From 768b492f4f87ee02318357f5d4e7c82fb87ac52a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Etienne=20T=C3=A9treault-Pinard?= Date: Wed, 26 Jul 2017 10:42:09 -0400 Subject: [PATCH] 1.29.2 --- dist/README.md | 36 +++++++++--------- dist/npm-ls.json | 18 ++++----- dist/plotly-basic.js | 4 +- dist/plotly-basic.min.js | 4 +- dist/plotly-cartesian.js | 4 +- dist/plotly-cartesian.min.js | 4 +- dist/plotly-finance.js | 4 +- dist/plotly-finance.min.js | 4 +- dist/plotly-geo-assets.js | 4 +- dist/plotly-geo.js | 4 +- dist/plotly-geo.min.js | 4 +- dist/plotly-gl2d.js | 19 ++++++---- dist/plotly-gl2d.min.js | 72 ++++++++++++++++++------------------ dist/plotly-gl3d.js | 27 ++++++++------ dist/plotly-gl3d.min.js | 30 +++++++-------- dist/plotly-mapbox.js | 4 +- dist/plotly-mapbox.min.js | 4 +- dist/plotly-with-meta.js | 27 ++++++++------ dist/plotly.js | 17 ++++++--- dist/plotly.min.js | 40 ++++++++++---------- package.json | 2 +- src/assets/geo_assets.js | 2 +- src/core.js | 2 +- 23 files changed, 178 insertions(+), 158 deletions(-) diff --git a/dist/README.md b/dist/README.md index 874d2d25581..f3a731d204f 100644 --- a/dist/README.md +++ b/dist/README.md @@ -37,11 +37,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-latest.min.js OR https://cdn.plot.ly/plotly-1.29.1.min.js +- using CDN URL https://cdn.plot.ly/plotly-latest.min.js OR https://cdn.plot.ly/plotly-1.29.2.min.js or as raw javascript: - using dist file `dist/plotly.js` -- using CDN URL https://cdn.plot.ly/plotly-latest.js OR https://cdn.plot.ly/plotly-1.29.1.js +- using CDN URL https://cdn.plot.ly/plotly-latest.js OR https://cdn.plot.ly/plotly-1.29.2.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` @@ -74,8 +74,8 @@ 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.29.1.js | -| CDN URL (tagged minified) | https://cdn.plot.ly/plotly-basic-1.29.1.min.js | +| CDN URL (tagged) | https://cdn.plot.ly/plotly-basic-1.29.2.js | +| CDN URL (tagged minified) | https://cdn.plot.ly/plotly-basic-1.29.2.min.js | | CommonJS | `require('plotly.js/lib/index-basic')` | | Raw size | Minified size | Minified + gzip size | @@ -92,8 +92,8 @@ 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.29.1.js | -| CDN URL (tagged minified) | https://cdn.plot.ly/plotly-cartesian-1.29.1.min.js | +| CDN URL (tagged) | https://cdn.plot.ly/plotly-cartesian-1.29.2.js | +| CDN URL (tagged minified) | https://cdn.plot.ly/plotly-cartesian-1.29.2.min.js | | CommonJS | `require('plotly.js/lib/index-cartesian')` | | Raw size | Minified size | Minified + gzip size | @@ -110,8 +110,8 @@ 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.29.1.js | -| CDN URL (tagged minified) | https://cdn.plot.ly/plotly-geo-1.29.1.min.js | +| CDN URL (tagged) | https://cdn.plot.ly/plotly-geo-1.29.2.js | +| CDN URL (tagged minified) | https://cdn.plot.ly/plotly-geo-1.29.2.min.js | | CommonJS | `require('plotly.js/lib/index-geo')` | | Raw size | Minified size | Minified + gzip size | @@ -128,13 +128,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.29.1.js | -| CDN URL (tagged minified) | https://cdn.plot.ly/plotly-gl3d-1.29.1.min.js | +| CDN URL (tagged) | https://cdn.plot.ly/plotly-gl3d-1.29.2.js | +| CDN URL (tagged minified) | https://cdn.plot.ly/plotly-gl3d-1.29.2.min.js | | CommonJS | `require('plotly.js/lib/index-gl3d')` | | Raw size | Minified size | Minified + gzip size | |------|-----------------|------------------------| -| 2.7 MB | 1.1 MB | 357.1 kB | +| 2.7 MB | 1.1 MB | 357.2 kB | ### plotly.js gl2d @@ -146,13 +146,13 @@ The `gl2d` partial bundle contains the `scatter`, `scattergl`, `pointcloud`, `he | 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.29.1.js | -| CDN URL (tagged minified) | https://cdn.plot.ly/plotly-gl2d-1.29.1.min.js | +| CDN URL (tagged) | https://cdn.plot.ly/plotly-gl2d-1.29.2.js | +| CDN URL (tagged minified) | https://cdn.plot.ly/plotly-gl2d-1.29.2.min.js | | CommonJS | `require('plotly.js/lib/index-gl2d')` | | Raw size | Minified size | Minified + gzip size | |------|-----------------|------------------------| -| 2.8 MB | 1.1 MB | 366.5 kB | +| 2.8 MB | 1.1 MB | 366.6 kB | ### plotly.js mapbox @@ -164,8 +164,8 @@ 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.29.1.js | -| CDN URL (tagged minified) | https://cdn.plot.ly/plotly-mapbox-1.29.1.min.js | +| CDN URL (tagged) | https://cdn.plot.ly/plotly-mapbox-1.29.2.js | +| CDN URL (tagged minified) | https://cdn.plot.ly/plotly-mapbox-1.29.2.min.js | | CommonJS | `require('plotly.js/lib/index-mapbox')` | | Raw size | Minified size | Minified + gzip size | @@ -182,8 +182,8 @@ The `finance` partial bundle contains the `scatter`, `bar`, `histogram`, `pie`, | dist bundle (minified) | `dist/plotly-finance.min.js` | | CDN URL (latest) | https://cdn.plot.ly/plotly-finance-latest.js | | CDN URL (latest minified) | https://cdn.plot.ly/plotly-finance-latest.min.js | -| CDN URL (tagged) | https://cdn.plot.ly/plotly-finance-1.29.1.js | -| CDN URL (tagged minified) | https://cdn.plot.ly/plotly-finance-1.29.1.min.js | +| CDN URL (tagged) | https://cdn.plot.ly/plotly-finance-1.29.2.js | +| CDN URL (tagged minified) | https://cdn.plot.ly/plotly-finance-1.29.2.min.js | | CommonJS | `require('plotly.js/lib/index-finance')` | | Raw size | Minified size | Minified + gzip size | diff --git a/dist/npm-ls.json b/dist/npm-ls.json index 6ac8d741a2a..4bec5d91408 100644 --- a/dist/npm-ls.json +++ b/dist/npm-ls.json @@ -1,6 +1,6 @@ { "name": "plotly.js", - "version": "1.29.1", + "version": "1.29.2", "dependencies": { "3d-view": { "version": "2.0.0", @@ -123,9 +123,9 @@ } }, "color-rgba": { - "version": "1.1.0", - "from": "color-rgba@>=1.0.4 <2.0.0", - "resolved": "https://registry.npmjs.org/color-rgba/-/color-rgba-1.1.0.tgz", + "version": "1.1.1", + "from": "color-rgba@>=1.1.1 <2.0.0", + "resolved": "https://registry.npmjs.org/color-rgba/-/color-rgba-1.1.1.tgz", "dependencies": { "clamp": { "version": "1.0.1", @@ -133,14 +133,14 @@ "resolved": "https://registry.npmjs.org/clamp/-/clamp-1.0.1.tgz" }, "color-parse": { - "version": "1.3.2", - "from": "color-parse@>=1.2.0 <2.0.0", - "resolved": "https://registry.npmjs.org/color-parse/-/color-parse-1.3.2.tgz", + "version": "1.3.4", + "from": "color-parse@>=1.3.4 <2.0.0", + "resolved": "https://registry.npmjs.org/color-parse/-/color-parse-1.3.4.tgz", "dependencies": { "color-name": { - "version": "1.1.2", + "version": "1.1.3", "from": "color-name@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.2.tgz" + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz" }, "is-plain-obj": { "version": "1.1.0", diff --git a/dist/plotly-basic.js b/dist/plotly-basic.js index fa7ab949b80..a3182d78905 100644 --- a/dist/plotly-basic.js +++ b/dist/plotly-basic.js @@ -1,5 +1,5 @@ /** -* plotly.js (basic) v1.29.1 +* plotly.js (basic) v1.29.2 * Copyright 2012-2017, Plotly, Inc. * All rights reserved. * Licensed under the MIT license @@ -29234,7 +29234,7 @@ exports.svgAttrs = { var Plotly = require('./plotly'); // package version injected by `npm run preprocess` -exports.version = '1.29.1'; +exports.version = '1.29.2'; // inject promise polyfill require('es6-promise').polyfill(); diff --git a/dist/plotly-basic.min.js b/dist/plotly-basic.min.js index 31fa3e5d156..abfbedce7c1 100644 --- a/dist/plotly-basic.min.js +++ b/dist/plotly-basic.min.js @@ -1,5 +1,5 @@ /** -* plotly.js (basic - minified) v1.29.1 +* plotly.js (basic - minified) v1.29.2 * Copyright 2012-2017, Plotly, Inc. * All rights reserved. * Licensed under the MIT license @@ -15,7 +15,7 @@ type:"brushstart"})}).tween("brush:brush",function(){var n=wr(f,e.x),r=wr(d,e.y) ;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:7}],60:[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"}}}},{}],61:[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;f0;t.each(function(t){var d,h=t[0].trace,p=h.error_x||{},g=h.error_y||{};h.ids&&(d=function(t){return t.id});var v=l.hasMarkers(h)&&h.marker.maxdisplayed>0;if(g.visible||p.visible){var m=a.select(this).selectAll("g.errorbar").data(t,d);m.exit().remove(),m.style("opacity",1);var y=m.enter().append("g").classed("errorbar",!0);f&&y.style("opacity",0).transition().duration(n.duration).style("opacity",1),i.setClipUrl(m,e.layerClipId),m.each(function(t){var e=a.select(this),i=r(t,c,u);if(!v||t.vis){var l;if(g.visible&&o(i.x)&&o(i.yh)&&o(i.ys)){var d=g.width;l="M"+(i.x-d)+","+i.yh+"h"+2*d+"m-"+d+",0V"+i.ys,i.noYS||(l+="m-"+d+",0h"+2*d);var h=e.select("path.yerror");s=!h.size(),s?h=e.append("path").style("vector-effect","non-scaling-stroke").classed("yerror",!0):f&&(h=h.transition().duration(n.duration).ease(n.easing)),h.attr("d",l)}if(p.visible&&o(i.y)&&o(i.xh)&&o(i.xs)){var m=(p.copy_ystyle?g:p).width;l="M"+i.xh+","+(i.y-m)+"v"+2*m+"m0,-"+m+"H"+i.xs,i.noXS||(l+="m0,-"+m+"v"+2*m);var y=e.select("path.xerror");s=!y.size(),s?y=e.append("path").style("vector-effect","non-scaling-stroke").classed("xerror",!0):f&&(y=y.transition().duration(n.duration).ease(n.easing)),y.attr("d",l)}}})}})}},{"../../traces/scatter/subtypes":273,"../drawing":58,d3:7,"fast-isnumeric":10}],66:[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":34,d3:7}],67:[function(t,e,n){"use strict";var r=t("../../lib/extend").extendFlat,a=t("../../plots/font_attributes");e.exports={hoverlabel:{bgcolor:{valType:"color",arrayOk:!0},bordercolor:{valType:"color",arrayOk:!0},font:{family:r({},a.family,{arrayOk:!0}),size:r({},a.size,{arrayOk:!0}),color:r({},a.color,{arrayOk:!0})},namelength:{valType:"integer",min:-1,arrayOk:!0}}}},{"../../lib/extend":142,"../../plots/font_attributes":207}],68:[function(t,e,n){"use strict";function r(t,e,n,r){r=r||a.identity,Array.isArray(t)&&(e[0][n]=r(t))}var a=t("../../lib"),o=t("../../registry");e.exports=function(t){for(var e=t.calcdata,n=t._fullLayout,i=0;i=0&&n.indexJ.width||$<0||$>J.height)return x.unhoverRaw(t,e)}if(E="xval"in e?w.flat(d,e.xval):w.p2c(L,W),N="yval"in e?w.flat(d,e.yval):w.p2c(C,$),!f(E[0])||!f(N[0]))return h.warn("Fx.hover failed",e,t),x.unhoverRaw(t,e)}var K=1/0;for(R=0;RX&&(Y.splice(0,X),K=Y[0].distance)}if(0===Y.length)return x.unhoverRaw(t,e);Y.sort(function(t,e){return t.distance-e.distance});var at=t._hoverdata,ot=[];for(I=0;I1,ct=y.combine(g.plot_bgcolor||y.background,g.paper_bgcolor),ut={hovermode:P,rotateLabels:st,bgColor:ct,container:g._hoverlayer,outerContainer:g._paperdiv,commonLabelOpts:g.hoverlabel},ft=a(Y,ut,t);if(o(Y,st?"xa":"ya"),i(ft,st),e.target&&e.target.tagName){var dt=_.getComponentMethod("annotations","hasClickToShow")(t,ot);v(u.select(e.target),dt?"pointer":"")}e.target&&!r&&c(t,e,at)&&(at&&t.emit("plotly_unhover",{event:e,points:at}),t.emit("plotly_hover",{event:e,points:t._hoverdata,xaxes:L,yaxes:C,xvals:E,yvals:N}))}function a(t,e,n){var r,a,o=e.hovermode,i=e.rotateLabels,l=e.bgColor,s=e.container,c=e.outerContainer,f=e.commonLabelOpts||{},d=e.fontFamily||k.HOVERFONT,h=e.fontSize||k.HOVERFONTSIZE,p=t[0],v=p.xa,x=p.ya,b="y"===o?"yLabel":"xLabel",_=p[b],w=(String(_)||"").split(" ")[0],A=c.node().getBoundingClientRect(),T=A.top,L=A.width,C=A.height,O=p.distance<=k.MAXDIST&&("x"===o||"y"===o);for(r=0;r-1&&r.length>p&&(r=p>3?r.substr(0,p-3)+"...":r.substr(0,p))}void 0!==t.extraText&&(a+=t.extraText),void 0!==t.zLabel?(void 0!==t.xLabel&&(a+="x: "+t.xLabel+"
"),void 0!==t.yLabel&&(a+="y: "+t.yLabel+"
"),a+=(a?"z: ":"")+t.zLabel):O&&t[o+"Label"]===_?a=t[("x"===o?"y":"x")+"Label"]||"":void 0===t.xLabel?void 0!==t.yLabel&&(a=t.yLabel):a=void 0===t.yLabel?t.xLabel:"("+t.xLabel+", "+t.yLabel+")",t.text&&!Array.isArray(t.text)&&(a+=(a?"
":"")+t.text),""===a&&(""===r&&e.remove(),a=r);var v=e.select("text.nums").call(m.font,t.fontFamily||d,t.fontSize||h,t.fontColor||f).text(a).attr("data-notex",1).call(g.positionText,0,0).call(g.convertToTspans,n),x=e.select("text.name"),b=0;r&&r!==a?(x.call(m.font,t.fontFamily||d,t.fontSize||h,c).text(r).attr("data-notex",1).call(g.positionText,0,0).call(g.convertToTspans,n),b=x.node().getBoundingClientRect().width+2*z):(x.remove(),e.select("rect").remove()),e.select("path").style({fill:c,stroke:f});var w,k,A=v.node().getBoundingClientRect(),D=t.xa._offset+(t.x0+t.x1)/2,P=t.ya._offset+(t.y0+t.y1)/2,E=Math.abs(t.x1-t.x0),N=Math.abs(t.y1-t.y0),I=A.width+S+z+b;t.ty0=T-A.top,t.bx=A.width+2*z,t.by=A.height+2*z,t.anchor="start",t.txwidth=A.width,t.tx2width=b,t.offset=0,i?(t.pos=D,w=P+N/2+I<=C,k=P-N/2-I>=0,"top"!==t.idealAlign&&w||!k?w?(P+=N/2,t.anchor="start"):t.anchor="middle":(P-=N/2,t.anchor="end")):(t.pos=P,w=D+E/2+I<=L,k=D-E/2-I>=0,"left"!==t.idealAlign&&w||!k?w?(D+=E/2,t.anchor="start"):t.anchor="middle":(D-=E/2,t.anchor="end")),v.attr("text-anchor",t.anchor),b&&x.attr("text-anchor",t.anchor),e.attr("transform","translate("+D+","+P+")"+(i?"rotate("+M+")":""))}),E}function o(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(!(o<.01)){if(a<-.01){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&&!(c<=0);i--)s=t[i],s.pos>e.pmax-1&&(s.del=!0,c--);for(i=0;i=0;l--)t[l].dp-=o;for(i=t.length-1;i>=0&&!(c<=0);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)?T: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 i(t,e){t.each(function(t){var n=u.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*(S+z),l=i+o*(t.txwidth+z),s=0,c=t.offset;"middle"===t.anchor&&(i-=t.tx2width/2,l-=t.tx2width/2),e&&(c*=-C,s=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*S+s)+","+(S+c)+"v"+(t.by/2-S)+"h"+r*t.bx+"v-"+t.by+"H"+(r*S+s)+"V"+(c-S)+"Z"),a.call(g.positionText,i+s,c+t.ty0-t.by/2+z),t.tx2width&&(n.select("text.name").call(g.positionText,l+o*z+s,c+t.ty0-t.by/2+z),n.select("rect").call(m.setRect,l+(o-1)*t.tx2width/2+s,c-t.by/2-1,t.tx2width,t.by+2))})}function l(t,e){function n(e,n,i){var l;if(o[n])l=o[n];else if(a[n]){var s=a[n];Array.isArray(s)&&Array.isArray(s[t.index[0]])&&(l=s[t.index[0]][t.index[1]])}else l=h.nestedProperty(r,i).get();l&&(t[e]=l)}var r=t.trace||{},a=t.cd[0],o=t.cd[t.index]||{};n("hoverinfo","hi","hoverinfo"),n("color","hbg","hoverlabel.bgcolor"),n("borderColor","hbc","hoverlabel.bordercolor"),n("fontFamily","htf","hoverlabel.font.family"),n("fontSize","hts","hoverlabel.font.size"),n("fontColor","htc","hoverlabel.font.color"),n("nameLength","hnl","hoverlabel.namelength"),t.posref="y"===e?(t.x0+t.x1)/2:(t.y0+t.y1)/2,t.x0=h.constrain(t.x0,0,t.xa._length),t.x1=h.constrain(t.x1,0,t.xa._length),t.y0=h.constrain(t.y0,0,t.ya._length),t.y1=h.constrain(t.y1,0,t.ya._length);var i;if(void 0!==t.xLabelVal){i="log"===t.xa.type&&t.xLabelVal<=0;var l=b.tickText(t.xa,t.xa.c2l(i?-t.xLabelVal:t.xLabelVal),"hover");i?0===t.xLabelVal?t.xLabel="0":t.xLabel="-"+l.text:t.xLabel=l.text,t.xVal=t.xa.c2d(t.xLabelVal)}if(void 0!==t.yLabelVal){i="log"===t.ya.type&&t.yLabelVal<=0;var s=b.tickText(t.ya,t.ya.c2l(i?-t.yLabelVal:t.yLabelVal),"hover");i?0===t.yLabelVal?t.yLabel="0":t.yLabel="-"+s.text:t.yLabel=s.text,t.yVal=t.ya.c2d(t.yLabelVal)}if(void 0!==t.zLabelVal&&(t.zLabel=String(t.zLabelVal)),!(isNaN(t.xerr)||"log"===t.xa.type&&t.xerr<=0)){var c=b.tickText(t.xa,t.xa.c2l(t.xerr),"hover").text;void 0!==t.xerrneg?t.xLabel+=" +"+c+" / -"+b.tickText(t.xa,t.xa.c2l(t.xerrneg),"hover").text:t.xLabel+=" \xb1 "+c,"x"===e&&(t.distance+=1)}if(!(isNaN(t.yerr)||"log"===t.ya.type&&t.yerr<=0)){var u=b.tickText(t.ya,t.ya.c2l(t.yerr),"hover").text;void 0!==t.yerrneg?t.yLabel+=" +"+u+" / -"+b.tickText(t.ya,t.ya.c2l(t.yerrneg),"hover").text:t.yLabel+=" \xb1 "+u,"y"===e&&(t.distance+=1)}var f=t.hoverinfo||t.trace.hoverinfo;return"all"!==f&&(f=f.split("+"),-1===f.indexOf("x")&&(t.xLabel=void 0),-1===f.indexOf("y")&&(t.yLabel=void 0),-1===f.indexOf("z")&&(t.zLabel=void 0),-1===f.indexOf("text")&&(t.text=void 0),-1===f.indexOf("name")&&(t.name=void 0)),t}function s(t,e){var n=e.hovermode,r=e.container,a=t[0],o=a.xa,i=a.ya,l=o.showspikes,s=i.showspikes;if(r.selectAll(".spikeline").remove(),"closest"===n&&(l||s)){var c=e.fullLayout,u=o._offset+(a.x0+a.x1)/2,f=i._offset+(a.y0+a.y1)/2,h=y.combine(c.plot_bgcolor,c.paper_bgcolor),p=d.readability(a.color,h)<1.5?y.contrast(h):a.color;if(s){var g=i.spikemode,v=i.spikethickness,x=i.spikecolor||p,b=i._boundingBox,_=(b.left+b.right)/2=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 u=t("d3"),f=t("fast-isnumeric"),d=t("tinycolor2"),h=t("../../lib"),p=t("../../lib/events"),g=t("../../lib/svg_text_utils"),v=t("../../lib/override_cursor"),m=t("../drawing"),y=t("../color"),x=t("../dragelement"),b=t("../../plots/cartesian/axes"),_=t("../../registry"),w=t("./helpers"),k=t("./constants"),M=k.YANGLE,A=Math.PI*M/180,T=1/Math.sin(A),L=Math.cos(A),C=Math.sin(A),S=k.HOVERARROWSIZE,z=k.HOVERTEXTPAD;n.hover=function(t,e,n,a){if("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)return r(t,e,n,a),void(t._lastHoverTime=Date.now());t._hoverTimer=setTimeout(function(){r(t,e,n,a),t._lastHoverTime=Date.now(),t._hoverTimer=void 0},k.HOVERMINTIME)},n.loneHover=function(t,e){var n={color:t.color||y.defaultLine,x0:t.x0||t.x||0,x1:t.x1||t.x||0,y0:t.y0||t.y||0,y1:t.y1||t.y||0,xLabel:t.xLabel,yLabel:t.yLabel,zLabel:t.zLabel,text:t.text,name:t.name,idealAlign:t.idealAlign,borderColor:t.borderColor,fontFamily:t.fontFamily,fontSize:t.fontSize,fontColor:t.fontColor,trace:{index:0,hoverinfo:""},xa:{_offset:0},ya:{_offset:0},index:0},r=u.select(e.container),o=e.outerContainer?u.select(e.outerContainer):r,l={hovermode:"closest",rotateLabels:!1,bgColor:e.bgColor||y.background,container:r,outerContainer:o},s=a([n],l,e.gd);return i(s,l.rotateLabels),s.node()}},{"../../lib":147,"../../lib/events":141,"../../lib/override_cursor":156,"../../lib/svg_text_utils":164,"../../plots/cartesian/axes":183,"../../registry":219,"../color":34,"../dragelement":55,"../drawing":58,"./constants":70,"./helpers":72,d3:7,"fast-isnumeric":10,tinycolor2:16}],74:[function(t,e,n){"use strict";var r=t("../../lib");e.exports=function(t,e,n,a){a=a||{},n("hoverlabel.bgcolor",a.bgcolor),n("hoverlabel.bordercolor",a.bordercolor),n("hoverlabel.namelength",a.namelength),r.coerceFont(n,"hoverlabel.font",a.font)}},{"../../lib":147}],75:[function(t,e,n){"use strict";function r(t){var e=l.isD3Selection(t)?t:i.select(t);e.selectAll("g.hovertext").remove(),e.selectAll(".spikeline").remove()}function a(t,e,n){return l.castOption(t,e,"hoverlabel."+n)}function o(t,e,n){function r(n){return l.coerceHoverinfo({hoverinfo:n},{_module:t._module},e)}return l.castOption(t,n,"hoverinfo",r)}var i=t("d3"),l=t("../../lib"),s=t("../dragelement"),c=t("./helpers"),u=t("./layout_attributes");e.exports={moduleType:"component",name:"fx",constants:t("./constants"),schema:{layout:u},attributes:t("./attributes"),layoutAttributes:u,supplyLayoutGlobalDefaults:t("./layout_global_defaults"),supplyDefaults:t("./defaults"),supplyLayoutDefaults:t("./layout_defaults"),calc:t("./calc"),getDistanceFunction:c.getDistanceFunction,getClosest:c.getClosest,inbox:c.inbox,appendArrayPointValue:c.appendArrayPointValue,castHoverOption:a,castHoverinfo:o,hover:t("./hover").hover,unhover:s.unhover,loneHover:t("./hover").loneHover,loneUnhover:r,click:t("./click")}},{"../../lib":147,"../dragelement":55,"./attributes":67,"./calc":68,"./click":69,"./constants":70,"./defaults":71,"./helpers":72,"./hover":73,"./layout_attributes":76,"./layout_defaults":77,"./layout_global_defaults":78,d3:7}],76:[function(t,e,n){"use strict";var r=t("../../lib/extend").extendFlat,a=t("../../plots/font_attributes"),o=t("./constants");e.exports={dragmode:{valType:"enumerated",values:["zoom","pan","select","lasso","orbit","turntable"],dflt:"zoom"},hovermode:{valType:"enumerated",values:["x","y","closest",!1]},hoverlabel:{bgcolor:{valType:"color"},bordercolor:{valType:"color"},font:{family:r({},a.family,{dflt:o.HOVERFONT}),size:r({},a.size,{dflt:o.HOVERFONTSIZE}),color:r({},a.color)},namelength:{valType:"integer",min:-1,dflt:15}}}},{"../../lib/extend":142,"../../plots/font_attributes":207,"./constants":70}],77:[function(t,e,n){"use strict";function r(t){for(var e=!0,n=0;n=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}},{}],85:[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":142,"../../plots/font_attributes":207,"../color/attributes":33}],86:[function(t,e,n){"use strict";e.exports={scrollBarWidth:4,scrollBarHeight:20,scrollBarColor:"#808BA4",scrollBarMargin:4}},{}],87:[function(t,e,n){"use strict";var r=t("../../registry"),a=t("../../lib"),o=t("./attributes"),i=t("../../plots/layout_attributes"),l=t("./helpers");e.exports=function(t,e,n){function s(t,e){return a.coerce(h,p,o,t,e)}for(var c,u,f,d,h=t.legend||{},p=e.legend={},g=0,v="normal",m=0;m1)){if(s("bgcolor",e.paper_bgcolor),s("bordercolor"),s("borderwidth"),a.coerceFont(s,"font",e.font),s("orientation"),"h"===p.orientation){var x=t.xaxis;x&&x.rangeslider&&x.rangeslider.visible?(c=0,f="left",u=1.1,d="bottom"):(c=0,f="left",u=-.1,d="top")}s("traceorder",v),l.isGrouped(e.legend)&&s("tracegroupgap"),s("x",c),s("xanchor",f),s("y",u),s("yanchor",d),a.noneOrAll(h,p,["x","y"])}}},{"../../lib":147,"../../plots/layout_attributes":210,"../../registry":219,"./attributes":85,"./helpers":90}],88:[function(t,e,n){"use strict";function r(t,e){function n(n){y.convertToTspans(n,e,function(){i(t,e)})}var r=t.data()[0][0],a=e._fullLayout,o=r.trace,l=p.traceIs(o,"pie"),s=o.index,c=l?r.label:o.name,u=t.selectAll("text.legendtext").data([0]);u.enter().append("text").classed("legendtext",!0),u.attr("text-anchor","start").classed("user-select-none",!0).call(v.font,a.legend.font).text(c),e._context.edits.legendText&&!l?u.call(y.makeEditable,{gd:e}).call(n).on("edit",function(t){this.text(t).call(n),this.text()||(t=" ");var a,o=r.trace._fullInput||{};if(-1!==["ohlc","candlestick"].indexOf(o.type)){var i=r.trace.transforms;a=i[i.length-1].direction+".name"}else a="name";f.restyle(e,a,t,s)}):u.call(n)}function a(t,e){var n,r=1,a=t.selectAll("rect").data([0]);a.enter().append("rect").classed("legendtoggle",!0).style("cursor","pointer").attr("pointer-events","all").call(m.fill,"rgba(0,0,0,0)"),a.on("mousedown",function(){n=(new Date).getTime(),n-e._legendMouseDownTimeL&&(r=Math.max(r-1,1)),1===r?n._clickTimeout=setTimeout(function(){o(t,e,r)},L):2===r&&(n._clickTimeout&&clearTimeout(n._clickTimeout),e._legendMouseDownTime=0,o(t,e,r))}})}function o(t,e,n){if(!e._dragged&&!e._editing){var r,a,o=e._fullLayout.hiddenlabels?e._fullLayout.hiddenlabels.slice():[],i=t.data()[0][0],l=e._fullData,s=i.trace,c=s.legendgroup,u=[];if(1===n&&T&&e.data&&e._context.showTips?(d.notifier("Double click on legend to isolate individual trace","long"),T=!1):T=!1,p.traceIs(s,"pie")){var h=i.label,g=o.indexOf(h);1===n?-1===g?o.push(h):o.splice(g,1):2===n&&(o=[],e.calcdata[0].forEach(function(t){h!==t.label&&o.push(t.label)}),e._fullLayout.hiddenlabels&&e._fullLayout.hiddenlabels.length===o.length&&-1===g&&(o=[])),f.relayout(e,"hiddenlabels",o)}else{var v,m=[],y=[];for(v=0;vr.width-(r.margin.r+r.margin.l)&&(x=0,g+=m,a.height=a.height+m,m=0),v.setTranslate(this,o+x,5+o+e.height/2+g),a.width+=i+n,a.height=Math.max(a.height,e.height),x+=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.each(function(e){var n=e[0];u.select(this).select(".legendtoggle").call(v.setRect,0,-n.height/2,(t._context.edits.legendText?0:a.width)+l,n.height)})}function s(t){var e=t._fullLayout,n=e.legend,r="left";A.isRightAnchor(n)?r="right":A.isCenterAnchor(n)&&(r="center");var a="top";A.isBottomAnchor(n)?a="bottom":A.isMiddleAnchor(n)&&(a="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}[a]||0),t:n.height*({bottom:1,middle:.5}[a]||0)})}function c(t){var e=t._fullLayout,n=e.legend,r="left";A.isRightAnchor(n)?r="right":A.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"),f=t("../../plotly"),d=t("../../lib"),h=t("../../plots/plots"),p=t("../../registry"),g=t("../dragelement"),v=t("../drawing"),m=t("../color"),y=t("../../lib/svg_text_utils"),x=t("./constants"),b=t("../../constants/interactions"),_=t("../../constants/alignment").LINE_SPACING,w=t("./get_legend_data"),k=t("./style"),M=t("./helpers"),A=t("./anchor_utils"),T=!0,L=b.DBLCLICKDELAY;e.exports=function(t){function e(t,e){S.attr("data-scroll",e).call(v.setTranslate,0,e),z.call(v.setRect,j,t,x.scrollBarWidth,x.scrollBarHeight),T.select("rect").attr({y:y.borderwidth-e})}var n=t._fullLayout,i="legend"+n._uid;if(n._infolayer&&t.calcdata){t._legendMouseDownTime||(t._legendMouseDownTime=0);var y=n.legend,b=n.showlegend&&w(t.calcdata,y),_=n.hiddenlabels||[];if(!n.showlegend||!b.length)return n._infolayer.selectAll(".legend").remove(),n._topdefs.select("#"+i).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 T=n._topdefs.selectAll("#"+i).data([0]);T.enter().append("clipPath").attr("id",i).append("rect");var C=M.selectAll("rect.bg").data([0]);C.enter().append("rect").attr({class:"bg","shape-rendering":"crispEdges"}),C.call(m.stroke,y.bordercolor),C.call(m.fill,y.bgcolor),C.style("stroke-width",y.borderwidth+"px");var S=M.selectAll("g.scrollbox").data([0]);S.enter().append("g").attr("class","scrollbox");var z=M.selectAll("rect.scrollbar").data([0]);z.enter().append("rect").attr({class:"scrollbar",rx:20,ry:2,width:0,height:0}).call(m.fill,"#808BA4");var O=S.selectAll("g.groups").data(b);O.enter().append("g").attr("class","groups"),O.exit().remove();var D=O.selectAll("g.traces").data(d.identity);D.enter().append("g").attr("class","traces"),D.exit().remove(),D.call(k,t).style("opacity",function(t){var e=t[0].trace;return p.traceIs(e,"pie")?-1!==_.indexOf(t[0].label)?.5:1:"legendonly"===e.visible?.5:1}).each(function(){u.select(this).call(r,t).call(a,t)});var P=0!==M.enter().size();P&&(l(t,O,D),s(t));var E=n.width,N=n.height;l(t,O,D),y.height>N?c(t):s(t);var I=n._size,R=I.l+I.w*y.x,F=I.t+I.h*(1-y.y);A.isRightAnchor(y)?R-=y.width:A.isCenterAnchor(y)&&(R-=y.width/2),A.isBottomAnchor(y)?F-=y.height:A.isMiddleAnchor(y)&&(F-=y.height/2);var j=y.width,B=I.w;j>B?(R=I.l,j=B):(R+j>E&&(R=E-j),R<0&&(R=0),j=Math.min(E-R,y.width));var H=y.height,q=I.h;H>q?(F=I.t,H=q):(F+H>N&&(F=N-H),F<0&&(F=0),H=Math.min(N-F,y.height)),v.setTranslate(M,R,F);var V,U,G=H-x.scrollBarHeight-2*x.scrollBarMargin,X=y.height-H;if(y.height<=H||t._context.staticPlot)C.attr({width:j-y.borderwidth,height:H-y.borderwidth,x:y.borderwidth/2,y:y.borderwidth/2}),v.setTranslate(S,0,0),T.select("rect").attr({width:j-2*y.borderwidth,height:H-2*y.borderwidth,x:y.borderwidth,y:y.borderwidth}),S.call(v.setClipUrl,i);else{V=x.scrollBarMargin,U=S.attr("data-scroll")||0,C.attr({width:j-2*y.borderwidth+x.scrollBarWidth+x.scrollBarMargin,height:H-y.borderwidth,x:y.borderwidth/2,y:y.borderwidth/2}),T.select("rect").attr({width:j-2*y.borderwidth+x.scrollBarWidth+x.scrollBarMargin,height:H-2*y.borderwidth,x:y.borderwidth,y:y.borderwidth-U}),S.call(v.setClipUrl,i),P&&e(V,U),M.on("wheel",null),M.on("wheel",function(){U=d.constrain(S.attr("data-scroll")-u.event.deltaY/G*X,-X,0),V=x.scrollBarMargin-U/X*G,e(V,U),0!==U&&U!==-X&&u.event.preventDefault()}),z.on(".drag",null),S.on(".drag",null);var Y=u.behavior.drag().on("drag",function(){V=d.constrain(u.event.y-x.scrollBarHeight/2,x.scrollBarMargin,x.scrollBarMargin+G),U=-(V-x.scrollBarMargin)/G*X,e(V,U)});z.call(Y),S.call(Y)}if(t._context.edits.legendPosition){var Z,W,$,Q;M.classed("cursor-move",!0),g.init({element:M.node(),gd:t,prepFn:function(){var t=v.getTranslate(M);$=t.x,Q=t.y},moveFn:function(t,e){var n=$+t,r=Q+e;v.setTranslate(M,n,r),Z=g.align(n,0,I.l,I.l+I.w,y.xanchor),W=g.align(r,0,I.t+I.h,I.t,y.yanchor)},doneFn:function(e,r,a){if(e&&void 0!==Z&&void 0!==W)f.relayout(t,{"legend.x":Z,"legend.y":W});else{var i=n._infolayer.selectAll("g.traces").filter(function(){var t=this.getBoundingClientRect();return a.clientX>=t.left&&a.clientX<=t.right&&a.clientY>=t.top&&a.clientY<=t.bottom});i.size()>0&&(1===r?M._clickTimeout=setTimeout(function(){o(i,t,r)},L):2===r&&(M._clickTimeout&&clearTimeout(M._clickTimeout),o(i,t,r)))}}})}}}},{"../../constants/alignment":130,"../../constants/interactions":131,"../../lib":147,"../../lib/svg_text_utils":164,"../../plotly":178,"../../plots/plots":212,"../../registry":219,"../color":34,"../dragelement":55,"../drawing":58,"./anchor_utils":84,"./constants":86,"./get_legend_data":89,"./helpers":90,"./style":92,d3:7}],89:[function(t,e,n){"use strict";var r=t("../../registry"),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;on[1])return n[1]}return a}function a(t){return t[0]}var l,c,u=t[0],f=u.trace,d=s.hasMarkers(f),h=s.hasText(f),p=s.hasLines(f);if(d||h||p){var g={},v={};d&&(g.mc=n("marker.color",a),g.mo=n("marker.opacity",o.mean,[.2,1]),g.ms=n("marker.size",o.mean,[2,16]),g.mlc=n("marker.line.color",a),g.mlw=n("marker.line.width",o.mean,[0,5]),v.marker={sizeref:1,sizemin:1,sizemode:"diameter"}),p&&(v.line={width:n("line.width",a,[0,10])}),h&&(g.tx="Aa",g.tp=n("textposition",a),g.ts=10,g.tc=n("textfont.color",a),g.tf=n("textfont.family",a)),l=[o.minExtend(u,g)],c=o.minExtend(f,v)}var m=r.select(this).select("g.legendpoints"),y=m.selectAll("path.scatterpts").data(d?l:[]);y.enter().append("path").classed("scatterpts",!0).attr("transform","translate(20,0)"),y.exit().remove(),y.call(i.pointStyle,c,e),d&&(l[0].mrc=3);var x=m.selectAll("g.pointtext").data(h?l:[]);x.enter().append("g").classed("pointtext",!0).append("text").attr("transform","translate(20,0)"),x.exit().remove(),x.selectAll("text").call(i.textPointStyle,c,e)}function f(t){var e=t[0].trace,n=e.marker||{},o=n.line||{},i=r.select(this).select("g.legendpoints").selectAll("path.legendbar").data(a.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=r.select(this),a=t[0],i=(a.mlw+1||o.width+1)-1;e.style("stroke-width",i+"px").call(l.fill,a.mc||n.color),i&&e.call(l.stroke,a.mlc||o.color)})}function d(t){var e=t[0].trace,n=r.select(this).select("g.legendpoints").selectAll("path.legendbox").data(a.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(){var t=e.line.width,n=r.select(this);n.style("stroke-width",t+"px").call(l.fill,e.fillcolor),t&&n.call(l.stroke,e.line.color)})}function h(t){var e=t[0].trace,n=r.select(this).select("g.legendpoints").selectAll("path.legendpie").data(a.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(c,t[0],e)}t.each(function(t){var e=r.select(this),n=e.selectAll("g.layers").data([0]);n.enter().append("g").classed("layers",!0),n.style("opacity",t[0].trace.opacity),n.selectAll("g.legendfill").data([t]).enter().append("g").classed("legendfill",!0),n.selectAll("g.legendlines").data([t]).enter().append("g").classed("legendlines",!0);var a=n.selectAll("g.legendsymbols").data([t]);a.enter().append("g").classed("legendsymbols",!0),a.selectAll("g.legendpoints").data([t]).enter().append("g").classed("legendpoints",!0)}).each(f).each(d).each(h).each(n).each(u)}},{"../../lib":147,"../../registry":219,"../../traces/pie/style_one":251,"../../traces/scatter/subtypes":273,"../color":34,"../drawing":58,d3:7}],93:[function(t,e,n){"use strict";function r(t,e){var n,r,a=e.currentTarget,o=a.getAttribute("data-attr"),i=a.getAttribute("data-val")||!0,l=t._fullLayout,s={},c=d.list(t,null,!0),f="on";if("zoom"===o){var h,p="in"===i?.5:2,g=(1+p)/2,v=(1-p)/2;for(r=0;r1)return r(["resetViews","toggleHover"]),i(m,n);u&&(r(["zoom3d","pan3d","orbitRotation","tableRotation"]),r(["resetCameraDefault3d","resetCameraLastSave3d"]),r(["hoverClosest3d"])),f&&(r(["zoomInGeo","zoomOutGeo","resetGeo"]),r(["hoverClosestGeo"]));var y=a(l),x=[];return((c||p)&&!y||g)&&(x=["zoom2d","pan2d"]),v&&(x=["pan2d"]),o(s)&&(x.push("select2d"),x.push("lasso2d")),x.length&&r(x),!c&&!p||y||g||r(["zoomIn2d","zoomOut2d","autoScale2d","resetScale2d"]),c&&h?r(["toggleHover"]):p?r(["hoverClosestGl2d"]):c?r(["toggleSpikelines","hoverClosestCartesian","hoverCompareCartesian"]):h?r(["hoverClosestPie"]):v&&r(["resetViewMapbox","toggleHover"]),i(m,n)}function a(t){for(var e=s.list({_fullLayout:t},null,!0),n=!0,r=0;r0)){var p=a(e,n,s);f("x",p[0]),f("y",p[1]),o.noneOrAll(t,e,["x","y"]),f("xanchor"),f("yanchor"),o.coerceFont(f,"font",n.font);var g=f("bgcolor");f("activecolor",i.contrast(g,c.lightAmount,c.darkAmount)),f("bordercolor"),f("borderwidth")}}},{"../../lib":147,"../color":34,"./attributes":97,"./button_attributes":98,"./constants":99}],101:[function(t,e,n){"use strict";function r(t){for(var e=m.list(t,"x",!0),n=[],r=0;rp&&(p=d)));return p>=h?[h,p]:void 0}}var a=t("../../lib"),o=t("../../plots/cartesian/axes"),i=t("./constants"),l=t("./helpers");e.exports=function(t){var e=t._fullLayout,n=a.filterVisible(e.shapes);if(n.length&&t._fullData.length)for(var l=0;lX&&r>Y&&!t.shiftKey?p.getCursor(a/n,1-o/r):"move";g(e,i),G=i.split("-")[0]}function o(e){j=f.getFromId(t,n.xref),B=f.getFromId(t,n.yref),H=m.getDataToPixel(t,j),q=m.getDataToPixel(t,B,!0),V=m.getPixelToData(t,j),U=m.getPixelToData(t,B,!0);var o="shapes["+r+"]";"path"===n.type?(R=n.path,F=o+".path"):(v=H(n.x0),y=q(n.y0),x=H(n.x1),b=q(n.y1),_=o+".x0",w=o+".y0",k=o+".x1",M=o+".y1"),vY&&(h[S]=n[P]=U(c),h[z]=n[E]=U(u)),d-f>X&&(h[O]=n[N]=V(f),h[D]=n[I]=V(d))}e.attr("d",i(t,n))}var h,v,y,x,b,_,w,k,M,A,T,L,C,S,z,O,D,P,E,N,I,R,F,j,B,H,q,V,U,G,X=10,Y=10,Z={element:e.node(),gd:t,prepFn:o,doneFn:l},W=Z.element.getBoundingClientRect();p.init(Z),e.node().onmousemove=a}function i(t,e){var n,r,a,o,i=e.type,s=f.getFromId(t,e.xref),c=f.getFromId(t,e.yref),u=t._fullLayout._size;if(s?(n=m.shapePositionToRange(s),r=function(t){return s._offset+s.r2p(n(t,!0))}):r=function(t){return u.l+u.w*t},c?(a=m.shapePositionToRange(c),o=function(t){return c._offset+c.r2p(a(t,!0))}):o=function(t){return u.t+u.h*(1-t)},"path"===i)return s&&"date"===s.type&&(r=m.decodeDate(r)),c&&"date"===c.type&&(o=m.decodeDate(o)),l(e.path,r,o);var d=r(e.x0),h=r(e.x1),p=o(e.y0),g=o(e.y1);if("line"===i)return"M"+d+","+p+"L"+h+","+g;if("rect"===i)return"M"+d+","+p+"H"+h+"V"+g+"H"+d+"Z";var v=(d+h)/2,y=(p+g)/2,x=Math.abs(v-d),b=Math.abs(y-p),_="A"+x+","+b,w=v+x+","+y;return"M"+w+_+" 0 1,1 "+v+","+(y-b)+_+" 0 0,1 "+w+"Z"}function l(t,e,n){return t.replace(v.segmentRE,function(t){var r=0,a=t.charAt(0),o=v.paramIsX[a],i=v.paramIsY[a],l=v.numParams[a],s=t.substr(1).replace(v.paramRE,function(t){return o[r]?t=e(t):i[r]&&(t=n(t)),r++,r>l&&(t="X"),t});return r>l&&(s=s.replace(/[\s,]*X.*/,""),u.log("Ignoring extra params in segment "+t)),a+s})}function s(t,e,n){return t.replace(v.segmentRE,function(t){var r=0,a=t.charAt(0),o=v.paramIsX[a],i=v.paramIsY[a],l=v.numParams[a];return a+t.substr(1).replace(v.paramRE,function(t){return r>=l?t:(o[r]?t=e(t):i[r]&&(t=n(t)),r++,t)})})}var c=t("../../plotly"),u=t("../../lib"),f=t("../../plots/cartesian/axes"),d=t("../color"),h=t("../drawing"),p=t("../dragelement"),g=t("../../lib/setcursor"),v=t("./constants"),m=t("./helpers");e.exports={draw:r,drawOne:a}},{"../../lib":147,"../../lib/setcursor":162,"../../plotly":178,"../../plots/cartesian/axes":183,"../color":34,"../dragelement":55,"../drawing":58,"./constants":112,"./helpers":115}],115:[function(t,e,n){"use strict";n.rangeToShapePosition=function(t){return"log"===t.type?t.r2d:function(t){return t}},n.shapePositionToRange=function(t){return"log"===t.type?t.d2r:function(t){return t}},n.decodeDate=function(t){return function(e){return e.replace&&(e=e.replace("_"," ")),t(e)}},n.encodeDate=function(t){return function(e){return t(e).replace(" ","_")}},n.getDataToPixel=function(t,e,r){var a,o=t._fullLayout._size;if(e){var i=n.shapePositionToRange(e);a=function(t){return e._offset+e.r2p(i(t,!0))},"date"===e.type&&(a=n.decodeDate(a))}else a=r?function(t){return o.t+o.h*(1-t)}:function(t){return o.l+o.w*t};return a},n.getPixelToData=function(t,e,r){var a,o=t._fullLayout._size;if(e){var i=n.rangeToShapePosition(e);a=function(t){return i(e.p2r(t-e._offset))}}else a=r?function(t){return 1-(t-o.t)/o.h}:function(t){return(t-o.l)/o.w};return a}},{}],116:[function(t,e,n){"use strict";var r=t("./draw");e.exports={moduleType:"component",name:"shapes",layoutAttributes:t("./attributes"),supplyLayoutDefaults:t("./defaults"),calcAutorange:t("./calc_autorange"),draw:r.draw,drawOne:r.drawOne}},{"./attributes":110,"./calc_autorange":111,"./defaults":113,"./draw":114}],117:[function(t,e,n){"use strict";var r=t("../../lib"),a=t("../../plots/cartesian/axes"),o=t("./attributes"),i=t("./helpers");e.exports=function(t,e,n,l,s){function c(n,a){return r.coerce(t,e,o,n,a)}if(l=l||{},s=s||{},!c("visible",!s.itemIsNotPlainObject))return e;c("layer"),c("opacity"),c("fillcolor"),c("line.color"),c("line.width"),c("line.dash");for(var u=t.path?"path":"rect",f=c("type",u),d=["x","y"],h=0;h<2;h++){var p=d[h],g={_fullLayout:n},v=a.coerceRef(t,e,g,p,"","paper");if("path"!==f){var m,y,x;"paper"!==v?(m=a.getFromId(g,v),x=i.rangeToShapePosition(m),y=i.shapePositionToRange(m)):y=x=r.identity;var b=p+"0",_=p+"1",w=t[b],k=t[_];t[b]=y(t[b],!0),t[_]=y(t[_],!0),a.coercePosition(e,g,c,v,b,.25),a.coercePosition(e,g,c,v,_,.75),e[b]=x(e[b]),e[_]=x(e[_]),t[b]=w,t[_]=k}}return"path"===f?c("path"):r.noneOrAll(t,e,["x0","x1","y0","y1"]),e}},{"../../lib":147,"../../plots/cartesian/axes":183,"./attributes":110,"./helpers":115}],118:[function(t,e,n){"use strict";var r=t("../../plots/font_attributes"),a=t("../../plots/pad_attributes"),o=t("../../lib/extend").extendFlat,i=t("../../lib/extend").extendDeep,l=t("../../plots/animation_attributes"),s=t("./constants"),c={_isLinkedToArray:"step",method:{valType:"enumerated",values:["restyle","relayout","animate","update","skip"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string"},value:{valType:"string"},execute:{valType:"boolean",dflt:!0}};e.exports={_isLinkedToArray:"slider",visible:{valType:"boolean",dflt:!0},active:{valType:"number",min:0,dflt:0},steps:c,lenmode:{valType:"enumerated",values:["fraction","pixels"],dflt:"fraction"},len:{valType:"number",min:0,dflt:1},x:{valType:"number",min:-2,max:3,dflt:0},pad:i({},a,{},{t:{dflt:20}}),xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left"},y:{valType:"number",min:-2,max:3,dflt:0},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"top"},transition:{duration:{valType:"number",min:0,dflt:150},easing:{valType:"enumerated",values:l.transition.easing.values,dflt:"cubic-in-out"}},currentvalue:{visible:{valType:"boolean",dflt:!0},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left"},offset:{valType:"number",dflt:10},prefix:{valType:"string"},suffix:{valType:"string"},font:o({},r,{})},font:o({},r,{}),activebgcolor:{valType:"color",dflt:s.gripBgActiveColor},bgcolor:{valType:"color",dflt:s.railBgColor},bordercolor:{valType:"color",dflt:s.railBorderColor},borderwidth:{valType:"number",min:0,dflt:s.railBorderWidth},ticklen:{valType:"number",min:0,dflt:s.tickLength},tickcolor:{valType:"color",dflt:s.tickColor},tickwidth:{valType:"number",min:0,dflt:1},minorticklen:{valType:"number",min:0,dflt:s.minorTickLength}}},{"../../lib/extend":142,"../../plots/animation_attributes":179,"../../plots/font_attributes":207,"../../plots/pad_attributes":211,"./constants":119}],119:[function(t,e,n){"use strict";e.exports={name:"sliders",containerClassName:"slider-container",groupClassName:"slider-group",inputAreaClass:"slider-input-area",railRectClass:"slider-rail-rect",railTouchRectClass:"slider-rail-touch-rect",gripRectClass:"slider-grip-rect",tickRectClass:"slider-tick-rect",inputProxyClass:"slider-input-proxy",labelsClass:"slider-labels",labelGroupClass:"slider-label-group",labelClass:"slider-label",currentValueClass:"slider-current-value",railHeight:5,menuIndexAttrName:"slider-active-index",autoMarginIdRoot:"slider-",minWidth:30,minHeight:30,textPadX:40,arrowOffsetX:4,railRadius:2,railWidth:5,railBorder:4,railBorderWidth:1,railBorderColor:"#bec8d9",railBgColor:"#f8fafc",railInset:8,stepInset:10,gripRadius:10,gripWidth:20,gripHeight:20,gripBorder:20,gripBorderWidth:1,gripBorderColor:"#bec8d9",gripBgColor:"#f6f8fa",gripBgActiveColor:"#dbdde0",labelPadding:8,labelOffset:0,tickWidth:1,tickColor:"#333",tickOffset:25,tickLength:7,minorTickOffset:25,minorTickColor:"#333",minorTickLength:4,currentValuePadding:8,currentValueInset:0}},{}],120:[function(t,e,n){"use strict";function r(t,e,n){function r(n,r){return o.coerce(t,e,l,n,r)}r("visible",a(t,e).length>0)&&(r("active"),r("x"),r("y"),o.noneOrAll(t,e,["x","y"]),r("xanchor"),r("yanchor"),r("len"),r("lenmode"),r("pad.t"),r("pad.r"),r("pad.b"),r("pad.l"),o.coerceFont(r,"font",n.font),r("currentvalue.visible")&&(r("currentvalue.xanchor"),r("currentvalue.prefix"),r("currentvalue.suffix"),r("currentvalue.offset"),o.coerceFont(r,"currentvalue.font",e.font)),r("transition.duration"),r("transition.easing"),r("bgcolor"),r("activebgcolor"),r("bordercolor"),r("borderwidth"),r("ticklen"),r("tickwidth"),r("tickcolor"),r("minorticklen"))}function a(t,e){function n(t,e){return o.coerce(r,a,u,t,e)}for(var r,a,i=t.steps||[],l=e.steps=[],s=0;s=n.steps.length&&(n.active=0),e.call(l,n).call(b,n).call(u,n).call(p,n).call(x,t,n).call(s,t,n),A.setTranslate(e,n.lx+n.pad.l,n.ly+n.pad.t),e.call(v,n,n.active/(n.steps.length-1),!1),e.call(l,n)}function l(t,e,n){if(e.currentvalue.visible){var r,a,o=t.selectAll("text").data([0]);switch(e.currentvalue.xanchor){case"right":r=e.inputAreaLength-C.currentValueInset-e.currentValueMaxWidth,a="left";break;case"center":r=.5*e.inputAreaLength,a="middle";break;default:r=C.currentValueInset,a="left"}o.enter().append("text").classed(C.labelClass,!0).classed("user-select-none",!0).attr({"text-anchor":a,"data-notex":1});var i=e.currentvalue.prefix?e.currentvalue.prefix:"";if("string"==typeof n)i+=n;else{i+=e.steps[e.active].label}e.currentvalue.suffix&&(i+=e.currentvalue.suffix),o.call(A.font,e.currentvalue.font).text(i).call(T.convertToTspans,e.gd);var l=T.lineCount(o),s=(e.currentValueMaxLines+1-l)*e.currentvalue.font.size*S;return T.positionText(o,r,s),o}}function s(t,e,n){ -var r=t.selectAll("rect."+C.gripRectClass).data([0]);r.enter().append("rect").classed(C.gripRectClass,!0).call(h,e,t,n).style("pointer-events","all"),r.attr({width:C.gripWidth,height:C.gripHeight,rx:C.gripRadius,ry:C.gripRadius}).call(M.stroke,n.bordercolor).call(M.fill,n.bgcolor).style("stroke-width",n.borderwidth+"px")}function c(t,e,n){var r=t.selectAll("text").data([0]);return r.enter().append("text").classed(C.labelClass,!0).classed("user-select-none",!0).attr({"text-anchor":"middle","data-notex":1}),r.call(A.font,n.font).text(e.step.label).call(T.convertToTspans,n.gd),r}function u(t,e){var n=t.selectAll("g."+C.labelsClass).data([0]);n.enter().append("g").classed(C.labelsClass,!0);var r=n.selectAll("g."+C.labelGroupClass).data(e.labelSteps);r.enter().append("g").classed(C.labelGroupClass,!0),r.exit().remove(),r.each(function(t){var n=w.select(this);n.call(c,t,e),A.setTranslate(n,m(e,t.fraction),C.tickOffset+e.ticklen+e.font.size*S+C.labelOffset+e.currentValueTotalHeight)})}function f(t,e,n,r,a){var o=Math.round(r*(n.steps.length-1));o!==n.active&&d(t,e,n,o,!0,a)}function d(t,e,n,r,a,o){var i=n.active;n._input.active=n.active=r;var s=n.steps[n.active];e.call(v,n,n.active/(n.steps.length-1),o),e.call(l,n),t.emit("plotly_sliderchange",{slider:n,step:n.steps[n.active],interaction:a,previousActive:i}),s&&s.method&&a&&(e._nextMethod?(e._nextMethod.step=s,e._nextMethod.doCallback=a,e._nextMethod.doTransition=o):(e._nextMethod={step:s,doCallback:a,doTransition:o},e._nextMethodRaf=window.requestAnimationFrame(function(){var n=e._nextMethod.step;n.method&&(n.execute&&k.executeAPICommand(t,n.method,n.args),e._nextMethod=null,e._nextMethodRaf=null)})))}function h(t,e,n){function r(){return n.data()[0]}var a=n.node(),o=w.select(e);t.on("mousedown",function(){var t=r();e.emit("plotly_sliderstart",{slider:t});var i=n.select("."+C.gripRectClass);w.event.stopPropagation(),w.event.preventDefault(),i.call(M.fill,t.activebgcolor);var l=y(t,w.mouse(a)[0]);f(e,n,t,l,!0),t._dragging=!0,o.on("mousemove",function(){var t=r(),o=y(t,w.mouse(a)[0]);f(e,n,t,o,!1)}),o.on("mouseup",function(){var t=r();t._dragging=!1,i.call(M.fill,t.bgcolor),o.on("mouseup",null),o.on("mousemove",null),e.emit("plotly_sliderend",{slider:t,step:t.steps[t.active]})})})}function p(t,e){var n=t.selectAll("rect."+C.tickRectClass).data(e.steps);n.enter().append("rect").classed(C.tickRectClass,!0),n.exit().remove(),n.attr({width:e.tickwidth+"px","shape-rendering":"crispEdges"}),n.each(function(t,n){var r=n%e.labelStride==0,a=w.select(this);a.attr({height:r?e.ticklen:e.minorticklen}).call(M.fill,e.tickcolor),A.setTranslate(a,m(e,n/(e.steps.length-1))-.5*e.tickwidth,(r?C.tickOffset:C.minorTickOffset)+e.currentValueTotalHeight)})}function g(t){t.labelSteps=[];for(var e=t.steps.length,n=0;n0&&(i=i.transition().duration(e.transition.duration).ease(e.transition.easing)),i.attr("transform","translate("+(o-.5*C.gripWidth)+","+e.currentValueTotalHeight+")")}}function m(t,e){return t.inputAreaStart+C.stepInset+(t.inputAreaLength-2*C.stepInset)*Math.min(1,Math.max(0,e))}function y(t,e){return Math.min(1,Math.max(0,(e-C.stepInset-t.inputAreaStart)/(t.inputAreaLength-2*C.stepInset-2*t.inputAreaStart)))}function x(t,e,n){var r=t.selectAll("rect."+C.railTouchRectClass).data([0]);r.enter().append("rect").classed(C.railTouchRectClass,!0).call(h,e,t,n).style("pointer-events","all"),r.attr({width:n.inputAreaLength,height:Math.max(n.inputAreaWidth,C.tickOffset+n.ticklen+n.labelHeight)}).call(M.fill,n.bgcolor).attr("opacity",0),A.setTranslate(r,0,n.currentValueTotalHeight)}function b(t,e){var n=t.selectAll("rect."+C.railRectClass).data([0]);n.enter().append("rect").classed(C.railRectClass,!0);var r=e.inputAreaLength-2*C.railInset;n.attr({width:r,height:C.railWidth,rx:C.railRadius,ry:C.railRadius,"shape-rendering":"crispEdges"}).call(M.stroke,e.bordercolor).call(M.fill,e.bgcolor).style("stroke-width",e.borderwidth+"px"),A.setTranslate(n,C.railInset,.5*(e.inputAreaWidth-C.railWidth)+e.currentValueTotalHeight)}function _(t){for(var e=t._fullLayout._pushmargin||{},n=Object.keys(e),r=0;r0?[0]:[]);if(l.enter().append("g").classed(C.containerClassName,!0).style("cursor","ew-resize"),l.exit().remove(),l.exit().size()&&_(t),0!==n.length){var s=l.selectAll("g."+C.groupClassName).data(n,a);s.enter().append("g").classed(C.groupClassName,!0),s.exit().each(function(e){w.select(this).remove(),e._commandObserver.remove(),delete e._commandObserver,k.autoMargin(t,C.autoMarginIdRoot+e._index)});for(var c=0;c0||d<0){var g={left:[-n,0],right:[n,0],top:[0,-n],bottom:[0,n]}[_.side];e.attr("transform","translate("+g+")")}}}var v,m=n.propContainer,y=n.propName,x=n.traceIndex,b=n.dfltName,_=n.avoid||{},w=n.attributes,k=n.transform,M=n.containerGroup,A=t._fullLayout,T=m.titlefont.family,L=m.titlefont.size,C=m.titlefont.color,S=1,z=!1,O=m.title.trim();"title"===y?v="titleText":-1!==y.indexOf("axis")?v="axisTitleText":y.indexOf(!0)&&(v="colorbarTitleText");var D=t._context.edits[v];""===O&&(S=0),O.match(d)&&(S=.2,z=!0,D||(O=""));var P=O||D;M||(M=A._infolayer.selectAll(".g-"+e).data([0]),M.enter().append("g").classed("g-"+e,!0));var E=M.selectAll("text").data(P?[0]:[]);if(E.enter().append("text"),E.text(O).attr("class",e),E.exit().remove(),P){E.call(h);var N="Click to enter "+b+" title";D&&(O?E.on(".opacity",null):function(){S=0,z=!0,O=N,E.text(O).on("mouseover.opacity",function(){r.select(this).transition().duration(f.SHOW_PLACEHOLDER).style("opacity",1)}).on("mouseout.opacity",function(){r.select(this).transition().duration(f.HIDE_PLACEHOLDER).style("opacity",0)})}(),E.call(u.makeEditable,{gd:t}).on("edit",function(e){void 0!==x?o.restyle(t,y,e,x):o.relayout(t,y,e)}).on("cancel",function(){this.text(this.attr("data-unformatted")).call(h)}).on("input",function(t){this.text(t||" ").call(u.positionText,w.x,w.y)})),E.classed("js-placeholder",z)}}},{"../../constants/interactions":131,"../../lib":147,"../../lib/svg_text_utils":164,"../../plotly":178,"../../plots/plots":212,"../color":34,"../drawing":58,d3:7,"fast-isnumeric":10}],124:[function(t,e,n){"use strict";var r=t("../../plots/font_attributes"),a=t("../color/attributes"),o=t("../../lib/extend").extendFlat,i=t("../../plots/pad_attributes"),l={_isLinkedToArray:"button",method:{valType:"enumerated",values:["restyle","relayout","animate","update","skip"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string",dflt:""},execute:{valType:"boolean",dflt:!0}};e.exports={_isLinkedToArray:"updatemenu",_arrayAttrRegexps:[/^updatemenus\[(0|[1-9][0-9]+)\]\.buttons/],visible:{valType:"boolean"},type:{valType:"enumerated",values:["dropdown","buttons"],dflt:"dropdown"},direction:{valType:"enumerated",values:["left","right","up","down"],dflt:"down"},active:{valType:"integer",min:-1,dflt:0},showactive:{valType:"boolean",dflt:!0},buttons:l,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:"top"},pad:o({},i,{}),font:o({},r,{}),bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:a.borderLine},borderwidth:{valType:"number",min:0,dflt:1}}},{"../../lib/extend":142,"../../plots/font_attributes":207,"../../plots/pad_attributes":211,"../color/attributes":33}],125:[function(t,e,n){"use strict";e.exports={name:"updatemenus",containerClassName:"updatemenu-container",headerGroupClassName:"updatemenu-header-group",headerClassName:"updatemenu-header",headerArrowClassName:"updatemenu-header-arrow",dropdownButtonGroupClassName:"updatemenu-dropdown-button-group",dropdownButtonClassName:"updatemenu-dropdown-button",buttonClassName:"updatemenu-button",itemRectClassName:"updatemenu-item-rect",itemTextClassName:"updatemenu-item-text",menuIndexAttrName:"updatemenu-active-index",autoMarginIdRoot:"updatemenu-",blankHeaderOpts:{label:" "},minWidth:30,minHeight:30,textPadX:24,arrowPadX:16,rx:2,ry:2,textOffsetX:12,textOffsetY:3,arrowOffsetX:4,gapButtonHeader:5,gapButton:2,activeColor:"#F4FAFF",hoverColor:"#F4FAFF",arrowSymbol:{left:"\u25c4",right:"\u25ba",up:"\u25b2",down:"\u25bc"}}},{}],126:[function(t,e,n){"use strict";function r(t,e,n){function r(n,r){return o.coerce(t,e,l,n,r)}r("visible",a(t,e).length>0)&&(r("active"),r("direction"),r("type"),r("showactive"),r("x"),r("y"),o.noneOrAll(t,e,["x","y"]),r("xanchor"),r("yanchor"),r("pad.t"),r("pad.r"),r("pad.b"),r("pad.l"),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,u,t,e)}for(var r,a,i=t.buttons||[],l=e.buttons=[],s=0;s0?[0]:[]);if(o.enter().append("g").classed(S.containerClassName,!0).style("cursor","pointer"),o.exit().remove(),o.exit().size()&&_(t),0!==n.length){var u=o.selectAll("g."+S.headerGroupClassName).data(n,a);u.enter().append("g").classed(S.headerGroupClassName,!0);var f=o.selectAll("g."+S.dropdownButtonGroupClassName).data([0]);f.enter().append("g").classed(S.dropdownButtonGroupClassName,!0).style("pointer-events","all");for(var d=0;dk,T=r.barLength+2*r.barPad,L=r.barWidth+2*r.barPad,C=p,S=v+m;S+L>c&&(S=c-L);var z=this.container.selectAll("rect.scrollbar-horizontal").data(A?[0]:[]);z.exit().on(".drag",null).remove(),z.enter().append("rect").classed("scrollbar-horizontal",!0).call(o.fill,r.barColor),A?(this.hbar=z.attr({rx:r.barRadius,ry:r.barRadius,x:C,y:S,width:T,height:L}),this._hbarXMin=C+T/2,this._hbarTranslateMax=k-T):(delete this.hbar,delete this._hbarXMin,delete this._hbarTranslateMax);var O=m>M,D=r.barWidth+2*r.barPad,P=r.barLength+2*r.barPad,E=p+g,N=v;E+D>s&&(E=s-D);var I=this.container.selectAll("rect.scrollbar-vertical").data(O?[0]:[]);I.exit().on(".drag",null).remove(),I.enter().append("rect").classed("scrollbar-vertical",!0).call(o.fill,r.barColor),O?(this.vbar=I.attr({rx:r.barRadius,ry:r.barRadius,x:E,y:N,width:D,height:P}),this._vbarYMin=N+P/2,this._vbarTranslateMax=M-P):(delete this.vbar,delete this._vbarYMin,delete this._vbarTranslateMax);var R=this.id,F=u-.5,j=O?f+D+.5:f+.5,B=d-.5,H=A?h+L+.5:h+.5,q=l._topdefs.selectAll("#"+R).data(A||O?[0]:[]);if(q.exit().remove(),q.enter().append("clipPath").attr("id",R).append("rect"),A||O?(this._clipRect=q.select("rect").attr({x:Math.floor(F),y:Math.floor(B),width:Math.ceil(j)-Math.floor(F),height:Math.ceil(H)-Math.floor(B)}),this.container.call(i.setClipUrl,R),this.bg.attr({x:p,y:v,width:g,height:m})):(this.bg.attr({width:0,height:0}),this.container.on("wheel",null).on(".drag",null).call(i.setClipUrl,null),delete this._clipRect),A||O){var V=a.behavior.drag().on("dragstart",function(){a.event.sourceEvent.preventDefault()}).on("drag",this._onBoxDrag.bind(this));this.container.on("wheel",null).on("wheel",this._onBoxWheel.bind(this)).on(".drag",null).call(V);var U=a.behavior.drag().on("dragstart",function(){a.event.sourceEvent.preventDefault(),a.event.sourceEvent.stopPropagation()}).on("drag",this._onBarDrag.bind(this));A&&this.hbar.on(".drag",null).call(U),O&&this.vbar.on(".drag",null).call(U)}this.setTranslate(e,n)},r.prototype.disable=function(){(this.hbar||this.vbar)&&(this.bg.attr({width:0,height:0}),this.container.on("wheel",null).on(".drag",null).call(i.setClipUrl,null),delete this._clipRect),this.hbar&&(this.hbar.on(".drag",null),this.hbar.remove(),delete this.hbar,delete this._hbarXMin,delete this._hbarTranslateMax),this.vbar&&(this.vbar.on(".drag",null),this.vbar.remove(),delete this.vbar,delete this._vbarYMin,delete this._vbarTranslateMax)},r.prototype._onBoxDrag=function(){var t=this.translateX,e=this.translateY;this.hbar&&(t-=a.event.dx),this.vbar&&(e-=a.event.dy),this.setTranslate(t,e)},r.prototype._onBoxWheel=function(){var t=this.translateX,e=this.translateY;this.hbar&&(t+=a.event.deltaY),this.vbar&&(e+=a.event.deltaY),this.setTranslate(t,e)},r.prototype._onBarDrag=function(){var t=this.translateX,e=this.translateY;if(this.hbar){var n=t+this._hbarXMin,r=n+this._hbarTranslateMax;t=(l.constrain(a.event.x,n,r)-n)/(r-n)*(this.position.w-this._box.w)}if(this.vbar){var o=e+this._vbarYMin,i=o+this._vbarTranslateMax;e=(l.constrain(a.event.y,o,i)-o)/(i-o)*(this.position.h-this._box.h)}this.setTranslate(t,e)},r.prototype.setTranslate=function(t,e){var n=this.position.w-this._box.w,r=this.position.h-this._box.h;if(t=l.constrain(t||0,0,n),e=l.constrain(e||0,0,r),this.translateX=t,this.translateY=e,this.container.call(i.setTranslate,this._box.l-this.position.l-t,this._box.t-this.position.t-e),this._clipRect&&this._clipRect.attr({x:Math.floor(this.position.l+t-.5),y:Math.floor(this.position.t+e-.5)}),this.hbar){var a=t/n;this.hbar.call(i.setTranslate,t+a*this._hbarTranslateMax,e)}if(this.vbar){var o=e/r;this.vbar.call(i.setTranslate,t,e+o*this._vbarTranslateMax)}}},{"../../lib":147,"../color":34,"../drawing":58,d3:7}],130:[function(t,e,n){"use strict";e.exports={FROM_BL:{left:0,center:.5,right:1,bottom:0,middle:.5,top:1},FROM_TL:{left:0,center:.5,right:1,bottom:1,middle:.5,top:0},LINE_SPACING:1.3,MID_SHIFT:.35}},{}],131:[function(t,e,n){"use strict";e.exports={SHOW_PLACEHOLDER:100,HIDE_PLACEHOLDER:1e3,DBLCLICKDELAY:300,DESELECTDIM:.2}},{}],132:[function(t,e,n){"use strict";e.exports={BADNUM:void 0,FP_SAFE:Number.MAX_VALUE/1e4,ONEAVGYEAR:315576e5,ONEAVGMONTH:26298e5,ONEDAY:864e5,ONEHOUR:36e5,ONEMIN:6e4,ONESEC:1e3,EPOCHJD:2440587.5,ALMOST_EQUAL:1-1e-6}},{}],133:[function(t,e,n){"use strict";e.exports={entityToUnicode:{mu:"\u03bc","#956":"\u03bc",amp:"&","#28":"&",lt:"<","#60":"<",gt:">","#62":">",nbsp:"\xa0","#160":"\xa0",times:"\xd7","#215":"\xd7",plusmn:"\xb1","#177":"\xb1",deg:"\xb0","#176":"\xb0"}}},{}],134:[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}},{}],135:[function(t,e,n){"use strict";var r=t("./plotly");n.version="1.29.1",t("es6-promise").polyfill(),t("../build/plotcss"),t("./fonts/mathjax_config"),n.plot=r.plot,n.newPlot=r.newPlot,n.restyle=r.restyle,n.relayout=r.relayout,n.redraw=r.redraw,n.update=r.update,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=t("./plot_api/register"),n.toImage=t("./plot_api/to_image"),n.downloadImage=t("./snapshot/download"),n.validate=t("./plot_api/validate"),n.addFrames=r.addFrames,n.deleteFrames=r.deleteFrames,n.animate=r.animate,n.register(t("./traces/scatter")),n.register([t("./components/fx"),t("./components/legend"),t("./components/annotations"),t("./components/annotations3d"),t("./components/shapes"),t("./components/images"),t("./components/updatemenus"),t("./components/sliders"),t("./components/rangeslider"),t("./components/rangeselector")]),n.Icons=t("../build/ploticon"),n.Plots=r.Plots,n.Fx=t("./components/fx"),n.Snapshot=t("./snapshot"),n.PlotSchema=t("./plot_api/plot_schema"),n.Queue=t("./lib/queue"),n.d3=t("d3")},{"../build/plotcss":1,"../build/ploticon":2,"./components/annotations":27,"./components/annotations3d":32,"./components/fx":75,"./components/images":83,"./components/legend":91,"./components/rangeselector":103,"./components/rangeslider":109,"./components/shapes":116,"./components/sliders":122,"./components/updatemenus":128,"./fonts/mathjax_config":136,"./lib/queue":159,"./plot_api/plot_schema":172,"./plot_api/register":173,"./plot_api/set_plot_config":174,"./plot_api/to_image":176,"./plot_api/validate":177,"./plotly":178,"./snapshot":224,"./snapshot/download":221,"./traces/scatter":263,d3:7,"es6-promise":8}],136:[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},{}],137:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("../constants/numerical").BADNUM,o=/^['"%,$#\s']+|[, ]|['"%,$#\s']+$/g;e.exports=function(t){return"string"==typeof t&&(t=t.replace(o,"")),r(t)?Number(t):a}},{"../constants/numerical":132,"fast-isnumeric":10}],138:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("tinycolor2"),o=t("../plots/attributes"),i=t("../components/colorscale/get_scale"),l=(Object.keys(t("../components/colorscale/scales")),t("./nested_property")),s=/^([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)},validateFunction:function(t,e){e.coerceNumber&&(t=+t);for(var n=e.values,r=0;ra.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;!0!==r.strict&&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;if("string"==typeof t&&t.substr(0,r)===n&&s.test(t.substr(r)))return void e.set(t);e.set(n)},validateFunction:function(t,e){var n=e.dflt,r=n.length;return t===n||"string"==typeof t&&!(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 a=t.split("+"),o=0;o0&&(i=i.transition().duration(e.transition.duration).ease(e.transition.easing)),i.attr("transform","translate("+(o-.5*C.gripWidth)+","+e.currentValueTotalHeight+")")}}function m(t,e){return t.inputAreaStart+C.stepInset+(t.inputAreaLength-2*C.stepInset)*Math.min(1,Math.max(0,e))}function y(t,e){return Math.min(1,Math.max(0,(e-C.stepInset-t.inputAreaStart)/(t.inputAreaLength-2*C.stepInset-2*t.inputAreaStart)))}function x(t,e,n){var r=t.selectAll("rect."+C.railTouchRectClass).data([0]);r.enter().append("rect").classed(C.railTouchRectClass,!0).call(h,e,t,n).style("pointer-events","all"),r.attr({width:n.inputAreaLength,height:Math.max(n.inputAreaWidth,C.tickOffset+n.ticklen+n.labelHeight)}).call(M.fill,n.bgcolor).attr("opacity",0),A.setTranslate(r,0,n.currentValueTotalHeight)}function b(t,e){var n=t.selectAll("rect."+C.railRectClass).data([0]);n.enter().append("rect").classed(C.railRectClass,!0);var r=e.inputAreaLength-2*C.railInset;n.attr({width:r,height:C.railWidth,rx:C.railRadius,ry:C.railRadius,"shape-rendering":"crispEdges"}).call(M.stroke,e.bordercolor).call(M.fill,e.bgcolor).style("stroke-width",e.borderwidth+"px"),A.setTranslate(n,C.railInset,.5*(e.inputAreaWidth-C.railWidth)+e.currentValueTotalHeight)}function _(t){for(var e=t._fullLayout._pushmargin||{},n=Object.keys(e),r=0;r0?[0]:[]);if(l.enter().append("g").classed(C.containerClassName,!0).style("cursor","ew-resize"),l.exit().remove(),l.exit().size()&&_(t),0!==n.length){var s=l.selectAll("g."+C.groupClassName).data(n,a);s.enter().append("g").classed(C.groupClassName,!0),s.exit().each(function(e){w.select(this).remove(),e._commandObserver.remove(),delete e._commandObserver,k.autoMargin(t,C.autoMarginIdRoot+e._index)});for(var c=0;c0||d<0){var g={left:[-n,0],right:[n,0],top:[0,-n],bottom:[0,n]}[_.side];e.attr("transform","translate("+g+")")}}}var v,m=n.propContainer,y=n.propName,x=n.traceIndex,b=n.dfltName,_=n.avoid||{},w=n.attributes,k=n.transform,M=n.containerGroup,A=t._fullLayout,T=m.titlefont.family,L=m.titlefont.size,C=m.titlefont.color,S=1,z=!1,O=m.title.trim();"title"===y?v="titleText":-1!==y.indexOf("axis")?v="axisTitleText":y.indexOf(!0)&&(v="colorbarTitleText");var D=t._context.edits[v];""===O&&(S=0),O.match(d)&&(S=.2,z=!0,D||(O=""));var P=O||D;M||(M=A._infolayer.selectAll(".g-"+e).data([0]),M.enter().append("g").classed("g-"+e,!0));var E=M.selectAll("text").data(P?[0]:[]);if(E.enter().append("text"),E.text(O).attr("class",e),E.exit().remove(),P){E.call(h);var N="Click to enter "+b+" title";D&&(O?E.on(".opacity",null):function(){S=0,z=!0,O=N,E.text(O).on("mouseover.opacity",function(){r.select(this).transition().duration(f.SHOW_PLACEHOLDER).style("opacity",1)}).on("mouseout.opacity",function(){r.select(this).transition().duration(f.HIDE_PLACEHOLDER).style("opacity",0)})}(),E.call(u.makeEditable,{gd:t}).on("edit",function(e){void 0!==x?o.restyle(t,y,e,x):o.relayout(t,y,e)}).on("cancel",function(){this.text(this.attr("data-unformatted")).call(h)}).on("input",function(t){this.text(t||" ").call(u.positionText,w.x,w.y)})),E.classed("js-placeholder",z)}}},{"../../constants/interactions":131,"../../lib":147,"../../lib/svg_text_utils":164,"../../plotly":178,"../../plots/plots":212,"../color":34,"../drawing":58,d3:7,"fast-isnumeric":10}],124:[function(t,e,n){"use strict";var r=t("../../plots/font_attributes"),a=t("../color/attributes"),o=t("../../lib/extend").extendFlat,i=t("../../plots/pad_attributes"),l={_isLinkedToArray:"button",method:{valType:"enumerated",values:["restyle","relayout","animate","update","skip"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string",dflt:""},execute:{valType:"boolean",dflt:!0}};e.exports={_isLinkedToArray:"updatemenu",_arrayAttrRegexps:[/^updatemenus\[(0|[1-9][0-9]+)\]\.buttons/],visible:{valType:"boolean"},type:{valType:"enumerated",values:["dropdown","buttons"],dflt:"dropdown"},direction:{valType:"enumerated",values:["left","right","up","down"],dflt:"down"},active:{valType:"integer",min:-1,dflt:0},showactive:{valType:"boolean",dflt:!0},buttons:l,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:"top"},pad:o({},i,{}),font:o({},r,{}),bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:a.borderLine},borderwidth:{valType:"number",min:0,dflt:1}}},{"../../lib/extend":142,"../../plots/font_attributes":207,"../../plots/pad_attributes":211,"../color/attributes":33}],125:[function(t,e,n){"use strict";e.exports={name:"updatemenus",containerClassName:"updatemenu-container",headerGroupClassName:"updatemenu-header-group",headerClassName:"updatemenu-header",headerArrowClassName:"updatemenu-header-arrow",dropdownButtonGroupClassName:"updatemenu-dropdown-button-group",dropdownButtonClassName:"updatemenu-dropdown-button",buttonClassName:"updatemenu-button",itemRectClassName:"updatemenu-item-rect",itemTextClassName:"updatemenu-item-text",menuIndexAttrName:"updatemenu-active-index",autoMarginIdRoot:"updatemenu-",blankHeaderOpts:{label:" "},minWidth:30,minHeight:30,textPadX:24,arrowPadX:16,rx:2,ry:2,textOffsetX:12,textOffsetY:3,arrowOffsetX:4,gapButtonHeader:5,gapButton:2,activeColor:"#F4FAFF",hoverColor:"#F4FAFF",arrowSymbol:{left:"\u25c4",right:"\u25ba",up:"\u25b2",down:"\u25bc"}}},{}],126:[function(t,e,n){"use strict";function r(t,e,n){function r(n,r){return o.coerce(t,e,l,n,r)}r("visible",a(t,e).length>0)&&(r("active"),r("direction"),r("type"),r("showactive"),r("x"),r("y"),o.noneOrAll(t,e,["x","y"]),r("xanchor"),r("yanchor"),r("pad.t"),r("pad.r"),r("pad.b"),r("pad.l"),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,u,t,e)}for(var r,a,i=t.buttons||[],l=e.buttons=[],s=0;s0?[0]:[]);if(o.enter().append("g").classed(S.containerClassName,!0).style("cursor","pointer"),o.exit().remove(),o.exit().size()&&_(t),0!==n.length){var u=o.selectAll("g."+S.headerGroupClassName).data(n,a);u.enter().append("g").classed(S.headerGroupClassName,!0);var f=o.selectAll("g."+S.dropdownButtonGroupClassName).data([0]);f.enter().append("g").classed(S.dropdownButtonGroupClassName,!0).style("pointer-events","all");for(var d=0;dk,T=r.barLength+2*r.barPad,L=r.barWidth+2*r.barPad,C=p,S=v+m;S+L>c&&(S=c-L);var z=this.container.selectAll("rect.scrollbar-horizontal").data(A?[0]:[]);z.exit().on(".drag",null).remove(),z.enter().append("rect").classed("scrollbar-horizontal",!0).call(o.fill,r.barColor),A?(this.hbar=z.attr({rx:r.barRadius,ry:r.barRadius,x:C,y:S,width:T,height:L}),this._hbarXMin=C+T/2,this._hbarTranslateMax=k-T):(delete this.hbar,delete this._hbarXMin,delete this._hbarTranslateMax);var O=m>M,D=r.barWidth+2*r.barPad,P=r.barLength+2*r.barPad,E=p+g,N=v;E+D>s&&(E=s-D);var I=this.container.selectAll("rect.scrollbar-vertical").data(O?[0]:[]);I.exit().on(".drag",null).remove(),I.enter().append("rect").classed("scrollbar-vertical",!0).call(o.fill,r.barColor),O?(this.vbar=I.attr({rx:r.barRadius,ry:r.barRadius,x:E,y:N,width:D,height:P}),this._vbarYMin=N+P/2,this._vbarTranslateMax=M-P):(delete this.vbar,delete this._vbarYMin,delete this._vbarTranslateMax);var R=this.id,F=u-.5,j=O?f+D+.5:f+.5,B=d-.5,H=A?h+L+.5:h+.5,q=l._topdefs.selectAll("#"+R).data(A||O?[0]:[]);if(q.exit().remove(),q.enter().append("clipPath").attr("id",R).append("rect"),A||O?(this._clipRect=q.select("rect").attr({x:Math.floor(F),y:Math.floor(B),width:Math.ceil(j)-Math.floor(F),height:Math.ceil(H)-Math.floor(B)}),this.container.call(i.setClipUrl,R),this.bg.attr({x:p,y:v,width:g,height:m})):(this.bg.attr({width:0,height:0}),this.container.on("wheel",null).on(".drag",null).call(i.setClipUrl,null),delete this._clipRect),A||O){var V=a.behavior.drag().on("dragstart",function(){a.event.sourceEvent.preventDefault()}).on("drag",this._onBoxDrag.bind(this));this.container.on("wheel",null).on("wheel",this._onBoxWheel.bind(this)).on(".drag",null).call(V);var U=a.behavior.drag().on("dragstart",function(){a.event.sourceEvent.preventDefault(),a.event.sourceEvent.stopPropagation()}).on("drag",this._onBarDrag.bind(this));A&&this.hbar.on(".drag",null).call(U),O&&this.vbar.on(".drag",null).call(U)}this.setTranslate(e,n)},r.prototype.disable=function(){(this.hbar||this.vbar)&&(this.bg.attr({width:0,height:0}),this.container.on("wheel",null).on(".drag",null).call(i.setClipUrl,null),delete this._clipRect),this.hbar&&(this.hbar.on(".drag",null),this.hbar.remove(),delete this.hbar,delete this._hbarXMin,delete this._hbarTranslateMax),this.vbar&&(this.vbar.on(".drag",null),this.vbar.remove(),delete this.vbar,delete this._vbarYMin,delete this._vbarTranslateMax)},r.prototype._onBoxDrag=function(){var t=this.translateX,e=this.translateY;this.hbar&&(t-=a.event.dx),this.vbar&&(e-=a.event.dy),this.setTranslate(t,e)},r.prototype._onBoxWheel=function(){var t=this.translateX,e=this.translateY;this.hbar&&(t+=a.event.deltaY),this.vbar&&(e+=a.event.deltaY),this.setTranslate(t,e)},r.prototype._onBarDrag=function(){var t=this.translateX,e=this.translateY;if(this.hbar){var n=t+this._hbarXMin,r=n+this._hbarTranslateMax;t=(l.constrain(a.event.x,n,r)-n)/(r-n)*(this.position.w-this._box.w)}if(this.vbar){var o=e+this._vbarYMin,i=o+this._vbarTranslateMax;e=(l.constrain(a.event.y,o,i)-o)/(i-o)*(this.position.h-this._box.h)}this.setTranslate(t,e)},r.prototype.setTranslate=function(t,e){var n=this.position.w-this._box.w,r=this.position.h-this._box.h;if(t=l.constrain(t||0,0,n),e=l.constrain(e||0,0,r),this.translateX=t,this.translateY=e,this.container.call(i.setTranslate,this._box.l-this.position.l-t,this._box.t-this.position.t-e),this._clipRect&&this._clipRect.attr({x:Math.floor(this.position.l+t-.5),y:Math.floor(this.position.t+e-.5)}),this.hbar){var a=t/n;this.hbar.call(i.setTranslate,t+a*this._hbarTranslateMax,e)}if(this.vbar){var o=e/r;this.vbar.call(i.setTranslate,t,e+o*this._vbarTranslateMax)}}},{"../../lib":147,"../color":34,"../drawing":58,d3:7}],130:[function(t,e,n){"use strict";e.exports={FROM_BL:{left:0,center:.5,right:1,bottom:0,middle:.5,top:1},FROM_TL:{left:0,center:.5,right:1,bottom:1,middle:.5,top:0},LINE_SPACING:1.3,MID_SHIFT:.35}},{}],131:[function(t,e,n){"use strict";e.exports={SHOW_PLACEHOLDER:100,HIDE_PLACEHOLDER:1e3,DBLCLICKDELAY:300,DESELECTDIM:.2}},{}],132:[function(t,e,n){"use strict";e.exports={BADNUM:void 0,FP_SAFE:Number.MAX_VALUE/1e4,ONEAVGYEAR:315576e5,ONEAVGMONTH:26298e5,ONEDAY:864e5,ONEHOUR:36e5,ONEMIN:6e4,ONESEC:1e3,EPOCHJD:2440587.5,ALMOST_EQUAL:1-1e-6}},{}],133:[function(t,e,n){"use strict";e.exports={entityToUnicode:{mu:"\u03bc","#956":"\u03bc",amp:"&","#28":"&",lt:"<","#60":"<",gt:">","#62":">",nbsp:"\xa0","#160":"\xa0",times:"\xd7","#215":"\xd7",plusmn:"\xb1","#177":"\xb1",deg:"\xb0","#176":"\xb0"}}},{}],134:[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}},{}],135:[function(t,e,n){"use strict";var r=t("./plotly");n.version="1.29.2",t("es6-promise").polyfill(),t("../build/plotcss"),t("./fonts/mathjax_config"),n.plot=r.plot,n.newPlot=r.newPlot,n.restyle=r.restyle,n.relayout=r.relayout,n.redraw=r.redraw,n.update=r.update,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=t("./plot_api/register"),n.toImage=t("./plot_api/to_image"),n.downloadImage=t("./snapshot/download"),n.validate=t("./plot_api/validate"),n.addFrames=r.addFrames,n.deleteFrames=r.deleteFrames,n.animate=r.animate,n.register(t("./traces/scatter")),n.register([t("./components/fx"),t("./components/legend"),t("./components/annotations"),t("./components/annotations3d"),t("./components/shapes"),t("./components/images"),t("./components/updatemenus"),t("./components/sliders"),t("./components/rangeslider"),t("./components/rangeselector")]),n.Icons=t("../build/ploticon"),n.Plots=r.Plots,n.Fx=t("./components/fx"),n.Snapshot=t("./snapshot"),n.PlotSchema=t("./plot_api/plot_schema"),n.Queue=t("./lib/queue"),n.d3=t("d3")},{"../build/plotcss":1,"../build/ploticon":2,"./components/annotations":27,"./components/annotations3d":32,"./components/fx":75,"./components/images":83,"./components/legend":91,"./components/rangeselector":103,"./components/rangeslider":109,"./components/shapes":116,"./components/sliders":122,"./components/updatemenus":128,"./fonts/mathjax_config":136,"./lib/queue":159,"./plot_api/plot_schema":172,"./plot_api/register":173,"./plot_api/set_plot_config":174,"./plot_api/to_image":176,"./plot_api/validate":177,"./plotly":178,"./snapshot":224,"./snapshot/download":221,"./traces/scatter":263,d3:7,"es6-promise":8}],136:[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},{}],137:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("../constants/numerical").BADNUM,o=/^['"%,$#\s']+|[, ]|['"%,$#\s']+$/g;e.exports=function(t){return"string"==typeof t&&(t=t.replace(o,"")),r(t)?Number(t):a}},{"../constants/numerical":132,"fast-isnumeric":10}],138:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("tinycolor2"),o=t("../plots/attributes"),i=t("../components/colorscale/get_scale"),l=(Object.keys(t("../components/colorscale/scales")),t("./nested_property")),s=/^([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)},validateFunction:function(t,e){e.coerceNumber&&(t=+t);for(var n=e.values,r=0;ra.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;!0!==r.strict&&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;if("string"==typeof t&&t.substr(0,r)===n&&s.test(t.substr(r)))return void e.set(t);e.set(n)},validateFunction:function(t,e){var n=e.dflt,r=n.length;return t===n||"string"==typeof t&&!(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 a=t.split("+"),o=0;o0&&(i=i.replace(/0+$/,"").replace(/[\.]$/,"")),r+=":"+i}return r}function s(t){return t.formatDate("yyyy")}function c(t){return t.formatDate("M yyyy")}function u(t){return t.formatDate("M d")}function f(t){return t.formatDate("M d, yyyy")}var d=t("d3"),h=t("fast-isnumeric"),p=t("./loggers").error,g=t("./mod"),v=t("../constants/numerical"),m=v.BADNUM,y=v.ONEDAY,x=v.ONEHOUR,b=v.ONEMIN,_=v.ONESEC,w=v.EPOCHJD,k=t("../registry"),M=d.time.format.utc,A=/^\s*(-?\d\d\d\d|\d\d)(-(\d?\d)(-(\d?\d)([ Tt]([01]?\d|2[0-3])(:([0-5]\d)(:([0-5]\d(\.\d+)?))?(Z|z|[+\-]\d\d:?\d\d)?)?)?)?)?\s*$/m,T=/^\s*(-?\d\d\d\d|\d\d)(-(\d?\di?)(-(\d?\d)([ Tt]([01]?\d|2[0-3])(:([0-5]\d)(:([0-5]\d(\.\d+)?))?(Z|z|[+\-]\d\d:?\d\d)?)?)?)?)?\s*$/m,L=(new Date).getFullYear()-70;n.dateTick0=function(t,e){return r(t)?e?k.getComponentMethod("calendars","CANONICAL_SUNDAY")[t]:k.getComponentMethod("calendars","CANONICAL_TICK")[t]:e?"2000-01-02":"2000-01-01"},n.dfltRange=function(t){return r(t)?k.getComponentMethod("calendars","DFLTRANGE")[t]:["2000-01-01","2001-01-01"]},n.isJSDate=function(t){return"object"==typeof t&&null!==t&&"function"==typeof t.getTime};var C,S;n.dateTime2ms=function(t,e){if(n.isJSDate(t))return t=Number(t)-t.getTimezoneOffset()*b,t>=C&&t<=S?t:m;if("string"!=typeof t&&"number"!=typeof t)return m;t=String(t);var a=r(e),o=t.charAt(0);!a||"G"!==o&&"g"!==o||(t=t.substr(1),e="");var i=a&&"chinese"===e.substr(0,7),l=t.match(i?T:A);if(!l)return m;var s=l[1],c=l[3]||"1",u=Number(l[5]||1),f=Number(l[7]||0),d=Number(l[9]||0),h=Number(l[11]||0);if(a){if(2===s.length)return m;s=Number(s);var p;try{var g=k.getComponentMethod("calendars","getCal")(e);if(i){var v="i"===c.charAt(c.length-1);c=parseInt(c,10),p=g.newDate(s,g.toMonthIndex(s,c,v),u)}else p=g.newDate(s,Number(c),u)}catch(t){return m}return p?(p.toJD()-w)*y+f*x+d*b+h*_:m}s=2===s.length?(Number(s)+2e3-L)%100+L:Number(s),c-=1;var M=new Date(Date.UTC(2e3,c,u,f,d));return M.setUTCFullYear(s),M.getUTCMonth()!==c?m:M.getUTCDate()!==u?m:M.getTime()+h*_},C=n.MIN_MS=n.dateTime2ms("-9999"),S=n.MAX_MS=n.dateTime2ms("9999-12-31 23:59:59.9999"),n.isDateTime=function(t,e){return n.dateTime2ms(t,e)!==m};var z=90*y,O=3*x,D=5*b;n.ms2DateTime=function(t,e,n){if("number"!=typeof t||!(t>=C&&t<=S))return m;e||(e=0);var a,i,l,s,c,u,f=Math.floor(10*g(t+.05,1)),d=Math.round(t-f/10);if(r(n)){var h=Math.floor(d/y)+w,p=Math.floor(g(t,y));try{a=k.getComponentMethod("calendars","getCal")(n).fromJD(h).formatDate("yyyy-mm-dd")}catch(t){a=M("G%Y-%m-%d")(new Date(d))}if("-"===a.charAt(0))for(;a.length<11;)a="-0"+a.substr(1);else for(;a.length<10;)a="0"+a;i=e=C+y&&t<=S-y))return m;var e=Math.floor(10*g(t+.05,1)),n=new Date(Math.round(t-e/10));return o(d.time.format("%Y-%m-%d")(n),n.getHours(),n.getMinutes(),n.getSeconds(),10*n.getUTCMilliseconds()+e)},n.cleanDate=function(t,e,a){if(n.isJSDate(t)||"number"==typeof t){if(r(a))return p("JS Dates and milliseconds are incompatible with world calendars",t),e;if(!(t=n.ms2DateTimeLocal(+t))&&void 0!==e)return e}else if(!n.isDateTime(t,a))return p("unrecognized date",t),e;return t};var P=/%\d?f/g,E=[59,59.9,59.99,59.999,59.9999],N=M("%Y"),I=M("%b %Y"),R=M("%b %-d"),F=M("%b %-d, %Y");n.formatDate=function(t,e,n,a){var o,d;if(a=r(a)&&a,e)return i(e,t,a);if(a)try{var h=Math.floor((t+.05)/y)+w,p=k.getComponentMethod("calendars","getCal")(a).fromJD(h);"y"===n?d=s(p):"m"===n?d=c(p):"d"===n?(o=s(p),d=u(p)):(o=f(p),d=l(t,n))}catch(t){return"Invalid"}else{var g=new Date(Math.floor(t+.05));"y"===n?d=N(g):"m"===n?d=I(g):"d"===n?(o=N(g),d=R(g)):(o=F(g),d=l(t,n))}return d+(o?"\n"+o:"")};var j=3*y;n.incrementMonth=function(t,e,n){n=r(n)&&n;var a=g(t,y);if(t=Math.round(t-a),n)try{var o=Math.round(t/y)+w,i=k.getComponentMethod("calendars","getCal")(n),l=i.fromJD(o);return e%12?i.add(l,e,"m"):i.add(l,e/12,"y"),(l.toJD()-w)*y+a}catch(e){p("invalid ms "+t+" in calendar "+n)}var s=new Date(t+j);return s.setUTCMonth(s.getUTCMonth()+e)+a-j},n.findExactDates=function(t,e){for(var n,a,o=0,i=0,l=0,s=0,c=r(e)&&k.getComponentMethod("calendars","getCal")(e),u=0;u1||g<0||g>1?null:{x:t+s*g,y:e+f*g}}function a(t,e,n,r,a){var o=r*t+a*e;if(o<0)return r*r+a*a;if(o>n){var i=r-t,l=a-e;return i*i+l*l}var s=r*e-a*t;return s*s/n}var o=t("./mod");n.segmentsIntersect=r,n.segmentDistance=function(t,e,n,o,i,l,s,c){if(r(t,e,n,o,i,l,s,c))return 0;var u=n-t,f=o-e,d=s-i,h=c-l,p=u*u+f*f,g=d*d+h*h,v=Math.min(a(u,f,p,i-t,l-e),a(u,f,p,s-t,c-e),a(d,h,g,t-i,e-l),a(d,h,g,n-i,o-l));return Math.sqrt(v)};var i,l,s;n.getTextLocation=function(t,e,n,r){if(t===l&&r===s||(i={},l=t,s=r),i[n])return i[n];var a=t.getPointAtLength(o(n-r/2,e)),c=t.getPointAtLength(o(n+r/2,e)),u=Math.atan((c.y-a.y)/(c.x-a.x)),f=t.getPointAtLength(o(n,e)),d=(4*f.x+a.x+c.x)/6,h=(4*f.y+a.y+c.y)/6,p={x:d,y:h,theta:u};return i[n]=p,p},n.clearLocationCache=function(){l=null},n.getVisibleSegment=function(t,e,n){function r(e){var n=t.getPointAtLength(e);0===e?a=n:e===f&&(o=n);var r=n.xl?n.x-l:0,u=n.yc?n.y-c:0;return Math.sqrt(r*r+u*u)}for(var a,o,i=e.left,l=e.right,s=e.top,c=e.bottom,u=0,f=t.getTotalLength(),d=f,h=r(u);h;){if((u+=h+n)>d)return;h=r(u)}for(h=r(d);h;){if(d-=h+n,u>d)return;h=r(d)}return{min:u,max:d,len:d-u,total:f,isClosed:0===u&&d===f&&Math.abs(a.x-o.x)<.1&&Math.abs(a.y-o.y)<.1}}},{"./mod":152}],146:[function(t,e,n){"use strict";e.exports=function(t){return t}},{}],147:[function(t,e,n){"use strict";var r=t("d3"),a=t("fast-isnumeric"),o=t("../constants/numerical"),i=o.FP_SAFE,l=o.BADNUM,s=e.exports={};s.nestedProperty=t("./nested_property"),s.isPlainObject=t("./is_plain_object"),s.isArray=t("./is_array"),s.mod=t("./mod"),s.toLogRange=t("./to_log_range"),s.relinkPrivateKeys=t("./relink_private"),s.ensureArray=t("./ensure_array");var c=t("./coerce");s.valObjects=c.valObjects,s.coerce=c.coerce,s.coerce2=c.coerce2,s.coerceFont=c.coerceFont,s.coerceHoverinfo=c.coerceHoverinfo,s.validate=c.validate;var u=t("./dates");s.dateTime2ms=u.dateTime2ms,s.isDateTime=u.isDateTime,s.ms2DateTime=u.ms2DateTime,s.ms2DateTimeLocal=u.ms2DateTimeLocal,s.cleanDate=u.cleanDate,s.isJSDate=u.isJSDate,s.formatDate=u.formatDate,s.incrementMonth=u.incrementMonth,s.dateTick0=u.dateTick0,s.dfltRange=u.dfltRange,s.findExactDates=u.findExactDates,s.MIN_MS=u.MIN_MS,s.MAX_MS=u.MAX_MS;var f=t("./search");s.findBin=f.findBin,s.sorterAsc=f.sorterAsc,s.sorterDes=f.sorterDes,s.distinctVals=f.distinctVals,s.roundUp=f.roundUp;var d=t("./stats");s.aggNums=d.aggNums,s.len=d.len,s.mean=d.mean,s.variance=d.variance,s.stdev=d.stdev,s.interp=d.interp;var h=t("./matrix");s.init2dArray=h.init2dArray,s.transposeRagged=h.transposeRagged,s.dot=h.dot,s.translationMatrix=h.translationMatrix,s.rotationMatrix=h.rotationMatrix,s.rotationXYMatrix=h.rotationXYMatrix,s.apply2DTransform=h.apply2DTransform,s.apply2DTransform2=h.apply2DTransform2;var p=t("./geometry2d");s.segmentsIntersect=p.segmentsIntersect,s.segmentDistance=p.segmentDistance,s.getTextLocation=p.getTextLocation,s.clearLocationCache=p.clearLocationCache,s.getVisibleSegment=p.getVisibleSegment;var g=t("./extend");s.extendFlat=g.extendFlat,s.extendDeep=g.extendDeep,s.extendDeepAll=g.extendDeepAll,s.extendDeepNoArrays=g.extendDeepNoArrays;var v=t("./loggers");s.log=v.log,s.warn=v.warn,s.error=v.error,s.notifier=t("./notifier"),s.filterUnique=t("./filter_unique"),s.filterVisible=t("./filter_visible"),s.pushUnique=t("./push_unique"),s.cleanNumber=t("./clean_number"),s.ensureNumber=function(t){return a(t)?(t=Number(t),t<-i||t>i?l:a(t)?Number(t):l):l},s.noop=t("./noop"),s.identity=t("./identity"),s.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))},s.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},s.simpleMap=function(t,e,n,r){for(var a=t.length,o=new Array(a),i=0;i-1||u!==1/0&&u>=Math.pow(2,n)?t(e,n,r):s},s.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},s.smooth=function(t,e){if((e=Math.round(e)||0)<2)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;n=l&&(a-=l*Math.floor(a/l)),a<0?a=-1-a:a>=i&&(a=l-1-a),o+=t[a]*c[r];u[n]=o}return u},s.syncOrAsync=function(t,e,n){function r(){return s.syncOrAsync(t,e,n)}for(var a,o;t.length;)if(o=t.splice(0,1)[0],(a=o(e))&&a.then)return a.then(r).then(void 0,s.promiseError);return n&&n(e)},s.stripTrailingSlash=function(t){return"/"===t.substr(-1)?t.substr(0,t.length-1):t},s.noneOrAll=function(t,e,n){if(t){var r,a,o=!1,i=!0;for(r=0;r1?a+i[1]:"";if(o&&(i.length>1||l.length>4||n))for(;r.test(l);)l=l.replace(r,"$1"+o+"$2");return l+s}},{"../constants/numerical":132,"./clean_number":137,"./coerce":138,"./dates":139,"./ensure_array":140,"./extend":142,"./filter_unique":143,"./filter_visible":144,"./geometry2d":145,"./identity":146,"./is_array":148,"./is_plain_object":149,"./loggers":150,"./matrix":151,"./mod":152,"./nested_property":153,"./noop":154,"./notifier":155,"./push_unique":158,"./relink_private":160,"./search":161,"./stats":163,"./to_log_range":165,d3:7,"fast-isnumeric":10}],148:[function(t,e,n){"use strict";var r="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer:{isView:function(){return!1}};e.exports=function(t){return Array.isArray(t)||r.isView(t)}},{}],149:[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}},{}],150:[function(t,e,n){"use strict";function r(t,e){if(t.apply)t.apply(t,e);else for(var n=0;n1){for(var t=["LOG:"],e=0;e0){for(var t=["WARN:"],e=0;e0){for(var t=["ERROR:"],e=0;e=0;e--){if(r=t[e][0],o=t[e][1],s=!1,h(r))for(n=r.length-1;n>=0;n--)a(r[n],i(o,n))?s?r[n]=void 0:r.pop():s=!0;else if("object"==typeof r&&null!==r)for(l=Object.keys(r),s=!1,n=l.length-1;n>=0;n--)a(r[l[n]],i(o,l[n]))?delete r[l[n]]:s=!0;if(s)return}}function u(t){return void 0===t||null===t||"object"==typeof t&&(h(t)?!t.length:!Object.keys(t).length)}function f(t,e,n){return{set:function(){throw"bad container"},get:function(){},astr:e,parts:n,obj:t}}var d=t("fast-isnumeric"),h=t("./is_array"),p=t("./is_plain_object"),g=t("../plot_api/container_array_match");e.exports=function(t,e){if(d(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(".");l/g),l=0;li||r===a||rs)&&(!e||!u(t))}function n(t,e){var n=t[0],c=t[1];if(n===a||ni||c===a||cs)return!1;var u,f,d,h,p,g=r.length,v=r[0][0],m=r[0][1],y=0;for(u=1;uMath.max(f,v)||c>Math.max(d,m)))if(cu||Math.abs(r(i,d))>a)return!0;return!1};o.filter=function(t,e){function n(n){t.push(n);var l=r.length,s=a;r.splice(o+1);for(var c=s+1;c1){n(t.pop())}return{addPt:n,raw:t,filtered:r}}},{"../constants/numerical":132,"./matrix":151}],158:[function(t,e,n){"use strict";e.exports=function(t,e){if(e instanceof RegExp){var n,r=e.toString();for(n=0;no.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;ne}function i(t,e){return t>=e}var l=t("fast-isnumeric"),s=t("./loggers");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;f90&&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;le[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;at.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":10}],164:[function(t,e,n){"use strict";function r(t,e){return t.node().getBoundingClientRect()[e]}function a(t){return t.replace(m,"\\lt ").replace(y,"\\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){if(!t)return null;var n=t.match(e);return n&&(n[3]||n[4])}function l(t,e){if(!t)return"";for(var n=0;n1)for(var a=1;a doesnt match end tag <"+t+">. Pretending it did match.",e),o=c[c.length-1].node}(M);else{var N=y[4],I={type:M},R=i(N,z);if(R?(R=R.replace(E,"$1 fill:"),A&&(R+=";"+A)):A&&(R=A),R&&(I.style=R),"a"===M){l=!0;var F=i(N,O);if(F){var j=document.createElement("a");j.href=F,-1!==k.indexOf(j.protocol)&&(I.href=encodeURI(F),I.target=i(N,D)||"_blank",I.popup=i(N,P))}}r(I)}}return l}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"),g=t("../constants/alignment").LINE_SPACING,v=/([^$]*)([$]+[^$]*[$]+)([^$]*)/;n.convertToTspans=function(t,e,a){function i(){u.empty()||(d=t.attr("class")+"-math",u.select("svg."+d).remove()),t.text("").style("white-space","pre"),c(t.node(),l)&&t.style("pointer-events","all"),n.positionText(t),a&&a.call(t)}var l=t.text(),s=!t.attr("data-notex")&&"undefined"!=typeof MathJax&&l.match(v),u=f.select(t.node().parentNode);if(!u.empty()){var d=t.attr("class")?t.attr("class").split(" ")[0]:"text";return d+="-math",u.selectAll("svg."+d).remove(),u.selectAll("g."+d+"-group").remove(),t.style("display",null).attr({"data-unformatted":l,"data-math":"N"}),s?(e&&e._promises||[]).push(new Promise(function(e){t.style("display","none");var n={fontSize:parseInt(t.style("font-size"),10)};o(s[2],n,function(n,o,s){u.selectAll("svg."+d).remove(),u.selectAll("g."+d+"-group").remove();var c=n&&n.select("svg");if(!c||!c.node())return i(),void e();var f=u.append("g").classed(d+"-group",!0).attr({"pointer-events":"none","data-unformatted":l,"data-math":"Y"});f.node().appendChild(c.node()),o&&o.node()&&c.node().insertBefore(o.node().cloneNode(!0),c.node().firstChild),c.attr({class:d,height:s.height,preserveAspectRatio:"xMinYMin meet"}).style({overflow:"visible","pointer-events":"none"});var h=t.style("fill")||"black";c.select("g").attr({fill:h,stroke:h});var p=r(c,"width"),g=r(c,"height"),v=+t.attr("x")-p*{start:0,middle:.5,end:1}[t.attr("text-anchor")||"start"],m=parseInt(t.style("font-size"),10)||r(t,"height"),y=-m/4;"y"===d[0]?(f.attr({transform:"rotate("+[-90,+t.attr("x"),+t.attr("y")]+") translate("+[-p/2,y-g/2]+")"}),c.attr({x:+t.attr("x"),y:+t.attr("y")})):"l"===d[0]?c.attr({x:t.attr("x"),y:y-g/2}):"a"===d[0]?c.attr({x:0,y:y}):c.attr({x:v,y:+t.attr("y")+y-g/2}),a&&a.call(t,f),e(f)})})):i(),t}};var m=/(<|<|<)/g,y=/(>|>|>)/g,x={sup:"font-size:70%",sub:"font-size:70%",b:"font-weight:bold",i:"font-style:italic",a:"cursor:pointer",span:"",em:"font-style:italic;font-weight:bold"},b={sub:"0.3em",sup:"-0.6em"},_={sub:"-0.21em",sup:"0.42em"},w="\u200b",k=["http:","https:","mailto:","",void 0,":"],M=new RegExp("]*)?/?>","g"),A=Object.keys(p.entityToUnicode).map(function(t){return{regExp:new RegExp("&"+t+";","g"),sub:p.entityToUnicode[t]}}),T=/(\r\n?|\n)/g,L=/(<[^<>]*>)/,C=/<(\/?)([^ >]*)(\s+(.*))?>/i,S=//i,z=/(^|[\s"'])style\s*=\s*("([^"]*);?"|'([^']*);?')/i,O=/(^|[\s"'])href\s*=\s*("([^"]*)"|'([^']*)')/i,D=/(^|[\s"'])target\s*=\s*("([^"\s]*)"|'([^'\s]*)')/i,P=/(^|[\s"'])popup\s*=\s*("([\w=,]*)"|'([\w=,]*)')/i,E=/(^|;)\s*color:/;n.plainText=function(t){return(t||"").replace(M," ")},n.lineCount=function(t){return t.selectAll("tspan.line").size()||1},n.positionText=function(t,e,n){return t.each(function(){function t(t,e){return void 0===e?null===(e=r.attr(t))&&(r.attr(t,0),e=0):r.attr(t,e),e}var r=f.select(this),a=t("x",e),o=t("y",n);"text"===this.nodeName&&r.selectAll("tspan.line").attr({x:a,y:o})})},n.makeEditable=function(t,e){function n(){a(),t.style({opacity:0});var e,n=s.attr("class");(e=n?"."+n.split(" ")[0]+"-math-group":"[class*=-math-group]")&&f.select(t.node().parentNode).select(e).style({opacity:0})}function r(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 n=f.select(o),a=n.select(".svg-container"),i=a.append("div");i.classed("plugin-editable editable",!0).style({position:"absolute","font-family":t.style("font-family")||"Arial","font-size":t.style("font-size")||12,color:e.fill||t.style("fill")||"black",opacity:1,"background-color":e.background||"transparent",outline:"#ffffff33 1px solid",margin:[-parseFloat(t.style("font-size"))/8+1,0,0,-1].join("px ")+"px",padding:"0","box-sizing":"border-box"}).attr({contenteditable:!0}).text(e.text||t.attr("data-unformatted")).call(u(t,a,e)).on("blur",function(){o._editing=!1,t.text(this.textContent).style({opacity:1});var e,n=f.select(this).attr("class");(e=n?"."+n.split(" ")[0]+"-math-group":"[class*=-math-group]")&&f.select(t.node().parentNode).select(e).style({opacity:0});var r=this.textContent;f.select(this).transition().duration(0).remove(),f.select(document).on("mouseup",null),l.edit.call(t,r)}).on("focus",function(){var t=this;o._editing=!0,f.select(document).on("mouseup",function(){if(f.event.target===t)return!1;document.activeElement===i.node()&&i.node().blur()})}).on("keyup",function(){27===f.event.which?(o._editing=!1,t.style({opacity:1}),f.select(this).style({opacity:0}).on("blur",function(){return!1}).transition().remove(),l.cancel.call(t,this.textContent)):(l.input.call(t,this.textContent),f.select(this).call(u(t,a,e)))}).on("keydown",function(){13===f.event.which&&this.blur()}).call(r)}var o=e.gd,i=e.delegate,l=f.dispatch("edit","input","cancel"),s=i||t;if(t.style({"pointer-events":i?"none":"all"}),1!==t.size())throw new Error("boo");return e.immediate?n():s.on("click",n),f.rebind(t,l,"on")}},{"../constants/alignment":130,"../constants/string_mappings":133,"../constants/xmlns_namespaces":134,"../lib":147,d3:7}],165:[function(t,e,n){"use strict";var r=t("fast-isnumeric");e.exports=function(t,e){if(t>0)return Math.log(t)/Math.LN10;var n=Math.log(Math.min(e[0],e[1]))/Math.LN10;return r(n)||(n=Math.log(Math.max(e[0],e[1]))/Math.LN10-6),n}},{"fast-isnumeric":10}],166:[function(t,e,n){"use strict";var r=t("../registry");e.exports=function(t){for(var e,n,a=r.layoutArrayContainers,o=r.layoutArrayRegexes,i=t.split("[")[0],l=0;l0)return t.substr(0,e)}var l=t("fast-isnumeric"),s=t("gl-mat4/fromQuat"),c=t("../registry"),u=t("../lib"),f=t("../plots/plots"),d=t("../plots/cartesian/axes"),h=t("../components/color");n.getGraphDiv=function(t){var e;if("string"==typeof t){if(null===(e=document.getElementById(t)))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},n.clearPromiseQueue=function(t){Array.isArray(t._promises)&&t._promises.length>0&&u.log("Clearing previous rejected promises from queue."),t._promises=[]},n.cleanLayout=function(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 a=d.list({_fullLayout:t});for(e=0;e3?(v.x=1.02,v.xanchor="left"):v.x<-2&&(v.x=-.02,v.xanchor="right"),v.y>3?(v.y=1.02,v.yanchor="bottom"):v.y<-2&&(v.y=-.02,v.yanchor="top")),"rotate"===t.dragmode&&(t.dragmode="orbit"),t.scene1&&(t.scene||(t.scene=t.scene1),delete t.scene1);var m=f.getSubplotIds(t,"gl3d");for(e=0;e1&&i.warn("Full array edits are incompatible with other edits",f);var y=n[""][""];if(u(y))e.set(null);else{if(!Array.isArray(y))return i.warn("Unrecognized full array edit value",f,y),!0;e.set(y)}return!g&&(d(v,m),h(t),!0)}var x,b,_,w,k,M,A,T=Object.keys(n).map(Number).sort(l),L=e.get(),C=L||[],S=r(m,f).get(),z=[],O=-1,D=C.length;for(x=0;xC.length-(A?0:1))i.warn("index out of range",f,_);else if(void 0!==M)k.length>1&&i.warn("Insertion & removal are incompatible with edits to the same index.",f,_),u(M)?z.push(_):A?("add"===M&&(M={}),C.splice(_,0,M),S&&S.splice(_,0,{})):i.warn("Unrecognized full object edit value",f,_,M),-1===O&&(O=_);else for(b=0;b=0;x--)C.splice(z[x],1),S&&S.splice(z[x],1);if(C.length?L||e.set(C):e.set(null),g)return!1;if(d(v,m),p!==o){var P;if(-1===O)P=T;else{for(D=Math.max(C.length,D),P=[],x=0;x=O);x++)P.push(_);for(x=O;x=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||a<0&&e.indexOf(t.data.length+a)>-1)throw new Error("each index in "+n+" must be unique.")}}function s(t,e,n){if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if(void 0===e)throw new Error("currentIndices is a required argument.");if(Array.isArray(e)||(e=[e]),l(t,e,"currentIndices"),void 0===n||Array.isArray(n)||(n=[n]),void 0!==n&&l(t,n,"newIndices"),void 0!==n&&e.length!==n.length)throw new Error("current and new indices must be of equal length.")}function c(t,e,n){var r,a;if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if(void 0===e)throw new Error("traces must be defined.");for(Array.isArray(e)||(e=[e]),r=0;r=0&&sV.range[0]?[1,2]:[2,1]);else{var X=V.range[0],Y=V.range[1];U?(X<=0&&Y<=0&&n(R+".autorange",!0),X<=0?X=Y/1e6:Y<=0&&(Y=X/1e6),n(R+".range[0]",Math.log(X)/Math.LN10),n(R+".range[1]",Math.log(Y)/Math.LN10)):(n(R+".range[0]",Math.pow(10,X)),n(R+".range[1]",Math.pow(10,Y)))}else n(R+".autorange",!0);k.getComponentMethod("annotations","convertCoords")(t,B,L,n),k.getComponentMethod("images","convertCoords")(t,B,L,n)}else n(R+".autorange",!0);b.nestedProperty(c,R+"._inputRange").set(null)}else if(P.match(N.AX_NAME_PATTERN)){var Z=b.nestedProperty(c,A).get(),W=(L||{}).type;W&&"-"!==W||(W="linear"),k.getComponentMethod("annotations","convertCoords")(t,Z,W,n),k.getComponentMethod("images","convertCoords")(t,Z,W,n)}var $=O.containerArrayMatch(A);if($){o=$.array,i=$.index;var Q=$.property,J=b.nestedProperty(s,o),K=(J||[])[i]||{};if(""===i)-1===A.indexOf("updatemenus")&&(m.docalc=!0);else if(""===Q){var tt=L;O.isAddVal(L)?_[A]=null:O.isRemoveVal(L)?(_[A]=K,tt=K):b.warn("unrecognized full object value",e),(r(tt,"x")||r(tt,"y")&&-1===A.indexOf("updatemenus"))&&(m.docalc=!0) }else!r(K,"x")&&!r(K,"y")||b.containsAny(A,["color","opacity","align","dash","updatemenus"])||(m.docalc=!0);d[o]||(d[o]={});var et=d[o][i];et||(et=d[o][i]={}),et[Q]=L,delete e[A]}else if("reverse"===P)F.range?F.range.reverse():(n(R+".autorange",!0),F.range=[1,0]),B.autorange?m.docalc=!0:m.doplot=!0;else{var nt=String(T.parts[1]||"");0===z.indexOf("scene")?"camera"===T.parts[1]?m.docamera=!0:m.doplot=!0:0===z.indexOf("geo")?m.doplot=!0:0===z.indexOf("ternary")?m.doplot=!0:"paper_bgcolor"===A?m.doplot=!0:"margin"===z||"autorange"===nt||"rangemode"===nt||"type"===nt||"domain"===nt||"fixedrange"===nt||"scaleanchor"===nt||"scaleratio"===nt||-1!==A.indexOf("calendar")||A.match(/^(bar|box|font)/)?m.docalc=!0:!c._has("gl2d")||-1===A.indexOf("axis")&&"plot_bgcolor"!==A?!c._has("gl2d")||"dragmode"!==A||"lasso"!==L&&"select"!==L||"lasso"===H||"select"===H?"hiddenlabels"===A?m.docalc=!0:-1!==z.indexOf("legend")?m.dolegend=!0:-1!==A.indexOf("title")?m.doticks=!0:-1!==z.indexOf("bgcolor")?m.dolayoutstyle=!0:C>1&&b.containsAny(nt,["tick","exponent","grid","zeroline"])?m.doticks=!0:-1!==A.indexOf(".linewidth")&&-1!==A.indexOf("axis")?m.doticks=m.dolayoutstyle=!0:C>1&&-1!==nt.indexOf("line")?m.dolayoutstyle=!0:C>1&&"mirror"===nt?m.doticks=m.dolayoutstyle=!0:"margin.pad"===A?m.doticks=m.dolayoutstyle=!0:-1!==["hovermode","dragmode"].indexOf(A)||-1!==A.indexOf("spike")?m.domodebar=!0:-1===["height","width","autosize"].indexOf(A)&&(m.doplot=!0):m.docalc=!0:m.doplot=!0,T.set(L)}}}for(o in d){O.applyContainerArrayChanges(t,b.nestedProperty(s,o),d[o],m)||(m.doplot=!0)}var rt=c._axisConstraintGroups;for(v in w)for(i=0;i=l.length?l[0]:l[t]:l}function a(t){return Array.isArray(s)?t>=s.length?s[0]:s[t]:s}function o(t,e){var n=0;return function(){if(t&&++n===e)return t()}}if(t=D.getGraphDiv(t),!b.isPlotDiv(t))throw new Error("This element is not a Plotly plot: "+t+". It's likely that you've failed to create a plot before animating it. For more details, see https://plot.ly/javascript/animations/");var i=t._transitionData;i._frameQueue||(i._frameQueue=[]),n=M.supplyAnimationDefaults(n);var l=n.transition,s=n.frame;return void 0===i._frameWaitingCnt&&(i._frameWaitingCnt=0),new Promise(function(s,c){function u(){t.emit("plotly_animated"),window.cancelAnimationFrame(i._animationRaf),i._animationRaf=null}function f(){i._currentFrame&&i._currentFrame.onComplete&&i._currentFrame.onComplete();var e=i._currentFrame=i._frameQueue.shift();if(e){var n=e.name?e.name.toString():null;t._fullLayout._currentFrame=n,i._lastFrameAt=Date.now(),i._timeToNext=e.frameOpts.duration,M.transition(t,e.frame.data,e.frame.layout,D.coerceTraceIndices(t,e.frame.traces),e.frameOpts,e.transitionOpts).then(function(){e.onComplete&&e.onComplete()}),t.emit("plotly_animatingframe",{name:n,frame:e.frame,animation:{frame:e.frameOpts,transition:e.transitionOpts}})}else u()}function d(){t.emit("plotly_animating"),i._lastFrameAt=-1/0,i._timeToNext=0,i._runningTransitions=0,i._currentFrame=null;var e=function(){i._animationRaf=window.requestAnimationFrame(e),Date.now()-i._lastFrameAt>i._timeToNext&&f()};e()}function h(t){return Array.isArray(l)?v>=l.length?t.transitionOpts=l[v]:t.transitionOpts=l[0]:t.transitionOpts=l,v++,t}var p,g,v=0,m=[],y=void 0===e||null===e,x=Array.isArray(e);if(y||x||!b.isPlainObject(e)){if(y||-1!==["string","number"].indexOf(typeof e))for(p=0;p0&&kk)&&A.push(g);m=A}}m.length>0?function(e){if(0!==e.length){for(var l=0;l=0;a--)if(b.isPlainObject(e[a])){var d=(c[e[a].name]||{}).name,h=e[a].name;d&&h&&"number"==typeof h&&c[d]&&(r++,b.warn('addFrames: overwriting frame "'+c[d].name+'" with a frame whose name of type "number" also equates to "'+d+'". This is valid but may potentially lead to unexpected behavior since all plotly.js frame names are stored internally as strings.'),r>5&&b.warn("addFrames: This API call has yielded too many warnings. For the rest of this call, further warnings about numeric frame names will be suppressed.")),f.push({frame:M.supplyFrameDefaults(e[a]),index:n&&void 0!==n[a]&&null!==n[a]?n[a]:u+a})}f.sort(function(t,e){return t.index>e.index?-1:t.index=0;a--){if(o=f[a].frame,"number"==typeof o.name&&b.warn("Warning: addFrames accepts frames with numeric names, but the numbers areimplicitly cast to strings"),!o.name)for(;c[o.name="frame "+t._transitionData._counter++];);if(c[o.name]){for(i=0;i=0;n--)r=e[n],o.push({type:"delete",index:r}),i.unshift({type:"insert",index:r,value:a[r]});var l=M.modifyFrames,s=M.modifyFrames,c=[t,i],u=[t,o];return w&&w.add(t,l,c,s,u),M.modifyFrames(t,o)},x.purge=function(t){t=D.getGraphDiv(t);var e=t._fullLayout||{},n=t._fullData||[];return M.cleanPlot([],{},n,e),M.purge(t),_.purge(t),e._container&&e._container.remove(),delete t._context,delete t._replotPending,delete t._mouseDownTime,delete t._legendMouseDownTime,delete t._hmpixcount,delete t._hmlumcount,t}},{"../components/drawing":58,"../components/errorbars":64,"../constants/xmlns_namespaces":134,"../lib":147,"../lib/events":141,"../lib/queue":159,"../lib/svg_text_utils":164,"../plotly":178,"../plots/cartesian/axis_ids":186,"../plots/cartesian/constants":188,"../plots/cartesian/constraints":190,"../plots/cartesian/graph_interact":192,"../plots/plots":212,"../plots/polar":215,"../registry":219,"./edit_types":167,"./helpers":168,"./manage_arrays":169,"./subroutines":175,d3:7,"fast-isnumeric":10,"has-hover":12}],171:[function(t,e,n){"use strict";function r(t,n){try{t._fullLayout._paper.style("background",n)}catch(t){e.exports.logging>0&&console.error(t)}}e.exports={staticPlot:!1,editable:!1,edits:{annotationPosition:!1,annotationTail:!1,annotationText:!1,axisTitleText:!1,colorbarPosition:!1,colorbarTitleText:!1,legendPosition:!1,legendText:!1,shapePosition:!1,titleText:!1},autosizable:!1,queueLength:0,fillFrame:!1,frameMargins:0,scrollZoom:!1,doubleClick:"reset+autosize",showTips:!0,showAxisDragHandles:!0,showAxisRangeEntryBoxes:!0,showLink:!1,sendData:!0,linkText:"Edit chart",showSources:!1,displayModeBar:"hover",modeBarButtonsToRemove:[],modeBarButtonsToAdd:[],modeBarButtons:!1,displaylogo:!0,plotGlPixelRatio:2,setBackground:r,topojsonURL:"https://cdn.plot.ly/",mapboxAccessToken:null,logging:!1,globalTransforms:[]}},{}],172:[function(t,e,n){"use strict";function r(t){var e,n;"area"===t?(e={attributes:x},n={}):(e=h.modules[t]._module,n=e.basePlotModule);var r={};r.type=null,k(r,g),k(r,e.attributes),n.attributes&&k(r,n.attributes),Object.keys(h.componentsRegistry).forEach(function(e){var n=h.componentsRegistry[e];n.schema&&n.schema.traces&&n.schema.traces[t]&&Object.keys(n.schema.traces[t]).forEach(function(e){d(r,n.schema.traces[t][e],e)})}),r.type=t;var a={meta:e.meta||{},attributes:l(r)};if(e.layoutAttributes){var o={};k(o,e.layoutAttributes),a.layoutAttributes=l(o)}return a}function a(){var t={};return k(t,v),Object.keys(h.subplotsRegistry).forEach(function(e){var n=h.subplotsRegistry[e];if(n.layoutAttributes)if("cartesian"===n.name)f(t,n,"xaxis"),f(t,n,"yaxis");else{var r="subplot"===n.attr?n.name:n.attr;f(t,n,r)}}),t=u(t),Object.keys(h.componentsRegistry).forEach(function(e){var n=h.componentsRegistry[e];n.layoutAttributes&&(n.schema&&n.schema.layout?Object.keys(n.schema.layout).forEach(function(e){d(t,n.schema.layout[e],e)}):d(t,n.layoutAttributes,n.name))}),{layoutAttributes:l(t)}}function o(t){var e=h.transformsRegistry[t],n=k({},e.attributes);return Object.keys(h.componentsRegistry).forEach(function(e){var r=h.componentsRegistry[e];r.schema&&r.schema.transforms&&r.schema.transforms[t]&&Object.keys(r.schema.transforms[t]).forEach(function(e){d(n,r.schema.transforms[t][e],e)})}),{attributes:l(n)}}function i(){var t={frames:p.extendDeep({},m)};return l(t),t.frames}function l(t){return s(t),c(t),t}function s(t){function e(t){return{valType:"string"}}function r(t,r,a){n.isValObject(t)?"data_array"===t.valType?(t.role="data",a[r+"src"]=e(r)):!0===t.arrayOk&&(a[r+"src"]=e(r)):p.isPlainObject(t)&&(t.role="object")}n.crawl(t,r)}function c(t){function e(t,e,n){if(t){var r=t[A];r&&(delete t[A],n[e]={items:{}},n[e].items[r]=t,n[e].role="object")}}n.crawl(t,e)}function u(t){return w(t,{radialaxis:b.radialaxis,angularaxis:b.angularaxis}),w(t,b.layout),t}function f(t,e,n){var r=p.nestedProperty(t,n),a=k({},e.layoutAttributes);a[M]=!0,r.set(a)}function d(t,e,n){var r=p.nestedProperty(t,n);r.set(k(r.get()||{},e))}var h=t("../registry"),p=t("../lib"),g=t("../plots/attributes"),v=t("../plots/layout_attributes"),m=t("../plots/frame_attributes"),y=t("../plots/animation_attributes"),x=t("../plots/polar/area_attributes"),b=t("../plots/polar/axis_attributes"),_=t("./edit_types"),w=p.extendFlat,k=p.extendDeep,M="_isSubplotObj",A="_isLinkedToArray",T=[M,A,"_arrayAttrRegexps","_deprecated"];n.IS_SUBPLOT_OBJ=M,n.IS_LINKED_TO_ARRAY=A,n.DEPRECATED="_deprecated",n.UNDERSCORE_ATTRS=T,n.get=function(){var t={};h.allTypes.concat("area").forEach(function(e){t[e]=r(e)});var e={};return Object.keys(h.transformsRegistry).forEach(function(t){e[t]=o(t)}),{defs:{valObjects:p.valObjects,metaKeys:T.concat(["description","role"]),editTypes:{traces:_.traces(),layout:_.layout()}},traces:t,layout:a(),transforms:e,frames:i(),animation:l(y)}},n.crawl=function(t,e,r){var a=r||0;Object.keys(t).forEach(function(r){var o=t[r];-1===T.indexOf(r)&&(e(o,r,t,a),n.isValObject(o)||p.isPlainObject(o)&&n.crawl(o,e,a+1))})},n.isValObject=function(t){return t&&void 0!==t.valType},n.findArrayAttributes=function(t){function e(e,n,i,l){if(o=o.slice(0,l).concat([n]),e&&("data_array"===e.valType||!0===e.arrayOk)&&!("colorbar"===o[l-1]&&("ticktext"===n||"tickvals"===n))){var s=r(o),c=p.nestedProperty(t,s).get();Array.isArray(c)&&a.push(s)}}function r(t){return t.join(".")}var a=[],o=[];if(n.crawl(g,e),t._module&&t._module.attributes&&n.crawl(t._module.attributes,e),t.transforms)for(var i=t.transforms,l=0;l=t[1]||a[1]<=t[0])&&(o[0]e[0]))return!0}return!1}function a(t,e,n){return t._anchorAxis===e&&(t.mirror||t.side===n)||"all"===t.mirror||"allticks"===t.mirror||t.mirrors&&t.mirrors[e._id+n]}function o(t,e,n){var r=[],a=e._anchorAxis;if(a){var o=a._mainAxis;if(-1===r.indexOf(o)){r.push(o);for(var i=0;i0;t.each(function(t){var d,h=t[0].trace,p=h.error_x||{},g=h.error_y||{};h.ids&&(d=function(t){return t.id});var m=l.hasMarkers(h)&&h.marker.maxdisplayed>0;if(g.visible||p.visible){var v=a.select(this).selectAll("g.errorbar").data(t,d);v.exit().remove(),v.style("opacity",1);var y=v.enter().append("g").classed("errorbar",!0);f&&y.style("opacity",0).transition().duration(r.duration).style("opacity",1),i.setClipUrl(v,e.layerClipId),v.each(function(t){var e=a.select(this),i=n(t,c,u);if(!m||t.vis){var l;if(g.visible&&o(i.x)&&o(i.yh)&&o(i.ys)){var d=g.width;l="M"+(i.x-d)+","+i.yh+"h"+2*d+"m-"+d+",0V"+i.ys,i.noYS||(l+="m-"+d+",0h"+2*d);var h=e.select("path.yerror");s=!h.size(),s?h=e.append("path").style("vector-effect","non-scaling-stroke").classed("yerror",!0):f&&(h=h.transition().duration(r.duration).ease(r.easing)),h.attr("d",l)}if(p.visible&&o(i.y)&&o(i.xh)&&o(i.xs)){var v=(p.copy_ystyle?g:p).width;l="M"+i.xh+","+(i.y-v)+"v"+2*v+"m0,-"+v+"H"+i.xs,i.noXS||(l+="m0,-"+v+"v"+2*v);var y=e.select("path.xerror");s=!y.size(),s?y=e.append("path").style("vector-effect","non-scaling-stroke").classed("xerror",!0):f&&(y=y.transition().duration(r.duration).ease(r.easing)),y.attr("d",l)}}})}})}},{"../../traces/scatter/subtypes":346,"../drawing":65,d3:14,"fast-isnumeric":17}],73:[function(t,e,r){"use strict";var n=t("d3"),a=t("../color");e.exports=function(t){t.each(function(t){var e=t[0].trace,r=e.error_y||{},o=e.error_x||{},i=n.select(this);i.selectAll("path.yerror").style("stroke-width",r.thickness+"px").call(a.stroke,r.color),o.copy_ystyle&&(o=r),i.selectAll("path.xerror").style("stroke-width",o.thickness+"px").call(a.stroke,o.color)})}},{"../color":41,d3:14}],74:[function(t,e,r){"use strict";var n=t("../../lib/extend").extendFlat,a=t("../../plots/font_attributes");e.exports={hoverlabel:{bgcolor:{valType:"color",arrayOk:!0},bordercolor:{valType:"color",arrayOk:!0},font:{family:n({},a.family,{arrayOk:!0}),size:n({},a.size,{arrayOk:!0}),color:n({},a.color,{arrayOk:!0})},namelength:{valType:"integer",min:-1,arrayOk:!0}}}},{"../../lib/extend":149,"../../plots/font_attributes":214}],75:[function(t,e,r){"use strict";function n(t,e,r,n){n=n||a.identity,Array.isArray(t)&&(e[0][r]=n(t))}var a=t("../../lib"),o=t("../../registry");e.exports=function(t){for(var e=t.calcdata,r=t._fullLayout,i=0;i=0&&r.indexJ.width||$<0||$>J.height)return x.unhoverRaw(t,e)}if(E="xval"in e?w.flat(d,e.xval):w.p2c(L,W),N="yval"in e?w.flat(d,e.yval):w.p2c(C,$),!f(E[0])||!f(N[0]))return h.warn("Fx.hover failed",e,t),x.unhoverRaw(t,e)}var K=1/0;for(R=0;RZ&&(X.splice(0,Z),K=X[0].distance)}if(0===X.length)return x.unhoverRaw(t,e);X.sort(function(t,e){return t.distance-e.distance});var at=t._hoverdata,ot=[];for(I=0;I1,ct=y.combine(g.plot_bgcolor||y.background,g.paper_bgcolor),ut={hovermode:P,rotateLabels:st,bgColor:ct,container:g._hoverlayer,outerContainer:g._paperdiv,commonLabelOpts:g.hoverlabel},ft=a(X,ut,t);if(o(X,st?"xa":"ya"),i(ft,st),e.target&&e.target.tagName){var dt=_.getComponentMethod("annotations","hasClickToShow")(t,ot);m(u.select(e.target),dt?"pointer":"")}e.target&&!n&&c(t,e,at)&&(at&&t.emit("plotly_unhover",{event:e,points:at}),t.emit("plotly_hover",{event:e,points:t._hoverdata,xaxes:L,yaxes:C,xvals:E,yvals:N}))}function a(t,e,r){var n,a,o=e.hovermode,i=e.rotateLabels,l=e.bgColor,s=e.container,c=e.outerContainer,f=e.commonLabelOpts||{},d=e.fontFamily||k.HOVERFONT,h=e.fontSize||k.HOVERFONTSIZE,p=t[0],m=p.xa,x=p.ya,b="y"===o?"yLabel":"xLabel",_=p[b],w=(String(_)||"").split(" ")[0],A=c.node().getBoundingClientRect(),T=A.top,L=A.width,C=A.height,O=p.distance<=k.MAXDIST&&("x"===o||"y"===o);for(n=0;n-1&&n.length>p&&(n=p>3?n.substr(0,p-3)+"...":n.substr(0,p))}void 0!==t.extraText&&(a+=t.extraText),void 0!==t.zLabel?(void 0!==t.xLabel&&(a+="x: "+t.xLabel+"
"),void 0!==t.yLabel&&(a+="y: "+t.yLabel+"
"),a+=(a?"z: ":"")+t.zLabel):O&&t[o+"Label"]===_?a=t[("x"===o?"y":"x")+"Label"]||"":void 0===t.xLabel?void 0!==t.yLabel&&(a=t.yLabel):a=void 0===t.yLabel?t.xLabel:"("+t.xLabel+", "+t.yLabel+")",t.text&&!Array.isArray(t.text)&&(a+=(a?"
":"")+t.text),""===a&&(""===n&&e.remove(),a=n);var m=e.select("text.nums").call(v.font,t.fontFamily||d,t.fontSize||h,t.fontColor||f).text(a).attr("data-notex",1).call(g.positionText,0,0).call(g.convertToTspans,r),x=e.select("text.name"),b=0;n&&n!==a?(x.call(v.font,t.fontFamily||d,t.fontSize||h,c).text(n).attr("data-notex",1).call(g.positionText,0,0).call(g.convertToTspans,r),b=x.node().getBoundingClientRect().width+2*S):(x.remove(),e.select("rect").remove()),e.select("path").style({fill:c,stroke:f});var w,k,A=m.node().getBoundingClientRect(),D=t.xa._offset+(t.x0+t.x1)/2,P=t.ya._offset+(t.y0+t.y1)/2,E=Math.abs(t.x1-t.x0),N=Math.abs(t.y1-t.y0),I=A.width+z+S+b;t.ty0=T-A.top,t.bx=A.width+2*S,t.by=A.height+2*S,t.anchor="start",t.txwidth=A.width,t.tx2width=b,t.offset=0,i?(t.pos=D,w=P+N/2+I<=C,k=P-N/2-I>=0,"top"!==t.idealAlign&&w||!k?w?(P+=N/2,t.anchor="start"):t.anchor="middle":(P-=N/2,t.anchor="end")):(t.pos=P,w=D+E/2+I<=L,k=D-E/2-I>=0,"left"!==t.idealAlign&&w||!k?w?(D+=E/2,t.anchor="start"):t.anchor="middle":(D-=E/2,t.anchor="end")),m.attr("text-anchor",t.anchor),b&&x.attr("text-anchor",t.anchor),e.attr("transform","translate("+D+","+P+")"+(i?"rotate("+M+")":""))}),E}function o(t,e){function r(t){var e=t[0],r=t[t.length-1];if(a=e.pmin-e.pos-e.dp+e.size,o=r.pos+r.dp+r.size-e.pmax,a>.01){for(l=t.length-1;l>=0;l--)t[l].dp+=a;n=!1}if(!(o<.01)){if(a<-.01){for(l=t.length-1;l>=0;l--)t[l].dp-=o;n=!1}if(n){var c=0;for(i=0;ie.pmax&&c++;for(i=t.length-1;i>=0&&!(c<=0);i--)s=t[i],s.pos>e.pmax-1&&(s.del=!0,c--);for(i=0;i=0;l--)t[l].dp-=o;for(i=t.length-1;i>=0&&!(c<=0);i--)s=t[i],s.pos+s.dp+s.size>e.pmax&&(s.del=!0,c--)}}}for(var n,a,o,i,l,s,c,u=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)?T:1)/2,pmin:n._offset,pmax:n._offset+n._length}]}).sort(function(t,e){return t[0].posref-e[0].posref});!n&&u<=t.length;){for(u++,n=!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;n=!1}else i++}f.forEach(r)}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 i(t,e){t.each(function(t){var r=u.select(this);if(t.del)return void r.remove();var n="end"===t.anchor?-1:1,a=r.select("text.nums"),o={start:1,end:-1,middle:0}[t.anchor],i=o*(z+S),l=i+o*(t.txwidth+S),s=0,c=t.offset;"middle"===t.anchor&&(i-=t.tx2width/2,l-=t.tx2width/2),e&&(c*=-C,s=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*z+s)+","+(z+c)+"v"+(t.by/2-z)+"h"+n*t.bx+"v-"+t.by+"H"+(n*z+s)+"V"+(c-z)+"Z"),a.call(g.positionText,i+s,c+t.ty0-t.by/2+S),t.tx2width&&(r.select("text.name").call(g.positionText,l+o*S+s,c+t.ty0-t.by/2+S),r.select("rect").call(v.setRect,l+(o-1)*t.tx2width/2+s,c-t.by/2-1,t.tx2width,t.by+2))})}function l(t,e){function r(e,r,i){var l;if(o[r])l=o[r];else if(a[r]){var s=a[r];Array.isArray(s)&&Array.isArray(s[t.index[0]])&&(l=s[t.index[0]][t.index[1]])}else l=h.nestedProperty(n,i).get();l&&(t[e]=l)}var n=t.trace||{},a=t.cd[0],o=t.cd[t.index]||{};r("hoverinfo","hi","hoverinfo"),r("color","hbg","hoverlabel.bgcolor"),r("borderColor","hbc","hoverlabel.bordercolor"),r("fontFamily","htf","hoverlabel.font.family"),r("fontSize","hts","hoverlabel.font.size"),r("fontColor","htc","hoverlabel.font.color"),r("nameLength","hnl","hoverlabel.namelength"),t.posref="y"===e?(t.x0+t.x1)/2:(t.y0+t.y1)/2,t.x0=h.constrain(t.x0,0,t.xa._length),t.x1=h.constrain(t.x1,0,t.xa._length),t.y0=h.constrain(t.y0,0,t.ya._length),t.y1=h.constrain(t.y1,0,t.ya._length);var i;if(void 0!==t.xLabelVal){i="log"===t.xa.type&&t.xLabelVal<=0;var l=b.tickText(t.xa,t.xa.c2l(i?-t.xLabelVal:t.xLabelVal),"hover");i?0===t.xLabelVal?t.xLabel="0":t.xLabel="-"+l.text:t.xLabel=l.text,t.xVal=t.xa.c2d(t.xLabelVal)}if(void 0!==t.yLabelVal){i="log"===t.ya.type&&t.yLabelVal<=0;var s=b.tickText(t.ya,t.ya.c2l(i?-t.yLabelVal:t.yLabelVal),"hover");i?0===t.yLabelVal?t.yLabel="0":t.yLabel="-"+s.text:t.yLabel=s.text,t.yVal=t.ya.c2d(t.yLabelVal)}if(void 0!==t.zLabelVal&&(t.zLabel=String(t.zLabelVal)),!(isNaN(t.xerr)||"log"===t.xa.type&&t.xerr<=0)){var c=b.tickText(t.xa,t.xa.c2l(t.xerr),"hover").text;void 0!==t.xerrneg?t.xLabel+=" +"+c+" / -"+b.tickText(t.xa,t.xa.c2l(t.xerrneg),"hover").text:t.xLabel+=" \xb1 "+c,"x"===e&&(t.distance+=1)}if(!(isNaN(t.yerr)||"log"===t.ya.type&&t.yerr<=0)){var u=b.tickText(t.ya,t.ya.c2l(t.yerr),"hover").text;void 0!==t.yerrneg?t.yLabel+=" +"+u+" / -"+b.tickText(t.ya,t.ya.c2l(t.yerrneg),"hover").text:t.yLabel+=" \xb1 "+u,"y"===e&&(t.distance+=1)}var f=t.hoverinfo||t.trace.hoverinfo;return"all"!==f&&(f=f.split("+"),-1===f.indexOf("x")&&(t.xLabel=void 0),-1===f.indexOf("y")&&(t.yLabel=void 0),-1===f.indexOf("z")&&(t.zLabel=void 0),-1===f.indexOf("text")&&(t.text=void 0),-1===f.indexOf("name")&&(t.name=void 0)),t}function s(t,e){var r=e.hovermode,n=e.container,a=t[0],o=a.xa,i=a.ya,l=o.showspikes,s=i.showspikes;if(n.selectAll(".spikeline").remove(),"closest"===r&&(l||s)){var c=e.fullLayout,u=o._offset+(a.x0+a.x1)/2,f=i._offset+(a.y0+a.y1)/2,h=y.combine(c.plot_bgcolor,c.paper_bgcolor),p=d.readability(a.color,h)<1.5?y.contrast(h):a.color;if(s){var g=i.spikemode,m=i.spikethickness,x=i.spikecolor||p,b=i._boundingBox,_=(b.left+b.right)/2=0;n--){var a=r[n],o=t._hoverdata[n];if(a.curveNumber!==o.curveNumber||String(a.pointNumber)!==String(o.pointNumber))return!0}return!1}var u=t("d3"),f=t("fast-isnumeric"),d=t("tinycolor2"),h=t("../../lib"),p=t("../../lib/events"),g=t("../../lib/svg_text_utils"),m=t("../../lib/override_cursor"),v=t("../drawing"),y=t("../color"),x=t("../dragelement"),b=t("../../plots/cartesian/axes"),_=t("../../registry"),w=t("./helpers"),k=t("./constants"),M=k.YANGLE,A=Math.PI*M/180,T=1/Math.sin(A),L=Math.cos(A),C=Math.sin(A),z=k.HOVERARROWSIZE,S=k.HOVERTEXTPAD;r.hover=function(t,e,r,a){if("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)return n(t,e,r,a),void(t._lastHoverTime=Date.now());t._hoverTimer=setTimeout(function(){n(t,e,r,a),t._lastHoverTime=Date.now(),t._hoverTimer=void 0},k.HOVERMINTIME)},r.loneHover=function(t,e){var r={color:t.color||y.defaultLine,x0:t.x0||t.x||0,x1:t.x1||t.x||0,y0:t.y0||t.y||0,y1:t.y1||t.y||0,xLabel:t.xLabel,yLabel:t.yLabel,zLabel:t.zLabel,text:t.text,name:t.name,idealAlign:t.idealAlign,borderColor:t.borderColor,fontFamily:t.fontFamily,fontSize:t.fontSize,fontColor:t.fontColor,trace:{index:0,hoverinfo:""},xa:{_offset:0},ya:{_offset:0},index:0},n=u.select(e.container),o=e.outerContainer?u.select(e.outerContainer):n,l={hovermode:"closest",rotateLabels:!1,bgColor:e.bgColor||y.background,container:n,outerContainer:o},s=a([r],l,e.gd);return i(s,l.rotateLabels),s.node()}},{"../../lib":154,"../../lib/events":148,"../../lib/override_cursor":163,"../../lib/svg_text_utils":171,"../../plots/cartesian/axes":190,"../../registry":234,"../color":41,"../dragelement":62,"../drawing":65,"./constants":77,"./helpers":79,d3:14,"fast-isnumeric":17,tinycolor2:23}],81:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function(t,e,r,a){a=a||{},r("hoverlabel.bgcolor",a.bgcolor),r("hoverlabel.bordercolor",a.bordercolor),r("hoverlabel.namelength",a.namelength),n.coerceFont(r,"hoverlabel.font",a.font)}},{"../../lib":154}],82:[function(t,e,r){"use strict";function n(t){var e=l.isD3Selection(t)?t:i.select(t);e.selectAll("g.hovertext").remove(),e.selectAll(".spikeline").remove()}function a(t,e,r){return l.castOption(t,e,"hoverlabel."+r)}function o(t,e,r){function n(r){return l.coerceHoverinfo({hoverinfo:r},{_module:t._module},e)}return l.castOption(t,r,"hoverinfo",n)}var i=t("d3"),l=t("../../lib"),s=t("../dragelement"),c=t("./helpers"),u=t("./layout_attributes");e.exports={moduleType:"component",name:"fx",constants:t("./constants"),schema:{layout:u},attributes:t("./attributes"),layoutAttributes:u,supplyLayoutGlobalDefaults:t("./layout_global_defaults"),supplyDefaults:t("./defaults"),supplyLayoutDefaults:t("./layout_defaults"),calc:t("./calc"),getDistanceFunction:c.getDistanceFunction,getClosest:c.getClosest,inbox:c.inbox,appendArrayPointValue:c.appendArrayPointValue,castHoverOption:a,castHoverinfo:o,hover:t("./hover").hover,unhover:s.unhover,loneHover:t("./hover").loneHover,loneUnhover:n,click:t("./click")}},{"../../lib":154,"../dragelement":62,"./attributes":74,"./calc":75,"./click":76,"./constants":77,"./defaults":78,"./helpers":79,"./hover":80,"./layout_attributes":83,"./layout_defaults":84,"./layout_global_defaults":85,d3:14}],83:[function(t,e,r){"use strict";var n=t("../../lib/extend").extendFlat,a=t("../../plots/font_attributes"),o=t("./constants");e.exports={dragmode:{valType:"enumerated",values:["zoom","pan","select","lasso","orbit","turntable"],dflt:"zoom"},hovermode:{valType:"enumerated",values:["x","y","closest",!1]},hoverlabel:{bgcolor:{valType:"color"},bordercolor:{valType:"color"},font:{family:n({},a.family,{dflt:o.HOVERFONT}),size:n({},a.size,{dflt:o.HOVERFONTSIZE}),color:n({},a.color)},namelength:{valType:"integer",min:-1,dflt:15}}}},{"../../lib/extend":149,"../../plots/font_attributes":214,"./constants":77}],84:[function(t,e,r){"use strict";function n(t){for(var e=!0,r=0;r=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}},{}],92:[function(t,e,r){"use strict";var n=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({},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":149,"../../plots/font_attributes":214,"../color/attributes":40}],93:[function(t,e,r){"use strict";e.exports={scrollBarWidth:4,scrollBarHeight:20,scrollBarColor:"#808BA4",scrollBarMargin:4}},{}],94:[function(t,e,r){"use strict";var n=t("../../registry"),a=t("../../lib"),o=t("./attributes"),i=t("../../plots/layout_attributes"),l=t("./helpers");e.exports=function(t,e,r){function s(t,e){return a.coerce(h,p,o,t,e)}for(var c,u,f,d,h=t.legend||{},p=e.legend={},g=0,m="normal",v=0;v1)){if(s("bgcolor",e.paper_bgcolor),s("bordercolor"),s("borderwidth"),a.coerceFont(s,"font",e.font),s("orientation"),"h"===p.orientation){var x=t.xaxis;x&&x.rangeslider&&x.rangeslider.visible?(c=0,f="left",u=1.1,d="bottom"):(c=0,f="left",u=-.1,d="top")}s("traceorder",m),l.isGrouped(e.legend)&&s("tracegroupgap"),s("x",c),s("xanchor",f),s("y",u),s("yanchor",d),a.noneOrAll(h,p,["x","y"])}}},{"../../lib":154,"../../plots/layout_attributes":217,"../../registry":234,"./attributes":92,"./helpers":97}],95:[function(t,e,r){"use strict";function n(t,e){function r(r){y.convertToTspans(r,e,function(){i(t,e)})}var n=t.data()[0][0],a=e._fullLayout,o=n.trace,l=p.traceIs(o,"pie"),s=o.index,c=l?n.label:o.name,u=t.selectAll("text.legendtext").data([0]);u.enter().append("text").classed("legendtext",!0),u.attr("text-anchor","start").classed("user-select-none",!0).call(m.font,a.legend.font).text(c),e._context.edits.legendText&&!l?u.call(y.makeEditable,{gd:e}).call(r).on("edit",function(t){this.text(t).call(r),this.text()||(t=" ");var a,o=n.trace._fullInput||{};if(-1!==["ohlc","candlestick"].indexOf(o.type)){var i=n.trace.transforms;a=i[i.length-1].direction+".name"}else a="name";f.restyle(e,a,t,s)}):u.call(r)}function a(t,e){var r,n=1,a=t.selectAll("rect").data([0]);a.enter().append("rect").classed("legendtoggle",!0).style("cursor","pointer").attr("pointer-events","all").call(v.fill,"rgba(0,0,0,0)"),a.on("mousedown",function(){r=(new Date).getTime(),r-e._legendMouseDownTimeL&&(n=Math.max(n-1,1)),1===n?r._clickTimeout=setTimeout(function(){o(t,e,n)},L):2===n&&(r._clickTimeout&&clearTimeout(r._clickTimeout),e._legendMouseDownTime=0,o(t,e,n))}})}function o(t,e,r){if(!e._dragged&&!e._editing){var n,a,o=e._fullLayout.hiddenlabels?e._fullLayout.hiddenlabels.slice():[],i=t.data()[0][0],l=e._fullData,s=i.trace,c=s.legendgroup,u=[];if(1===r&&T&&e.data&&e._context.showTips?(d.notifier("Double click on legend to isolate individual trace","long"),T=!1):T=!1,p.traceIs(s,"pie")){var h=i.label,g=o.indexOf(h);1===r?-1===g?o.push(h):o.splice(g,1):2===r&&(o=[],e.calcdata[0].forEach(function(t){h!==t.label&&o.push(t.label)}),e._fullLayout.hiddenlabels&&e._fullLayout.hiddenlabels.length===o.length&&-1===g&&(o=[])),f.relayout(e,"hiddenlabels",o)}else{var m,v=[],y=[];for(m=0;mn.width-(n.margin.r+n.margin.l)&&(x=0,g+=v,a.height=a.height+v,v=0),m.setTranslate(this,o+x,5+o+e.height/2+g),a.width+=i+r,a.height=Math.max(a.height,e.height),x+=i+r,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),r.each(function(e){var r=e[0];u.select(this).select(".legendtoggle").call(m.setRect,0,-r.height/2,(t._context.edits.legendText?0:a.width)+l,r.height)})}function s(t){var e=t._fullLayout,r=e.legend,n="left";A.isRightAnchor(r)?n="right":A.isCenterAnchor(r)&&(n="center");var a="top";A.isBottomAnchor(r)?a="bottom":A.isMiddleAnchor(r)&&(a="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}[a]||0),t:r.height*({bottom:1,middle:.5}[a]||0)})}function c(t){var e=t._fullLayout,r=e.legend,n="left";A.isRightAnchor(r)?n="right":A.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"),f=t("../../plotly"),d=t("../../lib"),h=t("../../plots/plots"),p=t("../../registry"),g=t("../dragelement"),m=t("../drawing"),v=t("../color"),y=t("../../lib/svg_text_utils"),x=t("./constants"),b=t("../../constants/interactions"),_=t("../../constants/alignment").LINE_SPACING,w=t("./get_legend_data"),k=t("./style"),M=t("./helpers"),A=t("./anchor_utils"),T=!0,L=b.DBLCLICKDELAY;e.exports=function(t){function e(t,e){z.attr("data-scroll",e).call(m.setTranslate,0,e),S.call(m.setRect,j,t,x.scrollBarWidth,x.scrollBarHeight),T.select("rect").attr({y:y.borderwidth-e})}var r=t._fullLayout,i="legend"+r._uid;if(r._infolayer&&t.calcdata){t._legendMouseDownTime||(t._legendMouseDownTime=0);var y=r.legend,b=r.showlegend&&w(t.calcdata,y),_=r.hiddenlabels||[];if(!r.showlegend||!b.length)return r._infolayer.selectAll(".legend").remove(),r._topdefs.select("#"+i).remove(),void h.autoMargin(t,"legend");var M=r._infolayer.selectAll("g.legend").data([0]);M.enter().append("g").attr({class:"legend","pointer-events":"all"});var T=r._topdefs.selectAll("#"+i).data([0]);T.enter().append("clipPath").attr("id",i).append("rect");var C=M.selectAll("rect.bg").data([0]);C.enter().append("rect").attr({class:"bg","shape-rendering":"crispEdges"}),C.call(v.stroke,y.bordercolor),C.call(v.fill,y.bgcolor),C.style("stroke-width",y.borderwidth+"px");var z=M.selectAll("g.scrollbox").data([0]);z.enter().append("g").attr("class","scrollbox");var S=M.selectAll("rect.scrollbar").data([0]);S.enter().append("rect").attr({class:"scrollbar",rx:20,ry:2,width:0,height:0}).call(v.fill,"#808BA4");var O=z.selectAll("g.groups").data(b);O.enter().append("g").attr("class","groups"),O.exit().remove();var D=O.selectAll("g.traces").data(d.identity);D.enter().append("g").attr("class","traces"),D.exit().remove(),D.call(k,t).style("opacity",function(t){var e=t[0].trace;return p.traceIs(e,"pie")?-1!==_.indexOf(t[0].label)?.5:1:"legendonly"===e.visible?.5:1}).each(function(){u.select(this).call(n,t).call(a,t)});var P=0!==M.enter().size();P&&(l(t,O,D),s(t));var E=r.width,N=r.height;l(t,O,D),y.height>N?c(t):s(t);var I=r._size,R=I.l+I.w*y.x,F=I.t+I.h*(1-y.y);A.isRightAnchor(y)?R-=y.width:A.isCenterAnchor(y)&&(R-=y.width/2),A.isBottomAnchor(y)?F-=y.height:A.isMiddleAnchor(y)&&(F-=y.height/2);var j=y.width,B=I.w;j>B?(R=I.l,j=B):(R+j>E&&(R=E-j),R<0&&(R=0),j=Math.min(E-R,y.width));var H=y.height,q=I.h;H>q?(F=I.t,H=q):(F+H>N&&(F=N-H),F<0&&(F=0),H=Math.min(N-F,y.height)),m.setTranslate(M,R,F);var V,U,G=H-x.scrollBarHeight-2*x.scrollBarMargin,Z=y.height-H;if(y.height<=H||t._context.staticPlot)C.attr({width:j-y.borderwidth,height:H-y.borderwidth,x:y.borderwidth/2,y:y.borderwidth/2}),m.setTranslate(z,0,0),T.select("rect").attr({width:j-2*y.borderwidth,height:H-2*y.borderwidth,x:y.borderwidth,y:y.borderwidth}),z.call(m.setClipUrl,i);else{V=x.scrollBarMargin,U=z.attr("data-scroll")||0,C.attr({width:j-2*y.borderwidth+x.scrollBarWidth+x.scrollBarMargin,height:H-y.borderwidth,x:y.borderwidth/2,y:y.borderwidth/2}),T.select("rect").attr({width:j-2*y.borderwidth+x.scrollBarWidth+x.scrollBarMargin,height:H-2*y.borderwidth,x:y.borderwidth,y:y.borderwidth-U}),z.call(m.setClipUrl,i),P&&e(V,U),M.on("wheel",null),M.on("wheel",function(){U=d.constrain(z.attr("data-scroll")-u.event.deltaY/G*Z,-Z,0),V=x.scrollBarMargin-U/Z*G,e(V,U),0!==U&&U!==-Z&&u.event.preventDefault()}),S.on(".drag",null),z.on(".drag",null);var X=u.behavior.drag().on("drag",function(){V=d.constrain(u.event.y-x.scrollBarHeight/2,x.scrollBarMargin,x.scrollBarMargin+G),U=-(V-x.scrollBarMargin)/G*Z,e(V,U)});S.call(X),z.call(X)}if(t._context.edits.legendPosition){var Y,W,$,Q;M.classed("cursor-move",!0),g.init({element:M.node(),gd:t,prepFn:function(){var t=m.getTranslate(M);$=t.x,Q=t.y},moveFn:function(t,e){var r=$+t,n=Q+e;m.setTranslate(M,r,n),Y=g.align(r,0,I.l,I.l+I.w,y.xanchor),W=g.align(n,0,I.t+I.h,I.t,y.yanchor)},doneFn:function(e,n,a){if(e&&void 0!==Y&&void 0!==W)f.relayout(t,{"legend.x":Y,"legend.y":W});else{var i=r._infolayer.selectAll("g.traces").filter(function(){var t=this.getBoundingClientRect();return a.clientX>=t.left&&a.clientX<=t.right&&a.clientY>=t.top&&a.clientY<=t.bottom});i.size()>0&&(1===n?M._clickTimeout=setTimeout(function(){o(i,t,n)},L):2===n&&(M._clickTimeout&&clearTimeout(M._clickTimeout),o(i,t,n)))}}})}}}},{"../../constants/alignment":137,"../../constants/interactions":138,"../../lib":154,"../../lib/svg_text_utils":171,"../../plotly":185,"../../plots/plots":219,"../../registry":234,"../color":41,"../dragelement":62,"../drawing":65,"./anchor_utils":91,"./constants":93,"./get_legend_data":96,"./helpers":97,"./style":99,d3:14}],96:[function(t,e,r){"use strict";var n=t("../../registry"),a=t("./helpers");e.exports=function(t,e){function r(t,r){if(""!==t&&a.isGrouped(e))-1===s.indexOf(t)?(s.push(t),c=!0,l[t]=[[r]]):l[t].push([r]);else{var n="~~i"+f;s.push(n),l[n]=[[r]],f++}}var o,i,l={},s=[],c=!1,u={},f=0;for(o=0;or[1])return r[1]}return a}function a(t){return t[0]}var l,c,u=t[0],f=u.trace,d=s.hasMarkers(f),h=s.hasText(f),p=s.hasLines(f);if(d||h||p){var g={},m={};d&&(g.mc=r("marker.color",a),g.mo=r("marker.opacity",o.mean,[.2,1]),g.ms=r("marker.size",o.mean,[2,16]),g.mlc=r("marker.line.color",a),g.mlw=r("marker.line.width",o.mean,[0,5]),m.marker={sizeref:1,sizemin:1,sizemode:"diameter"}),p&&(m.line={width:r("line.width",a,[0,10])}),h&&(g.tx="Aa",g.tp=r("textposition",a),g.ts=10,g.tc=r("textfont.color",a),g.tf=r("textfont.family",a)),l=[o.minExtend(u,g)],c=o.minExtend(f,m)}var v=n.select(this).select("g.legendpoints"),y=v.selectAll("path.scatterpts").data(d?l:[]);y.enter().append("path").classed("scatterpts",!0).attr("transform","translate(20,0)"),y.exit().remove(),y.call(i.pointStyle,c,e),d&&(l[0].mrc=3);var x=v.selectAll("g.pointtext").data(h?l:[]);x.enter().append("g").classed("pointtext",!0).append("text").attr("transform","translate(20,0)"),x.exit().remove(),x.selectAll("text").call(i.textPointStyle,c,e)}function f(t){var e=t[0].trace,r=e.marker||{},o=r.line||{},i=n.select(this).select("g.legendpoints").selectAll("path.legendbar").data(a.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=n.select(this),a=t[0],i=(a.mlw+1||o.width+1)-1;e.style("stroke-width",i+"px").call(l.fill,a.mc||r.color),i&&e.call(l.stroke,a.mlc||o.color)})}function d(t){var e=t[0].trace,r=n.select(this).select("g.legendpoints").selectAll("path.legendbox").data(a.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(){var t=e.line.width,r=n.select(this);r.style("stroke-width",t+"px").call(l.fill,e.fillcolor),t&&r.call(l.stroke,e.line.color)})}function h(t){var e=t[0].trace,r=n.select(this).select("g.legendpoints").selectAll("path.legendpie").data(a.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(c,t[0],e)}t.each(function(t){var e=n.select(this),r=e.selectAll("g.layers").data([0]);r.enter().append("g").classed("layers",!0),r.style("opacity",t[0].trace.opacity),r.selectAll("g.legendfill").data([t]).enter().append("g").classed("legendfill",!0),r.selectAll("g.legendlines").data([t]).enter().append("g").classed("legendlines",!0);var a=r.selectAll("g.legendsymbols").data([t]);a.enter().append("g").classed("legendsymbols",!0),a.selectAll("g.legendpoints").data([t]).enter().append("g").classed("legendpoints",!0)}).each(f).each(d).each(h).each(r).each(u)}},{"../../lib":154,"../../registry":234,"../../traces/pie/style_one":324,"../../traces/scatter/subtypes":346,"../color":41,"../drawing":65,d3:14}],100:[function(t,e,r){"use strict";function n(t,e){var r,n,a=e.currentTarget,o=a.getAttribute("data-attr"),i=a.getAttribute("data-val")||!0,l=t._fullLayout,s={},c=d.list(t,null,!0),f="on";if("zoom"===o){var h,p="in"===i?.5:2,g=(1+p)/2,m=(1-p)/2;for(n=0;n1)return n(["resetViews","toggleHover"]),i(v,r);u&&(n(["zoom3d","pan3d","orbitRotation","tableRotation"]),n(["resetCameraDefault3d","resetCameraLastSave3d"]),n(["hoverClosest3d"])),f&&(n(["zoomInGeo","zoomOutGeo","resetGeo"]),n(["hoverClosestGeo"]));var y=a(l),x=[];return((c||p)&&!y||g)&&(x=["zoom2d","pan2d"]),m&&(x=["pan2d"]),o(s)&&(x.push("select2d"),x.push("lasso2d")),x.length&&n(x),!c&&!p||y||g||n(["zoomIn2d","zoomOut2d","autoScale2d","resetScale2d"]),c&&h?n(["toggleHover"]):p?n(["hoverClosestGl2d"]):c?n(["toggleSpikelines","hoverClosestCartesian","hoverCompareCartesian"]):h?n(["hoverClosestPie"]):m&&n(["resetViewMapbox","toggleHover"]),i(v,r)}function a(t){for(var e=s.list({_fullLayout:t},null,!0),r=!0,n=0;n0)){var p=a(e,r,s);f("x",p[0]),f("y",p[1]),o.noneOrAll(t,e,["x","y"]),f("xanchor"),f("yanchor"),o.coerceFont(f,"font",r.font);var g=f("bgcolor");f("activecolor",i.contrast(g,c.lightAmount,c.darkAmount)),f("bordercolor"),f("borderwidth")}}},{"../../lib":154,"../color":41,"./attributes":104,"./button_attributes":105,"./constants":106}],108:[function(t,e,r){"use strict";function n(t){for(var e=v.list(t,"x",!0),r=[],n=0;np&&(p=d)));return p>=h?[h,p]:void 0}}var a=t("../../lib"),o=t("../../plots/cartesian/axes"),i=t("./constants"),l=t("./helpers");e.exports=function(t){var e=t._fullLayout,r=a.filterVisible(e.shapes);if(r.length&&t._fullData.length)for(var l=0;lZ&&n>X&&!t.shiftKey?p.getCursor(a/r,1-o/n):"move";g(e,i),G=i.split("-")[0]}function o(e){j=f.getFromId(t,r.xref),B=f.getFromId(t,r.yref),H=v.getDataToPixel(t,j),q=v.getDataToPixel(t,B,!0),V=v.getPixelToData(t,j),U=v.getPixelToData(t,B,!0);var o="shapes["+n+"]";"path"===r.type?(R=r.path,F=o+".path"):(m=H(r.x0),y=q(r.y0),x=H(r.x1),b=q(r.y1),_=o+".x0",w=o+".y0",k=o+".x1",M=o+".y1"),mX&&(h[z]=r[P]=U(c),h[S]=r[E]=U(u)),d-f>Z&&(h[O]=r[N]=V(f),h[D]=r[I]=V(d))}e.attr("d",i(t,r))}var h,m,y,x,b,_,w,k,M,A,T,L,C,z,S,O,D,P,E,N,I,R,F,j,B,H,q,V,U,G,Z=10,X=10,Y={element:e.node(),gd:t,prepFn:o,doneFn:l},W=Y.element.getBoundingClientRect();p.init(Y),e.node().onmousemove=a}function i(t,e){var r,n,a,o,i=e.type,s=f.getFromId(t,e.xref),c=f.getFromId(t,e.yref),u=t._fullLayout._size;if(s?(r=v.shapePositionToRange(s),n=function(t){return s._offset+s.r2p(r(t,!0))}):n=function(t){return u.l+u.w*t},c?(a=v.shapePositionToRange(c),o=function(t){return c._offset+c.r2p(a(t,!0))}):o=function(t){return u.t+u.h*(1-t)},"path"===i)return s&&"date"===s.type&&(n=v.decodeDate(n)),c&&"date"===c.type&&(o=v.decodeDate(o)),l(e.path,n,o);var d=n(e.x0),h=n(e.x1),p=o(e.y0),g=o(e.y1);if("line"===i)return"M"+d+","+p+"L"+h+","+g;if("rect"===i)return"M"+d+","+p+"H"+h+"V"+g+"H"+d+"Z";var m=(d+h)/2,y=(p+g)/2,x=Math.abs(m-d),b=Math.abs(y-p),_="A"+x+","+b,w=m+x+","+y;return"M"+w+_+" 0 1,1 "+m+","+(y-b)+_+" 0 0,1 "+w+"Z"}function l(t,e,r){return t.replace(m.segmentRE,function(t){var n=0,a=t.charAt(0),o=m.paramIsX[a],i=m.paramIsY[a],l=m.numParams[a],s=t.substr(1).replace(m.paramRE,function(t){return o[n]?t=e(t):i[n]&&(t=r(t)),n++,n>l&&(t="X"),t});return n>l&&(s=s.replace(/[\s,]*X.*/,""),u.log("Ignoring extra params in segment "+t)),a+s})}function s(t,e,r){return t.replace(m.segmentRE,function(t){var n=0,a=t.charAt(0),o=m.paramIsX[a],i=m.paramIsY[a],l=m.numParams[a];return a+t.substr(1).replace(m.paramRE,function(t){return n>=l?t:(o[n]?t=e(t):i[n]&&(t=r(t)),n++,t)})})}var c=t("../../plotly"),u=t("../../lib"),f=t("../../plots/cartesian/axes"),d=t("../color"),h=t("../drawing"),p=t("../dragelement"),g=t("../../lib/setcursor"),m=t("./constants"),v=t("./helpers");e.exports={draw:n,drawOne:a}},{"../../lib":154,"../../lib/setcursor":169,"../../plotly":185,"../../plots/cartesian/axes":190,"../color":41,"../dragelement":62,"../drawing":65,"./constants":119,"./helpers":122}],122:[function(t,e,r){"use strict";r.rangeToShapePosition=function(t){return"log"===t.type?t.r2d:function(t){return t}},r.shapePositionToRange=function(t){return"log"===t.type?t.d2r:function(t){return t}},r.decodeDate=function(t){return function(e){return e.replace&&(e=e.replace("_"," ")),t(e)}},r.encodeDate=function(t){return function(e){return t(e).replace(" ","_")}},r.getDataToPixel=function(t,e,n){var a,o=t._fullLayout._size;if(e){var i=r.shapePositionToRange(e);a=function(t){return e._offset+e.r2p(i(t,!0))},"date"===e.type&&(a=r.decodeDate(a))}else a=n?function(t){return o.t+o.h*(1-t)}:function(t){return o.l+o.w*t};return a},r.getPixelToData=function(t,e,n){var a,o=t._fullLayout._size;if(e){var i=r.rangeToShapePosition(e);a=function(t){return i(e.p2r(t-e._offset))}}else a=n?function(t){return 1-(t-o.t)/o.h}:function(t){return(t-o.l)/o.w};return a}},{}],123:[function(t,e,r){"use strict";var n=t("./draw");e.exports={moduleType:"component",name:"shapes",layoutAttributes:t("./attributes"),supplyLayoutDefaults:t("./defaults"),calcAutorange:t("./calc_autorange"),draw:n.draw,drawOne:n.drawOne}},{"./attributes":117,"./calc_autorange":118,"./defaults":120,"./draw":121}],124:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("../../plots/cartesian/axes"),o=t("./attributes"),i=t("./helpers");e.exports=function(t,e,r,l,s){function c(r,a){return n.coerce(t,e,o,r,a)}if(l=l||{},s=s||{},!c("visible",!s.itemIsNotPlainObject))return e;c("layer"),c("opacity"),c("fillcolor"),c("line.color"),c("line.width"),c("line.dash");for(var u=t.path?"path":"rect",f=c("type",u),d=["x","y"],h=0;h<2;h++){var p=d[h],g={_fullLayout:r},m=a.coerceRef(t,e,g,p,"","paper");if("path"!==f){var v,y,x;"paper"!==m?(v=a.getFromId(g,m),x=i.rangeToShapePosition(v),y=i.shapePositionToRange(v)):y=x=n.identity;var b=p+"0",_=p+"1",w=t[b],k=t[_];t[b]=y(t[b],!0),t[_]=y(t[_],!0),a.coercePosition(e,g,c,m,b,.25),a.coercePosition(e,g,c,m,_,.75),e[b]=x(e[b]),e[_]=x(e[_]),t[b]=w,t[_]=k}}return"path"===f?c("path"):n.noneOrAll(t,e,["x0","x1","y0","y1"]),e}},{"../../lib":154,"../../plots/cartesian/axes":190,"./attributes":117,"./helpers":122}],125:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),a=t("../../plots/pad_attributes"),o=t("../../lib/extend").extendFlat,i=t("../../lib/extend").extendDeep,l=t("../../plots/animation_attributes"),s=t("./constants"),c={_isLinkedToArray:"step",method:{valType:"enumerated",values:["restyle","relayout","animate","update","skip"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string"},value:{valType:"string"},execute:{valType:"boolean",dflt:!0}};e.exports={_isLinkedToArray:"slider",visible:{valType:"boolean",dflt:!0},active:{valType:"number",min:0,dflt:0},steps:c,lenmode:{valType:"enumerated",values:["fraction","pixels"],dflt:"fraction"},len:{valType:"number",min:0,dflt:1},x:{valType:"number",min:-2,max:3,dflt:0},pad:i({},a,{},{t:{dflt:20}}),xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left"},y:{valType:"number",min:-2,max:3,dflt:0},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"top"},transition:{duration:{valType:"number",min:0,dflt:150},easing:{valType:"enumerated",values:l.transition.easing.values,dflt:"cubic-in-out"}},currentvalue:{visible:{valType:"boolean",dflt:!0},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left"},offset:{valType:"number",dflt:10},prefix:{valType:"string"},suffix:{valType:"string"},font:o({},n,{})},font:o({},n,{}),activebgcolor:{valType:"color",dflt:s.gripBgActiveColor},bgcolor:{valType:"color",dflt:s.railBgColor},bordercolor:{valType:"color",dflt:s.railBorderColor},borderwidth:{valType:"number",min:0,dflt:s.railBorderWidth},ticklen:{valType:"number",min:0,dflt:s.tickLength},tickcolor:{valType:"color",dflt:s.tickColor},tickwidth:{valType:"number",min:0,dflt:1},minorticklen:{valType:"number",min:0,dflt:s.minorTickLength}}},{"../../lib/extend":149,"../../plots/animation_attributes":186,"../../plots/font_attributes":214,"../../plots/pad_attributes":218,"./constants":126}],126:[function(t,e,r){"use strict";e.exports={name:"sliders",containerClassName:"slider-container",groupClassName:"slider-group",inputAreaClass:"slider-input-area",railRectClass:"slider-rail-rect",railTouchRectClass:"slider-rail-touch-rect",gripRectClass:"slider-grip-rect",tickRectClass:"slider-tick-rect",inputProxyClass:"slider-input-proxy",labelsClass:"slider-labels",labelGroupClass:"slider-label-group",labelClass:"slider-label",currentValueClass:"slider-current-value",railHeight:5,menuIndexAttrName:"slider-active-index",autoMarginIdRoot:"slider-",minWidth:30,minHeight:30,textPadX:40,arrowOffsetX:4,railRadius:2,railWidth:5,railBorder:4,railBorderWidth:1,railBorderColor:"#bec8d9",railBgColor:"#f8fafc",railInset:8,stepInset:10,gripRadius:10,gripWidth:20,gripHeight:20,gripBorder:20,gripBorderWidth:1,gripBorderColor:"#bec8d9",gripBgColor:"#f6f8fa",gripBgActiveColor:"#dbdde0",labelPadding:8,labelOffset:0,tickWidth:1,tickColor:"#333",tickOffset:25,tickLength:7,minorTickOffset:25,minorTickColor:"#333",minorTickLength:4,currentValuePadding:8,currentValueInset:0}},{}],127:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return o.coerce(t,e,l,r,n)}n("visible",a(t,e).length>0)&&(n("active"),n("x"),n("y"),o.noneOrAll(t,e,["x","y"]),n("xanchor"),n("yanchor"),n("len"),n("lenmode"),n("pad.t"),n("pad.r"),n("pad.b"),n("pad.l"),o.coerceFont(n,"font",r.font),n("currentvalue.visible")&&(n("currentvalue.xanchor"),n("currentvalue.prefix"),n("currentvalue.suffix"),n("currentvalue.offset"),o.coerceFont(n,"currentvalue.font",e.font)),n("transition.duration"),n("transition.easing"),n("bgcolor"),n("activebgcolor"),n("bordercolor"),n("borderwidth"),n("ticklen"),n("tickwidth"),n("tickcolor"),n("minorticklen"))}function a(t,e){function r(t,e){return o.coerce(n,a,u,t,e)}for(var n,a,i=t.steps||[],l=e.steps=[],s=0;s=r.steps.length&&(r.active=0),e.call(l,r).call(b,r).call(u,r).call(p,r).call(x,t,r).call(s,t,r),A.setTranslate(e,r.lx+r.pad.l,r.ly+r.pad.t),e.call(m,r,r.active/(r.steps.length-1),!1),e.call(l,r)}function l(t,e,r){if(e.currentvalue.visible){var n,a,o=t.selectAll("text").data([0]);switch(e.currentvalue.xanchor){case"right":n=e.inputAreaLength-C.currentValueInset-e.currentValueMaxWidth,a="left";break;case"center":n=.5*e.inputAreaLength,a="middle";break;default:n=C.currentValueInset,a="left"}o.enter().append("text").classed(C.labelClass,!0).classed("user-select-none",!0).attr({"text-anchor":a,"data-notex":1});var i=e.currentvalue.prefix?e.currentvalue.prefix:"";if("string"==typeof r)i+=r;else{i+=e.steps[e.active].label}e.currentvalue.suffix&&(i+=e.currentvalue.suffix),o.call(A.font,e.currentvalue.font).text(i).call(T.convertToTspans,e.gd);var l=T.lineCount(o),s=(e.currentValueMaxLines+1-l)*e.currentvalue.font.size*z;return T.positionText(o,n,s),o}}function s(t,e,r){var n=t.selectAll("rect."+C.gripRectClass).data([0]);n.enter().append("rect").classed(C.gripRectClass,!0).call(h,e,t,r).style("pointer-events","all"),n.attr({width:C.gripWidth,height:C.gripHeight,rx:C.gripRadius,ry:C.gripRadius}).call(M.stroke,r.bordercolor).call(M.fill,r.bgcolor).style("stroke-width",r.borderwidth+"px")}function c(t,e,r){var n=t.selectAll("text").data([0]);return n.enter().append("text").classed(C.labelClass,!0).classed("user-select-none",!0).attr({"text-anchor":"middle","data-notex":1}),n.call(A.font,r.font).text(e.step.label).call(T.convertToTspans,r.gd),n}function u(t,e){var r=t.selectAll("g."+C.labelsClass).data([0]);r.enter().append("g").classed(C.labelsClass,!0);var n=r.selectAll("g."+C.labelGroupClass).data(e.labelSteps);n.enter().append("g").classed(C.labelGroupClass,!0),n.exit().remove(),n.each(function(t){var r=w.select(this);r.call(c,t,e),A.setTranslate(r,v(e,t.fraction),C.tickOffset+e.ticklen+e.font.size*z+C.labelOffset+e.currentValueTotalHeight)})}function f(t,e,r,n,a){var o=Math.round(n*(r.steps.length-1));o!==r.active&&d(t,e,r,o,!0,a)}function d(t,e,r,n,a,o){var i=r.active;r._input.active=r.active=n;var s=r.steps[r.active];e.call(m,r,r.active/(r.steps.length-1),o),e.call(l,r),t.emit("plotly_sliderchange",{slider:r,step:r.steps[r.active],interaction:a,previousActive:i}),s&&s.method&&a&&(e._nextMethod?(e._nextMethod.step=s,e._nextMethod.doCallback=a,e._nextMethod.doTransition=o):(e._nextMethod={step:s,doCallback:a,doTransition:o},e._nextMethodRaf=window.requestAnimationFrame(function(){var r=e._nextMethod.step;r.method&&(r.execute&&k.executeAPICommand(t,r.method,r.args),e._nextMethod=null,e._nextMethodRaf=null)})))}function h(t,e,r){function n(){return r.data()[0]}var a=r.node(),o=w.select(e);t.on("mousedown",function(){var t=n();e.emit("plotly_sliderstart",{slider:t});var i=r.select("."+C.gripRectClass);w.event.stopPropagation(),w.event.preventDefault(),i.call(M.fill,t.activebgcolor);var l=y(t,w.mouse(a)[0]);f(e,r,t,l,!0),t._dragging=!0,o.on("mousemove",function(){var t=n(),o=y(t,w.mouse(a)[0]);f(e,r,t,o,!1)}),o.on("mouseup",function(){var t=n();t._dragging=!1,i.call(M.fill,t.bgcolor),o.on("mouseup",null),o.on("mousemove",null),e.emit("plotly_sliderend",{slider:t,step:t.steps[t.active]})})})}function p(t,e){var r=t.selectAll("rect."+C.tickRectClass).data(e.steps);r.enter().append("rect").classed(C.tickRectClass,!0),r.exit().remove(),r.attr({width:e.tickwidth+"px","shape-rendering":"crispEdges"}),r.each(function(t,r){var n=r%e.labelStride==0,a=w.select(this);a.attr({height:n?e.ticklen:e.minorticklen}).call(M.fill,e.tickcolor),A.setTranslate(a,v(e,r/(e.steps.length-1))-.5*e.tickwidth,(n?C.tickOffset:C.minorTickOffset)+e.currentValueTotalHeight)})}function g(t){t.labelSteps=[];for(var e=t.steps.length,r=0;r0&&(i=i.transition().duration(e.transition.duration).ease(e.transition.easing)),i.attr("transform","translate("+(o-.5*C.gripWidth)+","+e.currentValueTotalHeight+")")}}function v(t,e){return t.inputAreaStart+C.stepInset+(t.inputAreaLength-2*C.stepInset)*Math.min(1,Math.max(0,e))}function y(t,e){return Math.min(1,Math.max(0,(e-C.stepInset-t.inputAreaStart)/(t.inputAreaLength-2*C.stepInset-2*t.inputAreaStart)))}function x(t,e,r){var n=t.selectAll("rect."+C.railTouchRectClass).data([0]);n.enter().append("rect").classed(C.railTouchRectClass,!0).call(h,e,t,r).style("pointer-events","all"),n.attr({width:r.inputAreaLength,height:Math.max(r.inputAreaWidth,C.tickOffset+r.ticklen+r.labelHeight)}).call(M.fill,r.bgcolor).attr("opacity",0),A.setTranslate(n,0,r.currentValueTotalHeight)}function b(t,e){var r=t.selectAll("rect."+C.railRectClass).data([0]);r.enter().append("rect").classed(C.railRectClass,!0);var n=e.inputAreaLength-2*C.railInset;r.attr({width:n,height:C.railWidth,rx:C.railRadius,ry:C.railRadius,"shape-rendering":"crispEdges"}).call(M.stroke,e.bordercolor).call(M.fill,e.bgcolor).style("stroke-width",e.borderwidth+"px"),A.setTranslate(r,C.railInset,.5*(e.inputAreaWidth-C.railWidth)+e.currentValueTotalHeight)}function _(t){for(var e=t._fullLayout._pushmargin||{},r=Object.keys(e),n=0;n0?[0]:[]);if(l.enter().append("g").classed(C.containerClassName,!0).style("cursor","ew-resize"),l.exit().remove(),l.exit().size()&&_(t),0!==r.length){var s=l.selectAll("g."+C.groupClassName).data(r,a);s.enter().append("g").classed(C.groupClassName,!0),s.exit().each(function(e){w.select(this).remove(),e._commandObserver.remove(),delete e._commandObserver,k.autoMargin(t,C.autoMarginIdRoot+e._index)});for(var c=0;c0||d<0){var g={left:[-r,0],right:[r,0],top:[0,-r],bottom:[0,r]}[_.side];e.attr("transform","translate("+g+")")}}}var m,v=r.propContainer,y=r.propName,x=r.traceIndex,b=r.dfltName,_=r.avoid||{},w=r.attributes,k=r.transform,M=r.containerGroup,A=t._fullLayout,T=v.titlefont.family,L=v.titlefont.size,C=v.titlefont.color,z=1,S=!1,O=v.title.trim();"title"===y?m="titleText":-1!==y.indexOf("axis")?m="axisTitleText":y.indexOf(!0)&&(m="colorbarTitleText");var D=t._context.edits[m];""===O&&(z=0),O.match(d)&&(z=.2,S=!0,D||(O=""));var P=O||D;M||(M=A._infolayer.selectAll(".g-"+e).data([0]),M.enter().append("g").classed("g-"+e,!0));var E=M.selectAll("text").data(P?[0]:[]);if(E.enter().append("text"),E.text(O).attr("class",e),E.exit().remove(),P){E.call(h);var N="Click to enter "+b+" title";D&&(O?E.on(".opacity",null):function(){z=0,S=!0,O=N,E.text(O).on("mouseover.opacity",function(){n.select(this).transition().duration(f.SHOW_PLACEHOLDER).style("opacity",1)}).on("mouseout.opacity",function(){n.select(this).transition().duration(f.HIDE_PLACEHOLDER).style("opacity",0)})}(),E.call(u.makeEditable,{gd:t}).on("edit",function(e){void 0!==x?o.restyle(t,y,e,x):o.relayout(t,y,e)}).on("cancel",function(){this.text(this.attr("data-unformatted")).call(h)}).on("input",function(t){this.text(t||" ").call(u.positionText,w.x,w.y)})),E.classed("js-placeholder",S)}}},{"../../constants/interactions":138,"../../lib":154,"../../lib/svg_text_utils":171,"../../plotly":185,"../../plots/plots":219,"../color":41,"../drawing":65,d3:14,"fast-isnumeric":17}],131:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),a=t("../color/attributes"),o=t("../../lib/extend").extendFlat,i=t("../../plots/pad_attributes"),l={_isLinkedToArray:"button",method:{valType:"enumerated",values:["restyle","relayout","animate","update","skip"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string",dflt:""},execute:{valType:"boolean",dflt:!0}};e.exports={_isLinkedToArray:"updatemenu",_arrayAttrRegexps:[/^updatemenus\[(0|[1-9][0-9]+)\]\.buttons/],visible:{valType:"boolean"},type:{valType:"enumerated",values:["dropdown","buttons"],dflt:"dropdown"},direction:{valType:"enumerated",values:["left","right","up","down"],dflt:"down"},active:{valType:"integer",min:-1,dflt:0},showactive:{valType:"boolean",dflt:!0},buttons:l,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:"top"},pad:o({},i,{}),font:o({},n,{}),bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:a.borderLine},borderwidth:{valType:"number",min:0,dflt:1}}},{"../../lib/extend":149,"../../plots/font_attributes":214,"../../plots/pad_attributes":218,"../color/attributes":40}],132:[function(t,e,r){"use strict";e.exports={name:"updatemenus",containerClassName:"updatemenu-container",headerGroupClassName:"updatemenu-header-group",headerClassName:"updatemenu-header",headerArrowClassName:"updatemenu-header-arrow",dropdownButtonGroupClassName:"updatemenu-dropdown-button-group",dropdownButtonClassName:"updatemenu-dropdown-button",buttonClassName:"updatemenu-button",itemRectClassName:"updatemenu-item-rect",itemTextClassName:"updatemenu-item-text",menuIndexAttrName:"updatemenu-active-index",autoMarginIdRoot:"updatemenu-",blankHeaderOpts:{label:" "},minWidth:30,minHeight:30,textPadX:24,arrowPadX:16,rx:2,ry:2,textOffsetX:12,textOffsetY:3,arrowOffsetX:4,gapButtonHeader:5,gapButton:2,activeColor:"#F4FAFF",hoverColor:"#F4FAFF",arrowSymbol:{left:"\u25c4",right:"\u25ba",up:"\u25b2",down:"\u25bc"}}},{}],133:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return o.coerce(t,e,l,r,n)}n("visible",a(t,e).length>0)&&(n("active"),n("direction"),n("type"),n("showactive"),n("x"),n("y"),o.noneOrAll(t,e,["x","y"]),n("xanchor"),n("yanchor"),n("pad.t"),n("pad.r"),n("pad.b"),n("pad.l"),o.coerceFont(n,"font",r.font),n("bgcolor",r.paper_bgcolor),n("bordercolor"),n("borderwidth"))}function a(t,e){function r(t,e){return o.coerce(n,a,u,t,e)}for(var n,a,i=t.buttons||[],l=e.buttons=[],s=0;s0?[0]:[]);if(o.enter().append("g").classed(z.containerClassName,!0).style("cursor","pointer"),o.exit().remove(),o.exit().size()&&_(t),0!==r.length){var u=o.selectAll("g."+z.headerGroupClassName).data(r,a);u.enter().append("g").classed(z.headerGroupClassName,!0);var f=o.selectAll("g."+z.dropdownButtonGroupClassName).data([0]);f.enter().append("g").classed(z.dropdownButtonGroupClassName,!0).style("pointer-events","all");for(var d=0;dk,T=n.barLength+2*n.barPad,L=n.barWidth+2*n.barPad,C=p,z=m+v;z+L>c&&(z=c-L);var S=this.container.selectAll("rect.scrollbar-horizontal").data(A?[0]:[]);S.exit().on(".drag",null).remove(),S.enter().append("rect").classed("scrollbar-horizontal",!0).call(o.fill,n.barColor),A?(this.hbar=S.attr({rx:n.barRadius,ry:n.barRadius,x:C,y:z,width:T,height:L}),this._hbarXMin=C+T/2,this._hbarTranslateMax=k-T):(delete this.hbar,delete this._hbarXMin,delete this._hbarTranslateMax);var O=v>M,D=n.barWidth+2*n.barPad,P=n.barLength+2*n.barPad,E=p+g,N=m;E+D>s&&(E=s-D);var I=this.container.selectAll("rect.scrollbar-vertical").data(O?[0]:[]);I.exit().on(".drag",null).remove(),I.enter().append("rect").classed("scrollbar-vertical",!0).call(o.fill,n.barColor),O?(this.vbar=I.attr({rx:n.barRadius,ry:n.barRadius,x:E,y:N,width:D,height:P}),this._vbarYMin=N+P/2,this._vbarTranslateMax=M-P):(delete this.vbar,delete this._vbarYMin,delete this._vbarTranslateMax);var R=this.id,F=u-.5,j=O?f+D+.5:f+.5,B=d-.5,H=A?h+L+.5:h+.5,q=l._topdefs.selectAll("#"+R).data(A||O?[0]:[]);if(q.exit().remove(),q.enter().append("clipPath").attr("id",R).append("rect"),A||O?(this._clipRect=q.select("rect").attr({x:Math.floor(F),y:Math.floor(B),width:Math.ceil(j)-Math.floor(F),height:Math.ceil(H)-Math.floor(B)}),this.container.call(i.setClipUrl,R),this.bg.attr({x:p,y:m,width:g,height:v})):(this.bg.attr({width:0,height:0}),this.container.on("wheel",null).on(".drag",null).call(i.setClipUrl,null),delete this._clipRect),A||O){var V=a.behavior.drag().on("dragstart",function(){a.event.sourceEvent.preventDefault()}).on("drag",this._onBoxDrag.bind(this));this.container.on("wheel",null).on("wheel",this._onBoxWheel.bind(this)).on(".drag",null).call(V);var U=a.behavior.drag().on("dragstart",function(){a.event.sourceEvent.preventDefault(),a.event.sourceEvent.stopPropagation()}).on("drag",this._onBarDrag.bind(this));A&&this.hbar.on(".drag",null).call(U),O&&this.vbar.on(".drag",null).call(U)}this.setTranslate(e,r)},n.prototype.disable=function(){(this.hbar||this.vbar)&&(this.bg.attr({width:0,height:0}),this.container.on("wheel",null).on(".drag",null).call(i.setClipUrl,null),delete this._clipRect),this.hbar&&(this.hbar.on(".drag",null),this.hbar.remove(),delete this.hbar,delete this._hbarXMin,delete this._hbarTranslateMax),this.vbar&&(this.vbar.on(".drag",null),this.vbar.remove(),delete this.vbar,delete this._vbarYMin,delete this._vbarTranslateMax)},n.prototype._onBoxDrag=function(){var t=this.translateX,e=this.translateY;this.hbar&&(t-=a.event.dx),this.vbar&&(e-=a.event.dy),this.setTranslate(t,e)},n.prototype._onBoxWheel=function(){var t=this.translateX,e=this.translateY;this.hbar&&(t+=a.event.deltaY),this.vbar&&(e+=a.event.deltaY),this.setTranslate(t,e)},n.prototype._onBarDrag=function(){var t=this.translateX,e=this.translateY;if(this.hbar){var r=t+this._hbarXMin,n=r+this._hbarTranslateMax;t=(l.constrain(a.event.x,r,n)-r)/(n-r)*(this.position.w-this._box.w)}if(this.vbar){var o=e+this._vbarYMin,i=o+this._vbarTranslateMax;e=(l.constrain(a.event.y,o,i)-o)/(i-o)*(this.position.h-this._box.h)}this.setTranslate(t,e)},n.prototype.setTranslate=function(t,e){var r=this.position.w-this._box.w,n=this.position.h-this._box.h;if(t=l.constrain(t||0,0,r),e=l.constrain(e||0,0,n),this.translateX=t,this.translateY=e,this.container.call(i.setTranslate,this._box.l-this.position.l-t,this._box.t-this.position.t-e),this._clipRect&&this._clipRect.attr({x:Math.floor(this.position.l+t-.5),y:Math.floor(this.position.t+e-.5)}),this.hbar){var a=t/r;this.hbar.call(i.setTranslate,t+a*this._hbarTranslateMax,e)}if(this.vbar){var o=e/n;this.vbar.call(i.setTranslate,t,e+o*this._vbarTranslateMax)}}},{"../../lib":154,"../color":41,"../drawing":65,d3:14}],137:[function(t,e,r){"use strict";e.exports={FROM_BL:{left:0,center:.5,right:1,bottom:0,middle:.5,top:1},FROM_TL:{left:0,center:.5,right:1,bottom:1,middle:.5,top:0},LINE_SPACING:1.3,MID_SHIFT:.35}},{}],138:[function(t,e,r){"use strict";e.exports={SHOW_PLACEHOLDER:100,HIDE_PLACEHOLDER:1e3,DBLCLICKDELAY:300,DESELECTDIM:.2}},{}],139:[function(t,e,r){"use strict";e.exports={BADNUM:void 0,FP_SAFE:Number.MAX_VALUE/1e4,ONEAVGYEAR:315576e5,ONEAVGMONTH:26298e5,ONEDAY:864e5,ONEHOUR:36e5,ONEMIN:6e4,ONESEC:1e3,EPOCHJD:2440587.5,ALMOST_EQUAL:1-1e-6}},{}],140:[function(t,e,r){"use strict";e.exports={entityToUnicode:{mu:"\u03bc","#956":"\u03bc",amp:"&","#28":"&",lt:"<","#60":"<",gt:">","#62":">",nbsp:"\xa0","#160":"\xa0",times:"\xd7","#215":"\xd7",plusmn:"\xb1","#177":"\xb1",deg:"\xb0","#176":"\xb0"}}},{}],141:[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}},{}],142:[function(t,e,r){"use strict";var n=t("./plotly");r.version="1.29.1",t("es6-promise").polyfill(),t("../build/plotcss"),t("./fonts/mathjax_config"),r.plot=n.plot,r.newPlot=n.newPlot,r.restyle=n.restyle,r.relayout=n.relayout,r.redraw=n.redraw,r.update=n.update,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=t("./plot_api/register"),r.toImage=t("./plot_api/to_image"),r.downloadImage=t("./snapshot/download"),r.validate=t("./plot_api/validate"),r.addFrames=n.addFrames,r.deleteFrames=n.deleteFrames,r.animate=n.animate,r.register(t("./traces/scatter")),r.register([t("./components/fx"),t("./components/legend"),t("./components/annotations"),t("./components/annotations3d"),t("./components/shapes"),t("./components/images"),t("./components/updatemenus"),t("./components/sliders"),t("./components/rangeslider"),t("./components/rangeselector")]),r.Icons=t("../build/ploticon"),r.Plots=n.Plots,r.Fx=t("./components/fx"),r.Snapshot=t("./snapshot"),r.PlotSchema=t("./plot_api/plot_schema"),r.Queue=t("./lib/queue"),r.d3=t("d3")},{"../build/plotcss":1,"../build/ploticon":2,"./components/annotations":34,"./components/annotations3d":39,"./components/fx":82,"./components/images":90,"./components/legend":98,"./components/rangeselector":110,"./components/rangeslider":116,"./components/shapes":123,"./components/sliders":129,"./components/updatemenus":135,"./fonts/mathjax_config":143,"./lib/queue":166,"./plot_api/plot_schema":179,"./plot_api/register":180,"./plot_api/set_plot_config":181,"./plot_api/to_image":183,"./plot_api/validate":184,"./plotly":185,"./snapshot":239,"./snapshot/download":236,"./traces/scatter":336,d3:14,"es6-promise":15}],143:[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},{}],144:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("../constants/numerical").BADNUM,o=/^['"%,$#\s']+|[, ]|['"%,$#\s']+$/g;e.exports=function(t){return"string"==typeof t&&(t=t.replace(o,"")),n(t)?Number(t):a}},{"../constants/numerical":139,"fast-isnumeric":17}],145:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("tinycolor2"),o=t("../plots/attributes"),i=t("../components/colorscale/get_scale"),l=(Object.keys(t("../components/colorscale/scales")),t("./nested_property")),s=/^([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)},validateFunction:function(t,e){e.coerceNumber&&(t=+t);for(var r=e.values,n=0;na.max?e.set(r):e.set(+t)}},integer:{coerceFunction:function(t,e,r,a){t%1||!n(t)||void 0!==a.min&&ta.max?e.set(r):e.set(+t)}},string:{coerceFunction:function(t,e,r,n){if("string"!=typeof t){var a="number"==typeof t;!0!==n.strict&&a?e.set(String(t)):e.set(r)}else n.noBlank&&!t?e.set(r):e.set(t)}},color:{coerceFunction:function(t,e,r){a(t).isValid()?e.set(t):e.set(r)}},colorscale:{coerceFunction:function(t,e,r){e.set(i(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;if("string"==typeof t&&t.substr(0,n)===r&&s.test(t.substr(n)))return void e.set(t);e.set(r)},validateFunction:function(t,e){var r=e.dflt,n=r.length;return t===r||"string"==typeof t&&!(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 a=t.split("+"),o=0;o=r.steps.length&&(r.active=0),e.call(l,r).call(b,r).call(u,r).call(p,r).call(x,t,r).call(s,t,r),A.setTranslate(e,r.lx+r.pad.l,r.ly+r.pad.t),e.call(m,r,r.active/(r.steps.length-1),!1),e.call(l,r)}function l(t,e,r){if(e.currentvalue.visible){var n,a,o=t.selectAll("text").data([0]);switch(e.currentvalue.xanchor){case"right":n=e.inputAreaLength-C.currentValueInset-e.currentValueMaxWidth,a="left";break;case"center":n=.5*e.inputAreaLength,a="middle";break;default:n=C.currentValueInset,a="left"}o.enter().append("text").classed(C.labelClass,!0).classed("user-select-none",!0).attr({"text-anchor":a,"data-notex":1});var i=e.currentvalue.prefix?e.currentvalue.prefix:"";if("string"==typeof r)i+=r;else{i+=e.steps[e.active].label}e.currentvalue.suffix&&(i+=e.currentvalue.suffix),o.call(A.font,e.currentvalue.font).text(i).call(T.convertToTspans,e.gd);var l=T.lineCount(o),s=(e.currentValueMaxLines+1-l)*e.currentvalue.font.size*z;return T.positionText(o,n,s),o}}function s(t,e,r){var n=t.selectAll("rect."+C.gripRectClass).data([0]);n.enter().append("rect").classed(C.gripRectClass,!0).call(h,e,t,r).style("pointer-events","all"),n.attr({width:C.gripWidth,height:C.gripHeight,rx:C.gripRadius,ry:C.gripRadius}).call(M.stroke,r.bordercolor).call(M.fill,r.bgcolor).style("stroke-width",r.borderwidth+"px")}function c(t,e,r){var n=t.selectAll("text").data([0]);return n.enter().append("text").classed(C.labelClass,!0).classed("user-select-none",!0).attr({"text-anchor":"middle","data-notex":1}),n.call(A.font,r.font).text(e.step.label).call(T.convertToTspans,r.gd),n}function u(t,e){var r=t.selectAll("g."+C.labelsClass).data([0]);r.enter().append("g").classed(C.labelsClass,!0);var n=r.selectAll("g."+C.labelGroupClass).data(e.labelSteps);n.enter().append("g").classed(C.labelGroupClass,!0),n.exit().remove(),n.each(function(t){var r=w.select(this);r.call(c,t,e),A.setTranslate(r,v(e,t.fraction),C.tickOffset+e.ticklen+e.font.size*z+C.labelOffset+e.currentValueTotalHeight)})}function f(t,e,r,n,a){var o=Math.round(n*(r.steps.length-1));o!==r.active&&d(t,e,r,o,!0,a)}function d(t,e,r,n,a,o){var i=r.active;r._input.active=r.active=n;var s=r.steps[r.active];e.call(m,r,r.active/(r.steps.length-1),o),e.call(l,r),t.emit("plotly_sliderchange",{slider:r,step:r.steps[r.active],interaction:a,previousActive:i}),s&&s.method&&a&&(e._nextMethod?(e._nextMethod.step=s,e._nextMethod.doCallback=a,e._nextMethod.doTransition=o):(e._nextMethod={step:s,doCallback:a,doTransition:o},e._nextMethodRaf=window.requestAnimationFrame(function(){var r=e._nextMethod.step;r.method&&(r.execute&&k.executeAPICommand(t,r.method,r.args),e._nextMethod=null,e._nextMethodRaf=null)})))}function h(t,e,r){function n(){return r.data()[0]}var a=r.node(),o=w.select(e);t.on("mousedown",function(){var t=n();e.emit("plotly_sliderstart",{slider:t});var i=r.select("."+C.gripRectClass);w.event.stopPropagation(),w.event.preventDefault(),i.call(M.fill,t.activebgcolor);var l=y(t,w.mouse(a)[0]);f(e,r,t,l,!0),t._dragging=!0,o.on("mousemove",function(){var t=n(),o=y(t,w.mouse(a)[0]);f(e,r,t,o,!1)}),o.on("mouseup",function(){var t=n();t._dragging=!1,i.call(M.fill,t.bgcolor),o.on("mouseup",null),o.on("mousemove",null),e.emit("plotly_sliderend",{slider:t,step:t.steps[t.active]})})})}function p(t,e){var r=t.selectAll("rect."+C.tickRectClass).data(e.steps);r.enter().append("rect").classed(C.tickRectClass,!0),r.exit().remove(),r.attr({width:e.tickwidth+"px","shape-rendering":"crispEdges"}),r.each(function(t,r){var n=r%e.labelStride==0,a=w.select(this);a.attr({height:n?e.ticklen:e.minorticklen}).call(M.fill,e.tickcolor),A.setTranslate(a,v(e,r/(e.steps.length-1))-.5*e.tickwidth,(n?C.tickOffset:C.minorTickOffset)+e.currentValueTotalHeight)})}function g(t){t.labelSteps=[];for(var e=t.steps.length,r=0;r0&&(i=i.transition().duration(e.transition.duration).ease(e.transition.easing)),i.attr("transform","translate("+(o-.5*C.gripWidth)+","+e.currentValueTotalHeight+")")}}function v(t,e){return t.inputAreaStart+C.stepInset+(t.inputAreaLength-2*C.stepInset)*Math.min(1,Math.max(0,e))}function y(t,e){return Math.min(1,Math.max(0,(e-C.stepInset-t.inputAreaStart)/(t.inputAreaLength-2*C.stepInset-2*t.inputAreaStart)))}function x(t,e,r){var n=t.selectAll("rect."+C.railTouchRectClass).data([0]);n.enter().append("rect").classed(C.railTouchRectClass,!0).call(h,e,t,r).style("pointer-events","all"),n.attr({width:r.inputAreaLength,height:Math.max(r.inputAreaWidth,C.tickOffset+r.ticklen+r.labelHeight)}).call(M.fill,r.bgcolor).attr("opacity",0),A.setTranslate(n,0,r.currentValueTotalHeight)}function b(t,e){var r=t.selectAll("rect."+C.railRectClass).data([0]);r.enter().append("rect").classed(C.railRectClass,!0);var n=e.inputAreaLength-2*C.railInset;r.attr({width:n,height:C.railWidth,rx:C.railRadius,ry:C.railRadius,"shape-rendering":"crispEdges"}).call(M.stroke,e.bordercolor).call(M.fill,e.bgcolor).style("stroke-width",e.borderwidth+"px"),A.setTranslate(r,C.railInset,.5*(e.inputAreaWidth-C.railWidth)+e.currentValueTotalHeight)}function _(t){for(var e=t._fullLayout._pushmargin||{},r=Object.keys(e),n=0;n0?[0]:[]);if(l.enter().append("g").classed(C.containerClassName,!0).style("cursor","ew-resize"),l.exit().remove(),l.exit().size()&&_(t),0!==r.length){var s=l.selectAll("g."+C.groupClassName).data(r,a);s.enter().append("g").classed(C.groupClassName,!0),s.exit().each(function(e){w.select(this).remove(),e._commandObserver.remove(),delete e._commandObserver,k.autoMargin(t,C.autoMarginIdRoot+e._index)});for(var c=0;c0||d<0){var g={left:[-r,0],right:[r,0],top:[0,-r],bottom:[0,r]}[_.side];e.attr("transform","translate("+g+")")}}}var m,v=r.propContainer,y=r.propName,x=r.traceIndex,b=r.dfltName,_=r.avoid||{},w=r.attributes,k=r.transform,M=r.containerGroup,A=t._fullLayout,T=v.titlefont.family,L=v.titlefont.size,C=v.titlefont.color,z=1,S=!1,O=v.title.trim();"title"===y?m="titleText":-1!==y.indexOf("axis")?m="axisTitleText":y.indexOf(!0)&&(m="colorbarTitleText");var D=t._context.edits[m];""===O&&(z=0),O.match(d)&&(z=.2,S=!0,D||(O=""));var P=O||D;M||(M=A._infolayer.selectAll(".g-"+e).data([0]),M.enter().append("g").classed("g-"+e,!0));var E=M.selectAll("text").data(P?[0]:[]);if(E.enter().append("text"),E.text(O).attr("class",e),E.exit().remove(),P){E.call(h);var N="Click to enter "+b+" title";D&&(O?E.on(".opacity",null):function(){z=0,S=!0,O=N,E.text(O).on("mouseover.opacity",function(){n.select(this).transition().duration(f.SHOW_PLACEHOLDER).style("opacity",1)}).on("mouseout.opacity",function(){n.select(this).transition().duration(f.HIDE_PLACEHOLDER).style("opacity",0)})}(),E.call(u.makeEditable,{gd:t}).on("edit",function(e){void 0!==x?o.restyle(t,y,e,x):o.relayout(t,y,e)}).on("cancel",function(){this.text(this.attr("data-unformatted")).call(h)}).on("input",function(t){this.text(t||" ").call(u.positionText,w.x,w.y)})),E.classed("js-placeholder",S)}}},{"../../constants/interactions":138,"../../lib":154,"../../lib/svg_text_utils":171,"../../plotly":185,"../../plots/plots":219,"../color":41,"../drawing":65,d3:14,"fast-isnumeric":17}],131:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),a=t("../color/attributes"),o=t("../../lib/extend").extendFlat,i=t("../../plots/pad_attributes"),l={_isLinkedToArray:"button",method:{valType:"enumerated",values:["restyle","relayout","animate","update","skip"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string",dflt:""},execute:{valType:"boolean",dflt:!0}};e.exports={_isLinkedToArray:"updatemenu",_arrayAttrRegexps:[/^updatemenus\[(0|[1-9][0-9]+)\]\.buttons/],visible:{valType:"boolean"},type:{valType:"enumerated",values:["dropdown","buttons"],dflt:"dropdown"},direction:{valType:"enumerated",values:["left","right","up","down"],dflt:"down"},active:{valType:"integer",min:-1,dflt:0},showactive:{valType:"boolean",dflt:!0},buttons:l,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:"top"},pad:o({},i,{}),font:o({},n,{}),bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:a.borderLine},borderwidth:{valType:"number",min:0,dflt:1}}},{"../../lib/extend":149,"../../plots/font_attributes":214,"../../plots/pad_attributes":218,"../color/attributes":40}],132:[function(t,e,r){"use strict";e.exports={name:"updatemenus",containerClassName:"updatemenu-container",headerGroupClassName:"updatemenu-header-group",headerClassName:"updatemenu-header",headerArrowClassName:"updatemenu-header-arrow",dropdownButtonGroupClassName:"updatemenu-dropdown-button-group",dropdownButtonClassName:"updatemenu-dropdown-button",buttonClassName:"updatemenu-button",itemRectClassName:"updatemenu-item-rect",itemTextClassName:"updatemenu-item-text",menuIndexAttrName:"updatemenu-active-index",autoMarginIdRoot:"updatemenu-",blankHeaderOpts:{label:" "},minWidth:30,minHeight:30,textPadX:24,arrowPadX:16,rx:2,ry:2,textOffsetX:12,textOffsetY:3,arrowOffsetX:4,gapButtonHeader:5,gapButton:2,activeColor:"#F4FAFF",hoverColor:"#F4FAFF",arrowSymbol:{left:"\u25c4",right:"\u25ba",up:"\u25b2",down:"\u25bc"}}},{}],133:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return o.coerce(t,e,l,r,n)}n("visible",a(t,e).length>0)&&(n("active"),n("direction"),n("type"),n("showactive"),n("x"),n("y"),o.noneOrAll(t,e,["x","y"]),n("xanchor"),n("yanchor"),n("pad.t"),n("pad.r"),n("pad.b"),n("pad.l"),o.coerceFont(n,"font",r.font),n("bgcolor",r.paper_bgcolor),n("bordercolor"),n("borderwidth"))}function a(t,e){function r(t,e){return o.coerce(n,a,u,t,e)}for(var n,a,i=t.buttons||[],l=e.buttons=[],s=0;s0?[0]:[]);if(o.enter().append("g").classed(z.containerClassName,!0).style("cursor","pointer"),o.exit().remove(),o.exit().size()&&_(t),0!==r.length){var u=o.selectAll("g."+z.headerGroupClassName).data(r,a);u.enter().append("g").classed(z.headerGroupClassName,!0);var f=o.selectAll("g."+z.dropdownButtonGroupClassName).data([0]);f.enter().append("g").classed(z.dropdownButtonGroupClassName,!0).style("pointer-events","all");for(var d=0;dk,T=n.barLength+2*n.barPad,L=n.barWidth+2*n.barPad,C=p,z=m+v;z+L>c&&(z=c-L);var S=this.container.selectAll("rect.scrollbar-horizontal").data(A?[0]:[]);S.exit().on(".drag",null).remove(),S.enter().append("rect").classed("scrollbar-horizontal",!0).call(o.fill,n.barColor),A?(this.hbar=S.attr({rx:n.barRadius,ry:n.barRadius,x:C,y:z,width:T,height:L}),this._hbarXMin=C+T/2,this._hbarTranslateMax=k-T):(delete this.hbar,delete this._hbarXMin,delete this._hbarTranslateMax);var O=v>M,D=n.barWidth+2*n.barPad,P=n.barLength+2*n.barPad,E=p+g,N=m;E+D>s&&(E=s-D);var I=this.container.selectAll("rect.scrollbar-vertical").data(O?[0]:[]);I.exit().on(".drag",null).remove(),I.enter().append("rect").classed("scrollbar-vertical",!0).call(o.fill,n.barColor),O?(this.vbar=I.attr({rx:n.barRadius,ry:n.barRadius,x:E,y:N,width:D,height:P}),this._vbarYMin=N+P/2,this._vbarTranslateMax=M-P):(delete this.vbar,delete this._vbarYMin,delete this._vbarTranslateMax);var R=this.id,F=u-.5,j=O?f+D+.5:f+.5,B=d-.5,H=A?h+L+.5:h+.5,q=l._topdefs.selectAll("#"+R).data(A||O?[0]:[]);if(q.exit().remove(),q.enter().append("clipPath").attr("id",R).append("rect"),A||O?(this._clipRect=q.select("rect").attr({x:Math.floor(F),y:Math.floor(B),width:Math.ceil(j)-Math.floor(F),height:Math.ceil(H)-Math.floor(B)}),this.container.call(i.setClipUrl,R),this.bg.attr({x:p,y:m,width:g,height:v})):(this.bg.attr({width:0,height:0}),this.container.on("wheel",null).on(".drag",null).call(i.setClipUrl,null),delete this._clipRect),A||O){var V=a.behavior.drag().on("dragstart",function(){a.event.sourceEvent.preventDefault()}).on("drag",this._onBoxDrag.bind(this));this.container.on("wheel",null).on("wheel",this._onBoxWheel.bind(this)).on(".drag",null).call(V);var U=a.behavior.drag().on("dragstart",function(){a.event.sourceEvent.preventDefault(),a.event.sourceEvent.stopPropagation()}).on("drag",this._onBarDrag.bind(this));A&&this.hbar.on(".drag",null).call(U),O&&this.vbar.on(".drag",null).call(U)}this.setTranslate(e,r)},n.prototype.disable=function(){(this.hbar||this.vbar)&&(this.bg.attr({width:0,height:0}),this.container.on("wheel",null).on(".drag",null).call(i.setClipUrl,null),delete this._clipRect),this.hbar&&(this.hbar.on(".drag",null),this.hbar.remove(),delete this.hbar,delete this._hbarXMin,delete this._hbarTranslateMax),this.vbar&&(this.vbar.on(".drag",null),this.vbar.remove(),delete this.vbar,delete this._vbarYMin,delete this._vbarTranslateMax)},n.prototype._onBoxDrag=function(){var t=this.translateX,e=this.translateY;this.hbar&&(t-=a.event.dx),this.vbar&&(e-=a.event.dy),this.setTranslate(t,e)},n.prototype._onBoxWheel=function(){var t=this.translateX,e=this.translateY;this.hbar&&(t+=a.event.deltaY),this.vbar&&(e+=a.event.deltaY),this.setTranslate(t,e)},n.prototype._onBarDrag=function(){var t=this.translateX,e=this.translateY;if(this.hbar){var r=t+this._hbarXMin,n=r+this._hbarTranslateMax;t=(l.constrain(a.event.x,r,n)-r)/(n-r)*(this.position.w-this._box.w)}if(this.vbar){var o=e+this._vbarYMin,i=o+this._vbarTranslateMax;e=(l.constrain(a.event.y,o,i)-o)/(i-o)*(this.position.h-this._box.h)}this.setTranslate(t,e)},n.prototype.setTranslate=function(t,e){var r=this.position.w-this._box.w,n=this.position.h-this._box.h;if(t=l.constrain(t||0,0,r),e=l.constrain(e||0,0,n),this.translateX=t,this.translateY=e,this.container.call(i.setTranslate,this._box.l-this.position.l-t,this._box.t-this.position.t-e),this._clipRect&&this._clipRect.attr({x:Math.floor(this.position.l+t-.5),y:Math.floor(this.position.t+e-.5)}),this.hbar){var a=t/r;this.hbar.call(i.setTranslate,t+a*this._hbarTranslateMax,e)}if(this.vbar){var o=e/n;this.vbar.call(i.setTranslate,t,e+o*this._vbarTranslateMax)}}},{"../../lib":154,"../color":41,"../drawing":65,d3:14}],137:[function(t,e,r){"use strict";e.exports={FROM_BL:{left:0,center:.5,right:1,bottom:0,middle:.5,top:1},FROM_TL:{left:0,center:.5,right:1,bottom:1,middle:.5,top:0},LINE_SPACING:1.3,MID_SHIFT:.35}},{}],138:[function(t,e,r){"use strict";e.exports={SHOW_PLACEHOLDER:100,HIDE_PLACEHOLDER:1e3,DBLCLICKDELAY:300,DESELECTDIM:.2}},{}],139:[function(t,e,r){"use strict";e.exports={BADNUM:void 0,FP_SAFE:Number.MAX_VALUE/1e4,ONEAVGYEAR:315576e5,ONEAVGMONTH:26298e5,ONEDAY:864e5,ONEHOUR:36e5,ONEMIN:6e4,ONESEC:1e3,EPOCHJD:2440587.5,ALMOST_EQUAL:1-1e-6}},{}],140:[function(t,e,r){"use strict";e.exports={entityToUnicode:{mu:"\u03bc","#956":"\u03bc",amp:"&","#28":"&",lt:"<","#60":"<",gt:">","#62":">",nbsp:"\xa0","#160":"\xa0",times:"\xd7","#215":"\xd7",plusmn:"\xb1","#177":"\xb1",deg:"\xb0","#176":"\xb0"}}},{}],141:[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}},{}],142:[function(t,e,r){"use strict";var n=t("./plotly");r.version="1.29.2",t("es6-promise").polyfill(),t("../build/plotcss"),t("./fonts/mathjax_config"),r.plot=n.plot,r.newPlot=n.newPlot,r.restyle=n.restyle,r.relayout=n.relayout,r.redraw=n.redraw,r.update=n.update,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=t("./plot_api/register"),r.toImage=t("./plot_api/to_image"),r.downloadImage=t("./snapshot/download"),r.validate=t("./plot_api/validate"),r.addFrames=n.addFrames,r.deleteFrames=n.deleteFrames,r.animate=n.animate,r.register(t("./traces/scatter")),r.register([t("./components/fx"),t("./components/legend"),t("./components/annotations"),t("./components/annotations3d"),t("./components/shapes"),t("./components/images"),t("./components/updatemenus"),t("./components/sliders"),t("./components/rangeslider"),t("./components/rangeselector")]),r.Icons=t("../build/ploticon"),r.Plots=n.Plots,r.Fx=t("./components/fx"),r.Snapshot=t("./snapshot"),r.PlotSchema=t("./plot_api/plot_schema"),r.Queue=t("./lib/queue"),r.d3=t("d3")},{"../build/plotcss":1,"../build/ploticon":2,"./components/annotations":34,"./components/annotations3d":39,"./components/fx":82,"./components/images":90,"./components/legend":98,"./components/rangeselector":110,"./components/rangeslider":116,"./components/shapes":123,"./components/sliders":129,"./components/updatemenus":135,"./fonts/mathjax_config":143,"./lib/queue":166,"./plot_api/plot_schema":179,"./plot_api/register":180,"./plot_api/set_plot_config":181,"./plot_api/to_image":183,"./plot_api/validate":184,"./plotly":185,"./snapshot":239,"./snapshot/download":236,"./traces/scatter":336,d3:14,"es6-promise":15}],143:[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},{}],144:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("../constants/numerical").BADNUM,o=/^['"%,$#\s']+|[, ]|['"%,$#\s']+$/g;e.exports=function(t){return"string"==typeof t&&(t=t.replace(o,"")),n(t)?Number(t):a}},{"../constants/numerical":139,"fast-isnumeric":17}],145:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("tinycolor2"),o=t("../plots/attributes"),i=t("../components/colorscale/get_scale"),l=(Object.keys(t("../components/colorscale/scales")),t("./nested_property")),s=/^([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)},validateFunction:function(t,e){e.coerceNumber&&(t=+t);for(var r=e.values,n=0;na.max?e.set(r):e.set(+t)}},integer:{coerceFunction:function(t,e,r,a){t%1||!n(t)||void 0!==a.min&&ta.max?e.set(r):e.set(+t)}},string:{coerceFunction:function(t,e,r,n){if("string"!=typeof t){var a="number"==typeof t;!0!==n.strict&&a?e.set(String(t)):e.set(r)}else n.noBlank&&!t?e.set(r):e.set(t)}},color:{coerceFunction:function(t,e,r){a(t).isValid()?e.set(t):e.set(r)}},colorscale:{coerceFunction:function(t,e,r){e.set(i(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;if("string"==typeof t&&t.substr(0,n)===r&&s.test(t.substr(n)))return void e.set(t);e.set(r)},validateFunction:function(t,e){var r=e.dflt,n=r.length;return t===r||"string"==typeof t&&!(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 a=t.split("+"),o=0;o0&&(i=i.replace(/0+$/,"").replace(/[\.]$/,"")),n+=":"+i}return n}function s(t){return t.formatDate("yyyy")}function c(t){return t.formatDate("M yyyy")}function u(t){return t.formatDate("M d")}function f(t){return t.formatDate("M d, yyyy")}var d=t("d3"),h=t("fast-isnumeric"),p=t("./loggers").error,g=t("./mod"),m=t("../constants/numerical"),v=m.BADNUM,y=m.ONEDAY,x=m.ONEHOUR,b=m.ONEMIN,_=m.ONESEC,w=m.EPOCHJD,k=t("../registry"),M=d.time.format.utc,A=/^\s*(-?\d\d\d\d|\d\d)(-(\d?\d)(-(\d?\d)([ Tt]([01]?\d|2[0-3])(:([0-5]\d)(:([0-5]\d(\.\d+)?))?(Z|z|[+\-]\d\d:?\d\d)?)?)?)?)?\s*$/m,T=/^\s*(-?\d\d\d\d|\d\d)(-(\d?\di?)(-(\d?\d)([ Tt]([01]?\d|2[0-3])(:([0-5]\d)(:([0-5]\d(\.\d+)?))?(Z|z|[+\-]\d\d:?\d\d)?)?)?)?)?\s*$/m,L=(new Date).getFullYear()-70;r.dateTick0=function(t,e){return n(t)?e?k.getComponentMethod("calendars","CANONICAL_SUNDAY")[t]:k.getComponentMethod("calendars","CANONICAL_TICK")[t]:e?"2000-01-02":"2000-01-01"},r.dfltRange=function(t){return n(t)?k.getComponentMethod("calendars","DFLTRANGE")[t]:["2000-01-01","2001-01-01"]},r.isJSDate=function(t){return"object"==typeof t&&null!==t&&"function"==typeof t.getTime};var C,z;r.dateTime2ms=function(t,e){if(r.isJSDate(t))return t=Number(t)-t.getTimezoneOffset()*b,t>=C&&t<=z?t:v;if("string"!=typeof t&&"number"!=typeof t)return v;t=String(t);var a=n(e),o=t.charAt(0);!a||"G"!==o&&"g"!==o||(t=t.substr(1),e="");var i=a&&"chinese"===e.substr(0,7),l=t.match(i?T:A);if(!l)return v;var s=l[1],c=l[3]||"1",u=Number(l[5]||1),f=Number(l[7]||0),d=Number(l[9]||0),h=Number(l[11]||0);if(a){if(2===s.length)return v;s=Number(s);var p;try{var g=k.getComponentMethod("calendars","getCal")(e);if(i){var m="i"===c.charAt(c.length-1);c=parseInt(c,10),p=g.newDate(s,g.toMonthIndex(s,c,m),u)}else p=g.newDate(s,Number(c),u)}catch(t){return v}return p?(p.toJD()-w)*y+f*x+d*b+h*_:v}s=2===s.length?(Number(s)+2e3-L)%100+L:Number(s),c-=1;var M=new Date(Date.UTC(2e3,c,u,f,d));return M.setUTCFullYear(s),M.getUTCMonth()!==c?v:M.getUTCDate()!==u?v:M.getTime()+h*_},C=r.MIN_MS=r.dateTime2ms("-9999"),z=r.MAX_MS=r.dateTime2ms("9999-12-31 23:59:59.9999"),r.isDateTime=function(t,e){return r.dateTime2ms(t,e)!==v};var S=90*y,O=3*x,D=5*b;r.ms2DateTime=function(t,e,r){if("number"!=typeof t||!(t>=C&&t<=z))return v;e||(e=0);var a,i,l,s,c,u,f=Math.floor(10*g(t+.05,1)),d=Math.round(t-f/10);if(n(r)){var h=Math.floor(d/y)+w,p=Math.floor(g(t,y));try{a=k.getComponentMethod("calendars","getCal")(r).fromJD(h).formatDate("yyyy-mm-dd")}catch(t){a=M("G%Y-%m-%d")(new Date(d))}if("-"===a.charAt(0))for(;a.length<11;)a="-0"+a.substr(1);else for(;a.length<10;)a="0"+a;i=e=C+y&&t<=z-y))return v;var e=Math.floor(10*g(t+.05,1)),r=new Date(Math.round(t-e/10));return o(d.time.format("%Y-%m-%d")(r),r.getHours(),r.getMinutes(),r.getSeconds(),10*r.getUTCMilliseconds()+e)},r.cleanDate=function(t,e,a){if(r.isJSDate(t)||"number"==typeof t){if(n(a))return p("JS Dates and milliseconds are incompatible with world calendars",t),e;if(!(t=r.ms2DateTimeLocal(+t))&&void 0!==e)return e}else if(!r.isDateTime(t,a))return p("unrecognized date",t),e;return t};var P=/%\d?f/g,E=[59,59.9,59.99,59.999,59.9999],N=M("%Y"),I=M("%b %Y"),R=M("%b %-d"),F=M("%b %-d, %Y");r.formatDate=function(t,e,r,a){var o,d;if(a=n(a)&&a,e)return i(e,t,a);if(a)try{var h=Math.floor((t+.05)/y)+w,p=k.getComponentMethod("calendars","getCal")(a).fromJD(h);"y"===r?d=s(p):"m"===r?d=c(p):"d"===r?(o=s(p),d=u(p)):(o=f(p),d=l(t,r))}catch(t){return"Invalid"}else{var g=new Date(Math.floor(t+.05));"y"===r?d=N(g):"m"===r?d=I(g):"d"===r?(o=N(g),d=R(g)):(o=F(g),d=l(t,r))}return d+(o?"\n"+o:"")};var j=3*y;r.incrementMonth=function(t,e,r){r=n(r)&&r;var a=g(t,y);if(t=Math.round(t-a),r)try{var o=Math.round(t/y)+w,i=k.getComponentMethod("calendars","getCal")(r),l=i.fromJD(o);return e%12?i.add(l,e,"m"):i.add(l,e/12,"y"),(l.toJD()-w)*y+a}catch(e){p("invalid ms "+t+" in calendar "+r)}var s=new Date(t+j);return s.setUTCMonth(s.getUTCMonth()+e)+a-j},r.findExactDates=function(t,e){for(var r,a,o=0,i=0,l=0,s=0,c=n(e)&&k.getComponentMethod("calendars","getCal")(e),u=0;u1||g<0||g>1?null:{x:t+s*g,y:e+f*g}}function a(t,e,r,n,a){var o=n*t+a*e;if(o<0)return n*n+a*a;if(o>r){var i=n-t,l=a-e;return i*i+l*l}var s=n*e-a*t;return s*s/r}var o=t("./mod");r.segmentsIntersect=n,r.segmentDistance=function(t,e,r,o,i,l,s,c){if(n(t,e,r,o,i,l,s,c))return 0;var u=r-t,f=o-e,d=s-i,h=c-l,p=u*u+f*f,g=d*d+h*h,m=Math.min(a(u,f,p,i-t,l-e),a(u,f,p,s-t,c-e),a(d,h,g,t-i,e-l),a(d,h,g,r-i,o-l));return Math.sqrt(m)};var i,l,s;r.getTextLocation=function(t,e,r,n){if(t===l&&n===s||(i={},l=t,s=n),i[r])return i[r];var a=t.getPointAtLength(o(r-n/2,e)),c=t.getPointAtLength(o(r+n/2,e)),u=Math.atan((c.y-a.y)/(c.x-a.x)),f=t.getPointAtLength(o(r,e)),d=(4*f.x+a.x+c.x)/6,h=(4*f.y+a.y+c.y)/6,p={x:d,y:h,theta:u};return i[r]=p,p},r.clearLocationCache=function(){l=null},r.getVisibleSegment=function(t,e,r){function n(e){var r=t.getPointAtLength(e);0===e?a=r:e===f&&(o=r);var n=r.xl?r.x-l:0,u=r.yc?r.y-c:0;return Math.sqrt(n*n+u*u)}for(var a,o,i=e.left,l=e.right,s=e.top,c=e.bottom,u=0,f=t.getTotalLength(),d=f,h=n(u);h;){if((u+=h+r)>d)return;h=n(u)}for(h=n(d);h;){if(d-=h+r,u>d)return;h=n(d)}return{min:u,max:d,len:d-u,total:f,isClosed:0===u&&d===f&&Math.abs(a.x-o.x)<.1&&Math.abs(a.y-o.y)<.1}}},{"./mod":159}],153:[function(t,e,r){"use strict";e.exports=function(t){return t}},{}],154:[function(t,e,r){"use strict";var n=t("d3"),a=t("fast-isnumeric"),o=t("../constants/numerical"),i=o.FP_SAFE,l=o.BADNUM,s=e.exports={};s.nestedProperty=t("./nested_property"),s.isPlainObject=t("./is_plain_object"),s.isArray=t("./is_array"),s.mod=t("./mod"),s.toLogRange=t("./to_log_range"),s.relinkPrivateKeys=t("./relink_private"),s.ensureArray=t("./ensure_array");var c=t("./coerce");s.valObjects=c.valObjects,s.coerce=c.coerce,s.coerce2=c.coerce2,s.coerceFont=c.coerceFont,s.coerceHoverinfo=c.coerceHoverinfo,s.validate=c.validate;var u=t("./dates");s.dateTime2ms=u.dateTime2ms,s.isDateTime=u.isDateTime,s.ms2DateTime=u.ms2DateTime,s.ms2DateTimeLocal=u.ms2DateTimeLocal,s.cleanDate=u.cleanDate,s.isJSDate=u.isJSDate,s.formatDate=u.formatDate,s.incrementMonth=u.incrementMonth,s.dateTick0=u.dateTick0,s.dfltRange=u.dfltRange,s.findExactDates=u.findExactDates,s.MIN_MS=u.MIN_MS,s.MAX_MS=u.MAX_MS;var f=t("./search");s.findBin=f.findBin,s.sorterAsc=f.sorterAsc,s.sorterDes=f.sorterDes,s.distinctVals=f.distinctVals,s.roundUp=f.roundUp;var d=t("./stats");s.aggNums=d.aggNums,s.len=d.len,s.mean=d.mean,s.variance=d.variance,s.stdev=d.stdev,s.interp=d.interp;var h=t("./matrix");s.init2dArray=h.init2dArray,s.transposeRagged=h.transposeRagged,s.dot=h.dot,s.translationMatrix=h.translationMatrix,s.rotationMatrix=h.rotationMatrix,s.rotationXYMatrix=h.rotationXYMatrix,s.apply2DTransform=h.apply2DTransform,s.apply2DTransform2=h.apply2DTransform2;var p=t("./geometry2d");s.segmentsIntersect=p.segmentsIntersect,s.segmentDistance=p.segmentDistance,s.getTextLocation=p.getTextLocation,s.clearLocationCache=p.clearLocationCache,s.getVisibleSegment=p.getVisibleSegment;var g=t("./extend");s.extendFlat=g.extendFlat,s.extendDeep=g.extendDeep,s.extendDeepAll=g.extendDeepAll,s.extendDeepNoArrays=g.extendDeepNoArrays;var m=t("./loggers");s.log=m.log,s.warn=m.warn,s.error=m.error,s.notifier=t("./notifier"),s.filterUnique=t("./filter_unique"),s.filterVisible=t("./filter_visible"),s.pushUnique=t("./push_unique"),s.cleanNumber=t("./clean_number"),s.ensureNumber=function(t){return a(t)?(t=Number(t),t<-i||t>i?l:a(t)?Number(t):l):l},s.noop=t("./noop"),s.identity=t("./identity"),s.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))},s.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},s.simpleMap=function(t,e,r,n){for(var a=t.length,o=new Array(a),i=0;i-1||u!==1/0&&u>=Math.pow(2,r)?t(e,r,n):s},s.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},s.smooth=function(t,e){if((e=Math.round(e)||0)<2)return t;var r,n,a,o,i=t.length,l=2*i,s=2*e-1,c=new Array(s),u=new Array(i);for(r=0;r=l&&(a-=l*Math.floor(a/l)),a<0?a=-1-a:a>=i&&(a=l-1-a),o+=t[a]*c[n];u[r]=o}return u},s.syncOrAsync=function(t,e,r){function n(){return s.syncOrAsync(t,e,r)}for(var a,o;t.length;)if(o=t.splice(0,1)[0],(a=o(e))&&a.then)return a.then(n).then(void 0,s.promiseError);return r&&r(e)},s.stripTrailingSlash=function(t){return"/"===t.substr(-1)?t.substr(0,t.length-1):t},s.noneOrAll=function(t,e,r){if(t){var n,a,o=!1,i=!0;for(n=0;n1?a+i[1]:"";if(o&&(i.length>1||l.length>4||r))for(;n.test(l);)l=l.replace(n,"$1"+o+"$2");return l+s}},{"../constants/numerical":139,"./clean_number":144,"./coerce":145,"./dates":146,"./ensure_array":147,"./extend":149,"./filter_unique":150,"./filter_visible":151,"./geometry2d":152,"./identity":153,"./is_array":155,"./is_plain_object":156,"./loggers":157,"./matrix":158,"./mod":159,"./nested_property":160,"./noop":161,"./notifier":162,"./push_unique":165,"./relink_private":167,"./search":168,"./stats":170,"./to_log_range":172,d3:14,"fast-isnumeric":17}],155:[function(t,e,r){"use strict";var n="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer:{isView:function(){return!1}};e.exports=function(t){return Array.isArray(t)||n.isView(t)}},{}],156:[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}},{}],157:[function(t,e,r){"use strict";function n(t,e){if(t.apply)t.apply(t,e);else for(var r=0;r1){for(var t=["LOG:"],e=0;e0){for(var t=["WARN:"],e=0;e0){for(var t=["ERROR:"],e=0;e=0;e--){if(n=t[e][0],o=t[e][1],s=!1,h(n))for(r=n.length-1;r>=0;r--)a(n[r],i(o,r))?s?n[r]=void 0:n.pop():s=!0;else if("object"==typeof n&&null!==n)for(l=Object.keys(n),s=!1,r=l.length-1;r>=0;r--)a(n[l[r]],i(o,l[r]))?delete n[l[r]]:s=!0;if(s)return}}function u(t){return void 0===t||null===t||"object"==typeof t&&(h(t)?!t.length:!Object.keys(t).length)}function f(t,e,r){return{set:function(){throw"bad container"},get:function(){},astr:e,parts:r,obj:t}}var d=t("fast-isnumeric"),h=t("./is_array"),p=t("./is_plain_object"),g=t("../plot_api/container_array_match");e.exports=function(t,e){if(d(e))e=String(e);else if("string"!=typeof e||"[-1]"===e.substr(e.length-4))throw"bad property string";for(var r,a,i,l=0,s=e.split(".");l/g),l=0;li||n===a||ns)&&(!e||!u(t))}function r(t,e){var r=t[0],c=t[1];if(r===a||ri||c===a||cs)return!1;var u,f,d,h,p,g=n.length,m=n[0][0],v=n[0][1],y=0;for(u=1;uMath.max(f,m)||c>Math.max(d,v)))if(cu||Math.abs(n(i,d))>a)return!0;return!1};o.filter=function(t,e){function r(r){t.push(r);var l=n.length,s=a;n.splice(o+1);for(var c=s+1;c1){r(t.pop())}return{addPt:r,raw:t,filtered:n}}},{"../constants/numerical":139,"./matrix":158}],165:[function(t,e,r){"use strict";e.exports=function(t,e){if(e instanceof RegExp){var r,n=e.toString();for(r=0;ro.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,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;re}function i(t,e){return t>=e}var l=t("fast-isnumeric"),s=t("./loggers");r.findBin=function(t,e,r){if(l(e.start))return r?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]?r?n:a:r?i:o;f90&&s.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,a=e[n]-e[0]||1,o=a/(n||1)/1e4,i=[e[0]],l=0;le[l]+o&&(a=Math.min(a,e[l+1]-e[l]),i.push(e[l+1]));return{vals:i,minDiff:a}},r.roundUp=function(t,e,r){for(var n,a=0,o=e.length-1,i=0,l=r?0:1,s=r?1:0,c=r?Math.ceil:Math.floor;at.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":17}],171:[function(t,e,r){"use strict";function n(t,e){return t.node().getBoundingClientRect()[e]}function a(t){return t.replace(v,"\\lt ").replace(y,"\\gt ")}function o(t,e,r){var n="math-output-"+d.randstr([],64),o=f.select("body").append("div").attr({id:n}).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),r();else{var n=o.select("svg").node().getBoundingClientRect();r(o.select(".MathJax_SVG"),e,n)}o.remove()})}function i(t,e){if(!t)return null;var r=t.match(e);return r&&(r[3]||r[4])}function l(t,e){if(!t)return"";for(var r=0;r1)for(var a=1;a doesnt match end tag <"+t+">. Pretending it did match.",e),o=c[c.length-1].node}(M);else{var N=y[4],I={type:M},R=i(N,S);if(R?(R=R.replace(E,"$1 fill:"),A&&(R+=";"+A)):A&&(R=A),R&&(I.style=R),"a"===M){l=!0;var F=i(N,O);if(F){var j=document.createElement("a");j.href=F,-1!==k.indexOf(j.protocol)&&(I.href=encodeURI(F),I.target=i(N,D)||"_blank",I.popup=i(N,P))}}n(I)}}return l}function u(t,e,r){var n,a,o,i=r.horizontalAlign,l=r.verticalAlign||"top",s=t.node().getBoundingClientRect(),c=e.node().getBoundingClientRect();return a="bottom"===l?function(){return s.bottom-n.height}:"middle"===l?function(){return s.top+(s.height-n.height)/2}:function(){return s.top},o="right"===i?function(){return s.right-n.width}:"center"===i?function(){return s.left+(s.width-n.width)/2}:function(){return s.left},function(){return n=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"),g=t("../constants/alignment").LINE_SPACING,m=/([^$]*)([$]+[^$]*[$]+)([^$]*)/;r.convertToTspans=function(t,e,a){function i(){u.empty()||(d=t.attr("class")+"-math",u.select("svg."+d).remove()),t.text("").style("white-space","pre"),c(t.node(),l)&&t.style("pointer-events","all"),r.positionText(t),a&&a.call(t)}var l=t.text(),s=!t.attr("data-notex")&&"undefined"!=typeof MathJax&&l.match(m),u=f.select(t.node().parentNode);if(!u.empty()){var d=t.attr("class")?t.attr("class").split(" ")[0]:"text";return d+="-math",u.selectAll("svg."+d).remove(),u.selectAll("g."+d+"-group").remove(),t.style("display",null).attr({"data-unformatted":l,"data-math":"N"}),s?(e&&e._promises||[]).push(new Promise(function(e){t.style("display","none");var r={fontSize:parseInt(t.style("font-size"),10)};o(s[2],r,function(r,o,s){u.selectAll("svg."+d).remove(),u.selectAll("g."+d+"-group").remove();var c=r&&r.select("svg");if(!c||!c.node())return i(),void e();var f=u.append("g").classed(d+"-group",!0).attr({"pointer-events":"none","data-unformatted":l,"data-math":"Y"});f.node().appendChild(c.node()),o&&o.node()&&c.node().insertBefore(o.node().cloneNode(!0),c.node().firstChild),c.attr({class:d,height:s.height,preserveAspectRatio:"xMinYMin meet"}).style({overflow:"visible","pointer-events":"none"});var h=t.style("fill")||"black";c.select("g").attr({fill:h,stroke:h});var p=n(c,"width"),g=n(c,"height"),m=+t.attr("x")-p*{start:0,middle:.5,end:1}[t.attr("text-anchor")||"start"],v=parseInt(t.style("font-size"),10)||n(t,"height"),y=-v/4;"y"===d[0]?(f.attr({transform:"rotate("+[-90,+t.attr("x"),+t.attr("y")]+") translate("+[-p/2,y-g/2]+")"}),c.attr({x:+t.attr("x"),y:+t.attr("y")})):"l"===d[0]?c.attr({x:t.attr("x"),y:y-g/2}):"a"===d[0]?c.attr({x:0,y:y}):c.attr({x:m,y:+t.attr("y")+y-g/2}),a&&a.call(t,f),e(f)})})):i(),t}};var v=/(<|<|<)/g,y=/(>|>|>)/g,x={sup:"font-size:70%",sub:"font-size:70%",b:"font-weight:bold",i:"font-style:italic",a:"cursor:pointer",span:"",em:"font-style:italic;font-weight:bold"},b={sub:"0.3em",sup:"-0.6em"},_={sub:"-0.21em",sup:"0.42em"},w="\u200b",k=["http:","https:","mailto:","",void 0,":"],M=new RegExp("]*)?/?>","g"),A=Object.keys(p.entityToUnicode).map(function(t){return{regExp:new RegExp("&"+t+";","g"),sub:p.entityToUnicode[t]}}),T=/(\r\n?|\n)/g,L=/(<[^<>]*>)/,C=/<(\/?)([^ >]*)(\s+(.*))?>/i,z=//i,S=/(^|[\s"'])style\s*=\s*("([^"]*);?"|'([^']*);?')/i,O=/(^|[\s"'])href\s*=\s*("([^"]*)"|'([^']*)')/i,D=/(^|[\s"'])target\s*=\s*("([^"\s]*)"|'([^'\s]*)')/i,P=/(^|[\s"'])popup\s*=\s*("([\w=,]*)"|'([\w=,]*)')/i,E=/(^|;)\s*color:/;r.plainText=function(t){return(t||"").replace(M," ")},r.lineCount=function(t){return t.selectAll("tspan.line").size()||1},r.positionText=function(t,e,r){return t.each(function(){function t(t,e){return void 0===e?null===(e=n.attr(t))&&(n.attr(t,0),e=0):n.attr(t,e),e}var n=f.select(this),a=t("x",e),o=t("y",r);"text"===this.nodeName&&n.selectAll("tspan.line").attr({x:a,y:o})})},r.makeEditable=function(t,e){function r(){a(),t.style({opacity:0});var e,r=s.attr("class");(e=r?"."+r.split(" ")[0]+"-math-group":"[class*=-math-group]")&&f.select(t.node().parentNode).select(e).style({opacity:0})}function n(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 r=f.select(o),a=r.select(".svg-container"),i=a.append("div");i.classed("plugin-editable editable",!0).style({position:"absolute","font-family":t.style("font-family")||"Arial","font-size":t.style("font-size")||12,color:e.fill||t.style("fill")||"black",opacity:1,"background-color":e.background||"transparent",outline:"#ffffff33 1px solid",margin:[-parseFloat(t.style("font-size"))/8+1,0,0,-1].join("px ")+"px",padding:"0","box-sizing":"border-box"}).attr({contenteditable:!0}).text(e.text||t.attr("data-unformatted")).call(u(t,a,e)).on("blur",function(){o._editing=!1,t.text(this.textContent).style({opacity:1});var e,r=f.select(this).attr("class");(e=r?"."+r.split(" ")[0]+"-math-group":"[class*=-math-group]")&&f.select(t.node().parentNode).select(e).style({opacity:0});var n=this.textContent;f.select(this).transition().duration(0).remove(),f.select(document).on("mouseup",null),l.edit.call(t,n)}).on("focus",function(){var t=this;o._editing=!0,f.select(document).on("mouseup",function(){if(f.event.target===t)return!1;document.activeElement===i.node()&&i.node().blur()})}).on("keyup",function(){27===f.event.which?(o._editing=!1,t.style({opacity:1}),f.select(this).style({opacity:0}).on("blur",function(){return!1}).transition().remove(),l.cancel.call(t,this.textContent)):(l.input.call(t,this.textContent),f.select(this).call(u(t,a,e)))}).on("keydown",function(){13===f.event.which&&this.blur()}).call(n)}var o=e.gd,i=e.delegate,l=f.dispatch("edit","input","cancel"),s=i||t;if(t.style({"pointer-events":i?"none":"all"}),1!==t.size())throw new Error("boo");return e.immediate?r():s.on("click",r),f.rebind(t,l,"on")}},{"../constants/alignment":137,"../constants/string_mappings":140,"../constants/xmlns_namespaces":141,"../lib":154,d3:14}],172:[function(t,e,r){"use strict";var n=t("fast-isnumeric");e.exports=function(t,e){if(t>0)return Math.log(t)/Math.LN10;var r=Math.log(Math.min(e[0],e[1]))/Math.LN10;return n(r)||(r=Math.log(Math.max(e[0],e[1]))/Math.LN10-6),r}},{"fast-isnumeric":17}],173:[function(t,e,r){"use strict";var n=t("../registry");e.exports=function(t){for(var e,r,a=n.layoutArrayContainers,o=n.layoutArrayRegexes,i=t.split("[")[0],l=0;l0)return t.substr(0,e)}var l=t("fast-isnumeric"),s=t("gl-mat4/fromQuat"),c=t("../registry"),u=t("../lib"),f=t("../plots/plots"),d=t("../plots/cartesian/axes"),h=t("../components/color");r.getGraphDiv=function(t){var e;if("string"==typeof t){if(null===(e=document.getElementById(t)))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},r.clearPromiseQueue=function(t){Array.isArray(t._promises)&&t._promises.length>0&&u.log("Clearing previous rejected promises from queue."),t._promises=[]},r.cleanLayout=function(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 a=d.list({_fullLayout:t});for(e=0;e3?(m.x=1.02,m.xanchor="left"):m.x<-2&&(m.x=-.02,m.xanchor="right"),m.y>3?(m.y=1.02,m.yanchor="bottom"):m.y<-2&&(m.y=-.02,m.yanchor="top")),"rotate"===t.dragmode&&(t.dragmode="orbit"),t.scene1&&(t.scene||(t.scene=t.scene1),delete t.scene1);var v=f.getSubplotIds(t,"gl3d");for(e=0;e1&&i.warn("Full array edits are incompatible with other edits",f);var y=r[""][""];if(u(y))e.set(null);else{if(!Array.isArray(y))return i.warn("Unrecognized full array edit value",f,y),!0;e.set(y)}return!g&&(d(m,v),h(t),!0)}var x,b,_,w,k,M,A,T=Object.keys(r).map(Number).sort(l),L=e.get(),C=L||[],z=n(v,f).get(),S=[],O=-1,D=C.length;for(x=0;xC.length-(A?0:1))i.warn("index out of range",f,_);else if(void 0!==M)k.length>1&&i.warn("Insertion & removal are incompatible with edits to the same index.",f,_),u(M)?S.push(_):A?("add"===M&&(M={}),C.splice(_,0,M),z&&z.splice(_,0,{})):i.warn("Unrecognized full object edit value",f,_,M),-1===O&&(O=_);else for(b=0;b=0;x--)C.splice(S[x],1),z&&z.splice(S[x],1);if(C.length?L||e.set(C):e.set(null),g)return!1;if(d(m,v),p!==o){var P;if(-1===O)P=T;else{for(D=Math.max(C.length,D),P=[],x=0;x=O);x++)P.push(_);for(x=O;x=t.data.length||a<-t.data.length)throw new Error(r+" must be valid indices for gd.data.");if(e.indexOf(a,n+1)>-1||a>=0&&e.indexOf(-t.data.length+a)>-1||a<0&&e.indexOf(t.data.length+a)>-1)throw new Error("each index in "+r+" must be unique.")}}function s(t,e,r){if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if(void 0===e)throw new Error("currentIndices is a required argument.");if(Array.isArray(e)||(e=[e]),l(t,e,"currentIndices"),void 0===r||Array.isArray(r)||(r=[r]),void 0!==r&&l(t,r,"newIndices"),void 0!==r&&e.length!==r.length)throw new Error("current and new indices must be of equal length.")}function c(t,e,r){var n,a;if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if(void 0===e)throw new Error("traces must be defined.");for(Array.isArray(e)||(e=[e]),n=0;n=0&&sV.range[0]?[1,2]:[2,1]);else{var Z=V.range[0],X=V.range[1];U?(Z<=0&&X<=0&&r(R+".autorange",!0),Z<=0?Z=X/1e6:X<=0&&(X=Z/1e6), r(R+".range[0]",Math.log(Z)/Math.LN10),r(R+".range[1]",Math.log(X)/Math.LN10)):(r(R+".range[0]",Math.pow(10,Z)),r(R+".range[1]",Math.pow(10,X)))}else r(R+".autorange",!0);k.getComponentMethod("annotations","convertCoords")(t,B,L,r),k.getComponentMethod("images","convertCoords")(t,B,L,r)}else r(R+".autorange",!0);b.nestedProperty(c,R+"._inputRange").set(null)}else if(P.match(N.AX_NAME_PATTERN)){var Y=b.nestedProperty(c,A).get(),W=(L||{}).type;W&&"-"!==W||(W="linear"),k.getComponentMethod("annotations","convertCoords")(t,Y,W,r),k.getComponentMethod("images","convertCoords")(t,Y,W,r)}var $=O.containerArrayMatch(A);if($){o=$.array,i=$.index;var Q=$.property,J=b.nestedProperty(s,o),K=(J||[])[i]||{};if(""===i)-1===A.indexOf("updatemenus")&&(v.docalc=!0);else if(""===Q){var tt=L;O.isAddVal(L)?_[A]=null:O.isRemoveVal(L)?(_[A]=K,tt=K):b.warn("unrecognized full object value",e),(n(tt,"x")||n(tt,"y")&&-1===A.indexOf("updatemenus"))&&(v.docalc=!0)}else!n(K,"x")&&!n(K,"y")||b.containsAny(A,["color","opacity","align","dash","updatemenus"])||(v.docalc=!0);d[o]||(d[o]={});var et=d[o][i];et||(et=d[o][i]={}),et[Q]=L,delete e[A]}else if("reverse"===P)F.range?F.range.reverse():(r(R+".autorange",!0),F.range=[1,0]),B.autorange?v.docalc=!0:v.doplot=!0;else{var rt=String(T.parts[1]||"");0===S.indexOf("scene")?"camera"===T.parts[1]?v.docamera=!0:v.doplot=!0:0===S.indexOf("geo")?v.doplot=!0:0===S.indexOf("ternary")?v.doplot=!0:"paper_bgcolor"===A?v.doplot=!0:"margin"===S||"autorange"===rt||"rangemode"===rt||"type"===rt||"domain"===rt||"fixedrange"===rt||"scaleanchor"===rt||"scaleratio"===rt||-1!==A.indexOf("calendar")||A.match(/^(bar|box|font)/)?v.docalc=!0:!c._has("gl2d")||-1===A.indexOf("axis")&&"plot_bgcolor"!==A?!c._has("gl2d")||"dragmode"!==A||"lasso"!==L&&"select"!==L||"lasso"===H||"select"===H?"hiddenlabels"===A?v.docalc=!0:-1!==S.indexOf("legend")?v.dolegend=!0:-1!==A.indexOf("title")?v.doticks=!0:-1!==S.indexOf("bgcolor")?v.dolayoutstyle=!0:C>1&&b.containsAny(rt,["tick","exponent","grid","zeroline"])?v.doticks=!0:-1!==A.indexOf(".linewidth")&&-1!==A.indexOf("axis")?v.doticks=v.dolayoutstyle=!0:C>1&&-1!==rt.indexOf("line")?v.dolayoutstyle=!0:C>1&&"mirror"===rt?v.doticks=v.dolayoutstyle=!0:"margin.pad"===A?v.doticks=v.dolayoutstyle=!0:-1!==["hovermode","dragmode"].indexOf(A)||-1!==A.indexOf("spike")?v.domodebar=!0:-1===["height","width","autosize"].indexOf(A)&&(v.doplot=!0):v.docalc=!0:v.doplot=!0,T.set(L)}}}for(o in d){O.applyContainerArrayChanges(t,b.nestedProperty(s,o),d[o],v)||(v.doplot=!0)}var nt=c._axisConstraintGroups;for(m in w)for(i=0;i=l.length?l[0]:l[t]:l}function a(t){return Array.isArray(s)?t>=s.length?s[0]:s[t]:s}function o(t,e){var r=0;return function(){if(t&&++r===e)return t()}}if(t=D.getGraphDiv(t),!b.isPlotDiv(t))throw new Error("This element is not a Plotly plot: "+t+". It's likely that you've failed to create a plot before animating it. For more details, see https://plot.ly/javascript/animations/");var i=t._transitionData;i._frameQueue||(i._frameQueue=[]),r=M.supplyAnimationDefaults(r);var l=r.transition,s=r.frame;return void 0===i._frameWaitingCnt&&(i._frameWaitingCnt=0),new Promise(function(s,c){function u(){t.emit("plotly_animated"),window.cancelAnimationFrame(i._animationRaf),i._animationRaf=null}function f(){i._currentFrame&&i._currentFrame.onComplete&&i._currentFrame.onComplete();var e=i._currentFrame=i._frameQueue.shift();if(e){var r=e.name?e.name.toString():null;t._fullLayout._currentFrame=r,i._lastFrameAt=Date.now(),i._timeToNext=e.frameOpts.duration,M.transition(t,e.frame.data,e.frame.layout,D.coerceTraceIndices(t,e.frame.traces),e.frameOpts,e.transitionOpts).then(function(){e.onComplete&&e.onComplete()}),t.emit("plotly_animatingframe",{name:r,frame:e.frame,animation:{frame:e.frameOpts,transition:e.transitionOpts}})}else u()}function d(){t.emit("plotly_animating"),i._lastFrameAt=-1/0,i._timeToNext=0,i._runningTransitions=0,i._currentFrame=null;var e=function(){i._animationRaf=window.requestAnimationFrame(e),Date.now()-i._lastFrameAt>i._timeToNext&&f()};e()}function h(t){return Array.isArray(l)?m>=l.length?t.transitionOpts=l[m]:t.transitionOpts=l[0]:t.transitionOpts=l,m++,t}var p,g,m=0,v=[],y=void 0===e||null===e,x=Array.isArray(e);if(y||x||!b.isPlainObject(e)){if(y||-1!==["string","number"].indexOf(typeof e))for(p=0;p0&&kk)&&A.push(g);v=A}}v.length>0?function(e){if(0!==e.length){for(var l=0;l=0;a--)if(b.isPlainObject(e[a])){var d=(c[e[a].name]||{}).name,h=e[a].name;d&&h&&"number"==typeof h&&c[d]&&(n++,b.warn('addFrames: overwriting frame "'+c[d].name+'" with a frame whose name of type "number" also equates to "'+d+'". This is valid but may potentially lead to unexpected behavior since all plotly.js frame names are stored internally as strings.'),n>5&&b.warn("addFrames: This API call has yielded too many warnings. For the rest of this call, further warnings about numeric frame names will be suppressed.")),f.push({frame:M.supplyFrameDefaults(e[a]),index:r&&void 0!==r[a]&&null!==r[a]?r[a]:u+a})}f.sort(function(t,e){return t.index>e.index?-1:t.index=0;a--){if(o=f[a].frame,"number"==typeof o.name&&b.warn("Warning: addFrames accepts frames with numeric names, but the numbers areimplicitly cast to strings"),!o.name)for(;c[o.name="frame "+t._transitionData._counter++];);if(c[o.name]){for(i=0;i=0;r--)n=e[r],o.push({type:"delete",index:n}),i.unshift({type:"insert",index:n,value:a[n]});var l=M.modifyFrames,s=M.modifyFrames,c=[t,i],u=[t,o];return w&&w.add(t,l,c,s,u),M.modifyFrames(t,o)},x.purge=function(t){t=D.getGraphDiv(t);var e=t._fullLayout||{},r=t._fullData||[];return M.cleanPlot([],{},r,e),M.purge(t),_.purge(t),e._container&&e._container.remove(),delete t._context,delete t._replotPending,delete t._mouseDownTime,delete t._legendMouseDownTime,delete t._hmpixcount,delete t._hmlumcount,t}},{"../components/drawing":65,"../components/errorbars":71,"../constants/xmlns_namespaces":141,"../lib":154,"../lib/events":148,"../lib/queue":166,"../lib/svg_text_utils":171,"../plotly":185,"../plots/cartesian/axis_ids":193,"../plots/cartesian/constants":195,"../plots/cartesian/constraints":197,"../plots/cartesian/graph_interact":199,"../plots/plots":219,"../plots/polar":222,"../registry":234,"./edit_types":174,"./helpers":175,"./manage_arrays":176,"./subroutines":182,d3:14,"fast-isnumeric":17,"has-hover":19}],178:[function(t,e,r){"use strict";function n(t,r){try{t._fullLayout._paper.style("background",r)}catch(t){e.exports.logging>0&&console.error(t)}}e.exports={staticPlot:!1,editable:!1,edits:{annotationPosition:!1,annotationTail:!1,annotationText:!1,axisTitleText:!1,colorbarPosition:!1,colorbarTitleText:!1,legendPosition:!1,legendText:!1,shapePosition:!1,titleText:!1},autosizable:!1,queueLength:0,fillFrame:!1,frameMargins:0,scrollZoom:!1,doubleClick:"reset+autosize",showTips:!0,showAxisDragHandles:!0,showAxisRangeEntryBoxes:!0,showLink:!1,sendData:!0,linkText:"Edit chart",showSources:!1,displayModeBar:"hover",modeBarButtonsToRemove:[],modeBarButtonsToAdd:[],modeBarButtons:!1,displaylogo:!0,plotGlPixelRatio:2,setBackground:n,topojsonURL:"https://cdn.plot.ly/",mapboxAccessToken:null,logging:!1,globalTransforms:[]}},{}],179:[function(t,e,r){"use strict";function n(t){var e,r;"area"===t?(e={attributes:x},r={}):(e=h.modules[t]._module,r=e.basePlotModule);var n={};n.type=null,k(n,g),k(n,e.attributes),r.attributes&&k(n,r.attributes),Object.keys(h.componentsRegistry).forEach(function(e){var r=h.componentsRegistry[e];r.schema&&r.schema.traces&&r.schema.traces[t]&&Object.keys(r.schema.traces[t]).forEach(function(e){d(n,r.schema.traces[t][e],e)})}),n.type=t;var a={meta:e.meta||{},attributes:l(n)};if(e.layoutAttributes){var o={};k(o,e.layoutAttributes),a.layoutAttributes=l(o)}return a}function a(){var t={};return k(t,m),Object.keys(h.subplotsRegistry).forEach(function(e){var r=h.subplotsRegistry[e];if(r.layoutAttributes)if("cartesian"===r.name)f(t,r,"xaxis"),f(t,r,"yaxis");else{var n="subplot"===r.attr?r.name:r.attr;f(t,r,n)}}),t=u(t),Object.keys(h.componentsRegistry).forEach(function(e){var r=h.componentsRegistry[e];r.layoutAttributes&&(r.schema&&r.schema.layout?Object.keys(r.schema.layout).forEach(function(e){d(t,r.schema.layout[e],e)}):d(t,r.layoutAttributes,r.name))}),{layoutAttributes:l(t)}}function o(t){var e=h.transformsRegistry[t],r=k({},e.attributes);return Object.keys(h.componentsRegistry).forEach(function(e){var n=h.componentsRegistry[e];n.schema&&n.schema.transforms&&n.schema.transforms[t]&&Object.keys(n.schema.transforms[t]).forEach(function(e){d(r,n.schema.transforms[t][e],e)})}),{attributes:l(r)}}function i(){var t={frames:p.extendDeep({},v)};return l(t),t.frames}function l(t){return s(t),c(t),t}function s(t){function e(t){return{valType:"string"}}function n(t,n,a){r.isValObject(t)?"data_array"===t.valType?(t.role="data",a[n+"src"]=e(n)):!0===t.arrayOk&&(a[n+"src"]=e(n)):p.isPlainObject(t)&&(t.role="object")}r.crawl(t,n)}function c(t){function e(t,e,r){if(t){var n=t[A];n&&(delete t[A],r[e]={items:{}},r[e].items[n]=t,r[e].role="object")}}r.crawl(t,e)}function u(t){return w(t,{radialaxis:b.radialaxis,angularaxis:b.angularaxis}),w(t,b.layout),t}function f(t,e,r){var n=p.nestedProperty(t,r),a=k({},e.layoutAttributes);a[M]=!0,n.set(a)}function d(t,e,r){var n=p.nestedProperty(t,r);n.set(k(n.get()||{},e))}var h=t("../registry"),p=t("../lib"),g=t("../plots/attributes"),m=t("../plots/layout_attributes"),v=t("../plots/frame_attributes"),y=t("../plots/animation_attributes"),x=t("../plots/polar/area_attributes"),b=t("../plots/polar/axis_attributes"),_=t("./edit_types"),w=p.extendFlat,k=p.extendDeep,M="_isSubplotObj",A="_isLinkedToArray",T=[M,A,"_arrayAttrRegexps","_deprecated"];r.IS_SUBPLOT_OBJ=M,r.IS_LINKED_TO_ARRAY=A,r.DEPRECATED="_deprecated",r.UNDERSCORE_ATTRS=T,r.get=function(){var t={};h.allTypes.concat("area").forEach(function(e){t[e]=n(e)});var e={};return Object.keys(h.transformsRegistry).forEach(function(t){e[t]=o(t)}),{defs:{valObjects:p.valObjects,metaKeys:T.concat(["description","role"]),editTypes:{traces:_.traces(),layout:_.layout()}},traces:t,layout:a(),transforms:e,frames:i(),animation:l(y)}},r.crawl=function(t,e,n){var a=n||0;Object.keys(t).forEach(function(n){var o=t[n];-1===T.indexOf(n)&&(e(o,n,t,a),r.isValObject(o)||p.isPlainObject(o)&&r.crawl(o,e,a+1))})},r.isValObject=function(t){return t&&void 0!==t.valType},r.findArrayAttributes=function(t){function e(e,r,i,l){if(o=o.slice(0,l).concat([r]),e&&("data_array"===e.valType||!0===e.arrayOk)&&!("colorbar"===o[l-1]&&("ticktext"===r||"tickvals"===r))){var s=n(o),c=p.nestedProperty(t,s).get();Array.isArray(c)&&a.push(s)}}function n(t){return t.join(".")}var a=[],o=[];if(r.crawl(g,e),t._module&&t._module.attributes&&r.crawl(t._module.attributes,e),t.transforms)for(var i=t.transforms,l=0;l=t[1]||a[1]<=t[0])&&(o[0]e[0]))return!0}return!1}function a(t,e,r){return t._anchorAxis===e&&(t.mirror||t.side===r)||"all"===t.mirror||"allticks"===t.mirror||t.mirrors&&t.mirrors[e._id+r]}function o(t,e,r){var n=[],a=e._anchorAxis;if(a){var o=a._mainAxis;if(-1===n.indexOf(o)){n.push(o);for(var i=0;i0;t.each(function(t){var d,h=t[0].trace,p=h.error_x||{},g=h.error_y||{};h.ids&&(d=function(t){return t.id});var v=l.hasMarkers(h)&&h.marker.maxdisplayed>0;if(g.visible||p.visible){var m=a.select(this).selectAll("g.errorbar").data(t,d);m.exit().remove(),m.style("opacity",1);var y=m.enter().append("g").classed("errorbar",!0);f&&y.style("opacity",0).transition().duration(n.duration).style("opacity",1),i.setClipUrl(m,e.layerClipId),m.each(function(t){var e=a.select(this),i=r(t,c,u);if(!v||t.vis){var l;if(g.visible&&o(i.x)&&o(i.yh)&&o(i.ys)){var d=g.width;l="M"+(i.x-d)+","+i.yh+"h"+2*d+"m-"+d+",0V"+i.ys,i.noYS||(l+="m-"+d+",0h"+2*d);var h=e.select("path.yerror");s=!h.size(),s?h=e.append("path").style("vector-effect","non-scaling-stroke").classed("yerror",!0):f&&(h=h.transition().duration(n.duration).ease(n.easing)),h.attr("d",l)}if(p.visible&&o(i.y)&&o(i.xh)&&o(i.xs)){var m=(p.copy_ystyle?g:p).width;l="M"+i.xh+","+(i.y-m)+"v"+2*m+"m0,-"+m+"H"+i.xs,i.noXS||(l+="m0,-"+m+"v"+2*m);var y=e.select("path.xerror");s=!y.size(),s?y=e.append("path").style("vector-effect","non-scaling-stroke").classed("xerror",!0):f&&(y=y.transition().duration(n.duration).ease(n.easing)),y.attr("d",l)}}})}})}},{"../../traces/scatter/subtypes":306,"../drawing":61,d3:10,"fast-isnumeric":13}],69:[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":37,d3:10}],70:[function(t,e,n){"use strict";var r=t("../../lib/extend").extendFlat,a=t("../../plots/font_attributes");e.exports={hoverlabel:{bgcolor:{valType:"color",arrayOk:!0},bordercolor:{valType:"color",arrayOk:!0},font:{family:r({},a.family,{arrayOk:!0}),size:r({},a.size,{arrayOk:!0}),color:r({},a.color,{arrayOk:!0})},namelength:{valType:"integer",min:-1,arrayOk:!0}}}},{"../../lib/extend":145,"../../plots/font_attributes":210}],71:[function(t,e,n){"use strict";function r(t,e,n,r){r=r||a.identity,Array.isArray(t)&&(e[0][n]=r(t))}var a=t("../../lib"),o=t("../../registry");e.exports=function(t){for(var e=t.calcdata,n=t._fullLayout,i=0;i=0&&n.indexJ.width||$<0||$>J.height)return x.unhoverRaw(t,e)}if(E="xval"in e?w.flat(d,e.xval):w.p2c(L,W),N="yval"in e?w.flat(d,e.yval):w.p2c(C,$),!f(E[0])||!f(N[0]))return h.warn("Fx.hover failed",e,t),x.unhoverRaw(t,e)}var K=1/0;for(R=0;RX&&(Y.splice(0,X),K=Y[0].distance)}if(0===Y.length)return x.unhoverRaw(t,e);Y.sort(function(t,e){return t.distance-e.distance});var at=t._hoverdata,ot=[];for(I=0;I1,ct=y.combine(g.plot_bgcolor||y.background,g.paper_bgcolor),ut={hovermode:P,rotateLabels:st,bgColor:ct,container:g._hoverlayer,outerContainer:g._paperdiv,commonLabelOpts:g.hoverlabel},ft=a(Y,ut,t);if(o(Y,st?"xa":"ya"),i(ft,st),e.target&&e.target.tagName){var dt=_.getComponentMethod("annotations","hasClickToShow")(t,ot);v(u.select(e.target),dt?"pointer":"")}e.target&&!r&&c(t,e,at)&&(at&&t.emit("plotly_unhover",{event:e,points:at}),t.emit("plotly_hover",{event:e,points:t._hoverdata,xaxes:L,yaxes:C,xvals:E,yvals:N}))}function a(t,e,n){var r,a,o=e.hovermode,i=e.rotateLabels,l=e.bgColor,s=e.container,c=e.outerContainer,f=e.commonLabelOpts||{},d=e.fontFamily||k.HOVERFONT,h=e.fontSize||k.HOVERFONTSIZE,p=t[0],v=p.xa,x=p.ya,b="y"===o?"yLabel":"xLabel",_=p[b],w=(String(_)||"").split(" ")[0],A=c.node().getBoundingClientRect(),T=A.top,L=A.width,C=A.height,z=p.distance<=k.MAXDIST&&("x"===o||"y"===o);for(r=0;r-1&&r.length>p&&(r=p>3?r.substr(0,p-3)+"...":r.substr(0,p))}void 0!==t.extraText&&(a+=t.extraText),void 0!==t.zLabel?(void 0!==t.xLabel&&(a+="x: "+t.xLabel+"
"),void 0!==t.yLabel&&(a+="y: "+t.yLabel+"
"),a+=(a?"z: ":"")+t.zLabel):z&&t[o+"Label"]===_?a=t[("x"===o?"y":"x")+"Label"]||"":void 0===t.xLabel?void 0!==t.yLabel&&(a=t.yLabel):a=void 0===t.yLabel?t.xLabel:"("+t.xLabel+", "+t.yLabel+")",t.text&&!Array.isArray(t.text)&&(a+=(a?"
":"")+t.text),""===a&&(""===r&&e.remove(),a=r);var v=e.select("text.nums").call(m.font,t.fontFamily||d,t.fontSize||h,t.fontColor||f).text(a).attr("data-notex",1).call(g.positionText,0,0).call(g.convertToTspans,n),x=e.select("text.name"),b=0;r&&r!==a?(x.call(m.font,t.fontFamily||d,t.fontSize||h,c).text(r).attr("data-notex",1).call(g.positionText,0,0).call(g.convertToTspans,n),b=x.node().getBoundingClientRect().width+2*O):(x.remove(),e.select("rect").remove()),e.select("path").style({fill:c,stroke:f});var w,k,A=v.node().getBoundingClientRect(),D=t.xa._offset+(t.x0+t.x1)/2,P=t.ya._offset+(t.y0+t.y1)/2,E=Math.abs(t.x1-t.x0),N=Math.abs(t.y1-t.y0),I=A.width+S+O+b;t.ty0=T-A.top,t.bx=A.width+2*O,t.by=A.height+2*O,t.anchor="start",t.txwidth=A.width,t.tx2width=b,t.offset=0,i?(t.pos=D,w=P+N/2+I<=C,k=P-N/2-I>=0,"top"!==t.idealAlign&&w||!k?w?(P+=N/2,t.anchor="start"):t.anchor="middle":(P-=N/2,t.anchor="end")):(t.pos=P,w=D+E/2+I<=L,k=D-E/2-I>=0,"left"!==t.idealAlign&&w||!k?w?(D+=E/2,t.anchor="start"):t.anchor="middle":(D-=E/2,t.anchor="end")),v.attr("text-anchor",t.anchor),b&&x.attr("text-anchor",t.anchor),e.attr("transform","translate("+D+","+P+")"+(i?"rotate("+M+")":""))}),E}function o(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(!(o<.01)){if(a<-.01){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&&!(c<=0);i--)s=t[i],s.pos>e.pmax-1&&(s.del=!0,c--);for(i=0;i=0;l--)t[l].dp-=o;for(i=t.length-1;i>=0&&!(c<=0);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)?T: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 i(t,e){t.each(function(t){var n=u.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*(S+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*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*S+s)+","+(S+c)+"v"+(t.by/2-S)+"h"+r*t.bx+"v-"+t.by+"H"+(r*S+s)+"V"+(c-S)+"Z"),a.call(g.positionText,i+s,c+t.ty0-t.by/2+O),t.tx2width&&(n.select("text.name").call(g.positionText,l+o*O+s,c+t.ty0-t.by/2+O),n.select("rect").call(m.setRect,l+(o-1)*t.tx2width/2+s,c-t.by/2-1,t.tx2width,t.by+2))})}function l(t,e){function n(e,n,i){var l;if(o[n])l=o[n];else if(a[n]){var s=a[n];Array.isArray(s)&&Array.isArray(s[t.index[0]])&&(l=s[t.index[0]][t.index[1]])}else l=h.nestedProperty(r,i).get();l&&(t[e]=l)}var r=t.trace||{},a=t.cd[0],o=t.cd[t.index]||{};n("hoverinfo","hi","hoverinfo"),n("color","hbg","hoverlabel.bgcolor"),n("borderColor","hbc","hoverlabel.bordercolor"),n("fontFamily","htf","hoverlabel.font.family"),n("fontSize","hts","hoverlabel.font.size"),n("fontColor","htc","hoverlabel.font.color"),n("nameLength","hnl","hoverlabel.namelength"),t.posref="y"===e?(t.x0+t.x1)/2:(t.y0+t.y1)/2,t.x0=h.constrain(t.x0,0,t.xa._length),t.x1=h.constrain(t.x1,0,t.xa._length),t.y0=h.constrain(t.y0,0,t.ya._length),t.y1=h.constrain(t.y1,0,t.ya._length);var i;if(void 0!==t.xLabelVal){i="log"===t.xa.type&&t.xLabelVal<=0;var l=b.tickText(t.xa,t.xa.c2l(i?-t.xLabelVal:t.xLabelVal),"hover");i?0===t.xLabelVal?t.xLabel="0":t.xLabel="-"+l.text:t.xLabel=l.text,t.xVal=t.xa.c2d(t.xLabelVal)}if(void 0!==t.yLabelVal){i="log"===t.ya.type&&t.yLabelVal<=0;var s=b.tickText(t.ya,t.ya.c2l(i?-t.yLabelVal:t.yLabelVal),"hover");i?0===t.yLabelVal?t.yLabel="0":t.yLabel="-"+s.text:t.yLabel=s.text,t.yVal=t.ya.c2d(t.yLabelVal)}if(void 0!==t.zLabelVal&&(t.zLabel=String(t.zLabelVal)),!(isNaN(t.xerr)||"log"===t.xa.type&&t.xerr<=0)){var c=b.tickText(t.xa,t.xa.c2l(t.xerr),"hover").text;void 0!==t.xerrneg?t.xLabel+=" +"+c+" / -"+b.tickText(t.xa,t.xa.c2l(t.xerrneg),"hover").text:t.xLabel+=" \xb1 "+c,"x"===e&&(t.distance+=1)}if(!(isNaN(t.yerr)||"log"===t.ya.type&&t.yerr<=0)){var u=b.tickText(t.ya,t.ya.c2l(t.yerr),"hover").text;void 0!==t.yerrneg?t.yLabel+=" +"+u+" / -"+b.tickText(t.ya,t.ya.c2l(t.yerrneg),"hover").text:t.yLabel+=" \xb1 "+u,"y"===e&&(t.distance+=1)}var f=t.hoverinfo||t.trace.hoverinfo;return"all"!==f&&(f=f.split("+"),-1===f.indexOf("x")&&(t.xLabel=void 0),-1===f.indexOf("y")&&(t.yLabel=void 0),-1===f.indexOf("z")&&(t.zLabel=void 0),-1===f.indexOf("text")&&(t.text=void 0),-1===f.indexOf("name")&&(t.name=void 0)),t}function s(t,e){var n=e.hovermode,r=e.container,a=t[0],o=a.xa,i=a.ya,l=o.showspikes,s=i.showspikes;if(r.selectAll(".spikeline").remove(),"closest"===n&&(l||s)){var c=e.fullLayout,u=o._offset+(a.x0+a.x1)/2,f=i._offset+(a.y0+a.y1)/2,h=y.combine(c.plot_bgcolor,c.paper_bgcolor),p=d.readability(a.color,h)<1.5?y.contrast(h):a.color;if(s){var g=i.spikemode,v=i.spikethickness,x=i.spikecolor||p,b=i._boundingBox,_=(b.left+b.right)/2=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 u=t("d3"),f=t("fast-isnumeric"),d=t("tinycolor2"),h=t("../../lib"),p=t("../../lib/events"),g=t("../../lib/svg_text_utils"),v=t("../../lib/override_cursor"),m=t("../drawing"),y=t("../color"),x=t("../dragelement"),b=t("../../plots/cartesian/axes"),_=t("../../registry"),w=t("./helpers"),k=t("./constants"),M=k.YANGLE,A=Math.PI*M/180,T=1/Math.sin(A),L=Math.cos(A),C=Math.sin(A),S=k.HOVERARROWSIZE,O=k.HOVERTEXTPAD;n.hover=function(t,e,n,a){if("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)return r(t,e,n,a),void(t._lastHoverTime=Date.now());t._hoverTimer=setTimeout(function(){r(t,e,n,a),t._lastHoverTime=Date.now(),t._hoverTimer=void 0},k.HOVERMINTIME)},n.loneHover=function(t,e){var n={color:t.color||y.defaultLine,x0:t.x0||t.x||0,x1:t.x1||t.x||0,y0:t.y0||t.y||0,y1:t.y1||t.y||0,xLabel:t.xLabel,yLabel:t.yLabel,zLabel:t.zLabel,text:t.text,name:t.name,idealAlign:t.idealAlign,borderColor:t.borderColor,fontFamily:t.fontFamily,fontSize:t.fontSize,fontColor:t.fontColor,trace:{index:0,hoverinfo:""},xa:{_offset:0},ya:{_offset:0},index:0},r=u.select(e.container),o=e.outerContainer?u.select(e.outerContainer):r,l={hovermode:"closest",rotateLabels:!1,bgColor:e.bgColor||y.background,container:r,outerContainer:o},s=a([n],l,e.gd);return i(s,l.rotateLabels),s.node()}},{"../../lib":150,"../../lib/events":144,"../../lib/override_cursor":159,"../../lib/svg_text_utils":167,"../../plots/cartesian/axes":186,"../../registry":222,"../color":37,"../dragelement":58,"../drawing":61,"./constants":73,"./helpers":75,d3:10,"fast-isnumeric":13,tinycolor2:19}],77:[function(t,e,n){"use strict";var r=t("../../lib");e.exports=function(t,e,n,a){a=a||{},n("hoverlabel.bgcolor",a.bgcolor),n("hoverlabel.bordercolor",a.bordercolor),n("hoverlabel.namelength",a.namelength),r.coerceFont(n,"hoverlabel.font",a.font)}},{"../../lib":150}],78:[function(t,e,n){"use strict";function r(t){var e=l.isD3Selection(t)?t:i.select(t);e.selectAll("g.hovertext").remove(),e.selectAll(".spikeline").remove()}function a(t,e,n){return l.castOption(t,e,"hoverlabel."+n)}function o(t,e,n){function r(n){return l.coerceHoverinfo({hoverinfo:n},{_module:t._module},e)}return l.castOption(t,n,"hoverinfo",r)}var i=t("d3"),l=t("../../lib"),s=t("../dragelement"),c=t("./helpers"),u=t("./layout_attributes");e.exports={moduleType:"component",name:"fx",constants:t("./constants"),schema:{layout:u},attributes:t("./attributes"),layoutAttributes:u,supplyLayoutGlobalDefaults:t("./layout_global_defaults"),supplyDefaults:t("./defaults"),supplyLayoutDefaults:t("./layout_defaults"),calc:t("./calc"),getDistanceFunction:c.getDistanceFunction,getClosest:c.getClosest,inbox:c.inbox,appendArrayPointValue:c.appendArrayPointValue,castHoverOption:a,castHoverinfo:o,hover:t("./hover").hover,unhover:s.unhover,loneHover:t("./hover").loneHover,loneUnhover:r,click:t("./click")}},{"../../lib":150,"../dragelement":58,"./attributes":70,"./calc":71,"./click":72,"./constants":73,"./defaults":74,"./helpers":75,"./hover":76,"./layout_attributes":79,"./layout_defaults":80,"./layout_global_defaults":81,d3:10}],79:[function(t,e,n){"use strict";var r=t("../../lib/extend").extendFlat,a=t("../../plots/font_attributes"),o=t("./constants");e.exports={dragmode:{valType:"enumerated",values:["zoom","pan","select","lasso","orbit","turntable"],dflt:"zoom"},hovermode:{valType:"enumerated",values:["x","y","closest",!1]},hoverlabel:{bgcolor:{valType:"color"},bordercolor:{valType:"color"},font:{family:r({},a.family,{dflt:o.HOVERFONT}),size:r({},a.size,{dflt:o.HOVERFONTSIZE}),color:r({},a.color)},namelength:{valType:"integer",min:-1,dflt:15}}}},{"../../lib/extend":145,"../../plots/font_attributes":210,"./constants":73}],80:[function(t,e,n){"use strict";function r(t){for(var e=!0,n=0;n=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}},{}],88:[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":145,"../../plots/font_attributes":210,"../color/attributes":36}],89:[function(t,e,n){"use strict";e.exports={scrollBarWidth:4,scrollBarHeight:20,scrollBarColor:"#808BA4",scrollBarMargin:4}},{}],90:[function(t,e,n){"use strict";var r=t("../../registry"),a=t("../../lib"),o=t("./attributes"),i=t("../../plots/layout_attributes"),l=t("./helpers");e.exports=function(t,e,n){function s(t,e){return a.coerce(h,p,o,t,e)}for(var c,u,f,d,h=t.legend||{},p=e.legend={},g=0,v="normal",m=0;m1)){if(s("bgcolor",e.paper_bgcolor),s("bordercolor"),s("borderwidth"),a.coerceFont(s,"font",e.font),s("orientation"),"h"===p.orientation){var x=t.xaxis;x&&x.rangeslider&&x.rangeslider.visible?(c=0,f="left",u=1.1,d="bottom"):(c=0,f="left",u=-.1,d="top")}s("traceorder",v),l.isGrouped(e.legend)&&s("tracegroupgap"),s("x",c),s("xanchor",f),s("y",u),s("yanchor",d),a.noneOrAll(h,p,["x","y"])}}},{"../../lib":150,"../../plots/layout_attributes":213,"../../registry":222,"./attributes":88,"./helpers":93}],91:[function(t,e,n){"use strict";function r(t,e){function n(n){y.convertToTspans(n,e,function(){i(t,e)})}var r=t.data()[0][0],a=e._fullLayout,o=r.trace,l=p.traceIs(o,"pie"),s=o.index,c=l?r.label:o.name,u=t.selectAll("text.legendtext").data([0]);u.enter().append("text").classed("legendtext",!0),u.attr("text-anchor","start").classed("user-select-none",!0).call(v.font,a.legend.font).text(c),e._context.edits.legendText&&!l?u.call(y.makeEditable,{gd:e}).call(n).on("edit",function(t){this.text(t).call(n),this.text()||(t=" ");var a,o=r.trace._fullInput||{};if(-1!==["ohlc","candlestick"].indexOf(o.type)){var i=r.trace.transforms;a=i[i.length-1].direction+".name"}else a="name";f.restyle(e,a,t,s)}):u.call(n)}function a(t,e){var n,r=1,a=t.selectAll("rect").data([0]);a.enter().append("rect").classed("legendtoggle",!0).style("cursor","pointer").attr("pointer-events","all").call(m.fill,"rgba(0,0,0,0)"),a.on("mousedown",function(){n=(new Date).getTime(),n-e._legendMouseDownTimeL&&(r=Math.max(r-1,1)),1===r?n._clickTimeout=setTimeout(function(){o(t,e,r)},L):2===r&&(n._clickTimeout&&clearTimeout(n._clickTimeout),e._legendMouseDownTime=0,o(t,e,r))}})}function o(t,e,n){if(!e._dragged&&!e._editing){var r,a,o=e._fullLayout.hiddenlabels?e._fullLayout.hiddenlabels.slice():[],i=t.data()[0][0],l=e._fullData,s=i.trace,c=s.legendgroup,u=[];if(1===n&&T&&e.data&&e._context.showTips?(d.notifier("Double click on legend to isolate individual trace","long"),T=!1):T=!1,p.traceIs(s,"pie")){var h=i.label,g=o.indexOf(h);1===n?-1===g?o.push(h):o.splice(g,1):2===n&&(o=[],e.calcdata[0].forEach(function(t){h!==t.label&&o.push(t.label)}),e._fullLayout.hiddenlabels&&e._fullLayout.hiddenlabels.length===o.length&&-1===g&&(o=[])),f.relayout(e,"hiddenlabels",o)}else{var v,m=[],y=[];for(v=0;vr.width-(r.margin.r+r.margin.l)&&(x=0,g+=m,a.height=a.height+m,m=0),v.setTranslate(this,o+x,5+o+e.height/2+g),a.width+=i+n,a.height=Math.max(a.height,e.height),x+=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.each(function(e){var n=e[0];u.select(this).select(".legendtoggle").call(v.setRect,0,-n.height/2,(t._context.edits.legendText?0:a.width)+l,n.height)})}function s(t){var e=t._fullLayout,n=e.legend,r="left";A.isRightAnchor(n)?r="right":A.isCenterAnchor(n)&&(r="center");var a="top";A.isBottomAnchor(n)?a="bottom":A.isMiddleAnchor(n)&&(a="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}[a]||0),t:n.height*({bottom:1,middle:.5}[a]||0)})}function c(t){var e=t._fullLayout,n=e.legend,r="left";A.isRightAnchor(n)?r="right":A.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"),f=t("../../plotly"),d=t("../../lib"),h=t("../../plots/plots"),p=t("../../registry"),g=t("../dragelement"),v=t("../drawing"),m=t("../color"),y=t("../../lib/svg_text_utils"),x=t("./constants"),b=t("../../constants/interactions"),_=t("../../constants/alignment").LINE_SPACING,w=t("./get_legend_data"),k=t("./style"),M=t("./helpers"),A=t("./anchor_utils"),T=!0,L=b.DBLCLICKDELAY;e.exports=function(t){function e(t,e){S.attr("data-scroll",e).call(v.setTranslate,0,e),O.call(v.setRect,j,t,x.scrollBarWidth,x.scrollBarHeight),T.select("rect").attr({y:y.borderwidth-e})}var n=t._fullLayout,i="legend"+n._uid;if(n._infolayer&&t.calcdata){t._legendMouseDownTime||(t._legendMouseDownTime=0);var y=n.legend,b=n.showlegend&&w(t.calcdata,y),_=n.hiddenlabels||[];if(!n.showlegend||!b.length)return n._infolayer.selectAll(".legend").remove(),n._topdefs.select("#"+i).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 T=n._topdefs.selectAll("#"+i).data([0]);T.enter().append("clipPath").attr("id",i).append("rect");var C=M.selectAll("rect.bg").data([0]);C.enter().append("rect").attr({class:"bg","shape-rendering":"crispEdges"}),C.call(m.stroke,y.bordercolor),C.call(m.fill,y.bgcolor),C.style("stroke-width",y.borderwidth+"px");var S=M.selectAll("g.scrollbox").data([0]);S.enter().append("g").attr("class","scrollbox");var O=M.selectAll("rect.scrollbar").data([0]);O.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(b);z.enter().append("g").attr("class","groups"),z.exit().remove();var D=z.selectAll("g.traces").data(d.identity);D.enter().append("g").attr("class","traces"),D.exit().remove(),D.call(k,t).style("opacity",function(t){var e=t[0].trace;return p.traceIs(e,"pie")?-1!==_.indexOf(t[0].label)?.5:1:"legendonly"===e.visible?.5:1}).each(function(){u.select(this).call(r,t).call(a,t)});var P=0!==M.enter().size();P&&(l(t,z,D),s(t));var E=n.width,N=n.height;l(t,z,D),y.height>N?c(t):s(t);var I=n._size,R=I.l+I.w*y.x,F=I.t+I.h*(1-y.y);A.isRightAnchor(y)?R-=y.width:A.isCenterAnchor(y)&&(R-=y.width/2),A.isBottomAnchor(y)?F-=y.height:A.isMiddleAnchor(y)&&(F-=y.height/2);var j=y.width,B=I.w;j>B?(R=I.l,j=B):(R+j>E&&(R=E-j),R<0&&(R=0),j=Math.min(E-R,y.width));var q=y.height,H=I.h;q>H?(F=I.t,q=H):(F+q>N&&(F=N-q),F<0&&(F=0),q=Math.min(N-F,y.height)),v.setTranslate(M,R,F);var V,U,G=q-x.scrollBarHeight-2*x.scrollBarMargin,X=y.height-q;if(y.height<=q||t._context.staticPlot)C.attr({width:j-y.borderwidth,height:q-y.borderwidth,x:y.borderwidth/2,y:y.borderwidth/2}),v.setTranslate(S,0,0),T.select("rect").attr({width:j-2*y.borderwidth,height:q-2*y.borderwidth,x:y.borderwidth,y:y.borderwidth}),S.call(v.setClipUrl,i);else{V=x.scrollBarMargin,U=S.attr("data-scroll")||0,C.attr({width:j-2*y.borderwidth+x.scrollBarWidth+x.scrollBarMargin,height:q-y.borderwidth,x:y.borderwidth/2,y:y.borderwidth/2}),T.select("rect").attr({width:j-2*y.borderwidth+x.scrollBarWidth+x.scrollBarMargin,height:q-2*y.borderwidth,x:y.borderwidth,y:y.borderwidth-U}),S.call(v.setClipUrl,i),P&&e(V,U),M.on("wheel",null),M.on("wheel",function(){U=d.constrain(S.attr("data-scroll")-u.event.deltaY/G*X,-X,0),V=x.scrollBarMargin-U/X*G,e(V,U),0!==U&&U!==-X&&u.event.preventDefault()}),O.on(".drag",null),S.on(".drag",null);var Y=u.behavior.drag().on("drag",function(){V=d.constrain(u.event.y-x.scrollBarHeight/2,x.scrollBarMargin,x.scrollBarMargin+G),U=-(V-x.scrollBarMargin)/G*X,e(V,U)});O.call(Y),S.call(Y)}if(t._context.edits.legendPosition){var Z,W,$,Q;M.classed("cursor-move",!0),g.init({element:M.node(),gd:t,prepFn:function(){var t=v.getTranslate(M);$=t.x,Q=t.y},moveFn:function(t,e){var n=$+t,r=Q+e;v.setTranslate(M,n,r),Z=g.align(n,0,I.l,I.l+I.w,y.xanchor),W=g.align(r,0,I.t+I.h,I.t,y.yanchor)},doneFn:function(e,r,a){if(e&&void 0!==Z&&void 0!==W)f.relayout(t,{"legend.x":Z,"legend.y":W});else{var i=n._infolayer.selectAll("g.traces").filter(function(){var t=this.getBoundingClientRect();return a.clientX>=t.left&&a.clientX<=t.right&&a.clientY>=t.top&&a.clientY<=t.bottom});i.size()>0&&(1===r?M._clickTimeout=setTimeout(function(){o(i,t,r)},L):2===r&&(M._clickTimeout&&clearTimeout(M._clickTimeout),o(i,t,r)))}}})}}}},{"../../constants/alignment":133,"../../constants/interactions":134,"../../lib":150,"../../lib/svg_text_utils":167,"../../plotly":181,"../../plots/plots":215,"../../registry":222,"../color":37,"../dragelement":58,"../drawing":61,"./anchor_utils":87,"./constants":89,"./get_legend_data":92,"./helpers":93,"./style":95,d3:10}],92:[function(t,e,n){"use strict";var r=t("../../registry"),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;on[1])return n[1]}return a}function a(t){return t[0]}var l,c,u=t[0],f=u.trace,d=s.hasMarkers(f),h=s.hasText(f),p=s.hasLines(f);if(d||h||p){var g={},v={};d&&(g.mc=n("marker.color",a),g.mo=n("marker.opacity",o.mean,[.2,1]),g.ms=n("marker.size",o.mean,[2,16]),g.mlc=n("marker.line.color",a),g.mlw=n("marker.line.width",o.mean,[0,5]),v.marker={sizeref:1,sizemin:1,sizemode:"diameter"}),p&&(v.line={width:n("line.width",a,[0,10])}),h&&(g.tx="Aa",g.tp=n("textposition",a),g.ts=10,g.tc=n("textfont.color",a),g.tf=n("textfont.family",a)),l=[o.minExtend(u,g)],c=o.minExtend(f,v)}var m=r.select(this).select("g.legendpoints"),y=m.selectAll("path.scatterpts").data(d?l:[]);y.enter().append("path").classed("scatterpts",!0).attr("transform","translate(20,0)"),y.exit().remove(),y.call(i.pointStyle,c,e),d&&(l[0].mrc=3);var x=m.selectAll("g.pointtext").data(h?l:[]);x.enter().append("g").classed("pointtext",!0).append("text").attr("transform","translate(20,0)"),x.exit().remove(),x.selectAll("text").call(i.textPointStyle,c,e)}function f(t){var e=t[0].trace,n=e.marker||{},o=n.line||{},i=r.select(this).select("g.legendpoints").selectAll("path.legendbar").data(a.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=r.select(this),a=t[0],i=(a.mlw+1||o.width+1)-1;e.style("stroke-width",i+"px").call(l.fill,a.mc||n.color),i&&e.call(l.stroke,a.mlc||o.color)})}function d(t){var e=t[0].trace,n=r.select(this).select("g.legendpoints").selectAll("path.legendbox").data(a.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(){var t=e.line.width,n=r.select(this);n.style("stroke-width",t+"px").call(l.fill,e.fillcolor),t&&n.call(l.stroke,e.line.color)})}function h(t){var e=t[0].trace,n=r.select(this).select("g.legendpoints").selectAll("path.legendpie").data(a.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(c,t[0],e)}t.each(function(t){var e=r.select(this),n=e.selectAll("g.layers").data([0]);n.enter().append("g").classed("layers",!0),n.style("opacity",t[0].trace.opacity),n.selectAll("g.legendfill").data([t]).enter().append("g").classed("legendfill",!0),n.selectAll("g.legendlines").data([t]).enter().append("g").classed("legendlines",!0);var a=n.selectAll("g.legendsymbols").data([t]);a.enter().append("g").classed("legendsymbols",!0),a.selectAll("g.legendpoints").data([t]).enter().append("g").classed("legendpoints",!0)}).each(f).each(d).each(h).each(n).each(u)}},{"../../lib":150,"../../registry":222,"../../traces/pie/style_one":284,"../../traces/scatter/subtypes":306,"../color":37,"../drawing":61,d3:10}],96:[function(t,e,n){"use strict";function r(t,e){var n,r,a=e.currentTarget,o=a.getAttribute("data-attr"),i=a.getAttribute("data-val")||!0,l=t._fullLayout,s={},c=d.list(t,null,!0),f="on";if("zoom"===o){var h,p="in"===i?.5:2,g=(1+p)/2,v=(1-p)/2;for(r=0;r1)return r(["resetViews","toggleHover"]),i(m,n);u&&(r(["zoom3d","pan3d","orbitRotation","tableRotation"]),r(["resetCameraDefault3d","resetCameraLastSave3d"]),r(["hoverClosest3d"])),f&&(r(["zoomInGeo","zoomOutGeo","resetGeo"]),r(["hoverClosestGeo"]));var y=a(l),x=[];return((c||p)&&!y||g)&&(x=["zoom2d","pan2d"]),v&&(x=["pan2d"]),o(s)&&(x.push("select2d"),x.push("lasso2d")),x.length&&r(x),!c&&!p||y||g||r(["zoomIn2d","zoomOut2d","autoScale2d","resetScale2d"]),c&&h?r(["toggleHover"]):p?r(["hoverClosestGl2d"]):c?r(["toggleSpikelines","hoverClosestCartesian","hoverCompareCartesian"]):h?r(["hoverClosestPie"]):v&&r(["resetViewMapbox","toggleHover"]),i(m,n)}function a(t){for(var e=s.list({_fullLayout:t},null,!0),n=!0,r=0;r0)){var p=a(e,n,s);f("x",p[0]),f("y",p[1]),o.noneOrAll(t,e,["x","y"]),f("xanchor"),f("yanchor"),o.coerceFont(f,"font",n.font);var g=f("bgcolor");f("activecolor",i.contrast(g,c.lightAmount,c.darkAmount)),f("bordercolor"),f("borderwidth")}}},{"../../lib":150,"../color":37,"./attributes":100,"./button_attributes":101,"./constants":102}],104:[function(t,e,n){"use strict";function r(t){for(var e=m.list(t,"x",!0),n=[],r=0;rp&&(p=d)));return p>=h?[h,p]:void 0}}var a=t("../../lib"),o=t("../../plots/cartesian/axes"),i=t("./constants"),l=t("./helpers");e.exports=function(t){var e=t._fullLayout,n=a.filterVisible(e.shapes);if(n.length&&t._fullData.length)for(var l=0;lX&&r>Y&&!t.shiftKey?p.getCursor(a/n,1-o/r):"move";g(e,i),G=i.split("-")[0]}function o(e){j=f.getFromId(t,n.xref),B=f.getFromId(t,n.yref),q=m.getDataToPixel(t,j),H=m.getDataToPixel(t,B,!0),V=m.getPixelToData(t,j),U=m.getPixelToData(t,B,!0);var o="shapes["+r+"]";"path"===n.type?(R=n.path,F=o+".path"):(v=q(n.x0),y=H(n.y0),x=q(n.x1),b=H(n.y1),_=o+".x0",w=o+".y0",k=o+".x1",M=o+".y1"),vY&&(h[S]=n[P]=U(c),h[O]=n[E]=U(u)),d-f>X&&(h[z]=n[N]=V(f),h[D]=n[I]=V(d))}e.attr("d",i(t,n))}var h,v,y,x,b,_,w,k,M,A,T,L,C,S,O,z,D,P,E,N,I,R,F,j,B,q,H,V,U,G,X=10,Y=10,Z={element:e.node(),gd:t,prepFn:o,doneFn:l},W=Z.element.getBoundingClientRect();p.init(Z),e.node().onmousemove=a}function i(t,e){var n,r,a,o,i=e.type,s=f.getFromId(t,e.xref),c=f.getFromId(t,e.yref),u=t._fullLayout._size;if(s?(n=m.shapePositionToRange(s),r=function(t){return s._offset+s.r2p(n(t,!0))}):r=function(t){return u.l+u.w*t},c?(a=m.shapePositionToRange(c),o=function(t){return c._offset+c.r2p(a(t,!0))}):o=function(t){return u.t+u.h*(1-t)},"path"===i)return s&&"date"===s.type&&(r=m.decodeDate(r)),c&&"date"===c.type&&(o=m.decodeDate(o)),l(e.path,r,o);var d=r(e.x0),h=r(e.x1),p=o(e.y0),g=o(e.y1);if("line"===i)return"M"+d+","+p+"L"+h+","+g;if("rect"===i)return"M"+d+","+p+"H"+h+"V"+g+"H"+d+"Z";var v=(d+h)/2,y=(p+g)/2,x=Math.abs(v-d),b=Math.abs(y-p),_="A"+x+","+b,w=v+x+","+y;return"M"+w+_+" 0 1,1 "+v+","+(y-b)+_+" 0 0,1 "+w+"Z"}function l(t,e,n){return t.replace(v.segmentRE,function(t){var r=0,a=t.charAt(0),o=v.paramIsX[a],i=v.paramIsY[a],l=v.numParams[a],s=t.substr(1).replace(v.paramRE,function(t){return o[r]?t=e(t):i[r]&&(t=n(t)),r++,r>l&&(t="X"),t});return r>l&&(s=s.replace(/[\s,]*X.*/,""),u.log("Ignoring extra params in segment "+t)),a+s})}function s(t,e,n){return t.replace(v.segmentRE,function(t){var r=0,a=t.charAt(0),o=v.paramIsX[a],i=v.paramIsY[a],l=v.numParams[a];return a+t.substr(1).replace(v.paramRE,function(t){return r>=l?t:(o[r]?t=e(t):i[r]&&(t=n(t)),r++,t)})})}var c=t("../../plotly"),u=t("../../lib"),f=t("../../plots/cartesian/axes"),d=t("../color"),h=t("../drawing"),p=t("../dragelement"),g=t("../../lib/setcursor"),v=t("./constants"),m=t("./helpers");e.exports={draw:r,drawOne:a}},{"../../lib":150,"../../lib/setcursor":165,"../../plotly":181,"../../plots/cartesian/axes":186,"../color":37,"../dragelement":58,"../drawing":61,"./constants":115,"./helpers":118}],118:[function(t,e,n){"use strict";n.rangeToShapePosition=function(t){return"log"===t.type?t.r2d:function(t){return t}},n.shapePositionToRange=function(t){return"log"===t.type?t.d2r:function(t){return t}},n.decodeDate=function(t){return function(e){return e.replace&&(e=e.replace("_"," ")),t(e)}},n.encodeDate=function(t){return function(e){return t(e).replace(" ","_")}},n.getDataToPixel=function(t,e,r){var a,o=t._fullLayout._size;if(e){var i=n.shapePositionToRange(e);a=function(t){return e._offset+e.r2p(i(t,!0))},"date"===e.type&&(a=n.decodeDate(a))}else a=r?function(t){return o.t+o.h*(1-t)}:function(t){return o.l+o.w*t};return a},n.getPixelToData=function(t,e,r){var a,o=t._fullLayout._size;if(e){var i=n.rangeToShapePosition(e);a=function(t){return i(e.p2r(t-e._offset))}}else a=r?function(t){return 1-(t-o.t)/o.h}:function(t){return(t-o.l)/o.w};return a}},{}],119:[function(t,e,n){"use strict";var r=t("./draw");e.exports={moduleType:"component",name:"shapes",layoutAttributes:t("./attributes"),supplyLayoutDefaults:t("./defaults"),calcAutorange:t("./calc_autorange"),draw:r.draw,drawOne:r.drawOne}},{"./attributes":113,"./calc_autorange":114,"./defaults":116,"./draw":117}],120:[function(t,e,n){"use strict";var r=t("../../lib"),a=t("../../plots/cartesian/axes"),o=t("./attributes"),i=t("./helpers");e.exports=function(t,e,n,l,s){function c(n,a){return r.coerce(t,e,o,n,a)}if(l=l||{},s=s||{},!c("visible",!s.itemIsNotPlainObject))return e;c("layer"),c("opacity"),c("fillcolor"),c("line.color"),c("line.width"),c("line.dash");for(var u=t.path?"path":"rect",f=c("type",u),d=["x","y"],h=0;h<2;h++){var p=d[h],g={_fullLayout:n},v=a.coerceRef(t,e,g,p,"","paper");if("path"!==f){var m,y,x;"paper"!==v?(m=a.getFromId(g,v),x=i.rangeToShapePosition(m),y=i.shapePositionToRange(m)):y=x=r.identity;var b=p+"0",_=p+"1",w=t[b],k=t[_];t[b]=y(t[b],!0),t[_]=y(t[_],!0),a.coercePosition(e,g,c,v,b,.25),a.coercePosition(e,g,c,v,_,.75),e[b]=x(e[b]),e[_]=x(e[_]),t[b]=w,t[_]=k}}return"path"===f?c("path"):r.noneOrAll(t,e,["x0","x1","y0","y1"]),e}},{"../../lib":150,"../../plots/cartesian/axes":186,"./attributes":113,"./helpers":118}],121:[function(t,e,n){"use strict";var r=t("../../plots/font_attributes"),a=t("../../plots/pad_attributes"),o=t("../../lib/extend").extendFlat,i=t("../../lib/extend").extendDeep,l=t("../../plots/animation_attributes"),s=t("./constants"),c={_isLinkedToArray:"step",method:{valType:"enumerated",values:["restyle","relayout","animate","update","skip"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string"},value:{valType:"string"},execute:{valType:"boolean",dflt:!0}};e.exports={_isLinkedToArray:"slider",visible:{valType:"boolean",dflt:!0},active:{valType:"number",min:0,dflt:0},steps:c,lenmode:{valType:"enumerated",values:["fraction","pixels"],dflt:"fraction"},len:{valType:"number",min:0,dflt:1},x:{valType:"number",min:-2,max:3,dflt:0},pad:i({},a,{},{t:{dflt:20}}),xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left"},y:{valType:"number",min:-2,max:3,dflt:0},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"top"},transition:{duration:{valType:"number",min:0,dflt:150},easing:{valType:"enumerated",values:l.transition.easing.values,dflt:"cubic-in-out"}},currentvalue:{visible:{valType:"boolean",dflt:!0},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left"},offset:{valType:"number",dflt:10},prefix:{valType:"string"},suffix:{valType:"string"},font:o({},r,{})},font:o({},r,{}),activebgcolor:{valType:"color",dflt:s.gripBgActiveColor},bgcolor:{valType:"color",dflt:s.railBgColor},bordercolor:{valType:"color",dflt:s.railBorderColor},borderwidth:{valType:"number",min:0,dflt:s.railBorderWidth},ticklen:{valType:"number",min:0,dflt:s.tickLength},tickcolor:{valType:"color",dflt:s.tickColor},tickwidth:{valType:"number",min:0,dflt:1},minorticklen:{valType:"number",min:0,dflt:s.minorTickLength}}},{"../../lib/extend":145,"../../plots/animation_attributes":182,"../../plots/font_attributes":210,"../../plots/pad_attributes":214,"./constants":122}],122:[function(t,e,n){"use strict";e.exports={name:"sliders",containerClassName:"slider-container",groupClassName:"slider-group",inputAreaClass:"slider-input-area",railRectClass:"slider-rail-rect",railTouchRectClass:"slider-rail-touch-rect",gripRectClass:"slider-grip-rect",tickRectClass:"slider-tick-rect",inputProxyClass:"slider-input-proxy",labelsClass:"slider-labels",labelGroupClass:"slider-label-group",labelClass:"slider-label",currentValueClass:"slider-current-value",railHeight:5,menuIndexAttrName:"slider-active-index",autoMarginIdRoot:"slider-",minWidth:30,minHeight:30,textPadX:40,arrowOffsetX:4,railRadius:2,railWidth:5,railBorder:4,railBorderWidth:1,railBorderColor:"#bec8d9",railBgColor:"#f8fafc",railInset:8,stepInset:10,gripRadius:10,gripWidth:20,gripHeight:20,gripBorder:20,gripBorderWidth:1,gripBorderColor:"#bec8d9",gripBgColor:"#f6f8fa",gripBgActiveColor:"#dbdde0",labelPadding:8,labelOffset:0,tickWidth:1,tickColor:"#333",tickOffset:25,tickLength:7,minorTickOffset:25,minorTickColor:"#333",minorTickLength:4,currentValuePadding:8,currentValueInset:0}},{}],123:[function(t,e,n){"use strict";function r(t,e,n){function r(n,r){return o.coerce(t,e,l,n,r)}r("visible",a(t,e).length>0)&&(r("active"),r("x"),r("y"),o.noneOrAll(t,e,["x","y"]),r("xanchor"),r("yanchor"),r("len"),r("lenmode"),r("pad.t"),r("pad.r"),r("pad.b"),r("pad.l"),o.coerceFont(r,"font",n.font),r("currentvalue.visible")&&(r("currentvalue.xanchor"),r("currentvalue.prefix"),r("currentvalue.suffix"),r("currentvalue.offset"),o.coerceFont(r,"currentvalue.font",e.font)),r("transition.duration"),r("transition.easing"),r("bgcolor"),r("activebgcolor"),r("bordercolor"),r("borderwidth"),r("ticklen"),r("tickwidth"),r("tickcolor"),r("minorticklen"))}function a(t,e){function n(t,e){return o.coerce(r,a,u,t,e)}for(var r,a,i=t.steps||[],l=e.steps=[],s=0;s=n.steps.length&&(n.active=0),e.call(l,n).call(b,n).call(u,n).call(p,n).call(x,t,n).call(s,t,n),A.setTranslate(e,n.lx+n.pad.l,n.ly+n.pad.t),e.call(v,n,n.active/(n.steps.length-1),!1),e.call(l,n)}function l(t,e,n){if(e.currentvalue.visible){var r,a,o=t.selectAll("text").data([0]);switch(e.currentvalue.xanchor){case"right":r=e.inputAreaLength-C.currentValueInset-e.currentValueMaxWidth,a="left";break;case"center":r=.5*e.inputAreaLength,a="middle";break;default:r=C.currentValueInset,a="left"}o.enter().append("text").classed(C.labelClass,!0).classed("user-select-none",!0).attr({"text-anchor":a,"data-notex":1}) -;var i=e.currentvalue.prefix?e.currentvalue.prefix:"";if("string"==typeof n)i+=n;else{i+=e.steps[e.active].label}e.currentvalue.suffix&&(i+=e.currentvalue.suffix),o.call(A.font,e.currentvalue.font).text(i).call(T.convertToTspans,e.gd);var l=T.lineCount(o),s=(e.currentValueMaxLines+1-l)*e.currentvalue.font.size*S;return T.positionText(o,r,s),o}}function s(t,e,n){var r=t.selectAll("rect."+C.gripRectClass).data([0]);r.enter().append("rect").classed(C.gripRectClass,!0).call(h,e,t,n).style("pointer-events","all"),r.attr({width:C.gripWidth,height:C.gripHeight,rx:C.gripRadius,ry:C.gripRadius}).call(M.stroke,n.bordercolor).call(M.fill,n.bgcolor).style("stroke-width",n.borderwidth+"px")}function c(t,e,n){var r=t.selectAll("text").data([0]);return r.enter().append("text").classed(C.labelClass,!0).classed("user-select-none",!0).attr({"text-anchor":"middle","data-notex":1}),r.call(A.font,n.font).text(e.step.label).call(T.convertToTspans,n.gd),r}function u(t,e){var n=t.selectAll("g."+C.labelsClass).data([0]);n.enter().append("g").classed(C.labelsClass,!0);var r=n.selectAll("g."+C.labelGroupClass).data(e.labelSteps);r.enter().append("g").classed(C.labelGroupClass,!0),r.exit().remove(),r.each(function(t){var n=w.select(this);n.call(c,t,e),A.setTranslate(n,m(e,t.fraction),C.tickOffset+e.ticklen+e.font.size*S+C.labelOffset+e.currentValueTotalHeight)})}function f(t,e,n,r,a){var o=Math.round(r*(n.steps.length-1));o!==n.active&&d(t,e,n,o,!0,a)}function d(t,e,n,r,a,o){var i=n.active;n._input.active=n.active=r;var s=n.steps[n.active];e.call(v,n,n.active/(n.steps.length-1),o),e.call(l,n),t.emit("plotly_sliderchange",{slider:n,step:n.steps[n.active],interaction:a,previousActive:i}),s&&s.method&&a&&(e._nextMethod?(e._nextMethod.step=s,e._nextMethod.doCallback=a,e._nextMethod.doTransition=o):(e._nextMethod={step:s,doCallback:a,doTransition:o},e._nextMethodRaf=window.requestAnimationFrame(function(){var n=e._nextMethod.step;n.method&&(n.execute&&k.executeAPICommand(t,n.method,n.args),e._nextMethod=null,e._nextMethodRaf=null)})))}function h(t,e,n){function r(){return n.data()[0]}var a=n.node(),o=w.select(e);t.on("mousedown",function(){var t=r();e.emit("plotly_sliderstart",{slider:t});var i=n.select("."+C.gripRectClass);w.event.stopPropagation(),w.event.preventDefault(),i.call(M.fill,t.activebgcolor);var l=y(t,w.mouse(a)[0]);f(e,n,t,l,!0),t._dragging=!0,o.on("mousemove",function(){var t=r(),o=y(t,w.mouse(a)[0]);f(e,n,t,o,!1)}),o.on("mouseup",function(){var t=r();t._dragging=!1,i.call(M.fill,t.bgcolor),o.on("mouseup",null),o.on("mousemove",null),e.emit("plotly_sliderend",{slider:t,step:t.steps[t.active]})})})}function p(t,e){var n=t.selectAll("rect."+C.tickRectClass).data(e.steps);n.enter().append("rect").classed(C.tickRectClass,!0),n.exit().remove(),n.attr({width:e.tickwidth+"px","shape-rendering":"crispEdges"}),n.each(function(t,n){var r=n%e.labelStride==0,a=w.select(this);a.attr({height:r?e.ticklen:e.minorticklen}).call(M.fill,e.tickcolor),A.setTranslate(a,m(e,n/(e.steps.length-1))-.5*e.tickwidth,(r?C.tickOffset:C.minorTickOffset)+e.currentValueTotalHeight)})}function g(t){t.labelSteps=[];for(var e=t.steps.length,n=0;n0&&(i=i.transition().duration(e.transition.duration).ease(e.transition.easing)),i.attr("transform","translate("+(o-.5*C.gripWidth)+","+e.currentValueTotalHeight+")")}}function m(t,e){return t.inputAreaStart+C.stepInset+(t.inputAreaLength-2*C.stepInset)*Math.min(1,Math.max(0,e))}function y(t,e){return Math.min(1,Math.max(0,(e-C.stepInset-t.inputAreaStart)/(t.inputAreaLength-2*C.stepInset-2*t.inputAreaStart)))}function x(t,e,n){var r=t.selectAll("rect."+C.railTouchRectClass).data([0]);r.enter().append("rect").classed(C.railTouchRectClass,!0).call(h,e,t,n).style("pointer-events","all"),r.attr({width:n.inputAreaLength,height:Math.max(n.inputAreaWidth,C.tickOffset+n.ticklen+n.labelHeight)}).call(M.fill,n.bgcolor).attr("opacity",0),A.setTranslate(r,0,n.currentValueTotalHeight)}function b(t,e){var n=t.selectAll("rect."+C.railRectClass).data([0]);n.enter().append("rect").classed(C.railRectClass,!0);var r=e.inputAreaLength-2*C.railInset;n.attr({width:r,height:C.railWidth,rx:C.railRadius,ry:C.railRadius,"shape-rendering":"crispEdges"}).call(M.stroke,e.bordercolor).call(M.fill,e.bgcolor).style("stroke-width",e.borderwidth+"px"),A.setTranslate(n,C.railInset,.5*(e.inputAreaWidth-C.railWidth)+e.currentValueTotalHeight)}function _(t){for(var e=t._fullLayout._pushmargin||{},n=Object.keys(e),r=0;r0?[0]:[]);if(l.enter().append("g").classed(C.containerClassName,!0).style("cursor","ew-resize"),l.exit().remove(),l.exit().size()&&_(t),0!==n.length){var s=l.selectAll("g."+C.groupClassName).data(n,a);s.enter().append("g").classed(C.groupClassName,!0),s.exit().each(function(e){w.select(this).remove(),e._commandObserver.remove(),delete e._commandObserver,k.autoMargin(t,C.autoMarginIdRoot+e._index)});for(var c=0;c0||d<0){var g={left:[-n,0],right:[n,0],top:[0,-n],bottom:[0,n]}[_.side];e.attr("transform","translate("+g+")")}}}var v,m=n.propContainer,y=n.propName,x=n.traceIndex,b=n.dfltName,_=n.avoid||{},w=n.attributes,k=n.transform,M=n.containerGroup,A=t._fullLayout,T=m.titlefont.family,L=m.titlefont.size,C=m.titlefont.color,S=1,O=!1,z=m.title.trim();"title"===y?v="titleText":-1!==y.indexOf("axis")?v="axisTitleText":y.indexOf(!0)&&(v="colorbarTitleText");var D=t._context.edits[v];""===z&&(S=0),z.match(d)&&(S=.2,O=!0,D||(z=""));var P=z||D;M||(M=A._infolayer.selectAll(".g-"+e).data([0]),M.enter().append("g").classed("g-"+e,!0));var E=M.selectAll("text").data(P?[0]:[]);if(E.enter().append("text"),E.text(z).attr("class",e),E.exit().remove(),P){E.call(h);var N="Click to enter "+b+" title";D&&(z?E.on(".opacity",null):function(){S=0,O=!0,z=N,E.text(z).on("mouseover.opacity",function(){r.select(this).transition().duration(f.SHOW_PLACEHOLDER).style("opacity",1)}).on("mouseout.opacity",function(){r.select(this).transition().duration(f.HIDE_PLACEHOLDER).style("opacity",0)})}(),E.call(u.makeEditable,{gd:t}).on("edit",function(e){void 0!==x?o.restyle(t,y,e,x):o.relayout(t,y,e)}).on("cancel",function(){this.text(this.attr("data-unformatted")).call(h)}).on("input",function(t){this.text(t||" ").call(u.positionText,w.x,w.y)})),E.classed("js-placeholder",O)}}},{"../../constants/interactions":134,"../../lib":150,"../../lib/svg_text_utils":167,"../../plotly":181,"../../plots/plots":215,"../color":37,"../drawing":61,d3:10,"fast-isnumeric":13}],127:[function(t,e,n){"use strict";var r=t("../../plots/font_attributes"),a=t("../color/attributes"),o=t("../../lib/extend").extendFlat,i=t("../../plots/pad_attributes"),l={_isLinkedToArray:"button",method:{valType:"enumerated",values:["restyle","relayout","animate","update","skip"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string",dflt:""},execute:{valType:"boolean",dflt:!0}};e.exports={_isLinkedToArray:"updatemenu",_arrayAttrRegexps:[/^updatemenus\[(0|[1-9][0-9]+)\]\.buttons/],visible:{valType:"boolean"},type:{valType:"enumerated",values:["dropdown","buttons"],dflt:"dropdown"},direction:{valType:"enumerated",values:["left","right","up","down"],dflt:"down"},active:{valType:"integer",min:-1,dflt:0},showactive:{valType:"boolean",dflt:!0},buttons:l,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:"top"},pad:o({},i,{}),font:o({},r,{}),bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:a.borderLine},borderwidth:{valType:"number",min:0,dflt:1}}},{"../../lib/extend":145,"../../plots/font_attributes":210,"../../plots/pad_attributes":214,"../color/attributes":36}],128:[function(t,e,n){"use strict";e.exports={name:"updatemenus",containerClassName:"updatemenu-container",headerGroupClassName:"updatemenu-header-group",headerClassName:"updatemenu-header",headerArrowClassName:"updatemenu-header-arrow",dropdownButtonGroupClassName:"updatemenu-dropdown-button-group",dropdownButtonClassName:"updatemenu-dropdown-button",buttonClassName:"updatemenu-button",itemRectClassName:"updatemenu-item-rect",itemTextClassName:"updatemenu-item-text",menuIndexAttrName:"updatemenu-active-index",autoMarginIdRoot:"updatemenu-",blankHeaderOpts:{label:" "},minWidth:30,minHeight:30,textPadX:24,arrowPadX:16,rx:2,ry:2,textOffsetX:12,textOffsetY:3,arrowOffsetX:4,gapButtonHeader:5,gapButton:2,activeColor:"#F4FAFF",hoverColor:"#F4FAFF",arrowSymbol:{left:"\u25c4",right:"\u25ba",up:"\u25b2",down:"\u25bc"}}},{}],129:[function(t,e,n){"use strict";function r(t,e,n){function r(n,r){return o.coerce(t,e,l,n,r)}r("visible",a(t,e).length>0)&&(r("active"),r("direction"),r("type"),r("showactive"),r("x"),r("y"),o.noneOrAll(t,e,["x","y"]),r("xanchor"),r("yanchor"),r("pad.t"),r("pad.r"),r("pad.b"),r("pad.l"),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,u,t,e)}for(var r,a,i=t.buttons||[],l=e.buttons=[],s=0;s0?[0]:[]);if(o.enter().append("g").classed(S.containerClassName,!0).style("cursor","pointer"),o.exit().remove(),o.exit().size()&&_(t),0!==n.length){var u=o.selectAll("g."+S.headerGroupClassName).data(n,a);u.enter().append("g").classed(S.headerGroupClassName,!0);var f=o.selectAll("g."+S.dropdownButtonGroupClassName).data([0]);f.enter().append("g").classed(S.dropdownButtonGroupClassName,!0).style("pointer-events","all");for(var d=0;dk,T=r.barLength+2*r.barPad,L=r.barWidth+2*r.barPad,C=p,S=v+m;S+L>c&&(S=c-L);var O=this.container.selectAll("rect.scrollbar-horizontal").data(A?[0]:[]);O.exit().on(".drag",null).remove(),O.enter().append("rect").classed("scrollbar-horizontal",!0).call(o.fill,r.barColor),A?(this.hbar=O.attr({rx:r.barRadius,ry:r.barRadius,x:C,y:S,width:T,height:L}),this._hbarXMin=C+T/2,this._hbarTranslateMax=k-T):(delete this.hbar,delete this._hbarXMin,delete this._hbarTranslateMax);var z=m>M,D=r.barWidth+2*r.barPad,P=r.barLength+2*r.barPad,E=p+g,N=v;E+D>s&&(E=s-D);var I=this.container.selectAll("rect.scrollbar-vertical").data(z?[0]:[]);I.exit().on(".drag",null).remove(),I.enter().append("rect").classed("scrollbar-vertical",!0).call(o.fill,r.barColor),z?(this.vbar=I.attr({rx:r.barRadius,ry:r.barRadius,x:E,y:N,width:D,height:P}),this._vbarYMin=N+P/2,this._vbarTranslateMax=M-P):(delete this.vbar,delete this._vbarYMin,delete this._vbarTranslateMax);var R=this.id,F=u-.5,j=z?f+D+.5:f+.5,B=d-.5,q=A?h+L+.5:h+.5,H=l._topdefs.selectAll("#"+R).data(A||z?[0]:[]);if(H.exit().remove(),H.enter().append("clipPath").attr("id",R).append("rect"),A||z?(this._clipRect=H.select("rect").attr({x:Math.floor(F),y:Math.floor(B),width:Math.ceil(j)-Math.floor(F),height:Math.ceil(q)-Math.floor(B)}),this.container.call(i.setClipUrl,R),this.bg.attr({x:p,y:v,width:g,height:m})):(this.bg.attr({width:0,height:0}),this.container.on("wheel",null).on(".drag",null).call(i.setClipUrl,null),delete this._clipRect),A||z){var V=a.behavior.drag().on("dragstart",function(){a.event.sourceEvent.preventDefault()}).on("drag",this._onBoxDrag.bind(this));this.container.on("wheel",null).on("wheel",this._onBoxWheel.bind(this)).on(".drag",null).call(V);var U=a.behavior.drag().on("dragstart",function(){a.event.sourceEvent.preventDefault(),a.event.sourceEvent.stopPropagation()}).on("drag",this._onBarDrag.bind(this));A&&this.hbar.on(".drag",null).call(U),z&&this.vbar.on(".drag",null).call(U)}this.setTranslate(e,n)},r.prototype.disable=function(){(this.hbar||this.vbar)&&(this.bg.attr({width:0,height:0}),this.container.on("wheel",null).on(".drag",null).call(i.setClipUrl,null),delete this._clipRect),this.hbar&&(this.hbar.on(".drag",null),this.hbar.remove(),delete this.hbar,delete this._hbarXMin,delete this._hbarTranslateMax),this.vbar&&(this.vbar.on(".drag",null),this.vbar.remove(),delete this.vbar,delete this._vbarYMin,delete this._vbarTranslateMax)},r.prototype._onBoxDrag=function(){var t=this.translateX,e=this.translateY;this.hbar&&(t-=a.event.dx),this.vbar&&(e-=a.event.dy),this.setTranslate(t,e)},r.prototype._onBoxWheel=function(){var t=this.translateX,e=this.translateY;this.hbar&&(t+=a.event.deltaY),this.vbar&&(e+=a.event.deltaY),this.setTranslate(t,e)},r.prototype._onBarDrag=function(){var t=this.translateX,e=this.translateY;if(this.hbar){var n=t+this._hbarXMin,r=n+this._hbarTranslateMax;t=(l.constrain(a.event.x,n,r)-n)/(r-n)*(this.position.w-this._box.w)}if(this.vbar){var o=e+this._vbarYMin,i=o+this._vbarTranslateMax;e=(l.constrain(a.event.y,o,i)-o)/(i-o)*(this.position.h-this._box.h)}this.setTranslate(t,e)},r.prototype.setTranslate=function(t,e){var n=this.position.w-this._box.w,r=this.position.h-this._box.h;if(t=l.constrain(t||0,0,n),e=l.constrain(e||0,0,r),this.translateX=t,this.translateY=e,this.container.call(i.setTranslate,this._box.l-this.position.l-t,this._box.t-this.position.t-e),this._clipRect&&this._clipRect.attr({x:Math.floor(this.position.l+t-.5),y:Math.floor(this.position.t+e-.5)}),this.hbar){var a=t/n;this.hbar.call(i.setTranslate,t+a*this._hbarTranslateMax,e)}if(this.vbar){var o=e/r;this.vbar.call(i.setTranslate,t,e+o*this._vbarTranslateMax)}}},{"../../lib":150,"../color":37,"../drawing":61,d3:10}],133:[function(t,e,n){"use strict";e.exports={FROM_BL:{left:0,center:.5,right:1,bottom:0,middle:.5,top:1},FROM_TL:{left:0,center:.5,right:1,bottom:1,middle:.5,top:0},LINE_SPACING:1.3,MID_SHIFT:.35}},{}],134:[function(t,e,n){"use strict";e.exports={SHOW_PLACEHOLDER:100,HIDE_PLACEHOLDER:1e3,DBLCLICKDELAY:300,DESELECTDIM:.2}},{}],135:[function(t,e,n){"use strict";e.exports={BADNUM:void 0,FP_SAFE:Number.MAX_VALUE/1e4,ONEAVGYEAR:315576e5,ONEAVGMONTH:26298e5,ONEDAY:864e5,ONEHOUR:36e5,ONEMIN:6e4,ONESEC:1e3,EPOCHJD:2440587.5,ALMOST_EQUAL:1-1e-6}},{}],136:[function(t,e,n){"use strict";e.exports={entityToUnicode:{mu:"\u03bc","#956":"\u03bc",amp:"&","#28":"&",lt:"<","#60":"<",gt:">","#62":">",nbsp:"\xa0","#160":"\xa0",times:"\xd7","#215":"\xd7",plusmn:"\xb1","#177":"\xb1",deg:"\xb0","#176":"\xb0"}}},{}],137:[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}},{}],138:[function(t,e,n){"use strict";var r=t("./plotly");n.version="1.29.1",t("es6-promise").polyfill(),t("../build/plotcss"),t("./fonts/mathjax_config"),n.plot=r.plot,n.newPlot=r.newPlot,n.restyle=r.restyle,n.relayout=r.relayout,n.redraw=r.redraw,n.update=r.update,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=t("./plot_api/register"),n.toImage=t("./plot_api/to_image"),n.downloadImage=t("./snapshot/download"),n.validate=t("./plot_api/validate"),n.addFrames=r.addFrames,n.deleteFrames=r.deleteFrames,n.animate=r.animate,n.register(t("./traces/scatter")),n.register([t("./components/fx"),t("./components/legend"),t("./components/annotations"),t("./components/annotations3d"),t("./components/shapes"),t("./components/images"),t("./components/updatemenus"),t("./components/sliders"),t("./components/rangeslider"),t("./components/rangeselector")]),n.Icons=t("../build/ploticon"),n.Plots=r.Plots,n.Fx=t("./components/fx"),n.Snapshot=t("./snapshot"),n.PlotSchema=t("./plot_api/plot_schema"),n.Queue=t("./lib/queue"),n.d3=t("d3")},{"../build/plotcss":1,"../build/ploticon":2,"./components/annotations":30,"./components/annotations3d":35,"./components/fx":78,"./components/images":86,"./components/legend":94,"./components/rangeselector":106,"./components/rangeslider":112,"./components/shapes":119,"./components/sliders":125,"./components/updatemenus":131,"./fonts/mathjax_config":139,"./lib/queue":162,"./plot_api/plot_schema":175,"./plot_api/register":176,"./plot_api/set_plot_config":177,"./plot_api/to_image":179,"./plot_api/validate":180,"./plotly":181,"./snapshot":227,"./snapshot/download":224,"./traces/scatter":296,d3:10,"es6-promise":11}],139:[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},{}],140:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("../constants/numerical").BADNUM,o=/^['"%,$#\s']+|[, ]|['"%,$#\s']+$/g;e.exports=function(t){return"string"==typeof t&&(t=t.replace(o,"")),r(t)?Number(t):a}},{"../constants/numerical":135,"fast-isnumeric":13}],141:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("tinycolor2"),o=t("../plots/attributes"),i=t("../components/colorscale/get_scale"),l=(Object.keys(t("../components/colorscale/scales")),t("./nested_property")),s=/^([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)},validateFunction:function(t,e){e.coerceNumber&&(t=+t);for(var n=e.values,r=0;ra.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;!0!==r.strict&&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;if("string"==typeof t&&t.substr(0,r)===n&&s.test(t.substr(r)))return void e.set(t);e.set(n)},validateFunction:function(t,e){var n=e.dflt,r=n.length;return t===n||"string"==typeof t&&!(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 a=t.split("+"),o=0;o0&&(i=i.transition().duration(e.transition.duration).ease(e.transition.easing)),i.attr("transform","translate("+(o-.5*C.gripWidth)+","+e.currentValueTotalHeight+")")}}function m(t,e){return t.inputAreaStart+C.stepInset+(t.inputAreaLength-2*C.stepInset)*Math.min(1,Math.max(0,e))}function y(t,e){return Math.min(1,Math.max(0,(e-C.stepInset-t.inputAreaStart)/(t.inputAreaLength-2*C.stepInset-2*t.inputAreaStart)))}function x(t,e,n){var r=t.selectAll("rect."+C.railTouchRectClass).data([0]);r.enter().append("rect").classed(C.railTouchRectClass,!0).call(h,e,t,n).style("pointer-events","all"),r.attr({width:n.inputAreaLength,height:Math.max(n.inputAreaWidth,C.tickOffset+n.ticklen+n.labelHeight)}).call(M.fill,n.bgcolor).attr("opacity",0),A.setTranslate(r,0,n.currentValueTotalHeight)}function b(t,e){var n=t.selectAll("rect."+C.railRectClass).data([0]);n.enter().append("rect").classed(C.railRectClass,!0);var r=e.inputAreaLength-2*C.railInset;n.attr({width:r,height:C.railWidth,rx:C.railRadius,ry:C.railRadius,"shape-rendering":"crispEdges"}).call(M.stroke,e.bordercolor).call(M.fill,e.bgcolor).style("stroke-width",e.borderwidth+"px"),A.setTranslate(n,C.railInset,.5*(e.inputAreaWidth-C.railWidth)+e.currentValueTotalHeight)}function _(t){for(var e=t._fullLayout._pushmargin||{},n=Object.keys(e),r=0;r0?[0]:[]);if(l.enter().append("g").classed(C.containerClassName,!0).style("cursor","ew-resize"),l.exit().remove(),l.exit().size()&&_(t),0!==n.length){var s=l.selectAll("g."+C.groupClassName).data(n,a);s.enter().append("g").classed(C.groupClassName,!0),s.exit().each(function(e){w.select(this).remove(),e._commandObserver.remove(),delete e._commandObserver,k.autoMargin(t,C.autoMarginIdRoot+e._index)});for(var c=0;c0||d<0){var g={left:[-n,0],right:[n,0],top:[0,-n],bottom:[0,n]}[_.side];e.attr("transform","translate("+g+")")}}}var v,m=n.propContainer,y=n.propName,x=n.traceIndex,b=n.dfltName,_=n.avoid||{},w=n.attributes,k=n.transform,M=n.containerGroup,A=t._fullLayout,T=m.titlefont.family,L=m.titlefont.size,C=m.titlefont.color,S=1,O=!1,z=m.title.trim();"title"===y?v="titleText":-1!==y.indexOf("axis")?v="axisTitleText":y.indexOf(!0)&&(v="colorbarTitleText");var D=t._context.edits[v];""===z&&(S=0),z.match(d)&&(S=.2,O=!0,D||(z=""));var P=z||D;M||(M=A._infolayer.selectAll(".g-"+e).data([0]),M.enter().append("g").classed("g-"+e,!0));var E=M.selectAll("text").data(P?[0]:[]);if(E.enter().append("text"),E.text(z).attr("class",e),E.exit().remove(),P){E.call(h);var N="Click to enter "+b+" title";D&&(z?E.on(".opacity",null):function(){S=0,O=!0,z=N,E.text(z).on("mouseover.opacity",function(){r.select(this).transition().duration(f.SHOW_PLACEHOLDER).style("opacity",1)}).on("mouseout.opacity",function(){r.select(this).transition().duration(f.HIDE_PLACEHOLDER).style("opacity",0)})}(),E.call(u.makeEditable,{gd:t}).on("edit",function(e){void 0!==x?o.restyle(t,y,e,x):o.relayout(t,y,e)}).on("cancel",function(){this.text(this.attr("data-unformatted")).call(h)}).on("input",function(t){this.text(t||" ").call(u.positionText,w.x,w.y)})),E.classed("js-placeholder",O)}}},{"../../constants/interactions":134,"../../lib":150,"../../lib/svg_text_utils":167,"../../plotly":181,"../../plots/plots":215,"../color":37,"../drawing":61,d3:10,"fast-isnumeric":13}],127:[function(t,e,n){"use strict";var r=t("../../plots/font_attributes"),a=t("../color/attributes"),o=t("../../lib/extend").extendFlat,i=t("../../plots/pad_attributes"),l={_isLinkedToArray:"button",method:{valType:"enumerated",values:["restyle","relayout","animate","update","skip"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string",dflt:""},execute:{valType:"boolean",dflt:!0}};e.exports={_isLinkedToArray:"updatemenu",_arrayAttrRegexps:[/^updatemenus\[(0|[1-9][0-9]+)\]\.buttons/],visible:{valType:"boolean"},type:{valType:"enumerated",values:["dropdown","buttons"],dflt:"dropdown"},direction:{valType:"enumerated",values:["left","right","up","down"],dflt:"down"},active:{valType:"integer",min:-1,dflt:0},showactive:{valType:"boolean",dflt:!0},buttons:l,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:"top"},pad:o({},i,{}),font:o({},r,{}),bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:a.borderLine},borderwidth:{valType:"number",min:0,dflt:1}}},{"../../lib/extend":145,"../../plots/font_attributes":210,"../../plots/pad_attributes":214,"../color/attributes":36}],128:[function(t,e,n){"use strict";e.exports={name:"updatemenus",containerClassName:"updatemenu-container",headerGroupClassName:"updatemenu-header-group",headerClassName:"updatemenu-header",headerArrowClassName:"updatemenu-header-arrow",dropdownButtonGroupClassName:"updatemenu-dropdown-button-group",dropdownButtonClassName:"updatemenu-dropdown-button",buttonClassName:"updatemenu-button",itemRectClassName:"updatemenu-item-rect",itemTextClassName:"updatemenu-item-text",menuIndexAttrName:"updatemenu-active-index",autoMarginIdRoot:"updatemenu-",blankHeaderOpts:{label:" "},minWidth:30,minHeight:30,textPadX:24,arrowPadX:16,rx:2,ry:2,textOffsetX:12,textOffsetY:3,arrowOffsetX:4,gapButtonHeader:5,gapButton:2,activeColor:"#F4FAFF",hoverColor:"#F4FAFF",arrowSymbol:{left:"\u25c4",right:"\u25ba",up:"\u25b2",down:"\u25bc"}}},{}],129:[function(t,e,n){"use strict";function r(t,e,n){function r(n,r){return o.coerce(t,e,l,n,r)}r("visible",a(t,e).length>0)&&(r("active"),r("direction"),r("type"),r("showactive"),r("x"),r("y"),o.noneOrAll(t,e,["x","y"]),r("xanchor"),r("yanchor"),r("pad.t"),r("pad.r"),r("pad.b"),r("pad.l"),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,u,t,e)}for(var r,a,i=t.buttons||[],l=e.buttons=[],s=0;s0?[0]:[]);if(o.enter().append("g").classed(S.containerClassName,!0).style("cursor","pointer"),o.exit().remove(),o.exit().size()&&_(t),0!==n.length){var u=o.selectAll("g."+S.headerGroupClassName).data(n,a);u.enter().append("g").classed(S.headerGroupClassName,!0);var f=o.selectAll("g."+S.dropdownButtonGroupClassName).data([0]);f.enter().append("g").classed(S.dropdownButtonGroupClassName,!0).style("pointer-events","all");for(var d=0;dk,T=r.barLength+2*r.barPad,L=r.barWidth+2*r.barPad,C=p,S=v+m;S+L>c&&(S=c-L);var O=this.container.selectAll("rect.scrollbar-horizontal").data(A?[0]:[]);O.exit().on(".drag",null).remove(),O.enter().append("rect").classed("scrollbar-horizontal",!0).call(o.fill,r.barColor),A?(this.hbar=O.attr({rx:r.barRadius,ry:r.barRadius,x:C,y:S,width:T,height:L}),this._hbarXMin=C+T/2,this._hbarTranslateMax=k-T):(delete this.hbar,delete this._hbarXMin,delete this._hbarTranslateMax);var z=m>M,D=r.barWidth+2*r.barPad,P=r.barLength+2*r.barPad,E=p+g,N=v;E+D>s&&(E=s-D);var I=this.container.selectAll("rect.scrollbar-vertical").data(z?[0]:[]);I.exit().on(".drag",null).remove(),I.enter().append("rect").classed("scrollbar-vertical",!0).call(o.fill,r.barColor),z?(this.vbar=I.attr({rx:r.barRadius,ry:r.barRadius,x:E,y:N,width:D,height:P}),this._vbarYMin=N+P/2,this._vbarTranslateMax=M-P):(delete this.vbar,delete this._vbarYMin,delete this._vbarTranslateMax);var R=this.id,F=u-.5,j=z?f+D+.5:f+.5,B=d-.5,q=A?h+L+.5:h+.5,H=l._topdefs.selectAll("#"+R).data(A||z?[0]:[]);if(H.exit().remove(),H.enter().append("clipPath").attr("id",R).append("rect"),A||z?(this._clipRect=H.select("rect").attr({x:Math.floor(F),y:Math.floor(B),width:Math.ceil(j)-Math.floor(F),height:Math.ceil(q)-Math.floor(B)}),this.container.call(i.setClipUrl,R),this.bg.attr({x:p,y:v,width:g,height:m})):(this.bg.attr({width:0,height:0}),this.container.on("wheel",null).on(".drag",null).call(i.setClipUrl,null),delete this._clipRect),A||z){var V=a.behavior.drag().on("dragstart",function(){a.event.sourceEvent.preventDefault()}).on("drag",this._onBoxDrag.bind(this));this.container.on("wheel",null).on("wheel",this._onBoxWheel.bind(this)).on(".drag",null).call(V);var U=a.behavior.drag().on("dragstart",function(){a.event.sourceEvent.preventDefault(),a.event.sourceEvent.stopPropagation()}).on("drag",this._onBarDrag.bind(this));A&&this.hbar.on(".drag",null).call(U),z&&this.vbar.on(".drag",null).call(U)}this.setTranslate(e,n)},r.prototype.disable=function(){(this.hbar||this.vbar)&&(this.bg.attr({width:0,height:0}),this.container.on("wheel",null).on(".drag",null).call(i.setClipUrl,null),delete this._clipRect),this.hbar&&(this.hbar.on(".drag",null),this.hbar.remove(),delete this.hbar,delete this._hbarXMin,delete this._hbarTranslateMax),this.vbar&&(this.vbar.on(".drag",null),this.vbar.remove(),delete this.vbar,delete this._vbarYMin,delete this._vbarTranslateMax)},r.prototype._onBoxDrag=function(){var t=this.translateX,e=this.translateY;this.hbar&&(t-=a.event.dx),this.vbar&&(e-=a.event.dy),this.setTranslate(t,e)},r.prototype._onBoxWheel=function(){var t=this.translateX,e=this.translateY;this.hbar&&(t+=a.event.deltaY),this.vbar&&(e+=a.event.deltaY),this.setTranslate(t,e)},r.prototype._onBarDrag=function(){var t=this.translateX,e=this.translateY;if(this.hbar){var n=t+this._hbarXMin,r=n+this._hbarTranslateMax;t=(l.constrain(a.event.x,n,r)-n)/(r-n)*(this.position.w-this._box.w)}if(this.vbar){var o=e+this._vbarYMin,i=o+this._vbarTranslateMax;e=(l.constrain(a.event.y,o,i)-o)/(i-o)*(this.position.h-this._box.h)}this.setTranslate(t,e)},r.prototype.setTranslate=function(t,e){var n=this.position.w-this._box.w,r=this.position.h-this._box.h;if(t=l.constrain(t||0,0,n),e=l.constrain(e||0,0,r),this.translateX=t,this.translateY=e,this.container.call(i.setTranslate,this._box.l-this.position.l-t,this._box.t-this.position.t-e),this._clipRect&&this._clipRect.attr({x:Math.floor(this.position.l+t-.5),y:Math.floor(this.position.t+e-.5)}),this.hbar){var a=t/n;this.hbar.call(i.setTranslate,t+a*this._hbarTranslateMax,e)}if(this.vbar){var o=e/r;this.vbar.call(i.setTranslate,t,e+o*this._vbarTranslateMax)}}},{"../../lib":150,"../color":37,"../drawing":61,d3:10}],133:[function(t,e,n){"use strict";e.exports={FROM_BL:{left:0,center:.5,right:1,bottom:0,middle:.5,top:1},FROM_TL:{left:0,center:.5,right:1,bottom:1,middle:.5,top:0},LINE_SPACING:1.3,MID_SHIFT:.35}},{}],134:[function(t,e,n){"use strict";e.exports={SHOW_PLACEHOLDER:100,HIDE_PLACEHOLDER:1e3,DBLCLICKDELAY:300,DESELECTDIM:.2}},{}],135:[function(t,e,n){"use strict";e.exports={BADNUM:void 0,FP_SAFE:Number.MAX_VALUE/1e4,ONEAVGYEAR:315576e5,ONEAVGMONTH:26298e5,ONEDAY:864e5,ONEHOUR:36e5,ONEMIN:6e4,ONESEC:1e3,EPOCHJD:2440587.5,ALMOST_EQUAL:1-1e-6}},{}],136:[function(t,e,n){"use strict";e.exports={entityToUnicode:{mu:"\u03bc","#956":"\u03bc",amp:"&","#28":"&",lt:"<","#60":"<",gt:">","#62":">",nbsp:"\xa0","#160":"\xa0",times:"\xd7","#215":"\xd7",plusmn:"\xb1","#177":"\xb1",deg:"\xb0","#176":"\xb0"}}},{}],137:[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}},{}],138:[function(t,e,n){"use strict";var r=t("./plotly");n.version="1.29.2",t("es6-promise").polyfill(),t("../build/plotcss"),t("./fonts/mathjax_config"),n.plot=r.plot,n.newPlot=r.newPlot,n.restyle=r.restyle,n.relayout=r.relayout,n.redraw=r.redraw,n.update=r.update,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=t("./plot_api/register"),n.toImage=t("./plot_api/to_image"),n.downloadImage=t("./snapshot/download"),n.validate=t("./plot_api/validate"),n.addFrames=r.addFrames,n.deleteFrames=r.deleteFrames,n.animate=r.animate,n.register(t("./traces/scatter")),n.register([t("./components/fx"),t("./components/legend"),t("./components/annotations"),t("./components/annotations3d"),t("./components/shapes"),t("./components/images"),t("./components/updatemenus"),t("./components/sliders"),t("./components/rangeslider"),t("./components/rangeselector")]),n.Icons=t("../build/ploticon"),n.Plots=r.Plots,n.Fx=t("./components/fx"),n.Snapshot=t("./snapshot"),n.PlotSchema=t("./plot_api/plot_schema"),n.Queue=t("./lib/queue"),n.d3=t("d3")},{"../build/plotcss":1,"../build/ploticon":2,"./components/annotations":30,"./components/annotations3d":35,"./components/fx":78,"./components/images":86,"./components/legend":94,"./components/rangeselector":106,"./components/rangeslider":112,"./components/shapes":119,"./components/sliders":125,"./components/updatemenus":131,"./fonts/mathjax_config":139,"./lib/queue":162,"./plot_api/plot_schema":175,"./plot_api/register":176,"./plot_api/set_plot_config":177,"./plot_api/to_image":179,"./plot_api/validate":180,"./plotly":181,"./snapshot":227,"./snapshot/download":224,"./traces/scatter":296,d3:10,"es6-promise":11}],139:[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},{}],140:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("../constants/numerical").BADNUM,o=/^['"%,$#\s']+|[, ]|['"%,$#\s']+$/g;e.exports=function(t){return"string"==typeof t&&(t=t.replace(o,"")),r(t)?Number(t):a}},{"../constants/numerical":135,"fast-isnumeric":13}],141:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("tinycolor2"),o=t("../plots/attributes"),i=t("../components/colorscale/get_scale"),l=(Object.keys(t("../components/colorscale/scales")),t("./nested_property")),s=/^([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)},validateFunction:function(t,e){e.coerceNumber&&(t=+t);for(var n=e.values,r=0;ra.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;!0!==r.strict&&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;if("string"==typeof t&&t.substr(0,r)===n&&s.test(t.substr(r)))return void e.set(t);e.set(n)},validateFunction:function(t,e){var n=e.dflt,r=n.length;return t===n||"string"==typeof t&&!(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 a=t.split("+"),o=0;o0&&(i=i.replace(/0+$/,"").replace(/[\.]$/,"")),r+=":"+i}return r}function s(t){return t.formatDate("yyyy")}function c(t){return t.formatDate("M yyyy")}function u(t){return t.formatDate("M d")}function f(t){return t.formatDate("M d, yyyy")}var d=t("d3"),h=t("fast-isnumeric"),p=t("./loggers").error,g=t("./mod"),v=t("../constants/numerical"),m=v.BADNUM,y=v.ONEDAY,x=v.ONEHOUR,b=v.ONEMIN,_=v.ONESEC,w=v.EPOCHJD,k=t("../registry"),M=d.time.format.utc,A=/^\s*(-?\d\d\d\d|\d\d)(-(\d?\d)(-(\d?\d)([ Tt]([01]?\d|2[0-3])(:([0-5]\d)(:([0-5]\d(\.\d+)?))?(Z|z|[+\-]\d\d:?\d\d)?)?)?)?)?\s*$/m,T=/^\s*(-?\d\d\d\d|\d\d)(-(\d?\di?)(-(\d?\d)([ Tt]([01]?\d|2[0-3])(:([0-5]\d)(:([0-5]\d(\.\d+)?))?(Z|z|[+\-]\d\d:?\d\d)?)?)?)?)?\s*$/m,L=(new Date).getFullYear()-70;n.dateTick0=function(t,e){return r(t)?e?k.getComponentMethod("calendars","CANONICAL_SUNDAY")[t]:k.getComponentMethod("calendars","CANONICAL_TICK")[t]:e?"2000-01-02":"2000-01-01"},n.dfltRange=function(t){return r(t)?k.getComponentMethod("calendars","DFLTRANGE")[t]:["2000-01-01","2001-01-01"]},n.isJSDate=function(t){return"object"==typeof t&&null!==t&&"function"==typeof t.getTime};var C,S;n.dateTime2ms=function(t,e){if(n.isJSDate(t))return t=Number(t)-t.getTimezoneOffset()*b,t>=C&&t<=S?t:m;if("string"!=typeof t&&"number"!=typeof t)return m;t=String(t);var a=r(e),o=t.charAt(0);!a||"G"!==o&&"g"!==o||(t=t.substr(1),e="");var i=a&&"chinese"===e.substr(0,7),l=t.match(i?T:A);if(!l)return m;var s=l[1],c=l[3]||"1",u=Number(l[5]||1),f=Number(l[7]||0),d=Number(l[9]||0),h=Number(l[11]||0);if(a){if(2===s.length)return m;s=Number(s);var p;try{var g=k.getComponentMethod("calendars","getCal")(e);if(i){var v="i"===c.charAt(c.length-1);c=parseInt(c,10),p=g.newDate(s,g.toMonthIndex(s,c,v),u)}else p=g.newDate(s,Number(c),u)}catch(t){return m}return p?(p.toJD()-w)*y+f*x+d*b+h*_:m}s=2===s.length?(Number(s)+2e3-L)%100+L:Number(s),c-=1;var M=new Date(Date.UTC(2e3,c,u,f,d));return M.setUTCFullYear(s),M.getUTCMonth()!==c?m:M.getUTCDate()!==u?m:M.getTime()+h*_},C=n.MIN_MS=n.dateTime2ms("-9999"),S=n.MAX_MS=n.dateTime2ms("9999-12-31 23:59:59.9999"),n.isDateTime=function(t,e){return n.dateTime2ms(t,e)!==m};var O=90*y,z=3*x,D=5*b;n.ms2DateTime=function(t,e,n){if("number"!=typeof t||!(t>=C&&t<=S))return m;e||(e=0);var a,i,l,s,c,u,f=Math.floor(10*g(t+.05,1)),d=Math.round(t-f/10);if(r(n)){var h=Math.floor(d/y)+w,p=Math.floor(g(t,y));try{a=k.getComponentMethod("calendars","getCal")(n).fromJD(h).formatDate("yyyy-mm-dd")}catch(t){a=M("G%Y-%m-%d")(new Date(d))}if("-"===a.charAt(0))for(;a.length<11;)a="-0"+a.substr(1);else for(;a.length<10;)a="0"+a;i=e=C+y&&t<=S-y))return m;var e=Math.floor(10*g(t+.05,1)),n=new Date(Math.round(t-e/10));return o(d.time.format("%Y-%m-%d")(n),n.getHours(),n.getMinutes(),n.getSeconds(),10*n.getUTCMilliseconds()+e)},n.cleanDate=function(t,e,a){if(n.isJSDate(t)||"number"==typeof t){if(r(a))return p("JS Dates and milliseconds are incompatible with world calendars",t),e;if(!(t=n.ms2DateTimeLocal(+t))&&void 0!==e)return e}else if(!n.isDateTime(t,a))return p("unrecognized date",t),e;return t};var P=/%\d?f/g,E=[59,59.9,59.99,59.999,59.9999],N=M("%Y"),I=M("%b %Y"),R=M("%b %-d"),F=M("%b %-d, %Y");n.formatDate=function(t,e,n,a){var o,d;if(a=r(a)&&a,e)return i(e,t,a);if(a)try{var h=Math.floor((t+.05)/y)+w,p=k.getComponentMethod("calendars","getCal")(a).fromJD(h);"y"===n?d=s(p):"m"===n?d=c(p):"d"===n?(o=s(p),d=u(p)):(o=f(p),d=l(t,n))}catch(t){return"Invalid"}else{var g=new Date(Math.floor(t+.05));"y"===n?d=N(g):"m"===n?d=I(g):"d"===n?(o=N(g),d=R(g)):(o=F(g),d=l(t,n))}return d+(o?"\n"+o:"")};var j=3*y;n.incrementMonth=function(t,e,n){n=r(n)&&n;var a=g(t,y);if(t=Math.round(t-a),n)try{var o=Math.round(t/y)+w,i=k.getComponentMethod("calendars","getCal")(n),l=i.fromJD(o);return e%12?i.add(l,e,"m"):i.add(l,e/12,"y"),(l.toJD()-w)*y+a}catch(e){p("invalid ms "+t+" in calendar "+n)}var s=new Date(t+j);return s.setUTCMonth(s.getUTCMonth()+e)+a-j},n.findExactDates=function(t,e){for(var n,a,o=0,i=0,l=0,s=0,c=r(e)&&k.getComponentMethod("calendars","getCal")(e),u=0;u1||g<0||g>1?null:{x:t+s*g,y:e+f*g}}function a(t,e,n,r,a){var o=r*t+a*e;if(o<0)return r*r+a*a;if(o>n){var i=r-t,l=a-e;return i*i+l*l}var s=r*e-a*t;return s*s/n}var o=t("./mod");n.segmentsIntersect=r,n.segmentDistance=function(t,e,n,o,i,l,s,c){if(r(t,e,n,o,i,l,s,c))return 0;var u=n-t,f=o-e,d=s-i,h=c-l,p=u*u+f*f,g=d*d+h*h,v=Math.min(a(u,f,p,i-t,l-e),a(u,f,p,s-t,c-e),a(d,h,g,t-i,e-l),a(d,h,g,n-i,o-l));return Math.sqrt(v)};var i,l,s;n.getTextLocation=function(t,e,n,r){if(t===l&&r===s||(i={},l=t,s=r),i[n])return i[n];var a=t.getPointAtLength(o(n-r/2,e)),c=t.getPointAtLength(o(n+r/2,e)),u=Math.atan((c.y-a.y)/(c.x-a.x)),f=t.getPointAtLength(o(n,e)),d=(4*f.x+a.x+c.x)/6,h=(4*f.y+a.y+c.y)/6,p={x:d,y:h,theta:u};return i[n]=p,p},n.clearLocationCache=function(){l=null},n.getVisibleSegment=function(t,e,n){function r(e){var n=t.getPointAtLength(e);0===e?a=n:e===f&&(o=n);var r=n.xl?n.x-l:0,u=n.yc?n.y-c:0;return Math.sqrt(r*r+u*u)}for(var a,o,i=e.left,l=e.right,s=e.top,c=e.bottom,u=0,f=t.getTotalLength(),d=f,h=r(u);h;){if((u+=h+n)>d)return;h=r(u)}for(h=r(d);h;){if(d-=h+n,u>d)return;h=r(d)}return{min:u,max:d,len:d-u,total:f,isClosed:0===u&&d===f&&Math.abs(a.x-o.x)<.1&&Math.abs(a.y-o.y)<.1}}},{"./mod":155}],149:[function(t,e,n){"use strict";e.exports=function(t){return t}},{}],150:[function(t,e,n){"use strict";var r=t("d3"),a=t("fast-isnumeric"),o=t("../constants/numerical"),i=o.FP_SAFE,l=o.BADNUM,s=e.exports={};s.nestedProperty=t("./nested_property"),s.isPlainObject=t("./is_plain_object"),s.isArray=t("./is_array"),s.mod=t("./mod"),s.toLogRange=t("./to_log_range"),s.relinkPrivateKeys=t("./relink_private"),s.ensureArray=t("./ensure_array");var c=t("./coerce");s.valObjects=c.valObjects,s.coerce=c.coerce,s.coerce2=c.coerce2,s.coerceFont=c.coerceFont,s.coerceHoverinfo=c.coerceHoverinfo,s.validate=c.validate;var u=t("./dates");s.dateTime2ms=u.dateTime2ms,s.isDateTime=u.isDateTime,s.ms2DateTime=u.ms2DateTime,s.ms2DateTimeLocal=u.ms2DateTimeLocal,s.cleanDate=u.cleanDate,s.isJSDate=u.isJSDate,s.formatDate=u.formatDate,s.incrementMonth=u.incrementMonth,s.dateTick0=u.dateTick0,s.dfltRange=u.dfltRange,s.findExactDates=u.findExactDates,s.MIN_MS=u.MIN_MS,s.MAX_MS=u.MAX_MS;var f=t("./search");s.findBin=f.findBin,s.sorterAsc=f.sorterAsc,s.sorterDes=f.sorterDes,s.distinctVals=f.distinctVals,s.roundUp=f.roundUp;var d=t("./stats");s.aggNums=d.aggNums,s.len=d.len,s.mean=d.mean,s.variance=d.variance,s.stdev=d.stdev,s.interp=d.interp;var h=t("./matrix");s.init2dArray=h.init2dArray,s.transposeRagged=h.transposeRagged,s.dot=h.dot,s.translationMatrix=h.translationMatrix,s.rotationMatrix=h.rotationMatrix,s.rotationXYMatrix=h.rotationXYMatrix,s.apply2DTransform=h.apply2DTransform,s.apply2DTransform2=h.apply2DTransform2;var p=t("./geometry2d");s.segmentsIntersect=p.segmentsIntersect,s.segmentDistance=p.segmentDistance,s.getTextLocation=p.getTextLocation,s.clearLocationCache=p.clearLocationCache,s.getVisibleSegment=p.getVisibleSegment;var g=t("./extend");s.extendFlat=g.extendFlat,s.extendDeep=g.extendDeep,s.extendDeepAll=g.extendDeepAll,s.extendDeepNoArrays=g.extendDeepNoArrays;var v=t("./loggers");s.log=v.log,s.warn=v.warn,s.error=v.error,s.notifier=t("./notifier"),s.filterUnique=t("./filter_unique"),s.filterVisible=t("./filter_visible"),s.pushUnique=t("./push_unique"),s.cleanNumber=t("./clean_number"),s.ensureNumber=function(t){return a(t)?(t=Number(t),t<-i||t>i?l:a(t)?Number(t):l):l},s.noop=t("./noop"),s.identity=t("./identity"),s.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))},s.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},s.simpleMap=function(t,e,n,r){for(var a=t.length,o=new Array(a),i=0;i-1||u!==1/0&&u>=Math.pow(2,n)?t(e,n,r):s},s.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},s.smooth=function(t,e){if((e=Math.round(e)||0)<2)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;n=l&&(a-=l*Math.floor(a/l)),a<0?a=-1-a:a>=i&&(a=l-1-a),o+=t[a]*c[r];u[n]=o}return u},s.syncOrAsync=function(t,e,n){function r(){return s.syncOrAsync(t,e,n)}for(var a,o;t.length;)if(o=t.splice(0,1)[0],(a=o(e))&&a.then)return a.then(r).then(void 0,s.promiseError);return n&&n(e)},s.stripTrailingSlash=function(t){return"/"===t.substr(-1)?t.substr(0,t.length-1):t},s.noneOrAll=function(t,e,n){if(t){var r,a,o=!1,i=!0;for(r=0;r1?a+i[1]:"";if(o&&(i.length>1||l.length>4||n))for(;r.test(l);)l=l.replace(r,"$1"+o+"$2");return l+s}},{"../constants/numerical":135,"./clean_number":140,"./coerce":141,"./dates":142,"./ensure_array":143,"./extend":145,"./filter_unique":146,"./filter_visible":147,"./geometry2d":148,"./identity":149,"./is_array":151,"./is_plain_object":152,"./loggers":153,"./matrix":154,"./mod":155,"./nested_property":156,"./noop":157,"./notifier":158,"./push_unique":161,"./relink_private":163,"./search":164,"./stats":166,"./to_log_range":168,d3:10,"fast-isnumeric":13}],151:[function(t,e,n){"use strict";var r="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer:{isView:function(){return!1}};e.exports=function(t){return Array.isArray(t)||r.isView(t)}},{}],152:[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}},{}],153:[function(t,e,n){"use strict";function r(t,e){if(t.apply)t.apply(t,e);else for(var n=0;n1){for(var t=["LOG:"],e=0;e0){for(var t=["WARN:"],e=0;e0){for(var t=["ERROR:"],e=0;e=0;e--){if(r=t[e][0],o=t[e][1],s=!1,h(r))for(n=r.length-1;n>=0;n--)a(r[n],i(o,n))?s?r[n]=void 0:r.pop():s=!0;else if("object"==typeof r&&null!==r)for(l=Object.keys(r),s=!1,n=l.length-1;n>=0;n--)a(r[l[n]],i(o,l[n]))?delete r[l[n]]:s=!0;if(s)return}}function u(t){return void 0===t||null===t||"object"==typeof t&&(h(t)?!t.length:!Object.keys(t).length)}function f(t,e,n){return{set:function(){throw"bad container"},get:function(){},astr:e,parts:n,obj:t}}var d=t("fast-isnumeric"),h=t("./is_array"),p=t("./is_plain_object"),g=t("../plot_api/container_array_match");e.exports=function(t,e){if(d(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(".");l/g),l=0;li||r===a||rs)&&(!e||!u(t))}function n(t,e){var n=t[0],c=t[1];if(n===a||ni||c===a||cs)return!1;var u,f,d,h,p,g=r.length,v=r[0][0],m=r[0][1],y=0;for(u=1;uMath.max(f,v)||c>Math.max(d,m)))if(cu||Math.abs(r(i,d))>a)return!0;return!1};o.filter=function(t,e){function n(n){t.push(n);var l=r.length,s=a;r.splice(o+1);for(var c=s+1;c1){n(t.pop())}return{addPt:n,raw:t,filtered:r}}},{"../constants/numerical":135,"./matrix":154}],161:[function(t,e,n){"use strict";e.exports=function(t,e){if(e instanceof RegExp){var n,r=e.toString();for(n=0;no.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;ne}function i(t,e){return t>=e}var l=t("fast-isnumeric"),s=t("./loggers");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;f90&&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;le[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;at.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":13}],167:[function(t,e,n){"use strict";function r(t,e){return t.node().getBoundingClientRect()[e]}function a(t){return t.replace(m,"\\lt ").replace(y,"\\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){if(!t)return null;var n=t.match(e);return n&&(n[3]||n[4])}function l(t,e){if(!t)return"";for(var n=0;n1)for(var a=1;a doesnt match end tag <"+t+">. Pretending it did match.",e),o=c[c.length-1].node}(M);else{var N=y[4],I={type:M},R=i(N,O);if(R?(R=R.replace(E,"$1 fill:"),A&&(R+=";"+A)):A&&(R=A),R&&(I.style=R),"a"===M){l=!0;var F=i(N,z);if(F){var j=document.createElement("a") ;j.href=F,-1!==k.indexOf(j.protocol)&&(I.href=encodeURI(F),I.target=i(N,D)||"_blank",I.popup=i(N,P))}}r(I)}}return l}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"),g=t("../constants/alignment").LINE_SPACING,v=/([^$]*)([$]+[^$]*[$]+)([^$]*)/;n.convertToTspans=function(t,e,a){function i(){u.empty()||(d=t.attr("class")+"-math",u.select("svg."+d).remove()),t.text("").style("white-space","pre"),c(t.node(),l)&&t.style("pointer-events","all"),n.positionText(t),a&&a.call(t)}var l=t.text(),s=!t.attr("data-notex")&&"undefined"!=typeof MathJax&&l.match(v),u=f.select(t.node().parentNode);if(!u.empty()){var d=t.attr("class")?t.attr("class").split(" ")[0]:"text";return d+="-math",u.selectAll("svg."+d).remove(),u.selectAll("g."+d+"-group").remove(),t.style("display",null).attr({"data-unformatted":l,"data-math":"N"}),s?(e&&e._promises||[]).push(new Promise(function(e){t.style("display","none");var n={fontSize:parseInt(t.style("font-size"),10)};o(s[2],n,function(n,o,s){u.selectAll("svg."+d).remove(),u.selectAll("g."+d+"-group").remove();var c=n&&n.select("svg");if(!c||!c.node())return i(),void e();var f=u.append("g").classed(d+"-group",!0).attr({"pointer-events":"none","data-unformatted":l,"data-math":"Y"});f.node().appendChild(c.node()),o&&o.node()&&c.node().insertBefore(o.node().cloneNode(!0),c.node().firstChild),c.attr({class:d,height:s.height,preserveAspectRatio:"xMinYMin meet"}).style({overflow:"visible","pointer-events":"none"});var h=t.style("fill")||"black";c.select("g").attr({fill:h,stroke:h});var p=r(c,"width"),g=r(c,"height"),v=+t.attr("x")-p*{start:0,middle:.5,end:1}[t.attr("text-anchor")||"start"],m=parseInt(t.style("font-size"),10)||r(t,"height"),y=-m/4;"y"===d[0]?(f.attr({transform:"rotate("+[-90,+t.attr("x"),+t.attr("y")]+") translate("+[-p/2,y-g/2]+")"}),c.attr({x:+t.attr("x"),y:+t.attr("y")})):"l"===d[0]?c.attr({x:t.attr("x"),y:y-g/2}):"a"===d[0]?c.attr({x:0,y:y}):c.attr({x:v,y:+t.attr("y")+y-g/2}),a&&a.call(t,f),e(f)})})):i(),t}};var m=/(<|<|<)/g,y=/(>|>|>)/g,x={sup:"font-size:70%",sub:"font-size:70%",b:"font-weight:bold",i:"font-style:italic",a:"cursor:pointer",span:"",em:"font-style:italic;font-weight:bold"},b={sub:"0.3em",sup:"-0.6em"},_={sub:"-0.21em",sup:"0.42em"},w="\u200b",k=["http:","https:","mailto:","",void 0,":"],M=new RegExp("]*)?/?>","g"),A=Object.keys(p.entityToUnicode).map(function(t){return{regExp:new RegExp("&"+t+";","g"),sub:p.entityToUnicode[t]}}),T=/(\r\n?|\n)/g,L=/(<[^<>]*>)/,C=/<(\/?)([^ >]*)(\s+(.*))?>/i,S=//i,O=/(^|[\s"'])style\s*=\s*("([^"]*);?"|'([^']*);?')/i,z=/(^|[\s"'])href\s*=\s*("([^"]*)"|'([^']*)')/i,D=/(^|[\s"'])target\s*=\s*("([^"\s]*)"|'([^'\s]*)')/i,P=/(^|[\s"'])popup\s*=\s*("([\w=,]*)"|'([\w=,]*)')/i,E=/(^|;)\s*color:/;n.plainText=function(t){return(t||"").replace(M," ")},n.lineCount=function(t){return t.selectAll("tspan.line").size()||1},n.positionText=function(t,e,n){return t.each(function(){function t(t,e){return void 0===e?null===(e=r.attr(t))&&(r.attr(t,0),e=0):r.attr(t,e),e}var r=f.select(this),a=t("x",e),o=t("y",n);"text"===this.nodeName&&r.selectAll("tspan.line").attr({x:a,y:o})})},n.makeEditable=function(t,e){function n(){a(),t.style({opacity:0});var e,n=s.attr("class");(e=n?"."+n.split(" ")[0]+"-math-group":"[class*=-math-group]")&&f.select(t.node().parentNode).select(e).style({opacity:0})}function r(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 n=f.select(o),a=n.select(".svg-container"),i=a.append("div");i.classed("plugin-editable editable",!0).style({position:"absolute","font-family":t.style("font-family")||"Arial","font-size":t.style("font-size")||12,color:e.fill||t.style("fill")||"black",opacity:1,"background-color":e.background||"transparent",outline:"#ffffff33 1px solid",margin:[-parseFloat(t.style("font-size"))/8+1,0,0,-1].join("px ")+"px",padding:"0","box-sizing":"border-box"}).attr({contenteditable:!0}).text(e.text||t.attr("data-unformatted")).call(u(t,a,e)).on("blur",function(){o._editing=!1,t.text(this.textContent).style({opacity:1});var e,n=f.select(this).attr("class");(e=n?"."+n.split(" ")[0]+"-math-group":"[class*=-math-group]")&&f.select(t.node().parentNode).select(e).style({opacity:0});var r=this.textContent;f.select(this).transition().duration(0).remove(),f.select(document).on("mouseup",null),l.edit.call(t,r)}).on("focus",function(){var t=this;o._editing=!0,f.select(document).on("mouseup",function(){if(f.event.target===t)return!1;document.activeElement===i.node()&&i.node().blur()})}).on("keyup",function(){27===f.event.which?(o._editing=!1,t.style({opacity:1}),f.select(this).style({opacity:0}).on("blur",function(){return!1}).transition().remove(),l.cancel.call(t,this.textContent)):(l.input.call(t,this.textContent),f.select(this).call(u(t,a,e)))}).on("keydown",function(){13===f.event.which&&this.blur()}).call(r)}var o=e.gd,i=e.delegate,l=f.dispatch("edit","input","cancel"),s=i||t;if(t.style({"pointer-events":i?"none":"all"}),1!==t.size())throw new Error("boo");return e.immediate?n():s.on("click",n),f.rebind(t,l,"on")}},{"../constants/alignment":133,"../constants/string_mappings":136,"../constants/xmlns_namespaces":137,"../lib":150,d3:10}],168:[function(t,e,n){"use strict";var r=t("fast-isnumeric");e.exports=function(t,e){if(t>0)return Math.log(t)/Math.LN10;var n=Math.log(Math.min(e[0],e[1]))/Math.LN10;return r(n)||(n=Math.log(Math.max(e[0],e[1]))/Math.LN10-6),n}},{"fast-isnumeric":13}],169:[function(t,e,n){"use strict";var r=t("../registry");e.exports=function(t){for(var e,n,a=r.layoutArrayContainers,o=r.layoutArrayRegexes,i=t.split("[")[0],l=0;l0)return t.substr(0,e)}var l=t("fast-isnumeric"),s=t("gl-mat4/fromQuat"),c=t("../registry"),u=t("../lib"),f=t("../plots/plots"),d=t("../plots/cartesian/axes"),h=t("../components/color");n.getGraphDiv=function(t){var e;if("string"==typeof t){if(null===(e=document.getElementById(t)))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},n.clearPromiseQueue=function(t){Array.isArray(t._promises)&&t._promises.length>0&&u.log("Clearing previous rejected promises from queue."),t._promises=[]},n.cleanLayout=function(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 a=d.list({_fullLayout:t});for(e=0;e3?(v.x=1.02,v.xanchor="left"):v.x<-2&&(v.x=-.02,v.xanchor="right"),v.y>3?(v.y=1.02,v.yanchor="bottom"):v.y<-2&&(v.y=-.02,v.yanchor="top")),"rotate"===t.dragmode&&(t.dragmode="orbit"),t.scene1&&(t.scene||(t.scene=t.scene1),delete t.scene1);var m=f.getSubplotIds(t,"gl3d");for(e=0;e1&&i.warn("Full array edits are incompatible with other edits",f);var y=n[""][""];if(u(y))e.set(null);else{if(!Array.isArray(y))return i.warn("Unrecognized full array edit value",f,y),!0;e.set(y)}return!g&&(d(v,m),h(t),!0)}var x,b,_,w,k,M,A,T=Object.keys(n).map(Number).sort(l),L=e.get(),C=L||[],S=r(m,f).get(),O=[],z=-1,D=C.length;for(x=0;xC.length-(A?0:1))i.warn("index out of range",f,_);else if(void 0!==M)k.length>1&&i.warn("Insertion & removal are incompatible with edits to the same index.",f,_),u(M)?O.push(_):A?("add"===M&&(M={}),C.splice(_,0,M),S&&S.splice(_,0,{})):i.warn("Unrecognized full object edit value",f,_,M),-1===z&&(z=_);else for(b=0;b=0;x--)C.splice(O[x],1),S&&S.splice(O[x],1);if(C.length?L||e.set(C):e.set(null),g)return!1;if(d(v,m),p!==o){var P;if(-1===z)P=T;else{for(D=Math.max(C.length,D),P=[],x=0;x=z);x++)P.push(_);for(x=z;x=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||a<0&&e.indexOf(t.data.length+a)>-1)throw new Error("each index in "+n+" must be unique.")}}function s(t,e,n){if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if(void 0===e)throw new Error("currentIndices is a required argument.");if(Array.isArray(e)||(e=[e]),l(t,e,"currentIndices"),void 0===n||Array.isArray(n)||(n=[n]),void 0!==n&&l(t,n,"newIndices"),void 0!==n&&e.length!==n.length)throw new Error("current and new indices must be of equal length.")}function c(t,e,n){var r,a;if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if(void 0===e)throw new Error("traces must be defined.");for(Array.isArray(e)||(e=[e]),r=0;r=0&&sV.range[0]?[1,2]:[2,1]);else{var X=V.range[0],Y=V.range[1];U?(X<=0&&Y<=0&&n(R+".autorange",!0),X<=0?X=Y/1e6:Y<=0&&(Y=X/1e6),n(R+".range[0]",Math.log(X)/Math.LN10),n(R+".range[1]",Math.log(Y)/Math.LN10)):(n(R+".range[0]",Math.pow(10,X)),n(R+".range[1]",Math.pow(10,Y)))}else n(R+".autorange",!0);k.getComponentMethod("annotations","convertCoords")(t,B,L,n),k.getComponentMethod("images","convertCoords")(t,B,L,n)}else n(R+".autorange",!0);b.nestedProperty(c,R+"._inputRange").set(null)}else if(P.match(N.AX_NAME_PATTERN)){var Z=b.nestedProperty(c,A).get(),W=(L||{}).type;W&&"-"!==W||(W="linear"),k.getComponentMethod("annotations","convertCoords")(t,Z,W,n),k.getComponentMethod("images","convertCoords")(t,Z,W,n)}var $=z.containerArrayMatch(A);if($){o=$.array,i=$.index ;var Q=$.property,J=b.nestedProperty(s,o),K=(J||[])[i]||{};if(""===i)-1===A.indexOf("updatemenus")&&(m.docalc=!0);else if(""===Q){var tt=L;z.isAddVal(L)?_[A]=null:z.isRemoveVal(L)?(_[A]=K,tt=K):b.warn("unrecognized full object value",e),(r(tt,"x")||r(tt,"y")&&-1===A.indexOf("updatemenus"))&&(m.docalc=!0)}else!r(K,"x")&&!r(K,"y")||b.containsAny(A,["color","opacity","align","dash","updatemenus"])||(m.docalc=!0);d[o]||(d[o]={});var et=d[o][i];et||(et=d[o][i]={}),et[Q]=L,delete e[A]}else if("reverse"===P)F.range?F.range.reverse():(n(R+".autorange",!0),F.range=[1,0]),B.autorange?m.docalc=!0:m.doplot=!0;else{var nt=String(T.parts[1]||"");0===O.indexOf("scene")?"camera"===T.parts[1]?m.docamera=!0:m.doplot=!0:0===O.indexOf("geo")?m.doplot=!0:0===O.indexOf("ternary")?m.doplot=!0:"paper_bgcolor"===A?m.doplot=!0:"margin"===O||"autorange"===nt||"rangemode"===nt||"type"===nt||"domain"===nt||"fixedrange"===nt||"scaleanchor"===nt||"scaleratio"===nt||-1!==A.indexOf("calendar")||A.match(/^(bar|box|font)/)?m.docalc=!0:!c._has("gl2d")||-1===A.indexOf("axis")&&"plot_bgcolor"!==A?!c._has("gl2d")||"dragmode"!==A||"lasso"!==L&&"select"!==L||"lasso"===q||"select"===q?"hiddenlabels"===A?m.docalc=!0:-1!==O.indexOf("legend")?m.dolegend=!0:-1!==A.indexOf("title")?m.doticks=!0:-1!==O.indexOf("bgcolor")?m.dolayoutstyle=!0:C>1&&b.containsAny(nt,["tick","exponent","grid","zeroline"])?m.doticks=!0:-1!==A.indexOf(".linewidth")&&-1!==A.indexOf("axis")?m.doticks=m.dolayoutstyle=!0:C>1&&-1!==nt.indexOf("line")?m.dolayoutstyle=!0:C>1&&"mirror"===nt?m.doticks=m.dolayoutstyle=!0:"margin.pad"===A?m.doticks=m.dolayoutstyle=!0:-1!==["hovermode","dragmode"].indexOf(A)||-1!==A.indexOf("spike")?m.domodebar=!0:-1===["height","width","autosize"].indexOf(A)&&(m.doplot=!0):m.docalc=!0:m.doplot=!0,T.set(L)}}}for(o in d){z.applyContainerArrayChanges(t,b.nestedProperty(s,o),d[o],m)||(m.doplot=!0)}var rt=c._axisConstraintGroups;for(v in w)for(i=0;i=l.length?l[0]:l[t]:l}function a(t){return Array.isArray(s)?t>=s.length?s[0]:s[t]:s}function o(t,e){var n=0;return function(){if(t&&++n===e)return t()}}if(t=D.getGraphDiv(t),!b.isPlotDiv(t))throw new Error("This element is not a Plotly plot: "+t+". It's likely that you've failed to create a plot before animating it. For more details, see https://plot.ly/javascript/animations/");var i=t._transitionData;i._frameQueue||(i._frameQueue=[]),n=M.supplyAnimationDefaults(n);var l=n.transition,s=n.frame;return void 0===i._frameWaitingCnt&&(i._frameWaitingCnt=0),new Promise(function(s,c){function u(){t.emit("plotly_animated"),window.cancelAnimationFrame(i._animationRaf),i._animationRaf=null}function f(){i._currentFrame&&i._currentFrame.onComplete&&i._currentFrame.onComplete();var e=i._currentFrame=i._frameQueue.shift();if(e){var n=e.name?e.name.toString():null;t._fullLayout._currentFrame=n,i._lastFrameAt=Date.now(),i._timeToNext=e.frameOpts.duration,M.transition(t,e.frame.data,e.frame.layout,D.coerceTraceIndices(t,e.frame.traces),e.frameOpts,e.transitionOpts).then(function(){e.onComplete&&e.onComplete()}),t.emit("plotly_animatingframe",{name:n,frame:e.frame,animation:{frame:e.frameOpts,transition:e.transitionOpts}})}else u()}function d(){t.emit("plotly_animating"),i._lastFrameAt=-1/0,i._timeToNext=0,i._runningTransitions=0,i._currentFrame=null;var e=function(){i._animationRaf=window.requestAnimationFrame(e),Date.now()-i._lastFrameAt>i._timeToNext&&f()};e()}function h(t){return Array.isArray(l)?v>=l.length?t.transitionOpts=l[v]:t.transitionOpts=l[0]:t.transitionOpts=l,v++,t}var p,g,v=0,m=[],y=void 0===e||null===e,x=Array.isArray(e);if(y||x||!b.isPlainObject(e)){if(y||-1!==["string","number"].indexOf(typeof e))for(p=0;p0&&kk)&&A.push(g);m=A}}m.length>0?function(e){if(0!==e.length){for(var l=0;l=0;a--)if(b.isPlainObject(e[a])){var d=(c[e[a].name]||{}).name,h=e[a].name;d&&h&&"number"==typeof h&&c[d]&&(r++,b.warn('addFrames: overwriting frame "'+c[d].name+'" with a frame whose name of type "number" also equates to "'+d+'". This is valid but may potentially lead to unexpected behavior since all plotly.js frame names are stored internally as strings.'),r>5&&b.warn("addFrames: This API call has yielded too many warnings. For the rest of this call, further warnings about numeric frame names will be suppressed.")),f.push({frame:M.supplyFrameDefaults(e[a]),index:n&&void 0!==n[a]&&null!==n[a]?n[a]:u+a})}f.sort(function(t,e){return t.index>e.index?-1:t.index=0;a--){if(o=f[a].frame,"number"==typeof o.name&&b.warn("Warning: addFrames accepts frames with numeric names, but the numbers areimplicitly cast to strings"),!o.name)for(;c[o.name="frame "+t._transitionData._counter++];);if(c[o.name]){for(i=0;i=0;n--)r=e[n],o.push({type:"delete",index:r}),i.unshift({type:"insert",index:r,value:a[r]});var l=M.modifyFrames,s=M.modifyFrames,c=[t,i],u=[t,o];return w&&w.add(t,l,c,s,u),M.modifyFrames(t,o)},x.purge=function(t){t=D.getGraphDiv(t);var e=t._fullLayout||{},n=t._fullData||[];return M.cleanPlot([],{},n,e),M.purge(t),_.purge(t),e._container&&e._container.remove(),delete t._context,delete t._replotPending,delete t._mouseDownTime,delete t._legendMouseDownTime,delete t._hmpixcount,delete t._hmlumcount,t}},{"../components/drawing":61,"../components/errorbars":67,"../constants/xmlns_namespaces":137,"../lib":150,"../lib/events":144,"../lib/queue":162,"../lib/svg_text_utils":167,"../plotly":181,"../plots/cartesian/axis_ids":189,"../plots/cartesian/constants":191,"../plots/cartesian/constraints":193,"../plots/cartesian/graph_interact":195,"../plots/plots":215,"../plots/polar":218,"../registry":222,"./edit_types":170,"./helpers":171,"./manage_arrays":172,"./subroutines":178,d3:10,"fast-isnumeric":13,"has-hover":15}],174:[function(t,e,n){"use strict";function r(t,n){try{t._fullLayout._paper.style("background",n)}catch(t){e.exports.logging>0&&console.error(t)}}e.exports={staticPlot:!1,editable:!1,edits:{annotationPosition:!1,annotationTail:!1,annotationText:!1,axisTitleText:!1,colorbarPosition:!1,colorbarTitleText:!1,legendPosition:!1,legendText:!1,shapePosition:!1,titleText:!1},autosizable:!1,queueLength:0,fillFrame:!1,frameMargins:0,scrollZoom:!1,doubleClick:"reset+autosize",showTips:!0,showAxisDragHandles:!0,showAxisRangeEntryBoxes:!0,showLink:!1,sendData:!0,linkText:"Edit chart",showSources:!1,displayModeBar:"hover",modeBarButtonsToRemove:[],modeBarButtonsToAdd:[],modeBarButtons:!1,displaylogo:!0,plotGlPixelRatio:2,setBackground:r,topojsonURL:"https://cdn.plot.ly/",mapboxAccessToken:null,logging:!1,globalTransforms:[]}},{}],175:[function(t,e,n){"use strict";function r(t){var e,n;"area"===t?(e={attributes:x},n={}):(e=h.modules[t]._module,n=e.basePlotModule);var r={};r.type=null,k(r,g),k(r,e.attributes),n.attributes&&k(r,n.attributes),Object.keys(h.componentsRegistry).forEach(function(e){var n=h.componentsRegistry[e];n.schema&&n.schema.traces&&n.schema.traces[t]&&Object.keys(n.schema.traces[t]).forEach(function(e){d(r,n.schema.traces[t][e],e)})}),r.type=t;var a={meta:e.meta||{},attributes:l(r)};if(e.layoutAttributes){var o={};k(o,e.layoutAttributes),a.layoutAttributes=l(o)}return a}function a(){var t={};return k(t,v),Object.keys(h.subplotsRegistry).forEach(function(e){var n=h.subplotsRegistry[e];if(n.layoutAttributes)if("cartesian"===n.name)f(t,n,"xaxis"),f(t,n,"yaxis");else{var r="subplot"===n.attr?n.name:n.attr;f(t,n,r)}}),t=u(t),Object.keys(h.componentsRegistry).forEach(function(e){var n=h.componentsRegistry[e];n.layoutAttributes&&(n.schema&&n.schema.layout?Object.keys(n.schema.layout).forEach(function(e){d(t,n.schema.layout[e],e)}):d(t,n.layoutAttributes,n.name))}),{layoutAttributes:l(t)}}function o(t){var e=h.transformsRegistry[t],n=k({},e.attributes);return Object.keys(h.componentsRegistry).forEach(function(e){var r=h.componentsRegistry[e];r.schema&&r.schema.transforms&&r.schema.transforms[t]&&Object.keys(r.schema.transforms[t]).forEach(function(e){d(n,r.schema.transforms[t][e],e)})}),{attributes:l(n)}}function i(){var t={frames:p.extendDeep({},m)};return l(t),t.frames}function l(t){return s(t),c(t),t}function s(t){function e(t){return{valType:"string"}}function r(t,r,a){n.isValObject(t)?"data_array"===t.valType?(t.role="data",a[r+"src"]=e(r)):!0===t.arrayOk&&(a[r+"src"]=e(r)):p.isPlainObject(t)&&(t.role="object")}n.crawl(t,r)}function c(t){function e(t,e,n){if(t){var r=t[A];r&&(delete t[A],n[e]={items:{}},n[e].items[r]=t,n[e].role="object")}}n.crawl(t,e)}function u(t){return w(t,{radialaxis:b.radialaxis,angularaxis:b.angularaxis}),w(t,b.layout),t}function f(t,e,n){var r=p.nestedProperty(t,n),a=k({},e.layoutAttributes);a[M]=!0,r.set(a)}function d(t,e,n){var r=p.nestedProperty(t,n);r.set(k(r.get()||{},e))}var h=t("../registry"),p=t("../lib"),g=t("../plots/attributes"),v=t("../plots/layout_attributes"),m=t("../plots/frame_attributes"),y=t("../plots/animation_attributes"),x=t("../plots/polar/area_attributes"),b=t("../plots/polar/axis_attributes"),_=t("./edit_types"),w=p.extendFlat,k=p.extendDeep,M="_isSubplotObj",A="_isLinkedToArray",T=[M,A,"_arrayAttrRegexps","_deprecated"];n.IS_SUBPLOT_OBJ=M,n.IS_LINKED_TO_ARRAY=A,n.DEPRECATED="_deprecated",n.UNDERSCORE_ATTRS=T,n.get=function(){var t={};h.allTypes.concat("area").forEach(function(e){t[e]=r(e)});var e={};return Object.keys(h.transformsRegistry).forEach(function(t){e[t]=o(t)}),{defs:{valObjects:p.valObjects,metaKeys:T.concat(["description","role"]),editTypes:{traces:_.traces(),layout:_.layout()}},traces:t,layout:a(),transforms:e,frames:i(),animation:l(y)}},n.crawl=function(t,e,r){var a=r||0;Object.keys(t).forEach(function(r){var o=t[r];-1===T.indexOf(r)&&(e(o,r,t,a),n.isValObject(o)||p.isPlainObject(o)&&n.crawl(o,e,a+1))})},n.isValObject=function(t){return t&&void 0!==t.valType},n.findArrayAttributes=function(t){function e(e,n,i,l){if(o=o.slice(0,l).concat([n]),e&&("data_array"===e.valType||!0===e.arrayOk)&&!("colorbar"===o[l-1]&&("ticktext"===n||"tickvals"===n))){var s=r(o),c=p.nestedProperty(t,s).get();Array.isArray(c)&&a.push(s)}}function r(t){return t.join(".")}var a=[],o=[];if(n.crawl(g,e),t._module&&t._module.attributes&&n.crawl(t._module.attributes,e),t.transforms)for(var i=t.transforms,l=0;l=t[1]||a[1]<=t[0])&&(o[0]e[0]))return!0}return!1}function a(t,e,n){return t._anchorAxis===e&&(t.mirror||t.side===n)||"all"===t.mirror||"allticks"===t.mirror||t.mirrors&&t.mirrors[e._id+n]}function o(t,e,n){var r=[],a=e._anchorAxis;if(a){var o=a._mainAxis;if(-1===r.indexOf(o)){r.push(o);for(var i=0;i=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 u=t("d3"),f=t("fast-isnumeric"),d=t("tinycolor2"),h=t("../../lib"),p=t("../../lib/events"),g=t("../../lib/svg_text_utils"),v=t("../../lib/override_cursor"),m=t("../drawing"),y=t("../color"),x=t("../dragelement"),b=t("../../plots/cartesian/axes"),_=t("../../registry"),w=t("./helpers"),k=t("./constants"),M=k.YANGLE,A=Math.PI*M/180,T=1/Math.sin(A),L=Math.cos(A),C=Math.sin(A),S=k.HOVERARROWSIZE,z=k.HOVERTEXTPAD;n.hover=function(t,e,n,a){if("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)return r(t,e,n,a),void(t._lastHoverTime=Date.now());t._hoverTimer=setTimeout(function(){r(t,e,n,a),t._lastHoverTime=Date.now(),t._hoverTimer=void 0},k.HOVERMINTIME)},n.loneHover=function(t,e){var n={color:t.color||y.defaultLine,x0:t.x0||t.x||0,x1:t.x1||t.x||0,y0:t.y0||t.y||0,y1:t.y1||t.y||0,xLabel:t.xLabel,yLabel:t.yLabel,zLabel:t.zLabel,text:t.text,name:t.name,idealAlign:t.idealAlign,borderColor:t.borderColor,fontFamily:t.fontFamily,fontSize:t.fontSize,fontColor:t.fontColor,trace:{index:0,hoverinfo:""},xa:{_offset:0},ya:{_offset:0},index:0},r=u.select(e.container),o=e.outerContainer?u.select(e.outerContainer):r,l={hovermode:"closest",rotateLabels:!1,bgColor:e.bgColor||y.background,container:r,outerContainer:o},s=a([n],l,e.gd);return i(s,l.rotateLabels),s.node()}},{"../../lib":152,"../../lib/events":144,"../../lib/override_cursor":161,"../../lib/svg_text_utils":169,"../../plots/cartesian/axes":189,"../../registry":238,"../color":36,"../dragelement":57,"../drawing":60,"./constants":72,"./helpers":74,d3:8,"fast-isnumeric":11,tinycolor2:17}],76:[function(t,e,n){"use strict";var r=t("../../lib");e.exports=function(t,e,n,a){a=a||{},n("hoverlabel.bgcolor",a.bgcolor),n("hoverlabel.bordercolor",a.bordercolor),n("hoverlabel.namelength",a.namelength),r.coerceFont(n,"hoverlabel.font",a.font)}},{"../../lib":152}],77:[function(t,e,n){"use strict";function r(t){var e=l.isD3Selection(t)?t:i.select(t);e.selectAll("g.hovertext").remove(),e.selectAll(".spikeline").remove()}function a(t,e,n){return l.castOption(t,e,"hoverlabel."+n)}function o(t,e,n){function r(n){return l.coerceHoverinfo({hoverinfo:n},{_module:t._module},e)}return l.castOption(t,n,"hoverinfo",r)}var i=t("d3"),l=t("../../lib"),s=t("../dragelement"),c=t("./helpers"),u=t("./layout_attributes");e.exports={moduleType:"component",name:"fx",constants:t("./constants"),schema:{layout:u},attributes:t("./attributes"),layoutAttributes:u,supplyLayoutGlobalDefaults:t("./layout_global_defaults"),supplyDefaults:t("./defaults"),supplyLayoutDefaults:t("./layout_defaults"),calc:t("./calc"),getDistanceFunction:c.getDistanceFunction,getClosest:c.getClosest,inbox:c.inbox,appendArrayPointValue:c.appendArrayPointValue,castHoverOption:a,castHoverinfo:o,hover:t("./hover").hover,unhover:s.unhover,loneHover:t("./hover").loneHover,loneUnhover:r,click:t("./click")}},{"../../lib":152,"../dragelement":57,"./attributes":69,"./calc":70,"./click":71,"./constants":72,"./defaults":73,"./helpers":74,"./hover":75,"./layout_attributes":78,"./layout_defaults":79,"./layout_global_defaults":80,d3:8}],78:[function(t,e,n){"use strict";var r=t("../../lib/extend").extendFlat,a=t("../../plots/font_attributes"),o=t("./constants");e.exports={dragmode:{valType:"enumerated",values:["zoom","pan","select","lasso","orbit","turntable"],dflt:"zoom"},hovermode:{valType:"enumerated",values:["x","y","closest",!1]},hoverlabel:{bgcolor:{valType:"color"},bordercolor:{valType:"color"},font:{family:r({},a.family,{dflt:o.HOVERFONT}),size:r({},a.size,{dflt:o.HOVERFONTSIZE}),color:r({},a.color)},namelength:{valType:"integer",min:-1,dflt:15}}}},{"../../lib/extend":145,"../../plots/font_attributes":213,"./constants":72}],79:[function(t,e,n){"use strict";function r(t){for(var e=!0,n=0;n=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}},{}],87:[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":145,"../../plots/font_attributes":213,"../color/attributes":35}],88:[function(t,e,n){"use strict";e.exports={scrollBarWidth:4,scrollBarHeight:20,scrollBarColor:"#808BA4",scrollBarMargin:4}},{}],89:[function(t,e,n){"use strict";var r=t("../../registry"),a=t("../../lib"),o=t("./attributes"),i=t("../../plots/layout_attributes"),l=t("./helpers");e.exports=function(t,e,n){function s(t,e){return a.coerce(h,p,o,t,e)}for(var c,u,f,d,h=t.legend||{},p=e.legend={},g=0,v="normal",m=0;m1)){if(s("bgcolor",e.paper_bgcolor),s("bordercolor"),s("borderwidth"),a.coerceFont(s,"font",e.font),s("orientation"),"h"===p.orientation){var x=t.xaxis;x&&x.rangeslider&&x.rangeslider.visible?(c=0,f="left",u=1.1,d="bottom"):(c=0,f="left",u=-.1,d="top")}s("traceorder",v),l.isGrouped(e.legend)&&s("tracegroupgap"),s("x",c),s("xanchor",f),s("y",u),s("yanchor",d),a.noneOrAll(h,p,["x","y"])}}},{"../../lib":152,"../../plots/layout_attributes":228,"../../registry":238,"./attributes":87,"./helpers":92}],90:[function(t,e,n){"use strict";function r(t,e){function n(n){y.convertToTspans(n,e,function(){i(t,e)})}var r=t.data()[0][0],a=e._fullLayout,o=r.trace,l=p.traceIs(o,"pie"),s=o.index,c=l?r.label:o.name,u=t.selectAll("text.legendtext").data([0]);u.enter().append("text").classed("legendtext",!0),u.attr("text-anchor","start").classed("user-select-none",!0).call(v.font,a.legend.font).text(c),e._context.edits.legendText&&!l?u.call(y.makeEditable,{gd:e}).call(n).on("edit",function(t){this.text(t).call(n),this.text()||(t=" ");var a,o=r.trace._fullInput||{};if(-1!==["ohlc","candlestick"].indexOf(o.type)){var i=r.trace.transforms;a=i[i.length-1].direction+".name"}else a="name";f.restyle(e,a,t,s)}):u.call(n)}function a(t,e){var n,r=1,a=t.selectAll("rect").data([0]);a.enter().append("rect").classed("legendtoggle",!0).style("cursor","pointer").attr("pointer-events","all").call(m.fill,"rgba(0,0,0,0)"),a.on("mousedown",function(){n=(new Date).getTime(),n-e._legendMouseDownTimeL&&(r=Math.max(r-1,1)),1===r?n._clickTimeout=setTimeout(function(){o(t,e,r)},L):2===r&&(n._clickTimeout&&clearTimeout(n._clickTimeout),e._legendMouseDownTime=0,o(t,e,r))}})}function o(t,e,n){if(!e._dragged&&!e._editing){var r,a,o=e._fullLayout.hiddenlabels?e._fullLayout.hiddenlabels.slice():[],i=t.data()[0][0],l=e._fullData,s=i.trace,c=s.legendgroup,u=[];if(1===n&&T&&e.data&&e._context.showTips?(d.notifier("Double click on legend to isolate individual trace","long"),T=!1):T=!1,p.traceIs(s,"pie")){var h=i.label,g=o.indexOf(h);1===n?-1===g?o.push(h):o.splice(g,1):2===n&&(o=[],e.calcdata[0].forEach(function(t){h!==t.label&&o.push(t.label)}),e._fullLayout.hiddenlabels&&e._fullLayout.hiddenlabels.length===o.length&&-1===g&&(o=[])),f.relayout(e,"hiddenlabels",o)}else{var v,m=[],y=[];for(v=0;vr.width-(r.margin.r+r.margin.l)&&(x=0,g+=m,a.height=a.height+m,m=0),v.setTranslate(this,o+x,5+o+e.height/2+g),a.width+=i+n,a.height=Math.max(a.height,e.height),x+=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.each(function(e){var n=e[0];u.select(this).select(".legendtoggle").call(v.setRect,0,-n.height/2,(t._context.edits.legendText?0:a.width)+l,n.height)})}function s(t){var e=t._fullLayout,n=e.legend,r="left";A.isRightAnchor(n)?r="right":A.isCenterAnchor(n)&&(r="center");var a="top";A.isBottomAnchor(n)?a="bottom":A.isMiddleAnchor(n)&&(a="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}[a]||0),t:n.height*({bottom:1,middle:.5}[a]||0)})}function c(t){var e=t._fullLayout,n=e.legend,r="left";A.isRightAnchor(n)?r="right":A.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"),f=t("../../plotly"),d=t("../../lib"),h=t("../../plots/plots"),p=t("../../registry"),g=t("../dragelement"),v=t("../drawing"),m=t("../color"),y=t("../../lib/svg_text_utils"),x=t("./constants"),b=t("../../constants/interactions"),_=t("../../constants/alignment").LINE_SPACING,w=t("./get_legend_data"),k=t("./style"),M=t("./helpers"),A=t("./anchor_utils"),T=!0,L=b.DBLCLICKDELAY;e.exports=function(t){function e(t,e){S.attr("data-scroll",e).call(v.setTranslate,0,e),z.call(v.setRect,F,t,x.scrollBarWidth,x.scrollBarHeight),T.select("rect").attr({y:y.borderwidth-e})}var n=t._fullLayout,i="legend"+n._uid;if(n._infolayer&&t.calcdata){t._legendMouseDownTime||(t._legendMouseDownTime=0);var y=n.legend,b=n.showlegend&&w(t.calcdata,y),_=n.hiddenlabels||[];if(!n.showlegend||!b.length)return n._infolayer.selectAll(".legend").remove(),n._topdefs.select("#"+i).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 T=n._topdefs.selectAll("#"+i).data([0]);T.enter().append("clipPath").attr("id",i).append("rect");var C=M.selectAll("rect.bg").data([0]);C.enter().append("rect").attr({class:"bg","shape-rendering":"crispEdges"}),C.call(m.stroke,y.bordercolor),C.call(m.fill,y.bgcolor),C.style("stroke-width",y.borderwidth+"px");var S=M.selectAll("g.scrollbox").data([0]);S.enter().append("g").attr("class","scrollbox");var z=M.selectAll("rect.scrollbar").data([0]);z.enter().append("rect").attr({class:"scrollbar",rx:20,ry:2,width:0,height:0}).call(m.fill,"#808BA4");var O=S.selectAll("g.groups").data(b);O.enter().append("g").attr("class","groups"),O.exit().remove();var P=O.selectAll("g.traces").data(d.identity);P.enter().append("g").attr("class","traces"),P.exit().remove(),P.call(k,t).style("opacity",function(t){var e=t[0].trace;return p.traceIs(e,"pie")?-1!==_.indexOf(t[0].label)?.5:1:"legendonly"===e.visible?.5:1}).each(function(){u.select(this).call(r,t).call(a,t)});var D=0!==M.enter().size();D&&(l(t,O,P),s(t));var E=n.width,N=n.height;l(t,O,P),y.height>N?c(t):s(t);var R=n._size,I=R.l+R.w*y.x,j=R.t+R.h*(1-y.y);A.isRightAnchor(y)?I-=y.width:A.isCenterAnchor(y)&&(I-=y.width/2),A.isBottomAnchor(y)?j-=y.height:A.isMiddleAnchor(y)&&(j-=y.height/2);var F=y.width,B=R.w;F>B?(I=R.l,F=B):(I+F>E&&(I=E-F),I<0&&(I=0),F=Math.min(E-I,y.width));var q=y.height,H=R.h;q>H?(j=R.t,q=H):(j+q>N&&(j=N-q),j<0&&(j=0),q=Math.min(N-j,y.height)),v.setTranslate(M,I,j);var V,U,G=q-x.scrollBarHeight-2*x.scrollBarMargin,Y=y.height-q;if(y.height<=q||t._context.staticPlot)C.attr({width:F-y.borderwidth,height:q-y.borderwidth,x:y.borderwidth/2,y:y.borderwidth/2}),v.setTranslate(S,0,0),T.select("rect").attr({width:F-2*y.borderwidth,height:q-2*y.borderwidth,x:y.borderwidth,y:y.borderwidth}),S.call(v.setClipUrl,i);else{V=x.scrollBarMargin,U=S.attr("data-scroll")||0,C.attr({width:F-2*y.borderwidth+x.scrollBarWidth+x.scrollBarMargin,height:q-y.borderwidth,x:y.borderwidth/2,y:y.borderwidth/2}),T.select("rect").attr({width:F-2*y.borderwidth+x.scrollBarWidth+x.scrollBarMargin,height:q-2*y.borderwidth,x:y.borderwidth,y:y.borderwidth-U}),S.call(v.setClipUrl,i),D&&e(V,U),M.on("wheel",null),M.on("wheel",function(){U=d.constrain(S.attr("data-scroll")-u.event.deltaY/G*Y,-Y,0),V=x.scrollBarMargin-U/Y*G,e(V,U),0!==U&&U!==-Y&&u.event.preventDefault()}),z.on(".drag",null),S.on(".drag",null);var X=u.behavior.drag().on("drag",function(){V=d.constrain(u.event.y-x.scrollBarHeight/2,x.scrollBarMargin,x.scrollBarMargin+G),U=-(V-x.scrollBarMargin)/G*Y,e(V,U)});z.call(X),S.call(X)}if(t._context.edits.legendPosition){var Z,W,Q,$;M.classed("cursor-move",!0),g.init({element:M.node(),gd:t,prepFn:function(){var t=v.getTranslate(M);Q=t.x,$=t.y},moveFn:function(t,e){var n=Q+t,r=$+e;v.setTranslate(M,n,r),Z=g.align(n,0,R.l,R.l+R.w,y.xanchor),W=g.align(r,0,R.t+R.h,R.t,y.yanchor)},doneFn:function(e,r,a){if(e&&void 0!==Z&&void 0!==W)f.relayout(t,{"legend.x":Z,"legend.y":W});else{var i=n._infolayer.selectAll("g.traces").filter(function(){var t=this.getBoundingClientRect();return a.clientX>=t.left&&a.clientX<=t.right&&a.clientY>=t.top&&a.clientY<=t.bottom});i.size()>0&&(1===r?M._clickTimeout=setTimeout(function(){o(i,t,r)},L):2===r&&(M._clickTimeout&&clearTimeout(M._clickTimeout),o(i,t,r)))}}})}}}},{"../../constants/alignment":132,"../../constants/interactions":133,"../../lib":152,"../../lib/svg_text_utils":169,"../../plotly":184,"../../plots/plots":230,"../../registry":238,"../color":36,"../dragelement":57,"../drawing":60,"./anchor_utils":86,"./constants":88,"./get_legend_data":91,"./helpers":92,"./style":94,d3:8}],91:[function(t,e,n){"use strict";var r=t("../../registry"),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;on[1])return n[1]}return a}function a(t){return t[0]}var l,c,u=t[0],f=u.trace,d=s.hasMarkers(f),h=s.hasText(f),p=s.hasLines(f);if(d||h||p){var g={},v={};d&&(g.mc=n("marker.color",a),g.mo=n("marker.opacity",o.mean,[.2,1]),g.ms=n("marker.size",o.mean,[2,16]),g.mlc=n("marker.line.color",a),g.mlw=n("marker.line.width",o.mean,[0,5]),v.marker={sizeref:1,sizemin:1,sizemode:"diameter"}),p&&(v.line={width:n("line.width",a,[0,10])}),h&&(g.tx="Aa",g.tp=n("textposition",a),g.ts=10,g.tc=n("textfont.color",a),g.tf=n("textfont.family",a)),l=[o.minExtend(u,g)],c=o.minExtend(f,v)}var m=r.select(this).select("g.legendpoints"),y=m.selectAll("path.scatterpts").data(d?l:[]);y.enter().append("path").classed("scatterpts",!0).attr("transform","translate(20,0)"),y.exit().remove(),y.call(i.pointStyle,c,e),d&&(l[0].mrc=3);var x=m.selectAll("g.pointtext").data(h?l:[]);x.enter().append("g").classed("pointtext",!0).append("text").attr("transform","translate(20,0)"),x.exit().remove(),x.selectAll("text").call(i.textPointStyle,c,e)}function f(t){var e=t[0].trace,n=e.marker||{},o=n.line||{},i=r.select(this).select("g.legendpoints").selectAll("path.legendbar").data(a.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=r.select(this),a=t[0],i=(a.mlw+1||o.width+1)-1;e.style("stroke-width",i+"px").call(l.fill,a.mc||n.color),i&&e.call(l.stroke,a.mlc||o.color)})}function d(t){var e=t[0].trace,n=r.select(this).select("g.legendpoints").selectAll("path.legendbox").data(a.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(){var t=e.line.width,n=r.select(this);n.style("stroke-width",t+"px").call(l.fill,e.fillcolor),t&&n.call(l.stroke,e.line.color)})}function h(t){var e=t[0].trace,n=r.select(this).select("g.legendpoints").selectAll("path.legendpie").data(a.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(c,t[0],e)}t.each(function(t){var e=r.select(this),n=e.selectAll("g.layers").data([0]);n.enter().append("g").classed("layers",!0),n.style("opacity",t[0].trace.opacity),n.selectAll("g.legendfill").data([t]).enter().append("g").classed("legendfill",!0),n.selectAll("g.legendlines").data([t]).enter().append("g").classed("legendlines",!0);var a=n.selectAll("g.legendsymbols").data([t]);a.enter().append("g").classed("legendsymbols",!0),a.selectAll("g.legendpoints").data([t]).enter().append("g").classed("legendpoints",!0)}).each(f).each(d).each(h).each(n).each(u)}},{"../../lib":152,"../../registry":238,"../../traces/pie/style_one":255,"../../traces/scatter/subtypes":277,"../color":36,"../drawing":60,d3:8}],95:[function(t,e,n){"use strict";function r(t,e){var n,r,a=e.currentTarget,o=a.getAttribute("data-attr"),i=a.getAttribute("data-val")||!0,l=t._fullLayout,s={},c=d.list(t,null,!0),f="on";if("zoom"===o){var h,p="in"===i?.5:2,g=(1+p)/2,v=(1-p)/2;for(r=0;r1)return r(["resetViews","toggleHover"]),i(m,n);u&&(r(["zoom3d","pan3d","orbitRotation","tableRotation"]),r(["resetCameraDefault3d","resetCameraLastSave3d"]),r(["hoverClosest3d"])),f&&(r(["zoomInGeo","zoomOutGeo","resetGeo"]),r(["hoverClosestGeo"]));var y=a(l),x=[];return((c||p)&&!y||g)&&(x=["zoom2d","pan2d"]),v&&(x=["pan2d"]),o(s)&&(x.push("select2d"),x.push("lasso2d")),x.length&&r(x),!c&&!p||y||g||r(["zoomIn2d","zoomOut2d","autoScale2d","resetScale2d"]),c&&h?r(["toggleHover"]):p?r(["hoverClosestGl2d"]):c?r(["toggleSpikelines","hoverClosestCartesian","hoverCompareCartesian"]):h?r(["hoverClosestPie"]):v&&r(["resetViewMapbox","toggleHover"]),i(m,n)}function a(t){for(var e=s.list({_fullLayout:t},null,!0),n=!0,r=0;r0)){var p=a(e,n,s);f("x",p[0]),f("y",p[1]),o.noneOrAll(t,e,["x","y"]),f("xanchor"),f("yanchor"),o.coerceFont(f,"font",n.font);var g=f("bgcolor");f("activecolor",i.contrast(g,c.lightAmount,c.darkAmount)),f("bordercolor"),f("borderwidth")}}},{"../../lib":152,"../color":36,"./attributes":99,"./button_attributes":100,"./constants":101}],103:[function(t,e,n){"use strict";function r(t){for(var e=m.list(t,"x",!0),n=[],r=0;rp&&(p=d)));return p>=h?[h,p]:void 0}}var a=t("../../lib"),o=t("../../plots/cartesian/axes"),i=t("./constants"),l=t("./helpers");e.exports=function(t){var e=t._fullLayout,n=a.filterVisible(e.shapes);if(n.length&&t._fullData.length)for(var l=0;lY&&r>X&&!t.shiftKey?p.getCursor(a/n,1-o/r):"move";g(e,i),G=i.split("-")[0]}function o(e){F=f.getFromId(t,n.xref),B=f.getFromId(t,n.yref),q=m.getDataToPixel(t,F),H=m.getDataToPixel(t,B,!0),V=m.getPixelToData(t,F),U=m.getPixelToData(t,B,!0);var o="shapes["+r+"]";"path"===n.type?(I=n.path,j=o+".path"):(v=q(n.x0),y=H(n.y0),x=q(n.x1),b=H(n.y1),_=o+".x0",w=o+".y0",k=o+".x1",M=o+".y1"),vX&&(h[S]=n[D]=U(c),h[z]=n[E]=U(u)),d-f>Y&&(h[O]=n[N]=V(f),h[P]=n[R]=V(d))}e.attr("d",i(t,n))}var h,v,y,x,b,_,w,k,M,A,T,L,C,S,z,O,P,D,E,N,R,I,j,F,B,q,H,V,U,G,Y=10,X=10,Z={element:e.node(),gd:t,prepFn:o,doneFn:l},W=Z.element.getBoundingClientRect();p.init(Z),e.node().onmousemove=a}function i(t,e){var n,r,a,o,i=e.type,s=f.getFromId(t,e.xref),c=f.getFromId(t,e.yref),u=t._fullLayout._size;if(s?(n=m.shapePositionToRange(s),r=function(t){return s._offset+s.r2p(n(t,!0))}):r=function(t){return u.l+u.w*t},c?(a=m.shapePositionToRange(c),o=function(t){return c._offset+c.r2p(a(t,!0))}):o=function(t){return u.t+u.h*(1-t)},"path"===i)return s&&"date"===s.type&&(r=m.decodeDate(r)),c&&"date"===c.type&&(o=m.decodeDate(o)),l(e.path,r,o);var d=r(e.x0),h=r(e.x1),p=o(e.y0),g=o(e.y1);if("line"===i)return"M"+d+","+p+"L"+h+","+g;if("rect"===i)return"M"+d+","+p+"H"+h+"V"+g+"H"+d+"Z";var v=(d+h)/2,y=(p+g)/2,x=Math.abs(v-d),b=Math.abs(y-p),_="A"+x+","+b,w=v+x+","+y;return"M"+w+_+" 0 1,1 "+v+","+(y-b)+_+" 0 0,1 "+w+"Z"}function l(t,e,n){return t.replace(v.segmentRE,function(t){var r=0,a=t.charAt(0),o=v.paramIsX[a],i=v.paramIsY[a],l=v.numParams[a],s=t.substr(1).replace(v.paramRE,function(t){return o[r]?t=e(t):i[r]&&(t=n(t)),r++,r>l&&(t="X"),t});return r>l&&(s=s.replace(/[\s,]*X.*/,""),u.log("Ignoring extra params in segment "+t)),a+s})}function s(t,e,n){return t.replace(v.segmentRE,function(t){var r=0,a=t.charAt(0),o=v.paramIsX[a],i=v.paramIsY[a],l=v.numParams[a];return a+t.substr(1).replace(v.paramRE,function(t){return r>=l?t:(o[r]?t=e(t):i[r]&&(t=n(t)),r++,t)})})}var c=t("../../plotly"),u=t("../../lib"),f=t("../../plots/cartesian/axes"),d=t("../color"),h=t("../drawing"),p=t("../dragelement"),g=t("../../lib/setcursor"),v=t("./constants"),m=t("./helpers");e.exports={draw:r,drawOne:a}},{"../../lib":152,"../../lib/setcursor":167,"../../plotly":184,"../../plots/cartesian/axes":189,"../color":36,"../dragelement":57,"../drawing":60,"./constants":114,"./helpers":117}],117:[function(t,e,n){"use strict";n.rangeToShapePosition=function(t){return"log"===t.type?t.r2d:function(t){return t}},n.shapePositionToRange=function(t){return"log"===t.type?t.d2r:function(t){return t}},n.decodeDate=function(t){return function(e){return e.replace&&(e=e.replace("_"," ")),t(e)}},n.encodeDate=function(t){return function(e){return t(e).replace(" ","_")}},n.getDataToPixel=function(t,e,r){var a,o=t._fullLayout._size;if(e){var i=n.shapePositionToRange(e);a=function(t){return e._offset+e.r2p(i(t,!0))},"date"===e.type&&(a=n.decodeDate(a))}else a=r?function(t){return o.t+o.h*(1-t)}:function(t){return o.l+o.w*t};return a},n.getPixelToData=function(t,e,r){var a,o=t._fullLayout._size;if(e){var i=n.rangeToShapePosition(e);a=function(t){return i(e.p2r(t-e._offset))}}else a=r?function(t){return 1-(t-o.t)/o.h}:function(t){return(t-o.l)/o.w};return a}},{}],118:[function(t,e,n){"use strict";var r=t("./draw");e.exports={moduleType:"component",name:"shapes",layoutAttributes:t("./attributes"),supplyLayoutDefaults:t("./defaults"),calcAutorange:t("./calc_autorange"),draw:r.draw,drawOne:r.drawOne}},{"./attributes":112,"./calc_autorange":113,"./defaults":115,"./draw":116}],119:[function(t,e,n){"use strict";var r=t("../../lib"),a=t("../../plots/cartesian/axes"),o=t("./attributes"),i=t("./helpers");e.exports=function(t,e,n,l,s){function c(n,a){return r.coerce(t,e,o,n,a)}if(l=l||{},s=s||{},!c("visible",!s.itemIsNotPlainObject))return e;c("layer"),c("opacity"),c("fillcolor"),c("line.color"),c("line.width"),c("line.dash");for(var u=t.path?"path":"rect",f=c("type",u),d=["x","y"],h=0;h<2;h++){var p=d[h],g={_fullLayout:n},v=a.coerceRef(t,e,g,p,"","paper");if("path"!==f){var m,y,x;"paper"!==v?(m=a.getFromId(g,v),x=i.rangeToShapePosition(m),y=i.shapePositionToRange(m)):y=x=r.identity;var b=p+"0",_=p+"1",w=t[b],k=t[_];t[b]=y(t[b],!0),t[_]=y(t[_],!0),a.coercePosition(e,g,c,v,b,.25),a.coercePosition(e,g,c,v,_,.75),e[b]=x(e[b]),e[_]=x(e[_]),t[b]=w,t[_]=k}}return"path"===f?c("path"):r.noneOrAll(t,e,["x0","x1","y0","y1"]),e}},{"../../lib":152,"../../plots/cartesian/axes":189,"./attributes":112,"./helpers":117}],120:[function(t,e,n){"use strict";var r=t("../../plots/font_attributes"),a=t("../../plots/pad_attributes"),o=t("../../lib/extend").extendFlat,i=t("../../lib/extend").extendDeep,l=t("../../plots/animation_attributes"),s=t("./constants"),c={_isLinkedToArray:"step",method:{valType:"enumerated",values:["restyle","relayout","animate","update","skip"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string"},value:{valType:"string"},execute:{valType:"boolean",dflt:!0}};e.exports={_isLinkedToArray:"slider",visible:{valType:"boolean",dflt:!0},active:{valType:"number",min:0,dflt:0},steps:c,lenmode:{valType:"enumerated",values:["fraction","pixels"],dflt:"fraction"},len:{valType:"number",min:0,dflt:1},x:{valType:"number",min:-2,max:3,dflt:0},pad:i({},a,{},{t:{dflt:20}}),xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left"},y:{valType:"number",min:-2,max:3,dflt:0},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"top"},transition:{duration:{valType:"number",min:0,dflt:150},easing:{valType:"enumerated",values:l.transition.easing.values,dflt:"cubic-in-out"}},currentvalue:{visible:{valType:"boolean",dflt:!0},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left"},offset:{valType:"number",dflt:10},prefix:{valType:"string"},suffix:{valType:"string"},font:o({},r,{})},font:o({},r,{}),activebgcolor:{valType:"color",dflt:s.gripBgActiveColor},bgcolor:{valType:"color",dflt:s.railBgColor},bordercolor:{valType:"color",dflt:s.railBorderColor},borderwidth:{valType:"number",min:0,dflt:s.railBorderWidth},ticklen:{valType:"number",min:0,dflt:s.tickLength},tickcolor:{valType:"color",dflt:s.tickColor},tickwidth:{valType:"number",min:0,dflt:1},minorticklen:{valType:"number",min:0,dflt:s.minorTickLength}}},{"../../lib/extend":145,"../../plots/animation_attributes":185,"../../plots/font_attributes":213,"../../plots/pad_attributes":229,"./constants":121}],121:[function(t,e,n){"use strict";e.exports={name:"sliders",containerClassName:"slider-container",groupClassName:"slider-group",inputAreaClass:"slider-input-area",railRectClass:"slider-rail-rect",railTouchRectClass:"slider-rail-touch-rect",gripRectClass:"slider-grip-rect",tickRectClass:"slider-tick-rect",inputProxyClass:"slider-input-proxy",labelsClass:"slider-labels",labelGroupClass:"slider-label-group",labelClass:"slider-label",currentValueClass:"slider-current-value",railHeight:5,menuIndexAttrName:"slider-active-index",autoMarginIdRoot:"slider-",minWidth:30,minHeight:30,textPadX:40,arrowOffsetX:4,railRadius:2,railWidth:5,railBorder:4,railBorderWidth:1,railBorderColor:"#bec8d9",railBgColor:"#f8fafc",railInset:8,stepInset:10,gripRadius:10,gripWidth:20,gripHeight:20,gripBorder:20,gripBorderWidth:1,gripBorderColor:"#bec8d9",gripBgColor:"#f6f8fa",gripBgActiveColor:"#dbdde0",labelPadding:8,labelOffset:0,tickWidth:1,tickColor:"#333",tickOffset:25,tickLength:7,minorTickOffset:25,minorTickColor:"#333",minorTickLength:4,currentValuePadding:8,currentValueInset:0}},{}],122:[function(t,e,n){"use strict";function r(t,e,n){function r(n,r){return o.coerce(t,e,l,n,r)}r("visible",a(t,e).length>0)&&(r("active"),r("x"),r("y"),o.noneOrAll(t,e,["x","y"]),r("xanchor"),r("yanchor"),r("len"),r("lenmode"),r("pad.t"),r("pad.r"),r("pad.b"),r("pad.l"),o.coerceFont(r,"font",n.font),r("currentvalue.visible")&&(r("currentvalue.xanchor"),r("currentvalue.prefix"),r("currentvalue.suffix"),r("currentvalue.offset"),o.coerceFont(r,"currentvalue.font",e.font)),r("transition.duration"),r("transition.easing"),r("bgcolor"),r("activebgcolor"),r("bordercolor"),r("borderwidth"),r("ticklen"),r("tickwidth"),r("tickcolor"),r("minorticklen"))}function a(t,e){function n(t,e){return o.coerce(r,a,u,t,e)}for(var r,a,i=t.steps||[],l=e.steps=[],s=0;s=n.steps.length&&(n.active=0),e.call(l,n).call(b,n).call(u,n).call(p,n).call(x,t,n).call(s,t,n),A.setTranslate(e,n.lx+n.pad.l,n.ly+n.pad.t),e.call(v,n,n.active/(n.steps.length-1),!1),e.call(l,n)}function l(t,e,n){if(e.currentvalue.visible){var r,a,o=t.selectAll("text").data([0]);switch(e.currentvalue.xanchor){case"right":r=e.inputAreaLength-C.currentValueInset-e.currentValueMaxWidth,a="left";break;case"center":r=.5*e.inputAreaLength,a="middle";break;default:r=C.currentValueInset,a="left"}o.enter().append("text").classed(C.labelClass,!0).classed("user-select-none",!0).attr({"text-anchor":a,"data-notex":1});var i=e.currentvalue.prefix?e.currentvalue.prefix:"";if("string"==typeof n)i+=n;else{i+=e.steps[e.active].label}e.currentvalue.suffix&&(i+=e.currentvalue.suffix),o.call(A.font,e.currentvalue.font).text(i).call(T.convertToTspans,e.gd);var l=T.lineCount(o),s=(e.currentValueMaxLines+1-l)*e.currentvalue.font.size*S;return T.positionText(o,r,s),o}}function s(t,e,n){var r=t.selectAll("rect."+C.gripRectClass).data([0]);r.enter().append("rect").classed(C.gripRectClass,!0).call(h,e,t,n).style("pointer-events","all"),r.attr({width:C.gripWidth,height:C.gripHeight,rx:C.gripRadius,ry:C.gripRadius}).call(M.stroke,n.bordercolor).call(M.fill,n.bgcolor).style("stroke-width",n.borderwidth+"px")}function c(t,e,n){var r=t.selectAll("text").data([0]);return r.enter().append("text").classed(C.labelClass,!0).classed("user-select-none",!0).attr({"text-anchor":"middle","data-notex":1}),r.call(A.font,n.font).text(e.step.label).call(T.convertToTspans,n.gd),r}function u(t,e){var n=t.selectAll("g."+C.labelsClass).data([0]);n.enter().append("g").classed(C.labelsClass,!0);var r=n.selectAll("g."+C.labelGroupClass).data(e.labelSteps);r.enter().append("g").classed(C.labelGroupClass,!0),r.exit().remove(),r.each(function(t){var n=w.select(this);n.call(c,t,e),A.setTranslate(n,m(e,t.fraction),C.tickOffset+e.ticklen+e.font.size*S+C.labelOffset+e.currentValueTotalHeight)})}function f(t,e,n,r,a){var o=Math.round(r*(n.steps.length-1));o!==n.active&&d(t,e,n,o,!0,a)}function d(t,e,n,r,a,o){var i=n.active;n._input.active=n.active=r;var s=n.steps[n.active];e.call(v,n,n.active/(n.steps.length-1),o),e.call(l,n),t.emit("plotly_sliderchange",{slider:n,step:n.steps[n.active],interaction:a,previousActive:i}),s&&s.method&&a&&(e._nextMethod?(e._nextMethod.step=s,e._nextMethod.doCallback=a,e._nextMethod.doTransition=o):(e._nextMethod={step:s,doCallback:a,doTransition:o},e._nextMethodRaf=window.requestAnimationFrame(function(){var n=e._nextMethod.step;n.method&&(n.execute&&k.executeAPICommand(t,n.method,n.args),e._nextMethod=null,e._nextMethodRaf=null)})))}function h(t,e,n){function r(){return n.data()[0]}var a=n.node(),o=w.select(e);t.on("mousedown",function(){var t=r();e.emit("plotly_sliderstart",{slider:t});var i=n.select("."+C.gripRectClass);w.event.stopPropagation(),w.event.preventDefault(),i.call(M.fill,t.activebgcolor);var l=y(t,w.mouse(a)[0]);f(e,n,t,l,!0),t._dragging=!0,o.on("mousemove",function(){var t=r(),o=y(t,w.mouse(a)[0]);f(e,n,t,o,!1)}),o.on("mouseup",function(){var t=r();t._dragging=!1,i.call(M.fill,t.bgcolor),o.on("mouseup",null),o.on("mousemove",null),e.emit("plotly_sliderend",{slider:t,step:t.steps[t.active]})})})}function p(t,e){var n=t.selectAll("rect."+C.tickRectClass).data(e.steps);n.enter().append("rect").classed(C.tickRectClass,!0),n.exit().remove(),n.attr({width:e.tickwidth+"px","shape-rendering":"crispEdges"}),n.each(function(t,n){var r=n%e.labelStride==0,a=w.select(this);a.attr({height:r?e.ticklen:e.minorticklen}).call(M.fill,e.tickcolor),A.setTranslate(a,m(e,n/(e.steps.length-1))-.5*e.tickwidth,(r?C.tickOffset:C.minorTickOffset)+e.currentValueTotalHeight)})}function g(t){t.labelSteps=[];for(var e=t.steps.length,n=0;n0&&(i=i.transition().duration(e.transition.duration).ease(e.transition.easing)),i.attr("transform","translate("+(o-.5*C.gripWidth)+","+e.currentValueTotalHeight+")")}}function m(t,e){return t.inputAreaStart+C.stepInset+(t.inputAreaLength-2*C.stepInset)*Math.min(1,Math.max(0,e))}function y(t,e){return Math.min(1,Math.max(0,(e-C.stepInset-t.inputAreaStart)/(t.inputAreaLength-2*C.stepInset-2*t.inputAreaStart)))}function x(t,e,n){var r=t.selectAll("rect."+C.railTouchRectClass).data([0]);r.enter().append("rect").classed(C.railTouchRectClass,!0).call(h,e,t,n).style("pointer-events","all"),r.attr({width:n.inputAreaLength,height:Math.max(n.inputAreaWidth,C.tickOffset+n.ticklen+n.labelHeight)}).call(M.fill,n.bgcolor).attr("opacity",0),A.setTranslate(r,0,n.currentValueTotalHeight)}function b(t,e){var n=t.selectAll("rect."+C.railRectClass).data([0]);n.enter().append("rect").classed(C.railRectClass,!0);var r=e.inputAreaLength-2*C.railInset;n.attr({width:r,height:C.railWidth,rx:C.railRadius,ry:C.railRadius,"shape-rendering":"crispEdges"}).call(M.stroke,e.bordercolor).call(M.fill,e.bgcolor).style("stroke-width",e.borderwidth+"px"),A.setTranslate(n,C.railInset,.5*(e.inputAreaWidth-C.railWidth)+e.currentValueTotalHeight)}function _(t){for(var e=t._fullLayout._pushmargin||{},n=Object.keys(e),r=0;r0?[0]:[]);if(l.enter().append("g").classed(C.containerClassName,!0).style("cursor","ew-resize"),l.exit().remove(),l.exit().size()&&_(t),0!==n.length){var s=l.selectAll("g."+C.groupClassName).data(n,a);s.enter().append("g").classed(C.groupClassName,!0),s.exit().each(function(e){w.select(this).remove(),e._commandObserver.remove(),delete e._commandObserver,k.autoMargin(t,C.autoMarginIdRoot+e._index)});for(var c=0;c0||d<0){var g={left:[-n,0],right:[n,0],top:[0,-n],bottom:[0,n]}[_.side];e.attr("transform","translate("+g+")")}}}var v,m=n.propContainer,y=n.propName,x=n.traceIndex,b=n.dfltName,_=n.avoid||{},w=n.attributes,k=n.transform,M=n.containerGroup,A=t._fullLayout,T=m.titlefont.family,L=m.titlefont.size,C=m.titlefont.color,S=1,z=!1,O=m.title.trim();"title"===y?v="titleText":-1!==y.indexOf("axis")?v="axisTitleText":y.indexOf(!0)&&(v="colorbarTitleText");var P=t._context.edits[v];""===O&&(S=0),O.match(d)&&(S=.2,z=!0,P||(O=""));var D=O||P;M||(M=A._infolayer.selectAll(".g-"+e).data([0]),M.enter().append("g").classed("g-"+e,!0));var E=M.selectAll("text").data(D?[0]:[]);if(E.enter().append("text"),E.text(O).attr("class",e),E.exit().remove(),D){E.call(h);var N="Click to enter "+b+" title";P&&(O?E.on(".opacity",null):function(){S=0,z=!0,O=N,E.text(O).on("mouseover.opacity",function(){r.select(this).transition().duration(f.SHOW_PLACEHOLDER).style("opacity",1)}).on("mouseout.opacity",function(){r.select(this).transition().duration(f.HIDE_PLACEHOLDER).style("opacity",0)})}(),E.call(u.makeEditable,{gd:t}).on("edit",function(e){void 0!==x?o.restyle(t,y,e,x):o.relayout(t,y,e)}).on("cancel",function(){this.text(this.attr("data-unformatted")).call(h)}).on("input",function(t){this.text(t||" ").call(u.positionText,w.x,w.y)})),E.classed("js-placeholder",z)}}},{"../../constants/interactions":133,"../../lib":152,"../../lib/svg_text_utils":169,"../../plotly":184,"../../plots/plots":230,"../color":36,"../drawing":60,d3:8,"fast-isnumeric":11}],126:[function(t,e,n){"use strict";var r=t("../../plots/font_attributes"),a=t("../color/attributes"),o=t("../../lib/extend").extendFlat,i=t("../../plots/pad_attributes"),l={_isLinkedToArray:"button",method:{valType:"enumerated",values:["restyle","relayout","animate","update","skip"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string",dflt:""},execute:{valType:"boolean",dflt:!0}};e.exports={_isLinkedToArray:"updatemenu",_arrayAttrRegexps:[/^updatemenus\[(0|[1-9][0-9]+)\]\.buttons/],visible:{valType:"boolean"},type:{valType:"enumerated",values:["dropdown","buttons"],dflt:"dropdown"},direction:{valType:"enumerated",values:["left","right","up","down"],dflt:"down"},active:{valType:"integer",min:-1,dflt:0},showactive:{valType:"boolean",dflt:!0},buttons:l,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:"top"},pad:o({},i,{}),font:o({},r,{}),bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:a.borderLine},borderwidth:{valType:"number",min:0,dflt:1}}},{"../../lib/extend":145,"../../plots/font_attributes":213,"../../plots/pad_attributes":229,"../color/attributes":35}],127:[function(t,e,n){"use strict";e.exports={name:"updatemenus",containerClassName:"updatemenu-container",headerGroupClassName:"updatemenu-header-group",headerClassName:"updatemenu-header",headerArrowClassName:"updatemenu-header-arrow",dropdownButtonGroupClassName:"updatemenu-dropdown-button-group",dropdownButtonClassName:"updatemenu-dropdown-button",buttonClassName:"updatemenu-button",itemRectClassName:"updatemenu-item-rect",itemTextClassName:"updatemenu-item-text",menuIndexAttrName:"updatemenu-active-index",autoMarginIdRoot:"updatemenu-",blankHeaderOpts:{label:" "},minWidth:30,minHeight:30,textPadX:24,arrowPadX:16,rx:2,ry:2,textOffsetX:12,textOffsetY:3,arrowOffsetX:4,gapButtonHeader:5,gapButton:2,activeColor:"#F4FAFF",hoverColor:"#F4FAFF",arrowSymbol:{left:"\u25c4",right:"\u25ba",up:"\u25b2",down:"\u25bc"}}},{}],128:[function(t,e,n){"use strict";function r(t,e,n){function r(n,r){return o.coerce(t,e,l,n,r)}r("visible",a(t,e).length>0)&&(r("active"),r("direction"),r("type"),r("showactive"),r("x"),r("y"),o.noneOrAll(t,e,["x","y"]),r("xanchor"),r("yanchor"),r("pad.t"),r("pad.r"),r("pad.b"),r("pad.l"),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,u,t,e)}for(var r,a,i=t.buttons||[],l=e.buttons=[],s=0;s0?[0]:[]);if(o.enter().append("g").classed(S.containerClassName,!0).style("cursor","pointer"),o.exit().remove(),o.exit().size()&&_(t),0!==n.length){var u=o.selectAll("g."+S.headerGroupClassName).data(n,a);u.enter().append("g").classed(S.headerGroupClassName,!0);var f=o.selectAll("g."+S.dropdownButtonGroupClassName).data([0]);f.enter().append("g").classed(S.dropdownButtonGroupClassName,!0).style("pointer-events","all");for(var d=0;dk,T=r.barLength+2*r.barPad,L=r.barWidth+2*r.barPad,C=p,S=v+m;S+L>c&&(S=c-L);var z=this.container.selectAll("rect.scrollbar-horizontal").data(A?[0]:[]);z.exit().on(".drag",null).remove(),z.enter().append("rect").classed("scrollbar-horizontal",!0).call(o.fill,r.barColor),A?(this.hbar=z.attr({rx:r.barRadius,ry:r.barRadius,x:C,y:S,width:T,height:L}),this._hbarXMin=C+T/2,this._hbarTranslateMax=k-T):(delete this.hbar,delete this._hbarXMin,delete this._hbarTranslateMax);var O=m>M,P=r.barWidth+2*r.barPad,D=r.barLength+2*r.barPad,E=p+g,N=v;E+P>s&&(E=s-P);var R=this.container.selectAll("rect.scrollbar-vertical").data(O?[0]:[]);R.exit().on(".drag",null).remove(),R.enter().append("rect").classed("scrollbar-vertical",!0).call(o.fill,r.barColor),O?(this.vbar=R.attr({rx:r.barRadius,ry:r.barRadius,x:E,y:N,width:P,height:D}),this._vbarYMin=N+D/2,this._vbarTranslateMax=M-D):(delete this.vbar,delete this._vbarYMin,delete this._vbarTranslateMax);var I=this.id,j=u-.5,F=O?f+P+.5:f+.5,B=d-.5,q=A?h+L+.5:h+.5,H=l._topdefs.selectAll("#"+I).data(A||O?[0]:[]);if(H.exit().remove(),H.enter().append("clipPath").attr("id",I).append("rect"),A||O?(this._clipRect=H.select("rect").attr({x:Math.floor(j),y:Math.floor(B),width:Math.ceil(F)-Math.floor(j),height:Math.ceil(q)-Math.floor(B)}),this.container.call(i.setClipUrl,I),this.bg.attr({x:p,y:v,width:g,height:m})):(this.bg.attr({width:0,height:0}),this.container.on("wheel",null).on(".drag",null).call(i.setClipUrl,null),delete this._clipRect),A||O){var V=a.behavior.drag().on("dragstart",function(){a.event.sourceEvent.preventDefault()}).on("drag",this._onBoxDrag.bind(this));this.container.on("wheel",null).on("wheel",this._onBoxWheel.bind(this)).on(".drag",null).call(V);var U=a.behavior.drag().on("dragstart",function(){a.event.sourceEvent.preventDefault(),a.event.sourceEvent.stopPropagation()}).on("drag",this._onBarDrag.bind(this));A&&this.hbar.on(".drag",null).call(U),O&&this.vbar.on(".drag",null).call(U)}this.setTranslate(e,n)},r.prototype.disable=function(){(this.hbar||this.vbar)&&(this.bg.attr({width:0,height:0}),this.container.on("wheel",null).on(".drag",null).call(i.setClipUrl,null),delete this._clipRect),this.hbar&&(this.hbar.on(".drag",null),this.hbar.remove(),delete this.hbar,delete this._hbarXMin,delete this._hbarTranslateMax),this.vbar&&(this.vbar.on(".drag",null),this.vbar.remove(),delete this.vbar,delete this._vbarYMin,delete this._vbarTranslateMax)},r.prototype._onBoxDrag=function(){var t=this.translateX,e=this.translateY;this.hbar&&(t-=a.event.dx),this.vbar&&(e-=a.event.dy),this.setTranslate(t,e)},r.prototype._onBoxWheel=function(){var t=this.translateX,e=this.translateY;this.hbar&&(t+=a.event.deltaY),this.vbar&&(e+=a.event.deltaY),this.setTranslate(t,e)},r.prototype._onBarDrag=function(){var t=this.translateX,e=this.translateY;if(this.hbar){var n=t+this._hbarXMin,r=n+this._hbarTranslateMax;t=(l.constrain(a.event.x,n,r)-n)/(r-n)*(this.position.w-this._box.w)}if(this.vbar){var o=e+this._vbarYMin,i=o+this._vbarTranslateMax;e=(l.constrain(a.event.y,o,i)-o)/(i-o)*(this.position.h-this._box.h)}this.setTranslate(t,e)},r.prototype.setTranslate=function(t,e){var n=this.position.w-this._box.w,r=this.position.h-this._box.h;if(t=l.constrain(t||0,0,n),e=l.constrain(e||0,0,r),this.translateX=t,this.translateY=e,this.container.call(i.setTranslate,this._box.l-this.position.l-t,this._box.t-this.position.t-e),this._clipRect&&this._clipRect.attr({x:Math.floor(this.position.l+t-.5),y:Math.floor(this.position.t+e-.5)}),this.hbar){var a=t/n;this.hbar.call(i.setTranslate,t+a*this._hbarTranslateMax,e)}if(this.vbar){var o=e/r;this.vbar.call(i.setTranslate,t,e+o*this._vbarTranslateMax)}}},{"../../lib":152,"../color":36,"../drawing":60,d3:8}],132:[function(t,e,n){"use strict";e.exports={FROM_BL:{left:0,center:.5,right:1,bottom:0,middle:.5,top:1},FROM_TL:{left:0,center:.5,right:1,bottom:1,middle:.5,top:0},LINE_SPACING:1.3,MID_SHIFT:.35}},{}],133:[function(t,e,n){"use strict";e.exports={SHOW_PLACEHOLDER:100,HIDE_PLACEHOLDER:1e3,DBLCLICKDELAY:300,DESELECTDIM:.2}},{}],134:[function(t,e,n){"use strict";e.exports={BADNUM:void 0,FP_SAFE:Number.MAX_VALUE/1e4,ONEAVGYEAR:315576e5,ONEAVGMONTH:26298e5,ONEDAY:864e5,ONEHOUR:36e5,ONEMIN:6e4,ONESEC:1e3,EPOCHJD:2440587.5,ALMOST_EQUAL:1-1e-6}},{}],135:[function(t,e,n){"use strict";e.exports={entityToUnicode:{mu:"\u03bc","#956":"\u03bc",amp:"&","#28":"&",lt:"<","#60":"<",gt:">","#62":">",nbsp:"\xa0","#160":"\xa0",times:"\xd7","#215":"\xd7",plusmn:"\xb1","#177":"\xb1",deg:"\xb0","#176":"\xb0"}}},{}],136:[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}},{}],137:[function(t,e,n){"use strict";var r=t("./plotly");n.version="1.29.1",t("es6-promise").polyfill(),t("../build/plotcss"),t("./fonts/mathjax_config"),n.plot=r.plot,n.newPlot=r.newPlot,n.restyle=r.restyle,n.relayout=r.relayout,n.redraw=r.redraw,n.update=r.update,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=t("./plot_api/register"),n.toImage=t("./plot_api/to_image"),n.downloadImage=t("./snapshot/download"),n.validate=t("./plot_api/validate"),n.addFrames=r.addFrames,n.deleteFrames=r.deleteFrames,n.animate=r.animate,n.register(t("./traces/scatter")),n.register([t("./components/fx"),t("./components/legend"),t("./components/annotations"),t("./components/annotations3d"),t("./components/shapes"),t("./components/images"),t("./components/updatemenus"),t("./components/sliders"),t("./components/rangeslider"),t("./components/rangeselector")]),n.Icons=t("../build/ploticon"),n.Plots=r.Plots,n.Fx=t("./components/fx"),n.Snapshot=t("./snapshot"),n.PlotSchema=t("./plot_api/plot_schema"),n.Queue=t("./lib/queue"),n.d3=t("d3")},{"../build/plotcss":1,"../build/ploticon":2,"./components/annotations":29,"./components/annotations3d":34,"./components/fx":77,"./components/images":85,"./components/legend":93,"./components/rangeselector":105,"./components/rangeslider":111,"./components/shapes":118,"./components/sliders":124,"./components/updatemenus":130,"./fonts/mathjax_config":138,"./lib/queue":164,"./plot_api/plot_schema":178,"./plot_api/register":179,"./plot_api/set_plot_config":180,"./plot_api/to_image":182,"./plot_api/validate":183,"./plotly":184,"./snapshot":243,"./snapshot/download":240,"./traces/scatter":267,d3:8,"es6-promise":9}],138:[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},{}],139:[function(t,e,n){"use strict";e.exports=function(t,e,n,r){Array.isArray(t)&&(e[n]=t[r])}},{}],140:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("../constants/numerical").BADNUM,o=/^['"%,$#\s']+|[, ]|['"%,$#\s']+$/g;e.exports=function(t){return"string"==typeof t&&(t=t.replace(o,"")),r(t)?Number(t):a}},{"../constants/numerical":134,"fast-isnumeric":11}],141:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("tinycolor2"),o=t("../plots/attributes"),i=t("../components/colorscale/get_scale"),l=(Object.keys(t("../components/colorscale/scales")),t("./nested_property")),s=/^([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)},validateFunction:function(t,e){e.coerceNumber&&(t=+t);for(var n=e.values,r=0;ra.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;!0!==r.strict&&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;if("string"==typeof t&&t.substr(0,r)===n&&s.test(t.substr(r)))return void e.set(t);e.set(n)},validateFunction:function(t,e){var n=e.dflt,r=n.length;return t===n||"string"==typeof t&&!(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 a=t.split("+"),o=0;o0&&(i=i.replace(/0+$/,"").replace(/[\.]$/,"")),r+=":"+i}return r}function s(t){return t.formatDate("yyyy")}function c(t){return t.formatDate("M yyyy")}function u(t){return t.formatDate("M d")}function f(t){return t.formatDate("M d, yyyy")}var d=t("d3"),h=t("fast-isnumeric"),p=t("./loggers").error,g=t("./mod"),v=t("../constants/numerical"),m=v.BADNUM,y=v.ONEDAY,x=v.ONEHOUR,b=v.ONEMIN,_=v.ONESEC,w=v.EPOCHJD,k=t("../registry"),M=d.time.format.utc,A=/^\s*(-?\d\d\d\d|\d\d)(-(\d?\d)(-(\d?\d)([ Tt]([01]?\d|2[0-3])(:([0-5]\d)(:([0-5]\d(\.\d+)?))?(Z|z|[+\-]\d\d:?\d\d)?)?)?)?)?\s*$/m,T=/^\s*(-?\d\d\d\d|\d\d)(-(\d?\di?)(-(\d?\d)([ Tt]([01]?\d|2[0-3])(:([0-5]\d)(:([0-5]\d(\.\d+)?))?(Z|z|[+\-]\d\d:?\d\d)?)?)?)?)?\s*$/m,L=(new Date).getFullYear()-70;n.dateTick0=function(t,e){return r(t)?e?k.getComponentMethod("calendars","CANONICAL_SUNDAY")[t]:k.getComponentMethod("calendars","CANONICAL_TICK")[t]:e?"2000-01-02":"2000-01-01"},n.dfltRange=function(t){return r(t)?k.getComponentMethod("calendars","DFLTRANGE")[t]:["2000-01-01","2001-01-01"]},n.isJSDate=function(t){return"object"==typeof t&&null!==t&&"function"==typeof t.getTime};var C,S;n.dateTime2ms=function(t,e){if(n.isJSDate(t))return t=Number(t)-t.getTimezoneOffset()*b,t>=C&&t<=S?t:m;if("string"!=typeof t&&"number"!=typeof t)return m;t=String(t);var a=r(e),o=t.charAt(0);!a||"G"!==o&&"g"!==o||(t=t.substr(1),e="");var i=a&&"chinese"===e.substr(0,7),l=t.match(i?T:A);if(!l)return m;var s=l[1],c=l[3]||"1",u=Number(l[5]||1),f=Number(l[7]||0),d=Number(l[9]||0),h=Number(l[11]||0);if(a){if(2===s.length)return m;s=Number(s);var p;try{var g=k.getComponentMethod("calendars","getCal")(e);if(i){var v="i"===c.charAt(c.length-1);c=parseInt(c,10),p=g.newDate(s,g.toMonthIndex(s,c,v),u)}else p=g.newDate(s,Number(c),u)}catch(t){return m}return p?(p.toJD()-w)*y+f*x+d*b+h*_:m}s=2===s.length?(Number(s)+2e3-L)%100+L:Number(s),c-=1;var M=new Date(Date.UTC(2e3,c,u,f,d));return M.setUTCFullYear(s),M.getUTCMonth()!==c?m:M.getUTCDate()!==u?m:M.getTime()+h*_},C=n.MIN_MS=n.dateTime2ms("-9999"),S=n.MAX_MS=n.dateTime2ms("9999-12-31 23:59:59.9999"),n.isDateTime=function(t,e){return n.dateTime2ms(t,e)!==m};var z=90*y,O=3*x,P=5*b;n.ms2DateTime=function(t,e,n){if("number"!=typeof t||!(t>=C&&t<=S))return m;e||(e=0);var a,i,l,s,c,u,f=Math.floor(10*g(t+.05,1)),d=Math.round(t-f/10);if(r(n)){var h=Math.floor(d/y)+w,p=Math.floor(g(t,y));try{a=k.getComponentMethod("calendars","getCal")(n).fromJD(h).formatDate("yyyy-mm-dd")}catch(t){a=M("G%Y-%m-%d")(new Date(d))}if("-"===a.charAt(0))for(;a.length<11;)a="-0"+a.substr(1);else for(;a.length<10;)a="0"+a;i=e=C+y&&t<=S-y))return m;var e=Math.floor(10*g(t+.05,1)),n=new Date(Math.round(t-e/10));return o(d.time.format("%Y-%m-%d")(n),n.getHours(),n.getMinutes(),n.getSeconds(),10*n.getUTCMilliseconds()+e)},n.cleanDate=function(t,e,a){if(n.isJSDate(t)||"number"==typeof t){if(r(a))return p("JS Dates and milliseconds are incompatible with world calendars",t),e;if(!(t=n.ms2DateTimeLocal(+t))&&void 0!==e)return e}else if(!n.isDateTime(t,a))return p("unrecognized date",t),e;return t};var D=/%\d?f/g,E=[59,59.9,59.99,59.999,59.9999],N=M("%Y"),R=M("%b %Y"),I=M("%b %-d"),j=M("%b %-d, %Y");n.formatDate=function(t,e,n,a){var o,d;if(a=r(a)&&a,e)return i(e,t,a);if(a)try{var h=Math.floor((t+.05)/y)+w,p=k.getComponentMethod("calendars","getCal")(a).fromJD(h);"y"===n?d=s(p):"m"===n?d=c(p):"d"===n?(o=s(p),d=u(p)):(o=f(p),d=l(t,n))}catch(t){return"Invalid"}else{var g=new Date(Math.floor(t+.05));"y"===n?d=N(g):"m"===n?d=R(g):"d"===n?(o=N(g),d=I(g)):(o=j(g),d=l(t,n))}return d+(o?"\n"+o:"")};var F=3*y;n.incrementMonth=function(t,e,n){n=r(n)&&n;var a=g(t,y);if(t=Math.round(t-a),n)try{var o=Math.round(t/y)+w,i=k.getComponentMethod("calendars","getCal")(n),l=i.fromJD(o);return e%12?i.add(l,e,"m"):i.add(l,e/12,"y"),(l.toJD()-w)*y+a}catch(e){p("invalid ms "+t+" in calendar "+n)}var s=new Date(t+F);return s.setUTCMonth(s.getUTCMonth()+e)+a-F},n.findExactDates=function(t,e){for(var n,a,o=0,i=0,l=0,s=0,c=r(e)&&k.getComponentMethod("calendars","getCal")(e),u=0;u0&&(a.push(o),o=[])}return o.length>0&&a.push(o),a},n.makeLine=function(t,e){var n={};return n=1===t.length?{type:"LineString",coordinates:t[0]}:{type:"MultiLineString",coordinates:t},e&&(n.trace=e),n},n.makePolygon=function(t,e){var n={};if(1===t.length)n={type:"Polygon",coordinates:t};else{for(var r=new Array(t.length),a=0;a1||g<0||g>1?null:{x:t+s*g,y:e+f*g}}function a(t,e,n,r,a){var o=r*t+a*e;if(o<0)return r*r+a*a;if(o>n){var i=r-t,l=a-e;return i*i+l*l}var s=r*e-a*t;return s*s/n}var o=t("./mod");n.segmentsIntersect=r,n.segmentDistance=function(t,e,n,o,i,l,s,c){if(r(t,e,n,o,i,l,s,c))return 0;var u=n-t,f=o-e,d=s-i,h=c-l,p=u*u+f*f,g=d*d+h*h,v=Math.min(a(u,f,p,i-t,l-e),a(u,f,p,s-t,c-e),a(d,h,g,t-i,e-l),a(d,h,g,n-i,o-l));return Math.sqrt(v)};var i,l,s;n.getTextLocation=function(t,e,n,r){if(t===l&&r===s||(i={},l=t,s=r),i[n])return i[n];var a=t.getPointAtLength(o(n-r/2,e)),c=t.getPointAtLength(o(n+r/2,e)),u=Math.atan((c.y-a.y)/(c.x-a.x)),f=t.getPointAtLength(o(n,e)),d=(4*f.x+a.x+c.x)/6,h=(4*f.y+a.y+c.y)/6,p={x:d,y:h,theta:u};return i[n]=p,p},n.clearLocationCache=function(){l=null},n.getVisibleSegment=function(t,e,n){function r(e){var n=t.getPointAtLength(e);0===e?a=n:e===f&&(o=n);var r=n.xl?n.x-l:0,u=n.yc?n.y-c:0;return Math.sqrt(r*r+u*u)}for(var a,o,i=e.left,l=e.right,s=e.top,c=e.bottom,u=0,f=t.getTotalLength(),d=f,h=r(u);h;){if((u+=h+n)>d)return;h=r(u)}for(h=r(d);h;){if(d-=h+n,u>d)return;h=r(d)}return{min:u,max:d,len:d-u,total:f,isClosed:0===u&&d===f&&Math.abs(a.x-o.x)<.1&&Math.abs(a.y-o.y)<.1}}},{"./mod":157}],151:[function(t,e,n){"use strict";e.exports=function(t){return t}},{}],152:[function(t,e,n){"use strict";var r=t("d3"),a=t("fast-isnumeric"),o=t("../constants/numerical"),i=o.FP_SAFE,l=o.BADNUM,s=e.exports={};s.nestedProperty=t("./nested_property"),s.isPlainObject=t("./is_plain_object"),s.isArray=t("./is_array"),s.mod=t("./mod"),s.toLogRange=t("./to_log_range"),s.relinkPrivateKeys=t("./relink_private"),s.ensureArray=t("./ensure_array");var c=t("./coerce");s.valObjects=c.valObjects,s.coerce=c.coerce,s.coerce2=c.coerce2,s.coerceFont=c.coerceFont,s.coerceHoverinfo=c.coerceHoverinfo,s.validate=c.validate;var u=t("./dates");s.dateTime2ms=u.dateTime2ms,s.isDateTime=u.isDateTime,s.ms2DateTime=u.ms2DateTime,s.ms2DateTimeLocal=u.ms2DateTimeLocal,s.cleanDate=u.cleanDate,s.isJSDate=u.isJSDate,s.formatDate=u.formatDate,s.incrementMonth=u.incrementMonth,s.dateTick0=u.dateTick0,s.dfltRange=u.dfltRange,s.findExactDates=u.findExactDates,s.MIN_MS=u.MIN_MS,s.MAX_MS=u.MAX_MS;var f=t("./search");s.findBin=f.findBin,s.sorterAsc=f.sorterAsc,s.sorterDes=f.sorterDes,s.distinctVals=f.distinctVals,s.roundUp=f.roundUp;var d=t("./stats");s.aggNums=d.aggNums,s.len=d.len,s.mean=d.mean,s.variance=d.variance,s.stdev=d.stdev,s.interp=d.interp;var h=t("./matrix");s.init2dArray=h.init2dArray,s.transposeRagged=h.transposeRagged,s.dot=h.dot,s.translationMatrix=h.translationMatrix,s.rotationMatrix=h.rotationMatrix,s.rotationXYMatrix=h.rotationXYMatrix,s.apply2DTransform=h.apply2DTransform,s.apply2DTransform2=h.apply2DTransform2;var p=t("./geometry2d");s.segmentsIntersect=p.segmentsIntersect,s.segmentDistance=p.segmentDistance,s.getTextLocation=p.getTextLocation,s.clearLocationCache=p.clearLocationCache,s.getVisibleSegment=p.getVisibleSegment;var g=t("./extend");s.extendFlat=g.extendFlat,s.extendDeep=g.extendDeep,s.extendDeepAll=g.extendDeepAll,s.extendDeepNoArrays=g.extendDeepNoArrays;var v=t("./loggers");s.log=v.log,s.warn=v.warn,s.error=v.error,s.notifier=t("./notifier"),s.filterUnique=t("./filter_unique"),s.filterVisible=t("./filter_visible"),s.pushUnique=t("./push_unique"),s.cleanNumber=t("./clean_number"),s.ensureNumber=function(t){return a(t)?(t=Number(t),t<-i||t>i?l:a(t)?Number(t):l):l},s.noop=t("./noop"),s.identity=t("./identity"),s.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))},s.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},s.simpleMap=function(t,e,n,r){for(var a=t.length,o=new Array(a),i=0;i-1||u!==1/0&&u>=Math.pow(2,n)?t(e,n,r):s},s.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},s.smooth=function(t,e){if((e=Math.round(e)||0)<2)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;n=l&&(a-=l*Math.floor(a/l)),a<0?a=-1-a:a>=i&&(a=l-1-a),o+=t[a]*c[r];u[n]=o}return u},s.syncOrAsync=function(t,e,n){function r(){return s.syncOrAsync(t,e,n)}for(var a,o;t.length;)if(o=t.splice(0,1)[0],(a=o(e))&&a.then)return a.then(r).then(void 0,s.promiseError);return n&&n(e)},s.stripTrailingSlash=function(t){return"/"===t.substr(-1)?t.substr(0,t.length-1):t},s.noneOrAll=function(t,e,n){if(t){var r,a,o=!1,i=!0;for(r=0;r1?a+i[1]:"";if(o&&(i.length>1||l.length>4||n))for(;r.test(l);)l=l.replace(r,"$1"+o+"$2");return l+s}},{"../constants/numerical":134,"./clean_number":140,"./coerce":141,"./dates":142,"./ensure_array":143,"./extend":145,"./filter_unique":146,"./filter_visible":147,"./geometry2d":150,"./identity":151,"./is_array":153,"./is_plain_object":154,"./loggers":155,"./matrix":156,"./mod":157,"./nested_property":158,"./noop":159,"./notifier":160,"./push_unique":163,"./relink_private":165,"./search":166,"./stats":168,"./to_log_range":170,d3:8,"fast-isnumeric":11}],153:[function(t,e,n){"use strict";var r="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer:{isView:function(){return!1}};e.exports=function(t){return Array.isArray(t)||r.isView(t)}},{}],154:[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}},{}], +var e=t._fullLayout,n=r(e),o=e._infolayer.selectAll("g."+S.containerClassName).data(n.length>0?[0]:[]);if(o.enter().append("g").classed(S.containerClassName,!0).style("cursor","pointer"),o.exit().remove(),o.exit().size()&&_(t),0!==n.length){var u=o.selectAll("g."+S.headerGroupClassName).data(n,a);u.enter().append("g").classed(S.headerGroupClassName,!0);var f=o.selectAll("g."+S.dropdownButtonGroupClassName).data([0]);f.enter().append("g").classed(S.dropdownButtonGroupClassName,!0).style("pointer-events","all");for(var d=0;dk,T=r.barLength+2*r.barPad,L=r.barWidth+2*r.barPad,C=p,S=v+m;S+L>c&&(S=c-L);var z=this.container.selectAll("rect.scrollbar-horizontal").data(A?[0]:[]);z.exit().on(".drag",null).remove(),z.enter().append("rect").classed("scrollbar-horizontal",!0).call(o.fill,r.barColor),A?(this.hbar=z.attr({rx:r.barRadius,ry:r.barRadius,x:C,y:S,width:T,height:L}),this._hbarXMin=C+T/2,this._hbarTranslateMax=k-T):(delete this.hbar,delete this._hbarXMin,delete this._hbarTranslateMax);var O=m>M,P=r.barWidth+2*r.barPad,D=r.barLength+2*r.barPad,E=p+g,N=v;E+P>s&&(E=s-P);var R=this.container.selectAll("rect.scrollbar-vertical").data(O?[0]:[]);R.exit().on(".drag",null).remove(),R.enter().append("rect").classed("scrollbar-vertical",!0).call(o.fill,r.barColor),O?(this.vbar=R.attr({rx:r.barRadius,ry:r.barRadius,x:E,y:N,width:P,height:D}),this._vbarYMin=N+D/2,this._vbarTranslateMax=M-D):(delete this.vbar,delete this._vbarYMin,delete this._vbarTranslateMax);var I=this.id,j=u-.5,F=O?f+P+.5:f+.5,B=d-.5,q=A?h+L+.5:h+.5,H=l._topdefs.selectAll("#"+I).data(A||O?[0]:[]);if(H.exit().remove(),H.enter().append("clipPath").attr("id",I).append("rect"),A||O?(this._clipRect=H.select("rect").attr({x:Math.floor(j),y:Math.floor(B),width:Math.ceil(F)-Math.floor(j),height:Math.ceil(q)-Math.floor(B)}),this.container.call(i.setClipUrl,I),this.bg.attr({x:p,y:v,width:g,height:m})):(this.bg.attr({width:0,height:0}),this.container.on("wheel",null).on(".drag",null).call(i.setClipUrl,null),delete this._clipRect),A||O){var V=a.behavior.drag().on("dragstart",function(){a.event.sourceEvent.preventDefault()}).on("drag",this._onBoxDrag.bind(this));this.container.on("wheel",null).on("wheel",this._onBoxWheel.bind(this)).on(".drag",null).call(V);var U=a.behavior.drag().on("dragstart",function(){a.event.sourceEvent.preventDefault(),a.event.sourceEvent.stopPropagation()}).on("drag",this._onBarDrag.bind(this));A&&this.hbar.on(".drag",null).call(U),O&&this.vbar.on(".drag",null).call(U)}this.setTranslate(e,n)},r.prototype.disable=function(){(this.hbar||this.vbar)&&(this.bg.attr({width:0,height:0}),this.container.on("wheel",null).on(".drag",null).call(i.setClipUrl,null),delete this._clipRect),this.hbar&&(this.hbar.on(".drag",null),this.hbar.remove(),delete this.hbar,delete this._hbarXMin,delete this._hbarTranslateMax),this.vbar&&(this.vbar.on(".drag",null),this.vbar.remove(),delete this.vbar,delete this._vbarYMin,delete this._vbarTranslateMax)},r.prototype._onBoxDrag=function(){var t=this.translateX,e=this.translateY;this.hbar&&(t-=a.event.dx),this.vbar&&(e-=a.event.dy),this.setTranslate(t,e)},r.prototype._onBoxWheel=function(){var t=this.translateX,e=this.translateY;this.hbar&&(t+=a.event.deltaY),this.vbar&&(e+=a.event.deltaY),this.setTranslate(t,e)},r.prototype._onBarDrag=function(){var t=this.translateX,e=this.translateY;if(this.hbar){var n=t+this._hbarXMin,r=n+this._hbarTranslateMax;t=(l.constrain(a.event.x,n,r)-n)/(r-n)*(this.position.w-this._box.w)}if(this.vbar){var o=e+this._vbarYMin,i=o+this._vbarTranslateMax;e=(l.constrain(a.event.y,o,i)-o)/(i-o)*(this.position.h-this._box.h)}this.setTranslate(t,e)},r.prototype.setTranslate=function(t,e){var n=this.position.w-this._box.w,r=this.position.h-this._box.h;if(t=l.constrain(t||0,0,n),e=l.constrain(e||0,0,r),this.translateX=t,this.translateY=e,this.container.call(i.setTranslate,this._box.l-this.position.l-t,this._box.t-this.position.t-e),this._clipRect&&this._clipRect.attr({x:Math.floor(this.position.l+t-.5),y:Math.floor(this.position.t+e-.5)}),this.hbar){var a=t/n;this.hbar.call(i.setTranslate,t+a*this._hbarTranslateMax,e)}if(this.vbar){var o=e/r;this.vbar.call(i.setTranslate,t,e+o*this._vbarTranslateMax)}}},{"../../lib":152,"../color":36,"../drawing":60,d3:8}],132:[function(t,e,n){"use strict";e.exports={FROM_BL:{left:0,center:.5,right:1,bottom:0,middle:.5,top:1},FROM_TL:{left:0,center:.5,right:1,bottom:1,middle:.5,top:0},LINE_SPACING:1.3,MID_SHIFT:.35}},{}],133:[function(t,e,n){"use strict";e.exports={SHOW_PLACEHOLDER:100,HIDE_PLACEHOLDER:1e3,DBLCLICKDELAY:300,DESELECTDIM:.2}},{}],134:[function(t,e,n){"use strict";e.exports={BADNUM:void 0,FP_SAFE:Number.MAX_VALUE/1e4,ONEAVGYEAR:315576e5,ONEAVGMONTH:26298e5,ONEDAY:864e5,ONEHOUR:36e5,ONEMIN:6e4,ONESEC:1e3,EPOCHJD:2440587.5,ALMOST_EQUAL:1-1e-6}},{}],135:[function(t,e,n){"use strict";e.exports={entityToUnicode:{mu:"\u03bc","#956":"\u03bc",amp:"&","#28":"&",lt:"<","#60":"<",gt:">","#62":">",nbsp:"\xa0","#160":"\xa0",times:"\xd7","#215":"\xd7",plusmn:"\xb1","#177":"\xb1",deg:"\xb0","#176":"\xb0"}}},{}],136:[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}},{}],137:[function(t,e,n){"use strict";var r=t("./plotly");n.version="1.29.2",t("es6-promise").polyfill(),t("../build/plotcss"),t("./fonts/mathjax_config"),n.plot=r.plot,n.newPlot=r.newPlot,n.restyle=r.restyle,n.relayout=r.relayout,n.redraw=r.redraw,n.update=r.update,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=t("./plot_api/register"),n.toImage=t("./plot_api/to_image"),n.downloadImage=t("./snapshot/download"),n.validate=t("./plot_api/validate"),n.addFrames=r.addFrames,n.deleteFrames=r.deleteFrames,n.animate=r.animate,n.register(t("./traces/scatter")),n.register([t("./components/fx"),t("./components/legend"),t("./components/annotations"),t("./components/annotations3d"),t("./components/shapes"),t("./components/images"),t("./components/updatemenus"),t("./components/sliders"),t("./components/rangeslider"),t("./components/rangeselector")]),n.Icons=t("../build/ploticon"),n.Plots=r.Plots,n.Fx=t("./components/fx"),n.Snapshot=t("./snapshot"),n.PlotSchema=t("./plot_api/plot_schema"),n.Queue=t("./lib/queue"),n.d3=t("d3")},{"../build/plotcss":1,"../build/ploticon":2,"./components/annotations":29,"./components/annotations3d":34,"./components/fx":77,"./components/images":85,"./components/legend":93,"./components/rangeselector":105,"./components/rangeslider":111,"./components/shapes":118,"./components/sliders":124,"./components/updatemenus":130,"./fonts/mathjax_config":138,"./lib/queue":164,"./plot_api/plot_schema":178,"./plot_api/register":179,"./plot_api/set_plot_config":180,"./plot_api/to_image":182,"./plot_api/validate":183,"./plotly":184,"./snapshot":243,"./snapshot/download":240,"./traces/scatter":267,d3:8,"es6-promise":9}],138:[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},{}],139:[function(t,e,n){"use strict";e.exports=function(t,e,n,r){Array.isArray(t)&&(e[n]=t[r])}},{}],140:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("../constants/numerical").BADNUM,o=/^['"%,$#\s']+|[, ]|['"%,$#\s']+$/g;e.exports=function(t){return"string"==typeof t&&(t=t.replace(o,"")),r(t)?Number(t):a}},{"../constants/numerical":134,"fast-isnumeric":11}],141:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("tinycolor2"),o=t("../plots/attributes"),i=t("../components/colorscale/get_scale"),l=(Object.keys(t("../components/colorscale/scales")),t("./nested_property")),s=/^([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)},validateFunction:function(t,e){e.coerceNumber&&(t=+t);for(var n=e.values,r=0;ra.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;!0!==r.strict&&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;if("string"==typeof t&&t.substr(0,r)===n&&s.test(t.substr(r)))return void e.set(t);e.set(n)},validateFunction:function(t,e){var n=e.dflt,r=n.length;return t===n||"string"==typeof t&&!(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 a=t.split("+"),o=0;o0&&(i=i.replace(/0+$/,"").replace(/[\.]$/,"")),r+=":"+i}return r}function s(t){return t.formatDate("yyyy")}function c(t){return t.formatDate("M yyyy")}function u(t){return t.formatDate("M d")}function f(t){return t.formatDate("M d, yyyy")}var d=t("d3"),h=t("fast-isnumeric"),p=t("./loggers").error,g=t("./mod"),v=t("../constants/numerical"),m=v.BADNUM,y=v.ONEDAY,x=v.ONEHOUR,b=v.ONEMIN,_=v.ONESEC,w=v.EPOCHJD,k=t("../registry"),M=d.time.format.utc,A=/^\s*(-?\d\d\d\d|\d\d)(-(\d?\d)(-(\d?\d)([ Tt]([01]?\d|2[0-3])(:([0-5]\d)(:([0-5]\d(\.\d+)?))?(Z|z|[+\-]\d\d:?\d\d)?)?)?)?)?\s*$/m,T=/^\s*(-?\d\d\d\d|\d\d)(-(\d?\di?)(-(\d?\d)([ Tt]([01]?\d|2[0-3])(:([0-5]\d)(:([0-5]\d(\.\d+)?))?(Z|z|[+\-]\d\d:?\d\d)?)?)?)?)?\s*$/m,L=(new Date).getFullYear()-70;n.dateTick0=function(t,e){return r(t)?e?k.getComponentMethod("calendars","CANONICAL_SUNDAY")[t]:k.getComponentMethod("calendars","CANONICAL_TICK")[t]:e?"2000-01-02":"2000-01-01"},n.dfltRange=function(t){return r(t)?k.getComponentMethod("calendars","DFLTRANGE")[t]:["2000-01-01","2001-01-01"]},n.isJSDate=function(t){return"object"==typeof t&&null!==t&&"function"==typeof t.getTime};var C,S;n.dateTime2ms=function(t,e){if(n.isJSDate(t))return t=Number(t)-t.getTimezoneOffset()*b,t>=C&&t<=S?t:m;if("string"!=typeof t&&"number"!=typeof t)return m;t=String(t);var a=r(e),o=t.charAt(0);!a||"G"!==o&&"g"!==o||(t=t.substr(1),e="");var i=a&&"chinese"===e.substr(0,7),l=t.match(i?T:A);if(!l)return m;var s=l[1],c=l[3]||"1",u=Number(l[5]||1),f=Number(l[7]||0),d=Number(l[9]||0),h=Number(l[11]||0);if(a){if(2===s.length)return m;s=Number(s);var p;try{var g=k.getComponentMethod("calendars","getCal")(e);if(i){var v="i"===c.charAt(c.length-1);c=parseInt(c,10),p=g.newDate(s,g.toMonthIndex(s,c,v),u)}else p=g.newDate(s,Number(c),u)}catch(t){return m}return p?(p.toJD()-w)*y+f*x+d*b+h*_:m}s=2===s.length?(Number(s)+2e3-L)%100+L:Number(s),c-=1;var M=new Date(Date.UTC(2e3,c,u,f,d));return M.setUTCFullYear(s),M.getUTCMonth()!==c?m:M.getUTCDate()!==u?m:M.getTime()+h*_},C=n.MIN_MS=n.dateTime2ms("-9999"),S=n.MAX_MS=n.dateTime2ms("9999-12-31 23:59:59.9999"),n.isDateTime=function(t,e){return n.dateTime2ms(t,e)!==m};var z=90*y,O=3*x,P=5*b;n.ms2DateTime=function(t,e,n){if("number"!=typeof t||!(t>=C&&t<=S))return m;e||(e=0);var a,i,l,s,c,u,f=Math.floor(10*g(t+.05,1)),d=Math.round(t-f/10);if(r(n)){var h=Math.floor(d/y)+w,p=Math.floor(g(t,y));try{a=k.getComponentMethod("calendars","getCal")(n).fromJD(h).formatDate("yyyy-mm-dd")}catch(t){a=M("G%Y-%m-%d")(new Date(d))}if("-"===a.charAt(0))for(;a.length<11;)a="-0"+a.substr(1);else for(;a.length<10;)a="0"+a;i=e=C+y&&t<=S-y))return m;var e=Math.floor(10*g(t+.05,1)),n=new Date(Math.round(t-e/10));return o(d.time.format("%Y-%m-%d")(n),n.getHours(),n.getMinutes(),n.getSeconds(),10*n.getUTCMilliseconds()+e)},n.cleanDate=function(t,e,a){if(n.isJSDate(t)||"number"==typeof t){if(r(a))return p("JS Dates and milliseconds are incompatible with world calendars",t),e;if(!(t=n.ms2DateTimeLocal(+t))&&void 0!==e)return e}else if(!n.isDateTime(t,a))return p("unrecognized date",t),e;return t};var D=/%\d?f/g,E=[59,59.9,59.99,59.999,59.9999],N=M("%Y"),R=M("%b %Y"),I=M("%b %-d"),j=M("%b %-d, %Y");n.formatDate=function(t,e,n,a){var o,d;if(a=r(a)&&a,e)return i(e,t,a);if(a)try{var h=Math.floor((t+.05)/y)+w,p=k.getComponentMethod("calendars","getCal")(a).fromJD(h);"y"===n?d=s(p):"m"===n?d=c(p):"d"===n?(o=s(p),d=u(p)):(o=f(p),d=l(t,n))}catch(t){return"Invalid"}else{var g=new Date(Math.floor(t+.05));"y"===n?d=N(g):"m"===n?d=R(g):"d"===n?(o=N(g),d=I(g)):(o=j(g),d=l(t,n))}return d+(o?"\n"+o:"")};var F=3*y;n.incrementMonth=function(t,e,n){n=r(n)&&n;var a=g(t,y);if(t=Math.round(t-a),n)try{var o=Math.round(t/y)+w,i=k.getComponentMethod("calendars","getCal")(n),l=i.fromJD(o);return e%12?i.add(l,e,"m"):i.add(l,e/12,"y"),(l.toJD()-w)*y+a}catch(e){p("invalid ms "+t+" in calendar "+n)}var s=new Date(t+F);return s.setUTCMonth(s.getUTCMonth()+e)+a-F},n.findExactDates=function(t,e){for(var n,a,o=0,i=0,l=0,s=0,c=r(e)&&k.getComponentMethod("calendars","getCal")(e),u=0;u0&&(a.push(o),o=[])}return o.length>0&&a.push(o),a},n.makeLine=function(t,e){var n={};return n=1===t.length?{type:"LineString",coordinates:t[0]}:{type:"MultiLineString",coordinates:t},e&&(n.trace=e),n},n.makePolygon=function(t,e){var n={};if(1===t.length)n={type:"Polygon",coordinates:t};else{for(var r=new Array(t.length),a=0;a1||g<0||g>1?null:{x:t+s*g,y:e+f*g}}function a(t,e,n,r,a){var o=r*t+a*e;if(o<0)return r*r+a*a;if(o>n){var i=r-t,l=a-e;return i*i+l*l}var s=r*e-a*t;return s*s/n}var o=t("./mod");n.segmentsIntersect=r,n.segmentDistance=function(t,e,n,o,i,l,s,c){if(r(t,e,n,o,i,l,s,c))return 0;var u=n-t,f=o-e,d=s-i,h=c-l,p=u*u+f*f,g=d*d+h*h,v=Math.min(a(u,f,p,i-t,l-e),a(u,f,p,s-t,c-e),a(d,h,g,t-i,e-l),a(d,h,g,n-i,o-l));return Math.sqrt(v)};var i,l,s;n.getTextLocation=function(t,e,n,r){if(t===l&&r===s||(i={},l=t,s=r),i[n])return i[n];var a=t.getPointAtLength(o(n-r/2,e)),c=t.getPointAtLength(o(n+r/2,e)),u=Math.atan((c.y-a.y)/(c.x-a.x)),f=t.getPointAtLength(o(n,e)),d=(4*f.x+a.x+c.x)/6,h=(4*f.y+a.y+c.y)/6,p={x:d,y:h,theta:u};return i[n]=p,p},n.clearLocationCache=function(){l=null},n.getVisibleSegment=function(t,e,n){function r(e){var n=t.getPointAtLength(e);0===e?a=n:e===f&&(o=n);var r=n.xl?n.x-l:0,u=n.yc?n.y-c:0;return Math.sqrt(r*r+u*u)}for(var a,o,i=e.left,l=e.right,s=e.top,c=e.bottom,u=0,f=t.getTotalLength(),d=f,h=r(u);h;){if((u+=h+n)>d)return;h=r(u)}for(h=r(d);h;){if(d-=h+n,u>d)return;h=r(d)}return{min:u,max:d,len:d-u,total:f,isClosed:0===u&&d===f&&Math.abs(a.x-o.x)<.1&&Math.abs(a.y-o.y)<.1}}},{"./mod":157}],151:[function(t,e,n){"use strict";e.exports=function(t){return t}},{}],152:[function(t,e,n){"use strict";var r=t("d3"),a=t("fast-isnumeric"),o=t("../constants/numerical"),i=o.FP_SAFE,l=o.BADNUM,s=e.exports={};s.nestedProperty=t("./nested_property"),s.isPlainObject=t("./is_plain_object"),s.isArray=t("./is_array"),s.mod=t("./mod"),s.toLogRange=t("./to_log_range"),s.relinkPrivateKeys=t("./relink_private"),s.ensureArray=t("./ensure_array");var c=t("./coerce");s.valObjects=c.valObjects,s.coerce=c.coerce,s.coerce2=c.coerce2,s.coerceFont=c.coerceFont,s.coerceHoverinfo=c.coerceHoverinfo,s.validate=c.validate;var u=t("./dates");s.dateTime2ms=u.dateTime2ms,s.isDateTime=u.isDateTime,s.ms2DateTime=u.ms2DateTime,s.ms2DateTimeLocal=u.ms2DateTimeLocal,s.cleanDate=u.cleanDate,s.isJSDate=u.isJSDate,s.formatDate=u.formatDate,s.incrementMonth=u.incrementMonth,s.dateTick0=u.dateTick0,s.dfltRange=u.dfltRange,s.findExactDates=u.findExactDates,s.MIN_MS=u.MIN_MS,s.MAX_MS=u.MAX_MS;var f=t("./search");s.findBin=f.findBin,s.sorterAsc=f.sorterAsc,s.sorterDes=f.sorterDes,s.distinctVals=f.distinctVals,s.roundUp=f.roundUp;var d=t("./stats");s.aggNums=d.aggNums,s.len=d.len,s.mean=d.mean,s.variance=d.variance,s.stdev=d.stdev,s.interp=d.interp;var h=t("./matrix");s.init2dArray=h.init2dArray,s.transposeRagged=h.transposeRagged,s.dot=h.dot,s.translationMatrix=h.translationMatrix,s.rotationMatrix=h.rotationMatrix,s.rotationXYMatrix=h.rotationXYMatrix,s.apply2DTransform=h.apply2DTransform,s.apply2DTransform2=h.apply2DTransform2;var p=t("./geometry2d");s.segmentsIntersect=p.segmentsIntersect,s.segmentDistance=p.segmentDistance,s.getTextLocation=p.getTextLocation,s.clearLocationCache=p.clearLocationCache,s.getVisibleSegment=p.getVisibleSegment;var g=t("./extend");s.extendFlat=g.extendFlat,s.extendDeep=g.extendDeep,s.extendDeepAll=g.extendDeepAll,s.extendDeepNoArrays=g.extendDeepNoArrays;var v=t("./loggers");s.log=v.log,s.warn=v.warn,s.error=v.error,s.notifier=t("./notifier"),s.filterUnique=t("./filter_unique"),s.filterVisible=t("./filter_visible"),s.pushUnique=t("./push_unique"),s.cleanNumber=t("./clean_number"),s.ensureNumber=function(t){return a(t)?(t=Number(t),t<-i||t>i?l:a(t)?Number(t):l):l},s.noop=t("./noop"),s.identity=t("./identity"),s.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))},s.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},s.simpleMap=function(t,e,n,r){for(var a=t.length,o=new Array(a),i=0;i-1||u!==1/0&&u>=Math.pow(2,n)?t(e,n,r):s},s.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},s.smooth=function(t,e){if((e=Math.round(e)||0)<2)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;n=l&&(a-=l*Math.floor(a/l)),a<0?a=-1-a:a>=i&&(a=l-1-a),o+=t[a]*c[r];u[n]=o}return u},s.syncOrAsync=function(t,e,n){function r(){return s.syncOrAsync(t,e,n)}for(var a,o;t.length;)if(o=t.splice(0,1)[0],(a=o(e))&&a.then)return a.then(r).then(void 0,s.promiseError);return n&&n(e)},s.stripTrailingSlash=function(t){return"/"===t.substr(-1)?t.substr(0,t.length-1):t},s.noneOrAll=function(t,e,n){if(t){var r,a,o=!1,i=!0;for(r=0;r1?a+i[1]:"";if(o&&(i.length>1||l.length>4||n))for(;r.test(l);)l=l.replace(r,"$1"+o+"$2");return l+s}},{"../constants/numerical":134,"./clean_number":140,"./coerce":141,"./dates":142,"./ensure_array":143,"./extend":145,"./filter_unique":146,"./filter_visible":147,"./geometry2d":150,"./identity":151,"./is_array":153,"./is_plain_object":154,"./loggers":155,"./matrix":156,"./mod":157,"./nested_property":158,"./noop":159,"./notifier":160,"./push_unique":163,"./relink_private":165,"./search":166,"./stats":168,"./to_log_range":170,d3:8,"fast-isnumeric":11}],153:[function(t,e,n){"use strict";var r="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer:{isView:function(){return!1}};e.exports=function(t){return Array.isArray(t)||r.isView(t)}},{}],154:[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}},{}], 155:[function(t,e,n){"use strict";function r(t,e){if(t.apply)t.apply(t,e);else for(var n=0;n1){for(var t=["LOG:"],e=0;e0){for(var t=["WARN:"],e=0;e0){for(var t=["ERROR:"],e=0;e=0;e--){if(r=t[e][0],o=t[e][1],s=!1,h(r))for(n=r.length-1;n>=0;n--)a(r[n],i(o,n))?s?r[n]=void 0:r.pop():s=!0;else if("object"==typeof r&&null!==r)for(l=Object.keys(r),s=!1,n=l.length-1;n>=0;n--)a(r[l[n]],i(o,l[n]))?delete r[l[n]]:s=!0;if(s)return}}function u(t){return void 0===t||null===t||"object"==typeof t&&(h(t)?!t.length:!Object.keys(t).length)}function f(t,e,n){return{set:function(){throw"bad container"},get:function(){},astr:e,parts:n,obj:t}}var d=t("fast-isnumeric"),h=t("./is_array"),p=t("./is_plain_object"),g=t("../plot_api/container_array_match");e.exports=function(t,e){if(d(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(".");l/g),l=0;li||r===a||rs)&&(!e||!u(t))}function n(t,e){var n=t[0],c=t[1];if(n===a||ni||c===a||cs)return!1;var u,f,d,h,p,g=r.length,v=r[0][0],m=r[0][1],y=0;for(u=1;uMath.max(f,v)||c>Math.max(d,m)))if(cu||Math.abs(r(i,d))>a)return!0;return!1};o.filter=function(t,e){function n(n){t.push(n);var l=r.length,s=a;r.splice(o+1);for(var c=s+1;c1){n(t.pop())}return{addPt:n,raw:t,filtered:r}}},{"../constants/numerical":134,"./matrix":156}],163:[function(t,e,n){"use strict";e.exports=function(t,e){if(e instanceof RegExp){var n,r=e.toString();for(n=0;no.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;ne}function i(t,e){return t>=e}var l=t("fast-isnumeric"),s=t("./loggers");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;f90&&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;le[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;at.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}],169:[function(t,e,n){"use strict";function r(t,e){return t.node().getBoundingClientRect()[e]}function a(t){return t.replace(m,"\\lt ").replace(y,"\\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){if(!t)return null;var n=t.match(e);return n&&(n[3]||n[4])}function l(t,e){if(!t)return"";for(var n=0;n1)for(var a=1;a doesnt match end tag <"+t+">. Pretending it did match.",e),o=c[c.length-1].node}(M);else{var N=y[4],R={type:M},I=i(N,z);if(I?(I=I.replace(E,"$1 fill:"),A&&(I+=";"+A)):A&&(I=A),I&&(R.style=I),"a"===M){l=!0;var j=i(N,O);if(j){var F=document.createElement("a");F.href=j,-1!==k.indexOf(F.protocol)&&(R.href=encodeURI(j),R.target=i(N,P)||"_blank",R.popup=i(N,D))}}r(R)}}return l}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"),g=t("../constants/alignment").LINE_SPACING,v=/([^$]*)([$]+[^$]*[$]+)([^$]*)/;n.convertToTspans=function(t,e,a){function i(){u.empty()||(d=t.attr("class")+"-math",u.select("svg."+d).remove()),t.text("").style("white-space","pre"),c(t.node(),l)&&t.style("pointer-events","all"),n.positionText(t),a&&a.call(t)}var l=t.text(),s=!t.attr("data-notex")&&"undefined"!=typeof MathJax&&l.match(v),u=f.select(t.node().parentNode);if(!u.empty()){var d=t.attr("class")?t.attr("class").split(" ")[0]:"text";return d+="-math",u.selectAll("svg."+d).remove(),u.selectAll("g."+d+"-group").remove(),t.style("display",null).attr({"data-unformatted":l,"data-math":"N"}),s?(e&&e._promises||[]).push(new Promise(function(e){t.style("display","none");var n={fontSize:parseInt(t.style("font-size"),10)};o(s[2],n,function(n,o,s){u.selectAll("svg."+d).remove(),u.selectAll("g."+d+"-group").remove();var c=n&&n.select("svg");if(!c||!c.node())return i(),void e();var f=u.append("g").classed(d+"-group",!0).attr({"pointer-events":"none","data-unformatted":l,"data-math":"Y"});f.node().appendChild(c.node()),o&&o.node()&&c.node().insertBefore(o.node().cloneNode(!0),c.node().firstChild),c.attr({class:d,height:s.height,preserveAspectRatio:"xMinYMin meet"}).style({overflow:"visible","pointer-events":"none"});var h=t.style("fill")||"black";c.select("g").attr({fill:h,stroke:h});var p=r(c,"width"),g=r(c,"height"),v=+t.attr("x")-p*{start:0,middle:.5,end:1}[t.attr("text-anchor")||"start"],m=parseInt(t.style("font-size"),10)||r(t,"height"),y=-m/4;"y"===d[0]?(f.attr({transform:"rotate("+[-90,+t.attr("x"),+t.attr("y")]+") translate("+[-p/2,y-g/2]+")"}),c.attr({x:+t.attr("x"),y:+t.attr("y")})):"l"===d[0]?c.attr({x:t.attr("x"),y:y-g/2}):"a"===d[0]?c.attr({x:0,y:y}):c.attr({x:v,y:+t.attr("y")+y-g/2}),a&&a.call(t,f),e(f)})})):i(),t}};var m=/(<|<|<)/g,y=/(>|>|>)/g,x={sup:"font-size:70%",sub:"font-size:70%",b:"font-weight:bold",i:"font-style:italic",a:"cursor:pointer",span:"",em:"font-style:italic;font-weight:bold"},b={sub:"0.3em",sup:"-0.6em"},_={sub:"-0.21em",sup:"0.42em"},w="\u200b",k=["http:","https:","mailto:","",void 0,":"],M=new RegExp("]*)?/?>","g"),A=Object.keys(p.entityToUnicode).map(function(t){return{regExp:new RegExp("&"+t+";","g"),sub:p.entityToUnicode[t]}}),T=/(\r\n?|\n)/g,L=/(<[^<>]*>)/,C=/<(\/?)([^ >]*)(\s+(.*))?>/i,S=//i,z=/(^|[\s"'])style\s*=\s*("([^"]*);?"|'([^']*);?')/i,O=/(^|[\s"'])href\s*=\s*("([^"]*)"|'([^']*)')/i,P=/(^|[\s"'])target\s*=\s*("([^"\s]*)"|'([^'\s]*)')/i,D=/(^|[\s"'])popup\s*=\s*("([\w=,]*)"|'([\w=,]*)')/i,E=/(^|;)\s*color:/;n.plainText=function(t){return(t||"").replace(M," ")},n.lineCount=function(t){return t.selectAll("tspan.line").size()||1},n.positionText=function(t,e,n){return t.each(function(){function t(t,e){return void 0===e?null===(e=r.attr(t))&&(r.attr(t,0),e=0):r.attr(t,e),e}var r=f.select(this),a=t("x",e),o=t("y",n);"text"===this.nodeName&&r.selectAll("tspan.line").attr({x:a,y:o})})},n.makeEditable=function(t,e){function n(){a(),t.style({opacity:0});var e,n=s.attr("class");(e=n?"."+n.split(" ")[0]+"-math-group":"[class*=-math-group]")&&f.select(t.node().parentNode).select(e).style({opacity:0})}function r(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 n=f.select(o),a=n.select(".svg-container"),i=a.append("div");i.classed("plugin-editable editable",!0).style({position:"absolute","font-family":t.style("font-family")||"Arial","font-size":t.style("font-size")||12,color:e.fill||t.style("fill")||"black",opacity:1,"background-color":e.background||"transparent",outline:"#ffffff33 1px solid",margin:[-parseFloat(t.style("font-size"))/8+1,0,0,-1].join("px ")+"px",padding:"0","box-sizing":"border-box"}).attr({contenteditable:!0}).text(e.text||t.attr("data-unformatted")).call(u(t,a,e)).on("blur",function(){o._editing=!1,t.text(this.textContent).style({opacity:1});var e,n=f.select(this).attr("class");(e=n?"."+n.split(" ")[0]+"-math-group":"[class*=-math-group]")&&f.select(t.node().parentNode).select(e).style({opacity:0});var r=this.textContent;f.select(this).transition().duration(0).remove(),f.select(document).on("mouseup",null),l.edit.call(t,r)}).on("focus",function(){var t=this;o._editing=!0,f.select(document).on("mouseup",function(){if(f.event.target===t)return!1;document.activeElement===i.node()&&i.node().blur()})}).on("keyup",function(){27===f.event.which?(o._editing=!1,t.style({opacity:1}),f.select(this).style({opacity:0}).on("blur",function(){return!1}).transition().remove(),l.cancel.call(t,this.textContent)):(l.input.call(t,this.textContent),f.select(this).call(u(t,a,e)))}).on("keydown",function(){13===f.event.which&&this.blur()}).call(r)}var o=e.gd,i=e.delegate,l=f.dispatch("edit","input","cancel"),s=i||t;if(t.style({"pointer-events":i?"none":"all"}),1!==t.size())throw new Error("boo");return e.immediate?n():s.on("click",n),f.rebind(t,l,"on")}},{"../constants/alignment":132,"../constants/string_mappings":135,"../constants/xmlns_namespaces":136,"../lib":152,d3:8}],170:[function(t,e,n){"use strict";var r=t("fast-isnumeric");e.exports=function(t,e){if(t>0)return Math.log(t)/Math.LN10;var n=Math.log(Math.min(e[0],e[1]))/Math.LN10;return r(n)||(n=Math.log(Math.max(e[0],e[1]))/Math.LN10-6),n}},{"fast-isnumeric":11}],171:[function(t,e,n){"use strict";var r=e.exports={},a=t("../plots/geo/constants").locationmodeToLayer,o=t("topojson-client").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":215,"topojson-client":18}],172:[function(t,e,n){"use strict";var r=t("../registry");e.exports=function(t){for(var e,n,a=r.layoutArrayContainers,o=r.layoutArrayRegexes,i=t.split("[")[0],l=0;l0)return t.substr(0,e)}var l=t("fast-isnumeric"),s=t("gl-mat4/fromQuat"),c=t("../registry"),u=t("../lib"),f=t("../plots/plots"),d=t("../plots/cartesian/axes"),h=t("../components/color");n.getGraphDiv=function(t){var e;if("string"==typeof t){if(null===(e=document.getElementById(t)))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},n.clearPromiseQueue=function(t){Array.isArray(t._promises)&&t._promises.length>0&&u.log("Clearing previous rejected promises from queue."),t._promises=[]},n.cleanLayout=function(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 a=d.list({_fullLayout:t});for(e=0;e3?(v.x=1.02,v.xanchor="left"):v.x<-2&&(v.x=-.02,v.xanchor="right"),v.y>3?(v.y=1.02,v.yanchor="bottom"):v.y<-2&&(v.y=-.02,v.yanchor="top")),"rotate"===t.dragmode&&(t.dragmode="orbit"),t.scene1&&(t.scene||(t.scene=t.scene1),delete t.scene1);var m=f.getSubplotIds(t,"gl3d");for(e=0;e1&&i.warn("Full array edits are incompatible with other edits",f);var y=n[""][""];if(u(y))e.set(null);else{if(!Array.isArray(y))return i.warn("Unrecognized full array edit value",f,y),!0;e.set(y)}return!g&&(d(v,m),h(t),!0)}var x,b,_,w,k,M,A,T=Object.keys(n).map(Number).sort(l),L=e.get(),C=L||[],S=r(m,f).get(),z=[],O=-1,P=C.length;for(x=0;xC.length-(A?0:1))i.warn("index out of range",f,_);else if(void 0!==M)k.length>1&&i.warn("Insertion & removal are incompatible with edits to the same index.",f,_),u(M)?z.push(_):A?("add"===M&&(M={}),C.splice(_,0,M),S&&S.splice(_,0,{})):i.warn("Unrecognized full object edit value",f,_,M),-1===O&&(O=_);else for(b=0;b=0;x--)C.splice(z[x],1),S&&S.splice(z[x],1);if(C.length?L||e.set(C):e.set(null),g)return!1;if(d(v,m),p!==o){var D;if(-1===O)D=T;else{for(P=Math.max(C.length,P),D=[],x=0;x=O);x++)D.push(_);for(x=O;x=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||a<0&&e.indexOf(t.data.length+a)>-1)throw new Error("each index in "+n+" must be unique.")}}function s(t,e,n){if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if(void 0===e)throw new Error("currentIndices is a required argument.");if(Array.isArray(e)||(e=[e]),l(t,e,"currentIndices"),void 0===n||Array.isArray(n)||(n=[n]),void 0!==n&&l(t,n,"newIndices"),void 0!==n&&e.length!==n.length)throw new Error("current and new indices must be of equal length.")}function c(t,e,n){var r,a;if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if(void 0===e)throw new Error("traces must be defined.");for(Array.isArray(e)||(e=[e]),r=0;r=0&&sV.range[0]?[1,2]:[2,1]);else{var Y=V.range[0],X=V.range[1];U?(Y<=0&&X<=0&&n(I+".autorange",!0),Y<=0?Y=X/1e6:X<=0&&(X=Y/1e6),n(I+".range[0]",Math.log(Y)/Math.LN10),n(I+".range[1]",Math.log(X)/Math.LN10)):(n(I+".range[0]",Math.pow(10,Y)),n(I+".range[1]",Math.pow(10,X)))}else n(I+".autorange",!0);k.getComponentMethod("annotations","convertCoords")(t,B,L,n),k.getComponentMethod("images","convertCoords")(t,B,L,n)}else n(I+".autorange",!0);b.nestedProperty(c,I+"._inputRange").set(null)}else if(D.match(N.AX_NAME_PATTERN)){var Z=b.nestedProperty(c,A).get(),W=(L||{}).type;W&&"-"!==W||(W="linear"),k.getComponentMethod("annotations","convertCoords")(t,Z,W,n),k.getComponentMethod("images","convertCoords")(t,Z,W,n)}var Q=O.containerArrayMatch(A);if(Q){o=Q.array,i=Q.index;var $=Q.property,J=b.nestedProperty(s,o),K=(J||[])[i]||{};if(""===i)-1===A.indexOf("updatemenus")&&(m.docalc=!0);else if(""===$){var tt=L;O.isAddVal(L)?_[A]=null:O.isRemoveVal(L)?(_[A]=K,tt=K):b.warn("unrecognized full object value",e),(r(tt,"x")||r(tt,"y")&&-1===A.indexOf("updatemenus"))&&(m.docalc=!0)}else!r(K,"x")&&!r(K,"y")||b.containsAny(A,["color","opacity","align","dash","updatemenus"])||(m.docalc=!0);d[o]||(d[o]={});var et=d[o][i];et||(et=d[o][i]={}),et[$]=L,delete e[A]}else if("reverse"===D)j.range?j.range.reverse():(n(I+".autorange",!0),j.range=[1,0]),B.autorange?m.docalc=!0:m.doplot=!0;else{var nt=String(T.parts[1]||"");0===z.indexOf("scene")?"camera"===T.parts[1]?m.docamera=!0:m.doplot=!0:0===z.indexOf("geo")?m.doplot=!0:0===z.indexOf("ternary")?m.doplot=!0:"paper_bgcolor"===A?m.doplot=!0:"margin"===z||"autorange"===nt||"rangemode"===nt||"type"===nt||"domain"===nt||"fixedrange"===nt||"scaleanchor"===nt||"scaleratio"===nt||-1!==A.indexOf("calendar")||A.match(/^(bar|box|font)/)?m.docalc=!0:!c._has("gl2d")||-1===A.indexOf("axis")&&"plot_bgcolor"!==A?!c._has("gl2d")||"dragmode"!==A||"lasso"!==L&&"select"!==L||"lasso"===q||"select"===q?"hiddenlabels"===A?m.docalc=!0:-1!==z.indexOf("legend")?m.dolegend=!0:-1!==A.indexOf("title")?m.doticks=!0:-1!==z.indexOf("bgcolor")?m.dolayoutstyle=!0:C>1&&b.containsAny(nt,["tick","exponent","grid","zeroline"])?m.doticks=!0:-1!==A.indexOf(".linewidth")&&-1!==A.indexOf("axis")?m.doticks=m.dolayoutstyle=!0:C>1&&-1!==nt.indexOf("line")?m.dolayoutstyle=!0:C>1&&"mirror"===nt?m.doticks=m.dolayoutstyle=!0:"margin.pad"===A?m.doticks=m.dolayoutstyle=!0:-1!==["hovermode","dragmode"].indexOf(A)||-1!==A.indexOf("spike")?m.domodebar=!0:-1===["height","width","autosize"].indexOf(A)&&(m.doplot=!0):m.docalc=!0:m.doplot=!0,T.set(L)}}}for(o in d){O.applyContainerArrayChanges(t,b.nestedProperty(s,o),d[o],m)||(m.doplot=!0)}var rt=c._axisConstraintGroups;for(v in w)for(i=0;i=l.length?l[0]:l[t]:l}function a(t){return Array.isArray(s)?t>=s.length?s[0]:s[t]:s}function o(t,e){var n=0;return function(){if(t&&++n===e)return t()}}if(t=P.getGraphDiv(t),!b.isPlotDiv(t))throw new Error("This element is not a Plotly plot: "+t+". It's likely that you've failed to create a plot before animating it. For more details, see https://plot.ly/javascript/animations/");var i=t._transitionData;i._frameQueue||(i._frameQueue=[]),n=M.supplyAnimationDefaults(n);var l=n.transition,s=n.frame;return void 0===i._frameWaitingCnt&&(i._frameWaitingCnt=0),new Promise(function(s,c){function u(){t.emit("plotly_animated"),window.cancelAnimationFrame(i._animationRaf),i._animationRaf=null}function f(){i._currentFrame&&i._currentFrame.onComplete&&i._currentFrame.onComplete();var e=i._currentFrame=i._frameQueue.shift();if(e){var n=e.name?e.name.toString():null;t._fullLayout._currentFrame=n,i._lastFrameAt=Date.now(),i._timeToNext=e.frameOpts.duration,M.transition(t,e.frame.data,e.frame.layout,P.coerceTraceIndices(t,e.frame.traces),e.frameOpts,e.transitionOpts).then(function(){e.onComplete&&e.onComplete()}),t.emit("plotly_animatingframe",{name:n,frame:e.frame,animation:{frame:e.frameOpts,transition:e.transitionOpts}})}else u()}function d(){t.emit("plotly_animating"),i._lastFrameAt=-1/0,i._timeToNext=0,i._runningTransitions=0,i._currentFrame=null;var e=function(){i._animationRaf=window.requestAnimationFrame(e),Date.now()-i._lastFrameAt>i._timeToNext&&f()};e()}function h(t){return Array.isArray(l)?v>=l.length?t.transitionOpts=l[v]:t.transitionOpts=l[0]:t.transitionOpts=l,v++,t}var p,g,v=0,m=[],y=void 0===e||null===e,x=Array.isArray(e);if(y||x||!b.isPlainObject(e)){if(y||-1!==["string","number"].indexOf(typeof e))for(p=0;p0&&kk)&&A.push(g);m=A}}m.length>0?function(e){if(0!==e.length){for(var l=0;l=0;a--)if(b.isPlainObject(e[a])){var d=(c[e[a].name]||{}).name,h=e[a].name;d&&h&&"number"==typeof h&&c[d]&&(r++,b.warn('addFrames: overwriting frame "'+c[d].name+'" with a frame whose name of type "number" also equates to "'+d+'". This is valid but may potentially lead to unexpected behavior since all plotly.js frame names are stored internally as strings.'),r>5&&b.warn("addFrames: This API call has yielded too many warnings. For the rest of this call, further warnings about numeric frame names will be suppressed.")),f.push({frame:M.supplyFrameDefaults(e[a]),index:n&&void 0!==n[a]&&null!==n[a]?n[a]:u+a})}f.sort(function(t,e){return t.index>e.index?-1:t.index=0;a--){if(o=f[a].frame,"number"==typeof o.name&&b.warn("Warning: addFrames accepts frames with numeric names, but the numbers areimplicitly cast to strings"),!o.name)for(;c[o.name="frame "+t._transitionData._counter++];);if(c[o.name]){for(i=0;i=0;n--)r=e[n],o.push({type:"delete",index:r}),i.unshift({type:"insert",index:r,value:a[r]});var l=M.modifyFrames,s=M.modifyFrames,c=[t,i],u=[t,o];return w&&w.add(t,l,c,s,u),M.modifyFrames(t,o)},x.purge=function(t){t=P.getGraphDiv(t);var e=t._fullLayout||{},n=t._fullData||[];return M.cleanPlot([],{},n,e),M.purge(t),_.purge(t),e._container&&e._container.remove(),delete t._context,delete t._replotPending,delete t._mouseDownTime,delete t._legendMouseDownTime,delete t._hmpixcount,delete t._hmlumcount,t}},{"../components/drawing":60,"../components/errorbars":66,"../constants/xmlns_namespaces":136,"../lib":152,"../lib/events":144,"../lib/queue":164,"../lib/svg_text_utils":169,"../plotly":184,"../plots/cartesian/axis_ids":192,"../plots/cartesian/constants":194,"../plots/cartesian/constraints":196,"../plots/cartesian/graph_interact":198,"../plots/plots":230,"../plots/polar":233,"../registry":238,"./edit_types":173,"./helpers":174,"./manage_arrays":175,"./subroutines":181,d3:8,"fast-isnumeric":11,"has-hover":13}],177:[function(t,e,n){"use strict";function r(t,n){try{t._fullLayout._paper.style("background",n)}catch(t){e.exports.logging>0&&console.error(t)}}e.exports={staticPlot:!1,editable:!1,edits:{annotationPosition:!1,annotationTail:!1,annotationText:!1,axisTitleText:!1,colorbarPosition:!1,colorbarTitleText:!1,legendPosition:!1,legendText:!1,shapePosition:!1,titleText:!1},autosizable:!1,queueLength:0,fillFrame:!1,frameMargins:0,scrollZoom:!1,doubleClick:"reset+autosize",showTips:!0,showAxisDragHandles:!0,showAxisRangeEntryBoxes:!0,showLink:!1,sendData:!0,linkText:"Edit chart",showSources:!1,displayModeBar:"hover",modeBarButtonsToRemove:[],modeBarButtonsToAdd:[],modeBarButtons:!1,displaylogo:!0,plotGlPixelRatio:2,setBackground:r,topojsonURL:"https://cdn.plot.ly/",mapboxAccessToken:null,logging:!1,globalTransforms:[]}},{}],178:[function(t,e,n){"use strict";function r(t){var e,n;"area"===t?(e={attributes:x},n={}):(e=h.modules[t]._module,n=e.basePlotModule);var r={};r.type=null,k(r,g),k(r,e.attributes),n.attributes&&k(r,n.attributes),Object.keys(h.componentsRegistry).forEach(function(e){var n=h.componentsRegistry[e];n.schema&&n.schema.traces&&n.schema.traces[t]&&Object.keys(n.schema.traces[t]).forEach(function(e){d(r,n.schema.traces[t][e],e)})}),r.type=t;var a={meta:e.meta||{},attributes:l(r)};if(e.layoutAttributes){var o={};k(o,e.layoutAttributes),a.layoutAttributes=l(o)}return a}function a(){var t={};return k(t,v),Object.keys(h.subplotsRegistry).forEach(function(e){var n=h.subplotsRegistry[e];if(n.layoutAttributes)if("cartesian"===n.name)f(t,n,"xaxis"),f(t,n,"yaxis");else{var r="subplot"===n.attr?n.name:n.attr;f(t,n,r)}}),t=u(t),Object.keys(h.componentsRegistry).forEach(function(e){var n=h.componentsRegistry[e];n.layoutAttributes&&(n.schema&&n.schema.layout?Object.keys(n.schema.layout).forEach(function(e){d(t,n.schema.layout[e],e)}):d(t,n.layoutAttributes,n.name))}),{layoutAttributes:l(t)}}function o(t){var e=h.transformsRegistry[t],n=k({},e.attributes);return Object.keys(h.componentsRegistry).forEach(function(e){var r=h.componentsRegistry[e];r.schema&&r.schema.transforms&&r.schema.transforms[t]&&Object.keys(r.schema.transforms[t]).forEach(function(e){d(n,r.schema.transforms[t][e],e)})}),{attributes:l(n)}}function i(){var t={frames:p.extendDeep({},m)};return l(t),t.frames}function l(t){return s(t),c(t),t}function s(t){function e(t){return{valType:"string"}}function r(t,r,a){n.isValObject(t)?"data_array"===t.valType?(t.role="data",a[r+"src"]=e(r)):!0===t.arrayOk&&(a[r+"src"]=e(r)):p.isPlainObject(t)&&(t.role="object")}n.crawl(t,r)}function c(t){function e(t,e,n){if(t){var r=t[A];r&&(delete t[A],n[e]={items:{}},n[e].items[r]=t,n[e].role="object")}}n.crawl(t,e)}function u(t){return w(t,{radialaxis:b.radialaxis,angularaxis:b.angularaxis}),w(t,b.layout),t}function f(t,e,n){var r=p.nestedProperty(t,n),a=k({},e.layoutAttributes);a[M]=!0,r.set(a)}function d(t,e,n){var r=p.nestedProperty(t,n);r.set(k(r.get()||{},e))}var h=t("../registry"),p=t("../lib"),g=t("../plots/attributes"),v=t("../plots/layout_attributes"),m=t("../plots/frame_attributes"),y=t("../plots/animation_attributes"),x=t("../plots/polar/area_attributes"),b=t("../plots/polar/axis_attributes"),_=t("./edit_types"),w=p.extendFlat,k=p.extendDeep,M="_isSubplotObj",A="_isLinkedToArray",T=[M,A,"_arrayAttrRegexps","_deprecated"];n.IS_SUBPLOT_OBJ=M,n.IS_LINKED_TO_ARRAY=A,n.DEPRECATED="_deprecated",n.UNDERSCORE_ATTRS=T,n.get=function(){var t={};h.allTypes.concat("area").forEach(function(e){t[e]=r(e)});var e={};return Object.keys(h.transformsRegistry).forEach(function(t){e[t]=o(t)}),{defs:{valObjects:p.valObjects,metaKeys:T.concat(["description","role"]),editTypes:{traces:_.traces(),layout:_.layout()}},traces:t,layout:a(),transforms:e,frames:i(),animation:l(y)}},n.crawl=function(t,e,r){var a=r||0;Object.keys(t).forEach(function(r){var o=t[r];-1===T.indexOf(r)&&(e(o,r,t,a),n.isValObject(o)||p.isPlainObject(o)&&n.crawl(o,e,a+1))})},n.isValObject=function(t){return t&&void 0!==t.valType},n.findArrayAttributes=function(t){function e(e,n,i,l){if(o=o.slice(0,l).concat([n]),e&&("data_array"===e.valType||!0===e.arrayOk)&&!("colorbar"===o[l-1]&&("ticktext"===n||"tickvals"===n))){var s=r(o),c=p.nestedProperty(t,s).get();Array.isArray(c)&&a.push(s)}}function r(t){return t.join(".")}var a=[],o=[];if(n.crawl(g,e),t._module&&t._module.attributes&&n.crawl(t._module.attributes,e),t.transforms)for(var i=t.transforms,l=0;l=t[1]||a[1]<=t[0])&&(o[0]e[0]))return!0}return!1}function a(t,e,n){return t._anchorAxis===e&&(t.mirror||t.side===n)||"all"===t.mirror||"allticks"===t.mirror||t.mirrors&&t.mirrors[e._id+n]}function o(t,e,n){var r=[],a=e._anchorAxis;if(a){var o=a._mainAxis;if(-1===r.indexOf(o)){r.push(o);for(var i=0;i1)};d(e.width)&&d(e.height)||r(new Error("Height and width should be pixel values."));var h=s(t,{format:"png",height:e.height,width:e.width}),p=h.gd;p.style.position="absolute",p.style.left="-5000px",document.body.appendChild(p);var g=l.getRedrawFunc(p);o.plot(p,h.data,h.layout,h.config).then(g).then(f).then(function(t){n(t)}).catch(function(t){r(t)})})}var a=t("fast-isnumeric"),o=t("../plotly"),i=t("../lib"),l=t("../snapshot/helpers"),s=t("../snapshot/cloneplot"),c=t("../snapshot/tosvg"),u=t("../snapshot/svgtoimg");e.exports=r},{"../lib":152,"../plotly":184,"../snapshot/cloneplot":239,"../snapshot/helpers":242,"../snapshot/svgtoimg":244,"../snapshot/tosvg":246,"fast-isnumeric":11}],183:[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;m.3*f||o(r)||o(a))){var d=n.dtick/2;t+=t+d.8){var i=Number(n.substr(1));o.exactYears>.8&&i%12==0?t=N.tickIncrement(t,"M6","reverse")+1.5*z:o.exactMonths>.8?t=N.tickIncrement(t,"M1","reverse")+15.5*z:t-=z/2;var l=N.tickIncrement(t,n);if(l<=r)return l}return t}function o(t){var e,n,r=t.tickvals,a=t.ticktext,o=new Array(r.length),i=_.simpleMap(t.range,t.r2l),l=1.0001*i[0]-1e-4*i[1],c=1.0001*i[1]-1e-4*i[0],u=Math.min(l,c),f=Math.max(l,c),d=0;Array.isArray(a)||(a=[]);var h="category"===t.type?t.d2l_noadd:t.d2l;for("log"===t.type&&"L"!==String(t.dtick).charAt(0)&&(t.dtick="L"+Math.pow(10,Math.floor(Math.min(t.range[0],t.range[1]))-1)),n=0;nu&&e10||"01-01"!==r.substr(5)?t._tickround="d":t._tickround=+e.substr(1)%12==0?"y":"m";else if(e>=z&&a<=10||e>=15*z)t._tickround="d";else if(e>=P&&a<=16||e>=O)t._tickround="M";else if(e>=D&&a<=19||e>=P)t._tickround="S";else{var o=t.l2r(n+e).replace(/^-/,"").length;t._tickround=Math.max(a,o)-20}}else if(x(e)||"L"===e.charAt(0)){var i=t.range.map(t.r2d||Number);x(e)||(e=Number(e.substr(1))),t._tickround=2-Math.floor(Math.log(e)/Math.LN10+.01);var l=Math.max(Math.abs(i[0]),Math.abs(i[1])),s=Math.floor(Math.log(l)/Math.LN10+.01);Math.abs(s)>3&&("SI"===t.exponentformat||"B"===t.exponentformat?t._tickexponent=3*Math.round((s-1)/3):t._tickexponent=s)}else t._tickround=null}function s(t,e,n){var r=t.tickfont||{};return{x:e,dx:0,dy:0,text:n||"",fontSize:r.size,font:r.family,fontColor:r.color}}function c(t,e,n,r){var a=t._tickround,o=n&&t.hoverformat||t.tickformat;r&&(a=x(a)?4:{y:"m",m:"d",d:"M",M:"S",S:4}[a]);var i,l=_.formatDate(e.x,o,a,t.calendar),s=l.indexOf("\n");-1!==s&&(i=l.substr(s+1),l=l.substr(0,s)),r&&("00:00:00"===l||"00:00"===l?(l=i,i=""):8===l.length&&(l=l.replace(/:00$/,""))),i&&(n?"d"===a?l+=", "+i:l=i+(l?", "+l:""):t._inCalcTicks&&i===t._prevDateHead||(l+="
"+i,t._prevDateHead=i)),e.text=l}function u(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=h(Math.pow(10,i),t,a,r);else if(x(o)||"D"===o.charAt(0)&&_.mod(i+.01,1)<.1)if(-1!==["e","E","power"].indexOf(t.exponentformat)){var l=Math.round(i);e.text=0===l?1:1===l?"10":l>1?"10"+l+"":"10\u2212"+-l+"",e.fontSize*=1.25}else e.text=h(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,_.mod(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*(i<0?.5:.25)))}}function f(t,e){var n=t._categories[Math.round(e.x)];void 0===n&&(n=""),e.text=String(n)}function d(t,e,n,r,a){"all"===t.showexponent&&Math.abs(e.x/t.dtick)<1e-6&&(a="hide"),e.text=h(e.x,t,a,r)}function h(t,e,n,r){var a=t<0,o=e._tickround,i=n||e.exponentformat||"B",s=e._tickexponent,c=e.tickformat,u=e.separatethousands;if(r){var f={exponentformat:e.exponentformat,dtick:"none"===e.showexponent?e.dtick:x(t)?Math.abs(t)||1:1,range:"none"===e.showexponent?e.range.map(e.r2d):[0,t||1]};l(f),o=(Number(f._tickround)||0)+4,s=f._tickexponent,e.hoverformat&&(c=e.hoverformat)}if(c)return y.format(c)(t).replace(/-/g,"\u2212");var d=Math.pow(10,-o)/2;if("none"===i&&(s=0),(t=Math.abs(t))12||s<-15)?t+="e"+g:"E"===i?t+="E"+g:"power"===i?t+="\xd710"+g+"":"B"===i&&9===s?t+="B":"SI"!==i&&"B"!==i||(t+=U[s/3+5])}return a?"\u2212"+t:t}function p(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},N.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){ diff --git a/dist/plotly-gl2d.js b/dist/plotly-gl2d.js index 4fc456739a3..130adc9b4c4 100644 --- a/dist/plotly-gl2d.js +++ b/dist/plotly-gl2d.js @@ -1,5 +1,5 @@ /** -* plotly.js (gl2d) v1.29.1 +* plotly.js (gl2d) v1.29.2 * Copyright 2012-2017, Plotly, Inc. * All rights reserved. * Licensed under the MIT license @@ -9046,6 +9046,8 @@ function fromNumber (n, normalized) { } },{"clamp":48}],52:[function(require,module,exports){ +'use strict' + module.exports = { "aliceblue": [240, 248, 255], "antiquewhite": [250, 235, 215], @@ -9195,8 +9197,10 @@ module.exports = { "whitesmoke": [245, 245, 245], "yellow": [255, 255, 0], "yellowgreen": [154, 205, 50] -}; +}; + },{}],53:[function(require,module,exports){ +(function (global){ /** * @module color-parse */ @@ -9360,7 +9364,7 @@ function parse (cstr) { } //array - else if (Array.isArray(cstr) || ArrayBuffer.isView(cstr)) { + else if (Array.isArray(cstr) || global.ArrayBuffer && ArrayBuffer.isView && ArrayBuffer.isView(cstr)) { parts = [cstr[0], cstr[1], cstr[2]]; space = 'rgb' alpha = cstr.length === 4 ? cstr[3] : 1; @@ -9373,6 +9377,7 @@ function parse (cstr) { }; } +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) },{"color-name":52,"is-plain-obj":156}],54:[function(require,module,exports){ /** @module color-rgba */ @@ -9383,14 +9388,14 @@ var hsl = require('color-space/hsl') var clamp = require('clamp') module.exports = function rgba (color, normalize) { + if (Array.isArray(color)) return color; + if (normalize == null) normalize = true var parsed = parse(color); if (!parsed.space) return []; - if (Array.isArray(color)) return color; - var values = parsed.values, i, l = values.length; for (i = 0; i < l; i++) { values[i] = clamp(values[i], 0, 255) @@ -24737,7 +24742,7 @@ arguments[4][47][0].apply(exports,arguments) },{"dup":47}],86:[function(require,module,exports){ -exports.lineVertex = "precision highp float;\n#define GLSLIFY 1\n\nattribute vec2 aHi, aLo, dHi, dLo;\n\nuniform vec2 scaleHi, translateHi, scaleLo, translateLo, screenShape;\nuniform float width;\n\nvarying vec2 direction;\n\n\nvec2 project_2_0(vec2 scHi, vec2 trHi, vec2 scLo, vec2 trLo, vec2 posHi, vec2 posLo) {\n return (posHi + trHi) * scHi\n + (posLo + trLo) * scHi\n + (posHi + trHi) * scLo\n + (posLo + trLo) * scLo;\n}\n\n\nvec2 project_1_1(vec2 scHi, vec2 scLo, vec2 posHi, vec2 posLo) {\n return scHi * posHi\n + scLo * posHi\n + scHi * posLo\n + scLo * posLo;\n}\n\nvoid main() {\n vec2 p = project_2_0(scaleHi, translateHi, scaleLo, translateLo, aHi, aLo);\n vec2 dir = project_1_1(scaleHi, scaleLo, dHi, dLo);\n vec2 n = 0.5 * width * 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(p + n, 0.0, 1.0);\n}" +exports.lineVertex = "precision highp float;\n#define GLSLIFY 1\n\nattribute vec2 aHi, aLo, dHi, dLo;\n\nuniform vec2 scaleHi, translateHi, scaleLo, translateLo, screenShape;\nuniform float width;\n\nvarying vec2 direction;\n\n\nvec2 project_1_0(vec2 scHi, vec2 trHi, vec2 scLo, vec2 trLo, vec2 posHi, vec2 posLo) {\n return (posHi + trHi) * scHi\n + (posLo + trLo) * scHi\n + (posHi + trHi) * scLo\n + (posLo + trLo) * scLo;\n}\n\n\nvec2 project_2_1(vec2 scHi, vec2 scLo, vec2 posHi, vec2 posLo) {\n return scHi * posHi\n + scLo * posHi\n + scHi * posLo\n + scLo * posLo;\n}\n\nvoid main() {\n vec2 p = project_1_0(scaleHi, translateHi, scaleLo, translateLo, aHi, aLo);\n vec2 dir = project_2_1(scaleHi, scaleLo, dHi, dLo);\n vec2 n = 0.5 * width * 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(p + n, 0.0, 1.0);\n}" exports.lineFragment = "precision highp 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}" exports.mitreVertex = "precision highp float;\n#define GLSLIFY 1\n\nattribute vec2 aHi, aLo;\n\nuniform vec2 scaleHi, translateHi, scaleLo, translateLo;\nuniform float radius;\n\n\nvec2 project_1_0(vec2 scHi, vec2 trHi, vec2 scLo, vec2 trLo, vec2 posHi, vec2 posLo) {\n return (posHi + trHi) * scHi\n + (posLo + trLo) * scHi\n + (posHi + trHi) * scLo\n + (posLo + trLo) * scLo;\n}\n\n\nvoid main() {\n vec2 p = project_1_0(scaleHi, translateHi, scaleLo, translateLo, aHi, aLo);\n gl_Position = vec4(p, 0.0, 1.0);\n gl_PointSize = radius;\n}" exports.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}" @@ -65048,7 +65053,7 @@ exports.svgAttrs = { var Plotly = require('./plotly'); // package version injected by `npm run preprocess` -exports.version = '1.29.1'; +exports.version = '1.29.2'; // inject promise polyfill require('es6-promise').polyfill(); diff --git a/dist/plotly-gl2d.min.js b/dist/plotly-gl2d.min.js index 99ef3f2a1ee..19a4d6b9f4a 100644 --- a/dist/plotly-gl2d.min.js +++ b/dist/plotly-gl2d.min.js @@ -1,5 +1,5 @@ /** -* plotly.js (gl2d - minified) v1.29.1 +* plotly.js (gl2d - minified) v1.29.2 * Copyright 2012-2017, Plotly, Inc. * All rights reserved. * Licensed under the MIT license @@ -7,38 +7,38 @@ !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 t(e,r,n){function a(o,s){if(!r[o]){if(!e[o]){var l="function"==typeof require&&require;if(!s&&l)return l(o,!0);if(i)return i(o,!0);var u=new Error("Cannot find module '"+o+"'");throw u.code="MODULE_NOT_FOUND",u}var c=r[o]={exports:{}};e[o][0].call(c.exports,function(t){var r=e[o][1][t];return a(r||t)},c,c.exports,t,e,r,n)}return r[o].exports}for(var i="function"==typeof require&&require,o=0;oa&&(a=t[o]),t[o]0?r=r.ushln(f):f<0&&(c=c.ushln(-f)),l(r,c)}var a=t("./is-rat"),i=t("./lib/is-bn"),o=t("./lib/num-to-bn"),s=t("./lib/str-to-bn"),l=t("./lib/rationalize"),u=t("./div");e.exports=n},{"./div":16,"./is-rat":18,"./lib/is-bn":22,"./lib/num-to-bn":23,"./lib/rationalize":24,"./lib/str-to-bn":25}],18:[function(t,e,r){"use strict";function n(t){return Array.isArray(t)&&2===t.length&&a(t[0])&&a(t[1])}var a=t("./lib/is-bn");e.exports=n},{"./lib/is-bn":22}],19:[function(t,e,r){"use strict";function n(t){return t.cmp(new a(0))}var a=t("bn.js");e.exports=n},{"bn.js":32}],20:[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 i=0;i20?52:r+32}var a=t("double-bits"),i=t("bit-twiddle").countTrailingZeros;e.exports=n},{"bit-twiddle":31,"double-bits":63}],22:[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":32}],23:[function(t,e,r){"use strict";function n(t){var e=i.exponent(t);return e<52?new a(t):new a(t*Math.pow(2,52-e)).ushln(e-52)}var a=t("bn.js"),i=t("double-bits");e.exports=n},{"bn.js":32,"double-bits":63}],24:[function(t,e,r){"use strict";function n(t,e){var r=i(t),n=i(e);if(0===r)return[a(0),a(1)];if(0===n)return[a(0),a(0)];n<0&&(t=t.neg(),e=e.neg());var o=t.gcd(e);return o.cmpn(1)?[t.div(o),e.div(o)]:[t,e]}var a=t("./num-to-bn"),i=t("./bn-sign");e.exports=n},{"./bn-sign":19,"./num-to-bn":23}],25:[function(t,e,r){"use strict";function n(t){return new a(t)}var a=t("bn.js");e.exports=n},{"bn.js":32}],26:[function(t,e,r){"use strict";function n(t,e){return a(t[0].mul(e[0]),t[1].mul(e[1]))}var a=t("./lib/rationalize");e.exports=n},{"./lib/rationalize":24}],27:[function(t,e,r){"use strict";function n(t){return a(t[0])*a(t[1])}var a=t("./lib/bn-sign");e.exports=n},{"./lib/bn-sign":19}],28:[function(t,e,r){"use strict";function n(t,e){return a(t[0].mul(e[1]).sub(t[1].mul(e[0])),t[1].mul(e[1]))}var a=t("./lib/rationalize");e.exports=n},{"./lib/rationalize":24}],29:[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.abs().divmod(r.abs()),o=n.div,s=a(o),l=n.mod,u=e.negative!==r.negative?-1:1;if(0===l.cmpn(0))return u*s;if(s){var c=i(s)+4,f=a(l.ushln(c).divRound(r));return u*(s+f*Math.pow(2,-c))}var h=r.bitLength()-l.bitLength()+53,f=a(l.ushln(h).divRound(r));return h<1023?u*f*Math.pow(2,-h):(f*=Math.pow(2,-1023),u*f*Math.pow(2,1023-h))}var a=t("./lib/bn-to-num"),i=t("./lib/ctz");e.exports=n},{"./lib/bn-to-num":20,"./lib/ctz":21}],30:[function(t,e,r){"use strict";function n(t,e,r,n,a,i){var o=["function ",t,"(a,l,h,",n.join(","),"){",i?"":"var i=",r?"l-1":"h+1",";while(l<=h){var m=(l+h)>>>1,x=a",a?".get(m)":"[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 a(t,e,r,a){return new Function([n("A","x"+t+"y",e,["y"],!1,a),n("B","x"+t+"y",e,["y"],!0,a),n("P","c(x,y)"+t+"0",e,["y","c"],!1,a),n("Q","c(x,y)"+t+"0",e,["y","c"],!0,a),"function dispatchBsearch",r,"(a,y,c,l,h){if(a.shape){if(typeof(c)==='function'){return Q(a,(l===undefined)?0:l|0,(h===undefined)?a.shape[0]-1:h|0,y,c)}else{return B(a,(c===undefined)?0:c|0,(l===undefined)?a.shape[0]-1:l|0,y)}}else{if(typeof(c)==='function'){return P(a,(l===undefined)?0:l|0,(h===undefined)?a.length-1:h|0,y,c)}else{return A(a,(c===undefined)?0:c|0,(l===undefined)?a.length-1:l|0,y)}}}return dispatchBsearch",r].join(""))()}e.exports={ge:a(">=",!1,"GE"),gt:a(">",!1,"GT"),lt:a("<",!0,"LT"),le:a("<=",!0,"LE"),eq:a("-",!0,"EQ",!0)}},{}],31:[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}r.INT_BITS=32,r.INT_MAX=2147483647,r.INT_MIN=-1<<31,r.sign=function(t){return(t>0)-(t<0)},r.abs=function(t){var e=t>>31;return(t^e)-e},r.min=function(t,e){return e^(t^e)&-(t65535)<<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)|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,16843009*((t=(858993459&t)+(t>>>2&858993459))+(t>>>4)&252645135)>>>24},r.countTrailingZeros=n,r.nextPow2=function(t){return t+=0===t,--t,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,(t|=t>>>16)+1},r.prevPow2=function(t){return t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,(t|=t>>>16)-(t>>>1)},r.parity=function(t){return t^=t>>>16,t^=t>>>8,t^=t>>>4,27030>>>(t&=15)&1};var a=new Array(256);!function(t){for(var e=0;e<256;++e){var r=e,n=e,a=7;for(r>>>=1;r;r>>>=1)n<<=1,n|=1&r,--a;t[e]=n<>>8&255]<<16|a[t>>>16&255]<<8|a[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))<<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))<<22>>22},r.nextCombination=function(t){var e=t|t-1;return e+1|(~e&-~e)-1>>>n(t)+1}},{}],32:[function(t,e,r){!function(e,r){"use strict";function n(t,e){if(!t)throw new Error(e||"Assertion failed")}function a(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){if(i.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}function o(t,e,r){for(var n=0,a=Math.min(t.length,r),i=e;i=49&&o<=54?o-49+10:o>=17&&o<=22?o-17+10:15&o}return n}function s(t,e,r,n){for(var a=0,i=Math.min(t.length,r),o=e;o=49?s-49+10:s>=17?s-17+10:s}return a}function l(t){for(var e=new Array(t.bitLength()),r=0;r>>a}return e}function u(t,e,r){r.negative=e.negative^t.negative;var n=t.length+e.length|0;r.length=n,n=n-1|0;var a=0|t.words[0],i=0|e.words[0],o=a*i,s=67108863&o,l=o/67108864|0;r.words[0]=s;for(var u=1;u>>26,f=67108863&l,h=Math.min(u,e.length-1),d=Math.max(0,u-t.length+1);d<=h;d++){var p=u-d|0;a=0|t.words[p],i=0|e.words[d],o=a*i+f,c+=o/67108864|0,f=67108863&o}r.words[u]=0|f,l=0|c}return 0!==l?r.words[u]=0|l:r.length--,r.strip()}function c(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var n=0,a=0,i=0;i>>26)|0,a+=o>>>26,o&=67108863}r.words[i]=s,n=o,o=a}return 0!==n?r.words[i]=n:r.length--,r.strip()}function f(t,e,r){return(new h).mulp(t,e,r)}function h(t,e){this.x=t,this.y=e}function d(t,e){this.name=t,this.p=new i(e,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function p(){d.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function g(){d.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function m(){d.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function v(){d.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function y(t){if("string"==typeof t){var e=i._prime(t);this.m=e.p,this.prime=e}else n(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function b(t){y.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new i(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}"object"==typeof e?e.exports=i:r.BN=i,i.BN=i,i.wordSize=26;var x;try{x=t("buffer").Buffer}catch(t){}i.isBN=function(t){return t instanceof i||null!==t&&"object"==typeof t&&t.constructor.wordSize===i.wordSize&&Array.isArray(t.words)},i.max=function(t,e){return t.cmp(e)>0?t:e},i.min=function(t,e){return t.cmp(e)<0?t:e},i.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),n(e===(0|e)&&e>=2&&e<=36),t=t.toString().replace(/\s+/g,"");var a=0;"-"===t[0]&&a++,16===e?this._parseHex(t,a):this._parseBase(t,e,a),"-"===t[0]&&(this.negative=1),this.strip(),"le"===r&&this._initArray(this.toArray(),e,r)},i.prototype._initNumber=function(t,e,r){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(n(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),e,r)},i.prototype._initArray=function(t,e,r){if(n("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var a=0;a=0;a-=3)o=t[a]|t[a-1]<<8|t[a-2]<<16,this.words[i]|=o<>>26-s&67108863,(s+=24)>=26&&(s-=26,i++);else if("le"===r)for(a=0,i=0;a>>26-s&67108863,(s+=24)>=26&&(s-=26,i++);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)a=o(t,r,r+6),this.words[n]|=a<>>26-i&4194303,(i+=24)>=26&&(i-=26,n++);r+6!==e&&(a=o(t,e,r+6),this.words[n]|=a<>>26-i&4194303),this.strip()},i.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var n=0,a=1;a<=67108863;a*=e)n++;n--,a=a/e|0;for(var i=t.length-r,o=i%n,l=Math.min(i,i-o)+r,u=0,c=r;c1&&0===this.words[this.length-1];)this.length--;return this._normSign()},i.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},i.prototype.inspect=function(){return(this.red?""};var _=["","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"],w=[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],A=[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){t=t||10,e=0|e||1;var r;if(16===t||"hex"===t){r="";for(var a=0,i=0,o=0;o>>24-a&16777215,r=0!==i||o!==this.length-1?_[6-l.length]+l+r:l+r,a+=2,a>=26&&(a-=26,o--)}for(0!==i&&(r=i.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var u=w[t],c=A[t];r="";var f=this.clone();for(f.negative=0;!f.isZero();){var h=f.modn(c).toString(t);f=f.idivn(c),r=f.isZero()?h+r:_[u-h.length]+h+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},i.prototype.toJSON=function(){return this.toString(16)},i.prototype.toBuffer=function(t,e){return n(void 0!==x),this.toArrayLike(x,t,e)},i.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},i.prototype.toArrayLike=function(t,e,r){var a=this.byteLength(),i=r||Math.max(1,a);n(a<=i,"byte array longer than desired length"),n(i>0,"Requested array length <= 0"),this.strip();var o,s,l="le"===e,u=new t(i),c=this.clone();if(l){for(s=0;!c.isZero();s++)o=c.andln(255),c.iushrn(8),u[s]=o;for(;s=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=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},i.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},i.prototype.iuand=function(t){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.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},i.prototype.iuxor=function(t){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.uxor=function(t){ return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},i.prototype.inotn=function(t){n("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var a=0;a0&&(this.words[a]=~this.words[a]&67108863>>26-r),this.strip()},i.prototype.notn=function(t){return this.clone().inotn(t)},i.prototype.setn=function(t,e){n("number"==typeof t&&t>=0);var r=t/26|0,a=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(r=this,n=t):(r=t,n=this);for(var a=0,i=0;i>>26;for(;0!==a&&i>>26;if(this.length=r.length,0!==a)this.words[this.length]=a,this.length++;else if(r!==this)for(;it.length?this.clone().iadd(t):t.clone().iadd(this)},i.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r=this.cmp(t);if(0===r)return this.negative=0,this.length=1,this.words[0]=0,this;var n,a;r>0?(n=this,a=t):(n=t,a=this);for(var i=0,o=0;o>26,this.words[o]=67108863&e;for(;0!==i&&o>26,this.words[o]=67108863&e;if(0===i&&o>>13,d=0|o[1],p=8191&d,g=d>>>13,m=0|o[2],v=8191&m,y=m>>>13,b=0|o[3],x=8191&b,_=b>>>13,w=0|o[4],A=8191&w,k=w>>>13,M=0|o[5],T=8191&M,E=M>>>13,L=0|o[6],S=8191&L,C=L>>>13,O=0|o[7],I=8191&O,R=O>>>13,D=0|o[8],P=8191&D,z=D>>>13,N=0|o[9],F=8191&N,B=N>>>13,j=0|s[0],H=8191&j,U=j>>>13,V=0|s[1],G=8191&V,q=V>>>13,X=0|s[2],Y=8191&X,W=X>>>13,Z=0|s[3],Q=8191&Z,$=Z>>>13,K=0|s[4],J=8191&K,tt=K>>>13,et=0|s[5],rt=8191&et,nt=et>>>13,at=0|s[6],it=8191&at,ot=at>>>13,st=0|s[7],lt=8191&st,ut=st>>>13,ct=0|s[8],ft=8191&ct,ht=ct>>>13,dt=0|s[9],pt=8191&dt,gt=dt>>>13;r.negative=t.negative^e.negative,r.length=19,n=Math.imul(f,H),a=Math.imul(f,U),a=a+Math.imul(h,H)|0,i=Math.imul(h,U);var mt=(u+n|0)+((8191&a)<<13)|0;u=(i+(a>>>13)|0)+(mt>>>26)|0,mt&=67108863,n=Math.imul(p,H),a=Math.imul(p,U),a=a+Math.imul(g,H)|0,i=Math.imul(g,U),n=n+Math.imul(f,G)|0,a=a+Math.imul(f,q)|0,a=a+Math.imul(h,G)|0,i=i+Math.imul(h,q)|0;var vt=(u+n|0)+((8191&a)<<13)|0;u=(i+(a>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(v,H),a=Math.imul(v,U),a=a+Math.imul(y,H)|0,i=Math.imul(y,U),n=n+Math.imul(p,G)|0,a=a+Math.imul(p,q)|0,a=a+Math.imul(g,G)|0,i=i+Math.imul(g,q)|0,n=n+Math.imul(f,Y)|0,a=a+Math.imul(f,W)|0,a=a+Math.imul(h,Y)|0,i=i+Math.imul(h,W)|0;var yt=(u+n|0)+((8191&a)<<13)|0;u=(i+(a>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(x,H),a=Math.imul(x,U),a=a+Math.imul(_,H)|0,i=Math.imul(_,U),n=n+Math.imul(v,G)|0,a=a+Math.imul(v,q)|0,a=a+Math.imul(y,G)|0,i=i+Math.imul(y,q)|0,n=n+Math.imul(p,Y)|0,a=a+Math.imul(p,W)|0,a=a+Math.imul(g,Y)|0,i=i+Math.imul(g,W)|0,n=n+Math.imul(f,Q)|0,a=a+Math.imul(f,$)|0,a=a+Math.imul(h,Q)|0,i=i+Math.imul(h,$)|0;var bt=(u+n|0)+((8191&a)<<13)|0;u=(i+(a>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(A,H),a=Math.imul(A,U),a=a+Math.imul(k,H)|0,i=Math.imul(k,U),n=n+Math.imul(x,G)|0,a=a+Math.imul(x,q)|0,a=a+Math.imul(_,G)|0,i=i+Math.imul(_,q)|0,n=n+Math.imul(v,Y)|0,a=a+Math.imul(v,W)|0,a=a+Math.imul(y,Y)|0,i=i+Math.imul(y,W)|0,n=n+Math.imul(p,Q)|0,a=a+Math.imul(p,$)|0,a=a+Math.imul(g,Q)|0,i=i+Math.imul(g,$)|0,n=n+Math.imul(f,J)|0,a=a+Math.imul(f,tt)|0,a=a+Math.imul(h,J)|0,i=i+Math.imul(h,tt)|0;var xt=(u+n|0)+((8191&a)<<13)|0;u=(i+(a>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(T,H),a=Math.imul(T,U),a=a+Math.imul(E,H)|0,i=Math.imul(E,U),n=n+Math.imul(A,G)|0,a=a+Math.imul(A,q)|0,a=a+Math.imul(k,G)|0,i=i+Math.imul(k,q)|0,n=n+Math.imul(x,Y)|0,a=a+Math.imul(x,W)|0,a=a+Math.imul(_,Y)|0,i=i+Math.imul(_,W)|0,n=n+Math.imul(v,Q)|0,a=a+Math.imul(v,$)|0,a=a+Math.imul(y,Q)|0,i=i+Math.imul(y,$)|0,n=n+Math.imul(p,J)|0,a=a+Math.imul(p,tt)|0,a=a+Math.imul(g,J)|0,i=i+Math.imul(g,tt)|0,n=n+Math.imul(f,rt)|0,a=a+Math.imul(f,nt)|0,a=a+Math.imul(h,rt)|0,i=i+Math.imul(h,nt)|0;var _t=(u+n|0)+((8191&a)<<13)|0;u=(i+(a>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(S,H),a=Math.imul(S,U),a=a+Math.imul(C,H)|0,i=Math.imul(C,U),n=n+Math.imul(T,G)|0,a=a+Math.imul(T,q)|0,a=a+Math.imul(E,G)|0,i=i+Math.imul(E,q)|0,n=n+Math.imul(A,Y)|0,a=a+Math.imul(A,W)|0,a=a+Math.imul(k,Y)|0,i=i+Math.imul(k,W)|0,n=n+Math.imul(x,Q)|0,a=a+Math.imul(x,$)|0,a=a+Math.imul(_,Q)|0,i=i+Math.imul(_,$)|0,n=n+Math.imul(v,J)|0,a=a+Math.imul(v,tt)|0,a=a+Math.imul(y,J)|0,i=i+Math.imul(y,tt)|0,n=n+Math.imul(p,rt)|0,a=a+Math.imul(p,nt)|0,a=a+Math.imul(g,rt)|0,i=i+Math.imul(g,nt)|0,n=n+Math.imul(f,it)|0,a=a+Math.imul(f,ot)|0,a=a+Math.imul(h,it)|0,i=i+Math.imul(h,ot)|0;var wt=(u+n|0)+((8191&a)<<13)|0;u=(i+(a>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(I,H),a=Math.imul(I,U),a=a+Math.imul(R,H)|0,i=Math.imul(R,U),n=n+Math.imul(S,G)|0,a=a+Math.imul(S,q)|0,a=a+Math.imul(C,G)|0,i=i+Math.imul(C,q)|0,n=n+Math.imul(T,Y)|0,a=a+Math.imul(T,W)|0,a=a+Math.imul(E,Y)|0,i=i+Math.imul(E,W)|0,n=n+Math.imul(A,Q)|0,a=a+Math.imul(A,$)|0,a=a+Math.imul(k,Q)|0,i=i+Math.imul(k,$)|0,n=n+Math.imul(x,J)|0,a=a+Math.imul(x,tt)|0,a=a+Math.imul(_,J)|0,i=i+Math.imul(_,tt)|0,n=n+Math.imul(v,rt)|0,a=a+Math.imul(v,nt)|0,a=a+Math.imul(y,rt)|0,i=i+Math.imul(y,nt)|0,n=n+Math.imul(p,it)|0,a=a+Math.imul(p,ot)|0,a=a+Math.imul(g,it)|0,i=i+Math.imul(g,ot)|0,n=n+Math.imul(f,lt)|0,a=a+Math.imul(f,ut)|0,a=a+Math.imul(h,lt)|0,i=i+Math.imul(h,ut)|0;var At=(u+n|0)+((8191&a)<<13)|0;u=(i+(a>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(P,H),a=Math.imul(P,U),a=a+Math.imul(z,H)|0,i=Math.imul(z,U),n=n+Math.imul(I,G)|0,a=a+Math.imul(I,q)|0,a=a+Math.imul(R,G)|0,i=i+Math.imul(R,q)|0,n=n+Math.imul(S,Y)|0,a=a+Math.imul(S,W)|0,a=a+Math.imul(C,Y)|0,i=i+Math.imul(C,W)|0,n=n+Math.imul(T,Q)|0,a=a+Math.imul(T,$)|0,a=a+Math.imul(E,Q)|0,i=i+Math.imul(E,$)|0,n=n+Math.imul(A,J)|0,a=a+Math.imul(A,tt)|0,a=a+Math.imul(k,J)|0,i=i+Math.imul(k,tt)|0,n=n+Math.imul(x,rt)|0,a=a+Math.imul(x,nt)|0,a=a+Math.imul(_,rt)|0,i=i+Math.imul(_,nt)|0,n=n+Math.imul(v,it)|0,a=a+Math.imul(v,ot)|0,a=a+Math.imul(y,it)|0,i=i+Math.imul(y,ot)|0,n=n+Math.imul(p,lt)|0,a=a+Math.imul(p,ut)|0,a=a+Math.imul(g,lt)|0,i=i+Math.imul(g,ut)|0,n=n+Math.imul(f,ft)|0,a=a+Math.imul(f,ht)|0,a=a+Math.imul(h,ft)|0,i=i+Math.imul(h,ht)|0;var kt=(u+n|0)+((8191&a)<<13)|0;u=(i+(a>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(F,H),a=Math.imul(F,U),a=a+Math.imul(B,H)|0,i=Math.imul(B,U),n=n+Math.imul(P,G)|0,a=a+Math.imul(P,q)|0,a=a+Math.imul(z,G)|0,i=i+Math.imul(z,q)|0,n=n+Math.imul(I,Y)|0,a=a+Math.imul(I,W)|0,a=a+Math.imul(R,Y)|0,i=i+Math.imul(R,W)|0,n=n+Math.imul(S,Q)|0,a=a+Math.imul(S,$)|0,a=a+Math.imul(C,Q)|0,i=i+Math.imul(C,$)|0,n=n+Math.imul(T,J)|0,a=a+Math.imul(T,tt)|0,a=a+Math.imul(E,J)|0,i=i+Math.imul(E,tt)|0,n=n+Math.imul(A,rt)|0,a=a+Math.imul(A,nt)|0,a=a+Math.imul(k,rt)|0,i=i+Math.imul(k,nt)|0,n=n+Math.imul(x,it)|0,a=a+Math.imul(x,ot)|0,a=a+Math.imul(_,it)|0,i=i+Math.imul(_,ot)|0,n=n+Math.imul(v,lt)|0,a=a+Math.imul(v,ut)|0,a=a+Math.imul(y,lt)|0,i=i+Math.imul(y,ut)|0,n=n+Math.imul(p,ft)|0,a=a+Math.imul(p,ht)|0,a=a+Math.imul(g,ft)|0,i=i+Math.imul(g,ht)|0,n=n+Math.imul(f,pt)|0,a=a+Math.imul(f,gt)|0,a=a+Math.imul(h,pt)|0,i=i+Math.imul(h,gt)|0;var Mt=(u+n|0)+((8191&a)<<13)|0;u=(i+(a>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(F,G),a=Math.imul(F,q),a=a+Math.imul(B,G)|0,i=Math.imul(B,q),n=n+Math.imul(P,Y)|0,a=a+Math.imul(P,W)|0,a=a+Math.imul(z,Y)|0,i=i+Math.imul(z,W)|0,n=n+Math.imul(I,Q)|0,a=a+Math.imul(I,$)|0,a=a+Math.imul(R,Q)|0,i=i+Math.imul(R,$)|0,n=n+Math.imul(S,J)|0,a=a+Math.imul(S,tt)|0,a=a+Math.imul(C,J)|0,i=i+Math.imul(C,tt)|0,n=n+Math.imul(T,rt)|0,a=a+Math.imul(T,nt)|0,a=a+Math.imul(E,rt)|0,i=i+Math.imul(E,nt)|0,n=n+Math.imul(A,it)|0,a=a+Math.imul(A,ot)|0,a=a+Math.imul(k,it)|0,i=i+Math.imul(k,ot)|0,n=n+Math.imul(x,lt)|0,a=a+Math.imul(x,ut)|0,a=a+Math.imul(_,lt)|0,i=i+Math.imul(_,ut)|0,n=n+Math.imul(v,ft)|0,a=a+Math.imul(v,ht)|0,a=a+Math.imul(y,ft)|0,i=i+Math.imul(y,ht)|0,n=n+Math.imul(p,pt)|0,a=a+Math.imul(p,gt)|0,a=a+Math.imul(g,pt)|0,i=i+Math.imul(g,gt)|0;var Tt=(u+n|0)+((8191&a)<<13)|0;u=(i+(a>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(F,Y),a=Math.imul(F,W),a=a+Math.imul(B,Y)|0,i=Math.imul(B,W),n=n+Math.imul(P,Q)|0,a=a+Math.imul(P,$)|0,a=a+Math.imul(z,Q)|0,i=i+Math.imul(z,$)|0,n=n+Math.imul(I,J)|0,a=a+Math.imul(I,tt)|0,a=a+Math.imul(R,J)|0,i=i+Math.imul(R,tt)|0,n=n+Math.imul(S,rt)|0,a=a+Math.imul(S,nt)|0,a=a+Math.imul(C,rt)|0,i=i+Math.imul(C,nt)|0,n=n+Math.imul(T,it)|0,a=a+Math.imul(T,ot)|0,a=a+Math.imul(E,it)|0,i=i+Math.imul(E,ot)|0,n=n+Math.imul(A,lt)|0,a=a+Math.imul(A,ut)|0,a=a+Math.imul(k,lt)|0,i=i+Math.imul(k,ut)|0,n=n+Math.imul(x,ft)|0,a=a+Math.imul(x,ht)|0,a=a+Math.imul(_,ft)|0,i=i+Math.imul(_,ht)|0,n=n+Math.imul(v,pt)|0,a=a+Math.imul(v,gt)|0,a=a+Math.imul(y,pt)|0,i=i+Math.imul(y,gt)|0;var Et=(u+n|0)+((8191&a)<<13)|0;u=(i+(a>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(F,Q),a=Math.imul(F,$),a=a+Math.imul(B,Q)|0,i=Math.imul(B,$),n=n+Math.imul(P,J)|0,a=a+Math.imul(P,tt)|0,a=a+Math.imul(z,J)|0,i=i+Math.imul(z,tt)|0,n=n+Math.imul(I,rt)|0,a=a+Math.imul(I,nt)|0,a=a+Math.imul(R,rt)|0,i=i+Math.imul(R,nt)|0,n=n+Math.imul(S,it)|0,a=a+Math.imul(S,ot)|0,a=a+Math.imul(C,it)|0,i=i+Math.imul(C,ot)|0,n=n+Math.imul(T,lt)|0,a=a+Math.imul(T,ut)|0,a=a+Math.imul(E,lt)|0,i=i+Math.imul(E,ut)|0,n=n+Math.imul(A,ft)|0,a=a+Math.imul(A,ht)|0,a=a+Math.imul(k,ft)|0,i=i+Math.imul(k,ht)|0,n=n+Math.imul(x,pt)|0,a=a+Math.imul(x,gt)|0,a=a+Math.imul(_,pt)|0,i=i+Math.imul(_,gt)|0;var Lt=(u+n|0)+((8191&a)<<13)|0;u=(i+(a>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,n=Math.imul(F,J),a=Math.imul(F,tt),a=a+Math.imul(B,J)|0,i=Math.imul(B,tt),n=n+Math.imul(P,rt)|0,a=a+Math.imul(P,nt)|0,a=a+Math.imul(z,rt)|0,i=i+Math.imul(z,nt)|0,n=n+Math.imul(I,it)|0,a=a+Math.imul(I,ot)|0,a=a+Math.imul(R,it)|0,i=i+Math.imul(R,ot)|0,n=n+Math.imul(S,lt)|0,a=a+Math.imul(S,ut)|0,a=a+Math.imul(C,lt)|0,i=i+Math.imul(C,ut)|0,n=n+Math.imul(T,ft)|0,a=a+Math.imul(T,ht)|0,a=a+Math.imul(E,ft)|0,i=i+Math.imul(E,ht)|0,n=n+Math.imul(A,pt)|0,a=a+Math.imul(A,gt)|0,a=a+Math.imul(k,pt)|0,i=i+Math.imul(k,gt)|0;var St=(u+n|0)+((8191&a)<<13)|0;u=(i+(a>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(F,rt),a=Math.imul(F,nt),a=a+Math.imul(B,rt)|0,i=Math.imul(B,nt),n=n+Math.imul(P,it)|0,a=a+Math.imul(P,ot)|0,a=a+Math.imul(z,it)|0,i=i+Math.imul(z,ot)|0,n=n+Math.imul(I,lt)|0,a=a+Math.imul(I,ut)|0,a=a+Math.imul(R,lt)|0,i=i+Math.imul(R,ut)|0,n=n+Math.imul(S,ft)|0,a=a+Math.imul(S,ht)|0,a=a+Math.imul(C,ft)|0,i=i+Math.imul(C,ht)|0,n=n+Math.imul(T,pt)|0,a=a+Math.imul(T,gt)|0,a=a+Math.imul(E,pt)|0,i=i+Math.imul(E,gt)|0;var Ct=(u+n|0)+((8191&a)<<13)|0;u=(i+(a>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,n=Math.imul(F,it),a=Math.imul(F,ot),a=a+Math.imul(B,it)|0,i=Math.imul(B,ot),n=n+Math.imul(P,lt)|0,a=a+Math.imul(P,ut)|0,a=a+Math.imul(z,lt)|0,i=i+Math.imul(z,ut)|0,n=n+Math.imul(I,ft)|0,a=a+Math.imul(I,ht)|0,a=a+Math.imul(R,ft)|0,i=i+Math.imul(R,ht)|0,n=n+Math.imul(S,pt)|0,a=a+Math.imul(S,gt)|0,a=a+Math.imul(C,pt)|0,i=i+Math.imul(C,gt)|0;var Ot=(u+n|0)+((8191&a)<<13)|0;u=(i+(a>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,n=Math.imul(F,lt),a=Math.imul(F,ut),a=a+Math.imul(B,lt)|0,i=Math.imul(B,ut),n=n+Math.imul(P,ft)|0,a=a+Math.imul(P,ht)|0,a=a+Math.imul(z,ft)|0,i=i+Math.imul(z,ht)|0,n=n+Math.imul(I,pt)|0,a=a+Math.imul(I,gt)|0,a=a+Math.imul(R,pt)|0,i=i+Math.imul(R,gt)|0;var It=(u+n|0)+((8191&a)<<13)|0;u=(i+(a>>>13)|0)+(It>>>26)|0,It&=67108863,n=Math.imul(F,ft),a=Math.imul(F,ht),a=a+Math.imul(B,ft)|0,i=Math.imul(B,ht),n=n+Math.imul(P,pt)|0,a=a+Math.imul(P,gt)|0,a=a+Math.imul(z,pt)|0,i=i+Math.imul(z,gt)|0;var Rt=(u+n|0)+((8191&a)<<13)|0;u=(i+(a>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,n=Math.imul(F,pt),a=Math.imul(F,gt),a=a+Math.imul(B,pt)|0,i=Math.imul(B,gt);var Dt=(u+n|0)+((8191&a)<<13)|0;return u=(i+(a>>>13)|0)+(Dt>>>26)|0,Dt&=67108863,l[0]=mt,l[1]=vt,l[2]=yt,l[3]=bt,l[4]=xt,l[5]=_t,l[6]=wt,l[7]=At,l[8]=kt,l[9]=Mt,l[10]=Tt,l[11]=Et,l[12]=Lt,l[13]=St,l[14]=Ct,l[15]=Ot,l[16]=It,l[17]=Rt,l[18]=Dt,0!==u&&(l[19]=u,r.length++),r};Math.imul||(k=u),i.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?k(this,t,e):r<63?u(this,t,e):r<1024?c(this,t,e):f(this,t,e)},h.prototype.makeRBT=function(t){for(var e=new Array(t),r=i.prototype._countBits(t)-1,n=0;n>=1;return n},h.prototype.permute=function(t,e,r,n,a,i){for(var o=0;o>>=1)a++;return 1<>>=13,r[2*o+1]=8191&i,i>>>=13;for(o=2*e;o>=26,e+=a/67108864|0,e+=i>>>26,this.words[r]=67108863&i}return 0!==e&&(this.words[r]=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.imul(this.clone())},i.prototype.pow=function(t){var e=l(t);if(0===e.length)return new i(1);for(var r=this,n=0;n=0);var e,r=t%26,a=(t-r)/26,i=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(e=0;e>>26-r}o&&(this.words[e]=o,this.length++)}if(0!==a){for(e=this.length-1;e>=0;e--)this.words[e+a]=this.words[e];for(e=0;e=0);var a;a=e?(e-e%26)/26:0;var i=t%26,o=Math.min((t-i)/26,this.length),s=67108863^67108863>>>i<o)for(this.length-=o,u=0;u=0&&(0!==c||u>=a);u--){var f=0|this.words[u];this.words[u]=c<<26-i|f>>>i,c=f&s}return l&&0!==c&&(l.words[l.length++]=c),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},i.prototype.ishrn=function(t,e,r){return n(0===this.negative),this.iushrn(t,e,r)},i.prototype.shln=function(t){return this.clone().ishln(t)},i.prototype.ushln=function(t){return this.clone().iushln(t)},i.prototype.shrn=function(t){return this.clone().ishrn(t)},i.prototype.ushrn=function(t){return this.clone().iushrn(t)},i.prototype.testn=function(t){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,a=1<=0);var e=t%26,r=(t-e)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var a=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},i.prototype.isubn=function(t){if(n("number"==typeof t),n(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(l/67108864|0),this.words[a+r]=67108863&o}for(;a>26,this.words[a+r]=67108863&o;if(0===s)return this.strip();for(n(-1===s),s=0,a=0;a>26,this.words[a]=67108863&o;return this.negative=1,this.strip()},i.prototype._wordDiv=function(t,e){var r=this.length-t.length,n=this.clone(),a=t,o=0|a.words[a.length-1];0!==(r=26-this._countBits(o))&&(a=a.ushln(r),n.iushln(r),o=0|a.words[a.length-1]);var s,l=n.length-a.length;if("mod"!==e){s=new i(null),s.length=l+1,s.words=new Array(s.length);for(var u=0;u=0;f--){var h=67108864*(0|n.words[a.length+f])+(0|n.words[a.length+f-1]);for(h=Math.min(h/o|0,67108863),n._ishlnsubmul(a,h,f);0!==n.negative;)h--,n.negative=0,n._ishlnsubmul(a,1,f),n.isZero()||(n.negative^=1);s&&(s.words[f]=h)}return s&&s.strip(),n.strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:s||null,mod:n}},i.prototype.divmod=function(t,e,r){if(n(!t.isZero()),this.isZero())return{div:new i(0),mod:new i(0)};var a,o,s;return 0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(a=s.div.neg()),"div"!==e&&(o=s.mod.neg(),r&&0!==o.negative&&o.iadd(t)),{div:a,mod:o}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(a=s.div.neg()),{div:a,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(o=s.mod.neg(),r&&0!==o.negative&&o.isub(t)),{div:s.div,mod:o}):t.length>this.length||this.cmp(t)<0?{div:new 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",!1).div},i.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},i.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},i.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,n=t.ushrn(1),a=t.andln(1),i=r.cmp(n);return i<0||1===a&&0===i?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},i.prototype.modn=function(t){n(t<=67108863);for(var e=(1<<26)%t,r=0,a=this.length-1;a>=0;a--)r=(e*r+(0|this.words[a]))%t;return r},i.prototype.idivn=function(t){n(t<=67108863);for(var e=0,r=this.length-1;r>=0;r--){var a=(0|this.words[r])+67108864*e;this.words[r]=a/t|0,e=a%t}return this.strip()},i.prototype.divn=function(t){return this.clone().idivn(t)},i.prototype.egcd=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var a=new i(1),o=new i(0),s=new i(0),l=new i(1),u=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++u;for(var c=r.clone(),f=e.clone();!e.isZero();){for(var h=0,d=1;0==(e.words[0]&d)&&h<26;++h,d<<=1);if(h>0)for(e.iushrn(h);h-- >0;)(a.isOdd()||o.isOdd())&&(a.iadd(c),o.isub(f)),a.iushrn(1),o.iushrn(1);for(var p=0,g=1;0==(r.words[0]&g)&&p<26;++p,g<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(s.isOdd()||l.isOdd())&&(s.iadd(c),l.isub(f)),s.iushrn(1),l.iushrn(1);e.cmp(r)>=0?(e.isub(r),a.isub(s),o.isub(l)):(r.isub(e),s.isub(a),l.isub(o))}return{a:s,b:l,gcd:r.iushln(u)}},i.prototype._invmp=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var a=new i(1),o=new i(0),s=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var l=0,u=1;0==(e.words[0]&u)&&l<26;++l,u<<=1);if(l>0)for(e.iushrn(l);l-- >0;)a.isOdd()&&a.iadd(s),a.iushrn(1);for(var c=0,f=1;0==(r.words[0]&f)&&c<26;++c,f<<=1);if(c>0)for(r.iushrn(c);c-- >0;)o.isOdd()&&o.iadd(s),o.iushrn(1);e.cmp(r)>=0?(e.isub(r),a.isub(o)):(r.isub(e),o.isub(a))}var h;return h=0===e.cmpn(1)?a:o,h.cmpn(0)<0&&h.iadd(t),h},i.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var n=0;e.isEven()&&r.isEven();n++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var a=e.cmp(r);if(a<0){var i=e;e=r,r=i}else if(0===a||0===r.cmpn(1))break;e.isub(r)}return r.iushln(n)},i.prototype.invm=function(t){return this.egcd(t).a.umod(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){n("number"==typeof t);var e=t%26,r=(t-e)/26,a=1<>>26,s&=67108863,this.words[o]=s}return 0!==i&&(this.words[o]=i,this.length++),this},i.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},i.prototype.cmpn=function(t){var e=t<0;if(0!==this.negative&&!e)return-1;if(0===this.negative&&e)return 1;this.strip();var r;if(this.length>1)r=1;else{e&&(t=-t),n(t<=67108863,"Number is too big");var a=0|this.words[0];r=a===t?0:at.length)return 1;if(this.length=0;r--){var n=0|this.words[r],a=0|t.words[r];if(n!==a){na&&(e=1);break}}return e},i.prototype.gtn=function(t){return 1===this.cmpn(t)},i.prototype.gt=function(t){return 1===this.cmp(t)},i.prototype.gten=function(t){return this.cmpn(t)>=0},i.prototype.gte=function(t){return this.cmp(t)>=0},i.prototype.ltn=function(t){return-1===this.cmpn(t)},i.prototype.lt=function(t){return-1===this.cmp(t)},i.prototype.lten=function(t){return this.cmpn(t)<=0},i.prototype.lte=function(t){return this.cmp(t)<=0},i.prototype.eqn=function(t){return 0===this.cmpn(t)},i.prototype.eq=function(t){return 0===this.cmp(t)},i.red=function(t){return new y(t)},i.prototype.toRed=function(t){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},i.prototype.fromRed=function(){return n(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 n(!this.red,"Already a number in reduction context"),this._forceRed(t)},i.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},i.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},i.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},i.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},i.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},i.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},i.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},i.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var M={k256:null,p224:null,p192:null,p25519:null};d.prototype._tmp=function(){var t=new i(null);return t.words=new Array(Math.ceil(this.n/13)),t},d.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},d.prototype.split=function(t,e){t.iushrn(this.n,0,e)},d.prototype.imulK=function(t){return t.imul(this.k)},a(p,d),p.prototype.split=function(t,e){for(var r=Math.min(t.length,9),n=0;n>>22,a=i}a>>>=22,t.words[n-10]=a,0===a&&t.length>10?t.length-=10:t.length-=9},p.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=a,e=n}return 0!==e&&(t.words[t.length++]=e),t},i._prime=function(t){if(M[t])return M[t];var e;if("k256"===t)e=new p;else if("p224"===t)e=new g;else if("p192"===t)e=new m;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new v}return M[t]=e,e},y.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},y.prototype._verify2=function(t,e){n(0==(t.negative|e.negative),"red works only with positives"),n(t.red&&t.red===e.red,"red works only with red numbers")},y.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},y.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},y.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)},y.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},y.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)},y.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},y.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},y.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},y.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},y.prototype.isqr=function(t){return this.imul(t,t.clone())},y.prototype.sqr=function(t){return this.mul(t,t)},y.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(n(e%2==1),3===e){var r=this.m.add(new i(1)).iushrn(2);return this.pow(t,r)}for(var a=this.m.subn(1),o=0;!a.isZero()&&0===a.andln(1);)o++,a.iushrn(1);n(!a.isZero());var s=new i(1).toRed(this),l=s.redNeg(),u=this.m.subn(1).iushrn(1),c=this.m.bitLength();for(c=new i(2*c*c).toRed(this);0!==this.pow(c,u).cmp(l);)c.redIAdd(l);for(var f=this.pow(c,a),h=this.pow(t,a.addn(1).iushrn(1)),d=this.pow(t,a),p=o;0!==d.cmp(s);){for(var g=d,m=0;0!==g.cmp(s);m++)g=g.redSqr();n(m=0;n--){for(var u=e.words[n],c=l-1;c>=0;c--){var f=u>>c&1;a!==r[0]&&(a=this.sqr(a)),0!==f||0!==o?(o<<=1,o|=f,(4===++s||0===n&&0===c)&&(a=this.mul(a,r[o]),s=0,o=0)):s=0}l=26}return a},y.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},y.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},i.mont=function(t){return new b(t)},a(b,y),b.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},b.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},b.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),a=r.isub(n).iushrn(this.shift),i=a;return a.cmp(this.m)>=0?i=a.isub(this.m):a.cmpn(0)<0&&(i=a.iadd(this.m)),i._forceRed(this)},b.prototype.mul=function(t,e){ if(t.isZero()||e.isZero())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),a=r.isub(n).iushrn(this.shift),o=a;return a.cmp(this.m)>=0?o=a.isub(this.m):a.cmpn(0)<0&&(o=a.iadd(this.m)),o._forceRed(this)},b.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(void 0===e||e,this)},{}],33:[function(t,e,r){"use strict";function n(t,e){for(var r=0;r>>1;if(!(s<=0)){var l,u=f.mallocDouble(2*s*i),c=f.mallocInt32(i);if((i=a(t,s,u,c))>0){if(1===s&&n)h.init(i),l=h.sweepComplete(s,r,0,i,u,c,0,i,u,c);else{var p=f.mallocDouble(2*s*o),g=f.mallocInt32(o);o=a(e,s,p,g),o>0&&(h.init(i+o),l=1===s?h.sweepBipartite(s,r,0,i,u,c,0,o,p,g):d(s,r,n,i,u,c,o,p,g),f.free(p),f.free(g))}f.free(u),f.free(c)}return l}}}function o(t,e){c.push([t,e])}function s(t){return c=[],i(t,t,o,!0),c}function l(t,e){return c=[],i(t,e,o,!1),c}function u(t,e,r){switch(arguments.length){case 1:return s(t);case 2:return"function"==typeof e?i(t,t,e,!0):l(t,e);case 3:return i(t,e,r,!1);default:throw new Error("box-intersect: Invalid arguments")}}e.exports=u;var c,f=t("typedarray-pool"),h=t("./lib/sweep"),d=t("./lib/intersect")},{"./lib/intersect":35,"./lib/sweep":39,"typedarray-pool":205}],34:[function(t,e,r){"use strict";function n(t,e,r){var n="bruteForce"+(t?"Red":"Blue")+(e?"Flip":"")+(r?"Full":""),a=["function ",n,"(",w.join(),"){","var ",u,"=2*",i,";"],l="for(var i="+c+","+p+"="+u+"*"+c+";i<"+f+";++i,"+p+"+="+u+"){var x0="+h+"["+o+"+"+p+"],x1="+h+"["+o+"+"+p+"+"+i+"],xi="+d+"[i];",A="for(var j="+g+","+b+"="+u+"*"+g+";j<"+m+";++j,"+b+"+="+u+"){var y0="+v+"["+o+"+"+b+"],"+(r?"y1="+v+"["+o+"+"+b+"+"+i+"],":"")+"yi="+y+"[j];";return t?a.push(l,_,":",A):a.push(A,_,":",l),r?a.push("if(y1"+m+"-"+g+"){"),t?(e(!0,!1),o.push("}else{"),e(!1,!1)):(o.push("if("+l+"){"),e(!0,!0),o.push("}else{"),e(!0,!1),o.push("}}else{if("+l+"){"),e(!1,!0),o.push("}else{"),e(!1,!1),o.push("}")),o.push("}}return "+r);var s=a.join("")+o.join("");return new Function(s)()}var i="d",o="ax",s="vv",l="fp",u="es",c="rs",f="re",h="rb",d="ri",p="rp",g="bs",m="be",v="bb",y="bi",b="bp",x="rv",_="Q",w=[i,o,s,c,f,h,d,g,m,v,y];r.partial=a(!1),r.full=a(!0)},{}],35:[function(t,e,r){"use strict";function n(t,e){var r=8*u.log2(e+1)*(t+1)|0,n=u.nextPow2(M*r);E.length0;){O-=1;var R=O*M,D=E[R],P=E[R+1],z=E[R+2],N=E[R+3],F=E[R+4],B=E[R+5],j=O*T,H=L[j],U=L[j+1],V=1&B,G=!!(16&B),q=l,X=u,Y=g,W=S;if(V&&(q=g,X=S,Y=l,W=u),!(2&B&&(z=_(t,D,P,z,q,X,U),P>=z)||4&B&&(P=w(t,D,P,z,q,X,H))>=z)){var Z=z-P,Q=F-N;if(G){if(t*Z*(Z+Q)=p0)&&!(p1>=hi)",["p0","p1"]),x=g("lo===p0",["p0"]),_=g("lor&&a[f+e]>u;--c,f-=o){for(var h=f,d=f+o,p=0;p>>1,h=2*t,d=f,p=i[h*f+e];u=b?(d=y,p=b):v>=_?(d=m,p=v):(d=x,p=_):b>=_?(d=y,p=b):_>=v?(d=m,p=v):(d=x,p=_);for(var w=h*(c-1),A=h*d,k=0;k=0&&n.push("lo=e[k+n]"),t.indexOf("hi")>=0&&n.push("hi=e[k+o]"),r.push(a.replace("_",n.join()).replace("$",t)),Function.apply(void 0,r)}e.exports=n;var a="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"},{}],38:[function(t,e,r){"use strict";function n(t,e){e<=4*h?a(0,e-1,t):f(0,e-1,t)}function a(t,e,r){for(var n=2*(t+1),a=t+1;a<=e;++a){for(var i=r[n++],o=r[n++],s=a,l=n-2;s-- >t;){var u=r[l-2],c=r[l-1];if(ur[e+1])}function c(t,e,r,n){t*=2;var a=n[t];return a>1,m=g-n,v=g+n,y=d,b=m,x=g,_=v,w=p,A=t+1,k=e-1,M=0;u(y,b,r)&&(M=y,y=b,b=M),u(_,w,r)&&(M=_,_=w,w=M),u(y,x,r)&&(M=y,y=x,x=M),u(b,x,r)&&(M=b,b=x,x=M),u(y,_,r)&&(M=y,y=_,_=M),u(x,_,r)&&(M=x,x=_,_=M),u(b,w,r)&&(M=b,b=w,w=M),u(b,x,r)&&(M=b,b=x,x=M),u(_,w,r)&&(M=_,_=w,w=M);for(var T=r[2*b],E=r[2*b+1],L=r[2*_],S=r[2*_+1],C=2*y,O=2*x,I=2*w,R=2*d,D=2*g,P=2*p,z=0;z<2;++z){var N=r[C+z],F=r[O+z],B=r[I+z];r[R+z]=N,r[D+z]=F,r[P+z]=B}o(m,t,r),o(v,e,r);for(var j=A;j<=k;++j)if(c(j,T,E,r))j!==A&&i(j,A,r),++A;else if(!c(j,L,S,r))for(;;){if(c(k,L,S,r)){c(k,T,E,r)?(s(j,A,k,r),++A,--k):(i(j,k,r),--k);break}if(--k>>1;h(x,E);for(var L=0,S=0,A=0;A=d)C=C-d|0,a(m,v,S--,C);else if(C>=0)a(p,g,L--,C);else if(C<=-d){C=-C-d|0;for(var O=0;O>>1;h(x,L);for(var S=0,C=0,O=0,k=0;k>1==x[2*k+3]>>1&&(R=2,k+=1),I<0){for(var D=-(I>>1)-1,P=0;P>1)-1;0===R?a(p,g,S--,D):1===R?a(m,v,C--,D):2===R&&a(y,b,O--,D)}}}function l(t,e,r,n,o,s,l,u,c,f,m,v){var y=0,b=2*t,_=e,w=e+t,A=1,k=1;n?k=d:A=d;for(var M=o;M>>1;h(x,S);for(var C=0,M=0;M=d?(I=!n,T-=d):(I=!!n,T-=1),I)i(p,g,C++,T);else{var R=v[T],D=b*T,P=m[D+e+1],z=m[D+e+1+t];t:for(var N=0;N>>1;h(x,A);for(var k=0,y=0;y=d)p[k++]=b-d;else{b-=1;var T=c[b],E=g*b,L=u[E+e+1],S=u[E+e+1+t];t:for(var C=0;C=0;--C)if(p[C]===b){for(var D=C+1;DZ)throw new RangeError("Invalid typed array length");var e=new Uint8Array(t);return e.__proto__=a.prototype,e}function a(t,e,r){if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return l(t)}return i(t,e,r)}function i(t,e,r){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return t instanceof ArrayBuffer?f(t,e,r):"string"==typeof t?u(t,e):h(t)}function o(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function s(t,e,r){return o(t),t<=0?n(t):void 0!==e?"string"==typeof r?n(t).fill(e,r):n(t).fill(e):n(t)}function l(t){return o(t),n(t<0?0:0|d(t))}function u(t,e){if("string"==typeof e&&""!==e||(e="utf8"),!a.isEncoding(e))throw new TypeError('"encoding" must be a valid string encoding');var r=0|g(t,e),i=n(r),o=i.write(t,e);return o!==r&&(i=i.slice(0,o)),i}function c(t){for(var e=t.length<0?0:0|d(t.length),r=n(e),a=0;a=Z)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Z.toString(16)+" bytes");return 0|t}function p(t){return+t!=t&&(t=0),a.alloc(+t)}function g(t,e){if(a.isBuffer(t))return t.length;if(q(t)||t instanceof ArrayBuffer)return t.byteLength;"string"!=typeof t&&(t=""+t);var r=t.length;if(0===r)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return j(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return V(t).length;default:if(n)return j(t).length;e=(""+e).toLowerCase(),n=!0}}function m(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if(r>>>=0,e>>>=0,r<=e)return"";for(t||(t="utf8");;)switch(t){case"hex":return O(this,e,r);case"utf8":case"utf-8":return E(this,e,r);case"ascii":return S(this,e,r);case"latin1":case"binary":return C(this,e,r);case"base64":return T(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function v(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function y(t,e,r,n,i){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,X(r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof e&&(e=a.from(e,n)),a.isBuffer(e))return 0===e.length?-1:b(t,e,r,n,i);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):b(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function b(t,e,r,n,a){function i(t,e){return 1===o?t[e]:t.readUInt16BE(e*o)}var o=1,s=t.length,l=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;o=2,s/=2,l/=2,r/=2}var u;if(a){var c=-1;for(u=r;us&&(r=s-l),u=r;u>=0;u--){for(var f=!0,h=0;ha&&(n=a):n=a;var i=e.length;if(i%2!=0)throw new TypeError("Invalid hex string");n>i/2&&(n=i/2);for(var o=0;o239?4:i>223?3:i>191?2:1;if(a+s<=r){var l,u,c,f;switch(s){case 1:i<128&&(o=i);break;case 2:l=t[a+1],128==(192&l)&&(f=(31&i)<<6|63&l)>127&&(o=f);break;case 3:l=t[a+1],u=t[a+2],128==(192&l)&&128==(192&u)&&(f=(15&i)<<12|(63&l)<<6|63&u)>2047&&(f<55296||f>57343)&&(o=f);break;case 4:l=t[a+1],u=t[a+2],c=t[a+3],128==(192&l)&&128==(192&u)&&128==(192&c)&&(f=(15&i)<<18|(63&l)<<12|(63&u)<<6|63&c)>65535&&f<1114112&&(o=f)}}null===o?(o=65533,s=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|1023&o),n.push(o),a+=s}return L(n)}function L(t){var e=t.length;if(e<=Q)return String.fromCharCode.apply(String,t);for(var r="",n=0;nn)&&(r=n);for(var a="",i=e;ir)throw new RangeError("Trying to access beyond buffer length")}function D(t,e,r,n,i,o){if(!a.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||et.length)throw new RangeError("Index out of range")}function P(t,e,r,n,a,i){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function z(t,e,r,n,a){return e=+e,r>>>=0,a||P(t,e,r,4,3.4028234663852886e38,-3.4028234663852886e38),W.write(t,e,r,n,23,4),r+4}function N(t,e,r,n,a){return e=+e,r>>>=0,a||P(t,e,r,8,1.7976931348623157e308,-1.7976931348623157e308),W.write(t,e,r,n,52,8),r+8}function F(t){if(t=t.trim().replace($,""),t.length<2)return"";for(;t.length%4!=0;)t+="=";return t}function B(t){return t<16?"0"+t.toString(16):t.toString(16)}function j(t,e){e=e||1/0;for(var r,n=t.length,a=null,i=[],o=0;o55295&&r<57344){if(!a){if(r>56319){(e-=3)>-1&&i.push(239,191,189);continue}if(o+1===n){(e-=3)>-1&&i.push(239,191,189);continue}a=r;continue}if(r<56320){(e-=3)>-1&&i.push(239,191,189),a=r;continue}r=65536+(a-55296<<10|r-56320)}else a&&(e-=3)>-1&&i.push(239,191,189);if(a=null,r<128){if((e-=1)<0)break;i.push(r)}else if(r<2048){if((e-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;i.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function H(t){for(var e=[],r=0;r>8,a=r%256,i.push(a),i.push(n);return i}function V(t){return Y.toByteArray(F(t))}function G(t,e,r,n){for(var a=0;a=e.length||a>=t.length);++a)e[a+r]=t[a];return a}function q(t){return"function"==typeof ArrayBuffer.isView&&ArrayBuffer.isView(t)}function X(t){return t!==t}var Y=t("base64-js"),W=t("ieee754");r.Buffer=a,r.SlowBuffer=p,r.INSPECT_MAX_BYTES=50;var Z=2147483647;r.kMaxLength=Z,a.TYPED_ARRAY_SUPPORT=function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()}catch(t){return!1}}(),a.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),"undefined"!=typeof Symbol&&Symbol.species&&a[Symbol.species]===a&&Object.defineProperty(a,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),a.poolSize=8192,a.from=function(t,e,r){return i(t,e,r)},a.prototype.__proto__=Uint8Array.prototype,a.__proto__=Uint8Array,a.alloc=function(t,e,r){return s(t,e,r)},a.allocUnsafe=function(t){return l(t)},a.allocUnsafeSlow=function(t){return l(t)},a.isBuffer=function(t){return null!=t&&!0===t._isBuffer},a.compare=function(t,e){if(!a.isBuffer(t)||!a.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,n=e.length,i=0,o=Math.min(r,n);i0&&(t=this.toString("hex",0,e).match(/.{2}/g).join(" "),this.length>e&&(t+=" ... ")),""},a.prototype.compare=function(t,e,r,n,i){if(!a.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),e<0||r>t.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&e>=r)return 0;if(n>=i)return-1;if(e>=r)return 1;if(e>>>=0,r>>>=0,n>>>=0,i>>>=0,this===t)return 0;for(var o=i-n,s=r-e,l=Math.min(o,s),u=this.slice(n,i),c=t.slice(e,r),f=0;f>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var a=this.length-e;if((void 0===r||r>a)&&(r=a),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!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"latin1":case"binary":return A(this,t,e,r);case"base64":return k(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return M(this,t,e,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Q=4096;a.prototype.slice=function(t,e){var r=this.length;t=~~t,e=void 0===e?r:~~e,t<0?(t+=r)<0&&(t=0):t>r&&(t=r),e<0?(e+=r)<0&&(e=0):e>r&&(e=r),e>>=0,e>>>=0,r||R(t,e,this.length);for(var n=this[t],a=1,i=0;++i>>=0,e>>>=0,r||R(t,e,this.length);for(var n=this[t+--e],a=1;e>0&&(a*=256);)n+=this[t+--e]*a;return n},a.prototype.readUInt8=function(t,e){return t>>>=0,e||R(t,1,this.length),this[t]},a.prototype.readUInt16LE=function(t,e){return t>>>=0,e||R(t,2,this.length),this[t]|this[t+1]<<8},a.prototype.readUInt16BE=function(t,e){return t>>>=0,e||R(t,2,this.length),this[t]<<8|this[t+1]},a.prototype.readUInt32LE=function(t,e){return t>>>=0,e||R(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},a.prototype.readUInt32BE=function(t,e){return t>>>=0,e||R(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},a.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||R(t,e,this.length);for(var n=this[t],a=1,i=0;++i=a&&(n-=Math.pow(2,8*e)),n},a.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||R(t,e,this.length);for(var n=e,a=1,i=this[t+--n];n>0&&(a*=256);)i+=this[t+--n]*a;return a*=128,i>=a&&(i-=Math.pow(2,8*e)),i},a.prototype.readInt8=function(t,e){return t>>>=0,e||R(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},a.prototype.readInt16LE=function(t,e){t>>>=0,e||R(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},a.prototype.readInt16BE=function(t,e){t>>>=0,e||R(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},a.prototype.readInt32LE=function(t,e){return t>>>=0,e||R(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},a.prototype.readInt32BE=function(t,e){return t>>>=0,e||R(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},a.prototype.readFloatLE=function(t,e){return t>>>=0,e||R(t,4,this.length),W.read(this,t,!0,23,4)},a.prototype.readFloatBE=function(t,e){return t>>>=0,e||R(t,4,this.length),W.read(this,t,!1,23,4)},a.prototype.readDoubleLE=function(t,e){return t>>>=0,e||R(t,8,this.length),W.read(this,t,!0,52,8)},a.prototype.readDoubleBE=function(t,e){return t>>>=0,e||R(t,8,this.length),W.read(this,t,!1,52,8)},a.prototype.writeUIntLE=function(t,e,r,n){if(t=+t,e>>>=0,r>>>=0,!n){D(this,t,e,r,Math.pow(2,8*r)-1,0)}var a=1,i=0;for(this[e]=255&t;++i>>=0,r>>>=0,!n){D(this,t,e,r,Math.pow(2,8*r)-1,0)}var a=r-1,i=1;for(this[e+a]=255&t;--a>=0&&(i*=256);)this[e+a]=t/i&255;return e+r},a.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||D(this,t,e,1,255,0),this[e]=255&t,e+1},a.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||D(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},a.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||D(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},a.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||D(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},a.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||D(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},a.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var a=Math.pow(2,8*r-1);D(this,t,e,r,a-1,-a)}var i=0,o=1,s=0;for(this[e]=255&t;++i>0)-s&255;return e+r},a.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var a=Math.pow(2,8*r-1);D(this,t,e,r,a-1,-a)}var i=r-1,o=1,s=0;for(this[e+i]=255&t;--i>=0&&(o*=256);)t<0&&0===s&&0!==this[e+i+1]&&(s=1),this[e+i]=(t/o>>0)-s&255;return e+r},a.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||D(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},a.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||D(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},a.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||D(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},a.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||D(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},a.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||D(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},a.prototype.writeFloatLE=function(t,e,r){return z(this,t,e,!0,r)},a.prototype.writeFloatBE=function(t,e,r){return z(this,t,e,!1,r)},a.prototype.writeDoubleLE=function(t,e,r){return N(this,t,e,!0,r)},a.prototype.writeDoubleBE=function(t,e,r){return N(this,t,e,!1,r)},a.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&&n=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e=0;--a)t[a+e]=this[a+r];else if(i<1e3)for(a=0;a>>=0,r=void 0===r?this.length:r>>>0,t||(t=0);var o;if("number"==typeof t)for(o=e;o0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===t[e-2]?2:"="===t[e-1]?1:0}function a(t){return 3*t.length/4-n(t)}function i(t){var e,r,a,i,o,s,l=t.length;o=n(t),s=new f(3*l/4-o),a=o>0?l-4:l;var u=0;for(e=0,r=0;e>16&255,s[u++]=i>>8&255,s[u++]=255&i;return 2===o?(i=c[t.charCodeAt(e)]<<2|c[t.charCodeAt(e+1)]>>4, -s[u++]=255&i):1===o&&(i=c[t.charCodeAt(e)]<<10|c[t.charCodeAt(e+1)]<<4|c[t.charCodeAt(e+2)]>>2,s[u++]=i>>8&255,s[u++]=255&i),s}function o(t){return u[t>>18&63]+u[t>>12&63]+u[t>>6&63]+u[63&t]}function s(t,e,r){for(var n,a=[],i=e;il?l:o+16383));return 1===n?(e=t[r-1],a+=u[e>>2],a+=u[e<<4&63],a+="=="):2===n&&(e=(t[r-2]<<8)+t[r-1],a+=u[e>>10],a+=u[e>>4&63],a+=u[e<<2&63],a+="="),i.push(a),i.join("")}r.byteLength=a,r.toByteArray=i,r.fromByteArray=l;for(var u=[],c=[],f="undefined"!=typeof Uint8Array?Uint8Array:Array,h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",d=0,p=h.length;d0;){for(var c=r.pop(),s=r.pop(),f=-1,h=-1,l=o[s],p=1;p=0||(e.flip(s,c),n(t,e,r,f,s,h),n(t,e,r,s,h,f),n(t,e,r,h,c,f),n(t,e,r,c,f,h)))}}var i=t("robust-in-sphere")[4];t("binary-search-bounds");e.exports=a},{"binary-search-bounds":47,"robust-in-sphere":181}],44:[function(t,e,r){"use strict";function n(t,e,r,n,a,i,o){this.cells=t,this.neighbor=e,this.flags=n,this.constraint=r,this.active=a,this.next=i,this.boundary=o}function a(t,e){return t[0]-e[0]||t[1]-e[1]||t[2]-e[2]}function i(t,e){for(var r=t.cells(),i=r.length,o=0;o0||l.length>0;){for(;s.length>0;){var d=s.pop();if(u[d]!==-a){u[d]=a;for(var p=(c[d],0);p<3;++p){var g=h[3*d+p];g>=0&&0===u[g]&&(f[3*d+p]?l.push(g):(s.push(g),u[g]=a))}}}var m=l;l=s,s=m,l.length=0,a=-a}var v=o(c,u,e);return r?v.concat(n.boundary):v}var l=t("binary-search-bounds");e.exports=s,n.prototype.locate=function(){var t=[0,0,0];return function(e,r,n){var i=e,o=r,s=n;return r1&&d(r[c[f-2]],r[c[f-1]],n)>0;)t.push([c[f-1],c[f-2],a]),f-=1;c.length=f,c.push(a);for(var p=u.upperIds,f=p.length;f>1&&d(r[p[f-2]],r[p[f-1]],n)<0;)t.push([p[f-2],p[f-1],a]),f-=1;p.length=f,p.push(a)}}function l(t,e){var r;return(r=t.a[0]v[0]&&l.push(new a(v,d,m,f),new a(d,v,g,f))}l.sort(i);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=[],f=0,_=l.length;f<_;++f){var w=l[f],A=w.type;A===p?s(x,b,t,w.a,w.idx):A===m?u(b,t,w):c(b,t,w)}return x}var h=t("binary-search-bounds"),d=t("robust-orientation")[3],p=0,g=1,m=2;e.exports=f},{"binary-search-bounds":47,"robust-orientation":182}],46:[function(t,e,r){"use strict";function n(t,e){this.stars=t,this.edges=e}function a(t,e,r){for(var n=1,a=t.length;n=0}}(),s.removeTriangle=function(t,e,r){var n=this.stars;a(n[t],e,r),a(n[e],r,t),a(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,a=r.length;n>>1,x=a[m]"];return a?e.indexOf("c")<0?i.push(";if(x===y){return m}else if(x<=y){"):i.push(";var p=c(x,y);if(p===0){return m}else if(p<=0){"):i.push(";if(",e,"){i=m;"),r?i.push("l=m+1}else{h=m-1}"):i.push("h=m-1}else{l=m+1}"),i.push("}"),a?i.push("return -1};"):i.push("return i};"),i.join("")}function a(t,e,r,a){return new Function([n("A","x"+t+"y",e,["y"],a),n("P","c(x,y)"+t+"0",e,["y","c"],a),"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(""))()}e.exports={ge:a(">=",!1,"GE"),gt:a(">",!1,"GT"),lt:a("<",!0,"LT"),le:a("<=",!0,"LE"),eq:a("-",!0,"EQ",!0)}},{}],48:[function(t,e,r){function n(t,e,r){return er?r:t:te?e:t}e.exports=n},{}],49:[function(t,e,r){"use strict";function n(t){var e=_(t);return[A(e,-1/0),A(e,1/0)]}function a(t,e){for(var r=new Array(e.length),n=0;n=0;--i){var p=n[i];o=p[0];var g=e[o],m=g[0],v=g[1],y=t[m],A=t[v];if((y[0]-A[0]||y[1]-A[1])<0){var M=m;m=v,v=M}g[0]=m;var T,E=g[1]=p[1];for(a&&(T=g[2]);i>0&&n[i-1][0]===o;){var p=n[--i],L=p[1];a?e.push([E,L,T]):e.push([E,L]),E=L}a?e.push([E,v,T]):e.push([E,v])}return s}function u(t,e,r){for(var a=e.length,i=new m(a),o=[],s=0;se[2]?1:0)}function h(t,e,r){if(0!==t.length){if(e)for(var n=0;n0||d.length>0)}function g(t,e,r){var n;if(r){n=e;for(var a=new Array(e.length),i=0;i>>24,n=(16711680&t)>>>16,a=(65280&t)>>>8,i=255&t;return!1===e?[r,n,a,i]:[r/255,n/255,a/255,i/255]}var i=t("clamp");e.exports=n,e.exports.to=n,e.exports.from=a},{clamp:48}],52:[function(t,e,r){e.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}},{}],53:[function(t,e,r){"use strict";function n(t){var e,r,n=[],s=1;if("string"==typeof t)if(a[t])n=a[t].slice(),r="rgb";else if("transparent"===t)s=0,r="rgb",n=[0,0,0];else if(/^#[A-Fa-f0-9]+$/.test(t)){var l=t.slice(1),u=l.length,c=u<=4;s=1,c?(n=[parseInt(l[0]+l[0],16),parseInt(l[1]+l[1],16),parseInt(l[2]+l[2],16)],4===u&&(s=parseInt(l[3]+l[3],16)/255)):(n=[parseInt(l[0]+l[1],16),parseInt(l[2]+l[3],16),parseInt(l[4]+l[5],16)],8===u&&(s=parseInt(l[6]+l[7],16)/255)),n[0]||(n[0]=0),n[1]||(n[1]=0),n[2]||(n[2]=0),r="rgb"}else if(e=/^((?:rgb|hs[lvb]|hwb|cmyk?|xy[zy]|gray|lab|lchu?v?|[ly]uv|lms)a?)\s*\(([^\)]*)\)/.exec(t)){var f=e[1],l=f.replace(/a$/,"");r=l;var u="cmyk"===l?4:"gray"===l?1:3;n=e[2].trim().split(/\s*,\s*/).map(function(t,e){if(/%$/.test(t))return e===u?parseFloat(t)/100:"rgb"===l?255*parseFloat(t)/100:parseFloat(t);if("h"===l[e]){if(/deg$/.test(t))return parseFloat(t);if(void 0!==o[t])return o[t]}return parseFloat(t)}),f===l&&n.push(1),s=void 0===n[u]?1:n[u],n=n.slice(0,u)}else t.length>10&&/[0-9](?:\s|\/)/.test(t)&&(n=t.match(/([0-9]+)/g).map(function(t){return parseFloat(t)}),r=t.match(/([a-z])/gi).join("").toLowerCase());else"number"==typeof t?(r="rgb",n=[t>>>16,(65280&t)>>>8,255&t]):i(t)?(null!=t.r?(n=[t.r,t.g,t.b],r="rgb"):null!=t.red?(n=[t.red,t.green,t.blue],r="rgb"):null!=t.h?(n=[t.h,t.s,t.l],r="hsl"):null!=t.hue&&(n=[t.hue,t.saturation,t.lightness],r="hsl"),null!=t.a?s=t.a:null!=t.alpha?s=t.alpha:null!=t.opacity&&(s=t.opacity/100)):(Array.isArray(t)||ArrayBuffer.isView(t))&&(n=[t[0],t[1],t[2]],r="rgb",s=4===t.length?t[3]:1);return{space:r,values:n,alpha:s}}e.exports=n;var a=t("color-name"),i=t("is-plain-obj"),o={red:0,orange:60,yellow:120,green:180,blue:240,purple:300}},{"color-name":52,"is-plain-obj":156}],54:[function(t,e,r){"use strict";var n=t("color-parse"),a=t("color-space/hsl"),i=t("clamp");e.exports=function(t,e){null==e&&(e=!0);var r=n(t);if(!r.space)return[];if(Array.isArray(t))return t;var o,s=r.values,l=s.length;for(o=0;o1&&n--,i=6*n<1?e+6*(r-e)*n:2*n<1?r:3*n<2?e+(r-e)*(2/3-n)*6:e,a[u]=255*i;return a}},n.hsl=function(t){var e,r,n,a=t[0]/255,i=t[1]/255,o=t[2]/255,s=Math.min(a,i,o),l=Math.max(a,i,o),u=l-s;return l===s?e=0:a===l?e=(i-o)/u:i===l?e=2+(o-a)/u:o===l&&(e=4+(a-i)/u),e=Math.min(60*e,360),e<0&&(e+=360),n=(s+l)/2,r=l===s?0:n<=.5?u/(l+s):u/(2-l-s),[e,100*r,100*n]}},{"./rgb":56}],56:[function(t,e,r){"use strict";e.exports={name:"rgb",min:[0,0,0],max:[255,255,255],channel:["red","green","blue"],alias:["RGB"]}},{}],57:[function(t,e,r){"use strict";function n(t,e,r){var n=s(t[0],-e[0]),a=s(t[1],-e[1]),i=s(r[0],-e[0]),o=s(r[1],-e[1]),c=u(l(n,i),l(a,o));return c[c.length-1]>=0}function a(t,e,r,a){var s=i(e,r,a);if(0===s){var l=o(i(t,e,r)),u=o(i(t,e,a));if(l===u){if(0===l){var c=n(t,e,r);return c===n(t,e,a)?0:c?1:-1}return 0}return 0===u?l>0?-1:n(t,e,a)?-1:1:0===l?u>0?1:n(t,e,r)?1:-1:o(u-l)}var f=i(t,e,r);return f>0?s>0&&i(t,e,a)>0?1:-1:f<0?s>0||i(t,e,a)>0?1:-1:i(t,e,a)>0?1:n(t,e,r)?1:-1}e.exports=a;var i=t("robust-orientation"),o=t("signum"),s=t("two-sum"),l=t("robust-product"),u=t("robust-sum")},{"robust-orientation":182,"robust-product":183,"robust-sum":187,signum:188,"two-sum":204}],58:[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 a(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 a=0;a0)throw new Error("cwise: pre() block may not reference array args");if(a0)throw new Error("cwise: post() block may not reference array args")}else if("scalar"===o)e.scalarArgs.push(a),e.shimArgs.push("scalar"+a);else if("index"===o){if(e.indexArgs.push(a),a0)throw new Error("cwise: pre() block may not reference array index");if(a0)throw new Error("cwise: post() block may not reference array index")}else if("shape"===o){if(e.shapeArgs.push(a),ar.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,i(e)}var i=t("./lib/thunk.js");e.exports=a},{"./lib/thunk.js":60}],59:[function(t,e,r){"use strict";function n(t,e,r){var n,a,i=t.length,o=e.arrayArgs.length,s=e.indexArgs.length>0,l=[],u=[],c=0,f=0;for(n=0;n0&&l.push("var "+u.join(",")),n=i-1;n>=0;--n)c=t[n],l.push(["for(i",n,"=0;i",n,"0&&l.push(["index[",f,"]-=s",f].join("")),l.push(["++index[",c,"]"].join(""))),l.push("}")}return l.join("\n")}function a(t,e,r,a){for(var i=e.length,o=r.arrayArgs.length,s=r.blockSize,l=r.indexArgs.length>0,u=[],c=0;c0;){"].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;c0&&(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),f=0;f0&&_.push("shape=SS.slice(0)"),t.indexArgs.length>0){for(var w=new Array(r),f=0;f0&&x.push("var "+_.join(","));for(var f=0;f3&&x.push(o(t.pre,t,c));var T=o(t.body,t,c),E=i(m);E3&&x.push(o(t.post,t,c)),t.debug&&console.log("-----Generated cwise routine for ",e,":\n"+x.join("\n")+"\n----------");var L=[t.funcName||"unnamed","_cwise_loop_",l[0].join("s"),"m",E,s(c)].join("");return new Function(["function ",L,"(",b.join(","),"){",x.join("\n"),"} return ",L].join(""))()}var u=t("uniq");e.exports=l},{uniq:207}],60:[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 i=[],o=[],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"+f+".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"+f+".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--\x3e0;) {"),e.push("if (!("+u.join(" && ")+")) throw new Error('cwise: Arrays do not all have the same shape!')"),e.push("}"));for(var c=0;ce?1:t>=e?0:NaN}function i(t){return null===t?NaN:+t}function o(t){return!isNaN(t)}function s(t){return{left:function(e,r,n,a){for(arguments.length<3&&(n=0),arguments.length<4&&(a=e.length);n>>1;t(e[i],r)<0?n=i+1:a=i}return n},right:function(e,r,n,a){for(arguments.length<3&&(n=0),arguments.length<4&&(a=e.length);n>>1;t(e[i],r)>0?a=i:n=i+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 f(){this._=Object.create(null)}function h(t){return(t+="")===_o||t[0]===wo?wo+t:t}function d(t){return(t+="")[0]===wo?t.slice(1):t}function p(t){return h(t)in this._}function g(t){return(t=h(t))in this._&&delete this._[t]}function m(){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 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=Ao.length;r=e&&(e=a+1);!(o=s[e])&&++e0&&(t=t.slice(0,s));var u=Ro.get(t);return u&&(t=u,l=Q),s?e?a:n:e?A:i}function Z(t,e){return function(r){var n=uo.event;uo.event=r,e[0]=this.__data__;try{t.apply(this,e)}finally{uo.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 $(t){var r=".dragsuppress-"+ ++Po,a="click"+r,i=uo.select(n(t)).on("touchmove"+r,T).on("dragstart"+r,T).on("selectstart"+r,T);if(null==Do&&(Do=!("onselectstart"in t)&&w(t.style,"userSelect")),Do){var o=e(t).style,s=o[Do];o[Do]="none"}return function(t){if(i.on(r,null),Do&&(o[Do]=s),t){var e=function(){i.on(a,null)};i.on(a,function(){T(),e()},!0),setTimeout(e,0)}}}function K(t,e){e.changedTouches&&(e=e.changedTouches[0]);var r=t.ownerSVGElement||t;if(r.createSVGPoint){var a=r.createSVGPoint();if(zo<0){var i=n(t);if(i.scrollX||i.scrollY){r=uo.select("body").append("svg").style({position:"absolute",top:0,left:0,margin:0,padding:0,border:"none"},"important");var o=r[0][0].getScreenCTM();zo=!(o.f||o.e),r.remove()}}return zo?(a.x=e.pageX,a.y=e.pageY):(a.x=e.clientX,a.y=e.clientY),a=a.matrixTransform(t.getScreenCTM().inverse()),[a.x,a.y]}var s=t.getBoundingClientRect();return[e.clientX-s.left-t.clientLeft,e.clientY-s.top-t.clientTop]}function J(){return uo.event.changedTouches[0].identifier}function tt(t){return t>0?1:t<0?-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:t<-1?Bo:Math.acos(t)}function nt(t){return t>1?Uo:t<-1?-Uo:Math.asin(t)}function at(t){return((t=Math.exp(t))-1/t)/2}function it(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,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):At(""+t,kt,ut):new ut(t,e,r)}function ct(t,e,r){function n(t){return t>360?t-=360:t<0&&(t+=360),t<60?i+(o-i)*t/60:t<180?o:t<240?i+(o-i)*(240-t)/60:i}function a(t){return Math.round(255*n(t))}var i,o;return t=isNaN(t)?0:(t%=360)<0?t+360:t,e=isNaN(e)?0:e<0?0:e>1?1:e,r=r<0?0:r>1?1:r,o=r<=.5?r*(1+e):r+e-r*e,i=2*r-o,new bt(a(t+120),a(t),a(t-120))}function ft(t,e,r){return this instanceof ft?(this.h=+t,this.c=+e,void(this.l=+r)):arguments.length<2?t instanceof ft?new ft(t.h,t.c,t.l):t instanceof dt?gt(t.l,t.a,t.b):gt((t=Mt((t=uo.rgb(t)).r,t.g,t.b)).l,t.a,t.b):new ft(t,e,r)}function ht(t,e,r){return isNaN(t)&&(t=0),isNaN(e)&&(e=0),new dt(r,Math.cos(t*=Vo)*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 ft?ht(t.h,t.c,t.l):Mt((t=bt(t)).r,t.g,t.b):new dt(t,e,r)}function pt(t,e,r){var n=(t+16)/116,a=n+e/500,i=n-r/200;return a=mt(a)*Ko,n=mt(n)*Jo,i=mt(i)*ts,new bt(yt(3.2404542*a-1.5371385*n-.4985314*i),yt(-.969266*a+1.8760108*n+.041556*i),yt(.0556434*a-.2040259*n+1.0572252*i))}function gt(t,e,r){return t>0?new ft(Math.atan2(r,e)*Go,Math.sqrt(e*e+r*r),t):new ft(NaN,NaN,t)}function mt(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*(t<=.00304?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):At(""+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 t<16?"0"+Math.max(0,t).toString(16):Math.min(255,t).toString(16)}function At(t,e,r){var n,a,i,o=0,s=0,l=0;if(n=/([a-z]+)\((.*)\)/.exec(t=t.toLowerCase()))switch(a=n[2].split(","),n[1]){case"hsl":return r(parseFloat(a[0]),parseFloat(a[1])/100,parseFloat(a[2])/100);case"rgb":return e(Et(a[0]),Et(a[1]),Et(a[2]))}return(i=ns.get(t))?e(i.r,i.g,i.b):(null==t||"#"!==t.charAt(0)||isNaN(i=parseInt(t.slice(1),16))||(4===t.length?(o=(3840&i)>>4,o|=o>>4,s=240&i,s|=s>>4,l=15&i,l|=l<<4):7===t.length&&(o=(16711680&i)>>16,s=(65280&i)>>8,l=255&i)),e(o,s,l))}function kt(t,e,r){var n,a,i=Math.min(t/=255,e/=255,r/=255),o=Math.max(t,e,r),s=o-i,l=(o+i)/2;return s?(a=l<.5?s/(o+i):s/(2-o-i),n=t==o?(e-r)/s+(e0&&l<1?0:n),new ut(n,a,l)}function Mt(t,e,r){t=Tt(t),e=Tt(e),r=Tt(r);var n=vt((.4124564*t+.3575761*e+.1804375*r)/Ko),a=vt((.2126729*t+.7151522*e+.072175*r)/Jo);return dt(116*a-16,500*(n-a),200*(a-vt((.0193339*t+.119192*e+.9503041*r)/ts)))}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 Lt(t){return"function"==typeof t?t:function(){return t}}function St(t){return function(e,r,n){return 2===arguments.length&&"function"==typeof r&&(n=r,r=null),Ct(e,r,t,n)}}function Ct(t,e,r,n){function a(){var t,e=l.status;if(!e&&It(l)||e>=200&&e<300||304===e){try{t=r.call(i,l)}catch(t){return void o.error.call(i,t)}o.load.call(i,t)}else o.error.call(i,l)}var i={},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=a:l.onreadystatechange=function(){l.readyState>3&&a()},l.onprogress=function(t){var e=uo.event;uo.event=t;try{o.progress.call(i,l)}finally{uo.event=e}},i.header=function(t,e){return t=(t+"").toLowerCase(),arguments.length<2?s[t]:(null==e?delete s[t]:s[t]=e+"",i)},i.mimeType=function(t){return arguments.length?(e=null==t?null:t+"",i):e},i.responseType=function(t){return arguments.length?(u=t,i):u},i.response=function(t){return r=t,i},["get","post"].forEach(function(t){i[t]=function(){return i.send.apply(i,[t].concat(fo(arguments)))}}),i.send=function(r,n,a){if(2===arguments.length&&"function"==typeof n&&(a=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!=a&&i.on("error",a).on("load",function(t){a(null,t)}),o.beforesend.call(i,l),l.send(null==n?null:n),i},i.abort=function(){return l.abort(),i},uo.rebind(i,o,"on"),null==n?i:i.get(Ot(n))}function Ot(t){return 1===t.length?function(e,r){t(null==e?r:null)}:t}function It(t){var e=t.responseType;return e&&"text"!==e?t.response:t.responseText}function Rt(t,e,r){var n=arguments.length;n<2&&(e=0),n<3&&(r=Date.now());var a=r+e,i={c:t,t:a,n:null};return is?is.n=i:as=i,is=i,os||(ss=clearTimeout(ss),os=1,ls(Dt)),i}function Dt(){var t=Pt(),e=zt()-t;e>24?(isFinite(e)&&(clearTimeout(ss),ss=setTimeout(Dt,e)),os=0):(os=1,ls(Dt))}function Pt(){for(var t=Date.now(),e=as;e;)t>=e.t&&e.c(t-e.t)&&(e.c=null),e=e.n;return t}function zt(){for(var t,e=as,r=1/0;e;)e.c?(e.t8?function(t){return t/r}:function(t){return t*r},symbol:t}}function Bt(t){var e=t.decimal,r=t.thousands,n=t.grouping,a=t.currency,i=n&&r?function(t,e){for(var a=t.length,i=[],o=0,s=n[0],l=0;a>0&&s>0&&(l+s+1>e&&(s=Math.max(1,e-l)),i.push(t.substring(a-=s,a+s)),!((l+=s+1)>e));)s=n[o=(o+1)%n.length];return i.reverse().join(r)}:x;return function(t){var r=cs.exec(t),n=r[1]||" ",o=r[2]||">",s=r[3]||"-",l=r[4]||"",u=r[5],c=+r[6],f=r[7],h=r[8],d=r[9],p=1,g="",m="",v=!1,y=!0;switch(h&&(h=+h.substring(1)),(u||"0"===n&&"="===o)&&(u=n="0",o="="),d){case"n":f=!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&&(g="0"+d.toLowerCase());case"c":y=!1;case"d":v=!0,h=0;break;case"s":p=-1,d="r"}"$"===l&&(g=a[0],m=a[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=fs.get(d)||jt;var b=u&&f;return function(t){var r=m;if(v&&t%1)return"";var a=t<0||0===t&&1/t<0?(t=-t,"-"):"-"===s?"":s;if(p<0){var l=uo.formatPrefix(t,h);t=l.scale(t),r=l.symbol+m}else t*=p;t=d(t,h);var x,_,w=t.lastIndexOf(".");if(w<0){var A=y?t.lastIndexOf("e"):-1;A<0?(x=t,_=""):(x=t.substring(0,A),_=t.substring(A))}else x=t.substring(0,w),_=e+t.substring(w+1);!u&&f&&(x=i(x,1/0));var k=g.length+x.length+_.length+(b?0:a.length),M=k"===o?M+a+t:"^"===o?M.substring(0,k>>=1)+a+t+M.substring(k):a+(b?t:M+t))+r}}}function jt(t){return t+""}function Ht(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}function Ut(t,e,r){function n(e){var r=t(e),n=i(r,1);return e-r1)for(;o=u)return-1;if(37===(a=e.charCodeAt(s++))){if(o=e.charAt(s++),!(i=S[o in gs?e.charAt(s++):o])||(n=i(t,r,n))<0)return-1}else if(a!=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=A.get(n[0].toLowerCase()),r+n[0].length):-1}function a(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 i(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 o(t,e,r){k.lastIndex=0;var n=k.exec(e.slice(r));return n?(t.m=M.get(n[0].toLowerCase()),r+n[0].length):-1}function s(t,e,n){return r(t,L.c.toString(),e,n)}function l(t,e,n){return r(t,L.x.toString(),e,n)}function u(t,e,n){return r(t,L.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 f=t.dateTime,h=t.date,d=t.time,p=t.periods,g=t.days,m=t.shortDays,v=t.months,y=t.shortMonths;e.utc=function(t){function r(t){try{ds=Ht;var e=new ds;return e._=t,n(e)}finally{ds=Date}}var n=e(t);return r.parse=function(t){try{ds=Ht;var e=n.parse(t);return e&&e._}finally{ds=Date}},r.toString=n.toString,r},e.multi=e.utc.multi=ce;var b=uo.map(),x=Xt(g),_=Yt(g),w=Xt(m),A=Yt(m),k=Xt(v),M=Yt(v),T=Xt(y),E=Yt(y);p.forEach(function(t,e){b.set(t.toLowerCase(),e)});var L={a:function(t){return m[t.getDay()]},A:function(t){return g[t.getDay()]},b:function(t){return y[t.getMonth()]},B:function(t){return v[t.getMonth()]},c:e(f),d:function(t,e){return qt(t.getDate(),e,2)},e:function(t,e){return qt(t.getDate(),e,2)},H:function(t,e){return qt(t.getHours(),e,2)},I:function(t,e){return qt(t.getHours()%12||12,e,2)},j:function(t,e){return qt(1+hs.dayOfYear(t),e,3)},L:function(t,e){return qt(t.getMilliseconds(),e,3)},m:function(t,e){return qt(t.getMonth()+1,e,2)},M:function(t,e){return qt(t.getMinutes(),e,2)},p:function(t){return p[+(t.getHours()>=12)]},S:function(t,e){return qt(t.getSeconds(),e,2)},U:function(t,e){return qt(hs.sundayOfYear(t),e,2)},w:function(t){return t.getDay()},W:function(t,e){return qt(hs.mondayOfYear(t),e,2)},x:e(h),X:e(d),y:function(t,e){return qt(t.getFullYear()%100,e,2)},Y:function(t,e){return qt(t.getFullYear()%1e4,e,4)},Z:le,"%":function(){return"%"}},S={a:n,A:a,b:i,B:o,c:s,d:re,e:re,H:ae,I:ae,j:ne,L:se,m:ee,M:ie,p:c,S:oe,U:Zt,w:Wt,W:Qt,x:l,X:u,y:Kt,Y:$t,Z:Jt,"%":ue};return e}function qt(t,e,r){var n=t<0?"-":"",a=(n?-t:t)+"",i=a.length;return n+(i68?1900:2e3)}function ee(t,e,r){ms.lastIndex=0;var n=ms.exec(e.slice(r,r+2));return n?(t.m=n[0]-1,r+n[0].length):-1}function re(t,e,r){ms.lastIndex=0;var n=ms.exec(e.slice(r,r+2));return n?(t.d=+n[0],r+n[0].length):-1}function ne(t,e,r){ms.lastIndex=0;var n=ms.exec(e.slice(r,r+3));return n?(t.j=+n[0],r+n[0].length):-1}function ae(t,e,r){ms.lastIndex=0;var n=ms.exec(e.slice(r,r+2));return n?(t.H=+n[0],r+n[0].length):-1}function ie(t,e,r){ms.lastIndex=0;var n=ms.exec(e.slice(r,r+2));return n?(t.M=+n[0],r+n[0].length):-1}function oe(t,e,r){ms.lastIndex=0;var n=ms.exec(e.slice(r,r+2));return n?(t.S=+n[0],r+n[0].length):-1}function se(t,e,r){ms.lastIndex=0;var n=ms.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=xo(e)/60|0,a=xo(e)%60;return r+qt(n,"0",2)+qt(a,"0",2)}function ue(t,e,r){vs.lastIndex=0;var n=vs.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=o*r,l=Math.cos(e),u=Math.sin(e),c=i*u,f=a*l+c*Math.cos(s),h=c*o*Math.sin(s);As.add(Math.atan2(h,f)),n=t,a=l,i=u}var e,r,n,a,i;ks.point=function(o,s){ks.point=t,n=(e=o)*Vo,a=Math.cos(s=(r=s)*Vo/2+Bo/4),i=Math.sin(s)},ks.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 Ae(t){return[Math.atan2(t[1],t[0]),nt(t[2])]}function ke(t,e){return xo(t[0]-e[0])=0;--s)a.point((f=c[s])[0],f[1])}else n(d.x,d.p.x,-1,a);d=d.p}d=d.o,c=d.z,p=!p}while(!d.v);a.lineEnd()}}}function Re(t){if(e=t.length){for(var e,r,n=0,a=t[0];++n0){for(_||(i.polygonStart(),_=!0),i.lineStart();++o1&&2&e&&r.push(r.pop().concat(r.shift())),d.push(r.filter(ze))}var d,p,g,m=e(i),v=a.invert(n[0],n[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=Ue(v,p);d.length?(_||(i.polygonStart(),_=!0),Ie(d,Fe,t,r,i)):t&&(_||(i.polygonStart(),_=!0),i.lineStart(),r(null,null,1,i),i.lineEnd()),_&&(i.polygonEnd(),_=!1),d=p=null},sphere:function(){i.polygonStart(),i.lineStart(),r(null,null,1,i),i.lineEnd(),i.polygonEnd()}},b=Ne(),x=e(b),_=!1;return y}}function ze(t){return t.length>1}function Ne(){var t,e=[];return{lineStart:function(){e.push(t=[])},point:function(e,r){t.push([e,r])},lineEnd:A,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]-Uo-No:Uo-t[1])-((e=e.x)[0]<0?e[1]-Uo-No:Uo-e[1])}function Be(t){var e,r=NaN,n=NaN,a=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(i,o){var s=i>0?Bo:-Bo,l=xo(i-r);xo(l-Bo)0?Uo:-Uo),t.point(a,n),t.lineEnd(),t.lineStart(),t.point(s,n),t.point(i,n),e=0):a!==s&&l>=Bo&&(xo(r-a)No?Math.atan((Math.sin(e)*(i=Math.cos(n))*Math.sin(r)-Math.sin(n)*(a=Math.cos(e))*Math.sin(t))/(a*i*o)):(e+n)/2}function He(t,e,r,n){var a;if(null==t)a=r*Uo,n.point(-Bo,a),n.point(0,a),n.point(Bo,a),n.point(Bo,0),n.point(Bo,-a),n.point(0,-a),n.point(-Bo,-a),n.point(-Bo,0),n.point(-Bo,a);else if(xo(t[0]-e[0])>No){var i=t[0]=0?1:-1,A=w*_,k=A>Bo,M=p*b;if(As.add(Math.atan2(M*w*Math.sin(A),g*x+M*Math.cos(A))),i+=k?_+w*jo:_,k^h>=r^v>=r){var T=be(ve(f),ve(t));we(T);var E=be(a,T);we(E);var L=(k^_>=0?-1:1)*nt(E[2]);(n>L||n===L&&(T[0]||T[1]))&&(o+=k^_>=0?1:-1)}if(!m++)break;h=v,p=b,g=x,f=t}}return(i<-No||ii}function r(t){var r,i,l,u,c;return{lineStart:function(){u=l=!1,c=1},point:function(f,h){var d,p=[f,h],g=e(f,h),m=o?g?0:a(f,h):g?a(f+(f<0?Bo:-Bo),h):0;if(!r&&(u=l=g)&&t.lineStart(),g!==l&&(d=n(r,p),(ke(r,d)||ke(p,d))&&(p[0]+=No,p[1]+=No,g=e(p[0],p[1]))),g!==l)c=0,g?(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&&o^g){var v;m&i||!(v=n(p,r,!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])))}!g||r&&ke(r,p)||t.point(p[0],p[1]),r=p,l=g,i=m},lineEnd:function(){l&&t.lineEnd(),r=null},clean:function(){return c|(u&&l)<<1}}}function n(t,e,r){var n=ve(t),a=ve(e),o=[1,0,0],s=be(n,a),l=ye(s,s),u=s[0],c=l-u*u;if(!c)return!r&&t;var f=i*l/c,h=-i*u/c,d=be(o,s),p=_e(o,f);xe(p,_e(s,h));var g=d,m=ye(p,g),v=ye(g,g),y=m*m-v*(ye(p,p)-1);if(!(y<0)){var b=Math.sqrt(y),x=_e(g,(-m-b)/v);if(xe(x,p),x=Ae(x),!r)return x;var _,w=t[0],A=e[0],k=t[1],M=e[1];A0^x[1]<(xo(x[0]-w)Bo^(w<=x[0]&&x[0]<=A)){var S=_e(g,(-m+b)/v);return xe(S,p),[x,Ae(S)]}}}function a(e,r){var n=o?t:Bo-t,a=0;return e<-n?a|=1:e>n&&(a|=2),r<-n?a|=4:r>n&&(a|=8),a}var i=Math.cos(t),o=i>0,s=xo(i)>No;return Pe(e,r,mr(t,6*Vo),o?[0,-t]:[-Bo,t-Bo])}function Ge(t,e,r,n){return function(a){var i,o=a.a,s=a.b,l=o.x,u=o.y,c=s.x,f=s.y,h=0,d=1,p=c-l,g=f-u;if(i=t-l,p||!(i>0)){if(i/=p,p<0){if(i0){if(i>d)return;i>h&&(h=i)}if(i=r-l,p||!(i<0)){if(i/=p,p<0){if(i>d)return;i>h&&(h=i)}else if(p>0){if(i0)){if(i/=g,g<0){if(i0){if(i>d)return;i>h&&(h=i)}if(i=n-u,g||!(i<0)){if(i/=g,g<0){if(i>d)return;i>h&&(h=i)}else if(g>0){if(i0&&(a.a={x:l+h*p,y:u+h*g}),d<1&&(a.b={x:l+d*p,y:u+d*g}),a}}}}}}function qe(t,e,r,n){function a(n,a){return xo(n[0]-t)0?0:3:xo(n[0]-r)0?2:1:xo(n[1]-e)0?1:0:a>0?3:2}function i(t,e){return o(t.x,e.x)}function o(t,e){var r=a(t,1),n=a(e,1);return r!==n?r-n:0===r?e[1]-t[1]:1===r?t[0]-e[0]:2===r?t[1]-e[1]:e[0]-t[0]}return function(s){function l(t){for(var e=0,r=m.length,n=t[1],a=0;an&&et(u,i,t)>0&&++e:i[1]<=n&&et(u,i,t)<0&&--e,u=i;return 0!==e}function u(i,s,l,u){var c=0,f=0;if(null==i||(c=a(i,l))!==(f=a(s,l))||o(i,s)<0^l>0)do{u.point(0===c||3===c?t:r,c>1?n:e)}while((c=(c+l+4)%4)!==f);else u.point(s[0],s[1])}function c(a,i){return t<=a&&a<=r&&e<=i&&i<=n}function f(t,e){c(t,e)&&s.point(t,e)}function h(){S.point=p,m&&m.push(v=[]),k=!0,A=!1,_=w=NaN}function d(){g&&(p(y,b),x&&A&&E.rejoin(),g.push(E.buffer())),S.point=f,A&&s.lineEnd()}function p(t,e){t=Math.max(-Fs,Math.min(Fs,t)),e=Math.max(-Fs,Math.min(Fs,e));var r=c(t,e);if(m&&v.push([t,e]),k)y=t,b=e,x=r,k=!1,r&&(s.lineStart(),s.point(t,e));else if(r&&A)s.point(t,e);else{var n={a:{x:_,y:w},b:{x:t,y:e}};L(n)?(A||(s.lineStart(),s.point(n.a.x,n.a.y)),s.point(n.b.x,n.b.y),r||s.lineEnd(),M=!1):r&&(s.lineStart(),s.point(t,e),M=!1)}_=t,w=e,A=r}var g,m,v,y,b,x,_,w,A,k,M,T=s,E=Ne(),L=Ge(t,e,r,n),S={point:f,lineStart:h,lineEnd:d,polygonStart:function(){s=E,g=[],m=[],M=!0},polygonEnd:function(){s=T,g=uo.merge(g);var e=l([t,n]),r=M&&e,a=g.length;(r||a)&&(s.polygonStart(),r&&(s.lineStart(),u(null,null,1,s),s.lineEnd()),a&&Ie(g,i,e,u,s),s.polygonEnd()),g=m=v=null}};return S}}function Xe(t){var e=0,r=Bo/3,n=lr(t),a=n(e,r);return a.parallels=function(t){return arguments.length?n(e=t[0]*Bo/180,r=t[1]*Bo/180):[e/Bo*180,r/Bo*180]},a}function Ye(t,e){function r(t,e){var r=Math.sqrt(i-2*a*Math.sin(e))/a;return[r*Math.sin(t*=a),o-r*Math.cos(t)]}var n=Math.sin(t),a=(n+Math.sin(e))/2,i=1+n*(2*a-n),o=Math.sqrt(i)/a;return r.invert=function(t,e){var r=o-e;return[Math.atan2(t,r)/a,nt((i-(t*t+r*r)*a*a)/(2*a))]},r}function We(){function t(t,e){js+=a*t-n*e,n=t,a=e}var e,r,n,a;qs.point=function(i,o){qs.point=t,e=n=i,r=a=o},qs.lineEnd=function(){t(e,r)}}function Ze(t,e){tVs&&(Vs=t),eGs&&(Gs=e)}function Qe(){function t(t,e){o.push("M",t,",",e,i)}function e(t,e){o.push("M",t,",",e),s.point=r}function r(t,e){o.push("L",t,",",e)}function n(){s.point=t}function a(){o.push("Z")}var i=$e(4.5),o=[],s={point:t,lineStart:function(){s.point=e},lineEnd:n,polygonStart:function(){s.lineEnd=a},polygonEnd:function(){s.lineEnd=n,s.point=t},pointRadius:function(t){return i=$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 Ke(t,e){Es+=t,Ls+=e,++Ss}function Je(){function t(t,n){var a=t-e,i=n-r,o=Math.sqrt(a*a+i*i);Cs+=o*(e+t)/2,Os+=o*(r+n)/2,Is+=o,Ke(e=t,r=n)}var e,r;Ys.point=function(n,a){Ys.point=t,Ke(e=n,r=a)}}function tr(){Ys.point=Ke}function er(){function t(t,e){var r=t-n,i=e-a,o=Math.sqrt(r*r+i*i);Cs+=o*(n+t)/2,Os+=o*(a+e)/2,Is+=o,o=a*t-n*e,Rs+=o*(n+t),Ds+=o*(a+e),Ps+=3*o,Ke(n=t,a=e)}var e,r,n,a;Ys.point=function(i,o){Ys.point=t,Ke(e=n=i,r=a=o)},Ys.lineEnd=function(){t(e,r)}}function rr(t){function e(e,r){t.moveTo(e+o,r),t.arc(e,r,o,0,jo)}function r(e,r){t.moveTo(e,r),s.point=n}function n(e,r){t.lineTo(e,r)}function a(){s.point=e}function i(){t.closePath()}var o=4.5,s={point:e,lineStart:function(){s.point=r},lineEnd:a,polygonStart:function(){s.lineEnd=i},polygonEnd:function(){s.lineEnd=a,s.point=e},pointRadius:function(t){return o=t,s},result:A};return s}function nr(t){function e(t){return(s?n:r)(t)}function r(e){return or(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=i,e.lineStart()}function i(r,n){var i=ve([r,n]),o=t(r,n);a(b,x,y,_,w,A,b=o[0],x=o[1],y=r,_=i[0],w=i[1],A=i[2],s,e),e.point(b,x)}function o(){k.point=r,e.lineEnd()}function l(){n(),k.point=u,k.lineEnd=c}function u(t,e){i(f=t,h=e),d=b,p=x,g=_,m=w,v=A,k.point=i}function c(){a(b,x,y,_,w,A,d,p,f,g,m,v,s,e),k.lineEnd=o,o()}var f,h,d,p,g,m,v,y,b,x,_,w,A,k={point:r,lineStart:n,lineEnd:o,polygonStart:function(){e.polygonStart(),k.lineStart=l},polygonEnd:function(){e.polygonEnd(),k.lineStart=n}};return k}function a(e,r,n,s,l,u,c,f,h,d,p,g,m,v){var y=c-e,b=f-r,x=y*y+b*b;if(x>4*i&&m--){var _=s+d,w=l+p,A=u+g,k=Math.sqrt(_*_+w*w+A*A),M=Math.asin(A/=k),T=xo(xo(A)-1)i||xo((y*C+b*O)/x-.5)>.3||s*d+l*p+u*g0&&16,e):Math.sqrt(i)},e}function ar(t){var e=nr(function(e,r){return t([e*Go,r*Go])});return function(t){return ur(e(t))}}function ir(t){this.stream=t}function or(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]*Vo,t[1]*Vo),[t[0]*h+l,u-t[1]*h]}function r(t){return(t=s.invert((t[0]-l)/h,(u-t[1])/h))&&[t[0]*Go,t[1]*Go]}function n(){s=Ce(o=hr(v,y,b),i);var t=i(g,m);return l=d-t[0]*h,u=p+t[1]*h,a()}function a(){return c&&(c.valid=!1,c=null),e}var i,o,s,l,u,c,f=nr(function(t,e){return t=i(t,e),[t[0]*h+l,u-t[1]*h]}),h=150,d=480,p=250,g=0,m=0,v=0,y=0,b=0,_=Ns,w=x,A=null,k=null;return e.stream=function(t){return c&&(c.valid=!1),c=ur(_(o,f(w(t)))),c.valid=!0,c},e.clipAngle=function(t){return arguments.length?(_=null==t?(A=t,Ns):Ve((A=+t)*Vo),a()):A},e.clipExtent=function(t){return arguments.length?(k=t,w=t?qe(t[0][0],t[0][1],t[1][0],t[1][1]):x,a()):k},e.scale=function(t){return arguments.length?(h=+t,n()):h},e.translate=function(t){return arguments.length?(d=+t[0],p=+t[1],n()):[d,p]},e.center=function(t){return arguments.length?(g=t[0]%360*Vo,m=t[1]%360*Vo,n()):[g*Go,m*Go]},e.rotate=function(t){return arguments.length?(v=t[0]%360*Vo,y=t[1]%360*Vo,b=t.length>2?t[2]%360*Vo:0,n()):[v*Go,y*Go,b*Go]},uo.rebind(e,f,"precision"),function(){return i=t.apply(this,arguments),e.invert=i.invert&&r,n()}}function ur(t){return or(t,function(e,r){t.point(e*Vo,r*Vo)})}function cr(t,e){return[t,e]}function fr(t,e){return[t>Bo?t-jo:t<-Bo?t+jo:t,e]}function hr(t,e,r){return t?e||r?Ce(pr(t),gr(e,r)):pr(t):e||r?gr(e,r):fr}function dr(t){return function(e,r){return e+=t,[e>Bo?e-jo:e<-Bo?e+jo:e,r]}}function pr(t){var e=dr(t);return e.invert=dr(-t),e}function gr(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*a;return[Math.atan2(l*i-c*o,s*n-u*a),nt(c*i+l*o)]}var n=Math.cos(t),a=Math.sin(t),i=Math.cos(e),o=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*i-l*o;return[Math.atan2(l*i+u*o,s*n+c*a),nt(c*n-s*a)]},r}function mr(t,e){var r=Math.cos(t),n=Math.sin(t);return function(a,i,o,s){var l=o*e;null!=a?(a=vr(r,a),i=vr(r,i),(o>0?ai)&&(a+=o*jo)):(a=t+o*jo,i=t-.5*l);for(var u,c=a;o>0?c>i:c0?e<-Uo+No&&(e=-Uo+No):e>Uo-No&&(e=Uo-No);var r=o/Math.pow(a(e),i);return[r*Math.sin(i*t),o-r*Math.cos(i*t)]}var n=Math.cos(t),a=function(t){return Math.tan(Bo/4+t/2)},i=t===e?Math.sin(t):Math.log(n/Math.cos(e))/Math.log(a(e)/a(t)),o=n*Math.pow(a(t),i)/i;return i?(r.invert=function(t,e){var r=o-e,n=tt(i)*Math.sqrt(t*t+r*r);return[Math.atan2(t,r)/i,2*Math.atan(Math.pow(o/n,1/i))-Uo]},r):Er}function Tr(t,e){function r(t,e){var r=i-e;return[r*Math.sin(a*t),i-r*Math.cos(a*t)]}var n=Math.cos(t),a=t===e?Math.sin(t):(n-Math.cos(e))/(e-t),i=n/a+t;return xo(a)1&&et(t[r[n-2]],t[r[n-1]],t[a])<=0;)--n;r[n++]=a}return r.slice(0,n)}function Rr(t,e){return t[0]-e[0]||t[1]-e[1]}function Dr(t,e,r){return(r[0]-e[0])*(t[1]-e[1])<(r[1]-e[1])*(t[0]-e[0])}function Pr(t,e,r,n){var a=t[0],i=r[0],o=e[0]-a,s=n[0]-i,l=t[1],u=r[1],c=e[1]-l,f=n[1]-u,h=(s*(l-u)-f*(a-i))/(f*o-s*c);return[a+h*o,l+h*c]}function zr(t){var e=t[0],r=t[t.length-1];return!(e[0]-r[0]||e[1]-r[1])}function Nr(){an(this),this.edge=this.site=this.circle=null}function Fr(t){var e=sl.pop()||new Nr;return e.site=t,e}function Br(t){Zr(t),al.remove(t),sl.push(t),an(t)}function jr(t){var e=t.circle,r=e.x,n=e.cy,a={x:r,y:n},i=t.P,o=t.N,s=[t];Br(t);for(var l=i;l.circle&&xo(r-l.circle.x)No)s=s.L;else{if(!((a=i-Vr(s,o))>No)){n>-No?(e=s.P,r=s):a>-No?(e=s,r=s.N):e=r=s;break}if(!s.R){e=s;break}s=s.R}var l=Fr(t);if(al.insert(e,l),e||r){if(e===r)return Zr(e),r=Fr(e.site),al.insert(l,r),l.edge=r.edge=Jr(e.site,l.site),Wr(e),void Wr(r);if(!r)return void(l.edge=Jr(e.site,l.site));Zr(e),Zr(r);var u=e.site,c=u.x,f=u.y,h=t.x-c,d=t.y-f,p=r.site,g=p.x-c,m=p.y-f,v=2*(h*m-d*g),y=h*h+d*d,b=g*g+m*m,x={x:(m*y-d*b)/v+c,y:(h*b-g*y)/v+f};en(r.edge,u,p,x),l.edge=Jr(u,t,null,x),r.edge=Jr(t,p,null,x),Wr(e),Wr(r)}}function Ur(t,e){var r=t.site,n=r.x,a=r.y,i=a-e;if(!i)return n;var o=t.P;if(!o)return-1/0;r=o.site;var s=r.x,l=r.y,u=l-e;if(!u)return s;var c=s-n,f=1/i-1/u,h=c/u;return f?(-h+Math.sqrt(h*h-2*f*(c*c/(-2*u)-l+u/2+a-i/2)))/f+n:(n+s)/2}function Vr(t,e){var r=t.N;if(r)return Ur(r,e);var n=t.site;return n.y===e?n.x:1/0}function Gr(t){this.site=t,this.edges=[]}function qr(t){for(var e,r,n,a,i,o,s,l,u,c,f=t[0][0],h=t[1][0],d=t[0][1],p=t[1][1],g=nl,m=g.length;m--;)if((i=g[m])&&i.prepare())for(s=i.edges,l=s.length,o=0;oNo||xo(a-r)>No)&&(s.splice(o,0,new rn(tn(i.site,c,xo(n-f)No?{x:f,y:xo(e-f)No?{x:xo(r-p)No?{x:h,y:xo(e-h)No?{x:xo(r-d)=-Fo)){var d=l*l+u*u,p=c*c+f*f,g=(f*d-u*p)/h,m=(l*p-c*d)/h,f=m+s,v=ll.pop()||new Yr;v.arc=t,v.site=a,v.x=g+o,v.y=f+Math.sqrt(g*g+m*m),v.cy=f,t.circle=v;for(var y=null,b=ol._;b;)if(v.y=s)return;if(h>p){if(i){if(i.y>=u)return}else i={x:m,y:l};r={x:m,y:u}}else{if(i){if(i.y1)if(h>p){if(i){if(i.y>=u)return}else i={x:(l-a)/n,y:l};r={x:(u-a)/n,y:u}}else{if(i){if(i.y=s)return}else i={x:o,y:n*o+a};r={x:s,y:n*s+a}}else{if(i){if(i.xi||f>o||h=x,A=r>=_,k=A<<1|w,M=k+4;ki&&(a=e.slice(i,a),s[o]?s[o]+=a:s[++o]=a),(r=r[0])===(n=n[0])?s[o]?s[o]+=n:s[++o]=n:(s[++o]=null,l.push({i:o,x:bn(r,n)})),i=fl.lastIndex;return i=0&&!(r=uo.interpolators[n](t,e)););return r}function wn(t,e){var r,n=[],a=[],i=t.length,o=e.length,s=Math.min(t.length,e.length);for(r=0;r=1?1:t(e)}}function kn(t){return function(e){return 1-t(1-e)}}function Mn(t){return function(e){return.5*(e<.5?t(2*e):2-t(2-2*e))}}function Tn(t){return t*t}function En(t){return t*t*t}function Ln(t){if(t<=0)return 0;if(t>=1)return 1;var e=t*t,r=e*t;return 4*(t<.5?r:3*(t-e)+r-.75)}function Sn(t){return function(e){return Math.pow(e,t)}}function Cn(t){return 1-Math.cos(t*Uo)}function On(t){return Math.pow(2,10*(t-1))}function In(t){return 1-Math.sqrt(1-t*t)}function Rn(t,e){var r;return arguments.length<2&&(e=.45),arguments.length?r=e/jo*Math.asin(1/t):(t=1,r=e/4),function(n){return 1+t*Math.pow(2,-10*n)*Math.sin((n-r)*jo/e)}}function Dn(t){return t||(t=1.70158),function(e){return e*e*((t+1)*e-t)}}function Pn(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375}function zn(t,e){t=uo.hcl(t),e=uo.hcl(e);var r=t.h,n=t.c,a=t.l,i=e.h-r,o=e.c-n,s=e.l-a;return isNaN(o)&&(o=0,n=isNaN(n)?e.c:n),isNaN(i)?(i=0,r=isNaN(r)?e.h:r):i>180?i-=360:i<-180&&(i+=360),function(t){return ht(r+i*t,n+o*t,a+s*t)+""}}function Nn(t,e){t=uo.hsl(t),e=uo.hsl(e);var r=t.h,n=t.s,a=t.l,i=e.h-r,o=e.s-n,s=e.l-a;return isNaN(o)&&(o=0,n=isNaN(n)?e.s:n),isNaN(i)?(i=0,r=isNaN(r)?e.h:r):i>180?i-=360:i<-180&&(i+=360),function(t){return ct(r+i*t,n+o*t,a+s*t)+""}}function Fn(t,e){t=uo.lab(t),e=uo.lab(e);var r=t.l,n=t.a,a=t.b,i=e.l-r,o=e.a-n,s=e.b-a;return function(t){return pt(r+i*t,n+o*t,a+s*t)+""}}function Bn(t,e){return e-=t,function(r){return Math.round(t+e*r)}}function jn(t){var e=[t.a,t.b],r=[t.c,t.d],n=Un(e),a=Hn(e,r),i=Un(Vn(r,e,-a))||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 a=r.push(Gn(r)+"scale(",null,",",null,")");n.push({i:a-4,x:bn(t[0],e[0])},{i:a-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=uo.transform(t),e=uo.transform(e),qn(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,a=-1,i=n.length;++a=0;)r.push(a[n])}function la(t,e){for(var r=[t],n=[];null!=(t=r.pop());)if(n.push(t),(i=t.children)&&(a=i.length))for(var a,i,o=-1;++oa&&(n=r,a=e);return n}function ba(t){return t.reduce(xa,0)}function xa(t,e){return t+e[1]}function _a(t,e){return wa(t,Math.ceil(Math.log(e.length)/Math.LN2+1))}function wa(t,e){for(var r=-1,n=+t[0],a=(t[1]-n)/e,i=[];++r<=e;)i[r]=a*r+n;return i}function Aa(t){return[uo.min(t),uo.max(t)]}function ka(t,e){return t.value-e.value}function Ma(t,e){var r=t._pack_next;t._pack_next=e,e._pack_prev=t,e._pack_next=r,r._pack_prev=e}function Ta(t,e){t._pack_next=e,e._pack_prev=t}function Ea(t,e){var r=e.x-t.x,n=e.y-t.y,a=t.r+e.r;return.999*a*a>r*r+n*n}function La(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((r=t.children)&&(u=r.length)){var r,n,a,i,o,s,l,u,c=1/0,f=-1/0,h=1/0,d=-1/0;if(r.forEach(Sa),n=r[0],n.x=-n.r,n.y=0,e(n),u>1&&(a=r[1],a.x=a.r,a.y=0,e(a),u>2))for(i=r[2],Ia(n,a,i),e(i),Ma(n,i),n._pack_prev=i,Ma(i,a),a=n._pack_next,o=3;o=0;)e=a[i],e.z+=r,e.m+=r,r+=e.s+(n+=e.c)}function Fa(t,e,r){return t.a.parent===e.parent?t.a:r}function Ba(t){return 1+uo.max(t,function(t){return t.y})}function ja(t){return t.reduce(function(t,e){return t+e.x},0)/t.length}function Ha(t){var e=t.children;return e&&e.length?Ha(e[0]):t}function Ua(t){var e,r=t.children;return r&&(e=r.length)?Ua(r[e-1]):t}function Va(t){return{x:t.x,y:t.y,dx:t.dx,dy:t.dy}}function Ga(t,e){var r=t.x+e[3],n=t.y+e[0],a=t.dx-e[1]-e[3],i=t.dy-e[0]-e[2];return a<0&&(r+=a/2,a=0),i<0&&(n+=i/2,i=0),{x:r,y:n,dx:a,dy:i}}function qa(t){var e=t[0],r=t[t.length-1];return e2?Qa:Ya,l=n?$n:Qn;return o=a(t,e,l,r),s=a(e,t,l,_n),i}function i(t){return o(t)}var o,s;return i.invert=function(t){return s(t)},i.domain=function(e){return arguments.length?(t=e.map(Number),a()):t},i.range=function(t){return arguments.length?(e=t,a()):e},i.rangeRound=function(t){return i.range(t).interpolate(Bn)},i.clamp=function(t){return arguments.length?(n=t,a()):n},i.interpolate=function(t){return arguments.length?(r=t,a()):r},i.ticks=function(e){return ei(t,e)},i.tickFormat=function(e,r){return ri(t,e,r)},i.nice=function(e){return Ja(t,e),a()},i.copy=function(){return $a(t,e,r,n)},a()}function Ka(t,e){return uo.rebind(t,e,"range","rangeRound","interpolate","clamp")}function Ja(t,e){return Wa(t,Za(ti(t,e)[2])),Wa(t,Za(ti(t,e)[2])),t}function ti(t,e){null==e&&(e=10);var r=qa(t),n=r[1]-r[0],a=Math.pow(10,Math.floor(Math.log(n/e)/Math.LN10)),i=e/n*a;return i<=.15?a*=10:i<=.35?a*=5:i<=.75&&(a*=2),r[0]=Math.ceil(r[0]/a)*a,r[1]=Math.floor(r[1]/a)*a+.5*a,r[2]=a,r}function ei(t,e){return uo.range.apply(uo,ti(t,e))}function ri(t,e,r){var n=ti(t,e);if(r){var a=cs.exec(r);if(a.shift(),"s"===a[8]){var i=uo.formatPrefix(Math.max(xo(n[0]),xo(n[1])));return a[7]||(a[7]="."+ni(i.scale(n[2]))),a[8]="f",r=uo.format(a.join("")),function(t){return r(i.scale(t))+i.symbol}}a[7]||(a[7]="."+ai(a[8],n)),r=a.join("")}else r=",."+ni(n[2])+"f";return uo.format(r)}function ni(t){return-Math.floor(Math.log(t)/Math.LN10+.01)}function ai(t,e){var r=ni(e[2]);return t in Al?Math.abs(r-ni(Math.max(xo(e[0]),xo(e[1]))))+ +("e"!==t):r-2*("%"===t)}function ii(t,e,r,n){function a(t){return(r?Math.log(t<0?0:t):-Math.log(t>0?0:-t))/Math.log(e)}function i(t){return r?Math.pow(e,t):-Math.pow(e,-t)}function o(e){return t(a(e))}return o.invert=function(e){return i(t.invert(e))},o.domain=function(e){return arguments.length?(r=e[0]>=0,t.domain((n=e.map(Number)).map(a)),o):n},o.base=function(r){return arguments.length?(e=+r,t.domain(n.map(a)),o):e},o.nice=function(){var e=Wa(n.map(a),r?Math:Ml);return t.domain(e),n=e.map(i),o},o.ticks=function(){var t=qa(n),o=[],s=t[0],l=t[1],u=Math.floor(a(s)),c=Math.ceil(a(l)),f=e%1?2:e;if(isFinite(c-u)){if(r){for(;u0;h--)o.push(i(u)*h);for(u=0;o[u]l;c--);o=o.slice(u,c)}return o},o.tickFormat=function(t,r){if(!arguments.length)return kl;arguments.length<2?r=kl:"function"!=typeof r&&(r=uo.format(r));var n=Math.max(1,e*t/o.ticks().length);return function(t){var o=t/i(Math.round(a(t)));return o*e0?s[r-1]:t[0],r0?0:1}function xi(t,e,r,n,a){var i=t[0]-e[0],o=t[1]-e[1],s=(a?n:-n)/Math.sqrt(i*i+o*o),l=s*o,u=-s*i,c=t[0]+l,f=t[1]+u,h=e[0]+l,d=e[1]+u,p=(c+h)/2,g=(f+d)/2,m=h-c,v=d-f,y=m*m+v*v,b=r-n,x=c*d-h*f,_=(v<0?-1:1)*Math.sqrt(Math.max(0,b*b*y-x*x)),w=(x*v-m*_)/y,A=(-x*m-v*_)/y,k=(x*v+m*_)/y,M=(-x*m+v*_)/y,T=w-p,E=A-g,L=k-p,S=M-g;return T*T+E*E>L*L+S*S&&(w=k,A=M),[[w-l,A-u],[w*r/b,A*r/b]]}function _i(t){function e(e){function o(){u.push("M",i(t(c),s))}for(var l,u=[],c=[],f=-1,h=e.length,d=Lt(r),p=Lt(n);++f1?t.join("L"):t+"Z"}function Ai(t){return t.join("L")+"Z"}function ki(t){for(var e=0,r=t.length,n=t[0],a=[n[0],",",n[1]];++e1&&a.push("H",n[0]),a.join("")}function Mi(t){for(var e=0,r=t.length,n=t[0],a=[n[0],",",n[1]];++e1){s=e[1],i=t[l],l++,n+="C"+(a[0]+o[0])+","+(a[1]+o[1])+","+(i[0]-s[0])+","+(i[1]-s[1])+","+i[0]+","+i[1];for(var u=2;u9&&(a=3*e/Math.sqrt(a),o[s]=a*r,o[s+1]=a*n));for(s=-1;++s<=l;)a=(t[Math.min(l,s+1)][0]-t[Math.max(0,s-1)][0])/(6*(1+o[s]*o[s])),i.push([a||0,o[s]*a||0]);return i}function Hi(t){return t.length<3?wi(t):t[0]+Ci(t,ji(t))}function Ui(t){for(var e,r,n,a=-1,i=t.length;++a0;)d[--s].call(t,o);if(i>=1)return g.event&&g.event.end.call(t,t.__data__,e),--p.count?delete p[n]:delete t[r],1}var l,u,c,h,d,p=t[r]||(t[r]={active:0,count:0}),g=p[n];g||(l=a.time,u=Rt(i,0,l),g=p[n]={tween:new f,time:l,timer:u,delay:a.delay,duration:a.duration,ease:a.ease,index:e},a=null,++p.count)}function ro(t,e,r){t.attr("transform",function(t){var n=e(t);return"translate("+(isFinite(n)?n:r(t))+",0)"})}function no(t,e,r){t.attr("transform",function(t){var n=e(t);return"translate(0,"+(isFinite(n)?n:r(t))+")"})}function ao(t){return t.toISOString()}function io(t,e,r){function n(e){return t(e)}function a(t,r){var n=t[1]-t[0],a=n/r,i=uo.bisect(Ql,a);return i==Ql.length?[e.year,ti(t.map(function(t){return t/31536e6}),r)[2]]:i?e[a/Ql[i-1]1?{floor:function(e){for(;r(e=t.floor(e));)e=oo(e-1);return e},ceil:function(e){for(;r(e=t.ceil(e));)e=oo(+e+1);return e}}:t))},n.ticks=function(t,e){var r=qa(n.domain()),i=null==t?a(r,10):"number"==typeof t?a(r,t):!t.range&&[{range:t},e];return i&&(t=i[0],e=i[1]),t.range(r[0],oo(+r[1]+1),e<1?1:e)},n.tickFormat=function(){return r},n.copy=function(){return io(t.copy(),e,r)},Ka(n,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.17"},co=[].slice,fo=function(t){return co.call(t)},ho=this.document;if(ho)try{fo(ho.documentElement.childNodes)[0].nodeType}catch(t){fo=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}),ho)try{ho.createElement("DIV").style.setProperty("opacity",0,"")}catch(t){var po=this.Element.prototype,go=po.setAttribute,mo=po.setAttributeNS,vo=this.CSSStyleDeclaration.prototype,yo=vo.setProperty;po.setAttribute=function(t,e){go.call(this,t,e+"")},po.setAttributeNS=function(t,e,r){mo.call(this,t,e,r+"")},vo.setProperty=function(t,e,r){yo.call(this,t,e+"",r)}}uo.ascending=a,uo.descending=function(t,e){return et?1:e>=t?0:NaN},uo.min=function(t,e){var r,n,a=-1,i=t.length;if(1===arguments.length){for(;++a=n){r=n;break}for(;++an&&(r=n)}else{for(;++a=n){r=n;break}for(;++an&&(r=n)}return r},uo.max=function(t,e){var r,n,a=-1,i=t.length;if(1===arguments.length){for(;++a=n){r=n;break}for(;++ar&&(r=n)}else{for(;++a=n){r=n;break}for(;++ar&&(r=n)}return r},uo.extent=function(t,e){var r,n,a,i=-1,o=t.length;if(1===arguments.length){for(;++i=n){r=a=n;break}for(;++in&&(r=n),a=n){r=a=n;break}for(;++in&&(r=n),a1)return l/(c-1)},uo.deviation=function(){var t=uo.variance.apply(this,arguments);return t?Math.sqrt(t):t};var bo=s(a);uo.bisectLeft=bo.left,uo.bisect=uo.bisectRight=bo.right,uo.bisector=function(t){return s(1===t.length?function(e,r){return a(t(e),r)}:t)},uo.shuffle=function(t,e,r){(i=arguments.length)<3&&(r=t.length,i<2&&(e=0));for(var n,a,i=r-e;i;)a=Math.random()*i--|0,n=t[i+e],t[i+e]=t[a+e],t[a+e]=n;return t},uo.permute=function(t,e){for(var r=e.length,n=new Array(r);r--;)n[r]=t[e[r]];return n},uo.pairs=function(t){for(var e=0,r=t.length-1,n=t[0],a=new Array(r<0?0:r);e=0;)for(n=t[a],e=n.length;--e>=0;)r[--o]=n[e];return r};var xo=Math.abs;uo.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,a=[],i=u(xo(r)),o=-1;if(t*=i,e*=i,r*=i,r<0)for(;(n=t+r*++o)>e;)a.push(n/i);else for(;(n=t+r*++o)=i.length)return n?n.call(a,o):r?o.sort(r):o;for(var l,u,c,h,d=-1,p=o.length,g=i[s++],m=new f;++d=i.length)return t;var n=[],a=o[r++];return t.forEach(function(t,a){n.push({key:t,values:e(a,r)})}),a?n.sort(function(t,e){return a(t.key,e.key)}):n}var r,n,a={},i=[],o=[];return a.map=function(e,r){return t(r,e,0)},a.entries=function(r){return e(t(uo.map,r,0),0)},a.key=function(t){return i.push(t),a},a.sortKeys=function(t){return o[i.length-1]=t,a},a.sortValues=function(t){return r=t,a},a.rollup=function(t){return n=t,a},a},uo.set=function(t){var e=new b;if(t)for(var r=0,n=t.length;r=0&&(n=t.slice(r+1),t=t.slice(0,r)),t)return arguments.length<2?this[t].on(n):this[t].on(n,e);if(2===arguments.length){if(null==e)for(t in this)this.hasOwnProperty(t)&&this[t].on(n,null);return this}},uo.event=null,uo.requote=function(t){return t.replace(ko,"\\$&")};var ko=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,Mo={}.__proto__?function(t,e){t.__proto__=e}:function(t,e){for(var r in e)t[r]=e[r]},To=function(t,e){return e.querySelector(t)},Eo=function(t,e){return e.querySelectorAll(t)},Lo=function(t,e){var r=t.matches||t[w(t,"matchesSelector")];return(Lo=function(t,e){return r.call(t,e)})(t,e)};"function"==typeof Sizzle&&(To=function(t,e){return Sizzle(t,e)[0]||null},Eo=Sizzle,Lo=Sizzle.matchesSelector),uo.selection=function(){return uo.select(ho.documentElement)};var So=uo.selection.prototype=[];So.select=function(t){var e,r,n,a,i=[];t=C(t);for(var o=-1,s=this.length;++o=0&&"xmlns"!==(r=t.slice(0,e))&&(t=t.slice(e+1)),Oo.hasOwnProperty(r)?{space:Oo[r],local:t}:t}},So.attr=function(t,e){if(arguments.length<2){if("string"==typeof t){var r=this.node();return t=uo.ns.qualify(t),t.local?r.getAttributeNS(t.space,t.local):r.getAttribute(t)}for(e in t)this.each(I(e,t[e]));return this}return this.each(I(t,e))},So.classed=function(t,e){if(arguments.length<2){if("string"==typeof t){var r=this.node(),n=(t=P(t)).length,a=-1;if(e=r.classList){for(;++a=0;)(r=n[a])&&(i&&i!==r.nextSibling&&i.parentNode.insertBefore(r,i),i=r);return this},So.sort=function(t){t=G.apply(this,arguments);for(var e=-1,r=this.length;++e0&&(e=e.transition().duration(S)),e.call(t.event)}function s(){_&&_.domain(x.range().map(function(t){return(t-k.x)/k.k}).map(x.invert)),A&&A.domain(w.range().map(function(t){return(t-k.y)/k.k}).map(w.invert))}function l(t){C++||t({type:"zoomstart"})}function u(t){s(),t({type:"zoom",scale:k.k,translate:[k.x,k.y]})}function c(t){--C||(t({type:"zoomend"}),m=null)}function f(){function t(){s=1,i(uo.mouse(a),h),u(o)}function r(){f.on(I,null).on(R,null),d(s),c(o)}var a=this,o=P.of(a,arguments),s=0,f=uo.select(n(a)).on(I,t).on(R,r),h=e(uo.mouse(a)),d=$(a);jl.call(a),l(o)}function h(){function t(){var t=uo.touches(p);return d=k.k,t.forEach(function(t){t.identifier in m&&(m[t.identifier]=e(t))}),t}function r(){var e=uo.event.target;uo.select(e).on(x,n).on(_,s),w.push(e);for(var r=uo.event.changedTouches,a=0,i=r.length;a1){var c=l[0],f=l[1],h=c[0]-f[0],d=c[1]-f[1];v=h*h+d*d}}function n(){var t,e,r,n,o=uo.touches(p);jl.call(p);for(var s=0,l=o.length;s=u)return o;if(a)return a=!1,i;var e=c;if(34===t.charCodeAt(e)){for(var r=e;r++=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i,fs=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,Nt(t,e))).toFixed(Math.max(0,Math.min(20,Nt(t*(1+1e-15),e))))}}),hs=uo.time={},ds=Date;Ht.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(){ps.setUTCDate.apply(this._,arguments)},setDay:function(){ps.setUTCDay.apply(this._,arguments)},setFullYear:function(){ps.setUTCFullYear.apply(this._,arguments)},setHours:function(){ps.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){ps.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){ps.setUTCMinutes.apply(this._,arguments)},setMonth:function(){ps.setUTCMonth.apply(this._,arguments)},setSeconds:function(){ps.setUTCSeconds.apply(this._,arguments)},setTime:function(){ps.setTime.apply(this._,arguments)}};var ps=Date.prototype;hs.year=Ut(function(t){return t=hs.day(t),t.setMonth(0,1),t},function(t,e){t.setFullYear(t.getFullYear()+e)},function(t){return t.getFullYear()}),hs.years=hs.year.range,hs.years.utc=hs.year.utc.range,hs.day=Ut(function(t){var e=new ds(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}),hs.days=hs.day.range,hs.days.utc=hs.day.utc.range,hs.dayOfYear=function(t){var e=hs.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=hs[t]=Ut(function(t){return(t=hs.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=hs.year(t).getDay();return Math.floor((hs.dayOfYear(t)+(r+e)%7)/7)-(r!==e)});hs[t+"s"]=r.range,hs[t+"s"].utc=r.utc.range,hs[t+"OfYear"]=function(t){var r=hs.year(t).getDay();return Math.floor((hs.dayOfYear(t)+(r+e)%7)/7)}}),hs.week=hs.sunday,hs.weeks=hs.sunday.range,hs.weeks.utc=hs.sunday.utc.range,hs.weekOfYear=hs.sundayOfYear;var gs={"-":"",_:" ",0:"0"},ms=/^\s*\d+/,vs=/^%/;uo.locale=function(t){return{numberFormat:Bt(t),timeFormat:Gt(t)}};var ys=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=ys.numberFormat,uo.geo={},fe.prototype={s:0,t:0,add:function(t){he(t,this.t,bs),he(bs.s,this.s,this),this.s?this.t+=bs.t:this.s=bs.t},reset:function(){this.s=this.t=0},valueOf:function(){return this.s}};var bs=new fe;uo.geo.stream=function(t,e){t&&xs.hasOwnProperty(t.type)?xs[t.type](t,e):de(t,e)};var xs={Feature:function(t,e){de(t.geometry,e)},FeatureCollection:function(t,e){for(var r=t.features,n=-1,a=r.length;++nd&&(d=e)}function e(e,r){var n=ve([e*Vo,r*Vo]);if(v){var a=be(v,n),i=[a[1],-a[0],0],o=be(i,a);we(o),o=Ae(o);var l=e-p,u=l>0?1:-1,g=o[0]*Go*u,m=xo(l)>180;if(m^(u*pd&&(d=y)}else if(g=(g+360)%360-180,m^(u*pd&&(d=r);m?es(c,h)&&(h=e):s(e,h)>s(c,h)&&(c=e):h>=c?(eh&&(h=e)):e>p?s(c,e)>s(c,h)&&(h=e):s(e,h)>s(c,h)&&(c=e)}else t(e,r);v=n,p=e}function r(){_.point=e}function n(){x[0]=c,x[1]=h,_.point=t,v=null}function a(t,r){if(v){var n=t-p;y+=xo(n)>180?n+(n>0?360:-360):n}else g=t,m=r;ks.point(t,r),e(t,r)}function i(){ks.lineStart()}function o(){a(g,m),ks.lineEnd(),xo(y)>No&&(c=-(h=180)),x[0]=c,x[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]:tNo?d=90:y<-No&&(f=-90),x[0]=c,x[1]=h}};return function(t){d=h=-(c=f=1/0),b=[],uo.geo.stream(t,_);var e=b.length;if(e){b.sort(l);for(var r,n=1,a=b[0],i=[a];ns(a[0],a[1])&&(a[1]=r[1]),s(r[0],a[1])>s(a[0],a[1])&&(a[0]=r[0])):i.push(a=r);for(var o,r,p=-1/0,e=i.length-1,n=0,a=i[e];n<=e;a=r,++n)r=i[n],(o=s(a[1],r[0]))>p&&(p=o,c=r[0],h=a[1])}return b=x=null,c===1/0||f===1/0?[[NaN,NaN],[NaN,NaN]]:[[c,f],[h,d]]}}(),uo.geo.centroid=function(t){ -Ms=Ts=Es=Ls=Ss=Cs=Os=Is=Rs=Ds=Ps=0,uo.geo.stream(t,zs);var e=Rs,r=Ds,n=Ps,a=e*e+r*r+n*n;return a=.12&&a<.234&&n>=-.425&&n<-.214?o:a>=.166&&a<.234&&n>=-.214&&n<-.115?s:i).invert(t)},t.stream=function(t){var e=i.stream(t),r=o.stream(t),n=s.stream(t);return{point:function(t,a){e.point(t,a),r.point(t,a),n.point(t,a)},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?(i.precision(e),o.precision(e),s.precision(e),t):i.precision()},t.scale=function(e){return arguments.length?(i.scale(e),o.scale(.35*e),s.scale(e),t.translate(i.translate())):i.scale()},t.translate=function(e){if(!arguments.length)return i.translate();var u=i.scale(),c=+e[0],f=+e[1];return r=i.translate(e).clipExtent([[c-.455*u,f-.238*u],[c+.455*u,f+.238*u]]).stream(l).point,n=o.translate([c-.307*u,f+.201*u]).clipExtent([[c-.425*u+No,f+.12*u+No],[c-.214*u-No,f+.234*u-No]]).stream(l).point,a=s.translate([c-.205*u,f+.212*u]).clipExtent([[c-.214*u+No,f+.166*u+No],[c-.115*u-No,f+.234*u-No]]).stream(l).point,t},t.scale(1070)};var Bs,js,Hs,Us,Vs,Gs,qs={point:A,lineStart:A,lineEnd:A,polygonStart:function(){js=0,qs.lineStart=We},polygonEnd:function(){qs.lineStart=qs.lineEnd=qs.point=A,Bs+=xo(js/2)}},Xs={point:Ze,lineStart:A,lineEnd:A,polygonStart:A,polygonEnd:A},Ys={point:Ke,lineStart:Je,lineEnd:tr,polygonStart:function(){Ys.lineStart=er},polygonEnd:function(){Ys.point=Ke,Ys.lineStart=Je,Ys.lineEnd=tr}};uo.geo.path=function(){function t(t){return t&&("function"==typeof s&&i.pointRadius(+s.apply(this,arguments)),o&&o.valid||(o=a(i)),uo.geo.stream(t,o)),i.result()}function e(){return o=null,t}var r,n,a,i,o,s=4.5;return t.area=function(t){return Bs=0,uo.geo.stream(t,a(qs)),Bs},t.centroid=function(t){return Es=Ls=Ss=Cs=Os=Is=Rs=Ds=Ps=0,uo.geo.stream(t,a(Ys)),Ps?[Rs/Ps,Ds/Ps]:Is?[Cs/Is,Os/Is]:Ss?[Es/Ss,Ls/Ss]:[NaN,NaN]},t.bounds=function(t){return Vs=Gs=-(Hs=Us=1/0),uo.geo.stream(t,a(Xs)),[[Hs,Us],[Vs,Gs]]},t.projection=function(t){return arguments.length?(a=(r=t)?t.stream||ar(t):x,e()):r},t.context=function(t){return arguments.length?(i=null==(n=t)?new Qe:new rr(t),"function"!=typeof s&&i.pointRadius(s),e()):n},t.pointRadius=function(e){return arguments.length?(s="function"==typeof e?e:(i.pointRadius(+e),+e),t):s},t.projection(uo.geo.albersUsa()).context(null)},uo.geo.transform=function(t){return{stream:function(e){var r=new ir(e);for(var n in t)r[n]=t[n];return r}}},ir.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=sr,uo.geo.projectionMutator=lr,(uo.geo.equirectangular=function(){return sr(cr)}).raw=cr.invert=cr,uo.geo.rotation=function(t){function e(e){return e=t(e[0]*Vo,e[1]*Vo),e[0]*=Go,e[1]*=Go,e}return t=hr(t[0]%360*Vo,t[1]*Vo,t.length>2?t[2]*Vo:0),e.invert=function(e){return e=t.invert(e[0]*Vo,e[1]*Vo),e[0]*=Go,e[1]*=Go,e},e},fr.invert=cr,uo.geo.circle=function(){function t(){var t="function"==typeof n?n.apply(this,arguments):n,e=hr(-t[0]*Vo,-t[1]*Vo,0).invert,a=[];return r(null,null,1,{point:function(t,r){a.push(t=e(t,r)),t[0]*=Go,t[1]*=Go}}),{type:"Polygon",coordinates:[a]}}var e,r,n=[0,0],a=6;return t.origin=function(e){return arguments.length?(n=e,t):n},t.angle=function(n){return arguments.length?(r=mr((e=+n)*Vo,a*Vo),t):e},t.precision=function(n){return arguments.length?(r=mr(e*Vo,(a=+n)*Vo),t):a},t.angle(90)},uo.geo.distance=function(t,e){var r,n=(e[0]-t[0])*Vo,a=t[1]*Vo,i=e[1]*Vo,o=Math.sin(n),s=Math.cos(n),l=Math.sin(a),u=Math.cos(a),c=Math.sin(i),f=Math.cos(i);return Math.atan2(Math.sqrt((r=f*o)*r+(r=u*c-l*f*s)*r),l*c+u*f*s)},uo.geo.graticule=function(){function t(){return{type:"MultiLineString",coordinates:e()}}function e(){return uo.range(Math.ceil(i/m)*m,a,m).map(h).concat(uo.range(Math.ceil(u/v)*v,l,v).map(d)).concat(uo.range(Math.ceil(n/p)*p,r,p).filter(function(t){return xo(t%m)>No}).map(c)).concat(uo.range(Math.ceil(s/g)*g,o,g).filter(function(t){return xo(t%v)>No}).map(f))}var r,n,a,i,o,s,l,u,c,f,h,d,p=10,g=p,m=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(i).concat(d(l).slice(1),h(a).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?(i=+e[0][0],a=+e[1][0],u=+e[0][1],l=+e[1][1],i>a&&(e=i,i=a,a=e),u>l&&(e=u,u=l,l=e),t.precision(y)):[[i,u],[a,l]]},t.minorExtent=function(e){return arguments.length?(n=+e[0][0],r=+e[1][0],s=+e[0][1],o=+e[1][1],n>r&&(e=n,n=r,r=e),s>o&&(e=s,s=o,o=e),t.precision(y)):[[n,s],[r,o]]},t.step=function(e){return arguments.length?t.majorStep(e).minorStep(e):t.minorStep()},t.majorStep=function(e){return arguments.length?(m=+e[0],v=+e[1],t):[m,v]},t.minorStep=function(e){return arguments.length?(p=+e[0],g=+e[1],t):[p,g]},t.precision=function(e){return arguments.length?(y=+e,c=yr(s,o,90),f=br(n,r,y),h=yr(u,l,90),d=br(i,a,y),t):y},t.majorExtent([[-180,-90+No],[180,90-No]]).minorExtent([[-180,-80-No],[180,80+No]])},uo.geo.greatArc=function(){function t(){return{type:"LineString",coordinates:[e||n.apply(this,arguments),r||a.apply(this,arguments)]}}var e,r,n=xr,a=_r;return t.distance=function(){return uo.geo.distance(e||n.apply(this,arguments),r||a.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?(a=e,r="function"==typeof e?null:e,t):a},t.precision=function(){return arguments.length?t:0},t},uo.geo.interpolate=function(t,e){return wr(t[0]*Vo,t[1]*Vo,e[0]*Vo,e[1]*Vo)},uo.geo.length=function(t){return Ws=0,uo.geo.stream(t,Zs),Ws};var Ws,Zs={sphere:A,point:A,lineStart:Ar,lineEnd:A,polygonStart:A,polygonEnd:A},Qs=kr(function(t){return Math.sqrt(2/(1+t))},function(t){return 2*Math.asin(t/2)});(uo.geo.azimuthalEqualArea=function(){return sr(Qs)}).raw=Qs;var $s=kr(function(t){var e=Math.acos(t);return e&&e/Math.sin(e)},x);(uo.geo.azimuthalEquidistant=function(){return sr($s)}).raw=$s,(uo.geo.conicConformal=function(){return Xe(Mr)}).raw=Mr,(uo.geo.conicEquidistant=function(){return Xe(Tr)}).raw=Tr;var Ks=kr(function(t){return 1/t},Math.atan);(uo.geo.gnomonic=function(){return sr(Ks)}).raw=Ks,Er.invert=function(t,e){return[t,2*Math.atan(Math.exp(e))-Uo]},(uo.geo.mercator=function(){return Lr(Er)}).raw=Er;var Js=kr(function(){return 1},Math.asin);(uo.geo.orthographic=function(){return sr(Js)}).raw=Js;var tl=kr(function(t){return 1/(1+t)},function(t){return 2*Math.atan(t)});(uo.geo.stereographic=function(){return sr(tl)}).raw=tl,Sr.invert=function(t,e){return[-e,2*Math.atan(Math.exp(t))-Uo]},(uo.geo.transverseMercator=function(){var t=Lr(Sr),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=Sr,uo.geom={},uo.geom.hull=function(t){function e(t){if(t.length<3)return[];var e,a=Lt(r),i=Lt(n),o=t.length,s=[],l=[];for(e=0;e=0;--e)d.push(t[s[u[e]][2]]);for(e=+f;e=n&&u.x<=i&&u.y>=a&&u.y<=o?[[n,o],[i,o],[i,a],[n,a]]:[]).point=t[s]}),e}function r(t){return t.map(function(t,e){return{x:Math.round(i(t,e)/No)*No,y:Math.round(o(t,e)/No)*No,i:e}})}var n=Cr,a=Or,i=n,o=a,s=ul;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 a,i=r.site,o=r.edges.sort(Xr),s=-1,l=o.length,u=o[l-1].edge,c=u.l===i?u.r:u.l;++s=u,h=n>=c,d=h<<1|f;t.leaf=!1,t=t.nodes[d]||(t.nodes[d]=pn()),f?a=u:s=u,h?o=c:l=c,i(t,e,r,n,a,o,s,l)}var c,f,h,d,p,g,m,v,y,b=Lt(s),x=Lt(l);if(null!=e)g=e,m=r,v=n,y=a;else if(v=y=-(g=m=1/0),f=[],h=[],p=t.length,o)for(d=0;dv&&(v=c.x),c.y>y&&(y=c.y),f.push(c.x),h.push(c.y);else for(d=0;dv&&(v=_),w>y&&(y=w),f.push(_),h.push(w)}var A=v-g,k=y-m;A>k?y=m+A:v=g+k;var M=pn();if(M.add=function(t){i(M,t,+b(t,++d),+x(t,d),g,m,v,y)},M.visit=function(t){gn(t,M,g,m,v,y)},M.find=function(t){return mn(M,t[0],t[1],g,m,v,y)},d=-1,null==e){for(;++d=0?t.slice(0,e):t,n=e>=0?t.slice(e+1):"in";return r=dl.get(r)||hl,n=pl.get(n)||x,An(n(r.apply(null,co.call(arguments,1))))},uo.interpolateHcl=zn,uo.interpolateHsl=Nn,uo.interpolateLab=Fn,uo.interpolateRound=Bn,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 r=e.transform.baseVal.consolidate()}return new jn(r?r.matrix:gl)})(t)},jn.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var gl={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;++r0?a=t:(r.c=null,r.t=NaN,r=null,u.end({type:"end",alpha:a=0})):t>0&&(u.start({type:"start",alpha:a=t}),r=Rt(l.tick)),l):a},l.start=function(){function t(t,n){if(!r){for(r=new Array(a),l=0;l=0;)o.push(c=u[l]),c.parent=i,c.depth=i.depth+1;n&&(i.value=0),i.children=u}else n&&(i.value=+n.call(t,i,i.depth)||0),delete i.children;return la(a,function(t){var r,a;e&&(r=t.children)&&r.sort(e),n&&(a=t.parent)&&(a.value+=t.value)}),s}var e=fa,r=ua,n=ca;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&&(sa(e,function(t){t.children&&(t.value=0)}),la(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,a){var i=e.children;if(e.x=r,e.y=e.depth*a,e.dx=n,e.dy=a,i&&(o=i.length)){var o,s,l,u=-1;for(n=e.value?n/e.value:0;++us&&(s=n),o.push(n)}for(r=0;r0)for(i=-1;++i=c[0]&&s<=c[1]&&(o=l[uo.bisect(f,s,1,d)-1],o.y+=p,o.push(t[i]));return l}var e=!0,r=Number,n=Aa,a=_a;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?(a="number"==typeof e?function(t){return wa(t,e)}:Lt(e),t):a},t.frequency=function(r){return arguments.length?(e=!!r,t):e},t},uo.layout.pack=function(){function t(t,i){var o=r.call(this,t,i),s=o[0],l=a[0],u=a[1],c=null==e?Math.sqrt:"function"==typeof e?e:function(){return e};if(s.x=s.y=0,la(s,function(t){t.r=+c(t.value)}),la(s,La),n){var f=n*(e?1:Math.max(2*s.r/l,2*s.r/u))/2;la(s,function(t){t.r+=f}),la(s,La),la(s,function(t){t.r-=f})}return Oa(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(ka),n=0,a=[1,1];return t.size=function(e){return arguments.length?(a=e,t):a},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},oa(t,r)},uo.layout.tree=function(){function t(t,a){var c=o.call(this,t,a),f=c[0],h=e(f);if(la(h,r),h.parent.m=-h.z,sa(h,n),u)sa(f,i);else{var d=f,p=f,g=f;sa(f,function(t){t.xp.x&&(p=t),t.depth>g.depth&&(g=t)});var m=s(d,p)/2-d.x,v=l[0]/(p.x+s(p,d)/2+m),y=l[1]/(g.depth||1);sa(f,function(t){t.x=(t.x+m)*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 a,i=e.children,o=0,s=i.length;o0&&(za(Fa(o,t,r),t,n),u+=n,c+=n),f+=o.m,u+=a.m,h+=l.m,c+=i.m;o&&!Pa(i)&&(i.t=o,i.m+=f-c),a&&!Da(l)&&(l.t=a,l.m+=u-h,r=t)}return r}function i(t){t.x*=l[0],t.y=t.depth*l[1]}var o=uo.layout.hierarchy().sort(null).value(null),s=Ra,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)?i:null,t):u?null:l},t.nodeSize=function(e){return arguments.length?(u=null==(l=e)?null:i,t):u?l:null},oa(t,o)},uo.layout.cluster=function(){function t(t,i){var o,s=e.call(this,t,i),l=s[0],u=0;la(l,function(t){var e=t.children;e&&e.length?(t.x=ja(e),t.y=Ba(e)):(t.x=o?u+=r(t,o):0,t.y=0,o=t)});var c=Ha(l),f=Ua(l),h=c.x-r(c,f)/2,d=f.x+r(f,c)/2;return la(l,a?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=Ra,n=[1,1],a=!1;return t.separation=function(e){return arguments.length?(r=e,t):r},t.size=function(e){return arguments.length?(a=null==(n=e),t):a?null:n},t.nodeSize=function(e){return arguments.length?(a=null!=(n=e),t):a?n:null},oa(t,e)},uo.layout.treemap=function(){function t(t,e){for(var r,n,a=-1,i=t.length;++a0;)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,a(c,g,u,!1),g=Math.min(u.dx,u.dy),c.length=c.area=0,p=1/0);c.length&&(a(c,g,u,!0),c.length=c.area=0),i.forEach(e)}}function r(e){var n=e.children;if(n&&n.length){var i,o=f(e),s=n.slice(),l=[];for(t(s,o.dx*o.dy/e.value),l.area=0;i=s.pop();)l.push(i),l.area+=i.area,null!=i.z&&(a(l,i.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,a=0,i=1/0,o=-1,s=t.length;++oa&&(a=r));return n*=n,e*=e,n?Math.max(e*a*p/n,n/(e*i*p)):1/0}function a(t,e,r,n){var a,i=-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);++ir.dx)&&(c=r.dx);++i1);return t+e*r*Math.sqrt(-2*Math.log(a)/a)}},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;rf?0:1;if(u=Ho)return e(u,d)+(t?e(t,1-d):"")+"Z";var p,g,m,v,y,b,x,_,w,A,k,M,T=0,E=0,L=[];if((v=(+l.apply(this,arguments)||0)/2)&&(m=i===Cl?Math.sqrt(t*t+u*u):+i.apply(this,arguments),d||(E*=-1),u&&(E=nt(m/u*Math.sin(v))),t&&(T=nt(m/t*Math.sin(v)))),u){y=u*Math.cos(c+E),b=u*Math.sin(c+E),x=u*Math.cos(f-E),_=u*Math.sin(f-E);var S=Math.abs(f-c-2*E)<=Bo?0:1;if(E&&bi(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-T),A=t*Math.sin(f-T),k=t*Math.cos(c+T),M=t*Math.sin(c+T);var O=Math.abs(c-f+2*T)<=Bo?0:1;if(T&&bi(w,A,k,M)===1-d^O){var I=(c+f)/2;w=t*Math.cos(I),A=t*Math.sin(I),k=M=null}}else w=A=0;if(h>No&&(p=Math.min(Math.abs(u-t)/2,+a.apply(this,arguments)))>.001){g=tBo)+",1 "+e}function a(t,e,r,n){return"Q 0,0 "+n}var i=xr,o=_r,s=Gi,l=mi,u=vi;return t.radius=function(e){return arguments.length?(s=Lt(e),t):s},t.source=function(e){return arguments.length?(i=Lt(e),t):i},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,a){var i=e.call(this,t,a),o=r.call(this,t,a),s=(i.y+o.y)/2,l=[i,{x:i.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=qi;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=qi,r=t.projection;return t.projection=function(t){return arguments.length?r(Xi(e=t)):e},t},uo.svg.symbol=function(){function t(t,n){return(Pl.get(e.call(this,t,n))||Zi)(r.call(this,t,n))}var e=Wi,r=Yi;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 Pl=uo.map({circle:Zi,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*Nl)),r=e*Nl;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/zl),r=e*zl/2;return"M0,"+r+"L"+e+","+-r+" "+-e+","+-r+"Z"},"triangle-up":function(t){var e=Math.sqrt(t/zl),r=e*zl/2;return"M0,"+-r+"L"+e+","+r+" "+-e+","+r+"Z"}});uo.svg.symbolTypes=Pl.keys();var zl=Math.sqrt(3),Nl=Math.tan(30*Vo);So.transition=function(t){for(var e,r,n=Fl||++Ul,a=to(t),i=[],o=Bl||{time:Date.now(),ease:Ln,delay:0,duration:250},s=-1,l=this.length;++srect,.s>rect").attr("width",f[1]-f[0])}function a(t){t.select(".extent").attr("y",h[0]),t.selectAll(".extent,.e>rect,.w>rect").attr("height",h[1]-h[0])}function i(){function i(){32==uo.event.keyCode&&(S||(b=null,O[0]-=f[1],O[1]-=h[1],S=2),T())}function g(){32==uo.event.keyCode&&2==S&&(O[0]+=f[1],O[1]+=h[1],S=0,T())}function m(){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]),O[0]=f[+(t[0]>>31},e.exports.exponent=function(t){return(e.exports.hi(t)<<1>>>21)-1023},e.exports.fraction=function(t){var r=e.exports.lo(t),n=e.exports.hi(t),a=1048575&n;return 2146435072&n&&(a+=1<<20),[r,a]},e.exports.denormalized=function(t){return!(2146435072&e.exports.hi(t))}}).call(this,t("buffer").Buffer)},{buffer:40}],64:[function(t,e,r){"use strict";function n(t,e,r){var a=0|t[r];if(a<=0)return[];var i,o=new Array(a);if(r===t.length-1)for(i=0;i0)return a(0|t,e);break;case"object":if("number"==typeof t.length)return n(t,e,0)}return[]}e.exports=i},{}],65:[function(t,e,r){"use strict";function n(t,e){var r=t.length;if("number"!=typeof e){e=0;for(var n=0;n0&&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(!a(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,i,s;if(!a(e))throw TypeError("listener must be a function");if(!this._events||!this._events[t])return this;if(r=this._events[t],i=r.length,n=-1,r===e||a(r.listener)&&r.listener===e)delete this._events[t],this._events.removeListener&&this.emit("removeListener",t,e);else if(o(r)){for(s=i;s-- >0;)if(r[s]===e||r[s].listener&&r[s].listener===e){n=s;break}if(n<0)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], -a(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){return this._events&&this._events[t]?a(this._events[t])?[this._events[t]]:this._events[t].slice():[]},n.prototype.listenerCount=function(t){if(this._events){var e=this._events[t];if(a(e))return 1;if(e)return e.length}return 0},n.listenerCount=function(t,e){return t.listenerCount(e)}},{}],68:[function(t,e,r){"use strict";function n(t){for(var e,r=t.length,n=0;n13)&&32!==e&&133!==e&&160!==e&&5760!==e&&6158!==e&&(e<8192||e>8205)&&8232!==e&&8233!==e&&8239!==e&&8287!==e&&8288!==e&&12288!==e&&65279!==e)return!1;return!0}e.exports=function(t){var e=typeof t;if("string"===e){var r=t;if(0===(t=+t)&&n(r))return!1}else if("number"!==e)return!1;return t-t<1}},{}],69:[function(t,e,r){"use strict";function n(t){t=t||{};var e,r,n=t.canvas||document.createElement("canvas"),o=t.family||"sans-serif",s=t.shape||[512,512],l=t.step||[32,32],u=parseFloat(t.size)||16,c=t.chars||[32,126],f=Math.floor((l[0]-u)/2),h=t.radius||1.5*f,d=new i(u,f,h,0,o),p=null==t.align?"optical":t.align,g=null==t.fit||1==t.fit?.5:t.fit;if(Array.isArray(c)){if(2===c.length&&"number"==typeof c[0]&&"number"==typeof c[1]){var m=[];for(e=c[0],r=0;e<=c[1];e++)m[r++]=String.fromCharCode(e);c=m}}else c=String(c).split("");s=s.slice(),n.width=s[0],n.height=s[1];var v=n.getContext("2d");v.fillStyle="#000",v.fillRect(0,0,n.width,n.height),v.textBaseline="middle";var y=l[0],b=l[1],x=0,_=0,w=u/b,A=Math.min(c.length,Math.floor(s[0]/y)*Math.ceil(s[1]/b)),k=d.ctx.textAlign,M=d.buffer,T=d.middle;for(d.ctx.textAlign="center",d.buffer=d.size/2,e=0;es[0]-l[0]&&(x=0,_+=l[1])}return d.ctx.textAlign=k,d.buffer=M,d.middle=T,n}function a(t,e,r){if(s[e]&&s[e][t])return s[e][t];var n=200*r,a=o(t,{size:200,fontSize:n,fontFamily:e});s[e]||(s[e]={});var i={center:[a.center[0]/200,a.center[1]/200],bounds:a.bounds.map(function(t){return t/200}),radius:a.radius/200};return s[e][t]=i,i}var i=t("tiny-sdf"),o=t("optical-properties");e.exports=n;var s={}},{"optical-properties":165,"tiny-sdf":199}],70:[function(t,e,r){"use strict";function n(t,e,r,n,a,i){this._color=t,this.key=e,this.value=r,this.left=n,this.right=a,this._count=i}function a(t){return new n(t._color,t.key,t.value,t.left,t.right,t._count)}function i(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||(e.right?l(t,e.right):void 0)}function u(t,e,r,n){if(e(t,n.key)<=0){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}if(n.right)return u(t,e,r,n.right)}function c(t,e,r,n,a){var i,o=r(t,a.key),s=r(e,a.key);if(o<=0){if(a.left&&(i=c(t,e,r,n,a.left)))return i;if(s>0&&(i=n(a.key,a.value)))return i}if(s>0&&a.right)return c(t,e,r,n,a.right)}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=v);if(r=t[l-1],r.left===e){if(n=r.right,n.right&&n.right._color===m){if(n=r.right=a(n),s=n.right=a(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,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===m){if(n=r.right=a(n),s=n.left=a(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,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===v){if(r._color===m)return r._color=v,void(r.right=i(m,n));r.right=i(m,n);continue}if(n=a(n),r.right=n.left,n.left=r,n._color=r._color,r._color=m,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===m){if(n=r.left=a(n),s=n.right=a(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,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===v){if(r._color===m)return r._color=v,void(r.left=i(m,n));r.left=i(m,n);continue}if(n=a(n),r.left=n.right,n.right=r,n._color=r._color,r._color=m,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+1e?1:0}function g(t){return new s(t||p,null)}e.exports=g;var m=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,a=this.root,l=[],u=[];a;){var c=r(t,a.key);l.push(a),u.push(c),a=c<=0?a.left:a.right}l.push(new n(m,t,e,null,null,1));for(var f=l.length-2;f>=0;--f){var a=l[f];u[f]<=0?l[f]=new n(a._color,a.key,a.value,l[f+1],a.right,a._count+1):l[f]=new n(a._color,a.key,a.value,a.left,l[f+1],a._count+1)}for(var f=l.length-1;f>1;--f){var h=l[f-1],a=l[f];if(h._color===v||a._color===v)break;var d=l[f-2];if(d.left===h)if(h.left===a){var p=d.right;if(!p||p._color!==m){if(d._color=m,d.left=h.right,h._color=v,h.right=d,l[f-2]=h,l[f-1]=a,o(d),o(h),f>=3){var g=l[f-3];g.left===d?g.left=h:g.right=h}break}h._color=v,d.right=i(v,p),d._color=m,f-=1}else{var p=d.right;if(!p||p._color!==m){if(h.right=a.left,d._color=m,d.left=a.right,a._color=v,a.left=h,a.right=d,l[f-2]=a,l[f-1]=h,o(d),o(h),o(a),f>=3){var g=l[f-3];g.left===d?g.left=a:g.right=a}break}h._color=v,d.right=i(v,p),d._color=m,f-=1}else if(h.right===a){var p=d.left;if(!p||p._color!==m){if(d._color=m,d.right=h.left,h._color=v,h.left=d,l[f-2]=h,l[f-1]=a,o(d),o(h),f>=3){var g=l[f-3];g.right===d?g.right=h:g.left=h}break}h._color=v,d.left=i(v,p),d._color=m,f-=1}else{var p=d.left;if(!p||p._color!==m){if(h.left=a.right,d._color=m,d.right=a.left,a._color=v,a.right=h,a.left=d,l[f-2]=a,l[f-1]=h,o(d),o(h),o(a),f>=3){var g=l[f-3];g.right===d?g.right=a:g.left=a}break}h._color=v,d.left=i(v,p),d._color=m,f-=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 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(t<0)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=[],a=0;r;){var i=e(t,r.key);n.push(r),i<=0&&(a=n.length),r=i<=0?r.left:r.right}return n.length=a,new f(this,n)},y.gt=function(t){for(var e=this._compare,r=this.root,n=[],a=0;r;){var i=e(t,r.key);n.push(r),i<0&&(a=n.length),r=i<0?r.left:r.right}return n.length=a,new f(this,n)},y.lt=function(t){for(var e=this._compare,r=this.root,n=[],a=0;r;){var i=e(t,r.key);n.push(r),i>0&&(a=n.length),r=i<=0?r.left:r.right}return n.length=a,new f(this,n)},y.le=function(t){for(var e=this._compare,r=this.root,n=[],a=0;r;){var i=e(t,r.key);n.push(r),i>=0&&(a=n.length),r=i<0?r.left:r.right}return n.length=a,new f(this,n)},y.find=function(t){for(var e=this._compare,r=this.root,n=[];r;){var a=e(t,r.key);if(n.push(r),0===a)return new f(this,n);r=a<=0?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=n<=0?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 a=t.length-2;a>=0;--a){var r=t[a];r.left===t[a+1]?e[a]=new n(r._color,r.key,r.value,e[a+1],r.right,r._count):e[a]=new n(r._color,r.key,r.value,r.left,e[a+1],r._count)}if(r=e[e.length-1],r.left&&r.right){var i=e.length;for(r=r.left;r.right;)e.push(r),r=r.right;var o=e[i-1];e.push(new n(r._color,o.key,o.value,r.left,r.right,r._count)),e[i-1].key=r.key,e[i-1].value=r.value;for(var a=e.length-2;a>=i;--a)r=e[a],e[a]=new n(r._color,r.key,r.value,r.left,e[a+1],r._count);e[i-1].left=e[i]}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 a=0;a0)return this._stack[this._stack.length-1].key},enumerable:!0}),Object.defineProperty(b,"value",{get:function(){if(this._stack.length>0)return this._stack[this._stack.length-1].value},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),a=e[e.length-1];r[r.length-1]=new n(a._color,a.key,t,a.left,a.right,a._count);for(var i=e.length-2;i>=0;--i)a=e[i],a.left===e[i+1]?r[i]=new n(a._color,a.key,a.value,r[i+1],a.right,a._count):r[i]=new n(a._color,a.key,a.value,a.left,r[i+1],a._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}})},{}],71:[function(t,e,r){function n(t){if(t<0)return Number("0/0");for(var e=o[0],r=o.length-1;r>0;--r)e+=o[r]/(t+r);var n=t+i+.5;return.5*Math.log(2*Math.PI)+(t+.5)*Math.log(n)-n+Math.log(e)-Math.log(t)}var a=[.9999999999998099,676.5203681218851,-1259.1392167224028,771.3234287776531,-176.6150291621406,12.507343278686905,-.13857109526572012,9984369578019572e-21,1.5056327351493116e-7],i=607/128,o=[.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 t(e){if(e<.5)return Math.PI/(Math.sin(Math.PI*e)*t(1-e));if(e>100)return Math.exp(n(e));e-=1;for(var r=a[0],i=1;i<9;i++)r+=a[i]/(e+i);var o=e+7+.5;return Math.sqrt(2*Math.PI)*Math.pow(o,e+.5)*Math.exp(-o)*r},e.exports.log=n},{}],72:[function(t,e,r){function n(t,e){if("string"!=typeof t)throw new TypeError("must specify type string");if(e=e||{},"undefined"==typeof document&&!e.canvas)return null;var r=e.canvas||document.createElement("canvas");"number"==typeof e.width&&(r.width=e.width),"number"==typeof e.height&&(r.height=e.height);var n,a=e;try{var i=[t];0===t.indexOf("webgl")&&i.push("experimental-"+t);for(var o=0;or)throw new Error("gl-buffer: If resizing buffer, must not specify offset");return t.bufferSubData(e,i,a),r}function i(t,e){for(var r=l.malloc(t.length,e),n=t.length,a=0;a=0;--n){if(e[n]!==r)return!1;r*=t[n]}return!0}function s(t,e,r,a){if(r=r||t.ARRAY_BUFFER,a=a||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(a!==t.DYNAMIC_DRAW&&a!==t.STATIC_DRAW&&a!==t.STREAM_DRAW)throw new Error("gl-buffer: Invalid usage for buffer, must be either gl.DYNAMIC_DRAW, gl.STATIC_DRAW or gl.STREAM_DRAW");var i=t.createBuffer(),o=new n(t,r,i,0,a);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&&void 0!==t.shape){var r=t.dtype;if(f.indexOf(r)<0&&(r="float32"),this.type===this.gl.ELEMENT_ARRAY_BUFFER){r=gl.getExtension("OES_element_index_uint")&&"uint16"!==r?"uint32":"uint16"}if(r===t.dtype&&o(t.shape,t.stride))0===t.offset&&t.data.length===t.shape[0]?this.length=a(this.gl,this.type,this.length,this.usage,t.data,e):this.length=a(this.gl,this.type,this.length,this.usage,t.data.subarray(t.offset,t.shape[0]),e);else{var n=l.malloc(t.size,r),s=c(n,t.shape);u.assign(s,t),this.length=e<0?a(this.gl,this.type,this.length,this.usage,n,e):a(this.gl,this.type,this.length,this.usage,n.subarray(0,t.size),e),l.free(n)}}else if(Array.isArray(t)){var h;h=this.type===this.gl.ELEMENT_ARRAY_BUFFER?i(t,"uint16"):i(t,"float32"),this.length=e<0?a(this.gl,this.type,this.length,this.usage,h,e):a(this.gl,this.type,this.length,this.usage,h.subarray(0,t.length),e),l.free(h)}else if("object"==typeof t&&"number"==typeof t.length)this.length=a(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=1),this.gl.bufferData(this.type,0|t,this.usage),this.length=t}},e.exports=s},{ndarray:163,"ndarray-ops":162,"typedarray-pool":205}],74:[function(t,e,r){e.exports={0:"NONE",1:"ONE",2:"LINE_LOOP",3:"LINE_STRIP",4:"TRIANGLES",5:"TRIANGLE_STRIP",6:"TRIANGLE_FAN",256:"DEPTH_BUFFER_BIT",512:"NEVER",513:"LESS",514:"EQUAL",515:"LEQUAL",516:"GREATER",517:"NOTEQUAL",518:"GEQUAL",519:"ALWAYS",768:"SRC_COLOR",769:"ONE_MINUS_SRC_COLOR",770:"SRC_ALPHA",771:"ONE_MINUS_SRC_ALPHA",772:"DST_ALPHA",773:"ONE_MINUS_DST_ALPHA",774:"DST_COLOR",775:"ONE_MINUS_DST_COLOR",776:"SRC_ALPHA_SATURATE",1024:"STENCIL_BUFFER_BIT",1028:"FRONT",1029:"BACK",1032:"FRONT_AND_BACK",1280:"INVALID_ENUM",1281:"INVALID_VALUE",1282:"INVALID_OPERATION",1285:"OUT_OF_MEMORY",1286:"INVALID_FRAMEBUFFER_OPERATION",2304:"CW",2305:"CCW",2849:"LINE_WIDTH",2884:"CULL_FACE",2885:"CULL_FACE_MODE",2886:"FRONT_FACE",2928:"DEPTH_RANGE",2929:"DEPTH_TEST",2930:"DEPTH_WRITEMASK",2931:"DEPTH_CLEAR_VALUE",2932:"DEPTH_FUNC",2960:"STENCIL_TEST",2961:"STENCIL_CLEAR_VALUE",2962:"STENCIL_FUNC",2963:"STENCIL_VALUE_MASK",2964:"STENCIL_FAIL",2965:"STENCIL_PASS_DEPTH_FAIL",2966:"STENCIL_PASS_DEPTH_PASS",2967:"STENCIL_REF",2968:"STENCIL_WRITEMASK",2978:"VIEWPORT",3024:"DITHER",3042:"BLEND",3088:"SCISSOR_BOX",3089:"SCISSOR_TEST",3106:"COLOR_CLEAR_VALUE",3107:"COLOR_WRITEMASK",3317:"UNPACK_ALIGNMENT",3333:"PACK_ALIGNMENT",3379:"MAX_TEXTURE_SIZE",3386:"MAX_VIEWPORT_DIMS",3408:"SUBPIXEL_BITS",3410:"RED_BITS",3411:"GREEN_BITS",3412:"BLUE_BITS",3413:"ALPHA_BITS",3414:"DEPTH_BITS",3415:"STENCIL_BITS",3553:"TEXTURE_2D",4352:"DONT_CARE",4353:"FASTEST",4354:"NICEST",5120:"BYTE",5121:"UNSIGNED_BYTE",5122:"SHORT",5123:"UNSIGNED_SHORT",5124:"INT",5125:"UNSIGNED_INT",5126:"FLOAT",5386:"INVERT",5890:"TEXTURE",6401:"STENCIL_INDEX",6402:"DEPTH_COMPONENT",6406:"ALPHA",6407:"RGB",6408:"RGBA",6409:"LUMINANCE",6410:"LUMINANCE_ALPHA",7680:"KEEP",7681:"REPLACE",7682:"INCR",7683:"DECR",7936:"VENDOR",7937:"RENDERER",7938:"VERSION",9728:"NEAREST",9729:"LINEAR",9984:"NEAREST_MIPMAP_NEAREST",9985:"LINEAR_MIPMAP_NEAREST",9986:"NEAREST_MIPMAP_LINEAR",9987:"LINEAR_MIPMAP_LINEAR",10240:"TEXTURE_MAG_FILTER",10241:"TEXTURE_MIN_FILTER",10242:"TEXTURE_WRAP_S",10243:"TEXTURE_WRAP_T",10497:"REPEAT",10752:"POLYGON_OFFSET_UNITS",16384:"COLOR_BUFFER_BIT",32769:"CONSTANT_COLOR",32770:"ONE_MINUS_CONSTANT_COLOR",32771:"CONSTANT_ALPHA",32772:"ONE_MINUS_CONSTANT_ALPHA",32773:"BLEND_COLOR",32774:"FUNC_ADD",32777:"BLEND_EQUATION_RGB",32778:"FUNC_SUBTRACT",32779:"FUNC_REVERSE_SUBTRACT",32819:"UNSIGNED_SHORT_4_4_4_4",32820:"UNSIGNED_SHORT_5_5_5_1",32823:"POLYGON_OFFSET_FILL",32824:"POLYGON_OFFSET_FACTOR",32854:"RGBA4",32855:"RGB5_A1",32873:"TEXTURE_BINDING_2D",32926:"SAMPLE_ALPHA_TO_COVERAGE",32928:"SAMPLE_COVERAGE",32936:"SAMPLE_BUFFERS",32937:"SAMPLES",32938:"SAMPLE_COVERAGE_VALUE",32939:"SAMPLE_COVERAGE_INVERT",32968:"BLEND_DST_RGB",32969:"BLEND_SRC_RGB",32970:"BLEND_DST_ALPHA",32971:"BLEND_SRC_ALPHA",33071:"CLAMP_TO_EDGE",33170:"GENERATE_MIPMAP_HINT",33189:"DEPTH_COMPONENT16",33306:"DEPTH_STENCIL_ATTACHMENT",33635:"UNSIGNED_SHORT_5_6_5",33648:"MIRRORED_REPEAT",33901:"ALIASED_POINT_SIZE_RANGE",33902:"ALIASED_LINE_WIDTH_RANGE",33984:"TEXTURE0",33985:"TEXTURE1",33986:"TEXTURE2",33987:"TEXTURE3",33988:"TEXTURE4",33989:"TEXTURE5",33990:"TEXTURE6",33991:"TEXTURE7",33992:"TEXTURE8",33993:"TEXTURE9",33994:"TEXTURE10",33995:"TEXTURE11",33996:"TEXTURE12",33997:"TEXTURE13",33998:"TEXTURE14",33999:"TEXTURE15",34e3:"TEXTURE16",34001:"TEXTURE17",34002:"TEXTURE18",34003:"TEXTURE19",34004:"TEXTURE20",34005:"TEXTURE21",34006:"TEXTURE22",34007:"TEXTURE23",34008:"TEXTURE24",34009:"TEXTURE25",34010:"TEXTURE26",34011:"TEXTURE27",34012:"TEXTURE28",34013:"TEXTURE29",34014:"TEXTURE30",34015:"TEXTURE31",34016:"ACTIVE_TEXTURE",34024:"MAX_RENDERBUFFER_SIZE",34041:"DEPTH_STENCIL",34055:"INCR_WRAP",34056:"DECR_WRAP",34067:"TEXTURE_CUBE_MAP",34068:"TEXTURE_BINDING_CUBE_MAP",34069:"TEXTURE_CUBE_MAP_POSITIVE_X",34070:"TEXTURE_CUBE_MAP_NEGATIVE_X",34071:"TEXTURE_CUBE_MAP_POSITIVE_Y",34072:"TEXTURE_CUBE_MAP_NEGATIVE_Y",34073:"TEXTURE_CUBE_MAP_POSITIVE_Z",34074:"TEXTURE_CUBE_MAP_NEGATIVE_Z",34076:"MAX_CUBE_MAP_TEXTURE_SIZE",34338:"VERTEX_ATTRIB_ARRAY_ENABLED",34339:"VERTEX_ATTRIB_ARRAY_SIZE",34340:"VERTEX_ATTRIB_ARRAY_STRIDE",34341:"VERTEX_ATTRIB_ARRAY_TYPE",34342:"CURRENT_VERTEX_ATTRIB",34373:"VERTEX_ATTRIB_ARRAY_POINTER",34466:"NUM_COMPRESSED_TEXTURE_FORMATS",34467:"COMPRESSED_TEXTURE_FORMATS",34660:"BUFFER_SIZE",34661:"BUFFER_USAGE",34816:"STENCIL_BACK_FUNC",34817:"STENCIL_BACK_FAIL",34818:"STENCIL_BACK_PASS_DEPTH_FAIL",34819:"STENCIL_BACK_PASS_DEPTH_PASS",34877:"BLEND_EQUATION_ALPHA",34921:"MAX_VERTEX_ATTRIBS",34922:"VERTEX_ATTRIB_ARRAY_NORMALIZED",34930:"MAX_TEXTURE_IMAGE_UNITS",34962:"ARRAY_BUFFER",34963:"ELEMENT_ARRAY_BUFFER",34964:"ARRAY_BUFFER_BINDING",34965:"ELEMENT_ARRAY_BUFFER_BINDING",34975:"VERTEX_ATTRIB_ARRAY_BUFFER_BINDING",35040:"STREAM_DRAW",35044:"STATIC_DRAW",35048:"DYNAMIC_DRAW",35632:"FRAGMENT_SHADER",35633:"VERTEX_SHADER",35660:"MAX_VERTEX_TEXTURE_IMAGE_UNITS",35661:"MAX_COMBINED_TEXTURE_IMAGE_UNITS",35663:"SHADER_TYPE",35664:"FLOAT_VEC2",35665:"FLOAT_VEC3",35666:"FLOAT_VEC4",35667:"INT_VEC2",35668:"INT_VEC3",35669:"INT_VEC4",35670:"BOOL",35671:"BOOL_VEC2",35672:"BOOL_VEC3",35673:"BOOL_VEC4",35674:"FLOAT_MAT2",35675:"FLOAT_MAT3",35676:"FLOAT_MAT4",35678:"SAMPLER_2D",35680:"SAMPLER_CUBE",35712:"DELETE_STATUS",35713:"COMPILE_STATUS",35714:"LINK_STATUS",35715:"VALIDATE_STATUS",35716:"INFO_LOG_LENGTH",35717:"ATTACHED_SHADERS",35718:"ACTIVE_UNIFORMS",35719:"ACTIVE_UNIFORM_MAX_LENGTH",35720:"SHADER_SOURCE_LENGTH",35721:"ACTIVE_ATTRIBUTES",35722:"ACTIVE_ATTRIBUTE_MAX_LENGTH",35724:"SHADING_LANGUAGE_VERSION",35725:"CURRENT_PROGRAM",36003:"STENCIL_BACK_REF",36004:"STENCIL_BACK_VALUE_MASK",36005:"STENCIL_BACK_WRITEMASK",36006:"FRAMEBUFFER_BINDING",36007:"RENDERBUFFER_BINDING",36048:"FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE",36049:"FRAMEBUFFER_ATTACHMENT_OBJECT_NAME",36050:"FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL",36051:"FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE",36053:"FRAMEBUFFER_COMPLETE",36054:"FRAMEBUFFER_INCOMPLETE_ATTACHMENT",36055:"FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT",36057:"FRAMEBUFFER_INCOMPLETE_DIMENSIONS",36061:"FRAMEBUFFER_UNSUPPORTED",36064:"COLOR_ATTACHMENT0",36096:"DEPTH_ATTACHMENT",36128:"STENCIL_ATTACHMENT",36160:"FRAMEBUFFER",36161:"RENDERBUFFER",36162:"RENDERBUFFER_WIDTH",36163:"RENDERBUFFER_HEIGHT",36164:"RENDERBUFFER_INTERNAL_FORMAT",36168:"STENCIL_INDEX8",36176:"RENDERBUFFER_RED_SIZE",36177:"RENDERBUFFER_GREEN_SIZE",36178:"RENDERBUFFER_BLUE_SIZE",36179:"RENDERBUFFER_ALPHA_SIZE",36180:"RENDERBUFFER_DEPTH_SIZE",36181:"RENDERBUFFER_STENCIL_SIZE",36194:"RGB565",36336:"LOW_FLOAT",36337:"MEDIUM_FLOAT",36338:"HIGH_FLOAT",36339:"LOW_INT",36340:"MEDIUM_INT",36341:"HIGH_INT",36346:"SHADER_COMPILER",36347:"MAX_VERTEX_UNIFORM_VECTORS",36348:"MAX_VARYING_VECTORS",36349:"MAX_FRAGMENT_UNIFORM_VECTORS",37440:"UNPACK_FLIP_Y_WEBGL",37441:"UNPACK_PREMULTIPLY_ALPHA_WEBGL",37442:"CONTEXT_LOST_WEBGL",37443:"UNPACK_COLORSPACE_CONVERSION_WEBGL",37444:"BROWSER_DEFAULT_WEBGL"}},{}],75:[function(t,e,r){var n=t("./1.0/numbers");e.exports=function(t){return n[t]}},{"./1.0/numbers":74}],76:[function(t,e,r){"use strict";function n(t,e,r,n,a,i,o,s){this.plot=t,this.shader=e,this.fillShader=r,this.positionBuffer=n,this.colorBuffer=a,this.idBuffer=i,this.fillPositionBuffer=o,this.fillColorBuffer=s,this.fillVerts=0,this.shape=[0,0],this.bounds=[1/0,1/0,-1/0,-1/0],this.numVertices=0,this.lineWidth=1}function a(t,e){var r=Math.floor(e);if(r<0)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 i(t,e){var r=t.gl,a=s(r,p.vertex,p.fragment),i=s(r,p.fillVertex,p.fragment),o=l(r),u=l(r),c=l(r),f=l(r),h=l(r),d=new n(t,a,i,o,u,c,f,h);return d.update(e),t.addObject(d),d}e.exports=i;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,m=[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,a=this.plot,i=this.shader,o=this.fillShader,s=this.bounds,l=this.numVertices,u=this.fillVerts,c=a.gl,f=a.viewBox,h=a.dataBox,d=s[2]-s[0],p=s[3]-s[1],g=h[2]-h[0],m=h[3]-h[1];if(t[0]=2*d/g,t[4]=2*p/m,t[6]=2*(s[0]-h[0])/g-1,t[7]=2*(s[1]-h[1])/m-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=i.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){i.bind();var v=this.lineWidth*a.pixelRatio;r=i.uniforms,r.viewTransform=t,r.screenShape=e,r.lineWidth=v,r.pointSize=1e3,n=i.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=v,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 a=n-r;return Math.abs(a)<1e-6?e:Math.floor(e)+Math.max(.001,Math.min(.999,(t-r)/a))}t=t||{};var r=t.shape||[0,0],n=t.x||o(r[0]),i=t.y||o(r[1]),s=t.z||new Float32Array(r[0]*r[1]),l=t.levels||[],p=t.levelColors||[],g=this.bounds,v=g[0]=n[0],y=g[1]=i[0],b=g[2]=n[n.length-1],x=g[3]=i[i.length-1];v===b&&(g[2]+=1,b+=1),y===x&&(g[3]+=1,x+=1);var _=1/(b-v),w=1/(x-y);this.lineWidth=t.lineWidth||1;for(var A=u(s,r),k=[],M=[],T=[],E=[],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 O=c(A,C),I=255*p[4*S]|0,R=255*p[4*S+1]|0,D=255*p[4*S+2]|0,P=255*p[4*S+3]|0,z=O.cells,N=O.positions,F=Array(N.length),B=0;B1)){var V,G=U[0],q=U[1],X=A.get(Math.floor(G),Math.floor(q)),Y=A.get(Math.floor(G),Math.ceil(q)),W=A.get(Math.ceil(G),Math.floor(q)),Z=A.get(Math.ceil(G),Math.ceil(q));0===Math.floor(U[0])&&X<=C!=Y>1;for(e=0;e0&&(T*=_),E<0?E*=w:E>0&&(E*=A),m[b++]=h*(r-p+T),m[b++]=d*(n-g+E),m[b++]=o*M[2]+(l+o)*M[4],m[b++]=o*M[3]+(l+o)*M[5]}}for(e=0;e1&&h.drawBuffersWEBGL(y[f]);var v=r.getExtension("WEBGL_depth_texture");v?d?t.depth=s(r,u,c,v.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;ms||r<0||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(i),u=0;uo||r<0||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)throw new Error("gl-fbo: Must specify a nonnegative number of colors");if(s>1){if(!a)throw new Error("gl-fbo: Multiple draw buffer extension not supported");if(s>t.getParameter(a.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,a)}var d=t("gl-texture2d");e.exports=h;var p,g,m,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 f(this,e,r),[e,r]},enumerable:!1},width:{get:function(){return this._destroyed?0:this._shape[0]},set:function(t){return t|=0,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,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;e>8*d&255;this.pickOffset=r,a.bind();var p=a.uniforms;p.viewTransform=t,p.pickOffset=e,p.shape=this.shape;var g=a.attributes;return this.positionBuffer.bind(),g.position.pointer(),this.weightBuffer.bind(),g.weight.pointer(s.UNSIGNED_BYTE,!1),this.idBuffer.bind(),g.pickId.pointer(s.UNSIGNED_BYTE,!1),s.drawArrays(s.TRIANGLES,0,o),r+this.shape[0]*this.shape[1]}}}(),f.pick=function(t,e,r){var n=this.pickOffset,a=this.shape[0]*this.shape[1];if(r=n+a)return null;var i=r-n,o=this.xData,s=this.yData;return{object:this,pointId:i,dataCoord:[o[i%this.shape[0]],s[i/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]),a=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],m=f[3]=n[n.length-1],v=1/(g-d),y=1/(m-p),b=e[0],x=e[1];this.shape=[b,x];var _=(b-1)*(x-1)*(h.length>>>1);this.numVertices=_;for(var w=s.mallocUint8(4*_),A=s.mallocFloat32(2*_),k=s.mallocUint8(2*_),M=s.mallocUint32(_),T=0,E=0;E2&&!this.usingDashes){var b=this.mitreShader;this.lineBufferLo.bind(),b.attributes.aLo.pointer(l.FLOAT,!1,48,0),this.lineBufferHi.bind(),b.bind();var x=b.uniforms;this.setProjectionUniforms(x,i),x.color=c,x.radius=s*u,b.attributes.aHi.pointer(l.FLOAT,!1,48,0),l.drawArrays(l.POINTS,0,a/3|0)}}}}(),h.drawPick=function(){var t=[0,0,0,0];return function(e){var r=this.vertCount,n=this.numPoints;if(this.pickOffset=e,!r)return e+n;var a=this.setProjectionModel(),i=this.plot,o=this.width,s=i.gl,l=i.pickPixelRatio,u=this.pickShader,c=this.pickBuffer;t[0]=255&e,t[1]=e>>>8&255,t[2]=e>>>16&255,t[3]=e>>>24,u.bind();var f=u.uniforms;this.setProjectionUniforms(f,a),f.width=o*l,f.pickOffset=t;var h=u.attributes;return this.lineBufferHi.bind(),h.aHi.pointer(s.FLOAT,!1,16,0),h.dHi.pointer(s.FLOAT,!1,16,8),this.lineBufferLo.bind(),h.aLo.pointer(s.FLOAT,!1,16,0),c.bind(),h.pick0.pointer(s.UNSIGNED_BYTE,!1,8,0),h.pick1.pointer(s.UNSIGNED_BYTE,!1,8,4),s.drawArrays(s.TRIANGLES,0,r),e+n}}(),h.pick=function(t,e,r){var n=this.pickOffset,a=this.numPoints;if(r=n+a)return null;var i=r-n,o=this.data;return{object:this,pointId:i,dataCoord:[o[2*i],o[2*i+1]]}},h.update=function(t){t=t||{};var e,r,n,i,o,s=this.plot.gl;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=a(t.fillColor||[[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]]);var f=t.dashes||[1],h=0;for(e=0;e1,this.dashPattern=l(s,u(d,[h,1,4],[1,0,0])),this.dashPattern.minFilter=s.NEAREST,this.dashPattern.magFilter=s.NEAREST,this.dashLength=h,c.free(d);var g=t.positions;this.data=g;var m=this.bounds;m[0]=m[1]=1/0,m[2]=m[3]=-1/0;var v=this.numPoints=g.length>>>1;if(0!==v){for(e=0;e1;){var M=--n;i=g[2*n],o=g[2*n+1];var T=M-1,E=g[2*T],L=g[2*T+1];if(!(isNaN(i)||isNaN(o)||isNaN(E)||isNaN(L))){k+=1,i=(i-m[0])/(m[2]-m[0]),o=(o-m[1])/(m[3]-m[1]),E=(E-m[0])/(m[2]-m[0]),L=(L-m[1])/(m[3]-m[1]);var S=E-i,C=L-o,O=M|1<<24,I=M-1,R=M,D=M-1|1<<24;y[--w]=-C,y[--w]=-S,y[--w]=o,y[--w]=i,_[--A]=O,_[--A]=I,y[--w]=C,y[--w]=S,y[--w]=L,y[--w]=E,_[--A]=R,_[--A]=D,y[--w]=-C,y[--w]=-S,y[--w]=L,y[--w]=E,_[--A]=R,_[--A]=D,y[--w]=C,y[--w]=S,y[--w]=L,y[--w]=E,_[--A]=R,_[--A]=D,y[--w]=-C,y[--w]=-S,y[--w]=o,y[--w]=i,_[--A]=O,_[--A]=I,y[--w]=C,y[--w]=S,y[--w]=o,y[--w]=i,_[--A]=O,_[--A]=I}}for(e=0;es[k]&&(i.uniforms.dataAxis=t,i.uniforms.screenOffset=e,i.uniforms.color=m[n],i.uniforms.angle=v[n],u.drawArrays(u.TRIANGLES,s[k],s[M]-s[k]))),y[n]&&A&&(e[1^n]-=T*d*b[n],i.uniforms.dataAxis=r,i.uniforms.screenOffset=e,i.uniforms.color=x[n],i.uniforms.angle=_[n],u.drawArrays(u.TRIANGLES,w,A)),e[1^n]=T*c[2+(1^n)]-1,p[n+2]&&(e[1^n]+=T*d*g[n+2],ks[k]&&(i.uniforms.dataAxis=t,i.uniforms.screenOffset=e,i.uniforms.color=m[n+2],i.uniforms.angle=v[n+2],u.drawArrays(u.TRIANGLES,s[k],s[M]-s[k]))),y[n+2]&&A&&(e[1^n]+=T*d*b[n+2],i.uniforms.dataAxis=r,i.uniforms.screenOffset=e,i.uniforms.color=x[n+2],i.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,a=r.gl,i=r.screenBox,o=r.titleCenter,s=r.titleAngle,l=r.titleColor,u=r.pixelRatio;if(this.titleCount){for(var c=0;c<2;++c)e[c]=2*(o[c]*u-i[c])/(i[2+c]-i[c])-1;n.bind(),n.uniforms.dataAxis=t,n.uniforms.screenOffset=e,n.uniforms.angle=s,n.uniforms.color=l,a.drawArrays(a.TRIANGLES,this.titleOffset,this.titleCount)}}}(),c.bind=function(){var t=[0,0],e=[0,0],r=[0,0];return function(){var n=this.plot,a=this.shader,i=n._tickBounds,o=n.dataBox,s=n.screenBox,l=n.viewBox;a.bind();for(var u=0;u<2;++u){var c=i[u],f=i[u+2],h=f-c,d=.5*(o[u+2]+o[u]),p=o[u+2]-o[u],g=l[u],m=l[u+2],v=m-g,y=s[u],b=s[u+2],x=b-y;e[u]=2*h/p*v/x,t[u]=2*(c-d)/p*v/x}r[1]=2*n.pixelRatio/(s[3]-s[1]),r[0]=r[1]*(s[3]-s[1])/(s[2]-s[0]),a.uniforms.dataScale=e,a.uniforms.dataShift=t,a.uniforms.textScale=r,this.vbo.bind(),a.attributes.textCoordinate.pointer()}}(),c.update=function(t){var e,r,n,a,i,o=[],l=t.ticks,u=t.bounds;for(i=0;i<2;++i){var c=[Math.floor(o.length/3)],f=[-1/0],h=l[i];for(e=0;er)for(t=r;te)for(t=e;t=0){for(var k=0|A.type.charAt(A.type.length-1),M=new Array(k),T=0;T=0;)E+=1;w[b]=E}var L=new Array(r.length);i(),d._relink=i,d.types={uniforms:l(r),attributes:l(n)},d.attributes=s(p,d,x,w),Object.defineProperty(d,"uniforms",o(p,d,r,L))},e.exports=i},{"./lib/GLError":96,"./lib/create-attributes":97,"./lib/create-uniforms":98,"./lib/reflect":99,"./lib/runtime-reflect":100,"./lib/shader-cache":101}],96:[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},{}],97:[function(t,e,r){"use strict";function n(t,e,r,n,a,i){this._gl=t,this._wrapper=e,this._index=r,this._locations=n,this._dimension=a,this._constFunc=i}function a(t,e,r,a,i,o,s){for(var l=["gl","v"],u=[],c=0;c=0){var p=h.charCodeAt(h.length-1)-48;if(p<2||p>4)throw new s("","Invalid data type for attribute "+f+": "+h);a(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(p<2||p>4)throw new s("","Invalid data type for attribute "+f+": "+h);i(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 a=this,i=a._gl,o=a._locations[a._index];i.vertexAttribPointer(o,a._dimension,t||i.FLOAT,!!e,r||0,n||0),i.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":96}],98:[function(t,e,r){"use strict";function n(t){return new Function("y","return function(){return y}")(t)}function a(t,e){for(var r=new Array(t),n=0;n4)throw new s("","Invalid uniform dimension type for matrix "+name+": "+r);return"gl.uniformMatrix"+a+"fv(locations["+e+"],false,obj"+t+")"}throw new s("","Unknown uniform data type for "+name+": "+r)}var a=r.charCodeAt(r.length-1)-48;if(a<2||a>4)throw new s("","Invalid data type");switch(r.charAt(0)){case"b":case"i":return"gl.uniform"+a+"iv(locations["+e+"],obj"+t+")";case"v":return"gl.uniform"+a+"fv(locations["+e+"],obj"+t+")";default:throw new 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 a=e[n],i=t;parseInt(n)+""===n?i+="["+n+"]":i+="."+n,"object"==typeof a?r.push.apply(r,c(i,a)):r.push([i,a])}return r}function f(e){for(var n=["return function updateProperty(obj){"],a=c("",e),o=0;o4)throw new s("","Invalid data type");return"b"===t.charAt(0)?a(r,!1):a(r,0)}if(0===t.indexOf("mat")&&4===t.length){var r=t.charCodeAt(t.length-1)-48;if(r<2||r>4)throw new s("","Invalid uniform dimension type for matrix "+name+": "+t);return a(r*r,0)}throw new s("","Unknown uniform data type for "+name+": "+t)}}function d(t,e,a){if("object"==typeof a){var o=p(a);Object.defineProperty(t,e,{get:n(o),set:f(a),enumerable:!0,configurable:!1})}else i[a]?Object.defineProperty(t,e,{get:l(a),set:f(a),enumerable:!0,configurable:!1}):t[e]=h(r[a].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;u1)for(var l=0;l=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;p=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;r>>1;for(r=0;r=e[0]&&i<=e[2]&&o>=e[1]&&o<=e[3]&&n++}return n}function i(t,e){var r=t.gl,a=s(r),i=s(r),l=o(r,u.pointVertex,u.pointFragment),c=o(r,u.pickVertex,u.pickFragment),f=new n(t,a,i,l,c);return f.update(e),t.addObject(f),f}var o=t("gl-shader"),s=t("gl-buffer"),l=t("typedarray-pool"),u=t("./lib/shader");e.exports=i;var c=n.prototype;c.dispose=function(){this.shader.dispose(),this.pickShader.dispose(),this.offsetBuffer.dispose(),this.pickBuffer.dispose(),this.plot.removeObject(this)},c.update=function(t){function e(e,r){return e in t?t[e]:r}var r;t=t||{},this.sizeMin=e("sizeMin",.5),this.sizeMax=e("sizeMax",20),this.color=e("color",[1,0,0,1]).slice(),this.areaRatio=e("areaRatio",1),this.borderColor=e("borderColor",[0,0,0,1]).slice(),this.blend=e("blend",!1);var n=t.positions.length>>>1,a=t.positions instanceof Float32Array,i=t.idToIndex instanceof Int32Array&&t.idToIndex.length>=n,o=t.positions,s=a?o:l.mallocFloat32(o.length),u=i?t.idToIndex:l.mallocInt32(n);if(a||s.set(o),!i)for(s.set(o),r=0;r>8&255,e[2]=r>>16&255,e[3]=r>>24&255,this.pickBuffer.bind(),i.attributes.pickId.pointer(o.UNSIGNED_BYTE),i.uniforms.pickOffset=e,this.pickOffset=r);var h=o.getParameter(o.BLEND),d=o.getParameter(o.DITHER);return h&&!this.blend&&o.disable(o.BLEND),d&&o.disable(o.DITHER),o.drawArrays(o.POINTS,0,this.pointCount),h&&!this.blend&&o.enable(o.BLEND),d&&o.enable(o.DITHER),r+this.pointCount}}(),c.draw=c.unifiedDraw,c.drawPick=c.unifiedDraw,c.pick=function(t,e,r){var n=this.pickOffset,a=this.pointCount;if(r=n+a)return null;var i=r-n,o=this.points;return{object:this,pointId:i,dataCoord:[o[2*i],o[2*i+1]]}}},{"./lib/shader":103,"gl-buffer":73,"gl-shader":104,"typedarray-pool":205}],112:[function(t,e,r){"use strict";e.exports={vertex:"precision highp float;\n#define GLSLIFY 1\n\n\nvec4 computePosition_1_0(vec2 posHi, vec2 posLo, vec2 scHi, vec2 scLo, vec2 trHi, vec2 trLo) {\n return vec4((posHi + trHi) * scHi\n \t\t\t//FIXME: this thingy does not give noticeable precision gain, need test\n + (posLo + trLo) * scHi\n + (posHi + trHi) * scLo\n + (posLo + trLo) * scLo\n , 0, 1);\n}\n\n\nattribute vec2 positionHi, positionLo;\nattribute float size, border;\nattribute vec2 char, color;\n\n//this is 64-bit form of scale and translate\nuniform vec2 scaleHi, scaleLo, translateHi, translateLo;\nuniform float pixelRatio;\nuniform vec4 viewBox;\nuniform sampler2D palette;\n\nvarying vec4 charColor, borderColor;\nvarying vec2 charId;\nvarying vec2 pointCoord;\nvarying float pointSize;\nvarying float borderWidth;\n\n\nvoid main() {\n charColor = texture2D(palette, vec2(color.x / 255., 0));\n borderColor = texture2D(palette, vec2(color.y / 255., 0));\n\n gl_PointSize = size * pixelRatio;\n pointSize = size * pixelRatio;\n\n charId = char;\n borderWidth = border;\n\n gl_Position = computePosition_1_0(\n positionHi, positionLo,\n scaleHi, scaleLo,\n translateHi, translateLo);\n\n pointCoord = viewBox.xy + (viewBox.zw - viewBox.xy) * (gl_Position.xy * .5 + .5);\n}\n", -fragment:"precision highp float;\n#define GLSLIFY 1\n\nuniform sampler2D chars;\nuniform vec2 charsShape;\nuniform float charsStep, pixelRatio, charOffset;\n\nvarying vec4 borderColor;\nvarying vec4 charColor;\nvarying vec2 charId;\nvarying vec2 pointCoord;\nvarying float pointSize;\nvarying float borderWidth;\n\nvoid main() {\n\tvec2 pointUV = (pointCoord - gl_FragCoord.xy + pointSize * .5) / pointSize;\n\tpointUV.x = 1. - pointUV.x;\n\tvec2 texCoord = ((charId + pointUV) * charsStep) / charsShape;\n\tfloat dist = texture2D(chars, texCoord).r;\n\n\t//max-distance alpha\n\tif (dist < 1e-2)\n\t\tdiscard;\n\n\tfloat gamma = .0045 * charsStep / pointSize;\n\n //null-border case\n \tif (borderWidth * borderColor.a == 0.) {\n\t\tfloat charAmt = smoothstep(.748 - gamma, .748 + gamma, dist);\n\t\tgl_FragColor = vec4(charColor.rgb, charAmt*charColor.a);\n\t\treturn;\n\t}\n\n\tfloat dif = 5. * pixelRatio * borderWidth / pointSize;\n\tfloat borderLevel = .748 - dif * .5;\n\tfloat charLevel = .748 + dif * .5;\n\n\tfloat borderAmt = smoothstep(borderLevel - gamma, borderLevel + gamma, dist);\n\tfloat charAmt = smoothstep(charLevel - gamma, charLevel + gamma, dist);\n\n\tvec4 color = borderColor;\n\tcolor.a *= borderAmt;\n\n\tgl_FragColor = mix(color, charColor, charAmt);\n}\n",pickVertex:"precision highp float;\n#define GLSLIFY 1\n\nattribute vec2 positionHi, positionLo;\nattribute vec4 id;\nattribute float size;\n\nuniform vec2 scaleHi, scaleLo, translateHi, translateLo;\nuniform vec4 pickOffset;\nuniform float pixelRatio;\n\nvarying vec4 fragColor;\n\n\nvec4 computePosition_1_0(vec2 posHi, vec2 posLo, vec2 scHi, vec2 scLo, vec2 trHi, vec2 trLo) {\n return vec4((posHi + trHi) * scHi\n \t\t\t//FIXME: this thingy does not give noticeable precision gain, need test\n + (posLo + trLo) * scHi\n + (posHi + trHi) * scLo\n + (posLo + trLo) * scLo\n , 0, 1);\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_PointSize = size * .25 * pixelRatio;\n\n gl_Position = computePosition_1_0(\n positionHi, positionLo,\n scaleHi, scaleLo,\n translateHi, translateLo);\n}\n",pickFragment:"precision lowp float;\n#define GLSLIFY 1\nvarying vec4 fragColor;\nvoid main() {\n gl_FragColor = fragColor;\n}\n"}},{}],113:[function(t,e,r){arguments[4][47][0].apply(r,arguments)},{dup:47}],114:[function(t,e,r){arguments[4][95][0].apply(r,arguments)},{"./lib/GLError":115,"./lib/create-attributes":116,"./lib/create-uniforms":117,"./lib/reflect":118,"./lib/runtime-reflect":119,"./lib/shader-cache":120,dup:95}],115:[function(t,e,r){arguments[4][96][0].apply(r,arguments)},{dup:96}],116:[function(t,e,r){arguments[4][97][0].apply(r,arguments)},{"./GLError":115,dup:97}],117:[function(t,e,r){arguments[4][98][0].apply(r,arguments)},{"./GLError":115,"./reflect":118,dup:98}],118:[function(t,e,r){arguments[4][99][0].apply(r,arguments)},{dup:99}],119:[function(t,e,r){arguments[4][100][0].apply(r,arguments)},{dup:100}],120:[function(t,e,r){arguments[4][101][0].apply(r,arguments)},{"./GLError":115,dup:101,"gl-format-compiler-error":82,"weakmap-shim":212}],121:[function(t,e,r){"use strict";function n(t,e,r,n,i){i<=4*h?a(0,i-1,t,e,r,n):f(0,i-1,t,e,r,n)}function a(t,e,r,n,a,i){for(var o=t+1;o<=e;++o){for(var s=r[o],l=n[2*o],u=n[2*o+1],c=a[o],f=i[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],a[h]=a[h-1],i[h]=i[h-1],h-=1}r[h]=s,n[2*h]=l,n[2*h+1]=u,a[h]=c,i[h]=f}}function i(t,e,r,n,a,i){var o=r[t],s=n[2*t],l=n[2*t+1],u=a[t],c=i[t];r[t]=r[e],n[2*t]=n[2*e],n[2*t+1]=n[2*e+1],a[t]=a[e],i[t]=i[e],r[e]=o,n[2*e]=s,n[2*e+1]=l,a[e]=u,i[e]=c}function o(t,e,r,n,a,i){r[t]=r[e],n[2*t]=n[2*e],n[2*t+1]=n[2*e+1],a[t]=a[e],i[t]=i[e]}function s(t,e,r,n,a,i,o){var s=n[t],l=a[2*t],u=a[2*t+1],c=i[t],f=o[t];n[t]=n[e],a[2*t]=a[2*e],a[2*t+1]=a[2*e+1],i[t]=i[e],o[t]=o[e],n[e]=n[r],a[2*e]=a[2*r],a[2*e+1]=a[2*r+1],i[e]=i[r],o[e]=o[r],n[r]=s,a[2*r]=l,a[2*r+1]=u,i[r]=c,o[r]=f}function l(t,e,r,n,a,i,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]=a,u[e]=i,c[e]=o}function u(t,e,r,n,a){return(r[t]-r[e]||n[2*e]-n[2*t]||a[t]-a[e])<0}function c(t,e,r,n,a,i,o,s){return(e-i[t]||o[2*t]-r||a-s[t])<0}function f(t,e,r,n,d,p){var g=(e-t+1)/6|0,m=t+g,v=e-g,y=t+e>>1,b=y-g,x=y+g,_=m,w=b,A=y,k=x,M=v,T=t+1,E=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],O=n[2*w+1],I=d[w],R=p[w],D=r[k],P=n[2*k],z=n[2*k+1],N=d[k],F=p[k],B=_,j=A,H=M,U=m,V=y,G=v,q=r[B],X=r[j],Y=r[H];r[U]=q,r[V]=X,r[G]=Y;for(var W=0;W<2;++W){var Z=n[2*B+W],Q=n[2*j+W],$=n[2*H+W];n[2*U+W]=Z,n[2*V+W]=Q,n[2*G+W]=$}var K=d[B],J=d[j],tt=d[H];d[U]=K,d[V]=J,d[G]=tt;var et=p[B],rt=p[j],nt=p[H];p[U]=et,p[V]=rt,p[G]=nt,o(b,t,r,n,d,p),o(x,e,r,n,d,p);for(var at=T;at<=E;++at)if(c(at,S,C,O,I,r,n,d))at!==T&&i(at,T,r,n,d,p),++T;else if(!c(at,D,P,z,N,r,n,d))for(;;){if(c(E,D,P,z,N,r,n,d)){c(E,S,C,O,I,r,n,d)?(s(at,T,E,r,n,d,p),++T,--E):(i(at,E,r,n,d,p),--E);break}if(--E=Math.max(.9*d,32)){var b=u+s>>>1;l(m,v,f,h,b,c+1),h=b}l(m,v,f,h,y,c+1),h=y}}}var u=t.length>>>1;if(u<1)return[];for(var c=1/0,f=1/0,h=-1/0,d=-1/0,p=0;p=0;--_){t[2*_]=(t[2*_]-c)*v,t[2*_+1]=(t[2*_+1]-f)*y;var M=x[_];M!==A&&(w.push(new a(b*Math.pow(.5,M),_+1,k-(_+1))),k=_+1,A=M)}return w.push(new a(b*Math.pow(.5,M+1),0,k)),o.free(x),w}var o=t("typedarray-pool"),s=t("./lib/sort");e.exports=i},{"./lib/sort":121,"typedarray-pool":205}],123:[function(t,e,r){"use strict";function n(t,e,r,n,a,i,o,s){this.plot=t,this.shader=e,this.pickShader=r,this.positionBuffer=n,this.sizeBuffer=a,this.colorBuffer=i,this.idBuffer=o,this.charBuffer=s,this.pointCount=0,this.pickOffset=0,this.points=null,this.scales=[],this.xCoords=[],this.charCanvas=document.createElement("canvas"),this.charTexture=g(this.plot.gl,this.charCanvas),this.charStep=400,this.charFit=.255,this.snapThreshold=1e4,this.paletteTexture=g(this.plot.gl,[256,1])}function a(){var t=this.plot,e=t.viewBox,r=t.dataBox,n=t.pixelRatio,a=r[2]-r[0],i=r[3]-r[1],u=2/a,c=2/i,f=-r[0]-.5*a,h=-r[1]-.5*i;_[0]=u,w[0]=u-_[0],_[1]=c,w[1]=c-_[1],A[0]=f,k[0]=f-A[0],A[1]=h,k[1]=h-A[1];var d=e[2]-e[0],p=e[3]-e[1];o=Math.min(a/d,i/p),M[0]=2*n/d,M[1]=2*n/p,s=r[0],l=r[2]}function i(t,e){var r=t.gl,a=u(r,h.vertex,h.fragment),i=u(r,h.pickVertex,h.pickFragment),o=c(r),s=c(r),l=c(r),f=c(r),d=c(r),p=new n(t,a,i,o,s,l,f,d);return p.update(e),t.addObject(p),p}e.exports=i;var o,s,l,u=t("gl-shader"),c=t("gl-buffer"),f=t("typedarray-pool"),h=t("./lib/shaders"),d=t("snap-points-2d"),p=t("font-atlas-sdf"),g=t("gl-texture2d"),m=t("color-id"),v=t("ndarray"),y=t("clamp"),b=t("binary-search-bounds"),x=n.prototype,_=new Float32Array([0,0]),w=new Float32Array([0,0]),A=new Float32Array([0,0]),k=new Float32Array([0,0]),M=[0,0],T=[0,0,0,0];x.drawPick=function(t){var e=void 0!==t,r=this.plot,n=this.pointCount,i=n>this.snapThreshold;if(!n)return t;a.call(this);var u=r.gl,c=e?this.pickShader:this.shader,f=u.isEnabled(u.BLEND);if(c.bind(),e){this.pickOffset=t;for(var h=0;h<4;++h)T[h]=t>>8*h&255;c.uniforms.pickOffset=T,this.idBuffer.bind(),c.attributes.id.pointer(u.UNSIGNED_BYTE,!1)}else u.blendFuncSeparate(u.SRC_ALPHA,u.ONE_MINUS_SRC_ALPHA,u.ONE,u.ONE_MINUS_SRC_ALPHA),u.blendColor(0,0,0,1),f||u.enable(u.BLEND),this.colorBuffer.bind(),c.attributes.color.pointer(u.UNSIGNED_BYTE,!1),this.charBuffer.bind(),c.attributes.char.pointer(u.UNSIGNED_BYTE,!1),c.uniforms.chars=this.charTexture.bind(0),c.uniforms.charsShape=[this.charCanvas.width,this.charCanvas.height],c.uniforms.charsStep=this.charStep,c.uniforms.palette=this.paletteTexture.bind(1);this.sizeBuffer.bind(),c.attributes.size.pointer(u.FLOAT,!1,8,0),e||c.attributes.border.pointer(u.FLOAT,!1,8,4),this.positionBuffer.bind(),c.attributes.positionHi.pointer(u.FLOAT,!1,16,0),c.attributes.positionLo.pointer(u.FLOAT,!1,16,8),c.uniforms.pixelRatio=r.pixelRatio,c.uniforms.scaleHi=_,c.uniforms.scaleLo=w,c.uniforms.translateHi=A,c.uniforms.translateLo=k,c.uniforms.viewBox=r.viewBox;var d=this.scales;if(i)for(var p=d.length-1;p>=0;p--){var g=d[p];if(!(g.pixelSize&&g.pixelSize<1.25*o&&p>1)){var m=g.offset,v=g.count+m,y=b.ge(this.xCoords,s,m,v-1),x=b.lt(this.xCoords,l,y,v-1)+1;x>y&&u.drawArrays(u.POINTS,y,x-y)}}else u.drawArrays(u.POINTS,0,n);if(e)return t+n;f?u.blendFunc(u.ONE,u.ONE_MINUS_SRC_ALPHA):u.disable(u.BLEND)},x.draw=x.drawPick,x.pick=function(t,e,r){var n=this.pickOffset,a=this.pointCount;if(r=n+a)return null;var i=r-n,o=this.points;return{object:this,pointId:i,dataCoord:[o[2*i],o[2*i+1]]}},x.update=function(t){t=t||{};var e=t.positions||[],r=t.colors||[],n=t.glyphs||[],a=t.sizes||[],i=t.borderWidths||[],o=t.borderColors||[],s=this.plot.gl,l=this.pointCount,u=l>this.snapThreshold;if(null!=t.positions){this.points=e,l=this.points.length/2,u=l>this.snapThreshold;var c=f.mallocFloat32(2*l),h=f.mallocFloat64(2*l),g=f.mallocUint32(l),b=f.mallocFloat32(4*l);h.set(this.points),u&&(this.i2idx&&f.free(this.i2idx),this.i2idx=f.mallocInt32(l),this.scales=d(h,this.i2idx,c)),this.pointCount=l;for(var x=0;xN&&(N=a[x]);var F=this.charStep;this.charStep=y(Math.ceil(4*N),128,768);var B=Object.keys(P),j=this.charStep,H=Math.floor(j/2),U=s.getParameter(s.MAX_TEXTURE_SIZE),V=U/j*(U/j),G=Math.min(U,j*B.length),q=Math.min(U,j*Math.ceil(j*B.length/U)),X=Math.floor(G/j);B.length>V&&console.warn("gl-scatter2d-fancy: number of characters is more than maximum texture size. Try reducing it."),this.chars&&this.chars+""==B+""&&this.charStep==F||(this.charCanvas=p({canvas:this.charCanvas,family:"sans-serif",size:H,shape:[G,q],step:[j,j],chars:B,align:!0,fit:this.charFit}),this.chars=B);for(var x=0;x>>1,n=u.mallocInt32(r),a=u.mallocFloat32(r),i=u.mallocFloat64(2*r);if(i.set(this.points),this.snapPoints)this.scales=l(i,n,a,this.bounds);else{this.bounds=h(i,2),f(i,2,this.bounds);for(var o=0;o>8&255,y[2]=t>>16&255,y[3]=t>>24&255,n.uniforms.pickOffset=y,s.bind(),n.attributes.pickId.pointer(f.UNSIGNED_BYTE)):(n.uniforms.useWeight=1,this.weightBuffer.bind(),n.attributes.weight.pointer());var O=!0;if(this.snapPoints)for(var I=a.length-1;I>=0;I--){var R=a[I];if(!(R.pixelSize1)){var D=this.getVisibleRange(R),P=D[0],z=D[1];z>P&&f.drawArrays(f.POINTS,P,z-P),!e&&O&&(O=!1,n.uniforms.useWeight=0)}}else f.drawArrays(f.POINTS,0,this.pointCount);return t+this.pointCount},d.getVisibleRange=function(t){var e=this.plot.dataBox,r=this.bounds,n=this.pixelSize,a=this.size,i=this.plot.pixelRatio,o=r[2]-r[0];r[3],r[1];if(!t)for(var t,l=this.scales.length-1;l>=0&&(t=this.scales[l],t.pixelSize1);l--);var u=this.xCoords,c=(e[0]-r[0]-n*a*i)/o,f=(e[2]-r[0]+n*a*i)/o,h=t.offset,d=t.count+h,p=s.ge(u,c,h,d-1);return[p,s.lt(u,f,p,d-1)+1]},d.drawPick=d.draw,d.pick=function(t,e,r){var n=r-this.pickOffset;return n<0||n>=this.pointCount?null:{object:this,pointId:n,dataCoord:[this.points[2*n],this.points[2*n+1]]}}},{"./lib/shader":124,"array-bounds":11,"array-normalize":12,"binary-search-bounds":125,"gl-buffer":73,"gl-shader":132,"snap-points-2d":127,"typedarray-pool":205}],129:[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"},{}],130:[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 a(t,e){var r=t.gl,a=o(r,[0,0,0,1,1,0,1,1]),l=i(r,s.boxVertex,s.boxFragment),u=new n(t,a,l);return u.update(e),t.addOverlay(u),u}var i=t("gl-shader"),o=t("gl-buffer"),s=t("./lib/shaders");e.exports=a;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),a=(this.outerFill,this.outerColor),i=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]),!(d0){var v=r*c;o.drawBox(f-v,h-v,d+v,h+v,i),o.drawBox(f-v,p-v,d+v,p+v,i),o.drawBox(f-v,h-v,f+v,p+v,i),o.drawBox(d-v,h-v,d+v,p+v,i)}}}},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":129,"gl-buffer":73,"gl-shader":132}],131:[function(t,e,r){"use strict";function n(t,e,r,n,a){this.coord=[t,e],this.id=r,this.value=n,this.distance=a}function a(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 i(t,e){return new a(t,o(t,e),s.mallocUint8(e[0]*e[1]*4))}e.exports=i;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(_inline_55_arg0_<255||_inline_55_arg1_<255||_inline_55_arg2_<255||_inline_55_arg3_<255){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)),a=0;a=0){for(var k=0|A.type.charAt(A.type.length-1),M=new Array(k),T=0;T=0;)E+=1;_[w]=E}var L=new Array(r.length);i(),d._relink=i,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=i},{"./lib/GLError":133,"./lib/create-attributes":134,"./lib/create-uniforms":135,"./lib/reflect":136,"./lib/runtime-reflect":137,"./lib/shader-cache":138}],133:[function(t,e,r){arguments[4][96][0].apply(r,arguments)},{dup:96}],134:[function(t,e,r){arguments[4][97][0].apply(r,arguments)},{"./GLError":133,dup:97}],135:[function(t,e,r){arguments[4][98][0].apply(r,arguments)},{"./GLError":133,"./reflect":136,dup:98}],136:[function(t,e,r){arguments[4][99][0].apply(r,arguments)},{dup:99}],137:[function(t,e,r){arguments[4][100][0].apply(r,arguments)},{dup:100}],138:[function(t,e,r){arguments[4][101][0].apply(r,arguments)},{"./GLError":133,dup:101,"gl-format-compiler-error":82,"weakmap-shim":212}],139:[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 a(t,e){var r=new n(t);return r.update(e),t.addOverlay(r),r}e.exports=a;var i=n.prototype;i.update=function(t){t=t||{},this.enable=(t.enable||[!0,!0,!1,!1]).slice(),this.width=(t.width||[1,1,1,1]).slice(),this.color=(t.color||[[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]]).map(function(t){return t.slice()}),this.center=(t.center||[1/0,1/0]).slice(),this.plot.setOverlayDirty()},i.draw=function(){var t=this.enable,e=this.width,r=this.color,n=this.center,a=this.plot,i=a.line,o=a.dataBox,s=a.viewBox;if(i.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]&&i.drawLine(l,u,s[0],u,e[0],r[0]),t[1]&&i.drawLine(l,u,l,s[1],e[1],r[1]),t[2]&&i.drawLine(l,u,s[2],u,e[2],r[2]),t[3]&&i.drawLine(l,u,l,s[3],e[3],r[3])}},i.dispose=function(){this.plot.removeOverlay(this)}},{}],140:[function(t,e,r){"use strict";function n(t){v=[t.LINEAR,t.NEAREST_MIPMAP_LINEAR,t.LINEAR_MIPMAP_NEAREST,t.LINEAR_MIPMAP_NEAREST],y=[t.NEAREST,t.LINEAR,t.NEAREST_MIPMAP_NEAREST,t.NEAREST_MIPMAP_LINEAR,t.LINEAR_MIPMAP_NEAREST,t.LINEAR_MIPMAP_LINEAR],b=[t.REPEAT,t.CLAMP_TO_EDGE,t.MIRRORED_REPEAT]}function a(t){return"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLVideoElement&&t instanceof HTMLVideoElement||"undefined"!=typeof ImageData&&t instanceof ImageData}function i(t,e,r){var n=t.gl,a=n.getParameter(n.MAX_TEXTURE_SIZE);if(e<0||e>a||r<0||r>a)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,a,i){this.gl=t,this.handle=e,this.format=a,this.type=i,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 s(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 l(t,e,r,n,a,i,o,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,d=s(c,l.stride.slice());"float32"===u?f=t.FLOAT:"float64"===u?(f=t.FLOAT,d=!1,u="float32"):"uint8"===u?f=t.UNSIGNED_BYTE:(f=t.UNSIGNED_BYTE,d=!1,u="uint8");if(2===c.length)h=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])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}c[2]}if(h!==t.LUMINANCE&&h!==t.ALPHA||a!==t.LUMINANCE&&a!==t.ALPHA||(h=a),h!==a)throw new Error("gl-texture2d: Incompatible texture format for setPixels");var v=l.size,y=o.indexOf(n)<0;if(y&&o.push(n), -f===i&&d)0===l.offset&&l.data.length===v?y?t.texImage2D(t.TEXTURE_2D,n,a,c[0],c[1],0,a,i,l.data):t.texSubImage2D(t.TEXTURE_2D,n,e,r,c[0],c[1],a,i,l.data):y?t.texImage2D(t.TEXTURE_2D,n,a,c[0],c[1],0,a,i,l.data.subarray(l.offset,l.offset+v)):t.texSubImage2D(t.TEXTURE_2D,n,e,r,c[0],c[1],a,i,l.data.subarray(l.offset,l.offset+v));else{var b;b=i===t.FLOAT?m.mallocFloat32(v):m.mallocUint8(v);var _=p(b,c,[c[2],c[2]*c[0],1]);f===t.FLOAT&&i===t.UNSIGNED_BYTE?x(_,l):g.assign(_,l),y?t.texImage2D(t.TEXTURE_2D,n,a,c[0],c[1],0,a,i,b.subarray(0,v)):t.texSubImage2D(t.TEXTURE_2D,n,e,r,c[0],c[1],a,i,b.subarray(0,v)),i===t.FLOAT?m.freeFloat32(b):m.freeUint8(b)}}function u(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 c(t,e,r,n,a){var i=t.getParameter(t.MAX_TEXTURE_SIZE);if(e<0||e>i||r<0||r>i)throw new Error("gl-texture2d: Invalid texture shape");if(a===t.FLOAT&&!t.getExtension("OES_texture_float"))throw new Error("gl-texture2d: Floating point textures not supported on this platform");var s=u(t);return t.texImage2D(t.TEXTURE_2D,0,n,e,r,0,n,a,null),new o(t,s,e,r,n,a)}function f(t,e,r,n,a,i){var s=u(t);return t.texImage2D(t.TEXTURE_2D,0,a,a,i,e),new o(t,s,r,n,a,i)}function h(t,e){var r=e.dtype,n=e.shape.slice(),a=t.getParameter(t.MAX_TEXTURE_SIZE);if(n[0]<0||n[0]>a||n[1]<0||n[1]>a)throw new Error("gl-texture2d: Invalid texture size");var i=s(n,e.stride.slice()),l=0;"float32"===r?l=t.FLOAT:"float64"===r?(l=t.FLOAT,i=!1,r="float32"):"uint8"===r?l=t.UNSIGNED_BYTE:(l=t.UNSIGNED_BYTE,i=!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}}l!==t.FLOAT||t.getExtension("OES_texture_float")||(l=t.UNSIGNED_BYTE,i=!1);var f,h,d=e.size;if(i)f=0===e.offset&&e.data.length===d?e.data:e.data.subarray(e.offset,e.offset+d);else{var v=[n[2],n[2]*n[0],1];h=m.malloc(d,r);var y=p(h,n,v,0);"float32"!==r&&"float64"!==r||l!==t.UNSIGNED_BYTE?g.assign(y,e):x(y,e),f=h.subarray(0,d)}var b=u(t);return t.texImage2D(t.TEXTURE_2D,0,c,n[0],n[1],0,c,l,f),i||m.free(h),new o(t,b,n[0],n[1],c,l)}function d(t){if(arguments.length<=1)throw new Error("gl-texture2d: Missing arguments for texture2d constructor");if(v||n(t),"number"==typeof arguments[1])return c(t,arguments[1],arguments[2],arguments[3]||t.RGBA,arguments[4]||t.UNSIGNED_BYTE);if(Array.isArray(arguments[1]))return c(t,0|arguments[1][0],0|arguments[1][1],arguments[2]||t.RGBA,arguments[3]||t.UNSIGNED_BYTE);if("object"==typeof arguments[1]){var e=arguments[1],r=a(e)?e:e.raw;if(r)return f(t,r,0|e.width,0|e.height,arguments[2]||t.RGBA,arguments[3]||t.UNSIGNED_BYTE);if(e.shape&&e.data&&e.stride)return h(t,e)}throw new Error("gl-texture2d: Invalid arguments for texture2d constructor")}var p=t("ndarray"),g=t("ndarray-ops"),m=t("typedarray-pool");e.exports=d;var v=null,y=null,b=null,x=function(t,e){g.muls(t,e,255)},_=o.prototype;Object.defineProperties(_,{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)),y.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)),y.indexOf(t)<0)throw new Error("gl-texture2d: Unknown filter mode "+t);return e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,t),this._magFilter=t}},mipSamples:{get:function(){return this._anisoSamples},set:function(t){var e=this._anisoSamples;if(this._anisoSamples=0|Math.max(t,1),e!==this._anisoSamples){var r=this.gl.getExtension("EXT_texture_filter_anisotropic");r&&this.gl.texParameterf(this.gl.TEXTURE_2D,r.TEXTURE_MAX_ANISOTROPY_EXT,this._anisoSamples)}return this._anisoSamples}},wrapS:{get:function(){return this._wrapS},set:function(t){if(this.bind(),b.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(),b.indexOf(t)<0)throw new Error("gl-texture2d: Unknown wrap mode "+t);return this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,t),this._wrapT=t}},wrap:{get:function(){return this._wrapVector},set:function(t){if(Array.isArray(t)||(t=[t,t]),2!==t.length)throw new Error("gl-texture2d: Must specify wrap mode for rows and columns");for(var e=0;e<2;++e)if(b.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,i(this,t,this._shape[1]),t}},height:{get:function(){return this._shape[1]},set:function(t){return t|=0,i(this,this._shape[0],t),t}}}),_.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},_.dispose=function(){this.gl.deleteTexture(this.handle)},_.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)},_.setPixels=function(t,e,r,n){var i=this.gl;this.bind(),Array.isArray(e)?(n=r,r=0|e[1],e=0|e[0]):(e=e||0,r=r||0),n=n||0;var o=a(t)?t:t.raw;if(o){this._mipLevels.indexOf(n)<0?(i.texImage2D(i.TEXTURE_2D,0,this.format,this.format,this.type,o),this._mipLevels.push(n)):i.texSubImage2D(i.TEXTURE_2D,n,e,r,this.format,this.type,o)}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||e<0||r<0)throw new Error("gl-texture2d: Texture dimensions are out of bounds");l(i,e,r,n,this.format,this.type,this._mipLevels,t)}}},{ndarray:163,"ndarray-ops":162,"typedarray-pool":205}],141:[function(t,e,r){function n(t){for(var e=Array.isArray(t)?t:a(t),r=0;r0)continue;n=t.slice(0,1).join("")}return e(n),q+=n.length,H=H.slice(n.length),H.length}}function O(){return/[^a-fA-F0-9]/.test(P)?(e(H.join("")),j=u,F):(H.push(P),z=P,F+1)}function I(){return"."===P?(H.push(P),j=m,z=P,F+1):/[eE]/.test(P)?(H.push(P),j=m,z=P,F+1):"x"===P&&1===H.length&&"0"===H[0]?(j=w,H.push(P),z=P,F+1):/[^\d]/.test(P)?(e(H.join("")),j=u,F):(H.push(P),z=P,F+1)}function R(){return"f"===P&&(H.push(P),z=P,F+=1),/[eE]/.test(P)?(H.push(P),z=P,F+1):"-"===P&&/[eE]/.test(z)?(H.push(P),z=P,F+1):/[^\d]/.test(P)?(e(H.join("")),j=u,F):(H.push(P),z=P,F+1)}function D(){if(/[^\d\w_]/.test(P)){var t=H.join("");return j=Q.indexOf(t)>-1?b:Z.indexOf(t)>-1?y:v,e(H.join("")),j=u,F}return H.push(P),z=P,F+1}var P,z,N,F=0,B=0,j=u,H=[],U=[],V=1,G=0,q=0,X=!1,Y=!1,W="";t=t||{};var Z=o,Q=a;return"300 es"===t.version&&(Z=l,Q=s),function(t){return U=[],null!==t?r(t.replace?t.replace(/\r\n/g,"\n"):t):n()}}e.exports=n;var a=t("./lib/literals"),i=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,m=5,v=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":144,"./lib/builtins-300es":143,"./lib/literals":146,"./lib/literals-300es":145,"./lib/operators":147}],143:[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":144}],144:[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"]},{}],145:[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":146}],146:[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"]},{}],147:[function(t,e,r){e.exports=["<<=",">>=","++","--","<<",">>","<=",">=","==","!=","&&","||","+=","-=","*=","/=","%=","&=","^^","^=","|=","(",")","[","]",".","!","~","*","/","%","+","-","<",">","&","^","|","?",":","=",",",";","{","}"]},{}],148:[function(t,e,r){function n(t,e){var r=a(e),n=[];return n=n.concat(r(t)),n=n.concat(r(null))}var a=t("./index");e.exports=n},{"./index":142}],149:[function(t,e,r){(function(r){"use strict";var n,a=t("is-browser");n="function"==typeof r.matchMedia?!r.matchMedia("(hover: none)").matches:a,e.exports=n}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"is-browser":154}],150:[function(t,e,r){r.read=function(t,e,r,n,a){var i,o,s=8*a-n-1,l=(1<>1,c=-7,f=r?a-1:0,h=r?-1:1,d=t[e+f];for(f+=h,i=d&(1<<-c)-1,d>>=-c,c+=s;c>0;i=256*i+t[e+f],f+=h,c-=8);for(o=i&(1<<-c)-1,i>>=-c,c+=n;c>0;o=256*o+t[e+f],f+=h,c-=8);if(0===i)i=1-u;else{if(i===l)return o?NaN:1/0*(d?-1:1);o+=Math.pow(2,n),i-=u}return(d?-1:1)*o*Math.pow(2,i-n)},r.write=function(t,e,r,n,a,i){var o,s,l,u=8*i-a-1,c=(1<>1,h=23===a?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:i-1,p=n?1:-1,g=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,o=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,a),o+=f):(s=e*Math.pow(2,f-1)*Math.pow(2,a),o=0));a>=8;t[r+d]=255&s,d+=p,s/=256,a-=8);for(o=o<0;t[r+d]=255&o,d+=p,o/=256,u-=8);t[r+d-p]|=128*g}},{}],151:[function(t,e,r){"use strict";function n(t,e,r,n,a){this.mid=t,this.left=e,this.right=r,this.leftPoints=n,this.rightPoints=a,this.count=(e?e.count:0)+(r?r.count:0)+n.length}function a(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 i(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),i(t,r)}function s(t,e){var r=t.intervals([]),n=r.indexOf(e);return n<0?y:(r.splice(n,1),i(t,r),b)}function l(t,e,r){for(var n=0;n=0&&t[n][1]>=e;--n){var a=r(t[n]);if(a)return a}}function c(t,e){for(var r=0;r>1],i=[],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=v.ge(this.leftPoints,t,h),n=v.ge(this.rightPoints,t,d);this.leftPoints.splice(r,0,t),this.rightPoints.splice(n,0,t)}},x.remove=function(t){var e=this.count-this.leftPoints;if(t[1]3*(e-1))return s(this,t);var r=this.left.remove(t);return 2===r?(this.left=null,this.count-=1,b):(r===b&&(this.count-=1),r)}if(t[0]>this.mid){if(!this.right)return y;if(4*(this.left?this.left.count:0)>3*(e-1))return s(this,t);var r=this.right.remove(t);return 2===r?(this.right=null,this.count-=1,b):(r===b&&(this.count-=1),r)}if(1===this.count)return this.leftPoints[0]===t?2:y;if(1===this.leftPoints.length&&this.leftPoints[0]===t){if(this.left&&this.right){for(var n=this,i=this.left;i.right;)n=i,i=i.right;if(n===this)i.right=this.right;else{var o=this.left,r=this.right;n.count-=i.count,n.right=i.left,i.left=o,i.right=r}a(this,i),this.count=(this.left?this.left.count:0)+(this.right?this.right.count:0)+this.leftPoints.length}else this.left?a(this,this.left):a(this,this.right);return b}for(var o=v.ge(this.leftPoints,t,h);othis.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)},x.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 _=g.prototype;_.insert=function(t){this.root?this.root.insert(t):this.root=new n(t[0],null,null,[t],[t])},_.remove=function(t){if(this.root){var e=this.root.remove(t);return 2===e&&(this.root=null),e!==y}return!1},_.queryPoint=function(t,e){if(this.root)return this.root.queryPoint(t,e)},_.queryInterval=function(t,e,r){if(t<=e&&this.root)return this.root.queryInterval(t,e,r)},Object.defineProperty(_,"count",{get:function(){return this.root?this.root.count:0}}),Object.defineProperty(_,"intervals",{get:function(){return this.root?this.root.intervals([]):[]}})},{"binary-search-bounds":30}],152:[function(t,e,r){"use strict";function n(t,e){e=e||new Array(t.length);for(var r=0;r0)return 1<=0)return 1<=0;--e)S(e,0);for(var r=[],e=0;e0;_=_-1&g)x.push(w+"["+T+"+"+m(_)+"]");x.push(v(0));for(var _=0;_0){",h(x[t]),"=1;"),D(t-1,e|1<0&&q.push(s(H,x[U-1])+"*"+o(x[U-1])),B.push(d(H,x[U])+"=("+q.join("-")+")|0")}for(var H=0;H=0;--H)X.push(o(x[H]));B.push(M+"=("+X.join("*")+")|0",A+"=mallocUint32("+M+")",w+"=mallocUint32("+M+")",T+"=0"),B.push(p(0)+"=0");for(var U=1;U<1< 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 i=t.getters||[],o=new Array(n),s=0;s=0?o[s]=!0:o[s]=!1;return b(t.vertex,t.cell,t.phase,a,r,o)}var _=t("typedarray-pool");e.exports=x;var w="V",A="P",k="N",M="Q",T="X",E="T"},{"typedarray-pool":205}],162:[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]=i({args:["array","array","array"],body:{args:["a","b","c"],body:"a=b"+e+"c"},funcName:t}),r[t+"eq"]=i({args:["array","array"],body:{args:["a","b"],body:"a"+e+"=b"}, -rvalue:!0,funcName:t+"eq"}),r[t+"s"]=i({args:["array","array","scalar"],body:{args:["a","b","s"],body:"a=b"+e+"s"},funcName:t+"s"}),r[t+"seq"]=i({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]=i({args:["array","array"],body:{args:["a","b"],body:"a="+e+"b"},funcName:t}),r[t+"eq"]=i({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]=i({args:["array","array","array"],body:{args:["a","b","c"],body:"a=b"+e+"c"},funcName:t}),r[t+"s"]=i({args:["array","array","scalar"],body:{args:["a","b","s"],body:"a=b"+e+"s"},funcName:t+"s"}),r[t+"eq"]=i({args:["array","array"],body:{args:["a","b"],body:"a=a"+e+"b"},rvalue:!0,count:2,funcName:t+"eq"}),r[t+"seq"]=i({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=i({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=i({args:["array","array"],body:{args:["a","b"],body:"a=b"},funcName:"assign"}),r.assigns=i({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}],163:[function(t,e,r){function n(t,e){return t[0]-e[0]}function a(){var t,e=this.stride,r=new Array(e.length);for(t=0;tMath.abs(this.stride[1]))?[1,0]:[0,1]}})"):3===e&&i.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];}}})")):i.push("ORDER})")),i.push("proto.set=function "+r+"_set("+u.join(",")+",v){"),n?i.push("return this.data.set("+c+",v)}"):i.push("return this.data["+c+"]=v}"),i.push("proto.get=function "+r+"_get("+u.join(",")+"){"),n?i.push("return this.data.get("+c+")}"):i.push("return this.data["+c+"]}"),i.push("proto.index=function "+r+"_index(",u.join(),"){return "+c+"}"),i.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+"]"});i.push("proto.lo=function "+r+"_lo("+u.join(",")+"){var b=this.offset,d=0,"+p.join(",")+","+g.join(","));for(var m=0;m=0){d=i"+m+"|0;b+=c"+m+"*d;a"+m+"-=d}");i.push("return new "+r+"(this.data,"+s.map(function(t){return"a"+t}).join(",")+","+s.map(function(t){return"c"+t}).join(",")+",b)}"),i.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;m=0){c=(c+this.stride["+m+"]*i"+m+")|0}else{a.push(this.shape["+m+"]);b.push(this.stride["+m+"])}");i.push("var ctor=CTOR_LIST[a.length+1];return ctor(this.data,a,b,c)}"),i.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",i.join("\n"));return o(f[t],a)}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 a=f.array[0];return a([])}"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;lt==t>0?n===o?(r+=1,n=0):n+=1:0===n?(n=o,r-=1):n-=1,a.pack(n,r)}var a=t("double-bits"),i=Math.pow(2,-1074),o=-1>>>0;e.exports=n},{"double-bits":63}],165:[function(t,e,r){"use strict";function n(t,e){var r,n,o;return"string"==typeof t?(r=a(t,e),n=r.width,o=r.height):t instanceof HTMLCanvasElement?(n=t.width,o=t.height,t=t.getContext("2d"),r=t.getImageData(0,0,n,o)):t instanceof ImageData&&(n=t.width,o=t.height,r=t),i(r)}function a(t,e){e||(e={});var r=e.family||"sans-serif",n=l.width,a=l.height,i=e.width||e.height||e.size;i&&i!=n&&(n=a=l.width=l.height=i);var o=e.fontSize||n/2;return u.fillStyle="#000",u.fillRect(0,0,n,a),u.font=o+"px "+r,u.textBaseline="middle",u.textAlign="center",u.fillStyle="white",u.fillText(t,n/2,a/2),u.getImageData(0,0,n,a)}function i(t){var e,r,n,a,i,l,u,c,f,h,d,p,g,m=t.data,v=t.width,y=t.height,b=Array(y),x=Array(y),_=0,w=0,A=v,k=0,M=0,T=Array(y);for(r=0;rk&&(k=d[1]),T[r]=d}for(l=0,c=0,u=0,r=0;rM&&(M=g);return{center:[f,h],bounds:[A,_,k,w+1],radius:Math.sqrt(M)}}function o(t,e){var r=0,n=t.length,a=0;for(e||(e=4);!t[a]&&ar;)a-=e;return n=a,[r/e,n/e]}function s(t,e){return t*t+e*e}e.exports=n;var l=document.createElement("canvas"),u=l.getContext("2d");l.width=200,l.height=200,n.canvas=l},{}],166:[function(t,e,r){"use strict";var n=t("repeat-string");e.exports=function(t,e,r){return r=void 0!==r?r+"":" ",n(r,e)+t}},{"repeat-string":180}],167:[function(t,e,r){e.exports=function(t,e){e||(e=[0,""]),t=String(t);var r=parseFloat(t,10);return e[0]=r,e[1]=t.match(/[\d.\-\+]*\s*(.*)/)[1]||"",e}},{}],168:[function(t,e,r){"use strict";function n(t){var e=t.length;if(e0;--a)n=l[a],r=s[a],s[a]=s[n],s[n]=r,l[a]=l[r],l[r]=n,u=(u+r)*a;return i.freeUint32(l),i.freeUint32(s),u}function a(t,e,r){switch(t){case 0:return 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,a,i,o=1;for(r[0]=0,i=1;i0;--i)n=e/o|0,e=e-n*o|0,o=o/i|0,a=0|r[i],r[i]=0|r[n],r[n]=0|a;return r}var i=t("typedarray-pool"),o=t("invert-permutation");r.rank=n,r.unrank=a},{"invert-permutation":152,"typedarray-pool":205}],170:[function(t,e,r){"use strict";function n(t,e){function r(t,e){var r=s[e][t[e]];r.splice(r.indexOf(t),1)}function n(t,n,i){for(var o,l,u,c=0;c<2;++c)if(s[c][n].length>0){o=s[c][n][0],u=c;break}l=o[1^u];for(var f=0;f<2;++f)for(var h=s[f][n],d=0;d0&&(o=p,l=g,u=f)}return i?l:(o&&r(o,u),l)}for(var i=0|e.length,o=t.length,s=[new Array(i),new Array(i)],l=0;l0;){var d=(s[0][l].length,function(t,i){var o=s[i][t][0],l=[t];r(o,i);for(var u=o[1^i];;){for(;u!==t;)l.push(u),u=n(l[l.length-2],u,!1);if(s[0][t].length+s[1][t].length===0)break;var c=l[l.length-1],f=t,h=l[1],d=n(c,f,!0);if(a(e[c],e[f],e[h],e[d])<0)break;l.push(t),u=n(c,f)}return l}(l,f));!function(t,e){return e[1]===e[e.length-1]}(h,d)?(h.length>0&&c.push(h),h=d):h.push.apply(h,d)}h.length>0&&c.push(h)}return c}e.exports=n;var a=t("compare-angle")},{"compare-angle":57}],171:[function(t,e,r){"use strict";function n(t,e){for(var r=a(t,e.length),n=new Array(e.length),i=new Array(e.length),o=[],s=0;s0;){var u=o.pop();n[u]=!1;for(var c=r[u],s=0;s0}function i(t){for(var e=t.length,r=0;r0;){var H=B.pop(),U=I[H];f(U,function(t,e){return t-e});var V,G=U.length,q=j[H];if(0===q){var T=v[H];V=[T]}for(var m=0;m=0)&&(j[X]=1^q,B.push(X),0===q)){var T=v[X];i(T)||(T.reverse(),V.push(T))}}0===q&&d.push(V)}return d}e.exports=i;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":171,"edges-to-adjacency-list":65,"planar-dual":170,"point-in-big-polygon":173,"robust-sum":187,"two-product":203,uniq:207}],173:[function(t,e,r){function n(){return!0}function a(t){return function(e,r){var a=t[e];return!!a&&!!a.queryPoint(r,n)}}function i(t){for(var e={},r=0;r0&&e[n]===r[0]))return 1;a=t[n-1]}for(var i=1;a;){var o=a.key,s=f(r,o[0],o[1]);if(o[0][0]0))return 0;i=-1,a=a.right}else if(s>0)a=a.left;else{if(!(s<0))return 0;i=1,a=a.right}}return i}}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=[],a=0;a1)for(var r=1;r=0&&(0|t)===t||e("invalid parameter type, ("+t+")"+n(r)+". must be a nonnegative integer")}function l(t,r,a){r.indexOf(t)<0&&e("invalid value"+n(a)+". must be one of: "+r)}function u(t){Object.keys(t).forEach(function(t){te.indexOf(t)<0&&e('invalid regl constructor argument "'+t+'". must be one of '+te)})}function c(t,e){for(t+="";t.length0&&e.push(new d("unknown",0,t))}}),e}function y(t,e){e.forEach(function(e){var r=t[e.file];if(r){var n=r.index[e.line];if(n)return n.errors.push(e),void(r.hasErrors=!0)}t.unknown.hasErrors=!0,t.unknown.lines[0].errors.push(e)})}function b(t,e,n,a,i){if(!t.getShaderParameter(e,t.COMPILE_STATUS)){var o=t.getShaderInfoLog(e),s=a===t.FRAGMENT_SHADER?"fragment":"vertex";T(n,"string",s+" shader source must be a string",i);var l=m(n,i),u=v(o);y(l,u),Object.keys(l).forEach(function(t){function e(t,e){n.push(t),a.push(e||"")}var r=l[t];if(r.hasErrors){var n=[""],a=[""];e("file number "+t+": "+r.name+"\n","color:red;text-decoration:underline;font-weight:bold"),r.lines.forEach(function(t){if(t.errors.length>0){e(c(t.number,4)+"| ","background-color:yellow; font-weight:bold"),e(t.line+"\n","color:red; background-color:yellow; font-weight:bold");var r=0;t.errors.forEach(function(n){var a=n.message,i=/^\s*\'(.*)\'\s*\:\s*(.*)$/.exec(a);if(i){var o=i[1];switch(a=i[2],o){case"assign":o="="}r=Math.max(t.line.indexOf(o,r),0)}else r=0;e(c("| ",6)),e(c("^^^",r+3)+"\n","font-weight:bold"),e(c("| ",6)),e(a+"\n","font-weight:bold")}),e(c("| ",6)+"\n")}else e(c(t.number,4)+"| "),e(t.line+"\n","color:red")}),"undefined"!=typeof document?(a[0]=n.join("%c"),console.log.apply(console,a)):console.log(n.join(""))}}),r.raise("Error compiling "+s+" shader, "+l[0].name)}}function x(t,e,n,a,i){if(!t.getProgramParameter(e,t.LINK_STATUS)){var o=t.getProgramInfoLog(e),s=m(n,i),l=m(a,i),u='Error linking program with vertex shader, "'+l[0].name+'", and fragment shader "'+s[0].name+'"';"undefined"!=typeof document?console.log("%c"+u+"\n%c"+o,"color:red;text-decoration:underline;font-weight:bold","color:red"):console.log(u+"\n"+o),r.raise(u)}}function _(t){t._commandRef=p()}function w(t,e,r,n){function a(t){return t?n.id(t):0}function i(t,e){Object.keys(e).forEach(function(e){t[n.id(e)]=!0})}_(t),t._fragId=a(t.static.frag),t._vertId=a(t.static.vert);var o=t._uniformSet={};i(o,e.static),i(o,e.dynamic);var s=t._attributeSet={};i(s,r.static),i(s,r.dynamic),t._hasCount="count"in t.static||"count"in t.dynamic||"elements"in t.static||"elements"in t.dynamic}function A(t,r){var n=g();e(t+" in command "+(r||p())+("unknown"===n?"":" called from "+n))}function k(t,e,r){t||A(e,r||p())}function M(t,e,r,a){t in e||A("unknown parameter ("+t+")"+n(r)+". possible values: "+Object.keys(e).join(),a||p())}function T(t,e,r,a){typeof t!==e&&A("invalid parameter type"+n(r)+". expected "+e+", got "+typeof t,a||p())}function E(t){t()}function L(t,e,r){t.texture?l(t.texture._texture.internalformat,e,"unsupported texture format for attachment"):l(t.renderbuffer._renderbuffer.format,r,"unsupported renderbuffer format for attachment")}function S(t,e){return t===ue||t===le||t===ce?2:t===fe?4:he[t]*e}function C(t){return!(t&t-1||!t)}function O(t,e,n){var a,i=e.width,o=e.height,s=e.channels;r(i>0&&i<=n.maxTextureSize&&o>0&&o<=n.maxTextureSize,"invalid texture shape"),t.wrapS===ee&&t.wrapT===ee||r(C(i)&&C(o),"incompatible wrap mode for texture, both width and height must be power of 2"),1===e.mipmask?1!==i&&1!==o&&r(t.minFilter!==ne&&t.minFilter!==ie&&t.minFilter!==ae&&t.minFilter!==oe,"min filter requires mipmap"):(r(C(i)&&C(o),"texture must be a square power of 2 to support mipmapping"),r(e.mipmask===(i<<1)-1,"missing or incomplete mipmap data")),e.type===se&&(n.extensions.indexOf("oes_texture_float_linear")<0&&r(t.minFilter===re&&t.magFilter===re,"filter not supported, must enable oes_texture_float_linear"),r(!t.genMipmaps,"mipmap generation not supported with float textures"));var l=e.images;for(a=0;a<16;++a)if(l[a]){var u=i>>a,c=o>>a;r(e.mipmask&1<0&&i<=a.maxTextureSize&&o>0&&o<=a.maxTextureSize,"invalid texture shape"),r(i===o,"cube map must be square"),r(e.wrapS===ee&&e.wrapT===ee,"wrap mode not supported by cube map");for(var l=0;l>f,p=o>>f;r(u.mipmask&1<1&&e===r&&('"'===e||"'"===e))return['"'+D(t.substr(1,t.length-2))+'"'];var n=/\[(false|true|null|\d+|'[^']*'|"[^"]*")\]/.exec(t);if(n)return P(t.substr(0,n.index)).concat(P(n[1])).concat(P(t.substr(n.index+n[0].length)));var a=t.split(".");if(1===a.length)return['"'+D(t)+'"'];for(var i=[],o=0;o0,"invalid pixel ratio"))):de.raise("invalid arguments to regl"),e&&("canvas"===e.nodeName.toLowerCase()?n=e:r=e),!a){if(!n){de("undefined"!=typeof document,"must manually specify webgl context outside of DOM environments");var d=H(r||document.body,f,u);if(!d)return null;n=d.canvas,h=d.onDestroy}a=U(n,o)}return a?{gl:a,canvas:n,container:r,extensions:s,optionalExtensions:l,pixelRatio:u,profile:c,onDone:f,onDestroy:h}:(h(),f("webgl not supported, try upgrading your browser or graphics drivers http://get.webgl.org"),null)}function W(t,e){function r(e){de.type(e,"string","extension name must be string");var r,a=e.toLowerCase();try{r=n[a]=t.getExtension(a)}catch(t){}return!!r}for(var n={},a=0;a65535)<<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)|t>>1}function J(t){var e=$(t),r=Le[K(e)>>2];return r.length>0?r.pop():new ArrayBuffer(e)}function tt(t){Le[K(t.byteLength)>>2].push(t)}function et(t,e){var r=null;switch(t){case _e:r=new Int8Array(J(e),0,e);break;case we:r=new Uint8Array(J(e),0,e);break;case Ae:r=new Int16Array(J(2*e),0,e);break;case ke:r=new Uint16Array(J(2*e),0,e);break;case Me:r=new Int32Array(J(4*e),0,e);break;case Te:r=new Uint32Array(J(4*e),0,e);break;case Ee:r=new Float32Array(J(4*e),0,e);break;default:return null}return r.length!==e?r.subarray(0,e):r}function rt(t){tt(t.buffer)}function nt(t,e,r){for(var n=0;n0){var l;if(Array.isArray(e[0])){s=De(e);for(var u=1,c=1;c0)if("number"==typeof t[0]){var a=Se.allocType(p.dtype,t.length);ct(a,t),f(a,n),Se.freeType(a)}else if(Array.isArray(t[0])||Kt(t[0])){r=De(t);var i=Re(t,r,p.dtype);f(i,n),Se.freeType(i)}else de.raise("invalid buffer data")}else if(Kt(t))f(t,n);else if(Z(t)){r=t.shape;var o=t.stride,s=0,l=0,u=0,h=0;1===r.length?(s=r[0],l=1,u=o[0],h=0):2===r.length?(s=r[0],l=r[1],u=o[0],h=o[1]):de.raise("invalid shape");var d=Array.isArray(t.data)?p.dtype:ut(t.data),g=Se.allocType(d,s*l);ft(g,t.data,s,l,u,h,t.offset),f(g,n),Se.freeType(g)}else de.raise("invalid data for buffer subdata");return c}e.bufferCount++;var p=new n(i);return h[p.id]=p,o||c(a),c._reglType="buffer",c._buffer=p,c.subdata=d,r.profile&&(c.stats=p.stats),c.destroy=function(){l(p)},c}function c(){xe(h).forEach(function(e){e.buffer=t.createBuffer(),t.bindBuffer(e.type,e.buffer),t.bufferData(e.type,e.persistentData||e.byteLength,e.usage)})}var f=0,h={};n.prototype.bind=function(){t.bindBuffer(this.type,this.buffer)},n.prototype.destroy=function(){l(this)};var d=[];return r.profile&&(e.getTotalBufferSize=function(){var t=0;return Object.keys(h).forEach(function(e){t+=h[e].stats.size}),t}),{create:u,createStream:a,destroyStream:i,clear:function(){xe(h).forEach(l),d.forEach(l)},getBuffer:function(t){return t&&t._buffer instanceof n?t._buffer:null},restore:c,_initBuffer:s}}function dt(t,e,r,n){function a(t){this.id=f++,c[this.id]=this,this.buffer=t,this.primType=Ve,this.vertCount=0,this.type=0}function i(t){var e=d.pop();return e||(e=new a(r.create(null,Qe,!0,!1)._buffer)),s(e,t,$e,-1,-1,0,0),e}function o(t){d.push(t)}function s(n,a,i,o,s,l,u){if(n.buffer.bind(),a){var c=u;u||Kt(a)&&(!Z(a)||Kt(a.data))||(c=e.oes_element_index_uint?Ze:Ye),r._initBuffer(n.buffer,a,i,c,3)}else t.bufferData(Qe,l,i),n.buffer.dtype=f||qe,n.buffer.usage=i,n.buffer.dimension=3,n.buffer.byteLength=l;var f=u;if(!u){switch(n.buffer.dtype){case qe:case Ge:f=qe;break;case Ye:case Xe:f=Ye;break;case Ze:case We:f=Ze;break;default:de.raise("unsupported type for element array")}n.buffer.dtype=f}n.type=f,de(f!==Ze||!!e.oes_element_index_uint,"32 bit element buffers not supported, enable oes_element_index_uint first");var h=s;h<0&&(h=n.buffer.byteLength,f===Ye?h>>=1:f===Ze&&(h>>=2)),n.vertCount=h;var d=o;if(o<0){d=Ve;var p=n.buffer.dimension;1===p&&(d=He),2===p&&(d=Ue),3===p&&(d=Ve)}n.primType=d}function l(t){n.elementsCount--,de(null!==t.buffer,"must not double destroy elements"),delete c[t.id],t.buffer.destroy(),t.buffer=null}function u(t,e){function i(t){if(t)if("number"==typeof t)o(t),u.primType=Ve,u.vertCount=0|t,u.type=qe;else{var e=null,r=Ke,n=-1,a=-1,l=0,c=0;Array.isArray(t)||Kt(t)||Z(t)?e=t:(de.type(t,"object","invalid arguments for elements"),"data"in t&&(e=t.data,de(Array.isArray(e)||Kt(e)||Z(e),"invalid data for element buffer")),"usage"in t&&(de.parameter(t.usage,Ie,"invalid element buffer usage"),r=Ie[t.usage]),"primitive"in t&&(de.parameter(t.primitive,je,"invalid element buffer primitive"),n=je[t.primitive]),"count"in t&&(de("number"==typeof t.count&&t.count>=0,"invalid vertex count for elements"),a=0|t.count),"type"in t&&(de.parameter(t.type,h,"invalid buffer type"),c=h[t.type]),"length"in t?l=0|t.length:(l=a,c===Ye||c===Xe?l*=2:c!==Ze&&c!==We||(l*=4))),s(u,e,r,n,a,l,c)}else o(),u.primType=Ve,u.vertCount=0,u.type=qe;return i}var o=r.create(null,Qe,!0),u=new a(o._buffer);return n.elementsCount++,i(t),i._reglType="elements",i._elements=u,i.subdata=function(t,e){return o.subdata(t,e),i},i.destroy=function(){l(u)},i}var c={},f=0,h={uint8:qe,uint16:Ye};e.oes_element_index_uint&&(h.uint32=Ze),a.prototype.bind=function(){this.buffer.bind()};var d=[];return{create:u,createStream:i,destroyStream:o,getElements:function(t){return"function"==typeof t&&t._elements instanceof a?t._elements:null},clear:function(){xe(c).forEach(l)}}}function pt(t){for(var e=Se.allocType(er,t.length),r=0;r>>31<<15,i=(n<<1>>>24)-127,o=n>>13&1023;if(i<-24)e[r]=a;else if(i<-14){var s=-14-i;e[r]=a+(o+1024>>s)}else e[r]=i>15?a+31744:a+(i+15<<10)+o}return e}function gt(t){return Array.isArray(t)||Kt(t)}function mt(t){return"[object "+t+"]"}function vt(t){return Array.isArray(t)&&(0===t.length||"number"==typeof t[0])}function yt(t){return!!Array.isArray(t)&&!(0===t.length||!gt(t[0]))}function bt(t){return Object.prototype.toString.call(t)}function xt(t){return bt(t)===dn}function _t(t){return bt(t)===pn}function wt(t){return bt(t)===gn}function At(t){return bt(t)===mn}function kt(t){if(!t)return!1;var e=bt(t);return vn.indexOf(e)>=0||(vt(t)||yt(t)||Z(t))}function Mt(t){return 0|$t[Object.prototype.toString.call(t)]}function Tt(t,e){var r=e.length;switch(t.type){case Pr:case zr:case Nr:case Fr:var n=Se.allocType(t.type,r);n.set(e),t.data=n;break;case wr:t.data=pt(e);break;default:de.raise("unsupported texture type, must specify a typed array")}}function Et(t,e){return Se.allocType(t.type===wr?Fr:t.type,e)}function Lt(t,e){t.type===wr?(t.data=pt(e),Se.freeType(e)):t.data=e}function St(t,e,r,n,a,i){for(var o=t.width,s=t.height,l=t.channels,u=o*s*l,c=Et(t,u),f=0,h=0;h=1;)s+=o*l*l,l/=2;return s}return o*r*n}function Ot(t,e,r,n,a,i,o){function s(){this.internalformat=or,this.format=or,this.type=Pr,this.compressed=!1,this.premultiplyAlpha=!1,this.flipY=!1,this.unpackAlignment=1,this.colorSpace=0,this.width=0,this.height=0,this.channels=0}function l(t,e){t.internalformat=e.internalformat,t.format=e.format,t.type=e.type,t.compressed=e.compressed,t.premultiplyAlpha=e.premultiplyAlpha,t.flipY=e.flipY,t.unpackAlignment=e.unpackAlignment,t.colorSpace=e.colorSpace,t.width=e.width,t.height=e.height,t.channels=e.channels}function u(t,n){if("object"==typeof n&&n){if("premultiplyAlpha"in n&&(de.type(n.premultiplyAlpha,"boolean","invalid premultiplyAlpha"),t.premultiplyAlpha=n.premultiplyAlpha),"flipY"in n&&(de.type(n.flipY,"boolean","invalid texture flip"),t.flipY=n.flipY),"alignment"in n&&(de.oneOf(n.alignment,[1,2,4,8],"invalid texture unpack alignment"),t.unpackAlignment=n.alignment),"colorSpace"in n&&(de.parameter(n.colorSpace,F,"invalid colorSpace"),t.colorSpace=F[n.colorSpace]),"type"in n){var a=n.type;de(e.oes_texture_float||!("float"===a||"float32"===a),"you must enable the OES_texture_float extension in order to use floating point textures."),de(e.oes_texture_half_float||!("half float"===a||"float16"===a),"you must enable the OES_texture_half_float extension in order to use 16-bit floating point textures."),de(e.webgl_depth_texture||!("uint16"===a||"uint32"===a||"depth stencil"===a),"you must enable the WEBGL_depth_texture extension in order to use depth/stencil textures."),de.parameter(a,B,"invalid texture type"),t.type=B[a]}var i=t.width,o=t.height,s=t.channels,l=!1;"shape"in n?(de(Array.isArray(n.shape)&&n.shape.length>=2,"shape must be an array"),i=n.shape[0],o=n.shape[1],3===n.shape.length&&(s=n.shape[2],de(s>0&&s<=4,"invalid number of channels"),l=!0),de(i>=0&&i<=r.maxTextureSize,"invalid width"),de(o>=0&&o<=r.maxTextureSize,"invalid height")):("radius"in n&&(i=o=n.radius,de(i>=0&&i<=r.maxTextureSize,"invalid radius")),"width"in n&&(i=n.width,de(i>=0&&i<=r.maxTextureSize,"invalid width")),"height"in n&&(o=n.height,de(o>=0&&o<=r.maxTextureSize,"invalid height")),"channels"in n&&(s=n.channels,de(s>0&&s<=4,"invalid number of channels"),l=!0)),t.width=0|i,t.height=0|o,t.channels=0|s;var u=!1;if("format"in n){var c=n.format;de(e.webgl_depth_texture||!("depth"===c||"depth stencil"===c),"you must enable the WEBGL_depth_texture extension in order to use depth/stencil textures."),de.parameter(c,j,"invalid texture format");var f=t.internalformat=j[c];t.format=Q[f],c in B&&("type"in n||(t.type=B[c])),c in H&&(t.compressed=!0),u=!0}!l&&u?t.channels=hn[t.format]:l&&!u?t.channels!==fn[t.format]&&(t.format=t.internalformat=fn[t.channels]):u&&l&&de(t.channels===hn[t.format],"number of channels inconsistent with specified format")}}function c(e){t.pixelStorei(an,e.flipY),t.pixelStorei(on,e.premultiplyAlpha),t.pixelStorei(sn,e.colorSpace),t.pixelStorei(nn,e.unpackAlignment)}function f(){s.call(this),this.xOffset=0,this.yOffset=0,this.data=null,this.needsFree=!1,this.element=null,this.needsCopy=!1}function h(t,e){var n=null;if(kt(e)?n=e:e&&(de.type(e,"object","invalid pixel data type"),u(t,e),"x"in e&&(t.xOffset=0|e.x),"y"in e&&(t.yOffset=0|e.y),kt(e.data)&&(n=e.data)),de(!t.compressed||n instanceof Uint8Array,"compressed texture data must be stored in a uint8array"),e.copy){de(!n,"can not specify copy and data field for the same texture");var i=a.viewportWidth,o=a.viewportHeight;t.width=t.width||i-t.xOffset,t.height=t.height||o-t.yOffset,t.needsCopy=!0,de(t.xOffset>=0&&t.xOffset=0&&t.yOffset0&&t.width<=i&&t.height>0&&t.height<=o,"copy texture read out of bounds")}else if(n){if(Kt(n))t.channels=t.channels||4,t.data=n,"type"in e||t.type!==Pr||(t.type=Mt(n));else if(vt(n))t.channels=t.channels||4,Tt(t,n),t.alignment=1,t.needsFree=!0;else if(Z(n)){var s=n.data;Array.isArray(s)||t.type!==Pr||(t.type=Mt(s));var l,c,f,h,d,p,g=n.shape,m=n.stride;3===g.length?(f=g[2],p=m[2]):(de(2===g.length,"invalid ndarray pixel data, must be 2 or 3D"),f=1,p=1),l=g[0],c=g[1],h=m[0],d=m[1],t.alignment=1,t.width=l,t.height=c,t.channels=f,t.format=t.internalformat=fn[f],t.needsFree=!0,St(t,s,h,d,p,n.offset)}else if(xt(n)||_t(n))xt(n)?t.element=n:t.element=n.canvas,t.width=t.element.width,t.height=t.element.height,t.channels=4;else if(wt(n))t.element=n,t.width=n.naturalWidth,t.height=n.naturalHeight,t.channels=4;else if(At(n))t.element=n,t.width=n.videoWidth,t.height=n.videoHeight,t.channels=4;else if(yt(n)){var v=t.width||n[0].length,y=t.height||n.length,b=t.channels;b=gt(n[0][0])?b||n[0][0].length:b||1;for(var x=Ce.shape(n),_=1,w=0;w=0,"oes_texture_float extension not enabled"):t.type===wr&&de(r.extensions.indexOf("oes_texture_half_float")>=0,"oes_texture_half_float extension not enabled")}function d(e,r,a){var i=e.element,o=e.data,s=e.internalformat,l=e.format,u=e.type,f=e.width,h=e.height;c(e),i?t.texImage2D(r,a,l,l,u,i):e.compressed?t.compressedTexImage2D(r,a,s,f,h,0,o):e.needsCopy?(n(),t.copyTexImage2D(r,a,l,e.xOffset,e.yOffset,f,h,0)):t.texImage2D(r,a,l,f,h,0,l,u,o)}function p(e,r,a,i,o){var s=e.element,l=e.data,u=e.internalformat,f=e.format,h=e.type,d=e.width,p=e.height;c(e),s?t.texSubImage2D(r,o,a,i,f,h,s):e.compressed?t.compressedTexSubImage2D(r,o,a,i,u,d,p,l):e.needsCopy?(n(),t.copyTexSubImage2D(r,o,a,i,e.xOffset,e.yOffset,d,p)):t.texSubImage2D(r,o,a,i,d,p,f,h,l)}function g(){return $.pop()||new f}function m(t){t.needsFree&&Se.freeType(t.data),f.call(t),$.push(t)}function v(){s.call(this),this.genMipmaps=!1,this.mipmapHint=Jr,this.mipmask=0,this.images=Array(16)}function y(t,e,r){var n=t.images[0]=g();t.mipmask=1,n.width=t.width=e,n.height=t.height=r,n.channels=t.channels=4}function b(t,e){var r=null;if(kt(e))r=t.images[0]=g(),l(r,t),h(r,e),t.mipmask=1;else if(u(t,e),Array.isArray(e.mipmap))for(var n=e.mipmap,a=0;a>=a,r.height>>=a,h(r,n[a]),t.mipmask|=1<=0&&(t.genMipmaps=!0)}if("mag"in e){var a=e.mag;de.parameter(a,z),t.magFilter=z[a]}var i=t.wrapS,o=t.wrapT;if("wrap"in e){var s=e.wrap;"string"==typeof s?(de.parameter(s,P),i=o=P[s]):Array.isArray(s)&&(de.parameter(s[0],P),de.parameter(s[1],P),i=P[s[0]],o=P[s[1]])}else{if("wrapS"in e){var l=e.wrapS;de.parameter(l,P),i=P[l]}if("wrapT"in e){var u=e.wrapT;de.parameter(u,P),o=P[u]}}if(t.wrapS=i,t.wrapT=o,"anisotropic"in e){var c=e.anisotropic;de("number"==typeof c&&c>=1&&c<=r.maxAnisotropic,"aniso samples must be between 1 and "),t.anisotropic=e.anisotropic}if("mipmap"in e){var f=!1;switch(typeof e.mipmap){case"string":de.parameter(e.mipmap,D,"invalid mipmap hint"),t.mipmapHint=D[e.mipmap],t.genMipmaps=!0,f=!0;break;case"boolean":f=t.genMipmaps=e.mipmap;break;case"object":de(Array.isArray(e.mipmap),"invalid mipmap type"),t.genMipmaps=!1,f=!0;break;default:de.raise("invalid mipmap type")}!f||"min"in e||(t.minFilter=Wr)}}function M(r,n){t.texParameteri(n,qr,r.minFilter),t.texParameteri(n,Gr,r.magFilter),t.texParameteri(n,Br,r.wrapS),t.texParameteri(n,jr,r.wrapT),e.ext_texture_filter_anisotropic&&t.texParameteri(n,rn,r.anisotropic),r.genMipmaps&&(t.hint(Kr,r.mipmapHint),t.generateMipmap(n))}function T(e){s.call(this),this.mipmask=0,this.internalformat=or,this.id=J++,this.refCount=1,this.target=e,this.texture=t.createTexture(),this.unit=-1,this.bindCount=0,this.texInfo=new A,o.profile&&(this.stats={size:0})}function E(e){t.activeTexture(un),t.bindTexture(e.target,e.texture)}function L(){var e=rt[0];e?t.bindTexture(e.target,e.texture):t.bindTexture(nr,null)}function S(e){var r=e.texture;de(r,"must not double destroy texture");var n=e.unit,a=e.target;n>=0&&(t.activeTexture(un+n),t.bindTexture(a,null),rt[n]=null),t.deleteTexture(r),e.texture=null,e.params=null,e.pixels=null,e.refCount=0,delete tt[e.id],i.textureCount--}function C(e,n){function a(t,e){var n=c.texInfo;A.call(n);var i=_();return"number"==typeof t?"number"==typeof e?y(i,0|t,0|e):y(i,0|t,0|t):t?(de.type(t,"object","invalid arguments to regl.texture"),k(n,t),b(i,t)):y(i,1,1),n.genMipmaps&&(i.mipmask=(i.width<<1)-1),c.mipmask=i.mipmask,l(c,i),de.texture2D(n,i,r),c.internalformat=i.internalformat,a.width=i.width,a.height=i.height,E(c),x(i,nr),M(n,nr),L(),w(i),o.profile&&(c.stats.size=Ct(c.internalformat,c.type,i.width,i.height,n.genMipmaps,!1)),a.format=G[c.internalformat],a.type=q[c.type],a.mag=X[n.magFilter],a.min=Y[n.minFilter],a.wrapS=W[n.wrapS],a.wrapT=W[n.wrapT],a}function s(t,e,r,n){de(!!t,"must specify image data");var i=0|e,o=0|r,s=0|n,u=g();return l(u,c),u.width=0,u.height=0,h(u,t),u.width=u.width||(c.width>>s)-i,u.height=u.height||(c.height>>s)-o,de(c.type===u.type&&c.format===u.format&&c.internalformat===u.internalformat,"incompatible format for texture.subimage"),de(i>=0&&o>=0&&i+u.width<=c.width&&o+u.height<=c.height,"texture.subimage write out of bounds"),de(c.mipmask&1<>s;++s)t.texImage2D(nr,s,c.format,n>>s,i>>s,0,c.format,c.type,null);return L(),o.profile&&(c.stats.size=Ct(c.internalformat,c.type,n,i,!1,!1)),a}var c=new T(nr);return tt[c.id]=c,i.textureCount++,a(e,n),a.subimage=s,a.resize=u,a._reglType="texture2d",a._texture=c,o.profile&&(a.stats=c.stats),a.destroy=function(){c.decRef()},a}function O(e,n,a,s,c,f){function d(t,e,n,a,i,s){var c,f=C.texInfo;for(A.call(f),c=0;c<6;++c)O[c]=_();if("number"!=typeof t&&t)if("object"==typeof t)if(e)b(O[0],t),b(O[1],e),b(O[2],n),b(O[3],a),b(O[4],i),b(O[5],s);else if(k(f,t),u(C,t),"faces"in t){var h=t.faces;for(de(Array.isArray(h)&&6===h.length,"cube faces must be a length 6 array"),c=0;c<6;++c)de("object"==typeof h[c]&&!!h[c],"invalid input for cube map face"),l(O[c],C),b(O[c],h[c])}else for(c=0;c<6;++c)b(O[c],t);else de.raise("invalid arguments to cube map");else{var p=0|t||1;for(c=0;c<6;++c)y(O[c],p,p)}for(l(C,O[0]),f.genMipmaps?C.mipmask=(O[0].width<<1)-1:C.mipmask=O[0].mipmask,de.textureCube(C,f,O,r),C.internalformat=O[0].internalformat,d.width=O[0].width,d.height=O[0].height,E(C),c=0;c<6;++c)x(O[c],ir+c);for(M(f,ar),L(),o.profile&&(C.stats.size=Ct(C.internalformat,C.type,d.width,d.height,f.genMipmaps,!0)),d.format=G[C.internalformat],d.type=q[C.type],d.mag=X[f.magFilter],d.min=Y[f.minFilter],d.wrapS=W[f.wrapS],d.wrapT=W[f.wrapT],c=0;c<6;++c)w(O[c]);return d}function v(t,e,r,n,a){de(!!e,"must specify image data"),de("number"==typeof t&&t===(0|t)&&t>=0&&t<6,"invalid face");var i=0|r,o=0|n,s=0|a,u=g();return l(u,C),u.width=0,u.height=0,h(u,e),u.width=u.width||(C.width>>s)-i,u.height=u.height||(C.height>>s)-o,de(C.type===u.type&&C.format===u.format&&C.internalformat===u.internalformat,"incompatible format for texture.subimage"),de(i>=0&&o>=0&&i+u.width<=C.width&&o+u.height<=C.height,"texture.subimage write out of bounds"),de(C.mipmask&1<>a;++a)t.texImage2D(ir+n,a,C.format,r>>a,r>>a,0,C.format,C.type,null);return L(),o.profile&&(C.stats.size=Ct(C.internalformat,C.type,d.width,d.height,!1,!0)),d}}var C=new T(ar);tt[C.id]=C,i.cubeCount++;var O=new Array(6);return d(e,n,a,s,c,f),d.subimage=v,d.resize=S,d._reglType="textureCube",d._texture=C,o.profile&&(d.stats=C.stats),d.destroy=function(){C.decRef()},d}function I(){for(var e=0;e>r,e.height>>r,0,e.internalformat,e.type,null);else for(var n=0;n<6;++n)t.texImage2D(ir+n,r,e.internalformat,e.width>>r,e.height>>r,0,e.internalformat,e.type,null);M(e.texInfo,e.target)})}var D={"don't care":Jr,"dont care":Jr,nice:en,fast:tn},P={repeat:Hr,clamp:Ur,mirror:Vr},z={nearest:Xr,linear:Yr},N=Jt({mipmap:$r,"nearest mipmap nearest":Wr,"linear mipmap nearest":Zr,"nearest mipmap linear":Qr,"linear mipmap linear":$r},z),F={none:0,browser:ln},B={uint8:Pr,rgba4:pr,rgb565:mr,"rgb5 a1":gr},j={alpha:sr,luminance:ur,"luminance alpha":cr,rgb:lr,rgba:or,rgba4:fr,"rgb5 a1":hr,rgb565:dr},H={};e.ext_srgb&&(j.srgb=xr,j.srgba=_r),e.oes_texture_float&&(B.float32=B.float=Fr),e.oes_texture_half_float&&(B.float16=B["half float"]=wr),e.webgl_depth_texture&&(Jt(j,{depth:yr,"depth stencil":br}),Jt(B,{uint16:zr,uint32:Nr,"depth stencil":vr})),e.webgl_compressed_texture_s3tc&&Jt(H,{"rgb s3tc dxt1":Ar,"rgba s3tc dxt1":kr,"rgba s3tc dxt3":Mr,"rgba s3tc dxt5":Tr}),e.webgl_compressed_texture_atc&&Jt(H,{"rgb atc":Er,"rgba atc explicit alpha":Lr,"rgba atc interpolated alpha":Sr}),e.webgl_compressed_texture_pvrtc&&Jt(H,{"rgb pvrtc 4bppv1":Cr,"rgb pvrtc 2bppv1":Or,"rgba pvrtc 4bppv1":Ir,"rgba pvrtc 2bppv1":Rr}),e.webgl_compressed_texture_etc1&&(H["rgb etc1"]=Dr);var U=Array.prototype.slice.call(t.getParameter(rr));Object.keys(H).forEach(function(t){var e=H[t];U.indexOf(e)>=0&&(j[t]=e)});var V=Object.keys(j);r.textureFormats=V;var G=[];Object.keys(j).forEach(function(t){var e=j[t];G[e]=t});var q=[];Object.keys(B).forEach(function(t){var e=B[t];q[e]=t});var X=[];Object.keys(z).forEach(function(t){var e=z[t];X[e]=t});var Y=[];Object.keys(N).forEach(function(t){var e=N[t];Y[e]=t});var W=[];Object.keys(P).forEach(function(t){var e=P[t];W[e]=t});var Q=V.reduce(function(t,e){var r=j[e];return r===ur||r===sr||r===ur||r===cr||r===yr||r===br?t[r]=r:r===hr||e.indexOf("rgba")>=0?t[r]=or:t[r]=lr,t},{}),$=[],K=[],J=0,tt={},et=r.maxTextureUnits,rt=Array(et).map(function(){return null});return Jt(T.prototype,{bind:function(){var e=this;e.bindCount+=1;var r=e.unit;if(r<0){for(var n=0;n0)continue;a.unit=-1}rt[n]=e,r=n;break}r>=et&&de.raise("insufficient number of texture units"),o.profile&&i.maxTextureUnits=En&&e=2,"invalid shape for framebuffer"),u=I[0],d=I[1]}else"radius"in O&&(u=d=O.radius),"width"in O&&(u=O.width),"height"in O&&(d=O.height);("color"in O||"colors"in O)&&(y=O.color||O.colors,Array.isArray(y)&&de(1===y.length||o,"multiple render targets not supported")),y||("colorCount"in O&&(T=0|O.colorCount,de(T>0,"invalid color buffer count")),"colorTexture"in O&&(b=!!O.colorTexture,x="rgba4"),"colorType"in O&&(M=O.colorType,b?(de(e.oes_texture_float||!("float"===M||"float32"===M),"you must enable OES_texture_float in order to use floating point framebuffer objects"),de(e.oes_texture_half_float||!("half float"===M||"float16"===M),"you must enable OES_texture_half_float in order to use 16-bit floating point framebuffer objects")):"half float"===M||"float16"===M?(de(e.ext_color_buffer_half_float,"you must enable EXT_color_buffer_half_float to use 16-bit render buffers"),x="rgba16f"):"float"!==M&&"float32"!==M||(de(e.webgl_color_buffer_float,"you must enable WEBGL_color_buffer_float in order to use 32-bit floating point renderbuffers"),x="rgba32f"),de.oneOf(M,k,"invalid color type")),"colorFormat"in O&&(x=O.colorFormat,w.indexOf(x)>=0?b=!0:A.indexOf(x)>=0?b=!1:b?de.oneOf(O.colorFormat,w,"invalid color format for texture"):de.oneOf(O.colorFormat,A,"invalid color format for renderbuffer"))),("depthTexture"in O||"depthStencilTexture"in O)&&(C=!(!O.depthTexture&&!O.depthStencilTexture),de(!C||e.webgl_depth_texture,"webgl_depth_texture extension not supported")),"depth"in O&&("boolean"==typeof O.depth?p=O.depth:(E=O.depth,m=!1)),"stencil"in O&&("boolean"==typeof O.stencil?m=O.stencil:(L=O.stencil,p=!1)),"depthStencil"in O&&("boolean"==typeof O.depthStencil?p=m=O.depthStencil:(S=O.depthStencil,p=!1,m=!1))}else u=d=1;var R=null,D=null,P=null,z=null;if(Array.isArray(y))R=y.map(c);else if(y)R=[c(y)];else for(R=new Array(T),i=0;i=0||R[i].renderbuffer&&jn.indexOf(R[i].renderbuffer._renderbuffer.format)>=0,"framebuffer color attachment "+i+" is invalid"),R[i]&&R[i].texture){var F=Pn[R[i].texture._texture.format]*zn[R[i].texture._texture.type];null===N?N=F:de(N===F,"all color attachments much have the same number of bits per pixel.")}return l(D,u,d),de(!D||D.texture&&D.texture._texture.format===Rn||D.renderbuffer&&D.renderbuffer._renderbuffer.format===Nn,"invalid depth attachment for framebuffer object"),l(P,u,d),de(!P||P.renderbuffer&&P.renderbuffer._renderbuffer.format===Fn,"invalid stencil attachment for framebuffer object"),l(z,u,d),de(!z||z.texture&&z.texture._texture.format===Bn||z.renderbuffer&&z.renderbuffer._renderbuffer.format===Bn,"invalid depth-stencil attachment for framebuffer object"),g(s),s.width=u,s.height=d,s.colorAttachments=R,s.depthAttachment=D,s.stencilAttachment=P,s.depthStencilAttachment=z,a.color=R.map(h),a.depth=h(D),a.stencil=h(P),a.depthStencil=h(z),a.width=s.width,a.height=s.height,v(s),a}function o(t,e){de(_.next!==s,"can not resize a framebuffer which is currently in use");var r=0|t,n=0|e||r;if(r===s.width&&n===s.height)return a;for(var i=s.colorAttachments,o=0;o=2,"invalid shape for framebuffer"),de(p[0]===p[1],"cube framebuffer must be square"),l=p[0]}else"radius"in d&&(l=0|d.radius),"width"in d?(l=0|d.width,"height"in d&&de(d.height===l,"must be square")):"height"in d&&(l=0|d.height);("color"in d||"colors"in d)&&(u=d.color||d.colors,Array.isArray(u)&&de(1===u.length||i,"multiple render targets not supported")),u||("colorCount"in d&&(h=0|d.colorCount,de(h>0,"invalid color buffer count")),"colorType"in d&&(de.oneOf(d.colorType,k,"invalid color type"),f=d.colorType),"colorFormat"in d&&(c=d.colorFormat,de.oneOf(d.colorFormat,w,"invalid color format for texture"))),"depth"in d&&(s.depth=d.depth),"stencil"in d&&(s.stencil=d.stencil),"depthStencil"in d&&(s.depthStencil=d.depthStencil)}else l=1;var g;if(u)if(Array.isArray(u))for(g=[],r=0;r0&&(s.depth=o[0].depth,s.stencil=o[0].stencil,s.depthStencil=o[0].depthStencil),o[r]?o[r](s):o[r]=y(s)}return Jt(a,{width:l,height:l,color:g})}function i(t){var e,n=0|t;if(de(n>0&&n<=r.maxCubeMapSize,"invalid radius for cube fbo"),n===a.width)return a;var i=a.color;for(e=0;e1)for(var g=0;gt&&(t=e.stats.uniformsCount)}),t},r.getMaxAttributesCount=function(){var t=0;return d.forEach(function(e){e.stats.attributesCount>t&&(t=e.stats.attributesCount)}),t}),{clear:function(){var e=t.deleteShader.bind(t);xe(c).forEach(e),c={},xe(f).forEach(e),f={},d.forEach(function(e){t.deleteProgram(e.program)}),d.length=0,h={},r.shaderCount=0},program:function(t,e,n){de.command(t>=0,"missing vertex shader",n),de.command(e>=0,"missing fragment shader",n);var a=h[e];a||(a=h[e]={});var i=a[t];return i||(i=new s(e,t),r.shaderCount++,l(i,n),a[t]=i,d.push(i)),i},restore:u,shader:o,frag:-1,vert:-1}}function Nt(t,e,r,n,a,i){function o(o){var s;null===e.next?(de(a.preserveDrawingBuffer,'you must create a webgl context with "preserveDrawingBuffer":true in order to read pixels from the drawing buffer'),s=Wn):(de(null!==e.next.colorAttachments[0].texture,"You cannot read from a renderbuffer"),s=e.next.colorAttachments[0].texture._texture.type,i.oes_texture_float?de(s===Wn||s===Qn,"Reading from a framebuffer is only allowed for the types 'uint8' and 'float'"):de(s===Wn,"Reading from a framebuffer is only allowed for the type 'uint8'"));var l=0,u=0,c=n.framebufferWidth,f=n.framebufferHeight,h=null;Kt(o)?h=o:o&&(de.type(o,"object","invalid arguments to regl.read()"),l=0|o.x,u=0|o.y,de(l>=0&&l=0&&u0&&c+l<=n.framebufferWidth,"invalid width for read pixels"),de(f>0&&f+u<=n.framebufferHeight,"invalid height for read pixels"),r();var d=c*f*4;return h||(s===Wn?h=new Uint8Array(d):s===Qn&&(h=h||new Float32Array(d))),de.isTypedArray(h,"data buffer for regl.read() must be a typedarray"),de(h.byteLength>=d,"data buffer for regl.read() too small"),t.pixelStorei(Zn,4),t.readPixels(l,u,c,f,Yn,s,h),h}function s(t){var r;return e.setFBO({framebuffer:t.framebuffer},function(){r=o(t)}),r}function l(t){return t&&"framebuffer"in t?s(t):o(t)}return l}function Ft(t){return Array.prototype.slice.call(t)}function Bt(t){return Ft(t).join("")}function jt(){function t(t){for(var e=0;e0&&(r.push(t,"="),r.push.apply(r,Ft(arguments)),r.push(";")),t}var r=[],n=[];return Jt(t,{def:e,toString:function(){return Bt([n.length>0?"var "+n+";":"",Bt(r)])}})}function r(){function t(t,e){n(t,e,"=",r.def(t,e),";")}var r=e(),n=e(),a=r.toString,i=n.toString;return Jt(function(){r.apply(r,Ft(arguments))},{def:r.def,entry:r,exit:n,save:t,set:function(e,n,a){t(e,n),r(e,n,"=",a,";")},toString:function(){return a()+i()}})}function n(){var t=Bt(arguments),e=r(),n=r(),a=e.toString,i=n.toString;return Jt(e,{then:function(){return e.apply(e,Ft(arguments)),this},else:function(){return n.apply(n,Ft(arguments)),this},toString:function(){var e=i();return e&&(e="else{"+e+"}"),Bt(["if(",t,"){",a(),"}",e])}})}function a(t,e){function n(){var t="a"+a.length;return a.push(t),t}var a=[];e=e||0;for(var i=0;i=1,n>=2,e)}if(r===ia){var a=t.data;return new Vt(a.thisDep,a.contextDep,a.propDep,e)}return new Vt(r===aa,r===na,r===ra,e)}function Yt(t,e,r,n,a,i,o,s,l,u,c,f,h,d,p){function g(t){return t.replace(".","_")}function m(t,e,r){var n=g(t);et.push(t),tt[n]=J[n]=!!r,rt[n]=e}function v(t,e,r){var n=g(t);et.push(t),Array.isArray(r)?(J[n]=r.slice(),tt[n]=r.slice()):J[n]=tt[n]=r,nt[n]=e}function y(){var t=jt(),r=t.link,n=t.global;t.id=ot++,t.batchId="0";var a=r(at),i=t.shared={props:"a0"};Object.keys(at).forEach(function(t){i[t]=n.def(a,".",t)}),de.optional(function(){t.CHECK=r(de),t.commandStr=de.guessCommand(),t.command=r(t.commandStr),t.assert=function(t,e,n){t("if(!(",e,"))",this.CHECK,".commandRaise(",r(n),",",this.command,");")},it.invalidBlendCombinations=Hi});var o=t.next={},s=t.current={};Object.keys(nt).forEach(function(t){Array.isArray(J[t])&&(o[t]=n.def(i.next,".",t),s[t]=n.def(i.current,".",t))});var l=t.constants={};Object.keys(it).forEach(function(t){l[t]=n.def(JSON.stringify(it[t]))}),t.invoke=function(e,n){switch(n.type){case ea:var a=["this",i.context,i.props,t.batchId];return e.def(r(n.data),".call(",a.slice(0,Math.max(n.data.length+1,4)),")");case ra:return e.def(i.props,n.data);case na:return e.def(i.context,n.data);case aa:return e.def("this",n.data);case ia:return n.data.append(t,e),n.data.ref}},t.attribCache={};var c={};return t.scopeAttrib=function(t){var n=e.id(t);if(n in c)return c[n];var a=u.scope[n];return a||(a=u.scope[n]=new W),c[n]=r(a)},t}function b(t){var e,r=t.static,n=t.dynamic;if(Ra in r){var a=!!r[Ra];e=qt(function(t,e){return a}),e.enable=a}else if(Ra in n){var i=n[Ra];e=Xt(i,function(t,e){return t.invoke(e,i)})}return e}function x(t,e){var r=t.static,n=t.dynamic;if(Da in r){var a=r[Da];return a?(a=s.getFramebuffer(a),de.command(a,"invalid framebuffer object"),qt(function(t,e){var r=t.link(a),n=t.shared;e.set(n.framebuffer,".next",r);var i=n.context;return e.set(i,"."+Ua,r+".width"),e.set(i,"."+Va,r+".height"),r})):qt(function(t,e){var r=t.shared;e.set(r.framebuffer,".next","null");var n=r.context;return e.set(n,"."+Ua,n+"."+Xa),e.set(n,"."+Va,n+"."+Ya),"null"})}if(Da in n){var i=n[Da];return Xt(i,function(t,e){var r=t.invoke(e,i),n=t.shared,a=n.framebuffer,o=e.def(a,".getFramebuffer(",r,")");de.optional(function(){t.assert(e,"!"+r+"||"+o,"invalid framebuffer object")}),e.set(a,".next",o);var s=n.context;return e.set(s,"."+Ua,o+"?"+o+".width:"+s+"."+Xa),e.set(s,"."+Va,o+"?"+o+".height:"+s+"."+Ya),o})}return null}function _(t,e,r){function n(t){if(t in a){var n=a[t];de.commandType(n,"object","invalid "+t,r.commandStr);var o,s,l=!0,u=0|n.x,c=0|n.y;return"width"in n?(o=0|n.width,de.command(o>=0,"invalid "+t,r.commandStr)):l=!1,"height"in n?(s=0|n.height,de.command(s>=0,"invalid "+t,r.commandStr)):l=!1,new Vt(!l&&e&&e.thisDep,!l&&e&&e.contextDep,!l&&e&&e.propDep,function(t,e){var r=t.shared.context,a=o;"width"in n||(a=e.def(r,".",Ua,"-",u));var i=s;return"height"in n||(i=e.def(r,".",Va,"-",c)),[u,c,a,i]})}if(t in i){var f=i[t],h=Xt(f,function(e,r){var n=e.invoke(r,f);de.optional(function(){e.assert(r,n+"&&typeof "+n+'==="object"',"invalid "+t)});var a=e.shared.context,i=r.def(n,".x|0"),o=r.def(n,".y|0"),s=r.def('"width" in ',n,"?",n,".width|0:","(",a,".",Ua,"-",i,")"),l=r.def('"height" in ',n,"?",n,".height|0:","(",a,".",Va,"-",o,")");return de.optional(function(){e.assert(r,s+">=0&&"+l+">=0","invalid "+t)}),[i,o,s,l]});return e&&(h.thisDep=h.thisDep||e.thisDep,h.contextDep=h.contextDep||e.contextDep,h.propDep=h.propDep||e.propDep),h}return e?new Vt(e.thisDep,e.contextDep,e.propDep,function(t,e){var r=t.shared.context;return[0,0,e.def(r,".",Ua),e.def(r,".",Va)]}):null}var a=t.static,i=t.dynamic,o=n(Ia);if(o){var s=o;o=new Vt(o.thisDep,o.contextDep,o.propDep,function(t,e){var r=s.append(t,e),n=t.shared.context;return e.set(n,"."+Ga,r[2]),e.set(n,"."+qa,r[3]),r})}return{viewport:o,scissor_box:n(Oa)}}function w(t){function r(t){if(t in a){var r=e.id(a[t]);de.optional(function(){c.shader(Gi[t],r,de.guessCommand())});var n=qt(function(){return r});return n.id=r,n}if(t in i){var o=i[t];return Xt(o,function(e,r){var n=e.invoke(r,o),a=r.def(e.shared.strings,".id(",n,")");return de.optional(function(){r(e.shared.shader,".shader(",Gi[t],",",a,",",e.command,");")}),a})}return null}var n,a=t.static,i=t.dynamic,o=r(za),s=r(Pa),l=null;return Gt(o)&&Gt(s)?(l=c.program(s.id,o.id),n=qt(function(t,e){return t.link(l)})):n=new Vt(o&&o.thisDep||s&&s.thisDep,o&&o.contextDep||s&&s.contextDep,o&&o.propDep||s&&s.propDep,function(t,e){var r,n=t.shared.shader;r=o?o.append(t,e):e.def(n,".",za);var a;a=s?s.append(t,e):e.def(n,".",Pa);var i=n+".program("+a+","+r;return de.optional(function(){i+=","+t.command}),e.def(i+")")}),{frag:o,vert:s,progVar:n,program:l}}function A(t,e){function r(t,r){if(t in n){var i=0|n[t];return de.command(!r||i>=0,"invalid "+t,e.commandStr),qt(function(t,e){return r&&(t.OFFSET=i),i})}if(t in a){var s=a[t];return Xt(s,function(e,n){var a=e.invoke(n,s);return r&&(e.OFFSET=a,de.optional(function(){e.assert(n,a+">=0","invalid "+t)})),a})}return r&&o?qt(function(t,e){return t.OFFSET="0",0}):null}var n=t.static,a=t.dynamic,o=function(){if(Na in n){var t=n[Na];Ht(t)?t=i.getElements(i.create(t,!0)):t&&(t=i.getElements(t),de.command(t,"invalid elements",e.commandStr));var r=qt(function(e,r){if(t){var n=e.link(t);return e.ELEMENTS=n,n}return e.ELEMENTS=null,null});return r.value=t,r}if(Na in a){var o=a[Na];return Xt(o,function(t,e){var r=t.shared,n=r.isBufferArgs,a=r.elements,i=t.invoke(e,o),s=e.def("null"),l=e.def(n,"(",i,")"),u=t.cond(l).then(s,"=",a,".createStream(",i,");").else(s,"=",a,".getElements(",i,");");return de.optional(function(){t.assert(u.else,"!"+i+"||"+s,"invalid elements")}),e.entry(u),e.exit(t.cond(l).then(a,".destroyStream(",s,");")),t.ELEMENTS=s,s})}return null}(),s=r(ja,!0);return{elements:o,primitive:function(){if(Fa in n){var t=n[Fa];return de.commandParameter(t,je,"invalid primitve",e.commandStr),qt(function(e,r){return je[t]})}if(Fa in a){var r=a[Fa];return Xt(r,function(t,e){var n=t.constants.primTypes,a=t.invoke(e,r);return de.optional(function(){t.assert(e,a+" in "+n,"invalid primitive, must be one of "+Object.keys(je))}),e.def(n,"[",a,"]")})}return o?Gt(o)?qt(o.value?function(t,e){return e.def(t.ELEMENTS,".primType")}:function(){return Mi}):new Vt(o.thisDep,o.contextDep,o.propDep,function(t,e){var r=t.ELEMENTS;return e.def(r,"?",r,".primType:",Mi)}):null}(),count:function(){if(Ba in n){var t=0|n[Ba];return de.command("number"==typeof t&&t>=0,"invalid vertex count",e.commandStr),qt(function(){return t})}if(Ba in a){var r=a[Ba];return Xt(r,function(t,e){var n=t.invoke(e,r);return de.optional(function(){t.assert(e,"typeof "+n+'==="number"&&'+n+">=0&&"+n+"===("+n+"|0)","invalid vertex count")}),n})}if(o){if(Gt(o)){if(o)return s?new Vt(s.thisDep,s.contextDep,s.propDep,function(t,e){var r=e.def(t.ELEMENTS,".vertCount-",t.OFFSET);return de.optional(function(){t.assert(e,r+">=0","invalid vertex offset/element buffer too small")}),r}):qt(function(t,e){return e.def(t.ELEMENTS,".vertCount")});var i=qt(function(){return-1});return de.optional(function(){i.MISSING=!0}),i}var l=new Vt(o.thisDep||s.thisDep,o.contextDep||s.contextDep,o.propDep||s.propDep,function(t,e){var r=t.ELEMENTS;return t.OFFSET?e.def(r,"?",r,".vertCount-",t.OFFSET,":-1"):e.def(r,"?",r,".vertCount:-1")});return de.optional(function(){l.DYNAMIC=!0}),l}return null}(),instances:r(Ha,!1),offset:s}}function k(t,e){var r=t.static,a=t.dynamic,i={};return et.forEach(function(t){function o(e,n){if(t in r){var o=e(r[t]);i[s]=qt(function(){return o})}else if(t in a){var l=a[t];i[s]=Xt(l,function(t,e){return n(t,e,t.invoke(e,l))})}}var s=g(t);switch(t){case ma:case sa:case oa:case Ma:case fa:case Ca:case xa:case wa:case Aa:case pa:return o(function(r){return de.commandType(r,"boolean",t,e.commandStr),r},function(e,r,n){return de.optional(function(){e.assert(r,"typeof "+n+'==="boolean"',"invalid flag "+t,e.commandStr)}),n});case ha:return o(function(r){return de.commandParameter(r,Ui,"invalid "+t,e.commandStr),Ui[r]},function(e,r,n){var a=e.constants.compareFuncs;return de.optional(function(){e.assert(r,n+" in "+a,"invalid "+t+", must be one of "+Object.keys(Ui))}),r.def(a,"[",n,"]")});case da:return o(function(t){return de.command(gt(t)&&2===t.length&&"number"==typeof t[0]&&"number"==typeof t[1]&&t[0]<=t[1],"depth range is 2d array",e.commandStr),t},function(t,e,r){return de.optional(function(){t.assert(e,t.shared.isArrayLike+"("+r+")&&"+r+".length===2&&typeof "+r+'[0]==="number"&&typeof '+r+'[1]==="number"&&'+r+"[0]<="+r+"[1]","depth range must be a 2d array")}),[e.def("+",r,"[0]"),e.def("+",r,"[1]")]});case ca:return o(function(t){de.commandType(t,"object","blend.func",e.commandStr);var r="srcRGB"in t?t.srcRGB:t.src,n="srcAlpha"in t?t.srcAlpha:t.src,a="dstRGB"in t?t.dstRGB:t.dst,i="dstAlpha"in t?t.dstAlpha:t.dst;return de.commandParameter(r,ji,s+".srcRGB",e.commandStr),de.commandParameter(n,ji,s+".srcAlpha",e.commandStr),de.commandParameter(a,ji,s+".dstRGB",e.commandStr),de.commandParameter(i,ji,s+".dstAlpha",e.commandStr),de.command(-1===Hi.indexOf(r+", "+a),"unallowed blending combination (srcRGB, dstRGB) = ("+r+", "+a+")",e.commandStr),[ji[r],ji[a],ji[n],ji[i]]},function(e,r,n){function a(a,o){var s=r.def('"',a,o,'" in ',n,"?",n,".",a,o,":",n,".",a);return de.optional(function(){e.assert(r,s+" in "+i,"invalid "+t+"."+a+o+", must be one of "+Object.keys(ji))}),s}var i=e.constants.blendFuncs;de.optional(function(){e.assert(r,n+"&&typeof "+n+'==="object"',"invalid blend func, must be an object")});var o=a("src","RGB"),s=a("dst","RGB");de.optional(function(){var t=e.constants.invalidBlendCombinations;e.assert(r,t+".indexOf("+o+'+", "+'+s+") === -1 ","unallowed blending combination for (srcRGB, dstRGB)")});var l=r.def(i,"[",o,"]"),u=r.def(i,"[",a("src","Alpha"),"]");return[l,r.def(i,"[",s,"]"),u,r.def(i,"[",a("dst","Alpha"),"]")]});case ua:return o(function(r){return"string"==typeof r?(de.commandParameter(r,Z,"invalid "+t,e.commandStr),[Z[r],Z[r]]):"object"==typeof r?(de.commandParameter(r.rgb,Z,t+".rgb",e.commandStr),de.commandParameter(r.alpha,Z,t+".alpha",e.commandStr),[Z[r.rgb],Z[r.alpha]]):void de.commandRaise("invalid blend.equation",e.commandStr)},function(e,r,n){var a=e.constants.blendEquations,i=r.def(),o=r.def(),s=e.cond("typeof ",n,'==="string"');return de.optional(function(){function r(t,r,n){e.assert(t,n+" in "+a,"invalid "+r+", must be one of "+Object.keys(Z))}r(s.then,t,n),e.assert(s.else,n+"&&typeof "+n+'==="object"',"invalid "+t),r(s.else,t+".rgb",n+".rgb"),r(s.else,t+".alpha",n+".alpha")}),s.then(i,"=",o,"=",a,"[",n,"];"),s.else(i,"=",a,"[",n,".rgb];",o,"=",a,"[",n,".alpha];"),r(s),[i,o]});case la:return o(function(t){return de.command(gt(t)&&4===t.length,"blend.color must be a 4d array",e.commandStr),Q(4,function(e){return+t[e]})},function(t,e,r){return de.optional(function(){t.assert(e,t.shared.isArrayLike+"("+r+")&&"+r+".length===4","blend.color must be a 4d array")}),Q(4,function(t){return e.def("+",r,"[",t,"]")})});case Ta:return o(function(t){return de.commandType(t,"number",s,e.commandStr),0|t},function(t,e,r){return de.optional(function(){t.assert(e,"typeof "+r+'==="number"',"invalid stencil.mask")}),e.def(r,"|0")});case Ea:return o(function(r){de.commandType(r,"object",s,e.commandStr);var n=r.cmp||"keep",a=r.ref||0,i="mask"in r?r.mask:-1;return de.commandParameter(n,Ui,t+".cmp",e.commandStr),de.commandType(a,"number",t+".ref",e.commandStr),de.commandType(i,"number",t+".mask",e.commandStr),[Ui[n],a,i]},function(t,e,r){var n=t.constants.compareFuncs;return de.optional(function(){function a(){t.assert(e,Array.prototype.join.call(arguments,""),"invalid stencil.func")}a(r+"&&typeof ",r,'==="object"'),a('!("cmp" in ',r,")||(",r,".cmp in ",n,")")}),[e.def('"cmp" in ',r,"?",n,"[",r,".cmp]",":",Ri),e.def(r,".ref|0"),e.def('"mask" in ',r,"?",r,".mask|0:-1")]});case La:case Sa:return o(function(r){de.commandType(r,"object",s,e.commandStr);var n=r.fail||"keep",a=r.zfail||"keep",i=r.zpass||"keep";return de.commandParameter(n,Vi,t+".fail",e.commandStr),de.commandParameter(a,Vi,t+".zfail",e.commandStr),de.commandParameter(i,Vi,t+".zpass",e.commandStr),[t===Sa?Ei:Ti,Vi[n],Vi[a],Vi[i]]},function(e,r,n){function a(a){return de.optional(function(){e.assert(r,'!("'+a+'" in '+n+")||("+n+"."+a+" in "+i+")","invalid "+t+"."+a+", must be one of "+Object.keys(Vi))}),r.def('"',a,'" in ',n,"?",i,"[",n,".",a,"]:",Ri)}var i=e.constants.stencilOps;return de.optional(function(){e.assert(r,n+"&&typeof "+n+'==="object"',"invalid "+t)}),[t===Sa?Ei:Ti,a("fail"),a("zfail"),a("zpass")]});case _a:return o(function(t){de.commandType(t,"object",s,e.commandStr);var r=0|t.factor,n=0|t.units;return de.commandType(r,"number",s+".factor",e.commandStr),de.commandType(n,"number",s+".units",e.commandStr),[r,n]},function(e,r,n){return de.optional(function(){e.assert(r,n+"&&typeof "+n+'==="object"',"invalid "+t)}),[r.def(n,".factor|0"),r.def(n,".units|0")]});case va:return o(function(t){var r=0;return"front"===t?r=Ti:"back"===t&&(r=Ei),de.command(!!r,s,e.commandStr),r},function(t,e,r){return de.optional(function(){t.assert(e,r+'==="front"||'+r+'==="back"',"invalid cull.face")}),e.def(r,'==="front"?',Ti,":",Ei)});case ba:return o(function(t){return de.command("number"==typeof t&&t>=n.lineWidthDims[0]&&t<=n.lineWidthDims[1],"invalid line width, must positive number between "+n.lineWidthDims[0]+" and "+n.lineWidthDims[1],e.commandStr),t},function(t,e,r){return de.optional(function(){t.assert(e,"typeof "+r+'==="number"&&'+r+">="+n.lineWidthDims[0]+"&&"+r+"<="+n.lineWidthDims[1],"invalid line width")}),r});case ya:return o(function(t){return de.commandParameter(t,qi,s,e.commandStr),qi[t]},function(t,e,r){return de.optional(function(){t.assert(e,r+'==="cw"||'+r+'==="ccw"',"invalid frontFace, must be one of cw,ccw")}),e.def(r+'==="cw"?'+Li+":"+Si)});case ga:return o(function(t){return de.command(gt(t)&&4===t.length,"color.mask must be length 4 array",e.commandStr),t.map(function(t){return!!t})},function(t,e,r){return de.optional(function(){t.assert(e,t.shared.isArrayLike+"("+r+")&&"+r+".length===4","invalid color.mask")}),Q(4,function(t){return"!!"+r+"["+t+"]"})});case ka:return o(function(t){de.command("object"==typeof t&&t,s,e.commandStr);var r="value"in t?t.value:1,n=!!t.invert;return de.command("number"==typeof r&&r>=0&&r<=1,"sample.coverage.value must be a number between 0 and 1",e.commandStr),[r,n]},function(t,e,r){return de.optional(function(){t.assert(e,r+"&&typeof "+r+'==="object"',"invalid sample.coverage")}),[e.def('"value" in ',r,"?+",r,".value:1"),e.def("!!",r,".invert")]})}}),i}function M(t,e){var r=t.static,n=t.dynamic,a={};return Object.keys(r).forEach(function(t){var n,i=r[t];if("number"==typeof i||"boolean"==typeof i)n=qt(function(){return i});else if("function"==typeof i){var o=i._reglType;"texture2d"===o||"textureCube"===o?n=qt(function(t){return t.link(i)}):"framebuffer"===o||"framebufferCube"===o?(de.command(i.color.length>0,'missing color attachment for framebuffer sent to uniform "'+t+'"',e.commandStr),n=qt(function(t){return t.link(i.color[0])})):de.commandRaise('invalid data for uniform "'+t+'"',e.commandStr)}else gt(i)?n=qt(function(e){return e.global.def("[",Q(i.length,function(r){return de.command("number"==typeof i[r]||"boolean"==typeof i[r],"invalid uniform "+t,e.commandStr),i[r]}),"]")}):de.commandRaise('invalid or missing data for uniform "'+t+'"',e.commandStr);n.value=i,a[t]=n}),Object.keys(n).forEach(function(t){var e=n[t];a[t]=Xt(e,function(t,r){return t.invoke(r,e)})}),a}function T(t,r){var n=t.static,i=t.dynamic,o={};return Object.keys(n).forEach(function(t){var i=n[t],s=e.id(t),l=new W;if(Ht(i))l.state=Jn,l.buffer=a.getBuffer(a.create(i,Za,!1,!0)),l.type=0;else{var u=a.getBuffer(i);if(u)l.state=Jn,l.buffer=u,l.type=0;else if(de.command("object"==typeof i&&i,"invalid data for attribute "+t,r.commandStr),i.constant){var c=i.constant;l.buffer="null",l.state=ta,"number"==typeof c?l.x=c:(de.command(gt(c)&&c.length>0&&c.length<=4,"invalid constant for attribute "+t,r.commandStr),$n.forEach(function(t,e){e=0,'invalid offset for attribute "'+t+'"',r.commandStr);var h=0|i.stride;de.command(h>=0&&h<256,'invalid stride for attribute "'+t+'", must be integer betweeen [0, 255]',r.commandStr);var d=0|i.size;de.command(!("size"in i)||d>0&&d<=4,'invalid size for attribute "'+t+'", must be 1,2,3,4',r.commandStr);var p=!!i.normalized,g=0;"type"in i&&(de.commandParameter(i.type,Oe,"invalid type for attribute "+t,r.commandStr),g=Oe[i.type]);var m=0|i.divisor;"divisor"in i&&(de.command(0===m||$,'cannot specify divisor for attribute "'+t+'", instancing not supported',r.commandStr),de.command(m>=0,'invalid divisor for attribute "'+t+'"',r.commandStr)),de.optional(function(){var e=r.commandStr,n=["buffer","offset","divisor","normalized","type","size","stride"];Object.keys(i).forEach(function(r){de.command(n.indexOf(r)>=0,'unknown parameter "'+r+'" for attribute pointer "'+t+'" (valid parameters are '+n+")",e)})}),l.buffer=u,l.state=Jn,l.size=d,l.normalized=p,l.type=g||u.dtype,l.offset=f,l.stride=h,l.divisor=m}}o[t]=qt(function(t,e){var r=t.attribCache;if(s in r)return r[s];var n={isStream:!1};return Object.keys(l).forEach(function(t){n[t]=l[t]}),l.buffer&&(n.buffer=t.link(l.buffer),n.type=n.type||n.buffer+".dtype"),r[s]=n,n})}),Object.keys(i).forEach(function(t){function e(e,n){function a(t){n(u[t],"=",i,".",t,"|0;")}var i=e.invoke(n,r),o=e.shared,s=o.isBufferArgs,l=o.buffer;de.optional(function(){ -e.assert(n,i+"&&(typeof "+i+'==="object"||typeof '+i+'==="function")&&('+s+"("+i+")||"+l+".getBuffer("+i+")||"+l+".getBuffer("+i+".buffer)||"+s+"("+i+'.buffer)||("constant" in '+i+"&&(typeof "+i+'.constant==="number"||'+o.isArrayLike+"("+i+".constant))))",'invalid dynamic attribute "'+t+'"')});var u={isStream:n.def(!1)},c=new W;c.state=Jn,Object.keys(c).forEach(function(t){u[t]=n.def(""+c[t])});var f=u.buffer,h=u.type;return n("if(",s,"(",i,")){",u.isStream,"=true;",f,"=",l,".createStream(",Za,",",i,");",h,"=",f,".dtype;","}else{",f,"=",l,".getBuffer(",i,");","if(",f,"){",h,"=",f,".dtype;",'}else if("constant" in ',i,"){",u.state,"=",ta,";","if(typeof "+i+'.constant === "number"){',u[$n[0]],"=",i,".constant;",$n.slice(1).map(function(t){return u[t]}).join("="),"=0;","}else{",$n.map(function(t,e){return u[t]+"="+i+".constant.length>="+e+"?"+i+".constant["+e+"]:0;"}).join(""),"}}else{","if(",s,"(",i,".buffer)){",f,"=",l,".createStream(",Za,",",i,".buffer);","}else{",f,"=",l,".getBuffer(",i,".buffer);","}",h,'="type" in ',i,"?",o.glTypes,"[",i,".type]:",f,".dtype;",u.normalized,"=!!",i,".normalized;"),a("size"),a("offset"),a("stride"),a("divisor"),n("}}"),n.exit("if(",u.isStream,"){",l,".destroyStream(",f,");","}"),u}var r=i[t];o[t]=Xt(r,e)}),o}function E(t){var e=t.static,r=t.dynamic,n={};return Object.keys(e).forEach(function(t){var r=e[t];n[t]=qt(function(t,e){return"number"==typeof r||"boolean"==typeof r?""+r:t.link(r)})}),Object.keys(r).forEach(function(t){var e=r[t];n[t]=Xt(e,function(t,r){return t.invoke(r,e)})}),n}function L(t,e,r,n,a){function i(t){var e=u[t];e&&(f[t]=e)}var o=t.static,s=t.dynamic;de.optional(function(){function t(t){Object.keys(t).forEach(function(t){de.command(e.indexOf(t)>=0,'unknown parameter "'+t+'"',a.commandStr)})}var e=[Da,Pa,za,Na,Fa,ja,Ba,Ha,Ra].concat(et);t(o),t(s)});var l=x(t,a),u=_(t,l,a),c=A(t,a),f=k(t,a),h=w(t,a);i(Ia),i(g(Oa));var d=Object.keys(f).length>0,p={framebuffer:l,draw:c,shader:h,state:f,dirty:d};return p.profile=b(t,a),p.uniforms=M(r,a),p.attributes=T(e,a),p.context=E(n,a),p}function S(t,e,r){var n=t.shared,a=n.context,i=t.scope();Object.keys(r).forEach(function(n){e.save(a,"."+n);var o=r[n];i(a,".",n,"=",o.append(t,e),";")}),e(i)}function C(t,e,r,n){var a,i=t.shared,o=i.gl,s=i.framebuffer;K&&(a=e.def(i.extensions,".webgl_draw_buffers"));var l,u=t.constants,c=u.drawBuffer,f=u.backBuffer;l=r?r.append(t,e):e.def(s,".next"),n||e("if(",l,"!==",s,".cur){"),e("if(",l,"){",o,".bindFramebuffer(",Fi,",",l,".framebuffer);"),K&&e(a,".drawBuffersWEBGL(",c,"[",l,".colorAttachments.length]);"),e("}else{",o,".bindFramebuffer(",Fi,",null);"),K&&e(a,".drawBuffersWEBGL(",f,");"),e("}",s,".cur=",l,";"),n||e("}")}function O(t,e,r){var n=t.shared,a=n.gl,i=t.current,o=t.next,s=n.current,l=n.next,u=t.cond(s,".dirty");et.forEach(function(e){var n=g(e);if(!(n in r.state)){var c,f;if(n in o){c=o[n],f=i[n];var h=Q(J[n].length,function(t){return u.def(c,"[",t,"]")});u(t.cond(h.map(function(t,e){return t+"!=="+f+"["+e+"]"}).join("||")).then(a,".",nt[n],"(",h,");",h.map(function(t,e){return f+"["+e+"]="+t}).join(";"),";"))}else{c=u.def(l,".",n);var d=t.cond(c,"!==",s,".",n);u(d),n in rt?d(t.cond(c).then(a,".enable(",rt[n],");").else(a,".disable(",rt[n],");"),s,".",n,"=",c,";"):d(a,".",nt[n],"(",c,");",s,".",n,"=",c,";")}}}),0===Object.keys(r.state).length&&u(s,".dirty=false;"),e(u)}function I(t,e,r,n){var a=t.shared,i=t.current,o=a.current,s=a.gl;Ut(Object.keys(r)).forEach(function(a){var l=r[a];if(!n||n(l)){var u=l.append(t,e);if(rt[a]){var c=rt[a];Gt(l)?u?e(s,".enable(",c,");"):e(s,".disable(",c,");"):e(t.cond(u).then(s,".enable(",c,");").else(s,".disable(",c,");")),e(o,".",a,"=",u,";")}else if(gt(u)){var f=i[a];e(s,".",nt[a],"(",u,");",u.map(function(t,e){return f+"["+e+"]="+t}).join(";"),";")}else e(s,".",nt[a],"(",u,");",o,".",a,"=",u,";")}})}function R(t,e){$&&(t.instancing=e.def(t.shared.extensions,".angle_instanced_arrays"))}function D(t,e,r,n,a){function i(){return"undefined"==typeof performance?"Date.now()":"performance.now()"}function o(t){u=e.def(),t(u,"=",i(),";"),"string"==typeof a?t(p,".count+=",a,";"):t(p,".count++;"),d&&(n?(c=e.def(),t(c,"=",m,".getNumPendingQueries();")):t(m,".beginQuery(",p,");"))}function s(t){t(p,".cpuTime+=",i(),"-",u,";"),d&&(n?t(m,".pushScopeStats(",c,",",m,".getNumPendingQueries(),",p,");"):t(m,".endQuery();"))}function l(t){var r=e.def(g,".profile");e(g,".profile=",t,";"),e.exit(g,".profile=",r,";")}var u,c,f,h=t.shared,p=t.stats,g=h.current,m=h.timer,v=r.profile;if(v){if(Gt(v))return void(v.enable?(o(e),s(e.exit),l("true")):l("false"));f=v.append(t,e),l(f)}else f=e.def(g,".profile");var y=t.block();o(y),e("if(",f,"){",y,"}");var b=t.block();s(b),e.exit("if(",f,"){",b,"}")}function P(t,e,r,n,a){function i(t){switch(t){case ui:case di:case vi:return 2;case ci:case pi:case yi:return 3;case fi:case gi:case bi:return 4;default:return 1}}function o(r,n,a){function i(){e("if(!",c,".buffer){",l,".enableVertexAttribArray(",u,");}");var r,i=a.type;if(r=a.size?e.def(a.size,"||",n):n,e("if(",c,".type!==",i,"||",c,".size!==",r,"||",p.map(function(t){return c+"."+t+"!=="+a[t]}).join("||"),"){",l,".bindBuffer(",Za,",",h,".buffer);",l,".vertexAttribPointer(",[u,r,i,a.normalized,a.stride,a.offset],");",c,".type=",i,";",c,".size=",r,";",p.map(function(t){return c+"."+t+"="+a[t]+";"}).join(""),"}"),$){var o=a.divisor;e("if(",c,".divisor!==",o,"){",t.instancing,".vertexAttribDivisorANGLE(",[u,o],");",c,".divisor=",o,";}")}}function o(){e("if(",c,".buffer){",l,".disableVertexAttribArray(",u,");","}if(",$n.map(function(t,e){return c+"."+t+"!=="+d[e]}).join("||"),"){",l,".vertexAttrib4f(",u,",",d,");",$n.map(function(t,e){return c+"."+t+"="+d[e]+";"}).join(""),"}")}var l=s.gl,u=e.def(r,".location"),c=e.def(s.attributes,"[",u,"]"),f=a.state,h=a.buffer,d=[a.x,a.y,a.z,a.w],p=["buffer","normalized","offset","stride"];f===Jn?i():f===ta?o():(e("if(",f,"===",Jn,"){"),i(),e("}else{"),o(),e("}"))}var s=t.shared;n.forEach(function(n){var s,l=n.name,u=r.attributes[l];if(u){if(!a(u))return;s=u.append(t,e)}else{if(!a(Xi))return;var c=t.scopeAttrib(l);de.optional(function(){t.assert(e,c+".state","missing attribute "+l)}),s={},Object.keys(new W).forEach(function(t){s[t]=e.def(c,".",t)})}o(t.link(n),i(n.info.type),s)})}function z(t,r,n,a,i){for(var o,s=t.shared,l=s.gl,u=0;u1?Q(_,function(t){return c+"["+t+"]"}):c);r(");")}}function N(t,e,r,n){function a(a){var i=c[a];return i?i.contextDep&&n.contextDynamic||i.propDep?i.append(t,r):i.append(t,e):e.def(u,".",a)}function i(){function t(){r(m,".drawElementsInstancedANGLE(",[h,p,v,d+"<<(("+v+"-"+Kn+")>>1)",g],");")}function e(){r(m,".drawArraysInstancedANGLE(",[h,d,p,g],");")}f?y?t():(r("if(",f,"){"),t(),r("}else{"),e(),r("}")):e()}function o(){function t(){r(l+".drawElements("+[h,p,v,d+"<<(("+v+"-"+Kn+")>>1)"]+");")}function e(){r(l+".drawArrays("+[h,d,p]+");")}f?y?t():(r("if(",f,"){"),t(),r("}else{"),e(),r("}")):e()}var s=t.shared,l=s.gl,u=s.draw,c=n.draw,f=function(){var a,i=c.elements,o=e;return i?((i.contextDep&&n.contextDynamic||i.propDep)&&(o=r),a=i.append(t,o)):a=o.def(u,".",Na),a&&o("if("+a+")"+l+".bindBuffer("+Qa+","+a+".buffer.buffer);"),a}(),h=a(Fa),d=a(ja),p=function(){var a,i=c.count,o=e;return i?((i.contextDep&&n.contextDynamic||i.propDep)&&(o=r),a=i.append(t,o),de.optional(function(){i.MISSING&&t.assert(e,"false","missing vertex count"),i.DYNAMIC&&t.assert(o,a+">=0","missing vertex count")})):(a=o.def(u,".",Ba),de.optional(function(){t.assert(o,a+">=0","missing vertex count")})),a}();if("number"==typeof p){if(0===p)return}else r("if(",p,"){"),r.exit("}");var g,m;$&&(g=a(Ha),m=t.instancing);var v=f+".type",y=c.elements&&Gt(c.elements);$&&("number"!=typeof g||g>=0)?"string"==typeof g?(r("if(",g,">0){"),i(),r("}else if(",g,"<0){"),o(),r("}")):i():o()}function F(t,e,r,n,a){var i=y(),o=i.proc("body",a);return de.optional(function(){i.commandStr=e.commandStr,i.command=i.link(e.commandStr)}),$&&(i.instancing=o.def(i.shared.extensions,".angle_instanced_arrays")),t(i,o,r,n),i.compile().body}function B(t,e,r,n){R(t,e),P(t,e,r,n.attributes,function(){return!0}),z(t,e,r,n.uniforms,function(){return!0}),N(t,e,e,r)}function j(t,e){var r=t.proc("draw",1);R(t,r),S(t,r,e.context),C(t,r,e.framebuffer),O(t,r,e),I(t,r,e.state),D(t,r,e,!1,!0);var n=e.shader.progVar.append(t,r);if(r(t.shared.gl,".useProgram(",n,".program);"),e.shader.program)B(t,r,e,e.shader.program);else{var a=t.global.def("{}"),i=r.def(n,".id"),o=r.def(a,"[",i,"]");r(t.cond(o).then(o,".call(this,a0);").else(o,"=",a,"[",i,"]=",t.link(function(r){return F(B,t,e,r,1)}),"(",n,");",o,".call(this,a0);"))}Object.keys(e.state).length>0&&r(t.shared.current,".dirty=true;")}function H(t,e,r,n){function a(){return!0}t.batchId="a1",R(t,e),P(t,e,r,n.attributes,a),z(t,e,r,n.uniforms,a),N(t,e,e,r)}function U(t,e,r,n){function a(t){return t.contextDep&&o||t.propDep}function i(t){return!a(t)}R(t,e);var o=r.contextDep,s=e.def(),l=e.def();t.shared.props=l,t.batchId=s;var u=t.scope(),c=t.scope();if(e(u.entry,"for(",s,"=0;",s,"<","a1",";++",s,"){",l,"=","a0","[",s,"];",c,"}",u.exit),r.needsContext&&S(t,c,r.context),r.needsFramebuffer&&C(t,c,r.framebuffer),I(t,c,r.state,a),r.profile&&a(r.profile)&&D(t,c,r,!1,!0),n)P(t,u,r,n.attributes,i),P(t,c,r,n.attributes,a),z(t,u,r,n.uniforms,i),z(t,c,r,n.uniforms,a),N(t,u,c,r);else{var f=t.global.def("{}"),h=r.shader.progVar.append(t,c),d=c.def(h,".id"),p=c.def(f,"[",d,"]");c(t.shared.gl,".useProgram(",h,".program);","if(!",p,"){",p,"=",f,"[",d,"]=",t.link(function(e){return F(H,t,r,e,2)}),"(",h,");}",p,".call(this,a0[",s,"],",s,");")}}function V(t,e){function r(t){return t.contextDep&&a||t.propDep}var n=t.proc("batch",2);t.batchId="0",R(t,n);var a=!1,i=!0;Object.keys(e.context).forEach(function(t){a=a||e.context[t].propDep}),a||(S(t,n,e.context),i=!1);var o=e.framebuffer,s=!1;o?(o.propDep?a=s=!0:o.contextDep&&a&&(s=!0),s||C(t,n,o)):C(t,n,null),e.state.viewport&&e.state.viewport.propDep&&(a=!0),O(t,n,e),I(t,n,e.state,function(t){return!r(t)}),e.profile&&r(e.profile)||D(t,n,e,!1,"a1"),e.contextDep=a,e.needsContext=i,e.needsFramebuffer=s;var l=e.shader.progVar;if(l.contextDep&&a||l.propDep)U(t,n,e,null);else{var u=l.append(t,n);if(n(t.shared.gl,".useProgram(",u,".program);"),e.shader.program)U(t,n,e,e.shader.program);else{var c=t.global.def("{}"),f=n.def(u,".id"),h=n.def(c,"[",f,"]");n(t.cond(h).then(h,".call(this,a0,a1);").else(h,"=",c,"[",f,"]=",t.link(function(r){return F(U,t,e,r,2)}),"(",u,");",h,".call(this,a0,a1);"))}}Object.keys(e.state).length>0&&n(t.shared.current,".dirty=true;")}function G(t,r){function n(e){var n=r.shader[e];n&&a.set(i.shader,"."+e,n.append(t,a))}var a=t.proc("scope",3);t.batchId="a2";var i=t.shared,o=i.current;S(t,a,r.context),r.framebuffer&&r.framebuffer.append(t,a),Ut(Object.keys(r.state)).forEach(function(e){var n=r.state[e],o=n.append(t,a);gt(o)?o.forEach(function(r,n){a.set(t.next[e],"["+n+"]",r)}):a.set(i.next,"."+e,o)}),D(t,a,r,!0,!0),[Na,ja,Ba,Ha,Fa].forEach(function(e){var n=r.draw[e];n&&a.set(i.draw,"."+e,""+n.append(t,a))}),Object.keys(r.uniforms).forEach(function(n){a.set(i.uniforms,"["+e.id(n)+"]",r.uniforms[n].append(t,a))}),Object.keys(r.attributes).forEach(function(e){var n=r.attributes[e].append(t,a),i=t.scopeAttrib(e);Object.keys(new W).forEach(function(t){a.set(i,"."+t,n[t])})}),n(Pa),n(za),Object.keys(r.state).length>0&&(a(o,".dirty=true;"),a.exit(o,".dirty=true;")),a("a1(",t.shared.context,",a0,",t.batchId,");")}function q(t){if("object"==typeof t&&!gt(t)){for(var e=Object.keys(t),r=0;r=0;--t){var r=G[t];r&&r(L,null,0)}v.flush(),k&&k.update()}function r(){!Q&&G.length>0&&(Q=ve.next(e))}function n(){Q&&(ve.cancel(e),Q=null)}function a(t){t.preventDefault(),b=!0,n(),q.forEach(function(t){t()})}function i(t){v.getError(),b=!1,x.restore(),P.restore(),I.restore(),z.restore(),N.restore(),F.restore(),k&&k.restore(),B.procs.refresh(),r(),X.forEach(function(t){t()})}function o(){G.length=0,n(),V&&(V.removeEventListener(eo,a),V.removeEventListener(ro,i)),P.clear(),F.clear(),N.clear(),z.clear(),R.clear(),I.clear(),k&&k.clear(),Z.forEach(function(t){t()})}function s(t){function e(t){var e={},r={};return Object.keys(t).forEach(function(n){var a=t[n];me.isDynamic(a)?r[n]=me.unbox(a,n):e[n]=a}),{dynamic:r,static:e}}function r(t){for(;d.length0)return f.call(this,r(0|t),0|t)}else{if(!Array.isArray(t))return c.call(this,t);if(t.length)return f.call(this,t,t.length)}}de(!!t,"invalid args to regl({...})"),de.type(t,"object","invalid args to regl({...})");var a=e(t.context||{}),i=e(t.uniforms||{}),o=e(t.attributes||{}),s=e(function(t){function e(t){if(t in r){var e=r[t];delete r[t],Object.keys(e).forEach(function(n){r[t+"."+n]=e[n]})}}var r=Jt({},t);return delete r.uniforms,delete r.attributes,delete r.context,"stencil"in r&&r.stencil.op&&(r.stencil.opBack=r.stencil.opFront=r.stencil.op,delete r.stencil.op),e("blend"),e("depth"),e("cull"),e("stencil"),e("polygonOffset"),e("scissor"),e("sample"),r}(t)),l={gpuTime:0,cpuTime:0,count:0},u=B.compile(s,o,i,a,l),c=u.draw,f=u.batch,h=u.scope,d=[];return Jt(n,{stats:l})}function l(t,e){var r=0;B.procs.poll();var n=e.color;n&&(v.clearColor(+n[0]||0,+n[1]||0,+n[2]||0,+n[3]||0),r|=$i),"depth"in e&&(v.clearDepth(+e.depth),r|=Ki),"stencil"in e&&(v.clearStencil(0|e.stencil),r|=Ji),de(!!r,"called regl.clear with no buffer specified"),v.clear(r)}function u(t){if(de("object"==typeof t&&t,"regl.clear() takes an object as input"),"framebuffer"in t)if(t.framebuffer&&"framebufferCube"===t.framebuffer_reglType)for(var e=0;e<6;++e)$(Jt({framebuffer:t.framebuffer.faces[e]},t),l);else $(t,l);else l(null,t)}function c(t){function e(){function e(){var t=Zt(G,e);G[t]=G[G.length-1],G.length-=1,G.length<=0&&n()}var r=Zt(G,t);de(r>=0,"cannot cancel a frame twice"),G[r]=e}return de.type(t,"function","regl.frame() callback must be a function"),G.push(t),r(),{cancel:e}}function f(){var t=U.viewport,e=U.scissor_box;t[0]=t[1]=e[0]=e[1]=0,L.viewportWidth=L.framebufferWidth=L.drawingBufferWidth=t[2]=e[2]=v.drawingBufferWidth,L.viewportHeight=L.framebufferHeight=L.drawingBufferHeight=t[3]=e[3]=v.drawingBufferHeight}function h(){L.tick+=1,L.time=p(),f(),B.procs.poll()}function d(){f(),B.procs.refresh(),k&&k.update()}function p(){return(ye()-M)/1e3}function g(t,e){de.type(e,"function","listener callback must be a function");var r;switch(t){case"frame":return c(e);case"lost":r=q;break;case"restore":r=X;break;case"destroy":r=Z;break;default:de.raise("invalid event, must be one of frame,lost,restore,destroy")}return r.push(e),{cancel:function(){for(var t=0;t=0},read:H,destroy:o,_gl:v,_refresh:d,poll:function(){h(),k&&k.update()},now:p,stats:w});return m.onDone(null,K),K}var $t={"[object Int8Array]":5120,"[object Int16Array]":5122,"[object Int32Array]":5124,"[object Uint8Array]":5121,"[object Uint8ClampedArray]":5121,"[object Uint16Array]":5123,"[object Uint32Array]":5125,"[object Float32Array]":5126,"[object Float64Array]":5121,"[object ArrayBuffer]":5121},Kt=function(t){return Object.prototype.toString.call(t)in $t},Jt=function(t,e){for(var r=Object.keys(e),n=0;n=2,"invalid renderbuffer shape"),i=0|d[0],o=0|d[1]}else"radius"in h&&(i=o=0|h.radius),"width"in h&&(i=0|h.width),"height"in h&&(o=0|h.height);"format"in h&&(de.parameter(h.format,u,"invalid renderbuffer format"),l=u[h.format])}else"number"==typeof e?(i=0|e,o="number"==typeof n?0|n:i):e?de.raise("invalid arguments to renderbuffer constructor"):i=o=1;if(de(i>0&&o>0&&i<=r.maxRenderbufferSize&&o<=r.maxRenderbufferSize,"invalid renderbuffer size"),i!==f.width||o!==f.height||l!==f.format)return s.width=f.width=i,s.height=f.height=o,f.format=l,t.bindRenderbuffer(xn,f.renderbuffer),t.renderbufferStorage(xn,l,i,o),a.profile&&(f.stats.size=It(f.format,f.width,f.height)),s.format=c[f.format],s}function l(e,n){var i=0|e,o=0|n||i;return i===f.width&&o===f.height?s:(de(i>0&&o>0&&i<=r.maxRenderbufferSize&&o<=r.maxRenderbufferSize,"invalid renderbuffer size"),s.width=f.width=i,s.height=f.height=o,t.bindRenderbuffer(xn,f.renderbuffer),t.renderbufferStorage(xn,f.format,i,o),a.profile&&(f.stats.size=It(f.format,f.width,f.height)),s)}var f=new i(t.createRenderbuffer());return h[f.id]=f,n.renderbufferCount++,s(e,o),s.resize=l,s._reglType="renderbuffer",s._renderbuffer=f,a.profile&&(s.stats=f.stats),s.destroy=function(){f.decRef()},s}function l(){xe(h).forEach(function(e){e.renderbuffer=t.createRenderbuffer(),t.bindRenderbuffer(xn,e.renderbuffer),t.renderbufferStorage(xn,e.format,e.width,e.height)}),t.bindRenderbuffer(xn,null)}var u={rgba4:_n,rgb565:36194,"rgb5 a1":32855,depth:33189,stencil:36168,"depth stencil":34041};e.ext_srgb&&(u.srgba=35907),e.ext_color_buffer_half_float&&(u.rgba16f=34842,u.rgb16f=34843),e.webgl_color_buffer_float&&(u.rgba32f=34836);var c=[];Object.keys(u).forEach(function(t){var e=u[t];c[e]=t});var f=0,h={};return i.prototype.decRef=function(){--this.refCount<=0&&o(this)},a.profile&&(n.getTotalRenderbufferSize=function(){var t=0;return Object.keys(h).forEach(function(e){t+=h[e].stats.size}),t}),{create:s,clear:function(){xe(h).forEach(o)},restore:l}},kn=36160,Mn=36161,Tn=3553,En=34069,Ln=36064,Sn=36096,Cn=36128,On=33306,In=36053,Rn=6402,Dn=[6408],Pn=[];Pn[6408]=4;var zn=[];zn[5121]=1,zn[5126]=4,zn[36193]=2;var Nn=33189,Fn=36168,Bn=34041,jn=[32854,32855,36194,35907,34842,34843,34836],Hn={};Hn[In]="complete",Hn[36054]="incomplete attachment",Hn[36057]="incomplete dimensions",Hn[36055]="incomplete, missing attachment",Hn[36061]="unsupported" -;var Un=5126,Vn=35632,Gn=35633,qn=35718,Xn=35721,Yn=6408,Wn=5121,Zn=3333,Qn=5126,$n="xyzw".split(""),Kn=5121,Jn=1,ta=2,ea=0,ra=1,na=2,aa=3,ia=4,oa="dither",sa="blend.enable",la="blend.color",ua="blend.equation",ca="blend.func",fa="depth.enable",ha="depth.func",da="depth.range",pa="depth.mask",ga="colorMask",ma="cull.enable",va="cull.face",ya="frontFace",ba="lineWidth",xa="polygonOffset.enable",_a="polygonOffset.offset",wa="sample.alpha",Aa="sample.enable",ka="sample.coverage",Ma="stencil.enable",Ta="stencil.mask",Ea="stencil.func",La="stencil.opFront",Sa="stencil.opBack",Ca="scissor.enable",Oa="scissor.box",Ia="viewport",Ra="profile",Da="framebuffer",Pa="vert",za="frag",Na="elements",Fa="primitive",Ba="count",ja="offset",Ha="instances",Ua=Da+"Width",Va=Da+"Height",Ga=Ia+"Width",qa=Ia+"Height",Xa="drawingBufferWidth",Ya="drawingBufferHeight",Wa=[ca,ua,Ea,La,Sa,ka,Ia,Oa,_a],Za=34962,Qa=34963,$a=3553,Ka=34067,Ja=2884,ti=3042,ei=3024,ri=2960,ni=2929,ai=3089,ii=32823,oi=32926,si=32928,li=5126,ui=35664,ci=35665,fi=35666,hi=5124,di=35667,pi=35668,gi=35669,mi=35670,vi=35671,yi=35672,bi=35673,xi=35674,_i=35675,wi=35676,Ai=35678,ki=35680,Mi=4,Ti=1028,Ei=1029,Li=2304,Si=2305,Ci=32775,Oi=32776,Ii=519,Ri=7680,Di=0,Pi=1,zi=32774,Ni=513,Fi=36160,Bi=36064,ji={0:0,1:1,zero:0,one:1,"src color":768,"one minus src color":769,"src alpha":770,"one minus src alpha":771,"dst color":774,"one minus dst color":775,"dst alpha":772,"one minus dst alpha":773,"constant color":32769,"one minus constant color":32770,"constant alpha":32771,"one minus constant alpha":32772,"src alpha saturate":776},Hi=["constant color, constant alpha","one minus constant color, constant alpha","constant color, one minus constant alpha","one minus constant color, one minus constant alpha","constant alpha, constant color","constant alpha, one minus constant color","one minus constant alpha, constant color","one minus constant alpha, one minus constant color"],Ui={never:512,less:513,"<":513,equal:514,"=":514,"==":514,"===":514,lequal:515,"<=":515,greater:516,">":516,notequal:517,"!=":517,"!==":517,gequal:518,">=":518,always:519},Vi={0:0,zero:0,keep:7680,replace:7681,increment:7682,decrement:7683,"increment wrap":34055,"decrement wrap":34056,invert:5386},Gi={frag:35632,vert:35633},qi={cw:Li,ccw:Si},Xi=new Vt(!1,!1,!1,function(){}),Yi=34918,Wi=34919,Zi=35007,Qi=function(t,e){function r(){return h.pop()||f.createQueryEXT()}function n(t){h.push(t)}function a(t){var e=r();f.beginQueryEXT(Zi,e),d.push(e),u(d.length-1,d.length,t)}function i(){f.endQueryEXT(Zi)}function o(){this.startQueryIndex=-1,this.endQueryIndex=-1,this.sum=0,this.stats=null}function s(){return p.pop()||new o}function l(t){p.push(t)}function u(t,e,r){var n=s();n.startQueryIndex=t,n.endQueryIndex=e,n.sum=0,n.stats=r,g.push(n)}function c(){var t,e,r=d.length;if(0!==r){v.length=Math.max(v.length,r+1),m.length=Math.max(m.length,r+1),m[0]=0,v[0]=0;var a=0;for(t=0,e=0;e=r)return i.substr(0,r);for(;r>i.length&&e>1;)1&e&&(i+=t),e>>=1,t+=t;return i+=t,i=i.substr(0,r)}var a,i="";e.exports=n},{}],181:[function(t,e,r){"use strict";function n(t,e){for(var r=new Array(t.length-1),n=1;n>1;return["sum(",i(t.slice(0,e)),",",i(t.slice(e)),")"].join("")}function o(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 o(e,t)}function s(t){return!0&t?"-":""}function l(t){if(2===t.length)return[["diff(",o(t[0][0],t[1][1]),",",o(t[1][0],t[0][1]),")"].join("")];for(var e=[],r=0;r>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;r0){if(i<=0)return o;n=a+i}else{if(!(a<0))return o;if(i>=0)return o;n=-(a+i)}var s=3.3306690738754716e-16*n;return o>=s||o<=-s?o:g(t,e,r)},function(t,e,r,n){var a=t[0]-n[0],i=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=i*u,p=o*l,g=o*s,v=a*u,y=a*l,b=i*s,x=c*(d-p)+f*(g-v)+h*(y-b),_=(Math.abs(d)+Math.abs(p))*Math.abs(c)+(Math.abs(g)+Math.abs(v))*Math.abs(f)+(Math.abs(y)+Math.abs(b))*Math.abs(h),w=7.771561172376103e-16*_;return x>w||-x>w?x:m(t,e,r,n)}];!function(){for(;v.length<=p;)v.push(l(v.length));for(var t=[],r=["slow"],n=0;n<=p;++n)t.push("a"+n),r.push("o"+n);for(var a=["function getOrientation(",t.join(),"){switch(arguments.length){case 0:case 1:return 0;"],n=2;n<=p;++n)a.push("case ",n,":return o",n,"(",t.slice(0,n).join(),");");a.push("}var s=new Array(arguments.length);for(var i=0;i0&&s>0||o<0&&s<0)return!1;var l=i(r,t,e),u=i(a,t,e);return!(l>0&&u>0||l<0&&u<0)&&(0!==o||0!==s||0!==l||0!==u||n(t,e,r,a))}e.exports=a;var i=t("robust-orientation")[3]},{"robust-orientation":182}],186:[function(t,e,r){"use strict";function n(t,e){var r=t+e,n=r-t,a=r-n,i=e-n,o=t-a,s=o+i;return s?[s,r]:[r]}function a(t,e){var r=0|t.length,a=0|e.length;if(1===r&&1===a)return n(t[0],-e[0]);var i,o,s=r+a,l=new Array(s),u=0,c=0,f=0,h=Math.abs,d=t[c],p=h(d),g=-e[f],m=h(g);p=a?(i=d,(c+=1)=a?(i=d,(c+=1)0?1:0}},{}],189:[function(t,e,r){arguments[4][31][0].apply(r,arguments)},{dup:31}],190:[function(t,e,r){"use strict";"use restrict";function n(t){for(var e=0,r=Math.max,n=0,a=t.length;n>1,s=o(t[i],e);s<=0?(0===s&&(a=i),r=i+1):s>0&&(n=i-1)}return a}function f(t,e){for(var r=new Array(t.length),n=0,a=r.length;n=t.length||0!==o(t[g],i))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;n>>c&1&&u.push(a[c]);e.push(u)}return l(e)}function p(t,e){if(e<0)return[];for(var r=[],n=(1<>1:(t>>1)-1}function u(t){for(var e=s(t);;){var r=e,n=2*t+1,a=2*(t+1),o=t;if(n0;){var r=l(t);if(r>=0){if(e0){var t=k[0];return i(0,T-1),T-=1,u(0),t}return-1}function h(t,e){var r=k[t];return y[r]===e?t:(y[r]=-1/0,c(t),f(),y[r]=e,T+=1,c(T-1))}function d(t,e){if(t[e]<0)return e;var r=e,n=e;do{var a=t[n];if(!b[n]||a<0||a===n)break;if(n=a,a=t[n],!b[n]||a<0||a===n)break;n=a,r=t[r]}while(r!==n);for(var i=e;i!==n;i=t[i])t[i]=n;return n}for(var p=e.length,g=t.length,m=new Array(p),v=new Array(p),y=new Array(p),b=new Array(p),x=0;x>1;x>=0;--x)u(x);for(;;){var E=f();if(E<0||y[E]>r)break;!function(t){if(!b[t]){b[t]=!0;var e=m[t],r=v[t];m[r]>=0&&(m[r]=e),v[e]>=0&&(v[e]=r),M[e]>=0&&h(M[e],a(e)),M[r]>=0&&h(M[r],a(r))}}(E)}for(var L=[],x=0;x=0&&r>=0&&e!==r){var n=M[e],a=M[r];n!==a&&S.push([n,a])}}),o.unique(o.normalize(S)),{positions:L,edges:S}}e.exports=a;var i=t("robust-orientation"),o=t("simplicial-complex")},{"robust-orientation":182,"simplicial-complex":190}],193:[function(t,e,r){"use strict";function n(t,e){var r,n;if(e[0][0]e[1][0])){var a=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 ol?a-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],a=e[0]}var o,s;if(t[0][0]t[1][0]))return-n(t,e);o=t[1],s=t[0]}var l=i(r,a,s),u=i(r,a,o);if(l<0){if(u<=0)return l}else if(l>0){if(u>=0)return l}else if(u)return u;if(l=i(s,o,a),u=i(s,o,r),l<0){if(u<=0)return l}else if(l>0){if(u>=0)return l}else if(u)return u;return a[0]-s[0]}e.exports=a;var i=t("robust-orientation")},{"robust-orientation":182}],194:[function(t,e,r){"use strict";function n(t,e,r){this.slabs=t,this.coordinates=e,this.horizontal=r}function a(t,e){return t.y-e}function i(t,e){for(var r=null;t;){var n,a,o=t.key;o[0][0]0)if(e[0]!==o[1][0])r=t,t=t.right;else{var l=i(t.right,e);if(l)return l;t=t.left}else{if(e[0]!==o[1][0])return t;var l=i(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,a=new Array(r),i=0;i0){var s=i(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],a);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":193,"binary-search-bounds":30,"functional-red-black-tree":70,"robust-orientation":182}],195:[function(e,r,n){!function(){"use strict";function e(t){return a(i(t),arguments)}function r(t,r){return e.apply(null,[t].concat(r||[]))}function a(t,r){var n,a,i,s,l,u,c,f,h,d=1,p=t.length,g="";for(a=0;a=0),s[8]){case"b":n=parseInt(n,10).toString(2);break;case"c":n=String.fromCharCode(parseInt(n,10));break;case"d":case"i":n=parseInt(n,10);break;case"j":n=JSON.stringify(n,null,s[6]?parseInt(s[6]):0);break;case"e":n=s[7]?parseFloat(n).toExponential(s[7]):parseFloat(n).toExponential();break;case"f":n=s[7]?parseFloat(n).toFixed(s[7]):parseFloat(n);break;case"g":n=s[7]?String(Number(n.toPrecision(s[7]))):parseFloat(n);break;case"o":n=(parseInt(n,10)>>>0).toString(8);break;case"s":n=String(n),n=s[7]?n.substring(0,s[7]):n;break;case"t":n=String(!!n),n=s[7]?n.substring(0,s[7]):n;break;case"T":n=Object.prototype.toString.call(n).slice(8,-1).toLowerCase(),n=s[7]?n.substring(0,s[7]):n;break;case"u":n=parseInt(n,10)>>>0;break;case"v":n=n.valueOf(),n=s[7]?n.substring(0,s[7]):n;break;case"x":n=(parseInt(n,10)>>>0).toString(16);break;case"X":n=(parseInt(n,10)>>>0).toString(16).toUpperCase()}o.json.test(s[8])?g+=n:(!o.number.test(s[8])||f&&!s[3]?h="":(h=f?"+":"-",n=n.toString().replace(o.sign,"")),u=s[4]?"0"===s[4]?"0":s[4].charAt(1):" ",c=s[6]-(h+n).length,l=s[6]&&c>0?u.repeat(c):"",g+=s[5]?h+n+l:"0"===u?h+l+n:l+h+n)}return g}function i(t){if(s[t])return s[t];for(var e,r=t,n=[],a=0;r;){if(null!==(e=o.text.exec(r)))n.push(e[0]);else if(null!==(e=o.modulo.exec(r)))n.push("%");else{if(null===(e=o.placeholder.exec(r)))throw new SyntaxError("[sprintf] unexpected placeholder");if(e[2]){a|=1;var i=[],l=e[2],u=[];if(null===(u=o.key.exec(l)))throw new SyntaxError("[sprintf] failed to parse named argument key");for(i.push(u[1]);""!==(l=l.substring(u[0].length));)if(null!==(u=o.key_access.exec(l)))i.push(u[1]);else{if(null===(u=o.index_access.exec(l)))throw new SyntaxError("[sprintf] failed to parse named argument key");i.push(u[1])}e[2]=i}else a|=2;if(3===a)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");n.push(e)}r=r.substring(e[0].length)}return s[t]=n}var o={not_string:/[^s]/,not_bool:/[^t]/,not_type:/[^T]/,not_primitive:/[^v]/,number:/[diefg]/,numeric_arg:/[bcdiefguxX]/,json:/[j]/,not_json:/[^j]/,text:/^[^\x25]+/,modulo:/^\x25{2}/,placeholder:/^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijostTuvxX])/,key:/^([a-z_][a-z_\d]*)/i,key_access:/^\.([a-z_][a-z_\d]*)/i,index_access:/^\[(\d+)\]/,sign:/^[\+\-]/},s=Object.create(null);void 0!==n&&(n.sprintf=e,n.vsprintf=r),"undefined"!=typeof window&&(window.sprintf=e,window.vsprintf=r,"function"==typeof t&&t.amd&&t(function(){return{sprintf:e,vsprintf:r}}))}()},{}],196:[function(t,e,r){"use strict";function n(t){return t.split("").map(function(t){return t in a?a[t]:""}).join("")}e.exports=n;var a={" ":" ",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"}},{}],197:[function(t,e,r){"use strict";function n(t,e){var r=t.length,n=["'use strict';"],a="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 i=[],l=[],u=0;u>>7){");for(var u=0;u<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),m=new Array(r),v=new Array(r),y=0,b=0;bb)&&!(u&1<<_)!=!(u&1<0&&(M="+"+m[x]+"*c");var T=p[x].length/y*.5,E=.5+v[x]/y*.5;k.push("d"+x+"-"+E+"-"+T+"*("+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;u<1<0&&(h+=.02);for(var p=new Float32Array(f),g=0,m=-.5*h,d=0;d=0?1.2:1))}function a(t,e,r,n,a,o,s){for(var l=0;l.5?l/(2-i-o):l/(i+o),i){case t:n=(e-r)/l+(e1&&(r-=1),r<1/6?t+6*(e-t)*r:r<.5?e:r<2/3?t+(e-t)*(2/3-r)*6:t}var a,i,o;if(t=E(t,360),e=E(e,100),r=E(r,100),0===e)a=i=o=r;else{var s=r<.5?r*(1+e):r+e-r*e,l=2*r-s;a=n(l,s,t+1/3),i=n(l,s,t),o=n(l,s,t-1/3)}return{r:255*a,g:255*i,b:255*o}}function l(t,e,r){t=E(t,255),e=E(e,255),r=E(r,255);var n,a,i=G(t,e,r),o=V(t,e,r),s=i,l=i-o;if(a=0===i?0:l/i,i==o)n=0;else{switch(i){case t:n=(e-r)/l+(e>1)+720)%360;--e;)a.h=(a.h+i)%360,o.push(n(a));return o}function M(t,e){e=e||6;for(var r=n(t).toHsv(),a=r.h,i=r.s,o=r.v,s=[],l=1/e;e--;)s.push(n({h:a,s:i,v:o})),o=(o+l)%1;return s}function T(t){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}function E(t,r){C(t)&&(t="100%");var n=O(t);return t=V(r,G(0,parseFloat(t))),n&&(t=parseInt(t*r,10)/100),e.abs(t-r)<1e-6?1:t%r/parseFloat(r)}function L(t){return V(1,G(0,t))}function S(t){return parseInt(t,16)}function C(t){return"string"==typeof t&&-1!=t.indexOf(".")&&1===parseFloat(t)}function O(t){return"string"==typeof t&&-1!=t.indexOf("%")}function I(t){return 1==t.length?"0"+t:""+t}function R(t){return t<=1&&(t=100*t+"%"),t}function D(t){return e.round(255*parseFloat(t)).toString(16)}function P(t){return S(t)/255}function z(t){return!!W.CSS_UNIT.exec(t)}function N(t){t=t.replace(B,"").replace(j,"").toLowerCase();var e=!1;if(X[t])t=X[t],e=!0;else if("transparent"==t)return{r:0,g:0,b:0,a:0,format:"name"};var r;return(r=W.rgb.exec(t))?{r:r[1],g:r[2],b:r[3]}:(r=W.rgba.exec(t))?{r:r[1],g:r[2],b:r[3],a:r[4]}:(r=W.hsl.exec(t))?{h:r[1],s:r[2],l:r[3]}:(r=W.hsla.exec(t))?{h:r[1],s:r[2],l:r[3],a:r[4]}:(r=W.hsv.exec(t))?{h:r[1],s:r[2],v:r[3]}:(r=W.hsva.exec(t))?{h:r[1],s:r[2],v:r[3],a:r[4]}:(r=W.hex8.exec(t))?{r:S(r[1]),g:S(r[2]),b:S(r[3]),a:P(r[4]),format:e?"name":"hex8"}:(r=W.hex6.exec(t))?{r:S(r[1]),g:S(r[2]),b:S(r[3]),format:e?"name":"hex"}:(r=W.hex4.exec(t))?{r:S(r[1]+""+r[1]),g:S(r[2]+""+r[2]),b:S(r[3]+""+r[3]),a:P(r[4]+""+r[4]),format:e?"name":"hex8"}:!!(r=W.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"}}function F(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 B=/^\s+/,j=/\s+$/,H=0,U=e.round,V=e.min,G=e.max,q=e.random;n.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,r,n,a,i,o,s=this.toRgb();return t=s.r/255,r=s.g/255,n=s.b/255,a=t<=.03928?t/12.92:e.pow((t+.055)/1.055,2.4),i=r<=.03928?r/12.92:e.pow((r+.055)/1.055,2.4),o=n<=.03928?n/12.92:e.pow((n+.055)/1.055,2.4),.2126*a+.7152*i+.0722*o},setAlpha:function(t){return this._a=T(t),this._roundA=U(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=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 c(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(t){return f(this._r,this._g,this._b,this._a,t)},toHex8String:function(t){return"#"+this.toHex8(t)},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)&&(Y[c(this._r,this._g,this._b,!0)]||!1)},toFilter:function(t){var e="#"+h(this._r,this._g,this._b,this._a),r=e,a=this._gradientType?"GradientType = 1, ":"";if(t){var i=n(t);r="#"+h(i._r,i._g,i._b,i._a)}return"progid:DXImageTransform.Microsoft.gradient("+a+"startColorstr="+e+",endColorstr="+r+")"},toString:function(t){var e=!!t;t=t||this._format;var r=!1,n=this._a<1&&this._a>=0;return e||!n||"hex"!==t&&"hex6"!==t&&"hex3"!==t&&"hex4"!==t&&"hex8"!==t&&"name"!==t?("rgb"===t&&(r=this.toRgbString()),"prgb"===t&&(r=this.toPercentageRgbString()),"hex"!==t&&"hex6"!==t||(r=this.toHexString()),"hex3"===t&&(r=this.toHexString(!0)),"hex4"===t&&(r=this.toHex8String(!0)),"hex8"===t&&(r=this.toHex8String()),"name"===t&&(r=this.toName()),"hsl"===t&&(r=this.toHslString()),"hsv"===t&&(r=this.toHsvString()),r||this.toHexString()):"name"===t&&0===this._a?this.toName():this.toRgbString()},clone:function(){return n(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(m,arguments)},brighten:function(){return this._applyModification(v,arguments)},darken:function(){return this._applyModification(y,arguments)},desaturate:function(){return this._applyModification(d,arguments)},saturate:function(){return this._applyModification(p,arguments)},greyscale:function(){return this._applyModification(g,arguments)},spin:function(){return this._applyModification(b,arguments)},_applyCombination:function(t,e){return t.apply(null,[this].concat([].slice.call(e)))},analogous:function(){return this._applyCombination(k,arguments)},complement:function(){return this._applyCombination(x,arguments)},monochromatic:function(){return this._applyCombination(M,arguments)},splitcomplement:function(){return this._applyCombination(A,arguments)},triad:function(){return this._applyCombination(_,arguments)},tetrad:function(){return this._applyCombination(w,arguments)}},n.fromRatio=function(t,e){if("object"==typeof t){var r={};for(var a in t)t.hasOwnProperty(a)&&(r[a]="a"===a?t[a]:R(t[a]));t=r}return n(t,e)},n.equals=function(t,e){return!(!t||!e)&&n(t).toRgbString()==n(e).toRgbString()},n.random=function(){return n.fromRatio({r:q(),g:q(),b:q()})},n.mix=function(t,e,r){r=0===r?0:r||50;var a=n(t).toRgb(),i=n(e).toRgb(),o=r/100;return n({r:(i.r-a.r)*o+a.r,g:(i.g-a.g)*o+a.g,b:(i.b-a.b)*o+a.b,a:(i.a-a.a)*o+a.a})},n.readability=function(t,r){var a=n(t),i=n(r);return(e.max(a.getLuminance(),i.getLuminance())+.05)/(e.min(a.getLuminance(),i.getLuminance())+.05)},n.isReadable=function(t,e,r){var a,i,o=n.readability(t,e);switch(i=!1,a=F(r),a.level+a.size){case"AAsmall":case"AAAlarge":i=o>=4.5;break;case"AAlarge":i=o>=3;break;case"AAAsmall":i=o>=7}return i},n.mostReadable=function(t,e,r){var a,i,o,s,l=null,u=0;r=r||{},i=r.includeFallbackColors,o=r.level,s=r.size;for(var c=0;cu&&(u=a,l=n(e[c]));return n.isReadable(t,l,{level:o,size:s})||!i?l:(r.includeFallbackColors=!1,n.mostReadable(t,["#fff","#000"],r))};var X=n.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=n.hexNames=function(t){var e={};for(var r in t)t.hasOwnProperty(r)&&(e[t[r]]=r);return e}(X),W=function(){var t="(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)",e="[\\s|\\(]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")\\s*\\)?",r="[\\s|\\(]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")\\s*\\)?";return{CSS_UNIT:new RegExp(t),rgb:new RegExp("rgb"+e),rgba:new RegExp("rgba"+r),hsl:new RegExp("hsl"+e),hsla:new RegExp("hsla"+r),hsv:new RegExp("hsv"+e),hsva:new RegExp("hsva"+r),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})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();void 0!==r&&r.exports?r.exports=n:"function"==typeof t&&t.amd?t(function(){return n}):window.tinycolor=n}(Math)},{}],201:[function(t,e,r){"use strict";function n(t,e){var r=o(getComputedStyle(t).getPropertyValue(e));return r[0]*i(r[1],t)}function a(t,e){var r=document.createElement("div");r.style["font-size"]="128"+t,e.appendChild(r);var a=n(r,"font-size")/128;return e.removeChild(r),a}function i(t,e){switch(e=e||document.body,t=(t||"px").trim().toLowerCase(),e!==window&&e!==document||(e=document.body),t){case"%":return e.clientHeight/100;case"ch":case"ex":return a(t,e);case"em":return n(e,"font-size");case"rem":return n(document.body,"font-size");case"vw":return window.innerWidth/100;case"vh":return window.innerHeight/100;case"vmin":return Math.min(window.innerWidth,window.innerHeight)/100;case"vmax":return Math.max(window.innerWidth,window.innerHeight)/100;case"in":return s;case"cm":return s/2.54;case"mm":return s/25.4;case"pt":return s/72;case"pc":return s/6}return 1}var o=t("parse-unit");e.exports=i;var s=96},{"parse-unit":167}],202:[function(t,e,r){"use strict";function n(t){if(t<0)return[];if(0===t)return[[0]];for(var e=0|Math.round(o(t+1)),r=[],n=0;n0?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 m(t){return new DataView(o(t),0,t)}function v(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=i,r.freeArrayBuffer=a,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 v(t);case"data":case"dataview":return m(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=m,r.mallocBuffer=v,r.clearCache=function(){for(var t=0;t<32;++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":31,buffer:40,dup:64}],206:[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;e8192)throw new Error("vectorize-text: String too long (sorry, this will get fixed later)");var i=3*n;t.height= 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}],215:[function(t,e,r){"use strict";function n(t,e){var r=[];return e=+e||0,a(t.hi(t.shape[0]-1),r,e),r}e.exports=n;var a=t("./lib/zc-core")},{"./lib/zc-core":214}],216:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("../../plots/cartesian/axes"),i=t("./common_defaults"),o=t("./attributes");e.exports=function(t,e,r,s,l){function u(r,a){return n.coerce(t,e,o,r,a)}s=s||{},l=l||{};var c=u("visible",!l.itemIsNotPlainObject),f=u("clicktoshow");if(!c&&!f)return e;i(t,e,r,u);for(var h=e.showarrow,d=["x","y"],p=[-10,-30],g={_fullLayout:r},m=0;m<2;m++){var v=d[m],y=a.coerceRef(t,e,g,v,"","paper");if(a.coercePosition(e,g,u,y,v,.5),h){var b="a"+v,x=a.coerceRef(t,e,g,b,"pixel");"pixel"!==x&&x!==y&&(x=e[b]="pixel");var _="pixel"===x?p[m]:.4;a.coercePosition(e,g,u,x,b,_)}u(v+"anchor"),u(v+"shift")}if(n.noneOrAll(t,e,["x","y"]),h&&n.noneOrAll(t,e,["ax","ay"]),f){var w=u("xclick"),A=u("yclick");e._xclick=void 0===w?e.x:a.cleanPosition(w,g,e.xref),e._yclick=void 0===A?e.y:a.cleanPosition(A,g,e.yref)}return e}},{"../../lib":350,"../../plots/cartesian/axes":389,"./attributes":218,"./common_defaults":221}],217:[function(t,e,r){"use strict";e.exports=[{path:"",backoff:0},{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}]},{}],218:[function(t,e,r){"use strict";var n=t("./arrow_paths"),a=t("../../plots/font_attributes"),i=t("../../plots/cartesian/constants"),o=t("../../lib/extend").extendFlat;e.exports={_isLinkedToArray:"annotation",visible:{valType:"boolean",dflt:!0},text:{valType:"string"},textangle:{valType:"angle",dflt:0},font:o({},a,{}),width:{valType:"number",min:1,dflt:null},height:{valType:"number",min:1,dflt:null},opacity:{valType:"number",min:0,max:1,dflt:1},align:{valType:"enumerated",values:["left","center","right"],dflt:"center"},valign:{valType:"enumerated",values:["top","middle","bottom"],dflt:"middle"},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},standoff:{valType:"number",min:0,dflt:0},ax:{valType:"any"},ay:{valType:"any"},axref:{valType:"enumerated",dflt:"pixel",values:["pixel",i.idRegex.x.toString()]},ayref:{valType:"enumerated",dflt:"pixel",values:["pixel",i.idRegex.y.toString()]},xref:{valType:"enumerated",values:["paper",i.idRegex.x.toString()]},x:{valType:"any"},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"auto"},xshift:{valType:"number",dflt:0},yref:{valType:"enumerated",values:["paper",i.idRegex.y.toString()]},y:{valType:"any"},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto"},yshift:{valType:"number",dflt:0},clicktoshow:{valType:"enumerated",values:[!1,"onoff","onout"],dflt:!1},xclick:{valType:"any"},yclick:{valType:"any"},hovertext:{valType:"string"},hoverlabel:{bgcolor:{valType:"color"},bordercolor:{valType:"color"},font:o({},a,{})},captureevents:{valType:"boolean"},_deprecated:{ref:{valType:"string"}}}},{"../../lib/extend":343,"../../plots/cartesian/constants":394,"../../plots/font_attributes":413,"./arrow_paths":217}],219:[function(t,e,r){"use strict";function n(t){var e=t._fullLayout;a.filterVisible(e.annotations).forEach(function(e){var r,n,a=i.getFromId(t,e.xref),o=i.getFromId(t,e.yref),s=3*e.arrowsize*e.arrowwidth||0;a&&a.autorange&&(r=s+e.xshift,n=s-e.xshift,e.axref===e.xref?(i.expand(a,[a.r2c(e.x)],{ppadplus:r,ppadminus:n}),i.expand(a,[a.r2c(e.ax)],{ppadplus:e._xpadplus,ppadminus:e._xpadminus})):i.expand(a,[a.r2c(e.x)],{ppadplus:Math.max(e._xpadplus,r),ppadminus:Math.max(e._xpadminus,n)})),o&&o.autorange&&(r=s-e.yshift,n=s+e.yshift,e.ayref===e.yref?(i.expand(o,[o.r2c(e.y)],{ppadplus:r,ppadminus:n}),i.expand(o,[o.r2c(e.ay)],{ppadplus:e._ypadplus,ppadminus:e._ypadminus})):i.expand(o,[o.r2c(e.y)],{ppadplus:Math.max(e._ypadplus,r),ppadminus:Math.max(e._ypadminus,n)}))})}var a=t("../../lib"),i=t("../../plots/cartesian/axes"),o=t("./draw").draw;e.exports=function(t){var e=t._fullLayout,r=a.filterVisible(e.annotations);if(r.length&&t._fullData.length){var s={};r.forEach(function(t){s[t.xref]=!0,s[t.yref]=!0});if(i.list(t).filter(function(t){return t.autorange&&s[t._id]}).length)return a.syncOrAsync([o,n],t)}}},{"../../lib":350,"../../plots/cartesian/axes":389,"./draw":224}],220:[function(t,e,r){"use strict";function n(t,e){var r=i(t,e);return r.on.length>0||r.explicitOff.length>0}function a(t,e){var r,n=i(t,e),a=n.on,o=n.off.concat(n.explicitOff),l={};if(a.length||o.length){for(r=0;r2/3?"right":"center"),{center:0,middle:0,left:.5,bottom:-.5,right:-.5,top:.5}[e]}var o=F.selectAll("a");if(1===o.size()&&o.text()===F.text()){C.insert("a",":first-child").attr({"xlink:xlink:href":o.attr("xlink:href"),"xlink:xlink:show":o.attr("xlink:show")}).style({cursor:"pointer"}).node().appendChild(D.node())} -var l=C.select(".annotation-text-math-group"),c=!l.empty(),d=h.bBox((c?l:F).node()),y=d.width,S=d.height,I=e.width||y,N=e.height||S,B=Math.round(I+2*R),j=Math.round(N+2*R);e._w=I,e._h=N;for(var H=!1,U=["x","y"],V=0;V1)&&($===Q?((ot=K.r2fraction(e["a"+Z]))<0||ot>1)&&(H=!0):H=!0,H))continue;G=K._offset+K.r2p(e[Z]),Y=.5}else"x"===Z?(X=e[Z],G=_.l+_.w*X):(X=1-e[Z],G=_.t+_.h*X),Y=e.showarrow?.5:X;if(e.showarrow){it.head=G;var st=e["a"+Z];W=tt*r(.5,e.xanchor)-et*r(.5,e.yanchor),$===Q?(it.tail=K._offset+K.r2p(st),q=W):(it.tail=G+st,q=W+st),it.text=it.tail+W;var lt=x["x"===Z?"width":"height"];if("paper"===Q&&(it.head=u.constrain(it.head,1,lt-1)),"pixel"===$){var ut=-Math.max(it.tail-3,it.text),ct=Math.min(it.tail+3,it.text)-lt;ut>0?(it.tail+=ut,it.text+=ut):ct>0&&(it.tail-=ct,it.text-=ct)}it.tail+=at,it.head+=at}else W=rt*r(Y,nt),q=W,it.text=G+W;it.text+=at,W+=at,q+=at,e["_"+Z+"padplus"]=rt/2+q,e["_"+Z+"padminus"]=rt/2-q,e["_"+Z+"size"]=rt,e["_"+Z+"shift"]=W}if(H)return void C.remove();var ft=0,ht=0;if("left"!==e.align&&(ft=(I-y)*("center"===e.align?.5:1)),"top"!==e.valign&&(ht=(N-S)*("middle"===e.valign?.5:1)),c)l.select("svg").attr({x:R+ft-1,y:R+ht}).call(h.setClipUrl,P?A:null);else{var dt=R+ht-d.top,pt=R+ft-d.left;F.call(p.positionText,pt,dt).call(h.setClipUrl,P?A:null)}z.select("rect").call(h.setRect,R,R,I,N),D.call(h.setRect,O/2,O/2,B-O,j-O),C.call(h.setTranslate,Math.round(k.x.text-B/2),Math.round(k.y.text-j/2)),E.attr({transform:"rotate("+M+","+k.x.text+","+k.y.text+")"});var gt=function(r,o){T.selectAll(".annotation-arrow-g").remove();var l=k.x.head,c=k.y.head,d=k.x.tail+r,p=k.y.tail+o,g=k.x.text+r,y=k.y.text+o,x=u.rotationXYMatrix(M,g,y),A=u.apply2DTransform(x),L=u.apply2DTransform2(x),S=+D.attr("width"),O=+D.attr("height"),I=g-.5*S,R=I+S,P=y-.5*O,z=P+O,N=[[I,P,I,z],[I,z,R,z],[R,z,R,P],[R,P,I,P]].map(L);if(!N.reduce(function(t,e){return t^!!u.segmentsIntersect(l,c,l+1e6,c+1e6,e[0],e[1],e[2],e[3])},!1)){N.forEach(function(t){var e=u.segmentsIntersect(d,p,l,c,t[0],t[1],t[2],t[3]);e&&(d=e.x,p=e.y)});var F=e.arrowwidth,B=e.arrowcolor,j=T.append("g").style({opacity:f.opacity(B)}).classed("annotation-arrow-g",!0),H=j.append("path").attr("d","M"+d+","+p+"L"+l+","+c).style("stroke-width",F+"px").call(f.stroke,f.rgb(B));if(v(H,e.arrowhead,"end",e.arrowsize,e.standoff),w.annotationPosition&&H.node().parentNode&&!n){var U=l,V=c;if(e.standoff){var G=Math.sqrt(Math.pow(l-d,2)+Math.pow(c-p,2));U+=e.standoff*(d-l)/G,V+=e.standoff*(p-c)/G}var q,X,Y,W=j.append("path").classed("annotation-arrow",!0).classed("anndrag",!0).attr({d:"M3,3H-3V-3H3ZM0,0L"+(d-U)+","+(p-V),transform:"translate("+U+","+V+")"}).style("stroke-width",F+6+"px").call(f.stroke,"rgba(0,0,0,0)").call(f.fill,"rgba(0,0,0,0)");m.init({element:W.node(),gd:t,prepFn:function(){var t=h.getTranslate(C);X=t.x,Y=t.y,q={},a&&a.autorange&&(q[a._name+".autorange"]=!0),i&&i.autorange&&(q[i._name+".autorange"]=!0)},moveFn:function(t,r){var n=A(X,Y),o=n[0]+t,s=n[1]+r;C.call(h.setTranslate,o,s),q[b+".x"]=a?a.p2r(a.r2p(e.x)+t):e.x+t/_.w,q[b+".y"]=i?i.p2r(i.r2p(e.y)+r):e.y-r/_.h,e.axref===e.xref&&(q[b+".ax"]=a.p2r(a.r2p(e.ax)+t)),e.ayref===e.yref&&(q[b+".ay"]=i.p2r(i.r2p(e.ay)+r)),j.attr("transform","translate("+t+","+r+")"),E.attr({transform:"rotate("+M+","+o+","+s+")"})},doneFn:function(e){if(e){s.relayout(t,q);var r=document.querySelector(".js-notes-box-panel");r&&r.redraw(r.selectedObj)}}})}}};if(e.showarrow&>(0,0),L){var mt,vt;m.init({element:C.node(),gd:t,prepFn:function(){vt=E.attr("transform"),mt={}},moveFn:function(t,r){var o="pointer";if(e.showarrow)e.axref===e.xref?mt[b+".ax"]=a.p2r(a.r2p(e.ax)+t):mt[b+".ax"]=e.ax+t,e.ayref===e.yref?mt[b+".ay"]=i.p2r(i.r2p(e.ay)+r):mt[b+".ay"]=e.ay+r,gt(t,r);else{if(n)return;if(a)mt[b+".x"]=e.x+t/a._m;else{var s=e._xsize/_.w,l=e.x+(e._xshift-e.xshift)/_.w-s/2;mt[b+".x"]=m.align(l+t/_.w,s,0,1,e.xanchor)}if(i)mt[b+".y"]=e.y+r/i._m;else{var u=e._ysize/_.h,c=e.y-(e._yshift+e.yshift)/_.h-u/2;mt[b+".y"]=m.align(c-r/_.h,u,0,1,e.yanchor)}a&&i||(o=m.getCursor(a?.5:mt[b+".x"],i?.5:mt[b+".y"],e.xanchor,e.yanchor))}E.attr({transform:"translate("+t+","+r+")"+vt}),g(C,o)},doneFn:function(e){if(g(C),e){s.relayout(t,mt);var r=document.querySelector(".js-notes-box-panel");r&&r.redraw(r.selectedObj)}}})}}var y,b,x=t._fullLayout,_=t._fullLayout._size,w=t._context.edits;n?(y="annotation-"+n,b=n+".annotations["+r+"]"):(y="annotation",b="annotations["+r+"]"),x._infolayer.selectAll("."+y+'[data-index="'+r+'"]').remove();var A="clip"+x._uid+"_ann"+r;if(!e._input||!1===e.visible)return void o.selectAll("#"+A).remove();var k={x:{},y:{}},M=+e.textangle||0,T=x._infolayer.append("g").classed(y,!0).attr("data-index",String(r)).style("opacity",e.opacity),E=T.append("g").classed("annotation-text-g",!0),L=w[e.showarrow?"annotationTail":"annotationPosition"],S=e.captureevents||w.annotationText||L,C=E.append("g").style("pointer-events",S?"all":null).call(g,"default").on("click",function(){t._dragging=!1;var a={index:r,annotation:e._input,fullAnnotation:e,event:o.event};n&&(a.subplotId=n),t.emit("plotly_clickannotation",a)});e.hovertext&&C.on("mouseover",function(){var r=e.hoverlabel,n=r.font,a=this.getBoundingClientRect(),i=t.getBoundingClientRect();d.loneHover({x0:a.left-i.left,x1:a.right-i.left,y:(a.top+a.bottom)/2-i.top,text:e.hovertext,color:r.bgcolor,borderColor:r.bordercolor,fontFamily:n.family,fontSize:n.size,fontColor:n.color},{container:x._hoverlayer.node(),outerContainer:x._paper.node(),gd:t})}).on("mouseout",function(){d.loneUnhover(x._hoverlayer.node())});var O=e.borderwidth,I=e.borderpad,R=O+I,D=C.append("rect").attr("class","bg").style("stroke-width",O+"px").call(f.stroke,e.bordercolor).call(f.fill,e.bgcolor),P=e.width||e.height,z=x._defs.select(".clips").selectAll("#"+A).data(P?[0]:[]);z.enter().append("clipPath").classed("annclip",!0).attr("id",A).append("rect"),z.exit().remove();var N=e.font,F=C.append("text").classed("annotation-text",!0).text(e.text);w.annotationText?F.call(p.makeEditable,{delegate:C,gd:t}).call(l).on("edit",function(r){e.text=r,this.call(l);var n={};n[b+".text"]=e.text,a&&a.autorange&&(n[a._name+".autorange"]=!0),i&&i.autorange&&(n[i._name+".autorange"]=!0),s.relayout(t,n)}):F.call(l)}var o=t("d3"),s=t("../../plotly"),l=t("../../plots/plots"),u=t("../../lib"),c=t("../../plots/cartesian/axes"),f=t("../color"),h=t("../drawing"),d=t("../fx"),p=t("../../lib/svg_text_utils"),g=t("../../lib/setcursor"),m=t("../dragelement"),v=t("./draw_arrow_head");e.exports={draw:n,drawOne:a,drawRaw:i}},{"../../lib":350,"../../lib/setcursor":365,"../../lib/svg_text_utils":369,"../../plotly":384,"../../plots/cartesian/axes":389,"../../plots/plots":422,"../color":233,"../dragelement":254,"../drawing":257,"../fx":274,"./draw_arrow_head":225,d3:62}],225:[function(t,e,r){"use strict";var n=t("d3"),a=t("fast-isnumeric"),i=t("../color"),o=t("../drawing"),s=t("./arrow_paths");e.exports=function(t,e,r,l,u){function c(){t.style("stroke-dasharray","0px,100px")}function f(r,a){d.path&&(e>5&&(a=0),n.select(h.parentNode).append("path").attr({class:t.attr("class"),d:d.path,transform:"translate("+r.x+","+r.y+")rotate("+180*a/Math.PI+")scale("+y+")"}).style({fill:b,opacity:x,"stroke-width":0}))}a(l)||(l=1);var h=t.node(),d=s[e||0];"string"==typeof r&&r||(r="end");var p,g,m,v,y=(o.getPx(t,"stroke-width")||1)*l,b=t.style("stroke")||i.defaultLine,x=t.style("stroke-opacity")||1,_=r.indexOf("start")>=0,w=r.indexOf("end")>=0,A=d.backoff*y+u;if("line"===h.nodeName){p={x:+t.attr("x1"),y:+t.attr("y1")},g={x:+t.attr("x2"),y:+t.attr("y2")};var k=p.x-g.x,M=p.y-g.y;if(m=Math.atan2(M,k),v=m+Math.PI,A){if(A*A>k*k+M*M)return void c();var T=A*Math.cos(m),E=A*Math.sin(m);_&&(p.x-=T,p.y-=E,t.attr({x1:p.x,y1:p.y})),w&&(g.x+=T,g.y+=E,t.attr({x2:g.x,y2:g.y}))}}else if("path"===h.nodeName){var L=h.getTotalLength(),S="";if(L1){u=!0;break}}u?t.fullLayout._infolayer.select(".annotation-"+t.id+'[data-index="'+s+'"]').remove():(l.pdata=a(t.glplot.cameraParams,[e.xaxis.r2l(l.x)*r[0],e.yaxis.r2l(l.y)*r[1],e.zaxis.r2l(l.z)*r[2]]),n(t.graphDiv,l,s,t.id,l._xa,l._ya))}}},{"../../plots/gl3d/project":419,"../annotations/draw":224}],231:[function(t,e,r){"use strict";e.exports={moduleType:"component",name:"annotations3d",schema:{layout:{"scene.annotations":t("./attributes")}},layoutAttributes:t("./attributes"),handleDefaults:t("./defaults"),convert:t("./convert"),draw:t("./draw")}},{"./attributes":227,"./convert":228,"./defaults":229,"./draw":230}],232:[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},{}],233:[function(t,e,r){"use strict";function n(t){if(i(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*/),a="a"===e.charAt(3)&&4===n.length;if(!a&&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 a?"rgba("+s+", "+n[3]+")":"rgb("+s+")"}var a=t("tinycolor2"),i=t("fast-isnumeric"),o=e.exports={},s=t("./attributes");o.defaults=s.defaults;var l=o.defaultLine=s.defaultLine;o.lightLine=s.lightLine;var u=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(a(t))},o.opacity=function(t){return t?a(t).getAlpha():0},o.addOpacity=function(t,e){var r=a(t).toRgb();return"rgba("+Math.round(r.r)+", "+Math.round(r.g)+", "+Math.round(r.b)+", "+e+")"},o.combine=function(t,e){var r=a(t).toRgb();if(1===r.a)return a(t).toRgbString();var n=a(e||u).toRgb(),i=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},o={r:i.r*(1-r.a)+r.r*r.a,g:i.g*(1-r.a)+r.g*r.a,b:i.b*(1-r.a)+r.b*r.a};return a(o).toRgbString()},o.contrast=function(t,e,r){var n=a(t);return 1!==n.getAlpha()&&(n=a(o.combine(t,u))),(n.isDark()?e?n.lighten(e):u:r?n.darken(r):l).toString()},o.stroke=function(t,e){var r=a(e);t.style({stroke:o.tinyRGB(r),"stroke-opacity":r.getAlpha()})},o.fill=function(t,e){var r=a(e);t.style({fill:o.tinyRGB(r),"fill-opacity":r.getAlpha()})},o.clean=function(t){if(t&&"object"==typeof t){var e,r,a,i,s=Object.keys(t);for(e=0;es&&(i[1]-=(ct-s)/2):r.node()&&!r.classed("js-placeholder")&&(ct=d.bBox(r.node()).height),ct){if(ct+=5,"top"===A.titleside)rt.domain[1]-=ct/L.h,i[1]*=-1;else{rt.domain[0]+=ct/L.h;var u=m.lineCount(r);i[1]+=(1-u)*s}e.attr("transform","translate("+i+")"),rt.setScale()}}lt.selectAll(".cbfills,.cblines,.cbaxis").attr("transform","translate(0,"+Math.round(L.h*(1-rt.domain[1]))+")");var f=lt.select(".cbfills").selectAll("rect.cbfill").data(R);f.enter().append("rect").classed("cbfill",!0).style("stroke","none"),f.exit().remove(),f.each(function(t,e){var r=[0===e?O[0]:(R[e]+R[e-1])/2,e===R.length-1?O[1]:(R[e]+R[e+1])/2].map(rt.c2p).map(Math.round);e!==R.length-1&&(r[1]+=r[1]>r[0]?1:-1);var i=P(t).replace("e-",""),o=a(i).toHexString();n.select(this).attr({x:Q,width:Math.max(V,2),y:n.min(r),height:Math.max(n.max(r)-n.min(r),2),fill:o})});var h=lt.select(".cblines").selectAll("path.cbline").data(A.line.color&&A.line.width?I:[]);return h.enter().append("path").classed("cbline",!0),h.exit().remove(),h.each(function(t){n.select(this).attr("d","M"+Q+","+(Math.round(rt.c2p(t))+A.line.width/2%1)+"h"+V).call(d.lineGroupStyle,A.line.width,D(t),A.line.dash)}),rt._axislayer.selectAll("g."+rt._id+"tick,path").remove(),rt._pos=Q+V+(A.outlinewidth||0)/2-("outside"===A.ticks?1:0),rt.side="right",c.syncOrAsync([function(){return l.doTicks(t,rt,!0)},function(){if(-1===["top","bottom"].indexOf(A.titleside)){var e=rt.titlefont.size,r=rt._offset+rt._length/2,a=L.l+(rt.position||0)*L.w+("right"===rt.side?10+e*(rt.showticklabels?1:.5):-10-e*(rt.showticklabels?.5:0));M("h"+rt._id+"title",{avoid:{selection:n.select(t).selectAll("g."+rt._id+"tick"),side:A.titleside,offsetLeft:L.l,offsetTop:L.t,maxShift:E.width},attributes:{x:a,y:r,"text-anchor":"middle"},transform:{rotate:"-90",offset:0}})}}])}function M(e,r){var n,a=w();n=s.traceIs(a,"markerColorscale")?"marker.colorbar.title":"colorbar.title";var i={propContainer:rt,propName:n,traceIndex:a.index,dfltName:"colorscale",containerGroup:lt.select(".cbtitle")},o="h"===e.charAt(0)?e.substr(1):"h"+e;lt.selectAll("."+o+",."+o+"-math-group").remove(),g.draw(t,e,f(i,r||{}))}function T(){var r=V+A.outlinewidth/2+d.bBox(rt._axislayer.node()).width;if(j=ut.select("text"),j.node()&&!j.classed("js-placeholder")){var n,a=ut.select(".h"+rt._id+"title-math-group").node();n=a&&-1!==["top","bottom"].indexOf(A.titleside)?d.bBox(a).width:d.bBox(ut.node()).right-Q-L.l,r=Math.max(r,n)}var i=2*A.xpad+r+A.borderwidth+A.outlinewidth/2,s=J-tt;lt.select(".cbbg").attr({x:Q-A.xpad-(A.borderwidth+A.outlinewidth)/2,y:tt-W,width:Math.max(i,2),height:Math.max(s+2*W,2)}).call(p.fill,A.bgcolor).call(p.stroke,A.bordercolor).style({"stroke-width":A.borderwidth}),lt.selectAll(".cboutline").attr({x:Q,y:tt+A.ypad+("top"===A.titleside?ct:0),width:Math.max(V,2),height:Math.max(s-2*A.ypad-ct,2)}).call(p.stroke,A.outlinecolor).style({fill:"None","stroke-width":A.outlinewidth});var l=({center:.5,right:1}[A.xanchor]||0)*i;lt.attr("transform","translate("+(L.l-l)+","+L.t+")"),o.autoMargin(t,e,{x:A.x,y:A.y,l:i*({right:1,center:.5}[A.xanchor]||0),r:i*({left:1,center:.5}[A.xanchor]||0),t:s*({bottom:1,middle:.5}[A.yanchor]||0),b:s*({top:1,middle:.5}[A.yanchor]||0)})}var E=t._fullLayout,L=E._size;if("function"!=typeof A.fillcolor&&"function"!=typeof A.line.color)return void E._infolayer.selectAll("g."+e).remove();var S,C,O=n.extent(("function"==typeof A.fillcolor?A.fillcolor:A.line.color).domain()),I=[],R=[],D="function"==typeof A.line.color?A.line.color:function(){return A.line.color},P="function"==typeof A.fillcolor?A.fillcolor:function(){return A.fillcolor},z=A.levels.end+A.levels.size/100,N=A.levels.size,F=1.001*O[0]-.001*O[1],B=1.001*O[1]-.001*O[0];for(C=0;C<1e5&&(S=A.levels.start+C*N,!(N>0?S>=z:S<=z));C++)S>F&&S0?S>=z:S<=z));C++)S>O[0]&&S1){var st=Math.pow(10,Math.floor(Math.log(ot)/Math.LN10));at*=st*c.roundUp(ot/st,[2,5,10]),(Math.abs(A.levels.start)/A.levels.size+1e-6)%1<2e-6&&(rt.tick0=0)}rt.dtick=at}rt.domain=[K+Z,K+X-Z],rt.setScale();var lt=E._infolayer.selectAll("g."+e).data([0]);lt.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)}),lt.attr("transform","translate("+Math.round(L.l)+","+Math.round(L.t)+")");var ut=lt.select(".cbtitleunshift").attr("transform","translate(-"+Math.round(L.l)+",-"+Math.round(L.t)+")");rt._axislayer=lt.select(".cbaxis");var ct=0;if(-1!==["top","bottom"].indexOf(A.titleside)){var ft,ht=L.l+(A.x+Y)*L.w,dt=rt.titlefont.size;ft="top"===A.titleside?(1-(K+X-Z))*L.h+L.t+3+.75*dt:(1-(K+Z))*L.h+L.t-3-.25*dt,M(rt._id+"title",{attributes:{x:ht,y:ft,"text-anchor":"start"}})}var pt=c.syncOrAsync([o.previousPromises,k,o.previousPromises,T],t);if(pt&&pt.then&&(t._promises||[]).push(pt),t._context.edits.colorbarPosition){var gt,mt,vt;u.init({element:lt.node(),gd:t,prepFn:function(){gt=lt.attr("transform"),h(lt)},moveFn:function(t,e){lt.attr("transform",gt+" translate("+t+","+e+")"),mt=u.align($+t/L.w,G,0,1,A.xanchor),vt=u.align(K-e/L.h,X,0,1,A.yanchor);var r=u.getCursor(mt,vt,A.xanchor,A.yanchor);h(lt,r)},doneFn:function(e){h(lt),e&&void 0!==mt&&void 0!==vt&&i.restyle(t,{"colorbar.x":mt,"colorbar.y":vt},w().index)}})}return pt}function w(){var r,n,a=e.substr(2);for(r=0;r=0?a.Reds:a.Blues,l.colorscale=g,s.reversescale&&(g=i(g)),s.colorscale=g)}},{"../../lib":350,"./flip_scale":244,"./scales":251}],240:[function(t,e,r){"use strict";var n=t("./attributes"),a=t("../../lib/extend").extendDeep;t("./scales.js");e.exports=function(t){return{color:{valType:"color",arrayOk:!0},colorscale:a({},n.colorscale,{}),cauto:a({},n.zauto,{}),cmax:a({},n.zmax,{}),cmin:a({},n.zmin,{}),autocolorscale:a({},n.autocolorscale,{}),reversescale:a({},n.reversescale,{})}}},{"../../lib/extend":343,"./attributes":238,"./scales.js":251}],241:[function(t,e,r){"use strict";var n=t("./scales");e.exports=n.RdBu},{"./scales":251}],242:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("../../lib"),i=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?a.nestedProperty(t,d).get()||{}:t,g=f?a.nestedProperty(e,d).get()||{}:e,m=p[h+"min"],v=p[h+"max"],y=p.colorscale;u(f+h+"auto",!(n(m)&&n(v)&&m=0;a--,i++)e=t[a],n[i]=[1-e[0],e[1]];return n}},{}],245:[function(t,e,r){"use strict";var n=t("./scales"),a=t("./default_scale"),i=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=a),t?("string"==typeof t&&(r(),"string"==typeof t&&r()),i(t)?t:e):e}},{"./default_scale":241,"./is_valid_scale_array":249,"./scales":251}],246:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("../../lib"),i=t("./is_valid_scale");e.exports=function(t,e){var r=e?a.nestedProperty(t,e).get()||{}:t,o=r.color,s=!1;if(Array.isArray(o))for(var l=0;l4/3-s?o:s}},{}],253:[function(t,e,r){"use strict";var n=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,r,i){return t="left"===r?0:"center"===r?1:"right"===r?2:n.constrain(Math.floor(3*t),0,2),e="bottom"===i?0:"middle"===i?1:"top"===i?2:n.constrain(Math.floor(3*e),0,2),a[e][t]}},{"../../lib":350}],254:[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 a(t){t._dragging=!1,t._replotPending&&l.plot(t)}function i(t){return o(t.changedTouches?t.changedTouches[0]:t,document.body)}var o=t("mouse-event-offset"),s=t("has-hover"),l=t("../../plotly"),u=t("../../lib"),c=t("../../plots/cartesian/constants"),f=t("../../constants/interactions"),h=e.exports={};h.align=t("./align"),h.getCursor=t("./cursor");var d=t("./unhover");h.unhover=d.wrapped,h.unhoverRaw=d.raw,h.init=function(t){function e(e){y._dragged=!1,y._dragging=!0;var a=i(e);return l=a[0],d=a[1],v=e.target,p=(new Date).getTime(),p-y._mouseDownTimex&&(b=Math.max(b-1,1)),t.doneFn&&t.doneFn(y._dragged,b,e),!y._dragged){var n;try{n=new MouseEvent("click",e)}catch(t){var l=i(e);n=document.createEvent("MouseEvents"),n.initMouseEvent("click",e.bubbles,e.cancelable,e.view,e.detail,e.screenX,e.screenY,l[0],l[1],e.ctrlKey,e.altKey,e.shiftKey,e.metaKey,e.button,e.relatedTarget)}v.dispatchEvent(n)}return a(y),y._dragged=!1,u.pauseEvent(e)}var l,d,p,g,m,v,y=t.gd,b=1,x=f.DBLCLICKDELAY;y._mouseDownTime||(y._mouseDownTime=0),t.element.style.pointerEvents="all",t.element.onmousedown=e,t.element.ontouchstart=e},h.coverSlip=n},{"../../constants/interactions":332,"../../lib":350,"../../plotly":384,"../../plots/cartesian/constants":394,"./align":252,"./cursor":253,"./unhover":255,"has-hover":149,"mouse-event-offset":158}],255:[function(t,e,r){"use strict";var n=t("../../lib/events"),a=e.exports={};a.wrapped=function(t,e,r){"string"==typeof t&&(t=document.getElementById(t)),t._hoverTimer&&(clearTimeout(t._hoverTimer),t._hoverTimer=void 0),a.raw(t,e,r)},a.raw=function(t,e){var r=t._fullLayout,a=t._hoverdata;e||(e={}),e.target&&!1===n.triggerHandler(t,"plotly_beforehover",e)||(r._hoverlayer.selectAll("g").remove(),r._hoverlayer.selectAll("line").remove(),r._hoverlayer.selectAll("circle").remove(),t._hoverdata=void 0,e.target&&a&&t.emit("plotly_unhover",{event:e,points:a}))}},{"../../lib/events":342}],256:[function(t,e,r){"use strict";r.dash={valType:"string",values:["solid","dot","dash","longdash","dashdot","longdashdot"],dflt:"solid"}},{}],257:[function(t,e,r){"use strict";function n(t,e,r,n,a,i,o,s){if(u.traceIs(r,"symbols")){var l=y(r);e.attr("d",function(t){var e;e="various"===t.ms||"various"===i.size?3:v.isBubble(r)?l(t.ms):(i.size||6)/2,t.mrc=e;var n=b.symbolNumber(t.mx||i.symbol)||0,a=n%100;return t.om=n%200>=100,b.symbolFuncs[a](e)+(n>=200?w:"")}).style("opacity",function(t){return(t.mo+1||i.opacity+1)-1})}var f,h,d,p=!1;if(t.so?(d=o.outlierwidth,h=o.outliercolor,f=i.outliercolor):(d=(t.mlw+1||o.width+1||(t.trace?t.trace.marker.line.width:0)+1)-1,h="mlc"in t?t.mlcc=a(t.mlc):Array.isArray(o.color)?c.defaultLine:o.color,Array.isArray(i.color)&&(f=c.defaultLine,p=!0),f="mc"in t?t.mcc=n(t.mc):i.color||"rgba(0,0,0,0)"),t.om)e.call(c.stroke,f).style({"stroke-width":(d||1)+"px",fill:"none"});else{e.style("stroke-width",d+"px");var g=i.gradient,m=t.mgt;if(m?p=!0:m=g&&g.type,m&&"none"!==m){var x=t.mgc;x?p=!0:x=g.color;var _="g"+s._fullLayout._uid+"-"+r.uid;p&&(_+="-"+t.i),e.call(b.gradient,s,_,m,f,x)}else e.call(c.fill,f);d&&e.call(c.stroke,h)}}function a(t,e,r,n){var a=t[0]-e[0],i=t[1]-e[1],s=r[0]-e[0],l=r[1]-e[1],u=Math.pow(a*a+i*i,T/2),c=Math.pow(s*s+l*l,T/2),f=(c*c*a-u*u*s)*n,h=(c*c*i-u*u*l)*n,d=3*c*(u+c),p=3*u*(u+c);return[[o.round(e[0]+(d&&f/d),2),o.round(e[1]+(d&&h/d),2)],[o.round(e[0]-(p&&f/p),2),o.round(e[1]-(p&&h/p),2)]]}function i(t){var e=t.getAttribute("data-unformatted");if(null!==e)return e+t.getAttribute("data-math")+t.getAttribute("text-anchor")+t.getAttribute("style")}var o=t("d3"),s=t("fast-isnumeric"),l=t("tinycolor2"),u=t("../../registry"),c=t("../color"),f=t("../colorscale"),h=t("../../lib"),d=t("../../lib/svg_text_utils"),p=t("../../constants/xmlns_namespaces"),g=t("../../constants/alignment"),m=g.LINE_SPACING,v=t("../../traces/scatter/subtypes"),y=t("../../traces/scatter/make_bubble_size_func"),b=e.exports={};b.font=function(t,e,r,n){h.isPlainObject(e)&&(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(c.fill,n)},b.setPosition=function(t,e,r){t.attr("x",e).attr("y",r)},b.setSize=function(t,e,r){t.attr("width",e).attr("height",r)},b.setRect=function(t,e,r,n,a){t.call(b.setPosition,e,r).call(b.setSize,n,a)},b.translatePoint=function(t,e,r,n){var a=r.c2p(t.x),i=n.c2p(t.y);return!!(s(a)&&s(i)&&e.node())&&("text"===e.node().nodeName?e.attr("x",a).attr("y",i):e.attr("transform","translate("+a+","+i+")"),!0)},b.translatePoints=function(t,e,r){t.each(function(t){var n=o.select(this);b.translatePoint(t,n,e,r)})},b.hideOutsideRangePoint=function(t,e,r,n){e.attr("display",r.isPtWithinRange(t)&&n.isPtWithinRange(t)?null:"none")},b.hideOutsideRangePoints=function(t,e){if(e._hasClipOnAxisFalse){var r=e.xaxis,n=e.yaxis;t.each(function(t){b.hideOutsideRangePoint(t,o.select(this),r,n)})}},b.getPx=function(t,e){return Number(t.style(e).replace(/px$/,""))},b.crispRound=function(t,e,r){return e&&s(e)?t._context.staticPlot?e:e<1?1:Math.round(e):r||0},b.singleLineStyle=function(t,e,r,n,a){e.style("fill","none");var i=(((t||[])[0]||{}).trace||{}).line||{},o=r||i.width||0,s=a||i.dash||"";c.stroke(e,n||i.color),b.dashLine(e,s,o)},b.lineGroupStyle=function(t,e,r,n){t.style("fill","none").each(function(t){var a=(((t||[])[0]||{}).trace||{}).line||{},i=e||a.width||0,s=n||a.dash||"";o.select(this).call(c.stroke,r||a.color).call(b.dashLine,s,i)})},b.dashLine=function(t,e,r){r=+r||0,e=b.dashStyle(e,r),t.style({"stroke-dasharray":e,"stroke-width":r+"px"})},b.dashStyle=function(t,e){e=+e||1;var r=Math.max(e,3);return"solid"===t?t="":"dot"===t?t=r+"px,"+r+"px":"dash"===t?t=3*r+"px,"+3*r+"px":"longdash"===t?t=5*r+"px,"+5*r+"px":"dashdot"===t?t=3*r+"px,"+r+"px,"+r+"px,"+r+"px":"longdashdot"===t&&(t=5*r+"px,"+2*r+"px,"+r+"px,"+2*r+"px"),t},b.singleFillStyle=function(t){var e=o.select(t.node()),r=e.data(),n=(((r[0]||[])[0]||{}).trace||{}).fillcolor;n&&t.call(c.fill,n)},b.fillGroupStyle=function(t){t.style("stroke-width",0).each(function(e){var r=o.select(this);try{r.call(c.fill,e[0].trace.fillcolor)}catch(e){h.error(e,t),r.remove()}})};var x=t("./symbol_defs");b.symbolNames=[],b.symbolFuncs=[],b.symbolNeedLines={},b.symbolNoDot={},b.symbolList=[],Object.keys(x).forEach(function(t){var e=x[t];b.symbolList=b.symbolList.concat([e.n,t,e.n+100,t+"-open"]),b.symbolNames[e.n]=t,b.symbolFuncs[e.n]=e.f,e.needLine&&(b.symbolNeedLines[e.n]=!0),e.noDot?b.symbolNoDot[e.n]=!0:b.symbolList=b.symbolList.concat([e.n+200,t+"-dot",e.n+300,t+"-open-dot"])});var _=b.symbolNames.length,w="M0,0.5L0.5,0L0,-0.5L-0.5,0Z";b.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=b.symbolNames.indexOf(t),t>=0&&(t+=e)}return t%100>=_||t>=400?0:Math.floor(Math.max(t,0))};var A={x1:1,x2:0,y1:0,y2:0},k={x1:0,x2:0,y1:1,y2:0};b.gradient=function(t,e,r,n,a,i){var s=e._fullLayout._defs.select(".gradients").selectAll("#"+r).data([n+a+i],h.identity);s.exit().remove(),s.enter().append("radial"===n?"radialGradient":"linearGradient").each(function(){var t=o.select(this);"horizontal"===n?t.attr(A):"vertical"===n&&t.attr(k),t.attr("id",r);var e=l(a),s=l(i);t.append("stop").attr({offset:"0%","stop-color":c.tinyRGB(s),"stop-opacity":s.getAlpha()}),t.append("stop").attr({offset:"100%","stop-color":c.tinyRGB(e),"stop-opacity":e.getAlpha()})}),t.style({fill:"url(#"+r+")","fill-opacity":null})},b.initGradients=function(t){var e=t._fullLayout._defs.selectAll(".gradients").data([0]);e.enter().append("g").classed("gradients",!0),e.selectAll("linearGradient,radialGradient").remove()},b.singlePointStyle=function(t,e,r,a,i,o){var s=r.marker;n(t,e,r,a,i,s,s.line,o)},b.pointStyle=function(t,e,r){if(t.size()){var n=e.marker,a=b.tryColorscale(n,""),i=b.tryColorscale(n,"line");t.each(function(t){b.singlePointStyle(t,o.select(this),e,a,i,r)})}},b.tryColorscale=function(t,e){var r=e?h.nestedProperty(t,e).get():t,n=r.colorscale,a=r.color;return n&&Array.isArray(a)?f.makeColorScaleFunc(f.extractScale(n,r.cmin,r.cmax)):h.identity};var M={start:1,end:-1,middle:0,bottom:1,top:-1};b.textPointStyle=function(t,e,r){t.each(function(t){var n=o.select(this),a=t.tx||e.text;if(!a||Array.isArray(a))return void n.remove();var i=t.tp||e.textposition,l=-1!==i.indexOf("top")?"top":-1!==i.indexOf("bottom")?"bottom":"middle",u=-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=s(c)&&c>0?c:0,n.call(b.font,t.tf||e.textfont.family,c,t.tc||e.textfont.color).attr("text-anchor",u).text(a).call(d.convertToTspans,r);var h=o.select(this.parentNode),p=(d.lineCount(n)-1)*m+1,g=M[u]*f,v=.75*c+M[l]*f+(M[l]-1)*p*c/2;h.attr("transform","translate("+g+","+v+")")})};var T=.5;b.smoothopen=function(t,e){if(t.length<3)return"M"+t.join("L");var r,n="M"+t[0],i=[];for(r=1;r=1e4&&(b.savedBBoxes={},S=0),r&&(b.savedBBoxes[r]=v),S++,h.extendFlat({},v)},b.setClipUrl=function(t,e){if(!e)return void t.attr("clip-path",null);var r="#"+e,n=o.select("base");n.size()&&n.attr("href")&&(r=window.location.href.split("#")[0]+r),t.attr("clip-path","url("+r+")")},b.getTranslate=function(t){var e=/.*\btranslate\((-?\d*\.?\d*)[^-\d]*(-?\d*\.?\d*)[^\d].*/,r=t.attr?"attr":"getAttribute",n=t[r]("transform")||"",a=n.replace(e,function(t,e,r){return[e,r].join(" ")}).split(" ");return{x:+a[0]||0,y:+a[1]||0}},b.setTranslate=function(t,e,r){var n=/(\btranslate\(.*?\);?)/,a=t.attr?"attr":"getAttribute",i=t.attr?"attr":"setAttribute",o=t[a]("transform")||"";return e=e||0,r=r||0,o=o.replace(n,"").trim(),o+=" translate("+e+", "+r+")",o=o.trim(),t[i]("transform",o),o},b.getScale=function(t){var e=/.*\bscale\((\d*\.?\d*)[^\d]*(\d*\.?\d*)[^\d].*/,r=t.attr?"attr":"getAttribute",n=t[r]("transform")||"",a=n.replace(e,function(t,e,r){return[e,r].join(" ")}).split(" ");return{x:+a[0]||1,y:+a[1]||1}},b.setScale=function(t,e,r){var n=/(\bscale\(.*?\);?)/,a=t.attr?"attr":"getAttribute",i=t.attr?"attr":"setAttribute",o=t[a]("transform")||"";return e=e||1,r=r||1,o=o.replace(n,"").trim(),o+=" scale("+e+", "+r+")",o=o.trim(),t[i]("transform",o),o},b.setPointGroupScale=function(t,e,r){var n,a,i;return e=e||1,r=r||1,a=1===e&&1===r?"":" scale("+e+","+r+")",i=/\s*sc.*/,t.each(function(){n=(this.getAttribute("transform")||"").replace(i,""),n+=a,n=n.trim(),this.setAttribute("transform",n)}),a};var C=/translate\([^)]*\)\s*$/;b.setTextPointsScale=function(t,e,r){t.each(function(){var t,n=o.select(this),a=n.select("text"),i=parseFloat(a.attr("x")||0),s=parseFloat(a.attr("y")||0),l=(n.attr("transform")||"").match(C);t=1===e&&1===r?[]:["translate("+i+","+s+")","scale("+e+","+r+")","translate("+-i+","+-s+")"],l&&t.push(l),n.attr("transform",t.join(" "))})}},{"../../constants/alignment":329,"../../constants/xmlns_namespaces":335,"../../lib":350,"../../lib/svg_text_utils":369,"../../registry":429,"../../traces/scatter/make_bubble_size_func":499,"../../traces/scatter/subtypes":504,"../color":233,"../colorscale":247,"./symbol_defs":258,d3:62,"fast-isnumeric":68,tinycolor2:200}],258:[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,a="l"+e+",-"+e,i="l-"+e+",-"+e,o="l-"+e+","+e;return"M0,"+e+r+a+i+a+i+o+i+o+r+o+r+"Z"}},"triangle-up":{n:5,f:function(t){var e=n.round(2*t/Math.sqrt(3),2);return"M-"+e+","+n.round(t/2,2)+"H"+e+"L0,-"+n.round(t,2)+"Z"}},"triangle-down":{n:6,f:function(t){var e=n.round(2*t/Math.sqrt(3),2);return"M-"+e+",-"+n.round(t/2,2)+"H"+e+"L0,"+n.round(t,2)+"Z"}},"triangle-left":{n:7,f:function(t){var e=n.round(2*t/Math.sqrt(3),2);return"M"+n.round(t/2,2)+",-"+e+"V"+e+"L-"+n.round(t,2)+",0Z"}},"triangle-right":{n:8,f:function(t){var e=n.round(2*t/Math.sqrt(3),2);return"M-"+n.round(t/2,2)+",-"+e+"V"+e+"L"+n.round(t,2)+",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),a=n.round(-t,2),i=n.round(-.309*t,2);return"M"+e+","+i+"L"+r+","+n.round(.809*t,2)+"H-"+r+"L-"+e+","+i+"L0,"+a+"Z"}},hexagon:{n:14,f:function(t){var e=n.round(t,2),r=n.round(t/2,2),a=n.round(t*Math.sqrt(3)/2,2);return"M"+a+",-"+r+"V"+r+"L0,"+e+"L-"+a+","+r+"V-"+r+"L0,-"+e+"Z"}},hexagon2:{n:15,f:function(t){var e=n.round(t,2),r=n.round(t/2,2),a=n.round(t*Math.sqrt(3)/2,2);return"M-"+r+","+a+"H"+r+"L"+e+",0L"+r+",-"+a+"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),a=n.round(.951*e,2),i=n.round(.363*e,2),o=n.round(.588*e,2),s=n.round(-e,2),l=n.round(-.309*e,2),u=n.round(.118*e,2),c=n.round(.809*e,2);return"M"+r+","+l+"H"+a+"L"+i+","+u+"L"+o+","+c+"L0,"+n.round(.382*e,2)+"L-"+o+","+c+"L-"+i+","+u+"L-"+a+","+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),a=n.round(.76*t,2);return"M-"+a+",0l-"+r+",-"+e+"h"+a+"l"+r+",-"+e+"l"+r+","+e+"h"+a+"l-"+r+","+e+"l"+r+","+e+"h-"+a+"l-"+r+","+e+"l-"+r+",-"+e+"h-"+a+"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),a=n.round(1.6*t,2),i=n.round(4*t,2),o="A "+i+","+i+" 0 0 1 ";return"M-"+e+","+r+o+e+","+r+o+"0,-"+a+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),a=n.round(1.6*t,2),i=n.round(4*t,2),o="A "+i+","+i+" 0 0 1 ";return"M"+e+",-"+r+o+"-"+e+",-"+r+o+"0,"+a+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),a="A "+r+","+r+" 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=n.round(1.4*t,2),r=n.round(1.9*t,2),a="A "+r+","+r+" 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=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),a=n.round(.8*t,2);return"M-"+e+","+a+"L0,0M"+e+","+a+"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),a=n.round(.8*t,2);return"M-"+e+",-"+a+"L0,0M"+e+",-"+a+"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),a=n.round(.8*t,2);return"M"+a+","+e+"L0,0M"+a+",-"+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),a=n.round(.8*t,2);return"M-"+a+","+e+"L0,0M-"+a+",-"+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}],259:[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"}}}},{}],260:[function(t,e,r){"use strict";function n(t,e,r,n){var i=e["error_"+n]||{},l=i.visible&&-1!==["linear","log"].indexOf(r.type),u=[];if(l){for(var c=s(i),f=0;f0;t.each(function(t){var h,d=t[0].trace,p=d.error_x||{},g=d.error_y||{};d.ids&&(h=function(t){return t.id});var m=s.hasMarkers(d)&&d.marker.maxdisplayed>0;if(g.visible||p.visible){var v=a.select(this).selectAll("g.errorbar").data(t,h);v.exit().remove(),v.style("opacity",1);var y=v.enter().append("g").classed("errorbar",!0);f&&y.style("opacity",0).transition().duration(r.duration).style("opacity",1),o.setClipUrl(v,e.layerClipId),v.each(function(t){var e=a.select(this),o=n(t,u,c);if(!m||t.vis){var s;if(g.visible&&i(o.x)&&i(o.yh)&&i(o.ys)){var h=g.width;s="M"+(o.x-h)+","+o.yh+"h"+2*h+"m-"+h+",0V"+o.ys,o.noYS||(s+="m-"+h+",0h"+2*h);var d=e.select("path.yerror");l=!d.size(),l?d=e.append("path").style("vector-effect","non-scaling-stroke").classed("yerror",!0):f&&(d=d.transition().duration(r.duration).ease(r.easing)),d.attr("d",s)}if(p.visible&&i(o.y)&&i(o.xh)&&i(o.xs)){var v=(p.copy_ystyle?g:p).width;s="M"+o.xh+","+(o.y-v)+"v"+2*v+"m0,-"+v+"H"+o.xs,o.noXS||(s+="m0,-"+v+"v"+2*v);var y=e.select("path.xerror");l=!y.size(),l?y=e.append("path").style("vector-effect","non-scaling-stroke").classed("xerror",!0):f&&(y=y.transition().duration(r.duration).ease(r.easing)),y.attr("d",s)}}})}})}},{"../../traces/scatter/subtypes":504,"../drawing":257,d3:62,"fast-isnumeric":68}],265:[function(t,e,r){"use strict";var n=t("d3"),a=t("../color");e.exports=function(t){t.each(function(t){var e=t[0].trace,r=e.error_y||{},i=e.error_x||{},o=n.select(this);o.selectAll("path.yerror").style("stroke-width",r.thickness+"px").call(a.stroke,r.color),i.copy_ystyle&&(i=r),o.selectAll("path.xerror").style("stroke-width",i.thickness+"px").call(a.stroke,i.color)})}},{"../color":233,d3:62}],266:[function(t,e,r){"use strict";var n=t("../../lib/extend").extendFlat,a=t("../../plots/font_attributes");e.exports={hoverlabel:{bgcolor:{valType:"color",arrayOk:!0},bordercolor:{valType:"color",arrayOk:!0},font:{family:n({},a.family,{arrayOk:!0}),size:n({},a.size,{arrayOk:!0}),color:n({},a.color,{arrayOk:!0})},namelength:{valType:"integer",min:-1,arrayOk:!0}}}},{"../../lib/extend":343,"../../plots/font_attributes":413}],267:[function(t,e,r){"use strict";function n(t,e,r,n){n=n||a.identity,Array.isArray(t)&&(e[0][r]=n(t))}var a=t("../../lib"),i=t("../../registry");e.exports=function(t){for(var e=t.calcdata,r=t._fullLayout,o=0;o=0&&r.indexK.width||Q<0||Q>K.height)return b.unhoverRaw(t,e)}if(D="xval"in e?w.flat(h,e.xval):w.p2c(E,Z),P="yval"in e?w.flat(h,e.yval):w.p2c(L,Q),!f(D[0])||!f(P[0]))return d.warn("Fx.hover failed",e,t),b.unhoverRaw(t,e)}var J=1/0;for(N=0;NX&&(Y.splice(0,X),J=Y[0].distance)}if(0===Y.length)return b.unhoverRaw(t,e);Y.sort(function(t,e){return t.distance-e.distance});var at=t._hoverdata,it=[];for(z=0;z1,ut=y.combine(g.plot_bgcolor||y.background,g.paper_bgcolor),ct={hovermode:R,rotateLabels:lt,bgColor:ut,container:g._hoverlayer,outerContainer:g._paperdiv,commonLabelOpts:g.hoverlabel},ft=a(Y,ct,t);if(i(Y,lt?"xa":"ya"),o(ft,lt),e.target&&e.target.tagName){var ht=_.getComponentMethod("annotations","hasClickToShow")(t,it);m(c.select(e.target),ht?"pointer":"")}e.target&&!n&&u(t,e,at)&&(at&&t.emit("plotly_unhover",{event:e,points:at}),t.emit("plotly_hover",{event:e,points:t._hoverdata,xaxes:E,yaxes:L,xvals:D,yvals:P}))}function a(t,e,r){var n,a,i=e.hovermode,o=e.rotateLabels,s=e.bgColor,l=e.container,u=e.outerContainer,f=e.commonLabelOpts||{},h=e.fontFamily||A.HOVERFONT,d=e.fontSize||A.HOVERFONTSIZE,p=t[0],m=p.xa,b=p.ya,x="y"===i?"yLabel":"xLabel",_=p[x],w=(String(_)||"").split(" ")[0],M=u.node().getBoundingClientRect(),T=M.top,E=M.width,L=M.height,O=p.distance<=A.MAXDIST&&("x"===i||"y"===i);for(n=0;n-1&&n.length>p&&(n=p>3?n.substr(0,p-3)+"...":n.substr(0,p))}void 0!==t.extraText&&(a+=t.extraText),void 0!==t.zLabel?(void 0!==t.xLabel&&(a+="x: "+t.xLabel+"
"),void 0!==t.yLabel&&(a+="y: "+t.yLabel+"
"),a+=(a?"z: ":"")+t.zLabel):O&&t[i+"Label"]===_?a=t[("x"===i?"y":"x")+"Label"]||"":void 0===t.xLabel?void 0!==t.yLabel&&(a=t.yLabel):a=void 0===t.yLabel?t.xLabel:"("+t.xLabel+", "+t.yLabel+")",t.text&&!Array.isArray(t.text)&&(a+=(a?"
":"")+t.text),""===a&&(""===n&&e.remove(),a=n);var m=e.select("text.nums").call(v.font,t.fontFamily||h,t.fontSize||d,t.fontColor||f).text(a).attr("data-notex",1).call(g.positionText,0,0).call(g.convertToTspans,r),b=e.select("text.name"),x=0;n&&n!==a?(b.call(v.font,t.fontFamily||h,t.fontSize||d,u).text(n).attr("data-notex",1).call(g.positionText,0,0).call(g.convertToTspans,r),x=b.node().getBoundingClientRect().width+2*C):(b.remove(),e.select("rect").remove()),e.select("path").style({fill:u,stroke:f});var w,A,M=m.node().getBoundingClientRect(),I=t.xa._offset+(t.x0+t.x1)/2,R=t.ya._offset+(t.y0+t.y1)/2,D=Math.abs(t.x1-t.x0),P=Math.abs(t.y1-t.y0),z=M.width+S+C+x;t.ty0=T-M.top,t.bx=M.width+2*C,t.by=M.height+2*C,t.anchor="start",t.txwidth=M.width,t.tx2width=x,t.offset=0,o?(t.pos=I,w=R+P/2+z<=L,A=R-P/2-z>=0,"top"!==t.idealAlign&&w||!A?w?(R+=P/2,t.anchor="start"):t.anchor="middle":(R-=P/2,t.anchor="end")):(t.pos=R,w=I+D/2+z<=E,A=I-D/2-z>=0,"left"!==t.idealAlign&&w||!A?w?(I+=D/2,t.anchor="start"):t.anchor="middle":(I-=D/2,t.anchor="end")),m.attr("text-anchor",t.anchor),x&&b.attr("text-anchor",t.anchor),e.attr("transform","translate("+I+","+R+")"+(o?"rotate("+k+")":""))}),D}function i(t,e){function r(t){var e=t[0],r=t[t.length-1];if(a=e.pmin-e.pos-e.dp+e.size,i=r.pos+r.dp+r.size-e.pmax,a>.01){for(s=t.length-1;s>=0;s--)t[s].dp+=a;n=!1}if(!(i<.01)){if(a<-.01){for(s=t.length-1;s>=0;s--)t[s].dp-=i;n=!1}if(n){var u=0;for(o=0;oe.pmax&&u++;for(o=t.length-1;o>=0&&!(u<=0);o--)l=t[o],l.pos>e.pmax-1&&(l.del=!0,u--);for(o=0;o=0;s--)t[s].dp-=i;for(o=t.length-1;o>=0&&!(u<=0);o--)l=t[o],l.pos+l.dp+l.size>e.pmax&&(l.del=!0,u--)}}}for(var n,a,i,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)?T: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+=a;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(i=u/h.length,s=h.length-1;s>=0;s--)h[s].dp-=i;n=!1}else o++}f.forEach(r)}for(o=f.length-1;o>=0;o--){var m=f[o];for(s=m.length-1;s>=0;s--){var v=m[s],y=t[v.i];y.offset=v.dp,y.del=v.del}}}function o(t,e){t.each(function(t){var r=c.select(this);if(t.del)return void r.remove();var n="end"===t.anchor?-1:1,a=r.select("text.nums"),i={start:1,end:-1,middle:0}[t.anchor],o=i*(S+C),s=o+i*(t.txwidth+C),l=0,u=t.offset;"middle"===t.anchor&&(o-=t.tx2width/2,s-=t.tx2width/2),e&&(u*=-L,l=t.offset*E),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*S+l)+","+(S+u)+"v"+(t.by/2-S)+"h"+n*t.bx+"v-"+t.by+"H"+(n*S+l)+"V"+(u-S)+"Z"),a.call(g.positionText,o+l,u+t.ty0-t.by/2+C),t.tx2width&&(r.select("text.name").call(g.positionText,s+i*C+l,u+t.ty0-t.by/2+C),r.select("rect").call(v.setRect,s+(i-1)*t.tx2width/2+l,u-t.by/2-1,t.tx2width,t.by+2))})}function s(t,e){function r(e,r,o){var s;if(i[r])s=i[r];else if(a[r]){var l=a[r];Array.isArray(l)&&Array.isArray(l[t.index[0]])&&(s=l[t.index[0]][t.index[1]])}else s=d.nestedProperty(n,o).get();s&&(t[e]=s)}var n=t.trace||{},a=t.cd[0],i=t.cd[t.index]||{};r("hoverinfo","hi","hoverinfo"),r("color","hbg","hoverlabel.bgcolor"),r("borderColor","hbc","hoverlabel.bordercolor"),r("fontFamily","htf","hoverlabel.font.family"),r("fontSize","hts","hoverlabel.font.size"),r("fontColor","htc","hoverlabel.font.color"),r("nameLength","hnl","hoverlabel.namelength"),t.posref="y"===e?(t.x0+t.x1)/2:(t.y0+t.y1)/2,t.x0=d.constrain(t.x0,0,t.xa._length),t.x1=d.constrain(t.x1,0,t.xa._length),t.y0=d.constrain(t.y0,0,t.ya._length),t.y1=d.constrain(t.y1,0,t.ya._length);var o;if(void 0!==t.xLabelVal){o="log"===t.xa.type&&t.xLabelVal<=0;var s=x.tickText(t.xa,t.xa.c2l(o?-t.xLabelVal:t.xLabelVal),"hover");o?0===t.xLabelVal?t.xLabel="0":t.xLabel="-"+s.text:t.xLabel=s.text,t.xVal=t.xa.c2d(t.xLabelVal)}if(void 0!==t.yLabelVal){o="log"===t.ya.type&&t.yLabelVal<=0;var l=x.tickText(t.ya,t.ya.c2l(o?-t.yLabelVal:t.yLabelVal),"hover");o?0===t.yLabelVal?t.yLabel="0":t.yLabel="-"+l.text:t.yLabel=l.text,t.yVal=t.ya.c2d(t.yLabelVal)}if(void 0!==t.zLabelVal&&(t.zLabel=String(t.zLabelVal)),!(isNaN(t.xerr)||"log"===t.xa.type&&t.xerr<=0)){var u=x.tickText(t.xa,t.xa.c2l(t.xerr),"hover").text;void 0!==t.xerrneg?t.xLabel+=" +"+u+" / -"+x.tickText(t.xa,t.xa.c2l(t.xerrneg),"hover").text:t.xLabel+=" \xb1 "+u,"x"===e&&(t.distance+=1)}if(!(isNaN(t.yerr)||"log"===t.ya.type&&t.yerr<=0)){var c=x.tickText(t.ya,t.ya.c2l(t.yerr),"hover").text;void 0!==t.yerrneg?t.yLabel+=" +"+c+" / -"+x.tickText(t.ya,t.ya.c2l(t.yerrneg),"hover").text:t.yLabel+=" \xb1 "+c,"y"===e&&(t.distance+=1)}var f=t.hoverinfo||t.trace.hoverinfo;return"all"!==f&&(f=f.split("+"),-1===f.indexOf("x")&&(t.xLabel=void 0),-1===f.indexOf("y")&&(t.yLabel=void 0),-1===f.indexOf("z")&&(t.zLabel=void 0),-1===f.indexOf("text")&&(t.text=void 0),-1===f.indexOf("name")&&(t.name=void 0)),t}function l(t,e){var r=e.hovermode,n=e.container,a=t[0],i=a.xa,o=a.ya,s=i.showspikes,l=o.showspikes;if(n.selectAll(".spikeline").remove(),"closest"===r&&(s||l)){var u=e.fullLayout,c=i._offset+(a.x0+a.x1)/2,f=o._offset+(a.y0+a.y1)/2,d=y.combine(u.plot_bgcolor,u.paper_bgcolor),p=h.readability(a.color,d)<1.5?y.contrast(d):a.color;if(l){var g=o.spikemode,m=o.spikethickness,b=o.spikecolor||p,x=o._boundingBox,_=(x.left+x.right)/2=0;n--){var a=r[n],i=t._hoverdata[n];if(a.curveNumber!==i.curveNumber||String(a.pointNumber)!==String(i.pointNumber))return!0}return!1}var c=t("d3"),f=t("fast-isnumeric"),h=t("tinycolor2"),d=t("../../lib"),p=t("../../lib/events"),g=t("../../lib/svg_text_utils"),m=t("../../lib/override_cursor"),v=t("../drawing"),y=t("../color"),b=t("../dragelement"),x=t("../../plots/cartesian/axes"),_=t("../../registry"),w=t("./helpers"),A=t("./constants"),k=A.YANGLE,M=Math.PI*k/180,T=1/Math.sin(M),E=Math.cos(M),L=Math.sin(M),S=A.HOVERARROWSIZE,C=A.HOVERTEXTPAD;r.hover=function(t,e,r,a){if("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+A.HOVERMINTIME)return n(t,e,r,a),void(t._lastHoverTime=Date.now());t._hoverTimer=setTimeout(function(){n(t,e,r,a),t._lastHoverTime=Date.now(),t._hoverTimer=void 0},A.HOVERMINTIME)},r.loneHover=function(t,e){var r={color:t.color||y.defaultLine,x0:t.x0||t.x||0,x1:t.x1||t.x||0,y0:t.y0||t.y||0,y1:t.y1||t.y||0,xLabel:t.xLabel,yLabel:t.yLabel,zLabel:t.zLabel,text:t.text,name:t.name,idealAlign:t.idealAlign,borderColor:t.borderColor,fontFamily:t.fontFamily,fontSize:t.fontSize,fontColor:t.fontColor,trace:{index:0,hoverinfo:""},xa:{_offset:0},ya:{_offset:0},index:0},n=c.select(e.container),i=e.outerContainer?c.select(e.outerContainer):n,s={hovermode:"closest",rotateLabels:!1,bgColor:e.bgColor||y.background,container:n,outerContainer:i},l=a([r],s,e.gd);return o(l,s.rotateLabels),l.node()}},{"../../lib":350,"../../lib/events":342,"../../lib/override_cursor":359,"../../lib/svg_text_utils":369,"../../plots/cartesian/axes":389,"../../registry":429,"../color":233,"../dragelement":254,"../drawing":257,"./constants":269,"./helpers":271,d3:62,"fast-isnumeric":68,tinycolor2:200}],273:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function(t,e,r,a){a=a||{},r("hoverlabel.bgcolor",a.bgcolor),r("hoverlabel.bordercolor",a.bordercolor),r("hoverlabel.namelength",a.namelength),n.coerceFont(r,"hoverlabel.font",a.font)}},{"../../lib":350}],274:[function(t,e,r){"use strict";function n(t){var e=s.isD3Selection(t)?t:o.select(t);e.selectAll("g.hovertext").remove(),e.selectAll(".spikeline").remove()}function a(t,e,r){return s.castOption(t,e,"hoverlabel."+r)}function i(t,e,r){function n(r){return s.coerceHoverinfo({hoverinfo:r},{_module:t._module},e)}return s.castOption(t,r,"hoverinfo",n)}var o=t("d3"),s=t("../../lib"),l=t("../dragelement"),u=t("./helpers"),c=t("./layout_attributes");e.exports={moduleType:"component",name:"fx",constants:t("./constants"),schema:{layout:c},attributes:t("./attributes"),layoutAttributes:c,supplyLayoutGlobalDefaults:t("./layout_global_defaults"),supplyDefaults:t("./defaults"),supplyLayoutDefaults:t("./layout_defaults"),calc:t("./calc"),getDistanceFunction:u.getDistanceFunction,getClosest:u.getClosest,inbox:u.inbox,appendArrayPointValue:u.appendArrayPointValue,castHoverOption:a,castHoverinfo:i,hover:t("./hover").hover,unhover:l.unhover,loneHover:t("./hover").loneHover,loneUnhover:n,click:t("./click")}},{"../../lib":350,"../dragelement":254,"./attributes":266,"./calc":267,"./click":268,"./constants":269,"./defaults":270,"./helpers":271,"./hover":272,"./layout_attributes":275,"./layout_defaults":276,"./layout_global_defaults":277,d3:62}],275:[function(t,e,r){"use strict";var n=t("../../lib/extend").extendFlat,a=t("../../plots/font_attributes"),i=t("./constants");e.exports={dragmode:{valType:"enumerated",values:["zoom","pan","select","lasso","orbit","turntable"],dflt:"zoom"},hovermode:{valType:"enumerated",values:["x","y","closest",!1]},hoverlabel:{bgcolor:{valType:"color"},bordercolor:{valType:"color"},font:{family:n({},a.family,{dflt:i.HOVERFONT}),size:n({},a.size,{dflt:i.HOVERFONTSIZE}),color:n({},a.color)},namelength:{valType:"integer",min:-1,dflt:15}}}},{"../../lib/extend":343,"../../plots/font_attributes":413,"./constants":269}],276:[function(t,e,r){"use strict";function n(t){for(var e=!0,r=0;r=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}},{}],284:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),a=t("../color/attributes"),i=t("../../lib/extend").extendFlat;e.exports={bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:a.defaultLine},borderwidth:{valType:"number",min:0,dflt:0},font:i({},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":343,"../../plots/font_attributes":413,"../color/attributes":232}],285:[function(t,e,r){"use strict";e.exports={scrollBarWidth:4,scrollBarHeight:20,scrollBarColor:"#808BA4",scrollBarMargin:4}},{}],286:[function(t,e,r){"use strict";var n=t("../../registry"),a=t("../../lib"),i=t("./attributes"),o=t("../../plots/layout_attributes"),s=t("./helpers");e.exports=function(t,e,r){function l(t,e){return a.coerce(d,p,i,t,e)}for(var u,c,f,h,d=t.legend||{},p=e.legend={},g=0,m="normal",v=0;v1)){if(l("bgcolor",e.paper_bgcolor),l("bordercolor"),l("borderwidth"),a.coerceFont(l,"font",e.font),l("orientation"),"h"===p.orientation){var b=t.xaxis;b&&b.rangeslider&&b.rangeslider.visible?(u=0,f="left",c=1.1,h="bottom"):(u=0,f="left",c=-.1,h="top")}l("traceorder",m),s.isGrouped(e.legend)&&l("tracegroupgap"),l("x",u),l("xanchor",f),l("y",c),l("yanchor",h),a.noneOrAll(d,p,["x","y"])}}},{"../../lib":350,"../../plots/layout_attributes":420,"../../registry":429,"./attributes":284,"./helpers":289}],287:[function(t,e,r){"use strict";function n(t,e){function r(r){y.convertToTspans(r,e,function(){o(t,e)})}var n=t.data()[0][0],a=e._fullLayout,i=n.trace,s=p.traceIs(i,"pie"),l=i.index,u=s?n.label:i.name,c=t.selectAll("text.legendtext").data([0]);c.enter().append("text").classed("legendtext",!0),c.attr("text-anchor","start").classed("user-select-none",!0).call(m.font,a.legend.font).text(u),e._context.edits.legendText&&!s?c.call(y.makeEditable,{gd:e}).call(r).on("edit",function(t){this.text(t).call(r),this.text()||(t=" ");var a,i=n.trace._fullInput||{};if(-1!==["ohlc","candlestick"].indexOf(i.type)){var o=n.trace.transforms;a=o[o.length-1].direction+".name"}else a="name";f.restyle(e,a,t,l)}):c.call(r)}function a(t,e){var r,n=1,a=t.selectAll("rect").data([0]);a.enter().append("rect").classed("legendtoggle",!0).style("cursor","pointer").attr("pointer-events","all").call(v.fill,"rgba(0,0,0,0)"),a.on("mousedown",function(){r=(new Date).getTime(),r-e._legendMouseDownTimeE&&(n=Math.max(n-1,1)),1===n?r._clickTimeout=setTimeout(function(){i(t,e,n)},E):2===n&&(r._clickTimeout&&clearTimeout(r._clickTimeout),e._legendMouseDownTime=0,i(t,e,n))}})}function i(t,e,r){if(!e._dragged&&!e._editing){var n,a,i=e._fullLayout.hiddenlabels?e._fullLayout.hiddenlabels.slice():[],o=t.data()[0][0],s=e._fullData,l=o.trace,u=l.legendgroup,c=[];if(1===r&&T&&e.data&&e._context.showTips?(h.notifier("Double click on legend to isolate individual trace","long"),T=!1):T=!1,p.traceIs(l,"pie")){var d=o.label,g=i.indexOf(d);1===r?-1===g?i.push(d):i.splice(g,1):2===r&&(i=[],e.calcdata[0].forEach(function(t){d!==t.label&&i.push(t.label)}),e._fullLayout.hiddenlabels&&e._fullLayout.hiddenlabels.length===i.length&&-1===g&&(i=[])),f.relayout(e,"hiddenlabels",i)}else{var m,v=[],y=[];for(m=0;mn.width-(n.margin.r+n.margin.l)&&(b=0,g+=v,a.height=a.height+v,v=0),m.setTranslate(this,i+b,5+i+e.height/2+g),a.width+=o+r,a.height=Math.max(a.height,e.height),b+=o+r,v=Math.max(e.height,v)}),a.width+=2*i,a.height+=10+2*i}a.width=Math.ceil(a.width),a.height=Math.ceil(a.height),r.each(function(e){var r=e[0];c.select(this).select(".legendtoggle").call(m.setRect,0,-r.height/2,(t._context.edits.legendText?0:a.width)+s,r.height)})}function l(t){var e=t._fullLayout,r=e.legend,n="left";M.isRightAnchor(r)?n="right":M.isCenterAnchor(r)&&(n="center");var a="top";M.isBottomAnchor(r)?a="bottom":M.isMiddleAnchor(r)&&(a="middle"),d.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}[a]||0),t:r.height*({bottom:1,middle:.5}[a]||0)})}function u(t){var e=t._fullLayout,r=e.legend,n="left";M.isRightAnchor(r)?n="right":M.isCenterAnchor(r)&&(n="center"),d.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 c=t("d3"),f=t("../../plotly"),h=t("../../lib"),d=t("../../plots/plots"),p=t("../../registry"),g=t("../dragelement"),m=t("../drawing"),v=t("../color"),y=t("../../lib/svg_text_utils"),b=t("./constants"),x=t("../../constants/interactions"),_=t("../../constants/alignment").LINE_SPACING,w=t("./get_legend_data"),A=t("./style"),k=t("./helpers"),M=t("./anchor_utils"),T=!0,E=x.DBLCLICKDELAY;e.exports=function(t){function e(t,e){S.attr("data-scroll",e).call(m.setTranslate,0,e),C.call(m.setRect,B,t,b.scrollBarWidth,b.scrollBarHeight),T.select("rect").attr({y:y.borderwidth-e})}var r=t._fullLayout,o="legend"+r._uid;if(r._infolayer&&t.calcdata){t._legendMouseDownTime||(t._legendMouseDownTime=0);var y=r.legend,x=r.showlegend&&w(t.calcdata,y),_=r.hiddenlabels||[];if(!r.showlegend||!x.length)return r._infolayer.selectAll(".legend").remove(),r._topdefs.select("#"+o).remove(),void d.autoMargin(t,"legend");var k=r._infolayer.selectAll("g.legend").data([0]);k.enter().append("g").attr({class:"legend","pointer-events":"all"});var T=r._topdefs.selectAll("#"+o).data([0]);T.enter().append("clipPath").attr("id",o).append("rect");var L=k.selectAll("rect.bg").data([0]);L.enter().append("rect").attr({class:"bg","shape-rendering":"crispEdges"}),L.call(v.stroke,y.bordercolor),L.call(v.fill,y.bgcolor),L.style("stroke-width",y.borderwidth+"px");var S=k.selectAll("g.scrollbox").data([0]);S.enter().append("g").attr("class","scrollbox");var C=k.selectAll("rect.scrollbar").data([0]);C.enter().append("rect").attr({class:"scrollbar",rx:20,ry:2,width:0,height:0}).call(v.fill,"#808BA4");var O=S.selectAll("g.groups").data(x);O.enter().append("g").attr("class","groups"),O.exit().remove();var I=O.selectAll("g.traces").data(h.identity);I.enter().append("g").attr("class","traces"),I.exit().remove(),I.call(A,t).style("opacity",function(t){var e=t[0].trace;return p.traceIs(e,"pie")?-1!==_.indexOf(t[0].label)?.5:1:"legendonly"===e.visible?.5:1}).each(function(){c.select(this).call(n,t).call(a,t)});var R=0!==k.enter().size();R&&(s(t,O,I),l(t));var D=r.width,P=r.height;s(t,O,I),y.height>P?u(t):l(t);var z=r._size,N=z.l+z.w*y.x,F=z.t+z.h*(1-y.y);M.isRightAnchor(y)?N-=y.width:M.isCenterAnchor(y)&&(N-=y.width/2),M.isBottomAnchor(y)?F-=y.height:M.isMiddleAnchor(y)&&(F-=y.height/2);var B=y.width,j=z.w;B>j?(N=z.l,B=j):(N+B>D&&(N=D-B),N<0&&(N=0),B=Math.min(D-N,y.width));var H=y.height,U=z.h;H>U?(F=z.t,H=U):(F+H>P&&(F=P-H),F<0&&(F=0),H=Math.min(P-F,y.height)),m.setTranslate(k,N,F);var V,G,q=H-b.scrollBarHeight-2*b.scrollBarMargin,X=y.height-H;if(y.height<=H||t._context.staticPlot)L.attr({width:B-y.borderwidth,height:H-y.borderwidth,x:y.borderwidth/2,y:y.borderwidth/2}),m.setTranslate(S,0,0),T.select("rect").attr({width:B-2*y.borderwidth,height:H-2*y.borderwidth,x:y.borderwidth,y:y.borderwidth}),S.call(m.setClipUrl,o);else{V=b.scrollBarMargin,G=S.attr("data-scroll")||0,L.attr({width:B-2*y.borderwidth+b.scrollBarWidth+b.scrollBarMargin,height:H-y.borderwidth,x:y.borderwidth/2,y:y.borderwidth/2}),T.select("rect").attr({width:B-2*y.borderwidth+b.scrollBarWidth+b.scrollBarMargin,height:H-2*y.borderwidth,x:y.borderwidth,y:y.borderwidth-G}),S.call(m.setClipUrl,o),R&&e(V,G),k.on("wheel",null),k.on("wheel",function(){G=h.constrain(S.attr("data-scroll")-c.event.deltaY/q*X,-X,0),V=b.scrollBarMargin-G/X*q,e(V,G),0!==G&&G!==-X&&c.event.preventDefault()}),C.on(".drag",null),S.on(".drag",null);var Y=c.behavior.drag().on("drag",function(){V=h.constrain(c.event.y-b.scrollBarHeight/2,b.scrollBarMargin,b.scrollBarMargin+q),G=-(V-b.scrollBarMargin)/q*X,e(V,G)});C.call(Y),S.call(Y)}if(t._context.edits.legendPosition){var W,Z,Q,$;k.classed("cursor-move",!0),g.init({element:k.node(),gd:t,prepFn:function(){var t=m.getTranslate(k);Q=t.x,$=t.y},moveFn:function(t,e){var r=Q+t,n=$+e;m.setTranslate(k,r,n),W=g.align(r,0,z.l,z.l+z.w,y.xanchor),Z=g.align(n,0,z.t+z.h,z.t,y.yanchor)},doneFn:function(e,n,a){if(e&&void 0!==W&&void 0!==Z)f.relayout(t,{"legend.x":W,"legend.y":Z});else{var o=r._infolayer.selectAll("g.traces").filter(function(){var t=this.getBoundingClientRect();return a.clientX>=t.left&&a.clientX<=t.right&&a.clientY>=t.top&&a.clientY<=t.bottom});o.size()>0&&(1===n?k._clickTimeout=setTimeout(function(){i(o,t,n)},E):2===n&&(k._clickTimeout&&clearTimeout(k._clickTimeout),i(o,t,n)))}}})}}}},{"../../constants/alignment":329,"../../constants/interactions":332,"../../lib":350,"../../lib/svg_text_utils":369,"../../plotly":384,"../../plots/plots":422,"../../registry":429,"../color":233,"../dragelement":254,"../drawing":257,"./anchor_utils":283,"./constants":285,"./get_legend_data":288,"./helpers":289,"./style":291,d3:62}],288:[function(t,e,r){"use strict";var n=t("../../registry"),a=t("./helpers");e.exports=function(t,e){function r(t,r){if(""!==t&&a.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 i,o,s={},l=[],u=!1,c={},f=0;for(i=0;ir[1])return r[1]}return a}function a(t){return t[0]}var s,u,c=t[0],f=c.trace,h=l.hasMarkers(f),d=l.hasText(f),p=l.hasLines(f);if(h||d||p){var g={},m={};h&&(g.mc=r("marker.color",a),g.mo=r("marker.opacity",i.mean,[.2,1]),g.ms=r("marker.size",i.mean,[2,16]),g.mlc=r("marker.line.color",a),g.mlw=r("marker.line.width",i.mean,[0,5]),m.marker={sizeref:1,sizemin:1,sizemode:"diameter"}),p&&(m.line={width:r("line.width",a,[0,10])}),d&&(g.tx="Aa",g.tp=r("textposition",a),g.ts=10,g.tc=r("textfont.color",a),g.tf=r("textfont.family",a)),s=[i.minExtend(c,g)],u=i.minExtend(f,m)}var v=n.select(this).select("g.legendpoints"),y=v.selectAll("path.scatterpts").data(h?s:[]);y.enter().append("path").classed("scatterpts",!0).attr("transform","translate(20,0)"),y.exit().remove(),y.call(o.pointStyle,u,e),h&&(s[0].mrc=3);var b=v.selectAll("g.pointtext").data(d?s:[]);b.enter().append("g").classed("pointtext",!0).append("text").attr("transform","translate(20,0)"),b.exit().remove(),b.selectAll("text").call(o.textPointStyle,u,e)}function f(t){var e=t[0].trace,r=e.marker||{},i=r.line||{},o=n.select(this).select("g.legendpoints").selectAll("path.legendbar").data(a.traceIs(e,"bar")?[t]:[]);o.enter().append("path").classed("legendbar",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),o.exit().remove(),o.each(function(t){var e=n.select(this),a=t[0],o=(a.mlw+1||i.width+1)-1;e.style("stroke-width",o+"px").call(s.fill,a.mc||r.color),o&&e.call(s.stroke,a.mlc||i.color)})}function h(t){var e=t[0].trace,r=n.select(this).select("g.legendpoints").selectAll("path.legendbox").data(a.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(){var t=e.line.width,r=n.select(this);r.style("stroke-width",t+"px").call(s.fill,e.fillcolor),t&&r.call(s.stroke,e.line.color)})}function d(t){var e=t[0].trace,r=n.select(this).select("g.legendpoints").selectAll("path.legendpie").data(a.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(u,t[0],e)}t.each(function(t){var e=n.select(this),r=e.selectAll("g.layers").data([0]);r.enter().append("g").classed("layers",!0),r.style("opacity",t[0].trace.opacity),r.selectAll("g.legendfill").data([t]).enter().append("g").classed("legendfill",!0),r.selectAll("g.legendlines").data([t]).enter().append("g").classed("legendlines",!0);var a=r.selectAll("g.legendsymbols").data([t]);a.enter().append("g").classed("legendsymbols",!0),a.selectAll("g.legendpoints").data([t]).enter().append("g").classed("legendpoints",!0)}).each(f).each(h).each(d).each(r).each(c)}},{"../../lib":350,"../../registry":429,"../../traces/pie/style_one":478,"../../traces/scatter/subtypes":504,"../color":233,"../drawing":257,d3:62}],292:[function(t,e,r){"use strict";function n(t,e){var r,n,a=e.currentTarget,i=a.getAttribute("data-attr"),o=a.getAttribute("data-val")||!0,s=t._fullLayout,l={},u=h.list(t,null,!0),f="on";if("zoom"===i){var d,p="in"===o?.5:2,g=(1+p)/2,m=(1-p)/2;for(n=0;n1)return n(["resetViews","toggleHover"]),o(v,r);c&&(n(["zoom3d","pan3d","orbitRotation","tableRotation"]),n(["resetCameraDefault3d","resetCameraLastSave3d"]),n(["hoverClosest3d"])),f&&(n(["zoomInGeo","zoomOutGeo","resetGeo"]),n(["hoverClosestGeo"]));var y=a(s),b=[];return((u||p)&&!y||g)&&(b=["zoom2d","pan2d"]),m&&(b=["pan2d"]),i(l)&&(b.push("select2d"),b.push("lasso2d")),b.length&&n(b),!u&&!p||y||g||n(["zoomIn2d","zoomOut2d","autoScale2d","resetScale2d"]),u&&d?n(["toggleHover"]):p?n(["hoverClosestGl2d"]):u?n(["toggleSpikelines","hoverClosestCartesian","hoverCompareCartesian"]):d?n(["hoverClosestPie"]):m&&n(["resetViewMapbox","toggleHover"]),o(v,r)}function a(t){for(var e=l.list({_fullLayout:t},null,!0),r=!0,n=0;n0)){var p=a(e,r,l);f("x",p[0]),f("y",p[1]),i.noneOrAll(t,e,["x","y"]),f("xanchor"),f("yanchor"),i.coerceFont(f,"font",r.font);var g=f("bgcolor");f("activecolor",o.contrast(g,u.lightAmount,u.darkAmount)),f("bordercolor"),f("borderwidth")}}},{"../../lib":350,"../color":233,"./attributes":296,"./button_attributes":297,"./constants":298}],300:[function(t,e,r){"use strict";function n(t){for(var e=v.list(t,"x",!0),r=[],n=0;np&&(p=h)));return p>=d?[d,p]:void 0}}var a=t("../../lib"),i=t("../../plots/cartesian/axes"),o=t("./constants"),s=t("./helpers");e.exports=function(t){var e=t._fullLayout,r=a.filterVisible(e.shapes);if(r.length&&t._fullData.length)for(var s=0;sX&&n>Y&&!t.shiftKey?p.getCursor(a/r,1-i/n):"move";g(e,o),q=o.split("-")[0]}function i(e){B=f.getFromId(t,r.xref),j=f.getFromId(t,r.yref),H=v.getDataToPixel(t,B),U=v.getDataToPixel(t,j,!0),V=v.getPixelToData(t,B),G=v.getPixelToData(t,j,!0);var i="shapes["+n+"]";"path"===r.type?(N=r.path,F=i+".path"):(m=H(r.x0),y=U(r.y0),b=H(r.x1),x=U(r.y1),_=i+".x0",w=i+".y0",A=i+".x1",k=i+".y1"),mY&&(d[S]=r[R]=G(u),d[C]=r[D]=G(c)),h-f>X&&(d[O]=r[P]=V(f),d[I]=r[z]=V(h))}e.attr("d",o(t,r))}var d,m,y,b,x,_,w,A,k,M,T,E,L,S,C,O,I,R,D,P,z,N,F,B,j,H,U,V,G,q,X=10,Y=10,W={element:e.node(),gd:t,prepFn:i,doneFn:s},Z=W.element.getBoundingClientRect();p.init(W),e.node().onmousemove=a}function o(t,e){var r,n,a,i,o=e.type,l=f.getFromId(t,e.xref),u=f.getFromId(t,e.yref),c=t._fullLayout._size;if(l?(r=v.shapePositionToRange(l),n=function(t){return l._offset+l.r2p(r(t,!0))}):n=function(t){return c.l+c.w*t},u?(a=v.shapePositionToRange(u),i=function(t){return u._offset+u.r2p(a(t,!0))}):i=function(t){return c.t+c.h*(1-t)},"path"===o)return l&&"date"===l.type&&(n=v.decodeDate(n)),u&&"date"===u.type&&(i=v.decodeDate(i)),s(e.path,n,i);var h=n(e.x0),d=n(e.x1),p=i(e.y0),g=i(e.y1);if("line"===o)return"M"+h+","+p+"L"+d+","+g;if("rect"===o)return"M"+h+","+p+"H"+d+"V"+g+"H"+h+"Z";var m=(h+d)/2,y=(p+g)/2,b=Math.abs(m-h),x=Math.abs(y-p),_="A"+b+","+x,w=m+b+","+y;return"M"+w+_+" 0 1,1 "+m+","+(y-x)+_+" 0 0,1 "+w+"Z"}function s(t,e,r){return t.replace(m.segmentRE,function(t){var n=0,a=t.charAt(0),i=m.paramIsX[a],o=m.paramIsY[a],s=m.numParams[a],l=t.substr(1).replace(m.paramRE,function(t){return i[n]?t=e(t):o[n]&&(t=r(t)),n++,n>s&&(t="X"),t});return n>s&&(l=l.replace(/[\s,]*X.*/,""),c.log("Ignoring extra params in segment "+t)),a+l})}function l(t,e,r){return t.replace(m.segmentRE,function(t){var n=0,a=t.charAt(0),i=m.paramIsX[a],o=m.paramIsY[a],s=m.numParams[a];return a+t.substr(1).replace(m.paramRE,function(t){return n>=s?t:(i[n]?t=e(t):o[n]&&(t=r(t)),n++,t)})})}var u=t("../../plotly"),c=t("../../lib"),f=t("../../plots/cartesian/axes"),h=t("../color"),d=t("../drawing"),p=t("../dragelement"),g=t("../../lib/setcursor"),m=t("./constants"),v=t("./helpers");e.exports={draw:n,drawOne:a}},{"../../lib":350,"../../lib/setcursor":365,"../../plotly":384,"../../plots/cartesian/axes":389,"../color":233,"../dragelement":254,"../drawing":257,"./constants":311,"./helpers":314}],314:[function(t,e,r){"use strict";r.rangeToShapePosition=function(t){return"log"===t.type?t.r2d:function(t){return t}},r.shapePositionToRange=function(t){return"log"===t.type?t.d2r:function(t){return t}},r.decodeDate=function(t){return function(e){return e.replace&&(e=e.replace("_"," ")),t(e)}},r.encodeDate=function(t){return function(e){return t(e).replace(" ","_")}},r.getDataToPixel=function(t,e,n){var a,i=t._fullLayout._size;if(e){var o=r.shapePositionToRange(e);a=function(t){return e._offset+e.r2p(o(t,!0))},"date"===e.type&&(a=r.decodeDate(a))}else a=n?function(t){return i.t+i.h*(1-t)}:function(t){return i.l+i.w*t};return a},r.getPixelToData=function(t,e,n){var a,i=t._fullLayout._size;if(e){var o=r.rangeToShapePosition(e);a=function(t){return o(e.p2r(t-e._offset))}}else a=n?function(t){return 1-(t-i.t)/i.h}:function(t){return(t-i.l)/i.w};return a}},{}],315:[function(t,e,r){"use strict";var n=t("./draw");e.exports={moduleType:"component",name:"shapes",layoutAttributes:t("./attributes"),supplyLayoutDefaults:t("./defaults"),calcAutorange:t("./calc_autorange"),draw:n.draw,drawOne:n.drawOne}},{"./attributes":309,"./calc_autorange":310,"./defaults":312,"./draw":313}],316:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("../../plots/cartesian/axes"),i=t("./attributes"),o=t("./helpers");e.exports=function(t,e,r,s,l){function u(r,a){return n.coerce(t,e,i,r,a)}if(s=s||{},l=l||{},!u("visible",!l.itemIsNotPlainObject))return e;u("layer"),u("opacity"),u("fillcolor"),u("line.color"),u("line.width"),u("line.dash");for(var c=t.path?"path":"rect",f=u("type",c),h=["x","y"],d=0;d<2;d++){var p=h[d],g={_fullLayout:r},m=a.coerceRef(t,e,g,p,"","paper");if("path"!==f){var v,y,b;"paper"!==m?(v=a.getFromId(g,m),b=o.rangeToShapePosition(v),y=o.shapePositionToRange(v)):y=b=n.identity;var x=p+"0",_=p+"1",w=t[x],A=t[_];t[x]=y(t[x],!0),t[_]=y(t[_],!0),a.coercePosition(e,g,u,m,x,.25),a.coercePosition(e,g,u,m,_,.75),e[x]=b(e[x]),e[_]=b(e[_]),t[x]=w,t[_]=A}}return"path"===f?u("path"):n.noneOrAll(t,e,["x0","x1","y0","y1"]),e}},{"../../lib":350,"../../plots/cartesian/axes":389,"./attributes":309,"./helpers":314}],317:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),a=t("../../plots/pad_attributes"),i=t("../../lib/extend").extendFlat,o=t("../../lib/extend").extendDeep,s=t("../../plots/animation_attributes"),l=t("./constants"),u={_isLinkedToArray:"step",method:{valType:"enumerated",values:["restyle","relayout","animate","update","skip"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string"},value:{valType:"string"},execute:{valType:"boolean",dflt:!0}};e.exports={_isLinkedToArray:"slider",visible:{valType:"boolean",dflt:!0},active:{valType:"number",min:0,dflt:0},steps:u,lenmode:{valType:"enumerated",values:["fraction","pixels"],dflt:"fraction"},len:{valType:"number",min:0,dflt:1},x:{valType:"number",min:-2,max:3,dflt:0},pad:o({},a,{},{t:{dflt:20}}),xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left"},y:{valType:"number",min:-2,max:3,dflt:0},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"top"},transition:{duration:{valType:"number",min:0,dflt:150},easing:{valType:"enumerated",values:s.transition.easing.values,dflt:"cubic-in-out"}},currentvalue:{visible:{valType:"boolean",dflt:!0},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left"},offset:{valType:"number",dflt:10},prefix:{valType:"string"},suffix:{valType:"string"},font:i({},n,{})},font:i({},n,{}),activebgcolor:{valType:"color",dflt:l.gripBgActiveColor},bgcolor:{valType:"color",dflt:l.railBgColor},bordercolor:{valType:"color",dflt:l.railBorderColor},borderwidth:{valType:"number",min:0,dflt:l.railBorderWidth},ticklen:{valType:"number",min:0,dflt:l.tickLength},tickcolor:{valType:"color",dflt:l.tickColor},tickwidth:{valType:"number",min:0,dflt:1},minorticklen:{valType:"number",min:0,dflt:l.minorTickLength}}},{"../../lib/extend":343,"../../plots/animation_attributes":385,"../../plots/font_attributes":413,"../../plots/pad_attributes":421,"./constants":318}],318:[function(t,e,r){"use strict";e.exports={name:"sliders",containerClassName:"slider-container",groupClassName:"slider-group",inputAreaClass:"slider-input-area",railRectClass:"slider-rail-rect",railTouchRectClass:"slider-rail-touch-rect",gripRectClass:"slider-grip-rect",tickRectClass:"slider-tick-rect",inputProxyClass:"slider-input-proxy",labelsClass:"slider-labels",labelGroupClass:"slider-label-group",labelClass:"slider-label",currentValueClass:"slider-current-value",railHeight:5,menuIndexAttrName:"slider-active-index",autoMarginIdRoot:"slider-",minWidth:30,minHeight:30,textPadX:40,arrowOffsetX:4,railRadius:2,railWidth:5,railBorder:4,railBorderWidth:1,railBorderColor:"#bec8d9",railBgColor:"#f8fafc",railInset:8,stepInset:10,gripRadius:10,gripWidth:20,gripHeight:20,gripBorder:20,gripBorderWidth:1,gripBorderColor:"#bec8d9",gripBgColor:"#f6f8fa",gripBgActiveColor:"#dbdde0",labelPadding:8,labelOffset:0,tickWidth:1,tickColor:"#333",tickOffset:25,tickLength:7,minorTickOffset:25,minorTickColor:"#333",minorTickLength:4,currentValuePadding:8,currentValueInset:0}},{}],319:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return i.coerce(t,e,s,r,n)}n("visible",a(t,e).length>0)&&(n("active"),n("x"),n("y"),i.noneOrAll(t,e,["x","y"]),n("xanchor"),n("yanchor"),n("len"),n("lenmode"),n("pad.t"),n("pad.r"),n("pad.b"),n("pad.l"),i.coerceFont(n,"font",r.font),n("currentvalue.visible")&&(n("currentvalue.xanchor"),n("currentvalue.prefix"),n("currentvalue.suffix"),n("currentvalue.offset"),i.coerceFont(n,"currentvalue.font",e.font)),n("transition.duration"),n("transition.easing"),n("bgcolor"),n("activebgcolor"),n("bordercolor"),n("borderwidth"),n("ticklen"),n("tickwidth"),n("tickcolor"),n("minorticklen"))}function a(t,e){function r(t,e){return i.coerce(n,a,c,t,e)}for(var n,a,o=t.steps||[],s=e.steps=[],l=0;l=r.steps.length&&(r.active=0),e.call(s,r).call(x,r).call(c,r).call(p,r).call(b,t,r).call(l,t,r),M.setTranslate(e,r.lx+r.pad.l,r.ly+r.pad.t),e.call(m,r,r.active/(r.steps.length-1),!1),e.call(s,r)}function s(t,e,r){if(e.currentvalue.visible){var n,a,i=t.selectAll("text").data([0]);switch(e.currentvalue.xanchor){case"right":n=e.inputAreaLength-L.currentValueInset-e.currentValueMaxWidth,a="left";break;case"center":n=.5*e.inputAreaLength,a="middle";break;default:n=L.currentValueInset,a="left"}i.enter().append("text").classed(L.labelClass,!0).classed("user-select-none",!0).attr({"text-anchor":a,"data-notex":1});var o=e.currentvalue.prefix?e.currentvalue.prefix:"";if("string"==typeof r)o+=r;else{o+=e.steps[e.active].label}e.currentvalue.suffix&&(o+=e.currentvalue.suffix),i.call(M.font,e.currentvalue.font).text(o).call(T.convertToTspans,e.gd);var s=T.lineCount(i),l=(e.currentValueMaxLines+1-s)*e.currentvalue.font.size*S;return T.positionText(i,n,l),i}}function l(t,e,r){var n=t.selectAll("rect."+L.gripRectClass).data([0]);n.enter().append("rect").classed(L.gripRectClass,!0).call(d,e,t,r).style("pointer-events","all"),n.attr({width:L.gripWidth,height:L.gripHeight,rx:L.gripRadius,ry:L.gripRadius}).call(k.stroke,r.bordercolor).call(k.fill,r.bgcolor).style("stroke-width",r.borderwidth+"px")}function u(t,e,r){var n=t.selectAll("text").data([0]);return n.enter().append("text").classed(L.labelClass,!0).classed("user-select-none",!0).attr({"text-anchor":"middle","data-notex":1}),n.call(M.font,r.font).text(e.step.label).call(T.convertToTspans,r.gd),n}function c(t,e){var r=t.selectAll("g."+L.labelsClass).data([0]);r.enter().append("g").classed(L.labelsClass,!0);var n=r.selectAll("g."+L.labelGroupClass).data(e.labelSteps);n.enter().append("g").classed(L.labelGroupClass,!0),n.exit().remove(),n.each(function(t){var r=w.select(this);r.call(u,t,e),M.setTranslate(r,v(e,t.fraction),L.tickOffset+e.ticklen+e.font.size*S+L.labelOffset+e.currentValueTotalHeight)})}function f(t,e,r,n,a){var i=Math.round(n*(r.steps.length-1));i!==r.active&&h(t,e,r,i,!0,a)}function h(t,e,r,n,a,i){var o=r.active;r._input.active=r.active=n;var l=r.steps[r.active];e.call(m,r,r.active/(r.steps.length-1),i),e.call(s,r),t.emit("plotly_sliderchange",{slider:r,step:r.steps[r.active],interaction:a,previousActive:o}),l&&l.method&&a&&(e._nextMethod?(e._nextMethod.step=l,e._nextMethod.doCallback=a,e._nextMethod.doTransition=i):(e._nextMethod={step:l,doCallback:a,doTransition:i},e._nextMethodRaf=window.requestAnimationFrame(function(){var r=e._nextMethod.step;r.method&&(r.execute&&A.executeAPICommand(t,r.method,r.args),e._nextMethod=null,e._nextMethodRaf=null)})))}function d(t,e,r){function n(){return r.data()[0]}var a=r.node(),i=w.select(e);t.on("mousedown",function(){var t=n();e.emit("plotly_sliderstart",{slider:t});var o=r.select("."+L.gripRectClass);w.event.stopPropagation(),w.event.preventDefault(),o.call(k.fill,t.activebgcolor);var s=y(t,w.mouse(a)[0]);f(e,r,t,s,!0),t._dragging=!0,i.on("mousemove",function(){var t=n(),i=y(t,w.mouse(a)[0]);f(e,r,t,i,!1)}),i.on("mouseup",function(){var t=n();t._dragging=!1,o.call(k.fill,t.bgcolor),i.on("mouseup",null),i.on("mousemove",null),e.emit("plotly_sliderend",{slider:t,step:t.steps[t.active]})})})}function p(t,e){var r=t.selectAll("rect."+L.tickRectClass).data(e.steps);r.enter().append("rect").classed(L.tickRectClass,!0),r.exit().remove(),r.attr({width:e.tickwidth+"px","shape-rendering":"crispEdges"}),r.each(function(t,r){var n=r%e.labelStride==0,a=w.select(this);a.attr({height:n?e.ticklen:e.minorticklen}).call(k.fill,e.tickcolor),M.setTranslate(a,v(e,r/(e.steps.length-1))-.5*e.tickwidth,(n?L.tickOffset:L.minorTickOffset)+e.currentValueTotalHeight)})}function g(t){t.labelSteps=[];for(var e=t.steps.length,r=0;r0&&(o=o.transition().duration(e.transition.duration).ease(e.transition.easing)),o.attr("transform","translate("+(i-.5*L.gripWidth)+","+e.currentValueTotalHeight+")")}}function v(t,e){return t.inputAreaStart+L.stepInset+(t.inputAreaLength-2*L.stepInset)*Math.min(1,Math.max(0,e))}function y(t,e){return Math.min(1,Math.max(0,(e-L.stepInset-t.inputAreaStart)/(t.inputAreaLength-2*L.stepInset-2*t.inputAreaStart)))}function b(t,e,r){var n=t.selectAll("rect."+L.railTouchRectClass).data([0]);n.enter().append("rect").classed(L.railTouchRectClass,!0).call(d,e,t,r).style("pointer-events","all"),n.attr({width:r.inputAreaLength,height:Math.max(r.inputAreaWidth,L.tickOffset+r.ticklen+r.labelHeight)}).call(k.fill,r.bgcolor).attr("opacity",0),M.setTranslate(n,0,r.currentValueTotalHeight)}function x(t,e){var r=t.selectAll("rect."+L.railRectClass).data([0]);r.enter().append("rect").classed(L.railRectClass,!0);var n=e.inputAreaLength-2*L.railInset;r.attr({width:n,height:L.railWidth,rx:L.railRadius,ry:L.railRadius,"shape-rendering":"crispEdges"}).call(k.stroke,e.bordercolor).call(k.fill,e.bgcolor).style("stroke-width",e.borderwidth+"px"),M.setTranslate(r,L.railInset,.5*(e.inputAreaWidth-L.railWidth)+e.currentValueTotalHeight)}function _(t){for(var e=t._fullLayout._pushmargin||{},r=Object.keys(e),n=0;n0?[0]:[]);if(s.enter().append("g").classed(L.containerClassName,!0).style("cursor","ew-resize"),s.exit().remove(),s.exit().size()&&_(t),0!==r.length){var l=s.selectAll("g."+L.groupClassName).data(r,a);l.enter().append("g").classed(L.groupClassName,!0),l.exit().each(function(e){w.select(this).remove(),e._commandObserver.remove(),delete e._commandObserver,A.autoMargin(t,L.autoMarginIdRoot+e._index)});for(var u=0;u0||h<0){var g={left:[-r,0],right:[r,0],top:[0,-r],bottom:[0,r]}[_.side];e.attr("transform","translate("+g+")")}}}var m,v=r.propContainer,y=r.propName,b=r.traceIndex,x=r.dfltName,_=r.avoid||{},w=r.attributes,A=r.transform,k=r.containerGroup,M=t._fullLayout,T=v.titlefont.family,E=v.titlefont.size,L=v.titlefont.color,S=1,C=!1,O=v.title.trim();"title"===y?m="titleText":-1!==y.indexOf("axis")?m="axisTitleText":y.indexOf(!0)&&(m="colorbarTitleText");var I=t._context.edits[m];""===O&&(S=0),O.match(h)&&(S=.2,C=!0,I||(O=""));var R=O||I;k||(k=M._infolayer.selectAll(".g-"+e).data([0]), -k.enter().append("g").classed("g-"+e,!0));var D=k.selectAll("text").data(R?[0]:[]);if(D.enter().append("text"),D.text(O).attr("class",e),D.exit().remove(),R){D.call(d);var P="Click to enter "+x+" title";I&&(O?D.on(".opacity",null):function(){S=0,C=!0,O=P,D.text(O).on("mouseover.opacity",function(){n.select(this).transition().duration(f.SHOW_PLACEHOLDER).style("opacity",1)}).on("mouseout.opacity",function(){n.select(this).transition().duration(f.HIDE_PLACEHOLDER).style("opacity",0)})}(),D.call(c.makeEditable,{gd:t}).on("edit",function(e){void 0!==b?i.restyle(t,y,e,b):i.relayout(t,y,e)}).on("cancel",function(){this.text(this.attr("data-unformatted")).call(d)}).on("input",function(t){this.text(t||" ").call(c.positionText,w.x,w.y)})),D.classed("js-placeholder",C)}}},{"../../constants/interactions":332,"../../lib":350,"../../lib/svg_text_utils":369,"../../plotly":384,"../../plots/plots":422,"../color":233,"../drawing":257,d3:62,"fast-isnumeric":68}],323:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),a=t("../color/attributes"),i=t("../../lib/extend").extendFlat,o=t("../../plots/pad_attributes"),s={_isLinkedToArray:"button",method:{valType:"enumerated",values:["restyle","relayout","animate","update","skip"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string",dflt:""},execute:{valType:"boolean",dflt:!0}};e.exports={_isLinkedToArray:"updatemenu",_arrayAttrRegexps:[/^updatemenus\[(0|[1-9][0-9]+)\]\.buttons/],visible:{valType:"boolean"},type:{valType:"enumerated",values:["dropdown","buttons"],dflt:"dropdown"},direction:{valType:"enumerated",values:["left","right","up","down"],dflt:"down"},active:{valType:"integer",min:-1,dflt:0},showactive:{valType:"boolean",dflt:!0},buttons:s,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:"top"},pad:i({},o,{}),font:i({},n,{}),bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:a.borderLine},borderwidth:{valType:"number",min:0,dflt:1}}},{"../../lib/extend":343,"../../plots/font_attributes":413,"../../plots/pad_attributes":421,"../color/attributes":232}],324:[function(t,e,r){"use strict";e.exports={name:"updatemenus",containerClassName:"updatemenu-container",headerGroupClassName:"updatemenu-header-group",headerClassName:"updatemenu-header",headerArrowClassName:"updatemenu-header-arrow",dropdownButtonGroupClassName:"updatemenu-dropdown-button-group",dropdownButtonClassName:"updatemenu-dropdown-button",buttonClassName:"updatemenu-button",itemRectClassName:"updatemenu-item-rect",itemTextClassName:"updatemenu-item-text",menuIndexAttrName:"updatemenu-active-index",autoMarginIdRoot:"updatemenu-",blankHeaderOpts:{label:" "},minWidth:30,minHeight:30,textPadX:24,arrowPadX:16,rx:2,ry:2,textOffsetX:12,textOffsetY:3,arrowOffsetX:4,gapButtonHeader:5,gapButton:2,activeColor:"#F4FAFF",hoverColor:"#F4FAFF",arrowSymbol:{left:"\u25c4",right:"\u25ba",up:"\u25b2",down:"\u25bc"}}},{}],325:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return i.coerce(t,e,s,r,n)}n("visible",a(t,e).length>0)&&(n("active"),n("direction"),n("type"),n("showactive"),n("x"),n("y"),i.noneOrAll(t,e,["x","y"]),n("xanchor"),n("yanchor"),n("pad.t"),n("pad.r"),n("pad.b"),n("pad.l"),i.coerceFont(n,"font",r.font),n("bgcolor",r.paper_bgcolor),n("bordercolor"),n("borderwidth"))}function a(t,e){function r(t,e){return i.coerce(n,a,c,t,e)}for(var n,a,o=t.buttons||[],s=e.buttons=[],l=0;l0?[0]:[]);if(i.enter().append("g").classed(S.containerClassName,!0).style("cursor","pointer"),i.exit().remove(),i.exit().size()&&_(t),0!==r.length){var c=i.selectAll("g."+S.headerGroupClassName).data(r,a);c.enter().append("g").classed(S.headerGroupClassName,!0);var f=i.selectAll("g."+S.dropdownButtonGroupClassName).data([0]);f.enter().append("g").classed(S.dropdownButtonGroupClassName,!0).style("pointer-events","all");for(var h=0;hA,T=n.barLength+2*n.barPad,E=n.barWidth+2*n.barPad,L=p,S=m+v;S+E>u&&(S=u-E);var C=this.container.selectAll("rect.scrollbar-horizontal").data(M?[0]:[]);C.exit().on(".drag",null).remove(),C.enter().append("rect").classed("scrollbar-horizontal",!0).call(i.fill,n.barColor),M?(this.hbar=C.attr({rx:n.barRadius,ry:n.barRadius,x:L,y:S,width:T,height:E}),this._hbarXMin=L+T/2,this._hbarTranslateMax=A-T):(delete this.hbar,delete this._hbarXMin,delete this._hbarTranslateMax);var O=v>k,I=n.barWidth+2*n.barPad,R=n.barLength+2*n.barPad,D=p+g,P=m;D+I>l&&(D=l-I);var z=this.container.selectAll("rect.scrollbar-vertical").data(O?[0]:[]);z.exit().on(".drag",null).remove(),z.enter().append("rect").classed("scrollbar-vertical",!0).call(i.fill,n.barColor),O?(this.vbar=z.attr({rx:n.barRadius,ry:n.barRadius,x:D,y:P,width:I,height:R}),this._vbarYMin=P+R/2,this._vbarTranslateMax=k-R):(delete this.vbar,delete this._vbarYMin,delete this._vbarTranslateMax);var N=this.id,F=c-.5,B=O?f+I+.5:f+.5,j=h-.5,H=M?d+E+.5:d+.5,U=s._topdefs.selectAll("#"+N).data(M||O?[0]:[]);if(U.exit().remove(),U.enter().append("clipPath").attr("id",N).append("rect"),M||O?(this._clipRect=U.select("rect").attr({x:Math.floor(F),y:Math.floor(j),width:Math.ceil(B)-Math.floor(F),height:Math.ceil(H)-Math.floor(j)}),this.container.call(o.setClipUrl,N),this.bg.attr({x:p,y:m,width:g,height:v})):(this.bg.attr({width:0,height:0}),this.container.on("wheel",null).on(".drag",null).call(o.setClipUrl,null),delete this._clipRect),M||O){var V=a.behavior.drag().on("dragstart",function(){a.event.sourceEvent.preventDefault()}).on("drag",this._onBoxDrag.bind(this));this.container.on("wheel",null).on("wheel",this._onBoxWheel.bind(this)).on(".drag",null).call(V);var G=a.behavior.drag().on("dragstart",function(){a.event.sourceEvent.preventDefault(),a.event.sourceEvent.stopPropagation()}).on("drag",this._onBarDrag.bind(this));M&&this.hbar.on(".drag",null).call(G),O&&this.vbar.on(".drag",null).call(G)}this.setTranslate(e,r)},n.prototype.disable=function(){(this.hbar||this.vbar)&&(this.bg.attr({width:0,height:0}),this.container.on("wheel",null).on(".drag",null).call(o.setClipUrl,null),delete this._clipRect),this.hbar&&(this.hbar.on(".drag",null),this.hbar.remove(),delete this.hbar,delete this._hbarXMin,delete this._hbarTranslateMax),this.vbar&&(this.vbar.on(".drag",null),this.vbar.remove(),delete this.vbar,delete this._vbarYMin,delete this._vbarTranslateMax)},n.prototype._onBoxDrag=function(){var t=this.translateX,e=this.translateY;this.hbar&&(t-=a.event.dx),this.vbar&&(e-=a.event.dy),this.setTranslate(t,e)},n.prototype._onBoxWheel=function(){var t=this.translateX,e=this.translateY;this.hbar&&(t+=a.event.deltaY),this.vbar&&(e+=a.event.deltaY),this.setTranslate(t,e)},n.prototype._onBarDrag=function(){var t=this.translateX,e=this.translateY;if(this.hbar){var r=t+this._hbarXMin,n=r+this._hbarTranslateMax;t=(s.constrain(a.event.x,r,n)-r)/(n-r)*(this.position.w-this._box.w)}if(this.vbar){var i=e+this._vbarYMin,o=i+this._vbarTranslateMax;e=(s.constrain(a.event.y,i,o)-i)/(o-i)*(this.position.h-this._box.h)}this.setTranslate(t,e)},n.prototype.setTranslate=function(t,e){var r=this.position.w-this._box.w,n=this.position.h-this._box.h;if(t=s.constrain(t||0,0,r),e=s.constrain(e||0,0,n),this.translateX=t,this.translateY=e,this.container.call(o.setTranslate,this._box.l-this.position.l-t,this._box.t-this.position.t-e),this._clipRect&&this._clipRect.attr({x:Math.floor(this.position.l+t-.5),y:Math.floor(this.position.t+e-.5)}),this.hbar){var a=t/r;this.hbar.call(o.setTranslate,t+a*this._hbarTranslateMax,e)}if(this.vbar){var i=e/n;this.vbar.call(o.setTranslate,t,e+i*this._vbarTranslateMax)}}},{"../../lib":350,"../color":233,"../drawing":257,d3:62}],329:[function(t,e,r){"use strict";e.exports={FROM_BL:{left:0,center:.5,right:1,bottom:0,middle:.5,top:1},FROM_TL:{left:0,center:.5,right:1,bottom:1,middle:.5,top:0},LINE_SPACING:1.3,MID_SHIFT:.35}},{}],330:[function(t,e,r){"use strict";e.exports={solid:[1],dot:[1,1],dash:[4,1],longdash:[8,1],dashdot:[4,1,1,1],longdashdot:[8,1,1,1]}},{}],331:[function(t,e,r){"use strict";for(var n=t("../lib/extend").extendFlat,a={circle:{unicode:"\u25cf"},square:{unicode:"\u25a0"},diamond:{unicode:"\u25c6"},cross:{unicode:"\u271a"},x:{unicode:"\u274c"},"triangle-up":{unicode:"\u25b2"},"triangle-down":{unicode:"\u25bc"},"triangle-left":{unicode:"\u25c4"},"triangle-right":{unicode:"\u25ba"},"triangle-ne":{unicode:"\u25e5"},"triangle-nw":{unicode:"\u25e4"},"triangle-se":{unicode:"\u25e2"},"triangle-sw":{unicode:"\u25e3"},pentagon:{unicode:"\u2b1f"},hexagon:{unicode:"\u2b22"},hexagon2:{unicode:"\u2b23"},star:{unicode:"\u2605"},"diamond-tall":{unicode:"\u2666"},bowtie:{unicode:"\u29d3"},"diamond-x":{unicode:"\u2756"},"cross-thin":{unicode:"+",noBorder:!0},asterisk:{unicode:"\u2733",noBorder:!0},"y-up":{unicode:"\u2144",noBorder:!0},"y-down":{unicode:"Y",noBorder:!0},"line-ew":{unicode:"\u2500",noBorder:!0},"line-ns":{unicode:"\u2502",noBorder:!0}},i={},o=Object.keys(a),s=0;s","#62":">",nbsp:"\xa0","#160":"\xa0",times:"\xd7","#215":"\xd7",plusmn:"\xb1","#177":"\xb1",deg:"\xb0","#176":"\xb0"}}},{}],335:[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}},{}],336:[function(t,e,r){"use strict";var n=t("./plotly");r.version="1.29.1",t("es6-promise").polyfill(),t("../build/plotcss"),t("./fonts/mathjax_config"),r.plot=n.plot,r.newPlot=n.newPlot,r.restyle=n.restyle,r.relayout=n.relayout,r.redraw=n.redraw,r.update=n.update,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=t("./plot_api/register"),r.toImage=t("./plot_api/to_image"),r.downloadImage=t("./snapshot/download"),r.validate=t("./plot_api/validate"),r.addFrames=n.addFrames,r.deleteFrames=n.deleteFrames,r.animate=n.animate,r.register(t("./traces/scatter")),r.register([t("./components/fx"),t("./components/legend"),t("./components/annotations"),t("./components/annotations3d"),t("./components/shapes"),t("./components/images"),t("./components/updatemenus"),t("./components/sliders"),t("./components/rangeslider"),t("./components/rangeselector")]),r.Icons=t("../build/ploticon"),r.Plots=n.Plots,r.Fx=t("./components/fx"),r.Snapshot=t("./snapshot"),r.PlotSchema=t("./plot_api/plot_schema"),r.Queue=t("./lib/queue"),r.d3=t("d3")},{"../build/plotcss":1,"../build/ploticon":2,"./components/annotations":226,"./components/annotations3d":231,"./components/fx":274,"./components/images":282,"./components/legend":290,"./components/rangeselector":302,"./components/rangeslider":308,"./components/shapes":315,"./components/sliders":321,"./components/updatemenus":327,"./fonts/mathjax_config":337,"./lib/queue":362,"./plot_api/plot_schema":378,"./plot_api/register":379,"./plot_api/set_plot_config":380,"./plot_api/to_image":382,"./plot_api/validate":383,"./plotly":384,"./snapshot":434,"./snapshot/download":431,"./traces/scatter":494,d3:62,"es6-promise":66}],337:[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},{}],338:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("../constants/numerical").BADNUM,i=/^['"%,$#\s']+|[, ]|['"%,$#\s']+$/g;e.exports=function(t){return"string"==typeof t&&(t=t.replace(i,"")),n(t)?Number(t):a}},{"../constants/numerical":333,"fast-isnumeric":68}],339:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("tinycolor2"),i=t("../plots/attributes"),o=t("../components/colorscale/get_scale"),s=(Object.keys(t("../components/colorscale/scales")),t("./nested_property")),l=/^([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)},validateFunction:function(t,e){e.coerceNumber&&(t=+t);for(var r=e.values,n=0;na.max?e.set(r):e.set(+t)}},integer:{coerceFunction:function(t,e,r,a){t%1||!n(t)||void 0!==a.min&&ta.max?e.set(r):e.set(+t)}},string:{coerceFunction:function(t,e,r,n){if("string"!=typeof t){var a="number"==typeof t;!0!==n.strict&&a?e.set(String(t)):e.set(r)}else n.noBlank&&!t?e.set(r):e.set(t)}},color:{coerceFunction:function(t,e,r){a(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;if("string"==typeof t&&t.substr(0,n)===r&&l.test(t.substr(n)))return void e.set(t);e.set(r)},validateFunction:function(t,e){var r=e.dflt,n=r.length;return t===r||"string"==typeof t&&!(t.substr(0,n)!==r||!l.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 a=t.split("+"),i=0;i0&&(o=o.replace(/0+$/,"").replace(/[\.]$/,"")),n+=":"+o}return n}function l(t){return t.formatDate("yyyy")}function u(t){return t.formatDate("M yyyy")}function c(t){return t.formatDate("M d")}function f(t){return t.formatDate("M d, yyyy")}var h=t("d3"),d=t("fast-isnumeric"),p=t("./loggers").error,g=t("./mod"),m=t("../constants/numerical"),v=m.BADNUM,y=m.ONEDAY,b=m.ONEHOUR,x=m.ONEMIN,_=m.ONESEC,w=m.EPOCHJD,A=t("../registry"),k=h.time.format.utc,M=/^\s*(-?\d\d\d\d|\d\d)(-(\d?\d)(-(\d?\d)([ Tt]([01]?\d|2[0-3])(:([0-5]\d)(:([0-5]\d(\.\d+)?))?(Z|z|[+\-]\d\d:?\d\d)?)?)?)?)?\s*$/m,T=/^\s*(-?\d\d\d\d|\d\d)(-(\d?\di?)(-(\d?\d)([ Tt]([01]?\d|2[0-3])(:([0-5]\d)(:([0-5]\d(\.\d+)?))?(Z|z|[+\-]\d\d:?\d\d)?)?)?)?)?\s*$/m,E=(new Date).getFullYear()-70;r.dateTick0=function(t,e){return n(t)?e?A.getComponentMethod("calendars","CANONICAL_SUNDAY")[t]:A.getComponentMethod("calendars","CANONICAL_TICK")[t]:e?"2000-01-02":"2000-01-01"},r.dfltRange=function(t){return n(t)?A.getComponentMethod("calendars","DFLTRANGE")[t]:["2000-01-01","2001-01-01"]},r.isJSDate=function(t){return"object"==typeof t&&null!==t&&"function"==typeof t.getTime};var L,S;r.dateTime2ms=function(t,e){if(r.isJSDate(t))return t=Number(t)-t.getTimezoneOffset()*x,t>=L&&t<=S?t:v;if("string"!=typeof t&&"number"!=typeof t)return v;t=String(t);var a=n(e),i=t.charAt(0);!a||"G"!==i&&"g"!==i||(t=t.substr(1),e="");var o=a&&"chinese"===e.substr(0,7),s=t.match(o?T:M);if(!s)return v;var l=s[1],u=s[3]||"1",c=Number(s[5]||1),f=Number(s[7]||0),h=Number(s[9]||0),d=Number(s[11]||0);if(a){if(2===l.length)return v;l=Number(l);var p;try{var g=A.getComponentMethod("calendars","getCal")(e);if(o){var m="i"===u.charAt(u.length-1);u=parseInt(u,10),p=g.newDate(l,g.toMonthIndex(l,u,m),c)}else p=g.newDate(l,Number(u),c)}catch(t){return v}return p?(p.toJD()-w)*y+f*b+h*x+d*_:v}l=2===l.length?(Number(l)+2e3-E)%100+E:Number(l),u-=1;var k=new Date(Date.UTC(2e3,u,c,f,h));return k.setUTCFullYear(l),k.getUTCMonth()!==u?v:k.getUTCDate()!==c?v:k.getTime()+d*_},L=r.MIN_MS=r.dateTime2ms("-9999"),S=r.MAX_MS=r.dateTime2ms("9999-12-31 23:59:59.9999"),r.isDateTime=function(t,e){return r.dateTime2ms(t,e)!==v};var C=90*y,O=3*b,I=5*x;r.ms2DateTime=function(t,e,r){if("number"!=typeof t||!(t>=L&&t<=S))return v;e||(e=0);var a,o,s,l,u,c,f=Math.floor(10*g(t+.05,1)),h=Math.round(t-f/10);if(n(r)){var d=Math.floor(h/y)+w,p=Math.floor(g(t,y));try{a=A.getComponentMethod("calendars","getCal")(r).fromJD(d).formatDate("yyyy-mm-dd")}catch(t){a=k("G%Y-%m-%d")(new Date(h))}if("-"===a.charAt(0))for(;a.length<11;)a="-0"+a.substr(1);else for(;a.length<10;)a="0"+a;o=e=L+y&&t<=S-y))return v;var e=Math.floor(10*g(t+.05,1)),r=new Date(Math.round(t-e/10));return i(h.time.format("%Y-%m-%d")(r),r.getHours(),r.getMinutes(),r.getSeconds(),10*r.getUTCMilliseconds()+e)},r.cleanDate=function(t,e,a){if(r.isJSDate(t)||"number"==typeof t){if(n(a))return p("JS Dates and milliseconds are incompatible with world calendars",t),e;if(!(t=r.ms2DateTimeLocal(+t))&&void 0!==e)return e}else if(!r.isDateTime(t,a))return p("unrecognized date",t),e;return t};var R=/%\d?f/g,D=[59,59.9,59.99,59.999,59.9999],P=k("%Y"),z=k("%b %Y"),N=k("%b %-d"),F=k("%b %-d, %Y");r.formatDate=function(t,e,r,a){var i,h;if(a=n(a)&&a,e)return o(e,t,a);if(a)try{var d=Math.floor((t+.05)/y)+w,p=A.getComponentMethod("calendars","getCal")(a).fromJD(d);"y"===r?h=l(p):"m"===r?h=u(p):"d"===r?(i=l(p),h=c(p)):(i=f(p),h=s(t,r))}catch(t){return"Invalid"}else{var g=new Date(Math.floor(t+.05));"y"===r?h=P(g):"m"===r?h=z(g):"d"===r?(i=P(g),h=N(g)):(i=F(g),h=s(t,r))}return h+(i?"\n"+i:"")};var B=3*y;r.incrementMonth=function(t,e,r){r=n(r)&&r;var a=g(t,y);if(t=Math.round(t-a),r)try{var i=Math.round(t/y)+w,o=A.getComponentMethod("calendars","getCal")(r),s=o.fromJD(i);return e%12?o.add(s,e,"m"):o.add(s,e/12,"y"),(s.toJD()-w)*y+a}catch(e){p("invalid ms "+t+" in calendar "+r)}var l=new Date(t+B);return l.setUTCMonth(l.getUTCMonth()+e)+a-B},r.findExactDates=function(t,e){for(var r,a,i=0,o=0,s=0,l=0,u=n(e)&&A.getComponentMethod("calendars","getCal")(e),c=0;c1||g<0||g>1?null:{x:t+l*g,y:e+f*g}}function a(t,e,r,n,a){var i=n*t+a*e;if(i<0)return n*n+a*a;if(i>r){var o=n-t,s=a-e;return o*o+s*s}var l=n*e-a*t;return l*l/r}var i=t("./mod");r.segmentsIntersect=n,r.segmentDistance=function(t,e,r,i,o,s,l,u){if(n(t,e,r,i,o,s,l,u))return 0;var c=r-t,f=i-e,h=l-o,d=u-s,p=c*c+f*f,g=h*h+d*d,m=Math.min(a(c,f,p,o-t,s-e),a(c,f,p,l-t,u-e),a(h,d,g,t-o,e-s),a(h,d,g,r-o,i-s));return Math.sqrt(m)};var o,s,l;r.getTextLocation=function(t,e,r,n){if(t===s&&n===l||(o={},s=t,l=n),o[r])return o[r];var a=t.getPointAtLength(i(r-n/2,e)),u=t.getPointAtLength(i(r+n/2,e)),c=Math.atan((u.y-a.y)/(u.x-a.x)),f=t.getPointAtLength(i(r,e)),h=(4*f.x+a.x+u.x)/6,d=(4*f.y+a.y+u.y)/6,p={x:h,y:d,theta:c};return o[r]=p,p},r.clearLocationCache=function(){s=null},r.getVisibleSegment=function(t,e,r){function n(e){var r=t.getPointAtLength(e);0===e?a=r:e===f&&(i=r);var n=r.xs?r.x-s:0,c=r.yu?r.y-u:0;return Math.sqrt(n*n+c*c)}for(var a,i,o=e.left,s=e.right,l=e.top,u=e.bottom,c=0,f=t.getTotalLength(),h=f,d=n(c);d;){if((c+=d+r)>h)return;d=n(c)}for(d=n(h);d;){if(h-=d+r,c>h)return;d=n(h)}return{min:c,max:h,len:h-c,total:f,isClosed:0===c&&h===f&&Math.abs(a.x-i.x)<.1&&Math.abs(a.y-i.y)<.1}}},{"./mod":355}],347:[function(t,e,r){"use strict";function n(t,e){var r=t;return r[3]*=e,r}function a(t){if(s(t))return f;var e=l(t);return e.length?e:f}function i(t){return s(t)?t:h}function o(t,e,r){var o,s,c,d,p,g=t.color,m=Array.isArray(g),v=Array.isArray(e),y=[];if(o=void 0!==t.colorscale?u.makeColorScaleFunc(u.extractScale(t.colorscale,t.cmin,t.cmax)):a,s=m?function(t,e){return void 0===t[e]?f:l(o(t[e]))}:a,c=v?function(t,e){return void 0===t[e]?h:i(t[e])}:i,m||v)for(var b=0;b",e))>=0;){var r=t.indexOf("",e);if(r/g,"\n")}function i(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(no?s:a(t)?Number(t):s):s},l.noop=t("./noop"),l.identity=t("./identity"),l.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))},l.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},l.simpleMap=function(t,e,r,n){for(var a=t.length,i=new Array(a),o=0;o-1||c!==1/0&&c>=Math.pow(2,r)?t(e,r,n):l},l.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},l.smooth=function(t,e){if((e=Math.round(e)||0)<2)return t;var r,n,a,i,o=t.length,s=2*o,l=2*e-1,u=new Array(l),c=new Array(o);for(r=0;r=s&&(a-=s*Math.floor(a/s)),a<0?a=-1-a:a>=o&&(a=s-1-a),i+=t[a]*u[n];c[r]=i}return c},l.syncOrAsync=function(t,e,r){function n(){return l.syncOrAsync(t,e,r)}for(var a,i;t.length;)if(i=t.splice(0,1)[0],(a=i(e))&&a.then)return a.then(n).then(void 0,l.promiseError);return r&&r(e)},l.stripTrailingSlash=function(t){return"/"===t.substr(-1)?t.substr(0,t.length-1):t},l.noneOrAll=function(t,e,r){if(t){var n,a,i=!1,o=!0;for(n=0;n1?a+o[1]:"";if(i&&(o.length>1||s.length>4||r))for(;n.test(s);)s=s.replace(n,"$1"+i+"$2");return s+l}},{"../constants/numerical":333,"./clean_number":338,"./coerce":339,"./dates":340,"./ensure_array":341,"./extend":343,"./filter_unique":344,"./filter_visible":345,"./geometry2d":346,"./identity":349,"./is_array":351,"./is_plain_object":352,"./loggers":353,"./matrix":354,"./mod":355,"./nested_property":356,"./noop":357,"./notifier":358,"./push_unique":361,"./relink_private":363,"./search":364,"./stats":367,"./to_log_range":370,d3:62,"fast-isnumeric":68}],351:[function(t,e,r){"use strict";var n="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer:{isView:function(){return!1}};e.exports=function(t){return Array.isArray(t)||n.isView(t)}},{}],352:[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}},{}],353:[function(t,e,r){"use strict";function n(t,e){if(t.apply)t.apply(t,e);else for(var r=0;r1){for(var t=["LOG:"],e=0;e0){for(var t=["WARN:"],e=0;e0){for(var t=["ERROR:"],e=0;e=0;e--){if(n=t[e][0],i=t[e][1],l=!1,d(n))for(r=n.length-1;r>=0;r--)a(n[r],o(i,r))?l?n[r]=void 0:n.pop():l=!0;else if("object"==typeof n&&null!==n)for(s=Object.keys(n),l=!1,r=s.length-1;r>=0;r--)a(n[s[r]],o(i,s[r]))?delete n[s[r]]:l=!0;if(l)return}}function c(t){return void 0===t||null===t||"object"==typeof t&&(d(t)?!t.length:!Object.keys(t).length)}function f(t,e,r){return{set:function(){throw"bad container"},get:function(){},astr:e,parts:r,obj:t}}var h=t("fast-isnumeric"),d=t("./is_array"),p=t("./is_plain_object"),g=t("../plot_api/container_array_match");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,a,o,s=0,l=e.split(".");s/g),s=0;so||n===a||nl)&&(!e||!c(t))}function r(t,e){var r=t[0],u=t[1];if(r===a||ro||u===a||ul)return!1;var c,f,h,d,p,g=n.length,m=n[0][0],v=n[0][1],y=0;for(c=1;cMath.max(f,m)||u>Math.max(h,v)))if(uc||Math.abs(n(o,h))>a)return!0;return!1};i.filter=function(t,e){function r(r){t.push(r);var s=n.length,l=a;n.splice(i+1);for(var u=l+1;u1){r(t.pop())}return{addPt:r,raw:t,filtered:n}}},{"../constants/numerical":333,"./matrix":354}],361:[function(t,e,r){"use strict";e.exports=function(t,e){if(e instanceof RegExp){var r,n=e.toString();for(r=0;ri.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;re}function o(t,e){return t>=e}var s=t("fast-isnumeric"),l=t("./loggers");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:a:r?o:i;f90&&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,a=e[n]-e[0]||1,i=a/(n||1)/1e4,o=[e[0]],s=0;se[s]+i&&(a=Math.min(a,e[s+1]-e[s]),o.push(e[s+1]));return{vals:o,minDiff:a}},r.roundUp=function(t,e,r){for(var n,a=0,i=e.length-1,o=0,s=r?0:1,l=r?1:0,u=r?Math.ceil:Math.floor;at.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":68}],368:[function(t,e,r){"use strict";function n(t){var e=a(t);return e.length?e:[0,0,0,1]}var a=t("color-rgba");e.exports=n},{"color-rgba":54}],369:[function(t,e,r){"use strict";function n(t,e){return t.node().getBoundingClientRect()[e]}function a(t){return t.replace(v,"\\lt ").replace(y,"\\gt ")}function i(t,e,r){var n="math-output-"+h.randstr([],64),i=f.select("body").append("div").attr({id:n}).style({visibility:"hidden",position:"absolute"}).style({"font-size":e.fontSize+"px"}).text(a(t));MathJax.Hub.Queue(["Typeset",MathJax.Hub,i.node()],function(){var e=f.select("body").select("#MathJax_SVG_glyphs");if(i.select(".MathJax_SVG").empty()||!i.select("svg").node())h.log("There was an error in the tex syntax.",t),r();else{var n=i.select("svg").node().getBoundingClientRect();r(i.select(".MathJax_SVG"),e,n)}i.remove()})}function o(t,e){if(!t)return null;var r=t.match(e);return r&&(r[3]||r[4])}function s(t,e){if(!t)return"";for(var r=0;r1)for(var a=1;a doesnt match end tag <"+t+">. Pretending it did match.",e),i=u[u.length-1].node}(k);else{var P=y[4],z={type:k},N=o(P,C);if(N?(N=N.replace(D,"$1 fill:"),M&&(N+=";"+M)):M&&(N=M),N&&(z.style=N),"a"===k){s=!0;var F=o(P,O);if(F){var B=document.createElement("a");B.href=F,-1!==A.indexOf(B.protocol)&&(z.href=encodeURI(F),z.target=o(P,I)||"_blank",z.popup=o(P,R))}}n(z)}}return s}function c(t,e,r){var n,a,i,o=r.horizontalAlign,s=r.verticalAlign||"top",l=t.node().getBoundingClientRect(),u=e.node().getBoundingClientRect();return a="bottom"===s?function(){return l.bottom-n.height}:"middle"===s?function(){return l.top+(l.height-n.height)/2}:function(){return l.top},i="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:a()-u.top+"px",left:i()-u.left+"px","z-index":1e3}),this}}var f=t("d3"),h=t("../lib"),d=t("../constants/xmlns_namespaces"),p=t("../constants/string_mappings"),g=t("../constants/alignment").LINE_SPACING,m=/([^$]*)([$]+[^$]*[$]+)([^$]*)/;r.convertToTspans=function(t,e,a){function o(){c.empty()||(h=t.attr("class")+"-math",c.select("svg."+h).remove()),t.text("").style("white-space","pre"),u(t.node(),s)&&t.style("pointer-events","all"),r.positionText(t),a&&a.call(t)}var s=t.text(),l=!t.attr("data-notex")&&"undefined"!=typeof MathJax&&s.match(m),c=f.select(t.node().parentNode);if(!c.empty()){var h=t.attr("class")?t.attr("class").split(" ")[0]:"text";return h+="-math",c.selectAll("svg."+h).remove(),c.selectAll("g."+h+"-group").remove(),t.style("display",null).attr({"data-unformatted":s,"data-math":"N"}),l?(e&&e._promises||[]).push(new Promise(function(e){t.style("display","none");var r={fontSize:parseInt(t.style("font-size"),10)};i(l[2],r,function(r,i,l){c.selectAll("svg."+h).remove(),c.selectAll("g."+h+"-group").remove();var u=r&&r.select("svg");if(!u||!u.node())return o(),void e();var f=c.append("g").classed(h+"-group",!0).attr({"pointer-events":"none","data-unformatted":s,"data-math":"Y"});f.node().appendChild(u.node()),i&&i.node()&&u.node().insertBefore(i.node().cloneNode(!0),u.node().firstChild),u.attr({class:h,height:l.height,preserveAspectRatio:"xMinYMin meet"}).style({overflow:"visible","pointer-events":"none"});var d=t.style("fill")||"black";u.select("g").attr({fill:d,stroke:d});var p=n(u,"width"),g=n(u,"height"),m=+t.attr("x")-p*{start:0,middle:.5,end:1}[t.attr("text-anchor")||"start"],v=parseInt(t.style("font-size"),10)||n(t,"height"),y=-v/4;"y"===h[0]?(f.attr({transform:"rotate("+[-90,+t.attr("x"),+t.attr("y")]+") translate("+[-p/2,y-g/2]+")"}),u.attr({x:+t.attr("x"),y:+t.attr("y")})):"l"===h[0]?u.attr({x:t.attr("x"),y:y-g/2}):"a"===h[0]?u.attr({x:0,y:y}):u.attr({x:m,y:+t.attr("y")+y-g/2}),a&&a.call(t,f),e(f)})})):o(),t}};var v=/(<|<|<)/g,y=/(>|>|>)/g,b={sup:"font-size:70%",sub:"font-size:70%",b:"font-weight:bold",i:"font-style:italic",a:"cursor:pointer",span:"",em:"font-style:italic;font-weight:bold"},x={sub:"0.3em",sup:"-0.6em"},_={sub:"-0.21em",sup:"0.42em"},w="\u200b",A=["http:","https:","mailto:","",void 0,":"],k=new RegExp("]*)?/?>","g"),M=Object.keys(p.entityToUnicode).map(function(t){return{regExp:new RegExp("&"+t+";","g"),sub:p.entityToUnicode[t]}}),T=/(\r\n?|\n)/g,E=/(<[^<>]*>)/,L=/<(\/?)([^ >]*)(\s+(.*))?>/i,S=//i,C=/(^|[\s"'])style\s*=\s*("([^"]*);?"|'([^']*);?')/i,O=/(^|[\s"'])href\s*=\s*("([^"]*)"|'([^']*)')/i,I=/(^|[\s"'])target\s*=\s*("([^"\s]*)"|'([^'\s]*)')/i,R=/(^|[\s"'])popup\s*=\s*("([\w=,]*)"|'([\w=,]*)')/i,D=/(^|;)\s*color:/;r.plainText=function(t){return(t||"").replace(k," ")},r.lineCount=function(t){return t.selectAll("tspan.line").size()||1},r.positionText=function(t,e,r){return t.each(function(){function t(t,e){return void 0===e?null===(e=n.attr(t))&&(n.attr(t,0),e=0):n.attr(t,e),e}var n=f.select(this),a=t("x",e),i=t("y",r);"text"===this.nodeName&&n.selectAll("tspan.line").attr({x:a,y:i})})},r.makeEditable=function(t,e){function r(){a(),t.style({opacity:0});var e,r=l.attr("class");(e=r?"."+r.split(" ")[0]+"-math-group":"[class*=-math-group]")&&f.select(t.node().parentNode).select(e).style({opacity:0})}function n(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 r=f.select(i),a=r.select(".svg-container"),o=a.append("div");o.classed("plugin-editable editable",!0).style({position:"absolute","font-family":t.style("font-family")||"Arial","font-size":t.style("font-size")||12,color:e.fill||t.style("fill")||"black",opacity:1, -"background-color":e.background||"transparent",outline:"#ffffff33 1px solid",margin:[-parseFloat(t.style("font-size"))/8+1,0,0,-1].join("px ")+"px",padding:"0","box-sizing":"border-box"}).attr({contenteditable:!0}).text(e.text||t.attr("data-unformatted")).call(c(t,a,e)).on("blur",function(){i._editing=!1,t.text(this.textContent).style({opacity:1});var e,r=f.select(this).attr("class");(e=r?"."+r.split(" ")[0]+"-math-group":"[class*=-math-group]")&&f.select(t.node().parentNode).select(e).style({opacity:0});var n=this.textContent;f.select(this).transition().duration(0).remove(),f.select(document).on("mouseup",null),s.edit.call(t,n)}).on("focus",function(){var t=this;i._editing=!0,f.select(document).on("mouseup",function(){if(f.event.target===t)return!1;document.activeElement===o.node()&&o.node().blur()})}).on("keyup",function(){27===f.event.which?(i._editing=!1,t.style({opacity:1}),f.select(this).style({opacity:0}).on("blur",function(){return!1}).transition().remove(),s.cancel.call(t,this.textContent)):(s.input.call(t,this.textContent),f.select(this).call(c(t,a,e)))}).on("keydown",function(){13===f.event.which&&this.blur()}).call(n)}var i=e.gd,o=e.delegate,s=f.dispatch("edit","input","cancel"),l=o||t;if(t.style({"pointer-events":o?"none":"all"}),1!==t.size())throw new Error("boo");return e.immediate?r():l.on("click",r),f.rebind(t,s,"on")}},{"../constants/alignment":329,"../constants/string_mappings":334,"../constants/xmlns_namespaces":335,"../lib":350,d3:62}],370:[function(t,e,r){"use strict";var n=t("fast-isnumeric");e.exports=function(t,e){if(t>0)return Math.log(t)/Math.LN10;var r=Math.log(Math.min(e[0],e[1]))/Math.LN10;return n(r)||(r=Math.log(Math.max(e[0],e[1]))/Math.LN10-6),r}},{"fast-isnumeric":68}],371:[function(t,e,r){"use strict";function n(t,e){for(var r=new Float32Array(e),n=0;n0)return t.substr(0,e)}var s=t("fast-isnumeric"),l=t("gl-mat4/fromQuat"),u=t("../registry"),c=t("../lib"),f=t("../plots/plots"),h=t("../plots/cartesian/axes"),d=t("../components/color");r.getGraphDiv=function(t){var e;if("string"==typeof t){if(null===(e=document.getElementById(t)))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},r.clearPromiseQueue=function(t){Array.isArray(t._promises)&&t._promises.length>0&&c.log("Clearing previous rejected promises from queue."),t._promises=[]},r.cleanLayout=function(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 a=h.list({_fullLayout:t});for(e=0;e3?(m.x=1.02,m.xanchor="left"):m.x<-2&&(m.x=-.02,m.xanchor="right"),m.y>3?(m.y=1.02,m.yanchor="bottom"):m.y<-2&&(m.y=-.02,m.yanchor="top")),"rotate"===t.dragmode&&(t.dragmode="orbit"),t.scene1&&(t.scene||(t.scene=t.scene1),delete t.scene1);var v=f.getSubplotIds(t,"gl3d");for(e=0;e1&&o.warn("Full array edits are incompatible with other edits",f);var y=r[""][""];if(c(y))e.set(null);else{if(!Array.isArray(y))return o.warn("Unrecognized full array edit value",f,y),!0;e.set(y)}return!g&&(h(m,v),d(t),!0)}var b,x,_,w,A,k,M,T=Object.keys(r).map(Number).sort(s),E=e.get(),L=E||[],S=n(v,f).get(),C=[],O=-1,I=L.length;for(b=0;bL.length-(M?0:1))o.warn("index out of range",f,_);else if(void 0!==k)A.length>1&&o.warn("Insertion & removal are incompatible with edits to the same index.",f,_),c(k)?C.push(_):M?("add"===k&&(k={}),L.splice(_,0,k),S&&S.splice(_,0,{})):o.warn("Unrecognized full object edit value",f,_,k),-1===O&&(O=_);else for(x=0;x=0;b--)L.splice(C[b],1),S&&S.splice(C[b],1);if(L.length?E||e.set(L):e.set(null),g)return!1;if(h(m,v),p!==i){var R;if(-1===O)R=T;else{for(I=Math.max(L.length,I),R=[],b=0;b=O);b++)R.push(_);for(b=O;b=t.data.length||a<-t.data.length)throw new Error(r+" must be valid indices for gd.data.");if(e.indexOf(a,n+1)>-1||a>=0&&e.indexOf(-t.data.length+a)>-1||a<0&&e.indexOf(t.data.length+a)>-1)throw new Error("each index in "+r+" must be unique.")}}function l(t,e,r){if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if(void 0===e)throw new Error("currentIndices is a required argument.");if(Array.isArray(e)||(e=[e]),s(t,e,"currentIndices"),void 0===r||Array.isArray(r)||(r=[r]),void 0!==r&&s(t,r,"newIndices"),void 0!==r&&e.length!==r.length)throw new Error("current and new indices must be of equal length.")}function u(t,e,r){var n,a;if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if(void 0===e)throw new Error("traces must be defined.");for(Array.isArray(e)||(e=[e]),n=0;n=0&&lV.range[0]?[1,2]:[2,1]);else{var X=V.range[0],Y=V.range[1];G?(X<=0&&Y<=0&&r(N+".autorange",!0),X<=0?X=Y/1e6:Y<=0&&(Y=X/1e6),r(N+".range[0]",Math.log(X)/Math.LN10),r(N+".range[1]",Math.log(Y)/Math.LN10)):(r(N+".range[0]",Math.pow(10,X)),r(N+".range[1]",Math.pow(10,Y)))}else r(N+".autorange",!0);A.getComponentMethod("annotations","convertCoords")(t,j,E,r),A.getComponentMethod("images","convertCoords")(t,j,E,r)}else r(N+".autorange",!0);x.nestedProperty(u,N+"._inputRange").set(null)}else if(R.match(P.AX_NAME_PATTERN)){var W=x.nestedProperty(u,M).get(),Z=(E||{}).type;Z&&"-"!==Z||(Z="linear"),A.getComponentMethod("annotations","convertCoords")(t,W,Z,r),A.getComponentMethod("images","convertCoords")(t,W,Z,r)}var Q=O.containerArrayMatch(M);if(Q){i=Q.array,o=Q.index;var $=Q.property,K=x.nestedProperty(l,i),J=(K||[])[o]||{};if(""===o)-1===M.indexOf("updatemenus")&&(v.docalc=!0);else if(""===$){var tt=E;O.isAddVal(E)?_[M]=null:O.isRemoveVal(E)?(_[M]=J,tt=J):x.warn("unrecognized full object value",e),(n(tt,"x")||n(tt,"y")&&-1===M.indexOf("updatemenus"))&&(v.docalc=!0)}else!n(J,"x")&&!n(J,"y")||x.containsAny(M,["color","opacity","align","dash","updatemenus"])||(v.docalc=!0);h[i]||(h[i]={});var et=h[i][o];et||(et=h[i][o]={}),et[$]=E,delete e[M]}else if("reverse"===R)F.range?F.range.reverse():(r(N+".autorange",!0),F.range=[1,0]),j.autorange?v.docalc=!0:v.doplot=!0;else{var rt=String(T.parts[1]||"");0===C.indexOf("scene")?"camera"===T.parts[1]?v.docamera=!0:v.doplot=!0:0===C.indexOf("geo")?v.doplot=!0:0===C.indexOf("ternary")?v.doplot=!0:"paper_bgcolor"===M?v.doplot=!0:"margin"===C||"autorange"===rt||"rangemode"===rt||"type"===rt||"domain"===rt||"fixedrange"===rt||"scaleanchor"===rt||"scaleratio"===rt||-1!==M.indexOf("calendar")||M.match(/^(bar|box|font)/)?v.docalc=!0:!u._has("gl2d")||-1===M.indexOf("axis")&&"plot_bgcolor"!==M?!u._has("gl2d")||"dragmode"!==M||"lasso"!==E&&"select"!==E||"lasso"===H||"select"===H?"hiddenlabels"===M?v.docalc=!0:-1!==C.indexOf("legend")?v.dolegend=!0:-1!==M.indexOf("title")?v.doticks=!0:-1!==C.indexOf("bgcolor")?v.dolayoutstyle=!0:L>1&&x.containsAny(rt,["tick","exponent","grid","zeroline"])?v.doticks=!0:-1!==M.indexOf(".linewidth")&&-1!==M.indexOf("axis")?v.doticks=v.dolayoutstyle=!0:L>1&&-1!==rt.indexOf("line")?v.dolayoutstyle=!0:L>1&&"mirror"===rt?v.doticks=v.dolayoutstyle=!0:"margin.pad"===M?v.doticks=v.dolayoutstyle=!0:-1!==["hovermode","dragmode"].indexOf(M)||-1!==M.indexOf("spike")?v.domodebar=!0:-1===["height","width","autosize"].indexOf(M)&&(v.doplot=!0):v.docalc=!0:v.doplot=!0,T.set(E)}}}for(i in h){O.applyContainerArrayChanges(t,x.nestedProperty(l,i),h[i],v)||(v.doplot=!0)}var nt=u._axisConstraintGroups;for(m in w)for(o=0;o=s.length?s[0]:s[t]:s}function a(t){return Array.isArray(l)?t>=l.length?l[0]:l[t]:l}function i(t,e){var r=0;return function(){if(t&&++r===e)return t()}}if(t=I.getGraphDiv(t),!x.isPlotDiv(t))throw new Error("This element is not a Plotly plot: "+t+". It's likely that you've failed to create a plot before animating it. For more details, see https://plot.ly/javascript/animations/");var o=t._transitionData;o._frameQueue||(o._frameQueue=[]),r=k.supplyAnimationDefaults(r);var s=r.transition,l=r.frame;return void 0===o._frameWaitingCnt&&(o._frameWaitingCnt=0),new Promise(function(l,u){function c(){t.emit("plotly_animated"),window.cancelAnimationFrame(o._animationRaf),o._animationRaf=null}function f(){o._currentFrame&&o._currentFrame.onComplete&&o._currentFrame.onComplete();var e=o._currentFrame=o._frameQueue.shift();if(e){var r=e.name?e.name.toString():null;t._fullLayout._currentFrame=r,o._lastFrameAt=Date.now(),o._timeToNext=e.frameOpts.duration,k.transition(t,e.frame.data,e.frame.layout,I.coerceTraceIndices(t,e.frame.traces),e.frameOpts,e.transitionOpts).then(function(){e.onComplete&&e.onComplete()}),t.emit("plotly_animatingframe",{name:r,frame:e.frame,animation:{frame:e.frameOpts,transition:e.transitionOpts}})}else c()}function h(){t.emit("plotly_animating"),o._lastFrameAt=-1/0,o._timeToNext=0,o._runningTransitions=0,o._currentFrame=null;var e=function(){o._animationRaf=window.requestAnimationFrame(e),Date.now()-o._lastFrameAt>o._timeToNext&&f()};e()}function d(t){return Array.isArray(s)?m>=s.length?t.transitionOpts=s[m]:t.transitionOpts=s[0]:t.transitionOpts=s,m++,t}var p,g,m=0,v=[],y=void 0===e||null===e,b=Array.isArray(e);if(y||b||!x.isPlainObject(e)){if(y||-1!==["string","number"].indexOf(typeof e))for(p=0;p0&&AA)&&M.push(g);v=M}}v.length>0?function(e){if(0!==e.length){for(var s=0;s=0;a--)if(x.isPlainObject(e[a])){var h=(u[e[a].name]||{}).name,d=e[a].name;h&&d&&"number"==typeof d&&u[h]&&(n++,x.warn('addFrames: overwriting frame "'+u[h].name+'" with a frame whose name of type "number" also equates to "'+h+'". This is valid but may potentially lead to unexpected behavior since all plotly.js frame names are stored internally as strings.'),n>5&&x.warn("addFrames: This API call has yielded too many warnings. For the rest of this call, further warnings about numeric frame names will be suppressed.")),f.push({frame:k.supplyFrameDefaults(e[a]),index:r&&void 0!==r[a]&&null!==r[a]?r[a]:c+a})}f.sort(function(t,e){return t.index>e.index?-1:t.index=0;a--){if(i=f[a].frame,"number"==typeof i.name&&x.warn("Warning: addFrames accepts frames with numeric names, but the numbers areimplicitly cast to strings"),!i.name)for(;u[i.name="frame "+t._transitionData._counter++];);if(u[i.name]){for(o=0;o=0;r--)n=e[r],i.push({type:"delete",index:n}),o.unshift({type:"insert",index:n,value:a[n]});var s=k.modifyFrames,l=k.modifyFrames,u=[t,o],c=[t,i];return w&&w.add(t,s,u,l,c),k.modifyFrames(t,i)},b.purge=function(t){t=I.getGraphDiv(t);var e=t._fullLayout||{},r=t._fullData||[];return k.cleanPlot([],{},r,e),k.purge(t),_.purge(t),e._container&&e._container.remove(),delete t._context,delete t._replotPending,delete t._mouseDownTime,delete t._legendMouseDownTime,delete t._hmpixcount,delete t._hmlumcount,t}},{"../components/drawing":257,"../components/errorbars":263,"../constants/xmlns_namespaces":335,"../lib":350,"../lib/events":342,"../lib/queue":362,"../lib/svg_text_utils":369,"../plotly":384,"../plots/cartesian/axis_ids":392,"../plots/cartesian/constants":394,"../plots/cartesian/constraints":396,"../plots/cartesian/graph_interact":398,"../plots/plots":422,"../plots/polar":425,"../registry":429,"./edit_types":373,"./helpers":374,"./manage_arrays":375,"./subroutines":381,d3:62,"fast-isnumeric":68,"has-hover":149}],377:[function(t,e,r){"use strict";function n(t,r){try{t._fullLayout._paper.style("background",r)}catch(t){e.exports.logging>0&&console.error(t)}}e.exports={staticPlot:!1,editable:!1,edits:{annotationPosition:!1,annotationTail:!1,annotationText:!1,axisTitleText:!1,colorbarPosition:!1,colorbarTitleText:!1,legendPosition:!1,legendText:!1,shapePosition:!1,titleText:!1},autosizable:!1,queueLength:0,fillFrame:!1,frameMargins:0,scrollZoom:!1,doubleClick:"reset+autosize",showTips:!0,showAxisDragHandles:!0,showAxisRangeEntryBoxes:!0,showLink:!1,sendData:!0,linkText:"Edit chart",showSources:!1,displayModeBar:"hover",modeBarButtonsToRemove:[],modeBarButtonsToAdd:[],modeBarButtons:!1,displaylogo:!0,plotGlPixelRatio:2,setBackground:n,topojsonURL:"https://cdn.plot.ly/",mapboxAccessToken:null,logging:!1,globalTransforms:[]}},{}],378:[function(t,e,r){"use strict";function n(t){var e,r;"area"===t?(e={attributes:b},r={}):(e=d.modules[t]._module,r=e.basePlotModule);var n={};n.type=null,A(n,g),A(n,e.attributes),r.attributes&&A(n,r.attributes),Object.keys(d.componentsRegistry).forEach(function(e){var r=d.componentsRegistry[e];r.schema&&r.schema.traces&&r.schema.traces[t]&&Object.keys(r.schema.traces[t]).forEach(function(e){h(n,r.schema.traces[t][e],e)})}),n.type=t;var a={meta:e.meta||{},attributes:s(n)};if(e.layoutAttributes){var i={};A(i,e.layoutAttributes),a.layoutAttributes=s(i)}return a}function a(){var t={};return A(t,m),Object.keys(d.subplotsRegistry).forEach(function(e){var r=d.subplotsRegistry[e];if(r.layoutAttributes)if("cartesian"===r.name)f(t,r,"xaxis"),f(t,r,"yaxis");else{var n="subplot"===r.attr?r.name:r.attr;f(t,r,n)}}),t=c(t),Object.keys(d.componentsRegistry).forEach(function(e){var r=d.componentsRegistry[e];r.layoutAttributes&&(r.schema&&r.schema.layout?Object.keys(r.schema.layout).forEach(function(e){h(t,r.schema.layout[e],e)}):h(t,r.layoutAttributes,r.name))}),{layoutAttributes:s(t)}}function i(t){var e=d.transformsRegistry[t],r=A({},e.attributes);return Object.keys(d.componentsRegistry).forEach(function(e){var n=d.componentsRegistry[e];n.schema&&n.schema.transforms&&n.schema.transforms[t]&&Object.keys(n.schema.transforms[t]).forEach(function(e){h(r,n.schema.transforms[t][e],e)})}),{attributes:s(r)}}function o(){var t={frames:p.extendDeep({},v)};return s(t),t.frames}function s(t){return l(t),u(t),t}function l(t){function e(t){return{valType:"string"}}function n(t,n,a){r.isValObject(t)?"data_array"===t.valType?(t.role="data",a[n+"src"]=e(n)):!0===t.arrayOk&&(a[n+"src"]=e(n)):p.isPlainObject(t)&&(t.role="object")}r.crawl(t,n)}function u(t){function e(t,e,r){if(t){var n=t[M];n&&(delete t[M],r[e]={items:{}},r[e].items[n]=t,r[e].role="object")}}r.crawl(t,e)}function c(t){return w(t,{radialaxis:x.radialaxis,angularaxis:x.angularaxis}),w(t,x.layout),t}function f(t,e,r){var n=p.nestedProperty(t,r),a=A({},e.layoutAttributes);a[k]=!0,n.set(a)}function h(t,e,r){var n=p.nestedProperty(t,r);n.set(A(n.get()||{},e))}var d=t("../registry"),p=t("../lib"),g=t("../plots/attributes"),m=t("../plots/layout_attributes"),v=t("../plots/frame_attributes"),y=t("../plots/animation_attributes"),b=t("../plots/polar/area_attributes"),x=t("../plots/polar/axis_attributes"),_=t("./edit_types"),w=p.extendFlat,A=p.extendDeep,k="_isSubplotObj",M="_isLinkedToArray",T=[k,M,"_arrayAttrRegexps","_deprecated"];r.IS_SUBPLOT_OBJ=k,r.IS_LINKED_TO_ARRAY=M,r.DEPRECATED="_deprecated",r.UNDERSCORE_ATTRS=T,r.get=function(){var t={};d.allTypes.concat("area").forEach(function(e){t[e]=n(e)});var e={};return Object.keys(d.transformsRegistry).forEach(function(t){e[t]=i(t)}),{defs:{valObjects:p.valObjects,metaKeys:T.concat(["description","role"]),editTypes:{traces:_.traces(),layout:_.layout()}},traces:t,layout:a(),transforms:e,frames:o(),animation:s(y)}},r.crawl=function(t,e,n){var a=n||0;Object.keys(t).forEach(function(n){var i=t[n];-1===T.indexOf(n)&&(e(i,n,t,a),r.isValObject(i)||p.isPlainObject(i)&&r.crawl(i,e,a+1))})},r.isValObject=function(t){return t&&void 0!==t.valType},r.findArrayAttributes=function(t){function e(e,r,o,s){if(i=i.slice(0,s).concat([r]),e&&("data_array"===e.valType||!0===e.arrayOk)&&!("colorbar"===i[s-1]&&("ticktext"===r||"tickvals"===r))){var l=n(i),u=p.nestedProperty(t,l).get();Array.isArray(u)&&a.push(l)}}function n(t){return t.join(".")}var a=[],i=[];if(r.crawl(g,e),t._module&&t._module.attributes&&r.crawl(t._module.attributes,e),t.transforms)for(var o=t.transforms,s=0;s=t[1]||a[1]<=t[0])&&(i[0]e[0]))return!0}return!1}function a(t,e,r){return t._anchorAxis===e&&(t.mirror||t.side===r)||"all"===t.mirror||"allticks"===t.mirror||t.mirrors&&t.mirrors[e._id+r]}function i(t,e,r){var n=[],a=e._anchorAxis;if(a){var i=a._mainAxis;if(-1===n.indexOf(i)){n.push(i);for(var o=0;o1)};h(e.width)&&h(e.height)||n(new Error("Height and width should be pixel values."));var d=l(t,{format:"png",height:e.height,width:e.width}),p=d.gd;p.style.position="absolute",p.style.left="-5000px",document.body.appendChild(p);var g=s.getRedrawFunc(p);i.plot(p,d.data,d.layout,d.config).then(g).then(f).then(function(t){r(t)}).catch(function(t){n(t)})})}var a=t("fast-isnumeric"),i=t("../plotly"),o=t("../lib"),s=t("../snapshot/helpers"),l=t("../snapshot/cloneplot"),u=t("../snapshot/tosvg"),c=t("../snapshot/svgtoimg");e.exports=n},{"../lib":350,"../plotly":384,"../snapshot/cloneplot":430,"../snapshot/helpers":433,"../snapshot/svgtoimg":435,"../snapshot/tosvg":437,"fast-isnumeric":68}],383:[function(t,e,r){"use strict";function n(t,e,r,a,i,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,m=r.length,v=0;v.3*f||i(n)||i(a))){var h=r.dtick/2;t+=t+h.8){var o=Number(r.substr(1));i.exactYears>.8&&o%12==0?t=P.tickIncrement(t,"M6","reverse")+1.5*C:i.exactMonths>.8?t=P.tickIncrement(t,"M1","reverse")+15.5*C:t-=C/2;var s=P.tickIncrement(t,r);if(s<=n)return s}return t}function i(t){var e,r,n=t.tickvals,a=t.ticktext,i=new Array(n.length),o=_.simpleMap(t.range,t.r2l),s=1.0001*o[0]-1e-4*o[1],u=1.0001*o[1]-1e-4*o[0],c=Math.min(s,u),f=Math.max(s,u),h=0;Array.isArray(a)||(a=[]);var d="category"===t.type?t.d2l_noadd:t.d2l;for("log"===t.type&&"L"!==String(t.dtick).charAt(0)&&(t.dtick="L"+Math.pow(10,Math.floor(Math.min(t.range[0],t.range[1]))-1)),r=0;rc&&e10||"01-01"!==n.substr(5)?t._tickround="d":t._tickround=+e.substr(1)%12==0?"y":"m";else if(e>=C&&a<=10||e>=15*C)t._tickround="d";else if(e>=I&&a<=16||e>=O)t._tickround="M";else if(e>=R&&a<=19||e>=I)t._tickround="S";else{var i=t.l2r(r+e).replace(/^-/,"").length;t._tickround=Math.max(a,i)-20}}else if(b(e)||"L"===e.charAt(0)){var o=t.range.map(t.r2d||Number);b(e)||(e=Number(e.substr(1))),t._tickround=2-Math.floor(Math.log(e)/Math.LN10+.01);var s=Math.max(Math.abs(o[0]),Math.abs(o[1])),l=Math.floor(Math.log(s)/Math.LN10+.01);Math.abs(l)>3&&("SI"===t.exponentformat||"B"===t.exponentformat?t._tickexponent=3*Math.round((l-1)/3):t._tickexponent=l)}else t._tickround=null}function l(t,e,r){var n=t.tickfont||{};return{x:e,dx:0,dy:0,text:r||"",fontSize:n.size,font:n.family,fontColor:n.color}}function u(t,e,r,n){var a=t._tickround,i=r&&t.hoverformat||t.tickformat;n&&(a=b(a)?4:{y:"m",m:"d",d:"M",M:"S",S:4}[a]);var o,s=_.formatDate(e.x,i,a,t.calendar),l=s.indexOf("\n");-1!==l&&(o=s.substr(l+1),s=s.substr(0,l)),n&&("00:00:00"===s||"00:00"===s?(s=o,o=""):8===s.length&&(s=s.replace(/:00$/,""))),o&&(r?"d"===a?s+=", "+o:s=o+(s?", "+s:""):t._inCalcTicks&&o===t._prevDateHead||(s+="
"+o,t._prevDateHead=o)),e.text=s}function c(t,e,r,n,a){var i=t.dtick,o=e.x;if(!n||"string"==typeof i&&"L"===i.charAt(0)||(i="L3"),t.tickformat||"string"==typeof i&&"L"===i.charAt(0))e.text=d(Math.pow(10,o),t,a,n);else if(b(i)||"D"===i.charAt(0)&&_.mod(o+.01,1)<.1)if(-1!==["e","E","power"].indexOf(t.exponentformat)){var s=Math.round(o);e.text=0===s?1:1===s?"10":s>1?"10"+s+"":"10\u2212"+-s+"",e.fontSize*=1.25}else e.text=d(Math.pow(10,o),t,"","fakehover"),"D1"===i&&"y"===t._id.charAt(0)&&(e.dy-=e.fontSize/6);else{if("D"!==i.charAt(0))throw"unrecognized dtick "+String(i);e.text=String(Math.round(Math.pow(10,_.mod(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*(o<0?.5:.25)))}}function f(t,e){var r=t._categories[Math.round(e.x)];void 0===r&&(r=""),e.text=String(r)}function h(t,e,r,n,a){"all"===t.showexponent&&Math.abs(e.x/t.dtick)<1e-6&&(a="hide"),e.text=d(e.x,t,a,n)}function d(t,e,r,n){var a=t<0,i=e._tickround,o=r||e.exponentformat||"B",l=e._tickexponent,u=e.tickformat,c=e.separatethousands;if(n){var f={exponentformat:e.exponentformat,dtick:"none"===e.showexponent?e.dtick:b(t)?Math.abs(t)||1:1,range:"none"===e.showexponent?e.range.map(e.r2d):[0,t||1]};s(f),i=(Number(f._tickround)||0)+4,l=f._tickexponent,e.hoverformat&&(u=e.hoverformat)}if(u)return y.format(u)(t).replace(/-/g,"\u2212");var h=Math.pow(10,-i)/2;if("none"===o&&(l=0),(t=Math.abs(t))12||l<-15)?t+="e"+g:"E"===o?t+="E"+g:"power"===o?t+="\xd710"+g+"":"B"===o&&9===l?t+="B":"SI"!==o&&"B"!==o||(t+=G[l/3+5])}return a?"\u2212"+t:t}function p(t,e){var r,n,a=[];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},P.getAutoRange=function(t){var e,r=[],n=t._min[0].val,a=t._max[0].val;for(e=1;e0&&c>0&&f/c>h&&(l=o,u=s,h=f/c);if(n===a){var g=n-1,m=n+1;r="tozero"===t.rangemode?n<0?[g,0]:[0,m]:"nonnegative"===t.rangemode?[Math.max(0,g),Math.max(0,m)]:[g,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)),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(),_.simpleMap(r,t.l2r||Number)},P.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=P.getAutoRange(t),t._r=t.range.slice(),t._rl=_.simpleMap(t._r,t.r2l);var r=t._input;r.range=t.range.slice(),r.autorange=t.autorange}},P.saveRangeInitial=function(t,e){for(var r=P.list(t,"",!0),n=!1,a=0;a=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||!!_.nestedProperty(t,"rangeslider.autorange").get())&&e){t._min||(t._min=[]),t._max||(t._max=[]),r||(r={}),t._m||t.setScale();var i,o,s,l,u,c,f,h,d,p,g,m=e.length,v=r.padded?.05*t._length:0,y=r.tozero&&("linear"===t.type||"-"===t.type);v&&"domain"===t.constrain&&t._inputDomain&&(v*=(t._inputDomain[1]-t._inputDomain[0])/(t.domain[1]-t.domain[0]));var x=n((t._m>0?r.ppadplus:r.ppadminus)||r.ppad||0),w=n((t._m>0?r.ppadminus:r.ppadplus)||r.ppad||0),A=n(r.vpadplus||r.vpad),k=n(r.vpadminus||r.vpad);for(i=0;i<6;i++)a(i);for(i=m-1;i>5;i--)a(i)}},P.autoBin=function(t,e,r,i,o){var s=_.aggNums(Math.min,null,t),l=_.aggNums(Math.max,null,t);if(o||(o=e.calendar),"category"===e.type)return{start:s-.5,end:l+.5,size:1};var u;if(r)u=(l-s)/r;else{var c=_.distinctVals(t),f=Math.pow(10,Math.floor(Math.log(c.minDiff)/Math.LN10)),h=f*_.roundUp(c.minDiff/f,[.9,1.9,4.9,9.9],!0);u=Math.max(h,2*_.stdev(t)/Math.pow(t.length,i?.25:.4)),b(u)||(u=1)}var d;d="log"===e.type?{type:"linear",range:[s,l]}:{type:e.type,range:_.simpleMap([s,l],e.c2r,0,o),calendar:o},P.setConvert(d),P.autoTicks(d,u);var p,g=P.tickIncrement(P.tickFirst(d),d.dtick,"reverse",o);if("number"==typeof d.dtick){g=n(g,t,d,s,l);p=g+(1+Math.floor((l-g)/d.dtick))*d.dtick}else for("M"===d.dtick.charAt(0)&&(g=a(g,t,d.dtick,s,o)),p=g;p<=l;)p=P.tickIncrement(p,d.dtick,!1,o);return{start:e.c2r(g,0,o),end:e.c2r(p,0,o),size:d.dtick}},P.calcTicks=function(t){var e=_.simpleMap(t.range,t.r2l);if("auto"===t.tickmode||!t.dtick){var r,n=t.nticks;n||("category"===t.type?(r=t.tickfont?1.2*(t.tickfont.size||12):15,n=t._length/r):(r="y"===t._id.charAt(0)?40:80,n=_.constrain(t._length/r,4,9)+1)),"array"===t.tickmode&&(n*=100),P.autoTicks(t,Math.abs(e[1]-e[0])/n),t._minDtick>0&&t.dtick<2*t._minDtick&&(t.dtick=t._minDtick,t.tick0=t.l2r(t._forceTick0))}if(t.tick0||(t.tick0="date"===t.type?"2000-01-01":0),s(t),"array"===t.tickmode)return i(t);t._tmin=P.tickFirst(t);var a=e[1]=l:f<=l)&&!(o.length>c||f===u);f=P.tickIncrement(f,t.dtick,a,t.calendar))u=f,o.push(f);t._tmax=o[o.length-1],t._prevDateHead="",t._inCalcTicks=!0;for(var h=new Array(o.length),d=0;dL?(e/=L,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="M"+12*o(e,r,F)):n>S?(e/=S,t.dtick="M"+o(e,1,B)):n>C?(t.dtick=o(e,C,H),t.tick0=_.dateTick0(t.calendar,!0)):n>O?t.dtick=o(e,O,B):n>I?t.dtick=o(e,I,j):n>R?t.dtick=o(e,R,j):(r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=o(e,r,F))}else if("log"===t.type){t.tick0=0;var a=_.simpleMap(t.range,t.r2l);if(e>.7)t.dtick=Math.ceil(e);else if(Math.abs(a[1]-a[0])<1){var i=1.5*Math.abs((a[1]-a[0])/e);e=Math.abs(Math.pow(10,a[1])-Math.pow(10,a[0]))/i,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="L"+o(e,r,F)}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=o(e,r,F));if(0===t.dtick&&(t.dtick=1),!b(t.dtick)&&"string"!=typeof t.dtick){var s=t.dtick;throw t.dtick=1,"ax.dtick error: "+String(s)}},P.tickIncrement=function(t,e,r,n){var a=r?-1:1;if(b(e))return t+a*e;var i=e.charAt(0),o=a*Number(e.substr(1));if("M"===i)return _.incrementMonth(t,o,n);if("L"===i)return Math.log(Math.pow(10,t)+o)/Math.LN10;if("D"===i){var s="D2"===e?V:U,l=t+.01*a,u=_.roundUp(_.mod(l,1),s,r);return Math.floor(l)+Math.log(y.round(Math.pow(10,u),1))/Math.LN10}throw"unrecognized dtick "+String(e)},P.tickFirst=function(t){var e=t.r2l||Number,r=_.simpleMap(t.range,e),n=r[1]1&&e2*a}function i(t){for(var e,r=Math.max(1,(t.length-1)/1e3),n=0,a=0,i=0;i2*n}var o=t("fast-isnumeric"),s=t("../../lib"),l=t("../../constants/numerical").BADNUM;e.exports=function(t,e){return a(t,e)?"date":i(t)?"category":n(t)?"linear":"-"}},{"../../constants/numerical":333,"../../lib":350,"fast-isnumeric":68}],391:[function(t,e,r){"use strict";var n=t("tinycolor2").mix,a=t("../../registry"),i=t("../../lib"),o=t("../../components/color/attributes").lightFraction,s=t("./layout_attributes"),l=t("./tick_value_defaults"),u=t("./tick_mark_defaults"),c=t("./tick_label_defaults"),f=t("./category_order_defaults"),h=t("./set_convert"),d=t("./ordered_categories");e.exports=function(t,e,r,p,g){function m(r,n){return i.coerce2(t,e,s,r,n)}var v=p.letter,y=p.font||{},b="Click to enter "+(p.title||v.toUpperCase()+" axis")+" title",x=r("visible",!p.cheateronly),_=e.type;if("date"===_){a.getComponentMethod("calendars","handleDefaults")(t,e,"calendar",p.calendar)} -if(h(e,g),r("autorange",!e.isValidRange(t.range))&&r("rangemode"),r("range"),e.cleanRange(),f(t,e,r),e._initialCategories="category"===_?d(v,e.categoryorder,e.categoryarray,p.data):[],!x)return e;var w=r("color"),A=w===t.color?w:y.color;r("title",b),i.coerceFont(r,"titlefont",{family:y.family,size:Math.round(1.2*y.size),color:A}),l(t,e,r,_),c(t,e,r,_,p),u(t,e,r,p);var k=m("linecolor",w),M=m("linewidth"),T=r("showline",!!k||!!M);T||(delete e.linecolor,delete e.linewidth),(T||e.ticks)&&r("mirror");var E=m("gridcolor",n(w,p.bgColor,o).toRgbString()),L=m("gridwidth");r("showgrid",p.showGrid||!!E||!!L)||(delete e.gridcolor,delete e.gridwidth);var S=m("zerolinecolor",w),C=m("zerolinewidth");return r("zeroline",p.showGrid||!!S||!!C)||(delete e.zerolinecolor,delete e.zerolinewidth),e}},{"../../components/color/attributes":232,"../../lib":350,"../../registry":429,"./category_order_defaults":393,"./layout_attributes":400,"./ordered_categories":402,"./set_convert":406,"./tick_label_defaults":407,"./tick_mark_defaults":408,"./tick_value_defaults":409,tinycolor2:200}],392:[function(t,e,r){"use strict";function n(t,e,r){function n(t,r){for(var n=Object.keys(t),a=/^[xyz]axis[0-9]*/,i=[],o=0;o0;i&&(n="array");var o=r("categoryorder",n);"array"===o&&r("categoryarray"),i||"array"!==o||(e.categoryorder="trace")}}},{}],394:[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]+)?$/},xAxisMatch:/^xaxis[0-9]*$/,yAxisMatch:/^yaxis[0-9]*$/,AX_ID_PATTERN:/^[xyz][0-9]*$/,AX_NAME_PATTERN:/^[xyz]axis[0-9]*$/,MINDRAG:8,MINSELECT:12,MINZOOM:20,DRAGGERSIZE:20,BENDPX:1.5,REDRAWDELAY:50,DFLTRANGEX:[-1,6],DFLTRANGEY:[-1,4],traceLayerClasses:["imagelayer","maplayer","barlayer","carpetlayer","boxlayer","scatterlayer"],layerValue2layerClass:{"above traces":"above","below traces":"below"}}},{}],395:[function(t,e,r){"use strict";function n(t,e,r,n){var a,i,s,l,u=n[o(e)].type,c=[];for(i=0;io*v)||_)for(r=0;rO&&RS&&(S=R);var z=(S-L)/(2*C);f/=z,L=l.l2r(L),S=l.l2r(S),l.range=l._input.range=M=0?Math.min(t,.9):1/(1/Math.max(t,-.3)+3.222))}function u(t,e){return t?"nsew"===t?"pan"===e?"move":"crosshair":t.toLowerCase()+"-resize":"pointer"}function c(t,e,r,n,a){return t.append("path").attr("class","zoombox").style({fill:e>.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("transform","translate("+r+", "+n+")").attr("d",a+"Z")}function f(t,e,r){return t.append("path").attr("class","zoombox-corners").style({fill:T.background,stroke:T.defaultLine,"stroke-width":1,opacity:0}).attr("transform","translate("+e+", "+r+")").attr("d","M0,0Z")}function h(t){t.selectAll(".select-outline").remove()}function d(t,e,r,n,a,i){t.attr("d",n+"M"+r.l+","+r.t+"v"+r.h+"h"+r.w+"v-"+r.h+"h-"+r.w+"Z"),a||(t.transition().style("fill",i>.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200),e.transition().style("opacity",1).duration(200))}function p(t){x.select(t).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}function g(t){return-1!==["lasso","select"].indexOf(t)}function m(t,e){return"M"+(t.l-.5)+","+(e-F-.5)+"h-3v"+(2*F+1)+"h3ZM"+(t.r+.5)+","+(e-F-.5)+"h3v"+(2*F+1)+"h-3Z"}function v(t,e){return"M"+(e-F-.5)+","+(t.t-.5)+"v-3h"+(2*F+1)+"v3ZM"+(e-F-.5)+","+(t.b+.5)+"v3h"+(2*F+1)+"v-3Z"}function y(t){var e=Math.floor(Math.min(t.b-t.t,t.r-t.l,F)/2);return"M"+(t.l-3.5)+","+(t.t-.5+e)+"h3v"+-e+"h"+e+"v-3h-"+(e+3)+"ZM"+(t.r+3.5)+","+(t.t-.5+e)+"h-3v"+-e+"h"+-e+"v-3h"+(e+3)+"ZM"+(t.r+3.5)+","+(t.b+.5-e)+"h-3v"+e+"h"+-e+"v3h"+(e+3)+"ZM"+(t.l-3.5)+","+(t.b+.5-e)+"h3v"+e+"h"+e+"v3h-"+(e+3)+"Z"}function b(t,e,r){var n,a,i,o,s,l,u=!1,c={},f={};for(n=0;nF||s>F?(kt="xy",o/it>s/ot?(s=o*ot/it,bt>i?xt.t=bt-s:xt.b=bt+s):(o=s*it/ot,yt>a?xt.l=yt-o:xt.r=yt+o),Tt.attr("d",y(xt))):n():!lt||szoom back out","long"),B=!1)}function Y(e,r){var n=1===(H+U).length;if(e)K();else if(2!==r||n){if(1===r&&n){var a=H?rt[0]:et[0],o="s"===H||"w"===U?0:1,s=a._name+".range["+o+"]",l=i(a,o),u="left",c="middle";if(a.fixedrange)return;H?(c="n"===H?"top":"bottom","right"===a.side&&(u="right")):"e"===U&&(u="right"),t._context.showAxisRangeEntryBoxes&&x.select(mt).call(M.makeEditable,{gd:t,immediate:!0,background:dt.paper_bgcolor,text:String(l),fill:a.tickfont?a.tickfont.color:"#444",horizontalAlign:u,verticalAlign:c}).on("edit",function(e){var r=a.d2r(e);void 0!==r&&w.relayout(t,s,r)})}}else $()}function W(e){function r(t,e,r){function n(e){return t.l2r(i+(e-i)*r)}if(!t.fixedrange){var a=k.simpleMap(t.range,t.r2l),i=a[0]+(a[1]-a[0])*e;t.range=a.map(n)}}if(t._context.scrollZoom||dt._enablescrollzoom){if(t._transitioningWithDuration)return k.pauseEvent(e);var n=t.querySelector(".plotly");if(V(),!(n.scrollHeight-n.clientHeight>10||n.scrollWidth-n.clientWidth>10)){clearTimeout(St);var a=-e.deltaY;if(isFinite(a)||(a=e.wheelDelta/10),!isFinite(a))return void k.log("Did not find wheel motion attributes: ",e);var i,o=Math.exp(-Math.min(Math.max(a,-20),20)/100),s=Ot.draglayer.select(".nsewdrag").node().getBoundingClientRect(),l=(e.clientX-s.left)/s.width,u=(s.bottom-e.clientY)/s.height;if(U||ct){for(U||(l=.5),i=0;i rect").call(E.setTranslate,s,l).call(E.setScale,i,o);var w=g.plot.selectAll(".scatterlayer .points, .boxlayer .points");g.plot.call(E.setTranslate,x,_).call(E.setScale,1/i,1/o),w.selectAll(".point").call(E.setPointGroupScale,i,o).call(E.hideOutsideRangePoints,g),w.selectAll(".textpoint").call(E.setTextPointsScale,i,o).call(E.hideOutsideRangePoints,g)}}}var tt,et,rt,nt,at,it,ot,st,lt,ut,ct,ft,ht,dt=t._fullLayout,pt=t._fullLayout._zoomlayer,gt=H+U==="nsew";V();var mt=n(e,H+U+"drag",ut,r,T,L,j);if(!lt&&!st&&!g(dt.dragmode))return mt.onmousedown=null,mt.style.pointerEvents=gt?"all":"none",mt;var vt={element:mt,gd:t,plotinfo:e,prepFn:function(e,r,n){var a=t._fullLayout.dragmode;gt?e.shiftKey&&(a="pan"===a?"zoom":"pan"):a="pan",vt.minDrag="lasso"===a?1:void 0,"zoom"===a?(vt.moveFn=q,vt.doneFn=X,vt.minDrag=1,G(e,r,n)):"pan"===a?(vt.moveFn=Z,vt.doneFn=Y,h(pt)):g(a)&&(vt.xaxes=et,vt.yaxes=rt,D(e,r,n,vt,a))}};S.init(vt);var yt,bt,xt,_t,wt,At,kt,Mt,Tt,Et={},Lt=[0,0,it,ot],St=null,Ct=z.REDRAWDELAY,Ot=e.mainplot?dt._plots[e.mainplot]:e;return H.length*U.length!=1&&(void 0!==mt.onwheel?mt.onwheel=W:void 0!==mt.onmousewheel&&(mt.onmousewheel=W)),mt}},{"../../components/color":233,"../../components/dragelement":254,"../../components/drawing":257,"../../constants/alignment":329,"../../lib":350,"../../lib/setcursor":365,"../../lib/svg_text_utils":369,"../../plotly":384,"../../registry":429,"../plots":422,"./axes":389,"./axis_ids":392,"./constants":394,"./scale_zoom":404,"./select":405,d3:62,tinycolor2:200}],398:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("../../components/fx"),i=t("../../components/dragelement"),o=t("./constants"),s=t("./dragbox");e.exports=function(t){var e=t._fullLayout;if((e._has("cartesian")||e._has("gl2d"))&&!t._context.staticPlot){Object.keys(e._plots||{}).sort(function(t,r){if((e._plots[t].mainplot&&!0)===(e._plots[r].mainplot&&!0)){var n=t.split("y"),a=r.split("y");return n[0]===a[0]?Number(n[1]||1)-Number(a[1]||1):Number(n[0]||1)-Number(a[0]||1)}return e._plots[t].mainplot?1:-1}).forEach(function(r){var l=e._plots[r],u=l.xaxis,c=l.yaxis,f=(u._linepositions[r]||[])[3],h=(c._linepositions[r]||[])[3],d=o.DRAGGERSIZE;if(n(f)&&"top"===u.side&&(f-=d),n(h)&&"right"!==c.side&&(h-=d),!l.mainplot){var p=s(t,l,0,0,u._length,c._length,"ns","ew");p.onmousemove=function(e){t._fullLayout._rehover=function(){t._fullLayout._hoversubplot===r&&a.hover(t,e,r)},a.hover(t,e,r),t._fullLayout._lasthover=p,t._fullLayout._hoversubplot=r},p.onmouseout=function(e){t._dragging||(t._fullLayout._hoversubplot=null,i.unhover(t,e))},p.onclick=function(e){a.click(t,e,r)},t._context.showAxisDragHandles&&(s(t,l,-d,-d,d,d,"n","w"),s(t,l,u._length,-d,d,d,"n","e"),s(t,l,-d,c._length,d,d,"s","w"),s(t,l,u._length,c._length,d,d,"s","e"))}t._context.showAxisDragHandles&&(n(f)&&("free"===u.anchor&&(f-=e._size.h*(1-c.domain[1])),s(t,l,.1*u._length,f,.8*u._length,d,"","ew"),s(t,l,0,f,.1*u._length,d,"","w"),s(t,l,.9*u._length,f,.1*u._length,d,"","e")),n(h)&&("free"===c.anchor&&(h-=e._size.w*u.domain[0]),s(t,l,h,.1*c._length,d,.8*c._length,"ns",""),s(t,l,h,.9*c._length,d,.1*c._length,"s",""),s(t,l,h,0,d,.1*c._length,"n","")))});var r=e._hoverlayer.node();r.onmousemove=function(r){r.target=e._lasthover,a.hover(t,r,e._hoversubplot)},r.onclick=function(r){r.target=e._lasthover,a.click(t,r)},r.onmousedown=function(t){e._lasthover.onmousedown(t)}}}},{"../../components/dragelement":254,"../../components/fx":274,"./constants":394,"./dragbox":397,"fast-isnumeric":68}],399:[function(t,e,r){"use strict";function n(t,e,r,n,a){var i=t._fullLayout,o=i._modules;e.plot&&e.plot.selectAll("g:not(.scatterlayer)").selectAll("g.trace").remove();for(var s=0;sc[1]-.01&&(e.domain=[0,1]),a.noneOrAll(t.domain,e.domain,[0,1])}return r("layer"),e}},{"../../lib":350,"fast-isnumeric":68}],404:[function(t,e,r){"use strict";var n=t("../../constants/alignment").FROM_BL;e.exports=function(t,e,r){void 0===r&&(r=n[t.constraintoward||"center"]);var a=[t.r2l(t.range[0]),t.r2l(t.range[1])],i=a[0]+(a[1]-a[0])*r;t.range=t._input.range=[t.l2r(i+(a[0]-i)*e),t.l2r(i+(a[1]-i)*e)]}},{"../../constants/alignment":329}],405:[function(t,e,r){"use strict";function n(t){return t._id}function a(t,e){if(Array.isArray(t))for(var r=e.cd[0].trace,n=0;n0)return Math.log(e)/Math.LN10;if(e<=0&&r&&t.range&&2===t.range.length){var n=t.range[0],a=t.range[1];return.5*(n+a-3*A*Math.abs(n-a))}return d}function f(e,r,n){var a=u(e,n||t.calendar);if(a===d){if(!i(e))return d;a=u(new Date(+e))}return a}function m(e,r,n){return l(e,r,n||t.calendar)}function v(e){return t._categories[Math.round(e)]}function y(e){if(null!==e&&void 0!==e){if(void 0===t._categoriesMap&&(t._categoriesMap={}),void 0!==t._categoriesMap[e])return t._categoriesMap[e];t._categories.push(e);var r=t._categories.length-1;return t._categoriesMap[e]=r,r}return d}function b(e){if(t._categoriesMap){var r=t._categoriesMap[e];if(void 0!==r)return r}if(i(e))return+e}function x(e){return i(e)?a.round(t._b+t._m*e,2):d}function _(e){return(e-t._b)/t._m}e=e||{};var w=(t._id||"x").charAt(0),A=10;t.c2l="log"===t.type?r:c,t.l2c="log"===t.type?n:c,t.l2p=x,t.p2l=_,t.c2p="log"===t.type?function(t,e){return x(r(t,e))}:x,t.p2c="log"===t.type?function(t){return n(_(t))}:_,-1!==["linear","-"].indexOf(t.type)?(t.d2r=t.r2d=t.d2c=t.r2c=t.d2l=t.r2l=s,t.c2d=t.c2r=t.l2d=t.l2r=c,t.d2p=t.r2p=function(e){return t.l2p(s(e))},t.p2d=t.p2r=_,t.cleanPos=c):"log"===t.type?(t.d2r=t.d2l=function(t,e){return r(s(t),e)},t.r2d=t.r2c=function(t){return n(s(t))},t.d2c=t.r2l=s,t.c2d=t.l2r=c,t.c2r=r,t.l2d=n,t.d2p=function(e,r){return t.l2p(t.d2r(e,r))},t.p2d=function(t){return n(_(t))},t.r2p=function(e){return t.l2p(s(e))},t.p2r=_,t.cleanPos=c):"date"===t.type?(t.d2r=t.r2d=o.identity,t.d2c=t.r2c=t.d2l=t.r2l=f,t.c2d=t.c2r=t.l2d=t.l2r=m,t.d2p=t.r2p=function(e,r,n){return t.l2p(f(e,0,n))},t.p2d=t.p2r=function(t,e,r){return m(_(t),e,r)},t.cleanPos=function(e){return o.cleanDate(e,d,t.calendar)}):"category"===t.type&&(t.d2c=t.d2l=y,t.r2d=t.c2d=t.l2d=v,t.d2r=t.d2l_noadd=b,t.r2c=function(e){var r=b(e);return void 0!==r?r:t.fraction2r(.5)},t.l2r=t.c2r=c,t.r2l=b,t.d2p=function(e){return t.l2p(t.r2c(e))},t.p2d=function(t){return v(_(t))},t.r2p=t.d2p,t.p2r=_,t.cleanPos=function(t){return"string"==typeof t&&""!==t?t:c(t)}),t.fraction2r=function(e){var r=t.r2l(t.range[0]),n=t.r2l(t.range[1]);return t.l2r(r+e*(n-r))},t.r2fraction=function(e){var r=t.r2l(t.range[0]),n=t.r2l(t.range[1]);return(t.r2l(e)-r)/(n-r)},t.cleanRange=function(e){e||(e="range");var r,n,a=o.nestedProperty(t,e).get();if(n="date"===t.type?o.dfltRange(t.calendar):"y"===w?p.DFLTRANGEY:p.DFLTRANGEX,n=n.slice(),!a||2!==a.length)return void o.nestedProperty(t,e).set(n);for("date"===t.type&&(a[0]=o.cleanDate(a[0],d,t.calendar),a[1]=o.cleanDate(a[1],d,t.calendar)),r=0;r<2;r++)if("date"===t.type){if(!o.isDateTime(a[r],t.calendar)){t[e]=n;break}if(t.r2l(a[0])===t.r2l(a[1])){var s=o.constrain(t.r2l(a[0]),o.MIN_MS+1e3,o.MAX_MS-1e3);a[0]=t.l2r(s-1e3),a[1]=t.l2r(s+1e3);break}}else{if(!i(a[r])){if(!i(a[1-r])){t[e]=n;break}a[r]=a[1-r]*(r?10:.1)}if(a[r]<-h?a[r]=-h:a[r]>h&&(a[r]=h),a[0]===a[1]){var l=Math.max(1,Math.abs(1e-6*a[0]));a[0]-=l,a[1]+=l}}},t.setScale=function(r){var n=e._size;if(t._categories||(t._categories=[]),t._categoriesMap||(t._categoriesMap={}),t.overlaying){var a=g.getFromId({_fullLayout:e},t.overlaying);t.domain=a.domain}var i=r&&t._r?"_r":"range",s=t.calendar;t.cleanRange(i);var l=t.r2l(t[i][0],s),u=t.r2l(t[i][1],s);if("y"===w?(t._offset=n.t+(1-t.domain[1])*n.h,t._length=n.h*(t.domain[1]-t.domain[0]),t._m=t._length/(l-u),t._b=-t._m*u):(t._offset=n.l+t.domain[0]*n.w,t._length=n.w*(t.domain[1]-t.domain[0]),t._m=t._length/(u-l),t._b=-t._m*l),!isFinite(t._m)||!isFinite(t._b))throw o.notifier("Something went wrong with axis scaling","long"),e._replotting=!1,new Error("axis scaling")},t.makeCalcdata=function(e,r){var n,a,i,o="date"===t.type&&e[r+"calendar"];if(r in e)for(n=e[r],a=new Array(n.length),i=0;i=t.range[0]&&r<=t.range[1]}:function(e){var r=e.y;return r>=t.range[0]&&r<=t.range[1]},t._min=[],t._max=[],t._separators=e.separators,delete t._minDtick,delete t._forceTick0}},{"../../constants/numerical":333,"../../lib":350,"./axis_ids":392,"./constants":394,d3:62,"fast-isnumeric":68}],407:[function(t,e,r){"use strict";function n(t){var e=["showexponent","showtickprefix","showticksuffix"],r=e.filter(function(e){return void 0!==t[e]}),n=function(e){return t[e]===t[r[0]]};if(r.every(n)||1===r.length)return t[r[0]]}var a=t("../../lib");e.exports=function(t,e,r,i,o){var s=n(t);if(r("tickprefix")&&r("showtickprefix",s),r("ticksuffix")&&r("showticksuffix",s),r("showticklabels")){var l=o.font||{},u=e.color===t.color?e.color:l.color;a.coerceFont(r,"tickfont",{family:l.family,size:l.size,color:u}),r("tickangle"),"category"!==i&&(r("tickformat")||"date"===i||(r("showexponent",s),r("exponentformat"),r("separatethousands")))}"category"===i||o.noHover||r("hoverformat")}},{"../../lib":350}],408:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("./layout_attributes");e.exports=function(t,e,r,i){var o=n.coerce2(t,e,a,"ticklen"),s=n.coerce2(t,e,a,"tickwidth"),l=n.coerce2(t,e,a,"tickcolor",e.color);r("ticks",i.outerTicks||o||s||l?"outside":"")||(delete e.ticklen,delete e.tickwidth,delete e.tickcolor)}},{"../../lib":350,"./layout_attributes":400}],409:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("../../lib"),i=t("../../constants/numerical").ONEDAY;e.exports=function(t,e,r,o){var s="auto";"array"!==t.tickmode||"log"!==o&&"date"!==o||(t.tickmode="auto"),Array.isArray(t.tickvals)?s="array":t.dtick&&(s="linear");var l=r("tickmode",s);if("auto"===l)r("nticks");else if("linear"===l){var u="date"===o?i:1,c=r("dtick",u);if(n(c))e.dtick=c>0?Number(c):u;else if("string"!=typeof c)e.dtick=u;else{var f=c.charAt(0),h=c.substr(1);h=n(h)?Number(h):0,(h<=0||!("date"===o&&"M"===f&&h===Math.round(h)||"log"===o&&"L"===f||"log"===o&&"D"===f&&(1===h||2===h)))&&(e.dtick=u)}var d="date"===o?a.dateTick0(e.calendar):0,p=r("tick0",d);"date"===o?e.tick0=a.cleanDate(p,d):n(p)&&"D1"!==c&&"D2"!==c?e.tick0=Number(p):e.tick0=d}else{var g=r("tickvals");void 0===g?e.tickmode="auto":r("ticktext")}}},{"../../constants/numerical":333,"../../lib":350,"fast-isnumeric":68}],410:[function(t,e,r){"use strict";var n=t("d3"),a=t("../../plotly"),i=t("../../registry"),o=t("../../components/drawing"),s=t("./axes"),l=/((x|y)([2-9]|[1-9][0-9]+)?)axis$/;e.exports=function(t,e,r,u){function c(e,r){function n(e,r,n){for(a=0;a rect").call(o.setTranslate,0,0).call(o.setScale,1,1),t.plot.call(o.setTranslate,e._offset,r._offset).call(o.setScale,1,1);var n=t.plot.select(".scatterlayer").selectAll(".points");n.selectAll(".point").call(o.setPointGroupScale,1,1).call(o.hideOutsideRangePoints,t),n.selectAll(".textpoint").call(o.setTextPointsScale,1,1).call(o.hideOutsideRangePoints,t)}function h(e,r){var n,a,i,s=y[e.xaxis._id],l=y[e.yaxis._id],u=[];if(s){n=t._fullLayout[s.axisName],a=n._r,i=s.to,u[0]=(a[0]*(1-r)+r*i[0]-a[0])/(a[1]-a[0])*e.xaxis._length;var f=a[1]-a[0],h=i[1]-i[0];n.range[0]=a[0]*(1-r)+r*i[0],n.range[1]=a[1]*(1-r)+r*i[1],u[2]=e.xaxis._length*(1-r+r*h/f)}else u[0]=0,u[2]=e.xaxis._length;if(l){n=t._fullLayout[l.axisName],a=n._r,i=l.to,u[1]=(a[1]*(1-r)+r*i[1]-a[1])/(a[0]-a[1])*e.yaxis._length;var d=a[1]-a[0],p=i[1]-i[0];n.range[0]=a[0]*(1-r)+r*i[0],n.range[1]=a[1]*(1-r)+r*i[1],u[3]=e.yaxis._length*(1-r+r*p/d)}else u[1]=0,u[3]=e.yaxis._length;c(e.xaxis,e.yaxis);var g=e.xaxis,v=e.yaxis,b=!!s,x=!!l,_=b?g._length/u[2]:1,w=x?v._length/u[3]:1,A=b?u[0]:0,k=x?u[1]:0,M=b?u[0]/u[2]*g._length:0,T=x?u[1]/u[3]*v._length:0,E=g._offset-M,L=v._offset-T;m._defs.select("#"+e.clipId+"> rect").call(o.setTranslate,A,k).call(o.setScale,1/_,1/w),e.plot.call(o.setTranslate,E,L).call(o.setScale,_,w).selectAll(".points").selectAll(".point").call(o.setPointGroupScale,1/_,1/w),e.plot.selectAll(".points").selectAll(".textpoint").call(o.setTextPointsScale,1/_,1/w)}function d(){for(var e={},r=0;rr.duration?(d(),k=window.cancelAnimationFrame(g)):k=window.requestAnimationFrame(g)}var m=t._fullLayout,v=[],y=function(t){var e,r,n,a,i,o={};for(e in t)if(r=e.split("."),n=r[0].match(l)){var s=n[1],u=s+"axis";if(a=m[u],i={},Array.isArray(t[e])?i.to=t[e].slice(0):Array.isArray(t[e].range)&&(i.to=t[e].range.slice(0)),!i.to)continue;i.axisName=u,i.length=a._length,v.push(s),o[s]=i}return o}(e),b=Object.keys(y),x=function(t,e,r){var n,a,i,o=t._plots,s=[];for(n in o){var l=o[n];if(-1===s.indexOf(l)){var u=l.xaxis._id,c=l.yaxis._id,f=l.xaxis.range,h=l.yaxis.range;l.xaxis._r=l.xaxis.range.slice(),l.yaxis._r=l.yaxis.range.slice(),a=r[u]?r[u].to:f,i=r[c]?r[c].to:h,f[0]===a[0]&&f[1]===a[1]&&h[0]===i[0]&&h[1]===i[1]||-1===e.indexOf(u)&&-1===e.indexOf(c)||s.push(l)}}return s}(m,b,y);if(!x.length)return function(){function e(e,r,n){for(var a=0;a0?".":"")+a;u.isPlainObject(i)?s(i,e,o,n+1):e(o,a,i)}})}var l=t("../plotly"),u=t("../lib");r.manageCommandObserver=function(t,e,a,i){var o={},s=!0;e&&e._commandObserver&&(o=e._commandObserver),o.cache||(o.cache={}),o.lookupTable={};var l=r.hasSimpleAPICommandBindings(t,a,o.lookupTable);if(e&&e._commandObserver){if(l)return o;if(e._commandObserver.remove)return e._commandObserver.remove(),e._commandObserver=null,o}if(l){n(t,l,o.cache),o.check=function(){if(s){var e=n(t,l,o.cache);return e.changed&&i&&void 0!==o.lookupTable[e.value]&&(o.disable(),Promise.resolve(i({value:e.value,type:l.type,prop:l.prop,traces:l.traces,index:o.lookupTable[e.value]})).then(o.enable,o.enable)),e.changed}};for(var c=["plotly_relayout","plotly_redraw","plotly_restyle","plotly_update","plotly_animatingframe","plotly_afterplot"],f=0;fMath.abs(u)?(f.boxEnd[1]=f.boxStart[1]+Math.abs(s)*w*(u>=0?1:-1),f.boxEnd[1]h[3]&&(f.boxEnd[1]=h[3],f.boxEnd[0]=f.boxStart[0]+(h[3]-f.boxStart[1])/Math.abs(w))):(f.boxEnd[0]=f.boxStart[0]+Math.abs(u)/w*(s>=0?1:-1),f.boxEnd[0]h[2]&&(f.boxEnd[0]=h[2],f.boxEnd[1]=f.boxStart[1]+(h[2]-f.boxStart[0])*Math.abs(w)))}}else f.boxEnabled?(s=f.boxStart[0]!==f.boxEnd[0],u=f.boxStart[1]!==f.boxEnd[1],s||u?(s&&(o(0,f.boxStart[0],f.boxEnd[0]),t.xaxis.autorange=!1),u&&(o(1,f.boxStart[1],f.boxEnd[1]),t.yaxis.autorange=!1),t.relayoutCallback()):t.glplot.setDirty(),f.boxEnabled=!1,f.boxInited=!1):f.boxInited&&(f.boxInited=!1);break;case"pan":f.boxEnabled=!1,f.boxInited=!1,n?(f.panning||(f.dragStart[0]=a,f.dragStart[1]=i),Math.abs(f.dragStart[0]-a)h[p+2]&&(h[p]=-1,h[p+2]=1),d=this[_[p]],d._length=o.viewBox[p+2]-o.viewBox[p],l.doAutoRange(d),d.setScale();b(s),o.ticks=this.computeTickMarks(),o.dataBox=this.calcDataBox(),o.merge(r),n.update(o),this.glplot.draw()},w.calcDataBox=function(){var t=this.xaxis,e=this.yaxis,r=t.range,n=e.range,a=t.r2l,i=e.r2l;return[a(r[0]),i(n[0]),a(r[1]),i(n[1])]},w.setRanges=function(t){var e=this.xaxis,r=this.yaxis,n=e.l2r,a=r.l2r;e.range=[n(t[0]),n(t[2])],r.range=[a(t[1]),a(t[3])]},w.updateTraces=function(t,e){var r,n,a,i=Object.keys(this.traces);this.fullData=t;t:for(r=0;r=e.width-20?(i["text-anchor"]="start",i.x=5):(i["text-anchor"]="end",i.x=e._paper.attr("width")-7),r.attr(i);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&&n(t,o),s.text(o.text()&&u.text()?" - ":"")}},m.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"});return n.append("input").attr({type:"text",name:"data"}).node().value=m.graphJson(t,!1,"keepdata"),n.node().submit(),r.remove(),t.emit("plotly_afterexport"),!1},m.supplyDefaults=function(t){var e,r=t._fullLayout||{},n=t._fullLayout={},i=t.layout||{},o=t._fullData||[],s=t._fullData=[],l=t.data||[];if(t._transitionData||m.createTransitionData(t),r._initialAutoSizeIsDone){var u=r.width,f=r.height;m.supplyLayoutGlobalDefaults(i,n),i.width||(n.width=u),i.height||(n.height=f)}else{m.supplyLayoutGlobalDefaults(i,n);var h=!i.width||!i.height,d=n.autosize,p=t._context&&t._context.autosizable;h&&(d||p)?m.plotAutoSize(t,i,n):h&&m.sanitizeMargins(t),!d&&h&&(i.width=n.width,i.height=n.height)}n._initialAutoSizeIsDone=!0,n._dataLength=l.length,n._globalTransforms=(t._context||{}).globalTransforms,m.supplyDataDefaults(l,s,i,n),n._has=m._hasPlotType.bind(n);var g=n._modules;for(e=0;e0){var c=o(t._boundingBoxMargins),f=c.left+c.right,h=c.bottom+c.top,p=1-2*s,g=r._container&&r._container.node?r._container.node().getBoundingClientRect():{width:r.width,height:r.height};n=Math.round(p*(g.width-f)),a=Math.round(p*(g.height-h))}else{var v=l?window.getComputedStyle(t):{};n=parseFloat(v.width)||r.width,a=parseFloat(v.height)||r.height}var y=m.layoutAttributes.width.min,b=m.layoutAttributes.height.min;n1,_=!e.height&&Math.abs(r.height-a)>1;(_||x)&&(x&&(r.width=n),_&&(r.height=a)),t._initialAutoSize||(t._initialAutoSize={width:n,height:a}),m.sanitizeMargins(r)},m.supplyLayoutModuleDefaults=function(t,e,r,n){var a,i;c.Axes.supplyLayoutDefaults(t,e,r);var o=e._basePlotModules;for(a=0;a.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+a},r:{val:r.x,size:r.r+a},b:{val:r.y,size:r.b+a},t:{val:r.y,size:r.t+a}}}else delete n._pushmargin[e];n._replotting||m.doAutoMargin(t)}},m.doAutoMargin=function(t){var e=t._fullLayout;e._size||(e._size={}),e._pushmargin||(e._pushmargin={});var r=e._size,n=JSON.stringify(r),a=Math.max(e.margin.l||0,0),i=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;if(!1!==e.margin.autoexpand){l.base={l:{val:0,size:a},r:{val:1,size:i},t:{val:1,size:o},b:{val:0,size:s}};for(var f=Object.keys(l),h=0;hm){var k=(v*w+(A-e.width)*m)/(w-m),M=(A*(1-m)+(v-e.width)*(1-w))/(w-m);k>=0&&M>=0&&k+M>a+i&&(a=k,i=M)}}if(u(b)&&l[_].t){var T=l[_].t.val,E=l[_].t.size;if(T>y){var L=(b*T+(E-e.height)*y)/(T-y),S=(E*(1-y)+(b-e.height)*(1-T))/(T-y);L>=0&&S>=0&&L+S>s+o&&(s=L,o=S)}}}}if(r.l=Math.round(a),r.r=Math.round(i),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,!e._replotting&&"{}"!==n&&n!==JSON.stringify(e._size))return c.plot(t)},m.graphJson=function(t,e,r,n,a){function i(t){if("function"==typeof t)return null;if(d.isPlainObject(t)){var e,n,a={};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("string"==typeof(n=t[e+"src"])&&n.indexOf(":")>0&&!d.isPlainObject(t.stream))continue}else if("keepall"!==r&&"string"==typeof(n=t[e+"src"])&&n.indexOf(":")>0)continue;a[e]=i(t[e])}return a}return Array.isArray(t)?t.map(i):d.isJSDate(t)?d.ms2DateTimeLocal(+t):t}(a&&e&&!t._fullData||a&&!e&&!t._fullLayout)&&m.supplyDefaults(t);var o=a?t._fullData:t.data,s=a?t._fullLayout:t.layout,l=(t._transitionData||{})._frames,u={data:(o||[]).map(function(t){var r=i(t);return e&&delete r.fit,r})};return e||(u.layout=i(s)),t.framework&&t.framework.isPolar&&(u=t.framework.getConfig()),l&&(u.frames=i(l)),"object"===n?u:JSON.stringify(u)},m.modifyFrames=function(t,e){var r,n,a,i=t._transitionData._frames,o=t._transitionData._frameHash;for(r=0;r0&&(t._transitioningWithDuration=!0),t._transitionData._interruptCallbacks.push(function(){x=!0}),a.redraw&&t._transitionData._interruptCallbacks.push(function(){return c.redraw(t)}),t._transitionData._interruptCallbacks.push(function(){t.emit("plotly_transitioninterrupted",[])});var o,s,l=0,u=0,h=t._fullLayout._basePlotModules,p=!1;if(r)for(s=0;s=0,S=L?h.angularAxis.domain:n.extent(k),C=Math.abs(k[1]-k[0]);T&&!M&&(C=0);var O=S.slice();E&&M&&(O[1]+=C);var I=h.angularAxis.ticksCount||4;I>8&&(I=I/(I/8)+I%8),h.angularAxis.ticksStep&&(I=(O[1]-O[0])/I);var R=h.angularAxis.ticksStep||(O[1]-O[0])/(I*(h.minorTicks+1));A&&(R=Math.max(Math.round(R),1)),O[2]||(O[2]=R);var D=n.range.apply(this,O);if(D=D.map(function(t,e){return parseFloat(t.toPrecision(12))}),l=n.scale.linear().domain(O.slice(0,2)).range("clockwise"===h.direction?[0,360]:[360,0]),f.layout.angularAxis.domain=l.domain(),f.layout.angularAxis.endPadding=E?C:0,void 0===(e=n.select(this).select("svg.chart-root"))||e.empty()){var P=(new DOMParser).parseFromString("' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '","application/xml"),z=this.appendChild(this.ownerDocument.importNode(P.documentElement,!0));e=n.select(z)}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,F=e.select(".chart-group"),B={fill:"none",stroke:h.tickColor},j={"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){N=e.select(".legend-group").attr({transform:"translate("+[x,h.margin.top]+")"}).style({display:"block"});var H=p.map(function(t,e){var r=s.util.cloneJson(t);return r.symbol="DotPlot"===t.geometry?t.dotType||"circle":"LinePlot"!=t.geometry?"square":"line",r.visibleInLegend=void 0===t.visibleInLegend||t.visibleInLegend,r.color="LinePlot"===t.geometry?t.strokeColor:t.color,r});s.Legend().config({data:p.map(function(t,e){return t.name||"Element"+e}),legendConfig:i({},s.Legend.defaultConfig().legendConfig,{container:N,elements:H,reverseOrder:h.legend.reverseOrder})})();var U=N.node().getBBox();x=Math.min(h.width-U.width-h.margin.left-h.margin.right,h.height-h.margin.top-h.margin.bottom)/2,x=Math.max(10,x),w=[h.margin.left+x,h.margin.top+x],a.range([0,x]),f.layout.radialAxis.domain=a.domain(),N.attr("transform","translate("+[w[0]+x,w[1]-x]+")")}else N=e.select(".legend-group").style({display:"none"});e.attr({width:h.width,height:h.height}).style({opacity:h.opacity}),F.attr("transform","translate("+w+")").style({cursor:"crosshair"});var V=[(h.width-(h.margin.left+h.margin.right+2*x+(U?U.width:0)))/2,(h.height-(h.margin.top+h.margin.bottom+2*x))/2];if(V[0]=Math.max(0,V[0]),V[1]=Math.max(0,V[1]),e.select(".outer-group").attr("transform","translate("+V+")"),h.title){var G=e.select("g.title-group text").style(j).text(h.title),q=G.node().getBBox();G.attr({x:w[0]-q.width/2,y:w[1]-x-20})}var X=e.select(".radial.axis-group");if(h.radialAxis.gridLinesVisible){var Y=X.selectAll("circle.grid-circle").data(a.ticks(5));Y.enter().append("circle").attr({class:"grid-circle"}).style(B),Y.attr("r",a),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:h.backgroundColor,stroke:h.stroke});if(h.radialAxis.visible){var Z=n.svg.axis().scale(a).ticks(5).tickSize(5);X.call(Z).attr({transform:"rotate("+h.radialAxis.orientation+")"}),X.selectAll(".domain").style(B),X.selectAll("g>text").text(function(t,e){return this.textContent+h.radialAxis.ticksSuffix}).style(j).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,j["font-size"]]+")":"translate("+[0,j["font-size"]]+")"}}),X.selectAll("g>line").style({stroke:"black"})}var Q=e.select(".angular.axis-group").selectAll("g.angular-tick").data(D),$=Q.enter().append("g").classed("angular-tick",!0);Q.attr({transform:function(t,e){return"rotate("+u(t,e)+")"}}).style({display:h.angularAxis.visible?"block":"none"}),Q.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}),Q.select("line.grid-line").attr({x1:h.tickLength?x-h.tickLength:0,x2:x}).style({display:h.angularAxis.gridLinesVisible?"block":"none"}),$.append("text").classed("axis-text",!0).style(j);var K=Q.select("text.axis-text").attr({x:x+h.labelOffset,dy:o+"em",transform:function(t,e){var r=u(t,e),n=x+h.labelOffset,a=h.angularAxis.tickOrientation;return"horizontal"==a?"rotate("+-r+" "+n+" 0)":"radial"==a?r<270&&r>90?"rotate(180 "+n+" 0)":null:"rotate("+(r<=180&&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?"":A?A[t]+h.angularAxis.ticksSuffix:t+h.angularAxis.ticksSuffix}).style(j);h.angularAxis.rewriteTicks&&K.text(function(t,e){return e%(h.minorTicks+1)!=0?"":h.angularAxis.rewriteTicks(this.textContent,e)});var J=n.max(F.selectAll(".angular-tick text")[0].map(function(t,e){return t.getCTM().e+t.getBBox().width}));N.attr({transform:"translate("+[x+J,h.margin.top]+")"});var tt=e.select("g.geometry-group").selectAll("g").size()>0,et=e.select("g.geometry-group").selectAll("g.geometry").data(p);if(et.enter().append("g").attr({class:function(t,e){return"geometry geometry"+e}}),et.exit().remove(),p[0]||tt){var rt=[];p.forEach(function(t,e){var r={};r.radialScale=a,r.angularScale=l,r.container=et.filter(function(t,r){return r==e}),r.geometry=t.geometry,r.orientation=h.orientation,r.direction=h.direction,r.index=e,rt.push({data:t,geometryConfig:r})});var nt=n.nest().key(function(t,e){return void 0!==t.data.groupId||"unstacked"}).entries(rt),at=[];nt.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 i(s[r].defaultConfig(),t)});s[r]().config(n)()})}var it,ot,st=e.select(".guides-group"),lt=e.select(".tooltips-group"),ut=s.tooltipPanel().config({container:lt,fontSize:8})(),ct=s.tooltipPanel().config({container:lt,fontSize:8})(),ft=s.tooltipPanel().config({container:lt,hasTick:!0})();if(!M){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 r=s.util.getMousePos(W).angle;ht.attr({x2:-x,transform:"rotate("+r+")"}).style({opacity:.5});var n=(r+180+360-h.orientation)%360;it=l.invert(n);var a=s.util.convertToCartesian(x+12,r+180);ut.text(s.util.round(it)).move([a[0]+w[0],a[1]+w[1]])}).on("mouseout.angular-guide",function(t,e){st.select("line").style({opacity:0})})}var dt=st.select("circle").style({stroke:"grey",fill:"none"});F.on("mousemove.radial-guide",function(t,e){var r=s.util.getMousePos(W).radius;dt.attr({r:r}).style({opacity:.5}),ot=a.invert(s.util.getMousePos(W).radius);var n=s.util.convertToCartesian(r,h.radialAxis.orientation);ct.text(s.util.round(ot)).move([n[0]+w[0],n[1]+w[1]])}).on("mouseout.radial-guide",function(t,e){dt.style({opacity:0}),ft.hide(),ut.hide(),ct.hide()}),e.selectAll(".geometry-group .mark").on("mouseover.tooltip",function(t,r){var a=n.select(this),i=a.style("fill"),o="black",l=a.style("opacity")||1;if(a.attr({"data-opacity":l}),"none"!=i){a.attr({"data-fill":i}),o=n.hsl(i).darker().toString(),a.style({fill:o,opacity:1});var u={t:s.util.round(t[0]),r:s.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-V[0]-h.left,f.top+f.height/2-V[1]-h.top];ft.config({color:o}).text(c),ft.move(d)}else i=a.style("stroke"),a.attr({"data-stroke":i}),o=n.hsl(i).darker().toString(),a.style({stroke:o,opacity:1})}).on("mousemove.tooltip",function(t,e){if(0!=n.event.which)return!1;n.select(this).attr("data-fill")&&ft.show()}).on("mouseout.tooltip",function(t,e){ft.hide();var r=n.select(this),a=r.attr("data-fill");a?r.style({fill:a,opacity:r.attr("data-opacity")}):r.style({stroke:r.attr("data-stroke"),opacity:r.attr("data-opacity")})})}),d}var e,r,a,l,u={data:[],layout:{}},c={},f={},h=n.dispatch("hover"),d={};return d.render=function(e){return t(e),this},d.config=function(t){if(!arguments.length)return u;var e=s.util.cloneJson(t);return e.data.forEach(function(t,e){u.data[e]||(u.data[e]={}),i(u.data[e],s.Axis.defaultConfig().data[0]),i(u.data[e],t)}),i(u.layout,s.Axis.defaultConfig().layout),i(u.layout,e.layout),this},d.getLiveConfig=function(){return f},d.getinputConfig=function(){return c},d.radialScale=function(t){return a},d.angularScale=function(t){return l},d.svg=function(){return e},n.rebind(d,h,"on"),d},s.Axis.defaultConfig=function(t,e){return{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:n.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}}},s.util={},s.DATAEXTENT="dataExtent",s.AREA="AreaChart",s.LINE="LinePlot",s.DOT="DotPlot",s.BAR="BarChart",s.util._override=function(t,e){for(var r in t)r in e&&(e[r]=t[r])},s.util._extend=function(t,e){for(var r in t)e[r]=t[r]},s.util._rndSnd=function(){return 2*Math.random()-1+(2*Math.random()-1)+(2*Math.random()-1)},s.util.dataFromEquation2=function(t,e){var r=e||6;return n.range(0,360+r,r).map(function(e,r){var n=e*Math.PI/180;return[e,t(n)]})},s.util.dataFromEquation=function(t,e,r){var a=e||6,i=[],o=[];n.range(0,360+a,a).forEach(function(e,r){var n=e*Math.PI/180,a=t(n);i.push(e),o.push(a)});var s={t:i,r:o};return r&&(s.name=r),s},s.util.ensureArray=function(t,e){if(void 0===t)return null;var r=[].concat(t);return n.range(e).map(function(t,e){return r[e]||r[0]})},s.util.fillArrays=function(t,e,r){return e.forEach(function(e,n){t[e]=s.util.ensureArray(t[e],r)}),t},s.util.cloneJson=function(t){return JSON.parse(JSON.stringify(t))},s.util.validateKeys=function(t,e){"string"==typeof e&&(e=e.split("."));var r=e.shift();return t[r]&&(!e.length||objHasKeys(t[r],e))},s.util.sumArrays=function(t,e){return n.zip(t,e).map(function(t,e){return n.sum(t)})},s.util.arrayLast=function(t){return t[t.length-1]},s.util.arrayEqual=function(t,e){for(var r=Math.max(t.length,e.length,1);r-- >=0&&t[r]===e[r];);return-2===r},s.util.flattenArray=function(t){for(var e=[];!s.util.arrayEqual(e,t);)e=t,t=[].concat.apply([],t);return t},s.util.deduplicate=function(t){return t.filter(function(t,e,r){return r.indexOf(t)==e})},s.util.convertToCartesian=function(t,e){var r=e*Math.PI/180;return[t*Math.cos(r),t*Math.sin(r)]},s.util.round=function(t,e){var r=e||2,n=Math.pow(10,r);return Math.round(t*n)/n},s.util.getMousePos=function(t){var e=n.mouse(t.node()),r=e[0],a=e[1],i={};return i.x=r,i.y=a,i.pos=e,i.angle=180*(Math.atan2(a,r)+Math.PI)/Math.PI,i.radius=Math.sqrt(r*r+a*a),i},s.util.duplicatesCount=function(t){for(var e,r={},n={},a=0,i=t.length;a0)){var s=n.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 m.fill(r,a,i)},"fill-opacity":0,stroke:function(t,e){return m.stroke(r,a,i)},"stroke-width":function(t,e){return m["stroke-width"](r,a,i)},"stroke-dasharray":function(t,e){return m["stroke-dasharray"](r,a,i)},opacity:function(t,e){return m.opacity(r,a,i)},display:function(t,e){return m.display(r,a,i)}})}};var d=t.angularScale.range(),p=Math.abs(d[1]-d[0])/l[0].length*Math.PI/180,g=n.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,a){n.select(this).attr({class:"mark arc",d:g,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 a[e[n].data.strokeDash]},opacity:function(t,r,n){return e[n].data.opacity},display:function(t,r,n){return void 0===e[n].data.visible||e[n].data.visible?"block":"none"}},v=n.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(m).each(f[t.geometryType]),y.exit().remove(),v.exit().remove()})}var e=[s.PolyChart.defaultConfig()],r=n.dispatch("hover"),a={solid:"none",dash:[5,2],dot:[2,5]};return t.config=function(t){return arguments.length?(t.forEach(function(t,r){e[r]||(e[r]={}),i(e[r],s.PolyChart.defaultConfig()),i(e[r],t)}),this):e},t.getColorScale=function(){},n.rebind(t,r,"on"),t},s.PolyChart.defaultConfig=function(){return{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:n.scale.category20()}}},s.BarChart=function(){return s.PolyChart()},s.BarChart.defaultConfig=function(){return{geometryConfig:{geometryType:"bar"}}},s.AreaChart=function(){return s.PolyChart()},s.AreaChart.defaultConfig=function(){return{geometryConfig:{geometryType:"arc"}}},s.DotPlot=function(){return s.PolyChart()},s.DotPlot.defaultConfig=function(){return{geometryConfig:{geometryType:"dot",dotType:"circle"}}},s.LinePlot=function(){return s.PolyChart()},s.LinePlot.defaultConfig=function(){return{geometryConfig:{geometryType:"line"}}},s.Legend=function(){function t(){var r=e.legendConfig,a=e.data.map(function(t,e){return[].concat(t).map(function(t,n){var a=i({},r.elements[e]);return a.name=t,a.color=[].concat(r.elements[e].color)[n],a})}),o=n.merge(a);o=o.filter(function(t,e){return r.elements[e]&&(r.elements[e].visibleInLegend||void 0===r.elements[e].visibleInLegend)}),r.reverseOrder&&(o=o.reverse());var s=r.container;("string"==typeof s||s.nodeName)&&(s=n.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=n.range(o.length),m=n.scale[c?"linear":"ordinal"]().domain(g).range(l),v=n.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!=n.svg.symbolTypes.indexOf(t)?n.svg.symbol().type(t).size(r)():n.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,v(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 _=n.svg.axis().scale(v).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=s.Legend.defaultConfig(),r=n.dispatch("hover");return t.config=function(t){return arguments.length?(i(e,t),this):e},n.rebind(t,r,"on"),t},s.Legend.defaultConfig=function(t,e){return{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}}},s.tooltipPanel=function(){var t,e,r,a={container:null,hasTick:!1,fontSize:12,color:"white",padding:5},o="tooltip-"+s.tooltipPanel.uid++,l=function(){t=a.container.selectAll("g."+o).data([0]);var n=t.enter().append("g").classed(o,!0).style({"pointer-events":"none",display:"none"});return r=n.append("path").style({fill:"white","fill-opacity":.9}).attr({d:"M0 0"}),e=n.append("text").attr({dx:a.padding+10,dy:.3*+a.fontSize}),l};return l.text=function(i){var o=n.hsl(a.color).l,s=o>=.5?"#aaa":"white",u=o>=.5?"black":"white",c=i||"";e.style({fill:u,"font-size":a.fontSize+"px"}).text(c);var f=a.padding,h=e.node().getBBox(),d={fill:a.color,stroke:s,"stroke-width":"2px"},p=h.width+2*f+10,g=h.height+2*f;return r.attr({d:"M"+[[10,-g/2],[10,-g/4],[a.hasTick?0:10,0],[10,g/4],[10,g/2],[p,g/2],[p,-g/2]].join("L")+"Z"}).style(d),t.attr({transform:"translate("+[10,-g/2+2*f]+")"}),t.style({display:"block"}),l},l.move=function(e){if(t)return t.attr({transform:"translate("+[e[0],e[1]]+")"}).style({display:"block"}),l},l.hide=function(){if(t)return t.style({display:"none"}),l},l.show=function(){if(t)return t.style({display:"block"}),l},l.config=function(t){return i(a,t),l},l},s.tooltipPanel.uid=1,s.adapter={},s.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=i({},t);return[[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"]]].forEach(function(t,r){s.util.translator.apply(null,t.concat(e))}),e||delete n.marker,e&&delete n.groupId,e?("LinePlot"===n.geometry?(n.type="scatter",!0===n.dotVisible?(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 a=s.util.duplicates(r.data.map(function(t,e){return t.geometry}));r.data.forEach(function(t,e){var n=a.indexOf(t.geometry);-1!=n&&(r.data[e].groupId=n)})}if(t.layout){var o=i({},t.layout);if([[o,["plot_bgcolor"],["backgroundColor"]],[o,["showlegend"],["showLegend"]],[o,["radialaxis"],["radialAxis"]],[o,["angularaxis"],["angularAxis"]],[o.angularaxis,["showline"],["gridLinesVisible"]],[o.angularaxis,["showticklabels"],["labelsVisible"]],[o.angularaxis,["nticks"],["ticksCount"]],[o.angularaxis,["tickorientation"],["tickOrientation"]],[o.angularaxis,["ticksuffix"],["ticksSuffix"]],[o.angularaxis,["range"],["domain"]],[o.angularaxis,["endpadding"],["endPadding"]],[o.radialaxis,["showline"],["gridLinesVisible"]],[o.radialaxis,["tickorientation"],["tickOrientation"]],[o.radialaxis,["ticksuffix"],["ticksSuffix"]],[o.radialaxis,["range"],["domain"]],[o.angularAxis,["showline"],["gridLinesVisible"]],[o.angularAxis,["showticklabels"],["labelsVisible"]],[o.angularAxis,["nticks"],["ticksCount"]],[o.angularAxis,["tickorientation"],["tickOrientation"]],[o.angularAxis,["ticksuffix"],["ticksSuffix"]],[o.angularAxis,["range"],["domain"]],[o.angularAxis,["endpadding"],["endPadding"]],[o.radialAxis,["showline"],["gridLinesVisible"]],[o.radialAxis,["tickorientation"],["tickOrientation"]],[o.radialAxis,["ticksuffix"],["ticksSuffix"]],[o.radialAxis,["range"],["domain"]],[o.font,["outlinecolor"],["outlineColor"]],[o.legend,["traceorder"],["reverseOrder"]],[o,["labeloffset"],["labelOffset"]],[o,["defaultcolorrange"],["defaultColorRange"]]].forEach(function(t,r){s.util.translator.apply(null,t.concat(e))}),e?(void 0!==o.tickLength&&(o.angularaxis.ticklen=o.tickLength,delete o.tickLength),o.tickColor&&(o.angularaxis.tickcolor=o.tickColor,delete o.tickColor)):(o.angularAxis&&void 0!==o.angularAxis.ticklen&&(o.tickLength=o.angularAxis.ticklen),o.angularAxis&&void 0!==o.angularAxis.tickcolor&&(o.tickColor=o.angularAxis.tickcolor)),o.legend&&"boolean"!=typeof o.legend.reverseOrder&&(o.legend.reverseOrder="normal"!=o.legend.reverseOrder),o.legend&&"boolean"==typeof o.legend.traceorder&&(o.legend.traceorder=o.legend.traceorder?"reversed":"normal",delete o.legend.reverseOrder),o.margin&&void 0!==o.margin.t){var l=["t","r","b","l","pad"],u=["top","right","bottom","left","pad"],c={};n.entries(o.margin).forEach(function(t,e){c[u[l.indexOf(t.key)]]=t.value}),o.margin=c}e&&(delete o.needsEndSpacing,delete o.minorTickColor,delete o.minorTicks,delete o.angularaxis.ticksCount,delete o.angularaxis.ticksCount,delete o.angularaxis.ticksStep,delete o.angularaxis.rewriteTicks,delete o.angularaxis.nticks,delete o.radialaxis.ticksCount,delete o.radialaxis.ticksCount,delete o.radialaxis.ticksStep,delete o.radialaxis.rewriteTicks,delete o.radialaxis.nticks),r.layout=o}return r},t}},{"../../constants/alignment":329,"../../lib":350,d3:62}],427:[function(t,e,r){"use strict";var n=t("d3"),a=t("../../lib"),i=t("../../components/color"),o=t("./micropolar"),s=t("./undo_manager"),l=a.extendDeepAll,u=e.exports={};u.framework=function(t){function e(e,a){return a&&(f=a),n.select(n.select(f).node().parentNode).selectAll(".svg-container>*:not(.chart-root)").remove(),r=r?l(r,e):e,i||(i=o.Axis()),c=o.adapter.plotly().convert(r),i.config(c).render(f),t.data=r.data,t.layout=r.layout,u.fillLayout(t),r}var r,a,i,c,f,h=new s;return e.isPolar=!0,e.svg=function(){return i.svg()},e.getConfig=function(){return r},e.getLiveConfig=function(){return o.adapter.plotly().convert(i.getLiveConfig(),!0)},e.getLiveScales=function(){return{t:i.angularScale(),r:i.radialScale()}},e.setUndoPoint=function(){var t=this,e=o.util.cloneJson(r);!function(e,r){h.add({undo:function(){r&&t(r)},redo:function(){t(e)}})}(e,a),a=o.util.cloneJson(e)},e.undo=function(){h.undo()},e.redo=function(){h.redo()},e},u.fillLayout=function(t){var e=n.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:i.background,_container:e,_paperdiv:r,_paper:a};t._fullLayout=l(o,t.layout)}},{"../../components/color":233,"../../lib":350,"./micropolar":426,"./undo_manager":428,d3:62}],428:[function(t,e,r){"use strict";e.exports=function(){function t(t,e){return t?(a=!0,t[e](),a=!1,this):this}var e,r=[],n=-1,a=!1;return{add:function(t){return a?this:(r.splice(n+1,r.length-n),r.push(t),n=r.length-1,this)},setCallback:function(t){e=t},undo:function(){var a=r[n];return a?(t(a,"undo"),n-=1,e&&e(a.undo),this):this},redo:function(){var a=r[n+1];return a?(t(a,"redo"),n+=1,e&&e(a.redo),this):this},clear:function(){r=[],n=-1},hasUndo:function(){return-1!==n},hasRedo:function(){return n-1}var i=t("../lib"),o=t("../plots/plots"),s=i.extendFlat,l=i.extendDeep;e.exports=function(t,e){t.framework&&t.framework.isPolar&&(t=t.framework.getConfig());var r,i=t.data,u=t.layout,c=l([],i),f=l({},u,n(e.tileClass)),h=t._context||{};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(r=0;r")?"":e.html(t).text()});return e.remove(),r}function a(t){return t.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g,"&")}var i=t("d3"),o=t("../components/drawing"),s=t("../components/color"),l=t("../constants/xmlns_namespaces"),u=/"/g,c=new RegExp('("TOBESTRIPPED)|(TOBESTRIPPED")',"g");e.exports=function(t,e){var r,f=t._fullLayout,h=f._paper,d=f._toppaper;h.insert("rect",":first-child").call(o.setRect,0,0,f.width,f.height).call(s.fill,f.paper_bgcolor);var p=f._basePlotModules||[];for(r=0;rs.end&&(s.start=s.end=(s.start+s.end)/2),e._input.contours||(e._input.contours={}),i(e._input.contours,{start:s.start,end:s.end,size:s.size}),e._input.autocontour=!0}else{var u=s.start,c=s.end,f=e._input.contours;if(u>c&&(s.start=f.start=c,c=s.end=f.end=u,u=s.start),!(s.size>0)){var h;h=u===c?1:n(u,c,e.ncontours).dtick,f.size=s.size=h}}return r}},{"../../lib":350,"../../plots/cartesian/axes":389,"../heatmap/calc":449}],440:[function(t,e,r){"use strict";var n=t("../../plots/plots"),a=t("../../components/colorbar/draw"),i=t("./make_color_map"),o=t("./end_plus");e.exports=function(t,e){var r=e[0].trace,s="cb"+r.uid;if(t._fullLayout._infolayer.selectAll("."+s).remove(),!r.showscale)return void n.autoMargin(t,s);var l=a(t,s);e[0].t.cb=l;var u=r.contours,c=r.line,f=u.size||1,h=u.coloring,d=i(r,{isColorbar:!0});"heatmap"===h&&l.filllevels({start:r.zmin,end:r.zmax,size:(r.zmax-r.zmin)/254}),l.fillcolor("fill"===h||"heatmap"===h?d:"").line({color:"lines"===h?d:c.color,width:!1!==u.showlines?c.width:0,dash:c.dash}).levels({start:u.start,end:o(u),size:f}).options(r.colorbar)()}},{"../../components/colorbar/draw":236,"../../plots/plots":422,"./end_plus":443,"./make_color_map":444}],441:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("./attributes");e.exports=function(t,e,r){var i,o=n.coerce2(t,e,a,"contours.start"),s=n.coerce2(t,e,a,"contours.end"),l=!1===o||!1===s,u=r("contours.size");!(i=l?e.autocontour=!0:r("autocontour",!1))&&u||r("ncontours")}},{"../../lib":350,"./attributes":438}],442:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("../heatmap/has_columns"),i=t("../heatmap/xyz_defaults"),o=t("./contours_defaults"),s=t("./style_defaults"),l=t("./attributes");e.exports=function(t,e,r,u){function c(r,a){return n.coerce(t,e,l,r,a)}if(!i(t,e,c,u))return void(e.visible=!1);c("text"),c("connectgaps",a(e)),o(t,e,c),s(t,e,c,u)}},{"../../lib":350,"../heatmap/has_columns":455,"../heatmap/xyz_defaults":459,"./attributes":438,"./contours_defaults":441,"./style_defaults":445}],443:[function(t,e,r){"use strict";e.exports=function(t){return t.end+t.size/1e6}},{}],444:[function(t,e,r){"use strict";var n=t("d3"),a=t("../../components/colorscale"),i=t("./end_plus");e.exports=function(t){var e=t.contours,r=e.start,o=i(e),s=e.size||1,l=Math.floor((o-r)/s)+1,u="lines"===e.coloring?0:1;isFinite(s)||(s=1,l=1);var c,f,h=t.colorscale,d=h.length,p=new Array(d),g=new Array(d);if("heatmap"===e.coloring){for(t.zauto&&!1===t.autocontour&&(t.zmin=r-s/2,t.zmax=t.zmin+l*s),f=0;fO){r("x scale is not linear");break}}if(y.length&&"fast"===L){var I=(y[y.length-1]-y[0])/(y.length-1),R=Math.abs(I/100);for(w=0;wR){r("y scale is not linear");break}}}var D=c(_),P="scaled"===e.xtype?"":g,z=p(e,P,m,v,D,A),N="scaled"===e.ytype?"":y,F=p(e,N,b,x,_.length,k);E||(i.expand(A,z),i.expand(k,F));var B={x:z,y:F,z:_,text:e.text};if(s(e,_,"","z"),M&&e.contours&&"heatmap"===e.contours.coloring){var j={type:"contour"===e.type?"heatmap":"histogram2d",xcalendar:e.xcalendar,ycalendar:e.ycalendar};B.xfill=p(j,P,m,v,D,A),B.yfill=p(j,N,b,x,_.length,k)}return[B]}},{"../../components/colorscale/calc":239,"../../lib":350,"../../plots/cartesian/axes":389,"../../registry":429,"../histogram2d/calc":467,"./clean_2d_array":450,"./convert_column_xyz":452,"./find_empties":454,"./has_columns":455,"./interp2d":456,"./make_bound_array":457,"./max_row_length":458}],450:[function(t,e,r){"use strict";var n=t("fast-isnumeric");e.exports=function(t,e){var r,a,i,o,s,l;if(e){for(r=0,s=0;s=0;o--)i=h[o],r=i[0],a=i[1],(s=((f[[r-1,a]]||g)[2]+(f[[r+1,a]]||g)[2]+(f[[r,a-1]]||g)[2]+(f[[r,a+1]]||g)[2])/20)&&(l[i]=[r,a,s],h.splice(o,1),u=!0);if(!u)throw"findEmpties iterated with no new neighbors";for(i in l)f[i]=l[i],c.push(l[i])}return c.sort(function(t,e){return e[2]-t[2]})}},{"./max_row_length":458}],455:[function(t,e,r){"use strict";e.exports=function(t){return!Array.isArray(t.z[0])}},{}],456:[function(t,e,r){"use strict";function n(t){return.5-.25*Math.min(1,.5*t)}function a(t,e,r){var n,a,i,s,l,u,c,f,h,d,p,g,m,v=0;for(s=0;sg&&(v=Math.max(v,Math.abs(t[a][i]-p)/(m-g))))}return v}var i=t("../../lib"),o=[[-1,0],[1,0],[0,-1],[0,1]];e.exports=function(t,e,r){var o,s,l=1;if(Array.isArray(r))for(o=0;o.01;o++)l=a(t,e,n(l));return l>.01&&i.log("interp2d didn't converge quickly",l),t}},{"../../lib":350}],457:[function(t,e,r){"use strict";var n=t("../../registry");e.exports=function(t,e,r,a,i,o){var s,l,u,c=[],f=n.traceIs(t,"contour"),h=n.traceIs(t,"histogram"),d=n.traceIs(t,"gl2d");if(Array.isArray(e)&&e.length>1&&!h&&"category"!==o.type){var p=e.length;if(!(p<=i))return f?e.slice(0,i):e.slice(0,i+1);if(f||d)c=e.slice(0,i);else if(1===i)c=[e[0]-.5,e[0]+.5];else{for(c=[1.5*e[0]-.5*e[1]],u=1;u0&&(n=!0);for(var s=0;si){var o=i-r[t];return r[t]=i,o}}return 0},max:function(t,e,r,a){var i=a[e];if(n(i)){if(i=Number(i),!n(r[t]))return r[t]=i,i;if(r[t]0?Number(h):f;else if("string"!=typeof h)u.size=f;else{var d=h.charAt(0),p=h.substr(1);p=n(p)?Number(p):0,(p<=0||"date"!==i||"M"!==d||p!==Math.round(p))&&(u.size=f)}var g="autobin"+r;"boolean"!=typeof t[g]&&(t[g]=!((u.start||0===u.start)&&(u.end||0===u.end))),t[g]||delete t["nbins"+r]}},{"../../constants/numerical":333,"../../lib":350,"fast-isnumeric":68}],466:[function(t,e,r){"use strict";e.exports={percent:function(t,e){for(var r=t.length,n=100/e,a=0;ak&&g.splice(k,g.length-k),v.length>k&&v.splice(k,v.length-k),!e.autobinx&&e.xbins&&null!==e.xbins.start&&null!==e.xbins.end||(e.xbins=a.autoBin(g,p,e.nbinsx,"2d",y),"histogram2dcontour"===e.type&&(e.xbins.start=w(a.tickIncrement(x(e.xbins.start),e.xbins.size,!0,y)),e.xbins.end=w(a.tickIncrement(x(e.xbins.end),e.xbins.size,!1,y))),e._input.xbins=e.xbins,e._input.autobinx=e.autobinx),!e.autobiny&&e.ybins&&null!==e.ybins.start&&null!==e.ybins.end||(e.ybins=a.autoBin(v,m,e.nbinsy,"2d",b),"histogram2dcontour"===e.type&&(e.ybins.start=A(a.tickIncrement(_(e.ybins.start),e.ybins.size,!0,b)),e.ybins.end=A(a.tickIncrement(_(e.ybins.end),e.ybins.size,!1,b))),e._input.ybins=e.ybins,e._input.autobiny=e.autobiny),h=[] -;var M,T,E=[],L=[],S="string"==typeof e.xbins.size,C="string"==typeof e.ybins.size,O=S?[]:e.xbins,I=C?[]:e.ybins,R=0,D=[],P=e.histnorm,z=e.histfunc,N=-1!==P.indexOf("density"),F="max"===z||"min"===z,B=F?null:0,j=i.count,H=o[P],U=!1,V=[],G=[],q="z"in e?e.z:"marker"in e&&Array.isArray(e.marker.color)?e.marker.color:"";q&&"count"!==z&&(U="avg"===z,j=i[z]);var X=e.xbins,Y=x(X.start),W=x(X.end)+(Y-a.tickIncrement(Y,X.size,!1,y))/1e6;for(d=Y;d=0&&M=0&&T<$&&(R+=j(M,d,h[T],q,D[T]));if(U)for(T=0;T<$;T++)R+=s(h[T],D[T]);if(H)for(T=0;T<$;T++)H(h[T],R,V,G[T]);return{x:g,x0:r,dx:u,y:v,y0:c,dy:f,z:h}}},{"../../lib":350,"../../plots/cartesian/axes":389,"../histogram/average":463,"../histogram/bin_functions":464,"../histogram/clean_bins":465,"../histogram/norm_functions":466}],468:[function(t,e,r){"use strict";var n=t("../../components/colorscale/color_attributes"),a=t("../../components/colorbar/attributes"),i=t("../../components/colorscale/scales"),o=t("../../plots/cartesian/layout_attributes"),s=t("../../plots/font_attributes"),l=t("../../lib/extend").extendDeep,u=t("../../lib/extend").extendFlat;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]}},labelfont:u({},s,{}),tickfont:u({},s,{}),rangefont:u({},s,{}),dimensions:{_isLinkedToArray:"dimension",label:{valType:"string"},tickvals:o.tickvals,ticktext:o.ticktext,tickformat:{valType:"string",dflt:"3s"},visible:{valType:"boolean",dflt:!0},range:{valType:"info_array",items:[{valType:"number"},{valType:"number"}]},constraintrange:{valType:"info_array",items:[{valType:"number"},{valType:"number"}]},values:{valType:"data_array",dflt:[]}},line:u({},l({},n("line"),{colorscale:l({},n("line").colorscale,{dflt:i.Viridis}),autocolorscale:l({},n("line").autocolorscale,{dflt:!1})}),{showscale:{valType:"boolean",dflt:!1},colorbar:a})}},{"../../components/colorbar/attributes":234,"../../components/colorscale/color_attributes":240,"../../components/colorscale/scales":251,"../../lib/extend":343,"../../plots/cartesian/layout_attributes":400,"../../plots/font_attributes":413}],469:[function(t,e,r){"use strict";var n=t("d3"),a=t("../../plots/plots"),i=t("./plot"),o=t("../../constants/xmlns_namespaces"),s=t("./constants");r.name="parcoords",r.attr="type",r.plot=function(t){var e=a.getSubplotCalcData(t.calcdata,"parcoords","parcoords");e.length&&i(t,e)},r.clean=function(t,e,r,n){var a=n._has&&n._has("parcoords"),i=e._has&&e._has("parcoords");a&&!i&&(n._paperdiv.selectAll(".parcoords-line-layers").remove(),n._paperdiv.selectAll(".parcoords-line-layers").remove(),n._paperdiv.selectAll(".parcoords").remove(),n._paperdiv.selectAll(".parcoords").remove(),n._glimages.selectAll("*").remove())},r.toSVG=function(t){function e(e){var n=this,a=n.toDataURL("image/png"),i=r.append("svg:image"),l=t._fullLayout._size,u=t._fullData[e.model.key].domain;i.attr({xmlns:o.svg,"xlink:href":a,x:l.l+l.w*u.x[0]-s.overdrag,y:l.t+l.h*(1-u.y[1]),width:(u.x[1]-u.x[0])*l.w+2*s.overdrag,height:(u.y[1]-u.y[0])*l.h,preserveAspectRatio:"none"})}var r=t._fullLayout._glimages,a=n.selectAll(".svg-container");a.filter(function(t,e){return e===a.size()-1}).selectAll(".parcoords-lines.context, .parcoords-lines.focus").each(e),window.setTimeout(function(){n.selectAll("#filterBarPattern").attr("id","filterBarPattern")},60)}},{"../../constants/xmlns_namespaces":335,"../../plots/plots":422,"./constants":472,"./plot":477,d3:62}],470:[function(t,e,r){"use strict";var n=t("../../components/colorscale/has_colorscale"),a=t("../../components/colorscale/calc"),i=t("../../lib");e.exports=function(t,e){var r=!!e.line.colorscale&&i.isArray(e.line.color),o=r?e.line.color:Array.apply(0,Array(e.dimensions.reduce(function(t,e){return Math.max(t,e.values.length)},0))).map(function(){return.5}),s=r?e.line.colorscale:[[0,e.line.color],[1,e.line.color]];return n(e,"line")&&a(e,e.line.color,"line","c"),[{lineColor:o,cscale:s}]}},{"../../components/colorscale/calc":239,"../../components/colorscale/has_colorscale":246,"../../lib":350}],471:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("../../lib"),i=t("../../plots/plots"),o=t("../../components/colorscale"),s=t("../../components/colorbar/draw");e.exports=function(t,e){var r=e[0].trace,l=r.line,u="cb"+r.uid;if(t._fullLayout._infolayer.selectAll("."+u).remove(),void 0===l||!l.showscale)return void i.autoMargin(t,u);var c=l.color,f=l.cmin,h=l.cmax;n(f)||(f=a.aggNums(Math.min,null,c)),n(h)||(h=a.aggNums(Math.max,null,c));var d=e[0].t.cb=s(t,u),p=o.makeColorScaleFunc(o.extractScale(l.colorscale,f,h),{noNumericCheck:!0});d.fillcolor(p).filllevels({start:f,end:h,size:(h-f)/254}).options(l.colorbar)()}},{"../../components/colorbar/draw":236,"../../components/colorscale":247,"../../lib":350,"../../plots/plots":422,"fast-isnumeric":68}],472:[function(t,e,r){"use strict";e.exports={maxDimensionCount:60,overdrag:45,verticalPadding:2,tickDistance:50,canvasPixelRatio:1,blockLineCount:5e3,scatter:!1,layers:["contextLineLayer","focusLineLayer","pickLineLayer"],axisTitleOffset:28,axisExtentOffset:10,bar:{width:4,capturewidth:10,fillcolor:"magenta",fillopacity:1,strokecolor:"white",strokeopacity:1,strokewidth:1,handleheight:16,handleopacity:1,handleoverlap:0}}},{}],473:[function(t,e,r){"use strict";function n(t,e,r,n,a){a("line.color",r),s(t,"line")&&i.isArray(t.line.color)?(a("line.colorscale"),l(t,e,n,a,{prefix:"line.",cLetter:"c"})):a("line.color",r)}function a(t,e){function r(t,e){return i.coerce(n,a,o.dimensions,t,e)}var n,a,s,l=t.dimensions||[],c=e.dimensions=[],f=1/0;for(l.length>u&&(i.log("parcoords traces support up to "+u+" dimensions at the moment"),l.splice(u)),s=0;s0);d&&(r("label"),r("tickvals"),r("ticktext"),r("tickformat"),r("range"),r("constraintrange"),f=Math.min(f,a.values.length)),a._index=s,c.push(a)}if(isFinite(f))for(s=0;sf&&(a.values=a.values.slice(0,f));return c}var i=t("../../lib"),o=t("./attributes"),s=t("../../components/colorscale/has_colorscale"),l=t("../../components/colorscale/defaults"),u=t("./constants").maxDimensionCount;e.exports=function(t,e,r,s){function l(r,n){return i.coerce(t,e,o,r,n)}var u=a(t,e);n(t,e,r,s,l),l("domain.x"),l("domain.y"),Array.isArray(u)&&u.length||(e.visible=!1);var c={family:s.font.family,size:Math.round(s.font.size*(10/12)),color:s.font.color};i.coerceFont(l,"labelfont",c),i.coerceFont(l,"tickfont",c),i.coerceFont(l,"rangefont",c)}},{"../../components/colorscale/defaults":242,"../../components/colorscale/has_colorscale":246,"../../lib":350,"./attributes":468,"./constants":472}],474:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.calc=t("./calc"),n.plot=t("./plot"),n.colorbar=t("./colorbar"),n.moduleType="trace",n.name="parcoords",n.basePlotModule=t("./base_plot"),n.categories=["gl","noOpacity"],n.meta={},e.exports=n},{"./attributes":468,"./base_plot":469,"./calc":470,"./colorbar":471,"./defaults":473,"./plot":477}],475:[function(t,e,r){"use strict";function n(t){t.read({x:0,y:0,width:1,height:1,data:x})}function a(t,e,r,n,a){var i=t._gl;i.enable(i.SCISSOR_TEST),i.scissor(e,r,n,a),t.clear({color:[0,0,0,0],depth:1})}function i(t,e,r,i,o,s){function l(n){var c;c=Math.min(i,o-n*i),s.offset=v*n*i,s.count=v*c,0===n&&(window.cancelAnimationFrame(r.currentRafs[u]),delete r.currentRafs[u],a(t,s.scissorX,s.scissorY,s.scissorWidth,s.viewBoxSize[1])),r.clearOnly||(e(s),n*i+c>>8*e)%256/255}function u(t,e,r,n){for(var a=[],i=0;i=m-4?l(i,m-2-s):.5);return a}function c(t,e,r){var n,a,i,o=[];for(a=0;ah&&(h=t[l].dim2.canvasX,c=l),t[l].dim1.canvasXa)return i;a=o,i=n[r]}return n[n.length-1]}function l(t,e,r){var n=o(r);return r.tickvals?_.scale.ordinal().domain(r.tickvals).range(r.tickvals.map(function(t){return(t-n[0])/(n[1]-n[0])}).map(function(r){return t-e+r*(e-(t-e))})):_.scale.linear().domain(n).range([t-e,e])}function u(t,e){return _.scale.linear().range([t-e,e])}function c(t){return _.scale.linear().domain(o(t))}function f(t){var e=o(t);return t.tickvals&&_.scale.ordinal().domain(t.tickvals).range(t.tickvals.map(function(t){return(t-e[0])/(e[1]-e[0])}))}function h(t){var e=t.map(function(t){return t[0]}),r=t.map(function(t){return t[1]}),n=r.map(function(t){return _.rgb(t)}),a=function(t){return function(e){return e[t]}},i="rgb".split("").map(function(t){return _.scale.linear().clamp(!0).domain(e).range(n.map(a(t)))});return function(t){return i.map(function(e){return e(t)})}}function d(t){return t[0]}function p(t,e,r){var n=d(e),a=n.trace,o=n.lineColor,s=n.cscale,l=a.line,u=a.domain,f=a.dimensions,p=t.width,g=a.labelfont,m=a.tickfont,v=a.rangefont,y=x.extendDeep({},l,{color:o.map(c({values:o,range:[l.cmin,l.cmax]})),blockLineCount:b.blockLineCount,canvasOverdrag:b.overdrag*b.canvasPixelRatio}),_=Math.floor(p*(u.x[1]-u.x[0])),w=Math.floor(t.height*(u.y[1]-u.y[0])),A=t.margin||{l:80,r:80,t:100,b:80},k=_,M=w;return{key:r,colCount:f.filter(i).length,dimensions:f,tickDistance:b.tickDistance,unitToColor:h(s),lines:y,labelFont:g,tickFont:m,rangeFont:v,translateX:u.x[0]*p,translateY:t.height-u.y[1]*t.height,pad:A,canvasWidth:k*b.canvasPixelRatio+2*y.canvasOverdrag,canvasHeight:M*b.canvasPixelRatio,width:k,height:M,canvasPixelRatio:b.canvasPixelRatio}}function g(t){var e=t.width,r=t.height,n=t.dimensions,a=t.canvasPixelRatio,o=function(r){return e*r/Math.max(1,t.colCount-1)},s=b.verticalPadding/(r*a),h=1-2*s,d=function(t){return s+h*t},p={key:t.key,xScale:o,model:t},g={};return p.dimensions=n.filter(i).map(function(e,n){var i=c(e),s=g[e.label];return g[e.label]=(s||0)+1,{key:e.label+(s?"__"+s:""),label:e.label,tickFormat:e.tickformat,tickvals:e.tickvals,ticktext:e.ticktext,ordinal:!!e.tickvals,scatter:b.scatter||e.scatter,xIndex:n,crossfilterDimensionIndex:n,visibleIndex:e._index,height:r,values:e.values,paddedUnitValues:e.values.map(i).map(d),xScale:o,x:o(n),canvasX:o(n)*a,unitScale:u(r,b.verticalPadding),domainScale:l(r,b.verticalPadding,e),ordinalScale:f(e),domainToUnitScale:i,filter:e.constraintrange?e.constraintrange.map(i):[0,1],parent:p,model:t}}),p}function m(t){return b.layers.map(function(e){return{key:e,context:"contextLineLayer"===e,pick:"pickLineLayer"===e,viewModel:t,model:t.model}})}function v(t){t.classed("axisExtentText",!0).attr("text-anchor","middle").style("cursor","default").style("user-select","none")}var y=t("./lines"),b=t("./constants"),x=t("../../lib"),_=t("d3"),w=t("../../components/drawing");e.exports=function(t,e,r,i,o){function l(t){var e=t.selectAll("defs").data(a,n);e.enter().append("defs");var r=e.selectAll("#filterBarPattern").data(a,n);r.enter().append("pattern").attr("id","filterBarPattern").attr("patternUnits","userSpaceOnUse"),r.attr("x",-b.bar.width).attr("width",b.bar.capturewidth).attr("height",function(t){return t.model.height});var i=r.selectAll("rect").data(a,n);i.enter().append("rect").attr("shape-rendering","crispEdges"),i.attr("height",function(t){return t.model.height}).attr("width",b.bar.width).attr("x",b.bar.width/2).attr("fill",b.bar.fillcolor).attr("fill-opacity",b.bar.fillopacity).attr("stroke",b.bar.strokecolor).attr("stroke-opacity",b.bar.strokeopacity).attr("stroke-width",b.bar.strokewidth)}function u(t){return t.dimensions.some(function(t){return 0!==t.filter[0]||1!==t.filter[1]})}function c(t,e){for(var r=e.panels||(e.panels=[]),n=t.each(function(t){return t})[e.key].map(function(t){return t.__data__}),a=n.length-1,i=0;i<1;i++)for(var o=0;o=r||s>=n)return;var l=t.lineLayer.readPixel(i,n-1-s),u=0!==l[3],c=u?l[2]+256*(l[1]+256*l[0]):null,f={x:i,y:s,clientX:e.clientX,clientY:e.clientY,dataIndex:t.model.key,curveNumber:c};c!==I&&(u?o.hover(f):o.unhover&&o.unhover(f),I=c)}}),C.style("margin",function(t){var e=t.model.pad;return e.t+"px "+e.r+"px "+e.b+"px "+e.l+"px"}).attr("width",function(t){return t.model.canvasWidth}).attr("height",function(t){return t.model.canvasHeight}).style("width",function(t){return t.model.width+2*b.overdrag+"px"}).style("height",function(t){return t.model.height+"px"}).style("opacity",function(t){return t.pick?.01:1}),e.style("background","rgba(255, 255, 255, 0)");var R=e.selectAll(".parcoords").data(L,n);R.exit().remove(),R.enter().append("g").classed("parcoords",!0).attr("overflow","visible").style("box-sizing","content-box").style("position","absolute").style("left",0).style("overflow","visible").style("shape-rendering","crispEdges").style("pointer-events","none").call(l),R.attr("width",function(t){return t.model.width+t.model.pad.l+t.model.pad.r}).attr("height",function(t){return t.model.height+t.model.pad.t+t.model.pad.b}).attr("transform",function(t){return"translate("+t.model.translateX+","+t.model.translateY+")"});var D=R.selectAll(".parcoordsControlView").data(a,n);D.enter().append("g").classed("parcoordsControlView",!0).style("box-sizing","content-box"),D.attr("transform",function(t){return"translate("+t.model.pad.l+","+t.model.pad.t+")"});var P=D.selectAll(".yAxis").data(function(t){return t.dimensions},n);P.enter().append("g").classed("yAxis",!0).each(function(t){O.dimensions.push(t)}),D.each(function(t){h(P,t)}),C.each(function(t){t.lineLayer=y(this,t.model.lines,t.model.canvasWidth,t.model.canvasHeight,t.viewModel.dimensions,t.viewModel.panels,t.model.unitToColor,t.context,t.pick,b.scatter),t.viewModel[t.key]=t.lineLayer,O.renderers.push(function(){t.lineLayer.render(t.viewModel.panels,!0)}),t.lineLayer.render(t.viewModel.panels,!t.context)}),P.attr("transform",function(t){return"translate("+t.xScale(t.xIndex)+", 0)"}),P.call(_.behavior.drag().origin(function(t){return t}).on("drag",function(t){var e=t.parent;E=!1,T||(t.x=Math.max(-b.overdrag,Math.min(t.model.width+b.overdrag,_.event.x)),t.canvasX=t.x*t.model.canvasPixelRatio,P.sort(function(t,e){return t.x-e.x}).each(function(e,r){e.xIndex=r,e.x=t===e?e.x:e.xScale(e.xIndex),e.canvasX=e.x*e.model.canvasPixelRatio}),h(P,e),P.filter(function(e){return 0!==Math.abs(t.xIndex-e.xIndex)}).attr("transform",function(t){return"translate("+t.xScale(t.xIndex)+", 0)"}),_.select(this).attr("transform","translate("+t.x+", 0)"),P.each(function(r,n,a){a===t.parent.key&&(e.dimensions[n]=r)}),e.contextLineLayer&&e.contextLineLayer.render(e.panels,!1,!u(e)),e.focusLineLayer.render&&e.focusLineLayer.render(e.panels))}).on("dragend",function(t){var e=t.parent;if(T)return void("ending"===T&&(T=!1));t.x=t.xScale(t.xIndex),t.canvasX=t.x*t.model.canvasPixelRatio,h(P,e),_.select(this).attr("transform",function(t){return"translate("+t.x+", 0)"}),e.contextLineLayer&&e.contextLineLayer.render(e.panels,!1,!u(e)),e.focusLineLayer&&e.focusLineLayer.render(e.panels),e.pickLineLayer&&e.pickLineLayer.render(e.panels,!0),E=!0,o&&o.axesMoved&&o.axesMoved(e.key,e.dimensions.map(function(t){return t.crossfilterDimensionIndex}))})),P.exit().remove();var z=P.selectAll(".axisOverlays").data(a,n);z.enter().append("g").classed("axisOverlays",!0),z.selectAll(".axis").remove();var N=z.selectAll(".axis").data(a,n);N.enter().append("g").classed("axis",!0),N.each(function(t){var e=t.model.height/t.model.tickDistance,r=t.domainScale,n=r.domain(),a=t.ticktext;_.select(this).call(_.svg.axis().orient("left").tickSize(4).outerTickSize(2).ticks(e,t.tickFormat).tickValues(t.ordinal?n.map(function(t,e){return a&&a[e]||t}):null).tickFormat(t.ordinal?function(t){return t}:null).scale(r)),w.font(N.selectAll("text"),t.model.tickFont)}),N.selectAll(".domain, .tick>line").attr("fill","none").attr("stroke","black").attr("stroke-opacity",.25).attr("stroke-width","1px"),N.selectAll("text").style("text-shadow","1px 1px 1px #fff, -1px -1px 1px #fff, 1px -1px 1px #fff, -1px 1px 1px #fff").style("cursor","default").style("user-select","none");var F=z.selectAll(".axisHeading").data(a,n);F.enter().append("g").classed("axisHeading",!0);var B=F.selectAll(".axisTitle").data(a,n);B.enter().append("text").classed("axisTitle",!0).attr("text-anchor","middle").style("cursor","ew-resize").style("user-select","none").style("pointer-events","auto"),B.attr("transform","translate(0,"+-b.axisTitleOffset+")").text(function(t){return t.label}).each(function(t){w.font(B,t.model.labelFont)});var j=z.selectAll(".axisExtent").data(a,n);j.enter().append("g").classed("axisExtent",!0);var H=j.selectAll(".axisExtentTop").data(a,n);H.enter().append("g").classed("axisExtentTop",!0),H.attr("transform","translate(0,"+-b.axisExtentOffset+")");var U=H.selectAll(".axisExtentTopText").data(a,n);U.enter().append("text").classed("axisExtentTopText",!0).attr("alignment-baseline","after-edge").call(v),U.text(function(t){return x(t)(t.domainScale.domain().slice(-1)[0])}).each(function(t){w.font(U,t.model.rangeFont)});var V=j.selectAll(".axisExtentBottom").data(a,n);V.enter().append("g").classed("axisExtentBottom",!0),V.attr("transform",function(t){return"translate(0,"+(t.model.height+b.axisExtentOffset)+")"});var G=V.selectAll(".axisExtentBottomText").data(a,n);G.enter().append("text").classed("axisExtentBottomText",!0).attr("alignment-baseline","before-edge").call(v),G.text(function(t){return x(t)(t.domainScale.domain()[0])}).each(function(t){w.font(G,t.model.rangeFont)});var q=z.selectAll(".axisBrush").data(a,n),X=q.enter().append("g").classed("axisBrush",!0);q.each(function(t){t.brush||(t.brush=_.svg.brush().y(t.unitScale).on("brushstart",A).on("brush",k).on("brushend",M),0===t.filter[0]&&1===t.filter[1]||t.brush.extent(t.filter),_.select(this).call(t.brush))}),X.selectAll("rect").attr("x",-b.bar.capturewidth/2).attr("width",b.bar.capturewidth),X.selectAll("rect.extent").attr("fill","url(#filterBarPattern)").style("cursor","ns-resize").filter(function(t){return 0===t.filter[0]&&1===t.filter[1]}).attr("y",-100),X.selectAll(".resize rect").attr("height",b.bar.handleheight).attr("opacity",0).style("visibility","visible"),X.selectAll(".resize.n rect").style("cursor","n-resize").attr("y",b.bar.handleoverlap-b.bar.handleheight),X.selectAll(".resize.s rect").style("cursor","s-resize").attr("y",b.bar.handleoverlap);var Y=!1,W=!1;return O}},{"../../components/drawing":257,"../../lib":350,"./constants":472,"./lines":475,d3:62}],477:[function(t,e,r){"use strict";var n=t("./parcoords");e.exports=function(t,e){var r=t._fullLayout,a=r._paper,i=r._paperdiv,o={},s={},l=r._size;e.forEach(function(e,r){o[r]=t.data[r].dimensions,s[r]=t.data[r].dimensions.slice()});var u=function(e,r,n){var a=s[e][r],i=a.constraintrange;i&&2===i.length||(i=a.constraintrange=[]),i[0]=n[0],i[1]=n[1],t.emit("plotly_restyle")},c=function(e){t.emit("plotly_hover",e)},f=function(e){t.emit("plotly_unhover",e)},h=function(e,r){function n(t){return!("visible"in t)||t.visible}function a(t,e,r){var n=e.indexOf(r),a=t.indexOf(n);return-1===a&&(a+=e.length),a}var i=function(t){return function(e,n){return a(r,t,e)-a(r,t,n)}}(s[e].filter(n));o[e].sort(i),s[e].filter(function(t){return!n(t)}).sort(function(t){return s[e].indexOf(t)}).forEach(function(t){o[e].splice(o[e].indexOf(t),1),o[e].splice(s[e].indexOf(t),0,t)}),t.emit("plotly_restyle")};n(i,a,e,{width:l.w,height:l.h,margin:{t:l.t,r:l.r,b:l.b,l:l.l}},{filterChanged:u,hover:c,unhover:f,axesMoved:h})}},{"./parcoords":476}],478:[function(t,e,r){"use strict";var n=t("../../components/color");e.exports=function(t,e,r){var a=r.marker.line.color;Array.isArray(a)&&(a=a[e.i]||n.defaultLine) -;var i=r.marker.line.width||0;Array.isArray(i)&&(i=i[e.i]||0),t.style({"stroke-width":i}).call(n.fill,e.color).call(n.stroke,a)}},{"../../components/color":233}],479:[function(t,e,r){"use strict";var n=t("../scattergl/attributes");e.exports={x:n.x,y:n.y,xy:{valType:"data_array"},indices:{valType:"data_array"},xbounds:{valType:"data_array"},ybounds:{valType:"data_array"},text:n.text,marker:{color:{valType:"color",arrayOk:!1},opacity:{valType:"number",min:0,max:1,dflt:1,arrayOk:!1},blend:{valType:"boolean",dflt:null},sizemin:{valType:"number",min:.1,max:2,dflt:.5},sizemax:{valType:"number",min:.1,dflt:20},border:{color:{valType:"color",arrayOk:!1},arearatio:{valType:"number",min:0,max:1,dflt:0}}}}},{"../scattergl/attributes":508}],480:[function(t,e,r){"use strict";function n(t,e){this.scene=t,this.uid=e,this.type="pointcloud",this.pickXData=[],this.pickYData=[],this.xData=[],this.yData=[],this.textLabels=[],this.color="rgb(0, 0, 0)",this.name="",this.hoverinfo="all",this.idToIndex=new Int32Array(0),this.bounds=[0,0,0,0],this.pointcloudOptions={positions:new Float32Array(0),idToIndex:this.idToIndex,sizemin:.5,sizemax:12,color:[0,0,0,1],areaRatio:1,borderColor:[0,0,0,1]},this.pointcloud=i(t.glplot,this.pointcloudOptions),this.pointcloud._trace=this}function a(t,e){var r=new n(t,e.uid);return r.update(e),r}var i=t("gl-pointcloud2d"),o=t("../../lib/str2rgbarray"),s=t("../scatter/get_trace_color"),l=["xaxis","yaxis"],u=n.prototype;u.handlePick=function(t){var e=this.idToIndex[t.pointId];return{trace:this,dataCoord:t.dataCoord,traceCoord:this.pickXYData?[this.pickXYData[2*e],this.pickXYData[2*e+1]]:[this.pickXData[e],this.pickYData[e]],textLabel:Array.isArray(this.textLabels)?this.textLabels[e]:this.textLabels,color:this.color,name:this.name,pointIndex:e,hoverinfo:this.hoverinfo}},u.update=function(t){this.index=t.index,this.textLabels=t.text,this.name=t.name,this.hoverinfo=t.hoverinfo,this.bounds=[1/0,1/0,-1/0,-1/0],this.updateFast(t),this.color=s(t,{})},u.updateFast=function(t){var e,r,n,a,i,s,l=this.xData=this.pickXData=t.x,u=this.yData=this.pickYData=t.y,c=this.pickXYData=t.xy,f=t.xbounds&&t.ybounds,h=t.indices,d=this.bounds;if(c){if(n=c,e=c.length>>>1,f)d[0]=t.xbounds[0],d[2]=t.xbounds[1],d[1]=t.ybounds[0],d[3]=t.ybounds[1];else for(s=0;sd[2]&&(d[2]=a),id[3]&&(d[3]=i);if(h)r=h;else for(r=new Int32Array(e),s=0;sd[2]&&(d[2]=a),id[3]&&(d[3]=i);this.idToIndex=r,this.pointcloudOptions.idToIndex=r,this.pointcloudOptions.positions=n;var p=o(t.marker.color),g=o(t.marker.border.color),m=t.opacity*t.marker.opacity;p[3]*=m,this.pointcloudOptions.color=p;var v=t.marker.blend;if(null===v){v=l.length<100||u.length<100}this.pointcloudOptions.blend=v,g[3]*=m,this.pointcloudOptions.borderColor=g;var y=t.marker.sizemin,b=Math.max(t.marker.sizemax,t.marker.sizemin);this.pointcloudOptions.sizeMin=y,this.pointcloudOptions.sizeMax=b,this.pointcloudOptions.areaRatio=t.marker.border.arearatio,this.pointcloud.update(this.pointcloudOptions),this.expandAxesFast(d,b/2)},u.expandAxesFast=function(t,e){for(var r,n,a,i=e||.5,o=0;o<2;o++)r=this.scene[l[o]],n=r._min,n||(n=[]),n.push({val:t[o],pad:i}),a=r._max,a||(a=[]),a.push({val:t[o+2],pad:i})},u.dispose=function(){this.pointcloud.dispose()},e.exports=a},{"../../lib/str2rgbarray":368,"../scatter/get_trace_color":492,"gl-pointcloud2d":111}],481:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("./attributes");e.exports=function(t,e,r){function i(r,i){return n.coerce(t,e,a,r,i)}i("x"),i("y"),i("xbounds"),i("ybounds"),t.xy&&t.xy instanceof Float32Array&&(e.xy=t.xy),t.indices&&t.indices instanceof Int32Array&&(e.indices=t.indices),i("text"),i("marker.color",r),i("marker.opacity"),i("marker.blend"),i("marker.sizemin"),i("marker.sizemax"),i("marker.border.color",r),i("marker.border.arearatio")}},{"../../lib":350,"./attributes":479}],482:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.calc=t("../scatter3d/calc"),n.plot=t("./convert"),n.moduleType="trace",n.name="pointcloud",n.basePlotModule=t("../../plots/gl2d"),n.categories=["gl2d","showLegend"],n.meta={},e.exports=n},{"../../plots/gl2d":417,"../scatter3d/calc":507,"./attributes":479,"./convert":480,"./defaults":481}],483:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function(t,e){for(var r=0;rg&&d.splice(g,d.length-g),p.length>g&&p.splice(g,p.length-g);var m={padded:!0},v={padded:!0};if(o.hasMarkers(e)){if(r=e.marker,u=r.size,Array.isArray(u)){var y={type:"linear"};a.setConvert(y),u=y.makeCalcdata(e.marker,"size"),u.length>g&&u.splice(g,u.length-g)}var b,x=1.6*(e.marker.sizeref||1);b="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=v.ppad=Array.isArray(u)?u.map(b):b(u)}s(e),!("tozerox"===e.fill||"tonextx"===e.fill&&t.firstscatter)||d[0]===d[g-1]&&p[0]===p[g-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)||d[0]===d[g-1]&&p[0]===p[g-1]?-1!==["tonextx","tozerox"].indexOf(e.fill)&&(v.padded=!1):v.tozero=!0,a.expand(f,d,m),a.expand(h,p,v);var _=new Array(g);for(c=0;c=0;a--){var i=t[a];if("scatter"===i.type&&i.xaxis===r.xaxis&&i.yaxis===r.yaxis){i.opacity=void 0;break}}}}}},{}],487:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("../../lib"),i=t("../../plots/plots"),o=t("../../components/colorscale"),s=t("../../components/colorbar/draw");e.exports=function(t,e){var r=e[0].trace,l=r.marker,u="cb"+r.uid;if(t._fullLayout._infolayer.selectAll("."+u).remove(),void 0===l||!l.showscale)return void i.autoMargin(t,u);var c=l.color,f=l.cmin,h=l.cmax;n(f)||(f=a.aggNums(Math.min,null,c)),n(h)||(h=a.aggNums(Math.max,null,c));var d=e[0].t.cb=s(t,u),p=o.makeColorScaleFunc(o.extractScale(l.colorscale,f,h),{noNumericCheck:!0});d.fillcolor(p).filllevels({start:f,end:h,size:(h-f)/254}).options(l.colorbar)()}},{"../../components/colorbar/draw":236,"../../components/colorscale":247,"../../lib":350,"../../plots/plots":422,"fast-isnumeric":68}],488:[function(t,e,r){"use strict";var n=t("../../components/colorscale/has_colorscale"),a=t("../../components/colorscale/calc"),i=t("./subtypes");e.exports=function(t){i.hasLines(t)&&n(t,"line")&&a(t,t.line.color,"line","c"),i.hasMarkers(t)&&(n(t,"marker")&&a(t,t.marker.color,"marker","c"),n(t,"marker.line")&&a(t,t.marker.line.color,"marker.line","c"))}},{"../../components/colorscale/calc":239,"../../components/colorscale/has_colorscale":246,"./subtypes":504}],489:[function(t,e,r){"use strict";e.exports={PTS_LINESONLY:20}},{}],490:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("./attributes"),i=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,i){return n.coerce(t,e,a,r,i)}var m=s(t,e,p,g),v=mU!=D>=U&&(O=S[E-1][0],I=S[E][0],C=O+(I-O)*(U-R)/(D-R),F=Math.min(F,C),B=Math.max(B,C));F=Math.max(F,0),B=Math.min(B,h._length);var V=s.defaultLine;return s.opacity(f.fillcolor)?V=f.fillcolor:s.opacity((f.line||{}).color)&&(V=f.line.color),n.extendFlat(t,{distance:l+10,x0:F,x1:B,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":233,"../../components/errorbars":263,"../../components/fx":274,"../../lib":350,"./get_trace_color":492}],494:[function(t,e,r){"use strict";var n={},a=t("./subtypes");n.hasLines=a.hasLines,n.hasMarkers=a.hasMarkers,n.hasText=a.hasText,n.isBubble=a.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.animatable=!0,n.moduleType="trace",n.name="scatter",n.basePlotModule=t("../../plots/cartesian"),n.categories=["cartesian","symbols","markerColorscale","errorBarsOK","showLegend","scatter-like"],n.meta={},e.exports=n},{"../../plots/cartesian":399,"./arrays_to_calcdata":483,"./attributes":484,"./calc":485,"./clean_data":486,"./colorbar":487,"./defaults":490,"./hover":493,"./plot":501,"./select":502,"./style":503,"./subtypes":504}],495:[function(t,e,r){"use strict";var n=t("../../components/colorscale/has_colorscale"),a=t("../../components/colorscale/defaults");e.exports=function(t,e,r,i,o,s){var l=(t.marker||{}).color;if(o("line.color",r),n(t,"line"))a(t,e,i,o,{prefix:"line.",cLetter:"c"});else{o("line.color",!Array.isArray(l)&&l||r)}o("line.width"),(s||{}).noDash||o("line.dash")}},{"../../components/colorscale/defaults":242,"../../components/colorscale/has_colorscale":246}],496:[function(t,e,r){"use strict";var n=t("../../constants/numerical").BADNUM;e.exports=function(t,e){function r(e){var r=_.c2p(t[e].x),a=w.c2p(t[e].y);return r!==n&&a!==n&&[r,a]}function a(t){var e=t[0]/_._length,r=t[1]/w._length;return(1+10*Math.max(0,-e,e-1,-r,r-1))*M}var i,o,s,l,u,c,f,h,d,p,g,m,v,y,b,x,_=e.xaxis,w=e.yaxis,A=e.simplify,k=e.connectGaps,M=e.baseTolerance,T=e.linear,E=[],L=.2,S=new Array(t.length),C=0;for(A||(M=L=-1),i=0;ia(c))break;s=c,v=p[0]*d[0]+p[1]*d[1],v>g?(g=v,l=c,h=!1):v=t.length||!c)break;S[C++]=c,o=c}}else S[C++]=l}E.push(S.slice(0,C))}return E}},{"../../constants/numerical":333}],497:[function(t,e,r){"use strict";e.exports=function(t,e,r){"spline"===r("line.shape")&&r("line.smoothing")}},{}],498:[function(t,e,r){"use strict";e.exports=function(t,e,r){for(var n,a,i=null,o=0;o0?Math.max(e,a):0}}},{"fast-isnumeric":68}],500:[function(t,e,r){"use strict";var n=t("../../components/color"),a=t("../../components/colorscale/has_colorscale"),i=t("../../components/colorscale/defaults"),o=t("./subtypes");e.exports=function(t,e,r,s,l,u){var c,f=o.isBubble(t),h=(t.line||{}).color;if(u=u||{},h&&(r=h),l("marker.symbol"),l("marker.opacity",f?.7:1),l("marker.size"),l("marker.color",r),a(t,"marker")&&i(t,e,s,l,{prefix:"marker.",cLetter:"c"}),u.noLine||(c=h&&!Array.isArray(h)&&e.marker.color!==h?h:f?n.background:n.defaultLine,l("marker.line.color",c),a(t,"marker.line")&&i(t,e,s,l,{prefix:"marker.line.",cLetter:"c"}),l("marker.line.width",f?1:0)),f&&(l("marker.sizeref"),l("marker.sizemin"),l("marker.sizemode")),u.gradient){"none"!==l("marker.gradient.type")&&l("marker.gradient.color")}}},{"../../components/color":233,"../../components/colorscale/defaults":242,"../../components/colorscale/has_colorscale":246,"./subtypes":504}],501:[function(t,e,r){"use strict";function n(t,e,r){var n;e.selectAll("g.trace").each(function(t){var e=o.select(this);if(n=t[0].trace,n._nexttrace){if(n._nextFill=e.select(".js-fill.js-tonext"),!n._nextFill.size()){var a=":first-child";e.select(".js-fill.js-tozero").size()&&(a+=" + *"),n._nextFill=e.insert("path",a).attr("class","js-fill js-tonext")}}else e.selectAll(".js-fill.js-tonext").remove(),n._nextFill=null;n.fill&&("tozero"===n.fill.substr(0,6)||"toself"===n.fill||"to"===n.fill.substr(0,2)&&!n._prevtrace)?(n._ownFill=e.select(".js-fill.js-tozero"),n._ownFill.size()||(n._ownFill=e.insert("path",":first-child").attr("class","js-fill js-tozero"))):(e.selectAll(".js-fill.js-tozero").remove(),n._ownFill=null),e.selectAll(".js-fill").call(l.setClipUrl,r.layerClipId)})}function a(t,e,r,n,a,h,p){function g(t){return A?t.transition():t}function m(t){return t.filter(function(t){return t.vis})}function v(t){return t.id}function y(t){if(t.ids)return v}function b(){return!1}function x(e){var n,a,i,u=e[0].trace,f=o.select(this),h=c.hasMarkers(u),d=c.hasText(u),p=y(u),v=b,x=b;h&&(v=u.marker.maxdisplayed||u._needsCull?m:s.identity),d&&(x=u.marker.maxdisplayed||u._needsCull?m:s.identity),a=f.selectAll("path.point"),n=a.data(v,p);var _=n.enter().append("path").classed("point",!0);A&&_.call(l.pointStyle,u,t).call(l.translatePoints,k,M).style("opacity",0).transition().style("opacity",1);var w=h&&l.tryColorscale(u.marker,""),T=h&&l.tryColorscale(u.marker,"line");n.order(),n.each(function(e){var n=o.select(this),a=g(n);i=l.translatePoint(e,a,k,M),i?(l.singlePointStyle(e,a,u,w,T,t),r.layerClipId&&l.hideOutsideRangePoint(e,a,k,M),u.customdata&&n.classed("plotly-customdata",null!==e.data&&void 0!==e.data)):a.remove()}),A?n.exit().transition().style("opacity",0).remove():n.exit().remove(),a=f.selectAll("g"),n=a.data(x,p),n.enter().append("g").classed("textpoint",!0).append("text"),n.order(),n.each(function(t){var e=o.select(this),n=g(e.select("text"));i=l.translatePoint(t,n,k,M),i?r.layerClipId&&l.hideOutsideRangePoint(t,e,k,M):e.remove()}),n.selectAll("text").call(l.textPointStyle,u,t).each(function(t){var e=k.c2p(t.x),r=M.c2p(t.y);o.select(this).selectAll("tspan.line").each(function(){g(o.select(this)).attr({x:e,y:r})})}),n.exit().remove()}var _,w;i(t,e,r,n,a);var A=!!p&&p.duration>0,k=r.xaxis,M=r.yaxis,T=n[0].trace,E=T.line,L=o.select(h);if(L.call(u.plot,r,p),!0===T.visible){g(L).style("opacity",T.opacity);var S,C,O=T.fill.charAt(T.fill.length-1);"x"!==O&&"y"!==O&&(O=""),n[0].node3=L;var I="",R=[],D=T._prevtrace;D&&(I=D._prevRevpath||"",C=D._nextFill,R=D._polygons);var P,z,N,F,B,j,H,U,V,G="",q="",X=[],Y=[],W=s.noop;if(S=T._ownFill,c.hasLines(T)||"none"!==T.fill){for(C&&C.datum(n),-1!==["hv","vh","hvh","vhv"].indexOf(E.shape)?(N=l.steps(E.shape),F=l.steps(E.shape.split("").reverse().join(""))):N=F="spline"===E.shape?function(t){var e=t[t.length-1];return t[0][0]===e[0]&&t[0][1]===e[1]?l.smoothclosed(t.slice(1),E.smoothing):l.smoothopen(t,E.smoothing)}:function(t){return"M"+t.join("L")},B=function(t){return F(t.reverse())},X=f(n,{xaxis:k,yaxis:M,connectGaps:T.connectgaps,baseTolerance:Math.max(E.width||1,3)/4,linear:"linear"===E.shape,simplify:E.simplify}),V=T._polygons=new Array(X.length),w=0;w1}),W=function(t){return function(e){if(P=N(e),z=B(e),G?O?(G+="L"+P.substr(1),q=z+"L"+q.substr(1)):(G+="Z"+P,q=z+"Z"+q):(G=P,q=z),c.hasLines(T)&&e.length>1){var r=o.select(this);if(r.datum(n),t)g(r.style("opacity",0).attr("d",P).call(l.lineGroupStyle)).style("opacity",1);else{var a=g(r);a.attr("d",P),l.singleLineStyle(n,a)}}}}}var Z=L.selectAll(".js-line").data(Y);g(Z.exit()).style("opacity",0).remove(),Z.each(W(!1)),Z.enter().append("path").classed("js-line",!0).style("vector-effect","non-scaling-stroke").call(l.lineGroupStyle).each(W(!0)),l.setClipUrl(Z,r.layerClipId),X.length&&(S?j&&U&&(O?("y"===O?j[1]=U[1]=M.c2p(0,!0):"x"===O&&(j[0]=U[0]=k.c2p(0,!0)),g(S).attr("d","M"+U+"L"+j+"L"+G.substr(1)).call(l.singleFillStyle)):g(S).attr("d",G+"Z").call(l.singleFillStyle)):"tonext"===T.fill.substr(0,6)&&G&&I&&("tonext"===T.fill?g(C).attr("d",G+"Z"+I+"Z").call(l.singleFillStyle):g(C).attr("d",G+"L"+I.substr(1)+"Z").call(l.singleFillStyle),T._polygons=T._polygons.concat(R)),T._prevRevpath=q,T._prevPolygons=V);var Q=L.selectAll(".points");_=Q.data([n]),Q.each(x),_.enter().append("g").classed("points",!0).each(x),_.exit().remove(),_.each(function(t){var e=!1===t[0].trace.cliponaxis;l.setClipUrl(o.select(this),e?null:r.layerClipId)})}}function i(t,e,r,n,a){var i=r.xaxis,l=r.yaxis,u=o.extent(s.simpleMap(i.range,i.r2c)),f=o.extent(s.simpleMap(l.range,l.r2c)),h=n[0].trace;if(c.hasMarkers(h)){var d=h.marker.maxdisplayed;if(0!==d){var p=n.filter(function(t){return t.x>=u[0]&&t.x<=u[1]&&t.y>=f[0]&&t.y<=f[1]}),g=Math.ceil(p.length/d),m=0;a.forEach(function(t,r){var n=t[0].trace;c.hasMarkers(n)&&n.marker.maxdisplayed>0&&r0;for(c=p.selectAll("g.trace"),f=c.data(r,function(t){return t[0].trace.uid}),f.enter().append("g").attr("class",function(t){return"trace scatter trace"+t[0].trace.uid}).style("stroke-miterlimit",2),h(t,e,r),n(t,p,e),l=0,u={};lu[e[0].trace.uid]?1:-1}),m){s&&(d=s());o.transition().duration(i.duration).ease(i.easing).each("end",function(){d&&d()}).each("interrupt",function(){d&&d()}).each(function(){p.selectAll("g.trace").each(function(n,o){a(t,o,e,n,r,this,i)})})}else p.selectAll("g.trace").each(function(n,o){a(t,o,e,n,r,this,i)});g&&f.exit().remove(),p.selectAll("path:not([d])").remove()}},{"../../components/drawing":257,"../../components/errorbars":263,"../../lib":350,"../../lib/polygon":360,"./line_points":496,"./link_traces":498,"./subtypes":504,d3:62}],502:[function(t,e,r){"use strict";var n=t("./subtypes"),a=t("../../constants/interactions").DESELECTDIM;e.exports=function(t,e){var r,i,o,s,l=t.cd,u=t.xaxis,c=t.yaxis,f=[],h=l[0].trace,d=h.marker,p=!n.hasMarkers(h)&&!n.hasText(h);if(!0===h.visible&&!p){var g=Array.isArray(d.opacity)?1:d.opacity;if(!1===e)for(r=0;r=e.length?a:e[i]);return n}function o(t,e,r){return l(P(t,r),D(e,r),r)}function s(t,e,r,n){var a=k(t,e,n);return a=Array.isArray(a[0])?a:i(y.identity,[a],n),l(a,D(r,n),n)}function l(t,e,r){for(var n=new Array(4*r),a=0;aZ?W-Z:0),!G||V.noBorder||V.noFill?c(this.scatter.options.colors,X,h,j,q):c(this.scatter.options.colors,I,h,0),c(this.scatter.options.borderColors,Y,h,j,q);B?(this.scatter.options.positions=null,this.fancyScatter.update(),this.scatter.options.positions=k):this.fancyScatter.update()}else this.fancyScatter.clear();this.scatter.clear(),this.expandAxesFancy(l,f,F)},R.updateLines=function(t,e){var r;if(this.hasLines){var n=e;if(!t.connectgaps){var a=0,i=this.xData,s=this.yData;for(n=new Float64Array(2*i.length),r=0;r>2,s[u++]=i>>8&255,s[u++]=255&i),s}function o(t){return u[t>>18&63]+u[t>>12&63]+u[t>>6&63]+u[63&t]}function s(t,e,r){for(var n,a=[],i=e;il?l:o+16383));return 1===n?(e=t[r-1],a+=u[e>>2],a+=u[e<<4&63],a+="=="):2===n&&(e=(t[r-2]<<8)+t[r-1],a+=u[e>>10],a+=u[e>>4&63],a+=u[e<<2&63],a+="="),i.push(a),i.join("")}r.byteLength=a,r.toByteArray=i,r.fromByteArray=l;for(var u=[],c=[],f="undefined"!=typeof Uint8Array?Uint8Array:Array,h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",d=0,p=h.length;d0;){for(var c=r.pop(),s=r.pop(),f=-1,h=-1,l=o[s],p=1;p=0||(e.flip(s,c),n(t,e,r,f,s,h),n(t,e,r,s,h,f),n(t,e,r,h,c,f),n(t,e,r,c,f,h)))}}var i=t("robust-in-sphere")[4];t("binary-search-bounds");e.exports=a},{"binary-search-bounds":47,"robust-in-sphere":181}],44:[function(t,e,r){"use strict";function n(t,e,r,n,a,i,o){this.cells=t,this.neighbor=e,this.flags=n,this.constraint=r,this.active=a,this.next=i,this.boundary=o}function a(t,e){return t[0]-e[0]||t[1]-e[1]||t[2]-e[2]}function i(t,e){for(var r=t.cells(),i=r.length,o=0;o0||l.length>0;){for(;s.length>0;){var d=s.pop();if(u[d]!==-a){u[d]=a;for(var p=(c[d],0);p<3;++p){var g=h[3*d+p];g>=0&&0===u[g]&&(f[3*d+p]?l.push(g):(s.push(g),u[g]=a))}}}var m=l;l=s,s=m,l.length=0,a=-a}var v=o(c,u,e);return r?v.concat(n.boundary):v}var l=t("binary-search-bounds");e.exports=s,n.prototype.locate=function(){var t=[0,0,0];return function(e,r,n){var i=e,o=r,s=n;return r1&&d(r[c[f-2]],r[c[f-1]],n)>0;)t.push([c[f-1],c[f-2],a]),f-=1;c.length=f,c.push(a);for(var p=u.upperIds,f=p.length;f>1&&d(r[p[f-2]],r[p[f-1]],n)<0;)t.push([p[f-2],p[f-1],a]),f-=1;p.length=f,p.push(a)}}function l(t,e){var r;return(r=t.a[0]v[0]&&l.push(new a(v,d,m,f),new a(d,v,g,f))}l.sort(i);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=[],f=0,_=l.length;f<_;++f){var w=l[f],A=w.type;A===p?s(x,b,t,w.a,w.idx):A===m?u(b,t,w):c(b,t,w)}return x}var h=t("binary-search-bounds"),d=t("robust-orientation")[3],p=0,g=1,m=2;e.exports=f},{"binary-search-bounds":47,"robust-orientation":182}],46:[function(t,e,r){"use strict";function n(t,e){this.stars=t,this.edges=e}function a(t,e,r){for(var n=1,a=t.length;n=0}}(),s.removeTriangle=function(t,e,r){var n=this.stars;a(n[t],e,r),a(n[e],r,t),a(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,a=r.length;n>>1,x=a[m]"];return a?e.indexOf("c")<0?i.push(";if(x===y){return m}else if(x<=y){"):i.push(";var p=c(x,y);if(p===0){return m}else if(p<=0){"):i.push(";if(",e,"){i=m;"),r?i.push("l=m+1}else{h=m-1}"):i.push("h=m-1}else{l=m+1}"),i.push("}"),a?i.push("return -1};"):i.push("return i};"),i.join("")}function a(t,e,r,a){return new Function([n("A","x"+t+"y",e,["y"],a),n("P","c(x,y)"+t+"0",e,["y","c"],a),"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(""))()}e.exports={ge:a(">=",!1,"GE"),gt:a(">",!1,"GT"),lt:a("<",!0,"LT"),le:a("<=",!0,"LE"),eq:a("-",!0,"EQ",!0)}},{}],48:[function(t,e,r){function n(t,e,r){return er?r:t:te?e:t}e.exports=n},{}],49:[function(t,e,r){"use strict";function n(t){var e=_(t);return[A(e,-1/0),A(e,1/0)]}function a(t,e){for(var r=new Array(e.length),n=0;n=0;--i){var p=n[i];o=p[0];var g=e[o],m=g[0],v=g[1],y=t[m],A=t[v];if((y[0]-A[0]||y[1]-A[1])<0){var M=m;m=v,v=M}g[0]=m;var T,E=g[1]=p[1];for(a&&(T=g[2]);i>0&&n[i-1][0]===o;){var p=n[--i],L=p[1];a?e.push([E,L,T]):e.push([E,L]),E=L}a?e.push([E,v,T]):e.push([E,v])}return s}function u(t,e,r){for(var a=e.length,i=new m(a),o=[],s=0;se[2]?1:0)}function h(t,e,r){if(0!==t.length){if(e)for(var n=0;n0||d.length>0)}function g(t,e,r){var n;if(r){n=e;for(var a=new Array(e.length),i=0;i>>24,n=(16711680&t)>>>16,a=(65280&t)>>>8,i=255&t;return!1===e?[r,n,a,i]:[r/255,n/255,a/255,i/255]}var i=t("clamp");e.exports=n,e.exports.to=n,e.exports.from=a},{clamp:48}],52:[function(t,e,r){"use strict";e.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}},{}],53:[function(t,e,r){(function(r){"use strict";function n(t){var e,n,s=[],l=1;if("string"==typeof t)if(a[t])s=a[t].slice(),n="rgb";else if("transparent"===t)l=0,n="rgb",s=[0,0,0];else if(/^#[A-Fa-f0-9]+$/.test(t)){var u=t.slice(1),c=u.length,f=c<=4;l=1,f?(s=[parseInt(u[0]+u[0],16),parseInt(u[1]+u[1],16),parseInt(u[2]+u[2],16)],4===c&&(l=parseInt(u[3]+u[3],16)/255)):(s=[parseInt(u[0]+u[1],16),parseInt(u[2]+u[3],16),parseInt(u[4]+u[5],16)],8===c&&(l=parseInt(u[6]+u[7],16)/255)),s[0]||(s[0]=0),s[1]||(s[1]=0),s[2]||(s[2]=0),n="rgb"}else if(e=/^((?:rgb|hs[lvb]|hwb|cmyk?|xy[zy]|gray|lab|lchu?v?|[ly]uv|lms)a?)\s*\(([^\)]*)\)/.exec(t)){var h=e[1],u=h.replace(/a$/,"");n=u;var c="cmyk"===u?4:"gray"===u?1:3;s=e[2].trim().split(/\s*,\s*/).map(function(t,e){if(/%$/.test(t))return e===c?parseFloat(t)/100:"rgb"===u?255*parseFloat(t)/100:parseFloat(t);if("h"===u[e]){if(/deg$/.test(t))return parseFloat(t);if(void 0!==o[t])return o[t]}return parseFloat(t)}),h===u&&s.push(1),l=void 0===s[c]?1:s[c],s=s.slice(0,c)}else t.length>10&&/[0-9](?:\s|\/)/.test(t)&&(s=t.match(/([0-9]+)/g).map(function(t){return parseFloat(t)}),n=t.match(/([a-z])/gi).join("").toLowerCase());else"number"==typeof t?(n="rgb",s=[t>>>16,(65280&t)>>>8,255&t]):i(t)?(null!=t.r?(s=[t.r,t.g,t.b],n="rgb"):null!=t.red?(s=[t.red,t.green,t.blue],n="rgb"):null!=t.h?(s=[t.h,t.s,t.l],n="hsl"):null!=t.hue&&(s=[t.hue,t.saturation,t.lightness],n="hsl"),null!=t.a?l=t.a:null!=t.alpha?l=t.alpha:null!=t.opacity&&(l=t.opacity/100)):(Array.isArray(t)||r.ArrayBuffer&&ArrayBuffer.isView&&ArrayBuffer.isView(t))&&(s=[t[0],t[1],t[2]],n="rgb",l=4===t.length?t[3]:1);return{space:n,values:s,alpha:l}}e.exports=n;var a=t("color-name"),i=t("is-plain-obj"),o={red:0,orange:60,yellow:120,green:180,blue:240,purple:300}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"color-name":52,"is-plain-obj":156}],54:[function(t,e,r){"use strict";var n=t("color-parse"),a=t("color-space/hsl"),i=t("clamp");e.exports=function(t,e){if(Array.isArray(t))return t;null==e&&(e=!0);var r=n(t);if(!r.space)return[];var o,s=r.values,l=s.length;for(o=0;o1&&n--,i=6*n<1?e+6*(r-e)*n:2*n<1?r:3*n<2?e+(r-e)*(2/3-n)*6:e,a[u]=255*i;return a}},n.hsl=function(t){var e,r,n,a=t[0]/255,i=t[1]/255,o=t[2]/255,s=Math.min(a,i,o),l=Math.max(a,i,o),u=l-s;return l===s?e=0:a===l?e=(i-o)/u:i===l?e=2+(o-a)/u:o===l&&(e=4+(a-i)/u),e=Math.min(60*e,360),e<0&&(e+=360),n=(s+l)/2,r=l===s?0:n<=.5?u/(l+s):u/(2-l-s),[e,100*r,100*n]}},{"./rgb":56}],56:[function(t,e,r){"use strict";e.exports={name:"rgb",min:[0,0,0],max:[255,255,255],channel:["red","green","blue"],alias:["RGB"]}},{}],57:[function(t,e,r){"use strict";function n(t,e,r){var n=s(t[0],-e[0]),a=s(t[1],-e[1]),i=s(r[0],-e[0]),o=s(r[1],-e[1]),c=u(l(n,i),l(a,o));return c[c.length-1]>=0}function a(t,e,r,a){var s=i(e,r,a);if(0===s){var l=o(i(t,e,r)),u=o(i(t,e,a));if(l===u){if(0===l){var c=n(t,e,r);return c===n(t,e,a)?0:c?1:-1}return 0}return 0===u?l>0?-1:n(t,e,a)?-1:1:0===l?u>0?1:n(t,e,r)?1:-1:o(u-l)}var f=i(t,e,r);return f>0?s>0&&i(t,e,a)>0?1:-1:f<0?s>0||i(t,e,a)>0?1:-1:i(t,e,a)>0?1:n(t,e,r)?1:-1}e.exports=a;var i=t("robust-orientation"),o=t("signum"),s=t("two-sum"),l=t("robust-product"),u=t("robust-sum")},{"robust-orientation":182,"robust-product":183,"robust-sum":187,signum:188,"two-sum":204}],58:[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 a(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 a=0;a0)throw new Error("cwise: pre() block may not reference array args");if(a0)throw new Error("cwise: post() block may not reference array args")}else if("scalar"===o)e.scalarArgs.push(a),e.shimArgs.push("scalar"+a);else if("index"===o){if(e.indexArgs.push(a),a0)throw new Error("cwise: pre() block may not reference array index");if(a0)throw new Error("cwise: post() block may not reference array index")}else if("shape"===o){if(e.shapeArgs.push(a),ar.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,i(e)}var i=t("./lib/thunk.js");e.exports=a},{"./lib/thunk.js":60}],59:[function(t,e,r){"use strict";function n(t,e,r){var n,a,i=t.length,o=e.arrayArgs.length,s=e.indexArgs.length>0,l=[],u=[],c=0,f=0;for(n=0;n0&&l.push("var "+u.join(",")),n=i-1;n>=0;--n)c=t[n],l.push(["for(i",n,"=0;i",n,"0&&l.push(["index[",f,"]-=s",f].join("")),l.push(["++index[",c,"]"].join(""))),l.push("}")}return l.join("\n")}function a(t,e,r,a){for(var i=e.length,o=r.arrayArgs.length,s=r.blockSize,l=r.indexArgs.length>0,u=[],c=0;c0;){"].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;c0&&(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),f=0;f0&&_.push("shape=SS.slice(0)"),t.indexArgs.length>0){for(var w=new Array(r),f=0;f0&&x.push("var "+_.join(","));for(var f=0;f3&&x.push(o(t.pre,t,c));var T=o(t.body,t,c),E=i(m);E3&&x.push(o(t.post,t,c)),t.debug&&console.log("-----Generated cwise routine for ",e,":\n"+x.join("\n")+"\n----------");var L=[t.funcName||"unnamed","_cwise_loop_",l[0].join("s"),"m",E,s(c)].join("");return new Function(["function ",L,"(",b.join(","),"){",x.join("\n"),"} return ",L].join(""))()}var u=t("uniq");e.exports=l},{uniq:207}],60:[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 i=[],o=[],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"+f+".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"+f+".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--\x3e0;) {"),e.push("if (!("+u.join(" && ")+")) throw new Error('cwise: Arrays do not all have the same shape!')"),e.push("}"));for(var c=0;ce?1:t>=e?0:NaN}function i(t){return null===t?NaN:+t}function o(t){return!isNaN(t)}function s(t){return{left:function(e,r,n,a){for(arguments.length<3&&(n=0),arguments.length<4&&(a=e.length);n>>1;t(e[i],r)<0?n=i+1:a=i}return n},right:function(e,r,n,a){for(arguments.length<3&&(n=0),arguments.length<4&&(a=e.length);n>>1;t(e[i],r)>0?a=i:n=i+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 f(){this._=Object.create(null)}function h(t){return(t+="")===_o||t[0]===wo?wo+t:t}function d(t){return(t+="")[0]===wo?t.slice(1):t}function p(t){return h(t)in this._}function g(t){return(t=h(t))in this._&&delete this._[t]}function m(){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 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=Ao.length;r=e&&(e=a+1);!(o=s[e])&&++e0&&(t=t.slice(0,s));var u=Ro.get(t);return u&&(t=u,l=Q),s?e?a:n:e?A:i}function Z(t,e){return function(r){var n=uo.event;uo.event=r,e[0]=this.__data__;try{t.apply(this,e)}finally{uo.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 $(t){var r=".dragsuppress-"+ ++Po,a="click"+r,i=uo.select(n(t)).on("touchmove"+r,T).on("dragstart"+r,T).on("selectstart"+r,T);if(null==Do&&(Do=!("onselectstart"in t)&&w(t.style,"userSelect")),Do){var o=e(t).style,s=o[Do];o[Do]="none"}return function(t){if(i.on(r,null),Do&&(o[Do]=s),t){var e=function(){i.on(a,null)};i.on(a,function(){T(),e()},!0),setTimeout(e,0)}}}function K(t,e){e.changedTouches&&(e=e.changedTouches[0]);var r=t.ownerSVGElement||t;if(r.createSVGPoint){var a=r.createSVGPoint();if(zo<0){var i=n(t);if(i.scrollX||i.scrollY){r=uo.select("body").append("svg").style({position:"absolute",top:0,left:0,margin:0,padding:0,border:"none"},"important");var o=r[0][0].getScreenCTM();zo=!(o.f||o.e),r.remove()}}return zo?(a.x=e.pageX,a.y=e.pageY):(a.x=e.clientX,a.y=e.clientY),a=a.matrixTransform(t.getScreenCTM().inverse()),[a.x,a.y]}var s=t.getBoundingClientRect();return[e.clientX-s.left-t.clientLeft,e.clientY-s.top-t.clientTop]}function J(){return uo.event.changedTouches[0].identifier}function tt(t){return t>0?1:t<0?-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:t<-1?Bo:Math.acos(t)}function nt(t){return t>1?Uo:t<-1?-Uo:Math.asin(t)}function at(t){return((t=Math.exp(t))-1/t)/2}function it(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,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):At(""+t,kt,ut):new ut(t,e,r)}function ct(t,e,r){function n(t){return t>360?t-=360:t<0&&(t+=360),t<60?i+(o-i)*t/60:t<180?o:t<240?i+(o-i)*(240-t)/60:i}function a(t){return Math.round(255*n(t))}var i,o;return t=isNaN(t)?0:(t%=360)<0?t+360:t,e=isNaN(e)?0:e<0?0:e>1?1:e,r=r<0?0:r>1?1:r,o=r<=.5?r*(1+e):r+e-r*e,i=2*r-o,new bt(a(t+120),a(t),a(t-120))}function ft(t,e,r){return this instanceof ft?(this.h=+t,this.c=+e,void(this.l=+r)):arguments.length<2?t instanceof ft?new ft(t.h,t.c,t.l):t instanceof dt?gt(t.l,t.a,t.b):gt((t=Mt((t=uo.rgb(t)).r,t.g,t.b)).l,t.a,t.b):new ft(t,e,r)}function ht(t,e,r){return isNaN(t)&&(t=0),isNaN(e)&&(e=0),new dt(r,Math.cos(t*=Vo)*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 ft?ht(t.h,t.c,t.l):Mt((t=bt(t)).r,t.g,t.b):new dt(t,e,r)}function pt(t,e,r){var n=(t+16)/116,a=n+e/500,i=n-r/200;return a=mt(a)*Ko,n=mt(n)*Jo,i=mt(i)*ts,new bt(yt(3.2404542*a-1.5371385*n-.4985314*i),yt(-.969266*a+1.8760108*n+.041556*i),yt(.0556434*a-.2040259*n+1.0572252*i))}function gt(t,e,r){return t>0?new ft(Math.atan2(r,e)*Go,Math.sqrt(e*e+r*r),t):new ft(NaN,NaN,t)}function mt(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*(t<=.00304?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):At(""+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 t<16?"0"+Math.max(0,t).toString(16):Math.min(255,t).toString(16)}function At(t,e,r){var n,a,i,o=0,s=0,l=0;if(n=/([a-z]+)\((.*)\)/.exec(t=t.toLowerCase()))switch(a=n[2].split(","),n[1]){case"hsl":return r(parseFloat(a[0]),parseFloat(a[1])/100,parseFloat(a[2])/100);case"rgb":return e(Et(a[0]),Et(a[1]),Et(a[2]))}return(i=ns.get(t))?e(i.r,i.g,i.b):(null==t||"#"!==t.charAt(0)||isNaN(i=parseInt(t.slice(1),16))||(4===t.length?(o=(3840&i)>>4,o|=o>>4,s=240&i,s|=s>>4,l=15&i,l|=l<<4):7===t.length&&(o=(16711680&i)>>16,s=(65280&i)>>8,l=255&i)),e(o,s,l))}function kt(t,e,r){var n,a,i=Math.min(t/=255,e/=255,r/=255),o=Math.max(t,e,r),s=o-i,l=(o+i)/2;return s?(a=l<.5?s/(o+i):s/(2-o-i),n=t==o?(e-r)/s+(e0&&l<1?0:n),new ut(n,a,l)}function Mt(t,e,r){t=Tt(t),e=Tt(e),r=Tt(r);var n=vt((.4124564*t+.3575761*e+.1804375*r)/Ko),a=vt((.2126729*t+.7151522*e+.072175*r)/Jo);return dt(116*a-16,500*(n-a),200*(a-vt((.0193339*t+.119192*e+.9503041*r)/ts)))}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 Lt(t){return"function"==typeof t?t:function(){return t}}function St(t){return function(e,r,n){return 2===arguments.length&&"function"==typeof r&&(n=r,r=null),Ct(e,r,t,n)}}function Ct(t,e,r,n){function a(){var t,e=l.status;if(!e&&It(l)||e>=200&&e<300||304===e){try{t=r.call(i,l)}catch(t){return void o.error.call(i,t)}o.load.call(i,t)}else o.error.call(i,l)}var i={},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=a:l.onreadystatechange=function(){l.readyState>3&&a()},l.onprogress=function(t){var e=uo.event;uo.event=t;try{o.progress.call(i,l)}finally{uo.event=e}},i.header=function(t,e){return t=(t+"").toLowerCase(),arguments.length<2?s[t]:(null==e?delete s[t]:s[t]=e+"",i)},i.mimeType=function(t){return arguments.length?(e=null==t?null:t+"",i):e},i.responseType=function(t){return arguments.length?(u=t,i):u},i.response=function(t){return r=t,i},["get","post"].forEach(function(t){i[t]=function(){return i.send.apply(i,[t].concat(fo(arguments)))}}),i.send=function(r,n,a){if(2===arguments.length&&"function"==typeof n&&(a=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!=a&&i.on("error",a).on("load",function(t){a(null,t)}),o.beforesend.call(i,l),l.send(null==n?null:n),i},i.abort=function(){return l.abort(),i},uo.rebind(i,o,"on"),null==n?i:i.get(Ot(n))}function Ot(t){return 1===t.length?function(e,r){t(null==e?r:null)}:t}function It(t){var e=t.responseType;return e&&"text"!==e?t.response:t.responseText}function Rt(t,e,r){var n=arguments.length;n<2&&(e=0),n<3&&(r=Date.now());var a=r+e,i={c:t,t:a,n:null};return is?is.n=i:as=i,is=i,os||(ss=clearTimeout(ss),os=1,ls(Dt)),i}function Dt(){var t=Pt(),e=zt()-t;e>24?(isFinite(e)&&(clearTimeout(ss),ss=setTimeout(Dt,e)),os=0):(os=1,ls(Dt))}function Pt(){for(var t=Date.now(),e=as;e;)t>=e.t&&e.c(t-e.t)&&(e.c=null),e=e.n;return t}function zt(){for(var t,e=as,r=1/0;e;)e.c?(e.t8?function(t){return t/r}:function(t){return t*r},symbol:t}}function Bt(t){var e=t.decimal,r=t.thousands,n=t.grouping,a=t.currency,i=n&&r?function(t,e){for(var a=t.length,i=[],o=0,s=n[0],l=0;a>0&&s>0&&(l+s+1>e&&(s=Math.max(1,e-l)),i.push(t.substring(a-=s,a+s)),!((l+=s+1)>e));)s=n[o=(o+1)%n.length];return i.reverse().join(r)}:x;return function(t){var r=cs.exec(t),n=r[1]||" ",o=r[2]||">",s=r[3]||"-",l=r[4]||"",u=r[5],c=+r[6],f=r[7],h=r[8],d=r[9],p=1,g="",m="",v=!1,y=!0;switch(h&&(h=+h.substring(1)),(u||"0"===n&&"="===o)&&(u=n="0",o="="),d){case"n":f=!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&&(g="0"+d.toLowerCase());case"c":y=!1;case"d":v=!0,h=0;break;case"s":p=-1,d="r"}"$"===l&&(g=a[0],m=a[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=fs.get(d)||jt;var b=u&&f;return function(t){var r=m;if(v&&t%1)return"";var a=t<0||0===t&&1/t<0?(t=-t,"-"):"-"===s?"":s;if(p<0){var l=uo.formatPrefix(t,h);t=l.scale(t),r=l.symbol+m}else t*=p;t=d(t,h);var x,_,w=t.lastIndexOf(".");if(w<0){var A=y?t.lastIndexOf("e"):-1;A<0?(x=t,_=""):(x=t.substring(0,A),_=t.substring(A))}else x=t.substring(0,w),_=e+t.substring(w+1);!u&&f&&(x=i(x,1/0));var k=g.length+x.length+_.length+(b?0:a.length),M=k"===o?M+a+t:"^"===o?M.substring(0,k>>=1)+a+t+M.substring(k):a+(b?t:M+t))+r}}}function jt(t){return t+""}function Ht(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}function Ut(t,e,r){function n(e){var r=t(e),n=i(r,1);return e-r1)for(;o=u)return-1;if(37===(a=e.charCodeAt(s++))){if(o=e.charAt(s++),!(i=S[o in gs?e.charAt(s++):o])||(n=i(t,r,n))<0)return-1}else if(a!=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=A.get(n[0].toLowerCase()),r+n[0].length):-1}function a(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 i(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 o(t,e,r){k.lastIndex=0;var n=k.exec(e.slice(r));return n?(t.m=M.get(n[0].toLowerCase()),r+n[0].length):-1}function s(t,e,n){return r(t,L.c.toString(),e,n)}function l(t,e,n){return r(t,L.x.toString(),e,n)}function u(t,e,n){return r(t,L.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 f=t.dateTime,h=t.date,d=t.time,p=t.periods,g=t.days,m=t.shortDays,v=t.months,y=t.shortMonths;e.utc=function(t){function r(t){try{ds=Ht;var e=new ds;return e._=t,n(e)}finally{ds=Date}}var n=e(t);return r.parse=function(t){try{ds=Ht;var e=n.parse(t);return e&&e._}finally{ds=Date}},r.toString=n.toString,r},e.multi=e.utc.multi=ce;var b=uo.map(),x=Xt(g),_=Yt(g),w=Xt(m),A=Yt(m),k=Xt(v),M=Yt(v),T=Xt(y),E=Yt(y);p.forEach(function(t,e){b.set(t.toLowerCase(),e)});var L={a:function(t){return m[t.getDay()]},A:function(t){return g[t.getDay()]},b:function(t){return y[t.getMonth()]},B:function(t){return v[t.getMonth()]},c:e(f),d:function(t,e){return qt(t.getDate(),e,2)},e:function(t,e){return qt(t.getDate(),e,2)},H:function(t,e){return qt(t.getHours(),e,2)},I:function(t,e){return qt(t.getHours()%12||12,e,2)},j:function(t,e){return qt(1+hs.dayOfYear(t),e,3)},L:function(t,e){return qt(t.getMilliseconds(),e,3)},m:function(t,e){return qt(t.getMonth()+1,e,2)},M:function(t,e){return qt(t.getMinutes(),e,2)},p:function(t){return p[+(t.getHours()>=12)]},S:function(t,e){return qt(t.getSeconds(),e,2)},U:function(t,e){return qt(hs.sundayOfYear(t),e,2)},w:function(t){return t.getDay()},W:function(t,e){return qt(hs.mondayOfYear(t),e,2)},x:e(h),X:e(d),y:function(t,e){return qt(t.getFullYear()%100,e,2)},Y:function(t,e){return qt(t.getFullYear()%1e4,e,4)},Z:le,"%":function(){return"%"}},S={a:n,A:a,b:i,B:o,c:s,d:re,e:re,H:ae,I:ae,j:ne,L:se,m:ee,M:ie,p:c,S:oe,U:Zt,w:Wt,W:Qt,x:l,X:u,y:Kt,Y:$t,Z:Jt,"%":ue};return e}function qt(t,e,r){var n=t<0?"-":"",a=(n?-t:t)+"",i=a.length;return n+(i68?1900:2e3)}function ee(t,e,r){ms.lastIndex=0;var n=ms.exec(e.slice(r,r+2));return n?(t.m=n[0]-1,r+n[0].length):-1}function re(t,e,r){ms.lastIndex=0;var n=ms.exec(e.slice(r,r+2));return n?(t.d=+n[0],r+n[0].length):-1}function ne(t,e,r){ms.lastIndex=0;var n=ms.exec(e.slice(r,r+3));return n?(t.j=+n[0],r+n[0].length):-1}function ae(t,e,r){ms.lastIndex=0;var n=ms.exec(e.slice(r,r+2));return n?(t.H=+n[0],r+n[0].length):-1}function ie(t,e,r){ms.lastIndex=0;var n=ms.exec(e.slice(r,r+2));return n?(t.M=+n[0],r+n[0].length):-1}function oe(t,e,r){ms.lastIndex=0;var n=ms.exec(e.slice(r,r+2));return n?(t.S=+n[0],r+n[0].length):-1}function se(t,e,r){ms.lastIndex=0;var n=ms.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=xo(e)/60|0,a=xo(e)%60;return r+qt(n,"0",2)+qt(a,"0",2)}function ue(t,e,r){vs.lastIndex=0;var n=vs.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=o*r,l=Math.cos(e),u=Math.sin(e),c=i*u,f=a*l+c*Math.cos(s),h=c*o*Math.sin(s);As.add(Math.atan2(h,f)),n=t,a=l,i=u}var e,r,n,a,i;ks.point=function(o,s){ks.point=t,n=(e=o)*Vo,a=Math.cos(s=(r=s)*Vo/2+Bo/4),i=Math.sin(s)},ks.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 Ae(t){return[Math.atan2(t[1],t[0]),nt(t[2])]}function ke(t,e){return xo(t[0]-e[0])=0;--s)a.point((f=c[s])[0],f[1])}else n(d.x,d.p.x,-1,a);d=d.p}d=d.o,c=d.z,p=!p}while(!d.v);a.lineEnd()}}}function Re(t){if(e=t.length){for(var e,r,n=0,a=t[0];++n0){for(_||(i.polygonStart(),_=!0),i.lineStart();++o1&&2&e&&r.push(r.pop().concat(r.shift())),d.push(r.filter(ze))}var d,p,g,m=e(i),v=a.invert(n[0],n[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=Ue(v,p);d.length?(_||(i.polygonStart(),_=!0),Ie(d,Fe,t,r,i)):t&&(_||(i.polygonStart(),_=!0),i.lineStart(),r(null,null,1,i),i.lineEnd()),_&&(i.polygonEnd(),_=!1),d=p=null},sphere:function(){i.polygonStart(),i.lineStart(),r(null,null,1,i),i.lineEnd(),i.polygonEnd()}},b=Ne(),x=e(b),_=!1;return y}}function ze(t){return t.length>1}function Ne(){var t,e=[];return{lineStart:function(){e.push(t=[])},point:function(e,r){t.push([e,r])},lineEnd:A,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]-Uo-No:Uo-t[1])-((e=e.x)[0]<0?e[1]-Uo-No:Uo-e[1])}function Be(t){var e,r=NaN,n=NaN,a=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(i,o){var s=i>0?Bo:-Bo,l=xo(i-r);xo(l-Bo)0?Uo:-Uo),t.point(a,n),t.lineEnd(),t.lineStart(),t.point(s,n),t.point(i,n),e=0):a!==s&&l>=Bo&&(xo(r-a)No?Math.atan((Math.sin(e)*(i=Math.cos(n))*Math.sin(r)-Math.sin(n)*(a=Math.cos(e))*Math.sin(t))/(a*i*o)):(e+n)/2}function He(t,e,r,n){var a;if(null==t)a=r*Uo,n.point(-Bo,a),n.point(0,a),n.point(Bo,a),n.point(Bo,0),n.point(Bo,-a),n.point(0,-a),n.point(-Bo,-a),n.point(-Bo,0),n.point(-Bo,a);else if(xo(t[0]-e[0])>No){var i=t[0]=0?1:-1,A=w*_,k=A>Bo,M=p*b;if(As.add(Math.atan2(M*w*Math.sin(A),g*x+M*Math.cos(A))),i+=k?_+w*jo:_,k^h>=r^v>=r){var T=be(ve(f),ve(t));we(T);var E=be(a,T);we(E);var L=(k^_>=0?-1:1)*nt(E[2]);(n>L||n===L&&(T[0]||T[1]))&&(o+=k^_>=0?1:-1)}if(!m++)break;h=v,p=b,g=x,f=t}}return(i<-No||ii}function r(t){var r,i,l,u,c;return{lineStart:function(){u=l=!1,c=1},point:function(f,h){var d,p=[f,h],g=e(f,h),m=o?g?0:a(f,h):g?a(f+(f<0?Bo:-Bo),h):0;if(!r&&(u=l=g)&&t.lineStart(),g!==l&&(d=n(r,p),(ke(r,d)||ke(p,d))&&(p[0]+=No,p[1]+=No,g=e(p[0],p[1]))),g!==l)c=0,g?(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&&o^g){var v;m&i||!(v=n(p,r,!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])))}!g||r&&ke(r,p)||t.point(p[0],p[1]),r=p,l=g,i=m},lineEnd:function(){l&&t.lineEnd(),r=null},clean:function(){return c|(u&&l)<<1}}}function n(t,e,r){var n=ve(t),a=ve(e),o=[1,0,0],s=be(n,a),l=ye(s,s),u=s[0],c=l-u*u;if(!c)return!r&&t;var f=i*l/c,h=-i*u/c,d=be(o,s),p=_e(o,f);xe(p,_e(s,h));var g=d,m=ye(p,g),v=ye(g,g),y=m*m-v*(ye(p,p)-1);if(!(y<0)){var b=Math.sqrt(y),x=_e(g,(-m-b)/v);if(xe(x,p),x=Ae(x),!r)return x;var _,w=t[0],A=e[0],k=t[1],M=e[1];A0^x[1]<(xo(x[0]-w)Bo^(w<=x[0]&&x[0]<=A)){var S=_e(g,(-m+b)/v);return xe(S,p),[x,Ae(S)]}}}function a(e,r){var n=o?t:Bo-t,a=0;return e<-n?a|=1:e>n&&(a|=2),r<-n?a|=4:r>n&&(a|=8),a}var i=Math.cos(t),o=i>0,s=xo(i)>No;return Pe(e,r,mr(t,6*Vo),o?[0,-t]:[-Bo,t-Bo])}function Ge(t,e,r,n){return function(a){var i,o=a.a,s=a.b,l=o.x,u=o.y,c=s.x,f=s.y,h=0,d=1,p=c-l,g=f-u;if(i=t-l,p||!(i>0)){if(i/=p,p<0){if(i0){if(i>d)return;i>h&&(h=i)}if(i=r-l,p||!(i<0)){if(i/=p,p<0){if(i>d)return;i>h&&(h=i)}else if(p>0){if(i0)){if(i/=g,g<0){if(i0){if(i>d)return;i>h&&(h=i)}if(i=n-u,g||!(i<0)){if(i/=g,g<0){if(i>d)return;i>h&&(h=i)}else if(g>0){if(i0&&(a.a={x:l+h*p,y:u+h*g}),d<1&&(a.b={x:l+d*p,y:u+d*g}),a}}}}}}function qe(t,e,r,n){function a(n,a){return xo(n[0]-t)0?0:3:xo(n[0]-r)0?2:1:xo(n[1]-e)0?1:0:a>0?3:2}function i(t,e){return o(t.x,e.x)}function o(t,e){var r=a(t,1),n=a(e,1);return r!==n?r-n:0===r?e[1]-t[1]:1===r?t[0]-e[0]:2===r?t[1]-e[1]:e[0]-t[0]}return function(s){function l(t){for(var e=0,r=m.length,n=t[1],a=0;an&&et(u,i,t)>0&&++e:i[1]<=n&&et(u,i,t)<0&&--e,u=i;return 0!==e}function u(i,s,l,u){var c=0,f=0;if(null==i||(c=a(i,l))!==(f=a(s,l))||o(i,s)<0^l>0)do{u.point(0===c||3===c?t:r,c>1?n:e)}while((c=(c+l+4)%4)!==f);else u.point(s[0],s[1])}function c(a,i){return t<=a&&a<=r&&e<=i&&i<=n}function f(t,e){c(t,e)&&s.point(t,e)}function h(){S.point=p,m&&m.push(v=[]),k=!0,A=!1,_=w=NaN}function d(){g&&(p(y,b),x&&A&&E.rejoin(),g.push(E.buffer())),S.point=f,A&&s.lineEnd()}function p(t,e){t=Math.max(-Fs,Math.min(Fs,t)),e=Math.max(-Fs,Math.min(Fs,e));var r=c(t,e);if(m&&v.push([t,e]),k)y=t,b=e,x=r,k=!1,r&&(s.lineStart(),s.point(t,e));else if(r&&A)s.point(t,e);else{var n={a:{x:_,y:w},b:{x:t,y:e}};L(n)?(A||(s.lineStart(),s.point(n.a.x,n.a.y)),s.point(n.b.x,n.b.y),r||s.lineEnd(),M=!1):r&&(s.lineStart(),s.point(t,e),M=!1)}_=t,w=e,A=r}var g,m,v,y,b,x,_,w,A,k,M,T=s,E=Ne(),L=Ge(t,e,r,n),S={point:f,lineStart:h,lineEnd:d,polygonStart:function(){s=E,g=[],m=[],M=!0},polygonEnd:function(){s=T,g=uo.merge(g);var e=l([t,n]),r=M&&e,a=g.length;(r||a)&&(s.polygonStart(),r&&(s.lineStart(),u(null,null,1,s),s.lineEnd()),a&&Ie(g,i,e,u,s),s.polygonEnd()),g=m=v=null}};return S}}function Xe(t){var e=0,r=Bo/3,n=lr(t),a=n(e,r);return a.parallels=function(t){return arguments.length?n(e=t[0]*Bo/180,r=t[1]*Bo/180):[e/Bo*180,r/Bo*180]},a}function Ye(t,e){function r(t,e){var r=Math.sqrt(i-2*a*Math.sin(e))/a;return[r*Math.sin(t*=a),o-r*Math.cos(t)]}var n=Math.sin(t),a=(n+Math.sin(e))/2,i=1+n*(2*a-n),o=Math.sqrt(i)/a;return r.invert=function(t,e){var r=o-e;return[Math.atan2(t,r)/a,nt((i-(t*t+r*r)*a*a)/(2*a))]},r}function We(){function t(t,e){js+=a*t-n*e,n=t,a=e}var e,r,n,a;qs.point=function(i,o){qs.point=t,e=n=i,r=a=o},qs.lineEnd=function(){t(e,r)}}function Ze(t,e){tVs&&(Vs=t),eGs&&(Gs=e)}function Qe(){function t(t,e){o.push("M",t,",",e,i)}function e(t,e){o.push("M",t,",",e),s.point=r}function r(t,e){o.push("L",t,",",e)}function n(){s.point=t}function a(){o.push("Z")}var i=$e(4.5),o=[],s={point:t,lineStart:function(){s.point=e},lineEnd:n,polygonStart:function(){s.lineEnd=a},polygonEnd:function(){s.lineEnd=n,s.point=t},pointRadius:function(t){return i=$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 Ke(t,e){Es+=t,Ls+=e,++Ss}function Je(){function t(t,n){var a=t-e,i=n-r,o=Math.sqrt(a*a+i*i);Cs+=o*(e+t)/2,Os+=o*(r+n)/2,Is+=o,Ke(e=t,r=n)}var e,r;Ys.point=function(n,a){Ys.point=t,Ke(e=n,r=a)}}function tr(){Ys.point=Ke}function er(){function t(t,e){var r=t-n,i=e-a,o=Math.sqrt(r*r+i*i);Cs+=o*(n+t)/2,Os+=o*(a+e)/2,Is+=o,o=a*t-n*e,Rs+=o*(n+t),Ds+=o*(a+e),Ps+=3*o,Ke(n=t,a=e)}var e,r,n,a;Ys.point=function(i,o){Ys.point=t,Ke(e=n=i,r=a=o)},Ys.lineEnd=function(){t(e,r)}}function rr(t){function e(e,r){t.moveTo(e+o,r),t.arc(e,r,o,0,jo)}function r(e,r){t.moveTo(e,r),s.point=n}function n(e,r){t.lineTo(e,r)}function a(){s.point=e}function i(){t.closePath()}var o=4.5,s={point:e,lineStart:function(){s.point=r},lineEnd:a,polygonStart:function(){s.lineEnd=i},polygonEnd:function(){s.lineEnd=a,s.point=e},pointRadius:function(t){return o=t,s},result:A};return s}function nr(t){function e(t){return(s?n:r)(t)}function r(e){return or(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=i,e.lineStart()}function i(r,n){var i=ve([r,n]),o=t(r,n);a(b,x,y,_,w,A,b=o[0],x=o[1],y=r,_=i[0],w=i[1],A=i[2],s,e),e.point(b,x)}function o(){k.point=r,e.lineEnd()}function l(){n(),k.point=u,k.lineEnd=c}function u(t,e){i(f=t,h=e),d=b,p=x,g=_,m=w,v=A,k.point=i}function c(){a(b,x,y,_,w,A,d,p,f,g,m,v,s,e),k.lineEnd=o,o()}var f,h,d,p,g,m,v,y,b,x,_,w,A,k={point:r,lineStart:n,lineEnd:o,polygonStart:function(){e.polygonStart(),k.lineStart=l},polygonEnd:function(){e.polygonEnd(),k.lineStart=n}};return k}function a(e,r,n,s,l,u,c,f,h,d,p,g,m,v){var y=c-e,b=f-r,x=y*y+b*b;if(x>4*i&&m--){var _=s+d,w=l+p,A=u+g,k=Math.sqrt(_*_+w*w+A*A),M=Math.asin(A/=k),T=xo(xo(A)-1)i||xo((y*C+b*O)/x-.5)>.3||s*d+l*p+u*g0&&16,e):Math.sqrt(i)},e}function ar(t){var e=nr(function(e,r){return t([e*Go,r*Go])});return function(t){return ur(e(t))}}function ir(t){this.stream=t}function or(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]*Vo,t[1]*Vo),[t[0]*h+l,u-t[1]*h]}function r(t){return(t=s.invert((t[0]-l)/h,(u-t[1])/h))&&[t[0]*Go,t[1]*Go]}function n(){s=Ce(o=hr(v,y,b),i);var t=i(g,m);return l=d-t[0]*h,u=p+t[1]*h,a()}function a(){return c&&(c.valid=!1,c=null),e}var i,o,s,l,u,c,f=nr(function(t,e){return t=i(t,e),[t[0]*h+l,u-t[1]*h]}),h=150,d=480,p=250,g=0,m=0,v=0,y=0,b=0,_=Ns,w=x,A=null,k=null;return e.stream=function(t){return c&&(c.valid=!1),c=ur(_(o,f(w(t)))),c.valid=!0,c},e.clipAngle=function(t){return arguments.length?(_=null==t?(A=t,Ns):Ve((A=+t)*Vo),a()):A},e.clipExtent=function(t){return arguments.length?(k=t,w=t?qe(t[0][0],t[0][1],t[1][0],t[1][1]):x,a()):k},e.scale=function(t){return arguments.length?(h=+t,n()):h},e.translate=function(t){return arguments.length?(d=+t[0],p=+t[1],n()):[d,p]},e.center=function(t){return arguments.length?(g=t[0]%360*Vo,m=t[1]%360*Vo,n()):[g*Go,m*Go]},e.rotate=function(t){return arguments.length?(v=t[0]%360*Vo,y=t[1]%360*Vo,b=t.length>2?t[2]%360*Vo:0,n()):[v*Go,y*Go,b*Go]},uo.rebind(e,f,"precision"),function(){return i=t.apply(this,arguments),e.invert=i.invert&&r,n()}}function ur(t){return or(t,function(e,r){t.point(e*Vo,r*Vo)})}function cr(t,e){return[t,e]}function fr(t,e){return[t>Bo?t-jo:t<-Bo?t+jo:t,e]}function hr(t,e,r){return t?e||r?Ce(pr(t),gr(e,r)):pr(t):e||r?gr(e,r):fr}function dr(t){return function(e,r){return e+=t,[e>Bo?e-jo:e<-Bo?e+jo:e,r]}}function pr(t){var e=dr(t);return e.invert=dr(-t),e}function gr(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*a;return[Math.atan2(l*i-c*o,s*n-u*a),nt(c*i+l*o)]}var n=Math.cos(t),a=Math.sin(t),i=Math.cos(e),o=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*i-l*o;return[Math.atan2(l*i+u*o,s*n+c*a),nt(c*n-s*a)]},r}function mr(t,e){var r=Math.cos(t),n=Math.sin(t);return function(a,i,o,s){var l=o*e;null!=a?(a=vr(r,a),i=vr(r,i), +(o>0?ai)&&(a+=o*jo)):(a=t+o*jo,i=t-.5*l);for(var u,c=a;o>0?c>i:c0?e<-Uo+No&&(e=-Uo+No):e>Uo-No&&(e=Uo-No);var r=o/Math.pow(a(e),i);return[r*Math.sin(i*t),o-r*Math.cos(i*t)]}var n=Math.cos(t),a=function(t){return Math.tan(Bo/4+t/2)},i=t===e?Math.sin(t):Math.log(n/Math.cos(e))/Math.log(a(e)/a(t)),o=n*Math.pow(a(t),i)/i;return i?(r.invert=function(t,e){var r=o-e,n=tt(i)*Math.sqrt(t*t+r*r);return[Math.atan2(t,r)/i,2*Math.atan(Math.pow(o/n,1/i))-Uo]},r):Er}function Tr(t,e){function r(t,e){var r=i-e;return[r*Math.sin(a*t),i-r*Math.cos(a*t)]}var n=Math.cos(t),a=t===e?Math.sin(t):(n-Math.cos(e))/(e-t),i=n/a+t;return xo(a)1&&et(t[r[n-2]],t[r[n-1]],t[a])<=0;)--n;r[n++]=a}return r.slice(0,n)}function Rr(t,e){return t[0]-e[0]||t[1]-e[1]}function Dr(t,e,r){return(r[0]-e[0])*(t[1]-e[1])<(r[1]-e[1])*(t[0]-e[0])}function Pr(t,e,r,n){var a=t[0],i=r[0],o=e[0]-a,s=n[0]-i,l=t[1],u=r[1],c=e[1]-l,f=n[1]-u,h=(s*(l-u)-f*(a-i))/(f*o-s*c);return[a+h*o,l+h*c]}function zr(t){var e=t[0],r=t[t.length-1];return!(e[0]-r[0]||e[1]-r[1])}function Nr(){an(this),this.edge=this.site=this.circle=null}function Fr(t){var e=sl.pop()||new Nr;return e.site=t,e}function Br(t){Zr(t),al.remove(t),sl.push(t),an(t)}function jr(t){var e=t.circle,r=e.x,n=e.cy,a={x:r,y:n},i=t.P,o=t.N,s=[t];Br(t);for(var l=i;l.circle&&xo(r-l.circle.x)No)s=s.L;else{if(!((a=i-Vr(s,o))>No)){n>-No?(e=s.P,r=s):a>-No?(e=s,r=s.N):e=r=s;break}if(!s.R){e=s;break}s=s.R}var l=Fr(t);if(al.insert(e,l),e||r){if(e===r)return Zr(e),r=Fr(e.site),al.insert(l,r),l.edge=r.edge=Jr(e.site,l.site),Wr(e),void Wr(r);if(!r)return void(l.edge=Jr(e.site,l.site));Zr(e),Zr(r);var u=e.site,c=u.x,f=u.y,h=t.x-c,d=t.y-f,p=r.site,g=p.x-c,m=p.y-f,v=2*(h*m-d*g),y=h*h+d*d,b=g*g+m*m,x={x:(m*y-d*b)/v+c,y:(h*b-g*y)/v+f};en(r.edge,u,p,x),l.edge=Jr(u,t,null,x),r.edge=Jr(t,p,null,x),Wr(e),Wr(r)}}function Ur(t,e){var r=t.site,n=r.x,a=r.y,i=a-e;if(!i)return n;var o=t.P;if(!o)return-1/0;r=o.site;var s=r.x,l=r.y,u=l-e;if(!u)return s;var c=s-n,f=1/i-1/u,h=c/u;return f?(-h+Math.sqrt(h*h-2*f*(c*c/(-2*u)-l+u/2+a-i/2)))/f+n:(n+s)/2}function Vr(t,e){var r=t.N;if(r)return Ur(r,e);var n=t.site;return n.y===e?n.x:1/0}function Gr(t){this.site=t,this.edges=[]}function qr(t){for(var e,r,n,a,i,o,s,l,u,c,f=t[0][0],h=t[1][0],d=t[0][1],p=t[1][1],g=nl,m=g.length;m--;)if((i=g[m])&&i.prepare())for(s=i.edges,l=s.length,o=0;oNo||xo(a-r)>No)&&(s.splice(o,0,new rn(tn(i.site,c,xo(n-f)No?{x:f,y:xo(e-f)No?{x:xo(r-p)No?{x:h,y:xo(e-h)No?{x:xo(r-d)=-Fo)){var d=l*l+u*u,p=c*c+f*f,g=(f*d-u*p)/h,m=(l*p-c*d)/h,f=m+s,v=ll.pop()||new Yr;v.arc=t,v.site=a,v.x=g+o,v.y=f+Math.sqrt(g*g+m*m),v.cy=f,t.circle=v;for(var y=null,b=ol._;b;)if(v.y=s)return;if(h>p){if(i){if(i.y>=u)return}else i={x:m,y:l};r={x:m,y:u}}else{if(i){if(i.y1)if(h>p){if(i){if(i.y>=u)return}else i={x:(l-a)/n,y:l};r={x:(u-a)/n,y:u}}else{if(i){if(i.y=s)return}else i={x:o,y:n*o+a};r={x:s,y:n*s+a}}else{if(i){if(i.xi||f>o||h=x,A=r>=_,k=A<<1|w,M=k+4;ki&&(a=e.slice(i,a),s[o]?s[o]+=a:s[++o]=a),(r=r[0])===(n=n[0])?s[o]?s[o]+=n:s[++o]=n:(s[++o]=null,l.push({i:o,x:bn(r,n)})),i=fl.lastIndex;return i=0&&!(r=uo.interpolators[n](t,e)););return r}function wn(t,e){var r,n=[],a=[],i=t.length,o=e.length,s=Math.min(t.length,e.length);for(r=0;r=1?1:t(e)}}function kn(t){return function(e){return 1-t(1-e)}}function Mn(t){return function(e){return.5*(e<.5?t(2*e):2-t(2-2*e))}}function Tn(t){return t*t}function En(t){return t*t*t}function Ln(t){if(t<=0)return 0;if(t>=1)return 1;var e=t*t,r=e*t;return 4*(t<.5?r:3*(t-e)+r-.75)}function Sn(t){return function(e){return Math.pow(e,t)}}function Cn(t){return 1-Math.cos(t*Uo)}function On(t){return Math.pow(2,10*(t-1))}function In(t){return 1-Math.sqrt(1-t*t)}function Rn(t,e){var r;return arguments.length<2&&(e=.45),arguments.length?r=e/jo*Math.asin(1/t):(t=1,r=e/4),function(n){return 1+t*Math.pow(2,-10*n)*Math.sin((n-r)*jo/e)}}function Dn(t){return t||(t=1.70158),function(e){return e*e*((t+1)*e-t)}}function Pn(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375}function zn(t,e){t=uo.hcl(t),e=uo.hcl(e);var r=t.h,n=t.c,a=t.l,i=e.h-r,o=e.c-n,s=e.l-a;return isNaN(o)&&(o=0,n=isNaN(n)?e.c:n),isNaN(i)?(i=0,r=isNaN(r)?e.h:r):i>180?i-=360:i<-180&&(i+=360),function(t){return ht(r+i*t,n+o*t,a+s*t)+""}}function Nn(t,e){t=uo.hsl(t),e=uo.hsl(e);var r=t.h,n=t.s,a=t.l,i=e.h-r,o=e.s-n,s=e.l-a;return isNaN(o)&&(o=0,n=isNaN(n)?e.s:n),isNaN(i)?(i=0,r=isNaN(r)?e.h:r):i>180?i-=360:i<-180&&(i+=360),function(t){return ct(r+i*t,n+o*t,a+s*t)+""}}function Fn(t,e){t=uo.lab(t),e=uo.lab(e);var r=t.l,n=t.a,a=t.b,i=e.l-r,o=e.a-n,s=e.b-a;return function(t){return pt(r+i*t,n+o*t,a+s*t)+""}}function Bn(t,e){return e-=t,function(r){return Math.round(t+e*r)}}function jn(t){var e=[t.a,t.b],r=[t.c,t.d],n=Un(e),a=Hn(e,r),i=Un(Vn(r,e,-a))||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 a=r.push(Gn(r)+"scale(",null,",",null,")");n.push({i:a-4,x:bn(t[0],e[0])},{i:a-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=uo.transform(t),e=uo.transform(e),qn(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,a=-1,i=n.length;++a=0;)r.push(a[n])}function la(t,e){for(var r=[t],n=[];null!=(t=r.pop());)if(n.push(t),(i=t.children)&&(a=i.length))for(var a,i,o=-1;++oa&&(n=r,a=e);return n}function ba(t){return t.reduce(xa,0)}function xa(t,e){return t+e[1]}function _a(t,e){return wa(t,Math.ceil(Math.log(e.length)/Math.LN2+1))}function wa(t,e){for(var r=-1,n=+t[0],a=(t[1]-n)/e,i=[];++r<=e;)i[r]=a*r+n;return i}function Aa(t){return[uo.min(t),uo.max(t)]}function ka(t,e){return t.value-e.value}function Ma(t,e){var r=t._pack_next;t._pack_next=e,e._pack_prev=t,e._pack_next=r,r._pack_prev=e}function Ta(t,e){t._pack_next=e,e._pack_prev=t}function Ea(t,e){var r=e.x-t.x,n=e.y-t.y,a=t.r+e.r;return.999*a*a>r*r+n*n}function La(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((r=t.children)&&(u=r.length)){var r,n,a,i,o,s,l,u,c=1/0,f=-1/0,h=1/0,d=-1/0;if(r.forEach(Sa),n=r[0],n.x=-n.r,n.y=0,e(n),u>1&&(a=r[1],a.x=a.r,a.y=0,e(a),u>2))for(i=r[2],Ia(n,a,i),e(i),Ma(n,i),n._pack_prev=i,Ma(i,a),a=n._pack_next,o=3;o=0;)e=a[i],e.z+=r,e.m+=r,r+=e.s+(n+=e.c)}function Fa(t,e,r){return t.a.parent===e.parent?t.a:r}function Ba(t){return 1+uo.max(t,function(t){return t.y})}function ja(t){return t.reduce(function(t,e){return t+e.x},0)/t.length}function Ha(t){var e=t.children;return e&&e.length?Ha(e[0]):t}function Ua(t){var e,r=t.children;return r&&(e=r.length)?Ua(r[e-1]):t}function Va(t){return{x:t.x,y:t.y,dx:t.dx,dy:t.dy}}function Ga(t,e){var r=t.x+e[3],n=t.y+e[0],a=t.dx-e[1]-e[3],i=t.dy-e[0]-e[2];return a<0&&(r+=a/2,a=0),i<0&&(n+=i/2,i=0),{x:r,y:n,dx:a,dy:i}}function qa(t){var e=t[0],r=t[t.length-1];return e2?Qa:Ya,l=n?$n:Qn;return o=a(t,e,l,r),s=a(e,t,l,_n),i}function i(t){return o(t)}var o,s;return i.invert=function(t){return s(t)},i.domain=function(e){return arguments.length?(t=e.map(Number),a()):t},i.range=function(t){return arguments.length?(e=t,a()):e},i.rangeRound=function(t){return i.range(t).interpolate(Bn)},i.clamp=function(t){return arguments.length?(n=t,a()):n},i.interpolate=function(t){return arguments.length?(r=t,a()):r},i.ticks=function(e){return ei(t,e)},i.tickFormat=function(e,r){return ri(t,e,r)},i.nice=function(e){return Ja(t,e),a()},i.copy=function(){return $a(t,e,r,n)},a()}function Ka(t,e){return uo.rebind(t,e,"range","rangeRound","interpolate","clamp")}function Ja(t,e){return Wa(t,Za(ti(t,e)[2])),Wa(t,Za(ti(t,e)[2])),t}function ti(t,e){null==e&&(e=10);var r=qa(t),n=r[1]-r[0],a=Math.pow(10,Math.floor(Math.log(n/e)/Math.LN10)),i=e/n*a;return i<=.15?a*=10:i<=.35?a*=5:i<=.75&&(a*=2),r[0]=Math.ceil(r[0]/a)*a,r[1]=Math.floor(r[1]/a)*a+.5*a,r[2]=a,r}function ei(t,e){return uo.range.apply(uo,ti(t,e))}function ri(t,e,r){var n=ti(t,e);if(r){var a=cs.exec(r);if(a.shift(),"s"===a[8]){var i=uo.formatPrefix(Math.max(xo(n[0]),xo(n[1])));return a[7]||(a[7]="."+ni(i.scale(n[2]))),a[8]="f",r=uo.format(a.join("")),function(t){return r(i.scale(t))+i.symbol}}a[7]||(a[7]="."+ai(a[8],n)),r=a.join("")}else r=",."+ni(n[2])+"f";return uo.format(r)}function ni(t){return-Math.floor(Math.log(t)/Math.LN10+.01)}function ai(t,e){var r=ni(e[2]);return t in Al?Math.abs(r-ni(Math.max(xo(e[0]),xo(e[1]))))+ +("e"!==t):r-2*("%"===t)}function ii(t,e,r,n){function a(t){return(r?Math.log(t<0?0:t):-Math.log(t>0?0:-t))/Math.log(e)}function i(t){return r?Math.pow(e,t):-Math.pow(e,-t)}function o(e){return t(a(e))}return o.invert=function(e){return i(t.invert(e))},o.domain=function(e){return arguments.length?(r=e[0]>=0,t.domain((n=e.map(Number)).map(a)),o):n},o.base=function(r){return arguments.length?(e=+r,t.domain(n.map(a)),o):e},o.nice=function(){var e=Wa(n.map(a),r?Math:Ml);return t.domain(e),n=e.map(i),o},o.ticks=function(){var t=qa(n),o=[],s=t[0],l=t[1],u=Math.floor(a(s)),c=Math.ceil(a(l)),f=e%1?2:e;if(isFinite(c-u)){if(r){for(;u0;h--)o.push(i(u)*h);for(u=0;o[u]l;c--);o=o.slice(u,c)}return o},o.tickFormat=function(t,r){if(!arguments.length)return kl;arguments.length<2?r=kl:"function"!=typeof r&&(r=uo.format(r));var n=Math.max(1,e*t/o.ticks().length);return function(t){var o=t/i(Math.round(a(t)));return o*e0?s[r-1]:t[0],r0?0:1}function xi(t,e,r,n,a){var i=t[0]-e[0],o=t[1]-e[1],s=(a?n:-n)/Math.sqrt(i*i+o*o),l=s*o,u=-s*i,c=t[0]+l,f=t[1]+u,h=e[0]+l,d=e[1]+u,p=(c+h)/2,g=(f+d)/2,m=h-c,v=d-f,y=m*m+v*v,b=r-n,x=c*d-h*f,_=(v<0?-1:1)*Math.sqrt(Math.max(0,b*b*y-x*x)),w=(x*v-m*_)/y,A=(-x*m-v*_)/y,k=(x*v+m*_)/y,M=(-x*m+v*_)/y,T=w-p,E=A-g,L=k-p,S=M-g;return T*T+E*E>L*L+S*S&&(w=k,A=M),[[w-l,A-u],[w*r/b,A*r/b]]}function _i(t){function e(e){function o(){u.push("M",i(t(c),s))}for(var l,u=[],c=[],f=-1,h=e.length,d=Lt(r),p=Lt(n);++f1?t.join("L"):t+"Z"}function Ai(t){return t.join("L")+"Z"}function ki(t){for(var e=0,r=t.length,n=t[0],a=[n[0],",",n[1]];++e1&&a.push("H",n[0]),a.join("")}function Mi(t){for(var e=0,r=t.length,n=t[0],a=[n[0],",",n[1]];++e1){s=e[1],i=t[l],l++,n+="C"+(a[0]+o[0])+","+(a[1]+o[1])+","+(i[0]-s[0])+","+(i[1]-s[1])+","+i[0]+","+i[1];for(var u=2;u9&&(a=3*e/Math.sqrt(a),o[s]=a*r,o[s+1]=a*n));for(s=-1;++s<=l;)a=(t[Math.min(l,s+1)][0]-t[Math.max(0,s-1)][0])/(6*(1+o[s]*o[s])),i.push([a||0,o[s]*a||0]);return i}function Hi(t){return t.length<3?wi(t):t[0]+Ci(t,ji(t))}function Ui(t){for(var e,r,n,a=-1,i=t.length;++a0;)d[--s].call(t,o);if(i>=1)return g.event&&g.event.end.call(t,t.__data__,e),--p.count?delete p[n]:delete t[r],1}var l,u,c,h,d,p=t[r]||(t[r]={active:0,count:0}),g=p[n];g||(l=a.time,u=Rt(i,0,l),g=p[n]={tween:new f,time:l,timer:u,delay:a.delay,duration:a.duration,ease:a.ease,index:e},a=null,++p.count)}function ro(t,e,r){t.attr("transform",function(t){var n=e(t);return"translate("+(isFinite(n)?n:r(t))+",0)"})}function no(t,e,r){t.attr("transform",function(t){var n=e(t);return"translate(0,"+(isFinite(n)?n:r(t))+")"})}function ao(t){return t.toISOString()}function io(t,e,r){function n(e){return t(e)}function a(t,r){var n=t[1]-t[0],a=n/r,i=uo.bisect(Ql,a);return i==Ql.length?[e.year,ti(t.map(function(t){ +return t/31536e6}),r)[2]]:i?e[a/Ql[i-1]1?{floor:function(e){for(;r(e=t.floor(e));)e=oo(e-1);return e},ceil:function(e){for(;r(e=t.ceil(e));)e=oo(+e+1);return e}}:t))},n.ticks=function(t,e){var r=qa(n.domain()),i=null==t?a(r,10):"number"==typeof t?a(r,t):!t.range&&[{range:t},e];return i&&(t=i[0],e=i[1]),t.range(r[0],oo(+r[1]+1),e<1?1:e)},n.tickFormat=function(){return r},n.copy=function(){return io(t.copy(),e,r)},Ka(n,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.17"},co=[].slice,fo=function(t){return co.call(t)},ho=this.document;if(ho)try{fo(ho.documentElement.childNodes)[0].nodeType}catch(t){fo=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}),ho)try{ho.createElement("DIV").style.setProperty("opacity",0,"")}catch(t){var po=this.Element.prototype,go=po.setAttribute,mo=po.setAttributeNS,vo=this.CSSStyleDeclaration.prototype,yo=vo.setProperty;po.setAttribute=function(t,e){go.call(this,t,e+"")},po.setAttributeNS=function(t,e,r){mo.call(this,t,e,r+"")},vo.setProperty=function(t,e,r){yo.call(this,t,e+"",r)}}uo.ascending=a,uo.descending=function(t,e){return et?1:e>=t?0:NaN},uo.min=function(t,e){var r,n,a=-1,i=t.length;if(1===arguments.length){for(;++a=n){r=n;break}for(;++an&&(r=n)}else{for(;++a=n){r=n;break}for(;++an&&(r=n)}return r},uo.max=function(t,e){var r,n,a=-1,i=t.length;if(1===arguments.length){for(;++a=n){r=n;break}for(;++ar&&(r=n)}else{for(;++a=n){r=n;break}for(;++ar&&(r=n)}return r},uo.extent=function(t,e){var r,n,a,i=-1,o=t.length;if(1===arguments.length){for(;++i=n){r=a=n;break}for(;++in&&(r=n),a=n){r=a=n;break}for(;++in&&(r=n),a1)return l/(c-1)},uo.deviation=function(){var t=uo.variance.apply(this,arguments);return t?Math.sqrt(t):t};var bo=s(a);uo.bisectLeft=bo.left,uo.bisect=uo.bisectRight=bo.right,uo.bisector=function(t){return s(1===t.length?function(e,r){return a(t(e),r)}:t)},uo.shuffle=function(t,e,r){(i=arguments.length)<3&&(r=t.length,i<2&&(e=0));for(var n,a,i=r-e;i;)a=Math.random()*i--|0,n=t[i+e],t[i+e]=t[a+e],t[a+e]=n;return t},uo.permute=function(t,e){for(var r=e.length,n=new Array(r);r--;)n[r]=t[e[r]];return n},uo.pairs=function(t){for(var e=0,r=t.length-1,n=t[0],a=new Array(r<0?0:r);e=0;)for(n=t[a],e=n.length;--e>=0;)r[--o]=n[e];return r};var xo=Math.abs;uo.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,a=[],i=u(xo(r)),o=-1;if(t*=i,e*=i,r*=i,r<0)for(;(n=t+r*++o)>e;)a.push(n/i);else for(;(n=t+r*++o)=i.length)return n?n.call(a,o):r?o.sort(r):o;for(var l,u,c,h,d=-1,p=o.length,g=i[s++],m=new f;++d=i.length)return t;var n=[],a=o[r++];return t.forEach(function(t,a){n.push({key:t,values:e(a,r)})}),a?n.sort(function(t,e){return a(t.key,e.key)}):n}var r,n,a={},i=[],o=[];return a.map=function(e,r){return t(r,e,0)},a.entries=function(r){return e(t(uo.map,r,0),0)},a.key=function(t){return i.push(t),a},a.sortKeys=function(t){return o[i.length-1]=t,a},a.sortValues=function(t){return r=t,a},a.rollup=function(t){return n=t,a},a},uo.set=function(t){var e=new b;if(t)for(var r=0,n=t.length;r=0&&(n=t.slice(r+1),t=t.slice(0,r)),t)return arguments.length<2?this[t].on(n):this[t].on(n,e);if(2===arguments.length){if(null==e)for(t in this)this.hasOwnProperty(t)&&this[t].on(n,null);return this}},uo.event=null,uo.requote=function(t){return t.replace(ko,"\\$&")};var ko=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,Mo={}.__proto__?function(t,e){t.__proto__=e}:function(t,e){for(var r in e)t[r]=e[r]},To=function(t,e){return e.querySelector(t)},Eo=function(t,e){return e.querySelectorAll(t)},Lo=function(t,e){var r=t.matches||t[w(t,"matchesSelector")];return(Lo=function(t,e){return r.call(t,e)})(t,e)};"function"==typeof Sizzle&&(To=function(t,e){return Sizzle(t,e)[0]||null},Eo=Sizzle,Lo=Sizzle.matchesSelector),uo.selection=function(){return uo.select(ho.documentElement)};var So=uo.selection.prototype=[];So.select=function(t){var e,r,n,a,i=[];t=C(t);for(var o=-1,s=this.length;++o=0&&"xmlns"!==(r=t.slice(0,e))&&(t=t.slice(e+1)),Oo.hasOwnProperty(r)?{space:Oo[r],local:t}:t}},So.attr=function(t,e){if(arguments.length<2){if("string"==typeof t){var r=this.node();return t=uo.ns.qualify(t),t.local?r.getAttributeNS(t.space,t.local):r.getAttribute(t)}for(e in t)this.each(I(e,t[e]));return this}return this.each(I(t,e))},So.classed=function(t,e){if(arguments.length<2){if("string"==typeof t){var r=this.node(),n=(t=P(t)).length,a=-1;if(e=r.classList){for(;++a=0;)(r=n[a])&&(i&&i!==r.nextSibling&&i.parentNode.insertBefore(r,i),i=r);return this},So.sort=function(t){t=G.apply(this,arguments);for(var e=-1,r=this.length;++e0&&(e=e.transition().duration(S)),e.call(t.event)}function s(){_&&_.domain(x.range().map(function(t){return(t-k.x)/k.k}).map(x.invert)),A&&A.domain(w.range().map(function(t){return(t-k.y)/k.k}).map(w.invert))}function l(t){C++||t({type:"zoomstart"})}function u(t){s(),t({type:"zoom",scale:k.k,translate:[k.x,k.y]})}function c(t){--C||(t({type:"zoomend"}),m=null)}function f(){function t(){s=1,i(uo.mouse(a),h),u(o)}function r(){f.on(I,null).on(R,null),d(s),c(o)}var a=this,o=P.of(a,arguments),s=0,f=uo.select(n(a)).on(I,t).on(R,r),h=e(uo.mouse(a)),d=$(a);jl.call(a),l(o)}function h(){function t(){var t=uo.touches(p);return d=k.k,t.forEach(function(t){t.identifier in m&&(m[t.identifier]=e(t))}),t}function r(){var e=uo.event.target;uo.select(e).on(x,n).on(_,s),w.push(e);for(var r=uo.event.changedTouches,a=0,i=r.length;a1){var c=l[0],f=l[1],h=c[0]-f[0],d=c[1]-f[1];v=h*h+d*d}}function n(){var t,e,r,n,o=uo.touches(p);jl.call(p);for(var s=0,l=o.length;s=u)return o;if(a)return a=!1,i;var e=c;if(34===t.charCodeAt(e)){for(var r=e;r++=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i,fs=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,Nt(t,e))).toFixed(Math.max(0,Math.min(20,Nt(t*(1+1e-15),e))))}}),hs=uo.time={},ds=Date;Ht.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(){ps.setUTCDate.apply(this._,arguments)},setDay:function(){ps.setUTCDay.apply(this._,arguments)},setFullYear:function(){ps.setUTCFullYear.apply(this._,arguments)},setHours:function(){ps.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){ps.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){ps.setUTCMinutes.apply(this._,arguments)},setMonth:function(){ps.setUTCMonth.apply(this._,arguments)},setSeconds:function(){ps.setUTCSeconds.apply(this._,arguments)},setTime:function(){ps.setTime.apply(this._,arguments)}};var ps=Date.prototype;hs.year=Ut(function(t){return t=hs.day(t),t.setMonth(0,1),t},function(t,e){t.setFullYear(t.getFullYear()+e)},function(t){return t.getFullYear()}),hs.years=hs.year.range,hs.years.utc=hs.year.utc.range,hs.day=Ut(function(t){var e=new ds(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}),hs.days=hs.day.range,hs.days.utc=hs.day.utc.range,hs.dayOfYear=function(t){var e=hs.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=hs[t]=Ut(function(t){return(t=hs.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=hs.year(t).getDay();return Math.floor((hs.dayOfYear(t)+(r+e)%7)/7)-(r!==e)});hs[t+"s"]=r.range,hs[t+"s"].utc=r.utc.range,hs[t+"OfYear"]=function(t){var r=hs.year(t).getDay();return Math.floor((hs.dayOfYear(t)+(r+e)%7)/7)}}),hs.week=hs.sunday,hs.weeks=hs.sunday.range,hs.weeks.utc=hs.sunday.utc.range,hs.weekOfYear=hs.sundayOfYear;var gs={"-":"",_:" ",0:"0"},ms=/^\s*\d+/,vs=/^%/;uo.locale=function(t){return{numberFormat:Bt(t),timeFormat:Gt(t)}};var ys=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=ys.numberFormat,uo.geo={},fe.prototype={s:0,t:0,add:function(t){he(t,this.t,bs),he(bs.s,this.s,this),this.s?this.t+=bs.t:this.s=bs.t},reset:function(){this.s=this.t=0},valueOf:function(){return this.s}};var bs=new fe;uo.geo.stream=function(t,e){t&&xs.hasOwnProperty(t.type)?xs[t.type](t,e):de(t,e)};var xs={Feature:function(t,e){de(t.geometry,e)},FeatureCollection:function(t,e){for(var r=t.features,n=-1,a=r.length;++nd&&(d=e)}function e(e,r){var n=ve([e*Vo,r*Vo]);if(v){var a=be(v,n),i=[a[1],-a[0],0],o=be(i,a);we(o),o=Ae(o);var l=e-p,u=l>0?1:-1,g=o[0]*Go*u,m=xo(l)>180;if(m^(u*pd&&(d=y)}else if(g=(g+360)%360-180,m^(u*pd&&(d=r);m?es(c,h)&&(h=e):s(e,h)>s(c,h)&&(c=e):h>=c?(eh&&(h=e)):e>p?s(c,e)>s(c,h)&&(h=e):s(e,h)>s(c,h)&&(c=e)}else t(e,r);v=n,p=e}function r(){_.point=e}function n(){x[0]=c,x[1]=h,_.point=t,v=null}function a(t,r){if(v){var n=t-p;y+=xo(n)>180?n+(n>0?360:-360):n}else g=t,m=r;ks.point(t,r),e(t,r)}function i(){ks.lineStart()}function o(){a(g,m),ks.lineEnd(),xo(y)>No&&(c=-(h=180)),x[0]=c,x[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]:tNo?d=90:y<-No&&(f=-90),x[0]=c,x[1]=h}};return function(t){d=h=-(c=f=1/0),b=[],uo.geo.stream(t,_);var e=b.length;if(e){b.sort(l);for(var r,n=1,a=b[0],i=[a];ns(a[0],a[1])&&(a[1]=r[1]),s(r[0],a[1])>s(a[0],a[1])&&(a[0]=r[0])):i.push(a=r);for(var o,r,p=-1/0,e=i.length-1,n=0,a=i[e];n<=e;a=r,++n)r=i[n], +(o=s(a[1],r[0]))>p&&(p=o,c=r[0],h=a[1])}return b=x=null,c===1/0||f===1/0?[[NaN,NaN],[NaN,NaN]]:[[c,f],[h,d]]}}(),uo.geo.centroid=function(t){Ms=Ts=Es=Ls=Ss=Cs=Os=Is=Rs=Ds=Ps=0,uo.geo.stream(t,zs);var e=Rs,r=Ds,n=Ps,a=e*e+r*r+n*n;return a=.12&&a<.234&&n>=-.425&&n<-.214?o:a>=.166&&a<.234&&n>=-.214&&n<-.115?s:i).invert(t)},t.stream=function(t){var e=i.stream(t),r=o.stream(t),n=s.stream(t);return{point:function(t,a){e.point(t,a),r.point(t,a),n.point(t,a)},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?(i.precision(e),o.precision(e),s.precision(e),t):i.precision()},t.scale=function(e){return arguments.length?(i.scale(e),o.scale(.35*e),s.scale(e),t.translate(i.translate())):i.scale()},t.translate=function(e){if(!arguments.length)return i.translate();var u=i.scale(),c=+e[0],f=+e[1];return r=i.translate(e).clipExtent([[c-.455*u,f-.238*u],[c+.455*u,f+.238*u]]).stream(l).point,n=o.translate([c-.307*u,f+.201*u]).clipExtent([[c-.425*u+No,f+.12*u+No],[c-.214*u-No,f+.234*u-No]]).stream(l).point,a=s.translate([c-.205*u,f+.212*u]).clipExtent([[c-.214*u+No,f+.166*u+No],[c-.115*u-No,f+.234*u-No]]).stream(l).point,t},t.scale(1070)};var Bs,js,Hs,Us,Vs,Gs,qs={point:A,lineStart:A,lineEnd:A,polygonStart:function(){js=0,qs.lineStart=We},polygonEnd:function(){qs.lineStart=qs.lineEnd=qs.point=A,Bs+=xo(js/2)}},Xs={point:Ze,lineStart:A,lineEnd:A,polygonStart:A,polygonEnd:A},Ys={point:Ke,lineStart:Je,lineEnd:tr,polygonStart:function(){Ys.lineStart=er},polygonEnd:function(){Ys.point=Ke,Ys.lineStart=Je,Ys.lineEnd=tr}};uo.geo.path=function(){function t(t){return t&&("function"==typeof s&&i.pointRadius(+s.apply(this,arguments)),o&&o.valid||(o=a(i)),uo.geo.stream(t,o)),i.result()}function e(){return o=null,t}var r,n,a,i,o,s=4.5;return t.area=function(t){return Bs=0,uo.geo.stream(t,a(qs)),Bs},t.centroid=function(t){return Es=Ls=Ss=Cs=Os=Is=Rs=Ds=Ps=0,uo.geo.stream(t,a(Ys)),Ps?[Rs/Ps,Ds/Ps]:Is?[Cs/Is,Os/Is]:Ss?[Es/Ss,Ls/Ss]:[NaN,NaN]},t.bounds=function(t){return Vs=Gs=-(Hs=Us=1/0),uo.geo.stream(t,a(Xs)),[[Hs,Us],[Vs,Gs]]},t.projection=function(t){return arguments.length?(a=(r=t)?t.stream||ar(t):x,e()):r},t.context=function(t){return arguments.length?(i=null==(n=t)?new Qe:new rr(t),"function"!=typeof s&&i.pointRadius(s),e()):n},t.pointRadius=function(e){return arguments.length?(s="function"==typeof e?e:(i.pointRadius(+e),+e),t):s},t.projection(uo.geo.albersUsa()).context(null)},uo.geo.transform=function(t){return{stream:function(e){var r=new ir(e);for(var n in t)r[n]=t[n];return r}}},ir.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=sr,uo.geo.projectionMutator=lr,(uo.geo.equirectangular=function(){return sr(cr)}).raw=cr.invert=cr,uo.geo.rotation=function(t){function e(e){return e=t(e[0]*Vo,e[1]*Vo),e[0]*=Go,e[1]*=Go,e}return t=hr(t[0]%360*Vo,t[1]*Vo,t.length>2?t[2]*Vo:0),e.invert=function(e){return e=t.invert(e[0]*Vo,e[1]*Vo),e[0]*=Go,e[1]*=Go,e},e},fr.invert=cr,uo.geo.circle=function(){function t(){var t="function"==typeof n?n.apply(this,arguments):n,e=hr(-t[0]*Vo,-t[1]*Vo,0).invert,a=[];return r(null,null,1,{point:function(t,r){a.push(t=e(t,r)),t[0]*=Go,t[1]*=Go}}),{type:"Polygon",coordinates:[a]}}var e,r,n=[0,0],a=6;return t.origin=function(e){return arguments.length?(n=e,t):n},t.angle=function(n){return arguments.length?(r=mr((e=+n)*Vo,a*Vo),t):e},t.precision=function(n){return arguments.length?(r=mr(e*Vo,(a=+n)*Vo),t):a},t.angle(90)},uo.geo.distance=function(t,e){var r,n=(e[0]-t[0])*Vo,a=t[1]*Vo,i=e[1]*Vo,o=Math.sin(n),s=Math.cos(n),l=Math.sin(a),u=Math.cos(a),c=Math.sin(i),f=Math.cos(i);return Math.atan2(Math.sqrt((r=f*o)*r+(r=u*c-l*f*s)*r),l*c+u*f*s)},uo.geo.graticule=function(){function t(){return{type:"MultiLineString",coordinates:e()}}function e(){return uo.range(Math.ceil(i/m)*m,a,m).map(h).concat(uo.range(Math.ceil(u/v)*v,l,v).map(d)).concat(uo.range(Math.ceil(n/p)*p,r,p).filter(function(t){return xo(t%m)>No}).map(c)).concat(uo.range(Math.ceil(s/g)*g,o,g).filter(function(t){return xo(t%v)>No}).map(f))}var r,n,a,i,o,s,l,u,c,f,h,d,p=10,g=p,m=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(i).concat(d(l).slice(1),h(a).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?(i=+e[0][0],a=+e[1][0],u=+e[0][1],l=+e[1][1],i>a&&(e=i,i=a,a=e),u>l&&(e=u,u=l,l=e),t.precision(y)):[[i,u],[a,l]]},t.minorExtent=function(e){return arguments.length?(n=+e[0][0],r=+e[1][0],s=+e[0][1],o=+e[1][1],n>r&&(e=n,n=r,r=e),s>o&&(e=s,s=o,o=e),t.precision(y)):[[n,s],[r,o]]},t.step=function(e){return arguments.length?t.majorStep(e).minorStep(e):t.minorStep()},t.majorStep=function(e){return arguments.length?(m=+e[0],v=+e[1],t):[m,v]},t.minorStep=function(e){return arguments.length?(p=+e[0],g=+e[1],t):[p,g]},t.precision=function(e){return arguments.length?(y=+e,c=yr(s,o,90),f=br(n,r,y),h=yr(u,l,90),d=br(i,a,y),t):y},t.majorExtent([[-180,-90+No],[180,90-No]]).minorExtent([[-180,-80-No],[180,80+No]])},uo.geo.greatArc=function(){function t(){return{type:"LineString",coordinates:[e||n.apply(this,arguments),r||a.apply(this,arguments)]}}var e,r,n=xr,a=_r;return t.distance=function(){return uo.geo.distance(e||n.apply(this,arguments),r||a.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?(a=e,r="function"==typeof e?null:e,t):a},t.precision=function(){return arguments.length?t:0},t},uo.geo.interpolate=function(t,e){return wr(t[0]*Vo,t[1]*Vo,e[0]*Vo,e[1]*Vo)},uo.geo.length=function(t){return Ws=0,uo.geo.stream(t,Zs),Ws};var Ws,Zs={sphere:A,point:A,lineStart:Ar,lineEnd:A,polygonStart:A,polygonEnd:A},Qs=kr(function(t){return Math.sqrt(2/(1+t))},function(t){return 2*Math.asin(t/2)});(uo.geo.azimuthalEqualArea=function(){return sr(Qs)}).raw=Qs;var $s=kr(function(t){var e=Math.acos(t);return e&&e/Math.sin(e)},x);(uo.geo.azimuthalEquidistant=function(){return sr($s)}).raw=$s,(uo.geo.conicConformal=function(){return Xe(Mr)}).raw=Mr,(uo.geo.conicEquidistant=function(){return Xe(Tr)}).raw=Tr;var Ks=kr(function(t){return 1/t},Math.atan);(uo.geo.gnomonic=function(){return sr(Ks)}).raw=Ks,Er.invert=function(t,e){return[t,2*Math.atan(Math.exp(e))-Uo]},(uo.geo.mercator=function(){return Lr(Er)}).raw=Er;var Js=kr(function(){return 1},Math.asin);(uo.geo.orthographic=function(){return sr(Js)}).raw=Js;var tl=kr(function(t){return 1/(1+t)},function(t){return 2*Math.atan(t)});(uo.geo.stereographic=function(){return sr(tl)}).raw=tl,Sr.invert=function(t,e){return[-e,2*Math.atan(Math.exp(t))-Uo]},(uo.geo.transverseMercator=function(){var t=Lr(Sr),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=Sr,uo.geom={},uo.geom.hull=function(t){function e(t){if(t.length<3)return[];var e,a=Lt(r),i=Lt(n),o=t.length,s=[],l=[];for(e=0;e=0;--e)d.push(t[s[u[e]][2]]);for(e=+f;e=n&&u.x<=i&&u.y>=a&&u.y<=o?[[n,o],[i,o],[i,a],[n,a]]:[]).point=t[s]}),e}function r(t){return t.map(function(t,e){return{x:Math.round(i(t,e)/No)*No,y:Math.round(o(t,e)/No)*No,i:e}})}var n=Cr,a=Or,i=n,o=a,s=ul;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 a,i=r.site,o=r.edges.sort(Xr),s=-1,l=o.length,u=o[l-1].edge,c=u.l===i?u.r:u.l;++s=u,h=n>=c,d=h<<1|f;t.leaf=!1,t=t.nodes[d]||(t.nodes[d]=pn()),f?a=u:s=u,h?o=c:l=c,i(t,e,r,n,a,o,s,l)}var c,f,h,d,p,g,m,v,y,b=Lt(s),x=Lt(l);if(null!=e)g=e,m=r,v=n,y=a;else if(v=y=-(g=m=1/0),f=[],h=[],p=t.length,o)for(d=0;dv&&(v=c.x),c.y>y&&(y=c.y),f.push(c.x),h.push(c.y);else for(d=0;dv&&(v=_),w>y&&(y=w),f.push(_),h.push(w)}var A=v-g,k=y-m;A>k?y=m+A:v=g+k;var M=pn();if(M.add=function(t){i(M,t,+b(t,++d),+x(t,d),g,m,v,y)},M.visit=function(t){gn(t,M,g,m,v,y)},M.find=function(t){return mn(M,t[0],t[1],g,m,v,y)},d=-1,null==e){for(;++d=0?t.slice(0,e):t,n=e>=0?t.slice(e+1):"in";return r=dl.get(r)||hl,n=pl.get(n)||x,An(n(r.apply(null,co.call(arguments,1))))},uo.interpolateHcl=zn,uo.interpolateHsl=Nn,uo.interpolateLab=Fn,uo.interpolateRound=Bn,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 r=e.transform.baseVal.consolidate()}return new jn(r?r.matrix:gl)})(t)},jn.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var gl={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;++r0?a=t:(r.c=null,r.t=NaN,r=null,u.end({type:"end",alpha:a=0})):t>0&&(u.start({type:"start",alpha:a=t}),r=Rt(l.tick)),l):a},l.start=function(){function t(t,n){if(!r){for(r=new Array(a),l=0;l=0;)o.push(c=u[l]),c.parent=i,c.depth=i.depth+1;n&&(i.value=0),i.children=u}else n&&(i.value=+n.call(t,i,i.depth)||0),delete i.children;return la(a,function(t){var r,a;e&&(r=t.children)&&r.sort(e),n&&(a=t.parent)&&(a.value+=t.value)}),s}var e=fa,r=ua,n=ca;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&&(sa(e,function(t){t.children&&(t.value=0)}),la(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,a){var i=e.children;if(e.x=r,e.y=e.depth*a,e.dx=n,e.dy=a,i&&(o=i.length)){var o,s,l,u=-1;for(n=e.value?n/e.value:0;++us&&(s=n),o.push(n)}for(r=0;r0)for(i=-1;++i=c[0]&&s<=c[1]&&(o=l[uo.bisect(f,s,1,d)-1],o.y+=p,o.push(t[i]));return l}var e=!0,r=Number,n=Aa,a=_a;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?(a="number"==typeof e?function(t){return wa(t,e)}:Lt(e),t):a},t.frequency=function(r){return arguments.length?(e=!!r,t):e},t},uo.layout.pack=function(){function t(t,i){var o=r.call(this,t,i),s=o[0],l=a[0],u=a[1],c=null==e?Math.sqrt:"function"==typeof e?e:function(){return e};if(s.x=s.y=0,la(s,function(t){t.r=+c(t.value)}),la(s,La),n){var f=n*(e?1:Math.max(2*s.r/l,2*s.r/u))/2;la(s,function(t){t.r+=f}),la(s,La),la(s,function(t){t.r-=f})}return Oa(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(ka),n=0,a=[1,1];return t.size=function(e){return arguments.length?(a=e,t):a},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},oa(t,r)},uo.layout.tree=function(){function t(t,a){var c=o.call(this,t,a),f=c[0],h=e(f);if(la(h,r),h.parent.m=-h.z,sa(h,n),u)sa(f,i);else{var d=f,p=f,g=f;sa(f,function(t){t.xp.x&&(p=t),t.depth>g.depth&&(g=t)});var m=s(d,p)/2-d.x,v=l[0]/(p.x+s(p,d)/2+m),y=l[1]/(g.depth||1);sa(f,function(t){t.x=(t.x+m)*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 a,i=e.children,o=0,s=i.length;o0&&(za(Fa(o,t,r),t,n),u+=n,c+=n),f+=o.m,u+=a.m,h+=l.m,c+=i.m;o&&!Pa(i)&&(i.t=o,i.m+=f-c),a&&!Da(l)&&(l.t=a,l.m+=u-h,r=t)}return r}function i(t){t.x*=l[0],t.y=t.depth*l[1]}var o=uo.layout.hierarchy().sort(null).value(null),s=Ra,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)?i:null,t):u?null:l},t.nodeSize=function(e){return arguments.length?(u=null==(l=e)?null:i,t):u?l:null},oa(t,o)},uo.layout.cluster=function(){function t(t,i){var o,s=e.call(this,t,i),l=s[0],u=0;la(l,function(t){var e=t.children;e&&e.length?(t.x=ja(e),t.y=Ba(e)):(t.x=o?u+=r(t,o):0,t.y=0,o=t)});var c=Ha(l),f=Ua(l),h=c.x-r(c,f)/2,d=f.x+r(f,c)/2;return la(l,a?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=Ra,n=[1,1],a=!1;return t.separation=function(e){return arguments.length?(r=e,t):r},t.size=function(e){return arguments.length?(a=null==(n=e),t):a?null:n},t.nodeSize=function(e){return arguments.length?(a=null!=(n=e),t):a?n:null},oa(t,e)},uo.layout.treemap=function(){function t(t,e){for(var r,n,a=-1,i=t.length;++a0;)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,a(c,g,u,!1),g=Math.min(u.dx,u.dy),c.length=c.area=0,p=1/0);c.length&&(a(c,g,u,!0),c.length=c.area=0),i.forEach(e)}}function r(e){var n=e.children;if(n&&n.length){var i,o=f(e),s=n.slice(),l=[];for(t(s,o.dx*o.dy/e.value),l.area=0;i=s.pop();)l.push(i),l.area+=i.area,null!=i.z&&(a(l,i.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,a=0,i=1/0,o=-1,s=t.length;++oa&&(a=r));return n*=n,e*=e,n?Math.max(e*a*p/n,n/(e*i*p)):1/0}function a(t,e,r,n){var a,i=-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);++ir.dx)&&(c=r.dx);++i1);return t+e*r*Math.sqrt(-2*Math.log(a)/a)}},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;rf?0:1;if(u=Ho)return e(u,d)+(t?e(t,1-d):"")+"Z";var p,g,m,v,y,b,x,_,w,A,k,M,T=0,E=0,L=[];if((v=(+l.apply(this,arguments)||0)/2)&&(m=i===Cl?Math.sqrt(t*t+u*u):+i.apply(this,arguments),d||(E*=-1),u&&(E=nt(m/u*Math.sin(v))),t&&(T=nt(m/t*Math.sin(v)))),u){y=u*Math.cos(c+E),b=u*Math.sin(c+E),x=u*Math.cos(f-E),_=u*Math.sin(f-E);var S=Math.abs(f-c-2*E)<=Bo?0:1;if(E&&bi(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-T),A=t*Math.sin(f-T),k=t*Math.cos(c+T),M=t*Math.sin(c+T);var O=Math.abs(c-f+2*T)<=Bo?0:1;if(T&&bi(w,A,k,M)===1-d^O){var I=(c+f)/2;w=t*Math.cos(I),A=t*Math.sin(I),k=M=null}}else w=A=0;if(h>No&&(p=Math.min(Math.abs(u-t)/2,+a.apply(this,arguments)))>.001){g=tBo)+",1 "+e}function a(t,e,r,n){return"Q 0,0 "+n}var i=xr,o=_r,s=Gi,l=mi,u=vi;return t.radius=function(e){return arguments.length?(s=Lt(e),t):s},t.source=function(e){return arguments.length?(i=Lt(e),t):i},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,a){var i=e.call(this,t,a),o=r.call(this,t,a),s=(i.y+o.y)/2,l=[i,{x:i.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=qi;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=qi,r=t.projection;return t.projection=function(t){return arguments.length?r(Xi(e=t)):e},t},uo.svg.symbol=function(){function t(t,n){return(Pl.get(e.call(this,t,n))||Zi)(r.call(this,t,n))}var e=Wi,r=Yi;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 Pl=uo.map({circle:Zi,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*Nl)),r=e*Nl;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/zl),r=e*zl/2;return"M0,"+r+"L"+e+","+-r+" "+-e+","+-r+"Z"},"triangle-up":function(t){var e=Math.sqrt(t/zl),r=e*zl/2;return"M0,"+-r+"L"+e+","+r+" "+-e+","+r+"Z"}});uo.svg.symbolTypes=Pl.keys();var zl=Math.sqrt(3),Nl=Math.tan(30*Vo);So.transition=function(t){for(var e,r,n=Fl||++Ul,a=to(t),i=[],o=Bl||{time:Date.now(),ease:Ln,delay:0,duration:250},s=-1,l=this.length;++srect,.s>rect").attr("width",f[1]-f[0])}function a(t){t.select(".extent").attr("y",h[0]),t.selectAll(".extent,.e>rect,.w>rect").attr("height",h[1]-h[0])}function i(){function i(){32==uo.event.keyCode&&(S||(b=null,O[0]-=f[1],O[1]-=h[1],S=2),T())}function g(){32==uo.event.keyCode&&2==S&&(O[0]+=f[1],O[1]+=h[1],S=0,T())}function m(){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]),O[0]=f[+(t[0]>>31},e.exports.exponent=function(t){return(e.exports.hi(t)<<1>>>21)-1023},e.exports.fraction=function(t){var r=e.exports.lo(t),n=e.exports.hi(t),a=1048575&n;return 2146435072&n&&(a+=1<<20),[r,a]},e.exports.denormalized=function(t){return!(2146435072&e.exports.hi(t))}}).call(this,t("buffer").Buffer)},{buffer:40}],64:[function(t,e,r){"use strict";function n(t,e,r){var a=0|t[r];if(a<=0)return[];var i,o=new Array(a);if(r===t.length-1)for(i=0;i0)return a(0|t,e);break;case"object":if("number"==typeof t.length)return n(t,e,0)}return[]}e.exports=i},{}],65:[function(t,e,r){"use strict";function n(t,e){var r=t.length;if("number"!=typeof e){e=0;for(var n=0;n0&&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(!a(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,i,s;if(!a(e))throw TypeError("listener must be a function");if(!this._events||!this._events[t])return this;if(r=this._events[t],i=r.length, +n=-1,r===e||a(r.listener)&&r.listener===e)delete this._events[t],this._events.removeListener&&this.emit("removeListener",t,e);else if(o(r)){for(s=i;s-- >0;)if(r[s]===e||r[s].listener&&r[s].listener===e){n=s;break}if(n<0)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],a(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){return this._events&&this._events[t]?a(this._events[t])?[this._events[t]]:this._events[t].slice():[]},n.prototype.listenerCount=function(t){if(this._events){var e=this._events[t];if(a(e))return 1;if(e)return e.length}return 0},n.listenerCount=function(t,e){return t.listenerCount(e)}},{}],68:[function(t,e,r){"use strict";function n(t){for(var e,r=t.length,n=0;n13)&&32!==e&&133!==e&&160!==e&&5760!==e&&6158!==e&&(e<8192||e>8205)&&8232!==e&&8233!==e&&8239!==e&&8287!==e&&8288!==e&&12288!==e&&65279!==e)return!1;return!0}e.exports=function(t){var e=typeof t;if("string"===e){var r=t;if(0===(t=+t)&&n(r))return!1}else if("number"!==e)return!1;return t-t<1}},{}],69:[function(t,e,r){"use strict";function n(t){t=t||{};var e,r,n=t.canvas||document.createElement("canvas"),o=t.family||"sans-serif",s=t.shape||[512,512],l=t.step||[32,32],u=parseFloat(t.size)||16,c=t.chars||[32,126],f=Math.floor((l[0]-u)/2),h=t.radius||1.5*f,d=new i(u,f,h,0,o),p=null==t.align?"optical":t.align,g=null==t.fit||1==t.fit?.5:t.fit;if(Array.isArray(c)){if(2===c.length&&"number"==typeof c[0]&&"number"==typeof c[1]){var m=[];for(e=c[0],r=0;e<=c[1];e++)m[r++]=String.fromCharCode(e);c=m}}else c=String(c).split("");s=s.slice(),n.width=s[0],n.height=s[1];var v=n.getContext("2d");v.fillStyle="#000",v.fillRect(0,0,n.width,n.height),v.textBaseline="middle";var y=l[0],b=l[1],x=0,_=0,w=u/b,A=Math.min(c.length,Math.floor(s[0]/y)*Math.ceil(s[1]/b)),k=d.ctx.textAlign,M=d.buffer,T=d.middle;for(d.ctx.textAlign="center",d.buffer=d.size/2,e=0;es[0]-l[0]&&(x=0,_+=l[1])}return d.ctx.textAlign=k,d.buffer=M,d.middle=T,n}function a(t,e,r){if(s[e]&&s[e][t])return s[e][t];var n=200*r,a=o(t,{size:200,fontSize:n,fontFamily:e});s[e]||(s[e]={});var i={center:[a.center[0]/200,a.center[1]/200],bounds:a.bounds.map(function(t){return t/200}),radius:a.radius/200};return s[e][t]=i,i}var i=t("tiny-sdf"),o=t("optical-properties");e.exports=n;var s={}},{"optical-properties":165,"tiny-sdf":199}],70:[function(t,e,r){"use strict";function n(t,e,r,n,a,i){this._color=t,this.key=e,this.value=r,this.left=n,this.right=a,this._count=i}function a(t){return new n(t._color,t.key,t.value,t.left,t.right,t._count)}function i(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||(e.right?l(t,e.right):void 0)}function u(t,e,r,n){if(e(t,n.key)<=0){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}if(n.right)return u(t,e,r,n.right)}function c(t,e,r,n,a){var i,o=r(t,a.key),s=r(e,a.key);if(o<=0){if(a.left&&(i=c(t,e,r,n,a.left)))return i;if(s>0&&(i=n(a.key,a.value)))return i}if(s>0&&a.right)return c(t,e,r,n,a.right)}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=v);if(r=t[l-1],r.left===e){if(n=r.right,n.right&&n.right._color===m){if(n=r.right=a(n),s=n.right=a(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,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===m){if(n=r.right=a(n),s=n.left=a(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,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===v){if(r._color===m)return r._color=v,void(r.right=i(m,n));r.right=i(m,n);continue}if(n=a(n),r.right=n.left,n.left=r,n._color=r._color,r._color=m,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===m){if(n=r.left=a(n),s=n.right=a(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,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===v){if(r._color===m)return r._color=v,void(r.left=i(m,n));r.left=i(m,n);continue}if(n=a(n),r.left=n.right,n.right=r,n._color=r._color,r._color=m,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+1e?1:0}function g(t){return new s(t||p,null)}e.exports=g;var m=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,a=this.root,l=[],u=[];a;){var c=r(t,a.key);l.push(a),u.push(c),a=c<=0?a.left:a.right}l.push(new n(m,t,e,null,null,1));for(var f=l.length-2;f>=0;--f){var a=l[f];u[f]<=0?l[f]=new n(a._color,a.key,a.value,l[f+1],a.right,a._count+1):l[f]=new n(a._color,a.key,a.value,a.left,l[f+1],a._count+1)}for(var f=l.length-1;f>1;--f){var h=l[f-1],a=l[f];if(h._color===v||a._color===v)break;var d=l[f-2];if(d.left===h)if(h.left===a){var p=d.right;if(!p||p._color!==m){if(d._color=m,d.left=h.right,h._color=v,h.right=d,l[f-2]=h,l[f-1]=a,o(d),o(h),f>=3){var g=l[f-3];g.left===d?g.left=h:g.right=h}break}h._color=v,d.right=i(v,p),d._color=m,f-=1}else{var p=d.right;if(!p||p._color!==m){if(h.right=a.left,d._color=m,d.left=a.right,a._color=v,a.left=h,a.right=d,l[f-2]=a,l[f-1]=h,o(d),o(h),o(a),f>=3){var g=l[f-3];g.left===d?g.left=a:g.right=a}break}h._color=v,d.right=i(v,p),d._color=m,f-=1}else if(h.right===a){var p=d.left;if(!p||p._color!==m){if(d._color=m,d.right=h.left,h._color=v,h.left=d,l[f-2]=h,l[f-1]=a,o(d),o(h),f>=3){var g=l[f-3];g.right===d?g.right=h:g.left=h}break}h._color=v,d.left=i(v,p),d._color=m,f-=1}else{var p=d.left;if(!p||p._color!==m){if(h.left=a.right,d._color=m,d.right=a.left,a._color=v,a.right=h,a.left=d,l[f-2]=a,l[f-1]=h,o(d),o(h),o(a),f>=3){var g=l[f-3];g.right===d?g.right=a:g.left=a}break}h._color=v,d.left=i(v,p),d._color=m,f-=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 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(t<0)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=[],a=0;r;){var i=e(t,r.key);n.push(r),i<=0&&(a=n.length),r=i<=0?r.left:r.right}return n.length=a,new f(this,n)},y.gt=function(t){for(var e=this._compare,r=this.root,n=[],a=0;r;){var i=e(t,r.key);n.push(r),i<0&&(a=n.length),r=i<0?r.left:r.right}return n.length=a,new f(this,n)},y.lt=function(t){for(var e=this._compare,r=this.root,n=[],a=0;r;){var i=e(t,r.key);n.push(r),i>0&&(a=n.length),r=i<=0?r.left:r.right}return n.length=a,new f(this,n)},y.le=function(t){for(var e=this._compare,r=this.root,n=[],a=0;r;){var i=e(t,r.key);n.push(r),i>=0&&(a=n.length),r=i<0?r.left:r.right}return n.length=a,new f(this,n)},y.find=function(t){for(var e=this._compare,r=this.root,n=[];r;){var a=e(t,r.key);if(n.push(r),0===a)return new f(this,n);r=a<=0?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=n<=0?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 a=t.length-2;a>=0;--a){var r=t[a];r.left===t[a+1]?e[a]=new n(r._color,r.key,r.value,e[a+1],r.right,r._count):e[a]=new n(r._color,r.key,r.value,r.left,e[a+1],r._count)}if(r=e[e.length-1],r.left&&r.right){var i=e.length;for(r=r.left;r.right;)e.push(r),r=r.right;var o=e[i-1];e.push(new n(r._color,o.key,o.value,r.left,r.right,r._count)),e[i-1].key=r.key,e[i-1].value=r.value;for(var a=e.length-2;a>=i;--a)r=e[a],e[a]=new n(r._color,r.key,r.value,r.left,e[a+1],r._count);e[i-1].left=e[i]}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 a=0;a0)return this._stack[this._stack.length-1].key},enumerable:!0}),Object.defineProperty(b,"value",{get:function(){if(this._stack.length>0)return this._stack[this._stack.length-1].value},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),a=e[e.length-1];r[r.length-1]=new n(a._color,a.key,t,a.left,a.right,a._count);for(var i=e.length-2;i>=0;--i)a=e[i],a.left===e[i+1]?r[i]=new n(a._color,a.key,a.value,r[i+1],a.right,a._count):r[i]=new n(a._color,a.key,a.value,a.left,r[i+1],a._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}})},{}],71:[function(t,e,r){function n(t){if(t<0)return Number("0/0");for(var e=o[0],r=o.length-1;r>0;--r)e+=o[r]/(t+r);var n=t+i+.5;return.5*Math.log(2*Math.PI)+(t+.5)*Math.log(n)-n+Math.log(e)-Math.log(t)}var a=[.9999999999998099,676.5203681218851,-1259.1392167224028,771.3234287776531,-176.6150291621406,12.507343278686905,-.13857109526572012,9984369578019572e-21,1.5056327351493116e-7],i=607/128,o=[.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 t(e){if(e<.5)return Math.PI/(Math.sin(Math.PI*e)*t(1-e));if(e>100)return Math.exp(n(e));e-=1;for(var r=a[0],i=1;i<9;i++)r+=a[i]/(e+i);var o=e+7+.5;return Math.sqrt(2*Math.PI)*Math.pow(o,e+.5)*Math.exp(-o)*r},e.exports.log=n},{}],72:[function(t,e,r){function n(t,e){if("string"!=typeof t)throw new TypeError("must specify type string");if(e=e||{},"undefined"==typeof document&&!e.canvas)return null;var r=e.canvas||document.createElement("canvas");"number"==typeof e.width&&(r.width=e.width),"number"==typeof e.height&&(r.height=e.height);var n,a=e;try{var i=[t];0===t.indexOf("webgl")&&i.push("experimental-"+t);for(var o=0;or)throw new Error("gl-buffer: If resizing buffer, must not specify offset");return t.bufferSubData(e,i,a),r}function i(t,e){for(var r=l.malloc(t.length,e),n=t.length,a=0;a=0;--n){if(e[n]!==r)return!1;r*=t[n]}return!0}function s(t,e,r,a){if(r=r||t.ARRAY_BUFFER,a=a||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(a!==t.DYNAMIC_DRAW&&a!==t.STATIC_DRAW&&a!==t.STREAM_DRAW)throw new Error("gl-buffer: Invalid usage for buffer, must be either gl.DYNAMIC_DRAW, gl.STATIC_DRAW or gl.STREAM_DRAW");var i=t.createBuffer(),o=new n(t,r,i,0,a);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&&void 0!==t.shape){var r=t.dtype;if(f.indexOf(r)<0&&(r="float32"),this.type===this.gl.ELEMENT_ARRAY_BUFFER){r=gl.getExtension("OES_element_index_uint")&&"uint16"!==r?"uint32":"uint16"}if(r===t.dtype&&o(t.shape,t.stride))0===t.offset&&t.data.length===t.shape[0]?this.length=a(this.gl,this.type,this.length,this.usage,t.data,e):this.length=a(this.gl,this.type,this.length,this.usage,t.data.subarray(t.offset,t.shape[0]),e);else{var n=l.malloc(t.size,r),s=c(n,t.shape);u.assign(s,t),this.length=e<0?a(this.gl,this.type,this.length,this.usage,n,e):a(this.gl,this.type,this.length,this.usage,n.subarray(0,t.size),e),l.free(n)}}else if(Array.isArray(t)){var h;h=this.type===this.gl.ELEMENT_ARRAY_BUFFER?i(t,"uint16"):i(t,"float32"),this.length=e<0?a(this.gl,this.type,this.length,this.usage,h,e):a(this.gl,this.type,this.length,this.usage,h.subarray(0,t.length),e),l.free(h)}else if("object"==typeof t&&"number"==typeof t.length)this.length=a(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=1),this.gl.bufferData(this.type,0|t,this.usage),this.length=t}},e.exports=s},{ndarray:163,"ndarray-ops":162,"typedarray-pool":205}],74:[function(t,e,r){e.exports={0:"NONE",1:"ONE",2:"LINE_LOOP",3:"LINE_STRIP",4:"TRIANGLES",5:"TRIANGLE_STRIP",6:"TRIANGLE_FAN",256:"DEPTH_BUFFER_BIT",512:"NEVER",513:"LESS",514:"EQUAL",515:"LEQUAL",516:"GREATER",517:"NOTEQUAL",518:"GEQUAL",519:"ALWAYS",768:"SRC_COLOR",769:"ONE_MINUS_SRC_COLOR",770:"SRC_ALPHA",771:"ONE_MINUS_SRC_ALPHA",772:"DST_ALPHA",773:"ONE_MINUS_DST_ALPHA",774:"DST_COLOR",775:"ONE_MINUS_DST_COLOR",776:"SRC_ALPHA_SATURATE",1024:"STENCIL_BUFFER_BIT",1028:"FRONT",1029:"BACK",1032:"FRONT_AND_BACK",1280:"INVALID_ENUM",1281:"INVALID_VALUE",1282:"INVALID_OPERATION",1285:"OUT_OF_MEMORY",1286:"INVALID_FRAMEBUFFER_OPERATION",2304:"CW",2305:"CCW",2849:"LINE_WIDTH",2884:"CULL_FACE",2885:"CULL_FACE_MODE",2886:"FRONT_FACE",2928:"DEPTH_RANGE",2929:"DEPTH_TEST",2930:"DEPTH_WRITEMASK",2931:"DEPTH_CLEAR_VALUE",2932:"DEPTH_FUNC",2960:"STENCIL_TEST",2961:"STENCIL_CLEAR_VALUE",2962:"STENCIL_FUNC",2963:"STENCIL_VALUE_MASK",2964:"STENCIL_FAIL",2965:"STENCIL_PASS_DEPTH_FAIL",2966:"STENCIL_PASS_DEPTH_PASS",2967:"STENCIL_REF",2968:"STENCIL_WRITEMASK",2978:"VIEWPORT",3024:"DITHER",3042:"BLEND",3088:"SCISSOR_BOX",3089:"SCISSOR_TEST",3106:"COLOR_CLEAR_VALUE",3107:"COLOR_WRITEMASK",3317:"UNPACK_ALIGNMENT",3333:"PACK_ALIGNMENT",3379:"MAX_TEXTURE_SIZE",3386:"MAX_VIEWPORT_DIMS",3408:"SUBPIXEL_BITS",3410:"RED_BITS",3411:"GREEN_BITS",3412:"BLUE_BITS",3413:"ALPHA_BITS",3414:"DEPTH_BITS",3415:"STENCIL_BITS",3553:"TEXTURE_2D",4352:"DONT_CARE",4353:"FASTEST",4354:"NICEST",5120:"BYTE",5121:"UNSIGNED_BYTE",5122:"SHORT",5123:"UNSIGNED_SHORT",5124:"INT",5125:"UNSIGNED_INT",5126:"FLOAT",5386:"INVERT",5890:"TEXTURE",6401:"STENCIL_INDEX",6402:"DEPTH_COMPONENT",6406:"ALPHA",6407:"RGB",6408:"RGBA",6409:"LUMINANCE",6410:"LUMINANCE_ALPHA",7680:"KEEP",7681:"REPLACE",7682:"INCR",7683:"DECR",7936:"VENDOR",7937:"RENDERER",7938:"VERSION",9728:"NEAREST",9729:"LINEAR",9984:"NEAREST_MIPMAP_NEAREST",9985:"LINEAR_MIPMAP_NEAREST",9986:"NEAREST_MIPMAP_LINEAR",9987:"LINEAR_MIPMAP_LINEAR",10240:"TEXTURE_MAG_FILTER",10241:"TEXTURE_MIN_FILTER",10242:"TEXTURE_WRAP_S",10243:"TEXTURE_WRAP_T",10497:"REPEAT",10752:"POLYGON_OFFSET_UNITS",16384:"COLOR_BUFFER_BIT",32769:"CONSTANT_COLOR",32770:"ONE_MINUS_CONSTANT_COLOR",32771:"CONSTANT_ALPHA",32772:"ONE_MINUS_CONSTANT_ALPHA",32773:"BLEND_COLOR",32774:"FUNC_ADD",32777:"BLEND_EQUATION_RGB",32778:"FUNC_SUBTRACT",32779:"FUNC_REVERSE_SUBTRACT",32819:"UNSIGNED_SHORT_4_4_4_4",32820:"UNSIGNED_SHORT_5_5_5_1",32823:"POLYGON_OFFSET_FILL",32824:"POLYGON_OFFSET_FACTOR",32854:"RGBA4",32855:"RGB5_A1",32873:"TEXTURE_BINDING_2D",32926:"SAMPLE_ALPHA_TO_COVERAGE",32928:"SAMPLE_COVERAGE",32936:"SAMPLE_BUFFERS",32937:"SAMPLES",32938:"SAMPLE_COVERAGE_VALUE",32939:"SAMPLE_COVERAGE_INVERT",32968:"BLEND_DST_RGB",32969:"BLEND_SRC_RGB",32970:"BLEND_DST_ALPHA",32971:"BLEND_SRC_ALPHA",33071:"CLAMP_TO_EDGE",33170:"GENERATE_MIPMAP_HINT",33189:"DEPTH_COMPONENT16",33306:"DEPTH_STENCIL_ATTACHMENT",33635:"UNSIGNED_SHORT_5_6_5",33648:"MIRRORED_REPEAT",33901:"ALIASED_POINT_SIZE_RANGE",33902:"ALIASED_LINE_WIDTH_RANGE",33984:"TEXTURE0",33985:"TEXTURE1",33986:"TEXTURE2",33987:"TEXTURE3",33988:"TEXTURE4",33989:"TEXTURE5",33990:"TEXTURE6",33991:"TEXTURE7",33992:"TEXTURE8",33993:"TEXTURE9",33994:"TEXTURE10",33995:"TEXTURE11",33996:"TEXTURE12",33997:"TEXTURE13",33998:"TEXTURE14",33999:"TEXTURE15",34e3:"TEXTURE16",34001:"TEXTURE17",34002:"TEXTURE18",34003:"TEXTURE19",34004:"TEXTURE20",34005:"TEXTURE21",34006:"TEXTURE22",34007:"TEXTURE23",34008:"TEXTURE24",34009:"TEXTURE25",34010:"TEXTURE26",34011:"TEXTURE27",34012:"TEXTURE28",34013:"TEXTURE29",34014:"TEXTURE30",34015:"TEXTURE31",34016:"ACTIVE_TEXTURE",34024:"MAX_RENDERBUFFER_SIZE",34041:"DEPTH_STENCIL",34055:"INCR_WRAP",34056:"DECR_WRAP",34067:"TEXTURE_CUBE_MAP",34068:"TEXTURE_BINDING_CUBE_MAP",34069:"TEXTURE_CUBE_MAP_POSITIVE_X",34070:"TEXTURE_CUBE_MAP_NEGATIVE_X",34071:"TEXTURE_CUBE_MAP_POSITIVE_Y",34072:"TEXTURE_CUBE_MAP_NEGATIVE_Y",34073:"TEXTURE_CUBE_MAP_POSITIVE_Z",34074:"TEXTURE_CUBE_MAP_NEGATIVE_Z",34076:"MAX_CUBE_MAP_TEXTURE_SIZE",34338:"VERTEX_ATTRIB_ARRAY_ENABLED",34339:"VERTEX_ATTRIB_ARRAY_SIZE",34340:"VERTEX_ATTRIB_ARRAY_STRIDE",34341:"VERTEX_ATTRIB_ARRAY_TYPE",34342:"CURRENT_VERTEX_ATTRIB",34373:"VERTEX_ATTRIB_ARRAY_POINTER",34466:"NUM_COMPRESSED_TEXTURE_FORMATS",34467:"COMPRESSED_TEXTURE_FORMATS",34660:"BUFFER_SIZE",34661:"BUFFER_USAGE",34816:"STENCIL_BACK_FUNC",34817:"STENCIL_BACK_FAIL",34818:"STENCIL_BACK_PASS_DEPTH_FAIL",34819:"STENCIL_BACK_PASS_DEPTH_PASS",34877:"BLEND_EQUATION_ALPHA",34921:"MAX_VERTEX_ATTRIBS",34922:"VERTEX_ATTRIB_ARRAY_NORMALIZED",34930:"MAX_TEXTURE_IMAGE_UNITS",34962:"ARRAY_BUFFER",34963:"ELEMENT_ARRAY_BUFFER",34964:"ARRAY_BUFFER_BINDING",34965:"ELEMENT_ARRAY_BUFFER_BINDING",34975:"VERTEX_ATTRIB_ARRAY_BUFFER_BINDING",35040:"STREAM_DRAW",35044:"STATIC_DRAW",35048:"DYNAMIC_DRAW",35632:"FRAGMENT_SHADER",35633:"VERTEX_SHADER",35660:"MAX_VERTEX_TEXTURE_IMAGE_UNITS",35661:"MAX_COMBINED_TEXTURE_IMAGE_UNITS",35663:"SHADER_TYPE",35664:"FLOAT_VEC2",35665:"FLOAT_VEC3",35666:"FLOAT_VEC4",35667:"INT_VEC2",35668:"INT_VEC3",35669:"INT_VEC4",35670:"BOOL",35671:"BOOL_VEC2",35672:"BOOL_VEC3",35673:"BOOL_VEC4",35674:"FLOAT_MAT2",35675:"FLOAT_MAT3",35676:"FLOAT_MAT4",35678:"SAMPLER_2D",35680:"SAMPLER_CUBE",35712:"DELETE_STATUS",35713:"COMPILE_STATUS",35714:"LINK_STATUS",35715:"VALIDATE_STATUS",35716:"INFO_LOG_LENGTH",35717:"ATTACHED_SHADERS",35718:"ACTIVE_UNIFORMS",35719:"ACTIVE_UNIFORM_MAX_LENGTH",35720:"SHADER_SOURCE_LENGTH",35721:"ACTIVE_ATTRIBUTES",35722:"ACTIVE_ATTRIBUTE_MAX_LENGTH",35724:"SHADING_LANGUAGE_VERSION",35725:"CURRENT_PROGRAM",36003:"STENCIL_BACK_REF",36004:"STENCIL_BACK_VALUE_MASK",36005:"STENCIL_BACK_WRITEMASK",36006:"FRAMEBUFFER_BINDING",36007:"RENDERBUFFER_BINDING",36048:"FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE",36049:"FRAMEBUFFER_ATTACHMENT_OBJECT_NAME",36050:"FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL",36051:"FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE",36053:"FRAMEBUFFER_COMPLETE",36054:"FRAMEBUFFER_INCOMPLETE_ATTACHMENT",36055:"FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT",36057:"FRAMEBUFFER_INCOMPLETE_DIMENSIONS",36061:"FRAMEBUFFER_UNSUPPORTED",36064:"COLOR_ATTACHMENT0",36096:"DEPTH_ATTACHMENT",36128:"STENCIL_ATTACHMENT",36160:"FRAMEBUFFER",36161:"RENDERBUFFER",36162:"RENDERBUFFER_WIDTH",36163:"RENDERBUFFER_HEIGHT",36164:"RENDERBUFFER_INTERNAL_FORMAT",36168:"STENCIL_INDEX8",36176:"RENDERBUFFER_RED_SIZE",36177:"RENDERBUFFER_GREEN_SIZE",36178:"RENDERBUFFER_BLUE_SIZE",36179:"RENDERBUFFER_ALPHA_SIZE",36180:"RENDERBUFFER_DEPTH_SIZE",36181:"RENDERBUFFER_STENCIL_SIZE",36194:"RGB565",36336:"LOW_FLOAT",36337:"MEDIUM_FLOAT",36338:"HIGH_FLOAT",36339:"LOW_INT",36340:"MEDIUM_INT",36341:"HIGH_INT",36346:"SHADER_COMPILER",36347:"MAX_VERTEX_UNIFORM_VECTORS",36348:"MAX_VARYING_VECTORS",36349:"MAX_FRAGMENT_UNIFORM_VECTORS",37440:"UNPACK_FLIP_Y_WEBGL",37441:"UNPACK_PREMULTIPLY_ALPHA_WEBGL",37442:"CONTEXT_LOST_WEBGL",37443:"UNPACK_COLORSPACE_CONVERSION_WEBGL",37444:"BROWSER_DEFAULT_WEBGL"}},{}],75:[function(t,e,r){var n=t("./1.0/numbers");e.exports=function(t){return n[t]}},{"./1.0/numbers":74}],76:[function(t,e,r){"use strict";function n(t,e,r,n,a,i,o,s){this.plot=t,this.shader=e,this.fillShader=r,this.positionBuffer=n,this.colorBuffer=a,this.idBuffer=i,this.fillPositionBuffer=o,this.fillColorBuffer=s,this.fillVerts=0,this.shape=[0,0],this.bounds=[1/0,1/0,-1/0,-1/0],this.numVertices=0,this.lineWidth=1}function a(t,e){var r=Math.floor(e);if(r<0)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 i(t,e){var r=t.gl,a=s(r,p.vertex,p.fragment),i=s(r,p.fillVertex,p.fragment),o=l(r),u=l(r),c=l(r),f=l(r),h=l(r),d=new n(t,a,i,o,u,c,f,h);return d.update(e),t.addObject(d),d}e.exports=i;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,m=[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,a=this.plot,i=this.shader,o=this.fillShader,s=this.bounds,l=this.numVertices,u=this.fillVerts,c=a.gl,f=a.viewBox,h=a.dataBox,d=s[2]-s[0],p=s[3]-s[1],g=h[2]-h[0],m=h[3]-h[1];if(t[0]=2*d/g,t[4]=2*p/m,t[6]=2*(s[0]-h[0])/g-1,t[7]=2*(s[1]-h[1])/m-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=i.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){i.bind();var v=this.lineWidth*a.pixelRatio;r=i.uniforms,r.viewTransform=t,r.screenShape=e,r.lineWidth=v,r.pointSize=1e3,n=i.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=v,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 a=n-r;return Math.abs(a)<1e-6?e:Math.floor(e)+Math.max(.001,Math.min(.999,(t-r)/a))}t=t||{};var r=t.shape||[0,0],n=t.x||o(r[0]),i=t.y||o(r[1]),s=t.z||new Float32Array(r[0]*r[1]),l=t.levels||[],p=t.levelColors||[],g=this.bounds,v=g[0]=n[0],y=g[1]=i[0],b=g[2]=n[n.length-1],x=g[3]=i[i.length-1];v===b&&(g[2]+=1,b+=1),y===x&&(g[3]+=1,x+=1);var _=1/(b-v),w=1/(x-y);this.lineWidth=t.lineWidth||1;for(var A=u(s,r),k=[],M=[],T=[],E=[],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 O=c(A,C),I=255*p[4*S]|0,R=255*p[4*S+1]|0,D=255*p[4*S+2]|0,P=255*p[4*S+3]|0,z=O.cells,N=O.positions,F=Array(N.length),B=0;B1)){var V,G=U[0],q=U[1],X=A.get(Math.floor(G),Math.floor(q)),Y=A.get(Math.floor(G),Math.ceil(q)),W=A.get(Math.ceil(G),Math.floor(q)),Z=A.get(Math.ceil(G),Math.ceil(q));0===Math.floor(U[0])&&X<=C!=Y>1;for(e=0;e0&&(T*=_),E<0?E*=w:E>0&&(E*=A),m[b++]=h*(r-p+T),m[b++]=d*(n-g+E),m[b++]=o*M[2]+(l+o)*M[4],m[b++]=o*M[3]+(l+o)*M[5]}}for(e=0;e1&&h.drawBuffersWEBGL(y[f]);var v=r.getExtension("WEBGL_depth_texture");v?d?t.depth=s(r,u,c,v.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;ms||r<0||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(i),u=0;uo||r<0||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)throw new Error("gl-fbo: Must specify a nonnegative number of colors");if(s>1){if(!a)throw new Error("gl-fbo: Multiple draw buffer extension not supported");if(s>t.getParameter(a.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,a)}var d=t("gl-texture2d");e.exports=h;var p,g,m,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 f(this,e,r),[e,r]},enumerable:!1},width:{get:function(){return this._destroyed?0:this._shape[0]},set:function(t){return t|=0,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,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;e>8*d&255;this.pickOffset=r,a.bind();var p=a.uniforms;p.viewTransform=t,p.pickOffset=e,p.shape=this.shape;var g=a.attributes;return this.positionBuffer.bind(),g.position.pointer(),this.weightBuffer.bind(),g.weight.pointer(s.UNSIGNED_BYTE,!1),this.idBuffer.bind(),g.pickId.pointer(s.UNSIGNED_BYTE,!1),s.drawArrays(s.TRIANGLES,0,o),r+this.shape[0]*this.shape[1]}}}(),f.pick=function(t,e,r){var n=this.pickOffset,a=this.shape[0]*this.shape[1];if(r=n+a)return null;var i=r-n,o=this.xData,s=this.yData;return{object:this,pointId:i,dataCoord:[o[i%this.shape[0]],s[i/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]),a=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],m=f[3]=n[n.length-1],v=1/(g-d),y=1/(m-p),b=e[0],x=e[1];this.shape=[b,x];var _=(b-1)*(x-1)*(h.length>>>1);this.numVertices=_;for(var w=s.mallocUint8(4*_),A=s.mallocFloat32(2*_),k=s.mallocUint8(2*_),M=s.mallocUint32(_),T=0,E=0;E2&&!this.usingDashes){var b=this.mitreShader;this.lineBufferLo.bind(),b.attributes.aLo.pointer(l.FLOAT,!1,48,0),this.lineBufferHi.bind(),b.bind();var x=b.uniforms;this.setProjectionUniforms(x,i),x.color=c,x.radius=s*u,b.attributes.aHi.pointer(l.FLOAT,!1,48,0),l.drawArrays(l.POINTS,0,a/3|0)}}}}(),h.drawPick=function(){var t=[0,0,0,0];return function(e){var r=this.vertCount,n=this.numPoints;if(this.pickOffset=e,!r)return e+n;var a=this.setProjectionModel(),i=this.plot,o=this.width,s=i.gl,l=i.pickPixelRatio,u=this.pickShader,c=this.pickBuffer;t[0]=255&e,t[1]=e>>>8&255,t[2]=e>>>16&255,t[3]=e>>>24,u.bind();var f=u.uniforms;this.setProjectionUniforms(f,a),f.width=o*l,f.pickOffset=t;var h=u.attributes;return this.lineBufferHi.bind(),h.aHi.pointer(s.FLOAT,!1,16,0),h.dHi.pointer(s.FLOAT,!1,16,8),this.lineBufferLo.bind(),h.aLo.pointer(s.FLOAT,!1,16,0),c.bind(),h.pick0.pointer(s.UNSIGNED_BYTE,!1,8,0),h.pick1.pointer(s.UNSIGNED_BYTE,!1,8,4),s.drawArrays(s.TRIANGLES,0,r),e+n}}(),h.pick=function(t,e,r){var n=this.pickOffset,a=this.numPoints;if(r=n+a)return null;var i=r-n,o=this.data;return{object:this,pointId:i,dataCoord:[o[2*i],o[2*i+1]]}},h.update=function(t){t=t||{};var e,r,n,i,o,s=this.plot.gl;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=a(t.fillColor||[[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]]);var f=t.dashes||[1],h=0;for(e=0;e1,this.dashPattern=l(s,u(d,[h,1,4],[1,0,0])),this.dashPattern.minFilter=s.NEAREST,this.dashPattern.magFilter=s.NEAREST,this.dashLength=h,c.free(d);var g=t.positions;this.data=g;var m=this.bounds;m[0]=m[1]=1/0,m[2]=m[3]=-1/0;var v=this.numPoints=g.length>>>1;if(0!==v){for(e=0;e1;){var M=--n;i=g[2*n],o=g[2*n+1];var T=M-1,E=g[2*T],L=g[2*T+1];if(!(isNaN(i)||isNaN(o)||isNaN(E)||isNaN(L))){k+=1,i=(i-m[0])/(m[2]-m[0]),o=(o-m[1])/(m[3]-m[1]),E=(E-m[0])/(m[2]-m[0]),L=(L-m[1])/(m[3]-m[1]);var S=E-i,C=L-o,O=M|1<<24,I=M-1,R=M,D=M-1|1<<24;y[--w]=-C,y[--w]=-S,y[--w]=o,y[--w]=i,_[--A]=O,_[--A]=I,y[--w]=C,y[--w]=S,y[--w]=L,y[--w]=E,_[--A]=R,_[--A]=D,y[--w]=-C,y[--w]=-S,y[--w]=L,y[--w]=E,_[--A]=R,_[--A]=D,y[--w]=C,y[--w]=S,y[--w]=L,y[--w]=E,_[--A]=R,_[--A]=D,y[--w]=-C,y[--w]=-S,y[--w]=o,y[--w]=i,_[--A]=O,_[--A]=I,y[--w]=C,y[--w]=S,y[--w]=o,y[--w]=i,_[--A]=O,_[--A]=I}}for(e=0;es[k]&&(i.uniforms.dataAxis=t,i.uniforms.screenOffset=e,i.uniforms.color=m[n],i.uniforms.angle=v[n],u.drawArrays(u.TRIANGLES,s[k],s[M]-s[k]))),y[n]&&A&&(e[1^n]-=T*d*b[n],i.uniforms.dataAxis=r,i.uniforms.screenOffset=e,i.uniforms.color=x[n],i.uniforms.angle=_[n],u.drawArrays(u.TRIANGLES,w,A)),e[1^n]=T*c[2+(1^n)]-1,p[n+2]&&(e[1^n]+=T*d*g[n+2],ks[k]&&(i.uniforms.dataAxis=t,i.uniforms.screenOffset=e,i.uniforms.color=m[n+2],i.uniforms.angle=v[n+2],u.drawArrays(u.TRIANGLES,s[k],s[M]-s[k]))),y[n+2]&&A&&(e[1^n]+=T*d*b[n+2],i.uniforms.dataAxis=r,i.uniforms.screenOffset=e,i.uniforms.color=x[n+2],i.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,a=r.gl,i=r.screenBox,o=r.titleCenter,s=r.titleAngle,l=r.titleColor,u=r.pixelRatio;if(this.titleCount){for(var c=0;c<2;++c)e[c]=2*(o[c]*u-i[c])/(i[2+c]-i[c])-1;n.bind(),n.uniforms.dataAxis=t,n.uniforms.screenOffset=e,n.uniforms.angle=s,n.uniforms.color=l,a.drawArrays(a.TRIANGLES,this.titleOffset,this.titleCount)}}}(),c.bind=function(){var t=[0,0],e=[0,0],r=[0,0];return function(){var n=this.plot,a=this.shader,i=n._tickBounds,o=n.dataBox,s=n.screenBox,l=n.viewBox;a.bind();for(var u=0;u<2;++u){var c=i[u],f=i[u+2],h=f-c,d=.5*(o[u+2]+o[u]),p=o[u+2]-o[u],g=l[u],m=l[u+2],v=m-g,y=s[u],b=s[u+2],x=b-y;e[u]=2*h/p*v/x,t[u]=2*(c-d)/p*v/x}r[1]=2*n.pixelRatio/(s[3]-s[1]),r[0]=r[1]*(s[3]-s[1])/(s[2]-s[0]),a.uniforms.dataScale=e,a.uniforms.dataShift=t,a.uniforms.textScale=r,this.vbo.bind(),a.attributes.textCoordinate.pointer()}}(),c.update=function(t){var e,r,n,a,i,o=[],l=t.ticks,u=t.bounds;for(i=0;i<2;++i){var c=[Math.floor(o.length/3)],f=[-1/0],h=l[i];for(e=0;er)for(t=r;te)for(t=e;t=0){for(var k=0|A.type.charAt(A.type.length-1),M=new Array(k),T=0;T=0;)E+=1;w[b]=E}var L=new Array(r.length);i(),d._relink=i,d.types={uniforms:l(r),attributes:l(n)},d.attributes=s(p,d,x,w),Object.defineProperty(d,"uniforms",o(p,d,r,L))},e.exports=i},{"./lib/GLError":96,"./lib/create-attributes":97,"./lib/create-uniforms":98,"./lib/reflect":99,"./lib/runtime-reflect":100,"./lib/shader-cache":101}],96:[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},{}],97:[function(t,e,r){"use strict";function n(t,e,r,n,a,i){this._gl=t,this._wrapper=e,this._index=r,this._locations=n,this._dimension=a,this._constFunc=i}function a(t,e,r,a,i,o,s){for(var l=["gl","v"],u=[],c=0;c=0){var p=h.charCodeAt(h.length-1)-48;if(p<2||p>4)throw new s("","Invalid data type for attribute "+f+": "+h);a(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(p<2||p>4)throw new s("","Invalid data type for attribute "+f+": "+h);i(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 a=this,i=a._gl,o=a._locations[a._index];i.vertexAttribPointer(o,a._dimension,t||i.FLOAT,!!e,r||0,n||0),i.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":96}],98:[function(t,e,r){"use strict";function n(t){return new Function("y","return function(){return y}")(t)}function a(t,e){for(var r=new Array(t),n=0;n4)throw new s("","Invalid uniform dimension type for matrix "+name+": "+r);return"gl.uniformMatrix"+a+"fv(locations["+e+"],false,obj"+t+")"}throw new s("","Unknown uniform data type for "+name+": "+r)}var a=r.charCodeAt(r.length-1)-48;if(a<2||a>4)throw new s("","Invalid data type");switch(r.charAt(0)){case"b":case"i":return"gl.uniform"+a+"iv(locations["+e+"],obj"+t+")";case"v":return"gl.uniform"+a+"fv(locations["+e+"],obj"+t+")";default:throw new 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 a=e[n],i=t;parseInt(n)+""===n?i+="["+n+"]":i+="."+n,"object"==typeof a?r.push.apply(r,c(i,a)):r.push([i,a])}return r}function f(e){for(var n=["return function updateProperty(obj){"],a=c("",e),o=0;o4)throw new s("","Invalid data type");return"b"===t.charAt(0)?a(r,!1):a(r,0)}if(0===t.indexOf("mat")&&4===t.length){var r=t.charCodeAt(t.length-1)-48;if(r<2||r>4)throw new s("","Invalid uniform dimension type for matrix "+name+": "+t);return a(r*r,0)}throw new s("","Unknown uniform data type for "+name+": "+t)}}function d(t,e,a){if("object"==typeof a){var o=p(a);Object.defineProperty(t,e,{get:n(o),set:f(a),enumerable:!0,configurable:!1})}else i[a]?Object.defineProperty(t,e,{get:l(a),set:f(a),enumerable:!0,configurable:!1}):t[e]=h(r[a].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;u1)for(var l=0;l=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;p=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;r>>1;for(r=0;r=e[0]&&i<=e[2]&&o>=e[1]&&o<=e[3]&&n++}return n}function i(t,e){var r=t.gl,a=s(r),i=s(r),l=o(r,u.pointVertex,u.pointFragment),c=o(r,u.pickVertex,u.pickFragment),f=new n(t,a,i,l,c);return f.update(e),t.addObject(f),f}var o=t("gl-shader"),s=t("gl-buffer"),l=t("typedarray-pool"),u=t("./lib/shader");e.exports=i;var c=n.prototype;c.dispose=function(){this.shader.dispose(),this.pickShader.dispose(),this.offsetBuffer.dispose(),this.pickBuffer.dispose(),this.plot.removeObject(this)},c.update=function(t){function e(e,r){return e in t?t[e]:r}var r;t=t||{},this.sizeMin=e("sizeMin",.5),this.sizeMax=e("sizeMax",20),this.color=e("color",[1,0,0,1]).slice(),this.areaRatio=e("areaRatio",1),this.borderColor=e("borderColor",[0,0,0,1]).slice(),this.blend=e("blend",!1);var n=t.positions.length>>>1,a=t.positions instanceof Float32Array,i=t.idToIndex instanceof Int32Array&&t.idToIndex.length>=n,o=t.positions,s=a?o:l.mallocFloat32(o.length),u=i?t.idToIndex:l.mallocInt32(n);if(a||s.set(o),!i)for(s.set(o),r=0;r>8&255,e[2]=r>>16&255,e[3]=r>>24&255,this.pickBuffer.bind(),i.attributes.pickId.pointer(o.UNSIGNED_BYTE),i.uniforms.pickOffset=e,this.pickOffset=r);var h=o.getParameter(o.BLEND),d=o.getParameter(o.DITHER);return h&&!this.blend&&o.disable(o.BLEND),d&&o.disable(o.DITHER),o.drawArrays(o.POINTS,0,this.pointCount),h&&!this.blend&&o.enable(o.BLEND),d&&o.enable(o.DITHER),r+this.pointCount}}(),c.draw=c.unifiedDraw,c.drawPick=c.unifiedDraw,c.pick=function(t,e,r){var n=this.pickOffset,a=this.pointCount;if(r=n+a)return null;var i=r-n,o=this.points;return{object:this,pointId:i,dataCoord:[o[2*i],o[2*i+1]]}}},{"./lib/shader":103,"gl-buffer":73,"gl-shader":104,"typedarray-pool":205}],112:[function(t,e,r){"use strict";e.exports={ +vertex:"precision highp float;\n#define GLSLIFY 1\n\n\nvec4 computePosition_1_0(vec2 posHi, vec2 posLo, vec2 scHi, vec2 scLo, vec2 trHi, vec2 trLo) {\n return vec4((posHi + trHi) * scHi\n \t\t\t//FIXME: this thingy does not give noticeable precision gain, need test\n + (posLo + trLo) * scHi\n + (posHi + trHi) * scLo\n + (posLo + trLo) * scLo\n , 0, 1);\n}\n\n\nattribute vec2 positionHi, positionLo;\nattribute float size, border;\nattribute vec2 char, color;\n\n//this is 64-bit form of scale and translate\nuniform vec2 scaleHi, scaleLo, translateHi, translateLo;\nuniform float pixelRatio;\nuniform vec4 viewBox;\nuniform sampler2D palette;\n\nvarying vec4 charColor, borderColor;\nvarying vec2 charId;\nvarying vec2 pointCoord;\nvarying float pointSize;\nvarying float borderWidth;\n\n\nvoid main() {\n charColor = texture2D(palette, vec2(color.x / 255., 0));\n borderColor = texture2D(palette, vec2(color.y / 255., 0));\n\n gl_PointSize = size * pixelRatio;\n pointSize = size * pixelRatio;\n\n charId = char;\n borderWidth = border;\n\n gl_Position = computePosition_1_0(\n positionHi, positionLo,\n scaleHi, scaleLo,\n translateHi, translateLo);\n\n pointCoord = viewBox.xy + (viewBox.zw - viewBox.xy) * (gl_Position.xy * .5 + .5);\n}\n",fragment:"precision highp float;\n#define GLSLIFY 1\n\nuniform sampler2D chars;\nuniform vec2 charsShape;\nuniform float charsStep, pixelRatio, charOffset;\n\nvarying vec4 borderColor;\nvarying vec4 charColor;\nvarying vec2 charId;\nvarying vec2 pointCoord;\nvarying float pointSize;\nvarying float borderWidth;\n\nvoid main() {\n\tvec2 pointUV = (pointCoord - gl_FragCoord.xy + pointSize * .5) / pointSize;\n\tpointUV.x = 1. - pointUV.x;\n\tvec2 texCoord = ((charId + pointUV) * charsStep) / charsShape;\n\tfloat dist = texture2D(chars, texCoord).r;\n\n\t//max-distance alpha\n\tif (dist < 1e-2)\n\t\tdiscard;\n\n\tfloat gamma = .0045 * charsStep / pointSize;\n\n //null-border case\n \tif (borderWidth * borderColor.a == 0.) {\n\t\tfloat charAmt = smoothstep(.748 - gamma, .748 + gamma, dist);\n\t\tgl_FragColor = vec4(charColor.rgb, charAmt*charColor.a);\n\t\treturn;\n\t}\n\n\tfloat dif = 5. * pixelRatio * borderWidth / pointSize;\n\tfloat borderLevel = .748 - dif * .5;\n\tfloat charLevel = .748 + dif * .5;\n\n\tfloat borderAmt = smoothstep(borderLevel - gamma, borderLevel + gamma, dist);\n\tfloat charAmt = smoothstep(charLevel - gamma, charLevel + gamma, dist);\n\n\tvec4 color = borderColor;\n\tcolor.a *= borderAmt;\n\n\tgl_FragColor = mix(color, charColor, charAmt);\n}\n",pickVertex:"precision highp float;\n#define GLSLIFY 1\n\nattribute vec2 positionHi, positionLo;\nattribute vec4 id;\nattribute float size;\n\nuniform vec2 scaleHi, scaleLo, translateHi, translateLo;\nuniform vec4 pickOffset;\nuniform float pixelRatio;\n\nvarying vec4 fragColor;\n\n\nvec4 computePosition_1_0(vec2 posHi, vec2 posLo, vec2 scHi, vec2 scLo, vec2 trHi, vec2 trLo) {\n return vec4((posHi + trHi) * scHi\n \t\t\t//FIXME: this thingy does not give noticeable precision gain, need test\n + (posLo + trLo) * scHi\n + (posHi + trHi) * scLo\n + (posLo + trLo) * scLo\n , 0, 1);\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_PointSize = size * .25 * pixelRatio;\n\n gl_Position = computePosition_1_0(\n positionHi, positionLo,\n scaleHi, scaleLo,\n translateHi, translateLo);\n}\n",pickFragment:"precision lowp float;\n#define GLSLIFY 1\nvarying vec4 fragColor;\nvoid main() {\n gl_FragColor = fragColor;\n}\n"}},{}],113:[function(t,e,r){arguments[4][47][0].apply(r,arguments)},{dup:47}],114:[function(t,e,r){arguments[4][95][0].apply(r,arguments)},{"./lib/GLError":115,"./lib/create-attributes":116,"./lib/create-uniforms":117,"./lib/reflect":118,"./lib/runtime-reflect":119,"./lib/shader-cache":120,dup:95}],115:[function(t,e,r){arguments[4][96][0].apply(r,arguments)},{dup:96}],116:[function(t,e,r){arguments[4][97][0].apply(r,arguments)},{"./GLError":115,dup:97}],117:[function(t,e,r){arguments[4][98][0].apply(r,arguments)},{"./GLError":115,"./reflect":118,dup:98}],118:[function(t,e,r){arguments[4][99][0].apply(r,arguments)},{dup:99}],119:[function(t,e,r){arguments[4][100][0].apply(r,arguments)},{dup:100}],120:[function(t,e,r){arguments[4][101][0].apply(r,arguments)},{"./GLError":115,dup:101,"gl-format-compiler-error":82,"weakmap-shim":212}],121:[function(t,e,r){"use strict";function n(t,e,r,n,i){i<=4*h?a(0,i-1,t,e,r,n):f(0,i-1,t,e,r,n)}function a(t,e,r,n,a,i){for(var o=t+1;o<=e;++o){for(var s=r[o],l=n[2*o],u=n[2*o+1],c=a[o],f=i[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],a[h]=a[h-1],i[h]=i[h-1],h-=1}r[h]=s,n[2*h]=l,n[2*h+1]=u,a[h]=c,i[h]=f}}function i(t,e,r,n,a,i){var o=r[t],s=n[2*t],l=n[2*t+1],u=a[t],c=i[t];r[t]=r[e],n[2*t]=n[2*e],n[2*t+1]=n[2*e+1],a[t]=a[e],i[t]=i[e],r[e]=o,n[2*e]=s,n[2*e+1]=l,a[e]=u,i[e]=c}function o(t,e,r,n,a,i){r[t]=r[e],n[2*t]=n[2*e],n[2*t+1]=n[2*e+1],a[t]=a[e],i[t]=i[e]}function s(t,e,r,n,a,i,o){var s=n[t],l=a[2*t],u=a[2*t+1],c=i[t],f=o[t];n[t]=n[e],a[2*t]=a[2*e],a[2*t+1]=a[2*e+1],i[t]=i[e],o[t]=o[e],n[e]=n[r],a[2*e]=a[2*r],a[2*e+1]=a[2*r+1],i[e]=i[r],o[e]=o[r],n[r]=s,a[2*r]=l,a[2*r+1]=u,i[r]=c,o[r]=f}function l(t,e,r,n,a,i,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]=a,u[e]=i,c[e]=o}function u(t,e,r,n,a){return(r[t]-r[e]||n[2*e]-n[2*t]||a[t]-a[e])<0}function c(t,e,r,n,a,i,o,s){return(e-i[t]||o[2*t]-r||a-s[t])<0}function f(t,e,r,n,d,p){var g=(e-t+1)/6|0,m=t+g,v=e-g,y=t+e>>1,b=y-g,x=y+g,_=m,w=b,A=y,k=x,M=v,T=t+1,E=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],O=n[2*w+1],I=d[w],R=p[w],D=r[k],P=n[2*k],z=n[2*k+1],N=d[k],F=p[k],B=_,j=A,H=M,U=m,V=y,G=v,q=r[B],X=r[j],Y=r[H];r[U]=q,r[V]=X,r[G]=Y;for(var W=0;W<2;++W){var Z=n[2*B+W],Q=n[2*j+W],$=n[2*H+W];n[2*U+W]=Z,n[2*V+W]=Q,n[2*G+W]=$}var K=d[B],J=d[j],tt=d[H];d[U]=K,d[V]=J,d[G]=tt;var et=p[B],rt=p[j],nt=p[H];p[U]=et,p[V]=rt,p[G]=nt,o(b,t,r,n,d,p),o(x,e,r,n,d,p);for(var at=T;at<=E;++at)if(c(at,S,C,O,I,r,n,d))at!==T&&i(at,T,r,n,d,p),++T;else if(!c(at,D,P,z,N,r,n,d))for(;;){if(c(E,D,P,z,N,r,n,d)){c(E,S,C,O,I,r,n,d)?(s(at,T,E,r,n,d,p),++T,--E):(i(at,E,r,n,d,p),--E);break}if(--E=Math.max(.9*d,32)){var b=u+s>>>1;l(m,v,f,h,b,c+1),h=b}l(m,v,f,h,y,c+1),h=y}}}var u=t.length>>>1;if(u<1)return[];for(var c=1/0,f=1/0,h=-1/0,d=-1/0,p=0;p=0;--_){t[2*_]=(t[2*_]-c)*v,t[2*_+1]=(t[2*_+1]-f)*y;var M=x[_];M!==A&&(w.push(new a(b*Math.pow(.5,M),_+1,k-(_+1))),k=_+1,A=M)}return w.push(new a(b*Math.pow(.5,M+1),0,k)),o.free(x),w}var o=t("typedarray-pool"),s=t("./lib/sort");e.exports=i},{"./lib/sort":121,"typedarray-pool":205}],123:[function(t,e,r){"use strict";function n(t,e,r,n,a,i,o,s){this.plot=t,this.shader=e,this.pickShader=r,this.positionBuffer=n,this.sizeBuffer=a,this.colorBuffer=i,this.idBuffer=o,this.charBuffer=s,this.pointCount=0,this.pickOffset=0,this.points=null,this.scales=[],this.xCoords=[],this.charCanvas=document.createElement("canvas"),this.charTexture=g(this.plot.gl,this.charCanvas),this.charStep=400,this.charFit=.255,this.snapThreshold=1e4,this.paletteTexture=g(this.plot.gl,[256,1])}function a(){var t=this.plot,e=t.viewBox,r=t.dataBox,n=t.pixelRatio,a=r[2]-r[0],i=r[3]-r[1],u=2/a,c=2/i,f=-r[0]-.5*a,h=-r[1]-.5*i;_[0]=u,w[0]=u-_[0],_[1]=c,w[1]=c-_[1],A[0]=f,k[0]=f-A[0],A[1]=h,k[1]=h-A[1];var d=e[2]-e[0],p=e[3]-e[1];o=Math.min(a/d,i/p),M[0]=2*n/d,M[1]=2*n/p,s=r[0],l=r[2]}function i(t,e){var r=t.gl,a=u(r,h.vertex,h.fragment),i=u(r,h.pickVertex,h.pickFragment),o=c(r),s=c(r),l=c(r),f=c(r),d=c(r),p=new n(t,a,i,o,s,l,f,d);return p.update(e),t.addObject(p),p}e.exports=i;var o,s,l,u=t("gl-shader"),c=t("gl-buffer"),f=t("typedarray-pool"),h=t("./lib/shaders"),d=t("snap-points-2d"),p=t("font-atlas-sdf"),g=t("gl-texture2d"),m=t("color-id"),v=t("ndarray"),y=t("clamp"),b=t("binary-search-bounds"),x=n.prototype,_=new Float32Array([0,0]),w=new Float32Array([0,0]),A=new Float32Array([0,0]),k=new Float32Array([0,0]),M=[0,0],T=[0,0,0,0];x.drawPick=function(t){var e=void 0!==t,r=this.plot,n=this.pointCount,i=n>this.snapThreshold;if(!n)return t;a.call(this);var u=r.gl,c=e?this.pickShader:this.shader,f=u.isEnabled(u.BLEND);if(c.bind(),e){this.pickOffset=t;for(var h=0;h<4;++h)T[h]=t>>8*h&255;c.uniforms.pickOffset=T,this.idBuffer.bind(),c.attributes.id.pointer(u.UNSIGNED_BYTE,!1)}else u.blendFuncSeparate(u.SRC_ALPHA,u.ONE_MINUS_SRC_ALPHA,u.ONE,u.ONE_MINUS_SRC_ALPHA),u.blendColor(0,0,0,1),f||u.enable(u.BLEND),this.colorBuffer.bind(),c.attributes.color.pointer(u.UNSIGNED_BYTE,!1),this.charBuffer.bind(),c.attributes.char.pointer(u.UNSIGNED_BYTE,!1),c.uniforms.chars=this.charTexture.bind(0),c.uniforms.charsShape=[this.charCanvas.width,this.charCanvas.height],c.uniforms.charsStep=this.charStep,c.uniforms.palette=this.paletteTexture.bind(1);this.sizeBuffer.bind(),c.attributes.size.pointer(u.FLOAT,!1,8,0),e||c.attributes.border.pointer(u.FLOAT,!1,8,4),this.positionBuffer.bind(),c.attributes.positionHi.pointer(u.FLOAT,!1,16,0),c.attributes.positionLo.pointer(u.FLOAT,!1,16,8),c.uniforms.pixelRatio=r.pixelRatio,c.uniforms.scaleHi=_,c.uniforms.scaleLo=w,c.uniforms.translateHi=A,c.uniforms.translateLo=k,c.uniforms.viewBox=r.viewBox;var d=this.scales;if(i)for(var p=d.length-1;p>=0;p--){var g=d[p];if(!(g.pixelSize&&g.pixelSize<1.25*o&&p>1)){var m=g.offset,v=g.count+m,y=b.ge(this.xCoords,s,m,v-1),x=b.lt(this.xCoords,l,y,v-1)+1;x>y&&u.drawArrays(u.POINTS,y,x-y)}}else u.drawArrays(u.POINTS,0,n);if(e)return t+n;f?u.blendFunc(u.ONE,u.ONE_MINUS_SRC_ALPHA):u.disable(u.BLEND)},x.draw=x.drawPick,x.pick=function(t,e,r){var n=this.pickOffset,a=this.pointCount;if(r=n+a)return null;var i=r-n,o=this.points;return{object:this,pointId:i,dataCoord:[o[2*i],o[2*i+1]]}},x.update=function(t){t=t||{};var e=t.positions||[],r=t.colors||[],n=t.glyphs||[],a=t.sizes||[],i=t.borderWidths||[],o=t.borderColors||[],s=this.plot.gl,l=this.pointCount,u=l>this.snapThreshold;if(null!=t.positions){this.points=e,l=this.points.length/2,u=l>this.snapThreshold;var c=f.mallocFloat32(2*l),h=f.mallocFloat64(2*l),g=f.mallocUint32(l),b=f.mallocFloat32(4*l);h.set(this.points),u&&(this.i2idx&&f.free(this.i2idx),this.i2idx=f.mallocInt32(l),this.scales=d(h,this.i2idx,c)),this.pointCount=l;for(var x=0;xN&&(N=a[x]);var F=this.charStep;this.charStep=y(Math.ceil(4*N),128,768);var B=Object.keys(P),j=this.charStep,H=Math.floor(j/2),U=s.getParameter(s.MAX_TEXTURE_SIZE),V=U/j*(U/j),G=Math.min(U,j*B.length),q=Math.min(U,j*Math.ceil(j*B.length/U)),X=Math.floor(G/j);B.length>V&&console.warn("gl-scatter2d-fancy: number of characters is more than maximum texture size. Try reducing it."),this.chars&&this.chars+""==B+""&&this.charStep==F||(this.charCanvas=p({canvas:this.charCanvas,family:"sans-serif",size:H,shape:[G,q],step:[j,j],chars:B,align:!0,fit:this.charFit}),this.chars=B);for(var x=0;x>>1,n=u.mallocInt32(r),a=u.mallocFloat32(r),i=u.mallocFloat64(2*r);if(i.set(this.points),this.snapPoints)this.scales=l(i,n,a,this.bounds);else{this.bounds=h(i,2),f(i,2,this.bounds);for(var o=0;o>8&255,y[2]=t>>16&255,y[3]=t>>24&255,n.uniforms.pickOffset=y,s.bind(),n.attributes.pickId.pointer(f.UNSIGNED_BYTE)):(n.uniforms.useWeight=1,this.weightBuffer.bind(),n.attributes.weight.pointer());var O=!0;if(this.snapPoints)for(var I=a.length-1;I>=0;I--){var R=a[I];if(!(R.pixelSize1)){var D=this.getVisibleRange(R),P=D[0],z=D[1];z>P&&f.drawArrays(f.POINTS,P,z-P),!e&&O&&(O=!1,n.uniforms.useWeight=0)}}else f.drawArrays(f.POINTS,0,this.pointCount);return t+this.pointCount},d.getVisibleRange=function(t){var e=this.plot.dataBox,r=this.bounds,n=this.pixelSize,a=this.size,i=this.plot.pixelRatio,o=r[2]-r[0];r[3],r[1];if(!t)for(var t,l=this.scales.length-1;l>=0&&(t=this.scales[l],t.pixelSize1);l--);var u=this.xCoords,c=(e[0]-r[0]-n*a*i)/o,f=(e[2]-r[0]+n*a*i)/o,h=t.offset,d=t.count+h,p=s.ge(u,c,h,d-1);return[p,s.lt(u,f,p,d-1)+1]},d.drawPick=d.draw,d.pick=function(t,e,r){var n=r-this.pickOffset;return n<0||n>=this.pointCount?null:{object:this,pointId:n,dataCoord:[this.points[2*n],this.points[2*n+1]]}}},{"./lib/shader":124,"array-bounds":11,"array-normalize":12,"binary-search-bounds":125,"gl-buffer":73,"gl-shader":132,"snap-points-2d":127,"typedarray-pool":205}],129:[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"},{}],130:[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 a(t,e){var r=t.gl,a=o(r,[0,0,0,1,1,0,1,1]),l=i(r,s.boxVertex,s.boxFragment),u=new n(t,a,l);return u.update(e),t.addOverlay(u),u}var i=t("gl-shader"),o=t("gl-buffer"),s=t("./lib/shaders");e.exports=a;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),a=(this.outerFill,this.outerColor),i=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]),!(d0){var v=r*c;o.drawBox(f-v,h-v,d+v,h+v,i),o.drawBox(f-v,p-v,d+v,p+v,i),o.drawBox(f-v,h-v,f+v,p+v,i),o.drawBox(d-v,h-v,d+v,p+v,i)}}}},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":129,"gl-buffer":73,"gl-shader":132}],131:[function(t,e,r){"use strict";function n(t,e,r,n,a){this.coord=[t,e],this.id=r,this.value=n,this.distance=a}function a(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 i(t,e){return new a(t,o(t,e),s.mallocUint8(e[0]*e[1]*4))}e.exports=i;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(_inline_55_arg0_<255||_inline_55_arg1_<255||_inline_55_arg2_<255||_inline_55_arg3_<255){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)),a=0;a=0){for(var k=0|A.type.charAt(A.type.length-1),M=new Array(k),T=0;T=0;)E+=1;_[w]=E}var L=new Array(r.length);i(),d._relink=i,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=i},{"./lib/GLError":133,"./lib/create-attributes":134,"./lib/create-uniforms":135,"./lib/reflect":136,"./lib/runtime-reflect":137,"./lib/shader-cache":138}],133:[function(t,e,r){arguments[4][96][0].apply(r,arguments)},{dup:96}],134:[function(t,e,r){arguments[4][97][0].apply(r,arguments)},{"./GLError":133,dup:97}],135:[function(t,e,r){arguments[4][98][0].apply(r,arguments)},{"./GLError":133,"./reflect":136,dup:98}],136:[function(t,e,r){arguments[4][99][0].apply(r,arguments)},{dup:99}],137:[function(t,e,r){arguments[4][100][0].apply(r,arguments)},{dup:100}],138:[function(t,e,r){arguments[4][101][0].apply(r,arguments)},{"./GLError":133,dup:101,"gl-format-compiler-error":82,"weakmap-shim":212}],139:[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 a(t,e){var r=new n(t);return r.update(e),t.addOverlay(r),r}e.exports=a;var i=n.prototype;i.update=function(t){t=t||{},this.enable=(t.enable||[!0,!0,!1,!1]).slice(),this.width=(t.width||[1,1,1,1]).slice(),this.color=(t.color||[[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]]).map(function(t){return t.slice()}),this.center=(t.center||[1/0,1/0]).slice(),this.plot.setOverlayDirty()},i.draw=function(){var t=this.enable,e=this.width,r=this.color,n=this.center,a=this.plot,i=a.line,o=a.dataBox,s=a.viewBox;if(i.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]&&i.drawLine(l,u,s[0],u,e[0],r[0]),t[1]&&i.drawLine(l,u,l,s[1],e[1],r[1]),t[2]&&i.drawLine(l,u,s[2],u,e[2],r[2]),t[3]&&i.drawLine(l,u,l,s[3],e[3],r[3])}},i.dispose=function(){this.plot.removeOverlay(this)}},{}],140:[function(t,e,r){"use strict";function n(t){v=[t.LINEAR,t.NEAREST_MIPMAP_LINEAR,t.LINEAR_MIPMAP_NEAREST,t.LINEAR_MIPMAP_NEAREST],y=[t.NEAREST,t.LINEAR,t.NEAREST_MIPMAP_NEAREST,t.NEAREST_MIPMAP_LINEAR,t.LINEAR_MIPMAP_NEAREST,t.LINEAR_MIPMAP_LINEAR],b=[t.REPEAT,t.CLAMP_TO_EDGE,t.MIRRORED_REPEAT]}function a(t){return"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLVideoElement&&t instanceof HTMLVideoElement||"undefined"!=typeof ImageData&&t instanceof ImageData}function i(t,e,r){var n=t.gl,a=n.getParameter(n.MAX_TEXTURE_SIZE);if(e<0||e>a||r<0||r>a)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,a,i){this.gl=t,this.handle=e,this.format=a,this.type=i,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 s(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 l(t,e,r,n,a,i,o,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,d=s(c,l.stride.slice());"float32"===u?f=t.FLOAT:"float64"===u?(f=t.FLOAT,d=!1,u="float32"):"uint8"===u?f=t.UNSIGNED_BYTE:(f=t.UNSIGNED_BYTE,d=!1,u="uint8");if(2===c.length)h=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])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}c[2]}if(h!==t.LUMINANCE&&h!==t.ALPHA||a!==t.LUMINANCE&&a!==t.ALPHA||(h=a),h!==a)throw new Error("gl-texture2d: Incompatible texture format for setPixels");var v=l.size,y=o.indexOf(n)<0;if(y&&o.push(n),f===i&&d)0===l.offset&&l.data.length===v?y?t.texImage2D(t.TEXTURE_2D,n,a,c[0],c[1],0,a,i,l.data):t.texSubImage2D(t.TEXTURE_2D,n,e,r,c[0],c[1],a,i,l.data):y?t.texImage2D(t.TEXTURE_2D,n,a,c[0],c[1],0,a,i,l.data.subarray(l.offset,l.offset+v)):t.texSubImage2D(t.TEXTURE_2D,n,e,r,c[0],c[1],a,i,l.data.subarray(l.offset,l.offset+v));else{var b;b=i===t.FLOAT?m.mallocFloat32(v):m.mallocUint8(v);var _=p(b,c,[c[2],c[2]*c[0],1]);f===t.FLOAT&&i===t.UNSIGNED_BYTE?x(_,l):g.assign(_,l),y?t.texImage2D(t.TEXTURE_2D,n,a,c[0],c[1],0,a,i,b.subarray(0,v)):t.texSubImage2D(t.TEXTURE_2D,n,e,r,c[0],c[1],a,i,b.subarray(0,v)),i===t.FLOAT?m.freeFloat32(b):m.freeUint8(b)}}function u(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 c(t,e,r,n,a){var i=t.getParameter(t.MAX_TEXTURE_SIZE);if(e<0||e>i||r<0||r>i)throw new Error("gl-texture2d: Invalid texture shape");if(a===t.FLOAT&&!t.getExtension("OES_texture_float"))throw new Error("gl-texture2d: Floating point textures not supported on this platform");var s=u(t);return t.texImage2D(t.TEXTURE_2D,0,n,e,r,0,n,a,null),new o(t,s,e,r,n,a)}function f(t,e,r,n,a,i){var s=u(t);return t.texImage2D(t.TEXTURE_2D,0,a,a,i,e),new o(t,s,r,n,a,i)}function h(t,e){var r=e.dtype,n=e.shape.slice(),a=t.getParameter(t.MAX_TEXTURE_SIZE);if(n[0]<0||n[0]>a||n[1]<0||n[1]>a)throw new Error("gl-texture2d: Invalid texture size");var i=s(n,e.stride.slice()),l=0;"float32"===r?l=t.FLOAT:"float64"===r?(l=t.FLOAT,i=!1,r="float32"):"uint8"===r?l=t.UNSIGNED_BYTE:(l=t.UNSIGNED_BYTE,i=!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}}l!==t.FLOAT||t.getExtension("OES_texture_float")||(l=t.UNSIGNED_BYTE,i=!1);var f,h,d=e.size;if(i)f=0===e.offset&&e.data.length===d?e.data:e.data.subarray(e.offset,e.offset+d);else{var v=[n[2],n[2]*n[0],1];h=m.malloc(d,r);var y=p(h,n,v,0);"float32"!==r&&"float64"!==r||l!==t.UNSIGNED_BYTE?g.assign(y,e):x(y,e),f=h.subarray(0,d)}var b=u(t);return t.texImage2D(t.TEXTURE_2D,0,c,n[0],n[1],0,c,l,f),i||m.free(h),new o(t,b,n[0],n[1],c,l)}function d(t){if(arguments.length<=1)throw new Error("gl-texture2d: Missing arguments for texture2d constructor");if(v||n(t),"number"==typeof arguments[1])return c(t,arguments[1],arguments[2],arguments[3]||t.RGBA,arguments[4]||t.UNSIGNED_BYTE);if(Array.isArray(arguments[1]))return c(t,0|arguments[1][0],0|arguments[1][1],arguments[2]||t.RGBA,arguments[3]||t.UNSIGNED_BYTE);if("object"==typeof arguments[1]){var e=arguments[1],r=a(e)?e:e.raw;if(r)return f(t,r,0|e.width,0|e.height,arguments[2]||t.RGBA,arguments[3]||t.UNSIGNED_BYTE);if(e.shape&&e.data&&e.stride)return h(t,e)}throw new Error("gl-texture2d: Invalid arguments for texture2d constructor")}var p=t("ndarray"),g=t("ndarray-ops"),m=t("typedarray-pool");e.exports=d;var v=null,y=null,b=null,x=function(t,e){g.muls(t,e,255)},_=o.prototype;Object.defineProperties(_,{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)),y.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)),y.indexOf(t)<0)throw new Error("gl-texture2d: Unknown filter mode "+t);return e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,t),this._magFilter=t}},mipSamples:{get:function(){return this._anisoSamples},set:function(t){var e=this._anisoSamples;if(this._anisoSamples=0|Math.max(t,1),e!==this._anisoSamples){var r=this.gl.getExtension("EXT_texture_filter_anisotropic");r&&this.gl.texParameterf(this.gl.TEXTURE_2D,r.TEXTURE_MAX_ANISOTROPY_EXT,this._anisoSamples)}return this._anisoSamples}},wrapS:{get:function(){return this._wrapS},set:function(t){if(this.bind(),b.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(),b.indexOf(t)<0)throw new Error("gl-texture2d: Unknown wrap mode "+t);return this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,t),this._wrapT=t}},wrap:{get:function(){return this._wrapVector},set:function(t){if(Array.isArray(t)||(t=[t,t]),2!==t.length)throw new Error("gl-texture2d: Must specify wrap mode for rows and columns");for(var e=0;e<2;++e)if(b.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,i(this,t,this._shape[1]),t}},height:{get:function(){return this._shape[1]},set:function(t){return t|=0,i(this,this._shape[0],t),t}}}),_.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},_.dispose=function(){this.gl.deleteTexture(this.handle)},_.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)},_.setPixels=function(t,e,r,n){var i=this.gl;this.bind(),Array.isArray(e)?(n=r,r=0|e[1],e=0|e[0]):(e=e||0,r=r||0),n=n||0;var o=a(t)?t:t.raw;if(o){this._mipLevels.indexOf(n)<0?(i.texImage2D(i.TEXTURE_2D,0,this.format,this.format,this.type,o),this._mipLevels.push(n)):i.texSubImage2D(i.TEXTURE_2D,n,e,r,this.format,this.type,o)}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||e<0||r<0)throw new Error("gl-texture2d: Texture dimensions are out of bounds");l(i,e,r,n,this.format,this.type,this._mipLevels,t)}}},{ndarray:163,"ndarray-ops":162,"typedarray-pool":205}],141:[function(t,e,r){function n(t){for(var e=Array.isArray(t)?t:a(t),r=0;r0)continue;n=t.slice(0,1).join("")}return e(n),q+=n.length,H=H.slice(n.length),H.length}}function O(){return/[^a-fA-F0-9]/.test(P)?(e(H.join("")),j=u,F):(H.push(P),z=P,F+1)}function I(){return"."===P?(H.push(P),j=m,z=P,F+1):/[eE]/.test(P)?(H.push(P),j=m,z=P,F+1):"x"===P&&1===H.length&&"0"===H[0]?(j=w,H.push(P),z=P,F+1):/[^\d]/.test(P)?(e(H.join("")),j=u,F):(H.push(P),z=P,F+1)}function R(){return"f"===P&&(H.push(P),z=P,F+=1),/[eE]/.test(P)?(H.push(P),z=P,F+1):"-"===P&&/[eE]/.test(z)?(H.push(P),z=P,F+1):/[^\d]/.test(P)?(e(H.join("")),j=u,F):(H.push(P),z=P,F+1)}function D(){if(/[^\d\w_]/.test(P)){var t=H.join("");return j=Q.indexOf(t)>-1?b:Z.indexOf(t)>-1?y:v,e(H.join("")),j=u,F}return H.push(P),z=P,F+1}var P,z,N,F=0,B=0,j=u,H=[],U=[],V=1,G=0,q=0,X=!1,Y=!1,W="";t=t||{};var Z=o,Q=a;return"300 es"===t.version&&(Z=l,Q=s),function(t){return U=[],null!==t?r(t.replace?t.replace(/\r\n/g,"\n"):t):n()}}e.exports=n;var a=t("./lib/literals"),i=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,m=5,v=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":144,"./lib/builtins-300es":143,"./lib/literals":146,"./lib/literals-300es":145,"./lib/operators":147}],143:[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":144}],144:[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"]},{}],145:[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":146}],146:[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"]},{}],147:[function(t,e,r){e.exports=["<<=",">>=","++","--","<<",">>","<=",">=","==","!=","&&","||","+=","-=","*=","/=","%=","&=","^^","^=","|=","(",")","[","]",".","!","~","*","/","%","+","-","<",">","&","^","|","?",":","=",",",";","{","}"]},{}],148:[function(t,e,r){function n(t,e){var r=a(e),n=[];return n=n.concat(r(t)),n=n.concat(r(null))}var a=t("./index");e.exports=n},{"./index":142}],149:[function(t,e,r){(function(r){"use strict";var n,a=t("is-browser");n="function"==typeof r.matchMedia?!r.matchMedia("(hover: none)").matches:a,e.exports=n}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"is-browser":154}],150:[function(t,e,r){r.read=function(t,e,r,n,a){var i,o,s=8*a-n-1,l=(1<>1,c=-7,f=r?a-1:0,h=r?-1:1,d=t[e+f];for(f+=h,i=d&(1<<-c)-1,d>>=-c,c+=s;c>0;i=256*i+t[e+f],f+=h,c-=8);for(o=i&(1<<-c)-1,i>>=-c,c+=n;c>0;o=256*o+t[e+f],f+=h,c-=8);if(0===i)i=1-u;else{if(i===l)return o?NaN:1/0*(d?-1:1);o+=Math.pow(2,n),i-=u}return(d?-1:1)*o*Math.pow(2,i-n)},r.write=function(t,e,r,n,a,i){var o,s,l,u=8*i-a-1,c=(1<>1,h=23===a?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:i-1,p=n?1:-1,g=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,o=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,a),o+=f):(s=e*Math.pow(2,f-1)*Math.pow(2,a),o=0));a>=8;t[r+d]=255&s,d+=p,s/=256,a-=8);for(o=o<0;t[r+d]=255&o,d+=p,o/=256,u-=8);t[r+d-p]|=128*g}},{}],151:[function(t,e,r){"use strict";function n(t,e,r,n,a){this.mid=t,this.left=e,this.right=r,this.leftPoints=n,this.rightPoints=a,this.count=(e?e.count:0)+(r?r.count:0)+n.length}function a(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 i(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),i(t,r)}function s(t,e){var r=t.intervals([]),n=r.indexOf(e);return n<0?y:(r.splice(n,1),i(t,r),b)}function l(t,e,r){for(var n=0;n=0&&t[n][1]>=e;--n){var a=r(t[n]);if(a)return a}}function c(t,e){for(var r=0;r>1],i=[],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=v.ge(this.leftPoints,t,h),n=v.ge(this.rightPoints,t,d);this.leftPoints.splice(r,0,t),this.rightPoints.splice(n,0,t)}},x.remove=function(t){var e=this.count-this.leftPoints;if(t[1]3*(e-1))return s(this,t);var r=this.left.remove(t);return 2===r?(this.left=null,this.count-=1,b):(r===b&&(this.count-=1),r)}if(t[0]>this.mid){if(!this.right)return y;if(4*(this.left?this.left.count:0)>3*(e-1))return s(this,t);var r=this.right.remove(t);return 2===r?(this.right=null,this.count-=1,b):(r===b&&(this.count-=1),r)}if(1===this.count)return this.leftPoints[0]===t?2:y;if(1===this.leftPoints.length&&this.leftPoints[0]===t){if(this.left&&this.right){for(var n=this,i=this.left;i.right;)n=i,i=i.right;if(n===this)i.right=this.right;else{var o=this.left,r=this.right;n.count-=i.count,n.right=i.left,i.left=o,i.right=r}a(this,i),this.count=(this.left?this.left.count:0)+(this.right?this.right.count:0)+this.leftPoints.length}else this.left?a(this,this.left):a(this,this.right);return b}for(var o=v.ge(this.leftPoints,t,h);othis.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)},x.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 _=g.prototype;_.insert=function(t){this.root?this.root.insert(t):this.root=new n(t[0],null,null,[t],[t])},_.remove=function(t){if(this.root){var e=this.root.remove(t);return 2===e&&(this.root=null),e!==y}return!1},_.queryPoint=function(t,e){if(this.root)return this.root.queryPoint(t,e)},_.queryInterval=function(t,e,r){if(t<=e&&this.root)return this.root.queryInterval(t,e,r)},Object.defineProperty(_,"count",{get:function(){return this.root?this.root.count:0}}),Object.defineProperty(_,"intervals",{get:function(){return this.root?this.root.intervals([]):[]}})},{"binary-search-bounds":30}],152:[function(t,e,r){"use strict";function n(t,e){e=e||new Array(t.length);for(var r=0;r0)return 1<=0)return 1<=0;--e)S(e,0);for(var r=[],e=0;e0;_=_-1&g)x.push(w+"["+T+"+"+m(_)+"]");x.push(v(0));for(var _=0;_0){",h(x[t]),"=1;"),D(t-1,e|1<0&&q.push(s(H,x[U-1])+"*"+o(x[U-1])),B.push(d(H,x[U])+"=("+q.join("-")+")|0")}for(var H=0;H=0;--H)X.push(o(x[H]));B.push(M+"=("+X.join("*")+")|0",A+"=mallocUint32("+M+")",w+"=mallocUint32("+M+")",T+"=0"),B.push(p(0)+"=0");for(var U=1;U<1< 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 i=t.getters||[],o=new Array(n),s=0;s=0?o[s]=!0:o[s]=!1;return b(t.vertex,t.cell,t.phase,a,r,o)}var _=t("typedarray-pool");e.exports=x;var w="V",A="P",k="N",M="Q",T="X",E="T"},{"typedarray-pool":205}],162:[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]=i({args:["array","array","array"],body:{args:["a","b","c"],body:"a=b"+e+"c"},funcName:t}),r[t+"eq"]=i({args:["array","array"],body:{args:["a","b"],body:"a"+e+"=b"},rvalue:!0,funcName:t+"eq"}),r[t+"s"]=i({args:["array","array","scalar"],body:{args:["a","b","s"],body:"a=b"+e+"s"},funcName:t+"s"}),r[t+"seq"]=i({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]=i({args:["array","array"],body:{args:["a","b"],body:"a="+e+"b"},funcName:t}),r[t+"eq"]=i({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]=i({args:["array","array","array"],body:{args:["a","b","c"],body:"a=b"+e+"c"},funcName:t}),r[t+"s"]=i({args:["array","array","scalar"],body:{args:["a","b","s"],body:"a=b"+e+"s"},funcName:t+"s"}),r[t+"eq"]=i({args:["array","array"],body:{args:["a","b"],body:"a=a"+e+"b"},rvalue:!0,count:2,funcName:t+"eq"}),r[t+"seq"]=i({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=i({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=i({args:["array","array"],body:{args:["a","b"],body:"a=b"},funcName:"assign"}),r.assigns=i({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}],163:[function(t,e,r){function n(t,e){return t[0]-e[0]}function a(){var t,e=this.stride,r=new Array(e.length);for(t=0;tMath.abs(this.stride[1]))?[1,0]:[0,1]}})"):3===e&&i.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];}}})")):i.push("ORDER})")),i.push("proto.set=function "+r+"_set("+u.join(",")+",v){"),n?i.push("return this.data.set("+c+",v)}"):i.push("return this.data["+c+"]=v}"),i.push("proto.get=function "+r+"_get("+u.join(",")+"){"),n?i.push("return this.data.get("+c+")}"):i.push("return this.data["+c+"]}"),i.push("proto.index=function "+r+"_index(",u.join(),"){return "+c+"}"),i.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+"]"});i.push("proto.lo=function "+r+"_lo("+u.join(",")+"){var b=this.offset,d=0,"+p.join(",")+","+g.join(","));for(var m=0;m=0){d=i"+m+"|0;b+=c"+m+"*d;a"+m+"-=d}");i.push("return new "+r+"(this.data,"+s.map(function(t){return"a"+t}).join(",")+","+s.map(function(t){return"c"+t}).join(",")+",b)}"),i.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;m=0){c=(c+this.stride["+m+"]*i"+m+")|0}else{a.push(this.shape["+m+"]);b.push(this.stride["+m+"])}");i.push("var ctor=CTOR_LIST[a.length+1];return ctor(this.data,a,b,c)}"),i.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",i.join("\n"));return o(f[t],a)}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 a=f.array[0];return a([])}"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;lt==t>0?n===o?(r+=1,n=0):n+=1:0===n?(n=o,r-=1):n-=1,a.pack(n,r)}var a=t("double-bits"),i=Math.pow(2,-1074),o=-1>>>0;e.exports=n},{"double-bits":63}],165:[function(t,e,r){"use strict";function n(t,e){var r,n,o;return"string"==typeof t?(r=a(t,e),n=r.width,o=r.height):t instanceof HTMLCanvasElement?(n=t.width,o=t.height,t=t.getContext("2d"),r=t.getImageData(0,0,n,o)):t instanceof ImageData&&(n=t.width,o=t.height,r=t),i(r)}function a(t,e){e||(e={});var r=e.family||"sans-serif",n=l.width,a=l.height,i=e.width||e.height||e.size;i&&i!=n&&(n=a=l.width=l.height=i);var o=e.fontSize||n/2;return u.fillStyle="#000",u.fillRect(0,0,n,a),u.font=o+"px "+r,u.textBaseline="middle",u.textAlign="center",u.fillStyle="white",u.fillText(t,n/2,a/2),u.getImageData(0,0,n,a)}function i(t){var e,r,n,a,i,l,u,c,f,h,d,p,g,m=t.data,v=t.width,y=t.height,b=Array(y),x=Array(y),_=0,w=0,A=v,k=0,M=0,T=Array(y);for(r=0;rk&&(k=d[1]),T[r]=d}for(l=0,c=0,u=0,r=0;rM&&(M=g);return{center:[f,h],bounds:[A,_,k,w+1],radius:Math.sqrt(M)}}function o(t,e){var r=0,n=t.length,a=0;for(e||(e=4);!t[a]&&ar;)a-=e;return n=a,[r/e,n/e]}function s(t,e){return t*t+e*e}e.exports=n;var l=document.createElement("canvas"),u=l.getContext("2d");l.width=200,l.height=200,n.canvas=l},{}],166:[function(t,e,r){"use strict";var n=t("repeat-string");e.exports=function(t,e,r){return r=void 0!==r?r+"":" ",n(r,e)+t}},{"repeat-string":180}],167:[function(t,e,r){e.exports=function(t,e){e||(e=[0,""]),t=String(t);var r=parseFloat(t,10);return e[0]=r,e[1]=t.match(/[\d.\-\+]*\s*(.*)/)[1]||"",e}},{}],168:[function(t,e,r){"use strict";function n(t){var e=t.length;if(e0;--a)n=l[a],r=s[a],s[a]=s[n],s[n]=r,l[a]=l[r],l[r]=n,u=(u+r)*a;return i.freeUint32(l),i.freeUint32(s),u}function a(t,e,r){switch(t){case 0:return 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,a,i,o=1;for(r[0]=0,i=1;i0;--i)n=e/o|0,e=e-n*o|0,o=o/i|0,a=0|r[i],r[i]=0|r[n],r[n]=0|a;return r}var i=t("typedarray-pool"),o=t("invert-permutation");r.rank=n,r.unrank=a},{"invert-permutation":152,"typedarray-pool":205}],170:[function(t,e,r){"use strict";function n(t,e){function r(t,e){var r=s[e][t[e]];r.splice(r.indexOf(t),1)}function n(t,n,i){for(var o,l,u,c=0;c<2;++c)if(s[c][n].length>0){o=s[c][n][0],u=c;break}l=o[1^u];for(var f=0;f<2;++f)for(var h=s[f][n],d=0;d0&&(o=p,l=g,u=f)}return i?l:(o&&r(o,u),l)}for(var i=0|e.length,o=t.length,s=[new Array(i),new Array(i)],l=0;l0;){var d=(s[0][l].length,function(t,i){var o=s[i][t][0],l=[t];r(o,i);for(var u=o[1^i];;){for(;u!==t;)l.push(u),u=n(l[l.length-2],u,!1);if(s[0][t].length+s[1][t].length===0)break;var c=l[l.length-1],f=t,h=l[1],d=n(c,f,!0);if(a(e[c],e[f],e[h],e[d])<0)break;l.push(t),u=n(c,f)}return l}(l,f));!function(t,e){return e[1]===e[e.length-1]}(h,d)?(h.length>0&&c.push(h),h=d):h.push.apply(h,d)}h.length>0&&c.push(h)}return c}e.exports=n;var a=t("compare-angle")},{"compare-angle":57}],171:[function(t,e,r){"use strict";function n(t,e){for(var r=a(t,e.length),n=new Array(e.length),i=new Array(e.length),o=[],s=0;s0;){var u=o.pop();n[u]=!1;for(var c=r[u],s=0;s0}function i(t){for(var e=t.length,r=0;r0;){var H=B.pop(),U=I[H];f(U,function(t,e){return t-e});var V,G=U.length,q=j[H];if(0===q){var T=v[H];V=[T]}for(var m=0;m=0)&&(j[X]=1^q,B.push(X),0===q)){var T=v[X];i(T)||(T.reverse(),V.push(T))}}0===q&&d.push(V)}return d}e.exports=i;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":171,"edges-to-adjacency-list":65,"planar-dual":170,"point-in-big-polygon":173,"robust-sum":187,"two-product":203,uniq:207}],173:[function(t,e,r){function n(){return!0}function a(t){return function(e,r){var a=t[e];return!!a&&!!a.queryPoint(r,n)}}function i(t){for(var e={},r=0;r0&&e[n]===r[0]))return 1;a=t[n-1]}for(var i=1;a;){var o=a.key,s=f(r,o[0],o[1]);if(o[0][0]0))return 0;i=-1,a=a.right}else if(s>0)a=a.left;else{if(!(s<0))return 0;i=1,a=a.right}}return i}}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=[],a=0;a1)for(var r=1;r=0&&(0|t)===t||e("invalid parameter type, ("+t+")"+n(r)+". must be a nonnegative integer")}function l(t,r,a){r.indexOf(t)<0&&e("invalid value"+n(a)+". must be one of: "+r)}function u(t){Object.keys(t).forEach(function(t){te.indexOf(t)<0&&e('invalid regl constructor argument "'+t+'". must be one of '+te)})}function c(t,e){for(t+="";t.length0&&e.push(new d("unknown",0,t))}}),e}function y(t,e){e.forEach(function(e){var r=t[e.file];if(r){var n=r.index[e.line];if(n)return n.errors.push(e),void(r.hasErrors=!0)}t.unknown.hasErrors=!0,t.unknown.lines[0].errors.push(e)})}function b(t,e,n,a,i){if(!t.getShaderParameter(e,t.COMPILE_STATUS)){var o=t.getShaderInfoLog(e),s=a===t.FRAGMENT_SHADER?"fragment":"vertex";T(n,"string",s+" shader source must be a string",i);var l=m(n,i),u=v(o);y(l,u),Object.keys(l).forEach(function(t){function e(t,e){n.push(t),a.push(e||"")}var r=l[t];if(r.hasErrors){var n=[""],a=[""];e("file number "+t+": "+r.name+"\n","color:red;text-decoration:underline;font-weight:bold"),r.lines.forEach(function(t){if(t.errors.length>0){e(c(t.number,4)+"| ","background-color:yellow; font-weight:bold"),e(t.line+"\n","color:red; background-color:yellow; font-weight:bold");var r=0;t.errors.forEach(function(n){var a=n.message,i=/^\s*\'(.*)\'\s*\:\s*(.*)$/.exec(a);if(i){var o=i[1];switch(a=i[2],o){case"assign":o="="}r=Math.max(t.line.indexOf(o,r),0)}else r=0;e(c("| ",6)),e(c("^^^",r+3)+"\n","font-weight:bold"),e(c("| ",6)),e(a+"\n","font-weight:bold")}),e(c("| ",6)+"\n")}else e(c(t.number,4)+"| "),e(t.line+"\n","color:red")}),"undefined"!=typeof document?(a[0]=n.join("%c"),console.log.apply(console,a)):console.log(n.join(""))}}),r.raise("Error compiling "+s+" shader, "+l[0].name)}}function x(t,e,n,a,i){if(!t.getProgramParameter(e,t.LINK_STATUS)){var o=t.getProgramInfoLog(e),s=m(n,i),l=m(a,i),u='Error linking program with vertex shader, "'+l[0].name+'", and fragment shader "'+s[0].name+'"';"undefined"!=typeof document?console.log("%c"+u+"\n%c"+o,"color:red;text-decoration:underline;font-weight:bold","color:red"):console.log(u+"\n"+o),r.raise(u)}}function _(t){t._commandRef=p()}function w(t,e,r,n){function a(t){return t?n.id(t):0}function i(t,e){Object.keys(e).forEach(function(e){t[n.id(e)]=!0})}_(t),t._fragId=a(t.static.frag),t._vertId=a(t.static.vert);var o=t._uniformSet={};i(o,e.static),i(o,e.dynamic);var s=t._attributeSet={};i(s,r.static),i(s,r.dynamic),t._hasCount="count"in t.static||"count"in t.dynamic||"elements"in t.static||"elements"in t.dynamic}function A(t,r){var n=g();e(t+" in command "+(r||p())+("unknown"===n?"":" called from "+n))}function k(t,e,r){t||A(e,r||p())}function M(t,e,r,a){t in e||A("unknown parameter ("+t+")"+n(r)+". possible values: "+Object.keys(e).join(),a||p())}function T(t,e,r,a){typeof t!==e&&A("invalid parameter type"+n(r)+". expected "+e+", got "+typeof t,a||p())}function E(t){t()}function L(t,e,r){t.texture?l(t.texture._texture.internalformat,e,"unsupported texture format for attachment"):l(t.renderbuffer._renderbuffer.format,r,"unsupported renderbuffer format for attachment")}function S(t,e){return t===ue||t===le||t===ce?2:t===fe?4:he[t]*e}function C(t){return!(t&t-1||!t)}function O(t,e,n){var a,i=e.width,o=e.height,s=e.channels;r(i>0&&i<=n.maxTextureSize&&o>0&&o<=n.maxTextureSize,"invalid texture shape"),t.wrapS===ee&&t.wrapT===ee||r(C(i)&&C(o),"incompatible wrap mode for texture, both width and height must be power of 2"), +1===e.mipmask?1!==i&&1!==o&&r(t.minFilter!==ne&&t.minFilter!==ie&&t.minFilter!==ae&&t.minFilter!==oe,"min filter requires mipmap"):(r(C(i)&&C(o),"texture must be a square power of 2 to support mipmapping"),r(e.mipmask===(i<<1)-1,"missing or incomplete mipmap data")),e.type===se&&(n.extensions.indexOf("oes_texture_float_linear")<0&&r(t.minFilter===re&&t.magFilter===re,"filter not supported, must enable oes_texture_float_linear"),r(!t.genMipmaps,"mipmap generation not supported with float textures"));var l=e.images;for(a=0;a<16;++a)if(l[a]){var u=i>>a,c=o>>a;r(e.mipmask&1<0&&i<=a.maxTextureSize&&o>0&&o<=a.maxTextureSize,"invalid texture shape"),r(i===o,"cube map must be square"),r(e.wrapS===ee&&e.wrapT===ee,"wrap mode not supported by cube map");for(var l=0;l>f,p=o>>f;r(u.mipmask&1<1&&e===r&&('"'===e||"'"===e))return['"'+D(t.substr(1,t.length-2))+'"'];var n=/\[(false|true|null|\d+|'[^']*'|"[^"]*")\]/.exec(t);if(n)return P(t.substr(0,n.index)).concat(P(n[1])).concat(P(t.substr(n.index+n[0].length)));var a=t.split(".");if(1===a.length)return['"'+D(t)+'"'];for(var i=[],o=0;o0,"invalid pixel ratio"))):de.raise("invalid arguments to regl"),e&&("canvas"===e.nodeName.toLowerCase()?n=e:r=e),!a){if(!n){de("undefined"!=typeof document,"must manually specify webgl context outside of DOM environments");var d=H(r||document.body,f,u);if(!d)return null;n=d.canvas,h=d.onDestroy}a=U(n,o)}return a?{gl:a,canvas:n,container:r,extensions:s,optionalExtensions:l,pixelRatio:u,profile:c,onDone:f,onDestroy:h}:(h(),f("webgl not supported, try upgrading your browser or graphics drivers http://get.webgl.org"),null)}function W(t,e){function r(e){de.type(e,"string","extension name must be string");var r,a=e.toLowerCase();try{r=n[a]=t.getExtension(a)}catch(t){}return!!r}for(var n={},a=0;a65535)<<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)|t>>1}function J(t){var e=$(t),r=Le[K(e)>>2];return r.length>0?r.pop():new ArrayBuffer(e)}function tt(t){Le[K(t.byteLength)>>2].push(t)}function et(t,e){var r=null;switch(t){case _e:r=new Int8Array(J(e),0,e);break;case we:r=new Uint8Array(J(e),0,e);break;case Ae:r=new Int16Array(J(2*e),0,e);break;case ke:r=new Uint16Array(J(2*e),0,e);break;case Me:r=new Int32Array(J(4*e),0,e);break;case Te:r=new Uint32Array(J(4*e),0,e);break;case Ee:r=new Float32Array(J(4*e),0,e);break;default:return null}return r.length!==e?r.subarray(0,e):r}function rt(t){tt(t.buffer)}function nt(t,e,r){for(var n=0;n0){var l;if(Array.isArray(e[0])){s=De(e);for(var u=1,c=1;c0)if("number"==typeof t[0]){var a=Se.allocType(p.dtype,t.length);ct(a,t),f(a,n),Se.freeType(a)}else if(Array.isArray(t[0])||Kt(t[0])){r=De(t);var i=Re(t,r,p.dtype);f(i,n),Se.freeType(i)}else de.raise("invalid buffer data")}else if(Kt(t))f(t,n);else if(Z(t)){r=t.shape;var o=t.stride,s=0,l=0,u=0,h=0;1===r.length?(s=r[0],l=1,u=o[0],h=0):2===r.length?(s=r[0],l=r[1],u=o[0],h=o[1]):de.raise("invalid shape");var d=Array.isArray(t.data)?p.dtype:ut(t.data),g=Se.allocType(d,s*l);ft(g,t.data,s,l,u,h,t.offset),f(g,n),Se.freeType(g)}else de.raise("invalid data for buffer subdata");return c}e.bufferCount++;var p=new n(i);return h[p.id]=p,o||c(a),c._reglType="buffer",c._buffer=p,c.subdata=d,r.profile&&(c.stats=p.stats),c.destroy=function(){l(p)},c}function c(){xe(h).forEach(function(e){e.buffer=t.createBuffer(),t.bindBuffer(e.type,e.buffer),t.bufferData(e.type,e.persistentData||e.byteLength,e.usage)})}var f=0,h={};n.prototype.bind=function(){t.bindBuffer(this.type,this.buffer)},n.prototype.destroy=function(){l(this)};var d=[];return r.profile&&(e.getTotalBufferSize=function(){var t=0;return Object.keys(h).forEach(function(e){t+=h[e].stats.size}),t}),{create:u,createStream:a,destroyStream:i,clear:function(){xe(h).forEach(l),d.forEach(l)},getBuffer:function(t){return t&&t._buffer instanceof n?t._buffer:null},restore:c,_initBuffer:s}}function dt(t,e,r,n){function a(t){this.id=f++,c[this.id]=this,this.buffer=t,this.primType=Ve,this.vertCount=0,this.type=0}function i(t){var e=d.pop();return e||(e=new a(r.create(null,Qe,!0,!1)._buffer)),s(e,t,$e,-1,-1,0,0),e}function o(t){d.push(t)}function s(n,a,i,o,s,l,u){if(n.buffer.bind(),a){var c=u;u||Kt(a)&&(!Z(a)||Kt(a.data))||(c=e.oes_element_index_uint?Ze:Ye),r._initBuffer(n.buffer,a,i,c,3)}else t.bufferData(Qe,l,i),n.buffer.dtype=f||qe,n.buffer.usage=i,n.buffer.dimension=3,n.buffer.byteLength=l;var f=u;if(!u){switch(n.buffer.dtype){case qe:case Ge:f=qe;break;case Ye:case Xe:f=Ye;break;case Ze:case We:f=Ze;break;default:de.raise("unsupported type for element array")}n.buffer.dtype=f}n.type=f,de(f!==Ze||!!e.oes_element_index_uint,"32 bit element buffers not supported, enable oes_element_index_uint first");var h=s;h<0&&(h=n.buffer.byteLength,f===Ye?h>>=1:f===Ze&&(h>>=2)),n.vertCount=h;var d=o;if(o<0){d=Ve;var p=n.buffer.dimension;1===p&&(d=He),2===p&&(d=Ue),3===p&&(d=Ve)}n.primType=d}function l(t){n.elementsCount--,de(null!==t.buffer,"must not double destroy elements"),delete c[t.id],t.buffer.destroy(),t.buffer=null}function u(t,e){function i(t){if(t)if("number"==typeof t)o(t),u.primType=Ve,u.vertCount=0|t,u.type=qe;else{var e=null,r=Ke,n=-1,a=-1,l=0,c=0;Array.isArray(t)||Kt(t)||Z(t)?e=t:(de.type(t,"object","invalid arguments for elements"),"data"in t&&(e=t.data,de(Array.isArray(e)||Kt(e)||Z(e),"invalid data for element buffer")),"usage"in t&&(de.parameter(t.usage,Ie,"invalid element buffer usage"),r=Ie[t.usage]),"primitive"in t&&(de.parameter(t.primitive,je,"invalid element buffer primitive"),n=je[t.primitive]),"count"in t&&(de("number"==typeof t.count&&t.count>=0,"invalid vertex count for elements"),a=0|t.count),"type"in t&&(de.parameter(t.type,h,"invalid buffer type"),c=h[t.type]),"length"in t?l=0|t.length:(l=a,c===Ye||c===Xe?l*=2:c!==Ze&&c!==We||(l*=4))),s(u,e,r,n,a,l,c)}else o(),u.primType=Ve,u.vertCount=0,u.type=qe;return i}var o=r.create(null,Qe,!0),u=new a(o._buffer);return n.elementsCount++,i(t),i._reglType="elements",i._elements=u,i.subdata=function(t,e){return o.subdata(t,e),i},i.destroy=function(){l(u)},i}var c={},f=0,h={uint8:qe,uint16:Ye};e.oes_element_index_uint&&(h.uint32=Ze),a.prototype.bind=function(){this.buffer.bind()};var d=[];return{create:u,createStream:i,destroyStream:o,getElements:function(t){return"function"==typeof t&&t._elements instanceof a?t._elements:null},clear:function(){xe(c).forEach(l)}}}function pt(t){for(var e=Se.allocType(er,t.length),r=0;r>>31<<15,i=(n<<1>>>24)-127,o=n>>13&1023;if(i<-24)e[r]=a;else if(i<-14){var s=-14-i;e[r]=a+(o+1024>>s)}else e[r]=i>15?a+31744:a+(i+15<<10)+o}return e}function gt(t){return Array.isArray(t)||Kt(t)}function mt(t){return"[object "+t+"]"}function vt(t){return Array.isArray(t)&&(0===t.length||"number"==typeof t[0])}function yt(t){return!!Array.isArray(t)&&!(0===t.length||!gt(t[0]))}function bt(t){return Object.prototype.toString.call(t)}function xt(t){return bt(t)===dn}function _t(t){return bt(t)===pn}function wt(t){return bt(t)===gn}function At(t){return bt(t)===mn}function kt(t){if(!t)return!1;var e=bt(t);return vn.indexOf(e)>=0||(vt(t)||yt(t)||Z(t))}function Mt(t){return 0|$t[Object.prototype.toString.call(t)]}function Tt(t,e){var r=e.length;switch(t.type){case Pr:case zr:case Nr:case Fr:var n=Se.allocType(t.type,r);n.set(e),t.data=n;break;case wr:t.data=pt(e);break;default:de.raise("unsupported texture type, must specify a typed array")}}function Et(t,e){return Se.allocType(t.type===wr?Fr:t.type,e)}function Lt(t,e){t.type===wr?(t.data=pt(e),Se.freeType(e)):t.data=e}function St(t,e,r,n,a,i){for(var o=t.width,s=t.height,l=t.channels,u=o*s*l,c=Et(t,u),f=0,h=0;h=1;)s+=o*l*l,l/=2;return s}return o*r*n}function Ot(t,e,r,n,a,i,o){function s(){this.internalformat=or,this.format=or,this.type=Pr,this.compressed=!1,this.premultiplyAlpha=!1,this.flipY=!1,this.unpackAlignment=1,this.colorSpace=0,this.width=0,this.height=0,this.channels=0}function l(t,e){t.internalformat=e.internalformat,t.format=e.format,t.type=e.type,t.compressed=e.compressed,t.premultiplyAlpha=e.premultiplyAlpha,t.flipY=e.flipY,t.unpackAlignment=e.unpackAlignment,t.colorSpace=e.colorSpace,t.width=e.width,t.height=e.height,t.channels=e.channels}function u(t,n){if("object"==typeof n&&n){if("premultiplyAlpha"in n&&(de.type(n.premultiplyAlpha,"boolean","invalid premultiplyAlpha"),t.premultiplyAlpha=n.premultiplyAlpha),"flipY"in n&&(de.type(n.flipY,"boolean","invalid texture flip"),t.flipY=n.flipY),"alignment"in n&&(de.oneOf(n.alignment,[1,2,4,8],"invalid texture unpack alignment"),t.unpackAlignment=n.alignment),"colorSpace"in n&&(de.parameter(n.colorSpace,F,"invalid colorSpace"),t.colorSpace=F[n.colorSpace]),"type"in n){var a=n.type;de(e.oes_texture_float||!("float"===a||"float32"===a),"you must enable the OES_texture_float extension in order to use floating point textures."),de(e.oes_texture_half_float||!("half float"===a||"float16"===a),"you must enable the OES_texture_half_float extension in order to use 16-bit floating point textures."),de(e.webgl_depth_texture||!("uint16"===a||"uint32"===a||"depth stencil"===a),"you must enable the WEBGL_depth_texture extension in order to use depth/stencil textures."),de.parameter(a,B,"invalid texture type"),t.type=B[a]}var i=t.width,o=t.height,s=t.channels,l=!1;"shape"in n?(de(Array.isArray(n.shape)&&n.shape.length>=2,"shape must be an array"),i=n.shape[0],o=n.shape[1],3===n.shape.length&&(s=n.shape[2],de(s>0&&s<=4,"invalid number of channels"),l=!0),de(i>=0&&i<=r.maxTextureSize,"invalid width"),de(o>=0&&o<=r.maxTextureSize,"invalid height")):("radius"in n&&(i=o=n.radius,de(i>=0&&i<=r.maxTextureSize,"invalid radius")),"width"in n&&(i=n.width,de(i>=0&&i<=r.maxTextureSize,"invalid width")),"height"in n&&(o=n.height,de(o>=0&&o<=r.maxTextureSize,"invalid height")),"channels"in n&&(s=n.channels,de(s>0&&s<=4,"invalid number of channels"),l=!0)),t.width=0|i,t.height=0|o,t.channels=0|s;var u=!1;if("format"in n){var c=n.format;de(e.webgl_depth_texture||!("depth"===c||"depth stencil"===c),"you must enable the WEBGL_depth_texture extension in order to use depth/stencil textures."),de.parameter(c,j,"invalid texture format");var f=t.internalformat=j[c];t.format=Q[f],c in B&&("type"in n||(t.type=B[c])),c in H&&(t.compressed=!0),u=!0}!l&&u?t.channels=hn[t.format]:l&&!u?t.channels!==fn[t.format]&&(t.format=t.internalformat=fn[t.channels]):u&&l&&de(t.channels===hn[t.format],"number of channels inconsistent with specified format")}}function c(e){t.pixelStorei(an,e.flipY),t.pixelStorei(on,e.premultiplyAlpha),t.pixelStorei(sn,e.colorSpace),t.pixelStorei(nn,e.unpackAlignment)}function f(){s.call(this),this.xOffset=0,this.yOffset=0,this.data=null,this.needsFree=!1,this.element=null,this.needsCopy=!1}function h(t,e){var n=null;if(kt(e)?n=e:e&&(de.type(e,"object","invalid pixel data type"),u(t,e),"x"in e&&(t.xOffset=0|e.x),"y"in e&&(t.yOffset=0|e.y),kt(e.data)&&(n=e.data)),de(!t.compressed||n instanceof Uint8Array,"compressed texture data must be stored in a uint8array"),e.copy){de(!n,"can not specify copy and data field for the same texture");var i=a.viewportWidth,o=a.viewportHeight;t.width=t.width||i-t.xOffset,t.height=t.height||o-t.yOffset,t.needsCopy=!0,de(t.xOffset>=0&&t.xOffset=0&&t.yOffset0&&t.width<=i&&t.height>0&&t.height<=o,"copy texture read out of bounds")}else if(n){if(Kt(n))t.channels=t.channels||4,t.data=n,"type"in e||t.type!==Pr||(t.type=Mt(n));else if(vt(n))t.channels=t.channels||4,Tt(t,n),t.alignment=1,t.needsFree=!0;else if(Z(n)){var s=n.data;Array.isArray(s)||t.type!==Pr||(t.type=Mt(s));var l,c,f,h,d,p,g=n.shape,m=n.stride;3===g.length?(f=g[2],p=m[2]):(de(2===g.length,"invalid ndarray pixel data, must be 2 or 3D"),f=1,p=1),l=g[0],c=g[1],h=m[0],d=m[1],t.alignment=1,t.width=l,t.height=c,t.channels=f,t.format=t.internalformat=fn[f],t.needsFree=!0,St(t,s,h,d,p,n.offset)}else if(xt(n)||_t(n))xt(n)?t.element=n:t.element=n.canvas,t.width=t.element.width,t.height=t.element.height,t.channels=4;else if(wt(n))t.element=n,t.width=n.naturalWidth,t.height=n.naturalHeight,t.channels=4;else if(At(n))t.element=n,t.width=n.videoWidth,t.height=n.videoHeight,t.channels=4;else if(yt(n)){var v=t.width||n[0].length,y=t.height||n.length,b=t.channels;b=gt(n[0][0])?b||n[0][0].length:b||1;for(var x=Ce.shape(n),_=1,w=0;w=0,"oes_texture_float extension not enabled"):t.type===wr&&de(r.extensions.indexOf("oes_texture_half_float")>=0,"oes_texture_half_float extension not enabled")}function d(e,r,a){var i=e.element,o=e.data,s=e.internalformat,l=e.format,u=e.type,f=e.width,h=e.height;c(e),i?t.texImage2D(r,a,l,l,u,i):e.compressed?t.compressedTexImage2D(r,a,s,f,h,0,o):e.needsCopy?(n(),t.copyTexImage2D(r,a,l,e.xOffset,e.yOffset,f,h,0)):t.texImage2D(r,a,l,f,h,0,l,u,o)}function p(e,r,a,i,o){var s=e.element,l=e.data,u=e.internalformat,f=e.format,h=e.type,d=e.width,p=e.height;c(e),s?t.texSubImage2D(r,o,a,i,f,h,s):e.compressed?t.compressedTexSubImage2D(r,o,a,i,u,d,p,l):e.needsCopy?(n(),t.copyTexSubImage2D(r,o,a,i,e.xOffset,e.yOffset,d,p)):t.texSubImage2D(r,o,a,i,d,p,f,h,l)}function g(){return $.pop()||new f}function m(t){t.needsFree&&Se.freeType(t.data),f.call(t),$.push(t)}function v(){s.call(this),this.genMipmaps=!1,this.mipmapHint=Jr,this.mipmask=0,this.images=Array(16)}function y(t,e,r){var n=t.images[0]=g();t.mipmask=1,n.width=t.width=e,n.height=t.height=r,n.channels=t.channels=4}function b(t,e){var r=null;if(kt(e))r=t.images[0]=g(),l(r,t),h(r,e),t.mipmask=1;else if(u(t,e),Array.isArray(e.mipmap))for(var n=e.mipmap,a=0;a>=a,r.height>>=a,h(r,n[a]),t.mipmask|=1<=0&&(t.genMipmaps=!0)}if("mag"in e){var a=e.mag;de.parameter(a,z),t.magFilter=z[a]}var i=t.wrapS,o=t.wrapT;if("wrap"in e){var s=e.wrap;"string"==typeof s?(de.parameter(s,P),i=o=P[s]):Array.isArray(s)&&(de.parameter(s[0],P),de.parameter(s[1],P),i=P[s[0]],o=P[s[1]])}else{if("wrapS"in e){var l=e.wrapS;de.parameter(l,P),i=P[l]}if("wrapT"in e){var u=e.wrapT;de.parameter(u,P),o=P[u]}}if(t.wrapS=i,t.wrapT=o,"anisotropic"in e){var c=e.anisotropic;de("number"==typeof c&&c>=1&&c<=r.maxAnisotropic,"aniso samples must be between 1 and "),t.anisotropic=e.anisotropic}if("mipmap"in e){var f=!1;switch(typeof e.mipmap){case"string":de.parameter(e.mipmap,D,"invalid mipmap hint"),t.mipmapHint=D[e.mipmap],t.genMipmaps=!0,f=!0;break;case"boolean":f=t.genMipmaps=e.mipmap;break;case"object":de(Array.isArray(e.mipmap),"invalid mipmap type"),t.genMipmaps=!1,f=!0;break;default:de.raise("invalid mipmap type")}!f||"min"in e||(t.minFilter=Wr)}}function M(r,n){t.texParameteri(n,qr,r.minFilter),t.texParameteri(n,Gr,r.magFilter),t.texParameteri(n,Br,r.wrapS),t.texParameteri(n,jr,r.wrapT),e.ext_texture_filter_anisotropic&&t.texParameteri(n,rn,r.anisotropic),r.genMipmaps&&(t.hint(Kr,r.mipmapHint),t.generateMipmap(n))}function T(e){s.call(this),this.mipmask=0,this.internalformat=or,this.id=J++,this.refCount=1,this.target=e,this.texture=t.createTexture(),this.unit=-1,this.bindCount=0,this.texInfo=new A,o.profile&&(this.stats={size:0})}function E(e){t.activeTexture(un),t.bindTexture(e.target,e.texture)}function L(){var e=rt[0];e?t.bindTexture(e.target,e.texture):t.bindTexture(nr,null)}function S(e){var r=e.texture;de(r,"must not double destroy texture");var n=e.unit,a=e.target;n>=0&&(t.activeTexture(un+n),t.bindTexture(a,null),rt[n]=null),t.deleteTexture(r),e.texture=null,e.params=null,e.pixels=null,e.refCount=0,delete tt[e.id],i.textureCount--}function C(e,n){function a(t,e){var n=c.texInfo;A.call(n);var i=_();return"number"==typeof t?"number"==typeof e?y(i,0|t,0|e):y(i,0|t,0|t):t?(de.type(t,"object","invalid arguments to regl.texture"),k(n,t),b(i,t)):y(i,1,1),n.genMipmaps&&(i.mipmask=(i.width<<1)-1),c.mipmask=i.mipmask,l(c,i),de.texture2D(n,i,r),c.internalformat=i.internalformat,a.width=i.width,a.height=i.height,E(c),x(i,nr),M(n,nr),L(),w(i),o.profile&&(c.stats.size=Ct(c.internalformat,c.type,i.width,i.height,n.genMipmaps,!1)),a.format=G[c.internalformat],a.type=q[c.type],a.mag=X[n.magFilter],a.min=Y[n.minFilter],a.wrapS=W[n.wrapS],a.wrapT=W[n.wrapT],a}function s(t,e,r,n){de(!!t,"must specify image data");var i=0|e,o=0|r,s=0|n,u=g();return l(u,c),u.width=0,u.height=0,h(u,t),u.width=u.width||(c.width>>s)-i,u.height=u.height||(c.height>>s)-o,de(c.type===u.type&&c.format===u.format&&c.internalformat===u.internalformat,"incompatible format for texture.subimage"),de(i>=0&&o>=0&&i+u.width<=c.width&&o+u.height<=c.height,"texture.subimage write out of bounds"),de(c.mipmask&1<>s;++s)t.texImage2D(nr,s,c.format,n>>s,i>>s,0,c.format,c.type,null);return L(),o.profile&&(c.stats.size=Ct(c.internalformat,c.type,n,i,!1,!1)),a}var c=new T(nr);return tt[c.id]=c,i.textureCount++,a(e,n),a.subimage=s,a.resize=u,a._reglType="texture2d",a._texture=c,o.profile&&(a.stats=c.stats),a.destroy=function(){c.decRef()},a}function O(e,n,a,s,c,f){function d(t,e,n,a,i,s){var c,f=C.texInfo;for(A.call(f),c=0;c<6;++c)O[c]=_();if("number"!=typeof t&&t)if("object"==typeof t)if(e)b(O[0],t),b(O[1],e),b(O[2],n),b(O[3],a),b(O[4],i),b(O[5],s);else if(k(f,t),u(C,t),"faces"in t){var h=t.faces;for(de(Array.isArray(h)&&6===h.length,"cube faces must be a length 6 array"),c=0;c<6;++c)de("object"==typeof h[c]&&!!h[c],"invalid input for cube map face"),l(O[c],C),b(O[c],h[c])}else for(c=0;c<6;++c)b(O[c],t);else de.raise("invalid arguments to cube map");else{var p=0|t||1;for(c=0;c<6;++c)y(O[c],p,p)}for(l(C,O[0]),f.genMipmaps?C.mipmask=(O[0].width<<1)-1:C.mipmask=O[0].mipmask,de.textureCube(C,f,O,r),C.internalformat=O[0].internalformat,d.width=O[0].width,d.height=O[0].height,E(C),c=0;c<6;++c)x(O[c],ir+c);for(M(f,ar),L(),o.profile&&(C.stats.size=Ct(C.internalformat,C.type,d.width,d.height,f.genMipmaps,!0)),d.format=G[C.internalformat],d.type=q[C.type],d.mag=X[f.magFilter],d.min=Y[f.minFilter],d.wrapS=W[f.wrapS],d.wrapT=W[f.wrapT],c=0;c<6;++c)w(O[c]);return d}function v(t,e,r,n,a){de(!!e,"must specify image data"),de("number"==typeof t&&t===(0|t)&&t>=0&&t<6,"invalid face");var i=0|r,o=0|n,s=0|a,u=g();return l(u,C),u.width=0,u.height=0,h(u,e),u.width=u.width||(C.width>>s)-i,u.height=u.height||(C.height>>s)-o,de(C.type===u.type&&C.format===u.format&&C.internalformat===u.internalformat,"incompatible format for texture.subimage"),de(i>=0&&o>=0&&i+u.width<=C.width&&o+u.height<=C.height,"texture.subimage write out of bounds"),de(C.mipmask&1<>a;++a)t.texImage2D(ir+n,a,C.format,r>>a,r>>a,0,C.format,C.type,null);return L(),o.profile&&(C.stats.size=Ct(C.internalformat,C.type,d.width,d.height,!1,!0)),d}}var C=new T(ar);tt[C.id]=C,i.cubeCount++;var O=new Array(6);return d(e,n,a,s,c,f),d.subimage=v,d.resize=S,d._reglType="textureCube",d._texture=C,o.profile&&(d.stats=C.stats),d.destroy=function(){C.decRef()},d}function I(){for(var e=0;e>r,e.height>>r,0,e.internalformat,e.type,null);else for(var n=0;n<6;++n)t.texImage2D(ir+n,r,e.internalformat,e.width>>r,e.height>>r,0,e.internalformat,e.type,null);M(e.texInfo,e.target)})}var D={"don't care":Jr,"dont care":Jr,nice:en,fast:tn},P={repeat:Hr,clamp:Ur,mirror:Vr},z={nearest:Xr,linear:Yr},N=Jt({mipmap:$r,"nearest mipmap nearest":Wr,"linear mipmap nearest":Zr,"nearest mipmap linear":Qr,"linear mipmap linear":$r},z),F={none:0,browser:ln},B={uint8:Pr,rgba4:pr,rgb565:mr,"rgb5 a1":gr},j={alpha:sr,luminance:ur,"luminance alpha":cr,rgb:lr,rgba:or,rgba4:fr,"rgb5 a1":hr,rgb565:dr},H={};e.ext_srgb&&(j.srgb=xr,j.srgba=_r),e.oes_texture_float&&(B.float32=B.float=Fr),e.oes_texture_half_float&&(B.float16=B["half float"]=wr),e.webgl_depth_texture&&(Jt(j,{depth:yr,"depth stencil":br}),Jt(B,{uint16:zr,uint32:Nr,"depth stencil":vr})),e.webgl_compressed_texture_s3tc&&Jt(H,{"rgb s3tc dxt1":Ar,"rgba s3tc dxt1":kr,"rgba s3tc dxt3":Mr,"rgba s3tc dxt5":Tr}),e.webgl_compressed_texture_atc&&Jt(H,{"rgb atc":Er,"rgba atc explicit alpha":Lr,"rgba atc interpolated alpha":Sr}),e.webgl_compressed_texture_pvrtc&&Jt(H,{"rgb pvrtc 4bppv1":Cr,"rgb pvrtc 2bppv1":Or,"rgba pvrtc 4bppv1":Ir,"rgba pvrtc 2bppv1":Rr}),e.webgl_compressed_texture_etc1&&(H["rgb etc1"]=Dr);var U=Array.prototype.slice.call(t.getParameter(rr));Object.keys(H).forEach(function(t){var e=H[t];U.indexOf(e)>=0&&(j[t]=e)});var V=Object.keys(j);r.textureFormats=V;var G=[];Object.keys(j).forEach(function(t){var e=j[t];G[e]=t});var q=[];Object.keys(B).forEach(function(t){var e=B[t];q[e]=t});var X=[];Object.keys(z).forEach(function(t){var e=z[t];X[e]=t});var Y=[];Object.keys(N).forEach(function(t){var e=N[t];Y[e]=t});var W=[];Object.keys(P).forEach(function(t){var e=P[t];W[e]=t});var Q=V.reduce(function(t,e){var r=j[e];return r===ur||r===sr||r===ur||r===cr||r===yr||r===br?t[r]=r:r===hr||e.indexOf("rgba")>=0?t[r]=or:t[r]=lr,t},{}),$=[],K=[],J=0,tt={},et=r.maxTextureUnits,rt=Array(et).map(function(){return null});return Jt(T.prototype,{bind:function(){var e=this;e.bindCount+=1;var r=e.unit;if(r<0){for(var n=0;n0)continue;a.unit=-1}rt[n]=e,r=n;break}r>=et&&de.raise("insufficient number of texture units"),o.profile&&i.maxTextureUnits=En&&e=2,"invalid shape for framebuffer"),u=I[0],d=I[1]}else"radius"in O&&(u=d=O.radius),"width"in O&&(u=O.width),"height"in O&&(d=O.height);("color"in O||"colors"in O)&&(y=O.color||O.colors,Array.isArray(y)&&de(1===y.length||o,"multiple render targets not supported")),y||("colorCount"in O&&(T=0|O.colorCount,de(T>0,"invalid color buffer count")),"colorTexture"in O&&(b=!!O.colorTexture,x="rgba4"),"colorType"in O&&(M=O.colorType,b?(de(e.oes_texture_float||!("float"===M||"float32"===M),"you must enable OES_texture_float in order to use floating point framebuffer objects"),de(e.oes_texture_half_float||!("half float"===M||"float16"===M),"you must enable OES_texture_half_float in order to use 16-bit floating point framebuffer objects")):"half float"===M||"float16"===M?(de(e.ext_color_buffer_half_float,"you must enable EXT_color_buffer_half_float to use 16-bit render buffers"),x="rgba16f"):"float"!==M&&"float32"!==M||(de(e.webgl_color_buffer_float,"you must enable WEBGL_color_buffer_float in order to use 32-bit floating point renderbuffers"),x="rgba32f"),de.oneOf(M,k,"invalid color type")),"colorFormat"in O&&(x=O.colorFormat,w.indexOf(x)>=0?b=!0:A.indexOf(x)>=0?b=!1:b?de.oneOf(O.colorFormat,w,"invalid color format for texture"):de.oneOf(O.colorFormat,A,"invalid color format for renderbuffer"))),("depthTexture"in O||"depthStencilTexture"in O)&&(C=!(!O.depthTexture&&!O.depthStencilTexture),de(!C||e.webgl_depth_texture,"webgl_depth_texture extension not supported")),"depth"in O&&("boolean"==typeof O.depth?p=O.depth:(E=O.depth,m=!1)),"stencil"in O&&("boolean"==typeof O.stencil?m=O.stencil:(L=O.stencil,p=!1)),"depthStencil"in O&&("boolean"==typeof O.depthStencil?p=m=O.depthStencil:(S=O.depthStencil,p=!1,m=!1))}else u=d=1;var R=null,D=null,P=null,z=null;if(Array.isArray(y))R=y.map(c);else if(y)R=[c(y)];else for(R=new Array(T),i=0;i=0||R[i].renderbuffer&&jn.indexOf(R[i].renderbuffer._renderbuffer.format)>=0,"framebuffer color attachment "+i+" is invalid"),R[i]&&R[i].texture){var F=Pn[R[i].texture._texture.format]*zn[R[i].texture._texture.type];null===N?N=F:de(N===F,"all color attachments much have the same number of bits per pixel.")}return l(D,u,d),de(!D||D.texture&&D.texture._texture.format===Rn||D.renderbuffer&&D.renderbuffer._renderbuffer.format===Nn,"invalid depth attachment for framebuffer object"),l(P,u,d),de(!P||P.renderbuffer&&P.renderbuffer._renderbuffer.format===Fn,"invalid stencil attachment for framebuffer object"),l(z,u,d),de(!z||z.texture&&z.texture._texture.format===Bn||z.renderbuffer&&z.renderbuffer._renderbuffer.format===Bn,"invalid depth-stencil attachment for framebuffer object"),g(s),s.width=u,s.height=d,s.colorAttachments=R,s.depthAttachment=D,s.stencilAttachment=P,s.depthStencilAttachment=z,a.color=R.map(h),a.depth=h(D),a.stencil=h(P),a.depthStencil=h(z),a.width=s.width,a.height=s.height,v(s),a}function o(t,e){de(_.next!==s,"can not resize a framebuffer which is currently in use");var r=0|t,n=0|e||r;if(r===s.width&&n===s.height)return a;for(var i=s.colorAttachments,o=0;o=2,"invalid shape for framebuffer"),de(p[0]===p[1],"cube framebuffer must be square"),l=p[0]}else"radius"in d&&(l=0|d.radius),"width"in d?(l=0|d.width,"height"in d&&de(d.height===l,"must be square")):"height"in d&&(l=0|d.height);("color"in d||"colors"in d)&&(u=d.color||d.colors,Array.isArray(u)&&de(1===u.length||i,"multiple render targets not supported")),u||("colorCount"in d&&(h=0|d.colorCount,de(h>0,"invalid color buffer count")),"colorType"in d&&(de.oneOf(d.colorType,k,"invalid color type"),f=d.colorType),"colorFormat"in d&&(c=d.colorFormat,de.oneOf(d.colorFormat,w,"invalid color format for texture"))),"depth"in d&&(s.depth=d.depth),"stencil"in d&&(s.stencil=d.stencil),"depthStencil"in d&&(s.depthStencil=d.depthStencil)}else l=1;var g;if(u)if(Array.isArray(u))for(g=[],r=0;r0&&(s.depth=o[0].depth,s.stencil=o[0].stencil,s.depthStencil=o[0].depthStencil),o[r]?o[r](s):o[r]=y(s)}return Jt(a,{width:l,height:l,color:g})}function i(t){var e,n=0|t;if(de(n>0&&n<=r.maxCubeMapSize,"invalid radius for cube fbo"),n===a.width)return a;var i=a.color;for(e=0;e1)for(var g=0;gt&&(t=e.stats.uniformsCount)}),t},r.getMaxAttributesCount=function(){var t=0;return d.forEach(function(e){e.stats.attributesCount>t&&(t=e.stats.attributesCount)}),t}),{clear:function(){var e=t.deleteShader.bind(t);xe(c).forEach(e),c={},xe(f).forEach(e),f={},d.forEach(function(e){t.deleteProgram(e.program)}),d.length=0,h={},r.shaderCount=0},program:function(t,e,n){de.command(t>=0,"missing vertex shader",n),de.command(e>=0,"missing fragment shader",n);var a=h[e];a||(a=h[e]={});var i=a[t];return i||(i=new s(e,t),r.shaderCount++,l(i,n),a[t]=i,d.push(i)),i},restore:u,shader:o,frag:-1,vert:-1}}function Nt(t,e,r,n,a,i){function o(o){var s;null===e.next?(de(a.preserveDrawingBuffer,'you must create a webgl context with "preserveDrawingBuffer":true in order to read pixels from the drawing buffer'),s=Wn):(de(null!==e.next.colorAttachments[0].texture,"You cannot read from a renderbuffer"),s=e.next.colorAttachments[0].texture._texture.type,i.oes_texture_float?de(s===Wn||s===Qn,"Reading from a framebuffer is only allowed for the types 'uint8' and 'float'"):de(s===Wn,"Reading from a framebuffer is only allowed for the type 'uint8'"));var l=0,u=0,c=n.framebufferWidth,f=n.framebufferHeight,h=null;Kt(o)?h=o:o&&(de.type(o,"object","invalid arguments to regl.read()"),l=0|o.x,u=0|o.y,de(l>=0&&l=0&&u0&&c+l<=n.framebufferWidth,"invalid width for read pixels"),de(f>0&&f+u<=n.framebufferHeight,"invalid height for read pixels"),r();var d=c*f*4;return h||(s===Wn?h=new Uint8Array(d):s===Qn&&(h=h||new Float32Array(d))),de.isTypedArray(h,"data buffer for regl.read() must be a typedarray"),de(h.byteLength>=d,"data buffer for regl.read() too small"),t.pixelStorei(Zn,4),t.readPixels(l,u,c,f,Yn,s,h),h}function s(t){var r;return e.setFBO({framebuffer:t.framebuffer},function(){r=o(t)}),r}function l(t){return t&&"framebuffer"in t?s(t):o(t)}return l}function Ft(t){return Array.prototype.slice.call(t)}function Bt(t){return Ft(t).join("")}function jt(){function t(t){for(var e=0;e0&&(r.push(t,"="),r.push.apply(r,Ft(arguments)),r.push(";")),t}var r=[],n=[];return Jt(t,{def:e,toString:function(){return Bt([n.length>0?"var "+n+";":"",Bt(r)])}})}function r(){function t(t,e){n(t,e,"=",r.def(t,e),";")}var r=e(),n=e(),a=r.toString,i=n.toString;return Jt(function(){r.apply(r,Ft(arguments))},{def:r.def,entry:r,exit:n,save:t,set:function(e,n,a){t(e,n),r(e,n,"=",a,";")},toString:function(){return a()+i()}})}function n(){var t=Bt(arguments),e=r(),n=r(),a=e.toString,i=n.toString;return Jt(e,{then:function(){return e.apply(e,Ft(arguments)),this},else:function(){return n.apply(n,Ft(arguments)),this},toString:function(){var e=i();return e&&(e="else{"+e+"}"),Bt(["if(",t,"){",a(),"}",e])}})}function a(t,e){function n(){var t="a"+a.length;return a.push(t),t}var a=[];e=e||0;for(var i=0;i=1,n>=2,e)}if(r===ia){var a=t.data;return new Vt(a.thisDep,a.contextDep,a.propDep,e)}return new Vt(r===aa,r===na,r===ra,e)}function Yt(t,e,r,n,a,i,o,s,l,u,c,f,h,d,p){function g(t){return t.replace(".","_")}function m(t,e,r){var n=g(t);et.push(t),tt[n]=J[n]=!!r,rt[n]=e}function v(t,e,r){var n=g(t);et.push(t),Array.isArray(r)?(J[n]=r.slice(),tt[n]=r.slice()):J[n]=tt[n]=r,nt[n]=e}function y(){var t=jt(),r=t.link,n=t.global;t.id=ot++,t.batchId="0";var a=r(at),i=t.shared={props:"a0"};Object.keys(at).forEach(function(t){i[t]=n.def(a,".",t)}),de.optional(function(){t.CHECK=r(de),t.commandStr=de.guessCommand(),t.command=r(t.commandStr),t.assert=function(t,e,n){t("if(!(",e,"))",this.CHECK,".commandRaise(",r(n),",",this.command,");")},it.invalidBlendCombinations=Hi});var o=t.next={},s=t.current={};Object.keys(nt).forEach(function(t){Array.isArray(J[t])&&(o[t]=n.def(i.next,".",t),s[t]=n.def(i.current,".",t))});var l=t.constants={};Object.keys(it).forEach(function(t){l[t]=n.def(JSON.stringify(it[t]))}),t.invoke=function(e,n){switch(n.type){case ea:var a=["this",i.context,i.props,t.batchId];return e.def(r(n.data),".call(",a.slice(0,Math.max(n.data.length+1,4)),")");case ra:return e.def(i.props,n.data);case na:return e.def(i.context,n.data);case aa:return e.def("this",n.data);case ia:return n.data.append(t,e),n.data.ref}},t.attribCache={};var c={};return t.scopeAttrib=function(t){var n=e.id(t);if(n in c)return c[n];var a=u.scope[n];return a||(a=u.scope[n]=new W),c[n]=r(a)},t}function b(t){var e,r=t.static,n=t.dynamic;if(Ra in r){var a=!!r[Ra];e=qt(function(t,e){return a}),e.enable=a}else if(Ra in n){var i=n[Ra];e=Xt(i,function(t,e){return t.invoke(e,i)})}return e}function x(t,e){var r=t.static,n=t.dynamic;if(Da in r){var a=r[Da];return a?(a=s.getFramebuffer(a),de.command(a,"invalid framebuffer object"),qt(function(t,e){var r=t.link(a),n=t.shared;e.set(n.framebuffer,".next",r);var i=n.context;return e.set(i,"."+Ua,r+".width"),e.set(i,"."+Va,r+".height"),r})):qt(function(t,e){var r=t.shared;e.set(r.framebuffer,".next","null");var n=r.context;return e.set(n,"."+Ua,n+"."+Xa),e.set(n,"."+Va,n+"."+Ya),"null"})}if(Da in n){var i=n[Da];return Xt(i,function(t,e){var r=t.invoke(e,i),n=t.shared,a=n.framebuffer,o=e.def(a,".getFramebuffer(",r,")");de.optional(function(){t.assert(e,"!"+r+"||"+o,"invalid framebuffer object")}),e.set(a,".next",o);var s=n.context;return e.set(s,"."+Ua,o+"?"+o+".width:"+s+"."+Xa),e.set(s,"."+Va,o+"?"+o+".height:"+s+"."+Ya),o})}return null}function _(t,e,r){function n(t){if(t in a){var n=a[t];de.commandType(n,"object","invalid "+t,r.commandStr);var o,s,l=!0,u=0|n.x,c=0|n.y;return"width"in n?(o=0|n.width,de.command(o>=0,"invalid "+t,r.commandStr)):l=!1,"height"in n?(s=0|n.height,de.command(s>=0,"invalid "+t,r.commandStr)):l=!1,new Vt(!l&&e&&e.thisDep,!l&&e&&e.contextDep,!l&&e&&e.propDep,function(t,e){var r=t.shared.context,a=o;"width"in n||(a=e.def(r,".",Ua,"-",u));var i=s;return"height"in n||(i=e.def(r,".",Va,"-",c)),[u,c,a,i]})}if(t in i){var f=i[t],h=Xt(f,function(e,r){var n=e.invoke(r,f);de.optional(function(){e.assert(r,n+"&&typeof "+n+'==="object"',"invalid "+t)});var a=e.shared.context,i=r.def(n,".x|0"),o=r.def(n,".y|0"),s=r.def('"width" in ',n,"?",n,".width|0:","(",a,".",Ua,"-",i,")"),l=r.def('"height" in ',n,"?",n,".height|0:","(",a,".",Va,"-",o,")");return de.optional(function(){e.assert(r,s+">=0&&"+l+">=0","invalid "+t)}),[i,o,s,l]});return e&&(h.thisDep=h.thisDep||e.thisDep,h.contextDep=h.contextDep||e.contextDep,h.propDep=h.propDep||e.propDep),h}return e?new Vt(e.thisDep,e.contextDep,e.propDep,function(t,e){var r=t.shared.context;return[0,0,e.def(r,".",Ua),e.def(r,".",Va)]}):null}var a=t.static,i=t.dynamic,o=n(Ia);if(o){var s=o;o=new Vt(o.thisDep,o.contextDep,o.propDep,function(t,e){var r=s.append(t,e),n=t.shared.context;return e.set(n,"."+Ga,r[2]),e.set(n,"."+qa,r[3]),r})}return{viewport:o,scissor_box:n(Oa)}}function w(t){function r(t){if(t in a){var r=e.id(a[t]);de.optional(function(){c.shader(Gi[t],r,de.guessCommand())});var n=qt(function(){return r});return n.id=r,n}if(t in i){var o=i[t];return Xt(o,function(e,r){var n=e.invoke(r,o),a=r.def(e.shared.strings,".id(",n,")");return de.optional(function(){r(e.shared.shader,".shader(",Gi[t],",",a,",",e.command,");")}),a})}return null}var n,a=t.static,i=t.dynamic,o=r(za),s=r(Pa),l=null;return Gt(o)&&Gt(s)?(l=c.program(s.id,o.id),n=qt(function(t,e){return t.link(l)})):n=new Vt(o&&o.thisDep||s&&s.thisDep,o&&o.contextDep||s&&s.contextDep,o&&o.propDep||s&&s.propDep,function(t,e){var r,n=t.shared.shader;r=o?o.append(t,e):e.def(n,".",za);var a;a=s?s.append(t,e):e.def(n,".",Pa);var i=n+".program("+a+","+r;return de.optional(function(){i+=","+t.command}),e.def(i+")")}),{frag:o,vert:s,progVar:n,program:l}}function A(t,e){function r(t,r){if(t in n){var i=0|n[t];return de.command(!r||i>=0,"invalid "+t,e.commandStr),qt(function(t,e){return r&&(t.OFFSET=i),i})}if(t in a){var s=a[t];return Xt(s,function(e,n){var a=e.invoke(n,s);return r&&(e.OFFSET=a,de.optional(function(){e.assert(n,a+">=0","invalid "+t)})),a})}return r&&o?qt(function(t,e){return t.OFFSET="0",0}):null}var n=t.static,a=t.dynamic,o=function(){if(Na in n){var t=n[Na];Ht(t)?t=i.getElements(i.create(t,!0)):t&&(t=i.getElements(t),de.command(t,"invalid elements",e.commandStr));var r=qt(function(e,r){if(t){var n=e.link(t);return e.ELEMENTS=n,n}return e.ELEMENTS=null,null});return r.value=t,r}if(Na in a){var o=a[Na];return Xt(o,function(t,e){var r=t.shared,n=r.isBufferArgs,a=r.elements,i=t.invoke(e,o),s=e.def("null"),l=e.def(n,"(",i,")"),u=t.cond(l).then(s,"=",a,".createStream(",i,");").else(s,"=",a,".getElements(",i,");");return de.optional(function(){t.assert(u.else,"!"+i+"||"+s,"invalid elements")}),e.entry(u),e.exit(t.cond(l).then(a,".destroyStream(",s,");")),t.ELEMENTS=s,s})}return null}(),s=r(ja,!0);return{elements:o,primitive:function(){if(Fa in n){var t=n[Fa];return de.commandParameter(t,je,"invalid primitve",e.commandStr),qt(function(e,r){return je[t]})}if(Fa in a){var r=a[Fa];return Xt(r,function(t,e){var n=t.constants.primTypes,a=t.invoke(e,r);return de.optional(function(){t.assert(e,a+" in "+n,"invalid primitive, must be one of "+Object.keys(je))}),e.def(n,"[",a,"]")})}return o?Gt(o)?qt(o.value?function(t,e){return e.def(t.ELEMENTS,".primType")}:function(){return Mi}):new Vt(o.thisDep,o.contextDep,o.propDep,function(t,e){var r=t.ELEMENTS;return e.def(r,"?",r,".primType:",Mi)}):null}(),count:function(){if(Ba in n){var t=0|n[Ba];return de.command("number"==typeof t&&t>=0,"invalid vertex count",e.commandStr),qt(function(){return t})}if(Ba in a){var r=a[Ba];return Xt(r,function(t,e){var n=t.invoke(e,r);return de.optional(function(){t.assert(e,"typeof "+n+'==="number"&&'+n+">=0&&"+n+"===("+n+"|0)","invalid vertex count")}),n})}if(o){if(Gt(o)){if(o)return s?new Vt(s.thisDep,s.contextDep,s.propDep,function(t,e){var r=e.def(t.ELEMENTS,".vertCount-",t.OFFSET);return de.optional(function(){t.assert(e,r+">=0","invalid vertex offset/element buffer too small")}),r}):qt(function(t,e){return e.def(t.ELEMENTS,".vertCount")});var i=qt(function(){return-1});return de.optional(function(){i.MISSING=!0}),i}var l=new Vt(o.thisDep||s.thisDep,o.contextDep||s.contextDep,o.propDep||s.propDep,function(t,e){var r=t.ELEMENTS;return t.OFFSET?e.def(r,"?",r,".vertCount-",t.OFFSET,":-1"):e.def(r,"?",r,".vertCount:-1")});return de.optional(function(){l.DYNAMIC=!0}),l}return null}(),instances:r(Ha,!1),offset:s}}function k(t,e){var r=t.static,a=t.dynamic,i={};return et.forEach(function(t){function o(e,n){if(t in r){var o=e(r[t]);i[s]=qt(function(){return o})}else if(t in a){var l=a[t];i[s]=Xt(l,function(t,e){return n(t,e,t.invoke(e,l))})}}var s=g(t);switch(t){case ma:case sa:case oa:case Ma:case fa:case Ca:case xa:case wa:case Aa:case pa:return o(function(r){return de.commandType(r,"boolean",t,e.commandStr),r},function(e,r,n){return de.optional(function(){e.assert(r,"typeof "+n+'==="boolean"',"invalid flag "+t,e.commandStr)}),n});case ha:return o(function(r){return de.commandParameter(r,Ui,"invalid "+t,e.commandStr),Ui[r]},function(e,r,n){var a=e.constants.compareFuncs;return de.optional(function(){e.assert(r,n+" in "+a,"invalid "+t+", must be one of "+Object.keys(Ui))}),r.def(a,"[",n,"]")});case da:return o(function(t){return de.command(gt(t)&&2===t.length&&"number"==typeof t[0]&&"number"==typeof t[1]&&t[0]<=t[1],"depth range is 2d array",e.commandStr),t},function(t,e,r){return de.optional(function(){t.assert(e,t.shared.isArrayLike+"("+r+")&&"+r+".length===2&&typeof "+r+'[0]==="number"&&typeof '+r+'[1]==="number"&&'+r+"[0]<="+r+"[1]","depth range must be a 2d array")}),[e.def("+",r,"[0]"),e.def("+",r,"[1]")]});case ca:return o(function(t){de.commandType(t,"object","blend.func",e.commandStr);var r="srcRGB"in t?t.srcRGB:t.src,n="srcAlpha"in t?t.srcAlpha:t.src,a="dstRGB"in t?t.dstRGB:t.dst,i="dstAlpha"in t?t.dstAlpha:t.dst;return de.commandParameter(r,ji,s+".srcRGB",e.commandStr),de.commandParameter(n,ji,s+".srcAlpha",e.commandStr),de.commandParameter(a,ji,s+".dstRGB",e.commandStr),de.commandParameter(i,ji,s+".dstAlpha",e.commandStr),de.command(-1===Hi.indexOf(r+", "+a),"unallowed blending combination (srcRGB, dstRGB) = ("+r+", "+a+")",e.commandStr),[ji[r],ji[a],ji[n],ji[i]]},function(e,r,n){function a(a,o){var s=r.def('"',a,o,'" in ',n,"?",n,".",a,o,":",n,".",a);return de.optional(function(){e.assert(r,s+" in "+i,"invalid "+t+"."+a+o+", must be one of "+Object.keys(ji))}),s}var i=e.constants.blendFuncs;de.optional(function(){e.assert(r,n+"&&typeof "+n+'==="object"',"invalid blend func, must be an object")});var o=a("src","RGB"),s=a("dst","RGB");de.optional(function(){var t=e.constants.invalidBlendCombinations;e.assert(r,t+".indexOf("+o+'+", "+'+s+") === -1 ","unallowed blending combination for (srcRGB, dstRGB)")});var l=r.def(i,"[",o,"]"),u=r.def(i,"[",a("src","Alpha"),"]");return[l,r.def(i,"[",s,"]"),u,r.def(i,"[",a("dst","Alpha"),"]")]});case ua:return o(function(r){return"string"==typeof r?(de.commandParameter(r,Z,"invalid "+t,e.commandStr),[Z[r],Z[r]]):"object"==typeof r?(de.commandParameter(r.rgb,Z,t+".rgb",e.commandStr),de.commandParameter(r.alpha,Z,t+".alpha",e.commandStr),[Z[r.rgb],Z[r.alpha]]):void de.commandRaise("invalid blend.equation",e.commandStr)},function(e,r,n){var a=e.constants.blendEquations,i=r.def(),o=r.def(),s=e.cond("typeof ",n,'==="string"');return de.optional(function(){function r(t,r,n){e.assert(t,n+" in "+a,"invalid "+r+", must be one of "+Object.keys(Z))}r(s.then,t,n),e.assert(s.else,n+"&&typeof "+n+'==="object"',"invalid "+t),r(s.else,t+".rgb",n+".rgb"),r(s.else,t+".alpha",n+".alpha")}),s.then(i,"=",o,"=",a,"[",n,"];"),s.else(i,"=",a,"[",n,".rgb];",o,"=",a,"[",n,".alpha];"),r(s),[i,o]});case la:return o(function(t){return de.command(gt(t)&&4===t.length,"blend.color must be a 4d array",e.commandStr),Q(4,function(e){return+t[e]})},function(t,e,r){return de.optional(function(){t.assert(e,t.shared.isArrayLike+"("+r+")&&"+r+".length===4","blend.color must be a 4d array")}),Q(4,function(t){return e.def("+",r,"[",t,"]")})});case Ta:return o(function(t){return de.commandType(t,"number",s,e.commandStr),0|t},function(t,e,r){return de.optional(function(){t.assert(e,"typeof "+r+'==="number"',"invalid stencil.mask")}),e.def(r,"|0")});case Ea:return o(function(r){de.commandType(r,"object",s,e.commandStr);var n=r.cmp||"keep",a=r.ref||0,i="mask"in r?r.mask:-1;return de.commandParameter(n,Ui,t+".cmp",e.commandStr),de.commandType(a,"number",t+".ref",e.commandStr),de.commandType(i,"number",t+".mask",e.commandStr),[Ui[n],a,i]},function(t,e,r){var n=t.constants.compareFuncs;return de.optional(function(){function a(){t.assert(e,Array.prototype.join.call(arguments,""),"invalid stencil.func")}a(r+"&&typeof ",r,'==="object"'),a('!("cmp" in ',r,")||(",r,".cmp in ",n,")")}),[e.def('"cmp" in ',r,"?",n,"[",r,".cmp]",":",Ri),e.def(r,".ref|0"),e.def('"mask" in ',r,"?",r,".mask|0:-1")]});case La:case Sa:return o(function(r){de.commandType(r,"object",s,e.commandStr);var n=r.fail||"keep",a=r.zfail||"keep",i=r.zpass||"keep";return de.commandParameter(n,Vi,t+".fail",e.commandStr),de.commandParameter(a,Vi,t+".zfail",e.commandStr),de.commandParameter(i,Vi,t+".zpass",e.commandStr),[t===Sa?Ei:Ti,Vi[n],Vi[a],Vi[i]]},function(e,r,n){function a(a){return de.optional(function(){e.assert(r,'!("'+a+'" in '+n+")||("+n+"."+a+" in "+i+")","invalid "+t+"."+a+", must be one of "+Object.keys(Vi))}),r.def('"',a,'" in ',n,"?",i,"[",n,".",a,"]:",Ri)}var i=e.constants.stencilOps;return de.optional(function(){e.assert(r,n+"&&typeof "+n+'==="object"',"invalid "+t)}),[t===Sa?Ei:Ti,a("fail"),a("zfail"),a("zpass")]});case _a:return o(function(t){de.commandType(t,"object",s,e.commandStr);var r=0|t.factor,n=0|t.units;return de.commandType(r,"number",s+".factor",e.commandStr),de.commandType(n,"number",s+".units",e.commandStr),[r,n]},function(e,r,n){return de.optional(function(){e.assert(r,n+"&&typeof "+n+'==="object"',"invalid "+t)}),[r.def(n,".factor|0"),r.def(n,".units|0")]});case va:return o(function(t){var r=0;return"front"===t?r=Ti:"back"===t&&(r=Ei),de.command(!!r,s,e.commandStr),r},function(t,e,r){return de.optional(function(){t.assert(e,r+'==="front"||'+r+'==="back"',"invalid cull.face")}),e.def(r,'==="front"?',Ti,":",Ei)});case ba:return o(function(t){return de.command("number"==typeof t&&t>=n.lineWidthDims[0]&&t<=n.lineWidthDims[1],"invalid line width, must positive number between "+n.lineWidthDims[0]+" and "+n.lineWidthDims[1],e.commandStr),t},function(t,e,r){return de.optional(function(){t.assert(e,"typeof "+r+'==="number"&&'+r+">="+n.lineWidthDims[0]+"&&"+r+"<="+n.lineWidthDims[1],"invalid line width")}),r});case ya:return o(function(t){return de.commandParameter(t,qi,s,e.commandStr),qi[t]},function(t,e,r){return de.optional(function(){t.assert(e,r+'==="cw"||'+r+'==="ccw"',"invalid frontFace, must be one of cw,ccw")}),e.def(r+'==="cw"?'+Li+":"+Si)});case ga:return o(function(t){return de.command(gt(t)&&4===t.length,"color.mask must be length 4 array",e.commandStr),t.map(function(t){return!!t})},function(t,e,r){return de.optional(function(){t.assert(e,t.shared.isArrayLike+"("+r+")&&"+r+".length===4","invalid color.mask")}),Q(4,function(t){return"!!"+r+"["+t+"]"})});case ka:return o(function(t){de.command("object"==typeof t&&t,s,e.commandStr);var r="value"in t?t.value:1,n=!!t.invert;return de.command("number"==typeof r&&r>=0&&r<=1,"sample.coverage.value must be a number between 0 and 1",e.commandStr),[r,n]},function(t,e,r){return de.optional(function(){t.assert(e,r+"&&typeof "+r+'==="object"',"invalid sample.coverage")}),[e.def('"value" in ',r,"?+",r,".value:1"),e.def("!!",r,".invert")]})}}),i}function M(t,e){var r=t.static,n=t.dynamic,a={};return Object.keys(r).forEach(function(t){var n,i=r[t];if("number"==typeof i||"boolean"==typeof i)n=qt(function(){return i});else if("function"==typeof i){var o=i._reglType;"texture2d"===o||"textureCube"===o?n=qt(function(t){return t.link(i)}):"framebuffer"===o||"framebufferCube"===o?(de.command(i.color.length>0,'missing color attachment for framebuffer sent to uniform "'+t+'"',e.commandStr),n=qt(function(t){return t.link(i.color[0])})):de.commandRaise('invalid data for uniform "'+t+'"',e.commandStr)}else gt(i)?n=qt(function(e){return e.global.def("[",Q(i.length,function(r){return de.command("number"==typeof i[r]||"boolean"==typeof i[r],"invalid uniform "+t,e.commandStr),i[r]}),"]")}):de.commandRaise('invalid or missing data for uniform "'+t+'"',e.commandStr);n.value=i,a[t]=n}),Object.keys(n).forEach(function(t){var e=n[t];a[t]=Xt(e,function(t,r){return t.invoke(r,e)})}),a}function T(t,r){var n=t.static,i=t.dynamic,o={};return Object.keys(n).forEach(function(t){var i=n[t],s=e.id(t),l=new W;if(Ht(i))l.state=Jn,l.buffer=a.getBuffer(a.create(i,Za,!1,!0)),l.type=0;else{var u=a.getBuffer(i);if(u)l.state=Jn,l.buffer=u,l.type=0;else if(de.command("object"==typeof i&&i,"invalid data for attribute "+t,r.commandStr),i.constant){var c=i.constant;l.buffer="null",l.state=ta,"number"==typeof c?l.x=c:(de.command(gt(c)&&c.length>0&&c.length<=4,"invalid constant for attribute "+t,r.commandStr),$n.forEach(function(t,e){e=0,'invalid offset for attribute "'+t+'"',r.commandStr);var h=0|i.stride +;de.command(h>=0&&h<256,'invalid stride for attribute "'+t+'", must be integer betweeen [0, 255]',r.commandStr);var d=0|i.size;de.command(!("size"in i)||d>0&&d<=4,'invalid size for attribute "'+t+'", must be 1,2,3,4',r.commandStr);var p=!!i.normalized,g=0;"type"in i&&(de.commandParameter(i.type,Oe,"invalid type for attribute "+t,r.commandStr),g=Oe[i.type]);var m=0|i.divisor;"divisor"in i&&(de.command(0===m||$,'cannot specify divisor for attribute "'+t+'", instancing not supported',r.commandStr),de.command(m>=0,'invalid divisor for attribute "'+t+'"',r.commandStr)),de.optional(function(){var e=r.commandStr,n=["buffer","offset","divisor","normalized","type","size","stride"];Object.keys(i).forEach(function(r){de.command(n.indexOf(r)>=0,'unknown parameter "'+r+'" for attribute pointer "'+t+'" (valid parameters are '+n+")",e)})}),l.buffer=u,l.state=Jn,l.size=d,l.normalized=p,l.type=g||u.dtype,l.offset=f,l.stride=h,l.divisor=m}}o[t]=qt(function(t,e){var r=t.attribCache;if(s in r)return r[s];var n={isStream:!1};return Object.keys(l).forEach(function(t){n[t]=l[t]}),l.buffer&&(n.buffer=t.link(l.buffer),n.type=n.type||n.buffer+".dtype"),r[s]=n,n})}),Object.keys(i).forEach(function(t){function e(e,n){function a(t){n(u[t],"=",i,".",t,"|0;")}var i=e.invoke(n,r),o=e.shared,s=o.isBufferArgs,l=o.buffer;de.optional(function(){e.assert(n,i+"&&(typeof "+i+'==="object"||typeof '+i+'==="function")&&('+s+"("+i+")||"+l+".getBuffer("+i+")||"+l+".getBuffer("+i+".buffer)||"+s+"("+i+'.buffer)||("constant" in '+i+"&&(typeof "+i+'.constant==="number"||'+o.isArrayLike+"("+i+".constant))))",'invalid dynamic attribute "'+t+'"')});var u={isStream:n.def(!1)},c=new W;c.state=Jn,Object.keys(c).forEach(function(t){u[t]=n.def(""+c[t])});var f=u.buffer,h=u.type;return n("if(",s,"(",i,")){",u.isStream,"=true;",f,"=",l,".createStream(",Za,",",i,");",h,"=",f,".dtype;","}else{",f,"=",l,".getBuffer(",i,");","if(",f,"){",h,"=",f,".dtype;",'}else if("constant" in ',i,"){",u.state,"=",ta,";","if(typeof "+i+'.constant === "number"){',u[$n[0]],"=",i,".constant;",$n.slice(1).map(function(t){return u[t]}).join("="),"=0;","}else{",$n.map(function(t,e){return u[t]+"="+i+".constant.length>="+e+"?"+i+".constant["+e+"]:0;"}).join(""),"}}else{","if(",s,"(",i,".buffer)){",f,"=",l,".createStream(",Za,",",i,".buffer);","}else{",f,"=",l,".getBuffer(",i,".buffer);","}",h,'="type" in ',i,"?",o.glTypes,"[",i,".type]:",f,".dtype;",u.normalized,"=!!",i,".normalized;"),a("size"),a("offset"),a("stride"),a("divisor"),n("}}"),n.exit("if(",u.isStream,"){",l,".destroyStream(",f,");","}"),u}var r=i[t];o[t]=Xt(r,e)}),o}function E(t){var e=t.static,r=t.dynamic,n={};return Object.keys(e).forEach(function(t){var r=e[t];n[t]=qt(function(t,e){return"number"==typeof r||"boolean"==typeof r?""+r:t.link(r)})}),Object.keys(r).forEach(function(t){var e=r[t];n[t]=Xt(e,function(t,r){return t.invoke(r,e)})}),n}function L(t,e,r,n,a){function i(t){var e=u[t];e&&(f[t]=e)}var o=t.static,s=t.dynamic;de.optional(function(){function t(t){Object.keys(t).forEach(function(t){de.command(e.indexOf(t)>=0,'unknown parameter "'+t+'"',a.commandStr)})}var e=[Da,Pa,za,Na,Fa,ja,Ba,Ha,Ra].concat(et);t(o),t(s)});var l=x(t,a),u=_(t,l,a),c=A(t,a),f=k(t,a),h=w(t,a);i(Ia),i(g(Oa));var d=Object.keys(f).length>0,p={framebuffer:l,draw:c,shader:h,state:f,dirty:d};return p.profile=b(t,a),p.uniforms=M(r,a),p.attributes=T(e,a),p.context=E(n,a),p}function S(t,e,r){var n=t.shared,a=n.context,i=t.scope();Object.keys(r).forEach(function(n){e.save(a,"."+n);var o=r[n];i(a,".",n,"=",o.append(t,e),";")}),e(i)}function C(t,e,r,n){var a,i=t.shared,o=i.gl,s=i.framebuffer;K&&(a=e.def(i.extensions,".webgl_draw_buffers"));var l,u=t.constants,c=u.drawBuffer,f=u.backBuffer;l=r?r.append(t,e):e.def(s,".next"),n||e("if(",l,"!==",s,".cur){"),e("if(",l,"){",o,".bindFramebuffer(",Fi,",",l,".framebuffer);"),K&&e(a,".drawBuffersWEBGL(",c,"[",l,".colorAttachments.length]);"),e("}else{",o,".bindFramebuffer(",Fi,",null);"),K&&e(a,".drawBuffersWEBGL(",f,");"),e("}",s,".cur=",l,";"),n||e("}")}function O(t,e,r){var n=t.shared,a=n.gl,i=t.current,o=t.next,s=n.current,l=n.next,u=t.cond(s,".dirty");et.forEach(function(e){var n=g(e);if(!(n in r.state)){var c,f;if(n in o){c=o[n],f=i[n];var h=Q(J[n].length,function(t){return u.def(c,"[",t,"]")});u(t.cond(h.map(function(t,e){return t+"!=="+f+"["+e+"]"}).join("||")).then(a,".",nt[n],"(",h,");",h.map(function(t,e){return f+"["+e+"]="+t}).join(";"),";"))}else{c=u.def(l,".",n);var d=t.cond(c,"!==",s,".",n);u(d),n in rt?d(t.cond(c).then(a,".enable(",rt[n],");").else(a,".disable(",rt[n],");"),s,".",n,"=",c,";"):d(a,".",nt[n],"(",c,");",s,".",n,"=",c,";")}}}),0===Object.keys(r.state).length&&u(s,".dirty=false;"),e(u)}function I(t,e,r,n){var a=t.shared,i=t.current,o=a.current,s=a.gl;Ut(Object.keys(r)).forEach(function(a){var l=r[a];if(!n||n(l)){var u=l.append(t,e);if(rt[a]){var c=rt[a];Gt(l)?u?e(s,".enable(",c,");"):e(s,".disable(",c,");"):e(t.cond(u).then(s,".enable(",c,");").else(s,".disable(",c,");")),e(o,".",a,"=",u,";")}else if(gt(u)){var f=i[a];e(s,".",nt[a],"(",u,");",u.map(function(t,e){return f+"["+e+"]="+t}).join(";"),";")}else e(s,".",nt[a],"(",u,");",o,".",a,"=",u,";")}})}function R(t,e){$&&(t.instancing=e.def(t.shared.extensions,".angle_instanced_arrays"))}function D(t,e,r,n,a){function i(){return"undefined"==typeof performance?"Date.now()":"performance.now()"}function o(t){u=e.def(),t(u,"=",i(),";"),"string"==typeof a?t(p,".count+=",a,";"):t(p,".count++;"),d&&(n?(c=e.def(),t(c,"=",m,".getNumPendingQueries();")):t(m,".beginQuery(",p,");"))}function s(t){t(p,".cpuTime+=",i(),"-",u,";"),d&&(n?t(m,".pushScopeStats(",c,",",m,".getNumPendingQueries(),",p,");"):t(m,".endQuery();"))}function l(t){var r=e.def(g,".profile");e(g,".profile=",t,";"),e.exit(g,".profile=",r,";")}var u,c,f,h=t.shared,p=t.stats,g=h.current,m=h.timer,v=r.profile;if(v){if(Gt(v))return void(v.enable?(o(e),s(e.exit),l("true")):l("false"));f=v.append(t,e),l(f)}else f=e.def(g,".profile");var y=t.block();o(y),e("if(",f,"){",y,"}");var b=t.block();s(b),e.exit("if(",f,"){",b,"}")}function P(t,e,r,n,a){function i(t){switch(t){case ui:case di:case vi:return 2;case ci:case pi:case yi:return 3;case fi:case gi:case bi:return 4;default:return 1}}function o(r,n,a){function i(){e("if(!",c,".buffer){",l,".enableVertexAttribArray(",u,");}");var r,i=a.type;if(r=a.size?e.def(a.size,"||",n):n,e("if(",c,".type!==",i,"||",c,".size!==",r,"||",p.map(function(t){return c+"."+t+"!=="+a[t]}).join("||"),"){",l,".bindBuffer(",Za,",",h,".buffer);",l,".vertexAttribPointer(",[u,r,i,a.normalized,a.stride,a.offset],");",c,".type=",i,";",c,".size=",r,";",p.map(function(t){return c+"."+t+"="+a[t]+";"}).join(""),"}"),$){var o=a.divisor;e("if(",c,".divisor!==",o,"){",t.instancing,".vertexAttribDivisorANGLE(",[u,o],");",c,".divisor=",o,";}")}}function o(){e("if(",c,".buffer){",l,".disableVertexAttribArray(",u,");","}if(",$n.map(function(t,e){return c+"."+t+"!=="+d[e]}).join("||"),"){",l,".vertexAttrib4f(",u,",",d,");",$n.map(function(t,e){return c+"."+t+"="+d[e]+";"}).join(""),"}")}var l=s.gl,u=e.def(r,".location"),c=e.def(s.attributes,"[",u,"]"),f=a.state,h=a.buffer,d=[a.x,a.y,a.z,a.w],p=["buffer","normalized","offset","stride"];f===Jn?i():f===ta?o():(e("if(",f,"===",Jn,"){"),i(),e("}else{"),o(),e("}"))}var s=t.shared;n.forEach(function(n){var s,l=n.name,u=r.attributes[l];if(u){if(!a(u))return;s=u.append(t,e)}else{if(!a(Xi))return;var c=t.scopeAttrib(l);de.optional(function(){t.assert(e,c+".state","missing attribute "+l)}),s={},Object.keys(new W).forEach(function(t){s[t]=e.def(c,".",t)})}o(t.link(n),i(n.info.type),s)})}function z(t,r,n,a,i){for(var o,s=t.shared,l=s.gl,u=0;u1?Q(_,function(t){return c+"["+t+"]"}):c);r(");")}}function N(t,e,r,n){function a(a){var i=c[a];return i?i.contextDep&&n.contextDynamic||i.propDep?i.append(t,r):i.append(t,e):e.def(u,".",a)}function i(){function t(){r(m,".drawElementsInstancedANGLE(",[h,p,v,d+"<<(("+v+"-"+Kn+")>>1)",g],");")}function e(){r(m,".drawArraysInstancedANGLE(",[h,d,p,g],");")}f?y?t():(r("if(",f,"){"),t(),r("}else{"),e(),r("}")):e()}function o(){function t(){r(l+".drawElements("+[h,p,v,d+"<<(("+v+"-"+Kn+")>>1)"]+");")}function e(){r(l+".drawArrays("+[h,d,p]+");")}f?y?t():(r("if(",f,"){"),t(),r("}else{"),e(),r("}")):e()}var s=t.shared,l=s.gl,u=s.draw,c=n.draw,f=function(){var a,i=c.elements,o=e;return i?((i.contextDep&&n.contextDynamic||i.propDep)&&(o=r),a=i.append(t,o)):a=o.def(u,".",Na),a&&o("if("+a+")"+l+".bindBuffer("+Qa+","+a+".buffer.buffer);"),a}(),h=a(Fa),d=a(ja),p=function(){var a,i=c.count,o=e;return i?((i.contextDep&&n.contextDynamic||i.propDep)&&(o=r),a=i.append(t,o),de.optional(function(){i.MISSING&&t.assert(e,"false","missing vertex count"),i.DYNAMIC&&t.assert(o,a+">=0","missing vertex count")})):(a=o.def(u,".",Ba),de.optional(function(){t.assert(o,a+">=0","missing vertex count")})),a}();if("number"==typeof p){if(0===p)return}else r("if(",p,"){"),r.exit("}");var g,m;$&&(g=a(Ha),m=t.instancing);var v=f+".type",y=c.elements&&Gt(c.elements);$&&("number"!=typeof g||g>=0)?"string"==typeof g?(r("if(",g,">0){"),i(),r("}else if(",g,"<0){"),o(),r("}")):i():o()}function F(t,e,r,n,a){var i=y(),o=i.proc("body",a);return de.optional(function(){i.commandStr=e.commandStr,i.command=i.link(e.commandStr)}),$&&(i.instancing=o.def(i.shared.extensions,".angle_instanced_arrays")),t(i,o,r,n),i.compile().body}function B(t,e,r,n){R(t,e),P(t,e,r,n.attributes,function(){return!0}),z(t,e,r,n.uniforms,function(){return!0}),N(t,e,e,r)}function j(t,e){var r=t.proc("draw",1);R(t,r),S(t,r,e.context),C(t,r,e.framebuffer),O(t,r,e),I(t,r,e.state),D(t,r,e,!1,!0);var n=e.shader.progVar.append(t,r);if(r(t.shared.gl,".useProgram(",n,".program);"),e.shader.program)B(t,r,e,e.shader.program);else{var a=t.global.def("{}"),i=r.def(n,".id"),o=r.def(a,"[",i,"]");r(t.cond(o).then(o,".call(this,a0);").else(o,"=",a,"[",i,"]=",t.link(function(r){return F(B,t,e,r,1)}),"(",n,");",o,".call(this,a0);"))}Object.keys(e.state).length>0&&r(t.shared.current,".dirty=true;")}function H(t,e,r,n){function a(){return!0}t.batchId="a1",R(t,e),P(t,e,r,n.attributes,a),z(t,e,r,n.uniforms,a),N(t,e,e,r)}function U(t,e,r,n){function a(t){return t.contextDep&&o||t.propDep}function i(t){return!a(t)}R(t,e);var o=r.contextDep,s=e.def(),l=e.def();t.shared.props=l,t.batchId=s;var u=t.scope(),c=t.scope();if(e(u.entry,"for(",s,"=0;",s,"<","a1",";++",s,"){",l,"=","a0","[",s,"];",c,"}",u.exit),r.needsContext&&S(t,c,r.context),r.needsFramebuffer&&C(t,c,r.framebuffer),I(t,c,r.state,a),r.profile&&a(r.profile)&&D(t,c,r,!1,!0),n)P(t,u,r,n.attributes,i),P(t,c,r,n.attributes,a),z(t,u,r,n.uniforms,i),z(t,c,r,n.uniforms,a),N(t,u,c,r);else{var f=t.global.def("{}"),h=r.shader.progVar.append(t,c),d=c.def(h,".id"),p=c.def(f,"[",d,"]");c(t.shared.gl,".useProgram(",h,".program);","if(!",p,"){",p,"=",f,"[",d,"]=",t.link(function(e){return F(H,t,r,e,2)}),"(",h,");}",p,".call(this,a0[",s,"],",s,");")}}function V(t,e){function r(t){return t.contextDep&&a||t.propDep}var n=t.proc("batch",2);t.batchId="0",R(t,n);var a=!1,i=!0;Object.keys(e.context).forEach(function(t){a=a||e.context[t].propDep}),a||(S(t,n,e.context),i=!1);var o=e.framebuffer,s=!1;o?(o.propDep?a=s=!0:o.contextDep&&a&&(s=!0),s||C(t,n,o)):C(t,n,null),e.state.viewport&&e.state.viewport.propDep&&(a=!0),O(t,n,e),I(t,n,e.state,function(t){return!r(t)}),e.profile&&r(e.profile)||D(t,n,e,!1,"a1"),e.contextDep=a,e.needsContext=i,e.needsFramebuffer=s;var l=e.shader.progVar;if(l.contextDep&&a||l.propDep)U(t,n,e,null);else{var u=l.append(t,n);if(n(t.shared.gl,".useProgram(",u,".program);"),e.shader.program)U(t,n,e,e.shader.program);else{var c=t.global.def("{}"),f=n.def(u,".id"),h=n.def(c,"[",f,"]");n(t.cond(h).then(h,".call(this,a0,a1);").else(h,"=",c,"[",f,"]=",t.link(function(r){return F(U,t,e,r,2)}),"(",u,");",h,".call(this,a0,a1);"))}}Object.keys(e.state).length>0&&n(t.shared.current,".dirty=true;")}function G(t,r){function n(e){var n=r.shader[e];n&&a.set(i.shader,"."+e,n.append(t,a))}var a=t.proc("scope",3);t.batchId="a2";var i=t.shared,o=i.current;S(t,a,r.context),r.framebuffer&&r.framebuffer.append(t,a),Ut(Object.keys(r.state)).forEach(function(e){var n=r.state[e],o=n.append(t,a);gt(o)?o.forEach(function(r,n){a.set(t.next[e],"["+n+"]",r)}):a.set(i.next,"."+e,o)}),D(t,a,r,!0,!0),[Na,ja,Ba,Ha,Fa].forEach(function(e){var n=r.draw[e];n&&a.set(i.draw,"."+e,""+n.append(t,a))}),Object.keys(r.uniforms).forEach(function(n){a.set(i.uniforms,"["+e.id(n)+"]",r.uniforms[n].append(t,a))}),Object.keys(r.attributes).forEach(function(e){var n=r.attributes[e].append(t,a),i=t.scopeAttrib(e);Object.keys(new W).forEach(function(t){a.set(i,"."+t,n[t])})}),n(Pa),n(za),Object.keys(r.state).length>0&&(a(o,".dirty=true;"),a.exit(o,".dirty=true;")),a("a1(",t.shared.context,",a0,",t.batchId,");")}function q(t){if("object"==typeof t&&!gt(t)){for(var e=Object.keys(t),r=0;r=0;--t){var r=G[t];r&&r(L,null,0)}v.flush(),k&&k.update()}function r(){!Q&&G.length>0&&(Q=ve.next(e))}function n(){Q&&(ve.cancel(e),Q=null)}function a(t){t.preventDefault(),b=!0,n(),q.forEach(function(t){t()})}function i(t){v.getError(),b=!1,x.restore(),P.restore(),I.restore(),z.restore(),N.restore(),F.restore(),k&&k.restore(),B.procs.refresh(),r(),X.forEach(function(t){t()})}function o(){G.length=0,n(),V&&(V.removeEventListener(eo,a),V.removeEventListener(ro,i)),P.clear(),F.clear(),N.clear(),z.clear(),R.clear(),I.clear(),k&&k.clear(),Z.forEach(function(t){t()})}function s(t){function e(t){var e={},r={};return Object.keys(t).forEach(function(n){var a=t[n];me.isDynamic(a)?r[n]=me.unbox(a,n):e[n]=a}),{dynamic:r,static:e}}function r(t){for(;d.length0)return f.call(this,r(0|t),0|t)}else{if(!Array.isArray(t))return c.call(this,t);if(t.length)return f.call(this,t,t.length)}}de(!!t,"invalid args to regl({...})"),de.type(t,"object","invalid args to regl({...})");var a=e(t.context||{}),i=e(t.uniforms||{}),o=e(t.attributes||{}),s=e(function(t){function e(t){if(t in r){var e=r[t];delete r[t],Object.keys(e).forEach(function(n){r[t+"."+n]=e[n]})}}var r=Jt({},t);return delete r.uniforms,delete r.attributes,delete r.context,"stencil"in r&&r.stencil.op&&(r.stencil.opBack=r.stencil.opFront=r.stencil.op,delete r.stencil.op),e("blend"),e("depth"),e("cull"),e("stencil"),e("polygonOffset"),e("scissor"),e("sample"),r}(t)),l={gpuTime:0,cpuTime:0,count:0},u=B.compile(s,o,i,a,l),c=u.draw,f=u.batch,h=u.scope,d=[];return Jt(n,{stats:l})}function l(t,e){var r=0;B.procs.poll();var n=e.color;n&&(v.clearColor(+n[0]||0,+n[1]||0,+n[2]||0,+n[3]||0),r|=$i),"depth"in e&&(v.clearDepth(+e.depth),r|=Ki),"stencil"in e&&(v.clearStencil(0|e.stencil),r|=Ji),de(!!r,"called regl.clear with no buffer specified"),v.clear(r)}function u(t){if(de("object"==typeof t&&t,"regl.clear() takes an object as input"),"framebuffer"in t)if(t.framebuffer&&"framebufferCube"===t.framebuffer_reglType)for(var e=0;e<6;++e)$(Jt({framebuffer:t.framebuffer.faces[e]},t),l);else $(t,l);else l(null,t)}function c(t){function e(){function e(){var t=Zt(G,e);G[t]=G[G.length-1],G.length-=1,G.length<=0&&n()}var r=Zt(G,t);de(r>=0,"cannot cancel a frame twice"),G[r]=e}return de.type(t,"function","regl.frame() callback must be a function"),G.push(t),r(),{cancel:e}}function f(){var t=U.viewport,e=U.scissor_box;t[0]=t[1]=e[0]=e[1]=0,L.viewportWidth=L.framebufferWidth=L.drawingBufferWidth=t[2]=e[2]=v.drawingBufferWidth,L.viewportHeight=L.framebufferHeight=L.drawingBufferHeight=t[3]=e[3]=v.drawingBufferHeight}function h(){L.tick+=1,L.time=p(),f(),B.procs.poll()}function d(){f(),B.procs.refresh(),k&&k.update()}function p(){return(ye()-M)/1e3}function g(t,e){de.type(e,"function","listener callback must be a function");var r;switch(t){case"frame":return c(e);case"lost":r=q;break;case"restore":r=X;break;case"destroy":r=Z;break;default:de.raise("invalid event, must be one of frame,lost,restore,destroy")}return r.push(e),{cancel:function(){for(var t=0;t=0},read:H,destroy:o,_gl:v,_refresh:d,poll:function(){h(),k&&k.update()},now:p,stats:w});return m.onDone(null,K),K}var $t={"[object Int8Array]":5120,"[object Int16Array]":5122,"[object Int32Array]":5124,"[object Uint8Array]":5121,"[object Uint8ClampedArray]":5121,"[object Uint16Array]":5123,"[object Uint32Array]":5125,"[object Float32Array]":5126,"[object Float64Array]":5121,"[object ArrayBuffer]":5121},Kt=function(t){return Object.prototype.toString.call(t)in $t},Jt=function(t,e){for(var r=Object.keys(e),n=0;n=2,"invalid renderbuffer shape"),i=0|d[0],o=0|d[1]}else"radius"in h&&(i=o=0|h.radius),"width"in h&&(i=0|h.width),"height"in h&&(o=0|h.height);"format"in h&&(de.parameter(h.format,u,"invalid renderbuffer format"),l=u[h.format])}else"number"==typeof e?(i=0|e,o="number"==typeof n?0|n:i):e?de.raise("invalid arguments to renderbuffer constructor"):i=o=1;if(de(i>0&&o>0&&i<=r.maxRenderbufferSize&&o<=r.maxRenderbufferSize,"invalid renderbuffer size"),i!==f.width||o!==f.height||l!==f.format)return s.width=f.width=i,s.height=f.height=o,f.format=l,t.bindRenderbuffer(xn,f.renderbuffer),t.renderbufferStorage(xn,l,i,o),a.profile&&(f.stats.size=It(f.format,f.width,f.height)),s.format=c[f.format],s}function l(e,n){var i=0|e,o=0|n||i;return i===f.width&&o===f.height?s:(de(i>0&&o>0&&i<=r.maxRenderbufferSize&&o<=r.maxRenderbufferSize,"invalid renderbuffer size"),s.width=f.width=i,s.height=f.height=o,t.bindRenderbuffer(xn,f.renderbuffer),t.renderbufferStorage(xn,f.format,i,o),a.profile&&(f.stats.size=It(f.format,f.width,f.height)),s)}var f=new i(t.createRenderbuffer());return h[f.id]=f,n.renderbufferCount++,s(e,o),s.resize=l,s._reglType="renderbuffer",s._renderbuffer=f,a.profile&&(s.stats=f.stats),s.destroy=function(){f.decRef()},s}function l(){xe(h).forEach(function(e){e.renderbuffer=t.createRenderbuffer(),t.bindRenderbuffer(xn,e.renderbuffer),t.renderbufferStorage(xn,e.format,e.width,e.height)}),t.bindRenderbuffer(xn,null)}var u={rgba4:_n,rgb565:36194,"rgb5 a1":32855,depth:33189,stencil:36168,"depth stencil":34041};e.ext_srgb&&(u.srgba=35907),e.ext_color_buffer_half_float&&(u.rgba16f=34842,u.rgb16f=34843),e.webgl_color_buffer_float&&(u.rgba32f=34836);var c=[];Object.keys(u).forEach(function(t){var e=u[t];c[e]=t}) +;var f=0,h={};return i.prototype.decRef=function(){--this.refCount<=0&&o(this)},a.profile&&(n.getTotalRenderbufferSize=function(){var t=0;return Object.keys(h).forEach(function(e){t+=h[e].stats.size}),t}),{create:s,clear:function(){xe(h).forEach(o)},restore:l}},kn=36160,Mn=36161,Tn=3553,En=34069,Ln=36064,Sn=36096,Cn=36128,On=33306,In=36053,Rn=6402,Dn=[6408],Pn=[];Pn[6408]=4;var zn=[];zn[5121]=1,zn[5126]=4,zn[36193]=2;var Nn=33189,Fn=36168,Bn=34041,jn=[32854,32855,36194,35907,34842,34843,34836],Hn={};Hn[In]="complete",Hn[36054]="incomplete attachment",Hn[36057]="incomplete dimensions",Hn[36055]="incomplete, missing attachment",Hn[36061]="unsupported";var Un=5126,Vn=35632,Gn=35633,qn=35718,Xn=35721,Yn=6408,Wn=5121,Zn=3333,Qn=5126,$n="xyzw".split(""),Kn=5121,Jn=1,ta=2,ea=0,ra=1,na=2,aa=3,ia=4,oa="dither",sa="blend.enable",la="blend.color",ua="blend.equation",ca="blend.func",fa="depth.enable",ha="depth.func",da="depth.range",pa="depth.mask",ga="colorMask",ma="cull.enable",va="cull.face",ya="frontFace",ba="lineWidth",xa="polygonOffset.enable",_a="polygonOffset.offset",wa="sample.alpha",Aa="sample.enable",ka="sample.coverage",Ma="stencil.enable",Ta="stencil.mask",Ea="stencil.func",La="stencil.opFront",Sa="stencil.opBack",Ca="scissor.enable",Oa="scissor.box",Ia="viewport",Ra="profile",Da="framebuffer",Pa="vert",za="frag",Na="elements",Fa="primitive",Ba="count",ja="offset",Ha="instances",Ua=Da+"Width",Va=Da+"Height",Ga=Ia+"Width",qa=Ia+"Height",Xa="drawingBufferWidth",Ya="drawingBufferHeight",Wa=[ca,ua,Ea,La,Sa,ka,Ia,Oa,_a],Za=34962,Qa=34963,$a=3553,Ka=34067,Ja=2884,ti=3042,ei=3024,ri=2960,ni=2929,ai=3089,ii=32823,oi=32926,si=32928,li=5126,ui=35664,ci=35665,fi=35666,hi=5124,di=35667,pi=35668,gi=35669,mi=35670,vi=35671,yi=35672,bi=35673,xi=35674,_i=35675,wi=35676,Ai=35678,ki=35680,Mi=4,Ti=1028,Ei=1029,Li=2304,Si=2305,Ci=32775,Oi=32776,Ii=519,Ri=7680,Di=0,Pi=1,zi=32774,Ni=513,Fi=36160,Bi=36064,ji={0:0,1:1,zero:0,one:1,"src color":768,"one minus src color":769,"src alpha":770,"one minus src alpha":771,"dst color":774,"one minus dst color":775,"dst alpha":772,"one minus dst alpha":773,"constant color":32769,"one minus constant color":32770,"constant alpha":32771,"one minus constant alpha":32772,"src alpha saturate":776},Hi=["constant color, constant alpha","one minus constant color, constant alpha","constant color, one minus constant alpha","one minus constant color, one minus constant alpha","constant alpha, constant color","constant alpha, one minus constant color","one minus constant alpha, constant color","one minus constant alpha, one minus constant color"],Ui={never:512,less:513,"<":513,equal:514,"=":514,"==":514,"===":514,lequal:515,"<=":515,greater:516,">":516,notequal:517,"!=":517,"!==":517,gequal:518,">=":518,always:519},Vi={0:0,zero:0,keep:7680,replace:7681,increment:7682,decrement:7683,"increment wrap":34055,"decrement wrap":34056,invert:5386},Gi={frag:35632,vert:35633},qi={cw:Li,ccw:Si},Xi=new Vt(!1,!1,!1,function(){}),Yi=34918,Wi=34919,Zi=35007,Qi=function(t,e){function r(){return h.pop()||f.createQueryEXT()}function n(t){h.push(t)}function a(t){var e=r();f.beginQueryEXT(Zi,e),d.push(e),u(d.length-1,d.length,t)}function i(){f.endQueryEXT(Zi)}function o(){this.startQueryIndex=-1,this.endQueryIndex=-1,this.sum=0,this.stats=null}function s(){return p.pop()||new o}function l(t){p.push(t)}function u(t,e,r){var n=s();n.startQueryIndex=t,n.endQueryIndex=e,n.sum=0,n.stats=r,g.push(n)}function c(){var t,e,r=d.length;if(0!==r){v.length=Math.max(v.length,r+1),m.length=Math.max(m.length,r+1),m[0]=0,v[0]=0;var a=0;for(t=0,e=0;e=r)return i.substr(0,r);for(;r>i.length&&e>1;)1&e&&(i+=t),e>>=1,t+=t;return i+=t,i=i.substr(0,r)}var a,i="";e.exports=n},{}],181:[function(t,e,r){"use strict";function n(t,e){for(var r=new Array(t.length-1),n=1;n>1;return["sum(",i(t.slice(0,e)),",",i(t.slice(e)),")"].join("")}function o(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 o(e,t)}function s(t){return!0&t?"-":""}function l(t){if(2===t.length)return[["diff(",o(t[0][0],t[1][1]),",",o(t[1][0],t[0][1]),")"].join("")];for(var e=[],r=0;r>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;r0){if(i<=0)return o;n=a+i}else{if(!(a<0))return o;if(i>=0)return o;n=-(a+i)}var s=3.3306690738754716e-16*n;return o>=s||o<=-s?o:g(t,e,r)},function(t,e,r,n){var a=t[0]-n[0],i=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=i*u,p=o*l,g=o*s,v=a*u,y=a*l,b=i*s,x=c*(d-p)+f*(g-v)+h*(y-b),_=(Math.abs(d)+Math.abs(p))*Math.abs(c)+(Math.abs(g)+Math.abs(v))*Math.abs(f)+(Math.abs(y)+Math.abs(b))*Math.abs(h),w=7.771561172376103e-16*_;return x>w||-x>w?x:m(t,e,r,n)}];!function(){for(;v.length<=p;)v.push(l(v.length));for(var t=[],r=["slow"],n=0;n<=p;++n)t.push("a"+n),r.push("o"+n);for(var a=["function getOrientation(",t.join(),"){switch(arguments.length){case 0:case 1:return 0;"],n=2;n<=p;++n)a.push("case ",n,":return o",n,"(",t.slice(0,n).join(),");");a.push("}var s=new Array(arguments.length);for(var i=0;i0&&s>0||o<0&&s<0)return!1;var l=i(r,t,e),u=i(a,t,e);return!(l>0&&u>0||l<0&&u<0)&&(0!==o||0!==s||0!==l||0!==u||n(t,e,r,a))}e.exports=a;var i=t("robust-orientation")[3]},{"robust-orientation":182}],186:[function(t,e,r){"use strict";function n(t,e){var r=t+e,n=r-t,a=r-n,i=e-n,o=t-a,s=o+i;return s?[s,r]:[r]}function a(t,e){var r=0|t.length,a=0|e.length;if(1===r&&1===a)return n(t[0],-e[0]);var i,o,s=r+a,l=new Array(s),u=0,c=0,f=0,h=Math.abs,d=t[c],p=h(d),g=-e[f],m=h(g);p=a?(i=d,(c+=1)=a?(i=d,(c+=1)0?1:0}},{}],189:[function(t,e,r){arguments[4][31][0].apply(r,arguments)},{dup:31}],190:[function(t,e,r){"use strict";"use restrict";function n(t){for(var e=0,r=Math.max,n=0,a=t.length;n>1,s=o(t[i],e);s<=0?(0===s&&(a=i),r=i+1):s>0&&(n=i-1)}return a}function f(t,e){for(var r=new Array(t.length),n=0,a=r.length;n=t.length||0!==o(t[g],i))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;n>>c&1&&u.push(a[c]);e.push(u)}return l(e)}function p(t,e){if(e<0)return[];for(var r=[],n=(1<>1:(t>>1)-1}function u(t){for(var e=s(t);;){var r=e,n=2*t+1,a=2*(t+1),o=t;if(n0;){var r=l(t);if(r>=0){if(e0){var t=k[0];return i(0,T-1),T-=1,u(0),t}return-1}function h(t,e){var r=k[t];return y[r]===e?t:(y[r]=-1/0,c(t),f(),y[r]=e,T+=1,c(T-1))}function d(t,e){if(t[e]<0)return e;var r=e,n=e;do{var a=t[n];if(!b[n]||a<0||a===n)break;if(n=a,a=t[n],!b[n]||a<0||a===n)break;n=a,r=t[r]}while(r!==n);for(var i=e;i!==n;i=t[i])t[i]=n;return n}for(var p=e.length,g=t.length,m=new Array(p),v=new Array(p),y=new Array(p),b=new Array(p),x=0;x>1;x>=0;--x)u(x);for(;;){var E=f();if(E<0||y[E]>r)break;!function(t){if(!b[t]){b[t]=!0;var e=m[t],r=v[t];m[r]>=0&&(m[r]=e),v[e]>=0&&(v[e]=r),M[e]>=0&&h(M[e],a(e)),M[r]>=0&&h(M[r],a(r))}}(E)}for(var L=[],x=0;x=0&&r>=0&&e!==r){var n=M[e],a=M[r];n!==a&&S.push([n,a])}}),o.unique(o.normalize(S)),{positions:L,edges:S}}e.exports=a;var i=t("robust-orientation"),o=t("simplicial-complex")},{"robust-orientation":182,"simplicial-complex":190}],193:[function(t,e,r){"use strict";function n(t,e){var r,n;if(e[0][0]e[1][0])){var a=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 ol?a-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],a=e[0]}var o,s;if(t[0][0]t[1][0]))return-n(t,e);o=t[1],s=t[0]}var l=i(r,a,s),u=i(r,a,o);if(l<0){if(u<=0)return l}else if(l>0){if(u>=0)return l}else if(u)return u;if(l=i(s,o,a),u=i(s,o,r),l<0){if(u<=0)return l}else if(l>0){if(u>=0)return l}else if(u)return u;return a[0]-s[0]}e.exports=a;var i=t("robust-orientation")},{"robust-orientation":182}],194:[function(t,e,r){"use strict";function n(t,e,r){this.slabs=t,this.coordinates=e,this.horizontal=r}function a(t,e){return t.y-e}function i(t,e){for(var r=null;t;){var n,a,o=t.key;o[0][0]0)if(e[0]!==o[1][0])r=t,t=t.right;else{var l=i(t.right,e);if(l)return l;t=t.left}else{if(e[0]!==o[1][0])return t;var l=i(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,a=new Array(r),i=0;i0){var s=i(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],a);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":193,"binary-search-bounds":30,"functional-red-black-tree":70,"robust-orientation":182}],195:[function(e,r,n){!function(){"use strict";function e(t){return a(i(t),arguments)}function r(t,r){return e.apply(null,[t].concat(r||[]))}function a(t,r){var n,a,i,s,l,u,c,f,h,d=1,p=t.length,g="";for(a=0;a=0),s[8]){case"b":n=parseInt(n,10).toString(2);break;case"c":n=String.fromCharCode(parseInt(n,10));break;case"d":case"i":n=parseInt(n,10);break;case"j":n=JSON.stringify(n,null,s[6]?parseInt(s[6]):0);break;case"e":n=s[7]?parseFloat(n).toExponential(s[7]):parseFloat(n).toExponential();break;case"f":n=s[7]?parseFloat(n).toFixed(s[7]):parseFloat(n);break;case"g":n=s[7]?String(Number(n.toPrecision(s[7]))):parseFloat(n);break;case"o":n=(parseInt(n,10)>>>0).toString(8);break;case"s":n=String(n),n=s[7]?n.substring(0,s[7]):n;break;case"t":n=String(!!n),n=s[7]?n.substring(0,s[7]):n;break;case"T":n=Object.prototype.toString.call(n).slice(8,-1).toLowerCase(),n=s[7]?n.substring(0,s[7]):n;break;case"u":n=parseInt(n,10)>>>0;break;case"v":n=n.valueOf(),n=s[7]?n.substring(0,s[7]):n;break;case"x":n=(parseInt(n,10)>>>0).toString(16);break;case"X":n=(parseInt(n,10)>>>0).toString(16).toUpperCase()}o.json.test(s[8])?g+=n:(!o.number.test(s[8])||f&&!s[3]?h="":(h=f?"+":"-",n=n.toString().replace(o.sign,"")),u=s[4]?"0"===s[4]?"0":s[4].charAt(1):" ",c=s[6]-(h+n).length,l=s[6]&&c>0?u.repeat(c):"",g+=s[5]?h+n+l:"0"===u?h+l+n:l+h+n)}return g}function i(t){if(s[t])return s[t];for(var e,r=t,n=[],a=0;r;){if(null!==(e=o.text.exec(r)))n.push(e[0]);else if(null!==(e=o.modulo.exec(r)))n.push("%");else{if(null===(e=o.placeholder.exec(r)))throw new SyntaxError("[sprintf] unexpected placeholder");if(e[2]){a|=1;var i=[],l=e[2],u=[];if(null===(u=o.key.exec(l)))throw new SyntaxError("[sprintf] failed to parse named argument key");for(i.push(u[1]);""!==(l=l.substring(u[0].length));)if(null!==(u=o.key_access.exec(l)))i.push(u[1]);else{if(null===(u=o.index_access.exec(l)))throw new SyntaxError("[sprintf] failed to parse named argument key");i.push(u[1])}e[2]=i}else a|=2;if(3===a)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");n.push(e)}r=r.substring(e[0].length)}return s[t]=n}var o={not_string:/[^s]/,not_bool:/[^t]/,not_type:/[^T]/,not_primitive:/[^v]/,number:/[diefg]/,numeric_arg:/[bcdiefguxX]/,json:/[j]/,not_json:/[^j]/,text:/^[^\x25]+/,modulo:/^\x25{2}/,placeholder:/^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijostTuvxX])/,key:/^([a-z_][a-z_\d]*)/i,key_access:/^\.([a-z_][a-z_\d]*)/i,index_access:/^\[(\d+)\]/,sign:/^[\+\-]/},s=Object.create(null);void 0!==n&&(n.sprintf=e,n.vsprintf=r),"undefined"!=typeof window&&(window.sprintf=e,window.vsprintf=r,"function"==typeof t&&t.amd&&t(function(){return{sprintf:e,vsprintf:r}}))}()},{}],196:[function(t,e,r){"use strict";function n(t){return t.split("").map(function(t){return t in a?a[t]:""}).join("")}e.exports=n;var a={" ":" ",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"}},{}],197:[function(t,e,r){"use strict";function n(t,e){var r=t.length,n=["'use strict';"],a="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 i=[],l=[],u=0;u>>7){");for(var u=0;u<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),m=new Array(r),v=new Array(r),y=0,b=0;bb)&&!(u&1<<_)!=!(u&1<0&&(M="+"+m[x]+"*c");var T=p[x].length/y*.5,E=.5+v[x]/y*.5;k.push("d"+x+"-"+E+"-"+T+"*("+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;u<1<0&&(h+=.02);for(var p=new Float32Array(f),g=0,m=-.5*h,d=0;d=0?1.2:1))}function a(t,e,r,n,a,o,s){for(var l=0;l.5?l/(2-i-o):l/(i+o),i){case t:n=(e-r)/l+(e1&&(r-=1),r<1/6?t+6*(e-t)*r:r<.5?e:r<2/3?t+(e-t)*(2/3-r)*6:t}var a,i,o;if(t=E(t,360),e=E(e,100),r=E(r,100),0===e)a=i=o=r;else{var s=r<.5?r*(1+e):r+e-r*e,l=2*r-s;a=n(l,s,t+1/3),i=n(l,s,t),o=n(l,s,t-1/3)}return{r:255*a,g:255*i,b:255*o}}function l(t,e,r){t=E(t,255),e=E(e,255),r=E(r,255);var n,a,i=G(t,e,r),o=V(t,e,r),s=i,l=i-o;if(a=0===i?0:l/i,i==o)n=0;else{switch(i){case t:n=(e-r)/l+(e>1)+720)%360;--e;)a.h=(a.h+i)%360,o.push(n(a));return o}function M(t,e){e=e||6;for(var r=n(t).toHsv(),a=r.h,i=r.s,o=r.v,s=[],l=1/e;e--;)s.push(n({h:a,s:i,v:o})),o=(o+l)%1;return s}function T(t){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}function E(t,r){C(t)&&(t="100%");var n=O(t);return t=V(r,G(0,parseFloat(t))),n&&(t=parseInt(t*r,10)/100),e.abs(t-r)<1e-6?1:t%r/parseFloat(r)}function L(t){return V(1,G(0,t))}function S(t){return parseInt(t,16)}function C(t){return"string"==typeof t&&-1!=t.indexOf(".")&&1===parseFloat(t)}function O(t){return"string"==typeof t&&-1!=t.indexOf("%")}function I(t){return 1==t.length?"0"+t:""+t}function R(t){return t<=1&&(t=100*t+"%"),t}function D(t){return e.round(255*parseFloat(t)).toString(16)}function P(t){return S(t)/255}function z(t){return!!W.CSS_UNIT.exec(t)}function N(t){t=t.replace(B,"").replace(j,"").toLowerCase();var e=!1;if(X[t])t=X[t],e=!0;else if("transparent"==t)return{r:0,g:0,b:0,a:0,format:"name"};var r;return(r=W.rgb.exec(t))?{r:r[1],g:r[2],b:r[3]}:(r=W.rgba.exec(t))?{r:r[1],g:r[2],b:r[3],a:r[4]}:(r=W.hsl.exec(t))?{h:r[1],s:r[2],l:r[3]}:(r=W.hsla.exec(t))?{h:r[1],s:r[2],l:r[3],a:r[4]}:(r=W.hsv.exec(t))?{h:r[1],s:r[2],v:r[3]}:(r=W.hsva.exec(t))?{h:r[1],s:r[2],v:r[3],a:r[4]}:(r=W.hex8.exec(t))?{r:S(r[1]),g:S(r[2]),b:S(r[3]),a:P(r[4]),format:e?"name":"hex8"}:(r=W.hex6.exec(t))?{r:S(r[1]),g:S(r[2]),b:S(r[3]),format:e?"name":"hex"}:(r=W.hex4.exec(t))?{r:S(r[1]+""+r[1]),g:S(r[2]+""+r[2]),b:S(r[3]+""+r[3]),a:P(r[4]+""+r[4]),format:e?"name":"hex8"}:!!(r=W.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"}}function F(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 B=/^\s+/,j=/\s+$/,H=0,U=e.round,V=e.min,G=e.max,q=e.random;n.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,r,n,a,i,o,s=this.toRgb();return t=s.r/255,r=s.g/255,n=s.b/255,a=t<=.03928?t/12.92:e.pow((t+.055)/1.055,2.4),i=r<=.03928?r/12.92:e.pow((r+.055)/1.055,2.4),o=n<=.03928?n/12.92:e.pow((n+.055)/1.055,2.4),.2126*a+.7152*i+.0722*o},setAlpha:function(t){return this._a=T(t),this._roundA=U(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=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 c(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(t){return f(this._r,this._g,this._b,this._a,t)},toHex8String:function(t){return"#"+this.toHex8(t)},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)&&(Y[c(this._r,this._g,this._b,!0)]||!1)},toFilter:function(t){var e="#"+h(this._r,this._g,this._b,this._a),r=e,a=this._gradientType?"GradientType = 1, ":"";if(t){var i=n(t);r="#"+h(i._r,i._g,i._b,i._a)}return"progid:DXImageTransform.Microsoft.gradient("+a+"startColorstr="+e+",endColorstr="+r+")"},toString:function(t){var e=!!t;t=t||this._format;var r=!1,n=this._a<1&&this._a>=0;return e||!n||"hex"!==t&&"hex6"!==t&&"hex3"!==t&&"hex4"!==t&&"hex8"!==t&&"name"!==t?("rgb"===t&&(r=this.toRgbString()),"prgb"===t&&(r=this.toPercentageRgbString()),"hex"!==t&&"hex6"!==t||(r=this.toHexString()),"hex3"===t&&(r=this.toHexString(!0)),"hex4"===t&&(r=this.toHex8String(!0)),"hex8"===t&&(r=this.toHex8String()),"name"===t&&(r=this.toName()),"hsl"===t&&(r=this.toHslString()),"hsv"===t&&(r=this.toHsvString()),r||this.toHexString()):"name"===t&&0===this._a?this.toName():this.toRgbString()},clone:function(){return n(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(m,arguments)},brighten:function(){return this._applyModification(v,arguments)},darken:function(){return this._applyModification(y,arguments)},desaturate:function(){return this._applyModification(d,arguments)},saturate:function(){return this._applyModification(p,arguments)},greyscale:function(){return this._applyModification(g,arguments)},spin:function(){return this._applyModification(b,arguments)},_applyCombination:function(t,e){return t.apply(null,[this].concat([].slice.call(e)))},analogous:function(){return this._applyCombination(k,arguments)},complement:function(){return this._applyCombination(x,arguments)},monochromatic:function(){return this._applyCombination(M,arguments)},splitcomplement:function(){return this._applyCombination(A,arguments)},triad:function(){return this._applyCombination(_,arguments)},tetrad:function(){return this._applyCombination(w,arguments)}},n.fromRatio=function(t,e){if("object"==typeof t){var r={};for(var a in t)t.hasOwnProperty(a)&&(r[a]="a"===a?t[a]:R(t[a]));t=r}return n(t,e)},n.equals=function(t,e){return!(!t||!e)&&n(t).toRgbString()==n(e).toRgbString()},n.random=function(){return n.fromRatio({r:q(),g:q(),b:q()})},n.mix=function(t,e,r){r=0===r?0:r||50;var a=n(t).toRgb(),i=n(e).toRgb(),o=r/100;return n({r:(i.r-a.r)*o+a.r,g:(i.g-a.g)*o+a.g,b:(i.b-a.b)*o+a.b,a:(i.a-a.a)*o+a.a})},n.readability=function(t,r){var a=n(t),i=n(r);return(e.max(a.getLuminance(),i.getLuminance())+.05)/(e.min(a.getLuminance(),i.getLuminance())+.05)},n.isReadable=function(t,e,r){var a,i,o=n.readability(t,e);switch(i=!1,a=F(r),a.level+a.size){case"AAsmall":case"AAAlarge":i=o>=4.5;break;case"AAlarge":i=o>=3;break;case"AAAsmall":i=o>=7}return i},n.mostReadable=function(t,e,r){var a,i,o,s,l=null,u=0;r=r||{},i=r.includeFallbackColors,o=r.level,s=r.size;for(var c=0;cu&&(u=a,l=n(e[c]));return n.isReadable(t,l,{level:o,size:s})||!i?l:(r.includeFallbackColors=!1,n.mostReadable(t,["#fff","#000"],r))};var X=n.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=n.hexNames=function(t){var e={};for(var r in t)t.hasOwnProperty(r)&&(e[t[r]]=r);return e}(X),W=function(){var t="(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)",e="[\\s|\\(]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")\\s*\\)?",r="[\\s|\\(]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")\\s*\\)?";return{CSS_UNIT:new RegExp(t),rgb:new RegExp("rgb"+e),rgba:new RegExp("rgba"+r),hsl:new RegExp("hsl"+e),hsla:new RegExp("hsla"+r),hsv:new RegExp("hsv"+e),hsva:new RegExp("hsva"+r),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})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();void 0!==r&&r.exports?r.exports=n:"function"==typeof t&&t.amd?t(function(){return n}):window.tinycolor=n}(Math)},{}],201:[function(t,e,r){"use strict";function n(t,e){var r=o(getComputedStyle(t).getPropertyValue(e));return r[0]*i(r[1],t)}function a(t,e){var r=document.createElement("div");r.style["font-size"]="128"+t,e.appendChild(r);var a=n(r,"font-size")/128;return e.removeChild(r),a}function i(t,e){switch(e=e||document.body,t=(t||"px").trim().toLowerCase(),e!==window&&e!==document||(e=document.body),t){case"%":return e.clientHeight/100;case"ch":case"ex":return a(t,e);case"em":return n(e,"font-size");case"rem":return n(document.body,"font-size");case"vw":return window.innerWidth/100;case"vh":return window.innerHeight/100;case"vmin":return Math.min(window.innerWidth,window.innerHeight)/100;case"vmax":return Math.max(window.innerWidth,window.innerHeight)/100;case"in":return s;case"cm":return s/2.54;case"mm":return s/25.4;case"pt":return s/72;case"pc":return s/6}return 1}var o=t("parse-unit");e.exports=i;var s=96},{"parse-unit":167}],202:[function(t,e,r){"use strict";function n(t){if(t<0)return[];if(0===t)return[[0]];for(var e=0|Math.round(o(t+1)),r=[],n=0;n0?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 m(t){return new DataView(o(t),0,t)}function v(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=i,r.freeArrayBuffer=a,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 v(t);case"data":case"dataview":return m(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=m,r.mallocBuffer=v,r.clearCache=function(){for(var t=0;t<32;++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":31,buffer:40,dup:64}],206:[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;e8192)throw new Error("vectorize-text: String too long (sorry, this will get fixed later)");var i=3*n;t.height= 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}],215:[function(t,e,r){"use strict";function n(t,e){var r=[];return e=+e||0,a(t.hi(t.shape[0]-1),r,e),r}e.exports=n;var a=t("./lib/zc-core")},{"./lib/zc-core":214}],216:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("../../plots/cartesian/axes"),i=t("./common_defaults"),o=t("./attributes");e.exports=function(t,e,r,s,l){function u(r,a){return n.coerce(t,e,o,r,a)}s=s||{},l=l||{};var c=u("visible",!l.itemIsNotPlainObject),f=u("clicktoshow");if(!c&&!f)return e;i(t,e,r,u);for(var h=e.showarrow,d=["x","y"],p=[-10,-30],g={_fullLayout:r},m=0;m<2;m++){var v=d[m],y=a.coerceRef(t,e,g,v,"","paper");if(a.coercePosition(e,g,u,y,v,.5),h){var b="a"+v,x=a.coerceRef(t,e,g,b,"pixel");"pixel"!==x&&x!==y&&(x=e[b]="pixel");var _="pixel"===x?p[m]:.4;a.coercePosition(e,g,u,x,b,_)}u(v+"anchor"),u(v+"shift")}if(n.noneOrAll(t,e,["x","y"]),h&&n.noneOrAll(t,e,["ax","ay"]),f){var w=u("xclick"),A=u("yclick");e._xclick=void 0===w?e.x:a.cleanPosition(w,g,e.xref),e._yclick=void 0===A?e.y:a.cleanPosition(A,g,e.yref)}return e}},{"../../lib":350,"../../plots/cartesian/axes":389,"./attributes":218,"./common_defaults":221}],217:[function(t,e,r){"use strict";e.exports=[{path:"",backoff:0},{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}]},{}],218:[function(t,e,r){"use strict";var n=t("./arrow_paths"),a=t("../../plots/font_attributes"),i=t("../../plots/cartesian/constants"),o=t("../../lib/extend").extendFlat;e.exports={_isLinkedToArray:"annotation",visible:{valType:"boolean",dflt:!0},text:{valType:"string"},textangle:{valType:"angle",dflt:0},font:o({},a,{}),width:{valType:"number",min:1,dflt:null},height:{valType:"number",min:1,dflt:null},opacity:{valType:"number",min:0,max:1,dflt:1},align:{valType:"enumerated",values:["left","center","right"],dflt:"center"},valign:{valType:"enumerated",values:["top","middle","bottom"],dflt:"middle"},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},standoff:{valType:"number",min:0,dflt:0},ax:{valType:"any"},ay:{valType:"any"},axref:{valType:"enumerated",dflt:"pixel",values:["pixel",i.idRegex.x.toString()]},ayref:{valType:"enumerated",dflt:"pixel",values:["pixel",i.idRegex.y.toString()]},xref:{valType:"enumerated",values:["paper",i.idRegex.x.toString()]},x:{valType:"any"},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"auto"},xshift:{valType:"number",dflt:0},yref:{valType:"enumerated",values:["paper",i.idRegex.y.toString()]},y:{valType:"any"},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto"},yshift:{valType:"number",dflt:0},clicktoshow:{valType:"enumerated",values:[!1,"onoff","onout"],dflt:!1},xclick:{valType:"any"},yclick:{valType:"any"},hovertext:{valType:"string"},hoverlabel:{bgcolor:{valType:"color"},bordercolor:{valType:"color"},font:o({},a,{})},captureevents:{valType:"boolean"},_deprecated:{ref:{valType:"string"}}}},{"../../lib/extend":343,"../../plots/cartesian/constants":394,"../../plots/font_attributes":413,"./arrow_paths":217}],219:[function(t,e,r){"use strict";function n(t){var e=t._fullLayout;a.filterVisible(e.annotations).forEach(function(e){var r,n,a=i.getFromId(t,e.xref),o=i.getFromId(t,e.yref),s=3*e.arrowsize*e.arrowwidth||0;a&&a.autorange&&(r=s+e.xshift,n=s-e.xshift,e.axref===e.xref?(i.expand(a,[a.r2c(e.x)],{ppadplus:r,ppadminus:n}),i.expand(a,[a.r2c(e.ax)],{ppadplus:e._xpadplus,ppadminus:e._xpadminus})):i.expand(a,[a.r2c(e.x)],{ppadplus:Math.max(e._xpadplus,r),ppadminus:Math.max(e._xpadminus,n)})),o&&o.autorange&&(r=s-e.yshift,n=s+e.yshift,e.ayref===e.yref?(i.expand(o,[o.r2c(e.y)],{ppadplus:r,ppadminus:n}),i.expand(o,[o.r2c(e.ay)],{ppadplus:e._ypadplus,ppadminus:e._ypadminus})):i.expand(o,[o.r2c(e.y)],{ppadplus:Math.max(e._ypadplus,r),ppadminus:Math.max(e._ypadminus,n)}))})}var a=t("../../lib"),i=t("../../plots/cartesian/axes"),o=t("./draw").draw;e.exports=function(t){var e=t._fullLayout,r=a.filterVisible(e.annotations);if(r.length&&t._fullData.length){var s={};r.forEach(function(t){s[t.xref]=!0,s[t.yref]=!0});if(i.list(t).filter(function(t){return t.autorange&&s[t._id]}).length)return a.syncOrAsync([o,n],t)}}},{"../../lib":350,"../../plots/cartesian/axes":389,"./draw":224}],220:[function(t,e,r){"use strict";function n(t,e){var r=i(t,e);return r.on.length>0||r.explicitOff.length>0}function a(t,e){var r,n=i(t,e),a=n.on,o=n.off.concat(n.explicitOff),l={};if(a.length||o.length){for(r=0;r2/3?"right":"center"),{center:0,middle:0,left:.5,bottom:-.5,right:-.5,top:.5}[e]}var o=F.selectAll("a");if(1===o.size()&&o.text()===F.text()){C.insert("a",":first-child").attr({"xlink:xlink:href":o.attr("xlink:href"),"xlink:xlink:show":o.attr("xlink:show")}).style({cursor:"pointer"}).node().appendChild(D.node())}var l=C.select(".annotation-text-math-group"),c=!l.empty(),d=h.bBox((c?l:F).node()),y=d.width,S=d.height,I=e.width||y,N=e.height||S,B=Math.round(I+2*R),j=Math.round(N+2*R);e._w=I,e._h=N;for(var H=!1,U=["x","y"],V=0;V1)&&($===Q?((ot=K.r2fraction(e["a"+Z]))<0||ot>1)&&(H=!0):H=!0,H))continue;G=K._offset+K.r2p(e[Z]),Y=.5}else"x"===Z?(X=e[Z],G=_.l+_.w*X):(X=1-e[Z],G=_.t+_.h*X),Y=e.showarrow?.5:X;if(e.showarrow){it.head=G;var st=e["a"+Z];W=tt*r(.5,e.xanchor)-et*r(.5,e.yanchor),$===Q?(it.tail=K._offset+K.r2p(st),q=W):(it.tail=G+st,q=W+st),it.text=it.tail+W;var lt=x["x"===Z?"width":"height"];if("paper"===Q&&(it.head=u.constrain(it.head,1,lt-1)),"pixel"===$){var ut=-Math.max(it.tail-3,it.text),ct=Math.min(it.tail+3,it.text)-lt;ut>0?(it.tail+=ut,it.text+=ut):ct>0&&(it.tail-=ct,it.text-=ct)}it.tail+=at,it.head+=at}else W=rt*r(Y,nt),q=W,it.text=G+W;it.text+=at,W+=at,q+=at,e["_"+Z+"padplus"]=rt/2+q,e["_"+Z+"padminus"]=rt/2-q,e["_"+Z+"size"]=rt,e["_"+Z+"shift"]=W}if(H)return void C.remove();var ft=0,ht=0;if("left"!==e.align&&(ft=(I-y)*("center"===e.align?.5:1)),"top"!==e.valign&&(ht=(N-S)*("middle"===e.valign?.5:1)),c)l.select("svg").attr({x:R+ft-1,y:R+ht}).call(h.setClipUrl,P?A:null);else{var dt=R+ht-d.top,pt=R+ft-d.left;F.call(p.positionText,pt,dt).call(h.setClipUrl,P?A:null)}z.select("rect").call(h.setRect,R,R,I,N),D.call(h.setRect,O/2,O/2,B-O,j-O),C.call(h.setTranslate,Math.round(k.x.text-B/2),Math.round(k.y.text-j/2)),E.attr({transform:"rotate("+M+","+k.x.text+","+k.y.text+")"});var gt=function(r,o){T.selectAll(".annotation-arrow-g").remove();var l=k.x.head,c=k.y.head,d=k.x.tail+r,p=k.y.tail+o,g=k.x.text+r,y=k.y.text+o,x=u.rotationXYMatrix(M,g,y),A=u.apply2DTransform(x),L=u.apply2DTransform2(x),S=+D.attr("width"),O=+D.attr("height"),I=g-.5*S,R=I+S,P=y-.5*O,z=P+O,N=[[I,P,I,z],[I,z,R,z],[R,z,R,P],[R,P,I,P]].map(L);if(!N.reduce(function(t,e){return t^!!u.segmentsIntersect(l,c,l+1e6,c+1e6,e[0],e[1],e[2],e[3])},!1)){N.forEach(function(t){var e=u.segmentsIntersect(d,p,l,c,t[0],t[1],t[2],t[3]);e&&(d=e.x,p=e.y)});var F=e.arrowwidth,B=e.arrowcolor,j=T.append("g").style({opacity:f.opacity(B)}).classed("annotation-arrow-g",!0),H=j.append("path").attr("d","M"+d+","+p+"L"+l+","+c).style("stroke-width",F+"px").call(f.stroke,f.rgb(B));if(v(H,e.arrowhead,"end",e.arrowsize,e.standoff),w.annotationPosition&&H.node().parentNode&&!n){var U=l,V=c;if(e.standoff){var G=Math.sqrt(Math.pow(l-d,2)+Math.pow(c-p,2));U+=e.standoff*(d-l)/G,V+=e.standoff*(p-c)/G}var q,X,Y,W=j.append("path").classed("annotation-arrow",!0).classed("anndrag",!0).attr({d:"M3,3H-3V-3H3ZM0,0L"+(d-U)+","+(p-V),transform:"translate("+U+","+V+")"}).style("stroke-width",F+6+"px").call(f.stroke,"rgba(0,0,0,0)").call(f.fill,"rgba(0,0,0,0)");m.init({element:W.node(),gd:t,prepFn:function(){var t=h.getTranslate(C);X=t.x,Y=t.y,q={},a&&a.autorange&&(q[a._name+".autorange"]=!0),i&&i.autorange&&(q[i._name+".autorange"]=!0)},moveFn:function(t,r){var n=A(X,Y),o=n[0]+t,s=n[1]+r;C.call(h.setTranslate,o,s),q[b+".x"]=a?a.p2r(a.r2p(e.x)+t):e.x+t/_.w,q[b+".y"]=i?i.p2r(i.r2p(e.y)+r):e.y-r/_.h,e.axref===e.xref&&(q[b+".ax"]=a.p2r(a.r2p(e.ax)+t)),e.ayref===e.yref&&(q[b+".ay"]=i.p2r(i.r2p(e.ay)+r)),j.attr("transform","translate("+t+","+r+")"),E.attr({transform:"rotate("+M+","+o+","+s+")"})},doneFn:function(e){if(e){s.relayout(t,q);var r=document.querySelector(".js-notes-box-panel");r&&r.redraw(r.selectedObj)}}})}}};if(e.showarrow&>(0,0),L){var mt,vt;m.init({element:C.node(),gd:t,prepFn:function(){vt=E.attr("transform"),mt={}},moveFn:function(t,r){var o="pointer";if(e.showarrow)e.axref===e.xref?mt[b+".ax"]=a.p2r(a.r2p(e.ax)+t):mt[b+".ax"]=e.ax+t,e.ayref===e.yref?mt[b+".ay"]=i.p2r(i.r2p(e.ay)+r):mt[b+".ay"]=e.ay+r,gt(t,r);else{if(n)return;if(a)mt[b+".x"]=e.x+t/a._m;else{var s=e._xsize/_.w,l=e.x+(e._xshift-e.xshift)/_.w-s/2;mt[b+".x"]=m.align(l+t/_.w,s,0,1,e.xanchor)}if(i)mt[b+".y"]=e.y+r/i._m;else{var u=e._ysize/_.h,c=e.y-(e._yshift+e.yshift)/_.h-u/2;mt[b+".y"]=m.align(c-r/_.h,u,0,1,e.yanchor)}a&&i||(o=m.getCursor(a?.5:mt[b+".x"],i?.5:mt[b+".y"],e.xanchor,e.yanchor))}E.attr({transform:"translate("+t+","+r+")"+vt}),g(C,o)},doneFn:function(e){if(g(C),e){s.relayout(t,mt);var r=document.querySelector(".js-notes-box-panel");r&&r.redraw(r.selectedObj)}}})}}var y,b,x=t._fullLayout,_=t._fullLayout._size,w=t._context.edits;n?(y="annotation-"+n,b=n+".annotations["+r+"]"):(y="annotation",b="annotations["+r+"]"),x._infolayer.selectAll("."+y+'[data-index="'+r+'"]').remove();var A="clip"+x._uid+"_ann"+r;if(!e._input||!1===e.visible)return void o.selectAll("#"+A).remove();var k={x:{},y:{}},M=+e.textangle||0,T=x._infolayer.append("g").classed(y,!0).attr("data-index",String(r)).style("opacity",e.opacity),E=T.append("g").classed("annotation-text-g",!0),L=w[e.showarrow?"annotationTail":"annotationPosition"],S=e.captureevents||w.annotationText||L,C=E.append("g").style("pointer-events",S?"all":null).call(g,"default").on("click",function(){t._dragging=!1;var a={index:r,annotation:e._input,fullAnnotation:e,event:o.event};n&&(a.subplotId=n),t.emit("plotly_clickannotation",a)});e.hovertext&&C.on("mouseover",function(){var r=e.hoverlabel,n=r.font,a=this.getBoundingClientRect(),i=t.getBoundingClientRect();d.loneHover({x0:a.left-i.left,x1:a.right-i.left,y:(a.top+a.bottom)/2-i.top,text:e.hovertext,color:r.bgcolor,borderColor:r.bordercolor,fontFamily:n.family,fontSize:n.size,fontColor:n.color},{container:x._hoverlayer.node(),outerContainer:x._paper.node(),gd:t})}).on("mouseout",function(){d.loneUnhover(x._hoverlayer.node())});var O=e.borderwidth,I=e.borderpad,R=O+I,D=C.append("rect").attr("class","bg").style("stroke-width",O+"px").call(f.stroke,e.bordercolor).call(f.fill,e.bgcolor),P=e.width||e.height,z=x._defs.select(".clips").selectAll("#"+A).data(P?[0]:[]);z.enter().append("clipPath").classed("annclip",!0).attr("id",A).append("rect"),z.exit().remove();var N=e.font,F=C.append("text").classed("annotation-text",!0).text(e.text);w.annotationText?F.call(p.makeEditable,{delegate:C,gd:t}).call(l).on("edit",function(r){e.text=r,this.call(l);var n={};n[b+".text"]=e.text,a&&a.autorange&&(n[a._name+".autorange"]=!0),i&&i.autorange&&(n[i._name+".autorange"]=!0),s.relayout(t,n)}):F.call(l)}var o=t("d3"),s=t("../../plotly"),l=t("../../plots/plots"),u=t("../../lib"),c=t("../../plots/cartesian/axes"),f=t("../color"),h=t("../drawing"),d=t("../fx"),p=t("../../lib/svg_text_utils"),g=t("../../lib/setcursor"),m=t("../dragelement"),v=t("./draw_arrow_head");e.exports={draw:n,drawOne:a,drawRaw:i}},{"../../lib":350,"../../lib/setcursor":365,"../../lib/svg_text_utils":369,"../../plotly":384,"../../plots/cartesian/axes":389,"../../plots/plots":422,"../color":233,"../dragelement":254,"../drawing":257,"../fx":274,"./draw_arrow_head":225,d3:62}],225:[function(t,e,r){"use strict";var n=t("d3"),a=t("fast-isnumeric"),i=t("../color"),o=t("../drawing"),s=t("./arrow_paths");e.exports=function(t,e,r,l,u){function c(){t.style("stroke-dasharray","0px,100px")}function f(r,a){d.path&&(e>5&&(a=0),n.select(h.parentNode).append("path").attr({class:t.attr("class"),d:d.path,transform:"translate("+r.x+","+r.y+")rotate("+180*a/Math.PI+")scale("+y+")"}).style({fill:b,opacity:x,"stroke-width":0}))}a(l)||(l=1);var h=t.node(),d=s[e||0];"string"==typeof r&&r||(r="end");var p,g,m,v,y=(o.getPx(t,"stroke-width")||1)*l,b=t.style("stroke")||i.defaultLine,x=t.style("stroke-opacity")||1,_=r.indexOf("start")>=0,w=r.indexOf("end")>=0,A=d.backoff*y+u;if("line"===h.nodeName){p={x:+t.attr("x1"),y:+t.attr("y1")},g={x:+t.attr("x2"),y:+t.attr("y2")};var k=p.x-g.x,M=p.y-g.y;if(m=Math.atan2(M,k),v=m+Math.PI,A){if(A*A>k*k+M*M)return void c();var T=A*Math.cos(m),E=A*Math.sin(m);_&&(p.x-=T,p.y-=E,t.attr({x1:p.x,y1:p.y})),w&&(g.x+=T,g.y+=E,t.attr({x2:g.x,y2:g.y}))}}else if("path"===h.nodeName){var L=h.getTotalLength(),S="";if(L1){u=!0;break}}u?t.fullLayout._infolayer.select(".annotation-"+t.id+'[data-index="'+s+'"]').remove():(l.pdata=a(t.glplot.cameraParams,[e.xaxis.r2l(l.x)*r[0],e.yaxis.r2l(l.y)*r[1],e.zaxis.r2l(l.z)*r[2]]),n(t.graphDiv,l,s,t.id,l._xa,l._ya))}}},{"../../plots/gl3d/project":419,"../annotations/draw":224}],231:[function(t,e,r){"use strict";e.exports={moduleType:"component",name:"annotations3d",schema:{layout:{"scene.annotations":t("./attributes")}},layoutAttributes:t("./attributes"),handleDefaults:t("./defaults"),convert:t("./convert"),draw:t("./draw")}},{"./attributes":227,"./convert":228,"./defaults":229,"./draw":230}],232:[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},{}],233:[function(t,e,r){"use strict";function n(t){if(i(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*/),a="a"===e.charAt(3)&&4===n.length;if(!a&&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 a?"rgba("+s+", "+n[3]+")":"rgb("+s+")"}var a=t("tinycolor2"),i=t("fast-isnumeric"),o=e.exports={},s=t("./attributes");o.defaults=s.defaults;var l=o.defaultLine=s.defaultLine;o.lightLine=s.lightLine;var u=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(a(t))},o.opacity=function(t){return t?a(t).getAlpha():0},o.addOpacity=function(t,e){var r=a(t).toRgb();return"rgba("+Math.round(r.r)+", "+Math.round(r.g)+", "+Math.round(r.b)+", "+e+")"},o.combine=function(t,e){var r=a(t).toRgb();if(1===r.a)return a(t).toRgbString();var n=a(e||u).toRgb(),i=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},o={r:i.r*(1-r.a)+r.r*r.a,g:i.g*(1-r.a)+r.g*r.a,b:i.b*(1-r.a)+r.b*r.a};return a(o).toRgbString()},o.contrast=function(t,e,r){var n=a(t);return 1!==n.getAlpha()&&(n=a(o.combine(t,u))),(n.isDark()?e?n.lighten(e):u:r?n.darken(r):l).toString()},o.stroke=function(t,e){var r=a(e);t.style({stroke:o.tinyRGB(r),"stroke-opacity":r.getAlpha()})},o.fill=function(t,e){var r=a(e);t.style({fill:o.tinyRGB(r),"fill-opacity":r.getAlpha()})},o.clean=function(t){if(t&&"object"==typeof t){var e,r,a,i,s=Object.keys(t);for(e=0;es&&(i[1]-=(ct-s)/2):r.node()&&!r.classed("js-placeholder")&&(ct=d.bBox(r.node()).height),ct){if(ct+=5,"top"===A.titleside)rt.domain[1]-=ct/L.h,i[1]*=-1;else{rt.domain[0]+=ct/L.h;var u=m.lineCount(r);i[1]+=(1-u)*s}e.attr("transform","translate("+i+")"),rt.setScale()}}lt.selectAll(".cbfills,.cblines,.cbaxis").attr("transform","translate(0,"+Math.round(L.h*(1-rt.domain[1]))+")");var f=lt.select(".cbfills").selectAll("rect.cbfill").data(R);f.enter().append("rect").classed("cbfill",!0).style("stroke","none"),f.exit().remove(),f.each(function(t,e){var r=[0===e?O[0]:(R[e]+R[e-1])/2,e===R.length-1?O[1]:(R[e]+R[e+1])/2].map(rt.c2p).map(Math.round);e!==R.length-1&&(r[1]+=r[1]>r[0]?1:-1);var i=P(t).replace("e-",""),o=a(i).toHexString();n.select(this).attr({x:Q,width:Math.max(V,2),y:n.min(r),height:Math.max(n.max(r)-n.min(r),2),fill:o})});var h=lt.select(".cblines").selectAll("path.cbline").data(A.line.color&&A.line.width?I:[]);return h.enter().append("path").classed("cbline",!0),h.exit().remove(),h.each(function(t){n.select(this).attr("d","M"+Q+","+(Math.round(rt.c2p(t))+A.line.width/2%1)+"h"+V).call(d.lineGroupStyle,A.line.width,D(t),A.line.dash)}),rt._axislayer.selectAll("g."+rt._id+"tick,path").remove(),rt._pos=Q+V+(A.outlinewidth||0)/2-("outside"===A.ticks?1:0),rt.side="right",c.syncOrAsync([function(){return l.doTicks(t,rt,!0)},function(){if(-1===["top","bottom"].indexOf(A.titleside)){var e=rt.titlefont.size,r=rt._offset+rt._length/2,a=L.l+(rt.position||0)*L.w+("right"===rt.side?10+e*(rt.showticklabels?1:.5):-10-e*(rt.showticklabels?.5:0));M("h"+rt._id+"title",{avoid:{selection:n.select(t).selectAll("g."+rt._id+"tick"),side:A.titleside,offsetLeft:L.l,offsetTop:L.t,maxShift:E.width},attributes:{x:a,y:r,"text-anchor":"middle"},transform:{rotate:"-90",offset:0}})}}])}function M(e,r){var n,a=w();n=s.traceIs(a,"markerColorscale")?"marker.colorbar.title":"colorbar.title";var i={propContainer:rt,propName:n,traceIndex:a.index,dfltName:"colorscale",containerGroup:lt.select(".cbtitle")},o="h"===e.charAt(0)?e.substr(1):"h"+e;lt.selectAll("."+o+",."+o+"-math-group").remove(),g.draw(t,e,f(i,r||{}))}function T(){var r=V+A.outlinewidth/2+d.bBox(rt._axislayer.node()).width;if(j=ut.select("text"),j.node()&&!j.classed("js-placeholder")){var n,a=ut.select(".h"+rt._id+"title-math-group").node();n=a&&-1!==["top","bottom"].indexOf(A.titleside)?d.bBox(a).width:d.bBox(ut.node()).right-Q-L.l,r=Math.max(r,n)}var i=2*A.xpad+r+A.borderwidth+A.outlinewidth/2,s=J-tt;lt.select(".cbbg").attr({x:Q-A.xpad-(A.borderwidth+A.outlinewidth)/2,y:tt-W,width:Math.max(i,2),height:Math.max(s+2*W,2)}).call(p.fill,A.bgcolor).call(p.stroke,A.bordercolor).style({"stroke-width":A.borderwidth}),lt.selectAll(".cboutline").attr({x:Q,y:tt+A.ypad+("top"===A.titleside?ct:0),width:Math.max(V,2),height:Math.max(s-2*A.ypad-ct,2)}).call(p.stroke,A.outlinecolor).style({fill:"None","stroke-width":A.outlinewidth});var l=({center:.5,right:1}[A.xanchor]||0)*i;lt.attr("transform","translate("+(L.l-l)+","+L.t+")"),o.autoMargin(t,e,{x:A.x,y:A.y,l:i*({right:1,center:.5}[A.xanchor]||0),r:i*({left:1,center:.5}[A.xanchor]||0),t:s*({bottom:1,middle:.5}[A.yanchor]||0),b:s*({top:1,middle:.5}[A.yanchor]||0)})}var E=t._fullLayout,L=E._size;if("function"!=typeof A.fillcolor&&"function"!=typeof A.line.color)return void E._infolayer.selectAll("g."+e).remove();var S,C,O=n.extent(("function"==typeof A.fillcolor?A.fillcolor:A.line.color).domain()),I=[],R=[],D="function"==typeof A.line.color?A.line.color:function(){return A.line.color},P="function"==typeof A.fillcolor?A.fillcolor:function(){return A.fillcolor},z=A.levels.end+A.levels.size/100,N=A.levels.size,F=1.001*O[0]-.001*O[1],B=1.001*O[1]-.001*O[0];for(C=0;C<1e5&&(S=A.levels.start+C*N,!(N>0?S>=z:S<=z));C++)S>F&&S0?S>=z:S<=z));C++)S>O[0]&&S1){var st=Math.pow(10,Math.floor(Math.log(ot)/Math.LN10));at*=st*c.roundUp(ot/st,[2,5,10]),(Math.abs(A.levels.start)/A.levels.size+1e-6)%1<2e-6&&(rt.tick0=0)}rt.dtick=at}rt.domain=[K+Z,K+X-Z],rt.setScale();var lt=E._infolayer.selectAll("g."+e).data([0]);lt.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)}),lt.attr("transform","translate("+Math.round(L.l)+","+Math.round(L.t)+")");var ut=lt.select(".cbtitleunshift").attr("transform","translate(-"+Math.round(L.l)+",-"+Math.round(L.t)+")");rt._axislayer=lt.select(".cbaxis");var ct=0;if(-1!==["top","bottom"].indexOf(A.titleside)){var ft,ht=L.l+(A.x+Y)*L.w,dt=rt.titlefont.size;ft="top"===A.titleside?(1-(K+X-Z))*L.h+L.t+3+.75*dt:(1-(K+Z))*L.h+L.t-3-.25*dt,M(rt._id+"title",{attributes:{x:ht,y:ft,"text-anchor":"start"}})}var pt=c.syncOrAsync([o.previousPromises,k,o.previousPromises,T],t);if(pt&&pt.then&&(t._promises||[]).push(pt),t._context.edits.colorbarPosition){var gt,mt,vt;u.init({element:lt.node(),gd:t,prepFn:function(){gt=lt.attr("transform"),h(lt)},moveFn:function(t,e){lt.attr("transform",gt+" translate("+t+","+e+")"),mt=u.align($+t/L.w,G,0,1,A.xanchor),vt=u.align(K-e/L.h,X,0,1,A.yanchor);var r=u.getCursor(mt,vt,A.xanchor,A.yanchor);h(lt,r)},doneFn:function(e){h(lt),e&&void 0!==mt&&void 0!==vt&&i.restyle(t,{"colorbar.x":mt,"colorbar.y":vt},w().index)}})}return pt}function w(){var r,n,a=e.substr(2);for(r=0;r=0?a.Reds:a.Blues,l.colorscale=g,s.reversescale&&(g=i(g)),s.colorscale=g)}},{"../../lib":350,"./flip_scale":244,"./scales":251}],240:[function(t,e,r){"use strict";var n=t("./attributes"),a=t("../../lib/extend").extendDeep;t("./scales.js");e.exports=function(t){return{color:{valType:"color",arrayOk:!0},colorscale:a({},n.colorscale,{}),cauto:a({},n.zauto,{}),cmax:a({},n.zmax,{}),cmin:a({},n.zmin,{}),autocolorscale:a({},n.autocolorscale,{}),reversescale:a({},n.reversescale,{})}}},{"../../lib/extend":343,"./attributes":238,"./scales.js":251}],241:[function(t,e,r){"use strict";var n=t("./scales");e.exports=n.RdBu},{"./scales":251}],242:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("../../lib"),i=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?a.nestedProperty(t,d).get()||{}:t,g=f?a.nestedProperty(e,d).get()||{}:e,m=p[h+"min"],v=p[h+"max"],y=p.colorscale;u(f+h+"auto",!(n(m)&&n(v)&&m=0;a--,i++)e=t[a],n[i]=[1-e[0],e[1]];return n}},{}],245:[function(t,e,r){"use strict";var n=t("./scales"),a=t("./default_scale"),i=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=a),t?("string"==typeof t&&(r(),"string"==typeof t&&r()),i(t)?t:e):e}},{"./default_scale":241,"./is_valid_scale_array":249,"./scales":251}],246:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("../../lib"),i=t("./is_valid_scale");e.exports=function(t,e){var r=e?a.nestedProperty(t,e).get()||{}:t,o=r.color,s=!1;if(Array.isArray(o))for(var l=0;l4/3-s?o:s}},{}],253:[function(t,e,r){"use strict";var n=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,r,i){return t="left"===r?0:"center"===r?1:"right"===r?2:n.constrain(Math.floor(3*t),0,2),e="bottom"===i?0:"middle"===i?1:"top"===i?2:n.constrain(Math.floor(3*e),0,2),a[e][t]}},{"../../lib":350}],254:[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 a(t){t._dragging=!1,t._replotPending&&l.plot(t)}function i(t){return o(t.changedTouches?t.changedTouches[0]:t,document.body)}var o=t("mouse-event-offset"),s=t("has-hover"),l=t("../../plotly"),u=t("../../lib"),c=t("../../plots/cartesian/constants"),f=t("../../constants/interactions"),h=e.exports={};h.align=t("./align"),h.getCursor=t("./cursor");var d=t("./unhover");h.unhover=d.wrapped,h.unhoverRaw=d.raw,h.init=function(t){function e(e){y._dragged=!1,y._dragging=!0;var a=i(e);return l=a[0],d=a[1],v=e.target,p=(new Date).getTime(),p-y._mouseDownTimex&&(b=Math.max(b-1,1)),t.doneFn&&t.doneFn(y._dragged,b,e),!y._dragged){var n;try{n=new MouseEvent("click",e)}catch(t){var l=i(e);n=document.createEvent("MouseEvents"),n.initMouseEvent("click",e.bubbles,e.cancelable,e.view,e.detail,e.screenX,e.screenY,l[0],l[1],e.ctrlKey,e.altKey,e.shiftKey,e.metaKey,e.button,e.relatedTarget)}v.dispatchEvent(n)}return a(y),y._dragged=!1,u.pauseEvent(e)}var l,d,p,g,m,v,y=t.gd,b=1,x=f.DBLCLICKDELAY;y._mouseDownTime||(y._mouseDownTime=0),t.element.style.pointerEvents="all",t.element.onmousedown=e,t.element.ontouchstart=e},h.coverSlip=n},{"../../constants/interactions":332,"../../lib":350,"../../plotly":384,"../../plots/cartesian/constants":394,"./align":252,"./cursor":253,"./unhover":255,"has-hover":149,"mouse-event-offset":158}],255:[function(t,e,r){"use strict";var n=t("../../lib/events"),a=e.exports={};a.wrapped=function(t,e,r){"string"==typeof t&&(t=document.getElementById(t)),t._hoverTimer&&(clearTimeout(t._hoverTimer),t._hoverTimer=void 0),a.raw(t,e,r)},a.raw=function(t,e){var r=t._fullLayout,a=t._hoverdata;e||(e={}),e.target&&!1===n.triggerHandler(t,"plotly_beforehover",e)||(r._hoverlayer.selectAll("g").remove(),r._hoverlayer.selectAll("line").remove(),r._hoverlayer.selectAll("circle").remove(),t._hoverdata=void 0,e.target&&a&&t.emit("plotly_unhover",{event:e,points:a}))}},{"../../lib/events":342}],256:[function(t,e,r){"use strict";r.dash={valType:"string",values:["solid","dot","dash","longdash","dashdot","longdashdot"],dflt:"solid"}},{}],257:[function(t,e,r){"use strict";function n(t,e,r,n,a,i,o,s){if(u.traceIs(r,"symbols")){var l=y(r);e.attr("d",function(t){var e;e="various"===t.ms||"various"===i.size?3:v.isBubble(r)?l(t.ms):(i.size||6)/2,t.mrc=e;var n=b.symbolNumber(t.mx||i.symbol)||0,a=n%100;return t.om=n%200>=100,b.symbolFuncs[a](e)+(n>=200?w:"")}).style("opacity",function(t){return(t.mo+1||i.opacity+1)-1})}var f,h,d,p=!1;if(t.so?(d=o.outlierwidth,h=o.outliercolor,f=i.outliercolor):(d=(t.mlw+1||o.width+1||(t.trace?t.trace.marker.line.width:0)+1)-1,h="mlc"in t?t.mlcc=a(t.mlc):Array.isArray(o.color)?c.defaultLine:o.color,Array.isArray(i.color)&&(f=c.defaultLine,p=!0),f="mc"in t?t.mcc=n(t.mc):i.color||"rgba(0,0,0,0)"),t.om)e.call(c.stroke,f).style({"stroke-width":(d||1)+"px",fill:"none"});else{e.style("stroke-width",d+"px");var g=i.gradient,m=t.mgt;if(m?p=!0:m=g&&g.type,m&&"none"!==m){var x=t.mgc;x?p=!0:x=g.color;var _="g"+s._fullLayout._uid+"-"+r.uid;p&&(_+="-"+t.i),e.call(b.gradient,s,_,m,f,x)}else e.call(c.fill,f);d&&e.call(c.stroke,h)}}function a(t,e,r,n){var a=t[0]-e[0],i=t[1]-e[1],s=r[0]-e[0],l=r[1]-e[1],u=Math.pow(a*a+i*i,T/2),c=Math.pow(s*s+l*l,T/2),f=(c*c*a-u*u*s)*n,h=(c*c*i-u*u*l)*n,d=3*c*(u+c),p=3*u*(u+c);return[[o.round(e[0]+(d&&f/d),2),o.round(e[1]+(d&&h/d),2)],[o.round(e[0]-(p&&f/p),2),o.round(e[1]-(p&&h/p),2)]]}function i(t){var e=t.getAttribute("data-unformatted");if(null!==e)return e+t.getAttribute("data-math")+t.getAttribute("text-anchor")+t.getAttribute("style")}var o=t("d3"),s=t("fast-isnumeric"),l=t("tinycolor2"),u=t("../../registry"),c=t("../color"),f=t("../colorscale"),h=t("../../lib"),d=t("../../lib/svg_text_utils"),p=t("../../constants/xmlns_namespaces"),g=t("../../constants/alignment"),m=g.LINE_SPACING,v=t("../../traces/scatter/subtypes"),y=t("../../traces/scatter/make_bubble_size_func"),b=e.exports={};b.font=function(t,e,r,n){h.isPlainObject(e)&&(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(c.fill,n)},b.setPosition=function(t,e,r){t.attr("x",e).attr("y",r)},b.setSize=function(t,e,r){t.attr("width",e).attr("height",r)},b.setRect=function(t,e,r,n,a){t.call(b.setPosition,e,r).call(b.setSize,n,a)},b.translatePoint=function(t,e,r,n){var a=r.c2p(t.x),i=n.c2p(t.y);return!!(s(a)&&s(i)&&e.node())&&("text"===e.node().nodeName?e.attr("x",a).attr("y",i):e.attr("transform","translate("+a+","+i+")"),!0)},b.translatePoints=function(t,e,r){t.each(function(t){var n=o.select(this);b.translatePoint(t,n,e,r)})},b.hideOutsideRangePoint=function(t,e,r,n){e.attr("display",r.isPtWithinRange(t)&&n.isPtWithinRange(t)?null:"none")},b.hideOutsideRangePoints=function(t,e){if(e._hasClipOnAxisFalse){var r=e.xaxis,n=e.yaxis;t.each(function(t){b.hideOutsideRangePoint(t,o.select(this),r,n)})}},b.getPx=function(t,e){return Number(t.style(e).replace(/px$/,""))},b.crispRound=function(t,e,r){return e&&s(e)?t._context.staticPlot?e:e<1?1:Math.round(e):r||0},b.singleLineStyle=function(t,e,r,n,a){e.style("fill","none");var i=(((t||[])[0]||{}).trace||{}).line||{},o=r||i.width||0,s=a||i.dash||"";c.stroke(e,n||i.color),b.dashLine(e,s,o)},b.lineGroupStyle=function(t,e,r,n){t.style("fill","none").each(function(t){var a=(((t||[])[0]||{}).trace||{}).line||{},i=e||a.width||0,s=n||a.dash||"";o.select(this).call(c.stroke,r||a.color).call(b.dashLine,s,i)})},b.dashLine=function(t,e,r){r=+r||0,e=b.dashStyle(e,r),t.style({"stroke-dasharray":e,"stroke-width":r+"px"})},b.dashStyle=function(t,e){e=+e||1;var r=Math.max(e,3);return"solid"===t?t="":"dot"===t?t=r+"px,"+r+"px":"dash"===t?t=3*r+"px,"+3*r+"px":"longdash"===t?t=5*r+"px,"+5*r+"px":"dashdot"===t?t=3*r+"px,"+r+"px,"+r+"px,"+r+"px":"longdashdot"===t&&(t=5*r+"px,"+2*r+"px,"+r+"px,"+2*r+"px"),t},b.singleFillStyle=function(t){var e=o.select(t.node()),r=e.data(),n=(((r[0]||[])[0]||{}).trace||{}).fillcolor;n&&t.call(c.fill,n)},b.fillGroupStyle=function(t){t.style("stroke-width",0).each(function(e){var r=o.select(this);try{r.call(c.fill,e[0].trace.fillcolor)}catch(e){h.error(e,t),r.remove()}})};var x=t("./symbol_defs");b.symbolNames=[],b.symbolFuncs=[],b.symbolNeedLines={},b.symbolNoDot={},b.symbolList=[],Object.keys(x).forEach(function(t){var e=x[t];b.symbolList=b.symbolList.concat([e.n,t,e.n+100,t+"-open"]),b.symbolNames[e.n]=t,b.symbolFuncs[e.n]=e.f,e.needLine&&(b.symbolNeedLines[e.n]=!0),e.noDot?b.symbolNoDot[e.n]=!0:b.symbolList=b.symbolList.concat([e.n+200,t+"-dot",e.n+300,t+"-open-dot"])});var _=b.symbolNames.length,w="M0,0.5L0.5,0L0,-0.5L-0.5,0Z";b.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=b.symbolNames.indexOf(t),t>=0&&(t+=e)}return t%100>=_||t>=400?0:Math.floor(Math.max(t,0))};var A={x1:1,x2:0,y1:0,y2:0},k={x1:0,x2:0,y1:1,y2:0};b.gradient=function(t,e,r,n,a,i){var s=e._fullLayout._defs.select(".gradients").selectAll("#"+r).data([n+a+i],h.identity);s.exit().remove(),s.enter().append("radial"===n?"radialGradient":"linearGradient").each(function(){var t=o.select(this);"horizontal"===n?t.attr(A):"vertical"===n&&t.attr(k),t.attr("id",r);var e=l(a),s=l(i);t.append("stop").attr({offset:"0%","stop-color":c.tinyRGB(s),"stop-opacity":s.getAlpha()}),t.append("stop").attr({offset:"100%","stop-color":c.tinyRGB(e),"stop-opacity":e.getAlpha()})}),t.style({fill:"url(#"+r+")","fill-opacity":null})},b.initGradients=function(t){var e=t._fullLayout._defs.selectAll(".gradients").data([0]);e.enter().append("g").classed("gradients",!0),e.selectAll("linearGradient,radialGradient").remove()},b.singlePointStyle=function(t,e,r,a,i,o){var s=r.marker;n(t,e,r,a,i,s,s.line,o)},b.pointStyle=function(t,e,r){if(t.size()){var n=e.marker,a=b.tryColorscale(n,""),i=b.tryColorscale(n,"line");t.each(function(t){b.singlePointStyle(t,o.select(this),e,a,i,r)})}},b.tryColorscale=function(t,e){var r=e?h.nestedProperty(t,e).get():t,n=r.colorscale,a=r.color;return n&&Array.isArray(a)?f.makeColorScaleFunc(f.extractScale(n,r.cmin,r.cmax)):h.identity};var M={start:1,end:-1,middle:0,bottom:1,top:-1};b.textPointStyle=function(t,e,r){t.each(function(t){var n=o.select(this),a=t.tx||e.text;if(!a||Array.isArray(a))return void n.remove();var i=t.tp||e.textposition,l=-1!==i.indexOf("top")?"top":-1!==i.indexOf("bottom")?"bottom":"middle",u=-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=s(c)&&c>0?c:0,n.call(b.font,t.tf||e.textfont.family,c,t.tc||e.textfont.color).attr("text-anchor",u).text(a).call(d.convertToTspans,r);var h=o.select(this.parentNode),p=(d.lineCount(n)-1)*m+1,g=M[u]*f,v=.75*c+M[l]*f+(M[l]-1)*p*c/2;h.attr("transform","translate("+g+","+v+")")})};var T=.5;b.smoothopen=function(t,e){if(t.length<3)return"M"+t.join("L");var r,n="M"+t[0],i=[];for(r=1;r=1e4&&(b.savedBBoxes={},S=0),r&&(b.savedBBoxes[r]=v),S++,h.extendFlat({},v)},b.setClipUrl=function(t,e){if(!e)return void t.attr("clip-path",null);var r="#"+e,n=o.select("base");n.size()&&n.attr("href")&&(r=window.location.href.split("#")[0]+r),t.attr("clip-path","url("+r+")")},b.getTranslate=function(t){var e=/.*\btranslate\((-?\d*\.?\d*)[^-\d]*(-?\d*\.?\d*)[^\d].*/,r=t.attr?"attr":"getAttribute",n=t[r]("transform")||"",a=n.replace(e,function(t,e,r){return[e,r].join(" ")}).split(" ");return{x:+a[0]||0,y:+a[1]||0}},b.setTranslate=function(t,e,r){var n=/(\btranslate\(.*?\);?)/,a=t.attr?"attr":"getAttribute",i=t.attr?"attr":"setAttribute",o=t[a]("transform")||"";return e=e||0,r=r||0,o=o.replace(n,"").trim(),o+=" translate("+e+", "+r+")",o=o.trim(),t[i]("transform",o),o},b.getScale=function(t){var e=/.*\bscale\((\d*\.?\d*)[^\d]*(\d*\.?\d*)[^\d].*/,r=t.attr?"attr":"getAttribute",n=t[r]("transform")||"",a=n.replace(e,function(t,e,r){return[e,r].join(" ")}).split(" ");return{x:+a[0]||1,y:+a[1]||1}},b.setScale=function(t,e,r){var n=/(\bscale\(.*?\);?)/,a=t.attr?"attr":"getAttribute",i=t.attr?"attr":"setAttribute",o=t[a]("transform")||"";return e=e||1,r=r||1,o=o.replace(n,"").trim(),o+=" scale("+e+", "+r+")",o=o.trim(),t[i]("transform",o),o},b.setPointGroupScale=function(t,e,r){var n,a,i;return e=e||1,r=r||1,a=1===e&&1===r?"":" scale("+e+","+r+")",i=/\s*sc.*/,t.each(function(){n=(this.getAttribute("transform")||"").replace(i,""),n+=a,n=n.trim(),this.setAttribute("transform",n)}),a};var C=/translate\([^)]*\)\s*$/;b.setTextPointsScale=function(t,e,r){t.each(function(){var t,n=o.select(this),a=n.select("text"),i=parseFloat(a.attr("x")||0),s=parseFloat(a.attr("y")||0),l=(n.attr("transform")||"").match(C);t=1===e&&1===r?[]:["translate("+i+","+s+")","scale("+e+","+r+")","translate("+-i+","+-s+")"],l&&t.push(l),n.attr("transform",t.join(" "))})}},{"../../constants/alignment":329,"../../constants/xmlns_namespaces":335,"../../lib":350,"../../lib/svg_text_utils":369,"../../registry":429,"../../traces/scatter/make_bubble_size_func":499,"../../traces/scatter/subtypes":504,"../color":233,"../colorscale":247,"./symbol_defs":258,d3:62,"fast-isnumeric":68,tinycolor2:200}],258:[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,a="l"+e+",-"+e,i="l-"+e+",-"+e,o="l-"+e+","+e;return"M0,"+e+r+a+i+a+i+o+i+o+r+o+r+"Z"}},"triangle-up":{n:5,f:function(t){var e=n.round(2*t/Math.sqrt(3),2);return"M-"+e+","+n.round(t/2,2)+"H"+e+"L0,-"+n.round(t,2)+"Z"}},"triangle-down":{n:6,f:function(t){var e=n.round(2*t/Math.sqrt(3),2);return"M-"+e+",-"+n.round(t/2,2)+"H"+e+"L0,"+n.round(t,2)+"Z"}},"triangle-left":{n:7,f:function(t){var e=n.round(2*t/Math.sqrt(3),2);return"M"+n.round(t/2,2)+",-"+e+"V"+e+"L-"+n.round(t,2)+",0Z"}},"triangle-right":{n:8,f:function(t){var e=n.round(2*t/Math.sqrt(3),2);return"M-"+n.round(t/2,2)+",-"+e+"V"+e+"L"+n.round(t,2)+",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),a=n.round(-t,2),i=n.round(-.309*t,2);return"M"+e+","+i+"L"+r+","+n.round(.809*t,2)+"H-"+r+"L-"+e+","+i+"L0,"+a+"Z"}},hexagon:{n:14,f:function(t){var e=n.round(t,2),r=n.round(t/2,2),a=n.round(t*Math.sqrt(3)/2,2);return"M"+a+",-"+r+"V"+r+"L0,"+e+"L-"+a+","+r+"V-"+r+"L0,-"+e+"Z"}},hexagon2:{n:15,f:function(t){var e=n.round(t,2),r=n.round(t/2,2),a=n.round(t*Math.sqrt(3)/2,2);return"M-"+r+","+a+"H"+r+"L"+e+",0L"+r+",-"+a+"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),a=n.round(.951*e,2),i=n.round(.363*e,2),o=n.round(.588*e,2),s=n.round(-e,2),l=n.round(-.309*e,2),u=n.round(.118*e,2),c=n.round(.809*e,2);return"M"+r+","+l+"H"+a+"L"+i+","+u+"L"+o+","+c+"L0,"+n.round(.382*e,2)+"L-"+o+","+c+"L-"+i+","+u+"L-"+a+","+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),a=n.round(.76*t,2);return"M-"+a+",0l-"+r+",-"+e+"h"+a+"l"+r+",-"+e+"l"+r+","+e+"h"+a+"l-"+r+","+e+"l"+r+","+e+"h-"+a+"l-"+r+","+e+"l-"+r+",-"+e+"h-"+a+"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),a=n.round(1.6*t,2),i=n.round(4*t,2),o="A "+i+","+i+" 0 0 1 ";return"M-"+e+","+r+o+e+","+r+o+"0,-"+a+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),a=n.round(1.6*t,2),i=n.round(4*t,2),o="A "+i+","+i+" 0 0 1 ";return"M"+e+",-"+r+o+"-"+e+",-"+r+o+"0,"+a+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),a="A "+r+","+r+" 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=n.round(1.4*t,2),r=n.round(1.9*t,2),a="A "+r+","+r+" 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=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),a=n.round(.8*t,2);return"M-"+e+","+a+"L0,0M"+e+","+a+"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),a=n.round(.8*t,2);return"M-"+e+",-"+a+"L0,0M"+e+",-"+a+"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),a=n.round(.8*t,2);return"M"+a+","+e+"L0,0M"+a+",-"+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),a=n.round(.8*t,2);return"M-"+a+","+e+"L0,0M-"+a+",-"+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}],259:[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"}}}},{}],260:[function(t,e,r){"use strict";function n(t,e,r,n){var i=e["error_"+n]||{},l=i.visible&&-1!==["linear","log"].indexOf(r.type),u=[];if(l){for(var c=s(i),f=0;f0;t.each(function(t){var h,d=t[0].trace,p=d.error_x||{},g=d.error_y||{};d.ids&&(h=function(t){return t.id});var m=s.hasMarkers(d)&&d.marker.maxdisplayed>0;if(g.visible||p.visible){var v=a.select(this).selectAll("g.errorbar").data(t,h);v.exit().remove(),v.style("opacity",1);var y=v.enter().append("g").classed("errorbar",!0);f&&y.style("opacity",0).transition().duration(r.duration).style("opacity",1),o.setClipUrl(v,e.layerClipId),v.each(function(t){var e=a.select(this),o=n(t,u,c);if(!m||t.vis){var s;if(g.visible&&i(o.x)&&i(o.yh)&&i(o.ys)){var h=g.width;s="M"+(o.x-h)+","+o.yh+"h"+2*h+"m-"+h+",0V"+o.ys,o.noYS||(s+="m-"+h+",0h"+2*h);var d=e.select("path.yerror");l=!d.size(),l?d=e.append("path").style("vector-effect","non-scaling-stroke").classed("yerror",!0):f&&(d=d.transition().duration(r.duration).ease(r.easing)),d.attr("d",s)}if(p.visible&&i(o.y)&&i(o.xh)&&i(o.xs)){var v=(p.copy_ystyle?g:p).width;s="M"+o.xh+","+(o.y-v)+"v"+2*v+"m0,-"+v+"H"+o.xs,o.noXS||(s+="m0,-"+v+"v"+2*v);var y=e.select("path.xerror");l=!y.size(),l?y=e.append("path").style("vector-effect","non-scaling-stroke").classed("xerror",!0):f&&(y=y.transition().duration(r.duration).ease(r.easing)),y.attr("d",s)}}})}})}},{"../../traces/scatter/subtypes":504,"../drawing":257,d3:62,"fast-isnumeric":68}],265:[function(t,e,r){"use strict";var n=t("d3"),a=t("../color");e.exports=function(t){t.each(function(t){var e=t[0].trace,r=e.error_y||{},i=e.error_x||{},o=n.select(this);o.selectAll("path.yerror").style("stroke-width",r.thickness+"px").call(a.stroke,r.color),i.copy_ystyle&&(i=r),o.selectAll("path.xerror").style("stroke-width",i.thickness+"px").call(a.stroke,i.color)})}},{"../color":233,d3:62}],266:[function(t,e,r){"use strict";var n=t("../../lib/extend").extendFlat,a=t("../../plots/font_attributes");e.exports={hoverlabel:{bgcolor:{valType:"color",arrayOk:!0},bordercolor:{valType:"color",arrayOk:!0},font:{family:n({},a.family,{arrayOk:!0}),size:n({},a.size,{arrayOk:!0}),color:n({},a.color,{arrayOk:!0})},namelength:{valType:"integer",min:-1,arrayOk:!0}}}},{"../../lib/extend":343,"../../plots/font_attributes":413}],267:[function(t,e,r){"use strict";function n(t,e,r,n){n=n||a.identity,Array.isArray(t)&&(e[0][r]=n(t))}var a=t("../../lib"),i=t("../../registry");e.exports=function(t){for(var e=t.calcdata,r=t._fullLayout,o=0;o=0&&r.indexK.width||Q<0||Q>K.height)return b.unhoverRaw(t,e)}if(D="xval"in e?w.flat(h,e.xval):w.p2c(E,Z),P="yval"in e?w.flat(h,e.yval):w.p2c(L,Q),!f(D[0])||!f(P[0]))return d.warn("Fx.hover failed",e,t),b.unhoverRaw(t,e)}var J=1/0;for(N=0;NX&&(Y.splice(0,X),J=Y[0].distance)}if(0===Y.length)return b.unhoverRaw(t,e);Y.sort(function(t,e){return t.distance-e.distance});var at=t._hoverdata,it=[];for(z=0;z1,ut=y.combine(g.plot_bgcolor||y.background,g.paper_bgcolor),ct={hovermode:R,rotateLabels:lt,bgColor:ut,container:g._hoverlayer,outerContainer:g._paperdiv,commonLabelOpts:g.hoverlabel},ft=a(Y,ct,t);if(i(Y,lt?"xa":"ya"),o(ft,lt),e.target&&e.target.tagName){var ht=_.getComponentMethod("annotations","hasClickToShow")(t,it);m(c.select(e.target),ht?"pointer":"")}e.target&&!n&&u(t,e,at)&&(at&&t.emit("plotly_unhover",{event:e,points:at}),t.emit("plotly_hover",{event:e,points:t._hoverdata,xaxes:E,yaxes:L,xvals:D,yvals:P}))}function a(t,e,r){var n,a,i=e.hovermode,o=e.rotateLabels,s=e.bgColor,l=e.container,u=e.outerContainer,f=e.commonLabelOpts||{},h=e.fontFamily||A.HOVERFONT,d=e.fontSize||A.HOVERFONTSIZE,p=t[0],m=p.xa,b=p.ya,x="y"===i?"yLabel":"xLabel",_=p[x],w=(String(_)||"").split(" ")[0],M=u.node().getBoundingClientRect(),T=M.top,E=M.width,L=M.height,O=p.distance<=A.MAXDIST&&("x"===i||"y"===i);for(n=0;n-1&&n.length>p&&(n=p>3?n.substr(0,p-3)+"...":n.substr(0,p))}void 0!==t.extraText&&(a+=t.extraText),void 0!==t.zLabel?(void 0!==t.xLabel&&(a+="x: "+t.xLabel+"
"),void 0!==t.yLabel&&(a+="y: "+t.yLabel+"
"),a+=(a?"z: ":"")+t.zLabel):O&&t[i+"Label"]===_?a=t[("x"===i?"y":"x")+"Label"]||"":void 0===t.xLabel?void 0!==t.yLabel&&(a=t.yLabel):a=void 0===t.yLabel?t.xLabel:"("+t.xLabel+", "+t.yLabel+")",t.text&&!Array.isArray(t.text)&&(a+=(a?"
":"")+t.text),""===a&&(""===n&&e.remove(),a=n);var m=e.select("text.nums").call(v.font,t.fontFamily||h,t.fontSize||d,t.fontColor||f).text(a).attr("data-notex",1).call(g.positionText,0,0).call(g.convertToTspans,r),b=e.select("text.name"),x=0;n&&n!==a?(b.call(v.font,t.fontFamily||h,t.fontSize||d,u).text(n).attr("data-notex",1).call(g.positionText,0,0).call(g.convertToTspans,r),x=b.node().getBoundingClientRect().width+2*C):(b.remove(),e.select("rect").remove()),e.select("path").style({fill:u,stroke:f});var w,A,M=m.node().getBoundingClientRect(),I=t.xa._offset+(t.x0+t.x1)/2,R=t.ya._offset+(t.y0+t.y1)/2,D=Math.abs(t.x1-t.x0),P=Math.abs(t.y1-t.y0),z=M.width+S+C+x;t.ty0=T-M.top,t.bx=M.width+2*C,t.by=M.height+2*C,t.anchor="start",t.txwidth=M.width,t.tx2width=x,t.offset=0,o?(t.pos=I,w=R+P/2+z<=L,A=R-P/2-z>=0,"top"!==t.idealAlign&&w||!A?w?(R+=P/2,t.anchor="start"):t.anchor="middle":(R-=P/2,t.anchor="end")):(t.pos=R,w=I+D/2+z<=E,A=I-D/2-z>=0,"left"!==t.idealAlign&&w||!A?w?(I+=D/2,t.anchor="start"):t.anchor="middle":(I-=D/2,t.anchor="end")),m.attr("text-anchor",t.anchor),x&&b.attr("text-anchor",t.anchor),e.attr("transform","translate("+I+","+R+")"+(o?"rotate("+k+")":""))}),D}function i(t,e){function r(t){var e=t[0],r=t[t.length-1];if(a=e.pmin-e.pos-e.dp+e.size,i=r.pos+r.dp+r.size-e.pmax,a>.01){for(s=t.length-1;s>=0;s--)t[s].dp+=a;n=!1}if(!(i<.01)){if(a<-.01){for(s=t.length-1;s>=0;s--)t[s].dp-=i;n=!1}if(n){var u=0;for(o=0;oe.pmax&&u++;for(o=t.length-1;o>=0&&!(u<=0);o--)l=t[o],l.pos>e.pmax-1&&(l.del=!0,u--);for(o=0;o=0;s--)t[s].dp-=i;for(o=t.length-1;o>=0&&!(u<=0);o--)l=t[o],l.pos+l.dp+l.size>e.pmax&&(l.del=!0,u--)}}}for(var n,a,i,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)?T: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+=a;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(i=u/h.length,s=h.length-1;s>=0;s--)h[s].dp-=i;n=!1}else o++}f.forEach(r)}for(o=f.length-1;o>=0;o--){var m=f[o];for(s=m.length-1;s>=0;s--){var v=m[s],y=t[v.i];y.offset=v.dp,y.del=v.del}}}function o(t,e){t.each(function(t){var r=c.select(this);if(t.del)return void r.remove();var n="end"===t.anchor?-1:1,a=r.select("text.nums"),i={start:1,end:-1,middle:0}[t.anchor],o=i*(S+C),s=o+i*(t.txwidth+C),l=0,u=t.offset;"middle"===t.anchor&&(o-=t.tx2width/2,s-=t.tx2width/2),e&&(u*=-L,l=t.offset*E),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*S+l)+","+(S+u)+"v"+(t.by/2-S)+"h"+n*t.bx+"v-"+t.by+"H"+(n*S+l)+"V"+(u-S)+"Z"),a.call(g.positionText,o+l,u+t.ty0-t.by/2+C),t.tx2width&&(r.select("text.name").call(g.positionText,s+i*C+l,u+t.ty0-t.by/2+C),r.select("rect").call(v.setRect,s+(i-1)*t.tx2width/2+l,u-t.by/2-1,t.tx2width,t.by+2))})}function s(t,e){function r(e,r,o){var s;if(i[r])s=i[r];else if(a[r]){var l=a[r];Array.isArray(l)&&Array.isArray(l[t.index[0]])&&(s=l[t.index[0]][t.index[1]])}else s=d.nestedProperty(n,o).get();s&&(t[e]=s)}var n=t.trace||{},a=t.cd[0],i=t.cd[t.index]||{};r("hoverinfo","hi","hoverinfo"),r("color","hbg","hoverlabel.bgcolor"),r("borderColor","hbc","hoverlabel.bordercolor"),r("fontFamily","htf","hoverlabel.font.family"),r("fontSize","hts","hoverlabel.font.size"),r("fontColor","htc","hoverlabel.font.color"),r("nameLength","hnl","hoverlabel.namelength"),t.posref="y"===e?(t.x0+t.x1)/2:(t.y0+t.y1)/2,t.x0=d.constrain(t.x0,0,t.xa._length),t.x1=d.constrain(t.x1,0,t.xa._length),t.y0=d.constrain(t.y0,0,t.ya._length),t.y1=d.constrain(t.y1,0,t.ya._length);var o;if(void 0!==t.xLabelVal){o="log"===t.xa.type&&t.xLabelVal<=0;var s=x.tickText(t.xa,t.xa.c2l(o?-t.xLabelVal:t.xLabelVal),"hover");o?0===t.xLabelVal?t.xLabel="0":t.xLabel="-"+s.text:t.xLabel=s.text,t.xVal=t.xa.c2d(t.xLabelVal)}if(void 0!==t.yLabelVal){o="log"===t.ya.type&&t.yLabelVal<=0;var l=x.tickText(t.ya,t.ya.c2l(o?-t.yLabelVal:t.yLabelVal),"hover");o?0===t.yLabelVal?t.yLabel="0":t.yLabel="-"+l.text:t.yLabel=l.text,t.yVal=t.ya.c2d(t.yLabelVal)}if(void 0!==t.zLabelVal&&(t.zLabel=String(t.zLabelVal)),!(isNaN(t.xerr)||"log"===t.xa.type&&t.xerr<=0)){var u=x.tickText(t.xa,t.xa.c2l(t.xerr),"hover").text;void 0!==t.xerrneg?t.xLabel+=" +"+u+" / -"+x.tickText(t.xa,t.xa.c2l(t.xerrneg),"hover").text:t.xLabel+=" \xb1 "+u,"x"===e&&(t.distance+=1)}if(!(isNaN(t.yerr)||"log"===t.ya.type&&t.yerr<=0)){var c=x.tickText(t.ya,t.ya.c2l(t.yerr),"hover").text;void 0!==t.yerrneg?t.yLabel+=" +"+c+" / -"+x.tickText(t.ya,t.ya.c2l(t.yerrneg),"hover").text:t.yLabel+=" \xb1 "+c,"y"===e&&(t.distance+=1)}var f=t.hoverinfo||t.trace.hoverinfo;return"all"!==f&&(f=f.split("+"),-1===f.indexOf("x")&&(t.xLabel=void 0),-1===f.indexOf("y")&&(t.yLabel=void 0),-1===f.indexOf("z")&&(t.zLabel=void 0),-1===f.indexOf("text")&&(t.text=void 0),-1===f.indexOf("name")&&(t.name=void 0)),t}function l(t,e){var r=e.hovermode,n=e.container,a=t[0],i=a.xa,o=a.ya,s=i.showspikes,l=o.showspikes;if(n.selectAll(".spikeline").remove(),"closest"===r&&(s||l)){var u=e.fullLayout,c=i._offset+(a.x0+a.x1)/2,f=o._offset+(a.y0+a.y1)/2,d=y.combine(u.plot_bgcolor,u.paper_bgcolor),p=h.readability(a.color,d)<1.5?y.contrast(d):a.color;if(l){var g=o.spikemode,m=o.spikethickness,b=o.spikecolor||p,x=o._boundingBox,_=(x.left+x.right)/2=0;n--){var a=r[n],i=t._hoverdata[n];if(a.curveNumber!==i.curveNumber||String(a.pointNumber)!==String(i.pointNumber))return!0}return!1}var c=t("d3"),f=t("fast-isnumeric"),h=t("tinycolor2"),d=t("../../lib"),p=t("../../lib/events"),g=t("../../lib/svg_text_utils"),m=t("../../lib/override_cursor"),v=t("../drawing"),y=t("../color"),b=t("../dragelement"),x=t("../../plots/cartesian/axes"),_=t("../../registry"),w=t("./helpers"),A=t("./constants"),k=A.YANGLE,M=Math.PI*k/180,T=1/Math.sin(M),E=Math.cos(M),L=Math.sin(M),S=A.HOVERARROWSIZE,C=A.HOVERTEXTPAD;r.hover=function(t,e,r,a){if("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+A.HOVERMINTIME)return n(t,e,r,a),void(t._lastHoverTime=Date.now());t._hoverTimer=setTimeout(function(){n(t,e,r,a),t._lastHoverTime=Date.now(),t._hoverTimer=void 0},A.HOVERMINTIME)},r.loneHover=function(t,e){var r={color:t.color||y.defaultLine,x0:t.x0||t.x||0,x1:t.x1||t.x||0,y0:t.y0||t.y||0,y1:t.y1||t.y||0,xLabel:t.xLabel,yLabel:t.yLabel,zLabel:t.zLabel,text:t.text,name:t.name,idealAlign:t.idealAlign,borderColor:t.borderColor,fontFamily:t.fontFamily,fontSize:t.fontSize,fontColor:t.fontColor,trace:{index:0,hoverinfo:""},xa:{_offset:0},ya:{_offset:0},index:0},n=c.select(e.container),i=e.outerContainer?c.select(e.outerContainer):n,s={hovermode:"closest",rotateLabels:!1,bgColor:e.bgColor||y.background,container:n,outerContainer:i},l=a([r],s,e.gd);return o(l,s.rotateLabels),l.node()}},{"../../lib":350,"../../lib/events":342,"../../lib/override_cursor":359,"../../lib/svg_text_utils":369,"../../plots/cartesian/axes":389,"../../registry":429,"../color":233,"../dragelement":254,"../drawing":257,"./constants":269,"./helpers":271,d3:62,"fast-isnumeric":68,tinycolor2:200}],273:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function(t,e,r,a){a=a||{},r("hoverlabel.bgcolor",a.bgcolor),r("hoverlabel.bordercolor",a.bordercolor),r("hoverlabel.namelength",a.namelength),n.coerceFont(r,"hoverlabel.font",a.font)}},{"../../lib":350}],274:[function(t,e,r){"use strict";function n(t){var e=s.isD3Selection(t)?t:o.select(t);e.selectAll("g.hovertext").remove(),e.selectAll(".spikeline").remove()}function a(t,e,r){return s.castOption(t,e,"hoverlabel."+r)}function i(t,e,r){function n(r){return s.coerceHoverinfo({hoverinfo:r},{_module:t._module},e)}return s.castOption(t,r,"hoverinfo",n)}var o=t("d3"),s=t("../../lib"),l=t("../dragelement"),u=t("./helpers"),c=t("./layout_attributes");e.exports={moduleType:"component",name:"fx",constants:t("./constants"),schema:{layout:c},attributes:t("./attributes"),layoutAttributes:c,supplyLayoutGlobalDefaults:t("./layout_global_defaults"),supplyDefaults:t("./defaults"),supplyLayoutDefaults:t("./layout_defaults"),calc:t("./calc"),getDistanceFunction:u.getDistanceFunction,getClosest:u.getClosest,inbox:u.inbox,appendArrayPointValue:u.appendArrayPointValue,castHoverOption:a,castHoverinfo:i,hover:t("./hover").hover,unhover:l.unhover,loneHover:t("./hover").loneHover,loneUnhover:n,click:t("./click")}},{"../../lib":350,"../dragelement":254,"./attributes":266,"./calc":267,"./click":268,"./constants":269,"./defaults":270,"./helpers":271,"./hover":272,"./layout_attributes":275,"./layout_defaults":276,"./layout_global_defaults":277,d3:62}],275:[function(t,e,r){"use strict";var n=t("../../lib/extend").extendFlat,a=t("../../plots/font_attributes"),i=t("./constants");e.exports={dragmode:{valType:"enumerated",values:["zoom","pan","select","lasso","orbit","turntable"],dflt:"zoom"},hovermode:{valType:"enumerated",values:["x","y","closest",!1]},hoverlabel:{bgcolor:{valType:"color"},bordercolor:{valType:"color"},font:{family:n({},a.family,{dflt:i.HOVERFONT}),size:n({},a.size,{dflt:i.HOVERFONTSIZE}),color:n({},a.color)},namelength:{valType:"integer",min:-1,dflt:15}}}},{"../../lib/extend":343,"../../plots/font_attributes":413,"./constants":269}],276:[function(t,e,r){"use strict";function n(t){for(var e=!0,r=0;r=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}},{}],284:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),a=t("../color/attributes"),i=t("../../lib/extend").extendFlat;e.exports={bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:a.defaultLine},borderwidth:{valType:"number",min:0,dflt:0},font:i({},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":343,"../../plots/font_attributes":413,"../color/attributes":232}],285:[function(t,e,r){"use strict";e.exports={scrollBarWidth:4,scrollBarHeight:20,scrollBarColor:"#808BA4",scrollBarMargin:4}},{}],286:[function(t,e,r){"use strict";var n=t("../../registry"),a=t("../../lib"),i=t("./attributes"),o=t("../../plots/layout_attributes"),s=t("./helpers");e.exports=function(t,e,r){function l(t,e){return a.coerce(d,p,i,t,e)}for(var u,c,f,h,d=t.legend||{},p=e.legend={},g=0,m="normal",v=0;v1)){if(l("bgcolor",e.paper_bgcolor),l("bordercolor"),l("borderwidth"),a.coerceFont(l,"font",e.font),l("orientation"),"h"===p.orientation){var b=t.xaxis;b&&b.rangeslider&&b.rangeslider.visible?(u=0,f="left",c=1.1,h="bottom"):(u=0,f="left",c=-.1,h="top")}l("traceorder",m),s.isGrouped(e.legend)&&l("tracegroupgap"),l("x",u),l("xanchor",f),l("y",c),l("yanchor",h),a.noneOrAll(d,p,["x","y"])}}},{"../../lib":350,"../../plots/layout_attributes":420,"../../registry":429,"./attributes":284,"./helpers":289}],287:[function(t,e,r){"use strict";function n(t,e){function r(r){y.convertToTspans(r,e,function(){o(t,e)})}var n=t.data()[0][0],a=e._fullLayout,i=n.trace,s=p.traceIs(i,"pie"),l=i.index,u=s?n.label:i.name,c=t.selectAll("text.legendtext").data([0]);c.enter().append("text").classed("legendtext",!0),c.attr("text-anchor","start").classed("user-select-none",!0).call(m.font,a.legend.font).text(u),e._context.edits.legendText&&!s?c.call(y.makeEditable,{gd:e}).call(r).on("edit",function(t){this.text(t).call(r),this.text()||(t=" ");var a,i=n.trace._fullInput||{};if(-1!==["ohlc","candlestick"].indexOf(i.type)){var o=n.trace.transforms;a=o[o.length-1].direction+".name"}else a="name";f.restyle(e,a,t,l)}):c.call(r)}function a(t,e){var r,n=1,a=t.selectAll("rect").data([0]);a.enter().append("rect").classed("legendtoggle",!0).style("cursor","pointer").attr("pointer-events","all").call(v.fill,"rgba(0,0,0,0)"),a.on("mousedown",function(){r=(new Date).getTime(),r-e._legendMouseDownTimeE&&(n=Math.max(n-1,1)),1===n?r._clickTimeout=setTimeout(function(){i(t,e,n)},E):2===n&&(r._clickTimeout&&clearTimeout(r._clickTimeout),e._legendMouseDownTime=0,i(t,e,n))}})}function i(t,e,r){if(!e._dragged&&!e._editing){var n,a,i=e._fullLayout.hiddenlabels?e._fullLayout.hiddenlabels.slice():[],o=t.data()[0][0],s=e._fullData,l=o.trace,u=l.legendgroup,c=[];if(1===r&&T&&e.data&&e._context.showTips?(h.notifier("Double click on legend to isolate individual trace","long"),T=!1):T=!1,p.traceIs(l,"pie")){var d=o.label,g=i.indexOf(d);1===r?-1===g?i.push(d):i.splice(g,1):2===r&&(i=[],e.calcdata[0].forEach(function(t){d!==t.label&&i.push(t.label)}),e._fullLayout.hiddenlabels&&e._fullLayout.hiddenlabels.length===i.length&&-1===g&&(i=[])),f.relayout(e,"hiddenlabels",i)}else{var m,v=[],y=[];for(m=0;mn.width-(n.margin.r+n.margin.l)&&(b=0,g+=v,a.height=a.height+v,v=0),m.setTranslate(this,i+b,5+i+e.height/2+g),a.width+=o+r,a.height=Math.max(a.height,e.height),b+=o+r,v=Math.max(e.height,v)}),a.width+=2*i,a.height+=10+2*i}a.width=Math.ceil(a.width),a.height=Math.ceil(a.height),r.each(function(e){var r=e[0] +;c.select(this).select(".legendtoggle").call(m.setRect,0,-r.height/2,(t._context.edits.legendText?0:a.width)+s,r.height)})}function l(t){var e=t._fullLayout,r=e.legend,n="left";M.isRightAnchor(r)?n="right":M.isCenterAnchor(r)&&(n="center");var a="top";M.isBottomAnchor(r)?a="bottom":M.isMiddleAnchor(r)&&(a="middle"),d.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}[a]||0),t:r.height*({bottom:1,middle:.5}[a]||0)})}function u(t){var e=t._fullLayout,r=e.legend,n="left";M.isRightAnchor(r)?n="right":M.isCenterAnchor(r)&&(n="center"),d.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 c=t("d3"),f=t("../../plotly"),h=t("../../lib"),d=t("../../plots/plots"),p=t("../../registry"),g=t("../dragelement"),m=t("../drawing"),v=t("../color"),y=t("../../lib/svg_text_utils"),b=t("./constants"),x=t("../../constants/interactions"),_=t("../../constants/alignment").LINE_SPACING,w=t("./get_legend_data"),A=t("./style"),k=t("./helpers"),M=t("./anchor_utils"),T=!0,E=x.DBLCLICKDELAY;e.exports=function(t){function e(t,e){S.attr("data-scroll",e).call(m.setTranslate,0,e),C.call(m.setRect,B,t,b.scrollBarWidth,b.scrollBarHeight),T.select("rect").attr({y:y.borderwidth-e})}var r=t._fullLayout,o="legend"+r._uid;if(r._infolayer&&t.calcdata){t._legendMouseDownTime||(t._legendMouseDownTime=0);var y=r.legend,x=r.showlegend&&w(t.calcdata,y),_=r.hiddenlabels||[];if(!r.showlegend||!x.length)return r._infolayer.selectAll(".legend").remove(),r._topdefs.select("#"+o).remove(),void d.autoMargin(t,"legend");var k=r._infolayer.selectAll("g.legend").data([0]);k.enter().append("g").attr({class:"legend","pointer-events":"all"});var T=r._topdefs.selectAll("#"+o).data([0]);T.enter().append("clipPath").attr("id",o).append("rect");var L=k.selectAll("rect.bg").data([0]);L.enter().append("rect").attr({class:"bg","shape-rendering":"crispEdges"}),L.call(v.stroke,y.bordercolor),L.call(v.fill,y.bgcolor),L.style("stroke-width",y.borderwidth+"px");var S=k.selectAll("g.scrollbox").data([0]);S.enter().append("g").attr("class","scrollbox");var C=k.selectAll("rect.scrollbar").data([0]);C.enter().append("rect").attr({class:"scrollbar",rx:20,ry:2,width:0,height:0}).call(v.fill,"#808BA4");var O=S.selectAll("g.groups").data(x);O.enter().append("g").attr("class","groups"),O.exit().remove();var I=O.selectAll("g.traces").data(h.identity);I.enter().append("g").attr("class","traces"),I.exit().remove(),I.call(A,t).style("opacity",function(t){var e=t[0].trace;return p.traceIs(e,"pie")?-1!==_.indexOf(t[0].label)?.5:1:"legendonly"===e.visible?.5:1}).each(function(){c.select(this).call(n,t).call(a,t)});var R=0!==k.enter().size();R&&(s(t,O,I),l(t));var D=r.width,P=r.height;s(t,O,I),y.height>P?u(t):l(t);var z=r._size,N=z.l+z.w*y.x,F=z.t+z.h*(1-y.y);M.isRightAnchor(y)?N-=y.width:M.isCenterAnchor(y)&&(N-=y.width/2),M.isBottomAnchor(y)?F-=y.height:M.isMiddleAnchor(y)&&(F-=y.height/2);var B=y.width,j=z.w;B>j?(N=z.l,B=j):(N+B>D&&(N=D-B),N<0&&(N=0),B=Math.min(D-N,y.width));var H=y.height,U=z.h;H>U?(F=z.t,H=U):(F+H>P&&(F=P-H),F<0&&(F=0),H=Math.min(P-F,y.height)),m.setTranslate(k,N,F);var V,G,q=H-b.scrollBarHeight-2*b.scrollBarMargin,X=y.height-H;if(y.height<=H||t._context.staticPlot)L.attr({width:B-y.borderwidth,height:H-y.borderwidth,x:y.borderwidth/2,y:y.borderwidth/2}),m.setTranslate(S,0,0),T.select("rect").attr({width:B-2*y.borderwidth,height:H-2*y.borderwidth,x:y.borderwidth,y:y.borderwidth}),S.call(m.setClipUrl,o);else{V=b.scrollBarMargin,G=S.attr("data-scroll")||0,L.attr({width:B-2*y.borderwidth+b.scrollBarWidth+b.scrollBarMargin,height:H-y.borderwidth,x:y.borderwidth/2,y:y.borderwidth/2}),T.select("rect").attr({width:B-2*y.borderwidth+b.scrollBarWidth+b.scrollBarMargin,height:H-2*y.borderwidth,x:y.borderwidth,y:y.borderwidth-G}),S.call(m.setClipUrl,o),R&&e(V,G),k.on("wheel",null),k.on("wheel",function(){G=h.constrain(S.attr("data-scroll")-c.event.deltaY/q*X,-X,0),V=b.scrollBarMargin-G/X*q,e(V,G),0!==G&&G!==-X&&c.event.preventDefault()}),C.on(".drag",null),S.on(".drag",null);var Y=c.behavior.drag().on("drag",function(){V=h.constrain(c.event.y-b.scrollBarHeight/2,b.scrollBarMargin,b.scrollBarMargin+q),G=-(V-b.scrollBarMargin)/q*X,e(V,G)});C.call(Y),S.call(Y)}if(t._context.edits.legendPosition){var W,Z,Q,$;k.classed("cursor-move",!0),g.init({element:k.node(),gd:t,prepFn:function(){var t=m.getTranslate(k);Q=t.x,$=t.y},moveFn:function(t,e){var r=Q+t,n=$+e;m.setTranslate(k,r,n),W=g.align(r,0,z.l,z.l+z.w,y.xanchor),Z=g.align(n,0,z.t+z.h,z.t,y.yanchor)},doneFn:function(e,n,a){if(e&&void 0!==W&&void 0!==Z)f.relayout(t,{"legend.x":W,"legend.y":Z});else{var o=r._infolayer.selectAll("g.traces").filter(function(){var t=this.getBoundingClientRect();return a.clientX>=t.left&&a.clientX<=t.right&&a.clientY>=t.top&&a.clientY<=t.bottom});o.size()>0&&(1===n?k._clickTimeout=setTimeout(function(){i(o,t,n)},E):2===n&&(k._clickTimeout&&clearTimeout(k._clickTimeout),i(o,t,n)))}}})}}}},{"../../constants/alignment":329,"../../constants/interactions":332,"../../lib":350,"../../lib/svg_text_utils":369,"../../plotly":384,"../../plots/plots":422,"../../registry":429,"../color":233,"../dragelement":254,"../drawing":257,"./anchor_utils":283,"./constants":285,"./get_legend_data":288,"./helpers":289,"./style":291,d3:62}],288:[function(t,e,r){"use strict";var n=t("../../registry"),a=t("./helpers");e.exports=function(t,e){function r(t,r){if(""!==t&&a.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 i,o,s={},l=[],u=!1,c={},f=0;for(i=0;ir[1])return r[1]}return a}function a(t){return t[0]}var s,u,c=t[0],f=c.trace,h=l.hasMarkers(f),d=l.hasText(f),p=l.hasLines(f);if(h||d||p){var g={},m={};h&&(g.mc=r("marker.color",a),g.mo=r("marker.opacity",i.mean,[.2,1]),g.ms=r("marker.size",i.mean,[2,16]),g.mlc=r("marker.line.color",a),g.mlw=r("marker.line.width",i.mean,[0,5]),m.marker={sizeref:1,sizemin:1,sizemode:"diameter"}),p&&(m.line={width:r("line.width",a,[0,10])}),d&&(g.tx="Aa",g.tp=r("textposition",a),g.ts=10,g.tc=r("textfont.color",a),g.tf=r("textfont.family",a)),s=[i.minExtend(c,g)],u=i.minExtend(f,m)}var v=n.select(this).select("g.legendpoints"),y=v.selectAll("path.scatterpts").data(h?s:[]);y.enter().append("path").classed("scatterpts",!0).attr("transform","translate(20,0)"),y.exit().remove(),y.call(o.pointStyle,u,e),h&&(s[0].mrc=3);var b=v.selectAll("g.pointtext").data(d?s:[]);b.enter().append("g").classed("pointtext",!0).append("text").attr("transform","translate(20,0)"),b.exit().remove(),b.selectAll("text").call(o.textPointStyle,u,e)}function f(t){var e=t[0].trace,r=e.marker||{},i=r.line||{},o=n.select(this).select("g.legendpoints").selectAll("path.legendbar").data(a.traceIs(e,"bar")?[t]:[]);o.enter().append("path").classed("legendbar",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),o.exit().remove(),o.each(function(t){var e=n.select(this),a=t[0],o=(a.mlw+1||i.width+1)-1;e.style("stroke-width",o+"px").call(s.fill,a.mc||r.color),o&&e.call(s.stroke,a.mlc||i.color)})}function h(t){var e=t[0].trace,r=n.select(this).select("g.legendpoints").selectAll("path.legendbox").data(a.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(){var t=e.line.width,r=n.select(this);r.style("stroke-width",t+"px").call(s.fill,e.fillcolor),t&&r.call(s.stroke,e.line.color)})}function d(t){var e=t[0].trace,r=n.select(this).select("g.legendpoints").selectAll("path.legendpie").data(a.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(u,t[0],e)}t.each(function(t){var e=n.select(this),r=e.selectAll("g.layers").data([0]);r.enter().append("g").classed("layers",!0),r.style("opacity",t[0].trace.opacity),r.selectAll("g.legendfill").data([t]).enter().append("g").classed("legendfill",!0),r.selectAll("g.legendlines").data([t]).enter().append("g").classed("legendlines",!0);var a=r.selectAll("g.legendsymbols").data([t]);a.enter().append("g").classed("legendsymbols",!0),a.selectAll("g.legendpoints").data([t]).enter().append("g").classed("legendpoints",!0)}).each(f).each(h).each(d).each(r).each(c)}},{"../../lib":350,"../../registry":429,"../../traces/pie/style_one":478,"../../traces/scatter/subtypes":504,"../color":233,"../drawing":257,d3:62}],292:[function(t,e,r){"use strict";function n(t,e){var r,n,a=e.currentTarget,i=a.getAttribute("data-attr"),o=a.getAttribute("data-val")||!0,s=t._fullLayout,l={},u=h.list(t,null,!0),f="on";if("zoom"===i){var d,p="in"===o?.5:2,g=(1+p)/2,m=(1-p)/2;for(n=0;n1)return n(["resetViews","toggleHover"]),o(v,r);c&&(n(["zoom3d","pan3d","orbitRotation","tableRotation"]),n(["resetCameraDefault3d","resetCameraLastSave3d"]),n(["hoverClosest3d"])),f&&(n(["zoomInGeo","zoomOutGeo","resetGeo"]),n(["hoverClosestGeo"]));var y=a(s),b=[];return((u||p)&&!y||g)&&(b=["zoom2d","pan2d"]),m&&(b=["pan2d"]),i(l)&&(b.push("select2d"),b.push("lasso2d")),b.length&&n(b),!u&&!p||y||g||n(["zoomIn2d","zoomOut2d","autoScale2d","resetScale2d"]),u&&d?n(["toggleHover"]):p?n(["hoverClosestGl2d"]):u?n(["toggleSpikelines","hoverClosestCartesian","hoverCompareCartesian"]):d?n(["hoverClosestPie"]):m&&n(["resetViewMapbox","toggleHover"]),o(v,r)}function a(t){for(var e=l.list({_fullLayout:t},null,!0),r=!0,n=0;n0)){var p=a(e,r,l);f("x",p[0]),f("y",p[1]),i.noneOrAll(t,e,["x","y"]),f("xanchor"),f("yanchor"),i.coerceFont(f,"font",r.font);var g=f("bgcolor");f("activecolor",o.contrast(g,u.lightAmount,u.darkAmount)),f("bordercolor"),f("borderwidth")}}},{"../../lib":350,"../color":233,"./attributes":296,"./button_attributes":297,"./constants":298}],300:[function(t,e,r){"use strict";function n(t){for(var e=v.list(t,"x",!0),r=[],n=0;np&&(p=h)));return p>=d?[d,p]:void 0}}var a=t("../../lib"),i=t("../../plots/cartesian/axes"),o=t("./constants"),s=t("./helpers");e.exports=function(t){var e=t._fullLayout,r=a.filterVisible(e.shapes);if(r.length&&t._fullData.length)for(var s=0;sX&&n>Y&&!t.shiftKey?p.getCursor(a/r,1-i/n):"move";g(e,o),q=o.split("-")[0]}function i(e){B=f.getFromId(t,r.xref),j=f.getFromId(t,r.yref),H=v.getDataToPixel(t,B),U=v.getDataToPixel(t,j,!0),V=v.getPixelToData(t,B),G=v.getPixelToData(t,j,!0);var i="shapes["+n+"]";"path"===r.type?(N=r.path,F=i+".path"):(m=H(r.x0),y=U(r.y0),b=H(r.x1),x=U(r.y1),_=i+".x0",w=i+".y0",A=i+".x1",k=i+".y1"),mY&&(d[S]=r[R]=G(u),d[C]=r[D]=G(c)),h-f>X&&(d[O]=r[P]=V(f),d[I]=r[z]=V(h))}e.attr("d",o(t,r))}var d,m,y,b,x,_,w,A,k,M,T,E,L,S,C,O,I,R,D,P,z,N,F,B,j,H,U,V,G,q,X=10,Y=10,W={element:e.node(),gd:t,prepFn:i,doneFn:s},Z=W.element.getBoundingClientRect();p.init(W),e.node().onmousemove=a}function o(t,e){var r,n,a,i,o=e.type,l=f.getFromId(t,e.xref),u=f.getFromId(t,e.yref),c=t._fullLayout._size;if(l?(r=v.shapePositionToRange(l),n=function(t){return l._offset+l.r2p(r(t,!0))}):n=function(t){return c.l+c.w*t},u?(a=v.shapePositionToRange(u),i=function(t){return u._offset+u.r2p(a(t,!0))}):i=function(t){return c.t+c.h*(1-t)},"path"===o)return l&&"date"===l.type&&(n=v.decodeDate(n)),u&&"date"===u.type&&(i=v.decodeDate(i)),s(e.path,n,i);var h=n(e.x0),d=n(e.x1),p=i(e.y0),g=i(e.y1);if("line"===o)return"M"+h+","+p+"L"+d+","+g;if("rect"===o)return"M"+h+","+p+"H"+d+"V"+g+"H"+h+"Z";var m=(h+d)/2,y=(p+g)/2,b=Math.abs(m-h),x=Math.abs(y-p),_="A"+b+","+x,w=m+b+","+y;return"M"+w+_+" 0 1,1 "+m+","+(y-x)+_+" 0 0,1 "+w+"Z"}function s(t,e,r){return t.replace(m.segmentRE,function(t){var n=0,a=t.charAt(0),i=m.paramIsX[a],o=m.paramIsY[a],s=m.numParams[a],l=t.substr(1).replace(m.paramRE,function(t){return i[n]?t=e(t):o[n]&&(t=r(t)),n++,n>s&&(t="X"),t});return n>s&&(l=l.replace(/[\s,]*X.*/,""),c.log("Ignoring extra params in segment "+t)),a+l})}function l(t,e,r){return t.replace(m.segmentRE,function(t){var n=0,a=t.charAt(0),i=m.paramIsX[a],o=m.paramIsY[a],s=m.numParams[a];return a+t.substr(1).replace(m.paramRE,function(t){return n>=s?t:(i[n]?t=e(t):o[n]&&(t=r(t)),n++,t)})})}var u=t("../../plotly"),c=t("../../lib"),f=t("../../plots/cartesian/axes"),h=t("../color"),d=t("../drawing"),p=t("../dragelement"),g=t("../../lib/setcursor"),m=t("./constants"),v=t("./helpers");e.exports={draw:n,drawOne:a}},{"../../lib":350,"../../lib/setcursor":365,"../../plotly":384,"../../plots/cartesian/axes":389,"../color":233,"../dragelement":254,"../drawing":257,"./constants":311,"./helpers":314}],314:[function(t,e,r){"use strict";r.rangeToShapePosition=function(t){return"log"===t.type?t.r2d:function(t){return t}},r.shapePositionToRange=function(t){return"log"===t.type?t.d2r:function(t){return t}},r.decodeDate=function(t){return function(e){return e.replace&&(e=e.replace("_"," ")),t(e)}},r.encodeDate=function(t){return function(e){return t(e).replace(" ","_")}},r.getDataToPixel=function(t,e,n){var a,i=t._fullLayout._size;if(e){var o=r.shapePositionToRange(e);a=function(t){return e._offset+e.r2p(o(t,!0))},"date"===e.type&&(a=r.decodeDate(a))}else a=n?function(t){return i.t+i.h*(1-t)}:function(t){return i.l+i.w*t};return a},r.getPixelToData=function(t,e,n){var a,i=t._fullLayout._size;if(e){var o=r.rangeToShapePosition(e);a=function(t){return o(e.p2r(t-e._offset))}}else a=n?function(t){return 1-(t-i.t)/i.h}:function(t){return(t-i.l)/i.w};return a}},{}],315:[function(t,e,r){"use strict";var n=t("./draw");e.exports={moduleType:"component",name:"shapes",layoutAttributes:t("./attributes"),supplyLayoutDefaults:t("./defaults"),calcAutorange:t("./calc_autorange"),draw:n.draw,drawOne:n.drawOne}},{"./attributes":309,"./calc_autorange":310,"./defaults":312,"./draw":313}],316:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("../../plots/cartesian/axes"),i=t("./attributes"),o=t("./helpers");e.exports=function(t,e,r,s,l){function u(r,a){return n.coerce(t,e,i,r,a)}if(s=s||{},l=l||{},!u("visible",!l.itemIsNotPlainObject))return e;u("layer"),u("opacity"),u("fillcolor"),u("line.color"),u("line.width"),u("line.dash");for(var c=t.path?"path":"rect",f=u("type",c),h=["x","y"],d=0;d<2;d++){var p=h[d],g={_fullLayout:r},m=a.coerceRef(t,e,g,p,"","paper");if("path"!==f){var v,y,b;"paper"!==m?(v=a.getFromId(g,m),b=o.rangeToShapePosition(v),y=o.shapePositionToRange(v)):y=b=n.identity;var x=p+"0",_=p+"1",w=t[x],A=t[_];t[x]=y(t[x],!0),t[_]=y(t[_],!0),a.coercePosition(e,g,u,m,x,.25),a.coercePosition(e,g,u,m,_,.75),e[x]=b(e[x]),e[_]=b(e[_]),t[x]=w,t[_]=A}}return"path"===f?u("path"):n.noneOrAll(t,e,["x0","x1","y0","y1"]),e}},{"../../lib":350,"../../plots/cartesian/axes":389,"./attributes":309,"./helpers":314}],317:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),a=t("../../plots/pad_attributes"),i=t("../../lib/extend").extendFlat,o=t("../../lib/extend").extendDeep,s=t("../../plots/animation_attributes"),l=t("./constants"),u={_isLinkedToArray:"step",method:{valType:"enumerated",values:["restyle","relayout","animate","update","skip"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string"},value:{valType:"string"},execute:{valType:"boolean",dflt:!0}};e.exports={_isLinkedToArray:"slider",visible:{valType:"boolean",dflt:!0},active:{valType:"number",min:0,dflt:0},steps:u,lenmode:{valType:"enumerated",values:["fraction","pixels"],dflt:"fraction"},len:{valType:"number",min:0,dflt:1},x:{valType:"number",min:-2,max:3,dflt:0},pad:o({},a,{},{t:{dflt:20}}),xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left"},y:{valType:"number",min:-2,max:3,dflt:0},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"top"},transition:{duration:{valType:"number",min:0,dflt:150},easing:{valType:"enumerated",values:s.transition.easing.values,dflt:"cubic-in-out"}},currentvalue:{visible:{valType:"boolean",dflt:!0},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left"},offset:{valType:"number",dflt:10},prefix:{valType:"string"},suffix:{valType:"string"},font:i({},n,{})},font:i({},n,{}),activebgcolor:{valType:"color",dflt:l.gripBgActiveColor},bgcolor:{valType:"color",dflt:l.railBgColor},bordercolor:{valType:"color",dflt:l.railBorderColor},borderwidth:{valType:"number",min:0,dflt:l.railBorderWidth},ticklen:{valType:"number",min:0,dflt:l.tickLength},tickcolor:{valType:"color",dflt:l.tickColor},tickwidth:{valType:"number",min:0,dflt:1},minorticklen:{valType:"number",min:0,dflt:l.minorTickLength}}},{"../../lib/extend":343,"../../plots/animation_attributes":385,"../../plots/font_attributes":413,"../../plots/pad_attributes":421,"./constants":318}],318:[function(t,e,r){"use strict";e.exports={name:"sliders",containerClassName:"slider-container",groupClassName:"slider-group",inputAreaClass:"slider-input-area",railRectClass:"slider-rail-rect",railTouchRectClass:"slider-rail-touch-rect",gripRectClass:"slider-grip-rect",tickRectClass:"slider-tick-rect",inputProxyClass:"slider-input-proxy",labelsClass:"slider-labels",labelGroupClass:"slider-label-group",labelClass:"slider-label",currentValueClass:"slider-current-value",railHeight:5,menuIndexAttrName:"slider-active-index",autoMarginIdRoot:"slider-",minWidth:30,minHeight:30,textPadX:40,arrowOffsetX:4,railRadius:2,railWidth:5,railBorder:4,railBorderWidth:1,railBorderColor:"#bec8d9",railBgColor:"#f8fafc",railInset:8,stepInset:10,gripRadius:10,gripWidth:20,gripHeight:20,gripBorder:20,gripBorderWidth:1,gripBorderColor:"#bec8d9",gripBgColor:"#f6f8fa",gripBgActiveColor:"#dbdde0",labelPadding:8,labelOffset:0,tickWidth:1,tickColor:"#333",tickOffset:25,tickLength:7,minorTickOffset:25,minorTickColor:"#333",minorTickLength:4,currentValuePadding:8,currentValueInset:0}},{}],319:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return i.coerce(t,e,s,r,n)}n("visible",a(t,e).length>0)&&(n("active"),n("x"),n("y"),i.noneOrAll(t,e,["x","y"]),n("xanchor"),n("yanchor"),n("len"),n("lenmode"),n("pad.t"),n("pad.r"),n("pad.b"),n("pad.l"),i.coerceFont(n,"font",r.font),n("currentvalue.visible")&&(n("currentvalue.xanchor"),n("currentvalue.prefix"),n("currentvalue.suffix"),n("currentvalue.offset"),i.coerceFont(n,"currentvalue.font",e.font)),n("transition.duration"),n("transition.easing"),n("bgcolor"),n("activebgcolor"),n("bordercolor"),n("borderwidth"),n("ticklen"),n("tickwidth"),n("tickcolor"),n("minorticklen"))}function a(t,e){function r(t,e){return i.coerce(n,a,c,t,e)}for(var n,a,o=t.steps||[],s=e.steps=[],l=0;l=r.steps.length&&(r.active=0),e.call(s,r).call(x,r).call(c,r).call(p,r).call(b,t,r).call(l,t,r),M.setTranslate(e,r.lx+r.pad.l,r.ly+r.pad.t),e.call(m,r,r.active/(r.steps.length-1),!1),e.call(s,r)}function s(t,e,r){if(e.currentvalue.visible){var n,a,i=t.selectAll("text").data([0]);switch(e.currentvalue.xanchor){case"right":n=e.inputAreaLength-L.currentValueInset-e.currentValueMaxWidth,a="left";break;case"center":n=.5*e.inputAreaLength,a="middle";break;default:n=L.currentValueInset,a="left"}i.enter().append("text").classed(L.labelClass,!0).classed("user-select-none",!0).attr({"text-anchor":a,"data-notex":1});var o=e.currentvalue.prefix?e.currentvalue.prefix:"";if("string"==typeof r)o+=r;else{o+=e.steps[e.active].label}e.currentvalue.suffix&&(o+=e.currentvalue.suffix),i.call(M.font,e.currentvalue.font).text(o).call(T.convertToTspans,e.gd);var s=T.lineCount(i),l=(e.currentValueMaxLines+1-s)*e.currentvalue.font.size*S;return T.positionText(i,n,l),i}}function l(t,e,r){var n=t.selectAll("rect."+L.gripRectClass).data([0]);n.enter().append("rect").classed(L.gripRectClass,!0).call(d,e,t,r).style("pointer-events","all"),n.attr({width:L.gripWidth,height:L.gripHeight,rx:L.gripRadius,ry:L.gripRadius}).call(k.stroke,r.bordercolor).call(k.fill,r.bgcolor).style("stroke-width",r.borderwidth+"px")}function u(t,e,r){var n=t.selectAll("text").data([0]);return n.enter().append("text").classed(L.labelClass,!0).classed("user-select-none",!0).attr({"text-anchor":"middle","data-notex":1}),n.call(M.font,r.font).text(e.step.label).call(T.convertToTspans,r.gd),n}function c(t,e){var r=t.selectAll("g."+L.labelsClass).data([0]);r.enter().append("g").classed(L.labelsClass,!0);var n=r.selectAll("g."+L.labelGroupClass).data(e.labelSteps);n.enter().append("g").classed(L.labelGroupClass,!0),n.exit().remove(),n.each(function(t){var r=w.select(this);r.call(u,t,e),M.setTranslate(r,v(e,t.fraction),L.tickOffset+e.ticklen+e.font.size*S+L.labelOffset+e.currentValueTotalHeight)})}function f(t,e,r,n,a){var i=Math.round(n*(r.steps.length-1));i!==r.active&&h(t,e,r,i,!0,a)}function h(t,e,r,n,a,i){var o=r.active;r._input.active=r.active=n;var l=r.steps[r.active];e.call(m,r,r.active/(r.steps.length-1),i),e.call(s,r),t.emit("plotly_sliderchange",{slider:r,step:r.steps[r.active],interaction:a,previousActive:o}),l&&l.method&&a&&(e._nextMethod?(e._nextMethod.step=l,e._nextMethod.doCallback=a,e._nextMethod.doTransition=i):(e._nextMethod={step:l,doCallback:a,doTransition:i},e._nextMethodRaf=window.requestAnimationFrame(function(){var r=e._nextMethod.step;r.method&&(r.execute&&A.executeAPICommand(t,r.method,r.args),e._nextMethod=null,e._nextMethodRaf=null)})))}function d(t,e,r){function n(){return r.data()[0]}var a=r.node(),i=w.select(e);t.on("mousedown",function(){var t=n();e.emit("plotly_sliderstart",{slider:t});var o=r.select("."+L.gripRectClass);w.event.stopPropagation(),w.event.preventDefault(),o.call(k.fill,t.activebgcolor);var s=y(t,w.mouse(a)[0]);f(e,r,t,s,!0),t._dragging=!0,i.on("mousemove",function(){var t=n(),i=y(t,w.mouse(a)[0]);f(e,r,t,i,!1)}),i.on("mouseup",function(){var t=n();t._dragging=!1,o.call(k.fill,t.bgcolor),i.on("mouseup",null),i.on("mousemove",null),e.emit("plotly_sliderend",{slider:t,step:t.steps[t.active]})})})}function p(t,e){var r=t.selectAll("rect."+L.tickRectClass).data(e.steps);r.enter().append("rect").classed(L.tickRectClass,!0),r.exit().remove(),r.attr({width:e.tickwidth+"px","shape-rendering":"crispEdges"}),r.each(function(t,r){var n=r%e.labelStride==0,a=w.select(this);a.attr({height:n?e.ticklen:e.minorticklen}).call(k.fill,e.tickcolor),M.setTranslate(a,v(e,r/(e.steps.length-1))-.5*e.tickwidth,(n?L.tickOffset:L.minorTickOffset)+e.currentValueTotalHeight)})}function g(t){t.labelSteps=[];for(var e=t.steps.length,r=0;r0&&(o=o.transition().duration(e.transition.duration).ease(e.transition.easing)),o.attr("transform","translate("+(i-.5*L.gripWidth)+","+e.currentValueTotalHeight+")")}}function v(t,e){return t.inputAreaStart+L.stepInset+(t.inputAreaLength-2*L.stepInset)*Math.min(1,Math.max(0,e))}function y(t,e){return Math.min(1,Math.max(0,(e-L.stepInset-t.inputAreaStart)/(t.inputAreaLength-2*L.stepInset-2*t.inputAreaStart)))}function b(t,e,r){var n=t.selectAll("rect."+L.railTouchRectClass).data([0]);n.enter().append("rect").classed(L.railTouchRectClass,!0).call(d,e,t,r).style("pointer-events","all"),n.attr({width:r.inputAreaLength,height:Math.max(r.inputAreaWidth,L.tickOffset+r.ticklen+r.labelHeight)}).call(k.fill,r.bgcolor).attr("opacity",0),M.setTranslate(n,0,r.currentValueTotalHeight)}function x(t,e){var r=t.selectAll("rect."+L.railRectClass).data([0]);r.enter().append("rect").classed(L.railRectClass,!0);var n=e.inputAreaLength-2*L.railInset;r.attr({width:n,height:L.railWidth,rx:L.railRadius,ry:L.railRadius,"shape-rendering":"crispEdges"}).call(k.stroke,e.bordercolor).call(k.fill,e.bgcolor).style("stroke-width",e.borderwidth+"px"),M.setTranslate(r,L.railInset,.5*(e.inputAreaWidth-L.railWidth)+e.currentValueTotalHeight)}function _(t){for(var e=t._fullLayout._pushmargin||{},r=Object.keys(e),n=0;n0?[0]:[]);if(s.enter().append("g").classed(L.containerClassName,!0).style("cursor","ew-resize"),s.exit().remove(),s.exit().size()&&_(t),0!==r.length){var l=s.selectAll("g."+L.groupClassName).data(r,a);l.enter().append("g").classed(L.groupClassName,!0),l.exit().each(function(e){w.select(this).remove(),e._commandObserver.remove(),delete e._commandObserver,A.autoMargin(t,L.autoMarginIdRoot+e._index)});for(var u=0;u0||h<0){var g={left:[-r,0],right:[r,0],top:[0,-r],bottom:[0,r]}[_.side];e.attr("transform","translate("+g+")")}}}var m,v=r.propContainer,y=r.propName,b=r.traceIndex,x=r.dfltName,_=r.avoid||{},w=r.attributes,A=r.transform,k=r.containerGroup,M=t._fullLayout,T=v.titlefont.family,E=v.titlefont.size,L=v.titlefont.color,S=1,C=!1,O=v.title.trim();"title"===y?m="titleText":-1!==y.indexOf("axis")?m="axisTitleText":y.indexOf(!0)&&(m="colorbarTitleText");var I=t._context.edits[m];""===O&&(S=0),O.match(h)&&(S=.2,C=!0,I||(O=""));var R=O||I;k||(k=M._infolayer.selectAll(".g-"+e).data([0]),k.enter().append("g").classed("g-"+e,!0));var D=k.selectAll("text").data(R?[0]:[]);if(D.enter().append("text"),D.text(O).attr("class",e),D.exit().remove(),R){D.call(d);var P="Click to enter "+x+" title";I&&(O?D.on(".opacity",null):function(){S=0,C=!0,O=P,D.text(O).on("mouseover.opacity",function(){n.select(this).transition().duration(f.SHOW_PLACEHOLDER).style("opacity",1)}).on("mouseout.opacity",function(){n.select(this).transition().duration(f.HIDE_PLACEHOLDER).style("opacity",0)})}(),D.call(c.makeEditable,{gd:t}).on("edit",function(e){void 0!==b?i.restyle(t,y,e,b):i.relayout(t,y,e)}).on("cancel",function(){this.text(this.attr("data-unformatted")).call(d)}).on("input",function(t){this.text(t||" ").call(c.positionText,w.x,w.y)})),D.classed("js-placeholder",C)}}},{"../../constants/interactions":332,"../../lib":350,"../../lib/svg_text_utils":369,"../../plotly":384,"../../plots/plots":422,"../color":233,"../drawing":257,d3:62,"fast-isnumeric":68}],323:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),a=t("../color/attributes"),i=t("../../lib/extend").extendFlat,o=t("../../plots/pad_attributes"),s={_isLinkedToArray:"button",method:{valType:"enumerated",values:["restyle","relayout","animate","update","skip"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string",dflt:""},execute:{valType:"boolean",dflt:!0}};e.exports={_isLinkedToArray:"updatemenu",_arrayAttrRegexps:[/^updatemenus\[(0|[1-9][0-9]+)\]\.buttons/],visible:{valType:"boolean"},type:{valType:"enumerated",values:["dropdown","buttons"],dflt:"dropdown"},direction:{valType:"enumerated",values:["left","right","up","down"],dflt:"down"},active:{valType:"integer",min:-1,dflt:0},showactive:{valType:"boolean",dflt:!0},buttons:s,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:"top"},pad:i({},o,{}),font:i({},n,{}),bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:a.borderLine},borderwidth:{valType:"number",min:0,dflt:1}}},{"../../lib/extend":343,"../../plots/font_attributes":413,"../../plots/pad_attributes":421,"../color/attributes":232}],324:[function(t,e,r){"use strict";e.exports={name:"updatemenus",containerClassName:"updatemenu-container",headerGroupClassName:"updatemenu-header-group",headerClassName:"updatemenu-header",headerArrowClassName:"updatemenu-header-arrow",dropdownButtonGroupClassName:"updatemenu-dropdown-button-group",dropdownButtonClassName:"updatemenu-dropdown-button",buttonClassName:"updatemenu-button",itemRectClassName:"updatemenu-item-rect",itemTextClassName:"updatemenu-item-text",menuIndexAttrName:"updatemenu-active-index",autoMarginIdRoot:"updatemenu-",blankHeaderOpts:{label:" "},minWidth:30,minHeight:30,textPadX:24,arrowPadX:16,rx:2,ry:2,textOffsetX:12,textOffsetY:3,arrowOffsetX:4,gapButtonHeader:5,gapButton:2,activeColor:"#F4FAFF",hoverColor:"#F4FAFF",arrowSymbol:{left:"\u25c4",right:"\u25ba",up:"\u25b2",down:"\u25bc"}}},{}],325:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return i.coerce(t,e,s,r,n)}n("visible",a(t,e).length>0)&&(n("active"),n("direction"),n("type"),n("showactive"),n("x"),n("y"),i.noneOrAll(t,e,["x","y"]),n("xanchor"),n("yanchor"),n("pad.t"),n("pad.r"),n("pad.b"),n("pad.l"),i.coerceFont(n,"font",r.font),n("bgcolor",r.paper_bgcolor),n("bordercolor"),n("borderwidth"))}function a(t,e){function r(t,e){return i.coerce(n,a,c,t,e)}for(var n,a,o=t.buttons||[],s=e.buttons=[],l=0;l0?[0]:[]);if(i.enter().append("g").classed(S.containerClassName,!0).style("cursor","pointer"),i.exit().remove(),i.exit().size()&&_(t),0!==r.length){var c=i.selectAll("g."+S.headerGroupClassName).data(r,a);c.enter().append("g").classed(S.headerGroupClassName,!0);var f=i.selectAll("g."+S.dropdownButtonGroupClassName).data([0]);f.enter().append("g").classed(S.dropdownButtonGroupClassName,!0).style("pointer-events","all");for(var h=0;hA,T=n.barLength+2*n.barPad,E=n.barWidth+2*n.barPad,L=p,S=m+v;S+E>u&&(S=u-E);var C=this.container.selectAll("rect.scrollbar-horizontal").data(M?[0]:[]);C.exit().on(".drag",null).remove(),C.enter().append("rect").classed("scrollbar-horizontal",!0).call(i.fill,n.barColor),M?(this.hbar=C.attr({rx:n.barRadius,ry:n.barRadius,x:L,y:S,width:T,height:E}),this._hbarXMin=L+T/2,this._hbarTranslateMax=A-T):(delete this.hbar,delete this._hbarXMin,delete this._hbarTranslateMax);var O=v>k,I=n.barWidth+2*n.barPad,R=n.barLength+2*n.barPad,D=p+g,P=m;D+I>l&&(D=l-I);var z=this.container.selectAll("rect.scrollbar-vertical").data(O?[0]:[]);z.exit().on(".drag",null).remove(),z.enter().append("rect").classed("scrollbar-vertical",!0).call(i.fill,n.barColor),O?(this.vbar=z.attr({rx:n.barRadius,ry:n.barRadius,x:D,y:P,width:I,height:R}),this._vbarYMin=P+R/2,this._vbarTranslateMax=k-R):(delete this.vbar,delete this._vbarYMin,delete this._vbarTranslateMax);var N=this.id,F=c-.5,B=O?f+I+.5:f+.5,j=h-.5,H=M?d+E+.5:d+.5,U=s._topdefs.selectAll("#"+N).data(M||O?[0]:[]);if(U.exit().remove(),U.enter().append("clipPath").attr("id",N).append("rect"),M||O?(this._clipRect=U.select("rect").attr({x:Math.floor(F),y:Math.floor(j),width:Math.ceil(B)-Math.floor(F),height:Math.ceil(H)-Math.floor(j)}),this.container.call(o.setClipUrl,N),this.bg.attr({x:p,y:m,width:g,height:v})):(this.bg.attr({width:0,height:0}),this.container.on("wheel",null).on(".drag",null).call(o.setClipUrl,null),delete this._clipRect),M||O){var V=a.behavior.drag().on("dragstart",function(){a.event.sourceEvent.preventDefault()}).on("drag",this._onBoxDrag.bind(this));this.container.on("wheel",null).on("wheel",this._onBoxWheel.bind(this)).on(".drag",null).call(V);var G=a.behavior.drag().on("dragstart",function(){a.event.sourceEvent.preventDefault(),a.event.sourceEvent.stopPropagation()}).on("drag",this._onBarDrag.bind(this));M&&this.hbar.on(".drag",null).call(G),O&&this.vbar.on(".drag",null).call(G)}this.setTranslate(e,r)},n.prototype.disable=function(){(this.hbar||this.vbar)&&(this.bg.attr({width:0,height:0}),this.container.on("wheel",null).on(".drag",null).call(o.setClipUrl,null),delete this._clipRect),this.hbar&&(this.hbar.on(".drag",null),this.hbar.remove(),delete this.hbar,delete this._hbarXMin,delete this._hbarTranslateMax),this.vbar&&(this.vbar.on(".drag",null),this.vbar.remove(),delete this.vbar,delete this._vbarYMin,delete this._vbarTranslateMax)},n.prototype._onBoxDrag=function(){var t=this.translateX,e=this.translateY;this.hbar&&(t-=a.event.dx),this.vbar&&(e-=a.event.dy),this.setTranslate(t,e)},n.prototype._onBoxWheel=function(){var t=this.translateX,e=this.translateY;this.hbar&&(t+=a.event.deltaY),this.vbar&&(e+=a.event.deltaY),this.setTranslate(t,e)},n.prototype._onBarDrag=function(){var t=this.translateX,e=this.translateY;if(this.hbar){var r=t+this._hbarXMin,n=r+this._hbarTranslateMax;t=(s.constrain(a.event.x,r,n)-r)/(n-r)*(this.position.w-this._box.w)}if(this.vbar){var i=e+this._vbarYMin,o=i+this._vbarTranslateMax;e=(s.constrain(a.event.y,i,o)-i)/(o-i)*(this.position.h-this._box.h)}this.setTranslate(t,e)},n.prototype.setTranslate=function(t,e){var r=this.position.w-this._box.w,n=this.position.h-this._box.h;if(t=s.constrain(t||0,0,r),e=s.constrain(e||0,0,n),this.translateX=t,this.translateY=e,this.container.call(o.setTranslate,this._box.l-this.position.l-t,this._box.t-this.position.t-e),this._clipRect&&this._clipRect.attr({x:Math.floor(this.position.l+t-.5),y:Math.floor(this.position.t+e-.5)}),this.hbar){var a=t/r;this.hbar.call(o.setTranslate,t+a*this._hbarTranslateMax,e)}if(this.vbar){var i=e/n;this.vbar.call(o.setTranslate,t,e+i*this._vbarTranslateMax)}}},{"../../lib":350,"../color":233,"../drawing":257,d3:62}],329:[function(t,e,r){"use strict";e.exports={FROM_BL:{left:0,center:.5,right:1,bottom:0,middle:.5,top:1},FROM_TL:{left:0,center:.5,right:1,bottom:1,middle:.5,top:0},LINE_SPACING:1.3,MID_SHIFT:.35}},{}],330:[function(t,e,r){"use strict";e.exports={solid:[1],dot:[1,1],dash:[4,1],longdash:[8,1],dashdot:[4,1,1,1],longdashdot:[8,1,1,1]}},{}],331:[function(t,e,r){"use strict";for(var n=t("../lib/extend").extendFlat,a={circle:{unicode:"\u25cf"},square:{unicode:"\u25a0"},diamond:{unicode:"\u25c6"},cross:{unicode:"\u271a"},x:{unicode:"\u274c"},"triangle-up":{unicode:"\u25b2"},"triangle-down":{unicode:"\u25bc"},"triangle-left":{unicode:"\u25c4"},"triangle-right":{unicode:"\u25ba"},"triangle-ne":{unicode:"\u25e5"},"triangle-nw":{unicode:"\u25e4"},"triangle-se":{unicode:"\u25e2"},"triangle-sw":{unicode:"\u25e3"},pentagon:{unicode:"\u2b1f"},hexagon:{unicode:"\u2b22"},hexagon2:{unicode:"\u2b23"},star:{unicode:"\u2605"},"diamond-tall":{unicode:"\u2666"},bowtie:{unicode:"\u29d3"},"diamond-x":{unicode:"\u2756"},"cross-thin":{unicode:"+",noBorder:!0},asterisk:{unicode:"\u2733",noBorder:!0},"y-up":{unicode:"\u2144",noBorder:!0},"y-down":{unicode:"Y",noBorder:!0},"line-ew":{unicode:"\u2500",noBorder:!0},"line-ns":{unicode:"\u2502",noBorder:!0}},i={},o=Object.keys(a),s=0;s","#62":">",nbsp:"\xa0","#160":"\xa0",times:"\xd7","#215":"\xd7",plusmn:"\xb1","#177":"\xb1",deg:"\xb0","#176":"\xb0"}}},{}],335:[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}},{}],336:[function(t,e,r){"use strict";var n=t("./plotly");r.version="1.29.2",t("es6-promise").polyfill(),t("../build/plotcss"),t("./fonts/mathjax_config"),r.plot=n.plot,r.newPlot=n.newPlot,r.restyle=n.restyle,r.relayout=n.relayout,r.redraw=n.redraw,r.update=n.update,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=t("./plot_api/register"),r.toImage=t("./plot_api/to_image"),r.downloadImage=t("./snapshot/download"),r.validate=t("./plot_api/validate"),r.addFrames=n.addFrames,r.deleteFrames=n.deleteFrames,r.animate=n.animate,r.register(t("./traces/scatter")),r.register([t("./components/fx"),t("./components/legend"),t("./components/annotations"),t("./components/annotations3d"),t("./components/shapes"),t("./components/images"),t("./components/updatemenus"),t("./components/sliders"),t("./components/rangeslider"),t("./components/rangeselector")]),r.Icons=t("../build/ploticon"),r.Plots=n.Plots,r.Fx=t("./components/fx"),r.Snapshot=t("./snapshot"),r.PlotSchema=t("./plot_api/plot_schema"),r.Queue=t("./lib/queue"),r.d3=t("d3")},{"../build/plotcss":1,"../build/ploticon":2,"./components/annotations":226,"./components/annotations3d":231,"./components/fx":274,"./components/images":282,"./components/legend":290,"./components/rangeselector":302,"./components/rangeslider":308,"./components/shapes":315,"./components/sliders":321,"./components/updatemenus":327,"./fonts/mathjax_config":337,"./lib/queue":362,"./plot_api/plot_schema":378,"./plot_api/register":379,"./plot_api/set_plot_config":380,"./plot_api/to_image":382,"./plot_api/validate":383,"./plotly":384,"./snapshot":434,"./snapshot/download":431,"./traces/scatter":494,d3:62,"es6-promise":66}],337:[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},{}],338:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("../constants/numerical").BADNUM,i=/^['"%,$#\s']+|[, ]|['"%,$#\s']+$/g;e.exports=function(t){return"string"==typeof t&&(t=t.replace(i,"")),n(t)?Number(t):a}},{"../constants/numerical":333,"fast-isnumeric":68}],339:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("tinycolor2"),i=t("../plots/attributes"),o=t("../components/colorscale/get_scale"),s=(Object.keys(t("../components/colorscale/scales")),t("./nested_property")),l=/^([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)},validateFunction:function(t,e){e.coerceNumber&&(t=+t);for(var r=e.values,n=0;na.max?e.set(r):e.set(+t)}},integer:{coerceFunction:function(t,e,r,a){t%1||!n(t)||void 0!==a.min&&ta.max?e.set(r):e.set(+t)}},string:{coerceFunction:function(t,e,r,n){if("string"!=typeof t){var a="number"==typeof t;!0!==n.strict&&a?e.set(String(t)):e.set(r)}else n.noBlank&&!t?e.set(r):e.set(t)}},color:{coerceFunction:function(t,e,r){a(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;if("string"==typeof t&&t.substr(0,n)===r&&l.test(t.substr(n)))return void e.set(t);e.set(r)},validateFunction:function(t,e){var r=e.dflt,n=r.length;return t===r||"string"==typeof t&&!(t.substr(0,n)!==r||!l.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 a=t.split("+"),i=0;i0&&(o=o.replace(/0+$/,"").replace(/[\.]$/,"")),n+=":"+o}return n}function l(t){return t.formatDate("yyyy")}function u(t){return t.formatDate("M yyyy")}function c(t){return t.formatDate("M d")}function f(t){return t.formatDate("M d, yyyy")}var h=t("d3"),d=t("fast-isnumeric"),p=t("./loggers").error,g=t("./mod"),m=t("../constants/numerical"),v=m.BADNUM,y=m.ONEDAY,b=m.ONEHOUR,x=m.ONEMIN,_=m.ONESEC,w=m.EPOCHJD,A=t("../registry"),k=h.time.format.utc,M=/^\s*(-?\d\d\d\d|\d\d)(-(\d?\d)(-(\d?\d)([ Tt]([01]?\d|2[0-3])(:([0-5]\d)(:([0-5]\d(\.\d+)?))?(Z|z|[+\-]\d\d:?\d\d)?)?)?)?)?\s*$/m,T=/^\s*(-?\d\d\d\d|\d\d)(-(\d?\di?)(-(\d?\d)([ Tt]([01]?\d|2[0-3])(:([0-5]\d)(:([0-5]\d(\.\d+)?))?(Z|z|[+\-]\d\d:?\d\d)?)?)?)?)?\s*$/m,E=(new Date).getFullYear()-70;r.dateTick0=function(t,e){return n(t)?e?A.getComponentMethod("calendars","CANONICAL_SUNDAY")[t]:A.getComponentMethod("calendars","CANONICAL_TICK")[t]:e?"2000-01-02":"2000-01-01"},r.dfltRange=function(t){return n(t)?A.getComponentMethod("calendars","DFLTRANGE")[t]:["2000-01-01","2001-01-01"]},r.isJSDate=function(t){return"object"==typeof t&&null!==t&&"function"==typeof t.getTime};var L,S;r.dateTime2ms=function(t,e){if(r.isJSDate(t))return t=Number(t)-t.getTimezoneOffset()*x,t>=L&&t<=S?t:v;if("string"!=typeof t&&"number"!=typeof t)return v;t=String(t);var a=n(e),i=t.charAt(0);!a||"G"!==i&&"g"!==i||(t=t.substr(1),e="");var o=a&&"chinese"===e.substr(0,7),s=t.match(o?T:M);if(!s)return v;var l=s[1],u=s[3]||"1",c=Number(s[5]||1),f=Number(s[7]||0),h=Number(s[9]||0),d=Number(s[11]||0);if(a){if(2===l.length)return v;l=Number(l);var p;try{var g=A.getComponentMethod("calendars","getCal")(e);if(o){var m="i"===u.charAt(u.length-1);u=parseInt(u,10),p=g.newDate(l,g.toMonthIndex(l,u,m),c)}else p=g.newDate(l,Number(u),c)}catch(t){return v}return p?(p.toJD()-w)*y+f*b+h*x+d*_:v}l=2===l.length?(Number(l)+2e3-E)%100+E:Number(l),u-=1;var k=new Date(Date.UTC(2e3,u,c,f,h));return k.setUTCFullYear(l),k.getUTCMonth()!==u?v:k.getUTCDate()!==c?v:k.getTime()+d*_},L=r.MIN_MS=r.dateTime2ms("-9999"),S=r.MAX_MS=r.dateTime2ms("9999-12-31 23:59:59.9999"),r.isDateTime=function(t,e){return r.dateTime2ms(t,e)!==v};var C=90*y,O=3*b,I=5*x;r.ms2DateTime=function(t,e,r){if("number"!=typeof t||!(t>=L&&t<=S))return v;e||(e=0);var a,o,s,l,u,c,f=Math.floor(10*g(t+.05,1)),h=Math.round(t-f/10);if(n(r)){var d=Math.floor(h/y)+w,p=Math.floor(g(t,y));try{a=A.getComponentMethod("calendars","getCal")(r).fromJD(d).formatDate("yyyy-mm-dd")}catch(t){a=k("G%Y-%m-%d")(new Date(h))}if("-"===a.charAt(0))for(;a.length<11;)a="-0"+a.substr(1);else for(;a.length<10;)a="0"+a;o=e=L+y&&t<=S-y))return v;var e=Math.floor(10*g(t+.05,1)),r=new Date(Math.round(t-e/10));return i(h.time.format("%Y-%m-%d")(r),r.getHours(),r.getMinutes(),r.getSeconds(),10*r.getUTCMilliseconds()+e)},r.cleanDate=function(t,e,a){if(r.isJSDate(t)||"number"==typeof t){if(n(a))return p("JS Dates and milliseconds are incompatible with world calendars",t),e;if(!(t=r.ms2DateTimeLocal(+t))&&void 0!==e)return e}else if(!r.isDateTime(t,a))return p("unrecognized date",t),e;return t};var R=/%\d?f/g,D=[59,59.9,59.99,59.999,59.9999],P=k("%Y"),z=k("%b %Y"),N=k("%b %-d"),F=k("%b %-d, %Y");r.formatDate=function(t,e,r,a){var i,h;if(a=n(a)&&a,e)return o(e,t,a);if(a)try{var d=Math.floor((t+.05)/y)+w,p=A.getComponentMethod("calendars","getCal")(a).fromJD(d);"y"===r?h=l(p):"m"===r?h=u(p):"d"===r?(i=l(p),h=c(p)):(i=f(p),h=s(t,r))}catch(t){return"Invalid"}else{var g=new Date(Math.floor(t+.05));"y"===r?h=P(g):"m"===r?h=z(g):"d"===r?(i=P(g),h=N(g)):(i=F(g),h=s(t,r))}return h+(i?"\n"+i:"")};var B=3*y;r.incrementMonth=function(t,e,r){r=n(r)&&r;var a=g(t,y);if(t=Math.round(t-a),r)try{var i=Math.round(t/y)+w,o=A.getComponentMethod("calendars","getCal")(r),s=o.fromJD(i);return e%12?o.add(s,e,"m"):o.add(s,e/12,"y"),(s.toJD()-w)*y+a}catch(e){p("invalid ms "+t+" in calendar "+r)}var l=new Date(t+B);return l.setUTCMonth(l.getUTCMonth()+e)+a-B},r.findExactDates=function(t,e){for(var r,a,i=0,o=0,s=0,l=0,u=n(e)&&A.getComponentMethod("calendars","getCal")(e),c=0;c1||g<0||g>1?null:{x:t+l*g,y:e+f*g}}function a(t,e,r,n,a){var i=n*t+a*e;if(i<0)return n*n+a*a;if(i>r){var o=n-t,s=a-e;return o*o+s*s}var l=n*e-a*t;return l*l/r}var i=t("./mod");r.segmentsIntersect=n,r.segmentDistance=function(t,e,r,i,o,s,l,u){if(n(t,e,r,i,o,s,l,u))return 0;var c=r-t,f=i-e,h=l-o,d=u-s,p=c*c+f*f,g=h*h+d*d,m=Math.min(a(c,f,p,o-t,s-e),a(c,f,p,l-t,u-e),a(h,d,g,t-o,e-s),a(h,d,g,r-o,i-s));return Math.sqrt(m)};var o,s,l;r.getTextLocation=function(t,e,r,n){if(t===s&&n===l||(o={},s=t,l=n),o[r])return o[r];var a=t.getPointAtLength(i(r-n/2,e)),u=t.getPointAtLength(i(r+n/2,e)),c=Math.atan((u.y-a.y)/(u.x-a.x)),f=t.getPointAtLength(i(r,e)),h=(4*f.x+a.x+u.x)/6,d=(4*f.y+a.y+u.y)/6,p={x:h,y:d,theta:c};return o[r]=p,p},r.clearLocationCache=function(){s=null},r.getVisibleSegment=function(t,e,r){function n(e){var r=t.getPointAtLength(e);0===e?a=r:e===f&&(i=r);var n=r.xs?r.x-s:0,c=r.yu?r.y-u:0;return Math.sqrt(n*n+c*c)}for(var a,i,o=e.left,s=e.right,l=e.top,u=e.bottom,c=0,f=t.getTotalLength(),h=f,d=n(c);d;){if((c+=d+r)>h)return;d=n(c)}for(d=n(h);d;){if(h-=d+r,c>h)return;d=n(h)}return{min:c,max:h,len:h-c,total:f,isClosed:0===c&&h===f&&Math.abs(a.x-i.x)<.1&&Math.abs(a.y-i.y)<.1}}},{"./mod":355}],347:[function(t,e,r){"use strict";function n(t,e){var r=t;return r[3]*=e,r}function a(t){if(s(t))return f;var e=l(t);return e.length?e:f}function i(t){return s(t)?t:h}function o(t,e,r){var o,s,c,d,p,g=t.color,m=Array.isArray(g),v=Array.isArray(e),y=[];if(o=void 0!==t.colorscale?u.makeColorScaleFunc(u.extractScale(t.colorscale,t.cmin,t.cmax)):a,s=m?function(t,e){return void 0===t[e]?f:l(o(t[e]))}:a,c=v?function(t,e){return void 0===t[e]?h:i(t[e])}:i,m||v)for(var b=0;b",e))>=0;){var r=t.indexOf("",e);if(r/g,"\n")}function i(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(no?s:a(t)?Number(t):s):s},l.noop=t("./noop"),l.identity=t("./identity"),l.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))},l.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},l.simpleMap=function(t,e,r,n){for(var a=t.length,i=new Array(a),o=0;o-1||c!==1/0&&c>=Math.pow(2,r)?t(e,r,n):l},l.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},l.smooth=function(t,e){if((e=Math.round(e)||0)<2)return t;var r,n,a,i,o=t.length,s=2*o,l=2*e-1,u=new Array(l),c=new Array(o);for(r=0;r=s&&(a-=s*Math.floor(a/s)),a<0?a=-1-a:a>=o&&(a=s-1-a),i+=t[a]*u[n];c[r]=i}return c},l.syncOrAsync=function(t,e,r){function n(){return l.syncOrAsync(t,e,r)}for(var a,i;t.length;)if(i=t.splice(0,1)[0],(a=i(e))&&a.then)return a.then(n).then(void 0,l.promiseError);return r&&r(e)},l.stripTrailingSlash=function(t){return"/"===t.substr(-1)?t.substr(0,t.length-1):t},l.noneOrAll=function(t,e,r){if(t){var n,a,i=!1,o=!0;for(n=0;n1?a+o[1]:"";if(i&&(o.length>1||s.length>4||r))for(;n.test(s);)s=s.replace(n,"$1"+i+"$2");return s+l}},{"../constants/numerical":333,"./clean_number":338,"./coerce":339,"./dates":340,"./ensure_array":341,"./extend":343,"./filter_unique":344,"./filter_visible":345,"./geometry2d":346,"./identity":349,"./is_array":351,"./is_plain_object":352,"./loggers":353,"./matrix":354,"./mod":355,"./nested_property":356,"./noop":357,"./notifier":358,"./push_unique":361,"./relink_private":363,"./search":364,"./stats":367,"./to_log_range":370,d3:62,"fast-isnumeric":68}],351:[function(t,e,r){"use strict";var n="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer:{isView:function(){return!1}};e.exports=function(t){return Array.isArray(t)||n.isView(t)}},{}],352:[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}},{}],353:[function(t,e,r){"use strict";function n(t,e){if(t.apply)t.apply(t,e);else for(var r=0;r1){for(var t=["LOG:"],e=0;e0){for(var t=["WARN:"],e=0;e0){for(var t=["ERROR:"],e=0;e=0;e--){if(n=t[e][0],i=t[e][1],l=!1,d(n))for(r=n.length-1;r>=0;r--)a(n[r],o(i,r))?l?n[r]=void 0:n.pop():l=!0;else if("object"==typeof n&&null!==n)for(s=Object.keys(n),l=!1,r=s.length-1;r>=0;r--)a(n[s[r]],o(i,s[r]))?delete n[s[r]]:l=!0;if(l)return}}function c(t){return void 0===t||null===t||"object"==typeof t&&(d(t)?!t.length:!Object.keys(t).length)}function f(t,e,r){return{set:function(){throw"bad container"},get:function(){},astr:e,parts:r,obj:t}}var h=t("fast-isnumeric"),d=t("./is_array"),p=t("./is_plain_object"),g=t("../plot_api/container_array_match");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,a,o,s=0,l=e.split(".");s/g),s=0;so||n===a||nl)&&(!e||!c(t))}function r(t,e){var r=t[0],u=t[1];if(r===a||ro||u===a||ul)return!1;var c,f,h,d,p,g=n.length,m=n[0][0],v=n[0][1],y=0;for(c=1;cMath.max(f,m)||u>Math.max(h,v)))if(uc||Math.abs(n(o,h))>a)return!0;return!1};i.filter=function(t,e){function r(r){t.push(r);var s=n.length,l=a;n.splice(i+1);for(var u=l+1;u1){r(t.pop())}return{addPt:r,raw:t,filtered:n}}},{"../constants/numerical":333,"./matrix":354}],361:[function(t,e,r){"use strict";e.exports=function(t,e){if(e instanceof RegExp){var r,n=e.toString();for(r=0;ri.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;re}function o(t,e){return t>=e}var s=t("fast-isnumeric"),l=t("./loggers");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:a:r?o:i;f90&&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,a=e[n]-e[0]||1,i=a/(n||1)/1e4,o=[e[0]],s=0;se[s]+i&&(a=Math.min(a,e[s+1]-e[s]),o.push(e[s+1]));return{vals:o,minDiff:a}},r.roundUp=function(t,e,r){for(var n,a=0,i=e.length-1,o=0,s=r?0:1,l=r?1:0,u=r?Math.ceil:Math.floor;at.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":68}],368:[function(t,e,r){"use strict";function n(t){var e=a(t);return e.length?e:[0,0,0,1]}var a=t("color-rgba");e.exports=n},{"color-rgba":54}],369:[function(t,e,r){"use strict";function n(t,e){return t.node().getBoundingClientRect()[e]}function a(t){return t.replace(v,"\\lt ").replace(y,"\\gt ")}function i(t,e,r){var n="math-output-"+h.randstr([],64),i=f.select("body").append("div").attr({id:n}).style({visibility:"hidden",position:"absolute"}).style({"font-size":e.fontSize+"px"}).text(a(t));MathJax.Hub.Queue(["Typeset",MathJax.Hub,i.node()],function(){var e=f.select("body").select("#MathJax_SVG_glyphs");if(i.select(".MathJax_SVG").empty()||!i.select("svg").node())h.log("There was an error in the tex syntax.",t),r();else{var n=i.select("svg").node().getBoundingClientRect();r(i.select(".MathJax_SVG"),e,n)}i.remove()})}function o(t,e){if(!t)return null;var r=t.match(e);return r&&(r[3]||r[4])}function s(t,e){if(!t)return"";for(var r=0;r1)for(var a=1;a doesnt match end tag <"+t+">. Pretending it did match.",e),i=u[u.length-1].node}(k);else{var P=y[4],z={type:k},N=o(P,C);if(N?(N=N.replace(D,"$1 fill:"),M&&(N+=";"+M)):M&&(N=M),N&&(z.style=N),"a"===k){s=!0;var F=o(P,O);if(F){var B=document.createElement("a");B.href=F,-1!==A.indexOf(B.protocol)&&(z.href=encodeURI(F),z.target=o(P,I)||"_blank",z.popup=o(P,R))}}n(z)}}return s}function c(t,e,r){var n,a,i,o=r.horizontalAlign,s=r.verticalAlign||"top",l=t.node().getBoundingClientRect(),u=e.node().getBoundingClientRect();return a="bottom"===s?function(){return l.bottom-n.height}:"middle"===s?function(){return l.top+(l.height-n.height)/2}:function(){return l.top},i="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:a()-u.top+"px",left:i()-u.left+"px","z-index":1e3}),this}}var f=t("d3"),h=t("../lib"),d=t("../constants/xmlns_namespaces"),p=t("../constants/string_mappings"),g=t("../constants/alignment").LINE_SPACING,m=/([^$]*)([$]+[^$]*[$]+)([^$]*)/;r.convertToTspans=function(t,e,a){function o(){c.empty()||(h=t.attr("class")+"-math",c.select("svg."+h).remove()),t.text("").style("white-space","pre"),u(t.node(),s)&&t.style("pointer-events","all"),r.positionText(t),a&&a.call(t)}var s=t.text(),l=!t.attr("data-notex")&&"undefined"!=typeof MathJax&&s.match(m),c=f.select(t.node().parentNode);if(!c.empty()){var h=t.attr("class")?t.attr("class").split(" ")[0]:"text";return h+="-math",c.selectAll("svg."+h).remove(),c.selectAll("g."+h+"-group").remove(),t.style("display",null).attr({"data-unformatted":s,"data-math":"N"}),l?(e&&e._promises||[]).push(new Promise(function(e){t.style("display","none");var r={fontSize:parseInt(t.style("font-size"),10)};i(l[2],r,function(r,i,l){c.selectAll("svg."+h).remove(),c.selectAll("g."+h+"-group").remove();var u=r&&r.select("svg");if(!u||!u.node())return o(),void e();var f=c.append("g").classed(h+"-group",!0).attr({"pointer-events":"none","data-unformatted":s,"data-math":"Y"});f.node().appendChild(u.node()),i&&i.node()&&u.node().insertBefore(i.node().cloneNode(!0),u.node().firstChild),u.attr({class:h,height:l.height,preserveAspectRatio:"xMinYMin meet"}).style({overflow:"visible","pointer-events":"none"});var d=t.style("fill")||"black";u.select("g").attr({fill:d,stroke:d});var p=n(u,"width"),g=n(u,"height"),m=+t.attr("x")-p*{start:0,middle:.5,end:1}[t.attr("text-anchor")||"start"],v=parseInt(t.style("font-size"),10)||n(t,"height"),y=-v/4;"y"===h[0]?(f.attr({transform:"rotate("+[-90,+t.attr("x"),+t.attr("y")]+") translate("+[-p/2,y-g/2]+")"}),u.attr({x:+t.attr("x"),y:+t.attr("y")})):"l"===h[0]?u.attr({x:t.attr("x"),y:y-g/2}):"a"===h[0]?u.attr({x:0,y:y}):u.attr({x:m,y:+t.attr("y")+y-g/2}),a&&a.call(t,f),e(f)})})):o(),t}};var v=/(<|<|<)/g,y=/(>|>|>)/g,b={sup:"font-size:70%",sub:"font-size:70%",b:"font-weight:bold",i:"font-style:italic",a:"cursor:pointer",span:"",em:"font-style:italic;font-weight:bold"},x={sub:"0.3em",sup:"-0.6em"},_={sub:"-0.21em",sup:"0.42em"},w="\u200b",A=["http:","https:","mailto:","",void 0,":"],k=new RegExp("]*)?/?>","g"),M=Object.keys(p.entityToUnicode).map(function(t){return{regExp:new RegExp("&"+t+";","g"),sub:p.entityToUnicode[t]}}),T=/(\r\n?|\n)/g,E=/(<[^<>]*>)/,L=/<(\/?)([^ >]*)(\s+(.*))?>/i,S=//i,C=/(^|[\s"'])style\s*=\s*("([^"]*);?"|'([^']*);?')/i,O=/(^|[\s"'])href\s*=\s*("([^"]*)"|'([^']*)')/i,I=/(^|[\s"'])target\s*=\s*("([^"\s]*)"|'([^'\s]*)')/i,R=/(^|[\s"'])popup\s*=\s*("([\w=,]*)"|'([\w=,]*)')/i,D=/(^|;)\s*color:/;r.plainText=function(t){return(t||"").replace(k," ")},r.lineCount=function(t){return t.selectAll("tspan.line").size()||1},r.positionText=function(t,e,r){return t.each(function(){function t(t,e){return void 0===e?null===(e=n.attr(t))&&(n.attr(t,0),e=0):n.attr(t,e),e}var n=f.select(this),a=t("x",e),i=t("y",r) +;"text"===this.nodeName&&n.selectAll("tspan.line").attr({x:a,y:i})})},r.makeEditable=function(t,e){function r(){a(),t.style({opacity:0});var e,r=l.attr("class");(e=r?"."+r.split(" ")[0]+"-math-group":"[class*=-math-group]")&&f.select(t.node().parentNode).select(e).style({opacity:0})}function n(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 r=f.select(i),a=r.select(".svg-container"),o=a.append("div");o.classed("plugin-editable editable",!0).style({position:"absolute","font-family":t.style("font-family")||"Arial","font-size":t.style("font-size")||12,color:e.fill||t.style("fill")||"black",opacity:1,"background-color":e.background||"transparent",outline:"#ffffff33 1px solid",margin:[-parseFloat(t.style("font-size"))/8+1,0,0,-1].join("px ")+"px",padding:"0","box-sizing":"border-box"}).attr({contenteditable:!0}).text(e.text||t.attr("data-unformatted")).call(c(t,a,e)).on("blur",function(){i._editing=!1,t.text(this.textContent).style({opacity:1});var e,r=f.select(this).attr("class");(e=r?"."+r.split(" ")[0]+"-math-group":"[class*=-math-group]")&&f.select(t.node().parentNode).select(e).style({opacity:0});var n=this.textContent;f.select(this).transition().duration(0).remove(),f.select(document).on("mouseup",null),s.edit.call(t,n)}).on("focus",function(){var t=this;i._editing=!0,f.select(document).on("mouseup",function(){if(f.event.target===t)return!1;document.activeElement===o.node()&&o.node().blur()})}).on("keyup",function(){27===f.event.which?(i._editing=!1,t.style({opacity:1}),f.select(this).style({opacity:0}).on("blur",function(){return!1}).transition().remove(),s.cancel.call(t,this.textContent)):(s.input.call(t,this.textContent),f.select(this).call(c(t,a,e)))}).on("keydown",function(){13===f.event.which&&this.blur()}).call(n)}var i=e.gd,o=e.delegate,s=f.dispatch("edit","input","cancel"),l=o||t;if(t.style({"pointer-events":o?"none":"all"}),1!==t.size())throw new Error("boo");return e.immediate?r():l.on("click",r),f.rebind(t,s,"on")}},{"../constants/alignment":329,"../constants/string_mappings":334,"../constants/xmlns_namespaces":335,"../lib":350,d3:62}],370:[function(t,e,r){"use strict";var n=t("fast-isnumeric");e.exports=function(t,e){if(t>0)return Math.log(t)/Math.LN10;var r=Math.log(Math.min(e[0],e[1]))/Math.LN10;return n(r)||(r=Math.log(Math.max(e[0],e[1]))/Math.LN10-6),r}},{"fast-isnumeric":68}],371:[function(t,e,r){"use strict";function n(t,e){for(var r=new Float32Array(e),n=0;n0)return t.substr(0,e)}var s=t("fast-isnumeric"),l=t("gl-mat4/fromQuat"),u=t("../registry"),c=t("../lib"),f=t("../plots/plots"),h=t("../plots/cartesian/axes"),d=t("../components/color");r.getGraphDiv=function(t){var e;if("string"==typeof t){if(null===(e=document.getElementById(t)))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},r.clearPromiseQueue=function(t){Array.isArray(t._promises)&&t._promises.length>0&&c.log("Clearing previous rejected promises from queue."),t._promises=[]},r.cleanLayout=function(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 a=h.list({_fullLayout:t});for(e=0;e3?(m.x=1.02,m.xanchor="left"):m.x<-2&&(m.x=-.02,m.xanchor="right"),m.y>3?(m.y=1.02,m.yanchor="bottom"):m.y<-2&&(m.y=-.02,m.yanchor="top")),"rotate"===t.dragmode&&(t.dragmode="orbit"),t.scene1&&(t.scene||(t.scene=t.scene1),delete t.scene1);var v=f.getSubplotIds(t,"gl3d");for(e=0;e1&&o.warn("Full array edits are incompatible with other edits",f);var y=r[""][""];if(c(y))e.set(null);else{if(!Array.isArray(y))return o.warn("Unrecognized full array edit value",f,y),!0;e.set(y)}return!g&&(h(m,v),d(t),!0)}var b,x,_,w,A,k,M,T=Object.keys(r).map(Number).sort(s),E=e.get(),L=E||[],S=n(v,f).get(),C=[],O=-1,I=L.length;for(b=0;bL.length-(M?0:1))o.warn("index out of range",f,_);else if(void 0!==k)A.length>1&&o.warn("Insertion & removal are incompatible with edits to the same index.",f,_),c(k)?C.push(_):M?("add"===k&&(k={}),L.splice(_,0,k),S&&S.splice(_,0,{})):o.warn("Unrecognized full object edit value",f,_,k),-1===O&&(O=_);else for(x=0;x=0;b--)L.splice(C[b],1),S&&S.splice(C[b],1);if(L.length?E||e.set(L):e.set(null),g)return!1;if(h(m,v),p!==i){var R;if(-1===O)R=T;else{for(I=Math.max(L.length,I),R=[],b=0;b=O);b++)R.push(_);for(b=O;b=t.data.length||a<-t.data.length)throw new Error(r+" must be valid indices for gd.data.");if(e.indexOf(a,n+1)>-1||a>=0&&e.indexOf(-t.data.length+a)>-1||a<0&&e.indexOf(t.data.length+a)>-1)throw new Error("each index in "+r+" must be unique.")}}function l(t,e,r){if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if(void 0===e)throw new Error("currentIndices is a required argument.");if(Array.isArray(e)||(e=[e]),s(t,e,"currentIndices"),void 0===r||Array.isArray(r)||(r=[r]),void 0!==r&&s(t,r,"newIndices"),void 0!==r&&e.length!==r.length)throw new Error("current and new indices must be of equal length.")}function u(t,e,r){var n,a;if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if(void 0===e)throw new Error("traces must be defined.");for(Array.isArray(e)||(e=[e]),n=0;n=0&&lV.range[0]?[1,2]:[2,1]);else{var X=V.range[0],Y=V.range[1];G?(X<=0&&Y<=0&&r(N+".autorange",!0),X<=0?X=Y/1e6:Y<=0&&(Y=X/1e6),r(N+".range[0]",Math.log(X)/Math.LN10),r(N+".range[1]",Math.log(Y)/Math.LN10)):(r(N+".range[0]",Math.pow(10,X)),r(N+".range[1]",Math.pow(10,Y)))}else r(N+".autorange",!0);A.getComponentMethod("annotations","convertCoords")(t,j,E,r),A.getComponentMethod("images","convertCoords")(t,j,E,r)}else r(N+".autorange",!0);x.nestedProperty(u,N+"._inputRange").set(null)}else if(R.match(P.AX_NAME_PATTERN)){var W=x.nestedProperty(u,M).get(),Z=(E||{}).type;Z&&"-"!==Z||(Z="linear"),A.getComponentMethod("annotations","convertCoords")(t,W,Z,r),A.getComponentMethod("images","convertCoords")(t,W,Z,r)}var Q=O.containerArrayMatch(M);if(Q){i=Q.array,o=Q.index;var $=Q.property,K=x.nestedProperty(l,i),J=(K||[])[o]||{};if(""===o)-1===M.indexOf("updatemenus")&&(v.docalc=!0);else if(""===$){var tt=E;O.isAddVal(E)?_[M]=null:O.isRemoveVal(E)?(_[M]=J,tt=J):x.warn("unrecognized full object value",e),(n(tt,"x")||n(tt,"y")&&-1===M.indexOf("updatemenus"))&&(v.docalc=!0)}else!n(J,"x")&&!n(J,"y")||x.containsAny(M,["color","opacity","align","dash","updatemenus"])||(v.docalc=!0);h[i]||(h[i]={});var et=h[i][o];et||(et=h[i][o]={}),et[$]=E,delete e[M]}else if("reverse"===R)F.range?F.range.reverse():(r(N+".autorange",!0),F.range=[1,0]),j.autorange?v.docalc=!0:v.doplot=!0;else{var rt=String(T.parts[1]||"");0===C.indexOf("scene")?"camera"===T.parts[1]?v.docamera=!0:v.doplot=!0:0===C.indexOf("geo")?v.doplot=!0:0===C.indexOf("ternary")?v.doplot=!0:"paper_bgcolor"===M?v.doplot=!0:"margin"===C||"autorange"===rt||"rangemode"===rt||"type"===rt||"domain"===rt||"fixedrange"===rt||"scaleanchor"===rt||"scaleratio"===rt||-1!==M.indexOf("calendar")||M.match(/^(bar|box|font)/)?v.docalc=!0:!u._has("gl2d")||-1===M.indexOf("axis")&&"plot_bgcolor"!==M?!u._has("gl2d")||"dragmode"!==M||"lasso"!==E&&"select"!==E||"lasso"===H||"select"===H?"hiddenlabels"===M?v.docalc=!0:-1!==C.indexOf("legend")?v.dolegend=!0:-1!==M.indexOf("title")?v.doticks=!0:-1!==C.indexOf("bgcolor")?v.dolayoutstyle=!0:L>1&&x.containsAny(rt,["tick","exponent","grid","zeroline"])?v.doticks=!0:-1!==M.indexOf(".linewidth")&&-1!==M.indexOf("axis")?v.doticks=v.dolayoutstyle=!0:L>1&&-1!==rt.indexOf("line")?v.dolayoutstyle=!0:L>1&&"mirror"===rt?v.doticks=v.dolayoutstyle=!0:"margin.pad"===M?v.doticks=v.dolayoutstyle=!0:-1!==["hovermode","dragmode"].indexOf(M)||-1!==M.indexOf("spike")?v.domodebar=!0:-1===["height","width","autosize"].indexOf(M)&&(v.doplot=!0):v.docalc=!0:v.doplot=!0,T.set(E)}}}for(i in h){O.applyContainerArrayChanges(t,x.nestedProperty(l,i),h[i],v)||(v.doplot=!0)}var nt=u._axisConstraintGroups;for(m in w)for(o=0;o=s.length?s[0]:s[t]:s}function a(t){return Array.isArray(l)?t>=l.length?l[0]:l[t]:l}function i(t,e){var r=0;return function(){if(t&&++r===e)return t()}}if(t=I.getGraphDiv(t),!x.isPlotDiv(t))throw new Error("This element is not a Plotly plot: "+t+". It's likely that you've failed to create a plot before animating it. For more details, see https://plot.ly/javascript/animations/");var o=t._transitionData;o._frameQueue||(o._frameQueue=[]),r=k.supplyAnimationDefaults(r);var s=r.transition,l=r.frame;return void 0===o._frameWaitingCnt&&(o._frameWaitingCnt=0),new Promise(function(l,u){function c(){t.emit("plotly_animated"),window.cancelAnimationFrame(o._animationRaf),o._animationRaf=null}function f(){o._currentFrame&&o._currentFrame.onComplete&&o._currentFrame.onComplete();var e=o._currentFrame=o._frameQueue.shift();if(e){var r=e.name?e.name.toString():null;t._fullLayout._currentFrame=r,o._lastFrameAt=Date.now(),o._timeToNext=e.frameOpts.duration,k.transition(t,e.frame.data,e.frame.layout,I.coerceTraceIndices(t,e.frame.traces),e.frameOpts,e.transitionOpts).then(function(){e.onComplete&&e.onComplete()}),t.emit("plotly_animatingframe",{name:r,frame:e.frame,animation:{frame:e.frameOpts,transition:e.transitionOpts}})}else c()}function h(){t.emit("plotly_animating"),o._lastFrameAt=-1/0,o._timeToNext=0,o._runningTransitions=0,o._currentFrame=null;var e=function(){o._animationRaf=window.requestAnimationFrame(e),Date.now()-o._lastFrameAt>o._timeToNext&&f()};e()}function d(t){return Array.isArray(s)?m>=s.length?t.transitionOpts=s[m]:t.transitionOpts=s[0]:t.transitionOpts=s,m++,t}var p,g,m=0,v=[],y=void 0===e||null===e,b=Array.isArray(e);if(y||b||!x.isPlainObject(e)){if(y||-1!==["string","number"].indexOf(typeof e))for(p=0;p0&&AA)&&M.push(g);v=M}}v.length>0?function(e){if(0!==e.length){for(var s=0;s=0;a--)if(x.isPlainObject(e[a])){var h=(u[e[a].name]||{}).name,d=e[a].name;h&&d&&"number"==typeof d&&u[h]&&(n++,x.warn('addFrames: overwriting frame "'+u[h].name+'" with a frame whose name of type "number" also equates to "'+h+'". This is valid but may potentially lead to unexpected behavior since all plotly.js frame names are stored internally as strings.'),n>5&&x.warn("addFrames: This API call has yielded too many warnings. For the rest of this call, further warnings about numeric frame names will be suppressed.")),f.push({frame:k.supplyFrameDefaults(e[a]),index:r&&void 0!==r[a]&&null!==r[a]?r[a]:c+a})}f.sort(function(t,e){return t.index>e.index?-1:t.index=0;a--){if(i=f[a].frame,"number"==typeof i.name&&x.warn("Warning: addFrames accepts frames with numeric names, but the numbers areimplicitly cast to strings"),!i.name)for(;u[i.name="frame "+t._transitionData._counter++];);if(u[i.name]){for(o=0;o=0;r--)n=e[r],i.push({type:"delete",index:n}),o.unshift({type:"insert",index:n,value:a[n]});var s=k.modifyFrames,l=k.modifyFrames,u=[t,o],c=[t,i];return w&&w.add(t,s,u,l,c),k.modifyFrames(t,i)},b.purge=function(t){t=I.getGraphDiv(t);var e=t._fullLayout||{},r=t._fullData||[];return k.cleanPlot([],{},r,e),k.purge(t),_.purge(t),e._container&&e._container.remove(),delete t._context,delete t._replotPending,delete t._mouseDownTime,delete t._legendMouseDownTime,delete t._hmpixcount,delete t._hmlumcount,t}},{"../components/drawing":257,"../components/errorbars":263,"../constants/xmlns_namespaces":335,"../lib":350,"../lib/events":342,"../lib/queue":362,"../lib/svg_text_utils":369,"../plotly":384,"../plots/cartesian/axis_ids":392,"../plots/cartesian/constants":394,"../plots/cartesian/constraints":396,"../plots/cartesian/graph_interact":398,"../plots/plots":422,"../plots/polar":425,"../registry":429,"./edit_types":373,"./helpers":374,"./manage_arrays":375,"./subroutines":381,d3:62,"fast-isnumeric":68,"has-hover":149}],377:[function(t,e,r){"use strict";function n(t,r){try{t._fullLayout._paper.style("background",r)}catch(t){e.exports.logging>0&&console.error(t)}}e.exports={staticPlot:!1,editable:!1,edits:{annotationPosition:!1,annotationTail:!1,annotationText:!1,axisTitleText:!1,colorbarPosition:!1,colorbarTitleText:!1,legendPosition:!1,legendText:!1,shapePosition:!1,titleText:!1},autosizable:!1,queueLength:0,fillFrame:!1,frameMargins:0,scrollZoom:!1,doubleClick:"reset+autosize",showTips:!0,showAxisDragHandles:!0,showAxisRangeEntryBoxes:!0,showLink:!1,sendData:!0,linkText:"Edit chart",showSources:!1,displayModeBar:"hover",modeBarButtonsToRemove:[],modeBarButtonsToAdd:[],modeBarButtons:!1,displaylogo:!0,plotGlPixelRatio:2,setBackground:n,topojsonURL:"https://cdn.plot.ly/",mapboxAccessToken:null,logging:!1,globalTransforms:[]}},{}],378:[function(t,e,r){"use strict";function n(t){var e,r;"area"===t?(e={attributes:b},r={}):(e=d.modules[t]._module,r=e.basePlotModule);var n={};n.type=null,A(n,g),A(n,e.attributes),r.attributes&&A(n,r.attributes),Object.keys(d.componentsRegistry).forEach(function(e){var r=d.componentsRegistry[e];r.schema&&r.schema.traces&&r.schema.traces[t]&&Object.keys(r.schema.traces[t]).forEach(function(e){h(n,r.schema.traces[t][e],e)})}),n.type=t;var a={meta:e.meta||{},attributes:s(n)};if(e.layoutAttributes){var i={};A(i,e.layoutAttributes),a.layoutAttributes=s(i)}return a}function a(){var t={};return A(t,m),Object.keys(d.subplotsRegistry).forEach(function(e){var r=d.subplotsRegistry[e];if(r.layoutAttributes)if("cartesian"===r.name)f(t,r,"xaxis"),f(t,r,"yaxis");else{var n="subplot"===r.attr?r.name:r.attr;f(t,r,n)}}),t=c(t),Object.keys(d.componentsRegistry).forEach(function(e){var r=d.componentsRegistry[e];r.layoutAttributes&&(r.schema&&r.schema.layout?Object.keys(r.schema.layout).forEach(function(e){h(t,r.schema.layout[e],e)}):h(t,r.layoutAttributes,r.name))}),{layoutAttributes:s(t)}}function i(t){var e=d.transformsRegistry[t],r=A({},e.attributes);return Object.keys(d.componentsRegistry).forEach(function(e){var n=d.componentsRegistry[e];n.schema&&n.schema.transforms&&n.schema.transforms[t]&&Object.keys(n.schema.transforms[t]).forEach(function(e){h(r,n.schema.transforms[t][e],e)})}),{attributes:s(r)}}function o(){var t={frames:p.extendDeep({},v)};return s(t),t.frames}function s(t){return l(t),u(t),t}function l(t){function e(t){return{valType:"string"}}function n(t,n,a){r.isValObject(t)?"data_array"===t.valType?(t.role="data",a[n+"src"]=e(n)):!0===t.arrayOk&&(a[n+"src"]=e(n)):p.isPlainObject(t)&&(t.role="object")}r.crawl(t,n)}function u(t){function e(t,e,r){if(t){var n=t[M];n&&(delete t[M],r[e]={items:{}},r[e].items[n]=t,r[e].role="object")}}r.crawl(t,e)}function c(t){return w(t,{radialaxis:x.radialaxis,angularaxis:x.angularaxis}),w(t,x.layout),t}function f(t,e,r){var n=p.nestedProperty(t,r),a=A({},e.layoutAttributes);a[k]=!0,n.set(a)}function h(t,e,r){var n=p.nestedProperty(t,r);n.set(A(n.get()||{},e))}var d=t("../registry"),p=t("../lib"),g=t("../plots/attributes"),m=t("../plots/layout_attributes"),v=t("../plots/frame_attributes"),y=t("../plots/animation_attributes"),b=t("../plots/polar/area_attributes"),x=t("../plots/polar/axis_attributes"),_=t("./edit_types"),w=p.extendFlat,A=p.extendDeep,k="_isSubplotObj",M="_isLinkedToArray",T=[k,M,"_arrayAttrRegexps","_deprecated"];r.IS_SUBPLOT_OBJ=k,r.IS_LINKED_TO_ARRAY=M,r.DEPRECATED="_deprecated",r.UNDERSCORE_ATTRS=T,r.get=function(){var t={};d.allTypes.concat("area").forEach(function(e){t[e]=n(e)});var e={};return Object.keys(d.transformsRegistry).forEach(function(t){e[t]=i(t)}),{defs:{valObjects:p.valObjects,metaKeys:T.concat(["description","role"]),editTypes:{traces:_.traces(),layout:_.layout()}},traces:t,layout:a(),transforms:e,frames:o(),animation:s(y)}},r.crawl=function(t,e,n){var a=n||0;Object.keys(t).forEach(function(n){var i=t[n];-1===T.indexOf(n)&&(e(i,n,t,a),r.isValObject(i)||p.isPlainObject(i)&&r.crawl(i,e,a+1))})},r.isValObject=function(t){return t&&void 0!==t.valType},r.findArrayAttributes=function(t){function e(e,r,o,s){if(i=i.slice(0,s).concat([r]),e&&("data_array"===e.valType||!0===e.arrayOk)&&!("colorbar"===i[s-1]&&("ticktext"===r||"tickvals"===r))){var l=n(i),u=p.nestedProperty(t,l).get();Array.isArray(u)&&a.push(l)}}function n(t){return t.join(".")}var a=[],i=[];if(r.crawl(g,e),t._module&&t._module.attributes&&r.crawl(t._module.attributes,e),t.transforms)for(var o=t.transforms,s=0;s=t[1]||a[1]<=t[0])&&(i[0]e[0]))return!0}return!1}function a(t,e,r){return t._anchorAxis===e&&(t.mirror||t.side===r)||"all"===t.mirror||"allticks"===t.mirror||t.mirrors&&t.mirrors[e._id+r]}function i(t,e,r){var n=[],a=e._anchorAxis;if(a){var i=a._mainAxis;if(-1===n.indexOf(i)){n.push(i);for(var o=0;o1)};h(e.width)&&h(e.height)||n(new Error("Height and width should be pixel values."));var d=l(t,{format:"png",height:e.height,width:e.width}),p=d.gd;p.style.position="absolute",p.style.left="-5000px",document.body.appendChild(p);var g=s.getRedrawFunc(p);i.plot(p,d.data,d.layout,d.config).then(g).then(f).then(function(t){r(t)}).catch(function(t){n(t)})})}var a=t("fast-isnumeric"),i=t("../plotly"),o=t("../lib"),s=t("../snapshot/helpers"),l=t("../snapshot/cloneplot"),u=t("../snapshot/tosvg"),c=t("../snapshot/svgtoimg");e.exports=n},{"../lib":350,"../plotly":384,"../snapshot/cloneplot":430,"../snapshot/helpers":433,"../snapshot/svgtoimg":435,"../snapshot/tosvg":437,"fast-isnumeric":68}],383:[function(t,e,r){"use strict";function n(t,e,r,a,i,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,m=r.length,v=0;v.3*f||i(n)||i(a))){var h=r.dtick/2;t+=t+h.8){var o=Number(r.substr(1));i.exactYears>.8&&o%12==0?t=P.tickIncrement(t,"M6","reverse")+1.5*C:i.exactMonths>.8?t=P.tickIncrement(t,"M1","reverse")+15.5*C:t-=C/2;var s=P.tickIncrement(t,r);if(s<=n)return s}return t}function i(t){var e,r,n=t.tickvals,a=t.ticktext,i=new Array(n.length),o=_.simpleMap(t.range,t.r2l),s=1.0001*o[0]-1e-4*o[1],u=1.0001*o[1]-1e-4*o[0],c=Math.min(s,u),f=Math.max(s,u),h=0;Array.isArray(a)||(a=[]);var d="category"===t.type?t.d2l_noadd:t.d2l;for("log"===t.type&&"L"!==String(t.dtick).charAt(0)&&(t.dtick="L"+Math.pow(10,Math.floor(Math.min(t.range[0],t.range[1]))-1)),r=0;rc&&e10||"01-01"!==n.substr(5)?t._tickround="d":t._tickround=+e.substr(1)%12==0?"y":"m";else if(e>=C&&a<=10||e>=15*C)t._tickround="d";else if(e>=I&&a<=16||e>=O)t._tickround="M";else if(e>=R&&a<=19||e>=I)t._tickround="S";else{var i=t.l2r(r+e).replace(/^-/,"").length;t._tickround=Math.max(a,i)-20}}else if(b(e)||"L"===e.charAt(0)){var o=t.range.map(t.r2d||Number);b(e)||(e=Number(e.substr(1))),t._tickround=2-Math.floor(Math.log(e)/Math.LN10+.01);var s=Math.max(Math.abs(o[0]),Math.abs(o[1])),l=Math.floor(Math.log(s)/Math.LN10+.01);Math.abs(l)>3&&("SI"===t.exponentformat||"B"===t.exponentformat?t._tickexponent=3*Math.round((l-1)/3):t._tickexponent=l)}else t._tickround=null}function l(t,e,r){var n=t.tickfont||{};return{x:e,dx:0,dy:0,text:r||"",fontSize:n.size,font:n.family,fontColor:n.color}}function u(t,e,r,n){var a=t._tickround,i=r&&t.hoverformat||t.tickformat;n&&(a=b(a)?4:{y:"m",m:"d",d:"M",M:"S",S:4}[a]);var o,s=_.formatDate(e.x,i,a,t.calendar),l=s.indexOf("\n");-1!==l&&(o=s.substr(l+1),s=s.substr(0,l)),n&&("00:00:00"===s||"00:00"===s?(s=o,o=""):8===s.length&&(s=s.replace(/:00$/,""))),o&&(r?"d"===a?s+=", "+o:s=o+(s?", "+s:""):t._inCalcTicks&&o===t._prevDateHead||(s+="
"+o,t._prevDateHead=o)),e.text=s}function c(t,e,r,n,a){var i=t.dtick,o=e.x;if(!n||"string"==typeof i&&"L"===i.charAt(0)||(i="L3"),t.tickformat||"string"==typeof i&&"L"===i.charAt(0))e.text=d(Math.pow(10,o),t,a,n);else if(b(i)||"D"===i.charAt(0)&&_.mod(o+.01,1)<.1)if(-1!==["e","E","power"].indexOf(t.exponentformat)){var s=Math.round(o);e.text=0===s?1:1===s?"10":s>1?"10"+s+"":"10\u2212"+-s+"",e.fontSize*=1.25}else e.text=d(Math.pow(10,o),t,"","fakehover"),"D1"===i&&"y"===t._id.charAt(0)&&(e.dy-=e.fontSize/6);else{if("D"!==i.charAt(0))throw"unrecognized dtick "+String(i);e.text=String(Math.round(Math.pow(10,_.mod(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*(o<0?.5:.25)))}}function f(t,e){var r=t._categories[Math.round(e.x)];void 0===r&&(r=""),e.text=String(r)}function h(t,e,r,n,a){"all"===t.showexponent&&Math.abs(e.x/t.dtick)<1e-6&&(a="hide"),e.text=d(e.x,t,a,n)}function d(t,e,r,n){var a=t<0,i=e._tickround,o=r||e.exponentformat||"B",l=e._tickexponent,u=e.tickformat,c=e.separatethousands;if(n){var f={exponentformat:e.exponentformat,dtick:"none"===e.showexponent?e.dtick:b(t)?Math.abs(t)||1:1,range:"none"===e.showexponent?e.range.map(e.r2d):[0,t||1]};s(f),i=(Number(f._tickround)||0)+4,l=f._tickexponent,e.hoverformat&&(u=e.hoverformat)}if(u)return y.format(u)(t).replace(/-/g,"\u2212");var h=Math.pow(10,-i)/2;if("none"===o&&(l=0),(t=Math.abs(t))12||l<-15)?t+="e"+g:"E"===o?t+="E"+g:"power"===o?t+="\xd710"+g+"":"B"===o&&9===l?t+="B":"SI"!==o&&"B"!==o||(t+=G[l/3+5])}return a?"\u2212"+t:t}function p(t,e){var r,n,a=[];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},P.getAutoRange=function(t){var e,r=[],n=t._min[0].val,a=t._max[0].val;for(e=1;e0&&c>0&&f/c>h&&(l=o,u=s,h=f/c);if(n===a){var g=n-1,m=n+1;r="tozero"===t.rangemode?n<0?[g,0]:[0,m]:"nonnegative"===t.rangemode?[Math.max(0,g),Math.max(0,m)]:[g,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)),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(),_.simpleMap(r,t.l2r||Number)},P.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=P.getAutoRange(t),t._r=t.range.slice(),t._rl=_.simpleMap(t._r,t.r2l);var r=t._input;r.range=t.range.slice(),r.autorange=t.autorange}},P.saveRangeInitial=function(t,e){for(var r=P.list(t,"",!0),n=!1,a=0;a=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||!!_.nestedProperty(t,"rangeslider.autorange").get())&&e){t._min||(t._min=[]),t._max||(t._max=[]),r||(r={}),t._m||t.setScale();var i,o,s,l,u,c,f,h,d,p,g,m=e.length,v=r.padded?.05*t._length:0,y=r.tozero&&("linear"===t.type||"-"===t.type);v&&"domain"===t.constrain&&t._inputDomain&&(v*=(t._inputDomain[1]-t._inputDomain[0])/(t.domain[1]-t.domain[0]));var x=n((t._m>0?r.ppadplus:r.ppadminus)||r.ppad||0),w=n((t._m>0?r.ppadminus:r.ppadplus)||r.ppad||0),A=n(r.vpadplus||r.vpad),k=n(r.vpadminus||r.vpad);for(i=0;i<6;i++)a(i);for(i=m-1;i>5;i--)a(i)}},P.autoBin=function(t,e,r,i,o){var s=_.aggNums(Math.min,null,t),l=_.aggNums(Math.max,null,t);if(o||(o=e.calendar),"category"===e.type)return{start:s-.5,end:l+.5,size:1};var u;if(r)u=(l-s)/r;else{var c=_.distinctVals(t),f=Math.pow(10,Math.floor(Math.log(c.minDiff)/Math.LN10)),h=f*_.roundUp(c.minDiff/f,[.9,1.9,4.9,9.9],!0);u=Math.max(h,2*_.stdev(t)/Math.pow(t.length,i?.25:.4)),b(u)||(u=1)}var d;d="log"===e.type?{type:"linear",range:[s,l]}:{type:e.type,range:_.simpleMap([s,l],e.c2r,0,o),calendar:o},P.setConvert(d),P.autoTicks(d,u);var p,g=P.tickIncrement(P.tickFirst(d),d.dtick,"reverse",o);if("number"==typeof d.dtick){g=n(g,t,d,s,l);p=g+(1+Math.floor((l-g)/d.dtick))*d.dtick}else for("M"===d.dtick.charAt(0)&&(g=a(g,t,d.dtick,s,o)),p=g;p<=l;)p=P.tickIncrement(p,d.dtick,!1,o);return{start:e.c2r(g,0,o),end:e.c2r(p,0,o),size:d.dtick}},P.calcTicks=function(t){var e=_.simpleMap(t.range,t.r2l);if("auto"===t.tickmode||!t.dtick){var r,n=t.nticks;n||("category"===t.type?(r=t.tickfont?1.2*(t.tickfont.size||12):15,n=t._length/r):(r="y"===t._id.charAt(0)?40:80,n=_.constrain(t._length/r,4,9)+1)),"array"===t.tickmode&&(n*=100),P.autoTicks(t,Math.abs(e[1]-e[0])/n),t._minDtick>0&&t.dtick<2*t._minDtick&&(t.dtick=t._minDtick,t.tick0=t.l2r(t._forceTick0))}if(t.tick0||(t.tick0="date"===t.type?"2000-01-01":0),s(t),"array"===t.tickmode)return i(t);t._tmin=P.tickFirst(t);var a=e[1]=l:f<=l)&&!(o.length>c||f===u);f=P.tickIncrement(f,t.dtick,a,t.calendar))u=f,o.push(f);t._tmax=o[o.length-1],t._prevDateHead="",t._inCalcTicks=!0;for(var h=new Array(o.length),d=0;dL?(e/=L,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="M"+12*o(e,r,F)):n>S?(e/=S,t.dtick="M"+o(e,1,B)):n>C?(t.dtick=o(e,C,H),t.tick0=_.dateTick0(t.calendar,!0)):n>O?t.dtick=o(e,O,B):n>I?t.dtick=o(e,I,j):n>R?t.dtick=o(e,R,j):(r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=o(e,r,F))}else if("log"===t.type){t.tick0=0;var a=_.simpleMap(t.range,t.r2l);if(e>.7)t.dtick=Math.ceil(e);else if(Math.abs(a[1]-a[0])<1){var i=1.5*Math.abs((a[1]-a[0])/e);e=Math.abs(Math.pow(10,a[1])-Math.pow(10,a[0]))/i,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="L"+o(e,r,F)}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=o(e,r,F));if(0===t.dtick&&(t.dtick=1),!b(t.dtick)&&"string"!=typeof t.dtick){var s=t.dtick;throw t.dtick=1,"ax.dtick error: "+String(s)}},P.tickIncrement=function(t,e,r,n){var a=r?-1:1;if(b(e))return t+a*e;var i=e.charAt(0),o=a*Number(e.substr(1));if("M"===i)return _.incrementMonth(t,o,n);if("L"===i)return Math.log(Math.pow(10,t)+o)/Math.LN10;if("D"===i){var s="D2"===e?V:U,l=t+.01*a,u=_.roundUp(_.mod(l,1),s,r);return Math.floor(l)+Math.log(y.round(Math.pow(10,u),1))/Math.LN10}throw"unrecognized dtick "+String(e)},P.tickFirst=function(t){var e=t.r2l||Number,r=_.simpleMap(t.range,e),n=r[1]1&&e2*a}function i(t){for(var e,r=Math.max(1,(t.length-1)/1e3),n=0,a=0,i=0;i2*n}var o=t("fast-isnumeric"),s=t("../../lib"),l=t("../../constants/numerical").BADNUM;e.exports=function(t,e){return a(t,e)?"date":i(t)?"category":n(t)?"linear":"-"}},{"../../constants/numerical":333, +"../../lib":350,"fast-isnumeric":68}],391:[function(t,e,r){"use strict";var n=t("tinycolor2").mix,a=t("../../registry"),i=t("../../lib"),o=t("../../components/color/attributes").lightFraction,s=t("./layout_attributes"),l=t("./tick_value_defaults"),u=t("./tick_mark_defaults"),c=t("./tick_label_defaults"),f=t("./category_order_defaults"),h=t("./set_convert"),d=t("./ordered_categories");e.exports=function(t,e,r,p,g){function m(r,n){return i.coerce2(t,e,s,r,n)}var v=p.letter,y=p.font||{},b="Click to enter "+(p.title||v.toUpperCase()+" axis")+" title",x=r("visible",!p.cheateronly),_=e.type;if("date"===_){a.getComponentMethod("calendars","handleDefaults")(t,e,"calendar",p.calendar)}if(h(e,g),r("autorange",!e.isValidRange(t.range))&&r("rangemode"),r("range"),e.cleanRange(),f(t,e,r),e._initialCategories="category"===_?d(v,e.categoryorder,e.categoryarray,p.data):[],!x)return e;var w=r("color"),A=w===t.color?w:y.color;r("title",b),i.coerceFont(r,"titlefont",{family:y.family,size:Math.round(1.2*y.size),color:A}),l(t,e,r,_),c(t,e,r,_,p),u(t,e,r,p);var k=m("linecolor",w),M=m("linewidth"),T=r("showline",!!k||!!M);T||(delete e.linecolor,delete e.linewidth),(T||e.ticks)&&r("mirror");var E=m("gridcolor",n(w,p.bgColor,o).toRgbString()),L=m("gridwidth");r("showgrid",p.showGrid||!!E||!!L)||(delete e.gridcolor,delete e.gridwidth);var S=m("zerolinecolor",w),C=m("zerolinewidth");return r("zeroline",p.showGrid||!!S||!!C)||(delete e.zerolinecolor,delete e.zerolinewidth),e}},{"../../components/color/attributes":232,"../../lib":350,"../../registry":429,"./category_order_defaults":393,"./layout_attributes":400,"./ordered_categories":402,"./set_convert":406,"./tick_label_defaults":407,"./tick_mark_defaults":408,"./tick_value_defaults":409,tinycolor2:200}],392:[function(t,e,r){"use strict";function n(t,e,r){function n(t,r){for(var n=Object.keys(t),a=/^[xyz]axis[0-9]*/,i=[],o=0;o0;i&&(n="array");var o=r("categoryorder",n);"array"===o&&r("categoryarray"),i||"array"!==o||(e.categoryorder="trace")}}},{}],394:[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]+)?$/},xAxisMatch:/^xaxis[0-9]*$/,yAxisMatch:/^yaxis[0-9]*$/,AX_ID_PATTERN:/^[xyz][0-9]*$/,AX_NAME_PATTERN:/^[xyz]axis[0-9]*$/,MINDRAG:8,MINSELECT:12,MINZOOM:20,DRAGGERSIZE:20,BENDPX:1.5,REDRAWDELAY:50,DFLTRANGEX:[-1,6],DFLTRANGEY:[-1,4],traceLayerClasses:["imagelayer","maplayer","barlayer","carpetlayer","boxlayer","scatterlayer"],layerValue2layerClass:{"above traces":"above","below traces":"below"}}},{}],395:[function(t,e,r){"use strict";function n(t,e,r,n){var a,i,s,l,u=n[o(e)].type,c=[];for(i=0;io*v)||_)for(r=0;rO&&RS&&(S=R);var z=(S-L)/(2*C);f/=z,L=l.l2r(L),S=l.l2r(S),l.range=l._input.range=M=0?Math.min(t,.9):1/(1/Math.max(t,-.3)+3.222))}function u(t,e){return t?"nsew"===t?"pan"===e?"move":"crosshair":t.toLowerCase()+"-resize":"pointer"}function c(t,e,r,n,a){return t.append("path").attr("class","zoombox").style({fill:e>.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("transform","translate("+r+", "+n+")").attr("d",a+"Z")}function f(t,e,r){return t.append("path").attr("class","zoombox-corners").style({fill:T.background,stroke:T.defaultLine,"stroke-width":1,opacity:0}).attr("transform","translate("+e+", "+r+")").attr("d","M0,0Z")}function h(t){t.selectAll(".select-outline").remove()}function d(t,e,r,n,a,i){t.attr("d",n+"M"+r.l+","+r.t+"v"+r.h+"h"+r.w+"v-"+r.h+"h-"+r.w+"Z"),a||(t.transition().style("fill",i>.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200),e.transition().style("opacity",1).duration(200))}function p(t){x.select(t).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}function g(t){return-1!==["lasso","select"].indexOf(t)}function m(t,e){return"M"+(t.l-.5)+","+(e-F-.5)+"h-3v"+(2*F+1)+"h3ZM"+(t.r+.5)+","+(e-F-.5)+"h3v"+(2*F+1)+"h-3Z"}function v(t,e){return"M"+(e-F-.5)+","+(t.t-.5)+"v-3h"+(2*F+1)+"v3ZM"+(e-F-.5)+","+(t.b+.5)+"v3h"+(2*F+1)+"v-3Z"}function y(t){var e=Math.floor(Math.min(t.b-t.t,t.r-t.l,F)/2);return"M"+(t.l-3.5)+","+(t.t-.5+e)+"h3v"+-e+"h"+e+"v-3h-"+(e+3)+"ZM"+(t.r+3.5)+","+(t.t-.5+e)+"h-3v"+-e+"h"+-e+"v-3h"+(e+3)+"ZM"+(t.r+3.5)+","+(t.b+.5-e)+"h-3v"+e+"h"+-e+"v3h"+(e+3)+"ZM"+(t.l-3.5)+","+(t.b+.5-e)+"h3v"+e+"h"+e+"v3h-"+(e+3)+"Z"}function b(t,e,r){var n,a,i,o,s,l,u=!1,c={},f={};for(n=0;nF||s>F?(kt="xy",o/it>s/ot?(s=o*ot/it,bt>i?xt.t=bt-s:xt.b=bt+s):(o=s*it/ot,yt>a?xt.l=yt-o:xt.r=yt+o),Tt.attr("d",y(xt))):n():!lt||szoom back out","long"),B=!1)}function Y(e,r){var n=1===(H+U).length;if(e)K();else if(2!==r||n){if(1===r&&n){var a=H?rt[0]:et[0],o="s"===H||"w"===U?0:1,s=a._name+".range["+o+"]",l=i(a,o),u="left",c="middle";if(a.fixedrange)return;H?(c="n"===H?"top":"bottom","right"===a.side&&(u="right")):"e"===U&&(u="right"),t._context.showAxisRangeEntryBoxes&&x.select(mt).call(M.makeEditable,{gd:t,immediate:!0,background:dt.paper_bgcolor,text:String(l),fill:a.tickfont?a.tickfont.color:"#444",horizontalAlign:u,verticalAlign:c}).on("edit",function(e){var r=a.d2r(e);void 0!==r&&w.relayout(t,s,r)})}}else $()}function W(e){function r(t,e,r){function n(e){return t.l2r(i+(e-i)*r)}if(!t.fixedrange){var a=k.simpleMap(t.range,t.r2l),i=a[0]+(a[1]-a[0])*e;t.range=a.map(n)}}if(t._context.scrollZoom||dt._enablescrollzoom){if(t._transitioningWithDuration)return k.pauseEvent(e);var n=t.querySelector(".plotly");if(V(),!(n.scrollHeight-n.clientHeight>10||n.scrollWidth-n.clientWidth>10)){clearTimeout(St);var a=-e.deltaY;if(isFinite(a)||(a=e.wheelDelta/10),!isFinite(a))return void k.log("Did not find wheel motion attributes: ",e);var i,o=Math.exp(-Math.min(Math.max(a,-20),20)/100),s=Ot.draglayer.select(".nsewdrag").node().getBoundingClientRect(),l=(e.clientX-s.left)/s.width,u=(s.bottom-e.clientY)/s.height;if(U||ct){for(U||(l=.5),i=0;i rect").call(E.setTranslate,s,l).call(E.setScale,i,o);var w=g.plot.selectAll(".scatterlayer .points, .boxlayer .points");g.plot.call(E.setTranslate,x,_).call(E.setScale,1/i,1/o),w.selectAll(".point").call(E.setPointGroupScale,i,o).call(E.hideOutsideRangePoints,g),w.selectAll(".textpoint").call(E.setTextPointsScale,i,o).call(E.hideOutsideRangePoints,g)}}}var tt,et,rt,nt,at,it,ot,st,lt,ut,ct,ft,ht,dt=t._fullLayout,pt=t._fullLayout._zoomlayer,gt=H+U==="nsew";V();var mt=n(e,H+U+"drag",ut,r,T,L,j);if(!lt&&!st&&!g(dt.dragmode))return mt.onmousedown=null,mt.style.pointerEvents=gt?"all":"none",mt;var vt={element:mt,gd:t,plotinfo:e,prepFn:function(e,r,n){var a=t._fullLayout.dragmode;gt?e.shiftKey&&(a="pan"===a?"zoom":"pan"):a="pan",vt.minDrag="lasso"===a?1:void 0,"zoom"===a?(vt.moveFn=q,vt.doneFn=X,vt.minDrag=1,G(e,r,n)):"pan"===a?(vt.moveFn=Z,vt.doneFn=Y,h(pt)):g(a)&&(vt.xaxes=et,vt.yaxes=rt,D(e,r,n,vt,a))}};S.init(vt);var yt,bt,xt,_t,wt,At,kt,Mt,Tt,Et={},Lt=[0,0,it,ot],St=null,Ct=z.REDRAWDELAY,Ot=e.mainplot?dt._plots[e.mainplot]:e;return H.length*U.length!=1&&(void 0!==mt.onwheel?mt.onwheel=W:void 0!==mt.onmousewheel&&(mt.onmousewheel=W)),mt}},{"../../components/color":233,"../../components/dragelement":254,"../../components/drawing":257,"../../constants/alignment":329,"../../lib":350,"../../lib/setcursor":365,"../../lib/svg_text_utils":369,"../../plotly":384,"../../registry":429,"../plots":422,"./axes":389,"./axis_ids":392,"./constants":394,"./scale_zoom":404,"./select":405,d3:62,tinycolor2:200}],398:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("../../components/fx"),i=t("../../components/dragelement"),o=t("./constants"),s=t("./dragbox");e.exports=function(t){var e=t._fullLayout;if((e._has("cartesian")||e._has("gl2d"))&&!t._context.staticPlot){Object.keys(e._plots||{}).sort(function(t,r){if((e._plots[t].mainplot&&!0)===(e._plots[r].mainplot&&!0)){var n=t.split("y"),a=r.split("y");return n[0]===a[0]?Number(n[1]||1)-Number(a[1]||1):Number(n[0]||1)-Number(a[0]||1)}return e._plots[t].mainplot?1:-1}).forEach(function(r){var l=e._plots[r],u=l.xaxis,c=l.yaxis,f=(u._linepositions[r]||[])[3],h=(c._linepositions[r]||[])[3],d=o.DRAGGERSIZE;if(n(f)&&"top"===u.side&&(f-=d),n(h)&&"right"!==c.side&&(h-=d),!l.mainplot){var p=s(t,l,0,0,u._length,c._length,"ns","ew");p.onmousemove=function(e){t._fullLayout._rehover=function(){t._fullLayout._hoversubplot===r&&a.hover(t,e,r)},a.hover(t,e,r),t._fullLayout._lasthover=p,t._fullLayout._hoversubplot=r},p.onmouseout=function(e){t._dragging||(t._fullLayout._hoversubplot=null,i.unhover(t,e))},p.onclick=function(e){a.click(t,e,r)},t._context.showAxisDragHandles&&(s(t,l,-d,-d,d,d,"n","w"),s(t,l,u._length,-d,d,d,"n","e"),s(t,l,-d,c._length,d,d,"s","w"),s(t,l,u._length,c._length,d,d,"s","e"))}t._context.showAxisDragHandles&&(n(f)&&("free"===u.anchor&&(f-=e._size.h*(1-c.domain[1])),s(t,l,.1*u._length,f,.8*u._length,d,"","ew"),s(t,l,0,f,.1*u._length,d,"","w"),s(t,l,.9*u._length,f,.1*u._length,d,"","e")),n(h)&&("free"===c.anchor&&(h-=e._size.w*u.domain[0]),s(t,l,h,.1*c._length,d,.8*c._length,"ns",""),s(t,l,h,.9*c._length,d,.1*c._length,"s",""),s(t,l,h,0,d,.1*c._length,"n","")))});var r=e._hoverlayer.node();r.onmousemove=function(r){r.target=e._lasthover,a.hover(t,r,e._hoversubplot)},r.onclick=function(r){r.target=e._lasthover,a.click(t,r)},r.onmousedown=function(t){e._lasthover.onmousedown(t)}}}},{"../../components/dragelement":254,"../../components/fx":274,"./constants":394,"./dragbox":397,"fast-isnumeric":68}],399:[function(t,e,r){"use strict";function n(t,e,r,n,a){var i=t._fullLayout,o=i._modules;e.plot&&e.plot.selectAll("g:not(.scatterlayer)").selectAll("g.trace").remove();for(var s=0;sc[1]-.01&&(e.domain=[0,1]),a.noneOrAll(t.domain,e.domain,[0,1])}return r("layer"),e}},{"../../lib":350,"fast-isnumeric":68}],404:[function(t,e,r){"use strict";var n=t("../../constants/alignment").FROM_BL;e.exports=function(t,e,r){void 0===r&&(r=n[t.constraintoward||"center"]);var a=[t.r2l(t.range[0]),t.r2l(t.range[1])],i=a[0]+(a[1]-a[0])*r;t.range=t._input.range=[t.l2r(i+(a[0]-i)*e),t.l2r(i+(a[1]-i)*e)]}},{"../../constants/alignment":329}],405:[function(t,e,r){"use strict";function n(t){return t._id}function a(t,e){if(Array.isArray(t))for(var r=e.cd[0].trace,n=0;n0)return Math.log(e)/Math.LN10;if(e<=0&&r&&t.range&&2===t.range.length){var n=t.range[0],a=t.range[1];return.5*(n+a-3*A*Math.abs(n-a))}return d}function f(e,r,n){var a=u(e,n||t.calendar);if(a===d){if(!i(e))return d;a=u(new Date(+e))}return a}function m(e,r,n){return l(e,r,n||t.calendar)}function v(e){return t._categories[Math.round(e)]}function y(e){if(null!==e&&void 0!==e){if(void 0===t._categoriesMap&&(t._categoriesMap={}),void 0!==t._categoriesMap[e])return t._categoriesMap[e];t._categories.push(e);var r=t._categories.length-1;return t._categoriesMap[e]=r,r}return d}function b(e){if(t._categoriesMap){var r=t._categoriesMap[e];if(void 0!==r)return r}if(i(e))return+e}function x(e){return i(e)?a.round(t._b+t._m*e,2):d}function _(e){return(e-t._b)/t._m}e=e||{};var w=(t._id||"x").charAt(0),A=10;t.c2l="log"===t.type?r:c,t.l2c="log"===t.type?n:c,t.l2p=x,t.p2l=_,t.c2p="log"===t.type?function(t,e){return x(r(t,e))}:x,t.p2c="log"===t.type?function(t){return n(_(t))}:_,-1!==["linear","-"].indexOf(t.type)?(t.d2r=t.r2d=t.d2c=t.r2c=t.d2l=t.r2l=s,t.c2d=t.c2r=t.l2d=t.l2r=c,t.d2p=t.r2p=function(e){return t.l2p(s(e))},t.p2d=t.p2r=_,t.cleanPos=c):"log"===t.type?(t.d2r=t.d2l=function(t,e){return r(s(t),e)},t.r2d=t.r2c=function(t){return n(s(t))},t.d2c=t.r2l=s,t.c2d=t.l2r=c,t.c2r=r,t.l2d=n,t.d2p=function(e,r){return t.l2p(t.d2r(e,r))},t.p2d=function(t){return n(_(t))},t.r2p=function(e){return t.l2p(s(e))},t.p2r=_,t.cleanPos=c):"date"===t.type?(t.d2r=t.r2d=o.identity,t.d2c=t.r2c=t.d2l=t.r2l=f,t.c2d=t.c2r=t.l2d=t.l2r=m,t.d2p=t.r2p=function(e,r,n){return t.l2p(f(e,0,n))},t.p2d=t.p2r=function(t,e,r){return m(_(t),e,r)},t.cleanPos=function(e){return o.cleanDate(e,d,t.calendar)}):"category"===t.type&&(t.d2c=t.d2l=y,t.r2d=t.c2d=t.l2d=v,t.d2r=t.d2l_noadd=b,t.r2c=function(e){var r=b(e);return void 0!==r?r:t.fraction2r(.5)},t.l2r=t.c2r=c,t.r2l=b,t.d2p=function(e){return t.l2p(t.r2c(e))},t.p2d=function(t){return v(_(t))},t.r2p=t.d2p,t.p2r=_,t.cleanPos=function(t){return"string"==typeof t&&""!==t?t:c(t)}),t.fraction2r=function(e){var r=t.r2l(t.range[0]),n=t.r2l(t.range[1]);return t.l2r(r+e*(n-r))},t.r2fraction=function(e){var r=t.r2l(t.range[0]),n=t.r2l(t.range[1]);return(t.r2l(e)-r)/(n-r)},t.cleanRange=function(e){e||(e="range");var r,n,a=o.nestedProperty(t,e).get();if(n="date"===t.type?o.dfltRange(t.calendar):"y"===w?p.DFLTRANGEY:p.DFLTRANGEX,n=n.slice(),!a||2!==a.length)return void o.nestedProperty(t,e).set(n);for("date"===t.type&&(a[0]=o.cleanDate(a[0],d,t.calendar),a[1]=o.cleanDate(a[1],d,t.calendar)),r=0;r<2;r++)if("date"===t.type){if(!o.isDateTime(a[r],t.calendar)){t[e]=n;break}if(t.r2l(a[0])===t.r2l(a[1])){var s=o.constrain(t.r2l(a[0]),o.MIN_MS+1e3,o.MAX_MS-1e3);a[0]=t.l2r(s-1e3),a[1]=t.l2r(s+1e3);break}}else{if(!i(a[r])){if(!i(a[1-r])){t[e]=n;break}a[r]=a[1-r]*(r?10:.1)}if(a[r]<-h?a[r]=-h:a[r]>h&&(a[r]=h),a[0]===a[1]){var l=Math.max(1,Math.abs(1e-6*a[0]));a[0]-=l,a[1]+=l}}},t.setScale=function(r){var n=e._size;if(t._categories||(t._categories=[]),t._categoriesMap||(t._categoriesMap={}),t.overlaying){var a=g.getFromId({_fullLayout:e},t.overlaying);t.domain=a.domain}var i=r&&t._r?"_r":"range",s=t.calendar;t.cleanRange(i);var l=t.r2l(t[i][0],s),u=t.r2l(t[i][1],s);if("y"===w?(t._offset=n.t+(1-t.domain[1])*n.h,t._length=n.h*(t.domain[1]-t.domain[0]),t._m=t._length/(l-u),t._b=-t._m*u):(t._offset=n.l+t.domain[0]*n.w,t._length=n.w*(t.domain[1]-t.domain[0]),t._m=t._length/(u-l),t._b=-t._m*l),!isFinite(t._m)||!isFinite(t._b))throw o.notifier("Something went wrong with axis scaling","long"),e._replotting=!1,new Error("axis scaling")},t.makeCalcdata=function(e,r){var n,a,i,o="date"===t.type&&e[r+"calendar"];if(r in e)for(n=e[r],a=new Array(n.length),i=0;i=t.range[0]&&r<=t.range[1]}:function(e){var r=e.y;return r>=t.range[0]&&r<=t.range[1]},t._min=[],t._max=[],t._separators=e.separators,delete t._minDtick,delete t._forceTick0}},{"../../constants/numerical":333,"../../lib":350,"./axis_ids":392,"./constants":394,d3:62,"fast-isnumeric":68}],407:[function(t,e,r){"use strict";function n(t){var e=["showexponent","showtickprefix","showticksuffix"],r=e.filter(function(e){return void 0!==t[e]}),n=function(e){return t[e]===t[r[0]]};if(r.every(n)||1===r.length)return t[r[0]]}var a=t("../../lib");e.exports=function(t,e,r,i,o){var s=n(t);if(r("tickprefix")&&r("showtickprefix",s),r("ticksuffix")&&r("showticksuffix",s),r("showticklabels")){var l=o.font||{},u=e.color===t.color?e.color:l.color;a.coerceFont(r,"tickfont",{family:l.family,size:l.size,color:u}),r("tickangle"),"category"!==i&&(r("tickformat")||"date"===i||(r("showexponent",s),r("exponentformat"),r("separatethousands")))}"category"===i||o.noHover||r("hoverformat")}},{"../../lib":350}],408:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("./layout_attributes");e.exports=function(t,e,r,i){var o=n.coerce2(t,e,a,"ticklen"),s=n.coerce2(t,e,a,"tickwidth"),l=n.coerce2(t,e,a,"tickcolor",e.color);r("ticks",i.outerTicks||o||s||l?"outside":"")||(delete e.ticklen,delete e.tickwidth,delete e.tickcolor)}},{"../../lib":350,"./layout_attributes":400}],409:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("../../lib"),i=t("../../constants/numerical").ONEDAY;e.exports=function(t,e,r,o){var s="auto";"array"!==t.tickmode||"log"!==o&&"date"!==o||(t.tickmode="auto"),Array.isArray(t.tickvals)?s="array":t.dtick&&(s="linear");var l=r("tickmode",s);if("auto"===l)r("nticks");else if("linear"===l){var u="date"===o?i:1,c=r("dtick",u);if(n(c))e.dtick=c>0?Number(c):u;else if("string"!=typeof c)e.dtick=u;else{var f=c.charAt(0),h=c.substr(1);h=n(h)?Number(h):0,(h<=0||!("date"===o&&"M"===f&&h===Math.round(h)||"log"===o&&"L"===f||"log"===o&&"D"===f&&(1===h||2===h)))&&(e.dtick=u)}var d="date"===o?a.dateTick0(e.calendar):0,p=r("tick0",d);"date"===o?e.tick0=a.cleanDate(p,d):n(p)&&"D1"!==c&&"D2"!==c?e.tick0=Number(p):e.tick0=d}else{var g=r("tickvals");void 0===g?e.tickmode="auto":r("ticktext")}}},{"../../constants/numerical":333,"../../lib":350,"fast-isnumeric":68}],410:[function(t,e,r){"use strict";var n=t("d3"),a=t("../../plotly"),i=t("../../registry"),o=t("../../components/drawing"),s=t("./axes"),l=/((x|y)([2-9]|[1-9][0-9]+)?)axis$/;e.exports=function(t,e,r,u){function c(e,r){function n(e,r,n){for(a=0;a rect").call(o.setTranslate,0,0).call(o.setScale,1,1),t.plot.call(o.setTranslate,e._offset,r._offset).call(o.setScale,1,1);var n=t.plot.select(".scatterlayer").selectAll(".points");n.selectAll(".point").call(o.setPointGroupScale,1,1).call(o.hideOutsideRangePoints,t),n.selectAll(".textpoint").call(o.setTextPointsScale,1,1).call(o.hideOutsideRangePoints,t)}function h(e,r){var n,a,i,s=y[e.xaxis._id],l=y[e.yaxis._id],u=[];if(s){n=t._fullLayout[s.axisName],a=n._r,i=s.to,u[0]=(a[0]*(1-r)+r*i[0]-a[0])/(a[1]-a[0])*e.xaxis._length;var f=a[1]-a[0],h=i[1]-i[0];n.range[0]=a[0]*(1-r)+r*i[0],n.range[1]=a[1]*(1-r)+r*i[1],u[2]=e.xaxis._length*(1-r+r*h/f)}else u[0]=0,u[2]=e.xaxis._length;if(l){n=t._fullLayout[l.axisName],a=n._r,i=l.to,u[1]=(a[1]*(1-r)+r*i[1]-a[1])/(a[0]-a[1])*e.yaxis._length;var d=a[1]-a[0],p=i[1]-i[0];n.range[0]=a[0]*(1-r)+r*i[0],n.range[1]=a[1]*(1-r)+r*i[1],u[3]=e.yaxis._length*(1-r+r*p/d)}else u[1]=0,u[3]=e.yaxis._length;c(e.xaxis,e.yaxis);var g=e.xaxis,v=e.yaxis,b=!!s,x=!!l,_=b?g._length/u[2]:1,w=x?v._length/u[3]:1,A=b?u[0]:0,k=x?u[1]:0,M=b?u[0]/u[2]*g._length:0,T=x?u[1]/u[3]*v._length:0,E=g._offset-M,L=v._offset-T;m._defs.select("#"+e.clipId+"> rect").call(o.setTranslate,A,k).call(o.setScale,1/_,1/w),e.plot.call(o.setTranslate,E,L).call(o.setScale,_,w).selectAll(".points").selectAll(".point").call(o.setPointGroupScale,1/_,1/w),e.plot.selectAll(".points").selectAll(".textpoint").call(o.setTextPointsScale,1/_,1/w)}function d(){for(var e={},r=0;rr.duration?(d(),k=window.cancelAnimationFrame(g)):k=window.requestAnimationFrame(g)}var m=t._fullLayout,v=[],y=function(t){var e,r,n,a,i,o={};for(e in t)if(r=e.split("."),n=r[0].match(l)){var s=n[1],u=s+"axis";if(a=m[u],i={},Array.isArray(t[e])?i.to=t[e].slice(0):Array.isArray(t[e].range)&&(i.to=t[e].range.slice(0)),!i.to)continue;i.axisName=u,i.length=a._length,v.push(s),o[s]=i}return o}(e),b=Object.keys(y),x=function(t,e,r){var n,a,i,o=t._plots,s=[];for(n in o){var l=o[n];if(-1===s.indexOf(l)){var u=l.xaxis._id,c=l.yaxis._id,f=l.xaxis.range,h=l.yaxis.range;l.xaxis._r=l.xaxis.range.slice(),l.yaxis._r=l.yaxis.range.slice(),a=r[u]?r[u].to:f,i=r[c]?r[c].to:h,f[0]===a[0]&&f[1]===a[1]&&h[0]===i[0]&&h[1]===i[1]||-1===e.indexOf(u)&&-1===e.indexOf(c)||s.push(l)}}return s}(m,b,y);if(!x.length)return function(){function e(e,r,n){for(var a=0;a0?".":"")+a;u.isPlainObject(i)?s(i,e,o,n+1):e(o,a,i)}})}var l=t("../plotly"),u=t("../lib");r.manageCommandObserver=function(t,e,a,i){var o={},s=!0;e&&e._commandObserver&&(o=e._commandObserver),o.cache||(o.cache={}),o.lookupTable={};var l=r.hasSimpleAPICommandBindings(t,a,o.lookupTable);if(e&&e._commandObserver){if(l)return o;if(e._commandObserver.remove)return e._commandObserver.remove(),e._commandObserver=null,o}if(l){n(t,l,o.cache),o.check=function(){if(s){var e=n(t,l,o.cache);return e.changed&&i&&void 0!==o.lookupTable[e.value]&&(o.disable(),Promise.resolve(i({value:e.value,type:l.type,prop:l.prop,traces:l.traces,index:o.lookupTable[e.value]})).then(o.enable,o.enable)),e.changed}};for(var c=["plotly_relayout","plotly_redraw","plotly_restyle","plotly_update","plotly_animatingframe","plotly_afterplot"],f=0;fMath.abs(u)?(f.boxEnd[1]=f.boxStart[1]+Math.abs(s)*w*(u>=0?1:-1),f.boxEnd[1]h[3]&&(f.boxEnd[1]=h[3],f.boxEnd[0]=f.boxStart[0]+(h[3]-f.boxStart[1])/Math.abs(w))):(f.boxEnd[0]=f.boxStart[0]+Math.abs(u)/w*(s>=0?1:-1),f.boxEnd[0]h[2]&&(f.boxEnd[0]=h[2],f.boxEnd[1]=f.boxStart[1]+(h[2]-f.boxStart[0])*Math.abs(w)))}}else f.boxEnabled?(s=f.boxStart[0]!==f.boxEnd[0],u=f.boxStart[1]!==f.boxEnd[1],s||u?(s&&(o(0,f.boxStart[0],f.boxEnd[0]),t.xaxis.autorange=!1),u&&(o(1,f.boxStart[1],f.boxEnd[1]),t.yaxis.autorange=!1),t.relayoutCallback()):t.glplot.setDirty(),f.boxEnabled=!1,f.boxInited=!1):f.boxInited&&(f.boxInited=!1);break;case"pan":f.boxEnabled=!1,f.boxInited=!1,n?(f.panning||(f.dragStart[0]=a,f.dragStart[1]=i),Math.abs(f.dragStart[0]-a)h[p+2]&&(h[p]=-1,h[p+2]=1),d=this[_[p]],d._length=o.viewBox[p+2]-o.viewBox[p],l.doAutoRange(d),d.setScale();b(s),o.ticks=this.computeTickMarks(),o.dataBox=this.calcDataBox(),o.merge(r),n.update(o),this.glplot.draw()},w.calcDataBox=function(){var t=this.xaxis,e=this.yaxis,r=t.range,n=e.range,a=t.r2l,i=e.r2l;return[a(r[0]),i(n[0]),a(r[1]),i(n[1])]},w.setRanges=function(t){var e=this.xaxis,r=this.yaxis,n=e.l2r,a=r.l2r;e.range=[n(t[0]),n(t[2])],r.range=[a(t[1]),a(t[3])]},w.updateTraces=function(t,e){var r,n,a,i=Object.keys(this.traces);this.fullData=t;t:for(r=0;r=e.width-20?(i["text-anchor"]="start",i.x=5):(i["text-anchor"]="end",i.x=e._paper.attr("width")-7),r.attr(i);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&&n(t,o),s.text(o.text()&&u.text()?" - ":"")}},m.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"});return n.append("input").attr({type:"text",name:"data"}).node().value=m.graphJson(t,!1,"keepdata"),n.node().submit(),r.remove(),t.emit("plotly_afterexport"),!1},m.supplyDefaults=function(t){var e,r=t._fullLayout||{},n=t._fullLayout={},i=t.layout||{},o=t._fullData||[],s=t._fullData=[],l=t.data||[];if(t._transitionData||m.createTransitionData(t),r._initialAutoSizeIsDone){var u=r.width,f=r.height;m.supplyLayoutGlobalDefaults(i,n),i.width||(n.width=u),i.height||(n.height=f)}else{m.supplyLayoutGlobalDefaults(i,n);var h=!i.width||!i.height,d=n.autosize,p=t._context&&t._context.autosizable;h&&(d||p)?m.plotAutoSize(t,i,n):h&&m.sanitizeMargins(t),!d&&h&&(i.width=n.width,i.height=n.height)}n._initialAutoSizeIsDone=!0,n._dataLength=l.length,n._globalTransforms=(t._context||{}).globalTransforms,m.supplyDataDefaults(l,s,i,n),n._has=m._hasPlotType.bind(n);var g=n._modules;for(e=0;e0){var c=o(t._boundingBoxMargins),f=c.left+c.right,h=c.bottom+c.top,p=1-2*s,g=r._container&&r._container.node?r._container.node().getBoundingClientRect():{width:r.width,height:r.height};n=Math.round(p*(g.width-f)),a=Math.round(p*(g.height-h))}else{var v=l?window.getComputedStyle(t):{};n=parseFloat(v.width)||r.width,a=parseFloat(v.height)||r.height}var y=m.layoutAttributes.width.min,b=m.layoutAttributes.height.min;n1,_=!e.height&&Math.abs(r.height-a)>1;(_||x)&&(x&&(r.width=n),_&&(r.height=a)),t._initialAutoSize||(t._initialAutoSize={width:n,height:a}),m.sanitizeMargins(r)},m.supplyLayoutModuleDefaults=function(t,e,r,n){var a,i;c.Axes.supplyLayoutDefaults(t,e,r);var o=e._basePlotModules;for(a=0;a.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+a},r:{val:r.x,size:r.r+a},b:{val:r.y,size:r.b+a},t:{val:r.y,size:r.t+a}}}else delete n._pushmargin[e];n._replotting||m.doAutoMargin(t)}},m.doAutoMargin=function(t){var e=t._fullLayout;e._size||(e._size={}),e._pushmargin||(e._pushmargin={});var r=e._size,n=JSON.stringify(r),a=Math.max(e.margin.l||0,0),i=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;if(!1!==e.margin.autoexpand){l.base={l:{val:0,size:a},r:{val:1,size:i},t:{val:1,size:o},b:{val:0,size:s}};for(var f=Object.keys(l),h=0;hm){var k=(v*w+(A-e.width)*m)/(w-m),M=(A*(1-m)+(v-e.width)*(1-w))/(w-m);k>=0&&M>=0&&k+M>a+i&&(a=k,i=M)}}if(u(b)&&l[_].t){var T=l[_].t.val,E=l[_].t.size;if(T>y){var L=(b*T+(E-e.height)*y)/(T-y),S=(E*(1-y)+(b-e.height)*(1-T))/(T-y);L>=0&&S>=0&&L+S>s+o&&(s=L,o=S)}}}}if(r.l=Math.round(a),r.r=Math.round(i),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,!e._replotting&&"{}"!==n&&n!==JSON.stringify(e._size))return c.plot(t)},m.graphJson=function(t,e,r,n,a){function i(t){if("function"==typeof t)return null;if(d.isPlainObject(t)){var e,n,a={};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("string"==typeof(n=t[e+"src"])&&n.indexOf(":")>0&&!d.isPlainObject(t.stream))continue}else if("keepall"!==r&&"string"==typeof(n=t[e+"src"])&&n.indexOf(":")>0)continue;a[e]=i(t[e])}return a}return Array.isArray(t)?t.map(i):d.isJSDate(t)?d.ms2DateTimeLocal(+t):t}(a&&e&&!t._fullData||a&&!e&&!t._fullLayout)&&m.supplyDefaults(t);var o=a?t._fullData:t.data,s=a?t._fullLayout:t.layout,l=(t._transitionData||{})._frames,u={data:(o||[]).map(function(t){var r=i(t);return e&&delete r.fit,r})};return e||(u.layout=i(s)),t.framework&&t.framework.isPolar&&(u=t.framework.getConfig()),l&&(u.frames=i(l)),"object"===n?u:JSON.stringify(u)},m.modifyFrames=function(t,e){var r,n,a,i=t._transitionData._frames,o=t._transitionData._frameHash;for(r=0;r0&&(t._transitioningWithDuration=!0),t._transitionData._interruptCallbacks.push(function(){x=!0}),a.redraw&&t._transitionData._interruptCallbacks.push(function(){return c.redraw(t)}),t._transitionData._interruptCallbacks.push(function(){t.emit("plotly_transitioninterrupted",[])});var o,s,l=0,u=0,h=t._fullLayout._basePlotModules,p=!1;if(r)for(s=0;s=0,S=L?h.angularAxis.domain:n.extent(k),C=Math.abs(k[1]-k[0]);T&&!M&&(C=0);var O=S.slice();E&&M&&(O[1]+=C);var I=h.angularAxis.ticksCount||4;I>8&&(I=I/(I/8)+I%8),h.angularAxis.ticksStep&&(I=(O[1]-O[0])/I);var R=h.angularAxis.ticksStep||(O[1]-O[0])/(I*(h.minorTicks+1));A&&(R=Math.max(Math.round(R),1)),O[2]||(O[2]=R);var D=n.range.apply(this,O);if(D=D.map(function(t,e){return parseFloat(t.toPrecision(12))}),l=n.scale.linear().domain(O.slice(0,2)).range("clockwise"===h.direction?[0,360]:[360,0]),f.layout.angularAxis.domain=l.domain(),f.layout.angularAxis.endPadding=E?C:0,void 0===(e=n.select(this).select("svg.chart-root"))||e.empty()){var P=(new DOMParser).parseFromString("' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '","application/xml"),z=this.appendChild(this.ownerDocument.importNode(P.documentElement,!0));e=n.select(z)}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,F=e.select(".chart-group"),B={fill:"none",stroke:h.tickColor},j={"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){N=e.select(".legend-group").attr({transform:"translate("+[x,h.margin.top]+")"}).style({display:"block"});var H=p.map(function(t,e){var r=s.util.cloneJson(t);return r.symbol="DotPlot"===t.geometry?t.dotType||"circle":"LinePlot"!=t.geometry?"square":"line",r.visibleInLegend=void 0===t.visibleInLegend||t.visibleInLegend,r.color="LinePlot"===t.geometry?t.strokeColor:t.color,r});s.Legend().config({data:p.map(function(t,e){return t.name||"Element"+e}),legendConfig:i({},s.Legend.defaultConfig().legendConfig,{container:N,elements:H,reverseOrder:h.legend.reverseOrder})})();var U=N.node().getBBox();x=Math.min(h.width-U.width-h.margin.left-h.margin.right,h.height-h.margin.top-h.margin.bottom)/2,x=Math.max(10,x),w=[h.margin.left+x,h.margin.top+x],a.range([0,x]),f.layout.radialAxis.domain=a.domain(),N.attr("transform","translate("+[w[0]+x,w[1]-x]+")")}else N=e.select(".legend-group").style({display:"none"});e.attr({width:h.width,height:h.height}).style({opacity:h.opacity}),F.attr("transform","translate("+w+")").style({cursor:"crosshair"});var V=[(h.width-(h.margin.left+h.margin.right+2*x+(U?U.width:0)))/2,(h.height-(h.margin.top+h.margin.bottom+2*x))/2];if(V[0]=Math.max(0,V[0]),V[1]=Math.max(0,V[1]),e.select(".outer-group").attr("transform","translate("+V+")"),h.title){var G=e.select("g.title-group text").style(j).text(h.title),q=G.node().getBBox();G.attr({x:w[0]-q.width/2,y:w[1]-x-20})}var X=e.select(".radial.axis-group");if(h.radialAxis.gridLinesVisible){var Y=X.selectAll("circle.grid-circle").data(a.ticks(5));Y.enter().append("circle").attr({class:"grid-circle"}).style(B),Y.attr("r",a),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:h.backgroundColor,stroke:h.stroke});if(h.radialAxis.visible){var Z=n.svg.axis().scale(a).ticks(5).tickSize(5);X.call(Z).attr({transform:"rotate("+h.radialAxis.orientation+")"}),X.selectAll(".domain").style(B),X.selectAll("g>text").text(function(t,e){return this.textContent+h.radialAxis.ticksSuffix}).style(j).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,j["font-size"]]+")":"translate("+[0,j["font-size"]]+")"}}),X.selectAll("g>line").style({stroke:"black"})}var Q=e.select(".angular.axis-group").selectAll("g.angular-tick").data(D),$=Q.enter().append("g").classed("angular-tick",!0);Q.attr({transform:function(t,e){return"rotate("+u(t,e)+")"}}).style({display:h.angularAxis.visible?"block":"none"}),Q.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}),Q.select("line.grid-line").attr({x1:h.tickLength?x-h.tickLength:0,x2:x}).style({display:h.angularAxis.gridLinesVisible?"block":"none"}),$.append("text").classed("axis-text",!0).style(j);var K=Q.select("text.axis-text").attr({x:x+h.labelOffset,dy:o+"em",transform:function(t,e){var r=u(t,e),n=x+h.labelOffset,a=h.angularAxis.tickOrientation;return"horizontal"==a?"rotate("+-r+" "+n+" 0)":"radial"==a?r<270&&r>90?"rotate(180 "+n+" 0)":null:"rotate("+(r<=180&&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?"":A?A[t]+h.angularAxis.ticksSuffix:t+h.angularAxis.ticksSuffix}).style(j);h.angularAxis.rewriteTicks&&K.text(function(t,e){return e%(h.minorTicks+1)!=0?"":h.angularAxis.rewriteTicks(this.textContent,e)});var J=n.max(F.selectAll(".angular-tick text")[0].map(function(t,e){return t.getCTM().e+t.getBBox().width}));N.attr({transform:"translate("+[x+J,h.margin.top]+")"});var tt=e.select("g.geometry-group").selectAll("g").size()>0,et=e.select("g.geometry-group").selectAll("g.geometry").data(p);if(et.enter().append("g").attr({class:function(t,e){return"geometry geometry"+e}}),et.exit().remove(),p[0]||tt){var rt=[];p.forEach(function(t,e){var r={};r.radialScale=a,r.angularScale=l,r.container=et.filter(function(t,r){return r==e}),r.geometry=t.geometry,r.orientation=h.orientation,r.direction=h.direction,r.index=e,rt.push({data:t,geometryConfig:r})});var nt=n.nest().key(function(t,e){return void 0!==t.data.groupId||"unstacked"}).entries(rt),at=[];nt.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 i(s[r].defaultConfig(),t)});s[r]().config(n)()})}var it,ot,st=e.select(".guides-group"),lt=e.select(".tooltips-group"),ut=s.tooltipPanel().config({container:lt,fontSize:8})(),ct=s.tooltipPanel().config({container:lt,fontSize:8})(),ft=s.tooltipPanel().config({container:lt,hasTick:!0})();if(!M){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 r=s.util.getMousePos(W).angle;ht.attr({x2:-x,transform:"rotate("+r+")"}).style({opacity:.5});var n=(r+180+360-h.orientation)%360;it=l.invert(n);var a=s.util.convertToCartesian(x+12,r+180);ut.text(s.util.round(it)).move([a[0]+w[0],a[1]+w[1]])}).on("mouseout.angular-guide",function(t,e){st.select("line").style({opacity:0})})}var dt=st.select("circle").style({stroke:"grey",fill:"none"});F.on("mousemove.radial-guide",function(t,e){var r=s.util.getMousePos(W).radius;dt.attr({r:r}).style({opacity:.5}),ot=a.invert(s.util.getMousePos(W).radius);var n=s.util.convertToCartesian(r,h.radialAxis.orientation);ct.text(s.util.round(ot)).move([n[0]+w[0],n[1]+w[1]])}).on("mouseout.radial-guide",function(t,e){dt.style({opacity:0}),ft.hide(),ut.hide(),ct.hide()}),e.selectAll(".geometry-group .mark").on("mouseover.tooltip",function(t,r){var a=n.select(this),i=a.style("fill"),o="black",l=a.style("opacity")||1;if(a.attr({"data-opacity":l}),"none"!=i){a.attr({"data-fill":i}),o=n.hsl(i).darker().toString(),a.style({fill:o,opacity:1});var u={t:s.util.round(t[0]),r:s.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-V[0]-h.left,f.top+f.height/2-V[1]-h.top];ft.config({color:o}).text(c),ft.move(d)}else i=a.style("stroke"),a.attr({"data-stroke":i}),o=n.hsl(i).darker().toString(),a.style({stroke:o,opacity:1})}).on("mousemove.tooltip",function(t,e){if(0!=n.event.which)return!1;n.select(this).attr("data-fill")&&ft.show()}).on("mouseout.tooltip",function(t,e){ft.hide();var r=n.select(this),a=r.attr("data-fill");a?r.style({fill:a,opacity:r.attr("data-opacity")}):r.style({stroke:r.attr("data-stroke"),opacity:r.attr("data-opacity")})})}),d}var e,r,a,l,u={data:[],layout:{}},c={},f={},h=n.dispatch("hover"),d={};return d.render=function(e){return t(e),this},d.config=function(t){if(!arguments.length)return u;var e=s.util.cloneJson(t);return e.data.forEach(function(t,e){u.data[e]||(u.data[e]={}),i(u.data[e],s.Axis.defaultConfig().data[0]),i(u.data[e],t)}),i(u.layout,s.Axis.defaultConfig().layout),i(u.layout,e.layout),this},d.getLiveConfig=function(){return f},d.getinputConfig=function(){return c},d.radialScale=function(t){return a},d.angularScale=function(t){return l},d.svg=function(){return e},n.rebind(d,h,"on"),d},s.Axis.defaultConfig=function(t,e){return{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:n.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}}},s.util={},s.DATAEXTENT="dataExtent",s.AREA="AreaChart",s.LINE="LinePlot",s.DOT="DotPlot",s.BAR="BarChart",s.util._override=function(t,e){for(var r in t)r in e&&(e[r]=t[r])},s.util._extend=function(t,e){for(var r in t)e[r]=t[r]},s.util._rndSnd=function(){return 2*Math.random()-1+(2*Math.random()-1)+(2*Math.random()-1)},s.util.dataFromEquation2=function(t,e){var r=e||6;return n.range(0,360+r,r).map(function(e,r){var n=e*Math.PI/180;return[e,t(n)]})},s.util.dataFromEquation=function(t,e,r){var a=e||6,i=[],o=[];n.range(0,360+a,a).forEach(function(e,r){var n=e*Math.PI/180,a=t(n);i.push(e),o.push(a)});var s={t:i,r:o};return r&&(s.name=r),s},s.util.ensureArray=function(t,e){if(void 0===t)return null;var r=[].concat(t);return n.range(e).map(function(t,e){return r[e]||r[0]})},s.util.fillArrays=function(t,e,r){return e.forEach(function(e,n){t[e]=s.util.ensureArray(t[e],r)}),t},s.util.cloneJson=function(t){return JSON.parse(JSON.stringify(t))},s.util.validateKeys=function(t,e){"string"==typeof e&&(e=e.split("."));var r=e.shift();return t[r]&&(!e.length||objHasKeys(t[r],e))},s.util.sumArrays=function(t,e){return n.zip(t,e).map(function(t,e){return n.sum(t)})},s.util.arrayLast=function(t){return t[t.length-1]},s.util.arrayEqual=function(t,e){for(var r=Math.max(t.length,e.length,1);r-- >=0&&t[r]===e[r];);return-2===r},s.util.flattenArray=function(t){for(var e=[];!s.util.arrayEqual(e,t);)e=t,t=[].concat.apply([],t);return t},s.util.deduplicate=function(t){return t.filter(function(t,e,r){return r.indexOf(t)==e})},s.util.convertToCartesian=function(t,e){var r=e*Math.PI/180;return[t*Math.cos(r),t*Math.sin(r)]},s.util.round=function(t,e){var r=e||2,n=Math.pow(10,r);return Math.round(t*n)/n},s.util.getMousePos=function(t){var e=n.mouse(t.node()),r=e[0],a=e[1],i={};return i.x=r,i.y=a,i.pos=e,i.angle=180*(Math.atan2(a,r)+Math.PI)/Math.PI,i.radius=Math.sqrt(r*r+a*a),i},s.util.duplicatesCount=function(t){for(var e,r={},n={},a=0,i=t.length;a0)){var s=n.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 m.fill(r,a,i)},"fill-opacity":0,stroke:function(t,e){return m.stroke(r,a,i)},"stroke-width":function(t,e){return m["stroke-width"](r,a,i)},"stroke-dasharray":function(t,e){return m["stroke-dasharray"](r,a,i)},opacity:function(t,e){return m.opacity(r,a,i)},display:function(t,e){return m.display(r,a,i)}})}};var d=t.angularScale.range(),p=Math.abs(d[1]-d[0])/l[0].length*Math.PI/180,g=n.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,a){n.select(this).attr({class:"mark arc",d:g,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 a[e[n].data.strokeDash]},opacity:function(t,r,n){return e[n].data.opacity},display:function(t,r,n){return void 0===e[n].data.visible||e[n].data.visible?"block":"none"}},v=n.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(m).each(f[t.geometryType]),y.exit().remove(),v.exit().remove()})}var e=[s.PolyChart.defaultConfig()],r=n.dispatch("hover"),a={solid:"none",dash:[5,2],dot:[2,5]};return t.config=function(t){return arguments.length?(t.forEach(function(t,r){e[r]||(e[r]={}),i(e[r],s.PolyChart.defaultConfig()),i(e[r],t)}),this):e},t.getColorScale=function(){},n.rebind(t,r,"on"),t},s.PolyChart.defaultConfig=function(){return{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:n.scale.category20()}}},s.BarChart=function(){return s.PolyChart()},s.BarChart.defaultConfig=function(){return{geometryConfig:{geometryType:"bar"}}},s.AreaChart=function(){return s.PolyChart()},s.AreaChart.defaultConfig=function(){return{geometryConfig:{geometryType:"arc"}}},s.DotPlot=function(){return s.PolyChart()},s.DotPlot.defaultConfig=function(){return{geometryConfig:{geometryType:"dot",dotType:"circle"}}},s.LinePlot=function(){return s.PolyChart()},s.LinePlot.defaultConfig=function(){return{geometryConfig:{geometryType:"line"}}},s.Legend=function(){function t(){var r=e.legendConfig,a=e.data.map(function(t,e){return[].concat(t).map(function(t,n){var a=i({},r.elements[e]);return a.name=t,a.color=[].concat(r.elements[e].color)[n],a})}),o=n.merge(a);o=o.filter(function(t,e){return r.elements[e]&&(r.elements[e].visibleInLegend||void 0===r.elements[e].visibleInLegend)}),r.reverseOrder&&(o=o.reverse());var s=r.container;("string"==typeof s||s.nodeName)&&(s=n.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=n.range(o.length),m=n.scale[c?"linear":"ordinal"]().domain(g).range(l),v=n.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!=n.svg.symbolTypes.indexOf(t)?n.svg.symbol().type(t).size(r)():n.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,v(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 _=n.svg.axis().scale(v).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=s.Legend.defaultConfig(),r=n.dispatch("hover");return t.config=function(t){return arguments.length?(i(e,t),this):e},n.rebind(t,r,"on"),t},s.Legend.defaultConfig=function(t,e){return{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}}},s.tooltipPanel=function(){var t,e,r,a={container:null,hasTick:!1,fontSize:12,color:"white",padding:5},o="tooltip-"+s.tooltipPanel.uid++,l=function(){t=a.container.selectAll("g."+o).data([0]);var n=t.enter().append("g").classed(o,!0).style({"pointer-events":"none",display:"none"});return r=n.append("path").style({fill:"white","fill-opacity":.9}).attr({d:"M0 0"}),e=n.append("text").attr({dx:a.padding+10,dy:.3*+a.fontSize}),l};return l.text=function(i){var o=n.hsl(a.color).l,s=o>=.5?"#aaa":"white",u=o>=.5?"black":"white",c=i||"";e.style({fill:u,"font-size":a.fontSize+"px"}).text(c);var f=a.padding,h=e.node().getBBox(),d={fill:a.color,stroke:s,"stroke-width":"2px"},p=h.width+2*f+10,g=h.height+2*f;return r.attr({d:"M"+[[10,-g/2],[10,-g/4],[a.hasTick?0:10,0],[10,g/4],[10,g/2],[p,g/2],[p,-g/2]].join("L")+"Z"}).style(d),t.attr({transform:"translate("+[10,-g/2+2*f]+")"}),t.style({display:"block"}),l},l.move=function(e){if(t)return t.attr({transform:"translate("+[e[0],e[1]]+")"}).style({display:"block"}),l},l.hide=function(){if(t)return t.style({display:"none"}),l},l.show=function(){if(t)return t.style({display:"block"}),l},l.config=function(t){return i(a,t),l},l},s.tooltipPanel.uid=1,s.adapter={},s.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=i({},t);return[[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"]]].forEach(function(t,r){s.util.translator.apply(null,t.concat(e))}),e||delete n.marker,e&&delete n.groupId,e?("LinePlot"===n.geometry?(n.type="scatter",!0===n.dotVisible?(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 a=s.util.duplicates(r.data.map(function(t,e){return t.geometry}));r.data.forEach(function(t,e){var n=a.indexOf(t.geometry);-1!=n&&(r.data[e].groupId=n)})}if(t.layout){var o=i({},t.layout);if([[o,["plot_bgcolor"],["backgroundColor"]],[o,["showlegend"],["showLegend"]],[o,["radialaxis"],["radialAxis"]],[o,["angularaxis"],["angularAxis"]],[o.angularaxis,["showline"],["gridLinesVisible"]],[o.angularaxis,["showticklabels"],["labelsVisible"]],[o.angularaxis,["nticks"],["ticksCount"]],[o.angularaxis,["tickorientation"],["tickOrientation"]],[o.angularaxis,["ticksuffix"],["ticksSuffix"]],[o.angularaxis,["range"],["domain"]],[o.angularaxis,["endpadding"],["endPadding"]],[o.radialaxis,["showline"],["gridLinesVisible"]],[o.radialaxis,["tickorientation"],["tickOrientation"]],[o.radialaxis,["ticksuffix"],["ticksSuffix"]],[o.radialaxis,["range"],["domain"]],[o.angularAxis,["showline"],["gridLinesVisible"]],[o.angularAxis,["showticklabels"],["labelsVisible"]],[o.angularAxis,["nticks"],["ticksCount"]],[o.angularAxis,["tickorientation"],["tickOrientation"]],[o.angularAxis,["ticksuffix"],["ticksSuffix"]],[o.angularAxis,["range"],["domain"]],[o.angularAxis,["endpadding"],["endPadding"]],[o.radialAxis,["showline"],["gridLinesVisible"]],[o.radialAxis,["tickorientation"],["tickOrientation"]],[o.radialAxis,["ticksuffix"],["ticksSuffix"]],[o.radialAxis,["range"],["domain"]],[o.font,["outlinecolor"],["outlineColor"]],[o.legend,["traceorder"],["reverseOrder"]],[o,["labeloffset"],["labelOffset"]],[o,["defaultcolorrange"],["defaultColorRange"]]].forEach(function(t,r){s.util.translator.apply(null,t.concat(e))}),e?(void 0!==o.tickLength&&(o.angularaxis.ticklen=o.tickLength,delete o.tickLength),o.tickColor&&(o.angularaxis.tickcolor=o.tickColor,delete o.tickColor)):(o.angularAxis&&void 0!==o.angularAxis.ticklen&&(o.tickLength=o.angularAxis.ticklen),o.angularAxis&&void 0!==o.angularAxis.tickcolor&&(o.tickColor=o.angularAxis.tickcolor)),o.legend&&"boolean"!=typeof o.legend.reverseOrder&&(o.legend.reverseOrder="normal"!=o.legend.reverseOrder),o.legend&&"boolean"==typeof o.legend.traceorder&&(o.legend.traceorder=o.legend.traceorder?"reversed":"normal",delete o.legend.reverseOrder),o.margin&&void 0!==o.margin.t){var l=["t","r","b","l","pad"],u=["top","right","bottom","left","pad"],c={};n.entries(o.margin).forEach(function(t,e){c[u[l.indexOf(t.key)]]=t.value}),o.margin=c}e&&(delete o.needsEndSpacing,delete o.minorTickColor,delete o.minorTicks,delete o.angularaxis.ticksCount,delete o.angularaxis.ticksCount,delete o.angularaxis.ticksStep,delete o.angularaxis.rewriteTicks,delete o.angularaxis.nticks,delete o.radialaxis.ticksCount,delete o.radialaxis.ticksCount,delete o.radialaxis.ticksStep,delete o.radialaxis.rewriteTicks,delete o.radialaxis.nticks),r.layout=o}return r},t}},{"../../constants/alignment":329,"../../lib":350,d3:62}],427:[function(t,e,r){"use strict";var n=t("d3"),a=t("../../lib"),i=t("../../components/color"),o=t("./micropolar"),s=t("./undo_manager"),l=a.extendDeepAll,u=e.exports={};u.framework=function(t){function e(e,a){return a&&(f=a),n.select(n.select(f).node().parentNode).selectAll(".svg-container>*:not(.chart-root)").remove(),r=r?l(r,e):e,i||(i=o.Axis()),c=o.adapter.plotly().convert(r),i.config(c).render(f),t.data=r.data,t.layout=r.layout,u.fillLayout(t),r}var r,a,i,c,f,h=new s;return e.isPolar=!0,e.svg=function(){return i.svg()},e.getConfig=function(){return r},e.getLiveConfig=function(){return o.adapter.plotly().convert(i.getLiveConfig(),!0)},e.getLiveScales=function(){return{t:i.angularScale(),r:i.radialScale()}},e.setUndoPoint=function(){var t=this,e=o.util.cloneJson(r);!function(e,r){h.add({undo:function(){r&&t(r)},redo:function(){t(e)}})}(e,a),a=o.util.cloneJson(e)},e.undo=function(){h.undo()},e.redo=function(){h.redo()},e},u.fillLayout=function(t){var e=n.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:i.background,_container:e,_paperdiv:r,_paper:a};t._fullLayout=l(o,t.layout)}},{"../../components/color":233,"../../lib":350,"./micropolar":426,"./undo_manager":428,d3:62}],428:[function(t,e,r){"use strict";e.exports=function(){function t(t,e){return t?(a=!0,t[e](),a=!1,this):this}var e,r=[],n=-1,a=!1;return{add:function(t){return a?this:(r.splice(n+1,r.length-n),r.push(t),n=r.length-1,this)},setCallback:function(t){e=t},undo:function(){var a=r[n];return a?(t(a,"undo"),n-=1,e&&e(a.undo),this):this},redo:function(){var a=r[n+1];return a?(t(a,"redo"),n+=1,e&&e(a.redo),this):this},clear:function(){r=[],n=-1},hasUndo:function(){return-1!==n},hasRedo:function(){return n-1}var i=t("../lib"),o=t("../plots/plots"),s=i.extendFlat,l=i.extendDeep;e.exports=function(t,e){t.framework&&t.framework.isPolar&&(t=t.framework.getConfig());var r,i=t.data,u=t.layout,c=l([],i),f=l({},u,n(e.tileClass)),h=t._context||{};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(r=0;r")?"":e.html(t).text()});return e.remove(),r}function a(t){return t.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g,"&")}var i=t("d3"),o=t("../components/drawing"),s=t("../components/color"),l=t("../constants/xmlns_namespaces"),u=/"/g,c=new RegExp('("TOBESTRIPPED)|(TOBESTRIPPED")',"g");e.exports=function(t,e){var r,f=t._fullLayout,h=f._paper,d=f._toppaper;h.insert("rect",":first-child").call(o.setRect,0,0,f.width,f.height).call(s.fill,f.paper_bgcolor);var p=f._basePlotModules||[];for(r=0;rs.end&&(s.start=s.end=(s.start+s.end)/2),e._input.contours||(e._input.contours={}),i(e._input.contours,{start:s.start,end:s.end,size:s.size}),e._input.autocontour=!0}else{var u=s.start,c=s.end,f=e._input.contours;if(u>c&&(s.start=f.start=c,c=s.end=f.end=u,u=s.start),!(s.size>0)){var h;h=u===c?1:n(u,c,e.ncontours).dtick,f.size=s.size=h}}return r}},{"../../lib":350,"../../plots/cartesian/axes":389,"../heatmap/calc":449}],440:[function(t,e,r){"use strict";var n=t("../../plots/plots"),a=t("../../components/colorbar/draw"),i=t("./make_color_map"),o=t("./end_plus");e.exports=function(t,e){var r=e[0].trace,s="cb"+r.uid;if(t._fullLayout._infolayer.selectAll("."+s).remove(),!r.showscale)return void n.autoMargin(t,s);var l=a(t,s);e[0].t.cb=l;var u=r.contours,c=r.line,f=u.size||1,h=u.coloring,d=i(r,{isColorbar:!0});"heatmap"===h&&l.filllevels({start:r.zmin,end:r.zmax,size:(r.zmax-r.zmin)/254}),l.fillcolor("fill"===h||"heatmap"===h?d:"").line({color:"lines"===h?d:c.color,width:!1!==u.showlines?c.width:0,dash:c.dash}).levels({start:u.start,end:o(u),size:f}).options(r.colorbar)()}},{"../../components/colorbar/draw":236,"../../plots/plots":422,"./end_plus":443,"./make_color_map":444}],441:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("./attributes");e.exports=function(t,e,r){var i,o=n.coerce2(t,e,a,"contours.start"),s=n.coerce2(t,e,a,"contours.end"),l=!1===o||!1===s,u=r("contours.size");!(i=l?e.autocontour=!0:r("autocontour",!1))&&u||r("ncontours")}},{"../../lib":350,"./attributes":438}],442:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("../heatmap/has_columns"),i=t("../heatmap/xyz_defaults"),o=t("./contours_defaults"),s=t("./style_defaults"),l=t("./attributes");e.exports=function(t,e,r,u){function c(r,a){return n.coerce(t,e,l,r,a)}if(!i(t,e,c,u))return void(e.visible=!1);c("text"),c("connectgaps",a(e)),o(t,e,c),s(t,e,c,u)}},{"../../lib":350,"../heatmap/has_columns":455,"../heatmap/xyz_defaults":459,"./attributes":438,"./contours_defaults":441,"./style_defaults":445}],443:[function(t,e,r){"use strict";e.exports=function(t){return t.end+t.size/1e6}},{}],444:[function(t,e,r){"use strict";var n=t("d3"),a=t("../../components/colorscale"),i=t("./end_plus");e.exports=function(t){var e=t.contours,r=e.start,o=i(e),s=e.size||1,l=Math.floor((o-r)/s)+1,u="lines"===e.coloring?0:1;isFinite(s)||(s=1,l=1);var c,f,h=t.colorscale,d=h.length,p=new Array(d),g=new Array(d);if("heatmap"===e.coloring){for(t.zauto&&!1===t.autocontour&&(t.zmin=r-s/2,t.zmax=t.zmin+l*s),f=0;fO){r("x scale is not linear");break}}if(y.length&&"fast"===L){var I=(y[y.length-1]-y[0])/(y.length-1),R=Math.abs(I/100);for(w=0;wR){r("y scale is not linear");break}}}var D=c(_),P="scaled"===e.xtype?"":g,z=p(e,P,m,v,D,A),N="scaled"===e.ytype?"":y,F=p(e,N,b,x,_.length,k);E||(i.expand(A,z),i.expand(k,F));var B={x:z,y:F,z:_,text:e.text};if(s(e,_,"","z"),M&&e.contours&&"heatmap"===e.contours.coloring){var j={type:"contour"===e.type?"heatmap":"histogram2d",xcalendar:e.xcalendar,ycalendar:e.ycalendar};B.xfill=p(j,P,m,v,D,A),B.yfill=p(j,N,b,x,_.length,k)}return[B]}},{"../../components/colorscale/calc":239,"../../lib":350,"../../plots/cartesian/axes":389,"../../registry":429,"../histogram2d/calc":467,"./clean_2d_array":450,"./convert_column_xyz":452,"./find_empties":454,"./has_columns":455,"./interp2d":456,"./make_bound_array":457,"./max_row_length":458}],450:[function(t,e,r){"use strict";var n=t("fast-isnumeric");e.exports=function(t,e){var r,a,i,o,s,l;if(e){for(r=0,s=0;s=0;o--)i=h[o],r=i[0],a=i[1],(s=((f[[r-1,a]]||g)[2]+(f[[r+1,a]]||g)[2]+(f[[r,a-1]]||g)[2]+(f[[r,a+1]]||g)[2])/20)&&(l[i]=[r,a,s],h.splice(o,1),u=!0);if(!u)throw"findEmpties iterated with no new neighbors";for(i in l)f[i]=l[i],c.push(l[i])}return c.sort(function(t,e){return e[2]-t[2]})}},{"./max_row_length":458}],455:[function(t,e,r){"use strict";e.exports=function(t){return!Array.isArray(t.z[0])}},{}],456:[function(t,e,r){"use strict";function n(t){return.5-.25*Math.min(1,.5*t)}function a(t,e,r){var n,a,i,s,l,u,c,f,h,d,p,g,m,v=0;for(s=0;sg&&(v=Math.max(v,Math.abs(t[a][i]-p)/(m-g))))}return v}var i=t("../../lib"),o=[[-1,0],[1,0],[0,-1],[0,1]];e.exports=function(t,e,r){var o,s,l=1;if(Array.isArray(r))for(o=0;o.01;o++)l=a(t,e,n(l));return l>.01&&i.log("interp2d didn't converge quickly",l),t}},{"../../lib":350}],457:[function(t,e,r){"use strict";var n=t("../../registry");e.exports=function(t,e,r,a,i,o){var s,l,u,c=[],f=n.traceIs(t,"contour"),h=n.traceIs(t,"histogram"),d=n.traceIs(t,"gl2d");if(Array.isArray(e)&&e.length>1&&!h&&"category"!==o.type){var p=e.length;if(!(p<=i))return f?e.slice(0,i):e.slice(0,i+1);if(f||d)c=e.slice(0,i);else if(1===i)c=[e[0]-.5,e[0]+.5];else{for(c=[1.5*e[0]-.5*e[1]],u=1;u0&&(n=!0);for(var s=0;si){var o=i-r[t];return r[t]=i,o}}return 0},max:function(t,e,r,a){var i=a[e];if(n(i)){if(i=Number(i),!n(r[t]))return r[t]=i,i;if(r[t]0?Number(h):f;else if("string"!=typeof h)u.size=f;else{var d=h.charAt(0),p=h.substr(1);p=n(p)?Number(p):0,(p<=0||"date"!==i||"M"!==d||p!==Math.round(p))&&(u.size=f)}var g="autobin"+r;"boolean"!=typeof t[g]&&(t[g]=!((u.start||0===u.start)&&(u.end||0===u.end))),t[g]||delete t["nbins"+r]}},{"../../constants/numerical":333,"../../lib":350,"fast-isnumeric":68}],466:[function(t,e,r){"use strict";e.exports={percent:function(t,e){for(var r=t.length,n=100/e,a=0;ak&&g.splice(k,g.length-k),v.length>k&&v.splice(k,v.length-k), +!e.autobinx&&e.xbins&&null!==e.xbins.start&&null!==e.xbins.end||(e.xbins=a.autoBin(g,p,e.nbinsx,"2d",y),"histogram2dcontour"===e.type&&(e.xbins.start=w(a.tickIncrement(x(e.xbins.start),e.xbins.size,!0,y)),e.xbins.end=w(a.tickIncrement(x(e.xbins.end),e.xbins.size,!1,y))),e._input.xbins=e.xbins,e._input.autobinx=e.autobinx),!e.autobiny&&e.ybins&&null!==e.ybins.start&&null!==e.ybins.end||(e.ybins=a.autoBin(v,m,e.nbinsy,"2d",b),"histogram2dcontour"===e.type&&(e.ybins.start=A(a.tickIncrement(_(e.ybins.start),e.ybins.size,!0,b)),e.ybins.end=A(a.tickIncrement(_(e.ybins.end),e.ybins.size,!1,b))),e._input.ybins=e.ybins,e._input.autobiny=e.autobiny),h=[];var M,T,E=[],L=[],S="string"==typeof e.xbins.size,C="string"==typeof e.ybins.size,O=S?[]:e.xbins,I=C?[]:e.ybins,R=0,D=[],P=e.histnorm,z=e.histfunc,N=-1!==P.indexOf("density"),F="max"===z||"min"===z,B=F?null:0,j=i.count,H=o[P],U=!1,V=[],G=[],q="z"in e?e.z:"marker"in e&&Array.isArray(e.marker.color)?e.marker.color:"";q&&"count"!==z&&(U="avg"===z,j=i[z]);var X=e.xbins,Y=x(X.start),W=x(X.end)+(Y-a.tickIncrement(Y,X.size,!1,y))/1e6;for(d=Y;d=0&&M=0&&T<$&&(R+=j(M,d,h[T],q,D[T]));if(U)for(T=0;T<$;T++)R+=s(h[T],D[T]);if(H)for(T=0;T<$;T++)H(h[T],R,V,G[T]);return{x:g,x0:r,dx:u,y:v,y0:c,dy:f,z:h}}},{"../../lib":350,"../../plots/cartesian/axes":389,"../histogram/average":463,"../histogram/bin_functions":464,"../histogram/clean_bins":465,"../histogram/norm_functions":466}],468:[function(t,e,r){"use strict";var n=t("../../components/colorscale/color_attributes"),a=t("../../components/colorbar/attributes"),i=t("../../components/colorscale/scales"),o=t("../../plots/cartesian/layout_attributes"),s=t("../../plots/font_attributes"),l=t("../../lib/extend").extendDeep,u=t("../../lib/extend").extendFlat;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]}},labelfont:u({},s,{}),tickfont:u({},s,{}),rangefont:u({},s,{}),dimensions:{_isLinkedToArray:"dimension",label:{valType:"string"},tickvals:o.tickvals,ticktext:o.ticktext,tickformat:{valType:"string",dflt:"3s"},visible:{valType:"boolean",dflt:!0},range:{valType:"info_array",items:[{valType:"number"},{valType:"number"}]},constraintrange:{valType:"info_array",items:[{valType:"number"},{valType:"number"}]},values:{valType:"data_array",dflt:[]}},line:u({},l({},n("line"),{colorscale:l({},n("line").colorscale,{dflt:i.Viridis}),autocolorscale:l({},n("line").autocolorscale,{dflt:!1})}),{showscale:{valType:"boolean",dflt:!1},colorbar:a})}},{"../../components/colorbar/attributes":234,"../../components/colorscale/color_attributes":240,"../../components/colorscale/scales":251,"../../lib/extend":343,"../../plots/cartesian/layout_attributes":400,"../../plots/font_attributes":413}],469:[function(t,e,r){"use strict";var n=t("d3"),a=t("../../plots/plots"),i=t("./plot"),o=t("../../constants/xmlns_namespaces"),s=t("./constants");r.name="parcoords",r.attr="type",r.plot=function(t){var e=a.getSubplotCalcData(t.calcdata,"parcoords","parcoords");e.length&&i(t,e)},r.clean=function(t,e,r,n){var a=n._has&&n._has("parcoords"),i=e._has&&e._has("parcoords");a&&!i&&(n._paperdiv.selectAll(".parcoords-line-layers").remove(),n._paperdiv.selectAll(".parcoords-line-layers").remove(),n._paperdiv.selectAll(".parcoords").remove(),n._paperdiv.selectAll(".parcoords").remove(),n._glimages.selectAll("*").remove())},r.toSVG=function(t){function e(e){var n=this,a=n.toDataURL("image/png"),i=r.append("svg:image"),l=t._fullLayout._size,u=t._fullData[e.model.key].domain;i.attr({xmlns:o.svg,"xlink:href":a,x:l.l+l.w*u.x[0]-s.overdrag,y:l.t+l.h*(1-u.y[1]),width:(u.x[1]-u.x[0])*l.w+2*s.overdrag,height:(u.y[1]-u.y[0])*l.h,preserveAspectRatio:"none"})}var r=t._fullLayout._glimages,a=n.selectAll(".svg-container");a.filter(function(t,e){return e===a.size()-1}).selectAll(".parcoords-lines.context, .parcoords-lines.focus").each(e),window.setTimeout(function(){n.selectAll("#filterBarPattern").attr("id","filterBarPattern")},60)}},{"../../constants/xmlns_namespaces":335,"../../plots/plots":422,"./constants":472,"./plot":477,d3:62}],470:[function(t,e,r){"use strict";var n=t("../../components/colorscale/has_colorscale"),a=t("../../components/colorscale/calc"),i=t("../../lib");e.exports=function(t,e){var r=!!e.line.colorscale&&i.isArray(e.line.color),o=r?e.line.color:Array.apply(0,Array(e.dimensions.reduce(function(t,e){return Math.max(t,e.values.length)},0))).map(function(){return.5}),s=r?e.line.colorscale:[[0,e.line.color],[1,e.line.color]];return n(e,"line")&&a(e,e.line.color,"line","c"),[{lineColor:o,cscale:s}]}},{"../../components/colorscale/calc":239,"../../components/colorscale/has_colorscale":246,"../../lib":350}],471:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("../../lib"),i=t("../../plots/plots"),o=t("../../components/colorscale"),s=t("../../components/colorbar/draw");e.exports=function(t,e){var r=e[0].trace,l=r.line,u="cb"+r.uid;if(t._fullLayout._infolayer.selectAll("."+u).remove(),void 0===l||!l.showscale)return void i.autoMargin(t,u);var c=l.color,f=l.cmin,h=l.cmax;n(f)||(f=a.aggNums(Math.min,null,c)),n(h)||(h=a.aggNums(Math.max,null,c));var d=e[0].t.cb=s(t,u),p=o.makeColorScaleFunc(o.extractScale(l.colorscale,f,h),{noNumericCheck:!0});d.fillcolor(p).filllevels({start:f,end:h,size:(h-f)/254}).options(l.colorbar)()}},{"../../components/colorbar/draw":236,"../../components/colorscale":247,"../../lib":350,"../../plots/plots":422,"fast-isnumeric":68}],472:[function(t,e,r){"use strict";e.exports={maxDimensionCount:60,overdrag:45,verticalPadding:2,tickDistance:50,canvasPixelRatio:1,blockLineCount:5e3,scatter:!1,layers:["contextLineLayer","focusLineLayer","pickLineLayer"],axisTitleOffset:28,axisExtentOffset:10,bar:{width:4,capturewidth:10,fillcolor:"magenta",fillopacity:1,strokecolor:"white",strokeopacity:1,strokewidth:1,handleheight:16,handleopacity:1,handleoverlap:0}}},{}],473:[function(t,e,r){"use strict";function n(t,e,r,n,a){a("line.color",r),s(t,"line")&&i.isArray(t.line.color)?(a("line.colorscale"),l(t,e,n,a,{prefix:"line.",cLetter:"c"})):a("line.color",r)}function a(t,e){function r(t,e){return i.coerce(n,a,o.dimensions,t,e)}var n,a,s,l=t.dimensions||[],c=e.dimensions=[],f=1/0;for(l.length>u&&(i.log("parcoords traces support up to "+u+" dimensions at the moment"),l.splice(u)),s=0;s0);d&&(r("label"),r("tickvals"),r("ticktext"),r("tickformat"),r("range"),r("constraintrange"),f=Math.min(f,a.values.length)),a._index=s,c.push(a)}if(isFinite(f))for(s=0;sf&&(a.values=a.values.slice(0,f));return c}var i=t("../../lib"),o=t("./attributes"),s=t("../../components/colorscale/has_colorscale"),l=t("../../components/colorscale/defaults"),u=t("./constants").maxDimensionCount;e.exports=function(t,e,r,s){function l(r,n){return i.coerce(t,e,o,r,n)}var u=a(t,e);n(t,e,r,s,l),l("domain.x"),l("domain.y"),Array.isArray(u)&&u.length||(e.visible=!1);var c={family:s.font.family,size:Math.round(s.font.size*(10/12)),color:s.font.color};i.coerceFont(l,"labelfont",c),i.coerceFont(l,"tickfont",c),i.coerceFont(l,"rangefont",c)}},{"../../components/colorscale/defaults":242,"../../components/colorscale/has_colorscale":246,"../../lib":350,"./attributes":468,"./constants":472}],474:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.calc=t("./calc"),n.plot=t("./plot"),n.colorbar=t("./colorbar"),n.moduleType="trace",n.name="parcoords",n.basePlotModule=t("./base_plot"),n.categories=["gl","noOpacity"],n.meta={},e.exports=n},{"./attributes":468,"./base_plot":469,"./calc":470,"./colorbar":471,"./defaults":473,"./plot":477}],475:[function(t,e,r){"use strict";function n(t){t.read({x:0,y:0,width:1,height:1,data:x})}function a(t,e,r,n,a){var i=t._gl;i.enable(i.SCISSOR_TEST),i.scissor(e,r,n,a),t.clear({color:[0,0,0,0],depth:1})}function i(t,e,r,i,o,s){function l(n){var c;c=Math.min(i,o-n*i),s.offset=v*n*i,s.count=v*c,0===n&&(window.cancelAnimationFrame(r.currentRafs[u]),delete r.currentRafs[u],a(t,s.scissorX,s.scissorY,s.scissorWidth,s.viewBoxSize[1])),r.clearOnly||(e(s),n*i+c>>8*e)%256/255}function u(t,e,r,n){for(var a=[],i=0;i=m-4?l(i,m-2-s):.5);return a}function c(t,e,r){var n,a,i,o=[];for(a=0;ah&&(h=t[l].dim2.canvasX,c=l),t[l].dim1.canvasXa)return i;a=o,i=n[r]}return n[n.length-1]}function l(t,e,r){var n=o(r);return r.tickvals?_.scale.ordinal().domain(r.tickvals).range(r.tickvals.map(function(t){return(t-n[0])/(n[1]-n[0])}).map(function(r){return t-e+r*(e-(t-e))})):_.scale.linear().domain(n).range([t-e,e])}function u(t,e){return _.scale.linear().range([t-e,e])}function c(t){return _.scale.linear().domain(o(t))}function f(t){var e=o(t);return t.tickvals&&_.scale.ordinal().domain(t.tickvals).range(t.tickvals.map(function(t){return(t-e[0])/(e[1]-e[0])}))}function h(t){var e=t.map(function(t){return t[0]}),r=t.map(function(t){return t[1]}),n=r.map(function(t){return _.rgb(t)}),a=function(t){return function(e){return e[t]}},i="rgb".split("").map(function(t){return _.scale.linear().clamp(!0).domain(e).range(n.map(a(t)))});return function(t){return i.map(function(e){return e(t)})}}function d(t){return t[0]}function p(t,e,r){var n=d(e),a=n.trace,o=n.lineColor,s=n.cscale,l=a.line,u=a.domain,f=a.dimensions,p=t.width,g=a.labelfont,m=a.tickfont,v=a.rangefont,y=x.extendDeep({},l,{color:o.map(c({values:o,range:[l.cmin,l.cmax]})),blockLineCount:b.blockLineCount,canvasOverdrag:b.overdrag*b.canvasPixelRatio}),_=Math.floor(p*(u.x[1]-u.x[0])),w=Math.floor(t.height*(u.y[1]-u.y[0])),A=t.margin||{l:80,r:80,t:100,b:80},k=_,M=w;return{key:r,colCount:f.filter(i).length,dimensions:f,tickDistance:b.tickDistance,unitToColor:h(s),lines:y,labelFont:g,tickFont:m,rangeFont:v,translateX:u.x[0]*p,translateY:t.height-u.y[1]*t.height,pad:A,canvasWidth:k*b.canvasPixelRatio+2*y.canvasOverdrag,canvasHeight:M*b.canvasPixelRatio,width:k,height:M,canvasPixelRatio:b.canvasPixelRatio}}function g(t){var e=t.width,r=t.height,n=t.dimensions,a=t.canvasPixelRatio,o=function(r){return e*r/Math.max(1,t.colCount-1)},s=b.verticalPadding/(r*a),h=1-2*s,d=function(t){return s+h*t},p={key:t.key,xScale:o,model:t},g={};return p.dimensions=n.filter(i).map(function(e,n){var i=c(e),s=g[e.label];return g[e.label]=(s||0)+1,{key:e.label+(s?"__"+s:""),label:e.label,tickFormat:e.tickformat,tickvals:e.tickvals,ticktext:e.ticktext,ordinal:!!e.tickvals,scatter:b.scatter||e.scatter,xIndex:n,crossfilterDimensionIndex:n,visibleIndex:e._index,height:r,values:e.values,paddedUnitValues:e.values.map(i).map(d),xScale:o,x:o(n),canvasX:o(n)*a,unitScale:u(r,b.verticalPadding),domainScale:l(r,b.verticalPadding,e),ordinalScale:f(e),domainToUnitScale:i,filter:e.constraintrange?e.constraintrange.map(i):[0,1],parent:p,model:t}}),p}function m(t){return b.layers.map(function(e){return{key:e,context:"contextLineLayer"===e,pick:"pickLineLayer"===e,viewModel:t,model:t.model}})}function v(t){t.classed("axisExtentText",!0).attr("text-anchor","middle").style("cursor","default").style("user-select","none")}var y=t("./lines"),b=t("./constants"),x=t("../../lib"),_=t("d3"),w=t("../../components/drawing");e.exports=function(t,e,r,i,o){function l(t){var e=t.selectAll("defs").data(a,n);e.enter().append("defs");var r=e.selectAll("#filterBarPattern").data(a,n);r.enter().append("pattern").attr("id","filterBarPattern").attr("patternUnits","userSpaceOnUse"),r.attr("x",-b.bar.width).attr("width",b.bar.capturewidth).attr("height",function(t){return t.model.height});var i=r.selectAll("rect").data(a,n);i.enter().append("rect").attr("shape-rendering","crispEdges"),i.attr("height",function(t){return t.model.height}).attr("width",b.bar.width).attr("x",b.bar.width/2).attr("fill",b.bar.fillcolor).attr("fill-opacity",b.bar.fillopacity).attr("stroke",b.bar.strokecolor).attr("stroke-opacity",b.bar.strokeopacity).attr("stroke-width",b.bar.strokewidth)}function u(t){return t.dimensions.some(function(t){return 0!==t.filter[0]||1!==t.filter[1]})}function c(t,e){for(var r=e.panels||(e.panels=[]),n=t.each(function(t){return t})[e.key].map(function(t){return t.__data__}),a=n.length-1,i=0;i<1;i++)for(var o=0;o=r||s>=n)return;var l=t.lineLayer.readPixel(i,n-1-s),u=0!==l[3],c=u?l[2]+256*(l[1]+256*l[0]):null,f={x:i,y:s,clientX:e.clientX,clientY:e.clientY,dataIndex:t.model.key,curveNumber:c};c!==I&&(u?o.hover(f):o.unhover&&o.unhover(f),I=c)}}),C.style("margin",function(t){var e=t.model.pad;return e.t+"px "+e.r+"px "+e.b+"px "+e.l+"px"}).attr("width",function(t){return t.model.canvasWidth}).attr("height",function(t){return t.model.canvasHeight}).style("width",function(t){return t.model.width+2*b.overdrag+"px"}).style("height",function(t){return t.model.height+"px"}).style("opacity",function(t){return t.pick?.01:1}),e.style("background","rgba(255, 255, 255, 0)");var R=e.selectAll(".parcoords").data(L,n);R.exit().remove(),R.enter().append("g").classed("parcoords",!0).attr("overflow","visible").style("box-sizing","content-box").style("position","absolute").style("left",0).style("overflow","visible").style("shape-rendering","crispEdges").style("pointer-events","none").call(l),R.attr("width",function(t){return t.model.width+t.model.pad.l+t.model.pad.r}).attr("height",function(t){return t.model.height+t.model.pad.t+t.model.pad.b}).attr("transform",function(t){return"translate("+t.model.translateX+","+t.model.translateY+")"});var D=R.selectAll(".parcoordsControlView").data(a,n);D.enter().append("g").classed("parcoordsControlView",!0).style("box-sizing","content-box"),D.attr("transform",function(t){return"translate("+t.model.pad.l+","+t.model.pad.t+")"});var P=D.selectAll(".yAxis").data(function(t){return t.dimensions},n);P.enter().append("g").classed("yAxis",!0).each(function(t){O.dimensions.push(t)}),D.each(function(t){h(P,t)}),C.each(function(t){t.lineLayer=y(this,t.model.lines,t.model.canvasWidth,t.model.canvasHeight,t.viewModel.dimensions,t.viewModel.panels,t.model.unitToColor,t.context,t.pick,b.scatter),t.viewModel[t.key]=t.lineLayer,O.renderers.push(function(){t.lineLayer.render(t.viewModel.panels,!0)}),t.lineLayer.render(t.viewModel.panels,!t.context)}),P.attr("transform",function(t){return"translate("+t.xScale(t.xIndex)+", 0)"}),P.call(_.behavior.drag().origin(function(t){return t}).on("drag",function(t){var e=t.parent;E=!1,T||(t.x=Math.max(-b.overdrag,Math.min(t.model.width+b.overdrag,_.event.x)),t.canvasX=t.x*t.model.canvasPixelRatio,P.sort(function(t,e){return t.x-e.x}).each(function(e,r){e.xIndex=r,e.x=t===e?e.x:e.xScale(e.xIndex),e.canvasX=e.x*e.model.canvasPixelRatio}),h(P,e),P.filter(function(e){return 0!==Math.abs(t.xIndex-e.xIndex)}).attr("transform",function(t){return"translate("+t.xScale(t.xIndex)+", 0)"}),_.select(this).attr("transform","translate("+t.x+", 0)"),P.each(function(r,n,a){a===t.parent.key&&(e.dimensions[n]=r)}),e.contextLineLayer&&e.contextLineLayer.render(e.panels,!1,!u(e)),e.focusLineLayer.render&&e.focusLineLayer.render(e.panels))}).on("dragend",function(t){var e=t.parent;if(T)return void("ending"===T&&(T=!1));t.x=t.xScale(t.xIndex),t.canvasX=t.x*t.model.canvasPixelRatio,h(P,e),_.select(this).attr("transform",function(t){return"translate("+t.x+", 0)"}),e.contextLineLayer&&e.contextLineLayer.render(e.panels,!1,!u(e)),e.focusLineLayer&&e.focusLineLayer.render(e.panels),e.pickLineLayer&&e.pickLineLayer.render(e.panels,!0),E=!0,o&&o.axesMoved&&o.axesMoved(e.key,e.dimensions.map(function(t){return t.crossfilterDimensionIndex}))})),P.exit().remove();var z=P.selectAll(".axisOverlays").data(a,n);z.enter().append("g").classed("axisOverlays",!0),z.selectAll(".axis").remove();var N=z.selectAll(".axis").data(a,n);N.enter().append("g").classed("axis",!0),N.each(function(t){var e=t.model.height/t.model.tickDistance,r=t.domainScale,n=r.domain(),a=t.ticktext;_.select(this).call(_.svg.axis().orient("left").tickSize(4).outerTickSize(2).ticks(e,t.tickFormat).tickValues(t.ordinal?n.map(function(t,e){return a&&a[e]||t}):null).tickFormat(t.ordinal?function(t){return t}:null).scale(r)),w.font(N.selectAll("text"),t.model.tickFont)}),N.selectAll(".domain, .tick>line").attr("fill","none").attr("stroke","black").attr("stroke-opacity",.25).attr("stroke-width","1px"),N.selectAll("text").style("text-shadow","1px 1px 1px #fff, -1px -1px 1px #fff, 1px -1px 1px #fff, -1px 1px 1px #fff").style("cursor","default").style("user-select","none");var F=z.selectAll(".axisHeading").data(a,n);F.enter().append("g").classed("axisHeading",!0);var B=F.selectAll(".axisTitle").data(a,n);B.enter().append("text").classed("axisTitle",!0).attr("text-anchor","middle").style("cursor","ew-resize").style("user-select","none").style("pointer-events","auto"),B.attr("transform","translate(0,"+-b.axisTitleOffset+")").text(function(t){return t.label}).each(function(t){w.font(B,t.model.labelFont)});var j=z.selectAll(".axisExtent").data(a,n);j.enter().append("g").classed("axisExtent",!0);var H=j.selectAll(".axisExtentTop").data(a,n);H.enter().append("g").classed("axisExtentTop",!0),H.attr("transform","translate(0,"+-b.axisExtentOffset+")");var U=H.selectAll(".axisExtentTopText").data(a,n);U.enter().append("text").classed("axisExtentTopText",!0).attr("alignment-baseline","after-edge").call(v),U.text(function(t){return x(t)(t.domainScale.domain().slice(-1)[0])}).each(function(t){w.font(U,t.model.rangeFont)});var V=j.selectAll(".axisExtentBottom").data(a,n);V.enter().append("g").classed("axisExtentBottom",!0),V.attr("transform",function(t){return"translate(0,"+(t.model.height+b.axisExtentOffset)+")"});var G=V.selectAll(".axisExtentBottomText").data(a,n);G.enter().append("text").classed("axisExtentBottomText",!0).attr("alignment-baseline","before-edge").call(v),G.text(function(t){return x(t)(t.domainScale.domain()[0])}).each(function(t){w.font(G,t.model.rangeFont)});var q=z.selectAll(".axisBrush").data(a,n),X=q.enter().append("g").classed("axisBrush",!0);q.each(function(t){t.brush||(t.brush=_.svg.brush().y(t.unitScale).on("brushstart",A).on("brush",k).on("brushend",M),0===t.filter[0]&&1===t.filter[1]||t.brush.extent(t.filter),_.select(this).call(t.brush))}),X.selectAll("rect").attr("x",-b.bar.capturewidth/2).attr("width",b.bar.capturewidth),X.selectAll("rect.extent").attr("fill","url(#filterBarPattern)").style("cursor","ns-resize").filter(function(t){return 0===t.filter[0]&&1===t.filter[1]}).attr("y",-100),X.selectAll(".resize rect").attr("height",b.bar.handleheight).attr("opacity",0).style("visibility","visible"),X.selectAll(".resize.n rect").style("cursor","n-resize").attr("y",b.bar.handleoverlap-b.bar.handleheight),X.selectAll(".resize.s rect").style("cursor","s-resize").attr("y",b.bar.handleoverlap);var Y=!1,W=!1;return O}},{"../../components/drawing":257,"../../lib":350,"./constants":472,"./lines":475,d3:62}],477:[function(t,e,r){"use strict";var n=t("./parcoords");e.exports=function(t,e){var r=t._fullLayout,a=r._paper,i=r._paperdiv,o={},s={},l=r._size;e.forEach(function(e,r){o[r]=t.data[r].dimensions,s[r]=t.data[r].dimensions.slice()});var u=function(e,r,n){var a=s[e][r],i=a.constraintrange;i&&2===i.length||(i=a.constraintrange=[]),i[0]=n[0],i[1]=n[1],t.emit("plotly_restyle")},c=function(e){t.emit("plotly_hover",e)},f=function(e){t.emit("plotly_unhover",e)},h=function(e,r){function n(t){return!("visible"in t)||t.visible}function a(t,e,r){ +var n=e.indexOf(r),a=t.indexOf(n);return-1===a&&(a+=e.length),a}var i=function(t){return function(e,n){return a(r,t,e)-a(r,t,n)}}(s[e].filter(n));o[e].sort(i),s[e].filter(function(t){return!n(t)}).sort(function(t){return s[e].indexOf(t)}).forEach(function(t){o[e].splice(o[e].indexOf(t),1),o[e].splice(s[e].indexOf(t),0,t)}),t.emit("plotly_restyle")};n(i,a,e,{width:l.w,height:l.h,margin:{t:l.t,r:l.r,b:l.b,l:l.l}},{filterChanged:u,hover:c,unhover:f,axesMoved:h})}},{"./parcoords":476}],478:[function(t,e,r){"use strict";var n=t("../../components/color");e.exports=function(t,e,r){var a=r.marker.line.color;Array.isArray(a)&&(a=a[e.i]||n.defaultLine);var i=r.marker.line.width||0;Array.isArray(i)&&(i=i[e.i]||0),t.style({"stroke-width":i}).call(n.fill,e.color).call(n.stroke,a)}},{"../../components/color":233}],479:[function(t,e,r){"use strict";var n=t("../scattergl/attributes");e.exports={x:n.x,y:n.y,xy:{valType:"data_array"},indices:{valType:"data_array"},xbounds:{valType:"data_array"},ybounds:{valType:"data_array"},text:n.text,marker:{color:{valType:"color",arrayOk:!1},opacity:{valType:"number",min:0,max:1,dflt:1,arrayOk:!1},blend:{valType:"boolean",dflt:null},sizemin:{valType:"number",min:.1,max:2,dflt:.5},sizemax:{valType:"number",min:.1,dflt:20},border:{color:{valType:"color",arrayOk:!1},arearatio:{valType:"number",min:0,max:1,dflt:0}}}}},{"../scattergl/attributes":508}],480:[function(t,e,r){"use strict";function n(t,e){this.scene=t,this.uid=e,this.type="pointcloud",this.pickXData=[],this.pickYData=[],this.xData=[],this.yData=[],this.textLabels=[],this.color="rgb(0, 0, 0)",this.name="",this.hoverinfo="all",this.idToIndex=new Int32Array(0),this.bounds=[0,0,0,0],this.pointcloudOptions={positions:new Float32Array(0),idToIndex:this.idToIndex,sizemin:.5,sizemax:12,color:[0,0,0,1],areaRatio:1,borderColor:[0,0,0,1]},this.pointcloud=i(t.glplot,this.pointcloudOptions),this.pointcloud._trace=this}function a(t,e){var r=new n(t,e.uid);return r.update(e),r}var i=t("gl-pointcloud2d"),o=t("../../lib/str2rgbarray"),s=t("../scatter/get_trace_color"),l=["xaxis","yaxis"],u=n.prototype;u.handlePick=function(t){var e=this.idToIndex[t.pointId];return{trace:this,dataCoord:t.dataCoord,traceCoord:this.pickXYData?[this.pickXYData[2*e],this.pickXYData[2*e+1]]:[this.pickXData[e],this.pickYData[e]],textLabel:Array.isArray(this.textLabels)?this.textLabels[e]:this.textLabels,color:this.color,name:this.name,pointIndex:e,hoverinfo:this.hoverinfo}},u.update=function(t){this.index=t.index,this.textLabels=t.text,this.name=t.name,this.hoverinfo=t.hoverinfo,this.bounds=[1/0,1/0,-1/0,-1/0],this.updateFast(t),this.color=s(t,{})},u.updateFast=function(t){var e,r,n,a,i,s,l=this.xData=this.pickXData=t.x,u=this.yData=this.pickYData=t.y,c=this.pickXYData=t.xy,f=t.xbounds&&t.ybounds,h=t.indices,d=this.bounds;if(c){if(n=c,e=c.length>>>1,f)d[0]=t.xbounds[0],d[2]=t.xbounds[1],d[1]=t.ybounds[0],d[3]=t.ybounds[1];else for(s=0;sd[2]&&(d[2]=a),id[3]&&(d[3]=i);if(h)r=h;else for(r=new Int32Array(e),s=0;sd[2]&&(d[2]=a),id[3]&&(d[3]=i);this.idToIndex=r,this.pointcloudOptions.idToIndex=r,this.pointcloudOptions.positions=n;var p=o(t.marker.color),g=o(t.marker.border.color),m=t.opacity*t.marker.opacity;p[3]*=m,this.pointcloudOptions.color=p;var v=t.marker.blend;if(null===v){v=l.length<100||u.length<100}this.pointcloudOptions.blend=v,g[3]*=m,this.pointcloudOptions.borderColor=g;var y=t.marker.sizemin,b=Math.max(t.marker.sizemax,t.marker.sizemin);this.pointcloudOptions.sizeMin=y,this.pointcloudOptions.sizeMax=b,this.pointcloudOptions.areaRatio=t.marker.border.arearatio,this.pointcloud.update(this.pointcloudOptions),this.expandAxesFast(d,b/2)},u.expandAxesFast=function(t,e){for(var r,n,a,i=e||.5,o=0;o<2;o++)r=this.scene[l[o]],n=r._min,n||(n=[]),n.push({val:t[o],pad:i}),a=r._max,a||(a=[]),a.push({val:t[o+2],pad:i})},u.dispose=function(){this.pointcloud.dispose()},e.exports=a},{"../../lib/str2rgbarray":368,"../scatter/get_trace_color":492,"gl-pointcloud2d":111}],481:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("./attributes");e.exports=function(t,e,r){function i(r,i){return n.coerce(t,e,a,r,i)}i("x"),i("y"),i("xbounds"),i("ybounds"),t.xy&&t.xy instanceof Float32Array&&(e.xy=t.xy),t.indices&&t.indices instanceof Int32Array&&(e.indices=t.indices),i("text"),i("marker.color",r),i("marker.opacity"),i("marker.blend"),i("marker.sizemin"),i("marker.sizemax"),i("marker.border.color",r),i("marker.border.arearatio")}},{"../../lib":350,"./attributes":479}],482:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.calc=t("../scatter3d/calc"),n.plot=t("./convert"),n.moduleType="trace",n.name="pointcloud",n.basePlotModule=t("../../plots/gl2d"),n.categories=["gl2d","showLegend"],n.meta={},e.exports=n},{"../../plots/gl2d":417,"../scatter3d/calc":507,"./attributes":479,"./convert":480,"./defaults":481}],483:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function(t,e){for(var r=0;rg&&d.splice(g,d.length-g),p.length>g&&p.splice(g,p.length-g);var m={padded:!0},v={padded:!0};if(o.hasMarkers(e)){if(r=e.marker,u=r.size,Array.isArray(u)){var y={type:"linear"};a.setConvert(y),u=y.makeCalcdata(e.marker,"size"),u.length>g&&u.splice(g,u.length-g)}var b,x=1.6*(e.marker.sizeref||1);b="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=v.ppad=Array.isArray(u)?u.map(b):b(u)}s(e),!("tozerox"===e.fill||"tonextx"===e.fill&&t.firstscatter)||d[0]===d[g-1]&&p[0]===p[g-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)||d[0]===d[g-1]&&p[0]===p[g-1]?-1!==["tonextx","tozerox"].indexOf(e.fill)&&(v.padded=!1):v.tozero=!0,a.expand(f,d,m),a.expand(h,p,v);var _=new Array(g);for(c=0;c=0;a--){var i=t[a];if("scatter"===i.type&&i.xaxis===r.xaxis&&i.yaxis===r.yaxis){i.opacity=void 0;break}}}}}},{}],487:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("../../lib"),i=t("../../plots/plots"),o=t("../../components/colorscale"),s=t("../../components/colorbar/draw");e.exports=function(t,e){var r=e[0].trace,l=r.marker,u="cb"+r.uid;if(t._fullLayout._infolayer.selectAll("."+u).remove(),void 0===l||!l.showscale)return void i.autoMargin(t,u);var c=l.color,f=l.cmin,h=l.cmax;n(f)||(f=a.aggNums(Math.min,null,c)),n(h)||(h=a.aggNums(Math.max,null,c));var d=e[0].t.cb=s(t,u),p=o.makeColorScaleFunc(o.extractScale(l.colorscale,f,h),{noNumericCheck:!0});d.fillcolor(p).filllevels({start:f,end:h,size:(h-f)/254}).options(l.colorbar)()}},{"../../components/colorbar/draw":236,"../../components/colorscale":247,"../../lib":350,"../../plots/plots":422,"fast-isnumeric":68}],488:[function(t,e,r){"use strict";var n=t("../../components/colorscale/has_colorscale"),a=t("../../components/colorscale/calc"),i=t("./subtypes");e.exports=function(t){i.hasLines(t)&&n(t,"line")&&a(t,t.line.color,"line","c"),i.hasMarkers(t)&&(n(t,"marker")&&a(t,t.marker.color,"marker","c"),n(t,"marker.line")&&a(t,t.marker.line.color,"marker.line","c"))}},{"../../components/colorscale/calc":239,"../../components/colorscale/has_colorscale":246,"./subtypes":504}],489:[function(t,e,r){"use strict";e.exports={PTS_LINESONLY:20}},{}],490:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("./attributes"),i=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,i){return n.coerce(t,e,a,r,i)}var m=s(t,e,p,g),v=mU!=D>=U&&(O=S[E-1][0],I=S[E][0],C=O+(I-O)*(U-R)/(D-R),F=Math.min(F,C),B=Math.max(B,C));F=Math.max(F,0),B=Math.min(B,h._length);var V=s.defaultLine;return s.opacity(f.fillcolor)?V=f.fillcolor:s.opacity((f.line||{}).color)&&(V=f.line.color),n.extendFlat(t,{distance:l+10,x0:F,x1:B,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":233,"../../components/errorbars":263,"../../components/fx":274,"../../lib":350,"./get_trace_color":492}],494:[function(t,e,r){"use strict";var n={},a=t("./subtypes");n.hasLines=a.hasLines,n.hasMarkers=a.hasMarkers,n.hasText=a.hasText,n.isBubble=a.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.animatable=!0,n.moduleType="trace",n.name="scatter",n.basePlotModule=t("../../plots/cartesian"),n.categories=["cartesian","symbols","markerColorscale","errorBarsOK","showLegend","scatter-like"],n.meta={},e.exports=n},{"../../plots/cartesian":399,"./arrays_to_calcdata":483,"./attributes":484,"./calc":485,"./clean_data":486,"./colorbar":487,"./defaults":490,"./hover":493,"./plot":501,"./select":502,"./style":503,"./subtypes":504}],495:[function(t,e,r){"use strict";var n=t("../../components/colorscale/has_colorscale"),a=t("../../components/colorscale/defaults");e.exports=function(t,e,r,i,o,s){var l=(t.marker||{}).color;if(o("line.color",r),n(t,"line"))a(t,e,i,o,{prefix:"line.",cLetter:"c"});else{o("line.color",!Array.isArray(l)&&l||r)}o("line.width"),(s||{}).noDash||o("line.dash")}},{"../../components/colorscale/defaults":242,"../../components/colorscale/has_colorscale":246}],496:[function(t,e,r){"use strict";var n=t("../../constants/numerical").BADNUM;e.exports=function(t,e){function r(e){var r=_.c2p(t[e].x),a=w.c2p(t[e].y);return r!==n&&a!==n&&[r,a]}function a(t){var e=t[0]/_._length,r=t[1]/w._length;return(1+10*Math.max(0,-e,e-1,-r,r-1))*M}var i,o,s,l,u,c,f,h,d,p,g,m,v,y,b,x,_=e.xaxis,w=e.yaxis,A=e.simplify,k=e.connectGaps,M=e.baseTolerance,T=e.linear,E=[],L=.2,S=new Array(t.length),C=0;for(A||(M=L=-1),i=0;ia(c))break;s=c,v=p[0]*d[0]+p[1]*d[1],v>g?(g=v,l=c,h=!1):v=t.length||!c)break;S[C++]=c,o=c}}else S[C++]=l}E.push(S.slice(0,C))}return E}},{"../../constants/numerical":333}],497:[function(t,e,r){"use strict";e.exports=function(t,e,r){"spline"===r("line.shape")&&r("line.smoothing")}},{}],498:[function(t,e,r){"use strict";e.exports=function(t,e,r){for(var n,a,i=null,o=0;o0?Math.max(e,a):0}}},{"fast-isnumeric":68}],500:[function(t,e,r){"use strict";var n=t("../../components/color"),a=t("../../components/colorscale/has_colorscale"),i=t("../../components/colorscale/defaults"),o=t("./subtypes");e.exports=function(t,e,r,s,l,u){var c,f=o.isBubble(t),h=(t.line||{}).color;if(u=u||{},h&&(r=h),l("marker.symbol"),l("marker.opacity",f?.7:1),l("marker.size"),l("marker.color",r),a(t,"marker")&&i(t,e,s,l,{prefix:"marker.",cLetter:"c"}),u.noLine||(c=h&&!Array.isArray(h)&&e.marker.color!==h?h:f?n.background:n.defaultLine,l("marker.line.color",c),a(t,"marker.line")&&i(t,e,s,l,{prefix:"marker.line.",cLetter:"c"}),l("marker.line.width",f?1:0)),f&&(l("marker.sizeref"),l("marker.sizemin"),l("marker.sizemode")),u.gradient){"none"!==l("marker.gradient.type")&&l("marker.gradient.color")}}},{"../../components/color":233,"../../components/colorscale/defaults":242,"../../components/colorscale/has_colorscale":246,"./subtypes":504}],501:[function(t,e,r){"use strict";function n(t,e,r){var n;e.selectAll("g.trace").each(function(t){var e=o.select(this);if(n=t[0].trace,n._nexttrace){if(n._nextFill=e.select(".js-fill.js-tonext"),!n._nextFill.size()){var a=":first-child";e.select(".js-fill.js-tozero").size()&&(a+=" + *"),n._nextFill=e.insert("path",a).attr("class","js-fill js-tonext")}}else e.selectAll(".js-fill.js-tonext").remove(),n._nextFill=null;n.fill&&("tozero"===n.fill.substr(0,6)||"toself"===n.fill||"to"===n.fill.substr(0,2)&&!n._prevtrace)?(n._ownFill=e.select(".js-fill.js-tozero"),n._ownFill.size()||(n._ownFill=e.insert("path",":first-child").attr("class","js-fill js-tozero"))):(e.selectAll(".js-fill.js-tozero").remove(),n._ownFill=null),e.selectAll(".js-fill").call(l.setClipUrl,r.layerClipId)})}function a(t,e,r,n,a,h,p){function g(t){return A?t.transition():t}function m(t){return t.filter(function(t){return t.vis})}function v(t){return t.id}function y(t){if(t.ids)return v}function b(){return!1}function x(e){var n,a,i,u=e[0].trace,f=o.select(this),h=c.hasMarkers(u),d=c.hasText(u),p=y(u),v=b,x=b;h&&(v=u.marker.maxdisplayed||u._needsCull?m:s.identity),d&&(x=u.marker.maxdisplayed||u._needsCull?m:s.identity),a=f.selectAll("path.point"),n=a.data(v,p);var _=n.enter().append("path").classed("point",!0);A&&_.call(l.pointStyle,u,t).call(l.translatePoints,k,M).style("opacity",0).transition().style("opacity",1);var w=h&&l.tryColorscale(u.marker,""),T=h&&l.tryColorscale(u.marker,"line");n.order(),n.each(function(e){var n=o.select(this),a=g(n);i=l.translatePoint(e,a,k,M),i?(l.singlePointStyle(e,a,u,w,T,t),r.layerClipId&&l.hideOutsideRangePoint(e,a,k,M),u.customdata&&n.classed("plotly-customdata",null!==e.data&&void 0!==e.data)):a.remove()}),A?n.exit().transition().style("opacity",0).remove():n.exit().remove(),a=f.selectAll("g"),n=a.data(x,p),n.enter().append("g").classed("textpoint",!0).append("text"),n.order(),n.each(function(t){var e=o.select(this),n=g(e.select("text"));i=l.translatePoint(t,n,k,M),i?r.layerClipId&&l.hideOutsideRangePoint(t,e,k,M):e.remove()}),n.selectAll("text").call(l.textPointStyle,u,t).each(function(t){var e=k.c2p(t.x),r=M.c2p(t.y);o.select(this).selectAll("tspan.line").each(function(){g(o.select(this)).attr({x:e,y:r})})}),n.exit().remove()}var _,w;i(t,e,r,n,a);var A=!!p&&p.duration>0,k=r.xaxis,M=r.yaxis,T=n[0].trace,E=T.line,L=o.select(h);if(L.call(u.plot,r,p),!0===T.visible){g(L).style("opacity",T.opacity);var S,C,O=T.fill.charAt(T.fill.length-1);"x"!==O&&"y"!==O&&(O=""),n[0].node3=L;var I="",R=[],D=T._prevtrace;D&&(I=D._prevRevpath||"",C=D._nextFill,R=D._polygons);var P,z,N,F,B,j,H,U,V,G="",q="",X=[],Y=[],W=s.noop;if(S=T._ownFill,c.hasLines(T)||"none"!==T.fill){for(C&&C.datum(n),-1!==["hv","vh","hvh","vhv"].indexOf(E.shape)?(N=l.steps(E.shape),F=l.steps(E.shape.split("").reverse().join(""))):N=F="spline"===E.shape?function(t){var e=t[t.length-1];return t[0][0]===e[0]&&t[0][1]===e[1]?l.smoothclosed(t.slice(1),E.smoothing):l.smoothopen(t,E.smoothing)}:function(t){return"M"+t.join("L")},B=function(t){return F(t.reverse())},X=f(n,{xaxis:k,yaxis:M,connectGaps:T.connectgaps,baseTolerance:Math.max(E.width||1,3)/4,linear:"linear"===E.shape,simplify:E.simplify}),V=T._polygons=new Array(X.length),w=0;w1}),W=function(t){return function(e){if(P=N(e),z=B(e),G?O?(G+="L"+P.substr(1),q=z+"L"+q.substr(1)):(G+="Z"+P,q=z+"Z"+q):(G=P,q=z),c.hasLines(T)&&e.length>1){var r=o.select(this);if(r.datum(n),t)g(r.style("opacity",0).attr("d",P).call(l.lineGroupStyle)).style("opacity",1);else{var a=g(r);a.attr("d",P),l.singleLineStyle(n,a)}}}}}var Z=L.selectAll(".js-line").data(Y);g(Z.exit()).style("opacity",0).remove(),Z.each(W(!1)),Z.enter().append("path").classed("js-line",!0).style("vector-effect","non-scaling-stroke").call(l.lineGroupStyle).each(W(!0)),l.setClipUrl(Z,r.layerClipId),X.length&&(S?j&&U&&(O?("y"===O?j[1]=U[1]=M.c2p(0,!0):"x"===O&&(j[0]=U[0]=k.c2p(0,!0)),g(S).attr("d","M"+U+"L"+j+"L"+G.substr(1)).call(l.singleFillStyle)):g(S).attr("d",G+"Z").call(l.singleFillStyle)):"tonext"===T.fill.substr(0,6)&&G&&I&&("tonext"===T.fill?g(C).attr("d",G+"Z"+I+"Z").call(l.singleFillStyle):g(C).attr("d",G+"L"+I.substr(1)+"Z").call(l.singleFillStyle),T._polygons=T._polygons.concat(R)),T._prevRevpath=q,T._prevPolygons=V);var Q=L.selectAll(".points");_=Q.data([n]),Q.each(x),_.enter().append("g").classed("points",!0).each(x),_.exit().remove(),_.each(function(t){var e=!1===t[0].trace.cliponaxis;l.setClipUrl(o.select(this),e?null:r.layerClipId)})}}function i(t,e,r,n,a){var i=r.xaxis,l=r.yaxis,u=o.extent(s.simpleMap(i.range,i.r2c)),f=o.extent(s.simpleMap(l.range,l.r2c)),h=n[0].trace;if(c.hasMarkers(h)){var d=h.marker.maxdisplayed;if(0!==d){var p=n.filter(function(t){return t.x>=u[0]&&t.x<=u[1]&&t.y>=f[0]&&t.y<=f[1]}),g=Math.ceil(p.length/d),m=0;a.forEach(function(t,r){var n=t[0].trace;c.hasMarkers(n)&&n.marker.maxdisplayed>0&&r0;for(c=p.selectAll("g.trace"),f=c.data(r,function(t){return t[0].trace.uid}),f.enter().append("g").attr("class",function(t){return"trace scatter trace"+t[0].trace.uid}).style("stroke-miterlimit",2),h(t,e,r),n(t,p,e),l=0,u={};lu[e[0].trace.uid]?1:-1}),m){s&&(d=s());o.transition().duration(i.duration).ease(i.easing).each("end",function(){d&&d()}).each("interrupt",function(){d&&d()}).each(function(){p.selectAll("g.trace").each(function(n,o){a(t,o,e,n,r,this,i)})})}else p.selectAll("g.trace").each(function(n,o){a(t,o,e,n,r,this,i)});g&&f.exit().remove(),p.selectAll("path:not([d])").remove()}},{"../../components/drawing":257,"../../components/errorbars":263,"../../lib":350,"../../lib/polygon":360,"./line_points":496,"./link_traces":498,"./subtypes":504,d3:62}],502:[function(t,e,r){"use strict";var n=t("./subtypes"),a=t("../../constants/interactions").DESELECTDIM;e.exports=function(t,e){var r,i,o,s,l=t.cd,u=t.xaxis,c=t.yaxis,f=[],h=l[0].trace,d=h.marker,p=!n.hasMarkers(h)&&!n.hasText(h);if(!0===h.visible&&!p){var g=Array.isArray(d.opacity)?1:d.opacity;if(!1===e)for(r=0;r=e.length?a:e[i]);return n}function o(t,e,r){return l(P(t,r),D(e,r),r)}function s(t,e,r,n){var a=k(t,e,n);return a=Array.isArray(a[0])?a:i(y.identity,[a],n),l(a,D(r,n),n)}function l(t,e,r){for(var n=new Array(4*r),a=0;aZ?W-Z:0),!G||V.noBorder||V.noFill?c(this.scatter.options.colors,X,h,j,q):c(this.scatter.options.colors,I,h,0),c(this.scatter.options.borderColors,Y,h,j,q);B?(this.scatter.options.positions=null,this.fancyScatter.update(),this.scatter.options.positions=k):this.fancyScatter.update()}else this.fancyScatter.clear();this.scatter.clear(),this.expandAxesFancy(l,f,F)},R.updateLines=function(t,e){var r;if(this.hasLines){var n=e;if(!t.connectgaps){var a=0,i=this.xData,s=this.yData;for(n=new Float64Array(2*i.length),r=0;rMath.abs(e))u.rotate(o,0,0,-t*n*Math.PI*p.rotateSpeed/window.innerWidth);else{var s=p.zoomSpeed*a*e/window.innerHeight*(o-u.lastT())/100;u.pan(o,0,0,f*(Math.exp(s)-1))}},!0),p}e.exports=n;var i=t("right-now"),a=t("3d-view"),o=t("mouse-change"),s=t("mouse-wheel"),l=t("mouse-event-offset")},{"3d-view":9,"mouse-change":188,"mouse-event-offset":189,"mouse-wheel":191,"right-now":225}],9:[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=a(),f=o(),h=s();return c.setDistanceLimits(l[0],l[1]),c.lookAt(0,e,r,i),f.setDistanceLimits(l[0],l[1]),f.lookAt(0,e,r,i),h.setDistanceLimits(l[0],l[1]),h.lookAt(0,e,r,i),new n({turntable:c,orbit:f,matrix:h},u)}e.exports=i;var a=t("turntable-camera-controller"),o=t("orbit-camera-controller"),s=t("matrix-camera-controller"),l=n.prototype;[["flush",1],["idle",1],["lookAt",4],["rotate",4],["pan",4],["translate",4],["setMatrix",2],["setDistanceLimits",2],["setDistance",2]].forEach(function(t){for(var e=t[0],r=[],n=0;n>16&255,r[1]=n>>8&255,r[2]=255&n):f.test(t)&&(n=t.match(h),r[0]=parseInt(n[1]),r[1]=parseInt(n[2]),r[2]=parseInt(n[3])),!e)for(var i=0;i<3;++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):f.test(t)&&(n=t.match(h),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;i<3;++i)r[i]=r[i]/255;return r}var c={},f=/^rgba?\(\s*\d{1,3}\s*,\s*\d{1,3}\s*,\s*\d{1,3}\s*(,.*)?\)$/,h=/^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=a,c.copy1D=o,c.str2RgbArray=l,c.str2RgbaArray=u,c}()},{}],16:[function(t,e,r){e.exports=function(t){return atob(t)}},{}],17:[function(t,e,r){"use strict";function n(t){for(var e=0,r=0;r0?r=r.ushln(f):f<0&&(c=c.ushln(-f)),l(r,c)}var i=t("./is-rat"),a=t("./lib/is-bn"),o=t("./lib/num-to-bn"),s=t("./lib/str-to-bn"),l=t("./lib/rationalize"),u=t("./div");e.exports=n},{"./div":20,"./is-rat":22,"./lib/is-bn":26,"./lib/num-to-bn":27,"./lib/rationalize":28,"./lib/str-to-bn":29}],22:[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":26}],23:[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":36}],24:[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 a=0;a20?52:r+32}var i=t("double-bits"),a=t("bit-twiddle").countTrailingZeros;e.exports=n},{"bit-twiddle":35,"double-bits":81}],26:[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":36}],27:[function(t,e,r){"use strict";function n(t){var e=a.exponent(t);return e<52?new i(t):new i(t*Math.pow(2,52-e)).ushln(e-52)}var i=t("bn.js"),a=t("double-bits");e.exports=n},{"bn.js":36,"double-bits":81}],28:[function(t,e,r){"use strict";function n(t,e){var r=a(t),n=a(e);if(0===r)return[i(0),i(1)];if(0===n)return[i(0),i(0)];n<0&&(t=t.neg(),e=e.neg());var o=t.gcd(e);return o.cmpn(1)?[t.div(o),e.div(o)]:[t,e]}var i=t("./num-to-bn"),a=t("./bn-sign");e.exports=n},{"./bn-sign":23,"./num-to-bn":27}],29:[function(t,e,r){"use strict";function n(t){return new i(t)}var i=t("bn.js");e.exports=n},{"bn.js":36}],30:[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":28}],31:[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":23}],32:[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":28}],33:[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.abs().divmod(r.abs()),o=n.div,s=i(o),l=n.mod,u=e.negative!==r.negative?-1:1;if(0===l.cmpn(0))return u*s;if(s){var c=a(s)+4,f=i(l.ushln(c).divRound(r));return u*(s+f*Math.pow(2,-c))}var h=r.bitLength()-l.bitLength()+53,f=i(l.ushln(h).divRound(r));return h<1023?u*f*Math.pow(2,-h):(f*=Math.pow(2,-1023),u*f*Math.pow(2,1023-h))}var i=t("./lib/bn-to-num"),a=t("./lib/ctz");e.exports=n},{"./lib/bn-to-num":24,"./lib/ctz":25}],34:[function(t,e,r){"use strict";function n(t,e,r,n,i,a){var o=["function ",t,"(a,l,h,",n.join(","),"){",a?"":"var i=",r?"l-1":"h+1",";while(l<=h){var m=(l+h)>>>1,x=a",i?".get(m)":"[m]"];return a?e.indexOf("c")<0?o.push(";if(x===y){return m}else if(x<=y){"):o.push(";var p=c(x,y);if(p===0){return m}else if(p<=0){"):o.push(";if(",e,"){i=m;"),r?o.push("l=m+1}else{h=m-1}"):o.push("h=m-1}else{l=m+1}"),o.push("}"),a?o.push("return -1};"):o.push("return i};"),o.join("")}function i(t,e,r,i){return new Function([n("A","x"+t+"y",e,["y"],!1,i),n("B","x"+t+"y",e,["y"],!0,i),n("P","c(x,y)"+t+"0",e,["y","c"],!1,i),n("Q","c(x,y)"+t+"0",e,["y","c"],!0,i),"function dispatchBsearch",r,"(a,y,c,l,h){if(a.shape){if(typeof(c)==='function'){return Q(a,(l===undefined)?0:l|0,(h===undefined)?a.shape[0]-1:h|0,y,c)}else{return B(a,(c===undefined)?0:c|0,(l===undefined)?a.shape[0]-1:l|0,y)}}else{if(typeof(c)==='function'){return P(a,(l===undefined)?0:l|0,(h===undefined)?a.length-1:h|0,y,c)}else{return A(a,(c===undefined)?0:c|0,(l===undefined)?a.length-1:l|0,y)}}}return dispatchBsearch",r].join(""))()}e.exports={ge:i(">=",!1,"GE"),gt:i(">",!1,"GT"),lt:i("<",!0,"LT"),le:i("<=",!0,"LE"),eq:i("-",!0,"EQ",!0)}},{}],35:[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}r.INT_BITS=32,r.INT_MAX=2147483647,r.INT_MIN=-1<<31,r.sign=function(t){return(t>0)-(t<0)},r.abs=function(t){var e=t>>31;return(t^e)-e},r.min=function(t,e){return e^(t^e)&-(t65535)<<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)|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,16843009*((t=(858993459&t)+(t>>>2&858993459))+(t>>>4)&252645135)>>>24},r.countTrailingZeros=n,r.nextPow2=function(t){return t+=0===t,--t,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,(t|=t>>>16)+1},r.prevPow2=function(t){return t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,(t|=t>>>16)-(t>>>1)},r.parity=function(t){return t^=t>>>16,t^=t>>>8,t^=t>>>4,27030>>>(t&=15)&1};var i=new Array(256);!function(t){for(var e=0;e<256;++e){var r=e,n=e,i=7;for(r>>>=1;r;r>>>=1)n<<=1,n|=1&r,--i;t[e]=n<>>8&255]<<16|i[t>>>16&255]<<8|i[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))<<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))<<22>>22},r.nextCombination=function(t){var e=t|t-1;return e+1|(~e&-~e)-1>>>n(t)+1}},{}],36:[function(t,e,r){!function(e,r){"use strict";function n(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function a(t,e,r){if(a.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}function o(t,e,r){for(var n=0,i=Math.min(t.length,r),a=e;a=49&&o<=54?o-49+10:o>=17&&o<=22?o-17+10:15&o}return n}function s(t,e,r,n){for(var i=0,a=Math.min(t.length,r),o=e;o=49?s-49+10:s>=17?s-17+10:s}return i}function l(t){for(var e=new Array(t.bitLength()),r=0;r>>i}return e}function u(t,e,r){r.negative=e.negative^t.negative;var n=t.length+e.length|0;r.length=n,n=n-1|0;var i=0|t.words[0],a=0|e.words[0],o=i*a,s=67108863&o,l=o/67108864|0;r.words[0]=s;for(var u=1;u>>26,f=67108863&l,h=Math.min(u,e.length-1),d=Math.max(0,u-t.length+1);d<=h;d++){var p=u-d|0;i=0|t.words[p],a=0|e.words[d],o=i*a+f,c+=o/67108864|0,f=67108863&o}r.words[u]=0|f,l=0|c}return 0!==l?r.words[u]=0|l:r.length--,r.strip()}function c(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var n=0,i=0,a=0;a>>26)|0,i+=o>>>26,o&=67108863}r.words[a]=s,n=o,o=i}return 0!==n?r.words[a]=n:r.length--,r.strip()}function f(t,e,r){return(new h).mulp(t,e,r)}function h(t,e){this.x=t,this.y=e}function d(t,e){this.name=t,this.p=new a(e,16),this.n=this.p.bitLength(),this.k=new a(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function p(){d.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function g(){d.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function v(){d.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function m(){d.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function y(t){if("string"==typeof t){var e=a._prime(t);this.m=e.p,this.prime=e}else n(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function b(t){y.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new a(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()), this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}"object"==typeof e?e.exports=a:r.BN=a,a.BN=a,a.wordSize=26;var x;try{x=t("buffer").Buffer}catch(t){}a.isBN=function(t){return t instanceof a||null!==t&&"object"==typeof t&&t.constructor.wordSize===a.wordSize&&Array.isArray(t.words)},a.max=function(t,e){return t.cmp(e)>0?t:e},a.min=function(t,e){return t.cmp(e)<0?t:e},a.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),n(e===(0|e)&&e>=2&&e<=36),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.negative=1),this.strip(),"le"===r&&this._initArray(this.toArray(),e,r)},a.prototype._initNumber=function(t,e,r){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(n(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),e,r)},a.prototype._initArray=function(t,e,r){if(n("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var i=0;i=0;i-=3)o=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[a]|=o<>>26-s&67108863,(s+=24)>=26&&(s-=26,a++);else if("le"===r)for(i=0,a=0;i>>26-s&67108863,(s+=24)>=26&&(s-=26,a++);return this.strip()},a.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)i=o(t,r,r+6),this.words[n]|=i<>>26-a&4194303,(a+=24)>=26&&(a-=26,n++);r+6!==e&&(i=o(t,e,r+6),this.words[n]|=i<>>26-a&4194303),this.strip()},a.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=e)n++;n--,i=i/e|0;for(var a=t.length-r,o=a%n,l=Math.min(a,a-o)+r,u=0,c=r;c1&&0===this.words[this.length-1];)this.length--;return this._normSign()},a.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},a.prototype.inspect=function(){return(this.red?""};var _=["","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"],w=[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];a.prototype.toString=function(t,e){t=t||10,e=0|e||1;var r;if(16===t||"hex"===t){r="";for(var i=0,a=0,o=0;o>>24-i&16777215,r=0!==a||o!==this.length-1?_[6-l.length]+l+r:l+r,i+=2,i>=26&&(i-=26,o--)}for(0!==a&&(r=a.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var u=w[t],c=M[t];r="";var f=this.clone();for(f.negative=0;!f.isZero();){var h=f.modn(c).toString(t);f=f.idivn(c),r=f.isZero()?h+r:_[u-h.length]+h+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},a.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},a.prototype.toJSON=function(){return this.toString(16)},a.prototype.toBuffer=function(t,e){return n(void 0!==x),this.toArrayLike(x,t,e)},a.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},a.prototype.toArrayLike=function(t,e,r){var i=this.byteLength(),a=r||Math.max(1,i);n(i<=a,"byte array longer than desired length"),n(a>0,"Requested array length <= 0"),this.strip();var o,s,l="le"===e,u=new t(a),c=this.clone();if(l){for(s=0;!c.isZero();s++)o=c.andln(255),c.iushrn(8),u[s]=o;for(;s=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},a.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},a.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},a.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},a.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},a.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},a.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},a.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;nt.length?this.clone().ixor(t):t.clone().ixor(this)},a.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},a.prototype.inotn=function(t){n("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-r),this.strip()},a.prototype.notn=function(t){return this.clone().inotn(t)},a.prototype.setn=function(t,e){n("number"==typeof t&&t>=0);var r=t/26|0,i=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(r=this,n=t):(r=t,n=this);for(var i=0,a=0;a>>26;for(;0!==i&&a>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;at.length?this.clone().iadd(t):t.clone().iadd(this)},a.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r=this.cmp(t);if(0===r)return this.negative=0,this.length=1,this.words[0]=0,this;var n,i;r>0?(n=this,i=t):(n=t,i=this);for(var a=0,o=0;o>26,this.words[o]=67108863&e;for(;0!==a&&o>26,this.words[o]=67108863&e;if(0===a&&o>>13,d=0|o[1],p=8191&d,g=d>>>13,v=0|o[2],m=8191&v,y=v>>>13,b=0|o[3],x=8191&b,_=b>>>13,w=0|o[4],M=8191&w,A=w>>>13,k=0|o[5],T=8191&k,E=k>>>13,L=0|o[6],C=8191&L,S=L>>>13,P=0|o[7],R=8191&P,O=P>>>13,N=0|o[8],I=8191&N,z=N>>>13,D=0|o[9],j=8191&D,F=D>>>13,B=0|s[0],U=8191&B,V=B>>>13,H=0|s[1],q=8191&H,G=H>>>13,X=0|s[2],W=8191&X,Y=X>>>13,Z=0|s[3],Q=8191&Z,$=Z>>>13,K=0|s[4],J=8191&K,tt=K>>>13,et=0|s[5],rt=8191&et,nt=et>>>13,it=0|s[6],at=8191&it,ot=it>>>13,st=0|s[7],lt=8191&st,ut=st>>>13,ct=0|s[8],ft=8191&ct,ht=ct>>>13,dt=0|s[9],pt=8191&dt,gt=dt>>>13;r.negative=t.negative^e.negative,r.length=19,n=Math.imul(f,U),i=Math.imul(f,V),i=i+Math.imul(h,U)|0,a=Math.imul(h,V);var vt=(u+n|0)+((8191&i)<<13)|0;u=(a+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(p,U),i=Math.imul(p,V),i=i+Math.imul(g,U)|0,a=Math.imul(g,V),n=n+Math.imul(f,q)|0,i=i+Math.imul(f,G)|0,i=i+Math.imul(h,q)|0,a=a+Math.imul(h,G)|0;var mt=(u+n|0)+((8191&i)<<13)|0;u=(a+(i>>>13)|0)+(mt>>>26)|0,mt&=67108863,n=Math.imul(m,U),i=Math.imul(m,V),i=i+Math.imul(y,U)|0,a=Math.imul(y,V),n=n+Math.imul(p,q)|0,i=i+Math.imul(p,G)|0,i=i+Math.imul(g,q)|0,a=a+Math.imul(g,G)|0,n=n+Math.imul(f,W)|0,i=i+Math.imul(f,Y)|0,i=i+Math.imul(h,W)|0,a=a+Math.imul(h,Y)|0;var yt=(u+n|0)+((8191&i)<<13)|0;u=(a+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(x,U),i=Math.imul(x,V),i=i+Math.imul(_,U)|0,a=Math.imul(_,V),n=n+Math.imul(m,q)|0,i=i+Math.imul(m,G)|0,i=i+Math.imul(y,q)|0,a=a+Math.imul(y,G)|0,n=n+Math.imul(p,W)|0,i=i+Math.imul(p,Y)|0,i=i+Math.imul(g,W)|0,a=a+Math.imul(g,Y)|0,n=n+Math.imul(f,Q)|0,i=i+Math.imul(f,$)|0,i=i+Math.imul(h,Q)|0,a=a+Math.imul(h,$)|0;var bt=(u+n|0)+((8191&i)<<13)|0;u=(a+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(M,U),i=Math.imul(M,V),i=i+Math.imul(A,U)|0,a=Math.imul(A,V),n=n+Math.imul(x,q)|0,i=i+Math.imul(x,G)|0,i=i+Math.imul(_,q)|0,a=a+Math.imul(_,G)|0,n=n+Math.imul(m,W)|0,i=i+Math.imul(m,Y)|0,i=i+Math.imul(y,W)|0,a=a+Math.imul(y,Y)|0,n=n+Math.imul(p,Q)|0,i=i+Math.imul(p,$)|0,i=i+Math.imul(g,Q)|0,a=a+Math.imul(g,$)|0,n=n+Math.imul(f,J)|0,i=i+Math.imul(f,tt)|0,i=i+Math.imul(h,J)|0,a=a+Math.imul(h,tt)|0;var xt=(u+n|0)+((8191&i)<<13)|0;u=(a+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(T,U),i=Math.imul(T,V),i=i+Math.imul(E,U)|0,a=Math.imul(E,V),n=n+Math.imul(M,q)|0,i=i+Math.imul(M,G)|0,i=i+Math.imul(A,q)|0,a=a+Math.imul(A,G)|0,n=n+Math.imul(x,W)|0,i=i+Math.imul(x,Y)|0,i=i+Math.imul(_,W)|0,a=a+Math.imul(_,Y)|0,n=n+Math.imul(m,Q)|0,i=i+Math.imul(m,$)|0,i=i+Math.imul(y,Q)|0,a=a+Math.imul(y,$)|0,n=n+Math.imul(p,J)|0,i=i+Math.imul(p,tt)|0,i=i+Math.imul(g,J)|0,a=a+Math.imul(g,tt)|0,n=n+Math.imul(f,rt)|0,i=i+Math.imul(f,nt)|0,i=i+Math.imul(h,rt)|0,a=a+Math.imul(h,nt)|0;var _t=(u+n|0)+((8191&i)<<13)|0;u=(a+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(C,U),i=Math.imul(C,V),i=i+Math.imul(S,U)|0,a=Math.imul(S,V),n=n+Math.imul(T,q)|0,i=i+Math.imul(T,G)|0,i=i+Math.imul(E,q)|0,a=a+Math.imul(E,G)|0,n=n+Math.imul(M,W)|0,i=i+Math.imul(M,Y)|0,i=i+Math.imul(A,W)|0,a=a+Math.imul(A,Y)|0,n=n+Math.imul(x,Q)|0,i=i+Math.imul(x,$)|0,i=i+Math.imul(_,Q)|0,a=a+Math.imul(_,$)|0,n=n+Math.imul(m,J)|0,i=i+Math.imul(m,tt)|0,i=i+Math.imul(y,J)|0,a=a+Math.imul(y,tt)|0,n=n+Math.imul(p,rt)|0,i=i+Math.imul(p,nt)|0,i=i+Math.imul(g,rt)|0,a=a+Math.imul(g,nt)|0,n=n+Math.imul(f,at)|0,i=i+Math.imul(f,ot)|0,i=i+Math.imul(h,at)|0,a=a+Math.imul(h,ot)|0;var wt=(u+n|0)+((8191&i)<<13)|0;u=(a+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(R,U),i=Math.imul(R,V),i=i+Math.imul(O,U)|0,a=Math.imul(O,V),n=n+Math.imul(C,q)|0,i=i+Math.imul(C,G)|0,i=i+Math.imul(S,q)|0,a=a+Math.imul(S,G)|0,n=n+Math.imul(T,W)|0,i=i+Math.imul(T,Y)|0,i=i+Math.imul(E,W)|0,a=a+Math.imul(E,Y)|0,n=n+Math.imul(M,Q)|0,i=i+Math.imul(M,$)|0,i=i+Math.imul(A,Q)|0,a=a+Math.imul(A,$)|0,n=n+Math.imul(x,J)|0,i=i+Math.imul(x,tt)|0,i=i+Math.imul(_,J)|0,a=a+Math.imul(_,tt)|0,n=n+Math.imul(m,rt)|0,i=i+Math.imul(m,nt)|0,i=i+Math.imul(y,rt)|0,a=a+Math.imul(y,nt)|0,n=n+Math.imul(p,at)|0,i=i+Math.imul(p,ot)|0,i=i+Math.imul(g,at)|0,a=a+Math.imul(g,ot)|0,n=n+Math.imul(f,lt)|0,i=i+Math.imul(f,ut)|0,i=i+Math.imul(h,lt)|0,a=a+Math.imul(h,ut)|0;var Mt=(u+n|0)+((8191&i)<<13)|0;u=(a+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(I,U),i=Math.imul(I,V),i=i+Math.imul(z,U)|0,a=Math.imul(z,V),n=n+Math.imul(R,q)|0,i=i+Math.imul(R,G)|0,i=i+Math.imul(O,q)|0,a=a+Math.imul(O,G)|0,n=n+Math.imul(C,W)|0,i=i+Math.imul(C,Y)|0,i=i+Math.imul(S,W)|0,a=a+Math.imul(S,Y)|0,n=n+Math.imul(T,Q)|0,i=i+Math.imul(T,$)|0,i=i+Math.imul(E,Q)|0,a=a+Math.imul(E,$)|0,n=n+Math.imul(M,J)|0,i=i+Math.imul(M,tt)|0,i=i+Math.imul(A,J)|0,a=a+Math.imul(A,tt)|0,n=n+Math.imul(x,rt)|0,i=i+Math.imul(x,nt)|0,i=i+Math.imul(_,rt)|0,a=a+Math.imul(_,nt)|0,n=n+Math.imul(m,at)|0,i=i+Math.imul(m,ot)|0,i=i+Math.imul(y,at)|0,a=a+Math.imul(y,ot)|0,n=n+Math.imul(p,lt)|0,i=i+Math.imul(p,ut)|0,i=i+Math.imul(g,lt)|0,a=a+Math.imul(g,ut)|0,n=n+Math.imul(f,ft)|0,i=i+Math.imul(f,ht)|0,i=i+Math.imul(h,ft)|0,a=a+Math.imul(h,ht)|0;var At=(u+n|0)+((8191&i)<<13)|0;u=(a+(i>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(j,U),i=Math.imul(j,V),i=i+Math.imul(F,U)|0,a=Math.imul(F,V),n=n+Math.imul(I,q)|0,i=i+Math.imul(I,G)|0,i=i+Math.imul(z,q)|0,a=a+Math.imul(z,G)|0,n=n+Math.imul(R,W)|0,i=i+Math.imul(R,Y)|0,i=i+Math.imul(O,W)|0,a=a+Math.imul(O,Y)|0,n=n+Math.imul(C,Q)|0,i=i+Math.imul(C,$)|0,i=i+Math.imul(S,Q)|0,a=a+Math.imul(S,$)|0,n=n+Math.imul(T,J)|0,i=i+Math.imul(T,tt)|0,i=i+Math.imul(E,J)|0,a=a+Math.imul(E,tt)|0,n=n+Math.imul(M,rt)|0,i=i+Math.imul(M,nt)|0,i=i+Math.imul(A,rt)|0,a=a+Math.imul(A,nt)|0,n=n+Math.imul(x,at)|0,i=i+Math.imul(x,ot)|0,i=i+Math.imul(_,at)|0,a=a+Math.imul(_,ot)|0,n=n+Math.imul(m,lt)|0,i=i+Math.imul(m,ut)|0,i=i+Math.imul(y,lt)|0,a=a+Math.imul(y,ut)|0,n=n+Math.imul(p,ft)|0,i=i+Math.imul(p,ht)|0,i=i+Math.imul(g,ft)|0,a=a+Math.imul(g,ht)|0,n=n+Math.imul(f,pt)|0,i=i+Math.imul(f,gt)|0,i=i+Math.imul(h,pt)|0,a=a+Math.imul(h,gt)|0;var kt=(u+n|0)+((8191&i)<<13)|0;u=(a+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(j,q),i=Math.imul(j,G),i=i+Math.imul(F,q)|0,a=Math.imul(F,G),n=n+Math.imul(I,W)|0,i=i+Math.imul(I,Y)|0,i=i+Math.imul(z,W)|0,a=a+Math.imul(z,Y)|0,n=n+Math.imul(R,Q)|0,i=i+Math.imul(R,$)|0,i=i+Math.imul(O,Q)|0,a=a+Math.imul(O,$)|0,n=n+Math.imul(C,J)|0,i=i+Math.imul(C,tt)|0,i=i+Math.imul(S,J)|0,a=a+Math.imul(S,tt)|0,n=n+Math.imul(T,rt)|0,i=i+Math.imul(T,nt)|0,i=i+Math.imul(E,rt)|0,a=a+Math.imul(E,nt)|0,n=n+Math.imul(M,at)|0,i=i+Math.imul(M,ot)|0,i=i+Math.imul(A,at)|0,a=a+Math.imul(A,ot)|0,n=n+Math.imul(x,lt)|0,i=i+Math.imul(x,ut)|0,i=i+Math.imul(_,lt)|0,a=a+Math.imul(_,ut)|0,n=n+Math.imul(m,ft)|0,i=i+Math.imul(m,ht)|0,i=i+Math.imul(y,ft)|0,a=a+Math.imul(y,ht)|0,n=n+Math.imul(p,pt)|0,i=i+Math.imul(p,gt)|0,i=i+Math.imul(g,pt)|0,a=a+Math.imul(g,gt)|0;var Tt=(u+n|0)+((8191&i)<<13)|0;u=(a+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(j,W),i=Math.imul(j,Y),i=i+Math.imul(F,W)|0,a=Math.imul(F,Y),n=n+Math.imul(I,Q)|0,i=i+Math.imul(I,$)|0,i=i+Math.imul(z,Q)|0,a=a+Math.imul(z,$)|0,n=n+Math.imul(R,J)|0,i=i+Math.imul(R,tt)|0,i=i+Math.imul(O,J)|0,a=a+Math.imul(O,tt)|0,n=n+Math.imul(C,rt)|0,i=i+Math.imul(C,nt)|0,i=i+Math.imul(S,rt)|0,a=a+Math.imul(S,nt)|0,n=n+Math.imul(T,at)|0,i=i+Math.imul(T,ot)|0,i=i+Math.imul(E,at)|0,a=a+Math.imul(E,ot)|0,n=n+Math.imul(M,lt)|0,i=i+Math.imul(M,ut)|0,i=i+Math.imul(A,lt)|0,a=a+Math.imul(A,ut)|0,n=n+Math.imul(x,ft)|0,i=i+Math.imul(x,ht)|0,i=i+Math.imul(_,ft)|0,a=a+Math.imul(_,ht)|0,n=n+Math.imul(m,pt)|0,i=i+Math.imul(m,gt)|0,i=i+Math.imul(y,pt)|0,a=a+Math.imul(y,gt)|0;var Et=(u+n|0)+((8191&i)<<13)|0;u=(a+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(j,Q),i=Math.imul(j,$),i=i+Math.imul(F,Q)|0,a=Math.imul(F,$),n=n+Math.imul(I,J)|0,i=i+Math.imul(I,tt)|0,i=i+Math.imul(z,J)|0,a=a+Math.imul(z,tt)|0,n=n+Math.imul(R,rt)|0,i=i+Math.imul(R,nt)|0,i=i+Math.imul(O,rt)|0,a=a+Math.imul(O,nt)|0,n=n+Math.imul(C,at)|0,i=i+Math.imul(C,ot)|0,i=i+Math.imul(S,at)|0,a=a+Math.imul(S,ot)|0,n=n+Math.imul(T,lt)|0,i=i+Math.imul(T,ut)|0,i=i+Math.imul(E,lt)|0,a=a+Math.imul(E,ut)|0,n=n+Math.imul(M,ft)|0,i=i+Math.imul(M,ht)|0,i=i+Math.imul(A,ft)|0,a=a+Math.imul(A,ht)|0,n=n+Math.imul(x,pt)|0,i=i+Math.imul(x,gt)|0,i=i+Math.imul(_,pt)|0,a=a+Math.imul(_,gt)|0;var Lt=(u+n|0)+((8191&i)<<13)|0;u=(a+(i>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,n=Math.imul(j,J),i=Math.imul(j,tt),i=i+Math.imul(F,J)|0,a=Math.imul(F,tt),n=n+Math.imul(I,rt)|0,i=i+Math.imul(I,nt)|0,i=i+Math.imul(z,rt)|0,a=a+Math.imul(z,nt)|0,n=n+Math.imul(R,at)|0,i=i+Math.imul(R,ot)|0,i=i+Math.imul(O,at)|0,a=a+Math.imul(O,ot)|0,n=n+Math.imul(C,lt)|0,i=i+Math.imul(C,ut)|0,i=i+Math.imul(S,lt)|0,a=a+Math.imul(S,ut)|0,n=n+Math.imul(T,ft)|0,i=i+Math.imul(T,ht)|0,i=i+Math.imul(E,ft)|0,a=a+Math.imul(E,ht)|0,n=n+Math.imul(M,pt)|0,i=i+Math.imul(M,gt)|0,i=i+Math.imul(A,pt)|0,a=a+Math.imul(A,gt)|0;var Ct=(u+n|0)+((8191&i)<<13)|0;u=(a+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,n=Math.imul(j,rt),i=Math.imul(j,nt),i=i+Math.imul(F,rt)|0,a=Math.imul(F,nt),n=n+Math.imul(I,at)|0,i=i+Math.imul(I,ot)|0,i=i+Math.imul(z,at)|0,a=a+Math.imul(z,ot)|0,n=n+Math.imul(R,lt)|0,i=i+Math.imul(R,ut)|0,i=i+Math.imul(O,lt)|0,a=a+Math.imul(O,ut)|0,n=n+Math.imul(C,ft)|0,i=i+Math.imul(C,ht)|0,i=i+Math.imul(S,ft)|0,a=a+Math.imul(S,ht)|0,n=n+Math.imul(T,pt)|0,i=i+Math.imul(T,gt)|0,i=i+Math.imul(E,pt)|0,a=a+Math.imul(E,gt)|0;var St=(u+n|0)+((8191&i)<<13)|0;u=(a+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(j,at),i=Math.imul(j,ot),i=i+Math.imul(F,at)|0,a=Math.imul(F,ot),n=n+Math.imul(I,lt)|0,i=i+Math.imul(I,ut)|0,i=i+Math.imul(z,lt)|0,a=a+Math.imul(z,ut)|0,n=n+Math.imul(R,ft)|0,i=i+Math.imul(R,ht)|0,i=i+Math.imul(O,ft)|0,a=a+Math.imul(O,ht)|0,n=n+Math.imul(C,pt)|0,i=i+Math.imul(C,gt)|0,i=i+Math.imul(S,pt)|0,a=a+Math.imul(S,gt)|0;var Pt=(u+n|0)+((8191&i)<<13)|0;u=(a+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,n=Math.imul(j,lt),i=Math.imul(j,ut),i=i+Math.imul(F,lt)|0,a=Math.imul(F,ut),n=n+Math.imul(I,ft)|0,i=i+Math.imul(I,ht)|0,i=i+Math.imul(z,ft)|0,a=a+Math.imul(z,ht)|0,n=n+Math.imul(R,pt)|0,i=i+Math.imul(R,gt)|0,i=i+Math.imul(O,pt)|0,a=a+Math.imul(O,gt)|0;var Rt=(u+n|0)+((8191&i)<<13)|0;u=(a+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,n=Math.imul(j,ft),i=Math.imul(j,ht),i=i+Math.imul(F,ft)|0,a=Math.imul(F,ht),n=n+Math.imul(I,pt)|0,i=i+Math.imul(I,gt)|0,i=i+Math.imul(z,pt)|0,a=a+Math.imul(z,gt)|0;var Ot=(u+n|0)+((8191&i)<<13)|0;u=(a+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,n=Math.imul(j,pt),i=Math.imul(j,gt),i=i+Math.imul(F,pt)|0,a=Math.imul(F,gt);var Nt=(u+n|0)+((8191&i)<<13)|0;return u=(a+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,l[0]=vt,l[1]=mt,l[2]=yt,l[3]=bt,l[4]=xt,l[5]=_t,l[6]=wt,l[7]=Mt,l[8]=At,l[9]=kt,l[10]=Tt,l[11]=Et,l[12]=Lt,l[13]=Ct,l[14]=St,l[15]=Pt,l[16]=Rt,l[17]=Ot,l[18]=Nt,0!==u&&(l[19]=u,r.length++),r};Math.imul||(A=u),a.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?A(this,t,e):r<63?u(this,t,e):r<1024?c(this,t,e):f(this,t,e)},h.prototype.makeRBT=function(t){for(var e=new Array(t),r=a.prototype._countBits(t)-1,n=0;n>=1;return n},h.prototype.permute=function(t,e,r,n,i,a){for(var o=0;o>>=1)i++;return 1<>>=13,r[2*o+1]=8191&a,a>>>=13;for(o=2*e;o>=26,e+=i/67108864|0,e+=a>>>26,this.words[r]=67108863&a}return 0!==e&&(this.words[r]=e,this.length++),this},a.prototype.muln=function(t){return this.clone().imuln(t)},a.prototype.sqr=function(){return this.mul(this)},a.prototype.isqr=function(){return this.imul(this.clone())},a.prototype.pow=function(t){var e=l(t);if(0===e.length)return new a(1);for(var r=this,n=0;n=0);var e,r=t%26,i=(t-r)/26,a=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(e=0;e>>26-r}o&&(this.words[e]=o,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e=0);var i;i=e?(e-e%26)/26:0;var a=t%26,o=Math.min((t-a)/26,this.length),s=67108863^67108863>>>a<o)for(this.length-=o,u=0;u=0&&(0!==c||u>=i);u--){var f=0|this.words[u];this.words[u]=c<<26-a|f>>>a,c=f&s}return l&&0!==c&&(l.words[l.length++]=c),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},a.prototype.ishrn=function(t,e,r){return n(0===this.negative),this.iushrn(t,e,r)},a.prototype.shln=function(t){return this.clone().ishln(t)},a.prototype.ushln=function(t){return this.clone().iushln(t)},a.prototype.shrn=function(t){return this.clone().ishrn(t)},a.prototype.ushrn=function(t){return this.clone().iushrn(t)},a.prototype.testn=function(t){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,i=1<=0);var e=t%26,r=(t-e)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var i=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},a.prototype.isubn=function(t){if(n("number"==typeof t),n(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(l/67108864|0),this.words[i+r]=67108863&o}for(;i>26,this.words[i+r]=67108863&o;if(0===s)return this.strip();for(n(-1===s),s=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},a.prototype._wordDiv=function(t,e){var r=this.length-t.length,n=this.clone(),i=t,o=0|i.words[i.length-1];0!==(r=26-this._countBits(o))&&(i=i.ushln(r),n.iushln(r),o=0|i.words[i.length-1]);var s,l=n.length-i.length;if("mod"!==e){s=new a(null),s.length=l+1,s.words=new Array(s.length);for(var u=0;u=0;f--){var h=67108864*(0|n.words[i.length+f])+(0|n.words[i.length+f-1]);for(h=Math.min(h/o|0,67108863),n._ishlnsubmul(i,h,f);0!==n.negative;)h--,n.negative=0,n._ishlnsubmul(i,1,f),n.isZero()||(n.negative^=1);s&&(s.words[f]=h)}return s&&s.strip(),n.strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:s||null,mod:n}},a.prototype.divmod=function(t,e,r){if(n(!t.isZero()),this.isZero())return{div:new a(0),mod:new a(0)};var i,o,s;return 0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(i=s.div.neg()),"div"!==e&&(o=s.mod.neg(),r&&0!==o.negative&&o.iadd(t)),{div:i,mod:o}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(i=s.div.neg()),{div:i,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(o=s.mod.neg(),r&&0!==o.negative&&o.isub(t)),{div:s.div,mod:o}):t.length>this.length||this.cmp(t)<0?{div:new a(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new a(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new a(this.modn(t.words[0]))}:this._wordDiv(t,e)},a.prototype.div=function(t){return this.divmod(t,"div",!1).div},a.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},a.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},a.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,n=t.ushrn(1),i=t.andln(1),a=r.cmp(n);return a<0||1===i&&0===a?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},a.prototype.modn=function(t){n(t<=67108863);for(var e=(1<<26)%t,r=0,i=this.length-1;i>=0;i--)r=(e*r+(0|this.words[i]))%t;return r},a.prototype.idivn=function(t){n(t<=67108863);for(var e=0,r=this.length-1;r>=0;r--){var i=(0|this.words[r])+67108864*e;this.words[r]=i/t|0,e=i%t}return this.strip()},a.prototype.divn=function(t){return this.clone().idivn(t)},a.prototype.egcd=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new a(1),o=new a(0),s=new a(0),l=new a(1),u=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++u;for(var c=r.clone(),f=e.clone();!e.isZero();){for(var h=0,d=1;0==(e.words[0]&d)&&h<26;++h,d<<=1);if(h>0)for(e.iushrn(h);h-- >0;)(i.isOdd()||o.isOdd())&&(i.iadd(c),o.isub(f)),i.iushrn(1),o.iushrn(1);for(var p=0,g=1;0==(r.words[0]&g)&&p<26;++p,g<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(s.isOdd()||l.isOdd())&&(s.iadd(c),l.isub(f)),s.iushrn(1),l.iushrn(1);e.cmp(r)>=0?(e.isub(r),i.isub(s),o.isub(l)):(r.isub(e),s.isub(i),l.isub(o))}return{a:s,b:l,gcd:r.iushln(u)}},a.prototype._invmp=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new a(1),o=new a(0),s=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var l=0,u=1;0==(e.words[0]&u)&&l<26;++l,u<<=1);if(l>0)for(e.iushrn(l);l-- >0;)i.isOdd()&&i.iadd(s),i.iushrn(1);for(var c=0,f=1;0==(r.words[0]&f)&&c<26;++c,f<<=1);if(c>0)for(r.iushrn(c);c-- >0;)o.isOdd()&&o.iadd(s),o.iushrn(1);e.cmp(r)>=0?(e.isub(r),i.isub(o)):(r.isub(e),o.isub(i))}var h;return h=0===e.cmpn(1)?i:o,h.cmpn(0)<0&&h.iadd(t),h},a.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var n=0;e.isEven()&&r.isEven();n++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=e.cmp(r);if(i<0){var a=e;e=r,r=a}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.iushln(n)},a.prototype.invm=function(t){return this.egcd(t).a.umod(t)},a.prototype.isEven=function(){return 0==(1&this.words[0])},a.prototype.isOdd=function(){return 1==(1&this.words[0])},a.prototype.andln=function(t){return this.words[0]&t},a.prototype.bincn=function(t){n("number"==typeof t);var e=t%26,r=(t-e)/26,i=1<>>26,s&=67108863,this.words[o]=s}return 0!==a&&(this.words[o]=a,this.length++),this},a.prototype.isZero=function(){return 1===this.length&&0===this.words[0] },a.prototype.cmpn=function(t){var e=t<0;if(0!==this.negative&&!e)return-1;if(0===this.negative&&e)return 1;this.strip();var r;if(this.length>1)r=1;else{e&&(t=-t),n(t<=67108863,"Number is too big");var i=0|this.words[0];r=i===t?0:it.length)return 1;if(this.length=0;r--){var n=0|this.words[r],i=0|t.words[r];if(n!==i){ni&&(e=1);break}}return e},a.prototype.gtn=function(t){return 1===this.cmpn(t)},a.prototype.gt=function(t){return 1===this.cmp(t)},a.prototype.gten=function(t){return this.cmpn(t)>=0},a.prototype.gte=function(t){return this.cmp(t)>=0},a.prototype.ltn=function(t){return-1===this.cmpn(t)},a.prototype.lt=function(t){return-1===this.cmp(t)},a.prototype.lten=function(t){return this.cmpn(t)<=0},a.prototype.lte=function(t){return this.cmp(t)<=0},a.prototype.eqn=function(t){return 0===this.cmpn(t)},a.prototype.eq=function(t){return 0===this.cmp(t)},a.red=function(t){return new y(t)},a.prototype.toRed=function(t){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},a.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},a.prototype._forceRed=function(t){return this.red=t,this},a.prototype.forceRed=function(t){return n(!this.red,"Already a number in reduction context"),this._forceRed(t)},a.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},a.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},a.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},a.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},a.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},a.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},a.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},a.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},a.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},a.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},a.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},a.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},a.prototype.redPow=function(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var k={k256:null,p224:null,p192:null,p25519:null};d.prototype._tmp=function(){var t=new a(null);return t.words=new Array(Math.ceil(this.n/13)),t},d.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},d.prototype.split=function(t,e){t.iushrn(this.n,0,e)},d.prototype.imulK=function(t){return t.imul(this.k)},i(p,d),p.prototype.split=function(t,e){for(var r=Math.min(t.length,9),n=0;n>>22,i=a}i>>>=22,t.words[n-10]=i,0===i&&t.length>10?t.length-=10:t.length-=9},p.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},a._prime=function(t){if(k[t])return k[t];var e;if("k256"===t)e=new p;else if("p224"===t)e=new g;else if("p192"===t)e=new v;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new m}return k[t]=e,e},y.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},y.prototype._verify2=function(t,e){n(0==(t.negative|e.negative),"red works only with positives"),n(t.red&&t.red===e.red,"red works only with red numbers")},y.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},y.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},y.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)},y.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},y.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)},y.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},y.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},y.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},y.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},y.prototype.isqr=function(t){return this.imul(t,t.clone())},y.prototype.sqr=function(t){return this.mul(t,t)},y.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(n(e%2==1),3===e){var r=this.m.add(new a(1)).iushrn(2);return this.pow(t,r)}for(var i=this.m.subn(1),o=0;!i.isZero()&&0===i.andln(1);)o++,i.iushrn(1);n(!i.isZero());var s=new a(1).toRed(this),l=s.redNeg(),u=this.m.subn(1).iushrn(1),c=this.m.bitLength();for(c=new a(2*c*c).toRed(this);0!==this.pow(c,u).cmp(l);)c.redIAdd(l);for(var f=this.pow(c,i),h=this.pow(t,i.addn(1).iushrn(1)),d=this.pow(t,i),p=o;0!==d.cmp(s);){for(var g=d,v=0;0!==g.cmp(s);v++)g=g.redSqr();n(v=0;n--){for(var u=e.words[n],c=l-1;c>=0;c--){var f=u>>c&1;i!==r[0]&&(i=this.sqr(i)),0!==f||0!==o?(o<<=1,o|=f,(4===++s||0===n&&0===c)&&(i=this.mul(i,r[o]),s=0,o=0)):s=0}l=26}return i},y.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},y.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},a.mont=function(t){return new b(t)},i(b,y),b.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},b.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},b.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),a=i;return i.cmp(this.m)>=0?a=i.isub(this.m):i.cmpn(0)<0&&(a=i.iadd(this.m)),a._forceRed(this)},b.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new a(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},b.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(void 0===e||e,this)},{}],37:[function(t,e,r){"use strict";function n(t){var e,r,n,i=t.length,a=0;for(e=0;e>>1;if(!(s<=0)){var l,u=f.mallocDouble(2*s*a),c=f.mallocInt32(a);if((a=i(t,s,u,c))>0){if(1===s&&n)h.init(a),l=h.sweepComplete(s,r,0,a,u,c,0,a,u,c);else{var p=f.mallocDouble(2*s*o),g=f.mallocInt32(o);o=i(e,s,p,g),o>0&&(h.init(a+o),l=1===s?h.sweepBipartite(s,r,0,a,u,c,0,o,p,g):d(s,r,n,a,u,c,o,p,g),f.free(p),f.free(g))}f.free(u),f.free(c)}return l}}}function o(t,e){c.push([t,e])}function s(t){return c=[],a(t,t,o,!0),c}function l(t,e){return c=[],a(t,e,o,!1),c}function u(t,e,r){switch(arguments.length){case 1:return s(t);case 2:return"function"==typeof e?a(t,t,e,!0):l(t,e);case 3:return a(t,e,r,!1);default:throw new Error("box-intersect: Invalid arguments")}}e.exports=u;var c,f=t("typedarray-pool"),h=t("./lib/sweep"),d=t("./lib/intersect")},{"./lib/intersect":40,"./lib/sweep":44,"typedarray-pool":258}],39:[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*",a,";"],l="for(var i="+c+","+p+"="+u+"*"+c+";i<"+f+";++i,"+p+"+="+u+"){var x0="+h+"["+o+"+"+p+"],x1="+h+"["+o+"+"+p+"+"+a+"],xi="+d+"[i];",M="for(var j="+g+","+b+"="+u+"*"+g+";j<"+v+";++j,"+b+"+="+u+"){var y0="+m+"["+o+"+"+b+"],"+(r?"y1="+m+"["+o+"+"+b+"+"+a+"],":"")+"yi="+y+"[j];";return t?i.push(l,_,":",M):i.push(M,_,":",l),r?i.push("if(y1"+v+"-"+g+"){"),t?(e(!0,!1),o.push("}else{"),e(!1,!1)):(o.push("if("+l+"){"),e(!0,!0),o.push("}else{"),e(!0,!1),o.push("}}else{if("+l+"){"),e(!1,!0),o.push("}else{"),e(!1,!1),o.push("}")),o.push("}}return "+r);var s=i.join("")+o.join("");return new Function(s)()}var a="d",o="ax",s="vv",l="fp",u="es",c="rs",f="re",h="rb",d="ri",p="rp",g="bs",v="be",m="bb",y="bi",b="bp",x="rv",_="Q",w=[a,o,s,c,f,h,d,g,v,m,y];r.partial=i(!1),r.full=i(!0)},{}],40:[function(t,e,r){"use strict";function n(t,e){var r=8*u.log2(e+1)*(t+1)|0,n=u.nextPow2(k*r);E.length0;){P-=1;var O=P*k,N=E[O],I=E[O+1],z=E[O+2],D=E[O+3],j=E[O+4],F=E[O+5],B=P*T,U=L[B],V=L[B+1],H=1&F,q=!!(16&F),G=l,X=u,W=g,Y=C;if(H&&(G=g,X=C,W=l,Y=u),!(2&F&&(z=_(t,N,I,z,G,X,V),I>=z)||4&F&&(I=w(t,N,I,z,G,X,U))>=z)){var Z=z-I,Q=j-D;if(q){if(t*Z*(Z+Q)=p0)&&!(p1>=hi)",["p0","p1"]),x=g("lo===p0",["p0"]),_=g("lor&&i[f+e]>u;--c,f-=o){for(var h=f,d=f+o,p=0;p>>1,h=2*t,d=f,p=a[h*f+e];u=b?(d=y,p=b):m>=_?(d=v,p=m):(d=x,p=_):b>=_?(d=y,p=b):_>=m?(d=v,p=m):(d=x,p=_);for(var w=h*(c-1),M=h*d,A=0;A=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"},{}],43:[function(t,e,r){"use strict";function n(t,e){e<=4*h?i(0,e-1,t):f(0,e-1,t)}function i(t,e,r){for(var n=2*(t+1),i=t+1;i<=e;++i){for(var a=r[n++],o=r[n++],s=i,l=n-2;s-- >t;){var u=r[l-2],c=r[l-1];if(ur[e+1])}function c(t,e,r,n){t*=2;var i=n[t];return i>1,v=g-n,m=g+n,y=d,b=v,x=g,_=m,w=p,M=t+1,A=e-1,k=0;u(y,b,r)&&(k=y,y=b,b=k),u(_,w,r)&&(k=_,_=w,w=k),u(y,x,r)&&(k=y,y=x,x=k),u(b,x,r)&&(k=b,b=x,x=k),u(y,_,r)&&(k=y,y=_,_=k),u(x,_,r)&&(k=x,x=_,_=k),u(b,w,r)&&(k=b,b=w,w=k),u(b,x,r)&&(k=b,b=x,x=k),u(_,w,r)&&(k=_,_=w,w=k);for(var T=r[2*b],E=r[2*b+1],L=r[2*_],C=r[2*_+1],S=2*y,P=2*x,R=2*w,O=2*d,N=2*g,I=2*p,z=0;z<2;++z){var D=r[S+z],j=r[P+z],F=r[R+z];r[O+z]=D,r[N+z]=j,r[I+z]=F}o(v,t,r),o(m,e,r);for(var B=M;B<=A;++B)if(c(B,T,E,r))B!==M&&a(B,M,r),++M;else if(!c(B,L,C,r))for(;;){if(c(A,L,C,r)){c(A,T,E,r)?(s(B,M,A,r),++M,--A):(a(B,A,r),--A);break}if(--A>>1;h(x,E);for(var L=0,C=0,M=0;M=d)S=S-d|0,i(v,m,C--,S);else if(S>=0)i(p,g,L--,S);else if(S<=-d){S=-S-d|0;for(var P=0;P>>1;h(x,L);for(var C=0,S=0,P=0,A=0;A>1==x[2*A+3]>>1&&(O=2,A+=1),R<0){for(var N=-(R>>1)-1,I=0;I>1)-1;0===O?i(p,g,C--,N):1===O?i(v,m,S--,N):2===O&&i(y,b,P--,N)}}}function l(t,e,r,n,o,s,l,u,c,f,v,m){var y=0,b=2*t,_=e,w=e+t,M=1,A=1;n?A=d:M=d;for(var k=o;k>>1;h(x,C);for(var S=0,k=0;k=d?(R=!n,T-=d):(R=!!n,T-=1),R)a(p,g,S++,T);else{var O=m[T],N=b*T,I=v[N+e+1],z=v[N+e+1+t];t:for(var D=0;D>>1;h(x,M);for(var A=0,y=0;y=d)p[A++]=b-d;else{b-=1;var T=c[b],E=g*b,L=u[E+e+1],C=u[E+e+1+t];t:for(var S=0;S=0;--S)if(p[S]===b){for(var N=S+1;NZ)throw new RangeError("Invalid typed array length");var e=new Uint8Array(t);return e.__proto__=i.prototype,e}function i(t,e,r){if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return l(t)}return a(t,e,r)}function a(t,e,r){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return t instanceof ArrayBuffer?f(t,e,r):"string"==typeof t?u(t,e):h(t)}function o(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function s(t,e,r){return o(t),t<=0?n(t):void 0!==e?"string"==typeof r?n(t).fill(e,r):n(t).fill(e):n(t)}function l(t){return o(t),n(t<0?0:0|d(t))}function u(t,e){if("string"==typeof e&&""!==e||(e="utf8"),!i.isEncoding(e))throw new TypeError('"encoding" must be a valid string encoding');var r=0|g(t,e),a=n(r),o=a.write(t,e);return o!==r&&(a=a.slice(0,o)),a}function c(t){for(var e=t.length<0?0:0|d(t.length),r=n(e),i=0;i=Z)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Z.toString(16)+" bytes");return 0|t}function p(t){return+t!=t&&(t=0),i.alloc(+t)}function g(t,e){if(i.isBuffer(t))return t.length;if(G(t)||t instanceof ArrayBuffer)return t.byteLength;"string"!=typeof t&&(t=""+t);var r=t.length;if(0===r)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return B(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return H(t).length;default:if(n)return B(t).length;e=(""+e).toLowerCase(),n=!0}}function v(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if(r>>>=0,e>>>=0,r<=e)return"";for(t||(t="utf8");;)switch(t){case"hex":return P(this,e,r);case"utf8":case"utf-8":return E(this,e,r);case"ascii":return C(this,e,r);case"latin1":case"binary":return S(this,e,r);case"base64":return T(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return R(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function m(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function y(t,e,r,n,a){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,X(r)&&(r=a?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(a)return-1;r=t.length-1}else if(r<0){if(!a)return-1;r=0}if("string"==typeof e&&(e=i.from(e,n)),i.isBuffer(e))return 0===e.length?-1:b(t,e,r,n,a);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?a?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):b(t,[e],r,n,a);throw new TypeError("val must be string, number or Buffer")}function b(t,e,r,n,i){function a(t,e){return 1===o?t[e]:t.readUInt16BE(e*o)}var o=1,s=t.length,l=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;o=2,s/=2,l/=2,r/=2}var u;if(i){var c=-1;for(u=r;us&&(r=s-l),u=r;u>=0;u--){for(var f=!0,h=0;hi&&(n=i):n=i;var a=e.length;if(a%2!=0)throw new TypeError("Invalid hex string");n>a/2&&(n=a/2);for(var o=0;o239?4:a>223?3:a>191?2:1;if(i+s<=r){var l,u,c,f;switch(s){case 1:a<128&&(o=a);break;case 2:l=t[i+1],128==(192&l)&&(f=(31&a)<<6|63&l)>127&&(o=f);break;case 3:l=t[i+1],u=t[i+2],128==(192&l)&&128==(192&u)&&(f=(15&a)<<12|(63&l)<<6|63&u)>2047&&(f<55296||f>57343)&&(o=f);break;case 4:l=t[i+1],u=t[i+2],c=t[i+3],128==(192&l)&&128==(192&u)&&128==(192&c)&&(f=(15&a)<<18|(63&l)<<12|(63&u)<<6|63&c)>65535&&f<1114112&&(o=f)}}null===o?(o=65533,s=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|1023&o),n.push(o),i+=s}return L(n)}function L(t){var e=t.length;if(e<=Q)return String.fromCharCode.apply(String,t);for(var r="",n=0;nn)&&(r=n);for(var i="",a=e;ar)throw new RangeError("Trying to access beyond buffer length")}function N(t,e,r,n,a,o){if(!i.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>a||et.length)throw new RangeError("Index out of range")}function I(t,e,r,n,i,a){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function z(t,e,r,n,i){return e=+e,r>>>=0,i||I(t,e,r,4,3.4028234663852886e38,-3.4028234663852886e38),Y.write(t,e,r,n,23,4),r+4}function D(t,e,r,n,i){return e=+e,r>>>=0,i||I(t,e,r,8,1.7976931348623157e308,-1.7976931348623157e308),Y.write(t,e,r,n,52,8),r+8}function j(t){if(t=t.trim().replace($,""),t.length<2)return"";for(;t.length%4!=0;)t+="=";return t}function F(t){return t<16?"0"+t.toString(16):t.toString(16)}function B(t,e){e=e||1/0;for(var r,n=t.length,i=null,a=[],o=0;o55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&a.push(239,191,189);continue}if(o+1===n){(e-=3)>-1&&a.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&a.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&a.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;a.push(r)}else if(r<2048){if((e-=2)<0)break;a.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;a.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;a.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return a}function U(t){for(var e=[],r=0;r>8,i=r%256,a.push(i),a.push(n);return a}function H(t){return W.toByteArray(j(t))}function q(t,e,r,n){for(var i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function G(t){return"function"==typeof ArrayBuffer.isView&&ArrayBuffer.isView(t)}function X(t){return t!==t}var W=t("base64-js"),Y=t("ieee754");r.Buffer=i,r.SlowBuffer=p,r.INSPECT_MAX_BYTES=50;var Z=2147483647;r.kMaxLength=Z,i.TYPED_ARRAY_SUPPORT=function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()}catch(t){return!1}}(),i.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),"undefined"!=typeof Symbol&&Symbol.species&&i[Symbol.species]===i&&Object.defineProperty(i,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),i.poolSize=8192,i.from=function(t,e,r){return a(t,e,r)},i.prototype.__proto__=Uint8Array.prototype,i.__proto__=Uint8Array,i.alloc=function(t,e,r){return s(t,e,r)},i.allocUnsafe=function(t){return l(t)},i.allocUnsafeSlow=function(t){return l(t)},i.isBuffer=function(t){return null!=t&&!0===t._isBuffer},i.compare=function(t,e){if(!i.isBuffer(t)||!i.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,n=e.length,a=0,o=Math.min(r,n);a0&&(t=this.toString("hex",0,e).match(/.{2}/g).join(" "),this.length>e&&(t+=" ... ")),""},i.prototype.compare=function(t,e,r,n,a){if(!i.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===a&&(a=this.length), -e<0||r>t.length||n<0||a>this.length)throw new RangeError("out of range index");if(n>=a&&e>=r)return 0;if(n>=a)return-1;if(e>=r)return 1;if(e>>>=0,r>>>=0,n>>>=0,a>>>=0,this===t)return 0;for(var o=a-n,s=r-e,l=Math.min(o,s),u=this.slice(n,a),c=t.slice(e,r),f=0;f>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-e;if((void 0===r||r>i)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var a=!1;;)switch(n){case"hex":return x(this,t,e,r);case"utf8":case"utf-8":return _(this,t,e,r);case"ascii":return w(this,t,e,r);case"latin1":case"binary":return M(this,t,e,r);case"base64":return A(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return k(this,t,e,r);default:if(a)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),a=!0}},i.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Q=4096;i.prototype.slice=function(t,e){var r=this.length;t=~~t,e=void 0===e?r:~~e,t<0?(t+=r)<0&&(t=0):t>r&&(t=r),e<0?(e+=r)<0&&(e=0):e>r&&(e=r),e>>=0,e>>>=0,r||O(t,e,this.length);for(var n=this[t],i=1,a=0;++a>>=0,e>>>=0,r||O(t,e,this.length);for(var n=this[t+--e],i=1;e>0&&(i*=256);)n+=this[t+--e]*i;return n},i.prototype.readUInt8=function(t,e){return t>>>=0,e||O(t,1,this.length),this[t]},i.prototype.readUInt16LE=function(t,e){return t>>>=0,e||O(t,2,this.length),this[t]|this[t+1]<<8},i.prototype.readUInt16BE=function(t,e){return t>>>=0,e||O(t,2,this.length),this[t]<<8|this[t+1]},i.prototype.readUInt32LE=function(t,e){return t>>>=0,e||O(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},i.prototype.readUInt32BE=function(t,e){return t>>>=0,e||O(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},i.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||O(t,e,this.length);for(var n=this[t],i=1,a=0;++a=i&&(n-=Math.pow(2,8*e)),n},i.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||O(t,e,this.length);for(var n=e,i=1,a=this[t+--n];n>0&&(i*=256);)a+=this[t+--n]*i;return i*=128,a>=i&&(a-=Math.pow(2,8*e)),a},i.prototype.readInt8=function(t,e){return t>>>=0,e||O(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},i.prototype.readInt16LE=function(t,e){t>>>=0,e||O(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},i.prototype.readInt16BE=function(t,e){t>>>=0,e||O(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},i.prototype.readInt32LE=function(t,e){return t>>>=0,e||O(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},i.prototype.readInt32BE=function(t,e){return t>>>=0,e||O(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},i.prototype.readFloatLE=function(t,e){return t>>>=0,e||O(t,4,this.length),Y.read(this,t,!0,23,4)},i.prototype.readFloatBE=function(t,e){return t>>>=0,e||O(t,4,this.length),Y.read(this,t,!1,23,4)},i.prototype.readDoubleLE=function(t,e){return t>>>=0,e||O(t,8,this.length),Y.read(this,t,!0,52,8)},i.prototype.readDoubleBE=function(t,e){return t>>>=0,e||O(t,8,this.length),Y.read(this,t,!1,52,8)},i.prototype.writeUIntLE=function(t,e,r,n){if(t=+t,e>>>=0,r>>>=0,!n){N(this,t,e,r,Math.pow(2,8*r)-1,0)}var i=1,a=0;for(this[e]=255&t;++a>>=0,r>>>=0,!n){N(this,t,e,r,Math.pow(2,8*r)-1,0)}var i=r-1,a=1;for(this[e+i]=255&t;--i>=0&&(a*=256);)this[e+i]=t/a&255;return e+r},i.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,1,255,0),this[e]=255&t,e+1},i.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},i.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},i.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},i.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},i.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var i=Math.pow(2,8*r-1);N(this,t,e,r,i-1,-i)}var a=0,o=1,s=0;for(this[e]=255&t;++a>0)-s&255;return e+r},i.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var i=Math.pow(2,8*r-1);N(this,t,e,r,i-1,-i)}var a=r-1,o=1,s=0;for(this[e+a]=255&t;--a>=0&&(o*=256);)t<0&&0===s&&0!==this[e+a+1]&&(s=1),this[e+a]=(t/o>>0)-s&255;return e+r},i.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},i.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},i.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},i.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},i.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},i.prototype.writeFloatLE=function(t,e,r){return z(this,t,e,!0,r)},i.prototype.writeFloatBE=function(t,e,r){return z(this,t,e,!1,r)},i.prototype.writeDoubleLE=function(t,e,r){return D(this,t,e,!0,r)},i.prototype.writeDoubleBE=function(t,e,r){return D(this,t,e,!1,r)},i.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&&n=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e=0;--i)t[i+e]=this[i+r];else if(a<1e3)for(i=0;i>>=0,r=void 0===r?this.length:r>>>0,t||(t=0);var o;if("number"==typeof t)for(o=e;o0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===t[e-2]?2:"="===t[e-1]?1:0}function i(t){return 3*t.length/4-n(t)}function a(t){var e,r,i,a,o,s,l=t.length;o=n(t),s=new f(3*l/4-o),i=o>0?l-4:l;var u=0;for(e=0,r=0;e>16&255,s[u++]=a>>8&255,s[u++]=255&a;return 2===o?(a=c[t.charCodeAt(e)]<<2|c[t.charCodeAt(e+1)]>>4,s[u++]=255&a):1===o&&(a=c[t.charCodeAt(e)]<<10|c[t.charCodeAt(e+1)]<<4|c[t.charCodeAt(e+2)]>>2,s[u++]=a>>8&255,s[u++]=255&a),s}function o(t){return u[t>>18&63]+u[t>>12&63]+u[t>>6&63]+u[63&t]}function s(t,e,r){for(var n,i=[],a=e;al?l:o+16383));return 1===n?(e=t[r-1],i+=u[e>>2],i+=u[e<<4&63],i+="=="):2===n&&(e=(t[r-2]<<8)+t[r-1],i+=u[e>>10],i+=u[e>>4&63],i+=u[e<<2&63],i+="="),a.push(i),a.join("")}r.byteLength=i,r.toByteArray=a,r.fromByteArray=l;for(var u=[],c=[],f="undefined"!=typeof Uint8Array?Uint8Array:Array,h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",d=0,p=h.length;d0;){for(var c=r.pop(),s=r.pop(),f=-1,h=-1,l=o[s],p=1;p=0||(e.flip(s,c),n(t,e,r,f,s,h),n(t,e,r,s,h,f),n(t,e,r,h,c,f),n(t,e,r,c,f,h)))}}var a=t("robust-in-sphere")[4];t("binary-search-bounds");e.exports=i},{"binary-search-bounds":52,"robust-in-sphere":229}],49:[function(t,e,r){"use strict";function n(t,e,r,n,i,a,o){this.cells=t,this.neighbor=e,this.flags=n,this.constraint=r,this.active=i,this.next=a,this.boundary=o}function i(t,e){return t[0]-e[0]||t[1]-e[1]||t[2]-e[2]}function a(t,e){for(var r=t.cells(),a=r.length,o=0;o0||l.length>0;){for(;s.length>0;){var d=s.pop();if(u[d]!==-i){u[d]=i;for(var p=(c[d],0);p<3;++p){var g=h[3*d+p];g>=0&&0===u[g]&&(f[3*d+p]?l.push(g):(s.push(g),u[g]=i))}}}var v=l;l=s,s=v,l.length=0,i=-i}var m=o(c,u,e);return r?m.concat(n.boundary):m}var l=t("binary-search-bounds");e.exports=s,n.prototype.locate=function(){var t=[0,0,0];return function(e,r,n){var a=e,o=r,s=n;return r1&&d(r[c[f-2]],r[c[f-1]],n)>0;)t.push([c[f-1],c[f-2],i]),f-=1;c.length=f,c.push(i);for(var p=u.upperIds,f=p.length;f>1&&d(r[p[f-2]],r[p[f-1]],n)<0;)t.push([p[f-2],p[f-1],i]),f-=1;p.length=f,p.push(i)}}function l(t,e){var r;return(r=t.a[0]m[0]&&l.push(new i(m,d,v,f),new i(d,m,g,f))}l.sort(a);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=[],f=0,_=l.length;f<_;++f){var w=l[f],M=w.type;M===p?s(x,b,t,w.a,w.idx):M===v?u(b,t,w):c(b,t,w)}return x}var h=t("binary-search-bounds"),d=t("robust-orientation")[3],p=0,g=1,v=2;e.exports=f},{"binary-search-bounds":52,"robust-orientation":231}],51:[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;n=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;n>>1,x=a[m]"];return i?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("}"),i?a.push("return -1};"):a.push("return i};"),a.join("")}function i(t,e,r,i){return 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(""))()}e.exports={ge:i(">=",!1,"GE"),gt:i(">",!1,"GT"),lt:i("<",!0,"LT"),le:i("<=",!0,"LE"),eq:i("-",!0,"EQ",!0)}},{}],53:[function(t,e,r){"use strict";function n(t){for(var e=1,r=1;rr?r:t:te?e:t}e.exports=n},{}],57:[function(t,e,r){"use strict";function n(t){var e=_(t);return[M(e,-1/0),M(e,1/0)]}function i(t,e){for(var r=new Array(e.length),n=0;n=0;--a){var p=n[a];o=p[0];var g=e[o],v=g[0],m=g[1],y=t[v],M=t[m];if((y[0]-M[0]||y[1]-M[1])<0){var k=v;v=m,m=k}g[0]=v;var T,E=g[1]=p[1];for(i&&(T=g[2]);a>0&&n[a-1][0]===o;){var p=n[--a],L=p[1];i?e.push([E,L,T]):e.push([E,L]),E=L}i?e.push([E,m,T]):e.push([E,m])}return s}function u(t,e,r){for(var i=e.length,a=new v(i),o=[],s=0;se[2]?1:0)}function h(t,e,r){if(0!==t.length){if(e)for(var n=0;n0||d.length>0)}function g(t,e,r){var n;if(r){n=e;for(var i=new Array(e.length),a=0;a10&&/[0-9](?:\s|\/)/.test(t)&&(n=t.match(/([0-9]+)/g).map(function(t){return parseFloat(t)}),r=t.match(/([a-z])/gi).join("").toLowerCase());else"number"==typeof t?(r="rgb",n=[t>>>16,(65280&t)>>>8,255&t]):a(t)?(null!=t.r?(n=[t.r,t.g,t.b],r="rgb"):null!=t.red?(n=[t.red,t.green,t.blue],r="rgb"):null!=t.h?(n=[t.h,t.s,t.l],r="hsl"):null!=t.hue&&(n=[t.hue,t.saturation,t.lightness],r="hsl"),null!=t.a?s=t.a:null!=t.alpha?s=t.alpha:null!=t.opacity&&(s=t.opacity/100)):(Array.isArray(t)||ArrayBuffer.isView(t))&&(n=[t[0],t[1],t[2]],r="rgb",s=4===t.length?t[3]:1);return{space:r,values:n,alpha:s}}e.exports=n;var i=t("color-name"),a=t("is-plain-obj"),o={red:0,orange:60,yellow:120,green:180,blue:240,purple:300}},{"color-name":60,"is-plain-obj":180}],62:[function(t,e,r){"use strict";var n=t("color-parse"),i=t("color-space/hsl"),a=t("clamp");e.exports=function(t,e){null==e&&(e=!0);var r=n(t);if(!r.space)return[];if(Array.isArray(t))return t;var o,s=r.values,l=s.length;for(o=0;o1&&n--,a=6*n<1?e+6*(r-e)*n:2*n<1?r:3*n<2?e+(r-e)*(2/3-n)*6:e,i[u]=255*a;return i}},n.hsl=function(t){var e,r,n,i=t[0]/255,a=t[1]/255,o=t[2]/255,s=Math.min(i,a,o),l=Math.max(i,a,o),u=l-s;return l===s?e=0:i===l?e=(a-o)/u:a===l?e=2+(o-i)/u:o===l&&(e=4+(i-a)/u),e=Math.min(60*e,360),e<0&&(e+=360),n=(s+l)/2,r=l===s?0:n<=.5?u/(l+s):u/(2-l-s),[e,100*r,100*n]}},{"./rgb":64}],64:[function(t,e,r){"use strict";e.exports={name:"rgb",min:[0,0,0],max:[255,255,255],channel:["red","green","blue"],alias:["RGB"]}},{}],65:[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]}],viridis:[{index:0,rgb:[68,1,84]},{index:.13,rgb:[71,44,122]},{index:.25,rgb:[59,81,139]},{index:.38,rgb:[44,113,142]},{index:.5,rgb:[33,144,141]},{index:.63,rgb:[39,173,129]},{index:.75,rgb:[92,200,99]},{index:.88,rgb:[170,220,50]},{index:1,rgb:[253,231,37]}],inferno:[{index:0,rgb:[0,0,4]},{index:.13,rgb:[31,12,72]},{index:.25,rgb:[85,15,109]},{index:.38,rgb:[136,34,106]},{index:.5,rgb:[186,54,85]},{index:.63,rgb:[227,89,51]},{index:.75,rgb:[249,140,10]},{index:.88,rgb:[249,201,50]},{index:1,rgb:[252,255,164]}],magma:[{index:0,rgb:[0,0,4]},{index:.13,rgb:[28,16,68]},{index:.25,rgb:[79,18,123]},{index:.38,rgb:[129,37,129]},{index:.5,rgb:[181,54,122]},{index:.63,rgb:[229,80,100]},{index:.75,rgb:[251,135,97]},{index:.88,rgb:[254,194,135]},{index:1,rgb:[252,253,191]}],plasma:[{index:0,rgb:[13,8,135]},{index:.13,rgb:[75,3,161]},{index:.25,rgb:[125,3,168]},{index:.38,rgb:[168,34,150]},{index:.5,rgb:[203,70,121]},{index:.63,rgb:[229,107,93]},{index:.75,rgb:[248,148,65]},{index:.88,rgb:[253,195,40]},{index:1,rgb:[240,249,33]}],warm:[{index:0,rgb:[125,0,179]},{index:.13,rgb:[172,0,187]},{index:.25,rgb:[219,0,170]},{index:.38,rgb:[255,0,130]},{index:.5,rgb:[255,63,74]},{index:.63,rgb:[255,123,0]},{index:.75,rgb:[234,176,0]},{index:.88,rgb:[190,228,0]},{index:1,rgb:[147,255,0]}],cool:[{index:0,rgb:[125,0,179]},{index:.13,rgb:[116,0,218]},{index:.25,rgb:[98,74,237]},{index:.38,rgb:[68,146,231]},{index:.5,rgb:[0,204,197]},{index:.63,rgb:[0,247,146]},{index:.75,rgb:[0,255,88]},{index:.88,rgb:[40,255,8]},{index:1,rgb:[147,255,0]}],"rainbow-soft":[{index:0,rgb:[125,0,179]},{index:.1,rgb:[199,0,180]},{index:.2,rgb:[255,0,121]},{index:.3,rgb:[255,108,0]},{index:.4,rgb:[222,194,0]},{index:.5,rgb:[150,255,0]},{index:.6,rgb:[0,255,55]},{index:.7,rgb:[0,246,150]},{index:.8,rgb:[50,167,222]},{index:.9,rgb:[103,51,235]},{index:1,rgb:[124,0,186]}],bathymetry:[{index:0,rgb:[40,26,44]},{index:.13,rgb:[59,49,90]},{index:.25,rgb:[64,76,139]},{index:.38,rgb:[63,110,151]},{index:.5,rgb:[72,142,158]},{index:.63,rgb:[85,174,163]},{index:.75,rgb:[120,206,163]},{index:.88,rgb:[187,230,172]},{index:1,rgb:[253,254,204]}],cdom:[{index:0,rgb:[47,15,62]},{index:.13,rgb:[87,23,86]},{index:.25,rgb:[130,28,99]},{index:.38,rgb:[171,41,96]},{index:.5,rgb:[206,67,86]},{index:.63,rgb:[230,106,84]},{index:.75,rgb:[242,149,103]},{index:.88,rgb:[249,193,135]},{index:1,rgb:[254,237,176]}],chlorophyll:[{index:0,rgb:[18,36,20]},{index:.13,rgb:[25,63,41]},{index:.25,rgb:[24,91,59]},{index:.38,rgb:[13,119,72]},{index:.5,rgb:[18,148,80]},{index:.63,rgb:[80,173,89]},{index:.75,rgb:[132,196,122]},{index:.88,rgb:[175,221,162]},{index:1,rgb:[215,249,208]}],density:[{index:0,rgb:[54,14,36]},{index:.13,rgb:[89,23,80]},{index:.25,rgb:[110,45,132]},{index:.38,rgb:[120,77,178]},{index:.5,rgb:[120,113,213]},{index:.63,rgb:[115,151,228]},{index:.75,rgb:[134,185,227]},{index:.88,rgb:[177,214,227]},{index:1,rgb:[230,241,241]}],"freesurface-blue":[{index:0,rgb:[30,4,110]},{index:.13,rgb:[47,14,176]},{index:.25,rgb:[41,45,236]},{index:.38,rgb:[25,99,212]},{index:.5,rgb:[68,131,200]},{index:.63,rgb:[114,156,197]},{index:.75,rgb:[157,181,203]},{index:.88,rgb:[200,208,216]},{index:1,rgb:[241,237,236]}],"freesurface-red":[{index:0,rgb:[60,9,18]},{index:.13,rgb:[100,17,27]},{index:.25,rgb:[142,20,29]},{index:.38,rgb:[177,43,27]},{index:.5,rgb:[192,87,63]},{index:.63,rgb:[205,125,105]},{index:.75,rgb:[216,162,148]},{index:.88,rgb:[227,199,193]},{index:1,rgb:[241,237,236]}],oxygen:[{index:0,rgb:[64,5,5]},{index:.13,rgb:[106,6,15]},{index:.25,rgb:[144,26,7]},{index:.38,rgb:[168,64,3]},{index:.5,rgb:[188,100,4]},{index:.63,rgb:[206,136,11]},{index:.75,rgb:[220,174,25]},{index:.88,rgb:[231,215,44]},{index:1,rgb:[248,254,105]}],par:[{index:0,rgb:[51,20,24]},{index:.13,rgb:[90,32,35]},{index:.25,rgb:[129,44,34]},{index:.38,rgb:[159,68,25]},{index:.5,rgb:[182,99,19]},{index:.63,rgb:[199,134,22]},{index:.75,rgb:[212,171,35]},{index:.88,rgb:[221,210,54]},{index:1,rgb:[225,253,75]}],phase:[{index:0,rgb:[145,105,18]},{index:.13,rgb:[184,71,38]},{index:.25,rgb:[186,58,115]},{index:.38,rgb:[160,71,185]},{index:.5,rgb:[110,97,218]},{index:.63,rgb:[50,123,164]},{index:.75,rgb:[31,131,110]},{index:.88,rgb:[77,129,34]},{index:1,rgb:[145,105,18]}],salinity:[{index:0,rgb:[42,24,108]},{index:.13,rgb:[33,50,162]},{index:.25,rgb:[15,90,145]},{index:.38,rgb:[40,118,137]},{index:.5,rgb:[59,146,135]},{index:.63,rgb:[79,175,126]},{index:.75,rgb:[120,203,104]},{index:.88,rgb:[193,221,100]},{index:1,rgb:[253,239,154]}],temperature:[{index:0,rgb:[4,35,51]},{index:.13,rgb:[23,51,122]},{index:.25,rgb:[85,59,157]},{index:.38,rgb:[129,79,143]},{index:.5,rgb:[175,95,130]},{index:.63,rgb:[222,112,101]},{index:.75,rgb:[249,146,66]},{index:.88,rgb:[249,196,65]},{index:1,rgb:[232,250,91]}],turbidity:[{index:0,rgb:[34,31,27]},{index:.13,rgb:[65,50,41]},{index:.25,rgb:[98,69,52]},{index:.38,rgb:[131,89,57]},{index:.5,rgb:[161,112,59]},{index:.63,rgb:[185,140,66]},{index:.75,rgb:[202,174,88]},{index:.88,rgb:[216,209,126]},{index:1,rgb:[233,246,171]}],"velocity-blue":[{index:0,rgb:[17,32,64]},{index:.13,rgb:[35,52,116]},{index:.25,rgb:[29,81,156]},{index:.38,rgb:[31,113,162]},{index:.5,rgb:[50,144,169]},{index:.63,rgb:[87,173,176]},{index:.75,rgb:[149,196,189]},{index:.88,rgb:[203,221,211]},{index:1,rgb:[254,251,230]}],"velocity-green":[{index:0,rgb:[23,35,19]},{index:.13,rgb:[24,64,38]},{index:.25,rgb:[11,95,45]},{index:.38,rgb:[39,123,35]},{index:.5,rgb:[95,146,12]},{index:.63,rgb:[152,165,18]},{index:.75,rgb:[201,186,69]},{index:.88,rgb:[233,216,137]},{index:1,rgb:[255,253,205]}],cubehelix:[{index:0,rgb:[0,0,0]},{index:.07,rgb:[22,5,59]},{index:.13,rgb:[60,4,105]},{index:.2,rgb:[109,1,135]},{index:.27,rgb:[161,0,147]},{index:.33,rgb:[210,2,142]},{index:.4,rgb:[251,11,123]},{index:.47,rgb:[255,29,97]},{index:.53,rgb:[255,54,69]},{index:.6,rgb:[255,85,46]},{index:.67,rgb:[255,120,34]},{index:.73,rgb:[255,157,37]},{index:.8,rgb:[241,191,57]},{index:.87,rgb:[224,220,93]},{index:.93,rgb:[218,241,142]},{index:1,rgb:[227,253,198]}]}},{}],66:[function(t,e,r){"use strict";function n(t){var e,r,n,u,c,f,h,d,p,g,v,m,y,b=[],x=[],_=[],w=[];if(o.isPlainObject(t)||(t={}),p=t.nshades||72,d=t.format||"hex",h=t.colormap,h||(h="jet"),"string"==typeof h){if(h=h.toLowerCase(),!l[h])throw Error(h+" not a supported colorscale");f=s(l[h])}else{if(!Array.isArray(h))throw Error("unsupported colormap option",h);f=s(h)}if(f.length>p)throw new Error(h+" map requires nshades to be at least size "+f.length);for(v=Array.isArray(t.alpha)?2!==t.alpha.length?[1,1]:s(t.alpha):"number"==typeof t.alpha?[t.alpha,t.alpha]:[1,1],e=f.map(function(t){return Math.round(t.index*p)}),v[0]<0&&(v[0]=0),v[1]<0&&(v[0]=0),v[0]>1&&(v[0]=1),v[1]>1&&(v[0]=1),y=0;y=0&&r[3]<=1||(r[3]=v[0]+(v[1]-v[0])*m);for(y=0;y=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);return c===n(t,e,i)?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 f=a(t,e,r);return f>0?s>0&&a(t,e,i)>0?1:-1:f<0?s>0||a(t,e,i)>0?1:-1:a(t,e,i)>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":231,"robust-product":232,"robust-sum":236,signum:237,"two-sum":257}],68:[function(t,e,r){function n(t,e){return t-e}function i(t,e){var r=t.length,i=t.length-e.length;if(i)return i;switch(r){case 0:return 0;case 1:return t[0]-e[0];case 2:return t[0]+t[1]-e[0]-e[1]||a(t[0],t[1])-a(e[0],e[1]);case 3:var o=t[0]+t[1],s=e[0]+e[1];if(i=o+t[2]-(s+e[2]))return i;var l=a(t[0],t[1]),u=a(e[0],e[1]);return a(l,t[2])-a(u,e[2])||a(l+t[2],o)-a(u+e[2],s);case 4:var c=t[0],f=t[1],h=t[2],d=t[3],p=e[0],g=e[1],v=e[2],m=e[3];return c+f+h+d-(p+g+v+m)||a(c,f,h,d)-a(p,g,v,m,p)||a(c+f,c+h,c+d,f+h,f+d,h+d)-a(p+g,p+v,p+m,g+v,g+m,v+m)||a(c+f+h,c+f+d,c+h+d,f+h+d)-a(p+g+v,p+g+m,p+v+m,g+v+m);default:for(var y=t.slice().sort(n),b=e.slice().sort(n),x=0;xt[r][0]&&(r=n);return er?[[r],[e]]:[[e]]}e.exports=n},{}],72:[function(t,e,r){"use strict";function n(t){var e=i(t),r=e.length;if(r<=2)return[];for(var n=new Array(r),a=e[r-1],o=0;o=e[l]&&(s+=1);a[o]=s}}return t}function a(t,e){try{return o(t,!0)}catch(u){var r=s(t);if(r.length<=e)return[];var a=n(t,r),l=o(a,!0);return i(l,r)}}e.exports=a;var o=t("incremental-convex-hull"),s=t("affine-hull")},{"affine-hull":12,"incremental-convex-hull":173}],74:[function(t,e,r){"use strict";function n(t,e,r,n,i,a){var o=6*i*i-6*i,s=3*i*i-4*i+1,l=-6*i*i+6*i,u=3*i*i-2*i;if(t.length){a||(a=new Array(t.length));for(var c=t.length-1;c>=0;--c)a[c]=o*t[c]+s*e[c]+l*r[c]+u*n[c];return a}return o*t+s*e+l*r[c]+u*n}function i(t,e,r,n,i,a){var o=i-1,s=i*i,l=o*o,u=(1+2*i)*l,c=i*l,f=s*(3-2*i),h=s*o;if(t.length){a||(a=new Array(t.length));for(var d=t.length-1;d>=0;--d)a[d]=u*t[d]+c*e[d]+f*r[d]+h*n[d];return a}return u*t+c*e+f*r+h*n}e.exports=i,e.exports.derivative=n},{}],75:[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"===o)e.scalarArgs.push(i),e.shimArgs.push("scalar"+i);else if("index"===o){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"===o){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,a(e)}var a=t("./lib/thunk.js");e.exports=i},{"./lib/thunk.js":77}],76:[function(t,e,r){"use strict";function n(t,e,r){var n,i,a=t.length,o=e.arrayArgs.length,s=e.indexArgs.length>0,l=[],u=[],c=0,f=0;for(n=0;n0&&l.push("var "+u.join(",")),n=a-1;n>=0;--n)c=t[n],l.push(["for(i",n,"=0;i",n,"0&&l.push(["index[",f,"]-=s",f].join("")),l.push(["++index[",c,"]"].join(""))),l.push("}")}return l.join("\n")}function i(t,e,r,i){for(var a=e.length,o=r.arrayArgs.length,s=r.blockSize,l=r.indexArgs.length>0,u=[],c=0;c0;){"].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;c0&&(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),f=0;f0&&_.push("shape=SS.slice(0)"),t.indexArgs.length>0){for(var w=new Array(r),f=0;f0&&x.push("var "+_.join(","));for(var f=0;f3&&x.push(o(t.pre,t,c));var T=o(t.body,t,c),E=a(v);E3&&x.push(o(t.post,t,c)),t.debug&&console.log("-----Generated cwise routine for ",e,":\n"+x.join("\n")+"\n----------");var L=[t.funcName||"unnamed","_cwise_loop_",l[0].join("s"),"m",E,s(c)].join("");return new Function(["function ",L,"(",b.join(","),"){",x.join("\n"),"} return ",L].join(""))()}var u=t("uniq");e.exports=l},{uniq:260}],77:[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 a=[],o=[],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"+f+".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"+f+".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--\x3e0;) {"),e.push("if (!("+u.join(" && ")+")) throw new Error('cwise: Arrays do not all have the same shape!')"),e.push("}"));for(var c=0;ce?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,r,n,i){for(arguments.length<3&&(n=0),arguments.length<4&&(i=e.length);n>>1;t(e[a],r)<0?n=a+1:i=a}return n},right:function(e,r,n,i){for(arguments.length<3&&(n=0),arguments.length<4&&(i=e.length);n>>1;t(e[a],r)>0?i=a:n=a+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 f(){this._=Object.create(null)}function h(t){return(t+="")===_o||t[0]===wo?wo+t:t}function d(t){return(t+="")[0]===wo?t.slice(1):t}function p(t){return h(t)in this._}function g(t){return(t=h(t))in this._&&delete this._[t]}function v(){var t=[];for(var e in this._)t.push(d(e));return t}function m(){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=Mo.length;r=e&&(e=i+1);!(o=s[e])&&++e0&&(t=t.slice(0,s));var u=Oo.get(t);return u&&(t=u,l=Q),s?e?i:n:e?M:a}function Z(t,e){return function(r){var n=uo.event;uo.event=r,e[0]=this.__data__;try{t.apply(this,e)}finally{uo.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 $(t){var r=".dragsuppress-"+ ++Io,i="click"+r,a=uo.select(n(t)).on("touchmove"+r,T).on("dragstart"+r,T).on("selectstart"+r,T);if(null==No&&(No=!("onselectstart"in t)&&w(t.style,"userSelect")),No){var o=e(t).style,s=o[No];o[No]="none"}return function(t){if(a.on(r,null),No&&(o[No]=s),t){var e=function(){a.on(i,null)};a.on(i,function(){T(),e()},!0),setTimeout(e,0)}}}function K(t,e){e.changedTouches&&(e=e.changedTouches[0]);var r=t.ownerSVGElement||t;if(r.createSVGPoint){var i=r.createSVGPoint();if(zo<0){var a=n(t);if(a.scrollX||a.scrollY){r=uo.select("body").append("svg").style({position:"absolute",top:0,left:0,margin:0,padding:0,border:"none"},"important");var o=r[0][0].getScreenCTM();zo=!(o.f||o.e),r.remove()}}return zo?(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 J(){return uo.event.changedTouches[0].identifier}function tt(t){return t>0?1:t<0?-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:t<-1?Fo:Math.acos(t)}function nt(t){return t>1?Vo:t<-1?-Vo: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,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,At,ut):new ut(t,e,r)}function ct(t,e,r){function n(t){return t>360?t-=360:t<0&&(t+=360),t<60?a+(o-a)*t/60:t<180?o:t<240?a+(o-a)*(240-t)/60:a}function i(t){return Math.round(255*n(t))}var a,o;return t=isNaN(t)?0:(t%=360)<0?t+360:t,e=isNaN(e)?0:e<0?0:e>1?1:e,r=r<0?0:r>1?1:r,o=r<=.5?r*(1+e):r+e-r*e,a=2*r-o,new bt(i(t+120),i(t),i(t-120))}function ft(t,e,r){return this instanceof ft?(this.h=+t,this.c=+e,void(this.l=+r)):arguments.length<2?t instanceof ft?new ft(t.h,t.c,t.l):t instanceof dt?gt(t.l,t.a,t.b):gt((t=kt((t=uo.rgb(t)).r,t.g,t.b)).l,t.a,t.b):new ft(t,e,r)}function ht(t,e,r){return isNaN(t)&&(t=0),isNaN(e)&&(e=0),new dt(r,Math.cos(t*=Ho)*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 ft?ht(t.h,t.c,t.l):kt((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,a=n-r/200;return i=vt(i)*Ko,n=vt(n)*Jo,a=vt(a)*ts,new bt(yt(3.2404542*i-1.5371385*n-.4985314*a),yt(-.969266*i+1.8760108*n+.041556*a),yt(.0556434*i-.2040259*n+1.0572252*a))}function gt(t,e,r){return t>0?new ft(Math.atan2(r,e)*qo,Math.sqrt(e*e+r*r),t):new ft(NaN,NaN,t)}function vt(t){return t>.206893034?t*t*t:(t-4/29)/7.787037}function mt(t){return t>.008856?Math.pow(t,1/3):7.787037*t+4/29}function yt(t){return Math.round(255*(t<=.00304?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 t<16?"0"+Math.max(0,t).toString(16):Math.min(255,t).toString(16)}function Mt(t,e,r){var n,i,a,o=0,s=0,l=0;if(n=/([a-z]+)\((.*)\)/.exec(t=t.toLowerCase()))switch(i=n[2].split(","),n[1]){case"hsl":return r(parseFloat(i[0]),parseFloat(i[1])/100,parseFloat(i[2])/100);case"rgb":return e(Et(i[0]),Et(i[1]),Et(i[2]))}return(a=ns.get(t))?e(a.r,a.g,a.b):(null==t||"#"!==t.charAt(0)||isNaN(a=parseInt(t.slice(1),16))||(4===t.length?(o=(3840&a)>>4,o|=o>>4,s=240&a,s|=s>>4,l=15&a,l|=l<<4):7===t.length&&(o=(16711680&a)>>16,s=(65280&a)>>8,l=255&a)),e(o,s,l))}function At(t,e,r){var n,i,a=Math.min(t/=255,e/=255,r/=255),o=Math.max(t,e,r),s=o-a,l=(o+a)/2;return s?(i=l<.5?s/(o+a):s/(2-o-a),n=t==o?(e-r)/s+(e0&&l<1?0:n),new ut(n,i,l)}function kt(t,e,r){t=Tt(t),e=Tt(e),r=Tt(r);var n=mt((.4124564*t+.3575761*e+.1804375*r)/Ko),i=mt((.2126729*t+.7151522*e+.072175*r)/Jo);return dt(116*i-16,500*(n-i),200*(i-mt((.0193339*t+.119192*e+.9503041*r)/ts)))}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 Lt(t){return"function"==typeof t?t:function(){return t}}function Ct(t){return function(e,r,n){return 2===arguments.length&&"function"==typeof r&&(n=r,r=null),St(e,r,t,n)}}function St(t,e,r,n){function i(){var t,e=l.status;if(!e&&Rt(l)||e>=200&&e<300||304===e){try{t=r.call(a,l)}catch(t){return void o.error.call(a,t)}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 r=t,a},["get","post"].forEach(function(t){a[t]=function(){return a.send.apply(a,[t].concat(fo(arguments)))}}),a.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&&a.on("error",i).on("load",function(t){i(null,t)}),o.beforesend.call(a,l),l.send(null==n?null:n),a},a.abort=function(){ -return l.abort(),a},uo.rebind(a,o,"on"),null==n?a:a.get(Pt(n))}function Pt(t){return 1===t.length?function(e,r){t(null==e?r:null)}:t}function Rt(t){var e=t.responseType;return e&&"text"!==e?t.response:t.responseText}function Ot(t,e,r){var n=arguments.length;n<2&&(e=0),n<3&&(r=Date.now());var i=r+e,a={c:t,t:i,n:null};return as?as.n=a:is=a,as=a,os||(ss=clearTimeout(ss),os=1,ls(Nt)),a}function Nt(){var t=It(),e=zt()-t;e>24?(isFinite(e)&&(clearTimeout(ss),ss=setTimeout(Nt,e)),os=0):(os=1,ls(Nt))}function It(){for(var t=Date.now(),e=is;e;)t>=e.t&&e.c(t-e.t)&&(e.c=null),e=e.n;return t}function zt(){for(var t,e=is,r=1/0;e;)e.c?(e.t8?function(t){return t/r}:function(t){return t*r},symbol:t}}function Ft(t){var e=t.decimal,r=t.thousands,n=t.grouping,i=t.currency,a=n&&r?function(t,e){for(var i=t.length,a=[],o=0,s=n[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=n[o=(o+1)%n.length];return a.reverse().join(r)}:x;return function(t){var r=cs.exec(t),n=r[1]||" ",o=r[2]||">",s=r[3]||"-",l=r[4]||"",u=r[5],c=+r[6],f=r[7],h=r[8],d=r[9],p=1,g="",v="",m=!1,y=!0;switch(h&&(h=+h.substring(1)),(u||"0"===n&&"="===o)&&(u=n="0",o="="),d){case"n":f=!0,d="g";break;case"%":p=100,v="%",d="f";break;case"p":p=100,v="%",d="r";break;case"b":case"o":case"x":case"X":"#"===l&&(g="0"+d.toLowerCase());case"c":y=!1;case"d":m=!0,h=0;break;case"s":p=-1,d="r"}"$"===l&&(g=i[0],v=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=fs.get(d)||Bt;var b=u&&f;return function(t){var r=v;if(m&&t%1)return"";var i=t<0||0===t&&1/t<0?(t=-t,"-"):"-"===s?"":s;if(p<0){var l=uo.formatPrefix(t,h);t=l.scale(t),r=l.symbol+v}else t*=p;t=d(t,h);var x,_,w=t.lastIndexOf(".");if(w<0){var M=y?t.lastIndexOf("e"):-1;M<0?(x=t,_=""):(x=t.substring(0,M),_=t.substring(M))}else x=t.substring(0,w),_=e+t.substring(w+1);!u&&f&&(x=a(x,1/0));var A=g.length+x.length+_.length+(b?0:i.length),k=A"===o?k+i+t:"^"===o?k.substring(0,A>>=1)+i+t+k.substring(A):i+(b?t:k+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=a(r,1);return e-r1)for(;o=u)return-1;if(37===(i=e.charCodeAt(s++))){if(o=e.charAt(s++),!(a=C[o in gs?e.charAt(s++):o])||(n=a(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 a(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 o(t,e,r){A.lastIndex=0;var n=A.exec(e.slice(r));return n?(t.m=k.get(n[0].toLowerCase()),r+n[0].length):-1}function s(t,e,n){return r(t,L.c.toString(),e,n)}function l(t,e,n){return r(t,L.x.toString(),e,n)}function u(t,e,n){return r(t,L.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 f=t.dateTime,h=t.date,d=t.time,p=t.periods,g=t.days,v=t.shortDays,m=t.months,y=t.shortMonths;e.utc=function(t){function r(t){try{ds=Ut;var e=new ds;return e._=t,n(e)}finally{ds=Date}}var n=e(t);return r.parse=function(t){try{ds=Ut;var e=n.parse(t);return e&&e._}finally{ds=Date}},r.toString=n.toString,r},e.multi=e.utc.multi=ce;var b=uo.map(),x=Xt(g),_=Wt(g),w=Xt(v),M=Wt(v),A=Xt(m),k=Wt(m),T=Xt(y),E=Wt(y);p.forEach(function(t,e){b.set(t.toLowerCase(),e)});var L={a:function(t){return v[t.getDay()]},A:function(t){return g[t.getDay()]},b:function(t){return y[t.getMonth()]},B:function(t){return m[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+hs.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(hs.sundayOfYear(t),e,2)},w:function(t){return t.getDay()},W:function(t,e){return Gt(hs.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"%"}},C={a:n,A:i,b:a,B:o,c:s,d:re,e:re,H:ie,I:ie,j:ne,L:se,m:ee,M:ae,p:c,S:oe,U:Zt,w:Yt,W:Qt,x:l,X:u,y:Kt,Y:$t,Z:Jt,"%":ue};return e}function Gt(t,e,r){var n=t<0?"-":"",i=(n?-t:t)+"",a=i.length;return n+(a68?1900:2e3)}function ee(t,e,r){vs.lastIndex=0;var n=vs.exec(e.slice(r,r+2));return n?(t.m=n[0]-1,r+n[0].length):-1}function re(t,e,r){vs.lastIndex=0;var n=vs.exec(e.slice(r,r+2));return n?(t.d=+n[0],r+n[0].length):-1}function ne(t,e,r){vs.lastIndex=0;var n=vs.exec(e.slice(r,r+3));return n?(t.j=+n[0],r+n[0].length):-1}function ie(t,e,r){vs.lastIndex=0;var n=vs.exec(e.slice(r,r+2));return n?(t.H=+n[0],r+n[0].length):-1}function ae(t,e,r){vs.lastIndex=0;var n=vs.exec(e.slice(r,r+2));return n?(t.M=+n[0],r+n[0].length):-1}function oe(t,e,r){vs.lastIndex=0;var n=vs.exec(e.slice(r,r+2));return n?(t.S=+n[0],r+n[0].length):-1}function se(t,e,r){vs.lastIndex=0;var n=vs.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=xo(e)/60|0,i=xo(e)%60;return r+Gt(n,"0",2)+Gt(i,"0",2)}function ue(t,e,r){ms.lastIndex=0;var n=ms.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=o*r,l=Math.cos(e),u=Math.sin(e),c=a*u,f=i*l+c*Math.cos(s),h=c*o*Math.sin(s);Ms.add(Math.atan2(h,f)),n=t,i=l,a=u}var e,r,n,i,a;As.point=function(o,s){As.point=t,n=(e=o)*Ho,i=Math.cos(s=(r=s)*Ho/2+Fo/4),a=Math.sin(s)},As.lineEnd=function(){t(e,r)}}function me(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 Ae(t,e){return xo(t[0]-e[0])=0;--s)i.point((f=c[s])[0],f[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 Oe(t){if(e=t.length){for(var e,r,n=0,i=t[0];++n0){for(_||(a.polygonStart(),_=!0),a.lineStart();++o1&&2&e&&r.push(r.pop().concat(r.shift())),d.push(r.filter(ze))}var d,p,g,v=e(a),m=i.invert(n[0],n[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(m,p);d.length?(_||(a.polygonStart(),_=!0),Re(d,je,t,r,a)):t&&(_||(a.polygonStart(),_=!0),a.lineStart(),r(null,null,1,a),a.lineEnd()),_&&(a.polygonEnd(),_=!1),d=p=null},sphere:function(){a.polygonStart(),a.lineStart(),r(null,null,1,a),a.lineEnd(),a.polygonEnd()}},b=De(),x=e(b),_=!1;return y}}function ze(t){return t.length>1}function De(){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]-Vo-Do:Vo-t[1])-((e=e.x)[0]<0?e[1]-Vo-Do:Vo-e[1])}function Fe(t){var e,r=NaN,n=NaN,i=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(a,o){var s=a>0?Fo:-Fo,l=xo(a-r);xo(l-Fo)0?Vo:-Vo),t.point(i,n),t.lineEnd(),t.lineStart(),t.point(s,n),t.point(a,n),e=0):i!==s&&l>=Fo&&(xo(r-i)Do?Math.atan((Math.sin(e)*(a=Math.cos(n))*Math.sin(r)-Math.sin(n)*(i=Math.cos(e))*Math.sin(t))/(i*a*o)):(e+n)/2}function Ue(t,e,r,n){var i;if(null==t)i=r*Vo,n.point(-Fo,i),n.point(0,i),n.point(Fo,i),n.point(Fo,0),n.point(Fo,-i),n.point(0,-i),n.point(-Fo,-i),n.point(-Fo,0),n.point(-Fo,i);else if(xo(t[0]-e[0])>Do){var a=t[0]=0?1:-1,M=w*_,A=M>Fo,k=p*b;if(Ms.add(Math.atan2(k*w*Math.sin(M),g*x+k*Math.cos(M))),a+=A?_+w*Bo:_,A^h>=r^m>=r){var T=be(me(f),me(t));we(T);var E=be(i,T);we(E);var L=(A^_>=0?-1:1)*nt(E[2]);(n>L||n===L&&(T[0]||T[1]))&&(o+=A^_>=0?1:-1)}if(!v++)break;h=m,p=b,g=x,f=t}}return(a<-Do||aa}function r(t){var r,a,l,u,c;return{lineStart:function(){u=l=!1,c=1},point:function(f,h){var d,p=[f,h],g=e(f,h),v=o?g?0:i(f,h):g?i(f+(f<0?Fo:-Fo),h):0;if(!r&&(u=l=g)&&t.lineStart(),g!==l&&(d=n(r,p),(Ae(r,d)||Ae(p,d))&&(p[0]+=Do,p[1]+=Do,g=e(p[0],p[1]))),g!==l)c=0,g?(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&&o^g){var m;v&a||!(m=n(p,r,!0))||(c=0,o?(t.lineStart(),t.point(m[0][0],m[0][1]),t.point(m[1][0],m[1][1]),t.lineEnd()):(t.point(m[1][0],m[1][1]),t.lineEnd(),t.lineStart(),t.point(m[0][0],m[0][1])))}!g||r&&Ae(r,p)||t.point(p[0],p[1]),r=p,l=g,a=v},lineEnd:function(){l&&t.lineEnd(),r=null},clean:function(){return c|(u&&l)<<1}}}function n(t,e,r){var n=me(t),i=me(e),o=[1,0,0],s=be(n,i),l=ye(s,s),u=s[0],c=l-u*u;if(!c)return!r&&t;var f=a*l/c,h=-a*u/c,d=be(o,s),p=_e(o,f);xe(p,_e(s,h));var g=d,v=ye(p,g),m=ye(g,g),y=v*v-m*(ye(p,p)-1);if(!(y<0)){var b=Math.sqrt(y),x=_e(g,(-v-b)/m);if(xe(x,p),x=Me(x),!r)return x;var _,w=t[0],M=e[0],A=t[1],k=e[1];M0^x[1]<(xo(x[0]-w)Fo^(w<=x[0]&&x[0]<=M)){var C=_e(g,(-v+b)/m);return xe(C,p),[x,Me(C)]}}}function i(e,r){var n=o?t:Fo-t,i=0;return e<-n?i|=1:e>n&&(i|=2),r<-n?i|=4:r>n&&(i|=8),i}var a=Math.cos(t),o=a>0,s=xo(a)>Do;return Ie(e,r,vr(t,6*Ho),o?[0,-t]:[-Fo,t-Fo])}function qe(t,e,r,n){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,g=f-u;if(a=t-l,p||!(a>0)){if(a/=p,p<0){if(a0){if(a>d)return;a>h&&(h=a)}if(a=r-l,p||!(a<0)){if(a/=p,p<0){if(a>d)return;a>h&&(h=a)}else if(p>0){if(a0)){if(a/=g,g<0){if(a0){if(a>d)return;a>h&&(h=a)}if(a=n-u,g||!(a<0)){if(a/=g,g<0){if(a>d)return;a>h&&(h=a)}else if(g>0){if(a0&&(i.a={x:l+h*p,y:u+h*g}),d<1&&(i.b={x:l+d*p,y:u+d*g}),i}}}}}}function Ge(t,e,r,n){function i(n,i){return xo(n[0]-t)0?0:3:xo(n[0]-r)0?2:1:xo(n[1]-e)0?1:0:i>0?3:2}function a(t,e){return o(t.x,e.x)}function o(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=v.length,n=t[1],i=0;in&&et(u,a,t)>0&&++e:a[1]<=n&&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:r,c>1?n:e)}while((c=(c+l+4)%4)!==f);else u.point(s[0],s[1])}function c(i,a){return t<=i&&i<=r&&e<=a&&a<=n}function f(t,e){c(t,e)&&s.point(t,e)}function h(){C.point=p,v&&v.push(m=[]),A=!0,M=!1,_=w=NaN}function d(){g&&(p(y,b),x&&M&&E.rejoin(),g.push(E.buffer())),C.point=f,M&&s.lineEnd()}function p(t,e){t=Math.max(-js,Math.min(js,t)),e=Math.max(-js,Math.min(js,e));var r=c(t,e);if(v&&m.push([t,e]),A)y=t,b=e,x=r,A=!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}};L(n)?(M||(s.lineStart(),s.point(n.a.x,n.a.y)),s.point(n.b.x,n.b.y),r||s.lineEnd(),k=!1):r&&(s.lineStart(),s.point(t,e),k=!1)}_=t,w=e,M=r}var g,v,m,y,b,x,_,w,M,A,k,T=s,E=De(),L=qe(t,e,r,n),C={point:f,lineStart:h,lineEnd:d,polygonStart:function(){s=E,g=[],v=[],k=!0},polygonEnd:function(){s=T,g=uo.merge(g);var e=l([t,n]),r=k&&e,i=g.length;(r||i)&&(s.polygonStart(),r&&(s.lineStart(),u(null,null,1,s),s.lineEnd()),i&&Re(g,a,e,u,s),s.polygonEnd()),g=v=m=null}};return C}}function Xe(t){var e=0,r=Fo/3,n=lr(t),i=n(e,r);return i.parallels=function(t){return arguments.length?n(e=t[0]*Fo/180,r=t[1]*Fo/180):[e/Fo*180,r/Fo*180]},i}function We(t,e){function r(t,e){var r=Math.sqrt(a-2*i*Math.sin(e))/i;return[r*Math.sin(t*=i),o-r*Math.cos(t)]}var n=Math.sin(t),i=(n+Math.sin(e))/2,a=1+n*(2*i-n),o=Math.sqrt(a)/i;return r.invert=function(t,e){var r=o-e;return[Math.atan2(t,r)/i,nt((a-(t*t+r*r)*i*i)/(2*i))]},r}function Ye(){function t(t,e){Bs+=i*t-n*e,n=t,i=e}var e,r,n,i;Gs.point=function(a,o){Gs.point=t,e=n=a,r=i=o},Gs.lineEnd=function(){t(e,r)}}function Ze(t,e){tHs&&(Hs=t),eqs&&(qs=e)}function Qe(){function t(t,e){o.push("M",t,",",e,a)}function e(t,e){o.push("M",t,",",e),s.point=r}function r(t,e){o.push("L",t,",",e)}function n(){s.point=t}function i(){o.push("Z")}var a=$e(4.5),o=[],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 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 Ke(t,e){Es+=t,Ls+=e,++Cs}function Je(){function t(t,n){var i=t-e,a=n-r,o=Math.sqrt(i*i+a*a);Ss+=o*(e+t)/2,Ps+=o*(r+n)/2,Rs+=o,Ke(e=t,r=n)}var e,r;Ws.point=function(n,i){Ws.point=t,Ke(e=n,r=i)}}function tr(){Ws.point=Ke}function er(){function t(t,e){var r=t-n,a=e-i,o=Math.sqrt(r*r+a*a);Ss+=o*(n+t)/2,Ps+=o*(i+e)/2,Rs+=o,o=i*t-n*e,Os+=o*(n+t),Ns+=o*(i+e),Is+=3*o,Ke(n=t,i=e)}var e,r,n,i;Ws.point=function(a,o){Ws.point=t,Ke(e=n=a,r=i=o)},Ws.lineEnd=function(){t(e,r)}}function rr(t){function e(e,r){t.moveTo(e+o,r),t.arc(e,r,o,0,Bo)}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 a(){t.closePath()}var o=4.5,s={point:e,lineStart:function(){s.point=r},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 nr(t){function e(t){return(s?n:r)(t)}function r(e){return or(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,A.point=a,e.lineStart()}function a(r,n){var a=me([r,n]),o=t(r,n);i(b,x,y,_,w,M,b=o[0],x=o[1],y=r,_=a[0],w=a[1],M=a[2],s,e),e.point(b,x)}function o(){A.point=r,e.lineEnd()}function l(){n(),A.point=u,A.lineEnd=c}function u(t,e){a(f=t,h=e),d=b,p=x,g=_,v=w,m=M,A.point=a}function c(){i(b,x,y,_,w,M,d,p,f,g,v,m,s,e),A.lineEnd=o,o()}var f,h,d,p,g,v,m,y,b,x,_,w,M,A={point:r,lineStart:n,lineEnd:o,polygonStart:function(){e.polygonStart(),A.lineStart=l},polygonEnd:function(){e.polygonEnd(),A.lineStart=n}};return A}function i(e,r,n,s,l,u,c,f,h,d,p,g,v,m){var y=c-e,b=f-r,x=y*y+b*b;if(x>4*a&&v--){var _=s+d,w=l+p,M=u+g,A=Math.sqrt(_*_+w*w+M*M),k=Math.asin(M/=A),T=xo(xo(M)-1)a||xo((y*S+b*P)/x-.5)>.3||s*d+l*p+u*g0&&16,e):Math.sqrt(a)},e}function ir(t){var e=nr(function(e,r){return t([e*qo,r*qo])});return function(t){return ur(e(t))}}function ar(t){this.stream=t}function or(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]*Ho,t[1]*Ho),[t[0]*h+l,u-t[1]*h]}function r(t){return(t=s.invert((t[0]-l)/h,(u-t[1])/h))&&[t[0]*qo,t[1]*qo]}function n(){s=Se(o=hr(m,y,b),a);var t=a(g,v);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=nr(function(t,e){return t=a(t,e),[t[0]*h+l,u-t[1]*h]}),h=150,d=480,p=250,g=0,v=0,m=0,y=0,b=0,_=Ds,w=x,M=null,A=null;return e.stream=function(t){return c&&(c.valid=!1),c=ur(_(o,f(w(t)))),c.valid=!0,c},e.clipAngle=function(t){return arguments.length?(_=null==t?(M=t,Ds):He((M=+t)*Ho),i()):M},e.clipExtent=function(t){return arguments.length?(A=t,w=t?Ge(t[0][0],t[0][1],t[1][0],t[1][1]):x,i()):A},e.scale=function(t){return arguments.length?(h=+t,n()):h},e.translate=function(t){return arguments.length?(d=+t[0],p=+t[1],n()):[d,p]},e.center=function(t){return arguments.length?(g=t[0]%360*Ho,v=t[1]%360*Ho,n()):[g*qo,v*qo]},e.rotate=function(t){return arguments.length?(m=t[0]%360*Ho,y=t[1]%360*Ho,b=t.length>2?t[2]%360*Ho:0,n()):[m*qo,y*qo,b*qo]},uo.rebind(e,f,"precision"),function(){return a=t.apply(this,arguments),e.invert=a.invert&&r,n()}}function ur(t){return or(t,function(e,r){t.point(e*Ho,r*Ho)})}function cr(t,e){return[t,e]}function fr(t,e){return[t>Fo?t-Bo:t<-Fo?t+Bo:t,e]}function hr(t,e,r){return t?e||r?Se(pr(t),gr(e,r)):pr(t):e||r?gr(e,r):fr}function dr(t){return function(e,r){return e+=t,[e>Fo?e-Bo:e<-Fo?e+Bo:e,r]}}function pr(t){var e=dr(t);return e.invert=dr(-t),e}function gr(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*a-c*o,s*n-u*i),nt(c*a+l*o)]}var n=Math.cos(t),i=Math.sin(t),a=Math.cos(e),o=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*a-l*o;return[Math.atan2(l*a+u*o,s*n+c*i),nt(c*n-s*i)]},r}function vr(t,e){var r=Math.cos(t),n=Math.sin(t);return function(i,a,o,s){var l=o*e;null!=i?(i=mr(r,i),a=mr(r,a),(o>0?ia)&&(i+=o*Bo)):(i=t+o*Bo,a=t-.5*l);for(var u,c=i;o>0?c>a:c0?e<-Vo+Do&&(e=-Vo+Do):e>Vo-Do&&(e=Vo-Do);var r=o/Math.pow(i(e),a);return[r*Math.sin(a*t),o-r*Math.cos(a*t)]}var n=Math.cos(t),i=function(t){return Math.tan(Fo/4+t/2)},a=t===e?Math.sin(t):Math.log(n/Math.cos(e))/Math.log(i(e)/i(t)),o=n*Math.pow(i(t),a)/a;return a?(r.invert=function(t,e){var r=o-e,n=tt(a)*Math.sqrt(t*t+r*r);return[Math.atan2(t,r)/a,2*Math.atan(Math.pow(o/n,1/a))-Vo]},r):Er}function Tr(t,e){function r(t,e){var r=a-e;return[r*Math.sin(i*t),a-r*Math.cos(i*t)]}var n=Math.cos(t),i=t===e?Math.sin(t):(n-Math.cos(e))/(e-t),a=n/i+t;return xo(i)1&&et(t[r[n-2]],t[r[n-1]],t[i])<=0;)--n;r[n++]=i}return r.slice(0,n)}function Or(t,e){return t[0]-e[0]||t[1]-e[1]}function Nr(t,e,r){return(r[0]-e[0])*(t[1]-e[1])<(r[1]-e[1])*(t[0]-e[0])}function Ir(t,e,r,n){var i=t[0],a=r[0],o=e[0]-i,s=n[0]-a,l=t[1],u=r[1],c=e[1]-l,f=n[1]-u,h=(s*(l-u)-f*(i-a))/(f*o-s*c);return[i+h*o,l+h*c]}function zr(t){var e=t[0],r=t[t.length-1];return!(e[0]-r[0]||e[1]-r[1])}function Dr(){an(this),this.edge=this.site=this.circle=null}function jr(t){var e=sl.pop()||new Dr;return e.site=t,e}function Fr(t){Zr(t),il.remove(t),sl.push(t),an(t)}function Br(t){var e=t.circle,r=e.x,n=e.cy,i={x:r,y:n},a=t.P,o=t.N,s=[t];Fr(t);for(var l=a;l.circle&&xo(r-l.circle.x)Do)s=s.L;else{if(!((i=a-Hr(s,o))>Do)){n>-Do?(e=s.P,r=s):i>-Do?(e=s,r=s.N):e=r=s;break}if(!s.R){e=s;break}s=s.R}var l=jr(t);if(il.insert(e,l),e||r){if(e===r)return Zr(e),r=jr(e.site),il.insert(l,r),l.edge=r.edge=Jr(e.site,l.site),Yr(e),void Yr(r);if(!r)return void(l.edge=Jr(e.site,l.site));Zr(e),Zr(r);var u=e.site,c=u.x,f=u.y,h=t.x-c,d=t.y-f,p=r.site,g=p.x-c,v=p.y-f,m=2*(h*v-d*g),y=h*h+d*d,b=g*g+v*v,x={x:(v*y-d*b)/m+c,y:(h*b-g*y)/m+f};en(r.edge,u,p,x),l.edge=Jr(u,t,null,x),r.edge=Jr(t,p,null,x),Yr(e),Yr(r)}}function Vr(t,e){var r=t.site,n=r.x,i=r.y,a=i-e;if(!a)return n;var o=t.P;if(!o)return-1/0;r=o.site;var s=r.x,l=r.y,u=l-e;if(!u)return s;var c=s-n,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+n:(n+s)/2}function Hr(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 qr(t){this.site=t,this.edges=[]}function Gr(t){for(var e,r,n,i,a,o,s,l,u,c,f=t[0][0],h=t[1][0],d=t[0][1],p=t[1][1],g=nl,v=g.length;v--;)if((a=g[v])&&a.prepare())for(s=a.edges,l=s.length,o=0;oDo||xo(i-r)>Do)&&(s.splice(o,0,new rn(tn(a.site,c,xo(n-f)Do?{x:f,y:xo(e-f)Do?{x:xo(r-p)Do?{x:h,y:xo(e-h)Do?{x:xo(r-d)=-jo)){var d=l*l+u*u,p=c*c+f*f,g=(f*d-u*p)/h,v=(l*p-c*d)/h,f=v+s,m=ll.pop()||new Wr;m.arc=t,m.site=i,m.x=g+o,m.y=f+Math.sqrt(g*g+v*v),m.cy=f,t.circle=m;for(var y=null,b=ol._;b;)if(m.y=s)return;if(h>p){if(a){if(a.y>=u)return}else a={x:v,y:l};r={x:v,y:u}}else{if(a){if(a.y1)if(h>p){if(a){if(a.y>=u)return}else a={x:(l-i)/n,y:l};r={x:(u-i)/n,y:u}}else{if(a){if(a.y=s)return}else a={x:o,y:n*o+i};r={x:s,y:n*s+i}}else{if(a){if(a.xa||f>o||h=x,M=r>=_,A=M<<1|w,k=A+4;Aa&&(i=e.slice(a,i),s[o]?s[o]+=i:s[++o]=i),(r=r[0])===(n=n[0])?s[o]?s[o]+=n:s[++o]=n:(s[++o]=null,l.push({i:o,x:bn(r,n)})),a=fl.lastIndex;return a=0&&!(r=uo.interpolators[n](t,e)););return r}function wn(t,e){var r,n=[],i=[],a=t.length,o=e.length,s=Math.min(t.length,e.length);for(r=0;r=1?1:t(e)}}function An(t){return function(e){return 1-t(1-e)}}function kn(t){return function(e){return.5*(e<.5?t(2*e):2-t(2-2*e))}}function Tn(t){return t*t}function En(t){return t*t*t}function Ln(t){if(t<=0)return 0;if(t>=1)return 1;var e=t*t,r=e*t;return 4*(t<.5?r:3*(t-e)+r-.75)}function Cn(t){return function(e){return Math.pow(e,t)}}function Sn(t){return 1-Math.cos(t*Vo)}function Pn(t){return Math.pow(2,10*(t-1))}function Rn(t){return 1-Math.sqrt(1-t*t)}function On(t,e){var r;return arguments.length<2&&(e=.45),arguments.length?r=e/Bo*Math.asin(1/t):(t=1,r=e/4),function(n){return 1+t*Math.pow(2,-10*n)*Math.sin((n-r)*Bo/e)}}function Nn(t){return t||(t=1.70158),function(e){return e*e*((t+1)*e-t)}}function In(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375}function zn(t,e){t=uo.hcl(t),e=uo.hcl(e);var r=t.h,n=t.c,i=t.l,a=e.h-r,o=e.c-n,s=e.l-i;return isNaN(o)&&(o=0,n=isNaN(n)?e.c:n),isNaN(a)?(a=0,r=isNaN(r)?e.h:r):a>180?a-=360:a<-180&&(a+=360),function(t){return ht(r+a*t,n+o*t,i+s*t)+""}}function Dn(t,e){t=uo.hsl(t),e=uo.hsl(e);var r=t.h,n=t.s,i=t.l,a=e.h-r,o=e.s-n,s=e.l-i;return isNaN(o)&&(o=0,n=isNaN(n)?e.s:n),isNaN(a)?(a=0,r=isNaN(r)?e.h:r):a>180?a-=360:a<-180&&(a+=360),function(t){return ct(r+a*t,n+o*t,i+s*t)+""}}function jn(t,e){t=uo.lab(t),e=uo.lab(e);var r=t.l,n=t.a,i=t.b,a=e.l-r,o=e.a-n,s=e.b-i;return function(t){return pt(r+a*t,n+o*t,i+s*t)+""}}function Fn(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),a=Vn(Hn(r,e,-i))||0;e[0]*r[1]180?e+=360:e-t>180&&(t+=360),n.push({i:r.push(qn(r)+"rotate(",null,")")-2,x:bn(t,e)})):e&&r.push(qn(r)+"rotate("+e+")")}function Wn(t,e,r,n){t!==e?n.push({i:r.push(qn(r)+"skewX(",null,")")-2,x:bn(t,e)}):e&&r.push(qn(r)+"skewX("+e+")")}function Yn(t,e,r,n){if(t[0]!==e[0]||t[1]!==e[1]){var i=r.push(qn(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(qn(r)+"scale("+e+")")}function Zn(t,e){var r=[],n=[];return t=uo.transform(t),e=uo.transform(e),Gn(t.translate,e.translate,r,n),Xn(t.rotate,e.rotate,r,n),Wn(t.skew,e.skew,r,n),Yn(t.scale,e.scale,r,n),t=e=null,function(t){for(var e,i=-1,a=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),(a=t.children)&&(i=a.length))for(var i,a,o=-1;++oi&&(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,a=[];++r<=e;)a[r]=i*r+n;return a}function Mi(t){return[uo.min(t),uo.max(t)]}function Ai(t,e){return t.value-e.value}function ki(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 Li(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((r=t.children)&&(u=r.length)){var r,n,i,a,o,s,l,u,c=1/0,f=-1/0,h=1/0,d=-1/0;if(r.forEach(Ci),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(a=r[2],Ri(n,i,a),e(a),ki(n,a),n._pack_prev=a,ki(a,i),i=n._pack_next,o=3;o=0;)e=i[a],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 Fi(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 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 Hi(t){return{x:t.x,y:t.y,dx:t.dx,dy:t.dy}}function qi(t,e){var r=t.x+e[3],n=t.y+e[0],i=t.dx-e[1]-e[3],a=t.dy-e[0]-e[2];return i<0&&(r+=i/2,i=0),a<0&&(n+=a/2,a=0),{x:r,y:n,dx:i,dy:a}}function Gi(t){var e=t[0],r=t[t.length-1];return e2?Qi:Wi,l=n?$n:Qn;return o=i(t,e,l,r),s=i(e,t,l,_n),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(Fn)},a.clamp=function(t){return arguments.length?(n=t,i()):n},a.interpolate=function(t){return arguments.length?(r=t,i()):r},a.ticks=function(e){return ea(t,e)},a.tickFormat=function(e,r){return ra(t,e,r)},a.nice=function(e){return Ji(t,e),i()},a.copy=function(){return $i(t,e,r,n)},i()}function Ki(t,e){return uo.rebind(t,e,"range","rangeRound","interpolate","clamp")}function Ji(t,e){return Yi(t,Zi(ta(t,e)[2])),Yi(t,Zi(ta(t,e)[2])),t}function ta(t,e){null==e&&(e=10);var r=Gi(t),n=r[1]-r[0],i=Math.pow(10,Math.floor(Math.log(n/e)/Math.LN10)),a=e/n*i;return a<=.15?i*=10:a<=.35?i*=5:a<=.75&&(i*=2),r[0]=Math.ceil(r[0]/i)*i,r[1]=Math.floor(r[1]/i)*i+.5*i,r[2]=i,r}function ea(t,e){return uo.range.apply(uo,ta(t,e))}function ra(t,e,r){var n=ta(t,e);if(r){var i=cs.exec(r);if(i.shift(),"s"===i[8]){var a=uo.formatPrefix(Math.max(xo(n[0]),xo(n[1])));return i[7]||(i[7]="."+na(a.scale(n[2]))),i[8]="f",r=uo.format(i.join("")),function(t){return r(a.scale(t))+a.symbol}}i[7]||(i[7]="."+ia(i[8],n)),r=i.join("")}else r=",."+na(n[2])+"f";return uo.format(r)}function na(t){return-Math.floor(Math.log(t)/Math.LN10+.01)}function ia(t,e){var r=na(e[2]);return t in Ml?Math.abs(r-na(Math.max(xo(e[0]),xo(e[1]))))+ +("e"!==t):r-2*("%"===t)}function aa(t,e,r,n){function i(t){return(r?Math.log(t<0?0:t):-Math.log(t>0?0:-t))/Math.log(e)}function a(t){return r?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?(r=e[0]>=0,t.domain((n=e.map(Number)).map(i)),o):n},o.base=function(r){return arguments.length?(e=+r,t.domain(n.map(i)),o):e},o.nice=function(){var e=Yi(n.map(i),r?Math:kl);return t.domain(e),n=e.map(a),o},o.ticks=function(){var t=Gi(n),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(r){for(;u0;h--)o.push(a(u)*h);for(u=0;o[u]l;c--);o=o.slice(u,c)}return o},o.tickFormat=function(t,r){if(!arguments.length)return Al;arguments.length<2?r=Al:"function"!=typeof r&&(r=uo.format(r));var n=Math.max(1,e*t/o.ticks().length);return function(t){var o=t/a(Math.round(i(t)));return o*e0?s[r-1]:t[0],r0?0:1}function xa(t,e,r,n,i){var a=t[0]-e[0],o=t[1]-e[1],s=(i?n:-n)/Math.sqrt(a*a+o*o),l=s*o,u=-s*a,c=t[0]+l,f=t[1]+u,h=e[0]+l,d=e[1]+u,p=(c+h)/2,g=(f+d)/2,v=h-c,m=d-f,y=v*v+m*m,b=r-n,x=c*d-h*f,_=(m<0?-1:1)*Math.sqrt(Math.max(0,b*b*y-x*x)),w=(x*m-v*_)/y,M=(-x*v-m*_)/y,A=(x*m+v*_)/y,k=(-x*v+m*_)/y,T=w-p,E=M-g,L=A-p,C=k-g;return T*T+E*E>L*L+C*C&&(w=A,M=k),[[w-l,M-u],[w*r/b,M*r/b]]}function _a(t){function e(e){function o(){u.push("M",a(t(c),s))}for(var l,u=[],c=[],f=-1,h=e.length,d=Lt(r),p=Lt(n);++f1?t.join("L"):t+"Z"}function Ma(t){return t.join("L")+"Z"}function Aa(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 ka(t){for(var e=0,r=t.length,n=t[0],i=[n[0],",",n[1]];++e1){s=e[1],a=t[l],l++,n+="C"+(i[0]+o[0])+","+(i[1]+o[1])+","+(a[0]-s[0])+","+(a[1]-s[1])+","+a[0]+","+a[1];for(var u=2;u9&&(i=3*e/Math.sqrt(i),o[s]=i*r,o[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+o[s]*o[s])),a.push([i||0,o[s]*i||0]);return a}function Ua(t){return t.length<3?wa(t):t[0]+Sa(t,Ba(t))}function Va(t){for(var e,r,n,i=-1,a=t.length;++i0;)d[--s].call(t,o);if(a>=1)return g.event&&g.event.end.call(t,t.__data__,e),--p.count?delete p[n]:delete t[r],1}var l,u,c,h,d,p=t[r]||(t[r]={active:0,count:0}),g=p[n];g||(l=i.time,u=Ot(a,0,l),g=p[n]={tween:new f,time:l,timer:u,delay:i.delay,duration:i.duration,ease:i.ease,index:e},i=null,++p.count)}function ro(t,e,r){t.attr("transform",function(t){var n=e(t);return"translate("+(isFinite(n)?n:r(t))+",0)"})}function no(t,e,r){t.attr("transform",function(t){var n=e(t);return"translate(0,"+(isFinite(n)?n:r(t))+")"})}function io(t){return t.toISOString()}function ao(t,e,r){function n(e){return t(e)}function i(t,r){var n=t[1]-t[0],i=n/r,a=uo.bisect(Ql,i);return a==Ql.length?[e.year,ta(t.map(function(t){return t/31536e6}),r)[2]]:a?e[i/Ql[a-1]1?{floor:function(e){for(;r(e=t.floor(e));)e=oo(e-1);return e},ceil:function(e){for(;r(e=t.ceil(e));)e=oo(+e+1);return e}}:t))},n.ticks=function(t,e){var r=Gi(n.domain()),a=null==t?i(r,10):"number"==typeof t?i(r,t):!t.range&&[{range:t},e];return a&&(t=a[0],e=a[1]),t.range(r[0],oo(+r[1]+1),e<1?1:e)},n.tickFormat=function(){return r},n.copy=function(){return ao(t.copy(),e,r)},Ki(n,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.17"},co=[].slice,fo=function(t){return co.call(t)},ho=this.document;if(ho)try{fo(ho.documentElement.childNodes)[0].nodeType}catch(t){fo=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}),ho)try{ho.createElement("DIV").style.setProperty("opacity",0,"")}catch(t){var po=this.Element.prototype,go=po.setAttribute,vo=po.setAttributeNS,mo=this.CSSStyleDeclaration.prototype,yo=mo.setProperty;po.setAttribute=function(t,e){go.call(this,t,e+"")},po.setAttributeNS=function(t,e,r){vo.call(this,t,e,r+"")},mo.setProperty=function(t,e,r){yo.call(this,t,e+"",r)}}uo.ascending=i,uo.descending=function(t,e){return et?1:e>=t?0:NaN},uo.min=function(t,e){var r,n,i=-1,a=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},uo.max=function(t,e){var r,n,i=-1,a=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},uo.extent=function(t,e){var r,n,i,a=-1,o=t.length;if(1===arguments.length){for(;++a=n){r=i=n;break}for(;++an&&(r=n),i=n){r=i=n;break}for(;++an&&(r=n),i1)return l/(c-1)},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,r){return i(t(e),r)}:t)},uo.shuffle=function(t,e,r){(a=arguments.length)<3&&(r=t.length,a<2&&(e=0));for(var n,i,a=r-e;a;)i=Math.random()*a--|0,n=t[a+e],t[a+e]=t[i+e],t[i+e]=n;return t},uo.permute=function(t,e){for(var r=e.length,n=new Array(r);r--;)n[r]=t[e[r]];return n},uo.pairs=function(t){for(var e=0,r=t.length-1,n=t[0],i=new Array(r<0?0:r);e=0;)for(n=t[i],e=n.length;--e>=0;)r[--o]=n[e];return r};var xo=Math.abs;uo.range=function(t,e,r){if(arguments.length<3&&(r=1,arguments.length<2&&(e=t,t=0)),(e-t)/r==1/0)throw new Error("infinite range");var n,i=[],a=u(xo(r)),o=-1;if(t*=a,e*=a,r*=a,r<0)for(;(n=t+r*++o)>e;)i.push(n/a);else for(;(n=t+r*++o)=a.length)return n?n.call(i,o):r?o.sort(r):o;for(var l,u,c,h,d=-1,p=o.length,g=a[s++],v=new f;++d=a.length)return t;var n=[],i=o[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={},a=[],o=[];return i.map=function(e,r){return t(r,e,0)},i.entries=function(r){return e(t(uo.map,r,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 r=t,i},i.rollup=function(t){return n=t,i},i},uo.set=function(t){var e=new b;if(t)for(var r=0,n=t.length;r=0&&(n=t.slice(r+1),t=t.slice(0,r)),t)return arguments.length<2?this[t].on(n):this[t].on(n,e);if(2===arguments.length){if(null==e)for(t in this)this.hasOwnProperty(t)&&this[t].on(n,null);return this}},uo.event=null,uo.requote=function(t){return t.replace(Ao,"\\$&")};var Ao=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,ko={}.__proto__?function(t,e){t.__proto__=e}:function(t,e){for(var r in e)t[r]=e[r]},To=function(t,e){return e.querySelector(t)},Eo=function(t,e){return e.querySelectorAll(t)},Lo=function(t,e){var r=t.matches||t[w(t,"matchesSelector")];return(Lo=function(t,e){return r.call(t,e)})(t,e)};"function"==typeof Sizzle&&(To=function(t,e){return Sizzle(t,e)[0]||null},Eo=Sizzle,Lo=Sizzle.matchesSelector),uo.selection=function(){return uo.select(ho.documentElement)};var Co=uo.selection.prototype=[];Co.select=function(t){var e,r,n,i,a=[];t=S(t);for(var o=-1,s=this.length;++o=0&&"xmlns"!==(r=t.slice(0,e))&&(t=t.slice(e+1)),Po.hasOwnProperty(r)?{space:Po[r],local:t}:t}},Co.attr=function(t,e){if(arguments.length<2){if("string"==typeof t){var r=this.node();return t=uo.ns.qualify(t),t.local?r.getAttributeNS(t.space,t.local):r.getAttribute(t)}for(e in t)this.each(R(e,t[e]));return this}return this.each(R(t,e))},Co.classed=function(t,e){if(arguments.length<2){if("string"==typeof t){var r=this.node(),n=(t=I(t)).length,i=-1;if(e=r.classList){for(;++i=0;)(r=n[i])&&(a&&a!==r.nextSibling&&a.parentNode.insertBefore(r,a),a=r);return this},Co.sort=function(t){t=q.apply(this,arguments);for(var e=-1,r=this.length;++e0&&(e=e.transition().duration(C)),e.call(t.event)}function s(){_&&_.domain(x.range().map(function(t){return(t-A.x)/A.k}).map(x.invert)),M&&M.domain(w.range().map(function(t){return(t-A.y)/A.k}).map(w.invert))}function l(t){S++||t({type:"zoomstart"})}function u(t){s(),t({type:"zoom",scale:A.k,translate:[A.x,A.y]})}function c(t){--S||(t({type:"zoomend"}),v=null)}function f(){function t(){s=1,a(uo.mouse(i),h),u(o)}function r(){f.on(R,null).on(O,null),d(s),c(o)}var i=this,o=I.of(i,arguments),s=0,f=uo.select(n(i)).on(R,t).on(O,r),h=e(uo.mouse(i)),d=$(i);Bl.call(i),l(o)}function h(){function t(){var t=uo.touches(p);return d=A.k,t.forEach(function(t){t.identifier in v&&(v[t.identifier]=e(t))}),t}function r(){var e=uo.event.target;uo.select(e).on(x,n).on(_,s),w.push(e);for(var r=uo.event.changedTouches,i=0,a=r.length;i1){var c=l[0],f=l[1],h=c[0]-f[0],d=c[1]-f[1];m=h*h+d*d}}function n(){var t,e,r,n,o=uo.touches(p);Bl.call(p);for(var s=0,l=o.length;s=u)return o;if(i)return i=!1,a;var e=c;if(34===t.charCodeAt(e)){for(var r=e;r++=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i,fs=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,Dt(t,e))).toFixed(Math.max(0,Math.min(20,Dt(t*(1+1e-15),e))))}}),hs=uo.time={},ds=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(){ps.setUTCDate.apply(this._,arguments)},setDay:function(){ps.setUTCDay.apply(this._,arguments)},setFullYear:function(){ps.setUTCFullYear.apply(this._,arguments)},setHours:function(){ps.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){ps.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){ps.setUTCMinutes.apply(this._,arguments)},setMonth:function(){ps.setUTCMonth.apply(this._,arguments)},setSeconds:function(){ps.setUTCSeconds.apply(this._,arguments)},setTime:function(){ps.setTime.apply(this._,arguments)}};var ps=Date.prototype;hs.year=Vt(function(t){return t=hs.day(t),t.setMonth(0,1),t},function(t,e){t.setFullYear(t.getFullYear()+e)},function(t){return t.getFullYear()}),hs.years=hs.year.range,hs.years.utc=hs.year.utc.range,hs.day=Vt(function(t){var e=new ds(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}),hs.days=hs.day.range,hs.days.utc=hs.day.utc.range,hs.dayOfYear=function(t){var e=hs.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=hs[t]=Vt(function(t){return(t=hs.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=hs.year(t).getDay();return Math.floor((hs.dayOfYear(t)+(r+e)%7)/7)-(r!==e)});hs[t+"s"]=r.range,hs[t+"s"].utc=r.utc.range,hs[t+"OfYear"]=function(t){var r=hs.year(t).getDay();return Math.floor((hs.dayOfYear(t)+(r+e)%7)/7)}}),hs.week=hs.sunday,hs.weeks=hs.sunday.range,hs.weeks.utc=hs.sunday.utc.range,hs.weekOfYear=hs.sundayOfYear;var gs={"-":"",_:" ",0:"0"},vs=/^\s*\d+/,ms=/^%/;uo.locale=function(t){return{numberFormat:Ft(t),timeFormat:qt(t)}};var ys=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=ys.numberFormat,uo.geo={},fe.prototype={s:0,t:0,add:function(t){he(t,this.t,bs),he(bs.s,this.s,this),this.s?this.t+=bs.t:this.s=bs.t},reset:function(){this.s=this.t=0},valueOf:function(){return this.s}};var bs=new fe;uo.geo.stream=function(t,e){t&&xs.hasOwnProperty(t.type)?xs[t.type](t,e):de(t,e)};var xs={Feature:function(t,e){de(t.geometry,e)},FeatureCollection:function(t,e){for(var r=t.features,n=-1,i=r.length;++nd&&(d=e)}function e(e,r){var n=me([e*Ho,r*Ho]);if(m){var i=be(m,n),a=[i[1],-i[0],0],o=be(a,i);we(o),o=Me(o);var l=e-p,u=l>0?1:-1,g=o[0]*qo*u,v=xo(l)>180;if(v^(u*pd&&(d=y)}else if(g=(g+360)%360-180,v^(u*pd&&(d=r);v?es(c,h)&&(h=e):s(e,h)>s(c,h)&&(c=e):h>=c?(eh&&(h=e)):e>p?s(c,e)>s(c,h)&&(h=e):s(e,h)>s(c,h)&&(c=e)}else t(e,r);m=n,p=e}function r(){_.point=e}function n(){x[0]=c,x[1]=h,_.point=t,m=null}function i(t,r){if(m){var n=t-p;y+=xo(n)>180?n+(n>0?360:-360):n}else g=t,v=r;As.point(t,r),e(t,r)}function a(){As.lineStart()}function o(){i(g,v),As.lineEnd(),xo(y)>Do&&(c=-(h=180)),x[0]=c,x[1]=h,m=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]:tDo?d=90:y<-Do&&(f=-90),x[0]=c,x[1]=h}};return function(t){d=h=-(c=f=1/0),b=[],uo.geo.stream(t,_);var e=b.length;if(e){b.sort(l);for(var r,n=1,i=b[0],a=[i];ns(i[0],i[1])&&(i[1]=r[1]),s(r[0],i[1])>s(i[0],i[1])&&(i[0]=r[0])):a.push(i=r);for(var o,r,p=-1/0,e=a.length-1,n=0,i=a[e];n<=e;i=r,++n)r=a[n],(o=s(i[1],r[0]))>p&&(p=o,c=r[0],h=i[1])}return b=x=null,c===1/0||f===1/0?[[NaN,NaN],[NaN,NaN]]:[[c,f],[h,d]]}}(),uo.geo.centroid=function(t){ks=Ts=Es=Ls=Cs=Ss=Ps=Rs=Os=Ns=Is=0,uo.geo.stream(t,zs);var e=Os,r=Ns,n=Is,i=e*e+r*r+n*n;return i=.12&&i<.234&&n>=-.425&&n<-.214?o:i>=.166&&i<.234&&n>=-.214&&n<-.115?s:a).invert(t)},t.stream=function(t){var e=a.stream(t),r=o.stream(t),n=s.stream(t);return{point:function(t,i){e.point(t,i),r.point(t,i),n.point(t,i)},sphere:function(){e.sphere(),r.sphere(),n.sphere()},lineStart:function(){e.lineStart(),r.lineStart(),n.lineStart()},lineEnd:function(){e.lineEnd(),r.lineEnd(),n.lineEnd()},polygonStart:function(){e.polygonStart(),r.polygonStart(),n.polygonStart()},polygonEnd:function(){e.polygonEnd(),r.polygonEnd(),n.polygonEnd()}}},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 r=a.translate(e).clipExtent([[c-.455*u,f-.238*u],[c+.455*u,f+.238*u]]).stream(l).point,n=o.translate([c-.307*u,f+.201*u]).clipExtent([[c-.425*u+Do,f+.12*u+Do],[c-.214*u-Do,f+.234*u-Do]]).stream(l).point,i=s.translate([c-.205*u,f+.212*u]).clipExtent([[c-.214*u+Do,f+.166*u+Do],[c-.115*u-Do,f+.234*u-Do]]).stream(l).point,t},t.scale(1070)};var Fs,Bs,Us,Vs,Hs,qs,Gs={point:M,lineStart:M,lineEnd:M,polygonStart:function(){Bs=0,Gs.lineStart=Ye},polygonEnd:function(){Gs.lineStart=Gs.lineEnd=Gs.point=M,Fs+=xo(Bs/2)}},Xs={point:Ze,lineStart:M,lineEnd:M,polygonStart:M,polygonEnd:M},Ws={point:Ke,lineStart:Je,lineEnd:tr,polygonStart:function(){Ws.lineStart=er},polygonEnd:function(){Ws.point=Ke,Ws.lineStart=Je,Ws.lineEnd=tr}};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 r,n,i,a,o,s=4.5;return t.area=function(t){return Fs=0,uo.geo.stream(t,i(Gs)),Fs},t.centroid=function(t){return Es=Ls=Cs=Ss=Ps=Rs=Os=Ns=Is=0,uo.geo.stream(t,i(Ws)),Is?[Os/Is,Ns/Is]:Rs?[Ss/Rs,Ps/Rs]:Cs?[Es/Cs,Ls/Cs]:[NaN,NaN]},t.bounds=function(t){return Hs=qs=-(Us=Vs=1/0),uo.geo.stream(t,i(Xs)),[[Us,Vs],[Hs,qs]]},t.projection=function(t){return arguments.length?(i=(r=t)?t.stream||ir(t):x,e()):r},t.context=function(t){return arguments.length?(a=null==(n=t)?new Qe:new rr(t),"function"!=typeof s&&a.pointRadius(s),e()):n},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 r=new ar(e);for(var n in t)r[n]=t[n];return r}}},ar.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=sr,uo.geo.projectionMutator=lr,(uo.geo.equirectangular=function(){return sr(cr)}).raw=cr.invert=cr,uo.geo.rotation=function(t){function e(e){return e=t(e[0]*Ho,e[1]*Ho),e[0]*=qo,e[1]*=qo,e}return t=hr(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]*=qo,e[1]*=qo,e},e},fr.invert=cr,uo.geo.circle=function(){function t(){var t="function"==typeof n?n.apply(this,arguments):n,e=hr(-t[0]*Ho,-t[1]*Ho,0).invert,i=[];return r(null,null,1,{point:function(t,r){i.push(t=e(t,r)),t[0]*=qo,t[1]*=qo}}),{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=vr((e=+n)*Ho,i*Ho),t):e},t.precision=function(n){return arguments.length?(r=vr(e*Ho,(i=+n)*Ho),t):i},t.angle(90)},uo.geo.distance=function(t,e){var r,n=(e[0]-t[0])*Ho,i=t[1]*Ho,a=e[1]*Ho,o=Math.sin(n),s=Math.cos(n),l=Math.sin(i),u=Math.cos(i),c=Math.sin(a),f=Math.cos(a);return Math.atan2(Math.sqrt((r=f*o)*r+(r=u*c-l*f*s)*r),l*c+u*f*s)},uo.geo.graticule=function(){function t(){return{type:"MultiLineString",coordinates:e()}}function e(){return uo.range(Math.ceil(a/v)*v,i,v).map(h).concat(uo.range(Math.ceil(u/m)*m,l,m).map(d)).concat(uo.range(Math.ceil(n/p)*p,r,p).filter(function(t){return xo(t%v)>Do}).map(c)).concat(uo.range(Math.ceil(s/g)*g,o,g).filter(function(t){return xo(t%m)>Do}).map(f))}var r,n,i,a,o,s,l,u,c,f,h,d,p=10,g=p,v=90,m=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?(n=+e[0][0],r=+e[1][0],s=+e[0][1],o=+e[1][1],n>r&&(e=n,n=r,r=e),s>o&&(e=s,s=o,o=e),t.precision(y)):[[n,s],[r,o]]},t.step=function(e){return arguments.length?t.majorStep(e).minorStep(e):t.minorStep()},t.majorStep=function(e){return arguments.length?(v=+e[0],m=+e[1],t):[v,m]},t.minorStep=function(e){return arguments.length?(p=+e[0],g=+e[1],t):[p,g]},t.precision=function(e){return arguments.length?(y=+e,c=yr(s,o,90),f=br(n,r,y),h=yr(u,l,90),d=br(a,i,y),t):y},t.majorExtent([[-180,-90+Do],[180,90-Do]]).minorExtent([[-180,-80-Do],[180,80+Do]])},uo.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 uo.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},uo.geo.interpolate=function(t,e){return wr(t[0]*Ho,t[1]*Ho,e[0]*Ho,e[1]*Ho)},uo.geo.length=function(t){return Ys=0,uo.geo.stream(t,Zs),Ys};var Ys,Zs={sphere:M,point:M,lineStart:Mr,lineEnd:M,polygonStart:M,polygonEnd:M},Qs=Ar(function(t){return Math.sqrt(2/(1+t))},function(t){return 2*Math.asin(t/2)});(uo.geo.azimuthalEqualArea=function(){return sr(Qs)}).raw=Qs;var $s=Ar(function(t){var e=Math.acos(t);return e&&e/Math.sin(e)},x);(uo.geo.azimuthalEquidistant=function(){return sr($s)}).raw=$s,(uo.geo.conicConformal=function(){return Xe(kr)}).raw=kr,(uo.geo.conicEquidistant=function(){return Xe(Tr)}).raw=Tr;var Ks=Ar(function(t){return 1/t},Math.atan);(uo.geo.gnomonic=function(){return sr(Ks)}).raw=Ks,Er.invert=function(t,e){return[t,2*Math.atan(Math.exp(e))-Vo]},(uo.geo.mercator=function(){return Lr(Er)}).raw=Er -;var Js=Ar(function(){return 1},Math.asin);(uo.geo.orthographic=function(){return sr(Js)}).raw=Js;var tl=Ar(function(t){return 1/(1+t)},function(t){return 2*Math.atan(t)});(uo.geo.stereographic=function(){return sr(tl)}).raw=tl,Cr.invert=function(t,e){return[-e,2*Math.atan(Math.exp(t))-Vo]},(uo.geo.transverseMercator=function(){var t=Lr(Cr),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=Cr,uo.geom={},uo.geom.hull=function(t){function e(t){if(t.length<3)return[];var e,i=Lt(r),a=Lt(n),o=t.length,s=[],l=[];for(e=0;e=0;--e)d.push(t[s[u[e]][2]]);for(e=+f;e=n&&u.x<=a&&u.y>=i&&u.y<=o?[[n,o],[a,o],[a,i],[n,i]]:[]).point=t[s]}),e}function r(t){return t.map(function(t,e){return{x:Math.round(a(t,e)/Do)*Do,y:Math.round(o(t,e)/Do)*Do,i:e}})}var n=Sr,i=Pr,a=n,o=i,s=ul;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,a=r.site,o=r.edges.sort(Xr),s=-1,l=o.length,u=o[l-1].edge,c=u.l===a?u.r:u.l;++s=u,h=n>=c,d=h<<1|f;t.leaf=!1,t=t.nodes[d]||(t.nodes[d]=pn()),f?i=u:s=u,h?o=c:l=c,a(t,e,r,n,i,o,s,l)}var c,f,h,d,p,g,v,m,y,b=Lt(s),x=Lt(l);if(null!=e)g=e,v=r,m=n,y=i;else if(m=y=-(g=v=1/0),f=[],h=[],p=t.length,o)for(d=0;dm&&(m=c.x),c.y>y&&(y=c.y),f.push(c.x),h.push(c.y);else for(d=0;dm&&(m=_),w>y&&(y=w),f.push(_),h.push(w)}var M=m-g,A=y-v;M>A?y=v+M:m=g+A;var k=pn();if(k.add=function(t){a(k,t,+b(t,++d),+x(t,d),g,v,m,y)},k.visit=function(t){gn(t,k,g,v,m,y)},k.find=function(t){return vn(k,t[0],t[1],g,v,m,y)},d=-1,null==e){for(;++d=0?t.slice(0,e):t,n=e>=0?t.slice(e+1):"in";return r=dl.get(r)||hl,n=pl.get(n)||x,Mn(n(r.apply(null,co.call(arguments,1))))},uo.interpolateHcl=zn,uo.interpolateHsl=Dn,uo.interpolateLab=jn,uo.interpolateRound=Fn,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 r=e.transform.baseVal.consolidate()}return new Bn(r?r.matrix:gl)})(t)},Bn.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var gl={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;++r0?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=Ot(l.tick)),l):i},l.start=function(){function t(t,n){if(!r){for(r=new Array(i),l=0;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;++us&&(s=n),o.push(n)}for(r=0;r0)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=Mi,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 Pi(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(Ai),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;o0&&(zi(ji(o,t,r),t,n),u+=n,c+=n),f+=o.m,u+=i.m,h+=l.m,c+=a.m;o&&!Ii(a)&&(a.t=o,a.m+=f-c),i&&!Ni(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=Oi,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=Fi(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=Oi,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;++i0;)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;++oi&&(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);++a1);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;rf?0:1;if(u=Uo)return e(u,d)+(t?e(t,1-d):"")+"Z";var p,g,v,m,y,b,x,_,w,M,A,k,T=0,E=0,L=[];if((m=(+l.apply(this,arguments)||0)/2)&&(v=a===Sl?Math.sqrt(t*t+u*u):+a.apply(this,arguments),d||(E*=-1),u&&(E=nt(v/u*Math.sin(m))),t&&(T=nt(v/t*Math.sin(m)))),u){y=u*Math.cos(c+E),b=u*Math.sin(c+E),x=u*Math.cos(f-E),_=u*Math.sin(f-E);var C=Math.abs(f-c-2*E)<=Fo?0:1;if(E&&ba(y,b,x,_)===d^C){var S=(c+f)/2;y=u*Math.cos(S),b=u*Math.sin(S),x=_=null}}else y=b=0;if(t){w=t*Math.cos(f-T),M=t*Math.sin(f-T),A=t*Math.cos(c+T),k=t*Math.sin(c+T);var P=Math.abs(c-f+2*T)<=Fo?0:1;if(T&&ba(w,M,A,k)===1-d^P){var R=(c+f)/2;w=t*Math.cos(R),M=t*Math.sin(R),A=k=null}}else w=M=0;if(h>Do&&(p=Math.min(Math.abs(u-t)/2,+i.apply(this,arguments)))>.001){g=tFo)+",1 "+e}function i(t,e,r,n){return"Q 0,0 "+n}var a=xr,o=_r,s=qa,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(Il.get(e.call(this,t,n))||Za)(r.call(this,t,n))}var e=Ya,r=Wa;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 Il=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*Dl)),r=e*Dl;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/zl),r=e*zl/2;return"M0,"+r+"L"+e+","+-r+" "+-e+","+-r+"Z"},"triangle-up":function(t){var e=Math.sqrt(t/zl),r=e*zl/2;return"M0,"+-r+"L"+e+","+r+" "+-e+","+r+"Z"}});uo.svg.symbolTypes=Il.keys();var zl=Math.sqrt(3),Dl=Math.tan(30*Ho);Co.transition=function(t){for(var e,r,n=jl||++Vl,i=to(t),a=[],o=Fl||{time:Date.now(),ease:Ln,delay:0,duration:250},s=-1,l=this.length;++srect,.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&&(C||(b=null,P[0]-=f[1],P[1]-=h[1],C=2),T())}function g(){32==uo.event.keyCode&&2==C&&(P[0]+=f[1],P[1]+=h[1],C=0,T())}function v(){var t=uo.mouse(_),n=!1;x&&(t[0]+=x[0],t[1]+=x[1]),C||(uo.event.altKey?(b||(b=[(f[0]+f[1])/2,(h[0]+h[1])/2]),P[0]=f[+(t[0]=2)return!1;t[r]=n}return!0}):w.filter(function(t){for(var e=0;e<=o;++e){var r=y[t[e]];if(r<0)return!1;t[e]=r}return!0}),1&o)for(var f=0;f>>31},e.exports.exponent=function(t){return(e.exports.hi(t)<<1>>>21)-1023},e.exports.fraction=function(t){var r=e.exports.lo(t),n=e.exports.hi(t),i=1048575&n;return 2146435072&n&&(i+=1<<20),[r,i]},e.exports.denormalized=function(t){return!(2146435072&e.exports.hi(t))}}).call(this,t("buffer").Buffer)},{buffer:45}],82:[function(t,e,r){"use strict";function n(t,e,r){var i=0|t[r];if(i<=0)return[];var a,o=new Array(i);if(r===t.length-1)for(a=0;a0)return i(0|t,e);break;case"object":if("number"==typeof t.length)return n(t,e,0)}return[]}e.exports=a},{}],83:[function(t,e,r){"use strict";function n(t,e){var r=t.length;if("number"!=typeof e){e=0;for(var n=0;n0&&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,a,s;if(!i(e))throw TypeError("listener must be a function");if(!this._events||!this._events[t])return this;if(r=this._events[t],a=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(o(r)){for(s=a;s-- >0;)if(r[s]===e||r[s].listener&&r[s].listener===e){n=s;break}if(n<0)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){return 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)}},{}],86:[function(t,e,r){"use strict";function n(t,e,r){var n=e||0,i=r||1;return[[t[12]+t[0],t[13]+t[1],t[14]+t[2],t[15]+t[3]],[t[12]-t[0],t[13]-t[1],t[14]-t[2],t[15]-t[3]],[t[12]+t[4],t[13]+t[5],t[14]+t[6],t[15]+t[7]],[t[12]-t[4],t[13]-t[5],t[14]-t[6],t[15]-t[7]],[n*t[12]+t[8],n*t[13]+t[9],n*t[14]+t[10],n*t[15]+t[11]],[i*t[12]-t[8],i*t[13]-t[9],i*t[14]-t[10],i*t[15]-t[11]]]}e.exports=n},{}],87:[function(t,e,r){"use strict";function n(t){for(var e,r=t.length,n=0;n13)&&32!==e&&133!==e&&160!==e&&5760!==e&&6158!==e&&(e<8192||e>8205)&&8232!==e&&8233!==e&&8239!==e&&8287!==e&&8288!==e&&12288!==e&&65279!==e)return!1;return!0}e.exports=function(t){var e=typeof t;if("string"===e){var r=t;if(0===(t=+t)&&n(r))return!1}else if("number"!==e)return!1;return t-t<1}},{}],88:[function(t,e,r){"use strict";function n(t,e,r){return Math.min(e,Math.max(t,r))}function i(t,e,r){this.dimension=t.length,this.bounds=[new Array(this.dimension),new Array(this.dimension)];for(var n=0;n=r-1)for(var h=o.length-1,p=t-e[r-1],d=0;d=r-1)for(var c=a.length-1,f=(e[r-1],0);f=0;--r)if(t[--e])return!1;return!0},u.jump=function(t){var e=this.lastT(),r=this.dimension;if(!(t0;--f)i.push(n(l[f-1],u[f-1],arguments[f])),a.push(0)}},u.push=function(t){var e=this.lastT(),r=this.dimension;if(!(t1e-6?1/s:0;this._time.push(t);for(var h=r;h>0;--h){var d=n(u[h-1],c[h-1],arguments[h]);i.push(d),a.push((d-i[o++])*f)}}},u.set=function(t){var e=this.dimension;if(!(t0;--l)r.push(n(o[l-1],s[l-1],arguments[l])),i.push(0)}},u.move=function(t){var e=this.lastT(),r=this.dimension;if(!(t<=e||arguments.length!==r+1)){var i=this._state,a=this._velocity,o=i.length-this.dimension,s=this.bounds,l=s[0],u=s[1],c=t-e,f=c>1e-6?1/c:0;this._time.push(t);for(var h=r;h>0;--h){var d=arguments[h];i.push(n(l[h-1],u[h-1],i[o++]+d)),a.push(d*f)}}},u.idle=function(t){var e=this.lastT();if(!(t=0;--f)i.push(n(l[f],u[f],i[o]+c*a[o])),a.push(0),o+=1}}},{"binary-search-bounds":34,"cubic-hermite":74}],89:[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||(e.right?l(t,e.right):void 0)}function u(t,e,r,n){if(e(t,n.key)<=0){if(n.left){var i=u(t,e,r,n.left);if(i)return i}var i=r(n.key,n.value);if(i)return i}if(n.right)return u(t,e,r,n.right)}function c(t,e,r,n,i){var a,o=r(t,i.key),s=r(e,i.key);if(o<=0){if(i.left&&(a=c(t,e,r,n,i.left)))return a;if(s>0&&(a=n(i.key,i.value)))return a}if(s>0&&i.right)return c(t,e,r,n,i.right)}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+1e?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=c<=0?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(t<0)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),a<=0&&(i=n.length),r=a<=0?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),a<0&&(i=n.length),r=a<0?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=a<=0?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=a<0?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=i<=0?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=n<=0?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)return this._stack[this._stack.length-1].key},enumerable:!0}),Object.defineProperty(b,"value",{get:function(){if(this._stack.length>0)return this._stack[this._stack.length-1].value},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}})},{}],90:[function(t,e,r){function n(t){if(t<0)return Number("0/0");for(var e=o[0],r=o.length-1;r>0;--r)e+=o[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=[.9999999999998099,676.5203681218851,-1259.1392167224028,771.3234287776531,-176.6150291621406,12.507343278686905,-.13857109526572012,9984369578019572e-21,1.5056327351493116e-7],a=607/128,o=[.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 t(e){if(e<.5)return Math.PI/(Math.sin(Math.PI*e)*t(1-e));if(e>100)return Math.exp(n(e));e-=1;for(var r=i[0],a=1;a<9;a++)r+=i[a]/(e+a);var o=e+7+.5;return Math.sqrt(2*Math.PI)*Math.pow(o,e+.5)*Math.exp(-o)*r},e.exports.log=n},{}],91:[function(t,e,r){function n(t,e){if("string"!=typeof t)throw new TypeError("must specify type string");if(e=e||{},"undefined"==typeof document&&!e.canvas)return null;var r=e.canvas||document.createElement("canvas");"number"==typeof e.width&&(r.width=e.width),"number"==typeof e.height&&(r.height=e.height);var n,i=e;try{var a=[t];0===t.indexOf("webgl")&&a.push("experimental-"+t);for(var o=0;o0?(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,a=t[n],o=this[n];(e?Array.isArray(a)&&Array.isArray(a[0]):Array.isArray(a))?this[n]=i=[r(a[0]),r(a[1]),r(a[2])]:this[n]=i=[r(a),r(a),r(a)];for(var s=0;s<3;++s)if(i[s]!==o[s])return!0}return!1}t=t||{};var r,n=e.bind(this,!1,Number),i=e.bind(this,!1,Boolean),a=e.bind(this,!1,String),o=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;d<2;++d)for(var p=0;p<3;++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;d<3;++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;d<3;++d)r[d].sort(function(t,e){return t.x-e.x});h.equal(r,this.ticks)?s=!1:this.ticks=r}i("tickEnable"),a("tickFont")&&(s=!0),n("tickSize"),n("tickAngle"),n("tickPad"),o("tickColor");var g=a("labels");a("labelFont")&&(g=!0),i("labelEnable"),n("labelSize"),n("labelPad"),o("labelColor"),i("lineEnable"),i("lineMirror"),n("lineWidth"),o("lineColor"),i("lineTickEnable"),i("lineTickMirror"),n("lineTickLength"),n("lineTickWidth"),o("lineTickColor"),i("gridEnable"),n("gridWidth"),o("gridColor"),i("zeroEnable"),o("zeroLineColor"),n("zeroLineWidth"),i("backgroundEnable"),o("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 a,new a,new a],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,a=t.projection||d,s=this.bounds,l=f(r,i,a,s),u=l.cubeEdges,c=l.axis,h=i[12],p=i[13],_=i[14],w=i[15],M=this.pixelRatio*(a[3]*h+a[7]*p+a[11]*_+a[15]*w)/e.drawingBufferHeight,A=0;A<3;++A)this.lastCubeProps.cubeEdges[A]=u[A],this.lastCubeProps.axis[A]=c[A];for(var k=g,A=0;A<3;++A)o(g[A],A,this.bounds,u,c);for(var e=this.gl,T=v,A=0;A<3;++A)this.backgroundEnable[A]?T[A]=c[A]:T[A]=0;this._background.draw(r,i,a,s,T,this.backgroundColor),this._lines.bind(r,i,a,this);for(var A=0;A<3;++A){var E=[0,0,0];c[A]>0?E[A]=s[1][A]:E[A]=s[0][A];for(var L=0;L<2;++L){var C=(A+1+L)%3,S=(A+1+(1^L))%3;this.gridEnable[C]&&this._lines.drawGrid(C,S,this.bounds,E,this.gridColor[C],this.gridWidth[C]*this.pixelRatio)}for(var L=0;L<2;++L){var C=(A+1+L)%3,S=(A+1+(1^L))%3;this.zeroEnable[S]&&s[0][S]<=0&&s[1][S]>=0&&this._lines.drawZero(C,S,this.bounds,E,this.zeroLineColor[S],this.zeroLineWidth[S]*this.pixelRatio)}}for(var A=0;A<3;++A){this.lineEnable[A]&&this._lines.drawAxisLine(A,this.bounds,k[A].primalOffset,this.lineColor[A],this.lineWidth[A]*this.pixelRatio),this.lineMirror[A]&&this._lines.drawAxisLine(A,this.bounds,k[A].mirrorOffset,this.lineColor[A],this.lineWidth[A]*this.pixelRatio);for(var P=n(y,k[A].primalMinor),R=n(b,k[A].mirrorMinor),O=this.lineTickLength,L=0;L<3;++L){var N=M/r[5*L];P[L]*=O[L]*N,R[L]*=O[L]*N}this.lineTickEnable[A]&&this._lines.drawAxisTicks(A,k[A].primalOffset,P,this.lineTickColor[A],this.lineTickWidth[A]*this.pixelRatio),this.lineTickMirror[A]&&this._lines.drawAxisTicks(A,k[A].mirrorOffset,R,this.lineTickColor[A],this.lineTickWidth[A]*this.pixelRatio)}this._text.bind(r,i,a,this.pixelRatio);for(var A=0;A<3;++A){for(var I=k[A].primalMinor,z=n(x,k[A].primalOffset),L=0;L<3;++L)this.lineTickEnable[A]&&(z[L]+=M*I[L]*Math.max(this.lineTickLength[L],0)/r[5*L]);if(this.tickEnable[A]){for(var L=0;L<3;++L)z[L]+=M*I[L]*this.tickPad[L]/r[5*L];this._text.drawTicks(A,this.tickSize[A],this.tickAngle[A],z,this.tickColor[A])}if(this.labelEnable[A]){for(var L=0;L<3;++L)z[L]+=M*I[L]*this.labelPad[L]/r[5*L];z[A]+=.5*(s[0][A]+s[1][A]),this._text.drawLabel(A,this.labelSize[A],this.labelAngle[A],z,this.labelColor[A])}}},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":93,"./lib/cube.js":94,"./lib/lines.js":95,"./lib/text.js":97,"./lib/ticks.js":98}],93:[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;l<3;++l)for(var u=(l+1)%3,c=(l+2)%3,f=[0,0,0],h=[0,0,0],d=-1;d<=1;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;p<=1;p+=2){f[u]=p;for(var g=-1;g<=1;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=a(t,new Float32Array(e)),y=a(t,new Uint16Array(r),t.ELEMENT_ARRAY_BUFFER),b=o(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 a=t("gl-buffer"),o=t("gl-vao"),s=t("./shaders").bg,l=n.prototype;l.draw=function(t,e,r,n,i,a){for(var o=!1,s=0;s<3;++s)o=o||i[s];if(o){var l=this.gl;l.enable(l.POLYGON_OFFSET_FILL),l.polygonOffset(1,2),this.shader.bind(),this.shader.uniforms={model:t,view:e,projection:r,bounds:n,enable:i,colors:a},this.vao.bind(),this.vao.draw(this.gl.TRIANGLES,36),l.disable(l.POLYGON_OFFSET_FILL)}},l.dispose=function(){this.vao.dispose(),this.buffer.dispose(),this.shader.dispose()}},{"./shaders":96,"gl-buffer":100,"gl-vao":155}],94:[function(t,e,r){"use strict";function n(t,e,r){for(var n=0;n<4;++n){t[n]=r[12+n];for(var i=0;i<3;++i)t[n]+=e[i]*r[4*i+n]}}function i(t){for(var e=0;eE&&(_|=1<E&&(_|=1<h[g][1]&&(I=g));for(var z=-1,g=0;g<3;++g){var D=I^1<h[j][0]&&(j=D)}}var F=v;F[0]=F[1]=F[2]=0,F[o.log2(z^I)]=I&z,F[o.log2(I^j)]=I&j;var B=7^j;B===_||B===N?(B=7^z,F[o.log2(j^B)]=B&j):F[o.log2(z^B)]=B&z;for(var U=m,V=_,A=0;A<3;++A)U[A]=V&1< 0.0) {\n vec3 nPosition = mix(bounds[0], bounds[1], 0.5 * (position + 1.0));\n gl_Position = projection * view * model * vec4(nPosition, 1.0);\n } else {\n gl_Position = vec4(0,0,0,0);\n }\n colorChannel = abs(normal);\n}","precision mediump float;\n#define GLSLIFY 1\n\nuniform vec4 colors[3];\n\nvarying vec3 colorChannel;\n\nvoid main() {\n gl_FragColor = colorChannel.x * colors[0] + \n colorChannel.y * colors[1] +\n colorChannel.z * colors[2];\n}",null,[{name:"position",type:"vec3"},{name:"normal",type:"vec3"}])}},{"gl-shader":140}],97:[function(t,e,r){(function(r){"use strict";function n(t,e,r,n){this.gl=t,this.shader=e,this.buffer=r,this.vao=n,this.tickOffset=this.tickCount=this.labelOffset=this.labelCount=null}function i(t,e){try{return l(t,e)}catch(t){return console.warn("error vectorizing text:",t),{cells:[],positions:[]}}}function a(t,e,r,i,a,l){var c=o(t),f=s(t,[{buffer:c,size:3}]),h=u(t);h.attributes.position.location=0;var d=new n(t,h,c,f);return d.update(e,r,i,a,l),d}e.exports=a;var o=t("gl-buffer"),s=t("gl-vao"),l=t("vectorize-text"),u=t("./shaders").text,c=window||r.global||{},f=c.__TEXT_CACHE||{};c.__TEXT_CACHE={};var h=n.prototype,d=[0,0];h.bind=function(t,e,r,n){this.vao.bind(),this.shader.bind();var i=this.shader.uniforms;i.model=t,i.view=e,i.projection=r,i.pixelScale=n,d[0]=this.gl.drawingBufferWidth,d[1]=this.gl.drawingBufferHeight,this.shader.uniforms.resolution=d},h.update=function(t,e,r,n,a){function o(t,e,r,n){var a=f[r];a||(a=f[r]={});var o=a[e];o||(o=a[e]=i(e,{triangles:!0,font:r,textAlign:"center",textBaseline:"middle"}));for(var l=(n||12)/12,u=o.positions,c=o.cells,h=0,d=c.length;h=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],h=[0,0,0],d=0;d<3;++d){c[d]=s.length/3|0,o(.5*(t[0][d]+t[1][d]),e[d],r),h[d]=(s.length/3|0)-c[d],l[d]=s.length/3|0;for(var p=0;p=0&&(i=r.length-n-1);var a=Math.pow(10,i),o=Math.round(t*e*a),s=o+"";if(s.indexOf("e")>=0)return s;var l=o/a,u=o%a;o<0?(l=0|-Math.ceil(l),u=0|-u):(l=0|Math.floor(l),u|=0);var c=""+l;if(o<0&&(c="-"+c),i){for(var f=""+u;f.length=t[0][i];--o)a.push({x:o*e[i],text:n(e[i],o)});r.push(a)}return r}function a(t,e){for(var r=0;r<3;++r){if(t[r].length!==e[r].length)return!1;for(var n=0;nr)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;i=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&&void 0!==t.shape){var r=t.dtype;if(f.indexOf(r)<0&&(r="float32"),this.type===this.gl.ELEMENT_ARRAY_BUFFER){r=gl.getExtension("OES_element_index_uint")&&"uint16"!==r?"uint32":"uint16"}if(r===t.dtype&&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 n=l.malloc(t.size,r),s=c(n,t.shape);u.assign(s,t),this.length=e<0?i(this.gl,this.type,this.length,this.usage,n,e):i(this.gl,this.type,this.length,this.usage,n.subarray(0,t.size),e),l.free(n)}}else if(Array.isArray(t)){var h;h=this.type===this.gl.ELEMENT_ARRAY_BUFFER?a(t,"uint16"):a(t,"float32"), -this.length=e<0?i(this.gl,this.type,this.length,this.usage,h,e):i(this.gl,this.type,this.length,this.usage,h.subarray(0,t.length),e),l.free(h)}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=1),this.gl.bufferData(this.type,0|t,this.usage),this.length=t}},e.exports=s},{ndarray:203,"ndarray-ops":197,"typedarray-pool":258}],101:[function(t,e,r){e.exports={0:"NONE",1:"ONE",2:"LINE_LOOP",3:"LINE_STRIP",4:"TRIANGLES",5:"TRIANGLE_STRIP",6:"TRIANGLE_FAN",256:"DEPTH_BUFFER_BIT",512:"NEVER",513:"LESS",514:"EQUAL",515:"LEQUAL",516:"GREATER",517:"NOTEQUAL",518:"GEQUAL",519:"ALWAYS",768:"SRC_COLOR",769:"ONE_MINUS_SRC_COLOR",770:"SRC_ALPHA",771:"ONE_MINUS_SRC_ALPHA",772:"DST_ALPHA",773:"ONE_MINUS_DST_ALPHA",774:"DST_COLOR",775:"ONE_MINUS_DST_COLOR",776:"SRC_ALPHA_SATURATE",1024:"STENCIL_BUFFER_BIT",1028:"FRONT",1029:"BACK",1032:"FRONT_AND_BACK",1280:"INVALID_ENUM",1281:"INVALID_VALUE",1282:"INVALID_OPERATION",1285:"OUT_OF_MEMORY",1286:"INVALID_FRAMEBUFFER_OPERATION",2304:"CW",2305:"CCW",2849:"LINE_WIDTH",2884:"CULL_FACE",2885:"CULL_FACE_MODE",2886:"FRONT_FACE",2928:"DEPTH_RANGE",2929:"DEPTH_TEST",2930:"DEPTH_WRITEMASK",2931:"DEPTH_CLEAR_VALUE",2932:"DEPTH_FUNC",2960:"STENCIL_TEST",2961:"STENCIL_CLEAR_VALUE",2962:"STENCIL_FUNC",2963:"STENCIL_VALUE_MASK",2964:"STENCIL_FAIL",2965:"STENCIL_PASS_DEPTH_FAIL",2966:"STENCIL_PASS_DEPTH_PASS",2967:"STENCIL_REF",2968:"STENCIL_WRITEMASK",2978:"VIEWPORT",3024:"DITHER",3042:"BLEND",3088:"SCISSOR_BOX",3089:"SCISSOR_TEST",3106:"COLOR_CLEAR_VALUE",3107:"COLOR_WRITEMASK",3317:"UNPACK_ALIGNMENT",3333:"PACK_ALIGNMENT",3379:"MAX_TEXTURE_SIZE",3386:"MAX_VIEWPORT_DIMS",3408:"SUBPIXEL_BITS",3410:"RED_BITS",3411:"GREEN_BITS",3412:"BLUE_BITS",3413:"ALPHA_BITS",3414:"DEPTH_BITS",3415:"STENCIL_BITS",3553:"TEXTURE_2D",4352:"DONT_CARE",4353:"FASTEST",4354:"NICEST",5120:"BYTE",5121:"UNSIGNED_BYTE",5122:"SHORT",5123:"UNSIGNED_SHORT",5124:"INT",5125:"UNSIGNED_INT",5126:"FLOAT",5386:"INVERT",5890:"TEXTURE",6401:"STENCIL_INDEX",6402:"DEPTH_COMPONENT",6406:"ALPHA",6407:"RGB",6408:"RGBA",6409:"LUMINANCE",6410:"LUMINANCE_ALPHA",7680:"KEEP",7681:"REPLACE",7682:"INCR",7683:"DECR",7936:"VENDOR",7937:"RENDERER",7938:"VERSION",9728:"NEAREST",9729:"LINEAR",9984:"NEAREST_MIPMAP_NEAREST",9985:"LINEAR_MIPMAP_NEAREST",9986:"NEAREST_MIPMAP_LINEAR",9987:"LINEAR_MIPMAP_LINEAR",10240:"TEXTURE_MAG_FILTER",10241:"TEXTURE_MIN_FILTER",10242:"TEXTURE_WRAP_S",10243:"TEXTURE_WRAP_T",10497:"REPEAT",10752:"POLYGON_OFFSET_UNITS",16384:"COLOR_BUFFER_BIT",32769:"CONSTANT_COLOR",32770:"ONE_MINUS_CONSTANT_COLOR",32771:"CONSTANT_ALPHA",32772:"ONE_MINUS_CONSTANT_ALPHA",32773:"BLEND_COLOR",32774:"FUNC_ADD",32777:"BLEND_EQUATION_RGB",32778:"FUNC_SUBTRACT",32779:"FUNC_REVERSE_SUBTRACT",32819:"UNSIGNED_SHORT_4_4_4_4",32820:"UNSIGNED_SHORT_5_5_5_1",32823:"POLYGON_OFFSET_FILL",32824:"POLYGON_OFFSET_FACTOR",32854:"RGBA4",32855:"RGB5_A1",32873:"TEXTURE_BINDING_2D",32926:"SAMPLE_ALPHA_TO_COVERAGE",32928:"SAMPLE_COVERAGE",32936:"SAMPLE_BUFFERS",32937:"SAMPLES",32938:"SAMPLE_COVERAGE_VALUE",32939:"SAMPLE_COVERAGE_INVERT",32968:"BLEND_DST_RGB",32969:"BLEND_SRC_RGB",32970:"BLEND_DST_ALPHA",32971:"BLEND_SRC_ALPHA",33071:"CLAMP_TO_EDGE",33170:"GENERATE_MIPMAP_HINT",33189:"DEPTH_COMPONENT16",33306:"DEPTH_STENCIL_ATTACHMENT",33635:"UNSIGNED_SHORT_5_6_5",33648:"MIRRORED_REPEAT",33901:"ALIASED_POINT_SIZE_RANGE",33902:"ALIASED_LINE_WIDTH_RANGE",33984:"TEXTURE0",33985:"TEXTURE1",33986:"TEXTURE2",33987:"TEXTURE3",33988:"TEXTURE4",33989:"TEXTURE5",33990:"TEXTURE6",33991:"TEXTURE7",33992:"TEXTURE8",33993:"TEXTURE9",33994:"TEXTURE10",33995:"TEXTURE11",33996:"TEXTURE12",33997:"TEXTURE13",33998:"TEXTURE14",33999:"TEXTURE15",34e3:"TEXTURE16",34001:"TEXTURE17",34002:"TEXTURE18",34003:"TEXTURE19",34004:"TEXTURE20",34005:"TEXTURE21",34006:"TEXTURE22",34007:"TEXTURE23",34008:"TEXTURE24",34009:"TEXTURE25",34010:"TEXTURE26",34011:"TEXTURE27",34012:"TEXTURE28",34013:"TEXTURE29",34014:"TEXTURE30",34015:"TEXTURE31",34016:"ACTIVE_TEXTURE",34024:"MAX_RENDERBUFFER_SIZE",34041:"DEPTH_STENCIL",34055:"INCR_WRAP",34056:"DECR_WRAP",34067:"TEXTURE_CUBE_MAP",34068:"TEXTURE_BINDING_CUBE_MAP",34069:"TEXTURE_CUBE_MAP_POSITIVE_X",34070:"TEXTURE_CUBE_MAP_NEGATIVE_X",34071:"TEXTURE_CUBE_MAP_POSITIVE_Y",34072:"TEXTURE_CUBE_MAP_NEGATIVE_Y",34073:"TEXTURE_CUBE_MAP_POSITIVE_Z",34074:"TEXTURE_CUBE_MAP_NEGATIVE_Z",34076:"MAX_CUBE_MAP_TEXTURE_SIZE",34338:"VERTEX_ATTRIB_ARRAY_ENABLED",34339:"VERTEX_ATTRIB_ARRAY_SIZE",34340:"VERTEX_ATTRIB_ARRAY_STRIDE",34341:"VERTEX_ATTRIB_ARRAY_TYPE",34342:"CURRENT_VERTEX_ATTRIB",34373:"VERTEX_ATTRIB_ARRAY_POINTER",34466:"NUM_COMPRESSED_TEXTURE_FORMATS",34467:"COMPRESSED_TEXTURE_FORMATS",34660:"BUFFER_SIZE",34661:"BUFFER_USAGE",34816:"STENCIL_BACK_FUNC",34817:"STENCIL_BACK_FAIL",34818:"STENCIL_BACK_PASS_DEPTH_FAIL",34819:"STENCIL_BACK_PASS_DEPTH_PASS",34877:"BLEND_EQUATION_ALPHA",34921:"MAX_VERTEX_ATTRIBS",34922:"VERTEX_ATTRIB_ARRAY_NORMALIZED",34930:"MAX_TEXTURE_IMAGE_UNITS",34962:"ARRAY_BUFFER",34963:"ELEMENT_ARRAY_BUFFER",34964:"ARRAY_BUFFER_BINDING",34965:"ELEMENT_ARRAY_BUFFER_BINDING",34975:"VERTEX_ATTRIB_ARRAY_BUFFER_BINDING",35040:"STREAM_DRAW",35044:"STATIC_DRAW",35048:"DYNAMIC_DRAW",35632:"FRAGMENT_SHADER",35633:"VERTEX_SHADER",35660:"MAX_VERTEX_TEXTURE_IMAGE_UNITS",35661:"MAX_COMBINED_TEXTURE_IMAGE_UNITS",35663:"SHADER_TYPE",35664:"FLOAT_VEC2",35665:"FLOAT_VEC3",35666:"FLOAT_VEC4",35667:"INT_VEC2",35668:"INT_VEC3",35669:"INT_VEC4",35670:"BOOL",35671:"BOOL_VEC2",35672:"BOOL_VEC3",35673:"BOOL_VEC4",35674:"FLOAT_MAT2",35675:"FLOAT_MAT3",35676:"FLOAT_MAT4",35678:"SAMPLER_2D",35680:"SAMPLER_CUBE",35712:"DELETE_STATUS",35713:"COMPILE_STATUS",35714:"LINK_STATUS",35715:"VALIDATE_STATUS",35716:"INFO_LOG_LENGTH",35717:"ATTACHED_SHADERS",35718:"ACTIVE_UNIFORMS",35719:"ACTIVE_UNIFORM_MAX_LENGTH",35720:"SHADER_SOURCE_LENGTH",35721:"ACTIVE_ATTRIBUTES",35722:"ACTIVE_ATTRIBUTE_MAX_LENGTH",35724:"SHADING_LANGUAGE_VERSION",35725:"CURRENT_PROGRAM",36003:"STENCIL_BACK_REF",36004:"STENCIL_BACK_VALUE_MASK",36005:"STENCIL_BACK_WRITEMASK",36006:"FRAMEBUFFER_BINDING",36007:"RENDERBUFFER_BINDING",36048:"FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE",36049:"FRAMEBUFFER_ATTACHMENT_OBJECT_NAME",36050:"FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL",36051:"FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE",36053:"FRAMEBUFFER_COMPLETE",36054:"FRAMEBUFFER_INCOMPLETE_ATTACHMENT",36055:"FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT",36057:"FRAMEBUFFER_INCOMPLETE_DIMENSIONS",36061:"FRAMEBUFFER_UNSUPPORTED",36064:"COLOR_ATTACHMENT0",36096:"DEPTH_ATTACHMENT",36128:"STENCIL_ATTACHMENT",36160:"FRAMEBUFFER",36161:"RENDERBUFFER",36162:"RENDERBUFFER_WIDTH",36163:"RENDERBUFFER_HEIGHT",36164:"RENDERBUFFER_INTERNAL_FORMAT",36168:"STENCIL_INDEX8",36176:"RENDERBUFFER_RED_SIZE",36177:"RENDERBUFFER_GREEN_SIZE",36178:"RENDERBUFFER_BLUE_SIZE",36179:"RENDERBUFFER_ALPHA_SIZE",36180:"RENDERBUFFER_DEPTH_SIZE",36181:"RENDERBUFFER_STENCIL_SIZE",36194:"RGB565",36336:"LOW_FLOAT",36337:"MEDIUM_FLOAT",36338:"HIGH_FLOAT",36339:"LOW_INT",36340:"MEDIUM_INT",36341:"HIGH_INT",36346:"SHADER_COMPILER",36347:"MAX_VERTEX_UNIFORM_VECTORS",36348:"MAX_VARYING_VECTORS",36349:"MAX_FRAGMENT_UNIFORM_VECTORS",37440:"UNPACK_FLIP_Y_WEBGL",37441:"UNPACK_PREMULTIPLY_ALPHA_WEBGL",37442:"CONTEXT_LOST_WEBGL",37443:"UNPACK_COLORSPACE_CONVERSION_WEBGL",37444:"BROWSER_DEFAULT_WEBGL"}},{}],102:[function(t,e,r){var n=t("./1.0/numbers");e.exports=function(t){return n[t]}},{"./1.0/numbers":101}],103:[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;r<3;++r)t[0][r]=Math.min(t[0][r],e[r]),t[1][r]=Math.max(t[1][r],e[r])}function a(t,e,r,n){for(var i=h[n],a=0;a=1},f.isTransparent=function(){return this.opacity<1},f.drawTransparent=f.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 a=n[12],o=n[13],s=n[14],l=n[15],u=this.pixelRatio*(i[3]*a+i[7]*o+i[11]*s+i[15]*l)/e.drawingBufferHeight;this.vao.bind();for(var f=0;f<3;++f)e.lineWidth(this.lineWidth[f]),r.capSize=this.capSize[f]*u,this.lineCount[f]&&e.drawArrays(e.LINES,this.lineOffset[f],this.lineCount[f]);this.vao.unbind()};var h=function(){for(var t=new Array(3),e=0;e<3;++e){for(var r=[],n=1;n<=2;++n)for(var i=-1;i<=1;i+=2){var a=(n+e)%3,o=[0,0,0];o[a]=i,r.push(o)}t[e]=r}return t}();f.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 o=[],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;u<3;++u){this.lineOffset[u]=l;t:for(var c=0;c0){var g=f.slice();g[u]+=d[1][u],o.push(f[0],f[1],f[2],p[0],p[1],p[2],p[3],0,0,0,g[0],g[1],g[2],p[0],p[1],p[2],p[3],0,0,0),i(this.bounds,g),l+=2+a(o,g,p,u)}}}this.lineCount[u]=l-this.lineOffset[u]}this.buffer.update(o)}},f.dispose=function(){this.shader.dispose(),this.buffer.dispose(),this.vao.dispose()}},{"./shaders/index":105,"gl-buffer":100,"gl-vao":155}],104:[function(t,e,r){e.exports=function(t){"string"==typeof t&&(t=[t]);for(var e=[].slice.call(arguments,1),r=[],n=0;n1&&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;vs||r<0||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;uo||r<0||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)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,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,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;e 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}",null,a)}},{"gl-shader":140}],109:[function(t,e,r){"use strict";function n(t,e){for(var r=0,n=0;n<3;++n){var i=t[n]-e[n];r+=i*i}return Math.sqrt(r)}function i(t){for(var e=[[-1e6,-1e6,-1e6],[1e6,1e6,1e6]],r=0;r<3;++r)e[0][r]=Math.max(t[0][r],e[0][r]),e[1][r]=Math.min(t[1][r],e[1][r]);return e}function a(t,e,r,n){this.arcLength=t,this.position=e,this.index=r,this.dataCoordinate=n}function o(t,e,r,n,i,a){this.gl=t,this.shader=e,this.pickShader=r,this.buffer=n,this.vao=i,this.clipBounds=[[-1/0,-1/0,-1/0],[1/0,1/0,1/0]],this.points=[],this.arcLength=[],this.vertexCount=0,this.bounds=[[0,0,0],[0,0,0]],this.pickId=0,this.lineWidth=1,this.texture=a,this.dashScale=1,this.opacity=1,this.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),a=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;f<1024;++f)s.data[f]=255;var h=c(e,s);h.wrap=e.REPEAT;var p=new o(e,r,n,i,a,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=o.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 a=t.position||t.positions;if(a){var o=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;e0){for(var b=0;b<24;++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(o[0])?(x=o[e-1],_=o[e]):x=_=o,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=f;if(f+=n(m,y),v){for(r=0;r<2;++r)l.push(m[0],m[1],m[2],y[0],y[1],y[2],M,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],M,w,x[0],x[1],x[2],x[3],m[0],m[1],m[2],y[0],y[1],y[2],M,-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(a[a.length-1].slice()),this.bounds=g,this.vertexCount=p,this.points=c,this.arcLength=u,"dashes"in t){var A=t.dashes,k=A.slice();for(k.unshift(0),e=1;e1.0001)return null;v+=g[c]}return Math.abs(v-1)>.001?null:[f,o(t,g),g]}var l=t("barycentric"),u=t("polytope-closest-point/lib/closest_point_2d.js");e.exports=s},{barycentric:17,"polytope-closest-point/lib/closest_point_2d.js":216}],131:[function(t,e,r){var n="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}";r.meshShader={vertex:"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}",fragment:"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}",attributes:[{name:"position",type:"vec3"},{name:"normal",type:"vec3"},{name:"color",type:"vec4"},{name:"uv",type:"vec2"}]},r.wireShader={vertex:"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}",fragment:"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}",attributes:[{name:"position",type:"vec3"},{name:"color",type:"vec4"},{name:"uv",type:"vec2"}]},r.pointShader={vertex:"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}",fragment:"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}",attributes:[{name:"position",type:"vec3"},{name:"color",type:"vec4"},{name:"uv",type:"vec2"},{name:"pointSize",type:"float"}]},r.pickShader={vertex:"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}",fragment:n,attributes:[{name:"position",type:"vec3"},{name:"id",type:"vec4"}]},r.pointPickShader={vertex:"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}",fragment:n,attributes:[{name:"position",type:"vec3"},{name:"pointSize",type:"float"},{name:"id",type:"vec4"}]},r.contourShader={vertex:"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}",fragment:"precision mediump float;\n#define GLSLIFY 1\n\nuniform vec3 contourColor;\n\nvoid main() {\n gl_FragColor = vec4(contourColor,1);\n}\n",attributes:[{name:"position",type:"vec3"}]}},{}],132:[function(t,e,r){"use strict";function n(t,e,r,n,i,a,o,s,l,u,c,f,h,d,p,g,v,m,y,b,x,_,w,M,A,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=a,this.pointPickShader=o,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=M,this.pointIds=x,this.pointVAO=A,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=O,this._view=O,this._projection=O,this._resolution=[1,1]}function i(t){for(var e=w({colormap:t,nshades:256,format:"rgba"}),r=new Uint8Array(1024),n=0;n<256;++n){for(var i=e[n],a=0;a<3;++a)r[4*n+a]=i[a];r[4*n+3]=255*i[3]}return _(r,[256,256,4],[4,0,1])}function a(t,e,r){for(var n=new Array(e),i=0;i=1},N.isTransparent=function(){return this.opacity<1},N.pickSlots=1,N.setPickBase=function(t){this.pickId=t},N.highlight=function(t){if(!t||!this.contourEnable)return void(this.contourCount=0);for(var e=M(this.cells,this.intensity,t.intensity),r=e.cells,n=e.vertexIds,i=e.vertexWeights,a=r.length,o=A.mallocFloat32(6*a),s=0,l=0;l0){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()}},N.drawPick=function(t){t=t||{};for(var e=this.gl,r=t.model||O,n=t.view||O,i=t.projection||O,a=[[-1e6,-1e6,-1e6],[1e6,1e6,1e6]],o=0;o<3;++o)a[0][o]=Math.max(a[0][o],this.clipBounds[0][o]),a[1][o]=Math.min(a[1][o],this.clipBounds[1][o]);this._model=[].slice.call(r),this._view=[].slice.call(n),this._projection=[].slice.call(i),this._resolution=[e.drawingBufferWidth,e.drawingBufferHeight];var s={model:r,view:n,projection:i,clipBounds:a,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()}},N.pick=function(t){if(!t)return null;if(t.id!==this.pickId)return null;for(var e=t.value[0]+256*t.value[1]+65536*t.value[2],r=this.cells[e],n=this.positions,i=new Array(r.length),a=0;a0){var r=Math.round(Math.pow(10,e));return Math.ceil(t/r)*r}return Math.ceil(t)}function o(t){return"boolean"!=typeof t||t}function s(t){function e(){if(!w&&G.autoResize){var t=M.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!==M.width||i!==M.height){M.width=n,M.height=i;var a=M.style;a.position=a.position||"absolute",a.left="0px",a.top="0px",a.width=e+"px",a.height=r+"px",F=!0}}}function r(){for(var t=I.length,e=j.length,r=0;r0&&0===D[e-1];)D.pop(),j.pop().dispose()}function s(){if(G.contextLost)return!0;k.isContextLost()&&(G.contextLost=!0,G.mouseListener.enabled=!1,G.selection.object=null,G.oncontextloss&&G.oncontextloss())}function b(){if(!s()){k.colorMask(!0,!0,!0,!0),k.depthMask(!0),k.disable(k.BLEND),k.enable(k.DEPTH_TEST);for(var t=I.length,e=j.length,r=0;rE.distance)continue;for(var u=0;u1e-6?(i=Math.acos(a),o=Math.sin(i), -s=Math.sin((1-n)*i)/o,l=Math.sin(n*i)/o):(s=1-n,l=n),t[0]=s*u+l*d,t[1]=s*c+l*p,t[2]=s*f+l*g,t[3]=s*h+l*v,t}e.exports=n},{}],136:[function(t,e,r){"use strict";function n(t,e){var r=a[e];if(r||(r=a[e]={}),t in r)return r[t];for(var n=i(t,{textAlign:"center",textBaseline:"middle",lineHeight:1,font:e}),o=i(t,{triangles:!0,textAlign:"center",textBaseline:"middle",lineHeight:1,font:e}),s=[[1/0,1/0],[-1/0,-1/0]],l=0;lMath.abs(z[1])){var D=I;I=z,z=D,D=O,O=N,N=D;var j=P;P=R,R=j}I[0]<0&&(O[P]=-1),z[1]>0&&(N[R]=-1);for(var F=0,B=0,S=0;S<4;++S)F+=Math.pow(p[4*P+S],2),B+=Math.pow(p[4*R+S],2);O[P]/=Math.sqrt(F),N[R]/=Math.sqrt(B),d.axes[0]=O,d.axes[1]=N,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,a){var o=r.gl;if(r.vao.bind(),i===r.opacity<1||a){t.bind();var s=t.uniforms;s.model=n.model||x,s.view=n.view||x,s.projection=n.projection||x,w[0]=2/o.drawingBufferWidth,w[1]=2/o.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(o.TRIANGLES,r.vertexCount),r.lineWidth>0&&(o.lineWidth(r.lineWidth),r.vao.draw(o.LINES,r.lineVertexCount,r.vertexCount))}f(e,r,n,i,a),r.vao.unbind()}function d(t){var e=t.gl,r=y.createPerspective(e),n=y.createOrtho(e),i=y.createProject(e),a=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 o(e,r,n,i,u,c,f,h,d,a,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 _=o.prototype;_.pickSlots=1,_.setPickBase=function(t){this.pickId=t},_.isTransparent=function(){if(this.opacity<1)return!0;for(var t=0;t<3;++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;t<3;++t)if(this.axesProject[t]&&this.projectOpacity[t]>=1)return!0;return!1};var w=[0,0],M=[0,0,0],A=[0,0,0],k=[0,0,0,1],T=[0,0,0,1],E=x.slice(),L=[0,0,0],C=[[0,0,0],[0,0,0]],S=[-1e8,-1e8,-1e8],P=[1e8,1e8,1e8],R=[S,P];_.draw=function(t){h(this.useOrtho?this.orthoShader:this.shader,this.projectShader,this,t,!1,!1)},_.drawTransparent=function(t){h(this.useOrtho?this.orthoShader:this.shader,this.projectShader,this,t,!0,!1)},_.drawPick=function(t){h(this.useOrtho?this.pickOrthoShader:this.pickPerspectiveShader,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||e<0)return null;var r=this.points[e],n=this._selectResult;n.index=e;for(var i=0;i<3;++i)n.position[i]=n.dataCoordinate[i]=r[i];return n},_.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",a=t.alignment||[0,0],o=[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;y0&&(P[0]=-a[0]*(1+k[0][0]));for(var H=M.cells,q=M.positions,_=0;_this.buffer.length){s.free(this.buffer);for(var n=this.buffer=s.mallocUint8(u(r*e*4)),i=0;i=0){for(var A=0|M.type.charAt(M.type.length-1),k=new Array(A),T=0;T=0;)E+=1;_[w]=E}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":141,"./lib/create-attributes":142,"./lib/create-uniforms":143,"./lib/reflect":144,"./lib/runtime-reflect":145,"./lib/shader-cache":146}],141:[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},{}],142:[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;c=0){var p=h.charCodeAt(h.length-1)-48;if(p<2||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(p<2||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":141}],143:[function(t,e,r){"use strict";function n(t){return new Function("y","return function(){return y}")(t)}function i(t,e){for(var r=new Array(t),n=0;n4)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(i<2||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;parseInt(n)+""===n?a+="["+n+"]":a+="."+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;o4)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(r<2||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;u1)for(var l=0;lt.length||n<0||a>this.length)throw new RangeError("out of range index");if(n>=a&&e>=r)return 0;if(n>=a)return-1;if(e>=r)return 1;if(e>>>=0,r>>>=0,n>>>=0,a>>>=0,this===t)return 0;for(var o=a-n,s=r-e,l=Math.min(o,s),u=this.slice(n,a),c=t.slice(e,r),f=0;f>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-e;if((void 0===r||r>i)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var a=!1;;)switch(n){case"hex":return x(this,t,e,r);case"utf8":case"utf-8":return _(this,t,e,r);case"ascii":return w(this,t,e,r);case"latin1":case"binary":return M(this,t,e,r);case"base64":return A(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return k(this,t,e,r);default:if(a)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),a=!0}},i.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Q=4096;i.prototype.slice=function(t,e){var r=this.length;t=~~t,e=void 0===e?r:~~e,t<0?(t+=r)<0&&(t=0):t>r&&(t=r),e<0?(e+=r)<0&&(e=0):e>r&&(e=r),e>>=0,e>>>=0,r||O(t,e,this.length);for(var n=this[t],i=1,a=0;++a>>=0,e>>>=0,r||O(t,e,this.length);for(var n=this[t+--e],i=1;e>0&&(i*=256);)n+=this[t+--e]*i;return n},i.prototype.readUInt8=function(t,e){return t>>>=0,e||O(t,1,this.length),this[t]},i.prototype.readUInt16LE=function(t,e){return t>>>=0,e||O(t,2,this.length),this[t]|this[t+1]<<8},i.prototype.readUInt16BE=function(t,e){return t>>>=0,e||O(t,2,this.length),this[t]<<8|this[t+1]},i.prototype.readUInt32LE=function(t,e){return t>>>=0,e||O(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},i.prototype.readUInt32BE=function(t,e){return t>>>=0,e||O(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},i.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||O(t,e,this.length);for(var n=this[t],i=1,a=0;++a=i&&(n-=Math.pow(2,8*e)),n},i.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||O(t,e,this.length);for(var n=e,i=1,a=this[t+--n];n>0&&(i*=256);)a+=this[t+--n]*i;return i*=128,a>=i&&(a-=Math.pow(2,8*e)),a},i.prototype.readInt8=function(t,e){return t>>>=0,e||O(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},i.prototype.readInt16LE=function(t,e){t>>>=0,e||O(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},i.prototype.readInt16BE=function(t,e){t>>>=0,e||O(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},i.prototype.readInt32LE=function(t,e){return t>>>=0,e||O(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},i.prototype.readInt32BE=function(t,e){return t>>>=0,e||O(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},i.prototype.readFloatLE=function(t,e){return t>>>=0,e||O(t,4,this.length),Y.read(this,t,!0,23,4)},i.prototype.readFloatBE=function(t,e){return t>>>=0,e||O(t,4,this.length),Y.read(this,t,!1,23,4)},i.prototype.readDoubleLE=function(t,e){return t>>>=0,e||O(t,8,this.length),Y.read(this,t,!0,52,8)},i.prototype.readDoubleBE=function(t,e){return t>>>=0,e||O(t,8,this.length),Y.read(this,t,!1,52,8)},i.prototype.writeUIntLE=function(t,e,r,n){if(t=+t,e>>>=0,r>>>=0,!n){N(this,t,e,r,Math.pow(2,8*r)-1,0)}var i=1,a=0;for(this[e]=255&t;++a>>=0,r>>>=0,!n){N(this,t,e,r,Math.pow(2,8*r)-1,0)}var i=r-1,a=1;for(this[e+i]=255&t;--i>=0&&(a*=256);)this[e+i]=t/a&255;return e+r},i.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,1,255,0),this[e]=255&t,e+1},i.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},i.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},i.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},i.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},i.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var i=Math.pow(2,8*r-1);N(this,t,e,r,i-1,-i)}var a=0,o=1,s=0;for(this[e]=255&t;++a>0)-s&255;return e+r},i.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var i=Math.pow(2,8*r-1);N(this,t,e,r,i-1,-i)}var a=r-1,o=1,s=0;for(this[e+a]=255&t;--a>=0&&(o*=256);)t<0&&0===s&&0!==this[e+a+1]&&(s=1),this[e+a]=(t/o>>0)-s&255;return e+r},i.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},i.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},i.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},i.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},i.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},i.prototype.writeFloatLE=function(t,e,r){return z(this,t,e,!0,r)},i.prototype.writeFloatBE=function(t,e,r){return z(this,t,e,!1,r)},i.prototype.writeDoubleLE=function(t,e,r){return D(this,t,e,!0,r)},i.prototype.writeDoubleBE=function(t,e,r){return D(this,t,e,!1,r)},i.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&&n=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e=0;--i)t[i+e]=this[i+r];else if(a<1e3)for(i=0;i>>=0,r=void 0===r?this.length:r>>>0,t||(t=0);var o;if("number"==typeof t)for(o=e;o0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===t[e-2]?2:"="===t[e-1]?1:0}function i(t){return 3*t.length/4-n(t)}function a(t){var e,r,i,a,o,s,l=t.length;o=n(t),s=new f(3*l/4-o),i=o>0?l-4:l;var u=0;for(e=0,r=0;e>16&255,s[u++]=a>>8&255,s[u++]=255&a;return 2===o?(a=c[t.charCodeAt(e)]<<2|c[t.charCodeAt(e+1)]>>4,s[u++]=255&a):1===o&&(a=c[t.charCodeAt(e)]<<10|c[t.charCodeAt(e+1)]<<4|c[t.charCodeAt(e+2)]>>2,s[u++]=a>>8&255,s[u++]=255&a),s}function o(t){return u[t>>18&63]+u[t>>12&63]+u[t>>6&63]+u[63&t]}function s(t,e,r){for(var n,i=[],a=e;al?l:o+16383));return 1===n?(e=t[r-1],i+=u[e>>2],i+=u[e<<4&63],i+="=="):2===n&&(e=(t[r-2]<<8)+t[r-1],i+=u[e>>10],i+=u[e>>4&63],i+=u[e<<2&63],i+="="),a.push(i),a.join("")}r.byteLength=i,r.toByteArray=a,r.fromByteArray=l;for(var u=[],c=[],f="undefined"!=typeof Uint8Array?Uint8Array:Array,h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",d=0,p=h.length;d0;){for(var c=r.pop(),s=r.pop(),f=-1,h=-1,l=o[s],p=1;p=0||(e.flip(s,c),n(t,e,r,f,s,h),n(t,e,r,s,h,f),n(t,e,r,h,c,f),n(t,e,r,c,f,h)))}}var a=t("robust-in-sphere")[4];t("binary-search-bounds");e.exports=i},{"binary-search-bounds":52,"robust-in-sphere":229}],49:[function(t,e,r){"use strict";function n(t,e,r,n,i,a,o){this.cells=t,this.neighbor=e,this.flags=n,this.constraint=r,this.active=i,this.next=a,this.boundary=o}function i(t,e){return t[0]-e[0]||t[1]-e[1]||t[2]-e[2]}function a(t,e){for(var r=t.cells(),a=r.length,o=0;o0||l.length>0;){for(;s.length>0;){var d=s.pop();if(u[d]!==-i){u[d]=i;for(var p=(c[d],0);p<3;++p){var g=h[3*d+p];g>=0&&0===u[g]&&(f[3*d+p]?l.push(g):(s.push(g),u[g]=i))}}}var v=l;l=s,s=v,l.length=0,i=-i}var m=o(c,u,e);return r?m.concat(n.boundary):m}var l=t("binary-search-bounds");e.exports=s,n.prototype.locate=function(){var t=[0,0,0];return function(e,r,n){var a=e,o=r,s=n;return r1&&d(r[c[f-2]],r[c[f-1]],n)>0;)t.push([c[f-1],c[f-2],i]),f-=1;c.length=f,c.push(i);for(var p=u.upperIds,f=p.length;f>1&&d(r[p[f-2]],r[p[f-1]],n)<0;)t.push([p[f-2],p[f-1],i]),f-=1;p.length=f,p.push(i)}}function l(t,e){var r;return(r=t.a[0]m[0]&&l.push(new i(m,d,v,f),new i(d,m,g,f))}l.sort(a);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=[],f=0,_=l.length;f<_;++f){var w=l[f],M=w.type;M===p?s(x,b,t,w.a,w.idx):M===v?u(b,t,w):c(b,t,w)}return x}var h=t("binary-search-bounds"),d=t("robust-orientation")[3],p=0,g=1,v=2;e.exports=f},{"binary-search-bounds":52,"robust-orientation":231}],51:[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;n=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;n>>1,x=a[m]"];return i?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("}"),i?a.push("return -1};"):a.push("return i};"),a.join("")}function i(t,e,r,i){return 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(""))()}e.exports={ge:i(">=",!1,"GE"),gt:i(">",!1,"GT"),lt:i("<",!0,"LT"),le:i("<=",!0,"LE"),eq:i("-",!0,"EQ",!0)}},{}],53:[function(t,e,r){"use strict";function n(t){for(var e=1,r=1;rr?r:t:te?e:t}e.exports=n},{}],57:[function(t,e,r){"use strict";function n(t){var e=_(t);return[M(e,-1/0),M(e,1/0)]}function i(t,e){for(var r=new Array(e.length),n=0;n=0;--a){var p=n[a];o=p[0];var g=e[o],v=g[0],m=g[1],y=t[v],M=t[m];if((y[0]-M[0]||y[1]-M[1])<0){var k=v;v=m,m=k}g[0]=v;var T,E=g[1]=p[1];for(i&&(T=g[2]);a>0&&n[a-1][0]===o;){var p=n[--a],L=p[1];i?e.push([E,L,T]):e.push([E,L]),E=L}i?e.push([E,m,T]):e.push([E,m])}return s}function u(t,e,r){for(var i=e.length,a=new v(i),o=[],s=0;se[2]?1:0)}function h(t,e,r){if(0!==t.length){if(e)for(var n=0;n0||d.length>0)}function g(t,e,r){var n;if(r){n=e;for(var i=new Array(e.length),a=0;a10&&/[0-9](?:\s|\/)/.test(t)&&(s=t.match(/([0-9]+)/g).map(function(t){return parseFloat(t)}),n=t.match(/([a-z])/gi).join("").toLowerCase());else"number"==typeof t?(n="rgb",s=[t>>>16,(65280&t)>>>8,255&t]):a(t)?(null!=t.r?(s=[t.r,t.g,t.b],n="rgb"):null!=t.red?(s=[t.red,t.green,t.blue],n="rgb"):null!=t.h?(s=[t.h,t.s,t.l],n="hsl"):null!=t.hue&&(s=[t.hue,t.saturation,t.lightness],n="hsl"),null!=t.a?l=t.a:null!=t.alpha?l=t.alpha:null!=t.opacity&&(l=t.opacity/100)):(Array.isArray(t)||r.ArrayBuffer&&ArrayBuffer.isView&&ArrayBuffer.isView(t))&&(s=[t[0],t[1],t[2]],n="rgb",l=4===t.length?t[3]:1);return{space:n,values:s,alpha:l}}e.exports=n;var i=t("color-name"),a=t("is-plain-obj"),o={red:0,orange:60,yellow:120,green:180,blue:240,purple:300}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"color-name":60,"is-plain-obj":180}],62:[function(t,e,r){"use strict";var n=t("color-parse"),i=t("color-space/hsl"),a=t("clamp");e.exports=function(t,e){if(Array.isArray(t))return t;null==e&&(e=!0);var r=n(t);if(!r.space)return[];var o,s=r.values,l=s.length;for(o=0;o1&&n--,a=6*n<1?e+6*(r-e)*n:2*n<1?r:3*n<2?e+(r-e)*(2/3-n)*6:e,i[u]=255*a;return i}},n.hsl=function(t){var e,r,n,i=t[0]/255,a=t[1]/255,o=t[2]/255,s=Math.min(i,a,o),l=Math.max(i,a,o),u=l-s;return l===s?e=0:i===l?e=(a-o)/u:a===l?e=2+(o-i)/u:o===l&&(e=4+(i-a)/u),e=Math.min(60*e,360),e<0&&(e+=360),n=(s+l)/2,r=l===s?0:n<=.5?u/(l+s):u/(2-l-s),[e,100*r,100*n]}},{"./rgb":64}],64:[function(t,e,r){"use strict";e.exports={name:"rgb",min:[0,0,0],max:[255,255,255],channel:["red","green","blue"],alias:["RGB"]}},{}],65:[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]}],viridis:[{index:0,rgb:[68,1,84]},{index:.13,rgb:[71,44,122]},{index:.25,rgb:[59,81,139]},{index:.38,rgb:[44,113,142]},{index:.5,rgb:[33,144,141]},{index:.63,rgb:[39,173,129]},{index:.75,rgb:[92,200,99]},{index:.88,rgb:[170,220,50]},{index:1,rgb:[253,231,37]}],inferno:[{index:0,rgb:[0,0,4]},{index:.13,rgb:[31,12,72]},{index:.25,rgb:[85,15,109]},{index:.38,rgb:[136,34,106]},{index:.5,rgb:[186,54,85]},{index:.63,rgb:[227,89,51]},{index:.75,rgb:[249,140,10]},{index:.88,rgb:[249,201,50]},{index:1,rgb:[252,255,164]}],magma:[{index:0,rgb:[0,0,4]},{index:.13,rgb:[28,16,68]},{index:.25,rgb:[79,18,123]},{index:.38,rgb:[129,37,129]},{index:.5,rgb:[181,54,122]},{index:.63,rgb:[229,80,100]},{index:.75,rgb:[251,135,97]},{index:.88,rgb:[254,194,135]},{index:1,rgb:[252,253,191]}],plasma:[{index:0,rgb:[13,8,135]},{index:.13,rgb:[75,3,161]},{index:.25,rgb:[125,3,168]},{index:.38,rgb:[168,34,150]},{index:.5,rgb:[203,70,121]},{index:.63,rgb:[229,107,93]},{index:.75,rgb:[248,148,65]},{index:.88,rgb:[253,195,40]},{index:1,rgb:[240,249,33]}],warm:[{index:0,rgb:[125,0,179]},{index:.13,rgb:[172,0,187]},{index:.25,rgb:[219,0,170]},{index:.38,rgb:[255,0,130]},{index:.5,rgb:[255,63,74]},{index:.63,rgb:[255,123,0]},{index:.75,rgb:[234,176,0]},{index:.88,rgb:[190,228,0]},{index:1,rgb:[147,255,0]}],cool:[{index:0,rgb:[125,0,179]},{index:.13,rgb:[116,0,218]},{index:.25,rgb:[98,74,237]},{index:.38,rgb:[68,146,231]},{index:.5,rgb:[0,204,197]},{index:.63,rgb:[0,247,146]},{index:.75,rgb:[0,255,88]},{index:.88,rgb:[40,255,8]},{index:1,rgb:[147,255,0]}],"rainbow-soft":[{index:0,rgb:[125,0,179]},{index:.1,rgb:[199,0,180]},{index:.2,rgb:[255,0,121]},{index:.3,rgb:[255,108,0]},{index:.4,rgb:[222,194,0]},{index:.5,rgb:[150,255,0]},{index:.6,rgb:[0,255,55]},{index:.7,rgb:[0,246,150]},{index:.8,rgb:[50,167,222]},{index:.9,rgb:[103,51,235]},{index:1,rgb:[124,0,186]}],bathymetry:[{index:0,rgb:[40,26,44]},{index:.13,rgb:[59,49,90]},{index:.25,rgb:[64,76,139]},{index:.38,rgb:[63,110,151]},{index:.5,rgb:[72,142,158]},{index:.63,rgb:[85,174,163]},{index:.75,rgb:[120,206,163]},{index:.88,rgb:[187,230,172]},{index:1,rgb:[253,254,204]}],cdom:[{index:0,rgb:[47,15,62]},{index:.13,rgb:[87,23,86]},{index:.25,rgb:[130,28,99]},{index:.38,rgb:[171,41,96]},{index:.5,rgb:[206,67,86]},{index:.63,rgb:[230,106,84]},{index:.75,rgb:[242,149,103]},{index:.88,rgb:[249,193,135]},{index:1,rgb:[254,237,176]}],chlorophyll:[{index:0,rgb:[18,36,20]},{index:.13,rgb:[25,63,41]},{index:.25,rgb:[24,91,59]},{index:.38,rgb:[13,119,72]},{index:.5,rgb:[18,148,80]},{index:.63,rgb:[80,173,89]},{index:.75,rgb:[132,196,122]},{index:.88,rgb:[175,221,162]},{index:1,rgb:[215,249,208]}],density:[{index:0,rgb:[54,14,36]},{index:.13,rgb:[89,23,80]},{index:.25,rgb:[110,45,132]},{index:.38,rgb:[120,77,178]},{index:.5,rgb:[120,113,213]},{index:.63,rgb:[115,151,228]},{index:.75,rgb:[134,185,227]},{index:.88,rgb:[177,214,227]},{index:1,rgb:[230,241,241]}],"freesurface-blue":[{index:0,rgb:[30,4,110]},{index:.13,rgb:[47,14,176]},{index:.25,rgb:[41,45,236]},{index:.38,rgb:[25,99,212]},{index:.5,rgb:[68,131,200]},{index:.63,rgb:[114,156,197]},{index:.75,rgb:[157,181,203]},{index:.88,rgb:[200,208,216]},{index:1,rgb:[241,237,236]}],"freesurface-red":[{index:0,rgb:[60,9,18]},{index:.13,rgb:[100,17,27]},{index:.25,rgb:[142,20,29]},{index:.38,rgb:[177,43,27]},{index:.5,rgb:[192,87,63]},{index:.63,rgb:[205,125,105]},{index:.75,rgb:[216,162,148]},{index:.88,rgb:[227,199,193]},{index:1,rgb:[241,237,236]}],oxygen:[{index:0,rgb:[64,5,5]},{index:.13,rgb:[106,6,15]},{index:.25,rgb:[144,26,7]},{index:.38,rgb:[168,64,3]},{index:.5,rgb:[188,100,4]},{index:.63,rgb:[206,136,11]},{index:.75,rgb:[220,174,25]},{index:.88,rgb:[231,215,44]},{index:1,rgb:[248,254,105]}],par:[{index:0,rgb:[51,20,24]},{index:.13,rgb:[90,32,35]},{index:.25,rgb:[129,44,34]},{index:.38,rgb:[159,68,25]},{index:.5,rgb:[182,99,19]},{index:.63,rgb:[199,134,22]},{index:.75,rgb:[212,171,35]},{index:.88,rgb:[221,210,54]},{index:1,rgb:[225,253,75]}],phase:[{index:0,rgb:[145,105,18]},{index:.13,rgb:[184,71,38]},{index:.25,rgb:[186,58,115]},{index:.38,rgb:[160,71,185]},{index:.5,rgb:[110,97,218]},{index:.63,rgb:[50,123,164]},{index:.75,rgb:[31,131,110]},{index:.88,rgb:[77,129,34]},{index:1,rgb:[145,105,18]}],salinity:[{index:0,rgb:[42,24,108]},{index:.13,rgb:[33,50,162]},{index:.25,rgb:[15,90,145]},{index:.38,rgb:[40,118,137]},{index:.5,rgb:[59,146,135]},{index:.63,rgb:[79,175,126]},{index:.75,rgb:[120,203,104]},{index:.88,rgb:[193,221,100]},{index:1,rgb:[253,239,154]}],temperature:[{index:0,rgb:[4,35,51]},{index:.13,rgb:[23,51,122]},{index:.25,rgb:[85,59,157]},{index:.38,rgb:[129,79,143]},{index:.5,rgb:[175,95,130]},{index:.63,rgb:[222,112,101]},{index:.75,rgb:[249,146,66]},{index:.88,rgb:[249,196,65]},{index:1,rgb:[232,250,91]}],turbidity:[{index:0,rgb:[34,31,27]},{index:.13,rgb:[65,50,41]},{index:.25,rgb:[98,69,52]},{index:.38,rgb:[131,89,57]},{index:.5,rgb:[161,112,59]},{index:.63,rgb:[185,140,66]},{index:.75,rgb:[202,174,88]},{index:.88,rgb:[216,209,126]},{index:1,rgb:[233,246,171]}],"velocity-blue":[{index:0,rgb:[17,32,64]},{index:.13,rgb:[35,52,116]},{index:.25,rgb:[29,81,156]},{index:.38,rgb:[31,113,162]},{index:.5,rgb:[50,144,169]},{index:.63,rgb:[87,173,176]},{index:.75,rgb:[149,196,189]},{index:.88,rgb:[203,221,211]},{index:1,rgb:[254,251,230]}],"velocity-green":[{index:0,rgb:[23,35,19]},{index:.13,rgb:[24,64,38]},{index:.25,rgb:[11,95,45]},{index:.38,rgb:[39,123,35]},{index:.5,rgb:[95,146,12]},{index:.63,rgb:[152,165,18]},{index:.75,rgb:[201,186,69]},{index:.88,rgb:[233,216,137]},{index:1,rgb:[255,253,205]}],cubehelix:[{index:0,rgb:[0,0,0]},{index:.07,rgb:[22,5,59]},{index:.13,rgb:[60,4,105]},{index:.2,rgb:[109,1,135]},{index:.27,rgb:[161,0,147]},{index:.33,rgb:[210,2,142]},{index:.4,rgb:[251,11,123]},{index:.47,rgb:[255,29,97]},{index:.53,rgb:[255,54,69]},{index:.6,rgb:[255,85,46]},{index:.67,rgb:[255,120,34]},{index:.73,rgb:[255,157,37]},{index:.8,rgb:[241,191,57]},{index:.87,rgb:[224,220,93]},{index:.93,rgb:[218,241,142]},{index:1,rgb:[227,253,198]}]}},{}],66:[function(t,e,r){"use strict";function n(t){var e,r,n,u,c,f,h,d,p,g,v,m,y,b=[],x=[],_=[],w=[];if(o.isPlainObject(t)||(t={}),p=t.nshades||72,d=t.format||"hex",h=t.colormap,h||(h="jet"),"string"==typeof h){if(h=h.toLowerCase(),!l[h])throw Error(h+" not a supported colorscale");f=s(l[h])}else{if(!Array.isArray(h))throw Error("unsupported colormap option",h);f=s(h)}if(f.length>p)throw new Error(h+" map requires nshades to be at least size "+f.length);for(v=Array.isArray(t.alpha)?2!==t.alpha.length?[1,1]:s(t.alpha):"number"==typeof t.alpha?[t.alpha,t.alpha]:[1,1],e=f.map(function(t){return Math.round(t.index*p)}),v[0]<0&&(v[0]=0),v[1]<0&&(v[0]=0),v[0]>1&&(v[0]=1),v[1]>1&&(v[0]=1),y=0;y=0&&r[3]<=1||(r[3]=v[0]+(v[1]-v[0])*m);for(y=0;y=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);return c===n(t,e,i)?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 f=a(t,e,r);return f>0?s>0&&a(t,e,i)>0?1:-1:f<0?s>0||a(t,e,i)>0?1:-1:a(t,e,i)>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":231,"robust-product":232,"robust-sum":236,signum:237,"two-sum":257}],68:[function(t,e,r){function n(t,e){return t-e}function i(t,e){var r=t.length,i=t.length-e.length;if(i)return i;switch(r){case 0:return 0;case 1:return t[0]-e[0];case 2:return t[0]+t[1]-e[0]-e[1]||a(t[0],t[1])-a(e[0],e[1]);case 3:var o=t[0]+t[1],s=e[0]+e[1];if(i=o+t[2]-(s+e[2]))return i;var l=a(t[0],t[1]),u=a(e[0],e[1]);return a(l,t[2])-a(u,e[2])||a(l+t[2],o)-a(u+e[2],s);case 4:var c=t[0],f=t[1],h=t[2],d=t[3],p=e[0],g=e[1],v=e[2],m=e[3];return c+f+h+d-(p+g+v+m)||a(c,f,h,d)-a(p,g,v,m,p)||a(c+f,c+h,c+d,f+h,f+d,h+d)-a(p+g,p+v,p+m,g+v,g+m,v+m)||a(c+f+h,c+f+d,c+h+d,f+h+d)-a(p+g+v,p+g+m,p+v+m,g+v+m);default:for(var y=t.slice().sort(n),b=e.slice().sort(n),x=0;xt[r][0]&&(r=n);return er?[[r],[e]]:[[e]]}e.exports=n},{}],72:[function(t,e,r){"use strict";function n(t){var e=i(t),r=e.length;if(r<=2)return[];for(var n=new Array(r),a=e[r-1],o=0;o=e[l]&&(s+=1);a[o]=s}}return t}function a(t,e){try{return o(t,!0)}catch(u){var r=s(t);if(r.length<=e)return[];var a=n(t,r),l=o(a,!0);return i(l,r)}}e.exports=a;var o=t("incremental-convex-hull"),s=t("affine-hull")},{"affine-hull":12,"incremental-convex-hull":173}],74:[function(t,e,r){"use strict";function n(t,e,r,n,i,a){var o=6*i*i-6*i,s=3*i*i-4*i+1,l=-6*i*i+6*i,u=3*i*i-2*i;if(t.length){a||(a=new Array(t.length));for(var c=t.length-1;c>=0;--c)a[c]=o*t[c]+s*e[c]+l*r[c]+u*n[c];return a}return o*t+s*e+l*r[c]+u*n}function i(t,e,r,n,i,a){var o=i-1,s=i*i,l=o*o,u=(1+2*i)*l,c=i*l,f=s*(3-2*i),h=s*o;if(t.length){a||(a=new Array(t.length));for(var d=t.length-1;d>=0;--d)a[d]=u*t[d]+c*e[d]+f*r[d]+h*n[d];return a}return u*t+c*e+f*r+h*n}e.exports=i,e.exports.derivative=n},{}],75:[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"===o)e.scalarArgs.push(i),e.shimArgs.push("scalar"+i);else if("index"===o){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"===o){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,a(e)}var a=t("./lib/thunk.js");e.exports=i},{"./lib/thunk.js":77}],76:[function(t,e,r){"use strict";function n(t,e,r){var n,i,a=t.length,o=e.arrayArgs.length,s=e.indexArgs.length>0,l=[],u=[],c=0,f=0;for(n=0;n0&&l.push("var "+u.join(",")),n=a-1;n>=0;--n)c=t[n],l.push(["for(i",n,"=0;i",n,"0&&l.push(["index[",f,"]-=s",f].join("")),l.push(["++index[",c,"]"].join(""))),l.push("}")}return l.join("\n")}function i(t,e,r,i){for(var a=e.length,o=r.arrayArgs.length,s=r.blockSize,l=r.indexArgs.length>0,u=[],c=0;c0;){"].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;c0&&(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),f=0;f0&&_.push("shape=SS.slice(0)"),t.indexArgs.length>0){for(var w=new Array(r),f=0;f0&&x.push("var "+_.join(","));for(var f=0;f3&&x.push(o(t.pre,t,c));var T=o(t.body,t,c),E=a(v);E3&&x.push(o(t.post,t,c)),t.debug&&console.log("-----Generated cwise routine for ",e,":\n"+x.join("\n")+"\n----------");var L=[t.funcName||"unnamed","_cwise_loop_",l[0].join("s"),"m",E,s(c)].join("");return new Function(["function ",L,"(",b.join(","),"){",x.join("\n"),"} return ",L].join(""))()}var u=t("uniq");e.exports=l},{uniq:260}],77:[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 a=[],o=[],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"+f+".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"+f+".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--\x3e0;) {"),e.push("if (!("+u.join(" && ")+")) throw new Error('cwise: Arrays do not all have the same shape!')"),e.push("}"));for(var c=0;ce?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,r,n,i){for(arguments.length<3&&(n=0),arguments.length<4&&(i=e.length);n>>1;t(e[a],r)<0?n=a+1:i=a}return n},right:function(e,r,n,i){for(arguments.length<3&&(n=0),arguments.length<4&&(i=e.length);n>>1;t(e[a],r)>0?i=a:n=a+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 f(){this._=Object.create(null)}function h(t){return(t+="")===_o||t[0]===wo?wo+t:t}function d(t){return(t+="")[0]===wo?t.slice(1):t}function p(t){return h(t)in this._}function g(t){return(t=h(t))in this._&&delete this._[t]}function v(){var t=[];for(var e in this._)t.push(d(e));return t}function m(){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=Mo.length;r=e&&(e=i+1);!(o=s[e])&&++e0&&(t=t.slice(0,s));var u=Oo.get(t);return u&&(t=u,l=Q),s?e?i:n:e?M:a}function Z(t,e){return function(r){var n=uo.event;uo.event=r,e[0]=this.__data__;try{t.apply(this,e)}finally{uo.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 $(t){var r=".dragsuppress-"+ ++Io,i="click"+r,a=uo.select(n(t)).on("touchmove"+r,T).on("dragstart"+r,T).on("selectstart"+r,T);if(null==No&&(No=!("onselectstart"in t)&&w(t.style,"userSelect")),No){var o=e(t).style,s=o[No];o[No]="none"}return function(t){if(a.on(r,null),No&&(o[No]=s),t){var e=function(){a.on(i,null)};a.on(i,function(){T(),e()},!0),setTimeout(e,0)}}}function K(t,e){e.changedTouches&&(e=e.changedTouches[0]);var r=t.ownerSVGElement||t;if(r.createSVGPoint){var i=r.createSVGPoint();if(zo<0){var a=n(t);if(a.scrollX||a.scrollY){r=uo.select("body").append("svg").style({position:"absolute",top:0,left:0,margin:0,padding:0,border:"none"},"important");var o=r[0][0].getScreenCTM();zo=!(o.f||o.e),r.remove()}}return zo?(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 J(){return uo.event.changedTouches[0].identifier}function tt(t){return t>0?1:t<0?-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:t<-1?Fo:Math.acos(t)}function nt(t){return t>1?Vo:t<-1?-Vo: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,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,At,ut):new ut(t,e,r)}function ct(t,e,r){function n(t){return t>360?t-=360:t<0&&(t+=360),t<60?a+(o-a)*t/60:t<180?o:t<240?a+(o-a)*(240-t)/60:a}function i(t){return Math.round(255*n(t))}var a,o;return t=isNaN(t)?0:(t%=360)<0?t+360:t,e=isNaN(e)?0:e<0?0:e>1?1:e,r=r<0?0:r>1?1:r,o=r<=.5?r*(1+e):r+e-r*e,a=2*r-o,new bt(i(t+120),i(t),i(t-120))}function ft(t,e,r){return this instanceof ft?(this.h=+t,this.c=+e,void(this.l=+r)):arguments.length<2?t instanceof ft?new ft(t.h,t.c,t.l):t instanceof dt?gt(t.l,t.a,t.b):gt((t=kt((t=uo.rgb(t)).r,t.g,t.b)).l,t.a,t.b):new ft(t,e,r)}function ht(t,e,r){return isNaN(t)&&(t=0),isNaN(e)&&(e=0),new dt(r,Math.cos(t*=Ho)*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 ft?ht(t.h,t.c,t.l):kt((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,a=n-r/200;return i=vt(i)*Ko,n=vt(n)*Jo,a=vt(a)*ts,new bt(yt(3.2404542*i-1.5371385*n-.4985314*a),yt(-.969266*i+1.8760108*n+.041556*a),yt(.0556434*i-.2040259*n+1.0572252*a))}function gt(t,e,r){return t>0?new ft(Math.atan2(r,e)*qo,Math.sqrt(e*e+r*r),t):new ft(NaN,NaN,t)}function vt(t){return t>.206893034?t*t*t:(t-4/29)/7.787037}function mt(t){return t>.008856?Math.pow(t,1/3):7.787037*t+4/29}function yt(t){return Math.round(255*(t<=.00304?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 t<16?"0"+Math.max(0,t).toString(16):Math.min(255,t).toString(16)}function Mt(t,e,r){var n,i,a,o=0,s=0,l=0;if(n=/([a-z]+)\((.*)\)/.exec(t=t.toLowerCase()))switch(i=n[2].split(","),n[1]){case"hsl":return r(parseFloat(i[0]),parseFloat(i[1])/100,parseFloat(i[2])/100);case"rgb":return e(Et(i[0]),Et(i[1]),Et(i[2]))}return(a=ns.get(t))?e(a.r,a.g,a.b):(null==t||"#"!==t.charAt(0)||isNaN(a=parseInt(t.slice(1),16))||(4===t.length?(o=(3840&a)>>4,o|=o>>4,s=240&a,s|=s>>4,l=15&a,l|=l<<4):7===t.length&&(o=(16711680&a)>>16,s=(65280&a)>>8,l=255&a)),e(o,s,l))}function At(t,e,r){var n,i,a=Math.min(t/=255,e/=255,r/=255),o=Math.max(t,e,r),s=o-a,l=(o+a)/2;return s?(i=l<.5?s/(o+a):s/(2-o-a),n=t==o?(e-r)/s+(e0&&l<1?0:n),new ut(n,i,l)}function kt(t,e,r){t=Tt(t),e=Tt(e),r=Tt(r);var n=mt((.4124564*t+.3575761*e+.1804375*r)/Ko),i=mt((.2126729*t+.7151522*e+.072175*r)/Jo);return dt(116*i-16,500*(n-i),200*(i-mt((.0193339*t+.119192*e+.9503041*r)/ts)))}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 Lt(t){return"function"==typeof t?t:function(){return t}}function Ct(t){return function(e,r,n){return 2===arguments.length&&"function"==typeof r&&(n=r,r=null),St(e,r,t,n)}}function St(t,e,r,n){function i(){var t,e=l.status;if(!e&&Rt(l)||e>=200&&e<300||304===e){try{t=r.call(a,l)}catch(t){return void o.error.call(a,t)}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 r=t,a},["get","post"].forEach(function(t){a[t]=function(){return a.send.apply(a,[t].concat(fo(arguments)))}}),a.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&&a.on("error",i).on("load",function(t){i(null,t)}),o.beforesend.call(a,l),l.send(null==n?null:n),a},a.abort=function(){return l.abort(),a},uo.rebind(a,o,"on"),null==n?a:a.get(Pt(n))}function Pt(t){return 1===t.length?function(e,r){t(null==e?r:null)}:t}function Rt(t){var e=t.responseType;return e&&"text"!==e?t.response:t.responseText}function Ot(t,e,r){var n=arguments.length;n<2&&(e=0),n<3&&(r=Date.now());var i=r+e,a={c:t,t:i,n:null};return as?as.n=a:is=a,as=a,os||(ss=clearTimeout(ss),os=1,ls(Nt)),a}function Nt(){var t=It(),e=zt()-t;e>24?(isFinite(e)&&(clearTimeout(ss),ss=setTimeout(Nt,e)),os=0):(os=1,ls(Nt))}function It(){for(var t=Date.now(),e=is;e;)t>=e.t&&e.c(t-e.t)&&(e.c=null),e=e.n;return t}function zt(){for(var t,e=is,r=1/0;e;)e.c?(e.t8?function(t){return t/r}:function(t){return t*r},symbol:t}}function Ft(t){var e=t.decimal,r=t.thousands,n=t.grouping,i=t.currency,a=n&&r?function(t,e){for(var i=t.length,a=[],o=0,s=n[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=n[o=(o+1)%n.length];return a.reverse().join(r)}:x;return function(t){var r=cs.exec(t),n=r[1]||" ",o=r[2]||">",s=r[3]||"-",l=r[4]||"",u=r[5],c=+r[6],f=r[7],h=r[8],d=r[9],p=1,g="",v="",m=!1,y=!0;switch(h&&(h=+h.substring(1)),(u||"0"===n&&"="===o)&&(u=n="0",o="="),d){case"n":f=!0,d="g";break;case"%":p=100,v="%",d="f";break;case"p":p=100,v="%",d="r";break;case"b":case"o":case"x":case"X":"#"===l&&(g="0"+d.toLowerCase());case"c":y=!1;case"d":m=!0,h=0;break;case"s":p=-1,d="r"}"$"===l&&(g=i[0],v=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=fs.get(d)||Bt;var b=u&&f;return function(t){var r=v;if(m&&t%1)return"";var i=t<0||0===t&&1/t<0?(t=-t,"-"):"-"===s?"":s;if(p<0){var l=uo.formatPrefix(t,h);t=l.scale(t),r=l.symbol+v}else t*=p;t=d(t,h);var x,_,w=t.lastIndexOf(".");if(w<0){var M=y?t.lastIndexOf("e"):-1;M<0?(x=t,_=""):(x=t.substring(0,M),_=t.substring(M))}else x=t.substring(0,w),_=e+t.substring(w+1);!u&&f&&(x=a(x,1/0));var A=g.length+x.length+_.length+(b?0:i.length),k=A"===o?k+i+t:"^"===o?k.substring(0,A>>=1)+i+t+k.substring(A):i+(b?t:k+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=a(r,1);return e-r1)for(;o=u)return-1;if(37===(i=e.charCodeAt(s++))){if(o=e.charAt(s++),!(a=C[o in gs?e.charAt(s++):o])||(n=a(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 a(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 o(t,e,r){A.lastIndex=0;var n=A.exec(e.slice(r));return n?(t.m=k.get(n[0].toLowerCase()),r+n[0].length):-1}function s(t,e,n){return r(t,L.c.toString(),e,n)}function l(t,e,n){return r(t,L.x.toString(),e,n)}function u(t,e,n){return r(t,L.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 f=t.dateTime,h=t.date,d=t.time,p=t.periods,g=t.days,v=t.shortDays,m=t.months,y=t.shortMonths;e.utc=function(t){function r(t){try{ds=Ut;var e=new ds;return e._=t,n(e)}finally{ds=Date}}var n=e(t);return r.parse=function(t){try{ds=Ut;var e=n.parse(t);return e&&e._}finally{ds=Date}},r.toString=n.toString,r},e.multi=e.utc.multi=ce;var b=uo.map(),x=Xt(g),_=Wt(g),w=Xt(v),M=Wt(v),A=Xt(m),k=Wt(m),T=Xt(y),E=Wt(y);p.forEach(function(t,e){b.set(t.toLowerCase(),e)});var L={a:function(t){return v[t.getDay()]},A:function(t){return g[t.getDay()]},b:function(t){return y[t.getMonth()]},B:function(t){return m[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+hs.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(hs.sundayOfYear(t),e,2)},w:function(t){return t.getDay()},W:function(t,e){return Gt(hs.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"%"}},C={a:n,A:i,b:a,B:o,c:s,d:re,e:re,H:ie,I:ie,j:ne,L:se,m:ee,M:ae,p:c,S:oe,U:Zt,w:Yt,W:Qt,x:l,X:u,y:Kt,Y:$t,Z:Jt,"%":ue};return e}function Gt(t,e,r){var n=t<0?"-":"",i=(n?-t:t)+"",a=i.length;return n+(a68?1900:2e3)}function ee(t,e,r){vs.lastIndex=0;var n=vs.exec(e.slice(r,r+2));return n?(t.m=n[0]-1,r+n[0].length):-1}function re(t,e,r){vs.lastIndex=0;var n=vs.exec(e.slice(r,r+2));return n?(t.d=+n[0],r+n[0].length):-1}function ne(t,e,r){vs.lastIndex=0;var n=vs.exec(e.slice(r,r+3));return n?(t.j=+n[0],r+n[0].length):-1}function ie(t,e,r){vs.lastIndex=0;var n=vs.exec(e.slice(r,r+2));return n?(t.H=+n[0],r+n[0].length):-1}function ae(t,e,r){vs.lastIndex=0;var n=vs.exec(e.slice(r,r+2));return n?(t.M=+n[0],r+n[0].length):-1}function oe(t,e,r){vs.lastIndex=0;var n=vs.exec(e.slice(r,r+2));return n?(t.S=+n[0],r+n[0].length):-1}function se(t,e,r){vs.lastIndex=0;var n=vs.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=xo(e)/60|0,i=xo(e)%60;return r+Gt(n,"0",2)+Gt(i,"0",2)}function ue(t,e,r){ms.lastIndex=0;var n=ms.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=o*r,l=Math.cos(e),u=Math.sin(e),c=a*u,f=i*l+c*Math.cos(s),h=c*o*Math.sin(s);Ms.add(Math.atan2(h,f)),n=t,i=l,a=u}var e,r,n,i,a;As.point=function(o,s){As.point=t,n=(e=o)*Ho,i=Math.cos(s=(r=s)*Ho/2+Fo/4),a=Math.sin(s)},As.lineEnd=function(){t(e,r)}}function me(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 Ae(t,e){return xo(t[0]-e[0])=0;--s)i.point((f=c[s])[0],f[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 Oe(t){if(e=t.length){for(var e,r,n=0,i=t[0];++n0){for(_||(a.polygonStart(),_=!0),a.lineStart();++o1&&2&e&&r.push(r.pop().concat(r.shift())),d.push(r.filter(ze))}var d,p,g,v=e(a),m=i.invert(n[0],n[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(m,p);d.length?(_||(a.polygonStart(),_=!0),Re(d,je,t,r,a)):t&&(_||(a.polygonStart(),_=!0),a.lineStart(),r(null,null,1,a),a.lineEnd()),_&&(a.polygonEnd(),_=!1),d=p=null},sphere:function(){a.polygonStart(),a.lineStart(),r(null,null,1,a),a.lineEnd(),a.polygonEnd()}},b=De(),x=e(b),_=!1;return y}}function ze(t){return t.length>1}function De(){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]-Vo-Do:Vo-t[1])-((e=e.x)[0]<0?e[1]-Vo-Do:Vo-e[1])}function Fe(t){var e,r=NaN,n=NaN,i=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(a,o){var s=a>0?Fo:-Fo,l=xo(a-r);xo(l-Fo)0?Vo:-Vo),t.point(i,n),t.lineEnd(),t.lineStart(),t.point(s,n),t.point(a,n),e=0):i!==s&&l>=Fo&&(xo(r-i)Do?Math.atan((Math.sin(e)*(a=Math.cos(n))*Math.sin(r)-Math.sin(n)*(i=Math.cos(e))*Math.sin(t))/(i*a*o)):(e+n)/2}function Ue(t,e,r,n){var i;if(null==t)i=r*Vo,n.point(-Fo,i),n.point(0,i),n.point(Fo,i),n.point(Fo,0),n.point(Fo,-i),n.point(0,-i),n.point(-Fo,-i),n.point(-Fo,0),n.point(-Fo,i);else if(xo(t[0]-e[0])>Do){var a=t[0]=0?1:-1,M=w*_,A=M>Fo,k=p*b;if(Ms.add(Math.atan2(k*w*Math.sin(M),g*x+k*Math.cos(M))),a+=A?_+w*Bo:_,A^h>=r^m>=r){var T=be(me(f),me(t));we(T);var E=be(i,T);we(E);var L=(A^_>=0?-1:1)*nt(E[2]);(n>L||n===L&&(T[0]||T[1]))&&(o+=A^_>=0?1:-1)}if(!v++)break;h=m,p=b,g=x,f=t}}return(a<-Do||aa}function r(t){var r,a,l,u,c;return{lineStart:function(){u=l=!1,c=1},point:function(f,h){var d,p=[f,h],g=e(f,h),v=o?g?0:i(f,h):g?i(f+(f<0?Fo:-Fo),h):0;if(!r&&(u=l=g)&&t.lineStart(),g!==l&&(d=n(r,p),(Ae(r,d)||Ae(p,d))&&(p[0]+=Do,p[1]+=Do,g=e(p[0],p[1]))),g!==l)c=0,g?(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&&o^g){var m;v&a||!(m=n(p,r,!0))||(c=0,o?(t.lineStart(),t.point(m[0][0],m[0][1]),t.point(m[1][0],m[1][1]),t.lineEnd()):(t.point(m[1][0],m[1][1]),t.lineEnd(),t.lineStart(),t.point(m[0][0],m[0][1])))}!g||r&&Ae(r,p)||t.point(p[0],p[1]),r=p,l=g,a=v},lineEnd:function(){l&&t.lineEnd(),r=null},clean:function(){return c|(u&&l)<<1}}}function n(t,e,r){var n=me(t),i=me(e),o=[1,0,0],s=be(n,i),l=ye(s,s),u=s[0],c=l-u*u;if(!c)return!r&&t;var f=a*l/c,h=-a*u/c,d=be(o,s),p=_e(o,f);xe(p,_e(s,h));var g=d,v=ye(p,g),m=ye(g,g),y=v*v-m*(ye(p,p)-1);if(!(y<0)){var b=Math.sqrt(y),x=_e(g,(-v-b)/m);if(xe(x,p),x=Me(x),!r)return x;var _,w=t[0],M=e[0],A=t[1],k=e[1];M0^x[1]<(xo(x[0]-w)Fo^(w<=x[0]&&x[0]<=M)){var C=_e(g,(-v+b)/m);return xe(C,p),[x,Me(C)]}}}function i(e,r){var n=o?t:Fo-t,i=0;return e<-n?i|=1:e>n&&(i|=2),r<-n?i|=4:r>n&&(i|=8),i}var a=Math.cos(t),o=a>0,s=xo(a)>Do;return Ie(e,r,vr(t,6*Ho),o?[0,-t]:[-Fo,t-Fo])}function qe(t,e,r,n){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,g=f-u;if(a=t-l,p||!(a>0)){if(a/=p,p<0){if(a0){if(a>d)return;a>h&&(h=a)}if(a=r-l,p||!(a<0)){if(a/=p,p<0){if(a>d)return;a>h&&(h=a)}else if(p>0){if(a0)){if(a/=g,g<0){if(a0){if(a>d)return;a>h&&(h=a)}if(a=n-u,g||!(a<0)){if(a/=g,g<0){if(a>d)return;a>h&&(h=a)}else if(g>0){if(a0&&(i.a={x:l+h*p,y:u+h*g}),d<1&&(i.b={x:l+d*p,y:u+d*g}),i}}}}}}function Ge(t,e,r,n){function i(n,i){return xo(n[0]-t)0?0:3:xo(n[0]-r)0?2:1:xo(n[1]-e)0?1:0:i>0?3:2}function a(t,e){return o(t.x,e.x)}function o(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=v.length,n=t[1],i=0;in&&et(u,a,t)>0&&++e:a[1]<=n&&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:r,c>1?n:e)}while((c=(c+l+4)%4)!==f);else u.point(s[0],s[1])}function c(i,a){return t<=i&&i<=r&&e<=a&&a<=n}function f(t,e){c(t,e)&&s.point(t,e)}function h(){C.point=p,v&&v.push(m=[]),A=!0,M=!1,_=w=NaN}function d(){g&&(p(y,b),x&&M&&E.rejoin(),g.push(E.buffer())),C.point=f,M&&s.lineEnd()}function p(t,e){t=Math.max(-js,Math.min(js,t)),e=Math.max(-js,Math.min(js,e));var r=c(t,e);if(v&&m.push([t,e]),A)y=t,b=e,x=r,A=!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}};L(n)?(M||(s.lineStart(),s.point(n.a.x,n.a.y)),s.point(n.b.x,n.b.y),r||s.lineEnd(),k=!1):r&&(s.lineStart(),s.point(t,e),k=!1)}_=t,w=e,M=r}var g,v,m,y,b,x,_,w,M,A,k,T=s,E=De(),L=qe(t,e,r,n),C={point:f,lineStart:h,lineEnd:d,polygonStart:function(){s=E,g=[],v=[],k=!0},polygonEnd:function(){s=T,g=uo.merge(g);var e=l([t,n]),r=k&&e,i=g.length;(r||i)&&(s.polygonStart(),r&&(s.lineStart(),u(null,null,1,s),s.lineEnd()),i&&Re(g,a,e,u,s),s.polygonEnd()),g=v=m=null}};return C}}function Xe(t){var e=0,r=Fo/3,n=lr(t),i=n(e,r);return i.parallels=function(t){return arguments.length?n(e=t[0]*Fo/180,r=t[1]*Fo/180):[e/Fo*180,r/Fo*180]},i}function We(t,e){function r(t,e){var r=Math.sqrt(a-2*i*Math.sin(e))/i;return[r*Math.sin(t*=i),o-r*Math.cos(t)]}var n=Math.sin(t),i=(n+Math.sin(e))/2,a=1+n*(2*i-n),o=Math.sqrt(a)/i;return r.invert=function(t,e){var r=o-e;return[Math.atan2(t,r)/i,nt((a-(t*t+r*r)*i*i)/(2*i))]},r}function Ye(){function t(t,e){Bs+=i*t-n*e,n=t,i=e}var e,r,n,i;Gs.point=function(a,o){Gs.point=t,e=n=a,r=i=o},Gs.lineEnd=function(){t(e,r)}}function Ze(t,e){tHs&&(Hs=t),eqs&&(qs=e)}function Qe(){function t(t,e){o.push("M",t,",",e,a)}function e(t,e){o.push("M",t,",",e),s.point=r}function r(t,e){o.push("L",t,",",e)}function n(){s.point=t}function i(){o.push("Z")}var a=$e(4.5),o=[],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 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 Ke(t,e){Es+=t,Ls+=e,++Cs}function Je(){function t(t,n){var i=t-e,a=n-r,o=Math.sqrt(i*i+a*a);Ss+=o*(e+t)/2,Ps+=o*(r+n)/2,Rs+=o,Ke(e=t,r=n)}var e,r;Ws.point=function(n,i){Ws.point=t,Ke(e=n,r=i)}}function tr(){Ws.point=Ke}function er(){function t(t,e){var r=t-n,a=e-i,o=Math.sqrt(r*r+a*a);Ss+=o*(n+t)/2,Ps+=o*(i+e)/2,Rs+=o,o=i*t-n*e,Os+=o*(n+t),Ns+=o*(i+e),Is+=3*o,Ke(n=t,i=e)}var e,r,n,i;Ws.point=function(a,o){Ws.point=t,Ke(e=n=a,r=i=o)},Ws.lineEnd=function(){t(e,r)}}function rr(t){function e(e,r){t.moveTo(e+o,r),t.arc(e,r,o,0,Bo)}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 a(){t.closePath()}var o=4.5,s={point:e,lineStart:function(){s.point=r},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 nr(t){function e(t){return(s?n:r)(t)}function r(e){return or(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,A.point=a,e.lineStart()}function a(r,n){var a=me([r,n]),o=t(r,n);i(b,x,y,_,w,M,b=o[0],x=o[1],y=r,_=a[0],w=a[1],M=a[2],s,e),e.point(b,x)}function o(){A.point=r,e.lineEnd()}function l(){n(),A.point=u,A.lineEnd=c}function u(t,e){a(f=t,h=e),d=b,p=x,g=_,v=w,m=M,A.point=a}function c(){i(b,x,y,_,w,M,d,p,f,g,v,m,s,e),A.lineEnd=o,o()}var f,h,d,p,g,v,m,y,b,x,_,w,M,A={point:r,lineStart:n,lineEnd:o,polygonStart:function(){e.polygonStart(),A.lineStart=l},polygonEnd:function(){e.polygonEnd(),A.lineStart=n}};return A}function i(e,r,n,s,l,u,c,f,h,d,p,g,v,m){var y=c-e,b=f-r,x=y*y+b*b;if(x>4*a&&v--){var _=s+d,w=l+p,M=u+g,A=Math.sqrt(_*_+w*w+M*M),k=Math.asin(M/=A),T=xo(xo(M)-1)a||xo((y*S+b*P)/x-.5)>.3||s*d+l*p+u*g0&&16,e):Math.sqrt(a)},e}function ir(t){var e=nr(function(e,r){return t([e*qo,r*qo])});return function(t){return ur(e(t))}}function ar(t){this.stream=t}function or(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]*Ho,t[1]*Ho),[t[0]*h+l,u-t[1]*h]}function r(t){return(t=s.invert((t[0]-l)/h,(u-t[1])/h))&&[t[0]*qo,t[1]*qo]}function n(){s=Se(o=hr(m,y,b),a);var t=a(g,v);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=nr(function(t,e){return t=a(t,e),[t[0]*h+l,u-t[1]*h]}),h=150,d=480,p=250,g=0,v=0,m=0,y=0,b=0,_=Ds,w=x,M=null,A=null;return e.stream=function(t){return c&&(c.valid=!1),c=ur(_(o,f(w(t)))),c.valid=!0,c},e.clipAngle=function(t){return arguments.length?(_=null==t?(M=t,Ds):He((M=+t)*Ho),i()):M},e.clipExtent=function(t){return arguments.length?(A=t,w=t?Ge(t[0][0],t[0][1],t[1][0],t[1][1]):x,i()):A},e.scale=function(t){return arguments.length?(h=+t,n()):h},e.translate=function(t){return arguments.length?(d=+t[0],p=+t[1],n()):[d,p]},e.center=function(t){return arguments.length?(g=t[0]%360*Ho,v=t[1]%360*Ho,n()):[g*qo,v*qo]},e.rotate=function(t){return arguments.length?(m=t[0]%360*Ho,y=t[1]%360*Ho,b=t.length>2?t[2]%360*Ho:0,n()):[m*qo,y*qo,b*qo]},uo.rebind(e,f,"precision"),function(){return a=t.apply(this,arguments),e.invert=a.invert&&r,n()}}function ur(t){return or(t,function(e,r){t.point(e*Ho,r*Ho)})}function cr(t,e){return[t,e]}function fr(t,e){return[t>Fo?t-Bo:t<-Fo?t+Bo:t,e]}function hr(t,e,r){return t?e||r?Se(pr(t),gr(e,r)):pr(t):e||r?gr(e,r):fr}function dr(t){return function(e,r){return e+=t,[e>Fo?e-Bo:e<-Fo?e+Bo:e,r]}}function pr(t){var e=dr(t);return e.invert=dr(-t),e}function gr(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*a-c*o,s*n-u*i),nt(c*a+l*o)]}var n=Math.cos(t),i=Math.sin(t),a=Math.cos(e),o=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*a-l*o;return[Math.atan2(l*a+u*o,s*n+c*i),nt(c*n-s*i)]},r}function vr(t,e){var r=Math.cos(t),n=Math.sin(t);return function(i,a,o,s){var l=o*e;null!=i?(i=mr(r,i),a=mr(r,a),(o>0?ia)&&(i+=o*Bo)):(i=t+o*Bo,a=t-.5*l);for(var u,c=i;o>0?c>a:c0?e<-Vo+Do&&(e=-Vo+Do):e>Vo-Do&&(e=Vo-Do);var r=o/Math.pow(i(e),a);return[r*Math.sin(a*t),o-r*Math.cos(a*t)]}var n=Math.cos(t),i=function(t){return Math.tan(Fo/4+t/2)},a=t===e?Math.sin(t):Math.log(n/Math.cos(e))/Math.log(i(e)/i(t)),o=n*Math.pow(i(t),a)/a;return a?(r.invert=function(t,e){var r=o-e,n=tt(a)*Math.sqrt(t*t+r*r);return[Math.atan2(t,r)/a,2*Math.atan(Math.pow(o/n,1/a))-Vo]},r):Er}function Tr(t,e){function r(t,e){var r=a-e;return[r*Math.sin(i*t),a-r*Math.cos(i*t)]}var n=Math.cos(t),i=t===e?Math.sin(t):(n-Math.cos(e))/(e-t),a=n/i+t;return xo(i)1&&et(t[r[n-2]],t[r[n-1]],t[i])<=0;)--n;r[n++]=i}return r.slice(0,n)}function Or(t,e){return t[0]-e[0]||t[1]-e[1]}function Nr(t,e,r){return(r[0]-e[0])*(t[1]-e[1])<(r[1]-e[1])*(t[0]-e[0])}function Ir(t,e,r,n){var i=t[0],a=r[0],o=e[0]-i,s=n[0]-a,l=t[1],u=r[1],c=e[1]-l,f=n[1]-u,h=(s*(l-u)-f*(i-a))/(f*o-s*c);return[i+h*o,l+h*c]}function zr(t){var e=t[0],r=t[t.length-1];return!(e[0]-r[0]||e[1]-r[1])}function Dr(){an(this),this.edge=this.site=this.circle=null}function jr(t){var e=sl.pop()||new Dr;return e.site=t,e}function Fr(t){Zr(t),il.remove(t),sl.push(t),an(t)}function Br(t){var e=t.circle,r=e.x,n=e.cy,i={x:r,y:n},a=t.P,o=t.N,s=[t];Fr(t);for(var l=a;l.circle&&xo(r-l.circle.x)Do)s=s.L;else{if(!((i=a-Hr(s,o))>Do)){n>-Do?(e=s.P,r=s):i>-Do?(e=s,r=s.N):e=r=s;break}if(!s.R){e=s;break}s=s.R}var l=jr(t);if(il.insert(e,l),e||r){if(e===r)return Zr(e),r=jr(e.site),il.insert(l,r),l.edge=r.edge=Jr(e.site,l.site),Yr(e),void Yr(r);if(!r)return void(l.edge=Jr(e.site,l.site));Zr(e),Zr(r);var u=e.site,c=u.x,f=u.y,h=t.x-c,d=t.y-f,p=r.site,g=p.x-c,v=p.y-f,m=2*(h*v-d*g),y=h*h+d*d,b=g*g+v*v,x={x:(v*y-d*b)/m+c,y:(h*b-g*y)/m+f};en(r.edge,u,p,x),l.edge=Jr(u,t,null,x),r.edge=Jr(t,p,null,x),Yr(e),Yr(r)}}function Vr(t,e){var r=t.site,n=r.x,i=r.y,a=i-e;if(!a)return n;var o=t.P;if(!o)return-1/0;r=o.site;var s=r.x,l=r.y,u=l-e;if(!u)return s;var c=s-n,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+n:(n+s)/2}function Hr(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 qr(t){this.site=t,this.edges=[]}function Gr(t){for(var e,r,n,i,a,o,s,l,u,c,f=t[0][0],h=t[1][0],d=t[0][1],p=t[1][1],g=nl,v=g.length;v--;)if((a=g[v])&&a.prepare())for(s=a.edges,l=s.length,o=0;oDo||xo(i-r)>Do)&&(s.splice(o,0,new rn(tn(a.site,c,xo(n-f)Do?{x:f,y:xo(e-f)Do?{x:xo(r-p)Do?{x:h,y:xo(e-h)Do?{x:xo(r-d)=-jo)){var d=l*l+u*u,p=c*c+f*f,g=(f*d-u*p)/h,v=(l*p-c*d)/h,f=v+s,m=ll.pop()||new Wr;m.arc=t,m.site=i,m.x=g+o,m.y=f+Math.sqrt(g*g+v*v),m.cy=f,t.circle=m;for(var y=null,b=ol._;b;)if(m.y=s)return;if(h>p){if(a){if(a.y>=u)return}else a={x:v,y:l};r={x:v,y:u}}else{if(a){if(a.y1)if(h>p){if(a){if(a.y>=u)return}else a={x:(l-i)/n,y:l};r={x:(u-i)/n,y:u}}else{if(a){if(a.y=s)return}else a={x:o,y:n*o+i};r={x:s,y:n*s+i}}else{if(a){if(a.xa||f>o||h=x,M=r>=_,A=M<<1|w,k=A+4;Aa&&(i=e.slice(a,i),s[o]?s[o]+=i:s[++o]=i),(r=r[0])===(n=n[0])?s[o]?s[o]+=n:s[++o]=n:(s[++o]=null,l.push({i:o,x:bn(r,n)})),a=fl.lastIndex;return a=0&&!(r=uo.interpolators[n](t,e)););return r}function wn(t,e){var r,n=[],i=[],a=t.length,o=e.length,s=Math.min(t.length,e.length);for(r=0;r=1?1:t(e)}}function An(t){return function(e){return 1-t(1-e)}}function kn(t){return function(e){return.5*(e<.5?t(2*e):2-t(2-2*e))}}function Tn(t){return t*t}function En(t){return t*t*t}function Ln(t){if(t<=0)return 0;if(t>=1)return 1;var e=t*t,r=e*t;return 4*(t<.5?r:3*(t-e)+r-.75)}function Cn(t){return function(e){return Math.pow(e,t)}}function Sn(t){return 1-Math.cos(t*Vo)}function Pn(t){return Math.pow(2,10*(t-1))}function Rn(t){return 1-Math.sqrt(1-t*t)}function On(t,e){var r;return arguments.length<2&&(e=.45),arguments.length?r=e/Bo*Math.asin(1/t):(t=1,r=e/4),function(n){return 1+t*Math.pow(2,-10*n)*Math.sin((n-r)*Bo/e)}}function Nn(t){return t||(t=1.70158),function(e){return e*e*((t+1)*e-t)}}function In(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375}function zn(t,e){t=uo.hcl(t),e=uo.hcl(e);var r=t.h,n=t.c,i=t.l,a=e.h-r,o=e.c-n,s=e.l-i;return isNaN(o)&&(o=0,n=isNaN(n)?e.c:n),isNaN(a)?(a=0,r=isNaN(r)?e.h:r):a>180?a-=360:a<-180&&(a+=360),function(t){return ht(r+a*t,n+o*t,i+s*t)+""}}function Dn(t,e){t=uo.hsl(t),e=uo.hsl(e);var r=t.h,n=t.s,i=t.l,a=e.h-r,o=e.s-n,s=e.l-i;return isNaN(o)&&(o=0,n=isNaN(n)?e.s:n),isNaN(a)?(a=0,r=isNaN(r)?e.h:r):a>180?a-=360:a<-180&&(a+=360),function(t){return ct(r+a*t,n+o*t,i+s*t)+""}}function jn(t,e){t=uo.lab(t),e=uo.lab(e);var r=t.l,n=t.a,i=t.b,a=e.l-r,o=e.a-n,s=e.b-i;return function(t){return pt(r+a*t,n+o*t,i+s*t)+""}}function Fn(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),a=Vn(Hn(r,e,-i))||0;e[0]*r[1]180?e+=360:e-t>180&&(t+=360),n.push({i:r.push(qn(r)+"rotate(",null,")")-2,x:bn(t,e)})):e&&r.push(qn(r)+"rotate("+e+")")}function Wn(t,e,r,n){t!==e?n.push({i:r.push(qn(r)+"skewX(",null,")")-2,x:bn(t,e)}):e&&r.push(qn(r)+"skewX("+e+")")}function Yn(t,e,r,n){if(t[0]!==e[0]||t[1]!==e[1]){var i=r.push(qn(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(qn(r)+"scale("+e+")")}function Zn(t,e){var r=[],n=[];return t=uo.transform(t),e=uo.transform(e),Gn(t.translate,e.translate,r,n),Xn(t.rotate,e.rotate,r,n),Wn(t.skew,e.skew,r,n),Yn(t.scale,e.scale,r,n),t=e=null,function(t){for(var e,i=-1,a=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),(a=t.children)&&(i=a.length))for(var i,a,o=-1;++oi&&(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,a=[];++r<=e;)a[r]=i*r+n;return a}function Mi(t){return[uo.min(t),uo.max(t)]}function Ai(t,e){return t.value-e.value}function ki(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 Li(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((r=t.children)&&(u=r.length)){var r,n,i,a,o,s,l,u,c=1/0,f=-1/0,h=1/0,d=-1/0;if(r.forEach(Ci),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(a=r[2],Ri(n,i,a),e(a),ki(n,a),n._pack_prev=a,ki(a,i),i=n._pack_next,o=3;o=0;)e=i[a],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 Fi(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 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 Hi(t){return{x:t.x,y:t.y,dx:t.dx,dy:t.dy}}function qi(t,e){var r=t.x+e[3],n=t.y+e[0],i=t.dx-e[1]-e[3],a=t.dy-e[0]-e[2];return i<0&&(r+=i/2,i=0),a<0&&(n+=a/2,a=0),{x:r,y:n,dx:i,dy:a}}function Gi(t){var e=t[0],r=t[t.length-1];return e2?Qi:Wi,l=n?$n:Qn;return o=i(t,e,l,r),s=i(e,t,l,_n),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(Fn)},a.clamp=function(t){return arguments.length?(n=t,i()):n},a.interpolate=function(t){return arguments.length?(r=t,i()):r},a.ticks=function(e){return ea(t,e)},a.tickFormat=function(e,r){return ra(t,e,r)},a.nice=function(e){return Ji(t,e),i()},a.copy=function(){return $i(t,e,r,n)},i()}function Ki(t,e){return uo.rebind(t,e,"range","rangeRound","interpolate","clamp")}function Ji(t,e){return Yi(t,Zi(ta(t,e)[2])),Yi(t,Zi(ta(t,e)[2])),t}function ta(t,e){null==e&&(e=10);var r=Gi(t),n=r[1]-r[0],i=Math.pow(10,Math.floor(Math.log(n/e)/Math.LN10)),a=e/n*i;return a<=.15?i*=10:a<=.35?i*=5:a<=.75&&(i*=2),r[0]=Math.ceil(r[0]/i)*i,r[1]=Math.floor(r[1]/i)*i+.5*i,r[2]=i,r}function ea(t,e){return uo.range.apply(uo,ta(t,e))}function ra(t,e,r){var n=ta(t,e);if(r){var i=cs.exec(r);if(i.shift(),"s"===i[8]){var a=uo.formatPrefix(Math.max(xo(n[0]),xo(n[1])));return i[7]||(i[7]="."+na(a.scale(n[2]))),i[8]="f",r=uo.format(i.join("")),function(t){return r(a.scale(t))+a.symbol}}i[7]||(i[7]="."+ia(i[8],n)),r=i.join("")}else r=",."+na(n[2])+"f";return uo.format(r)}function na(t){return-Math.floor(Math.log(t)/Math.LN10+.01)}function ia(t,e){var r=na(e[2]);return t in Ml?Math.abs(r-na(Math.max(xo(e[0]),xo(e[1]))))+ +("e"!==t):r-2*("%"===t)}function aa(t,e,r,n){function i(t){return(r?Math.log(t<0?0:t):-Math.log(t>0?0:-t))/Math.log(e)}function a(t){return r?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?(r=e[0]>=0,t.domain((n=e.map(Number)).map(i)),o):n},o.base=function(r){return arguments.length?(e=+r,t.domain(n.map(i)),o):e},o.nice=function(){var e=Yi(n.map(i),r?Math:kl);return t.domain(e),n=e.map(a),o},o.ticks=function(){var t=Gi(n),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(r){for(;u0;h--)o.push(a(u)*h);for(u=0;o[u]l;c--);o=o.slice(u,c)}return o},o.tickFormat=function(t,r){if(!arguments.length)return Al;arguments.length<2?r=Al:"function"!=typeof r&&(r=uo.format(r));var n=Math.max(1,e*t/o.ticks().length);return function(t){var o=t/a(Math.round(i(t)));return o*e0?s[r-1]:t[0],r0?0:1}function xa(t,e,r,n,i){var a=t[0]-e[0],o=t[1]-e[1],s=(i?n:-n)/Math.sqrt(a*a+o*o),l=s*o,u=-s*a,c=t[0]+l,f=t[1]+u,h=e[0]+l,d=e[1]+u,p=(c+h)/2,g=(f+d)/2,v=h-c,m=d-f,y=v*v+m*m,b=r-n,x=c*d-h*f,_=(m<0?-1:1)*Math.sqrt(Math.max(0,b*b*y-x*x)),w=(x*m-v*_)/y,M=(-x*v-m*_)/y,A=(x*m+v*_)/y,k=(-x*v+m*_)/y,T=w-p,E=M-g,L=A-p,C=k-g;return T*T+E*E>L*L+C*C&&(w=A,M=k),[[w-l,M-u],[w*r/b,M*r/b]]}function _a(t){function e(e){function o(){u.push("M",a(t(c),s))}for(var l,u=[],c=[],f=-1,h=e.length,d=Lt(r),p=Lt(n);++f1?t.join("L"):t+"Z"}function Ma(t){return t.join("L")+"Z"}function Aa(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 ka(t){for(var e=0,r=t.length,n=t[0],i=[n[0],",",n[1]];++e1){s=e[1],a=t[l],l++,n+="C"+(i[0]+o[0])+","+(i[1]+o[1])+","+(a[0]-s[0])+","+(a[1]-s[1])+","+a[0]+","+a[1];for(var u=2;u9&&(i=3*e/Math.sqrt(i),o[s]=i*r,o[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+o[s]*o[s])),a.push([i||0,o[s]*i||0]);return a}function Ua(t){return t.length<3?wa(t):t[0]+Sa(t,Ba(t))}function Va(t){for(var e,r,n,i=-1,a=t.length;++i0;)d[--s].call(t,o);if(a>=1)return g.event&&g.event.end.call(t,t.__data__,e),--p.count?delete p[n]:delete t[r],1}var l,u,c,h,d,p=t[r]||(t[r]={active:0,count:0}),g=p[n];g||(l=i.time,u=Ot(a,0,l),g=p[n]={tween:new f,time:l,timer:u,delay:i.delay,duration:i.duration,ease:i.ease,index:e},i=null,++p.count)}function ro(t,e,r){t.attr("transform",function(t){var n=e(t);return"translate("+(isFinite(n)?n:r(t))+",0)"})}function no(t,e,r){t.attr("transform",function(t){var n=e(t);return"translate(0,"+(isFinite(n)?n:r(t))+")"})}function io(t){return t.toISOString()}function ao(t,e,r){function n(e){return t(e)}function i(t,r){var n=t[1]-t[0],i=n/r,a=uo.bisect(Ql,i);return a==Ql.length?[e.year,ta(t.map(function(t){return t/31536e6}),r)[2]]:a?e[i/Ql[a-1]1?{floor:function(e){for(;r(e=t.floor(e));)e=oo(e-1);return e},ceil:function(e){for(;r(e=t.ceil(e));)e=oo(+e+1);return e}}:t))},n.ticks=function(t,e){var r=Gi(n.domain()),a=null==t?i(r,10):"number"==typeof t?i(r,t):!t.range&&[{range:t},e];return a&&(t=a[0],e=a[1]),t.range(r[0],oo(+r[1]+1),e<1?1:e)},n.tickFormat=function(){return r},n.copy=function(){return ao(t.copy(),e,r)},Ki(n,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.17"},co=[].slice,fo=function(t){return co.call(t)},ho=this.document;if(ho)try{fo(ho.documentElement.childNodes)[0].nodeType}catch(t){fo=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}),ho)try{ho.createElement("DIV").style.setProperty("opacity",0,"")}catch(t){var po=this.Element.prototype,go=po.setAttribute,vo=po.setAttributeNS,mo=this.CSSStyleDeclaration.prototype,yo=mo.setProperty;po.setAttribute=function(t,e){go.call(this,t,e+"")},po.setAttributeNS=function(t,e,r){vo.call(this,t,e,r+"")},mo.setProperty=function(t,e,r){yo.call(this,t,e+"",r)}}uo.ascending=i,uo.descending=function(t,e){return et?1:e>=t?0:NaN},uo.min=function(t,e){var r,n,i=-1,a=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},uo.max=function(t,e){var r,n,i=-1,a=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},uo.extent=function(t,e){var r,n,i,a=-1,o=t.length;if(1===arguments.length){for(;++a=n){r=i=n;break}for(;++an&&(r=n),i=n){r=i=n;break}for(;++an&&(r=n),i1)return l/(c-1)},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,r){return i(t(e),r)}:t)},uo.shuffle=function(t,e,r){(a=arguments.length)<3&&(r=t.length,a<2&&(e=0));for(var n,i,a=r-e;a;)i=Math.random()*a--|0,n=t[a+e],t[a+e]=t[i+e],t[i+e]=n;return t},uo.permute=function(t,e){for(var r=e.length,n=new Array(r);r--;)n[r]=t[e[r]];return n},uo.pairs=function(t){for(var e=0,r=t.length-1,n=t[0],i=new Array(r<0?0:r);e=0;)for(n=t[i],e=n.length;--e>=0;)r[--o]=n[e];return r};var xo=Math.abs;uo.range=function(t,e,r){if(arguments.length<3&&(r=1,arguments.length<2&&(e=t,t=0)),(e-t)/r==1/0)throw new Error("infinite range");var n,i=[],a=u(xo(r)),o=-1;if(t*=a,e*=a,r*=a,r<0)for(;(n=t+r*++o)>e;)i.push(n/a);else for(;(n=t+r*++o)=a.length)return n?n.call(i,o):r?o.sort(r):o;for(var l,u,c,h,d=-1,p=o.length,g=a[s++],v=new f;++d=a.length)return t;var n=[],i=o[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={},a=[],o=[];return i.map=function(e,r){return t(r,e,0)},i.entries=function(r){return e(t(uo.map,r,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 r=t,i},i.rollup=function(t){return n=t,i},i},uo.set=function(t){var e=new b;if(t)for(var r=0,n=t.length;r=0&&(n=t.slice(r+1),t=t.slice(0,r)),t)return arguments.length<2?this[t].on(n):this[t].on(n,e);if(2===arguments.length){if(null==e)for(t in this)this.hasOwnProperty(t)&&this[t].on(n,null);return this}},uo.event=null,uo.requote=function(t){return t.replace(Ao,"\\$&")};var Ao=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,ko={}.__proto__?function(t,e){t.__proto__=e}:function(t,e){for(var r in e)t[r]=e[r]},To=function(t,e){return e.querySelector(t)},Eo=function(t,e){return e.querySelectorAll(t)},Lo=function(t,e){var r=t.matches||t[w(t,"matchesSelector")];return(Lo=function(t,e){return r.call(t,e)})(t,e)};"function"==typeof Sizzle&&(To=function(t,e){return Sizzle(t,e)[0]||null},Eo=Sizzle,Lo=Sizzle.matchesSelector),uo.selection=function(){return uo.select(ho.documentElement)};var Co=uo.selection.prototype=[];Co.select=function(t){var e,r,n,i,a=[];t=S(t);for(var o=-1,s=this.length;++o=0&&"xmlns"!==(r=t.slice(0,e))&&(t=t.slice(e+1)),Po.hasOwnProperty(r)?{space:Po[r],local:t}:t}},Co.attr=function(t,e){if(arguments.length<2){if("string"==typeof t){var r=this.node();return t=uo.ns.qualify(t),t.local?r.getAttributeNS(t.space,t.local):r.getAttribute(t)}for(e in t)this.each(R(e,t[e]));return this}return this.each(R(t,e))},Co.classed=function(t,e){if(arguments.length<2){if("string"==typeof t){var r=this.node(),n=(t=I(t)).length,i=-1;if(e=r.classList){for(;++i=0;)(r=n[i])&&(a&&a!==r.nextSibling&&a.parentNode.insertBefore(r,a),a=r);return this},Co.sort=function(t){t=q.apply(this,arguments);for(var e=-1,r=this.length;++e0&&(e=e.transition().duration(C)),e.call(t.event)}function s(){_&&_.domain(x.range().map(function(t){return(t-A.x)/A.k}).map(x.invert)),M&&M.domain(w.range().map(function(t){return(t-A.y)/A.k}).map(w.invert))}function l(t){S++||t({type:"zoomstart"})}function u(t){s(),t({type:"zoom",scale:A.k,translate:[A.x,A.y]})}function c(t){--S||(t({type:"zoomend"}),v=null)}function f(){function t(){s=1,a(uo.mouse(i),h),u(o)}function r(){f.on(R,null).on(O,null),d(s),c(o)}var i=this,o=I.of(i,arguments),s=0,f=uo.select(n(i)).on(R,t).on(O,r),h=e(uo.mouse(i)),d=$(i);Bl.call(i),l(o)}function h(){function t(){var t=uo.touches(p);return d=A.k,t.forEach(function(t){t.identifier in v&&(v[t.identifier]=e(t))}),t}function r(){var e=uo.event.target;uo.select(e).on(x,n).on(_,s),w.push(e);for(var r=uo.event.changedTouches,i=0,a=r.length;i1){var c=l[0],f=l[1],h=c[0]-f[0],d=c[1]-f[1];m=h*h+d*d}}function n(){var t,e,r,n,o=uo.touches(p);Bl.call(p);for(var s=0,l=o.length;s=u)return o;if(i)return i=!1,a;var e=c;if(34===t.charCodeAt(e)){for(var r=e;r++=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i,fs=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,Dt(t,e))).toFixed(Math.max(0,Math.min(20,Dt(t*(1+1e-15),e))))}}),hs=uo.time={},ds=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(){ps.setUTCDate.apply(this._,arguments)},setDay:function(){ps.setUTCDay.apply(this._,arguments)},setFullYear:function(){ps.setUTCFullYear.apply(this._,arguments)},setHours:function(){ps.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){ps.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){ps.setUTCMinutes.apply(this._,arguments)},setMonth:function(){ps.setUTCMonth.apply(this._,arguments)},setSeconds:function(){ps.setUTCSeconds.apply(this._,arguments)},setTime:function(){ps.setTime.apply(this._,arguments)}};var ps=Date.prototype;hs.year=Vt(function(t){return t=hs.day(t),t.setMonth(0,1),t},function(t,e){t.setFullYear(t.getFullYear()+e)},function(t){return t.getFullYear()}),hs.years=hs.year.range,hs.years.utc=hs.year.utc.range,hs.day=Vt(function(t){var e=new ds(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}),hs.days=hs.day.range,hs.days.utc=hs.day.utc.range,hs.dayOfYear=function(t){var e=hs.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=hs[t]=Vt(function(t){return(t=hs.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=hs.year(t).getDay();return Math.floor((hs.dayOfYear(t)+(r+e)%7)/7)-(r!==e)});hs[t+"s"]=r.range,hs[t+"s"].utc=r.utc.range,hs[t+"OfYear"]=function(t){var r=hs.year(t).getDay();return Math.floor((hs.dayOfYear(t)+(r+e)%7)/7)}}),hs.week=hs.sunday,hs.weeks=hs.sunday.range,hs.weeks.utc=hs.sunday.utc.range,hs.weekOfYear=hs.sundayOfYear;var gs={"-":"",_:" ",0:"0"},vs=/^\s*\d+/,ms=/^%/;uo.locale=function(t){return{numberFormat:Ft(t),timeFormat:qt(t)}};var ys=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=ys.numberFormat,uo.geo={},fe.prototype={s:0,t:0,add:function(t){he(t,this.t,bs),he(bs.s,this.s,this),this.s?this.t+=bs.t:this.s=bs.t},reset:function(){this.s=this.t=0},valueOf:function(){return this.s}};var bs=new fe;uo.geo.stream=function(t,e){t&&xs.hasOwnProperty(t.type)?xs[t.type](t,e):de(t,e)};var xs={Feature:function(t,e){de(t.geometry,e)},FeatureCollection:function(t,e){for(var r=t.features,n=-1,i=r.length;++nd&&(d=e)}function e(e,r){var n=me([e*Ho,r*Ho]);if(m){var i=be(m,n),a=[i[1],-i[0],0],o=be(a,i);we(o),o=Me(o);var l=e-p,u=l>0?1:-1,g=o[0]*qo*u,v=xo(l)>180;if(v^(u*pd&&(d=y)}else if(g=(g+360)%360-180,v^(u*pd&&(d=r);v?es(c,h)&&(h=e):s(e,h)>s(c,h)&&(c=e):h>=c?(eh&&(h=e)):e>p?s(c,e)>s(c,h)&&(h=e):s(e,h)>s(c,h)&&(c=e)}else t(e,r);m=n,p=e}function r(){_.point=e}function n(){x[0]=c,x[1]=h,_.point=t,m=null}function i(t,r){if(m){var n=t-p;y+=xo(n)>180?n+(n>0?360:-360):n}else g=t,v=r;As.point(t,r),e(t,r)}function a(){As.lineStart()}function o(){i(g,v),As.lineEnd(),xo(y)>Do&&(c=-(h=180)),x[0]=c,x[1]=h,m=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]:tDo?d=90:y<-Do&&(f=-90),x[0]=c,x[1]=h}};return function(t){d=h=-(c=f=1/0),b=[],uo.geo.stream(t,_);var e=b.length;if(e){b.sort(l);for(var r,n=1,i=b[0],a=[i];ns(i[0],i[1])&&(i[1]=r[1]),s(r[0],i[1])>s(i[0],i[1])&&(i[0]=r[0])):a.push(i=r);for(var o,r,p=-1/0,e=a.length-1,n=0,i=a[e];n<=e;i=r,++n)r=a[n],(o=s(i[1],r[0]))>p&&(p=o,c=r[0],h=i[1])}return b=x=null,c===1/0||f===1/0?[[NaN,NaN],[NaN,NaN]]:[[c,f],[h,d]]}}(),uo.geo.centroid=function(t){ks=Ts=Es=Ls=Cs=Ss=Ps=Rs=Os=Ns=Is=0,uo.geo.stream(t,zs);var e=Os,r=Ns,n=Is,i=e*e+r*r+n*n;return i=.12&&i<.234&&n>=-.425&&n<-.214?o:i>=.166&&i<.234&&n>=-.214&&n<-.115?s:a).invert(t)},t.stream=function(t){var e=a.stream(t),r=o.stream(t),n=s.stream(t);return{point:function(t,i){e.point(t,i),r.point(t,i),n.point(t,i)},sphere:function(){e.sphere(),r.sphere(),n.sphere()},lineStart:function(){e.lineStart(),r.lineStart(),n.lineStart()},lineEnd:function(){e.lineEnd(),r.lineEnd(),n.lineEnd()},polygonStart:function(){e.polygonStart(),r.polygonStart(),n.polygonStart()},polygonEnd:function(){e.polygonEnd(),r.polygonEnd(),n.polygonEnd()}}},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 r=a.translate(e).clipExtent([[c-.455*u,f-.238*u],[c+.455*u,f+.238*u]]).stream(l).point,n=o.translate([c-.307*u,f+.201*u]).clipExtent([[c-.425*u+Do,f+.12*u+Do],[c-.214*u-Do,f+.234*u-Do]]).stream(l).point,i=s.translate([c-.205*u,f+.212*u]).clipExtent([[c-.214*u+Do,f+.166*u+Do],[c-.115*u-Do,f+.234*u-Do]]).stream(l).point,t},t.scale(1070)};var Fs,Bs,Us,Vs,Hs,qs,Gs={point:M,lineStart:M,lineEnd:M,polygonStart:function(){Bs=0,Gs.lineStart=Ye},polygonEnd:function(){Gs.lineStart=Gs.lineEnd=Gs.point=M,Fs+=xo(Bs/2)}},Xs={point:Ze,lineStart:M,lineEnd:M,polygonStart:M,polygonEnd:M},Ws={point:Ke,lineStart:Je,lineEnd:tr,polygonStart:function(){Ws.lineStart=er},polygonEnd:function(){Ws.point=Ke,Ws.lineStart=Je,Ws.lineEnd=tr}};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 r,n,i,a,o,s=4.5;return t.area=function(t){return Fs=0,uo.geo.stream(t,i(Gs)),Fs},t.centroid=function(t){return Es=Ls=Cs=Ss=Ps=Rs=Os=Ns=Is=0,uo.geo.stream(t,i(Ws)),Is?[Os/Is,Ns/Is]:Rs?[Ss/Rs,Ps/Rs]:Cs?[Es/Cs,Ls/Cs]:[NaN,NaN]},t.bounds=function(t){return Hs=qs=-(Us=Vs=1/0),uo.geo.stream(t,i(Xs)),[[Us,Vs],[Hs,qs]]},t.projection=function(t){return arguments.length?(i=(r=t)?t.stream||ir(t):x,e()):r},t.context=function(t){return arguments.length?(a=null==(n=t)?new Qe:new rr(t),"function"!=typeof s&&a.pointRadius(s),e()):n},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 r=new ar(e);for(var n in t)r[n]=t[n];return r}}},ar.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=sr,uo.geo.projectionMutator=lr,(uo.geo.equirectangular=function(){return sr(cr)}).raw=cr.invert=cr,uo.geo.rotation=function(t){function e(e){return e=t(e[0]*Ho,e[1]*Ho),e[0]*=qo,e[1]*=qo,e}return t=hr(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]*=qo,e[1]*=qo,e},e},fr.invert=cr,uo.geo.circle=function(){function t(){var t="function"==typeof n?n.apply(this,arguments):n,e=hr(-t[0]*Ho,-t[1]*Ho,0).invert,i=[];return r(null,null,1,{point:function(t,r){i.push(t=e(t,r)),t[0]*=qo,t[1]*=qo}}),{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=vr((e=+n)*Ho,i*Ho),t):e},t.precision=function(n){return arguments.length?(r=vr(e*Ho,(i=+n)*Ho),t):i},t.angle(90)},uo.geo.distance=function(t,e){var r,n=(e[0]-t[0])*Ho,i=t[1]*Ho,a=e[1]*Ho,o=Math.sin(n),s=Math.cos(n),l=Math.sin(i),u=Math.cos(i),c=Math.sin(a),f=Math.cos(a);return Math.atan2(Math.sqrt((r=f*o)*r+(r=u*c-l*f*s)*r),l*c+u*f*s)},uo.geo.graticule=function(){function t(){return{type:"MultiLineString",coordinates:e()}}function e(){return uo.range(Math.ceil(a/v)*v,i,v).map(h).concat(uo.range(Math.ceil(u/m)*m,l,m).map(d)).concat(uo.range(Math.ceil(n/p)*p,r,p).filter(function(t){return xo(t%v)>Do}).map(c)).concat(uo.range(Math.ceil(s/g)*g,o,g).filter(function(t){return xo(t%m)>Do}).map(f))}var r,n,i,a,o,s,l,u,c,f,h,d,p=10,g=p,v=90,m=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?(n=+e[0][0],r=+e[1][0],s=+e[0][1],o=+e[1][1],n>r&&(e=n,n=r,r=e),s>o&&(e=s,s=o,o=e),t.precision(y)):[[n,s],[r,o]]},t.step=function(e){return arguments.length?t.majorStep(e).minorStep(e):t.minorStep()},t.majorStep=function(e){return arguments.length?(v=+e[0],m=+e[1],t):[v,m]},t.minorStep=function(e){return arguments.length?(p=+e[0],g=+e[1],t):[p,g]},t.precision=function(e){return arguments.length?(y=+e,c=yr(s,o,90),f=br(n,r,y),h=yr(u,l,90),d=br(a,i,y),t):y},t.majorExtent([[-180,-90+Do],[180,90-Do]]).minorExtent([[-180,-80-Do],[180,80+Do]])},uo.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 uo.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},uo.geo.interpolate=function(t,e){return wr(t[0]*Ho,t[1]*Ho,e[0]*Ho,e[1]*Ho)},uo.geo.length=function(t){return Ys=0,uo.geo.stream(t,Zs),Ys};var Ys,Zs={sphere:M,point:M,lineStart:Mr,lineEnd:M,polygonStart:M,polygonEnd:M},Qs=Ar(function(t){return Math.sqrt(2/(1+t))},function(t){return 2*Math.asin(t/2)});(uo.geo.azimuthalEqualArea=function(){return sr(Qs)}).raw=Qs;var $s=Ar(function(t){var e=Math.acos(t);return e&&e/Math.sin(e)},x);(uo.geo.azimuthalEquidistant=function(){return sr($s)}).raw=$s,(uo.geo.conicConformal=function(){return Xe(kr)}).raw=kr, +(uo.geo.conicEquidistant=function(){return Xe(Tr)}).raw=Tr;var Ks=Ar(function(t){return 1/t},Math.atan);(uo.geo.gnomonic=function(){return sr(Ks)}).raw=Ks,Er.invert=function(t,e){return[t,2*Math.atan(Math.exp(e))-Vo]},(uo.geo.mercator=function(){return Lr(Er)}).raw=Er;var Js=Ar(function(){return 1},Math.asin);(uo.geo.orthographic=function(){return sr(Js)}).raw=Js;var tl=Ar(function(t){return 1/(1+t)},function(t){return 2*Math.atan(t)});(uo.geo.stereographic=function(){return sr(tl)}).raw=tl,Cr.invert=function(t,e){return[-e,2*Math.atan(Math.exp(t))-Vo]},(uo.geo.transverseMercator=function(){var t=Lr(Cr),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=Cr,uo.geom={},uo.geom.hull=function(t){function e(t){if(t.length<3)return[];var e,i=Lt(r),a=Lt(n),o=t.length,s=[],l=[];for(e=0;e=0;--e)d.push(t[s[u[e]][2]]);for(e=+f;e=n&&u.x<=a&&u.y>=i&&u.y<=o?[[n,o],[a,o],[a,i],[n,i]]:[]).point=t[s]}),e}function r(t){return t.map(function(t,e){return{x:Math.round(a(t,e)/Do)*Do,y:Math.round(o(t,e)/Do)*Do,i:e}})}var n=Sr,i=Pr,a=n,o=i,s=ul;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,a=r.site,o=r.edges.sort(Xr),s=-1,l=o.length,u=o[l-1].edge,c=u.l===a?u.r:u.l;++s=u,h=n>=c,d=h<<1|f;t.leaf=!1,t=t.nodes[d]||(t.nodes[d]=pn()),f?i=u:s=u,h?o=c:l=c,a(t,e,r,n,i,o,s,l)}var c,f,h,d,p,g,v,m,y,b=Lt(s),x=Lt(l);if(null!=e)g=e,v=r,m=n,y=i;else if(m=y=-(g=v=1/0),f=[],h=[],p=t.length,o)for(d=0;dm&&(m=c.x),c.y>y&&(y=c.y),f.push(c.x),h.push(c.y);else for(d=0;dm&&(m=_),w>y&&(y=w),f.push(_),h.push(w)}var M=m-g,A=y-v;M>A?y=v+M:m=g+A;var k=pn();if(k.add=function(t){a(k,t,+b(t,++d),+x(t,d),g,v,m,y)},k.visit=function(t){gn(t,k,g,v,m,y)},k.find=function(t){return vn(k,t[0],t[1],g,v,m,y)},d=-1,null==e){for(;++d=0?t.slice(0,e):t,n=e>=0?t.slice(e+1):"in";return r=dl.get(r)||hl,n=pl.get(n)||x,Mn(n(r.apply(null,co.call(arguments,1))))},uo.interpolateHcl=zn,uo.interpolateHsl=Dn,uo.interpolateLab=jn,uo.interpolateRound=Fn,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 r=e.transform.baseVal.consolidate()}return new Bn(r?r.matrix:gl)})(t)},Bn.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var gl={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;++r0?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=Ot(l.tick)),l):i},l.start=function(){function t(t,n){if(!r){for(r=new Array(i),l=0;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;++us&&(s=n),o.push(n)}for(r=0;r0)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=Mi,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 Pi(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(Ai),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;o0&&(zi(ji(o,t,r),t,n),u+=n,c+=n),f+=o.m,u+=i.m,h+=l.m,c+=a.m;o&&!Ii(a)&&(a.t=o,a.m+=f-c),i&&!Ni(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=Oi,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=Fi(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=Oi,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;++i0;)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;++oi&&(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);++a1);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;rf?0:1;if(u=Uo)return e(u,d)+(t?e(t,1-d):"")+"Z";var p,g,v,m,y,b,x,_,w,M,A,k,T=0,E=0,L=[];if((m=(+l.apply(this,arguments)||0)/2)&&(v=a===Sl?Math.sqrt(t*t+u*u):+a.apply(this,arguments),d||(E*=-1),u&&(E=nt(v/u*Math.sin(m))),t&&(T=nt(v/t*Math.sin(m)))),u){y=u*Math.cos(c+E),b=u*Math.sin(c+E),x=u*Math.cos(f-E),_=u*Math.sin(f-E);var C=Math.abs(f-c-2*E)<=Fo?0:1;if(E&&ba(y,b,x,_)===d^C){var S=(c+f)/2;y=u*Math.cos(S),b=u*Math.sin(S),x=_=null}}else y=b=0;if(t){w=t*Math.cos(f-T),M=t*Math.sin(f-T),A=t*Math.cos(c+T),k=t*Math.sin(c+T);var P=Math.abs(c-f+2*T)<=Fo?0:1;if(T&&ba(w,M,A,k)===1-d^P){var R=(c+f)/2;w=t*Math.cos(R),M=t*Math.sin(R),A=k=null}}else w=M=0;if(h>Do&&(p=Math.min(Math.abs(u-t)/2,+i.apply(this,arguments)))>.001){g=tFo)+",1 "+e}function i(t,e,r,n){return"Q 0,0 "+n}var a=xr,o=_r,s=qa,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(Il.get(e.call(this,t,n))||Za)(r.call(this,t,n))}var e=Ya,r=Wa;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 Il=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*Dl)),r=e*Dl;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/zl),r=e*zl/2;return"M0,"+r+"L"+e+","+-r+" "+-e+","+-r+"Z"},"triangle-up":function(t){var e=Math.sqrt(t/zl),r=e*zl/2;return"M0,"+-r+"L"+e+","+r+" "+-e+","+r+"Z"}});uo.svg.symbolTypes=Il.keys();var zl=Math.sqrt(3),Dl=Math.tan(30*Ho);Co.transition=function(t){for(var e,r,n=jl||++Vl,i=to(t),a=[],o=Fl||{time:Date.now(),ease:Ln,delay:0,duration:250},s=-1,l=this.length;++srect,.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&&(C||(b=null,P[0]-=f[1],P[1]-=h[1],C=2),T())}function g(){32==uo.event.keyCode&&2==C&&(P[0]+=f[1],P[1]+=h[1],C=0,T())}function v(){var t=uo.mouse(_),n=!1;x&&(t[0]+=x[0],t[1]+=x[1]),C||(uo.event.altKey?(b||(b=[(f[0]+f[1])/2,(h[0]+h[1])/2]),P[0]=f[+(t[0]=2)return!1;t[r]=n}return!0}):w.filter(function(t){for(var e=0;e<=o;++e){var r=y[t[e]];if(r<0)return!1;t[e]=r}return!0}),1&o)for(var f=0;f>>31},e.exports.exponent=function(t){return(e.exports.hi(t)<<1>>>21)-1023},e.exports.fraction=function(t){var r=e.exports.lo(t),n=e.exports.hi(t),i=1048575&n;return 2146435072&n&&(i+=1<<20),[r,i]},e.exports.denormalized=function(t){return!(2146435072&e.exports.hi(t))}}).call(this,t("buffer").Buffer)},{buffer:45}],82:[function(t,e,r){"use strict";function n(t,e,r){var i=0|t[r];if(i<=0)return[];var a,o=new Array(i);if(r===t.length-1)for(a=0;a0)return i(0|t,e);break;case"object":if("number"==typeof t.length)return n(t,e,0)}return[]}e.exports=a},{}],83:[function(t,e,r){"use strict";function n(t,e){var r=t.length;if("number"!=typeof e){e=0;for(var n=0;n0&&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,a,s;if(!i(e))throw TypeError("listener must be a function");if(!this._events||!this._events[t])return this;if(r=this._events[t],a=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(o(r)){for(s=a;s-- >0;)if(r[s]===e||r[s].listener&&r[s].listener===e){n=s;break}if(n<0)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){return 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)}},{}],86:[function(t,e,r){"use strict";function n(t,e,r){var n=e||0,i=r||1;return[[t[12]+t[0],t[13]+t[1],t[14]+t[2],t[15]+t[3]],[t[12]-t[0],t[13]-t[1],t[14]-t[2],t[15]-t[3]],[t[12]+t[4],t[13]+t[5],t[14]+t[6],t[15]+t[7]],[t[12]-t[4],t[13]-t[5],t[14]-t[6],t[15]-t[7]],[n*t[12]+t[8],n*t[13]+t[9],n*t[14]+t[10],n*t[15]+t[11]],[i*t[12]-t[8],i*t[13]-t[9],i*t[14]-t[10],i*t[15]-t[11]]]}e.exports=n},{}],87:[function(t,e,r){"use strict";function n(t){for(var e,r=t.length,n=0;n13)&&32!==e&&133!==e&&160!==e&&5760!==e&&6158!==e&&(e<8192||e>8205)&&8232!==e&&8233!==e&&8239!==e&&8287!==e&&8288!==e&&12288!==e&&65279!==e)return!1;return!0}e.exports=function(t){var e=typeof t;if("string"===e){var r=t;if(0===(t=+t)&&n(r))return!1}else if("number"!==e)return!1;return t-t<1}},{}],88:[function(t,e,r){"use strict";function n(t,e,r){return Math.min(e,Math.max(t,r))}function i(t,e,r){this.dimension=t.length,this.bounds=[new Array(this.dimension),new Array(this.dimension)];for(var n=0;n=r-1)for(var h=o.length-1,p=t-e[r-1],d=0;d=r-1)for(var c=a.length-1,f=(e[r-1],0);f=0;--r)if(t[--e])return!1;return!0},u.jump=function(t){var e=this.lastT(),r=this.dimension;if(!(t0;--f)i.push(n(l[f-1],u[f-1],arguments[f])),a.push(0)}},u.push=function(t){var e=this.lastT(),r=this.dimension;if(!(t1e-6?1/s:0;this._time.push(t);for(var h=r;h>0;--h){var d=n(u[h-1],c[h-1],arguments[h]);i.push(d),a.push((d-i[o++])*f)}}},u.set=function(t){var e=this.dimension;if(!(t0;--l)r.push(n(o[l-1],s[l-1],arguments[l])),i.push(0)}},u.move=function(t){var e=this.lastT(),r=this.dimension;if(!(t<=e||arguments.length!==r+1)){var i=this._state,a=this._velocity,o=i.length-this.dimension,s=this.bounds,l=s[0],u=s[1],c=t-e,f=c>1e-6?1/c:0;this._time.push(t);for(var h=r;h>0;--h){var d=arguments[h];i.push(n(l[h-1],u[h-1],i[o++]+d)),a.push(d*f)}}},u.idle=function(t){var e=this.lastT();if(!(t=0;--f)i.push(n(l[f],u[f],i[o]+c*a[o])),a.push(0),o+=1}}},{"binary-search-bounds":34,"cubic-hermite":74}],89:[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||(e.right?l(t,e.right):void 0)}function u(t,e,r,n){if(e(t,n.key)<=0){if(n.left){var i=u(t,e,r,n.left);if(i)return i}var i=r(n.key,n.value);if(i)return i}if(n.right)return u(t,e,r,n.right)}function c(t,e,r,n,i){var a,o=r(t,i.key),s=r(e,i.key);if(o<=0){if(i.left&&(a=c(t,e,r,n,i.left)))return a;if(s>0&&(a=n(i.key,i.value)))return a}if(s>0&&i.right)return c(t,e,r,n,i.right)}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+1e?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=c<=0?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(t<0)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),a<=0&&(i=n.length),r=a<=0?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),a<0&&(i=n.length),r=a<0?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=a<=0?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=a<0?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=i<=0?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=n<=0?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)return this._stack[this._stack.length-1].key},enumerable:!0}),Object.defineProperty(b,"value",{get:function(){if(this._stack.length>0)return this._stack[this._stack.length-1].value},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}})},{}],90:[function(t,e,r){function n(t){if(t<0)return Number("0/0");for(var e=o[0],r=o.length-1;r>0;--r)e+=o[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=[.9999999999998099,676.5203681218851,-1259.1392167224028,771.3234287776531,-176.6150291621406,12.507343278686905,-.13857109526572012,9984369578019572e-21,1.5056327351493116e-7],a=607/128,o=[.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 t(e){if(e<.5)return Math.PI/(Math.sin(Math.PI*e)*t(1-e));if(e>100)return Math.exp(n(e));e-=1;for(var r=i[0],a=1;a<9;a++)r+=i[a]/(e+a);var o=e+7+.5;return Math.sqrt(2*Math.PI)*Math.pow(o,e+.5)*Math.exp(-o)*r},e.exports.log=n},{}],91:[function(t,e,r){function n(t,e){if("string"!=typeof t)throw new TypeError("must specify type string");if(e=e||{},"undefined"==typeof document&&!e.canvas)return null;var r=e.canvas||document.createElement("canvas");"number"==typeof e.width&&(r.width=e.width),"number"==typeof e.height&&(r.height=e.height);var n,i=e;try{var a=[t];0===t.indexOf("webgl")&&a.push("experimental-"+t);for(var o=0;o0?(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,a=t[n],o=this[n];(e?Array.isArray(a)&&Array.isArray(a[0]):Array.isArray(a))?this[n]=i=[r(a[0]),r(a[1]),r(a[2])]:this[n]=i=[r(a),r(a),r(a)];for(var s=0;s<3;++s)if(i[s]!==o[s])return!0}return!1}t=t||{};var r,n=e.bind(this,!1,Number),i=e.bind(this,!1,Boolean),a=e.bind(this,!1,String),o=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;d<2;++d)for(var p=0;p<3;++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;d<3;++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;d<3;++d)r[d].sort(function(t,e){return t.x-e.x});h.equal(r,this.ticks)?s=!1:this.ticks=r}i("tickEnable"),a("tickFont")&&(s=!0),n("tickSize"),n("tickAngle"),n("tickPad"),o("tickColor");var g=a("labels");a("labelFont")&&(g=!0),i("labelEnable"),n("labelSize"),n("labelPad"),o("labelColor"),i("lineEnable"),i("lineMirror"),n("lineWidth"),o("lineColor"),i("lineTickEnable"),i("lineTickMirror"),n("lineTickLength"),n("lineTickWidth"),o("lineTickColor"),i("gridEnable"),n("gridWidth"),o("gridColor"),i("zeroEnable"),o("zeroLineColor"),n("zeroLineWidth"),i("backgroundEnable"),o("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 a,new a,new a],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,a=t.projection||d,s=this.bounds,l=f(r,i,a,s),u=l.cubeEdges,c=l.axis,h=i[12],p=i[13],_=i[14],w=i[15],M=this.pixelRatio*(a[3]*h+a[7]*p+a[11]*_+a[15]*w)/e.drawingBufferHeight,A=0;A<3;++A)this.lastCubeProps.cubeEdges[A]=u[A],this.lastCubeProps.axis[A]=c[A];for(var k=g,A=0;A<3;++A)o(g[A],A,this.bounds,u,c);for(var e=this.gl,T=v,A=0;A<3;++A)this.backgroundEnable[A]?T[A]=c[A]:T[A]=0;this._background.draw(r,i,a,s,T,this.backgroundColor),this._lines.bind(r,i,a,this);for(var A=0;A<3;++A){var E=[0,0,0];c[A]>0?E[A]=s[1][A]:E[A]=s[0][A];for(var L=0;L<2;++L){var C=(A+1+L)%3,S=(A+1+(1^L))%3;this.gridEnable[C]&&this._lines.drawGrid(C,S,this.bounds,E,this.gridColor[C],this.gridWidth[C]*this.pixelRatio)}for(var L=0;L<2;++L){var C=(A+1+L)%3,S=(A+1+(1^L))%3;this.zeroEnable[S]&&s[0][S]<=0&&s[1][S]>=0&&this._lines.drawZero(C,S,this.bounds,E,this.zeroLineColor[S],this.zeroLineWidth[S]*this.pixelRatio)}}for(var A=0;A<3;++A){this.lineEnable[A]&&this._lines.drawAxisLine(A,this.bounds,k[A].primalOffset,this.lineColor[A],this.lineWidth[A]*this.pixelRatio),this.lineMirror[A]&&this._lines.drawAxisLine(A,this.bounds,k[A].mirrorOffset,this.lineColor[A],this.lineWidth[A]*this.pixelRatio);for(var P=n(y,k[A].primalMinor),R=n(b,k[A].mirrorMinor),O=this.lineTickLength,L=0;L<3;++L){var N=M/r[5*L];P[L]*=O[L]*N,R[L]*=O[L]*N}this.lineTickEnable[A]&&this._lines.drawAxisTicks(A,k[A].primalOffset,P,this.lineTickColor[A],this.lineTickWidth[A]*this.pixelRatio),this.lineTickMirror[A]&&this._lines.drawAxisTicks(A,k[A].mirrorOffset,R,this.lineTickColor[A],this.lineTickWidth[A]*this.pixelRatio)}this._text.bind(r,i,a,this.pixelRatio);for(var A=0;A<3;++A){for(var I=k[A].primalMinor,z=n(x,k[A].primalOffset),L=0;L<3;++L)this.lineTickEnable[A]&&(z[L]+=M*I[L]*Math.max(this.lineTickLength[L],0)/r[5*L]);if(this.tickEnable[A]){for(var L=0;L<3;++L)z[L]+=M*I[L]*this.tickPad[L]/r[5*L];this._text.drawTicks(A,this.tickSize[A],this.tickAngle[A],z,this.tickColor[A])}if(this.labelEnable[A]){for(var L=0;L<3;++L)z[L]+=M*I[L]*this.labelPad[L]/r[5*L];z[A]+=.5*(s[0][A]+s[1][A]),this._text.drawLabel(A,this.labelSize[A],this.labelAngle[A],z,this.labelColor[A])}}},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":93,"./lib/cube.js":94,"./lib/lines.js":95,"./lib/text.js":97,"./lib/ticks.js":98}],93:[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;l<3;++l)for(var u=(l+1)%3,c=(l+2)%3,f=[0,0,0],h=[0,0,0],d=-1;d<=1;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;p<=1;p+=2){f[u]=p;for(var g=-1;g<=1;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=a(t,new Float32Array(e)),y=a(t,new Uint16Array(r),t.ELEMENT_ARRAY_BUFFER),b=o(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 a=t("gl-buffer"),o=t("gl-vao"),s=t("./shaders").bg,l=n.prototype;l.draw=function(t,e,r,n,i,a){for(var o=!1,s=0;s<3;++s)o=o||i[s];if(o){var l=this.gl;l.enable(l.POLYGON_OFFSET_FILL),l.polygonOffset(1,2),this.shader.bind(),this.shader.uniforms={model:t,view:e,projection:r,bounds:n,enable:i,colors:a},this.vao.bind(),this.vao.draw(this.gl.TRIANGLES,36),l.disable(l.POLYGON_OFFSET_FILL)}},l.dispose=function(){this.vao.dispose(),this.buffer.dispose(),this.shader.dispose()}},{"./shaders":96,"gl-buffer":100,"gl-vao":155}],94:[function(t,e,r){"use strict";function n(t,e,r){for(var n=0;n<4;++n){t[n]=r[12+n];for(var i=0;i<3;++i)t[n]+=e[i]*r[4*i+n]}}function i(t){for(var e=0;eE&&(_|=1<E&&(_|=1<h[g][1]&&(I=g));for(var z=-1,g=0;g<3;++g){var D=I^1<h[j][0]&&(j=D)}}var F=v;F[0]=F[1]=F[2]=0,F[o.log2(z^I)]=I&z,F[o.log2(I^j)]=I&j;var B=7^j;B===_||B===N?(B=7^z,F[o.log2(j^B)]=B&j):F[o.log2(z^B)]=B&z;for(var U=m,V=_,A=0;A<3;++A)U[A]=V&1< 0.0) {\n vec3 nPosition = mix(bounds[0], bounds[1], 0.5 * (position + 1.0));\n gl_Position = projection * view * model * vec4(nPosition, 1.0);\n } else {\n gl_Position = vec4(0,0,0,0);\n }\n colorChannel = abs(normal);\n}","precision mediump float;\n#define GLSLIFY 1\n\nuniform vec4 colors[3];\n\nvarying vec3 colorChannel;\n\nvoid main() {\n gl_FragColor = colorChannel.x * colors[0] + \n colorChannel.y * colors[1] +\n colorChannel.z * colors[2];\n}",null,[{name:"position",type:"vec3"},{name:"normal",type:"vec3"}])}},{"gl-shader":140}],97:[function(t,e,r){(function(r){"use strict";function n(t,e,r,n){this.gl=t,this.shader=e,this.buffer=r,this.vao=n,this.tickOffset=this.tickCount=this.labelOffset=this.labelCount=null}function i(t,e){try{return l(t,e)}catch(t){return console.warn("error vectorizing text:",t),{cells:[],positions:[]}}}function a(t,e,r,i,a,l){var c=o(t),f=s(t,[{buffer:c,size:3}]),h=u(t);h.attributes.position.location=0;var d=new n(t,h,c,f);return d.update(e,r,i,a,l),d}e.exports=a;var o=t("gl-buffer"),s=t("gl-vao"),l=t("vectorize-text"),u=t("./shaders").text,c=window||r.global||{},f=c.__TEXT_CACHE||{};c.__TEXT_CACHE={};var h=n.prototype,d=[0,0];h.bind=function(t,e,r,n){this.vao.bind(),this.shader.bind();var i=this.shader.uniforms;i.model=t,i.view=e,i.projection=r,i.pixelScale=n,d[0]=this.gl.drawingBufferWidth,d[1]=this.gl.drawingBufferHeight,this.shader.uniforms.resolution=d},h.update=function(t,e,r,n,a){function o(t,e,r,n){var a=f[r];a||(a=f[r]={});var o=a[e];o||(o=a[e]=i(e,{triangles:!0,font:r,textAlign:"center",textBaseline:"middle"}));for(var l=(n||12)/12,u=o.positions,c=o.cells,h=0,d=c.length;h=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],h=[0,0,0],d=0;d<3;++d){c[d]=s.length/3|0,o(.5*(t[0][d]+t[1][d]),e[d],r),h[d]=(s.length/3|0)-c[d],l[d]=s.length/3|0;for(var p=0;p=0&&(i=r.length-n-1);var a=Math.pow(10,i),o=Math.round(t*e*a),s=o+"";if(s.indexOf("e")>=0)return s;var l=o/a,u=o%a;o<0?(l=0|-Math.ceil(l),u=0|-u):(l=0|Math.floor(l),u|=0);var c=""+l;if(o<0&&(c="-"+c),i){for(var f=""+u;f.length=t[0][i];--o)a.push({x:o*e[i],text:n(e[i],o)});r.push(a)}return r}function a(t,e){for(var r=0;r<3;++r){if(t[r].length!==e[r].length)return!1;for(var n=0;nr)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;i=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&&void 0!==t.shape){var r=t.dtype;if(f.indexOf(r)<0&&(r="float32"),this.type===this.gl.ELEMENT_ARRAY_BUFFER){r=gl.getExtension("OES_element_index_uint")&&"uint16"!==r?"uint32":"uint16"}if(r===t.dtype&&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 n=l.malloc(t.size,r),s=c(n,t.shape);u.assign(s,t), +this.length=e<0?i(this.gl,this.type,this.length,this.usage,n,e):i(this.gl,this.type,this.length,this.usage,n.subarray(0,t.size),e),l.free(n)}}else if(Array.isArray(t)){var h;h=this.type===this.gl.ELEMENT_ARRAY_BUFFER?a(t,"uint16"):a(t,"float32"),this.length=e<0?i(this.gl,this.type,this.length,this.usage,h,e):i(this.gl,this.type,this.length,this.usage,h.subarray(0,t.length),e),l.free(h)}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=1),this.gl.bufferData(this.type,0|t,this.usage),this.length=t}},e.exports=s},{ndarray:203,"ndarray-ops":197,"typedarray-pool":258}],101:[function(t,e,r){e.exports={0:"NONE",1:"ONE",2:"LINE_LOOP",3:"LINE_STRIP",4:"TRIANGLES",5:"TRIANGLE_STRIP",6:"TRIANGLE_FAN",256:"DEPTH_BUFFER_BIT",512:"NEVER",513:"LESS",514:"EQUAL",515:"LEQUAL",516:"GREATER",517:"NOTEQUAL",518:"GEQUAL",519:"ALWAYS",768:"SRC_COLOR",769:"ONE_MINUS_SRC_COLOR",770:"SRC_ALPHA",771:"ONE_MINUS_SRC_ALPHA",772:"DST_ALPHA",773:"ONE_MINUS_DST_ALPHA",774:"DST_COLOR",775:"ONE_MINUS_DST_COLOR",776:"SRC_ALPHA_SATURATE",1024:"STENCIL_BUFFER_BIT",1028:"FRONT",1029:"BACK",1032:"FRONT_AND_BACK",1280:"INVALID_ENUM",1281:"INVALID_VALUE",1282:"INVALID_OPERATION",1285:"OUT_OF_MEMORY",1286:"INVALID_FRAMEBUFFER_OPERATION",2304:"CW",2305:"CCW",2849:"LINE_WIDTH",2884:"CULL_FACE",2885:"CULL_FACE_MODE",2886:"FRONT_FACE",2928:"DEPTH_RANGE",2929:"DEPTH_TEST",2930:"DEPTH_WRITEMASK",2931:"DEPTH_CLEAR_VALUE",2932:"DEPTH_FUNC",2960:"STENCIL_TEST",2961:"STENCIL_CLEAR_VALUE",2962:"STENCIL_FUNC",2963:"STENCIL_VALUE_MASK",2964:"STENCIL_FAIL",2965:"STENCIL_PASS_DEPTH_FAIL",2966:"STENCIL_PASS_DEPTH_PASS",2967:"STENCIL_REF",2968:"STENCIL_WRITEMASK",2978:"VIEWPORT",3024:"DITHER",3042:"BLEND",3088:"SCISSOR_BOX",3089:"SCISSOR_TEST",3106:"COLOR_CLEAR_VALUE",3107:"COLOR_WRITEMASK",3317:"UNPACK_ALIGNMENT",3333:"PACK_ALIGNMENT",3379:"MAX_TEXTURE_SIZE",3386:"MAX_VIEWPORT_DIMS",3408:"SUBPIXEL_BITS",3410:"RED_BITS",3411:"GREEN_BITS",3412:"BLUE_BITS",3413:"ALPHA_BITS",3414:"DEPTH_BITS",3415:"STENCIL_BITS",3553:"TEXTURE_2D",4352:"DONT_CARE",4353:"FASTEST",4354:"NICEST",5120:"BYTE",5121:"UNSIGNED_BYTE",5122:"SHORT",5123:"UNSIGNED_SHORT",5124:"INT",5125:"UNSIGNED_INT",5126:"FLOAT",5386:"INVERT",5890:"TEXTURE",6401:"STENCIL_INDEX",6402:"DEPTH_COMPONENT",6406:"ALPHA",6407:"RGB",6408:"RGBA",6409:"LUMINANCE",6410:"LUMINANCE_ALPHA",7680:"KEEP",7681:"REPLACE",7682:"INCR",7683:"DECR",7936:"VENDOR",7937:"RENDERER",7938:"VERSION",9728:"NEAREST",9729:"LINEAR",9984:"NEAREST_MIPMAP_NEAREST",9985:"LINEAR_MIPMAP_NEAREST",9986:"NEAREST_MIPMAP_LINEAR",9987:"LINEAR_MIPMAP_LINEAR",10240:"TEXTURE_MAG_FILTER",10241:"TEXTURE_MIN_FILTER",10242:"TEXTURE_WRAP_S",10243:"TEXTURE_WRAP_T",10497:"REPEAT",10752:"POLYGON_OFFSET_UNITS",16384:"COLOR_BUFFER_BIT",32769:"CONSTANT_COLOR",32770:"ONE_MINUS_CONSTANT_COLOR",32771:"CONSTANT_ALPHA",32772:"ONE_MINUS_CONSTANT_ALPHA",32773:"BLEND_COLOR",32774:"FUNC_ADD",32777:"BLEND_EQUATION_RGB",32778:"FUNC_SUBTRACT",32779:"FUNC_REVERSE_SUBTRACT",32819:"UNSIGNED_SHORT_4_4_4_4",32820:"UNSIGNED_SHORT_5_5_5_1",32823:"POLYGON_OFFSET_FILL",32824:"POLYGON_OFFSET_FACTOR",32854:"RGBA4",32855:"RGB5_A1",32873:"TEXTURE_BINDING_2D",32926:"SAMPLE_ALPHA_TO_COVERAGE",32928:"SAMPLE_COVERAGE",32936:"SAMPLE_BUFFERS",32937:"SAMPLES",32938:"SAMPLE_COVERAGE_VALUE",32939:"SAMPLE_COVERAGE_INVERT",32968:"BLEND_DST_RGB",32969:"BLEND_SRC_RGB",32970:"BLEND_DST_ALPHA",32971:"BLEND_SRC_ALPHA",33071:"CLAMP_TO_EDGE",33170:"GENERATE_MIPMAP_HINT",33189:"DEPTH_COMPONENT16",33306:"DEPTH_STENCIL_ATTACHMENT",33635:"UNSIGNED_SHORT_5_6_5",33648:"MIRRORED_REPEAT",33901:"ALIASED_POINT_SIZE_RANGE",33902:"ALIASED_LINE_WIDTH_RANGE",33984:"TEXTURE0",33985:"TEXTURE1",33986:"TEXTURE2",33987:"TEXTURE3",33988:"TEXTURE4",33989:"TEXTURE5",33990:"TEXTURE6",33991:"TEXTURE7",33992:"TEXTURE8",33993:"TEXTURE9",33994:"TEXTURE10",33995:"TEXTURE11",33996:"TEXTURE12",33997:"TEXTURE13",33998:"TEXTURE14",33999:"TEXTURE15",34e3:"TEXTURE16",34001:"TEXTURE17",34002:"TEXTURE18",34003:"TEXTURE19",34004:"TEXTURE20",34005:"TEXTURE21",34006:"TEXTURE22",34007:"TEXTURE23",34008:"TEXTURE24",34009:"TEXTURE25",34010:"TEXTURE26",34011:"TEXTURE27",34012:"TEXTURE28",34013:"TEXTURE29",34014:"TEXTURE30",34015:"TEXTURE31",34016:"ACTIVE_TEXTURE",34024:"MAX_RENDERBUFFER_SIZE",34041:"DEPTH_STENCIL",34055:"INCR_WRAP",34056:"DECR_WRAP",34067:"TEXTURE_CUBE_MAP",34068:"TEXTURE_BINDING_CUBE_MAP",34069:"TEXTURE_CUBE_MAP_POSITIVE_X",34070:"TEXTURE_CUBE_MAP_NEGATIVE_X",34071:"TEXTURE_CUBE_MAP_POSITIVE_Y",34072:"TEXTURE_CUBE_MAP_NEGATIVE_Y",34073:"TEXTURE_CUBE_MAP_POSITIVE_Z",34074:"TEXTURE_CUBE_MAP_NEGATIVE_Z",34076:"MAX_CUBE_MAP_TEXTURE_SIZE",34338:"VERTEX_ATTRIB_ARRAY_ENABLED",34339:"VERTEX_ATTRIB_ARRAY_SIZE",34340:"VERTEX_ATTRIB_ARRAY_STRIDE",34341:"VERTEX_ATTRIB_ARRAY_TYPE",34342:"CURRENT_VERTEX_ATTRIB",34373:"VERTEX_ATTRIB_ARRAY_POINTER",34466:"NUM_COMPRESSED_TEXTURE_FORMATS",34467:"COMPRESSED_TEXTURE_FORMATS",34660:"BUFFER_SIZE",34661:"BUFFER_USAGE",34816:"STENCIL_BACK_FUNC",34817:"STENCIL_BACK_FAIL",34818:"STENCIL_BACK_PASS_DEPTH_FAIL",34819:"STENCIL_BACK_PASS_DEPTH_PASS",34877:"BLEND_EQUATION_ALPHA",34921:"MAX_VERTEX_ATTRIBS",34922:"VERTEX_ATTRIB_ARRAY_NORMALIZED",34930:"MAX_TEXTURE_IMAGE_UNITS",34962:"ARRAY_BUFFER",34963:"ELEMENT_ARRAY_BUFFER",34964:"ARRAY_BUFFER_BINDING",34965:"ELEMENT_ARRAY_BUFFER_BINDING",34975:"VERTEX_ATTRIB_ARRAY_BUFFER_BINDING",35040:"STREAM_DRAW",35044:"STATIC_DRAW",35048:"DYNAMIC_DRAW",35632:"FRAGMENT_SHADER",35633:"VERTEX_SHADER",35660:"MAX_VERTEX_TEXTURE_IMAGE_UNITS",35661:"MAX_COMBINED_TEXTURE_IMAGE_UNITS",35663:"SHADER_TYPE",35664:"FLOAT_VEC2",35665:"FLOAT_VEC3",35666:"FLOAT_VEC4",35667:"INT_VEC2",35668:"INT_VEC3",35669:"INT_VEC4",35670:"BOOL",35671:"BOOL_VEC2",35672:"BOOL_VEC3",35673:"BOOL_VEC4",35674:"FLOAT_MAT2",35675:"FLOAT_MAT3",35676:"FLOAT_MAT4",35678:"SAMPLER_2D",35680:"SAMPLER_CUBE",35712:"DELETE_STATUS",35713:"COMPILE_STATUS",35714:"LINK_STATUS",35715:"VALIDATE_STATUS",35716:"INFO_LOG_LENGTH",35717:"ATTACHED_SHADERS",35718:"ACTIVE_UNIFORMS",35719:"ACTIVE_UNIFORM_MAX_LENGTH",35720:"SHADER_SOURCE_LENGTH",35721:"ACTIVE_ATTRIBUTES",35722:"ACTIVE_ATTRIBUTE_MAX_LENGTH",35724:"SHADING_LANGUAGE_VERSION",35725:"CURRENT_PROGRAM",36003:"STENCIL_BACK_REF",36004:"STENCIL_BACK_VALUE_MASK",36005:"STENCIL_BACK_WRITEMASK",36006:"FRAMEBUFFER_BINDING",36007:"RENDERBUFFER_BINDING",36048:"FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE",36049:"FRAMEBUFFER_ATTACHMENT_OBJECT_NAME",36050:"FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL",36051:"FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE",36053:"FRAMEBUFFER_COMPLETE",36054:"FRAMEBUFFER_INCOMPLETE_ATTACHMENT",36055:"FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT",36057:"FRAMEBUFFER_INCOMPLETE_DIMENSIONS",36061:"FRAMEBUFFER_UNSUPPORTED",36064:"COLOR_ATTACHMENT0",36096:"DEPTH_ATTACHMENT",36128:"STENCIL_ATTACHMENT",36160:"FRAMEBUFFER",36161:"RENDERBUFFER",36162:"RENDERBUFFER_WIDTH",36163:"RENDERBUFFER_HEIGHT",36164:"RENDERBUFFER_INTERNAL_FORMAT",36168:"STENCIL_INDEX8",36176:"RENDERBUFFER_RED_SIZE",36177:"RENDERBUFFER_GREEN_SIZE",36178:"RENDERBUFFER_BLUE_SIZE",36179:"RENDERBUFFER_ALPHA_SIZE",36180:"RENDERBUFFER_DEPTH_SIZE",36181:"RENDERBUFFER_STENCIL_SIZE",36194:"RGB565",36336:"LOW_FLOAT",36337:"MEDIUM_FLOAT",36338:"HIGH_FLOAT",36339:"LOW_INT",36340:"MEDIUM_INT",36341:"HIGH_INT",36346:"SHADER_COMPILER",36347:"MAX_VERTEX_UNIFORM_VECTORS",36348:"MAX_VARYING_VECTORS",36349:"MAX_FRAGMENT_UNIFORM_VECTORS",37440:"UNPACK_FLIP_Y_WEBGL",37441:"UNPACK_PREMULTIPLY_ALPHA_WEBGL",37442:"CONTEXT_LOST_WEBGL",37443:"UNPACK_COLORSPACE_CONVERSION_WEBGL",37444:"BROWSER_DEFAULT_WEBGL"}},{}],102:[function(t,e,r){var n=t("./1.0/numbers");e.exports=function(t){return n[t]}},{"./1.0/numbers":101}],103:[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;r<3;++r)t[0][r]=Math.min(t[0][r],e[r]),t[1][r]=Math.max(t[1][r],e[r])}function a(t,e,r,n){for(var i=h[n],a=0;a=1},f.isTransparent=function(){return this.opacity<1},f.drawTransparent=f.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 a=n[12],o=n[13],s=n[14],l=n[15],u=this.pixelRatio*(i[3]*a+i[7]*o+i[11]*s+i[15]*l)/e.drawingBufferHeight;this.vao.bind();for(var f=0;f<3;++f)e.lineWidth(this.lineWidth[f]),r.capSize=this.capSize[f]*u,this.lineCount[f]&&e.drawArrays(e.LINES,this.lineOffset[f],this.lineCount[f]);this.vao.unbind()};var h=function(){for(var t=new Array(3),e=0;e<3;++e){for(var r=[],n=1;n<=2;++n)for(var i=-1;i<=1;i+=2){var a=(n+e)%3,o=[0,0,0];o[a]=i,r.push(o)}t[e]=r}return t}();f.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 o=[],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;u<3;++u){this.lineOffset[u]=l;t:for(var c=0;c0){var g=f.slice();g[u]+=d[1][u],o.push(f[0],f[1],f[2],p[0],p[1],p[2],p[3],0,0,0,g[0],g[1],g[2],p[0],p[1],p[2],p[3],0,0,0),i(this.bounds,g),l+=2+a(o,g,p,u)}}}this.lineCount[u]=l-this.lineOffset[u]}this.buffer.update(o)}},f.dispose=function(){this.shader.dispose(),this.buffer.dispose(),this.vao.dispose()}},{"./shaders/index":105,"gl-buffer":100,"gl-vao":155}],104:[function(t,e,r){e.exports=function(t){"string"==typeof t&&(t=[t]);for(var e=[].slice.call(arguments,1),r=[],n=0;n1&&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;vs||r<0||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;uo||r<0||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)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,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,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;e 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}",null,a)}},{"gl-shader":140}],109:[function(t,e,r){"use strict";function n(t,e){for(var r=0,n=0;n<3;++n){var i=t[n]-e[n];r+=i*i}return Math.sqrt(r)}function i(t){for(var e=[[-1e6,-1e6,-1e6],[1e6,1e6,1e6]],r=0;r<3;++r)e[0][r]=Math.max(t[0][r],e[0][r]),e[1][r]=Math.min(t[1][r],e[1][r]);return e}function a(t,e,r,n){this.arcLength=t,this.position=e,this.index=r,this.dataCoordinate=n}function o(t,e,r,n,i,a){this.gl=t,this.shader=e,this.pickShader=r,this.buffer=n,this.vao=i,this.clipBounds=[[-1/0,-1/0,-1/0],[1/0,1/0,1/0]],this.points=[],this.arcLength=[],this.vertexCount=0,this.bounds=[[0,0,0],[0,0,0]],this.pickId=0,this.lineWidth=1,this.texture=a,this.dashScale=1,this.opacity=1,this.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),a=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;f<1024;++f)s.data[f]=255;var h=c(e,s);h.wrap=e.REPEAT;var p=new o(e,r,n,i,a,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=o.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 a=t.position||t.positions;if(a){var o=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;e0){for(var b=0;b<24;++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(o[0])?(x=o[e-1],_=o[e]):x=_=o,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=f;if(f+=n(m,y),v){for(r=0;r<2;++r)l.push(m[0],m[1],m[2],y[0],y[1],y[2],M,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],M,w,x[0],x[1],x[2],x[3],m[0],m[1],m[2],y[0],y[1],y[2],M,-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(a[a.length-1].slice()),this.bounds=g,this.vertexCount=p,this.points=c,this.arcLength=u,"dashes"in t){var A=t.dashes,k=A.slice();for(k.unshift(0),e=1;e1.0001)return null;v+=g[c]}return Math.abs(v-1)>.001?null:[f,o(t,g),g]}var l=t("barycentric"),u=t("polytope-closest-point/lib/closest_point_2d.js");e.exports=s},{barycentric:17,"polytope-closest-point/lib/closest_point_2d.js":216}],131:[function(t,e,r){var n="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}";r.meshShader={vertex:"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}",fragment:"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}",attributes:[{name:"position",type:"vec3"},{name:"normal",type:"vec3"},{name:"color",type:"vec4"},{name:"uv",type:"vec2"}]},r.wireShader={vertex:"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}",fragment:"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}",attributes:[{name:"position",type:"vec3"},{name:"color",type:"vec4"},{name:"uv",type:"vec2"}]},r.pointShader={vertex:"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}",fragment:"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}",attributes:[{name:"position",type:"vec3"},{name:"color",type:"vec4"},{name:"uv",type:"vec2"},{name:"pointSize",type:"float"}]},r.pickShader={vertex:"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}",fragment:n,attributes:[{name:"position",type:"vec3"},{name:"id",type:"vec4"}]},r.pointPickShader={vertex:"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}",fragment:n,attributes:[{name:"position",type:"vec3"},{name:"pointSize",type:"float"},{name:"id",type:"vec4"}]},r.contourShader={vertex:"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}",fragment:"precision mediump float;\n#define GLSLIFY 1\n\nuniform vec3 contourColor;\n\nvoid main() {\n gl_FragColor = vec4(contourColor,1);\n}\n",attributes:[{name:"position",type:"vec3"}]}},{}],132:[function(t,e,r){"use strict";function n(t,e,r,n,i,a,o,s,l,u,c,f,h,d,p,g,v,m,y,b,x,_,w,M,A,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=a,this.pointPickShader=o,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=M,this.pointIds=x,this.pointVAO=A,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=O,this._view=O,this._projection=O,this._resolution=[1,1]}function i(t){for(var e=w({colormap:t,nshades:256,format:"rgba"}),r=new Uint8Array(1024),n=0;n<256;++n){for(var i=e[n],a=0;a<3;++a)r[4*n+a]=i[a];r[4*n+3]=255*i[3]}return _(r,[256,256,4],[4,0,1])}function a(t,e,r){for(var n=new Array(e),i=0;i=1},N.isTransparent=function(){return this.opacity<1},N.pickSlots=1,N.setPickBase=function(t){this.pickId=t},N.highlight=function(t){if(!t||!this.contourEnable)return void(this.contourCount=0);for(var e=M(this.cells,this.intensity,t.intensity),r=e.cells,n=e.vertexIds,i=e.vertexWeights,a=r.length,o=A.mallocFloat32(6*a),s=0,l=0;l0){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()}},N.drawPick=function(t){t=t||{};for(var e=this.gl,r=t.model||O,n=t.view||O,i=t.projection||O,a=[[-1e6,-1e6,-1e6],[1e6,1e6,1e6]],o=0;o<3;++o)a[0][o]=Math.max(a[0][o],this.clipBounds[0][o]),a[1][o]=Math.min(a[1][o],this.clipBounds[1][o]);this._model=[].slice.call(r),this._view=[].slice.call(n),this._projection=[].slice.call(i),this._resolution=[e.drawingBufferWidth,e.drawingBufferHeight];var s={model:r,view:n,projection:i,clipBounds:a,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()}},N.pick=function(t){if(!t)return null;if(t.id!==this.pickId)return null;for(var e=t.value[0]+256*t.value[1]+65536*t.value[2],r=this.cells[e],n=this.positions,i=new Array(r.length),a=0;a0){var r=Math.round(Math.pow(10,e));return Math.ceil(t/r)*r}return Math.ceil(t)}function o(t){return"boolean"!=typeof t||t}function s(t){function e(){if(!w&&G.autoResize){var t=M.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!==M.width||i!==M.height){M.width=n,M.height=i;var a=M.style;a.position=a.position||"absolute",a.left="0px",a.top="0px",a.width=e+"px",a.height=r+"px",F=!0}}}function r(){for(var t=I.length,e=j.length,r=0;r0&&0===D[e-1];)D.pop(),j.pop().dispose()}function s(){if(G.contextLost)return!0;k.isContextLost()&&(G.contextLost=!0,G.mouseListener.enabled=!1,G.selection.object=null,G.oncontextloss&&G.oncontextloss())}function b(){if(!s()){k.colorMask(!0,!0,!0,!0),k.depthMask(!0),k.disable(k.BLEND),k.enable(k.DEPTH_TEST);for(var t=I.length,e=j.length,r=0;rE.distance)continue;for(var u=0;u1e-6?(i=Math.acos(a),o=Math.sin(i),s=Math.sin((1-n)*i)/o,l=Math.sin(n*i)/o):(s=1-n,l=n),t[0]=s*u+l*d,t[1]=s*c+l*p,t[2]=s*f+l*g,t[3]=s*h+l*v,t}e.exports=n},{}],136:[function(t,e,r){"use strict";function n(t,e){var r=a[e];if(r||(r=a[e]={}),t in r)return r[t];for(var n=i(t,{textAlign:"center",textBaseline:"middle",lineHeight:1,font:e}),o=i(t,{triangles:!0,textAlign:"center",textBaseline:"middle",lineHeight:1,font:e}),s=[[1/0,1/0],[-1/0,-1/0]],l=0;lMath.abs(z[1])){var D=I;I=z,z=D,D=O,O=N,N=D;var j=P;P=R,R=j}I[0]<0&&(O[P]=-1),z[1]>0&&(N[R]=-1);for(var F=0,B=0,S=0;S<4;++S)F+=Math.pow(p[4*P+S],2),B+=Math.pow(p[4*R+S],2);O[P]/=Math.sqrt(F),N[R]/=Math.sqrt(B),d.axes[0]=O,d.axes[1]=N,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,a){var o=r.gl;if(r.vao.bind(),i===r.opacity<1||a){t.bind();var s=t.uniforms;s.model=n.model||x,s.view=n.view||x,s.projection=n.projection||x,w[0]=2/o.drawingBufferWidth,w[1]=2/o.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(o.TRIANGLES,r.vertexCount),r.lineWidth>0&&(o.lineWidth(r.lineWidth),r.vao.draw(o.LINES,r.lineVertexCount,r.vertexCount))}f(e,r,n,i,a),r.vao.unbind()}function d(t){var e=t.gl,r=y.createPerspective(e),n=y.createOrtho(e),i=y.createProject(e),a=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 o(e,r,n,i,u,c,f,h,d,a,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 _=o.prototype;_.pickSlots=1,_.setPickBase=function(t){this.pickId=t},_.isTransparent=function(){if(this.opacity<1)return!0;for(var t=0;t<3;++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;t<3;++t)if(this.axesProject[t]&&this.projectOpacity[t]>=1)return!0;return!1};var w=[0,0],M=[0,0,0],A=[0,0,0],k=[0,0,0,1],T=[0,0,0,1],E=x.slice(),L=[0,0,0],C=[[0,0,0],[0,0,0]],S=[-1e8,-1e8,-1e8],P=[1e8,1e8,1e8],R=[S,P];_.draw=function(t){h(this.useOrtho?this.orthoShader:this.shader,this.projectShader,this,t,!1,!1)},_.drawTransparent=function(t){h(this.useOrtho?this.orthoShader:this.shader,this.projectShader,this,t,!0,!1)},_.drawPick=function(t){h(this.useOrtho?this.pickOrthoShader:this.pickPerspectiveShader,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||e<0)return null;var r=this.points[e],n=this._selectResult;n.index=e;for(var i=0;i<3;++i)n.position[i]=n.dataCoordinate[i]=r[i];return n},_.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",a=t.alignment||[0,0],o=[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;y0&&(P[0]=-a[0]*(1+k[0][0]));for(var H=M.cells,q=M.positions,_=0;_this.buffer.length){s.free(this.buffer);for(var n=this.buffer=s.mallocUint8(u(r*e*4)),i=0;i=0){for(var A=0|M.type.charAt(M.type.length-1),k=new Array(A),T=0;T=0;)E+=1;_[w]=E}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":141,"./lib/create-attributes":142,"./lib/create-uniforms":143,"./lib/reflect":144,"./lib/runtime-reflect":145,"./lib/shader-cache":146}],141:[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},{}],142:[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;c=0){var p=h.charCodeAt(h.length-1)-48;if(p<2||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(p<2||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":141}],143:[function(t,e,r){"use strict";function n(t){return new Function("y","return function(){return y}")(t)}function i(t,e){for(var r=new Array(t),n=0;n4)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(i<2||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;parseInt(n)+""===n?a+="["+n+"]":a+="."+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;o4)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(r<2||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;u1)for(var l=0;l0)][r],M(l,t.model,l);var u=F.clipBounds[r];for(i=0;i<2;++i)for(n=0;n<3;++n)u[i][n]=t.clipBounds[i][n];u[0][r]=-1e8,u[1][r]=1e8}return F.showSurface=o,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||O,n.view=t.view||O,n.projection=t.projection||O,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=A(n.inverseModel,n.model);for(var i=0;i<2;++i)for(var a=n.clipBounds[i],s=0;s<3;++s)a[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,n.vertexColor=this.vertexColor;var l=U;for(M(l,n.view,n.model),M(l,n.projection,l),A(l,l),i=0;i<3;++i)n.eyePosition[i]=l[12+i]/l[15];var u=l[15];for(i=0;i<3;++i)u+=this.lightPosition[i]*l[4*i+3];for(i=0;i<3;++i){var c=l[12+i];for(s=0;s<3;++s)c+=l[4*s+i]*this.lightPosition[s];n.lightPosition[i]=c/u}var f=o(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;i<3;++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;i<3;++i)for(h.uniforms.permutation=I[i],r.lineWidth(this.contourWidth[i]),s=0;s=1)return!0;for(var t=0;t<3;++t)if(this._contourCounts[t].length>0||this._dynamicCounts[t]>0)return!0;return!1},D.pickSlots=1,D.setPickBase=function(t){this.pickId=t};var j=[0,0,0],F={showSurface:!1,showContour:!1,projections:[O.slice(),O.slice(),O.slice()],clipBounds:[[[0,0,0],[0,0,0]],[[0,0,0],[0,0,0]],[[0,0,0],[0,0,0]]]},B={model:O,view:O,projection:O,inverseModel:O.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,vertexColor:0},U=O.slice(),V=[1,0,0,0,1,0,0,0,1];D.draw=function(t){return s.call(this,t,!1)},D.drawTransparent=function(t){return s.call(this,t,!0)};var H={model:O,view:O,projection:O,inverseModel:O,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]};D.drawPick=function(t){t=t||{};var e=this.gl;e.disable(e.CULL_FACE);var r=H;r.model=t.model||O,r.view=t.view||O,r.projection=t.projection||O,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;n<2;++n)for(var i=r.clipBounds[n],a=0;a<3;++a)i[a]=Math.min(Math.max(this.clipBounds[n][a],-1e8),1e8);var s=o(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;n<3;++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(),a=0;a<3;++a)for(e.lineWidth(this.contourWidth[a]),l.uniforms.permutation=I[a],n=0;n>4)/16)/255,i=Math.floor(n),a=n-i,o=e[1]*(t.value[1]+(15&t.value[2])/16)/255,s=Math.floor(o),l=o-s;i+=1,s+=1;var u=r.position;u[0]=u[1]=u[2]=0;for(var c=0;c<2;++c)for(var f=c?a:1-a,h=0;h<2;++h)for(var d=h?l:1-l,p=i+c,g=s+h,v=f*d,m=0;m<3;++m)u[m]+=this._field[m].get(p,g)*v;for(var y=this._pickResult.level,b=0;b<3;++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]=a<.5?i:i+1,r.index[1]=l<.5?s:s+1,r.uv[0]=n/e[0],r.uv[1]=o/e[1],m=0;m<3;++m)r.dataCoordinate[m]=this._field[m].get(r.index[0],r.index[1]);return r},D.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),"vertexColor"in t&&(this.vertexColor=t.vertexColor?1:0);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 a=this.shape,o=0;o<2;++o)this._field[2].size>this._field[o].data.length&&(m.freeFloat(this._field[o].data),this._field[o].data=m.mallocFloat(this._field[2].size)),this._field[o]=_(this._field[o].data,[a[0]+2,a[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(o=0;o<2;++o){var c=s[o];for(y=0;y<2;++y)if(c.shape[y]!==a[y])throw new Error("gl-surface: coords have incorrect shape");l(this._field[o],c)}}else if(t.ticks){var h=t.ticks;if(!Array.isArray(h)||2!==h.length)throw new Error("gl-surface: invalid ticks");for(o=0;o<2;++o){var p=h[o];if((Array.isArray(p)||p.length)&&(p=_(p)),p.shape[0]!==a[o])throw new Error("gl-surface: invalid tick length");var g=_(p.data,a);g.stride[o]=p.stride[0],g.stride[1^o]=0,l(this._field[o],g)}}else{for(o=0;o<2;++o){var v=[0,0];v[o]=1,this._field[o]=_(this._field[o].data,[a[0]+2,a[1]+2],v,0)}this._field[0].set(0,0,0);for(var y=0;y0){for(var xt=0;xt<5;++xt)tt.pop();H-=1}continue t}tt.push(it[0],it[1],st[0],st[1],it[2]),H+=1}}nt.push(H)}this._contourOffsets[et]=rt,this._contourCounts[et]=nt}var _t=m.mallocFloat(tt.length);for(o=0;oi||r<0||r>i)throw new Error("gl-texture2d: Invalid texture size");return t._shape=[e,r],t.bind(),n.texImage2D(n.TEXTURE_2D,0,t.format,e,r,0,t.format,t.type,null),t._mipLevels=[0],t}function o(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 s(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 l(t,e,r,n,i,a,o,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,d=s(c,l.stride.slice());"float32"===u?f=t.FLOAT:"float64"===u?(f=t.FLOAT,d=!1,u="float32"):"uint8"===u?f=t.UNSIGNED_BYTE:(f=t.UNSIGNED_BYTE,d=!1,u="uint8");if(2===c.length)h=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])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}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 m=l.size,y=o.indexOf(n)<0;if(y&&o.push(n),f===a&&d)0===l.offset&&l.data.length===m?y?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):y?t.texImage2D(t.TEXTURE_2D,n,i,c[0],c[1],0,i,a,l.data.subarray(l.offset,l.offset+m)):t.texSubImage2D(t.TEXTURE_2D,n,e,r,c[0],c[1],i,a,l.data.subarray(l.offset,l.offset+m));else{var b;b=a===t.FLOAT?v.mallocFloat32(m):v.mallocUint8(m);var _=p(b,c,[c[2],c[2]*c[0],1]);f===t.FLOAT&&a===t.UNSIGNED_BYTE?x(_,l):g.assign(_,l),y?t.texImage2D(t.TEXTURE_2D,n,i,c[0],c[1],0,i,a,b.subarray(0,m)):t.texSubImage2D(t.TEXTURE_2D,n,e,r,c[0],c[1],i,a,b.subarray(0,m)),a===t.FLOAT?v.freeFloat32(b):v.freeUint8(b)}}function u(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 c(t,e,r,n,i){var a=t.getParameter(t.MAX_TEXTURE_SIZE);if(e<0||e>a||r<0||r>a)throw new Error("gl-texture2d: Invalid texture shape");if(i===t.FLOAT&&!t.getExtension("OES_texture_float"))throw new Error("gl-texture2d: Floating point textures not supported on this platform");var s=u(t);return t.texImage2D(t.TEXTURE_2D,0,n,e,r,0,n,i,null),new o(t,s,e,r,n,i)}function f(t,e,r,n,i,a){var s=u(t);return t.texImage2D(t.TEXTURE_2D,0,i,i,a,e),new o(t,s,r,n,i,a)}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 a=s(n,e.stride.slice()),l=0;"float32"===r?l=t.FLOAT:"float64"===r?(l=t.FLOAT,a=!1,r="float32"):"uint8"===r?l=t.UNSIGNED_BYTE:(l=t.UNSIGNED_BYTE,a=!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}}l!==t.FLOAT||t.getExtension("OES_texture_float")||(l=t.UNSIGNED_BYTE,a=!1);var f,h,d=e.size;if(a)f=0===e.offset&&e.data.length===d?e.data:e.data.subarray(e.offset,e.offset+d);else{var m=[n[2],n[2]*n[0],1];h=v.malloc(d,r);var y=p(h,n,m,0);"float32"!==r&&"float64"!==r||l!==t.UNSIGNED_BYTE?g.assign(y,e):x(y,e),f=h.subarray(0,d)}var b=u(t);return t.texImage2D(t.TEXTURE_2D,0,c,n[0],n[1],0,c,l,f),a||v.free(h),new o(t,b,n[0],n[1],c,l)}function d(t){if(arguments.length<=1)throw new Error("gl-texture2d: Missing arguments for texture2d constructor");if(m||n(t),"number"==typeof arguments[1])return c(t,arguments[1],arguments[2],arguments[3]||t.RGBA,arguments[4]||t.UNSIGNED_BYTE);if(Array.isArray(arguments[1]))return c(t,0|arguments[1][0],0|arguments[1][1],arguments[2]||t.RGBA,arguments[3]||t.UNSIGNED_BYTE);if("object"==typeof arguments[1]){var e=arguments[1],r=i(e)?e:e.raw;if(r)return f(t,r,0|e.width,0|e.height,arguments[2]||t.RGBA,arguments[3]||t.UNSIGNED_BYTE);if(e.shape&&e.data&&e.stride)return h(t,e)}throw new Error("gl-texture2d: Invalid arguments for texture2d constructor")}var p=t("ndarray"),g=t("ndarray-ops"),v=t("typedarray-pool");e.exports=d;var m=null,y=null,b=null,x=function(t,e){g.muls(t,e,255)},_=o.prototype;Object.defineProperties(_,{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)),y.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)),y.indexOf(t)<0)throw new Error("gl-texture2d: Unknown filter mode "+t);return e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,t),this._magFilter=t}},mipSamples:{get:function(){return this._anisoSamples},set:function(t){var e=this._anisoSamples;if(this._anisoSamples=0|Math.max(t,1),e!==this._anisoSamples){var r=this.gl.getExtension("EXT_texture_filter_anisotropic");r&&this.gl.texParameterf(this.gl.TEXTURE_2D,r.TEXTURE_MAX_ANISOTROPY_EXT,this._anisoSamples)}return this._anisoSamples}},wrapS:{get:function(){return this._wrapS},set:function(t){if(this.bind(),b.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(),b.indexOf(t)<0)throw new Error("gl-texture2d: Unknown wrap mode "+t);return this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,t),this._wrapT=t}},wrap:{get:function(){return this._wrapVector},set:function(t){if(Array.isArray(t)||(t=[t,t]),2!==t.length)throw new Error("gl-texture2d: Must specify wrap mode for rows and columns");for(var e=0;e<2;++e)if(b.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 a(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,a(this,t,this._shape[1]),t}},height:{get:function(){return this._shape[1]},set:function(t){return t|=0,a(this,this._shape[0],t),t}}}),_.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},_.dispose=function(){this.gl.deleteTexture(this.handle)},_.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)},_.setPixels=function(t,e,r,n){var a=this.gl;this.bind(),Array.isArray(e)?(n=r,r=0|e[1],e=0|e[0]):(e=e||0,r=r||0),n=n||0;var o=i(t)?t:t.raw;if(o){this._mipLevels.indexOf(n)<0?(a.texImage2D(a.TEXTURE_2D,0,this.format,this.format,this.type,o),this._mipLevels.push(n)):a.texSubImage2D(a.TEXTURE_2D,n,e,r,this.format,this.type,o)}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||e<0||r<0)throw new Error("gl-texture2d: Texture dimensions are out of bounds");l(a,e,r,n,this.format,this.type,this._mipLevels,t)}}},{ndarray:203,"ndarray-ops":197,"typedarray-pool":258}],152:[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;i0&&(a=1/Math.sqrt(a),t[0]=e[0]*a,t[1]=e[1]*a,t[2]=e[2]*a),t}e.exports=n},{}],161:[function(t,e,r){function n(t,e,r){var n=e[0],i=e[1],a=e[2],o=e[3];return t[0]=r[0]*n+r[4]*i+r[8]*a+r[12]*o,t[1]=r[1]*n+r[5]*i+r[9]*a+r[13]*o,t[2]=r[2]*n+r[6]*i+r[10]*a+r[14]*o,t[3]=r[3]*n+r[7]*i+r[11]*a+r[15]*o,t}e.exports=n},{}],162:[function(t,e,r){function n(t,e,r,n){return i[0]=n,i[1]=r,i[2]=e,i[3]=t,a[0]}e.exports=n;var i=new Uint8Array(4),a=new Float32Array(i.buffer)},{}],163:[function(t,e,r){function n(t){for(var e=Array.isArray(t)?t:i(t),r=0;r0)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,j):(U.push(I),z=I,j+1)}function R(){return"."===I?(U.push(I),B=v,z=I,j+1):/[eE]/.test(I)?(U.push(I),B=v,z=I,j+1):"x"===I&&1===U.length&&"0"===U[0]?(B=w,U.push(I),z=I,j+1):/[^\d]/.test(I)?(e(U.join("")),B=u,j):(U.push(I),z=I,j+1)}function O(){return"f"===I&&(U.push(I),z=I,j+=1),/[eE]/.test(I)?(U.push(I),z=I,j+1):"-"===I&&/[eE]/.test(z)?(U.push(I),z=I,j+1):/[^\d]/.test(I)?(e(U.join("")),B=u,j):(U.push(I),z=I,j+1)}function N(){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,j}return U.push(I),z=I,j+1}var I,z,D,j=0,F=0,B=u,U=[],V=[],H=1,q=0,G=0,X=!1,W=!1,Y="";t=t||{};var Z=o,Q=i;return"300 es"===t.version&&(Z=l,Q=s),function(t){return V=[],null!==t?r(t.replace?t.replace(/\r\n/g,"\n"):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,M=["block-comment","line-comment","preprocessor","operator","integer","float","ident","builtin","keyword","whitespace","eof","integer"]},{"./lib/builtins":166,"./lib/builtins-300es":165,"./lib/literals":168,"./lib/literals-300es":167,"./lib/operators":169}],165:[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":166}],166:[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"]},{}],167:[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":168}],168:[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"]},{}],169:[function(t,e,r){e.exports=["<<=",">>=","++","--","<<",">>","<=",">=","==","!=","&&","||","+=","-=","*=","/=","%=","&=","^^","^=","|=","(",")","[","]",".","!","~","*","/","%","+","-","<",">","&","^","|","?",":","=",",",";","{","}"]},{}],170:[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":164}],171:[function(t,e,r){(function(r){"use strict";var n,i=t("is-browser");n="function"==typeof r.matchMedia?!r.matchMedia("(hover: none)").matches:i,e.exports=n}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"is-browser":177}],172:[function(t,e,r){r.read=function(t,e,r,n,i){var a,o,s=8*i-n-1,l=(1<>1,c=-7,f=r?i-1:0,h=r?-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+=n;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:1/0*(d?-1:1);o+=Math.pow(2,n),a-=u}return(d?-1:1)*o*Math.pow(2,a-n)},r.write=function(t,e,r,n,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=n?0:a-1,p=n?1:-1,g=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,o=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[r+d]=255&s,d+=p,s/=256,i-=8);for(o=o<0;t[r+d]=255&o,d+=p,o/=256,u-=8);t[r+d-p]|=128*g}},{}],173:[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 a(t,e){return c(t.vertices,e.vertices)}function o(t){for(var e=["function orient(){var tuple=this.tuple;return test("],r=0;r<=t;++r)r>0&&e.push(","),e.push("tuple[",r,"]");e.push(")}return orient");var 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;n<=t;++n)this.tuple[n]=this.vertices[n];var i=f[t];i||(i=f[t]=o(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(r<=i)throw new Error("Must input at least d+1 points");var a=t.slice(0,i+1),o=u.apply(void 0,a);if(0===o)throw new Error("Input not in general position");for(var l=new Array(i+1),c=0;c<=i;++c)l[c]=c;o<0&&(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;c<=i;++c){for(var p=l.slice(),g=0;g<=i;++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;c<=i;++c)for(var p=h[c].vertices,y=h[c].adjacent,g=0;g<=i;++g){var b=p[g];if(b<0)y[g]=f;else for(var x=0;x<=i;++x)h[x].vertices.indexOf(b)<0&&(y[g]=h[x])}for(var _=new s(i,a,d),w=!!e,c=i+1;c0;){t=o.pop();for(var s=(t.vertices,t.adjacent),l=0;l<=r;++l){var u=s[l];if(u.boundary&&!(u.lastVisited<=-n)){for(var c=u.vertices,f=0;f<=r;++f){var h=c[f];i[f]=h<0?e:a[h]}var d=this.orient();if(d>0)return u;u.lastVisited=-n,0===d&&o.push(u)}}}return null},h.walk=function(t,e){var r=this.vertices.length-1,n=this.dimension,i=this.vertices,a=this.tuple,o=e?this.interior.length*Math.random()|0:this.interior.length-1,s=this.interior[o];t:for(;!s.boundary;){for(var l=s.vertices,u=s.adjacent,c=0;c<=n;++c)a[c]=i[l[c]];s.lastVisited=r;for(var c=0;c<=n;++c){var f=u[c];if(!(f.lastVisited>=r)){var h=a[c];a[c]=t;var d=this.orient();if(a[c]=h,d<0){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,o=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(!(g<0))for(var v=0;v<=o;++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;x<=o;++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,M=d.slice(),A=p.slice(),k=new n(M,A,!0);c.push(k);var T=w.indexOf(e);if(!(T<0)){w[T]=k,A[g]=m,M[v]=-1,A[v]=e,p[v]=k,k.flip();for(var x=0;x<=o;++x){var E=M[x];if(!(E<0||E===r)){for(var L=new Array(o-1),C=0,S=0;S<=o;++S){var P=M[S];P<0||S===x||(L[C++]=P)}h.push(new i(L,k,x))}}}}}}h.sort(a);for(var v=0;v+1=0?o[l++]=s[c]:u=1&c;if(u===(1&t)){var f=o[0];o[0]=o[1],o[1]=f}e.push(o)}}return e}},{"robust-orientation":231,"simplicial-complex":241}],174:[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 n<0?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)}},x.remove=function(t){var e=this.count-this.leftPoints;if(t[1]3*(e-1))return s(this,t);var r=this.left.remove(t);return 2===r?(this.left=null,this.count-=1,b):(r===b&&(this.count-=1),r)}if(t[0]>this.mid){if(!this.right)return y;if(4*(this.left?this.left.count:0)>3*(e-1))return s(this,t);var r=this.right.remove(t);return 2===r?(this.right=null,this.count-=1,b):(r===b&&(this.count-=1),r)}if(1===this.count)return this.leftPoints[0]===t?2:y;if(1===this.leftPoints.length&&this.leftPoints[0]===t){if(this.left&&this.right){for(var n=this,a=this.left;a.right;)n=a,a=a.right;if(n===this)a.right=this.right;else{var o=this.left,r=this.right;n.count-=a.count,n.right=a.left,a.left=o,a.right=r}i(this,a),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 o=m.ge(this.leftPoints,t,h);othis.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)},x.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 _=g.prototype;_.insert=function(t){this.root?this.root.insert(t):this.root=new n(t[0],null,null,[t],[t])},_.remove=function(t){if(this.root){var e=this.root.remove(t);return 2===e&&(this.root=null),e!==y}return!1},_.queryPoint=function(t,e){if(this.root)return this.root.queryPoint(t,e)},_.queryInterval=function(t,e,r){if(t<=e&&this.root)return this.root.queryInterval(t,e,r)},Object.defineProperty(_,"count",{get:function(){return this.root?this.root.count:0}}),Object.defineProperty(_,"intervals",{get:function(){return this.root?this.root.intervals([]):[]}})},{"binary-search-bounds":34}],175:[function(t,e,r){"use strict";function n(t,e){e=e||new Array(t.length);for(var r=0;rv[1][2]&&(b[0]=-b[0]),v[0][2]>v[2][0]&&(b[1]=-b[1]),v[1][0]>v[0][1]&&(b[2]=-b[2]),!0}},{"./normalize":183,"gl-mat4/clone":112,"gl-mat4/create":113,"gl-mat4/determinant":114,"gl-mat4/invert":118,"gl-mat4/transpose":128,"gl-vec3/cross":156,"gl-vec3/dot":157,"gl-vec3/length":158,"gl-vec3/normalize":160}],183:[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;i<16;i++)t[i]=e[i]*n;return!0}},{}],184:[function(t,e,r){function n(t,e,r,n){if(0===c(e)||0===c(r))return!1;var i=u(e,h.translate,h.scale,h.skew,h.perspective,h.quaternion),a=u(r,d.translate,d.scale,d.skew,d.perspective,d.quaternion);return!(!i||!a)&&(s(p.translate,h.translate,d.translate,n),s(p.skew,h.skew,d.skew,n),s(p.scale,h.scale,d.scale,n),s(p.perspective,h.perspective,d.perspective,n),f(p.quaternion,h.quaternion,d.quaternion,n),l(t,p.translate,p.scale,p.skew,p.perspective,p.quaternion),!0)}function i(){return{translate:a(),scale:a(1),skew:a(),perspective:o(),quaternion:o()}}function a(t){return[t||0,t||0,t||0]}function o(){return[0,0,0,1]}var s=t("gl-vec3/lerp"),l=t("mat4-recompose"),u=t("mat4-decompose"),c=t("gl-mat4/determinant"),f=t("quat-slerp"),h=i(),d=i(),p=i();e.exports=n},{"gl-mat4/determinant":114,"gl-vec3/lerp":159,"mat4-decompose":182,"mat4-recompose":185,"quat-slerp":218}],185:[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,a,o,s){return n.identity(t),n.fromRotationTranslation(t,s,e),t[3]=o[0],t[7]=o[1],t[11]=o[2],t[15]=o[3],n.identity(i),0!==a[2]&&(i[9]=a[2],n.multiply(t,t,i)),0!==a[1]&&(i[9]=0,i[8]=a[1],n.multiply(t,t,i)),0!==a[0]&&(i[8]=0,i[4]=a[0],n.multiply(t,t,i)),n.scale(t,t,r),t}},{"gl-mat4/create":113,"gl-mat4/fromRotationTranslation":116,"gl-mat4/identity":117,"gl-mat4/multiply":120,"gl-mat4/scale":126,"gl-mat4/translate":127}],186:[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){return t=t||{},new n(t.matrix||[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}var a=t("binary-search-bounds"),o=t("mat4-interpolate"),s=t("gl-mat4/invert"),l=t("gl-mat4/rotateX"),u=t("gl-mat4/rotateY"),c=t("gl-mat4/rotateZ"),f=t("gl-mat4/lookAt"),h=t("gl-mat4/translate"),d=(t("gl-mat4/scale"),t("gl-vec3/normalize")),p=[0,0,0];e.exports=i;var g=n.prototype;g.recalcMatrix=function(t){var e=this._time,r=a.le(e,t),n=this.computedMatrix;if(!(r<0)){var i=this._components;if(r===e.length-1)for(var l=16*r,u=0;u<16;++u)n[u]=i[l++];else{for(var c=e[r+1]-e[r],l=16*r,f=this.prevMatrix,h=!0,u=0;u<16;++u)f[u]=i[l++];for(var p=this.nextMatrix,u=0;u<16;++u)p[u]=i[l++],h=h&&f[u]===p[u];if(c<1e-6||h)for(var u=0;u<16;++u)n[u]=f[u];else o(n,f,p,(t-e[r])/c)}var g=this.computedUp;g[0]=n[1],g[1]=n[5],g[2]=n[9],d(g,g);var v=this.computedInverse;s(v,n);var m=this.computedEye,y=v[15];m[0]=v[12]/y,m[1]=v[13]/y,m[2]=v[14]/y;for(var b=this.computedCenter,x=Math.exp(this.computedRadius[0]),u=0;u<3;++u)b[u]=m[u]-n[2+4*u]*x}},g.idle=function(t){if(!(t1&&i(t[o[c-2]],t[o[c-1]],u)<=0;)c-=1,o.pop();for(o.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+o.length-2),f=0,n=0,h=o.length;n0;--d)r[f++]=s[d];return r}e.exports=n;var i=t("robust-orientation")[3]},{"robust-orientation":231}],188:[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 a=i.x(n),o=i.y(n);"buttons"in n&&(t=0|n.buttons),(t!==d||a!==p||o!==g||r(n))&&(d=0|t,p=a||0,g=o||0,e&&e(d,p,g,v))}function a(t){n(0,t)}function o(){(d||p||g||v.shift||v.alt||v.meta||v.control)&&(p=g=0,d=0,v.shift=v.alt=v.control=v.meta=!1,e&&e(0,0,0,v))}function s(t){r(t)&&e&&e(d,p,g,v)}function l(t){0===i.buttons(t)?n(0,t):n(d,t)}function u(t){n(d|i.buttons(t),t)}function c(t){n(d&~i.buttons(t),t)}function f(){m||(m=!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)))}function h(){m&&(m=!1,t.removeEventListener("mousemove",l),t.removeEventListener("mousedown",u),t.removeEventListener("mouseup",c),t.removeEventListener("mouseleave",a),t.removeEventListener("mouseenter",a),t.removeEventListener("mouseout",a),t.removeEventListener("mouseover",a),t.removeEventListener("blur",o),t.removeEventListener("keyup",s),t.removeEventListener("keydown",s),t.removeEventListener("keypress",s),t!==window&&(window.removeEventListener("blur",o),window.removeEventListener("keyup",s),window.removeEventListener("keydown",s),window.removeEventListener("keypress",s)))}e||(e=t,t=window);var d=0,p=0,g=0,v={shift:!1,alt:!1,control:!1,meta:!1},m=!1;f();var y={element:t};return Object.defineProperties(y,{enabled:{get:function(){return m},set:function(t){t?f():h()},enumerable:!0},buttons:{get:function(){return d},enumerable:!0},x:{get:function(){return p},enumerable:!0},y:{get:function(){return g},enumerable:!0},mods:{get:function(){return v},enumerable:!0}}),y}e.exports=n;var i=t("mouse-event")},{"mouse-event":190}],189:[function(t,e,r){function n(t,e,r){e=e||t.currentTarget||t.srcElement,Array.isArray(r)||(r=[0,0]);var n=t.clientX||0,a=t.clientY||0,o=i(e);return r[0]=n-o.left,r[1]=a-o.top,r}function i(t){return t===window||t===document||t===document.body?a:t.getBoundingClientRect()}var a={left:0,top:0};e.exports=n},{}],190:[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;--e)C(e,0);for(var r=[],e=0;e0;_=_-1&g)x.push(w+"["+T+"+"+v(_)+"]");x.push(m(0));for(var _=0;_0){",h(x[t]),"=1;"),N(t-1,e|1<0&&G.push(s(U,x[V-1])+"*"+o(x[V-1])),F.push(d(U,x[V])+"=("+G.join("-")+")|0")}for(var U=0;U=0;--U)X.push(o(x[U]));F.push(k+"=("+X.join("*")+")|0",M+"=mallocUint32("+k+")",w+"=mallocUint32("+k+")",T+"=0"),F.push(p(0)+"=0");for(var V=1;V<1< 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;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",M="P",A="N",k="Q",T="X",E="T"},{"typedarray-pool":258}],193:[function(t,e,r){"use strict";var n=t("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:!1,rvalue:!0,count:1},{name:"_inline_7_arg1_",lvalue:!0,rvalue:!1,count:1},{name:"_inline_7_arg2_",lvalue:!1,rvalue:!0,count:1}],thisVars:[],localVars:[]},post:{body:"{}",args:[],thisVars:[],localVars:[]},debug:!1,funcName:"cwise",blockSize:64});e.exports=function(t,e){return n(t,e),t}},{"cwise/lib/wrapper":78}],194:[function(t,e,r){"use strict";function n(t){if(t in l)return l[t];for(var e=[],r=0;r=0?s.push("0"):e.indexOf(-(l+1))>=0?s.push("s["+l+"]-1"):(s.push("-1"),n.push("1"),o.push("s["+l+"]-2"));var u=".lo("+n.join()+").hi("+o.join()+")";if(0===n.length&&(u=""),r>0){a.push("if(1");for(var l=0;l=0||e.indexOf(-(l+1))>=0||a.push("&&s[",l,"]>2");a.push("){grad",r,"(src.pick(",s.join(),")",u);for(var l=0;l=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("};")}(p)}}a.push("return dst;};return gradient");for(var g=["diff","zero"],v=[f,h],o=1;o<=i;++o)g.push("grad"+o),v.push(n(o));g.push(a.join(""));var m=Function.apply(void 0,g),r=m.apply(void 0,v);return l[e]=r,r}function a(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?o(e.dimension,r):o(e.dimension,"clamp");if(t.dimension!==e.dimension+1)throw new Error("ndarray-gradient: output dimension must be +1 input dimension");if(t.shape[e.dimension]!==e.dimension)throw new Error("ndarray-gradient: output shape must match input shape");for(var n=0;n>",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":75}],198:[function(t,e,r){"use strict";var n=t("ndarray"),i=t("./doConvert.js");e.exports=function(t,e){for(var r=[],a=t,o=1;Array.isArray(a);)r.push(a.length),o*=a.length,a=a[0];return 0===r.length?n():(e||(e=n(new Float64Array(o),r)),i(e,t),e)}},{"./doConvert.js":199,ndarray:203}],199:[function(t,e,r){e.exports=t("cwise-compiler")({args:["array","scalar","index"],pre:{body:"{}",args:[],thisVars:[],localVars:[]},body:{body:"{\nvar _inline_1_v=_inline_1_arg1_,_inline_1_i\nfor(_inline_1_i=0;_inline_1_i<_inline_1_arg2_.length-1;++_inline_1_i) {\n_inline_1_v=_inline_1_v[_inline_1_arg2_[_inline_1_i]]\n}\n_inline_1_arg0_=_inline_1_v[_inline_1_arg2_[_inline_1_arg2_.length-1]]\n}",args:[{name:"_inline_1_arg0_",lvalue:!0,rvalue:!1,count:1},{name:"_inline_1_arg1_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_1_arg2_",lvalue:!1,rvalue:!0,count:4}],thisVars:[],localVars:["_inline_1_i","_inline_1_v"]},post:{body:"{}",args:[],thisVars:[],localVars:[]},funcName:"convert",blockSize:64})},{"cwise-compiler":75}],200:[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;r1){for(var f=[],h=1;h1){o.push("dptr=0;sptr=ptr");for(var h=t.length-1;h>=0;--h){var d=t[h];0!==d&&o.push(["for(i",d,"=0;i",d,"b){break __l}"].join(""));for(var h=t.length-1;h>=1;--h)o.push("sptr+=e"+h,"dptr+=f"+h,"}");o.push("dptr=cptr;sptr=cptr-s0");for(var h=t.length-1;h>=0;--h){var d=t[h];0!==d&&o.push(["for(i",d,"=0;i",d,"=0;--h){var d=t[h];0!==d&&o.push(["for(i",d,"=0;i",d,"scratch)){",a("cptr",r("cptr-s0")),"cptr-=s0","}",a("cptr","scratch"));if(o.push("}"),t.length>1&&u&&o.push("free(scratch)"),o.push("} return "+s),u){var p=new Function("malloc","free",o.join("\n"));return p(u[0],u[1])}var p=new Function(o.join("\n"));return p()}function o(t,e,r){function a(t){return["(offset+",t,"*s0)"].join("")}function o(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="+a(e[0]));else for(var i=0;i=0;--i){var o=t[i];0!==o&&_.push(["for(i",o,"=0;i",o,"1)for(var i=0;i1?_.push("ptr_shift+=d"+o):_.push("ptr0+=d"+o),_.push("}"))}}function c(e,r,n,i){if(1===r.length)_.push("ptr0="+a(r[0]));else{for(var o=0;o1)for(var o=0;o=1;--o)n&&_.push("pivot_ptr+=f"+o),r.length>1?_.push("ptr_shift+=e"+o):_.push("ptr0+=e"+o),_.push("}")}function f(){t.length>1&&A&&_.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=",o("ptr0"),"-",o("ptr1"),"\n","if(comp>0){tmp0=",n,";",n,"=",i,";",i,"=tmp0;break ",s,"}\n","if(comp<0){break ",s,"}"].join(""))}else _.push(["if(",o(a(n)),">",o(a(i)),"){tmp0=",n,";",n,"=",i,";",i,"=tmp0}"].join(""))}function d(e,r){t.length>1?l([e,r],!1,s("ptr0",o("ptr1"))):_.push(s(a(e),o(a(r))))}function p(e,r,n){if(t.length>1){var i="__l"+ ++k;c(i,[r],!0,[e,"=",o("ptr0"),"-pivot",n,"[pivot_ptr]\n","if(",e,"!==0){break ",i,"}"].join(""))}else _.push([e,"=",o(a(r)),"-pivot",n].join(""))}function g(e,r){t.length>1?l([e,r],!1,["tmp=",o("ptr0"),"\n",s("ptr0",o("ptr1")),"\n",s("ptr1","tmp")].join("")):_.push(["ptr0=",a(e),"\n","ptr1=",a(r),"\n","tmp=",o("ptr0"),"\n",s("ptr0",o("ptr1")),"\n",s("ptr1","tmp")].join(""))}function v(e,r,n){t.length>1?(l([e,r,n],!1,["tmp=",o("ptr0"),"\n",s("ptr0",o("ptr1")),"\n",s("ptr1",o("ptr2")),"\n",s("ptr2","tmp")].join("")),_.push("++"+r,"--"+n)):_.push(["ptr0=",a(e),"\n","ptr1=",a(r),"\n","ptr2=",a(n),"\n","++",r,"\n","--",n,"\n","tmp=",o("ptr0"),"\n",s("ptr0",o("ptr1")),"\n",s("ptr1",o("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",o("ptr1")),"\n",s("ptr1",["pivot",n,"[pivot_ptr]"].join(""))].join("")):_.push(s(a(e),o(a(r))),s(a(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(",o("ptr0"),"!==pivot",r,"[pivot_ptr]){break __l",k,"}"].join("")),_.push(n,"}")):_.push(["while(",o(a(e)),"===pivot",r,"){",n,"}"].join(""))}var _=["'use strict'"],w=["ndarrayQuickSort",t.join("d"),e].join(""),M=["left","right","data","offset"].concat(i(t.length)),A=n(e),k=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=[],L=1;L1?l(["el1","el2","el3","el4","el5","index1","index3","index5"],!0,["pivot1[pivot_ptr]=",o("ptr1"),"\n","pivot2[pivot_ptr]=",o("ptr3"),"\n","pivots_are_equal=pivots_are_equal&&(pivot1[pivot_ptr]===pivot2[pivot_ptr])\n","x=",o("ptr0"),"\n","y=",o("ptr2"),"\n","z=",o("ptr4"),"\n",s("ptr5","x"),"\n",s("ptr6","y"),"\n",s("ptr7","z")].join("")):_.push(["pivot1=",o(a("el2")),"\n","pivot2=",o(a("el4")),"\n","pivots_are_equal=pivot1===pivot2\n","x=",o(a("el1")),"\n","y=",o(a("el3")),"\n","z=",o(a("el5")),"\n",s(a("index1"),"x"),"\n",s(a("index3"),"y"),"\n",s(a("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&&A){var C=new Function("insertionSort","malloc","free",_.join("\n"));return C(r,A[0],A[1])}var C=new Function("insertionSort",_.join("\n"));return C(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=a(t,e);return y(b,o(t,e,b))}var l=t("typedarray-pool"),u=32;e.exports=s},{"typedarray-pool":258}],201:[function(t,e,r){"use strict";function n(t){var e=t.order,r=t.dtype,n=[e,r],o=n.join(":"),s=a[o];return s||(a[o]=s=i(e,r)),s(t),t}var i=t("./lib/compile_sort.js"),a={};e.exports=n},{"./lib/compile_sort.js":200}],202:[function(t,e,r){"use strict";var n=t("ndarray-linear-interpolate"),i=t("cwise/lib/wrapper")({args:["index","array","scalar","scalar","scalar"],pre:{body:"{this_warped=new Array(_inline_33_arg4_)}",args:[{name:"_inline_33_arg0_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_33_arg1_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_33_arg2_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_33_arg3_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_33_arg4_",lvalue:!1,rvalue:!0,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:!1,rvalue:!0,count:1},{name:"_inline_34_arg1_",lvalue:!0,rvalue:!1,count:1},{name:"_inline_34_arg2_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_34_arg3_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_34_arg4_",lvalue:!1,rvalue:!1,count:0}],thisVars:["this_warped"],localVars:[]},post:{body:"{}",args:[],thisVars:[],localVars:[]},debug:!1,funcName:"warpND",blockSize:64}),a=t("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:!1,rvalue:!0,count:1},{name:"_inline_37_arg1_",lvalue:!0,rvalue:!1,count:1},{name:"_inline_37_arg2_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_37_arg3_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_37_arg4_",lvalue:!1,rvalue:!0,count:1}],thisVars:["this_warped"],localVars:[]},post:{body:"{}",args:[],thisVars:[],localVars:[]},debug:!1,funcName:"warp1D",blockSize:64}),o=t("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:!1,rvalue:!0,count:1},{name:"_inline_40_arg1_",lvalue:!0,rvalue:!1,count:1},{name:"_inline_40_arg2_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_40_arg3_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_40_arg4_",lvalue:!1,rvalue:!0,count:1}],thisVars:["this_warped"],localVars:[]},post:{body:"{}",args:[],thisVars:[],localVars:[]},debug:!1,funcName:"warp2D",blockSize:64}),s=t("cwise/lib/wrapper")({args:["index","array","scalar","scalar","scalar"],pre:{body:"{this_warped=[0,0,0]}",args:[],thisVars:["this_warped"],localVars:[]},body:{body:"{_inline_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:!1,rvalue:!0,count:1},{name:"_inline_43_arg1_",lvalue:!0,rvalue:!1,count:1},{name:"_inline_43_arg2_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_43_arg3_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_43_arg4_",lvalue:!1,rvalue:!0,count:1}],thisVars:["this_warped"],localVars:[]},post:{body:"{}",args:[],thisVars:[],localVars:[]},debug:!1,funcName:"warp3D",blockSize:64});e.exports=function(t,e,r){switch(e.shape.length){case 1:a(t,r,n.d1,e);break;case 2:o(t,r,n.d2,e);break;case 3:s(t,r,n.d3,e);break;default:i(t,r,n.bind(void 0,e),e.shape.length)}return t}},{"cwise/lib/wrapper":78,"ndarray-linear-interpolate":196}],203:[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;tMath.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;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;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;lt==t>0?n===o?(r+=1,n=0):n+=1:0===n?(n=o,r-=1):n-=1,i.pack(n,r)}var i=t("double-bits"),a=Math.pow(2,-1074),o=-1>>>0;e.exports=n},{"double-bits":81}],205:[function(t,e,r){r.vertexNormals=function(t,e,r){for(var n=e.length,i=new Array(n),a=void 0===r?1e-6:r,o=0;oa)for(var x=i[u],_=1/Math.sqrt(v*y),b=0;b<3;++b){var w=(b+1)%3,M=(b+2)%3;x[b]+=_*(m[w]*g[M]-m[M]*g[w])}}for(var o=0;oa)for(var _=1/Math.sqrt(A),b=0;b<3;++b)x[b]*=_;else for(var b=0;b<3;++b)x[b]=0}return i},r.faceNormals=function(t,e,r){for(var n=t.length,i=new Array(n),a=void 0===r?1e-6:r,o=0;oa?1/Math.sqrt(d):0;for(var u=0;u<3;++u)h[u]*=d;i[o]=h}return i}},{}],206:[function(t,e,r){"use strict";function n(t,e,r,n,i,a,o,s,l,u){var c=e+a+u;if(f>0){var f=Math.sqrt(c+1);t[0]=.5*(o-l)/f,t[1]=.5*(s-n)/f,t[2]=.5*(r-a)/f,t[3]=.5*f}else{var h=Math.max(e,a,u),f=Math.sqrt(2*h-c+1);e>=h?(t[0]=.5*f,t[1]=.5*(i+r)/f,t[2]=.5*(s+n)/f,t[3]=.5*(o-l)/f):a>=h?(t[0]=.5*(r+i)/f,t[1]=.5*f,t[2]=.5*(l+o)/f,t[3]=.5*(s-n)/f):(t[0]=.5*(n+s)/f,t[1]=.5*(o+l)/f,t[2]=.5*f,t[3]=.5*(r-i)/f)}return t}e.exports=n},{}],207:[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 a(t,e){var r=e[0],n=e[1],a=e[2],o=e[3],s=i(r,n,a,o);s>1e-6?(t[0]=r/s,t[1]=n/s,t[2]=a/s,t[3]=o/s):(t[0]=t[1]=t[2]=0,t[3]=1)}function o(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),a(r,r);var i=new o(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"),f=t("gl-mat4/invert"),h=t("./lib/quatFromFrame"),d=o.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;a(e,e);var r=this.computedMatrix;c(r,e);var n=this.computedCenter,i=this.computedEye,o=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],o[0]=r[1],o[1]=r[5],o[2]=r[9];for(var l=0;l<3;++l){for(var u=0,f=0;f<3;++f)u+=r[l+4*f]*i[f];r[12+l]=-u}},d.getMatrix=function(t,e){this.recalcMatrix(t);var r=this.computedMatrix;if(e){for(var n=0;n<16;++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 a=this.computedMatrix,o=a[1],s=a[5],l=a[9],u=n(o,s,l);o/=u,s/=u,l/=u;var c=a[0],f=a[4],h=a[8],d=c*o+f*s+h*l;c-=o*d,f-=s*d,h-=l*d;var p=n(c,f,h);c/=p,f/=p,h/=p;var g=a[2],v=a[6],m=a[10],y=g*o+v*s+m*l,b=g*c+v*f+m*h;g-=y*o+b*c,v-=y*s+b*f,m-=y*l+b*h;var x=n(g,v,m);g/=x,v/=x,m/=x;var _=c*e+o*r,w=f*e+s*r,M=h*e+l*r;this.center.move(t,_,w,M);var A=Math.exp(this.computedRadius[0]);A=Math.max(1e-4,A+i),this.radius.set(t,Math.log(A))},d.rotate=function(t,e,r,a){this.recalcMatrix(t),e=e||0,r=r||0;var o=this.computedMatrix,s=o[0],l=o[4],u=o[8],c=o[1],f=o[5],h=o[9],d=o[2],p=o[6],g=o[10],v=e*s+r*c,m=e*l+r*f,y=e*u+r*h,b=-(p*y-g*m),x=-(g*v-d*y),_=-(d*m-p*v),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 A=this.computedRotation,k=A[0],T=A[1],E=A[2],L=A[3],C=k*w+L*b+T*_-E*x,S=T*w+L*x+E*b-k*_,P=E*w+L*_+k*x-T*b,R=L*w-k*b-T*x-E*_;if(a){b=d,x=p,_=g;var O=Math.sin(a)/n(b,x,_);b*=O,x*=O,_*=O,w=Math.cos(e),C=C*w+R*b+S*_-P*x,S=S*w+R*x+P*b-C*_,P=P*w+R*_+C*x-S*b,R=R*w-C*b-S*x-P*_}var N=i(C,S,P,R);N>1e-6?(C/=N,S/=N,P/=N,R/=N):(C=S=P=0,R=1),this.rotation.set(t,C,S,P,R)},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 o=this.computedRotation;h(o,i[0],i[1],i[2],i[4],i[5],i[6],i[8],i[9],i[10]),a(o,o),this.rotation.set(t,o[0],o[1],o[2],o[3]);for(var s=0,l=0;l<3;++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;h(r,e[0],e[1],e[2],e[4],e[5],e[6],e[8],e[9],e[10]),a(r,r),this.rotation.set(t,r[0],r[1],r[2],r[3]);var n=this.computedMatrix;f(n,e);var i=n[15];if(Math.abs(i)>1e-6){var o=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,o-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":206,"filtered-vector":88,"gl-mat4/fromQuat":115,"gl-mat4/invert":118,"gl-mat4/lookAt":119}],208:[function(t,e,r){"use strict";var n=t("repeat-string");e.exports=function(t,e,r){return r=void 0!==r?r+"":" ",n(r,e)+t}},{"repeat-string":224}],209:[function(t,e,r){e.exports=function(t,e){e||(e=[0,""]),t=String(t);var r=parseFloat(t,10);return e[0]=r,e[1]=t.match(/[\d.\-\+]*\s*(.*)/)[1]||"",e}},{}],210:[function(t,e,r){"use strict";function n(t){var e=t.length;if(e0;--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||[];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;a0;--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":175,"typedarray-pool":258}],212:[function(t,e,r){"use strict";function n(t,e){function r(t,e){var r=s[e][t[e]];r.splice(r.indexOf(t),1)}function n(t,n,a){for(var o,l,u,c=0;c<2;++c)if(s[c][n].length>0){o=s[c][n][0],u=c;break}l=o[1^u];for(var f=0;f<2;++f)for(var h=s[f][n],d=0;d0&&(o=p,l=g,u=f)}return a?l:(o&&r(o,u),l)}for(var a=0|e.length,o=t.length,s=[new Array(a),new Array(a)],l=0;l0;){var d=(s[0][l].length,function(t,a){var o=s[a][t][0],l=[t];r(o,a);for(var u=o[1^a];;){for(;u!==t;)l.push(u),u=n(l[l.length-2],u,!1);if(s[0][t].length+s[1][t].length===0)break;var c=l[l.length-1],f=t,h=l[1],d=n(c,f,!0);if(i(e[c],e[f],e[h],e[d])<0)break;l.push(t),u=n(c,f)}return l}(l,f));!function(t,e){return e[1]===e[e.length-1]}(h,d)?(h.length>0&&c.push(h),h=d):h.push.apply(h,d)}h.length>0&&c.push(h)}return c}e.exports=n;var i=t("compare-angle")},{"compare-angle":67}],213:[function(t,e,r){"use strict";function n(t,e){for(var r=i(t,e.length),n=new Array(e.length),a=new Array(e.length),o=[],s=0;s0;){var u=o.pop();n[u]=!1;for(var c=r[u],s=0;s0}function a(t){for(var e=t.length,r=0;r0;){var U=F.pop(),V=R[U];f(V,function(t,e){return t-e});var H,q=V.length,G=B[U];if(0===G){var T=m[U];H=[T]}for(var v=0;v=0)&&(B[X]=1^G,F.push(X),0===G)){var T=m[X];a(T)||(T.reverse(),H.push(T))}}0===G&&d.push(H)}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":213,"edges-to-adjacency-list":83,"planar-dual":212,"point-in-big-polygon":215,"robust-sum":236,"two-product":256,uniq:260}],215:[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)}}function a(t){for(var e={},r=0;r0&&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]0))return 0;a=-1,i=i.right}else if(s>0)i=i.left;else{if(!(s<0))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;i=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 M,A,k,T;x<0?(M=c+h,A=f+d,A>M?(k=A-M,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,A<=0?(_=1,y=f+2*d+p):d>=0?(_=0,y=p):(_=-d/f,y=d*_+p))):_<0?(M=c+d,A=u+h,A>M?(k=A-M,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, +n.create());e.exports=function(t,e,r,a,o,s){return n.identity(t),n.fromRotationTranslation(t,s,e),t[3]=o[0],t[7]=o[1],t[11]=o[2],t[15]=o[3],n.identity(i),0!==a[2]&&(i[9]=a[2],n.multiply(t,t,i)),0!==a[1]&&(i[9]=0,i[8]=a[1],n.multiply(t,t,i)),0!==a[0]&&(i[8]=0,i[4]=a[0],n.multiply(t,t,i)),n.scale(t,t,r),t}},{"gl-mat4/create":113,"gl-mat4/fromRotationTranslation":116,"gl-mat4/identity":117,"gl-mat4/multiply":120,"gl-mat4/scale":126,"gl-mat4/translate":127}],186:[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){return t=t||{},new n(t.matrix||[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}var a=t("binary-search-bounds"),o=t("mat4-interpolate"),s=t("gl-mat4/invert"),l=t("gl-mat4/rotateX"),u=t("gl-mat4/rotateY"),c=t("gl-mat4/rotateZ"),f=t("gl-mat4/lookAt"),h=t("gl-mat4/translate"),d=(t("gl-mat4/scale"),t("gl-vec3/normalize")),p=[0,0,0];e.exports=i;var g=n.prototype;g.recalcMatrix=function(t){var e=this._time,r=a.le(e,t),n=this.computedMatrix;if(!(r<0)){var i=this._components;if(r===e.length-1)for(var l=16*r,u=0;u<16;++u)n[u]=i[l++];else{for(var c=e[r+1]-e[r],l=16*r,f=this.prevMatrix,h=!0,u=0;u<16;++u)f[u]=i[l++];for(var p=this.nextMatrix,u=0;u<16;++u)p[u]=i[l++],h=h&&f[u]===p[u];if(c<1e-6||h)for(var u=0;u<16;++u)n[u]=f[u];else o(n,f,p,(t-e[r])/c)}var g=this.computedUp;g[0]=n[1],g[1]=n[5],g[2]=n[9],d(g,g);var v=this.computedInverse;s(v,n);var m=this.computedEye,y=v[15];m[0]=v[12]/y,m[1]=v[13]/y,m[2]=v[14]/y;for(var b=this.computedCenter,x=Math.exp(this.computedRadius[0]),u=0;u<3;++u)b[u]=m[u]-n[2+4*u]*x}},g.idle=function(t){if(!(t1&&i(t[o[c-2]],t[o[c-1]],u)<=0;)c-=1,o.pop();for(o.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+o.length-2),f=0,n=0,h=o.length;n0;--d)r[f++]=s[d];return r}e.exports=n;var i=t("robust-orientation")[3]},{"robust-orientation":231}],188:[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 a=i.x(n),o=i.y(n);"buttons"in n&&(t=0|n.buttons),(t!==d||a!==p||o!==g||r(n))&&(d=0|t,p=a||0,g=o||0,e&&e(d,p,g,v))}function a(t){n(0,t)}function o(){(d||p||g||v.shift||v.alt||v.meta||v.control)&&(p=g=0,d=0,v.shift=v.alt=v.control=v.meta=!1,e&&e(0,0,0,v))}function s(t){r(t)&&e&&e(d,p,g,v)}function l(t){0===i.buttons(t)?n(0,t):n(d,t)}function u(t){n(d|i.buttons(t),t)}function c(t){n(d&~i.buttons(t),t)}function f(){m||(m=!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)))}function h(){m&&(m=!1,t.removeEventListener("mousemove",l),t.removeEventListener("mousedown",u),t.removeEventListener("mouseup",c),t.removeEventListener("mouseleave",a),t.removeEventListener("mouseenter",a),t.removeEventListener("mouseout",a),t.removeEventListener("mouseover",a),t.removeEventListener("blur",o),t.removeEventListener("keyup",s),t.removeEventListener("keydown",s),t.removeEventListener("keypress",s),t!==window&&(window.removeEventListener("blur",o),window.removeEventListener("keyup",s),window.removeEventListener("keydown",s),window.removeEventListener("keypress",s)))}e||(e=t,t=window);var d=0,p=0,g=0,v={shift:!1,alt:!1,control:!1,meta:!1},m=!1;f();var y={element:t};return Object.defineProperties(y,{enabled:{get:function(){return m},set:function(t){t?f():h()},enumerable:!0},buttons:{get:function(){return d},enumerable:!0},x:{get:function(){return p},enumerable:!0},y:{get:function(){return g},enumerable:!0},mods:{get:function(){return v},enumerable:!0}}),y}e.exports=n;var i=t("mouse-event")},{"mouse-event":190}],189:[function(t,e,r){function n(t,e,r){e=e||t.currentTarget||t.srcElement,Array.isArray(r)||(r=[0,0]);var n=t.clientX||0,a=t.clientY||0,o=i(e);return r[0]=n-o.left,r[1]=a-o.top,r}function i(t){return t===window||t===document||t===document.body?a:t.getBoundingClientRect()}var a={left:0,top:0};e.exports=n},{}],190:[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;--e)C(e,0);for(var r=[],e=0;e0;_=_-1&g)x.push(w+"["+T+"+"+v(_)+"]");x.push(m(0));for(var _=0;_0){",h(x[t]),"=1;"),N(t-1,e|1<0&&G.push(s(U,x[V-1])+"*"+o(x[V-1])),F.push(d(U,x[V])+"=("+G.join("-")+")|0")}for(var U=0;U=0;--U)X.push(o(x[U]));F.push(k+"=("+X.join("*")+")|0",M+"=mallocUint32("+k+")",w+"=mallocUint32("+k+")",T+"=0"),F.push(p(0)+"=0");for(var V=1;V<1< 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;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",M="P",A="N",k="Q",T="X",E="T"},{"typedarray-pool":258}],193:[function(t,e,r){"use strict";var n=t("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:!1,rvalue:!0,count:1},{name:"_inline_4_arg1_",lvalue:!0,rvalue:!1,count:1},{name:"_inline_4_arg2_",lvalue:!1,rvalue:!0,count:1}],thisVars:[],localVars:[]},post:{body:"{}",args:[],thisVars:[],localVars:[]},debug:!1,funcName:"cwise",blockSize:64});e.exports=function(t,e){return n(t,e),t}},{"cwise/lib/wrapper":78}],194:[function(t,e,r){"use strict";function n(t){if(t in l)return l[t];for(var e=[],r=0;r=0?s.push("0"):e.indexOf(-(l+1))>=0?s.push("s["+l+"]-1"):(s.push("-1"),n.push("1"),o.push("s["+l+"]-2"));var u=".lo("+n.join()+").hi("+o.join()+")";if(0===n.length&&(u=""),r>0){a.push("if(1");for(var l=0;l=0||e.indexOf(-(l+1))>=0||a.push("&&s[",l,"]>2");a.push("){grad",r,"(src.pick(",s.join(),")",u);for(var l=0;l=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("};")}(p)}}a.push("return dst;};return gradient");for(var g=["diff","zero"],v=[f,h],o=1;o<=i;++o)g.push("grad"+o),v.push(n(o));g.push(a.join(""));var m=Function.apply(void 0,g),r=m.apply(void 0,v);return l[e]=r,r}function a(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?o(e.dimension,r):o(e.dimension,"clamp");if(t.dimension!==e.dimension+1)throw new Error("ndarray-gradient: output dimension must be +1 input dimension");if(t.shape[e.dimension]!==e.dimension)throw new Error("ndarray-gradient: output shape must match input shape");for(var n=0;n>",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":75}],198:[function(t,e,r){"use strict";var n=t("ndarray"),i=t("./doConvert.js");e.exports=function(t,e){for(var r=[],a=t,o=1;Array.isArray(a);)r.push(a.length),o*=a.length,a=a[0];return 0===r.length?n():(e||(e=n(new Float64Array(o),r)),i(e,t),e)}},{"./doConvert.js":199,ndarray:203}],199:[function(t,e,r){e.exports=t("cwise-compiler")({args:["array","scalar","index"],pre:{body:"{}",args:[],thisVars:[],localVars:[]},body:{body:"{\nvar _inline_1_v=_inline_1_arg1_,_inline_1_i\nfor(_inline_1_i=0;_inline_1_i<_inline_1_arg2_.length-1;++_inline_1_i) {\n_inline_1_v=_inline_1_v[_inline_1_arg2_[_inline_1_i]]\n}\n_inline_1_arg0_=_inline_1_v[_inline_1_arg2_[_inline_1_arg2_.length-1]]\n}",args:[{name:"_inline_1_arg0_",lvalue:!0,rvalue:!1,count:1},{name:"_inline_1_arg1_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_1_arg2_",lvalue:!1,rvalue:!0,count:4}],thisVars:[],localVars:["_inline_1_i","_inline_1_v"]},post:{body:"{}",args:[],thisVars:[],localVars:[]},funcName:"convert",blockSize:64})},{"cwise-compiler":75}],200:[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;r1){for(var f=[],h=1;h1){o.push("dptr=0;sptr=ptr");for(var h=t.length-1;h>=0;--h){var d=t[h];0!==d&&o.push(["for(i",d,"=0;i",d,"b){break __l}"].join(""));for(var h=t.length-1;h>=1;--h)o.push("sptr+=e"+h,"dptr+=f"+h,"}");o.push("dptr=cptr;sptr=cptr-s0");for(var h=t.length-1;h>=0;--h){var d=t[h];0!==d&&o.push(["for(i",d,"=0;i",d,"=0;--h){var d=t[h];0!==d&&o.push(["for(i",d,"=0;i",d,"scratch)){",a("cptr",r("cptr-s0")),"cptr-=s0","}",a("cptr","scratch"));if(o.push("}"),t.length>1&&u&&o.push("free(scratch)"),o.push("} return "+s),u){var p=new Function("malloc","free",o.join("\n"));return p(u[0],u[1])}var p=new Function(o.join("\n"));return p()}function o(t,e,r){function a(t){return["(offset+",t,"*s0)"].join("")}function o(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="+a(e[0]));else for(var i=0;i=0;--i){var o=t[i];0!==o&&_.push(["for(i",o,"=0;i",o,"1)for(var i=0;i1?_.push("ptr_shift+=d"+o):_.push("ptr0+=d"+o),_.push("}"))}}function c(e,r,n,i){if(1===r.length)_.push("ptr0="+a(r[0]));else{for(var o=0;o1)for(var o=0;o=1;--o)n&&_.push("pivot_ptr+=f"+o),r.length>1?_.push("ptr_shift+=e"+o):_.push("ptr0+=e"+o),_.push("}")}function f(){t.length>1&&A&&_.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=",o("ptr0"),"-",o("ptr1"),"\n","if(comp>0){tmp0=",n,";",n,"=",i,";",i,"=tmp0;break ",s,"}\n","if(comp<0){break ",s,"}"].join(""))}else _.push(["if(",o(a(n)),">",o(a(i)),"){tmp0=",n,";",n,"=",i,";",i,"=tmp0}"].join(""))}function d(e,r){t.length>1?l([e,r],!1,s("ptr0",o("ptr1"))):_.push(s(a(e),o(a(r))))}function p(e,r,n){if(t.length>1){var i="__l"+ ++k;c(i,[r],!0,[e,"=",o("ptr0"),"-pivot",n,"[pivot_ptr]\n","if(",e,"!==0){break ",i,"}"].join(""))}else _.push([e,"=",o(a(r)),"-pivot",n].join(""))}function g(e,r){t.length>1?l([e,r],!1,["tmp=",o("ptr0"),"\n",s("ptr0",o("ptr1")),"\n",s("ptr1","tmp")].join("")):_.push(["ptr0=",a(e),"\n","ptr1=",a(r),"\n","tmp=",o("ptr0"),"\n",s("ptr0",o("ptr1")),"\n",s("ptr1","tmp")].join(""))}function v(e,r,n){t.length>1?(l([e,r,n],!1,["tmp=",o("ptr0"),"\n",s("ptr0",o("ptr1")),"\n",s("ptr1",o("ptr2")),"\n",s("ptr2","tmp")].join("")),_.push("++"+r,"--"+n)):_.push(["ptr0=",a(e),"\n","ptr1=",a(r),"\n","ptr2=",a(n),"\n","++",r,"\n","--",n,"\n","tmp=",o("ptr0"),"\n",s("ptr0",o("ptr1")),"\n",s("ptr1",o("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",o("ptr1")),"\n",s("ptr1",["pivot",n,"[pivot_ptr]"].join(""))].join("")):_.push(s(a(e),o(a(r))),s(a(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(",o("ptr0"),"!==pivot",r,"[pivot_ptr]){break __l",k,"}"].join("")),_.push(n,"}")):_.push(["while(",o(a(e)),"===pivot",r,"){",n,"}"].join(""))}var _=["'use strict'"],w=["ndarrayQuickSort",t.join("d"),e].join(""),M=["left","right","data","offset"].concat(i(t.length)),A=n(e),k=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=[],L=1;L1?l(["el1","el2","el3","el4","el5","index1","index3","index5"],!0,["pivot1[pivot_ptr]=",o("ptr1"),"\n","pivot2[pivot_ptr]=",o("ptr3"),"\n","pivots_are_equal=pivots_are_equal&&(pivot1[pivot_ptr]===pivot2[pivot_ptr])\n","x=",o("ptr0"),"\n","y=",o("ptr2"),"\n","z=",o("ptr4"),"\n",s("ptr5","x"),"\n",s("ptr6","y"),"\n",s("ptr7","z")].join("")):_.push(["pivot1=",o(a("el2")),"\n","pivot2=",o(a("el4")),"\n","pivots_are_equal=pivot1===pivot2\n","x=",o(a("el1")),"\n","y=",o(a("el3")),"\n","z=",o(a("el5")),"\n",s(a("index1"),"x"),"\n",s(a("index3"),"y"),"\n",s(a("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&&A){var C=new Function("insertionSort","malloc","free",_.join("\n"));return C(r,A[0],A[1])}var C=new Function("insertionSort",_.join("\n"));return C(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=a(t,e);return y(b,o(t,e,b))}var l=t("typedarray-pool"),u=32;e.exports=s},{"typedarray-pool":258}],201:[function(t,e,r){"use strict";function n(t){var e=t.order,r=t.dtype,n=[e,r],o=n.join(":"),s=a[o];return s||(a[o]=s=i(e,r)),s(t),t}var i=t("./lib/compile_sort.js"),a={};e.exports=n},{"./lib/compile_sort.js":200}],202:[function(t,e,r){"use strict";var n=t("ndarray-linear-interpolate"),i=t("cwise/lib/wrapper")({args:["index","array","scalar","scalar","scalar"],pre:{body:"{this_warped=new Array(_inline_21_arg4_)}",args:[{name:"_inline_21_arg0_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_21_arg1_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_21_arg2_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_21_arg3_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_21_arg4_",lvalue:!1,rvalue:!0,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:!1,rvalue:!0,count:1},{name:"_inline_22_arg1_",lvalue:!0,rvalue:!1,count:1},{name:"_inline_22_arg2_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_22_arg3_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_22_arg4_",lvalue:!1,rvalue:!1,count:0}],thisVars:["this_warped"],localVars:[]},post:{body:"{}",args:[],thisVars:[],localVars:[]},debug:!1,funcName:"warpND",blockSize:64}),a=t("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:!1,rvalue:!0,count:1},{name:"_inline_25_arg1_",lvalue:!0,rvalue:!1,count:1},{name:"_inline_25_arg2_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_25_arg3_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_25_arg4_",lvalue:!1,rvalue:!0,count:1}],thisVars:["this_warped"],localVars:[]},post:{body:"{}",args:[],thisVars:[],localVars:[]},debug:!1,funcName:"warp1D",blockSize:64}),o=t("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:!1,rvalue:!0,count:1},{name:"_inline_28_arg1_",lvalue:!0,rvalue:!1,count:1},{name:"_inline_28_arg2_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_28_arg3_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_28_arg4_",lvalue:!1,rvalue:!0,count:1}],thisVars:["this_warped"],localVars:[]},post:{body:"{}",args:[],thisVars:[],localVars:[]},debug:!1,funcName:"warp2D",blockSize:64}),s=t("cwise/lib/wrapper")({args:["index","array","scalar","scalar","scalar"],pre:{body:"{this_warped=[0,0,0]}",args:[],thisVars:["this_warped"],localVars:[]},body:{body:"{_inline_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:!1,rvalue:!0,count:1},{name:"_inline_31_arg1_",lvalue:!0,rvalue:!1,count:1},{name:"_inline_31_arg2_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_31_arg3_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_31_arg4_",lvalue:!1,rvalue:!0,count:1}],thisVars:["this_warped"],localVars:[]},post:{body:"{}",args:[],thisVars:[],localVars:[]},debug:!1,funcName:"warp3D",blockSize:64});e.exports=function(t,e,r){switch(e.shape.length){case 1:a(t,r,n.d1,e);break;case 2:o(t,r,n.d2,e);break;case 3:s(t,r,n.d3,e);break;default:i(t,r,n.bind(void 0,e),e.shape.length)}return t}},{"cwise/lib/wrapper":78,"ndarray-linear-interpolate":196}],203:[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;tMath.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;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;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;lt==t>0?n===o?(r+=1,n=0):n+=1:0===n?(n=o,r-=1):n-=1,i.pack(n,r)}var i=t("double-bits"),a=Math.pow(2,-1074),o=-1>>>0;e.exports=n},{"double-bits":81}],205:[function(t,e,r){r.vertexNormals=function(t,e,r){for(var n=e.length,i=new Array(n),a=void 0===r?1e-6:r,o=0;oa)for(var x=i[u],_=1/Math.sqrt(v*y),b=0;b<3;++b){var w=(b+1)%3,M=(b+2)%3;x[b]+=_*(m[w]*g[M]-m[M]*g[w])}}for(var o=0;oa)for(var _=1/Math.sqrt(A),b=0;b<3;++b)x[b]*=_;else for(var b=0;b<3;++b)x[b]=0}return i},r.faceNormals=function(t,e,r){for(var n=t.length,i=new Array(n),a=void 0===r?1e-6:r,o=0;oa?1/Math.sqrt(d):0;for(var u=0;u<3;++u)h[u]*=d;i[o]=h}return i}},{}],206:[function(t,e,r){"use strict";function n(t,e,r,n,i,a,o,s,l,u){var c=e+a+u;if(f>0){var f=Math.sqrt(c+1);t[0]=.5*(o-l)/f,t[1]=.5*(s-n)/f,t[2]=.5*(r-a)/f,t[3]=.5*f}else{var h=Math.max(e,a,u),f=Math.sqrt(2*h-c+1);e>=h?(t[0]=.5*f,t[1]=.5*(i+r)/f,t[2]=.5*(s+n)/f,t[3]=.5*(o-l)/f):a>=h?(t[0]=.5*(r+i)/f,t[1]=.5*f,t[2]=.5*(l+o)/f,t[3]=.5*(s-n)/f):(t[0]=.5*(n+s)/f,t[1]=.5*(o+l)/f,t[2]=.5*f,t[3]=.5*(r-i)/f)}return t}e.exports=n},{}],207:[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 a(t,e){var r=e[0],n=e[1],a=e[2],o=e[3],s=i(r,n,a,o);s>1e-6?(t[0]=r/s,t[1]=n/s,t[2]=a/s,t[3]=o/s):(t[0]=t[1]=t[2]=0,t[3]=1)}function o(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),a(r,r);var i=new o(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"),f=t("gl-mat4/invert"),h=t("./lib/quatFromFrame"),d=o.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;a(e,e);var r=this.computedMatrix;c(r,e);var n=this.computedCenter,i=this.computedEye,o=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],o[0]=r[1],o[1]=r[5],o[2]=r[9];for(var l=0;l<3;++l){for(var u=0,f=0;f<3;++f)u+=r[l+4*f]*i[f];r[12+l]=-u}},d.getMatrix=function(t,e){this.recalcMatrix(t);var r=this.computedMatrix;if(e){for(var n=0;n<16;++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 a=this.computedMatrix,o=a[1],s=a[5],l=a[9],u=n(o,s,l);o/=u,s/=u,l/=u;var c=a[0],f=a[4],h=a[8],d=c*o+f*s+h*l;c-=o*d,f-=s*d,h-=l*d;var p=n(c,f,h);c/=p,f/=p,h/=p;var g=a[2],v=a[6],m=a[10],y=g*o+v*s+m*l,b=g*c+v*f+m*h;g-=y*o+b*c,v-=y*s+b*f,m-=y*l+b*h;var x=n(g,v,m);g/=x,v/=x,m/=x;var _=c*e+o*r,w=f*e+s*r,M=h*e+l*r;this.center.move(t,_,w,M);var A=Math.exp(this.computedRadius[0]);A=Math.max(1e-4,A+i),this.radius.set(t,Math.log(A))},d.rotate=function(t,e,r,a){this.recalcMatrix(t),e=e||0,r=r||0;var o=this.computedMatrix,s=o[0],l=o[4],u=o[8],c=o[1],f=o[5],h=o[9],d=o[2],p=o[6],g=o[10],v=e*s+r*c,m=e*l+r*f,y=e*u+r*h,b=-(p*y-g*m),x=-(g*v-d*y),_=-(d*m-p*v),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 A=this.computedRotation,k=A[0],T=A[1],E=A[2],L=A[3],C=k*w+L*b+T*_-E*x,S=T*w+L*x+E*b-k*_,P=E*w+L*_+k*x-T*b,R=L*w-k*b-T*x-E*_;if(a){b=d,x=p,_=g;var O=Math.sin(a)/n(b,x,_);b*=O,x*=O,_*=O,w=Math.cos(e),C=C*w+R*b+S*_-P*x,S=S*w+R*x+P*b-C*_,P=P*w+R*_+C*x-S*b,R=R*w-C*b-S*x-P*_}var N=i(C,S,P,R);N>1e-6?(C/=N,S/=N,P/=N,R/=N):(C=S=P=0,R=1),this.rotation.set(t,C,S,P,R)},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 o=this.computedRotation;h(o,i[0],i[1],i[2],i[4],i[5],i[6],i[8],i[9],i[10]),a(o,o),this.rotation.set(t,o[0],o[1],o[2],o[3]);for(var s=0,l=0;l<3;++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;h(r,e[0],e[1],e[2],e[4],e[5],e[6],e[8],e[9],e[10]),a(r,r),this.rotation.set(t,r[0],r[1],r[2],r[3]);var n=this.computedMatrix;f(n,e);var i=n[15];if(Math.abs(i)>1e-6){var o=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,o-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":206,"filtered-vector":88,"gl-mat4/fromQuat":115,"gl-mat4/invert":118,"gl-mat4/lookAt":119}],208:[function(t,e,r){"use strict";var n=t("repeat-string");e.exports=function(t,e,r){return r=void 0!==r?r+"":" ",n(r,e)+t}},{"repeat-string":224}],209:[function(t,e,r){e.exports=function(t,e){e||(e=[0,""]),t=String(t);var r=parseFloat(t,10);return e[0]=r,e[1]=t.match(/[\d.\-\+]*\s*(.*)/)[1]||"",e}},{}],210:[function(t,e,r){"use strict";function n(t){var e=t.length;if(e0;--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||[];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;a0;--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":175,"typedarray-pool":258}],212:[function(t,e,r){"use strict";function n(t,e){function r(t,e){var r=s[e][t[e]];r.splice(r.indexOf(t),1)}function n(t,n,a){for(var o,l,u,c=0;c<2;++c)if(s[c][n].length>0){o=s[c][n][0],u=c;break}l=o[1^u];for(var f=0;f<2;++f)for(var h=s[f][n],d=0;d0&&(o=p,l=g,u=f)}return a?l:(o&&r(o,u),l)}for(var a=0|e.length,o=t.length,s=[new Array(a),new Array(a)],l=0;l0;){var d=(s[0][l].length,function(t,a){var o=s[a][t][0],l=[t];r(o,a);for(var u=o[1^a];;){for(;u!==t;)l.push(u),u=n(l[l.length-2],u,!1);if(s[0][t].length+s[1][t].length===0)break;var c=l[l.length-1],f=t,h=l[1],d=n(c,f,!0);if(i(e[c],e[f],e[h],e[d])<0)break;l.push(t),u=n(c,f)}return l}(l,f));!function(t,e){return e[1]===e[e.length-1]}(h,d)?(h.length>0&&c.push(h),h=d):h.push.apply(h,d)}h.length>0&&c.push(h)}return c}e.exports=n;var i=t("compare-angle")},{"compare-angle":67}],213:[function(t,e,r){"use strict";function n(t,e){for(var r=i(t,e.length),n=new Array(e.length),a=new Array(e.length),o=[],s=0;s0;){var u=o.pop();n[u]=!1;for(var c=r[u],s=0;s0}function a(t){for(var e=t.length,r=0;r0;){var U=F.pop(),V=R[U];f(V,function(t,e){return t-e});var H,q=V.length,G=B[U];if(0===G){var T=m[U];H=[T]}for(var v=0;v=0)&&(B[X]=1^G,F.push(X),0===G)){var T=m[X];a(T)||(T.reverse(),H.push(T))}}0===G&&d.push(H)}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":213,"edges-to-adjacency-list":83,"planar-dual":212,"point-in-big-polygon":215,"robust-sum":236,"two-product":256,uniq:260}],215:[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)}}function a(t){for(var e={},r=0;r0&&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]0))return 0;a=-1,i=i.right}else if(s>0)i=i.left;else{if(!(s<0))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;i=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 M,A,k,T;x<0?(M=c+h,A=f+d,A>M?(k=A-M,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,A<=0?(_=1,y=f+2*d+p):d>=0?(_=0,y=p):(_=-d/f,y=d*_+p))):_<0?(M=c+d,A=u+h,A>M?(k=A-M,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, A<=0?(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,k<=0?(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;l1)for(var r=1;r0){var u=t[r-1];if(0===i(s,u)&&o(u)!==l){r-=1;continue}}t[r++]=s}}return t.length=r,t}var i=t("compare-cell"),a=t("compare-oriented-cell"),o=t("cell-orientation");e.exports=n},{"cell-orientation":53,"compare-cell":68,"compare-oriented-cell":69}],224:[function(t,e,r){"use strict";function n(t,e){if("string"!=typeof t)throw new TypeError("expected a string");if(1===e)return t;if(2===e)return t+t;var r=t.length*e;if(i!==t||void 0===i)i=t,a="";else if(a.length>=r)return a.substr(0,r);for(;r>a.length&&e>1;)1&e&&(a+=t),e>>=1,t+=t;return a+=t,a=a.substr(0,r)}var i,a="";e.exports=n},{}],225:[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:{})},{}],226:[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 a=r,o=t[i];r=a+o;var s=r-a,l=o-s;l&&(t[--n]=r,r=l)}for(var u=0,i=n;i>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;r>1;return["sum(",a(t.slice(0,e)),",",a(t.slice(e)),")"].join("")}function o(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 o(e,t)}function s(t){return!0&t?"-":""}function l(t){if(2===t.length)return[["diff(",o(t[0][0],t[1][1]),",",o(t[1][0],t[0][1]),")"].join("")];for(var e=[],r=0;r0&&r.push(","),r.push("[");for(var a=0;a0&&r.push(","),a===n?r.push("+b[",i,"]"):r.push("+A[",i,"][",a,"]");r.push("]")}r.push("]),")}r.push("det(A)]}return ",e);var s=new Function("det",r.join(""));return s(t<6?o[t]:o)}function i(){return[0]}function a(t,e){return[[e[0]],[t[0][0]]]}var o=t("robust-determinant"),s=6,l=[i,a];!function(){for(;l.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;r0){if(a<=0)return o;n=i+a}else{if(!(i<0))return o;if(a>=0)return o;n=-(i+a)}var s=3.3306690738754716e-16*n;return o>=s||o<=-s?o:g(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,m=i*u,y=i*l,b=a*s,x=c*(d-p)+f*(g-m)+h*(y-b),_=(Math.abs(d)+Math.abs(p))*Math.abs(c)+(Math.abs(g)+Math.abs(m))*Math.abs(f)+(Math.abs(y)+Math.abs(b))*Math.abs(h),w=7.771561172376103e-16*_;return x>w||-x>w?x:v(t,e,r,n)}];!function(){for(;m.length<=p;)m.push(l(m.length));for(var t=[],r=["slow"],n=0;n<=p;++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;n<=p;++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;i0&&s>0||o<0&&s<0)return!1;var l=a(r,t,e),u=a(i,t,e);return!(l>0&&u>0||l<0&&u<0)&&(0!==o||0!==s||0!==l||0!==u||n(t,e,r,i))}e.exports=i;var a=t("robust-orientation")[3]},{"robust-orientation":231}],235:[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);p=i?(a=d,(c+=1)=i?(a=d,(c+=1)0?1:0}},{}],238:[function(t,e,r){"use strict";function n(t){return a(i(t))}e.exports=n;var i=t("boundary-cells"),a=t("reduce-simplicial-complex")},{"boundary-cells":37,"reduce-simplicial-complex":223}],239:[function(t,e,r){"use strict";function n(t){for(var e=t.length,r=0,n=0;n>1,v=E[2*m+1];","if(v===b){return m}","if(b1;--n){n0&&l.push(","),l.push("[");for(var n=0;n0&&l.push(","),l.push("B(C,E,c[",i[0],"],c[",i[1],"])")}l.push("]")}l.push(");")}}(i[s]),l.push("break;");l.push("}}")}return l.push("}return R;};return getContour",t,"d"),new Function("pool",l.join(""))(a)}function i(t){var e=s[t];return e||(e=s[t]=n(t)),e}e.exports=i;var a=t("typedarray-pool"),o=t("marching-simplex-table"),s={}},{"marching-simplex-table":181,"typedarray-pool":258}],241:[function(t,e,r){"use strict";"use restrict";function n(t){for(var e=0,r=Math.max,n=0,i=t.length;n>1,s=o(t[a],e);s<=0?(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;n=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;n>>c&1&&u.push(i[c]);e.push(u)}return l(e)}function p(t,e){if(e<0)return[];for(var r=[],n=(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(n0;){var r=l(t);if(r>=0){if(e0){var t=A[0];return a(0,T-1),T-=1,u(0),t}return-1}function h(t,e){var r=A[t];return y[r]===e?t:(y[r]=-1/0,c(t),f(),y[r]=e,T+=1,c(T-1))}function d(t,e){if(t[e]<0)return e;var r=e,n=e;do{var i=t[n];if(!b[n]||i<0||i===n)break;if(n=i,i=t[n],!b[n]||i<0||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 p=e.length,g=t.length,v=new Array(p),m=new Array(p),y=new Array(p),b=new Array(p),x=0;x>1;x>=0;--x)u(x);for(;;){var E=f();if(E<0||y[E]>r)break;!function(t){if(!b[t]){b[t]=!0;var e=v[t],r=m[t];v[r]>=0&&(v[r]=e),m[e]>=0&&(m[e]=r),k[e]>=0&&h(k[e],i(e)),k[r]>=0&&h(k[r],i(r))}}(E)}for(var L=[],x=0;x=0&&r>=0&&e!==r){var n=k[e],i=k[r];n!==i&&C.push([n,i])}}),o.unique(o.normalize(C)),{positions:L,edges:C}}e.exports=i;var a=t("robust-orientation"),o=t("simplicial-complex")},{"robust-orientation":231,"simplicial-complex":243}],246:[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 ol?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(l<0){if(u<=0)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),l<0){if(u<=0)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":231}],247:[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]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;a0){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":246,"binary-search-bounds":34,"functional-red-black-tree":89,"robust-orientation":231}],248:[function(t,e,r){"use strict";function n(t,e){var r=u(l(t,e),[e[e.length-1]]);return r[r.length-1]}function i(t,e,r,n){var i=n-e,a=-e/i;a<0?a=0:a>1&&(a=1);for(var o=1-a,s=t.length,l=new Array(s),u=0;u0||o>0&&c<0){var f=i(s,c,l,o);r.push(f),a.push(f.slice())}c<0?a.push(l.slice()):c>0?r.push(l.slice()):(r.push(l.slice()),a.push(l.slice())),o=c}return{positive:r,negative:a}}function o(t,e){for(var r=[],a=n(t[t.length-1],e),o=t[t.length-1],s=t[0],l=0;l0||a>0&&u<0)&&r.push(i(o,u,s,a)),u>=0&&r.push(s.slice()),a=u}return r}function s(t,e){for(var r=[],a=n(t[t.length-1],e),o=t[t.length-1],s=t[0],l=0;l0||a>0&&u<0)&&r.push(i(o,u,s,a)),u<=0&&r.push(s.slice()),a=u}return r}var l=t("robust-dot-product"),u=t("robust-sum");e.exports=a,e.exports.positive=o,e.exports.negative=s},{"robust-dot-product":228,"robust-sum":236}],249:[function(e,r,n){!function(){"use strict";function e(t){return i(a(t),arguments)}function r(t,r){return e.apply(null,[t].concat(r||[]))}function i(t,r){var n,i,a,s,l,u,c,f,h,d=1,p=t.length,g="";for(i=0;i=0),s[8]){case"b":n=parseInt(n,10).toString(2);break;case"c":n=String.fromCharCode(parseInt(n,10));break;case"d":case"i":n=parseInt(n,10);break;case"j":n=JSON.stringify(n,null,s[6]?parseInt(s[6]):0);break;case"e":n=s[7]?parseFloat(n).toExponential(s[7]):parseFloat(n).toExponential();break;case"f":n=s[7]?parseFloat(n).toFixed(s[7]):parseFloat(n);break;case"g":n=s[7]?String(Number(n.toPrecision(s[7]))):parseFloat(n);break;case"o":n=(parseInt(n,10)>>>0).toString(8);break;case"s":n=String(n),n=s[7]?n.substring(0,s[7]):n;break;case"t":n=String(!!n),n=s[7]?n.substring(0,s[7]):n;break;case"T":n=Object.prototype.toString.call(n).slice(8,-1).toLowerCase(),n=s[7]?n.substring(0,s[7]):n;break;case"u":n=parseInt(n,10)>>>0;break;case"v":n=n.valueOf(),n=s[7]?n.substring(0,s[7]):n;break;case"x":n=(parseInt(n,10)>>>0).toString(16);break;case"X":n=(parseInt(n,10)>>>0).toString(16).toUpperCase()}o.json.test(s[8])?g+=n:(!o.number.test(s[8])||f&&!s[3]?h="":(h=f?"+":"-",n=n.toString().replace(o.sign,"")),u=s[4]?"0"===s[4]?"0":s[4].charAt(1):" ",c=s[6]-(h+n).length,l=s[6]&&c>0?u.repeat(c):"",g+=s[5]?h+n+l:"0"===u?h+l+n:l+h+n)}return g}function a(t){if(s[t])return s[t];for(var e,r=t,n=[],i=0;r;){if(null!==(e=o.text.exec(r)))n.push(e[0]);else if(null!==(e=o.modulo.exec(r)))n.push("%");else{if(null===(e=o.placeholder.exec(r)))throw new SyntaxError("[sprintf] unexpected placeholder");if(e[2]){i|=1;var a=[],l=e[2],u=[];if(null===(u=o.key.exec(l)))throw new SyntaxError("[sprintf] failed to parse named argument key");for(a.push(u[1]);""!==(l=l.substring(u[0].length));)if(null!==(u=o.key_access.exec(l)))a.push(u[1]);else{if(null===(u=o.index_access.exec(l)))throw new SyntaxError("[sprintf] failed to parse named argument key");a.push(u[1])}e[2]=a}else i|=2;if(3===i)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");n.push(e)}r=r.substring(e[0].length)}return s[t]=n}var o={not_string:/[^s]/,not_bool:/[^t]/,not_type:/[^T]/,not_primitive:/[^v]/,number:/[diefg]/,numeric_arg:/[bcdiefguxX]/,json:/[j]/,not_json:/[^j]/,text:/^[^\x25]+/,modulo:/^\x25{2}/,placeholder:/^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijostTuvxX])/,key:/^([a-z_][a-z_\d]*)/i,key_access:/^\.([a-z_][a-z_\d]*)/i,index_access:/^\[(\d+)\]/,sign:/^[\+\-]/},s=Object.create(null);void 0!==n&&(n.sprintf=e,n.vsprintf=r),"undefined"!=typeof window&&(window.sprintf=e,window.vsprintf=r,"function"==typeof t&&t.amd&&t(function(){return{sprintf:e,vsprintf:r}}))}()},{}],250:[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"}},{}],251:[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;u>>7){");for(var u=0;u<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;bb)&&!(u&1<<_)!=!(u&1<0&&(k="+"+v[x]+"*c");var T=p[x].length/y*.5,E=.5+m[x]/y*.5;A.push("d"+x+"-"+E+"-"+T+"*("+p[x].join("+")+k+")/("+g[x].join("+")+")")}h.push("a.push([",A.join(),"]);","break;")}n.push("}},"),f.length>0&&h.push("}}");for(var L=[],u=0;u<1<.5?l/(2-a-o):l/(a+o),a){case t:n=(e-r)/l+(e1&&(r-=1),r<1/6?t+6*(e-t)*r:r<.5?e:r<2/3?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=r<.5?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 l(t,e,r){t=E(t,255),e=E(e,255),r=E(r,255);var n,i,a=q(t,e,r),o=H(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+(e>1)+720)%360;--e;)i.h=(i.h+a)%360,o.push(n(i));return o}function k(t,e){e=e||6;for(var r=n(t).toHsv(),i=r.h,a=r.s,o=r.v,s=[],l=1/e;e--;)s.push(n({h:i,s:a,v:o})),o=(o+l)%1;return s}function T(t){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}function E(t,r){S(t)&&(t="100%");var n=P(t);return t=H(r,q(0,parseFloat(t))),n&&(t=parseInt(t*r,10)/100),e.abs(t-r)<1e-6?1:t%r/parseFloat(r)}function L(t){return H(1,q(0,t))}function C(t){return parseInt(t,16)}function S(t){return"string"==typeof t&&-1!=t.indexOf(".")&&1===parseFloat(t)}function P(t){return"string"==typeof t&&-1!=t.indexOf("%")}function R(t){return 1==t.length?"0"+t:""+t}function O(t){return t<=1&&(t=100*t+"%"),t}function N(t){return e.round(255*parseFloat(t)).toString(16)}function I(t){return C(t)/255}function z(t){return!!Y.CSS_UNIT.exec(t)}function D(t){t=t.replace(F,"").replace(B,"").toLowerCase();var e=!1;if(X[t])t=X[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))?{r:C(r[1]),g:C(r[2]),b:C(r[3]),a:I(r[4]),format:e?"name":"hex8"}:(r=Y.hex6.exec(t))?{r:C(r[1]),g:C(r[2]),b:C(r[3]),format:e?"name":"hex"}:(r=Y.hex4.exec(t))?{r:C(r[1]+""+r[1]),g:C(r[2]+""+r[2]),b:C(r[3]+""+r[3]),a:I(r[4]+""+r[4]),format:e?"name":"hex8"}:!!(r=Y.hex3.exec(t))&&{r:C(r[1]+""+r[1]),g:C(r[2]+""+r[2]),b:C(r[3]+""+r[3]),format:e?"name":"hex"}}function j(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+/,B=/\s+$/,U=0,V=e.round,H=e.min,q=e.max,G=e.random;n.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,r,n,i,a,o,s=this.toRgb();return t=s.r/255,r=s.g/255,n=s.b/255,i=t<=.03928?t/12.92:e.pow((t+.055)/1.055,2.4),a=r<=.03928?r/12.92:e.pow((r+.055)/1.055,2.4),o=n<=.03928?n/12.92:e.pow((n+.055)/1.055,2.4),.2126*i+.7152*a+.0722*o},setAlpha:function(t){return this._a=T(t),this._roundA=V(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=V(360*t.h),r=V(100*t.s),n=V(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=V(360*t.h),r=V(100*t.s),n=V(100*t.l);return 1==this._a?"hsl("+e+", "+r+"%, "+n+"%)":"hsla("+e+", "+r+"%, "+n+"%, "+this._roundA+")"},toHex:function(t){return c(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(t){return f(this._r,this._g,this._b,this._a,t)},toHex8String:function(t){return"#"+this.toHex8(t)},toRgb:function(){return{r:V(this._r),g:V(this._g),b:V(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+V(this._r)+", "+V(this._g)+", "+V(this._b)+")":"rgba("+V(this._r)+", "+V(this._g)+", "+V(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:V(100*E(this._r,255))+"%",g:V(100*E(this._g,255))+"%",b:V(100*E(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+V(100*E(this._r,255))+"%, "+V(100*E(this._g,255))+"%, "+V(100*E(this._b,255))+"%)":"rgba("+V(100*E(this._r,255))+"%, "+V(100*E(this._g,255))+"%, "+V(100*E(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&(W[c(this._r,this._g,this._b,!0)]||!1)},toFilter:function(t){var e="#"+h(this._r,this._g,this._b,this._a),r=e,i=this._gradientType?"GradientType = 1, ":"";if(t){var a=n(t);r="#"+h(a._r,a._g,a._b,a._a)}return"progid:DXImageTransform.Microsoft.gradient("+i+"startColorstr="+e+",endColorstr="+r+")"},toString:function(t){var e=!!t;t=t||this._format;var r=!1,n=this._a<1&&this._a>=0;return e||!n||"hex"!==t&&"hex6"!==t&&"hex3"!==t&&"hex4"!==t&&"hex8"!==t&&"name"!==t?("rgb"===t&&(r=this.toRgbString()),"prgb"===t&&(r=this.toPercentageRgbString()),"hex"!==t&&"hex6"!==t||(r=this.toHexString()),"hex3"===t&&(r=this.toHexString(!0)),"hex4"===t&&(r=this.toHex8String(!0)),"hex8"===t&&(r=this.toHex8String()),"name"===t&&(r=this.toName()),"hsl"===t&&(r=this.toHslString()),"hsv"===t&&(r=this.toHsvString()),r||this.toHexString()):"name"===t&&0===this._a?this.toName():this.toRgbString()},clone:function(){return n(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(v,arguments)},brighten:function(){return this._applyModification(m,arguments)},darken:function(){return this._applyModification(y,arguments)},desaturate:function(){return this._applyModification(d,arguments)},saturate:function(){return this._applyModification(p,arguments)},greyscale:function(){return this._applyModification(g,arguments)},spin:function(){return this._applyModification(b,arguments)},_applyCombination:function(t,e){return t.apply(null,[this].concat([].slice.call(e)))},analogous:function(){return this._applyCombination(A,arguments)},complement:function(){return this._applyCombination(x,arguments)},monochromatic:function(){return this._applyCombination(k,arguments)},splitcomplement:function(){return this._applyCombination(M,arguments)},triad:function(){return this._applyCombination(_,arguments)},tetrad:function(){return this._applyCombination(w,arguments)}},n.fromRatio=function(t,e){if("object"==typeof t){var r={};for(var i in t)t.hasOwnProperty(i)&&(r[i]="a"===i?t[i]:O(t[i]));t=r}return n(t,e)},n.equals=function(t,e){return!(!t||!e)&&n(t).toRgbString()==n(e).toRgbString()},n.random=function(){return n.fromRatio({r:G(),g:G(),b:G()})},n.mix=function(t,e,r){r=0===r?0:r||50;var i=n(t).toRgb(),a=n(e).toRgb(),o=r/100;return n({r:(a.r-i.r)*o+i.r,g:(a.g-i.g)*o+i.g,b:(a.b-i.b)*o+i.b,a:(a.a-i.a)*o+i.a})},n.readability=function(t,r){var i=n(t),a=n(r);return(e.max(i.getLuminance(),a.getLuminance())+.05)/(e.min(i.getLuminance(),a.getLuminance())+.05)},n.isReadable=function(t,e,r){var i,a,o=n.readability(t,e);switch(a=!1,i=j(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},n.mostReadable=function(t,e,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=n(e[c]));return n.isReadable(t,l,{level:o,size:s})||!a?l:(r.includeFallbackColors=!1,n.mostReadable(t,["#fff","#000"],r))};var X=n.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"},W=n.hexNames=function(t){var e={};for(var r in t)t.hasOwnProperty(r)&&(e[t[r]]=r);return e}(X),Y=function(){var t="(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)",e="[\\s|\\(]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")\\s*\\)?",r="[\\s|\\(]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")\\s*\\)?";return{CSS_UNIT:new RegExp(t),rgb:new RegExp("rgb"+e),rgba:new RegExp("rgba"+r),hsl:new RegExp("hsl"+e),hsla:new RegExp("hsla"+r),hsv:new RegExp("hsv"+e),hsva:new RegExp("hsva"+r),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})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();void 0!==r&&r.exports?r.exports=n:"function"==typeof t&&t.amd?t(function(){return n}):window.tinycolor=n}(Math)},{}],253:[function(t,e,r){"use strict";function n(t,e){var r=o(getComputedStyle(t).getPropertyValue(e));return r[0]*a(r[1],t)}function i(t,e){var r=document.createElement("div");r.style["font-size"]="128"+t,e.appendChild(r);var i=n(r,"font-size")/128;return e.removeChild(r),i}function a(t,e){switch(e=e||document.body,t=(t||"px").trim().toLowerCase(),e!==window&&e!==document||(e=document.body),t){case"%":return e.clientHeight/100;case"ch":case"ex":return i(t,e);case"em":return n(e,"font-size");case"rem":return n(document.body,"font-size");case"vw":return window.innerWidth/100;case"vh":return window.innerHeight/100;case"vmin":return Math.min(window.innerWidth,window.innerHeight)/100;case"vmax":return Math.max(window.innerWidth,window.innerHeight)/100;case"in":return s;case"cm":return s/2.54;case"mm":return s/25.4;case"pt":return s/72;case"pc":return s/6}return 1}var o=t("parse-unit");e.exports=a;var s=96},{"parse-unit":209}],254:[function(t,e,r){"use strict";function n(t){if(t<0)return[];if(0===t)return[[0]];for(var e=0|Math.round(o(t+1)),r=[],n=0;nMath.max(r,n)?i[2]=1:r>Math.max(e,n)?i[0]=1:i[1]=1;for(var a=0,o=0,s=0;s<3;++s)a+=t[s]*t[s],o+=i[s]*t[s];for(var s=0;s<3;++s)i[s]-=o/a*t[s];return h(i,i),i}function o(t,e,r,n,i,a,o,s){this.center=l(r),this.up=l(n),this.right=l(i),this.radius=l([a]),this.angle=l([o,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;u<16;++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||a(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),h(r,r),i=[].slice.call(i,0,3),h(i,i),"eye"in t){var c=t.eye,p=[c[0]-e[0],c[1]-e[1],c[2]-e[2]];f(i,p,r),n(i[0],i[1],i[2])<1e-6?i=a(r):h(i,i),s=n(p[0],p[1],p[2]);var g=d(r,p)/s,v=d(i,p)/s;u=Math.acos(g),l=Math.acos(v)}return s=Math.log(s),new o(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"),f=t("gl-vec3/cross"),h=t("gl-vec3/normalize"),d=t("gl-vec3/dot"),p=o.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,a=0,o=0;o<3;++o)a+=e[o]*r[o],i+=e[o]*e[o];for(var s=Math.sqrt(i),l=0,o=0;o<3;++o)r[o]-=e[o]*a/i,l+=r[o]*r[o],e[o]/=s;for(var u=Math.sqrt(l),o=0;o<3;++o)r[o]/=u;var c=this.computedToward;f(c,e,r),h(c,c);for(var d=Math.exp(this.computedRadius[0]),p=this.computedAngle[0],g=this.computedAngle[1],v=Math.cos(p),m=Math.sin(p),y=Math.cos(g),b=Math.sin(g),x=this.computedCenter,_=v*y,w=m*y,M=b,A=-v*b,k=-m*b,T=y,E=this.computedEye,L=this.computedMatrix,o=0;o<3;++o){var C=_*r[o]+w*c[o]+M*e[o];L[4*o+1]=A*r[o]+k*c[o]+T*e[o],L[4*o+2]=C,L[4*o+3]=0}var S=L[1],P=L[5],R=L[9],O=L[2],N=L[6],I=L[10],z=P*I-R*N,D=R*O-S*I,j=S*N-P*O,F=n(z,D,j);z/=F,D/=F,j/=F,L[0]=z,L[4]=D,L[8]=j;for(var o=0;o<3;++o)E[o]=x[o]+L[2+4*o]*d;for(var o=0;o<3;++o){for(var l=0,B=0;B<3;++B)l+=L[o+4*B]*E[B];L[12+o]=-l}L[15]=1},p.getMatrix=function(t,e){this.recalcMatrix(t);var r=this.computedMatrix;if(e){for(var n=0;n<16;++n)e[n]=r[n];return e}return r};var g=[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;g[0]=i[2],g[1]=i[6],g[2]=i[10];for(var a=this.computedUp,o=this.computedRight,s=this.computedToward,l=0;l<3;++l)i[4*l]=a[l],i[4*l+1]=o[l],i[4*l+2]=s[l];c(i,i,n,g);for(var l=0;l<3;++l)a[l]=i[4*l],o[l]=i[4*l+1];this.up.set(t,a[0],a[1],a[2]),this.right.set(t,o[0],o[1],o[2])}},p.pan=function(t,e,r,i){e=e||0,r=r||0,i=i||0,this.recalcMatrix(t);var a=this.computedMatrix,o=(Math.exp(this.computedRadius[0]),a[1]),s=a[5],l=a[9],u=n(o,s,l);o/=u,s/=u,l/=u;var c=a[0],f=a[4],h=a[8],d=c*o+f*s+h*l;c-=o*d,f-=s*d,h-=l*d;var p=n(c,f,h);c/=p,f/=p,h/=p;var g=c*e+o*r,v=f*e+s*r,m=h*e+l*r;this.center.move(t,g,v,m);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,a){var o=1;"number"==typeof r&&(o=0|r),(o<0||o>3)&&(o=1);var s=(o+2)%3;e||(this.recalcMatrix(t),e=this.computedMatrix);var l=e[o],c=e[o+4],f=e[o+8];if(a){var h=Math.abs(l),d=Math.abs(c),p=Math.abs(f),g=Math.max(h,d,p);h===g?(l=l<0?-1:1,c=f=0):p===g?(f=f<0?-1:1,l=c=0):(c=c<0?-1:1,l=f=0)}else{var v=n(l,c,f);l/=v,c/=v,f/=v}var m=e[s],y=e[s+4],b=e[s+8],x=m*l+y*c+b*f;m-=l*x,y-=c*x,b-=f*x;var _=n(m,y,b);m/=_,y/=_,b/=_;var w=c*b-f*y,M=f*m-l*b,A=l*y-c*m,k=n(w,M,A);w/=k,M/=k,A/=k,this.center.jump(t,q,G,X),this.radius.idle(t),this.up.jump(t,l,c,f),this.right.jump(t,m,y,b);var T,E;if(2===o){var L=e[1],C=e[5],S=e[9],P=L*m+C*y+S*b,R=L*w+C*M+S*A;T=z<0?-Math.PI/2:Math.PI/2,E=Math.atan2(R,P)}else{var O=e[2],N=e[6],I=e[10],z=O*l+N*c+I*f,D=O*m+N*y+I*b,j=O*w+N*M+I*A;T=Math.asin(i(z)),E=Math.atan2(j,D)}this.angle.jump(t,E,T),this.recalcMatrix(t);var F=e[2],B=e[6],U=e[10],V=this.computedMatrix;u(V,e);var H=V[15],q=V[12]/H,G=V[13]/H,X=V[14]/H,W=Math.exp(this.computedRadius[0]);this.center.jump(t,q-F*W,G-B*W,X-U*W)},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,a){this.recalcMatrix(t),e=e||this.computedEye,r=r||this.computedCenter,a=a||this.computedUp;var o=a[0],s=a[1],l=a[2],u=n(o,s,l);if(!(u<1e-6)){o/=u,s/=u,l/=u;var c=e[0]-r[0],f=e[1]-r[1],h=e[2]-r[2],d=n(c,f,h);if(!(d<1e-6)){c/=d,f/=d,h/=d;var p=this.computedRight,g=p[0],v=p[1],m=p[2],y=o*g+s*v+l*m;g-=y*o,v-=y*s,m-=y*l;var b=n(g,v,m);if(!(b<.01&&(g=s*h-l*f,v=l*c-o*h,m=o*f-s*c,(b=n(g,v,m))<1e-6))){g/=b,v/=b,m/=b,this.up.set(t,o,s,l),this.right.set(t,g,v,m),this.center.set(t,r[0],r[1],r[2]),this.radius.set(t,Math.log(d));var x=s*m-l*v,_=l*g-o*m,w=o*v-s*g,M=n(x,_,w);x/=M,_/=M,w/=M;var A=o*c+s*f+l*h,k=g*c+v*f+m*h,T=x*c+_*f+w*h,E=Math.asin(i(A)),L=Math.atan2(T,k),C=this.angle._state,S=C[C.length-1],P=C[C.length-2];S%=2*Math.PI;var R=Math.abs(S+2*Math.PI-L),O=Math.abs(S-L),N=Math.abs(S-2*Math.PI-L);R0?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=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=a,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 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;t<32;++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":35,buffer:45,dup:82}],259:[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;e8192)throw new Error("vectorize-text: String too long (sorry, this will get fixed later)");var a=3*n;t.height=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 o(t){var e,r,i=n(t);return i?u in i&&delete i[u]:!((e=s.indexOf(t))<0)&&(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||a();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(o)}})};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)}function n(t){var e=!!u.delete(t);return c?c.delete___(t)||e:e}this instanceof x||a();var l,u=new s,c=void 0,f=!1;return l=o?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})}})}o&&"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)}}()},{}],264:[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":265}],265:[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},{}],266:[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){return t(e).value=r,this},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":264}],267:[function(t,e,r){var n=t("get-canvas-context");e.exports=function(t){return n("webgl",t)}},{"get-canvas-context":91}],268:[function(t,e,r){e.exports=t("cwise-compiler")({args:["array",{offset:[1],array:0},"scalar","scalar","index"],pre:{body:"{}",args:[],thisVars:[],localVars:[]},post:{body:"{}",args:[],thisVars:[],localVars:[]},body:{body:"{\n var _inline_1_da = _inline_1_arg0_ - _inline_1_arg3_\n var _inline_1_db = _inline_1_arg1_ - _inline_1_arg3_\n if((_inline_1_da >= 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":75}],269:[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":268}],270:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../plots/cartesian/axes"),a=t("./common_defaults"),o=t("./attributes");e.exports=function(t,e,r,s,l){function u(r,i){return n.coerce(t,e,o,r,i)}s=s||{},l=l||{};var c=u("visible",!l.itemIsNotPlainObject),f=u("clicktoshow");if(!c&&!f)return e;a(t,e,r,u);for(var h=e.showarrow,d=["x","y"],p=[-10,-30],g={_fullLayout:r},v=0;v<2;v++){var m=d[v],y=i.coerceRef(t,e,g,m,"","paper");if(i.coercePosition(e,g,u,y,m,.5),h){var b="a"+m,x=i.coerceRef(t,e,g,b,"pixel");"pixel"!==x&&x!==y&&(x=e[b]="pixel");var _="pixel"===x?p[v]:.4;i.coercePosition(e,g,u,x,b,_)}u(m+"anchor"),u(m+"shift")}if(n.noneOrAll(t,e,["x","y"]),h&&n.noneOrAll(t,e,["ax","ay"]),f){var w=u("xclick"),M=u("yclick");e._xclick=void 0===w?e.x:i.cleanPosition(w,g,e.xref),e._yclick=void 0===M?e.y:i.cleanPosition(M,g,e.yref)}return e}},{"../../lib":404,"../../plots/cartesian/axes":442,"./attributes":272,"./common_defaults":275}],271:[function(t,e,r){"use strict";e.exports=[{path:"",backoff:0},{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}]},{}],272:[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:"annotation",visible:{valType:"boolean",dflt:!0},text:{valType:"string"},textangle:{valType:"angle",dflt:0},font:o({},i,{}),width:{valType:"number",min:1,dflt:null},height:{valType:"number",min:1,dflt:null},opacity:{valType:"number",min:0,max:1,dflt:1},align:{valType:"enumerated",values:["left","center","right"],dflt:"center"},valign:{valType:"enumerated",values:["top","middle","bottom"],dflt:"middle"},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},standoff:{valType:"number",min:0,dflt:0},ax:{valType:"any"},ay:{valType:"any"},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:"any"},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"auto"},xshift:{valType:"number",dflt:0},yref:{valType:"enumerated",values:["paper",a.idRegex.y.toString()]},y:{valType:"any"},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto"},yshift:{valType:"number",dflt:0},clicktoshow:{valType:"enumerated",values:[!1,"onoff","onout"],dflt:!1},xclick:{valType:"any"},yclick:{valType:"any"},hovertext:{valType:"string"},hoverlabel:{bgcolor:{valType:"color"},bordercolor:{valType:"color"},font:o({},i,{})},captureevents:{valType:"boolean"},_deprecated:{ref:{valType:"string"}}}},{"../../lib/extend":397,"../../plots/cartesian/constants":447,"../../plots/font_attributes":466,"./arrow_paths":271}],273:[function(t,e,r){"use strict";function n(t){var e=t._fullLayout;i.filterVisible(e.annotations).forEach(function(e){var r,n,i=a.getFromId(t,e.xref),o=a.getFromId(t,e.yref),s=3*e.arrowsize*e.arrowwidth||0;i&&i.autorange&&(r=s+e.xshift,n=s-e.xshift,e.axref===e.xref?(a.expand(i,[i.r2c(e.x)],{ppadplus:r,ppadminus:n}),a.expand(i,[i.r2c(e.ax)],{ppadplus:e._xpadplus,ppadminus:e._xpadminus})):a.expand(i,[i.r2c(e.x)],{ppadplus:Math.max(e._xpadplus,r),ppadminus:Math.max(e._xpadminus,n)})),o&&o.autorange&&(r=s-e.yshift,n=s+e.yshift,e.ayref===e.yref?(a.expand(o,[o.r2c(e.y)],{ppadplus:r,ppadminus:n}),a.expand(o,[o.r2c(e.ay)],{ppadplus:e._ypadplus,ppadminus:e._ypadminus})):a.expand(o,[o.r2c(e.y)],{ppadplus:Math.max(e._ypadplus,r),ppadminus:Math.max(e._ypadminus,n)}))})}var i=t("../../lib"),a=t("../../plots/cartesian/axes"),o=t("./draw").draw;e.exports=function(t){var e=t._fullLayout,r=i.filterVisible(e.annotations);if(r.length&&t._fullData.length){var s={};r.forEach(function(t){s[t.xref]=!0,s[t.yref]=!0});if(a.list(t).filter(function(t){return t.autorange&&s[t._id]}).length)return i.syncOrAsync([o,n],t)}}},{"../../lib":404,"../../plots/cartesian/axes":442,"./draw":278}],274:[function(t,e,r){"use strict";function n(t,e){var r=a(t,e);return r.on.length>0||r.explicitOff.length>0}function i(t,e){var r,n=a(t,e),i=n.on,o=n.off.concat(n.explicitOff),l={};if(i.length||o.length){for(r=0;r2/3?"right":"center"),{center:0,middle:0,left:.5,bottom:-.5,right:-.5,top:.5}[e]}var o=j.selectAll("a");if(1===o.size()&&o.text()===j.text()){S.insert("a",":first-child").attr({"xlink:xlink:href":o.attr("xlink:href"),"xlink:xlink:show":o.attr("xlink:show")}).style({cursor:"pointer"}).node().appendChild(N.node())}var l=S.select(".annotation-text-math-group"),c=!l.empty(),d=h.bBox((c?l:j).node()),y=d.width,C=d.height,R=e.width||y,D=e.height||C,F=Math.round(R+2*O),B=Math.round(D+2*O);e._w=R,e._h=D;for(var U=!1,V=["x","y"],H=0;H1)&&($===Q?((ot=K.r2fraction(e["a"+Z]))<0||ot>1)&&(U=!0):U=!0,U))continue;q=K._offset+K.r2p(e[Z]),W=.5}else"x"===Z?(X=e[Z],q=_.l+_.w*X):(X=1-e[Z],q=_.t+_.h*X),W=e.showarrow?.5:X;if(e.showarrow){at.head=q;var st=e["a"+Z];Y=tt*r(.5,e.xanchor)-et*r(.5,e.yanchor),$===Q?(at.tail=K._offset+K.r2p(st),G=Y):(at.tail=q+st,G=Y+st),at.text=at.tail+Y;var lt=x["x"===Z?"width":"height"];if("paper"===Q&&(at.head=u.constrain(at.head,1,lt-1)),"pixel"===$){var ut=-Math.max(at.tail-3,at.text),ct=Math.min(at.tail+3,at.text)-lt;ut>0?(at.tail+=ut,at.text+=ut):ct>0&&(at.tail-=ct,at.text-=ct)}at.tail+=it,at.head+=it}else Y=rt*r(W,nt),G=Y,at.text=q+Y;at.text+=it,Y+=it,G+=it,e["_"+Z+"padplus"]=rt/2+G,e["_"+Z+"padminus"]=rt/2-G,e["_"+Z+"size"]=rt,e["_"+Z+"shift"]=Y}if(U)return void S.remove();var ft=0,ht=0;if("left"!==e.align&&(ft=(R-y)*("center"===e.align?.5:1)),"top"!==e.valign&&(ht=(D-C)*("middle"===e.valign?.5:1)),c)l.select("svg").attr({x:O+ft-1,y:O+ht}).call(h.setClipUrl,I?M:null);else{var dt=O+ht-d.top,pt=O+ft-d.left;j.call(p.positionText,pt,dt).call(h.setClipUrl,I?M:null)}z.select("rect").call(h.setRect,O,O,R,D),N.call(h.setRect,P/2,P/2,F-P,B-P),S.call(h.setTranslate,Math.round(A.x.text-F/2),Math.round(A.y.text-B/2)),E.attr({transform:"rotate("+k+","+A.x.text+","+A.y.text+")"});var gt=function(r,o){T.selectAll(".annotation-arrow-g").remove();var l=A.x.head,c=A.y.head,d=A.x.tail+r,p=A.y.tail+o,g=A.x.text+r,y=A.y.text+o,x=u.rotationXYMatrix(k,g,y),M=u.apply2DTransform(x),L=u.apply2DTransform2(x),C=+N.attr("width"),P=+N.attr("height"),R=g-.5*C,O=R+C,I=y-.5*P,z=I+P,D=[[R,I,R,z],[R,z,O,z],[O,z,O,I],[O,I,R,I]].map(L);if(!D.reduce(function(t,e){return t^!!u.segmentsIntersect(l,c,l+1e6,c+1e6,e[0],e[1],e[2],e[3])},!1)){D.forEach(function(t){var e=u.segmentsIntersect(d,p,l,c,t[0],t[1],t[2],t[3]);e&&(d=e.x,p=e.y)});var j=e.arrowwidth,F=e.arrowcolor,B=T.append("g").style({opacity:f.opacity(F)}).classed("annotation-arrow-g",!0),U=B.append("path").attr("d","M"+d+","+p+"L"+l+","+c).style("stroke-width",j+"px").call(f.stroke,f.rgb(F));if(m(U,e.arrowhead,"end",e.arrowsize,e.standoff),w.annotationPosition&&U.node().parentNode&&!n){var V=l,H=c;if(e.standoff){var q=Math.sqrt(Math.pow(l-d,2)+Math.pow(c-p,2));V+=e.standoff*(d-l)/q,H+=e.standoff*(p-c)/q}var G,X,W,Y=B.append("path").classed("annotation-arrow",!0).classed("anndrag",!0).attr({d:"M3,3H-3V-3H3ZM0,0L"+(d-V)+","+(p-H),transform:"translate("+V+","+H+")"}).style("stroke-width",j+6+"px").call(f.stroke,"rgba(0,0,0,0)").call(f.fill,"rgba(0,0,0,0)");v.init({element:Y.node(),gd:t,prepFn:function(){var t=h.getTranslate(S);X=t.x,W=t.y,G={},i&&i.autorange&&(G[i._name+".autorange"]=!0),a&&a.autorange&&(G[a._name+".autorange"]=!0)},moveFn:function(t,r){var n=M(X,W),o=n[0]+t,s=n[1]+r;S.call(h.setTranslate,o,s),G[b+".x"]=i?i.p2r(i.r2p(e.x)+t):e.x+t/_.w,G[b+".y"]=a?a.p2r(a.r2p(e.y)+r):e.y-r/_.h,e.axref===e.xref&&(G[b+".ax"]=i.p2r(i.r2p(e.ax)+t)),e.ayref===e.yref&&(G[b+".ay"]=a.p2r(a.r2p(e.ay)+r)),B.attr("transform","translate("+t+","+r+")"),E.attr({transform:"rotate("+k+","+o+","+s+")"})},doneFn:function(e){if(e){s.relayout(t,G);var r=document.querySelector(".js-notes-box-panel");r&&r.redraw(r.selectedObj)}}})}}};if(e.showarrow&>(0,0),L){var vt,mt;v.init({element:S.node(),gd:t,prepFn:function(){mt=E.attr("transform"),vt={}},moveFn:function(t,r){var o="pointer";if(e.showarrow)e.axref===e.xref?vt[b+".ax"]=i.p2r(i.r2p(e.ax)+t):vt[b+".ax"]=e.ax+t,e.ayref===e.yref?vt[b+".ay"]=a.p2r(a.r2p(e.ay)+r):vt[b+".ay"]=e.ay+r,gt(t,r);else{if(n)return;if(i)vt[b+".x"]=e.x+t/i._m;else{var s=e._xsize/_.w,l=e.x+(e._xshift-e.xshift)/_.w-s/2;vt[b+".x"]=v.align(l+t/_.w,s,0,1,e.xanchor)}if(a)vt[b+".y"]=e.y+r/a._m;else{var u=e._ysize/_.h,c=e.y-(e._yshift+e.yshift)/_.h-u/2;vt[b+".y"]=v.align(c-r/_.h,u,0,1,e.yanchor)}i&&a||(o=v.getCursor(i?.5:vt[b+".x"],a?.5:vt[b+".y"],e.xanchor,e.yanchor))}E.attr({transform:"translate("+t+","+r+")"+mt}),g(S,o)},doneFn:function(e){if(g(S),e){s.relayout(t,vt);var r=document.querySelector(".js-notes-box-panel");r&&r.redraw(r.selectedObj)}}})}}var y,b,x=t._fullLayout,_=t._fullLayout._size,w=t._context.edits;n?(y="annotation-"+n,b=n+".annotations["+r+"]"):(y="annotation",b="annotations["+r+"]"),x._infolayer.selectAll("."+y+'[data-index="'+r+'"]').remove();var M="clip"+x._uid+"_ann"+r;if(!e._input||!1===e.visible)return void o.selectAll("#"+M).remove();var A={x:{},y:{}},k=+e.textangle||0,T=x._infolayer.append("g").classed(y,!0).attr("data-index",String(r)).style("opacity",e.opacity),E=T.append("g").classed("annotation-text-g",!0),L=w[e.showarrow?"annotationTail":"annotationPosition"],C=e.captureevents||w.annotationText||L,S=E.append("g").style("pointer-events",C?"all":null).call(g,"default").on("click",function(){t._dragging=!1;var i={index:r,annotation:e._input,fullAnnotation:e,event:o.event};n&&(i.subplotId=n),t.emit("plotly_clickannotation",i)});e.hovertext&&S.on("mouseover",function(){var r=e.hoverlabel,n=r.font,i=this.getBoundingClientRect(),a=t.getBoundingClientRect();d.loneHover({x0:i.left-a.left,x1:i.right-a.left,y:(i.top+i.bottom)/2-a.top,text:e.hovertext,color:r.bgcolor,borderColor:r.bordercolor,fontFamily:n.family,fontSize:n.size,fontColor:n.color},{container:x._hoverlayer.node(),outerContainer:x._paper.node(),gd:t})}).on("mouseout",function(){d.loneUnhover(x._hoverlayer.node())});var P=e.borderwidth,R=e.borderpad,O=P+R,N=S.append("rect").attr("class","bg").style("stroke-width",P+"px").call(f.stroke,e.bordercolor).call(f.fill,e.bgcolor),I=e.width||e.height,z=x._defs.select(".clips").selectAll("#"+M).data(I?[0]:[]);z.enter().append("clipPath").classed("annclip",!0).attr("id",M).append("rect"),z.exit().remove();var D=e.font,j=S.append("text").classed("annotation-text",!0).text(e.text);w.annotationText?j.call(p.makeEditable,{delegate:S,gd:t}).call(l).on("edit",function(r){e.text=r,this.call(l);var n={};n[b+".text"]=e.text,i&&i.autorange&&(n[i._name+".autorange"]=!0),a&&a.autorange&&(n[a._name+".autorange"]=!0),s.relayout(t,n)}):j.call(l)}var o=t("d3"),s=t("../../plotly"),l=t("../../plots/plots"),u=t("../../lib"),c=t("../../plots/cartesian/axes"),f=t("../color"),h=t("../drawing"),d=t("../fx"),p=t("../../lib/svg_text_utils"),g=t("../../lib/setcursor"),v=t("../dragelement"),m=t("./draw_arrow_head");e.exports={draw:n,drawOne:i,drawRaw:a}},{"../../lib":404,"../../lib/setcursor":419,"../../lib/svg_text_utils":423,"../../plotly":437,"../../plots/cartesian/axes":442,"../../plots/plots":482,"../color":287,"../dragelement":308,"../drawing":311,"../fx":328,"./draw_arrow_head":279,d3:79}],279:[function(t,e,r){"use strict";var n=t("d3"),i=t("fast-isnumeric"),a=t("../color"),o=t("../drawing"),s=t("./arrow_paths");e.exports=function(t,e,r,l,u){function c(){t.style("stroke-dasharray","0px,100px")}function f(r,i){d.path&&(e>5&&(i=0),n.select(h.parentNode).append("path").attr({class:t.attr("class"),d:d.path,transform:"translate("+r.x+","+r.y+")rotate("+180*i/Math.PI+")scale("+y+")"}).style({fill:b,opacity:x,"stroke-width":0}))}i(l)||(l=1);var h=t.node(),d=s[e||0];"string"==typeof r&&r||(r="end");var p,g,v,m,y=(o.getPx(t,"stroke-width")||1)*l,b=t.style("stroke")||a.defaultLine,x=t.style("stroke-opacity")||1,_=r.indexOf("start")>=0,w=r.indexOf("end")>=0,M=d.backoff*y+u;if("line"===h.nodeName){p={x:+t.attr("x1"),y:+t.attr("y1")},g={x:+t.attr("x2"),y:+t.attr("y2")};var A=p.x-g.x,k=p.y-g.y;if(v=Math.atan2(k,A),m=v+Math.PI,M){if(M*M>A*A+k*k)return void c();var T=M*Math.cos(v),E=M*Math.sin(v);_&&(p.x-=T,p.y-=E,t.attr({x1:p.x,y1:p.y})),w&&(g.x+=T,g.y+=E,t.attr({x2:g.x,y2:g.y}))}}else if("path"===h.nodeName){var L=h.getTotalLength(),C="";if(L1){u=!0;break}}u?t.fullLayout._infolayer.select(".annotation-"+t.id+'[data-index="'+s+'"]').remove():(l.pdata=i(t.glplot.cameraParams,[e.xaxis.r2l(l.x)*r[0],e.yaxis.r2l(l.y)*r[1],e.zaxis.r2l(l.z)*r[2]]),n(t.graphDiv,l,s,t.id,l._xa,l._ya))}}},{"../../plots/gl3d/project":478,"../annotations/draw":278}],285:[function(t,e,r){"use strict";e.exports={moduleType:"component",name:"annotations3d",schema:{layout:{"scene.annotations":t("./attributes")}},layoutAttributes:t("./attributes"),handleDefaults:t("./defaults"),convert:t("./convert"),draw:t("./draw")}},{"./attributes":281,"./convert":282,"./defaults":283,"./draw":284}],286:[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},{}],287:[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;var l=o.defaultLine=s.defaultLine;o.lightLine=s.lightLine;var u=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||u).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},o={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(o).toRgbString()},o.contrast=function(t,e,r){var n=i(t);return 1!==n.getAlpha()&&(n=i(o.combine(t,u))),(n.isDark()?e?n.lighten(e):u:r?n.darken(r):l).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;e=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}},{}],338:[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":397,"../../plots/font_attributes":466,"../color/attributes":286}],339:[function(t,e,r){"use strict";e.exports={scrollBarWidth:4,scrollBarHeight:20,scrollBarColor:"#808BA4",scrollBarMargin:4}},{}],340:[function(t,e,r){"use strict";var n=t("../../registry"),i=t("../../lib"),a=t("./attributes"),o=t("../../plots/layout_attributes"),s=t("./helpers");e.exports=function(t,e,r){function l(t,e){return i.coerce(d,p,a,t,e)}for(var u,c,f,h,d=t.legend||{},p=e.legend={},g=0,v="normal",m=0;m1)){if(l("bgcolor",e.paper_bgcolor),l("bordercolor"),l("borderwidth"),i.coerceFont(l,"font",e.font),l("orientation"),"h"===p.orientation){var b=t.xaxis;b&&b.rangeslider&&b.rangeslider.visible?(u=0,f="left",c=1.1,h="bottom"):(u=0,f="left",c=-.1,h="top")}l("traceorder",v),s.isGrouped(e.legend)&&l("tracegroupgap"),l("x",u),l("xanchor",f),l("y",c),l("yanchor",h),i.noneOrAll(d,p,["x","y"])}}},{"../../lib":404,"../../plots/layout_attributes":480,"../../registry":490,"./attributes":338,"./helpers":343}],341:[function(t,e,r){"use strict";function n(t,e){function r(r){y.convertToTspans(r,e,function(){o(t,e)})}var n=t.data()[0][0],i=e._fullLayout,a=n.trace,s=p.traceIs(a,"pie"),l=a.index,u=s?n.label:a.name,c=t.selectAll("text.legendtext").data([0]);c.enter().append("text").classed("legendtext",!0),c.attr("text-anchor","start").classed("user-select-none",!0).call(v.font,i.legend.font).text(u),e._context.edits.legendText&&!s?c.call(y.makeEditable,{gd:e}).call(r).on("edit",function(t){this.text(t).call(r),this.text()||(t=" ");var i,a=n.trace._fullInput||{};if(-1!==["ohlc","candlestick"].indexOf(a.type)){var o=n.trace.transforms;i=o[o.length-1].direction+".name"}else i="name";f.restyle(e,i,t,l)}):c.call(r)}function i(t,e){var r,n=1,i=t.selectAll("rect").data([0]);i.enter().append("rect").classed("legendtoggle",!0).style("cursor","pointer").attr("pointer-events","all").call(m.fill,"rgba(0,0,0,0)"),i.on("mousedown",function(){r=(new Date).getTime(),r-e._legendMouseDownTimeE&&(n=Math.max(n-1,1)),1===n?r._clickTimeout=setTimeout(function(){a(t,e,n)},E):2===n&&(r._clickTimeout&&clearTimeout(r._clickTimeout),e._legendMouseDownTime=0,a(t,e,n))}})}function a(t,e,r){if(!e._dragged&&!e._editing){var n,i,a=e._fullLayout.hiddenlabels?e._fullLayout.hiddenlabels.slice():[],o=t.data()[0][0],s=e._fullData,l=o.trace,u=l.legendgroup,c=[];if(1===r&&T&&e.data&&e._context.showTips?(h.notifier("Double click on legend to isolate individual trace","long"),T=!1):T=!1,p.traceIs(l,"pie")){var d=o.label,g=a.indexOf(d);1===r?-1===g?a.push(d):a.splice(g,1):2===r&&(a=[],e.calcdata[0].forEach(function(t){d!==t.label&&a.push(t.label)}),e._fullLayout.hiddenlabels&&e._fullLayout.hiddenlabels.length===a.length&&-1===g&&(a=[])),f.relayout(e,"hiddenlabels",a)}else{var v,m=[],y=[];for(v=0;vn.width-(n.margin.r+n.margin.l)&&(b=0,g+=m,i.height=i.height+m,m=0),v.setTranslate(this,a+b,5+a+e.height/2+g),i.width+=o+r,i.height=Math.max(i.height,e.height),b+=o+r,m=Math.max(e.height,m)}),i.width+=2*a,i.height+=10+2*a}i.width=Math.ceil(i.width),i.height=Math.ceil(i.height),r.each(function(e){var r=e[0];c.select(this).select(".legendtoggle").call(v.setRect,0,-r.height/2,(t._context.edits.legendText?0:i.width)+s,r.height)})}function l(t){var e=t._fullLayout,r=e.legend,n="left";k.isRightAnchor(r)?n="right":k.isCenterAnchor(r)&&(n="center");var i="top";k.isBottomAnchor(r)?i="bottom":k.isMiddleAnchor(r)&&(i="middle"),d.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 u(t){var e=t._fullLayout,r=e.legend,n="left";k.isRightAnchor(r)?n="right":k.isCenterAnchor(r)&&(n="center"),d.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 c=t("d3"),f=t("../../plotly"),h=t("../../lib"),d=t("../../plots/plots"),p=t("../../registry"),g=t("../dragelement"),v=t("../drawing"),m=t("../color"),y=t("../../lib/svg_text_utils"),b=t("./constants"),x=t("../../constants/interactions"),_=t("../../constants/alignment").LINE_SPACING,w=t("./get_legend_data"),M=t("./style"),A=t("./helpers"),k=t("./anchor_utils"),T=!0,E=x.DBLCLICKDELAY;e.exports=function(t){function e(t,e){C.attr("data-scroll",e).call(v.setTranslate,0,e),S.call(v.setRect,F,t,b.scrollBarWidth,b.scrollBarHeight),T.select("rect").attr({y:y.borderwidth-e})}var r=t._fullLayout,o="legend"+r._uid;if(r._infolayer&&t.calcdata){t._legendMouseDownTime||(t._legendMouseDownTime=0);var y=r.legend,x=r.showlegend&&w(t.calcdata,y),_=r.hiddenlabels||[];if(!r.showlegend||!x.length)return r._infolayer.selectAll(".legend").remove(),r._topdefs.select("#"+o).remove(),void d.autoMargin(t,"legend");var A=r._infolayer.selectAll("g.legend").data([0]);A.enter().append("g").attr({class:"legend","pointer-events":"all"});var T=r._topdefs.selectAll("#"+o).data([0]);T.enter().append("clipPath").attr("id",o).append("rect");var L=A.selectAll("rect.bg").data([0]);L.enter().append("rect").attr({class:"bg","shape-rendering":"crispEdges"}),L.call(m.stroke,y.bordercolor),L.call(m.fill,y.bgcolor),L.style("stroke-width",y.borderwidth+"px");var C=A.selectAll("g.scrollbox").data([0]);C.enter().append("g").attr("class","scrollbox");var S=A.selectAll("rect.scrollbar").data([0]);S.enter().append("rect").attr({class:"scrollbar",rx:20,ry:2,width:0,height:0}).call(m.fill,"#808BA4");var P=C.selectAll("g.groups").data(x);P.enter().append("g").attr("class","groups"),P.exit().remove();var R=P.selectAll("g.traces").data(h.identity);R.enter().append("g").attr("class","traces"),R.exit().remove(),R.call(M,t).style("opacity",function(t){var e=t[0].trace;return p.traceIs(e,"pie")?-1!==_.indexOf(t[0].label)?.5:1:"legendonly"===e.visible?.5:1}).each(function(){c.select(this).call(n,t).call(i,t)});var O=0!==A.enter().size();O&&(s(t,P,R),l(t));var N=r.width,I=r.height;s(t,P,R),y.height>I?u(t):l(t);var z=r._size,D=z.l+z.w*y.x,j=z.t+z.h*(1-y.y);k.isRightAnchor(y)?D-=y.width:k.isCenterAnchor(y)&&(D-=y.width/2),k.isBottomAnchor(y)?j-=y.height:k.isMiddleAnchor(y)&&(j-=y.height/2);var F=y.width,B=z.w;F>B?(D=z.l,F=B):(D+F>N&&(D=N-F),D<0&&(D=0),F=Math.min(N-D,y.width));var U=y.height,V=z.h;U>V?(j=z.t,U=V):(j+U>I&&(j=I-U),j<0&&(j=0),U=Math.min(I-j,y.height)),v.setTranslate(A,D,j);var H,q,G=U-b.scrollBarHeight-2*b.scrollBarMargin,X=y.height-U;if(y.height<=U||t._context.staticPlot)L.attr({width:F-y.borderwidth,height:U-y.borderwidth,x:y.borderwidth/2,y:y.borderwidth/2}),v.setTranslate(C,0,0),T.select("rect").attr({width:F-2*y.borderwidth,height:U-2*y.borderwidth,x:y.borderwidth,y:y.borderwidth}),C.call(v.setClipUrl,o);else{H=b.scrollBarMargin,q=C.attr("data-scroll")||0,L.attr({width:F-2*y.borderwidth+b.scrollBarWidth+b.scrollBarMargin,height:U-y.borderwidth,x:y.borderwidth/2,y:y.borderwidth/2}),T.select("rect").attr({width:F-2*y.borderwidth+b.scrollBarWidth+b.scrollBarMargin,height:U-2*y.borderwidth,x:y.borderwidth,y:y.borderwidth-q}),C.call(v.setClipUrl,o),O&&e(H,q),A.on("wheel",null),A.on("wheel",function(){q=h.constrain(C.attr("data-scroll")-c.event.deltaY/G*X,-X,0),H=b.scrollBarMargin-q/X*G,e(H,q),0!==q&&q!==-X&&c.event.preventDefault()}),S.on(".drag",null),C.on(".drag",null);var W=c.behavior.drag().on("drag",function(){H=h.constrain(c.event.y-b.scrollBarHeight/2,b.scrollBarMargin,b.scrollBarMargin+G),q=-(H-b.scrollBarMargin)/G*X,e(H,q)});S.call(W),C.call(W)}if(t._context.edits.legendPosition){var Y,Z,Q,$;A.classed("cursor-move",!0),g.init({element:A.node(),gd:t,prepFn:function(){var t=v.getTranslate(A);Q=t.x,$=t.y},moveFn:function(t,e){var r=Q+t,n=$+e;v.setTranslate(A,r,n),Y=g.align(r,0,z.l,z.l+z.w,y.xanchor),Z=g.align(n,0,z.t+z.h,z.t,y.yanchor)},doneFn:function(e,n,i){if(e&&void 0!==Y&&void 0!==Z)f.relayout(t,{"legend.x":Y,"legend.y":Z});else{var o=r._infolayer.selectAll("g.traces").filter(function(){var t=this.getBoundingClientRect();return i.clientX>=t.left&&i.clientX<=t.right&&i.clientY>=t.top&&i.clientY<=t.bottom});o.size()>0&&(1===n?A._clickTimeout=setTimeout(function(){a(o,t,n)},E):2===n&&(A._clickTimeout&&clearTimeout(A._clickTimeout),a(o,t,n)))}}})}}}},{"../../constants/alignment":383,"../../constants/interactions":386,"../../lib":404,"../../lib/svg_text_utils":423,"../../plotly":437,"../../plots/plots":482,"../../registry":490,"../color":287,"../dragelement":308,"../drawing":311,"./anchor_utils":337,"./constants":339,"./get_legend_data":342,"./helpers":343,"./style":345,d3:79}],342:[function(t,e,r){"use strict";var n=t("../../registry"),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;ar[1])return r[1]}return i}function i(t){return t[0]}var s,u,c=t[0],f=c.trace,h=l.hasMarkers(f),d=l.hasText(f),p=l.hasLines(f);if(h||d||p){var g={},v={};h&&(g.mc=r("marker.color",i),g.mo=r("marker.opacity",a.mean,[.2,1]),g.ms=r("marker.size",a.mean,[2,16]),g.mlc=r("marker.line.color",i),g.mlw=r("marker.line.width",a.mean,[0,5]),v.marker={sizeref:1,sizemin:1,sizemode:"diameter"}),p&&(v.line={width:r("line.width",i,[0,10])}),d&&(g.tx="Aa",g.tp=r("textposition",i),g.ts=10,g.tc=r("textfont.color",i),g.tf=r("textfont.family",i)),s=[a.minExtend(c,g)],u=a.minExtend(f,v)}var m=n.select(this).select("g.legendpoints"),y=m.selectAll("path.scatterpts").data(h?s:[]);y.enter().append("path").classed("scatterpts",!0).attr("transform","translate(20,0)"),y.exit().remove(),y.call(o.pointStyle,u,e),h&&(s[0].mrc=3);var b=m.selectAll("g.pointtext").data(d?s:[]);b.enter().append("g").classed("pointtext",!0).append("text").attr("transform","translate(20,0)"),b.exit().remove(),b.selectAll("text").call(o.textPointStyle,u,e)}function f(t){var e=t[0].trace,r=e.marker||{},a=r.line||{},o=n.select(this).select("g.legendpoints").selectAll("path.legendbar").data(i.traceIs(e,"bar")?[t]:[]);o.enter().append("path").classed("legendbar",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),o.exit().remove(),o.each(function(t){var e=n.select(this),i=t[0],o=(i.mlw+1||a.width+1)-1;e.style("stroke-width",o+"px").call(s.fill,i.mc||r.color),o&&e.call(s.stroke,i.mlc||a.color)})}function h(t){var e=t[0].trace,r=n.select(this).select("g.legendpoints").selectAll("path.legendbox").data(i.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(){var t=e.line.width,r=n.select(this);r.style("stroke-width",t+"px").call(s.fill,e.fillcolor),t&&r.call(s.stroke,e.line.color)})}function d(t){var e=t[0].trace,r=n.select(this).select("g.legendpoints").selectAll("path.legendpie").data(i.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(u,t[0],e)}t.each(function(t){var e=n.select(this),r=e.selectAll("g.layers").data([0]);r.enter().append("g").classed("layers",!0),r.style("opacity",t[0].trace.opacity),r.selectAll("g.legendfill").data([t]).enter().append("g").classed("legendfill",!0),r.selectAll("g.legendlines").data([t]).enter().append("g").classed("legendlines",!0);var i=r.selectAll("g.legendsymbols").data([t]);i.enter().append("g").classed("legendsymbols",!0),i.selectAll("g.legendpoints").data([t]).enter().append("g").classed("legendpoints",!0)}).each(f).each(h).each(d).each(r).each(c)}},{"../../lib":404,"../../registry":490,"../../traces/pie/style_one":505,"../../traces/scatter/subtypes":527,"../color":287,"../drawing":311,d3:79}],346:[function(t,e,r){"use strict";function n(t,e){var r,n,i=e.currentTarget,a=i.getAttribute("data-attr"),o=i.getAttribute("data-val")||!0,s=t._fullLayout,l={},u=h.list(t,null,!0),f="on";if("zoom"===a){var d,p="in"===o?.5:2,g=(1+p)/2,v=(1-p)/2;for(n=0;n1)return n(["resetViews","toggleHover"]),o(m,r);c&&(n(["zoom3d","pan3d","orbitRotation","tableRotation"]),n(["resetCameraDefault3d","resetCameraLastSave3d"]),n(["hoverClosest3d"])),f&&(n(["zoomInGeo","zoomOutGeo","resetGeo"]),n(["hoverClosestGeo"]));var y=i(s),b=[];return((u||p)&&!y||g)&&(b=["zoom2d","pan2d"]),v&&(b=["pan2d"]),a(l)&&(b.push("select2d"),b.push("lasso2d")),b.length&&n(b),!u&&!p||y||g||n(["zoomIn2d","zoomOut2d","autoScale2d","resetScale2d"]),u&&d?n(["toggleHover"]):p?n(["hoverClosestGl2d"]):u?n(["toggleSpikelines","hoverClosestCartesian","hoverCompareCartesian"]):d?n(["hoverClosestPie"]):v&&n(["resetViewMapbox","toggleHover"]),o(m,r)}function i(t){for(var e=l.list({_fullLayout:t},null,!0),r=!0,n=0;n0)){var p=i(e,r,l);f("x",p[0]),f("y",p[1]),a.noneOrAll(t,e,["x","y"]),f("xanchor"),f("yanchor"),a.coerceFont(f,"font",r.font);var g=f("bgcolor");f("activecolor",o.contrast(g,u.lightAmount,u.darkAmount)),f("bordercolor"),f("borderwidth")}}},{"../../lib":404,"../color":287,"./attributes":350,"./button_attributes":351,"./constants":352}],354:[function(t,e,r){"use strict";function n(t){for(var e=m.list(t,"x",!0),r=[],n=0;np&&(p=h)));return p>=d?[d,p]:void 0}}var i=t("../../lib"),a=t("../../plots/cartesian/axes"),o=t("./constants"),s=t("./helpers");e.exports=function(t){var e=t._fullLayout,r=i.filterVisible(e.shapes);if(r.length&&t._fullData.length)for(var s=0;sX&&n>W&&!t.shiftKey?p.getCursor(i/r,1-a/n):"move";g(e,o),G=o.split("-")[0]}function a(e){F=f.getFromId(t,r.xref),B=f.getFromId(t,r.yref),U=m.getDataToPixel(t,F),V=m.getDataToPixel(t,B,!0),H=m.getPixelToData(t,F),q=m.getPixelToData(t,B,!0);var a="shapes["+n+"]";"path"===r.type?(D=r.path,j=a+".path"):(v=U(r.x0),y=V(r.y0),b=U(r.x1),x=V(r.y1),_=a+".x0",w=a+".y0",M=a+".x1",A=a+".y1"),vW&&(d[C]=r[O]=q(u),d[S]=r[N]=q(c)),h-f>X&&(d[P]=r[I]=H(f),d[R]=r[z]=H(h))}e.attr("d",o(t,r))}var d,v,y,b,x,_,w,M,A,k,T,E,L,C,S,P,R,O,N,I,z,D,j,F,B,U,V,H,q,G,X=10,W=10,Y={element:e.node(),gd:t,prepFn:a,doneFn:s},Z=Y.element.getBoundingClientRect();p.init(Y),e.node().onmousemove=i}function o(t,e){var r,n,i,a,o=e.type,l=f.getFromId(t,e.xref),u=f.getFromId(t,e.yref),c=t._fullLayout._size;if(l?(r=m.shapePositionToRange(l),n=function(t){return l._offset+l.r2p(r(t,!0))}):n=function(t){return c.l+c.w*t},u?(i=m.shapePositionToRange(u),a=function(t){return u._offset+u.r2p(i(t,!0))}):a=function(t){return c.t+c.h*(1-t)},"path"===o)return l&&"date"===l.type&&(n=m.decodeDate(n)),u&&"date"===u.type&&(a=m.decodeDate(a)),s(e.path,n,a);var h=n(e.x0),d=n(e.x1),p=a(e.y0),g=a(e.y1);if("line"===o)return"M"+h+","+p+"L"+d+","+g;if("rect"===o)return"M"+h+","+p+"H"+d+"V"+g+"H"+h+"Z";var v=(h+d)/2,y=(p+g)/2,b=Math.abs(v-h),x=Math.abs(y-p),_="A"+b+","+x,w=v+b+","+y;return"M"+w+_+" 0 1,1 "+v+","+(y-x)+_+" 0 0,1 "+w+"Z"}function s(t,e,r){return t.replace(v.segmentRE,function(t){var n=0,i=t.charAt(0),a=v.paramIsX[i],o=v.paramIsY[i],s=v.numParams[i],l=t.substr(1).replace(v.paramRE,function(t){return a[n]?t=e(t):o[n]&&(t=r(t)),n++,n>s&&(t="X"),t});return n>s&&(l=l.replace(/[\s,]*X.*/,""),c.log("Ignoring extra params in segment "+t)),i+l})}function l(t,e,r){return t.replace(v.segmentRE,function(t){var n=0,i=t.charAt(0),a=v.paramIsX[i],o=v.paramIsY[i],s=v.numParams[i];return i+t.substr(1).replace(v.paramRE,function(t){return n>=s?t:(a[n]?t=e(t):o[n]&&(t=r(t)),n++,t)})})}var u=t("../../plotly"),c=t("../../lib"),f=t("../../plots/cartesian/axes"),h=t("../color"),d=t("../drawing"),p=t("../dragelement"),g=t("../../lib/setcursor"),v=t("./constants"),m=t("./helpers");e.exports={draw:n,drawOne:i}},{"../../lib":404,"../../lib/setcursor":419,"../../plotly":437,"../../plots/cartesian/axes":442,"../color":287,"../dragelement":308,"../drawing":311,"./constants":365,"./helpers":368}],368:[function(t,e,r){"use strict";r.rangeToShapePosition=function(t){return"log"===t.type?t.r2d:function(t){return t}},r.shapePositionToRange=function(t){return"log"===t.type?t.d2r:function(t){return t}},r.decodeDate=function(t){return function(e){return e.replace&&(e=e.replace("_"," ")),t(e)}},r.encodeDate=function(t){return function(e){return t(e).replace(" ","_")}},r.getDataToPixel=function(t,e,n){var i,a=t._fullLayout._size;if(e){var o=r.shapePositionToRange(e);i=function(t){return e._offset+e.r2p(o(t,!0))},"date"===e.type&&(i=r.decodeDate(i))}else i=n?function(t){return a.t+a.h*(1-t)}:function(t){return a.l+a.w*t};return i},r.getPixelToData=function(t,e,n){var i,a=t._fullLayout._size;if(e){var o=r.rangeToShapePosition(e);i=function(t){return o(e.p2r(t-e._offset))}}else i=n?function(t){return 1-(t-a.t)/a.h}:function(t){return(t-a.l)/a.w};return i}},{}],369:[function(t,e,r){"use strict";var n=t("./draw");e.exports={moduleType:"component",name:"shapes",layoutAttributes:t("./attributes"),supplyLayoutDefaults:t("./defaults"),calcAutorange:t("./calc_autorange"),draw:n.draw,drawOne:n.drawOne}},{"./attributes":363,"./calc_autorange":364,"./defaults":366,"./draw":367}],370:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../plots/cartesian/axes"),a=t("./attributes"),o=t("./helpers");e.exports=function(t,e,r,s,l){function u(r,i){return n.coerce(t,e,a,r,i)}if(s=s||{},l=l||{},!u("visible",!l.itemIsNotPlainObject))return e;u("layer"),u("opacity"),u("fillcolor"),u("line.color"),u("line.width"),u("line.dash");for(var c=t.path?"path":"rect",f=u("type",c),h=["x","y"],d=0;d<2;d++){var p=h[d],g={_fullLayout:r},v=i.coerceRef(t,e,g,p,"","paper");if("path"!==f){var m,y,b;"paper"!==v?(m=i.getFromId(g,v),b=o.rangeToShapePosition(m),y=o.shapePositionToRange(m)):y=b=n.identity;var x=p+"0",_=p+"1",w=t[x],M=t[_];t[x]=y(t[x],!0),t[_]=y(t[_],!0),i.coercePosition(e,g,u,v,x,.25),i.coercePosition(e,g,u,v,_,.75),e[x]=b(e[x]),e[_]=b(e[_]),t[x]=w,t[_]=M}}return"path"===f?u("path"):n.noneOrAll(t,e,["x0","x1","y0","y1"]),e}},{"../../lib":404,"../../plots/cartesian/axes":442,"./attributes":363,"./helpers":368}],371:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),i=t("../../plots/pad_attributes"),a=t("../../lib/extend").extendFlat,o=t("../../lib/extend").extendDeep,s=t("../../plots/animation_attributes"),l=t("./constants"),u={_isLinkedToArray:"step",method:{valType:"enumerated",values:["restyle","relayout","animate","update","skip"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string"},value:{valType:"string"},execute:{valType:"boolean",dflt:!0}};e.exports={_isLinkedToArray:"slider",visible:{valType:"boolean",dflt:!0},active:{valType:"number",min:0,dflt:0},steps:u,lenmode:{valType:"enumerated", values:["fraction","pixels"],dflt:"fraction"},len:{valType:"number",min:0,dflt:1},x:{valType:"number",min:-2,max:3,dflt:0},pad:o({},i,{},{t:{dflt:20}}),xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left"},y:{valType:"number",min:-2,max:3,dflt:0},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"top"},transition:{duration:{valType:"number",min:0,dflt:150},easing:{valType:"enumerated",values:s.transition.easing.values,dflt:"cubic-in-out"}},currentvalue:{visible:{valType:"boolean",dflt:!0},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left"},offset:{valType:"number",dflt:10},prefix:{valType:"string"},suffix:{valType:"string"},font:a({},n,{})},font:a({},n,{}),activebgcolor:{valType:"color",dflt:l.gripBgActiveColor},bgcolor:{valType:"color",dflt:l.railBgColor},bordercolor:{valType:"color",dflt:l.railBorderColor},borderwidth:{valType:"number",min:0,dflt:l.railBorderWidth},ticklen:{valType:"number",min:0,dflt:l.tickLength},tickcolor:{valType:"color",dflt:l.tickColor},tickwidth:{valType:"number",min:0,dflt:1},minorticklen:{valType:"number",min:0,dflt:l.minorTickLength}}},{"../../lib/extend":397,"../../plots/animation_attributes":438,"../../plots/font_attributes":466,"../../plots/pad_attributes":481,"./constants":372}],372:[function(t,e,r){"use strict";e.exports={name:"sliders",containerClassName:"slider-container",groupClassName:"slider-group",inputAreaClass:"slider-input-area",railRectClass:"slider-rail-rect",railTouchRectClass:"slider-rail-touch-rect",gripRectClass:"slider-grip-rect",tickRectClass:"slider-tick-rect",inputProxyClass:"slider-input-proxy",labelsClass:"slider-labels",labelGroupClass:"slider-label-group",labelClass:"slider-label",currentValueClass:"slider-current-value",railHeight:5,menuIndexAttrName:"slider-active-index",autoMarginIdRoot:"slider-",minWidth:30,minHeight:30,textPadX:40,arrowOffsetX:4,railRadius:2,railWidth:5,railBorder:4,railBorderWidth:1,railBorderColor:"#bec8d9",railBgColor:"#f8fafc",railInset:8,stepInset:10,gripRadius:10,gripWidth:20,gripHeight:20,gripBorder:20,gripBorderWidth:1,gripBorderColor:"#bec8d9",gripBgColor:"#f6f8fa",gripBgActiveColor:"#dbdde0",labelPadding:8,labelOffset:0,tickWidth:1,tickColor:"#333",tickOffset:25,tickLength:7,minorTickOffset:25,minorTickColor:"#333",minorTickLength:4,currentValuePadding:8,currentValueInset:0}},{}],373:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return a.coerce(t,e,s,r,n)}n("visible",i(t,e).length>0)&&(n("active"),n("x"),n("y"),a.noneOrAll(t,e,["x","y"]),n("xanchor"),n("yanchor"),n("len"),n("lenmode"),n("pad.t"),n("pad.r"),n("pad.b"),n("pad.l"),a.coerceFont(n,"font",r.font),n("currentvalue.visible")&&(n("currentvalue.xanchor"),n("currentvalue.prefix"),n("currentvalue.suffix"),n("currentvalue.offset"),a.coerceFont(n,"currentvalue.font",e.font)),n("transition.duration"),n("transition.easing"),n("bgcolor"),n("activebgcolor"),n("bordercolor"),n("borderwidth"),n("ticklen"),n("tickwidth"),n("tickcolor"),n("minorticklen"))}function i(t,e){function r(t,e){return a.coerce(n,i,c,t,e)}for(var n,i,o=t.steps||[],s=e.steps=[],l=0;l=r.steps.length&&(r.active=0),e.call(s,r).call(x,r).call(c,r).call(p,r).call(b,t,r).call(l,t,r),k.setTranslate(e,r.lx+r.pad.l,r.ly+r.pad.t),e.call(v,r,r.active/(r.steps.length-1),!1),e.call(s,r)}function s(t,e,r){if(e.currentvalue.visible){var n,i,a=t.selectAll("text").data([0]);switch(e.currentvalue.xanchor){case"right":n=e.inputAreaLength-L.currentValueInset-e.currentValueMaxWidth,i="left";break;case"center":n=.5*e.inputAreaLength,i="middle";break;default:n=L.currentValueInset,i="left"}a.enter().append("text").classed(L.labelClass,!0).classed("user-select-none",!0).attr({"text-anchor":i,"data-notex":1});var o=e.currentvalue.prefix?e.currentvalue.prefix:"";if("string"==typeof r)o+=r;else{o+=e.steps[e.active].label}e.currentvalue.suffix&&(o+=e.currentvalue.suffix),a.call(k.font,e.currentvalue.font).text(o).call(T.convertToTspans,e.gd);var s=T.lineCount(a),l=(e.currentValueMaxLines+1-s)*e.currentvalue.font.size*C;return T.positionText(a,n,l),a}}function l(t,e,r){var n=t.selectAll("rect."+L.gripRectClass).data([0]);n.enter().append("rect").classed(L.gripRectClass,!0).call(d,e,t,r).style("pointer-events","all"),n.attr({width:L.gripWidth,height:L.gripHeight,rx:L.gripRadius,ry:L.gripRadius}).call(A.stroke,r.bordercolor).call(A.fill,r.bgcolor).style("stroke-width",r.borderwidth+"px")}function u(t,e,r){var n=t.selectAll("text").data([0]);return n.enter().append("text").classed(L.labelClass,!0).classed("user-select-none",!0).attr({"text-anchor":"middle","data-notex":1}),n.call(k.font,r.font).text(e.step.label).call(T.convertToTspans,r.gd),n}function c(t,e){var r=t.selectAll("g."+L.labelsClass).data([0]);r.enter().append("g").classed(L.labelsClass,!0);var n=r.selectAll("g."+L.labelGroupClass).data(e.labelSteps);n.enter().append("g").classed(L.labelGroupClass,!0),n.exit().remove(),n.each(function(t){var r=w.select(this);r.call(u,t,e),k.setTranslate(r,m(e,t.fraction),L.tickOffset+e.ticklen+e.font.size*C+L.labelOffset+e.currentValueTotalHeight)})}function f(t,e,r,n,i){var a=Math.round(n*(r.steps.length-1));a!==r.active&&h(t,e,r,a,!0,i)}function h(t,e,r,n,i,a){var o=r.active;r._input.active=r.active=n;var l=r.steps[r.active];e.call(v,r,r.active/(r.steps.length-1),a),e.call(s,r),t.emit("plotly_sliderchange",{slider:r,step:r.steps[r.active],interaction:i,previousActive:o}),l&&l.method&&i&&(e._nextMethod?(e._nextMethod.step=l,e._nextMethod.doCallback=i,e._nextMethod.doTransition=a):(e._nextMethod={step:l,doCallback:i,doTransition:a},e._nextMethodRaf=window.requestAnimationFrame(function(){var r=e._nextMethod.step;r.method&&(r.execute&&M.executeAPICommand(t,r.method,r.args),e._nextMethod=null,e._nextMethodRaf=null)})))}function d(t,e,r){function n(){return r.data()[0]}var i=r.node(),a=w.select(e);t.on("mousedown",function(){var t=n();e.emit("plotly_sliderstart",{slider:t});var o=r.select("."+L.gripRectClass);w.event.stopPropagation(),w.event.preventDefault(),o.call(A.fill,t.activebgcolor);var s=y(t,w.mouse(i)[0]);f(e,r,t,s,!0),t._dragging=!0,a.on("mousemove",function(){var t=n(),a=y(t,w.mouse(i)[0]);f(e,r,t,a,!1)}),a.on("mouseup",function(){var t=n();t._dragging=!1,o.call(A.fill,t.bgcolor),a.on("mouseup",null),a.on("mousemove",null),e.emit("plotly_sliderend",{slider:t,step:t.steps[t.active]})})})}function p(t,e){var r=t.selectAll("rect."+L.tickRectClass).data(e.steps);r.enter().append("rect").classed(L.tickRectClass,!0),r.exit().remove(),r.attr({width:e.tickwidth+"px","shape-rendering":"crispEdges"}),r.each(function(t,r){var n=r%e.labelStride==0,i=w.select(this);i.attr({height:n?e.ticklen:e.minorticklen}).call(A.fill,e.tickcolor),k.setTranslate(i,m(e,r/(e.steps.length-1))-.5*e.tickwidth,(n?L.tickOffset:L.minorTickOffset)+e.currentValueTotalHeight)})}function g(t){t.labelSteps=[];for(var e=t.steps.length,r=0;r0&&(o=o.transition().duration(e.transition.duration).ease(e.transition.easing)),o.attr("transform","translate("+(a-.5*L.gripWidth)+","+e.currentValueTotalHeight+")")}}function m(t,e){return t.inputAreaStart+L.stepInset+(t.inputAreaLength-2*L.stepInset)*Math.min(1,Math.max(0,e))}function y(t,e){return Math.min(1,Math.max(0,(e-L.stepInset-t.inputAreaStart)/(t.inputAreaLength-2*L.stepInset-2*t.inputAreaStart)))}function b(t,e,r){var n=t.selectAll("rect."+L.railTouchRectClass).data([0]);n.enter().append("rect").classed(L.railTouchRectClass,!0).call(d,e,t,r).style("pointer-events","all"),n.attr({width:r.inputAreaLength,height:Math.max(r.inputAreaWidth,L.tickOffset+r.ticklen+r.labelHeight)}).call(A.fill,r.bgcolor).attr("opacity",0),k.setTranslate(n,0,r.currentValueTotalHeight)}function x(t,e){var r=t.selectAll("rect."+L.railRectClass).data([0]);r.enter().append("rect").classed(L.railRectClass,!0);var n=e.inputAreaLength-2*L.railInset;r.attr({width:n,height:L.railWidth,rx:L.railRadius,ry:L.railRadius,"shape-rendering":"crispEdges"}).call(A.stroke,e.bordercolor).call(A.fill,e.bgcolor).style("stroke-width",e.borderwidth+"px"),k.setTranslate(r,L.railInset,.5*(e.inputAreaWidth-L.railWidth)+e.currentValueTotalHeight)}function _(t){for(var e=t._fullLayout._pushmargin||{},r=Object.keys(e),n=0;n0?[0]:[]);if(s.enter().append("g").classed(L.containerClassName,!0).style("cursor","ew-resize"),s.exit().remove(),s.exit().size()&&_(t),0!==r.length){var l=s.selectAll("g."+L.groupClassName).data(r,i);l.enter().append("g").classed(L.groupClassName,!0),l.exit().each(function(e){w.select(this).remove(),e._commandObserver.remove(),delete e._commandObserver,M.autoMargin(t,L.autoMarginIdRoot+e._index)});for(var u=0;u0||h<0){var g={left:[-r,0],right:[r,0],top:[0,-r],bottom:[0,r]}[_.side];e.attr("transform","translate("+g+")")}}}var v,m=r.propContainer,y=r.propName,b=r.traceIndex,x=r.dfltName,_=r.avoid||{},w=r.attributes,M=r.transform,A=r.containerGroup,k=t._fullLayout,T=m.titlefont.family,E=m.titlefont.size,L=m.titlefont.color,C=1,S=!1,P=m.title.trim();"title"===y?v="titleText":-1!==y.indexOf("axis")?v="axisTitleText":y.indexOf(!0)&&(v="colorbarTitleText");var R=t._context.edits[v];""===P&&(C=0),P.match(h)&&(C=.2,S=!0,R||(P=""));var O=P||R;A||(A=k._infolayer.selectAll(".g-"+e).data([0]),A.enter().append("g").classed("g-"+e,!0));var N=A.selectAll("text").data(O?[0]:[]);if(N.enter().append("text"),N.text(P).attr("class",e),N.exit().remove(),O){N.call(d);var I="Click to enter "+x+" title";R&&(P?N.on(".opacity",null):function(){C=0,S=!0,P=I,N.text(P).on("mouseover.opacity",function(){n.select(this).transition().duration(f.SHOW_PLACEHOLDER).style("opacity",1)}).on("mouseout.opacity",function(){n.select(this).transition().duration(f.HIDE_PLACEHOLDER).style("opacity",0)})}(),N.call(c.makeEditable,{gd:t}).on("edit",function(e){void 0!==b?a.restyle(t,y,e,b):a.relayout(t,y,e)}).on("cancel",function(){this.text(this.attr("data-unformatted")).call(d)}).on("input",function(t){this.text(t||" ").call(c.positionText,w.x,w.y)})),N.classed("js-placeholder",S)}}},{"../../constants/interactions":386,"../../lib":404,"../../lib/svg_text_utils":423,"../../plotly":437,"../../plots/plots":482,"../color":287,"../drawing":311,d3:79,"fast-isnumeric":87}],377:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),i=t("../color/attributes"),a=t("../../lib/extend").extendFlat,o=t("../../plots/pad_attributes"),s={_isLinkedToArray:"button",method:{valType:"enumerated",values:["restyle","relayout","animate","update","skip"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string",dflt:""},execute:{valType:"boolean",dflt:!0}};e.exports={_isLinkedToArray:"updatemenu",_arrayAttrRegexps:[/^updatemenus\[(0|[1-9][0-9]+)\]\.buttons/],visible:{valType:"boolean"},type:{valType:"enumerated",values:["dropdown","buttons"],dflt:"dropdown"},direction:{valType:"enumerated",values:["left","right","up","down"],dflt:"down"},active:{valType:"integer",min:-1,dflt:0},showactive:{valType:"boolean",dflt:!0},buttons:s,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:"top"},pad:a({},o,{}),font:a({},n,{}),bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:i.borderLine},borderwidth:{valType:"number",min:0,dflt:1}}},{"../../lib/extend":397,"../../plots/font_attributes":466,"../../plots/pad_attributes":481,"../color/attributes":286}],378:[function(t,e,r){"use strict";e.exports={name:"updatemenus",containerClassName:"updatemenu-container",headerGroupClassName:"updatemenu-header-group",headerClassName:"updatemenu-header",headerArrowClassName:"updatemenu-header-arrow",dropdownButtonGroupClassName:"updatemenu-dropdown-button-group",dropdownButtonClassName:"updatemenu-dropdown-button",buttonClassName:"updatemenu-button",itemRectClassName:"updatemenu-item-rect",itemTextClassName:"updatemenu-item-text",menuIndexAttrName:"updatemenu-active-index",autoMarginIdRoot:"updatemenu-",blankHeaderOpts:{label:" "},minWidth:30,minHeight:30,textPadX:24,arrowPadX:16,rx:2,ry:2,textOffsetX:12,textOffsetY:3,arrowOffsetX:4,gapButtonHeader:5,gapButton:2,activeColor:"#F4FAFF",hoverColor:"#F4FAFF",arrowSymbol:{left:"\u25c4",right:"\u25ba",up:"\u25b2",down:"\u25bc"}}},{}],379:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return a.coerce(t,e,s,r,n)}n("visible",i(t,e).length>0)&&(n("active"),n("direction"),n("type"),n("showactive"),n("x"),n("y"),a.noneOrAll(t,e,["x","y"]),n("xanchor"),n("yanchor"),n("pad.t"),n("pad.r"),n("pad.b"),n("pad.l"),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,c,t,e)}for(var n,i,o=t.buttons||[],s=e.buttons=[],l=0;l0?[0]:[]);if(a.enter().append("g").classed(C.containerClassName,!0).style("cursor","pointer"),a.exit().remove(),a.exit().size()&&_(t),0!==r.length){var c=a.selectAll("g."+C.headerGroupClassName).data(r,i);c.enter().append("g").classed(C.headerGroupClassName,!0);var f=a.selectAll("g."+C.dropdownButtonGroupClassName).data([0]);f.enter().append("g").classed(C.dropdownButtonGroupClassName,!0).style("pointer-events","all");for(var h=0;hM,T=n.barLength+2*n.barPad,E=n.barWidth+2*n.barPad,L=p,C=v+m;C+E>u&&(C=u-E);var S=this.container.selectAll("rect.scrollbar-horizontal").data(k?[0]:[]);S.exit().on(".drag",null).remove(),S.enter().append("rect").classed("scrollbar-horizontal",!0).call(a.fill,n.barColor),k?(this.hbar=S.attr({rx:n.barRadius,ry:n.barRadius,x:L,y:C,width:T,height:E}),this._hbarXMin=L+T/2,this._hbarTranslateMax=M-T):(delete this.hbar,delete this._hbarXMin,delete this._hbarTranslateMax);var P=m>A,R=n.barWidth+2*n.barPad,O=n.barLength+2*n.barPad,N=p+g,I=v;N+R>l&&(N=l-R);var z=this.container.selectAll("rect.scrollbar-vertical").data(P?[0]:[]);z.exit().on(".drag",null).remove(),z.enter().append("rect").classed("scrollbar-vertical",!0).call(a.fill,n.barColor),P?(this.vbar=z.attr({rx:n.barRadius,ry:n.barRadius,x:N,y:I,width:R,height:O}),this._vbarYMin=I+O/2,this._vbarTranslateMax=A-O):(delete this.vbar,delete this._vbarYMin,delete this._vbarTranslateMax);var D=this.id,j=c-.5,F=P?f+R+.5:f+.5,B=h-.5,U=k?d+E+.5:d+.5,V=s._topdefs.selectAll("#"+D).data(k||P?[0]:[]);if(V.exit().remove(),V.enter().append("clipPath").attr("id",D).append("rect"),k||P?(this._clipRect=V.select("rect").attr({x:Math.floor(j),y:Math.floor(B),width:Math.ceil(F)-Math.floor(j),height:Math.ceil(U)-Math.floor(B)}),this.container.call(o.setClipUrl,D),this.bg.attr({x:p,y:v,width:g,height:m})):(this.bg.attr({width:0,height:0}),this.container.on("wheel",null).on(".drag",null).call(o.setClipUrl,null),delete this._clipRect),k||P){var H=i.behavior.drag().on("dragstart",function(){i.event.sourceEvent.preventDefault()}).on("drag",this._onBoxDrag.bind(this));this.container.on("wheel",null).on("wheel",this._onBoxWheel.bind(this)).on(".drag",null).call(H);var q=i.behavior.drag().on("dragstart",function(){i.event.sourceEvent.preventDefault(),i.event.sourceEvent.stopPropagation()}).on("drag",this._onBarDrag.bind(this));k&&this.hbar.on(".drag",null).call(q),P&&this.vbar.on(".drag",null).call(q)}this.setTranslate(e,r)},n.prototype.disable=function(){(this.hbar||this.vbar)&&(this.bg.attr({width:0,height:0}),this.container.on("wheel",null).on(".drag",null).call(o.setClipUrl,null),delete this._clipRect),this.hbar&&(this.hbar.on(".drag",null),this.hbar.remove(),delete this.hbar,delete this._hbarXMin,delete this._hbarTranslateMax),this.vbar&&(this.vbar.on(".drag",null),this.vbar.remove(),delete this.vbar,delete this._vbarYMin,delete this._vbarTranslateMax)},n.prototype._onBoxDrag=function(){var t=this.translateX,e=this.translateY;this.hbar&&(t-=i.event.dx),this.vbar&&(e-=i.event.dy),this.setTranslate(t,e)},n.prototype._onBoxWheel=function(){var t=this.translateX,e=this.translateY;this.hbar&&(t+=i.event.deltaY),this.vbar&&(e+=i.event.deltaY),this.setTranslate(t,e)},n.prototype._onBarDrag=function(){var t=this.translateX,e=this.translateY;if(this.hbar){var r=t+this._hbarXMin,n=r+this._hbarTranslateMax;t=(s.constrain(i.event.x,r,n)-r)/(n-r)*(this.position.w-this._box.w)}if(this.vbar){var a=e+this._vbarYMin,o=a+this._vbarTranslateMax;e=(s.constrain(i.event.y,a,o)-a)/(o-a)*(this.position.h-this._box.h)}this.setTranslate(t,e)},n.prototype.setTranslate=function(t,e){var r=this.position.w-this._box.w,n=this.position.h-this._box.h;if(t=s.constrain(t||0,0,r),e=s.constrain(e||0,0,n),this.translateX=t,this.translateY=e,this.container.call(o.setTranslate,this._box.l-this.position.l-t,this._box.t-this.position.t-e),this._clipRect&&this._clipRect.attr({x:Math.floor(this.position.l+t-.5),y:Math.floor(this.position.t+e-.5)}),this.hbar){var i=t/r;this.hbar.call(o.setTranslate,t+i*this._hbarTranslateMax,e)}if(this.vbar){var a=e/n;this.vbar.call(o.setTranslate,t,e+a*this._vbarTranslateMax)}}},{"../../lib":404,"../color":287,"../drawing":311,d3:79}],383:[function(t,e,r){"use strict";e.exports={FROM_BL:{left:0,center:.5,right:1,bottom:0,middle:.5,top:1},FROM_TL:{left:0,center:.5,right:1,bottom:1,middle:.5,top:0},LINE_SPACING:1.3,MID_SHIFT:.35}},{}],384:[function(t,e,r){"use strict";e.exports={solid:[[],0],dot:[[.5,1],200],dash:[[.5,1],50],longdash:[[.5,1],10],dashdot:[[.5,.625,.875,1],50],longdashdot:[[.5,.7,.8,1],10]}},{}],385:[function(t,e,r){"use strict";e.exports={circle:"\u25cf","circle-open":"\u25cb",square:"\u25a0", -"square-open":"\u25a1",diamond:"\u25c6","diamond-open":"\u25c7",cross:"+",x:"\u274c"}},{}],386:[function(t,e,r){"use strict";e.exports={SHOW_PLACEHOLDER:100,HIDE_PLACEHOLDER:1e3,DBLCLICKDELAY:300,DESELECTDIM:.2}},{}],387:[function(t,e,r){"use strict";e.exports={BADNUM:void 0,FP_SAFE:Number.MAX_VALUE/1e4,ONEAVGYEAR:315576e5,ONEAVGMONTH:26298e5,ONEDAY:864e5,ONEHOUR:36e5,ONEMIN:6e4,ONESEC:1e3,EPOCHJD:2440587.5,ALMOST_EQUAL:1-1e-6}},{}],388:[function(t,e,r){"use strict";e.exports={entityToUnicode:{mu:"\u03bc","#956":"\u03bc",amp:"&","#28":"&",lt:"<","#60":"<",gt:">","#62":">",nbsp:"\xa0","#160":"\xa0",times:"\xd7","#215":"\xd7",plusmn:"\xb1","#177":"\xb1",deg:"\xb0","#176":"\xb0"}}},{}],389:[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}},{}],390:[function(t,e,r){"use strict";var n=t("./plotly");r.version="1.29.1",t("es6-promise").polyfill(),t("../build/plotcss"),t("./fonts/mathjax_config"),r.plot=n.plot,r.newPlot=n.newPlot,r.restyle=n.restyle,r.relayout=n.relayout,r.redraw=n.redraw,r.update=n.update,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=t("./plot_api/register"),r.toImage=t("./plot_api/to_image"),r.downloadImage=t("./snapshot/download"),r.validate=t("./plot_api/validate"),r.addFrames=n.addFrames,r.deleteFrames=n.deleteFrames,r.animate=n.animate,r.register(t("./traces/scatter")),r.register([t("./components/fx"),t("./components/legend"),t("./components/annotations"),t("./components/annotations3d"),t("./components/shapes"),t("./components/images"),t("./components/updatemenus"),t("./components/sliders"),t("./components/rangeslider"),t("./components/rangeselector")]),r.Icons=t("../build/ploticon"),r.Plots=n.Plots,r.Fx=t("./components/fx"),r.Snapshot=t("./snapshot"),r.PlotSchema=t("./plot_api/plot_schema"),r.Queue=t("./lib/queue"),r.d3=t("d3")},{"../build/plotcss":1,"../build/ploticon":2,"./components/annotations":280,"./components/annotations3d":285,"./components/fx":328,"./components/images":336,"./components/legend":344,"./components/rangeselector":356,"./components/rangeslider":362,"./components/shapes":369,"./components/sliders":375,"./components/updatemenus":381,"./fonts/mathjax_config":391,"./lib/queue":416,"./plot_api/plot_schema":431,"./plot_api/register":432,"./plot_api/set_plot_config":433,"./plot_api/to_image":435,"./plot_api/validate":436,"./plotly":437,"./snapshot":495,"./snapshot/download":492,"./traces/scatter":517,d3:79,"es6-promise":84}],391:[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},{}],392:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../constants/numerical").BADNUM,a=/^['"%,$#\s']+|[, ]|['"%,$#\s']+$/g;e.exports=function(t){return"string"==typeof t&&(t=t.replace(a,"")),n(t)?Number(t):i}},{"../constants/numerical":387,"fast-isnumeric":87}],393:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("tinycolor2"),a=t("../plots/attributes"),o=t("../components/colorscale/get_scale"),s=(Object.keys(t("../components/colorscale/scales")),t("./nested_property")),l=/^([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)},validateFunction:function(t,e){e.coerceNumber&&(t=+t);for(var r=e.values,n=0;ni.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;!0!==n.strict&&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;if("string"==typeof t&&t.substr(0,n)===r&&l.test(t.substr(n)))return void e.set(t);e.set(r)},validateFunction:function(t,e){var r=e.dflt,n=r.length;return t===r||"string"==typeof t&&!(t.substr(0,n)!==r||!l.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;a0&&(o=o.replace(/0+$/,"").replace(/[\.]$/,"")),n+=":"+o}return n}function l(t){return t.formatDate("yyyy")}function u(t){return t.formatDate("M yyyy")}function c(t){return t.formatDate("M d")}function f(t){return t.formatDate("M d, yyyy")}var h=t("d3"),d=t("fast-isnumeric"),p=t("./loggers").error,g=t("./mod"),v=t("../constants/numerical"),m=v.BADNUM,y=v.ONEDAY,b=v.ONEHOUR,x=v.ONEMIN,_=v.ONESEC,w=v.EPOCHJD,M=t("../registry"),A=h.time.format.utc,k=/^\s*(-?\d\d\d\d|\d\d)(-(\d?\d)(-(\d?\d)([ Tt]([01]?\d|2[0-3])(:([0-5]\d)(:([0-5]\d(\.\d+)?))?(Z|z|[+\-]\d\d:?\d\d)?)?)?)?)?\s*$/m,T=/^\s*(-?\d\d\d\d|\d\d)(-(\d?\di?)(-(\d?\d)([ Tt]([01]?\d|2[0-3])(:([0-5]\d)(:([0-5]\d(\.\d+)?))?(Z|z|[+\-]\d\d:?\d\d)?)?)?)?)?\s*$/m,E=(new Date).getFullYear()-70;r.dateTick0=function(t,e){return n(t)?e?M.getComponentMethod("calendars","CANONICAL_SUNDAY")[t]:M.getComponentMethod("calendars","CANONICAL_TICK")[t]:e?"2000-01-02":"2000-01-01"},r.dfltRange=function(t){return n(t)?M.getComponentMethod("calendars","DFLTRANGE")[t]:["2000-01-01","2001-01-01"]},r.isJSDate=function(t){return"object"==typeof t&&null!==t&&"function"==typeof t.getTime};var L,C;r.dateTime2ms=function(t,e){if(r.isJSDate(t))return t=Number(t)-t.getTimezoneOffset()*x,t>=L&&t<=C?t:m;if("string"!=typeof t&&"number"!=typeof t)return m;t=String(t);var i=n(e),a=t.charAt(0);!i||"G"!==a&&"g"!==a||(t=t.substr(1),e="");var o=i&&"chinese"===e.substr(0,7),s=t.match(o?T:k);if(!s)return m;var l=s[1],u=s[3]||"1",c=Number(s[5]||1),f=Number(s[7]||0),h=Number(s[9]||0),d=Number(s[11]||0);if(i){if(2===l.length)return m;l=Number(l);var p;try{var g=M.getComponentMethod("calendars","getCal")(e);if(o){var v="i"===u.charAt(u.length-1);u=parseInt(u,10),p=g.newDate(l,g.toMonthIndex(l,u,v),c)}else p=g.newDate(l,Number(u),c)}catch(t){return m}return p?(p.toJD()-w)*y+f*b+h*x+d*_:m}l=2===l.length?(Number(l)+2e3-E)%100+E:Number(l),u-=1;var A=new Date(Date.UTC(2e3,u,c,f,h));return A.setUTCFullYear(l),A.getUTCMonth()!==u?m:A.getUTCDate()!==c?m:A.getTime()+d*_},L=r.MIN_MS=r.dateTime2ms("-9999"),C=r.MAX_MS=r.dateTime2ms("9999-12-31 23:59:59.9999"),r.isDateTime=function(t,e){return r.dateTime2ms(t,e)!==m};var S=90*y,P=3*b,R=5*x;r.ms2DateTime=function(t,e,r){if("number"!=typeof t||!(t>=L&&t<=C))return m;e||(e=0);var i,o,s,l,u,c,f=Math.floor(10*g(t+.05,1)),h=Math.round(t-f/10);if(n(r)){var d=Math.floor(h/y)+w,p=Math.floor(g(t,y));try{i=M.getComponentMethod("calendars","getCal")(r).fromJD(d).formatDate("yyyy-mm-dd")}catch(t){i=A("G%Y-%m-%d")(new Date(h))}if("-"===i.charAt(0))for(;i.length<11;)i="-0"+i.substr(1);else for(;i.length<10;)i="0"+i;o=e=L+y&&t<=C-y))return m;var e=Math.floor(10*g(t+.05,1)),r=new Date(Math.round(t-e/10));return a(h.time.format("%Y-%m-%d")(r),r.getHours(),r.getMinutes(),r.getSeconds(),10*r.getUTCMilliseconds()+e)},r.cleanDate=function(t,e,i){if(r.isJSDate(t)||"number"==typeof t){if(n(i))return p("JS Dates and milliseconds are incompatible with world calendars",t),e;if(!(t=r.ms2DateTimeLocal(+t))&&void 0!==e)return e}else if(!r.isDateTime(t,i))return p("unrecognized date",t),e;return t};var O=/%\d?f/g,N=[59,59.9,59.99,59.999,59.9999],I=A("%Y"),z=A("%b %Y"),D=A("%b %-d"),j=A("%b %-d, %Y");r.formatDate=function(t,e,r,i){var a,h;if(i=n(i)&&i,e)return o(e,t,i);if(i)try{var d=Math.floor((t+.05)/y)+w,p=M.getComponentMethod("calendars","getCal")(i).fromJD(d);"y"===r?h=l(p):"m"===r?h=u(p):"d"===r?(a=l(p),h=c(p)):(a=f(p),h=s(t,r))}catch(t){return"Invalid"}else{var g=new Date(Math.floor(t+.05));"y"===r?h=I(g):"m"===r?h=z(g):"d"===r?(a=I(g),h=D(g)):(a=j(g),h=s(t,r))}return h+(a?"\n"+a:"")};var F=3*y;r.incrementMonth=function(t,e,r){r=n(r)&&r;var i=g(t,y);if(t=Math.round(t-i),r)try{var a=Math.round(t/y)+w,o=M.getComponentMethod("calendars","getCal")(r),s=o.fromJD(a);return e%12?o.add(s,e,"m"):o.add(s,e/12,"y"),(s.toJD()-w)*y+i}catch(e){p("invalid ms "+t+" in calendar "+r)}var l=new Date(t+F);return l.setUTCMonth(l.getUTCMonth()+e)+i-F},r.findExactDates=function(t,e){for(var r,i,a=0,o=0,s=0,l=0,u=n(e)&&M.getComponentMethod("calendars","getCal")(e),c=0;c1||g<0||g>1?null:{x:t+l*g,y:e+f*g}}function i(t,e,r,n,i){var a=n*t+i*e;if(a<0)return n*n+i*i;if(a>r){var o=n-t,s=i-e;return o*o+s*s}var l=n*e-i*t;return l*l/r}var a=t("./mod");r.segmentsIntersect=n,r.segmentDistance=function(t,e,r,a,o,s,l,u){if(n(t,e,r,a,o,s,l,u))return 0;var c=r-t,f=a-e,h=l-o,d=u-s,p=c*c+f*f,g=h*h+d*d,v=Math.min(i(c,f,p,o-t,s-e),i(c,f,p,l-t,u-e),i(h,d,g,t-o,e-s),i(h,d,g,r-o,a-s));return Math.sqrt(v)};var o,s,l;r.getTextLocation=function(t,e,r,n){if(t===s&&n===l||(o={},s=t,l=n),o[r])return o[r];var i=t.getPointAtLength(a(r-n/2,e)),u=t.getPointAtLength(a(r+n/2,e)),c=Math.atan((u.y-i.y)/(u.x-i.x)),f=t.getPointAtLength(a(r,e)),h=(4*f.x+i.x+u.x)/6,d=(4*f.y+i.y+u.y)/6,p={x:h,y:d,theta:c};return o[r]=p,p},r.clearLocationCache=function(){s=null},r.getVisibleSegment=function(t,e,r){function n(e){var r=t.getPointAtLength(e);0===e?i=r:e===f&&(a=r);var n=r.xs?r.x-s:0,c=r.yu?r.y-u:0;return Math.sqrt(n*n+c*c)}for(var i,a,o=e.left,s=e.right,l=e.top,u=e.bottom,c=0,f=t.getTotalLength(),h=f,d=n(c);d;){if((c+=d+r)>h)return;d=n(c)}for(d=n(h);d;){if(h-=d+r,c>h)return;d=n(h)}return{min:c,max:h,len:h-c,total:f,isClosed:0===c&&h===f&&Math.abs(i.x-a.x)<.1&&Math.abs(i.y-a.y)<.1}}},{"./mod":409}],401:[function(t,e,r){"use strict";function n(t,e){var r=t;return r[3]*=e,r}function i(t){if(s(t))return f;var e=l(t);return e.length?e:f}function a(t){return s(t)?t:h}function o(t,e,r){var o,s,c,d,p,g=t.color,v=Array.isArray(g),m=Array.isArray(e),y=[];if(o=void 0!==t.colorscale?u.makeColorScaleFunc(u.extractScale(t.colorscale,t.cmin,t.cmax)):i,s=v?function(t,e){return void 0===t[e]?f:l(o(t[e]))}:i,c=m?function(t,e){return void 0===t[e]?h:a(t[e])}:a,v||m)for(var b=0;b",e))>=0;){var r=t.indexOf("",e);if(r/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(no?s:i(t)?Number(t):s):s},l.noop=t("./noop"),l.identity=t("./identity"),l.swapAttrs=function(t,e,r,n){r||(r="x"),n||(n="y");for(var i=0;ir?Math.max(r,Math.min(e,t)):Math.max(e,Math.min(r,t))},l.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},l.simpleMap=function(t,e,r,n){for(var i=t.length,a=new Array(i),o=0;o-1||c!==1/0&&c>=Math.pow(2,r)?t(e,r,n):l},l.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},l.smooth=function(t,e){if((e=Math.round(e)||0)<2)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;r=s&&(i-=s*Math.floor(i/s)),i<0?i=-1-i:i>=o&&(i=s-1-i),a+=t[i]*u[n];c[r]=a}return c},l.syncOrAsync=function(t,e,r){function n(){return l.syncOrAsync(t,e,r)}for(var i,a;t.length;)if(a=t.splice(0,1)[0],(i=a(e))&&i.then)return i.then(n).then(void 0,l.promiseError);return r&&r(e)},l.stripTrailingSlash=function(t){return"/"===t.substr(-1)?t.substr(0,t.length-1):t},l.noneOrAll=function(t,e,r){if(t){var n,i,a=!1,o=!0;for(n=0;n1?i+o[1]:"";if(a&&(o.length>1||s.length>4||r))for(;n.test(s);)s=s.replace(n,"$1"+a+"$2");return s+l}},{"../constants/numerical":387,"./clean_number":392,"./coerce":393,"./dates":394,"./ensure_array":395,"./extend":397,"./filter_unique":398,"./filter_visible":399,"./geometry2d":400,"./identity":403,"./is_array":405,"./is_plain_object":406,"./loggers":407,"./matrix":408,"./mod":409,"./nested_property":410,"./noop":411,"./notifier":412,"./push_unique":415,"./relink_private":417,"./search":418,"./stats":421,"./to_log_range":424,d3:79,"fast-isnumeric":87}],405:[function(t,e,r){"use strict";var n="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer:{isView:function(){return!1}};e.exports=function(t){return Array.isArray(t)||n.isView(t)}},{}],406:[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}},{}],407:[function(t,e,r){"use strict";function n(t,e){if(t.apply)t.apply(t,e);else for(var r=0;r1){for(var t=["LOG:"],e=0;e0){for(var t=["WARN:"],e=0;e0){for(var t=["ERROR:"],e=0;e=0;e--){if(n=t[e][0],a=t[e][1],l=!1,d(n))for(r=n.length-1;r>=0;r--)i(n[r],o(a,r))?l?n[r]=void 0:n.pop():l=!0;else if("object"==typeof n&&null!==n)for(s=Object.keys(n),l=!1,r=s.length-1;r>=0;r--)i(n[s[r]],o(a,s[r]))?delete n[s[r]]:l=!0;if(l)return}}function c(t){return void 0===t||null===t||"object"==typeof t&&(d(t)?!t.length:!Object.keys(t).length)}function f(t,e,r){return{set:function(){throw"bad container"},get:function(){},astr:e,parts:r,obj:t}}var h=t("fast-isnumeric"),d=t("./is_array"),p=t("./is_plain_object"),g=t("../plot_api/container_array_match");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,o,s=0,l=e.split(".");s/g),s=0;so||n===i||nl)&&(!e||!c(t))}function r(t,e){var r=t[0],u=t[1];if(r===i||ro||u===i||ul)return!1;var c,f,h,d,p,g=n.length,v=n[0][0],m=n[0][1],y=0;for(c=1;c","#62":">",nbsp:"\xa0","#160":"\xa0",times:"\xd7","#215":"\xd7",plusmn:"\xb1","#177":"\xb1",deg:"\xb0","#176":"\xb0"}}},{}],389:[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}},{}],390:[function(t,e,r){"use strict";var n=t("./plotly");r.version="1.29.2",t("es6-promise").polyfill(),t("../build/plotcss"),t("./fonts/mathjax_config"),r.plot=n.plot,r.newPlot=n.newPlot,r.restyle=n.restyle,r.relayout=n.relayout,r.redraw=n.redraw,r.update=n.update,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=t("./plot_api/register"),r.toImage=t("./plot_api/to_image"),r.downloadImage=t("./snapshot/download"),r.validate=t("./plot_api/validate"),r.addFrames=n.addFrames,r.deleteFrames=n.deleteFrames,r.animate=n.animate,r.register(t("./traces/scatter")),r.register([t("./components/fx"),t("./components/legend"),t("./components/annotations"),t("./components/annotations3d"),t("./components/shapes"),t("./components/images"),t("./components/updatemenus"),t("./components/sliders"),t("./components/rangeslider"),t("./components/rangeselector")]),r.Icons=t("../build/ploticon"),r.Plots=n.Plots,r.Fx=t("./components/fx"),r.Snapshot=t("./snapshot"),r.PlotSchema=t("./plot_api/plot_schema"),r.Queue=t("./lib/queue"),r.d3=t("d3")},{"../build/plotcss":1,"../build/ploticon":2,"./components/annotations":280,"./components/annotations3d":285,"./components/fx":328,"./components/images":336,"./components/legend":344,"./components/rangeselector":356,"./components/rangeslider":362,"./components/shapes":369,"./components/sliders":375,"./components/updatemenus":381,"./fonts/mathjax_config":391,"./lib/queue":416,"./plot_api/plot_schema":431,"./plot_api/register":432,"./plot_api/set_plot_config":433,"./plot_api/to_image":435,"./plot_api/validate":436,"./plotly":437,"./snapshot":495,"./snapshot/download":492,"./traces/scatter":517,d3:79,"es6-promise":84}],391:[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},{}],392:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../constants/numerical").BADNUM,a=/^['"%,$#\s']+|[, ]|['"%,$#\s']+$/g;e.exports=function(t){return"string"==typeof t&&(t=t.replace(a,"")),n(t)?Number(t):i}},{"../constants/numerical":387,"fast-isnumeric":87}],393:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("tinycolor2"),a=t("../plots/attributes"),o=t("../components/colorscale/get_scale"),s=(Object.keys(t("../components/colorscale/scales")),t("./nested_property")),l=/^([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)},validateFunction:function(t,e){e.coerceNumber&&(t=+t);for(var r=e.values,n=0;ni.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;!0!==n.strict&&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;if("string"==typeof t&&t.substr(0,n)===r&&l.test(t.substr(n)))return void e.set(t);e.set(r)},validateFunction:function(t,e){var r=e.dflt,n=r.length;return t===r||"string"==typeof t&&!(t.substr(0,n)!==r||!l.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;a0&&(o=o.replace(/0+$/,"").replace(/[\.]$/,"")),n+=":"+o}return n}function l(t){return t.formatDate("yyyy")}function u(t){return t.formatDate("M yyyy")}function c(t){return t.formatDate("M d")}function f(t){return t.formatDate("M d, yyyy")}var h=t("d3"),d=t("fast-isnumeric"),p=t("./loggers").error,g=t("./mod"),v=t("../constants/numerical"),m=v.BADNUM,y=v.ONEDAY,b=v.ONEHOUR,x=v.ONEMIN,_=v.ONESEC,w=v.EPOCHJD,M=t("../registry"),A=h.time.format.utc,k=/^\s*(-?\d\d\d\d|\d\d)(-(\d?\d)(-(\d?\d)([ Tt]([01]?\d|2[0-3])(:([0-5]\d)(:([0-5]\d(\.\d+)?))?(Z|z|[+\-]\d\d:?\d\d)?)?)?)?)?\s*$/m,T=/^\s*(-?\d\d\d\d|\d\d)(-(\d?\di?)(-(\d?\d)([ Tt]([01]?\d|2[0-3])(:([0-5]\d)(:([0-5]\d(\.\d+)?))?(Z|z|[+\-]\d\d:?\d\d)?)?)?)?)?\s*$/m,E=(new Date).getFullYear()-70;r.dateTick0=function(t,e){return n(t)?e?M.getComponentMethod("calendars","CANONICAL_SUNDAY")[t]:M.getComponentMethod("calendars","CANONICAL_TICK")[t]:e?"2000-01-02":"2000-01-01"},r.dfltRange=function(t){return n(t)?M.getComponentMethod("calendars","DFLTRANGE")[t]:["2000-01-01","2001-01-01"]},r.isJSDate=function(t){return"object"==typeof t&&null!==t&&"function"==typeof t.getTime};var L,C;r.dateTime2ms=function(t,e){if(r.isJSDate(t))return t=Number(t)-t.getTimezoneOffset()*x,t>=L&&t<=C?t:m;if("string"!=typeof t&&"number"!=typeof t)return m;t=String(t);var i=n(e),a=t.charAt(0);!i||"G"!==a&&"g"!==a||(t=t.substr(1),e="");var o=i&&"chinese"===e.substr(0,7),s=t.match(o?T:k);if(!s)return m;var l=s[1],u=s[3]||"1",c=Number(s[5]||1),f=Number(s[7]||0),h=Number(s[9]||0),d=Number(s[11]||0);if(i){if(2===l.length)return m;l=Number(l);var p;try{var g=M.getComponentMethod("calendars","getCal")(e);if(o){var v="i"===u.charAt(u.length-1);u=parseInt(u,10),p=g.newDate(l,g.toMonthIndex(l,u,v),c)}else p=g.newDate(l,Number(u),c)}catch(t){return m}return p?(p.toJD()-w)*y+f*b+h*x+d*_:m}l=2===l.length?(Number(l)+2e3-E)%100+E:Number(l),u-=1;var A=new Date(Date.UTC(2e3,u,c,f,h));return A.setUTCFullYear(l),A.getUTCMonth()!==u?m:A.getUTCDate()!==c?m:A.getTime()+d*_},L=r.MIN_MS=r.dateTime2ms("-9999"),C=r.MAX_MS=r.dateTime2ms("9999-12-31 23:59:59.9999"),r.isDateTime=function(t,e){return r.dateTime2ms(t,e)!==m};var S=90*y,P=3*b,R=5*x;r.ms2DateTime=function(t,e,r){if("number"!=typeof t||!(t>=L&&t<=C))return m;e||(e=0);var i,o,s,l,u,c,f=Math.floor(10*g(t+.05,1)),h=Math.round(t-f/10);if(n(r)){var d=Math.floor(h/y)+w,p=Math.floor(g(t,y));try{i=M.getComponentMethod("calendars","getCal")(r).fromJD(d).formatDate("yyyy-mm-dd")}catch(t){i=A("G%Y-%m-%d")(new Date(h))}if("-"===i.charAt(0))for(;i.length<11;)i="-0"+i.substr(1);else for(;i.length<10;)i="0"+i;o=e=L+y&&t<=C-y))return m;var e=Math.floor(10*g(t+.05,1)),r=new Date(Math.round(t-e/10));return a(h.time.format("%Y-%m-%d")(r),r.getHours(),r.getMinutes(),r.getSeconds(),10*r.getUTCMilliseconds()+e)},r.cleanDate=function(t,e,i){if(r.isJSDate(t)||"number"==typeof t){if(n(i))return p("JS Dates and milliseconds are incompatible with world calendars",t),e;if(!(t=r.ms2DateTimeLocal(+t))&&void 0!==e)return e}else if(!r.isDateTime(t,i))return p("unrecognized date",t),e;return t};var O=/%\d?f/g,N=[59,59.9,59.99,59.999,59.9999],I=A("%Y"),z=A("%b %Y"),D=A("%b %-d"),j=A("%b %-d, %Y");r.formatDate=function(t,e,r,i){var a,h;if(i=n(i)&&i,e)return o(e,t,i);if(i)try{var d=Math.floor((t+.05)/y)+w,p=M.getComponentMethod("calendars","getCal")(i).fromJD(d);"y"===r?h=l(p):"m"===r?h=u(p):"d"===r?(a=l(p),h=c(p)):(a=f(p),h=s(t,r))}catch(t){return"Invalid"}else{var g=new Date(Math.floor(t+.05));"y"===r?h=I(g):"m"===r?h=z(g):"d"===r?(a=I(g),h=D(g)):(a=j(g),h=s(t,r))}return h+(a?"\n"+a:"")};var F=3*y;r.incrementMonth=function(t,e,r){r=n(r)&&r;var i=g(t,y);if(t=Math.round(t-i),r)try{var a=Math.round(t/y)+w,o=M.getComponentMethod("calendars","getCal")(r),s=o.fromJD(a);return e%12?o.add(s,e,"m"):o.add(s,e/12,"y"),(s.toJD()-w)*y+i}catch(e){p("invalid ms "+t+" in calendar "+r)}var l=new Date(t+F);return l.setUTCMonth(l.getUTCMonth()+e)+i-F},r.findExactDates=function(t,e){for(var r,i,a=0,o=0,s=0,l=0,u=n(e)&&M.getComponentMethod("calendars","getCal")(e),c=0;c1||g<0||g>1?null:{x:t+l*g,y:e+f*g}}function i(t,e,r,n,i){var a=n*t+i*e;if(a<0)return n*n+i*i;if(a>r){var o=n-t,s=i-e;return o*o+s*s}var l=n*e-i*t;return l*l/r}var a=t("./mod");r.segmentsIntersect=n,r.segmentDistance=function(t,e,r,a,o,s,l,u){if(n(t,e,r,a,o,s,l,u))return 0;var c=r-t,f=a-e,h=l-o,d=u-s,p=c*c+f*f,g=h*h+d*d,v=Math.min(i(c,f,p,o-t,s-e),i(c,f,p,l-t,u-e),i(h,d,g,t-o,e-s),i(h,d,g,r-o,a-s));return Math.sqrt(v)};var o,s,l;r.getTextLocation=function(t,e,r,n){if(t===s&&n===l||(o={},s=t,l=n),o[r])return o[r];var i=t.getPointAtLength(a(r-n/2,e)),u=t.getPointAtLength(a(r+n/2,e)),c=Math.atan((u.y-i.y)/(u.x-i.x)),f=t.getPointAtLength(a(r,e)),h=(4*f.x+i.x+u.x)/6,d=(4*f.y+i.y+u.y)/6,p={x:h,y:d,theta:c};return o[r]=p,p},r.clearLocationCache=function(){s=null},r.getVisibleSegment=function(t,e,r){function n(e){var r=t.getPointAtLength(e);0===e?i=r:e===f&&(a=r);var n=r.xs?r.x-s:0,c=r.yu?r.y-u:0;return Math.sqrt(n*n+c*c)}for(var i,a,o=e.left,s=e.right,l=e.top,u=e.bottom,c=0,f=t.getTotalLength(),h=f,d=n(c);d;){if((c+=d+r)>h)return;d=n(c)}for(d=n(h);d;){if(h-=d+r,c>h)return;d=n(h)}return{min:c,max:h,len:h-c,total:f,isClosed:0===c&&h===f&&Math.abs(i.x-a.x)<.1&&Math.abs(i.y-a.y)<.1}}},{"./mod":409}],401:[function(t,e,r){"use strict";function n(t,e){var r=t;return r[3]*=e,r}function i(t){if(s(t))return f;var e=l(t);return e.length?e:f}function a(t){return s(t)?t:h}function o(t,e,r){var o,s,c,d,p,g=t.color,v=Array.isArray(g),m=Array.isArray(e),y=[];if(o=void 0!==t.colorscale?u.makeColorScaleFunc(u.extractScale(t.colorscale,t.cmin,t.cmax)):i,s=v?function(t,e){return void 0===t[e]?f:l(o(t[e]))}:i,c=m?function(t,e){return void 0===t[e]?h:a(t[e])}:a,v||m)for(var b=0;b",e))>=0;){var r=t.indexOf("",e);if(r/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(no?s:i(t)?Number(t):s):s},l.noop=t("./noop"),l.identity=t("./identity"),l.swapAttrs=function(t,e,r,n){r||(r="x"),n||(n="y");for(var i=0;ir?Math.max(r,Math.min(e,t)):Math.max(e,Math.min(r,t))},l.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},l.simpleMap=function(t,e,r,n){for(var i=t.length,a=new Array(i),o=0;o-1||c!==1/0&&c>=Math.pow(2,r)?t(e,r,n):l},l.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},l.smooth=function(t,e){if((e=Math.round(e)||0)<2)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;r=s&&(i-=s*Math.floor(i/s)),i<0?i=-1-i:i>=o&&(i=s-1-i),a+=t[i]*u[n];c[r]=a}return c},l.syncOrAsync=function(t,e,r){function n(){return l.syncOrAsync(t,e,r)}for(var i,a;t.length;)if(a=t.splice(0,1)[0],(i=a(e))&&i.then)return i.then(n).then(void 0,l.promiseError);return r&&r(e)},l.stripTrailingSlash=function(t){return"/"===t.substr(-1)?t.substr(0,t.length-1):t},l.noneOrAll=function(t,e,r){if(t){var n,i,a=!1,o=!0;for(n=0;n1?i+o[1]:"";if(a&&(o.length>1||s.length>4||r))for(;n.test(s);)s=s.replace(n,"$1"+a+"$2");return s+l}},{"../constants/numerical":387,"./clean_number":392,"./coerce":393,"./dates":394,"./ensure_array":395,"./extend":397,"./filter_unique":398,"./filter_visible":399,"./geometry2d":400,"./identity":403,"./is_array":405,"./is_plain_object":406,"./loggers":407,"./matrix":408,"./mod":409,"./nested_property":410,"./noop":411,"./notifier":412,"./push_unique":415,"./relink_private":417,"./search":418,"./stats":421,"./to_log_range":424,d3:79,"fast-isnumeric":87}],405:[function(t,e,r){"use strict";var n="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer:{isView:function(){return!1}};e.exports=function(t){return Array.isArray(t)||n.isView(t)}},{}],406:[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}},{}],407:[function(t,e,r){"use strict";function n(t,e){if(t.apply)t.apply(t,e);else for(var r=0;r1){for(var t=["LOG:"],e=0;e0){for(var t=["WARN:"],e=0;e0){for(var t=["ERROR:"],e=0;e=0;e--){if(n=t[e][0],a=t[e][1],l=!1,d(n))for(r=n.length-1;r>=0;r--)i(n[r],o(a,r))?l?n[r]=void 0:n.pop():l=!0;else if("object"==typeof n&&null!==n)for(s=Object.keys(n),l=!1,r=s.length-1;r>=0;r--)i(n[s[r]],o(a,s[r]))?delete n[s[r]]:l=!0;if(l)return}}function c(t){return void 0===t||null===t||"object"==typeof t&&(d(t)?!t.length:!Object.keys(t).length)}function f(t,e,r){return{set:function(){throw"bad container"},get:function(){},astr:e,parts:r,obj:t}}var h=t("fast-isnumeric"),d=t("./is_array"),p=t("./is_plain_object"),g=t("../plot_api/container_array_match");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,o,s=0,l=e.split(".");s/g),s=0;so||n===i||nl)&&(!e||!c(t))}function r(t,e){var r=t[0],u=t[1];if(r===i||ro||u===i||ul)return!1;var c,f,h,d,p,g=n.length,v=n[0][0],m=n[0][1],y=0;for(c=1;cMath.max(f,v)||u>Math.max(h,m)))if(uc||Math.abs(n(o,h))>i)return!0;return!1};a.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){r(t.pop())}return{addPt:r,raw:t,filtered:n}}},{"../constants/numerical":387,"./matrix":408}],415:[function(t,e,r){"use strict";e.exports=function(t,e){if(e instanceof RegExp){var r,n=e.toString();for(r=0;ra.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;re}function o(t,e){return t>=e}var s=t("fast-isnumeric"),l=t("./loggers");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;f90&&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;se[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;it.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":87}],422:[function(t,e,r){"use strict";function n(t){var e=i(t);return e.length?e:[0,0,0,1]}var i=t("color-rgba");e.exports=n},{"color-rgba":62}],423:[function(t,e,r){"use strict";function n(t,e){return t.node().getBoundingClientRect()[e]}function i(t){return t.replace(m,"\\lt ").replace(y,"\\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){if(!t)return null;var r=t.match(e);return r&&(r[3]||r[4])}function s(t,e){if(!t)return"";for(var r=0;r1)for(var i=1;i doesnt match end tag <"+t+">. Pretending it did match.",e),a=u[u.length-1].node}(A);else{var I=y[4],z={type:A},D=o(I,S);if(D?(D=D.replace(N,"$1 fill:"),k&&(D+=";"+k)):k&&(D=k),D&&(z.style=D),"a"===A){s=!0;var j=o(I,P);if(j){var F=document.createElement("a");F.href=j,-1!==M.indexOf(F.protocol)&&(z.href=encodeURI(j),z.target=o(I,R)||"_blank",z.popup=o(I,O))}}n(z)}}return s}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"),g=t("../constants/alignment").LINE_SPACING,v=/([^$]*)([$]+[^$]*[$]+)([^$]*)/;r.convertToTspans=function(t,e,i){function o(){c.empty()||(h=t.attr("class")+"-math",c.select("svg."+h).remove()),t.text("").style("white-space","pre"),u(t.node(),s)&&t.style("pointer-events","all"),r.positionText(t),i&&i.call(t)}var s=t.text(),l=!t.attr("data-notex")&&"undefined"!=typeof MathJax&&s.match(v),c=f.select(t.node().parentNode);if(!c.empty()){var h=t.attr("class")?t.attr("class").split(" ")[0]:"text";return h+="-math",c.selectAll("svg."+h).remove(),c.selectAll("g."+h+"-group").remove(),t.style("display",null).attr({"data-unformatted":s,"data-math":"N"}),l?(e&&e._promises||[]).push(new Promise(function(e){t.style("display","none");var r={fontSize:parseInt(t.style("font-size"),10)};a(l[2],r,function(r,a,l){c.selectAll("svg."+h).remove(),c.selectAll("g."+h+"-group").remove();var u=r&&r.select("svg");if(!u||!u.node())return o(),void e();var f=c.append("g").classed(h+"-group",!0).attr({"pointer-events":"none","data-unformatted":s,"data-math":"Y"});f.node().appendChild(u.node()),a&&a.node()&&u.node().insertBefore(a.node().cloneNode(!0),u.node().firstChild),u.attr({class:h,height:l.height,preserveAspectRatio:"xMinYMin meet"}).style({overflow:"visible","pointer-events":"none"});var d=t.style("fill")||"black";u.select("g").attr({fill:d,stroke:d});var p=n(u,"width"),g=n(u,"height"),v=+t.attr("x")-p*{start:0,middle:.5,end:1}[t.attr("text-anchor")||"start"],m=parseInt(t.style("font-size"),10)||n(t,"height"),y=-m/4;"y"===h[0]?(f.attr({transform:"rotate("+[-90,+t.attr("x"),+t.attr("y")]+") translate("+[-p/2,y-g/2]+")"}),u.attr({x:+t.attr("x"),y:+t.attr("y")})):"l"===h[0]?u.attr({x:t.attr("x"),y:y-g/2}):"a"===h[0]?u.attr({x:0,y:y}):u.attr({x:v,y:+t.attr("y")+y-g/2}),i&&i.call(t,f),e(f)})})):o(),t}};var m=/(<|<|<)/g,y=/(>|>|>)/g,b={sup:"font-size:70%",sub:"font-size:70%",b:"font-weight:bold",i:"font-style:italic",a:"cursor:pointer",span:"",em:"font-style:italic;font-weight:bold"},x={sub:"0.3em",sup:"-0.6em"},_={sub:"-0.21em",sup:"0.42em"},w="\u200b",M=["http:","https:","mailto:","",void 0,":"],A=new RegExp("]*)?/?>","g"),k=Object.keys(p.entityToUnicode).map(function(t){return{regExp:new RegExp("&"+t+";","g"),sub:p.entityToUnicode[t]}}),T=/(\r\n?|\n)/g,E=/(<[^<>]*>)/,L=/<(\/?)([^ >]*)(\s+(.*))?>/i,C=//i,S=/(^|[\s"'])style\s*=\s*("([^"]*);?"|'([^']*);?')/i,P=/(^|[\s"'])href\s*=\s*("([^"]*)"|'([^']*)')/i,R=/(^|[\s"'])target\s*=\s*("([^"\s]*)"|'([^'\s]*)')/i,O=/(^|[\s"'])popup\s*=\s*("([\w=,]*)"|'([\w=,]*)')/i,N=/(^|;)\s*color:/;r.plainText=function(t){return(t||"").replace(A," ")},r.lineCount=function(t){return t.selectAll("tspan.line").size()||1},r.positionText=function(t,e,r){return t.each(function(){function t(t,e){return void 0===e?null===(e=n.attr(t))&&(n.attr(t,0),e=0):n.attr(t,e),e}var n=f.select(this),i=t("x",e),a=t("y",r);"text"===this.nodeName&&n.selectAll("tspan.line").attr({x:i,y:a})})},r.makeEditable=function(t,e){function r(){i(),t.style({opacity:0});var e,r=l.attr("class");(e=r?"."+r.split(" ")[0]+"-math-group":"[class*=-math-group]")&&f.select(t.node().parentNode).select(e).style({opacity:0})}function n(t){var e=t.node(),r=document.createRange();r.selectNodeContents(e);var n=window.getSelection();n.removeAllRanges(),n.addRange(r),e.focus()}function i(){var r=f.select(a),i=r.select(".svg-container"),o=i.append("div");o.classed("plugin-editable editable",!0).style({position:"absolute","font-family":t.style("font-family")||"Arial","font-size":t.style("font-size")||12,color:e.fill||t.style("fill")||"black",opacity:1,"background-color":e.background||"transparent",outline:"#ffffff33 1px solid",margin:[-parseFloat(t.style("font-size"))/8+1,0,0,-1].join("px ")+"px",padding:"0","box-sizing":"border-box"}).attr({contenteditable:!0}).text(e.text||t.attr("data-unformatted")).call(c(t,i,e)).on("blur",function(){a._editing=!1,t.text(this.textContent).style({opacity:1});var e,r=f.select(this).attr("class");(e=r?"."+r.split(" ")[0]+"-math-group":"[class*=-math-group]")&&f.select(t.node().parentNode).select(e).style({opacity:0});var n=this.textContent;f.select(this).transition().duration(0).remove(),f.select(document).on("mouseup",null),s.edit.call(t,n)}).on("focus",function(){var t=this;a._editing=!0,f.select(document).on("mouseup",function(){if(f.event.target===t)return!1;document.activeElement===o.node()&&o.node().blur()})}).on("keyup",function(){27===f.event.which?(a._editing=!1,t.style({opacity:1}),f.select(this).style({opacity:0}).on("blur",function(){return!1}).transition().remove(),s.cancel.call(t,this.textContent)):(s.input.call(t,this.textContent),f.select(this).call(c(t,i,e)))}).on("keydown",function(){13===f.event.which&&this.blur()}).call(n)}var a=e.gd,o=e.delegate,s=f.dispatch("edit","input","cancel"),l=o||t;if(t.style({"pointer-events":o?"none":"all"}),1!==t.size())throw new Error("boo");return e.immediate?r():l.on("click",r),f.rebind(t,s,"on")}},{"../constants/alignment":383,"../constants/string_mappings":388,"../constants/xmlns_namespaces":389,"../lib":404,d3:79}],424:[function(t,e,r){"use strict";var n=t("fast-isnumeric");e.exports=function(t,e){if(t>0)return Math.log(t)/Math.LN10;var r=Math.log(Math.min(e[0],e[1]))/Math.LN10;return n(r)||(r=Math.log(Math.max(e[0],e[1]))/Math.LN10-6),r}},{"fast-isnumeric":87}],425:[function(t,e,r){"use strict";var n=t("../registry");e.exports=function(t){for(var e,r,i=n.layoutArrayContainers,a=n.layoutArrayRegexes,o=t.split("[")[0],s=0;s0)return t.substr(0,e)}var s=t("fast-isnumeric"),l=t("gl-mat4/fromQuat"),u=t("../registry"),c=t("../lib"),f=t("../plots/plots"),h=t("../plots/cartesian/axes"),d=t("../components/color");r.getGraphDiv=function(t){var e;if("string"==typeof t){if(null===(e=document.getElementById(t)))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},r.clearPromiseQueue=function(t){Array.isArray(t._promises)&&t._promises.length>0&&c.log("Clearing previous rejected promises from queue."),t._promises=[]},r.cleanLayout=function(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 i=h.list({_fullLayout:t});for(e=0;e3?(v.x=1.02,v.xanchor="left"):v.x<-2&&(v.x=-.02,v.xanchor="right"),v.y>3?(v.y=1.02,v.yanchor="bottom"):v.y<-2&&(v.y=-.02,v.yanchor="top")),"rotate"===t.dragmode&&(t.dragmode="orbit"),t.scene1&&(t.scene||(t.scene=t.scene1),delete t.scene1);var m=f.getSubplotIds(t,"gl3d");for(e=0;e1&&o.warn("Full array edits are incompatible with other edits",f);var y=r[""][""];if(c(y))e.set(null);else{if(!Array.isArray(y))return o.warn("Unrecognized full array edit value",f,y),!0;e.set(y)}return!g&&(h(v,m),d(t),!0)}var b,x,_,w,M,A,k,T=Object.keys(r).map(Number).sort(s),E=e.get(),L=E||[],C=n(m,f).get(),S=[],P=-1,R=L.length;for(b=0;bL.length-(k?0:1))o.warn("index out of range",f,_);else if(void 0!==A)M.length>1&&o.warn("Insertion & removal are incompatible with edits to the same index.",f,_),c(A)?S.push(_):k?("add"===A&&(A={}),L.splice(_,0,A),C&&C.splice(_,0,{})):o.warn("Unrecognized full object edit value",f,_,A),-1===P&&(P=_);else for(x=0;x=0;b--)L.splice(S[b],1),C&&C.splice(S[b],1);if(L.length?E||e.set(L):e.set(null),g)return!1;if(h(v,m),p!==a){var O;if(-1===P)O=T;else{for(R=Math.max(L.length,R),O=[],b=0;b=P);b++)O.push(_);for(b=P;b=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||i<0&&e.indexOf(t.data.length+i)>-1)throw new Error("each index in "+r+" must be unique.")}}function l(t,e,r){if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if(void 0===e)throw new Error("currentIndices is a required argument.");if(Array.isArray(e)||(e=[e]),s(t,e,"currentIndices"),void 0===r||Array.isArray(r)||(r=[r]),void 0!==r&&s(t,r,"newIndices"),void 0!==r&&e.length!==r.length)throw new Error("current and new indices must be of equal length.")}function u(t,e,r){var n,i;if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if(void 0===e)throw new Error("traces must be defined.");for(Array.isArray(e)||(e=[e]),n=0;n=0&&lH.range[0]?[1,2]:[2,1]);else{var X=H.range[0],W=H.range[1];q?(X<=0&&W<=0&&r(D+".autorange",!0),X<=0?X=W/1e6:W<=0&&(W=X/1e6),r(D+".range[0]",Math.log(X)/Math.LN10),r(D+".range[1]",Math.log(W)/Math.LN10)):(r(D+".range[0]",Math.pow(10,X)),r(D+".range[1]",Math.pow(10,W)))}else r(D+".autorange",!0);M.getComponentMethod("annotations","convertCoords")(t,B,E,r),M.getComponentMethod("images","convertCoords")(t,B,E,r)}else r(D+".autorange",!0);x.nestedProperty(u,D+"._inputRange").set(null)}else if(O.match(I.AX_NAME_PATTERN)){var Y=x.nestedProperty(u,k).get(),Z=(E||{}).type;Z&&"-"!==Z||(Z="linear"),M.getComponentMethod("annotations","convertCoords")(t,Y,Z,r),M.getComponentMethod("images","convertCoords")(t,Y,Z,r)}var Q=P.containerArrayMatch(k);if(Q){a=Q.array,o=Q.index;var $=Q.property,K=x.nestedProperty(l,a),J=(K||[])[o]||{};if(""===o)-1===k.indexOf("updatemenus")&&(m.docalc=!0);else if(""===$){var tt=E;P.isAddVal(E)?_[k]=null:P.isRemoveVal(E)?(_[k]=J,tt=J):x.warn("unrecognized full object value",e),(n(tt,"x")||n(tt,"y")&&-1===k.indexOf("updatemenus"))&&(m.docalc=!0)}else!n(J,"x")&&!n(J,"y")||x.containsAny(k,["color","opacity","align","dash","updatemenus"])||(m.docalc=!0);h[a]||(h[a]={});var et=h[a][o];et||(et=h[a][o]={}),et[$]=E,delete e[k]}else if("reverse"===O)j.range?j.range.reverse():(r(D+".autorange",!0),j.range=[1,0]),B.autorange?m.docalc=!0:m.doplot=!0;else{var rt=String(T.parts[1]||"");0===S.indexOf("scene")?"camera"===T.parts[1]?m.docamera=!0:m.doplot=!0:0===S.indexOf("geo")?m.doplot=!0:0===S.indexOf("ternary")?m.doplot=!0:"paper_bgcolor"===k?m.doplot=!0:"margin"===S||"autorange"===rt||"rangemode"===rt||"type"===rt||"domain"===rt||"fixedrange"===rt||"scaleanchor"===rt||"scaleratio"===rt||-1!==k.indexOf("calendar")||k.match(/^(bar|box|font)/)?m.docalc=!0:!u._has("gl2d")||-1===k.indexOf("axis")&&"plot_bgcolor"!==k?!u._has("gl2d")||"dragmode"!==k||"lasso"!==E&&"select"!==E||"lasso"===U||"select"===U?"hiddenlabels"===k?m.docalc=!0:-1!==S.indexOf("legend")?m.dolegend=!0:-1!==k.indexOf("title")?m.doticks=!0:-1!==S.indexOf("bgcolor")?m.dolayoutstyle=!0:L>1&&x.containsAny(rt,["tick","exponent","grid","zeroline"])?m.doticks=!0:-1!==k.indexOf(".linewidth")&&-1!==k.indexOf("axis")?m.doticks=m.dolayoutstyle=!0:L>1&&-1!==rt.indexOf("line")?m.dolayoutstyle=!0:L>1&&"mirror"===rt?m.doticks=m.dolayoutstyle=!0:"margin.pad"===k?m.doticks=m.dolayoutstyle=!0:-1!==["hovermode","dragmode"].indexOf(k)||-1!==k.indexOf("spike")?m.domodebar=!0:-1===["height","width","autosize"].indexOf(k)&&(m.doplot=!0):m.docalc=!0:m.doplot=!0,T.set(E)}}}for(a in h){P.applyContainerArrayChanges(t,x.nestedProperty(l,a),h[a],m)||(m.doplot=!0)}var nt=u._axisConstraintGroups;for(v in w)for(o=0;o=s.length?s[0]:s[t]:s}function i(t){return Array.isArray(l)?t>=l.length?l[0]:l[t]:l}function a(t,e){var r=0;return function(){if(t&&++r===e)return t()}}if(t=R.getGraphDiv(t),!x.isPlotDiv(t))throw new Error("This element is not a Plotly plot: "+t+". It's likely that you've failed to create a plot before animating it. For more details, see https://plot.ly/javascript/animations/");var o=t._transitionData;o._frameQueue||(o._frameQueue=[]),r=A.supplyAnimationDefaults(r);var s=r.transition,l=r.frame;return void 0===o._frameWaitingCnt&&(o._frameWaitingCnt=0),new Promise(function(l,u){function c(){t.emit("plotly_animated"),window.cancelAnimationFrame(o._animationRaf),o._animationRaf=null}function f(){o._currentFrame&&o._currentFrame.onComplete&&o._currentFrame.onComplete();var e=o._currentFrame=o._frameQueue.shift();if(e){var r=e.name?e.name.toString():null;t._fullLayout._currentFrame=r,o._lastFrameAt=Date.now(),o._timeToNext=e.frameOpts.duration,A.transition(t,e.frame.data,e.frame.layout,R.coerceTraceIndices(t,e.frame.traces),e.frameOpts,e.transitionOpts).then(function(){e.onComplete&&e.onComplete()}),t.emit("plotly_animatingframe",{name:r,frame:e.frame,animation:{frame:e.frameOpts,transition:e.transitionOpts}})}else c()}function h(){t.emit("plotly_animating"),o._lastFrameAt=-1/0,o._timeToNext=0,o._runningTransitions=0,o._currentFrame=null;var e=function(){o._animationRaf=window.requestAnimationFrame(e),Date.now()-o._lastFrameAt>o._timeToNext&&f()};e()}function d(t){return Array.isArray(s)?v>=s.length?t.transitionOpts=s[v]:t.transitionOpts=s[0]:t.transitionOpts=s,v++,t}var p,g,v=0,m=[],y=void 0===e||null===e,b=Array.isArray(e);if(y||b||!x.isPlainObject(e)){if(y||-1!==["string","number"].indexOf(typeof e))for(p=0;p0&&MM)&&k.push(g);m=k}}m.length>0?function(e){if(0!==e.length){for(var s=0;s=0;i--)if(x.isPlainObject(e[i])){var h=(u[e[i].name]||{}).name,d=e[i].name;h&&d&&"number"==typeof d&&u[h]&&(n++,x.warn('addFrames: overwriting frame "'+u[h].name+'" with a frame whose name of type "number" also equates to "'+h+'". This is valid but may potentially lead to unexpected behavior since all plotly.js frame names are stored internally as strings.'),n>5&&x.warn("addFrames: This API call has yielded too many warnings. For the rest of this call, further warnings about numeric frame names will be suppressed.")),f.push({frame:A.supplyFrameDefaults(e[i]),index:r&&void 0!==r[i]&&null!==r[i]?r[i]:c+i})}f.sort(function(t,e){return t.index>e.index?-1:t.index=0;i--){if(a=f[i].frame,"number"==typeof a.name&&x.warn("Warning: addFrames accepts frames with numeric names, but the numbers areimplicitly cast to strings"),!a.name)for(;u[a.name="frame "+t._transitionData._counter++];);if(u[a.name]){for(o=0;o=0;r--)n=e[r],a.push({type:"delete",index:n}),o.unshift({type:"insert",index:n,value:i[n]});var s=A.modifyFrames,l=A.modifyFrames,u=[t,o],c=[t,a];return w&&w.add(t,s,u,l,c),A.modifyFrames(t,a)},b.purge=function(t){t=R.getGraphDiv(t);var e=t._fullLayout||{},r=t._fullData||[];return A.cleanPlot([],{},r,e),A.purge(t),_.purge(t),e._container&&e._container.remove(),delete t._context,delete t._replotPending,delete t._mouseDownTime,delete t._legendMouseDownTime,delete t._hmpixcount,delete t._hmlumcount,t}},{"../components/drawing":311,"../components/errorbars":317,"../constants/xmlns_namespaces":389,"../lib":404,"../lib/events":396,"../lib/queue":416,"../lib/svg_text_utils":423,"../plotly":437,"../plots/cartesian/axis_ids":445,"../plots/cartesian/constants":447,"../plots/cartesian/constraints":449,"../plots/cartesian/graph_interact":451,"../plots/plots":482,"../plots/polar":485,"../registry":490,"./edit_types":426,"./helpers":427,"./manage_arrays":428,"./subroutines":434,d3:79,"fast-isnumeric":87,"has-hover":171}],430:[function(t,e,r){"use strict";function n(t,r){try{t._fullLayout._paper.style("background",r)}catch(t){e.exports.logging>0&&console.error(t)}}e.exports={staticPlot:!1,editable:!1,edits:{annotationPosition:!1,annotationTail:!1,annotationText:!1,axisTitleText:!1,colorbarPosition:!1,colorbarTitleText:!1,legendPosition:!1,legendText:!1,shapePosition:!1,titleText:!1},autosizable:!1,queueLength:0,fillFrame:!1,frameMargins:0,scrollZoom:!1,doubleClick:"reset+autosize",showTips:!0,showAxisDragHandles:!0,showAxisRangeEntryBoxes:!0,showLink:!1,sendData:!0,linkText:"Edit chart",showSources:!1,displayModeBar:"hover",modeBarButtonsToRemove:[],modeBarButtonsToAdd:[],modeBarButtons:!1,displaylogo:!0,plotGlPixelRatio:2,setBackground:n,topojsonURL:"https://cdn.plot.ly/",mapboxAccessToken:null,logging:!1,globalTransforms:[]}},{}],431:[function(t,e,r){"use strict";function n(t){var e,r;"area"===t?(e={attributes:b},r={}):(e=d.modules[t]._module,r=e.basePlotModule);var n={};n.type=null,M(n,g),M(n,e.attributes),r.attributes&&M(n,r.attributes),Object.keys(d.componentsRegistry).forEach(function(e){var r=d.componentsRegistry[e] ;r.schema&&r.schema.traces&&r.schema.traces[t]&&Object.keys(r.schema.traces[t]).forEach(function(e){h(n,r.schema.traces[t][e],e)})}),n.type=t;var i={meta:e.meta||{},attributes:s(n)};if(e.layoutAttributes){var a={};M(a,e.layoutAttributes),i.layoutAttributes=s(a)}return i}function i(){var t={};return M(t,v),Object.keys(d.subplotsRegistry).forEach(function(e){var r=d.subplotsRegistry[e];if(r.layoutAttributes)if("cartesian"===r.name)f(t,r,"xaxis"),f(t,r,"yaxis");else{var n="subplot"===r.attr?r.name:r.attr;f(t,r,n)}}),t=c(t),Object.keys(d.componentsRegistry).forEach(function(e){var r=d.componentsRegistry[e];r.layoutAttributes&&(r.schema&&r.schema.layout?Object.keys(r.schema.layout).forEach(function(e){h(t,r.schema.layout[e],e)}):h(t,r.layoutAttributes,r.name))}),{layoutAttributes:s(t)}}function a(t){var e=d.transformsRegistry[t],r=M({},e.attributes);return Object.keys(d.componentsRegistry).forEach(function(e){var n=d.componentsRegistry[e];n.schema&&n.schema.transforms&&n.schema.transforms[t]&&Object.keys(n.schema.transforms[t]).forEach(function(e){h(r,n.schema.transforms[t][e],e)})}),{attributes:s(r)}}function o(){var t={frames:p.extendDeep({},m)};return s(t),t.frames}function s(t){return l(t),u(t),t}function l(t){function e(t){return{valType:"string"}}function n(t,n,i){r.isValObject(t)?"data_array"===t.valType?(t.role="data",i[n+"src"]=e(n)):!0===t.arrayOk&&(i[n+"src"]=e(n)):p.isPlainObject(t)&&(t.role="object")}r.crawl(t,n)}function u(t){function e(t,e,r){if(t){var n=t[k];n&&(delete t[k],r[e]={items:{}},r[e].items[n]=t,r[e].role="object")}}r.crawl(t,e)}function c(t){return w(t,{radialaxis:x.radialaxis,angularaxis:x.angularaxis}),w(t,x.layout),t}function f(t,e,r){var n=p.nestedProperty(t,r),i=M({},e.layoutAttributes);i[A]=!0,n.set(i)}function h(t,e,r){var n=p.nestedProperty(t,r);n.set(M(n.get()||{},e))}var d=t("../registry"),p=t("../lib"),g=t("../plots/attributes"),v=t("../plots/layout_attributes"),m=t("../plots/frame_attributes"),y=t("../plots/animation_attributes"),b=t("../plots/polar/area_attributes"),x=t("../plots/polar/axis_attributes"),_=t("./edit_types"),w=p.extendFlat,M=p.extendDeep,A="_isSubplotObj",k="_isLinkedToArray",T=[A,k,"_arrayAttrRegexps","_deprecated"];r.IS_SUBPLOT_OBJ=A,r.IS_LINKED_TO_ARRAY=k,r.DEPRECATED="_deprecated",r.UNDERSCORE_ATTRS=T,r.get=function(){var t={};d.allTypes.concat("area").forEach(function(e){t[e]=n(e)});var e={};return Object.keys(d.transformsRegistry).forEach(function(t){e[t]=a(t)}),{defs:{valObjects:p.valObjects,metaKeys:T.concat(["description","role"]),editTypes:{traces:_.traces(),layout:_.layout()}},traces:t,layout:i(),transforms:e,frames:o(),animation:s(y)}},r.crawl=function(t,e,n){var i=n||0;Object.keys(t).forEach(function(n){var a=t[n];-1===T.indexOf(n)&&(e(a,n,t,i),r.isValObject(a)||p.isPlainObject(a)&&r.crawl(a,e,i+1))})},r.isValObject=function(t){return t&&void 0!==t.valType},r.findArrayAttributes=function(t){function e(e,r,o,s){if(a=a.slice(0,s).concat([r]),e&&("data_array"===e.valType||!0===e.arrayOk)&&!("colorbar"===a[s-1]&&("ticktext"===r||"tickvals"===r))){var l=n(a),u=p.nestedProperty(t,l).get();Array.isArray(u)&&i.push(l)}}function n(t){return t.join(".")}var i=[],a=[];if(r.crawl(g,e),t._module&&t._module.attributes&&r.crawl(t._module.attributes,e),t.transforms)for(var o=t.transforms,s=0;s=t[1]||i[1]<=t[0])&&(a[0]e[0]))return!0}return!1}function i(t,e,r){return t._anchorAxis===e&&(t.mirror||t.side===r)||"all"===t.mirror||"allticks"===t.mirror||t.mirrors&&t.mirrors[e._id+r]}function a(t,e,r){var n=[],i=e._anchorAxis;if(i){var a=i._mainAxis;if(-1===n.indexOf(a)){n.push(a);for(var o=0;o1)};h(e.width)&&h(e.height)||n(new Error("Height and width should be pixel values."));var d=l(t,{format:"png",height:e.height,width:e.width}),p=d.gd;p.style.position="absolute",p.style.left="-5000px",document.body.appendChild(p);var g=s.getRedrawFunc(p);a.plot(p,d.data,d.layout,d.config).then(g).then(f).then(function(t){r(t)}).catch(function(t){n(t)})})}var i=t("fast-isnumeric"),a=t("../plotly"),o=t("../lib"),s=t("../snapshot/helpers"),l=t("../snapshot/cloneplot"),u=t("../snapshot/tosvg"),c=t("../snapshot/svgtoimg");e.exports=n},{"../lib":404,"../plotly":437,"../snapshot/cloneplot":491,"../snapshot/helpers":494,"../snapshot/svgtoimg":496,"../snapshot/tosvg":498,"fast-isnumeric":87}],436:[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;m.3*f||a(n)||a(i))){var h=r.dtick/2;t+=t+h.8){var o=Number(r.substr(1));a.exactYears>.8&&o%12==0?t=I.tickIncrement(t,"M6","reverse")+1.5*S:a.exactMonths>.8?t=I.tickIncrement(t,"M1","reverse")+15.5*S:t-=S/2;var s=I.tickIncrement(t,r);if(s<=n)return s}return t}function a(t){var e,r,n=t.tickvals,i=t.ticktext,a=new Array(n.length),o=_.simpleMap(t.range,t.r2l),s=1.0001*o[0]-1e-4*o[1],u=1.0001*o[1]-1e-4*o[0],c=Math.min(s,u),f=Math.max(s,u),h=0;Array.isArray(i)||(i=[]);var d="category"===t.type?t.d2l_noadd:t.d2l;for("log"===t.type&&"L"!==String(t.dtick).charAt(0)&&(t.dtick="L"+Math.pow(10,Math.floor(Math.min(t.range[0],t.range[1]))-1)),r=0;rc&&e10||"01-01"!==n.substr(5)?t._tickround="d":t._tickround=+e.substr(1)%12==0?"y":"m";else if(e>=S&&i<=10||e>=15*S)t._tickround="d";else if(e>=R&&i<=16||e>=P)t._tickround="M";else if(e>=O&&i<=19||e>=R)t._tickround="S";else{var a=t.l2r(r+e).replace(/^-/,"").length;t._tickround=Math.max(i,a)-20}}else if(b(e)||"L"===e.charAt(0)){var o=t.range.map(t.r2d||Number);b(e)||(e=Number(e.substr(1))),t._tickround=2-Math.floor(Math.log(e)/Math.LN10+.01);var s=Math.max(Math.abs(o[0]),Math.abs(o[1])),l=Math.floor(Math.log(s)/Math.LN10+.01);Math.abs(l)>3&&("SI"===t.exponentformat||"B"===t.exponentformat?t._tickexponent=3*Math.round((l-1)/3):t._tickexponent=l)}else t._tickround=null}function l(t,e,r){var n=t.tickfont||{};return{x:e,dx:0,dy:0,text:r||"",fontSize:n.size,font:n.family,fontColor:n.color}}function u(t,e,r,n){var i=t._tickround,a=r&&t.hoverformat||t.tickformat;n&&(i=b(i)?4:{y:"m",m:"d",d:"M",M:"S",S:4}[i]);var o,s=_.formatDate(e.x,a,i,t.calendar),l=s.indexOf("\n");-1!==l&&(o=s.substr(l+1),s=s.substr(0,l)),n&&("00:00:00"===s||"00:00"===s?(s=o,o=""):8===s.length&&(s=s.replace(/:00$/,""))),o&&(r?"d"===i?s+=", "+o:s=o+(s?", "+s:""):t._inCalcTicks&&o===t._prevDateHead||(s+="
"+o,t._prevDateHead=o)),e.text=s}function c(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=d(Math.pow(10,o),t,i,n);else if(b(a)||"D"===a.charAt(0)&&_.mod(o+.01,1)<.1)if(-1!==["e","E","power"].indexOf(t.exponentformat)){var s=Math.round(o);e.text=0===s?1:1===s?"10":s>1?"10"+s+"":"10\u2212"+-s+"",e.fontSize*=1.25}else e.text=d(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,_.mod(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*(o<0?.5:.25)))}}function f(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=d(e.x,t,i,n)}function d(t,e,r,n){var i=t<0,a=e._tickround,o=r||e.exponentformat||"B",l=e._tickexponent,u=e.tickformat,c=e.separatethousands;if(n){var f={exponentformat:e.exponentformat,dtick:"none"===e.showexponent?e.dtick:b(t)?Math.abs(t)||1:1,range:"none"===e.showexponent?e.range.map(e.r2d):[0,t||1]};s(f),a=(Number(f._tickround)||0)+4,l=f._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"===o&&(l=0),(t=Math.abs(t))12||l<-15)?t+="e"+g:"E"===o?t+="E"+g:"power"===o?t+="\xd710"+g+"":"B"===o&&9===l?t+="B":"SI"!==o&&"B"!==o||(t+=q[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},I.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 g=n-1,v=n+1;r="tozero"===t.rangemode?n<0?[g,0]:[0,v]:"nonnegative"===t.rangemode?[Math.max(0,g),Math.max(0,v)]:[g,v]}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(),_.simpleMap(r,t.l2r||Number)},I.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=I.getAutoRange(t),t._r=t.range.slice(),t._rl=_.simpleMap(t._r,t.r2l);var r=t._input;r.range=t.range.slice(),r.autorange=t.autorange}},I.saveRangeInitial=function(t,e){for(var r=I.list(t,"",!0),n=!1,i=0;i=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||!!_.nestedProperty(t,"rangeslider.autorange").get())&&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);m&&"domain"===t.constrain&&t._inputDomain&&(m*=(t._inputDomain[1]-t._inputDomain[0])/(t.domain[1]-t.domain[0]));var x=n((t._m>0?r.ppadplus:r.ppadminus)||r.ppad||0),w=n((t._m>0?r.ppadminus:r.ppadplus)||r.ppad||0),M=n(r.vpadplus||r.vpad),A=n(r.vpadminus||r.vpad);for(a=0;a<6;a++)i(a);for(a=v-1;a>5;a--)i(a)}},I.autoBin=function(t,e,r,a,o){var s=_.aggNums(Math.min,null,t),l=_.aggNums(Math.max,null,t);if(o||(o=e.calendar),"category"===e.type)return{start:s-.5,end:l+.5,size:1};var u;if(r)u=(l-s)/r;else{var c=_.distinctVals(t),f=Math.pow(10,Math.floor(Math.log(c.minDiff)/Math.LN10)),h=f*_.roundUp(c.minDiff/f,[.9,1.9,4.9,9.9],!0);u=Math.max(h,2*_.stdev(t)/Math.pow(t.length,a?.25:.4)),b(u)||(u=1)}var d;d="log"===e.type?{type:"linear",range:[s,l]}:{type:e.type,range:_.simpleMap([s,l],e.c2r,0,o),calendar:o},I.setConvert(d),I.autoTicks(d,u);var p,g=I.tickIncrement(I.tickFirst(d),d.dtick,"reverse",o);if("number"==typeof d.dtick){g=n(g,t,d,s,l);p=g+(1+Math.floor((l-g)/d.dtick))*d.dtick}else for("M"===d.dtick.charAt(0)&&(g=i(g,t,d.dtick,s,o)),p=g;p<=l;)p=I.tickIncrement(p,d.dtick,!1,o);return{start:e.c2r(g,0,o),end:e.c2r(p,0,o),size:d.dtick}},I.calcTicks=function(t){var e=_.simpleMap(t.range,t.r2l);if("auto"===t.tickmode||!t.dtick){var r,n=t.nticks;n||("category"===t.type?(r=t.tickfont?1.2*(t.tickfont.size||12):15,n=t._length/r):(r="y"===t._id.charAt(0)?40:80,n=_.constrain(t._length/r,4,9)+1)),"array"===t.tickmode&&(n*=100), diff --git a/dist/plotly-mapbox.js b/dist/plotly-mapbox.js index b2c47a4f34c..ae19aa0cde2 100644 --- a/dist/plotly-mapbox.js +++ b/dist/plotly-mapbox.js @@ -1,5 +1,5 @@ /** -* plotly.js (mapbox) v1.29.1 +* plotly.js (mapbox) v1.29.2 * Copyright 2012-2017, Plotly, Inc. * All rights reserved. * Licensed under the MIT license @@ -63228,7 +63228,7 @@ exports.svgAttrs = { var Plotly = require('./plotly'); // package version injected by `npm run preprocess` -exports.version = '1.29.1'; +exports.version = '1.29.2'; // inject promise polyfill require('es6-promise').polyfill(); diff --git a/dist/plotly-mapbox.min.js b/dist/plotly-mapbox.min.js index 4c34ea8dab2..1b35fa1a22d 100644 --- a/dist/plotly-mapbox.min.js +++ b/dist/plotly-mapbox.min.js @@ -1,5 +1,5 @@ /** -* plotly.js (mapbox - minified) v1.29.1 +* plotly.js (mapbox - minified) v1.29.2 * Copyright 2012-2017, Plotly, Inc. * All rights reserved. * Licensed under the MIT license @@ -29,7 +29,7 @@ var r,i=ut.select(".h"+nt._id+"title-math-group").node();r=i&&-1!==["top","botto ;return"M"+n+","+l+"H"+i+"L"+a+","+u+"L"+o+","+c+"L0,"+r.round(.382*e,2)+"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:8}],260:[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"}}}},{}],261:[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;f0;t.each(function(t){var h,d=t[0].trace,p=d.error_x||{},m=d.error_y||{};d.ids&&(h=function(t){return t.id});var g=s.hasMarkers(d)&&d.marker.maxdisplayed>0;if(m.visible||p.visible){var v=i.select(this).selectAll("g.errorbar").data(t,h);v.exit().remove(),v.style("opacity",1);var y=v.enter().append("g").classed("errorbar",!0);f&&y.style("opacity",0).transition().duration(n.duration).style("opacity",1),o.setClipUrl(v,e.layerClipId),v.each(function(t){var e=i.select(this),o=r(t,u,c);if(!g||t.vis){var s;if(m.visible&&a(o.x)&&a(o.yh)&&a(o.ys)){var h=m.width;s="M"+(o.x-h)+","+o.yh+"h"+2*h+"m-"+h+",0V"+o.ys,o.noYS||(s+="m-"+h+",0h"+2*h);var d=e.select("path.yerror");l=!d.size(),l?d=e.append("path").style("vector-effect","non-scaling-stroke").classed("yerror",!0):f&&(d=d.transition().duration(n.duration).ease(n.easing)),d.attr("d",s)}if(p.visible&&a(o.y)&&a(o.xh)&&a(o.xs)){var v=(p.copy_ystyle?m:p).width;s="M"+o.xh+","+(o.y-v)+"v"+2*v+"m0,-"+v+"H"+o.xs,o.noXS||(s+="m0,-"+v+"v"+2*v);var y=e.select("path.xerror");l=!y.size(),l?y=e.append("path").style("vector-effect","non-scaling-stroke").classed("xerror",!0):f&&(y=y.transition().duration(n.duration).ease(n.easing)),y.attr("d",s)}}})}})}},{"../../traces/scatter/subtypes":459,"../drawing":258,d3:8,"fast-isnumeric":12}],266:[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":234,d3:8}],267:[function(t,e,n){"use strict";var r=t("../../lib/extend").extendFlat,i=t("../../plots/font_attributes");e.exports={hoverlabel:{bgcolor:{valType:"color",arrayOk:!0},bordercolor:{valType:"color",arrayOk:!0},font:{family:r({},i.family,{arrayOk:!0}),size:r({},i.size,{arrayOk:!0}),color:r({},i.color,{arrayOk:!0})},namelength:{valType:"integer",min:-1,arrayOk:!0}}}},{"../../lib/extend":342,"../../plots/font_attributes":408}],268:[function(t,e,n){"use strict";function r(t,e,n,r){r=r||i.identity,Array.isArray(t)&&(e[0][n]=r(t))}var i=t("../../lib"),a=t("../../registry");e.exports=function(t){for(var e=t.calcdata,n=t._fullLayout,o=0;o=0&&n.index$.width||Q<0||Q>$.height)return x.unhoverRaw(t,e)}if(P="xval"in e?w.flat(h,e.xval):w.p2c(S,W),O="yval"in e?w.flat(h,e.yval):w.p2c(z,Q),!f(P[0])||!f(O[0]))return d.warn("Fx.hover failed",e,t),x.unhoverRaw(t,e)}var K=1/0;for(R=0;RZ&&(X.splice(0,Z),K=X[0].distance)}if(0===X.length)return x.unhoverRaw(t,e);X.sort(function(t,e){return t.distance-e.distance});var it=t._hoverdata,at=[];for(F=0;F1,ut=y.combine(m.plot_bgcolor||y.background,m.paper_bgcolor),ct={hovermode:C,rotateLabels:lt,bgColor:ut,container:m._hoverlayer,outerContainer:m._paperdiv,commonLabelOpts:m.hoverlabel},ft=i(X,ct,t);if(a(X,lt?"xa":"ya"),o(ft,lt),e.target&&e.target.tagName){var ht=b.getComponentMethod("annotations","hasClickToShow")(t,at);g(c.select(e.target),ht?"pointer":"")}e.target&&!r&&u(t,e,it)&&(it&&t.emit("plotly_unhover",{event:e,points:it}),t.emit("plotly_hover",{event:e,points:t._hoverdata,xaxes:S,yaxes:z,xvals:P,yvals:O}))}function i(t,e,n){var r,i,a=e.hovermode,o=e.rotateLabels,s=e.bgColor,l=e.container,u=e.outerContainer,f=e.commonLabelOpts||{},h=e.fontFamily||M.HOVERFONT,d=e.fontSize||M.HOVERFONTSIZE,p=t[0],g=p.xa,x=p.ya,_="y"===a?"yLabel":"xLabel",b=p[_],w=(String(b)||"").split(" ")[0],A=u.node().getBoundingClientRect(),T=A.top,S=A.width,z=A.height,I=p.distance<=M.MAXDIST&&("x"===a||"y"===a);for(r=0;r-1&&r.length>p&&(r=p>3?r.substr(0,p-3)+"...":r.substr(0,p))}void 0!==t.extraText&&(i+=t.extraText),void 0!==t.zLabel?(void 0!==t.xLabel&&(i+="x: "+t.xLabel+"
"),void 0!==t.yLabel&&(i+="y: "+t.yLabel+"
"),i+=(i?"z: ":"")+t.zLabel):I&&t[a+"Label"]===b?i=t[("x"===a?"y":"x")+"Label"]||"":void 0===t.xLabel?void 0!==t.yLabel&&(i=t.yLabel):i=void 0===t.yLabel?t.xLabel:"("+t.xLabel+", "+t.yLabel+")",t.text&&!Array.isArray(t.text)&&(i+=(i?"
":"")+t.text),""===i&&(""===r&&e.remove(),i=r);var g=e.select("text.nums").call(v.font,t.fontFamily||h,t.fontSize||d,t.fontColor||f).text(i).attr("data-notex",1).call(m.positionText,0,0).call(m.convertToTspans,n),x=e.select("text.name"),_=0;r&&r!==i?(x.call(v.font,t.fontFamily||h,t.fontSize||d,u).text(r).attr("data-notex",1).call(m.positionText,0,0).call(m.convertToTspans,n),_=x.node().getBoundingClientRect().width+2*L):(x.remove(),e.select("rect").remove()),e.select("path").style({fill:u,stroke:f});var w,M,A=g.node().getBoundingClientRect(),D=t.xa._offset+(t.x0+t.x1)/2,C=t.ya._offset+(t.y0+t.y1)/2,P=Math.abs(t.x1-t.x0),O=Math.abs(t.y1-t.y0),F=A.width+E+L+_;t.ty0=T-A.top,t.bx=A.width+2*L,t.by=A.height+2*L,t.anchor="start",t.txwidth=A.width,t.tx2width=_,t.offset=0,o?(t.pos=D,w=C+O/2+F<=z,M=C-O/2-F>=0,"top"!==t.idealAlign&&w||!M?w?(C+=O/2,t.anchor="start"):t.anchor="middle":(C-=O/2,t.anchor="end")):(t.pos=C,w=D+P/2+F<=S,M=D-P/2-F>=0,"left"!==t.idealAlign&&w||!M?w?(D+=P/2,t.anchor="start"):t.anchor="middle":(D-=P/2,t.anchor="end")),g.attr("text-anchor",t.anchor),_&&x.attr("text-anchor",t.anchor),e.attr("transform","translate("+D+","+C+")"+(o?"rotate("+k+")":""))}),P}function a(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(!(a<.01)){if(i<-.01){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&&!(u<=0);o--)l=t[o],l.pos>e.pmax-1&&(l.del=!0,u--);for(o=0;o=0;s--)t[s].dp-=a;for(o=t.length-1;o>=0&&!(u<=0);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)?T: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 o(t,e){t.each(function(t){var n=c.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*(E+L),s=o+a*(t.txwidth+L),l=0,u=t.offset;"middle"===t.anchor&&(o-=t.tx2width/2,s-=t.tx2width/2),e&&(u*=-z,l=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+l)+","+(E+u)+"v"+(t.by/2-E)+"h"+r*t.bx+"v-"+t.by+"H"+(r*E+l)+"V"+(u-E)+"Z"),i.call(m.positionText,o+l,u+t.ty0-t.by/2+L),t.tx2width&&(n.select("text.name").call(m.positionText,s+a*L+l,u+t.ty0-t.by/2+L),n.select("rect").call(v.setRect,s+(a-1)*t.tx2width/2+l,u-t.by/2-1,t.tx2width,t.by+2))})}function s(t,e){function n(e,n,o){var s;if(a[n])s=a[n];else if(i[n]){var l=i[n];Array.isArray(l)&&Array.isArray(l[t.index[0]])&&(s=l[t.index[0]][t.index[1]])}else s=d.nestedProperty(r,o).get();s&&(t[e]=s)}var r=t.trace||{},i=t.cd[0],a=t.cd[t.index]||{};n("hoverinfo","hi","hoverinfo"),n("color","hbg","hoverlabel.bgcolor"),n("borderColor","hbc","hoverlabel.bordercolor"),n("fontFamily","htf","hoverlabel.font.family"),n("fontSize","hts","hoverlabel.font.size"),n("fontColor","htc","hoverlabel.font.color"),n("nameLength","hnl","hoverlabel.namelength"),t.posref="y"===e?(t.x0+t.x1)/2:(t.y0+t.y1)/2,t.x0=d.constrain(t.x0,0,t.xa._length),t.x1=d.constrain(t.x1,0,t.xa._length),t.y0=d.constrain(t.y0,0,t.ya._length),t.y1=d.constrain(t.y1,0,t.ya._length);var o;if(void 0!==t.xLabelVal){o="log"===t.xa.type&&t.xLabelVal<=0;var s=_.tickText(t.xa,t.xa.c2l(o?-t.xLabelVal:t.xLabelVal),"hover");o?0===t.xLabelVal?t.xLabel="0":t.xLabel="-"+s.text:t.xLabel=s.text,t.xVal=t.xa.c2d(t.xLabelVal)}if(void 0!==t.yLabelVal){o="log"===t.ya.type&&t.yLabelVal<=0;var l=_.tickText(t.ya,t.ya.c2l(o?-t.yLabelVal:t.yLabelVal),"hover");o?0===t.yLabelVal?t.yLabel="0":t.yLabel="-"+l.text:t.yLabel=l.text,t.yVal=t.ya.c2d(t.yLabelVal)}if(void 0!==t.zLabelVal&&(t.zLabel=String(t.zLabelVal)),!(isNaN(t.xerr)||"log"===t.xa.type&&t.xerr<=0)){var u=_.tickText(t.xa,t.xa.c2l(t.xerr),"hover").text;void 0!==t.xerrneg?t.xLabel+=" +"+u+" / -"+_.tickText(t.xa,t.xa.c2l(t.xerrneg),"hover").text:t.xLabel+=" \xb1 "+u,"x"===e&&(t.distance+=1)}if(!(isNaN(t.yerr)||"log"===t.ya.type&&t.yerr<=0)){var c=_.tickText(t.ya,t.ya.c2l(t.yerr),"hover").text;void 0!==t.yerrneg?t.yLabel+=" +"+c+" / -"+_.tickText(t.ya,t.ya.c2l(t.yerrneg),"hover").text:t.yLabel+=" \xb1 "+c,"y"===e&&(t.distance+=1)}var f=t.hoverinfo||t.trace.hoverinfo;return"all"!==f&&(f=f.split("+"),-1===f.indexOf("x")&&(t.xLabel=void 0),-1===f.indexOf("y")&&(t.yLabel=void 0),-1===f.indexOf("z")&&(t.zLabel=void 0),-1===f.indexOf("text")&&(t.text=void 0),-1===f.indexOf("name")&&(t.name=void 0)),t}function l(t,e){var n=e.hovermode,r=e.container,i=t[0],a=i.xa,o=i.ya,s=a.showspikes,l=o.showspikes;if(r.selectAll(".spikeline").remove(),"closest"===n&&(s||l)){var u=e.fullLayout,c=a._offset+(i.x0+i.x1)/2,f=o._offset+(i.y0+i.y1)/2,d=y.combine(u.plot_bgcolor,u.paper_bgcolor),p=h.readability(i.color,d)<1.5?y.contrast(d):i.color;if(l){var m=o.spikemode,g=o.spikethickness,x=o.spikecolor||p,_=o._boundingBox,b=(_.left+_.right)/2=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 c=t("d3"),f=t("fast-isnumeric"),h=t("tinycolor2"),d=t("../../lib"),p=t("../../lib/events"),m=t("../../lib/svg_text_utils"),g=t("../../lib/override_cursor"),v=t("../drawing"),y=t("../color"),x=t("../dragelement"),_=t("../../plots/cartesian/axes"),b=t("../../registry"),w=t("./helpers"),M=t("./constants"),k=M.YANGLE,A=Math.PI*k/180,T=1/Math.sin(A),S=Math.cos(A),z=Math.sin(A),E=M.HOVERARROWSIZE,L=M.HOVERTEXTPAD;n.hover=function(t,e,n,i){if("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+M.HOVERMINTIME)return r(t,e,n,i),void(t._lastHoverTime=Date.now());t._hoverTimer=setTimeout(function(){r(t,e,n,i),t._lastHoverTime=Date.now(),t._hoverTimer=void 0},M.HOVERMINTIME)},n.loneHover=function(t,e){var n={color:t.color||y.defaultLine,x0:t.x0||t.x||0,x1:t.x1||t.x||0,y0:t.y0||t.y||0,y1:t.y1||t.y||0,xLabel:t.xLabel,yLabel:t.yLabel,zLabel:t.zLabel,text:t.text,name:t.name,idealAlign:t.idealAlign,borderColor:t.borderColor,fontFamily:t.fontFamily,fontSize:t.fontSize,fontColor:t.fontColor,trace:{index:0,hoverinfo:""},xa:{_offset:0},ya:{_offset:0},index:0},r=c.select(e.container),a=e.outerContainer?c.select(e.outerContainer):r,s={hovermode:"closest",rotateLabels:!1,bgColor:e.bgColor||y.background,container:r,outerContainer:a},l=i([n],s,e.gd);return o(l,s.rotateLabels),l.node()}},{"../../lib":348,"../../lib/events":341,"../../lib/override_cursor":357,"../../lib/svg_text_utils":365,"../../plots/cartesian/axes":384,"../../registry":428,"../color":234,"../dragelement":255,"../drawing":258,"./constants":270,"./helpers":272,d3:8,"fast-isnumeric":12,tinycolor2:200}],274:[function(t,e,n){"use strict";var r=t("../../lib");e.exports=function(t,e,n,i){i=i||{},n("hoverlabel.bgcolor",i.bgcolor),n("hoverlabel.bordercolor",i.bordercolor),n("hoverlabel.namelength",i.namelength),r.coerceFont(n,"hoverlabel.font",i.font)}},{"../../lib":348}],275:[function(t,e,n){"use strict";function r(t){var e=s.isD3Selection(t)?t:o.select(t);e.selectAll("g.hovertext").remove(),e.selectAll(".spikeline").remove()}function i(t,e,n){return s.castOption(t,e,"hoverlabel."+n)}function a(t,e,n){function r(n){return s.coerceHoverinfo({hoverinfo:n},{_module:t._module},e)}return s.castOption(t,n,"hoverinfo",r)}var o=t("d3"),s=t("../../lib"),l=t("../dragelement"),u=t("./helpers"),c=t("./layout_attributes");e.exports={moduleType:"component",name:"fx",constants:t("./constants"),schema:{layout:c},attributes:t("./attributes"),layoutAttributes:c,supplyLayoutGlobalDefaults:t("./layout_global_defaults"),supplyDefaults:t("./defaults"),supplyLayoutDefaults:t("./layout_defaults"),calc:t("./calc"),getDistanceFunction:u.getDistanceFunction,getClosest:u.getClosest,inbox:u.inbox,appendArrayPointValue:u.appendArrayPointValue,castHoverOption:i,castHoverinfo:a,hover:t("./hover").hover,unhover:l.unhover,loneHover:t("./hover").loneHover,loneUnhover:r,click:t("./click")}},{"../../lib":348,"../dragelement":255,"./attributes":267,"./calc":268,"./click":269,"./constants":270,"./defaults":271,"./helpers":272,"./hover":273,"./layout_attributes":276,"./layout_defaults":277,"./layout_global_defaults":278,d3:8}],276:[function(t,e,n){"use strict";var r=t("../../lib/extend").extendFlat,i=t("../../plots/font_attributes"),a=t("./constants");e.exports={dragmode:{valType:"enumerated",values:["zoom","pan","select","lasso","orbit","turntable"],dflt:"zoom"},hovermode:{valType:"enumerated",values:["x","y","closest",!1]},hoverlabel:{bgcolor:{valType:"color"},bordercolor:{valType:"color"},font:{family:r({},i.family,{dflt:a.HOVERFONT}),size:r({},i.size,{dflt:a.HOVERFONTSIZE}),color:r({},i.color)},namelength:{valType:"integer",min:-1,dflt:15}}}},{"../../lib/extend":342,"../../plots/font_attributes":408,"./constants":270}],277:[function(t,e,n){"use strict";function r(t){for(var e=!0,n=0;n=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}},{}],285:[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":342,"../../plots/font_attributes":408,"../color/attributes":233}],286:[function(t,e,n){"use strict";e.exports={scrollBarWidth:4,scrollBarHeight:20,scrollBarColor:"#808BA4",scrollBarMargin:4}},{}],287:[function(t,e,n){"use strict";var r=t("../../registry"),i=t("../../lib"),a=t("./attributes"),o=t("../../plots/layout_attributes"),s=t("./helpers");e.exports=function(t,e,n){function l(t,e){return i.coerce(d,p,a,t,e)}for(var u,c,f,h,d=t.legend||{},p=e.legend={},m=0,g="normal",v=0;v1)){if(l("bgcolor",e.paper_bgcolor),l("bordercolor"),l("borderwidth"),i.coerceFont(l,"font",e.font),l("orientation"),"h"===p.orientation){var x=t.xaxis;x&&x.rangeslider&&x.rangeslider.visible?(u=0,f="left",c=1.1,h="bottom"):(u=0,f="left",c=-.1,h="top")}l("traceorder",g),s.isGrouped(e.legend)&&l("tracegroupgap"),l("x",u),l("xanchor",f),l("y",c),l("yanchor",h),i.noneOrAll(d,p,["x","y"])}}},{"../../lib":348,"../../plots/layout_attributes":411,"../../registry":428,"./attributes":285,"./helpers":290}],288:[function(t,e,n){"use strict";function r(t,e){function n(n){y.convertToTspans(n,e,function(){o(t,e)})}var r=t.data()[0][0],i=e._fullLayout,a=r.trace,s=p.traceIs(a,"pie"),l=a.index,u=s?r.label:a.name,c=t.selectAll("text.legendtext").data([0]);c.enter().append("text").classed("legendtext",!0),c.attr("text-anchor","start").classed("user-select-none",!0).call(g.font,i.legend.font).text(u),e._context.edits.legendText&&!s?c.call(y.makeEditable,{gd:e}).call(n).on("edit",function(t){this.text(t).call(n),this.text()||(t=" ");var i,a=r.trace._fullInput||{};if(-1!==["ohlc","candlestick"].indexOf(a.type)){var o=r.trace.transforms;i=o[o.length-1].direction+".name"}else i="name";f.restyle(e,i,t,l)}):c.call(n)}function i(t,e){var n,r=1,i=t.selectAll("rect").data([0]);i.enter().append("rect").classed("legendtoggle",!0).style("cursor","pointer").attr("pointer-events","all").call(v.fill,"rgba(0,0,0,0)"),i.on("mousedown",function(){n=(new Date).getTime(),n-e._legendMouseDownTimeS&&(r=Math.max(r-1,1)),1===r?n._clickTimeout=setTimeout(function(){a(t,e,r)},S):2===r&&(n._clickTimeout&&clearTimeout(n._clickTimeout),e._legendMouseDownTime=0,a(t,e,r))}})}function a(t,e,n){if(!e._dragged&&!e._editing){var r,i,a=e._fullLayout.hiddenlabels?e._fullLayout.hiddenlabels.slice():[],o=t.data()[0][0],s=e._fullData,l=o.trace,u=l.legendgroup,c=[];if(1===n&&T&&e.data&&e._context.showTips?(h.notifier("Double click on legend to isolate individual trace","long"),T=!1):T=!1,p.traceIs(l,"pie")){var d=o.label,m=a.indexOf(d);1===n?-1===m?a.push(d):a.splice(m,1):2===n&&(a=[],e.calcdata[0].forEach(function(t){d!==t.label&&a.push(t.label)}),e._fullLayout.hiddenlabels&&e._fullLayout.hiddenlabels.length===a.length&&-1===m&&(a=[])),f.relayout(e,"hiddenlabels",a)}else{var g,v=[],y=[];for(g=0;gr.width-(r.margin.r+r.margin.l)&&(x=0,m+=v,i.height=i.height+v,v=0),g.setTranslate(this,a+x,5+a+e.height/2+m),i.width+=o+n,i.height=Math.max(i.height,e.height),x+=o+n,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),n.each(function(e){var n=e[0];c.select(this).select(".legendtoggle").call(g.setRect,0,-n.height/2,(t._context.edits.legendText?0:i.width)+s,n.height)})}function l(t){var e=t._fullLayout,n=e.legend,r="left";A.isRightAnchor(n)?r="right":A.isCenterAnchor(n)&&(r="center");var i="top";A.isBottomAnchor(n)?i="bottom":A.isMiddleAnchor(n)&&(i="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}[i]||0),t:n.height*({bottom:1,middle:.5}[i]||0)})}function u(t){var e=t._fullLayout,n=e.legend,r="left";A.isRightAnchor(n)?r="right":A.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"),f=t("../../plotly"),h=t("../../lib"),d=t("../../plots/plots"),p=t("../../registry"),m=t("../dragelement"),g=t("../drawing"),v=t("../color"),y=t("../../lib/svg_text_utils"),x=t("./constants"),_=t("../../constants/interactions"),b=t("../../constants/alignment").LINE_SPACING,w=t("./get_legend_data"),M=t("./style"),k=t("./helpers"),A=t("./anchor_utils"),T=!0,S=_.DBLCLICKDELAY;e.exports=function(t){function e(t,e){E.attr("data-scroll",e).call(g.setTranslate,0,e),L.call(g.setRect,N,t,x.scrollBarWidth,x.scrollBarHeight),T.select("rect").attr({y:y.borderwidth-e})}var n=t._fullLayout,o="legend"+n._uid;if(n._infolayer&&t.calcdata){t._legendMouseDownTime||(t._legendMouseDownTime=0);var y=n.legend,_=n.showlegend&&w(t.calcdata,y),b=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 T=n._topdefs.selectAll("#"+o).data([0]);T.enter().append("clipPath").attr("id",o).append("rect");var z=k.selectAll("rect.bg").data([0]);z.enter().append("rect").attr({class:"bg","shape-rendering":"crispEdges"}),z.call(v.stroke,y.bordercolor),z.call(v.fill,y.bgcolor),z.style("stroke-width",y.borderwidth+"px");var E=k.selectAll("g.scrollbox").data([0]);E.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(v.fill,"#808BA4");var I=E.selectAll("g.groups").data(_);I.enter().append("g").attr("class","groups"),I.exit().remove();var D=I.selectAll("g.traces").data(h.identity);D.enter().append("g").attr("class","traces"),D.exit().remove(),D.call(M,t).style("opacity",function(t){var e=t[0].trace;return p.traceIs(e,"pie")?-1!==b.indexOf(t[0].label)?.5:1:"legendonly"===e.visible?.5:1}).each(function(){c.select(this).call(r,t).call(i,t)});var C=0!==k.enter().size();C&&(s(t,I,D),l(t));var P=n.width,O=n.height;s(t,I,D),y.height>O?u(t):l(t);var F=n._size,R=F.l+F.w*y.x,j=F.t+F.h*(1-y.y);A.isRightAnchor(y)?R-=y.width:A.isCenterAnchor(y)&&(R-=y.width/2),A.isBottomAnchor(y)?j-=y.height:A.isMiddleAnchor(y)&&(j-=y.height/2);var N=y.width,B=F.w;N>B?(R=F.l,N=B):(R+N>P&&(R=P-N),R<0&&(R=0),N=Math.min(P-R,y.width));var V=y.height,q=F.h;V>q?(j=F.t,V=q):(j+V>O&&(j=O-V),j<0&&(j=0),V=Math.min(O-j,y.height)),g.setTranslate(k,R,j);var U,H,G=V-x.scrollBarHeight-2*x.scrollBarMargin,Z=y.height-V;if(y.height<=V||t._context.staticPlot)z.attr({width:N-y.borderwidth,height:V-y.borderwidth,x:y.borderwidth/2,y:y.borderwidth/2}),g.setTranslate(E,0,0),T.select("rect").attr({width:N-2*y.borderwidth,height:V-2*y.borderwidth,x:y.borderwidth,y:y.borderwidth}),E.call(g.setClipUrl,o);else{U=x.scrollBarMargin,H=E.attr("data-scroll")||0,z.attr({width:N-2*y.borderwidth+x.scrollBarWidth+x.scrollBarMargin,height:V-y.borderwidth,x:y.borderwidth/2,y:y.borderwidth/2}),T.select("rect").attr({width:N-2*y.borderwidth+x.scrollBarWidth+x.scrollBarMargin,height:V-2*y.borderwidth,x:y.borderwidth,y:y.borderwidth-H}),E.call(g.setClipUrl,o),C&&e(U,H),k.on("wheel",null),k.on("wheel",function(){H=h.constrain(E.attr("data-scroll")-c.event.deltaY/G*Z,-Z,0),U=x.scrollBarMargin-H/Z*G,e(U,H),0!==H&&H!==-Z&&c.event.preventDefault()}),L.on(".drag",null),E.on(".drag",null);var X=c.behavior.drag().on("drag",function(){U=h.constrain(c.event.y-x.scrollBarHeight/2,x.scrollBarMargin,x.scrollBarMargin+G),H=-(U-x.scrollBarMargin)/G*Z,e(U,H)});L.call(X),E.call(X)}if(t._context.edits.legendPosition){var Y,W,Q,J;k.classed("cursor-move",!0),m.init({element:k.node(),gd:t,prepFn:function(){var t=g.getTranslate(k);Q=t.x,J=t.y},moveFn:function(t,e){var n=Q+t,r=J+e;g.setTranslate(k,n,r),Y=m.align(n,0,F.l,F.l+F.w,y.xanchor),W=m.align(r,0,F.t+F.h,F.t,y.yanchor)},doneFn:function(e,r,i){if(e&&void 0!==Y&&void 0!==W)f.relayout(t,{"legend.x":Y,"legend.y":W});else{var o=n._infolayer.selectAll("g.traces").filter(function(){var t=this.getBoundingClientRect();return i.clientX>=t.left&&i.clientX<=t.right&&i.clientY>=t.top&&i.clientY<=t.bottom});o.size()>0&&(1===r?k._clickTimeout=setTimeout(function(){a(o,t,r)},S):2===r&&(k._clickTimeout&&clearTimeout(k._clickTimeout),a(o,t,r)))}}})}}}},{"../../constants/alignment":330,"../../constants/interactions":331,"../../lib":348,"../../lib/svg_text_utils":365,"../../plotly":379,"../../plots/plots":420,"../../registry":428,"../color":234,"../dragelement":255,"../drawing":258,"./anchor_utils":284,"./constants":286,"./get_legend_data":289,"./helpers":290,"./style":292,d3:8}],289:[function(t,e,n){"use strict";var r=t("../../registry"),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;an[1])return n[1]}return i}function i(t){return t[0]}var s,u,c=t[0],f=c.trace,h=l.hasMarkers(f),d=l.hasText(f),p=l.hasLines(f);if(h||d||p){var m={},g={};h&&(m.mc=n("marker.color",i),m.mo=n("marker.opacity",a.mean,[.2,1]),m.ms=n("marker.size",a.mean,[2,16]),m.mlc=n("marker.line.color",i),m.mlw=n("marker.line.width",a.mean,[0,5]),g.marker={sizeref:1,sizemin:1,sizemode:"diameter"}),p&&(g.line={width:n("line.width",i,[0,10])}),d&&(m.tx="Aa",m.tp=n("textposition",i),m.ts=10,m.tc=n("textfont.color",i),m.tf=n("textfont.family",i)),s=[a.minExtend(c,m)],u=a.minExtend(f,g)}var v=r.select(this).select("g.legendpoints"),y=v.selectAll("path.scatterpts").data(h?s:[]);y.enter().append("path").classed("scatterpts",!0).attr("transform","translate(20,0)"),y.exit().remove(),y.call(o.pointStyle,u,e),h&&(s[0].mrc=3);var x=v.selectAll("g.pointtext").data(d?s:[]);x.enter().append("g").classed("pointtext",!0).append("text").attr("transform","translate(20,0)"),x.exit().remove(),x.selectAll("text").call(o.textPointStyle,u,e)}function f(t){var e=t[0].trace,n=e.marker||{},a=n.line||{},o=r.select(this).select("g.legendpoints").selectAll("path.legendbar").data(i.traceIs(e,"bar")?[t]:[]);o.enter().append("path").classed("legendbar",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),o.exit().remove(),o.each(function(t){var e=r.select(this),i=t[0],o=(i.mlw+1||a.width+1)-1;e.style("stroke-width",o+"px").call(s.fill,i.mc||n.color),o&&e.call(s.stroke,i.mlc||a.color)})}function h(t){var e=t[0].trace,n=r.select(this).select("g.legendpoints").selectAll("path.legendbox").data(i.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(){var t=e.line.width,n=r.select(this);n.style("stroke-width",t+"px").call(s.fill,e.fillcolor),t&&n.call(s.stroke,e.line.color)})}function d(t){var e=t[0].trace,n=r.select(this).select("g.legendpoints").selectAll("path.legendpie").data(i.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(u,t[0],e)}t.each(function(t){var e=r.select(this),n=e.selectAll("g.layers").data([0]);n.enter().append("g").classed("layers",!0),n.style("opacity",t[0].trace.opacity),n.selectAll("g.legendfill").data([t]).enter().append("g").classed("legendfill",!0),n.selectAll("g.legendlines").data([t]).enter().append("g").classed("legendlines",!0);var i=n.selectAll("g.legendsymbols").data([t]);i.enter().append("g").classed("legendsymbols",!0),i.selectAll("g.legendpoints").data([t]).enter().append("g").classed("legendpoints",!0)}).each(f).each(h).each(d).each(n).each(c)}},{"../../lib":348,"../../registry":428,"../../traces/pie/style_one":437,"../../traces/scatter/subtypes":459,"../color":234,"../drawing":258,d3:8}],293:[function(t,e,n){"use strict";function r(t,e){var n,r,i=e.currentTarget,a=i.getAttribute("data-attr"),o=i.getAttribute("data-val")||!0,s=t._fullLayout,l={},u=h.list(t,null,!0),f="on";if("zoom"===a){var d,p="in"===o?.5:2,m=(1+p)/2,g=(1-p)/2;for(r=0;r1)return r(["resetViews","toggleHover"]),o(v,n);c&&(r(["zoom3d","pan3d","orbitRotation","tableRotation"]),r(["resetCameraDefault3d","resetCameraLastSave3d"]),r(["hoverClosest3d"])),f&&(r(["zoomInGeo","zoomOutGeo","resetGeo"]),r(["hoverClosestGeo"]));var y=i(s),x=[];return((u||p)&&!y||m)&&(x=["zoom2d","pan2d"]),g&&(x=["pan2d"]),a(l)&&(x.push("select2d"),x.push("lasso2d")),x.length&&r(x),!u&&!p||y||m||r(["zoomIn2d","zoomOut2d","autoScale2d","resetScale2d"]),u&&d?r(["toggleHover"]):p?r(["hoverClosestGl2d"]):u?r(["toggleSpikelines","hoverClosestCartesian","hoverCompareCartesian"]):d?r(["hoverClosestPie"]):g&&r(["resetViewMapbox","toggleHover"]),o(v,n)}function i(t){for(var e=l.list({_fullLayout:t},null,!0),n=!0,r=0;r0)){var p=i(e,n,l);f("x",p[0]),f("y",p[1]),a.noneOrAll(t,e,["x","y"]),f("xanchor"),f("yanchor"),a.coerceFont(f,"font",n.font);var m=f("bgcolor");f("activecolor",o.contrast(m,u.lightAmount,u.darkAmount)),f("bordercolor"),f("borderwidth")}}},{"../../lib":348,"../color":234,"./attributes":297,"./button_attributes":298,"./constants":299}],301:[function(t,e,n){"use strict";function r(t){for(var e=v.list(t,"x",!0),n=[],r=0;rp&&(p=h)));return p>=d?[d,p]:void 0}}var i=t("../../lib"),a=t("../../plots/cartesian/axes"),o=t("./constants"),s=t("./helpers");e.exports=function(t){var e=t._fullLayout,n=i.filterVisible(e.shapes);if(n.length&&t._fullData.length)for(var s=0;sZ&&r>X&&!t.shiftKey?p.getCursor(i/n,1-a/r):"move";m(e,o),G=o.split("-")[0]}function a(e){N=f.getFromId(t,n.xref),B=f.getFromId(t,n.yref),V=v.getDataToPixel(t,N),q=v.getDataToPixel(t,B,!0),U=v.getPixelToData(t,N),H=v.getPixelToData(t,B,!0);var a="shapes["+r+"]";"path"===n.type?(R=n.path,j=a+".path"):(g=V(n.x0),y=q(n.y0),x=V(n.x1),_=q(n.y1),b=a+".x0",w=a+".y0",M=a+".x1",k=a+".y1"),gX&&(d[E]=n[C]=H(u),d[L]=n[P]=H(c)),h-f>Z&&(d[I]=n[O]=U(f),d[D]=n[F]=U(h))}e.attr("d",o(t,n))}var d,g,y,x,_,b,w,M,k,A,T,S,z,E,L,I,D,C,P,O,F,R,j,N,B,V,q,U,H,G,Z=10,X=10,Y={element:e.node(),gd:t,prepFn:a,doneFn:s},W=Y.element.getBoundingClientRect();p.init(Y),e.node().onmousemove=i}function o(t,e){var n,r,i,a,o=e.type,l=f.getFromId(t,e.xref),u=f.getFromId(t,e.yref),c=t._fullLayout._size;if(l?(n=v.shapePositionToRange(l),r=function(t){return l._offset+l.r2p(n(t,!0))}):r=function(t){return c.l+c.w*t},u?(i=v.shapePositionToRange(u),a=function(t){return u._offset+u.r2p(i(t,!0))}):a=function(t){return c.t+c.h*(1-t)},"path"===o)return l&&"date"===l.type&&(r=v.decodeDate(r)),u&&"date"===u.type&&(a=v.decodeDate(a)),s(e.path,r,a);var h=r(e.x0),d=r(e.x1),p=a(e.y0),m=a(e.y1);if("line"===o)return"M"+h+","+p+"L"+d+","+m;if("rect"===o)return"M"+h+","+p+"H"+d+"V"+m+"H"+h+"Z";var g=(h+d)/2,y=(p+m)/2,x=Math.abs(g-h),_=Math.abs(y-p),b="A"+x+","+_,w=g+x+","+y;return"M"+w+b+" 0 1,1 "+g+","+(y-_)+b+" 0 0,1 "+w+"Z"}function s(t,e,n){return t.replace(g.segmentRE,function(t){var r=0,i=t.charAt(0),a=g.paramIsX[i],o=g.paramIsY[i],s=g.numParams[i],l=t.substr(1).replace(g.paramRE,function(t){return a[r]?t=e(t):o[r]&&(t=n(t)),r++,r>s&&(t="X"),t});return r>s&&(l=l.replace(/[\s,]*X.*/,""),c.log("Ignoring extra params in segment "+t)),i+l})}function l(t,e,n){return t.replace(g.segmentRE,function(t){var r=0,i=t.charAt(0),a=g.paramIsX[i],o=g.paramIsY[i],s=g.numParams[i];return i+t.substr(1).replace(g.paramRE,function(t){return r>=s?t:(a[r]?t=e(t):o[r]&&(t=n(t)),r++,t)})})}var u=t("../../plotly"),c=t("../../lib"),f=t("../../plots/cartesian/axes"),h=t("../color"),d=t("../drawing"),p=t("../dragelement"),m=t("../../lib/setcursor"),g=t("./constants"),v=t("./helpers");e.exports={draw:r,drawOne:i}},{"../../lib":348,"../../lib/setcursor":363,"../../plotly":379,"../../plots/cartesian/axes":384,"../color":234,"../dragelement":255,"../drawing":258,"./constants":312,"./helpers":315}],315:[function(t,e,n){"use strict";n.rangeToShapePosition=function(t){return"log"===t.type?t.r2d:function(t){return t}},n.shapePositionToRange=function(t){return"log"===t.type?t.d2r:function(t){return t}},n.decodeDate=function(t){return function(e){return e.replace&&(e=e.replace("_"," ")),t(e)}},n.encodeDate=function(t){return function(e){return t(e).replace(" ","_")}},n.getDataToPixel=function(t,e,r){var i,a=t._fullLayout._size;if(e){var o=n.shapePositionToRange(e);i=function(t){return e._offset+e.r2p(o(t,!0))},"date"===e.type&&(i=n.decodeDate(i))}else i=r?function(t){return a.t+a.h*(1-t)}:function(t){return a.l+a.w*t};return i},n.getPixelToData=function(t,e,r){var i,a=t._fullLayout._size;if(e){var o=n.rangeToShapePosition(e);i=function(t){return o(e.p2r(t-e._offset))}}else i=r?function(t){return 1-(t-a.t)/a.h}:function(t){return(t-a.l)/a.w};return i}},{}],316:[function(t,e,n){"use strict";var r=t("./draw");e.exports={moduleType:"component",name:"shapes",layoutAttributes:t("./attributes"),supplyLayoutDefaults:t("./defaults"),calcAutorange:t("./calc_autorange"),draw:r.draw,drawOne:r.drawOne}},{"./attributes":310,"./calc_autorange":311,"./defaults":313,"./draw":314}],317:[function(t,e,n){"use strict";var r=t("../../lib"),i=t("../../plots/cartesian/axes"),a=t("./attributes"),o=t("./helpers");e.exports=function(t,e,n,s,l){function u(n,i){return r.coerce(t,e,a,n,i)}if(s=s||{},l=l||{},!u("visible",!l.itemIsNotPlainObject))return e;u("layer"),u("opacity"),u("fillcolor"),u("line.color"),u("line.width"),u("line.dash");for(var c=t.path?"path":"rect",f=u("type",c),h=["x","y"],d=0;d<2;d++){var p=h[d],m={_fullLayout:n},g=i.coerceRef(t,e,m,p,"","paper");if("path"!==f){var v,y,x;"paper"!==g?(v=i.getFromId(m,g),x=o.rangeToShapePosition(v),y=o.shapePositionToRange(v)):y=x=r.identity;var _=p+"0",b=p+"1",w=t[_],M=t[b];t[_]=y(t[_],!0),t[b]=y(t[b],!0),i.coercePosition(e,m,u,g,_,.25),i.coercePosition(e,m,u,g,b,.75),e[_]=x(e[_]),e[b]=x(e[b]),t[_]=w,t[b]=M}}return"path"===f?u("path"):r.noneOrAll(t,e,["x0","x1","y0","y1"]),e}},{"../../lib":348,"../../plots/cartesian/axes":384,"./attributes":310,"./helpers":315}],318:[function(t,e,n){"use strict";var r=t("../../plots/font_attributes"),i=t("../../plots/pad_attributes"),a=t("../../lib/extend").extendFlat,o=t("../../lib/extend").extendDeep,s=t("../../plots/animation_attributes"),l=t("./constants"),u={_isLinkedToArray:"step",method:{valType:"enumerated",values:["restyle","relayout","animate","update","skip"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string"},value:{valType:"string"},execute:{valType:"boolean",dflt:!0}};e.exports={_isLinkedToArray:"slider",visible:{valType:"boolean",dflt:!0},active:{valType:"number",min:0,dflt:0},steps:u,lenmode:{valType:"enumerated",values:["fraction","pixels"],dflt:"fraction"},len:{valType:"number",min:0,dflt:1},x:{valType:"number",min:-2,max:3,dflt:0},pad:o({},i,{},{t:{dflt:20}}),xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left"},y:{valType:"number",min:-2,max:3,dflt:0},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"top"},transition:{duration:{valType:"number",min:0,dflt:150},easing:{valType:"enumerated",values:s.transition.easing.values,dflt:"cubic-in-out"}},currentvalue:{visible:{valType:"boolean",dflt:!0},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left"},offset:{valType:"number",dflt:10},prefix:{valType:"string"},suffix:{valType:"string"},font:a({},r,{})},font:a({},r,{}),activebgcolor:{valType:"color",dflt:l.gripBgActiveColor},bgcolor:{valType:"color",dflt:l.railBgColor},bordercolor:{valType:"color",dflt:l.railBorderColor},borderwidth:{valType:"number",min:0,dflt:l.railBorderWidth},ticklen:{valType:"number",min:0,dflt:l.tickLength},tickcolor:{valType:"color",dflt:l.tickColor},tickwidth:{valType:"number",min:0,dflt:1},minorticklen:{valType:"number",min:0,dflt:l.minorTickLength}}},{"../../lib/extend":342,"../../plots/animation_attributes":380,"../../plots/font_attributes":408,"../../plots/pad_attributes":419,"./constants":319}],319:[function(t,e,n){"use strict";e.exports={name:"sliders",containerClassName:"slider-container",groupClassName:"slider-group",inputAreaClass:"slider-input-area",railRectClass:"slider-rail-rect",railTouchRectClass:"slider-rail-touch-rect",gripRectClass:"slider-grip-rect",tickRectClass:"slider-tick-rect",inputProxyClass:"slider-input-proxy",labelsClass:"slider-labels",labelGroupClass:"slider-label-group",labelClass:"slider-label",currentValueClass:"slider-current-value",railHeight:5,menuIndexAttrName:"slider-active-index",autoMarginIdRoot:"slider-",minWidth:30,minHeight:30,textPadX:40,arrowOffsetX:4,railRadius:2,railWidth:5,railBorder:4,railBorderWidth:1,railBorderColor:"#bec8d9",railBgColor:"#f8fafc",railInset:8,stepInset:10,gripRadius:10,gripWidth:20,gripHeight:20,gripBorder:20,gripBorderWidth:1,gripBorderColor:"#bec8d9",gripBgColor:"#f6f8fa",gripBgActiveColor:"#dbdde0",labelPadding:8,labelOffset:0,tickWidth:1,tickColor:"#333",tickOffset:25,tickLength:7,minorTickOffset:25,minorTickColor:"#333",minorTickLength:4,currentValuePadding:8,currentValueInset:0}},{}],320:[function(t,e,n){"use strict";function r(t,e,n){function r(n,r){return a.coerce(t,e,s,n,r)}r("visible",i(t,e).length>0)&&(r("active"),r("x"),r("y"),a.noneOrAll(t,e,["x","y"]),r("xanchor"),r("yanchor"),r("len"),r("lenmode"),r("pad.t"),r("pad.r"),r("pad.b"),r("pad.l"),a.coerceFont(r,"font",n.font),r("currentvalue.visible")&&(r("currentvalue.xanchor"),r("currentvalue.prefix"),r("currentvalue.suffix"),r("currentvalue.offset"),a.coerceFont(r,"currentvalue.font",e.font)),r("transition.duration"),r("transition.easing"),r("bgcolor"),r("activebgcolor"),r("bordercolor"),r("borderwidth"),r("ticklen"),r("tickwidth"),r("tickcolor"),r("minorticklen"))}function i(t,e){function n(t,e){return a.coerce(r,i,c,t,e)} -for(var r,i,o=t.steps||[],s=e.steps=[],l=0;l=n.steps.length&&(n.active=0),e.call(s,n).call(_,n).call(c,n).call(p,n).call(x,t,n).call(l,t,n),A.setTranslate(e,n.lx+n.pad.l,n.ly+n.pad.t),e.call(g,n,n.active/(n.steps.length-1),!1),e.call(s,n)}function s(t,e,n){if(e.currentvalue.visible){var r,i,a=t.selectAll("text").data([0]);switch(e.currentvalue.xanchor){case"right":r=e.inputAreaLength-z.currentValueInset-e.currentValueMaxWidth,i="left";break;case"center":r=.5*e.inputAreaLength,i="middle";break;default:r=z.currentValueInset,i="left"}a.enter().append("text").classed(z.labelClass,!0).classed("user-select-none",!0).attr({"text-anchor":i,"data-notex":1});var o=e.currentvalue.prefix?e.currentvalue.prefix:"";if("string"==typeof n)o+=n;else{o+=e.steps[e.active].label}e.currentvalue.suffix&&(o+=e.currentvalue.suffix),a.call(A.font,e.currentvalue.font).text(o).call(T.convertToTspans,e.gd);var s=T.lineCount(a),l=(e.currentValueMaxLines+1-s)*e.currentvalue.font.size*E;return T.positionText(a,r,l),a}}function l(t,e,n){var r=t.selectAll("rect."+z.gripRectClass).data([0]);r.enter().append("rect").classed(z.gripRectClass,!0).call(d,e,t,n).style("pointer-events","all"),r.attr({width:z.gripWidth,height:z.gripHeight,rx:z.gripRadius,ry:z.gripRadius}).call(k.stroke,n.bordercolor).call(k.fill,n.bgcolor).style("stroke-width",n.borderwidth+"px")}function u(t,e,n){var r=t.selectAll("text").data([0]);return r.enter().append("text").classed(z.labelClass,!0).classed("user-select-none",!0).attr({"text-anchor":"middle","data-notex":1}),r.call(A.font,n.font).text(e.step.label).call(T.convertToTspans,n.gd),r}function c(t,e){var n=t.selectAll("g."+z.labelsClass).data([0]);n.enter().append("g").classed(z.labelsClass,!0);var r=n.selectAll("g."+z.labelGroupClass).data(e.labelSteps);r.enter().append("g").classed(z.labelGroupClass,!0),r.exit().remove(),r.each(function(t){var n=w.select(this);n.call(u,t,e),A.setTranslate(n,v(e,t.fraction),z.tickOffset+e.ticklen+e.font.size*E+z.labelOffset+e.currentValueTotalHeight)})}function f(t,e,n,r,i){var a=Math.round(r*(n.steps.length-1));a!==n.active&&h(t,e,n,a,!0,i)}function h(t,e,n,r,i,a){var o=n.active;n._input.active=n.active=r;var l=n.steps[n.active];e.call(g,n,n.active/(n.steps.length-1),a),e.call(s,n),t.emit("plotly_sliderchange",{slider:n,step:n.steps[n.active],interaction:i,previousActive:o}),l&&l.method&&i&&(e._nextMethod?(e._nextMethod.step=l,e._nextMethod.doCallback=i,e._nextMethod.doTransition=a):(e._nextMethod={step:l,doCallback:i,doTransition:a},e._nextMethodRaf=window.requestAnimationFrame(function(){var n=e._nextMethod.step;n.method&&(n.execute&&M.executeAPICommand(t,n.method,n.args),e._nextMethod=null,e._nextMethodRaf=null)})))}function d(t,e,n){function r(){return n.data()[0]}var i=n.node(),a=w.select(e);t.on("mousedown",function(){var t=r();e.emit("plotly_sliderstart",{slider:t});var o=n.select("."+z.gripRectClass);w.event.stopPropagation(),w.event.preventDefault(),o.call(k.fill,t.activebgcolor);var s=y(t,w.mouse(i)[0]);f(e,n,t,s,!0),t._dragging=!0,a.on("mousemove",function(){var t=r(),a=y(t,w.mouse(i)[0]);f(e,n,t,a,!1)}),a.on("mouseup",function(){var t=r();t._dragging=!1,o.call(k.fill,t.bgcolor),a.on("mouseup",null),a.on("mousemove",null),e.emit("plotly_sliderend",{slider:t,step:t.steps[t.active]})})})}function p(t,e){var n=t.selectAll("rect."+z.tickRectClass).data(e.steps);n.enter().append("rect").classed(z.tickRectClass,!0),n.exit().remove(),n.attr({width:e.tickwidth+"px","shape-rendering":"crispEdges"}),n.each(function(t,n){var r=n%e.labelStride==0,i=w.select(this);i.attr({height:r?e.ticklen:e.minorticklen}).call(k.fill,e.tickcolor),A.setTranslate(i,v(e,n/(e.steps.length-1))-.5*e.tickwidth,(r?z.tickOffset:z.minorTickOffset)+e.currentValueTotalHeight)})}function m(t){t.labelSteps=[];for(var e=t.steps.length,n=0;n0&&(o=o.transition().duration(e.transition.duration).ease(e.transition.easing)),o.attr("transform","translate("+(a-.5*z.gripWidth)+","+e.currentValueTotalHeight+")")}}function v(t,e){return t.inputAreaStart+z.stepInset+(t.inputAreaLength-2*z.stepInset)*Math.min(1,Math.max(0,e))}function y(t,e){return Math.min(1,Math.max(0,(e-z.stepInset-t.inputAreaStart)/(t.inputAreaLength-2*z.stepInset-2*t.inputAreaStart)))}function x(t,e,n){var r=t.selectAll("rect."+z.railTouchRectClass).data([0]);r.enter().append("rect").classed(z.railTouchRectClass,!0).call(d,e,t,n).style("pointer-events","all"),r.attr({width:n.inputAreaLength,height:Math.max(n.inputAreaWidth,z.tickOffset+n.ticklen+n.labelHeight)}).call(k.fill,n.bgcolor).attr("opacity",0),A.setTranslate(r,0,n.currentValueTotalHeight)}function _(t,e){var n=t.selectAll("rect."+z.railRectClass).data([0]);n.enter().append("rect").classed(z.railRectClass,!0);var r=e.inputAreaLength-2*z.railInset;n.attr({width:r,height:z.railWidth,rx:z.railRadius,ry:z.railRadius,"shape-rendering":"crispEdges"}).call(k.stroke,e.bordercolor).call(k.fill,e.bgcolor).style("stroke-width",e.borderwidth+"px"),A.setTranslate(n,z.railInset,.5*(e.inputAreaWidth-z.railWidth)+e.currentValueTotalHeight)}function b(t){for(var e=t._fullLayout._pushmargin||{},n=Object.keys(e),r=0;r0?[0]:[]);if(s.enter().append("g").classed(z.containerClassName,!0).style("cursor","ew-resize"),s.exit().remove(),s.exit().size()&&b(t),0!==n.length){var l=s.selectAll("g."+z.groupClassName).data(n,i);l.enter().append("g").classed(z.groupClassName,!0),l.exit().each(function(e){w.select(this).remove(),e._commandObserver.remove(),delete e._commandObserver,M.autoMargin(t,z.autoMarginIdRoot+e._index)});for(var u=0;u0||h<0){var m={left:[-n,0],right:[n,0],top:[0,-n],bottom:[0,n]}[b.side];e.attr("transform","translate("+m+")")}}}var g,v=n.propContainer,y=n.propName,x=n.traceIndex,_=n.dfltName,b=n.avoid||{},w=n.attributes,M=n.transform,k=n.containerGroup,A=t._fullLayout,T=v.titlefont.family,S=v.titlefont.size,z=v.titlefont.color,E=1,L=!1,I=v.title.trim();"title"===y?g="titleText":-1!==y.indexOf("axis")?g="axisTitleText":y.indexOf(!0)&&(g="colorbarTitleText");var D=t._context.edits[g];""===I&&(E=0),I.match(h)&&(E=.2,L=!0,D||(I=""));var C=I||D;k||(k=A._infolayer.selectAll(".g-"+e).data([0]),k.enter().append("g").classed("g-"+e,!0));var P=k.selectAll("text").data(C?[0]:[]);if(P.enter().append("text"),P.text(I).attr("class",e),P.exit().remove(),C){P.call(d);var O="Click to enter "+_+" title";D&&(I?P.on(".opacity",null):function(){E=0,L=!0,I=O,P.text(I).on("mouseover.opacity",function(){r.select(this).transition().duration(f.SHOW_PLACEHOLDER).style("opacity",1)}).on("mouseout.opacity",function(){r.select(this).transition().duration(f.HIDE_PLACEHOLDER).style("opacity",0)})}(),P.call(c.makeEditable,{gd:t}).on("edit",function(e){void 0!==x?a.restyle(t,y,e,x):a.relayout(t,y,e)}).on("cancel",function(){this.text(this.attr("data-unformatted")).call(d)}).on("input",function(t){this.text(t||" ").call(c.positionText,w.x,w.y)})),P.classed("js-placeholder",L)}}},{"../../constants/interactions":331,"../../lib":348,"../../lib/svg_text_utils":365,"../../plotly":379,"../../plots/plots":420,"../color":234,"../drawing":258,d3:8,"fast-isnumeric":12}],324:[function(t,e,n){"use strict";var r=t("../../plots/font_attributes"),i=t("../color/attributes"),a=t("../../lib/extend").extendFlat,o=t("../../plots/pad_attributes"),s={_isLinkedToArray:"button",method:{valType:"enumerated",values:["restyle","relayout","animate","update","skip"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string",dflt:""},execute:{valType:"boolean",dflt:!0}};e.exports={_isLinkedToArray:"updatemenu",_arrayAttrRegexps:[/^updatemenus\[(0|[1-9][0-9]+)\]\.buttons/],visible:{valType:"boolean"},type:{valType:"enumerated",values:["dropdown","buttons"],dflt:"dropdown"},direction:{valType:"enumerated",values:["left","right","up","down"],dflt:"down"},active:{valType:"integer",min:-1,dflt:0},showactive:{valType:"boolean",dflt:!0},buttons:s,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:"top"},pad:a({},o,{}),font:a({},r,{}),bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:i.borderLine},borderwidth:{valType:"number",min:0,dflt:1}}},{"../../lib/extend":342,"../../plots/font_attributes":408,"../../plots/pad_attributes":419,"../color/attributes":233}],325:[function(t,e,n){"use strict";e.exports={name:"updatemenus",containerClassName:"updatemenu-container",headerGroupClassName:"updatemenu-header-group",headerClassName:"updatemenu-header",headerArrowClassName:"updatemenu-header-arrow",dropdownButtonGroupClassName:"updatemenu-dropdown-button-group",dropdownButtonClassName:"updatemenu-dropdown-button",buttonClassName:"updatemenu-button",itemRectClassName:"updatemenu-item-rect",itemTextClassName:"updatemenu-item-text",menuIndexAttrName:"updatemenu-active-index",autoMarginIdRoot:"updatemenu-",blankHeaderOpts:{label:" "},minWidth:30,minHeight:30,textPadX:24,arrowPadX:16,rx:2,ry:2,textOffsetX:12,textOffsetY:3,arrowOffsetX:4,gapButtonHeader:5,gapButton:2,activeColor:"#F4FAFF",hoverColor:"#F4FAFF",arrowSymbol:{left:"\u25c4",right:"\u25ba",up:"\u25b2",down:"\u25bc"}}},{}],326:[function(t,e,n){"use strict";function r(t,e,n){function r(n,r){return a.coerce(t,e,s,n,r)}r("visible",i(t,e).length>0)&&(r("active"),r("direction"),r("type"),r("showactive"),r("x"),r("y"),a.noneOrAll(t,e,["x","y"]),r("xanchor"),r("yanchor"),r("pad.t"),r("pad.r"),r("pad.b"),r("pad.l"),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,c,t,e)}for(var r,i,o=t.buttons||[],s=e.buttons=[],l=0;l0?[0]:[]);if(a.enter().append("g").classed(E.containerClassName,!0).style("cursor","pointer"),a.exit().remove(),a.exit().size()&&b(t),0!==n.length){var c=a.selectAll("g."+E.headerGroupClassName).data(n,i);c.enter().append("g").classed(E.headerGroupClassName,!0);var f=a.selectAll("g."+E.dropdownButtonGroupClassName).data([0]);f.enter().append("g").classed(E.dropdownButtonGroupClassName,!0).style("pointer-events","all");for(var h=0;hM,T=r.barLength+2*r.barPad,S=r.barWidth+2*r.barPad,z=p,E=g+v;E+S>u&&(E=u-S);var L=this.container.selectAll("rect.scrollbar-horizontal").data(A?[0]:[]);L.exit().on(".drag",null).remove(),L.enter().append("rect").classed("scrollbar-horizontal",!0).call(a.fill,r.barColor),A?(this.hbar=L.attr({rx:r.barRadius,ry:r.barRadius,x:z,y:E,width:T,height:S}),this._hbarXMin=z+T/2,this._hbarTranslateMax=M-T):(delete this.hbar,delete this._hbarXMin,delete this._hbarTranslateMax);var I=v>k,D=r.barWidth+2*r.barPad,C=r.barLength+2*r.barPad,P=p+m,O=g;P+D>l&&(P=l-D);var F=this.container.selectAll("rect.scrollbar-vertical").data(I?[0]:[]);F.exit().on(".drag",null).remove(),F.enter().append("rect").classed("scrollbar-vertical",!0).call(a.fill,r.barColor),I?(this.vbar=F.attr({rx:r.barRadius,ry:r.barRadius,x:P,y:O,width:D,height:C}),this._vbarYMin=O+C/2,this._vbarTranslateMax=k-C):(delete this.vbar,delete this._vbarYMin,delete this._vbarTranslateMax);var R=this.id,j=c-.5,N=I?f+D+.5:f+.5,B=h-.5,V=A?d+S+.5:d+.5,q=s._topdefs.selectAll("#"+R).data(A||I?[0]:[]);if(q.exit().remove(),q.enter().append("clipPath").attr("id",R).append("rect"),A||I?(this._clipRect=q.select("rect").attr({x:Math.floor(j),y:Math.floor(B),width:Math.ceil(N)-Math.floor(j),height:Math.ceil(V)-Math.floor(B)}),this.container.call(o.setClipUrl,R),this.bg.attr({x:p,y:g,width:m,height:v})):(this.bg.attr({width:0,height:0}),this.container.on("wheel",null).on(".drag",null).call(o.setClipUrl,null),delete this._clipRect),A||I){var U=i.behavior.drag().on("dragstart",function(){i.event.sourceEvent.preventDefault()}).on("drag",this._onBoxDrag.bind(this));this.container.on("wheel",null).on("wheel",this._onBoxWheel.bind(this)).on(".drag",null).call(U);var H=i.behavior.drag().on("dragstart",function(){i.event.sourceEvent.preventDefault(),i.event.sourceEvent.stopPropagation()}).on("drag",this._onBarDrag.bind(this));A&&this.hbar.on(".drag",null).call(H),I&&this.vbar.on(".drag",null).call(H)}this.setTranslate(e,n)},r.prototype.disable=function(){(this.hbar||this.vbar)&&(this.bg.attr({width:0,height:0}),this.container.on("wheel",null).on(".drag",null).call(o.setClipUrl,null),delete this._clipRect),this.hbar&&(this.hbar.on(".drag",null),this.hbar.remove(),delete this.hbar,delete this._hbarXMin,delete this._hbarTranslateMax),this.vbar&&(this.vbar.on(".drag",null),this.vbar.remove(),delete this.vbar,delete this._vbarYMin,delete this._vbarTranslateMax)},r.prototype._onBoxDrag=function(){var t=this.translateX,e=this.translateY;this.hbar&&(t-=i.event.dx),this.vbar&&(e-=i.event.dy),this.setTranslate(t,e)},r.prototype._onBoxWheel=function(){var t=this.translateX,e=this.translateY;this.hbar&&(t+=i.event.deltaY),this.vbar&&(e+=i.event.deltaY),this.setTranslate(t,e)},r.prototype._onBarDrag=function(){var t=this.translateX,e=this.translateY;if(this.hbar){var n=t+this._hbarXMin,r=n+this._hbarTranslateMax;t=(s.constrain(i.event.x,n,r)-n)/(r-n)*(this.position.w-this._box.w)}if(this.vbar){var a=e+this._vbarYMin,o=a+this._vbarTranslateMax;e=(s.constrain(i.event.y,a,o)-a)/(o-a)*(this.position.h-this._box.h)}this.setTranslate(t,e)},r.prototype.setTranslate=function(t,e){var n=this.position.w-this._box.w,r=this.position.h-this._box.h;if(t=s.constrain(t||0,0,n),e=s.constrain(e||0,0,r),this.translateX=t,this.translateY=e,this.container.call(o.setTranslate,this._box.l-this.position.l-t,this._box.t-this.position.t-e),this._clipRect&&this._clipRect.attr({x:Math.floor(this.position.l+t-.5),y:Math.floor(this.position.t+e-.5)}),this.hbar){var i=t/n;this.hbar.call(o.setTranslate,t+i*this._hbarTranslateMax,e)}if(this.vbar){var a=e/r;this.vbar.call(o.setTranslate,t,e+a*this._vbarTranslateMax)}}},{"../../lib":348,"../color":234,"../drawing":258,d3:8}],330:[function(t,e,n){"use strict";e.exports={FROM_BL:{left:0,center:.5,right:1,bottom:0,middle:.5,top:1},FROM_TL:{left:0,center:.5,right:1,bottom:1,middle:.5,top:0},LINE_SPACING:1.3,MID_SHIFT:.35}},{}],331:[function(t,e,n){"use strict";e.exports={SHOW_PLACEHOLDER:100,HIDE_PLACEHOLDER:1e3,DBLCLICKDELAY:300,DESELECTDIM:.2}},{}],332:[function(t,e,n){"use strict";e.exports={BADNUM:void 0,FP_SAFE:Number.MAX_VALUE/1e4,ONEAVGYEAR:315576e5,ONEAVGMONTH:26298e5,ONEDAY:864e5,ONEHOUR:36e5,ONEMIN:6e4,ONESEC:1e3,EPOCHJD:2440587.5,ALMOST_EQUAL:1-1e-6}},{}],333:[function(t,e,n){"use strict";e.exports={entityToUnicode:{mu:"\u03bc","#956":"\u03bc",amp:"&","#28":"&",lt:"<","#60":"<",gt:">","#62":">",nbsp:"\xa0","#160":"\xa0",times:"\xd7","#215":"\xd7",plusmn:"\xb1","#177":"\xb1",deg:"\xb0","#176":"\xb0"}}},{}],334:[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}},{}],335:[function(t,e,n){"use strict";var r=t("./plotly");n.version="1.29.1",t("es6-promise").polyfill(),t("../build/plotcss"),t("./fonts/mathjax_config"),n.plot=r.plot,n.newPlot=r.newPlot,n.restyle=r.restyle,n.relayout=r.relayout,n.redraw=r.redraw,n.update=r.update,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=t("./plot_api/register"),n.toImage=t("./plot_api/to_image"),n.downloadImage=t("./snapshot/download"),n.validate=t("./plot_api/validate"),n.addFrames=r.addFrames,n.deleteFrames=r.deleteFrames,n.animate=r.animate,n.register(t("./traces/scatter")),n.register([t("./components/fx"),t("./components/legend"),t("./components/annotations"),t("./components/annotations3d"),t("./components/shapes"),t("./components/images"),t("./components/updatemenus"),t("./components/sliders"),t("./components/rangeslider"),t("./components/rangeselector")]),n.Icons=t("../build/ploticon"),n.Plots=r.Plots,n.Fx=t("./components/fx"),n.Snapshot=t("./snapshot"),n.PlotSchema=t("./plot_api/plot_schema"),n.Queue=t("./lib/queue"),n.d3=t("d3")},{"../build/plotcss":1,"../build/ploticon":2,"./components/annotations":227,"./components/annotations3d":232,"./components/fx":275,"./components/images":283,"./components/legend":291,"./components/rangeselector":303,"./components/rangeslider":309,"./components/shapes":316,"./components/sliders":322,"./components/updatemenus":328,"./fonts/mathjax_config":336,"./lib/queue":360,"./plot_api/plot_schema":373,"./plot_api/register":374,"./plot_api/set_plot_config":375,"./plot_api/to_image":377,"./plot_api/validate":378,"./plotly":379,"./snapshot":433,"./snapshot/download":430,"./traces/scatter":449,d3:8,"es6-promise":10}],336:[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},{}],337:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),i=t("../constants/numerical").BADNUM,a=/^['"%,$#\s']+|[, ]|['"%,$#\s']+$/g;e.exports=function(t){return"string"==typeof t&&(t=t.replace(a,"")),r(t)?Number(t):i}},{"../constants/numerical":332,"fast-isnumeric":12}],338:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),i=t("tinycolor2"),a=t("../plots/attributes"),o=t("../components/colorscale/get_scale"),s=(Object.keys(t("../components/colorscale/scales")),t("./nested_property")),l=/^([2-9]|[1-9][0-9]+)$/ +for(var r,i,o=t.steps||[],s=e.steps=[],l=0;l=n.steps.length&&(n.active=0),e.call(s,n).call(_,n).call(c,n).call(p,n).call(x,t,n).call(l,t,n),A.setTranslate(e,n.lx+n.pad.l,n.ly+n.pad.t),e.call(g,n,n.active/(n.steps.length-1),!1),e.call(s,n)}function s(t,e,n){if(e.currentvalue.visible){var r,i,a=t.selectAll("text").data([0]);switch(e.currentvalue.xanchor){case"right":r=e.inputAreaLength-z.currentValueInset-e.currentValueMaxWidth,i="left";break;case"center":r=.5*e.inputAreaLength,i="middle";break;default:r=z.currentValueInset,i="left"}a.enter().append("text").classed(z.labelClass,!0).classed("user-select-none",!0).attr({"text-anchor":i,"data-notex":1});var o=e.currentvalue.prefix?e.currentvalue.prefix:"";if("string"==typeof n)o+=n;else{o+=e.steps[e.active].label}e.currentvalue.suffix&&(o+=e.currentvalue.suffix),a.call(A.font,e.currentvalue.font).text(o).call(T.convertToTspans,e.gd);var s=T.lineCount(a),l=(e.currentValueMaxLines+1-s)*e.currentvalue.font.size*E;return T.positionText(a,r,l),a}}function l(t,e,n){var r=t.selectAll("rect."+z.gripRectClass).data([0]);r.enter().append("rect").classed(z.gripRectClass,!0).call(d,e,t,n).style("pointer-events","all"),r.attr({width:z.gripWidth,height:z.gripHeight,rx:z.gripRadius,ry:z.gripRadius}).call(k.stroke,n.bordercolor).call(k.fill,n.bgcolor).style("stroke-width",n.borderwidth+"px")}function u(t,e,n){var r=t.selectAll("text").data([0]);return r.enter().append("text").classed(z.labelClass,!0).classed("user-select-none",!0).attr({"text-anchor":"middle","data-notex":1}),r.call(A.font,n.font).text(e.step.label).call(T.convertToTspans,n.gd),r}function c(t,e){var n=t.selectAll("g."+z.labelsClass).data([0]);n.enter().append("g").classed(z.labelsClass,!0);var r=n.selectAll("g."+z.labelGroupClass).data(e.labelSteps);r.enter().append("g").classed(z.labelGroupClass,!0),r.exit().remove(),r.each(function(t){var n=w.select(this);n.call(u,t,e),A.setTranslate(n,v(e,t.fraction),z.tickOffset+e.ticklen+e.font.size*E+z.labelOffset+e.currentValueTotalHeight)})}function f(t,e,n,r,i){var a=Math.round(r*(n.steps.length-1));a!==n.active&&h(t,e,n,a,!0,i)}function h(t,e,n,r,i,a){var o=n.active;n._input.active=n.active=r;var l=n.steps[n.active];e.call(g,n,n.active/(n.steps.length-1),a),e.call(s,n),t.emit("plotly_sliderchange",{slider:n,step:n.steps[n.active],interaction:i,previousActive:o}),l&&l.method&&i&&(e._nextMethod?(e._nextMethod.step=l,e._nextMethod.doCallback=i,e._nextMethod.doTransition=a):(e._nextMethod={step:l,doCallback:i,doTransition:a},e._nextMethodRaf=window.requestAnimationFrame(function(){var n=e._nextMethod.step;n.method&&(n.execute&&M.executeAPICommand(t,n.method,n.args),e._nextMethod=null,e._nextMethodRaf=null)})))}function d(t,e,n){function r(){return n.data()[0]}var i=n.node(),a=w.select(e);t.on("mousedown",function(){var t=r();e.emit("plotly_sliderstart",{slider:t});var o=n.select("."+z.gripRectClass);w.event.stopPropagation(),w.event.preventDefault(),o.call(k.fill,t.activebgcolor);var s=y(t,w.mouse(i)[0]);f(e,n,t,s,!0),t._dragging=!0,a.on("mousemove",function(){var t=r(),a=y(t,w.mouse(i)[0]);f(e,n,t,a,!1)}),a.on("mouseup",function(){var t=r();t._dragging=!1,o.call(k.fill,t.bgcolor),a.on("mouseup",null),a.on("mousemove",null),e.emit("plotly_sliderend",{slider:t,step:t.steps[t.active]})})})}function p(t,e){var n=t.selectAll("rect."+z.tickRectClass).data(e.steps);n.enter().append("rect").classed(z.tickRectClass,!0),n.exit().remove(),n.attr({width:e.tickwidth+"px","shape-rendering":"crispEdges"}),n.each(function(t,n){var r=n%e.labelStride==0,i=w.select(this);i.attr({height:r?e.ticklen:e.minorticklen}).call(k.fill,e.tickcolor),A.setTranslate(i,v(e,n/(e.steps.length-1))-.5*e.tickwidth,(r?z.tickOffset:z.minorTickOffset)+e.currentValueTotalHeight)})}function m(t){t.labelSteps=[];for(var e=t.steps.length,n=0;n0&&(o=o.transition().duration(e.transition.duration).ease(e.transition.easing)),o.attr("transform","translate("+(a-.5*z.gripWidth)+","+e.currentValueTotalHeight+")")}}function v(t,e){return t.inputAreaStart+z.stepInset+(t.inputAreaLength-2*z.stepInset)*Math.min(1,Math.max(0,e))}function y(t,e){return Math.min(1,Math.max(0,(e-z.stepInset-t.inputAreaStart)/(t.inputAreaLength-2*z.stepInset-2*t.inputAreaStart)))}function x(t,e,n){var r=t.selectAll("rect."+z.railTouchRectClass).data([0]);r.enter().append("rect").classed(z.railTouchRectClass,!0).call(d,e,t,n).style("pointer-events","all"),r.attr({width:n.inputAreaLength,height:Math.max(n.inputAreaWidth,z.tickOffset+n.ticklen+n.labelHeight)}).call(k.fill,n.bgcolor).attr("opacity",0),A.setTranslate(r,0,n.currentValueTotalHeight)}function _(t,e){var n=t.selectAll("rect."+z.railRectClass).data([0]);n.enter().append("rect").classed(z.railRectClass,!0);var r=e.inputAreaLength-2*z.railInset;n.attr({width:r,height:z.railWidth,rx:z.railRadius,ry:z.railRadius,"shape-rendering":"crispEdges"}).call(k.stroke,e.bordercolor).call(k.fill,e.bgcolor).style("stroke-width",e.borderwidth+"px"),A.setTranslate(n,z.railInset,.5*(e.inputAreaWidth-z.railWidth)+e.currentValueTotalHeight)}function b(t){for(var e=t._fullLayout._pushmargin||{},n=Object.keys(e),r=0;r0?[0]:[]);if(s.enter().append("g").classed(z.containerClassName,!0).style("cursor","ew-resize"),s.exit().remove(),s.exit().size()&&b(t),0!==n.length){var l=s.selectAll("g."+z.groupClassName).data(n,i);l.enter().append("g").classed(z.groupClassName,!0),l.exit().each(function(e){w.select(this).remove(),e._commandObserver.remove(),delete e._commandObserver,M.autoMargin(t,z.autoMarginIdRoot+e._index)});for(var u=0;u0||h<0){var m={left:[-n,0],right:[n,0],top:[0,-n],bottom:[0,n]}[b.side];e.attr("transform","translate("+m+")")}}}var g,v=n.propContainer,y=n.propName,x=n.traceIndex,_=n.dfltName,b=n.avoid||{},w=n.attributes,M=n.transform,k=n.containerGroup,A=t._fullLayout,T=v.titlefont.family,S=v.titlefont.size,z=v.titlefont.color,E=1,L=!1,I=v.title.trim();"title"===y?g="titleText":-1!==y.indexOf("axis")?g="axisTitleText":y.indexOf(!0)&&(g="colorbarTitleText");var D=t._context.edits[g];""===I&&(E=0),I.match(h)&&(E=.2,L=!0,D||(I=""));var C=I||D;k||(k=A._infolayer.selectAll(".g-"+e).data([0]),k.enter().append("g").classed("g-"+e,!0));var P=k.selectAll("text").data(C?[0]:[]);if(P.enter().append("text"),P.text(I).attr("class",e),P.exit().remove(),C){P.call(d);var O="Click to enter "+_+" title";D&&(I?P.on(".opacity",null):function(){E=0,L=!0,I=O,P.text(I).on("mouseover.opacity",function(){r.select(this).transition().duration(f.SHOW_PLACEHOLDER).style("opacity",1)}).on("mouseout.opacity",function(){r.select(this).transition().duration(f.HIDE_PLACEHOLDER).style("opacity",0)})}(),P.call(c.makeEditable,{gd:t}).on("edit",function(e){void 0!==x?a.restyle(t,y,e,x):a.relayout(t,y,e)}).on("cancel",function(){this.text(this.attr("data-unformatted")).call(d)}).on("input",function(t){this.text(t||" ").call(c.positionText,w.x,w.y)})),P.classed("js-placeholder",L)}}},{"../../constants/interactions":331,"../../lib":348,"../../lib/svg_text_utils":365,"../../plotly":379,"../../plots/plots":420,"../color":234,"../drawing":258,d3:8,"fast-isnumeric":12}],324:[function(t,e,n){"use strict";var r=t("../../plots/font_attributes"),i=t("../color/attributes"),a=t("../../lib/extend").extendFlat,o=t("../../plots/pad_attributes"),s={_isLinkedToArray:"button",method:{valType:"enumerated",values:["restyle","relayout","animate","update","skip"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string",dflt:""},execute:{valType:"boolean",dflt:!0}};e.exports={_isLinkedToArray:"updatemenu",_arrayAttrRegexps:[/^updatemenus\[(0|[1-9][0-9]+)\]\.buttons/],visible:{valType:"boolean"},type:{valType:"enumerated",values:["dropdown","buttons"],dflt:"dropdown"},direction:{valType:"enumerated",values:["left","right","up","down"],dflt:"down"},active:{valType:"integer",min:-1,dflt:0},showactive:{valType:"boolean",dflt:!0},buttons:s,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:"top"},pad:a({},o,{}),font:a({},r,{}),bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:i.borderLine},borderwidth:{valType:"number",min:0,dflt:1}}},{"../../lib/extend":342,"../../plots/font_attributes":408,"../../plots/pad_attributes":419,"../color/attributes":233}],325:[function(t,e,n){"use strict";e.exports={name:"updatemenus",containerClassName:"updatemenu-container",headerGroupClassName:"updatemenu-header-group",headerClassName:"updatemenu-header",headerArrowClassName:"updatemenu-header-arrow",dropdownButtonGroupClassName:"updatemenu-dropdown-button-group",dropdownButtonClassName:"updatemenu-dropdown-button",buttonClassName:"updatemenu-button",itemRectClassName:"updatemenu-item-rect",itemTextClassName:"updatemenu-item-text",menuIndexAttrName:"updatemenu-active-index",autoMarginIdRoot:"updatemenu-",blankHeaderOpts:{label:" "},minWidth:30,minHeight:30,textPadX:24,arrowPadX:16,rx:2,ry:2,textOffsetX:12,textOffsetY:3,arrowOffsetX:4,gapButtonHeader:5,gapButton:2,activeColor:"#F4FAFF",hoverColor:"#F4FAFF",arrowSymbol:{left:"\u25c4",right:"\u25ba",up:"\u25b2",down:"\u25bc"}}},{}],326:[function(t,e,n){"use strict";function r(t,e,n){function r(n,r){return a.coerce(t,e,s,n,r)}r("visible",i(t,e).length>0)&&(r("active"),r("direction"),r("type"),r("showactive"),r("x"),r("y"),a.noneOrAll(t,e,["x","y"]),r("xanchor"),r("yanchor"),r("pad.t"),r("pad.r"),r("pad.b"),r("pad.l"),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,c,t,e)}for(var r,i,o=t.buttons||[],s=e.buttons=[],l=0;l0?[0]:[]);if(a.enter().append("g").classed(E.containerClassName,!0).style("cursor","pointer"),a.exit().remove(),a.exit().size()&&b(t),0!==n.length){var c=a.selectAll("g."+E.headerGroupClassName).data(n,i);c.enter().append("g").classed(E.headerGroupClassName,!0);var f=a.selectAll("g."+E.dropdownButtonGroupClassName).data([0]);f.enter().append("g").classed(E.dropdownButtonGroupClassName,!0).style("pointer-events","all");for(var h=0;hM,T=r.barLength+2*r.barPad,S=r.barWidth+2*r.barPad,z=p,E=g+v;E+S>u&&(E=u-S);var L=this.container.selectAll("rect.scrollbar-horizontal").data(A?[0]:[]);L.exit().on(".drag",null).remove(),L.enter().append("rect").classed("scrollbar-horizontal",!0).call(a.fill,r.barColor),A?(this.hbar=L.attr({rx:r.barRadius,ry:r.barRadius,x:z,y:E,width:T,height:S}),this._hbarXMin=z+T/2,this._hbarTranslateMax=M-T):(delete this.hbar,delete this._hbarXMin,delete this._hbarTranslateMax);var I=v>k,D=r.barWidth+2*r.barPad,C=r.barLength+2*r.barPad,P=p+m,O=g;P+D>l&&(P=l-D);var F=this.container.selectAll("rect.scrollbar-vertical").data(I?[0]:[]);F.exit().on(".drag",null).remove(),F.enter().append("rect").classed("scrollbar-vertical",!0).call(a.fill,r.barColor),I?(this.vbar=F.attr({rx:r.barRadius,ry:r.barRadius,x:P,y:O,width:D,height:C}),this._vbarYMin=O+C/2,this._vbarTranslateMax=k-C):(delete this.vbar,delete this._vbarYMin,delete this._vbarTranslateMax);var R=this.id,j=c-.5,N=I?f+D+.5:f+.5,B=h-.5,V=A?d+S+.5:d+.5,q=s._topdefs.selectAll("#"+R).data(A||I?[0]:[]);if(q.exit().remove(),q.enter().append("clipPath").attr("id",R).append("rect"),A||I?(this._clipRect=q.select("rect").attr({x:Math.floor(j),y:Math.floor(B),width:Math.ceil(N)-Math.floor(j),height:Math.ceil(V)-Math.floor(B)}),this.container.call(o.setClipUrl,R),this.bg.attr({x:p,y:g,width:m,height:v})):(this.bg.attr({width:0,height:0}),this.container.on("wheel",null).on(".drag",null).call(o.setClipUrl,null),delete this._clipRect),A||I){var U=i.behavior.drag().on("dragstart",function(){i.event.sourceEvent.preventDefault()}).on("drag",this._onBoxDrag.bind(this));this.container.on("wheel",null).on("wheel",this._onBoxWheel.bind(this)).on(".drag",null).call(U);var H=i.behavior.drag().on("dragstart",function(){i.event.sourceEvent.preventDefault(),i.event.sourceEvent.stopPropagation()}).on("drag",this._onBarDrag.bind(this));A&&this.hbar.on(".drag",null).call(H),I&&this.vbar.on(".drag",null).call(H)}this.setTranslate(e,n)},r.prototype.disable=function(){(this.hbar||this.vbar)&&(this.bg.attr({width:0,height:0}),this.container.on("wheel",null).on(".drag",null).call(o.setClipUrl,null),delete this._clipRect),this.hbar&&(this.hbar.on(".drag",null),this.hbar.remove(),delete this.hbar,delete this._hbarXMin,delete this._hbarTranslateMax),this.vbar&&(this.vbar.on(".drag",null),this.vbar.remove(),delete this.vbar,delete this._vbarYMin,delete this._vbarTranslateMax)},r.prototype._onBoxDrag=function(){var t=this.translateX,e=this.translateY;this.hbar&&(t-=i.event.dx),this.vbar&&(e-=i.event.dy),this.setTranslate(t,e)},r.prototype._onBoxWheel=function(){var t=this.translateX,e=this.translateY;this.hbar&&(t+=i.event.deltaY),this.vbar&&(e+=i.event.deltaY),this.setTranslate(t,e)},r.prototype._onBarDrag=function(){var t=this.translateX,e=this.translateY;if(this.hbar){var n=t+this._hbarXMin,r=n+this._hbarTranslateMax;t=(s.constrain(i.event.x,n,r)-n)/(r-n)*(this.position.w-this._box.w)}if(this.vbar){var a=e+this._vbarYMin,o=a+this._vbarTranslateMax;e=(s.constrain(i.event.y,a,o)-a)/(o-a)*(this.position.h-this._box.h)}this.setTranslate(t,e)},r.prototype.setTranslate=function(t,e){var n=this.position.w-this._box.w,r=this.position.h-this._box.h;if(t=s.constrain(t||0,0,n),e=s.constrain(e||0,0,r),this.translateX=t,this.translateY=e,this.container.call(o.setTranslate,this._box.l-this.position.l-t,this._box.t-this.position.t-e),this._clipRect&&this._clipRect.attr({x:Math.floor(this.position.l+t-.5),y:Math.floor(this.position.t+e-.5)}),this.hbar){var i=t/n;this.hbar.call(o.setTranslate,t+i*this._hbarTranslateMax,e)}if(this.vbar){var a=e/r;this.vbar.call(o.setTranslate,t,e+a*this._vbarTranslateMax)}}},{"../../lib":348,"../color":234,"../drawing":258,d3:8}],330:[function(t,e,n){"use strict";e.exports={FROM_BL:{left:0,center:.5,right:1,bottom:0,middle:.5,top:1},FROM_TL:{left:0,center:.5,right:1,bottom:1,middle:.5,top:0},LINE_SPACING:1.3,MID_SHIFT:.35}},{}],331:[function(t,e,n){"use strict";e.exports={SHOW_PLACEHOLDER:100,HIDE_PLACEHOLDER:1e3,DBLCLICKDELAY:300,DESELECTDIM:.2}},{}],332:[function(t,e,n){"use strict";e.exports={BADNUM:void 0,FP_SAFE:Number.MAX_VALUE/1e4,ONEAVGYEAR:315576e5,ONEAVGMONTH:26298e5,ONEDAY:864e5,ONEHOUR:36e5,ONEMIN:6e4,ONESEC:1e3,EPOCHJD:2440587.5,ALMOST_EQUAL:1-1e-6}},{}],333:[function(t,e,n){"use strict";e.exports={entityToUnicode:{mu:"\u03bc","#956":"\u03bc",amp:"&","#28":"&",lt:"<","#60":"<",gt:">","#62":">",nbsp:"\xa0","#160":"\xa0",times:"\xd7","#215":"\xd7",plusmn:"\xb1","#177":"\xb1",deg:"\xb0","#176":"\xb0"}}},{}],334:[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}},{}],335:[function(t,e,n){"use strict";var r=t("./plotly");n.version="1.29.2",t("es6-promise").polyfill(),t("../build/plotcss"),t("./fonts/mathjax_config"),n.plot=r.plot,n.newPlot=r.newPlot,n.restyle=r.restyle,n.relayout=r.relayout,n.redraw=r.redraw,n.update=r.update,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=t("./plot_api/register"),n.toImage=t("./plot_api/to_image"),n.downloadImage=t("./snapshot/download"),n.validate=t("./plot_api/validate"),n.addFrames=r.addFrames,n.deleteFrames=r.deleteFrames,n.animate=r.animate,n.register(t("./traces/scatter")),n.register([t("./components/fx"),t("./components/legend"),t("./components/annotations"),t("./components/annotations3d"),t("./components/shapes"),t("./components/images"),t("./components/updatemenus"),t("./components/sliders"),t("./components/rangeslider"),t("./components/rangeselector")]),n.Icons=t("../build/ploticon"),n.Plots=r.Plots,n.Fx=t("./components/fx"),n.Snapshot=t("./snapshot"),n.PlotSchema=t("./plot_api/plot_schema"),n.Queue=t("./lib/queue"),n.d3=t("d3")},{"../build/plotcss":1,"../build/ploticon":2,"./components/annotations":227,"./components/annotations3d":232,"./components/fx":275,"./components/images":283,"./components/legend":291,"./components/rangeselector":303,"./components/rangeslider":309,"./components/shapes":316,"./components/sliders":322,"./components/updatemenus":328,"./fonts/mathjax_config":336,"./lib/queue":360,"./plot_api/plot_schema":373,"./plot_api/register":374,"./plot_api/set_plot_config":375,"./plot_api/to_image":377,"./plot_api/validate":378,"./plotly":379,"./snapshot":433,"./snapshot/download":430,"./traces/scatter":449,d3:8,"es6-promise":10}],336:[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},{}],337:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),i=t("../constants/numerical").BADNUM,a=/^['"%,$#\s']+|[, ]|['"%,$#\s']+$/g;e.exports=function(t){return"string"==typeof t&&(t=t.replace(a,"")),r(t)?Number(t):i}},{"../constants/numerical":332,"fast-isnumeric":12}],338:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),i=t("tinycolor2"),a=t("../plots/attributes"),o=t("../components/colorscale/get_scale"),s=(Object.keys(t("../components/colorscale/scales")),t("./nested_property")),l=/^([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)},validateFunction:function(t,e){e.coerceNumber&&(t=+t);for(var n=e.values,r=0;ri.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;!0!==r.strict&&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;if("string"==typeof t&&t.substr(0,r)===n&&l.test(t.substr(r)))return void e.set(t);e.set(n)},validateFunction:function(t,e){var n=e.dflt,r=n.length;return t===n||"string"==typeof t&&!(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 i=t.split("+"),a=0;a0&&(o=o.replace(/0+$/,"").replace(/[\.]$/,"")),r+=":"+o}return r}function l(t){return t.formatDate("yyyy")}function u(t){return t.formatDate("M yyyy")}function c(t){return t.formatDate("M d")}function f(t){return t.formatDate("M d, yyyy")}var h=t("d3"),d=t("fast-isnumeric"),p=t("./loggers").error,m=t("./mod"),g=t("../constants/numerical"),v=g.BADNUM,y=g.ONEDAY,x=g.ONEHOUR,_=g.ONEMIN,b=g.ONESEC,w=g.EPOCHJD,M=t("../registry"),k=h.time.format.utc,A=/^\s*(-?\d\d\d\d|\d\d)(-(\d?\d)(-(\d?\d)([ Tt]([01]?\d|2[0-3])(:([0-5]\d)(:([0-5]\d(\.\d+)?))?(Z|z|[+\-]\d\d:?\d\d)?)?)?)?)?\s*$/m,T=/^\s*(-?\d\d\d\d|\d\d)(-(\d?\di?)(-(\d?\d)([ Tt]([01]?\d|2[0-3])(:([0-5]\d)(:([0-5]\d(\.\d+)?))?(Z|z|[+\-]\d\d:?\d\d)?)?)?)?)?\s*$/m,S=(new Date).getFullYear()-70;n.dateTick0=function(t,e){return r(t)?e?M.getComponentMethod("calendars","CANONICAL_SUNDAY")[t]:M.getComponentMethod("calendars","CANONICAL_TICK")[t]:e?"2000-01-02":"2000-01-01"},n.dfltRange=function(t){return r(t)?M.getComponentMethod("calendars","DFLTRANGE")[t]:["2000-01-01","2001-01-01"]},n.isJSDate=function(t){return"object"==typeof t&&null!==t&&"function"==typeof t.getTime};var z,E;n.dateTime2ms=function(t,e){if(n.isJSDate(t))return t=Number(t)-t.getTimezoneOffset()*_,t>=z&&t<=E?t:v;if("string"!=typeof t&&"number"!=typeof t)return v;t=String(t);var i=r(e),a=t.charAt(0);!i||"G"!==a&&"g"!==a||(t=t.substr(1),e="");var o=i&&"chinese"===e.substr(0,7),s=t.match(o?T:A);if(!s)return v;var l=s[1],u=s[3]||"1",c=Number(s[5]||1),f=Number(s[7]||0),h=Number(s[9]||0),d=Number(s[11]||0);if(i){if(2===l.length)return v;l=Number(l);var p;try{var m=M.getComponentMethod("calendars","getCal")(e);if(o){var g="i"===u.charAt(u.length-1);u=parseInt(u,10),p=m.newDate(l,m.toMonthIndex(l,u,g),c)}else p=m.newDate(l,Number(u),c)}catch(t){return v}return p?(p.toJD()-w)*y+f*x+h*_+d*b:v}l=2===l.length?(Number(l)+2e3-S)%100+S:Number(l),u-=1;var k=new Date(Date.UTC(2e3,u,c,f,h));return k.setUTCFullYear(l),k.getUTCMonth()!==u?v:k.getUTCDate()!==c?v:k.getTime()+d*b},z=n.MIN_MS=n.dateTime2ms("-9999"),E=n.MAX_MS=n.dateTime2ms("9999-12-31 23:59:59.9999"),n.isDateTime=function(t,e){return n.dateTime2ms(t,e)!==v};var L=90*y,I=3*x,D=5*_;n.ms2DateTime=function(t,e,n){if("number"!=typeof t||!(t>=z&&t<=E))return v;e||(e=0);var i,o,s,l,u,c,f=Math.floor(10*m(t+.05,1)),h=Math.round(t-f/10);if(r(n)){var d=Math.floor(h/y)+w,p=Math.floor(m(t,y));try{i=M.getComponentMethod("calendars","getCal")(n).fromJD(d).formatDate("yyyy-mm-dd")}catch(t){i=k("G%Y-%m-%d")(new Date(h))}if("-"===i.charAt(0))for(;i.length<11;)i="-0"+i.substr(1);else for(;i.length<10;)i="0"+i;o=e=z+y&&t<=E-y))return v;var e=Math.floor(10*m(t+.05,1)),n=new Date(Math.round(t-e/10));return a(h.time.format("%Y-%m-%d")(n),n.getHours(),n.getMinutes(),n.getSeconds(),10*n.getUTCMilliseconds()+e)},n.cleanDate=function(t,e,i){if(n.isJSDate(t)||"number"==typeof t){if(r(i))return p("JS Dates and milliseconds are incompatible with world calendars",t),e;if(!(t=n.ms2DateTimeLocal(+t))&&void 0!==e)return e}else if(!n.isDateTime(t,i))return p("unrecognized date",t),e;return t};var C=/%\d?f/g,P=[59,59.9,59.99,59.999,59.9999],O=k("%Y"),F=k("%b %Y"),R=k("%b %-d"),j=k("%b %-d, %Y");n.formatDate=function(t,e,n,i){var a,h;if(i=r(i)&&i,e)return o(e,t,i);if(i)try{var d=Math.floor((t+.05)/y)+w,p=M.getComponentMethod("calendars","getCal")(i).fromJD(d);"y"===n?h=l(p):"m"===n?h=u(p):"d"===n?(a=l(p),h=c(p)):(a=f(p),h=s(t,n))}catch(t){return"Invalid"}else{var m=new Date(Math.floor(t+.05));"y"===n?h=O(m):"m"===n?h=F(m):"d"===n?(a=O(m),h=R(m)):(a=j(m),h=s(t,n))}return h+(a?"\n"+a:"")};var N=3*y;n.incrementMonth=function(t,e,n){n=r(n)&&n;var i=m(t,y);if(t=Math.round(t-i),n)try{var a=Math.round(t/y)+w,o=M.getComponentMethod("calendars","getCal")(n),s=o.fromJD(a);return e%12?o.add(s,e,"m"):o.add(s,e/12,"y"),(s.toJD()-w)*y+i}catch(e){p("invalid ms "+t+" in calendar "+n)}var l=new Date(t+N);return l.setUTCMonth(l.getUTCMonth()+e)+i-N},n.findExactDates=function(t,e){for(var n,i,a=0,o=0,s=0,l=0,u=r(e)&&M.getComponentMethod("calendars","getCal")(e),c=0;c0&&(i.push(a),a=[])}return a.length>0&&i.push(a),i},n.makeLine=function(t,e){var n={};return n=1===t.length?{type:"LineString",coordinates:t[0]}:{type:"MultiLineString",coordinates:t},e&&(n.trace=e),n},n.makePolygon=function(t,e){var n={};if(1===t.length)n={type:"Polygon",coordinates:t};else{for(var r=new Array(t.length),i=0;i1||m<0||m>1?null:{x:t+l*m,y:e+f*m}}function i(t,e,n,r,i){var a=r*t+i*e;if(a<0)return r*r+i*i;if(a>n){var o=r-t,s=i-e;return o*o+s*s}var l=r*e-i*t;return l*l/n}var a=t("./mod");n.segmentsIntersect=r,n.segmentDistance=function(t,e,n,a,o,s,l,u){if(r(t,e,n,a,o,s,l,u))return 0;var c=n-t,f=a-e,h=l-o,d=u-s,p=c*c+f*f,m=h*h+d*d,g=Math.min(i(c,f,p,o-t,s-e),i(c,f,p,l-t,u-e),i(h,d,m,t-o,e-s),i(h,d,m,n-o,a-s));return Math.sqrt(g)};var o,s,l;n.getTextLocation=function(t,e,n,r){if(t===s&&r===l||(o={},s=t,l=r),o[n])return o[n];var i=t.getPointAtLength(a(n-r/2,e)),u=t.getPointAtLength(a(n+r/2,e)),c=Math.atan((u.y-i.y)/(u.x-i.x)),f=t.getPointAtLength(a(n,e)),h=(4*f.x+i.x+u.x)/6,d=(4*f.y+i.y+u.y)/6,p={x:h,y:d,theta:c};return o[n]=p,p},n.clearLocationCache=function(){s=null},n.getVisibleSegment=function(t,e,n){function r(e){var n=t.getPointAtLength(e);0===e?i=n:e===f&&(a=n);var r=n.xs?n.x-s:0,c=n.yu?n.y-u:0;return Math.sqrt(r*r+c*c)}for(var i,a,o=e.left,s=e.right,l=e.top,u=e.bottom,c=0,f=t.getTotalLength(),h=f,d=r(c);d;){if((c+=d+n)>h)return;d=r(c)}for(d=r(h);d;){if(h-=d+n,c>h)return;d=r(h)}return{min:c,max:h,len:h-c,total:f,isClosed:0===c&&h===f&&Math.abs(i.x-a.x)<.1&&Math.abs(i.y-a.y)<.1}}},{"./mod":353}],347:[function(t,e,n){"use strict";e.exports=function(t){return t}},{}],348:[function(t,e,n){"use strict";var r=t("d3"),i=t("fast-isnumeric"),a=t("../constants/numerical"),o=a.FP_SAFE,s=a.BADNUM,l=e.exports={};l.nestedProperty=t("./nested_property"),l.isPlainObject=t("./is_plain_object"),l.isArray=t("./is_array"),l.mod=t("./mod"),l.toLogRange=t("./to_log_range"),l.relinkPrivateKeys=t("./relink_private"),l.ensureArray=t("./ensure_array");var u=t("./coerce");l.valObjects=u.valObjects,l.coerce=u.coerce,l.coerce2=u.coerce2,l.coerceFont=u.coerceFont,l.coerceHoverinfo=u.coerceHoverinfo,l.validate=u.validate;var c=t("./dates");l.dateTime2ms=c.dateTime2ms,l.isDateTime=c.isDateTime,l.ms2DateTime=c.ms2DateTime,l.ms2DateTimeLocal=c.ms2DateTimeLocal,l.cleanDate=c.cleanDate,l.isJSDate=c.isJSDate,l.formatDate=c.formatDate,l.incrementMonth=c.incrementMonth,l.dateTick0=c.dateTick0,l.dfltRange=c.dfltRange,l.findExactDates=c.findExactDates,l.MIN_MS=c.MIN_MS,l.MAX_MS=c.MAX_MS;var f=t("./search");l.findBin=f.findBin,l.sorterAsc=f.sorterAsc,l.sorterDes=f.sorterDes,l.distinctVals=f.distinctVals,l.roundUp=f.roundUp;var h=t("./stats");l.aggNums=h.aggNums,l.len=h.len,l.mean=h.mean,l.variance=h.variance,l.stdev=h.stdev,l.interp=h.interp;var d=t("./matrix");l.init2dArray=d.init2dArray,l.transposeRagged=d.transposeRagged,l.dot=d.dot,l.translationMatrix=d.translationMatrix,l.rotationMatrix=d.rotationMatrix,l.rotationXYMatrix=d.rotationXYMatrix,l.apply2DTransform=d.apply2DTransform,l.apply2DTransform2=d.apply2DTransform2;var p=t("./geometry2d");l.segmentsIntersect=p.segmentsIntersect,l.segmentDistance=p.segmentDistance,l.getTextLocation=p.getTextLocation,l.clearLocationCache=p.clearLocationCache,l.getVisibleSegment=p.getVisibleSegment;var m=t("./extend");l.extendFlat=m.extendFlat,l.extendDeep=m.extendDeep,l.extendDeepAll=m.extendDeepAll,l.extendDeepNoArrays=m.extendDeepNoArrays;var g=t("./loggers");l.log=g.log,l.warn=g.warn,l.error=g.error,l.notifier=t("./notifier"),l.filterUnique=t("./filter_unique"),l.filterVisible=t("./filter_visible"),l.pushUnique=t("./push_unique"),l.cleanNumber=t("./clean_number"),l.ensureNumber=function(t){return i(t)?(t=Number(t),t<-o||t>o?s:i(t)?Number(t):s):s},l.noop=t("./noop"),l.identity=t("./identity"),l.swapAttrs=function(t,e,n,r){n||(n="x"),r||(r="y");for(var i=0;in?Math.max(n,Math.min(e,t)):Math.max(e,Math.min(n,t))},l.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},l.simpleMap=function(t,e,n,r){for(var i=t.length,a=new Array(i),o=0;o-1||c!==1/0&&c>=Math.pow(2,n)?t(e,n,r):l},l.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},l.smooth=function(t,e){if((e=Math.round(e)||0)<2)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;n=s&&(i-=s*Math.floor(i/s)),i<0?i=-1-i:i>=o&&(i=s-1-i),a+=t[i]*u[r];c[n]=a}return c},l.syncOrAsync=function(t,e,n){function r(){return l.syncOrAsync(t,e,n)}for(var i,a;t.length;)if(a=t.splice(0,1)[0],(i=a(e))&&i.then)return i.then(r).then(void 0,l.promiseError);return n&&n(e)},l.stripTrailingSlash=function(t){return"/"===t.substr(-1)?t.substr(0,t.length-1):t},l.noneOrAll=function(t,e,n){if(t){var r,i,a=!1,o=!0;for(r=0;r1?i+o[1]:"";if(a&&(o.length>1||s.length>4||n))for(;r.test(s);)s=s.replace(r,"$1"+a+"$2");return s+l}},{"../constants/numerical":332,"./clean_number":337,"./coerce":338,"./dates":339,"./ensure_array":340,"./extend":342,"./filter_unique":343,"./filter_visible":344,"./geometry2d":346,"./identity":347,"./is_array":349,"./is_plain_object":350,"./loggers":351,"./matrix":352,"./mod":353,"./nested_property":354,"./noop":355,"./notifier":356,"./push_unique":359,"./relink_private":361,"./search":362,"./stats":364,"./to_log_range":366,d3:8,"fast-isnumeric":12}],349:[function(t,e,n){"use strict";var r="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer:{isView:function(){return!1}};e.exports=function(t){return Array.isArray(t)||r.isView(t)}},{}],350:[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}},{}],351:[function(t,e,n){"use strict";function r(t,e){if(t.apply)t.apply(t,e);else for(var n=0;n1){for(var t=["LOG:"],e=0;e0){for(var t=["WARN:"],e=0;e0){for(var t=["ERROR:"],e=0;e=0;e--){if(r=t[e][0],a=t[e][1],l=!1,d(r))for(n=r.length-1;n>=0;n--)i(r[n],o(a,n))?l?r[n]=void 0:r.pop():l=!0;else if("object"==typeof r&&null!==r)for(s=Object.keys(r),l=!1,n=s.length-1;n>=0;n--)i(r[s[n]],o(a,s[n]))?delete r[s[n]]:l=!0;if(l)return}}function c(t){return void 0===t||null===t||"object"==typeof t&&(d(t)?!t.length:!Object.keys(t).length)}function f(t,e,n){return{set:function(){throw"bad container"},get:function(){},astr:e,parts:n,obj:t}}var h=t("fast-isnumeric"),d=t("./is_array"),p=t("./is_plain_object"),m=t("../plot_api/container_array_match");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 n,i,o,s=0,l=e.split(".");s/g),s=0;so||r===i||rl)&&(!e||!c(t))}function n(t,e){var n=t[0],u=t[1];if(n===i||no||u===i||ul)return!1;var c,f,h,d,p,m=r.length,g=r[0][0],v=r[0][1],y=0;for(c=1;cMath.max(f,g)||u>Math.max(h,v)))if(uc||Math.abs(r(o,h))>i)return!0;return!1};a.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){n(t.pop())}return{addPt:n,raw:t,filtered:r}}},{"../constants/numerical":332,"./matrix":352}],359:[function(t,e,n){"use strict";e.exports=function(t,e){if(e instanceof RegExp){var n,r=e.toString();for(n=0;na.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;ne}function o(t,e){return t>=e}var s=t("fast-isnumeric"),l=t("./loggers");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;f90&&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;se[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;it.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}],365:[function(t,e,n){"use strict";function r(t,e){return t.node().getBoundingClientRect()[e]}function i(t){return t.replace(v,"\\lt ").replace(y,"\\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){if(!t)return null;var n=t.match(e);return n&&(n[3]||n[4])}function s(t,e){if(!t)return"";for(var n=0;n1)for(var i=1;i doesnt match end tag <"+t+">. Pretending it did match.",e),a=u[u.length-1].node}(k);else{var O=y[4],F={type:k},R=o(O,L);if(R?(R=R.replace(P,"$1 fill:"),A&&(R+=";"+A)):A&&(R=A),R&&(F.style=R),"a"===k){s=!0;var j=o(O,I);if(j){var N=document.createElement("a");N.href=j,-1!==M.indexOf(N.protocol)&&(F.href=encodeURI(j),F.target=o(O,D)||"_blank",F.popup=o(O,C))}}r(F)}}return s}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"),m=t("../constants/alignment").LINE_SPACING,g=/([^$]*)([$]+[^$]*[$]+)([^$]*)/;n.convertToTspans=function(t,e,i){function o(){c.empty()||(h=t.attr("class")+"-math",c.select("svg."+h).remove()),t.text("").style("white-space","pre"),u(t.node(),s)&&t.style("pointer-events","all"),n.positionText(t),i&&i.call(t)}var s=t.text(),l=!t.attr("data-notex")&&"undefined"!=typeof MathJax&&s.match(g),c=f.select(t.node().parentNode);if(!c.empty()){var h=t.attr("class")?t.attr("class").split(" ")[0]:"text";return h+="-math",c.selectAll("svg."+h).remove(),c.selectAll("g."+h+"-group").remove(),t.style("display",null).attr({"data-unformatted":s,"data-math":"N"}),l?(e&&e._promises||[]).push(new Promise(function(e){t.style("display","none");var n={fontSize:parseInt(t.style("font-size"),10)};a(l[2],n,function(n,a,l){c.selectAll("svg."+h).remove(),c.selectAll("g."+h+"-group").remove();var u=n&&n.select("svg");if(!u||!u.node())return o(),void e();var f=c.append("g").classed(h+"-group",!0).attr({"pointer-events":"none","data-unformatted":s,"data-math":"Y"});f.node().appendChild(u.node()),a&&a.node()&&u.node().insertBefore(a.node().cloneNode(!0),u.node().firstChild),u.attr({class:h,height:l.height,preserveAspectRatio:"xMinYMin meet"}).style({overflow:"visible","pointer-events":"none"});var d=t.style("fill")||"black";u.select("g").attr({fill:d,stroke:d});var p=r(u,"width"),m=r(u,"height"),g=+t.attr("x")-p*{start:0,middle:.5,end:1}[t.attr("text-anchor")||"start"],v=parseInt(t.style("font-size"),10)||r(t,"height"),y=-v/4;"y"===h[0]?(f.attr({transform:"rotate("+[-90,+t.attr("x"),+t.attr("y")]+") translate("+[-p/2,y-m/2]+")"}),u.attr({x:+t.attr("x"),y:+t.attr("y")})):"l"===h[0]?u.attr({x:t.attr("x"),y:y-m/2}):"a"===h[0]?u.attr({x:0,y:y}):u.attr({x:g,y:+t.attr("y")+y-m/2}),i&&i.call(t,f),e(f)})})):o(),t}};var v=/(<|<|<)/g,y=/(>|>|>)/g,x={sup:"font-size:70%",sub:"font-size:70%",b:"font-weight:bold",i:"font-style:italic",a:"cursor:pointer",span:"",em:"font-style:italic;font-weight:bold"},_={sub:"0.3em",sup:"-0.6em"},b={sub:"-0.21em",sup:"0.42em"},w="\u200b",M=["http:","https:","mailto:","",void 0,":"],k=new RegExp("]*)?/?>","g"),A=Object.keys(p.entityToUnicode).map(function(t){return{regExp:new RegExp("&"+t+";","g"),sub:p.entityToUnicode[t]}}),T=/(\r\n?|\n)/g,S=/(<[^<>]*>)/,z=/<(\/?)([^ >]*)(\s+(.*))?>/i,E=//i,L=/(^|[\s"'])style\s*=\s*("([^"]*);?"|'([^']*);?')/i,I=/(^|[\s"'])href\s*=\s*("([^"]*)"|'([^']*)')/i,D=/(^|[\s"'])target\s*=\s*("([^"\s]*)"|'([^'\s]*)')/i,C=/(^|[\s"'])popup\s*=\s*("([\w=,]*)"|'([\w=,]*)')/i,P=/(^|;)\s*color:/;n.plainText=function(t){return(t||"").replace(k," ")},n.lineCount=function(t){return t.selectAll("tspan.line").size()||1},n.positionText=function(t,e,n){return t.each(function(){function t(t,e){return void 0===e?null===(e=r.attr(t))&&(r.attr(t,0),e=0):r.attr(t,e),e}var r=f.select(this),i=t("x",e),a=t("y",n);"text"===this.nodeName&&r.selectAll("tspan.line").attr({x:i,y:a})})},n.makeEditable=function(t,e){function n(){i(),t.style({opacity:0});var e,n=l.attr("class");(e=n?"."+n.split(" ")[0]+"-math-group":"[class*=-math-group]")&&f.select(t.node().parentNode).select(e).style({opacity:0})}function r(t){var e=t.node(),n=document.createRange();n.selectNodeContents(e);var r=window.getSelection();r.removeAllRanges(),r.addRange(n),e.focus()}function i(){var n=f.select(a),i=n.select(".svg-container"),o=i.append("div");o.classed("plugin-editable editable",!0).style({position:"absolute","font-family":t.style("font-family")||"Arial","font-size":t.style("font-size")||12,color:e.fill||t.style("fill")||"black",opacity:1,"background-color":e.background||"transparent",outline:"#ffffff33 1px solid",margin:[-parseFloat(t.style("font-size"))/8+1,0,0,-1].join("px ")+"px",padding:"0","box-sizing":"border-box"}).attr({contenteditable:!0}).text(e.text||t.attr("data-unformatted")).call(c(t,i,e)).on("blur",function(){a._editing=!1,t.text(this.textContent).style({opacity:1});var e,n=f.select(this).attr("class");(e=n?"."+n.split(" ")[0]+"-math-group":"[class*=-math-group]")&&f.select(t.node().parentNode).select(e).style({opacity:0});var r=this.textContent;f.select(this).transition().duration(0).remove(),f.select(document).on("mouseup",null),s.edit.call(t,r)}).on("focus",function(){var t=this;a._editing=!0,f.select(document).on("mouseup",function(){if(f.event.target===t)return!1;document.activeElement===o.node()&&o.node().blur()})}).on("keyup",function(){27===f.event.which?(a._editing=!1,t.style({opacity:1}),f.select(this).style({opacity:0}).on("blur",function(){return!1}).transition().remove(),s.cancel.call(t,this.textContent)):(s.input.call(t,this.textContent),f.select(this).call(c(t,i,e)))}).on("keydown",function(){13===f.event.which&&this.blur()}).call(r)}var a=e.gd,o=e.delegate,s=f.dispatch("edit","input","cancel"),l=o||t;if(t.style({"pointer-events":o?"none":"all"}),1!==t.size())throw new Error("boo");return e.immediate?n():l.on("click",n),f.rebind(t,s,"on")}},{"../constants/alignment":330,"../constants/string_mappings":333,"../constants/xmlns_namespaces":334,"../lib":348,d3:8}],366:[function(t,e,n){"use strict";var r=t("fast-isnumeric");e.exports=function(t,e){if(t>0)return Math.log(t)/Math.LN10;var n=Math.log(Math.min(e[0],e[1]))/Math.LN10;return r(n)||(n=Math.log(Math.max(e[0],e[1]))/Math.LN10-6),n}},{"fast-isnumeric":12}],367:[function(t,e,n){"use strict";var r=t("../registry");e.exports=function(t){for(var e,n,i=r.layoutArrayContainers,a=r.layoutArrayRegexes,o=t.split("[")[0],s=0;s0)return t.substr(0,e)}var s=t("fast-isnumeric"),l=t("gl-mat4/fromQuat"),u=t("../registry"),c=t("../lib"),f=t("../plots/plots"),h=t("../plots/cartesian/axes"),d=t("../components/color");n.getGraphDiv=function(t){var e;if("string"==typeof t){if(null===(e=document.getElementById(t)))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},n.clearPromiseQueue=function(t){Array.isArray(t._promises)&&t._promises.length>0&&c.log("Clearing previous rejected promises from queue."),t._promises=[]},n.cleanLayout=function(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 i=h.list({_fullLayout:t});for(e=0;e3?(g.x=1.02,g.xanchor="left"):g.x<-2&&(g.x=-.02,g.xanchor="right"),g.y>3?(g.y=1.02,g.yanchor="bottom"):g.y<-2&&(g.y=-.02,g.yanchor="top")),"rotate"===t.dragmode&&(t.dragmode="orbit"),t.scene1&&(t.scene||(t.scene=t.scene1),delete t.scene1);var v=f.getSubplotIds(t,"gl3d");for(e=0;e1&&o.warn("Full array edits are incompatible with other edits",f);var y=n[""][""];if(c(y))e.set(null);else{if(!Array.isArray(y))return o.warn("Unrecognized full array edit value",f,y),!0;e.set(y)}return!m&&(h(g,v),d(t),!0)}var x,_,b,w,M,k,A,T=Object.keys(n).map(Number).sort(s),S=e.get(),z=S||[],E=r(v,f).get(),L=[],I=-1,D=z.length;for(x=0;xz.length-(A?0:1))o.warn("index out of range",f,b);else if(void 0!==k)M.length>1&&o.warn("Insertion & removal are incompatible with edits to the same index.",f,b),c(k)?L.push(b):A?("add"===k&&(k={}),z.splice(b,0,k),E&&E.splice(b,0,{})):o.warn("Unrecognized full object edit value",f,b,k),-1===I&&(I=b);else for(_=0;_=0;x--)z.splice(L[x],1),E&&E.splice(L[x],1);if(z.length?S||e.set(z):e.set(null),m)return!1;if(h(g,v),p!==a){var C;if(-1===I)C=T;else{for(D=Math.max(z.length,D),C=[],x=0;x=I);x++)C.push(b);for(x=I;x=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||i<0&&e.indexOf(t.data.length+i)>-1)throw new Error("each index in "+n+" must be unique.")}}function l(t,e,n){if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if(void 0===e)throw new Error("currentIndices is a required argument.");if(Array.isArray(e)||(e=[e]),s(t,e,"currentIndices"),void 0===n||Array.isArray(n)||(n=[n]),void 0!==n&&s(t,n,"newIndices"),void 0!==n&&e.length!==n.length)throw new Error("current and new indices must be of equal length.")}function u(t,e,n){var r,i;if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if(void 0===e)throw new Error("traces must be defined.");for(Array.isArray(e)||(e=[e]),r=0;r=0&&lU.range[0]?[1,2]:[2,1]);else{var Z=U.range[0],X=U.range[1];H?(Z<=0&&X<=0&&n(R+".autorange",!0),Z<=0?Z=X/1e6:X<=0&&(X=Z/1e6),n(R+".range[0]",Math.log(Z)/Math.LN10),n(R+".range[1]",Math.log(X)/Math.LN10)):(n(R+".range[0]",Math.pow(10,Z)),n(R+".range[1]",Math.pow(10,X)))}else n(R+".autorange",!0);M.getComponentMethod("annotations","convertCoords")(t,B,S,n),M.getComponentMethod("images","convertCoords")(t,B,S,n)}else n(R+".autorange",!0);_.nestedProperty(u,R+"._inputRange").set(null)}else if(C.match(O.AX_NAME_PATTERN)){var Y=_.nestedProperty(u,A).get(),W=(S||{}).type;W&&"-"!==W||(W="linear"),M.getComponentMethod("annotations","convertCoords")(t,Y,W,n),M.getComponentMethod("images","convertCoords")(t,Y,W,n)}var Q=I.containerArrayMatch(A);if(Q){a=Q.array,o=Q.index;var J=Q.property,$=_.nestedProperty(l,a),K=($||[])[o]||{};if(""===o)-1===A.indexOf("updatemenus")&&(v.docalc=!0);else if(""===J){var tt=S;I.isAddVal(S)?b[A]=null:I.isRemoveVal(S)?(b[A]=K,tt=K):_.warn("unrecognized full object value",e),(r(tt,"x")||r(tt,"y")&&-1===A.indexOf("updatemenus"))&&(v.docalc=!0)}else!r(K,"x")&&!r(K,"y")||_.containsAny(A,["color","opacity","align","dash","updatemenus"])||(v.docalc=!0);h[a]||(h[a]={});var et=h[a][o];et||(et=h[a][o]={}),et[J]=S,delete e[A]}else if("reverse"===C)j.range?j.range.reverse():(n(R+".autorange",!0),j.range=[1,0]),B.autorange?v.docalc=!0:v.doplot=!0;else{var nt=String(T.parts[1]||"");0===L.indexOf("scene")?"camera"===T.parts[1]?v.docamera=!0:v.doplot=!0:0===L.indexOf("geo")?v.doplot=!0:0===L.indexOf("ternary")?v.doplot=!0:"paper_bgcolor"===A?v.doplot=!0:"margin"===L||"autorange"===nt||"rangemode"===nt||"type"===nt||"domain"===nt||"fixedrange"===nt||"scaleanchor"===nt||"scaleratio"===nt||-1!==A.indexOf("calendar")||A.match(/^(bar|box|font)/)?v.docalc=!0:!u._has("gl2d")||-1===A.indexOf("axis")&&"plot_bgcolor"!==A?!u._has("gl2d")||"dragmode"!==A||"lasso"!==S&&"select"!==S||"lasso"===V||"select"===V?"hiddenlabels"===A?v.docalc=!0:-1!==L.indexOf("legend")?v.dolegend=!0:-1!==A.indexOf("title")?v.doticks=!0:-1!==L.indexOf("bgcolor")?v.dolayoutstyle=!0:z>1&&_.containsAny(nt,["tick","exponent","grid","zeroline"])?v.doticks=!0:-1!==A.indexOf(".linewidth")&&-1!==A.indexOf("axis")?v.doticks=v.dolayoutstyle=!0:z>1&&-1!==nt.indexOf("line")?v.dolayoutstyle=!0:z>1&&"mirror"===nt?v.doticks=v.dolayoutstyle=!0:"margin.pad"===A?v.doticks=v.dolayoutstyle=!0:-1!==["hovermode","dragmode"].indexOf(A)||-1!==A.indexOf("spike")?v.domodebar=!0:-1===["height","width","autosize"].indexOf(A)&&(v.doplot=!0):v.docalc=!0:v.doplot=!0,T.set(S)}}}for(a in h){I.applyContainerArrayChanges(t,_.nestedProperty(l,a),h[a],v)||(v.doplot=!0)}var rt=u._axisConstraintGroups;for(g in w)for(o=0;o=s.length?s[0]:s[t]:s}function i(t){return Array.isArray(l)?t>=l.length?l[0]:l[t]:l}function a(t,e){var n=0;return function(){if(t&&++n===e)return t()}}if(t=D.getGraphDiv(t),!_.isPlotDiv(t))throw new Error("This element is not a Plotly plot: "+t+". It's likely that you've failed to create a plot before animating it. For more details, see https://plot.ly/javascript/animations/");var o=t._transitionData;o._frameQueue||(o._frameQueue=[]),n=k.supplyAnimationDefaults(n);var s=n.transition,l=n.frame;return void 0===o._frameWaitingCnt&&(o._frameWaitingCnt=0),new Promise(function(l,u){function c(){t.emit("plotly_animated"),window.cancelAnimationFrame(o._animationRaf),o._animationRaf=null}function f(){o._currentFrame&&o._currentFrame.onComplete&&o._currentFrame.onComplete();var e=o._currentFrame=o._frameQueue.shift();if(e){var n=e.name?e.name.toString():null;t._fullLayout._currentFrame=n,o._lastFrameAt=Date.now(),o._timeToNext=e.frameOpts.duration,k.transition(t,e.frame.data,e.frame.layout,D.coerceTraceIndices(t,e.frame.traces),e.frameOpts,e.transitionOpts).then(function(){e.onComplete&&e.onComplete()}),t.emit("plotly_animatingframe",{name:n,frame:e.frame,animation:{frame:e.frameOpts,transition:e.transitionOpts}})}else c()}function h(){t.emit("plotly_animating"),o._lastFrameAt=-1/0,o._timeToNext=0,o._runningTransitions=0,o._currentFrame=null;var e=function(){o._animationRaf=window.requestAnimationFrame(e),Date.now()-o._lastFrameAt>o._timeToNext&&f()};e()}function d(t){return Array.isArray(s)?g>=s.length?t.transitionOpts=s[g]:t.transitionOpts=s[0]:t.transitionOpts=s,g++,t}var p,m,g=0,v=[],y=void 0===e||null===e,x=Array.isArray(e);if(y||x||!_.isPlainObject(e)){if(y||-1!==["string","number"].indexOf(typeof e))for(p=0;p0&&MM)&&A.push(m);v=A}}v.length>0?function(e){if(0!==e.length){for(var s=0;s=0;i--)if(_.isPlainObject(e[i])){var h=(u[e[i].name]||{}).name,d=e[i].name;h&&d&&"number"==typeof d&&u[h]&&(r++,_.warn('addFrames: overwriting frame "'+u[h].name+'" with a frame whose name of type "number" also equates to "'+h+'". This is valid but may potentially lead to unexpected behavior since all plotly.js frame names are stored internally as strings.'),r>5&&_.warn("addFrames: This API call has yielded too many warnings. For the rest of this call, further warnings about numeric frame names will be suppressed.")),f.push({frame:k.supplyFrameDefaults(e[i]),index:n&&void 0!==n[i]&&null!==n[i]?n[i]:c+i})}f.sort(function(t,e){return t.index>e.index?-1:t.index=0;i--){if(a=f[i].frame,"number"==typeof a.name&&_.warn("Warning: addFrames accepts frames with numeric names, but the numbers areimplicitly cast to strings"),!a.name)for(;u[a.name="frame "+t._transitionData._counter++];);if(u[a.name]){for(o=0;o=0;n--)r=e[n],a.push({type:"delete",index:r}),o.unshift({type:"insert",index:r,value:i[r]});var s=k.modifyFrames,l=k.modifyFrames,u=[t,o],c=[t,a];return w&&w.add(t,s,u,l,c),k.modifyFrames(t,a)},x.purge=function(t){t=D.getGraphDiv(t);var e=t._fullLayout||{},n=t._fullData||[];return k.cleanPlot([],{},n,e),k.purge(t),b.purge(t),e._container&&e._container.remove(),delete t._context,delete t._replotPending,delete t._mouseDownTime,delete t._legendMouseDownTime,delete t._hmpixcount,delete t._hmlumcount,t}},{"../components/drawing":258,"../components/errorbars":264,"../constants/xmlns_namespaces":334,"../lib":348,"../lib/events":341,"../lib/queue":360,"../lib/svg_text_utils":365,"../plotly":379,"../plots/cartesian/axis_ids":387,"../plots/cartesian/constants":389,"../plots/cartesian/constraints":391,"../plots/cartesian/graph_interact":393,"../plots/plots":420,"../plots/polar":423,"../registry":428,"./edit_types":368,"./helpers":369,"./manage_arrays":370,"./subroutines":376,d3:8,"fast-isnumeric":12,"has-hover":36}],372:[function(t,e,n){"use strict";function r(t,n){try{t._fullLayout._paper.style("background",n)}catch(t){e.exports.logging>0&&console.error(t)}}e.exports={staticPlot:!1,editable:!1,edits:{annotationPosition:!1,annotationTail:!1,annotationText:!1,axisTitleText:!1,colorbarPosition:!1,colorbarTitleText:!1,legendPosition:!1,legendText:!1,shapePosition:!1,titleText:!1},autosizable:!1,queueLength:0,fillFrame:!1,frameMargins:0,scrollZoom:!1,doubleClick:"reset+autosize",showTips:!0,showAxisDragHandles:!0,showAxisRangeEntryBoxes:!0,showLink:!1,sendData:!0,linkText:"Edit chart",showSources:!1,displayModeBar:"hover",modeBarButtonsToRemove:[],modeBarButtonsToAdd:[],modeBarButtons:!1,displaylogo:!0,plotGlPixelRatio:2,setBackground:r,topojsonURL:"https://cdn.plot.ly/",mapboxAccessToken:null,logging:!1,globalTransforms:[]}},{}],373:[function(t,e,n){"use strict";function r(t){var e,n;"area"===t?(e={attributes:x},n={}):(e=d.modules[t]._module,n=e.basePlotModule);var r={};r.type=null,M(r,m),M(r,e.attributes),n.attributes&&M(r,n.attributes),Object.keys(d.componentsRegistry).forEach(function(e){var n=d.componentsRegistry[e];n.schema&&n.schema.traces&&n.schema.traces[t]&&Object.keys(n.schema.traces[t]).forEach(function(e){h(r,n.schema.traces[t][e],e)})}),r.type=t;var i={meta:e.meta||{},attributes:s(r)};if(e.layoutAttributes){var a={};M(a,e.layoutAttributes),i.layoutAttributes=s(a)}return i}function i(){var t={};return M(t,g),Object.keys(d.subplotsRegistry).forEach(function(e){var n=d.subplotsRegistry[e];if(n.layoutAttributes)if("cartesian"===n.name)f(t,n,"xaxis"),f(t,n,"yaxis");else{var r="subplot"===n.attr?n.name:n.attr;f(t,n,r)}}),t=c(t),Object.keys(d.componentsRegistry).forEach(function(e){var n=d.componentsRegistry[e];n.layoutAttributes&&(n.schema&&n.schema.layout?Object.keys(n.schema.layout).forEach(function(e){h(t,n.schema.layout[e],e)}):h(t,n.layoutAttributes,n.name))}),{layoutAttributes:s(t)}}function a(t){var e=d.transformsRegistry[t],n=M({},e.attributes);return Object.keys(d.componentsRegistry).forEach(function(e){var r=d.componentsRegistry[e];r.schema&&r.schema.transforms&&r.schema.transforms[t]&&Object.keys(r.schema.transforms[t]).forEach(function(e){h(n,r.schema.transforms[t][e],e)})}),{attributes:s(n)}}function o(){var t={frames:p.extendDeep({},v)};return s(t),t.frames}function s(t){return l(t),u(t),t}function l(t){function e(t){return{valType:"string"}}function r(t,r,i){n.isValObject(t)?"data_array"===t.valType?(t.role="data",i[r+"src"]=e(r)):!0===t.arrayOk&&(i[r+"src"]=e(r)):p.isPlainObject(t)&&(t.role="object")}n.crawl(t,r)}function u(t){function e(t,e,n){if(t){var r=t[A];r&&(delete t[A],n[e]={items:{}},n[e].items[r]=t,n[e].role="object")}}n.crawl(t,e)}function c(t){return w(t,{radialaxis:_.radialaxis,angularaxis:_.angularaxis}),w(t,_.layout),t}function f(t,e,n){var r=p.nestedProperty(t,n),i=M({},e.layoutAttributes);i[k]=!0,r.set(i)}function h(t,e,n){var r=p.nestedProperty(t,n);r.set(M(r.get()||{},e))}var d=t("../registry"),p=t("../lib"),m=t("../plots/attributes"),g=t("../plots/layout_attributes"),v=t("../plots/frame_attributes"),y=t("../plots/animation_attributes"),x=t("../plots/polar/area_attributes"),_=t("../plots/polar/axis_attributes"),b=t("./edit_types"),w=p.extendFlat,M=p.extendDeep,k="_isSubplotObj",A="_isLinkedToArray",T=[k,A,"_arrayAttrRegexps","_deprecated"];n.IS_SUBPLOT_OBJ=k,n.IS_LINKED_TO_ARRAY=A,n.DEPRECATED="_deprecated",n.UNDERSCORE_ATTRS=T,n.get=function(){var t={};d.allTypes.concat("area").forEach(function(e){t[e]=r(e)});var e={};return Object.keys(d.transformsRegistry).forEach(function(t){e[t]=a(t)}),{defs:{valObjects:p.valObjects,metaKeys:T.concat(["description","role"]),editTypes:{traces:b.traces(),layout:b.layout()}},traces:t,layout:i(),transforms:e,frames:o(),animation:s(y)}},n.crawl=function(t,e,r){var i=r||0;Object.keys(t).forEach(function(r){var a=t[r];-1===T.indexOf(r)&&(e(a,r,t,i),n.isValObject(a)||p.isPlainObject(a)&&n.crawl(a,e,i+1))})},n.isValObject=function(t){return t&&void 0!==t.valType},n.findArrayAttributes=function(t){function e(e,n,o,s){if(a=a.slice(0,s).concat([n]),e&&("data_array"===e.valType||!0===e.arrayOk)&&!("colorbar"===a[s-1]&&("ticktext"===n||"tickvals"===n))){var l=r(a),u=p.nestedProperty(t,l).get();Array.isArray(u)&&i.push(l)}}function r(t){return t.join(".")}var i=[],a=[];if(n.crawl(m,e),t._module&&t._module.attributes&&n.crawl(t._module.attributes,e),t.transforms)for(var o=t.transforms,s=0;s=t[1]||i[1]<=t[0])&&(a[0]e[0]))return!0}return!1}function i(t,e,n){return t._anchorAxis===e&&(t.mirror||t.side===n)||"all"===t.mirror||"allticks"===t.mirror||t.mirrors&&t.mirrors[e._id+n]}function a(t,e,n){var r=[],i=e._anchorAxis;if(i){var a=i._mainAxis;if(-1===r.indexOf(a)){r.push(a);for(var o=0;o=0){var o=n.indexOf("\n",a+1);n=n.substring(o+1)}this.stack=n}}},x.inherits(k.AssertionError,Error),k.fail=h,k.ok=f,k.equal=function(t,e,r){t!=e&&h(t,e,r,"==",k.equal)},k.notEqual=function(t,e,r){t==e&&h(t,e,r,"!=",k.notEqual)},k.deepEqual=function(t,e,r){d(t,e,!1)||h(t,e,r,"deepEqual",k.deepEqual)},k.deepStrictEqual=function(t,e,r){d(t,e,!0)||h(t,e,r,"deepStrictEqual",k.deepStrictEqual)},k.notDeepEqual=function(t,e,r){d(t,e,!1)&&h(t,e,r,"notDeepEqual",k.notDeepEqual)},k.notDeepStrictEqual=v,k.strictEqual=function(t,e,r){t!==e&&h(t,e,r,"===",k.strictEqual)},k.notStrictEqual=function(t,e,r){t===e&&h(t,e,r,"!==",k.notStrictEqual)},k.throws=function(t,e,r){b(!0,t,e,r)},k.doesNotThrow=function(t,e,r){b(!1,t,e,r)},k.ifError=function(t){if(t)throw t};var T=Object.keys||function(t){var e=[];for(var r in t)_.call(t,r)&&e.push(r);return e}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"util/":547}],46:[function(t,e,r){e.exports=function(t){return atob(t)}},{}],47:[function(t,e,r){"use strict";function n(t){for(var e=0,r=0;r0?r=r.ushln(h):h<0&&(c=c.ushln(-h)),l(r,c)}var i=t("./is-rat"),a=t("./lib/is-bn"),o=t("./lib/num-to-bn"),s=t("./lib/str-to-bn"),l=t("./lib/rationalize"),u=t("./div");e.exports=n},{"./div":50,"./is-rat":52,"./lib/is-bn":56,"./lib/num-to-bn":57,"./lib/rationalize":58,"./lib/str-to-bn":59}],52:[function(t,e,r){"use strict";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":56}],53:[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":66}],54:[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 a=0;a20?52:r+32}var i=t("double-bits"),a=t("bit-twiddle").countTrailingZeros;e.exports=n},{"bit-twiddle":65,"double-bits":122}],56:[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":66}],57:[function(t,e,r){"use strict";function n(t){var e=a.exponent(t);return e<52?new i(t):new i(t*Math.pow(2,52-e)).ushln(e-52)}var i=t("bn.js"),a=t("double-bits");e.exports=n},{"bn.js":66,"double-bits":122}],58:[function(t,e,r){"use strict";function n(t,e){var r=a(t),n=a(e);if(0===r)return[i(0),i(1)];if(0===n)return[i(0),i(0)];n<0&&(t=t.neg(),e=e.neg());var o=t.gcd(e);return o.cmpn(1)?[t.div(o),e.div(o)]:[t,e]}var i=t("./num-to-bn"),a=t("./bn-sign");e.exports=n},{"./bn-sign":53,"./num-to-bn":57}],59:[function(t,e,r){"use strict";function n(t){return new i(t)}var i=t("bn.js");e.exports=n},{"bn.js":66}],60:[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":58}],61:[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":53}],62:[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":58}],63:[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.abs().divmod(r.abs()),o=n.div,s=i(o),l=n.mod,u=e.negative!==r.negative?-1:1;if(0===l.cmpn(0))return u*s;if(s){var c=a(s)+4,h=i(l.ushln(c).divRound(r));return u*(s+h*Math.pow(2,-c))}var f=r.bitLength()-l.bitLength()+53,h=i(l.ushln(f).divRound(r));return f<1023?u*h*Math.pow(2,-f):(h*=Math.pow(2,-1023),u*h*Math.pow(2,1023-f))}var i=t("./lib/bn-to-num"),a=t("./lib/ctz");e.exports=n},{"./lib/bn-to-num":54,"./lib/ctz":55}],64:[function(t,e,r){"use strict";function n(t,e,r,n,i,a){var o=["function ",t,"(a,l,h,",n.join(","),"){",a?"":"var i=",r?"l-1":"h+1",";while(l<=h){var m=(l+h)>>>1,x=a",i?".get(m)":"[m]"];return a?e.indexOf("c")<0?o.push(";if(x===y){return m}else if(x<=y){"):o.push(";var p=c(x,y);if(p===0){return m}else if(p<=0){"):o.push(";if(",e,"){i=m;"),r?o.push("l=m+1}else{h=m-1}"):o.push("h=m-1}else{l=m+1}"),o.push("}"),a?o.push("return -1};"):o.push("return i};"),o.join("")}function i(t,e,r,i){return new Function([n("A","x"+t+"y",e,["y"],!1,i),n("B","x"+t+"y",e,["y"],!0,i),n("P","c(x,y)"+t+"0",e,["y","c"],!1,i),n("Q","c(x,y)"+t+"0",e,["y","c"],!0,i),"function dispatchBsearch",r,"(a,y,c,l,h){if(a.shape){if(typeof(c)==='function'){return Q(a,(l===undefined)?0:l|0,(h===undefined)?a.shape[0]-1:h|0,y,c)}else{return B(a,(c===undefined)?0:c|0,(l===undefined)?a.shape[0]-1:l|0,y)}}else{if(typeof(c)==='function'){return P(a,(l===undefined)?0:l|0,(h===undefined)?a.length-1:h|0,y,c)}else{return A(a,(c===undefined)?0:c|0,(l===undefined)?a.length-1:l|0,y)}}}return dispatchBsearch",r].join(""))()}e.exports={ge:i(">=",!1,"GE"),gt:i(">",!1,"GT"),lt:i("<",!0,"LT"),le:i("<=",!0,"LE"),eq:i("-",!0,"EQ",!0)}},{}],65:[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}r.INT_BITS=32,r.INT_MAX=2147483647,r.INT_MIN=-1<<31,r.sign=function(t){return(t>0)-(t<0)},r.abs=function(t){var e=t>>31;return(t^e)-e},r.min=function(t,e){return e^(t^e)&-(t65535)<<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)|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,16843009*((t=(858993459&t)+(t>>>2&858993459))+(t>>>4)&252645135)>>>24},r.countTrailingZeros=n,r.nextPow2=function(t){return t+=0===t,--t,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,(t|=t>>>16)+1},r.prevPow2=function(t){return t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,(t|=t>>>16)-(t>>>1)},r.parity=function(t){return t^=t>>>16,t^=t>>>8,t^=t>>>4,27030>>>(t&=15)&1};var i=new Array(256);!function(t){for(var e=0;e<256;++e){var r=e,n=e,i=7;for(r>>>=1;r;r>>>=1)n<<=1,n|=1&r,--i;t[e]=n<>>8&255]<<16|i[t>>>16&255]<<8|i[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))<<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))<<22>>22},r.nextCombination=function(t){var e=t|t-1;return e+1|(~e&-~e)-1>>>n(t)+1}},{}],66:[function(t,e,r){!function(e,r){"use strict";function n(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function a(t,e,r){if(a.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}function o(t,e,r){for(var n=0,i=Math.min(t.length,r),a=e;a=49&&o<=54?o-49+10:o>=17&&o<=22?o-17+10:15&o}return n}function s(t,e,r,n){for(var i=0,a=Math.min(t.length,r),o=e;o=49?s-49+10:s>=17?s-17+10:s}return i}function l(t){for(var e=new Array(t.bitLength()),r=0;r>>i}return e}function u(t,e,r){r.negative=e.negative^t.negative;var n=t.length+e.length|0;r.length=n,n=n-1|0;var i=0|t.words[0],a=0|e.words[0],o=i*a,s=67108863&o,l=o/67108864|0;r.words[0]=s;for(var u=1;u>>26,h=67108863&l,f=Math.min(u,e.length-1),d=Math.max(0,u-t.length+1);d<=f;d++){var p=u-d|0;i=0|t.words[p],a=0|e.words[d],o=i*a+h,c+=o/67108864|0,h=67108863&o}r.words[u]=0|h,l=0|c}return 0!==l?r.words[u]=0|l:r.length--,r.strip()}function c(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var n=0,i=0,a=0;a>>26)|0,i+=o>>>26,o&=67108863}r.words[a]=s,n=o,o=i}return 0!==n?r.words[a]=n:r.length--,r.strip()}function h(t,e,r){return(new f).mulp(t,e,r)}function f(t,e){this.x=t,this.y=e}function d(t,e){this.name=t,this.p=new a(e,16),this.n=this.p.bitLength(),this.k=new a(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function p(){d.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function m(){d.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function v(){d.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function g(){d.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function y(t){if("string"==typeof t){var e=a._prime(t);this.m=e.p,this.prime=e}else n(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function b(t){y.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new a(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}"object"==typeof e?e.exports=a:r.BN=a,a.BN=a,a.wordSize=26;var x;try{x=t("buffer").Buffer}catch(t){}a.isBN=function(t){return t instanceof a||null!==t&&"object"==typeof t&&t.constructor.wordSize===a.wordSize&&Array.isArray(t.words)},a.max=function(t,e){return t.cmp(e)>0?t:e},a.min=function(t,e){return t.cmp(e)<0?t:e},a.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),n(e===(0|e)&&e>=2&&e<=36),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.negative=1),this.strip(),"le"===r&&this._initArray(this.toArray(),e,r)},a.prototype._initNumber=function(t,e,r){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(n(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),e,r)},a.prototype._initArray=function(t,e,r){if(n("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var i=0;i=0;i-=3)o=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[a]|=o<>>26-s&67108863,(s+=24)>=26&&(s-=26,a++);else if("le"===r)for(i=0,a=0;i>>26-s&67108863,(s+=24)>=26&&(s-=26,a++);return this.strip()},a.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)i=o(t,r,r+6),this.words[n]|=i<>>26-a&4194303,(a+=24)>=26&&(a-=26,n++);r+6!==e&&(i=o(t,e,r+6),this.words[n]|=i<>>26-a&4194303),this.strip()},a.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=e)n++;n--,i=i/e|0;for(var a=t.length-r,o=a%n,l=Math.min(a,a-o)+r,u=0,c=r;c1&&0===this.words[this.length-1];)this.length--;return this._normSign()},a.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},a.prototype.inspect=function(){return(this.red?""};var _=["","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"],w=[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];a.prototype.toString=function(t,e){t=t||10,e=0|e||1;var r;if(16===t||"hex"===t){r="";for(var i=0,a=0,o=0;o>>24-i&16777215,r=0!==a||o!==this.length-1?_[6-l.length]+l+r:l+r,i+=2,i>=26&&(i-=26,o--)}for(0!==a&&(r=a.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var u=w[t],c=M[t];r="";var h=this.clone();for(h.negative=0;!h.isZero();){var f=h.modn(c).toString(t);h=h.idivn(c),r=h.isZero()?f+r:_[u-f.length]+f+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},a.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},a.prototype.toJSON=function(){return this.toString(16)},a.prototype.toBuffer=function(t,e){return n(void 0!==x),this.toArrayLike(x,t,e)},a.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},a.prototype.toArrayLike=function(t,e,r){var i=this.byteLength(),a=r||Math.max(1,i);n(i<=a,"byte array longer than desired length"),n(a>0,"Requested array length <= 0"),this.strip();var o,s,l="le"===e,u=new t(a),c=this.clone();if(l){for(s=0;!c.isZero();s++)o=c.andln(255),c.iushrn(8),u[s]=o;for(;s=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},a.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},a.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},a.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},a.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},a.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},a.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},a.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;nt.length?this.clone().ixor(t):t.clone().ixor(this)},a.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},a.prototype.inotn=function(t){n("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-r),this.strip()},a.prototype.notn=function(t){return this.clone().inotn(t)},a.prototype.setn=function(t,e){n("number"==typeof t&&t>=0);var r=t/26|0,i=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(r=this,n=t):(r=t,n=this);for(var i=0,a=0;a>>26;for(;0!==i&&a>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;at.length?this.clone().iadd(t):t.clone().iadd(this)},a.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r=this.cmp(t);if(0===r)return this.negative=0,this.length=1,this.words[0]=0,this;var n,i;r>0?(n=this,i=t):(n=t,i=this);for(var a=0,o=0;o>26,this.words[o]=67108863&e;for(;0!==a&&o>26,this.words[o]=67108863&e;if(0===a&&o>>13,d=0|o[1],p=8191&d,m=d>>>13,v=0|o[2],g=8191&v,y=v>>>13,b=0|o[3],x=8191&b,_=b>>>13,w=0|o[4],M=8191&w,k=w>>>13,A=0|o[5],T=8191&A,S=A>>>13,E=0|o[6],L=8191&E,C=E>>>13,z=0|o[7],I=8191&z,D=z>>>13,P=0|o[8],O=8191&P,R=P>>>13,F=0|o[9],j=8191&F,N=F>>>13,B=0|s[0],U=8191&B,V=B>>>13,H=0|s[1],q=8191&H,G=H>>>13,Y=0|s[2],X=8191&Y,W=Y>>>13,Z=0|s[3],J=8191&Z,K=Z>>>13,Q=0|s[4],$=8191&Q,tt=Q>>>13,et=0|s[5],rt=8191&et,nt=et>>>13,it=0|s[6],at=8191&it,ot=it>>>13,st=0|s[7],lt=8191&st,ut=st>>>13,ct=0|s[8],ht=8191&ct,ft=ct>>>13,dt=0|s[9],pt=8191&dt,mt=dt>>>13;r.negative=t.negative^e.negative,r.length=19,n=Math.imul(h,U),i=Math.imul(h,V),i=i+Math.imul(f,U)|0,a=Math.imul(f,V);var vt=(u+n|0)+((8191&i)<<13)|0;u=(a+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(p,U),i=Math.imul(p,V),i=i+Math.imul(m,U)|0,a=Math.imul(m,V),n=n+Math.imul(h,q)|0,i=i+Math.imul(h,G)|0,i=i+Math.imul(f,q)|0,a=a+Math.imul(f,G)|0;var gt=(u+n|0)+((8191&i)<<13)|0;u=(a+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,n=Math.imul(g,U),i=Math.imul(g,V),i=i+Math.imul(y,U)|0,a=Math.imul(y,V),n=n+Math.imul(p,q)|0,i=i+Math.imul(p,G)|0,i=i+Math.imul(m,q)|0,a=a+Math.imul(m,G)|0,n=n+Math.imul(h,X)|0,i=i+Math.imul(h,W)|0,i=i+Math.imul(f,X)|0,a=a+Math.imul(f,W)|0;var yt=(u+n|0)+((8191&i)<<13)|0;u=(a+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(x,U),i=Math.imul(x,V),i=i+Math.imul(_,U)|0,a=Math.imul(_,V),n=n+Math.imul(g,q)|0,i=i+Math.imul(g,G)|0,i=i+Math.imul(y,q)|0,a=a+Math.imul(y,G)|0,n=n+Math.imul(p,X)|0,i=i+Math.imul(p,W)|0,i=i+Math.imul(m,X)|0,a=a+Math.imul(m,W)|0,n=n+Math.imul(h,J)|0,i=i+Math.imul(h,K)|0,i=i+Math.imul(f,J)|0,a=a+Math.imul(f,K)|0;var bt=(u+n|0)+((8191&i)<<13)|0;u=(a+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(M,U),i=Math.imul(M,V),i=i+Math.imul(k,U)|0,a=Math.imul(k,V),n=n+Math.imul(x,q)|0,i=i+Math.imul(x,G)|0,i=i+Math.imul(_,q)|0,a=a+Math.imul(_,G)|0,n=n+Math.imul(g,X)|0,i=i+Math.imul(g,W)|0,i=i+Math.imul(y,X)|0,a=a+Math.imul(y,W)|0,n=n+Math.imul(p,J)|0,i=i+Math.imul(p,K)|0,i=i+Math.imul(m,J)|0,a=a+Math.imul(m,K)|0,n=n+Math.imul(h,$)|0,i=i+Math.imul(h,tt)|0,i=i+Math.imul(f,$)|0,a=a+Math.imul(f,tt)|0;var xt=(u+n|0)+((8191&i)<<13)|0;u=(a+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(T,U),i=Math.imul(T,V),i=i+Math.imul(S,U)|0,a=Math.imul(S,V),n=n+Math.imul(M,q)|0,i=i+Math.imul(M,G)|0,i=i+Math.imul(k,q)|0,a=a+Math.imul(k,G)|0,n=n+Math.imul(x,X)|0,i=i+Math.imul(x,W)|0,i=i+Math.imul(_,X)|0,a=a+Math.imul(_,W)|0,n=n+Math.imul(g,J)|0,i=i+Math.imul(g,K)|0,i=i+Math.imul(y,J)|0,a=a+Math.imul(y,K)|0,n=n+Math.imul(p,$)|0,i=i+Math.imul(p,tt)|0,i=i+Math.imul(m,$)|0,a=a+Math.imul(m,tt)|0,n=n+Math.imul(h,rt)|0,i=i+Math.imul(h,nt)|0,i=i+Math.imul(f,rt)|0,a=a+Math.imul(f,nt)|0;var _t=(u+n|0)+((8191&i)<<13)|0;u=(a+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(L,U),i=Math.imul(L,V),i=i+Math.imul(C,U)|0,a=Math.imul(C,V),n=n+Math.imul(T,q)|0,i=i+Math.imul(T,G)|0,i=i+Math.imul(S,q)|0,a=a+Math.imul(S,G)|0,n=n+Math.imul(M,X)|0,i=i+Math.imul(M,W)|0,i=i+Math.imul(k,X)|0,a=a+Math.imul(k,W)|0,n=n+Math.imul(x,J)|0,i=i+Math.imul(x,K)|0,i=i+Math.imul(_,J)|0,a=a+Math.imul(_,K)|0,n=n+Math.imul(g,$)|0,i=i+Math.imul(g,tt)|0,i=i+Math.imul(y,$)|0,a=a+Math.imul(y,tt)|0,n=n+Math.imul(p,rt)|0,i=i+Math.imul(p,nt)|0,i=i+Math.imul(m,rt)|0,a=a+Math.imul(m,nt)|0,n=n+Math.imul(h,at)|0,i=i+Math.imul(h,ot)|0,i=i+Math.imul(f,at)|0,a=a+Math.imul(f,ot)|0;var wt=(u+n|0)+((8191&i)<<13)|0;u=(a+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(I,U),i=Math.imul(I,V),i=i+Math.imul(D,U)|0,a=Math.imul(D,V),n=n+Math.imul(L,q)|0,i=i+Math.imul(L,G)|0,i=i+Math.imul(C,q)|0,a=a+Math.imul(C,G)|0,n=n+Math.imul(T,X)|0,i=i+Math.imul(T,W)|0,i=i+Math.imul(S,X)|0,a=a+Math.imul(S,W)|0,n=n+Math.imul(M,J)|0,i=i+Math.imul(M,K)|0,i=i+Math.imul(k,J)|0,a=a+Math.imul(k,K)|0,n=n+Math.imul(x,$)|0,i=i+Math.imul(x,tt)|0,i=i+Math.imul(_,$)|0,a=a+Math.imul(_,tt)|0,n=n+Math.imul(g,rt)|0,i=i+Math.imul(g,nt)|0,i=i+Math.imul(y,rt)|0,a=a+Math.imul(y,nt)|0,n=n+Math.imul(p,at)|0,i=i+Math.imul(p,ot)|0,i=i+Math.imul(m,at)|0,a=a+Math.imul(m,ot)|0,n=n+Math.imul(h,lt)|0,i=i+Math.imul(h,ut)|0,i=i+Math.imul(f,lt)|0,a=a+Math.imul(f,ut)|0;var Mt=(u+n|0)+((8191&i)<<13)|0;u=(a+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(O,U),i=Math.imul(O,V),i=i+Math.imul(R,U)|0,a=Math.imul(R,V),n=n+Math.imul(I,q)|0,i=i+Math.imul(I,G)|0,i=i+Math.imul(D,q)|0,a=a+Math.imul(D,G)|0,n=n+Math.imul(L,X)|0,i=i+Math.imul(L,W)|0,i=i+Math.imul(C,X)|0,a=a+Math.imul(C,W)|0,n=n+Math.imul(T,J)|0,i=i+Math.imul(T,K)|0,i=i+Math.imul(S,J)|0,a=a+Math.imul(S,K)|0,n=n+Math.imul(M,$)|0,i=i+Math.imul(M,tt)|0,i=i+Math.imul(k,$)|0,a=a+Math.imul(k,tt)|0,n=n+Math.imul(x,rt)|0,i=i+Math.imul(x,nt)|0,i=i+Math.imul(_,rt)|0,a=a+Math.imul(_,nt)|0,n=n+Math.imul(g,at)|0,i=i+Math.imul(g,ot)|0,i=i+Math.imul(y,at)|0,a=a+Math.imul(y,ot)|0,n=n+Math.imul(p,lt)|0,i=i+Math.imul(p,ut)|0,i=i+Math.imul(m,lt)|0,a=a+Math.imul(m,ut)|0,n=n+Math.imul(h,ht)|0,i=i+Math.imul(h,ft)|0,i=i+Math.imul(f,ht)|0,a=a+Math.imul(f,ft)|0;var kt=(u+n|0)+((8191&i)<<13)|0;u=(a+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(j,U),i=Math.imul(j,V),i=i+Math.imul(N,U)|0,a=Math.imul(N,V),n=n+Math.imul(O,q)|0,i=i+Math.imul(O,G)|0,i=i+Math.imul(R,q)|0,a=a+Math.imul(R,G)|0,n=n+Math.imul(I,X)|0,i=i+Math.imul(I,W)|0,i=i+Math.imul(D,X)|0,a=a+Math.imul(D,W)|0,n=n+Math.imul(L,J)|0,i=i+Math.imul(L,K)|0,i=i+Math.imul(C,J)|0,a=a+Math.imul(C,K)|0,n=n+Math.imul(T,$)|0,i=i+Math.imul(T,tt)|0,i=i+Math.imul(S,$)|0,a=a+Math.imul(S,tt)|0,n=n+Math.imul(M,rt)|0,i=i+Math.imul(M,nt)|0,i=i+Math.imul(k,rt)|0,a=a+Math.imul(k,nt)|0,n=n+Math.imul(x,at)|0,i=i+Math.imul(x,ot)|0,i=i+Math.imul(_,at)|0,a=a+Math.imul(_,ot)|0,n=n+Math.imul(g,lt)|0,i=i+Math.imul(g,ut)|0,i=i+Math.imul(y,lt)|0,a=a+Math.imul(y,ut)|0,n=n+Math.imul(p,ht)|0,i=i+Math.imul(p,ft)|0,i=i+Math.imul(m,ht)|0,a=a+Math.imul(m,ft)|0,n=n+Math.imul(h,pt)|0,i=i+Math.imul(h,mt)|0,i=i+Math.imul(f,pt)|0,a=a+Math.imul(f,mt)|0;var At=(u+n|0)+((8191&i)<<13)|0;u=(a+(i>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(j,q),i=Math.imul(j,G),i=i+Math.imul(N,q)|0,a=Math.imul(N,G),n=n+Math.imul(O,X)|0,i=i+Math.imul(O,W)|0,i=i+Math.imul(R,X)|0,a=a+Math.imul(R,W)|0,n=n+Math.imul(I,J)|0,i=i+Math.imul(I,K)|0,i=i+Math.imul(D,J)|0,a=a+Math.imul(D,K)|0,n=n+Math.imul(L,$)|0,i=i+Math.imul(L,tt)|0,i=i+Math.imul(C,$)|0,a=a+Math.imul(C,tt)|0,n=n+Math.imul(T,rt)|0,i=i+Math.imul(T,nt)|0,i=i+Math.imul(S,rt)|0,a=a+Math.imul(S,nt)|0,n=n+Math.imul(M,at)|0,i=i+Math.imul(M,ot)|0,i=i+Math.imul(k,at)|0,a=a+Math.imul(k,ot)|0,n=n+Math.imul(x,lt)|0,i=i+Math.imul(x,ut)|0,i=i+Math.imul(_,lt)|0,a=a+Math.imul(_,ut)|0,n=n+Math.imul(g,ht)|0,i=i+Math.imul(g,ft)|0,i=i+Math.imul(y,ht)|0,a=a+Math.imul(y,ft)|0,n=n+Math.imul(p,pt)|0,i=i+Math.imul(p,mt)|0,i=i+Math.imul(m,pt)|0,a=a+Math.imul(m,mt)|0;var Tt=(u+n|0)+((8191&i)<<13)|0;u=(a+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(j,X),i=Math.imul(j,W),i=i+Math.imul(N,X)|0,a=Math.imul(N,W),n=n+Math.imul(O,J)|0,i=i+Math.imul(O,K)|0,i=i+Math.imul(R,J)|0,a=a+Math.imul(R,K)|0,n=n+Math.imul(I,$)|0,i=i+Math.imul(I,tt)|0,i=i+Math.imul(D,$)|0,a=a+Math.imul(D,tt)|0,n=n+Math.imul(L,rt)|0,i=i+Math.imul(L,nt)|0,i=i+Math.imul(C,rt)|0,a=a+Math.imul(C,nt)|0,n=n+Math.imul(T,at)|0,i=i+Math.imul(T,ot)|0,i=i+Math.imul(S,at)|0,a=a+Math.imul(S,ot)|0,n=n+Math.imul(M,lt)|0,i=i+Math.imul(M,ut)|0,i=i+Math.imul(k,lt)|0,a=a+Math.imul(k,ut)|0,n=n+Math.imul(x,ht)|0,i=i+Math.imul(x,ft)|0,i=i+Math.imul(_,ht)|0,a=a+Math.imul(_,ft)|0,n=n+Math.imul(g,pt)|0,i=i+Math.imul(g,mt)|0,i=i+Math.imul(y,pt)|0,a=a+Math.imul(y,mt)|0;var St=(u+n|0)+((8191&i)<<13)|0;u=(a+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(j,J),i=Math.imul(j,K),i=i+Math.imul(N,J)|0,a=Math.imul(N,K),n=n+Math.imul(O,$)|0,i=i+Math.imul(O,tt)|0,i=i+Math.imul(R,$)|0,a=a+Math.imul(R,tt)|0,n=n+Math.imul(I,rt)|0,i=i+Math.imul(I,nt)|0,i=i+Math.imul(D,rt)|0,a=a+Math.imul(D,nt)|0,n=n+Math.imul(L,at)|0,i=i+Math.imul(L,ot)|0,i=i+Math.imul(C,at)|0,a=a+Math.imul(C,ot)|0,n=n+Math.imul(T,lt)|0,i=i+Math.imul(T,ut)|0,i=i+Math.imul(S,lt)|0,a=a+Math.imul(S,ut)|0,n=n+Math.imul(M,ht)|0,i=i+Math.imul(M,ft)|0,i=i+Math.imul(k,ht)|0,a=a+Math.imul(k,ft)|0,n=n+Math.imul(x,pt)|0,i=i+Math.imul(x,mt)|0,i=i+Math.imul(_,pt)|0,a=a+Math.imul(_,mt)|0;var Et=(u+n|0)+((8191&i)<<13)|0;u=(a+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(j,$),i=Math.imul(j,tt),i=i+Math.imul(N,$)|0,a=Math.imul(N,tt),n=n+Math.imul(O,rt)|0,i=i+Math.imul(O,nt)|0,i=i+Math.imul(R,rt)|0,a=a+Math.imul(R,nt)|0,n=n+Math.imul(I,at)|0,i=i+Math.imul(I,ot)|0,i=i+Math.imul(D,at)|0,a=a+Math.imul(D,ot)|0,n=n+Math.imul(L,lt)|0,i=i+Math.imul(L,ut)|0,i=i+Math.imul(C,lt)|0,a=a+Math.imul(C,ut)|0,n=n+Math.imul(T,ht)|0,i=i+Math.imul(T,ft)|0,i=i+Math.imul(S,ht)|0,a=a+Math.imul(S,ft)|0,n=n+Math.imul(M,pt)|0,i=i+Math.imul(M,mt)|0,i=i+Math.imul(k,pt)|0,a=a+Math.imul(k,mt)|0;var Lt=(u+n|0)+((8191&i)<<13)|0;u=(a+(i>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,n=Math.imul(j,rt),i=Math.imul(j,nt),i=i+Math.imul(N,rt)|0,a=Math.imul(N,nt),n=n+Math.imul(O,at)|0,i=i+Math.imul(O,ot)|0,i=i+Math.imul(R,at)|0,a=a+Math.imul(R,ot)|0,n=n+Math.imul(I,lt)|0,i=i+Math.imul(I,ut)|0,i=i+Math.imul(D,lt)|0,a=a+Math.imul(D,ut)|0,n=n+Math.imul(L,ht)|0,i=i+Math.imul(L,ft)|0,i=i+Math.imul(C,ht)|0,a=a+Math.imul(C,ft)|0,n=n+Math.imul(T,pt)|0,i=i+Math.imul(T,mt)|0,i=i+Math.imul(S,pt)|0,a=a+Math.imul(S,mt)|0;var Ct=(u+n|0)+((8191&i)<<13)|0;u=(a+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,n=Math.imul(j,at),i=Math.imul(j,ot),i=i+Math.imul(N,at)|0, a=Math.imul(N,ot),n=n+Math.imul(O,lt)|0,i=i+Math.imul(O,ut)|0,i=i+Math.imul(R,lt)|0,a=a+Math.imul(R,ut)|0,n=n+Math.imul(I,ht)|0,i=i+Math.imul(I,ft)|0,i=i+Math.imul(D,ht)|0,a=a+Math.imul(D,ft)|0,n=n+Math.imul(L,pt)|0,i=i+Math.imul(L,mt)|0,i=i+Math.imul(C,pt)|0,a=a+Math.imul(C,mt)|0;var zt=(u+n|0)+((8191&i)<<13)|0;u=(a+(i>>>13)|0)+(zt>>>26)|0,zt&=67108863,n=Math.imul(j,lt),i=Math.imul(j,ut),i=i+Math.imul(N,lt)|0,a=Math.imul(N,ut),n=n+Math.imul(O,ht)|0,i=i+Math.imul(O,ft)|0,i=i+Math.imul(R,ht)|0,a=a+Math.imul(R,ft)|0,n=n+Math.imul(I,pt)|0,i=i+Math.imul(I,mt)|0,i=i+Math.imul(D,pt)|0,a=a+Math.imul(D,mt)|0;var It=(u+n|0)+((8191&i)<<13)|0;u=(a+(i>>>13)|0)+(It>>>26)|0,It&=67108863,n=Math.imul(j,ht),i=Math.imul(j,ft),i=i+Math.imul(N,ht)|0,a=Math.imul(N,ft),n=n+Math.imul(O,pt)|0,i=i+Math.imul(O,mt)|0,i=i+Math.imul(R,pt)|0,a=a+Math.imul(R,mt)|0;var Dt=(u+n|0)+((8191&i)<<13)|0;u=(a+(i>>>13)|0)+(Dt>>>26)|0,Dt&=67108863,n=Math.imul(j,pt),i=Math.imul(j,mt),i=i+Math.imul(N,pt)|0,a=Math.imul(N,mt);var Pt=(u+n|0)+((8191&i)<<13)|0;return u=(a+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,l[0]=vt,l[1]=gt,l[2]=yt,l[3]=bt,l[4]=xt,l[5]=_t,l[6]=wt,l[7]=Mt,l[8]=kt,l[9]=At,l[10]=Tt,l[11]=St,l[12]=Et,l[13]=Lt,l[14]=Ct,l[15]=zt,l[16]=It,l[17]=Dt,l[18]=Pt,0!==u&&(l[19]=u,r.length++),r};Math.imul||(k=u),a.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?k(this,t,e):r<63?u(this,t,e):r<1024?c(this,t,e):h(this,t,e)},f.prototype.makeRBT=function(t){for(var e=new Array(t),r=a.prototype._countBits(t)-1,n=0;n>=1;return n},f.prototype.permute=function(t,e,r,n,i,a){for(var o=0;o>>=1)i++;return 1<>>=13,r[2*o+1]=8191&a,a>>>=13;for(o=2*e;o>=26,e+=i/67108864|0,e+=a>>>26,this.words[r]=67108863&a}return 0!==e&&(this.words[r]=e,this.length++),this},a.prototype.muln=function(t){return this.clone().imuln(t)},a.prototype.sqr=function(){return this.mul(this)},a.prototype.isqr=function(){return this.imul(this.clone())},a.prototype.pow=function(t){var e=l(t);if(0===e.length)return new a(1);for(var r=this,n=0;n=0);var e,r=t%26,i=(t-r)/26,a=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(e=0;e>>26-r}o&&(this.words[e]=o,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e=0);var i;i=e?(e-e%26)/26:0;var a=t%26,o=Math.min((t-a)/26,this.length),s=67108863^67108863>>>a<o)for(this.length-=o,u=0;u=0&&(0!==c||u>=i);u--){var h=0|this.words[u];this.words[u]=c<<26-a|h>>>a,c=h&s}return l&&0!==c&&(l.words[l.length++]=c),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},a.prototype.ishrn=function(t,e,r){return n(0===this.negative),this.iushrn(t,e,r)},a.prototype.shln=function(t){return this.clone().ishln(t)},a.prototype.ushln=function(t){return this.clone().iushln(t)},a.prototype.shrn=function(t){return this.clone().ishrn(t)},a.prototype.ushrn=function(t){return this.clone().iushrn(t)},a.prototype.testn=function(t){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,i=1<=0);var e=t%26,r=(t-e)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var i=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},a.prototype.isubn=function(t){if(n("number"==typeof t),n(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(l/67108864|0),this.words[i+r]=67108863&o}for(;i>26,this.words[i+r]=67108863&o;if(0===s)return this.strip();for(n(-1===s),s=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},a.prototype._wordDiv=function(t,e){var r=this.length-t.length,n=this.clone(),i=t,o=0|i.words[i.length-1];0!==(r=26-this._countBits(o))&&(i=i.ushln(r),n.iushln(r),o=0|i.words[i.length-1]);var s,l=n.length-i.length;if("mod"!==e){s=new a(null),s.length=l+1,s.words=new Array(s.length);for(var u=0;u=0;h--){var f=67108864*(0|n.words[i.length+h])+(0|n.words[i.length+h-1]);for(f=Math.min(f/o|0,67108863),n._ishlnsubmul(i,f,h);0!==n.negative;)f--,n.negative=0,n._ishlnsubmul(i,1,h),n.isZero()||(n.negative^=1);s&&(s.words[h]=f)}return s&&s.strip(),n.strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:s||null,mod:n}},a.prototype.divmod=function(t,e,r){if(n(!t.isZero()),this.isZero())return{div:new a(0),mod:new a(0)};var i,o,s;return 0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(i=s.div.neg()),"div"!==e&&(o=s.mod.neg(),r&&0!==o.negative&&o.iadd(t)),{div:i,mod:o}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(i=s.div.neg()),{div:i,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(o=s.mod.neg(),r&&0!==o.negative&&o.isub(t)),{div:s.div,mod:o}):t.length>this.length||this.cmp(t)<0?{div:new a(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new a(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new a(this.modn(t.words[0]))}:this._wordDiv(t,e)},a.prototype.div=function(t){return this.divmod(t,"div",!1).div},a.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},a.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},a.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,n=t.ushrn(1),i=t.andln(1),a=r.cmp(n);return a<0||1===i&&0===a?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},a.prototype.modn=function(t){n(t<=67108863);for(var e=(1<<26)%t,r=0,i=this.length-1;i>=0;i--)r=(e*r+(0|this.words[i]))%t;return r},a.prototype.idivn=function(t){n(t<=67108863);for(var e=0,r=this.length-1;r>=0;r--){var i=(0|this.words[r])+67108864*e;this.words[r]=i/t|0,e=i%t}return this.strip()},a.prototype.divn=function(t){return this.clone().idivn(t)},a.prototype.egcd=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new a(1),o=new a(0),s=new a(0),l=new a(1),u=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++u;for(var c=r.clone(),h=e.clone();!e.isZero();){for(var f=0,d=1;0==(e.words[0]&d)&&f<26;++f,d<<=1);if(f>0)for(e.iushrn(f);f-- >0;)(i.isOdd()||o.isOdd())&&(i.iadd(c),o.isub(h)),i.iushrn(1),o.iushrn(1);for(var p=0,m=1;0==(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(s.isOdd()||l.isOdd())&&(s.iadd(c),l.isub(h)),s.iushrn(1),l.iushrn(1);e.cmp(r)>=0?(e.isub(r),i.isub(s),o.isub(l)):(r.isub(e),s.isub(i),l.isub(o))}return{a:s,b:l,gcd:r.iushln(u)}},a.prototype._invmp=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new a(1),o=new a(0),s=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var l=0,u=1;0==(e.words[0]&u)&&l<26;++l,u<<=1);if(l>0)for(e.iushrn(l);l-- >0;)i.isOdd()&&i.iadd(s),i.iushrn(1);for(var c=0,h=1;0==(r.words[0]&h)&&c<26;++c,h<<=1);if(c>0)for(r.iushrn(c);c-- >0;)o.isOdd()&&o.iadd(s),o.iushrn(1);e.cmp(r)>=0?(e.isub(r),i.isub(o)):(r.isub(e),o.isub(i))}var f;return f=0===e.cmpn(1)?i:o,f.cmpn(0)<0&&f.iadd(t),f},a.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var n=0;e.isEven()&&r.isEven();n++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=e.cmp(r);if(i<0){var a=e;e=r,r=a}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.iushln(n)},a.prototype.invm=function(t){return this.egcd(t).a.umod(t)},a.prototype.isEven=function(){return 0==(1&this.words[0])},a.prototype.isOdd=function(){return 1==(1&this.words[0])},a.prototype.andln=function(t){return this.words[0]&t},a.prototype.bincn=function(t){n("number"==typeof t);var e=t%26,r=(t-e)/26,i=1<>>26,s&=67108863,this.words[o]=s}return 0!==a&&(this.words[o]=a,this.length++),this},a.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},a.prototype.cmpn=function(t){var e=t<0;if(0!==this.negative&&!e)return-1;if(0===this.negative&&e)return 1;this.strip();var r;if(this.length>1)r=1;else{e&&(t=-t),n(t<=67108863,"Number is too big");var i=0|this.words[0];r=i===t?0:it.length)return 1;if(this.length=0;r--){var n=0|this.words[r],i=0|t.words[r];if(n!==i){ni&&(e=1);break}}return e},a.prototype.gtn=function(t){return 1===this.cmpn(t)},a.prototype.gt=function(t){return 1===this.cmp(t)},a.prototype.gten=function(t){return this.cmpn(t)>=0},a.prototype.gte=function(t){return this.cmp(t)>=0},a.prototype.ltn=function(t){return-1===this.cmpn(t)},a.prototype.lt=function(t){return-1===this.cmp(t)},a.prototype.lten=function(t){return this.cmpn(t)<=0},a.prototype.lte=function(t){return this.cmp(t)<=0},a.prototype.eqn=function(t){return 0===this.cmpn(t)},a.prototype.eq=function(t){return 0===this.cmp(t)},a.red=function(t){return new y(t)},a.prototype.toRed=function(t){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},a.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},a.prototype._forceRed=function(t){return this.red=t,this},a.prototype.forceRed=function(t){return n(!this.red,"Already a number in reduction context"),this._forceRed(t)},a.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},a.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},a.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},a.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},a.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},a.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},a.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},a.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},a.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},a.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},a.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},a.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},a.prototype.redPow=function(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var A={k256:null,p224:null,p192:null,p25519:null};d.prototype._tmp=function(){var t=new a(null);return t.words=new Array(Math.ceil(this.n/13)),t},d.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},d.prototype.split=function(t,e){t.iushrn(this.n,0,e)},d.prototype.imulK=function(t){return t.imul(this.k)},i(p,d),p.prototype.split=function(t,e){for(var r=Math.min(t.length,9),n=0;n>>22,i=a}i>>>=22,t.words[n-10]=i,0===i&&t.length>10?t.length-=10:t.length-=9},p.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},a._prime=function(t){if(A[t])return A[t];var e;if("k256"===t)e=new p;else if("p224"===t)e=new m;else if("p192"===t)e=new v;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new g}return A[t]=e,e},y.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},y.prototype._verify2=function(t,e){n(0==(t.negative|e.negative),"red works only with positives"),n(t.red&&t.red===e.red,"red works only with red numbers")},y.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},y.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},y.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)},y.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},y.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)},y.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},y.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},y.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},y.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},y.prototype.isqr=function(t){return this.imul(t,t.clone())},y.prototype.sqr=function(t){return this.mul(t,t)},y.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(n(e%2==1),3===e){var r=this.m.add(new a(1)).iushrn(2);return this.pow(t,r)}for(var i=this.m.subn(1),o=0;!i.isZero()&&0===i.andln(1);)o++,i.iushrn(1);n(!i.isZero());var s=new a(1).toRed(this),l=s.redNeg(),u=this.m.subn(1).iushrn(1),c=this.m.bitLength();for(c=new a(2*c*c).toRed(this);0!==this.pow(c,u).cmp(l);)c.redIAdd(l);for(var h=this.pow(c,i),f=this.pow(t,i.addn(1).iushrn(1)),d=this.pow(t,i),p=o;0!==d.cmp(s);){for(var m=d,v=0;0!==m.cmp(s);v++)m=m.redSqr();n(v=0;n--){for(var u=e.words[n],c=l-1;c>=0;c--){var h=u>>c&1;i!==r[0]&&(i=this.sqr(i)),0!==h||0!==o?(o<<=1,o|=h,(4===++s||0===n&&0===c)&&(i=this.mul(i,r[o]),s=0,o=0)):s=0}l=26}return i},y.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},y.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},a.mont=function(t){return new b(t)},i(b,y),b.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},b.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},b.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),a=i;return i.cmp(this.m)>=0?a=i.isub(this.m):i.cmpn(0)<0&&(a=i.iadd(this.m)),a._forceRed(this)},b.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new a(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},b.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(void 0===e||e,this)},{}],67:[function(t,e,r){"use strict";function n(t){var e,r,n,i=t.length,a=0;for(e=0;e>>1;if(!(s<=0)){var l,u=h.mallocDouble(2*s*a),c=h.mallocInt32(a);if((a=i(t,s,u,c))>0){if(1===s&&n)f.init(a),l=f.sweepComplete(s,r,0,a,u,c,0,a,u,c);else{var p=h.mallocDouble(2*s*o),m=h.mallocInt32(o);o=i(e,s,p,m),o>0&&(f.init(a+o),l=1===s?f.sweepBipartite(s,r,0,a,u,c,0,o,p,m):d(s,r,n,a,u,c,o,p,m),h.free(p),h.free(m))}h.free(u),h.free(c)}return l}}}function o(t,e){c.push([t,e])}function s(t){return c=[],a(t,t,o,!0),c}function l(t,e){return c=[],a(t,e,o,!1),c}function u(t,e,r){switch(arguments.length){case 1:return s(t);case 2:return"function"==typeof e?a(t,t,e,!0):l(t,e);case 3:return a(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":70,"./lib/sweep":74,"typedarray-pool":539}],69:[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*",a,";"],l="for(var i="+c+","+p+"="+u+"*"+c+";i<"+h+";++i,"+p+"+="+u+"){var x0="+f+"["+o+"+"+p+"],x1="+f+"["+o+"+"+p+"+"+a+"],xi="+d+"[i];",M="for(var j="+m+","+b+"="+u+"*"+m+";j<"+v+";++j,"+b+"+="+u+"){var y0="+g+"["+o+"+"+b+"],"+(r?"y1="+g+"["+o+"+"+b+"+"+a+"],":"")+"yi="+y+"[j];";return t?i.push(l,_,":",M):i.push(M,_,":",l),r?i.push("if(y1"+v+"-"+m+"){"),t?(e(!0,!1),o.push("}else{"),e(!1,!1)):(o.push("if("+l+"){"),e(!0,!0),o.push("}else{"),e(!0,!1),o.push("}}else{if("+l+"){"),e(!1,!0),o.push("}else{"),e(!1,!1),o.push("}")),o.push("}}return "+r);var s=i.join("")+o.join("");return new Function(s)()}var a="d",o="ax",s="vv",l="fp",u="es",c="rs",h="re",f="rb",d="ri",p="rp",m="bs",v="be",g="bb",y="bi",b="bp",x="rv",_="Q",w=[a,o,s,c,h,f,d,m,v,g,y];r.partial=i(!1),r.full=i(!0)},{}],70:[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.length0;){z-=1;var D=z*A,P=S[D],O=S[D+1],R=S[D+2],F=S[D+3],j=S[D+4],N=S[D+5],B=z*T,U=E[B],V=E[B+1],H=1&N,q=!!(16&N),G=l,Y=u,X=m,W=L;if(H&&(G=m,Y=L,X=l,W=u),!(2&N&&(R=_(t,P,O,R,G,Y,V),O>=R)||4&N&&(O=w(t,P,O,R,G,Y,U))>=R)){var Z=R-O,J=j-F;if(q){if(t*Z*(Z+J)=p0)&&!(p1>=hi)",["p0","p1"]),x=m("lo===p0",["p0"]),_=m("lor&&i[h+e]>u;--c,h-=o){for(var f=h,d=h+o,p=0;p>>1,f=2*t,d=h,p=a[f*h+e];u=b?(d=y,p=b):g>=_?(d=v,p=g):(d=x,p=_):b>=_?(d=y,p=b):_>=g?(d=v,p=g):(d=x,p=_);for(var w=f*(c-1),M=f*d,k=0;k=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"},{}],73:[function(t,e,r){"use strict";function n(t,e){e<=4*f?i(0,e-1,t):h(0,e-1,t)}function i(t,e,r){for(var n=2*(t+1),i=t+1;i<=e;++i){for(var a=r[n++],o=r[n++],s=i,l=n-2;s-- >t;){var u=r[l-2],c=r[l-1];if(ur[e+1])}function c(t,e,r,n){t*=2;var i=n[t];return i>1,v=m-n,g=m+n,y=d,b=v,x=m,_=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],S=r[2*b+1],E=r[2*_],L=r[2*_+1],C=2*y,z=2*x,I=2*w,D=2*d,P=2*m,O=2*p,R=0;R<2;++R){var F=r[C+R],j=r[z+R],N=r[I+R];r[D+R]=F,r[P+R]=j,r[O+R]=N}o(v,t,r),o(g,e,r);for(var B=M;B<=k;++B)if(c(B,T,S,r))B!==M&&a(B,M,r),++M;else if(!c(B,E,L,r))for(;;){if(c(k,E,L,r)){c(k,T,S,r)?(s(B,M,k,r),++M,--k):(a(B,k,r),--k);break}if(--k>>1;f(x,S);for(var E=0,L=0,M=0;M=d)C=C-d|0,i(v,g,L--,C);else if(C>=0)i(p,m,E--,C);else if(C<=-d){C=-C-d|0;for(var z=0;z>>1;f(x,E);for(var L=0,C=0,z=0,k=0;k>1==x[2*k+3]>>1&&(D=2,k+=1),I<0){for(var P=-(I>>1)-1,O=0;O>1)-1;0===D?i(p,m,L--,P):1===D?i(v,g,C--,P):2===D&&i(y,b,z--,P)}}}function l(t,e,r,n,o,s,l,u,c,h,v,g){var y=0,b=2*t,_=e,w=e+t,M=1,k=1;n?k=d:M=d;for(var A=o;A>>1;f(x,L);for(var C=0,A=0;A=d?(I=!n,T-=d):(I=!!n,T-=1),I)a(p,m,C++,T);else{ var D=g[T],P=b*T,O=v[P+e+1],R=v[P+e+1+t];t:for(var F=0;F>>1;f(x,M);for(var k=0,y=0;y=d)p[k++]=b-d;else{b-=1;var T=c[b],S=m*b,E=u[S+e+1],L=u[S+e+1+t];t:for(var C=0;C=0;--C)if(p[C]===b){for(var P=C+1;PZ)throw new RangeError("Invalid typed array length");var e=new Uint8Array(t);return e.__proto__=i.prototype,e}function i(t,e,r){if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return l(t)}return a(t,e,r)}function a(t,e,r){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return t instanceof ArrayBuffer?h(t,e,r):"string"==typeof t?u(t,e):f(t)}function o(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function s(t,e,r){return o(t),t<=0?n(t):void 0!==e?"string"==typeof r?n(t).fill(e,r):n(t).fill(e):n(t)}function l(t){return o(t),n(t<0?0:0|d(t))}function u(t,e){if("string"==typeof e&&""!==e||(e="utf8"),!i.isEncoding(e))throw new TypeError('"encoding" must be a valid string encoding');var r=0|m(t,e),a=n(r),o=a.write(t,e);return o!==r&&(a=a.slice(0,o)),a}function c(t){for(var e=t.length<0?0:0|d(t.length),r=n(e),i=0;i=Z)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Z.toString(16)+" bytes");return 0|t}function p(t){return+t!=t&&(t=0),i.alloc(+t)}function m(t,e){if(i.isBuffer(t))return t.length;if(G(t)||t instanceof ArrayBuffer)return t.byteLength;"string"!=typeof t&&(t=""+t);var r=t.length;if(0===r)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return B(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return H(t).length;default:if(n)return B(t).length;e=(""+e).toLowerCase(),n=!0}}function v(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if(r>>>=0,e>>>=0,r<=e)return"";for(t||(t="utf8");;)switch(t){case"hex":return z(this,e,r);case"utf8":case"utf-8":return S(this,e,r);case"ascii":return L(this,e,r);case"latin1":case"binary":return C(this,e,r);case"base64":return T(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function g(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function y(t,e,r,n,a){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,Y(r)&&(r=a?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(a)return-1;r=t.length-1}else if(r<0){if(!a)return-1;r=0}if("string"==typeof e&&(e=i.from(e,n)),i.isBuffer(e))return 0===e.length?-1:b(t,e,r,n,a);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?a?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):b(t,[e],r,n,a);throw new TypeError("val must be string, number or Buffer")}function b(t,e,r,n,i){function a(t,e){return 1===o?t[e]:t.readUInt16BE(e*o)}var o=1,s=t.length,l=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;o=2,s/=2,l/=2,r/=2}var u;if(i){var c=-1;for(u=r;us&&(r=s-l),u=r;u>=0;u--){for(var h=!0,f=0;fi&&(n=i):n=i;var a=e.length;if(a%2!=0)throw new TypeError("Invalid hex string");n>a/2&&(n=a/2);for(var o=0;o239?4:a>223?3:a>191?2:1;if(i+s<=r){var l,u,c,h;switch(s){case 1:a<128&&(o=a);break;case 2:l=t[i+1],128==(192&l)&&(h=(31&a)<<6|63&l)>127&&(o=h);break;case 3:l=t[i+1],u=t[i+2],128==(192&l)&&128==(192&u)&&(h=(15&a)<<12|(63&l)<<6|63&u)>2047&&(h<55296||h>57343)&&(o=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&a)<<18|(63&l)<<12|(63&u)<<6|63&c)>65535&&h<1114112&&(o=h)}}null===o?(o=65533,s=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|1023&o),n.push(o),i+=s}return E(n)}function E(t){var e=t.length;if(e<=J)return String.fromCharCode.apply(String,t);for(var r="",n=0;nn)&&(r=n);for(var i="",a=e;ar)throw new RangeError("Trying to access beyond buffer length")}function P(t,e,r,n,a,o){if(!i.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>a||et.length)throw new RangeError("Index out of range")}function O(t,e,r,n,i,a){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function R(t,e,r,n,i){return e=+e,r>>>=0,i||O(t,e,r,4,3.4028234663852886e38,-3.4028234663852886e38),W.write(t,e,r,n,23,4),r+4}function F(t,e,r,n,i){return e=+e,r>>>=0,i||O(t,e,r,8,1.7976931348623157e308,-1.7976931348623157e308),W.write(t,e,r,n,52,8),r+8}function j(t){if(t=t.trim().replace(K,""),t.length<2)return"";for(;t.length%4!=0;)t+="=";return t}function N(t){return t<16?"0"+t.toString(16):t.toString(16)}function B(t,e){e=e||1/0;for(var r,n=t.length,i=null,a=[],o=0;o55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&a.push(239,191,189);continue}if(o+1===n){(e-=3)>-1&&a.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&a.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&a.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;a.push(r)}else if(r<2048){if((e-=2)<0)break;a.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;a.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;a.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return a}function U(t){for(var e=[],r=0;r>8,i=r%256,a.push(i),a.push(n);return a}function H(t){return X.toByteArray(j(t))}function q(t,e,r,n){for(var i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function G(t){return"function"==typeof ArrayBuffer.isView&&ArrayBuffer.isView(t)}function Y(t){return t!==t}var X=t("base64-js"),W=t("ieee754");r.Buffer=i,r.SlowBuffer=p,r.INSPECT_MAX_BYTES=50;var Z=2147483647;r.kMaxLength=Z,i.TYPED_ARRAY_SUPPORT=function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()}catch(t){return!1}}(),i.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),"undefined"!=typeof Symbol&&Symbol.species&&i[Symbol.species]===i&&Object.defineProperty(i,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),i.poolSize=8192,i.from=function(t,e,r){return a(t,e,r)},i.prototype.__proto__=Uint8Array.prototype,i.__proto__=Uint8Array,i.alloc=function(t,e,r){return s(t,e,r)},i.allocUnsafe=function(t){return l(t)},i.allocUnsafeSlow=function(t){return l(t)},i.isBuffer=function(t){return null!=t&&!0===t._isBuffer},i.compare=function(t,e){if(!i.isBuffer(t)||!i.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,n=e.length,a=0,o=Math.min(r,n);a0&&(t=this.toString("hex",0,e).match(/.{2}/g).join(" "),this.length>e&&(t+=" ... ")),""},i.prototype.compare=function(t,e,r,n,a){if(!i.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===a&&(a=this.length),e<0||r>t.length||n<0||a>this.length)throw new RangeError("out of range index");if(n>=a&&e>=r)return 0;if(n>=a)return-1;if(e>=r)return 1;if(e>>>=0,r>>>=0,n>>>=0,a>>>=0,this===t)return 0;for(var o=a-n,s=r-e,l=Math.min(o,s),u=this.slice(n,a),c=t.slice(e,r),h=0;h>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-e;if((void 0===r||r>i)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var a=!1;;)switch(n){case"hex":return x(this,t,e,r);case"utf8":case"utf-8":return _(this,t,e,r);case"ascii":return w(this,t,e,r);case"latin1":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}},i.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var J=4096;i.prototype.slice=function(t,e){var r=this.length;t=~~t,e=void 0===e?r:~~e,t<0?(t+=r)<0&&(t=0):t>r&&(t=r),e<0?(e+=r)<0&&(e=0):e>r&&(e=r),e>>=0,e>>>=0,r||D(t,e,this.length);for(var n=this[t],i=1,a=0;++a>>=0,e>>>=0,r||D(t,e,this.length);for(var n=this[t+--e],i=1;e>0&&(i*=256);)n+=this[t+--e]*i;return n},i.prototype.readUInt8=function(t,e){return t>>>=0,e||D(t,1,this.length),this[t]},i.prototype.readUInt16LE=function(t,e){return t>>>=0,e||D(t,2,this.length),this[t]|this[t+1]<<8},i.prototype.readUInt16BE=function(t,e){return t>>>=0,e||D(t,2,this.length),this[t]<<8|this[t+1]},i.prototype.readUInt32LE=function(t,e){return t>>>=0,e||D(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},i.prototype.readUInt32BE=function(t,e){return t>>>=0,e||D(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},i.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||D(t,e,this.length);for(var n=this[t],i=1,a=0;++a=i&&(n-=Math.pow(2,8*e)),n},i.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||D(t,e,this.length);for(var n=e,i=1,a=this[t+--n];n>0&&(i*=256);)a+=this[t+--n]*i;return i*=128,a>=i&&(a-=Math.pow(2,8*e)),a},i.prototype.readInt8=function(t,e){return t>>>=0,e||D(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},i.prototype.readInt16LE=function(t,e){t>>>=0,e||D(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},i.prototype.readInt16BE=function(t,e){t>>>=0,e||D(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},i.prototype.readInt32LE=function(t,e){return t>>>=0,e||D(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},i.prototype.readInt32BE=function(t,e){return t>>>=0,e||D(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},i.prototype.readFloatLE=function(t,e){return t>>>=0,e||D(t,4,this.length),W.read(this,t,!0,23,4)},i.prototype.readFloatBE=function(t,e){return t>>>=0,e||D(t,4,this.length),W.read(this,t,!1,23,4)},i.prototype.readDoubleLE=function(t,e){return t>>>=0,e||D(t,8,this.length),W.read(this,t,!0,52,8)},i.prototype.readDoubleBE=function(t,e){return t>>>=0,e||D(t,8,this.length),W.read(this,t,!1,52,8)},i.prototype.writeUIntLE=function(t,e,r,n){if(t=+t,e>>>=0,r>>>=0,!n){P(this,t,e,r,Math.pow(2,8*r)-1,0)}var i=1,a=0;for(this[e]=255&t;++a>>=0,r>>>=0,!n){P(this,t,e,r,Math.pow(2,8*r)-1,0)}var i=r-1,a=1;for(this[e+i]=255&t;--i>=0&&(a*=256);)this[e+i]=t/a&255;return e+r},i.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,1,255,0),this[e]=255&t,e+1},i.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},i.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},i.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},i.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},i.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var i=Math.pow(2,8*r-1);P(this,t,e,r,i-1,-i)}var a=0,o=1,s=0;for(this[e]=255&t;++a>0)-s&255;return e+r},i.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var i=Math.pow(2,8*r-1);P(this,t,e,r,i-1,-i)}var a=r-1,o=1,s=0;for(this[e+a]=255&t;--a>=0&&(o*=256);)t<0&&0===s&&0!==this[e+a+1]&&(s=1),this[e+a]=(t/o>>0)-s&255;return e+r},i.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},i.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},i.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},i.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},i.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},i.prototype.writeFloatLE=function(t,e,r){return R(this,t,e,!0,r)},i.prototype.writeFloatBE=function(t,e,r){return R(this,t,e,!1,r)},i.prototype.writeDoubleLE=function(t,e,r){return F(this,t,e,!0,r)},i.prototype.writeDoubleBE=function(t,e,r){return F(this,t,e,!1,r)},i.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&&n=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e=0;--i)t[i+e]=this[i+r];else if(a<1e3)for(i=0;i>>=0,r=void 0===r?this.length:r>>>0,t||(t=0);var o;if("number"==typeof t)for(o=e;o0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===t[e-2]?2:"="===t[e-1]?1:0}function i(t){return 3*t.length/4-n(t)}function a(t){var e,r,i,a,o,s,l=t.length;o=n(t),s=new h(3*l/4-o),i=o>0?l-4:l;var u=0;for(e=0,r=0;e>16&255,s[u++]=a>>8&255,s[u++]=255&a;return 2===o?(a=c[t.charCodeAt(e)]<<2|c[t.charCodeAt(e+1)]>>4,s[u++]=255&a):1===o&&(a=c[t.charCodeAt(e)]<<10|c[t.charCodeAt(e+1)]<<4|c[t.charCodeAt(e+2)]>>2,s[u++]=a>>8&255,s[u++]=255&a),s}function o(t){return u[t>>18&63]+u[t>>12&63]+u[t>>6&63]+u[63&t]}function s(t,e,r){for(var n,i=[],a=e;al?l:o+16383));return 1===n?(e=t[r-1],i+=u[e>>2],i+=u[e<<4&63],i+="=="):2===n&&(e=(t[r-2]<<8)+t[r-1],i+=u[e>>10],i+=u[e>>4&63],i+=u[e<<2&63],i+="="),a.push(i),a.join("")}r.byteLength=i,r.toByteArray=a,r.fromByteArray=l;for(var u=[],c=[],h="undefined"!=typeof Uint8Array?Uint8Array:Array,f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",d=0,p=f.length;d0;){for(var c=r.pop(),s=r.pop(),h=-1,f=-1,l=o[s],p=1;p=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 a=t("robust-in-sphere")[4];t("binary-search-bounds");e.exports=i},{"binary-search-bounds":82,"robust-in-sphere":504}],79:[function(t,e,r){"use strict";function n(t,e,r,n,i,a,o){this.cells=t,this.neighbor=e,this.flags=n,this.constraint=r,this.active=i,this.next=a,this.boundary=o}function i(t,e){return t[0]-e[0]||t[1]-e[1]||t[2]-e[2]}function a(t,e){for(var r=t.cells(),a=r.length,o=0;o0||l.length>0;){for(;s.length>0;){var d=s.pop();if(u[d]!==-i){u[d]=i;for(var p=(c[d],0);p<3;++p){var m=f[3*d+p];m>=0&&0===u[m]&&(h[3*d+p]?l.push(m):(s.push(m),u[m]=i))}}}var v=l;l=s,s=v,l.length=0,i=-i}var g=o(c,u,e);return r?g.concat(n.boundary):g}var l=t("binary-search-bounds");e.exports=s,n.prototype.locate=function(){var t=[0,0,0];return function(e,r,n){var a=e,o=r,s=n;return r1&&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]g[0]&&l.push(new i(g,d,v,h),new i(d,g,m,h))}l.sort(a);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===v?u(b,t,w):c(b,t,w)}return x}var f=t("binary-search-bounds"),d=t("robust-orientation")[3],p=0,m=1,v=2;e.exports=h},{"binary-search-bounds":82,"robust-orientation":506}],81:[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;n=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;n>>1,x=a[m]"];return i?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("}"),i?a.push("return -1};"):a.push("return i};"),a.join("")}function i(t,e,r,i){return 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(""))()}e.exports={ge:i(">=",!1,"GE"),gt:i(">",!1,"GT"),lt:i("<",!0,"LT"),le:i("<=",!0,"LE"),eq:i("-",!0,"EQ",!0)}},{}],83:[function(t,e,r){"use strict";function n(t){for(var e=1,r=1;rr?r:t:te?e:t}e.exports=n},{}],87:[function(t,e,r){"use strict";function n(t){var e=_(t);return[M(e,-1/0),M(e,1/0)]}function i(t,e){for(var r=new Array(e.length),n=0;n=0;--a){var p=n[a];o=p[0];var m=e[o],v=m[0],g=m[1],y=t[v],M=t[g];if((y[0]-M[0]||y[1]-M[1])<0){var A=v;v=g,g=A}m[0]=v;var T,S=m[1]=p[1];for(i&&(T=m[2]);a>0&&n[a-1][0]===o;){var p=n[--a],E=p[1];i?e.push([S,E,T]):e.push([S,E]),S=E}i?e.push([S,g,T]):e.push([S,g])}return s}function u(t,e,r){for(var i=e.length,a=new v(i),o=[],s=0;se[2]?1:0)}function f(t,e,r){if(0!==t.length){if(e)for(var n=0;n0||d.length>0)}function m(t,e,r){var n;if(r){n=e;for(var i=new Array(e.length),a=0;a>>24,n=(16711680&t)>>>16,i=(65280&t)>>>8,a=255&t;return!1===e?[r,n,i,a]:[r/255,n/255,i/255,a/255]}var a=t("clamp");e.exports=n,e.exports.to=n,e.exports.from=i},{clamp:86}],91:[function(t,e,r){e.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}},{}],92:[function(t,e,r){"use strict";function n(t){var e,r,n=[],s=1;if("string"==typeof t)if(i[t])n=i[t].slice(),r="rgb";else if("transparent"===t)s=0,r="rgb",n=[0,0,0];else if(/^#[A-Fa-f0-9]+$/.test(t)){var l=t.slice(1),u=l.length,c=u<=4;s=1,c?(n=[parseInt(l[0]+l[0],16),parseInt(l[1]+l[1],16),parseInt(l[2]+l[2],16)],4===u&&(s=parseInt(l[3]+l[3],16)/255)):(n=[parseInt(l[0]+l[1],16),parseInt(l[2]+l[3],16),parseInt(l[4]+l[5],16)],8===u&&(s=parseInt(l[6]+l[7],16)/255)),n[0]||(n[0]=0),n[1]||(n[1]=0),n[2]||(n[2]=0),r="rgb"}else if(e=/^((?:rgb|hs[lvb]|hwb|cmyk?|xy[zy]|gray|lab|lchu?v?|[ly]uv|lms)a?)\s*\(([^\)]*)\)/.exec(t)){var h=e[1],l=h.replace(/a$/,"");r=l;var u="cmyk"===l?4:"gray"===l?1:3;n=e[2].trim().split(/\s*,\s*/).map(function(t,e){if(/%$/.test(t))return e===u?parseFloat(t)/100:"rgb"===l?255*parseFloat(t)/100:parseFloat(t);if("h"===l[e]){if(/deg$/.test(t))return parseFloat(t);if(void 0!==o[t])return o[t]}return parseFloat(t)}),h===l&&n.push(1),s=void 0===n[u]?1:n[u],n=n.slice(0,u)}else t.length>10&&/[0-9](?:\s|\/)/.test(t)&&(n=t.match(/([0-9]+)/g).map(function(t){return parseFloat(t)}),r=t.match(/([a-z])/gi).join("").toLowerCase());else"number"==typeof t?(r="rgb",n=[t>>>16,(65280&t)>>>8,255&t]):a(t)?(null!=t.r?(n=[t.r,t.g,t.b],r="rgb"):null!=t.red?(n=[t.red,t.green,t.blue],r="rgb"):null!=t.h?(n=[t.h,t.s,t.l],r="hsl"):null!=t.hue&&(n=[t.hue,t.saturation,t.lightness],r="hsl"),null!=t.a?s=t.a:null!=t.alpha?s=t.alpha:null!=t.opacity&&(s=t.opacity/100)):(Array.isArray(t)||ArrayBuffer.isView(t))&&(n=[t[0],t[1],t[2]],r="rgb",s=4===t.length?t[3]:1);return{space:r,values:n,alpha:s}}e.exports=n;var i=t("color-name"),a=t("is-plain-obj"),o={red:0,orange:60,yellow:120,green:180,blue:240,purple:300}},{"color-name":91,"is-plain-obj":295}],93:[function(t,e,r){"use strict";var n=t("color-parse"),i=t("color-space/hsl"),a=t("clamp");e.exports=function(t,e){null==e&&(e=!0);var r=n(t);if(!r.space)return[];if(Array.isArray(t))return t;var o,s=r.values,l=s.length;for(o=0;o1&&n--,a=6*n<1?e+6*(r-e)*n:2*n<1?r:3*n<2?e+(r-e)*(2/3-n)*6:e,i[u]=255*a;return i}},n.hsl=function(t){var e,r,n,i=t[0]/255,a=t[1]/255,o=t[2]/255,s=Math.min(i,a,o),l=Math.max(i,a,o),u=l-s;return l===s?e=0:i===l?e=(a-o)/u:a===l?e=2+(o-i)/u:o===l&&(e=4+(i-a)/u),e=Math.min(60*e,360),e<0&&(e+=360),n=(s+l)/2,r=l===s?0:n<=.5?u/(l+s):u/(2-l-s),[e,100*r,100*n]}},{"./rgb":95}],95:[function(t,e,r){"use strict";e.exports={name:"rgb",min:[0,0,0],max:[255,255,255],channel:["red","green","blue"],alias:["RGB"]}},{}],96:[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]}],viridis:[{index:0,rgb:[68,1,84]},{index:.13,rgb:[71,44,122]},{index:.25,rgb:[59,81,139]},{index:.38,rgb:[44,113,142]},{index:.5,rgb:[33,144,141]},{index:.63,rgb:[39,173,129]},{index:.75,rgb:[92,200,99]},{index:.88,rgb:[170,220,50]},{index:1,rgb:[253,231,37]}],inferno:[{index:0,rgb:[0,0,4]},{index:.13,rgb:[31,12,72]},{index:.25,rgb:[85,15,109]},{index:.38,rgb:[136,34,106]},{index:.5,rgb:[186,54,85]},{index:.63,rgb:[227,89,51]},{index:.75,rgb:[249,140,10]},{index:.88,rgb:[249,201,50]},{index:1,rgb:[252,255,164]}],magma:[{index:0,rgb:[0,0,4]},{index:.13,rgb:[28,16,68]},{index:.25,rgb:[79,18,123]},{index:.38,rgb:[129,37,129]},{index:.5,rgb:[181,54,122]},{index:.63,rgb:[229,80,100]},{index:.75,rgb:[251,135,97]},{index:.88,rgb:[254,194,135]},{index:1,rgb:[252,253,191]}],plasma:[{index:0,rgb:[13,8,135]},{index:.13,rgb:[75,3,161]},{index:.25,rgb:[125,3,168]},{index:.38,rgb:[168,34,150]},{index:.5,rgb:[203,70,121]},{index:.63,rgb:[229,107,93]},{index:.75,rgb:[248,148,65]},{index:.88,rgb:[253,195,40]},{index:1,rgb:[240,249,33]}],warm:[{index:0,rgb:[125,0,179]},{index:.13,rgb:[172,0,187]},{index:.25,rgb:[219,0,170]},{index:.38,rgb:[255,0,130]},{index:.5,rgb:[255,63,74]},{index:.63,rgb:[255,123,0]},{index:.75,rgb:[234,176,0]},{index:.88,rgb:[190,228,0]},{index:1,rgb:[147,255,0]}],cool:[{index:0,rgb:[125,0,179]},{index:.13,rgb:[116,0,218]},{index:.25,rgb:[98,74,237]},{index:.38,rgb:[68,146,231]},{index:.5,rgb:[0,204,197]},{index:.63,rgb:[0,247,146]},{index:.75,rgb:[0,255,88]},{index:.88,rgb:[40,255,8]},{index:1,rgb:[147,255,0]}],"rainbow-soft":[{index:0,rgb:[125,0,179]},{index:.1,rgb:[199,0,180]},{index:.2,rgb:[255,0,121]},{index:.3,rgb:[255,108,0]},{index:.4,rgb:[222,194,0]},{index:.5,rgb:[150,255,0]},{index:.6,rgb:[0,255,55]},{index:.7,rgb:[0,246,150]},{index:.8,rgb:[50,167,222]},{index:.9,rgb:[103,51,235]},{index:1,rgb:[124,0,186]}],bathymetry:[{index:0,rgb:[40,26,44]},{index:.13,rgb:[59,49,90]},{index:.25,rgb:[64,76,139]},{index:.38,rgb:[63,110,151]},{index:.5,rgb:[72,142,158]},{index:.63,rgb:[85,174,163]},{index:.75,rgb:[120,206,163]},{index:.88,rgb:[187,230,172]},{index:1,rgb:[253,254,204]}],cdom:[{index:0,rgb:[47,15,62]},{index:.13,rgb:[87,23,86]},{index:.25,rgb:[130,28,99]},{index:.38,rgb:[171,41,96]},{index:.5,rgb:[206,67,86]},{index:.63,rgb:[230,106,84]},{index:.75,rgb:[242,149,103]},{index:.88,rgb:[249,193,135]},{index:1,rgb:[254,237,176]}],chlorophyll:[{index:0,rgb:[18,36,20]},{index:.13,rgb:[25,63,41]},{index:.25,rgb:[24,91,59]},{index:.38,rgb:[13,119,72]},{index:.5,rgb:[18,148,80]},{index:.63,rgb:[80,173,89]},{index:.75,rgb:[132,196,122]},{index:.88,rgb:[175,221,162]},{index:1,rgb:[215,249,208]}],density:[{index:0,rgb:[54,14,36]},{index:.13,rgb:[89,23,80]},{index:.25,rgb:[110,45,132]},{index:.38,rgb:[120,77,178]},{index:.5,rgb:[120,113,213]},{index:.63,rgb:[115,151,228]},{index:.75,rgb:[134,185,227]},{index:.88,rgb:[177,214,227]},{index:1,rgb:[230,241,241]}],"freesurface-blue":[{index:0,rgb:[30,4,110]},{index:.13,rgb:[47,14,176]},{index:.25,rgb:[41,45,236]},{index:.38,rgb:[25,99,212]},{index:.5,rgb:[68,131,200]},{index:.63,rgb:[114,156,197]},{index:.75,rgb:[157,181,203]},{index:.88,rgb:[200,208,216]},{index:1,rgb:[241,237,236]}],"freesurface-red":[{index:0,rgb:[60,9,18]},{index:.13,rgb:[100,17,27]},{index:.25,rgb:[142,20,29]},{index:.38,rgb:[177,43,27]},{index:.5,rgb:[192,87,63]},{index:.63,rgb:[205,125,105]},{index:.75,rgb:[216,162,148]},{index:.88,rgb:[227,199,193]},{index:1,rgb:[241,237,236]}],oxygen:[{index:0,rgb:[64,5,5]},{index:.13,rgb:[106,6,15]},{index:.25,rgb:[144,26,7]},{index:.38,rgb:[168,64,3]},{index:.5,rgb:[188,100,4]},{index:.63,rgb:[206,136,11]},{index:.75,rgb:[220,174,25]},{index:.88,rgb:[231,215,44]},{index:1,rgb:[248,254,105]}],par:[{index:0,rgb:[51,20,24]},{index:.13,rgb:[90,32,35]},{index:.25,rgb:[129,44,34]},{index:.38,rgb:[159,68,25]},{index:.5,rgb:[182,99,19]},{index:.63,rgb:[199,134,22]},{index:.75,rgb:[212,171,35]},{index:.88,rgb:[221,210,54]},{index:1,rgb:[225,253,75]}],phase:[{index:0,rgb:[145,105,18]},{index:.13,rgb:[184,71,38]},{index:.25,rgb:[186,58,115]},{index:.38,rgb:[160,71,185]},{index:.5,rgb:[110,97,218]},{index:.63,rgb:[50,123,164]},{index:.75,rgb:[31,131,110]},{index:.88,rgb:[77,129,34]},{index:1,rgb:[145,105,18]}],salinity:[{index:0,rgb:[42,24,108]},{index:.13,rgb:[33,50,162]},{index:.25,rgb:[15,90,145]},{index:.38,rgb:[40,118,137]},{index:.5,rgb:[59,146,135]},{index:.63,rgb:[79,175,126]},{index:.75,rgb:[120,203,104]},{index:.88,rgb:[193,221,100]},{index:1,rgb:[253,239,154]}],temperature:[{index:0,rgb:[4,35,51]},{index:.13,rgb:[23,51,122]},{index:.25,rgb:[85,59,157]},{index:.38,rgb:[129,79,143]},{index:.5,rgb:[175,95,130]},{index:.63,rgb:[222,112,101]},{index:.75,rgb:[249,146,66]},{index:.88,rgb:[249,196,65]},{index:1,rgb:[232,250,91]}],turbidity:[{index:0,rgb:[34,31,27]},{index:.13,rgb:[65,50,41]},{index:.25,rgb:[98,69,52]},{index:.38,rgb:[131,89,57]},{index:.5,rgb:[161,112,59]},{index:.63,rgb:[185,140,66]},{index:.75,rgb:[202,174,88]},{index:.88,rgb:[216,209,126]},{index:1,rgb:[233,246,171]}],"velocity-blue":[{index:0,rgb:[17,32,64]},{index:.13,rgb:[35,52,116]},{index:.25,rgb:[29,81,156]},{index:.38,rgb:[31,113,162]},{index:.5,rgb:[50,144,169]},{index:.63,rgb:[87,173,176]},{index:.75,rgb:[149,196,189]},{index:.88,rgb:[203,221,211]},{index:1,rgb:[254,251,230]}],"velocity-green":[{index:0,rgb:[23,35,19]},{index:.13,rgb:[24,64,38]},{index:.25,rgb:[11,95,45]},{index:.38,rgb:[39,123,35]},{index:.5,rgb:[95,146,12]},{index:.63,rgb:[152,165,18]},{index:.75,rgb:[201,186,69]},{index:.88,rgb:[233,216,137]},{index:1,rgb:[255,253,205]}],cubehelix:[{index:0,rgb:[0,0,0]},{index:.07,rgb:[22,5,59]},{index:.13,rgb:[60,4,105]},{index:.2,rgb:[109,1,135]},{index:.27,rgb:[161,0,147]},{index:.33,rgb:[210,2,142]},{index:.4,rgb:[251,11,123]},{index:.47,rgb:[255,29,97]},{index:.53,rgb:[255,54,69]},{index:.6,rgb:[255,85,46]},{index:.67,rgb:[255,120,34]},{index:.73,rgb:[255,157,37]},{index:.8,rgb:[241,191,57]},{index:.87,rgb:[224,220,93]},{index:.93,rgb:[218,241,142]},{index:1,rgb:[227,253,198]}]}},{}],97:[function(t,e,r){"use strict";function n(t){var e,r,n,u,c,h,f,d,p,m,v,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(),!l[f])throw Error(f+" not a supported colorscale");h=s(l[f])}else{if(!Array.isArray(f))throw Error("unsupported colormap option",f);h=s(f)}if(h.length>p)throw new Error(f+" map requires nshades to be at least size "+h.length);for(v=Array.isArray(t.alpha)?2!==t.alpha.length?[1,1]:s(t.alpha):"number"==typeof t.alpha?[t.alpha,t.alpha]:[1,1],e=h.map(function(t){return Math.round(t.index*p)}),v[0]<0&&(v[0]=0),v[1]<0&&(v[0]=0),v[0]>1&&(v[0]=1),v[1]>1&&(v[0]=1),y=0;y=0&&r[3]<=1||(r[3]=v[0]+(v[1]-v[0])*g);for(y=0;y=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);return c===n(t,e,i)?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);return h>0?s>0&&a(t,e,i)>0?1:-1:h<0?s>0||a(t,e,i)>0?1:-1:a(t,e,i)>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":506,"robust-product":507,"robust-sum":511,signum:513,"two-sum":538}],99:[function(t,e,r){function n(t,e){return t-e}function i(t,e){var r=t.length,i=t.length-e.length;if(i)return i;switch(r){case 0:return 0;case 1:return t[0]-e[0];case 2:return t[0]+t[1]-e[0]-e[1]||a(t[0],t[1])-a(e[0],e[1]);case 3:var o=t[0]+t[1],s=e[0]+e[1];if(i=o+t[2]-(s+e[2]))return i;var l=a(t[0],t[1]),u=a(e[0],e[1]);return a(l,t[2])-a(u,e[2])||a(l+t[2],o)-a(u+e[2],s);case 4:var c=t[0],h=t[1],f=t[2],d=t[3],p=e[0],m=e[1],v=e[2],g=e[3];return c+h+f+d-(p+m+v+g)||a(c,h,f,d)-a(p,m,v,g,p)||a(c+h,c+f,c+d,h+f,h+d,f+d)-a(p+m,p+v,p+g,m+v,m+g,v+g)||a(c+h+f,c+h+d,c+f+d,h+f+d)-a(p+m+v,p+m+g,p+v+g,m+v+g);default:for(var y=t.slice().sort(n),b=e.slice().sort(n),x=0;xt[r][0]&&(r=n);return er?[[r],[e]]:[[e]]}e.exports=n},{}],103:[function(t,e,r){"use strict";function n(t){var e=i(t),r=e.length;if(r<=2)return[];for(var n=new Array(r),a=e[r-1],o=0;o=e[l]&&(s+=1);a[o]=s}}return t}function a(t,e){try{return o(t,!0)}catch(u){var r=s(t);if(r.length<=e)return[];var a=n(t,r),l=o(a,!0);return i(l,r)}}e.exports=a;var o=t("incremental-convex-hull"),s=t("affine-hull")},{"affine-hull":39,"incremental-convex-hull":288}],105:[function(t,e,r){e.exports={AFG:"afghan",ALA:"\\b\\wland",ALB:"albania",DZA:"algeria",ASM:"^(?=.*americ).*samoa",AND:"andorra",AGO:"angola",AIA:"anguill?a",ATA:"antarctica",ATG:"antigua",ARG:"argentin",ARM:"armenia",ABW:"^(?!.*bonaire).*\\baruba",AUS:"australia",AUT:"^(?!.*hungary).*austria|\\baustri.*\\bemp",AZE:"azerbaijan",BHS:"bahamas",BHR:"bahrain",BGD:"bangladesh|^(?=.*east).*paki?stan",BRB:"barbados",BLR:"belarus|byelo",BEL:"^(?!.*luxem).*belgium",BLZ:"belize|^(?=.*british).*honduras",BEN:"benin|dahome",BMU:"bermuda",BTN:"bhutan",BOL:"bolivia",BES:"^(?=.*bonaire).*eustatius|^(?=.*carib).*netherlands|\\bbes.?islands",BIH:"herzegovina|bosnia",BWA:"botswana|bechuana",BVT:"bouvet",BRA:"brazil",IOT:"british.?indian.?ocean",BRN:"brunei",BGR:"bulgaria",BFA:"burkina|\\bfaso|upper.?volta",BDI:"burundi",CPV:"verde",KHM:"cambodia|kampuchea|khmer",CMR:"cameroon",CAN:"canada",CYM:"cayman",CAF:"\\bcentral.african.republic",TCD:"\\bchad",CHL:"\\bchile",CHN:"^(?!.*\\bmac)(?!.*\\bhong)(?!.*\\btai)(?!.*\\brep).*china|^(?=.*peo)(?=.*rep).*china",CXR:"christmas",CCK:"\\bcocos|keeling",COL:"colombia",COM:"comoro",COG:"^(?!.*\\bdem)(?!.*\\bd[\\.]?r)(?!.*kinshasa)(?!.*zaire)(?!.*belg)(?!.*l.opoldville)(?!.*free).*\\bcongo",COK:"\\bcook",CRI:"costa.?rica",CIV:"ivoire|ivory",HRV:"croatia",CUB:"\\bcuba",CUW:"^(?!.*bonaire).*\\bcura(c|\xe7)ao",CYP:"cyprus",CSK:"czechoslovakia",CZE:"^(?=.*rep).*czech|czechia|bohemia",COD:"\\bdem.*congo|congo.*\\bdem|congo.*\\bd[\\.]?r|\\bd[\\.]?r.*congo|belgian.?congo|congo.?free.?state|kinshasa|zaire|l.opoldville|drc|droc|rdc",DNK:"denmark",DJI:"djibouti",DMA:"dominica(?!n)",DOM:"dominican.rep",ECU:"ecuador",EGY:"egypt",SLV:"el.?salvador",GNQ:"guine.*eq|eq.*guine|^(?=.*span).*guinea",ERI:"eritrea",EST:"estonia",ETH:"ethiopia|abyssinia",FLK:"falkland|malvinas",FRO:"faroe|faeroe",FJI:"fiji",FIN:"finland",FRA:"^(?!.*\\bdep)(?!.*martinique).*france|french.?republic|\\bgaul",GUF:"^(?=.*french).*guiana",PYF:"french.?polynesia|tahiti",ATF:"french.?southern",GAB:"gabon",GMB:"gambia",GEO:"^(?!.*south).*georgia",DDR:"german.?democratic.?republic|democratic.?republic.*germany|east.germany",DEU:"^(?!.*east).*germany|^(?=.*\\bfed.*\\brep).*german",GHA:"ghana|gold.?coast",GIB:"gibraltar",GRC:"greece|hellenic|hellas",GRL:"greenland",GRD:"grenada",GLP:"guadeloupe",GUM:"\\bguam",GTM:"guatemala",GGY:"guernsey",GIN:"^(?!.*eq)(?!.*span)(?!.*bissau)(?!.*portu)(?!.*new).*guinea",GNB:"bissau|^(?=.*portu).*guinea",GUY:"guyana|british.?guiana",HTI:"haiti",HMD:"heard.*mcdonald",VAT:"holy.?see|vatican|papal.?st",HND:"^(?!.*brit).*honduras",HKG:"hong.?kong",HUN:"^(?!.*austr).*hungary",ISL:"iceland",IND:"india(?!.*ocea)",IDN:"indonesia",IRN:"\\biran|persia",IRQ:"\\biraq|mesopotamia",IRL:"(^ireland)|(^republic.*ireland)",IMN:"^(?=.*isle).*\\bman",ISR:"israel",ITA:"italy",JAM:"jamaica",JPN:"japan",JEY:"jersey",JOR:"jordan",KAZ:"kazak",KEN:"kenya|british.?east.?africa|east.?africa.?prot",KIR:"kiribati",PRK:"^(?=.*democrat|people|north|d.*p.*.r).*\\bkorea|dprk|korea.*(d.*p.*r)",KWT:"kuwait",KGZ:"kyrgyz|kirghiz",LAO:"\\blaos?\\b",LVA:"latvia",LBN:"lebanon",LSO:"lesotho|basuto",LBR:"liberia",LBY:"libya",LIE:"liechtenstein",LTU:"lithuania",LUX:"^(?!.*belg).*luxem",MAC:"maca(o|u)",MDG:"madagascar|malagasy",MWI:"malawi|nyasa",MYS:"malaysia",MDV:"maldive",MLI:"\\bmali\\b",MLT:"\\bmalta",MHL:"marshall",MTQ:"martinique",MRT:"mauritania",MUS:"mauritius",MYT:"\\bmayotte",MEX:"\\bmexic",FSM:"fed.*micronesia|micronesia.*fed",MCO:"monaco",MNG:"mongolia",MNE:"^(?!.*serbia).*montenegro",MSR:"montserrat",MAR:"morocco|\\bmaroc",MOZ:"mozambique",MMR:"myanmar|burma",NAM:"namibia",NRU:"nauru",NPL:"nepal",NLD:"^(?!.*\\bant)(?!.*\\bcarib).*netherlands",ANT:"^(?=.*\\bant).*(nether|dutch)",NCL:"new.?caledonia",NZL:"new.?zealand",NIC:"nicaragua",NER:"\\bniger(?!ia)",NGA:"nigeria",NIU:"niue",NFK:"norfolk",MNP:"mariana",NOR:"norway",OMN:"\\boman|trucial",PAK:"^(?!.*east).*paki?stan",PLW:"palau",PSE:"palestin|\\bgaza|west.?bank",PAN:"panama",PNG:"papua|new.?guinea",PRY:"paraguay",PER:"peru",PHL:"philippines",PCN:"pitcairn",POL:"poland",PRT:"portugal",PRI:"puerto.?rico",QAT:"qatar",KOR:"^(?!.*d.*p.*r)(?!.*democrat)(?!.*people)(?!.*north).*\\bkorea(?!.*d.*p.*r)",MDA:"moldov|b(a|e)ssarabia",REU:"r(e|\xe9)union",ROU:"r(o|u|ou)mania",RUS:"\\brussia|soviet.?union|u\\.?s\\.?s\\.?r|socialist.?republics",RWA:"rwanda",BLM:"barth(e|\xe9)lemy",SHN:"helena",KNA:"kitts|\\bnevis",LCA:"\\blucia",MAF:"^(?=.*collectivity).*martin|^(?=.*france).*martin(?!ique)|^(?=.*french).*martin(?!ique)",SPM:"miquelon",VCT:"vincent",WSM:"^(?!.*amer).*samoa",SMR:"san.?marino",STP:"\\bs(a|\xe3)o.?tom(e|\xe9)",SAU:"\\bsa\\w*.?arabia",SEN:"senegal",SRB:"^(?!.*monte).*serbia",SYC:"seychell",SLE:"sierra",SGP:"singapore",SXM:"^(?!.*martin)(?!.*saba).*maarten",SVK:"^(?!.*cze).*slovak",SVN:"slovenia",SLB:"solomon",SOM:"somali",ZAF:"south.africa|s\\\\..?africa",SGS:"south.?georgia|sandwich",SSD:"\\bs\\w*.?sudan",ESP:"spain",LKA:"sri.?lanka|ceylon",SDN:"^(?!.*\\bs(?!u)).*sudan",SUR:"surinam|dutch.?guiana",SJM:"svalbard",SWZ:"swaziland",SWE:"sweden",CHE:"switz|swiss",SYR:"syria",TWN:"taiwan|taipei|formosa|^(?!.*peo)(?=.*rep).*china",TJK:"tajik",THA:"thailand|\\bsiam",MKD:"macedonia|fyrom",TLS:"^(?=.*leste).*timor|^(?=.*east).*timor",TGO:"togo",TKL:"tokelau",TON:"tonga",TTO:"trinidad|tobago",TUN:"tunisia",TUR:"turkey",TKM:"turkmen",TCA:"turks",TUV:"tuvalu",UGA:"uganda",UKR:"ukrain",ARE:"emirates|^u\\.?a\\.?e\\.?$|united.?arab.?em",GBR:"united.?kingdom|britain|^u\\.?k\\.?$",TZA:"tanzania",USA:"united.?states\\b(?!.*islands)|\\bu\\.?s\\.?a\\.?\\b|^\\s*u\\.?s\\.?\\b(?!.*islands)",UMI:"minor.?outlying.?is",URY:"uruguay",UZB:"uzbek",VUT:"vanuatu|new.?hebrides",VEN:"venezuela",VNM:"^(?!.*republic).*viet.?nam|^(?=.*socialist).*viet.?nam",VGB:"^(?=.*\\bu\\.?\\s?k).*virgin|^(?=.*brit).*virgin|^(?=.*kingdom).*virgin",VIR:"^(?=.*\\bu\\.?\\s?s).*virgin|^(?=.*states).*virgin",WLF:"futuna|wallis",ESH:"western.sahara",YEM:"^(?!.*arab)(?!.*north)(?!.*sana)(?!.*peo)(?!.*dem)(?!.*south)(?!.*aden)(?!.*\\bp\\.?d\\.?r).*yemen",YMD:"^(?=.*peo).*yemen|^(?!.*rep)(?=.*dem).*yemen|^(?=.*south).*yemen|^(?=.*aden).*yemen|^(?=.*\\bp\\.?d\\.?r).*yemen",YUG:"yugoslavia",ZMB:"zambia|northern.?rhodesia",EAZ:"zanzibar",ZWE:"zimbabwe|^(?!.*northern).*rhodesia"}},{}],106:[function(t,e,r){function n(t){return t=Math.round(t),t<0?0:t>255?255:t}function i(t){return t<0?0:t>1?1:t}function a(t){return n("%"===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,r){return r<0?r+=1:r>1&&(r-=1),6*r<1?t+(e-t)*r*6:2*r<1?e:3*r<2?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&&r<=4095?[(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&&r<=16777215?[(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=o(h.pop());case"rgb":return 3!==h.length?null:[a(h[0]),a(h[1]),a(h[2]),f];case"hsla":if(4!==h.length)return null;f=o(h.pop());case"hsl":if(3!==h.length)return null;var d=(parseFloat(h[0])%360+360)%360/360,p=o(h[1]),m=o(h[2]),v=m<=.5?m*(p+1):m+p-m*p,g=2*m-v;return[n(255*s(g,v,d+1/3)),n(255*s(g,v,d)),n(255*s(g,v,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],rebeccapurple:[102,51,153,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(t){}},{}],107:[function(t,e,r){"use strict";function n(t,e,r,n,i,a){var o=6*i*i-6*i,s=3*i*i-4*i+1,l=-6*i*i+6*i,u=3*i*i-2*i;if(t.length){a||(a=new Array(t.length));for(var c=t.length-1;c>=0;--c)a[c]=o*t[c]+s*e[c]+l*r[c]+u*n[c];return a}return o*t+s*e+l*r[c]+u*n}function i(t,e,r,n,i,a){var o=i-1,s=i*i,l=o*o,u=(1+2*i)*l,c=i*l,h=s*(3-2*i),f=s*o;if(t.length){a||(a=new Array(t.length));for(var d=t.length-1;d>=0;--d)a[d]=u*t[d]+c*e[d]+h*r[d]+f*n[d];return a}return u*t+c*e+h*r+f*n}e.exports=i,e.exports.derivative=n},{}],108:[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"===o)e.scalarArgs.push(i),e.shimArgs.push("scalar"+i);else if("index"===o){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"===o){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,a(e)}var a=t("./lib/thunk.js");e.exports=i},{"./lib/thunk.js":110}],109:[function(t,e,r){"use strict";function n(t,e,r){var n,i,a=t.length,o=e.arrayArgs.length,s=e.indexArgs.length>0,l=[],u=[],c=0,h=0;for(n=0;n0&&l.push("var "+u.join(",")),n=a-1;n>=0;--n)c=t[n],l.push(["for(i",n,"=0;i",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 a=e.length,o=r.arrayArgs.length,s=r.blockSize,l=r.indexArgs.length>0,u=[],c=0;c0;){"].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;c0&&(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;h0&&_.push("shape=SS.slice(0)"),t.indexArgs.length>0){for(var w=new Array(r),h=0;h0&&x.push("var "+_.join(","));for(var h=0;h3&&x.push(o(t.pre,t,c));var T=o(t.body,t,c),S=a(v);S3&&x.push(o(t.post,t,c)),t.debug&&console.log("-----Generated cwise routine for ",e,":\n"+x.join("\n")+"\n----------");var E=[t.funcName||"unnamed","_cwise_loop_",l[0].join("s"),"m",S,s(c)].join("");return new Function(["function ",E,"(",b.join(","),"){",x.join("\n"),"} return ",E].join(""))()}var u=t("uniq");e.exports=l},{uniq:541}],110:[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 a=[],o=[],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--\x3e0;) {"),e.push("if (!("+u.join(" && ")+")) throw new Error('cwise: Arrays do not all have the same shape!')"),e.push("}"));for(var c=0;c=0?(a>=k?10:a>=A?5:a>=T?2:1)*Math.pow(10,i):-Math.pow(10,-i)/(a>=k?10:a>=A?5:a>=T?2:1)}function i(t,e,r){var n=Math.abs(e-t)/Math.max(0,r),i=Math.pow(10,Math.floor(Math.log(n)/Math.LN10)),a=n/i;return a>=k?i*=10:a>=A?i*=5:a>=T&&(i*=2),ee?1:t>=e?0:NaN},s=function(t){return 1===t.length&&(t=e(t)),{left:function(e,r,n,i){for(null==n&&(n=0),null==i&&(i=e.length);n>>1;t(e[a],r)<0?n=a+1:i=a}return n},right:function(e,r,n,i){for(null==n&&(n=0),null==i&&(i=e.length);n>>1;t(e[a],r)>0?i=a:n=a+1}return n}}},l=s(o),u=l.right,c=l.left,h=function(t,e){null==e&&(e=r);for(var n=0,i=t.length-1,a=t[0],o=new Array(i<0?0:i);nt?1:e>=t?0:NaN},p=function(t){return null===t?NaN:+t},m=function(t,e){var r,n,i=t.length,a=0,o=-1,s=0,l=0;if(null==e)for(;++o1)return l/(a-1)},v=function(t,e){var r=m(t,e);return r?Math.sqrt(r):r},g=function(t,e){var r,n,i,a=t.length,o=-1;if(null==e){for(;++o=r)for(n=i=r;++or&&(n=r),i=r)for(n=i=r;++or&&(n=r),i0)for(t=Math.ceil(t/o),e=Math.floor(e/o),a=new Array(i=Math.ceil(e-t+1));++lf;)d.pop(),--p;var m,v=new Array(p+1);for(a=0;a<=p;++a)m=v[a]=[],m.x0=a>0?d[a-1]:h,m.x1=a=1)return+r(t[n-1],n-1,t);var n,i=(n-1)*e,a=Math.floor(i),o=+r(t[a],a,t);return o+(+r(t[a+1],a+1,t)-o)*(i-a)}},z=function(t,e,r){return t=x.call(t,p).sort(o),Math.ceil((r-e)/(2*(C(t,.75)-C(t,.25))*Math.pow(t.length,-1/3)))},I=function(t,e,r){return Math.ceil((r-e)/(3.5*v(t)*Math.pow(t.length,-1/3)))},D=function(t,e){var r,n,i=t.length,a=-1;if(null==e){for(;++a=r)for(n=r;++an&&(n=r)}else for(;++a=r)for(n=r;++an&&(n=r);return n},P=function(t,e){var r,n=t.length,i=n,a=-1,o=0;if(null==e)for(;++a=0;)for(n=t[i],e=n.length;--e>=0;)r[--o]=n[e];return r},F=function(t,e){var r,n,i=t.length,a=-1;if(null==e){for(;++a=r)for(n=r;++ar&&(n=r)}else for(;++a=r)for(n=r;++ar&&(n=r);return n},j=function(t,e){for(var r=e.length,n=new Array(r);r--;)n[r]=t[e[r]];return n},N=function(t,e){if(r=t.length){var r,n,i=0,a=0,s=t[a];for(null==e&&(e=o);++i=c.length)return null!=l?l(e):null!=s?e.sort(s):e;for(var o,u,h,f=-1,d=e.length,p=c[n++],m=r(),v=i();++fc.length)return t;var n,i=h[r-1];return null!=l&&r>=c.length?n=t.entries():(n=[],t.each(function(t,i){n.push({key:i,values:e(t,r)})})),null!=i?n.sort(function(t,e){return i(t.key,e.key)}):n}var s,l,u,c=[],h=[];return u={object:function(e){return t(e,0,n,i)},map:function(e){return t(e,0,a,o)},entries:function(r){return e(t(r,0,a,o),0)},key:function(t){return c.push(t),u},sortKeys:function(t){return h[c.length-1]=t,u},sortValues:function(t){return s=t,u},rollup:function(t){return l=t,u}}},c=r.prototype;s.prototype=l.prototype={constructor:s,has:c.has,add:function(t){return t+="",this["$"+t]=t,this},remove:c.remove,clear:c.clear,values:c.keys,size:c.size,empty:c.empty,each:c.each};var h=function(t){var e=[];for(var r in t)e.push(r);return e},f=function(t){var e=[];for(var r in t)e.push(t[r]);return e},d=function(t){var e=[];for(var r in t)e.push({key:r,value:t[r]});return e};t.nest=u,t.set=l,t.map=r,t.keys=h,t.values=f,t.entries=d,Object.defineProperty(t,"__esModule",{value:!0})})},{}],114:[function(e,r,n){!function(e,i){"object"==typeof n&&void 0!==r?i(n):"function"==typeof t&&t.amd?t(["exports"],i):i(e.d3=e.d3||{})}(this,function(t){"use strict";function e(t,e){var r=Object.create(t.prototype);for(var n in e)r[n]=e[n];return r}function r(){}function n(t){var e;return t=(t+"").trim().toLowerCase(),(e=z.exec(t))?(e=parseInt(e[1],16),new l(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1)):(e=I.exec(t))?i(parseInt(e[1],16)):(e=D.exec(t))?new l(e[1],e[2],e[3],1):(e=P.exec(t))?new l(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=O.exec(t))?a(e[1],e[2],e[3],e[4]):(e=R.exec(t))?a(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=F.exec(t))?u(e[1],e[2]/100,e[3]/100,1):(e=j.exec(t))?u(e[1],e[2]/100,e[3]/100,e[4]):N.hasOwnProperty(t)?i(N[t]):"transparent"===t?new l(NaN,NaN,NaN,0):null}function i(t){return new l(t>>16&255,t>>8&255,255&t,1)}function a(t,e,r,n){return n<=0&&(t=e=r=NaN),new l(t,e,r,n)}function o(t){return t instanceof r||(t=n(t)),t?(t=t.rgb(),new l(t.r,t.g,t.b,t.opacity)):new l}function s(t,e,r,n){return 1===arguments.length?o(t):new l(t,e,r,null==n?1:n)}function l(t,e,r,n){this.r=+t,this.g=+e,this.b=+r,this.opacity=+n}function u(t,e,r,n){return n<=0?t=e=r=NaN:r<=0||r>=1?t=e=NaN:e<=0&&(t=NaN),new f(t,e,r,n)}function c(t){if(t instanceof f)return new f(t.h,t.s,t.l,t.opacity);if(t instanceof r||(t=n(t)),!t)return new f;if(t instanceof f)return t;t=t.rgb();var e=t.r/255,i=t.g/255,a=t.b/255,o=Math.min(e,i,a),s=Math.max(e,i,a),l=NaN,u=s-o,c=(s+o)/2;return u?(l=e===s?(i-a)/u+6*(i0&&c<1?0:l,new f(l,u,c,t.opacity)}function h(t,e,r,n){return 1===arguments.length?c(t):new f(t,e,r,null==n?1:n)}function f(t,e,r,n){this.h=+t,this.s=+e,this.l=+r,this.opacity=+n}function d(t,e,r){return 255*(t<60?e+(r-e)*t/60:t<180?r:t<240?e+(r-e)*(240-t)/60:e)}function p(t){if(t instanceof v)return new v(t.l,t.a,t.b,t.opacity);if(t instanceof M){var e=t.h*B;return new v(t.l,Math.cos(e)*t.c,Math.sin(e)*t.c,t.opacity)}t instanceof l||(t=o(t));var r=x(t.r),n=x(t.g),i=x(t.b),a=g((.4124564*r+.3575761*n+.1804375*i)/V),s=g((.2126729*r+.7151522*n+.072175*i)/H);return new v(116*s-16,500*(a-s),200*(s-g((.0193339*r+.119192*n+.9503041*i)/q)),t.opacity)}function m(t,e,r,n){return 1===arguments.length?p(t):new v(t,e,r,null==n?1:n)}function v(t,e,r,n){this.l=+t,this.a=+e,this.b=+r,this.opacity=+n}function g(t){return t>W?Math.pow(t,1/3):t/X+G}function y(t){return t>Y?t*t*t:X*(t-G)}function b(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function x(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function _(t){if(t instanceof M)return new M(t.h,t.c,t.l,t.opacity);t instanceof v||(t=p(t));var e=Math.atan2(t.b,t.a)*U;return new M(e<0?e+360:e,Math.sqrt(t.a*t.a+t.b*t.b),t.l,t.opacity)}function w(t,e,r,n){return 1===arguments.length?_(t):new M(t,e,r,null==n?1:n)}function M(t,e,r,n){this.h=+t,this.c=+e,this.l=+r,this.opacity=+n}function k(t){if(t instanceof T)return new T(t.h,t.s,t.l,t.opacity);t instanceof l||(t=o(t));var e=t.r/255,r=t.g/255,n=t.b/255,i=(rt*n+tt*e-et*r)/(rt+tt-et),a=n-i,s=($*(r-i)-K*a)/Q,u=Math.sqrt(s*s+a*a)/($*i*(1-i)),c=u?Math.atan2(s,a)*U-120:NaN;return new T(c<0?c+360:c,u,i,t.opacity)}function A(t,e,r,n){return 1===arguments.length?k(t):new T(t,e,r,null==n?1:n)}function T(t,e,r,n){this.h=+t,this.s=+e,this.l=+r,this.opacity=+n}var S=function(t,e,r){t.prototype=e.prototype=r,r.constructor=t},E="\\s*([+-]?\\d+)\\s*",L="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",C="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",z=/^#([0-9a-f]{3})$/,I=/^#([0-9a-f]{6})$/,D=new RegExp("^rgb\\("+[E,E,E]+"\\)$"),P=new RegExp("^rgb\\("+[C,C,C]+"\\)$"),O=new RegExp("^rgba\\("+[E,E,E,L]+"\\)$"),R=new RegExp("^rgba\\("+[C,C,C,L]+"\\)$"),F=new RegExp("^hsl\\("+[L,C,C]+"\\)$"),j=new RegExp("^hsla\\("+[L,C,C,L]+"\\)$"),N={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};S(r,n,{displayable:function(){return this.rgb().displayable()},toString:function(){return this.rgb()+""}}),S(l,s,e(r,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new l(this.r*t,this.g*t,this.b*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new l(this.r*t,this.g*t,this.b*t,this.opacity)},rgb:function(){return this},displayable:function(){return 0<=this.r&&this.r<=255&&0<=this.g&&this.g<=255&&0<=this.b&&this.b<=255&&0<=this.opacity&&this.opacity<=1},toString:function(){var t=this.opacity;return t=isNaN(t)?1:Math.max(0,Math.min(1,t)),(1===t?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(1===t?")":", "+t+")")}})),S(f,h,e(r,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new f(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new f(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=this.h%360+360*(this.h<0),e=isNaN(t)||isNaN(this.s)?0:this.s,r=this.l,n=r+(r<.5?r:1-r)*e,i=2*r-n;return new l(d(t>=240?t-240:t+120,i,n),d(t,i,n),d(t<120?t+240:t-120,i,n),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1}}));var B=Math.PI/180,U=180/Math.PI,V=.95047,H=1,q=1.08883,G=4/29,Y=6/29,X=3*Y*Y,W=Y*Y*Y;S(v,m,e(r,{brighter:function(t){return new v(this.l+18*(null==t?1:t),this.a,this.b,this.opacity)},darker:function(t){return new v(this.l-18*(null==t?1:t),this.a,this.b,this.opacity)},rgb:function(){var t=(this.l+16)/116,e=isNaN(this.a)?t:t+this.a/500,r=isNaN(this.b)?t:t-this.b/200;return t=H*y(t),e=V*y(e),r=q*y(r),new l(b(3.2404542*e-1.5371385*t-.4985314*r),b(-.969266*e+1.8760108*t+.041556*r),b(.0556434*e-.2040259*t+1.0572252*r),this.opacity)}})),S(M,w,e(r,{brighter:function(t){return new M(this.h,this.c,this.l+18*(null==t?1:t),this.opacity)},darker:function(t){return new M(this.h,this.c,this.l-18*(null==t?1:t),this.opacity)},rgb:function(){return p(this).rgb()}}));var Z=-.14861,J=1.78277,K=-.29227,Q=-.90649,$=1.97294,tt=$*Q,et=$*J,rt=J*K-Q*Z;S(T,A,e(r,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new T(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new T(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=isNaN(this.h)?0:(this.h+120)*B,e=+this.l,r=isNaN(this.s)?0:this.s*e*(1-e),n=Math.cos(t),i=Math.sin(t);return new l(255*(e+r*(Z*n+J*i)),255*(e+r*(K*n+Q*i)),255*(e+r*($*n)),this.opacity)}})),t.color=n,t.rgb=s,t.hsl=h,t.lab=m,t.hcl=w,t.cubehelix=A,Object.defineProperty(t,"__esModule",{value:!0})})},{}],115:[function(e,r,n){!function(e,i){"object"==typeof n&&void 0!==r?i(n):"function"==typeof t&&t.amd?t(["exports"],i):i(e.d3=e.d3||{})}(this,function(t){"use strict";function e(){for(var t,e=0,n=arguments.length,i={};e=0&&(r=t.slice(n+1),t=t.slice(0,n)),t&&!e.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:r}})}function i(t,e){for(var r,n=0,i=t.length;n0)for(var r,n,i=new Array(r),a=0;af+s||np+s||ih.index){var l=f-a.x-a.vx,c=p-a.y-a.vy,g=l*l+c*c;gt.r&&(t.r=t[e].r)}function i(){if(s){var e,r,n=s.length;for(l=new Array(n),e=0;e1?(null==e?p.remove(t):p.set(t,s(e)),l):p.get(t)},find:function(e,r,n){var i,a,o,s,l,u=0,c=t.length;for(null==n?n=1/0:n*=n,u=0;u1?(y.on(t,e),l):y.on(t)}}},b=function(){function t(t){var r,l=a.length,h=e.quadtree(a,u,c).visitAfter(n);for(s=t,r=0;r=m)){(t.data!==o||t.next)&&(0===i&&(i=d(),c+=i*i),0===a&&(a=d(),c+=a*a),c180||r<-180?r-360*Math.round(r/360):r):S(isNaN(t)?e:t)}function o(t){return 1==(t=+t)?s:function(e,r){return r-e?i(e,r,t):S(isNaN(e)?r:e)}}function s(t,e){var r=e-t;return r?n(t,r):S(isNaN(t)?e:t)}function l(t){return function(r){var n,i,a=r.length,o=new Array(a),s=new Array(a),l=new Array(a);for(n=0;n180?e+=360:e-t>180&&(t+=360),a.push({i:r.push(i(r)+"rotate(",null,n)-2,x:D(t,e)})):e&&r.push(i(r)+"rotate("+e+n)}function s(t,e,r,a){t!==e?a.push({i:r.push(i(r)+"skewX(",null,n)-2,x:D(t,e)}):e&&r.push(i(r)+"skewX("+e+n)}function l(t,e,r,n,a,o){if(t!==r||e!==n){var s=a.push(i(a)+"scale(",null,",",null,")");o.push({i:s-4,x:D(t,r)},{i:s-2,x:D(e,n)})}else 1===r&&1===n||a.push(i(a)+"scale("+r+","+n+")")}return function(e,r){var n=[],i=[];return e=t(e),r=t(r),a(e.translateX,e.translateY,r.translateX,r.translateY,n,i),o(e.rotate,r.rotate,n,i),s(e.skewX,r.skewX,n,i),l(e.scaleX,e.scaleY,r.scaleX,r.scaleY,n,i),e=r=null,function(t){for(var e,r=-1,a=i.length;++r=1?(n=1,e-1):Math.floor(n*e),a=t[i],o=t[i+1],s=i>0?t[i-1]:2*a-o,l=ia&&(i=e.slice(a,i),s[o]?s[o]+=i:s[++o]=i),(r=r[0])===(n=n[0])?s[o]?s[o]+=n:s[++o]=n:(s[++o]=null,l.push({i:o,x:D(r,n)})),a=R.lastIndex;return a=(a=(m+g)/2))?m=a:g=a,(c=r>=(o=(v+y)/2))?v=o:y=o,i=d,!(d=d[h=c<<1|u]))return i[h]=p,t;if(s=+t._x.call(null,d.data),l=+t._y.call(null,d.data),e===s&&r===l)return p.next=d,i?i[h]=p:t._root=p,t;do{i=i?i[h]=new Array(4):t._root=new Array(4),(u=e>=(a=(m+g)/2))?m=a:g=a,(c=r>=(o=(v+y)/2))?v=o:y=o}while((h=c<<1|u)==(f=(l>=o)<<1|s>=a));return i[f]=d,i[h]=p,t}function r(t){var r,n,i,a,o=t.length,s=new Array(o),l=new Array(o),u=1/0,c=1/0,h=-1/0,f=-1/0;for(n=0;nh&&(h=i),af&&(f=a));for(ht||t>i||n>e||e>a))return this;var o,s,l=i-r,u=this._root;switch(s=(e<(n+a)/2)<<1|t<(r+i)/2){case 0:do{o=new Array(4),o[s]=u,u=o}while(l*=2,i=r+l,a=n+l,t>i||e>a);break;case 1:do{o=new Array(4),o[s]=u,u=o}while(l*=2,r=i-l,a=n+l,r>t||e>a);break;case 2:do{o=new Array(4),o[s]=u,u=o}while(l*=2,i=r+l,n=a-l,t>i||n>e);break;case 3:do{o=new Array(4),o[s]=u,u=o}while(l*=2,r=i-l,n=a-l,r>t||n>e)}this._root&&this._root.length&&(this._root=u)}return this._x0=r,this._y0=n,this._x1=i,this._y1=a,this},h=function(){var t=[];return this.visit(function(e){if(!e.length)do{t.push(e.data)}while(e=e.next)}),t},f=function(t){return arguments.length?this.cover(+t[0][0],+t[0][1]).cover(+t[1][0],+t[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]},d=function(t,e,r,n,i){this.node=t,this.x0=e,this.y0=r,this.x1=n,this.y1=i},p=function(t,e,r){var n,i,a,o,s,l,u,c=this._x0,h=this._y0,f=this._x1,p=this._y1,m=[],v=this._root;for(v&&m.push(new d(v,c,h,f,p)),null==r?r=1/0:(c=t-r,h=e-r,f=t+r,p=e+r,r*=r);l=m.pop();)if(!(!(v=l.node)||(i=l.x0)>f||(a=l.y0)>p||(o=l.x1)=y)<<1|t>=g)&&(l=m[m.length-1],m[m.length-1]=m[m.length-1-u],m[m.length-1-u]=l)}else{var b=t-+this._x.call(null,v.data),x=e-+this._y.call(null,v.data),_=b*b+x*x;if(_=(s=(p+v)/2))?p=s:v=s,(c=o>=(l=(m+g)/2))?m=l:g=l,e=d,!(d=d[h=c<<1|u]))return this;if(!d.length)break;(e[h+1&3]||e[h+2&3]||e[h+3&3])&&(r=e,f=h)}for(;d.data!==t;)if(n=d,!(d=d.next))return this;return(i=d.next)&&delete d.next,n?(i?n.next=i:delete n.next,this):e?(i?e[h]=i:delete e[h],(d=e[0]||e[1]||e[2]||e[3])&&d===(e[3]||e[2]||e[1]||e[0])&&!d.length&&(r?r[f]=d:this._root=d),this):(this._root=i,this)},v=function(){return this._root},g=function(){var t=0;return this.visit(function(e){if(!e.length)do{++t}while(e=e.next)}),t},y=function(t){var e,r,n,i,a,o,s=[],l=this._root;for(l&&s.push(new d(l,this._x0,this._y0,this._x1,this._y1));e=s.pop();)if(!t(l=e.node,n=e.x0,i=e.y0,a=e.x1,o=e.y1)&&l.length){var u=(n+a)/2,c=(i+o)/2;(r=l[3])&&s.push(new d(r,u,c,a,o)),(r=l[2])&&s.push(new d(r,n,c,u,o)),(r=l[1])&&s.push(new d(r,u,i,a,c)),(r=l[0])&&s.push(new d(r,n,i,u,c))}return this},b=function(t){var e,r=[],n=[];for(this._root&&r.push(new d(this._root,this._x0,this._y0,this._x1,this._y1));e=r.pop();){var i=e.node;if(i.length){var a,o=e.x0,s=e.y0,l=e.x1,u=e.y1,c=(o+l)/2,h=(s+u)/2;(a=i[0])&&r.push(new d(a,o,s,c,h)),(a=i[1])&&r.push(new d(a,c,s,l,h)),(a=i[2])&&r.push(new d(a,o,h,c,u)),(a=i[3])&&r.push(new d(a,c,h,l,u))}n.push(e)}for(;e=n.pop();)t(e.node,e.x0,e.y0,e.x1,e.y1);return this},x=function(t){return arguments.length?(this._x=t,this):this._x},_=function(t){return arguments.length?(this._y=t,this):this._y},w=o.prototype=s.prototype;w.copy=function(){var t,e,r=new s(this._x,this._y,this._x0,this._y0,this._x1,this._y1),n=this._root;if(!n)return r;if(!n.length)return r._root=l(n),r;for(t=[{source:n,target:r._root=new Array(4)}];n=t.pop();)for(var i=0;i<4;++i)(e=n.source[i])&&(e.length?t.push({source:e,target:n.target[i]=new Array(4)}):n.target[i]=l(e));return r},w.add=u,w.addAll=r,w.cover=c,w.data=h,w.extent=f,w.find=p,w.remove=m,w.removeAll=n,w.root=v,w.size=g,w.visit=y,w.visitAfter=b,w.x=x,w.y=_,t.quadtree=o,Object.defineProperty(t,"__esModule",{value:!0})})},{}],119:[function(e,r,n){!function(e,i){"object"==typeof n&&void 0!==r?i(n):"function"==typeof t&&t.amd?t(["exports"],i):i(e.d3=e.d3||{})}(this,function(t){"use strict";function e(){return g||(x(r),g=b.now()+y)}function r(){g=0}function n(){this._call=this._time=this._next=null}function i(t,e,r){var i=new n;return i.restart(t,e,r),i}function a(){e(),++f;for(var t,r=c;r;)(t=g-r._time)>=0&&r._call.call(null,t),r=r._next;--f}function o(){g=(v=b.now())+y,f=d=0;try{a()}finally{f=0,l(),g=0}}function s(){var t=b.now(),e=t-v;e>m&&(y-=e,v=t)}function l(){for(var t,e,r=c,n=1/0;r;)r._call?(n>r._time&&(n=r._time),t=r,r=r._next):(e=r._next,r._next=null,r=t?t._next=e:c=e);h=t,u(n)}function u(t){if(!f){d&&(d=clearTimeout(d));var e=t-g;e>24?(t<1/0&&(d=setTimeout(o,e)),p&&(p=clearInterval(p))):(p||(v=g,p=setInterval(s,m)),f=1,x(o))}}var c,h,f=0,d=0,p=0,m=1e3,v=0,g=0,y=0,b="object"==typeof performance&&performance.now?performance:Date,x="function"==typeof requestAnimationFrame?requestAnimationFrame:function(t){setTimeout(t,17)};n.prototype=i.prototype={constructor:n,restart:function(t,r,n){if("function"!=typeof t)throw new TypeError("callback is not a function");n=(null==n?e():+n)+(null==r?0:+r),this._next||h===this||(h?h._next=this:c=this,h=this),this._call=t,this._time=n,u()},stop:function(){this._call&&(this._call=null,this._time=1/0,u())}};var _=function(t,e,r){var i=new n;return e=null==e?0:+e,i.restart(function(r){i.stop(),t(r+e)},e,r),i},w=function(t,r,i){var a=new n,o=r;return null==r?(a.restart(t,r,i),a):(r=+r,i=null==i?e():+i,a.restart(function e(n){n+=o,a.restart(e,o+=r,i),t(n)},r,i),a)};t.now=e,t.timer=i,t.timerFlush=a,t.timeout=_,t.interval=w,Object.defineProperty(t,"__esModule",{value:!0})})},{}],120:[function(e,r,n){!function(){function e(t){return t&&(t.ownerDocument||t.document||t).documentElement}function n(t){return t&&(t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView)}function i(t,e){return te?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,r,n,i){for(arguments.length<3&&(n=0),arguments.length<4&&(i=e.length);n>>1;t(e[a],r)<0?n=a+1:i=a}return n},right:function(e,r,n,i){for(arguments.length<3&&(n=0),arguments.length<4&&(i=e.length);n>>1;t(e[a],r)>0?i=a:n=a+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+="")===_o||t[0]===wo?wo+t:t}function d(t){return(t+="")[0]===wo?t.slice(1):t}function p(t){return f(t)in this._}function m(t){return(t=f(t))in this._&&delete this._[t]}function v(){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=Mo.length;r=e&&(e=i+1);!(o=s[e])&&++e0&&(t=t.slice(0,s));var u=Do.get(t);return u&&(t=u,l=J),s?e?i:n:e?M:a}function Z(t,e){return function(r){var n=uo.event;uo.event=r,e[0]=this.__data__;try{t.apply(this,e)}finally{uo.event=n}}}function J(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-"+ ++Oo,i="click"+r,a=uo.select(n(t)).on("touchmove"+r,T).on("dragstart"+r,T).on("selectstart"+r,T);if(null==Po&&(Po=!("onselectstart"in t)&&w(t.style,"userSelect")),Po){var o=e(t).style,s=o[Po];o[Po]="none"}return function(t){if(a.on(r,null),Po&&(o[Po]=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 r=t.ownerSVGElement||t;if(r.createSVGPoint){var i=r.createSVGPoint();if(Ro<0){var a=n(t);if(a.scrollX||a.scrollY){r=uo.select("body").append("svg").style({position:"absolute",top:0,left:0,margin:0,padding:0,border:"none"},"important");var o=r[0][0].getScreenCTM();Ro=!(o.f||o.e),r.remove()}}return Ro?(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 uo.event.changedTouches[0].identifier}function tt(t){return t>0?1:t<0?-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:t<-1?No:Math.acos(t)}function nt(t){return t>1?Vo:t<-1?-Vo: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,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:t<0&&(t+=360),t<60?a+(o-a)*t/60:t<180?o:t<240?a+(o-a)*(240-t)/60:a}function i(t){return Math.round(255*n(t))}var a,o;return t=isNaN(t)?0:(t%=360)<0?t+360:t,e=isNaN(e)?0:e<0?0:e>1?1:e,r=r<0?0:r>1?1:r,o=r<=.5?r*(1+e):r+e-r*e,a=2*r-o,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?mt(t.l,t.a,t.b):mt((t=At((t=uo.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*=Ho)*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,a=n-r/200;return i=vt(i)*Qo,n=vt(n)*$o,a=vt(a)*ts,new bt(yt(3.2404542*i-1.5371385*n-.4985314*a),yt(-.969266*i+1.8760108*n+.041556*a),yt(.0556434*i-.2040259*n+1.0572252*a))}function mt(t,e,r){return t>0?new ht(Math.atan2(r,e)*qo,Math.sqrt(e*e+r*r),t):new ht(NaN,NaN,t)}function vt(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*(t<=.00304?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 t<16?"0"+Math.max(0,t).toString(16):Math.min(255,t).toString(16)}function Mt(t,e,r){var n,i,a,o=0,s=0,l=0;if(n=/([a-z]+)\((.*)\)/.exec(t=t.toLowerCase()))switch(i=n[2].split(","),n[1]){case"hsl":return r(parseFloat(i[0]),parseFloat(i[1])/100,parseFloat(i[2])/100);case"rgb":return e(St(i[0]),St(i[1]),St(i[2]))}return(a=ns.get(t))?e(a.r,a.g,a.b):(null==t||"#"!==t.charAt(0)||isNaN(a=parseInt(t.slice(1),16))||(4===t.length?(o=(3840&a)>>4,o|=o>>4,s=240&a,s|=s>>4,l=15&a,l|=l<<4):7===t.length&&(o=(16711680&a)>>16,s=(65280&a)>>8,l=255&a)),e(o,s,l))}function kt(t,e,r){var n,i,a=Math.min(t/=255,e/=255,r/=255),o=Math.max(t,e,r),s=o-a,l=(o+a)/2;return s?(i=l<.5?s/(o+a):s/(2-o-a),n=t==o?(e-r)/s+(e0&&l<1?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)/Qo),i=gt((.2126729*t+.7151522*e+.072175*r)/$o);return dt(116*i-16,500*(n-i),200*(i-gt((.0193339*t+.119192*e+.9503041*r)/ts)))}function Tt(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function St(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,r,n){return 2===arguments.length&&"function"==typeof r&&(n=r,r=null),Ct(e,r,t,n)}}function Ct(t,e,r,n){function i(){var t,e=l.status;if(!e&&It(l)||e>=200&&e<300||304===e){try{t=r.call(a,l)}catch(t){return void o.error.call(a,t)}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 r=t,a},["get","post"].forEach(function(t){a[t]=function(){return a.send.apply(a,[t].concat(ho(arguments)))}}),a.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&&a.on("error",i).on("load",function(t){i(null,t)}),o.beforesend.call(a,l),l.send(null==n?null:n),a},a.abort=function(){return l.abort(),a},uo.rebind(a,o,"on"),null==n?a:a.get(zt(n))}function zt(t){return 1===t.length?function(e,r){t(null==e?r:null)}:t}function It(t){var e=t.responseType;return e&&"text"!==e?t.response:t.responseText}function Dt(t,e,r){var n=arguments.length;n<2&&(e=0),n<3&&(r=Date.now());var i=r+e,a={c:t,t:i,n:null};return as?as.n=a:is=a,as=a,os||(ss=clearTimeout(ss),os=1,ls(Pt)),a}function Pt(){var t=Ot(),e=Rt()-t;e>24?(isFinite(e)&&(clearTimeout(ss),ss=setTimeout(Pt,e)),os=0):(os=1,ls(Pt))}function Ot(){for(var t=Date.now(),e=is;e;)t>=e.t&&e.c(t-e.t)&&(e.c=null),e=e.n;return t}function Rt(){for(var t,e=is,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,a=n&&r?function(t,e){for(var i=t.length,a=[],o=0,s=n[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=n[o=(o+1)%n.length];return a.reverse().join(r)}:x;return function(t){var r=cs.exec(t),n=r[1]||" ",o=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,m="",v="",g=!1,y=!0;switch(f&&(f=+f.substring(1)),(u||"0"===n&&"="===o)&&(u=n="0",o="="),d){case"n":h=!0,d="g";break;case"%":p=100,v="%",d="f";break;case"p":p=100,v="%",d="r";break;case"b":case"o":case"x":case"X":"#"===l&&(m="0"+d.toLowerCase());case"c":y=!1;case"d":g=!0,f=0;break;case"s":p=-1,d="r"}"$"===l&&(m=i[0],v=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=hs.get(d)||Bt;var b=u&&h;return function(t){var r=v;if(g&&t%1)return"";var i=t<0||0===t&&1/t<0?(t=-t,"-"):"-"===s?"":s;if(p<0){var l=uo.formatPrefix(t,f);t=l.scale(t),r=l.symbol+v}else t*=p;t=d(t,f);var x,_,w=t.lastIndexOf(".");if(w<0){var M=y?t.lastIndexOf("e"):-1;M<0?(x=t,_=""):(x=t.substring(0,M),_=t.substring(M))}else x=t.substring(0,w),_=e+t.substring(w+1);!u&&h&&(x=a(x,1/0));var k=m.length+x.length+_.length+(b?0:i.length),A=k"===o?A+i+t:"^"===o?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=a(r,1);return e-r1)for(;o=u)return-1;if(37===(i=e.charCodeAt(s++))){if(o=e.charAt(s++),!(a=L[o in ms?e.charAt(s++):o])||(n=a(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 a(t,e,r){T.lastIndex=0;var n=T.exec(e.slice(r));return n?(t.m=S.get(n[0].toLowerCase()),r+n[0].length):-1}function o(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,E.c.toString(),e,n)}function l(t,e,n){return r(t,E.x.toString(),e,n)}function u(t,e,n){return r(t,E.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,m=t.days,v=t.shortDays,g=t.months,y=t.shortMonths;e.utc=function(t){function r(t){try{ds=Ut;var e=new ds;return e._=t,n(e)}finally{ds=Date}}var n=e(t);return r.parse=function(t){try{ds=Ut;var e=n.parse(t);return e&&e._}finally{ds=Date}},r.toString=n.toString,r},e.multi=e.utc.multi=ce;var b=uo.map(),x=Yt(m),_=Xt(m),w=Yt(v),M=Xt(v),k=Yt(g),A=Xt(g),T=Yt(y),S=Xt(y);p.forEach(function(t,e){b.set(t.toLowerCase(),e)});var E={a:function(t){return v[t.getDay()]},A:function(t){return m[t.getDay()]},b:function(t){return y[t.getMonth()]},B:function(t){return g[t.getMonth()]},c:e(h),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+fs.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(fs.sundayOfYear(t),e,2)},w:function(t){return t.getDay()},W:function(t,e){return Gt(fs.mondayOfYear(t),e,2)},x:e(f),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"%"}},L={a:n,A:i,b:a,B:o,c:s,d:re,e:re,H:ie,I:ie,j:ne,L:se,m:ee,M:ae,p:c,S:oe,U:Zt,w:Wt,W:Jt,x:l,X:u,y:Qt,Y:Kt,Z:$t,"%":ue};return e}function Gt(t,e,r){var n=t<0?"-":"",i=(n?-t:t)+"",a=i.length;return n+(a68?1900:2e3)}function ee(t,e,r){vs.lastIndex=0;var n=vs.exec(e.slice(r,r+2));return n?(t.m=n[0]-1,r+n[0].length):-1}function re(t,e,r){vs.lastIndex=0;var n=vs.exec(e.slice(r,r+2));return n?(t.d=+n[0],r+n[0].length):-1}function ne(t,e,r){vs.lastIndex=0;var n=vs.exec(e.slice(r,r+3));return n?(t.j=+n[0],r+n[0].length):-1}function ie(t,e,r){vs.lastIndex=0;var n=vs.exec(e.slice(r,r+2));return n?(t.H=+n[0],r+n[0].length):-1}function ae(t,e,r){vs.lastIndex=0;var n=vs.exec(e.slice(r,r+2));return n?(t.M=+n[0],r+n[0].length):-1}function oe(t,e,r){vs.lastIndex=0;var n=vs.exec(e.slice(r,r+2));return n?(t.S=+n[0],r+n[0].length):-1}function se(t,e,r){vs.lastIndex=0;var n=vs.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=xo(e)/60|0,i=xo(e)%60;return r+Gt(n,"0",2)+Gt(i,"0",2)}function ue(t,e,r){gs.lastIndex=0;var n=gs.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=o*r,l=Math.cos(e),u=Math.sin(e),c=a*u,h=i*l+c*Math.cos(s),f=c*o*Math.sin(s);Ms.add(Math.atan2(f,h)),n=t,i=l,a=u}var e,r,n,i,a;ks.point=function(o,s){ks.point=t,n=(e=o)*Ho,i=Math.cos(s=(r=s)*Ho/2+No/4),a=Math.sin(s)},ks.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 xo(t[0]-e[0])=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 De(t){if(e=t.length){for(var e,r,n=0,i=t[0];++n0){for(_||(a.polygonStart(),_=!0),a.lineStart();++o1&&2&e&&r.push(r.pop().concat(r.shift())),d.push(r.filter(Re))}var d,p,m,v=e(a),g=i.invert(n[0],n[1]),y={point:o,lineStart:l,lineEnd:u,polygonStart:function(){y.point=c,y.lineStart=h,y.lineEnd=f,d=[],p=[]},polygonEnd:function(){y.point=o,y.lineStart=l,y.lineEnd=u,d=uo.merge(d);var t=Ve(g,p);d.length?(_||(a.polygonStart(),_=!0),Ie(d,je,t,r,a)):t&&(_||(a.polygonStart(),_=!0),a.lineStart(),r(null,null,1,a),a.lineEnd()),_&&(a.polygonEnd(),_=!1),d=p=null},sphere:function(){a.polygonStart(),a.lineStart(),r(null,null,1,a),a.lineEnd(),a.polygonEnd()}},b=Fe(),x=e(b),_=!1;return y}}function Re(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]-Vo-Fo:Vo-t[1])-((e=e.x)[0]<0?e[1]-Vo-Fo:Vo-e[1])}function Ne(t){var e,r=NaN,n=NaN,i=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(a,o){var s=a>0?No:-No,l=xo(a-r);xo(l-No)0?Vo:-Vo),t.point(i,n),t.lineEnd(),t.lineStart(),t.point(s,n),t.point(a,n),e=0):i!==s&&l>=No&&(xo(r-i)Fo?Math.atan((Math.sin(e)*(a=Math.cos(n))*Math.sin(r)-Math.sin(n)*(i=Math.cos(e))*Math.sin(t))/(i*a*o)):(e+n)/2}function Ue(t,e,r,n){var i;if(null==t)i=r*Vo,n.point(-No,i),n.point(0,i),n.point(No,i),n.point(No,0),n.point(No,-i),n.point(0,-i),n.point(-No,-i),n.point(-No,0),n.point(-No,i);else if(xo(t[0]-e[0])>Fo){var a=t[0]=0?1:-1,M=w*_,k=M>No,A=p*b;if(Ms.add(Math.atan2(A*w*Math.sin(M),m*x+A*Math.cos(M))),a+=k?_+w*Bo:_,k^f>=r^g>=r){var T=be(ge(h),ge(t));we(T);var S=be(i,T);we(S);var E=(k^_>=0?-1:1)*nt(S[2]);(n>E||n===E&&(T[0]||T[1]))&&(o+=k^_>=0?1:-1)}if(!v++)break;f=g,p=b,m=x,h=t}}return(a<-Fo||aa}function r(t){var r,a,l,u,c;return{lineStart:function(){u=l=!1,c=1},point:function(h,f){var d,p=[h,f],m=e(h,f),v=o?m?0:i(h,f):m?i(h+(h<0?No:-No),f):0;if(!r&&(u=l=m)&&t.lineStart(),m!==l&&(d=n(r,p),(ke(r,d)||ke(p,d))&&(p[0]+=Fo,p[1]+=Fo,m=e(p[0],p[1]))),m!==l)c=0,m?(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&&o^m){var g;v&a||!(g=n(p,r,!0))||(c=0,o?(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])))}!m||r&&ke(r,p)||t.point(p[0],p[1]),r=p,l=m,a=v},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),o=[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=a*l/c,f=-a*u/c,d=be(o,s),p=_e(o,h);xe(p,_e(s,f));var m=d,v=ye(p,m),g=ye(m,m),y=v*v-g*(ye(p,p)-1);if(!(y<0)){var b=Math.sqrt(y),x=_e(m,(-v-b)/g);if(xe(x,p),x=Me(x),!r)return x;var _,w=t[0],M=e[0],k=t[1],A=e[1];M0^x[1]<(xo(x[0]-w)No^(w<=x[0]&&x[0]<=M)){var L=_e(m,(-v+b)/g);return xe(L,p),[x,Me(L)]}}}function i(e,r){var n=o?t:No-t,i=0;return e<-n?i|=1:e>n&&(i|=2),r<-n?i|=4:r>n&&(i|=8),i}var a=Math.cos(t),o=a>0,s=xo(a)>Fo;return Oe(e,r,vr(t,6*Ho),o?[0,-t]:[-No,t-No])}function qe(t,e,r,n){return function(i){var a,o=i.a,s=i.b,l=o.x,u=o.y,c=s.x,h=s.y,f=0,d=1,p=c-l,m=h-u;if(a=t-l,p||!(a>0)){if(a/=p,p<0){if(a0){if(a>d)return;a>f&&(f=a)}if(a=r-l,p||!(a<0)){if(a/=p,p<0){if(a>d)return;a>f&&(f=a)}else if(p>0){if(a0)){if(a/=m,m<0){if(a0){if(a>d)return;a>f&&(f=a)}if(a=n-u,m||!(a<0)){if(a/=m,m<0){if(a>d)return;a>f&&(f=a)}else if(m>0){if(a0&&(i.a={x:l+f*p,y:u+f*m}),d<1&&(i.b={x:l+d*p,y:u+d*m}),i}}}}}}function Ge(t,e,r,n){function i(n,i){return xo(n[0]-t)0?0:3:xo(n[0]-r)0?2:1:xo(n[1]-e)0?1:0:i>0?3:2}function a(t,e){return o(t.x,e.x)}function o(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=v.length,n=t[1],i=0;in&&et(u,a,t)>0&&++e:a[1]<=n&&et(u,a,t)<0&&--e,u=a;return 0!==e}function u(a,s,l,u){var c=0,h=0;if(null==a||(c=i(a,l))!==(h=i(s,l))||o(a,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,a){return t<=i&&i<=r&&e<=a&&a<=n}function h(t,e){c(t,e)&&s.point(t,e)}function f(){L.point=p,v&&v.push(g=[]),k=!0,M=!1,_=w=NaN}function d(){m&&(p(y,b),x&&M&&S.rejoin(),m.push(S.buffer())),L.point=h,M&&s.lineEnd()}function p(t,e){t=Math.max(-js,Math.min(js,t)),e=Math.max(-js,Math.min(js,e));var r=c(t,e);if(v&&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}};E(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,v,g,y,b,x,_,w,M,k,A,T=s,S=Fe(),E=qe(t,e,r,n),L={point:h,lineStart:f,lineEnd:d,polygonStart:function(){s=S,m=[],v=[],A=!0},polygonEnd:function(){s=T,m=uo.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&&Ie(m,a,e,u,s),s.polygonEnd()),m=v=g=null}};return L}}function Ye(t){var e=0,r=No/3,n=lr(t),i=n(e,r);return i.parallels=function(t){return arguments.length?n(e=t[0]*No/180,r=t[1]*No/180):[e/No*180,r/No*180]},i}function Xe(t,e){function r(t,e){var r=Math.sqrt(a-2*i*Math.sin(e))/i;return[r*Math.sin(t*=i),o-r*Math.cos(t)]}var n=Math.sin(t),i=(n+Math.sin(e))/2,a=1+n*(2*i-n),o=Math.sqrt(a)/i;return r.invert=function(t,e){var r=o-e;return[Math.atan2(t,r)/i,nt((a-(t*t+r*r)*i*i)/(2*i))]},r}function We(){function t(t,e){Bs+=i*t-n*e,n=t,i=e}var e,r,n,i;Gs.point=function(a,o){Gs.point=t,e=n=a,r=i=o},Gs.lineEnd=function(){t(e,r)}}function Ze(t,e){tHs&&(Hs=t),eqs&&(qs=e)}function Je(){function t(t,e){o.push("M",t,",",e,a)}function e(t,e){o.push("M",t,",",e),s.point=r}function r(t,e){o.push("L",t,",",e)}function n(){s.point=t}function i(){o.push("Z")}var a=Ke(4.5),o=[],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 a=Ke(t),s},result:function(){if(o.length){var t=o.join("");return o=[],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 Qe(t,e){Ss+=t,Es+=e,++Ls}function $e(){function t(t,n){var i=t-e,a=n-r,o=Math.sqrt(i*i+a*a);Cs+=o*(e+t)/2,zs+=o*(r+n)/2,Is+=o,Qe(e=t,r=n)}var e,r;Xs.point=function(n,i){Xs.point=t,Qe(e=n,r=i)}}function tr(){Xs.point=Qe}function er(){function t(t,e){var r=t-n,a=e-i,o=Math.sqrt(r*r+a*a);Cs+=o*(n+t)/2,zs+=o*(i+e)/2,Is+=o,o=i*t-n*e,Ds+=o*(n+t),Ps+=o*(i+e),Os+=3*o,Qe(n=t,i=e)}var e,r,n,i;Xs.point=function(a,o){Xs.point=t,Qe(e=n=a,r=i=o)},Xs.lineEnd=function(){t(e,r)}}function rr(t){function e(e,r){t.moveTo(e+o,r),t.arc(e,r,o,0,Bo)}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 a(){t.closePath()}var o=4.5,s={point:e,lineStart:function(){s.point=r},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 nr(t){function e(t){return(s?n:r)(t)}function r(e){return or(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=a,e.lineStart()}function a(r,n){var a=ge([r,n]),o=t(r,n);i(b,x,y,_,w,M,b=o[0],x=o[1],y=r,_=a[0],w=a[1],M=a[2],s,e),e.point(b,x)}function o(){k.point=r,e.lineEnd()}function l(){n(),k.point=u,k.lineEnd=c}function u(t,e){a(h=t,f=e),d=b,p=x,m=_,v=w,g=M,k.point=a}function c(){i(b,x,y,_,w,M,d,p,h,m,v,g,s,e),k.lineEnd=o,o()}var h,f,d,p,m,v,g,y,b,x,_,w,M,k={point:r,lineStart:n,lineEnd:o,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,m,v,g){var y=c-e,b=h-r,x=y*y+b*b;if(x>4*a&&v--){var _=s+d,w=l+p,M=u+m,k=Math.sqrt(_*_+w*w+M*M),A=Math.asin(M/=k),T=xo(xo(M)-1)a||xo((y*C+b*z)/x-.5)>.3||s*d+l*p+u*m0&&16,e):Math.sqrt(a)},e}function ir(t){var e=nr(function(e,r){return t([e*qo,r*qo])});return function(t){return ur(e(t))}}function ar(t){this.stream=t}function or(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]*Ho,t[1]*Ho),[t[0]*f+l,u-t[1]*f]}function r(t){return(t=s.invert((t[0]-l)/f,(u-t[1])/f))&&[t[0]*qo,t[1]*qo]}function n(){s=Ce(o=fr(g,y,b),a);var t=a(m,v);return l=d-t[0]*f,u=p+t[1]*f,i()}function i(){return c&&(c.valid=!1,c=null),e}var a,o,s,l,u,c,h=nr(function(t,e){return t=a(t,e),[t[0]*f+l,u-t[1]*f]}),f=150,d=480,p=250,m=0,v=0,g=0,y=0,b=0,_=Fs,w=x,M=null,k=null;return e.stream=function(t){return c&&(c.valid=!1),c=ur(_(o,h(w(t)))),c.valid=!0,c},e.clipAngle=function(t){return arguments.length?(_=null==t?(M=t,Fs):He((M=+t)*Ho),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]):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?(m=t[0]%360*Ho,v=t[1]%360*Ho,n()):[m*qo,v*qo]},e.rotate=function(t){return arguments.length?(g=t[0]%360*Ho,y=t[1]%360*Ho,b=t.length>2?t[2]%360*Ho:0,n()):[g*qo,y*qo,b*qo]},uo.rebind(e,h,"precision"),function(){return a=t.apply(this,arguments),e.invert=a.invert&&r,n()}}function ur(t){return or(t,function(e,r){t.point(e*Ho,r*Ho)})}function cr(t,e){return[t,e]}function hr(t,e){return[t>No?t-Bo:t<-No?t+Bo:t,e]}function fr(t,e,r){return t?e||r?Ce(pr(t),mr(e,r)):pr(t):e||r?mr(e,r):hr}function dr(t){return function(e,r){return e+=t,[e>No?e-Bo:e<-No?e+Bo:e,r]}}function pr(t){var e=dr(t);return e.invert=dr(-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*a-c*o,s*n-u*i),nt(c*a+l*o)]}var n=Math.cos(t),i=Math.sin(t),a=Math.cos(e),o=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*a-l*o;return[Math.atan2(l*a+u*o,s*n+c*i),nt(c*n-s*i)]},r}function vr(t,e){var r=Math.cos(t),n=Math.sin(t);return function(i,a,o,s){var l=o*e;null!=i?(i=gr(r,i),a=gr(r,a),(o>0?ia)&&(i+=o*Bo)):(i=t+o*Bo,a=t-.5*l);for(var u,c=i;o>0?c>a:c0?e<-Vo+Fo&&(e=-Vo+Fo):e>Vo-Fo&&(e=Vo-Fo);var r=o/Math.pow(i(e),a);return[r*Math.sin(a*t),o-r*Math.cos(a*t)]}var n=Math.cos(t),i=function(t){return Math.tan(No/4+t/2)},a=t===e?Math.sin(t):Math.log(n/Math.cos(e))/Math.log(i(e)/i(t)),o=n*Math.pow(i(t),a)/a;return a?(r.invert=function(t,e){var r=o-e,n=tt(a)*Math.sqrt(t*t+r*r);return[Math.atan2(t,r)/a,2*Math.atan(Math.pow(o/n,1/a))-Vo]},r):Sr}function Tr(t,e){function r(t,e){var r=a-e;return[r*Math.sin(i*t),a-r*Math.cos(i*t)]}var n=Math.cos(t),i=t===e?Math.sin(t):(n-Math.cos(e))/(e-t),a=n/i+t;return xo(i)1&&et(t[r[n-2]],t[r[n-1]],t[i])<=0;)--n;r[n++]=i}return r.slice(0,n)}function Dr(t,e){return t[0]-e[0]||t[1]-e[1]}function Pr(t,e,r){return(r[0]-e[0])*(t[1]-e[1])<(r[1]-e[1])*(t[0]-e[0])}function Or(t,e,r,n){var i=t[0],a=r[0],o=e[0]-i,s=n[0]-a,l=t[1],u=r[1],c=e[1]-l,h=n[1]-u,f=(s*(l-u)-h*(i-a))/(h*o-s*c);return[i+f*o,l+f*c]}function Rr(t){var e=t[0],r=t[t.length-1];return!(e[0]-r[0]||e[1]-r[1])}function Fr(){an(this),this.edge=this.site=this.circle=null}function jr(t){var e=sl.pop()||new Fr;return e.site=t,e}function Nr(t){Zr(t),il.remove(t),sl.push(t),an(t)}function Br(t){var e=t.circle,r=e.x,n=e.cy,i={x:r,y:n},a=t.P,o=t.N,s=[t];Nr(t);for(var l=a;l.circle&&xo(r-l.circle.x)Fo)s=s.L;else{if(!((i=a-Hr(s,o))>Fo)){n>-Fo?(e=s.P,r=s):i>-Fo?(e=s,r=s.N):e=r=s;break}if(!s.R){e=s;break}s=s.R}var l=jr(t);if(il.insert(e,l),e||r){if(e===r)return Zr(e),r=jr(e.site),il.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,d=t.y-h,p=r.site,m=p.x-c,v=p.y-h,g=2*(f*v-d*m),y=f*f+d*d,b=m*m+v*v,x={x:(v*y-d*b)/g+c,y:(f*b-m*y)/g+h};en(r.edge,u,p,x),l.edge=$r(u,t,null,x),r.edge=$r(t,p,null,x),Wr(e),Wr(r)}}function Vr(t,e){var r=t.site,n=r.x,i=r.y,a=i-e;if(!a)return n;var o=t.P;if(!o)return-1/0;r=o.site;var s=r.x,l=r.y,u=l-e;if(!u)return s;var c=s-n,h=1/a-1/u,f=c/u;return h?(-f+Math.sqrt(f*f-2*h*(c*c/(-2*u)-l+u/2+i-a/2)))/h+n:(n+s)/2}function Hr(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 qr(t){this.site=t,this.edges=[]}function Gr(t){for(var e,r,n,i,a,o,s,l,u,c,h=t[0][0],f=t[1][0],d=t[0][1],p=t[1][1],m=nl,v=m.length;v--;)if((a=m[v])&&a.prepare())for(s=a.edges,l=s.length,o=0;oFo||xo(i-r)>Fo)&&(s.splice(o,0,new rn(tn(a.site,c,xo(n-h)Fo?{x:h,y:xo(e-h)Fo?{x:xo(r-p)Fo?{x:f,y:xo(e-f)Fo?{x:xo(r-d)=-jo)){var d=l*l+u*u,p=c*c+h*h,m=(h*d-u*p)/f,v=(l*p-c*d)/f,h=v+s,g=ll.pop()||new Xr;g.arc=t,g.site=i,g.x=m+o,g.y=h+Math.sqrt(m*m+v*v),g.cy=h,t.circle=g;for(var y=null,b=ol._;b;)if(g.y=s)return;if(f>p){if(a){if(a.y>=u)return}else a={x:v,y:l};r={x:v,y:u}}else{if(a){if(a.y1)if(f>p){if(a){if(a.y>=u)return}else a={x:(l-i)/n,y:l};r={x:(u-i)/n,y:u}}else{if(a){if(a.y=s)return}else a={x:o,y:n*o+i};r={x:s,y:n*s+i}}else{if(a){if(a.xa||h>o||f=x,M=r>=_,k=M<<1|w,A=k+4;ka&&(i=e.slice(a,i),s[o]?s[o]+=i:s[++o]=i),(r=r[0])===(n=n[0])?s[o]?s[o]+=n:s[++o]=n:(s[++o]=null,l.push({i:o,x:bn(r,n)})),a=hl.lastIndex;return a=0&&!(r=uo.interpolators[n](t,e)););return r}function wn(t,e){var r,n=[],i=[],a=t.length,o=e.length,s=Math.min(t.length,e.length);for(r=0;r=1?1:t(e)}}function kn(t){return function(e){return 1-t(1-e)}}function An(t){return function(e){return.5*(e<.5?t(2*e):2-t(2-2*e))}}function Tn(t){return t*t}function Sn(t){return t*t*t}function En(t){if(t<=0)return 0;if(t>=1)return 1;var e=t*t,r=e*t;return 4*(t<.5?r:3*(t-e)+r-.75)}function Ln(t){return function(e){return Math.pow(e,t)}}function Cn(t){return 1-Math.cos(t*Vo)}function zn(t){return Math.pow(2,10*(t-1))}function In(t){return 1-Math.sqrt(1-t*t)}function Dn(t,e){var r;return arguments.length<2&&(e=.45),arguments.length?r=e/Bo*Math.asin(1/t):(t=1,r=e/4),function(n){return 1+t*Math.pow(2,-10*n)*Math.sin((n-r)*Bo/e)}}function Pn(t){return t||(t=1.70158),function(e){return e*e*((t+1)*e-t)}}function On(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375}function Rn(t,e){t=uo.hcl(t),e=uo.hcl(e);var r=t.h,n=t.c,i=t.l,a=e.h-r,o=e.c-n,s=e.l-i;return isNaN(o)&&(o=0,n=isNaN(n)?e.c:n),isNaN(a)?(a=0,r=isNaN(r)?e.h:r):a>180?a-=360:a<-180&&(a+=360),function(t){return ft(r+a*t,n+o*t,i+s*t)+""}}function Fn(t,e){t=uo.hsl(t),e=uo.hsl(e);var r=t.h,n=t.s,i=t.l,a=e.h-r,o=e.s-n,s=e.l-i;return isNaN(o)&&(o=0,n=isNaN(n)?e.s:n),isNaN(a)?(a=0,r=isNaN(r)?e.h:r):a>180?a-=360:a<-180&&(a+=360),function(t){return ct(r+a*t,n+o*t,i+s*t)+""}}function jn(t,e){t=uo.lab(t),e=uo.lab(e);var r=t.l,n=t.a,i=t.b,a=e.l-r,o=e.a-n,s=e.b-i;return function(t){return pt(r+a*t,n+o*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),a=Vn(Hn(r,e,-i))||0;e[0]*r[1]180?e+=360:e-t>180&&(t+=360),n.push({i:r.push(qn(r)+"rotate(",null,")")-2,x:bn(t,e)})):e&&r.push(qn(r)+"rotate("+e+")")}function Xn(t,e,r,n){t!==e?n.push({i:r.push(qn(r)+"skewX(",null,")")-2,x:bn(t,e)}):e&&r.push(qn(r)+"skewX("+e+")")}function Wn(t,e,r,n){if(t[0]!==e[0]||t[1]!==e[1]){var i=r.push(qn(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(qn(r)+"scale("+e+")")}function Zn(t,e){var r=[],n=[];return t=uo.transform(t),e=uo.transform(e),Gn(t.translate,e.translate,r,n),Yn(t.rotate,e.rotate,r,n),Xn(t.skew,e.skew,r,n),Wn(t.scale,e.scale,r,n),t=e=null,function(t){for(var e,i=-1,a=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),(a=t.children)&&(i=a.length))for(var i,a,o=-1;++oi&&(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,a=[];++r<=e;)a[r]=i*r+n;return a}function Mi(t){return[uo.min(t),uo.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 Si(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 Ei(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,a,o,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(a=r[2],Ii(n,i,a),e(a),Ai(n,a),n._pack_prev=a,Ai(a,i),i=n._pack_next,o=3;o=0;)e=i[a],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+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 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 Hi(t){return{x:t.x,y:t.y,dx:t.dx,dy:t.dy}}function qi(t,e){var r=t.x+e[3],n=t.y+e[0],i=t.dx-e[1]-e[3],a=t.dy-e[0]-e[2];return i<0&&(r+=i/2,i=0),a<0&&(n+=a/2,a=0),{x:r,y:n,dx:i,dy:a}}function Gi(t){var e=t[0],r=t[t.length-1];return e2?Ji:Xi,l=n?Kn:Jn;return o=i(t,e,l,r),s=i(e,t,l,_n),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(Nn)},a.clamp=function(t){return arguments.length?(n=t,i()):n},a.interpolate=function(t){return arguments.length?(r=t,i()):r},a.ticks=function(e){return ea(t,e)},a.tickFormat=function(e,r){return ra(t,e,r)},a.nice=function(e){return $i(t,e),i()},a.copy=function(){return Ki(t,e,r,n)},i()}function Qi(t,e){return uo.rebind(t,e,"range","rangeRound","interpolate","clamp")}function $i(t,e){return Wi(t,Zi(ta(t,e)[2])),Wi(t,Zi(ta(t,e)[2])),t}function ta(t,e){null==e&&(e=10);var r=Gi(t),n=r[1]-r[0],i=Math.pow(10,Math.floor(Math.log(n/e)/Math.LN10)),a=e/n*i;return a<=.15?i*=10:a<=.35?i*=5:a<=.75&&(i*=2),r[0]=Math.ceil(r[0]/i)*i,r[1]=Math.floor(r[1]/i)*i+.5*i,r[2]=i,r}function ea(t,e){return uo.range.apply(uo,ta(t,e))}function ra(t,e,r){var n=ta(t,e);if(r){var i=cs.exec(r);if(i.shift(),"s"===i[8]){var a=uo.formatPrefix(Math.max(xo(n[0]),xo(n[1])));return i[7]||(i[7]="."+na(a.scale(n[2]))),i[8]="f",r=uo.format(i.join("")),function(t){return r(a.scale(t))+a.symbol}}i[7]||(i[7]="."+ia(i[8],n)),r=i.join("")}else r=",."+na(n[2])+"f";return uo.format(r)}function na(t){return-Math.floor(Math.log(t)/Math.LN10+.01)}function ia(t,e){var r=na(e[2]);return t in Ml?Math.abs(r-na(Math.max(xo(e[0]),xo(e[1]))))+ +("e"!==t):r-2*("%"===t)}function aa(t,e,r,n){function i(t){return(r?Math.log(t<0?0:t):-Math.log(t>0?0:-t))/Math.log(e)}function a(t){return r?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?(r=e[0]>=0,t.domain((n=e.map(Number)).map(i)),o):n},o.base=function(r){return arguments.length?(e=+r,t.domain(n.map(i)),o):e},o.nice=function(){var e=Wi(n.map(i),r?Math:Al);return t.domain(e),n=e.map(a),o},o.ticks=function(){var t=Gi(n),o=[],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(;u0;f--)o.push(a(u)*f);for(u=0;o[u]l;c--);o=o.slice(u,c)}return o},o.tickFormat=function(t,r){if(!arguments.length)return kl;arguments.length<2?r=kl:"function"!=typeof r&&(r=uo.format(r));var n=Math.max(1,e*t/o.ticks().length);return function(t){var o=t/a(Math.round(i(t)));return o*e0?s[r-1]:t[0],r0?0:1}function xa(t,e,r,n,i){var a=t[0]-e[0],o=t[1]-e[1],s=(i?n:-n)/Math.sqrt(a*a+o*o),l=s*o,u=-s*a,c=t[0]+l,h=t[1]+u,f=e[0]+l,d=e[1]+u,p=(c+f)/2,m=(h+d)/2,v=f-c,g=d-h,y=v*v+g*g,b=r-n,x=c*d-f*h,_=(g<0?-1:1)*Math.sqrt(Math.max(0,b*b*y-x*x)),w=(x*g-v*_)/y,M=(-x*v-g*_)/y,k=(x*g+v*_)/y,A=(-x*v+g*_)/y,T=w-p,S=M-m,E=k-p,L=A-m;return T*T+S*S>E*E+L*L&&(w=k,M=A),[[w-l,M-u],[w*r/b,M*r/b]]}function _a(t){function e(e){function o(){u.push("M",a(t(c),s))}for(var l,u=[],c=[],h=-1,f=e.length,d=Et(r),p=Et(n);++h1?t.join("L"):t+"Z"}function Ma(t){return t.join("L")+"Z"}function ka(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 Aa(t){for(var e=0,r=t.length,n=t[0],i=[n[0],",",n[1]];++e1){s=e[1],a=t[l],l++,n+="C"+(i[0]+o[0])+","+(i[1]+o[1])+","+(a[0]-s[0])+","+(a[1]-s[1])+","+a[0]+","+a[1];for(var u=2;u9&&(i=3*e/Math.sqrt(i),o[s]=i*r,o[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+o[s]*o[s])),a.push([i||0,o[s]*i||0]);return a}function Ua(t){return t.length<3?wa(t):t[0]+Ca(t,Ba(t))}function Va(t){for(var e,r,n,i=-1,a=t.length;++i0;)d[--s].call(t,o);if(a>=1)return m.event&&m.event.end.call(t,t.__data__,e),--p.count?delete p[n]:delete t[r],1}var l,u,c,f,d,p=t[r]||(t[r]={active:0,count:0}),m=p[n];m||(l=i.time,u=Dt(a,0,l),m=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 ro(t,e,r){t.attr("transform",function(t){var n=e(t);return"translate("+(isFinite(n)?n:r(t))+",0)"})}function no(t,e,r){t.attr("transform",function(t){var n=e(t);return"translate(0,"+(isFinite(n)?n:r(t))+")"})}function io(t){return t.toISOString()}function ao(t,e,r){function n(e){return t(e)}function i(t,r){var n=t[1]-t[0],i=n/r,a=uo.bisect(Jl,i);return a==Jl.length?[e.year,ta(t.map(function(t){return t/31536e6}),r)[2]]:a?e[i/Jl[a-1]1?{floor:function(e){for(;r(e=t.floor(e));)e=oo(e-1);return e},ceil:function(e){for(;r(e=t.ceil(e));)e=oo(+e+1);return e}}:t))},n.ticks=function(t,e){var r=Gi(n.domain()),a=null==t?i(r,10):"number"==typeof t?i(r,t):!t.range&&[{range:t},e];return a&&(t=a[0],e=a[1]),t.range(r[0],oo(+r[1]+1),e<1?1:e)},n.tickFormat=function(){return r},n.copy=function(){return ao(t.copy(),e,r)},Qi(n,t)}function oo(t){return new Date(t)}function so(t){return JSON.parse(t.responseText)}function lo(t){var e=fo.createRange();return e.selectNode(fo.body),e.createContextualFragment(t.responseText)}var uo={version:"3.5.17"},co=[].slice,ho=function(t){return co.call(t)},fo=this.document;if(fo)try{ho(fo.documentElement.childNodes)[0].nodeType}catch(t){ho=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}),fo)try{fo.createElement("DIV").style.setProperty("opacity",0,"")}catch(t){var po=this.Element.prototype,mo=po.setAttribute,vo=po.setAttributeNS,go=this.CSSStyleDeclaration.prototype,yo=go.setProperty;po.setAttribute=function(t,e){mo.call(this,t,e+"")},po.setAttributeNS=function(t,e,r){vo.call(this,t,e,r+"")},go.setProperty=function(t,e,r){yo.call(this,t,e+"",r)}}uo.ascending=i,uo.descending=function(t,e){return et?1:e>=t?0:NaN},uo.min=function(t,e){var r,n,i=-1,a=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},uo.max=function(t,e){var r,n,i=-1,a=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},uo.extent=function(t,e){var r,n,i,a=-1,o=t.length;if(1===arguments.length){for(;++a=n){r=i=n;break}for(;++an&&(r=n),i=n){r=i=n;break}for(;++an&&(r=n),i1)return l/(c-1)},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,r){return i(t(e),r)}:t)},uo.shuffle=function(t,e,r){(a=arguments.length)<3&&(r=t.length,a<2&&(e=0));for(var n,i,a=r-e;a;)i=Math.random()*a--|0,n=t[a+e],t[a+e]=t[i+e],t[i+e]=n;return t},uo.permute=function(t,e){for(var r=e.length,n=new Array(r);r--;)n[r]=t[e[r]];return n},uo.pairs=function(t){for(var e=0,r=t.length-1,n=t[0],i=new Array(r<0?0:r);e=0;)for(n=t[i],e=n.length;--e>=0;)r[--o]=n[e];return r};var xo=Math.abs;uo.range=function(t,e,r){if(arguments.length<3&&(r=1,arguments.length<2&&(e=t,t=0)),(e-t)/r==1/0)throw new Error("infinite range");var n,i=[],a=u(xo(r)),o=-1;if(t*=a,e*=a,r*=a,r<0)for(;(n=t+r*++o)>e;)i.push(n/a);else for(;(n=t+r*++o)=a.length)return n?n.call(i,o):r?o.sort(r):o;for(var l,u,c,f,d=-1,p=o.length,m=a[s++],v=new h;++d=a.length)return t;var n=[],i=o[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={},a=[],o=[];return i.map=function(e,r){return t(r,e,0)},i.entries=function(r){return e(t(uo.map,r,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 r=t,i},i.rollup=function(t){return n=t,i},i},uo.set=function(t){var e=new b;if(t)for(var r=0,n=t.length;r=0&&(n=t.slice(r+1),t=t.slice(0,r)),t)return arguments.length<2?this[t].on(n):this[t].on(n,e) -;if(2===arguments.length){if(null==e)for(t in this)this.hasOwnProperty(t)&&this[t].on(n,null);return this}},uo.event=null,uo.requote=function(t){return t.replace(ko,"\\$&")};var ko=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,Ao={}.__proto__?function(t,e){t.__proto__=e}:function(t,e){for(var r in e)t[r]=e[r]},To=function(t,e){return e.querySelector(t)},So=function(t,e){return e.querySelectorAll(t)},Eo=function(t,e){var r=t.matches||t[w(t,"matchesSelector")];return(Eo=function(t,e){return r.call(t,e)})(t,e)};"function"==typeof Sizzle&&(To=function(t,e){return Sizzle(t,e)[0]||null},So=Sizzle,Eo=Sizzle.matchesSelector),uo.selection=function(){return uo.select(fo.documentElement)};var Lo=uo.selection.prototype=[];Lo.select=function(t){var e,r,n,i,a=[];t=C(t);for(var o=-1,s=this.length;++o=0&&"xmlns"!==(r=t.slice(0,e))&&(t=t.slice(e+1)),zo.hasOwnProperty(r)?{space:zo[r],local:t}:t}},Lo.attr=function(t,e){if(arguments.length<2){if("string"==typeof t){var r=this.node();return t=uo.ns.qualify(t),t.local?r.getAttributeNS(t.space,t.local):r.getAttribute(t)}for(e in t)this.each(I(e,t[e]));return this}return this.each(I(t,e))},Lo.classed=function(t,e){if(arguments.length<2){if("string"==typeof t){var r=this.node(),n=(t=O(t)).length,i=-1;if(e=r.classList){for(;++i=0;)(r=n[i])&&(a&&a!==r.nextSibling&&a.parentNode.insertBefore(r,a),a=r);return this},Lo.sort=function(t){t=q.apply(this,arguments);for(var e=-1,r=this.length;++e0&&(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){C++||t({type:"zoomstart"})}function u(t){s(),t({type:"zoom",scale:k.k,translate:[k.x,k.y]})}function c(t){--C||(t({type:"zoomend"}),v=null)}function h(){function t(){s=1,a(uo.mouse(i),f),u(o)}function r(){h.on(I,null).on(D,null),d(s),c(o)}var i=this,o=O.of(i,arguments),s=0,h=uo.select(n(i)).on(I,t).on(D,r),f=e(uo.mouse(i)),d=K(i);Bl.call(i),l(o)}function f(){function t(){var t=uo.touches(p);return d=k.k,t.forEach(function(t){t.identifier in v&&(v[t.identifier]=e(t))}),t}function r(){var e=uo.event.target;uo.select(e).on(x,n).on(_,s),w.push(e);for(var r=uo.event.changedTouches,i=0,a=r.length;i1){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,o=uo.touches(p);Bl.call(p);for(var s=0,l=o.length;s=u)return o;if(i)return i=!1,a;var e=c;if(34===t.charCodeAt(e)){for(var r=e;r++=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i,hs=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,Ft(t,e))).toFixed(Math.max(0,Math.min(20,Ft(t*(1+1e-15),e))))}}),fs=uo.time={},ds=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(){ps.setUTCDate.apply(this._,arguments)},setDay:function(){ps.setUTCDay.apply(this._,arguments)},setFullYear:function(){ps.setUTCFullYear.apply(this._,arguments)},setHours:function(){ps.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){ps.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){ps.setUTCMinutes.apply(this._,arguments)},setMonth:function(){ps.setUTCMonth.apply(this._,arguments)},setSeconds:function(){ps.setUTCSeconds.apply(this._,arguments)},setTime:function(){ps.setTime.apply(this._,arguments)}};var ps=Date.prototype;fs.year=Vt(function(t){return t=fs.day(t),t.setMonth(0,1),t},function(t,e){t.setFullYear(t.getFullYear()+e)},function(t){return t.getFullYear()}),fs.years=fs.year.range,fs.years.utc=fs.year.utc.range,fs.day=Vt(function(t){var e=new ds(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}),fs.days=fs.day.range,fs.days.utc=fs.day.utc.range,fs.dayOfYear=function(t){var e=fs.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=fs[t]=Vt(function(t){return(t=fs.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=fs.year(t).getDay();return Math.floor((fs.dayOfYear(t)+(r+e)%7)/7)-(r!==e)});fs[t+"s"]=r.range,fs[t+"s"].utc=r.utc.range,fs[t+"OfYear"]=function(t){var r=fs.year(t).getDay();return Math.floor((fs.dayOfYear(t)+(r+e)%7)/7)}}),fs.week=fs.sunday,fs.weeks=fs.sunday.range,fs.weeks.utc=fs.sunday.utc.range,fs.weekOfYear=fs.sundayOfYear;var ms={"-":"",_:" ",0:"0"},vs=/^\s*\d+/,gs=/^%/;uo.locale=function(t){return{numberFormat:Nt(t),timeFormat:qt(t)}};var ys=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=ys.numberFormat,uo.geo={},he.prototype={s:0,t:0,add:function(t){fe(t,this.t,bs),fe(bs.s,this.s,this),this.s?this.t+=bs.t:this.s=bs.t},reset:function(){this.s=this.t=0},valueOf:function(){return this.s}};var bs=new he;uo.geo.stream=function(t,e){t&&xs.hasOwnProperty(t.type)?xs[t.type](t,e):de(t,e)};var xs={Feature:function(t,e){de(t.geometry,e)},FeatureCollection:function(t,e){for(var r=t.features,n=-1,i=r.length;++nd&&(d=e)}function e(e,r){var n=ge([e*Ho,r*Ho]);if(g){var i=be(g,n),a=[i[1],-i[0],0],o=be(a,i);we(o),o=Me(o);var l=e-p,u=l>0?1:-1,m=o[0]*qo*u,v=xo(l)>180;if(v^(u*pd&&(d=y)}else if(m=(m+360)%360-180,v^(u*pd&&(d=r);v?es(c,f)&&(f=e):s(e,f)>s(c,f)&&(c=e):f>=c?(ef&&(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+=xo(n)>180?n+(n>0?360:-360):n}else m=t,v=r;ks.point(t,r),e(t,r)}function a(){ks.lineStart()}function o(){i(m,v),ks.lineEnd(),xo(y)>Fo&&(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]:tFo?d=90:y<-Fo&&(h=-90),x[0]=c,x[1]=f}};return function(t){d=f=-(c=h=1/0),b=[],uo.geo.stream(t,_);var e=b.length;if(e){b.sort(l);for(var r,n=1,i=b[0],a=[i];ns(i[0],i[1])&&(i[1]=r[1]),s(r[0],i[1])>s(i[0],i[1])&&(i[0]=r[0])):a.push(i=r);for(var o,r,p=-1/0,e=a.length-1,n=0,i=a[e];n<=e;i=r,++n)r=a[n],(o=s(i[1],r[0]))>p&&(p=o,c=r[0],f=i[1])}return b=x=null,c===1/0||h===1/0?[[NaN,NaN],[NaN,NaN]]:[[c,h],[f,d]]}}(),uo.geo.centroid=function(t){As=Ts=Ss=Es=Ls=Cs=zs=Is=Ds=Ps=Os=0,uo.geo.stream(t,Rs);var e=Ds,r=Ps,n=Os,i=e*e+r*r+n*n;return i=.12&&i<.234&&n>=-.425&&n<-.214?o:i>=.166&&i<.234&&n>=-.214&&n<-.115?s:a).invert(t)},t.stream=function(t){var e=a.stream(t),r=o.stream(t),n=s.stream(t);return{point:function(t,i){e.point(t,i),r.point(t,i),n.point(t,i)},sphere:function(){e.sphere(),r.sphere(),n.sphere()},lineStart:function(){e.lineStart(),r.lineStart(),n.lineStart()},lineEnd:function(){e.lineEnd(),r.lineEnd(),n.lineEnd()},polygonStart:function(){e.polygonStart(),r.polygonStart(),n.polygonStart()},polygonEnd:function(){e.polygonEnd(),r.polygonEnd(),n.polygonEnd()}}},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],h=+e[1];return r=a.translate(e).clipExtent([[c-.455*u,h-.238*u],[c+.455*u,h+.238*u]]).stream(l).point,n=o.translate([c-.307*u,h+.201*u]).clipExtent([[c-.425*u+Fo,h+.12*u+Fo],[c-.214*u-Fo,h+.234*u-Fo]]).stream(l).point,i=s.translate([c-.205*u,h+.212*u]).clipExtent([[c-.214*u+Fo,h+.166*u+Fo],[c-.115*u-Fo,h+.234*u-Fo]]).stream(l).point,t},t.scale(1070)};var Ns,Bs,Us,Vs,Hs,qs,Gs={point:M,lineStart:M,lineEnd:M,polygonStart:function(){Bs=0,Gs.lineStart=We},polygonEnd:function(){Gs.lineStart=Gs.lineEnd=Gs.point=M,Ns+=xo(Bs/2)}},Ys={point:Ze,lineStart:M,lineEnd:M,polygonStart:M,polygonEnd:M},Xs={point:Qe,lineStart:$e,lineEnd:tr,polygonStart:function(){Xs.lineStart=er},polygonEnd:function(){Xs.point=Qe,Xs.lineStart=$e,Xs.lineEnd=tr}};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 r,n,i,a,o,s=4.5;return t.area=function(t){return Ns=0,uo.geo.stream(t,i(Gs)),Ns},t.centroid=function(t){return Ss=Es=Ls=Cs=zs=Is=Ds=Ps=Os=0,uo.geo.stream(t,i(Xs)),Os?[Ds/Os,Ps/Os]:Is?[Cs/Is,zs/Is]:Ls?[Ss/Ls,Es/Ls]:[NaN,NaN]},t.bounds=function(t){return Hs=qs=-(Us=Vs=1/0),uo.geo.stream(t,i(Ys)),[[Us,Vs],[Hs,qs]]},t.projection=function(t){return arguments.length?(i=(r=t)?t.stream||ir(t):x,e()):r},t.context=function(t){return arguments.length?(a=null==(n=t)?new Je:new rr(t),"function"!=typeof s&&a.pointRadius(s),e()):n},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 r=new ar(e);for(var n in t)r[n]=t[n];return r}}},ar.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=sr,uo.geo.projectionMutator=lr,(uo.geo.equirectangular=function(){return sr(cr)}).raw=cr.invert=cr,uo.geo.rotation=function(t){function e(e){return e=t(e[0]*Ho,e[1]*Ho),e[0]*=qo,e[1]*=qo,e}return t=fr(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]*=qo,e[1]*=qo,e},e},hr.invert=cr,uo.geo.circle=function(){function t(){var t="function"==typeof n?n.apply(this,arguments):n,e=fr(-t[0]*Ho,-t[1]*Ho,0).invert,i=[];return r(null,null,1,{point:function(t,r){i.push(t=e(t,r)),t[0]*=qo,t[1]*=qo}}),{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=vr((e=+n)*Ho,i*Ho),t):e},t.precision=function(n){return arguments.length?(r=vr(e*Ho,(i=+n)*Ho),t):i},t.angle(90)},uo.geo.distance=function(t,e){var r,n=(e[0]-t[0])*Ho,i=t[1]*Ho,a=e[1]*Ho,o=Math.sin(n),s=Math.cos(n),l=Math.sin(i),u=Math.cos(i),c=Math.sin(a),h=Math.cos(a);return Math.atan2(Math.sqrt((r=h*o)*r+(r=u*c-l*h*s)*r),l*c+u*h*s)},uo.geo.graticule=function(){function t(){return{type:"MultiLineString",coordinates:e()}}function e(){return uo.range(Math.ceil(a/v)*v,i,v).map(f).concat(uo.range(Math.ceil(u/g)*g,l,g).map(d)).concat(uo.range(Math.ceil(n/p)*p,r,p).filter(function(t){return xo(t%v)>Fo}).map(c)).concat(uo.range(Math.ceil(s/m)*m,o,m).filter(function(t){return xo(t%g)>Fo}).map(h))}var r,n,i,a,o,s,l,u,c,h,f,d,p=10,m=p,v=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(a).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?(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?(n=+e[0][0],r=+e[1][0],s=+e[0][1],o=+e[1][1],n>r&&(e=n,n=r,r=e),s>o&&(e=s,s=o,o=e),t.precision(y)):[[n,s],[r,o]]},t.step=function(e){return arguments.length?t.majorStep(e).minorStep(e):t.minorStep()},t.majorStep=function(e){return arguments.length?(v=+e[0],g=+e[1],t):[v,g]},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=yr(s,o,90),h=br(n,r,y),f=yr(u,l,90),d=br(a,i,y),t):y},t.majorExtent([[-180,-90+Fo],[180,90-Fo]]).minorExtent([[-180,-80-Fo],[180,80+Fo]])},uo.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 uo.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},uo.geo.interpolate=function(t,e){return wr(t[0]*Ho,t[1]*Ho,e[0]*Ho,e[1]*Ho)},uo.geo.length=function(t){return Ws=0,uo.geo.stream(t,Zs),Ws};var Ws,Zs={sphere:M,point:M,lineStart:Mr,lineEnd:M,polygonStart:M,polygonEnd:M},Js=kr(function(t){return Math.sqrt(2/(1+t))},function(t){return 2*Math.asin(t/2)});(uo.geo.azimuthalEqualArea=function(){return sr(Js)}).raw=Js;var Ks=kr(function(t){var e=Math.acos(t);return e&&e/Math.sin(e)},x);(uo.geo.azimuthalEquidistant=function(){return sr(Ks)}).raw=Ks,(uo.geo.conicConformal=function(){return Ye(Ar)}).raw=Ar,(uo.geo.conicEquidistant=function(){return Ye(Tr)}).raw=Tr;var Qs=kr(function(t){return 1/t},Math.atan);(uo.geo.gnomonic=function(){return sr(Qs)}).raw=Qs,Sr.invert=function(t,e){return[t,2*Math.atan(Math.exp(e))-Vo]},(uo.geo.mercator=function(){return Er(Sr)}).raw=Sr;var $s=kr(function(){return 1},Math.asin);(uo.geo.orthographic=function(){return sr($s)}).raw=$s;var tl=kr(function(t){return 1/(1+t)},function(t){return 2*Math.atan(t)});(uo.geo.stereographic=function(){return sr(tl)}).raw=tl,Lr.invert=function(t,e){return[-e,2*Math.atan(Math.exp(t))-Vo]},(uo.geo.transverseMercator=function(){var t=Er(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,uo.geom={},uo.geom.hull=function(t){function e(t){if(t.length<3)return[];var e,i=Et(r),a=Et(n),o=t.length,s=[],l=[];for(e=0;e=0;--e)d.push(t[s[u[e]][2]]);for(e=+h;e=n&&u.x<=a&&u.y>=i&&u.y<=o?[[n,o],[a,o],[a,i],[n,i]]:[]).point=t[s]}),e}function r(t){return t.map(function(t,e){return{x:Math.round(a(t,e)/Fo)*Fo,y:Math.round(o(t,e)/Fo)*Fo,i:e}})}var n=Cr,i=zr,a=n,o=i,s=ul;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,a=r.site,o=r.edges.sort(Yr),s=-1,l=o.length,u=o[l-1].edge,c=u.l===a?u.r:u.l;++s=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?o=c:l=c,a(t,e,r,n,i,o,s,l)}var c,h,f,d,p,m,v,g,y,b=Et(s),x=Et(l);if(null!=e)m=e,v=r,g=n,y=i;else if(g=y=-(m=v=1/0),h=[],f=[],p=t.length,o)for(d=0;dg&&(g=c.x),c.y>y&&(y=c.y),h.push(c.x),f.push(c.y);else for(d=0;dg&&(g=_),w>y&&(y=w),h.push(_),f.push(w)}var M=g-m,k=y-v;M>k?y=v+M:g=m+k;var A=pn();if(A.add=function(t){a(A,t,+b(t,++d),+x(t,d),m,v,g,y)},A.visit=function(t){mn(t,A,m,v,g,y)},A.find=function(t){return vn(A,t[0],t[1],m,v,g,y)},d=-1,null==e){for(;++d=0?t.slice(0,e):t,n=e>=0?t.slice(e+1):"in";return r=dl.get(r)||fl,n=pl.get(n)||x,Mn(n(r.apply(null,co.call(arguments,1))))},uo.interpolateHcl=Rn,uo.interpolateHsl=Fn,uo.interpolateLab=jn,uo.interpolateRound=Nn,uo.transform=function(t){var e=fo.createElementNS(uo.ns.prefix.svg,"g");return(uo.transform=function(t){if(null!=t){e.setAttribute("transform",t);var r=e.transform.baseVal.consolidate()}return new Bn(r?r.matrix:ml)})(t)},Bn.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var ml={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;++r0?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=Dt(l.tick)),l):i},l.start=function(){function t(t,n){if(!r){for(r=new Array(i),l=0;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=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},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;++us&&(s=n),o.push(n)}for(r=0;r0)for(a=-1;++a=c[0]&&s<=c[1]&&(o=l[uo.bisect(h,s,1,d)-1],o.y+=p,o.push(t[a]));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=Et(e),t):n},t.bins=function(e){return arguments.length?(i="number"==typeof e?function(t){return wi(t,e)}:Et(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,Ei),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,Ei),li(s,function(t){t.r-=h})}return zi(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),h=c[0],f=e(h);if(li(f,r),f.parent.m=-f.z,si(f,n),u)si(h,a);else{var d=h,p=h,m=h;si(h,function(t){t.xp.x&&(p=t),t.depth>m.depth&&(m=t)});var v=s(d,p)/2-d.x,g=l[0]/(p.x+s(p,d)/2+v),y=l[1]/(m.depth||1);si(h,function(t){t.x=(t.x+v)*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,a=e.children,o=0,s=a.length;o0&&(Ri(ji(o,t,r),t,n),u+=n,c+=n),h+=o.m,u+=i.m,f+=l.m,c+=a.m;o&&!Oi(a)&&(a.t=o,a.m+=h-c),i&&!Pi(l)&&(l.t=i,l.m+=u-f,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=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)?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=Ni(e)):(t.x=o?u+=r(t,o):0,t.y=0,o=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=uo.layout.hierarchy().sort(null).value(null),r=Di,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;++i0;)c.push(o=f[l-1]),c.area+=o.area,"squarify"!==d||(s=n(c,m))<=p?(f.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 r(e){var n=e.children;if(n&&n.length){var a,o=h(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;++oi&&(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);++a1);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;rh?0:1;if(u=Uo)return e(u,d)+(t?e(t,1-d):"")+"Z";var p,m,v,g,y,b,x,_,w,M,k,A,T=0,S=0,E=[];if((g=(+l.apply(this,arguments)||0)/2)&&(v=a===Cl?Math.sqrt(t*t+u*u):+a.apply(this,arguments),d||(S*=-1),u&&(S=nt(v/u*Math.sin(g))),t&&(T=nt(v/t*Math.sin(g)))),u){y=u*Math.cos(c+S),b=u*Math.sin(c+S),x=u*Math.cos(h-S),_=u*Math.sin(h-S);var L=Math.abs(h-c-2*S)<=No?0:1;if(S&&ba(y,b,x,_)===d^L){var C=(c+h)/2;y=u*Math.cos(C),b=u*Math.sin(C),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 z=Math.abs(c-h+2*T)<=No?0:1;if(T&&ba(w,M,k,A)===1-d^z){var I=(c+h)/2;w=t*Math.cos(I),M=t*Math.sin(I),k=A=null}}else w=M=0;if(f>Fo&&(p=Math.min(Math.abs(u-t)/2,+i.apply(this,arguments)))>.001){m=tNo)+",1 "+e}function i(t,e,r,n){return"Q 0,0 "+n}var a=xr,o=_r,s=qa,l=va,u=ga;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=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=Et(r),t):e},t.target=function(e){return arguments.length?(r=Et(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(Ya(e=t)):e},t},uo.svg.symbol=function(){function t(t,n){return(Ol.get(e.call(this,t,n))||Za)(r.call(this,t,n))}var e=Wa,r=Xa;return t.type=function(r){return arguments.length?(e=Et(r),t):e},t.size=function(e){return arguments.length?(r=Et(e),t):r},t};var Ol=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*Fl)),r=e*Fl;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/Rl),r=e*Rl/2;return"M0,"+r+"L"+e+","+-r+" "+-e+","+-r+"Z"},"triangle-up":function(t){var e=Math.sqrt(t/Rl),r=e*Rl/2;return"M0,"+-r+"L"+e+","+r+" "+-e+","+r+"Z"}});uo.svg.symbolTypes=Ol.keys();var Rl=Math.sqrt(3),Fl=Math.tan(30*Ho);Lo.transition=function(t){for(var e,r,n=jl||++Vl,i=to(t),a=[],o=Nl||{time:Date.now(),ease:En,delay:0,duration:250},s=-1,l=this.length;++srect,.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 a(){function a(){32==uo.event.keyCode&&(L||(b=null,z[0]-=h[1],z[1]-=f[1],L=2),T())}function m(){32==uo.event.keyCode&&2==L&&(z[0]+=h[1],z[1]+=f[1],L=0,T())}function v(){var t=uo.mouse(_),n=!1;x&&(t[0]+=x[0],t[1]+=x[1]),L||(uo.event.altKey?(b||(b=[(h[0]+h[1])/2,(f[0]+f[1])/2]),z[0]=h[+(t[0]=2)return!1;t[r]=n}return!0}):w.filter(function(t){for(var e=0;e<=o;++e){var r=y[t[e]];if(r<0)return!1;t[e]=r}return!0}),1&o)for(var h=0;h>>31},e.exports.exponent=function(t){return(e.exports.hi(t)<<1>>>21)-1023},e.exports.fraction=function(t){var r=e.exports.lo(t),n=e.exports.hi(t),i=1048575&n;return 2146435072&n&&(i+=1<<20),[r,i]},e.exports.denormalized=function(t){return!(2146435072&e.exports.hi(t))}}).call(this,t("buffer").Buffer)},{buffer:75}],123:[function(t,e,r){"use strict";function n(t,e,r){var i=0|t[r];if(i<=0)return[];var a,o=new Array(i);if(r===t.length-1)for(a=0;a0)return i(0|t,e);break;case"object":if("number"==typeof t.length)return n(t,e,0)}return[]}e.exports=a},{}],124:[function(t,e,r){"use strict";function n(t,e,r){r=r||2;var n=e&&e.length,a=n?e[0]*r:t.length,s=i(t,0,a,r,!0),l=[];if(!s)return l;var u,c,f,d,p,m,v;if(n&&(s=h(t,e,s,r)),t.length>80*r){u=f=t[0],c=d=t[1];for(var g=r;gf&&(f=p),m>d&&(d=m);v=Math.max(f-u,d-c)}return o(s,l,r,u,c,v),l}function i(t,e,r,n,i){var a,o;if(i===z(t,e,r,n)>0)for(a=e;a=e;a-=n)o=E(a,t[a],t[a+1],o);return o&&w(o,o.next)&&(L(o),o=o.next),o}function a(t,e){if(!t)return t;e||(e=t);var r,n=t;do{if(r=!1,n.steiner||!w(n,n.next)&&0!==_(n.prev,n,n.next))n=n.next;else{if(L(n),(n=e=n.prev)===n.next)return null;r=!0}}while(r||n!==e);return e}function o(t,e,r,n,i,h,f){if(t){!f&&h&&m(t,n,i,h);for(var d,p,v=t;t.prev!==t.next;)if(d=t.prev,p=t.next,h?l(t,n,i,h):s(t))e.push(d.i/r),e.push(t.i/r),e.push(p.i/r),L(t),t=p.next,v=p.next;else if((t=p)===v){f?1===f?(t=u(t,e,r),o(t,e,r,n,i,h,2)):2===f&&c(t,e,r,n,i,h):o(a(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,a=t,o=t.next;if(_(i,a,o)>=0)return!1;for(var s=i.xa.x?i.x>o.x?i.x:o.x:a.x>o.x?a.x:o.x,c=i.y>a.y?i.y>o.y?i.y:o.y:a.y>o.y?a.y:o.y,h=g(s,l,e,r,n),f=g(u,c,e,r,n),d=t.nextZ;d&&d.z<=f;){if(d!==t.prev&&d!==t.next&&b(i.x,i.y,a.x,a.y,o.x,o.y,d.x,d.y)&&_(d.prev,d,d.next)>=0)return!1;d=d.nextZ}for(d=t.prevZ;d&&d.z>=h;){if(d!==t.prev&&d!==t.next&&b(i.x,i.y,a.x,a.y,o.x,o.y,d.x,d.y)&&_(d.prev,d,d.next)>=0)return!1;d=d.prevZ}return!0}function u(t,e,r){var n=t;do{var i=n.prev,a=n.next.next;!w(i,a)&&M(i,n,n.next,a)&&A(i,a)&&A(a,i)&&(e.push(i.i/r),e.push(n.i/r),e.push(a.i/r),L(n),L(n.next),n=t=a),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=S(l,u);return l=a(l,l.next),c=a(c,c.next),o(l,e,r,n,i,s),void o(c,e,r,n,i,s)}u=u.next}l=l.next}while(l!==t)}function h(t,e,r,n){var o,s,l,u,c,h=[];for(o=0,s=e.length;o=n.next.y){var s=n.x+(a-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(s<=i&&s>o){if(o=s,s===i){if(a===n.y)return n;if(a===n.next.y)return n.next}r=n.x=n.x&&n.x>=c&&b(ar.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=g(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,v(i)}function v(t){var e,r,n,i,a,o,s,l,u=1;do{for(r=t,t=null,a=null,o=0;r;){for(o++,n=r,s=0,e=0;e0||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--),a?a.nextZ=i:t=i,i.prevZ=a,a=i;r=n}a.nextZ=null,u*=2}while(o>1);return t}function g(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-o)*(n-s)-(r-o)*(e-s)>=0&&(r-o)*(a-s)-(i-o)*(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))||_(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,a=(t.y+e.y)/2;do{r.y>a!=r.next.y>a&&i<(r.next.x-r.x)*(a-r.y)/(r.next.y-r.y)+r.x&&(n=!n),r=r.next}while(r!==t);return n}function S(t,e){var r=new C(t.i,t.x,t.y),n=new C(e.i,e.x,e.y),i=t.next,a=e.prev;return t.next=e,e.prev=t,r.next=i,i.prev=r,n.next=r,r.prev=n,a.next=n,n.prev=a,n}function E(t,e,r,n){var i=new C(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 C(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 z(t,e,r,n){for(var i=0,a=e,o=r-n;a0&&(n+=t[i-1].length,r.holes.push(n))}return r}},{}],125:[function(t,e,r){"use strict";function n(t,e){var r=t.length;if("number"!=typeof e){e=0;for(var n=0;n0&&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,a,s;if(!i(e))throw TypeError("listener must be a function");if(!this._events||!this._events[t])return this;if(r=this._events[t],a=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(o(r)){for(s=a;s-- >0;)if(r[s]===e||r[s].listener&&r[s].listener===e){n=s;break}if(n<0)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){return 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)}},{}],128:[function(t,e,r){"use strict";function n(t,e,r){var n=e||0,i=r||1;return[[t[12]+t[0],t[13]+t[1],t[14]+t[2],t[15]+t[3]],[t[12]-t[0],t[13]-t[1],t[14]-t[2],t[15]-t[3]],[t[12]+t[4],t[13]+t[5],t[14]+t[6],t[15]+t[7]],[t[12]-t[4],t[13]-t[5],t[14]-t[6],t[15]-t[7]],[n*t[12]+t[8],n*t[13]+t[9],n*t[14]+t[10],n*t[15]+t[11]],[i*t[12]-t[8],i*t[13]-t[9],i*t[14]-t[10],i*t[15]-t[11]]]}e.exports=n},{}],129:[function(t,e,r){"use strict";function n(t){for(var e,r=t.length,n=0;n13)&&32!==e&&133!==e&&160!==e&&5760!==e&&6158!==e&&(e<8192||e>8205)&&8232!==e&&8233!==e&&8239!==e&&8287!==e&&8288!==e&&12288!==e&&65279!==e)return!1;return!0}e.exports=function(t){var e=typeof t;if("string"===e){var r=t;if(0===(t=+t)&&n(r))return!1}else if("number"!==e)return!1;return t-t<1}},{}],130:[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];return t.length<=1?"any"===e?"false":"true":"("+("=="===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")+")"}function a(t){return"$type"===t?"f.type":"$id"===t?"f.id":"p["+JSON.stringify(t)+"]"}function o(t,e,r,n){var i=a(t),o="$type"===t?f.indexOf(e):JSON.stringify(e);return(n?"typeof "+i+"=== typeof "+o+"&&":"")+i+r+o}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=a(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 te?1:0}e.exports=n;var f=["Unknown","Point","LineString","Polygon"]},{}],131:[function(t,e,r){"use strict";function n(t,e,r){return Math.min(e,Math.max(t,r))}function i(t,e,r){this.dimension=t.length,this.bounds=[new Array(this.dimension),new Array(this.dimension)];for(var n=0;n=r-1)for(var f=o.length-1,p=t-e[r-1],d=0;d=r-1)for(var c=a.length-1,h=(e[r-1],0);h=0;--r)if(t[--e])return!1;return!0},u.jump=function(t){var e=this.lastT(),r=this.dimension;if(!(t0;--h)i.push(n(l[h-1],u[h-1],arguments[h])),a.push(0)}},u.push=function(t){var e=this.lastT(),r=this.dimension;if(!(t1e-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),a.push((d-i[o++])*h)}}},u.set=function(t){var e=this.dimension;if(!(t0;--l)r.push(n(o[l-1],s[l-1],arguments[l])),i.push(0)}},u.move=function(t){var e=this.lastT(),r=this.dimension;if(!(t<=e||arguments.length!==r+1)){var i=this._state,a=this._velocity,o=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[o++]+d)),a.push(d*h)}}},u.idle=function(t){var e=this.lastT();if(!(t=0;--h)i.push(n(l[h],u[h],i[o]+c*a[o])),a.push(0),o+=1}}},{"binary-search-bounds":64,"cubic-hermite":107}],132:[function(t,e,r){"use strict";function n(t){t=t||{};var e,r,n=t.canvas||document.createElement("canvas"),o=t.family||"sans-serif",s=t.shape||[512,512],l=t.step||[32,32],u=parseFloat(t.size)||16,c=t.chars||[32,126],h=Math.floor((l[0]-u)/2),f=t.radius||1.5*h,d=new a(u,h,f,0,o),p=null==t.align?"optical":t.align,m=null==t.fit||1==t.fit?.5:t.fit;if(Array.isArray(c)){if(2===c.length&&"number"==typeof c[0]&&"number"==typeof c[1]){var v=[];for(e=c[0],r=0;e<=c[1];e++)v[r++]=String.fromCharCode(e);c=v}}else c=String(c).split("");s=s.slice(),n.width=s[0],n.height=s[1];var g=n.getContext("2d");g.fillStyle="#000",g.fillRect(0,0,n.width,n.height),g.textBaseline="middle";var y=l[0],b=l[1],x=0,_=0,w=u/b,M=Math.min(c.length,Math.floor(s[0]/y)*Math.ceil(s[1]/b)),k=d.ctx.textAlign,A=d.buffer,T=d.middle;for(d.ctx.textAlign="center",d.buffer=d.size/2,e=0;es[0]-l[0]&&(x=0,_+=l[1])}return d.ctx.textAlign=k,d.buffer=A,d.middle=T,n}function i(t,e,r){if(s[e]&&s[e][t])return s[e][t];var n=200*r,i=o(t,{size:200,fontSize:n,fontFamily:e});s[e]||(s[e]={});var a={center:[i.center[0]/200,i.center[1]/200],bounds:i.bounds.map(function(t){return t/200}),radius:i.radius/200};return s[e][t]=a,a}var a=t("tiny-sdf"),o=t("optical-properties");e.exports=n;var s={}},{"optical-properties":469,"tiny-sdf":531}],133:[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||(e.right?l(t,e.right):void 0)}function u(t,e,r,n){if(e(t,n.key)<=0){if(n.left){var i=u(t,e,r,n.left);if(i)return i}var i=r(n.key,n.value);if(i)return i}if(n.right)return u(t,e,r,n.right)}function c(t,e,r,n,i){var a,o=r(t,i.key),s=r(e,i.key);if(o<=0){if(i.left&&(a=c(t,e,r,n,i.left)))return a;if(s>0&&(a=n(i.key,i.value)))return a}if(s>0&&i.right)return c(t,e,r,n,i.right)}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===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=g,r._color=g,s._color=g,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=g,n._color=g,e._color=g,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===g){if(r._color===v)return r._color=g,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=g,n._color=g,e._color=g,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===g){if(r._color===v)return r._color=g,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+1e?1:0}function m(t){return new s(t||p,null)}e.exports=m;var v=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=c<=0?i.left:i.right}l.push(new n(v,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!==v){if(d._color=v,d.left=f.right,f._color=g,f.right=d,l[h-2]=f,l[h-1]=i,o(d),o(f),h>=3){var m=l[h-3];m.left===d?m.left=f:m.right=f}break}f._color=g,d.right=a(g,p),d._color=v,h-=1}else{var p=d.right;if(!p||p._color!==v){if(f.right=i.left,d._color=v,d.left=i.right,i._color=g,i.left=f,i.right=d,l[h-2]=i,l[h-1]=f,o(d),o(f),o(i),h>=3){var m=l[h-3];m.left===d?m.left=i:m.right=i}break}f._color=g,d.right=a(g,p),d._color=v,h-=1}else if(f.right===i){var p=d.left;if(!p||p._color!==v){if(d._color=v,d.right=f.left,f._color=g,f.left=d,l[h-2]=f,l[h-1]=i,o(d),o(f),h>=3){var m=l[h-3];m.right===d?m.right=f:m.left=f}break}f._color=g,d.left=a(g,p),d._color=v,h-=1}else{var p=d.left;if(!p||p._color!==v){if(f.left=i.right,d._color=v,d.right=i.left,i._color=g,i.right=f,i.left=d,l[h-2]=i,l[h-1]=f,o(d),o(f),o(i),h>=3){var m=l[h-3];m.right===d?m.right=i:m.left=i}break}f._color=g,d.left=a(g,p),d._color=v,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(t<0)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 a=e(t,r.key);n.push(r),a<=0&&(i=n.length),r=a<=0?r.left:r.right}return n.length=i,new h(this,n)},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),a<0&&(i=n.length),r=a<0?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 a=e(t,r.key);n.push(r),a>0&&(i=n.length),r=a<=0?r.left:r.right}return n.length=i,new h(this,n)},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=a<0?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=i<=0?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=n<=0?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 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)return this._stack[this._stack.length-1].key},enumerable:!0}),Object.defineProperty(b,"value",{get:function(){if(this._stack.length>0)return this._stack[this._stack.length-1].value},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}})},{}],134:[function(t,e,r){function n(t){if(t<0)return Number("0/0");for(var e=o[0],r=o.length-1;r>0;--r)e+=o[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=[.9999999999998099,676.5203681218851,-1259.1392167224028,771.3234287776531,-176.6150291621406,12.507343278686905,-.13857109526572012,9984369578019572e-21,1.5056327351493116e-7],a=607/128,o=[.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 t(e){if(e<.5)return Math.PI/(Math.sin(Math.PI*e)*t(1-e));if(e>100)return Math.exp(n(e));e-=1;for(var r=i[0],a=1;a<9;a++)r+=i[a]/(e+a);var o=e+7+.5;return Math.sqrt(2*Math.PI)*Math.pow(o,e+.5)*Math.exp(-o)*r},e.exports.log=n},{}],135:[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(a(t[0]));for(var r=1;r2){for(var r,n,i=0;i=0}var u=t("geojson-area");e.exports=n},{"geojson-area":135}],137:[function(t,e,r){"use strict";function n(t,e,r,n,o,l,u,c){if(r/=e,n/=e,u>=r&&c<=n)return t;if(u>n||c=r&&p<=n)h.push(m);else if(!(d>n||p=e&&s<=r&&i.push(o)}return i}function a(t,e,r,n,i,a){for(var s=[],l=0;lr?(x.push(i(u,p,e),i(u,p,r)),a||(x=o(s,x,v,g,y))):d>=e&&x.push(i(u,p,e)):f>r?dr&&(x.push(i(u,p,r)),a||(x=o(s,x,v,g,y))));u=m[b-1],f=u[n],f>=e&&f<=r&&x.push(u),h=x[x.length-1],a&&h&&(x[0][0]!==h[0]||x[0][1]!==h[1])&&x.push(x[0]),o(s,x,v,g,y)}return s}function o(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":139}],138:[function(t,e,r){"use strict";function n(t,e){var r=[];if("FeatureCollection"===t.type)for(var n=0;n1?1:n,[r,n,0]}function s(t){for(var e,r,n=0,i=0,a=0;a1)return!1;var a=i.geometry[0].length;if(5!==a)return!1;for(var o=0;o1&&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}),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===d.maxZoom||e===i)continue;var w=1<1&&console.time("clipping");var M,k,A,T,S,E,L=.5*d.buffer/d.extent,C=.5-L,z=.5+L,I=1+L;M=k=A=T=null,S=f(t,g,r-L,r+z,0,o,b.min[0],b.max[0]),E=f(t,g,r+C,r+I,0,o,b.min[0],b.max[0]),S&&(M=f(S,g,n-L,n+z,1,s,b.min[1],b.max[1]),k=f(S,g,n+C,n+I,1,s,b.min[1],b.max[1])),E&&(A=f(E,g,n-L,n+z,1,s,b.min[1],b.max[1]),T=f(E,g,n+C,n+I,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&&(v=e)}return v},i.prototype.getTile=function(t,e,r){var n=this.options,i=n.extent,o=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[a(f,d,p)];if(!c||!c.source)return null;if(o>1&&console.log("found parent tile z%d-%d-%d",f,d,p),u(c,i,n.buffer))return h.tile(c,i);o>1&&console.time("drilling down");var m=this.splitTile(c.source,f,d,p,t,e,r);if(o>1&&console.timeEnd("drilling down"),null!==m){var v=1<n&&(o=r,n=a);n>s?(t[o][2]=n,h.push(u),h.push(o),u=o):(c=h.pop(),u=h.pop())}}function i(t,e,r){var n=e[0],i=e[1],a=r[0],o=r[1],s=t[0],l=t[1],u=a-n,c=o-i;if(0!==u||0!==c){var h=((s-n)*u+(l-i)*c)/(u*u+c*c);h>1?(n=a,i=o):h>0&&(n+=u*h,i+=c*h)}return u=s-n,c=l-i,u*u+c*c}e.exports=n},{}],142:[function(t,e,r){"use strict";function n(t,e,r,n,a,o){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,s,l,u=e.geometry,c=e.type,h=[],f=r*r;if(1===c)for(i=0;if)&&(d.push(l),t.numSimplified++),t.numPoints++;3===c&&a(d,s.outer),h.push(d)}else t.numPoints+=s.length;if(h.length){var p={geometry:h,type:c,tags:e.tags||null};null!==e.id&&(p.id=e.id),t.features.push(p)}}function a(t,e){o(t)<0===e&&t.reverse()}function o(t){for(var e,r,n=0,i=0,a=t.length,o=a-1;i0?(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,a=t[n],o=this[n] -;(e?Array.isArray(a)&&Array.isArray(a[0]):Array.isArray(a))?this[n]=i=[r(a[0]),r(a[1]),r(a[2])]:this[n]=i=[r(a),r(a),r(a)];for(var s=0;s<3;++s)if(i[s]!==o[s])return!0}return!1}t=t||{};var r,n=e.bind(this,!1,Number),i=e.bind(this,!1,Boolean),a=e.bind(this,!1,String),o=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;d<2;++d)for(var p=0;p<3;++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;d<3;++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;d<3;++d)r[d].sort(function(t,e){return t.x-e.x});f.equal(r,this.ticks)?s=!1:this.ticks=r}i("tickEnable"),a("tickFont")&&(s=!0),n("tickSize"),n("tickAngle"),n("tickPad"),o("tickColor");var m=a("labels");a("labelFont")&&(m=!0),i("labelEnable"),n("labelSize"),n("labelPad"),o("labelColor"),i("lineEnable"),i("lineMirror"),n("lineWidth"),o("lineColor"),i("lineTickEnable"),i("lineTickMirror"),n("lineTickLength"),n("lineTickWidth"),o("lineTickColor"),i("gridEnable"),n("gridWidth"),o("gridColor"),i("zeroEnable"),o("zeroLineColor"),n("zeroLineWidth"),i("backgroundEnable"),o("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 a,new a,new a],v=[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,a=t.projection||d,s=this.bounds,l=h(r,i,a,s),u=l.cubeEdges,c=l.axis,f=i[12],p=i[13],_=i[14],w=i[15],M=this.pixelRatio*(a[3]*f+a[7]*p+a[11]*_+a[15]*w)/e.drawingBufferHeight,k=0;k<3;++k)this.lastCubeProps.cubeEdges[k]=u[k],this.lastCubeProps.axis[k]=c[k];for(var A=m,k=0;k<3;++k)o(m[k],k,this.bounds,u,c);for(var e=this.gl,T=v,k=0;k<3;++k)this.backgroundEnable[k]?T[k]=c[k]:T[k]=0;this._background.draw(r,i,a,s,T,this.backgroundColor),this._lines.bind(r,i,a,this);for(var k=0;k<3;++k){var S=[0,0,0];c[k]>0?S[k]=s[1][k]:S[k]=s[0][k];for(var E=0;E<2;++E){var L=(k+1+E)%3,C=(k+1+(1^E))%3;this.gridEnable[L]&&this._lines.drawGrid(L,C,this.bounds,S,this.gridColor[L],this.gridWidth[L]*this.pixelRatio)}for(var E=0;E<2;++E){var L=(k+1+E)%3,C=(k+1+(1^E))%3;this.zeroEnable[C]&&s[0][C]<=0&&s[1][C]>=0&&this._lines.drawZero(L,C,this.bounds,S,this.zeroLineColor[C],this.zeroLineWidth[C]*this.pixelRatio)}}for(var k=0;k<3;++k){this.lineEnable[k]&&this._lines.drawAxisLine(k,this.bounds,A[k].primalOffset,this.lineColor[k],this.lineWidth[k]*this.pixelRatio),this.lineMirror[k]&&this._lines.drawAxisLine(k,this.bounds,A[k].mirrorOffset,this.lineColor[k],this.lineWidth[k]*this.pixelRatio);for(var z=n(y,A[k].primalMinor),I=n(b,A[k].mirrorMinor),D=this.lineTickLength,E=0;E<3;++E){var P=M/r[5*E];z[E]*=D[E]*P,I[E]*=D[E]*P}this.lineTickEnable[k]&&this._lines.drawAxisTicks(k,A[k].primalOffset,z,this.lineTickColor[k],this.lineTickWidth[k]*this.pixelRatio),this.lineTickMirror[k]&&this._lines.drawAxisTicks(k,A[k].mirrorOffset,I,this.lineTickColor[k],this.lineTickWidth[k]*this.pixelRatio)}this._text.bind(r,i,a,this.pixelRatio);for(var k=0;k<3;++k){for(var O=A[k].primalMinor,R=n(x,A[k].primalOffset),E=0;E<3;++E)this.lineTickEnable[k]&&(R[E]+=M*O[E]*Math.max(this.lineTickLength[E],0)/r[5*E]);if(this.tickEnable[k]){for(var E=0;E<3;++E)R[E]+=M*O[E]*this.tickPad[E]/r[5*E];this._text.drawTicks(k,this.tickSize[k],this.tickAngle[k],R,this.tickColor[k])}if(this.labelEnable[k]){for(var E=0;E<3;++E)R[E]+=M*O[E]*this.labelPad[E]/r[5*E];R[k]+=.5*(s[0][k]+s[1][k]),this._text.drawLabel(k,this.labelSize[k],this.labelAngle[k],R,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":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;l<3;++l)for(var u=(l+1)%3,c=(l+2)%3,h=[0,0,0],f=[0,0,0],d=-1;d<=1;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;p<=1;p+=2){h[u]=p;for(var m=-1;m<=1;m+=2)h[c]=m,e.push(h[0],h[1],h[2],f[0],f[1],f[2]),i+=1}var v=u;u=c,c=v}var g=a(t,new Float32Array(e)),y=a(t,new Uint16Array(r),t.ELEMENT_ARRAY_BUFFER),b=o(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 a=t("gl-buffer"),o=t("gl-vao"),s=t("./shaders").bg,l=n.prototype;l.draw=function(t,e,r,n,i,a){for(var o=!1,s=0;s<3;++s)o=o||i[s];if(o){var l=this.gl;l.enable(l.POLYGON_OFFSET_FILL),l.polygonOffset(1,2),this.shader.bind(),this.shader.uniforms={model:t,view:e,projection:r,bounds:n,enable:i,colors:a},this.vao.bind(),this.vao.draw(this.gl.TRIANGLES,36),l.disable(l.POLYGON_OFFSET_FILL)}},l.dispose=function(){this.vao.dispose(),this.buffer.dispose(),this.shader.dispose()}},{"./shaders":150,"gl-buffer":154,"gl-vao":269}],148:[function(t,e,r){"use strict";function n(t,e,r){for(var n=0;n<4;++n){t[n]=r[12+n];for(var i=0;i<3;++i)t[n]+=e[i]*r[4*i+n]}}function i(t){for(var e=0;eS&&(_|=1<S&&(_|=1<f[m][1]&&(O=m));for(var R=-1,m=0;m<3;++m){var F=O^1<f[j][0]&&(j=F)}}var N=v;N[0]=N[1]=N[2]=0,N[o.log2(R^O)]=O&R,N[o.log2(O^j)]=O&j;var B=7^j;B===_||B===P?(B=7^R,N[o.log2(j^B)]=B&j):N[o.log2(R^B)]=B&R;for(var U=g,V=_,k=0;k<3;++k)U[k]=V&1< 0.0) {\n vec3 nPosition = mix(bounds[0], bounds[1], 0.5 * (position + 1.0));\n gl_Position = projection * view * model * vec4(nPosition, 1.0);\n } else {\n gl_Position = vec4(0,0,0,0);\n }\n colorChannel = abs(normal);\n}","precision mediump float;\n#define GLSLIFY 1\n\nuniform vec4 colors[3];\n\nvarying vec3 colorChannel;\n\nvoid main() {\n gl_FragColor = colorChannel.x * colors[0] + \n colorChannel.y * colors[1] +\n colorChannel.z * colors[2];\n}",null,[{name:"position",type:"vec3"},{name:"normal",type:"vec3"}])}},{"gl-shader":253}],151:[function(t,e,r){(function(r){"use strict";function n(t,e,r,n){this.gl=t,this.shader=e,this.buffer=r,this.vao=n,this.tickOffset=this.tickCount=this.labelOffset=this.labelCount=null}function i(t,e){try{return l(t,e)}catch(t){return console.warn("error vectorizing text:",t),{cells:[],positions:[]}}}function a(t,e,r,i,a,l){var c=o(t),h=s(t,[{buffer:c,size:3}]),f=u(t);f.attributes.position.location=0;var d=new n(t,f,c,h);return d.update(e,r,i,a,l),d}e.exports=a;var o=t("gl-buffer"),s=t("gl-vao"),l=t("vectorize-text"),u=t("./shaders").text,c=window||r.global||{},h=c.__TEXT_CACHE||{};c.__TEXT_CACHE={};var f=n.prototype,d=[0,0];f.bind=function(t,e,r,n){this.vao.bind(),this.shader.bind();var i=this.shader.uniforms;i.model=t,i.view=e,i.projection=r,i.pixelScale=n,d[0]=this.gl.drawingBufferWidth,d[1]=this.gl.drawingBufferHeight,this.shader.uniforms.resolution=d},f.update=function(t,e,r,n,a){function o(t,e,r,n){var a=h[r];a||(a=h[r]={});var o=a[e];o||(o=a[e]=i(e,{triangles:!0,font:r,textAlign:"center",textBaseline:"middle"}));for(var l=(n||12)/12,u=o.positions,c=o.cells,f=0,d=c.length;f=0;--m){var v=u[p[m]];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],f=[0,0,0],d=0;d<3;++d){c[d]=s.length/3|0,o(.5*(t[0][d]+t[1][d]),e[d],r),f[d]=(s.length/3|0)-c[d],l[d]=s.length/3|0;for(var p=0;p=0&&(i=r.length-n-1);var a=Math.pow(10,i),o=Math.round(t*e*a),s=o+"";if(s.indexOf("e")>=0)return s;var l=o/a,u=o%a;o<0?(l=0|-Math.ceil(l),u=0|-u):(l=0|Math.floor(l),u|=0);var c=""+l;if(o<0&&(c="-"+c),i){for(var h=""+u;h.length=t[0][i];--o)a.push({x:o*e[i],text:n(e[i],o)});r.push(a)}return r}function a(t,e){for(var r=0;r<3;++r){if(t[r].length!==e[r].length)return!1;for(var n=0;nr)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;i=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"),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&&void 0!==t.shape){var r=t.dtype;if(h.indexOf(r)<0&&(r="float32"),this.type===this.gl.ELEMENT_ARRAY_BUFFER){r=gl.getExtension("OES_element_index_uint")&&"uint16"!==r?"uint32":"uint16"}if(r===t.dtype&&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 n=l.malloc(t.size,r),s=c(n,t.shape);u.assign(s,t),this.length=e<0?i(this.gl,this.type,this.length,this.usage,n,e):i(this.gl,this.type,this.length,this.usage,n.subarray(0,t.size),e),l.free(n)}}else if(Array.isArray(t)){var f;f=this.type===this.gl.ELEMENT_ARRAY_BUFFER?a(t,"uint16"):a(t,"float32"),this.length=e<0?i(this.gl,this.type,this.length,this.usage,f,e):i(this.gl,this.type,this.length,this.usage,f.subarray(0,t.length),e),l.free(f)}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=1),this.gl.bufferData(this.type,0|t,this.usage),this.length=t}},e.exports=s},{ndarray:465,"ndarray-ops":459,"typedarray-pool":539}],155:[function(t,e,r){e.exports={0:"NONE",1:"ONE",2:"LINE_LOOP",3:"LINE_STRIP",4:"TRIANGLES",5:"TRIANGLE_STRIP",6:"TRIANGLE_FAN",256:"DEPTH_BUFFER_BIT",512:"NEVER",513:"LESS",514:"EQUAL",515:"LEQUAL",516:"GREATER",517:"NOTEQUAL",518:"GEQUAL",519:"ALWAYS",768:"SRC_COLOR",769:"ONE_MINUS_SRC_COLOR",770:"SRC_ALPHA",771:"ONE_MINUS_SRC_ALPHA",772:"DST_ALPHA",773:"ONE_MINUS_DST_ALPHA",774:"DST_COLOR",775:"ONE_MINUS_DST_COLOR",776:"SRC_ALPHA_SATURATE",1024:"STENCIL_BUFFER_BIT",1028:"FRONT",1029:"BACK",1032:"FRONT_AND_BACK",1280:"INVALID_ENUM",1281:"INVALID_VALUE",1282:"INVALID_OPERATION",1285:"OUT_OF_MEMORY",1286:"INVALID_FRAMEBUFFER_OPERATION",2304:"CW",2305:"CCW",2849:"LINE_WIDTH",2884:"CULL_FACE",2885:"CULL_FACE_MODE",2886:"FRONT_FACE",2928:"DEPTH_RANGE",2929:"DEPTH_TEST",2930:"DEPTH_WRITEMASK",2931:"DEPTH_CLEAR_VALUE",2932:"DEPTH_FUNC",2960:"STENCIL_TEST",2961:"STENCIL_CLEAR_VALUE",2962:"STENCIL_FUNC",2963:"STENCIL_VALUE_MASK",2964:"STENCIL_FAIL",2965:"STENCIL_PASS_DEPTH_FAIL",2966:"STENCIL_PASS_DEPTH_PASS",2967:"STENCIL_REF",2968:"STENCIL_WRITEMASK",2978:"VIEWPORT",3024:"DITHER",3042:"BLEND",3088:"SCISSOR_BOX",3089:"SCISSOR_TEST",3106:"COLOR_CLEAR_VALUE",3107:"COLOR_WRITEMASK",3317:"UNPACK_ALIGNMENT",3333:"PACK_ALIGNMENT",3379:"MAX_TEXTURE_SIZE",3386:"MAX_VIEWPORT_DIMS",3408:"SUBPIXEL_BITS",3410:"RED_BITS",3411:"GREEN_BITS",3412:"BLUE_BITS",3413:"ALPHA_BITS",3414:"DEPTH_BITS",3415:"STENCIL_BITS",3553:"TEXTURE_2D",4352:"DONT_CARE",4353:"FASTEST",4354:"NICEST",5120:"BYTE",5121:"UNSIGNED_BYTE",5122:"SHORT",5123:"UNSIGNED_SHORT",5124:"INT",5125:"UNSIGNED_INT",5126:"FLOAT",5386:"INVERT",5890:"TEXTURE",6401:"STENCIL_INDEX",6402:"DEPTH_COMPONENT",6406:"ALPHA",6407:"RGB",6408:"RGBA",6409:"LUMINANCE",6410:"LUMINANCE_ALPHA",7680:"KEEP",7681:"REPLACE",7682:"INCR",7683:"DECR",7936:"VENDOR",7937:"RENDERER",7938:"VERSION",9728:"NEAREST",9729:"LINEAR",9984:"NEAREST_MIPMAP_NEAREST",9985:"LINEAR_MIPMAP_NEAREST",9986:"NEAREST_MIPMAP_LINEAR",9987:"LINEAR_MIPMAP_LINEAR",10240:"TEXTURE_MAG_FILTER",10241:"TEXTURE_MIN_FILTER",10242:"TEXTURE_WRAP_S",10243:"TEXTURE_WRAP_T",10497:"REPEAT",10752:"POLYGON_OFFSET_UNITS",16384:"COLOR_BUFFER_BIT",32769:"CONSTANT_COLOR",32770:"ONE_MINUS_CONSTANT_COLOR",32771:"CONSTANT_ALPHA",32772:"ONE_MINUS_CONSTANT_ALPHA",32773:"BLEND_COLOR",32774:"FUNC_ADD",32777:"BLEND_EQUATION_RGB",32778:"FUNC_SUBTRACT",32779:"FUNC_REVERSE_SUBTRACT",32819:"UNSIGNED_SHORT_4_4_4_4",32820:"UNSIGNED_SHORT_5_5_5_1",32823:"POLYGON_OFFSET_FILL",32824:"POLYGON_OFFSET_FACTOR",32854:"RGBA4",32855:"RGB5_A1",32873:"TEXTURE_BINDING_2D",32926:"SAMPLE_ALPHA_TO_COVERAGE",32928:"SAMPLE_COVERAGE",32936:"SAMPLE_BUFFERS",32937:"SAMPLES",32938:"SAMPLE_COVERAGE_VALUE",32939:"SAMPLE_COVERAGE_INVERT",32968:"BLEND_DST_RGB",32969:"BLEND_SRC_RGB",32970:"BLEND_DST_ALPHA",32971:"BLEND_SRC_ALPHA",33071:"CLAMP_TO_EDGE",33170:"GENERATE_MIPMAP_HINT",33189:"DEPTH_COMPONENT16",33306:"DEPTH_STENCIL_ATTACHMENT",33635:"UNSIGNED_SHORT_5_6_5",33648:"MIRRORED_REPEAT",33901:"ALIASED_POINT_SIZE_RANGE",33902:"ALIASED_LINE_WIDTH_RANGE",33984:"TEXTURE0",33985:"TEXTURE1",33986:"TEXTURE2",33987:"TEXTURE3",33988:"TEXTURE4",33989:"TEXTURE5",33990:"TEXTURE6",33991:"TEXTURE7",33992:"TEXTURE8",33993:"TEXTURE9",33994:"TEXTURE10",33995:"TEXTURE11",33996:"TEXTURE12",33997:"TEXTURE13",33998:"TEXTURE14",33999:"TEXTURE15",34e3:"TEXTURE16",34001:"TEXTURE17",34002:"TEXTURE18",34003:"TEXTURE19",34004:"TEXTURE20",34005:"TEXTURE21",34006:"TEXTURE22",34007:"TEXTURE23",34008:"TEXTURE24",34009:"TEXTURE25",34010:"TEXTURE26",34011:"TEXTURE27",34012:"TEXTURE28",34013:"TEXTURE29",34014:"TEXTURE30",34015:"TEXTURE31",34016:"ACTIVE_TEXTURE",34024:"MAX_RENDERBUFFER_SIZE",34041:"DEPTH_STENCIL",34055:"INCR_WRAP",34056:"DECR_WRAP",34067:"TEXTURE_CUBE_MAP",34068:"TEXTURE_BINDING_CUBE_MAP",34069:"TEXTURE_CUBE_MAP_POSITIVE_X",34070:"TEXTURE_CUBE_MAP_NEGATIVE_X",34071:"TEXTURE_CUBE_MAP_POSITIVE_Y",34072:"TEXTURE_CUBE_MAP_NEGATIVE_Y",34073:"TEXTURE_CUBE_MAP_POSITIVE_Z",34074:"TEXTURE_CUBE_MAP_NEGATIVE_Z",34076:"MAX_CUBE_MAP_TEXTURE_SIZE",34338:"VERTEX_ATTRIB_ARRAY_ENABLED",34339:"VERTEX_ATTRIB_ARRAY_SIZE",34340:"VERTEX_ATTRIB_ARRAY_STRIDE",34341:"VERTEX_ATTRIB_ARRAY_TYPE",34342:"CURRENT_VERTEX_ATTRIB",34373:"VERTEX_ATTRIB_ARRAY_POINTER",34466:"NUM_COMPRESSED_TEXTURE_FORMATS",34467:"COMPRESSED_TEXTURE_FORMATS",34660:"BUFFER_SIZE",34661:"BUFFER_USAGE",34816:"STENCIL_BACK_FUNC",34817:"STENCIL_BACK_FAIL",34818:"STENCIL_BACK_PASS_DEPTH_FAIL",34819:"STENCIL_BACK_PASS_DEPTH_PASS",34877:"BLEND_EQUATION_ALPHA",34921:"MAX_VERTEX_ATTRIBS",34922:"VERTEX_ATTRIB_ARRAY_NORMALIZED",34930:"MAX_TEXTURE_IMAGE_UNITS",34962:"ARRAY_BUFFER",34963:"ELEMENT_ARRAY_BUFFER",34964:"ARRAY_BUFFER_BINDING",34965:"ELEMENT_ARRAY_BUFFER_BINDING",34975:"VERTEX_ATTRIB_ARRAY_BUFFER_BINDING",35040:"STREAM_DRAW",35044:"STATIC_DRAW",35048:"DYNAMIC_DRAW",35632:"FRAGMENT_SHADER",35633:"VERTEX_SHADER",35660:"MAX_VERTEX_TEXTURE_IMAGE_UNITS",35661:"MAX_COMBINED_TEXTURE_IMAGE_UNITS",35663:"SHADER_TYPE",35664:"FLOAT_VEC2",35665:"FLOAT_VEC3",35666:"FLOAT_VEC4",35667:"INT_VEC2",35668:"INT_VEC3",35669:"INT_VEC4",35670:"BOOL",35671:"BOOL_VEC2",35672:"BOOL_VEC3",35673:"BOOL_VEC4",35674:"FLOAT_MAT2",35675:"FLOAT_MAT3",35676:"FLOAT_MAT4",35678:"SAMPLER_2D",35680:"SAMPLER_CUBE",35712:"DELETE_STATUS",35713:"COMPILE_STATUS",35714:"LINK_STATUS",35715:"VALIDATE_STATUS",35716:"INFO_LOG_LENGTH",35717:"ATTACHED_SHADERS",35718:"ACTIVE_UNIFORMS",35719:"ACTIVE_UNIFORM_MAX_LENGTH",35720:"SHADER_SOURCE_LENGTH",35721:"ACTIVE_ATTRIBUTES",35722:"ACTIVE_ATTRIBUTE_MAX_LENGTH",35724:"SHADING_LANGUAGE_VERSION",35725:"CURRENT_PROGRAM",36003:"STENCIL_BACK_REF",36004:"STENCIL_BACK_VALUE_MASK",36005:"STENCIL_BACK_WRITEMASK",36006:"FRAMEBUFFER_BINDING",36007:"RENDERBUFFER_BINDING",36048:"FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE",36049:"FRAMEBUFFER_ATTACHMENT_OBJECT_NAME",36050:"FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL",36051:"FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE",36053:"FRAMEBUFFER_COMPLETE",36054:"FRAMEBUFFER_INCOMPLETE_ATTACHMENT",36055:"FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT",36057:"FRAMEBUFFER_INCOMPLETE_DIMENSIONS",36061:"FRAMEBUFFER_UNSUPPORTED",36064:"COLOR_ATTACHMENT0",36096:"DEPTH_ATTACHMENT",36128:"STENCIL_ATTACHMENT",36160:"FRAMEBUFFER",36161:"RENDERBUFFER",36162:"RENDERBUFFER_WIDTH",36163:"RENDERBUFFER_HEIGHT",36164:"RENDERBUFFER_INTERNAL_FORMAT",36168:"STENCIL_INDEX8",36176:"RENDERBUFFER_RED_SIZE",36177:"RENDERBUFFER_GREEN_SIZE",36178:"RENDERBUFFER_BLUE_SIZE",36179:"RENDERBUFFER_ALPHA_SIZE",36180:"RENDERBUFFER_DEPTH_SIZE",36181:"RENDERBUFFER_STENCIL_SIZE",36194:"RGB565",36336:"LOW_FLOAT",36337:"MEDIUM_FLOAT",36338:"HIGH_FLOAT",36339:"LOW_INT",36340:"MEDIUM_INT",36341:"HIGH_INT",36346:"SHADER_COMPILER",36347:"MAX_VERTEX_UNIFORM_VECTORS",36348:"MAX_VARYING_VECTORS",36349:"MAX_FRAGMENT_UNIFORM_VECTORS",37440:"UNPACK_FLIP_Y_WEBGL",37441:"UNPACK_PREMULTIPLY_ALPHA_WEBGL",37442:"CONTEXT_LOST_WEBGL",37443:"UNPACK_COLORSPACE_CONVERSION_WEBGL",37444:"BROWSER_DEFAULT_WEBGL"}},{}],156:[function(t,e,r){var n=t("./1.0/numbers");e.exports=function(t){return n[t]}},{"./1.0/numbers":155}],157:[function(t,e,r){"use strict";function n(t,e,r,n){this.plot=t,this.shader=e,this.bufferHi=r,this.bufferLo=n,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=o(t.gl),u=new n(t,r,i,s);return u.update(e),t.addObject(u),u}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=new Float32Array([0,0]),e=new Float32Array([0,0]),r=new Float32Array([0,0]),n=new Float32Array([0,0]),i=[1,1];return function(){var a=this.plot,o=this.shader,s=this.bounds,l=this.numPoints;if(l){var c=a.gl,h=a.dataBox,f=a.viewBox,d=a.pixelRatio,p=s[2]-s[0],m=s[3]-s[1],v=h[2]-h[0],g=h[3]-h[1],y=2*p/v,b=2*m/g,x=(s[0]-h[0]-.5*v)/p,_=(s[1]-h[1]-.5*g)/m;t[0]=y,t[1]=b,e[0]=y-t[0],e[1]=b-t[1],r[0]=x,r[1]=_,n[0]=x-r[0],n[1]=_-r[1];var w=f[2]-f[0],M=f[3]-f[1];i[0]=2*d/w,i[1]=2*d/M,o.bind(),o.uniforms.scaleHi=t,o.uniforms.scaleLo=e,o.uniforms.translateHi=r,o.uniforms.translateLo=n,o.uniforms.pixelScale=i,o.uniforms.color=this.color,this.bufferLo.bind(),o.attributes.positionLo.pointer(c.FLOAT,!1,16,0),this.bufferHi.bind(),o.attributes.positionHi.pointer(c.FLOAT,!1,16,0),o.attributes.pixelOffset.pointer(c.FLOAT,!1,16,8),c.drawArrays(c.TRIANGLES,0,l*u.length)}}}(),c.drawPick=function(t){return t},c.pick=function(){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],h=this.numPoints=i.length>>1;for(e=0;e0&&(T*=_),S<0?S*=w:S>0&&(S*=M),v[b++]=f*(r-p+T),v[b++]=d*(n-m+S),v[b++]=o*A[2]+(l+o)*A[4],v[b++]=o*A[3]+(l+o)*A[5]}}for(e=0;e=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 a=n[12],o=n[13],s=n[14],l=n[15],u=this.pixelRatio*(i[3]*a+i[7]*o+i[11]*s+i[15]*l)/e.drawingBufferHeight;this.vao.bind();for(var h=0;h<3;++h)e.lineWidth(this.lineWidth[h]),r.capSize=this.capSize[h]*u,this.lineCount[h]&&e.drawArrays(e.LINES,this.lineOffset[h],this.lineCount[h]);this.vao.unbind()};var f=function(){for(var t=new Array(3),e=0;e<3;++e){for(var r=[],n=1;n<=2;++n)for(var i=-1;i<=1;i+=2){var a=(n+e)%3,o=[0,0,0];o[a]=i,r.push(o)}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 o=[],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;u<3;++u){this.lineOffset[u]=l;t:for(var c=0;c0){var m=h.slice();m[u]+=d[1][u],o.push(h[0],h[1],h[2],p[0],p[1],p[2],p[3],0,0,0,m[0],m[1],m[2],p[0],p[1],p[2],p[3],0,0,0),i(this.bounds,m),l+=2+a(o,m,p,u)}}}this.lineCount[u]=l-this.lineOffset[u]}this.buffer.update(o)}},h.dispose=function(){this.shader.dispose(),this.buffer.dispose(),this.vao.dispose()}},{"./shaders/index":161,"gl-buffer":154,"gl-vao":269}],160:[function(t,e,r){e.exports=function(t){"string"==typeof t&&(t=[t]);for(var e=[].slice.call(arguments,1),r=[],n=0;n1&&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 v=0;vs||r<0||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;uo||r<0||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)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,m,v,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,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,h(this,this._shape[0],t),t},enumerable:!1}}),b.bind=function(){if(!this._destroyed){var t=this.gl;t.bindFramebuffer(t.FRAMEBUFFER,this.handle),t.viewport(0,0,this._shape[0],this._shape[1])}},b.dispose=function(){if(!this._destroyed){this._destroyed=!0;var t=this.gl;t.deleteFramebuffer(this.handle),this.handle=null,this.depth&&(this.depth.dispose(),this.depth=null),this._depth_rb&&(t.deleteRenderbuffer(this._depth_rb),this._depth_rb=null);for(var e=0;e>8*d&255;this.pickOffset=r,i.bind();var p=i.uniforms;p.viewTransform=t,p.pickOffset=e,p.shape=this.shape;var m=i.attributes;return this.positionBuffer.bind(),m.position.pointer(),this.weightBuffer.bind(),m.weight.pointer(s.UNSIGNED_BYTE,!1),this.idBuffer.bind(),m.pickId.pointer(s.UNSIGNED_BYTE,!1),s.drawArrays(s.TRIANGLES,0,o),r+this.shape[0]*this.shape[1]}}}(),h.pick=function(t,e,r){var n=this.pickOffset,i=this.shape[0]*this.shape[1];if(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]]}},h.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,h=this.bounds,d=h[0]=r[0],p=h[1]=n[0],m=h[2]=r[r.length-1],v=h[3]=n[n.length-1],g=1/(m-d),y=1/(v-p),b=e[0],x=e[1];this.shape=[b,x];var _=(b-1)*(x-1)*(f.length>>>1);this.numVertices=_;for(var w=s.mallocUint8(4*_),M=s.mallocFloat32(2*_),k=s.mallocUint8(2*_),A=s.mallocUint32(_),T=0,S=0;S2&&!this.usingDashes){var b=this.mitreShader;this.lineBufferLo.bind(),b.attributes.aLo.pointer(l.FLOAT,!1,48,0),this.lineBufferHi.bind(),b.bind();var x=b.uniforms;this.setProjectionUniforms(x,a),x.color=c,x.radius=s*u,b.attributes.aHi.pointer(l.FLOAT,!1,48,0),l.drawArrays(l.POINTS,0,i/3|0)}}}}(),f.drawPick=function(){var t=[0,0,0,0];return function(e){var r=this.vertCount,n=this.numPoints;if(this.pickOffset=e,!r)return e+n;var i=this.setProjectionModel(),a=this.plot,o=this.width,s=a.gl,l=a.pickPixelRatio,u=this.pickShader,c=this.pickBuffer;t[0]=255&e,t[1]=e>>>8&255,t[2]=e>>>16&255,t[3]=e>>>24,u.bind();var h=u.uniforms;this.setProjectionUniforms(h,i),h.width=o*l,h.pickOffset=t;var f=u.attributes;return this.lineBufferHi.bind(),f.aHi.pointer(s.FLOAT,!1,16,0),f.dHi.pointer(s.FLOAT,!1,16,8),this.lineBufferLo.bind(),f.aLo.pointer(s.FLOAT,!1,16,0),c.bind(),f.pick0.pointer(s.UNSIGNED_BYTE,!1,8,0),f.pick1.pointer(s.UNSIGNED_BYTE,!1,8,4),s.drawArrays(s.TRIANGLES,0,r),e+n}}(),f.pick=function(t,e,r){var n=this.pickOffset,i=this.numPoints;if(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]]}},f.update=function(t){t=t||{};var e,r,n,a,o,s=this.plot.gl;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]]);var h=t.dashes||[1],f=0;for(e=0;e1,this.dashPattern=l(s,u(d,[f,1,4],[1,0,0])),this.dashPattern.minFilter=s.NEAREST,this.dashPattern.magFilter=s.NEAREST,this.dashLength=f,c.free(d);var m=t.positions;this.data=m;var v=this.bounds;v[0]=v[1]=1/0,v[2]=v[3]=-1/0;var g=this.numPoints=m.length>>>1;if(0!==g){for(e=0;e1;){var A=--n;a=m[2*n],o=m[2*n+1];var T=A-1,S=m[2*T],E=m[2*T+1];if(!(isNaN(a)||isNaN(o)||isNaN(S)||isNaN(E))){k+=1,a=(a-v[0])/(v[2]-v[0]),o=(o-v[1])/(v[3]-v[1]),S=(S-v[0])/(v[2]-v[0]),E=(E-v[1])/(v[3]-v[1]);var L=S-a,C=E-o,z=A|1<<24,I=A-1,D=A,P=A-1|1<<24;y[--w]=-C,y[--w]=-L,y[--w]=o,y[--w]=a,_[--M]=z,_[--M]=I,y[--w]=C,y[--w]=L,y[--w]=E,y[--w]=S,_[--M]=D,_[--M]=P,y[--w]=-C,y[--w]=-L,y[--w]=E,y[--w]=S,_[--M]=D,_[--M]=P,y[--w]=C,y[--w]=L,y[--w]=E,y[--w]=S,_[--M]=D,_[--M]=P,y[--w]=-C,y[--w]=-L,y[--w]=o,y[--w]=a,_[--M]=z,_[--M]=I,y[--w]=C,y[--w]=L,y[--w]=o,y[--w]=a,_[--M]=z,_[--M]=I}}for(e=0;e 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}",null,a)}},{"gl-shader":253}],170:[function(t,e,r){"use strict";function n(t,e){for(var r=0,n=0;n<3;++n){var i=t[n]-e[n];r+=i*i}return Math.sqrt(r)}function i(t){for(var e=[[-1e6,-1e6,-1e6],[1e6,1e6,1e6]],r=0;r<3;++r)e[0][r]=Math.max(t[0][r],e[0][r]),e[1][r]=Math.min(t[1][r],e[1][r]);return e}function a(t,e,r,n){this.arcLength=t,this.position=e,this.index=r,this.dataCoordinate=n}function o(t,e,r,n,i,a){this.gl=t,this.shader=e,this.pickShader=r,this.buffer=n,this.vao=i,this.clipBounds=[[-1/0,-1/0,-1/0],[1/0,1/0,1/0]],this.points=[],this.arcLength=[],this.vertexCount=0,this.bounds=[[0,0,0],[0,0,0]],this.pickId=0,this.lineWidth=1,this.texture=a,this.dashScale=1,this.opacity=1,this.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=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),a=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;h<1024;++h)s.data[h]=255;var f=c(e,s);f.wrap=e.REPEAT;var p=new o(e,r,n,i,a,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"),m=p.createShader,v=p.createPickShader,g=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],y=o.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 a=t.position||t.positions;if(a){var o=t.color||t.colors||[0,0,0,1],s=t.lineWidth||1,l=[],u=[],c=[],h=0,p=0,m=[[1/0,1/0,1/0],[-1/0,-1/0,-1/0]],v=!1;t:for(e=1;e0){for(var b=0;b<24;++b)l.push(l[l.length-12]);p+=2,v=!0}continue t}m[0][r]=Math.min(m[0][r],g[r],y[r]),m[1][r]=Math.max(m[1][r],g[r],y[r])}var x,_;Array.isArray(o[0])?(x=o[e-1],_=o[e]):x=_=o,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),v){for(r=0;r<2;++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,v=!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(a[a.length-1].slice()),this.bounds=m,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;e0?(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],a=e[1],o=e[2],s=e[3],l=i+i,u=a+a,c=o+o,h=i*l,f=i*u,d=i*c,p=a*u,m=a*c,v=o*c,g=s*l,y=s*u,b=s*c,x=n[0],_=n[1],w=n[2];return t[0]=(1-(p+v))*x,t[1]=(f+b)*x,t[2]=(d-y)*x,t[3]=0,t[4]=(f-b)*_,t[5]=(1-(h+v))*_,t[6]=(m+g)*_,t[7]=0,t[8]=(d+y)*w,t[9]=(m-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 a=e[0],o=e[1],s=e[2],l=e[3],u=a+a,c=o+o,h=s+s,f=a*u,d=a*c,p=a*h,m=o*c,v=o*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-(m+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]=(v+y)*w,t[7]=0,t[8]=(p+b)*M,t[9]=(v-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],a=e[3],o=r+r,s=n+n,l=i+i,u=r*o,c=n*o,h=n*s,f=i*o,d=i*s,p=i*l,m=a*o,v=a*s,g=a*l;return t[0]=1-h-p,t[1]=c+g,t[2]=f-v,t[3]=0,t[4]=c-g,t[5]=1-u-p,t[6]=d+m,t[7]=0,t[8]=f+v,t[9]=d-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,a,o){var s=1/(r-e),l=1/(i-n),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]=(r+e)*s,t[9]=(i+n)*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,r,n,i){var a=1/Math.tan(e/2),o=1/(n-i);return t[0]=a/r,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=a,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=(i+n)*o,t[11]=-1,t[12]=0,t[13]=0,t[14]=2*i*n*o,t[15]=0,t},i.perspectiveFromFieldOfView=function(t,e,r,n){var i=Math.tan(e.upDegrees*Math.PI/180),a=Math.tan(e.downDegrees*Math.PI/180),o=Math.tan(e.leftDegrees*Math.PI/180),s=Math.tan(e.rightDegrees*Math.PI/180),l=2/(o+s),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]=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,a,o){var s=1/(e-r),l=1/(n-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+r)*s,t[13]=(i+n)*l,t[14]=(o+a)*u,t[15]=1,t},i.lookAt=function(t,e,r,a){var o,s,l,u,c,h,f,d,p,m,v=e[0],g=e[1],y=e[2],b=a[0],x=a[1],_=a[2],w=r[0],M=r[1],k=r[2];return Math.abs(v-w).999999?(n[0]=0,n[1]=0,n[2]=0,n[3]=1,n):(a.cross(t,i,o),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=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,r){r*=.5;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=o.add,s.multiply=function(t,e,r){var n=e[0],i=e[1],a=e[2],o=e[3],s=r[0],l=r[1],u=r[2],c=r[3];return t[0]=n*c+o*s+i*u-a*l,t[1]=i*c+o*l+a*s-n*u,t[2]=a*c+o*u+n*l-i*s,t[3]=o*c-n*s-i*l-a*u,t},s.mul=s.multiply,s.scale=o.scale,s.rotateX=function(t,e,r){r*=.5;var n=e[0],i=e[1],a=e[2],o=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]=a*l-i*s,t[3]=o*l-n*s,t},s.rotateY=function(t,e,r){r*=.5;var n=e[0],i=e[1],a=e[2],o=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]=a*l+n*s,t[3]=o*l-i*s,t},s.rotateZ=function(t,e,r){r*=.5;var n=e[0],i=e[1],a=e[2],o=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]=a*l+o*s,t[3]=o*l-a*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=o.dot,s.lerp=o.lerp,s.slerp=function(t,e,r,n){var i,a,o,s,l,u=e[0],c=e[1],h=e[2],f=e[3],d=r[0],p=r[1],m=r[2],v=r[3];return a=u*d+c*p+h*m+f*v,a<0&&(a=-a,d=-d,p=-p,m=-m,v=-v),1-a>1e-6?(i=Math.acos(a),o=Math.sin(i),s=Math.sin((1-n)*i)/o,l=Math.sin(n*i)/o):(s=1-n,l=n),t[0]=s*u+l*d,t[1]=s*c+l*p,t[2]=s*h+l*m,t[3]=s*f+l*v,t},s.sqlerp=function(){var t=s.create(),e=s.create();return function(r,n,i,a,o,l){return s.slerp(t,n,o,l),s.slerp(e,i,a,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],a=e[3],o=r*r+n*n+i*i+a*a,s=o?1/o:0;return t[0]=-r*s,t[1]=-n*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 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 a=(i+1)%3,o=(i+2)%3;r=Math.sqrt(e[3*i+i]-e[3*a+a]-e[3*o+o]+1),t[i]=.5*r,r=.5/r,t[3]=(e[3*a+o]-e[3*o+a])*r,t[a]=(e[3*a+i]+e[3*i+a])*r,t[o]=(e[3*o+i]+e[3*i+o])*r}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":192,"./mat3.js":195,"./vec3.js":199,"./vec4.js":200}],198:[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],a=e[1];return t[0]=i+n*(r[0]-i),t[1]=a+n*(r[1]-a),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,a,o){var s,l;for(r||(r=2),n||(n=0),l=i?Math.min(i*r+n,e.length):e.length,s=n;s0&&(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,r){var n=e[0],i=e[1],a=e[2],o=r[0],s=r[1],l=r[2];return t[0]=i*l-a*s,t[1]=a*o-n*l,t[2]=n*s-i*o,t},i.lerp=function(t,e,r,n){var i=e[0],a=e[1],o=e[2];return t[0]=i+n*(r[0]-i),t[1]=a+n*(r[1]-a),t[2]=o+n*(r[2]-o),t},i.hermite=function(t,e,r,n,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+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,a){var o=1-a,s=o*o,l=a*a,u=s*o,c=3*a*s,h=3*l*o,f=l*a;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,a=Math.sqrt(1-i*i)*e;return t[0]=Math.cos(r)*a,t[1]=Math.sin(r)*a,t[2]=i*e,t},i.transformMat4=function(t,e,r){var n=e[0],i=e[1],a=e[2],o=r[3]*n+r[7]*i+r[11]*a+r[15];return o=o||1,t[0]=(r[0]*n+r[4]*i+r[8]*a+r[12])/o,t[1]=(r[1]*n+r[5]*i+r[9]*a+r[13])/o,t[2]=(r[2]*n+r[6]*i+r[10]*a+r[14])/o,t},i.transformMat3=function(t,e,r){var n=e[0],i=e[1],a=e[2];return t[0]=n*r[0]+i*r[3]+a*r[6],t[1]=n*r[1]+i*r[4]+a*r[7],t[2]=n*r[2]+i*r[5]+a*r[8],t},i.transformQuat=function(t,e,r){var n=e[0],i=e[1],a=e[2],o=r[0],s=r[1],l=r[2],u=r[3],c=u*n+s*a-l*i,h=u*i+l*n-o*a,f=u*a+o*i-s*n,d=-o*n-s*i-l*a;return t[0]=c*u+d*-o+h*-l-f*-s,t[1]=h*u+d*-s+f*-o-c*-l,t[2]=f*u+d*-l+c*-s-h*-o,t},i.rotateX=function(t,e,r,n){var i=[],a=[];return i[0]=e[0]-r[0],i[1]=e[1]-r[1],i[2]=e[2]-r[2],a[0]=i[0],a[1]=i[1]*Math.cos(n)-i[2]*Math.sin(n),a[2]=i[1]*Math.sin(n)+i[2]*Math.cos(n),t[0]=a[0]+r[0],t[1]=a[1]+r[1],t[2]=a[2]+r[2],t},i.rotateY=function(t,e,r,n){var i=[],a=[];return i[0]=e[0]-r[0],i[1]=e[1]-r[1],i[2]=e[2]-r[2],a[0]=i[2]*Math.sin(n)+i[0]*Math.cos(n),a[1]=i[1],a[2]=i[2]*Math.cos(n)-i[0]*Math.sin(n),t[0]=a[0]+r[0],t[1]=a[1]+r[1],t[2]=a[2]+r[2],t},i.rotateZ=function(t,e,r,n){var i=[],a=[];return i[0]=e[0]-r[0],i[1]=e[1]-r[1],i[2]=e[2]-r[2],a[0]=i[0]*Math.cos(n)-i[1]*Math.sin(n),a[1]=i[0]*Math.sin(n)+i[1]*Math.cos(n),a[2]=i[2],t[0]=a[0]+r[0],t[1]=a[1]+r[1],t[2]=a[2]+r[2],t},i.forEach=function(){var t=i.create();return function(e,r,n,i,a,o){var s,l;for(r||(r=3),n||(n=0),l=i?Math.min(i*r+n,e.length):e.length,s=n;s1?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 r=t[0],i=t[1],a=t[2],o=e[0],s=e[1],l=e[2];return Math.abs(r-o)<=n.EPSILON*Math.max(1,Math.abs(r),Math.abs(o))&&Math.abs(i-s)<=n.EPSILON*Math.max(1,Math.abs(i),Math.abs(s))&&Math.abs(a-l)<=n.EPSILON*Math.max(1,Math.abs(a),Math.abs(l))},e.exports=i},{"./common.js":192}],200:[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 a=new n.ARRAY_TYPE(4);return a[0]=t,a[1]=e,a[2]=r,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,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],a=e[3]-t[3];return Math.sqrt(r*r+n*n+i*i+a*a)},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],a=e[3]-t[3];return r*r+n*n+i*i+a*a},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],a=e[3],o=r*r+n*n+i*i+a*a;return o>0&&(o=1/Math.sqrt(o),t[0]=r*o,t[1]=n*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,r,n){var i=e[0],a=e[1],o=e[2],s=e[3];return t[0]=i+n*(r[0]-i),t[1]=a+n*(r[1]-a),t[2]=o+n*(r[2]-o),t[3]=s+n*(r[3]-s),t},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],a=e[2],o=e[3];return t[0]=r[0]*n+r[4]*i+r[8]*a+r[12]*o,t[1]=r[1]*n+r[5]*i+r[9]*a+r[13]*o,t[2]=r[2]*n+r[6]*i+r[10]*a+r[14]*o,t[3]=r[3]*n+r[7]*i+r[11]*a+r[15]*o,t},i.transformQuat=function(t,e,r){var n=e[0],i=e[1],a=e[2],o=r[0],s=r[1],l=r[2],u=r[3],c=u*n+s*a-l*i,h=u*i+l*n-o*a,f=u*a+o*i-s*n,d=-o*n-s*i-l*a;return t[0]=c*u+d*-o+h*-l-f*-s, -t[1]=h*u+d*-s+f*-o-c*-l,t[2]=f*u+d*-l+c*-s-h*-o,t[3]=e[3],t},i.forEach=function(){var t=i.create();return function(e,r,n,i,a,o){var s,l;for(r||(r=4),n||(n=0),l=i?Math.min(i*r+n,e.length):e.length,s=n;s1.0001)return null;v+=m[c]}return Math.abs(v-1)>.001?null:[h,o(t,m),m]}var l=t("barycentric"),u=t("polytope-closest-point/lib/closest_point_2d.js");e.exports=s},{barycentric:47,"polytope-closest-point/lib/closest_point_2d.js":484}],202:[function(t,e,r){var n="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}";r.meshShader={vertex:"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}",fragment:"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}",attributes:[{name:"position",type:"vec3"},{name:"normal",type:"vec3"},{name:"color",type:"vec4"},{name:"uv",type:"vec2"}]},r.wireShader={vertex:"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}",fragment:"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}",attributes:[{name:"position",type:"vec3"},{name:"color",type:"vec4"},{name:"uv",type:"vec2"}]},r.pointShader={vertex:"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}",fragment:"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}",attributes:[{name:"position",type:"vec3"},{name:"color",type:"vec4"},{name:"uv",type:"vec2"},{name:"pointSize",type:"float"}]},r.pickShader={vertex:"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}",fragment:n,attributes:[{name:"position",type:"vec3"},{name:"id",type:"vec4"}]},r.pointPickShader={vertex:"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}",fragment:n,attributes:[{name:"position",type:"vec3"},{name:"pointSize",type:"float"},{name:"id",type:"vec4"}]},r.contourShader={vertex:"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}",fragment:"precision mediump float;\n#define GLSLIFY 1\n\nuniform vec3 contourColor;\n\nvoid main() {\n gl_FragColor = vec4(contourColor,1);\n}\n",attributes:[{name:"position",type:"vec3"}]}},{}],203:[function(t,e,r){"use strict";function n(t,e,r,n,i,a,o,s,l,u,c,h,f,d,p,m,v,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=a,this.pointPickShader=o,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=v,this.edgeUVs=g,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=D,this._view=D,this._projection=D,this._resolution=[1,1]}function i(t){for(var e=w({colormap:t,nshades:256,format:"rgba"}),r=new Uint8Array(1024),n=0;n<256;++n){for(var i=e[n],a=0;a<3;++a)r[4*n+a]=i[a];r[4*n+3]=255*i[3]}return _(r,[256,256,4],[4,0,1])}function a(t,e,r){for(var n=new Array(e),i=0;i=1},P.isTransparent=function(){return this.opacity<1},P.pickSlots=1,P.setPickBase=function(t){this.pickId=t},P.highlight=function(t){if(!t||!this.contourEnable)return void(this.contourCount=0);for(var e=M(this.cells,this.intensity,t.intensity),r=e.cells,n=e.vertexIds,i=e.vertexWeights,a=r.length,o=k.mallocFloat32(6*a),s=0,l=0;l0){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()}},P.drawPick=function(t){t=t||{};for(var e=this.gl,r=t.model||D,n=t.view||D,i=t.projection||D,a=[[-1e6,-1e6,-1e6],[1e6,1e6,1e6]],o=0;o<3;++o)a[0][o]=Math.max(a[0][o],this.clipBounds[0][o]),a[1][o]=Math.min(a[1][o],this.clipBounds[1][o]);this._model=[].slice.call(r),this._view=[].slice.call(n),this._projection=[].slice.call(i),this._resolution=[e.drawingBufferWidth,e.drawingBufferHeight];var s={model:r,view:n,projection:i,clipBounds:a,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()}},P.pick=function(t){if(!t)return null;if(t.id!==this.pickId)return null;for(var e=t.value[0]+256*t.value[1]+65536*t.value[2],r=this.cells[e],n=this.positions,i=new Array(r.length),a=0;as[k]&&(a.uniforms.dataAxis=t,a.uniforms.screenOffset=e,a.uniforms.color=v[n],a.uniforms.angle=g[n],u.drawArrays(u.TRIANGLES,s[k],s[A]-s[k]))),y[n]&&M&&(e[1^n]-=T*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,M)),e[1^n]=T*c[2+(1^n)]-1,p[n+2]&&(e[1^n]+=T*d*m[n+2],ks[k]&&(a.uniforms.dataAxis=t,a.uniforms.screenOffset=e,a.uniforms.color=v[n+2],a.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],a.uniforms.dataAxis=r,a.uniforms.screenOffset=e,a.uniforms.color=x[n+2],a.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,a=r.screenBox,o=r.titleCenter,s=r.titleAngle,l=r.titleColor,u=r.pixelRatio;if(this.titleCount){for(var c=0;c<2;++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;u<2;++u){var c=a[u],h=a[u+2],f=h-c,d=.5*(o[u+2]+o[u]),p=o[u+2]-o[u],m=l[u],v=l[u+2],g=v-m,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){var e,r,n,i,a,o=[],l=t.ticks,u=t.bounds;for(a=0;a<2;++a){var c=[Math.floor(o.length/3)],h=[-1/0],f=l[a];for(e=0;er)for(t=r;te)for(t=e;t=0){for(var k=0|M.type.charAt(M.type.length-1),A=new Array(k),T=0;T=0;)S+=1;w[b]=S}var E=new Array(r.length);a(),d._relink=a,d.types={uniforms:l(r),attributes:l(n)},d.attributes=s(p,d,x,w),Object.defineProperty(d,"uniforms",o(p,d,r,E))},e.exports=a},{"./lib/GLError":211,"./lib/create-attributes":212,"./lib/create-uniforms":213,"./lib/reflect":214,"./lib/runtime-reflect":215,"./lib/shader-cache":216}],211:[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},{}],212:[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;c=0){var p=f.charCodeAt(f.length-1)-48;if(p<2||p>4)throw new s("","Invalid data type for attribute "+h+": "+f);i(t,e,d[0],n,p,o,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(p<2||p>4)throw new s("","Invalid data type for attribute "+h+": "+f);a(t,e,d,n,p,o,h)}}}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":211}],213:[function(t,e,r){"use strict";function n(t){return new Function("y","return function(){return y}")(t)}function i(t,e){for(var r=new Array(t),n=0;n4)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(i<2||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;parseInt(n)+""===n?a+="["+n+"]":a+="."+n,"object"==typeof i?r.push.apply(r,c(a,i)):r.push([a,i])}return r}function h(e){for(var n=["return function updateProperty(obj){"],i=c("",e),o=0;o4)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(r<2||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:h(i),enumerable:!0,configurable:!1})}else a[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 o||(o[l[0]]=[]),o=o[l[0]];for(var u=1;u1)for(var l=0;l=0){var m=e[p]-n[p]*(e[p+2]-e[p])/(n[p+2]-n[p]);0===p?o.drawLine(m,e[1],m,e[3],d[p],f[p]):o.drawLine(e[0],m,e[2],m,d[p],f[p])}}for(var p=0;p=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;r0){var r=Math.round(Math.pow(10,e));return Math.ceil(t/r)*r}return Math.ceil(t)}function o(t){return"boolean"!=typeof t||t}function s(t){function e(){if(!w&&G.autoResize){var t=M.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!==M.width||i!==M.height){M.width=n,M.height=i;var a=M.style;a.position=a.position||"absolute",a.left="0px",a.top="0px",a.width=e+"px",a.height=r+"px",N=!0}}}function r(){for(var t=O.length,e=j.length,r=0;r0&&0===F[e-1];)F.pop(),j.pop().dispose()}function s(){if(G.contextLost)return!0;A.isContextLost()&&(G.contextLost=!0,G.mouseListener.enabled=!1,G.selection.object=null,G.oncontextloss&&G.oncontextloss())}function b(){if(!s()){A.colorMask(!0,!0,!0,!0),A.depthMask(!0),A.disable(A.BLEND),A.enable(A.DEPTH_TEST);for(var t=O.length,e=j.length,r=0;rS.distance)continue;for(var u=0;u>>1;for(r=0;r=e[0]&&a<=e[2]&&o>=e[1]&&o<=e[3]&&n++}return n}function a(t,e){ -var r=t.gl,i=s(r),a=s(r),l=o(r,u.pointVertex,u.pointFragment),c=o(r,u.pickVertex,u.pickFragment),h=new n(t,i,a,l,c);return h.update(e),t.addObject(h),h}var o=t("gl-shader"),s=t("gl-buffer"),l=t("typedarray-pool"),u=t("./lib/shader");e.exports=a;var c=n.prototype;c.dispose=function(){this.shader.dispose(),this.pickShader.dispose(),this.offsetBuffer.dispose(),this.pickBuffer.dispose(),this.plot.removeObject(this)},c.update=function(t){function e(e,r){return e in t?t[e]:r}var r;t=t||{},this.sizeMin=e("sizeMin",.5),this.sizeMax=e("sizeMax",20),this.color=e("color",[1,0,0,1]).slice(),this.areaRatio=e("areaRatio",1),this.borderColor=e("borderColor",[0,0,0,1]).slice(),this.blend=e("blend",!1);var n=t.positions.length>>>1,i=t.positions instanceof Float32Array,a=t.idToIndex instanceof Int32Array&&t.idToIndex.length>=n,o=t.positions,s=i?o:l.mallocFloat32(o.length),u=a?t.idToIndex:l.mallocInt32(n);if(i||s.set(o),!a)for(s.set(o),r=0;r>8&255,e[2]=r>>16&255,e[3]=r>>24&255,this.pickBuffer.bind(),a.attributes.pickId.pointer(o.UNSIGNED_BYTE),a.uniforms.pickOffset=e,this.pickOffset=r);var f=o.getParameter(o.BLEND),d=o.getParameter(o.DITHER);return f&&!this.blend&&o.disable(o.BLEND),d&&o.disable(o.DITHER),o.drawArrays(o.POINTS,0,this.pointCount),f&&!this.blend&&o.enable(o.BLEND),d&&o.enable(o.DITHER),r+this.pointCount}}(),c.draw=c.unifiedDraw,c.drawPick=c.unifiedDraw,c.pick=function(t,e,r){var n=this.pickOffset,i=this.pointCount;if(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":220,"gl-buffer":154,"gl-shader":221,"typedarray-pool":539}],229:[function(t,e,r){function n(t,e,r,n){var i,a,o,s,l,u=e[0],c=e[1],h=e[2],f=e[3],d=r[0],p=r[1],m=r[2],v=r[3];return a=u*d+c*p+h*m+f*v,a<0&&(a=-a,d=-d,p=-p,m=-m,v=-v),1-a>1e-6?(i=Math.acos(a),o=Math.sin(i),s=Math.sin((1-n)*i)/o,l=Math.sin(n*i)/o):(s=1-n,l=n),t[0]=s*u+l*d,t[1]=s*c+l*p,t[2]=s*h+l*m,t[3]=s*f+l*v,t}e.exports=n},{}],230:[function(t,e,r){"use strict";e.exports={vertex:"precision highp float;\n#define GLSLIFY 1\n\n\nvec4 computePosition_1_0(vec2 posHi, vec2 posLo, vec2 scHi, vec2 scLo, vec2 trHi, vec2 trLo) {\n return vec4((posHi + trHi) * scHi\n \t\t\t//FIXME: this thingy does not give noticeable precision gain, need test\n + (posLo + trLo) * scHi\n + (posHi + trHi) * scLo\n + (posLo + trLo) * scLo\n , 0, 1);\n}\n\n\nattribute vec2 positionHi, positionLo;\nattribute float size, border;\nattribute vec2 char, color;\n\n//this is 64-bit form of scale and translate\nuniform vec2 scaleHi, scaleLo, translateHi, translateLo;\nuniform float pixelRatio;\nuniform vec4 viewBox;\nuniform sampler2D palette;\n\nvarying vec4 charColor, borderColor;\nvarying vec2 charId;\nvarying vec2 pointCoord;\nvarying float pointSize;\nvarying float borderWidth;\n\n\nvoid main() {\n charColor = texture2D(palette, vec2(color.x / 255., 0));\n borderColor = texture2D(palette, vec2(color.y / 255., 0));\n\n gl_PointSize = size * pixelRatio;\n pointSize = size * pixelRatio;\n\n charId = char;\n borderWidth = border;\n\n gl_Position = computePosition_1_0(\n positionHi, positionLo,\n scaleHi, scaleLo,\n translateHi, translateLo);\n\n pointCoord = viewBox.xy + (viewBox.zw - viewBox.xy) * (gl_Position.xy * .5 + .5);\n}\n",fragment:"precision highp float;\n#define GLSLIFY 1\n\nuniform sampler2D chars;\nuniform vec2 charsShape;\nuniform float charsStep, pixelRatio, charOffset;\n\nvarying vec4 borderColor;\nvarying vec4 charColor;\nvarying vec2 charId;\nvarying vec2 pointCoord;\nvarying float pointSize;\nvarying float borderWidth;\n\nvoid main() {\n\tvec2 pointUV = (pointCoord - gl_FragCoord.xy + pointSize * .5) / pointSize;\n\tpointUV.x = 1. - pointUV.x;\n\tvec2 texCoord = ((charId + pointUV) * charsStep) / charsShape;\n\tfloat dist = texture2D(chars, texCoord).r;\n\n\t//max-distance alpha\n\tif (dist < 1e-2)\n\t\tdiscard;\n\n\tfloat gamma = .0045 * charsStep / pointSize;\n\n //null-border case\n \tif (borderWidth * borderColor.a == 0.) {\n\t\tfloat charAmt = smoothstep(.748 - gamma, .748 + gamma, dist);\n\t\tgl_FragColor = vec4(charColor.rgb, charAmt*charColor.a);\n\t\treturn;\n\t}\n\n\tfloat dif = 5. * pixelRatio * borderWidth / pointSize;\n\tfloat borderLevel = .748 - dif * .5;\n\tfloat charLevel = .748 + dif * .5;\n\n\tfloat borderAmt = smoothstep(borderLevel - gamma, borderLevel + gamma, dist);\n\tfloat charAmt = smoothstep(charLevel - gamma, charLevel + gamma, dist);\n\n\tvec4 color = borderColor;\n\tcolor.a *= borderAmt;\n\n\tgl_FragColor = mix(color, charColor, charAmt);\n}\n",pickVertex:"precision highp float;\n#define GLSLIFY 1\n\nattribute vec2 positionHi, positionLo;\nattribute vec4 id;\nattribute float size;\n\nuniform vec2 scaleHi, scaleLo, translateHi, translateLo;\nuniform vec4 pickOffset;\nuniform float pixelRatio;\n\nvarying vec4 fragColor;\n\n\nvec4 computePosition_1_0(vec2 posHi, vec2 posLo, vec2 scHi, vec2 scLo, vec2 trHi, vec2 trLo) {\n return vec4((posHi + trHi) * scHi\n \t\t\t//FIXME: this thingy does not give noticeable precision gain, need test\n + (posLo + trLo) * scHi\n + (posHi + trHi) * scLo\n + (posLo + trLo) * scLo\n , 0, 1);\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_PointSize = size * .25 * pixelRatio;\n\n gl_Position = computePosition_1_0(\n positionHi, positionLo,\n scaleHi, scaleLo,\n translateHi, translateLo);\n}\n",pickFragment:"precision lowp float;\n#define GLSLIFY 1\nvarying vec4 fragColor;\nvoid main() {\n gl_FragColor = fragColor;\n}\n"}},{}],231:[function(t,e,r){arguments[4][82][0].apply(r,arguments)},{dup:82}],232:[function(t,e,r){arguments[4][210][0].apply(r,arguments)},{"./lib/GLError":233,"./lib/create-attributes":234,"./lib/create-uniforms":235,"./lib/reflect":236,"./lib/runtime-reflect":237,"./lib/shader-cache":238,dup:210}],233:[function(t,e,r){arguments[4][211][0].apply(r,arguments)},{dup:211}],234:[function(t,e,r){arguments[4][212][0].apply(r,arguments)},{"./GLError":233,dup:212}],235:[function(t,e,r){arguments[4][213][0].apply(r,arguments)},{"./GLError":233,"./reflect":236,dup:213}],236:[function(t,e,r){arguments[4][214][0].apply(r,arguments)},{dup:214}],237:[function(t,e,r){arguments[4][215][0].apply(r,arguments)},{dup:215}],238:[function(t,e,r){arguments[4][216][0].apply(r,arguments)},{"./GLError":233,dup:216,"gl-format-compiler-error":163,"weakmap-shim":560}],239:[function(t,e,r){"use strict";function n(t,e,r,n,a){a<=4*f?i(0,a-1,t,e,r,n):h(0,a-1,t,e,r,n)}function i(t,e,r,n,i,a){for(var o=t+1;o<=e;++o){for(var s=r[o],l=n[2*o],u=n[2*o+1],c=i[o],h=a[o],f=o;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],a[f]=a[f-1],f-=1}r[f]=s,n[2*f]=l,n[2*f+1]=u,i[f]=c,a[f]=h}}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],h=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]=h}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 h(t,e,r,n,d,p){var m=(e-t+1)/6|0,v=t+m,g=e-m,y=t+e>>1,b=y-m,x=y+m,_=v,w=b,M=y,k=x,A=g,T=t+1,S=e-1,E=0;u(_,w,r,n,d,p)&&(E=_,_=w,w=E),u(k,A,r,n,d,p)&&(E=k,k=A,A=E),u(_,M,r,n,d,p)&&(E=_,_=M,M=E),u(w,M,r,n,d,p)&&(E=w,w=M,M=E),u(_,k,r,n,d,p)&&(E=_,_=k,k=E),u(M,k,r,n,d,p)&&(E=M,M=k,k=E),u(w,A,r,n,d,p)&&(E=w,w=A,A=E),u(w,M,r,n,d,p)&&(E=w,w=M,M=E),u(k,A,r,n,d,p)&&(E=k,k=A,A=E);var L=r[w],C=n[2*w],z=n[2*w+1],I=d[w],D=p[w],P=r[k],O=n[2*k],R=n[2*k+1],F=d[k],j=p[k],N=_,B=M,U=A,V=v,H=y,q=g,G=r[N],Y=r[B],X=r[U];r[V]=G,r[H]=Y,r[q]=X;for(var W=0;W<2;++W){var Z=n[2*N+W],J=n[2*B+W],K=n[2*U+W];n[2*V+W]=Z,n[2*H+W]=J,n[2*q+W]=K}var Q=d[N],$=d[B],tt=d[U];d[V]=Q,d[H]=$,d[q]=tt;var et=p[N],rt=p[B],nt=p[U];p[V]=et,p[H]=rt,p[q]=nt,o(b,t,r,n,d,p),o(x,e,r,n,d,p);for(var it=T;it<=S;++it)if(c(it,L,C,z,I,r,n,d))it!==T&&a(it,T,r,n,d,p),++T;else if(!c(it,P,O,R,F,r,n,d))for(;;){if(c(S,P,O,R,F,r,n,d)){c(S,L,C,z,I,r,n,d)?(s(it,T,S,r,n,d,p),++T,--S):(a(it,S,r,n,d,p),--S);break}if(--S=Math.max(.9*d,32)){var b=u+s>>>1;l(v,g,h,f,b,c+1),f=b}l(v,g,h,f,y,c+1),f=y}}}var u=t.length>>>1;if(u<1)return[];for(var c=1/0,h=1/0,f=-1/0,d=-1/0,p=0;p=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)),o.free(x),w}var o=t("typedarray-pool"),s=t("./lib/sort");e.exports=a},{"./lib/sort":239,"typedarray-pool":539}],241:[function(t,e,r){"use strict";function n(t,e,r,n,i,a,o,s){this.plot=t,this.shader=e,this.pickShader=r,this.positionBuffer=n,this.sizeBuffer=i,this.colorBuffer=a,this.idBuffer=o,this.charBuffer=s,this.pointCount=0,this.pickOffset=0,this.points=null,this.scales=[],this.xCoords=[],this.charCanvas=document.createElement("canvas"),this.charTexture=m(this.plot.gl,this.charCanvas),this.charStep=400,this.charFit=.255,this.snapThreshold=1e4,this.paletteTexture=m(this.plot.gl,[256,1])}function i(){var t=this.plot,e=t.viewBox,r=t.dataBox,n=t.pixelRatio,i=r[2]-r[0],a=r[3]-r[1],u=2/i,c=2/a,h=-r[0]-.5*i,f=-r[1]-.5*a;_[0]=u,w[0]=u-_[0],_[1]=c,w[1]=c-_[1],M[0]=h,k[0]=h-M[0],M[1]=f,k[1]=f-M[1];var d=e[2]-e[0],p=e[3]-e[1];o=Math.min(i/d,a/p),A[0]=2*n/d,A[1]=2*n/p,s=r[0],l=r[2]}function a(t,e){var r=t.gl,i=u(r,f.vertex,f.fragment),a=u(r,f.pickVertex,f.pickFragment),o=c(r),s=c(r),l=c(r),h=c(r),d=c(r),p=new n(t,i,a,o,s,l,h,d);return p.update(e),t.addObject(p),p}e.exports=a;var o,s,l,u=t("gl-shader"),c=t("gl-buffer"),h=t("typedarray-pool"),f=t("./lib/shaders"),d=t("snap-points-2d"),p=t("font-atlas-sdf"),m=t("gl-texture2d"),v=t("color-id"),g=t("ndarray"),y=t("clamp"),b=t("binary-search-bounds"),x=n.prototype,_=new Float32Array([0,0]),w=new Float32Array([0,0]),M=new Float32Array([0,0]),k=new Float32Array([0,0]),A=[0,0],T=[0,0,0,0];x.drawPick=function(t){var e=void 0!==t,r=this.plot,n=this.pointCount,a=n>this.snapThreshold;if(!n)return t;i.call(this);var u=r.gl,c=e?this.pickShader:this.shader,h=u.isEnabled(u.BLEND);if(c.bind(),e){this.pickOffset=t;for(var f=0;f<4;++f)T[f]=t>>8*f&255;c.uniforms.pickOffset=T,this.idBuffer.bind(),c.attributes.id.pointer(u.UNSIGNED_BYTE,!1)}else u.blendFuncSeparate(u.SRC_ALPHA,u.ONE_MINUS_SRC_ALPHA,u.ONE,u.ONE_MINUS_SRC_ALPHA),u.blendColor(0,0,0,1),h||u.enable(u.BLEND),this.colorBuffer.bind(),c.attributes.color.pointer(u.UNSIGNED_BYTE,!1),this.charBuffer.bind(),c.attributes.char.pointer(u.UNSIGNED_BYTE,!1),c.uniforms.chars=this.charTexture.bind(0),c.uniforms.charsShape=[this.charCanvas.width,this.charCanvas.height],c.uniforms.charsStep=this.charStep,c.uniforms.palette=this.paletteTexture.bind(1);this.sizeBuffer.bind(),c.attributes.size.pointer(u.FLOAT,!1,8,0),e||c.attributes.border.pointer(u.FLOAT,!1,8,4),this.positionBuffer.bind(),c.attributes.positionHi.pointer(u.FLOAT,!1,16,0),c.attributes.positionLo.pointer(u.FLOAT,!1,16,8),c.uniforms.pixelRatio=r.pixelRatio,c.uniforms.scaleHi=_,c.uniforms.scaleLo=w,c.uniforms.translateHi=M,c.uniforms.translateLo=k,c.uniforms.viewBox=r.viewBox;var d=this.scales;if(a)for(var p=d.length-1;p>=0;p--){var m=d[p];if(!(m.pixelSize&&m.pixelSize<1.25*o&&p>1)){var v=m.offset,g=m.count+v,y=b.ge(this.xCoords,s,v,g-1),x=b.lt(this.xCoords,l,y,g-1)+1;x>y&&u.drawArrays(u.POINTS,y,x-y)}}else u.drawArrays(u.POINTS,0,n);if(e)return t+n;h?u.blendFunc(u.ONE,u.ONE_MINUS_SRC_ALPHA):u.disable(u.BLEND)},x.draw=x.drawPick,x.pick=function(t,e,r){var n=this.pickOffset,i=this.pointCount;if(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]]}},x.update=function(t){t=t||{};var e=t.positions||[],r=t.colors||[],n=t.glyphs||[],i=t.sizes||[],a=t.borderWidths||[],o=t.borderColors||[],s=this.plot.gl,l=this.pointCount,u=l>this.snapThreshold;if(null!=t.positions){this.points=e,l=this.points.length/2,u=l>this.snapThreshold;var c=h.mallocFloat32(2*l),f=h.mallocFloat64(2*l),m=h.mallocUint32(l),b=h.mallocFloat32(4*l);f.set(this.points),u&&(this.i2idx&&h.free(this.i2idx),this.i2idx=h.mallocInt32(l),this.scales=d(f,this.i2idx,c)),this.pointCount=l;for(var x=0;xF&&(F=i[x]);var j=this.charStep;this.charStep=y(Math.ceil(4*F),128,768);var N=Object.keys(O),B=this.charStep,U=Math.floor(B/2),V=s.getParameter(s.MAX_TEXTURE_SIZE),H=V/B*(V/B),q=Math.min(V,B*N.length),G=Math.min(V,B*Math.ceil(B*N.length/V)),Y=Math.floor(q/B);N.length>H&&console.warn("gl-scatter2d-fancy: number of characters is more than maximum texture size. Try reducing it."),this.chars&&this.chars+""==N+""&&this.charStep==j||(this.charCanvas=p({canvas:this.charCanvas,family:"sans-serif",size:U,shape:[q,G],step:[B,B],chars:N,align:!0,fit:this.charFit}),this.chars=N);for(var x=0;x>>1,n=u.mallocInt32(r),i=u.mallocFloat32(r),a=u.mallocFloat64(2*r);if(a.set(this.points),this.snapPoints)this.scales=l(a,n,i,this.bounds);else{this.bounds=f(a,2),h(a,2,this.bounds);for(var o=0;o>8&255,y[2]=t>>16&255,y[3]=t>>24&255,n.uniforms.pickOffset=y,s.bind(),n.attributes.pickId.pointer(h.UNSIGNED_BYTE)):(n.uniforms.useWeight=1,this.weightBuffer.bind(),n.attributes.weight.pointer());var z=!0;if(this.snapPoints)for(var I=i.length-1;I>=0;I--){var D=i[I];if(!(D.pixelSize1)){var P=this.getVisibleRange(D),O=P[0],R=P[1];R>O&&h.drawArrays(h.POINTS,O,R-O),!e&&z&&(z=!1,n.uniforms.useWeight=0)}}else h.drawArrays(h.POINTS,0,this.pointCount);return t+this.pointCount},d.getVisibleRange=function(t){var e=this.plot.dataBox,r=this.bounds,n=this.pixelSize,i=this.size,a=this.plot.pixelRatio,o=r[2]-r[0];r[3],r[1];if(!t)for(var t,l=this.scales.length-1;l>=0&&(t=this.scales[l],t.pixelSize1);l--);var u=this.xCoords,c=(e[0]-r[0]-n*i*a)/o,h=(e[2]-r[0]+n*i*a)/o,f=t.offset,d=t.count+f,p=s.ge(u,c,f,d-1);return[p,s.lt(u,h,p,d-1)+1]},d.drawPick=d.draw,d.pick=function(t,e,r){var n=r-this.pickOffset;return n<0||n>=this.pointCount?null:{object:this,pointId:n,dataCoord:[this.points[2*n],this.points[2*n+1]]}}},{"./lib/shader":242,"array-bounds":42,"array-normalize":43,"binary-search-bounds":243,"gl-buffer":154,"gl-shader":253,"snap-points-2d":245,"typedarray-pool":539}],247:[function(t,e,r){"use strict";function n(t,e){var r=a[e];if(r||(r=a[e]={}),t in r)return r[t];for(var n=i(t,{textAlign:"center",textBaseline:"middle",lineHeight:1,font:e}),o=i(t,{triangles:!0,textAlign:"center",textBaseline:"middle",lineHeight:1,font:e}),s=[[1/0,1/0],[-1/0,-1/0]],l=0;lMath.abs(R[1])){var F=O;O=R,R=F,F=D,D=P,P=F;var j=z;z=I,I=j}O[0]<0&&(D[z]=-1),R[1]>0&&(P[I]=-1);for(var N=0,B=0,C=0;C<4;++C)N+=Math.pow(p[4*z+C],2),B+=Math.pow(p[4*I+C],2);D[z]/=Math.sqrt(N),P[I]/=Math.sqrt(B),d.axes[0]=D,d.axes[1]=P,d.fragClipBounds[0]=u(E,b[0],_,-1e8),d.fragClipBounds[1]=u(E,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,a){var o=r.gl -;if(r.vao.bind(),i===r.opacity<1||a){t.bind();var s=t.uniforms;s.model=n.model||x,s.view=n.view||x,s.projection=n.projection||x,w[0]=2/o.drawingBufferWidth,w[1]=2/o.drawingBufferHeight,s.screenSize=w,s.highlightId=r.highlightId,s.highlightScale=r.highlightScale,s.fragClipBounds=I,s.clipBounds=r.axes.bounds,s.opacity=r.opacity,s.pickGroup=r.pickId/255,s.pixelRatio=r.pixelRatio,r.vao.draw(o.TRIANGLES,r.vertexCount),r.lineWidth>0&&(o.lineWidth(r.lineWidth),r.vao.draw(o.LINES,r.lineVertexCount,r.vertexCount))}h(e,r,n,i,a),r.vao.unbind()}function d(t){var e=t.gl,r=y.createPerspective(e),n=y.createOrtho(e),i=y.createProject(e),a=y.createPickPerspective(e),s=y.createPickOrtho(e),l=y.createPickProject(e),u=p(e),c=p(e),h=p(e),f=p(e),d=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}]),v=new o(e,r,n,i,u,c,h,f,d,a,s,l);return v.update(t),v}var p=t("gl-buffer"),m=t("gl-vao"),v=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 _=o.prototype;_.pickSlots=1,_.setPickBase=function(t){this.pickId=t},_.isTransparent=function(){if(this.opacity<1)return!0;for(var t=0;t<3;++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;t<3;++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],S=x.slice(),E=[0,0,0],L=[[0,0,0],[0,0,0]],C=[-1e8,-1e8,-1e8],z=[1e8,1e8,1e8],I=[C,z];_.draw=function(t){f(this.useOrtho?this.orthoShader:this.shader,this.projectShader,this,t,!1,!1)},_.drawTransparent=function(t){f(this.useOrtho?this.orthoShader:this.shader,this.projectShader,this,t,!0,!1)},_.drawPick=function(t){f(this.useOrtho?this.pickOrthoShader:this.pickPerspectiveShader,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||e<0)return null;var r=this.points[e],n=this._selectResult;n.index=e;for(var i=0;i<3;++i)n.position[i]=n.dataCoordinate[i]=r[i];return n},_.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",a=t.alignment||[0,0],o=[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,m=0,g=n.length;t:for(var y=0;y0&&(z[0]=-a[0]*(1+A[0][0]));for(var H=M.cells,q=M.positions,_=0;_0){var g=r*c;o.drawBox(h-g,f-g,d+g,f+g,a),o.drawBox(h-g,p-g,d+g,p+g,a),o.drawBox(h-g,f-g,h+g,p+g,a),o.drawBox(d-g,f-g,d+g,p+g,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":250,"gl-buffer":154,"gl-shader":253}],252:[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){return new i(t,o(t,e),s.mallocUint8(e[0]*e[1]*4))}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(_inline_46_arg0_<255||_inline_46_arg1_<255||_inline_46_arg2_<255||_inline_46_arg3_<255){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;i=0){for(var k=0|M.type.charAt(M.type.length-1),A=new Array(k),T=0;T=0;)S+=1;_[w]=S}var E=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,E))},e.exports=a},{"./lib/GLError":254,"./lib/create-attributes":255,"./lib/create-uniforms":256,"./lib/reflect":257,"./lib/runtime-reflect":258,"./lib/shader-cache":259}],254:[function(t,e,r){arguments[4][211][0].apply(r,arguments)},{dup:211}],255:[function(t,e,r){arguments[4][212][0].apply(r,arguments)},{"./GLError":254,dup:212}],256:[function(t,e,r){arguments[4][213][0].apply(r,arguments)},{"./GLError":254,"./reflect":257,dup:213}],257:[function(t,e,r){arguments[4][214][0].apply(r,arguments)},{dup:214}],258:[function(t,e,r){arguments[4][215][0].apply(r,arguments)},{dup:215}],259:[function(t,e,r){arguments[4][216][0].apply(r,arguments)},{"./GLError":254,dup:216,"gl-format-compiler-error":163,"weakmap-shim":560}],260:[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)}},{}],261:[function(t,e,r){"use strict";var n=t("gl-shader");e.exports=function(t){return n(t,"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","precision mediump float;\n#define GLSLIFY 1\n\nvarying vec4 fragColor;\n\nvoid main() {\n gl_FragColor = fragColor;\n}",null,[{name:"position",type:"vec3"},{name:"color",type:"vec3"},{name:"weight",type:"float"}])}},{"gl-shader":253}],262:[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,a,o){var s=[t,e,r,0,0,0,1];s[n+3]=1,s[n]=a,i.push.apply(i,s),s[6]=-1,i.push.apply(i,s),s[n]=o,i.push.apply(i,s),i.push.apply(i,s),s[6]=1,i.push.apply(i,s),s[n]=a,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=a(t,i),u=o(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 a=t("gl-buffer"),o=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,a=t.model||l,o=t.view||l,s=t.projection||l;this.axes&&(i=this.axes.lastCubeProps.axis);for(var u=c,d=h,p=0;p<3;++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=a,n.uniforms.view=o,n.uniforms.projection=s,n.uniforms.coordinates=[this.position,u,d],n.uniforms.colors=this.colors,n.uniforms.screenShape=f;for(var p=0;p<3;++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":261,"gl-buffer":154,"gl-vao":269}],263:[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;\nuniform sampler2D colormap;\n\nvarying float value, kill;\nvarying vec3 worldCoordinate;\nvarying vec2 planeCoordinate;\nvarying vec3 lightDirection, eyeDirection, surfaceNormal;\nvarying vec4 vColor;\n\nvoid main() {\n 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 vColor = texture2D(colormap, vec2(value, value));\n\n //Lighting geometry parameters\n vec4 cameraCoordinate = view * worldPosition;\n cameraCoordinate.xyz /= cameraCoordinate.w;\n lightDirection = lightPosition - cameraCoordinate.xyz;\n eyeDirection = eyePosition - cameraCoordinate.xyz;\n surfaceNormal = normalize((vec4(normal,0) * inverseModel).xyz);\n}\n",a="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;\nuniform float vertexColor;\n\nvarying float value, kill;\nvarying vec3 worldCoordinate;\nvarying vec3 lightDirection, eyeDirection, surfaceNormal;\nvarying vec4 vColor;\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 = max(beckmannSpecular_1_1(L, V, N, roughness), 0.);\n float diffuse = min(kambient + kdiffuse * max(dot(N, L), 0.0), 1.0);\n\n //decide how to interpolate color \u2014 in vertex or in fragment\n vec4 surfaceColor = step(vertexColor, .5) * texture2D(colormap, vec2(value, value)) + step(.5, vertexColor) * vColor;\n\n vec4 litColor = surfaceColor.a * vec4(diffuse * surfaceColor.rgb + kspecular * vec3(1,1,1) * specular, 1.0);\n\n gl_FragColor = mix(litColor, contourColor, contourTint) * opacity;\n}\n",o="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;\nuniform sampler2D colormap;\n\nvarying float value, kill;\nvarying vec3 worldCoordinate;\nvarying vec2 planeCoordinate;\nvarying vec3 lightDirection, eyeDirection, surfaceNormal;\nvarying vec4 vColor;\n\nvoid main() {\n vec3 dataCoordinate = permutation * vec3(uv.xy, height);\n 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 vColor = texture2D(colormap, vec2(value, value));\n\n //Don't do lighting for contours\n surfaceNormal = vec3(1,0,0);\n eyeDirection = vec3(0,1,0);\n lightDirection = vec3(0,0,1);\n}\n",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,a,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,o,a,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,o,s,null,[{name:"uv",type:"vec4"},{name:"f",type:"float"}]);return e.attributes.uv.location=0,e.attributes.f.location=1,e}},{"gl-shader":253}],264:[function(t,e,r){"use strict";function n(t,e,r,n,i){this.position=t,this.index=e,this.uv=r,this.level=n,this.dataCoordinate=i}function i(t){var e=x([y({colormap:t,nshades:R,format:"rgba"}).map(function(t){return[t[0],t[1],t[2],255*t[3]]})]);return b.divseq(e,255),e}function a(t,e,r,i,a,o,s,l,u,c,h,f,d,p){this.gl=t,this.shape=e,this.bounds=r,this.intensityBounds=[],this._shader=i,this._pickShader=a,this._coordinateBuffer=o,this._vao=s,this._colorMap=l,this._contourShader=u,this._contourPickShader=c,this._contourBuffer=h,this._contourVAO=f,this._contourOffsets=[[],[],[]],this._contourCounts=[[],[],[]],this._vertexCount=0,this._pickResult=new n([0,0,0],[0,0],[0,0],[0,0,0],[0,0,0]),this._dynamicBuffer=d,this._dynamicVAO=p,this._dynamicOffsets=[0,0,0],this._dynamicCounts=[0,0,0],this.contourWidth=[1,1,1],this.contourLevels=[[1],[1],[1]],this.contourTint=[0,0,0],this.contourColor=[[.5,.5,.5,1],[.5,.5,.5,1],[.5,.5,.5,1]],this.showContour=!0,this.showSurface=!0,this.enableHighlight=[!0,!0,!0],this.highlightColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.highlightTint=[1,1,1],this.highlightLevel=[-1,-1,-1],this.enableDynamic=[!0,!0,!0],this.dynamicLevel=[NaN,NaN,NaN],this.dynamicColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.dynamicTint=[1,1,1],this.dynamicWidth=[1,1,1],this.axesBounds=[[1/0,1/0,1/0],[-1/0,-1/0,-1/0]],this.surfaceProject=[!1,!1,!1],this.contourProject=[[!1,!1,!1],[!1,!1,!1],[!1,!1,!1]],this.colorBounds=[!1,!1],this._field=[_(g.mallocFloat(1024),[0,0]),_(g.mallocFloat(1024),[0,0]),_(g.mallocFloat(1024),[0,0])],this.pickId=1,this.clipBounds=[[-1/0,-1/0,-1/0],[1/0,1/0,1/0]],this.snapToData=!1,this.opacity=1,this.lightPosition=[10,1e4,0],this.ambientLight=.8,this.diffuseLight=.8,this.specularLight=2,this.roughness=.5,this.fresnel=1.5,this.vertexColor=0,this.dirty=!0}function o(t,e){var r,n,i,a=e.axes&&e.axes.lastCubeProps.axis||j,o=e.showSurface,s=e.showContour;for(r=0;r<3;++r)for(o=o||e.surfaceProject[r],n=0;n<3;++n)s=s||e.contourProject[r][n];for(r=0;r<3;++r){var l=N.projections[r];for(n=0;n<16;++n)l[n]=0;for(n=0;n<4;++n)l[5*n]=1;l[5*r]=0,l[12+r]=e.axesBounds[+(a[r]>0)][r],M(l,t.model,l);var u=N.clipBounds[r];for(i=0;i<2;++i)for(n=0;n<3;++n)u[i][n]=t.clipBounds[i][n];u[0][r]=-1e8,u[1][r]=1e8}return N.showSurface=o,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||D,n.view=t.view||D,n.projection=t.projection||D,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;i<2;++i)for(var a=n.clipBounds[i],s=0;s<3;++s)a[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,n.vertexColor=this.vertexColor;var l=U;for(M(l,n.view,n.model),M(l,n.projection,l),k(l,l),i=0;i<3;++i)n.eyePosition[i]=l[12+i]/l[15];var u=l[15];for(i=0;i<3;++i)u+=this.lightPosition[i]*l[4*i+3];for(i=0;i<3;++i){var c=l[12+i];for(s=0;s<3;++s)c+=l[4*s+i]*this.lightPosition[s];n.lightPosition[i]=c/u}var h=o(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;i<3;++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;i<3;++i)for(f.uniforms.permutation=O[i],r.lineWidth(this.contourWidth[i]),s=0;s=1)return!0;for(var t=0;t<3;++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:[D.slice(),D.slice(),D.slice()],clipBounds:[[[0,0,0],[0,0,0]],[[0,0,0],[0,0,0]],[[0,0,0],[0,0,0]]]},B={model:D,view:D,projection:D,inverseModel:D.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,vertexColor:0},U=D.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 H={model:D,view:D,projection:D,inverseModel:D,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=H;r.model=t.model||D,r.view=t.view||D,r.projection=t.projection||D,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;n<2;++n)for(var i=r.clipBounds[n],a=0;a<3;++a)i[a]=Math.min(Math.max(this.clipBounds[n][a],-1e8),1e8);var s=o(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;n<3;++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(),a=0;a<3;++a)for(e.lineWidth(this.contourWidth[a]),l.uniforms.permutation=O[a],n=0;n>4)/16)/255,i=Math.floor(n),a=n-i,o=e[1]*(t.value[1]+(15&t.value[2])/16)/255,s=Math.floor(o),l=o-s;i+=1,s+=1;var u=r.position;u[0]=u[1]=u[2]=0;for(var c=0;c<2;++c)for(var h=c?a:1-a,f=0;f<2;++f)for(var d=f?l:1-l,p=i+c,m=s+f,v=h*d,g=0;g<3;++g)u[g]+=this._field[g].get(p,m)*v;for(var y=this._pickResult.level,b=0;b<3;++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]=a<.5?i:i+1,r.index[1]=l<.5?s:s+1,r.uv[0]=n/e[0],r.uv[1]=o/e[1],g=0;g<3;++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),"vertexColor"in t&&(this.vertexColor=t.vertexColor?1:0);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 a=this.shape,o=0;o<2;++o)this._field[2].size>this._field[o].data.length&&(g.freeFloat(this._field[o].data),this._field[o].data=g.mallocFloat(this._field[2].size)),this._field[o]=_(this._field[o].data,[a[0]+2,a[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(o=0;o<2;++o){var c=s[o];for(y=0;y<2;++y)if(c.shape[y]!==a[y])throw new Error("gl-surface: coords have incorrect shape");l(this._field[o],c)}}else if(t.ticks){var f=t.ticks;if(!Array.isArray(f)||2!==f.length)throw new Error("gl-surface: invalid ticks");for(o=0;o<2;++o){var p=f[o];if((Array.isArray(p)||p.length)&&(p=_(p)),p.shape[0]!==a[o])throw new Error("gl-surface: invalid tick length");var m=_(p.data,a);m.stride[o]=p.stride[0],m.stride[1^o]=0,l(this._field[o],m)}}else{for(o=0;o<2;++o){var v=[0,0];v[o]=1,this._field[o]=_(this._field[o].data,[a[0]+2,a[1]+2],v,0)}this._field[0].set(0,0,0);for(var y=0;y0){for(var xt=0;xt<5;++xt)tt.pop();H-=1}continue t}tt.push(it[0],it[1],st[0],st[1],it[2]),H+=1}}nt.push(H)}this._contourOffsets[et]=rt,this._contourCounts[et]=nt}var _t=g.mallocFloat(tt.length);for(o=0;oi||r<0||r>i)throw new Error("gl-texture2d: Invalid texture size");return t._shape=[e,r],t.bind(),n.texImage2D(n.TEXTURE_2D,0,t.format,e,r,0,t.format,t.type,null),t._mipLevels=[0],t}function o(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 s(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 l(t,e,r,n,i,a,o,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,d=s(c,l.stride.slice());"float32"===u?h=t.FLOAT:"float64"===u?(h=t.FLOAT,d=!1,u="float32"):"uint8"===u?h=t.UNSIGNED_BYTE:(h=t.UNSIGNED_BYTE,d=!1,u="uint8");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}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 g=l.size,y=o.indexOf(n)<0;if(y&&o.push(n),h===a&&d)0===l.offset&&l.data.length===g?y?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):y?t.texImage2D(t.TEXTURE_2D,n,i,c[0],c[1],0,i,a,l.data.subarray(l.offset,l.offset+g)):t.texSubImage2D(t.TEXTURE_2D,n,e,r,c[0],c[1],i,a,l.data.subarray(l.offset,l.offset+g));else{var b;b=a===t.FLOAT?v.mallocFloat32(g):v.mallocUint8(g);var _=p(b,c,[c[2],c[2]*c[0],1]);h===t.FLOAT&&a===t.UNSIGNED_BYTE?x(_,l):m.assign(_,l),y?t.texImage2D(t.TEXTURE_2D,n,i,c[0],c[1],0,i,a,b.subarray(0,g)):t.texSubImage2D(t.TEXTURE_2D,n,e,r,c[0],c[1],i,a,b.subarray(0,g)),a===t.FLOAT?v.freeFloat32(b):v.freeUint8(b)}}function u(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 c(t,e,r,n,i){var a=t.getParameter(t.MAX_TEXTURE_SIZE);if(e<0||e>a||r<0||r>a)throw new Error("gl-texture2d: Invalid texture shape");if(i===t.FLOAT&&!t.getExtension("OES_texture_float"))throw new Error("gl-texture2d: Floating point textures not supported on this platform");var s=u(t);return t.texImage2D(t.TEXTURE_2D,0,n,e,r,0,n,i,null),new o(t,s,e,r,n,i)}function h(t,e,r,n,i,a){var s=u(t);return t.texImage2D(t.TEXTURE_2D,0,i,i,a,e),new o(t,s,r,n,i,a)}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 a=s(n,e.stride.slice()),l=0;"float32"===r?l=t.FLOAT:"float64"===r?(l=t.FLOAT,a=!1,r="float32"):"uint8"===r?l=t.UNSIGNED_BYTE:(l=t.UNSIGNED_BYTE,a=!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}}l!==t.FLOAT||t.getExtension("OES_texture_float")||(l=t.UNSIGNED_BYTE,a=!1);var h,f,d=e.size;if(a)h=0===e.offset&&e.data.length===d?e.data:e.data.subarray(e.offset,e.offset+d);else{var g=[n[2],n[2]*n[0],1];f=v.malloc(d,r);var y=p(f,n,g,0);"float32"!==r&&"float64"!==r||l!==t.UNSIGNED_BYTE?m.assign(y,e):x(y,e),h=f.subarray(0,d)}var b=u(t);return t.texImage2D(t.TEXTURE_2D,0,c,n[0],n[1],0,c,l,h),a||v.free(f),new o(t,b,n[0],n[1],c,l)}function d(t){if(arguments.length<=1)throw new Error("gl-texture2d: Missing arguments for texture2d constructor");if(g||n(t),"number"==typeof arguments[1])return c(t,arguments[1],arguments[2],arguments[3]||t.RGBA,arguments[4]||t.UNSIGNED_BYTE);if(Array.isArray(arguments[1]))return c(t,0|arguments[1][0],0|arguments[1][1],arguments[2]||t.RGBA,arguments[3]||t.UNSIGNED_BYTE);if("object"==typeof arguments[1]){var e=arguments[1],r=i(e)?e:e.raw;if(r)return h(t,r,0|e.width,0|e.height,arguments[2]||t.RGBA,arguments[3]||t.UNSIGNED_BYTE);if(e.shape&&e.data&&e.stride)return f(t,e)}throw new Error("gl-texture2d: Invalid arguments for texture2d constructor")}var p=t("ndarray"),m=t("ndarray-ops"),v=t("typedarray-pool");e.exports=d;var g=null,y=null,b=null,x=function(t,e){m.muls(t,e,255)},_=o.prototype;Object.defineProperties(_,{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)),y.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)),y.indexOf(t)<0)throw new Error("gl-texture2d: Unknown filter mode "+t);return e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,t),this._magFilter=t}},mipSamples:{get:function(){return this._anisoSamples},set:function(t){var e=this._anisoSamples;if(this._anisoSamples=0|Math.max(t,1),e!==this._anisoSamples){var r=this.gl.getExtension("EXT_texture_filter_anisotropic");r&&this.gl.texParameterf(this.gl.TEXTURE_2D,r.TEXTURE_MAX_ANISOTROPY_EXT,this._anisoSamples)}return this._anisoSamples}},wrapS:{get:function(){return this._wrapS},set:function(t){if(this.bind(),b.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(),b.indexOf(t)<0)throw new Error("gl-texture2d: Unknown wrap mode "+t);return this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,t),this._wrapT=t}},wrap:{get:function(){return this._wrapVector},set:function(t){if(Array.isArray(t)||(t=[t,t]),2!==t.length)throw new Error("gl-texture2d: Must specify wrap mode for rows and columns");for(var e=0;e<2;++e)if(b.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 a(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,a(this,t,this._shape[1]),t}},height:{get:function(){return this._shape[1]},set:function(t){return t|=0,a(this,this._shape[0],t),t}}}),_.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},_.dispose=function(){this.gl.deleteTexture(this.handle)},_.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)},_.setPixels=function(t,e,r,n){var a=this.gl;this.bind(),Array.isArray(e)?(n=r,r=0|e[1],e=0|e[0]):(e=e||0,r=r||0),n=n||0;var o=i(t)?t:t.raw;if(o){this._mipLevels.indexOf(n)<0?(a.texImage2D(a.TEXTURE_2D,0,this.format,this.format,this.type,o),this._mipLevels.push(n)):a.texSubImage2D(a.TEXTURE_2D,n,e,r,this.format,this.type,o)}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||e<0||r<0)throw new Error("gl-texture2d: Texture dimensions are out of bounds");l(a,e,r,n,this.format,this.type,this._mipLevels,t)}}},{ndarray:465,"ndarray-ops":459,"typedarray-pool":539}],266:[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;i0&&(a=1/Math.sqrt(a),t[0]=e[0]*a,t[1]=e[1]*a,t[2]=e[2]*a),t}e.exports=n},{}],275:[function(t,e,r){function n(t,e,r){var n=e[0],i=e[1],a=e[2],o=e[3];return t[0]=r[0]*n+r[4]*i+r[8]*a+r[12]*o,t[1]=r[1]*n+r[5]*i+r[9]*a+r[13]*o,t[2]=r[2]*n+r[6]*i+r[10]*a+r[14]*o,t[3]=r[3]*n+r[7]*i+r[11]*a+r[15]*o,t}e.exports=n},{}],276:[function(t,e,r){function n(t,e,r,n){return i[0]=n,i[1]=r,i[2]=e,i[3]=t,a[0]}e.exports=n;var i=new Uint8Array(4),a=new Float32Array(i.buffer)},{}],277:[function(t,e,r){function n(t){for(var e=Array.isArray(t)?t:i(t),r=0;r0)continue;n=t.slice(0,1).join("")}return e(n),G+=n.length,U=U.slice(n.length),U.length}}function z(){return/[^a-fA-F0-9]/.test(O)?(e(U.join("")),B=u,j):(U.push(O),R=O,j+1)}function I(){return"."===O?(U.push(O),B=v,R=O,j+1):/[eE]/.test(O)?(U.push(O),B=v,R=O,j+1):"x"===O&&1===U.length&&"0"===U[0]?(B=w,U.push(O),R=O,j+1):/[^\d]/.test(O)?(e(U.join("")),B=u,j):(U.push(O),R=O,j+1)}function D(){return"f"===O&&(U.push(O),R=O,j+=1),/[eE]/.test(O)?(U.push(O),R=O,j+1):"-"===O&&/[eE]/.test(R)?(U.push(O),R=O,j+1):/[^\d]/.test(O)?(e(U.join("")),B=u,j):(U.push(O),R=O,j+1)}function P(){if(/[^\d\w_]/.test(O)){var t=U.join("");return B=J.indexOf(t)>-1?b:Z.indexOf(t)>-1?y:g,e(U.join("")),B=u,j}return U.push(O),R=O,j+1}var O,R,F,j=0,N=0,B=u,U=[],V=[],H=1,q=0,G=0,Y=!1,X=!1,W="";t=t||{};var Z=o,J=i;return"300 es"===t.version&&(Z=l,J=s),function(t){return V=[],null!==t?r(t.replace?t.replace(/\r\n/g,"\n"):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,h=0,f=1,d=2,p=3,m=4,v=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":280,"./lib/builtins-300es":279,"./lib/literals":282,"./lib/literals-300es":281,"./lib/operators":283}],279:[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":280}],280:[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"]},{}],281:[function(t,e,r){var n=t("./literals") +var l=t[n-1],u=t[n];(u[0]!==l[0]||u[1]!==l[1]||r&&u[2]!==l[2])&&(t[s++]=u)}t.length=s}}function d(t,e,r){var n=u(t,[],a(t));return f(e,n,r),!!n}function p(t,e,r){var n=i(t,e),c=o(t,e,n),h=a(t),d=s(t,e,n,h),p=l(t,e,c,d,r),m=u(t,p,h);return f(e,m,r),!!m||(c.length>0||d.length>0)}function m(t,e,r){var n;if(r){n=e;for(var i=new Array(e.length),a=0;a>>24,n=(16711680&t)>>>16,i=(65280&t)>>>8,a=255&t;return!1===e?[r,n,i,a]:[r/255,n/255,i/255,a/255]}var a=t("clamp");e.exports=n,e.exports.to=n,e.exports.from=i},{clamp:86}],91:[function(t,e,r){"use strict";e.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}},{}],92:[function(t,e,r){(function(r){"use strict";function n(t){var e,n,s=[],l=1;if("string"==typeof t)if(i[t])s=i[t].slice(),n="rgb";else if("transparent"===t)l=0,n="rgb",s=[0,0,0];else if(/^#[A-Fa-f0-9]+$/.test(t)){var u=t.slice(1),c=u.length,h=c<=4;l=1,h?(s=[parseInt(u[0]+u[0],16),parseInt(u[1]+u[1],16),parseInt(u[2]+u[2],16)],4===c&&(l=parseInt(u[3]+u[3],16)/255)):(s=[parseInt(u[0]+u[1],16),parseInt(u[2]+u[3],16),parseInt(u[4]+u[5],16)],8===c&&(l=parseInt(u[6]+u[7],16)/255)),s[0]||(s[0]=0),s[1]||(s[1]=0),s[2]||(s[2]=0),n="rgb"}else if(e=/^((?:rgb|hs[lvb]|hwb|cmyk?|xy[zy]|gray|lab|lchu?v?|[ly]uv|lms)a?)\s*\(([^\)]*)\)/.exec(t)){var f=e[1],u=f.replace(/a$/,"");n=u;var c="cmyk"===u?4:"gray"===u?1:3;s=e[2].trim().split(/\s*,\s*/).map(function(t,e){if(/%$/.test(t))return e===c?parseFloat(t)/100:"rgb"===u?255*parseFloat(t)/100:parseFloat(t);if("h"===u[e]){if(/deg$/.test(t))return parseFloat(t);if(void 0!==o[t])return o[t]}return parseFloat(t)}),f===u&&s.push(1),l=void 0===s[c]?1:s[c],s=s.slice(0,c)}else t.length>10&&/[0-9](?:\s|\/)/.test(t)&&(s=t.match(/([0-9]+)/g).map(function(t){return parseFloat(t)}),n=t.match(/([a-z])/gi).join("").toLowerCase());else"number"==typeof t?(n="rgb",s=[t>>>16,(65280&t)>>>8,255&t]):a(t)?(null!=t.r?(s=[t.r,t.g,t.b],n="rgb"):null!=t.red?(s=[t.red,t.green,t.blue],n="rgb"):null!=t.h?(s=[t.h,t.s,t.l],n="hsl"):null!=t.hue&&(s=[t.hue,t.saturation,t.lightness],n="hsl"),null!=t.a?l=t.a:null!=t.alpha?l=t.alpha:null!=t.opacity&&(l=t.opacity/100)):(Array.isArray(t)||r.ArrayBuffer&&ArrayBuffer.isView&&ArrayBuffer.isView(t))&&(s=[t[0],t[1],t[2]],n="rgb",l=4===t.length?t[3]:1);return{space:n,values:s,alpha:l}}e.exports=n;var i=t("color-name"),a=t("is-plain-obj"),o={red:0,orange:60,yellow:120,green:180,blue:240,purple:300}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"color-name":91,"is-plain-obj":295}],93:[function(t,e,r){"use strict";var n=t("color-parse"),i=t("color-space/hsl"),a=t("clamp");e.exports=function(t,e){if(Array.isArray(t))return t;null==e&&(e=!0);var r=n(t);if(!r.space)return[];var o,s=r.values,l=s.length;for(o=0;o1&&n--,a=6*n<1?e+6*(r-e)*n:2*n<1?r:3*n<2?e+(r-e)*(2/3-n)*6:e,i[u]=255*a;return i}},n.hsl=function(t){var e,r,n,i=t[0]/255,a=t[1]/255,o=t[2]/255,s=Math.min(i,a,o),l=Math.max(i,a,o),u=l-s;return l===s?e=0:i===l?e=(a-o)/u:a===l?e=2+(o-i)/u:o===l&&(e=4+(i-a)/u),e=Math.min(60*e,360),e<0&&(e+=360),n=(s+l)/2,r=l===s?0:n<=.5?u/(l+s):u/(2-l-s),[e,100*r,100*n]}},{"./rgb":95}],95:[function(t,e,r){"use strict";e.exports={name:"rgb",min:[0,0,0],max:[255,255,255],channel:["red","green","blue"],alias:["RGB"]}},{}],96:[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]}],viridis:[{index:0,rgb:[68,1,84]},{index:.13,rgb:[71,44,122]},{index:.25,rgb:[59,81,139]},{index:.38,rgb:[44,113,142]},{index:.5,rgb:[33,144,141]},{index:.63,rgb:[39,173,129]},{index:.75,rgb:[92,200,99]},{index:.88,rgb:[170,220,50]},{index:1,rgb:[253,231,37]}],inferno:[{index:0,rgb:[0,0,4]},{index:.13,rgb:[31,12,72]},{index:.25,rgb:[85,15,109]},{index:.38,rgb:[136,34,106]},{index:.5,rgb:[186,54,85]},{index:.63,rgb:[227,89,51]},{index:.75,rgb:[249,140,10]},{index:.88,rgb:[249,201,50]},{index:1,rgb:[252,255,164]}],magma:[{index:0,rgb:[0,0,4]},{index:.13,rgb:[28,16,68]},{index:.25,rgb:[79,18,123]},{index:.38,rgb:[129,37,129]},{index:.5,rgb:[181,54,122]},{index:.63,rgb:[229,80,100]},{index:.75,rgb:[251,135,97]},{index:.88,rgb:[254,194,135]},{index:1,rgb:[252,253,191]}],plasma:[{index:0,rgb:[13,8,135]},{index:.13,rgb:[75,3,161]},{index:.25,rgb:[125,3,168]},{index:.38,rgb:[168,34,150]},{index:.5,rgb:[203,70,121]},{index:.63,rgb:[229,107,93]},{index:.75,rgb:[248,148,65]},{index:.88,rgb:[253,195,40]},{index:1,rgb:[240,249,33]}],warm:[{index:0,rgb:[125,0,179]},{index:.13,rgb:[172,0,187]},{index:.25,rgb:[219,0,170]},{index:.38,rgb:[255,0,130]},{index:.5,rgb:[255,63,74]},{index:.63,rgb:[255,123,0]},{index:.75,rgb:[234,176,0]},{index:.88,rgb:[190,228,0]},{index:1,rgb:[147,255,0]}],cool:[{index:0,rgb:[125,0,179]},{index:.13,rgb:[116,0,218]},{index:.25,rgb:[98,74,237]},{index:.38,rgb:[68,146,231]},{index:.5,rgb:[0,204,197]},{index:.63,rgb:[0,247,146]},{index:.75,rgb:[0,255,88]},{index:.88,rgb:[40,255,8]},{index:1,rgb:[147,255,0]}],"rainbow-soft":[{index:0,rgb:[125,0,179]},{index:.1,rgb:[199,0,180]},{index:.2,rgb:[255,0,121]},{index:.3,rgb:[255,108,0]},{index:.4,rgb:[222,194,0]},{index:.5,rgb:[150,255,0]},{index:.6,rgb:[0,255,55]},{index:.7,rgb:[0,246,150]},{index:.8,rgb:[50,167,222]},{index:.9,rgb:[103,51,235]},{index:1,rgb:[124,0,186]}],bathymetry:[{index:0,rgb:[40,26,44]},{index:.13,rgb:[59,49,90]},{index:.25,rgb:[64,76,139]},{index:.38,rgb:[63,110,151]},{index:.5,rgb:[72,142,158]},{index:.63,rgb:[85,174,163]},{index:.75,rgb:[120,206,163]},{index:.88,rgb:[187,230,172]},{index:1,rgb:[253,254,204]}],cdom:[{index:0,rgb:[47,15,62]},{index:.13,rgb:[87,23,86]},{index:.25,rgb:[130,28,99]},{index:.38,rgb:[171,41,96]},{index:.5,rgb:[206,67,86]},{index:.63,rgb:[230,106,84]},{index:.75,rgb:[242,149,103]},{index:.88,rgb:[249,193,135]},{index:1,rgb:[254,237,176]}],chlorophyll:[{index:0,rgb:[18,36,20]},{index:.13,rgb:[25,63,41]},{index:.25,rgb:[24,91,59]},{index:.38,rgb:[13,119,72]},{index:.5,rgb:[18,148,80]},{index:.63,rgb:[80,173,89]},{index:.75,rgb:[132,196,122]},{index:.88,rgb:[175,221,162]},{index:1,rgb:[215,249,208]}],density:[{index:0,rgb:[54,14,36]},{index:.13,rgb:[89,23,80]},{index:.25,rgb:[110,45,132]},{index:.38,rgb:[120,77,178]},{index:.5,rgb:[120,113,213]},{index:.63,rgb:[115,151,228]},{index:.75,rgb:[134,185,227]},{index:.88,rgb:[177,214,227]},{index:1,rgb:[230,241,241]}],"freesurface-blue":[{index:0,rgb:[30,4,110]},{index:.13,rgb:[47,14,176]},{index:.25,rgb:[41,45,236]},{index:.38,rgb:[25,99,212]},{index:.5,rgb:[68,131,200]},{index:.63,rgb:[114,156,197]},{index:.75,rgb:[157,181,203]},{index:.88,rgb:[200,208,216]},{index:1,rgb:[241,237,236]}],"freesurface-red":[{index:0,rgb:[60,9,18]},{index:.13,rgb:[100,17,27]},{index:.25,rgb:[142,20,29]},{index:.38,rgb:[177,43,27]},{index:.5,rgb:[192,87,63]},{index:.63,rgb:[205,125,105]},{index:.75,rgb:[216,162,148]},{index:.88,rgb:[227,199,193]},{index:1,rgb:[241,237,236]}],oxygen:[{index:0,rgb:[64,5,5]},{index:.13,rgb:[106,6,15]},{index:.25,rgb:[144,26,7]},{index:.38,rgb:[168,64,3]},{index:.5,rgb:[188,100,4]},{index:.63,rgb:[206,136,11]},{index:.75,rgb:[220,174,25]},{index:.88,rgb:[231,215,44]},{index:1,rgb:[248,254,105]}],par:[{index:0,rgb:[51,20,24]},{index:.13,rgb:[90,32,35]},{index:.25,rgb:[129,44,34]},{index:.38,rgb:[159,68,25]},{index:.5,rgb:[182,99,19]},{index:.63,rgb:[199,134,22]},{index:.75,rgb:[212,171,35]},{index:.88,rgb:[221,210,54]},{index:1,rgb:[225,253,75]}],phase:[{index:0,rgb:[145,105,18]},{index:.13,rgb:[184,71,38]},{index:.25,rgb:[186,58,115]},{index:.38,rgb:[160,71,185]},{index:.5,rgb:[110,97,218]},{index:.63,rgb:[50,123,164]},{index:.75,rgb:[31,131,110]},{index:.88,rgb:[77,129,34]},{index:1,rgb:[145,105,18]}],salinity:[{index:0,rgb:[42,24,108]},{index:.13,rgb:[33,50,162]},{index:.25,rgb:[15,90,145]},{index:.38,rgb:[40,118,137]},{index:.5,rgb:[59,146,135]},{index:.63,rgb:[79,175,126]},{index:.75,rgb:[120,203,104]},{index:.88,rgb:[193,221,100]},{index:1,rgb:[253,239,154]}],temperature:[{index:0,rgb:[4,35,51]},{index:.13,rgb:[23,51,122]},{index:.25,rgb:[85,59,157]},{index:.38,rgb:[129,79,143]},{index:.5,rgb:[175,95,130]},{index:.63,rgb:[222,112,101]},{index:.75,rgb:[249,146,66]},{index:.88,rgb:[249,196,65]},{index:1,rgb:[232,250,91]}],turbidity:[{index:0,rgb:[34,31,27]},{index:.13,rgb:[65,50,41]},{index:.25,rgb:[98,69,52]},{index:.38,rgb:[131,89,57]},{index:.5,rgb:[161,112,59]},{index:.63,rgb:[185,140,66]},{index:.75,rgb:[202,174,88]},{index:.88,rgb:[216,209,126]},{index:1,rgb:[233,246,171]}],"velocity-blue":[{index:0,rgb:[17,32,64]},{index:.13,rgb:[35,52,116]},{index:.25,rgb:[29,81,156]},{index:.38,rgb:[31,113,162]},{index:.5,rgb:[50,144,169]},{index:.63,rgb:[87,173,176]},{index:.75,rgb:[149,196,189]},{index:.88,rgb:[203,221,211]},{index:1,rgb:[254,251,230]}],"velocity-green":[{index:0,rgb:[23,35,19]},{index:.13,rgb:[24,64,38]},{index:.25,rgb:[11,95,45]},{index:.38,rgb:[39,123,35]},{index:.5,rgb:[95,146,12]},{index:.63,rgb:[152,165,18]},{index:.75,rgb:[201,186,69]},{index:.88,rgb:[233,216,137]},{index:1,rgb:[255,253,205]}],cubehelix:[{index:0,rgb:[0,0,0]},{index:.07,rgb:[22,5,59]},{index:.13,rgb:[60,4,105]},{index:.2,rgb:[109,1,135]},{index:.27,rgb:[161,0,147]},{index:.33,rgb:[210,2,142]},{index:.4,rgb:[251,11,123]},{index:.47,rgb:[255,29,97]},{index:.53,rgb:[255,54,69]},{index:.6,rgb:[255,85,46]},{index:.67,rgb:[255,120,34]},{index:.73,rgb:[255,157,37]},{index:.8,rgb:[241,191,57]},{index:.87,rgb:[224,220,93]},{index:.93,rgb:[218,241,142]},{index:1,rgb:[227,253,198]}]}},{}],97:[function(t,e,r){"use strict";function n(t){var e,r,n,u,c,h,f,d,p,m,v,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(),!l[f])throw Error(f+" not a supported colorscale");h=s(l[f])}else{if(!Array.isArray(f))throw Error("unsupported colormap option",f);h=s(f)}if(h.length>p)throw new Error(f+" map requires nshades to be at least size "+h.length);for(v=Array.isArray(t.alpha)?2!==t.alpha.length?[1,1]:s(t.alpha):"number"==typeof t.alpha?[t.alpha,t.alpha]:[1,1],e=h.map(function(t){return Math.round(t.index*p)}),v[0]<0&&(v[0]=0),v[1]<0&&(v[0]=0),v[0]>1&&(v[0]=1),v[1]>1&&(v[0]=1),y=0;y=0&&r[3]<=1||(r[3]=v[0]+(v[1]-v[0])*g);for(y=0;y=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);return c===n(t,e,i)?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);return h>0?s>0&&a(t,e,i)>0?1:-1:h<0?s>0||a(t,e,i)>0?1:-1:a(t,e,i)>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":506,"robust-product":507,"robust-sum":511,signum:513,"two-sum":538}],99:[function(t,e,r){function n(t,e){return t-e}function i(t,e){var r=t.length,i=t.length-e.length;if(i)return i;switch(r){case 0:return 0;case 1:return t[0]-e[0];case 2:return t[0]+t[1]-e[0]-e[1]||a(t[0],t[1])-a(e[0],e[1]);case 3:var o=t[0]+t[1],s=e[0]+e[1];if(i=o+t[2]-(s+e[2]))return i;var l=a(t[0],t[1]),u=a(e[0],e[1]);return a(l,t[2])-a(u,e[2])||a(l+t[2],o)-a(u+e[2],s);case 4:var c=t[0],h=t[1],f=t[2],d=t[3],p=e[0],m=e[1],v=e[2],g=e[3];return c+h+f+d-(p+m+v+g)||a(c,h,f,d)-a(p,m,v,g,p)||a(c+h,c+f,c+d,h+f,h+d,f+d)-a(p+m,p+v,p+g,m+v,m+g,v+g)||a(c+h+f,c+h+d,c+f+d,h+f+d)-a(p+m+v,p+m+g,p+v+g,m+v+g);default:for(var y=t.slice().sort(n),b=e.slice().sort(n),x=0;xt[r][0]&&(r=n);return er?[[r],[e]]:[[e]]}e.exports=n},{}],103:[function(t,e,r){"use strict";function n(t){var e=i(t),r=e.length;if(r<=2)return[];for(var n=new Array(r),a=e[r-1],o=0;o=e[l]&&(s+=1);a[o]=s}}return t}function a(t,e){try{return o(t,!0)}catch(u){var r=s(t);if(r.length<=e)return[];var a=n(t,r),l=o(a,!0);return i(l,r)}}e.exports=a;var o=t("incremental-convex-hull"),s=t("affine-hull")},{"affine-hull":39,"incremental-convex-hull":288}],105:[function(t,e,r){e.exports={AFG:"afghan",ALA:"\\b\\wland",ALB:"albania",DZA:"algeria",ASM:"^(?=.*americ).*samoa",AND:"andorra",AGO:"angola",AIA:"anguill?a",ATA:"antarctica",ATG:"antigua",ARG:"argentin",ARM:"armenia",ABW:"^(?!.*bonaire).*\\baruba",AUS:"australia",AUT:"^(?!.*hungary).*austria|\\baustri.*\\bemp",AZE:"azerbaijan",BHS:"bahamas",BHR:"bahrain",BGD:"bangladesh|^(?=.*east).*paki?stan",BRB:"barbados",BLR:"belarus|byelo",BEL:"^(?!.*luxem).*belgium",BLZ:"belize|^(?=.*british).*honduras",BEN:"benin|dahome",BMU:"bermuda",BTN:"bhutan",BOL:"bolivia",BES:"^(?=.*bonaire).*eustatius|^(?=.*carib).*netherlands|\\bbes.?islands",BIH:"herzegovina|bosnia",BWA:"botswana|bechuana",BVT:"bouvet",BRA:"brazil",IOT:"british.?indian.?ocean",BRN:"brunei",BGR:"bulgaria",BFA:"burkina|\\bfaso|upper.?volta",BDI:"burundi",CPV:"verde",KHM:"cambodia|kampuchea|khmer",CMR:"cameroon",CAN:"canada",CYM:"cayman",CAF:"\\bcentral.african.republic",TCD:"\\bchad",CHL:"\\bchile",CHN:"^(?!.*\\bmac)(?!.*\\bhong)(?!.*\\btai)(?!.*\\brep).*china|^(?=.*peo)(?=.*rep).*china",CXR:"christmas",CCK:"\\bcocos|keeling",COL:"colombia",COM:"comoro",COG:"^(?!.*\\bdem)(?!.*\\bd[\\.]?r)(?!.*kinshasa)(?!.*zaire)(?!.*belg)(?!.*l.opoldville)(?!.*free).*\\bcongo",COK:"\\bcook",CRI:"costa.?rica",CIV:"ivoire|ivory",HRV:"croatia",CUB:"\\bcuba",CUW:"^(?!.*bonaire).*\\bcura(c|\xe7)ao",CYP:"cyprus",CSK:"czechoslovakia",CZE:"^(?=.*rep).*czech|czechia|bohemia",COD:"\\bdem.*congo|congo.*\\bdem|congo.*\\bd[\\.]?r|\\bd[\\.]?r.*congo|belgian.?congo|congo.?free.?state|kinshasa|zaire|l.opoldville|drc|droc|rdc",DNK:"denmark",DJI:"djibouti",DMA:"dominica(?!n)",DOM:"dominican.rep",ECU:"ecuador",EGY:"egypt",SLV:"el.?salvador",GNQ:"guine.*eq|eq.*guine|^(?=.*span).*guinea",ERI:"eritrea",EST:"estonia",ETH:"ethiopia|abyssinia",FLK:"falkland|malvinas",FRO:"faroe|faeroe",FJI:"fiji",FIN:"finland",FRA:"^(?!.*\\bdep)(?!.*martinique).*france|french.?republic|\\bgaul",GUF:"^(?=.*french).*guiana",PYF:"french.?polynesia|tahiti",ATF:"french.?southern",GAB:"gabon",GMB:"gambia",GEO:"^(?!.*south).*georgia",DDR:"german.?democratic.?republic|democratic.?republic.*germany|east.germany",DEU:"^(?!.*east).*germany|^(?=.*\\bfed.*\\brep).*german",GHA:"ghana|gold.?coast",GIB:"gibraltar",GRC:"greece|hellenic|hellas",GRL:"greenland",GRD:"grenada",GLP:"guadeloupe",GUM:"\\bguam",GTM:"guatemala",GGY:"guernsey",GIN:"^(?!.*eq)(?!.*span)(?!.*bissau)(?!.*portu)(?!.*new).*guinea",GNB:"bissau|^(?=.*portu).*guinea",GUY:"guyana|british.?guiana",HTI:"haiti",HMD:"heard.*mcdonald",VAT:"holy.?see|vatican|papal.?st",HND:"^(?!.*brit).*honduras",HKG:"hong.?kong",HUN:"^(?!.*austr).*hungary",ISL:"iceland",IND:"india(?!.*ocea)",IDN:"indonesia",IRN:"\\biran|persia",IRQ:"\\biraq|mesopotamia",IRL:"(^ireland)|(^republic.*ireland)",IMN:"^(?=.*isle).*\\bman",ISR:"israel",ITA:"italy",JAM:"jamaica",JPN:"japan",JEY:"jersey",JOR:"jordan",KAZ:"kazak",KEN:"kenya|british.?east.?africa|east.?africa.?prot",KIR:"kiribati",PRK:"^(?=.*democrat|people|north|d.*p.*.r).*\\bkorea|dprk|korea.*(d.*p.*r)",KWT:"kuwait",KGZ:"kyrgyz|kirghiz",LAO:"\\blaos?\\b",LVA:"latvia",LBN:"lebanon",LSO:"lesotho|basuto",LBR:"liberia",LBY:"libya",LIE:"liechtenstein",LTU:"lithuania",LUX:"^(?!.*belg).*luxem",MAC:"maca(o|u)",MDG:"madagascar|malagasy",MWI:"malawi|nyasa",MYS:"malaysia",MDV:"maldive",MLI:"\\bmali\\b",MLT:"\\bmalta",MHL:"marshall",MTQ:"martinique",MRT:"mauritania",MUS:"mauritius",MYT:"\\bmayotte",MEX:"\\bmexic",FSM:"fed.*micronesia|micronesia.*fed",MCO:"monaco",MNG:"mongolia",MNE:"^(?!.*serbia).*montenegro",MSR:"montserrat",MAR:"morocco|\\bmaroc",MOZ:"mozambique",MMR:"myanmar|burma",NAM:"namibia",NRU:"nauru",NPL:"nepal",NLD:"^(?!.*\\bant)(?!.*\\bcarib).*netherlands",ANT:"^(?=.*\\bant).*(nether|dutch)",NCL:"new.?caledonia",NZL:"new.?zealand",NIC:"nicaragua",NER:"\\bniger(?!ia)",NGA:"nigeria",NIU:"niue",NFK:"norfolk",MNP:"mariana",NOR:"norway",OMN:"\\boman|trucial",PAK:"^(?!.*east).*paki?stan",PLW:"palau",PSE:"palestin|\\bgaza|west.?bank",PAN:"panama",PNG:"papua|new.?guinea",PRY:"paraguay",PER:"peru",PHL:"philippines",PCN:"pitcairn",POL:"poland",PRT:"portugal",PRI:"puerto.?rico",QAT:"qatar",KOR:"^(?!.*d.*p.*r)(?!.*democrat)(?!.*people)(?!.*north).*\\bkorea(?!.*d.*p.*r)",MDA:"moldov|b(a|e)ssarabia",REU:"r(e|\xe9)union",ROU:"r(o|u|ou)mania",RUS:"\\brussia|soviet.?union|u\\.?s\\.?s\\.?r|socialist.?republics",RWA:"rwanda",BLM:"barth(e|\xe9)lemy",SHN:"helena",KNA:"kitts|\\bnevis",LCA:"\\blucia",MAF:"^(?=.*collectivity).*martin|^(?=.*france).*martin(?!ique)|^(?=.*french).*martin(?!ique)",SPM:"miquelon",VCT:"vincent",WSM:"^(?!.*amer).*samoa",SMR:"san.?marino",STP:"\\bs(a|\xe3)o.?tom(e|\xe9)",SAU:"\\bsa\\w*.?arabia",SEN:"senegal",SRB:"^(?!.*monte).*serbia",SYC:"seychell",SLE:"sierra",SGP:"singapore",SXM:"^(?!.*martin)(?!.*saba).*maarten",SVK:"^(?!.*cze).*slovak",SVN:"slovenia",SLB:"solomon",SOM:"somali",ZAF:"south.africa|s\\\\..?africa",SGS:"south.?georgia|sandwich",SSD:"\\bs\\w*.?sudan",ESP:"spain",LKA:"sri.?lanka|ceylon",SDN:"^(?!.*\\bs(?!u)).*sudan",SUR:"surinam|dutch.?guiana",SJM:"svalbard",SWZ:"swaziland",SWE:"sweden",CHE:"switz|swiss",SYR:"syria",TWN:"taiwan|taipei|formosa|^(?!.*peo)(?=.*rep).*china",TJK:"tajik",THA:"thailand|\\bsiam",MKD:"macedonia|fyrom",TLS:"^(?=.*leste).*timor|^(?=.*east).*timor",TGO:"togo",TKL:"tokelau",TON:"tonga",TTO:"trinidad|tobago",TUN:"tunisia",TUR:"turkey",TKM:"turkmen",TCA:"turks",TUV:"tuvalu",UGA:"uganda",UKR:"ukrain",ARE:"emirates|^u\\.?a\\.?e\\.?$|united.?arab.?em",GBR:"united.?kingdom|britain|^u\\.?k\\.?$",TZA:"tanzania",USA:"united.?states\\b(?!.*islands)|\\bu\\.?s\\.?a\\.?\\b|^\\s*u\\.?s\\.?\\b(?!.*islands)",UMI:"minor.?outlying.?is",URY:"uruguay",UZB:"uzbek",VUT:"vanuatu|new.?hebrides",VEN:"venezuela",VNM:"^(?!.*republic).*viet.?nam|^(?=.*socialist).*viet.?nam",VGB:"^(?=.*\\bu\\.?\\s?k).*virgin|^(?=.*brit).*virgin|^(?=.*kingdom).*virgin",VIR:"^(?=.*\\bu\\.?\\s?s).*virgin|^(?=.*states).*virgin",WLF:"futuna|wallis",ESH:"western.sahara",YEM:"^(?!.*arab)(?!.*north)(?!.*sana)(?!.*peo)(?!.*dem)(?!.*south)(?!.*aden)(?!.*\\bp\\.?d\\.?r).*yemen",YMD:"^(?=.*peo).*yemen|^(?!.*rep)(?=.*dem).*yemen|^(?=.*south).*yemen|^(?=.*aden).*yemen|^(?=.*\\bp\\.?d\\.?r).*yemen",YUG:"yugoslavia",ZMB:"zambia|northern.?rhodesia",EAZ:"zanzibar",ZWE:"zimbabwe|^(?!.*northern).*rhodesia"}},{}],106:[function(t,e,r){function n(t){return t=Math.round(t),t<0?0:t>255?255:t}function i(t){return t<0?0:t>1?1:t}function a(t){return n("%"===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,r){return r<0?r+=1:r>1&&(r-=1),6*r<1?t+(e-t)*r*6:2*r<1?e:3*r<2?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&&r<=4095?[(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&&r<=16777215?[(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=o(h.pop());case"rgb":return 3!==h.length?null:[a(h[0]),a(h[1]),a(h[2]),f];case"hsla":if(4!==h.length)return null;f=o(h.pop());case"hsl":if(3!==h.length)return null;var d=(parseFloat(h[0])%360+360)%360/360,p=o(h[1]),m=o(h[2]),v=m<=.5?m*(p+1):m+p-m*p,g=2*m-v;return[n(255*s(g,v,d+1/3)),n(255*s(g,v,d)),n(255*s(g,v,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],rebeccapurple:[102,51,153,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(t){}},{}],107:[function(t,e,r){"use strict";function n(t,e,r,n,i,a){var o=6*i*i-6*i,s=3*i*i-4*i+1,l=-6*i*i+6*i,u=3*i*i-2*i;if(t.length){a||(a=new Array(t.length));for(var c=t.length-1;c>=0;--c)a[c]=o*t[c]+s*e[c]+l*r[c]+u*n[c];return a}return o*t+s*e+l*r[c]+u*n}function i(t,e,r,n,i,a){var o=i-1,s=i*i,l=o*o,u=(1+2*i)*l,c=i*l,h=s*(3-2*i),f=s*o;if(t.length){a||(a=new Array(t.length));for(var d=t.length-1;d>=0;--d)a[d]=u*t[d]+c*e[d]+h*r[d]+f*n[d];return a}return u*t+c*e+h*r+f*n}e.exports=i,e.exports.derivative=n},{}],108:[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"===o)e.scalarArgs.push(i),e.shimArgs.push("scalar"+i);else if("index"===o){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"===o){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,a(e)}var a=t("./lib/thunk.js");e.exports=i},{"./lib/thunk.js":110}],109:[function(t,e,r){"use strict";function n(t,e,r){var n,i,a=t.length,o=e.arrayArgs.length,s=e.indexArgs.length>0,l=[],u=[],c=0,h=0;for(n=0;n0&&l.push("var "+u.join(",")),n=a-1;n>=0;--n)c=t[n],l.push(["for(i",n,"=0;i",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 a=e.length,o=r.arrayArgs.length,s=r.blockSize,l=r.indexArgs.length>0,u=[],c=0;c0;){"].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;c0&&(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;h0&&_.push("shape=SS.slice(0)"),t.indexArgs.length>0){for(var w=new Array(r),h=0;h0&&x.push("var "+_.join(","));for(var h=0;h3&&x.push(o(t.pre,t,c));var T=o(t.body,t,c),S=a(v);S3&&x.push(o(t.post,t,c)),t.debug&&console.log("-----Generated cwise routine for ",e,":\n"+x.join("\n")+"\n----------");var E=[t.funcName||"unnamed","_cwise_loop_",l[0].join("s"),"m",S,s(c)].join("");return new Function(["function ",E,"(",b.join(","),"){",x.join("\n"),"} return ",E].join(""))()}var u=t("uniq");e.exports=l},{uniq:541}],110:[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 a=[],o=[],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--\x3e0;) {"),e.push("if (!("+u.join(" && ")+")) throw new Error('cwise: Arrays do not all have the same shape!')"),e.push("}"));for(var c=0;c=0?(a>=k?10:a>=A?5:a>=T?2:1)*Math.pow(10,i):-Math.pow(10,-i)/(a>=k?10:a>=A?5:a>=T?2:1)}function i(t,e,r){var n=Math.abs(e-t)/Math.max(0,r),i=Math.pow(10,Math.floor(Math.log(n)/Math.LN10)),a=n/i;return a>=k?i*=10:a>=A?i*=5:a>=T&&(i*=2),ee?1:t>=e?0:NaN},s=function(t){return 1===t.length&&(t=e(t)),{left:function(e,r,n,i){for(null==n&&(n=0),null==i&&(i=e.length);n>>1;t(e[a],r)<0?n=a+1:i=a}return n},right:function(e,r,n,i){for(null==n&&(n=0),null==i&&(i=e.length);n>>1;t(e[a],r)>0?i=a:n=a+1}return n}}},l=s(o),u=l.right,c=l.left,h=function(t,e){null==e&&(e=r);for(var n=0,i=t.length-1,a=t[0],o=new Array(i<0?0:i);nt?1:e>=t?0:NaN},p=function(t){return null===t?NaN:+t},m=function(t,e){var r,n,i=t.length,a=0,o=-1,s=0,l=0;if(null==e)for(;++o1)return l/(a-1)},v=function(t,e){var r=m(t,e);return r?Math.sqrt(r):r},g=function(t,e){var r,n,i,a=t.length,o=-1;if(null==e){for(;++o=r)for(n=i=r;++or&&(n=r),i=r)for(n=i=r;++or&&(n=r),i0)for(t=Math.ceil(t/o),e=Math.floor(e/o),a=new Array(i=Math.ceil(e-t+1));++lf;)d.pop(),--p;var m,v=new Array(p+1);for(a=0;a<=p;++a)m=v[a]=[],m.x0=a>0?d[a-1]:h,m.x1=a=1)return+r(t[n-1],n-1,t);var n,i=(n-1)*e,a=Math.floor(i),o=+r(t[a],a,t);return o+(+r(t[a+1],a+1,t)-o)*(i-a)}},z=function(t,e,r){return t=x.call(t,p).sort(o),Math.ceil((r-e)/(2*(C(t,.75)-C(t,.25))*Math.pow(t.length,-1/3)))},I=function(t,e,r){return Math.ceil((r-e)/(3.5*v(t)*Math.pow(t.length,-1/3)))},D=function(t,e){var r,n,i=t.length,a=-1;if(null==e){for(;++a=r)for(n=r;++an&&(n=r)}else for(;++a=r)for(n=r;++an&&(n=r);return n},P=function(t,e){var r,n=t.length,i=n,a=-1,o=0;if(null==e)for(;++a=0;)for(n=t[i],e=n.length;--e>=0;)r[--o]=n[e];return r},F=function(t,e){var r,n,i=t.length,a=-1;if(null==e){for(;++a=r)for(n=r;++ar&&(n=r)}else for(;++a=r)for(n=r;++ar&&(n=r);return n},j=function(t,e){for(var r=e.length,n=new Array(r);r--;)n[r]=t[e[r]];return n},N=function(t,e){if(r=t.length){var r,n,i=0,a=0,s=t[a];for(null==e&&(e=o);++i=c.length)return null!=l?l(e):null!=s?e.sort(s):e;for(var o,u,h,f=-1,d=e.length,p=c[n++],m=r(),v=i();++fc.length)return t;var n,i=h[r-1];return null!=l&&r>=c.length?n=t.entries():(n=[],t.each(function(t,i){n.push({key:i,values:e(t,r)})})),null!=i?n.sort(function(t,e){return i(t.key,e.key)}):n}var s,l,u,c=[],h=[];return u={object:function(e){return t(e,0,n,i)},map:function(e){return t(e,0,a,o)},entries:function(r){return e(t(r,0,a,o),0)},key:function(t){return c.push(t),u},sortKeys:function(t){return h[c.length-1]=t,u},sortValues:function(t){return s=t,u},rollup:function(t){return l=t,u}}},c=r.prototype;s.prototype=l.prototype={constructor:s,has:c.has,add:function(t){return t+="",this["$"+t]=t,this},remove:c.remove,clear:c.clear,values:c.keys,size:c.size,empty:c.empty,each:c.each};var h=function(t){var e=[];for(var r in t)e.push(r);return e},f=function(t){var e=[];for(var r in t)e.push(t[r]);return e},d=function(t){var e=[];for(var r in t)e.push({key:r,value:t[r]});return e};t.nest=u,t.set=l,t.map=r,t.keys=h,t.values=f,t.entries=d,Object.defineProperty(t,"__esModule",{value:!0})})},{}],114:[function(e,r,n){!function(e,i){"object"==typeof n&&void 0!==r?i(n):"function"==typeof t&&t.amd?t(["exports"],i):i(e.d3=e.d3||{})}(this,function(t){"use strict";function e(t,e){var r=Object.create(t.prototype);for(var n in e)r[n]=e[n];return r}function r(){}function n(t){var e;return t=(t+"").trim().toLowerCase(),(e=z.exec(t))?(e=parseInt(e[1],16),new l(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1)):(e=I.exec(t))?i(parseInt(e[1],16)):(e=D.exec(t))?new l(e[1],e[2],e[3],1):(e=P.exec(t))?new l(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=O.exec(t))?a(e[1],e[2],e[3],e[4]):(e=R.exec(t))?a(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=F.exec(t))?u(e[1],e[2]/100,e[3]/100,1):(e=j.exec(t))?u(e[1],e[2]/100,e[3]/100,e[4]):N.hasOwnProperty(t)?i(N[t]):"transparent"===t?new l(NaN,NaN,NaN,0):null}function i(t){return new l(t>>16&255,t>>8&255,255&t,1)}function a(t,e,r,n){return n<=0&&(t=e=r=NaN),new l(t,e,r,n)}function o(t){return t instanceof r||(t=n(t)),t?(t=t.rgb(),new l(t.r,t.g,t.b,t.opacity)):new l}function s(t,e,r,n){return 1===arguments.length?o(t):new l(t,e,r,null==n?1:n)}function l(t,e,r,n){this.r=+t,this.g=+e,this.b=+r,this.opacity=+n}function u(t,e,r,n){return n<=0?t=e=r=NaN:r<=0||r>=1?t=e=NaN:e<=0&&(t=NaN),new f(t,e,r,n)}function c(t){if(t instanceof f)return new f(t.h,t.s,t.l,t.opacity);if(t instanceof r||(t=n(t)),!t)return new f;if(t instanceof f)return t;t=t.rgb();var e=t.r/255,i=t.g/255,a=t.b/255,o=Math.min(e,i,a),s=Math.max(e,i,a),l=NaN,u=s-o,c=(s+o)/2;return u?(l=e===s?(i-a)/u+6*(i0&&c<1?0:l,new f(l,u,c,t.opacity)}function h(t,e,r,n){return 1===arguments.length?c(t):new f(t,e,r,null==n?1:n)}function f(t,e,r,n){this.h=+t,this.s=+e,this.l=+r,this.opacity=+n}function d(t,e,r){return 255*(t<60?e+(r-e)*t/60:t<180?r:t<240?e+(r-e)*(240-t)/60:e)}function p(t){if(t instanceof v)return new v(t.l,t.a,t.b,t.opacity);if(t instanceof M){var e=t.h*B;return new v(t.l,Math.cos(e)*t.c,Math.sin(e)*t.c,t.opacity)}t instanceof l||(t=o(t));var r=x(t.r),n=x(t.g),i=x(t.b),a=g((.4124564*r+.3575761*n+.1804375*i)/V),s=g((.2126729*r+.7151522*n+.072175*i)/H);return new v(116*s-16,500*(a-s),200*(s-g((.0193339*r+.119192*n+.9503041*i)/q)),t.opacity)}function m(t,e,r,n){return 1===arguments.length?p(t):new v(t,e,r,null==n?1:n)}function v(t,e,r,n){this.l=+t,this.a=+e,this.b=+r,this.opacity=+n}function g(t){return t>W?Math.pow(t,1/3):t/X+G}function y(t){return t>Y?t*t*t:X*(t-G)}function b(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function x(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function _(t){if(t instanceof M)return new M(t.h,t.c,t.l,t.opacity);t instanceof v||(t=p(t));var e=Math.atan2(t.b,t.a)*U;return new M(e<0?e+360:e,Math.sqrt(t.a*t.a+t.b*t.b),t.l,t.opacity)}function w(t,e,r,n){return 1===arguments.length?_(t):new M(t,e,r,null==n?1:n)}function M(t,e,r,n){this.h=+t,this.c=+e,this.l=+r,this.opacity=+n}function k(t){if(t instanceof T)return new T(t.h,t.s,t.l,t.opacity);t instanceof l||(t=o(t));var e=t.r/255,r=t.g/255,n=t.b/255,i=(rt*n+tt*e-et*r)/(rt+tt-et),a=n-i,s=($*(r-i)-K*a)/Q,u=Math.sqrt(s*s+a*a)/($*i*(1-i)),c=u?Math.atan2(s,a)*U-120:NaN;return new T(c<0?c+360:c,u,i,t.opacity)}function A(t,e,r,n){return 1===arguments.length?k(t):new T(t,e,r,null==n?1:n)}function T(t,e,r,n){this.h=+t,this.s=+e,this.l=+r,this.opacity=+n}var S=function(t,e,r){t.prototype=e.prototype=r,r.constructor=t},E="\\s*([+-]?\\d+)\\s*",L="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",C="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",z=/^#([0-9a-f]{3})$/,I=/^#([0-9a-f]{6})$/,D=new RegExp("^rgb\\("+[E,E,E]+"\\)$"),P=new RegExp("^rgb\\("+[C,C,C]+"\\)$"),O=new RegExp("^rgba\\("+[E,E,E,L]+"\\)$"),R=new RegExp("^rgba\\("+[C,C,C,L]+"\\)$"),F=new RegExp("^hsl\\("+[L,C,C]+"\\)$"),j=new RegExp("^hsla\\("+[L,C,C,L]+"\\)$"),N={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};S(r,n,{displayable:function(){return this.rgb().displayable()},toString:function(){return this.rgb()+""}}),S(l,s,e(r,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new l(this.r*t,this.g*t,this.b*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new l(this.r*t,this.g*t,this.b*t,this.opacity)},rgb:function(){return this},displayable:function(){return 0<=this.r&&this.r<=255&&0<=this.g&&this.g<=255&&0<=this.b&&this.b<=255&&0<=this.opacity&&this.opacity<=1},toString:function(){var t=this.opacity;return t=isNaN(t)?1:Math.max(0,Math.min(1,t)),(1===t?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(1===t?")":", "+t+")")}})),S(f,h,e(r,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new f(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new f(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=this.h%360+360*(this.h<0),e=isNaN(t)||isNaN(this.s)?0:this.s,r=this.l,n=r+(r<.5?r:1-r)*e,i=2*r-n;return new l(d(t>=240?t-240:t+120,i,n),d(t,i,n),d(t<120?t+240:t-120,i,n),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1}}));var B=Math.PI/180,U=180/Math.PI,V=.95047,H=1,q=1.08883,G=4/29,Y=6/29,X=3*Y*Y,W=Y*Y*Y;S(v,m,e(r,{brighter:function(t){return new v(this.l+18*(null==t?1:t),this.a,this.b,this.opacity)},darker:function(t){return new v(this.l-18*(null==t?1:t),this.a,this.b,this.opacity)},rgb:function(){var t=(this.l+16)/116,e=isNaN(this.a)?t:t+this.a/500,r=isNaN(this.b)?t:t-this.b/200;return t=H*y(t),e=V*y(e),r=q*y(r),new l(b(3.2404542*e-1.5371385*t-.4985314*r),b(-.969266*e+1.8760108*t+.041556*r),b(.0556434*e-.2040259*t+1.0572252*r),this.opacity)}})),S(M,w,e(r,{brighter:function(t){return new M(this.h,this.c,this.l+18*(null==t?1:t),this.opacity)},darker:function(t){return new M(this.h,this.c,this.l-18*(null==t?1:t),this.opacity)},rgb:function(){return p(this).rgb()}}));var Z=-.14861,J=1.78277,K=-.29227,Q=-.90649,$=1.97294,tt=$*Q,et=$*J,rt=J*K-Q*Z;S(T,A,e(r,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new T(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new T(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=isNaN(this.h)?0:(this.h+120)*B,e=+this.l,r=isNaN(this.s)?0:this.s*e*(1-e),n=Math.cos(t),i=Math.sin(t);return new l(255*(e+r*(Z*n+J*i)),255*(e+r*(K*n+Q*i)),255*(e+r*($*n)),this.opacity)}})),t.color=n,t.rgb=s,t.hsl=h,t.lab=m,t.hcl=w,t.cubehelix=A,Object.defineProperty(t,"__esModule",{value:!0})})},{}],115:[function(e,r,n){!function(e,i){"object"==typeof n&&void 0!==r?i(n):"function"==typeof t&&t.amd?t(["exports"],i):i(e.d3=e.d3||{})}(this,function(t){"use strict";function e(){for(var t,e=0,n=arguments.length,i={};e=0&&(r=t.slice(n+1),t=t.slice(0,n)),t&&!e.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:r}})}function i(t,e){for(var r,n=0,i=t.length;n0)for(var r,n,i=new Array(r),a=0;af+s||np+s||ih.index){var l=f-a.x-a.vx,c=p-a.y-a.vy,g=l*l+c*c;gt.r&&(t.r=t[e].r)}function i(){if(s){var e,r,n=s.length;for(l=new Array(n),e=0;e1?(null==e?p.remove(t):p.set(t,s(e)),l):p.get(t)},find:function(e,r,n){var i,a,o,s,l,u=0,c=t.length;for(null==n?n=1/0:n*=n,u=0;u1?(y.on(t,e),l):y.on(t)}}},b=function(){function t(t){var r,l=a.length,h=e.quadtree(a,u,c).visitAfter(n);for(s=t,r=0;r=m)){(t.data!==o||t.next)&&(0===i&&(i=d(),c+=i*i),0===a&&(a=d(),c+=a*a),c180||r<-180?r-360*Math.round(r/360):r):S(isNaN(t)?e:t)}function o(t){return 1==(t=+t)?s:function(e,r){return r-e?i(e,r,t):S(isNaN(e)?r:e)}}function s(t,e){var r=e-t;return r?n(t,r):S(isNaN(t)?e:t)}function l(t){return function(r){var n,i,a=r.length,o=new Array(a),s=new Array(a),l=new Array(a);for(n=0;n180?e+=360:e-t>180&&(t+=360),a.push({i:r.push(i(r)+"rotate(",null,n)-2,x:D(t,e)})):e&&r.push(i(r)+"rotate("+e+n)}function s(t,e,r,a){t!==e?a.push({i:r.push(i(r)+"skewX(",null,n)-2,x:D(t,e)}):e&&r.push(i(r)+"skewX("+e+n)}function l(t,e,r,n,a,o){if(t!==r||e!==n){var s=a.push(i(a)+"scale(",null,",",null,")");o.push({i:s-4,x:D(t,r)},{i:s-2,x:D(e,n)})}else 1===r&&1===n||a.push(i(a)+"scale("+r+","+n+")")}return function(e,r){var n=[],i=[];return e=t(e),r=t(r),a(e.translateX,e.translateY,r.translateX,r.translateY,n,i),o(e.rotate,r.rotate,n,i),s(e.skewX,r.skewX,n,i),l(e.scaleX,e.scaleY,r.scaleX,r.scaleY,n,i),e=r=null,function(t){for(var e,r=-1,a=i.length;++r=1?(n=1,e-1):Math.floor(n*e),a=t[i],o=t[i+1],s=i>0?t[i-1]:2*a-o,l=ia&&(i=e.slice(a,i),s[o]?s[o]+=i:s[++o]=i),(r=r[0])===(n=n[0])?s[o]?s[o]+=n:s[++o]=n:(s[++o]=null,l.push({i:o,x:D(r,n)})),a=R.lastIndex;return a=(a=(m+g)/2))?m=a:g=a,(c=r>=(o=(v+y)/2))?v=o:y=o,i=d,!(d=d[h=c<<1|u]))return i[h]=p,t;if(s=+t._x.call(null,d.data),l=+t._y.call(null,d.data),e===s&&r===l)return p.next=d,i?i[h]=p:t._root=p,t;do{i=i?i[h]=new Array(4):t._root=new Array(4),(u=e>=(a=(m+g)/2))?m=a:g=a,(c=r>=(o=(v+y)/2))?v=o:y=o}while((h=c<<1|u)==(f=(l>=o)<<1|s>=a));return i[f]=d,i[h]=p,t}function r(t){var r,n,i,a,o=t.length,s=new Array(o),l=new Array(o),u=1/0,c=1/0,h=-1/0,f=-1/0;for(n=0;nh&&(h=i),af&&(f=a));for(ht||t>i||n>e||e>a))return this;var o,s,l=i-r,u=this._root;switch(s=(e<(n+a)/2)<<1|t<(r+i)/2){case 0:do{o=new Array(4),o[s]=u,u=o}while(l*=2,i=r+l,a=n+l,t>i||e>a);break;case 1:do{o=new Array(4),o[s]=u,u=o}while(l*=2,r=i-l,a=n+l,r>t||e>a);break;case 2:do{o=new Array(4),o[s]=u,u=o}while(l*=2,i=r+l,n=a-l,t>i||n>e);break;case 3:do{o=new Array(4),o[s]=u,u=o}while(l*=2,r=i-l,n=a-l,r>t||n>e)}this._root&&this._root.length&&(this._root=u)}return this._x0=r,this._y0=n,this._x1=i,this._y1=a,this},h=function(){var t=[];return this.visit(function(e){if(!e.length)do{t.push(e.data)}while(e=e.next)}),t},f=function(t){return arguments.length?this.cover(+t[0][0],+t[0][1]).cover(+t[1][0],+t[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]},d=function(t,e,r,n,i){this.node=t,this.x0=e,this.y0=r,this.x1=n,this.y1=i},p=function(t,e,r){var n,i,a,o,s,l,u,c=this._x0,h=this._y0,f=this._x1,p=this._y1,m=[],v=this._root;for(v&&m.push(new d(v,c,h,f,p)),null==r?r=1/0:(c=t-r,h=e-r,f=t+r,p=e+r,r*=r);l=m.pop();)if(!(!(v=l.node)||(i=l.x0)>f||(a=l.y0)>p||(o=l.x1)=y)<<1|t>=g)&&(l=m[m.length-1],m[m.length-1]=m[m.length-1-u],m[m.length-1-u]=l)}else{var b=t-+this._x.call(null,v.data),x=e-+this._y.call(null,v.data),_=b*b+x*x;if(_=(s=(p+v)/2))?p=s:v=s,(c=o>=(l=(m+g)/2))?m=l:g=l,e=d,!(d=d[h=c<<1|u]))return this;if(!d.length)break;(e[h+1&3]||e[h+2&3]||e[h+3&3])&&(r=e,f=h)}for(;d.data!==t;)if(n=d,!(d=d.next))return this;return(i=d.next)&&delete d.next,n?(i?n.next=i:delete n.next,this):e?(i?e[h]=i:delete e[h],(d=e[0]||e[1]||e[2]||e[3])&&d===(e[3]||e[2]||e[1]||e[0])&&!d.length&&(r?r[f]=d:this._root=d),this):(this._root=i,this)},v=function(){return this._root},g=function(){var t=0;return this.visit(function(e){if(!e.length)do{++t}while(e=e.next)}),t},y=function(t){var e,r,n,i,a,o,s=[],l=this._root;for(l&&s.push(new d(l,this._x0,this._y0,this._x1,this._y1));e=s.pop();)if(!t(l=e.node,n=e.x0,i=e.y0,a=e.x1,o=e.y1)&&l.length){var u=(n+a)/2,c=(i+o)/2;(r=l[3])&&s.push(new d(r,u,c,a,o)),(r=l[2])&&s.push(new d(r,n,c,u,o)),(r=l[1])&&s.push(new d(r,u,i,a,c)),(r=l[0])&&s.push(new d(r,n,i,u,c))}return this},b=function(t){var e,r=[],n=[];for(this._root&&r.push(new d(this._root,this._x0,this._y0,this._x1,this._y1));e=r.pop();){var i=e.node;if(i.length){var a,o=e.x0,s=e.y0,l=e.x1,u=e.y1,c=(o+l)/2,h=(s+u)/2;(a=i[0])&&r.push(new d(a,o,s,c,h)),(a=i[1])&&r.push(new d(a,c,s,l,h)),(a=i[2])&&r.push(new d(a,o,h,c,u)),(a=i[3])&&r.push(new d(a,c,h,l,u))}n.push(e)}for(;e=n.pop();)t(e.node,e.x0,e.y0,e.x1,e.y1);return this},x=function(t){return arguments.length?(this._x=t,this):this._x},_=function(t){return arguments.length?(this._y=t,this):this._y},w=o.prototype=s.prototype;w.copy=function(){var t,e,r=new s(this._x,this._y,this._x0,this._y0,this._x1,this._y1),n=this._root;if(!n)return r;if(!n.length)return r._root=l(n),r;for(t=[{source:n,target:r._root=new Array(4)}];n=t.pop();)for(var i=0;i<4;++i)(e=n.source[i])&&(e.length?t.push({source:e,target:n.target[i]=new Array(4)}):n.target[i]=l(e));return r},w.add=u,w.addAll=r,w.cover=c,w.data=h,w.extent=f,w.find=p,w.remove=m,w.removeAll=n,w.root=v,w.size=g,w.visit=y,w.visitAfter=b,w.x=x,w.y=_,t.quadtree=o,Object.defineProperty(t,"__esModule",{value:!0})})},{}],119:[function(e,r,n){!function(e,i){"object"==typeof n&&void 0!==r?i(n):"function"==typeof t&&t.amd?t(["exports"],i):i(e.d3=e.d3||{})}(this,function(t){"use strict";function e(){return g||(x(r),g=b.now()+y)}function r(){g=0}function n(){this._call=this._time=this._next=null}function i(t,e,r){var i=new n;return i.restart(t,e,r),i}function a(){e(),++f;for(var t,r=c;r;)(t=g-r._time)>=0&&r._call.call(null,t),r=r._next;--f}function o(){g=(v=b.now())+y,f=d=0;try{a()}finally{f=0,l(),g=0}}function s(){var t=b.now(),e=t-v;e>m&&(y-=e,v=t)}function l(){for(var t,e,r=c,n=1/0;r;)r._call?(n>r._time&&(n=r._time),t=r,r=r._next):(e=r._next,r._next=null,r=t?t._next=e:c=e);h=t,u(n)}function u(t){if(!f){d&&(d=clearTimeout(d));var e=t-g;e>24?(t<1/0&&(d=setTimeout(o,e)),p&&(p=clearInterval(p))):(p||(v=g,p=setInterval(s,m)),f=1,x(o))}}var c,h,f=0,d=0,p=0,m=1e3,v=0,g=0,y=0,b="object"==typeof performance&&performance.now?performance:Date,x="function"==typeof requestAnimationFrame?requestAnimationFrame:function(t){setTimeout(t,17)};n.prototype=i.prototype={constructor:n,restart:function(t,r,n){if("function"!=typeof t)throw new TypeError("callback is not a function");n=(null==n?e():+n)+(null==r?0:+r),this._next||h===this||(h?h._next=this:c=this,h=this),this._call=t,this._time=n,u()},stop:function(){this._call&&(this._call=null,this._time=1/0,u())}};var _=function(t,e,r){var i=new n;return e=null==e?0:+e,i.restart(function(r){i.stop(),t(r+e)},e,r),i},w=function(t,r,i){var a=new n,o=r;return null==r?(a.restart(t,r,i),a):(r=+r,i=null==i?e():+i,a.restart(function e(n){n+=o,a.restart(e,o+=r,i),t(n)},r,i),a)};t.now=e,t.timer=i,t.timerFlush=a,t.timeout=_,t.interval=w,Object.defineProperty(t,"__esModule",{value:!0})})},{}],120:[function(e,r,n){!function(){function e(t){return t&&(t.ownerDocument||t.document||t).documentElement}function n(t){return t&&(t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView)}function i(t,e){return te?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,r,n,i){for(arguments.length<3&&(n=0),arguments.length<4&&(i=e.length);n>>1;t(e[a],r)<0?n=a+1:i=a}return n},right:function(e,r,n,i){for(arguments.length<3&&(n=0),arguments.length<4&&(i=e.length);n>>1;t(e[a],r)>0?i=a:n=a+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+="")===_o||t[0]===wo?wo+t:t}function d(t){return(t+="")[0]===wo?t.slice(1):t}function p(t){return f(t)in this._}function m(t){return(t=f(t))in this._&&delete this._[t]}function v(){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=Mo.length;r=e&&(e=i+1);!(o=s[e])&&++e0&&(t=t.slice(0,s));var u=Do.get(t);return u&&(t=u,l=J),s?e?i:n:e?M:a}function Z(t,e){return function(r){var n=uo.event;uo.event=r,e[0]=this.__data__;try{t.apply(this,e)}finally{uo.event=n}}}function J(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-"+ ++Oo,i="click"+r,a=uo.select(n(t)).on("touchmove"+r,T).on("dragstart"+r,T).on("selectstart"+r,T);if(null==Po&&(Po=!("onselectstart"in t)&&w(t.style,"userSelect")),Po){var o=e(t).style,s=o[Po];o[Po]="none"}return function(t){if(a.on(r,null),Po&&(o[Po]=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 r=t.ownerSVGElement||t;if(r.createSVGPoint){var i=r.createSVGPoint();if(Ro<0){var a=n(t);if(a.scrollX||a.scrollY){r=uo.select("body").append("svg").style({position:"absolute",top:0,left:0,margin:0,padding:0,border:"none"},"important");var o=r[0][0].getScreenCTM();Ro=!(o.f||o.e),r.remove()}}return Ro?(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 uo.event.changedTouches[0].identifier}function tt(t){return t>0?1:t<0?-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:t<-1?No:Math.acos(t)}function nt(t){return t>1?Vo:t<-1?-Vo: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,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:t<0&&(t+=360),t<60?a+(o-a)*t/60:t<180?o:t<240?a+(o-a)*(240-t)/60:a}function i(t){return Math.round(255*n(t))}var a,o;return t=isNaN(t)?0:(t%=360)<0?t+360:t,e=isNaN(e)?0:e<0?0:e>1?1:e,r=r<0?0:r>1?1:r,o=r<=.5?r*(1+e):r+e-r*e,a=2*r-o,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?mt(t.l,t.a,t.b):mt((t=At((t=uo.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*=Ho)*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,a=n-r/200;return i=vt(i)*Qo,n=vt(n)*$o,a=vt(a)*ts,new bt(yt(3.2404542*i-1.5371385*n-.4985314*a),yt(-.969266*i+1.8760108*n+.041556*a),yt(.0556434*i-.2040259*n+1.0572252*a))}function mt(t,e,r){return t>0?new ht(Math.atan2(r,e)*qo,Math.sqrt(e*e+r*r),t):new ht(NaN,NaN,t)}function vt(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*(t<=.00304?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 t<16?"0"+Math.max(0,t).toString(16):Math.min(255,t).toString(16)}function Mt(t,e,r){var n,i,a,o=0,s=0,l=0;if(n=/([a-z]+)\((.*)\)/.exec(t=t.toLowerCase()))switch(i=n[2].split(","),n[1]){case"hsl":return r(parseFloat(i[0]),parseFloat(i[1])/100,parseFloat(i[2])/100);case"rgb":return e(St(i[0]),St(i[1]),St(i[2]))}return(a=ns.get(t))?e(a.r,a.g,a.b):(null==t||"#"!==t.charAt(0)||isNaN(a=parseInt(t.slice(1),16))||(4===t.length?(o=(3840&a)>>4,o|=o>>4,s=240&a,s|=s>>4,l=15&a,l|=l<<4):7===t.length&&(o=(16711680&a)>>16,s=(65280&a)>>8,l=255&a)),e(o,s,l))}function kt(t,e,r){var n,i,a=Math.min(t/=255,e/=255,r/=255),o=Math.max(t,e,r),s=o-a,l=(o+a)/2;return s?(i=l<.5?s/(o+a):s/(2-o-a),n=t==o?(e-r)/s+(e0&&l<1?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)/Qo),i=gt((.2126729*t+.7151522*e+.072175*r)/$o);return dt(116*i-16,500*(n-i),200*(i-gt((.0193339*t+.119192*e+.9503041*r)/ts)))}function Tt(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function St(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,r,n){return 2===arguments.length&&"function"==typeof r&&(n=r,r=null),Ct(e,r,t,n)}}function Ct(t,e,r,n){function i(){var t,e=l.status;if(!e&&It(l)||e>=200&&e<300||304===e){try{t=r.call(a,l) +}catch(t){return void o.error.call(a,t)}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 r=t,a},["get","post"].forEach(function(t){a[t]=function(){return a.send.apply(a,[t].concat(ho(arguments)))}}),a.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&&a.on("error",i).on("load",function(t){i(null,t)}),o.beforesend.call(a,l),l.send(null==n?null:n),a},a.abort=function(){return l.abort(),a},uo.rebind(a,o,"on"),null==n?a:a.get(zt(n))}function zt(t){return 1===t.length?function(e,r){t(null==e?r:null)}:t}function It(t){var e=t.responseType;return e&&"text"!==e?t.response:t.responseText}function Dt(t,e,r){var n=arguments.length;n<2&&(e=0),n<3&&(r=Date.now());var i=r+e,a={c:t,t:i,n:null};return as?as.n=a:is=a,as=a,os||(ss=clearTimeout(ss),os=1,ls(Pt)),a}function Pt(){var t=Ot(),e=Rt()-t;e>24?(isFinite(e)&&(clearTimeout(ss),ss=setTimeout(Pt,e)),os=0):(os=1,ls(Pt))}function Ot(){for(var t=Date.now(),e=is;e;)t>=e.t&&e.c(t-e.t)&&(e.c=null),e=e.n;return t}function Rt(){for(var t,e=is,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,a=n&&r?function(t,e){for(var i=t.length,a=[],o=0,s=n[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=n[o=(o+1)%n.length];return a.reverse().join(r)}:x;return function(t){var r=cs.exec(t),n=r[1]||" ",o=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,m="",v="",g=!1,y=!0;switch(f&&(f=+f.substring(1)),(u||"0"===n&&"="===o)&&(u=n="0",o="="),d){case"n":h=!0,d="g";break;case"%":p=100,v="%",d="f";break;case"p":p=100,v="%",d="r";break;case"b":case"o":case"x":case"X":"#"===l&&(m="0"+d.toLowerCase());case"c":y=!1;case"d":g=!0,f=0;break;case"s":p=-1,d="r"}"$"===l&&(m=i[0],v=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=hs.get(d)||Bt;var b=u&&h;return function(t){var r=v;if(g&&t%1)return"";var i=t<0||0===t&&1/t<0?(t=-t,"-"):"-"===s?"":s;if(p<0){var l=uo.formatPrefix(t,f);t=l.scale(t),r=l.symbol+v}else t*=p;t=d(t,f);var x,_,w=t.lastIndexOf(".");if(w<0){var M=y?t.lastIndexOf("e"):-1;M<0?(x=t,_=""):(x=t.substring(0,M),_=t.substring(M))}else x=t.substring(0,w),_=e+t.substring(w+1);!u&&h&&(x=a(x,1/0));var k=m.length+x.length+_.length+(b?0:i.length),A=k"===o?A+i+t:"^"===o?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=a(r,1);return e-r1)for(;o=u)return-1;if(37===(i=e.charCodeAt(s++))){if(o=e.charAt(s++),!(a=L[o in ms?e.charAt(s++):o])||(n=a(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 a(t,e,r){T.lastIndex=0;var n=T.exec(e.slice(r));return n?(t.m=S.get(n[0].toLowerCase()),r+n[0].length):-1}function o(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,E.c.toString(),e,n)}function l(t,e,n){return r(t,E.x.toString(),e,n)}function u(t,e,n){return r(t,E.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,m=t.days,v=t.shortDays,g=t.months,y=t.shortMonths;e.utc=function(t){function r(t){try{ds=Ut;var e=new ds;return e._=t,n(e)}finally{ds=Date}}var n=e(t);return r.parse=function(t){try{ds=Ut;var e=n.parse(t);return e&&e._}finally{ds=Date}},r.toString=n.toString,r},e.multi=e.utc.multi=ce;var b=uo.map(),x=Yt(m),_=Xt(m),w=Yt(v),M=Xt(v),k=Yt(g),A=Xt(g),T=Yt(y),S=Xt(y);p.forEach(function(t,e){b.set(t.toLowerCase(),e)});var E={a:function(t){return v[t.getDay()]},A:function(t){return m[t.getDay()]},b:function(t){return y[t.getMonth()]},B:function(t){return g[t.getMonth()]},c:e(h),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+fs.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(fs.sundayOfYear(t),e,2)},w:function(t){return t.getDay()},W:function(t,e){return Gt(fs.mondayOfYear(t),e,2)},x:e(f),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"%"}},L={a:n,A:i,b:a,B:o,c:s,d:re,e:re,H:ie,I:ie,j:ne,L:se,m:ee,M:ae,p:c,S:oe,U:Zt,w:Wt,W:Jt,x:l,X:u,y:Qt,Y:Kt,Z:$t,"%":ue};return e}function Gt(t,e,r){var n=t<0?"-":"",i=(n?-t:t)+"",a=i.length;return n+(a68?1900:2e3)}function ee(t,e,r){vs.lastIndex=0;var n=vs.exec(e.slice(r,r+2));return n?(t.m=n[0]-1,r+n[0].length):-1}function re(t,e,r){vs.lastIndex=0;var n=vs.exec(e.slice(r,r+2));return n?(t.d=+n[0],r+n[0].length):-1}function ne(t,e,r){vs.lastIndex=0;var n=vs.exec(e.slice(r,r+3));return n?(t.j=+n[0],r+n[0].length):-1}function ie(t,e,r){vs.lastIndex=0;var n=vs.exec(e.slice(r,r+2));return n?(t.H=+n[0],r+n[0].length):-1}function ae(t,e,r){vs.lastIndex=0;var n=vs.exec(e.slice(r,r+2));return n?(t.M=+n[0],r+n[0].length):-1}function oe(t,e,r){vs.lastIndex=0;var n=vs.exec(e.slice(r,r+2));return n?(t.S=+n[0],r+n[0].length):-1}function se(t,e,r){vs.lastIndex=0;var n=vs.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=xo(e)/60|0,i=xo(e)%60;return r+Gt(n,"0",2)+Gt(i,"0",2)}function ue(t,e,r){gs.lastIndex=0;var n=gs.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=o*r,l=Math.cos(e),u=Math.sin(e),c=a*u,h=i*l+c*Math.cos(s),f=c*o*Math.sin(s);Ms.add(Math.atan2(f,h)),n=t,i=l,a=u}var e,r,n,i,a;ks.point=function(o,s){ks.point=t,n=(e=o)*Ho,i=Math.cos(s=(r=s)*Ho/2+No/4),a=Math.sin(s)},ks.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 xo(t[0]-e[0])=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 De(t){if(e=t.length){for(var e,r,n=0,i=t[0];++n0){for(_||(a.polygonStart(),_=!0),a.lineStart();++o1&&2&e&&r.push(r.pop().concat(r.shift())),d.push(r.filter(Re))}var d,p,m,v=e(a),g=i.invert(n[0],n[1]),y={point:o,lineStart:l,lineEnd:u,polygonStart:function(){y.point=c,y.lineStart=h,y.lineEnd=f,d=[],p=[]},polygonEnd:function(){y.point=o,y.lineStart=l,y.lineEnd=u,d=uo.merge(d);var t=Ve(g,p);d.length?(_||(a.polygonStart(),_=!0),Ie(d,je,t,r,a)):t&&(_||(a.polygonStart(),_=!0),a.lineStart(),r(null,null,1,a),a.lineEnd()),_&&(a.polygonEnd(),_=!1),d=p=null},sphere:function(){a.polygonStart(),a.lineStart(),r(null,null,1,a),a.lineEnd(),a.polygonEnd()}},b=Fe(),x=e(b),_=!1;return y}}function Re(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]-Vo-Fo:Vo-t[1])-((e=e.x)[0]<0?e[1]-Vo-Fo:Vo-e[1])}function Ne(t){var e,r=NaN,n=NaN,i=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(a,o){var s=a>0?No:-No,l=xo(a-r);xo(l-No)0?Vo:-Vo),t.point(i,n),t.lineEnd(),t.lineStart(),t.point(s,n),t.point(a,n),e=0):i!==s&&l>=No&&(xo(r-i)Fo?Math.atan((Math.sin(e)*(a=Math.cos(n))*Math.sin(r)-Math.sin(n)*(i=Math.cos(e))*Math.sin(t))/(i*a*o)):(e+n)/2}function Ue(t,e,r,n){var i;if(null==t)i=r*Vo,n.point(-No,i),n.point(0,i),n.point(No,i),n.point(No,0),n.point(No,-i),n.point(0,-i),n.point(-No,-i),n.point(-No,0),n.point(-No,i);else if(xo(t[0]-e[0])>Fo){var a=t[0]=0?1:-1,M=w*_,k=M>No,A=p*b;if(Ms.add(Math.atan2(A*w*Math.sin(M),m*x+A*Math.cos(M))),a+=k?_+w*Bo:_,k^f>=r^g>=r){var T=be(ge(h),ge(t));we(T);var S=be(i,T);we(S);var E=(k^_>=0?-1:1)*nt(S[2]);(n>E||n===E&&(T[0]||T[1]))&&(o+=k^_>=0?1:-1)}if(!v++)break;f=g,p=b,m=x,h=t}}return(a<-Fo||aa}function r(t){var r,a,l,u,c;return{lineStart:function(){u=l=!1,c=1},point:function(h,f){var d,p=[h,f],m=e(h,f),v=o?m?0:i(h,f):m?i(h+(h<0?No:-No),f):0;if(!r&&(u=l=m)&&t.lineStart(),m!==l&&(d=n(r,p),(ke(r,d)||ke(p,d))&&(p[0]+=Fo,p[1]+=Fo,m=e(p[0],p[1]))),m!==l)c=0,m?(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&&o^m){var g;v&a||!(g=n(p,r,!0))||(c=0,o?(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])))}!m||r&&ke(r,p)||t.point(p[0],p[1]),r=p,l=m,a=v},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),o=[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=a*l/c,f=-a*u/c,d=be(o,s),p=_e(o,h);xe(p,_e(s,f));var m=d,v=ye(p,m),g=ye(m,m),y=v*v-g*(ye(p,p)-1);if(!(y<0)){var b=Math.sqrt(y),x=_e(m,(-v-b)/g);if(xe(x,p),x=Me(x),!r)return x;var _,w=t[0],M=e[0],k=t[1],A=e[1];M0^x[1]<(xo(x[0]-w)No^(w<=x[0]&&x[0]<=M)){var L=_e(m,(-v+b)/g);return xe(L,p),[x,Me(L)]}}}function i(e,r){var n=o?t:No-t,i=0;return e<-n?i|=1:e>n&&(i|=2),r<-n?i|=4:r>n&&(i|=8),i}var a=Math.cos(t),o=a>0,s=xo(a)>Fo;return Oe(e,r,vr(t,6*Ho),o?[0,-t]:[-No,t-No])}function qe(t,e,r,n){return function(i){var a,o=i.a,s=i.b,l=o.x,u=o.y,c=s.x,h=s.y,f=0,d=1,p=c-l,m=h-u;if(a=t-l,p||!(a>0)){if(a/=p,p<0){if(a0){if(a>d)return;a>f&&(f=a)}if(a=r-l,p||!(a<0)){if(a/=p,p<0){if(a>d)return;a>f&&(f=a)}else if(p>0){if(a0)){if(a/=m,m<0){if(a0){if(a>d)return;a>f&&(f=a)}if(a=n-u,m||!(a<0)){if(a/=m,m<0){if(a>d)return;a>f&&(f=a)}else if(m>0){if(a0&&(i.a={x:l+f*p,y:u+f*m}),d<1&&(i.b={x:l+d*p,y:u+d*m}),i}}}}}}function Ge(t,e,r,n){function i(n,i){return xo(n[0]-t)0?0:3:xo(n[0]-r)0?2:1:xo(n[1]-e)0?1:0:i>0?3:2}function a(t,e){return o(t.x,e.x)}function o(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=v.length,n=t[1],i=0;in&&et(u,a,t)>0&&++e:a[1]<=n&&et(u,a,t)<0&&--e,u=a;return 0!==e}function u(a,s,l,u){var c=0,h=0;if(null==a||(c=i(a,l))!==(h=i(s,l))||o(a,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,a){return t<=i&&i<=r&&e<=a&&a<=n}function h(t,e){c(t,e)&&s.point(t,e)}function f(){L.point=p,v&&v.push(g=[]),k=!0,M=!1,_=w=NaN}function d(){m&&(p(y,b),x&&M&&S.rejoin(),m.push(S.buffer())),L.point=h,M&&s.lineEnd()}function p(t,e){t=Math.max(-js,Math.min(js,t)),e=Math.max(-js,Math.min(js,e));var r=c(t,e);if(v&&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}};E(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,v,g,y,b,x,_,w,M,k,A,T=s,S=Fe(),E=qe(t,e,r,n),L={point:h,lineStart:f,lineEnd:d,polygonStart:function(){s=S,m=[],v=[],A=!0},polygonEnd:function(){s=T,m=uo.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&&Ie(m,a,e,u,s),s.polygonEnd()),m=v=g=null}};return L}}function Ye(t){var e=0,r=No/3,n=lr(t),i=n(e,r);return i.parallels=function(t){return arguments.length?n(e=t[0]*No/180,r=t[1]*No/180):[e/No*180,r/No*180]},i}function Xe(t,e){function r(t,e){var r=Math.sqrt(a-2*i*Math.sin(e))/i;return[r*Math.sin(t*=i),o-r*Math.cos(t)]}var n=Math.sin(t),i=(n+Math.sin(e))/2,a=1+n*(2*i-n),o=Math.sqrt(a)/i;return r.invert=function(t,e){var r=o-e;return[Math.atan2(t,r)/i,nt((a-(t*t+r*r)*i*i)/(2*i))]},r}function We(){function t(t,e){Bs+=i*t-n*e,n=t,i=e}var e,r,n,i;Gs.point=function(a,o){Gs.point=t,e=n=a,r=i=o},Gs.lineEnd=function(){t(e,r)}}function Ze(t,e){tHs&&(Hs=t),eqs&&(qs=e)}function Je(){function t(t,e){o.push("M",t,",",e,a)}function e(t,e){o.push("M",t,",",e),s.point=r}function r(t,e){o.push("L",t,",",e)}function n(){s.point=t}function i(){o.push("Z")}var a=Ke(4.5),o=[],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 a=Ke(t),s},result:function(){if(o.length){var t=o.join("");return o=[],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 Qe(t,e){Ss+=t,Es+=e,++Ls}function $e(){function t(t,n){var i=t-e,a=n-r,o=Math.sqrt(i*i+a*a);Cs+=o*(e+t)/2,zs+=o*(r+n)/2,Is+=o,Qe(e=t,r=n)}var e,r;Xs.point=function(n,i){Xs.point=t,Qe(e=n,r=i)}}function tr(){Xs.point=Qe}function er(){function t(t,e){var r=t-n,a=e-i,o=Math.sqrt(r*r+a*a);Cs+=o*(n+t)/2,zs+=o*(i+e)/2,Is+=o,o=i*t-n*e,Ds+=o*(n+t),Ps+=o*(i+e),Os+=3*o,Qe(n=t,i=e)}var e,r,n,i;Xs.point=function(a,o){Xs.point=t,Qe(e=n=a,r=i=o)},Xs.lineEnd=function(){t(e,r)}}function rr(t){function e(e,r){t.moveTo(e+o,r),t.arc(e,r,o,0,Bo)}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 a(){t.closePath()}var o=4.5,s={point:e,lineStart:function(){s.point=r},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 nr(t){function e(t){return(s?n:r)(t)}function r(e){return or(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=a,e.lineStart()}function a(r,n){var a=ge([r,n]),o=t(r,n);i(b,x,y,_,w,M,b=o[0],x=o[1],y=r,_=a[0],w=a[1],M=a[2],s,e),e.point(b,x)}function o(){k.point=r,e.lineEnd()}function l(){n(),k.point=u,k.lineEnd=c}function u(t,e){a(h=t,f=e),d=b,p=x,m=_,v=w,g=M,k.point=a}function c(){i(b,x,y,_,w,M,d,p,h,m,v,g,s,e),k.lineEnd=o,o()}var h,f,d,p,m,v,g,y,b,x,_,w,M,k={point:r,lineStart:n,lineEnd:o,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,m,v,g){var y=c-e,b=h-r,x=y*y+b*b;if(x>4*a&&v--){var _=s+d,w=l+p,M=u+m,k=Math.sqrt(_*_+w*w+M*M),A=Math.asin(M/=k),T=xo(xo(M)-1)a||xo((y*C+b*z)/x-.5)>.3||s*d+l*p+u*m0&&16,e):Math.sqrt(a)},e}function ir(t){var e=nr(function(e,r){return t([e*qo,r*qo])});return function(t){return ur(e(t))}}function ar(t){this.stream=t}function or(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]*Ho,t[1]*Ho),[t[0]*f+l,u-t[1]*f]}function r(t){return(t=s.invert((t[0]-l)/f,(u-t[1])/f))&&[t[0]*qo,t[1]*qo]}function n(){s=Ce(o=fr(g,y,b),a);var t=a(m,v);return l=d-t[0]*f,u=p+t[1]*f,i()}function i(){return c&&(c.valid=!1,c=null),e}var a,o,s,l,u,c,h=nr(function(t,e){return t=a(t,e),[t[0]*f+l,u-t[1]*f]}),f=150,d=480,p=250,m=0,v=0,g=0,y=0,b=0,_=Fs,w=x,M=null,k=null;return e.stream=function(t){return c&&(c.valid=!1),c=ur(_(o,h(w(t)))),c.valid=!0,c},e.clipAngle=function(t){return arguments.length?(_=null==t?(M=t,Fs):He((M=+t)*Ho),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]):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?(m=t[0]%360*Ho,v=t[1]%360*Ho,n()):[m*qo,v*qo]},e.rotate=function(t){return arguments.length?(g=t[0]%360*Ho,y=t[1]%360*Ho,b=t.length>2?t[2]%360*Ho:0,n()):[g*qo,y*qo,b*qo]},uo.rebind(e,h,"precision"),function(){return a=t.apply(this,arguments),e.invert=a.invert&&r,n()}}function ur(t){return or(t,function(e,r){t.point(e*Ho,r*Ho)})}function cr(t,e){return[t,e]}function hr(t,e){return[t>No?t-Bo:t<-No?t+Bo:t,e]}function fr(t,e,r){return t?e||r?Ce(pr(t),mr(e,r)):pr(t):e||r?mr(e,r):hr}function dr(t){return function(e,r){return e+=t,[e>No?e-Bo:e<-No?e+Bo:e,r]}}function pr(t){var e=dr(t);return e.invert=dr(-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*a-c*o,s*n-u*i),nt(c*a+l*o)]}var n=Math.cos(t),i=Math.sin(t),a=Math.cos(e),o=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*a-l*o;return[Math.atan2(l*a+u*o,s*n+c*i),nt(c*n-s*i)]},r}function vr(t,e){var r=Math.cos(t),n=Math.sin(t);return function(i,a,o,s){var l=o*e;null!=i?(i=gr(r,i),a=gr(r,a),(o>0?ia)&&(i+=o*Bo)):(i=t+o*Bo,a=t-.5*l);for(var u,c=i;o>0?c>a:c0?e<-Vo+Fo&&(e=-Vo+Fo):e>Vo-Fo&&(e=Vo-Fo);var r=o/Math.pow(i(e),a);return[r*Math.sin(a*t),o-r*Math.cos(a*t)]}var n=Math.cos(t),i=function(t){return Math.tan(No/4+t/2)},a=t===e?Math.sin(t):Math.log(n/Math.cos(e))/Math.log(i(e)/i(t)),o=n*Math.pow(i(t),a)/a;return a?(r.invert=function(t,e){var r=o-e,n=tt(a)*Math.sqrt(t*t+r*r);return[Math.atan2(t,r)/a,2*Math.atan(Math.pow(o/n,1/a))-Vo]},r):Sr}function Tr(t,e){function r(t,e){var r=a-e;return[r*Math.sin(i*t),a-r*Math.cos(i*t)]}var n=Math.cos(t),i=t===e?Math.sin(t):(n-Math.cos(e))/(e-t),a=n/i+t;return xo(i)1&&et(t[r[n-2]],t[r[n-1]],t[i])<=0;)--n;r[n++]=i}return r.slice(0,n)}function Dr(t,e){return t[0]-e[0]||t[1]-e[1]}function Pr(t,e,r){return(r[0]-e[0])*(t[1]-e[1])<(r[1]-e[1])*(t[0]-e[0])}function Or(t,e,r,n){var i=t[0],a=r[0],o=e[0]-i,s=n[0]-a,l=t[1],u=r[1],c=e[1]-l,h=n[1]-u,f=(s*(l-u)-h*(i-a))/(h*o-s*c);return[i+f*o,l+f*c]}function Rr(t){var e=t[0],r=t[t.length-1];return!(e[0]-r[0]||e[1]-r[1])}function Fr(){an(this),this.edge=this.site=this.circle=null}function jr(t){var e=sl.pop()||new Fr;return e.site=t,e}function Nr(t){Zr(t),il.remove(t),sl.push(t),an(t)}function Br(t){var e=t.circle,r=e.x,n=e.cy,i={x:r,y:n},a=t.P,o=t.N,s=[t];Nr(t);for(var l=a;l.circle&&xo(r-l.circle.x)Fo)s=s.L;else{if(!((i=a-Hr(s,o))>Fo)){n>-Fo?(e=s.P,r=s):i>-Fo?(e=s,r=s.N):e=r=s;break}if(!s.R){e=s;break}s=s.R}var l=jr(t);if(il.insert(e,l),e||r){if(e===r)return Zr(e),r=jr(e.site),il.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,d=t.y-h,p=r.site,m=p.x-c,v=p.y-h,g=2*(f*v-d*m),y=f*f+d*d,b=m*m+v*v,x={x:(v*y-d*b)/g+c,y:(f*b-m*y)/g+h};en(r.edge,u,p,x),l.edge=$r(u,t,null,x),r.edge=$r(t,p,null,x),Wr(e),Wr(r)}}function Vr(t,e){var r=t.site,n=r.x,i=r.y,a=i-e;if(!a)return n;var o=t.P;if(!o)return-1/0;r=o.site;var s=r.x,l=r.y,u=l-e;if(!u)return s;var c=s-n,h=1/a-1/u,f=c/u;return h?(-f+Math.sqrt(f*f-2*h*(c*c/(-2*u)-l+u/2+i-a/2)))/h+n:(n+s)/2}function Hr(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 qr(t){this.site=t,this.edges=[]}function Gr(t){for(var e,r,n,i,a,o,s,l,u,c,h=t[0][0],f=t[1][0],d=t[0][1],p=t[1][1],m=nl,v=m.length;v--;)if((a=m[v])&&a.prepare())for(s=a.edges,l=s.length,o=0;oFo||xo(i-r)>Fo)&&(s.splice(o,0,new rn(tn(a.site,c,xo(n-h)Fo?{x:h,y:xo(e-h)Fo?{x:xo(r-p)Fo?{x:f,y:xo(e-f)Fo?{x:xo(r-d)=-jo)){var d=l*l+u*u,p=c*c+h*h,m=(h*d-u*p)/f,v=(l*p-c*d)/f,h=v+s,g=ll.pop()||new Xr;g.arc=t,g.site=i,g.x=m+o,g.y=h+Math.sqrt(m*m+v*v),g.cy=h,t.circle=g;for(var y=null,b=ol._;b;)if(g.y=s)return;if(f>p){if(a){if(a.y>=u)return}else a={x:v,y:l};r={x:v,y:u}}else{if(a){if(a.y1)if(f>p){if(a){if(a.y>=u)return}else a={x:(l-i)/n,y:l};r={x:(u-i)/n,y:u}}else{if(a){if(a.y=s)return}else a={x:o,y:n*o+i};r={x:s,y:n*s+i}}else{if(a){if(a.xa||h>o||f=x,M=r>=_,k=M<<1|w,A=k+4;ka&&(i=e.slice(a,i),s[o]?s[o]+=i:s[++o]=i),(r=r[0])===(n=n[0])?s[o]?s[o]+=n:s[++o]=n:(s[++o]=null,l.push({i:o,x:bn(r,n)})),a=hl.lastIndex;return a=0&&!(r=uo.interpolators[n](t,e)););return r}function wn(t,e){var r,n=[],i=[],a=t.length,o=e.length,s=Math.min(t.length,e.length);for(r=0;r=1?1:t(e)}}function kn(t){return function(e){return 1-t(1-e)}}function An(t){return function(e){return.5*(e<.5?t(2*e):2-t(2-2*e))}}function Tn(t){return t*t}function Sn(t){return t*t*t}function En(t){if(t<=0)return 0;if(t>=1)return 1;var e=t*t,r=e*t;return 4*(t<.5?r:3*(t-e)+r-.75)}function Ln(t){return function(e){return Math.pow(e,t)}}function Cn(t){return 1-Math.cos(t*Vo)}function zn(t){return Math.pow(2,10*(t-1))}function In(t){return 1-Math.sqrt(1-t*t)}function Dn(t,e){var r;return arguments.length<2&&(e=.45),arguments.length?r=e/Bo*Math.asin(1/t):(t=1,r=e/4),function(n){return 1+t*Math.pow(2,-10*n)*Math.sin((n-r)*Bo/e)}}function Pn(t){return t||(t=1.70158),function(e){return e*e*((t+1)*e-t)}}function On(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375}function Rn(t,e){t=uo.hcl(t),e=uo.hcl(e);var r=t.h,n=t.c,i=t.l,a=e.h-r,o=e.c-n,s=e.l-i;return isNaN(o)&&(o=0,n=isNaN(n)?e.c:n),isNaN(a)?(a=0,r=isNaN(r)?e.h:r):a>180?a-=360:a<-180&&(a+=360),function(t){return ft(r+a*t,n+o*t,i+s*t)+""}}function Fn(t,e){t=uo.hsl(t),e=uo.hsl(e);var r=t.h,n=t.s,i=t.l,a=e.h-r,o=e.s-n,s=e.l-i;return isNaN(o)&&(o=0,n=isNaN(n)?e.s:n),isNaN(a)?(a=0,r=isNaN(r)?e.h:r):a>180?a-=360:a<-180&&(a+=360),function(t){return ct(r+a*t,n+o*t,i+s*t)+""}}function jn(t,e){t=uo.lab(t),e=uo.lab(e);var r=t.l,n=t.a,i=t.b,a=e.l-r,o=e.a-n,s=e.b-i;return function(t){return pt(r+a*t,n+o*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),a=Vn(Hn(r,e,-i))||0;e[0]*r[1]180?e+=360:e-t>180&&(t+=360),n.push({i:r.push(qn(r)+"rotate(",null,")")-2,x:bn(t,e)})):e&&r.push(qn(r)+"rotate("+e+")")}function Xn(t,e,r,n){t!==e?n.push({i:r.push(qn(r)+"skewX(",null,")")-2,x:bn(t,e)}):e&&r.push(qn(r)+"skewX("+e+")")}function Wn(t,e,r,n){if(t[0]!==e[0]||t[1]!==e[1]){var i=r.push(qn(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(qn(r)+"scale("+e+")")}function Zn(t,e){var r=[],n=[];return t=uo.transform(t),e=uo.transform(e),Gn(t.translate,e.translate,r,n),Yn(t.rotate,e.rotate,r,n),Xn(t.skew,e.skew,r,n),Wn(t.scale,e.scale,r,n),t=e=null,function(t){for(var e,i=-1,a=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),(a=t.children)&&(i=a.length))for(var i,a,o=-1;++oi&&(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,a=[];++r<=e;)a[r]=i*r+n;return a}function Mi(t){return[uo.min(t),uo.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 Si(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 Ei(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,a,o,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(a=r[2],Ii(n,i,a),e(a),Ai(n,a),n._pack_prev=a,Ai(a,i),i=n._pack_next,o=3;o=0;)e=i[a],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+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 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 Hi(t){return{x:t.x,y:t.y,dx:t.dx,dy:t.dy}}function qi(t,e){var r=t.x+e[3],n=t.y+e[0],i=t.dx-e[1]-e[3],a=t.dy-e[0]-e[2];return i<0&&(r+=i/2,i=0),a<0&&(n+=a/2,a=0),{x:r,y:n,dx:i,dy:a}}function Gi(t){var e=t[0],r=t[t.length-1];return e2?Ji:Xi,l=n?Kn:Jn;return o=i(t,e,l,r),s=i(e,t,l,_n),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(Nn)},a.clamp=function(t){return arguments.length?(n=t,i()):n},a.interpolate=function(t){return arguments.length?(r=t,i()):r},a.ticks=function(e){return ea(t,e)},a.tickFormat=function(e,r){return ra(t,e,r)},a.nice=function(e){return $i(t,e),i()},a.copy=function(){return Ki(t,e,r,n)},i()}function Qi(t,e){return uo.rebind(t,e,"range","rangeRound","interpolate","clamp")}function $i(t,e){return Wi(t,Zi(ta(t,e)[2])),Wi(t,Zi(ta(t,e)[2])),t}function ta(t,e){null==e&&(e=10);var r=Gi(t),n=r[1]-r[0],i=Math.pow(10,Math.floor(Math.log(n/e)/Math.LN10)),a=e/n*i;return a<=.15?i*=10:a<=.35?i*=5:a<=.75&&(i*=2),r[0]=Math.ceil(r[0]/i)*i,r[1]=Math.floor(r[1]/i)*i+.5*i,r[2]=i,r}function ea(t,e){return uo.range.apply(uo,ta(t,e))}function ra(t,e,r){var n=ta(t,e);if(r){var i=cs.exec(r);if(i.shift(),"s"===i[8]){var a=uo.formatPrefix(Math.max(xo(n[0]),xo(n[1])));return i[7]||(i[7]="."+na(a.scale(n[2]))),i[8]="f",r=uo.format(i.join("")),function(t){return r(a.scale(t))+a.symbol}}i[7]||(i[7]="."+ia(i[8],n)),r=i.join("")}else r=",."+na(n[2])+"f";return uo.format(r)}function na(t){return-Math.floor(Math.log(t)/Math.LN10+.01)}function ia(t,e){var r=na(e[2]);return t in Ml?Math.abs(r-na(Math.max(xo(e[0]),xo(e[1]))))+ +("e"!==t):r-2*("%"===t)}function aa(t,e,r,n){function i(t){return(r?Math.log(t<0?0:t):-Math.log(t>0?0:-t))/Math.log(e)}function a(t){return r?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?(r=e[0]>=0,t.domain((n=e.map(Number)).map(i)),o):n},o.base=function(r){return arguments.length?(e=+r,t.domain(n.map(i)),o):e},o.nice=function(){var e=Wi(n.map(i),r?Math:Al);return t.domain(e),n=e.map(a),o},o.ticks=function(){var t=Gi(n),o=[],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(;u0;f--)o.push(a(u)*f);for(u=0;o[u]l;c--);o=o.slice(u,c)}return o},o.tickFormat=function(t,r){if(!arguments.length)return kl;arguments.length<2?r=kl:"function"!=typeof r&&(r=uo.format(r));var n=Math.max(1,e*t/o.ticks().length);return function(t){var o=t/a(Math.round(i(t)));return o*e0?s[r-1]:t[0],r0?0:1}function xa(t,e,r,n,i){var a=t[0]-e[0],o=t[1]-e[1],s=(i?n:-n)/Math.sqrt(a*a+o*o),l=s*o,u=-s*a,c=t[0]+l,h=t[1]+u,f=e[0]+l,d=e[1]+u,p=(c+f)/2,m=(h+d)/2,v=f-c,g=d-h,y=v*v+g*g,b=r-n,x=c*d-f*h,_=(g<0?-1:1)*Math.sqrt(Math.max(0,b*b*y-x*x)),w=(x*g-v*_)/y,M=(-x*v-g*_)/y,k=(x*g+v*_)/y,A=(-x*v+g*_)/y,T=w-p,S=M-m,E=k-p,L=A-m;return T*T+S*S>E*E+L*L&&(w=k,M=A),[[w-l,M-u],[w*r/b,M*r/b]]}function _a(t){function e(e){function o(){u.push("M",a(t(c),s))}for(var l,u=[],c=[],h=-1,f=e.length,d=Et(r),p=Et(n);++h1?t.join("L"):t+"Z"}function Ma(t){return t.join("L")+"Z"}function ka(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 Aa(t){for(var e=0,r=t.length,n=t[0],i=[n[0],",",n[1]];++e1){s=e[1],a=t[l],l++,n+="C"+(i[0]+o[0])+","+(i[1]+o[1])+","+(a[0]-s[0])+","+(a[1]-s[1])+","+a[0]+","+a[1];for(var u=2;u9&&(i=3*e/Math.sqrt(i),o[s]=i*r,o[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+o[s]*o[s])),a.push([i||0,o[s]*i||0]);return a}function Ua(t){return t.length<3?wa(t):t[0]+Ca(t,Ba(t))}function Va(t){for(var e,r,n,i=-1,a=t.length;++i0;)d[--s].call(t,o);if(a>=1)return m.event&&m.event.end.call(t,t.__data__,e),--p.count?delete p[n]:delete t[r],1}var l,u,c,f,d,p=t[r]||(t[r]={active:0,count:0}),m=p[n];m||(l=i.time,u=Dt(a,0,l),m=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 ro(t,e,r){t.attr("transform",function(t){var n=e(t);return"translate("+(isFinite(n)?n:r(t))+",0)"})}function no(t,e,r){t.attr("transform",function(t){var n=e(t);return"translate(0,"+(isFinite(n)?n:r(t))+")"})}function io(t){return t.toISOString()}function ao(t,e,r){function n(e){return t(e)}function i(t,r){var n=t[1]-t[0],i=n/r,a=uo.bisect(Jl,i);return a==Jl.length?[e.year,ta(t.map(function(t){return t/31536e6}),r)[2]]:a?e[i/Jl[a-1]1?{floor:function(e){for(;r(e=t.floor(e));)e=oo(e-1);return e},ceil:function(e){for(;r(e=t.ceil(e));)e=oo(+e+1);return e}}:t))},n.ticks=function(t,e){var r=Gi(n.domain()),a=null==t?i(r,10):"number"==typeof t?i(r,t):!t.range&&[{range:t},e];return a&&(t=a[0],e=a[1]),t.range(r[0],oo(+r[1]+1),e<1?1:e)},n.tickFormat=function(){return r},n.copy=function(){return ao(t.copy(),e,r)},Qi(n,t)}function oo(t){return new Date(t)}function so(t){return JSON.parse(t.responseText)}function lo(t){var e=fo.createRange();return e.selectNode(fo.body),e.createContextualFragment(t.responseText)}var uo={version:"3.5.17"},co=[].slice,ho=function(t){return co.call(t)},fo=this.document;if(fo)try{ho(fo.documentElement.childNodes)[0].nodeType}catch(t){ho=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}),fo)try{fo.createElement("DIV").style.setProperty("opacity",0,"")}catch(t){var po=this.Element.prototype,mo=po.setAttribute,vo=po.setAttributeNS,go=this.CSSStyleDeclaration.prototype,yo=go.setProperty;po.setAttribute=function(t,e){mo.call(this,t,e+"")},po.setAttributeNS=function(t,e,r){vo.call(this,t,e,r+"")},go.setProperty=function(t,e,r){yo.call(this,t,e+"",r)}}uo.ascending=i,uo.descending=function(t,e){return et?1:e>=t?0:NaN},uo.min=function(t,e){var r,n,i=-1,a=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},uo.max=function(t,e){var r,n,i=-1,a=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},uo.extent=function(t,e){var r,n,i,a=-1,o=t.length;if(1===arguments.length){for(;++a=n){r=i=n;break}for(;++an&&(r=n),i=n){r=i=n;break}for(;++an&&(r=n),i1)return l/(c-1)},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,r){return i(t(e),r)}:t)},uo.shuffle=function(t,e,r){(a=arguments.length)<3&&(r=t.length,a<2&&(e=0));for(var n,i,a=r-e;a;)i=Math.random()*a--|0,n=t[a+e],t[a+e]=t[i+e],t[i+e]=n;return t},uo.permute=function(t,e){for(var r=e.length,n=new Array(r);r--;)n[r]=t[e[r]];return n},uo.pairs=function(t){for(var e=0,r=t.length-1,n=t[0],i=new Array(r<0?0:r);e=0;)for(n=t[i],e=n.length;--e>=0;)r[--o]=n[e];return r};var xo=Math.abs;uo.range=function(t,e,r){if(arguments.length<3&&(r=1,arguments.length<2&&(e=t,t=0)),(e-t)/r==1/0)throw new Error("infinite range");var n,i=[],a=u(xo(r)),o=-1;if(t*=a,e*=a,r*=a,r<0)for(;(n=t+r*++o)>e;)i.push(n/a);else for(;(n=t+r*++o)=a.length)return n?n.call(i,o):r?o.sort(r):o;for(var l,u,c,f,d=-1,p=o.length,m=a[s++],v=new h;++d=a.length)return t;var n=[],i=o[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={},a=[],o=[];return i.map=function(e,r){return t(r,e,0)},i.entries=function(r){return e(t(uo.map,r,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 r=t,i},i.rollup=function(t){return n=t,i},i},uo.set=function(t){var e=new b;if(t)for(var r=0,n=t.length;r=0&&(n=t.slice(r+1), +t=t.slice(0,r)),t)return arguments.length<2?this[t].on(n):this[t].on(n,e);if(2===arguments.length){if(null==e)for(t in this)this.hasOwnProperty(t)&&this[t].on(n,null);return this}},uo.event=null,uo.requote=function(t){return t.replace(ko,"\\$&")};var ko=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,Ao={}.__proto__?function(t,e){t.__proto__=e}:function(t,e){for(var r in e)t[r]=e[r]},To=function(t,e){return e.querySelector(t)},So=function(t,e){return e.querySelectorAll(t)},Eo=function(t,e){var r=t.matches||t[w(t,"matchesSelector")];return(Eo=function(t,e){return r.call(t,e)})(t,e)};"function"==typeof Sizzle&&(To=function(t,e){return Sizzle(t,e)[0]||null},So=Sizzle,Eo=Sizzle.matchesSelector),uo.selection=function(){return uo.select(fo.documentElement)};var Lo=uo.selection.prototype=[];Lo.select=function(t){var e,r,n,i,a=[];t=C(t);for(var o=-1,s=this.length;++o=0&&"xmlns"!==(r=t.slice(0,e))&&(t=t.slice(e+1)),zo.hasOwnProperty(r)?{space:zo[r],local:t}:t}},Lo.attr=function(t,e){if(arguments.length<2){if("string"==typeof t){var r=this.node();return t=uo.ns.qualify(t),t.local?r.getAttributeNS(t.space,t.local):r.getAttribute(t)}for(e in t)this.each(I(e,t[e]));return this}return this.each(I(t,e))},Lo.classed=function(t,e){if(arguments.length<2){if("string"==typeof t){var r=this.node(),n=(t=O(t)).length,i=-1;if(e=r.classList){for(;++i=0;)(r=n[i])&&(a&&a!==r.nextSibling&&a.parentNode.insertBefore(r,a),a=r);return this},Lo.sort=function(t){t=q.apply(this,arguments);for(var e=-1,r=this.length;++e0&&(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){C++||t({type:"zoomstart"})}function u(t){s(),t({type:"zoom",scale:k.k,translate:[k.x,k.y]})}function c(t){--C||(t({type:"zoomend"}),v=null)}function h(){function t(){s=1,a(uo.mouse(i),f),u(o)}function r(){h.on(I,null).on(D,null),d(s),c(o)}var i=this,o=O.of(i,arguments),s=0,h=uo.select(n(i)).on(I,t).on(D,r),f=e(uo.mouse(i)),d=K(i);Bl.call(i),l(o)}function f(){function t(){var t=uo.touches(p);return d=k.k,t.forEach(function(t){t.identifier in v&&(v[t.identifier]=e(t))}),t}function r(){var e=uo.event.target;uo.select(e).on(x,n).on(_,s),w.push(e);for(var r=uo.event.changedTouches,i=0,a=r.length;i1){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,o=uo.touches(p);Bl.call(p);for(var s=0,l=o.length;s=u)return o;if(i)return i=!1,a;var e=c;if(34===t.charCodeAt(e)){for(var r=e;r++=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i,hs=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,Ft(t,e))).toFixed(Math.max(0,Math.min(20,Ft(t*(1+1e-15),e))))}}),fs=uo.time={},ds=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(){ps.setUTCDate.apply(this._,arguments)},setDay:function(){ps.setUTCDay.apply(this._,arguments)},setFullYear:function(){ps.setUTCFullYear.apply(this._,arguments)},setHours:function(){ps.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){ps.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){ps.setUTCMinutes.apply(this._,arguments)},setMonth:function(){ps.setUTCMonth.apply(this._,arguments)},setSeconds:function(){ps.setUTCSeconds.apply(this._,arguments)},setTime:function(){ps.setTime.apply(this._,arguments)}};var ps=Date.prototype;fs.year=Vt(function(t){return t=fs.day(t),t.setMonth(0,1),t},function(t,e){t.setFullYear(t.getFullYear()+e)},function(t){return t.getFullYear()}),fs.years=fs.year.range,fs.years.utc=fs.year.utc.range,fs.day=Vt(function(t){var e=new ds(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}),fs.days=fs.day.range,fs.days.utc=fs.day.utc.range,fs.dayOfYear=function(t){var e=fs.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=fs[t]=Vt(function(t){return(t=fs.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=fs.year(t).getDay();return Math.floor((fs.dayOfYear(t)+(r+e)%7)/7)-(r!==e)});fs[t+"s"]=r.range,fs[t+"s"].utc=r.utc.range,fs[t+"OfYear"]=function(t){var r=fs.year(t).getDay();return Math.floor((fs.dayOfYear(t)+(r+e)%7)/7)}}),fs.week=fs.sunday,fs.weeks=fs.sunday.range,fs.weeks.utc=fs.sunday.utc.range,fs.weekOfYear=fs.sundayOfYear;var ms={"-":"",_:" ",0:"0"},vs=/^\s*\d+/,gs=/^%/;uo.locale=function(t){return{numberFormat:Nt(t),timeFormat:qt(t)}};var ys=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=ys.numberFormat,uo.geo={},he.prototype={s:0,t:0,add:function(t){fe(t,this.t,bs),fe(bs.s,this.s,this),this.s?this.t+=bs.t:this.s=bs.t},reset:function(){this.s=this.t=0},valueOf:function(){return this.s}};var bs=new he;uo.geo.stream=function(t,e){t&&xs.hasOwnProperty(t.type)?xs[t.type](t,e):de(t,e)};var xs={Feature:function(t,e){de(t.geometry,e)},FeatureCollection:function(t,e){for(var r=t.features,n=-1,i=r.length;++nd&&(d=e)}function e(e,r){var n=ge([e*Ho,r*Ho]);if(g){var i=be(g,n),a=[i[1],-i[0],0],o=be(a,i);we(o),o=Me(o);var l=e-p,u=l>0?1:-1,m=o[0]*qo*u,v=xo(l)>180;if(v^(u*pd&&(d=y)}else if(m=(m+360)%360-180,v^(u*pd&&(d=r);v?es(c,f)&&(f=e):s(e,f)>s(c,f)&&(c=e):f>=c?(ef&&(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+=xo(n)>180?n+(n>0?360:-360):n}else m=t,v=r;ks.point(t,r),e(t,r)}function a(){ks.lineStart()}function o(){i(m,v),ks.lineEnd(),xo(y)>Fo&&(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]:tFo?d=90:y<-Fo&&(h=-90),x[0]=c,x[1]=f}};return function(t){d=f=-(c=h=1/0),b=[],uo.geo.stream(t,_);var e=b.length;if(e){b.sort(l);for(var r,n=1,i=b[0],a=[i];ns(i[0],i[1])&&(i[1]=r[1]),s(r[0],i[1])>s(i[0],i[1])&&(i[0]=r[0])):a.push(i=r);for(var o,r,p=-1/0,e=a.length-1,n=0,i=a[e];n<=e;i=r,++n)r=a[n],(o=s(i[1],r[0]))>p&&(p=o,c=r[0],f=i[1])}return b=x=null,c===1/0||h===1/0?[[NaN,NaN],[NaN,NaN]]:[[c,h],[f,d]]}}(),uo.geo.centroid=function(t){As=Ts=Ss=Es=Ls=Cs=zs=Is=Ds=Ps=Os=0,uo.geo.stream(t,Rs);var e=Ds,r=Ps,n=Os,i=e*e+r*r+n*n;return i=.12&&i<.234&&n>=-.425&&n<-.214?o:i>=.166&&i<.234&&n>=-.214&&n<-.115?s:a).invert(t)},t.stream=function(t){var e=a.stream(t),r=o.stream(t),n=s.stream(t);return{point:function(t,i){e.point(t,i),r.point(t,i),n.point(t,i)},sphere:function(){e.sphere(),r.sphere(),n.sphere()},lineStart:function(){e.lineStart(),r.lineStart(),n.lineStart()},lineEnd:function(){e.lineEnd(),r.lineEnd(),n.lineEnd()},polygonStart:function(){e.polygonStart(),r.polygonStart(),n.polygonStart()},polygonEnd:function(){e.polygonEnd(),r.polygonEnd(),n.polygonEnd()}}},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],h=+e[1];return r=a.translate(e).clipExtent([[c-.455*u,h-.238*u],[c+.455*u,h+.238*u]]).stream(l).point,n=o.translate([c-.307*u,h+.201*u]).clipExtent([[c-.425*u+Fo,h+.12*u+Fo],[c-.214*u-Fo,h+.234*u-Fo]]).stream(l).point,i=s.translate([c-.205*u,h+.212*u]).clipExtent([[c-.214*u+Fo,h+.166*u+Fo],[c-.115*u-Fo,h+.234*u-Fo]]).stream(l).point,t},t.scale(1070)};var Ns,Bs,Us,Vs,Hs,qs,Gs={point:M,lineStart:M,lineEnd:M,polygonStart:function(){Bs=0,Gs.lineStart=We},polygonEnd:function(){Gs.lineStart=Gs.lineEnd=Gs.point=M,Ns+=xo(Bs/2)}},Ys={point:Ze,lineStart:M,lineEnd:M,polygonStart:M,polygonEnd:M},Xs={point:Qe,lineStart:$e,lineEnd:tr,polygonStart:function(){Xs.lineStart=er},polygonEnd:function(){Xs.point=Qe,Xs.lineStart=$e,Xs.lineEnd=tr}};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 r,n,i,a,o,s=4.5;return t.area=function(t){return Ns=0,uo.geo.stream(t,i(Gs)),Ns},t.centroid=function(t){return Ss=Es=Ls=Cs=zs=Is=Ds=Ps=Os=0,uo.geo.stream(t,i(Xs)),Os?[Ds/Os,Ps/Os]:Is?[Cs/Is,zs/Is]:Ls?[Ss/Ls,Es/Ls]:[NaN,NaN]},t.bounds=function(t){return Hs=qs=-(Us=Vs=1/0),uo.geo.stream(t,i(Ys)),[[Us,Vs],[Hs,qs]]},t.projection=function(t){return arguments.length?(i=(r=t)?t.stream||ir(t):x,e()):r},t.context=function(t){return arguments.length?(a=null==(n=t)?new Je:new rr(t),"function"!=typeof s&&a.pointRadius(s),e()):n},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 r=new ar(e);for(var n in t)r[n]=t[n];return r}}},ar.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=sr,uo.geo.projectionMutator=lr,(uo.geo.equirectangular=function(){return sr(cr)}).raw=cr.invert=cr,uo.geo.rotation=function(t){function e(e){return e=t(e[0]*Ho,e[1]*Ho),e[0]*=qo,e[1]*=qo,e}return t=fr(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]*=qo,e[1]*=qo,e},e},hr.invert=cr,uo.geo.circle=function(){function t(){var t="function"==typeof n?n.apply(this,arguments):n,e=fr(-t[0]*Ho,-t[1]*Ho,0).invert,i=[];return r(null,null,1,{point:function(t,r){i.push(t=e(t,r)),t[0]*=qo,t[1]*=qo}}),{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=vr((e=+n)*Ho,i*Ho),t):e},t.precision=function(n){return arguments.length?(r=vr(e*Ho,(i=+n)*Ho),t):i},t.angle(90)},uo.geo.distance=function(t,e){var r,n=(e[0]-t[0])*Ho,i=t[1]*Ho,a=e[1]*Ho,o=Math.sin(n),s=Math.cos(n),l=Math.sin(i),u=Math.cos(i),c=Math.sin(a),h=Math.cos(a);return Math.atan2(Math.sqrt((r=h*o)*r+(r=u*c-l*h*s)*r),l*c+u*h*s)},uo.geo.graticule=function(){function t(){return{type:"MultiLineString",coordinates:e()}}function e(){return uo.range(Math.ceil(a/v)*v,i,v).map(f).concat(uo.range(Math.ceil(u/g)*g,l,g).map(d)).concat(uo.range(Math.ceil(n/p)*p,r,p).filter(function(t){return xo(t%v)>Fo}).map(c)).concat(uo.range(Math.ceil(s/m)*m,o,m).filter(function(t){return xo(t%g)>Fo}).map(h))}var r,n,i,a,o,s,l,u,c,h,f,d,p=10,m=p,v=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(a).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?(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?(n=+e[0][0],r=+e[1][0],s=+e[0][1],o=+e[1][1],n>r&&(e=n,n=r,r=e),s>o&&(e=s,s=o,o=e),t.precision(y)):[[n,s],[r,o]]},t.step=function(e){return arguments.length?t.majorStep(e).minorStep(e):t.minorStep()},t.majorStep=function(e){return arguments.length?(v=+e[0],g=+e[1],t):[v,g]},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=yr(s,o,90),h=br(n,r,y),f=yr(u,l,90),d=br(a,i,y),t):y},t.majorExtent([[-180,-90+Fo],[180,90-Fo]]).minorExtent([[-180,-80-Fo],[180,80+Fo]])},uo.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 uo.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},uo.geo.interpolate=function(t,e){return wr(t[0]*Ho,t[1]*Ho,e[0]*Ho,e[1]*Ho)},uo.geo.length=function(t){return Ws=0,uo.geo.stream(t,Zs),Ws};var Ws,Zs={sphere:M,point:M,lineStart:Mr,lineEnd:M,polygonStart:M,polygonEnd:M},Js=kr(function(t){return Math.sqrt(2/(1+t))},function(t){return 2*Math.asin(t/2)});(uo.geo.azimuthalEqualArea=function(){return sr(Js)}).raw=Js;var Ks=kr(function(t){var e=Math.acos(t);return e&&e/Math.sin(e)},x);(uo.geo.azimuthalEquidistant=function(){return sr(Ks)}).raw=Ks,(uo.geo.conicConformal=function(){return Ye(Ar)}).raw=Ar,(uo.geo.conicEquidistant=function(){return Ye(Tr)}).raw=Tr;var Qs=kr(function(t){return 1/t},Math.atan);(uo.geo.gnomonic=function(){return sr(Qs)}).raw=Qs,Sr.invert=function(t,e){return[t,2*Math.atan(Math.exp(e))-Vo]},(uo.geo.mercator=function(){return Er(Sr)}).raw=Sr;var $s=kr(function(){return 1},Math.asin);(uo.geo.orthographic=function(){return sr($s)}).raw=$s;var tl=kr(function(t){return 1/(1+t)},function(t){return 2*Math.atan(t)});(uo.geo.stereographic=function(){return sr(tl)}).raw=tl,Lr.invert=function(t,e){return[-e,2*Math.atan(Math.exp(t))-Vo]},(uo.geo.transverseMercator=function(){var t=Er(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,uo.geom={},uo.geom.hull=function(t){function e(t){if(t.length<3)return[];var e,i=Et(r),a=Et(n),o=t.length,s=[],l=[];for(e=0;e=0;--e)d.push(t[s[u[e]][2]]);for(e=+h;e=n&&u.x<=a&&u.y>=i&&u.y<=o?[[n,o],[a,o],[a,i],[n,i]]:[]).point=t[s]}),e}function r(t){return t.map(function(t,e){return{x:Math.round(a(t,e)/Fo)*Fo,y:Math.round(o(t,e)/Fo)*Fo,i:e}})}var n=Cr,i=zr,a=n,o=i,s=ul;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,a=r.site,o=r.edges.sort(Yr),s=-1,l=o.length,u=o[l-1].edge,c=u.l===a?u.r:u.l;++s=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?o=c:l=c,a(t,e,r,n,i,o,s,l)}var c,h,f,d,p,m,v,g,y,b=Et(s),x=Et(l);if(null!=e)m=e,v=r,g=n,y=i;else if(g=y=-(m=v=1/0),h=[],f=[],p=t.length,o)for(d=0;dg&&(g=c.x),c.y>y&&(y=c.y),h.push(c.x),f.push(c.y);else for(d=0;dg&&(g=_),w>y&&(y=w),h.push(_),f.push(w)}var M=g-m,k=y-v;M>k?y=v+M:g=m+k;var A=pn();if(A.add=function(t){a(A,t,+b(t,++d),+x(t,d),m,v,g,y)},A.visit=function(t){mn(t,A,m,v,g,y)},A.find=function(t){return vn(A,t[0],t[1],m,v,g,y)},d=-1,null==e){for(;++d=0?t.slice(0,e):t,n=e>=0?t.slice(e+1):"in";return r=dl.get(r)||fl,n=pl.get(n)||x,Mn(n(r.apply(null,co.call(arguments,1))))},uo.interpolateHcl=Rn,uo.interpolateHsl=Fn,uo.interpolateLab=jn,uo.interpolateRound=Nn,uo.transform=function(t){var e=fo.createElementNS(uo.ns.prefix.svg,"g");return(uo.transform=function(t){if(null!=t){e.setAttribute("transform",t);var r=e.transform.baseVal.consolidate()}return new Bn(r?r.matrix:ml)})(t)},Bn.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var ml={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;++r0?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=Dt(l.tick)),l):i},l.start=function(){function t(t,n){if(!r){for(r=new Array(i),l=0;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=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},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;++us&&(s=n),o.push(n)}for(r=0;r0)for(a=-1;++a=c[0]&&s<=c[1]&&(o=l[uo.bisect(h,s,1,d)-1],o.y+=p,o.push(t[a]));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=Et(e),t):n},t.bins=function(e){return arguments.length?(i="number"==typeof e?function(t){return wi(t,e)}:Et(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,Ei),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,Ei),li(s,function(t){t.r-=h})}return zi(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),h=c[0],f=e(h);if(li(f,r),f.parent.m=-f.z,si(f,n),u)si(h,a);else{var d=h,p=h,m=h;si(h,function(t){t.xp.x&&(p=t),t.depth>m.depth&&(m=t)});var v=s(d,p)/2-d.x,g=l[0]/(p.x+s(p,d)/2+v),y=l[1]/(m.depth||1);si(h,function(t){t.x=(t.x+v)*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,a=e.children,o=0,s=a.length;o0&&(Ri(ji(o,t,r),t,n),u+=n,c+=n),h+=o.m,u+=i.m,f+=l.m,c+=a.m;o&&!Oi(a)&&(a.t=o,a.m+=h-c),i&&!Pi(l)&&(l.t=i,l.m+=u-f,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=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)?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=Ni(e)):(t.x=o?u+=r(t,o):0,t.y=0,o=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=uo.layout.hierarchy().sort(null).value(null),r=Di,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;++i0;)c.push(o=f[l-1]),c.area+=o.area,"squarify"!==d||(s=n(c,m))<=p?(f.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 r(e){var n=e.children;if(n&&n.length){var a,o=h(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;++oi&&(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);++a1);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;rh?0:1;if(u=Uo)return e(u,d)+(t?e(t,1-d):"")+"Z";var p,m,v,g,y,b,x,_,w,M,k,A,T=0,S=0,E=[];if((g=(+l.apply(this,arguments)||0)/2)&&(v=a===Cl?Math.sqrt(t*t+u*u):+a.apply(this,arguments),d||(S*=-1),u&&(S=nt(v/u*Math.sin(g))),t&&(T=nt(v/t*Math.sin(g)))),u){y=u*Math.cos(c+S),b=u*Math.sin(c+S),x=u*Math.cos(h-S),_=u*Math.sin(h-S);var L=Math.abs(h-c-2*S)<=No?0:1;if(S&&ba(y,b,x,_)===d^L){var C=(c+h)/2;y=u*Math.cos(C),b=u*Math.sin(C),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 z=Math.abs(c-h+2*T)<=No?0:1;if(T&&ba(w,M,k,A)===1-d^z){var I=(c+h)/2;w=t*Math.cos(I),M=t*Math.sin(I),k=A=null}}else w=M=0;if(f>Fo&&(p=Math.min(Math.abs(u-t)/2,+i.apply(this,arguments)))>.001){m=tNo)+",1 "+e}function i(t,e,r,n){return"Q 0,0 "+n}var a=xr,o=_r,s=qa,l=va,u=ga;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=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=Et(r),t):e},t.target=function(e){return arguments.length?(r=Et(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(Ya(e=t)):e},t},uo.svg.symbol=function(){function t(t,n){return(Ol.get(e.call(this,t,n))||Za)(r.call(this,t,n))}var e=Wa,r=Xa;return t.type=function(r){return arguments.length?(e=Et(r),t):e},t.size=function(e){return arguments.length?(r=Et(e),t):r},t};var Ol=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*Fl)),r=e*Fl;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/Rl),r=e*Rl/2;return"M0,"+r+"L"+e+","+-r+" "+-e+","+-r+"Z"},"triangle-up":function(t){var e=Math.sqrt(t/Rl),r=e*Rl/2;return"M0,"+-r+"L"+e+","+r+" "+-e+","+r+"Z"}});uo.svg.symbolTypes=Ol.keys();var Rl=Math.sqrt(3),Fl=Math.tan(30*Ho);Lo.transition=function(t){for(var e,r,n=jl||++Vl,i=to(t),a=[],o=Nl||{time:Date.now(),ease:En,delay:0,duration:250},s=-1,l=this.length;++srect,.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 a(){function a(){32==uo.event.keyCode&&(L||(b=null,z[0]-=h[1],z[1]-=f[1],L=2),T())}function m(){32==uo.event.keyCode&&2==L&&(z[0]+=h[1],z[1]+=f[1],L=0,T())}function v(){var t=uo.mouse(_),n=!1;x&&(t[0]+=x[0],t[1]+=x[1]),L||(uo.event.altKey?(b||(b=[(h[0]+h[1])/2,(f[0]+f[1])/2]),z[0]=h[+(t[0]=2)return!1;t[r]=n}return!0}):w.filter(function(t){for(var e=0;e<=o;++e){var r=y[t[e]];if(r<0)return!1;t[e]=r}return!0}),1&o)for(var h=0;h>>31},e.exports.exponent=function(t){return(e.exports.hi(t)<<1>>>21)-1023},e.exports.fraction=function(t){var r=e.exports.lo(t),n=e.exports.hi(t),i=1048575&n;return 2146435072&n&&(i+=1<<20),[r,i]},e.exports.denormalized=function(t){return!(2146435072&e.exports.hi(t))}}).call(this,t("buffer").Buffer)},{buffer:75}],123:[function(t,e,r){"use strict";function n(t,e,r){var i=0|t[r];if(i<=0)return[];var a,o=new Array(i);if(r===t.length-1)for(a=0;a0)return i(0|t,e);break;case"object":if("number"==typeof t.length)return n(t,e,0)}return[]}e.exports=a},{}],124:[function(t,e,r){"use strict";function n(t,e,r){r=r||2;var n=e&&e.length,a=n?e[0]*r:t.length,s=i(t,0,a,r,!0),l=[];if(!s)return l;var u,c,f,d,p,m,v;if(n&&(s=h(t,e,s,r)),t.length>80*r){u=f=t[0],c=d=t[1];for(var g=r;gf&&(f=p),m>d&&(d=m);v=Math.max(f-u,d-c)}return o(s,l,r,u,c,v),l}function i(t,e,r,n,i){var a,o;if(i===z(t,e,r,n)>0)for(a=e;a=e;a-=n)o=E(a,t[a],t[a+1],o);return o&&w(o,o.next)&&(L(o),o=o.next),o}function a(t,e){if(!t)return t;e||(e=t);var r,n=t;do{if(r=!1,n.steiner||!w(n,n.next)&&0!==_(n.prev,n,n.next))n=n.next;else{if(L(n),(n=e=n.prev)===n.next)return null;r=!0}}while(r||n!==e);return e}function o(t,e,r,n,i,h,f){if(t){!f&&h&&m(t,n,i,h);for(var d,p,v=t;t.prev!==t.next;)if(d=t.prev,p=t.next,h?l(t,n,i,h):s(t))e.push(d.i/r),e.push(t.i/r),e.push(p.i/r),L(t),t=p.next,v=p.next;else if((t=p)===v){f?1===f?(t=u(t,e,r),o(t,e,r,n,i,h,2)):2===f&&c(t,e,r,n,i,h):o(a(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,a=t,o=t.next;if(_(i,a,o)>=0)return!1;for(var s=i.xa.x?i.x>o.x?i.x:o.x:a.x>o.x?a.x:o.x,c=i.y>a.y?i.y>o.y?i.y:o.y:a.y>o.y?a.y:o.y,h=g(s,l,e,r,n),f=g(u,c,e,r,n),d=t.nextZ;d&&d.z<=f;){if(d!==t.prev&&d!==t.next&&b(i.x,i.y,a.x,a.y,o.x,o.y,d.x,d.y)&&_(d.prev,d,d.next)>=0)return!1;d=d.nextZ}for(d=t.prevZ;d&&d.z>=h;){if(d!==t.prev&&d!==t.next&&b(i.x,i.y,a.x,a.y,o.x,o.y,d.x,d.y)&&_(d.prev,d,d.next)>=0)return!1;d=d.prevZ}return!0}function u(t,e,r){var n=t;do{var i=n.prev,a=n.next.next;!w(i,a)&&M(i,n,n.next,a)&&A(i,a)&&A(a,i)&&(e.push(i.i/r),e.push(n.i/r),e.push(a.i/r),L(n),L(n.next),n=t=a),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=S(l,u);return l=a(l,l.next),c=a(c,c.next),o(l,e,r,n,i,s),void o(c,e,r,n,i,s)}u=u.next}l=l.next}while(l!==t)}function h(t,e,r,n){var o,s,l,u,c,h=[];for(o=0,s=e.length;o=n.next.y){var s=n.x+(a-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(s<=i&&s>o){if(o=s,s===i){if(a===n.y)return n;if(a===n.next.y)return n.next}r=n.x=n.x&&n.x>=c&&b(ar.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=g(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,v(i)}function v(t){var e,r,n,i,a,o,s,l,u=1;do{for(r=t,t=null,a=null,o=0;r;){for(o++,n=r,s=0,e=0;e0||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--),a?a.nextZ=i:t=i,i.prevZ=a,a=i;r=n}a.nextZ=null,u*=2}while(o>1);return t}function g(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-o)*(n-s)-(r-o)*(e-s)>=0&&(r-o)*(a-s)-(i-o)*(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))||_(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,a=(t.y+e.y)/2;do{r.y>a!=r.next.y>a&&i<(r.next.x-r.x)*(a-r.y)/(r.next.y-r.y)+r.x&&(n=!n),r=r.next}while(r!==t);return n}function S(t,e){var r=new C(t.i,t.x,t.y),n=new C(e.i,e.x,e.y),i=t.next,a=e.prev;return t.next=e,e.prev=t,r.next=i,i.prev=r,n.next=r,r.prev=n,a.next=n,n.prev=a,n}function E(t,e,r,n){var i=new C(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 C(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 z(t,e,r,n){for(var i=0,a=e,o=r-n;a0&&(n+=t[i-1].length,r.holes.push(n))}return r}},{}],125:[function(t,e,r){"use strict";function n(t,e){var r=t.length;if("number"!=typeof e){e=0;for(var n=0;n0&&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,a,s;if(!i(e))throw TypeError("listener must be a function");if(!this._events||!this._events[t])return this;if(r=this._events[t],a=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(o(r)){for(s=a;s-- >0;)if(r[s]===e||r[s].listener&&r[s].listener===e){n=s;break}if(n<0)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){return 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)}},{}],128:[function(t,e,r){"use strict";function n(t,e,r){var n=e||0,i=r||1;return[[t[12]+t[0],t[13]+t[1],t[14]+t[2],t[15]+t[3]],[t[12]-t[0],t[13]-t[1],t[14]-t[2],t[15]-t[3]],[t[12]+t[4],t[13]+t[5],t[14]+t[6],t[15]+t[7]],[t[12]-t[4],t[13]-t[5],t[14]-t[6],t[15]-t[7]],[n*t[12]+t[8],n*t[13]+t[9],n*t[14]+t[10],n*t[15]+t[11]],[i*t[12]-t[8],i*t[13]-t[9],i*t[14]-t[10],i*t[15]-t[11]]]}e.exports=n},{}],129:[function(t,e,r){"use strict";function n(t){for(var e,r=t.length,n=0;n13)&&32!==e&&133!==e&&160!==e&&5760!==e&&6158!==e&&(e<8192||e>8205)&&8232!==e&&8233!==e&&8239!==e&&8287!==e&&8288!==e&&12288!==e&&65279!==e)return!1;return!0}e.exports=function(t){var e=typeof t;if("string"===e){var r=t;if(0===(t=+t)&&n(r))return!1}else if("number"!==e)return!1;return t-t<1}},{}],130:[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];return t.length<=1?"any"===e?"false":"true":"("+("=="===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")+")"}function a(t){return"$type"===t?"f.type":"$id"===t?"f.id":"p["+JSON.stringify(t)+"]"}function o(t,e,r,n){var i=a(t),o="$type"===t?f.indexOf(e):JSON.stringify(e);return(n?"typeof "+i+"=== typeof "+o+"&&":"")+i+r+o}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=a(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 te?1:0}e.exports=n;var f=["Unknown","Point","LineString","Polygon"]},{}],131:[function(t,e,r){"use strict";function n(t,e,r){return Math.min(e,Math.max(t,r))}function i(t,e,r){this.dimension=t.length,this.bounds=[new Array(this.dimension),new Array(this.dimension)];for(var n=0;n=r-1)for(var f=o.length-1,p=t-e[r-1],d=0;d=r-1)for(var c=a.length-1,h=(e[r-1],0);h=0;--r)if(t[--e])return!1;return!0},u.jump=function(t){var e=this.lastT(),r=this.dimension;if(!(t0;--h)i.push(n(l[h-1],u[h-1],arguments[h])),a.push(0)}},u.push=function(t){var e=this.lastT(),r=this.dimension;if(!(t1e-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),a.push((d-i[o++])*h)}}},u.set=function(t){var e=this.dimension;if(!(t0;--l)r.push(n(o[l-1],s[l-1],arguments[l])),i.push(0)}},u.move=function(t){var e=this.lastT(),r=this.dimension;if(!(t<=e||arguments.length!==r+1)){var i=this._state,a=this._velocity,o=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[o++]+d)),a.push(d*h)}}},u.idle=function(t){var e=this.lastT();if(!(t=0;--h)i.push(n(l[h],u[h],i[o]+c*a[o])),a.push(0),o+=1}}},{"binary-search-bounds":64,"cubic-hermite":107}],132:[function(t,e,r){"use strict";function n(t){t=t||{};var e,r,n=t.canvas||document.createElement("canvas"),o=t.family||"sans-serif",s=t.shape||[512,512],l=t.step||[32,32],u=parseFloat(t.size)||16,c=t.chars||[32,126],h=Math.floor((l[0]-u)/2),f=t.radius||1.5*h,d=new a(u,h,f,0,o),p=null==t.align?"optical":t.align,m=null==t.fit||1==t.fit?.5:t.fit;if(Array.isArray(c)){if(2===c.length&&"number"==typeof c[0]&&"number"==typeof c[1]){var v=[];for(e=c[0],r=0;e<=c[1];e++)v[r++]=String.fromCharCode(e);c=v}}else c=String(c).split("");s=s.slice(),n.width=s[0],n.height=s[1];var g=n.getContext("2d");g.fillStyle="#000",g.fillRect(0,0,n.width,n.height),g.textBaseline="middle";var y=l[0],b=l[1],x=0,_=0,w=u/b,M=Math.min(c.length,Math.floor(s[0]/y)*Math.ceil(s[1]/b)),k=d.ctx.textAlign,A=d.buffer,T=d.middle;for(d.ctx.textAlign="center",d.buffer=d.size/2,e=0;es[0]-l[0]&&(x=0,_+=l[1])}return d.ctx.textAlign=k,d.buffer=A,d.middle=T,n}function i(t,e,r){if(s[e]&&s[e][t])return s[e][t];var n=200*r,i=o(t,{size:200,fontSize:n,fontFamily:e});s[e]||(s[e]={});var a={center:[i.center[0]/200,i.center[1]/200],bounds:i.bounds.map(function(t){return t/200}),radius:i.radius/200};return s[e][t]=a,a}var a=t("tiny-sdf"),o=t("optical-properties");e.exports=n;var s={}},{"optical-properties":469,"tiny-sdf":531}],133:[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||(e.right?l(t,e.right):void 0)}function u(t,e,r,n){if(e(t,n.key)<=0){if(n.left){var i=u(t,e,r,n.left);if(i)return i}var i=r(n.key,n.value);if(i)return i}if(n.right)return u(t,e,r,n.right)}function c(t,e,r,n,i){var a,o=r(t,i.key),s=r(e,i.key);if(o<=0){if(i.left&&(a=c(t,e,r,n,i.left)))return a;if(s>0&&(a=n(i.key,i.value)))return a}if(s>0&&i.right)return c(t,e,r,n,i.right)}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===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=g,r._color=g,s._color=g,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=g,n._color=g,e._color=g,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===g){if(r._color===v)return r._color=g,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=g,n._color=g,e._color=g,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===g){if(r._color===v)return r._color=g,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+1e?1:0}function m(t){return new s(t||p,null)}e.exports=m;var v=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=c<=0?i.left:i.right}l.push(new n(v,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!==v){if(d._color=v,d.left=f.right,f._color=g,f.right=d,l[h-2]=f,l[h-1]=i,o(d),o(f),h>=3){var m=l[h-3];m.left===d?m.left=f:m.right=f}break}f._color=g,d.right=a(g,p),d._color=v,h-=1}else{var p=d.right;if(!p||p._color!==v){if(f.right=i.left,d._color=v,d.left=i.right,i._color=g,i.left=f,i.right=d,l[h-2]=i,l[h-1]=f,o(d),o(f),o(i),h>=3){var m=l[h-3];m.left===d?m.left=i:m.right=i}break}f._color=g,d.right=a(g,p),d._color=v,h-=1}else if(f.right===i){var p=d.left;if(!p||p._color!==v){if(d._color=v,d.right=f.left,f._color=g,f.left=d,l[h-2]=f,l[h-1]=i,o(d),o(f),h>=3){var m=l[h-3];m.right===d?m.right=f:m.left=f}break}f._color=g,d.left=a(g,p),d._color=v,h-=1}else{var p=d.left;if(!p||p._color!==v){if(f.left=i.right,d._color=v,d.right=i.left,i._color=g,i.right=f,i.left=d,l[h-2]=i,l[h-1]=f,o(d),o(f),o(i),h>=3){var m=l[h-3];m.right===d?m.right=i:m.left=i}break}f._color=g,d.left=a(g,p),d._color=v,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(t<0)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 a=e(t,r.key);n.push(r),a<=0&&(i=n.length),r=a<=0?r.left:r.right}return n.length=i,new h(this,n)},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),a<0&&(i=n.length),r=a<0?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 a=e(t,r.key);n.push(r),a>0&&(i=n.length),r=a<=0?r.left:r.right}return n.length=i,new h(this,n)},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=a<0?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=i<=0?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=n<=0?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 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)return this._stack[this._stack.length-1].key},enumerable:!0}),Object.defineProperty(b,"value",{get:function(){if(this._stack.length>0)return this._stack[this._stack.length-1].value},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}})},{}],134:[function(t,e,r){function n(t){if(t<0)return Number("0/0");for(var e=o[0],r=o.length-1;r>0;--r)e+=o[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=[.9999999999998099,676.5203681218851,-1259.1392167224028,771.3234287776531,-176.6150291621406,12.507343278686905,-.13857109526572012,9984369578019572e-21,1.5056327351493116e-7],a=607/128,o=[.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 t(e){if(e<.5)return Math.PI/(Math.sin(Math.PI*e)*t(1-e));if(e>100)return Math.exp(n(e));e-=1;for(var r=i[0],a=1;a<9;a++)r+=i[a]/(e+a);var o=e+7+.5;return Math.sqrt(2*Math.PI)*Math.pow(o,e+.5)*Math.exp(-o)*r},e.exports.log=n},{}],135:[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(a(t[0]));for(var r=1;r2){for(var r,n,i=0;i=0}var u=t("geojson-area");e.exports=n},{"geojson-area":135}],137:[function(t,e,r){"use strict";function n(t,e,r,n,o,l,u,c){if(r/=e,n/=e,u>=r&&c<=n)return t;if(u>n||c=r&&p<=n)h.push(m);else if(!(d>n||p=e&&s<=r&&i.push(o)}return i}function a(t,e,r,n,i,a){for(var s=[],l=0;lr?(x.push(i(u,p,e),i(u,p,r)),a||(x=o(s,x,v,g,y))):d>=e&&x.push(i(u,p,e)):f>r?dr&&(x.push(i(u,p,r)),a||(x=o(s,x,v,g,y))));u=m[b-1],f=u[n],f>=e&&f<=r&&x.push(u),h=x[x.length-1],a&&h&&(x[0][0]!==h[0]||x[0][1]!==h[1])&&x.push(x[0]),o(s,x,v,g,y)}return s}function o(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":139}],138:[function(t,e,r){"use strict";function n(t,e){var r=[];if("FeatureCollection"===t.type)for(var n=0;n1?1:n,[r,n,0]}function s(t){for(var e,r,n=0,i=0,a=0;a1)return!1;var a=i.geometry[0].length;if(5!==a)return!1;for(var o=0;o1&&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}),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===d.maxZoom||e===i)continue;var w=1<1&&console.time("clipping");var M,k,A,T,S,E,L=.5*d.buffer/d.extent,C=.5-L,z=.5+L,I=1+L;M=k=A=T=null,S=f(t,g,r-L,r+z,0,o,b.min[0],b.max[0]),E=f(t,g,r+C,r+I,0,o,b.min[0],b.max[0]),S&&(M=f(S,g,n-L,n+z,1,s,b.min[1],b.max[1]),k=f(S,g,n+C,n+I,1,s,b.min[1],b.max[1])),E&&(A=f(E,g,n-L,n+z,1,s,b.min[1],b.max[1]),T=f(E,g,n+C,n+I,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&&(v=e)}return v},i.prototype.getTile=function(t,e,r){var n=this.options,i=n.extent,o=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[a(f,d,p)];if(!c||!c.source)return null;if(o>1&&console.log("found parent tile z%d-%d-%d",f,d,p),u(c,i,n.buffer))return h.tile(c,i);o>1&&console.time("drilling down");var m=this.splitTile(c.source,f,d,p,t,e,r);if(o>1&&console.timeEnd("drilling down"),null!==m){var v=1<n&&(o=r,n=a);n>s?(t[o][2]=n,h.push(u),h.push(o),u=o):(c=h.pop(),u=h.pop())}}function i(t,e,r){var n=e[0],i=e[1],a=r[0],o=r[1],s=t[0],l=t[1],u=a-n,c=o-i;if(0!==u||0!==c){var h=((s-n)*u+(l-i)*c)/(u*u+c*c);h>1?(n=a,i=o):h>0&&(n+=u*h,i+=c*h)}return u=s-n,c=l-i,u*u+c*c}e.exports=n},{}],142:[function(t,e,r){"use strict";function n(t,e,r,n,a,o){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,s,l,u=e.geometry,c=e.type,h=[],f=r*r;if(1===c)for(i=0;if)&&(d.push(l),t.numSimplified++),t.numPoints++;3===c&&a(d,s.outer),h.push(d)}else t.numPoints+=s.length;if(h.length){var p={geometry:h,type:c,tags:e.tags||null};null!==e.id&&(p.id=e.id),t.features.push(p)}}function a(t,e){o(t)<0===e&&t.reverse()}function o(t){for(var e,r,n=0,i=0,a=t.length,o=a-1;i0?(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,a=t[n],o=this[n];(e?Array.isArray(a)&&Array.isArray(a[0]):Array.isArray(a))?this[n]=i=[r(a[0]),r(a[1]),r(a[2])]:this[n]=i=[r(a),r(a),r(a)];for(var s=0;s<3;++s)if(i[s]!==o[s])return!0}return!1}t=t||{};var r,n=e.bind(this,!1,Number),i=e.bind(this,!1,Boolean),a=e.bind(this,!1,String),o=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;d<2;++d)for(var p=0;p<3;++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;d<3;++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;d<3;++d)r[d].sort(function(t,e){return t.x-e.x});f.equal(r,this.ticks)?s=!1:this.ticks=r}i("tickEnable"),a("tickFont")&&(s=!0),n("tickSize"),n("tickAngle"),n("tickPad"),o("tickColor");var m=a("labels");a("labelFont")&&(m=!0),i("labelEnable"),n("labelSize"),n("labelPad"),o("labelColor"),i("lineEnable"),i("lineMirror"),n("lineWidth"),o("lineColor"),i("lineTickEnable"),i("lineTickMirror"),n("lineTickLength"),n("lineTickWidth"),o("lineTickColor"),i("gridEnable"),n("gridWidth"),o("gridColor"),i("zeroEnable"),o("zeroLineColor"),n("zeroLineWidth"),i("backgroundEnable"),o("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 a,new a,new a],v=[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,a=t.projection||d,s=this.bounds,l=h(r,i,a,s),u=l.cubeEdges,c=l.axis,f=i[12],p=i[13],_=i[14],w=i[15],M=this.pixelRatio*(a[3]*f+a[7]*p+a[11]*_+a[15]*w)/e.drawingBufferHeight,k=0;k<3;++k)this.lastCubeProps.cubeEdges[k]=u[k],this.lastCubeProps.axis[k]=c[k];for(var A=m,k=0;k<3;++k)o(m[k],k,this.bounds,u,c);for(var e=this.gl,T=v,k=0;k<3;++k)this.backgroundEnable[k]?T[k]=c[k]:T[k]=0;this._background.draw(r,i,a,s,T,this.backgroundColor),this._lines.bind(r,i,a,this);for(var k=0;k<3;++k){var S=[0,0,0];c[k]>0?S[k]=s[1][k]:S[k]=s[0][k];for(var E=0;E<2;++E){var L=(k+1+E)%3,C=(k+1+(1^E))%3;this.gridEnable[L]&&this._lines.drawGrid(L,C,this.bounds,S,this.gridColor[L],this.gridWidth[L]*this.pixelRatio)}for(var E=0;E<2;++E){var L=(k+1+E)%3,C=(k+1+(1^E))%3;this.zeroEnable[C]&&s[0][C]<=0&&s[1][C]>=0&&this._lines.drawZero(L,C,this.bounds,S,this.zeroLineColor[C],this.zeroLineWidth[C]*this.pixelRatio)}}for(var k=0;k<3;++k){this.lineEnable[k]&&this._lines.drawAxisLine(k,this.bounds,A[k].primalOffset,this.lineColor[k],this.lineWidth[k]*this.pixelRatio),this.lineMirror[k]&&this._lines.drawAxisLine(k,this.bounds,A[k].mirrorOffset,this.lineColor[k],this.lineWidth[k]*this.pixelRatio);for(var z=n(y,A[k].primalMinor),I=n(b,A[k].mirrorMinor),D=this.lineTickLength,E=0;E<3;++E){var P=M/r[5*E];z[E]*=D[E]*P,I[E]*=D[E]*P}this.lineTickEnable[k]&&this._lines.drawAxisTicks(k,A[k].primalOffset,z,this.lineTickColor[k],this.lineTickWidth[k]*this.pixelRatio),this.lineTickMirror[k]&&this._lines.drawAxisTicks(k,A[k].mirrorOffset,I,this.lineTickColor[k],this.lineTickWidth[k]*this.pixelRatio)}this._text.bind(r,i,a,this.pixelRatio);for(var k=0;k<3;++k){for(var O=A[k].primalMinor,R=n(x,A[k].primalOffset),E=0;E<3;++E)this.lineTickEnable[k]&&(R[E]+=M*O[E]*Math.max(this.lineTickLength[E],0)/r[5*E]);if(this.tickEnable[k]){for(var E=0;E<3;++E)R[E]+=M*O[E]*this.tickPad[E]/r[5*E];this._text.drawTicks(k,this.tickSize[k],this.tickAngle[k],R,this.tickColor[k])}if(this.labelEnable[k]){for(var E=0;E<3;++E)R[E]+=M*O[E]*this.labelPad[E]/r[5*E];R[k]+=.5*(s[0][k]+s[1][k]),this._text.drawLabel(k,this.labelSize[k],this.labelAngle[k],R,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":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;l<3;++l)for(var u=(l+1)%3,c=(l+2)%3,h=[0,0,0],f=[0,0,0],d=-1;d<=1;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;p<=1;p+=2){h[u]=p;for(var m=-1;m<=1;m+=2)h[c]=m,e.push(h[0],h[1],h[2],f[0],f[1],f[2]),i+=1}var v=u;u=c,c=v}var g=a(t,new Float32Array(e)),y=a(t,new Uint16Array(r),t.ELEMENT_ARRAY_BUFFER),b=o(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 a=t("gl-buffer"),o=t("gl-vao"),s=t("./shaders").bg,l=n.prototype;l.draw=function(t,e,r,n,i,a){for(var o=!1,s=0;s<3;++s)o=o||i[s];if(o){var l=this.gl;l.enable(l.POLYGON_OFFSET_FILL),l.polygonOffset(1,2),this.shader.bind(),this.shader.uniforms={model:t,view:e,projection:r,bounds:n,enable:i,colors:a},this.vao.bind(),this.vao.draw(this.gl.TRIANGLES,36),l.disable(l.POLYGON_OFFSET_FILL)}},l.dispose=function(){this.vao.dispose(),this.buffer.dispose(),this.shader.dispose()}},{"./shaders":150,"gl-buffer":154,"gl-vao":269}],148:[function(t,e,r){"use strict";function n(t,e,r){for(var n=0;n<4;++n){t[n]=r[12+n];for(var i=0;i<3;++i)t[n]+=e[i]*r[4*i+n]}}function i(t){for(var e=0;eS&&(_|=1<S&&(_|=1<f[m][1]&&(O=m));for(var R=-1,m=0;m<3;++m){var F=O^1<f[j][0]&&(j=F)}}var N=v;N[0]=N[1]=N[2]=0,N[o.log2(R^O)]=O&R,N[o.log2(O^j)]=O&j;var B=7^j;B===_||B===P?(B=7^R,N[o.log2(j^B)]=B&j):N[o.log2(R^B)]=B&R;for(var U=g,V=_,k=0;k<3;++k)U[k]=V&1< 0.0) {\n vec3 nPosition = mix(bounds[0], bounds[1], 0.5 * (position + 1.0));\n gl_Position = projection * view * model * vec4(nPosition, 1.0);\n } else {\n gl_Position = vec4(0,0,0,0);\n }\n colorChannel = abs(normal);\n}","precision mediump float;\n#define GLSLIFY 1\n\nuniform vec4 colors[3];\n\nvarying vec3 colorChannel;\n\nvoid main() {\n gl_FragColor = colorChannel.x * colors[0] + \n colorChannel.y * colors[1] +\n colorChannel.z * colors[2];\n}",null,[{name:"position",type:"vec3"},{name:"normal",type:"vec3"}])}},{"gl-shader":253}],151:[function(t,e,r){(function(r){"use strict";function n(t,e,r,n){this.gl=t,this.shader=e,this.buffer=r,this.vao=n,this.tickOffset=this.tickCount=this.labelOffset=this.labelCount=null}function i(t,e){try{return l(t,e)}catch(t){return console.warn("error vectorizing text:",t),{cells:[],positions:[]}}}function a(t,e,r,i,a,l){var c=o(t),h=s(t,[{buffer:c,size:3}]),f=u(t);f.attributes.position.location=0;var d=new n(t,f,c,h);return d.update(e,r,i,a,l),d}e.exports=a;var o=t("gl-buffer"),s=t("gl-vao"),l=t("vectorize-text"),u=t("./shaders").text,c=window||r.global||{},h=c.__TEXT_CACHE||{};c.__TEXT_CACHE={};var f=n.prototype,d=[0,0];f.bind=function(t,e,r,n){this.vao.bind(),this.shader.bind();var i=this.shader.uniforms;i.model=t,i.view=e,i.projection=r,i.pixelScale=n,d[0]=this.gl.drawingBufferWidth,d[1]=this.gl.drawingBufferHeight,this.shader.uniforms.resolution=d},f.update=function(t,e,r,n,a){function o(t,e,r,n){var a=h[r];a||(a=h[r]={});var o=a[e];o||(o=a[e]=i(e,{triangles:!0,font:r,textAlign:"center",textBaseline:"middle"}));for(var l=(n||12)/12,u=o.positions,c=o.cells,f=0,d=c.length;f=0;--m){var v=u[p[m]];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],f=[0,0,0],d=0;d<3;++d){c[d]=s.length/3|0,o(.5*(t[0][d]+t[1][d]),e[d],r),f[d]=(s.length/3|0)-c[d],l[d]=s.length/3|0;for(var p=0;p=0&&(i=r.length-n-1);var a=Math.pow(10,i),o=Math.round(t*e*a),s=o+"";if(s.indexOf("e")>=0)return s;var l=o/a,u=o%a;o<0?(l=0|-Math.ceil(l),u=0|-u):(l=0|Math.floor(l),u|=0);var c=""+l;if(o<0&&(c="-"+c),i){for(var h=""+u;h.length=t[0][i];--o)a.push({x:o*e[i],text:n(e[i],o)});r.push(a)}return r}function a(t,e){for(var r=0;r<3;++r){if(t[r].length!==e[r].length)return!1;for(var n=0;nr)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;i=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"),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&&void 0!==t.shape){var r=t.dtype;if(h.indexOf(r)<0&&(r="float32"),this.type===this.gl.ELEMENT_ARRAY_BUFFER){r=gl.getExtension("OES_element_index_uint")&&"uint16"!==r?"uint32":"uint16"}if(r===t.dtype&&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 n=l.malloc(t.size,r),s=c(n,t.shape);u.assign(s,t),this.length=e<0?i(this.gl,this.type,this.length,this.usage,n,e):i(this.gl,this.type,this.length,this.usage,n.subarray(0,t.size),e),l.free(n)}}else if(Array.isArray(t)){var f;f=this.type===this.gl.ELEMENT_ARRAY_BUFFER?a(t,"uint16"):a(t,"float32"),this.length=e<0?i(this.gl,this.type,this.length,this.usage,f,e):i(this.gl,this.type,this.length,this.usage,f.subarray(0,t.length),e),l.free(f)}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=1),this.gl.bufferData(this.type,0|t,this.usage),this.length=t}},e.exports=s},{ndarray:465,"ndarray-ops":459,"typedarray-pool":539}],155:[function(t,e,r){e.exports={0:"NONE",1:"ONE",2:"LINE_LOOP",3:"LINE_STRIP",4:"TRIANGLES",5:"TRIANGLE_STRIP",6:"TRIANGLE_FAN",256:"DEPTH_BUFFER_BIT",512:"NEVER",513:"LESS",514:"EQUAL",515:"LEQUAL",516:"GREATER",517:"NOTEQUAL",518:"GEQUAL",519:"ALWAYS",768:"SRC_COLOR",769:"ONE_MINUS_SRC_COLOR",770:"SRC_ALPHA",771:"ONE_MINUS_SRC_ALPHA",772:"DST_ALPHA",773:"ONE_MINUS_DST_ALPHA",774:"DST_COLOR",775:"ONE_MINUS_DST_COLOR",776:"SRC_ALPHA_SATURATE",1024:"STENCIL_BUFFER_BIT",1028:"FRONT",1029:"BACK",1032:"FRONT_AND_BACK",1280:"INVALID_ENUM",1281:"INVALID_VALUE",1282:"INVALID_OPERATION",1285:"OUT_OF_MEMORY",1286:"INVALID_FRAMEBUFFER_OPERATION",2304:"CW",2305:"CCW",2849:"LINE_WIDTH",2884:"CULL_FACE",2885:"CULL_FACE_MODE",2886:"FRONT_FACE",2928:"DEPTH_RANGE",2929:"DEPTH_TEST",2930:"DEPTH_WRITEMASK",2931:"DEPTH_CLEAR_VALUE",2932:"DEPTH_FUNC",2960:"STENCIL_TEST",2961:"STENCIL_CLEAR_VALUE",2962:"STENCIL_FUNC",2963:"STENCIL_VALUE_MASK",2964:"STENCIL_FAIL",2965:"STENCIL_PASS_DEPTH_FAIL",2966:"STENCIL_PASS_DEPTH_PASS",2967:"STENCIL_REF",2968:"STENCIL_WRITEMASK",2978:"VIEWPORT",3024:"DITHER",3042:"BLEND",3088:"SCISSOR_BOX",3089:"SCISSOR_TEST",3106:"COLOR_CLEAR_VALUE",3107:"COLOR_WRITEMASK",3317:"UNPACK_ALIGNMENT",3333:"PACK_ALIGNMENT",3379:"MAX_TEXTURE_SIZE",3386:"MAX_VIEWPORT_DIMS",3408:"SUBPIXEL_BITS",3410:"RED_BITS",3411:"GREEN_BITS",3412:"BLUE_BITS",3413:"ALPHA_BITS",3414:"DEPTH_BITS",3415:"STENCIL_BITS",3553:"TEXTURE_2D",4352:"DONT_CARE",4353:"FASTEST",4354:"NICEST",5120:"BYTE",5121:"UNSIGNED_BYTE",5122:"SHORT",5123:"UNSIGNED_SHORT",5124:"INT",5125:"UNSIGNED_INT",5126:"FLOAT",5386:"INVERT",5890:"TEXTURE",6401:"STENCIL_INDEX",6402:"DEPTH_COMPONENT",6406:"ALPHA",6407:"RGB",6408:"RGBA",6409:"LUMINANCE",6410:"LUMINANCE_ALPHA",7680:"KEEP",7681:"REPLACE",7682:"INCR",7683:"DECR",7936:"VENDOR",7937:"RENDERER",7938:"VERSION",9728:"NEAREST",9729:"LINEAR",9984:"NEAREST_MIPMAP_NEAREST",9985:"LINEAR_MIPMAP_NEAREST",9986:"NEAREST_MIPMAP_LINEAR",9987:"LINEAR_MIPMAP_LINEAR",10240:"TEXTURE_MAG_FILTER",10241:"TEXTURE_MIN_FILTER",10242:"TEXTURE_WRAP_S",10243:"TEXTURE_WRAP_T",10497:"REPEAT",10752:"POLYGON_OFFSET_UNITS",16384:"COLOR_BUFFER_BIT",32769:"CONSTANT_COLOR",32770:"ONE_MINUS_CONSTANT_COLOR",32771:"CONSTANT_ALPHA",32772:"ONE_MINUS_CONSTANT_ALPHA",32773:"BLEND_COLOR",32774:"FUNC_ADD",32777:"BLEND_EQUATION_RGB",32778:"FUNC_SUBTRACT",32779:"FUNC_REVERSE_SUBTRACT",32819:"UNSIGNED_SHORT_4_4_4_4",32820:"UNSIGNED_SHORT_5_5_5_1",32823:"POLYGON_OFFSET_FILL",32824:"POLYGON_OFFSET_FACTOR",32854:"RGBA4",32855:"RGB5_A1",32873:"TEXTURE_BINDING_2D",32926:"SAMPLE_ALPHA_TO_COVERAGE",32928:"SAMPLE_COVERAGE",32936:"SAMPLE_BUFFERS",32937:"SAMPLES",32938:"SAMPLE_COVERAGE_VALUE",32939:"SAMPLE_COVERAGE_INVERT",32968:"BLEND_DST_RGB",32969:"BLEND_SRC_RGB",32970:"BLEND_DST_ALPHA",32971:"BLEND_SRC_ALPHA",33071:"CLAMP_TO_EDGE",33170:"GENERATE_MIPMAP_HINT",33189:"DEPTH_COMPONENT16",33306:"DEPTH_STENCIL_ATTACHMENT",33635:"UNSIGNED_SHORT_5_6_5",33648:"MIRRORED_REPEAT",33901:"ALIASED_POINT_SIZE_RANGE",33902:"ALIASED_LINE_WIDTH_RANGE",33984:"TEXTURE0",33985:"TEXTURE1",33986:"TEXTURE2",33987:"TEXTURE3",33988:"TEXTURE4",33989:"TEXTURE5",33990:"TEXTURE6",33991:"TEXTURE7",33992:"TEXTURE8",33993:"TEXTURE9",33994:"TEXTURE10",33995:"TEXTURE11",33996:"TEXTURE12",33997:"TEXTURE13",33998:"TEXTURE14",33999:"TEXTURE15",34e3:"TEXTURE16",34001:"TEXTURE17",34002:"TEXTURE18",34003:"TEXTURE19",34004:"TEXTURE20",34005:"TEXTURE21",34006:"TEXTURE22",34007:"TEXTURE23",34008:"TEXTURE24",34009:"TEXTURE25",34010:"TEXTURE26",34011:"TEXTURE27",34012:"TEXTURE28",34013:"TEXTURE29",34014:"TEXTURE30",34015:"TEXTURE31",34016:"ACTIVE_TEXTURE",34024:"MAX_RENDERBUFFER_SIZE",34041:"DEPTH_STENCIL",34055:"INCR_WRAP",34056:"DECR_WRAP",34067:"TEXTURE_CUBE_MAP",34068:"TEXTURE_BINDING_CUBE_MAP",34069:"TEXTURE_CUBE_MAP_POSITIVE_X",34070:"TEXTURE_CUBE_MAP_NEGATIVE_X",34071:"TEXTURE_CUBE_MAP_POSITIVE_Y",34072:"TEXTURE_CUBE_MAP_NEGATIVE_Y",34073:"TEXTURE_CUBE_MAP_POSITIVE_Z",34074:"TEXTURE_CUBE_MAP_NEGATIVE_Z",34076:"MAX_CUBE_MAP_TEXTURE_SIZE",34338:"VERTEX_ATTRIB_ARRAY_ENABLED",34339:"VERTEX_ATTRIB_ARRAY_SIZE",34340:"VERTEX_ATTRIB_ARRAY_STRIDE",34341:"VERTEX_ATTRIB_ARRAY_TYPE",34342:"CURRENT_VERTEX_ATTRIB",34373:"VERTEX_ATTRIB_ARRAY_POINTER",34466:"NUM_COMPRESSED_TEXTURE_FORMATS",34467:"COMPRESSED_TEXTURE_FORMATS",34660:"BUFFER_SIZE",34661:"BUFFER_USAGE",34816:"STENCIL_BACK_FUNC",34817:"STENCIL_BACK_FAIL",34818:"STENCIL_BACK_PASS_DEPTH_FAIL",34819:"STENCIL_BACK_PASS_DEPTH_PASS",34877:"BLEND_EQUATION_ALPHA",34921:"MAX_VERTEX_ATTRIBS",34922:"VERTEX_ATTRIB_ARRAY_NORMALIZED",34930:"MAX_TEXTURE_IMAGE_UNITS",34962:"ARRAY_BUFFER",34963:"ELEMENT_ARRAY_BUFFER",34964:"ARRAY_BUFFER_BINDING",34965:"ELEMENT_ARRAY_BUFFER_BINDING",34975:"VERTEX_ATTRIB_ARRAY_BUFFER_BINDING",35040:"STREAM_DRAW",35044:"STATIC_DRAW",35048:"DYNAMIC_DRAW",35632:"FRAGMENT_SHADER",35633:"VERTEX_SHADER",35660:"MAX_VERTEX_TEXTURE_IMAGE_UNITS",35661:"MAX_COMBINED_TEXTURE_IMAGE_UNITS",35663:"SHADER_TYPE",35664:"FLOAT_VEC2",35665:"FLOAT_VEC3",35666:"FLOAT_VEC4",35667:"INT_VEC2",35668:"INT_VEC3",35669:"INT_VEC4",35670:"BOOL",35671:"BOOL_VEC2",35672:"BOOL_VEC3",35673:"BOOL_VEC4",35674:"FLOAT_MAT2",35675:"FLOAT_MAT3",35676:"FLOAT_MAT4",35678:"SAMPLER_2D",35680:"SAMPLER_CUBE",35712:"DELETE_STATUS",35713:"COMPILE_STATUS",35714:"LINK_STATUS",35715:"VALIDATE_STATUS",35716:"INFO_LOG_LENGTH",35717:"ATTACHED_SHADERS",35718:"ACTIVE_UNIFORMS",35719:"ACTIVE_UNIFORM_MAX_LENGTH",35720:"SHADER_SOURCE_LENGTH",35721:"ACTIVE_ATTRIBUTES",35722:"ACTIVE_ATTRIBUTE_MAX_LENGTH",35724:"SHADING_LANGUAGE_VERSION",35725:"CURRENT_PROGRAM",36003:"STENCIL_BACK_REF",36004:"STENCIL_BACK_VALUE_MASK",36005:"STENCIL_BACK_WRITEMASK",36006:"FRAMEBUFFER_BINDING",36007:"RENDERBUFFER_BINDING",36048:"FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE",36049:"FRAMEBUFFER_ATTACHMENT_OBJECT_NAME",36050:"FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL",36051:"FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE",36053:"FRAMEBUFFER_COMPLETE",36054:"FRAMEBUFFER_INCOMPLETE_ATTACHMENT",36055:"FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT",36057:"FRAMEBUFFER_INCOMPLETE_DIMENSIONS",36061:"FRAMEBUFFER_UNSUPPORTED",36064:"COLOR_ATTACHMENT0",36096:"DEPTH_ATTACHMENT",36128:"STENCIL_ATTACHMENT",36160:"FRAMEBUFFER",36161:"RENDERBUFFER",36162:"RENDERBUFFER_WIDTH",36163:"RENDERBUFFER_HEIGHT",36164:"RENDERBUFFER_INTERNAL_FORMAT",36168:"STENCIL_INDEX8",36176:"RENDERBUFFER_RED_SIZE",36177:"RENDERBUFFER_GREEN_SIZE",36178:"RENDERBUFFER_BLUE_SIZE",36179:"RENDERBUFFER_ALPHA_SIZE",36180:"RENDERBUFFER_DEPTH_SIZE",36181:"RENDERBUFFER_STENCIL_SIZE",36194:"RGB565",36336:"LOW_FLOAT",36337:"MEDIUM_FLOAT",36338:"HIGH_FLOAT",36339:"LOW_INT",36340:"MEDIUM_INT",36341:"HIGH_INT",36346:"SHADER_COMPILER",36347:"MAX_VERTEX_UNIFORM_VECTORS",36348:"MAX_VARYING_VECTORS",36349:"MAX_FRAGMENT_UNIFORM_VECTORS",37440:"UNPACK_FLIP_Y_WEBGL",37441:"UNPACK_PREMULTIPLY_ALPHA_WEBGL",37442:"CONTEXT_LOST_WEBGL",37443:"UNPACK_COLORSPACE_CONVERSION_WEBGL",37444:"BROWSER_DEFAULT_WEBGL"}},{}],156:[function(t,e,r){var n=t("./1.0/numbers");e.exports=function(t){return n[t]}},{"./1.0/numbers":155}],157:[function(t,e,r){"use strict";function n(t,e,r,n){this.plot=t,this.shader=e,this.bufferHi=r,this.bufferLo=n,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=o(t.gl),u=new n(t,r,i,s);return u.update(e),t.addObject(u),u}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=new Float32Array([0,0]),e=new Float32Array([0,0]),r=new Float32Array([0,0]),n=new Float32Array([0,0]),i=[1,1];return function(){var a=this.plot,o=this.shader,s=this.bounds,l=this.numPoints;if(l){var c=a.gl,h=a.dataBox,f=a.viewBox,d=a.pixelRatio,p=s[2]-s[0],m=s[3]-s[1],v=h[2]-h[0],g=h[3]-h[1],y=2*p/v,b=2*m/g,x=(s[0]-h[0]-.5*v)/p,_=(s[1]-h[1]-.5*g)/m;t[0]=y,t[1]=b,e[0]=y-t[0],e[1]=b-t[1],r[0]=x,r[1]=_,n[0]=x-r[0],n[1]=_-r[1];var w=f[2]-f[0],M=f[3]-f[1];i[0]=2*d/w,i[1]=2*d/M,o.bind(),o.uniforms.scaleHi=t,o.uniforms.scaleLo=e,o.uniforms.translateHi=r,o.uniforms.translateLo=n,o.uniforms.pixelScale=i,o.uniforms.color=this.color,this.bufferLo.bind(),o.attributes.positionLo.pointer(c.FLOAT,!1,16,0),this.bufferHi.bind(),o.attributes.positionHi.pointer(c.FLOAT,!1,16,0),o.attributes.pixelOffset.pointer(c.FLOAT,!1,16,8),c.drawArrays(c.TRIANGLES,0,l*u.length)}}}(),c.drawPick=function(t){return t},c.pick=function(){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],h=this.numPoints=i.length>>1;for(e=0;e0&&(T*=_),S<0?S*=w:S>0&&(S*=M),v[b++]=f*(r-p+T),v[b++]=d*(n-m+S),v[b++]=o*A[2]+(l+o)*A[4],v[b++]=o*A[3]+(l+o)*A[5]}}for(e=0;e=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 a=n[12],o=n[13],s=n[14],l=n[15],u=this.pixelRatio*(i[3]*a+i[7]*o+i[11]*s+i[15]*l)/e.drawingBufferHeight;this.vao.bind();for(var h=0;h<3;++h)e.lineWidth(this.lineWidth[h]),r.capSize=this.capSize[h]*u,this.lineCount[h]&&e.drawArrays(e.LINES,this.lineOffset[h],this.lineCount[h]);this.vao.unbind()};var f=function(){for(var t=new Array(3),e=0;e<3;++e){for(var r=[],n=1;n<=2;++n)for(var i=-1;i<=1;i+=2){var a=(n+e)%3,o=[0,0,0];o[a]=i,r.push(o)}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 o=[],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;u<3;++u){this.lineOffset[u]=l;t:for(var c=0;c0){var m=h.slice();m[u]+=d[1][u],o.push(h[0],h[1],h[2],p[0],p[1],p[2],p[3],0,0,0,m[0],m[1],m[2],p[0],p[1],p[2],p[3],0,0,0),i(this.bounds,m),l+=2+a(o,m,p,u)}}}this.lineCount[u]=l-this.lineOffset[u]}this.buffer.update(o)}},h.dispose=function(){this.shader.dispose(),this.buffer.dispose(),this.vao.dispose()}},{"./shaders/index":161,"gl-buffer":154,"gl-vao":269}],160:[function(t,e,r){e.exports=function(t){"string"==typeof t&&(t=[t]);for(var e=[].slice.call(arguments,1),r=[],n=0;n1&&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 v=0;vs||r<0||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;uo||r<0||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)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,m,v,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,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,h(this,this._shape[0],t),t},enumerable:!1}}),b.bind=function(){if(!this._destroyed){var t=this.gl;t.bindFramebuffer(t.FRAMEBUFFER,this.handle),t.viewport(0,0,this._shape[0],this._shape[1])}},b.dispose=function(){if(!this._destroyed){this._destroyed=!0;var t=this.gl;t.deleteFramebuffer(this.handle),this.handle=null,this.depth&&(this.depth.dispose(),this.depth=null),this._depth_rb&&(t.deleteRenderbuffer(this._depth_rb),this._depth_rb=null);for(var e=0;e>8*d&255;this.pickOffset=r,i.bind();var p=i.uniforms;p.viewTransform=t,p.pickOffset=e,p.shape=this.shape;var m=i.attributes;return this.positionBuffer.bind(),m.position.pointer(),this.weightBuffer.bind(),m.weight.pointer(s.UNSIGNED_BYTE,!1),this.idBuffer.bind(),m.pickId.pointer(s.UNSIGNED_BYTE,!1),s.drawArrays(s.TRIANGLES,0,o),r+this.shape[0]*this.shape[1]}}}(),h.pick=function(t,e,r){var n=this.pickOffset,i=this.shape[0]*this.shape[1];if(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]]}},h.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,h=this.bounds,d=h[0]=r[0],p=h[1]=n[0],m=h[2]=r[r.length-1],v=h[3]=n[n.length-1],g=1/(m-d),y=1/(v-p),b=e[0],x=e[1];this.shape=[b,x];var _=(b-1)*(x-1)*(f.length>>>1);this.numVertices=_;for(var w=s.mallocUint8(4*_),M=s.mallocFloat32(2*_),k=s.mallocUint8(2*_),A=s.mallocUint32(_),T=0,S=0;S2&&!this.usingDashes){var b=this.mitreShader;this.lineBufferLo.bind(),b.attributes.aLo.pointer(l.FLOAT,!1,48,0),this.lineBufferHi.bind(),b.bind();var x=b.uniforms;this.setProjectionUniforms(x,a),x.color=c,x.radius=s*u,b.attributes.aHi.pointer(l.FLOAT,!1,48,0),l.drawArrays(l.POINTS,0,i/3|0)}}}}(),f.drawPick=function(){var t=[0,0,0,0];return function(e){var r=this.vertCount,n=this.numPoints;if(this.pickOffset=e,!r)return e+n;var i=this.setProjectionModel(),a=this.plot,o=this.width,s=a.gl,l=a.pickPixelRatio,u=this.pickShader,c=this.pickBuffer;t[0]=255&e,t[1]=e>>>8&255,t[2]=e>>>16&255,t[3]=e>>>24,u.bind();var h=u.uniforms;this.setProjectionUniforms(h,i),h.width=o*l,h.pickOffset=t;var f=u.attributes;return this.lineBufferHi.bind(),f.aHi.pointer(s.FLOAT,!1,16,0),f.dHi.pointer(s.FLOAT,!1,16,8),this.lineBufferLo.bind(),f.aLo.pointer(s.FLOAT,!1,16,0),c.bind(),f.pick0.pointer(s.UNSIGNED_BYTE,!1,8,0),f.pick1.pointer(s.UNSIGNED_BYTE,!1,8,4),s.drawArrays(s.TRIANGLES,0,r),e+n}}(),f.pick=function(t,e,r){var n=this.pickOffset,i=this.numPoints;if(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]]}},f.update=function(t){t=t||{};var e,r,n,a,o,s=this.plot.gl;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]]);var h=t.dashes||[1],f=0;for(e=0;e1,this.dashPattern=l(s,u(d,[f,1,4],[1,0,0])),this.dashPattern.minFilter=s.NEAREST,this.dashPattern.magFilter=s.NEAREST,this.dashLength=f,c.free(d);var m=t.positions;this.data=m;var v=this.bounds;v[0]=v[1]=1/0,v[2]=v[3]=-1/0;var g=this.numPoints=m.length>>>1;if(0!==g){for(e=0;e1;){var A=--n;a=m[2*n],o=m[2*n+1];var T=A-1,S=m[2*T],E=m[2*T+1];if(!(isNaN(a)||isNaN(o)||isNaN(S)||isNaN(E))){k+=1,a=(a-v[0])/(v[2]-v[0]),o=(o-v[1])/(v[3]-v[1]),S=(S-v[0])/(v[2]-v[0]),E=(E-v[1])/(v[3]-v[1]);var L=S-a,C=E-o,z=A|1<<24,I=A-1,D=A,P=A-1|1<<24;y[--w]=-C,y[--w]=-L,y[--w]=o,y[--w]=a,_[--M]=z,_[--M]=I,y[--w]=C,y[--w]=L,y[--w]=E,y[--w]=S,_[--M]=D,_[--M]=P,y[--w]=-C,y[--w]=-L,y[--w]=E,y[--w]=S,_[--M]=D,_[--M]=P,y[--w]=C,y[--w]=L,y[--w]=E,y[--w]=S,_[--M]=D,_[--M]=P,y[--w]=-C,y[--w]=-L,y[--w]=o,y[--w]=a,_[--M]=z,_[--M]=I,y[--w]=C,y[--w]=L,y[--w]=o,y[--w]=a,_[--M]=z,_[--M]=I}}for(e=0;e 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}",null,a)}},{"gl-shader":253}],170:[function(t,e,r){"use strict";function n(t,e){for(var r=0,n=0;n<3;++n){var i=t[n]-e[n];r+=i*i}return Math.sqrt(r)}function i(t){for(var e=[[-1e6,-1e6,-1e6],[1e6,1e6,1e6]],r=0;r<3;++r)e[0][r]=Math.max(t[0][r],e[0][r]),e[1][r]=Math.min(t[1][r],e[1][r]);return e}function a(t,e,r,n){this.arcLength=t,this.position=e,this.index=r,this.dataCoordinate=n}function o(t,e,r,n,i,a){this.gl=t,this.shader=e,this.pickShader=r,this.buffer=n,this.vao=i,this.clipBounds=[[-1/0,-1/0,-1/0],[1/0,1/0,1/0]],this.points=[],this.arcLength=[],this.vertexCount=0,this.bounds=[[0,0,0],[0,0,0]],this.pickId=0,this.lineWidth=1,this.texture=a,this.dashScale=1,this.opacity=1,this.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=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),a=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;h<1024;++h)s.data[h]=255;var f=c(e,s);f.wrap=e.REPEAT;var p=new o(e,r,n,i,a,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"),m=p.createShader,v=p.createPickShader,g=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],y=o.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 a=t.position||t.positions;if(a){var o=t.color||t.colors||[0,0,0,1],s=t.lineWidth||1,l=[],u=[],c=[],h=0,p=0,m=[[1/0,1/0,1/0],[-1/0,-1/0,-1/0]],v=!1;t:for(e=1;e0){for(var b=0;b<24;++b)l.push(l[l.length-12]);p+=2,v=!0}continue t}m[0][r]=Math.min(m[0][r],g[r],y[r]),m[1][r]=Math.max(m[1][r],g[r],y[r])}var x,_;Array.isArray(o[0])?(x=o[e-1],_=o[e]):x=_=o,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),v){for(r=0;r<2;++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,v=!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(a[a.length-1].slice()),this.bounds=m,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;e0?(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],a=e[1],o=e[2],s=e[3],l=i+i,u=a+a,c=o+o,h=i*l,f=i*u,d=i*c,p=a*u,m=a*c,v=o*c,g=s*l,y=s*u,b=s*c,x=n[0],_=n[1],w=n[2];return t[0]=(1-(p+v))*x,t[1]=(f+b)*x,t[2]=(d-y)*x,t[3]=0,t[4]=(f-b)*_,t[5]=(1-(h+v))*_,t[6]=(m+g)*_,t[7]=0,t[8]=(d+y)*w,t[9]=(m-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 a=e[0],o=e[1],s=e[2],l=e[3],u=a+a,c=o+o,h=s+s,f=a*u,d=a*c,p=a*h,m=o*c,v=o*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-(m+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]=(v+y)*w,t[7]=0,t[8]=(p+b)*M,t[9]=(v-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],a=e[3],o=r+r,s=n+n,l=i+i,u=r*o,c=n*o,h=n*s,f=i*o,d=i*s,p=i*l,m=a*o,v=a*s,g=a*l;return t[0]=1-h-p,t[1]=c+g,t[2]=f-v,t[3]=0,t[4]=c-g,t[5]=1-u-p,t[6]=d+m,t[7]=0,t[8]=f+v,t[9]=d-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,a,o){var s=1/(r-e),l=1/(i-n),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]=(r+e)*s,t[9]=(i+n)*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,r,n,i){var a=1/Math.tan(e/2),o=1/(n-i);return t[0]=a/r,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=a,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=(i+n)*o,t[11]=-1,t[12]=0,t[13]=0,t[14]=2*i*n*o,t[15]=0,t},i.perspectiveFromFieldOfView=function(t,e,r,n){var i=Math.tan(e.upDegrees*Math.PI/180),a=Math.tan(e.downDegrees*Math.PI/180),o=Math.tan(e.leftDegrees*Math.PI/180),s=Math.tan(e.rightDegrees*Math.PI/180),l=2/(o+s),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]=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,a,o){var s=1/(e-r),l=1/(n-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+r)*s,t[13]=(i+n)*l,t[14]=(o+a)*u,t[15]=1,t},i.lookAt=function(t,e,r,a){var o,s,l,u,c,h,f,d,p,m,v=e[0],g=e[1],y=e[2],b=a[0],x=a[1],_=a[2],w=r[0],M=r[1],k=r[2];return Math.abs(v-w).999999?(n[0]=0,n[1]=0,n[2]=0,n[3]=1,n):(a.cross(t,i,o),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=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,r){r*=.5;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=o.add,s.multiply=function(t,e,r){var n=e[0],i=e[1],a=e[2],o=e[3],s=r[0],l=r[1],u=r[2],c=r[3];return t[0]=n*c+o*s+i*u-a*l,t[1]=i*c+o*l+a*s-n*u,t[2]=a*c+o*u+n*l-i*s,t[3]=o*c-n*s-i*l-a*u,t},s.mul=s.multiply,s.scale=o.scale,s.rotateX=function(t,e,r){r*=.5;var n=e[0],i=e[1],a=e[2],o=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]=a*l-i*s,t[3]=o*l-n*s,t},s.rotateY=function(t,e,r){r*=.5;var n=e[0],i=e[1],a=e[2],o=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]=a*l+n*s,t[3]=o*l-i*s,t},s.rotateZ=function(t,e,r){r*=.5;var n=e[0],i=e[1],a=e[2],o=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]=a*l+o*s,t[3]=o*l-a*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=o.dot,s.lerp=o.lerp,s.slerp=function(t,e,r,n){var i,a,o,s,l,u=e[0],c=e[1],h=e[2],f=e[3],d=r[0],p=r[1],m=r[2],v=r[3];return a=u*d+c*p+h*m+f*v,a<0&&(a=-a,d=-d,p=-p,m=-m,v=-v),1-a>1e-6?(i=Math.acos(a),o=Math.sin(i),s=Math.sin((1-n)*i)/o,l=Math.sin(n*i)/o):(s=1-n,l=n),t[0]=s*u+l*d,t[1]=s*c+l*p,t[2]=s*h+l*m,t[3]=s*f+l*v,t},s.sqlerp=function(){var t=s.create(),e=s.create();return function(r,n,i,a,o,l){return s.slerp(t,n,o,l),s.slerp(e,i,a,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],a=e[3],o=r*r+n*n+i*i+a*a,s=o?1/o:0;return t[0]=-r*s,t[1]=-n*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 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 a=(i+1)%3,o=(i+2)%3;r=Math.sqrt(e[3*i+i]-e[3*a+a]-e[3*o+o]+1),t[i]=.5*r,r=.5/r,t[3]=(e[3*a+o]-e[3*o+a])*r,t[a]=(e[3*a+i]+e[3*i+a])*r,t[o]=(e[3*o+i]+e[3*i+o])*r}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":192,"./mat3.js":195,"./vec3.js":199,"./vec4.js":200}],198:[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],a=e[1];return t[0]=i+n*(r[0]-i),t[1]=a+n*(r[1]-a),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,a,o){var s,l;for(r||(r=2),n||(n=0),l=i?Math.min(i*r+n,e.length):e.length,s=n;s0&&(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,r){var n=e[0],i=e[1],a=e[2],o=r[0],s=r[1],l=r[2];return t[0]=i*l-a*s,t[1]=a*o-n*l,t[2]=n*s-i*o,t},i.lerp=function(t,e,r,n){var i=e[0],a=e[1],o=e[2];return t[0]=i+n*(r[0]-i),t[1]=a+n*(r[1]-a),t[2]=o+n*(r[2]-o),t},i.hermite=function(t,e,r,n,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+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,a){var o=1-a,s=o*o,l=a*a,u=s*o,c=3*a*s,h=3*l*o,f=l*a;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,a=Math.sqrt(1-i*i)*e;return t[0]=Math.cos(r)*a,t[1]=Math.sin(r)*a,t[2]=i*e,t},i.transformMat4=function(t,e,r){var n=e[0],i=e[1],a=e[2],o=r[3]*n+r[7]*i+r[11]*a+r[15];return o=o||1,t[0]=(r[0]*n+r[4]*i+r[8]*a+r[12])/o,t[1]=(r[1]*n+r[5]*i+r[9]*a+r[13])/o,t[2]=(r[2]*n+r[6]*i+r[10]*a+r[14])/o,t},i.transformMat3=function(t,e,r){var n=e[0],i=e[1],a=e[2];return t[0]=n*r[0]+i*r[3]+a*r[6],t[1]=n*r[1]+i*r[4]+a*r[7],t[2]=n*r[2]+i*r[5]+a*r[8],t},i.transformQuat=function(t,e,r){var n=e[0],i=e[1],a=e[2],o=r[0],s=r[1],l=r[2],u=r[3],c=u*n+s*a-l*i,h=u*i+l*n-o*a,f=u*a+o*i-s*n,d=-o*n-s*i-l*a;return t[0]=c*u+d*-o+h*-l-f*-s,t[1]=h*u+d*-s+f*-o-c*-l,t[2]=f*u+d*-l+c*-s-h*-o,t},i.rotateX=function(t,e,r,n){var i=[],a=[];return i[0]=e[0]-r[0],i[1]=e[1]-r[1],i[2]=e[2]-r[2],a[0]=i[0],a[1]=i[1]*Math.cos(n)-i[2]*Math.sin(n),a[2]=i[1]*Math.sin(n)+i[2]*Math.cos(n),t[0]=a[0]+r[0],t[1]=a[1]+r[1],t[2]=a[2]+r[2],t},i.rotateY=function(t,e,r,n){var i=[],a=[];return i[0]=e[0]-r[0],i[1]=e[1]-r[1],i[2]=e[2]-r[2],a[0]=i[2]*Math.sin(n)+i[0]*Math.cos(n),a[1]=i[1],a[2]=i[2]*Math.cos(n)-i[0]*Math.sin(n),t[0]=a[0]+r[0],t[1]=a[1]+r[1],t[2]=a[2]+r[2],t},i.rotateZ=function(t,e,r,n){var i=[],a=[];return i[0]=e[0]-r[0],i[1]=e[1]-r[1],i[2]=e[2]-r[2],a[0]=i[0]*Math.cos(n)-i[1]*Math.sin(n),a[1]=i[0]*Math.sin(n)+i[1]*Math.cos(n),a[2]=i[2],t[0]=a[0]+r[0],t[1]=a[1]+r[1],t[2]=a[2]+r[2],t},i.forEach=function(){var t=i.create();return function(e,r,n,i,a,o){var s,l;for(r||(r=3),n||(n=0),l=i?Math.min(i*r+n,e.length):e.length,s=n;s1?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 r=t[0],i=t[1],a=t[2],o=e[0],s=e[1],l=e[2];return Math.abs(r-o)<=n.EPSILON*Math.max(1,Math.abs(r),Math.abs(o))&&Math.abs(i-s)<=n.EPSILON*Math.max(1,Math.abs(i),Math.abs(s))&&Math.abs(a-l)<=n.EPSILON*Math.max(1,Math.abs(a),Math.abs(l))},e.exports=i},{"./common.js":192}],200:[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 a=new n.ARRAY_TYPE(4);return a[0]=t,a[1]=e,a[2]=r,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,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],a=e[3]-t[3];return Math.sqrt(r*r+n*n+i*i+a*a)},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],a=e[3]-t[3];return r*r+n*n+i*i+a*a},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],a=e[3],o=r*r+n*n+i*i+a*a;return o>0&&(o=1/Math.sqrt(o),t[0]=r*o,t[1]=n*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,r,n){var i=e[0],a=e[1],o=e[2],s=e[3];return t[0]=i+n*(r[0]-i),t[1]=a+n*(r[1]-a),t[2]=o+n*(r[2]-o),t[3]=s+n*(r[3]-s),t},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],a=e[2],o=e[3];return t[0]=r[0]*n+r[4]*i+r[8]*a+r[12]*o,t[1]=r[1]*n+r[5]*i+r[9]*a+r[13]*o,t[2]=r[2]*n+r[6]*i+r[10]*a+r[14]*o,t[3]=r[3]*n+r[7]*i+r[11]*a+r[15]*o,t}, +i.transformQuat=function(t,e,r){var n=e[0],i=e[1],a=e[2],o=r[0],s=r[1],l=r[2],u=r[3],c=u*n+s*a-l*i,h=u*i+l*n-o*a,f=u*a+o*i-s*n,d=-o*n-s*i-l*a;return t[0]=c*u+d*-o+h*-l-f*-s,t[1]=h*u+d*-s+f*-o-c*-l,t[2]=f*u+d*-l+c*-s-h*-o,t[3]=e[3],t},i.forEach=function(){var t=i.create();return function(e,r,n,i,a,o){var s,l;for(r||(r=4),n||(n=0),l=i?Math.min(i*r+n,e.length):e.length,s=n;s1.0001)return null;v+=m[c]}return Math.abs(v-1)>.001?null:[h,o(t,m),m]}var l=t("barycentric"),u=t("polytope-closest-point/lib/closest_point_2d.js");e.exports=s},{barycentric:47,"polytope-closest-point/lib/closest_point_2d.js":484}],202:[function(t,e,r){var n="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}";r.meshShader={vertex:"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}",fragment:"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}",attributes:[{name:"position",type:"vec3"},{name:"normal",type:"vec3"},{name:"color",type:"vec4"},{name:"uv",type:"vec2"}]},r.wireShader={vertex:"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}",fragment:"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}",attributes:[{name:"position",type:"vec3"},{name:"color",type:"vec4"},{name:"uv",type:"vec2"}]},r.pointShader={vertex:"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}",fragment:"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}",attributes:[{name:"position",type:"vec3"},{name:"color",type:"vec4"},{name:"uv",type:"vec2"},{name:"pointSize",type:"float"}]},r.pickShader={vertex:"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}",fragment:n,attributes:[{name:"position",type:"vec3"},{name:"id",type:"vec4"}]},r.pointPickShader={vertex:"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}",fragment:n,attributes:[{name:"position",type:"vec3"},{name:"pointSize",type:"float"},{name:"id",type:"vec4"}]},r.contourShader={vertex:"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}",fragment:"precision mediump float;\n#define GLSLIFY 1\n\nuniform vec3 contourColor;\n\nvoid main() {\n gl_FragColor = vec4(contourColor,1);\n}\n",attributes:[{name:"position",type:"vec3"}]}},{}],203:[function(t,e,r){"use strict";function n(t,e,r,n,i,a,o,s,l,u,c,h,f,d,p,m,v,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=a,this.pointPickShader=o,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=v,this.edgeUVs=g,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=D,this._view=D,this._projection=D,this._resolution=[1,1]}function i(t){for(var e=w({colormap:t,nshades:256,format:"rgba"}),r=new Uint8Array(1024),n=0;n<256;++n){for(var i=e[n],a=0;a<3;++a)r[4*n+a]=i[a];r[4*n+3]=255*i[3]}return _(r,[256,256,4],[4,0,1])}function a(t,e,r){for(var n=new Array(e),i=0;i=1},P.isTransparent=function(){return this.opacity<1},P.pickSlots=1,P.setPickBase=function(t){this.pickId=t},P.highlight=function(t){if(!t||!this.contourEnable)return void(this.contourCount=0);for(var e=M(this.cells,this.intensity,t.intensity),r=e.cells,n=e.vertexIds,i=e.vertexWeights,a=r.length,o=k.mallocFloat32(6*a),s=0,l=0;l0){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()}},P.drawPick=function(t){t=t||{};for(var e=this.gl,r=t.model||D,n=t.view||D,i=t.projection||D,a=[[-1e6,-1e6,-1e6],[1e6,1e6,1e6]],o=0;o<3;++o)a[0][o]=Math.max(a[0][o],this.clipBounds[0][o]),a[1][o]=Math.min(a[1][o],this.clipBounds[1][o]);this._model=[].slice.call(r),this._view=[].slice.call(n),this._projection=[].slice.call(i),this._resolution=[e.drawingBufferWidth,e.drawingBufferHeight];var s={model:r,view:n,projection:i,clipBounds:a,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()}},P.pick=function(t){if(!t)return null;if(t.id!==this.pickId)return null;for(var e=t.value[0]+256*t.value[1]+65536*t.value[2],r=this.cells[e],n=this.positions,i=new Array(r.length),a=0;as[k]&&(a.uniforms.dataAxis=t,a.uniforms.screenOffset=e,a.uniforms.color=v[n],a.uniforms.angle=g[n],u.drawArrays(u.TRIANGLES,s[k],s[A]-s[k]))),y[n]&&M&&(e[1^n]-=T*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,M)),e[1^n]=T*c[2+(1^n)]-1,p[n+2]&&(e[1^n]+=T*d*m[n+2],ks[k]&&(a.uniforms.dataAxis=t,a.uniforms.screenOffset=e,a.uniforms.color=v[n+2],a.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],a.uniforms.dataAxis=r,a.uniforms.screenOffset=e,a.uniforms.color=x[n+2],a.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,a=r.screenBox,o=r.titleCenter,s=r.titleAngle,l=r.titleColor,u=r.pixelRatio;if(this.titleCount){for(var c=0;c<2;++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;u<2;++u){var c=a[u],h=a[u+2],f=h-c,d=.5*(o[u+2]+o[u]),p=o[u+2]-o[u],m=l[u],v=l[u+2],g=v-m,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){var e,r,n,i,a,o=[],l=t.ticks,u=t.bounds;for(a=0;a<2;++a){var c=[Math.floor(o.length/3)],h=[-1/0],f=l[a];for(e=0;er)for(t=r;te)for(t=e;t=0){for(var k=0|M.type.charAt(M.type.length-1),A=new Array(k),T=0;T=0;)S+=1;w[b]=S}var E=new Array(r.length);a(),d._relink=a,d.types={uniforms:l(r),attributes:l(n)},d.attributes=s(p,d,x,w),Object.defineProperty(d,"uniforms",o(p,d,r,E))},e.exports=a},{"./lib/GLError":211,"./lib/create-attributes":212,"./lib/create-uniforms":213,"./lib/reflect":214,"./lib/runtime-reflect":215,"./lib/shader-cache":216}],211:[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},{}],212:[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;c=0){var p=f.charCodeAt(f.length-1)-48;if(p<2||p>4)throw new s("","Invalid data type for attribute "+h+": "+f);i(t,e,d[0],n,p,o,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(p<2||p>4)throw new s("","Invalid data type for attribute "+h+": "+f);a(t,e,d,n,p,o,h)}}}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":211}],213:[function(t,e,r){"use strict";function n(t){return new Function("y","return function(){return y}")(t)}function i(t,e){for(var r=new Array(t),n=0;n4)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(i<2||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;parseInt(n)+""===n?a+="["+n+"]":a+="."+n,"object"==typeof i?r.push.apply(r,c(a,i)):r.push([a,i])}return r}function h(e){for(var n=["return function updateProperty(obj){"],i=c("",e),o=0;o4)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(r<2||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:h(i),enumerable:!0,configurable:!1})}else a[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 o||(o[l[0]]=[]),o=o[l[0]];for(var u=1;u1)for(var l=0;l=0){var m=e[p]-n[p]*(e[p+2]-e[p])/(n[p+2]-n[p]);0===p?o.drawLine(m,e[1],m,e[3],d[p],f[p]):o.drawLine(e[0],m,e[2],m,d[p],f[p])}}for(var p=0;p=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;r0){var r=Math.round(Math.pow(10,e));return Math.ceil(t/r)*r}return Math.ceil(t)}function o(t){return"boolean"!=typeof t||t}function s(t){function e(){if(!w&&G.autoResize){var t=M.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!==M.width||i!==M.height){M.width=n,M.height=i;var a=M.style;a.position=a.position||"absolute",a.left="0px",a.top="0px",a.width=e+"px",a.height=r+"px",N=!0}}}function r(){for(var t=O.length,e=j.length,r=0;r0&&0===F[e-1];)F.pop(),j.pop().dispose()}function s(){if(G.contextLost)return!0;A.isContextLost()&&(G.contextLost=!0,G.mouseListener.enabled=!1,G.selection.object=null,G.oncontextloss&&G.oncontextloss())}function b(){if(!s()){A.colorMask(!0,!0,!0,!0),A.depthMask(!0),A.disable(A.BLEND),A.enable(A.DEPTH_TEST);for(var t=O.length,e=j.length,r=0;rS.distance)continue;for(var u=0;u>>1;for(r=0;r=e[0]&&a<=e[2]&&o>=e[1]&&o<=e[3]&&n++}return n}function a(t,e){var r=t.gl,i=s(r),a=s(r),l=o(r,u.pointVertex,u.pointFragment),c=o(r,u.pickVertex,u.pickFragment),h=new n(t,i,a,l,c);return h.update(e),t.addObject(h),h}var o=t("gl-shader"),s=t("gl-buffer"),l=t("typedarray-pool"),u=t("./lib/shader");e.exports=a;var c=n.prototype;c.dispose=function(){this.shader.dispose(),this.pickShader.dispose(),this.offsetBuffer.dispose(),this.pickBuffer.dispose(),this.plot.removeObject(this)},c.update=function(t){function e(e,r){return e in t?t[e]:r}var r;t=t||{},this.sizeMin=e("sizeMin",.5),this.sizeMax=e("sizeMax",20),this.color=e("color",[1,0,0,1]).slice(),this.areaRatio=e("areaRatio",1),this.borderColor=e("borderColor",[0,0,0,1]).slice(),this.blend=e("blend",!1);var n=t.positions.length>>>1,i=t.positions instanceof Float32Array,a=t.idToIndex instanceof Int32Array&&t.idToIndex.length>=n,o=t.positions,s=i?o:l.mallocFloat32(o.length),u=a?t.idToIndex:l.mallocInt32(n);if(i||s.set(o),!a)for(s.set(o),r=0;r>8&255,e[2]=r>>16&255,e[3]=r>>24&255,this.pickBuffer.bind(),a.attributes.pickId.pointer(o.UNSIGNED_BYTE),a.uniforms.pickOffset=e,this.pickOffset=r);var f=o.getParameter(o.BLEND),d=o.getParameter(o.DITHER);return f&&!this.blend&&o.disable(o.BLEND),d&&o.disable(o.DITHER),o.drawArrays(o.POINTS,0,this.pointCount),f&&!this.blend&&o.enable(o.BLEND),d&&o.enable(o.DITHER),r+this.pointCount}}(),c.draw=c.unifiedDraw,c.drawPick=c.unifiedDraw,c.pick=function(t,e,r){var n=this.pickOffset,i=this.pointCount;if(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":220,"gl-buffer":154,"gl-shader":221,"typedarray-pool":539}],229:[function(t,e,r){function n(t,e,r,n){var i,a,o,s,l,u=e[0],c=e[1],h=e[2],f=e[3],d=r[0],p=r[1],m=r[2],v=r[3];return a=u*d+c*p+h*m+f*v,a<0&&(a=-a,d=-d,p=-p,m=-m,v=-v),1-a>1e-6?(i=Math.acos(a),o=Math.sin(i),s=Math.sin((1-n)*i)/o,l=Math.sin(n*i)/o):(s=1-n,l=n),t[0]=s*u+l*d,t[1]=s*c+l*p,t[2]=s*h+l*m,t[3]=s*f+l*v,t}e.exports=n},{}],230:[function(t,e,r){"use strict";e.exports={vertex:"precision highp float;\n#define GLSLIFY 1\n\n\nvec4 computePosition_1_0(vec2 posHi, vec2 posLo, vec2 scHi, vec2 scLo, vec2 trHi, vec2 trLo) {\n return vec4((posHi + trHi) * scHi\n \t\t\t//FIXME: this thingy does not give noticeable precision gain, need test\n + (posLo + trLo) * scHi\n + (posHi + trHi) * scLo\n + (posLo + trLo) * scLo\n , 0, 1);\n}\n\n\nattribute vec2 positionHi, positionLo;\nattribute float size, border;\nattribute vec2 char, color;\n\n//this is 64-bit form of scale and translate\nuniform vec2 scaleHi, scaleLo, translateHi, translateLo;\nuniform float pixelRatio;\nuniform vec4 viewBox;\nuniform sampler2D palette;\n\nvarying vec4 charColor, borderColor;\nvarying vec2 charId;\nvarying vec2 pointCoord;\nvarying float pointSize;\nvarying float borderWidth;\n\n\nvoid main() {\n charColor = texture2D(palette, vec2(color.x / 255., 0));\n borderColor = texture2D(palette, vec2(color.y / 255., 0));\n\n gl_PointSize = size * pixelRatio;\n pointSize = size * pixelRatio;\n\n charId = char;\n borderWidth = border;\n\n gl_Position = computePosition_1_0(\n positionHi, positionLo,\n scaleHi, scaleLo,\n translateHi, translateLo);\n\n pointCoord = viewBox.xy + (viewBox.zw - viewBox.xy) * (gl_Position.xy * .5 + .5);\n}\n",fragment:"precision highp float;\n#define GLSLIFY 1\n\nuniform sampler2D chars;\nuniform vec2 charsShape;\nuniform float charsStep, pixelRatio, charOffset;\n\nvarying vec4 borderColor;\nvarying vec4 charColor;\nvarying vec2 charId;\nvarying vec2 pointCoord;\nvarying float pointSize;\nvarying float borderWidth;\n\nvoid main() {\n\tvec2 pointUV = (pointCoord - gl_FragCoord.xy + pointSize * .5) / pointSize;\n\tpointUV.x = 1. - pointUV.x;\n\tvec2 texCoord = ((charId + pointUV) * charsStep) / charsShape;\n\tfloat dist = texture2D(chars, texCoord).r;\n\n\t//max-distance alpha\n\tif (dist < 1e-2)\n\t\tdiscard;\n\n\tfloat gamma = .0045 * charsStep / pointSize;\n\n //null-border case\n \tif (borderWidth * borderColor.a == 0.) {\n\t\tfloat charAmt = smoothstep(.748 - gamma, .748 + gamma, dist);\n\t\tgl_FragColor = vec4(charColor.rgb, charAmt*charColor.a);\n\t\treturn;\n\t}\n\n\tfloat dif = 5. * pixelRatio * borderWidth / pointSize;\n\tfloat borderLevel = .748 - dif * .5;\n\tfloat charLevel = .748 + dif * .5;\n\n\tfloat borderAmt = smoothstep(borderLevel - gamma, borderLevel + gamma, dist);\n\tfloat charAmt = smoothstep(charLevel - gamma, charLevel + gamma, dist);\n\n\tvec4 color = borderColor;\n\tcolor.a *= borderAmt;\n\n\tgl_FragColor = mix(color, charColor, charAmt);\n}\n",pickVertex:"precision highp float;\n#define GLSLIFY 1\n\nattribute vec2 positionHi, positionLo;\nattribute vec4 id;\nattribute float size;\n\nuniform vec2 scaleHi, scaleLo, translateHi, translateLo;\nuniform vec4 pickOffset;\nuniform float pixelRatio;\n\nvarying vec4 fragColor;\n\n\nvec4 computePosition_1_0(vec2 posHi, vec2 posLo, vec2 scHi, vec2 scLo, vec2 trHi, vec2 trLo) {\n return vec4((posHi + trHi) * scHi\n \t\t\t//FIXME: this thingy does not give noticeable precision gain, need test\n + (posLo + trLo) * scHi\n + (posHi + trHi) * scLo\n + (posLo + trLo) * scLo\n , 0, 1);\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_PointSize = size * .25 * pixelRatio;\n\n gl_Position = computePosition_1_0(\n positionHi, positionLo,\n scaleHi, scaleLo,\n translateHi, translateLo);\n}\n",pickFragment:"precision lowp float;\n#define GLSLIFY 1\nvarying vec4 fragColor;\nvoid main() {\n gl_FragColor = fragColor;\n}\n"}},{}],231:[function(t,e,r){arguments[4][82][0].apply(r,arguments)},{dup:82}],232:[function(t,e,r){arguments[4][210][0].apply(r,arguments)},{"./lib/GLError":233,"./lib/create-attributes":234,"./lib/create-uniforms":235,"./lib/reflect":236,"./lib/runtime-reflect":237,"./lib/shader-cache":238,dup:210}],233:[function(t,e,r){arguments[4][211][0].apply(r,arguments)},{dup:211}],234:[function(t,e,r){arguments[4][212][0].apply(r,arguments)},{"./GLError":233,dup:212}],235:[function(t,e,r){arguments[4][213][0].apply(r,arguments)},{"./GLError":233,"./reflect":236,dup:213}],236:[function(t,e,r){arguments[4][214][0].apply(r,arguments)},{dup:214}],237:[function(t,e,r){arguments[4][215][0].apply(r,arguments)},{dup:215}],238:[function(t,e,r){arguments[4][216][0].apply(r,arguments)},{"./GLError":233,dup:216,"gl-format-compiler-error":163,"weakmap-shim":560}],239:[function(t,e,r){"use strict";function n(t,e,r,n,a){a<=4*f?i(0,a-1,t,e,r,n):h(0,a-1,t,e,r,n)}function i(t,e,r,n,i,a){for(var o=t+1;o<=e;++o){for(var s=r[o],l=n[2*o],u=n[2*o+1],c=i[o],h=a[o],f=o;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],a[f]=a[f-1],f-=1}r[f]=s,n[2*f]=l,n[2*f+1]=u,i[f]=c,a[f]=h}}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],h=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]=h}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 h(t,e,r,n,d,p){var m=(e-t+1)/6|0,v=t+m,g=e-m,y=t+e>>1,b=y-m,x=y+m,_=v,w=b,M=y,k=x,A=g,T=t+1,S=e-1,E=0;u(_,w,r,n,d,p)&&(E=_,_=w,w=E),u(k,A,r,n,d,p)&&(E=k,k=A,A=E),u(_,M,r,n,d,p)&&(E=_,_=M,M=E),u(w,M,r,n,d,p)&&(E=w,w=M,M=E),u(_,k,r,n,d,p)&&(E=_,_=k,k=E),u(M,k,r,n,d,p)&&(E=M,M=k,k=E),u(w,A,r,n,d,p)&&(E=w,w=A,A=E),u(w,M,r,n,d,p)&&(E=w,w=M,M=E),u(k,A,r,n,d,p)&&(E=k,k=A,A=E);var L=r[w],C=n[2*w],z=n[2*w+1],I=d[w],D=p[w],P=r[k],O=n[2*k],R=n[2*k+1],F=d[k],j=p[k],N=_,B=M,U=A,V=v,H=y,q=g,G=r[N],Y=r[B],X=r[U];r[V]=G,r[H]=Y,r[q]=X;for(var W=0;W<2;++W){var Z=n[2*N+W],J=n[2*B+W],K=n[2*U+W];n[2*V+W]=Z,n[2*H+W]=J,n[2*q+W]=K}var Q=d[N],$=d[B],tt=d[U];d[V]=Q,d[H]=$,d[q]=tt;var et=p[N],rt=p[B],nt=p[U];p[V]=et,p[H]=rt,p[q]=nt,o(b,t,r,n,d,p),o(x,e,r,n,d,p);for(var it=T;it<=S;++it)if(c(it,L,C,z,I,r,n,d))it!==T&&a(it,T,r,n,d,p),++T;else if(!c(it,P,O,R,F,r,n,d))for(;;){if(c(S,P,O,R,F,r,n,d)){c(S,L,C,z,I,r,n,d)?(s(it,T,S,r,n,d,p),++T,--S):(a(it,S,r,n,d,p),--S);break}if(--S=Math.max(.9*d,32)){var b=u+s>>>1;l(v,g,h,f,b,c+1),f=b}l(v,g,h,f,y,c+1),f=y}}}var u=t.length>>>1;if(u<1)return[];for(var c=1/0,h=1/0,f=-1/0,d=-1/0,p=0;p=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)),o.free(x),w}var o=t("typedarray-pool"),s=t("./lib/sort");e.exports=a},{"./lib/sort":239,"typedarray-pool":539}],241:[function(t,e,r){"use strict";function n(t,e,r,n,i,a,o,s){this.plot=t,this.shader=e,this.pickShader=r,this.positionBuffer=n,this.sizeBuffer=i,this.colorBuffer=a,this.idBuffer=o,this.charBuffer=s,this.pointCount=0,this.pickOffset=0,this.points=null,this.scales=[],this.xCoords=[],this.charCanvas=document.createElement("canvas"),this.charTexture=m(this.plot.gl,this.charCanvas),this.charStep=400,this.charFit=.255,this.snapThreshold=1e4,this.paletteTexture=m(this.plot.gl,[256,1])}function i(){var t=this.plot,e=t.viewBox,r=t.dataBox,n=t.pixelRatio,i=r[2]-r[0],a=r[3]-r[1],u=2/i,c=2/a,h=-r[0]-.5*i,f=-r[1]-.5*a;_[0]=u,w[0]=u-_[0],_[1]=c,w[1]=c-_[1],M[0]=h,k[0]=h-M[0],M[1]=f,k[1]=f-M[1];var d=e[2]-e[0],p=e[3]-e[1];o=Math.min(i/d,a/p),A[0]=2*n/d,A[1]=2*n/p,s=r[0],l=r[2]}function a(t,e){var r=t.gl,i=u(r,f.vertex,f.fragment),a=u(r,f.pickVertex,f.pickFragment),o=c(r),s=c(r),l=c(r),h=c(r),d=c(r),p=new n(t,i,a,o,s,l,h,d);return p.update(e),t.addObject(p),p}e.exports=a;var o,s,l,u=t("gl-shader"),c=t("gl-buffer"),h=t("typedarray-pool"),f=t("./lib/shaders"),d=t("snap-points-2d"),p=t("font-atlas-sdf"),m=t("gl-texture2d"),v=t("color-id"),g=t("ndarray"),y=t("clamp"),b=t("binary-search-bounds"),x=n.prototype,_=new Float32Array([0,0]),w=new Float32Array([0,0]),M=new Float32Array([0,0]),k=new Float32Array([0,0]),A=[0,0],T=[0,0,0,0];x.drawPick=function(t){var e=void 0!==t,r=this.plot,n=this.pointCount,a=n>this.snapThreshold;if(!n)return t;i.call(this);var u=r.gl,c=e?this.pickShader:this.shader,h=u.isEnabled(u.BLEND);if(c.bind(),e){this.pickOffset=t;for(var f=0;f<4;++f)T[f]=t>>8*f&255;c.uniforms.pickOffset=T,this.idBuffer.bind(),c.attributes.id.pointer(u.UNSIGNED_BYTE,!1)}else u.blendFuncSeparate(u.SRC_ALPHA,u.ONE_MINUS_SRC_ALPHA,u.ONE,u.ONE_MINUS_SRC_ALPHA),u.blendColor(0,0,0,1),h||u.enable(u.BLEND),this.colorBuffer.bind(),c.attributes.color.pointer(u.UNSIGNED_BYTE,!1),this.charBuffer.bind(),c.attributes.char.pointer(u.UNSIGNED_BYTE,!1),c.uniforms.chars=this.charTexture.bind(0),c.uniforms.charsShape=[this.charCanvas.width,this.charCanvas.height],c.uniforms.charsStep=this.charStep,c.uniforms.palette=this.paletteTexture.bind(1);this.sizeBuffer.bind(),c.attributes.size.pointer(u.FLOAT,!1,8,0),e||c.attributes.border.pointer(u.FLOAT,!1,8,4),this.positionBuffer.bind(),c.attributes.positionHi.pointer(u.FLOAT,!1,16,0),c.attributes.positionLo.pointer(u.FLOAT,!1,16,8),c.uniforms.pixelRatio=r.pixelRatio,c.uniforms.scaleHi=_,c.uniforms.scaleLo=w,c.uniforms.translateHi=M,c.uniforms.translateLo=k,c.uniforms.viewBox=r.viewBox;var d=this.scales;if(a)for(var p=d.length-1;p>=0;p--){var m=d[p];if(!(m.pixelSize&&m.pixelSize<1.25*o&&p>1)){var v=m.offset,g=m.count+v,y=b.ge(this.xCoords,s,v,g-1),x=b.lt(this.xCoords,l,y,g-1)+1;x>y&&u.drawArrays(u.POINTS,y,x-y)}}else u.drawArrays(u.POINTS,0,n);if(e)return t+n;h?u.blendFunc(u.ONE,u.ONE_MINUS_SRC_ALPHA):u.disable(u.BLEND)},x.draw=x.drawPick,x.pick=function(t,e,r){var n=this.pickOffset,i=this.pointCount;if(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]]}},x.update=function(t){t=t||{};var e=t.positions||[],r=t.colors||[],n=t.glyphs||[],i=t.sizes||[],a=t.borderWidths||[],o=t.borderColors||[],s=this.plot.gl,l=this.pointCount,u=l>this.snapThreshold;if(null!=t.positions){this.points=e,l=this.points.length/2,u=l>this.snapThreshold;var c=h.mallocFloat32(2*l),f=h.mallocFloat64(2*l),m=h.mallocUint32(l),b=h.mallocFloat32(4*l);f.set(this.points),u&&(this.i2idx&&h.free(this.i2idx),this.i2idx=h.mallocInt32(l),this.scales=d(f,this.i2idx,c)),this.pointCount=l;for(var x=0;xF&&(F=i[x]);var j=this.charStep;this.charStep=y(Math.ceil(4*F),128,768);var N=Object.keys(O),B=this.charStep,U=Math.floor(B/2),V=s.getParameter(s.MAX_TEXTURE_SIZE),H=V/B*(V/B),q=Math.min(V,B*N.length),G=Math.min(V,B*Math.ceil(B*N.length/V)),Y=Math.floor(q/B);N.length>H&&console.warn("gl-scatter2d-fancy: number of characters is more than maximum texture size. Try reducing it."),this.chars&&this.chars+""==N+""&&this.charStep==j||(this.charCanvas=p({canvas:this.charCanvas,family:"sans-serif",size:U,shape:[q,G],step:[B,B],chars:N,align:!0,fit:this.charFit}),this.chars=N);for(var x=0;x>>1,n=u.mallocInt32(r),i=u.mallocFloat32(r),a=u.mallocFloat64(2*r);if(a.set(this.points),this.snapPoints)this.scales=l(a,n,i,this.bounds);else{this.bounds=f(a,2),h(a,2,this.bounds);for(var o=0;o>8&255,y[2]=t>>16&255,y[3]=t>>24&255,n.uniforms.pickOffset=y,s.bind(),n.attributes.pickId.pointer(h.UNSIGNED_BYTE)):(n.uniforms.useWeight=1,this.weightBuffer.bind(),n.attributes.weight.pointer());var z=!0;if(this.snapPoints)for(var I=i.length-1;I>=0;I--){var D=i[I];if(!(D.pixelSize1)){var P=this.getVisibleRange(D),O=P[0],R=P[1];R>O&&h.drawArrays(h.POINTS,O,R-O),!e&&z&&(z=!1,n.uniforms.useWeight=0)}}else h.drawArrays(h.POINTS,0,this.pointCount);return t+this.pointCount},d.getVisibleRange=function(t){var e=this.plot.dataBox,r=this.bounds,n=this.pixelSize,i=this.size,a=this.plot.pixelRatio,o=r[2]-r[0];r[3],r[1];if(!t)for(var t,l=this.scales.length-1;l>=0&&(t=this.scales[l],t.pixelSize1);l--);var u=this.xCoords,c=(e[0]-r[0]-n*i*a)/o,h=(e[2]-r[0]+n*i*a)/o,f=t.offset,d=t.count+f,p=s.ge(u,c,f,d-1);return[p,s.lt(u,h,p,d-1)+1]},d.drawPick=d.draw,d.pick=function(t,e,r){var n=r-this.pickOffset;return n<0||n>=this.pointCount?null:{object:this,pointId:n,dataCoord:[this.points[2*n],this.points[2*n+1]]}}},{"./lib/shader":242,"array-bounds":42,"array-normalize":43,"binary-search-bounds":243,"gl-buffer":154,"gl-shader":253,"snap-points-2d":245,"typedarray-pool":539}],247:[function(t,e,r){"use strict";function n(t,e){var r=a[e];if(r||(r=a[e]={}),t in r)return r[t];for(var n=i(t,{textAlign:"center",textBaseline:"middle",lineHeight:1,font:e}),o=i(t,{triangles:!0,textAlign:"center",textBaseline:"middle",lineHeight:1,font:e}),s=[[1/0,1/0],[-1/0,-1/0]],l=0;lMath.abs(R[1])){var F=O;O=R,R=F,F=D,D=P,P=F;var j=z;z=I,I=j}O[0]<0&&(D[z]=-1),R[1]>0&&(P[I]=-1);for(var N=0,B=0,C=0;C<4;++C)N+=Math.pow(p[4*z+C],2),B+=Math.pow(p[4*I+C],2);D[z]/=Math.sqrt(N),P[I]/=Math.sqrt(B),d.axes[0]=D,d.axes[1]=P, +d.fragClipBounds[0]=u(E,b[0],_,-1e8),d.fragClipBounds[1]=u(E,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,a){var o=r.gl;if(r.vao.bind(),i===r.opacity<1||a){t.bind();var s=t.uniforms;s.model=n.model||x,s.view=n.view||x,s.projection=n.projection||x,w[0]=2/o.drawingBufferWidth,w[1]=2/o.drawingBufferHeight,s.screenSize=w,s.highlightId=r.highlightId,s.highlightScale=r.highlightScale,s.fragClipBounds=I,s.clipBounds=r.axes.bounds,s.opacity=r.opacity,s.pickGroup=r.pickId/255,s.pixelRatio=r.pixelRatio,r.vao.draw(o.TRIANGLES,r.vertexCount),r.lineWidth>0&&(o.lineWidth(r.lineWidth),r.vao.draw(o.LINES,r.lineVertexCount,r.vertexCount))}h(e,r,n,i,a),r.vao.unbind()}function d(t){var e=t.gl,r=y.createPerspective(e),n=y.createOrtho(e),i=y.createProject(e),a=y.createPickPerspective(e),s=y.createPickOrtho(e),l=y.createPickProject(e),u=p(e),c=p(e),h=p(e),f=p(e),d=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}]),v=new o(e,r,n,i,u,c,h,f,d,a,s,l);return v.update(t),v}var p=t("gl-buffer"),m=t("gl-vao"),v=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 _=o.prototype;_.pickSlots=1,_.setPickBase=function(t){this.pickId=t},_.isTransparent=function(){if(this.opacity<1)return!0;for(var t=0;t<3;++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;t<3;++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],S=x.slice(),E=[0,0,0],L=[[0,0,0],[0,0,0]],C=[-1e8,-1e8,-1e8],z=[1e8,1e8,1e8],I=[C,z];_.draw=function(t){f(this.useOrtho?this.orthoShader:this.shader,this.projectShader,this,t,!1,!1)},_.drawTransparent=function(t){f(this.useOrtho?this.orthoShader:this.shader,this.projectShader,this,t,!0,!1)},_.drawPick=function(t){f(this.useOrtho?this.pickOrthoShader:this.pickPerspectiveShader,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||e<0)return null;var r=this.points[e],n=this._selectResult;n.index=e;for(var i=0;i<3;++i)n.position[i]=n.dataCoordinate[i]=r[i];return n},_.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",a=t.alignment||[0,0],o=[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,m=0,g=n.length;t:for(var y=0;y0&&(z[0]=-a[0]*(1+A[0][0]));for(var H=M.cells,q=M.positions,_=0;_0){var g=r*c;o.drawBox(h-g,f-g,d+g,f+g,a),o.drawBox(h-g,p-g,d+g,p+g,a),o.drawBox(h-g,f-g,h+g,p+g,a),o.drawBox(d-g,f-g,d+g,p+g,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":250,"gl-buffer":154,"gl-shader":253}],252:[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){return new i(t,o(t,e),s.mallocUint8(e[0]*e[1]*4))}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(_inline_46_arg0_<255||_inline_46_arg1_<255||_inline_46_arg2_<255||_inline_46_arg3_<255){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;i=0){for(var k=0|M.type.charAt(M.type.length-1),A=new Array(k),T=0;T=0;)S+=1;_[w]=S}var E=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,E))},e.exports=a},{"./lib/GLError":254,"./lib/create-attributes":255,"./lib/create-uniforms":256,"./lib/reflect":257,"./lib/runtime-reflect":258,"./lib/shader-cache":259}],254:[function(t,e,r){arguments[4][211][0].apply(r,arguments)},{dup:211}],255:[function(t,e,r){arguments[4][212][0].apply(r,arguments)},{"./GLError":254,dup:212}],256:[function(t,e,r){arguments[4][213][0].apply(r,arguments)},{"./GLError":254,"./reflect":257,dup:213}],257:[function(t,e,r){arguments[4][214][0].apply(r,arguments)},{dup:214}],258:[function(t,e,r){arguments[4][215][0].apply(r,arguments)},{dup:215}],259:[function(t,e,r){arguments[4][216][0].apply(r,arguments)},{"./GLError":254,dup:216,"gl-format-compiler-error":163,"weakmap-shim":560}],260:[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)}},{}],261:[function(t,e,r){"use strict";var n=t("gl-shader");e.exports=function(t){return n(t,"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","precision mediump float;\n#define GLSLIFY 1\n\nvarying vec4 fragColor;\n\nvoid main() {\n gl_FragColor = fragColor;\n}",null,[{name:"position",type:"vec3"},{name:"color",type:"vec3"},{name:"weight",type:"float"}])}},{"gl-shader":253}],262:[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,a,o){var s=[t,e,r,0,0,0,1];s[n+3]=1,s[n]=a,i.push.apply(i,s),s[6]=-1,i.push.apply(i,s),s[n]=o,i.push.apply(i,s),i.push.apply(i,s),s[6]=1,i.push.apply(i,s),s[n]=a,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=a(t,i),u=o(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 a=t("gl-buffer"),o=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,a=t.model||l,o=t.view||l,s=t.projection||l;this.axes&&(i=this.axes.lastCubeProps.axis);for(var u=c,d=h,p=0;p<3;++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=a,n.uniforms.view=o,n.uniforms.projection=s,n.uniforms.coordinates=[this.position,u,d],n.uniforms.colors=this.colors,n.uniforms.screenShape=f;for(var p=0;p<3;++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":261,"gl-buffer":154,"gl-vao":269}],263:[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;\nuniform sampler2D colormap;\n\nvarying float value, kill;\nvarying vec3 worldCoordinate;\nvarying vec2 planeCoordinate;\nvarying vec3 lightDirection, eyeDirection, surfaceNormal;\nvarying vec4 vColor;\n\nvoid main() {\n 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 vColor = texture2D(colormap, vec2(value, value));\n\n //Lighting geometry parameters\n vec4 cameraCoordinate = view * worldPosition;\n cameraCoordinate.xyz /= cameraCoordinate.w;\n lightDirection = lightPosition - cameraCoordinate.xyz;\n eyeDirection = eyePosition - cameraCoordinate.xyz;\n surfaceNormal = normalize((vec4(normal,0) * inverseModel).xyz);\n}\n",a="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;\nuniform float vertexColor;\n\nvarying float value, kill;\nvarying vec3 worldCoordinate;\nvarying vec3 lightDirection, eyeDirection, surfaceNormal;\nvarying vec4 vColor;\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 = max(beckmannSpecular_1_1(L, V, N, roughness), 0.);\n float diffuse = min(kambient + kdiffuse * max(dot(N, L), 0.0), 1.0);\n\n //decide how to interpolate color \u2014 in vertex or in fragment\n vec4 surfaceColor = step(vertexColor, .5) * texture2D(colormap, vec2(value, value)) + step(.5, vertexColor) * vColor;\n\n vec4 litColor = surfaceColor.a * vec4(diffuse * surfaceColor.rgb + kspecular * vec3(1,1,1) * specular, 1.0);\n\n gl_FragColor = mix(litColor, contourColor, contourTint) * opacity;\n}\n",o="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;\nuniform sampler2D colormap;\n\nvarying float value, kill;\nvarying vec3 worldCoordinate;\nvarying vec2 planeCoordinate;\nvarying vec3 lightDirection, eyeDirection, surfaceNormal;\nvarying vec4 vColor;\n\nvoid main() {\n vec3 dataCoordinate = permutation * vec3(uv.xy, height);\n 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 vColor = texture2D(colormap, vec2(value, value));\n\n //Don't do lighting for contours\n surfaceNormal = vec3(1,0,0);\n eyeDirection = vec3(0,1,0);\n lightDirection = vec3(0,0,1);\n}\n",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,a,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,o,a,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,o,s,null,[{name:"uv",type:"vec4"},{name:"f",type:"float"}]);return e.attributes.uv.location=0,e.attributes.f.location=1,e}},{"gl-shader":253}],264:[function(t,e,r){"use strict";function n(t,e,r,n,i){this.position=t,this.index=e,this.uv=r,this.level=n,this.dataCoordinate=i}function i(t){var e=x([y({colormap:t,nshades:R,format:"rgba"}).map(function(t){return[t[0],t[1],t[2],255*t[3]]})]);return b.divseq(e,255),e}function a(t,e,r,i,a,o,s,l,u,c,h,f,d,p){this.gl=t,this.shape=e,this.bounds=r,this.intensityBounds=[],this._shader=i,this._pickShader=a,this._coordinateBuffer=o,this._vao=s,this._colorMap=l,this._contourShader=u,this._contourPickShader=c,this._contourBuffer=h,this._contourVAO=f,this._contourOffsets=[[],[],[]],this._contourCounts=[[],[],[]],this._vertexCount=0,this._pickResult=new n([0,0,0],[0,0],[0,0],[0,0,0],[0,0,0]),this._dynamicBuffer=d,this._dynamicVAO=p,this._dynamicOffsets=[0,0,0],this._dynamicCounts=[0,0,0],this.contourWidth=[1,1,1],this.contourLevels=[[1],[1],[1]],this.contourTint=[0,0,0],this.contourColor=[[.5,.5,.5,1],[.5,.5,.5,1],[.5,.5,.5,1]],this.showContour=!0,this.showSurface=!0,this.enableHighlight=[!0,!0,!0],this.highlightColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.highlightTint=[1,1,1],this.highlightLevel=[-1,-1,-1],this.enableDynamic=[!0,!0,!0],this.dynamicLevel=[NaN,NaN,NaN],this.dynamicColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.dynamicTint=[1,1,1],this.dynamicWidth=[1,1,1],this.axesBounds=[[1/0,1/0,1/0],[-1/0,-1/0,-1/0]],this.surfaceProject=[!1,!1,!1],this.contourProject=[[!1,!1,!1],[!1,!1,!1],[!1,!1,!1]],this.colorBounds=[!1,!1],this._field=[_(g.mallocFloat(1024),[0,0]),_(g.mallocFloat(1024),[0,0]),_(g.mallocFloat(1024),[0,0])],this.pickId=1,this.clipBounds=[[-1/0,-1/0,-1/0],[1/0,1/0,1/0]],this.snapToData=!1,this.opacity=1,this.lightPosition=[10,1e4,0],this.ambientLight=.8,this.diffuseLight=.8,this.specularLight=2,this.roughness=.5,this.fresnel=1.5,this.vertexColor=0,this.dirty=!0}function o(t,e){var r,n,i,a=e.axes&&e.axes.lastCubeProps.axis||j,o=e.showSurface,s=e.showContour;for(r=0;r<3;++r)for(o=o||e.surfaceProject[r],n=0;n<3;++n)s=s||e.contourProject[r][n];for(r=0;r<3;++r){var l=N.projections[r];for(n=0;n<16;++n)l[n]=0;for(n=0;n<4;++n)l[5*n]=1;l[5*r]=0,l[12+r]=e.axesBounds[+(a[r]>0)][r],M(l,t.model,l);var u=N.clipBounds[r];for(i=0;i<2;++i)for(n=0;n<3;++n)u[i][n]=t.clipBounds[i][n];u[0][r]=-1e8,u[1][r]=1e8}return N.showSurface=o,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||D,n.view=t.view||D,n.projection=t.projection||D,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;i<2;++i)for(var a=n.clipBounds[i],s=0;s<3;++s)a[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,n.vertexColor=this.vertexColor;var l=U;for(M(l,n.view,n.model),M(l,n.projection,l),k(l,l),i=0;i<3;++i)n.eyePosition[i]=l[12+i]/l[15];var u=l[15];for(i=0;i<3;++i)u+=this.lightPosition[i]*l[4*i+3];for(i=0;i<3;++i){var c=l[12+i];for(s=0;s<3;++s)c+=l[4*s+i]*this.lightPosition[s];n.lightPosition[i]=c/u}var h=o(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;i<3;++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;i<3;++i)for(f.uniforms.permutation=O[i],r.lineWidth(this.contourWidth[i]),s=0;s=1)return!0;for(var t=0;t<3;++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:[D.slice(),D.slice(),D.slice()],clipBounds:[[[0,0,0],[0,0,0]],[[0,0,0],[0,0,0]],[[0,0,0],[0,0,0]]]},B={model:D,view:D,projection:D,inverseModel:D.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,vertexColor:0},U=D.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 H={model:D,view:D,projection:D,inverseModel:D,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=H;r.model=t.model||D,r.view=t.view||D,r.projection=t.projection||D,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;n<2;++n)for(var i=r.clipBounds[n],a=0;a<3;++a)i[a]=Math.min(Math.max(this.clipBounds[n][a],-1e8),1e8);var s=o(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;n<3;++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(),a=0;a<3;++a)for(e.lineWidth(this.contourWidth[a]),l.uniforms.permutation=O[a],n=0;n>4)/16)/255,i=Math.floor(n),a=n-i,o=e[1]*(t.value[1]+(15&t.value[2])/16)/255,s=Math.floor(o),l=o-s;i+=1,s+=1;var u=r.position;u[0]=u[1]=u[2]=0;for(var c=0;c<2;++c)for(var h=c?a:1-a,f=0;f<2;++f)for(var d=f?l:1-l,p=i+c,m=s+f,v=h*d,g=0;g<3;++g)u[g]+=this._field[g].get(p,m)*v;for(var y=this._pickResult.level,b=0;b<3;++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]=a<.5?i:i+1,r.index[1]=l<.5?s:s+1,r.uv[0]=n/e[0],r.uv[1]=o/e[1],g=0;g<3;++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),"vertexColor"in t&&(this.vertexColor=t.vertexColor?1:0);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 a=this.shape,o=0;o<2;++o)this._field[2].size>this._field[o].data.length&&(g.freeFloat(this._field[o].data),this._field[o].data=g.mallocFloat(this._field[2].size)),this._field[o]=_(this._field[o].data,[a[0]+2,a[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(o=0;o<2;++o){var c=s[o];for(y=0;y<2;++y)if(c.shape[y]!==a[y])throw new Error("gl-surface: coords have incorrect shape");l(this._field[o],c)}}else if(t.ticks){var f=t.ticks;if(!Array.isArray(f)||2!==f.length)throw new Error("gl-surface: invalid ticks");for(o=0;o<2;++o){var p=f[o];if((Array.isArray(p)||p.length)&&(p=_(p)),p.shape[0]!==a[o])throw new Error("gl-surface: invalid tick length");var m=_(p.data,a);m.stride[o]=p.stride[0],m.stride[1^o]=0,l(this._field[o],m)}}else{for(o=0;o<2;++o){var v=[0,0];v[o]=1,this._field[o]=_(this._field[o].data,[a[0]+2,a[1]+2],v,0)}this._field[0].set(0,0,0);for(var y=0;y0){for(var xt=0;xt<5;++xt)tt.pop();H-=1}continue t}tt.push(it[0],it[1],st[0],st[1],it[2]),H+=1}}nt.push(H)}this._contourOffsets[et]=rt,this._contourCounts[et]=nt}var _t=g.mallocFloat(tt.length);for(o=0;oi||r<0||r>i)throw new Error("gl-texture2d: Invalid texture size");return t._shape=[e,r],t.bind(),n.texImage2D(n.TEXTURE_2D,0,t.format,e,r,0,t.format,t.type,null),t._mipLevels=[0],t}function o(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 s(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 l(t,e,r,n,i,a,o,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,d=s(c,l.stride.slice());"float32"===u?h=t.FLOAT:"float64"===u?(h=t.FLOAT,d=!1,u="float32"):"uint8"===u?h=t.UNSIGNED_BYTE:(h=t.UNSIGNED_BYTE,d=!1,u="uint8");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}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 g=l.size,y=o.indexOf(n)<0;if(y&&o.push(n),h===a&&d)0===l.offset&&l.data.length===g?y?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):y?t.texImage2D(t.TEXTURE_2D,n,i,c[0],c[1],0,i,a,l.data.subarray(l.offset,l.offset+g)):t.texSubImage2D(t.TEXTURE_2D,n,e,r,c[0],c[1],i,a,l.data.subarray(l.offset,l.offset+g));else{var b;b=a===t.FLOAT?v.mallocFloat32(g):v.mallocUint8(g);var _=p(b,c,[c[2],c[2]*c[0],1]);h===t.FLOAT&&a===t.UNSIGNED_BYTE?x(_,l):m.assign(_,l),y?t.texImage2D(t.TEXTURE_2D,n,i,c[0],c[1],0,i,a,b.subarray(0,g)):t.texSubImage2D(t.TEXTURE_2D,n,e,r,c[0],c[1],i,a,b.subarray(0,g)),a===t.FLOAT?v.freeFloat32(b):v.freeUint8(b)}}function u(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 c(t,e,r,n,i){var a=t.getParameter(t.MAX_TEXTURE_SIZE);if(e<0||e>a||r<0||r>a)throw new Error("gl-texture2d: Invalid texture shape");if(i===t.FLOAT&&!t.getExtension("OES_texture_float"))throw new Error("gl-texture2d: Floating point textures not supported on this platform");var s=u(t);return t.texImage2D(t.TEXTURE_2D,0,n,e,r,0,n,i,null),new o(t,s,e,r,n,i)}function h(t,e,r,n,i,a){var s=u(t);return t.texImage2D(t.TEXTURE_2D,0,i,i,a,e),new o(t,s,r,n,i,a)}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 a=s(n,e.stride.slice()),l=0;"float32"===r?l=t.FLOAT:"float64"===r?(l=t.FLOAT,a=!1,r="float32"):"uint8"===r?l=t.UNSIGNED_BYTE:(l=t.UNSIGNED_BYTE,a=!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}}l!==t.FLOAT||t.getExtension("OES_texture_float")||(l=t.UNSIGNED_BYTE,a=!1);var h,f,d=e.size;if(a)h=0===e.offset&&e.data.length===d?e.data:e.data.subarray(e.offset,e.offset+d);else{var g=[n[2],n[2]*n[0],1];f=v.malloc(d,r);var y=p(f,n,g,0);"float32"!==r&&"float64"!==r||l!==t.UNSIGNED_BYTE?m.assign(y,e):x(y,e),h=f.subarray(0,d)}var b=u(t);return t.texImage2D(t.TEXTURE_2D,0,c,n[0],n[1],0,c,l,h),a||v.free(f),new o(t,b,n[0],n[1],c,l)}function d(t){if(arguments.length<=1)throw new Error("gl-texture2d: Missing arguments for texture2d constructor");if(g||n(t),"number"==typeof arguments[1])return c(t,arguments[1],arguments[2],arguments[3]||t.RGBA,arguments[4]||t.UNSIGNED_BYTE);if(Array.isArray(arguments[1]))return c(t,0|arguments[1][0],0|arguments[1][1],arguments[2]||t.RGBA,arguments[3]||t.UNSIGNED_BYTE);if("object"==typeof arguments[1]){var e=arguments[1],r=i(e)?e:e.raw;if(r)return h(t,r,0|e.width,0|e.height,arguments[2]||t.RGBA,arguments[3]||t.UNSIGNED_BYTE);if(e.shape&&e.data&&e.stride)return f(t,e)}throw new Error("gl-texture2d: Invalid arguments for texture2d constructor")}var p=t("ndarray"),m=t("ndarray-ops"),v=t("typedarray-pool");e.exports=d;var g=null,y=null,b=null,x=function(t,e){m.muls(t,e,255)},_=o.prototype;Object.defineProperties(_,{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)),y.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)),y.indexOf(t)<0)throw new Error("gl-texture2d: Unknown filter mode "+t);return e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,t),this._magFilter=t}},mipSamples:{get:function(){return this._anisoSamples},set:function(t){var e=this._anisoSamples;if(this._anisoSamples=0|Math.max(t,1),e!==this._anisoSamples){var r=this.gl.getExtension("EXT_texture_filter_anisotropic");r&&this.gl.texParameterf(this.gl.TEXTURE_2D,r.TEXTURE_MAX_ANISOTROPY_EXT,this._anisoSamples)}return this._anisoSamples}},wrapS:{get:function(){return this._wrapS},set:function(t){if(this.bind(),b.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(),b.indexOf(t)<0)throw new Error("gl-texture2d: Unknown wrap mode "+t);return this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,t),this._wrapT=t}},wrap:{get:function(){return this._wrapVector},set:function(t){if(Array.isArray(t)||(t=[t,t]),2!==t.length)throw new Error("gl-texture2d: Must specify wrap mode for rows and columns");for(var e=0;e<2;++e)if(b.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 a(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,a(this,t,this._shape[1]),t}},height:{get:function(){return this._shape[1]},set:function(t){return t|=0,a(this,this._shape[0],t),t}}}),_.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},_.dispose=function(){this.gl.deleteTexture(this.handle)},_.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)},_.setPixels=function(t,e,r,n){var a=this.gl;this.bind(),Array.isArray(e)?(n=r,r=0|e[1],e=0|e[0]):(e=e||0,r=r||0),n=n||0;var o=i(t)?t:t.raw;if(o){this._mipLevels.indexOf(n)<0?(a.texImage2D(a.TEXTURE_2D,0,this.format,this.format,this.type,o),this._mipLevels.push(n)):a.texSubImage2D(a.TEXTURE_2D,n,e,r,this.format,this.type,o)}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||e<0||r<0)throw new Error("gl-texture2d: Texture dimensions are out of bounds");l(a,e,r,n,this.format,this.type,this._mipLevels,t)}}},{ndarray:465,"ndarray-ops":459,"typedarray-pool":539}],266:[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;i0&&(a=1/Math.sqrt(a),t[0]=e[0]*a,t[1]=e[1]*a,t[2]=e[2]*a),t}e.exports=n},{}],275:[function(t,e,r){function n(t,e,r){var n=e[0],i=e[1],a=e[2],o=e[3];return t[0]=r[0]*n+r[4]*i+r[8]*a+r[12]*o,t[1]=r[1]*n+r[5]*i+r[9]*a+r[13]*o,t[2]=r[2]*n+r[6]*i+r[10]*a+r[14]*o,t[3]=r[3]*n+r[7]*i+r[11]*a+r[15]*o,t}e.exports=n},{}],276:[function(t,e,r){function n(t,e,r,n){return i[0]=n,i[1]=r,i[2]=e,i[3]=t,a[0]}e.exports=n;var i=new Uint8Array(4),a=new Float32Array(i.buffer)},{}],277:[function(t,e,r){function n(t){for(var e=Array.isArray(t)?t:i(t),r=0;r0)continue;n=t.slice(0,1).join("")}return e(n),G+=n.length,U=U.slice(n.length),U.length}}function z(){return/[^a-fA-F0-9]/.test(O)?(e(U.join("")),B=u,j):(U.push(O),R=O,j+1)}function I(){return"."===O?(U.push(O),B=v,R=O,j+1):/[eE]/.test(O)?(U.push(O),B=v,R=O,j+1):"x"===O&&1===U.length&&"0"===U[0]?(B=w,U.push(O),R=O,j+1):/[^\d]/.test(O)?(e(U.join("")),B=u,j):(U.push(O),R=O,j+1)}function D(){return"f"===O&&(U.push(O),R=O,j+=1),/[eE]/.test(O)?(U.push(O),R=O,j+1):"-"===O&&/[eE]/.test(R)?(U.push(O),R=O,j+1):/[^\d]/.test(O)?(e(U.join("")),B=u,j):(U.push(O),R=O,j+1)}function P(){if(/[^\d\w_]/.test(O)){var t=U.join("");return B=J.indexOf(t)>-1?b:Z.indexOf(t)>-1?y:g,e(U.join("")),B=u,j}return U.push(O),R=O,j+1}var O,R,F,j=0,N=0,B=u,U=[],V=[],H=1,q=0,G=0,Y=!1,X=!1,W="";t=t||{};var Z=o,J=i;return"300 es"===t.version&&(Z=l,J=s),function(t){return V=[],null!==t?r(t.replace?t.replace(/\r\n/g,"\n"):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,h=0,f=1,d=2,p=3,m=4,v=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":280,"./lib/builtins-300es":279,"./lib/literals":282,"./lib/literals-300es":281,"./lib/operators":283}],279:[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":280}],280:[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"]},{}],281:[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":282}],282:[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"]},{}],283:[function(t,e,r){e.exports=["<<=",">>=","++","--","<<",">>","<=",">=","==","!=","&&","||","+=","-=","*=","/=","%=","&=","^^","^=","|=","(",")","[","]",".","!","~","*","/","%","+","-","<",">","&","^","|","?",":","=",",",";","{","}"]},{}],284:[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":278}],285:[function(t,e,r){"use strict";function n(t,e,r){var n=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;var a=new Int32Array(this.arrayBuffer);t=a[0],e=a[1],r=a[2],this.d=e+2*r;for(var o=0;o=u[f+0]&&n>=u[f+1]?(o[h]=!0,a.push(l[h])):o[h]=!1}}},n.prototype._forEachCell=function(t,e,r,n,i,a,o){for(var s=this._convertToCellCoord(t),l=this._convertToCellCoord(e),u=this._convertToCellCoord(r),c=this._convertToCellCoord(n),h=s;h<=u;h++)for(var f=l;f<=c;f++){var d=this.d*f+h;if(i.call(this,t,e,r,n,d,a,o))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>1,c=-7,h=r?i-1:0,f=r?-1:1,d=t[e+h];for(h+=f,a=d&(1<<-c)-1,d>>=-c,c+=s;c>0;a=256*a+t[e+h],h+=f,c-=8);for(o=a&(1<<-c)-1,a>>=-c,c+=n;c>0;o=256*o+t[e+h],h+=f,c-=8);if(0===a)a=1-u;else{if(a===l)return o?NaN:1/0*(d?-1:1);o+=Math.pow(2,n),a-=u}return(d?-1:1)*o*Math.pow(2,a-n)},r.write=function(t,e,r,n,i,a){var o,s,l,u=8*a-i-1,c=(1<>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:a-1,p=n?1:-1,m=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,o=c):(o=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-o))<1&&(o--,l*=2),e+=o+h>=1?f/l:f*Math.pow(2,1-h),e*l>=2&&(o++,l/=2),o+h>=c?(s=0,o=c):o+h>=1?(s=(e*l-1)*Math.pow(2,i),o+=h):(s=e*Math.pow(2,h-1)*Math.pow(2,i),o=0));i>=8;t[r+d]=255&s,d+=p,s/=256,i-=8);for(o=o<0;t[r+d]=255&o,d+=p,o/=256,u-=8);t[r+d-p]|=128*m}},{}],288:[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 a(t,e){return c(t.vertices,e.vertices)}function o(t){for(var e=["function orient(){var tuple=this.tuple;return test("],r=0;r<=t;++r)r>0&&e.push(","),e.push("tuple[",r,"]");e.push(")}return orient");var 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;n<=t;++n)this.tuple[n]=this.vertices[n];var i=h[t];i||(i=h[t]=o(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(r<=i)throw new Error("Must input at least d+1 points");var a=t.slice(0,i+1),o=u.apply(void 0,a);if(0===o)throw new Error("Input not in general position");for(var l=new Array(i+1),c=0;c<=i;++c)l[c]=c;o<0&&(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;c<=i;++c){for(var p=l.slice(),m=0;m<=i;++m)m===c&&(p[m]=-1);var v=p[0];p[0]=p[1],p[1]=v;var g=new n(p,new Array(i+1),!0);f[c]=g,d[c]=g}d[i+1]=h;for(var c=0;c<=i;++c)for(var p=f[c].vertices,y=f[c].adjacent,m=0;m<=i;++m){var b=p[m];if(b<0)y[m]=h;else for(var x=0;x<=i;++x)f[x].vertices.indexOf(b)<0&&(y[m]=f[x])}for(var _=new s(i,a,d),w=!!e,c=i+1;c0;){t=o.pop();for(var s=(t.vertices,t.adjacent),l=0;l<=r;++l){var u=s[l];if(u.boundary&&!(u.lastVisited<=-n)){for(var c=u.vertices,h=0;h<=r;++h){var f=c[h];i[h]=f<0?e:a[f]}var d=this.orient();if(d>0)return u;u.lastVisited=-n,0===d&&o.push(u)}}}return null},f.walk=function(t,e){var r=this.vertices.length-1,n=this.dimension,i=this.vertices,a=this.tuple,o=e?this.interior.length*Math.random()|0:this.interior.length-1,s=this.interior[o];t:for(;!s.boundary;){for(var l=s.vertices,u=s.adjacent,c=0;c<=n;++c)a[c]=i[l[c]];s.lastVisited=r;for(var c=0;c<=n;++c){var h=u[c];if(!(h.lastVisited>=r)){var f=a[c];a[c]=t;var d=this.orient();if(a[c]=f,d<0){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,o=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,m=d.indexOf(r);if(!(m<0))for(var v=0;v<=o;++v)if(v!==m){var g=p[v];if(g.boundary&&!(g.lastVisited>=r)){var y=g.vertices;if(g.lastVisited!==-r){for(var b=0,x=0;x<=o;++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(!(T<0)){w[T]=A,k[m]=g,M[v]=-1,k[v]=e,p[v]=A,A.flip();for(var x=0;x<=o;++x){var S=M[x];if(!(S<0||S===r)){for(var E=new Array(o-1),L=0,C=0;C<=o;++C){var z=M[C];z<0||C===x||(E[L++]=z)}f.push(new i(E,A,x))}}}}}}f.sort(a);for(var v=0;v+1=0?o[l++]=s[c]:u=1&c;if(u===(1&t)){var h=o[0];o[0]=o[1],o[1]=h}e.push(o)}}return e}},{"robust-orientation":506,"simplicial-complex":517}],289:[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 n<0?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=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)}},x.remove=function(t){var e=this.count-this.leftPoints;if(t[1]3*(e-1))return s(this,t);var r=this.left.remove(t);return 2===r?(this.left=null,this.count-=1,b):(r===b&&(this.count-=1),r)}if(t[0]>this.mid){if(!this.right)return y;if(4*(this.left?this.left.count:0)>3*(e-1))return s(this,t);var r=this.right.remove(t);return 2===r?(this.right=null,this.count-=1,b):(r===b&&(this.count-=1),r)}if(1===this.count)return this.leftPoints[0]===t?2:y;if(1===this.leftPoints.length&&this.leftPoints[0]===t){if(this.left&&this.right){for(var n=this,a=this.left;a.right;)n=a,a=a.right;if(n===this)a.right=this.right;else{var o=this.left,r=this.right;n.count-=a.count,n.right=a.left,a.left=o,a.right=r}i(this,a),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 o=g.ge(this.leftPoints,t,f);othis.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)},x.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 _=m.prototype;_.insert=function(t){this.root?this.root.insert(t):this.root=new n(t[0],null,null,[t],[t])},_.remove=function(t){if(this.root){var e=this.root.remove(t);return 2===e&&(this.root=null),e!==y}return!1},_.queryPoint=function(t,e){if(this.root)return this.root.queryPoint(t,e)},_.queryInterval=function(t,e,r){if(t<=e&&this.root)return this.root.queryInterval(t,e,r)},Object.defineProperty(_,"count",{get:function(){return this.root?this.root.count:0}}),Object.defineProperty(_,"intervals",{get:function(){return this.root?this.root.intervals([]):[]}})},{"binary-search-bounds":64}],290:[function(t,e,r){"use strict";function n(t,e){e=e||new Array(t.length);for(var r=0;r=r&&s<=i&&l>=n&&l<=a&&c.push(t[p]);else{var m=Math.floor((d+f)/2);s=e[2*m],l=e[2*m+1],s>=r&&s<=i&&l>=n&&l<=a&&c.push(t[m]);var v=(h+1)%2;(0===h?r<=s:n<=l)&&(u.push(d),u.push(m-1),u.push(v)),(0===h?i>=s:a>=l)&&(u.push(m+1),u.push(f),u.push(v))}}return c}e.exports=n},{}],298:[function(t,e,r){"use strict";function n(t,e,r,a,o,s){if(!(o-a<=r)){var l=Math.floor((a+o)/2);i(t,e,l,a,o,s%2),n(t,e,r,a,l-1,s+1),n(t,e,r,l+1,o,s+1)}}function i(t,e,r,n,o,s){for(;o>n;){if(o-n>600){var l=o-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)*(u-l/2<0?-1:1);i(t,e,r,Math.max(n,Math.floor(r-u*h/l+f)),Math.min(o,Math.floor(r+(l-u)*h/l+f)),s)}var d=e[2*r+s],p=n,m=o;for(a(t,e,n,r),e[2*o+s]>d&&a(t,e,n,o);pd;)m--}e[2*n+s]===d?a(t,e,n,m):(m++,a(t,e,m,o)),m<=r&&(n=m+1),r<=m&&(o=m-1)}}function a(t,e,r,n){o(t,r,n),o(e,2*r,2*n),o(e,2*r+1,2*n+1)}function o(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}e.exports=n},{}],299:[function(t,e,r){"use strict";function n(t,e,r,n,a,o){for(var s=[0,t.length-1,0],l=[],u=a*a;s.length;){var c=s.pop(),h=s.pop(),f=s.pop();if(h-f<=o)for(var d=f;d<=h;d++)i(e[2*d],e[2*d+1],r,n)<=u&&l.push(t[d]);else{var p=Math.floor((f+h)/2),m=e[2*p],v=e[2*p+1];i(m,v,r,n)<=u&&l.push(t[p]);var g=(c+1)%2;(0===c?r-a<=m:n-a<=v)&&(s.push(f),s.push(p-1),s.push(g)),(0===c?r+a>=m:n+a>=v)&&(s.push(p+1),s.push(h),s.push(g))}}return l}function i(t,e,r,n){var i=t-r,a=e-n;return i*i+a*a}e.exports=n},{}],300:[function(t,e,r){"use strict";function n(t,e){var r;if(h(t)){var l,u=t.stops&&"object"==typeof t.stops[0][0],c=u||void 0!==t.property,f=u||!c,d=t.type||e||"exponential";if("exponential"===d)l=o;else if("interval"===d)l=a;else if("categorical"===d)l=i;else{if("identity"!==d)throw new Error('Unknown function type "'+d+'"');l=s}if(u){for(var p={},m=[],v=0;v=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]:l(e,r,t.stops[n-1][0],t.stops[n][0],t.stops[n-1][1],t.stops[n][1])}function s(t,e){return e}function l(t,e,r,n,i,a){return"function"==typeof i?function(){var o=i.apply(void 0,arguments),s=a.apply(void 0,arguments);return l(t,e,r,n,o,s)}:i.length?c(t,e,r,n,i,a):u(t,e,r,n,i,a)}function u(t,e,r,n,i,a){var o,s=n-r,l=t-r;return o=1===e?l/s:(Math.pow(e,l)-1)/(Math.pow(e,s)-1),i*(1-o)+a*o}function c(t,e,r,n,i,a){for(var o=[],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:474}],302:[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:547}],303:[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=a({},e,{value:f.constants[l]})}return u.function&&"object"===i(l)?r(e):u.type&&s[u.type]?s[u.type](e):o(a({},e,{valueSpec:u.type?h[u.type]:u}))}},{"../error/validation_error":302,"../util/extend":303,"../util/get_type":304,"./validate_array":307,"./validate_boolean":308,"./validate_color":309,"./validate_constants":310,"./validate_enum":311,"./validate_filter":312,"./validate_function":313,"./validate_layer":315,"./validate_number":317,"./validate_object":318,"./validate_source":320,"./validate_string":321}],307:[function(t,e,r){"use strict";var n=t("../util/get_type"),i=t("./validate"),a=t("../error/validation_error");e.exports=function(t){var e=t.value,r=t.valueSpec,o=t.style,s=t.styleSpec,l=t.key,u=t.arrayElementValidator||i;if("array"!==n(e))return[new a(l,e,"array expected, %s found",n(e))];if(r.length&&e.length!==r.length)return[new a(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 o=[];for(var s in r)"@"!==s[0]&&o.push(new n(e+"."+s,r[s],'constants must start with "@"'));return o}},{"../error/validation_error":302,"../util/get_type":304}],311:[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,a=t.valueSpec,o=[];return-1===a.values.indexOf(i(r))&&o.push(new n(e,r,"expected one of [%s], %s found",a.values.join(", "),r)),o}},{"../error/validation_error":302,"../util/unbundle_jsonlint":305}],312:[function(t,e,r){"use strict";var n=t("../error/validation_error"),i=t("./validate_enum"),a=t("../util/get_type"),o=t("../util/unbundle_jsonlint");e.exports=function t(e){var r,s=e.value,l=e.key,u=e.styleSpec,c=[];if("array"!==a(s))return[new n(l,s,"array expected, %s found",a(s))];if(s.length<1)return[new n(l,s,"filter array must have at least 1 element")];switch(c=c.concat(i({key:l+"[0]",value:s[0],valueSpec:u.filter_operator,style:e.style,styleSpec:e.styleSpec})),o(s[0])){case"<":case"<=":case">":case">=":s.length>=2&&"$type"==s[1]&&c.push(new n(l,s,'"$type" cannot be use with operator "%s"',s[0]));case"==":case"!=":3!=s.length&&c.push(new n(l,s,'filter array for operator "%s" must have 3 elements',s[0]));case"in":case"!in":s.length>=2&&(r=a(s[1]),"string"!==r?c.push(new n(l+"[1]",s[1],"string expected, %s found",r)):"@"===s[1][0]&&c.push(new n(l+"[1]",s[1],"filter key cannot be a constant")));for(var h=2;h=8&&(f&&!t.valueSpec["property-function"]?p.push(new n(t.key,t.value,"property functions not supported")):d&&!t.valueSpec["zoom-function"]&&p.push(new n(t.key,t.value,"zoom functions not supported"))),p}},{"../error/validation_error":302,"../util/get_type":304,"./validate":306,"./validate_array":307,"./validate_number":317,"./validate_object":318}],314:[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,a=i(t);return a.length?a:(-1===e.indexOf("{fontstack}")&&a.push(new n(r,e,'"glyphs" url must include a "{fontstack}" token')),-1===e.indexOf("{range}")&&a.push(new n(r,e,'"glyphs" url must include a "{range}" token')),a)}},{"../error/validation_error":302,"./validate_string":321}],315:[function(t,e,r){"use strict";var n=t("../error/validation_error"),i=t("../util/unbundle_jsonlint"),a=t("./validate_object"),o=t("./validate_filter"),s=t("./validate_paint_property"),l=t("./validate_layout_property"),u=t("../util/extend");e.exports=function(t){var e=[],r=t.value,c=t.key,h=t.style,f=t.styleSpec;r.type||r.ref||e.push(new n(c,r,'either "type" or "ref" is required'));var d=i(r.type),p=i(r.ref);if(r.id)for(var m=0;ma.maximum?[new i(e,r,"%s is greater than the maximum value %s",r,a.maximum)]:[]}},{"../error/validation_error":302,"../util/get_type":304}],318:[function(t,e,r){"use strict";var n=t("../error/validation_error"),i=t("../util/get_type"),a=t("./validate");e.exports=function(t){var e=t.key,r=t.value,o=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=o&&(o[d]||o["*"]),m=s[d]||s["*"];p||m?c=c.concat((m||a)({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 o)o[d].required&&void 0===o[d].default&&void 0===r[d]&&c.push(new n(e,r,'missing required property "%s"',d));return c}},{"../error/validation_error":302,"../util/get_type":304,"./validate":306}],319:[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,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?n({key:e,value:o,valueSpec:a.transition,style:r,styleSpec:a}):t.valueSpec||l[s]?n({key:t.key,value:o,valueSpec:t.valueSpec||l[s],style:r,styleSpec:a}):[new i(e,o,'unknown property "%s"',s)]}},{"../error/validation_error":302,"./validate":306}],320:[function(t,e,r){"use strict";var n=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,r=t.key,s=t.styleSpec,l=t.style;if(!e.type)return[new n(r,e,'"type" is required')];switch(i(e.type)){case"vector":case"raster":var u=[];if(u=u.concat(a({key:r,value:e,valueSpec:s.source_tile,style:t.style,styleSpec:s})),"url"in e)for(var c in e)["type","url","tileSize"].indexOf(c)<0&&u.push(new n(r+"."+c,e[c],'a source with a "url" property may not include a "%s" property',c));return u;case"geojson":return a({key:r,value:e,valueSpec:s.source_geojson,style:l,styleSpec:s});case"video":return a({key:r,value:e,valueSpec:s.source_video,style:l,styleSpec:s});case"image":return a({key:r,value:e,valueSpec:s.source_image,style:l,styleSpec:s});default:return o({key:r+".type",value:e.type,valueSpec:{values:["vector","raster","geojson","video","image"]},style:l,styleSpec:s})}}},{"../error/validation_error":302,"../util/unbundle_jsonlint":305,"./validate_enum":311,"./validate_object":318}],321:[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,a=n(e);return"string"!==a?[new i(r,e,"string expected, %s found",a)]:[]}},{"../error/validation_error":302,"../util/get_type":304}],322:[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(o({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 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");n.source=a(t("./validate/validate_source")),n.layer=a(t("./validate/validate_layer")),n.filter=a(t("./validate/validate_filter")),n.paintProperty=a(t("./validate/validate_paint_property")),n.layoutProperty=a(t("./validate/validate_layout_property")),e.exports=n},{"../reference/latest.min":323,"./validate/validate":306,"./validate/validate_constants":310,"./validate/validate_filter":312,"./validate/validate_glyphs_url":314,"./validate/validate_layer":315,"./validate/validate_layout_property":316,"./validate/validate_paint_property":319,"./validate/validate_source":320}],323:[function(t,e,r){e.exports=t("./v8.min.json")},{"./v8.min.json":324}],324:[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"}}}},{}],325:[function(t,e,r){"use strict";function n(t){return!!(i()&&a()&&o()&&s()&&l()&&u()&&c()&&h(t&&t.failIfMajorPerformanceCaveat))}function i(){return"undefined"!=typeof window&&"undefined"!=typeof document}function a(){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 o(){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===d[t]&&(d[t]=f(t)),d[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)}void 0!==e&&e.exports?e.exports=n:window&&(window.mapboxgl=window.mapboxgl||{},window.mapboxgl.supported=n);var d={};n.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0}},{}],326:[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":440}],327:[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],a=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:a})})})}}function i(t){var e={};for(var r in t.programInterfaces){for(var n=e[r]={},i=0;i-1&&n.length>p&&(n=p>3?n.substr(0,p-3)+"...":n.substr(0,p))}void 0!==t.extraText&&(i+=t.extraText),void 0!==t.zLabel?(void 0!==t.xLabel&&(i+="x: "+t.xLabel+"
"),void 0!==t.yLabel&&(i+="y: "+t.yLabel+"
"),i+=(i?"z: ":"")+t.zLabel):z&&t[a+"Label"]===_?i=t[("x"===a?"y":"x")+"Label"]||"":void 0===t.xLabel?void 0!==t.yLabel&&(i=t.yLabel):i=void 0===t.yLabel?t.xLabel:"("+t.xLabel+", "+t.yLabel+")",t.text&&!Array.isArray(t.text)&&(i+=(i?"
":"")+t.text),""===i&&(""===n&&e.remove(),i=n);var v=e.select("text.nums").call(g.font,t.fontFamily||f,t.fontSize||d,t.fontColor||h).text(i).attr("data-notex",1).call(m.positionText,0,0).call(m.convertToTspans,r),b=e.select("text.name"),x=0;n&&n!==i?(b.call(g.font,t.fontFamily||f,t.fontSize||d,u).text(n).attr("data-notex",1).call(m.positionText,0,0).call(m.convertToTspans,r),x=b.node().getBoundingClientRect().width+2*C):(b.remove(),e.select("rect").remove()),e.select("path").style({fill:u,stroke:h});var w,M,A=v.node().getBoundingClientRect(),I=t.xa._offset+(t.x0+t.x1)/2,D=t.ya._offset+(t.y0+t.y1)/2,P=Math.abs(t.x1-t.x0),O=Math.abs(t.y1-t.y0),R=A.width+L+C+x;t.ty0=T-A.top,t.bx=A.width+2*C,t.by=A.height+2*C,t.anchor="start",t.txwidth=A.width,t.tx2width=x,t.offset=0,o?(t.pos=I,w=D+O/2+R<=E,M=D-O/2-R>=0,"top"!==t.idealAlign&&w||!M?w?(D+=O/2,t.anchor="start"):t.anchor="middle":(D-=O/2,t.anchor="end")):(t.pos=D,w=I+P/2+R<=S,M=I-P/2-R>=0,"left"!==t.idealAlign&&w||!M?w?(I+=P/2,t.anchor="start"):t.anchor="middle":(I-=P/2,t.anchor="end")),v.attr("text-anchor",t.anchor),x&&b.attr("text-anchor",t.anchor),e.attr("transform","translate("+I+","+D+")"+(o?"rotate("+k+")":""))}),P}function a(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(!(a<.01)){if(i<-.01){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&&!(u<=0);o--)l=t[o],l.pos>e.pmax-1&&(l.del=!0,u--);for(o=0;o=0;s--)t[s].dp-=a;for(o=t.length-1;o>=0&&!(u<=0);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,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)?T: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===m.pmin&&p.pmax===m.pmax){for(s=d.length-1;s>=0;s--)d[s].dp+=i;for(f.push.apply(f,d),h.splice(o+1,1),u=0,s=f.length-1;s>=0;s--)u+=f[s].dp;for(a=u/f.length,s=f.length-1;s>=0;s--)f[s].dp-=a;n=!1}else o++}h.forEach(r)}for(o=h.length-1;o>=0;o--){var v=h[o];for(s=v.length-1;s>=0;s--){var g=v[s],y=t[g.i];y.offset=g.dp,y.del=g.del}}}function o(t,e){t.each(function(t){var r=c.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*(L+C),s=o+a*(t.txwidth+C),l=0,u=t.offset;"middle"===t.anchor&&(o-=t.tx2width/2,s-=t.tx2width/2),e&&(u*=-E,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*L+l)+","+(L+u)+"v"+(t.by/2-L)+"h"+n*t.bx+"v-"+t.by+"H"+(n*L+l)+"V"+(u-L)+"Z"),i.call(m.positionText,o+l,u+t.ty0-t.by/2+C),t.tx2width&&(r.select("text.name").call(m.positionText,s+a*C+l,u+t.ty0-t.by/2+C),r.select("rect").call(g.setRect,s+(a-1)*t.tx2width/2+l,u-t.by/2-1,t.tx2width,t.by+2))})}function s(t,e){function r(e,r,o){var s;if(a[r])s=a[r];else if(i[r]){var l=i[r];Array.isArray(l)&&Array.isArray(l[t.index[0]])&&(s=l[t.index[0]][t.index[1]])}else s=d.nestedProperty(n,o).get();s&&(t[e]=s)}var n=t.trace||{},i=t.cd[0],a=t.cd[t.index]||{};r("hoverinfo","hi","hoverinfo"),r("color","hbg","hoverlabel.bgcolor"),r("borderColor","hbc","hoverlabel.bordercolor"),r("fontFamily","htf","hoverlabel.font.family"),r("fontSize","hts","hoverlabel.font.size"),r("fontColor","htc","hoverlabel.font.color"),r("nameLength","hnl","hoverlabel.namelength"),t.posref="y"===e?(t.x0+t.x1)/2:(t.y0+t.y1)/2,t.x0=d.constrain(t.x0,0,t.xa._length),t.x1=d.constrain(t.x1,0,t.xa._length),t.y0=d.constrain(t.y0,0,t.ya._length),t.y1=d.constrain(t.y1,0,t.ya._length);var o;if(void 0!==t.xLabelVal){o="log"===t.xa.type&&t.xLabelVal<=0;var s=x.tickText(t.xa,t.xa.c2l(o?-t.xLabelVal:t.xLabelVal),"hover");o?0===t.xLabelVal?t.xLabel="0":t.xLabel="-"+s.text:t.xLabel=s.text,t.xVal=t.xa.c2d(t.xLabelVal)}if(void 0!==t.yLabelVal){o="log"===t.ya.type&&t.yLabelVal<=0;var l=x.tickText(t.ya,t.ya.c2l(o?-t.yLabelVal:t.yLabelVal),"hover");o?0===t.yLabelVal?t.yLabel="0":t.yLabel="-"+l.text:t.yLabel=l.text,t.yVal=t.ya.c2d(t.yLabelVal)}if(void 0!==t.zLabelVal&&(t.zLabel=String(t.zLabelVal)),!(isNaN(t.xerr)||"log"===t.xa.type&&t.xerr<=0)){var u=x.tickText(t.xa,t.xa.c2l(t.xerr),"hover").text;void 0!==t.xerrneg?t.xLabel+=" +"+u+" / -"+x.tickText(t.xa,t.xa.c2l(t.xerrneg),"hover").text:t.xLabel+=" \xb1 "+u,"x"===e&&(t.distance+=1)}if(!(isNaN(t.yerr)||"log"===t.ya.type&&t.yerr<=0)){var c=x.tickText(t.ya,t.ya.c2l(t.yerr),"hover").text;void 0!==t.yerrneg?t.yLabel+=" +"+c+" / -"+x.tickText(t.ya,t.ya.c2l(t.yerrneg),"hover").text:t.yLabel+=" \xb1 "+c,"y"===e&&(t.distance+=1)}var h=t.hoverinfo||t.trace.hoverinfo;return"all"!==h&&(h=h.split("+"),-1===h.indexOf("x")&&(t.xLabel=void 0),-1===h.indexOf("y")&&(t.yLabel=void 0),-1===h.indexOf("z")&&(t.zLabel=void 0),-1===h.indexOf("text")&&(t.text=void 0),-1===h.indexOf("name")&&(t.name=void 0)),t}function l(t,e){var r=e.hovermode,n=e.container,i=t[0],a=i.xa,o=i.ya,s=a.showspikes,l=o.showspikes;if(n.selectAll(".spikeline").remove(),"closest"===r&&(s||l)){var u=e.fullLayout,c=a._offset+(i.x0+i.x1)/2,h=o._offset+(i.y0+i.y1)/2,d=y.combine(u.plot_bgcolor,u.paper_bgcolor),p=f.readability(i.color,d)<1.5?y.contrast(d):i.color;if(l){var m=o.spikemode,v=o.spikethickness,b=o.spikecolor||p,x=o._boundingBox,_=(x.left+x.right)/2=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 c=t("d3"),h=t("fast-isnumeric"),f=t("tinycolor2"),d=t("../../lib"),p=t("../../lib/events"),m=t("../../lib/svg_text_utils"),v=t("../../lib/override_cursor"),g=t("../drawing"),y=t("../color"),b=t("../dragelement"),x=t("../../plots/cartesian/axes"),_=t("../../registry"),w=t("./helpers"),M=t("./constants"),k=M.YANGLE,A=Math.PI*k/180,T=1/Math.sin(A),S=Math.cos(A),E=Math.sin(A),L=M.HOVERARROWSIZE,C=M.HOVERTEXTPAD;r.hover=function(t,e,r,i){if("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+M.HOVERMINTIME)return n(t,e,r,i),void(t._lastHoverTime=Date.now());t._hoverTimer=setTimeout(function(){n(t,e,r,i),t._lastHoverTime=Date.now(),t._hoverTimer=void 0},M.HOVERMINTIME)},r.loneHover=function(t,e){var r={color:t.color||y.defaultLine,x0:t.x0||t.x||0,x1:t.x1||t.x||0,y0:t.y0||t.y||0,y1:t.y1||t.y||0,xLabel:t.xLabel,yLabel:t.yLabel,zLabel:t.zLabel,text:t.text,name:t.name,idealAlign:t.idealAlign,borderColor:t.borderColor,fontFamily:t.fontFamily,fontSize:t.fontSize,fontColor:t.fontColor,trace:{index:0,hoverinfo:""},xa:{_offset:0},ya:{_offset:0},index:0},n=c.select(e.container),a=e.outerContainer?c.select(e.outerContainer):n,s={hovermode:"closest",rotateLabels:!1,bgColor:e.bgColor||y.background,container:n,outerContainer:a},l=i([r],s,e.gd);return o(l,s.rotateLabels),l.node()}},{"../../lib":724,"../../lib/events":714,"../../lib/override_cursor":733,"../../lib/svg_text_utils":743,"../../plots/cartesian/axes":764,"../../registry":842,"../color":602,"../dragelement":623,"../drawing":626,"./constants":638,"./helpers":640,d3:120,"fast-isnumeric":129,tinycolor2:532}],642:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function(t,e,r,i){i=i||{},r("hoverlabel.bgcolor",i.bgcolor),r("hoverlabel.bordercolor",i.bordercolor),r("hoverlabel.namelength",i.namelength),n.coerceFont(r,"hoverlabel.font",i.font)}},{"../../lib":724}],643:[function(t,e,r){"use strict";function n(t){var e=s.isD3Selection(t)?t:o.select(t);e.selectAll("g.hovertext").remove(),e.selectAll(".spikeline").remove()}function i(t,e,r){return s.castOption(t,e,"hoverlabel."+r)}function a(t,e,r){function n(r){return s.coerceHoverinfo({hoverinfo:r},{_module:t._module},e)}return s.castOption(t,r,"hoverinfo",n)}var o=t("d3"),s=t("../../lib"),l=t("../dragelement"),u=t("./helpers"),c=t("./layout_attributes");e.exports={moduleType:"component",name:"fx",constants:t("./constants"),schema:{layout:c},attributes:t("./attributes"),layoutAttributes:c,supplyLayoutGlobalDefaults:t("./layout_global_defaults"),supplyDefaults:t("./defaults"),supplyLayoutDefaults:t("./layout_defaults"),calc:t("./calc"),getDistanceFunction:u.getDistanceFunction,getClosest:u.getClosest,inbox:u.inbox,appendArrayPointValue:u.appendArrayPointValue,castHoverOption:i,castHoverinfo:a,hover:t("./hover").hover,unhover:l.unhover,loneHover:t("./hover").loneHover,loneUnhover:n,click:t("./click")}},{"../../lib":724,"../dragelement":623,"./attributes":635,"./calc":636,"./click":637,"./constants":638,"./defaults":639,"./helpers":640,"./hover":641,"./layout_attributes":644,"./layout_defaults":645,"./layout_global_defaults":646,d3:120}],644:[function(t,e,r){"use strict";var n=t("../../lib/extend").extendFlat,i=t("../../plots/font_attributes"),a=t("./constants");e.exports={dragmode:{valType:"enumerated",values:["zoom","pan","select","lasso","orbit","turntable"],dflt:"zoom"},hovermode:{valType:"enumerated",values:["x","y","closest",!1]},hoverlabel:{bgcolor:{valType:"color"},bordercolor:{valType:"color"},font:{family:n({},i.family,{dflt:a.HOVERFONT}),size:n({},i.size,{dflt:a.HOVERFONTSIZE}),color:n({},i.color)},namelength:{valType:"integer",min:-1,dflt:15}}}},{"../../lib/extend":715,"../../plots/font_attributes":788,"./constants":638}],645:[function(t,e,r){"use strict";function n(t){for(var e=!0,r=0;r=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}},{}],653:[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":715,"../../plots/font_attributes":788,"../color/attributes":601}],654:[function(t,e,r){"use strict";e.exports={scrollBarWidth:4,scrollBarHeight:20,scrollBarColor:"#808BA4",scrollBarMargin:4}},{}],655:[function(t,e,r){"use strict";var n=t("../../registry"),i=t("../../lib"),a=t("./attributes"),o=t("../../plots/layout_attributes"),s=t("./helpers");e.exports=function(t,e,r){function l(t,e){return i.coerce(d,p,a,t,e)}for(var u,c,h,f,d=t.legend||{},p=e.legend={},m=0,v="normal",g=0;g1)){if(l("bgcolor",e.paper_bgcolor),l("bordercolor"),l("borderwidth"),i.coerceFont(l,"font",e.font),l("orientation"),"h"===p.orientation){var b=t.xaxis;b&&b.rangeslider&&b.rangeslider.visible?(u=0,h="left",c=1.1,f="bottom"):(u=0,h="left",c=-.1,f="top")}l("traceorder",v),s.isGrouped(e.legend)&&l("tracegroupgap"),l("x",u),l("xanchor",h),l("y",c),l("yanchor",f),i.noneOrAll(d,p,["x","y"])}}},{"../../lib":724,"../../plots/layout_attributes":818,"../../registry":842,"./attributes":653,"./helpers":658}],656:[function(t,e,r){"use strict";function n(t,e){function r(r){y.convertToTspans(r,e,function(){o(t,e)})}var n=t.data()[0][0],i=e._fullLayout,a=n.trace,s=p.traceIs(a,"pie"),l=a.index,u=s?n.label:a.name,c=t.selectAll("text.legendtext").data([0]);c.enter().append("text").classed("legendtext",!0),c.attr("text-anchor","start").classed("user-select-none",!0).call(v.font,i.legend.font).text(u),e._context.edits.legendText&&!s?c.call(y.makeEditable,{gd:e}).call(r).on("edit",function(t){this.text(t).call(r),this.text()||(t=" ");var i,a=n.trace._fullInput||{};if(-1!==["ohlc","candlestick"].indexOf(a.type)){var o=n.trace.transforms;i=o[o.length-1].direction+".name"}else i="name";h.restyle(e,i,t,l)}):c.call(r)}function i(t,e){var r,n=1,i=t.selectAll("rect").data([0]);i.enter().append("rect").classed("legendtoggle",!0).style("cursor","pointer").attr("pointer-events","all").call(g.fill,"rgba(0,0,0,0)"),i.on("mousedown",function(){r=(new Date).getTime(),r-e._legendMouseDownTimeS&&(n=Math.max(n-1,1)),1===n?r._clickTimeout=setTimeout(function(){a(t,e,n)},S):2===n&&(r._clickTimeout&&clearTimeout(r._clickTimeout),e._legendMouseDownTime=0,a(t,e,n))}})}function a(t,e,r){if(!e._dragged&&!e._editing){var n,i,a=e._fullLayout.hiddenlabels?e._fullLayout.hiddenlabels.slice():[],o=t.data()[0][0],s=e._fullData,l=o.trace,u=l.legendgroup,c=[];if(1===r&&T&&e.data&&e._context.showTips?(f.notifier("Double click on legend to isolate individual trace","long"),T=!1):T=!1,p.traceIs(l,"pie")){var d=o.label,m=a.indexOf(d);1===r?-1===m?a.push(d):a.splice(m,1):2===r&&(a=[],e.calcdata[0].forEach(function(t){d!==t.label&&a.push(t.label)}),e._fullLayout.hiddenlabels&&e._fullLayout.hiddenlabels.length===a.length&&-1===m&&(a=[])),h.relayout(e,"hiddenlabels",a)}else{var v,g=[],y=[];for(v=0;vn.width-(n.margin.r+n.margin.l)&&(b=0,m+=g,i.height=i.height+g,g=0),v.setTranslate(this,a+b,5+a+e.height/2+m),i.width+=o+r,i.height=Math.max(i.height,e.height),b+=o+r,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),r.each(function(e){var r=e[0];c.select(this).select(".legendtoggle").call(v.setRect,0,-r.height/2,(t._context.edits.legendText?0:i.width)+s,r.height)})}function l(t){var e=t._fullLayout,r=e.legend,n="left";A.isRightAnchor(r)?n="right":A.isCenterAnchor(r)&&(n="center");var i="top";A.isBottomAnchor(r)?i="bottom":A.isMiddleAnchor(r)&&(i="middle"),d.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 u(t){var e=t._fullLayout,r=e.legend,n="left";A.isRightAnchor(r)?n="right":A.isCenterAnchor(r)&&(n="center"),d.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 c=t("d3"),h=t("../../plotly"),f=t("../../lib"),d=t("../../plots/plots"),p=t("../../registry"),m=t("../dragelement"),v=t("../drawing"),g=t("../color"),y=t("../../lib/svg_text_utils"),b=t("./constants"),x=t("../../constants/interactions"),_=t("../../constants/alignment").LINE_SPACING,w=t("./get_legend_data"),M=t("./style"),k=t("./helpers"),A=t("./anchor_utils"),T=!0,S=x.DBLCLICKDELAY;e.exports=function(t){function e(t,e){L.attr("data-scroll",e).call(v.setTranslate,0,e),C.call(v.setRect,N,t,b.scrollBarWidth,b.scrollBarHeight),T.select("rect").attr({y:y.borderwidth-e})}var r=t._fullLayout,o="legend"+r._uid;if(r._infolayer&&t.calcdata){t._legendMouseDownTime||(t._legendMouseDownTime=0);var y=r.legend,x=r.showlegend&&w(t.calcdata,y),_=r.hiddenlabels||[];if(!r.showlegend||!x.length)return r._infolayer.selectAll(".legend").remove(),r._topdefs.select("#"+o).remove(),void d.autoMargin(t,"legend");var k=r._infolayer.selectAll("g.legend").data([0]);k.enter().append("g").attr({class:"legend","pointer-events":"all"});var T=r._topdefs.selectAll("#"+o).data([0]);T.enter().append("clipPath").attr("id",o).append("rect");var E=k.selectAll("rect.bg").data([0]);E.enter().append("rect").attr({class:"bg","shape-rendering":"crispEdges"}),E.call(g.stroke,y.bordercolor),E.call(g.fill,y.bgcolor),E.style("stroke-width",y.borderwidth+"px");var L=k.selectAll("g.scrollbox").data([0]);L.enter().append("g").attr("class","scrollbox");var C=k.selectAll("rect.scrollbar").data([0]);C.enter().append("rect").attr({class:"scrollbar",rx:20,ry:2,width:0,height:0}).call(g.fill,"#808BA4");var z=L.selectAll("g.groups").data(x);z.enter().append("g").attr("class","groups"),z.exit().remove();var I=z.selectAll("g.traces").data(f.identity);I.enter().append("g").attr("class","traces"),I.exit().remove(),I.call(M,t).style("opacity",function(t){var e=t[0].trace;return p.traceIs(e,"pie")?-1!==_.indexOf(t[0].label)?.5:1:"legendonly"===e.visible?.5:1}).each(function(){c.select(this).call(n,t).call(i,t)});var D=0!==k.enter().size();D&&(s(t,z,I),l(t));var P=r.width,O=r.height;s(t,z,I),y.height>O?u(t):l(t);var R=r._size,F=R.l+R.w*y.x,j=R.t+R.h*(1-y.y);A.isRightAnchor(y)?F-=y.width:A.isCenterAnchor(y)&&(F-=y.width/2),A.isBottomAnchor(y)?j-=y.height:A.isMiddleAnchor(y)&&(j-=y.height/2);var N=y.width,B=R.w;N>B?(F=R.l,N=B):(F+N>P&&(F=P-N),F<0&&(F=0),N=Math.min(P-F,y.width));var U=y.height,V=R.h;U>V?(j=R.t,U=V):(j+U>O&&(j=O-U),j<0&&(j=0),U=Math.min(O-j,y.height)),v.setTranslate(k,F,j);var H,q,G=U-b.scrollBarHeight-2*b.scrollBarMargin,Y=y.height-U;if(y.height<=U||t._context.staticPlot)E.attr({width:N-y.borderwidth,height:U-y.borderwidth,x:y.borderwidth/2,y:y.borderwidth/2}),v.setTranslate(L,0,0),T.select("rect").attr({width:N-2*y.borderwidth,height:U-2*y.borderwidth,x:y.borderwidth,y:y.borderwidth}),L.call(v.setClipUrl,o);else{H=b.scrollBarMargin,q=L.attr("data-scroll")||0,E.attr({width:N-2*y.borderwidth+b.scrollBarWidth+b.scrollBarMargin,height:U-y.borderwidth,x:y.borderwidth/2,y:y.borderwidth/2}),T.select("rect").attr({width:N-2*y.borderwidth+b.scrollBarWidth+b.scrollBarMargin,height:U-2*y.borderwidth,x:y.borderwidth,y:y.borderwidth-q}),L.call(v.setClipUrl,o),D&&e(H,q),k.on("wheel",null),k.on("wheel",function(){q=f.constrain(L.attr("data-scroll")-c.event.deltaY/G*Y,-Y,0),H=b.scrollBarMargin-q/Y*G,e(H,q),0!==q&&q!==-Y&&c.event.preventDefault()}),C.on(".drag",null),L.on(".drag",null);var X=c.behavior.drag().on("drag",function(){H=f.constrain(c.event.y-b.scrollBarHeight/2,b.scrollBarMargin,b.scrollBarMargin+G),q=-(H-b.scrollBarMargin)/G*Y,e(H,q)});C.call(X),L.call(X)}if(t._context.edits.legendPosition){var W,Z,J,K;k.classed("cursor-move",!0),m.init({element:k.node(),gd:t,prepFn:function(){var t=v.getTranslate(k);J=t.x,K=t.y},moveFn:function(t,e){var r=J+t,n=K+e;v.setTranslate(k,r,n),W=m.align(r,0,R.l,R.l+R.w,y.xanchor),Z=m.align(n,0,R.t+R.h,R.t,y.yanchor)},doneFn:function(e,n,i){if(e&&void 0!==W&&void 0!==Z)h.relayout(t,{"legend.x":W,"legend.y":Z});else{var o=r._infolayer.selectAll("g.traces").filter(function(){var t=this.getBoundingClientRect();return i.clientX>=t.left&&i.clientX<=t.right&&i.clientY>=t.top&&i.clientY<=t.bottom});o.size()>0&&(1===n?k._clickTimeout=setTimeout(function(){a(o,t,n)},S):2===n&&(k._clickTimeout&&clearTimeout(k._clickTimeout),a(o,t,n)))}}})}}}},{"../../constants/alignment":698,"../../constants/interactions":703,"../../lib":724,"../../lib/svg_text_utils":743,"../../plotly":759,"../../plots/plots":827,"../../registry":842,"../color":602,"../dragelement":623,"../drawing":626,"./anchor_utils":652,"./constants":654,"./get_legend_data":657,"./helpers":658,"./style":660,d3:120}],657:[function(t,e,r){"use strict";var n=t("../../registry"),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 a,o,s={},l=[],u=!1,c={},h=0;for(a=0;ar[1])return r[1]}return i}function i(t){return t[0]}var s,u,c=t[0],h=c.trace,f=l.hasMarkers(h),d=l.hasText(h),p=l.hasLines(h);if(f||d||p){var m={},v={};f&&(m.mc=r("marker.color",i),m.mo=r("marker.opacity",a.mean,[.2,1]),m.ms=r("marker.size",a.mean,[2,16]),m.mlc=r("marker.line.color",i),m.mlw=r("marker.line.width",a.mean,[0,5]),v.marker={sizeref:1,sizemin:1,sizemode:"diameter"}),p&&(v.line={width:r("line.width",i,[0,10])}),d&&(m.tx="Aa",m.tp=r("textposition",i),m.ts=10,m.tc=r("textfont.color",i),m.tf=r("textfont.family",i)),s=[a.minExtend(c,m)],u=a.minExtend(h,v)}var g=n.select(this).select("g.legendpoints"),y=g.selectAll("path.scatterpts").data(f?s:[]);y.enter().append("path").classed("scatterpts",!0).attr("transform","translate(20,0)"),y.exit().remove(),y.call(o.pointStyle,u,e),f&&(s[0].mrc=3);var b=g.selectAll("g.pointtext").data(d?s:[]);b.enter().append("g").classed("pointtext",!0).append("text").attr("transform","translate(20,0)"),b.exit().remove(),b.selectAll("text").call(o.textPointStyle,u,e)}function h(t){var e=t[0].trace,r=e.marker||{},a=r.line||{},o=n.select(this).select("g.legendpoints").selectAll("path.legendbar").data(i.traceIs(e,"bar")?[t]:[]);o.enter().append("path").classed("legendbar",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),o.exit().remove(),o.each(function(t){var e=n.select(this),i=t[0],o=(i.mlw+1||a.width+1)-1;e.style("stroke-width",o+"px").call(s.fill,i.mc||r.color),o&&e.call(s.stroke,i.mlc||a.color)})}function f(t){var e=t[0].trace,r=n.select(this).select("g.legendpoints").selectAll("path.legendbox").data(i.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(){var t=e.line.width,r=n.select(this);r.style("stroke-width",t+"px").call(s.fill,e.fillcolor),t&&r.call(s.stroke,e.line.color)})}function d(t){var e=t[0].trace,r=n.select(this).select("g.legendpoints").selectAll("path.legendpie").data(i.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(u,t[0],e)}t.each(function(t){var e=n.select(this),r=e.selectAll("g.layers").data([0]);r.enter().append("g").classed("layers",!0),r.style("opacity",t[0].trace.opacity),r.selectAll("g.legendfill").data([t]).enter().append("g").classed("legendfill",!0),r.selectAll("g.legendlines").data([t]).enter().append("g").classed("legendlines",!0);var i=r.selectAll("g.legendsymbols").data([t]);i.enter().append("g").classed("legendsymbols",!0),i.selectAll("g.legendpoints").data([t]).enter().append("g").classed("legendpoints",!0)}).each(h).each(f).each(d).each(r).each(c)}},{"../../lib":724,"../../registry":842,"../../traces/pie/style_one":1011,"../../traces/scatter/subtypes":1045,"../color":602,"../drawing":626,d3:120}],661:[function(t,e,r){"use strict";function n(t,e){var r,n,i=e.currentTarget,a=i.getAttribute("data-attr"),o=i.getAttribute("data-val")||!0,s=t._fullLayout,l={},u=f.list(t,null,!0),h="on";if("zoom"===a){var d,p="in"===o?.5:2,m=(1+p)/2,v=(1-p)/2;for(n=0;n1)return n(["resetViews","toggleHover"]),o(g,r);c&&(n(["zoom3d","pan3d","orbitRotation","tableRotation"]),n(["resetCameraDefault3d","resetCameraLastSave3d"]),n(["hoverClosest3d"])),h&&(n(["zoomInGeo","zoomOutGeo","resetGeo"]),n(["hoverClosestGeo"]));var y=i(s),b=[];return((u||p)&&!y||m)&&(b=["zoom2d","pan2d"]),v&&(b=["pan2d"]),a(l)&&(b.push("select2d"),b.push("lasso2d")),b.length&&n(b),!u&&!p||y||m||n(["zoomIn2d","zoomOut2d","autoScale2d","resetScale2d"]),u&&d?n(["toggleHover"]):p?n(["hoverClosestGl2d"]):u?n(["toggleSpikelines","hoverClosestCartesian","hoverCompareCartesian"]):d?n(["hoverClosestPie"]):v&&n(["resetViewMapbox","toggleHover"]),o(g,r)}function i(t){for(var e=l.list({_fullLayout:t},null,!0),r=!0,n=0;n0)){var p=i(e,r,l);h("x",p[0]),h("y",p[1]),a.noneOrAll(t,e,["x","y"]),h("xanchor"),h("yanchor"),a.coerceFont(h,"font",r.font);var m=h("bgcolor");h("activecolor",o.contrast(m,u.lightAmount,u.darkAmount)),h("bordercolor"),h("borderwidth")}}},{"../../lib":724,"../color":602,"./attributes":665,"./button_attributes":666,"./constants":667}],669:[function(t,e,r){"use strict";function n(t){for(var e=g.list(t,"x",!0),r=[],n=0;np&&(p=f)));return p>=d?[d,p]:void 0}}var i=t("../../lib"),a=t("../../plots/cartesian/axes"),o=t("./constants"),s=t("./helpers");e.exports=function(t){var e=t._fullLayout,r=i.filterVisible(e.shapes);if(r.length&&t._fullData.length)for(var s=0;sY&&n>X&&!t.shiftKey?p.getCursor(i/r,1-a/n):"move";m(e,o),G=o.split("-")[0]}function a(e){N=h.getFromId(t,r.xref),B=h.getFromId(t,r.yref),U=g.getDataToPixel(t,N),V=g.getDataToPixel(t,B,!0),H=g.getPixelToData(t,N),q=g.getPixelToData(t,B,!0);var a="shapes["+n+"]";"path"===r.type?(F=r.path,j=a+".path"):(v=U(r.x0),y=V(r.y0),b=U(r.x1),x=V(r.y1),_=a+".x0",w=a+".y0",M=a+".x1",k=a+".y1"),vX&&(d[L]=r[D]=q(u),d[C]=r[P]=q(c)),f-h>Y&&(d[z]=r[O]=H(h),d[I]=r[R]=H(f))}e.attr("d",o(t,r))}var d,v,y,b,x,_,w,M,k,A,T,S,E,L,C,z,I,D,P,O,R,F,j,N,B,U,V,H,q,G,Y=10,X=10,W={element:e.node(),gd:t,prepFn:a,doneFn:s},Z=W.element.getBoundingClientRect();p.init(W),e.node().onmousemove=i}function o(t,e){var r,n,i,a,o=e.type,l=h.getFromId(t,e.xref),u=h.getFromId(t,e.yref),c=t._fullLayout._size;if(l?(r=g.shapePositionToRange(l),n=function(t){return l._offset+l.r2p(r(t,!0))}):n=function(t){return c.l+c.w*t},u?(i=g.shapePositionToRange(u),a=function(t){return u._offset+u.r2p(i(t,!0))}):a=function(t){return c.t+c.h*(1-t)},"path"===o)return l&&"date"===l.type&&(n=g.decodeDate(n)),u&&"date"===u.type&&(a=g.decodeDate(a)),s(e.path,n,a);var f=n(e.x0),d=n(e.x1),p=a(e.y0),m=a(e.y1);if("line"===o)return"M"+f+","+p+"L"+d+","+m;if("rect"===o)return"M"+f+","+p+"H"+d+"V"+m+"H"+f+"Z";var v=(f+d)/2,y=(p+m)/2,b=Math.abs(v-f),x=Math.abs(y-p),_="A"+b+","+x,w=v+b+","+y;return"M"+w+_+" 0 1,1 "+v+","+(y-x)+_+" 0 0,1 "+w+"Z"}function s(t,e,r){return t.replace(v.segmentRE,function(t){var n=0,i=t.charAt(0),a=v.paramIsX[i],o=v.paramIsY[i],s=v.numParams[i],l=t.substr(1).replace(v.paramRE,function(t){return a[n]?t=e(t):o[n]&&(t=r(t)),n++,n>s&&(t="X"),t});return n>s&&(l=l.replace(/[\s,]*X.*/,""),c.log("Ignoring extra params in segment "+t)),i+l})}function l(t,e,r){return t.replace(v.segmentRE,function(t){var n=0,i=t.charAt(0),a=v.paramIsX[i],o=v.paramIsY[i],s=v.numParams[i];return i+t.substr(1).replace(v.paramRE,function(t){return n>=s?t:(a[n]?t=e(t):o[n]&&(t=r(t)),n++,t)})})}var u=t("../../plotly"),c=t("../../lib"),h=t("../../plots/cartesian/axes"),f=t("../color"),d=t("../drawing"),p=t("../dragelement"),m=t("../../lib/setcursor"),v=t("./constants"),g=t("./helpers");e.exports={draw:n,drawOne:i}},{"../../lib":724,"../../lib/setcursor":739,"../../plotly":759,"../../plots/cartesian/axes":764,"../color":602,"../dragelement":623,"../drawing":626,"./constants":680,"./helpers":683}],683:[function(t,e,r){"use strict";r.rangeToShapePosition=function(t){return"log"===t.type?t.r2d:function(t){return t}},r.shapePositionToRange=function(t){return"log"===t.type?t.d2r:function(t){return t}},r.decodeDate=function(t){return function(e){return e.replace&&(e=e.replace("_"," ")),t(e)}},r.encodeDate=function(t){return function(e){return t(e).replace(" ","_")}},r.getDataToPixel=function(t,e,n){var i,a=t._fullLayout._size;if(e){var o=r.shapePositionToRange(e);i=function(t){return e._offset+e.r2p(o(t,!0))},"date"===e.type&&(i=r.decodeDate(i))}else i=n?function(t){return a.t+a.h*(1-t)}:function(t){return a.l+a.w*t};return i},r.getPixelToData=function(t,e,n){var i,a=t._fullLayout._size;if(e){var o=r.rangeToShapePosition(e);i=function(t){return o(e.p2r(t-e._offset))}}else i=n?function(t){return 1-(t-a.t)/a.h}:function(t){return(t-a.l)/a.w};return i}},{}],684:[function(t,e,r){"use strict";var n=t("./draw");e.exports={moduleType:"component",name:"shapes",layoutAttributes:t("./attributes"),supplyLayoutDefaults:t("./defaults"),calcAutorange:t("./calc_autorange"),draw:n.draw,drawOne:n.drawOne}},{"./attributes":678,"./calc_autorange":679,"./defaults":681,"./draw":682}],685:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../plots/cartesian/axes"),a=t("./attributes"),o=t("./helpers");e.exports=function(t,e,r,s,l){function u(r,i){return n.coerce(t,e,a,r,i)}if(s=s||{},l=l||{},!u("visible",!l.itemIsNotPlainObject))return e;u("layer"),u("opacity"),u("fillcolor"),u("line.color"),u("line.width"),u("line.dash");for(var c=t.path?"path":"rect",h=u("type",c),f=["x","y"],d=0;d<2;d++){var p=f[d],m={_fullLayout:r},v=i.coerceRef(t,e,m,p,"","paper");if("path"!==h){var g,y,b;"paper"!==v?(g=i.getFromId(m,v),b=o.rangeToShapePosition(g),y=o.shapePositionToRange(g)):y=b=n.identity;var x=p+"0",_=p+"1",w=t[x],M=t[_];t[x]=y(t[x],!0),t[_]=y(t[_],!0),i.coercePosition(e,m,u,v,x,.25),i.coercePosition(e,m,u,v,_,.75),e[x]=b(e[x]),e[_]=b(e[_]),t[x]=w,t[_]=M}}return"path"===h?u("path"):n.noneOrAll(t,e,["x0","x1","y0","y1"]),e}},{"../../lib":724,"../../plots/cartesian/axes":764,"./attributes":678,"./helpers":683}],686:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),i=t("../../plots/pad_attributes"),a=t("../../lib/extend").extendFlat,o=t("../../lib/extend").extendDeep,s=t("../../plots/animation_attributes"),l=t("./constants"),u={_isLinkedToArray:"step",method:{valType:"enumerated",values:["restyle","relayout","animate","update","skip"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string"},value:{valType:"string"},execute:{valType:"boolean",dflt:!0}};e.exports={_isLinkedToArray:"slider",visible:{valType:"boolean",dflt:!0},active:{valType:"number",min:0,dflt:0},steps:u,lenmode:{valType:"enumerated",values:["fraction","pixels"],dflt:"fraction"},len:{valType:"number",min:0,dflt:1},x:{valType:"number",min:-2,max:3,dflt:0},pad:o({},i,{},{t:{dflt:20}}),xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left"},y:{valType:"number",min:-2,max:3,dflt:0},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"top"},transition:{duration:{valType:"number",min:0,dflt:150},easing:{valType:"enumerated",values:s.transition.easing.values,dflt:"cubic-in-out"}},currentvalue:{visible:{valType:"boolean",dflt:!0},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left"},offset:{valType:"number",dflt:10},prefix:{valType:"string"},suffix:{valType:"string"},font:a({},n,{})},font:a({},n,{}),activebgcolor:{valType:"color",dflt:l.gripBgActiveColor},bgcolor:{valType:"color",dflt:l.railBgColor},bordercolor:{valType:"color",dflt:l.railBorderColor},borderwidth:{valType:"number",min:0,dflt:l.railBorderWidth},ticklen:{valType:"number",min:0,dflt:l.tickLength},tickcolor:{valType:"color",dflt:l.tickColor},tickwidth:{valType:"number",min:0,dflt:1},minorticklen:{valType:"number",min:0,dflt:l.minorTickLength}}},{"../../lib/extend":715,"../../plots/animation_attributes":760,"../../plots/font_attributes":788,"../../plots/pad_attributes":826,"./constants":687}],687:[function(t,e,r){"use strict";e.exports={name:"sliders",containerClassName:"slider-container",groupClassName:"slider-group",inputAreaClass:"slider-input-area",railRectClass:"slider-rail-rect",railTouchRectClass:"slider-rail-touch-rect",gripRectClass:"slider-grip-rect",tickRectClass:"slider-tick-rect",inputProxyClass:"slider-input-proxy",labelsClass:"slider-labels",labelGroupClass:"slider-label-group",labelClass:"slider-label",currentValueClass:"slider-current-value",railHeight:5,menuIndexAttrName:"slider-active-index",autoMarginIdRoot:"slider-",minWidth:30,minHeight:30,textPadX:40,arrowOffsetX:4,railRadius:2,railWidth:5,railBorder:4,railBorderWidth:1,railBorderColor:"#bec8d9",railBgColor:"#f8fafc",railInset:8,stepInset:10,gripRadius:10,gripWidth:20,gripHeight:20,gripBorder:20,gripBorderWidth:1,gripBorderColor:"#bec8d9",gripBgColor:"#f6f8fa",gripBgActiveColor:"#dbdde0",labelPadding:8,labelOffset:0,tickWidth:1,tickColor:"#333",tickOffset:25,tickLength:7,minorTickOffset:25,minorTickColor:"#333",minorTickLength:4,currentValuePadding:8,currentValueInset:0}},{}],688:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return a.coerce(t,e,s,r,n)}n("visible",i(t,e).length>0)&&(n("active"),n("x"),n("y"),a.noneOrAll(t,e,["x","y"]),n("xanchor"),n("yanchor"),n("len"),n("lenmode"),n("pad.t"),n("pad.r"),n("pad.b"),n("pad.l"),a.coerceFont(n,"font",r.font),n("currentvalue.visible")&&(n("currentvalue.xanchor"),n("currentvalue.prefix"),n("currentvalue.suffix"),n("currentvalue.offset"),a.coerceFont(n,"currentvalue.font",e.font)),n("transition.duration"),n("transition.easing"),n("bgcolor"),n("activebgcolor"),n("bordercolor"),n("borderwidth"),n("ticklen"),n("tickwidth"),n("tickcolor"),n("minorticklen"))}function i(t,e){function r(t,e){return a.coerce(n,i,c,t,e)}for(var n,i,o=t.steps||[],s=e.steps=[],l=0;l=r.steps.length&&(r.active=0),e.call(s,r).call(x,r).call(c,r).call(p,r).call(b,t,r).call(l,t,r),A.setTranslate(e,r.lx+r.pad.l,r.ly+r.pad.t),e.call(v,r,r.active/(r.steps.length-1),!1),e.call(s,r)}function s(t,e,r){if(e.currentvalue.visible){var n,i,a=t.selectAll("text").data([0]);switch(e.currentvalue.xanchor){case"right":n=e.inputAreaLength-E.currentValueInset-e.currentValueMaxWidth,i="left";break;case"center":n=.5*e.inputAreaLength,i="middle";break;default:n=E.currentValueInset,i="left"}a.enter().append("text").classed(E.labelClass,!0).classed("user-select-none",!0).attr({"text-anchor":i,"data-notex":1});var o=e.currentvalue.prefix?e.currentvalue.prefix:"";if("string"==typeof r)o+=r;else{o+=e.steps[e.active].label}e.currentvalue.suffix&&(o+=e.currentvalue.suffix),a.call(A.font,e.currentvalue.font).text(o).call(T.convertToTspans,e.gd);var s=T.lineCount(a),l=(e.currentValueMaxLines+1-s)*e.currentvalue.font.size*L;return T.positionText(a,n,l),a}}function l(t,e,r){var n=t.selectAll("rect."+E.gripRectClass).data([0]);n.enter().append("rect").classed(E.gripRectClass,!0).call(d,e,t,r).style("pointer-events","all"),n.attr({width:E.gripWidth,height:E.gripHeight,rx:E.gripRadius,ry:E.gripRadius}).call(k.stroke,r.bordercolor).call(k.fill,r.bgcolor).style("stroke-width",r.borderwidth+"px")}function u(t,e,r){var n=t.selectAll("text").data([0]);return n.enter().append("text").classed(E.labelClass,!0).classed("user-select-none",!0).attr({"text-anchor":"middle","data-notex":1}),n.call(A.font,r.font).text(e.step.label).call(T.convertToTspans,r.gd),n}function c(t,e){var r=t.selectAll("g."+E.labelsClass).data([0]);r.enter().append("g").classed(E.labelsClass,!0);var n=r.selectAll("g."+E.labelGroupClass).data(e.labelSteps);n.enter().append("g").classed(E.labelGroupClass,!0),n.exit().remove(),n.each(function(t){var r=w.select(this);r.call(u,t,e),A.setTranslate(r,g(e,t.fraction),E.tickOffset+e.ticklen+e.font.size*L+E.labelOffset+e.currentValueTotalHeight)})}function h(t,e,r,n,i){var a=Math.round(n*(r.steps.length-1));a!==r.active&&f(t,e,r,a,!0,i)}function f(t,e,r,n,i,a){var o=r.active;r._input.active=r.active=n;var l=r.steps[r.active];e.call(v,r,r.active/(r.steps.length-1),a),e.call(s,r),t.emit("plotly_sliderchange",{slider:r,step:r.steps[r.active],interaction:i,previousActive:o}),l&&l.method&&i&&(e._nextMethod?(e._nextMethod.step=l,e._nextMethod.doCallback=i,e._nextMethod.doTransition=a):(e._nextMethod={step:l,doCallback:i,doTransition:a},e._nextMethodRaf=window.requestAnimationFrame(function(){var r=e._nextMethod.step;r.method&&(r.execute&&M.executeAPICommand(t,r.method,r.args),e._nextMethod=null,e._nextMethodRaf=null)})))}function d(t,e,r){function n(){return r.data()[0]}var i=r.node(),a=w.select(e);t.on("mousedown",function(){var t=n();e.emit("plotly_sliderstart",{slider:t});var o=r.select("."+E.gripRectClass);w.event.stopPropagation(),w.event.preventDefault(),o.call(k.fill,t.activebgcolor);var s=y(t,w.mouse(i)[0]);h(e,r,t,s,!0),t._dragging=!0,a.on("mousemove",function(){var t=n(),a=y(t,w.mouse(i)[0]);h(e,r,t,a,!1)}),a.on("mouseup",function(){var t=n();t._dragging=!1,o.call(k.fill,t.bgcolor),a.on("mouseup",null),a.on("mousemove",null),e.emit("plotly_sliderend",{slider:t,step:t.steps[t.active]})})})}function p(t,e){var r=t.selectAll("rect."+E.tickRectClass).data(e.steps);r.enter().append("rect").classed(E.tickRectClass,!0),r.exit().remove(),r.attr({width:e.tickwidth+"px","shape-rendering":"crispEdges"}),r.each(function(t,r){var n=r%e.labelStride==0,i=w.select(this);i.attr({height:n?e.ticklen:e.minorticklen}).call(k.fill,e.tickcolor),A.setTranslate(i,g(e,r/(e.steps.length-1))-.5*e.tickwidth,(n?E.tickOffset:E.minorTickOffset)+e.currentValueTotalHeight)})}function m(t){t.labelSteps=[];for(var e=t.steps.length,r=0;r0&&(o=o.transition().duration(e.transition.duration).ease(e.transition.easing)),o.attr("transform","translate("+(a-.5*E.gripWidth)+","+e.currentValueTotalHeight+")")}}function g(t,e){return t.inputAreaStart+E.stepInset+(t.inputAreaLength-2*E.stepInset)*Math.min(1,Math.max(0,e))}function y(t,e){return Math.min(1,Math.max(0,(e-E.stepInset-t.inputAreaStart)/(t.inputAreaLength-2*E.stepInset-2*t.inputAreaStart)))}function b(t,e,r){var n=t.selectAll("rect."+E.railTouchRectClass).data([0]);n.enter().append("rect").classed(E.railTouchRectClass,!0).call(d,e,t,r).style("pointer-events","all"),n.attr({width:r.inputAreaLength,height:Math.max(r.inputAreaWidth,E.tickOffset+r.ticklen+r.labelHeight)}).call(k.fill,r.bgcolor).attr("opacity",0),A.setTranslate(n,0,r.currentValueTotalHeight)}function x(t,e){var r=t.selectAll("rect."+E.railRectClass).data([0]);r.enter().append("rect").classed(E.railRectClass,!0);var n=e.inputAreaLength-2*E.railInset;r.attr({width:n,height:E.railWidth,rx:E.railRadius,ry:E.railRadius,"shape-rendering":"crispEdges"}).call(k.stroke,e.bordercolor).call(k.fill,e.bgcolor).style("stroke-width",e.borderwidth+"px"),A.setTranslate(r,E.railInset,.5*(e.inputAreaWidth-E.railWidth)+e.currentValueTotalHeight)}function _(t){for(var e=t._fullLayout._pushmargin||{},r=Object.keys(e),n=0;n0?[0]:[]);if(s.enter().append("g").classed(E.containerClassName,!0).style("cursor","ew-resize"),s.exit().remove(),s.exit().size()&&_(t),0!==r.length){var l=s.selectAll("g."+E.groupClassName).data(r,i);l.enter().append("g").classed(E.groupClassName,!0),l.exit().each(function(e){w.select(this).remove(),e._commandObserver.remove(),delete e._commandObserver,M.autoMargin(t,E.autoMarginIdRoot+e._index)});for(var u=0;u0||f<0){var m={left:[-r,0],right:[r,0],top:[0,-r],bottom:[0,r]}[_.side];e.attr("transform","translate("+m+")")}}}var v,g=r.propContainer,y=r.propName,b=r.traceIndex,x=r.dfltName,_=r.avoid||{},w=r.attributes,M=r.transform,k=r.containerGroup,A=t._fullLayout,T=g.titlefont.family,S=g.titlefont.size,E=g.titlefont.color,L=1,C=!1,z=g.title.trim();"title"===y?v="titleText":-1!==y.indexOf("axis")?v="axisTitleText":y.indexOf(!0)&&(v="colorbarTitleText");var I=t._context.edits[v];""===z&&(L=0),z.match(f)&&(L=.2,C=!0,I||(z=""));var D=z||I;k||(k=A._infolayer.selectAll(".g-"+e).data([0]),k.enter().append("g").classed("g-"+e,!0));var P=k.selectAll("text").data(D?[0]:[]);if(P.enter().append("text"),P.text(z).attr("class",e),P.exit().remove(),D){P.call(d);var O="Click to enter "+x+" title";I&&(z?P.on(".opacity",null):function(){L=0,C=!0,z=O,P.text(z).on("mouseover.opacity",function(){n.select(this).transition().duration(h.SHOW_PLACEHOLDER).style("opacity",1)}).on("mouseout.opacity",function(){n.select(this).transition().duration(h.HIDE_PLACEHOLDER).style("opacity",0)})}(),P.call(c.makeEditable,{gd:t}).on("edit",function(e){void 0!==b?a.restyle(t,y,e,b):a.relayout(t,y,e)}).on("cancel",function(){this.text(this.attr("data-unformatted")).call(d)}).on("input",function(t){this.text(t||" ").call(c.positionText,w.x,w.y)})),P.classed("js-placeholder",C)}}},{"../../constants/interactions":703,"../../lib":724,"../../lib/svg_text_utils":743,"../../plotly":759,"../../plots/plots":827,"../color":602,"../drawing":626,d3:120,"fast-isnumeric":129}],692:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),i=t("../color/attributes"),a=t("../../lib/extend").extendFlat,o=t("../../plots/pad_attributes"),s={_isLinkedToArray:"button",method:{valType:"enumerated",values:["restyle","relayout","animate","update","skip"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string",dflt:""},execute:{valType:"boolean",dflt:!0}};e.exports={_isLinkedToArray:"updatemenu",_arrayAttrRegexps:[/^updatemenus\[(0|[1-9][0-9]+)\]\.buttons/],visible:{valType:"boolean"},type:{valType:"enumerated",values:["dropdown","buttons"],dflt:"dropdown"},direction:{valType:"enumerated",values:["left","right","up","down"],dflt:"down"},active:{valType:"integer",min:-1,dflt:0},showactive:{valType:"boolean",dflt:!0},buttons:s,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:"top"},pad:a({},o,{}),font:a({},n,{}),bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:i.borderLine},borderwidth:{valType:"number",min:0,dflt:1}}},{"../../lib/extend":715,"../../plots/font_attributes":788,"../../plots/pad_attributes":826,"../color/attributes":601}],693:[function(t,e,r){"use strict";e.exports={name:"updatemenus",containerClassName:"updatemenu-container",headerGroupClassName:"updatemenu-header-group",headerClassName:"updatemenu-header",headerArrowClassName:"updatemenu-header-arrow",dropdownButtonGroupClassName:"updatemenu-dropdown-button-group",dropdownButtonClassName:"updatemenu-dropdown-button",buttonClassName:"updatemenu-button",itemRectClassName:"updatemenu-item-rect",itemTextClassName:"updatemenu-item-text",menuIndexAttrName:"updatemenu-active-index",autoMarginIdRoot:"updatemenu-",blankHeaderOpts:{label:" "},minWidth:30,minHeight:30,textPadX:24,arrowPadX:16,rx:2,ry:2,textOffsetX:12,textOffsetY:3,arrowOffsetX:4,gapButtonHeader:5,gapButton:2,activeColor:"#F4FAFF",hoverColor:"#F4FAFF",arrowSymbol:{left:"\u25c4",right:"\u25ba",up:"\u25b2",down:"\u25bc"}}},{}],694:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return a.coerce(t,e,s,r,n)}n("visible",i(t,e).length>0)&&(n("active"),n("direction"),n("type"),n("showactive"),n("x"),n("y"),a.noneOrAll(t,e,["x","y"]),n("xanchor"),n("yanchor"),n("pad.t"),n("pad.r"),n("pad.b"),n("pad.l"),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,c,t,e)}for(var n,i,o=t.buttons||[],s=e.buttons=[],l=0;l0?[0]:[]);if(a.enter().append("g").classed(L.containerClassName,!0).style("cursor","pointer"),a.exit().remove(),a.exit().size()&&_(t),0!==r.length){var c=a.selectAll("g."+L.headerGroupClassName).data(r,i);c.enter().append("g").classed(L.headerGroupClassName,!0);var h=a.selectAll("g."+L.dropdownButtonGroupClassName).data([0]);h.enter().append("g").classed(L.dropdownButtonGroupClassName,!0).style("pointer-events","all");for(var f=0;fM,T=n.barLength+2*n.barPad,S=n.barWidth+2*n.barPad,E=p,L=v+g;L+S>u&&(L=u-S);var C=this.container.selectAll("rect.scrollbar-horizontal").data(A?[0]:[]);C.exit().on(".drag",null).remove(),C.enter().append("rect").classed("scrollbar-horizontal",!0).call(a.fill,n.barColor),A?(this.hbar=C.attr({rx:n.barRadius,ry:n.barRadius,x:E,y:L,width:T,height:S}),this._hbarXMin=E+T/2,this._hbarTranslateMax=M-T):(delete this.hbar,delete this._hbarXMin,delete this._hbarTranslateMax);var z=g>k,I=n.barWidth+2*n.barPad,D=n.barLength+2*n.barPad,P=p+m,O=v;P+I>l&&(P=l-I);var R=this.container.selectAll("rect.scrollbar-vertical").data(z?[0]:[]);R.exit().on(".drag",null).remove(),R.enter().append("rect").classed("scrollbar-vertical",!0).call(a.fill,n.barColor),z?(this.vbar=R.attr({rx:n.barRadius,ry:n.barRadius,x:P,y:O,width:I,height:D}),this._vbarYMin=O+D/2,this._vbarTranslateMax=k-D):(delete this.vbar,delete this._vbarYMin,delete this._vbarTranslateMax);var F=this.id,j=c-.5,N=z?h+I+.5:h+.5,B=f-.5,U=A?d+S+.5:d+.5,V=s._topdefs.selectAll("#"+F).data(A||z?[0]:[]);if(V.exit().remove(),V.enter().append("clipPath").attr("id",F).append("rect"),A||z?(this._clipRect=V.select("rect").attr({x:Math.floor(j),y:Math.floor(B),width:Math.ceil(N)-Math.floor(j),height:Math.ceil(U)-Math.floor(B)}),this.container.call(o.setClipUrl,F),this.bg.attr({x:p,y:v,width:m,height:g})):(this.bg.attr({width:0,height:0}),this.container.on("wheel",null).on(".drag",null).call(o.setClipUrl,null),delete this._clipRect),A||z){var H=i.behavior.drag().on("dragstart",function(){i.event.sourceEvent.preventDefault()}).on("drag",this._onBoxDrag.bind(this));this.container.on("wheel",null).on("wheel",this._onBoxWheel.bind(this)).on(".drag",null).call(H);var q=i.behavior.drag().on("dragstart",function(){i.event.sourceEvent.preventDefault(),i.event.sourceEvent.stopPropagation()}).on("drag",this._onBarDrag.bind(this));A&&this.hbar.on(".drag",null).call(q),z&&this.vbar.on(".drag",null).call(q)}this.setTranslate(e,r)},n.prototype.disable=function(){(this.hbar||this.vbar)&&(this.bg.attr({width:0,height:0}),this.container.on("wheel",null).on(".drag",null).call(o.setClipUrl,null),delete this._clipRect),this.hbar&&(this.hbar.on(".drag",null),this.hbar.remove(),delete this.hbar,delete this._hbarXMin,delete this._hbarTranslateMax),this.vbar&&(this.vbar.on(".drag",null),this.vbar.remove(),delete this.vbar,delete this._vbarYMin,delete this._vbarTranslateMax)},n.prototype._onBoxDrag=function(){var t=this.translateX,e=this.translateY;this.hbar&&(t-=i.event.dx),this.vbar&&(e-=i.event.dy),this.setTranslate(t,e)},n.prototype._onBoxWheel=function(){var t=this.translateX,e=this.translateY;this.hbar&&(t+=i.event.deltaY),this.vbar&&(e+=i.event.deltaY),this.setTranslate(t,e)},n.prototype._onBarDrag=function(){var t=this.translateX,e=this.translateY;if(this.hbar){var r=t+this._hbarXMin,n=r+this._hbarTranslateMax;t=(s.constrain(i.event.x,r,n)-r)/(n-r)*(this.position.w-this._box.w)}if(this.vbar){var a=e+this._vbarYMin,o=a+this._vbarTranslateMax;e=(s.constrain(i.event.y,a,o)-a)/(o-a)*(this.position.h-this._box.h)}this.setTranslate(t,e)},n.prototype.setTranslate=function(t,e){var r=this.position.w-this._box.w,n=this.position.h-this._box.h;if(t=s.constrain(t||0,0,r),e=s.constrain(e||0,0,n),this.translateX=t,this.translateY=e,this.container.call(o.setTranslate,this._box.l-this.position.l-t,this._box.t-this.position.t-e),this._clipRect&&this._clipRect.attr({x:Math.floor(this.position.l+t-.5),y:Math.floor(this.position.t+e-.5)}),this.hbar){var i=t/r;this.hbar.call(o.setTranslate,t+i*this._hbarTranslateMax,e)}if(this.vbar){var a=e/n;this.vbar.call(o.setTranslate,t,e+a*this._vbarTranslateMax)}}},{"../../lib":724,"../color":602,"../drawing":626,d3:120}],698:[function(t,e,r){"use strict";e.exports={FROM_BL:{left:0,center:.5,right:1,bottom:0,middle:.5,top:1},FROM_TL:{left:0,center:.5,right:1,bottom:1,middle:.5,top:0},LINE_SPACING:1.3,MID_SHIFT:.35}},{}],699:[function(t,e,r){"use strict";e.exports={solid:[1],dot:[1,1],dash:[4,1],longdash:[8,1],dashdot:[4,1,1,1],longdashdot:[8,1,1,1]}},{}],700:[function(t,e,r){"use strict";for(var n=t("../lib/extend").extendFlat,i={circle:{unicode:"\u25cf"},square:{unicode:"\u25a0"},diamond:{unicode:"\u25c6"},cross:{unicode:"\u271a"},x:{unicode:"\u274c"},"triangle-up":{unicode:"\u25b2"},"triangle-down":{unicode:"\u25bc"},"triangle-left":{unicode:"\u25c4"},"triangle-right":{unicode:"\u25ba"},"triangle-ne":{unicode:"\u25e5"},"triangle-nw":{unicode:"\u25e4"},"triangle-se":{unicode:"\u25e2"},"triangle-sw":{unicode:"\u25e3"},pentagon:{unicode:"\u2b1f"},hexagon:{unicode:"\u2b22"},hexagon2:{unicode:"\u2b23"},star:{unicode:"\u2605"},"diamond-tall":{unicode:"\u2666"},bowtie:{unicode:"\u29d3"},"diamond-x":{unicode:"\u2756"},"cross-thin":{unicode:"+",noBorder:!0},asterisk:{unicode:"\u2733",noBorder:!0},"y-up":{unicode:"\u2144",noBorder:!0},"y-down":{unicode:"Y",noBorder:!0},"line-ew":{unicode:"\u2500",noBorder:!0},"line-ns":{unicode:"\u2502",noBorder:!0}},a={},o=Object.keys(i),s=0;s","#62":">",nbsp:"\xa0","#160":"\xa0",times:"\xd7","#215":"\xd7",plusmn:"\xb1","#177":"\xb1",deg:"\xb0","#176":"\xb0"}}},{}],706:[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}},{}],707:[function(t,e,r){"use strict";var n=t("./plotly");r.version="1.29.1",t("es6-promise").polyfill(),t("../build/plotcss"),t("./fonts/mathjax_config"),r.plot=n.plot,r.newPlot=n.newPlot,r.restyle=n.restyle,r.relayout=n.relayout,r.redraw=n.redraw,r.update=n.update,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=t("./plot_api/register"),r.toImage=t("./plot_api/to_image"),r.downloadImage=t("./snapshot/download"),r.validate=t("./plot_api/validate"),r.addFrames=n.addFrames,r.deleteFrames=n.deleteFrames,r.animate=n.animate,r.register(t("./traces/scatter")),r.register([t("./components/fx"),t("./components/legend"),t("./components/annotations"),t("./components/annotations3d"),t("./components/shapes"),t("./components/images"),t("./components/updatemenus"),t("./components/sliders"),t("./components/rangeslider"),t("./components/rangeselector")]),r.Icons=t("../build/ploticon"),r.Plots=n.Plots,r.Fx=t("./components/fx"),r.Snapshot=t("./snapshot"),r.PlotSchema=t("./plot_api/plot_schema"),r.Queue=t("./lib/queue"),r.d3=t("d3")},{"../build/plotcss":1,"../build/ploticon":2,"./components/annotations":593,"./components/annotations3d":598,"./components/fx":643,"./components/images":651,"./components/legend":659,"./components/rangeselector":671,"./components/rangeslider":677,"./components/shapes":684,"./components/sliders":690,"./components/updatemenus":696,"./fonts/mathjax_config":708,"./lib/queue":736,"./plot_api/plot_schema":753,"./plot_api/register":754,"./plot_api/set_plot_config":755,"./plot_api/to_image":757,"./plot_api/validate":758,"./plotly":759,"./snapshot":847,"./snapshot/download":844,"./traces/scatter":1035,d3:120,"es6-promise":126}],708:[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},{}],709:[function(t,e,r){"use strict";e.exports=function(t,e,r,n){Array.isArray(t)&&(e[r]=t[n])}},{}],710:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../constants/numerical").BADNUM,a=/^['"%,$#\s']+|[, ]|['"%,$#\s']+$/g;e.exports=function(t){return"string"==typeof t&&(t=t.replace(a,"")),n(t)?Number(t):i}},{"../constants/numerical":704,"fast-isnumeric":129}],711:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("tinycolor2"),a=t("../plots/attributes"),o=t("../components/colorscale/get_scale"),s=(Object.keys(t("../components/colorscale/scales")),t("./nested_property")),l=/^([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)},validateFunction:function(t,e){e.coerceNumber&&(t=+t);for(var r=e.values,n=0;ni.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;!0!==n.strict&&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;if("string"==typeof t&&t.substr(0,n)===r&&l.test(t.substr(n)))return void e.set(t);e.set(r)},validateFunction:function(t,e){var r=e.dflt,n=r.length;return t===r||"string"==typeof t&&!(t.substr(0,n)!==r||!l.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;a0&&(o=o.replace(/0+$/,"").replace(/[\.]$/,"")),n+=":"+o}return n}function l(t){return t.formatDate("yyyy")}function u(t){return t.formatDate("M yyyy")}function c(t){return t.formatDate("M d")}function h(t){return t.formatDate("M d, yyyy")}var f=t("d3"),d=t("fast-isnumeric"),p=t("./loggers").error,m=t("./mod"),v=t("../constants/numerical"),g=v.BADNUM,y=v.ONEDAY,b=v.ONEHOUR,x=v.ONEMIN,_=v.ONESEC,w=v.EPOCHJD,M=t("../registry"),k=f.time.format.utc,A=/^\s*(-?\d\d\d\d|\d\d)(-(\d?\d)(-(\d?\d)([ Tt]([01]?\d|2[0-3])(:([0-5]\d)(:([0-5]\d(\.\d+)?))?(Z|z|[+\-]\d\d:?\d\d)?)?)?)?)?\s*$/m,T=/^\s*(-?\d\d\d\d|\d\d)(-(\d?\di?)(-(\d?\d)([ Tt]([01]?\d|2[0-3])(:([0-5]\d)(:([0-5]\d(\.\d+)?))?(Z|z|[+\-]\d\d:?\d\d)?)?)?)?)?\s*$/m,S=(new Date).getFullYear()-70;r.dateTick0=function(t,e){return n(t)?e?M.getComponentMethod("calendars","CANONICAL_SUNDAY")[t]:M.getComponentMethod("calendars","CANONICAL_TICK")[t]:e?"2000-01-02":"2000-01-01"},r.dfltRange=function(t){return n(t)?M.getComponentMethod("calendars","DFLTRANGE")[t]:["2000-01-01","2001-01-01"]},r.isJSDate=function(t){return"object"==typeof t&&null!==t&&"function"==typeof t.getTime};var E,L;r.dateTime2ms=function(t,e){if(r.isJSDate(t))return t=Number(t)-t.getTimezoneOffset()*x,t>=E&&t<=L?t:g;if("string"!=typeof t&&"number"!=typeof t)return g;t=String(t);var i=n(e),a=t.charAt(0);!i||"G"!==a&&"g"!==a||(t=t.substr(1),e="");var o=i&&"chinese"===e.substr(0,7),s=t.match(o?T:A);if(!s)return g;var l=s[1],u=s[3]||"1",c=Number(s[5]||1),h=Number(s[7]||0),f=Number(s[9]||0),d=Number(s[11]||0);if(i){if(2===l.length)return g;l=Number(l);var p;try{var m=M.getComponentMethod("calendars","getCal")(e);if(o){var v="i"===u.charAt(u.length-1);u=parseInt(u,10),p=m.newDate(l,m.toMonthIndex(l,u,v),c)}else p=m.newDate(l,Number(u),c)}catch(t){return g}return p?(p.toJD()-w)*y+h*b+f*x+d*_:g}l=2===l.length?(Number(l)+2e3-S)%100+S:Number(l),u-=1;var k=new Date(Date.UTC(2e3,u,c,h,f));return k.setUTCFullYear(l),k.getUTCMonth()!==u?g:k.getUTCDate()!==c?g:k.getTime()+d*_},E=r.MIN_MS=r.dateTime2ms("-9999"),L=r.MAX_MS=r.dateTime2ms("9999-12-31 23:59:59.9999"),r.isDateTime=function(t,e){return r.dateTime2ms(t,e)!==g};var C=90*y,z=3*b,I=5*x;r.ms2DateTime=function(t,e,r){if("number"!=typeof t||!(t>=E&&t<=L))return g;e||(e=0);var i,o,s,l,u,c,h=Math.floor(10*m(t+.05,1)),f=Math.round(t-h/10);if(n(r)){var d=Math.floor(f/y)+w,p=Math.floor(m(t,y));try{i=M.getComponentMethod("calendars","getCal")(r).fromJD(d).formatDate("yyyy-mm-dd")}catch(t){i=k("G%Y-%m-%d")(new Date(f))}if("-"===i.charAt(0))for(;i.length<11;)i="-0"+i.substr(1);else for(;i.length<10;)i="0"+i;o=e=E+y&&t<=L-y))return g;var e=Math.floor(10*m(t+.05,1)),r=new Date(Math.round(t-e/10));return a(f.time.format("%Y-%m-%d")(r),r.getHours(),r.getMinutes(),r.getSeconds(),10*r.getUTCMilliseconds()+e)},r.cleanDate=function(t,e,i){if(r.isJSDate(t)||"number"==typeof t){if(n(i))return p("JS Dates and milliseconds are incompatible with world calendars",t),e;if(!(t=r.ms2DateTimeLocal(+t))&&void 0!==e)return e}else if(!r.isDateTime(t,i))return p("unrecognized date",t),e;return t};var D=/%\d?f/g,P=[59,59.9,59.99,59.999,59.9999],O=k("%Y"),R=k("%b %Y"),F=k("%b %-d"),j=k("%b %-d, %Y");r.formatDate=function(t,e,r,i){var a,f;if(i=n(i)&&i,e)return o(e,t,i);if(i)try{var d=Math.floor((t+.05)/y)+w,p=M.getComponentMethod("calendars","getCal")(i).fromJD(d);"y"===r?f=l(p):"m"===r?f=u(p):"d"===r?(a=l(p),f=c(p)):(a=h(p),f=s(t,r))}catch(t){return"Invalid"}else{var m=new Date(Math.floor(t+.05));"y"===r?f=O(m):"m"===r?f=R(m):"d"===r?(a=O(m),f=F(m)):(a=j(m),f=s(t,r))}return f+(a?"\n"+a:"")};var N=3*y;r.incrementMonth=function(t,e,r){r=n(r)&&r;var i=m(t,y);if(t=Math.round(t-i),r)try{var a=Math.round(t/y)+w,o=M.getComponentMethod("calendars","getCal")(r),s=o.fromJD(a);return e%12?o.add(s,e,"m"):o.add(s,e/12,"y"),(s.toJD()-w)*y+i}catch(e){p("invalid ms "+t+" in calendar "+r)}var l=new Date(t+N);return l.setUTCMonth(l.getUTCMonth()+e)+i-N},r.findExactDates=function(t,e){for(var r,i,a=0,o=0,s=0,l=0,u=n(e)&&M.getComponentMethod("calendars","getCal")(e),c=0;c0&&(i.push(a),a=[])}return a.length>0&&i.push(a),i},r.makeLine=function(t,e){var r={};return r=1===t.length?{type:"LineString",coordinates:t[0]}:{type:"MultiLineString",coordinates:t},e&&(r.trace=e),r},r.makePolygon=function(t,e){var r={};if(1===t.length)r={type:"Polygon",coordinates:t};else{for(var n=new Array(t.length),i=0;i1||m<0||m>1?null:{x:t+l*m,y:e+h*m}}function i(t,e,r,n,i){var a=n*t+i*e;if(a<0)return n*n+i*i;if(a>r){var o=n-t,s=i-e;return o*o+s*s}var l=n*e-i*t;return l*l/r}var a=t("./mod");r.segmentsIntersect=n,r.segmentDistance=function(t,e,r,a,o,s,l,u){if(n(t,e,r,a,o,s,l,u))return 0;var c=r-t,h=a-e,f=l-o,d=u-s,p=c*c+h*h,m=f*f+d*d,v=Math.min(i(c,h,p,o-t,s-e),i(c,h,p,l-t,u-e),i(f,d,m,t-o,e-s),i(f,d,m,r-o,a-s));return Math.sqrt(v)};var o,s,l;r.getTextLocation=function(t,e,r,n){if(t===s&&n===l||(o={},s=t,l=n),o[r])return o[r];var i=t.getPointAtLength(a(r-n/2,e)),u=t.getPointAtLength(a(r+n/2,e)),c=Math.atan((u.y-i.y)/(u.x-i.x)),h=t.getPointAtLength(a(r,e)),f=(4*h.x+i.x+u.x)/6,d=(4*h.y+i.y+u.y)/6,p={x:f,y:d,theta:c};return o[r]=p,p},r.clearLocationCache=function(){s=null},r.getVisibleSegment=function(t,e,r){function n(e){var r=t.getPointAtLength(e);0===e?i=r:e===h&&(a=r);var n=r.xs?r.x-s:0,c=r.yu?r.y-u:0;return Math.sqrt(n*n+c*c)}for(var i,a,o=e.left,s=e.right,l=e.top,u=e.bottom,c=0,h=t.getTotalLength(),f=h,d=n(c);d;){if((c+=d+r)>f)return;d=n(c)}for(d=n(f);d;){if(f-=d+r,c>f)return;d=n(f)}return{min:c,max:f,len:f-c,total:h,isClosed:0===c&&f===h&&Math.abs(i.x-a.x)<.1&&Math.abs(i.y-a.y)<.1}}},{"./mod":729}],721:[function(t,e,r){"use strict";function n(t,e){var r=t;return r[3]*=e,r}function i(t){if(s(t))return h;var e=l(t);return e.length?e:h}function a(t){return s(t)?t:f}function o(t,e,r){var o,s,c,d,p,m=t.color,v=Array.isArray(m),g=Array.isArray(e),y=[] +;var d=e.selectAll("text."+L.headerArrowClassName).data([0]);d.enter().append("text").classed(L.headerArrowClassName,!0).classed("user-select-none",!0).attr("text-anchor","end").call(A.font,i.font).text(L.arrowSymbol[i.direction]),d.attr({x:i.headerWidth-L.arrowOffsetX+i.pad.l,y:i.headerHeight/2+L.textOffsetY+i.pad.t}),a.on("click",function(){r.call(x),r.attr(L.menuIndexAttrName,o(r,i)?-1:String(i._index)),u(t,e,r,n,i)}),a.on("mouseover",function(){a.call(v)}),a.on("mouseout",function(){a.call(g,i)}),A.setTranslate(e,i.lx,i.ly)}function u(t,e,r,n,i){r||(r=e,r.attr("pointer-events","all"));var o=a(r)&&"buttons"!==i.type?[]:i.buttons,l="dropdown"===i.type?L.dropdownButtonClassName:L.buttonClassName,u=r.selectAll("g."+l).data(o),d=u.enter().append("g").classed(l,!0),p=u.exit();"dropdown"===i.type?(d.attr("opacity","0").transition().attr("opacity","1"),p.transition().attr("opacity","0").remove()):p.remove();var y=0,x=0,_=-1!==["up","down"].indexOf(i.direction);"dropdown"===i.type&&(_?x=i.headerHeight+L.gapButtonHeader:y=i.headerWidth+L.gapButtonHeader),"dropdown"===i.type&&"up"===i.direction&&(x=-L.gapButtonHeader+L.gapButton-i.openHeight),"dropdown"===i.type&&"left"===i.direction&&(y=-L.gapButtonHeader+L.gapButton-i.openWidth);var k={x:i.lx+y+i.pad.l,y:i.ly+x+i.pad.t,yPad:L.gapButton,xPad:L.gapButton,index:0},A={l:k.x+i.borderwidth,t:k.y+i.borderwidth};u.each(function(a,o){var l=w.select(this);l.call(f,i,a,t).call(b,i,k),l.on("click",function(){w.event.defaultPrevented||(s(t,i,a,e,r,n,o),a.execute&&M.executeAPICommand(t,a.method,a.args),t.emit("plotly_buttonclicked",{menu:i,button:a,active:i.active}))}),l.on("mouseover",function(){l.call(v)}),l.on("mouseout",function(){l.call(g,i),u.call(m,i)})}),u.call(m,i),_?(A.w=Math.max(i.openWidth,i.headerWidth),A.h=k.y-A.t):(A.w=k.x-A.l,A.h=Math.max(i.openHeight,i.headerHeight)),A.direction=i.direction,n&&(u.size()?c(t,e,r,n,i,A):h(n))}function c(t,e,r,n,i,a){var o,s,l,u=i.direction,c="up"===u||"down"===u,h=i.active;if(c)for(s=0,l=0;l0?[0]:[]);if(a.enter().append("g").classed(L.containerClassName,!0).style("cursor","pointer"),a.exit().remove(),a.exit().size()&&_(t),0!==r.length){var c=a.selectAll("g."+L.headerGroupClassName).data(r,i);c.enter().append("g").classed(L.headerGroupClassName,!0);var h=a.selectAll("g."+L.dropdownButtonGroupClassName).data([0]);h.enter().append("g").classed(L.dropdownButtonGroupClassName,!0).style("pointer-events","all");for(var f=0;fM,T=n.barLength+2*n.barPad,S=n.barWidth+2*n.barPad,E=p,L=v+g;L+S>u&&(L=u-S);var C=this.container.selectAll("rect.scrollbar-horizontal").data(A?[0]:[]);C.exit().on(".drag",null).remove(),C.enter().append("rect").classed("scrollbar-horizontal",!0).call(a.fill,n.barColor),A?(this.hbar=C.attr({rx:n.barRadius,ry:n.barRadius,x:E,y:L,width:T,height:S}),this._hbarXMin=E+T/2,this._hbarTranslateMax=M-T):(delete this.hbar,delete this._hbarXMin,delete this._hbarTranslateMax);var z=g>k,I=n.barWidth+2*n.barPad,D=n.barLength+2*n.barPad,P=p+m,O=v;P+I>l&&(P=l-I);var R=this.container.selectAll("rect.scrollbar-vertical").data(z?[0]:[]);R.exit().on(".drag",null).remove(),R.enter().append("rect").classed("scrollbar-vertical",!0).call(a.fill,n.barColor),z?(this.vbar=R.attr({rx:n.barRadius,ry:n.barRadius,x:P,y:O,width:I,height:D}),this._vbarYMin=O+D/2,this._vbarTranslateMax=k-D):(delete this.vbar,delete this._vbarYMin,delete this._vbarTranslateMax);var F=this.id,j=c-.5,N=z?h+I+.5:h+.5,B=f-.5,U=A?d+S+.5:d+.5,V=s._topdefs.selectAll("#"+F).data(A||z?[0]:[]);if(V.exit().remove(),V.enter().append("clipPath").attr("id",F).append("rect"),A||z?(this._clipRect=V.select("rect").attr({x:Math.floor(j),y:Math.floor(B),width:Math.ceil(N)-Math.floor(j),height:Math.ceil(U)-Math.floor(B)}),this.container.call(o.setClipUrl,F),this.bg.attr({x:p,y:v,width:m,height:g})):(this.bg.attr({width:0,height:0}),this.container.on("wheel",null).on(".drag",null).call(o.setClipUrl,null),delete this._clipRect),A||z){var H=i.behavior.drag().on("dragstart",function(){i.event.sourceEvent.preventDefault()}).on("drag",this._onBoxDrag.bind(this));this.container.on("wheel",null).on("wheel",this._onBoxWheel.bind(this)).on(".drag",null).call(H);var q=i.behavior.drag().on("dragstart",function(){i.event.sourceEvent.preventDefault(),i.event.sourceEvent.stopPropagation()}).on("drag",this._onBarDrag.bind(this));A&&this.hbar.on(".drag",null).call(q),z&&this.vbar.on(".drag",null).call(q)}this.setTranslate(e,r)},n.prototype.disable=function(){(this.hbar||this.vbar)&&(this.bg.attr({width:0,height:0}),this.container.on("wheel",null).on(".drag",null).call(o.setClipUrl,null),delete this._clipRect),this.hbar&&(this.hbar.on(".drag",null),this.hbar.remove(),delete this.hbar,delete this._hbarXMin,delete this._hbarTranslateMax),this.vbar&&(this.vbar.on(".drag",null),this.vbar.remove(),delete this.vbar,delete this._vbarYMin,delete this._vbarTranslateMax)},n.prototype._onBoxDrag=function(){var t=this.translateX,e=this.translateY;this.hbar&&(t-=i.event.dx),this.vbar&&(e-=i.event.dy),this.setTranslate(t,e)},n.prototype._onBoxWheel=function(){var t=this.translateX,e=this.translateY;this.hbar&&(t+=i.event.deltaY),this.vbar&&(e+=i.event.deltaY),this.setTranslate(t,e)},n.prototype._onBarDrag=function(){var t=this.translateX,e=this.translateY;if(this.hbar){var r=t+this._hbarXMin,n=r+this._hbarTranslateMax;t=(s.constrain(i.event.x,r,n)-r)/(n-r)*(this.position.w-this._box.w)}if(this.vbar){var a=e+this._vbarYMin,o=a+this._vbarTranslateMax;e=(s.constrain(i.event.y,a,o)-a)/(o-a)*(this.position.h-this._box.h)}this.setTranslate(t,e)},n.prototype.setTranslate=function(t,e){var r=this.position.w-this._box.w,n=this.position.h-this._box.h;if(t=s.constrain(t||0,0,r),e=s.constrain(e||0,0,n),this.translateX=t,this.translateY=e,this.container.call(o.setTranslate,this._box.l-this.position.l-t,this._box.t-this.position.t-e),this._clipRect&&this._clipRect.attr({x:Math.floor(this.position.l+t-.5),y:Math.floor(this.position.t+e-.5)}),this.hbar){var i=t/r;this.hbar.call(o.setTranslate,t+i*this._hbarTranslateMax,e)}if(this.vbar){var a=e/n;this.vbar.call(o.setTranslate,t,e+a*this._vbarTranslateMax)}}},{"../../lib":724,"../color":602,"../drawing":626,d3:120}],698:[function(t,e,r){"use strict";e.exports={FROM_BL:{left:0,center:.5,right:1,bottom:0,middle:.5,top:1},FROM_TL:{left:0,center:.5,right:1,bottom:1,middle:.5,top:0},LINE_SPACING:1.3,MID_SHIFT:.35}},{}],699:[function(t,e,r){"use strict";e.exports={solid:[1],dot:[1,1],dash:[4,1],longdash:[8,1],dashdot:[4,1,1,1],longdashdot:[8,1,1,1]}},{}],700:[function(t,e,r){"use strict";for(var n=t("../lib/extend").extendFlat,i={circle:{unicode:"\u25cf"},square:{unicode:"\u25a0"},diamond:{unicode:"\u25c6"},cross:{unicode:"\u271a"},x:{unicode:"\u274c"},"triangle-up":{unicode:"\u25b2"},"triangle-down":{unicode:"\u25bc"},"triangle-left":{unicode:"\u25c4"},"triangle-right":{unicode:"\u25ba"},"triangle-ne":{unicode:"\u25e5"},"triangle-nw":{unicode:"\u25e4"},"triangle-se":{unicode:"\u25e2"},"triangle-sw":{unicode:"\u25e3"},pentagon:{unicode:"\u2b1f"},hexagon:{unicode:"\u2b22"},hexagon2:{unicode:"\u2b23"},star:{unicode:"\u2605"},"diamond-tall":{unicode:"\u2666"},bowtie:{unicode:"\u29d3"},"diamond-x":{unicode:"\u2756"},"cross-thin":{unicode:"+",noBorder:!0},asterisk:{unicode:"\u2733",noBorder:!0},"y-up":{unicode:"\u2144",noBorder:!0},"y-down":{unicode:"Y",noBorder:!0},"line-ew":{unicode:"\u2500",noBorder:!0},"line-ns":{unicode:"\u2502",noBorder:!0}},a={},o=Object.keys(i),s=0;s","#62":">",nbsp:"\xa0","#160":"\xa0",times:"\xd7","#215":"\xd7",plusmn:"\xb1","#177":"\xb1",deg:"\xb0","#176":"\xb0"}}},{}],706:[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}},{}],707:[function(t,e,r){"use strict";var n=t("./plotly");r.version="1.29.2",t("es6-promise").polyfill(),t("../build/plotcss"),t("./fonts/mathjax_config"),r.plot=n.plot,r.newPlot=n.newPlot,r.restyle=n.restyle,r.relayout=n.relayout,r.redraw=n.redraw,r.update=n.update,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=t("./plot_api/register"),r.toImage=t("./plot_api/to_image"),r.downloadImage=t("./snapshot/download"),r.validate=t("./plot_api/validate"),r.addFrames=n.addFrames,r.deleteFrames=n.deleteFrames,r.animate=n.animate,r.register(t("./traces/scatter")),r.register([t("./components/fx"),t("./components/legend"),t("./components/annotations"),t("./components/annotations3d"),t("./components/shapes"),t("./components/images"),t("./components/updatemenus"),t("./components/sliders"),t("./components/rangeslider"),t("./components/rangeselector")]),r.Icons=t("../build/ploticon"),r.Plots=n.Plots,r.Fx=t("./components/fx"),r.Snapshot=t("./snapshot"),r.PlotSchema=t("./plot_api/plot_schema"),r.Queue=t("./lib/queue"),r.d3=t("d3")},{"../build/plotcss":1,"../build/ploticon":2,"./components/annotations":593,"./components/annotations3d":598,"./components/fx":643,"./components/images":651,"./components/legend":659,"./components/rangeselector":671,"./components/rangeslider":677,"./components/shapes":684,"./components/sliders":690,"./components/updatemenus":696,"./fonts/mathjax_config":708,"./lib/queue":736,"./plot_api/plot_schema":753,"./plot_api/register":754,"./plot_api/set_plot_config":755,"./plot_api/to_image":757,"./plot_api/validate":758,"./plotly":759,"./snapshot":847,"./snapshot/download":844,"./traces/scatter":1035,d3:120,"es6-promise":126}],708:[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},{}],709:[function(t,e,r){"use strict";e.exports=function(t,e,r,n){Array.isArray(t)&&(e[r]=t[n])}},{}],710:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../constants/numerical").BADNUM,a=/^['"%,$#\s']+|[, ]|['"%,$#\s']+$/g;e.exports=function(t){return"string"==typeof t&&(t=t.replace(a,"")),n(t)?Number(t):i}},{"../constants/numerical":704,"fast-isnumeric":129}],711:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("tinycolor2"),a=t("../plots/attributes"),o=t("../components/colorscale/get_scale"),s=(Object.keys(t("../components/colorscale/scales")),t("./nested_property")),l=/^([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)},validateFunction:function(t,e){e.coerceNumber&&(t=+t);for(var r=e.values,n=0;ni.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;!0!==n.strict&&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;if("string"==typeof t&&t.substr(0,n)===r&&l.test(t.substr(n)))return void e.set(t);e.set(r)},validateFunction:function(t,e){var r=e.dflt,n=r.length;return t===r||"string"==typeof t&&!(t.substr(0,n)!==r||!l.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;a0&&(o=o.replace(/0+$/,"").replace(/[\.]$/,"")),n+=":"+o}return n}function l(t){return t.formatDate("yyyy")}function u(t){return t.formatDate("M yyyy")}function c(t){return t.formatDate("M d")}function h(t){return t.formatDate("M d, yyyy")}var f=t("d3"),d=t("fast-isnumeric"),p=t("./loggers").error,m=t("./mod"),v=t("../constants/numerical"),g=v.BADNUM,y=v.ONEDAY,b=v.ONEHOUR,x=v.ONEMIN,_=v.ONESEC,w=v.EPOCHJD,M=t("../registry"),k=f.time.format.utc,A=/^\s*(-?\d\d\d\d|\d\d)(-(\d?\d)(-(\d?\d)([ Tt]([01]?\d|2[0-3])(:([0-5]\d)(:([0-5]\d(\.\d+)?))?(Z|z|[+\-]\d\d:?\d\d)?)?)?)?)?\s*$/m,T=/^\s*(-?\d\d\d\d|\d\d)(-(\d?\di?)(-(\d?\d)([ Tt]([01]?\d|2[0-3])(:([0-5]\d)(:([0-5]\d(\.\d+)?))?(Z|z|[+\-]\d\d:?\d\d)?)?)?)?)?\s*$/m,S=(new Date).getFullYear()-70;r.dateTick0=function(t,e){return n(t)?e?M.getComponentMethod("calendars","CANONICAL_SUNDAY")[t]:M.getComponentMethod("calendars","CANONICAL_TICK")[t]:e?"2000-01-02":"2000-01-01"},r.dfltRange=function(t){return n(t)?M.getComponentMethod("calendars","DFLTRANGE")[t]:["2000-01-01","2001-01-01"]},r.isJSDate=function(t){return"object"==typeof t&&null!==t&&"function"==typeof t.getTime};var E,L;r.dateTime2ms=function(t,e){if(r.isJSDate(t))return t=Number(t)-t.getTimezoneOffset()*x,t>=E&&t<=L?t:g;if("string"!=typeof t&&"number"!=typeof t)return g;t=String(t);var i=n(e),a=t.charAt(0);!i||"G"!==a&&"g"!==a||(t=t.substr(1),e="");var o=i&&"chinese"===e.substr(0,7),s=t.match(o?T:A);if(!s)return g;var l=s[1],u=s[3]||"1",c=Number(s[5]||1),h=Number(s[7]||0),f=Number(s[9]||0),d=Number(s[11]||0);if(i){if(2===l.length)return g;l=Number(l);var p;try{var m=M.getComponentMethod("calendars","getCal")(e);if(o){var v="i"===u.charAt(u.length-1);u=parseInt(u,10),p=m.newDate(l,m.toMonthIndex(l,u,v),c)}else p=m.newDate(l,Number(u),c)}catch(t){return g}return p?(p.toJD()-w)*y+h*b+f*x+d*_:g}l=2===l.length?(Number(l)+2e3-S)%100+S:Number(l),u-=1;var k=new Date(Date.UTC(2e3,u,c,h,f));return k.setUTCFullYear(l),k.getUTCMonth()!==u?g:k.getUTCDate()!==c?g:k.getTime()+d*_},E=r.MIN_MS=r.dateTime2ms("-9999"),L=r.MAX_MS=r.dateTime2ms("9999-12-31 23:59:59.9999"),r.isDateTime=function(t,e){return r.dateTime2ms(t,e)!==g};var C=90*y,z=3*b,I=5*x;r.ms2DateTime=function(t,e,r){if("number"!=typeof t||!(t>=E&&t<=L))return g;e||(e=0);var i,o,s,l,u,c,h=Math.floor(10*m(t+.05,1)),f=Math.round(t-h/10);if(n(r)){var d=Math.floor(f/y)+w,p=Math.floor(m(t,y));try{i=M.getComponentMethod("calendars","getCal")(r).fromJD(d).formatDate("yyyy-mm-dd")}catch(t){i=k("G%Y-%m-%d")(new Date(f))}if("-"===i.charAt(0))for(;i.length<11;)i="-0"+i.substr(1);else for(;i.length<10;)i="0"+i;o=e=E+y&&t<=L-y))return g;var e=Math.floor(10*m(t+.05,1)),r=new Date(Math.round(t-e/10));return a(f.time.format("%Y-%m-%d")(r),r.getHours(),r.getMinutes(),r.getSeconds(),10*r.getUTCMilliseconds()+e)},r.cleanDate=function(t,e,i){if(r.isJSDate(t)||"number"==typeof t){if(n(i))return p("JS Dates and milliseconds are incompatible with world calendars",t),e;if(!(t=r.ms2DateTimeLocal(+t))&&void 0!==e)return e}else if(!r.isDateTime(t,i))return p("unrecognized date",t),e;return t};var D=/%\d?f/g,P=[59,59.9,59.99,59.999,59.9999],O=k("%Y"),R=k("%b %Y"),F=k("%b %-d"),j=k("%b %-d, %Y");r.formatDate=function(t,e,r,i){var a,f;if(i=n(i)&&i,e)return o(e,t,i);if(i)try{var d=Math.floor((t+.05)/y)+w,p=M.getComponentMethod("calendars","getCal")(i).fromJD(d);"y"===r?f=l(p):"m"===r?f=u(p):"d"===r?(a=l(p),f=c(p)):(a=h(p),f=s(t,r))}catch(t){return"Invalid"}else{var m=new Date(Math.floor(t+.05));"y"===r?f=O(m):"m"===r?f=R(m):"d"===r?(a=O(m),f=F(m)):(a=j(m),f=s(t,r))}return f+(a?"\n"+a:"")};var N=3*y;r.incrementMonth=function(t,e,r){r=n(r)&&r;var i=m(t,y);if(t=Math.round(t-i),r)try{var a=Math.round(t/y)+w,o=M.getComponentMethod("calendars","getCal")(r),s=o.fromJD(a);return e%12?o.add(s,e,"m"):o.add(s,e/12,"y"),(s.toJD()-w)*y+i}catch(e){p("invalid ms "+t+" in calendar "+r)}var l=new Date(t+N);return l.setUTCMonth(l.getUTCMonth()+e)+i-N},r.findExactDates=function(t,e){for(var r,i,a=0,o=0,s=0,l=0,u=n(e)&&M.getComponentMethod("calendars","getCal")(e),c=0;c0&&(i.push(a),a=[])}return a.length>0&&i.push(a),i},r.makeLine=function(t,e){var r={};return r=1===t.length?{type:"LineString",coordinates:t[0]}:{type:"MultiLineString",coordinates:t},e&&(r.trace=e),r},r.makePolygon=function(t,e){var r={};if(1===t.length)r={type:"Polygon",coordinates:t};else{for(var n=new Array(t.length),i=0;i1||m<0||m>1?null:{x:t+l*m,y:e+h*m}}function i(t,e,r,n,i){var a=n*t+i*e;if(a<0)return n*n+i*i;if(a>r){var o=n-t,s=i-e;return o*o+s*s}var l=n*e-i*t;return l*l/r}var a=t("./mod");r.segmentsIntersect=n,r.segmentDistance=function(t,e,r,a,o,s,l,u){if(n(t,e,r,a,o,s,l,u))return 0;var c=r-t,h=a-e,f=l-o,d=u-s,p=c*c+h*h,m=f*f+d*d,v=Math.min(i(c,h,p,o-t,s-e),i(c,h,p,l-t,u-e),i(f,d,m,t-o,e-s),i(f,d,m,r-o,a-s));return Math.sqrt(v)};var o,s,l;r.getTextLocation=function(t,e,r,n){if(t===s&&n===l||(o={},s=t,l=n),o[r])return o[r];var i=t.getPointAtLength(a(r-n/2,e)),u=t.getPointAtLength(a(r+n/2,e)),c=Math.atan((u.y-i.y)/(u.x-i.x)),h=t.getPointAtLength(a(r,e)),f=(4*h.x+i.x+u.x)/6,d=(4*h.y+i.y+u.y)/6,p={x:f,y:d,theta:c};return o[r]=p,p},r.clearLocationCache=function(){s=null},r.getVisibleSegment=function(t,e,r){function n(e){var r=t.getPointAtLength(e);0===e?i=r:e===h&&(a=r);var n=r.xs?r.x-s:0,c=r.yu?r.y-u:0;return Math.sqrt(n*n+c*c)}for(var i,a,o=e.left,s=e.right,l=e.top,u=e.bottom,c=0,h=t.getTotalLength(),f=h,d=n(c);d;){if((c+=d+r)>f)return;d=n(c)}for(d=n(f);d;){if(f-=d+r,c>f)return;d=n(f)}return{min:c,max:f,len:f-c,total:h,isClosed:0===c&&f===h&&Math.abs(i.x-a.x)<.1&&Math.abs(i.y-a.y)<.1}}},{"./mod":729}],721:[function(t,e,r){"use strict";function n(t,e){var r=t;return r[3]*=e,r}function i(t){if(s(t))return h;var e=l(t);return e.length?e:h}function a(t){return s(t)?t:f}function o(t,e,r){var o,s,c,d,p,m=t.color,v=Array.isArray(m),g=Array.isArray(e),y=[] ;if(o=void 0!==t.colorscale?u.makeColorScaleFunc(u.extractScale(t.colorscale,t.cmin,t.cmax)):i,s=v?function(t,e){return void 0===t[e]?h:l(o(t[e]))}:i,c=g?function(t,e){return void 0===t[e]?f:a(t[e])}:a,v||g)for(var b=0;b",e))>=0;){var r=t.indexOf("",e);if(r/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(no?s:i(t)?Number(t):s):s},l.noop=t("./noop"),l.identity=t("./identity"),l.swapAttrs=function(t,e,r,n){r||(r="x"),n||(n="y");for(var i=0;ir?Math.max(r,Math.min(e,t)):Math.max(e,Math.min(r,t))},l.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},l.simpleMap=function(t,e,r,n){for(var i=t.length,a=new Array(i),o=0;o-1||c!==1/0&&c>=Math.pow(2,r)?t(e,r,n):l},l.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},l.smooth=function(t,e){if((e=Math.round(e)||0)<2)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;r=s&&(i-=s*Math.floor(i/s)),i<0?i=-1-i:i>=o&&(i=s-1-i),a+=t[i]*u[n];c[r]=a}return c},l.syncOrAsync=function(t,e,r){function n(){return l.syncOrAsync(t,e,r)}for(var i,a;t.length;)if(a=t.splice(0,1)[0],(i=a(e))&&i.then)return i.then(n).then(void 0,l.promiseError);return r&&r(e)},l.stripTrailingSlash=function(t){return"/"===t.substr(-1)?t.substr(0,t.length-1):t},l.noneOrAll=function(t,e,r){if(t){var n,i,a=!1,o=!0;for(n=0;n1?i+o[1]:"";if(a&&(o.length>1||s.length>4||r))for(;n.test(s);)s=s.replace(n,"$1"+a+"$2");return s+l}},{"../constants/numerical":704,"./clean_number":710,"./coerce":711,"./dates":712,"./ensure_array":713,"./extend":715,"./filter_unique":716,"./filter_visible":717,"./geometry2d":720,"./identity":723,"./is_array":725,"./is_plain_object":726,"./loggers":727,"./matrix":728,"./mod":729,"./nested_property":730,"./noop":731,"./notifier":732,"./push_unique":735,"./relink_private":737,"./search":738,"./stats":741,"./to_log_range":744,d3:120,"fast-isnumeric":129}],725:[function(t,e,r){"use strict";var n="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer:{isView:function(){return!1}};e.exports=function(t){return Array.isArray(t)||n.isView(t)}},{}],726:[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}},{}],727:[function(t,e,r){"use strict";function n(t,e){if(t.apply)t.apply(t,e);else for(var r=0;r1){for(var t=["LOG:"],e=0;e0){for(var t=["WARN:"],e=0;e0){for(var t=["ERROR:"],e=0;e=0;e--){if(n=t[e][0],a=t[e][1],l=!1,d(n))for(r=n.length-1;r>=0;r--)i(n[r],o(a,r))?l?n[r]=void 0:n.pop():l=!0;else if("object"==typeof n&&null!==n)for(s=Object.keys(n),l=!1,r=s.length-1;r>=0;r--)i(n[s[r]],o(a,s[r]))?delete n[s[r]]:l=!0;if(l)return}}function c(t){return void 0===t||null===t||"object"==typeof t&&(d(t)?!t.length:!Object.keys(t).length)}function h(t,e,r){return{set:function(){throw"bad container"},get:function(){},astr:e,parts:r,obj:t}}var f=t("fast-isnumeric"),d=t("./is_array"),p=t("./is_plain_object"),m=t("../plot_api/container_array_match");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(".");s/g),s=0;so||n===i||nl)&&(!e||!c(t))}function r(t,e){var r=t[0],u=t[1];if(r===i||ro||u===i||ul)return!1;var c,h,f,d,p,m=n.length,v=n[0][0],g=n[0][1],y=0;for(c=1;cMath.max(h,v)||u>Math.max(f,g)))if(uc||Math.abs(n(o,f))>i)return!0;return!1};a.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){r(t.pop())}return{addPt:r,raw:t,filtered:n}}},{"../constants/numerical":704,"./matrix":728}],735:[function(t,e,r){"use strict";e.exports=function(t,e){if(e instanceof RegExp){var r,n=e.toString();for(r=0;ra.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;re}function o(t,e){return t>=e}var s=t("fast-isnumeric"),l=t("./loggers");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?o:a;h90&&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,a=i/(n||1)/1e4,o=[e[0]],s=0;se[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;it.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":129}],742:[function(t,e,r){"use strict";function n(t){var e=i(t);return e.length?e:[0,0,0,1]}var i=t("color-rgba");e.exports=n},{"color-rgba":93}],743:[function(t,e,r){"use strict";function n(t,e){return t.node().getBoundingClientRect()[e]}function i(t){return t.replace(g,"\\lt ").replace(y,"\\gt ")}function a(t,e,r){var n="math-output-"+f.randstr([],64),a=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,a.node()],function(){var e=h.select("body").select("#MathJax_SVG_glyphs");if(a.select(".MathJax_SVG").empty()||!a.select("svg").node())f.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){if(!t)return null;var r=t.match(e);return r&&(r[3]||r[4])}function s(t,e){if(!t)return"";for(var r=0;r1)for(var i=1;i doesnt match end tag <"+t+">. Pretending it did match.",e),a=u[u.length-1].node}(k);else{var O=y[4],R={type:k},F=o(O,C);if(F?(F=F.replace(P,"$1 fill:"),A&&(F+=";"+A)):A&&(F=A),F&&(R.style=F),"a"===k){s=!0;var j=o(O,z);if(j){var N=document.createElement("a");N.href=j,-1!==M.indexOf(N.protocol)&&(R.href=encodeURI(j),R.target=o(O,I)||"_blank",R.popup=o(O,D))}}n(R)}}return s}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 h=t("d3"),f=t("../lib"),d=t("../constants/xmlns_namespaces"),p=t("../constants/string_mappings"),m=t("../constants/alignment").LINE_SPACING,v=/([^$]*)([$]+[^$]*[$]+)([^$]*)/;r.convertToTspans=function(t,e,i){function o(){c.empty()||(f=t.attr("class")+"-math",c.select("svg."+f).remove()),t.text("").style("white-space","pre"),u(t.node(),s)&&t.style("pointer-events","all"),r.positionText(t),i&&i.call(t)}var s=t.text(),l=!t.attr("data-notex")&&"undefined"!=typeof MathJax&&s.match(v),c=h.select(t.node().parentNode);if(!c.empty()){var f=t.attr("class")?t.attr("class").split(" ")[0]:"text";return f+="-math",c.selectAll("svg."+f).remove(),c.selectAll("g."+f+"-group").remove(),t.style("display",null).attr({"data-unformatted":s,"data-math":"N"}),l?(e&&e._promises||[]).push(new Promise(function(e){t.style("display","none");var r={fontSize:parseInt(t.style("font-size"),10)};a(l[2],r,function(r,a,l){c.selectAll("svg."+f).remove(),c.selectAll("g."+f+"-group").remove();var u=r&&r.select("svg");if(!u||!u.node())return o(),void e();var h=c.append("g").classed(f+"-group",!0).attr({"pointer-events":"none","data-unformatted":s,"data-math":"Y"});h.node().appendChild(u.node()),a&&a.node()&&u.node().insertBefore(a.node().cloneNode(!0),u.node().firstChild),u.attr({class:f,height:l.height,preserveAspectRatio:"xMinYMin meet"}).style({overflow:"visible","pointer-events":"none"});var d=t.style("fill")||"black";u.select("g").attr({fill:d,stroke:d});var p=n(u,"width"),m=n(u,"height"),v=+t.attr("x")-p*{start:0,middle:.5,end:1}[t.attr("text-anchor")||"start"],g=parseInt(t.style("font-size"),10)||n(t,"height"),y=-g/4;"y"===f[0]?(h.attr({transform:"rotate("+[-90,+t.attr("x"),+t.attr("y")]+") translate("+[-p/2,y-m/2]+")"}),u.attr({x:+t.attr("x"),y:+t.attr("y")})):"l"===f[0]?u.attr({x:t.attr("x"),y:y-m/2}):"a"===f[0]?u.attr({x:0,y:y}):u.attr({x:v,y:+t.attr("y")+y-m/2}),i&&i.call(t,h),e(h)})})):o(),t}};var g=/(<|<|<)/g,y=/(>|>|>)/g,b={sup:"font-size:70%",sub:"font-size:70%",b:"font-weight:bold",i:"font-style:italic",a:"cursor:pointer",span:"",em:"font-style:italic;font-weight:bold"},x={sub:"0.3em",sup:"-0.6em"},_={sub:"-0.21em",sup:"0.42em"},w="\u200b",M=["http:","https:","mailto:","",void 0,":"],k=new RegExp("]*)?/?>","g"),A=Object.keys(p.entityToUnicode).map(function(t){return{regExp:new RegExp("&"+t+";","g"),sub:p.entityToUnicode[t]}}),T=/(\r\n?|\n)/g,S=/(<[^<>]*>)/,E=/<(\/?)([^ >]*)(\s+(.*))?>/i,L=//i,C=/(^|[\s"'])style\s*=\s*("([^"]*);?"|'([^']*);?')/i,z=/(^|[\s"'])href\s*=\s*("([^"]*)"|'([^']*)')/i,I=/(^|[\s"'])target\s*=\s*("([^"\s]*)"|'([^'\s]*)')/i,D=/(^|[\s"'])popup\s*=\s*("([\w=,]*)"|'([\w=,]*)')/i,P=/(^|;)\s*color:/;r.plainText=function(t){return(t||"").replace(k," ")},r.lineCount=function(t){return t.selectAll("tspan.line").size()||1},r.positionText=function(t,e,r){return t.each(function(){function t(t,e){return void 0===e?null===(e=n.attr(t))&&(n.attr(t,0),e=0):n.attr(t,e),e}var n=h.select(this),i=t("x",e),a=t("y",r);"text"===this.nodeName&&n.selectAll("tspan.line").attr({x:i,y:a})})},r.makeEditable=function(t,e){function r(){i(),t.style({opacity:0});var e,r=l.attr("class");(e=r?"."+r.split(" ")[0]+"-math-group":"[class*=-math-group]")&&h.select(t.node().parentNode).select(e).style({opacity:0})}function n(t){var e=t.node(),r=document.createRange();r.selectNodeContents(e);var n=window.getSelection();n.removeAllRanges(),n.addRange(r),e.focus()}function i(){var r=h.select(a),i=r.select(".svg-container"),o=i.append("div");o.classed("plugin-editable editable",!0).style({position:"absolute","font-family":t.style("font-family")||"Arial","font-size":t.style("font-size")||12,color:e.fill||t.style("fill")||"black",opacity:1,"background-color":e.background||"transparent",outline:"#ffffff33 1px solid",margin:[-parseFloat(t.style("font-size"))/8+1,0,0,-1].join("px ")+"px",padding:"0","box-sizing":"border-box"}).attr({contenteditable:!0}).text(e.text||t.attr("data-unformatted")).call(c(t,i,e)).on("blur",function(){a._editing=!1,t.text(this.textContent).style({opacity:1});var e,r=h.select(this).attr("class");(e=r?"."+r.split(" ")[0]+"-math-group":"[class*=-math-group]")&&h.select(t.node().parentNode).select(e).style({opacity:0});var n=this.textContent;h.select(this).transition().duration(0).remove(),h.select(document).on("mouseup",null),s.edit.call(t,n)}).on("focus",function(){var t=this;a._editing=!0,h.select(document).on("mouseup",function(){if(h.event.target===t)return!1;document.activeElement===o.node()&&o.node().blur()})}).on("keyup",function(){27===h.event.which?(a._editing=!1,t.style({opacity:1}),h.select(this).style({opacity:0}).on("blur",function(){return!1}).transition().remove(),s.cancel.call(t,this.textContent)):(s.input.call(t,this.textContent),h.select(this).call(c(t,i,e)))}).on("keydown",function(){13===h.event.which&&this.blur()}).call(n)}var a=e.gd,o=e.delegate,s=h.dispatch("edit","input","cancel"),l=o||t;if(t.style({"pointer-events":o?"none":"all"}),1!==t.size())throw new Error("boo");return e.immediate?r():l.on("click",r),h.rebind(t,s,"on")}},{"../constants/alignment":698,"../constants/string_mappings":705,"../constants/xmlns_namespaces":706,"../lib":724,d3:120}],744:[function(t,e,r){"use strict";var n=t("fast-isnumeric");e.exports=function(t,e){if(t>0)return Math.log(t)/Math.LN10;var r=Math.log(Math.min(e[0],e[1]))/Math.LN10;return n(r)||(r=Math.log(Math.max(e[0],e[1]))/Math.LN10-6),r}},{"fast-isnumeric":129}],745:[function(t,e,r){"use strict";var n=e.exports={},i=t("../plots/geo/constants").locationmodeToLayer,a=t("topojson-client").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 a(e,n).features}},{"../plots/geo/constants":790,"topojson-client":534}],746:[function(t,e,r){"use strict";function n(t,e){for(var r=new Float32Array(e),n=0;n0)return t.substr(0,e)}var s=t("fast-isnumeric"),l=t("gl-mat4/fromQuat"),u=t("../registry"),c=t("../lib"),h=t("../plots/plots"),f=t("../plots/cartesian/axes"),d=t("../components/color");r.getGraphDiv=function(t){var e;if("string"==typeof t){if(null===(e=document.getElementById(t)))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},r.clearPromiseQueue=function(t){Array.isArray(t._promises)&&t._promises.length>0&&c.log("Clearing previous rejected promises from queue."),t._promises=[]},r.cleanLayout=function(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 i=f.list({_fullLayout:t});for(e=0;e3?(v.x=1.02,v.xanchor="left"):v.x<-2&&(v.x=-.02,v.xanchor="right"),v.y>3?(v.y=1.02,v.yanchor="bottom"):v.y<-2&&(v.y=-.02,v.yanchor="top")),"rotate"===t.dragmode&&(t.dragmode="orbit"),t.scene1&&(t.scene||(t.scene=t.scene1),delete t.scene1);var g=h.getSubplotIds(t,"gl3d");for(e=0;e1&&o.warn("Full array edits are incompatible with other edits",h);var y=r[""][""];if(c(y))e.set(null);else{if(!Array.isArray(y))return o.warn("Unrecognized full array edit value",h,y),!0;e.set(y)}return!m&&(f(v,g),d(t),!0)}var b,x,_,w,M,k,A,T=Object.keys(r).map(Number).sort(s),S=e.get(),E=S||[],L=n(g,h).get(),C=[],z=-1,I=E.length;for(b=0;bE.length-(A?0:1))o.warn("index out of range",h,_);else if(void 0!==k)M.length>1&&o.warn("Insertion & removal are incompatible with edits to the same index.",h,_),c(k)?C.push(_):A?("add"===k&&(k={}),E.splice(_,0,k),L&&L.splice(_,0,{})):o.warn("Unrecognized full object edit value",h,_,k),-1===z&&(z=_);else for(x=0;x=0;b--)E.splice(C[b],1),L&&L.splice(C[b],1);if(E.length?S||e.set(E):e.set(null),m)return!1;if(f(v,g),p!==a){var D;if(-1===z)D=T;else{for(I=Math.max(E.length,I),D=[],b=0;b=z);b++)D.push(_);for(b=z;b=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||i<0&&e.indexOf(t.data.length+i)>-1)throw new Error("each index in "+r+" must be unique.")}}function l(t,e,r){if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if(void 0===e)throw new Error("currentIndices is a required argument.");if(Array.isArray(e)||(e=[e]),s(t,e,"currentIndices"),void 0===r||Array.isArray(r)||(r=[r]),void 0!==r&&s(t,r,"newIndices"),void 0!==r&&e.length!==r.length)throw new Error("current and new indices must be of equal length.")}function u(t,e,r){var n,i;if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if(void 0===e)throw new Error("traces must be defined.");for(Array.isArray(e)||(e=[e]),n=0;n=0&&lH.range[0]?[1,2]:[2,1]);else{var Y=H.range[0],X=H.range[1];q?(Y<=0&&X<=0&&r(F+".autorange",!0),Y<=0?Y=X/1e6:X<=0&&(X=Y/1e6),r(F+".range[0]",Math.log(Y)/Math.LN10),r(F+".range[1]",Math.log(X)/Math.LN10)):(r(F+".range[0]",Math.pow(10,Y)),r(F+".range[1]",Math.pow(10,X)))}else r(F+".autorange",!0);M.getComponentMethod("annotations","convertCoords")(t,B,S,r),M.getComponentMethod("images","convertCoords")(t,B,S,r)}else r(F+".autorange",!0);x.nestedProperty(u,F+"._inputRange").set(null)}else if(D.match(O.AX_NAME_PATTERN)){var W=x.nestedProperty(u,A).get(),Z=(S||{}).type;Z&&"-"!==Z||(Z="linear"),M.getComponentMethod("annotations","convertCoords")(t,W,Z,r),M.getComponentMethod("images","convertCoords")(t,W,Z,r)}var J=z.containerArrayMatch(A);if(J){a=J.array,o=J.index;var K=J.property,Q=x.nestedProperty(l,a),$=(Q||[])[o]||{};if(""===o)-1===A.indexOf("updatemenus")&&(g.docalc=!0);else if(""===K){var tt=S;z.isAddVal(S)?_[A]=null:z.isRemoveVal(S)?(_[A]=$,tt=$):x.warn("unrecognized full object value",e),(n(tt,"x")||n(tt,"y")&&-1===A.indexOf("updatemenus"))&&(g.docalc=!0)}else!n($,"x")&&!n($,"y")||x.containsAny(A,["color","opacity","align","dash","updatemenus"])||(g.docalc=!0);f[a]||(f[a]={});var et=f[a][o];et||(et=f[a][o]={}),et[K]=S,delete e[A]}else if("reverse"===D)j.range?j.range.reverse():(r(F+".autorange",!0),j.range=[1,0]),B.autorange?g.docalc=!0:g.doplot=!0;else{var rt=String(T.parts[1]||"");0===C.indexOf("scene")?"camera"===T.parts[1]?g.docamera=!0:g.doplot=!0:0===C.indexOf("geo")?g.doplot=!0:0===C.indexOf("ternary")?g.doplot=!0:"paper_bgcolor"===A?g.doplot=!0:"margin"===C||"autorange"===rt||"rangemode"===rt||"type"===rt||"domain"===rt||"fixedrange"===rt||"scaleanchor"===rt||"scaleratio"===rt||-1!==A.indexOf("calendar")||A.match(/^(bar|box|font)/)?g.docalc=!0:!u._has("gl2d")||-1===A.indexOf("axis")&&"plot_bgcolor"!==A?!u._has("gl2d")||"dragmode"!==A||"lasso"!==S&&"select"!==S||"lasso"===U||"select"===U?"hiddenlabels"===A?g.docalc=!0:-1!==C.indexOf("legend")?g.dolegend=!0:-1!==A.indexOf("title")?g.doticks=!0:-1!==C.indexOf("bgcolor")?g.dolayoutstyle=!0:E>1&&x.containsAny(rt,["tick","exponent","grid","zeroline"])?g.doticks=!0:-1!==A.indexOf(".linewidth")&&-1!==A.indexOf("axis")?g.doticks=g.dolayoutstyle=!0:E>1&&-1!==rt.indexOf("line")?g.dolayoutstyle=!0:E>1&&"mirror"===rt?g.doticks=g.dolayoutstyle=!0:"margin.pad"===A?g.doticks=g.dolayoutstyle=!0:-1!==["hovermode","dragmode"].indexOf(A)||-1!==A.indexOf("spike")?g.domodebar=!0:-1===["height","width","autosize"].indexOf(A)&&(g.doplot=!0):g.docalc=!0:g.doplot=!0,T.set(S)}}}for(a in f){z.applyContainerArrayChanges(t,x.nestedProperty(l,a),f[a],g)||(g.doplot=!0)}var nt=u._axisConstraintGroups;for(v in w)for(o=0;o=s.length?s[0]:s[t]:s}function i(t){return Array.isArray(l)?t>=l.length?l[0]:l[t]:l}function a(t,e){var r=0;return function(){if(t&&++r===e)return t()}}if(t=I.getGraphDiv(t),!x.isPlotDiv(t))throw new Error("This element is not a Plotly plot: "+t+". It's likely that you've failed to create a plot before animating it. For more details, see https://plot.ly/javascript/animations/");var o=t._transitionData;o._frameQueue||(o._frameQueue=[]),r=k.supplyAnimationDefaults(r);var s=r.transition,l=r.frame;return void 0===o._frameWaitingCnt&&(o._frameWaitingCnt=0),new Promise(function(l,u){function c(){t.emit("plotly_animated"),window.cancelAnimationFrame(o._animationRaf),o._animationRaf=null}function h(){o._currentFrame&&o._currentFrame.onComplete&&o._currentFrame.onComplete();var e=o._currentFrame=o._frameQueue.shift();if(e){var r=e.name?e.name.toString():null;t._fullLayout._currentFrame=r,o._lastFrameAt=Date.now(),o._timeToNext=e.frameOpts.duration,k.transition(t,e.frame.data,e.frame.layout,I.coerceTraceIndices(t,e.frame.traces),e.frameOpts,e.transitionOpts).then(function(){e.onComplete&&e.onComplete()}),t.emit("plotly_animatingframe",{name:r,frame:e.frame,animation:{frame:e.frameOpts,transition:e.transitionOpts}})}else c()}function f(){t.emit("plotly_animating"),o._lastFrameAt=-1/0,o._timeToNext=0,o._runningTransitions=0,o._currentFrame=null;var e=function(){o._animationRaf=window.requestAnimationFrame(e),Date.now()-o._lastFrameAt>o._timeToNext&&h()};e()}function d(t){return Array.isArray(s)?v>=s.length?t.transitionOpts=s[v]:t.transitionOpts=s[0]:t.transitionOpts=s,v++,t}var p,m,v=0,g=[],y=void 0===e||null===e,b=Array.isArray(e);if(y||b||!x.isPlainObject(e)){if(y||-1!==["string","number"].indexOf(typeof e))for(p=0;p0&&MM)&&A.push(m);g=A}}g.length>0?function(e){if(0!==e.length){for(var s=0;s=0;i--)if(x.isPlainObject(e[i])){var f=(u[e[i].name]||{}).name,d=e[i].name;f&&d&&"number"==typeof d&&u[f]&&(n++,x.warn('addFrames: overwriting frame "'+u[f].name+'" with a frame whose name of type "number" also equates to "'+f+'". This is valid but may potentially lead to unexpected behavior since all plotly.js frame names are stored internally as strings.'),n>5&&x.warn("addFrames: This API call has yielded too many warnings. For the rest of this call, further warnings about numeric frame names will be suppressed.")),h.push({frame:k.supplyFrameDefaults(e[i]),index:r&&void 0!==r[i]&&null!==r[i]?r[i]:c+i})}h.sort(function(t,e){return t.index>e.index?-1:t.index=0;i--){if(a=h[i].frame,"number"==typeof a.name&&x.warn("Warning: addFrames accepts frames with numeric names, but the numbers areimplicitly cast to strings"),!a.name)for(;u[a.name="frame "+t._transitionData._counter++];);if(u[a.name]){for(o=0;o=0;r--)n=e[r],a.push({type:"delete",index:n}),o.unshift({type:"insert",index:n,value:i[n]});var s=k.modifyFrames,l=k.modifyFrames,u=[t,o],c=[t,a];return w&&w.add(t,s,u,l,c),k.modifyFrames(t,a)},b.purge=function(t){t=I.getGraphDiv(t);var e=t._fullLayout||{},r=t._fullData||[];return k.cleanPlot([],{},r,e),k.purge(t),_.purge(t),e._container&&e._container.remove(),delete t._context,delete t._replotPending,delete t._mouseDownTime,delete t._legendMouseDownTime,delete t._hmpixcount,delete t._hmlumcount,t}},{"../components/drawing":626,"../components/errorbars":632,"../constants/xmlns_namespaces":706,"../lib":724,"../lib/events":714,"../lib/queue":736,"../lib/svg_text_utils":743,"../plotly":759,"../plots/cartesian/axis_ids":767,"../plots/cartesian/constants":769,"../plots/cartesian/constraints":771,"../plots/cartesian/graph_interact":773,"../plots/plots":827,"../plots/polar":830,"../registry":842,"./edit_types":748,"./helpers":749,"./manage_arrays":750,"./subroutines":756,d3:120,"fast-isnumeric":129,"has-hover":286}],752:[function(t,e,r){"use strict";function n(t,r){try{t._fullLayout._paper.style("background",r)}catch(t){e.exports.logging>0&&console.error(t)}}e.exports={staticPlot:!1,editable:!1,edits:{annotationPosition:!1,annotationTail:!1,annotationText:!1,axisTitleText:!1,colorbarPosition:!1,colorbarTitleText:!1,legendPosition:!1,legendText:!1,shapePosition:!1,titleText:!1},autosizable:!1,queueLength:0,fillFrame:!1,frameMargins:0,scrollZoom:!1,doubleClick:"reset+autosize",showTips:!0,showAxisDragHandles:!0,showAxisRangeEntryBoxes:!0,showLink:!1,sendData:!0,linkText:"Edit chart",showSources:!1,displayModeBar:"hover",modeBarButtonsToRemove:[],modeBarButtonsToAdd:[],modeBarButtons:!1,displaylogo:!0,plotGlPixelRatio:2,setBackground:n,topojsonURL:"https://cdn.plot.ly/",mapboxAccessToken:null,logging:!1,globalTransforms:[]}},{}],753:[function(t,e,r){"use strict";function n(t){var e,r;"area"===t?(e={attributes:b},r={}):(e=d.modules[t]._module,r=e.basePlotModule);var n={};n.type=null,M(n,m),M(n,e.attributes),r.attributes&&M(n,r.attributes),Object.keys(d.componentsRegistry).forEach(function(e){var r=d.componentsRegistry[e];r.schema&&r.schema.traces&&r.schema.traces[t]&&Object.keys(r.schema.traces[t]).forEach(function(e){f(n,r.schema.traces[t][e],e)})}),n.type=t;var i={meta:e.meta||{},attributes:s(n)};if(e.layoutAttributes){var a={};M(a,e.layoutAttributes),i.layoutAttributes=s(a)}return i}function i(){var t={};return M(t,v),Object.keys(d.subplotsRegistry).forEach(function(e){var r=d.subplotsRegistry[e];if(r.layoutAttributes)if("cartesian"===r.name)h(t,r,"xaxis"),h(t,r,"yaxis");else{var n="subplot"===r.attr?r.name:r.attr;h(t,r,n)}}),t=c(t),Object.keys(d.componentsRegistry).forEach(function(e){var r=d.componentsRegistry[e];r.layoutAttributes&&(r.schema&&r.schema.layout?Object.keys(r.schema.layout).forEach(function(e){f(t,r.schema.layout[e],e)}):f(t,r.layoutAttributes,r.name))}),{layoutAttributes:s(t)}}function a(t){var e=d.transformsRegistry[t],r=M({},e.attributes);return Object.keys(d.componentsRegistry).forEach(function(e){var n=d.componentsRegistry[e];n.schema&&n.schema.transforms&&n.schema.transforms[t]&&Object.keys(n.schema.transforms[t]).forEach(function(e){f(r,n.schema.transforms[t][e],e)})}),{attributes:s(r)}}function o(){var t={frames:p.extendDeep({},g)};return s(t),t.frames}function s(t){return l(t),u(t),t}function l(t){function e(t){return{valType:"string"}}function n(t,n,i){r.isValObject(t)?"data_array"===t.valType?(t.role="data",i[n+"src"]=e(n)):!0===t.arrayOk&&(i[n+"src"]=e(n)):p.isPlainObject(t)&&(t.role="object")}r.crawl(t,n)}function u(t){function e(t,e,r){if(t){var n=t[A];n&&(delete t[A],r[e]={items:{}},r[e].items[n]=t,r[e].role="object")}}r.crawl(t,e)}function c(t){return w(t,{radialaxis:x.radialaxis,angularaxis:x.angularaxis}),w(t,x.layout),t}function h(t,e,r){var n=p.nestedProperty(t,r),i=M({},e.layoutAttributes);i[k]=!0,n.set(i)}function f(t,e,r){var n=p.nestedProperty(t,r);n.set(M(n.get()||{},e))}var d=t("../registry"),p=t("../lib"),m=t("../plots/attributes"),v=t("../plots/layout_attributes"),g=t("../plots/frame_attributes"),y=t("../plots/animation_attributes"),b=t("../plots/polar/area_attributes"),x=t("../plots/polar/axis_attributes"),_=t("./edit_types"),w=p.extendFlat,M=p.extendDeep,k="_isSubplotObj",A="_isLinkedToArray",T=[k,A,"_arrayAttrRegexps","_deprecated"];r.IS_SUBPLOT_OBJ=k,r.IS_LINKED_TO_ARRAY=A,r.DEPRECATED="_deprecated",r.UNDERSCORE_ATTRS=T,r.get=function(){var t={};d.allTypes.concat("area").forEach(function(e){t[e]=n(e)});var e={};return Object.keys(d.transformsRegistry).forEach(function(t){e[t]=a(t)}),{defs:{valObjects:p.valObjects,metaKeys:T.concat(["description","role"]),editTypes:{traces:_.traces(),layout:_.layout()}},traces:t,layout:i(),transforms:e,frames:o(),animation:s(y)}},r.crawl=function(t,e,n){var i=n||0;Object.keys(t).forEach(function(n){var a=t[n];-1===T.indexOf(n)&&(e(a,n,t,i),r.isValObject(a)||p.isPlainObject(a)&&r.crawl(a,e,i+1))})},r.isValObject=function(t){return t&&void 0!==t.valType},r.findArrayAttributes=function(t){function e(e,r,o,s){if(a=a.slice(0,s).concat([r]),e&&("data_array"===e.valType||!0===e.arrayOk)&&!("colorbar"===a[s-1]&&("ticktext"===r||"tickvals"===r))){var l=n(a),u=p.nestedProperty(t,l).get();Array.isArray(u)&&i.push(l)}}function n(t){return t.join(".")}var i=[],a=[];if(r.crawl(m,e),t._module&&t._module.attributes&&r.crawl(t._module.attributes,e),t.transforms)for(var o=t.transforms,s=0;s=t[1]||i[1]<=t[0])&&(a[0]e[0]))return!0}return!1}function i(t,e,r){return t._anchorAxis===e&&(t.mirror||t.side===r)||"all"===t.mirror||"allticks"===t.mirror||t.mirrors&&t.mirrors[e._id+r]}function a(t,e,r){var n=[],i=e._anchorAxis;if(i){var a=i._mainAxis;if(-1===n.indexOf(a)){n.push(a);for(var o=0;o1)};f(e.width)&&f(e.height)||n(new Error("Height and width should be pixel values."));var d=l(t,{format:"png",height:e.height,width:e.width}),p=d.gd;p.style.position="absolute",p.style.left="-5000px",document.body.appendChild(p);var m=s.getRedrawFunc(p);a.plot(p,d.data,d.layout,d.config).then(m).then(h).then(function(t){r(t)}).catch(function(t){n(t)})})}var i=t("fast-isnumeric"),a=t("../plotly"),o=t("../lib"),s=t("../snapshot/helpers"),l=t("../snapshot/cloneplot"),u=t("../snapshot/tosvg"),c=t("../snapshot/svgtoimg");e.exports=n},{"../lib":724,"../plotly":759,"../snapshot/cloneplot":843,"../snapshot/helpers":846,"../snapshot/svgtoimg":848,"../snapshot/tosvg":850,"fast-isnumeric":129}],758:[function(t,e,r){"use strict";function n(t,e,r,i,a,u){u=u||[];for(var c=Object.keys(t),f=0;f1&&l.push(o("object","layout"))),f.supplyDefaults(u);for(var c=u._fullData,v=r.length,g=0;g