y4ashida/rbplotly

View on GitHub
lib/plotly/offline/plotly.min.js

Summary

Maintainability
A
0 mins
Test Coverage
/**
* plotly.js v1.16.2
* Copyright 2012-2016, Plotly, Inc.
* All rights reserved.
* Licensed under the MIT license
*/
!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,e.Plotly=t()}}(function(){var t;return function e(t,r,n){function i(a,s){if(!r[a]){if(!t[a]){var l="function"==typeof require&&require;if(!s&&l)return l(a,!0);if(o)return o(a,!0);var u=new Error("Cannot find module '"+a+"'");throw u.code="MODULE_NOT_FOUND",u}var c=r[a]={exports:{}};t[a][0].call(c.exports,function(e){var r=t[a][1][e];return i(r?r:e)},c,c.exports,e,t,r,n)}return r[a].exports}for(var o="function"==typeof require&&require,a=0;a<n.length;a++)i(n[a]);return i}({1:[function(t,e,r){"use strict";var n=t("../src/plotly"),i={"X,X div":"font-family:'Open Sans', verdana, arial, sans-serif;margin:0;padding:0;","X input,X button":"font-family:'Open Sans', verdana, arial, sans-serif;","X input:focus,X button:focus":"outline:none;","X a":"text-decoration:none;","X a:hover":"text-decoration:none;","X .crisp":"shape-rendering:crispEdges;","X .user-select-none":"-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;-o-user-select:none;user-select:none;","X svg":"overflow:hidden;","X svg a":"fill:#447adb;","X svg a:hover":"fill:#3c6dc5;","X .main-svg":"position:absolute;top:0;left:0;pointer-events:none;","X .main-svg .draglayer":"pointer-events:all;","X .cursor-pointer":"cursor:pointer;","X .cursor-crosshair":"cursor:crosshair;","X .cursor-move":"cursor:move;","X .cursor-col-resize":"cursor:col-resize;","X .cursor-row-resize":"cursor:row-resize;","X .cursor-ns-resize":"cursor:ns-resize;","X .cursor-ew-resize":"cursor:ew-resize;","X .cursor-sw-resize":"cursor:sw-resize;","X .cursor-s-resize":"cursor:s-resize;","X .cursor-se-resize":"cursor:se-resize;","X .cursor-w-resize":"cursor:w-resize;","X .cursor-e-resize":"cursor:e-resize;","X .cursor-nw-resize":"cursor:nw-resize;","X .cursor-n-resize":"cursor:n-resize;","X .cursor-ne-resize":"cursor:ne-resize;","X .modebar":"position:absolute;top:2px;right:2px;z-index:1001;background:rgba(255,255,255,0.7);","X .modebar--hover":"opacity:0;-webkit-transition:opacity 0.3s ease 0s;-moz-transition:opacity 0.3s ease 0s;-ms-transition:opacity 0.3s ease 0s;-o-transition:opacity 0.3s ease 0s;transition:opacity 0.3s ease 0s;","X:hover .modebar--hover":"opacity:1;","X .modebar-group":"float:left;display:inline-block;box-sizing:border-box;margin-left:8px;position:relative;vertical-align:middle;white-space:nowrap;","X .modebar-group:first-child":"margin-left:0px;","X .modebar-btn":"position:relative;font-size:16px;padding:3px 4px;cursor:pointer;line-height:normal;box-sizing:border-box;","X .modebar-btn svg":"position:relative;top:2px;","X .modebar-btn path":"fill:rgba(0,31,95,0.3);","X .modebar-btn.active path,X .modebar-btn:hover path":"fill:rgba(0,22,72,0.5);","X .modebar-btn.modebar-btn--logo":"padding:3px 1px;","X .modebar-btn.modebar-btn--logo path":"fill:#447adb !important;","X [data-title]:before,X [data-title]:after":"position:absolute;-webkit-transform:translate3d(0, 0, 0);-moz-transform:translate3d(0, 0, 0);-ms-transform:translate3d(0, 0, 0);-o-transform:translate3d(0, 0, 0);transform:translate3d(0, 0, 0);display:none;opacity:0;z-index:1001;pointer-events:none;top:110%;right:50%;","X [data-title]:hover:before,X [data-title]:hover:after":"display:block;opacity:1;","X [data-title]:before":"content:'';position:absolute;background:transparent;border:6px solid transparent;z-index:1002;margin-top:-12px;border-bottom-color:#69738a;margin-right:-6px;","X [data-title]:after":"content:attr(data-title);background:#69738a;color:white;padding:8px 10px;font-size:12px;line-height:12px;white-space:nowrap;margin-right:-18px;border-radius:2px;","X .select-outline":"fill:none;stroke-width:1;shape-rendering:crispEdges;","X .select-outline-1":"stroke:white;","X .select-outline-2":"stroke:black;stroke-dasharray:2px 2px;",Y:"font-family:'Open Sans';position:fixed;top:50px;right:20px;z-index:10000;font-size:10pt;max-width:180px;","Y p":"margin:0;","Y .notifier-note":"min-width:180px;max-width:250px;border:1px solid #fff;z-index:3000;margin:0;background-color:#8c97af;background-color:rgba(140,151,175,0.9);color:#fff;padding:10px;","Y .notifier-close":"color:#fff;opacity:0.8;float:right;padding:0 5px;background:none;border:none;font-size:20px;font-weight:bold;line-height:20px;","Y .notifier-close:hover":"color:#444;text-decoration:none;cursor:pointer;"};for(var o in i){var a=o.replace(/^,/," ,").replace(/X/g,".js-plotly-plot .plotly").replace(/Y/g,".plotly-notifier");n.Lib.addStyleRule(a,i[o])}},{"../src/plotly":589}],2:[function(t,e,r){"use strict";e.exports={undo:{width:857.1,path:"m857 350q0-87-34-166t-91-137-137-92-166-34q-96 0-183 41t-147 114q-4 6-4 13t5 11l76 77q6 5 14 5 9-1 13-7 41-53 100-82t126-29q58 0 110 23t92 61 61 91 22 111-22 111-61 91-92 61-110 23q-55 0-105-20t-90-57l77-77q17-16 8-38-10-23-33-23h-250q-15 0-25 11t-11 25v250q0 24 22 33 22 10 39-8l72-72q60 57 137 88t159 31q87 0 166-34t137-92 91-137 34-166z",ascent:850,descent:-150},home:{width:928.6,path:"m786 296v-267q0-15-11-26t-25-10h-214v214h-143v-214h-214q-15 0-25 10t-11 26v267q0 1 0 2t0 2l321 264 321-264q1-1 1-4z m124 39l-34-41q-5-5-12-6h-2q-7 0-12 3l-386 322-386-322q-7-4-13-4-7 2-12 7l-35 41q-4 5-3 13t6 12l401 334q18 15 42 15t43-15l136-114v109q0 8 5 13t13 5h107q8 0 13-5t5-13v-227l122-102q5-5 6-12t-4-13z",ascent:850,descent:-150},"camera-retro":{width:1e3,path:"m518 386q0 8-5 13t-13 5q-37 0-63-27t-26-63q0-8 5-13t13-5 12 5 5 13q0 23 16 38t38 16q8 0 13 5t5 13z m125-73q0-59-42-101t-101-42-101 42-42 101 42 101 101 42 101-42 42-101z m-572-320h858v71h-858v-71z m643 320q0 89-62 152t-152 62-151-62-63-152 63-151 151-63 152 63 62 151z m-571 358h214v72h-214v-72z m-72-107h858v143h-462l-36-71h-360v-72z m929 143v-714q0-30-21-51t-50-21h-858q-29 0-50 21t-21 51v714q0 30 21 51t50 21h858q29 0 50-21t21-51z",ascent:850,descent:-150},zoombox:{width:1e3,path:"m1000-25l-250 251c40 63 63 138 63 218 0 224-182 406-407 406-224 0-406-182-406-406s183-406 407-406c80 0 155 22 218 62l250-250 125 125z m-812 250l0 438 437 0 0-438-437 0z m62 375l313 0 0-312-313 0 0 312z",ascent:850,descent:-150},pan:{width:1e3,path:"m1000 350l-187 188 0-125-250 0 0 250 125 0-188 187-187-187 125 0 0-250-250 0 0 125-188-188 186-187 0 125 252 0 0-250-125 0 187-188 188 188-125 0 0 250 250 0 0-126 187 188z",ascent:850,descent:-150},zoom_plus:{width:1e3,path:"m1 787l0-875 875 0 0 875-875 0z m687-500l-187 0 0-187-125 0 0 187-188 0 0 125 188 0 0 187 125 0 0-187 187 0 0-125z",ascent:850,descent:-150},zoom_minus:{width:1e3,path:"m0 788l0-876 875 0 0 876-875 0z m688-500l-500 0 0 125 500 0 0-125z",ascent:850,descent:-150},autoscale:{width:1e3,path:"m250 850l-187 0-63 0 0-62 0-188 63 0 0 188 187 0 0 62z m688 0l-188 0 0-62 188 0 0-188 62 0 0 188 0 62-62 0z m-875-938l0 188-63 0 0-188 0-62 63 0 187 0 0 62-187 0z m875 188l0-188-188 0 0-62 188 0 62 0 0 62 0 188-62 0z m-125 188l-1 0-93-94-156 156 156 156 92-93 2 0 0 250-250 0 0-2 93-92-156-156-156 156 94 92 0 2-250 0 0-250 0 0 93 93 157-156-157-156-93 94 0 0 0-250 250 0 0 0-94 93 156 157 156-157-93-93 0 0 250 0 0 250z",ascent:850,descent:-150},tooltip_basic:{width:1500,path:"m375 725l0 0-375-375 375-374 0-1 1125 0 0 750-1125 0z",ascent:850,descent:-150},tooltip_compare:{width:1125,path:"m187 786l0 2-187-188 188-187 0 0 937 0 0 373-938 0z m0-499l0 1-187-188 188-188 0 0 937 0 0 376-938-1z",ascent:850,descent:-150},plotlylogo:{width:1542,path:"m0-10h182v-140h-182v140z m228 146h183v-286h-183v286z m225 714h182v-1000h-182v1000z m225-285h182v-715h-182v715z m225 142h183v-857h-183v857z m231-428h182v-429h-182v429z m225-291h183v-138h-183v138z",ascent:850,descent:-150},"z-axis":{width:1e3,path:"m833 5l-17 108v41l-130-65 130-66c0 0 0 38 0 39 0-1 36-14 39-25 4-15-6-22-16-30-15-12-39-16-56-20-90-22-187-23-279-23-261 0-341 34-353 59 3 60 228 110 228 110-140-8-351-35-351-116 0-120 293-142 474-142 155 0 477 22 477 142 0 50-74 79-163 96z m-374 94c-58-5-99-21-99-40 0-24 65-43 144-43 79 0 143 19 143 43 0 19-42 34-98 40v216h87l-132 135-133-135h88v-216z m167 515h-136v1c16 16 31 34 46 52l84 109v54h-230v-71h124v-1c-16-17-28-32-44-51l-89-114v-51h245v72z",ascent:850,descent:-150},"3d_rotate":{width:1e3,path:"m922 660c-5 4-9 7-14 11-359 263-580-31-580-31l-102 28 58-400c0 1 1 1 2 2 118 108 351 249 351 249s-62 27-100 42c88 83 222 183 347 122 16-8 30-17 44-27-2 1-4 2-6 4z m36-329c0 0 64 229-88 296-62 27-124 14-175-11 157-78 225-208 249-266 8-19 11-31 11-31 2 5 6 15 11 32-5-13-8-20-8-20z m-775-239c70-31 117-50 198-32-121 80-199 346-199 346l-96-15-58-12c0 0 55-226 155-287z m603 133l-317-139c0 0 4-4 19-14 7-5 24-15 24-15s-177-147-389 4c235-287 536-112 536-112l31-22 100 299-4-1z m-298-153c6-4 14-9 24-15 0 0-17 10-24 15z",ascent:850,descent:-150},camera:{width:1e3,path:"m500 450c-83 0-150-67-150-150 0-83 67-150 150-150 83 0 150 67 150 150 0 83-67 150-150 150z m400 150h-120c-16 0-34 13-39 29l-31 93c-6 15-23 28-40 28h-340c-16 0-34-13-39-28l-31-94c-6-15-23-28-40-28h-120c-55 0-100-45-100-100v-450c0-55 45-100 100-100h800c55 0 100 45 100 100v450c0 55-45 100-100 100z m-400-550c-138 0-250 112-250 250 0 138 112 250 250 250 138 0 250-112 250-250 0-138-112-250-250-250z m365 380c-19 0-35 16-35 35 0 19 16 35 35 35 19 0 35-16 35-35 0-19-16-35-35-35z",ascent:850,descent:-150},movie:{width:1e3,path:"m938 413l-188-125c0 37-17 71-44 94 64 38 107 107 107 187 0 121-98 219-219 219-121 0-219-98-219-219 0-61 25-117 66-156h-115c30 33 49 76 49 125 0 103-84 187-187 187s-188-84-188-187c0-57 26-107 65-141-38-22-65-62-65-109v-250c0-70 56-126 125-126h500c69 0 125 56 125 126l188-126c34 0 62 28 62 63v375c0 35-28 63-62 63z m-750 0c-69 0-125 56-125 125s56 125 125 125 125-56 125-125-56-125-125-125z m406-1c-87 0-157 70-157 157 0 86 70 156 157 156s156-70 156-156-70-157-156-157z",ascent:850,descent:-150},question:{width:857.1,path:"m500 82v107q0 8-5 13t-13 5h-107q-8 0-13-5t-5-13v-107q0-8 5-13t13-5h107q8 0 13 5t5 13z m143 375q0 49-31 91t-77 65-95 23q-136 0-207-119-9-14 4-24l74-55q4-4 10-4 9 0 14 7 30 38 48 51 19 14 48 14 27 0 48-15t21-33q0-21-11-34t-38-25q-35-16-65-48t-29-70v-20q0-8 5-13t13-5h107q8 0 13 5t5 13q0 10 12 27t30 28q18 10 28 16t25 19 25 27 16 34 7 45z m214-107q0-117-57-215t-156-156-215-58-216 58-155 156-58 215 58 215 155 156 216 58 215-58 156-156 57-215z",ascent:850,descent:-150},disk:{width:857.1,path:"m214-7h429v214h-429v-214z m500 0h72v500q0 8-6 21t-11 20l-157 156q-5 6-19 12t-22 5v-232q0-22-15-38t-38-16h-322q-22 0-37 16t-16 38v232h-72v-714h72v232q0 22 16 38t37 16h465q22 0 38-16t15-38v-232z m-214 518v178q0 8-5 13t-13 5h-107q-7 0-13-5t-5-13v-178q0-8 5-13t13-5h107q7 0 13 5t5 13z m357-18v-518q0-22-15-38t-38-16h-750q-23 0-38 16t-16 38v750q0 22 16 38t38 16h517q23 0 50-12t42-26l156-157q16-15 27-42t11-49z",ascent:850,descent:-150},lasso:{width:1031,path:"m1018 538c-36 207-290 336-568 286-277-48-473-256-436-463 10-57 36-108 76-151-13-66 11-137 68-183 34-28 75-41 114-42l-55-70 0 0c-2-1-3-2-4-3-10-14-8-34 5-45 14-11 34-8 45 4 1 1 2 3 2 5l0 0 113 140c16 11 31 24 45 40 4 3 6 7 8 11 48-3 100 0 151 9 278 48 473 255 436 462z m-624-379c-80 14-149 48-197 96 42 42 109 47 156 9 33-26 47-66 41-105z m-187-74c-19 16-33 37-39 60 50-32 109-55 174-68-42-25-95-24-135 8z m360 75c-34-7-69-9-102-8 8 62-16 128-68 170-73 59-175 54-244-5-9 20-16 40-20 61-28 159 121 317 333 354s407-60 434-217c28-159-121-318-333-355z",ascent:850,descent:-150},selectbox:{width:1e3,path:"m0 850l0-143 143 0 0 143-143 0z m286 0l0-143 143 0 0 143-143 0z m285 0l0-143 143 0 0 143-143 0z m286 0l0-143 143 0 0 143-143 0z m-857-286l0-143 143 0 0 143-143 0z m857 0l0-143 143 0 0 143-143 0z m-857-285l0-143 143 0 0 143-143 0z m857 0l0-143 143 0 0 143-143 0z m-857-286l0-143 143 0 0 143-143 0z m286 0l0-143 143 0 0 143-143 0z m285 0l0-143 143 0 0 143-143 0z m286 0l0-143 143 0 0 143-143 0z",ascent:850,descent:-150}}},{}],3:[function(t,e,r){e.exports=t("../src/traces/bar")},{"../src/traces/bar":674}],4:[function(t,e,r){e.exports=t("../src/traces/box")},{"../src/traces/box":685}],5:[function(t,e,r){e.exports=t("../src/traces/choropleth")},{"../src/traces/choropleth":694}],6:[function(t,e,r){e.exports=t("../src/traces/contour")},{"../src/traces/contour":701}],7:[function(t,e,r){e.exports=t("../src/core")},{"../src/core":557}],8:[function(t,e,r){e.exports=t("../src/traces/heatmap")},{"../src/traces/heatmap":713}],9:[function(t,e,r){e.exports=t("../src/traces/histogram")},{"../src/traces/histogram":724}],10:[function(t,e,r){e.exports=t("../src/traces/histogram2d")},{"../src/traces/histogram2d":729}],11:[function(t,e,r){e.exports=t("../src/traces/histogram2dcontour")},{"../src/traces/histogram2dcontour":733}],12:[function(t,e,r){"use strict";var n=t("./core");n.register([t("./bar"),t("./box"),t("./heatmap"),t("./histogram"),t("./histogram2d"),t("./histogram2dcontour"),t("./pie"),t("./contour"),t("./scatter3d"),t("./surface"),t("./mesh3d"),t("./scattergeo"),t("./choropleth"),t("./scattergl"),t("./scatterternary"),t("./scattermapbox")]),e.exports=n},{"./bar":3,"./box":4,"./choropleth":5,"./contour":6,"./core":7,"./heatmap":8,"./histogram":9,"./histogram2d":10,"./histogram2dcontour":11,"./mesh3d":13,"./pie":14,"./scatter3d":15,"./scattergeo":16,"./scattergl":17,"./scattermapbox":18,"./scatterternary":19,"./surface":20}],13:[function(t,e,r){e.exports=t("../src/traces/mesh3d")},{"../src/traces/mesh3d":737}],14:[function(t,e,r){e.exports=t("../src/traces/pie")},{"../src/traces/pie":743}],15:[function(t,e,r){e.exports=t("../src/traces/scatter3d")},{"../src/traces/scatter3d":777}],16:[function(t,e,r){e.exports=t("../src/traces/scattergeo")},{"../src/traces/scattergeo":781}],17:[function(t,e,r){e.exports=t("../src/traces/scattergl")},{"../src/traces/scattergl":786}],18:[function(t,e,r){e.exports=t("../src/traces/scattermapbox")},{"../src/traces/scattermapbox":792}],19:[function(t,e,r){e.exports=t("../src/traces/scatterternary")},{"../src/traces/scatterternary":798}],20:[function(t,e,r){e.exports=t("../src/traces/surface")},{"../src/traces/surface":807}],21:[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<this.dimension;++n)this.bounds[0][n]=-(1/0),this.bounds[1][n]=1/0;this._state=t.slice().reverse(),this._velocity=e.slice().reverse(),this._time=[r],this._scratch=[t.slice(),t.slice(),t.slice(),t.slice(),t.slice()]}function o(t){for(var e=new Array(t),r=0;t>r;++r)e[r]=0;return e}function a(t,e,r){switch(arguments.length){case 0:return new i([0],[0],0);case 1:if("number"==typeof t){var n=o(t);return new i(n,n,0)}return new i(t,o(t.length),0);case 2:if("number"==typeof e){var n=o(t.length);return new i(t,n,+e)}r=0;case 3:if(t.length!==e.length)throw new Error("state and velocity lengths must match");return new i(t,e,r)}}e.exports=a;var s=t("cubic-hermite"),l=t("binary-search-bounds"),u=i.prototype;u.flush=function(t){var e=l.gt(this._time,t)-1;0>=e||(this._time.splice(0,e),this._state.splice(0,e*this.dimension),this._velocity.splice(0,e*this.dimension))},u.curve=function(t){var e=this._time,r=e.length,i=l.le(e,t),o=this._scratch[0],a=this._state,u=this._velocity,c=this.dimension,h=this.bounds;if(0>i)for(var f=c-1,d=0;c>d;++d,--f)o[d]=a[f];else if(i>=r-1)for(var f=a.length-1,p=t-e[r-1],d=0;c>d;++d,--f)o[d]=a[f]+p*u[f];else{for(var f=c*(i+1)-1,v=e[i],m=e[i+1],g=m-v||1,y=this._scratch[1],b=this._scratch[2],x=this._scratch[3],_=this._scratch[4],w=!0,d=0;c>d;++d,--f)y[d]=a[f],x[d]=u[f]*g,b[d]=a[f+c],_[d]=u[f+c]*g,w=w&&y[d]===b[d]&&x[d]===_[d]&&0===x[d];if(w)for(var d=0;c>d;++d)o[d]=y[d];else s(y,x,b,_,(t-v)/g,o)}for(var M=h[0],k=h[1],d=0;c>d;++d)o[d]=n(M[d],k[d],o[d]);return o},u.dcurve=function(t){var e=this._time,r=e.length,n=l.le(e,t),i=this._scratch[0],o=this._state,a=this._velocity,u=this.dimension;if(n>=r-1)for(var c=o.length-1,h=(t-e[r-1],0);u>h;++h,--c)i[h]=a[c];else{for(var c=u*(n+1)-1,f=e[n],d=e[n+1],p=d-f||1,v=this._scratch[1],m=this._scratch[2],g=this._scratch[3],y=this._scratch[4],b=!0,h=0;u>h;++h,--c)v[h]=o[c],g[h]=a[c]*p,m[h]=o[c+u],y[h]=a[c+u]*p,b=b&&v[h]===m[h]&&g[h]===y[h]&&0===g[h];if(b)for(var h=0;u>h;++h)i[h]=0;else{s.derivative(v,g,m,y,(t-f)/p,i);for(var h=0;u>h;++h)i[h]/=p}}return i},u.lastT=function(){var t=this._time;return t[t.length-1]},u.stable=function(){for(var t=this._velocity,e=t.length,r=this.dimension-1;r>=0;--r)if(t[--e])return!1;return!0},u.jump=function(t){var e=this.lastT(),r=this.dimension;if(!(e>t||arguments.length!==r+1)){var i=this._state,o=this._velocity,a=i.length-this.dimension,s=this.bounds,l=s[0],u=s[1];this._time.push(e,t);for(var c=0;2>c;++c)for(var h=0;r>h;++h)i.push(i[a++]),o.push(0);this._time.push(t);for(var h=r;h>0;--h)i.push(n(l[h-1],u[h-1],arguments[h])),o.push(0)}},u.push=function(t){var e=this.lastT(),r=this.dimension;if(!(e>t||arguments.length!==r+1)){var i=this._state,o=this._velocity,a=i.length-this.dimension,s=t-e,l=this.bounds,u=l[0],c=l[1],h=s>1e-6?1/s:0;this._time.push(t);for(var f=r;f>0;--f){var d=n(u[f-1],c[f-1],arguments[f]);i.push(d),o.push((d-i[a++])*h)}}},u.set=function(t){var e=this.dimension;if(!(t<this.lastT()||arguments.length!==e+1)){var r=this._state,i=this._velocity,o=this.bounds,a=o[0],s=o[1];this._time.push(t);for(var l=e;l>0;--l)r.push(n(a[l-1],s[l-1],arguments[l])),i.push(0)}},u.move=function(t){var e=this.lastT(),r=this.dimension;if(!(e>=t||arguments.length!==r+1)){var i=this._state,o=this._velocity,a=i.length-this.dimension,s=this.bounds,l=s[0],u=s[1],c=t-e,h=c>1e-6?1/c:0;this._time.push(t);for(var f=r;f>0;--f){var d=arguments[f];i.push(n(l[f-1],u[f-1],i[a++]+d)),o.push(d*h)}}},u.idle=function(t){var e=this.lastT();if(!(e>t)){var r=this.dimension,i=this._state,o=this._velocity,a=i.length-r,s=this.bounds,l=s[0],u=s[1],c=t-e;this._time.push(t);for(var h=r-1;h>=0;--h)i.push(n(l[h],u[h],i[a]+c*o[a])),o.push(0),a+=1}}},{"binary-search-bounds":22,"cubic-hermite":23}],22:[function(t,e,r){"use strict";function n(t,e,r,n,i,o){var a=["function ",t,"(a,l,h,",n.join(","),"){",o?"":"var i=",r?"l-1":"h+1",";while(l<=h){var m=(l+h)>>>1,x=a",i?".get(m)":"[m]"];return o?e.indexOf("c")<0?a.push(";if(x===y){return m}else if(x<=y){"):a.push(";var p=c(x,y);if(p===0){return m}else if(p<=0){"):a.push(";if(",e,"){i=m;"),r?a.push("l=m+1}else{h=m-1}"):a.push("h=m-1}else{l=m+1}"),a.push("}"),o?a.push("return -1};"):a.push("return i};"),a.join("")}function i(t,e,r,i){var o=new Function([n("A","x"+t+"y",e,["y"],!1,i),n("B","x"+t+"y",e,["y"],!0,i),n("P","c(x,y)"+t+"0",e,["y","c"],!1,i),n("Q","c(x,y)"+t+"0",e,["y","c"],!0,i),"function dispatchBsearch",r,"(a,y,c,l,h){if(a.shape){if(typeof(c)==='function'){return Q(a,(l===undefined)?0:l|0,(h===undefined)?a.shape[0]-1:h|0,y,c)}else{return B(a,(c===undefined)?0:c|0,(l===undefined)?a.shape[0]-1:l|0,y)}}else{if(typeof(c)==='function'){return P(a,(l===undefined)?0:l|0,(h===undefined)?a.length-1:h|0,y,c)}else{return A(a,(c===undefined)?0:c|0,(l===undefined)?a.length-1:l|0,y)}}}return dispatchBsearch",r].join(""));return o()}e.exports={ge:i(">=",!1,"GE"),gt:i(">",!1,"GT"),lt:i("<",!0,"LT"),le:i("<=",!0,"LE"),eq:i("-",!0,"EQ",!0)}},{}],23:[function(t,e,r){"use strict";function n(t,e,r,n,i,o){var a=6*i*i-6*i,s=3*i*i-4*i+1,l=-6*i*i+6*i,u=3*i*i-2*i;if(t.length){o||(o=new Array(t.length));for(var c=t.length-1;c>=0;--c)o[c]=a*t[c]+s*e[c]+l*r[c]+u*n[c];return o}return a*t+s*e+l*r[c]+u*n}function i(t,e,r,n,i,o){var a=i-1,s=i*i,l=a*a,u=(1+2*i)*l,c=i*l,h=s*(3-2*i),f=s*a;if(t.length){o||(o=new Array(t.length));for(var d=t.length-1;d>=0;--d)o[d]=u*t[d]+c*e[d]+h*r[d]+f*n[d];return o}return u*t+c*e+h*r+f*n}e.exports=i,e.exports.derivative=n},{}],24:[function(t,e,r){function n(t,e,r){var n=e[0],i=e[1],o=e[2],a=r[0],s=r[1],l=r[2];return t[0]=i*l-o*s,t[1]=o*a-n*l,t[2]=n*s-i*a,t}e.exports=n},{}],25:[function(t,e,r){function n(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}e.exports=n},{}],26:[function(t,e,r){function n(t){var e=t[0],r=t[1],n=t[2];return Math.sqrt(e*e+r*r+n*n)}e.exports=n},{}],27:[function(t,e,r){function n(t,e,r,n){var i=e[0],o=e[1],a=e[2];return t[0]=i+n*(r[0]-i),t[1]=o+n*(r[1]-o),t[2]=a+n*(r[2]-a),t}e.exports=n},{}],28:[function(t,e,r){function n(t,e){var r=e[0],n=e[1],i=e[2],o=r*r+n*n+i*i;return o>0&&(o=1/Math.sqrt(o),t[0]=e[0]*o,t[1]=e[1]*o,t[2]=e[2]*o),t}e.exports=n},{}],29:[function(t,e,r){"use strict";function n(t){this._components=t.slice(),this._time=[0],this.prevMatrix=t.slice(),this.nextMatrix=t.slice(),this.computedMatrix=t.slice(),this.computedInverse=t.slice(),this.computedEye=[0,0,0],this.computedUp=[0,0,0],this.computedCenter=[0,0,0],this.computedRadius=[0],this._limits=[-(1/0),1/0]}function i(t){t=t||{};var e=t.matrix||[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];return new n(e)}var o=t("binary-search-bounds"),a=t("mat4-interpolate"),s=t("gl-mat4/invert"),l=t("gl-mat4/rotateX"),u=t("gl-mat4/rotateY"),c=t("gl-mat4/rotateZ"),h=t("gl-mat4/lookAt"),f=t("gl-mat4/translate"),d=(t("gl-mat4/scale"),t("gl-vec3/normalize")),p=[0,0,0];e.exports=i;var v=n.prototype;v.recalcMatrix=function(t){var e=this._time,r=o.le(e,t),n=this.computedMatrix;if(!(0>r)){var i=this._components;if(r===e.length-1)for(var l=16*r,u=0;16>u;++u)n[u]=i[l++];else{for(var c=e[r+1]-e[r],l=16*r,h=this.prevMatrix,f=!0,u=0;16>u;++u)h[u]=i[l++];for(var p=this.nextMatrix,u=0;16>u;++u)p[u]=i[l++],f=f&&h[u]===p[u];if(1e-6>c||f)for(var u=0;16>u;++u)n[u]=h[u];else a(n,h,p,(t-e[r])/c)}var v=this.computedUp;v[0]=n[1],v[1]=n[5],v[2]=n[6],d(v,v);var m=this.computedInverse;s(m,n);var g=this.computedEye,y=m[15];g[0]=m[12]/y,g[1]=m[13]/y,g[2]=m[14]/y;for(var b=this.computedCenter,x=Math.exp(this.computedRadius[0]),u=0;3>u;++u)b[u]=g[u]-n[2+4*u]*x}},v.idle=function(t){if(!(t<this.lastT())){for(var e=this._components,r=e.length-16,n=0;16>n;++n)e.push(e[r++]);this._time.push(t)}},v.flush=function(t){var e=o.gt(this._time,t)-2;0>e||(this._time.slice(0,e),this._components.slice(0,16*e))},v.lastT=function(){return this._time[this._time.length-1]},v.lookAt=function(t,e,r,n){this.recalcMatrix(t),e=e||this.computedEye,r=r||p,n=n||this.computedUp,this.setMatrix(t,h(this.computedMatrix,e,r,n));for(var i=0,o=0;3>o;++o)i+=Math.pow(r[o]-e[o],2);i=Math.log(Math.sqrt(i)),this.computedRadius[0]=i},v.rotate=function(t,e,r,n){this.recalcMatrix(t);var i=this.computedInverse;e&&u(i,i,e),r&&l(i,i,r),n&&c(i,i,n),this.setMatrix(t,s(this.computedMatrix,i))};var m=[0,0,0];v.pan=function(t,e,r,n){m[0]=-(e||0),m[1]=-(r||0),m[2]=-(n||0),this.recalcMatrix(t);var i=this.computedInverse;f(i,i,m),this.setMatrix(t,s(i,i))},v.translate=function(t,e,r,n){m[0]=e||0,m[1]=r||0,m[2]=n||0,this.recalcMatrix(t);var i=this.computedMatrix;f(i,i,m),this.setMatrix(t,i)},v.setMatrix=function(t,e){if(!(t<this.lastT())){this._time.push(t);for(var r=0;16>r;++r)this._components.push(e[r])}},v.setDistance=function(t,e){this.computedRadius[0]=e},v.setDistanceLimits=function(t,e){var r=this._limits;r[0]=t,r[1]=e},v.getDistanceLimits=function(t){var e=this._limits;return t?(t[0]=e[0],t[1]=e[1],t):e}},{"binary-search-bounds":30,"gl-mat4/invert":143,"gl-mat4/lookAt":144,"gl-mat4/rotateX":148,"gl-mat4/rotateY":149,"gl-mat4/rotateZ":150,"gl-mat4/scale":151,"gl-mat4/translate":152,"gl-vec3/normalize":28,"mat4-interpolate":31}],30:[function(t,e,r){arguments[4][22][0].apply(r,arguments)},{dup:22}],31:[function(t,e,r){function n(t,e,r,n){if(0===c(e)||0===c(r))return!1;var i=u(e,f.translate,f.scale,f.skew,f.perspective,f.quaternion),o=u(r,d.translate,d.scale,d.skew,d.perspective,d.quaternion);return i&&o?(s(p.translate,f.translate,d.translate,n),s(p.skew,f.skew,d.skew,n),s(p.scale,f.scale,d.scale,n),s(p.perspective,f.perspective,d.perspective,n),h(p.quaternion,f.quaternion,d.quaternion,n),l(t,p.translate,p.scale,p.skew,p.perspective,p.quaternion),!0):!1}function i(){return{translate:o(),scale:o(1),skew:o(),perspective:a(),quaternion:a()}}function o(t){return[t||0,t||0,t||0]}function a(){return[0,0,0,1]}var s=t("gl-vec3/lerp"),l=t("mat4-recompose"),u=t("mat4-decompose"),c=t("gl-mat4/determinant"),h=t("quat-slerp"),f=i(),d=i(),p=i();e.exports=n},{"gl-mat4/determinant":139,"gl-vec3/lerp":27,"mat4-decompose":32,"mat4-recompose":34,"quat-slerp":35}],32:[function(t,e,r){function n(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3];return t[0]=r[0]*n+r[4]*i+r[8]*o+r[12]*a,t[1]=r[1]*n+r[5]*i+r[9]*o+r[13]*a,t[2]=r[2]*n+r[6]*i+r[10]*o+r[14]*a,t[3]=r[3]*n+r[7]*i+r[11]*o+r[15]*a,t}function i(t,e){t[0][0]=e[0],t[0][1]=e[1],t[0][2]=e[2],t[1][0]=e[4],t[1][1]=e[5],t[1][2]=e[6],t[2][0]=e[8],t[2][1]=e[9],t[2][2]=e[10]}function o(t,e,r,n,i){t[0]=e[0]*n+r[0]*i,t[1]=e[1]*n+r[1]*i,t[2]=e[2]*n+r[2]*i}var a=t("./normalize"),s=t("gl-mat4/create"),l=t("gl-mat4/clone"),u=t("gl-mat4/determinant"),c=t("gl-mat4/invert"),h=t("gl-mat4/transpose"),f={length:t("gl-vec3/length"),normalize:t("gl-vec3/normalize"),dot:t("gl-vec3/dot"),cross:t("gl-vec3/cross")},d=s(),p=s(),v=[0,0,0,0],m=[[0,0,0],[0,0,0],[0,0,0]],g=[0,0,0];e.exports=function(t,e,r,s,y,b){if(e||(e=[0,0,0]),r||(r=[0,0,0]),s||(s=[0,0,0]),y||(y=[0,0,0,1]),b||(b=[0,0,0,1]),!a(d,t))return!1;if(l(p,d),p[3]=0,p[7]=0,p[11]=0,p[15]=1,Math.abs(u(p)<1e-8))return!1;var x=d[3],_=d[7],w=d[11],M=d[12],k=d[13],A=d[14],T=d[15];if(0!==x||0!==_||0!==w){v[0]=x,v[1]=_,v[2]=w,v[3]=T;var E=c(p,p);if(!E)return!1;h(p,p),n(y,v,p)}else y[0]=y[1]=y[2]=0,y[3]=1;if(e[0]=M,e[1]=k,e[2]=A,i(m,d),r[0]=f.length(m[0]),f.normalize(m[0],m[0]),s[0]=f.dot(m[0],m[1]),o(m[1],m[1],m[0],1,-s[0]),r[1]=f.length(m[1]),f.normalize(m[1],m[1]),s[0]/=r[1],s[1]=f.dot(m[0],m[2]),o(m[2],m[2],m[0],1,-s[1]),s[2]=f.dot(m[1],m[2]),o(m[2],m[2],m[1],1,-s[2]),r[2]=f.length(m[2]),f.normalize(m[2],m[2]),s[1]/=r[2],s[2]/=r[2],f.cross(g,m[1],m[2]),f.dot(m[0],g)<0)for(var S=0;3>S;S++)r[S]*=-1,m[S][0]*=-1,m[S][1]*=-1,m[S][2]*=-1;return b[0]=.5*Math.sqrt(Math.max(1+m[0][0]-m[1][1]-m[2][2],0)),b[1]=.5*Math.sqrt(Math.max(1-m[0][0]+m[1][1]-m[2][2],0)),b[2]=.5*Math.sqrt(Math.max(1-m[0][0]-m[1][1]+m[2][2],0)),b[3]=.5*Math.sqrt(Math.max(1+m[0][0]+m[1][1]+m[2][2],0)),m[2][1]>m[1][2]&&(b[0]=-b[0]),m[0][2]>m[2][0]&&(b[1]=-b[1]),m[1][0]>m[0][1]&&(b[2]=-b[2]),!0}},{"./normalize":33,"gl-mat4/clone":137,"gl-mat4/create":138,"gl-mat4/determinant":139,"gl-mat4/invert":143,"gl-mat4/transpose":153,"gl-vec3/cross":24,"gl-vec3/dot":25,"gl-vec3/length":26,"gl-vec3/normalize":28}],33:[function(t,e,r){e.exports=function(t,e){var r=e[15];if(0===r)return!1;for(var n=1/r,i=0;16>i;i++)t[i]=e[i]*n;return!0}},{}],34:[function(t,e,r){var n={identity:t("gl-mat4/identity"),translate:t("gl-mat4/translate"),multiply:t("gl-mat4/multiply"),create:t("gl-mat4/create"),scale:t("gl-mat4/scale"),fromRotationTranslation:t("gl-mat4/fromRotationTranslation")},i=(n.create(),n.create());e.exports=function(t,e,r,o,a,s){return n.identity(t),n.fromRotationTranslation(t,s,e),t[3]=a[0],t[7]=a[1],t[11]=a[2],t[15]=a[3],n.identity(i),0!==o[2]&&(i[9]=o[2],n.multiply(t,t,i)),0!==o[1]&&(i[9]=0,i[8]=o[1],n.multiply(t,t,i)),0!==o[0]&&(i[8]=0,i[4]=o[0],n.multiply(t,t,i)),n.scale(t,t,r),t}},{"gl-mat4/create":138,"gl-mat4/fromRotationTranslation":141,"gl-mat4/identity":142,"gl-mat4/multiply":145,"gl-mat4/scale":151,"gl-mat4/translate":152}],35:[function(t,e,r){e.exports=t("gl-quat/slerp")},{"gl-quat/slerp":36}],36:[function(t,e,r){function n(t,e,r,n){var i,o,a,s,l,u=e[0],c=e[1],h=e[2],f=e[3],d=r[0],p=r[1],v=r[2],m=r[3];return o=u*d+c*p+h*v+f*m,0>o&&(o=-o,d=-d,p=-p,v=-v,m=-m),1-o>1e-6?(i=Math.acos(o),a=Math.sin(i),s=Math.sin((1-n)*i)/a,l=Math.sin(n*i)/a):(s=1-n,l=n),t[0]=s*u+l*d,t[1]=s*c+l*p,t[2]=s*h+l*v,t[3]=s*f+l*m,t}e.exports=n},{}],37:[function(t,e,r){"use strict";function n(t,e,r,n,i,o,a,s,l,u){var c=e+o+u;if(h>0){var h=Math.sqrt(c+1);t[0]=.5*(a-l)/h,t[1]=.5*(s-n)/h,t[2]=.5*(r-o)/h,t[3]=.5*h}else{var f=Math.max(e,o,u),h=Math.sqrt(2*f-c+1);e>=f?(t[0]=.5*h,t[1]=.5*(i+r)/h,t[2]=.5*(s+n)/h,t[3]=.5*(a-l)/h):o>=f?(t[0]=.5*(r+i)/h,t[1]=.5*h,t[2]=.5*(l+a)/h,t[3]=.5*(s-n)/h):(t[0]=.5*(n+s)/h,t[1]=.5*(a+l)/h,t[2]=.5*h,t[3]=.5*(r-i)/h)}return t}e.exports=n},{}],38:[function(t,e,r){"use strict";function n(t,e,r){return Math.sqrt(Math.pow(t,2)+Math.pow(e,2)+Math.pow(r,2))}function i(t,e,r,n){return Math.sqrt(Math.pow(t,2)+Math.pow(e,2)+Math.pow(r,2)+Math.pow(n,2))}function o(t,e){var r=e[0],n=e[1],o=e[2],a=e[3],s=i(r,n,o,a);s>1e-6?(t[0]=r/s,t[1]=n/s,t[2]=o/s,t[3]=a/s):(t[0]=t[1]=t[2]=0,t[3]=1)}function a(t,e,r){this.radius=l([r]),this.center=l(e),this.rotation=l(t),this.computedRadius=this.radius.curve(0),this.computedCenter=this.center.curve(0),this.computedRotation=this.rotation.curve(0),this.computedUp=[.1,0,0],this.computedEye=[.1,0,0],this.computedMatrix=[.1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],this.recalcMatrix(0)}function s(t){t=t||{};var e=t.center||[0,0,0],r=t.rotation||[0,0,0,1],n=t.radius||1;e=[].slice.call(e,0,3),r=[].slice.call(r,0,4),o(r,r);var i=new a(r,e,Math.log(n));return i.setDistanceLimits(t.zoomMin,t.zoomMax),("eye"in t||"up"in t)&&i.lookAt(0,t.eye,t.center,t.up),i}e.exports=s;var l=t("filtered-vector"),u=t("gl-mat4/lookAt"),c=t("gl-mat4/fromQuat"),h=t("gl-mat4/invert"),f=t("./lib/quatFromFrame"),d=a.prototype;d.lastT=function(){return Math.max(this.radius.lastT(),this.center.lastT(),this.rotation.lastT())},d.recalcMatrix=function(t){this.radius.curve(t),this.center.curve(t),this.rotation.curve(t);var e=this.computedRotation;o(e,e);var r=this.computedMatrix;c(r,e);var n=this.computedCenter,i=this.computedEye,a=this.computedUp,s=Math.exp(this.computedRadius[0]);i[0]=n[0]+s*r[2],i[1]=n[1]+s*r[6],i[2]=n[2]+s*r[10],a[0]=r[1],a[1]=r[5],a[2]=r[9];for(var l=0;3>l;++l){for(var u=0,h=0;3>h;++h)u+=r[l+4*h]*i[h];r[12+l]=-u}},d.getMatrix=function(t,e){this.recalcMatrix(t);var r=this.computedMatrix;if(e){for(var n=0;16>n;++n)e[n]=r[n];return e}return r},d.idle=function(t){this.center.idle(t),this.radius.idle(t),this.rotation.idle(t)},d.flush=function(t){this.center.flush(t),this.radius.flush(t),this.rotation.flush(t)},d.pan=function(t,e,r,i){e=e||0,r=r||0,i=i||0,this.recalcMatrix(t);var o=this.computedMatrix,a=o[1],s=o[5],l=o[9],u=n(a,s,l);a/=u,s/=u,l/=u;var c=o[0],h=o[4],f=o[8],d=c*a+h*s+f*l;c-=a*d,h-=s*d,f-=l*d;var p=n(c,h,f);c/=p,h/=p,f/=p;var v=o[2],m=o[6],g=o[10],y=v*a+m*s+g*l,b=v*c+m*h+g*f;v-=y*a+b*c,m-=y*s+b*h,g-=y*l+b*f;var x=n(v,m,g);v/=x,m/=x,g/=x;var _=c*e+a*r,w=h*e+s*r,M=f*e+l*r;this.center.move(t,_,w,M);var k=Math.exp(this.computedRadius[0]);k=Math.max(1e-4,k+i),this.radius.set(t,Math.log(k))},d.rotate=function(t,e,r,o){this.recalcMatrix(t),e=e||0,r=r||0;var a=this.computedMatrix,s=a[0],l=a[4],u=a[8],c=a[1],h=a[5],f=a[9],d=a[2],p=a[6],v=a[10],m=e*s+r*c,g=e*l+r*h,y=e*u+r*f,b=-(p*y-v*g),x=-(v*m-d*y),_=-(d*g-p*m),w=Math.sqrt(Math.max(0,1-Math.pow(b,2)-Math.pow(x,2)-Math.pow(_,2))),M=i(b,x,_,w);M>1e-6?(b/=M,x/=M,_/=M,w/=M):(b=x=_=0,w=1);var k=this.computedRotation,A=k[0],T=k[1],E=k[2],S=k[3],L=A*w+S*b+T*_-E*x,z=T*w+S*x+E*b-A*_,I=E*w+S*_+A*x-T*b,P=S*w-A*b-T*x-E*_;if(o){b=d,x=p,_=v;var C=Math.sin(o)/n(b,x,_);b*=C,x*=C,_*=C,w=Math.cos(e),L=L*w+P*b+z*_-I*x,z=z*w+P*x+I*b-L*_,I=I*w+P*_+L*x-z*b,P=P*w-L*b-z*x-I*_}var R=i(L,z,I,P);R>1e-6?(L/=R,z/=R,I/=R,P/=R):(L=z=I=0,P=1),this.rotation.set(t,L,z,I,P)},d.lookAt=function(t,e,r,n){this.recalcMatrix(t),r=r||this.computedCenter,e=e||this.computedEye,n=n||this.computedUp;var i=this.computedMatrix;u(i,e,r,n);var a=this.computedRotation;f(a,i[0],i[1],i[2],i[4],i[5],i[6],i[8],i[9],i[10]),o(a,a),this.rotation.set(t,a[0],a[1],a[2],a[3]);for(var s=0,l=0;3>l;++l)s+=Math.pow(r[l]-e[l],2);this.radius.set(t,.5*Math.log(Math.max(s,1e-6))),this.center.set(t,r[0],r[1],r[2])},d.translate=function(t,e,r,n){this.center.move(t,e||0,r||0,n||0)},d.setMatrix=function(t,e){var r=this.computedRotation;f(r,e[0],e[1],e[2],e[4],e[5],e[6],e[8],e[9],e[10]),o(r,r),this.rotation.set(t,r[0],r[1],r[2],r[3]);var n=this.computedMatrix;h(n,e);var i=n[15];if(Math.abs(i)>1e-6){var a=n[12]/i,s=n[13]/i,l=n[14]/i;this.recalcMatrix(t);var u=Math.exp(this.computedRadius[0]);this.center.set(t,a-n[2]*u,s-n[6]*u,l-n[10]*u),this.radius.idle(t)}else this.center.idle(t),this.radius.idle(t)},d.setDistance=function(t,e){e>0&&this.radius.set(t,Math.log(e))},d.setDistanceLimits=function(t,e){t=t>0?Math.log(t):-(1/0),
e=e>0?Math.log(e):1/0,e=Math.max(e,t),this.radius.bounds[0][0]=t,this.radius.bounds[1][0]=e},d.getDistanceLimits=function(t){var e=this.radius.bounds;return t?(t[0]=Math.exp(e[0][0]),t[1]=Math.exp(e[1][0]),t):[Math.exp(e[0][0]),Math.exp(e[1][0])]},d.toJSON=function(){return this.recalcMatrix(this.lastT()),{center:this.computedCenter.slice(),rotation:this.computedRotation.slice(),distance:Math.log(this.computedRadius[0]),zoomMin:this.radius.bounds[0][0],zoomMax:this.radius.bounds[1][0]}},d.fromJSON=function(t){var e=this.lastT(),r=t.center;r&&this.center.set(e,r[0],r[1],r[2]);var n=t.rotation;n&&this.rotation.set(e,n[0],n[1],n[2],n[3]);var i=t.distance;i&&i>0&&this.radius.set(e,Math.log(i)),this.setDistanceLimits(t.zoomMin,t.zoomMax)}},{"./lib/quatFromFrame":37,"filtered-vector":21,"gl-mat4/fromQuat":140,"gl-mat4/invert":143,"gl-mat4/lookAt":144}],39:[function(t,e,r){"use strict";function n(t,e,r){return Math.sqrt(Math.pow(t,2)+Math.pow(e,2)+Math.pow(r,2))}function i(t){return Math.min(1,Math.max(-1,t))}function o(t){var e=Math.abs(t[0]),r=Math.abs(t[1]),n=Math.abs(t[2]),i=[0,0,0];e>Math.max(r,n)?i[2]=1:r>Math.max(e,n)?i[0]=1:i[1]=1;for(var o=0,a=0,s=0;3>s;++s)o+=t[s]*t[s],a+=i[s]*t[s];for(var s=0;3>s;++s)i[s]-=a/o*t[s];return f(i,i),i}function a(t,e,r,n,i,o,a,s){this.center=l(r),this.up=l(n),this.right=l(i),this.radius=l([o]),this.angle=l([a,s]),this.angle.bounds=[[-(1/0),-Math.PI/2],[1/0,Math.PI/2]],this.setDistanceLimits(t,e),this.computedCenter=this.center.curve(0),this.computedUp=this.up.curve(0),this.computedRight=this.right.curve(0),this.computedRadius=this.radius.curve(0),this.computedAngle=this.angle.curve(0),this.computedToward=[0,0,0],this.computedEye=[0,0,0],this.computedMatrix=new Array(16);for(var u=0;16>u;++u)this.computedMatrix[u]=.5;this.recalcMatrix(0)}function s(t){t=t||{};var e=t.center||[0,0,0],r=t.up||[0,1,0],i=t.right||o(r),s=t.radius||1,l=t.theta||0,u=t.phi||0;if(e=[].slice.call(e,0,3),r=[].slice.call(r,0,3),f(r,r),i=[].slice.call(i,0,3),f(i,i),"eye"in t){var c=t.eye,p=[c[0]-e[0],c[1]-e[1],c[2]-e[2]];h(i,p,r),n(i[0],i[1],i[2])<1e-6?i=o(r):f(i,i),s=n(p[0],p[1],p[2]);var v=d(r,p)/s,m=d(i,p)/s;u=Math.acos(v),l=Math.acos(m)}return s=Math.log(s),new a(t.zoomMin,t.zoomMax,e,r,i,s,l,u)}e.exports=s;var l=t("filtered-vector"),u=t("gl-mat4/invert"),c=t("gl-mat4/rotate"),h=t("gl-vec3/cross"),f=t("gl-vec3/normalize"),d=t("gl-vec3/dot"),p=a.prototype;p.setDistanceLimits=function(t,e){t=t>0?Math.log(t):-(1/0),e=e>0?Math.log(e):1/0,e=Math.max(e,t),this.radius.bounds[0][0]=t,this.radius.bounds[1][0]=e},p.getDistanceLimits=function(t){var e=this.radius.bounds[0];return t?(t[0]=Math.exp(e[0][0]),t[1]=Math.exp(e[1][0]),t):[Math.exp(e[0][0]),Math.exp(e[1][0])]},p.recalcMatrix=function(t){this.center.curve(t),this.up.curve(t),this.right.curve(t),this.radius.curve(t),this.angle.curve(t);for(var e=this.computedUp,r=this.computedRight,i=0,o=0,a=0;3>a;++a)o+=e[a]*r[a],i+=e[a]*e[a];for(var s=Math.sqrt(i),l=0,a=0;3>a;++a)r[a]-=e[a]*o/i,l+=r[a]*r[a],e[a]/=s;for(var u=Math.sqrt(l),a=0;3>a;++a)r[a]/=u;var c=this.computedToward;h(c,e,r),f(c,c);for(var d=Math.exp(this.computedRadius[0]),p=this.computedAngle[0],v=this.computedAngle[1],m=Math.cos(p),g=Math.sin(p),y=Math.cos(v),b=Math.sin(v),x=this.computedCenter,_=m*y,w=g*y,M=b,k=-m*b,A=-g*b,T=y,E=this.computedEye,S=this.computedMatrix,a=0;3>a;++a){var L=_*r[a]+w*c[a]+M*e[a];S[4*a+1]=k*r[a]+A*c[a]+T*e[a],S[4*a+2]=L,S[4*a+3]=0}var z=S[1],I=S[5],P=S[9],C=S[2],R=S[6],D=S[10],O=I*D-P*R,F=P*C-z*D,j=z*R-I*C,N=n(O,F,j);O/=N,F/=N,j/=N,S[0]=O,S[4]=F,S[8]=j;for(var a=0;3>a;++a)E[a]=x[a]+S[2+4*a]*d;for(var a=0;3>a;++a){for(var l=0,B=0;3>B;++B)l+=S[a+4*B]*E[B];S[12+a]=-l}S[15]=1},p.getMatrix=function(t,e){this.recalcMatrix(t);var r=this.computedMatrix;if(e){for(var n=0;16>n;++n)e[n]=r[n];return e}return r};var v=[0,0,0];p.rotate=function(t,e,r,n){if(this.angle.move(t,e,r),n){this.recalcMatrix(t);var i=this.computedMatrix;v[0]=i[2],v[1]=i[6],v[2]=i[10];for(var o=this.computedUp,a=this.computedRight,s=this.computedToward,l=0;3>l;++l)i[4*l]=o[l],i[4*l+1]=a[l],i[4*l+2]=s[l];c(i,i,n,v);for(var l=0;3>l;++l)o[l]=i[4*l],a[l]=i[4*l+1];this.up.set(t,o[0],o[1],o[2]),this.right.set(t,a[0],a[1],a[2])}},p.pan=function(t,e,r,i){e=e||0,r=r||0,i=i||0,this.recalcMatrix(t);var o=this.computedMatrix,a=(Math.exp(this.computedRadius[0]),o[1]),s=o[5],l=o[9],u=n(a,s,l);a/=u,s/=u,l/=u;var c=o[0],h=o[4],f=o[8],d=c*a+h*s+f*l;c-=a*d,h-=s*d,f-=l*d;var p=n(c,h,f);c/=p,h/=p,f/=p;var v=c*e+a*r,m=h*e+s*r,g=f*e+l*r;this.center.move(t,v,m,g);var y=Math.exp(this.computedRadius[0]);y=Math.max(1e-4,y+i),this.radius.set(t,Math.log(y))},p.translate=function(t,e,r,n){this.center.move(t,e||0,r||0,n||0)},p.setMatrix=function(t,e,r,o){var a=1;"number"==typeof r&&(a=0|r),(0>a||a>3)&&(a=1);var s=(a+2)%3;e||(this.recalcMatrix(t),e=this.computedMatrix);var l=e[a],c=e[a+4],h=e[a+8];if(o){var f=Math.abs(l),d=Math.abs(c),p=Math.abs(h),v=Math.max(f,d,p);f===v?(l=0>l?-1:1,c=h=0):p===v?(h=0>h?-1:1,l=c=0):(c=0>c?-1:1,l=h=0)}else{var m=n(l,c,h);l/=m,c/=m,h/=m}var g=e[s],y=e[s+4],b=e[s+8],x=g*l+y*c+b*h;g-=l*x,y-=c*x,b-=h*x;var _=n(g,y,b);g/=_,y/=_,b/=_;var w=c*b-h*y,M=h*g-l*b,k=l*y-c*g,A=n(w,M,k);w/=A,M/=A,k/=A,this.center.jump(t,G,H,X),this.radius.idle(t),this.up.jump(t,l,c,h),this.right.jump(t,g,y,b);var T,E;if(2===a){var S=e[1],L=e[5],z=e[9],I=S*g+L*y+z*b,P=S*w+L*M+z*k;T=0>O?-Math.PI/2:Math.PI/2,E=Math.atan2(P,I)}else{var C=e[2],R=e[6],D=e[10],O=C*l+R*c+D*h,F=C*g+R*y+D*b,j=C*w+R*M+D*k;T=Math.asin(i(O)),E=Math.atan2(j,F)}this.angle.jump(t,E,T),this.recalcMatrix(t);var N=e[2],B=e[6],U=e[10],V=this.computedMatrix;u(V,e);var q=V[15],G=V[12]/q,H=V[13]/q,X=V[14]/q,Y=Math.exp(this.computedRadius[0]);this.center.jump(t,G-N*Y,H-B*Y,X-U*Y)},p.lastT=function(){return Math.max(this.center.lastT(),this.up.lastT(),this.right.lastT(),this.radius.lastT(),this.angle.lastT())},p.idle=function(t){this.center.idle(t),this.up.idle(t),this.right.idle(t),this.radius.idle(t),this.angle.idle(t)},p.flush=function(t){this.center.flush(t),this.up.flush(t),this.right.flush(t),this.radius.flush(t),this.angle.flush(t)},p.setDistance=function(t,e){e>0&&this.radius.set(t,Math.log(e))},p.lookAt=function(t,e,r,o){this.recalcMatrix(t),e=e||this.computedEye,r=r||this.computedCenter,o=o||this.computedUp;var a=o[0],s=o[1],l=o[2],u=n(a,s,l);if(!(1e-6>u)){a/=u,s/=u,l/=u;var c=e[0]-r[0],h=e[1]-r[1],f=e[2]-r[2],d=n(c,h,f);if(!(1e-6>d)){c/=d,h/=d,f/=d;var p=this.computedRight,v=p[0],m=p[1],g=p[2],y=a*v+s*m+l*g;v-=y*a,m-=y*s,g-=y*l;var b=n(v,m,g);if(!(.01>b&&(v=s*f-l*h,m=l*c-a*f,g=a*h-s*c,b=n(v,m,g),1e-6>b))){v/=b,m/=b,g/=b,this.up.set(t,a,s,l),this.right.set(t,v,m,g),this.center.set(t,r[0],r[1],r[2]),this.radius.set(t,Math.log(d));var x=s*g-l*m,_=l*v-a*g,w=a*m-s*v,M=n(x,_,w);x/=M,_/=M,w/=M;var k=a*c+s*h+l*f,A=v*c+m*h+g*f,T=x*c+_*h+w*f,E=Math.asin(i(k)),S=Math.atan2(T,A),L=this.angle._state,z=L[L.length-1],I=L[L.length-2];z%=2*Math.PI;var P=Math.abs(z+2*Math.PI-S),C=Math.abs(z-S),R=Math.abs(z-2*Math.PI-S);C>P&&(z+=2*Math.PI),C>R&&(z-=2*Math.PI),this.angle.jump(this.angle.lastT(),z,I),this.angle.set(t,S,E)}}}}},{"filtered-vector":21,"gl-mat4/invert":143,"gl-mat4/rotate":147,"gl-vec3/cross":24,"gl-vec3/dot":25,"gl-vec3/normalize":28}],40:[function(t,e,r){"use strict";function n(t,e){this._controllerNames=Object.keys(t),this._controllerList=this._controllerNames.map(function(e){return t[e]}),this._mode=e,this._active=t[e],this._active||(this._mode="turntable",this._active=t.turntable),this.modes=this._controllerNames,this.computedMatrix=this._active.computedMatrix,this.computedEye=this._active.computedEye,this.computedUp=this._active.computedUp,this.computedCenter=this._active.computedCenter,this.computedRadius=this._active.computedRadius}function i(t){t=t||{};var e=t.eye||[0,0,1],r=t.center||[0,0,0],i=t.up||[0,1,0],l=t.distanceLimits||[0,1/0],u=t.mode||"turntable",c=o(),h=a(),f=s();return c.setDistanceLimits(l[0],l[1]),c.lookAt(0,e,r,i),h.setDistanceLimits(l[0],l[1]),h.lookAt(0,e,r,i),f.setDistanceLimits(l[0],l[1]),f.lookAt(0,e,r,i),new n({turntable:c,orbit:h,matrix:f},u)}e.exports=i;var o=t("turntable-camera-controller"),a=t("orbit-camera-controller"),s=t("matrix-camera-controller"),l=n.prototype,u=[["flush",1],["idle",1],["lookAt",4],["rotate",4],["pan",4],["translate",4],["setMatrix",2],["setDistanceLimits",2],["setDistance",2]];u.forEach(function(t){for(var e=t[0],r=[],n=0;n<t[1];++n)r.push("a"+n);var i="var cc=this._controllerList;for(var i=0;i<cc.length;++i){cc[i]."+t[0]+"("+r.join()+")}";l[e]=Function.apply(null,r.concat(i))}),l.recalcMatrix=function(t){this._active.recalcMatrix(t)},l.getDistance=function(t){return this._active.getDistance(t)},l.getDistanceLimits=function(t){return this._active.getDistanceLimits(t)},l.lastT=function(){return this._active.lastT()},l.setMode=function(t){if(t!==this._mode){var e=this._controllerNames.indexOf(t);if(!(0>e)){var r=this._active,n=this._controllerList[e],i=Math.max(r.lastT(),n.lastT());r.recalcMatrix(i),n.setMatrix(i,r.computedMatrix),this._active=n,this._mode=t,this.computedMatrix=this._active.computedMatrix,this.computedEye=this._active.computedEye,this.computedUp=this._active.computedUp,this.computedCenter=this._active.computedCenter,this.computedRadius=this._active.computedRadius}}},l.getMode=function(){return this._mode}},{"matrix-camera-controller":29,"orbit-camera-controller":38,"turntable-camera-controller":39}],41:[function(t,e,r){function n(t,e){return o(i(t,e))}e.exports=n;var i=t("alpha-complex"),o=t("simplicial-complex-boundary")},{"alpha-complex":42,"simplicial-complex-boundary":45}],42:[function(t,e,r){"use strict";function n(t,e){return i(e).filter(function(r){for(var n=new Array(r.length),i=0;i<r.length;++i)n[i]=e[r[i]];return o(n)*t<1})}e.exports=n;var i=t("delaunay-triangulate"),o=t("circumradius")},{circumradius:43,"delaunay-triangulate":120}],43:[function(t,e,r){function n(t){for(var e=i(t),r=0,n=0;n<t.length;++n)for(var o=t[n],a=0;a<e.length;++a)r+=Math.pow(o[a]-e[a],2);return Math.sqrt(r/t.length)}e.exports=n;var i=t("circumcenter")},{circumcenter:44}],44:[function(t,e,r){"use strict";function n(t,e){for(var r=0,n=t.length,i=0;n>i;++i)r+=t[i]*e[i];return r}function i(t){var e=t.length;if(0===e)return[];var r=(t[0].length,a([t.length+1,t.length+1],1)),i=a([t.length+1],1);r[e][e]=0;for(var o=0;e>o;++o){for(var l=0;o>=l;++l)r[l][o]=r[o][l]=2*n(t[o],t[l]);i[o]=n(t[o],t[o])}for(var u=s(r,i),c=0,h=u[e+1],o=0;o<h.length;++o)c+=h[o];for(var f=new Array(e),o=0;e>o;++o){for(var h=u[o],d=0,l=0;l<h.length;++l)d+=h[l];f[o]=d/c}return f}function o(t){if(0===t.length)return[];for(var e=t[0].length,r=a([e]),n=i(t),o=0;o<t.length;++o)for(var s=0;e>s;++s)r[s]+=t[o][s]*n[o];return r}var a=t("dup"),s=t("robust-linear-solve");o.barycenetric=i,e.exports=o},{dup:121,"robust-linear-solve":436}],45:[function(t,e,r){"use strict";function n(t){return o(i(t))}e.exports=n;var i=t("boundary-cells"),o=t("reduce-simplicial-complex")},{"boundary-cells":46,"reduce-simplicial-complex":49}],46:[function(t,e,r){"use strict";function n(t){for(var e=t.length,r=0,n=0;e>n;++n)r+=t[n].length;for(var i=new Array(r),o=0,n=0;e>n;++n)for(var a=t[n],s=a.length,l=0;s>l;++l)for(var u=i[o++]=new Array(s-1),c=1;s>c;++c)u[c-1]=a[(l+c)%s];return i}e.exports=n},{}],47:[function(t,e,r){"use strict";function n(t){for(var e=1,r=1;r<t.length;++r)for(var n=0;r>n;++n)if(t[r]<t[n])e=-e;else if(t[n]===t[r])return 0;return e}e.exports=n},{}],48:[function(t,e,r){"use strict";function n(t,e){return i(t,e)||o(t)-o(e)}var i=t("compare-cell"),o=t("cell-orientation");e.exports=n},{"cell-orientation":47,"compare-cell":107}],49:[function(t,e,r){"use strict";function n(t){t.sort(o);for(var e=t.length,r=0,n=0;e>n;++n){var s=t[n],l=a(s);if(0!==l){if(r>0){var u=t[r-1];if(0===i(s,u)&&a(u)!==l){r-=1;continue}}t[r++]=s}}return t.length=r,t}var i=t("compare-cell"),o=t("compare-oriented-cell"),a=t("cell-orientation");e.exports=n},{"cell-orientation":47,"compare-cell":107,"compare-oriented-cell":48}],50:[function(t,e,r){"use strict";var n=function(){function t(t){return!Array.isArray(t)&&null!==t&&"object"==typeof t}function e(t,e,r){for(var n=(e-t)/Math.max(r-1,1),i=[],o=0;r>o;o++)i.push(t+o*n);return i}function r(){for(var t=[].slice.call(arguments),e=t.map(function(t){return t.length}),r=Math.min.apply(null,e),n=[],i=0;r>i;i++){n[i]=[];for(var o=0;o<t.length;++o)n[i][o]=t[o][i]}return n}function n(t,e,r){for(var n=Math.min.apply(null,[t.length,e.length,r.length]),i=[],o=0;n>o;o++)i.push([t[o],e[o],r[o]]);return i}function i(t){function e(t){for(var n=0;n<t.length;n++)Array.isArray(t[n])?e(t[n],r):r+=t[n]}var r=0;return e(t,r),r}function o(t){for(var e=[],r=0;r<t.length;++r){e[r]=[];for(var n=0;n<t[r].length;++n)e[r][n]=t[r][n]}return e}function a(t){for(var e=[],r=0;r<t.length;++r)e[r]=t[r];return e}function s(t,e){if(t.length!==e.length)return!1;for(var r=t.length;r--;)if(t[r]!==e[r])return!1;return!0}function l(t,e){var r,n;if("string"!=typeof t)return t;if(r=[],"#"===t[0]?(t=t.substr(1),3===t.length&&(t+=t),n=parseInt(t,16),r[0]=n>>16&255,r[1]=n>>8&255,r[2]=255&n):h.test(t)&&(n=t.match(f),r[0]=parseInt(n[1]),r[1]=parseInt(n[2]),r[2]=parseInt(n[3])),!e)for(var i=0;3>i;++i)r[i]=r[i]/255;return r}function u(t,e){var r,n;if("string"!=typeof t)return t;if(r=[],"#"===t[0]?(t=t.substr(1),3===t.length&&(t+=t),n=parseInt(t,16),r[0]=n>>16&255,r[1]=n>>8&255,r[2]=255&n):h.test(t)&&(n=t.match(f),r[0]=parseInt(n[1]),r[1]=parseInt(n[2]),r[2]=parseInt(n[3]),n[4]?r[3]=parseFloat(n[4]):r[3]=1),!e)for(var i=0;3>i;++i)r[i]=r[i]/255;return r}var c={},h=/^rgba?\(\s*\d{1,3}\s*,\s*\d{1,3}\s*,\s*\d{1,3}\s*(,.*)?\)$/,f=/^rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,?\s*(.*)?\)$/;return c.isPlainObject=t,c.linspace=e,c.zip3=n,c.sum=i,c.zip=r,c.isEqual=s,c.copy2D=o,c.copy1D=a,c.str2RgbArray=l,c.str2RgbaArray=u,c};e.exports=n()},{}],51:[function(t,e,r){"use strict";"use restrict";function n(t){var e=32;return t&=-t,t&&e--,65535&t&&(e-=16),16711935&t&&(e-=8),252645135&t&&(e-=4),858993459&t&&(e-=2),1431655765&t&&(e-=1),e}var i=32;r.INT_BITS=i,r.INT_MAX=2147483647,r.INT_MIN=-1<<i-1,r.sign=function(t){return(t>0)-(0>t)},r.abs=function(t){var e=t>>i-1;return(t^e)-e},r.min=function(t,e){return e^(t^e)&-(e>t)},r.max=function(t,e){return t^(t^e)&-(e>t)},r.isPow2=function(t){return!(t&t-1||!t)},r.log2=function(t){var e,r;return e=(t>65535)<<4,t>>>=e,r=(t>255)<<3,t>>>=r,e|=r,r=(t>15)<<2,t>>>=r,e|=r,r=(t>3)<<1,t>>>=r,e|=r,e|t>>1},r.log10=function(t){return t>=1e9?9:t>=1e8?8:t>=1e7?7:t>=1e6?6:t>=1e5?5:t>=1e4?4:t>=1e3?3:t>=100?2:t>=10?1:0},r.popCount=function(t){return t-=t>>>1&1431655765,t=(858993459&t)+(t>>>2&858993459),16843009*(t+(t>>>4)&252645135)>>>24},r.countTrailingZeros=n,r.nextPow2=function(t){return t+=0===t,--t,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t+1},r.prevPow2=function(t){return t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t-(t>>>1)},r.parity=function(t){return t^=t>>>16,t^=t>>>8,t^=t>>>4,t&=15,27030>>>t&1};var o=new Array(256);!function(t){for(var e=0;256>e;++e){var r=e,n=e,i=7;for(r>>>=1;r;r>>>=1)n<<=1,n|=1&r,--i;t[e]=n<<i&255}}(o),r.reverse=function(t){return o[255&t]<<24|o[t>>>8&255]<<16|o[t>>>16&255]<<8|o[t>>>24&255]},r.interleave2=function(t,e){return t&=65535,t=16711935&(t|t<<8),t=252645135&(t|t<<4),t=858993459&(t|t<<2),t=1431655765&(t|t<<1),e&=65535,e=16711935&(e|e<<8),e=252645135&(e|e<<4),e=858993459&(e|e<<2),e=1431655765&(e|e<<1),t|e<<1},r.deinterleave2=function(t,e){return t=t>>>e&1431655765,t=858993459&(t|t>>>1),t=252645135&(t|t>>>2),t=16711935&(t|t>>>4),t=65535&(t|t>>>16),t<<16>>16},r.interleave3=function(t,e,r){return t&=1023,t=4278190335&(t|t<<16),t=251719695&(t|t<<8),t=3272356035&(t|t<<4),t=1227133513&(t|t<<2),e&=1023,e=4278190335&(e|e<<16),e=251719695&(e|e<<8),e=3272356035&(e|e<<4),e=1227133513&(e|e<<2),t|=e<<1,r&=1023,r=4278190335&(r|r<<16),r=251719695&(r|r<<8),r=3272356035&(r|r<<4),r=1227133513&(r|r<<2),t|r<<2},r.deinterleave3=function(t,e){return t=t>>>e&1227133513,t=3272356035&(t|t>>>2),t=251719695&(t|t>>>4),t=4278190335&(t|t>>>8),t=1023&(t|t>>>16),t<<22>>22},r.nextCombination=function(t){var e=t|t-1;return e+1|(~e&-~e)-1>>>n(t)+1}},{}],52:[function(t,e,r){function n(t,e){return d.isUndefined(e)?""+e:d.isNumber(e)&&!isFinite(e)?e.toString():d.isFunction(e)||d.isRegExp(e)?e.toString():e}function i(t,e){return d.isString(t)?t.length<e?t:t.slice(0,e):t}function o(t){return i(JSON.stringify(t.actual,n),128)+" "+t.operator+" "+i(JSON.stringify(t.expected,n),128)}function a(t,e,r,n,i){throw new m.AssertionError({message:r,actual:t,expected:e,operator:n,stackStartFunction:i})}function s(t,e){t||a(t,!0,e,"==",m.ok)}function l(t,e){if(t===e)return!0;if(d.isBuffer(t)&&d.isBuffer(e)){if(t.length!=e.length)return!1;for(var r=0;r<t.length;r++)if(t[r]!==e[r])return!1;return!0}return d.isDate(t)&&d.isDate(e)?t.getTime()===e.getTime():d.isRegExp(t)&&d.isRegExp(e)?t.source===e.source&&t.global===e.global&&t.multiline===e.multiline&&t.lastIndex===e.lastIndex&&t.ignoreCase===e.ignoreCase:d.isObject(t)||d.isObject(e)?c(t,e):t==e}function u(t){return"[object Arguments]"==Object.prototype.toString.call(t)}function c(t,e){if(d.isNullOrUndefined(t)||d.isNullOrUndefined(e))return!1;if(t.prototype!==e.prototype)return!1;if(d.isPrimitive(t)||d.isPrimitive(e))return t===e;var r=u(t),n=u(e);if(r&&!n||!r&&n)return!1;if(r)return t=p.call(t),e=p.call(e),l(t,e);var i,o,a=g(t),s=g(e);if(a.length!=s.length)return!1;for(a.sort(),s.sort(),o=a.length-1;o>=0;o--)if(a[o]!=s[o])return!1;for(o=a.length-1;o>=0;o--)if(i=a[o],!l(t[i],e[i]))return!1;return!0}function h(t,e){return t&&e?"[object RegExp]"==Object.prototype.toString.call(e)?e.test(t):t instanceof e?!0:e.call({},t)===!0:!1}function f(t,e,r,n){var i;d.isString(r)&&(n=r,r=null);try{e()}catch(o){i=o}if(n=(r&&r.name?" ("+r.name+").":".")+(n?" "+n:"."),t&&!i&&a(i,r,"Missing expected exception"+n),!t&&h(i,r)&&a(i,r,"Got unwanted exception"+n),t&&i&&r&&!h(i,r)||!t&&i)throw i}var d=t("util/"),p=Array.prototype.slice,v=Object.prototype.hasOwnProperty,m=e.exports=s;m.AssertionError=function(t){this.name="AssertionError",this.actual=t.actual,this.expected=t.expected,this.operator=t.operator,t.message?(this.message=t.message,this.generatedMessage=!1):(this.message=o(this),this.generatedMessage=!0);var e=t.stackStartFunction||a;if(Error.captureStackTrace)Error.captureStackTrace(this,e);else{var r=new Error;if(r.stack){var n=r.stack,i=e.name,s=n.indexOf("\n"+i);if(s>=0){var l=n.indexOf("\n",s+1);n=n.substring(l+1)}this.stack=n}}},d.inherits(m.AssertionError,Error),m.fail=a,m.ok=s,m.equal=function(t,e,r){t!=e&&a(t,e,r,"==",m.equal)},m.notEqual=function(t,e,r){t==e&&a(t,e,r,"!=",m.notEqual)},m.deepEqual=function(t,e,r){l(t,e)||a(t,e,r,"deepEqual",m.deepEqual)},m.notDeepEqual=function(t,e,r){l(t,e)&&a(t,e,r,"notDeepEqual",m.notDeepEqual)},m.strictEqual=function(t,e,r){t!==e&&a(t,e,r,"===",m.strictEqual)},m.notStrictEqual=function(t,e,r){t===e&&a(t,e,r,"!==",m.notStrictEqual)},m.throws=function(t,e,r){f.apply(this,[!0].concat(p.call(arguments)))},m.doesNotThrow=function(t,e){f.apply(this,[!1].concat(p.call(arguments)))},m.ifError=function(t){if(t)throw t};var g=Object.keys||function(t){var e=[];for(var r in t)v.call(t,r)&&e.push(r);return e}},{"util/":62}],53:[function(t,e,r){(function(e){"use strict";function n(){try{var t=new Uint8Array(1);return t.foo=function(){return 42},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(e){return!1}}function i(){return o.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function o(t){return this instanceof o?(o.TYPED_ARRAY_SUPPORT||(this.length=0,this.parent=void 0),"number"==typeof t?a(this,t):"string"==typeof t?s(this,t,arguments.length>1?arguments[1]:"utf8"):l(this,t)):arguments.length>1?new o(t,arguments[1]):new o(t)}function a(t,e){if(t=v(t,0>e?0:0|m(e)),!o.TYPED_ARRAY_SUPPORT)for(var r=0;e>r;r++)t[r]=0;return t}function s(t,e,r){"string"==typeof r&&""!==r||(r="utf8");var n=0|y(e,r);return t=v(t,n),t.write(e,r),t}function l(t,e){if(o.isBuffer(e))return u(t,e);if(K(e))return c(t,e);if(null==e)throw new TypeError("must start with number, buffer, array or string");if("undefined"!=typeof ArrayBuffer){if(e.buffer instanceof ArrayBuffer)return h(t,e);if(e instanceof ArrayBuffer)return f(t,e)}return e.length?d(t,e):p(t,e)}function u(t,e){var r=0|m(e.length);return t=v(t,r),e.copy(t,0,0,r),t}function c(t,e){var r=0|m(e.length);t=v(t,r);for(var n=0;r>n;n+=1)t[n]=255&e[n];return t}function h(t,e){var r=0|m(e.length);t=v(t,r);for(var n=0;r>n;n+=1)t[n]=255&e[n];return t}function f(t,e){return e.byteLength,o.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e),t.__proto__=o.prototype):t=h(t,new Uint8Array(e)),t}function d(t,e){var r=0|m(e.length);t=v(t,r);for(var n=0;r>n;n+=1)t[n]=255&e[n];return t}function p(t,e){var r,n=0;"Buffer"===e.type&&K(e.data)&&(r=e.data,n=0|m(r.length)),t=v(t,n);for(var i=0;n>i;i+=1)t[i]=255&r[i];return t}function v(t,e){o.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e),t.__proto__=o.prototype):t.length=e;var r=0!==e&&e<=o.poolSize>>>1;return r&&(t.parent=J),t}function m(t){if(t>=i())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i().toString(16)+" bytes");return 0|t}function g(t,e){if(!(this instanceof g))return new g(t,e);var r=new o(t,e);return delete r.parent,r}function y(t,e){"string"!=typeof t&&(t=""+t);var r=t.length;if(0===r)return 0;for(var n=!1;;)switch(e){case"ascii":case"binary":case"raw":case"raws":return r;case"utf8":case"utf-8":return q(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return X(t).length;default:if(n)return q(t).length;e=(""+e).toLowerCase(),n=!0}}function b(t,e,r){var n=!1;if(e=0|e,r=void 0===r||r===1/0?this.length:0|r,t||(t="utf8"),0>e&&(e=0),r>this.length&&(r=this.length),e>=r)return"";for(;;)switch(t){case"hex":return I(this,e,r);case"utf8":case"utf-8":return E(this,e,r);case"ascii":return L(this,e,r);case"binary":return z(this,e,r);case"base64":return T(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return P(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function x(t,e,r,n){r=Number(r)||0;var i=t.length-r;n?(n=Number(n),n>i&&(n=i)):n=i;var o=e.length;if(o%2!==0)throw new Error("Invalid hex string");n>o/2&&(n=o/2);for(var a=0;n>a;a++){var s=parseInt(e.substr(2*a,2),16);if(isNaN(s))throw new Error("Invalid hex string");t[r+a]=s}return a}function _(t,e,r,n){return Y(q(e,t.length-r),t,r,n)}function w(t,e,r,n){return Y(G(e),t,r,n)}function M(t,e,r,n){return w(t,e,r,n)}function k(t,e,r,n){return Y(X(e),t,r,n)}function A(t,e,r,n){return Y(H(e,t.length-r),t,r,n)}function T(t,e,r){return 0===e&&r===t.length?W.fromByteArray(t):W.fromByteArray(t.slice(e,r))}function E(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;r>i;){var o=t[i],a=null,s=o>239?4:o>223?3:o>191?2:1;if(r>=i+s){var l,u,c,h;switch(s){case 1:128>o&&(a=o);break;case 2:l=t[i+1],128===(192&l)&&(h=(31&o)<<6|63&l,h>127&&(a=h));break;case 3:l=t[i+1],u=t[i+2],128===(192&l)&&128===(192&u)&&(h=(15&o)<<12|(63&l)<<6|63&u,h>2047&&(55296>h||h>57343)&&(a=h));break;case 4:l=t[i+1],u=t[i+2],c=t[i+3],128===(192&l)&&128===(192&u)&&128===(192&c)&&(h=(15&o)<<18|(63&l)<<12|(63&u)<<6|63&c,h>65535&&1114112>h&&(a=h))}}null===a?(a=65533,s=1):a>65535&&(a-=65536,n.push(a>>>10&1023|55296),a=56320|1023&a),n.push(a),i+=s}return S(n)}function S(t){var e=t.length;if($>=e)return String.fromCharCode.apply(String,t);for(var r="",n=0;e>n;)r+=String.fromCharCode.apply(String,t.slice(n,n+=$));return r}function L(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;r>i;i++)n+=String.fromCharCode(127&t[i]);return n}function z(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;r>i;i++)n+=String.fromCharCode(t[i]);return n}function I(t,e,r){var n=t.length;(!e||0>e)&&(e=0),(!r||0>r||r>n)&&(r=n);for(var i="",o=e;r>o;o++)i+=V(t[o]);return i}function P(t,e,r){for(var n=t.slice(e,r),i="",o=0;o<n.length;o+=2)i+=String.fromCharCode(n[o]+256*n[o+1]);return i}function C(t,e,r){if(t%1!==0||0>t)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function R(t,e,r,n,i,a){if(!o.isBuffer(t))throw new TypeError("buffer must be a Buffer instance");if(e>i||a>e)throw new RangeError("value is out of bounds");if(r+n>t.length)throw new RangeError("index out of range")}function D(t,e,r,n){0>e&&(e=65535+e+1);for(var i=0,o=Math.min(t.length-r,2);o>i;i++)t[r+i]=(e&255<<8*(n?i:1-i))>>>8*(n?i:1-i)}function O(t,e,r,n){0>e&&(e=4294967295+e+1);for(var i=0,o=Math.min(t.length-r,4);o>i;i++)t[r+i]=e>>>8*(n?i:3-i)&255}function F(t,e,r,n,i,o){if(r+n>t.length)throw new RangeError("index out of range");if(0>r)throw new RangeError("index out of range")}function j(t,e,r,n,i){return i||F(t,e,r,4,3.4028234663852886e38,-3.4028234663852886e38),Z.write(t,e,r,n,23,4),r+4}function N(t,e,r,n,i){return i||F(t,e,r,8,1.7976931348623157e308,-1.7976931348623157e308),Z.write(t,e,r,n,52,8),r+8}function B(t){if(t=U(t).replace(Q,""),t.length<2)return"";for(;t.length%4!==0;)t+="=";return t}function U(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function V(t){return 16>t?"0"+t.toString(16):t.toString(16)}function q(t,e){e=e||1/0;for(var r,n=t.length,i=null,o=[],a=0;n>a;a++){if(r=t.charCodeAt(a),r>55295&&57344>r){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(a+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(56320>r){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,128>r){if((e-=1)<0)break;o.push(r)}else if(2048>r){if((e-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(65536>r){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(1114112>r))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function G(t){for(var e=[],r=0;r<t.length;r++)e.push(255&t.charCodeAt(r));return e}function H(t,e){for(var r,n,i,o=[],a=0;a<t.length&&!((e-=2)<0);a++)r=t.charCodeAt(a),n=r>>8,i=r%256,o.push(i),o.push(n);return o}function X(t){return W.toByteArray(B(t))}function Y(t,e,r,n){for(var i=0;n>i&&!(i+r>=e.length||i>=t.length);i++)e[i+r]=t[i];return i}var W=t("base64-js"),Z=t("ieee754"),K=t("isarray");r.Buffer=o,r.SlowBuffer=g,r.INSPECT_MAX_BYTES=50,o.poolSize=8192;var J={};o.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:n(),o._augment=function(t){return t.__proto__=o.prototype,t},o.TYPED_ARRAY_SUPPORT?(o.prototype.__proto__=Uint8Array.prototype,o.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&o[Symbol.species]===o&&Object.defineProperty(o,Symbol.species,{value:null,configurable:!0})):(o.prototype.length=void 0,o.prototype.parent=void 0),o.isBuffer=function(t){return!(null==t||!t._isBuffer)},o.compare=function(t,e){if(!o.isBuffer(t)||!o.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,n=e.length,i=0,a=Math.min(r,n);a>i&&t[i]===e[i];)++i;return i!==a&&(r=t[i],n=e[i]),n>r?-1:r>n?1:0},o.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"raw":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},o.concat=function(t,e){if(!K(t))throw new TypeError("list argument must be an Array of Buffers.");if(0===t.length)return new o(0);var r;if(void 0===e)for(e=0,r=0;r<t.length;r++)e+=t[r].length;var n=new o(e),i=0;for(r=0;r<t.length;r++){var a=t[r];a.copy(n,i),i+=a.length}return n},o.byteLength=y,o.prototype._isBuffer=!0,o.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?E(this,0,t):b.apply(this,arguments)},o.prototype.equals=function(t){if(!o.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t?!0:0===o.compare(this,t)},o.prototype.inspect=function(){var t="",e=r.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,e).match(/.{2}/g).join(" "),this.length>e&&(t+=" ... ")),"<Buffer "+t+">"},o.prototype.compare=function(t){if(!o.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t?0:o.compare(this,t)},o.prototype.indexOf=function(t,e){function r(t,e,r){for(var n=-1,i=0;r+i<t.length;i++)if(t[r+i]===e[-1===n?0:i-n]){if(-1===n&&(n=i),i-n+1===e.length)return r+n}else n=-1;return-1}if(e>2147483647?e=2147483647:-2147483648>e&&(e=-2147483648),e>>=0,0===this.length)return-1;if(e>=this.length)return-1;if(0>e&&(e=Math.max(this.length+e,0)),"string"==typeof t)return 0===t.length?-1:String.prototype.indexOf.call(this,t,e);if(o.isBuffer(t))return r(this,t,e);if("number"==typeof t)return o.TYPED_ARRAY_SUPPORT&&"function"===Uint8Array.prototype.indexOf?Uint8Array.prototype.indexOf.call(this,t,e):r(this,[t],e);throw new TypeError("val must be string, number or Buffer")},o.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else if(isFinite(e))e=0|e,isFinite(r)?(r=0|r,void 0===n&&(n="utf8")):(n=r,r=void 0);else{var i=n;n=e,e=0|r,r=i}var o=this.length-e;if((void 0===r||r>o)&&(r=o),t.length>0&&(0>r||0>e)||e>this.length)throw new RangeError("attempt to write outside buffer bounds");n||(n="utf8");for(var a=!1;;)switch(n){case"hex":return x(this,t,e,r);case"utf8":case"utf-8":return _(this,t,e,r);case"ascii":return w(this,t,e,r);case"binary":return M(this,t,e,r);case"base64":return k(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,t,e,r);default:if(a)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),a=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var $=4096;o.prototype.slice=function(t,e){var r=this.length;t=~~t,e=void 0===e?r:~~e,0>t?(t+=r,0>t&&(t=0)):t>r&&(t=r),0>e?(e+=r,0>e&&(e=0)):e>r&&(e=r),t>e&&(e=t);var n;if(o.TYPED_ARRAY_SUPPORT)n=this.subarray(t,e),n.__proto__=o.prototype;else{var i=e-t;n=new o(i,void 0);for(var a=0;i>a;a++)n[a]=this[a+t]}return n.length&&(n.parent=this.parent||this),n},o.prototype.readUIntLE=function(t,e,r){t=0|t,e=0|e,r||C(t,e,this.length);for(var n=this[t],i=1,o=0;++o<e&&(i*=256);)n+=this[t+o]*i;return n},o.prototype.readUIntBE=function(t,e,r){t=0|t,e=0|e,r||C(t,e,this.length);for(var n=this[t+--e],i=1;e>0&&(i*=256);)n+=this[t+--e]*i;return n},o.prototype.readUInt8=function(t,e){return e||C(t,1,this.length),this[t]},o.prototype.readUInt16LE=function(t,e){return e||C(t,2,this.length),this[t]|this[t+1]<<8},o.prototype.readUInt16BE=function(t,e){return e||C(t,2,this.length),this[t]<<8|this[t+1]},o.prototype.readUInt32LE=function(t,e){return e||C(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},o.prototype.readUInt32BE=function(t,e){return e||C(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},o.prototype.readIntLE=function(t,e,r){t=0|t,e=0|e,r||C(t,e,this.length);for(var n=this[t],i=1,o=0;++o<e&&(i*=256);)n+=this[t+o]*i;return i*=128,n>=i&&(n-=Math.pow(2,8*e)),n},o.prototype.readIntBE=function(t,e,r){t=0|t,e=0|e,r||C(t,e,this.length);for(var n=e,i=1,o=this[t+--n];n>0&&(i*=256);)o+=this[t+--n]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*e)),o},o.prototype.readInt8=function(t,e){return e||C(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},o.prototype.readInt16LE=function(t,e){e||C(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},o.prototype.readInt16BE=function(t,e){e||C(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},o.prototype.readInt32LE=function(t,e){return e||C(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},o.prototype.readInt32BE=function(t,e){return e||C(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},o.prototype.readFloatLE=function(t,e){return e||C(t,4,this.length),Z.read(this,t,!0,23,4)},o.prototype.readFloatBE=function(t,e){return e||C(t,4,this.length),Z.read(this,t,!1,23,4)},o.prototype.readDoubleLE=function(t,e){return e||C(t,8,this.length),Z.read(this,t,!0,52,8)},o.prototype.readDoubleBE=function(t,e){
return e||C(t,8,this.length),Z.read(this,t,!1,52,8)},o.prototype.writeUIntLE=function(t,e,r,n){t=+t,e=0|e,r=0|r,n||R(this,t,e,r,Math.pow(2,8*r),0);var i=1,o=0;for(this[e]=255&t;++o<r&&(i*=256);)this[e+o]=t/i&255;return e+r},o.prototype.writeUIntBE=function(t,e,r,n){t=+t,e=0|e,r=0|r,n||R(this,t,e,r,Math.pow(2,8*r),0);var i=r-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+r},o.prototype.writeUInt8=function(t,e,r){return t=+t,e=0|e,r||R(this,t,e,1,255,0),o.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},o.prototype.writeUInt16LE=function(t,e,r){return t=+t,e=0|e,r||R(this,t,e,2,65535,0),o.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):D(this,t,e,!0),e+2},o.prototype.writeUInt16BE=function(t,e,r){return t=+t,e=0|e,r||R(this,t,e,2,65535,0),o.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):D(this,t,e,!1),e+2},o.prototype.writeUInt32LE=function(t,e,r){return t=+t,e=0|e,r||R(this,t,e,4,4294967295,0),o.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):O(this,t,e,!0),e+4},o.prototype.writeUInt32BE=function(t,e,r){return t=+t,e=0|e,r||R(this,t,e,4,4294967295,0),o.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):O(this,t,e,!1),e+4},o.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e=0|e,!n){var i=Math.pow(2,8*r-1);R(this,t,e,r,i-1,-i)}var o=0,a=1,s=0>t?1:0;for(this[e]=255&t;++o<r&&(a*=256);)this[e+o]=(t/a>>0)-s&255;return e+r},o.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e=0|e,!n){var i=Math.pow(2,8*r-1);R(this,t,e,r,i-1,-i)}var o=r-1,a=1,s=0>t?1:0;for(this[e+o]=255&t;--o>=0&&(a*=256);)this[e+o]=(t/a>>0)-s&255;return e+r},o.prototype.writeInt8=function(t,e,r){return t=+t,e=0|e,r||R(this,t,e,1,127,-128),o.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),0>t&&(t=255+t+1),this[e]=255&t,e+1},o.prototype.writeInt16LE=function(t,e,r){return t=+t,e=0|e,r||R(this,t,e,2,32767,-32768),o.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):D(this,t,e,!0),e+2},o.prototype.writeInt16BE=function(t,e,r){return t=+t,e=0|e,r||R(this,t,e,2,32767,-32768),o.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):D(this,t,e,!1),e+2},o.prototype.writeInt32LE=function(t,e,r){return t=+t,e=0|e,r||R(this,t,e,4,2147483647,-2147483648),o.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):O(this,t,e,!0),e+4},o.prototype.writeInt32BE=function(t,e,r){return t=+t,e=0|e,r||R(this,t,e,4,2147483647,-2147483648),0>t&&(t=4294967295+t+1),o.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):O(this,t,e,!1),e+4},o.prototype.writeFloatLE=function(t,e,r){return j(this,t,e,!0,r)},o.prototype.writeFloatBE=function(t,e,r){return j(this,t,e,!1,r)},o.prototype.writeDoubleLE=function(t,e,r){return N(this,t,e,!0,r)},o.prototype.writeDoubleBE=function(t,e,r){return N(this,t,e,!1,r)},o.prototype.copy=function(t,e,r,n){if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&r>n&&(n=r),n===r)return 0;if(0===t.length||0===this.length)return 0;if(0>e)throw new RangeError("targetStart out of bounds");if(0>r||r>=this.length)throw new RangeError("sourceStart out of bounds");if(0>n)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e<n-r&&(n=t.length-e+r);var i,a=n-r;if(this===t&&e>r&&n>e)for(i=a-1;i>=0;i--)t[i+e]=this[i+r];else if(1e3>a||!o.TYPED_ARRAY_SUPPORT)for(i=0;a>i;i++)t[i+e]=this[i+r];else Uint8Array.prototype.set.call(t,this.subarray(r,r+a),e);return a},o.prototype.fill=function(t,e,r){if(t||(t=0),e||(e=0),r||(r=this.length),e>r)throw new RangeError("end < start");if(r!==e&&0!==this.length){if(0>e||e>=this.length)throw new RangeError("start out of bounds");if(0>r||r>this.length)throw new RangeError("end out of bounds");var n;if("number"==typeof t)for(n=e;r>n;n++)this[n]=t;else{var i=q(t.toString()),o=i.length;for(n=e;r>n;n++)this[n]=i[n%o]}return this}};var Q=/[^+\/0-9A-Za-z-_]/g}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"base64-js":54,ieee754:55,isarray:56}],54:[function(t,e,r){"use strict";function n(){var t,e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=e.length;for(t=0;r>t;t++)l[t]=e[t];for(t=0;r>t;++t)u[e.charCodeAt(t)]=t;u["-".charCodeAt(0)]=62,u["_".charCodeAt(0)]=63}function i(t){var e,r,n,i,o,a,s=t.length;if(s%4>0)throw new Error("Invalid string. Length must be a multiple of 4");o="="===t[s-2]?2:"="===t[s-1]?1:0,a=new c(3*s/4-o),n=o>0?s-4:s;var l=0;for(e=0,r=0;n>e;e+=4,r+=3)i=u[t.charCodeAt(e)]<<18|u[t.charCodeAt(e+1)]<<12|u[t.charCodeAt(e+2)]<<6|u[t.charCodeAt(e+3)],a[l++]=(16711680&i)>>16,a[l++]=(65280&i)>>8,a[l++]=255&i;return 2===o?(i=u[t.charCodeAt(e)]<<2|u[t.charCodeAt(e+1)]>>4,a[l++]=255&i):1===o&&(i=u[t.charCodeAt(e)]<<10|u[t.charCodeAt(e+1)]<<4|u[t.charCodeAt(e+2)]>>2,a[l++]=i>>8&255,a[l++]=255&i),a}function o(t){return l[t>>18&63]+l[t>>12&63]+l[t>>6&63]+l[63&t]}function a(t,e,r){for(var n,i=[],a=e;r>a;a+=3)n=(t[a]<<16)+(t[a+1]<<8)+t[a+2],i.push(o(n));return i.join("")}function s(t){for(var e,r=t.length,n=r%3,i="",o=[],s=16383,u=0,c=r-n;c>u;u+=s)o.push(a(t,u,u+s>c?c:u+s));return 1===n?(e=t[r-1],i+=l[e>>2],i+=l[e<<4&63],i+="=="):2===n&&(e=(t[r-2]<<8)+t[r-1],i+=l[e>>10],i+=l[e>>4&63],i+=l[e<<2&63],i+="="),o.push(i),o.join("")}r.toByteArray=i,r.fromByteArray=s;var l=[],u=[],c="undefined"!=typeof Uint8Array?Uint8Array:Array;n()},{}],55:[function(t,e,r){r.read=function(t,e,r,n,i){var o,a,s=8*i-n-1,l=(1<<s)-1,u=l>>1,c=-7,h=r?i-1:0,f=r?-1:1,d=t[e+h];for(h+=f,o=d&(1<<-c)-1,d>>=-c,c+=s;c>0;o=256*o+t[e+h],h+=f,c-=8);for(a=o&(1<<-c)-1,o>>=-c,c+=n;c>0;a=256*a+t[e+h],h+=f,c-=8);if(0===o)o=1-u;else{if(o===l)return a?NaN:(d?-1:1)*(1/0);a+=Math.pow(2,n),o-=u}return(d?-1:1)*a*Math.pow(2,o-n)},r.write=function(t,e,r,n,i,o){var a,s,l,u=8*o-i-1,c=(1<<u)-1,h=c>>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:o-1,p=n?1:-1,v=0>e||0===e&&0>1/e?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,a=c):(a=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-a))<1&&(a--,l*=2),e+=a+h>=1?f/l:f*Math.pow(2,1-h),e*l>=2&&(a++,l/=2),a+h>=c?(s=0,a=c):a+h>=1?(s=(e*l-1)*Math.pow(2,i),a+=h):(s=e*Math.pow(2,h-1)*Math.pow(2,i),a=0));i>=8;t[r+d]=255&s,d+=p,s/=256,i-=8);for(a=a<<i|s,u+=i;u>0;t[r+d]=255&a,d+=p,a/=256,u-=8);t[r+d-p]|=128*v}},{}],56:[function(t,e,r){var n={}.toString;e.exports=Array.isArray||function(t){return"[object Array]"==n.call(t)}},{}],57:[function(t,e,r){function n(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function i(t){return"function"==typeof t}function o(t){return"number"==typeof t}function a(t){return"object"==typeof t&&null!==t}function s(t){return void 0===t}e.exports=n,n.EventEmitter=n,n.prototype._events=void 0,n.prototype._maxListeners=void 0,n.defaultMaxListeners=10,n.prototype.setMaxListeners=function(t){if(!o(t)||0>t||isNaN(t))throw TypeError("n must be a positive number");return this._maxListeners=t,this},n.prototype.emit=function(t){var e,r,n,o,l,u;if(this._events||(this._events={}),"error"===t&&(!this._events.error||a(this._events.error)&&!this._events.error.length)){if(e=arguments[1],e instanceof Error)throw e;throw TypeError('Uncaught, unspecified "error" event.')}if(r=this._events[t],s(r))return!1;if(i(r))switch(arguments.length){case 1:r.call(this);break;case 2:r.call(this,arguments[1]);break;case 3:r.call(this,arguments[1],arguments[2]);break;default:o=Array.prototype.slice.call(arguments,1),r.apply(this,o)}else if(a(r))for(o=Array.prototype.slice.call(arguments,1),u=r.slice(),n=u.length,l=0;n>l;l++)u[l].apply(this,o);return!0},n.prototype.addListener=function(t,e){var r;if(!i(e))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",t,i(e.listener)?e.listener:e),this._events[t]?a(this._events[t])?this._events[t].push(e):this._events[t]=[this._events[t],e]:this._events[t]=e,a(this._events[t])&&!this._events[t].warned&&(r=s(this._maxListeners)?n.defaultMaxListeners:this._maxListeners,r&&r>0&&this._events[t].length>r&&(this._events[t].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[t].length),"function"==typeof console.trace&&console.trace())),this},n.prototype.on=n.prototype.addListener,n.prototype.once=function(t,e){function r(){this.removeListener(t,r),n||(n=!0,e.apply(this,arguments))}if(!i(e))throw TypeError("listener must be a function");var n=!1;return r.listener=e,this.on(t,r),this},n.prototype.removeListener=function(t,e){var r,n,o,s;if(!i(e))throw TypeError("listener must be a function");if(!this._events||!this._events[t])return this;if(r=this._events[t],o=r.length,n=-1,r===e||i(r.listener)&&r.listener===e)delete this._events[t],this._events.removeListener&&this.emit("removeListener",t,e);else if(a(r)){for(s=o;s-- >0;)if(r[s]===e||r[s].listener&&r[s].listener===e){n=s;break}if(0>n)return this;1===r.length?(r.length=0,delete this._events[t]):r.splice(n,1),this._events.removeListener&&this.emit("removeListener",t,e)}return this},n.prototype.removeAllListeners=function(t){var e,r;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[t]&&delete this._events[t],this;if(0===arguments.length){for(e in this._events)"removeListener"!==e&&this.removeAllListeners(e);return this.removeAllListeners("removeListener"),this._events={},this}if(r=this._events[t],i(r))this.removeListener(t,r);else if(r)for(;r.length;)this.removeListener(t,r[r.length-1]);return delete this._events[t],this},n.prototype.listeners=function(t){var e;return e=this._events&&this._events[t]?i(this._events[t])?[this._events[t]]:this._events[t].slice():[]},n.prototype.listenerCount=function(t){if(this._events){var e=this._events[t];if(i(e))return 1;if(e)return e.length}return 0},n.listenerCount=function(t,e){return t.listenerCount(e)}},{}],58:[function(t,e,r){"function"==typeof Object.create?e.exports=function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}},{}],59:[function(t,e,r){(function(t){function e(t,e){for(var r=0,n=t.length-1;n>=0;n--){var i=t[n];"."===i?t.splice(n,1):".."===i?(t.splice(n,1),r++):r&&(t.splice(n,1),r--)}if(e)for(;r--;r)t.unshift("..");return t}function n(t,e){if(t.filter)return t.filter(e);for(var r=[],n=0;n<t.length;n++)e(t[n],n,t)&&r.push(t[n]);return r}var i=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/,o=function(t){return i.exec(t).slice(1)};r.resolve=function(){for(var r="",i=!1,o=arguments.length-1;o>=-1&&!i;o--){var a=o>=0?arguments[o]:t.cwd();if("string"!=typeof a)throw new TypeError("Arguments to path.resolve must be strings");a&&(r=a+"/"+r,i="/"===a.charAt(0))}return r=e(n(r.split("/"),function(t){return!!t}),!i).join("/"),(i?"/":"")+r||"."},r.normalize=function(t){var i=r.isAbsolute(t),o="/"===a(t,-1);return t=e(n(t.split("/"),function(t){return!!t}),!i).join("/"),t||i||(t="."),t&&o&&(t+="/"),(i?"/":"")+t},r.isAbsolute=function(t){return"/"===t.charAt(0)},r.join=function(){var t=Array.prototype.slice.call(arguments,0);return r.normalize(n(t,function(t,e){if("string"!=typeof t)throw new TypeError("Arguments to path.join must be strings");return t}).join("/"))},r.relative=function(t,e){function n(t){for(var e=0;e<t.length&&""===t[e];e++);for(var r=t.length-1;r>=0&&""===t[r];r--);return e>r?[]:t.slice(e,r-e+1)}t=r.resolve(t).substr(1),e=r.resolve(e).substr(1);for(var i=n(t.split("/")),o=n(e.split("/")),a=Math.min(i.length,o.length),s=a,l=0;a>l;l++)if(i[l]!==o[l]){s=l;break}for(var u=[],l=s;l<i.length;l++)u.push("..");return u=u.concat(o.slice(s)),u.join("/")},r.sep="/",r.delimiter=":",r.dirname=function(t){var e=o(t),r=e[0],n=e[1];return r||n?(n&&(n=n.substr(0,n.length-1)),r+n):"."},r.basename=function(t,e){var r=o(t)[2];return e&&r.substr(-1*e.length)===e&&(r=r.substr(0,r.length-e.length)),r},r.extname=function(t){return o(t)[3]};var a="b"==="ab".substr(-1)?function(t,e,r){return t.substr(e,r)}:function(t,e,r){return 0>e&&(e=t.length+e),t.substr(e,r)}}).call(this,t("_process"))},{_process:60}],60:[function(t,e,r){function n(){c=!1,s.length?u=s.concat(u):h=-1,u.length&&i()}function i(){if(!c){var t=setTimeout(n);c=!0;for(var e=u.length;e;){for(s=u,u=[];++h<e;)s&&s[h].run();h=-1,e=u.length}s=null,c=!1,clearTimeout(t)}}function o(t,e){this.fun=t,this.array=e}function a(){}var s,l=e.exports={},u=[],c=!1,h=-1;l.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];u.push(new o(t,e)),1!==u.length||c||setTimeout(i,0)},o.prototype.run=function(){this.fun.apply(null,this.array)},l.title="browser",l.browser=!0,l.env={},l.argv=[],l.version="",l.versions={},l.on=a,l.addListener=a,l.once=a,l.off=a,l.removeListener=a,l.removeAllListeners=a,l.emit=a,l.binding=function(t){throw new Error("process.binding is not supported")},l.cwd=function(){return"/"},l.chdir=function(t){throw new Error("process.chdir is not supported")},l.umask=function(){return 0}},{}],61:[function(t,e,r){e.exports=function(t){return t&&"object"==typeof t&&"function"==typeof t.copy&&"function"==typeof t.fill&&"function"==typeof t.readUInt8}},{}],62:[function(t,e,r){(function(e,n){function i(t,e){var n={seen:[],stylize:a};return arguments.length>=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),v(e)?n.showHidden=e:e&&r._extend(n,e),_(n.showHidden)&&(n.showHidden=!1),_(n.depth)&&(n.depth=2),_(n.colors)&&(n.colors=!1),_(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=o),l(n,t,n.depth)}function o(t,e){var r=i.styles[e];return r?"["+i.colors[r][0]+"m"+t+"["+i.colors[r][1]+"m":t}function a(t,e){return t}function s(t){var e={};return t.forEach(function(t,r){e[t]=!0}),e}function l(t,e,n){if(t.customInspect&&e&&T(e.inspect)&&e.inspect!==r.inspect&&(!e.constructor||e.constructor.prototype!==e)){var i=e.inspect(n,t);return b(i)||(i=l(t,i,n)),i}var o=u(t,e);if(o)return o;var a=Object.keys(e),v=s(a);if(t.showHidden&&(a=Object.getOwnPropertyNames(e)),A(e)&&(a.indexOf("message")>=0||a.indexOf("description")>=0))return c(e);if(0===a.length){if(T(e)){var m=e.name?": "+e.name:"";return t.stylize("[Function"+m+"]","special")}if(w(e))return t.stylize(RegExp.prototype.toString.call(e),"regexp");if(k(e))return t.stylize(Date.prototype.toString.call(e),"date");if(A(e))return c(e)}var g="",y=!1,x=["{","}"];if(p(e)&&(y=!0,x=["[","]"]),T(e)){var _=e.name?": "+e.name:"";g=" [Function"+_+"]"}if(w(e)&&(g=" "+RegExp.prototype.toString.call(e)),k(e)&&(g=" "+Date.prototype.toUTCString.call(e)),A(e)&&(g=" "+c(e)),0===a.length&&(!y||0==e.length))return x[0]+g+x[1];if(0>n)return w(e)?t.stylize(RegExp.prototype.toString.call(e),"regexp"):t.stylize("[Object]","special");t.seen.push(e);var M;return M=y?h(t,e,n,v,a):a.map(function(r){return f(t,e,n,v,r,y)}),t.seen.pop(),d(M,g,x)}function u(t,e){if(_(e))return t.stylize("undefined","undefined");if(b(e)){var r="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(r,"string")}return y(e)?t.stylize(""+e,"number"):v(e)?t.stylize(""+e,"boolean"):m(e)?t.stylize("null","null"):void 0}function c(t){return"["+Error.prototype.toString.call(t)+"]"}function h(t,e,r,n,i){for(var o=[],a=0,s=e.length;s>a;++a)I(e,String(a))?o.push(f(t,e,r,n,String(a),!0)):o.push("");return i.forEach(function(i){i.match(/^\d+$/)||o.push(f(t,e,r,n,i,!0))}),o}function f(t,e,r,n,i,o){var a,s,u;if(u=Object.getOwnPropertyDescriptor(e,i)||{value:e[i]},u.get?s=u.set?t.stylize("[Getter/Setter]","special"):t.stylize("[Getter]","special"):u.set&&(s=t.stylize("[Setter]","special")),I(n,i)||(a="["+i+"]"),s||(t.seen.indexOf(u.value)<0?(s=m(r)?l(t,u.value,null):l(t,u.value,r-1),s.indexOf("\n")>-1&&(s=o?s.split("\n").map(function(t){return"  "+t}).join("\n").substr(2):"\n"+s.split("\n").map(function(t){return"   "+t}).join("\n"))):s=t.stylize("[Circular]","special")),_(a)){if(o&&i.match(/^\d+$/))return s;a=JSON.stringify(""+i),a.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(a=a.substr(1,a.length-2),a=t.stylize(a,"name")):(a=a.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),a=t.stylize(a,"string"))}return a+": "+s}function d(t,e,r){var n=0,i=t.reduce(function(t,e){return n++,e.indexOf("\n")>=0&&n++,t+e.replace(/\u001b\[\d\d?m/g,"").length+1},0);return i>60?r[0]+(""===e?"":e+"\n ")+" "+t.join(",\n  ")+" "+r[1]:r[0]+e+" "+t.join(", ")+" "+r[1]}function p(t){return Array.isArray(t)}function v(t){return"boolean"==typeof t}function m(t){return null===t}function g(t){return null==t}function y(t){return"number"==typeof t}function b(t){return"string"==typeof t}function x(t){return"symbol"==typeof t}function _(t){return void 0===t}function w(t){return M(t)&&"[object RegExp]"===S(t)}function M(t){return"object"==typeof t&&null!==t}function k(t){return M(t)&&"[object Date]"===S(t)}function A(t){return M(t)&&("[object Error]"===S(t)||t instanceof Error)}function T(t){return"function"==typeof t}function E(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||"undefined"==typeof t}function S(t){return Object.prototype.toString.call(t)}function L(t){return 10>t?"0"+t.toString(10):t.toString(10)}function z(){var t=new Date,e=[L(t.getHours()),L(t.getMinutes()),L(t.getSeconds())].join(":");return[t.getDate(),D[t.getMonth()],e].join(" ")}function I(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var P=/%[sdj%]/g;r.format=function(t){if(!b(t)){for(var e=[],r=0;r<arguments.length;r++)e.push(i(arguments[r]));return e.join(" ")}for(var r=1,n=arguments,o=n.length,a=String(t).replace(P,function(t){if("%%"===t)return"%";if(r>=o)return t;switch(t){case"%s":return String(n[r++]);case"%d":return Number(n[r++]);case"%j":try{return JSON.stringify(n[r++])}catch(e){return"[Circular]"}default:return t}}),s=n[r];o>r;s=n[++r])a+=m(s)||!M(s)?" "+s:" "+i(s);return a},r.deprecate=function(t,i){function o(){if(!a){if(e.throwDeprecation)throw new Error(i);e.traceDeprecation?console.trace(i):console.error(i),a=!0}return t.apply(this,arguments)}if(_(n.process))return function(){return r.deprecate(t,i).apply(this,arguments)};if(e.noDeprecation===!0)return t;var a=!1;return o};var C,R={};r.debuglog=function(t){if(_(C)&&(C=e.env.NODE_DEBUG||""),t=t.toUpperCase(),!R[t])if(new RegExp("\\b"+t+"\\b","i").test(C)){var n=e.pid;R[t]=function(){var e=r.format.apply(r,arguments);console.error("%s %d: %s",t,n,e)}}else R[t]=function(){};return R[t]},r.inspect=i,i.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},i.styles={special:"cyan",number:"yellow","boolean":"yellow",undefined:"grey","null":"bold",string:"green",date:"magenta",regexp:"red"},r.isArray=p,r.isBoolean=v,r.isNull=m,r.isNullOrUndefined=g,r.isNumber=y,r.isString=b,r.isSymbol=x,r.isUndefined=_,r.isRegExp=w,r.isObject=M,r.isDate=k,r.isError=A,r.isFunction=T,r.isPrimitive=E,r.isBuffer=t("./support/isBuffer");var D=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];r.log=function(){console.log("%s - %s",z(),r.format.apply(r,arguments))},r.inherits=t("inherits"),r._extend=function(t,e){if(!e||!M(e))return t;for(var r=Object.keys(e),n=r.length;n--;)t[r[n]]=e[r[n]];return t}}).call(this,t("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./support/isBuffer":61,_process:60,inherits:58}],63:[function(t,e,r){"use strict";function n(t){return[Math.min(t[0],t[1]),Math.max(t[0],t[1])]}function i(t,e){return t[0]-e[0]||t[1]-e[1]}function o(t){return t.map(n).sort(i)}function a(t,e,r){return e in t?t[e]:r}function s(t,e,r){Array.isArray(e)?(r=r||{},e=e||[]):(r=e||{},e=[]);var n=!!a(r,"delaunay",!0),i=!!a(r,"interior",!0),s=!!a(r,"exterior",!0),f=!!a(r,"infinity",!1);if(!i&&!s||0===t.length)return[];var d=l(t,e);if(n||i!==s||f){for(var p=u(t.length,o(e)),v=0;v<d.length;++v){var m=d[v];p.addTriangle(m[0],m[1],m[2])}return n&&c(t,p),s?i?f?h(p,0,f):p.cells():h(p,1,f):h(p,-1)}return d}var l=t("./lib/monotone"),u=t("./lib/triangulation"),c=t("./lib/delaunay"),h=t("./lib/filter");e.exports=s},{"./lib/delaunay":64,"./lib/filter":65,"./lib/monotone":66,"./lib/triangulation":67}],64:[function(t,e,r){"use strict";function n(t,e,r,n,i,a){var s=e.opposite(n,i);if(!(0>s)){if(n>i){var l=n;n=i,i=l,l=a,a=s,s=l}e.isConstraint(n,i)||o(t[n],t[i],t[a],t[s])<0&&r.push(n,i)}}function i(t,e){for(var r=[],i=t.length,a=e.stars,s=0;i>s;++s)for(var l=a[s],u=1;u<l.length;u+=2){var c=l[u];if(!(s>c||e.isConstraint(s,c))){for(var h=l[u-1],f=-1,d=1;d<l.length;d+=2)if(l[d-1]===c){f=l[d];break}0>f||o(t[s],t[c],t[h],t[f])<0&&r.push(s,c)}}for(;r.length>0;){for(var c=r.pop(),s=r.pop(),h=-1,f=-1,l=a[s],p=1;p<l.length;p+=2){var v=l[p-1],m=l[p];v===c?f=m:m===c&&(h=v)}0>h||0>f||o(t[s],t[c],t[h],t[f])>=0||(e.flip(s,c),n(t,e,r,h,s,f),n(t,e,r,s,f,h),n(t,e,r,f,c,h),n(t,e,r,c,h,f))}}var o=t("robust-in-sphere")[4];t("binary-search-bounds");e.exports=i},{"binary-search-bounds":68,"robust-in-sphere":69}],65:[function(t,e,r){"use strict";function n(t,e,r,n,i,o,a){this.cells=t,this.neighbor=e,this.flags=n,this.constraint=r,this.active=i,this.next=o,this.boundary=a}function i(t,e){return t[0]-e[0]||t[1]-e[1]||t[2]-e[2]}function o(t,e){for(var r=t.cells(),o=r.length,a=0;o>a;++a){var s=r[a],l=s[0],u=s[1],c=s[2];c>u?l>u&&(s[0]=u,s[1]=c,s[2]=l):l>c&&(s[0]=c,s[1]=l,s[2]=u)}r.sort(i);for(var h=new Array(o),a=0;a<h.length;++a)h[a]=0;var f=[],d=[],p=new Array(3*o),v=new Array(3*o),m=null;e&&(m=[]);for(var g=new n(r,p,v,h,f,d,m),a=0;o>a;++a)for(var s=r[a],y=0;3>y;++y){var l=s[y],u=s[(y+1)%3],b=p[3*a+y]=g.locate(u,l,t.opposite(u,l)),x=v[3*a+y]=t.isConstraint(l,u);0>b&&(x?d.push(a):(f.push(a),h[a]=1),e&&m.push([u,l,-1]))}return g}function a(t,e,r){for(var n=0,i=0;i<t.length;++i)e[i]===r&&(t[n++]=t[i]);return t.length=n,t}function s(t,e,r){var n=o(t,r);if(0===e)return r?n.cells.concat(n.boundary):n.cells;for(var i=1,s=n.active,l=n.next,u=n.flags,c=n.cells,h=n.constraint,f=n.neighbor;s.length>0||l.length>0;){for(;s.length>0;){var d=s.pop();if(u[d]!==-i){u[d]=i;for(var p=(c[d],0);3>p;++p){var v=f[3*d+p];v>=0&&0===u[v]&&(h[3*d+p]?l.push(v):(s.push(v),u[v]=i))}}}var m=l;l=s,s=m,l.length=0,i=-i}var g=a(c,u,e);return r?g.concat(n.boundary):g}var l=t("binary-search-bounds");e.exports=s;var u=n.prototype;u.locate=function(){var t=[0,0,0];return function(e,r,n){var o=e,a=r,s=n;return n>r?e>r&&(o=r,a=n,s=e):e>n&&(o=n,a=e,s=r),0>o?-1:(t[0]=o,t[1]=a,t[2]=s,l.eq(this.cells,t,i))}}()},{"binary-search-bounds":68}],66:[function(t,e,r){"use strict";function n(t,e,r,n,i){this.a=t,this.b=e,this.idx=r,this.lowerIds=n,this.upperIds=i}function i(t,e,r,n){this.a=t,this.b=e,this.type=r,this.idx=n}function o(t,e){var r=t.a[0]-e.a[0]||t.a[1]-e.a[1]||t.type-e.type;return r?r:t.type!==p&&(r=d(t.a,t.b,e.b))?r:t.idx-e.idx}function a(t,e){return d(t.a,t.b,e)}function s(t,e,r,n,i){for(var o=f.lt(e,n,a),s=f.gt(e,n,a),l=o;s>l;++l){for(var u=e[l],c=u.lowerIds,h=c.length;h>1&&d(r[c[h-2]],r[c[h-1]],n)>0;)t.push([c[h-1],c[h-2],i]),h-=1;c.length=h,c.push(i);for(var p=u.upperIds,h=p.length;h>1&&d(r[p[h-2]],r[p[h-1]],n)<0;)t.push([p[h-2],p[h-1],i]),h-=1;p.length=h,p.push(i)}}function l(t,e){var r;return(r=t.a[0]<e.a[0]?d(t.a,t.b,e.a):d(e.b,e.a,t.a))?r:(r=e.b[0]<t.b[0]?d(t.a,t.b,e.b):d(e.b,e.a,t.b),r||t.idx-e.idx)}function u(t,e,r){var i=f.le(t,r,l),o=t[i],a=o.upperIds,s=a[a.length-1];o.upperIds=[s],t.splice(i+1,0,new n(r.a,r.b,r.idx,[s],a))}function c(t,e,r){var n=r.a;r.a=r.b,r.b=n;var i=f.eq(t,r,l),o=t[i],a=t[i-1];a.upperIds=o.upperIds,t.splice(i,1)}function h(t,e){for(var r=t.length,a=e.length,l=[],h=0;r>h;++h)l.push(new i(t[h],null,p,h));for(var h=0;a>h;++h){var f=e[h],d=t[f[0]],g=t[f[1]];d[0]<g[0]?l.push(new i(d,g,m,h),new i(g,d,v,h)):d[0]>g[0]&&l.push(new i(g,d,m,h),new i(d,g,v,h))}l.sort(o);for(var y=l[0].a[0]-(1+Math.abs(l[0].a[0]))*Math.pow(2,-52),b=[new n([y,1],[y,0],-1,[],[],[],[])],x=[],h=0,_=l.length;_>h;++h){var w=l[h],M=w.type;M===p?s(x,b,t,w.a,w.idx):M===m?u(b,t,w):c(b,t,w)}return x}var f=t("binary-search-bounds"),d=t("robust-orientation")[3],p=0,v=1,m=2;e.exports=h},{"binary-search-bounds":68,"robust-orientation":439}],67:[function(t,e,r){"use strict";function n(t,e){this.stars=t,this.edges=e}function i(t,e,r){for(var n=1,i=t.length;i>n;n+=2)if(t[n-1]===e&&t[n]===r)return t[n-1]=t[i-2],t[n]=t[i-1],void(t.length=i-2)}function o(t,e){for(var r=new Array(t),i=0;t>i;++i)r[i]=[];return new n(r,e)}var a=t("binary-search-bounds");e.exports=o;var s=n.prototype;s.isConstraint=function(){function t(t,e){return t[0]-e[0]||t[1]-e[1]}var e=[0,0];return function(r,n){return e[0]=Math.min(r,n),e[1]=Math.max(r,n),a.eq(this.edges,e,t)>=0}}(),s.removeTriangle=function(t,e,r){var n=this.stars;i(n[t],e,r),i(n[e],r,t),i(n[r],t,e)},s.addTriangle=function(t,e,r){var n=this.stars;n[t].push(e,r),n[e].push(r,t),n[r].push(t,e)},s.opposite=function(t,e){for(var r=this.stars[e],n=1,i=r.length;i>n;n+=2)if(r[n]===t)return r[n-1];return-1},s.flip=function(t,e){var r=this.opposite(t,e),n=this.opposite(e,t);this.removeTriangle(t,e,r),this.removeTriangle(e,t,n),this.addTriangle(t,n,r),this.addTriangle(e,r,n)},s.edges=function(){for(var t=this.stars,e=[],r=0,n=t.length;n>r;++r)for(var i=t[r],o=0,a=i.length;a>o;o+=2)e.push([i[o],i[o+1]]);return e},s.cells=function(){for(var t=this.stars,e=[],r=0,n=t.length;n>r;++r)for(var i=t[r],o=0,a=i.length;a>o;o+=2){var s=i[o],l=i[o+1];r<Math.min(s,l)&&e.push([r,s,l])}return e}},{"binary-search-bounds":68}],68:[function(t,e,r){"use strict";function n(t,e,r,n,i){var o=["function ",t,"(a,l,h,",n.join(","),"){",i?"":"var i=",r?"l-1":"h+1",";while(l<=h){var m=(l+h)>>>1,x=a[m]"];return i?e.indexOf("c")<0?o.push(";if(x===y){return m}else if(x<=y){"):o.push(";var p=c(x,y);if(p===0){return m}else if(p<=0){"):o.push(";if(",e,"){i=m;"),r?o.push("l=m+1}else{h=m-1}"):o.push("h=m-1}else{l=m+1}"),o.push("}"),i?o.push("return -1};"):o.push("return i};"),o.join("")}function i(t,e,r,i){var o=new Function([n("A","x"+t+"y",e,["y"],i),n("P","c(x,y)"+t+"0",e,["y","c"],i),"function dispatchBsearch",r,"(a,y,c,l,h){if(typeof(c)==='function'){return P(a,(l===void 0)?0:l|0,(h===void 0)?a.length-1:h|0,y,c)}else{return A(a,(c===void 0)?0:c|0,(l===void 0)?a.length-1:l|0,y)}}return dispatchBsearch",r].join(""));return o()}e.exports={ge:i(">=",!1,"GE"),gt:i(">",!1,"GT"),lt:i("<",!0,"LT"),le:i("<=",!0,"LE"),eq:i("-",!0,"EQ",!0)}},{}],69:[function(t,e,r){"use strict";function n(t,e){for(var r=new Array(t.length-1),n=1;n<t.length;++n)for(var i=r[n-1]=new Array(t.length-1),o=0,a=0;o<t.length;++o)o!==e&&(i[a++]=t[n][o]);return r}function i(t){for(var e=new Array(t),r=0;t>r;++r){e[r]=new Array(t);for(var n=0;t>n;++n)e[r][n]=["m",n,"[",t-r-2,"]"].join("")}return e}function o(t){if(1===t.length)return t[0];if(2===t.length)return["sum(",t[0],",",t[1],")"].join("");var e=t.length>>1;return["sum(",o(t.slice(0,e)),",",o(t.slice(e)),")"].join("")}function a(t,e){if("m"===t.charAt(0)){if("w"===e.charAt(0)){var r=t.split("[");return["w",e.substr(1),"m",r[0].substr(1)].join("")}return["prod(",t,",",e,")"].join("")}return a(e,t)}function s(t){return t&!0?"-":""}function l(t){if(2===t.length)return[["diff(",a(t[0][0],t[1][1]),",",a(t[1][0],t[0][1]),")"].join("")];for(var e=[],r=0;r<t.length;++r)e.push(["scale(",o(l(n(t,r))),",",s(r),t[0][r],")"].join(""));return e}function u(t,e){for(var r=[],n=0;e-2>n;++n)r.push(["prod(m",t,"[",n,"],m",t,"[",n,"])"].join(""));return o(r)}function c(t){for(var e=[],r=[],a=i(t),s=0;t>s;++s)a[0][s]="1",a[t-1][s]="w"+s;for(var s=0;t>s;++s)0===(1&s)?e.push.apply(e,l(n(a,s))):r.push.apply(r,l(n(a,s)));for(var c=o(e),h=o(r),f="exactInSphere"+t,d=[],s=0;t>s;++s)d.push("m"+s);for(var p=["function ",f,"(",d.join(),"){"],s=0;t>s;++s){p.push("var w",s,"=",u(s,t),";");for(var v=0;t>v;++v)v!==s&&p.push("var w",s,"m",v,"=scale(w",s,",m",v,"[0]);")}p.push("var p=",c,",n=",h,",d=diff(p,n);return d[d.length-1];}return ",f);var x=new Function("sum","diff","prod","scale",p.join(""));return x(g,y,m,b)}function h(){return 0}function f(){return 0}function d(){return 0}function p(t){var e=_[t.length];return e||(e=_[t.length]=c(t.length)),e.apply(void 0,t)}function v(){for(;_.length<=x;)_.push(c(_.length));for(var t=[],r=["slow"],n=0;x>=n;++n)t.push("a"+n),r.push("o"+n);for(var i=["function testInSphere(",t.join(),"){switch(arguments.length){case 0:case 1:return 0;"],n=2;x>=n;++n)i.push("case ",n,":return o",n,"(",t.slice(0,n).join(),");");i.push("}var s=new Array(arguments.length);for(var i=0;i<arguments.length;++i){s[i]=arguments[i]};return slow(s);}return testInSphere"),r.push(i.join(""));var o=Function.apply(void 0,r);e.exports=o.apply(void 0,[p].concat(_));for(var n=0;x>=n;++n)e.exports[n]=_[n]}var m=t("two-product"),g=t("robust-sum"),y=t("robust-subtract"),b=t("robust-scale"),x=6,_=[h,f,d];v()},{"robust-scale":440,"robust-subtract":441,"robust-sum":442,"two-product":456}],70:[function(t,e,r){"use strict";function n(t){var e=x(t),r=b(y(e),t);return 0>r?[e,w(e,1/0)]:r>0?[w(e,-(1/0)),e]:[e,e]}function i(t,e){for(var r=new Array(e.length),n=0;n<e.length;++n){var i=e[n],o=t[i[0]],a=t[i[1]];r[n]=[Math.min(o[0],a[0]),Math.min(o[1],a[1]),Math.max(o[0],a[0]),Math.max(o[1],a[1])]}return r}function o(t){for(var e=new Array(t.length),r=0;r<t.length;++r){var n=t[r];e[r]=[n[0],n[1],n[0],n[1]]}return e}function a(t,e,r){var n=[];return m(r,function(r,i){var o=e[r],a=e[i];if(o[0]!==a[0]&&o[0]!==a[1]&&o[1]!==a[0]&&o[1]!==a[1]){var s=t[o[0]],l=t[o[1]],u=t[a[0]],c=t[a[1]];g(s,l,u,c)&&n.push([r,i])}}),n}function s(t,e,r,n){var i=[];return m(r,n,function(r,n){var o=e[r];if(o[0]!==n&&o[1]!==n){var a=t[n],s=t[o[0]],l=t[o[1]];g(s,l,a,a)&&i.push([r,n])}}),i}function l(t,e,r,n,i){function o(e){if(e>=t.length)return a[e-t.length];var r=t[e];return[y(r[0]),y(r[1])]}for(var a=[],s=0;s<r.length;++s){var l=r[s],u=l[0],c=l[1],h=e[u],f=e[c],d=M(_(t[h[0]]),_(t[h[1]]),_(t[f[0]]),_(t[f[1]]));if(d){var p=a.length+t.length;a.push(d),n.push([u,p],[c,p])}}n.sort(function(t,e){if(t[0]!==e[0])return t[0]-e[0];var r=o(t[1]),n=o(e[1]);return b(r[0],n[0])||b(r[1],n[1])});for(var s=n.length-1;s>=0;--s){var v=n[s],u=v[0],m=e[u],g=m[0],x=m[1],w=t[g],k=t[x];if((w[0]-k[0]||w[1]-k[1])<0){var A=g;g=x,x=A}m[0]=g;var T,E=m[1]=v[1];for(i&&(T=m[2]);s>0&&n[s-1][0]===u;){var v=n[--s],S=v[1];i?e.push([E,S,T]):e.push([E,S]),E=S}i?e.push([E,x,T]):e.push([E,x])}return a}function u(t,e,r){for(var i=t.length+e.length,o=new v(i),a=r,s=0;s<e.length;++s){var l=e[s],u=n(l[0]),c=n(l[1]);a.push([u[0],c[0],u[1],c[1]]),t.push([x(l[0]),x(l[1])])}m(a,function(t,e){o.link(t,e)});for(var h=0,f=!0,d=new Array(i),s=0;i>s;++s){var p=o.find(s);p===s?(d[s]=h,t[h++]=t[s]):(f=!1,d[s]=-1)}if(t.length=h,f)return null;for(var s=0;i>s;++s)d[s]<0&&(d[s]=d[o.find(s)]);return d}function c(t,e){return t[0]-e[0]||t[1]-e[1]}function h(t,e){var r=t[0]-e[0]||t[1]-e[1];return r?r:t[2]<e[2]?-1:t[2]>e[2]?1:0}function f(t,e,r){if(0!==t.length){if(e)for(var n=0;n<t.length;++n){var i=t[n],o=e[i[0]],a=e[i[1]];i[0]=Math.min(o,a),i[1]=Math.max(o,a)}else for(var n=0;n<t.length;++n){var i=t[n],o=i[0],a=i[1];i[0]=Math.min(o,a),i[1]=Math.max(o,a)}r?t.sort(h):t.sort(c);for(var s=1,n=1;n<t.length;++n){var l=t[n-1],u=t[n];(u[0]!==l[0]||u[1]!==l[1]||r&&u[2]!==l[2])&&(t[s++]=u)}t.length=s}}function d(t,e,r){var n=i(t,e),c=a(t,e,n),h=o(t),d=s(t,e,n,h),p=l(t,e,c,d,r),v=u(t,p,h);return f(e,v,r),v?!0:c.length>0||d.length>0}function p(t,e,r){var n,i=!1;if(r){n=e;for(var o=new Array(e.length),a=0;a<e.length;++a){var s=e[a];o[a]=[s[0],s[1],r[a]]}e=o}for(;d(t,e,!!r);)i=!0;if(r&&i){n.length=0,r.length=0;for(var a=0;a<e.length;++a){var s=e[a];n.push([s[0],s[1]]),r.push(s[2])}}return i}e.exports=p;var v=t("union-find"),m=t("box-intersect"),g=(t("compare-cell"),t("robust-segment-intersect")),y=t("big-rat"),b=t("big-rat/cmp"),x=t("big-rat/to-float"),_=t("rat-vec"),w=t("nextafter"),M=t("./lib/rat-seg-intersect");
},{"./lib/rat-seg-intersect":71,"big-rat":75,"big-rat/cmp":73,"big-rat/to-float":88,"box-intersect":89,"compare-cell":107,nextafter:97,"rat-vec":99,"robust-segment-intersect":102,"union-find":103}],71:[function(t,e,r){"use strict";function n(t,e){return s(o(t[0],e[1]),o(t[1],e[0]))}function i(t,e,r,i){var o=u(e,t),s=u(i,r),f=n(o,s);if(0===l(f))return null;var d=u(t,r),p=n(s,d),v=a(p,f);return c(t,h(o,v))}e.exports=i;var o=t("big-rat/mul"),a=t("big-rat/div"),s=t("big-rat/sub"),l=t("big-rat/sign"),u=t("rat-vec/sub"),c=t("rat-vec/add"),h=t("rat-vec/muls");t("big-rat/to-float")},{"big-rat/div":74,"big-rat/mul":84,"big-rat/sign":86,"big-rat/sub":87,"big-rat/to-float":88,"rat-vec/add":98,"rat-vec/muls":100,"rat-vec/sub":101}],72:[function(t,e,r){"use strict";function n(t,e){return i(t[0].mul(e[1]).add(e[0].mul(t[1])),t[1].mul(e[1]))}var i=t("./lib/rationalize");e.exports=n},{"./lib/rationalize":82}],73:[function(t,e,r){"use strict";function n(t,e){return t[0].mul(e[1]).cmp(e[0].mul(t[1]))}e.exports=n},{}],74:[function(t,e,r){"use strict";function n(t,e){return i(t[0].mul(e[1]),t[1].mul(e[0]))}var i=t("./lib/rationalize");e.exports=n},{"./lib/rationalize":82}],75:[function(t,e,r){"use strict";function n(t,e){if(i(t))return e?u(t,n(e)):[t[0].clone(),t[1].clone()];var r,c,h=0;if(o(t))r=t.clone();else if("string"==typeof t)r=s(t);else{if(0===t)return[a(0),a(1)];if(t===Math.floor(t))r=a(t);else{for(;t!==Math.floor(t);)t*=Math.pow(2,256),h-=256;r=a(t)}}if(i(e))r.mul(e[1]),c=e[0].clone();else if(o(e))c=e.clone();else if("string"==typeof e)c=s(e);else if(e)if(e===Math.floor(e))c=a(e);else{for(;e!==Math.floor(e);)e*=Math.pow(2,256),h+=256;c=a(e)}else c=a(1);return h>0?r=r.shln(h):0>h&&(c=c.shln(-h)),l(r,c)}var i=t("./is-rat"),o=t("./lib/is-bn"),a=t("./lib/num-to-bn"),s=t("./lib/str-to-bn"),l=t("./lib/rationalize"),u=t("./div");e.exports=n},{"./div":74,"./is-rat":76,"./lib/is-bn":80,"./lib/num-to-bn":81,"./lib/rationalize":82,"./lib/str-to-bn":83}],76:[function(t,e,r){"use strict";function n(t){return Array.isArray(t)&&2===t.length&&i(t[0])&&i(t[1])}var i=t("./lib/is-bn");e.exports=n},{"./lib/is-bn":80}],77:[function(t,e,r){"use strict";function n(t){return t.cmp(new i(0))}var i=t("bn.js");e.exports=n},{"bn.js":85}],78:[function(t,e,r){"use strict";function n(t){var e=t.length,r=t.words,n=0;if(1===e)n=r[0];else if(2===e)n=r[0]+67108864*r[1];else for(var n=0,i=0;e>i;i++){var o=r[i];n+=o*Math.pow(67108864,i)}return t.sign?-n:n}e.exports=n},{}],79:[function(t,e,r){"use strict";function n(t){var e=o(i.lo(t));if(32>e)return e;var r=o(i.hi(t));return r>20?52:r+32}var i=t("double-bits"),o=t("bit-twiddle").countTrailingZeros;e.exports=n},{"bit-twiddle":51,"double-bits":96}],80:[function(t,e,r){"use strict";function n(t){return t&&"object"==typeof t&&Boolean(t.words)}t("bn.js");e.exports=n},{"bn.js":85}],81:[function(t,e,r){"use strict";function n(t){var e=o.exponent(t);return 52>e?new i(t):new i(t*Math.pow(2,52-e)).shln(e-52)}var i=t("bn.js"),o=t("double-bits");e.exports=n},{"bn.js":85,"double-bits":96}],82:[function(t,e,r){"use strict";function n(t,e){var r=o(t),n=o(e);if(0===r)return[i(0),i(1)];if(0===n)return[i(0),i(0)];0>n&&(t=t.neg(),e=e.neg());var a=t.gcd(e);return a.cmpn(1)?[t.div(a),e.div(a)]:[t,e]}var i=t("./num-to-bn"),o=t("./bn-sign");e.exports=n},{"./bn-sign":77,"./num-to-bn":81}],83:[function(t,e,r){"use strict";function n(t){return new i(t)}var i=t("bn.js");e.exports=n},{"bn.js":85}],84:[function(t,e,r){"use strict";function n(t,e){return i(t[0].mul(e[0]),t[1].mul(e[1]))}var i=t("./lib/rationalize");e.exports=n},{"./lib/rationalize":82}],85:[function(t,e,r){!function(t,e){"use strict";function r(t,e){if(!t)throw new Error(e||"Assertion failed")}function n(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function i(t,e,r){return null!==t&&"object"==typeof t&&Array.isArray(t.words)?t:(this.sign=!1,this.words=null,this.length=0,this.red=null,"le"!==e&&"be"!==e||(r=e,e=10),void(null!==t&&this._init(t||0,e||10,r||"be")))}function o(t,e,r){for(var n=0,i=Math.min(t.length,r),o=e;i>o;o++){var a=t.charCodeAt(o)-48;n<<=4,n|=a>=49&&54>=a?a-49+10:a>=17&&22>=a?a-17+10:15&a}return n}function a(t,e,r,n){for(var i=0,o=Math.min(t.length,r),a=e;o>a;a++){var s=t.charCodeAt(a)-48;i*=n,i+=s>=49?s-49+10:s>=17?s-17+10:s}return i}function s(t,e){this.name=t,this.p=new i(e,16),this.n=this.p.bitLength(),this.k=new i(1).ishln(this.n).isub(this.p),this.tmp=this._tmp()}function l(){s.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function u(){s.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function c(){s.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function h(){s.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function f(t){if("string"==typeof t){var e=i._prime(t);this.m=e.p,this.prime=e}else this.m=t,this.prime=null}function d(t){f.call(this,t),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new i(1).ishln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv.sign=!0,this.minv=this.minv.mod(this.r)}"object"==typeof t?t.exports=i:e.BN=i,i.BN=i,i.wordSize=26,i.prototype._init=function(t,e,n){if("number"==typeof t)return this._initNumber(t,e,n);if("object"==typeof t)return this._initArray(t,e,n);"hex"===e&&(e=16),r(e===(0|e)&&e>=2&&36>=e),t=t.toString().replace(/\s+/g,"");var i=0;"-"===t[0]&&i++,16===e?this._parseHex(t,i):this._parseBase(t,e,i),"-"===t[0]&&(this.sign=!0),this.strip(),"le"===n&&this._initArray(this.toArray(),e,n)},i.prototype._initNumber=function(t,e,n){0>t&&(this.sign=!0,t=-t),67108864>t?(this.words=[67108863&t],this.length=1):4503599627370496>t?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(r(9007199254740992>t),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===n&&this._initArray(this.toArray(),e,n)},i.prototype._initArray=function(t,e,n){if(r("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var o=0;if("be"===n)for(var i=t.length-1,a=0;i>=0;i-=3){var s=t[i]|t[i-1]<<8|t[i-2]<<16;this.words[a]|=s<<o&67108863,this.words[a+1]=s>>>26-o&67108863,o+=24,o>=26&&(o-=26,a++)}else if("le"===n)for(var i=0,a=0;i<t.length;i+=3){var s=t[i]|t[i+1]<<8|t[i+2]<<16;this.words[a]|=s<<o&67108863,this.words[a+1]=s>>>26-o&67108863,o+=24,o>=26&&(o-=26,a++)}return this.strip()},i.prototype._parseHex=function(t,e){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r<this.length;r++)this.words[r]=0;for(var n=0,r=t.length-6,i=0;r>=e;r-=6){var a=o(t,r,r+6);this.words[i]|=a<<n&67108863,this.words[i+1]|=a>>>26-n&4194303,n+=24,n>=26&&(n-=26,i++)}if(r+6!==e){var a=o(t,e,r+6);this.words[i]|=a<<n&67108863,this.words[i+1]|=a>>>26-n&4194303}this.strip()},i.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var n=0,i=1;67108863>=i;i*=e)n++;n--,i=i/e|0;for(var o=t.length-r,s=o%n,l=Math.min(o,o-s)+r,u=0,c=r;l>c;c+=n)u=a(t,c,c+n,e),this.imuln(i),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==s){for(var h=1,u=a(t,c,t.length,e),c=0;s>c;c++)h*=e;this.imuln(h),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}},i.prototype.copy=function(t){t.words=new Array(this.length);for(var e=0;e<this.length;e++)t.words[e]=this.words[e];t.length=this.length,t.sign=this.sign,t.red=this.red},i.prototype.clone=function(){var t=new i(null);return this.copy(t),t},i.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},i.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.sign=!1),this},i.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var p=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],v=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],m=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];i.prototype.toString=function(t,e){if(t=t||10,16===t||"hex"===t){for(var n="",i=0,e=0|e||1,o=0,a=0;a<this.length;a++){var s=this.words[a],l=(16777215&(s<<i|o)).toString(16);o=s>>>24-i&16777215,n=0!==o||a!==this.length-1?p[6-l.length]+l+n:l+n,i+=2,i>=26&&(i-=26,a--)}for(0!==o&&(n=o.toString(16)+n);n.length%e!==0;)n="0"+n;return this.sign&&(n="-"+n),n}if(t===(0|t)&&t>=2&&36>=t){var u=v[t],c=m[t],n="",h=this.clone();for(h.sign=!1;0!==h.cmpn(0);){var f=h.modn(c).toString(t);h=h.idivn(c),n=0!==h.cmpn(0)?p[u-f.length]+f+n:f+n}return 0===this.cmpn(0)&&(n="0"+n),this.sign&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},i.prototype.toJSON=function(){return this.toString(16)},i.prototype.toArray=function(t){this.strip();var e=new Array(this.byteLength());e[0]=0;var r=this.clone();if("le"!==t)for(var n=0;0!==r.cmpn(0);n++){var i=r.andln(255);r.ishrn(8),e[e.length-n-1]=i}else for(var n=0;0!==r.cmpn(0);n++){var i=r.andln(255);r.ishrn(8),e[n]=i}return e},Math.clz32?i.prototype._countBits=function(t){return 32-Math.clz32(t)}:i.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},i.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0===(8191&e)&&(r+=13,e>>>=13),0===(127&e)&&(r+=7,e>>>=7),0===(15&e)&&(r+=4,e>>>=4),0===(3&e)&&(r+=2,e>>>=2),0===(1&e)&&r++,r},i.prototype.bitLength=function(){var t=0,e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},i.prototype.zeroBits=function(){if(0===this.cmpn(0))return 0;for(var t=0,e=0;e<this.length;e++){var r=this._zeroBits(this.words[e]);if(t+=r,26!==r)break}return t},i.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},i.prototype.neg=function(){if(0===this.cmpn(0))return this.clone();var t=this.clone();return t.sign=!this.sign,t},i.prototype.ior=function(t){for(this.sign=this.sign||t.sign;this.length<t.length;)this.words[this.length++]=0;for(var e=0;e<t.length;e++)this.words[e]=this.words[e]|t.words[e];return this.strip()},i.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},i.prototype.iand=function(t){this.sign=this.sign&&t.sign;var e;e=this.length>t.length?t:this;for(var r=0;r<e.length;r++)this.words[r]=this.words[r]&t.words[r];return this.length=e.length,this.strip()},i.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},i.prototype.ixor=function(t){this.sign=this.sign||t.sign;var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;n<r.length;n++)this.words[n]=e.words[n]^r.words[n];if(this!==e)for(;n<e.length;n++)this.words[n]=e.words[n];return this.length=e.length,this.strip()},i.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},i.prototype.setn=function(t,e){r("number"==typeof t&&t>=0);for(var n=t/26|0,i=t%26;this.length<=n;)this.words[this.length++]=0;return e?this.words[n]=this.words[n]|1<<i:this.words[n]=this.words[n]&~(1<<i),this.strip()},i.prototype.iadd=function(t){if(this.sign&&!t.sign){this.sign=!1;var e=this.isub(t);return this.sign=!this.sign,this._normSign()}if(!this.sign&&t.sign){t.sign=!1;var e=this.isub(t);return t.sign=!0,e._normSign()}var r,n;this.length>t.length?(r=this,n=t):(r=t,n=this);for(var i=0,o=0;o<n.length;o++){var e=r.words[o]+n.words[o]+i;this.words[o]=67108863&e,i=e>>>26}for(;0!==i&&o<r.length;o++){var e=r.words[o]+i;this.words[o]=67108863&e,i=e>>>26}if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this},i.prototype.add=function(t){if(t.sign&&!this.sign){t.sign=!1;var e=this.sub(t);return t.sign=!0,e}if(!t.sign&&this.sign){this.sign=!1;var e=t.sub(this);return this.sign=!0,e}return this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},i.prototype.isub=function(t){if(t.sign){t.sign=!1;var e=this.iadd(t);return t.sign=!0,e._normSign()}if(this.sign)return this.sign=!1,this.iadd(t),this.sign=!0,this._normSign();var r=this.cmp(t);if(0===r)return this.sign=!1,this.length=1,this.words[0]=0,this;var n,i;r>0?(n=this,i=t):(n=t,i=this);for(var o=0,a=0;a<i.length;a++){var e=n.words[a]-i.words[a]+o;o=e>>26,this.words[a]=67108863&e}for(;0!==o&&a<n.length;a++){var e=n.words[a]+o;o=e>>26,this.words[a]=67108863&e}if(0===o&&a<n.length&&n!==this)for(;a<n.length;a++)this.words[a]=n.words[a];return this.length=Math.max(this.length,a),n!==this&&(this.sign=!0),this.strip()},i.prototype.sub=function(t){return this.clone().isub(t)},i.prototype._smallMulTo=function(t,e){e.sign=t.sign!==this.sign,e.length=this.length+t.length;for(var r=0,n=0;n<e.length-1;n++){for(var i=r>>>26,o=67108863&r,a=Math.min(n,t.length-1),s=Math.max(0,n-this.length+1);a>=s;s++){var l=n-s,u=0|this.words[l],c=0|t.words[s],h=u*c,f=67108863&h;i=i+(h/67108864|0)|0,f=f+o|0,o=67108863&f,i=i+(f>>>26)|0}e.words[n]=o,r=i}return 0!==r?e.words[n]=r:e.length--,e.strip()},i.prototype._bigMulTo=function(t,e){e.sign=t.sign!==this.sign,e.length=this.length+t.length;for(var r=0,n=0,i=0;i<e.length-1;i++){var o=n;n=0;for(var a=67108863&r,s=Math.min(i,t.length-1),l=Math.max(0,i-this.length+1);s>=l;l++){var u=i-l,c=0|this.words[u],h=0|t.words[l],f=c*h,d=67108863&f;o=o+(f/67108864|0)|0,d=d+a|0,a=67108863&d,o=o+(d>>>26)|0,n+=o>>>26,o&=67108863}e.words[i]=a,r=o,o=n}return 0!==r?e.words[i]=r:e.length--,e.strip()},i.prototype.mulTo=function(t,e){var r;return r=this.length+t.length<63?this._smallMulTo(t,e):this._bigMulTo(t,e)},i.prototype.mul=function(t){var e=new i(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},i.prototype.imul=function(t){if(0===this.cmpn(0)||0===t.cmpn(0))return this.words[0]=0,this.length=1,this;var e=this.length,r=t.length;this.sign=t.sign!==this.sign,this.length=this.length+t.length,this.words[this.length-1]=0;for(var n=this.length-2;n>=0;n--){for(var i=0,o=0,a=Math.min(n,r-1),s=Math.max(0,n-e+1);a>=s;s++){var l=n-s,u=this.words[l],c=t.words[s],h=u*c,f=67108863&h;i+=h/67108864|0,f+=o,o=67108863&f,i+=f>>>26}this.words[n]=o,this.words[n+1]+=i,i=0}for(var i=0,l=1;l<this.length;l++){var d=this.words[l]+i;this.words[l]=67108863&d,i=d>>>26}return this.strip()},i.prototype.imuln=function(t){r("number"==typeof t);for(var e=0,n=0;n<this.length;n++){var i=this.words[n]*t,o=(67108863&i)+(67108863&e);e>>=26,e+=i/67108864|0,e+=o>>>26,this.words[n]=67108863&o}return 0!==e&&(this.words[n]=e,this.length++),this},i.prototype.muln=function(t){return this.clone().imuln(t)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.mul(this)},i.prototype.ishln=function(t){r("number"==typeof t&&t>=0);var e=t%26,n=(t-e)/26,i=67108863>>>26-e<<26-e;if(0!==e){for(var o=0,a=0;a<this.length;a++){var s=this.words[a]&i,l=this.words[a]-s<<e;this.words[a]=l|o,o=s>>>26-e}o&&(this.words[a]=o,this.length++)}if(0!==n){for(var a=this.length-1;a>=0;a--)this.words[a+n]=this.words[a];for(var a=0;n>a;a++)this.words[a]=0;this.length+=n}return this.strip()},i.prototype.ishrn=function(t,e,n){r("number"==typeof t&&t>=0);var i;i=e?(e-e%26)/26:0;var o=t%26,a=Math.min((t-o)/26,this.length),s=67108863^67108863>>>o<<o,l=n;if(i-=a,i=Math.max(0,i),l){for(var u=0;a>u;u++)l.words[u]=this.words[u];l.length=a}if(0===a);else if(this.length>a){this.length-=a;for(var u=0;u<this.length;u++)this.words[u]=this.words[u+a]}else this.words[0]=0,this.length=1;for(var c=0,u=this.length-1;u>=0&&(0!==c||u>=i);u--){var h=this.words[u];this.words[u]=c<<26-o|h>>>o,c=h&s}return l&&0!==c&&(l.words[l.length++]=c),0===this.length&&(this.words[0]=0,this.length=1),this.strip(),this},i.prototype.shln=function(t){return this.clone().ishln(t)},i.prototype.shrn=function(t){return this.clone().ishrn(t)},i.prototype.testn=function(t){r("number"==typeof t&&t>=0);var e=t%26,n=(t-e)/26,i=1<<e;if(this.length<=n)return!1;var o=this.words[n];return!!(o&i)},i.prototype.imaskn=function(t){r("number"==typeof t&&t>=0);var e=t%26,n=(t-e)/26;if(r(!this.sign,"imaskn works only with positive numbers"),0!==e&&n++,this.length=Math.min(n,this.length),0!==e){var i=67108863^67108863>>>e<<e;this.words[this.length-1]&=i}return this.strip()},i.prototype.maskn=function(t){return this.clone().imaskn(t)},i.prototype.iaddn=function(t){return r("number"==typeof t),0>t?this.isubn(-t):this.sign?1===this.length&&this.words[0]<t?(this.words[0]=t-this.words[0],this.sign=!1,this):(this.sign=!1,this.isubn(t),this.sign=!0,this):this._iaddn(t)},i.prototype._iaddn=function(t){this.words[0]+=t;for(var e=0;e<this.length&&this.words[e]>=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},i.prototype.isubn=function(t){if(r("number"==typeof t),0>t)return this.iaddn(-t);if(this.sign)return this.sign=!1,this.iaddn(t),this.sign=!0,this;this.words[0]-=t;for(var e=0;e<this.length&&this.words[e]<0;e++)this.words[e]+=67108864,this.words[e+1]-=1;return this.strip()},i.prototype.addn=function(t){return this.clone().iaddn(t)},i.prototype.subn=function(t){return this.clone().isubn(t)},i.prototype.iabs=function(){return this.sign=!1,this},i.prototype.abs=function(){return this.clone().iabs()},i.prototype._ishlnsubmul=function(t,e,n){var i,o=t.length+n;if(this.words.length<o){for(var a=new Array(o),i=0;i<this.length;i++)a[i]=this.words[i];this.words=a}else i=this.length;for(this.length=Math.max(this.length,o);i<this.length;i++)this.words[i]=0;for(var s=0,i=0;i<t.length;i++){var l=this.words[i+n]+s,u=t.words[i]*e;l-=67108863&u,s=(l>>26)-(u/67108864|0),this.words[i+n]=67108863&l}for(;i<this.length-n;i++){var l=this.words[i+n]+s;s=l>>26,this.words[i+n]=67108863&l}if(0===s)return this.strip();r(-1===s),s=0;for(var i=0;i<this.length;i++){var l=-this.words[i]+s;s=l>>26,this.words[i]=67108863&l}return this.sign=!0,this.strip()},i.prototype._wordDiv=function(t,e){var r=this.length-t.length,n=this.clone(),o=t,a=o.words[o.length-1],s=this._countBits(a);r=26-s,0!==r&&(o=o.shln(r),n.ishln(r),a=o.words[o.length-1]);var l,u=n.length-o.length;if("mod"!==e){l=new i(null),l.length=u+1,l.words=new Array(l.length);for(var c=0;c<l.length;c++)l.words[c]=0}var h=n.clone()._ishlnsubmul(o,1,u);h.sign||(n=h,l&&(l.words[u]=1));for(var f=u-1;f>=0;f--){var d=67108864*n.words[o.length+f]+n.words[o.length+f-1];for(d=Math.min(d/a|0,67108863),n._ishlnsubmul(o,d,f);n.sign;)d--,n.sign=!1,n._ishlnsubmul(o,1,f),0!==n.cmpn(0)&&(n.sign=!n.sign);l&&(l.words[f]=d)}return l&&l.strip(),n.strip(),"div"!==e&&0!==r&&n.ishrn(r),{div:l?l:null,mod:n}},i.prototype.divmod=function(t,e){if(r(0!==t.cmpn(0)),this.sign&&!t.sign){var n,o,a=this.neg().divmod(t,e);return"mod"!==e&&(n=a.div.neg()),"div"!==e&&(o=0===a.mod.cmpn(0)?a.mod:t.sub(a.mod)),{div:n,mod:o}}if(!this.sign&&t.sign){var n,a=this.divmod(t.neg(),e);return"mod"!==e&&(n=a.div.neg()),{div:n,mod:a.mod}}return this.sign&&t.sign?this.neg().divmod(t.neg(),e):t.length>this.length||this.cmp(t)<0?{div:new i(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new i(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new i(this.modn(t.words[0]))}:this._wordDiv(t,e)},i.prototype.div=function(t){return this.divmod(t,"div").div},i.prototype.mod=function(t){return this.divmod(t,"mod").mod},i.prototype.divRound=function(t){var e=this.divmod(t);if(0===e.mod.cmpn(0))return e.div;var r=e.div.sign?e.mod.isub(t):e.mod,n=t.shrn(1),i=t.andln(1),o=r.cmp(n);return 0>o||1===i&&0===o?e.div:e.div.sign?e.div.isubn(1):e.div.iaddn(1)},i.prototype.modn=function(t){r(67108863>=t);for(var e=(1<<26)%t,n=0,i=this.length-1;i>=0;i--)n=(e*n+this.words[i])%t;return n},i.prototype.idivn=function(t){r(67108863>=t);for(var e=0,n=this.length-1;n>=0;n--){var i=this.words[n]+67108864*e;this.words[n]=i/t|0,e=i%t}return this.strip()},i.prototype.divn=function(t){return this.clone().idivn(t)},i.prototype.egcd=function(t){r(!t.sign),r(0!==t.cmpn(0));var e=this,n=t.clone();e=e.sign?e.mod(t):e.clone();for(var o=new i(1),a=new i(0),s=new i(0),l=new i(1),u=0;e.isEven()&&n.isEven();)e.ishrn(1),n.ishrn(1),++u;for(var c=n.clone(),h=e.clone();0!==e.cmpn(0);){for(;e.isEven();)e.ishrn(1),o.isEven()&&a.isEven()?(o.ishrn(1),a.ishrn(1)):(o.iadd(c).ishrn(1),a.isub(h).ishrn(1));for(;n.isEven();)n.ishrn(1),s.isEven()&&l.isEven()?(s.ishrn(1),l.ishrn(1)):(s.iadd(c).ishrn(1),l.isub(h).ishrn(1));e.cmp(n)>=0?(e.isub(n),o.isub(s),a.isub(l)):(n.isub(e),s.isub(o),l.isub(a))}return{a:s,b:l,gcd:n.ishln(u)}},i.prototype._invmp=function(t){r(!t.sign),r(0!==t.cmpn(0));var e=this,n=t.clone();e=e.sign?e.mod(t):e.clone();for(var o=new i(1),a=new i(0),s=n.clone();e.cmpn(1)>0&&n.cmpn(1)>0;){for(;e.isEven();)e.ishrn(1),o.isEven()?o.ishrn(1):o.iadd(s).ishrn(1);for(;n.isEven();)n.ishrn(1),a.isEven()?a.ishrn(1):a.iadd(s).ishrn(1);e.cmp(n)>=0?(e.isub(n),o.isub(a)):(n.isub(e),a.isub(o))}return 0===e.cmpn(1)?o:a},i.prototype.gcd=function(t){if(0===this.cmpn(0))return t.clone();if(0===t.cmpn(0))return this.clone();var e=this.clone(),r=t.clone();e.sign=!1,r.sign=!1;for(var n=0;e.isEven()&&r.isEven();n++)e.ishrn(1),r.ishrn(1);for(;;){for(;e.isEven();)e.ishrn(1);for(;r.isEven();)r.ishrn(1);var i=e.cmp(r);if(0>i){var o=e;e=r,r=o}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.ishln(n)},i.prototype.invm=function(t){return this.egcd(t).a.mod(t)},i.prototype.isEven=function(){return 0===(1&this.words[0])},i.prototype.isOdd=function(){return 1===(1&this.words[0])},i.prototype.andln=function(t){return this.words[0]&t},i.prototype.bincn=function(t){r("number"==typeof t);var e=t%26,n=(t-e)/26,i=1<<e;if(this.length<=n){for(var o=this.length;n+1>o;o++)this.words[o]=0;return this.words[n]|=i,this.length=n+1,this}for(var a=i,o=n;0!==a&&o<this.length;o++){var s=this.words[o];s+=a,a=s>>>26,s&=67108863,this.words[o]=s}return 0!==a&&(this.words[o]=a,this.length++),this},i.prototype.cmpn=function(t){var e=0>t;if(e&&(t=-t),this.sign&&!e)return-1;if(!this.sign&&e)return 1;t&=67108863,this.strip();var r;if(this.length>1)r=1;else{var n=this.words[0];r=n===t?0:t>n?-1:1}return this.sign&&(r=-r),r},i.prototype.cmp=function(t){if(this.sign&&!t.sign)return-1;if(!this.sign&&t.sign)return 1;var e=this.ucmp(t);return this.sign?-e:e},i.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var e=0,r=this.length-1;r>=0;r--){var n=this.words[r],i=t.words[r];if(n!==i){i>n?e=-1:n>i&&(e=1);break}}return e},i.red=function(t){return new f(t)},i.prototype.toRed=function(t){return r(!this.red,"Already a number in reduction context"),r(!this.sign,"red works only with positives"),t.convertTo(this)._forceRed(t)},i.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(t){return this.red=t,this},i.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},i.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},i.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},i.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},i.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},i.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},i.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},i.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},i.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var g={k256:null,p224:null,p192:null,p25519:null};s.prototype._tmp=function(){var t=new i(null);return t.words=new Array(Math.ceil(this.n/13)),t},s.prototype.ireduce=function(t){var e,r=t;do this.split(r,this.tmp),r=this.imulK(r),r=r.iadd(this.tmp),e=r.bitLength();while(e>this.n);var n=e<this.n?-1:r.ucmp(this.p);return 0===n?(r.words[0]=0,r.length=1):n>0?r.isub(this.p):r.strip(),r},s.prototype.split=function(t,e){t.ishrn(this.n,0,e)},s.prototype.imulK=function(t){return t.imul(this.k)},n(l,s),l.prototype.split=function(t,e){for(var r=4194303,n=Math.min(t.length,9),i=0;n>i;i++)e.words[i]=t.words[i];if(e.length=n,t.length<=9)return t.words[0]=0,void(t.length=1);var o=t.words[9];e.words[e.length++]=o&r;for(var i=10;i<t.length;i++){var a=t.words[i];t.words[i-10]=(a&r)<<4|o>>>22,o=a}t.words[i-10]=o>>>22,t.length-=9},l.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e,r=0,n=0;n<t.length;n++){var i=t.words[n];e=64*i,r+=977*i,e+=r/67108864|0,r&=67108863,t.words[n]=r,r=e}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},n(u,s),n(c,s),n(h,s),h.prototype.imulK=function(t){for(var e=0,r=0;r<t.length;r++){var n=19*t.words[r]+e,i=67108863&n;n>>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},i._prime=function y(t){if(g[t])return g[t];var y;if("k256"===t)y=new l;else if("p224"===t)y=new u;else if("p192"===t)y=new c;else{if("p25519"!==t)throw new Error("Unknown prime "+t);y=new h}return g[t]=y,y},f.prototype._verify1=function(t){r(!t.sign,"red works only with positives"),r(t.red,"red works only with red numbers")},f.prototype._verify2=function(t,e){r(!t.sign&&!e.sign,"red works only with positives"),r(t.red&&t.red===e.red,"red works only with red numbers")},f.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.mod(this.m)._forceRed(this)},f.prototype.neg=function(t){var e=t.clone();return e.sign=!e.sign,e.iadd(this.m)._forceRed(this)},f.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},f.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},f.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},f.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},f.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.shln(e))},f.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},f.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},f.prototype.isqr=function(t){return this.imul(t,t)},f.prototype.sqr=function(t){return this.mul(t,t)},f.prototype.sqrt=function(t){if(0===t.cmpn(0))return t.clone();var e=this.m.andln(3);if(r(e%2===1),3===e){var n=this.m.add(new i(1)).ishrn(2),o=this.pow(t,n);return o}for(var a=this.m.subn(1),s=0;0!==a.cmpn(0)&&0===a.andln(1);)s++,a.ishrn(1);r(0!==a.cmpn(0));var l=new i(1).toRed(this),u=l.redNeg(),c=this.m.subn(1).ishrn(1),h=this.m.bitLength();for(h=new i(2*h*h).toRed(this);0!==this.pow(h,c).cmp(u);)h.redIAdd(u);for(var f=this.pow(h,a),o=this.pow(t,a.addn(1).ishrn(1)),d=this.pow(t,a),p=s;0!==d.cmp(l);){for(var v=d,m=0;0!==v.cmp(l);m++)v=v.redSqr();r(p>m);var g=this.pow(f,new i(1).ishln(p-m-1));o=o.redMul(g),f=g.redSqr(),d=d.redMul(f),p=m}return o},f.prototype.invm=function(t){var e=t._invmp(this.m);return e.sign?(e.sign=!1,this.imod(e).redNeg()):this.imod(e)},f.prototype.pow=function(t,e){var r=[];if(0===e.cmpn(0))return new i(1);for(var n=e.clone();0!==n.cmpn(0);)r.push(n.andln(1)),n.ishrn(1);for(var o=t,a=0;a<r.length&&0===r[a];a++,o=this.sqr(o));if(++a<r.length)for(var n=this.sqr(o);a<r.length;a++,n=this.sqr(n))0!==r[a]&&(o=this.mul(o,n));return o},f.prototype.convertTo=function(t){var e=t.mod(this.m);return e===t?e.clone():e},f.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},i.mont=function(t){return new d(t)},n(d,f),d.prototype.convertTo=function(t){return this.imod(t.shln(this.shift))},d.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},d.prototype.imul=function(t,e){if(0===t.cmpn(0)||0===e.cmpn(0))return t.words[0]=0,t.length=1,t;var r=t.imul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).ishrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},d.prototype.mul=function(t,e){if(0===t.cmpn(0)||0===e.cmpn(0))return new i(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(n).ishrn(this.shift),a=o;return o.cmp(this.m)>=0?a=o.isub(this.m):o.cmpn(0)<0&&(a=o.iadd(this.m)),a._forceRed(this)},d.prototype.invm=function(t){var e=this.imod(t._invmp(this.m).mul(this.r2));return e._forceRed(this)}}("undefined"==typeof e||e,this)},{}],86:[function(t,e,r){"use strict";function n(t){return i(t[0])*i(t[1])}var i=t("./lib/bn-sign");e.exports=n},{"./lib/bn-sign":77}],87:[function(t,e,r){"use strict";function n(t,e){return i(t[0].mul(e[1]).sub(t[1].mul(e[0])),t[1].mul(e[1]))}var i=t("./lib/rationalize");e.exports=n},{"./lib/rationalize":82}],88:[function(t,e,r){"use strict";function n(t){var e=t[0],r=t[1];if(0===e.cmpn(0))return 0;var n=e.divmod(r),a=n.div,s=i(a),l=n.mod;if(0===l.cmpn(0))return s;if(s){var u=o(s)+4,c=i(l.shln(u).divRound(r));return 0>s&&(c=-c),s+c*Math.pow(2,-u)}var h=r.bitLength()-l.bitLength()+53,c=i(l.shln(h).divRound(r));return 1023>h?c*Math.pow(2,-h):(c*=Math.pow(2,-1023),c*Math.pow(2,1023-h))}var i=t("./lib/bn-to-num"),o=t("./lib/ctz");e.exports=n},{"./lib/bn-to-num":78,"./lib/ctz":79}],89:[function(t,e,r){"use strict";function n(t,e){for(var r=0;t>r;++r)if(!(e[r]<=e[r+t]))return!0;return!1}function i(t,e,r,i){for(var o=0,a=0,s=0,l=t.length;l>s;++s){var u=t[s];if(!n(e,u)){for(var c=0;2*e>c;++c)r[o++]=u[c];i[a++]=s}}return a}function o(t,e,r,n){var o=t.length,a=e.length;if(!(0>=o||0>=a)){var s=t[0].length>>>1;if(!(0>=s)){var l,u=h.mallocDouble(2*s*o),c=h.mallocInt32(o);if(o=i(t,s,u,c),o>0){if(1===s&&n)f.init(o),l=f.sweepComplete(s,r,0,o,u,c,0,o,u,c);else{var p=h.mallocDouble(2*s*a),v=h.mallocInt32(a);a=i(e,s,p,v),a>0&&(f.init(o+a),l=1===s?f.sweepBipartite(s,r,0,o,u,c,0,a,p,v):d(s,r,n,o,u,c,a,p,v),h.free(p),h.free(v))}h.free(u),h.free(c)}return l}}}function a(t,e){c.push([t,e])}function s(t){return c=[],o(t,t,a,!0),c}function l(t,e){return c=[],o(t,e,a,!1),c}function u(t,e,r){switch(arguments.length){case 1:return s(t);case 2:return"function"==typeof e?o(t,t,e,!0):l(t,e);case 3:return o(t,e,r,!1);default:throw new Error("box-intersect: Invalid arguments")}}e.exports=u;var c,h=t("typedarray-pool"),f=t("./lib/sweep"),d=t("./lib/intersect");
},{"./lib/intersect":91,"./lib/sweep":95,"typedarray-pool":458}],90:[function(t,e,r){"use strict";function n(t,e,r){var n="bruteForce"+(t?"Red":"Blue")+(e?"Flip":"")+(r?"Full":""),i=["function ",n,"(",w.join(),"){","var ",u,"=2*",o,";"],l="for(var i="+c+","+p+"="+u+"*"+c+";i<"+h+";++i,"+p+"+="+u+"){var x0="+f+"["+a+"+"+p+"],x1="+f+"["+a+"+"+p+"+"+o+"],xi="+d+"[i];",M="for(var j="+v+","+b+"="+u+"*"+v+";j<"+m+";++j,"+b+"+="+u+"){var y0="+g+"["+a+"+"+b+"],"+(r?"y1="+g+"["+a+"+"+b+"+"+o+"],":"")+"yi="+y+"[j];";return t?i.push(l,_,":",M):i.push(M,_,":",l),r?i.push("if(y1<x0||x1<y0)continue;"):e?i.push("if(y0<=x0||x1<y0)continue;"):i.push("if(y0<x0||x1<y0)continue;"),i.push("for(var k="+a+"+1;k<"+o+";++k){var r0="+f+"[k+"+p+"],r1="+f+"[k+"+o+"+"+p+"],b0="+g+"[k+"+b+"],b1="+g+"[k+"+o+"+"+b+"];if(r1<b0||b1<r0)continue "+_+";}var "+x+"="+s+"("),e?i.push("yi,xi"):i.push("xi,yi"),i.push(");if("+x+"!==void 0)return "+x+";}}}"),{name:n,code:i.join("")}}function i(t){function e(e,r){var o=n(e,r,t);i.push(o.code),a.push("return "+o.name+"("+w.join()+");")}var r="bruteForce"+(t?"Full":"Partial"),i=[],o=w.slice();t||o.splice(3,0,l);var a=["function "+r+"("+o.join()+"){"];a.push("if("+h+"-"+c+">"+m+"-"+v+"){"),t?(e(!0,!1),a.push("}else{"),e(!1,!1)):(a.push("if("+l+"){"),e(!0,!0),a.push("}else{"),e(!0,!1),a.push("}}else{if("+l+"){"),e(!1,!0),a.push("}else{"),e(!1,!1),a.push("}")),a.push("}}return "+r);var s=i.join("")+a.join(""),u=new Function(s);return u()}var o="d",a="ax",s="vv",l="fp",u="es",c="rs",h="re",f="rb",d="ri",p="rp",v="bs",m="be",g="bb",y="bi",b="bp",x="rv",_="Q",w=[o,a,s,c,h,f,d,v,m,g,y];r.partial=i(!1),r.full=i(!0)},{}],91:[function(t,e,r){"use strict";function n(t,e){var r=8*u.log2(e+1)*(t+1)|0,n=u.nextPow2(A*r);S.length<n&&(l.free(S),S=l.mallocInt32(n));var i=u.nextPow2(T*r);i>L&&(l.free(L),L=l.mallocDouble(i))}function i(t,e,r,n,i,o,a,s,l){var u=A*t;S[u]=e,S[u+1]=r,S[u+2]=n,S[u+3]=i,S[u+4]=o,S[u+5]=a;var c=T*t;L[c]=s,L[c+1]=l}function o(t,e,r,n,i,o,a,s,l,u,c){var h=2*t,f=l*h,d=u[f+e];t:for(var p=i,v=i*h;o>p;++p,v+=h){var m=a[v+e],g=a[v+e+t];if(!(m>d||d>g||n&&d===m)){for(var y=s[p],b=e+1;t>b;++b){var m=a[v+b],g=a[v+b+t],x=u[f+b],_=u[f+b+t];if(x>g||m>_)continue t}var w;if(w=n?r(c,y):r(y,c),void 0!==w)return w}}}function a(t,e,r,n,i,o,a,s,l,u){var c=2*t,h=s*c,f=l[h+e];t:for(var d=n,p=n*c;i>d;++d,p+=c){var v=a[d];if(v!==u){var m=o[p+e],g=o[p+e+t];if(!(m>f||f>g)){for(var y=e+1;t>y;++y){var m=o[p+y],g=o[p+y+t],b=l[h+y],x=l[h+y+t];if(b>g||m>x)continue t}var _=r(v,u);if(void 0!==_)return _}}}}function s(t,e,r,s,l,u,c,v,E){n(t,s+c);var z,I=0,P=2*t;for(i(I++,0,0,s,0,c,r?16:0,-(1/0),1/0),r||i(I++,0,0,c,0,s,1,-(1/0),1/0);I>0;){I-=1;var C=I*A,R=S[C],D=S[C+1],O=S[C+2],F=S[C+3],j=S[C+4],N=S[C+5],B=I*T,U=L[B],V=L[B+1],q=1&N,G=!!(16&N),H=l,X=u,Y=v,W=E;if(q&&(H=v,X=E,Y=l,W=u),!(2&N&&(O=_(t,R,D,O,H,X,V),D>=O)||4&N&&(D=w(t,R,D,O,H,X,U),D>=O))){var Z=O-D,K=j-F;if(G){if(y>t*Z*(Z+K)){if(z=d.scanComplete(t,R,e,D,O,H,X,F,j,Y,W),void 0!==z)return z;continue}}else{if(t*Math.min(Z,K)<m){if(z=h(t,R,e,q,D,O,H,X,F,j,Y,W),void 0!==z)return z;continue}if(g>t*Z*K){if(z=d.scanBipartite(t,R,e,q,D,O,H,X,F,j,Y,W),void 0!==z)return z;continue}}var J=b(t,R,D,O,H,X,U,V);if(J>D)if(m>t*(J-D)){if(z=f(t,R+1,e,D,J,H,X,F,j,Y,W),void 0!==z)return z}else if(R===t-2){if(z=q?d.sweepBipartite(t,e,F,j,Y,W,D,J,H,X):d.sweepBipartite(t,e,D,J,H,X,F,j,Y,W),void 0!==z)return z}else i(I++,R+1,D,J,F,j,q,-(1/0),1/0),i(I++,R+1,F,j,D,J,1^q,-(1/0),1/0);if(O>J){var $=p(t,R,F,j,Y,W),Q=Y[P*$+R],tt=x(t,R,$,j,Y,W,Q);if(j>tt&&i(I++,R,J,O,tt,j,(4|q)+(G?16:0),Q,V),$>F&&i(I++,R,J,O,F,$,(2|q)+(G?16:0),U,Q),$+1===tt){if(z=G?a(t,R,e,J,O,H,X,$,Y,W[$]):o(t,R,e,q,J,O,H,X,$,Y,W[$]),void 0!==z)return z}else if(tt>$){var et;if(G){if(et=M(t,R,J,O,H,X,Q),et>J){var rt=x(t,R,J,et,H,X,Q);if(R===t-2){if(rt>J&&(z=d.sweepComplete(t,e,J,rt,H,X,$,tt,Y,W),void 0!==z))return z;if(et>rt&&(z=d.sweepBipartite(t,e,rt,et,H,X,$,tt,Y,W),void 0!==z))return z}else rt>J&&i(I++,R+1,J,rt,$,tt,16,-(1/0),1/0),et>rt&&(i(I++,R+1,rt,et,$,tt,0,-(1/0),1/0),i(I++,R+1,$,tt,rt,et,1,-(1/0),1/0))}}else et=q?k(t,R,J,O,H,X,Q):M(t,R,J,O,H,X,Q),et>J&&(R===t-2?z=q?d.sweepBipartite(t,e,$,tt,Y,W,J,et,H,X):d.sweepBipartite(t,e,J,et,H,X,$,tt,Y,W):(i(I++,R+1,J,et,$,tt,q,-(1/0),1/0),i(I++,R+1,$,tt,J,et,1^q,-(1/0),1/0)))}}}}}e.exports=s;var l=t("typedarray-pool"),u=t("bit-twiddle"),c=t("./brute"),h=c.partial,f=c.full,d=t("./sweep"),p=t("./median"),v=t("./partition"),m=128,g=1<<22,y=1<<22,b=v("!(lo>=p0)&&!(p1>=hi)",["p0","p1"]),x=v("lo===p0",["p0"]),_=v("lo<p0",["p0"]),w=v("hi<=p0",["p0"]),M=v("lo<=p0&&p0<=hi",["p0"]),k=v("lo<p0&&p0<=hi",["p0"]),A=6,T=2,E=1024,S=l.mallocInt32(E),L=l.mallocDouble(E)},{"./brute":90,"./median":92,"./partition":93,"./sweep":95,"bit-twiddle":51,"typedarray-pool":458}],92:[function(t,e,r){"use strict";function n(t,e,r,n,i,o){for(var a=2*t,s=a*(r+1)+e,l=r+1;n>l;++l,s+=a)for(var u=i[s],c=l,h=a*(l-1);c>r&&i[h+e]>u;--c,h-=a){for(var f=h,d=h+a,p=0;a>p;++p,++f,++d){var v=i[f];i[f]=i[d],i[d]=v}var m=o[c];o[c]=o[c-1],o[c-1]=m}}function i(t,e,r,i,o,l){if(r+1>=i)return r;for(var u=r,c=i,h=i+r>>>1,f=2*t,d=h,p=o[f*h+e];c>u;){if(s>c-u){n(t,e,u,c,o,l),p=o[f*h+e];break}var v=c-u,m=Math.random()*v+u|0,g=o[f*m+e],y=Math.random()*v+u|0,b=o[f*y+e],x=Math.random()*v+u|0,_=o[f*x+e];b>=g?_>=b?(d=y,p=b):g>=_?(d=m,p=g):(d=x,p=_):b>=_?(d=y,p=b):_>=g?(d=m,p=g):(d=x,p=_);for(var w=f*(c-1),M=f*d,k=0;f>k;++k,++w,++M){var A=o[w];o[w]=o[M],o[M]=A}var T=l[c-1];l[c-1]=l[d],l[d]=T,d=a(t,e,u,c-1,o,l,p);for(var w=f*(c-1),M=f*d,k=0;f>k;++k,++w,++M){var A=o[w];o[w]=o[M],o[M]=A}var T=l[c-1];if(l[c-1]=l[d],l[d]=T,d>h){for(c=d-1;c>u&&o[f*(c-1)+e]===p;)c-=1;c+=1}else{if(!(h>d))break;for(u=d+1;c>u&&o[f*u+e]===p;)u+=1}}return a(t,e,r,h,o,l,o[f*h+e])}e.exports=i;var o=t("./partition"),a=o("lo<p0",["p0"]),s=8},{"./partition":93}],93:[function(t,e,r){"use strict";function n(t,e){var r="abcdef".split("").concat(e),n=[];return t.indexOf("lo")>=0&&n.push("lo=e[k+n]"),t.indexOf("hi")>=0&&n.push("hi=e[k+o]"),r.push(i.replace("_",n.join()).replace("$",t)),Function.apply(void 0,r)}e.exports=n;var i="for(var j=2*a,k=j*c,l=k,m=c,n=b,o=a+b,p=c;d>p;++p,k+=j){var _;if($)if(m===p)m+=1,l+=j;else{for(var s=0;j>s;++s){var t=e[k+s];e[k+s]=e[l],e[l++]=t}var u=f[p];f[p]=f[m],f[m++]=u}}return m"},{}],94:[function(t,e,r){"use strict";function n(t,e){4*f>=e?i(0,e-1,t):h(0,e-1,t)}function i(t,e,r){for(var n=2*(t+1),i=t+1;e>=i;++i){for(var o=r[n++],a=r[n++],s=i,l=n-2;s-- >t;){var u=r[l-2],c=r[l-1];if(o>u)break;if(u===o&&a>c)break;r[l]=u,r[l+1]=c,l-=2}r[l]=o,r[l+1]=a}}function o(t,e,r){t*=2,e*=2;var n=r[t],i=r[t+1];r[t]=r[e],r[t+1]=r[e+1],r[e]=n,r[e+1]=i}function a(t,e,r){t*=2,e*=2,r[t]=r[e],r[t+1]=r[e+1]}function s(t,e,r,n){t*=2,e*=2,r*=2;var i=n[t],o=n[t+1];n[t]=n[e],n[t+1]=n[e+1],n[e]=n[r],n[e+1]=n[r+1],n[r]=i,n[r+1]=o}function l(t,e,r,n,i){t*=2,e*=2,i[t]=i[e],i[e]=r,i[t+1]=i[e+1],i[e+1]=n}function u(t,e,r){t*=2,e*=2;var n=r[t],i=r[e];return i>n?!1:n===i?r[t+1]>r[e+1]:!0}function c(t,e,r,n){t*=2;var i=n[t];return e>i?!0:i===e?n[t+1]<r:!1}function h(t,e,r){var n=(e-t+1)/6|0,d=t+n,p=e-n,v=t+e>>1,m=v-n,g=v+n,y=d,b=m,x=v,_=g,w=p,M=t+1,k=e-1,A=0;u(y,b,r)&&(A=y,y=b,b=A),u(_,w,r)&&(A=_,_=w,w=A),u(y,x,r)&&(A=y,y=x,x=A),u(b,x,r)&&(A=b,b=x,x=A),u(y,_,r)&&(A=y,y=_,_=A),u(x,_,r)&&(A=x,x=_,_=A),u(b,w,r)&&(A=b,b=w,w=A),u(b,x,r)&&(A=b,b=x,x=A),u(_,w,r)&&(A=_,_=w,w=A);for(var T=r[2*b],E=r[2*b+1],S=r[2*_],L=r[2*_+1],z=2*y,I=2*x,P=2*w,C=2*d,R=2*v,D=2*p,O=0;2>O;++O){var F=r[z+O],j=r[I+O],N=r[P+O];r[C+O]=F,r[R+O]=j,r[D+O]=N}a(m,t,r),a(g,e,r);for(var B=M;k>=B;++B)if(c(B,T,E,r))B!==M&&o(B,M,r),++M;else if(!c(B,S,L,r))for(;;){if(c(k,S,L,r)){c(k,T,E,r)?(s(B,M,k,r),++M,--k):(o(B,k,r),--k);break}if(--k<B)break}l(t,M-1,T,E,r),l(e,k+1,S,L,r),f>=M-2-t?i(t,M-2,r):h(t,M-2,r),f>=e-(k+2)?i(k+2,e,r):h(k+2,e,r),f>=k-M?i(M,k,r):h(M,k,r)}e.exports=n;var f=32},{}],95:[function(t,e,r){"use strict";function n(t){var e=h.nextPow2(t);v.length<e&&(c.free(v),v=c.mallocInt32(e)),m.length<e&&(c.free(m),m=c.mallocInt32(e)),g.length<e&&(c.free(g),g=c.mallocInt32(e)),y.length<e&&(c.free(y),y=c.mallocInt32(e)),b.length<e&&(c.free(b),b=c.mallocInt32(e)),x.length<e&&(c.free(x),x=c.mallocInt32(e));var r=8*e;_.length<r&&(c.free(_),_=c.mallocDouble(r))}function i(t,e,r,n){var i=e[n],o=t[r-1];t[i]=o,e[o]=i}function o(t,e,r,n){t[r]=n,e[n]=r}function a(t,e,r,n,a,s,l,u,c,h){for(var p=0,b=2*t,x=t-1,w=b-1,M=r;n>M;++M){var k=s[M],A=b*M;_[p++]=a[A+x],_[p++]=-(k+1),_[p++]=a[A+w],_[p++]=k}for(var M=l;u>M;++M){var k=h[M]+d,T=b*M;_[p++]=c[T+x],_[p++]=-k,_[p++]=c[T+w],_[p++]=k}var E=p>>>1;f(_,E);for(var S=0,L=0,M=0;E>M;++M){var z=0|_[2*M+1];if(z>=d)z=z-d|0,i(g,y,L--,z);else if(z>=0)i(v,m,S--,z);else if(-d>=z){z=-z-d|0;for(var I=0;S>I;++I){var P=e(v[I],z);if(void 0!==P)return P}o(g,y,L++,z)}else{z=-z-1|0;for(var I=0;L>I;++I){var P=e(z,g[I]);if(void 0!==P)return P}o(v,m,S++,z)}}}function s(t,e,r,n,a,s,l,u,c,h){for(var d=0,p=2*t,w=t-1,M=p-1,k=r;n>k;++k){var A=s[k]+1<<1,T=p*k;_[d++]=a[T+w],_[d++]=-A,_[d++]=a[T+M],_[d++]=A}for(var k=l;u>k;++k){var A=h[k]+1<<1,E=p*k;_[d++]=c[E+w],_[d++]=1|-A,_[d++]=c[E+M],_[d++]=1|A}var S=d>>>1;f(_,S);for(var L=0,z=0,I=0,k=0;S>k;++k){var P=0|_[2*k+1],C=1&P;if(S-1>k&&P>>1===_[2*k+3]>>1&&(C=2,k+=1),0>P){for(var R=-(P>>1)-1,D=0;I>D;++D){var O=e(b[D],R);if(void 0!==O)return O}if(0!==C)for(var D=0;L>D;++D){var O=e(v[D],R);if(void 0!==O)return O}if(1!==C)for(var D=0;z>D;++D){var O=e(g[D],R);if(void 0!==O)return O}0===C?o(v,m,L++,R):1===C?o(g,y,z++,R):2===C&&o(b,x,I++,R)}else{var R=(P>>1)-1;0===C?i(v,m,L--,R):1===C?i(g,y,z--,R):2===C&&i(b,x,I--,R)}}}function l(t,e,r,n,a,s,l,u,c,h,p,g){var y=0,b=2*t,x=e,w=e+t,M=1,k=1;n?k=d:M=d;for(var A=a;s>A;++A){var T=A+M,E=b*A;_[y++]=l[E+x],_[y++]=-T,_[y++]=l[E+w],_[y++]=T}for(var A=c;h>A;++A){var T=A+k,S=b*A;_[y++]=p[S+x],_[y++]=-T}var L=y>>>1;f(_,L);for(var z=0,A=0;L>A;++A){var I=0|_[2*A+1];if(0>I){var T=-I,P=!1;if(T>=d?(P=!n,T-=d):(P=!!n,T-=1),P)o(v,m,z++,T);else{var C=g[T],R=b*T,D=p[R+e+1],O=p[R+e+1+t];t:for(var F=0;z>F;++F){var j=v[F],N=b*j;if(!(O<l[N+e+1]||l[N+e+1+t]<D)){for(var B=e+2;t>B;++B)if(p[R+B+t]<l[N+B]||l[N+B+t]<p[R+B])continue t;var U,V=u[j];if(U=n?r(C,V):r(V,C),void 0!==U)return U}}}}else i(v,m,z--,I-M)}}function u(t,e,r,n,i,o,a,s,l,u,c){for(var h=0,p=2*t,m=e,g=e+t,y=n;i>y;++y){var b=y+d,x=p*y;_[h++]=o[x+m],_[h++]=-b,_[h++]=o[x+g],_[h++]=b}for(var y=s;l>y;++y){var b=y+1,w=p*y;_[h++]=u[w+m],_[h++]=-b}var M=h>>>1;f(_,M);for(var k=0,y=0;M>y;++y){var A=0|_[2*y+1];if(0>A){var b=-A;if(b>=d)v[k++]=b-d;else{b-=1;var T=c[b],E=p*b,S=u[E+e+1],L=u[E+e+1+t];t:for(var z=0;k>z;++z){var I=v[z],P=a[I];if(P===T)break;var C=p*I;if(!(L<o[C+e+1]||o[C+e+1+t]<S)){for(var R=e+2;t>R;++R)if(u[E+R+t]<o[C+R]||o[C+R+t]<u[E+R])continue t;var D=r(P,T);if(void 0!==D)return D}}}}else{for(var b=A-d,z=k-1;z>=0;--z)if(v[z]===b){for(var R=z+1;k>R;++R)v[R-1]=v[R];break}--k}}}e.exports={init:n,sweepBipartite:a,sweepComplete:s,scanBipartite:l,scanComplete:u};var c=t("typedarray-pool"),h=t("bit-twiddle"),f=t("./sort"),d=1<<28,p=1024,v=c.mallocInt32(p),m=c.mallocInt32(p),g=c.mallocInt32(p),y=c.mallocInt32(p),b=c.mallocInt32(p),x=c.mallocInt32(p),_=c.mallocDouble(8*p)},{"./sort":94,"bit-twiddle":51,"typedarray-pool":458}],96:[function(t,e,r){(function(t){function r(t,e){return d[0]=t,d[1]=e,f[0]}function n(t){return f[0]=t,d[0]}function i(t){return f[0]=t,d[1]}function o(t,e){return d[1]=t,d[0]=e,f[0]}function a(t){return f[0]=t,d[1]}function s(t){return f[0]=t,d[0]}function l(t,e){return p.writeUInt32LE(t,0,!0),p.writeUInt32LE(e,4,!0),p.readDoubleLE(0,!0)}function u(t){return p.writeDoubleLE(t,0,!0),p.readUInt32LE(0,!0)}function c(t){return p.writeDoubleLE(t,0,!0),p.readUInt32LE(4,!0)}var h=!1;if("undefined"!=typeof Float64Array){var f=new Float64Array(1),d=new Uint32Array(f.buffer);f[0]=1,h=!0,1072693248===d[1]?(e.exports=function(t){return f[0]=t,[d[0],d[1]]},e.exports.pack=r,e.exports.lo=n,e.exports.hi=i):1072693248===d[0]?(e.exports=function(t){return f[0]=t,[d[1],d[0]]},e.exports.pack=o,e.exports.lo=a,e.exports.hi=s):h=!1}if(!h){var p=new t(8);e.exports=function(t){return p.writeDoubleLE(t,0,!0),[p.readUInt32LE(0,!0),p.readUInt32LE(4,!0)]},e.exports.pack=l,e.exports.lo=u,e.exports.hi=c}e.exports.sign=function(t){return e.exports.hi(t)>>>31},e.exports.exponent=function(t){var r=e.exports.hi(t);return(r<<1>>>21)-1023},e.exports.fraction=function(t){var r=e.exports.lo(t),n=e.exports.hi(t),i=1048575&n;return 2146435072&n&&(i+=1<<20),[r,i]},e.exports.denormalized=function(t){var r=e.exports.hi(t);return!(2146435072&r)}}).call(this,t("buffer").Buffer)},{buffer:53}],97:[function(t,e,r){"use strict";function n(t,e){if(isNaN(t)||isNaN(e))return NaN;if(t===e)return t;if(0===t)return 0>e?-o:o;var r=i.hi(t),n=i.lo(t);return e>t==t>0?n===a?(r+=1,n=0):n+=1:0===n?(n=a,r-=1):n-=1,i.pack(n,r)}var i=t("double-bits"),o=Math.pow(2,-1074),a=-1>>>0;e.exports=n},{"double-bits":96}],98:[function(t,e,r){"use strict";function n(t,e){for(var r=t.length,n=new Array(r),o=0;r>o;++o)n[o]=i(t[o],e[o]);return n}var i=t("big-rat/add");e.exports=n},{"big-rat/add":72}],99:[function(t,e,r){"use strict";function n(t){for(var e=new Array(t.length),r=0;r<t.length;++r)e[r]=i(t[r]);return e}e.exports=n;var i=t("big-rat")},{"big-rat":75}],100:[function(t,e,r){"use strict";function n(t,e){for(var r=i(e),n=t.length,a=new Array(n),s=0;n>s;++s)a[s]=o(t[s],r);return a}var i=t("big-rat"),o=t("big-rat/mul");e.exports=n},{"big-rat":75,"big-rat/mul":84}],101:[function(t,e,r){"use strict";function n(t,e){for(var r=t.length,n=new Array(r),o=0;r>o;++o)n[o]=i(t[o],e[o]);return n}var i=t("big-rat/sub");e.exports=n},{"big-rat/sub":87}],102:[function(t,e,r){"use strict";function n(t,e,r,n){for(var i=0;2>i;++i){var o=t[i],a=e[i],s=Math.min(o,a),l=Math.max(o,a),u=r[i],c=n[i],h=Math.min(u,c),f=Math.max(u,c);if(s>f||h>l)return!1}return!0}function i(t,e,r,i){var a=o(t,r,i),s=o(e,r,i);if(a>0&&s>0||0>a&&0>s)return!1;var l=o(r,t,e),u=o(i,t,e);return l>0&&u>0||0>l&&0>u?!1:0===a&&0===s&&0===l&&0===u?n(t,e,r,i):!0}e.exports=i;var o=t("robust-orientation")[3]},{"robust-orientation":439}],103:[function(t,e,r){"use strict";"use restrict";function n(t){this.roots=new Array(t),this.ranks=new Array(t);for(var e=0;t>e;++e)this.roots[e]=e,this.ranks[e]=0}e.exports=n;var i=n.prototype;Object.defineProperty(i,"length",{get:function(){return this.roots.length}}),i.makeSet=function(){var t=this.roots.length;return this.roots.push(t),this.ranks.push(0),t},i.find=function(t){for(var e=t,r=this.roots;r[t]!==t;)t=r[t];for(;r[e]!==t;){var n=r[e];r[e]=t,e=n}return t},i.link=function(t,e){var r=this.find(t),n=this.find(e);if(r!==n){var i=this.ranks,o=this.roots,a=i[r],s=i[n];s>a?o[r]=n:a>s?o[n]=r:(o[n]=r,++i[r])}}},{}],104:[function(t,e,r){(function(t){var r=function(){"use strict";function e(r,n,i,o){function s(r,i){if(null===r)return null;if(0==i)return r;var l,f;if("object"!=typeof r)return r;if(e.__isArray(r))l=[];else if(e.__isRegExp(r))l=new RegExp(r.source,a(r)),r.lastIndex&&(l.lastIndex=r.lastIndex);else if(e.__isDate(r))l=new Date(r.getTime());else{if(h&&t.isBuffer(r))return l=new t(r.length),r.copy(l),l;"undefined"==typeof o?(f=Object.getPrototypeOf(r),l=Object.create(f)):(l=Object.create(o),f=o)}if(n){var d=u.indexOf(r);if(-1!=d)return c[d];u.push(r),c.push(l)}for(var p in r){var v;f&&(v=Object.getOwnPropertyDescriptor(f,p)),v&&null==v.set||(l[p]=s(r[p],i-1))}return l}var l;"object"==typeof n&&(i=n.depth,o=n.prototype,l=n.filter,n=n.circular);var u=[],c=[],h="undefined"!=typeof t;return"undefined"==typeof n&&(n=!0),"undefined"==typeof i&&(i=1/0),s(r,i)}function r(t){return Object.prototype.toString.call(t)}function n(t){return"object"==typeof t&&"[object Date]"===r(t)}function i(t){return"object"==typeof t&&"[object Array]"===r(t)}function o(t){return"object"==typeof t&&"[object RegExp]"===r(t)}function a(t){var e="";return t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),e}return e.clonePrototype=function(t){if(null===t)return null;var e=function(){};return e.prototype=t,new e},e.__objToStr=r,e.__isDate=n,e.__isArray=i,e.__isRegExp=o,e.__getRegExpFlags=a,e}();"object"==typeof e&&e.exports&&(e.exports=r)}).call(this,t("buffer").Buffer)},{buffer:53}],105:[function(t,e,r){e.exports={jet:[{index:0,rgb:[0,0,131]},{index:.125,rgb:[0,60,170]},{index:.375,rgb:[5,255,255]},{index:.625,rgb:[255,255,0]},{index:.875,rgb:[250,0,0]},{index:1,rgb:[128,0,0]}],hsv:[{index:0,rgb:[255,0,0]},{index:.169,rgb:[253,255,2]},{index:.173,rgb:[247,255,2]},{index:.337,rgb:[0,252,4]},{index:.341,rgb:[0,252,10]},{index:.506,rgb:[1,249,255]},{index:.671,rgb:[2,0,253]},{index:.675,rgb:[8,0,253]},{index:.839,rgb:[255,0,251]},{index:.843,rgb:[255,0,245]},{index:1,rgb:[255,0,6]}],hot:[{index:0,rgb:[0,0,0]},{index:.3,rgb:[230,0,0]},{index:.6,rgb:[255,210,0]},{index:1,rgb:[255,255,255]}],cool:[{index:0,rgb:[0,255,255]},{index:1,rgb:[255,0,255]}],spring:[{index:0,rgb:[255,0,255]},{index:1,rgb:[255,255,0]}],summer:[{index:0,rgb:[0,128,102]},{index:1,rgb:[255,255,102]}],autumn:[{index:0,rgb:[255,0,0]},{index:1,rgb:[255,255,0]}],winter:[{index:0,rgb:[0,0,255]},{index:1,rgb:[0,255,128]}],bone:[{index:0,rgb:[0,0,0]},{index:.376,rgb:[84,84,116]},{index:.753,rgb:[169,200,200]},{index:1,rgb:[255,255,255]}],copper:[{index:0,rgb:[0,0,0]},{index:.804,rgb:[255,160,102]},{index:1,rgb:[255,199,127]}],greys:[{index:0,rgb:[0,0,0]},{index:1,rgb:[255,255,255]}],yignbu:[{index:0,rgb:[8,29,88]},{index:.125,rgb:[37,52,148]},{index:.25,rgb:[34,94,168]},{index:.375,rgb:[29,145,192]},{index:.5,rgb:[65,182,196]},{index:.625,rgb:[127,205,187]},{index:.75,rgb:[199,233,180]},{index:.875,rgb:[237,248,217]},{index:1,rgb:[255,255,217]}],greens:[{index:0,rgb:[0,68,27]},{index:.125,rgb:[0,109,44]},{index:.25,rgb:[35,139,69]},{index:.375,rgb:[65,171,93]},{index:.5,rgb:[116,196,118]},{index:.625,rgb:[161,217,155]},{index:.75,rgb:[199,233,192]},{index:.875,rgb:[229,245,224]},{index:1,rgb:[247,252,245]}],yiorrd:[{index:0,rgb:[128,0,38]},{index:.125,rgb:[189,0,38]},{index:.25,rgb:[227,26,28]},{index:.375,rgb:[252,78,42]},{index:.5,rgb:[253,141,60]},{index:.625,rgb:[254,178,76]},{index:.75,rgb:[254,217,118]},{index:.875,rgb:[255,237,160]},{index:1,rgb:[255,255,204]}],bluered:[{index:0,rgb:[0,0,255]},{index:1,rgb:[255,0,0]}],rdbu:[{index:0,rgb:[5,10,172]},{index:.35,rgb:[106,137,247]},{index:.5,rgb:[190,190,190]},{index:.6,rgb:[220,170,132]},{index:.7,rgb:[230,145,90]},{index:1,rgb:[178,10,28]}],picnic:[{index:0,rgb:[0,0,255]},{index:.1,rgb:[51,153,255]},{index:.2,rgb:[102,204,255]},{index:.3,rgb:[153,204,255]},{index:.4,rgb:[204,204,255]},{index:.5,rgb:[255,255,255]},{index:.6,rgb:[255,204,255]},{index:.7,rgb:[255,153,255]},{index:.8,rgb:[255,102,204]},{index:.9,rgb:[255,102,102]},{index:1,rgb:[255,0,0]}],rainbow:[{index:0,rgb:[150,0,90]},{index:.125,rgb:[0,0,200]},{index:.25,rgb:[0,25,255]},{index:.375,rgb:[0,152,255]},{index:.5,rgb:[44,255,150]},{index:.625,rgb:[151,255,0]},{index:.75,rgb:[255,234,0]},{index:.875,rgb:[255,111,0]},{index:1,rgb:[255,0,0]}],portland:[{index:0,rgb:[12,51,131]},{index:.25,rgb:[10,136,186]},{index:.5,rgb:[242,211,56]},{index:.75,rgb:[242,143,56]},{index:1,rgb:[217,30,30]}],blackbody:[{index:0,rgb:[0,0,0]},{index:.2,rgb:[230,0,0]},{index:.4,rgb:[230,210,0]},{index:.7,rgb:[255,255,255]},{index:1,rgb:[160,200,255]}],earth:[{index:0,rgb:[0,0,130]},{index:.1,rgb:[0,180,180]},{index:.2,rgb:[40,210,40]},{index:.4,rgb:[230,230,50]},{index:.6,rgb:[120,70,20]},{index:1,rgb:[255,255,255]}],electric:[{index:0,rgb:[0,0,0]},{index:.15,rgb:[30,0,100]},{index:.4,rgb:[120,0,100]},{index:.6,rgb:[160,90,0]},{index:.8,rgb:[230,200,0]},{index:1,rgb:[255,250,220]}],alpha:[{index:0,rgb:[255,255,255,0]},{index:0,rgb:[255,255,255,1]}]}},{}],106:[function(t,e,r){"use strict";function n(t){for(var e,r="#",n=0;3>n;++n)e=t[n],e=e.toString(16),r+=("00"+e).substr(e.length);return r}function i(t){return"rgba("+t.join(",")+")"}var o=t("arraytools"),a=t("clone"),s=t("./colorScales");e.exports=function(t){var e,r,l,u,c,h,f,d,p,v,m,g,y,b=[],x=[],_=[],w=[];if(o.isPlainObject(t)||(t={}),p=t.nshades||72,d=t.format||"hex",f=t.colormap,f||(f="jet"),"string"==typeof f){if(f=f.toLowerCase(),!s[f])throw Error(f+" not a supported colorscale");h=a(s[f])}else{if(!Array.isArray(f))throw Error("unsupported colormap option",f);h=a(f)}if(h.length>p)throw new Error(f+" map requires nshades to be at least size "+h.length);for(m=Array.isArray(t.alpha)?2!==t.alpha.length?[1,1]:a(t.alpha):"number"==typeof t.alpha?[t.alpha,t.alpha]:[1,1],e=h.map(function(t){return Math.round(t.index*p)}),m[0]<0&&(m[0]=0),m[1]<0&&(m[0]=0),m[0]>1&&(m[0]=1),m[1]>1&&(m[0]=1),y=0;y<e.length;++y)g=h[y].index,r=h[y].rgb,4===r.length&&r[3]>=0&&r[3]<=1||(r[3]=m[0]+(m[1]-m[0])*g);for(y=0;y<e.length-1;++y)c=e[y+1]-e[y],l=h[y].rgb,u=h[y+1].rgb,b=b.concat(o.linspace(l[0],u[0],c)),x=x.concat(o.linspace(l[1],u[1],c)),_=_.concat(o.linspace(l[2],u[2],c)),w=w.concat(o.linspace(l[3],u[3],c));return b=b.map(Math.round),x=x.map(Math.round),_=_.map(Math.round),v=o.zip(b,x,_,w),"hex"===d&&(v=v.map(n)),"rgbaString"===d&&(v=v.map(i)),v}},{"./colorScales":105,arraytools:50,clone:104}],107:[function(t,e,r){function n(t,e){return t-e}function i(t,e){var r=t.length,i=t.length-e.length;if(i)return i;switch(r){case 0:return 0;case 1:return t[0]-e[0];case 2:return t[0]+t[1]-e[0]-e[1]||o(t[0],t[1])-o(e[0],e[1]);case 3:var a=t[0]+t[1],s=e[0]+e[1];if(i=a+t[2]-(s+e[2]))return i;var l=o(t[0],t[1]),u=o(e[0],e[1]);return o(l,t[2])-o(u,e[2])||o(l+t[2],a)-o(u+e[2],s);case 4:var c=t[0],h=t[1],f=t[2],d=t[3],p=e[0],v=e[1],m=e[2],g=e[3];return c+h+f+d-(p+v+m+g)||o(c,h,f,d)-o(p,v,m,g,p)||o(c+h,c+f,c+d,h+f,h+d,f+d)-o(p+v,p+m,p+g,v+m,v+g,m+g)||o(c+h+f,c+h+d,c+f+d,h+f+d)-o(p+v+m,p+v+g,p+m+g,v+m+g);default:for(var y=t.slice().sort(n),b=e.slice().sort(n),x=0;r>x;++x)if(i=y[x]-b[x])return i;return 0}}e.exports=i;var o=Math.min},{}],108:[function(t,e,r){"use strict";function n(t){var e=t.length;if(0===e)return[];if(1===e)return[[0]];var r=t[0].length;return 0===r?[]:1===r?i(t):2===r?o(t):a(t,r)}var i=t("./lib/ch1d"),o=t("./lib/ch2d"),a=t("./lib/chnd");e.exports=n},{"./lib/ch1d":109,"./lib/ch2d":110,"./lib/chnd":111}],109:[function(t,e,r){"use strict";function n(t){for(var e=0,r=0,n=1;n<t.length;++n)t[n][0]<t[e][0]&&(e=n),t[n][0]>t[r][0]&&(r=n);return r>e?[[e],[r]]:e>r?[[r],[e]]:[[e]]}e.exports=n},{}],110:[function(t,e,r){"use strict";function n(t){var e=i(t),r=e.length;if(2>=r)return[];for(var n=new Array(r),o=e[r-1],a=0;r>a;++a){var s=e[a];n[a]=[o,s],o=s}return n}e.exports=n;var i=t("monotone-convex-hull-2d")},{"monotone-convex-hull-2d":113}],111:[function(t,e,r){"use strict";function n(t,e){for(var r=t.length,n=new Array(r),i=0;i<e.length;++i)n[i]=t[e[i]];for(var o=e.length,i=0;r>i;++i)e.indexOf(i)<0&&(n[o++]=t[i]);return n}function i(t,e){for(var r=t.length,n=e.length,i=0;r>i;++i)for(var o=t[i],a=0;a<o.length;++a){var s=o[a];if(n>s)o[a]=e[s];else{s-=n;for(var l=0;n>l;++l)s>=e[l]&&(s+=1);o[a]=s}}return t}function o(t,e){try{return a(t,!0)}catch(r){var o=s(t);if(o.length<=e)return[];var l=n(t,o),u=a(l,!0);return i(u,o)}}e.exports=o;var a=t("incremental-convex-hull"),s=t("affine-hull")},{"affine-hull":112,"incremental-convex-hull":241}],112:[function(t,e,r){"use strict";function n(t,e){for(var r=new Array(e+1),n=0;n<t.length;++n)r[n]=t[n];for(var n=0;n<=t.length;++n){for(var i=t.length;e>=i;++i){for(var a=new Array(e),s=0;e>s;++s)a[s]=Math.pow(i+1-n,s);r[i]=a}var l=o.apply(void 0,r);if(l)return!0}return!1}function i(t){var e=t.length;if(0===e)return[];if(1===e)return[0];for(var r=t[0].length,i=[t[0]],o=[0],a=1;e>a;++a)if(i.push(t[a]),n(i,r)){if(o.push(a),o.length===r+1)return o}else i.pop();return o}e.exports=i;var o=t("robust-orientation")},{"robust-orientation":439}],113:[function(t,e,r){"use strict";function n(t){var e=t.length;if(3>e){for(var r=new Array(e),n=0;e>n;++n)r[n]=n;return 2===e&&t[0][0]===t[1][0]&&t[0][1]===t[1][1]?[0]:r}for(var o=new Array(e),n=0;e>n;++n)o[n]=n;o.sort(function(e,r){var n=t[e][0]-t[r][0];return n?n:t[e][1]-t[r][1]});for(var a=[o[0],o[1]],s=[o[0],o[1]],n=2;e>n;++n){for(var l=o[n],u=t[l],c=a.length;c>1&&i(t[a[c-2]],t[a[c-1]],u)<=0;)c-=1,a.pop();for(a.push(l),c=s.length;c>1&&i(t[s[c-2]],t[s[c-1]],u)>=0;)c-=1,s.pop();s.push(l)}for(var r=new Array(s.length+a.length-2),h=0,n=0,f=a.length;f>n;++n)r[h++]=a[n];for(var d=s.length-2;d>0;--d)r[h++]=s[d];return r}e.exports=n;var i=t("robust-orientation")[3]},{"robust-orientation":439}],114:[function(t,e,r){e.exports={AFG:"afghan",ALA:"\\b\\wland",ALB:"albania",DZA:"algeria",ASM:"^(?=.*americ).*samoa",AND:"andorra",AGO:"angola",AIA:"anguill?a",ATA:"antarctica",ATG:"antigua",ARG:"argentin",ARM:"armenia",ABW:"^(?!.*bonaire).*\\baruba",AUS:"australia",AUT:"^(?!.*hungary).*austria|\\baustri.*\\bemp",AZE:"azerbaijan",BHS:"bahamas",BHR:"bahrain",BGD:"bangladesh|^(?=.*east).*paki?stan",BRB:"barbados",BLR:"belarus|byelo",BEL:"^(?!.*luxem).*belgium",BLZ:"belize|^(?=.*british).*honduras",BEN:"benin|dahome",BMU:"bermuda",BTN:"bhutan",BOL:"bolivia",BES:"^(?=.*bonaire).*eustatius|^(?=.*carib).*netherlands|\\bbes.?islands",BIH:"herzegovina|bosnia",BWA:"botswana|bechuana",BVT:"bouvet",BRA:"brazil",IOT:"british.?indian.?ocean",BRN:"brunei",BGR:"bulgaria",BFA:"burkina|\\bfaso|upper.?volta",BDI:"burundi",KHM:"cambodia|kampuchea|khmer",CMR:"cameroon",CAN:"canada",CPV:"verde",CYM:"cayman",CAF:"\\bcentral.african.republic",TCD:"\\bchad",CHL:"\\bchile",CHN:"^(?!.*\\bmac)(?!.*\\bhong)(?!.*\\btai).*china",CXR:"christmas",CCK:"\\bcocos|keeling",COL:"colombia",COM:"comoro",COD:"\\bdem.*congo|congo.*\\bdem|congo.*\\bdr|\\bdr.*congo|belgian.?congo|congo.?free.?state|kinshasa|zaire|l.opoldville|drc|droc|rdc",COG:"^(?!.*\\bdem)(?!.*\\bdr)(?!.*kinshasa)(?!.*zaire)(?!.*belg)(?!.*l.opoldville)(?!.*free).*\\bcongo",COK:"\\bcook",CRI:"costa.?rica",CIV:"ivoire|ivory",HRV:"croatia",CUB:"\\bcuba",CUW:"^(?!.*bonaire).*\\bcura(c|\xe7)ao",CYP:"cyprus",CZE:"^(?=.*rep).*czech|czechia|bohemia",CSK:"czechoslovakia",DNK:"denmark",DJI:"djibouti",DMA:"dominica(?!n)",DOM:"dominican.rep",ECU:"ecuador",EGY:"egypt",SLV:"el.?salvador",GNQ:"guine.*eq|eq.*guine|^(?=.*span).*guinea",ERI:"eritrea",EST:"estonia",ETH:"ethiopia|abyssinia",FLK:"falkland|malvinas",FRO:"faroe|faeroe",FJI:"fiji",FIN:"finland",FRA:"^(?!.*\\bdep)(?!.*martinique).*france|french.?republic|\\bgaul",GUF:"^(?=.*french).*guiana",PYF:"french.?polynesia|tahiti",ATF:"french.?southern",GAB:"gabon",GMB:"gambia",GEO:"^(?!.*south).*georgia",DDR:"german.?democratic.?republic|democratic.?republic.*germany|east.germany",DEU:"^(?!.*east).*germany|^(?=.*\\bfed.*\\brep).*german",GHA:"ghana|gold.?coast",GIB:"gibraltar",GRC:"greece|hellenic|hellas",GRL:"greenland",GRD:"grenada",GLP:"guadeloupe",GUM:"\\bguam",GTM:"guatemala",GGY:"guernsey",GIN:"^(?!.*eq)(?!.*span)(?!.*bissau)(?!.*portu)(?!.*new).*guinea",GNB:"bissau|^(?=.*portu).*guinea",GUY:"guyana|british.?guiana",HTI:"haiti",HMD:"heard.*mcdonald",VAT:"holy.?see|vatican|papal.?st",HND:"^(?!.*brit).*honduras",HKG:"hong.?kong",HUN:"^(?!.*austr).*hungary",ISL:"iceland",IND:"india(?!.*ocea)",IDN:"indonesia",IRN:"\\biran|persia",IRQ:"\\biraq|mesopotamia",IRL:"ireland",IMN:"^(?=.*isle).*\\bman",ISR:"israel",ITA:"italy",JAM:"jamaica",JPN:"japan",JEY:"jersey",JOR:"jordan",KAZ:"kazak",KEN:"kenya|british.?east.?africa|east.?africa.?prot",KIR:"kiribati",PRK:"^(?=.*democrat).*\\bkorea|^(?=.*people).*\\bkorea|^(?=.*north).*\\bkorea|dprk",KOR:"^(?!.*democrat)(?!.*people)(?!.*north).*\\bkorea",KWT:"kuwait",KGZ:"kyrgyz|kirghiz",LAO:"\\blaos?\\b",LVA:"latvia",LBN:"lebanon",LSO:"lesotho|basuto",LBR:"liberia",LBY:"libya",LIE:"liechtenstein",LTU:"lithuania",LUX:"^(?!.*belg).*luxem",MAC:"maca(o|u)",MKD:"macedonia|fyrom",MDG:"madagascar|malagasy",MWI:"malawi|nyasa",MYS:"malaysia",MDV:"maldive",MLI:"\\bmali\\b",MLT:"\\bmalta",MHL:"marshall",MTQ:"martinique",MRT:"mauritania",MUS:"mauritius",MYT:"\\bmayotte",MEX:"\\bmexic",FSM:"micronesia",MDA:"moldov|b(a|e)ssarabia",MCO:"monaco",MNG:"mongolia",MNE:"^(?!.*serbia).*montenegro",MSR:"montserrat",MAR:"morocco|\\bmaroc",MOZ:"mozambique",MMR:"myanmar|burma",NAM:"namibia",NRU:"nauru",NPL:"nepal",NLD:"^(?!.*\\bant)(?!.*\\bcarib).*netherlands",ANT:"^(?=.*\\bant).*(nether|dutch)",NCL:"new.?caledonia",NZL:"new.?zealand",NIC:"nicaragua",NER:"\\bniger(?!ia)",NGA:"nigeria",NIU:"niue",NFK:"norfolk",MNP:"mariana",NOR:"norway",OMN:"\\boman|trucial",PAK:"^(?!.*east).*paki?stan",PLW:"palau",PSE:"palestin|\\bgaza|west.?bank",PAN:"panama",PNG:"papua|new.?guinea",PRY:"paraguay",PER:"peru",PHL:"philippines",PCN:"pitcairn",POL:"poland",PRT:"portugal",PRI:"puerto.?rico",QAT:"qatar",REU:"r(e|\xe9)union",ROU:"r(o|u|ou)mania",RUS:"\\brussia|soviet.?union|u\\.?s\\.?s\\.?r|socialist.?republics",RWA:"rwanda",BLM:"barth(e|\xe9)lemy",SHN:"helena",KNA:"kitts|\\bnevis",LCA:"\\blucia",MAF:"^(?=.*collectivity).*martin|^(?=.*france).*martin(?!ique)|^(?=.*french).*martin(?!ique)",SPM:"miquelon",VCT:"vincent",WSM:"^(?!.*amer).*samoa",SMR:"san.?marino",STP:"\\bs(a|\xe3)o.?tom(e|\xe9)",SAU:"\\bsa\\w*.?arabia",SEN:"senegal",SRB:"^(?!.*monte).*serbia",SYC:"seychell",SLE:"sierra",SGP:"singapore",SXM:"^(?!.*martin)(?!.*saba).*maarten",SVK:"^(?!.*cze).*slovak",SVN:"slovenia",SLB:"solomon",SOM:"somali",ZAF:"\\bs\\w*.?africa",SGS:"south.?georgia|sandwich",SSD:"\\bs\\w*.?sudan",ESP:"spain",LKA:"sri.?lanka|ceylon",SDN:"^(?!.*\\bs(?!u)).*sudan",SUR:"surinam|dutch.?guiana",SJM:"svalbard",SWZ:"swaziland",SWE:"sweden",CHE:"switz|swiss",SYR:"syria",TWN:"taiwan|taipei|formosa",TJK:"tajik",TZA:"tanzania",THA:"thailand|\\bsiam",TLS:"^(?=.*leste).*timor|^(?=.*east).*timor",TGO:"togo",TKL:"tokelau",TON:"tonga",TTO:"trinidad|tobago",TUN:"tunisia",TUR:"turkey",TKM:"turkmen",TCA:"turks",TUV:"tuvalu",UGA:"uganda",UKR:"ukrain",ARE:"emirates|^u\\.?a\\.?e\\.?$|united.?arab.?em",GBR:"united.?kingdom|britain|^u\\.?k\\.?$",USA:"united.?states|\\bu\\.?s\\.?a\\.?\\b|\\bu\\.?s\\.?\\b(?!.*islands)",UMI:"minor.?outlying.?is",URY:"uruguay",UZB:"uzbek",VUT:"vanuatu|new.?hebrides",VEN:"venezuela",VNM:"^(?!.*republic).*viet.?nam|^(?=.*socialist).*viet.?nam",VGB:"^(?=.*\\bu\\.?\\s?k).*virgin|^(?=.*brit).*virgin|^(?=.*kingdom).*virgin",VIR:"^(?=.*\\bu\\.?\\s?s).*virgin|^(?=.*states).*virgin",WLF:"futuna|wallis",ESH:"western.sahara",YEM:"^(?!.*arab)(?!.*north)(?!.*sana)(?!.*peo)(?!.*dem)(?!.*south)(?!.*aden)(?!.*\\bp\\.?d\\.?r).*yemen",YMD:"^(?=.*peo).*yemen|^(?!.*rep)(?=.*dem).*yemen|^(?=.*south).*yemen|^(?=.*aden).*yemen|^(?=.*\\bp\\.?d\\.?r).*yemen",YUG:"yugoslavia",ZMB:"zambia|northern.?rhodesia",EAZ:"zanzibar",ZWE:"zimbabwe|^(?!.*northern).*rhodesia"}},{}],115:[function(t,e,r){"use strict";function n(){this.argTypes=[],this.shimArgs=[],this.arrayArgs=[],this.arrayBlockIndices=[],this.scalarArgs=[],this.offsetArgs=[],this.offsetArgIndex=[],this.indexArgs=[],this.shapeArgs=[],this.funcName="",this.pre=null,this.body=null,this.post=null,this.debug=!1}function i(t){var e=new n;e.pre=t.pre,e.body=t.body,e.post=t.post;var r=t.args.slice(0);e.argTypes=r;for(var i=0;i<r.length;++i){var a=r[i];if("array"===a||"object"==typeof a&&a.blockIndices){if(e.argTypes[i]="array",e.arrayArgs.push(i),e.arrayBlockIndices.push(a.blockIndices?a.blockIndices:0),e.shimArgs.push("array"+i),i<e.pre.args.length&&e.pre.args[i].count>0)throw new Error("cwise: pre() block may not reference array args");if(i<e.post.args.length&&e.post.args[i].count>0)throw new Error("cwise: post() block may not reference array args")}else if("scalar"===a)e.scalarArgs.push(i),e.shimArgs.push("scalar"+i);else if("index"===a){if(e.indexArgs.push(i),i<e.pre.args.length&&e.pre.args[i].count>0)throw new Error("cwise: pre() block may not reference array index");if(i<e.body.args.length&&e.body.args[i].lvalue)throw new Error("cwise: body() block may not write to array index");if(i<e.post.args.length&&e.post.args[i].count>0)throw new Error("cwise: post() block may not reference array index")}else if("shape"===a){if(e.shapeArgs.push(i),i<e.pre.args.length&&e.pre.args[i].lvalue)throw new Error("cwise: pre() block may not write to array shape");if(i<e.body.args.length&&e.body.args[i].lvalue)throw new Error("cwise: body() block may not write to array shape");if(i<e.post.args.length&&e.post.args[i].lvalue)throw new Error("cwise: post() block may not write to array shape");
}else{if("object"!=typeof a||!a.offset)throw new Error("cwise: Unknown argument type "+r[i]);e.argTypes[i]="offset",e.offsetArgs.push({array:a.array,offset:a.offset}),e.offsetArgIndex.push(i)}}if(e.arrayArgs.length<=0)throw new Error("cwise: No array arguments specified");if(e.pre.args.length>r.length)throw new Error("cwise: Too many arguments in pre() block");if(e.body.args.length>r.length)throw new Error("cwise: Too many arguments in body() block");if(e.post.args.length>r.length)throw new Error("cwise: Too many arguments in post() block");return e.debug=!!t.printCode||!!t.debug,e.funcName=t.funcName||"cwise",e.blockSize=t.blockSize||64,o(e)}var o=t("./lib/thunk.js");e.exports=i},{"./lib/thunk.js":117}],116:[function(t,e,r){"use strict";function n(t,e,r){var n,i,o=t.length,a=e.arrayArgs.length,s=e.indexArgs.length>0,l=[],u=[],c=0,h=0;for(n=0;o>n;++n)u.push(["i",n,"=0"].join(""));for(i=0;a>i;++i)for(n=0;o>n;++n)h=c,c=t[n],0===n?u.push(["d",i,"s",n,"=t",i,"p",c].join("")):u.push(["d",i,"s",n,"=(t",i,"p",c,"-s",h,"*t",i,"p",h,")"].join(""));for(l.push("var "+u.join(",")),n=o-1;n>=0;--n)c=t[n],l.push(["for(i",n,"=0;i",n,"<s",c,";++i",n,"){"].join(""));for(l.push(r),n=0;o>n;++n){for(h=c,c=t[n],i=0;a>i;++i)l.push(["p",i,"+=d",i,"s",n].join(""));s&&(n>0&&l.push(["index[",h,"]-=s",h].join("")),l.push(["++index[",c,"]"].join(""))),l.push("}")}return l.join("\n")}function i(t,e,r,i){for(var o=e.length,a=r.arrayArgs.length,s=r.blockSize,l=r.indexArgs.length>0,u=[],c=0;a>c;++c)u.push(["var offset",c,"=p",c].join(""));for(var c=t;o>c;++c)u.push(["for(var j"+c+"=SS[",e[c],"]|0;j",c,">0;){"].join("")),u.push(["if(j",c,"<",s,"){"].join("")),u.push(["s",e[c],"=j",c].join("")),u.push(["j",c,"=0"].join("")),u.push(["}else{s",e[c],"=",s].join("")),u.push(["j",c,"-=",s,"}"].join("")),l&&u.push(["index[",e[c],"]=j",c].join(""));for(var c=0;a>c;++c){for(var h=["offset"+c],f=t;o>f;++f)h.push(["j",f,"*t",c,"p",e[f]].join(""));u.push(["p",c,"=(",h.join("+"),")"].join(""))}u.push(n(e,r,i));for(var c=t;o>c;++c)u.push("}");return u.join("\n")}function o(t){for(var e=0,r=t[0].length;r>e;){for(var n=1;n<t.length;++n)if(t[n][e]!==t[0][e])return e;++e}return e}function a(t,e,r){for(var n=t.body,i=[],o=[],a=0;a<t.args.length;++a){var s=t.args[a];if(!(s.count<=0)){var l=new RegExp(s.name,"g"),u="",c=e.arrayArgs.indexOf(a);switch(e.argTypes[a]){case"offset":var h=e.offsetArgIndex.indexOf(a),f=e.offsetArgs[h];c=f.array,u="+q"+h;case"array":u="p"+c+u;var d="l"+a,p="a"+c;if(0===e.arrayBlockIndices[c])1===s.count?"generic"===r[c]?s.lvalue?(i.push(["var ",d,"=",p,".get(",u,")"].join("")),n=n.replace(l,d),o.push([p,".set(",u,",",d,")"].join(""))):n=n.replace(l,[p,".get(",u,")"].join("")):n=n.replace(l,[p,"[",u,"]"].join("")):"generic"===r[c]?(i.push(["var ",d,"=",p,".get(",u,")"].join("")),n=n.replace(l,d),s.lvalue&&o.push([p,".set(",u,",",d,")"].join(""))):(i.push(["var ",d,"=",p,"[",u,"]"].join("")),n=n.replace(l,d),s.lvalue&&o.push([p,"[",u,"]=",d].join("")));else{for(var v=[s.name],m=[u],g=0;g<Math.abs(e.arrayBlockIndices[c]);g++)v.push("\\s*\\[([^\\]]+)\\]"),m.push("$"+(g+1)+"*t"+c+"b"+g);if(l=new RegExp(v.join(""),"g"),u=m.join("+"),"generic"===r[c])throw new Error("cwise: Generic arrays not supported in combination with blocks!");n=n.replace(l,[p,"[",u,"]"].join(""))}break;case"scalar":n=n.replace(l,"Y"+e.scalarArgs.indexOf(a));break;case"index":n=n.replace(l,"index");break;case"shape":n=n.replace(l,"shape")}}}return[i.join("\n"),n,o.join("\n")].join("\n").trim()}function s(t){for(var e=new Array(t.length),r=!0,n=0;n<t.length;++n){var i=t[n],o=i.match(/\d+/);o=o?o[0]:"",0===i.charAt(0)?e[n]="u"+i.charAt(1)+o:e[n]=i.charAt(0)+o,n>0&&(r=r&&e[n]===e[n-1])}return r?e[0]:e.join("")}function l(t,e){for(var r=e[1].length-Math.abs(t.arrayBlockIndices[0])|0,l=new Array(t.arrayArgs.length),c=new Array(t.arrayArgs.length),h=0;h<t.arrayArgs.length;++h)c[h]=e[2*h],l[h]=e[2*h+1];for(var f=[],d=[],p=[],v=[],m=[],h=0;h<t.arrayArgs.length;++h){t.arrayBlockIndices[h]<0?(p.push(0),v.push(r),f.push(r),d.push(r+t.arrayBlockIndices[h])):(p.push(t.arrayBlockIndices[h]),v.push(t.arrayBlockIndices[h]+r),f.push(0),d.push(t.arrayBlockIndices[h]));for(var g=[],y=0;y<l[h].length;y++)p[h]<=l[h][y]&&l[h][y]<v[h]&&g.push(l[h][y]-p[h]);m.push(g)}for(var b=["SS"],x=["'use strict'"],_=[],y=0;r>y;++y)_.push(["s",y,"=SS[",y,"]"].join(""));for(var h=0;h<t.arrayArgs.length;++h){b.push("a"+h),b.push("t"+h),b.push("p"+h);for(var y=0;r>y;++y)_.push(["t",h,"p",y,"=t",h,"[",p[h]+y,"]"].join(""));for(var y=0;y<Math.abs(t.arrayBlockIndices[h]);++y)_.push(["t",h,"b",y,"=t",h,"[",f[h]+y,"]"].join(""))}for(var h=0;h<t.scalarArgs.length;++h)b.push("Y"+h);if(t.shapeArgs.length>0&&_.push("shape=SS.slice(0)"),t.indexArgs.length>0){for(var w=new Array(r),h=0;r>h;++h)w[h]="0";_.push(["index=[",w.join(","),"]"].join(""))}for(var h=0;h<t.offsetArgs.length;++h){for(var M=t.offsetArgs[h],k=[],y=0;y<M.offset.length;++y)0!==M.offset[y]&&(1===M.offset[y]?k.push(["t",M.array,"p",y].join("")):k.push([M.offset[y],"*t",M.array,"p",y].join("")));0===k.length?_.push("q"+h+"=0"):_.push(["q",h,"=",k.join("+")].join(""))}var A=u([].concat(t.pre.thisVars).concat(t.body.thisVars).concat(t.post.thisVars));_=_.concat(A),x.push("var "+_.join(","));for(var h=0;h<t.arrayArgs.length;++h)x.push("p"+h+"|=0");t.pre.body.length>3&&x.push(a(t.pre,t,c));var T=a(t.body,t,c),E=o(m);r>E?x.push(i(E,m[0],t,T)):x.push(n(m[0],t,T)),t.post.body.length>3&&x.push(a(t.post,t,c)),t.debug&&console.log("-----Generated cwise routine for ",e,":\n"+x.join("\n")+"\n----------");var S=[t.funcName||"unnamed","_cwise_loop_",l[0].join("s"),"m",E,s(c)].join(""),L=new Function(["function ",S,"(",b.join(","),"){",x.join("\n"),"} return ",S].join(""));return L()}var u=t("uniq");e.exports=l},{uniq:459}],117:[function(t,e,r){"use strict";function n(t){var e=["'use strict'","var CACHED={}"],r=[],n=t.funcName+"_cwise_thunk";e.push(["return function ",n,"(",t.shimArgs.join(","),"){"].join(""));for(var o=[],a=[],s=[["array",t.arrayArgs[0],".shape.slice(",Math.max(0,t.arrayBlockIndices[0]),t.arrayBlockIndices[0]<0?","+t.arrayBlockIndices[0]+")":")"].join("")],l=[],u=[],c=0;c<t.arrayArgs.length;++c){var h=t.arrayArgs[c];r.push(["t",h,"=array",h,".dtype,","r",h,"=array",h,".order"].join("")),o.push("t"+h),o.push("r"+h),a.push("t"+h),a.push("r"+h+".join()"),s.push("array"+h+".data"),s.push("array"+h+".stride"),s.push("array"+h+".offset|0"),c>0&&(l.push("array"+t.arrayArgs[0]+".shape.length===array"+h+".shape.length+"+(Math.abs(t.arrayBlockIndices[0])-Math.abs(t.arrayBlockIndices[c]))),u.push("array"+t.arrayArgs[0]+".shape[shapeIndex+"+Math.max(0,t.arrayBlockIndices[0])+"]===array"+h+".shape[shapeIndex+"+Math.max(0,t.arrayBlockIndices[c])+"]"))}t.arrayArgs.length>1&&(e.push("if (!("+l.join(" && ")+")) throw new Error('cwise: Arrays do not all have the same dimensionality!')"),e.push("for(var shapeIndex=array"+t.arrayArgs[0]+".shape.length-"+Math.abs(t.arrayBlockIndices[0])+"; shapeIndex-->0;) {"),e.push("if (!("+u.join(" && ")+")) throw new Error('cwise: Arrays do not all have the same shape!')"),e.push("}"));for(var c=0;c<t.scalarArgs.length;++c)s.push("scalar"+t.scalarArgs[c]);r.push(["type=[",a.join(","),"].join()"].join("")),r.push("proc=CACHED[type]"),e.push("var "+r.join(",")),e.push(["if(!proc){","CACHED[type]=proc=compile([",o.join(","),"])}","return proc(",s.join(","),")}"].join("")),t.debug&&console.log("-----Generated thunk:\n"+e.join("\n")+"\n----------");var f=new Function("compile",e.join("\n"));return f(i.bind(void 0,t))}var i=t("./compile.js");e.exports=n},{"./compile.js":116}],118:[function(t,e,r){e.exports=t("cwise-compiler")},{"cwise-compiler":115}],119:[function(e,r,n){!function(){function e(t){return t&&(t.ownerDocument||t.document||t).documentElement}function n(t){return t&&(t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView)}function i(t,e){return e>t?-1:t>e?1:t>=e?0:NaN}function o(t){return null===t?NaN:+t}function a(t){return!isNaN(t)}function s(t){return{left:function(e,r,n,i){for(arguments.length<3&&(n=0),arguments.length<4&&(i=e.length);i>n;){var o=n+i>>>1;t(e[o],r)<0?n=o+1:i=o}return n},right:function(e,r,n,i){for(arguments.length<3&&(n=0),arguments.length<4&&(i=e.length);i>n;){var o=n+i>>>1;t(e[o],r)>0?i=o:n=o+1}return n}}}function l(t){return t.length}function u(t){for(var e=1;t*e%1;)e*=10;return e}function c(t,e){for(var r in e)Object.defineProperty(t.prototype,r,{value:e[r],enumerable:!1})}function h(){this._=Object.create(null)}function f(t){return(t+="")===Ma||t[0]===ka?ka+t:t}function d(t){return(t+="")[0]===ka?t.slice(1):t}function p(t){return f(t)in this._}function v(t){return(t=f(t))in this._&&delete this._[t]}function m(){var t=[];for(var e in this._)t.push(d(e));return t}function g(){var t=0;for(var e in this._)++t;return t}function y(){for(var t in this._)return!1;return!0}function b(){this._=Object.create(null)}function x(t){return t}function _(t,e,r){return function(){var n=r.apply(e,arguments);return n===e?t:n}}function w(t,e){if(e in t)return e;e=e.charAt(0).toUpperCase()+e.slice(1);for(var r=0,n=Aa.length;n>r;++r){var i=Aa[r]+e;if(i in t)return i}}function M(){}function k(){}function A(t){function e(){for(var e,n=r,i=-1,o=n.length;++i<o;)(e=n[i].on)&&e.apply(this,arguments);return t}var r=[],n=new h;return e.on=function(e,i){var o,a=n.get(e);return arguments.length<2?a&&a.on:(a&&(a.on=null,r=r.slice(0,o=r.indexOf(a)).concat(r.slice(o+1)),n.remove(e)),i&&r.push(n.set(e,{on:i})),t)},e}function T(){ca.event.preventDefault()}function E(){for(var t,e=ca.event;t=e.sourceEvent;)e=t;return e}function S(t){for(var e=new k,r=0,n=arguments.length;++r<n;)e[arguments[r]]=A(e);return e.of=function(r,n){return function(i){try{var o=i.sourceEvent=ca.event;i.target=t,ca.event=i,e[i.type].apply(r,n)}finally{ca.event=o}}},e}function L(t){return Ea(t,Ia),t}function z(t){return"function"==typeof t?t:function(){return Sa(t,this)}}function I(t){return"function"==typeof t?t:function(){return La(t,this)}}function P(t,e){function r(){this.removeAttribute(t)}function n(){this.removeAttributeNS(t.space,t.local)}function i(){this.setAttribute(t,e)}function o(){this.setAttributeNS(t.space,t.local,e)}function a(){var r=e.apply(this,arguments);null==r?this.removeAttribute(t):this.setAttribute(t,r)}function s(){var r=e.apply(this,arguments);null==r?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,r)}return t=ca.ns.qualify(t),null==e?t.local?n:r:"function"==typeof e?t.local?s:a:t.local?o:i}function C(t){return t.trim().replace(/\s+/g," ")}function R(t){return new RegExp("(?:^|\\s+)"+ca.requote(t)+"(?:\\s+|$)","g")}function D(t){return(t+"").trim().split(/^|\s+/)}function O(t,e){function r(){for(var r=-1;++r<i;)t[r](this,e)}function n(){for(var r=-1,n=e.apply(this,arguments);++r<i;)t[r](this,n)}t=D(t).map(F);var i=t.length;return"function"==typeof e?n:r}function F(t){var e=R(t);return function(r,n){if(i=r.classList)return n?i.add(t):i.remove(t);var i=r.getAttribute("class")||"";n?(e.lastIndex=0,e.test(i)||r.setAttribute("class",C(i+" "+t))):r.setAttribute("class",C(i.replace(e," ")))}}function j(t,e,r){function n(){this.style.removeProperty(t)}function i(){this.style.setProperty(t,e,r)}function o(){var n=e.apply(this,arguments);null==n?this.style.removeProperty(t):this.style.setProperty(t,n,r)}return null==e?n:"function"==typeof e?o:i}function N(t,e){function r(){delete this[t]}function n(){this[t]=e}function i(){var r=e.apply(this,arguments);null==r?delete this[t]:this[t]=r}return null==e?r:"function"==typeof e?i:n}function B(t){function e(){var e=this.ownerDocument,r=this.namespaceURI;return r===Pa&&e.documentElement.namespaceURI===Pa?e.createElement(t):e.createElementNS(r,t)}function r(){return this.ownerDocument.createElementNS(t.space,t.local)}return"function"==typeof t?t:(t=ca.ns.qualify(t)).local?r:e}function U(){var t=this.parentNode;t&&t.removeChild(this)}function V(t){return{__data__:t}}function q(t){return function(){return za(this,t)}}function G(t){return arguments.length||(t=i),function(e,r){return e&&r?t(e.__data__,r.__data__):!e-!r}}function H(t,e){for(var r=0,n=t.length;n>r;r++)for(var i,o=t[r],a=0,s=o.length;s>a;a++)(i=o[a])&&e(i,a,r);return t}function X(t){return Ea(t,Ra),t}function Y(t){var e,r;return function(n,i,o){var a,s=t[o].update,l=s.length;for(o!=r&&(r=o,e=0),i>=e&&(e=i+1);!(a=s[e])&&++e<l;);return a}}function W(t,e,r){function n(){var e=this[a];e&&(this.removeEventListener(t,e,e.$),delete this[a])}function i(){var i=l(e,fa(arguments));n.call(this),this.addEventListener(t,this[a]=i,i.$=r),i._=e}function o(){var e,r=new RegExp("^__on([^.]+)"+ca.requote(t)+"$");for(var n in this)if(e=n.match(r)){var i=this[n];this.removeEventListener(e[1],i,i.$),delete this[n]}}var a="__on"+t,s=t.indexOf("."),l=Z;s>0&&(t=t.slice(0,s));var u=Da.get(t);return u&&(t=u,l=K),s?e?i:n:e?M:o}function Z(t,e){return function(r){var n=ca.event;ca.event=r,e[0]=this.__data__;try{t.apply(this,e)}finally{ca.event=n}}}function K(t,e){var r=Z(t,e);return function(t){var e=this,n=t.relatedTarget;n&&(n===e||8&n.compareDocumentPosition(e))||r.call(e,t)}}function J(t){var r=".dragsuppress-"+ ++Fa,i="click"+r,o=ca.select(n(t)).on("touchmove"+r,T).on("dragstart"+r,T).on("selectstart"+r,T);if(null==Oa&&(Oa="onselectstart"in t?!1:w(t.style,"userSelect")),Oa){var a=e(t).style,s=a[Oa];a[Oa]="none"}return function(t){if(o.on(r,null),Oa&&(a[Oa]=s),t){var e=function(){o.on(i,null)};o.on(i,function(){T(),e()},!0),setTimeout(e,0)}}}function $(t,e){e.changedTouches&&(e=e.changedTouches[0]);var r=t.ownerSVGElement||t;if(r.createSVGPoint){var i=r.createSVGPoint();if(0>ja){var o=n(t);if(o.scrollX||o.scrollY){r=ca.select("body").append("svg").style({position:"absolute",top:0,left:0,margin:0,padding:0,border:"none"},"important");var a=r[0][0].getScreenCTM();ja=!(a.f||a.e),r.remove()}}return ja?(i.x=e.pageX,i.y=e.pageY):(i.x=e.clientX,i.y=e.clientY),i=i.matrixTransform(t.getScreenCTM().inverse()),[i.x,i.y]}var s=t.getBoundingClientRect();return[e.clientX-s.left-t.clientLeft,e.clientY-s.top-t.clientTop]}function Q(){return ca.event.changedTouches[0].identifier}function tt(t){return t>0?1:0>t?-1:0}function et(t,e,r){return(e[0]-t[0])*(r[1]-t[1])-(e[1]-t[1])*(r[0]-t[0])}function rt(t){return t>1?0:-1>t?Ua:Math.acos(t)}function nt(t){return t>1?Ga:-1>t?-Ga:Math.asin(t)}function it(t){return((t=Math.exp(t))-1/t)/2}function ot(t){return((t=Math.exp(t))+1/t)/2}function at(t){return((t=Math.exp(2*t))-1)/(t+1)}function st(t){return(t=Math.sin(t/2))*t}function lt(){}function ut(t,e,r){return this instanceof ut?(this.h=+t,this.s=+e,void(this.l=+r)):arguments.length<2?t instanceof ut?new ut(t.h,t.s,t.l):Mt(""+t,kt,ut):new ut(t,e,r)}function ct(t,e,r){function n(t){return t>360?t-=360:0>t&&(t+=360),60>t?o+(a-o)*t/60:180>t?a:240>t?o+(a-o)*(240-t)/60:o}function i(t){return Math.round(255*n(t))}var o,a;return t=isNaN(t)?0:(t%=360)<0?t+360:t,e=isNaN(e)?0:0>e?0:e>1?1:e,r=0>r?0:r>1?1:r,a=.5>=r?r*(1+e):r+e-r*e,o=2*r-a,new bt(i(t+120),i(t),i(t-120))}function ht(t,e,r){return this instanceof ht?(this.h=+t,this.c=+e,void(this.l=+r)):arguments.length<2?t instanceof ht?new ht(t.h,t.c,t.l):t instanceof dt?vt(t.l,t.a,t.b):vt((t=At((t=ca.rgb(t)).r,t.g,t.b)).l,t.a,t.b):new ht(t,e,r)}function ft(t,e,r){return isNaN(t)&&(t=0),isNaN(e)&&(e=0),new dt(r,Math.cos(t*=Ha)*e,Math.sin(t)*e)}function dt(t,e,r){return this instanceof dt?(this.l=+t,this.a=+e,void(this.b=+r)):arguments.length<2?t instanceof dt?new dt(t.l,t.a,t.b):t instanceof ht?ft(t.h,t.c,t.l):At((t=bt(t)).r,t.g,t.b):new dt(t,e,r)}function pt(t,e,r){var n=(t+16)/116,i=n+e/500,o=n-r/200;return i=mt(i)*rs,n=mt(n)*ns,o=mt(o)*is,new bt(yt(3.2404542*i-1.5371385*n-.4985314*o),yt(-.969266*i+1.8760108*n+.041556*o),yt(.0556434*i-.2040259*n+1.0572252*o))}function vt(t,e,r){return t>0?new ht(Math.atan2(r,e)*Xa,Math.sqrt(e*e+r*r),t):new ht(NaN,NaN,t)}function mt(t){return t>.206893034?t*t*t:(t-4/29)/7.787037}function gt(t){return t>.008856?Math.pow(t,1/3):7.787037*t+4/29}function yt(t){return Math.round(255*(.00304>=t?12.92*t:1.055*Math.pow(t,1/2.4)-.055))}function bt(t,e,r){return this instanceof bt?(this.r=~~t,this.g=~~e,void(this.b=~~r)):arguments.length<2?t instanceof bt?new bt(t.r,t.g,t.b):Mt(""+t,bt,ct):new bt(t,e,r)}function xt(t){return new bt(t>>16,t>>8&255,255&t)}function _t(t){return xt(t)+""}function wt(t){return 16>t?"0"+Math.max(0,t).toString(16):Math.min(255,t).toString(16)}function Mt(t,e,r){var n,i,o,a=0,s=0,l=0;if(n=/([a-z]+)\((.*)\)/.exec(t=t.toLowerCase()))switch(i=n[2].split(","),n[1]){case"hsl":return r(parseFloat(i[0]),parseFloat(i[1])/100,parseFloat(i[2])/100);case"rgb":return e(Et(i[0]),Et(i[1]),Et(i[2]))}return(o=ss.get(t))?e(o.r,o.g,o.b):(null==t||"#"!==t.charAt(0)||isNaN(o=parseInt(t.slice(1),16))||(4===t.length?(a=(3840&o)>>4,a=a>>4|a,s=240&o,s=s>>4|s,l=15&o,l=l<<4|l):7===t.length&&(a=(16711680&o)>>16,s=(65280&o)>>8,l=255&o)),e(a,s,l))}function kt(t,e,r){var n,i,o=Math.min(t/=255,e/=255,r/=255),a=Math.max(t,e,r),s=a-o,l=(a+o)/2;return s?(i=.5>l?s/(a+o):s/(2-a-o),n=t==a?(e-r)/s+(r>e?6:0):e==a?(r-t)/s+2:(t-e)/s+4,n*=60):(n=NaN,i=l>0&&1>l?0:n),new ut(n,i,l)}function At(t,e,r){t=Tt(t),e=Tt(e),r=Tt(r);var n=gt((.4124564*t+.3575761*e+.1804375*r)/rs),i=gt((.2126729*t+.7151522*e+.072175*r)/ns),o=gt((.0193339*t+.119192*e+.9503041*r)/is);return dt(116*i-16,500*(n-i),200*(i-o))}function Tt(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Et(t){var e=parseFloat(t);return"%"===t.charAt(t.length-1)?Math.round(2.55*e):e}function St(t){return"function"==typeof t?t:function(){return t}}function Lt(t){return function(e,r,n){return 2===arguments.length&&"function"==typeof r&&(n=r,r=null),zt(e,r,t,n)}}function zt(t,e,r,n){function i(){var t,e=l.status;if(!e&&Pt(l)||e>=200&&300>e||304===e){try{t=r.call(o,l)}catch(n){return void a.error.call(o,n)}a.load.call(o,t)}else a.error.call(o,l)}var o={},a=ca.dispatch("beforesend","progress","load","error"),s={},l=new XMLHttpRequest,u=null;return!this.XDomainRequest||"withCredentials"in l||!/^(http(s)?:)?\/\//.test(t)||(l=new XDomainRequest),"onload"in l?l.onload=l.onerror=i:l.onreadystatechange=function(){l.readyState>3&&i()},l.onprogress=function(t){var e=ca.event;ca.event=t;try{a.progress.call(o,l)}finally{ca.event=e}},o.header=function(t,e){return t=(t+"").toLowerCase(),arguments.length<2?s[t]:(null==e?delete s[t]:s[t]=e+"",o)},o.mimeType=function(t){return arguments.length?(e=null==t?null:t+"",o):e},o.responseType=function(t){return arguments.length?(u=t,o):u},o.response=function(t){return r=t,o},["get","post"].forEach(function(t){o[t]=function(){return o.send.apply(o,[t].concat(fa(arguments)))}}),o.send=function(r,n,i){if(2===arguments.length&&"function"==typeof n&&(i=n,n=null),l.open(r,t,!0),null==e||"accept"in s||(s.accept=e+",*/*"),l.setRequestHeader)for(var c in s)l.setRequestHeader(c,s[c]);return null!=e&&l.overrideMimeType&&l.overrideMimeType(e),null!=u&&(l.responseType=u),null!=i&&o.on("error",i).on("load",function(t){i(null,t)}),a.beforesend.call(o,l),l.send(null==n?null:n),o},o.abort=function(){return l.abort(),o},ca.rebind(o,a,"on"),null==n?o:o.get(It(n))}function It(t){return 1===t.length?function(e,r){t(null==e?r:null)}:t}function Pt(t){var e=t.responseType;return e&&"text"!==e?t.response:t.responseText}function Ct(t,e,r){var n=arguments.length;2>n&&(e=0),3>n&&(r=Date.now());var i=r+e,o={c:t,t:i,n:null};return us?us.n=o:ls=o,us=o,cs||(hs=clearTimeout(hs),cs=1,fs(Rt)),o}function Rt(){var t=Dt(),e=Ot()-t;e>24?(isFinite(e)&&(clearTimeout(hs),hs=setTimeout(Rt,e)),cs=0):(cs=1,fs(Rt))}function Dt(){for(var t=Date.now(),e=ls;e;)t>=e.t&&e.c(t-e.t)&&(e.c=null),e=e.n;return t}function Ot(){for(var t,e=ls,r=1/0;e;)e.c?(e.t<r&&(r=e.t),e=(t=e).n):e=t?t.n=e.n:ls=e.n;return us=t,r}function Ft(t,e){return e-(t?Math.ceil(Math.log(t)/Math.LN10):1)}function jt(t,e){var r=Math.pow(10,3*wa(8-e));return{scale:e>8?function(t){return t/r}:function(t){return t*r},symbol:t}}function Nt(t){var e=t.decimal,r=t.thousands,n=t.grouping,i=t.currency,o=n&&r?function(t,e){for(var i=t.length,o=[],a=0,s=n[0],l=0;i>0&&s>0&&(l+s+1>e&&(s=Math.max(1,e-l)),o.push(t.substring(i-=s,i+s)),!((l+=s+1)>e));)s=n[a=(a+1)%n.length];return o.reverse().join(r)}:x;return function(t){var r=ps.exec(t),n=r[1]||" ",a=r[2]||">",s=r[3]||"-",l=r[4]||"",u=r[5],c=+r[6],h=r[7],f=r[8],d=r[9],p=1,v="",m="",g=!1,y=!0;switch(f&&(f=+f.substring(1)),(u||"0"===n&&"="===a)&&(u=n="0",a="="),d){case"n":h=!0,d="g";break;case"%":p=100,m="%",d="f";break;case"p":p=100,m="%",d="r";break;case"b":case"o":case"x":case"X":"#"===l&&(v="0"+d.toLowerCase());case"c":y=!1;case"d":g=!0,f=0;break;case"s":p=-1,d="r"}"$"===l&&(v=i[0],m=i[1]),"r"!=d||f||(d="g"),null!=f&&("g"==d?f=Math.max(1,Math.min(21,f)):"e"!=d&&"f"!=d||(f=Math.max(0,Math.min(20,f)))),d=vs.get(d)||Bt;var b=u&&h;return function(t){var r=m;if(g&&t%1)return"";var i=0>t||0===t&&0>1/t?(t=-t,"-"):"-"===s?"":s;if(0>p){var l=ca.formatPrefix(t,f);t=l.scale(t),r=l.symbol+m}else t*=p;t=d(t,f);var x,_,w=t.lastIndexOf(".");if(0>w){var M=y?t.lastIndexOf("e"):-1;0>M?(x=t,_=""):(x=t.substring(0,M),_=t.substring(M))}else x=t.substring(0,w),_=e+t.substring(w+1);!u&&h&&(x=o(x,1/0));var k=v.length+x.length+_.length+(b?0:i.length),A=c>k?new Array(k=c-k+1).join(n):"";return b&&(x=o(A+x,A.length?c-_.length:1/0)),i+=v,t=x+_,("<"===a?i+t+A:">"===a?A+i+t:"^"===a?A.substring(0,k>>=1)+i+t+A.substring(k):i+(b?t:A+t))+r}}}function Bt(t){return t+""}function Ut(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}function Vt(t,e,r){function n(e){var r=t(e),n=o(r,1);return n-e>e-r?r:n}function i(r){return e(r=t(new gs(r-1)),1),r}function o(t,r){return e(t=new gs(+t),r),t}function a(t,n,o){var a=i(t),s=[];if(o>1)for(;n>a;)r(a)%o||s.push(new Date(+a)),e(a,1);else for(;n>a;)s.push(new Date(+a)),e(a,1);return s}function s(t,e,r){try{gs=Ut;var n=new Ut;return n._=t,a(n,e,r)}finally{gs=Date}}t.floor=t,t.round=n,t.ceil=i,t.offset=o,t.range=a;var l=t.utc=qt(t);return l.floor=l,l.round=qt(n),l.ceil=qt(i),l.offset=qt(o),l.range=s,t}function qt(t){return function(e,r){try{gs=Ut;var n=new Ut;return n._=e,t(n,r)._}finally{gs=Date}}}function Gt(t){function e(t){function e(e){for(var r,i,o,a=[],s=-1,l=0;++s<n;)37===t.charCodeAt(s)&&(a.push(t.slice(l,s)),null!=(i=bs[r=t.charAt(++s)])&&(r=t.charAt(++s)),(o=S[r])&&(r=o(e,null==i?"e"===r?" ":"0":i)),a.push(r),l=s+1);return a.push(t.slice(l,s)),a.join("")}var n=t.length;return e.parse=function(e){var n={y:1900,m:0,d:1,H:0,M:0,S:0,L:0,Z:null},i=r(n,t,e,0);if(i!=e.length)return null;"p"in n&&(n.H=n.H%12+12*n.p);var o=null!=n.Z&&gs!==Ut,a=new(o?Ut:gs);return"j"in n?a.setFullYear(n.y,0,n.j):"W"in n||"U"in n?("w"in n||(n.w="W"in n?1:0),a.setFullYear(n.y,0,1),a.setFullYear(n.y,0,"W"in n?(n.w+6)%7+7*n.W-(a.getDay()+5)%7:n.w+7*n.U-(a.getDay()+6)%7)):a.setFullYear(n.y,n.m,n.d),a.setHours(n.H+(n.Z/100|0),n.M+n.Z%100,n.S,n.L),o?a._:a},e.toString=function(){return t},e}function r(t,e,r,n){for(var i,o,a,s=0,l=e.length,u=r.length;l>s;){if(n>=u)return-1;if(i=e.charCodeAt(s++),37===i){if(a=e.charAt(s++),o=L[a in bs?e.charAt(s++):a],!o||(n=o(t,r,n))<0)return-1}else if(i!=r.charCodeAt(n++))return-1}return n}function n(t,e,r){w.lastIndex=0;var n=w.exec(e.slice(r));return n?(t.w=M.get(n[0].toLowerCase()),r+n[0].length):-1}function i(t,e,r){x.lastIndex=0;var n=x.exec(e.slice(r));return n?(t.w=_.get(n[0].toLowerCase()),r+n[0].length):-1}function o(t,e,r){T.lastIndex=0;var n=T.exec(e.slice(r));return n?(t.m=E.get(n[0].toLowerCase()),r+n[0].length):-1}function a(t,e,r){k.lastIndex=0;var n=k.exec(e.slice(r));return n?(t.m=A.get(n[0].toLowerCase()),r+n[0].length):-1}function s(t,e,n){return r(t,S.c.toString(),e,n)}function l(t,e,n){return r(t,S.x.toString(),e,n)}function u(t,e,n){return r(t,S.X.toString(),e,n)}function c(t,e,r){var n=b.get(e.slice(r,r+=2).toLowerCase());return null==n?-1:(t.p=n,r)}var h=t.dateTime,f=t.date,d=t.time,p=t.periods,v=t.days,m=t.shortDays,g=t.months,y=t.shortMonths;e.utc=function(t){function r(t){try{gs=Ut;var e=new gs;return e._=t,n(e)}finally{gs=Date}}var n=e(t);return r.parse=function(t){try{gs=Ut;var e=n.parse(t);return e&&e._}finally{gs=Date}},r.toString=n.toString,r},e.multi=e.utc.multi=ce;var b=ca.map(),x=Xt(v),_=Yt(v),w=Xt(m),M=Yt(m),k=Xt(g),A=Yt(g),T=Xt(y),E=Yt(y);p.forEach(function(t,e){b.set(t.toLowerCase(),e)});var S={a:function(t){return m[t.getDay()]},A:function(t){return v[t.getDay()]},b:function(t){return y[t.getMonth()]},B:function(t){return g[t.getMonth()]},c:e(h),d:function(t,e){return Ht(t.getDate(),e,2)},e:function(t,e){return Ht(t.getDate(),e,2)},H:function(t,e){return Ht(t.getHours(),e,2)},I:function(t,e){return Ht(t.getHours()%12||12,e,2)},j:function(t,e){return Ht(1+ms.dayOfYear(t),e,3)},L:function(t,e){return Ht(t.getMilliseconds(),e,3)},m:function(t,e){return Ht(t.getMonth()+1,e,2)},M:function(t,e){return Ht(t.getMinutes(),e,2)},p:function(t){return p[+(t.getHours()>=12)]},S:function(t,e){return Ht(t.getSeconds(),e,2)},U:function(t,e){return Ht(ms.sundayOfYear(t),e,2)},w:function(t){return t.getDay()},W:function(t,e){return Ht(ms.mondayOfYear(t),e,2)},x:e(f),X:e(d),y:function(t,e){return Ht(t.getFullYear()%100,e,2)},Y:function(t,e){return Ht(t.getFullYear()%1e4,e,4)},Z:le,"%":function(){return"%"}},L={a:n,A:i,b:o,B:a,c:s,d:re,e:re,H:ie,I:ie,j:ne,L:se,m:ee,M:oe,p:c,S:ae,U:Zt,w:Wt,W:Kt,x:l,X:u,y:$t,Y:Jt,Z:Qt,"%":ue};return e}function Ht(t,e,r){var n=0>t?"-":"",i=(n?-t:t)+"",o=i.length;return n+(r>o?new Array(r-o+1).join(e)+i:i)}function Xt(t){return new RegExp("^(?:"+t.map(ca.requote).join("|")+")","i")}function Yt(t){for(var e=new h,r=-1,n=t.length;++r<n;)e.set(t[r].toLowerCase(),r);return e}function Wt(t,e,r){xs.lastIndex=0;var n=xs.exec(e.slice(r,r+1));return n?(t.w=+n[0],r+n[0].length):-1}function Zt(t,e,r){xs.lastIndex=0;var n=xs.exec(e.slice(r));return n?(t.U=+n[0],r+n[0].length):-1}function Kt(t,e,r){xs.lastIndex=0;var n=xs.exec(e.slice(r));return n?(t.W=+n[0],r+n[0].length):-1}function Jt(t,e,r){xs.lastIndex=0;var n=xs.exec(e.slice(r,r+4));return n?(t.y=+n[0],r+n[0].length):-1}function $t(t,e,r){xs.lastIndex=0;var n=xs.exec(e.slice(r,r+2));return n?(t.y=te(+n[0]),r+n[0].length):-1}function Qt(t,e,r){return/^[+-]\d{4}$/.test(e=e.slice(r,r+5))?(t.Z=-e,r+5):-1}function te(t){return t+(t>68?1900:2e3)}function ee(t,e,r){xs.lastIndex=0;var n=xs.exec(e.slice(r,r+2));return n?(t.m=n[0]-1,r+n[0].length):-1}function re(t,e,r){xs.lastIndex=0;var n=xs.exec(e.slice(r,r+2));return n?(t.d=+n[0],r+n[0].length):-1}function ne(t,e,r){xs.lastIndex=0;var n=xs.exec(e.slice(r,r+3));return n?(t.j=+n[0],r+n[0].length):-1}function ie(t,e,r){xs.lastIndex=0;var n=xs.exec(e.slice(r,r+2));return n?(t.H=+n[0],r+n[0].length):-1}function oe(t,e,r){xs.lastIndex=0;var n=xs.exec(e.slice(r,r+2));return n?(t.M=+n[0],r+n[0].length):-1}function ae(t,e,r){xs.lastIndex=0;var n=xs.exec(e.slice(r,r+2));return n?(t.S=+n[0],r+n[0].length):-1}function se(t,e,r){xs.lastIndex=0;var n=xs.exec(e.slice(r,r+3));return n?(t.L=+n[0],r+n[0].length):-1}function le(t){var e=t.getTimezoneOffset(),r=e>0?"-":"+",n=wa(e)/60|0,i=wa(e)%60;return r+Ht(n,"0",2)+Ht(i,"0",2)}function ue(t,e,r){_s.lastIndex=0;var n=_s.exec(e.slice(r,r+1));return n?r+n[0].length:-1}function ce(t){for(var e=t.length,r=-1;++r<e;)t[r][0]=this(t[r][0]);return function(e){for(var r=0,n=t[r];!n[1](e);)n=t[++r];return n[0](e)}}function he(){}function fe(t,e,r){var n=r.s=t+e,i=n-t,o=n-i;r.t=t-o+(e-i)}function de(t,e){t&&As.hasOwnProperty(t.type)&&As[t.type](t,e)}function pe(t,e,r){var n,i=-1,o=t.length-r;for(e.lineStart();++i<o;)n=t[i],e.point(n[0],n[1],n[2]);e.lineEnd()}function ve(t,e){var r=-1,n=t.length;for(e.polygonStart();++r<n;)pe(t[r],e,1);e.polygonEnd()}function me(){function t(t,e){t*=Ha,e=e*Ha/2+Ua/4;var r=t-n,a=r>=0?1:-1,s=a*r,l=Math.cos(e),u=Math.sin(e),c=o*u,h=i*l+c*Math.cos(s),f=c*a*Math.sin(s);Es.add(Math.atan2(f,h)),n=t,i=l,o=u}var e,r,n,i,o;Ss.point=function(a,s){Ss.point=t,n=(e=a)*Ha,i=Math.cos(s=(r=s)*Ha/2+Ua/4),o=Math.sin(s)},Ss.lineEnd=function(){t(e,r)}}function ge(t){var e=t[0],r=t[1],n=Math.cos(r);return[n*Math.cos(e),n*Math.sin(e),Math.sin(r)]}function ye(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function be(t,e){return[t[1]*e[2]-t[2]*e[1],t[2]*e[0]-t[0]*e[2],t[0]*e[1]-t[1]*e[0]]}function xe(t,e){t[0]+=e[0],t[1]+=e[1],t[2]+=e[2]}function _e(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function we(t){var e=Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=e,t[1]/=e,t[2]/=e}function Me(t){return[Math.atan2(t[1],t[0]),nt(t[2])]}function ke(t,e){return wa(t[0]-e[0])<Na&&wa(t[1]-e[1])<Na}function Ae(t,e){t*=Ha;var r=Math.cos(e*=Ha);Te(r*Math.cos(t),r*Math.sin(t),Math.sin(e))}function Te(t,e,r){++Ls,Is+=(t-Is)/Ls,Ps+=(e-Ps)/Ls,Cs+=(r-Cs)/Ls}function Ee(){function t(t,i){t*=Ha;var o=Math.cos(i*=Ha),a=o*Math.cos(t),s=o*Math.sin(t),l=Math.sin(i),u=Math.atan2(Math.sqrt((u=r*l-n*s)*u+(u=n*a-e*l)*u+(u=e*s-r*a)*u),e*a+r*s+n*l);zs+=u,Rs+=u*(e+(e=a)),Ds+=u*(r+(r=s)),Os+=u*(n+(n=l)),Te(e,r,n)}var e,r,n;Bs.point=function(i,o){i*=Ha;var a=Math.cos(o*=Ha);e=a*Math.cos(i),r=a*Math.sin(i),n=Math.sin(o),Bs.point=t,Te(e,r,n)}}function Se(){Bs.point=Ae}function Le(){function t(t,e){t*=Ha;var r=Math.cos(e*=Ha),a=r*Math.cos(t),s=r*Math.sin(t),l=Math.sin(e),u=i*l-o*s,c=o*a-n*l,h=n*s-i*a,f=Math.sqrt(u*u+c*c+h*h),d=n*a+i*s+o*l,p=f&&-rt(d)/f,v=Math.atan2(f,d);Fs+=p*u,js+=p*c,Ns+=p*h,zs+=v,Rs+=v*(n+(n=a)),Ds+=v*(i+(i=s)),Os+=v*(o+(o=l)),Te(n,i,o)}var e,r,n,i,o;Bs.point=function(a,s){e=a,r=s,Bs.point=t,a*=Ha;var l=Math.cos(s*=Ha);n=l*Math.cos(a),i=l*Math.sin(a),o=Math.sin(s),Te(n,i,o)},Bs.lineEnd=function(){t(e,r),Bs.lineEnd=Se,Bs.point=Ae}}function ze(t,e){function r(r,n){return r=t(r,n),e(r[0],r[1])}return t.invert&&e.invert&&(r.invert=function(r,n){return r=e.invert(r,n),r&&t.invert(r[0],r[1])}),r}function Ie(){return!0}function Pe(t,e,r,n,i){var o=[],a=[];if(t.forEach(function(t){if(!((e=t.length-1)<=0)){var e,r=t[0],n=t[e];if(ke(r,n)){i.lineStart();for(var s=0;e>s;++s)i.point((r=t[s])[0],r[1]);return void i.lineEnd()}var l=new Re(r,t,null,!0),u=new Re(r,null,l,!1);l.o=u,o.push(l),a.push(u),l=new Re(n,t,null,!1),u=new Re(n,null,l,!0),l.o=u,o.push(l),a.push(u)}}),a.sort(e),Ce(o),Ce(a),o.length){for(var s=0,l=r,u=a.length;u>s;++s)a[s].e=l=!l;for(var c,h,f=o[0];;){for(var d=f,p=!0;d.v;)if((d=d.n)===f)return;c=d.z,i.lineStart();do{if(d.v=d.o.v=!0,d.e){if(p)for(var s=0,u=c.length;u>s;++s)i.point((h=c[s])[0],h[1]);else n(d.x,d.n.x,1,i);d=d.n}else{if(p){c=d.p.z;for(var s=c.length-1;s>=0;--s)i.point((h=c[s])[0],h[1])}else n(d.x,d.p.x,-1,i);d=d.p}d=d.o,c=d.z,p=!p}while(!d.v);i.lineEnd()}}}function Ce(t){if(e=t.length){for(var e,r,n=0,i=t[0];++n<e;)i.n=r=t[n],r.p=i,i=r;i.n=r=t[0],r.p=i}}function Re(t,e,r,n){this.x=t,this.z=e,this.o=r,this.e=n,this.v=!1,this.n=this.p=null}function De(t,e,r,n){return function(i,o){function a(e,r){var n=i(e,r);t(e=n[0],r=n[1])&&o.point(e,r)}function s(t,e){var r=i(t,e);m.point(r[0],r[1])}function l(){y.point=s,m.lineStart()}function u(){y.point=a,m.lineEnd()}function c(t,e){v.push([t,e]);var r=i(t,e);x.point(r[0],r[1])}function h(){x.lineStart(),v=[]}function f(){c(v[0][0],v[0][1]),x.lineEnd();var t,e=x.clean(),r=b.buffer(),n=r.length;if(v.pop(),p.push(v),v=null,n)if(1&e){t=r[0];var i,n=t.length-1,a=-1;if(n>0){for(_||(o.polygonStart(),_=!0),o.lineStart();++a<n;)o.point((i=t[a])[0],i[1]);o.lineEnd()}}else n>1&&2&e&&r.push(r.pop().concat(r.shift())),d.push(r.filter(Oe))}var d,p,v,m=e(o),g=i.invert(n[0],n[1]),y={point:a,lineStart:l,lineEnd:u,polygonStart:function(){y.point=c,y.lineStart=h,y.lineEnd=f,d=[],p=[]},polygonEnd:function(){y.point=a,y.lineStart=l,y.lineEnd=u,d=ca.merge(d);var t=Ve(g,p);d.length?(_||(o.polygonStart(),_=!0),Pe(d,je,t,r,o)):t&&(_||(o.polygonStart(),_=!0),o.lineStart(),r(null,null,1,o),o.lineEnd()),_&&(o.polygonEnd(),_=!1),d=p=null},sphere:function(){o.polygonStart(),o.lineStart(),r(null,null,1,o),o.lineEnd(),o.polygonEnd()}},b=Fe(),x=e(b),_=!1;return y}}function Oe(t){return t.length>1}function Fe(){var t,e=[];return{lineStart:function(){e.push(t=[])},point:function(e,r){t.push([e,r])},lineEnd:M,buffer:function(){var r=e;return e=[],
t=null,r},rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))}}}function je(t,e){return((t=t.x)[0]<0?t[1]-Ga-Na:Ga-t[1])-((e=e.x)[0]<0?e[1]-Ga-Na:Ga-e[1])}function Ne(t){var e,r=NaN,n=NaN,i=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(o,a){var s=o>0?Ua:-Ua,l=wa(o-r);wa(l-Ua)<Na?(t.point(r,n=(n+a)/2>0?Ga:-Ga),t.point(i,n),t.lineEnd(),t.lineStart(),t.point(s,n),t.point(o,n),e=0):i!==s&&l>=Ua&&(wa(r-i)<Na&&(r-=i*Na),wa(o-s)<Na&&(o-=s*Na),n=Be(r,n,o,a),t.point(i,n),t.lineEnd(),t.lineStart(),t.point(s,n),e=0),t.point(r=o,n=a),i=s},lineEnd:function(){t.lineEnd(),r=n=NaN},clean:function(){return 2-e}}}function Be(t,e,r,n){var i,o,a=Math.sin(t-r);return wa(a)>Na?Math.atan((Math.sin(e)*(o=Math.cos(n))*Math.sin(r)-Math.sin(n)*(i=Math.cos(e))*Math.sin(t))/(i*o*a)):(e+n)/2}function Ue(t,e,r,n){var i;if(null==t)i=r*Ga,n.point(-Ua,i),n.point(0,i),n.point(Ua,i),n.point(Ua,0),n.point(Ua,-i),n.point(0,-i),n.point(-Ua,-i),n.point(-Ua,0),n.point(-Ua,i);else if(wa(t[0]-e[0])>Na){var o=t[0]<e[0]?Ua:-Ua;i=r*o/2,n.point(-o,i),n.point(0,i),n.point(o,i)}else n.point(e[0],e[1])}function Ve(t,e){var r=t[0],n=t[1],i=[Math.sin(r),-Math.cos(r),0],o=0,a=0;Es.reset();for(var s=0,l=e.length;l>s;++s){var u=e[s],c=u.length;if(c)for(var h=u[0],f=h[0],d=h[1]/2+Ua/4,p=Math.sin(d),v=Math.cos(d),m=1;;){m===c&&(m=0),t=u[m];var g=t[0],y=t[1]/2+Ua/4,b=Math.sin(y),x=Math.cos(y),_=g-f,w=_>=0?1:-1,M=w*_,k=M>Ua,A=p*b;if(Es.add(Math.atan2(A*w*Math.sin(M),v*x+A*Math.cos(M))),o+=k?_+w*Va:_,k^f>=r^g>=r){var T=be(ge(h),ge(t));we(T);var E=be(i,T);we(E);var S=(k^_>=0?-1:1)*nt(E[2]);(n>S||n===S&&(T[0]||T[1]))&&(a+=k^_>=0?1:-1)}if(!m++)break;f=g,p=b,v=x,h=t}}return(-Na>o||Na>o&&0>Es)^1&a}function qe(t){function e(t,e){return Math.cos(t)*Math.cos(e)>o}function r(t){var r,o,l,u,c;return{lineStart:function(){u=l=!1,c=1},point:function(h,f){var d,p=[h,f],v=e(h,f),m=a?v?0:i(h,f):v?i(h+(0>h?Ua:-Ua),f):0;if(!r&&(u=l=v)&&t.lineStart(),v!==l&&(d=n(r,p),(ke(r,d)||ke(p,d))&&(p[0]+=Na,p[1]+=Na,v=e(p[0],p[1]))),v!==l)c=0,v?(t.lineStart(),d=n(p,r),t.point(d[0],d[1])):(d=n(r,p),t.point(d[0],d[1]),t.lineEnd()),r=d;else if(s&&r&&a^v){var g;m&o||!(g=n(p,r,!0))||(c=0,a?(t.lineStart(),t.point(g[0][0],g[0][1]),t.point(g[1][0],g[1][1]),t.lineEnd()):(t.point(g[1][0],g[1][1]),t.lineEnd(),t.lineStart(),t.point(g[0][0],g[0][1])))}!v||r&&ke(r,p)||t.point(p[0],p[1]),r=p,l=v,o=m},lineEnd:function(){l&&t.lineEnd(),r=null},clean:function(){return c|(u&&l)<<1}}}function n(t,e,r){var n=ge(t),i=ge(e),a=[1,0,0],s=be(n,i),l=ye(s,s),u=s[0],c=l-u*u;if(!c)return!r&&t;var h=o*l/c,f=-o*u/c,d=be(a,s),p=_e(a,h),v=_e(s,f);xe(p,v);var m=d,g=ye(p,m),y=ye(m,m),b=g*g-y*(ye(p,p)-1);if(!(0>b)){var x=Math.sqrt(b),_=_e(m,(-g-x)/y);if(xe(_,p),_=Me(_),!r)return _;var w,M=t[0],k=e[0],A=t[1],T=e[1];M>k&&(w=M,M=k,k=w);var E=k-M,S=wa(E-Ua)<Na,L=S||Na>E;if(!S&&A>T&&(w=A,A=T,T=w),L?S?A+T>0^_[1]<(wa(_[0]-M)<Na?A:T):A<=_[1]&&_[1]<=T:E>Ua^(M<=_[0]&&_[0]<=k)){var z=_e(m,(-g+x)/y);return xe(z,p),[_,Me(z)]}}}function i(e,r){var n=a?t:Ua-t,i=0;return-n>e?i|=1:e>n&&(i|=2),-n>r?i|=4:r>n&&(i|=8),i}var o=Math.cos(t),a=o>0,s=wa(o)>Na,l=mr(t,6*Ha);return De(e,r,l,a?[0,-t]:[-Ua,t-Ua])}function Ge(t,e,r,n){return function(i){var o,a=i.a,s=i.b,l=a.x,u=a.y,c=s.x,h=s.y,f=0,d=1,p=c-l,v=h-u;if(o=t-l,p||!(o>0)){if(o/=p,0>p){if(f>o)return;d>o&&(d=o)}else if(p>0){if(o>d)return;o>f&&(f=o)}if(o=r-l,p||!(0>o)){if(o/=p,0>p){if(o>d)return;o>f&&(f=o)}else if(p>0){if(f>o)return;d>o&&(d=o)}if(o=e-u,v||!(o>0)){if(o/=v,0>v){if(f>o)return;d>o&&(d=o)}else if(v>0){if(o>d)return;o>f&&(f=o)}if(o=n-u,v||!(0>o)){if(o/=v,0>v){if(o>d)return;o>f&&(f=o)}else if(v>0){if(f>o)return;d>o&&(d=o)}return f>0&&(i.a={x:l+f*p,y:u+f*v}),1>d&&(i.b={x:l+d*p,y:u+d*v}),i}}}}}}function He(t,e,r,n){function i(n,i){return wa(n[0]-t)<Na?i>0?0:3:wa(n[0]-r)<Na?i>0?2:1:wa(n[1]-e)<Na?i>0?1:0:i>0?3:2}function o(t,e){return a(t.x,e.x)}function a(t,e){var r=i(t,1),n=i(e,1);return r!==n?r-n:0===r?e[1]-t[1]:1===r?t[0]-e[0]:2===r?t[1]-e[1]:e[0]-t[0]}return function(s){function l(t){for(var e=0,r=m.length,n=t[1],i=0;r>i;++i)for(var o,a=1,s=m[i],l=s.length,u=s[0];l>a;++a)o=s[a],u[1]<=n?o[1]>n&&et(u,o,t)>0&&++e:o[1]<=n&&et(u,o,t)<0&&--e,u=o;return 0!==e}function u(o,s,l,u){var c=0,h=0;if(null==o||(c=i(o,l))!==(h=i(s,l))||a(o,s)<0^l>0){do u.point(0===c||3===c?t:r,c>1?n:e);while((c=(c+l+4)%4)!==h)}else u.point(s[0],s[1])}function c(i,o){return i>=t&&r>=i&&o>=e&&n>=o}function h(t,e){c(t,e)&&s.point(t,e)}function f(){L.point=p,m&&m.push(g=[]),k=!0,M=!1,_=w=NaN}function d(){v&&(p(y,b),x&&M&&E.rejoin(),v.push(E.buffer())),L.point=h,M&&s.lineEnd()}function p(t,e){t=Math.max(-Vs,Math.min(Vs,t)),e=Math.max(-Vs,Math.min(Vs,e));var r=c(t,e);if(m&&g.push([t,e]),k)y=t,b=e,x=r,k=!1,r&&(s.lineStart(),s.point(t,e));else if(r&&M)s.point(t,e);else{var n={a:{x:_,y:w},b:{x:t,y:e}};S(n)?(M||(s.lineStart(),s.point(n.a.x,n.a.y)),s.point(n.b.x,n.b.y),r||s.lineEnd(),A=!1):r&&(s.lineStart(),s.point(t,e),A=!1)}_=t,w=e,M=r}var v,m,g,y,b,x,_,w,M,k,A,T=s,E=Fe(),S=Ge(t,e,r,n),L={point:h,lineStart:f,lineEnd:d,polygonStart:function(){s=E,v=[],m=[],A=!0},polygonEnd:function(){s=T,v=ca.merge(v);var e=l([t,n]),r=A&&e,i=v.length;(r||i)&&(s.polygonStart(),r&&(s.lineStart(),u(null,null,1,s),s.lineEnd()),i&&Pe(v,o,e,u,s),s.polygonEnd()),v=m=g=null}};return L}}function Xe(t){var e=0,r=Ua/3,n=lr(t),i=n(e,r);return i.parallels=function(t){return arguments.length?n(e=t[0]*Ua/180,r=t[1]*Ua/180):[e/Ua*180,r/Ua*180]},i}function Ye(t,e){function r(t,e){var r=Math.sqrt(o-2*i*Math.sin(e))/i;return[r*Math.sin(t*=i),a-r*Math.cos(t)]}var n=Math.sin(t),i=(n+Math.sin(e))/2,o=1+n*(2*i-n),a=Math.sqrt(o)/i;return r.invert=function(t,e){var r=a-e;return[Math.atan2(t,r)/i,nt((o-(t*t+r*r)*i*i)/(2*i))]},r}function We(){function t(t,e){Gs+=i*t-n*e,n=t,i=e}var e,r,n,i;Zs.point=function(o,a){Zs.point=t,e=n=o,r=i=a},Zs.lineEnd=function(){t(e,r)}}function Ze(t,e){Hs>t&&(Hs=t),t>Ys&&(Ys=t),Xs>e&&(Xs=e),e>Ws&&(Ws=e)}function Ke(){function t(t,e){a.push("M",t,",",e,o)}function e(t,e){a.push("M",t,",",e),s.point=r}function r(t,e){a.push("L",t,",",e)}function n(){s.point=t}function i(){a.push("Z")}var o=Je(4.5),a=[],s={point:t,lineStart:function(){s.point=e},lineEnd:n,polygonStart:function(){s.lineEnd=i},polygonEnd:function(){s.lineEnd=n,s.point=t},pointRadius:function(t){return o=Je(t),s},result:function(){if(a.length){var t=a.join("");return a=[],t}}};return s}function Je(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function $e(t,e){Is+=t,Ps+=e,++Cs}function Qe(){function t(t,n){var i=t-e,o=n-r,a=Math.sqrt(i*i+o*o);Rs+=a*(e+t)/2,Ds+=a*(r+n)/2,Os+=a,$e(e=t,r=n)}var e,r;Js.point=function(n,i){Js.point=t,$e(e=n,r=i)}}function tr(){Js.point=$e}function er(){function t(t,e){var r=t-n,o=e-i,a=Math.sqrt(r*r+o*o);Rs+=a*(n+t)/2,Ds+=a*(i+e)/2,Os+=a,a=i*t-n*e,Fs+=a*(n+t),js+=a*(i+e),Ns+=3*a,$e(n=t,i=e)}var e,r,n,i;Js.point=function(o,a){Js.point=t,$e(e=n=o,r=i=a)},Js.lineEnd=function(){t(e,r)}}function rr(t){function e(e,r){t.moveTo(e+a,r),t.arc(e,r,a,0,Va)}function r(e,r){t.moveTo(e,r),s.point=n}function n(e,r){t.lineTo(e,r)}function i(){s.point=e}function o(){t.closePath()}var a=4.5,s={point:e,lineStart:function(){s.point=r},lineEnd:i,polygonStart:function(){s.lineEnd=o},polygonEnd:function(){s.lineEnd=i,s.point=e},pointRadius:function(t){return a=t,s},result:M};return s}function nr(t){function e(t){return(s?n:r)(t)}function r(e){return ar(e,function(r,n){r=t(r,n),e.point(r[0],r[1])})}function n(e){function r(r,n){r=t(r,n),e.point(r[0],r[1])}function n(){b=NaN,k.point=o,e.lineStart()}function o(r,n){var o=ge([r,n]),a=t(r,n);i(b,x,y,_,w,M,b=a[0],x=a[1],y=r,_=o[0],w=o[1],M=o[2],s,e),e.point(b,x)}function a(){k.point=r,e.lineEnd()}function l(){n(),k.point=u,k.lineEnd=c}function u(t,e){o(h=t,f=e),d=b,p=x,v=_,m=w,g=M,k.point=o}function c(){i(b,x,y,_,w,M,d,p,h,v,m,g,s,e),k.lineEnd=a,a()}var h,f,d,p,v,m,g,y,b,x,_,w,M,k={point:r,lineStart:n,lineEnd:a,polygonStart:function(){e.polygonStart(),k.lineStart=l},polygonEnd:function(){e.polygonEnd(),k.lineStart=n}};return k}function i(e,r,n,s,l,u,c,h,f,d,p,v,m,g){var y=c-e,b=h-r,x=y*y+b*b;if(x>4*o&&m--){var _=s+d,w=l+p,M=u+v,k=Math.sqrt(_*_+w*w+M*M),A=Math.asin(M/=k),T=wa(wa(M)-1)<Na||wa(n-f)<Na?(n+f)/2:Math.atan2(w,_),E=t(T,A),S=E[0],L=E[1],z=S-e,I=L-r,P=b*z-y*I;(P*P/x>o||wa((y*z+b*I)/x-.5)>.3||a>s*d+l*p+u*v)&&(i(e,r,n,s,l,u,S,L,T,_/=k,w/=k,M,m,g),g.point(S,L),i(S,L,T,_,w,M,c,h,f,d,p,v,m,g))}}var o=.5,a=Math.cos(30*Ha),s=16;return e.precision=function(t){return arguments.length?(s=(o=t*t)>0&&16,e):Math.sqrt(o)},e}function ir(t){var e=nr(function(e,r){return t([e*Xa,r*Xa])});return function(t){return ur(e(t))}}function or(t){this.stream=t}function ar(t,e){return{point:e,sphere:function(){t.sphere()},lineStart:function(){t.lineStart()},lineEnd:function(){t.lineEnd()},polygonStart:function(){t.polygonStart()},polygonEnd:function(){t.polygonEnd()}}}function sr(t){return lr(function(){return t})()}function lr(t){function e(t){return t=s(t[0]*Ha,t[1]*Ha),[t[0]*f+l,u-t[1]*f]}function r(t){return t=s.invert((t[0]-l)/f,(u-t[1])/f),t&&[t[0]*Xa,t[1]*Xa]}function n(){s=ze(a=fr(g,y,b),o);var t=o(v,m);return l=d-t[0]*f,u=p+t[1]*f,i()}function i(){return c&&(c.valid=!1,c=null),e}var o,a,s,l,u,c,h=nr(function(t,e){return t=o(t,e),[t[0]*f+l,u-t[1]*f]}),f=150,d=480,p=250,v=0,m=0,g=0,y=0,b=0,_=Us,w=x,M=null,k=null;return e.stream=function(t){return c&&(c.valid=!1),c=ur(_(a,h(w(t)))),c.valid=!0,c},e.clipAngle=function(t){return arguments.length?(_=null==t?(M=t,Us):qe((M=+t)*Ha),i()):M},e.clipExtent=function(t){return arguments.length?(k=t,w=t?He(t[0][0],t[0][1],t[1][0],t[1][1]):x,i()):k},e.scale=function(t){return arguments.length?(f=+t,n()):f},e.translate=function(t){return arguments.length?(d=+t[0],p=+t[1],n()):[d,p]},e.center=function(t){return arguments.length?(v=t[0]%360*Ha,m=t[1]%360*Ha,n()):[v*Xa,m*Xa]},e.rotate=function(t){return arguments.length?(g=t[0]%360*Ha,y=t[1]%360*Ha,b=t.length>2?t[2]%360*Ha:0,n()):[g*Xa,y*Xa,b*Xa]},ca.rebind(e,h,"precision"),function(){return o=t.apply(this,arguments),e.invert=o.invert&&r,n()}}function ur(t){return ar(t,function(e,r){t.point(e*Ha,r*Ha)})}function cr(t,e){return[t,e]}function hr(t,e){return[t>Ua?t-Va:-Ua>t?t+Va:t,e]}function fr(t,e,r){return t?e||r?ze(pr(t),vr(e,r)):pr(t):e||r?vr(e,r):hr}function dr(t){return function(e,r){return e+=t,[e>Ua?e-Va:-Ua>e?e+Va:e,r]}}function pr(t){var e=dr(t);return e.invert=dr(-t),e}function vr(t,e){function r(t,e){var r=Math.cos(e),s=Math.cos(t)*r,l=Math.sin(t)*r,u=Math.sin(e),c=u*n+s*i;return[Math.atan2(l*o-c*a,s*n-u*i),nt(c*o+l*a)]}var n=Math.cos(t),i=Math.sin(t),o=Math.cos(e),a=Math.sin(e);return r.invert=function(t,e){var r=Math.cos(e),s=Math.cos(t)*r,l=Math.sin(t)*r,u=Math.sin(e),c=u*o-l*a;return[Math.atan2(l*o+u*a,s*n+c*i),nt(c*n-s*i)]},r}function mr(t,e){var r=Math.cos(t),n=Math.sin(t);return function(i,o,a,s){var l=a*e;null!=i?(i=gr(r,i),o=gr(r,o),(a>0?o>i:i>o)&&(i+=a*Va)):(i=t+a*Va,o=t-.5*l);for(var u,c=i;a>0?c>o:o>c;c-=l)s.point((u=Me([r,-n*Math.cos(c),-n*Math.sin(c)]))[0],u[1])}}function gr(t,e){var r=ge(e);r[0]-=t,we(r);var n=rt(-r[1]);return((-r[2]<0?-n:n)+2*Math.PI-Na)%(2*Math.PI)}function yr(t,e,r){var n=ca.range(t,e-Na,r).concat(e);return function(t){return n.map(function(e){return[t,e]})}}function br(t,e,r){var n=ca.range(t,e-Na,r).concat(e);return function(t){return n.map(function(e){return[e,t]})}}function xr(t){return t.source}function _r(t){return t.target}function wr(t,e,r,n){var i=Math.cos(e),o=Math.sin(e),a=Math.cos(n),s=Math.sin(n),l=i*Math.cos(t),u=i*Math.sin(t),c=a*Math.cos(r),h=a*Math.sin(r),f=2*Math.asin(Math.sqrt(st(n-e)+i*a*st(r-t))),d=1/Math.sin(f),p=f?function(t){var e=Math.sin(t*=f)*d,r=Math.sin(f-t)*d,n=r*l+e*c,i=r*u+e*h,a=r*o+e*s;return[Math.atan2(i,n)*Xa,Math.atan2(a,Math.sqrt(n*n+i*i))*Xa]}:function(){return[t*Xa,e*Xa]};return p.distance=f,p}function Mr(){function t(t,i){var o=Math.sin(i*=Ha),a=Math.cos(i),s=wa((t*=Ha)-e),l=Math.cos(s);$s+=Math.atan2(Math.sqrt((s=a*Math.sin(s))*s+(s=n*o-r*a*l)*s),r*o+n*a*l),e=t,r=o,n=a}var e,r,n;Qs.point=function(i,o){e=i*Ha,r=Math.sin(o*=Ha),n=Math.cos(o),Qs.point=t},Qs.lineEnd=function(){Qs.point=Qs.lineEnd=M}}function kr(t,e){function r(e,r){var n=Math.cos(e),i=Math.cos(r),o=t(n*i);return[o*i*Math.sin(e),o*Math.sin(r)]}return r.invert=function(t,r){var n=Math.sqrt(t*t+r*r),i=e(n),o=Math.sin(i),a=Math.cos(i);return[Math.atan2(t*o,n*a),Math.asin(n&&r*o/n)]},r}function Ar(t,e){function r(t,e){a>0?-Ga+Na>e&&(e=-Ga+Na):e>Ga-Na&&(e=Ga-Na);var r=a/Math.pow(i(e),o);return[r*Math.sin(o*t),a-r*Math.cos(o*t)]}var n=Math.cos(t),i=function(t){return Math.tan(Ua/4+t/2)},o=t===e?Math.sin(t):Math.log(n/Math.cos(e))/Math.log(i(e)/i(t)),a=n*Math.pow(i(t),o)/o;return o?(r.invert=function(t,e){var r=a-e,n=tt(o)*Math.sqrt(t*t+r*r);return[Math.atan2(t,r)/o,2*Math.atan(Math.pow(a/n,1/o))-Ga]},r):Er}function Tr(t,e){function r(t,e){var r=o-e;return[r*Math.sin(i*t),o-r*Math.cos(i*t)]}var n=Math.cos(t),i=t===e?Math.sin(t):(n-Math.cos(e))/(e-t),o=n/i+t;return wa(i)<Na?cr:(r.invert=function(t,e){var r=o-e;return[Math.atan2(t,r)/i,o-tt(i)*Math.sqrt(t*t+r*r)]},r)}function Er(t,e){return[t,Math.log(Math.tan(Ua/4+e/2))]}function Sr(t){var e,r=sr(t),n=r.scale,i=r.translate,o=r.clipExtent;return r.scale=function(){var t=n.apply(r,arguments);return t===r?e?r.clipExtent(null):r:t},r.translate=function(){var t=i.apply(r,arguments);return t===r?e?r.clipExtent(null):r:t},r.clipExtent=function(t){var a=o.apply(r,arguments);if(a===r){if(e=null==t){var s=Ua*n(),l=i();o([[l[0]-s,l[1]-s],[l[0]+s,l[1]+s]])}}else e&&(a=null);return a},r.clipExtent(null)}function Lr(t,e){return[Math.log(Math.tan(Ua/4+e/2)),-t]}function zr(t){return t[0]}function Ir(t){return t[1]}function Pr(t){for(var e=t.length,r=[0,1],n=2,i=2;e>i;i++){for(;n>1&&et(t[r[n-2]],t[r[n-1]],t[i])<=0;)--n;r[n++]=i}return r.slice(0,n)}function Cr(t,e){return t[0]-e[0]||t[1]-e[1]}function Rr(t,e,r){return(r[0]-e[0])*(t[1]-e[1])<(r[1]-e[1])*(t[0]-e[0])}function Dr(t,e,r,n){var i=t[0],o=r[0],a=e[0]-i,s=n[0]-o,l=t[1],u=r[1],c=e[1]-l,h=n[1]-u,f=(s*(l-u)-h*(i-o))/(h*a-s*c);return[i+f*a,l+f*c]}function Or(t){var e=t[0],r=t[t.length-1];return!(e[0]-r[0]||e[1]-r[1])}function Fr(){on(this),this.edge=this.site=this.circle=null}function jr(t){var e=hl.pop()||new Fr;return e.site=t,e}function Nr(t){Zr(t),ll.remove(t),hl.push(t),on(t)}function Br(t){var e=t.circle,r=e.x,n=e.cy,i={x:r,y:n},o=t.P,a=t.N,s=[t];Nr(t);for(var l=o;l.circle&&wa(r-l.circle.x)<Na&&wa(n-l.circle.cy)<Na;)o=l.P,s.unshift(l),Nr(l),l=o;s.unshift(l),Zr(l);for(var u=a;u.circle&&wa(r-u.circle.x)<Na&&wa(n-u.circle.cy)<Na;)a=u.N,s.push(u),Nr(u),u=a;s.push(u),Zr(u);var c,h=s.length;for(c=1;h>c;++c)u=s[c],l=s[c-1],en(u.edge,l.site,u.site,i);l=s[0],u=s[h-1],u.edge=Qr(l.site,u.site,null,i),Wr(l),Wr(u)}function Ur(t){for(var e,r,n,i,o=t.x,a=t.y,s=ll._;s;)if(n=Vr(s,a)-o,n>Na)s=s.L;else{if(i=o-qr(s,a),!(i>Na)){n>-Na?(e=s.P,r=s):i>-Na?(e=s,r=s.N):e=r=s;break}if(!s.R){e=s;break}s=s.R}var l=jr(t);if(ll.insert(e,l),e||r){if(e===r)return Zr(e),r=jr(e.site),ll.insert(l,r),l.edge=r.edge=Qr(e.site,l.site),Wr(e),void Wr(r);if(!r)return void(l.edge=Qr(e.site,l.site));Zr(e),Zr(r);var u=e.site,c=u.x,h=u.y,f=t.x-c,d=t.y-h,p=r.site,v=p.x-c,m=p.y-h,g=2*(f*m-d*v),y=f*f+d*d,b=v*v+m*m,x={x:(m*y-d*b)/g+c,y:(f*b-v*y)/g+h};en(r.edge,u,p,x),l.edge=Qr(u,t,null,x),r.edge=Qr(t,p,null,x),Wr(e),Wr(r)}}function Vr(t,e){var r=t.site,n=r.x,i=r.y,o=i-e;if(!o)return n;var a=t.P;if(!a)return-(1/0);r=a.site;var s=r.x,l=r.y,u=l-e;if(!u)return s;var c=s-n,h=1/o-1/u,f=c/u;return h?(-f+Math.sqrt(f*f-2*h*(c*c/(-2*u)-l+u/2+i-o/2)))/h+n:(n+s)/2}function qr(t,e){var r=t.N;if(r)return Vr(r,e);var n=t.site;return n.y===e?n.x:1/0}function Gr(t){this.site=t,this.edges=[]}function Hr(t){for(var e,r,n,i,o,a,s,l,u,c,h=t[0][0],f=t[1][0],d=t[0][1],p=t[1][1],v=sl,m=v.length;m--;)if(o=v[m],o&&o.prepare())for(s=o.edges,l=s.length,a=0;l>a;)c=s[a].end(),n=c.x,i=c.y,u=s[++a%l].start(),e=u.x,r=u.y,(wa(n-e)>Na||wa(i-r)>Na)&&(s.splice(a,0,new rn(tn(o.site,c,wa(n-h)<Na&&p-i>Na?{x:h,y:wa(e-h)<Na?r:p}:wa(i-p)<Na&&f-n>Na?{x:wa(r-p)<Na?e:f,y:p}:wa(n-f)<Na&&i-d>Na?{x:f,y:wa(e-f)<Na?r:d}:wa(i-d)<Na&&n-h>Na?{x:wa(r-d)<Na?e:h,y:d}:null),o.site,null)),++l)}function Xr(t,e){return e.angle-t.angle}function Yr(){on(this),this.x=this.y=this.arc=this.site=this.cy=null}function Wr(t){var e=t.P,r=t.N;if(e&&r){var n=e.site,i=t.site,o=r.site;if(n!==o){var a=i.x,s=i.y,l=n.x-a,u=n.y-s,c=o.x-a,h=o.y-s,f=2*(l*h-u*c);if(!(f>=-Ba)){var d=l*l+u*u,p=c*c+h*h,v=(h*d-u*p)/f,m=(l*p-c*d)/f,h=m+s,g=fl.pop()||new Yr;g.arc=t,g.site=i,g.x=v+a,g.y=h+Math.sqrt(v*v+m*m),g.cy=h,t.circle=g;for(var y=null,b=cl._;b;)if(g.y<b.y||g.y===b.y&&g.x<=b.x){if(!b.L){y=b.P;break}b=b.L}else{if(!b.R){y=b;break}b=b.R}cl.insert(y,g),y||(ul=g)}}}}function Zr(t){var e=t.circle;e&&(e.P||(ul=e.N),cl.remove(e),fl.push(e),on(e),t.circle=null)}function Kr(t){for(var e,r=al,n=Ge(t[0][0],t[0][1],t[1][0],t[1][1]),i=r.length;i--;)e=r[i],(!Jr(e,t)||!n(e)||wa(e.a.x-e.b.x)<Na&&wa(e.a.y-e.b.y)<Na)&&(e.a=e.b=null,r.splice(i,1))}function Jr(t,e){var r=t.b;if(r)return!0;var n,i,o=t.a,a=e[0][0],s=e[1][0],l=e[0][1],u=e[1][1],c=t.l,h=t.r,f=c.x,d=c.y,p=h.x,v=h.y,m=(f+p)/2,g=(d+v)/2;if(v===d){if(a>m||m>=s)return;if(f>p){if(o){if(o.y>=u)return}else o={x:m,y:l};r={x:m,y:u}}else{if(o){if(o.y<l)return}else o={x:m,y:u};r={x:m,y:l}}}else if(n=(f-p)/(v-d),i=g-n*m,-1>n||n>1)if(f>p){if(o){if(o.y>=u)return}else o={x:(l-i)/n,y:l};r={x:(u-i)/n,y:u}}else{if(o){if(o.y<l)return}else o={x:(u-i)/n,y:u};r={x:(l-i)/n,y:l}}else if(v>d){if(o){if(o.x>=s)return}else o={x:a,y:n*a+i};r={x:s,y:n*s+i}}else{if(o){if(o.x<a)return}else o={x:s,y:n*s+i};r={x:a,y:n*a+i}}return t.a=o,t.b=r,!0}function $r(t,e){this.l=t,this.r=e,this.a=this.b=null}function Qr(t,e,r,n){var i=new $r(t,e);return al.push(i),r&&en(i,t,e,r),n&&en(i,e,t,n),sl[t.i].edges.push(new rn(i,t,e)),sl[e.i].edges.push(new rn(i,e,t)),i}function tn(t,e,r){var n=new $r(t,null);return n.a=e,n.b=r,al.push(n),n}function en(t,e,r,n){t.a||t.b?t.l===r?t.b=n:t.a=n:(t.a=n,t.l=e,t.r=r)}function rn(t,e,r){var n=t.a,i=t.b;this.edge=t,this.site=e,this.angle=r?Math.atan2(r.y-e.y,r.x-e.x):t.l===e?Math.atan2(i.x-n.x,n.y-i.y):Math.atan2(n.x-i.x,i.y-n.y)}function nn(){this._=null}function on(t){t.U=t.C=t.L=t.R=t.P=t.N=null}function an(t,e){var r=e,n=e.R,i=r.U;i?i.L===r?i.L=n:i.R=n:t._=n,n.U=i,r.U=n,r.R=n.L,r.R&&(r.R.U=r),n.L=r}function sn(t,e){var r=e,n=e.L,i=r.U;i?i.L===r?i.L=n:i.R=n:t._=n,n.U=i,r.U=n,r.L=n.R,r.L&&(r.L.U=r),n.R=r}function ln(t){for(;t.L;)t=t.L;return t}function un(t,e){var r,n,i,o=t.sort(cn).pop();for(al=[],sl=new Array(t.length),ll=new nn,cl=new nn;;)if(i=ul,o&&(!i||o.y<i.y||o.y===i.y&&o.x<i.x))o.x===r&&o.y===n||(sl[o.i]=new Gr(o),Ur(o),r=o.x,n=o.y),o=t.pop();else{if(!i)break;Br(i.arc)}e&&(Kr(e),Hr(e));var a={cells:sl,edges:al};return ll=cl=al=sl=null,a}function cn(t,e){return e.y-t.y||e.x-t.x}function hn(t,e,r){return(t.x-r.x)*(e.y-t.y)-(t.x-e.x)*(r.y-t.y)}function fn(t){return t.x}function dn(t){return t.y}function pn(){return{leaf:!0,nodes:[],point:null,x:null,y:null}}function vn(t,e,r,n,i,o){if(!t(e,r,n,i,o)){var a=.5*(r+i),s=.5*(n+o),l=e.nodes;l[0]&&vn(t,l[0],r,n,a,s),l[1]&&vn(t,l[1],a,n,i,s),l[2]&&vn(t,l[2],r,s,a,o),l[3]&&vn(t,l[3],a,s,i,o)}}function mn(t,e,r,n,i,o,a){var s,l=1/0;return function u(t,c,h,f,d){if(!(c>o||h>a||n>f||i>d)){if(p=t.point){var p,v=e-t.x,m=r-t.y,g=v*v+m*m;if(l>g){var y=Math.sqrt(l=g);n=e-y,i=r-y,o=e+y,a=r+y,s=p}}for(var b=t.nodes,x=.5*(c+f),_=.5*(h+d),w=e>=x,M=r>=_,k=M<<1|w,A=k+4;A>k;++k)if(t=b[3&k])switch(3&k){case 0:u(t,c,h,x,_);break;case 1:u(t,x,h,f,_);break;case 2:u(t,c,_,x,d);break;case 3:u(t,x,_,f,d)}}}(t,n,i,o,a),s}function gn(t,e){t=ca.rgb(t),e=ca.rgb(e);var r=t.r,n=t.g,i=t.b,o=e.r-r,a=e.g-n,s=e.b-i;return function(t){return"#"+wt(Math.round(r+o*t))+wt(Math.round(n+a*t))+wt(Math.round(i+s*t))}}function yn(t,e){var r,n={},i={};for(r in t)r in e?n[r]=_n(t[r],e[r]):i[r]=t[r];for(r in e)r in t||(i[r]=e[r]);return function(t){for(r in n)i[r]=n[r](t);return i}}function bn(t,e){return t=+t,e=+e,function(r){return t*(1-r)+e*r}}function xn(t,e){var r,n,i,o=pl.lastIndex=vl.lastIndex=0,a=-1,s=[],l=[];for(t+="",e+="";(r=pl.exec(t))&&(n=vl.exec(e));)(i=n.index)>o&&(i=e.slice(o,i),s[a]?s[a]+=i:s[++a]=i),(r=r[0])===(n=n[0])?s[a]?s[a]+=n:s[++a]=n:(s[++a]=null,l.push({i:a,x:bn(r,n)})),o=vl.lastIndex;return o<e.length&&(i=e.slice(o),s[a]?s[a]+=i:s[++a]=i),s.length<2?l[0]?(e=l[0].x,function(t){return e(t)+""}):function(){return e}:(e=l.length,function(t){for(var r,n=0;e>n;++n)s[(r=l[n]).i]=r.x(t);return s.join("")})}function _n(t,e){for(var r,n=ca.interpolators.length;--n>=0&&!(r=ca.interpolators[n](t,e)););return r}function wn(t,e){var r,n=[],i=[],o=t.length,a=e.length,s=Math.min(t.length,e.length);for(r=0;s>r;++r)n.push(_n(t[r],e[r]));for(;o>r;++r)i[r]=t[r];for(;a>r;++r)i[r]=e[r];return function(t){for(r=0;s>r;++r)i[r]=n[r](t);return i}}function Mn(t){return function(e){return 0>=e?0:e>=1?1:t(e)}}function kn(t){return function(e){return 1-t(1-e)}}function An(t){return function(e){return.5*(.5>e?t(2*e):2-t(2-2*e))}}function Tn(t){return t*t}function En(t){return t*t*t}function Sn(t){if(0>=t)return 0;if(t>=1)return 1;var e=t*t,r=e*t;return 4*(.5>t?r:3*(t-e)+r-.75)}function Ln(t){return function(e){return Math.pow(e,t)}}function zn(t){return 1-Math.cos(t*Ga)}function In(t){return Math.pow(2,10*(t-1))}function Pn(t){return 1-Math.sqrt(1-t*t)}function Cn(t,e){var r;return arguments.length<2&&(e=.45),arguments.length?r=e/Va*Math.asin(1/t):(t=1,r=e/4),function(n){return 1+t*Math.pow(2,-10*n)*Math.sin((n-r)*Va/e)}}function Rn(t){return t||(t=1.70158),function(e){return e*e*((t+1)*e-t)}}function Dn(t){return 1/2.75>t?7.5625*t*t:2/2.75>t?7.5625*(t-=1.5/2.75)*t+.75:2.5/2.75>t?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375}function On(t,e){t=ca.hcl(t),e=ca.hcl(e);var r=t.h,n=t.c,i=t.l,o=e.h-r,a=e.c-n,s=e.l-i;return isNaN(a)&&(a=0,n=isNaN(n)?e.c:n),isNaN(o)?(o=0,r=isNaN(r)?e.h:r):o>180?o-=360:-180>o&&(o+=360),function(t){return ft(r+o*t,n+a*t,i+s*t)+""}}function Fn(t,e){t=ca.hsl(t),e=ca.hsl(e);var r=t.h,n=t.s,i=t.l,o=e.h-r,a=e.s-n,s=e.l-i;return isNaN(a)&&(a=0,n=isNaN(n)?e.s:n),isNaN(o)?(o=0,r=isNaN(r)?e.h:r):o>180?o-=360:-180>o&&(o+=360),function(t){return ct(r+o*t,n+a*t,i+s*t)+""}}function jn(t,e){t=ca.lab(t),e=ca.lab(e);var r=t.l,n=t.a,i=t.b,o=e.l-r,a=e.a-n,s=e.b-i;return function(t){return pt(r+o*t,n+a*t,i+s*t)+""}}function Nn(t,e){return e-=t,function(r){return Math.round(t+e*r)}}function Bn(t){var e=[t.a,t.b],r=[t.c,t.d],n=Vn(e),i=Un(e,r),o=Vn(qn(r,e,-i))||0;e[0]*r[1]<r[0]*e[1]&&(e[0]*=-1,e[1]*=-1,n*=-1,i*=-1),this.rotate=(n?Math.atan2(e[1],e[0]):Math.atan2(-r[0],r[1]))*Xa,this.translate=[t.e,t.f],this.scale=[n,o],this.skew=o?Math.atan2(i,o)*Xa:0}function Un(t,e){return t[0]*e[0]+t[1]*e[1]}function Vn(t){var e=Math.sqrt(Un(t,t));return e&&(t[0]/=e,t[1]/=e),e}function qn(t,e,r){return t[0]+=r*e[0],t[1]+=r*e[1],t}function Gn(t){return t.length?t.pop()+",":""}function Hn(t,e,r,n){if(t[0]!==e[0]||t[1]!==e[1]){var i=r.push("translate(",null,",",null,")");n.push({i:i-4,x:bn(t[0],e[0])},{i:i-2,x:bn(t[1],e[1])})}else(e[0]||e[1])&&r.push("translate("+e+")")}function Xn(t,e,r,n){t!==e?(t-e>180?e+=360:e-t>180&&(t+=360),n.push({i:r.push(Gn(r)+"rotate(",null,")")-2,x:bn(t,e)})):e&&r.push(Gn(r)+"rotate("+e+")")}function Yn(t,e,r,n){t!==e?n.push({i:r.push(Gn(r)+"skewX(",null,")")-2,x:bn(t,e)}):e&&r.push(Gn(r)+"skewX("+e+")")}function Wn(t,e,r,n){if(t[0]!==e[0]||t[1]!==e[1]){var i=r.push(Gn(r)+"scale(",null,",",null,")");n.push({i:i-4,x:bn(t[0],e[0])},{i:i-2,x:bn(t[1],e[1])})}else 1===e[0]&&1===e[1]||r.push(Gn(r)+"scale("+e+")")}function Zn(t,e){var r=[],n=[];return t=ca.transform(t),e=ca.transform(e),Hn(t.translate,e.translate,r,n),Xn(t.rotate,e.rotate,r,n),Yn(t.skew,e.skew,r,n),Wn(t.scale,e.scale,r,n),t=e=null,function(t){for(var e,i=-1,o=n.length;++i<o;)r[(e=n[i]).i]=e.x(t);return r.join("")}}function Kn(t,e){return e=(e-=t=+t)||1/e,function(r){return(r-t)/e}}function Jn(t,e){return e=(e-=t=+t)||1/e,function(r){return Math.max(0,Math.min(1,(r-t)/e))}}function $n(t){for(var e=t.source,r=t.target,n=ti(e,r),i=[e];e!==n;)e=e.parent,i.push(e);for(var o=i.length;r!==n;)i.splice(o,0,r),r=r.parent;return i}function Qn(t){for(var e=[],r=t.parent;null!=r;)e.push(t),t=r,r=r.parent;return e.push(t),e}function ti(t,e){if(t===e)return t;for(var r=Qn(t),n=Qn(e),i=r.pop(),o=n.pop(),a=null;i===o;)a=i,i=r.pop(),o=n.pop();return a}function ei(t){t.fixed|=2}function ri(t){t.fixed&=-7}function ni(t){t.fixed|=4,t.px=t.x,t.py=t.y}function ii(t){t.fixed&=-5}function oi(t,e,r){var n=0,i=0;if(t.charge=0,!t.leaf)for(var o,a=t.nodes,s=a.length,l=-1;++l<s;)o=a[l],null!=o&&(oi(o,e,r),t.charge+=o.charge,n+=o.charge*o.cx,i+=o.charge*o.cy);if(t.point){t.leaf||(t.point.x+=Math.random()-.5,t.point.y+=Math.random()-.5);var u=e*r[t.point.index];t.charge+=t.pointCharge=u,n+=u*t.point.x,i+=u*t.point.y}t.cx=n/t.charge,t.cy=i/t.charge}function ai(t,e){return ca.rebind(t,e,"sort","children","value"),t.nodes=t,t.links=fi,t}function si(t,e){for(var r=[t];null!=(t=r.pop());)if(e(t),(i=t.children)&&(n=i.length))for(var n,i;--n>=0;)r.push(i[n])}function li(t,e){for(var r=[t],n=[];null!=(t=r.pop());)if(n.push(t),(o=t.children)&&(i=o.length))for(var i,o,a=-1;++a<i;)r.push(o[a]);for(;null!=(t=n.pop());)e(t)}function ui(t){return t.children}function ci(t){return t.value}function hi(t,e){return e.value-t.value}function fi(t){return ca.merge(t.map(function(t){return(t.children||[]).map(function(e){return{source:t,target:e}})}))}function di(t){return t.x}function pi(t){return t.y}function vi(t,e,r){t.y0=e,t.y=r}function mi(t){return ca.range(t.length)}function gi(t){for(var e=-1,r=t[0].length,n=[];++e<r;)n[e]=0;return n}function yi(t){for(var e,r=1,n=0,i=t[0][1],o=t.length;o>r;++r)(e=t[r][1])>i&&(n=r,i=e);return n}function bi(t){return t.reduce(xi,0)}function xi(t,e){return t+e[1]}function _i(t,e){return wi(t,Math.ceil(Math.log(e.length)/Math.LN2+1))}function wi(t,e){for(var r=-1,n=+t[0],i=(t[1]-n)/e,o=[];++r<=e;)o[r]=i*r+n;return o}function Mi(t){return[ca.min(t),ca.max(t)]}function ki(t,e){return t.value-e.value}function Ai(t,e){var r=t._pack_next;t._pack_next=e,e._pack_prev=t,e._pack_next=r,r._pack_prev=e}function Ti(t,e){t._pack_next=e,e._pack_prev=t}function Ei(t,e){var r=e.x-t.x,n=e.y-t.y,i=t.r+e.r;return.999*i*i>r*r+n*n}function Si(t){function e(t){c=Math.min(t.x-t.r,c),h=Math.max(t.x+t.r,h),f=Math.min(t.y-t.r,f),d=Math.max(t.y+t.r,d)}if((r=t.children)&&(u=r.length)){var r,n,i,o,a,s,l,u,c=1/0,h=-(1/0),f=1/0,d=-(1/0);if(r.forEach(Li),n=r[0],n.x=-n.r,n.y=0,e(n),u>1&&(i=r[1],i.x=i.r,i.y=0,e(i),u>2))for(o=r[2],Pi(n,i,o),e(o),Ai(n,o),n._pack_prev=o,Ai(o,i),i=n._pack_next,a=3;u>a;a++){Pi(n,i,o=r[a]);var p=0,v=1,m=1;for(s=i._pack_next;s!==i;s=s._pack_next,v++)if(Ei(s,o)){p=1;break}if(1==p)for(l=n._pack_prev;l!==s._pack_prev&&!Ei(l,o);l=l._pack_prev,m++);p?(m>v||v==m&&i.r<n.r?Ti(n,i=s):Ti(n=l,i),a--):(Ai(n,o),i=o,e(o))}var g=(c+h)/2,y=(f+d)/2,b=0;for(a=0;u>a;a++)o=r[a],o.x-=g,o.y-=y,b=Math.max(b,o.r+Math.sqrt(o.x*o.x+o.y*o.y));t.r=b,r.forEach(zi)}}function Li(t){t._pack_next=t._pack_prev=t}function zi(t){delete t._pack_next,delete t._pack_prev}function Ii(t,e,r,n){var i=t.children;if(t.x=e+=n*t.x,t.y=r+=n*t.y,t.r*=n,i)for(var o=-1,a=i.length;++o<a;)Ii(i[o],e,r,n)}function Pi(t,e,r){var n=t.r+r.r,i=e.x-t.x,o=e.y-t.y;if(n&&(i||o)){var a=e.r+r.r,s=i*i+o*o;a*=a,n*=n;var l=.5+(n-a)/(2*s),u=Math.sqrt(Math.max(0,2*a*(n+s)-(n-=s)*n-a*a))/(2*s);r.x=t.x+l*i+u*o,r.y=t.y+l*o-u*i}else r.x=t.x+n,r.y=t.y}function Ci(t,e){return t.parent==e.parent?1:2}function Ri(t){var e=t.children;return e.length?e[0]:t.t}function Di(t){var e,r=t.children;return(e=r.length)?r[e-1]:t.t}function Oi(t,e,r){var n=r/(e.i-t.i);e.c-=n,e.s+=r,t.c+=n,e.z+=r,e.m+=r}function Fi(t){for(var e,r=0,n=0,i=t.children,o=i.length;--o>=0;)e=i[o],e.z+=r,e.m+=r,r+=e.s+(n+=e.c)}function ji(t,e,r){return t.a.parent===e.parent?t.a:r}function Ni(t){return 1+ca.max(t,function(t){return t.y})}function Bi(t){return t.reduce(function(t,e){return t+e.x},0)/t.length}function Ui(t){var e=t.children;return e&&e.length?Ui(e[0]):t}function Vi(t){var e,r=t.children;return r&&(e=r.length)?Vi(r[e-1]):t}function qi(t){return{x:t.x,y:t.y,dx:t.dx,dy:t.dy}}function Gi(t,e){var r=t.x+e[3],n=t.y+e[0],i=t.dx-e[1]-e[3],o=t.dy-e[0]-e[2];return 0>i&&(r+=i/2,i=0),0>o&&(n+=o/2,o=0),{x:r,y:n,dx:i,dy:o}}function Hi(t){var e=t[0],r=t[t.length-1];return r>e?[e,r]:[r,e]}function Xi(t){return t.rangeExtent?t.rangeExtent():Hi(t.range())}function Yi(t,e,r,n){var i=r(t[0],t[1]),o=n(e[0],e[1]);return function(t){return o(i(t))}}function Wi(t,e){var r,n=0,i=t.length-1,o=t[n],a=t[i];return o>a&&(r=n,n=i,i=r,r=o,o=a,a=r),t[n]=e.floor(o),t[i]=e.ceil(a),t}function Zi(t){return t?{floor:function(e){return Math.floor(e/t)*t},ceil:function(e){return Math.ceil(e/t)*t}}:Tl}function Ki(t,e,r,n){var i=[],o=[],a=0,s=Math.min(t.length,e.length)-1;for(t[s]<t[0]&&(t=t.slice().reverse(),e=e.slice().reverse());++a<=s;)i.push(r(t[a-1],t[a])),o.push(n(e[a-1],e[a]));return function(e){var r=ca.bisect(t,e,1,s)-1;return o[r](i[r](e))}}function Ji(t,e,r,n){function i(){var i=Math.min(t.length,e.length)>2?Ki:Yi,l=n?Jn:Kn;return a=i(t,e,l,r),s=i(e,t,l,_n),o}function o(t){return a(t)}var a,s;return o.invert=function(t){return s(t)},o.domain=function(e){return arguments.length?(t=e.map(Number),i()):t},o.range=function(t){return arguments.length?(e=t,i()):e},o.rangeRound=function(t){return o.range(t).interpolate(Nn)},o.clamp=function(t){return arguments.length?(n=t,i()):n},o.interpolate=function(t){return arguments.length?(r=t,i()):r},o.ticks=function(e){return eo(t,e)},o.tickFormat=function(e,r){return ro(t,e,r)},o.nice=function(e){return Qi(t,e),i()},o.copy=function(){return Ji(t,e,r,n)},i()}function $i(t,e){return ca.rebind(t,e,"range","rangeRound","interpolate","clamp")}function Qi(t,e){return Wi(t,Zi(to(t,e)[2])),Wi(t,Zi(to(t,e)[2])),t}function to(t,e){null==e&&(e=10);var r=Hi(t),n=r[1]-r[0],i=Math.pow(10,Math.floor(Math.log(n/e)/Math.LN10)),o=e/n*i;return.15>=o?i*=10:.35>=o?i*=5:.75>=o&&(i*=2),r[0]=Math.ceil(r[0]/i)*i,r[1]=Math.floor(r[1]/i)*i+.5*i,r[2]=i,r}function eo(t,e){return ca.range.apply(ca,to(t,e))}function ro(t,e,r){var n=to(t,e);if(r){var i=ps.exec(r);if(i.shift(),"s"===i[8]){var o=ca.formatPrefix(Math.max(wa(n[0]),wa(n[1])));return i[7]||(i[7]="."+no(o.scale(n[2]))),i[8]="f",r=ca.format(i.join("")),function(t){return r(o.scale(t))+o.symbol}}i[7]||(i[7]="."+io(i[8],n)),r=i.join("")}else r=",."+no(n[2])+"f";return ca.format(r)}function no(t){return-Math.floor(Math.log(t)/Math.LN10+.01)}function io(t,e){var r=no(e[2]);return t in El?Math.abs(r-no(Math.max(wa(e[0]),wa(e[1]))))+ +("e"!==t):r-2*("%"===t)}function oo(t,e,r,n){function i(t){return(r?Math.log(0>t?0:t):-Math.log(t>0?0:-t))/Math.log(e)}function o(t){return r?Math.pow(e,t):-Math.pow(e,-t)}function a(e){return t(i(e))}return a.invert=function(e){return o(t.invert(e))},a.domain=function(e){return arguments.length?(r=e[0]>=0,t.domain((n=e.map(Number)).map(i)),a):n},a.base=function(r){return arguments.length?(e=+r,t.domain(n.map(i)),a):e},a.nice=function(){var e=Wi(n.map(i),r?Math:Ll);return t.domain(e),n=e.map(o),a},a.ticks=function(){var t=Hi(n),a=[],s=t[0],l=t[1],u=Math.floor(i(s)),c=Math.ceil(i(l)),h=e%1?2:e;if(isFinite(c-u)){if(r){for(;c>u;u++)for(var f=1;h>f;f++)a.push(o(u)*f);a.push(o(u))}else for(a.push(o(u));u++<c;)for(var f=h-1;f>0;f--)a.push(o(u)*f);for(u=0;a[u]<s;u++);for(c=a.length;a[c-1]>l;c--);a=a.slice(u,c)}return a},a.tickFormat=function(t,r){if(!arguments.length)return Sl;arguments.length<2?r=Sl:"function"!=typeof r&&(r=ca.format(r));var n=Math.max(1,e*t/a.ticks().length);return function(t){var a=t/o(Math.round(i(t)));return e-.5>a*e&&(a*=e),n>=a?r(t):""}},a.copy=function(){return oo(t.copy(),e,r,n)},$i(a,t)}function ao(t,e,r){function n(e){return t(i(e))}var i=so(e),o=so(1/e);return n.invert=function(e){return o(t.invert(e))},n.domain=function(e){return arguments.length?(t.domain((r=e.map(Number)).map(i)),n):r},n.ticks=function(t){return eo(r,t)},n.tickFormat=function(t,e){return ro(r,t,e)},n.nice=function(t){return n.domain(Qi(r,t));
},n.exponent=function(a){return arguments.length?(i=so(e=a),o=so(1/e),t.domain(r.map(i)),n):e},n.copy=function(){return ao(t.copy(),e,r)},$i(n,t)}function so(t){return function(e){return 0>e?-Math.pow(-e,t):Math.pow(e,t)}}function lo(t,e){function r(r){return o[((i.get(r)||("range"===e.t?i.set(r,t.push(r)):NaN))-1)%o.length]}function n(e,r){return ca.range(t.length).map(function(t){return e+r*t})}var i,o,a;return r.domain=function(n){if(!arguments.length)return t;t=[],i=new h;for(var o,a=-1,s=n.length;++a<s;)i.has(o=n[a])||i.set(o,t.push(o));return r[e.t].apply(r,e.a)},r.range=function(t){return arguments.length?(o=t,a=0,e={t:"range",a:arguments},r):o},r.rangePoints=function(i,s){arguments.length<2&&(s=0);var l=i[0],u=i[1],c=t.length<2?(l=(l+u)/2,0):(u-l)/(t.length-1+s);return o=n(l+c*s/2,c),a=0,e={t:"rangePoints",a:arguments},r},r.rangeRoundPoints=function(i,s){arguments.length<2&&(s=0);var l=i[0],u=i[1],c=t.length<2?(l=u=Math.round((l+u)/2),0):(u-l)/(t.length-1+s)|0;return o=n(l+Math.round(c*s/2+(u-l-(t.length-1+s)*c)/2),c),a=0,e={t:"rangeRoundPoints",a:arguments},r},r.rangeBands=function(i,s,l){arguments.length<2&&(s=0),arguments.length<3&&(l=s);var u=i[1]<i[0],c=i[u-0],h=i[1-u],f=(h-c)/(t.length-s+2*l);return o=n(c+f*l,f),u&&o.reverse(),a=f*(1-s),e={t:"rangeBands",a:arguments},r},r.rangeRoundBands=function(i,s,l){arguments.length<2&&(s=0),arguments.length<3&&(l=s);var u=i[1]<i[0],c=i[u-0],h=i[1-u],f=Math.floor((h-c)/(t.length-s+2*l));return o=n(c+Math.round((h-c-(t.length-s)*f)/2),f),u&&o.reverse(),a=Math.round(f*(1-s)),e={t:"rangeRoundBands",a:arguments},r},r.rangeBand=function(){return a},r.rangeExtent=function(){return Hi(e.a[0])},r.copy=function(){return lo(t,e)},r.domain(t)}function uo(t,e){function r(){var r=0,i=e.length;for(s=[];++r<i;)s[r-1]=ca.quantile(t,r/i);return n}function n(t){return isNaN(t=+t)?void 0:e[ca.bisect(s,t)]}var s;return n.domain=function(e){return arguments.length?(t=e.map(o).filter(a).sort(i),r()):t},n.range=function(t){return arguments.length?(e=t,r()):e},n.quantiles=function(){return s},n.invertExtent=function(r){return r=e.indexOf(r),0>r?[NaN,NaN]:[r>0?s[r-1]:t[0],r<s.length?s[r]:t[t.length-1]]},n.copy=function(){return uo(t,e)},r()}function co(t,e,r){function n(e){return r[Math.max(0,Math.min(a,Math.floor(o*(e-t))))]}function i(){return o=r.length/(e-t),a=r.length-1,n}var o,a;return n.domain=function(r){return arguments.length?(t=+r[0],e=+r[r.length-1],i()):[t,e]},n.range=function(t){return arguments.length?(r=t,i()):r},n.invertExtent=function(e){return e=r.indexOf(e),e=0>e?NaN:e/o+t,[e,e+1/o]},n.copy=function(){return co(t,e,r)},i()}function ho(t,e){function r(r){return r>=r?e[ca.bisect(t,r)]:void 0}return r.domain=function(e){return arguments.length?(t=e,r):t},r.range=function(t){return arguments.length?(e=t,r):e},r.invertExtent=function(r){return r=e.indexOf(r),[t[r-1],t[r]]},r.copy=function(){return ho(t,e)},r}function fo(t){function e(t){return+t}return e.invert=e,e.domain=e.range=function(r){return arguments.length?(t=r.map(e),e):t},e.ticks=function(e){return eo(t,e)},e.tickFormat=function(e,r){return ro(t,e,r)},e.copy=function(){return fo(t)},e}function po(){return 0}function vo(t){return t.innerRadius}function mo(t){return t.outerRadius}function go(t){return t.startAngle}function yo(t){return t.endAngle}function bo(t){return t&&t.padAngle}function xo(t,e,r,n){return(t-r)*e-(e-n)*t>0?0:1}function _o(t,e,r,n,i){var o=t[0]-e[0],a=t[1]-e[1],s=(i?n:-n)/Math.sqrt(o*o+a*a),l=s*a,u=-s*o,c=t[0]+l,h=t[1]+u,f=e[0]+l,d=e[1]+u,p=(c+f)/2,v=(h+d)/2,m=f-c,g=d-h,y=m*m+g*g,b=r-n,x=c*d-f*h,_=(0>g?-1:1)*Math.sqrt(Math.max(0,b*b*y-x*x)),w=(x*g-m*_)/y,M=(-x*m-g*_)/y,k=(x*g+m*_)/y,A=(-x*m+g*_)/y,T=w-p,E=M-v,S=k-p,L=A-v;return T*T+E*E>S*S+L*L&&(w=k,M=A),[[w-l,M-u],[w*r/b,M*r/b]]}function wo(t){function e(e){function a(){u.push("M",o(t(c),s))}for(var l,u=[],c=[],h=-1,f=e.length,d=St(r),p=St(n);++h<f;)i.call(this,l=e[h],h)?c.push([+d.call(this,l,h),+p.call(this,l,h)]):c.length&&(a(),c=[]);return c.length&&a(),u.length?u.join(""):null}var r=zr,n=Ir,i=Ie,o=Mo,a=o.key,s=.7;return e.x=function(t){return arguments.length?(r=t,e):r},e.y=function(t){return arguments.length?(n=t,e):n},e.defined=function(t){return arguments.length?(i=t,e):i},e.interpolate=function(t){return arguments.length?(a="function"==typeof t?o=t:(o=Dl.get(t)||Mo).key,e):a},e.tension=function(t){return arguments.length?(s=t,e):s},e}function Mo(t){return t.length>1?t.join("L"):t+"Z"}function ko(t){return t.join("L")+"Z"}function Ao(t){for(var e=0,r=t.length,n=t[0],i=[n[0],",",n[1]];++e<r;)i.push("H",(n[0]+(n=t[e])[0])/2,"V",n[1]);return r>1&&i.push("H",n[0]),i.join("")}function To(t){for(var e=0,r=t.length,n=t[0],i=[n[0],",",n[1]];++e<r;)i.push("V",(n=t[e])[1],"H",n[0]);return i.join("")}function Eo(t){for(var e=0,r=t.length,n=t[0],i=[n[0],",",n[1]];++e<r;)i.push("H",(n=t[e])[0],"V",n[1]);return i.join("")}function So(t,e){return t.length<4?Mo(t):t[1]+Io(t.slice(1,-1),Po(t,e))}function Lo(t,e){return t.length<3?ko(t):t[0]+Io((t.push(t[0]),t),Po([t[t.length-2]].concat(t,[t[1]]),e))}function zo(t,e){return t.length<3?Mo(t):t[0]+Io(t,Po(t,e))}function Io(t,e){if(e.length<1||t.length!=e.length&&t.length!=e.length+2)return Mo(t);var r=t.length!=e.length,n="",i=t[0],o=t[1],a=e[0],s=a,l=1;if(r&&(n+="Q"+(o[0]-2*a[0]/3)+","+(o[1]-2*a[1]/3)+","+o[0]+","+o[1],i=t[1],l=2),e.length>1){s=e[1],o=t[l],l++,n+="C"+(i[0]+a[0])+","+(i[1]+a[1])+","+(o[0]-s[0])+","+(o[1]-s[1])+","+o[0]+","+o[1];for(var u=2;u<e.length;u++,l++)o=t[l],s=e[u],n+="S"+(o[0]-s[0])+","+(o[1]-s[1])+","+o[0]+","+o[1]}if(r){var c=t[l];n+="Q"+(o[0]+2*s[0]/3)+","+(o[1]+2*s[1]/3)+","+c[0]+","+c[1]}return n}function Po(t,e){for(var r,n=[],i=(1-e)/2,o=t[0],a=t[1],s=1,l=t.length;++s<l;)r=o,o=a,a=t[s],n.push([i*(a[0]-r[0]),i*(a[1]-r[1])]);return n}function Co(t){if(t.length<3)return Mo(t);var e=1,r=t.length,n=t[0],i=n[0],o=n[1],a=[i,i,i,(n=t[1])[0]],s=[o,o,o,n[1]],l=[i,",",o,"L",Fo(jl,a),",",Fo(jl,s)];for(t.push(t[r-1]);++e<=r;)n=t[e],a.shift(),a.push(n[0]),s.shift(),s.push(n[1]),jo(l,a,s);return t.pop(),l.push("L",n),l.join("")}function Ro(t){if(t.length<4)return Mo(t);for(var e,r=[],n=-1,i=t.length,o=[0],a=[0];++n<3;)e=t[n],o.push(e[0]),a.push(e[1]);for(r.push(Fo(jl,o)+","+Fo(jl,a)),--n;++n<i;)e=t[n],o.shift(),o.push(e[0]),a.shift(),a.push(e[1]),jo(r,o,a);return r.join("")}function Do(t){for(var e,r,n=-1,i=t.length,o=i+4,a=[],s=[];++n<4;)r=t[n%i],a.push(r[0]),s.push(r[1]);for(e=[Fo(jl,a),",",Fo(jl,s)],--n;++n<o;)r=t[n%i],a.shift(),a.push(r[0]),s.shift(),s.push(r[1]),jo(e,a,s);return e.join("")}function Oo(t,e){var r=t.length-1;if(r)for(var n,i,o=t[0][0],a=t[0][1],s=t[r][0]-o,l=t[r][1]-a,u=-1;++u<=r;)n=t[u],i=u/r,n[0]=e*n[0]+(1-e)*(o+i*s),n[1]=e*n[1]+(1-e)*(a+i*l);return Co(t)}function Fo(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]}function jo(t,e,r){t.push("C",Fo(Ol,e),",",Fo(Ol,r),",",Fo(Fl,e),",",Fo(Fl,r),",",Fo(jl,e),",",Fo(jl,r))}function No(t,e){return(e[1]-t[1])/(e[0]-t[0])}function Bo(t){for(var e=0,r=t.length-1,n=[],i=t[0],o=t[1],a=n[0]=No(i,o);++e<r;)n[e]=(a+(a=No(i=o,o=t[e+1])))/2;return n[e]=a,n}function Uo(t){for(var e,r,n,i,o=[],a=Bo(t),s=-1,l=t.length-1;++s<l;)e=No(t[s],t[s+1]),wa(e)<Na?a[s]=a[s+1]=0:(r=a[s]/e,n=a[s+1]/e,i=r*r+n*n,i>9&&(i=3*e/Math.sqrt(i),a[s]=i*r,a[s+1]=i*n));for(s=-1;++s<=l;)i=(t[Math.min(l,s+1)][0]-t[Math.max(0,s-1)][0])/(6*(1+a[s]*a[s])),o.push([i||0,a[s]*i||0]);return o}function Vo(t){return t.length<3?Mo(t):t[0]+Io(t,Uo(t))}function qo(t){for(var e,r,n,i=-1,o=t.length;++i<o;)e=t[i],r=e[0],n=e[1]-Ga,e[0]=r*Math.cos(n),e[1]=r*Math.sin(n);return t}function Go(t){function e(e){function l(){v.push("M",s(t(g),h),c,u(t(m.reverse()),h),"Z")}for(var f,d,p,v=[],m=[],g=[],y=-1,b=e.length,x=St(r),_=St(i),w=r===n?function(){return d}:St(n),M=i===o?function(){return p}:St(o);++y<b;)a.call(this,f=e[y],y)?(m.push([d=+x.call(this,f,y),p=+_.call(this,f,y)]),g.push([+w.call(this,f,y),+M.call(this,f,y)])):m.length&&(l(),m=[],g=[]);return m.length&&l(),v.length?v.join(""):null}var r=zr,n=zr,i=0,o=Ir,a=Ie,s=Mo,l=s.key,u=s,c="L",h=.7;return e.x=function(t){return arguments.length?(r=n=t,e):n},e.x0=function(t){return arguments.length?(r=t,e):r},e.x1=function(t){return arguments.length?(n=t,e):n},e.y=function(t){return arguments.length?(i=o=t,e):o},e.y0=function(t){return arguments.length?(i=t,e):i},e.y1=function(t){return arguments.length?(o=t,e):o},e.defined=function(t){return arguments.length?(a=t,e):a},e.interpolate=function(t){return arguments.length?(l="function"==typeof t?s=t:(s=Dl.get(t)||Mo).key,u=s.reverse||s,c=s.closed?"M":"L",e):l},e.tension=function(t){return arguments.length?(h=t,e):h},e}function Ho(t){return t.radius}function Xo(t){return[t.x,t.y]}function Yo(t){return function(){var e=t.apply(this,arguments),r=e[0],n=e[1]-Ga;return[r*Math.cos(n),r*Math.sin(n)]}}function Wo(){return 64}function Zo(){return"circle"}function Ko(t){var e=Math.sqrt(t/Ua);return"M0,"+e+"A"+e+","+e+" 0 1,1 0,"+-e+"A"+e+","+e+" 0 1,1 0,"+e+"Z"}function Jo(t){return function(){var e,r,n;(e=this[t])&&(n=e[r=e.active])&&(n.timer.c=null,n.timer.t=NaN,--e.count?delete e[r]:delete this[t],e.active+=.5,n.event&&n.event.interrupt.call(this,this.__data__,n.index))}}function $o(t,e,r){return Ea(t,Hl),t.namespace=e,t.id=r,t}function Qo(t,e,r,n){var i=t.id,o=t.namespace;return H(t,"function"==typeof r?function(t,a,s){t[o][i].tween.set(e,n(r.call(t,t.__data__,a,s)))}:(r=n(r),function(t){t[o][i].tween.set(e,r)}))}function ta(t){return null==t&&(t=""),function(){this.textContent=t}}function ea(t){return null==t?"__transition__":"__transition_"+t+"__"}function ra(t,e,r,n,i){function o(t){var e=v.delay;return u.t=e+l,t>=e?a(t-e):void(u.c=a)}function a(r){var i=p.active,o=p[i];o&&(o.timer.c=null,o.timer.t=NaN,--p.count,delete p[i],o.event&&o.event.interrupt.call(t,t.__data__,o.index));for(var a in p)if(n>+a){var h=p[a];h.timer.c=null,h.timer.t=NaN,--p.count,delete p[a]}u.c=s,Ct(function(){return u.c&&s(r||1)&&(u.c=null,u.t=NaN),1},0,l),p.active=n,v.event&&v.event.start.call(t,t.__data__,e),d=[],v.tween.forEach(function(r,n){(n=n.call(t,t.__data__,e))&&d.push(n)}),f=v.ease,c=v.duration}function s(i){for(var o=i/c,a=f(o),s=d.length;s>0;)d[--s].call(t,a);return o>=1?(v.event&&v.event.end.call(t,t.__data__,e),--p.count?delete p[n]:delete t[r],1):void 0}var l,u,c,f,d,p=t[r]||(t[r]={active:0,count:0}),v=p[n];v||(l=i.time,u=Ct(o,0,l),v=p[n]={tween:new h,time:l,timer:u,delay:i.delay,duration:i.duration,ease:i.ease,index:e},i=null,++p.count)}function na(t,e,r){t.attr("transform",function(t){var n=e(t);return"translate("+(isFinite(n)?n:r(t))+",0)"})}function ia(t,e,r){t.attr("transform",function(t){var n=e(t);return"translate(0,"+(isFinite(n)?n:r(t))+")"})}function oa(t){return t.toISOString()}function aa(t,e,r){function n(e){return t(e)}function i(t,r){var n=t[1]-t[0],i=n/r,o=ca.bisect(tu,i);return o==tu.length?[e.year,to(t.map(function(t){return t/31536e6}),r)[2]]:o?e[i/tu[o-1]<tu[o]/i?o-1:o]:[nu,to(t,r)[2]]}return n.invert=function(e){return sa(t.invert(e))},n.domain=function(e){return arguments.length?(t.domain(e),n):t.domain().map(sa)},n.nice=function(t,e){function r(r){return!isNaN(r)&&!t.range(r,sa(+r+1),e).length}var o=n.domain(),a=Hi(o),s=null==t?i(a,10):"number"==typeof t&&i(a,t);return s&&(t=s[0],e=s[1]),n.domain(Wi(o,e>1?{floor:function(e){for(;r(e=t.floor(e));)e=sa(e-1);return e},ceil:function(e){for(;r(e=t.ceil(e));)e=sa(+e+1);return e}}:t))},n.ticks=function(t,e){var r=Hi(n.domain()),o=null==t?i(r,10):"number"==typeof t?i(r,t):!t.range&&[{range:t},e];return o&&(t=o[0],e=o[1]),t.range(r[0],sa(+r[1]+1),1>e?1:e)},n.tickFormat=function(){return r},n.copy=function(){return aa(t.copy(),e,r)},$i(n,t)}function sa(t){return new Date(t)}function la(t){return JSON.parse(t.responseText)}function ua(t){var e=da.createRange();return e.selectNode(da.body),e.createContextualFragment(t.responseText)}var ca={version:"3.5.16"},ha=[].slice,fa=function(t){return ha.call(t)},da=this.document;if(da)try{fa(da.documentElement.childNodes)[0].nodeType}catch(pa){fa=function(t){for(var e=t.length,r=new Array(e);e--;)r[e]=t[e];return r}}if(Date.now||(Date.now=function(){return+new Date}),da)try{da.createElement("DIV").style.setProperty("opacity",0,"")}catch(va){var ma=this.Element.prototype,ga=ma.setAttribute,ya=ma.setAttributeNS,ba=this.CSSStyleDeclaration.prototype,xa=ba.setProperty;ma.setAttribute=function(t,e){ga.call(this,t,e+"")},ma.setAttributeNS=function(t,e,r){ya.call(this,t,e,r+"")},ba.setProperty=function(t,e,r){xa.call(this,t,e+"",r)}}ca.ascending=i,ca.descending=function(t,e){return t>e?-1:e>t?1:e>=t?0:NaN},ca.min=function(t,e){var r,n,i=-1,o=t.length;if(1===arguments.length){for(;++i<o;)if(null!=(n=t[i])&&n>=n){r=n;break}for(;++i<o;)null!=(n=t[i])&&r>n&&(r=n)}else{for(;++i<o;)if(null!=(n=e.call(t,t[i],i))&&n>=n){r=n;break}for(;++i<o;)null!=(n=e.call(t,t[i],i))&&r>n&&(r=n)}return r},ca.max=function(t,e){var r,n,i=-1,o=t.length;if(1===arguments.length){for(;++i<o;)if(null!=(n=t[i])&&n>=n){r=n;break}for(;++i<o;)null!=(n=t[i])&&n>r&&(r=n)}else{for(;++i<o;)if(null!=(n=e.call(t,t[i],i))&&n>=n){r=n;break}for(;++i<o;)null!=(n=e.call(t,t[i],i))&&n>r&&(r=n)}return r},ca.extent=function(t,e){var r,n,i,o=-1,a=t.length;if(1===arguments.length){for(;++o<a;)if(null!=(n=t[o])&&n>=n){r=i=n;break}for(;++o<a;)null!=(n=t[o])&&(r>n&&(r=n),n>i&&(i=n))}else{for(;++o<a;)if(null!=(n=e.call(t,t[o],o))&&n>=n){r=i=n;break}for(;++o<a;)null!=(n=e.call(t,t[o],o))&&(r>n&&(r=n),n>i&&(i=n))}return[r,i]},ca.sum=function(t,e){var r,n=0,i=t.length,o=-1;if(1===arguments.length)for(;++o<i;)a(r=+t[o])&&(n+=r);else for(;++o<i;)a(r=+e.call(t,t[o],o))&&(n+=r);return n},ca.mean=function(t,e){var r,n=0,i=t.length,s=-1,l=i;if(1===arguments.length)for(;++s<i;)a(r=o(t[s]))?n+=r:--l;else for(;++s<i;)a(r=o(e.call(t,t[s],s)))?n+=r:--l;return l?n/l:void 0},ca.quantile=function(t,e){var r=(t.length-1)*e+1,n=Math.floor(r),i=+t[n-1],o=r-n;return o?i+o*(t[n]-i):i},ca.median=function(t,e){var r,n=[],s=t.length,l=-1;if(1===arguments.length)for(;++l<s;)a(r=o(t[l]))&&n.push(r);else for(;++l<s;)a(r=o(e.call(t,t[l],l)))&&n.push(r);return n.length?ca.quantile(n.sort(i),.5):void 0},ca.variance=function(t,e){var r,n,i=t.length,s=0,l=0,u=-1,c=0;if(1===arguments.length)for(;++u<i;)a(r=o(t[u]))&&(n=r-s,s+=n/++c,l+=n*(r-s));else for(;++u<i;)a(r=o(e.call(t,t[u],u)))&&(n=r-s,s+=n/++c,l+=n*(r-s));return c>1?l/(c-1):void 0},ca.deviation=function(){var t=ca.variance.apply(this,arguments);return t?Math.sqrt(t):t};var _a=s(i);ca.bisectLeft=_a.left,ca.bisect=ca.bisectRight=_a.right,ca.bisector=function(t){return s(1===t.length?function(e,r){return i(t(e),r)}:t)},ca.shuffle=function(t,e,r){(o=arguments.length)<3&&(r=t.length,2>o&&(e=0));for(var n,i,o=r-e;o;)i=Math.random()*o--|0,n=t[o+e],t[o+e]=t[i+e],t[i+e]=n;return t},ca.permute=function(t,e){for(var r=e.length,n=new Array(r);r--;)n[r]=t[e[r]];return n},ca.pairs=function(t){for(var e,r=0,n=t.length-1,i=t[0],o=new Array(0>n?0:n);n>r;)o[r]=[e=i,i=t[++r]];return o},ca.transpose=function(t){if(!(i=t.length))return[];for(var e=-1,r=ca.min(t,l),n=new Array(r);++e<r;)for(var i,o=-1,a=n[e]=new Array(i);++o<i;)a[o]=t[o][e];return n},ca.zip=function(){return ca.transpose(arguments)},ca.keys=function(t){var e=[];for(var r in t)e.push(r);return e},ca.values=function(t){var e=[];for(var r in t)e.push(t[r]);return e},ca.entries=function(t){var e=[];for(var r in t)e.push({key:r,value:t[r]});return e},ca.merge=function(t){for(var e,r,n,i=t.length,o=-1,a=0;++o<i;)a+=t[o].length;for(r=new Array(a);--i>=0;)for(n=t[i],e=n.length;--e>=0;)r[--a]=n[e];return r};var wa=Math.abs;ca.range=function(t,e,r){if(arguments.length<3&&(r=1,arguments.length<2&&(e=t,t=0)),(e-t)/r===1/0)throw new Error("infinite range");var n,i=[],o=u(wa(r)),a=-1;if(t*=o,e*=o,r*=o,0>r)for(;(n=t+r*++a)>e;)i.push(n/o);else for(;(n=t+r*++a)<e;)i.push(n/o);return i},ca.map=function(t,e){var r=new h;if(t instanceof h)t.forEach(function(t,e){r.set(t,e)});else if(Array.isArray(t)){var n,i=-1,o=t.length;if(1===arguments.length)for(;++i<o;)r.set(i,t[i]);else for(;++i<o;)r.set(e.call(t,n=t[i],i),n)}else for(var a in t)r.set(a,t[a]);return r};var Ma="__proto__",ka="\x00";c(h,{has:p,get:function(t){return this._[f(t)]},set:function(t,e){return this._[f(t)]=e},remove:v,keys:m,values:function(){var t=[];for(var e in this._)t.push(this._[e]);return t},entries:function(){var t=[];for(var e in this._)t.push({key:d(e),value:this._[e]});return t},size:g,empty:y,forEach:function(t){for(var e in this._)t.call(this,d(e),this._[e])}}),ca.nest=function(){function t(e,a,s){if(s>=o.length)return n?n.call(i,a):r?a.sort(r):a;for(var l,u,c,f,d=-1,p=a.length,v=o[s++],m=new h;++d<p;)(f=m.get(l=v(u=a[d])))?f.push(u):m.set(l,[u]);return e?(u=e(),c=function(r,n){u.set(r,t(e,n,s))}):(u={},c=function(r,n){u[r]=t(e,n,s)}),m.forEach(c),u}function e(t,r){if(r>=o.length)return t;var n=[],i=a[r++];return t.forEach(function(t,i){n.push({key:t,values:e(i,r)})}),i?n.sort(function(t,e){return i(t.key,e.key)}):n}var r,n,i={},o=[],a=[];return i.map=function(e,r){return t(r,e,0)},i.entries=function(r){return e(t(ca.map,r,0),0)},i.key=function(t){return o.push(t),i},i.sortKeys=function(t){return a[o.length-1]=t,i},i.sortValues=function(t){return r=t,i},i.rollup=function(t){return n=t,i},i},ca.set=function(t){var e=new b;if(t)for(var r=0,n=t.length;n>r;++r)e.add(t[r]);return e},c(b,{has:p,add:function(t){return this._[f(t+="")]=!0,t},remove:v,values:m,size:g,empty:y,forEach:function(t){for(var e in this._)t.call(this,d(e))}}),ca.behavior={},ca.rebind=function(t,e){for(var r,n=1,i=arguments.length;++n<i;)t[r=arguments[n]]=_(t,e,e[r]);return t};var Aa=["webkit","ms","moz","Moz","o","O"];ca.dispatch=function(){for(var t=new k,e=-1,r=arguments.length;++e<r;)t[arguments[e]]=A(t);return t},k.prototype.on=function(t,e){var r=t.indexOf("."),n="";if(r>=0&&(n=t.slice(r+1),t=t.slice(0,r)),t)return arguments.length<2?this[t].on(n):this[t].on(n,e);if(2===arguments.length){if(null==e)for(t in this)this.hasOwnProperty(t)&&this[t].on(n,null);return this}},ca.event=null,ca.requote=function(t){return t.replace(Ta,"\\$&")};var Ta=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,Ea={}.__proto__?function(t,e){t.__proto__=e}:function(t,e){for(var r in e)t[r]=e[r]},Sa=function(t,e){return e.querySelector(t)},La=function(t,e){return e.querySelectorAll(t)},za=function(t,e){var r=t.matches||t[w(t,"matchesSelector")];return(za=function(t,e){return r.call(t,e)})(t,e)};"function"==typeof Sizzle&&(Sa=function(t,e){return Sizzle(t,e)[0]||null},La=Sizzle,za=Sizzle.matchesSelector),ca.selection=function(){return ca.select(da.documentElement)};var Ia=ca.selection.prototype=[];Ia.select=function(t){var e,r,n,i,o=[];t=z(t);for(var a=-1,s=this.length;++a<s;){o.push(e=[]),e.parentNode=(n=this[a]).parentNode;for(var l=-1,u=n.length;++l<u;)(i=n[l])?(e.push(r=t.call(i,i.__data__,l,a)),r&&"__data__"in i&&(r.__data__=i.__data__)):e.push(null)}return L(o)},Ia.selectAll=function(t){var e,r,n=[];t=I(t);for(var i=-1,o=this.length;++i<o;)for(var a=this[i],s=-1,l=a.length;++s<l;)(r=a[s])&&(n.push(e=fa(t.call(r,r.__data__,s,i))),e.parentNode=r);return L(n)};var Pa="http://www.w3.org/1999/xhtml",Ca={svg:"http://www.w3.org/2000/svg",xhtml:Pa,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};ca.ns={prefix:Ca,qualify:function(t){var e=t.indexOf(":"),r=t;return e>=0&&"xmlns"!==(r=t.slice(0,e))&&(t=t.slice(e+1)),Ca.hasOwnProperty(r)?{space:Ca[r],local:t}:t}},Ia.attr=function(t,e){if(arguments.length<2){if("string"==typeof t){var r=this.node();return t=ca.ns.qualify(t),t.local?r.getAttributeNS(t.space,t.local):r.getAttribute(t)}for(e in t)this.each(P(e,t[e]));return this}return this.each(P(t,e))},Ia.classed=function(t,e){if(arguments.length<2){if("string"==typeof t){var r=this.node(),n=(t=D(t)).length,i=-1;if(e=r.classList){for(;++i<n;)if(!e.contains(t[i]))return!1}else for(e=r.getAttribute("class");++i<n;)if(!R(t[i]).test(e))return!1;return!0}for(e in t)this.each(O(e,t[e]));return this}return this.each(O(t,e))},Ia.style=function(t,e,r){var i=arguments.length;if(3>i){if("string"!=typeof t){2>i&&(e="");for(r in t)this.each(j(r,t[r],e));return this}if(2>i){var o=this.node();return n(o).getComputedStyle(o,null).getPropertyValue(t)}r=""}return this.each(j(t,e,r))},Ia.property=function(t,e){if(arguments.length<2){if("string"==typeof t)return this.node()[t];for(e in t)this.each(N(e,t[e]));return this}return this.each(N(t,e))},Ia.text=function(t){return arguments.length?this.each("function"==typeof t?function(){var e=t.apply(this,arguments);this.textContent=null==e?"":e}:null==t?function(){this.textContent=""}:function(){this.textContent=t}):this.node().textContent},Ia.html=function(t){return arguments.length?this.each("function"==typeof t?function(){var e=t.apply(this,arguments);this.innerHTML=null==e?"":e}:null==t?function(){this.innerHTML=""}:function(){this.innerHTML=t}):this.node().innerHTML},Ia.append=function(t){return t=B(t),this.select(function(){return this.appendChild(t.apply(this,arguments))})},Ia.insert=function(t,e){return t=B(t),e=z(e),this.select(function(){return this.insertBefore(t.apply(this,arguments),e.apply(this,arguments)||null)})},Ia.remove=function(){return this.each(U)},Ia.data=function(t,e){function r(t,r){var n,i,o,a=t.length,c=r.length,f=Math.min(a,c),d=new Array(c),p=new Array(c),v=new Array(a);if(e){var m,g=new h,y=new Array(a);for(n=-1;++n<a;)(i=t[n])&&(g.has(m=e.call(i,i.__data__,n))?v[n]=i:g.set(m,i),y[n]=m);for(n=-1;++n<c;)(i=g.get(m=e.call(r,o=r[n],n)))?i!==!0&&(d[n]=i,i.__data__=o):p[n]=V(o),g.set(m,!0);for(n=-1;++n<a;)n in y&&g.get(y[n])!==!0&&(v[n]=t[n])}else{for(n=-1;++n<f;)i=t[n],o=r[n],i?(i.__data__=o,d[n]=i):p[n]=V(o);for(;c>n;++n)p[n]=V(r[n]);for(;a>n;++n)v[n]=t[n]}p.update=d,p.parentNode=d.parentNode=v.parentNode=t.parentNode,s.push(p),l.push(d),u.push(v)}var n,i,o=-1,a=this.length;if(!arguments.length){for(t=new Array(a=(n=this[0]).length);++o<a;)(i=n[o])&&(t[o]=i.__data__);return t}var s=X([]),l=L([]),u=L([]);if("function"==typeof t)for(;++o<a;)r(n=this[o],t.call(n,n.parentNode.__data__,o));else for(;++o<a;)r(n=this[o],t);return l.enter=function(){return s},l.exit=function(){return u},l},Ia.datum=function(t){return arguments.length?this.property("__data__",t):this.property("__data__")},Ia.filter=function(t){var e,r,n,i=[];"function"!=typeof t&&(t=q(t));for(var o=0,a=this.length;a>o;o++){i.push(e=[]),e.parentNode=(r=this[o]).parentNode;for(var s=0,l=r.length;l>s;s++)(n=r[s])&&t.call(n,n.__data__,s,o)&&e.push(n)}return L(i)},Ia.order=function(){for(var t=-1,e=this.length;++t<e;)for(var r,n=this[t],i=n.length-1,o=n[i];--i>=0;)(r=n[i])&&(o&&o!==r.nextSibling&&o.parentNode.insertBefore(r,o),o=r);return this},Ia.sort=function(t){t=G.apply(this,arguments);for(var e=-1,r=this.length;++e<r;)this[e].sort(t);return this.order()},Ia.each=function(t){return H(this,function(e,r,n){t.call(e,e.__data__,r,n)})},Ia.call=function(t){var e=fa(arguments);return t.apply(e[0]=this,e),this},Ia.empty=function(){return!this.node()},Ia.node=function(){for(var t=0,e=this.length;e>t;t++)for(var r=this[t],n=0,i=r.length;i>n;n++){var o=r[n];if(o)return o}return null},Ia.size=function(){var t=0;return H(this,function(){++t}),t};var Ra=[];ca.selection.enter=X,ca.selection.enter.prototype=Ra,Ra.append=Ia.append,Ra.empty=Ia.empty,Ra.node=Ia.node,Ra.call=Ia.call,Ra.size=Ia.size,Ra.select=function(t){for(var e,r,n,i,o,a=[],s=-1,l=this.length;++s<l;){n=(i=this[s]).update,a.push(e=[]),e.parentNode=i.parentNode;for(var u=-1,c=i.length;++u<c;)(o=i[u])?(e.push(n[u]=r=t.call(i.parentNode,o.__data__,u,s)),r.__data__=o.__data__):e.push(null)}return L(a)},Ra.insert=function(t,e){return arguments.length<2&&(e=Y(this)),Ia.insert.call(this,t,e)},ca.select=function(t){var r;return"string"==typeof t?(r=[Sa(t,da)],r.parentNode=da.documentElement):(r=[t],r.parentNode=e(t)),L([r])},ca.selectAll=function(t){var e;return"string"==typeof t?(e=fa(La(t,da)),e.parentNode=da.documentElement):(e=fa(t),e.parentNode=null),L([e])},Ia.on=function(t,e,r){var n=arguments.length;if(3>n){if("string"!=typeof t){2>n&&(e=!1);for(r in t)this.each(W(r,t[r],e));return this}if(2>n)return(n=this.node()["__on"+t])&&n._;r=!1}return this.each(W(t,e,r))};var Da=ca.map({mouseenter:"mouseover",mouseleave:"mouseout"});da&&Da.forEach(function(t){"on"+t in da&&Da.remove(t)});var Oa,Fa=0;ca.mouse=function(t){return $(t,E())};var ja=this.navigator&&/WebKit/.test(this.navigator.userAgent)?-1:0;ca.touch=function(t,e,r){if(arguments.length<3&&(r=e,e=E().changedTouches),e)for(var n,i=0,o=e.length;o>i;++i)if((n=e[i]).identifier===r)return $(t,n)},ca.behavior.drag=function(){function t(){this.on("mousedown.drag",o).on("touchstart.drag",a)}function e(t,e,n,o,a){return function(){function s(){var t,r,n=e(f,v);n&&(t=n[0]-b[0],r=n[1]-b[1],p|=t|r,b=n,d({type:"drag",x:n[0]+u[0],y:n[1]+u[1],dx:t,dy:r}))}function l(){e(f,v)&&(g.on(o+m,null).on(a+m,null),y(p),d({type:"dragend"}))}var u,c=this,h=ca.event.target.correspondingElement||ca.event.target,f=c.parentNode,d=r.of(c,arguments),p=0,v=t(),m=".drag"+(null==v?"":"-"+v),g=ca.select(n(h)).on(o+m,s).on(a+m,l),y=J(h),b=e(f,v);i?(u=i.apply(c,arguments),u=[u.x-b[0],u.y-b[1]]):u=[0,0],d({type:"dragstart"})}}var r=S(t,"drag","dragstart","dragend"),i=null,o=e(M,ca.mouse,n,"mousemove","mouseup"),a=e(Q,ca.touch,x,"touchmove","touchend");return t.origin=function(e){return arguments.length?(i=e,t):i},ca.rebind(t,r,"on")},ca.touches=function(t,e){return arguments.length<2&&(e=E().touches),e?fa(e).map(function(e){var r=$(t,e);return r.identifier=e.identifier,r}):[]};var Na=1e-6,Ba=Na*Na,Ua=Math.PI,Va=2*Ua,qa=Va-Na,Ga=Ua/2,Ha=Ua/180,Xa=180/Ua,Ya=Math.SQRT2,Wa=2,Za=4;ca.interpolateZoom=function(t,e){var r,n,i=t[0],o=t[1],a=t[2],s=e[0],l=e[1],u=e[2],c=s-i,h=l-o,f=c*c+h*h;if(Ba>f)n=Math.log(u/a)/Ya,r=function(t){return[i+t*c,o+t*h,a*Math.exp(Ya*t*n)]};else{var d=Math.sqrt(f),p=(u*u-a*a+Za*f)/(2*a*Wa*d),v=(u*u-a*a-Za*f)/(2*u*Wa*d),m=Math.log(Math.sqrt(p*p+1)-p),g=Math.log(Math.sqrt(v*v+1)-v);n=(g-m)/Ya,r=function(t){var e=t*n,r=ot(m),s=a/(Wa*d)*(r*at(Ya*e+m)-it(m));return[i+s*c,o+s*h,a*r/ot(Ya*e+m)]}}return r.duration=1e3*n,r},ca.behavior.zoom=function(){function t(t){t.on(I,h).on(Ja+".zoom",d).on("dblclick.zoom",p).on(R,f)}function e(t){return[(t[0]-k.x)/k.k,(t[1]-k.y)/k.k]}function r(t){return[t[0]*k.k+k.x,t[1]*k.k+k.y]}function i(t){k.k=Math.max(E[0],Math.min(E[1],t))}function o(t,e){e=r(e),k.x+=t[0]-e[0],k.y+=t[1]-e[1]}function a(e,r,n,a){e.__chart__={x:k.x,y:k.y,k:k.k},i(Math.pow(2,a)),o(m=r,n),e=ca.select(e),L>0&&(e=e.transition().duration(L)),e.call(t.event)}function s(){_&&_.domain(x.range().map(function(t){return(t-k.x)/k.k}).map(x.invert)),M&&M.domain(w.range().map(function(t){return(t-k.y)/k.k}).map(w.invert))}function l(t){z++||t({type:"zoomstart"})}function u(t){s(),t({type:"zoom",scale:k.k,translate:[k.x,k.y]})}function c(t){--z||(t({type:"zoomend"}),m=null)}function h(){function t(){s=1,o(ca.mouse(i),f),u(a)}function r(){h.on(P,null).on(C,null),d(s),c(a)}var i=this,a=D.of(i,arguments),s=0,h=ca.select(n(i)).on(P,t).on(C,r),f=e(ca.mouse(i)),d=J(i);Gl.call(i),l(a)}function f(){function t(){var t=ca.touches(p);return d=k.k,t.forEach(function(t){t.identifier in m&&(m[t.identifier]=e(t))}),t}function r(){var e=ca.event.target;ca.select(e).on(x,n).on(_,s),w.push(e);for(var r=ca.event.changedTouches,i=0,o=r.length;o>i;++i)m[r[i].identifier]=null;var l=t(),u=Date.now();if(1===l.length){if(500>u-b){var c=l[0];a(p,c,m[c.identifier],Math.floor(Math.log(k.k)/Math.LN2)+1),T()}b=u}else if(l.length>1){var c=l[0],h=l[1],f=c[0]-h[0],d=c[1]-h[1];g=f*f+d*d}}function n(){var t,e,r,n,a=ca.touches(p);Gl.call(p);for(var s=0,l=a.length;l>s;++s,n=null)if(r=a[s],n=m[r.identifier]){if(e)break;t=r,e=n}if(n){var c=(c=r[0]-t[0])*c+(c=r[1]-t[1])*c,h=g&&Math.sqrt(c/g);t=[(t[0]+r[0])/2,(t[1]+r[1])/2],e=[(e[0]+n[0])/2,(e[1]+n[1])/2],i(h*d)}b=null,o(t,e),u(v)}function s(){if(ca.event.touches.length){for(var e=ca.event.changedTouches,r=0,n=e.length;n>r;++r)delete m[e[r].identifier];for(var i in m)return void t()}ca.selectAll(w).on(y,null),M.on(I,h).on(R,f),A(),c(v)}var d,p=this,v=D.of(p,arguments),m={},g=0,y=".zoom-"+ca.event.changedTouches[0].identifier,x="touchmove"+y,_="touchend"+y,w=[],M=ca.select(p),A=J(p);r(),l(v),M.on(I,null).on(R,r)}function d(){var t=D.of(this,arguments);y?clearTimeout(y):(Gl.call(this),v=e(m=g||ca.mouse(this)),l(t)),y=setTimeout(function(){y=null,c(t)},50),T(),i(Math.pow(2,.002*Ka())*k.k),o(m,v),u(t)}function p(){var t=ca.mouse(this),r=Math.log(k.k)/Math.LN2;a(this,t,e(t),ca.event.shiftKey?Math.ceil(r)-1:Math.floor(r)+1)}var v,m,g,y,b,x,_,w,M,k={x:0,y:0,k:1},A=[960,500],E=$a,L=250,z=0,I="mousedown.zoom",P="mousemove.zoom",C="mouseup.zoom",R="touchstart.zoom",D=S(t,"zoomstart","zoom","zoomend");return Ja||(Ja="onwheel"in da?(Ka=function(){return-ca.event.deltaY*(ca.event.deltaMode?120:1)},"wheel"):"onmousewheel"in da?(Ka=function(){return ca.event.wheelDelta},"mousewheel"):(Ka=function(){return-ca.event.detail},"MozMousePixelScroll")),t.event=function(t){t.each(function(){var t=D.of(this,arguments),e=k;Vl?ca.select(this).transition().each("start.zoom",function(){k=this.__chart__||{x:0,y:0,k:1},l(t)}).tween("zoom:zoom",function(){var r=A[0],n=A[1],i=m?m[0]:r/2,o=m?m[1]:n/2,a=ca.interpolateZoom([(i-k.x)/k.k,(o-k.y)/k.k,r/k.k],[(i-e.x)/e.k,(o-e.y)/e.k,r/e.k]);return function(e){var n=a(e),s=r/n[2];this.__chart__=k={x:i-n[0]*s,y:o-n[1]*s,k:s},u(t)}}).each("interrupt.zoom",function(){c(t)}).each("end.zoom",function(){c(t)}):(this.__chart__=k,l(t),u(t),c(t))})},t.translate=function(e){return arguments.length?(k={x:+e[0],y:+e[1],k:k.k},s(),t):[k.x,k.y]},t.scale=function(e){return arguments.length?(k={x:k.x,y:k.y,k:null},i(+e),s(),t):k.k},t.scaleExtent=function(e){return arguments.length?(E=null==e?$a:[+e[0],+e[1]],t):E},t.center=function(e){return arguments.length?(g=e&&[+e[0],+e[1]],t):g},t.size=function(e){return arguments.length?(A=e&&[+e[0],+e[1]],t):A},t.duration=function(e){return arguments.length?(L=+e,t):L},t.x=function(e){return arguments.length?(_=e,x=e.copy(),k={x:0,y:0,k:1},t):_},t.y=function(e){return arguments.length?(M=e,w=e.copy(),k={x:0,y:0,k:1},t):M},ca.rebind(t,D,"on")};var Ka,Ja,$a=[0,1/0];ca.color=lt,lt.prototype.toString=function(){return this.rgb()+""},ca.hsl=ut;var Qa=ut.prototype=new lt;Qa.brighter=function(t){return t=Math.pow(.7,arguments.length?t:1),new ut(this.h,this.s,this.l/t)},Qa.darker=function(t){return t=Math.pow(.7,arguments.length?t:1),new ut(this.h,this.s,t*this.l)},Qa.rgb=function(){return ct(this.h,this.s,this.l)},ca.hcl=ht;var ts=ht.prototype=new lt;ts.brighter=function(t){return new ht(this.h,this.c,Math.min(100,this.l+es*(arguments.length?t:1)))},ts.darker=function(t){return new ht(this.h,this.c,Math.max(0,this.l-es*(arguments.length?t:1)))},ts.rgb=function(){return ft(this.h,this.c,this.l).rgb()},ca.lab=dt;var es=18,rs=.95047,ns=1,is=1.08883,os=dt.prototype=new lt;os.brighter=function(t){return new dt(Math.min(100,this.l+es*(arguments.length?t:1)),this.a,this.b)},os.darker=function(t){return new dt(Math.max(0,this.l-es*(arguments.length?t:1)),this.a,this.b)},os.rgb=function(){return pt(this.l,this.a,this.b)},ca.rgb=bt;var as=bt.prototype=new lt;as.brighter=function(t){t=Math.pow(.7,arguments.length?t:1);var e=this.r,r=this.g,n=this.b,i=30;return e||r||n?(e&&i>e&&(e=i),r&&i>r&&(r=i),n&&i>n&&(n=i),new bt(Math.min(255,e/t),Math.min(255,r/t),Math.min(255,n/t))):new bt(i,i,i)},as.darker=function(t){return t=Math.pow(.7,arguments.length?t:1),new bt(t*this.r,t*this.g,t*this.b)},as.hsl=function(){return kt(this.r,this.g,this.b)},as.toString=function(){return"#"+wt(this.r)+wt(this.g)+wt(this.b)};var ss=ca.map({aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,
darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074});ss.forEach(function(t,e){ss.set(t,xt(e))}),ca.functor=St,ca.xhr=Lt(x),ca.dsv=function(t,e){function r(t,r,o){arguments.length<3&&(o=r,r=null);var a=zt(t,e,null==r?n:i(r),o);return a.row=function(t){return arguments.length?a.response(null==(r=t)?n:i(t)):r},a}function n(t){return r.parse(t.responseText)}function i(t){return function(e){return r.parse(e.responseText,t)}}function o(e){return e.map(a).join(t)}function a(t){return s.test(t)?'"'+t.replace(/\"/g,'""')+'"':t}var s=new RegExp('["'+t+"\n]"),l=t.charCodeAt(0);return r.parse=function(t,e){var n;return r.parseRows(t,function(t,r){if(n)return n(t,r-1);var i=new Function("d","return {"+t.map(function(t,e){return JSON.stringify(t)+": d["+e+"]"}).join(",")+"}");n=e?function(t,r){return e(i(t),r)}:i})},r.parseRows=function(t,e){function r(){if(c>=u)return a;if(i)return i=!1,o;var e=c;if(34===t.charCodeAt(e)){for(var r=e;r++<u;)if(34===t.charCodeAt(r)){if(34!==t.charCodeAt(r+1))break;++r}c=r+2;var n=t.charCodeAt(r+1);return 13===n?(i=!0,10===t.charCodeAt(r+2)&&++c):10===n&&(i=!0),t.slice(e+1,r).replace(/""/g,'"')}for(;u>c;){var n=t.charCodeAt(c++),s=1;if(10===n)i=!0;else if(13===n)i=!0,10===t.charCodeAt(c)&&(++c,++s);else if(n!==l)continue;return t.slice(e,c-s)}return t.slice(e)}for(var n,i,o={},a={},s=[],u=t.length,c=0,h=0;(n=r())!==a;){for(var f=[];n!==o&&n!==a;)f.push(n),n=r();e&&null==(f=e(f,h++))||s.push(f)}return s},r.format=function(e){if(Array.isArray(e[0]))return r.formatRows(e);var n=new b,i=[];return e.forEach(function(t){for(var e in t)n.has(e)||i.push(n.add(e))}),[i.map(a).join(t)].concat(e.map(function(e){return i.map(function(t){return a(e[t])}).join(t)})).join("\n")},r.formatRows=function(t){return t.map(o).join("\n")},r},ca.csv=ca.dsv(",","text/csv"),ca.tsv=ca.dsv("    ","text/tab-separated-values");var ls,us,cs,hs,fs=this[w(this,"requestAnimationFrame")]||function(t){setTimeout(t,17)};ca.timer=function(){Ct.apply(this,arguments)},ca.timer.flush=function(){Dt(),Ot()},ca.round=function(t,e){return e?Math.round(t*(e=Math.pow(10,e)))/e:Math.round(t)};var ds=["y","z","a","f","p","n","\xb5","m","","k","M","G","T","P","E","Z","Y"].map(jt);ca.formatPrefix=function(t,e){var r=0;return(t=+t)&&(0>t&&(t*=-1),e&&(t=ca.round(t,Ft(t,e))),r=1+Math.floor(1e-12+Math.log(t)/Math.LN10),r=Math.max(-24,Math.min(24,3*Math.floor((r-1)/3)))),ds[8+r/3]};var ps=/(?:([^{])?([<>=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i,vs=ca.map({b:function(t){return t.toString(2)},c:function(t){return String.fromCharCode(t)},o:function(t){return t.toString(8)},x:function(t){return t.toString(16)},X:function(t){return t.toString(16).toUpperCase()},g:function(t,e){return t.toPrecision(e)},e:function(t,e){return t.toExponential(e)},f:function(t,e){return t.toFixed(e)},r:function(t,e){return(t=ca.round(t,Ft(t,e))).toFixed(Math.max(0,Math.min(20,Ft(t*(1+1e-15),e))))}}),ms=ca.time={},gs=Date;Ut.prototype={getDate:function(){return this._.getUTCDate()},getDay:function(){return this._.getUTCDay()},getFullYear:function(){return this._.getUTCFullYear()},getHours:function(){return this._.getUTCHours()},getMilliseconds:function(){return this._.getUTCMilliseconds()},getMinutes:function(){return this._.getUTCMinutes()},getMonth:function(){return this._.getUTCMonth()},getSeconds:function(){return this._.getUTCSeconds()},getTime:function(){return this._.getTime()},getTimezoneOffset:function(){return 0},valueOf:function(){return this._.valueOf()},setDate:function(){ys.setUTCDate.apply(this._,arguments)},setDay:function(){ys.setUTCDay.apply(this._,arguments)},setFullYear:function(){ys.setUTCFullYear.apply(this._,arguments)},setHours:function(){ys.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){ys.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){ys.setUTCMinutes.apply(this._,arguments)},setMonth:function(){ys.setUTCMonth.apply(this._,arguments)},setSeconds:function(){ys.setUTCSeconds.apply(this._,arguments)},setTime:function(){ys.setTime.apply(this._,arguments)}};var ys=Date.prototype;ms.year=Vt(function(t){return t=ms.day(t),t.setMonth(0,1),t},function(t,e){t.setFullYear(t.getFullYear()+e)},function(t){return t.getFullYear()}),ms.years=ms.year.range,ms.years.utc=ms.year.utc.range,ms.day=Vt(function(t){var e=new gs(2e3,0);return e.setFullYear(t.getFullYear(),t.getMonth(),t.getDate()),e},function(t,e){t.setDate(t.getDate()+e)},function(t){return t.getDate()-1}),ms.days=ms.day.range,ms.days.utc=ms.day.utc.range,ms.dayOfYear=function(t){var e=ms.year(t);return Math.floor((t-e-6e4*(t.getTimezoneOffset()-e.getTimezoneOffset()))/864e5)},["sunday","monday","tuesday","wednesday","thursday","friday","saturday"].forEach(function(t,e){e=7-e;var r=ms[t]=Vt(function(t){return(t=ms.day(t)).setDate(t.getDate()-(t.getDay()+e)%7),t},function(t,e){t.setDate(t.getDate()+7*Math.floor(e))},function(t){var r=ms.year(t).getDay();return Math.floor((ms.dayOfYear(t)+(r+e)%7)/7)-(r!==e)});ms[t+"s"]=r.range,ms[t+"s"].utc=r.utc.range,ms[t+"OfYear"]=function(t){var r=ms.year(t).getDay();return Math.floor((ms.dayOfYear(t)+(r+e)%7)/7)}}),ms.week=ms.sunday,ms.weeks=ms.sunday.range,ms.weeks.utc=ms.sunday.utc.range,ms.weekOfYear=ms.sundayOfYear;var bs={"-":"",_:" ",0:"0"},xs=/^\s*\d+/,_s=/^%/;ca.locale=function(t){return{numberFormat:Nt(t),timeFormat:Gt(t)}};var ws=ca.locale({decimal:".",thousands:",",grouping:[3],currency:["$",""],dateTime:"%a %b %e %X %Y",date:"%m/%d/%Y",time:"%H:%M:%S",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});ca.format=ws.numberFormat,ca.geo={},he.prototype={s:0,t:0,add:function(t){fe(t,this.t,Ms),fe(Ms.s,this.s,this),this.s?this.t+=Ms.t:this.s=Ms.t},reset:function(){this.s=this.t=0},valueOf:function(){return this.s}};var Ms=new he;ca.geo.stream=function(t,e){t&&ks.hasOwnProperty(t.type)?ks[t.type](t,e):de(t,e)};var ks={Feature:function(t,e){de(t.geometry,e)},FeatureCollection:function(t,e){for(var r=t.features,n=-1,i=r.length;++n<i;)de(r[n].geometry,e)}},As={Sphere:function(t,e){e.sphere()},Point:function(t,e){t=t.coordinates,e.point(t[0],t[1],t[2])},MultiPoint:function(t,e){for(var r=t.coordinates,n=-1,i=r.length;++n<i;)t=r[n],e.point(t[0],t[1],t[2])},LineString:function(t,e){pe(t.coordinates,e,0)},MultiLineString:function(t,e){for(var r=t.coordinates,n=-1,i=r.length;++n<i;)pe(r[n],e,0)},Polygon:function(t,e){ve(t.coordinates,e)},MultiPolygon:function(t,e){for(var r=t.coordinates,n=-1,i=r.length;++n<i;)ve(r[n],e)},GeometryCollection:function(t,e){for(var r=t.geometries,n=-1,i=r.length;++n<i;)de(r[n],e)}};ca.geo.area=function(t){return Ts=0,ca.geo.stream(t,Ss),Ts};var Ts,Es=new he,Ss={sphere:function(){Ts+=4*Ua},point:M,lineStart:M,lineEnd:M,polygonStart:function(){Es.reset(),Ss.lineStart=me},polygonEnd:function(){var t=2*Es;Ts+=0>t?4*Ua+t:t,Ss.lineStart=Ss.lineEnd=Ss.point=M}};ca.geo.bounds=function(){function t(t,e){b.push(x=[c=t,f=t]),h>e&&(h=e),e>d&&(d=e)}function e(e,r){var n=ge([e*Ha,r*Ha]);if(g){var i=be(g,n),o=[i[1],-i[0],0],a=be(o,i);we(a),a=Me(a);var l=e-p,u=l>0?1:-1,v=a[0]*Xa*u,m=wa(l)>180;if(m^(v>u*p&&u*e>v)){var y=a[1]*Xa;y>d&&(d=y)}else if(v=(v+360)%360-180,m^(v>u*p&&u*e>v)){var y=-a[1]*Xa;h>y&&(h=y)}else h>r&&(h=r),r>d&&(d=r);m?p>e?s(c,e)>s(c,f)&&(f=e):s(e,f)>s(c,f)&&(c=e):f>=c?(c>e&&(c=e),e>f&&(f=e)):e>p?s(c,e)>s(c,f)&&(f=e):s(e,f)>s(c,f)&&(c=e)}else t(e,r);g=n,p=e}function r(){_.point=e}function n(){x[0]=c,x[1]=f,_.point=t,g=null}function i(t,r){if(g){var n=t-p;y+=wa(n)>180?n+(n>0?360:-360):n}else v=t,m=r;Ss.point(t,r),e(t,r)}function o(){Ss.lineStart()}function a(){i(v,m),Ss.lineEnd(),wa(y)>Na&&(c=-(f=180)),x[0]=c,x[1]=f,g=null}function s(t,e){return(e-=t)<0?e+360:e}function l(t,e){return t[0]-e[0]}function u(t,e){return e[0]<=e[1]?e[0]<=t&&t<=e[1]:t<e[0]||e[1]<t}var c,h,f,d,p,v,m,g,y,b,x,_={point:t,lineStart:r,lineEnd:n,polygonStart:function(){_.point=i,_.lineStart=o,_.lineEnd=a,y=0,Ss.polygonStart()},polygonEnd:function(){Ss.polygonEnd(),_.point=t,_.lineStart=r,_.lineEnd=n,0>Es?(c=-(f=180),h=-(d=90)):y>Na?d=90:-Na>y&&(h=-90),x[0]=c,x[1]=f}};return function(t){d=f=-(c=h=1/0),b=[],ca.geo.stream(t,_);var e=b.length;if(e){b.sort(l);for(var r,n=1,i=b[0],o=[i];e>n;++n)r=b[n],u(r[0],i)||u(r[1],i)?(s(i[0],r[1])>s(i[0],i[1])&&(i[1]=r[1]),s(r[0],i[1])>s(i[0],i[1])&&(i[0]=r[0])):o.push(i=r);for(var a,r,p=-(1/0),e=o.length-1,n=0,i=o[e];e>=n;i=r,++n)r=o[n],(a=s(i[1],r[0]))>p&&(p=a,c=r[0],f=i[1])}return b=x=null,c===1/0||h===1/0?[[NaN,NaN],[NaN,NaN]]:[[c,h],[f,d]]}}(),ca.geo.centroid=function(t){Ls=zs=Is=Ps=Cs=Rs=Ds=Os=Fs=js=Ns=0,ca.geo.stream(t,Bs);var e=Fs,r=js,n=Ns,i=e*e+r*r+n*n;return Ba>i&&(e=Rs,r=Ds,n=Os,Na>zs&&(e=Is,r=Ps,n=Cs),i=e*e+r*r+n*n,Ba>i)?[NaN,NaN]:[Math.atan2(r,e)*Xa,nt(n/Math.sqrt(i))*Xa]};var Ls,zs,Is,Ps,Cs,Rs,Ds,Os,Fs,js,Ns,Bs={sphere:M,point:Ae,lineStart:Ee,lineEnd:Se,polygonStart:function(){Bs.lineStart=Le},polygonEnd:function(){Bs.lineStart=Ee}},Us=De(Ie,Ne,Ue,[-Ua,-Ua/2]),Vs=1e9;ca.geo.clipExtent=function(){var t,e,r,n,i,o,a={stream:function(t){return i&&(i.valid=!1),i=o(t),i.valid=!0,i},extent:function(s){return arguments.length?(o=He(t=+s[0][0],e=+s[0][1],r=+s[1][0],n=+s[1][1]),i&&(i.valid=!1,i=null),a):[[t,e],[r,n]]}};return a.extent([[0,0],[960,500]])},(ca.geo.conicEqualArea=function(){return Xe(Ye)}).raw=Ye,ca.geo.albers=function(){return ca.geo.conicEqualArea().rotate([96,0]).center([-.6,38.7]).parallels([29.5,45.5]).scale(1070)},ca.geo.albersUsa=function(){function t(t){var o=t[0],a=t[1];return e=null,r(o,a),e||(n(o,a),e)||i(o,a),e}var e,r,n,i,o=ca.geo.albers(),a=ca.geo.conicEqualArea().rotate([154,0]).center([-2,58.5]).parallels([55,65]),s=ca.geo.conicEqualArea().rotate([157,0]).center([-3,19.9]).parallels([8,18]),l={point:function(t,r){e=[t,r]}};return t.invert=function(t){var e=o.scale(),r=o.translate(),n=(t[0]-r[0])/e,i=(t[1]-r[1])/e;return(i>=.12&&.234>i&&n>=-.425&&-.214>n?a:i>=.166&&.234>i&&n>=-.214&&-.115>n?s:o).invert(t)},t.stream=function(t){var e=o.stream(t),r=a.stream(t),n=s.stream(t);return{point:function(t,i){e.point(t,i),r.point(t,i),n.point(t,i)},sphere:function(){e.sphere(),r.sphere(),n.sphere()},lineStart:function(){e.lineStart(),r.lineStart(),n.lineStart()},lineEnd:function(){e.lineEnd(),r.lineEnd(),n.lineEnd()},polygonStart:function(){e.polygonStart(),r.polygonStart(),n.polygonStart()},polygonEnd:function(){e.polygonEnd(),r.polygonEnd(),n.polygonEnd()}}},t.precision=function(e){return arguments.length?(o.precision(e),a.precision(e),s.precision(e),t):o.precision()},t.scale=function(e){return arguments.length?(o.scale(e),a.scale(.35*e),s.scale(e),t.translate(o.translate())):o.scale()},t.translate=function(e){if(!arguments.length)return o.translate();var u=o.scale(),c=+e[0],h=+e[1];return r=o.translate(e).clipExtent([[c-.455*u,h-.238*u],[c+.455*u,h+.238*u]]).stream(l).point,n=a.translate([c-.307*u,h+.201*u]).clipExtent([[c-.425*u+Na,h+.12*u+Na],[c-.214*u-Na,h+.234*u-Na]]).stream(l).point,i=s.translate([c-.205*u,h+.212*u]).clipExtent([[c-.214*u+Na,h+.166*u+Na],[c-.115*u-Na,h+.234*u-Na]]).stream(l).point,t},t.scale(1070)};var qs,Gs,Hs,Xs,Ys,Ws,Zs={point:M,lineStart:M,lineEnd:M,polygonStart:function(){Gs=0,Zs.lineStart=We},polygonEnd:function(){Zs.lineStart=Zs.lineEnd=Zs.point=M,qs+=wa(Gs/2)}},Ks={point:Ze,lineStart:M,lineEnd:M,polygonStart:M,polygonEnd:M},Js={point:$e,lineStart:Qe,lineEnd:tr,polygonStart:function(){Js.lineStart=er},polygonEnd:function(){Js.point=$e,Js.lineStart=Qe,Js.lineEnd=tr}};ca.geo.path=function(){function t(t){return t&&("function"==typeof s&&o.pointRadius(+s.apply(this,arguments)),a&&a.valid||(a=i(o)),ca.geo.stream(t,a)),o.result()}function e(){return a=null,t}var r,n,i,o,a,s=4.5;return t.area=function(t){return qs=0,ca.geo.stream(t,i(Zs)),qs},t.centroid=function(t){return Is=Ps=Cs=Rs=Ds=Os=Fs=js=Ns=0,ca.geo.stream(t,i(Js)),Ns?[Fs/Ns,js/Ns]:Os?[Rs/Os,Ds/Os]:Cs?[Is/Cs,Ps/Cs]:[NaN,NaN]},t.bounds=function(t){return Ys=Ws=-(Hs=Xs=1/0),ca.geo.stream(t,i(Ks)),[[Hs,Xs],[Ys,Ws]]},t.projection=function(t){return arguments.length?(i=(r=t)?t.stream||ir(t):x,e()):r},t.context=function(t){return arguments.length?(o=null==(n=t)?new Ke:new rr(t),"function"!=typeof s&&o.pointRadius(s),e()):n},t.pointRadius=function(e){return arguments.length?(s="function"==typeof e?e:(o.pointRadius(+e),+e),t):s},t.projection(ca.geo.albersUsa()).context(null)},ca.geo.transform=function(t){return{stream:function(e){var r=new or(e);for(var n in t)r[n]=t[n];return r}}},or.prototype={point:function(t,e){this.stream.point(t,e)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}},ca.geo.projection=sr,ca.geo.projectionMutator=lr,(ca.geo.equirectangular=function(){return sr(cr)}).raw=cr.invert=cr,ca.geo.rotation=function(t){function e(e){return e=t(e[0]*Ha,e[1]*Ha),e[0]*=Xa,e[1]*=Xa,e}return t=fr(t[0]%360*Ha,t[1]*Ha,t.length>2?t[2]*Ha:0),e.invert=function(e){return e=t.invert(e[0]*Ha,e[1]*Ha),e[0]*=Xa,e[1]*=Xa,e},e},hr.invert=cr,ca.geo.circle=function(){function t(){var t="function"==typeof n?n.apply(this,arguments):n,e=fr(-t[0]*Ha,-t[1]*Ha,0).invert,i=[];return r(null,null,1,{point:function(t,r){i.push(t=e(t,r)),t[0]*=Xa,t[1]*=Xa}}),{type:"Polygon",coordinates:[i]}}var e,r,n=[0,0],i=6;return t.origin=function(e){return arguments.length?(n=e,t):n},t.angle=function(n){return arguments.length?(r=mr((e=+n)*Ha,i*Ha),t):e},t.precision=function(n){return arguments.length?(r=mr(e*Ha,(i=+n)*Ha),t):i},t.angle(90)},ca.geo.distance=function(t,e){var r,n=(e[0]-t[0])*Ha,i=t[1]*Ha,o=e[1]*Ha,a=Math.sin(n),s=Math.cos(n),l=Math.sin(i),u=Math.cos(i),c=Math.sin(o),h=Math.cos(o);return Math.atan2(Math.sqrt((r=h*a)*r+(r=u*c-l*h*s)*r),l*c+u*h*s)},ca.geo.graticule=function(){function t(){return{type:"MultiLineString",coordinates:e()}}function e(){return ca.range(Math.ceil(o/m)*m,i,m).map(f).concat(ca.range(Math.ceil(u/g)*g,l,g).map(d)).concat(ca.range(Math.ceil(n/p)*p,r,p).filter(function(t){return wa(t%m)>Na}).map(c)).concat(ca.range(Math.ceil(s/v)*v,a,v).filter(function(t){return wa(t%g)>Na}).map(h))}var r,n,i,o,a,s,l,u,c,h,f,d,p=10,v=p,m=90,g=360,y=2.5;return t.lines=function(){return e().map(function(t){return{type:"LineString",coordinates:t}})},t.outline=function(){return{type:"Polygon",coordinates:[f(o).concat(d(l).slice(1),f(i).reverse().slice(1),d(u).reverse().slice(1))]}},t.extent=function(e){return arguments.length?t.majorExtent(e).minorExtent(e):t.minorExtent()},t.majorExtent=function(e){return arguments.length?(o=+e[0][0],i=+e[1][0],u=+e[0][1],l=+e[1][1],o>i&&(e=o,o=i,i=e),u>l&&(e=u,u=l,l=e),t.precision(y)):[[o,u],[i,l]]},t.minorExtent=function(e){return arguments.length?(n=+e[0][0],r=+e[1][0],s=+e[0][1],a=+e[1][1],n>r&&(e=n,n=r,r=e),s>a&&(e=s,s=a,a=e),t.precision(y)):[[n,s],[r,a]]},t.step=function(e){return arguments.length?t.majorStep(e).minorStep(e):t.minorStep()},t.majorStep=function(e){return arguments.length?(m=+e[0],g=+e[1],t):[m,g]},t.minorStep=function(e){return arguments.length?(p=+e[0],v=+e[1],t):[p,v]},t.precision=function(e){return arguments.length?(y=+e,c=yr(s,a,90),h=br(n,r,y),f=yr(u,l,90),d=br(o,i,y),t):y},t.majorExtent([[-180,-90+Na],[180,90-Na]]).minorExtent([[-180,-80-Na],[180,80+Na]])},ca.geo.greatArc=function(){function t(){return{type:"LineString",coordinates:[e||n.apply(this,arguments),r||i.apply(this,arguments)]}}var e,r,n=xr,i=_r;return t.distance=function(){return ca.geo.distance(e||n.apply(this,arguments),r||i.apply(this,arguments))},t.source=function(r){return arguments.length?(n=r,e="function"==typeof r?null:r,t):n},t.target=function(e){return arguments.length?(i=e,r="function"==typeof e?null:e,t):i},t.precision=function(){return arguments.length?t:0},t},ca.geo.interpolate=function(t,e){return wr(t[0]*Ha,t[1]*Ha,e[0]*Ha,e[1]*Ha)},ca.geo.length=function(t){return $s=0,ca.geo.stream(t,Qs),$s};var $s,Qs={sphere:M,point:M,lineStart:Mr,lineEnd:M,polygonStart:M,polygonEnd:M},tl=kr(function(t){return Math.sqrt(2/(1+t))},function(t){return 2*Math.asin(t/2)});(ca.geo.azimuthalEqualArea=function(){return sr(tl)}).raw=tl;var el=kr(function(t){var e=Math.acos(t);return e&&e/Math.sin(e)},x);(ca.geo.azimuthalEquidistant=function(){return sr(el)}).raw=el,(ca.geo.conicConformal=function(){return Xe(Ar)}).raw=Ar,(ca.geo.conicEquidistant=function(){return Xe(Tr)}).raw=Tr;var rl=kr(function(t){return 1/t},Math.atan);(ca.geo.gnomonic=function(){return sr(rl)}).raw=rl,Er.invert=function(t,e){return[t,2*Math.atan(Math.exp(e))-Ga]},(ca.geo.mercator=function(){return Sr(Er)}).raw=Er;var nl=kr(function(){return 1},Math.asin);(ca.geo.orthographic=function(){return sr(nl)}).raw=nl;var il=kr(function(t){return 1/(1+t)},function(t){return 2*Math.atan(t)});(ca.geo.stereographic=function(){return sr(il)}).raw=il,Lr.invert=function(t,e){return[-e,2*Math.atan(Math.exp(t))-Ga]},(ca.geo.transverseMercator=function(){var t=Sr(Lr),e=t.center,r=t.rotate;return t.center=function(t){return t?e([-t[1],t[0]]):(t=e(),[t[1],-t[0]])},t.rotate=function(t){return t?r([t[0],t[1],t.length>2?t[2]+90:90]):(t=r(),[t[0],t[1],t[2]-90])},r([0,0,90])}).raw=Lr,ca.geom={},ca.geom.hull=function(t){function e(t){if(t.length<3)return[];var e,i=St(r),o=St(n),a=t.length,s=[],l=[];for(e=0;a>e;e++)s.push([+i.call(this,t[e],e),+o.call(this,t[e],e),e]);for(s.sort(Cr),e=0;a>e;e++)l.push([s[e][0],-s[e][1]]);var u=Pr(s),c=Pr(l),h=c[0]===u[0],f=c[c.length-1]===u[u.length-1],d=[];for(e=u.length-1;e>=0;--e)d.push(t[s[u[e]][2]]);for(e=+h;e<c.length-f;++e)d.push(t[s[c[e]][2]]);return d}var r=zr,n=Ir;return arguments.length?e(t):(e.x=function(t){return arguments.length?(r=t,e):r},e.y=function(t){return arguments.length?(n=t,e):n},e)},ca.geom.polygon=function(t){return Ea(t,ol),t};var ol=ca.geom.polygon.prototype=[];ol.area=function(){for(var t,e=-1,r=this.length,n=this[r-1],i=0;++e<r;)t=n,n=this[e],i+=t[1]*n[0]-t[0]*n[1];return.5*i},ol.centroid=function(t){var e,r,n=-1,i=this.length,o=0,a=0,s=this[i-1];for(arguments.length||(t=-1/(6*this.area()));++n<i;)e=s,s=this[n],r=e[0]*s[1]-s[0]*e[1],o+=(e[0]+s[0])*r,a+=(e[1]+s[1])*r;return[o*t,a*t]},ol.clip=function(t){for(var e,r,n,i,o,a,s=Or(t),l=-1,u=this.length-Or(this),c=this[u-1];++l<u;){for(e=t.slice(),t.length=0,i=this[l],o=e[(n=e.length-s)-1],r=-1;++r<n;)a=e[r],Rr(a,c,i)?(Rr(o,c,i)||t.push(Dr(o,a,c,i)),t.push(a)):Rr(o,c,i)&&t.push(Dr(o,a,c,i)),o=a;s&&t.push(t[0]),c=i}return t};var al,sl,ll,ul,cl,hl=[],fl=[];Gr.prototype.prepare=function(){for(var t,e=this.edges,r=e.length;r--;)t=e[r].edge,t.b&&t.a||e.splice(r,1);return e.sort(Xr),e.length},rn.prototype={start:function(){return this.edge.l===this.site?this.edge.a:this.edge.b},end:function(){return this.edge.l===this.site?this.edge.b:this.edge.a}},nn.prototype={insert:function(t,e){var r,n,i;if(t){if(e.P=t,e.N=t.N,t.N&&(t.N.P=e),t.N=e,t.R){for(t=t.R;t.L;)t=t.L;t.L=e}else t.R=e;r=t}else this._?(t=ln(this._),e.P=null,e.N=t,t.P=t.L=e,r=t):(e.P=e.N=null,this._=e,r=null);for(e.L=e.R=null,e.U=r,e.C=!0,t=e;r&&r.C;)n=r.U,r===n.L?(i=n.R,i&&i.C?(r.C=i.C=!1,n.C=!0,t=n):(t===r.R&&(an(this,r),t=r,r=t.U),r.C=!1,n.C=!0,sn(this,n))):(i=n.L,i&&i.C?(r.C=i.C=!1,n.C=!0,t=n):(t===r.L&&(sn(this,r),t=r,r=t.U),r.C=!1,n.C=!0,an(this,n))),r=t.U;this._.C=!1},remove:function(t){t.N&&(t.N.P=t.P),t.P&&(t.P.N=t.N),t.N=t.P=null;var e,r,n,i=t.U,o=t.L,a=t.R;if(r=o?a?ln(a):o:a,i?i.L===t?i.L=r:i.R=r:this._=r,o&&a?(n=r.C,r.C=t.C,r.L=o,o.U=r,r!==a?(i=r.U,r.U=t.U,t=r.R,i.L=t,r.R=a,a.U=r):(r.U=i,i=r,t=r.R)):(n=t.C,t=r),t&&(t.U=i),!n){if(t&&t.C)return void(t.C=!1);do{if(t===this._)break;if(t===i.L){if(e=i.R,e.C&&(e.C=!1,i.C=!0,an(this,i),e=i.R),e.L&&e.L.C||e.R&&e.R.C){e.R&&e.R.C||(e.L.C=!1,e.C=!0,sn(this,e),e=i.R),e.C=i.C,i.C=e.R.C=!1,an(this,i),t=this._;break}}else if(e=i.L,e.C&&(e.C=!1,i.C=!0,sn(this,i),e=i.L),e.L&&e.L.C||e.R&&e.R.C){e.L&&e.L.C||(e.R.C=!1,e.C=!0,an(this,e),e=i.L),e.C=i.C,i.C=e.L.C=!1,sn(this,i),t=this._;break}e.C=!0,t=i,i=i.U}while(!t.C);t&&(t.C=!1)}}},ca.geom.voronoi=function(t){function e(t){var e=new Array(t.length),n=s[0][0],i=s[0][1],o=s[1][0],a=s[1][1];return un(r(t),s).cells.forEach(function(r,s){var l=r.edges,u=r.site,c=e[s]=l.length?l.map(function(t){var e=t.start();return[e.x,e.y]}):u.x>=n&&u.x<=o&&u.y>=i&&u.y<=a?[[n,a],[o,a],[o,i],[n,i]]:[];c.point=t[s]}),e}function r(t){return t.map(function(t,e){return{x:Math.round(o(t,e)/Na)*Na,y:Math.round(a(t,e)/Na)*Na,i:e}})}var n=zr,i=Ir,o=n,a=i,s=dl;return t?e(t):(e.links=function(t){return un(r(t)).edges.filter(function(t){return t.l&&t.r}).map(function(e){return{source:t[e.l.i],target:t[e.r.i]}})},e.triangles=function(t){var e=[];return un(r(t)).cells.forEach(function(r,n){for(var i,o,a=r.site,s=r.edges.sort(Xr),l=-1,u=s.length,c=s[u-1].edge,h=c.l===a?c.r:c.l;++l<u;)i=c,o=h,c=s[l].edge,h=c.l===a?c.r:c.l,n<o.i&&n<h.i&&hn(a,o,h)<0&&e.push([t[n],t[o.i],t[h.i]])}),e},e.x=function(t){return arguments.length?(o=St(n=t),e):n},e.y=function(t){return arguments.length?(a=St(i=t),e):i},e.clipExtent=function(t){return arguments.length?(s=null==t?dl:t,e):s===dl?null:s},e.size=function(t){return arguments.length?e.clipExtent(t&&[[0,0],t]):s===dl?null:s&&s[1]},e)};var dl=[[-1e6,-1e6],[1e6,1e6]];ca.geom.delaunay=function(t){return ca.geom.voronoi().triangles(t)},ca.geom.quadtree=function(t,e,r,n,i){function o(t){function o(t,e,r,n,i,o,a,s){if(!isNaN(r)&&!isNaN(n))if(t.leaf){var l=t.x,c=t.y;if(null!=l)if(wa(l-r)+wa(c-n)<.01)u(t,e,r,n,i,o,a,s);else{var h=t.point;t.x=t.y=t.point=null,u(t,h,l,c,i,o,a,s),u(t,e,r,n,i,o,a,s)}else t.x=r,t.y=n,t.point=e}else u(t,e,r,n,i,o,a,s)}function u(t,e,r,n,i,a,s,l){var u=.5*(i+s),c=.5*(a+l),h=r>=u,f=n>=c,d=f<<1|h;t.leaf=!1,t=t.nodes[d]||(t.nodes[d]=pn()),h?i=u:s=u,f?a=c:l=c,o(t,e,r,n,i,a,s,l)}var c,h,f,d,p,v,m,g,y,b=St(s),x=St(l);if(null!=e)v=e,m=r,g=n,y=i;else if(g=y=-(v=m=1/0),h=[],f=[],p=t.length,a)for(d=0;p>d;++d)c=t[d],c.x<v&&(v=c.x),c.y<m&&(m=c.y),c.x>g&&(g=c.x),c.y>y&&(y=c.y),h.push(c.x),f.push(c.y);else for(d=0;p>d;++d){var _=+b(c=t[d],d),w=+x(c,d);v>_&&(v=_),m>w&&(m=w),_>g&&(g=_),w>y&&(y=w),h.push(_),f.push(w)}var M=g-v,k=y-m;M>k?y=m+M:g=v+k;var A=pn();if(A.add=function(t){o(A,t,+b(t,++d),+x(t,d),v,m,g,y)},A.visit=function(t){vn(t,A,v,m,g,y)},A.find=function(t){return mn(A,t[0],t[1],v,m,g,y)},d=-1,null==e){for(;++d<p;)o(A,t[d],h[d],f[d],v,m,g,y);--d}else t.forEach(A.add);return h=f=t=c=null,A}var a,s=zr,l=Ir;return(a=arguments.length)?(s=fn,l=dn,3===a&&(i=r,n=e,r=e=0),o(t)):(o.x=function(t){return arguments.length?(s=t,o):s},o.y=function(t){return arguments.length?(l=t,o):l},o.extent=function(t){return arguments.length?(null==t?e=r=n=i=null:(e=+t[0][0],r=+t[0][1],n=+t[1][0],i=+t[1][1]),o):null==e?null:[[e,r],[n,i]]},o.size=function(t){return arguments.length?(null==t?e=r=n=i=null:(e=r=0,n=+t[0],i=+t[1]),o):null==e?null:[n-e,i-r]},o)},ca.interpolateRgb=gn,ca.interpolateObject=yn,ca.interpolateNumber=bn,ca.interpolateString=xn;var pl=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,vl=new RegExp(pl.source,"g");ca.interpolate=_n,ca.interpolators=[function(t,e){var r=typeof e;return("string"===r?ss.has(e.toLowerCase())||/^(#|rgb\(|hsl\()/i.test(e)?gn:xn:e instanceof lt?gn:Array.isArray(e)?wn:"object"===r&&isNaN(e)?yn:bn)(t,e)}],ca.interpolateArray=wn;var ml=function(){return x},gl=ca.map({linear:ml,poly:Ln,quad:function(){return Tn},cubic:function(){return En},sin:function(){return zn},exp:function(){return In},circle:function(){return Pn},elastic:Cn,back:Rn,bounce:function(){return Dn}}),yl=ca.map({"in":x,out:kn,"in-out":An,"out-in":function(t){return An(kn(t))}});ca.ease=function(t){var e=t.indexOf("-"),r=e>=0?t.slice(0,e):t,n=e>=0?t.slice(e+1):"in";return r=gl.get(r)||ml,n=yl.get(n)||x,Mn(n(r.apply(null,ha.call(arguments,1))))},ca.interpolateHcl=On,ca.interpolateHsl=Fn,ca.interpolateLab=jn,ca.interpolateRound=Nn,ca.transform=function(t){var e=da.createElementNS(ca.ns.prefix.svg,"g");return(ca.transform=function(t){if(null!=t){e.setAttribute("transform",t);var r=e.transform.baseVal.consolidate()}return new Bn(r?r.matrix:bl)})(t)},Bn.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var bl={a:1,b:0,c:0,d:1,e:0,f:0};ca.interpolateTransform=Zn,ca.layout={},ca.layout.bundle=function(){return function(t){for(var e=[],r=-1,n=t.length;++r<n;)e.push($n(t[r]));return e}},ca.layout.chord=function(){function t(){var t,u,h,f,d,p={},v=[],m=ca.range(o),g=[];for(r=[],n=[],t=0,f=-1;++f<o;){for(u=0,d=-1;++d<o;)u+=i[f][d];v.push(u),g.push(ca.range(o)),t+=u}for(a&&m.sort(function(t,e){return a(v[t],v[e])}),s&&g.forEach(function(t,e){t.sort(function(t,r){return s(i[e][t],i[e][r])})}),t=(Va-c*o)/t,u=0,f=-1;++f<o;){for(h=u,d=-1;++d<o;){var y=m[f],b=g[y][d],x=i[y][b],_=u,w=u+=x*t;p[y+"-"+b]={index:y,subindex:b,startAngle:_,endAngle:w,value:x}}n[y]={index:y,startAngle:h,endAngle:u,value:v[y]},u+=c}for(f=-1;++f<o;)for(d=f-1;++d<o;){var M=p[f+"-"+d],k=p[d+"-"+f];(M.value||k.value)&&r.push(M.value<k.value?{source:k,target:M}:{source:M,target:k})}l&&e()}function e(){r.sort(function(t,e){return l((t.source.value+t.target.value)/2,(e.source.value+e.target.value)/2)})}var r,n,i,o,a,s,l,u={},c=0;return u.matrix=function(t){return arguments.length?(o=(i=t)&&i.length,r=n=null,u):i},u.padding=function(t){return arguments.length?(c=t,r=n=null,u):c},u.sortGroups=function(t){return arguments.length?(a=t,r=n=null,u):a},u.sortSubgroups=function(t){return arguments.length?(s=t,r=null,u):s},u.sortChords=function(t){return arguments.length?(l=t,r&&e(),u):l},u.chords=function(){return r||t(),r},u.groups=function(){return n||t(),n},u},ca.layout.force=function(){function t(t){return function(e,r,n,i){if(e.point!==t){var o=e.cx-t.x,a=e.cy-t.y,s=i-r,l=o*o+a*a;if(l>s*s/g){if(v>l){var u=e.charge/l;t.px-=o*u,t.py-=a*u}return!0}if(e.point&&l&&v>l){var u=e.pointCharge/l;t.px-=o*u,t.py-=a*u}}return!e.charge}}function e(t){t.px=ca.event.x,t.py=ca.event.y,l.resume()}var r,n,i,o,a,s,l={},u=ca.dispatch("start","tick","end"),c=[1,1],h=.9,f=xl,d=_l,p=-30,v=wl,m=.1,g=.64,y=[],b=[];return l.tick=function(){if((i*=.99)<.005)return r=null,u.end({type:"end",alpha:i=0}),!0;var e,n,l,f,d,v,g,x,_,w=y.length,M=b.length;for(n=0;M>n;++n)l=b[n],f=l.source,d=l.target,x=d.x-f.x,_=d.y-f.y,(v=x*x+_*_)&&(v=i*a[n]*((v=Math.sqrt(v))-o[n])/v,x*=v,_*=v,d.x-=x*(g=f.weight+d.weight?f.weight/(f.weight+d.weight):.5),d.y-=_*g,f.x+=x*(g=1-g),f.y+=_*g);if((g=i*m)&&(x=c[0]/2,_=c[1]/2,n=-1,g))for(;++n<w;)l=y[n],l.x+=(x-l.x)*g,l.y+=(_-l.y)*g;if(p)for(oi(e=ca.geom.quadtree(y),i,s),n=-1;++n<w;)(l=y[n]).fixed||e.visit(t(l));for(n=-1;++n<w;)l=y[n],l.fixed?(l.x=l.px,l.y=l.py):(l.x-=(l.px-(l.px=l.x))*h,l.y-=(l.py-(l.py=l.y))*h);u.tick({type:"tick",alpha:i})},l.nodes=function(t){return arguments.length?(y=t,l):y},l.links=function(t){return arguments.length?(b=t,l):b},l.size=function(t){return arguments.length?(c=t,l):c},l.linkDistance=function(t){return arguments.length?(f="function"==typeof t?t:+t,l):f},l.distance=l.linkDistance,l.linkStrength=function(t){return arguments.length?(d="function"==typeof t?t:+t,l):d},l.friction=function(t){return arguments.length?(h=+t,l):h},l.charge=function(t){return arguments.length?(p="function"==typeof t?t:+t,l):p},l.chargeDistance=function(t){return arguments.length?(v=t*t,l):Math.sqrt(v)},l.gravity=function(t){return arguments.length?(m=+t,l):m},l.theta=function(t){return arguments.length?(g=t*t,l):Math.sqrt(g)},l.alpha=function(t){return arguments.length?(t=+t,i?t>0?i=t:(r.c=null,r.t=NaN,r=null,u.end({type:"end",alpha:i=0})):t>0&&(u.start({type:"start",alpha:i=t}),r=Ct(l.tick)),l):i},l.start=function(){function t(t,n){if(!r){for(r=new Array(i),l=0;i>l;++l)r[l]=[];for(l=0;u>l;++l){var o=b[l];r[o.source.index].push(o.target),r[o.target.index].push(o.source)}}for(var a,s=r[e],l=-1,c=s.length;++l<c;)if(!isNaN(a=s[l][t]))return a;return Math.random()*n}var e,r,n,i=y.length,u=b.length,h=c[0],v=c[1];for(e=0;i>e;++e)(n=y[e]).index=e,n.weight=0;for(e=0;u>e;++e)n=b[e],"number"==typeof n.source&&(n.source=y[n.source]),"number"==typeof n.target&&(n.target=y[n.target]),++n.source.weight,++n.target.weight;for(e=0;i>e;++e)n=y[e],isNaN(n.x)&&(n.x=t("x",h)),isNaN(n.y)&&(n.y=t("y",v)),isNaN(n.px)&&(n.px=n.x),isNaN(n.py)&&(n.py=n.y);if(o=[],"function"==typeof f)for(e=0;u>e;++e)o[e]=+f.call(this,b[e],e);else for(e=0;u>e;++e)o[e]=f;if(a=[],"function"==typeof d)for(e=0;u>e;++e)a[e]=+d.call(this,b[e],e);else for(e=0;u>e;++e)a[e]=d;if(s=[],"function"==typeof p)for(e=0;i>e;++e)s[e]=+p.call(this,y[e],e);else for(e=0;i>e;++e)s[e]=p;return l.resume()},l.resume=function(){return l.alpha(.1)},l.stop=function(){return l.alpha(0)},l.drag=function(){return n||(n=ca.behavior.drag().origin(x).on("dragstart.force",ei).on("drag.force",e).on("dragend.force",ri)),arguments.length?void this.on("mouseover.force",ni).on("mouseout.force",ii).call(n):n},ca.rebind(l,u,"on")};var xl=20,_l=1,wl=1/0;ca.layout.hierarchy=function(){function t(i){var o,a=[i],s=[];for(i.depth=0;null!=(o=a.pop());)if(s.push(o),(u=r.call(t,o,o.depth))&&(l=u.length)){for(var l,u,c;--l>=0;)a.push(c=u[l]),c.parent=o,c.depth=o.depth+1;n&&(o.value=0),o.children=u}else n&&(o.value=+n.call(t,o,o.depth)||0),delete o.children;return li(i,function(t){var r,i;e&&(r=t.children)&&r.sort(e),n&&(i=t.parent)&&(i.value+=t.value)}),s}var e=hi,r=ui,n=ci;return t.sort=function(r){return arguments.length?(e=r,t):e},t.children=function(e){return arguments.length?(r=e,t):r},t.value=function(e){return arguments.length?(n=e,t):n},t.revalue=function(e){return n&&(si(e,function(t){t.children&&(t.value=0)}),li(e,function(e){var r;e.children||(e.value=+n.call(t,e,e.depth)||0),
(r=e.parent)&&(r.value+=e.value)})),e},t},ca.layout.partition=function(){function t(e,r,n,i){var o=e.children;if(e.x=r,e.y=e.depth*i,e.dx=n,e.dy=i,o&&(a=o.length)){var a,s,l,u=-1;for(n=e.value?n/e.value:0;++u<a;)t(s=o[u],r,l=s.value*n,i),r+=l}}function e(t){var r=t.children,n=0;if(r&&(i=r.length))for(var i,o=-1;++o<i;)n=Math.max(n,e(r[o]));return 1+n}function r(r,o){var a=n.call(this,r,o);return t(a[0],0,i[0],i[1]/e(a[0])),a}var n=ca.layout.hierarchy(),i=[1,1];return r.size=function(t){return arguments.length?(i=t,r):i},ai(r,n)},ca.layout.pie=function(){function t(a){var s,l=a.length,u=a.map(function(r,n){return+e.call(t,r,n)}),c=+("function"==typeof n?n.apply(this,arguments):n),h=("function"==typeof i?i.apply(this,arguments):i)-c,f=Math.min(Math.abs(h)/l,+("function"==typeof o?o.apply(this,arguments):o)),d=f*(0>h?-1:1),p=ca.sum(u),v=p?(h-l*d)/p:0,m=ca.range(l),g=[];return null!=r&&m.sort(r===Ml?function(t,e){return u[e]-u[t]}:function(t,e){return r(a[t],a[e])}),m.forEach(function(t){g[t]={data:a[t],value:s=u[t],startAngle:c,endAngle:c+=s*v+d,padAngle:f}}),g}var e=Number,r=Ml,n=0,i=Va,o=0;return t.value=function(r){return arguments.length?(e=r,t):e},t.sort=function(e){return arguments.length?(r=e,t):r},t.startAngle=function(e){return arguments.length?(n=e,t):n},t.endAngle=function(e){return arguments.length?(i=e,t):i},t.padAngle=function(e){return arguments.length?(o=e,t):o},t};var Ml={};ca.layout.stack=function(){function t(s,l){if(!(f=s.length))return s;var u=s.map(function(r,n){return e.call(t,r,n)}),c=u.map(function(e){return e.map(function(e,r){return[o.call(t,e,r),a.call(t,e,r)]})}),h=r.call(t,c,l);u=ca.permute(u,h),c=ca.permute(c,h);var f,d,p,v,m=n.call(t,c,l),g=u[0].length;for(p=0;g>p;++p)for(i.call(t,u[0][p],v=m[p],c[0][p][1]),d=1;f>d;++d)i.call(t,u[d][p],v+=c[d-1][p][1],c[d][p][1]);return s}var e=x,r=mi,n=gi,i=vi,o=di,a=pi;return t.values=function(r){return arguments.length?(e=r,t):e},t.order=function(e){return arguments.length?(r="function"==typeof e?e:kl.get(e)||mi,t):r},t.offset=function(e){return arguments.length?(n="function"==typeof e?e:Al.get(e)||gi,t):n},t.x=function(e){return arguments.length?(o=e,t):o},t.y=function(e){return arguments.length?(a=e,t):a},t.out=function(e){return arguments.length?(i=e,t):i},t};var kl=ca.map({"inside-out":function(t){var e,r,n=t.length,i=t.map(yi),o=t.map(bi),a=ca.range(n).sort(function(t,e){return i[t]-i[e]}),s=0,l=0,u=[],c=[];for(e=0;n>e;++e)r=a[e],l>s?(s+=o[r],u.push(r)):(l+=o[r],c.push(r));return c.reverse().concat(u)},reverse:function(t){return ca.range(t.length).reverse()},"default":mi}),Al=ca.map({silhouette:function(t){var e,r,n,i=t.length,o=t[0].length,a=[],s=0,l=[];for(r=0;o>r;++r){for(e=0,n=0;i>e;e++)n+=t[e][r][1];n>s&&(s=n),a.push(n)}for(r=0;o>r;++r)l[r]=(s-a[r])/2;return l},wiggle:function(t){var e,r,n,i,o,a,s,l,u,c=t.length,h=t[0],f=h.length,d=[];for(d[0]=l=u=0,r=1;f>r;++r){for(e=0,i=0;c>e;++e)i+=t[e][r][1];for(e=0,o=0,s=h[r][0]-h[r-1][0];c>e;++e){for(n=0,a=(t[e][r][1]-t[e][r-1][1])/(2*s);e>n;++n)a+=(t[n][r][1]-t[n][r-1][1])/s;o+=a*t[e][r][1]}d[r]=l-=i?o/i*s:0,u>l&&(u=l)}for(r=0;f>r;++r)d[r]-=u;return d},expand:function(t){var e,r,n,i=t.length,o=t[0].length,a=1/i,s=[];for(r=0;o>r;++r){for(e=0,n=0;i>e;e++)n+=t[e][r][1];if(n)for(e=0;i>e;e++)t[e][r][1]/=n;else for(e=0;i>e;e++)t[e][r][1]=a}for(r=0;o>r;++r)s[r]=0;return s},zero:gi});ca.layout.histogram=function(){function t(t,o){for(var a,s,l=[],u=t.map(r,this),c=n.call(this,u,o),h=i.call(this,c,u,o),o=-1,f=u.length,d=h.length-1,p=e?1:1/f;++o<d;)a=l[o]=[],a.dx=h[o+1]-(a.x=h[o]),a.y=0;if(d>0)for(o=-1;++o<f;)s=u[o],s>=c[0]&&s<=c[1]&&(a=l[ca.bisect(h,s,1,d)-1],a.y+=p,a.push(t[o]));return l}var e=!0,r=Number,n=Mi,i=_i;return t.value=function(e){return arguments.length?(r=e,t):r},t.range=function(e){return arguments.length?(n=St(e),t):n},t.bins=function(e){return arguments.length?(i="number"==typeof e?function(t){return wi(t,e)}:St(e),t):i},t.frequency=function(r){return arguments.length?(e=!!r,t):e},t},ca.layout.pack=function(){function t(t,o){var a=r.call(this,t,o),s=a[0],l=i[0],u=i[1],c=null==e?Math.sqrt:"function"==typeof e?e:function(){return e};if(s.x=s.y=0,li(s,function(t){t.r=+c(t.value)}),li(s,Si),n){var h=n*(e?1:Math.max(2*s.r/l,2*s.r/u))/2;li(s,function(t){t.r+=h}),li(s,Si),li(s,function(t){t.r-=h})}return Ii(s,l/2,u/2,e?1:1/Math.max(2*s.r/l,2*s.r/u)),a}var e,r=ca.layout.hierarchy().sort(ki),n=0,i=[1,1];return t.size=function(e){return arguments.length?(i=e,t):i},t.radius=function(r){return arguments.length?(e=null==r||"function"==typeof r?r:+r,t):e},t.padding=function(e){return arguments.length?(n=+e,t):n},ai(t,r)},ca.layout.tree=function(){function t(t,i){var c=a.call(this,t,i),h=c[0],f=e(h);if(li(f,r),f.parent.m=-f.z,si(f,n),u)si(h,o);else{var d=h,p=h,v=h;si(h,function(t){t.x<d.x&&(d=t),t.x>p.x&&(p=t),t.depth>v.depth&&(v=t)});var m=s(d,p)/2-d.x,g=l[0]/(p.x+s(p,d)/2+m),y=l[1]/(v.depth||1);si(h,function(t){t.x=(t.x+m)*g,t.y=t.depth*y})}return c}function e(t){for(var e,r={A:null,children:[t]},n=[r];null!=(e=n.pop());)for(var i,o=e.children,a=0,s=o.length;s>a;++a)n.push((o[a]=i={_:o[a],parent:e,children:(i=o[a].children)&&i.slice()||[],A:null,a:null,z:0,m:0,c:0,s:0,t:null,i:a}).a=i);return r.children[0]}function r(t){var e=t.children,r=t.parent.children,n=t.i?r[t.i-1]:null;if(e.length){Fi(t);var o=(e[0].z+e[e.length-1].z)/2;n?(t.z=n.z+s(t._,n._),t.m=t.z-o):t.z=o}else n&&(t.z=n.z+s(t._,n._));t.parent.A=i(t,n,t.parent.A||r[0])}function n(t){t._.x=t.z+t.parent.m,t.m+=t.parent.m}function i(t,e,r){if(e){for(var n,i=t,o=t,a=e,l=i.parent.children[0],u=i.m,c=o.m,h=a.m,f=l.m;a=Di(a),i=Ri(i),a&&i;)l=Ri(l),o=Di(o),o.a=t,n=a.z+h-i.z-u+s(a._,i._),n>0&&(Oi(ji(a,t,r),t,n),u+=n,c+=n),h+=a.m,u+=i.m,f+=l.m,c+=o.m;a&&!Di(o)&&(o.t=a,o.m+=h-c),i&&!Ri(l)&&(l.t=i,l.m+=u-f,r=t)}return r}function o(t){t.x*=l[0],t.y=t.depth*l[1]}var a=ca.layout.hierarchy().sort(null).value(null),s=Ci,l=[1,1],u=null;return t.separation=function(e){return arguments.length?(s=e,t):s},t.size=function(e){return arguments.length?(u=null==(l=e)?o:null,t):u?null:l},t.nodeSize=function(e){return arguments.length?(u=null==(l=e)?null:o,t):u?l:null},ai(t,a)},ca.layout.cluster=function(){function t(t,o){var a,s=e.call(this,t,o),l=s[0],u=0;li(l,function(t){var e=t.children;e&&e.length?(t.x=Bi(e),t.y=Ni(e)):(t.x=a?u+=r(t,a):0,t.y=0,a=t)});var c=Ui(l),h=Vi(l),f=c.x-r(c,h)/2,d=h.x+r(h,c)/2;return li(l,i?function(t){t.x=(t.x-l.x)*n[0],t.y=(l.y-t.y)*n[1]}:function(t){t.x=(t.x-f)/(d-f)*n[0],t.y=(1-(l.y?t.y/l.y:1))*n[1]}),s}var e=ca.layout.hierarchy().sort(null).value(null),r=Ci,n=[1,1],i=!1;return t.separation=function(e){return arguments.length?(r=e,t):r},t.size=function(e){return arguments.length?(i=null==(n=e),t):i?null:n},t.nodeSize=function(e){return arguments.length?(i=null!=(n=e),t):i?n:null},ai(t,e)},ca.layout.treemap=function(){function t(t,e){for(var r,n,i=-1,o=t.length;++i<o;)n=(r=t[i]).value*(0>e?0:e),r.area=isNaN(n)||0>=n?0:n}function e(r){var o=r.children;if(o&&o.length){var a,s,l,u=h(r),c=[],f=o.slice(),p=1/0,v="slice"===d?u.dx:"dice"===d?u.dy:"slice-dice"===d?1&r.depth?u.dy:u.dx:Math.min(u.dx,u.dy);for(t(f,u.dx*u.dy/r.value),c.area=0;(l=f.length)>0;)c.push(a=f[l-1]),c.area+=a.area,"squarify"!==d||(s=n(c,v))<=p?(f.pop(),p=s):(c.area-=c.pop().area,i(c,v,u,!1),v=Math.min(u.dx,u.dy),c.length=c.area=0,p=1/0);c.length&&(i(c,v,u,!0),c.length=c.area=0),o.forEach(e)}}function r(e){var n=e.children;if(n&&n.length){var o,a=h(e),s=n.slice(),l=[];for(t(s,a.dx*a.dy/e.value),l.area=0;o=s.pop();)l.push(o),l.area+=o.area,null!=o.z&&(i(l,o.z?a.dx:a.dy,a,!s.length),l.length=l.area=0);n.forEach(r)}}function n(t,e){for(var r,n=t.area,i=0,o=1/0,a=-1,s=t.length;++a<s;)(r=t[a].area)&&(o>r&&(o=r),r>i&&(i=r));return n*=n,e*=e,n?Math.max(e*i*p/n,n/(e*o*p)):1/0}function i(t,e,r,n){var i,o=-1,a=t.length,s=r.x,u=r.y,c=e?l(t.area/e):0;if(e==r.dx){for((n||c>r.dy)&&(c=r.dy);++o<a;)i=t[o],i.x=s,i.y=u,i.dy=c,s+=i.dx=Math.min(r.x+r.dx-s,c?l(i.area/c):0);i.z=!0,i.dx+=r.x+r.dx-s,r.y+=c,r.dy-=c}else{for((n||c>r.dx)&&(c=r.dx);++o<a;)i=t[o],i.x=s,i.y=u,i.dx=c,u+=i.dy=Math.min(r.y+r.dy-u,c?l(i.area/c):0);i.z=!1,i.dy+=r.y+r.dy-u,r.x+=c,r.dx-=c}}function o(n){var i=a||s(n),o=i[0];return o.x=o.y=0,o.value?(o.dx=u[0],o.dy=u[1]):o.dx=o.dy=0,a&&s.revalue(o),t([o],o.dx*o.dy/o.value),(a?r:e)(o),f&&(a=i),i}var a,s=ca.layout.hierarchy(),l=Math.round,u=[1,1],c=null,h=qi,f=!1,d="squarify",p=.5*(1+Math.sqrt(5));return o.size=function(t){return arguments.length?(u=t,o):u},o.padding=function(t){function e(e){var r=t.call(o,e,e.depth);return null==r?qi(e):Gi(e,"number"==typeof r?[r,r,r,r]:r)}function r(e){return Gi(e,t)}if(!arguments.length)return c;var n;return h=null==(c=t)?qi:"function"==(n=typeof t)?e:"number"===n?(t=[t,t,t,t],r):r,o},o.round=function(t){return arguments.length?(l=t?Math.round:Number,o):l!=Number},o.sticky=function(t){return arguments.length?(f=t,a=null,o):f},o.ratio=function(t){return arguments.length?(p=t,o):p},o.mode=function(t){return arguments.length?(d=t+"",o):d},ai(o,s)},ca.random={normal:function(t,e){var r=arguments.length;return 2>r&&(e=1),1>r&&(t=0),function(){var r,n,i;do r=2*Math.random()-1,n=2*Math.random()-1,i=r*r+n*n;while(!i||i>1);return t+e*r*Math.sqrt(-2*Math.log(i)/i)}},logNormal:function(){var t=ca.random.normal.apply(ca,arguments);return function(){return Math.exp(t())}},bates:function(t){var e=ca.random.irwinHall(t);return function(){return e()/t}},irwinHall:function(t){return function(){for(var e=0,r=0;t>r;r++)e+=Math.random();return e}}},ca.scale={};var Tl={floor:x,ceil:x};ca.scale.linear=function(){return Ji([0,1],[0,1],_n,!1)};var El={s:1,g:1,p:1,r:1,e:1};ca.scale.log=function(){return oo(ca.scale.linear().domain([0,1]),10,!0,[1,10])};var Sl=ca.format(".0e"),Ll={floor:function(t){return-Math.ceil(-t)},ceil:function(t){return-Math.floor(-t)}};ca.scale.pow=function(){return ao(ca.scale.linear(),1,[0,1])},ca.scale.sqrt=function(){return ca.scale.pow().exponent(.5)},ca.scale.ordinal=function(){return lo([],{t:"range",a:[[]]})},ca.scale.category10=function(){return ca.scale.ordinal().range(zl)},ca.scale.category20=function(){return ca.scale.ordinal().range(Il)},ca.scale.category20b=function(){return ca.scale.ordinal().range(Pl)},ca.scale.category20c=function(){return ca.scale.ordinal().range(Cl)};var zl=[2062260,16744206,2924588,14034728,9725885,9197131,14907330,8355711,12369186,1556175].map(_t),Il=[2062260,11454440,16744206,16759672,2924588,10018698,14034728,16750742,9725885,12955861,9197131,12885140,14907330,16234194,8355711,13092807,12369186,14408589,1556175,10410725].map(_t),Pl=[3750777,5395619,7040719,10264286,6519097,9216594,11915115,13556636,9202993,12426809,15186514,15190932,8666169,11356490,14049643,15177372,8077683,10834324,13528509,14589654].map(_t),Cl=[3244733,7057110,10406625,13032431,15095053,16616764,16625259,16634018,3253076,7652470,10607003,13101504,7695281,10394312,12369372,14342891,6513507,9868950,12434877,14277081].map(_t);ca.scale.quantile=function(){return uo([],[])},ca.scale.quantize=function(){return co(0,1,[0,1])},ca.scale.threshold=function(){return ho([.5],[0,1])},ca.scale.identity=function(){return fo([0,1])},ca.svg={},ca.svg.arc=function(){function t(){var t=Math.max(0,+r.apply(this,arguments)),u=Math.max(0,+n.apply(this,arguments)),c=a.apply(this,arguments)-Ga,h=s.apply(this,arguments)-Ga,f=Math.abs(h-c),d=c>h?0:1;if(t>u&&(p=u,u=t,t=p),f>=qa)return e(u,d)+(t?e(t,1-d):"")+"Z";var p,v,m,g,y,b,x,_,w,M,k,A,T=0,E=0,S=[];if((g=(+l.apply(this,arguments)||0)/2)&&(m=o===Rl?Math.sqrt(t*t+u*u):+o.apply(this,arguments),d||(E*=-1),u&&(E=nt(m/u*Math.sin(g))),t&&(T=nt(m/t*Math.sin(g)))),u){y=u*Math.cos(c+E),b=u*Math.sin(c+E),x=u*Math.cos(h-E),_=u*Math.sin(h-E);var L=Math.abs(h-c-2*E)<=Ua?0:1;if(E&&xo(y,b,x,_)===d^L){var z=(c+h)/2;y=u*Math.cos(z),b=u*Math.sin(z),x=_=null}}else y=b=0;if(t){w=t*Math.cos(h-T),M=t*Math.sin(h-T),k=t*Math.cos(c+T),A=t*Math.sin(c+T);var I=Math.abs(c-h+2*T)<=Ua?0:1;if(T&&xo(w,M,k,A)===1-d^I){var P=(c+h)/2;w=t*Math.cos(P),M=t*Math.sin(P),k=A=null}}else w=M=0;if(f>Na&&(p=Math.min(Math.abs(u-t)/2,+i.apply(this,arguments)))>.001){v=u>t^d?0:1;var C=p,R=p;if(Ua>f){var D=null==k?[w,M]:null==x?[y,b]:Dr([y,b],[k,A],[x,_],[w,M]),O=y-D[0],F=b-D[1],j=x-D[0],N=_-D[1],B=1/Math.sin(Math.acos((O*j+F*N)/(Math.sqrt(O*O+F*F)*Math.sqrt(j*j+N*N)))/2),U=Math.sqrt(D[0]*D[0]+D[1]*D[1]);R=Math.min(p,(t-U)/(B-1)),C=Math.min(p,(u-U)/(B+1))}if(null!=x){var V=_o(null==k?[w,M]:[k,A],[y,b],u,C,d),q=_o([x,_],[w,M],u,C,d);p===C?S.push("M",V[0],"A",C,",",C," 0 0,",v," ",V[1],"A",u,",",u," 0 ",1-d^xo(V[1][0],V[1][1],q[1][0],q[1][1]),",",d," ",q[1],"A",C,",",C," 0 0,",v," ",q[0]):S.push("M",V[0],"A",C,",",C," 0 1,",v," ",q[0])}else S.push("M",y,",",b);if(null!=k){var G=_o([y,b],[k,A],t,-R,d),H=_o([w,M],null==x?[y,b]:[x,_],t,-R,d);p===R?S.push("L",H[0],"A",R,",",R," 0 0,",v," ",H[1],"A",t,",",t," 0 ",d^xo(H[1][0],H[1][1],G[1][0],G[1][1]),",",1-d," ",G[1],"A",R,",",R," 0 0,",v," ",G[0]):S.push("L",H[0],"A",R,",",R," 0 0,",v," ",G[0])}else S.push("L",w,",",M)}else S.push("M",y,",",b),null!=x&&S.push("A",u,",",u," 0 ",L,",",d," ",x,",",_),S.push("L",w,",",M),null!=k&&S.push("A",t,",",t," 0 ",I,",",1-d," ",k,",",A);return S.push("Z"),S.join("")}function e(t,e){return"M0,"+t+"A"+t+","+t+" 0 1,"+e+" 0,"+-t+"A"+t+","+t+" 0 1,"+e+" 0,"+t}var r=vo,n=mo,i=po,o=Rl,a=go,s=yo,l=bo;return t.innerRadius=function(e){return arguments.length?(r=St(e),t):r},t.outerRadius=function(e){return arguments.length?(n=St(e),t):n},t.cornerRadius=function(e){return arguments.length?(i=St(e),t):i},t.padRadius=function(e){return arguments.length?(o=e==Rl?Rl:St(e),t):o},t.startAngle=function(e){return arguments.length?(a=St(e),t):a},t.endAngle=function(e){return arguments.length?(s=St(e),t):s},t.padAngle=function(e){return arguments.length?(l=St(e),t):l},t.centroid=function(){var t=(+r.apply(this,arguments)+ +n.apply(this,arguments))/2,e=(+a.apply(this,arguments)+ +s.apply(this,arguments))/2-Ga;return[Math.cos(e)*t,Math.sin(e)*t]},t};var Rl="auto";ca.svg.line=function(){return wo(x)};var Dl=ca.map({linear:Mo,"linear-closed":ko,step:Ao,"step-before":To,"step-after":Eo,basis:Co,"basis-open":Ro,"basis-closed":Do,bundle:Oo,cardinal:zo,"cardinal-open":So,"cardinal-closed":Lo,monotone:Vo});Dl.forEach(function(t,e){e.key=t,e.closed=/-closed$/.test(t)});var Ol=[0,2/3,1/3,0],Fl=[0,1/3,2/3,0],jl=[0,1/6,2/3,1/6];ca.svg.line.radial=function(){var t=wo(qo);return t.radius=t.x,delete t.x,t.angle=t.y,delete t.y,t},To.reverse=Eo,Eo.reverse=To,ca.svg.area=function(){return Go(x)},ca.svg.area.radial=function(){var t=Go(qo);return t.radius=t.x,delete t.x,t.innerRadius=t.x0,delete t.x0,t.outerRadius=t.x1,delete t.x1,t.angle=t.y,delete t.y,t.startAngle=t.y0,delete t.y0,t.endAngle=t.y1,delete t.y1,t},ca.svg.chord=function(){function t(t,s){var l=e(this,o,t,s),u=e(this,a,t,s);return"M"+l.p0+n(l.r,l.p1,l.a1-l.a0)+(r(l,u)?i(l.r,l.p1,l.r,l.p0):i(l.r,l.p1,u.r,u.p0)+n(u.r,u.p1,u.a1-u.a0)+i(u.r,u.p1,l.r,l.p0))+"Z"}function e(t,e,r,n){var i=e.call(t,r,n),o=s.call(t,i,n),a=l.call(t,i,n)-Ga,c=u.call(t,i,n)-Ga;return{r:o,a0:a,a1:c,p0:[o*Math.cos(a),o*Math.sin(a)],p1:[o*Math.cos(c),o*Math.sin(c)]}}function r(t,e){return t.a0==e.a0&&t.a1==e.a1}function n(t,e,r){return"A"+t+","+t+" 0 "+ +(r>Ua)+",1 "+e}function i(t,e,r,n){return"Q 0,0 "+n}var o=xr,a=_r,s=Ho,l=go,u=yo;return t.radius=function(e){return arguments.length?(s=St(e),t):s},t.source=function(e){return arguments.length?(o=St(e),t):o},t.target=function(e){return arguments.length?(a=St(e),t):a},t.startAngle=function(e){return arguments.length?(l=St(e),t):l},t.endAngle=function(e){return arguments.length?(u=St(e),t):u},t},ca.svg.diagonal=function(){function t(t,i){var o=e.call(this,t,i),a=r.call(this,t,i),s=(o.y+a.y)/2,l=[o,{x:o.x,y:s},{x:a.x,y:s},a];return l=l.map(n),"M"+l[0]+"C"+l[1]+" "+l[2]+" "+l[3]}var e=xr,r=_r,n=Xo;return t.source=function(r){return arguments.length?(e=St(r),t):e},t.target=function(e){return arguments.length?(r=St(e),t):r},t.projection=function(e){return arguments.length?(n=e,t):n},t},ca.svg.diagonal.radial=function(){var t=ca.svg.diagonal(),e=Xo,r=t.projection;return t.projection=function(t){return arguments.length?r(Yo(e=t)):e},t},ca.svg.symbol=function(){function t(t,n){return(Nl.get(e.call(this,t,n))||Ko)(r.call(this,t,n))}var e=Zo,r=Wo;return t.type=function(r){return arguments.length?(e=St(r),t):e},t.size=function(e){return arguments.length?(r=St(e),t):r},t};var Nl=ca.map({circle:Ko,cross:function(t){var e=Math.sqrt(t/5)/2;return"M"+-3*e+","+-e+"H"+-e+"V"+-3*e+"H"+e+"V"+-e+"H"+3*e+"V"+e+"H"+e+"V"+3*e+"H"+-e+"V"+e+"H"+-3*e+"Z"},diamond:function(t){var e=Math.sqrt(t/(2*Ul)),r=e*Ul;return"M0,"+-e+"L"+r+",0 0,"+e+" "+-r+",0Z"},square:function(t){var e=Math.sqrt(t)/2;return"M"+-e+","+-e+"L"+e+","+-e+" "+e+","+e+" "+-e+","+e+"Z"},"triangle-down":function(t){var e=Math.sqrt(t/Bl),r=e*Bl/2;return"M0,"+r+"L"+e+","+-r+" "+-e+","+-r+"Z"},"triangle-up":function(t){var e=Math.sqrt(t/Bl),r=e*Bl/2;return"M0,"+-r+"L"+e+","+r+" "+-e+","+r+"Z"}});ca.svg.symbolTypes=Nl.keys();var Bl=Math.sqrt(3),Ul=Math.tan(30*Ha);Ia.transition=function(t){for(var e,r,n=Vl||++Xl,i=ea(t),o=[],a=ql||{time:Date.now(),ease:Sn,delay:0,duration:250},s=-1,l=this.length;++s<l;){o.push(e=[]);for(var u=this[s],c=-1,h=u.length;++c<h;)(r=u[c])&&ra(r,c,i,n,a),e.push(r)}return $o(o,i,n)},Ia.interrupt=function(t){return this.each(null==t?Gl:Jo(ea(t)))};var Vl,ql,Gl=Jo(ea()),Hl=[],Xl=0;Hl.call=Ia.call,Hl.empty=Ia.empty,Hl.node=Ia.node,Hl.size=Ia.size,ca.transition=function(t,e){return t&&t.transition?Vl?t.transition(e):t:ca.selection().transition(t)},ca.transition.prototype=Hl,Hl.select=function(t){var e,r,n,i=this.id,o=this.namespace,a=[];t=z(t);for(var s=-1,l=this.length;++s<l;){a.push(e=[]);for(var u=this[s],c=-1,h=u.length;++c<h;)(n=u[c])&&(r=t.call(n,n.__data__,c,s))?("__data__"in n&&(r.__data__=n.__data__),ra(r,c,o,i,n[o][i]),e.push(r)):e.push(null)}return $o(a,o,i)},Hl.selectAll=function(t){var e,r,n,i,o,a=this.id,s=this.namespace,l=[];t=I(t);for(var u=-1,c=this.length;++u<c;)for(var h=this[u],f=-1,d=h.length;++f<d;)if(n=h[f]){o=n[s][a],r=t.call(n,n.__data__,f,u),l.push(e=[]);for(var p=-1,v=r.length;++p<v;)(i=r[p])&&ra(i,p,s,a,o),e.push(i)}return $o(l,s,a)},Hl.filter=function(t){var e,r,n,i=[];"function"!=typeof t&&(t=q(t));for(var o=0,a=this.length;a>o;o++){i.push(e=[]);for(var r=this[o],s=0,l=r.length;l>s;s++)(n=r[s])&&t.call(n,n.__data__,s,o)&&e.push(n)}return $o(i,this.namespace,this.id)},Hl.tween=function(t,e){var r=this.id,n=this.namespace;return arguments.length<2?this.node()[n][r].tween.get(t):H(this,null==e?function(e){e[n][r].tween.remove(t)}:function(i){i[n][r].tween.set(t,e)})},Hl.attr=function(t,e){function r(){this.removeAttribute(s)}function n(){this.removeAttributeNS(s.space,s.local)}function i(t){return null==t?r:(t+="",function(){var e,r=this.getAttribute(s);return r!==t&&(e=a(r,t),function(t){this.setAttribute(s,e(t))})})}function o(t){return null==t?n:(t+="",function(){var e,r=this.getAttributeNS(s.space,s.local);return r!==t&&(e=a(r,t),function(t){this.setAttributeNS(s.space,s.local,e(t))})})}if(arguments.length<2){for(e in t)this.attr(e,t[e]);return this}var a="transform"==t?Zn:_n,s=ca.ns.qualify(t);return Qo(this,"attr."+t,e,s.local?o:i)},Hl.attrTween=function(t,e){function r(t,r){var n=e.call(this,t,r,this.getAttribute(i));return n&&function(t){this.setAttribute(i,n(t))}}function n(t,r){var n=e.call(this,t,r,this.getAttributeNS(i.space,i.local));return n&&function(t){this.setAttributeNS(i.space,i.local,n(t))}}var i=ca.ns.qualify(t);return this.tween("attr."+t,i.local?n:r)},Hl.style=function(t,e,r){function i(){this.style.removeProperty(t)}function o(e){return null==e?i:(e+="",function(){var i,o=n(this).getComputedStyle(this,null).getPropertyValue(t);return o!==e&&(i=_n(o,e),function(e){this.style.setProperty(t,i(e),r)})})}var a=arguments.length;if(3>a){if("string"!=typeof t){2>a&&(e="");for(r in t)this.style(r,t[r],e);return this}r=""}return Qo(this,"style."+t,e,o)},Hl.styleTween=function(t,e,r){function i(i,o){var a=e.call(this,i,o,n(this).getComputedStyle(this,null).getPropertyValue(t));return a&&function(e){this.style.setProperty(t,a(e),r)}}return arguments.length<3&&(r=""),this.tween("style."+t,i)},Hl.text=function(t){return Qo(this,"text",t,ta)},Hl.remove=function(){var t=this.namespace;return this.each("end.transition",function(){var e;this[t].count<2&&(e=this.parentNode)&&e.removeChild(this)})},Hl.ease=function(t){var e=this.id,r=this.namespace;return arguments.length<1?this.node()[r][e].ease:("function"!=typeof t&&(t=ca.ease.apply(ca,arguments)),H(this,function(n){n[r][e].ease=t}))},Hl.delay=function(t){var e=this.id,r=this.namespace;return arguments.length<1?this.node()[r][e].delay:H(this,"function"==typeof t?function(n,i,o){n[r][e].delay=+t.call(n,n.__data__,i,o)}:(t=+t,function(n){n[r][e].delay=t}))},Hl.duration=function(t){var e=this.id,r=this.namespace;return arguments.length<1?this.node()[r][e].duration:H(this,"function"==typeof t?function(n,i,o){n[r][e].duration=Math.max(1,t.call(n,n.__data__,i,o))}:(t=Math.max(1,t),function(n){n[r][e].duration=t}))},Hl.each=function(t,e){var r=this.id,n=this.namespace;if(arguments.length<2){var i=ql,o=Vl;try{Vl=r,H(this,function(e,i,o){ql=e[n][r],t.call(e,e.__data__,i,o)})}finally{ql=i,Vl=o}}else H(this,function(i){var o=i[n][r];(o.event||(o.event=ca.dispatch("start","end","interrupt"))).on(t,e)});return this},Hl.transition=function(){for(var t,e,r,n,i=this.id,o=++Xl,a=this.namespace,s=[],l=0,u=this.length;u>l;l++){s.push(t=[]);for(var e=this[l],c=0,h=e.length;h>c;c++)(r=e[c])&&(n=r[a][i],ra(r,c,a,o,{time:n.time,ease:n.ease,delay:n.delay+n.duration,duration:n.duration})),t.push(r)}return $o(s,a,o)},ca.svg.axis=function(){function t(t){t.each(function(){var t,u=ca.select(this),c=this.__chart__||r,h=this.__chart__=r.copy(),f=null==l?h.ticks?h.ticks.apply(h,s):h.domain():l,d=null==e?h.tickFormat?h.tickFormat.apply(h,s):x:e,p=u.selectAll(".tick").data(f,h),v=p.enter().insert("g",".domain").attr("class","tick").style("opacity",Na),m=ca.transition(p.exit()).style("opacity",Na).remove(),g=ca.transition(p.order()).style("opacity",1),y=Math.max(i,0)+a,b=Xi(h),_=u.selectAll(".domain").data([0]),w=(_.enter().append("path").attr("class","domain"),ca.transition(_));v.append("line"),v.append("text");var M,k,A,T,E=v.select("line"),S=g.select("line"),L=p.select("text").text(d),z=v.select("text"),I=g.select("text"),P="top"===n||"left"===n?-1:1;if("bottom"===n||"top"===n?(t=na,M="x",A="y",k="x2",T="y2",L.attr("dy",0>P?"0em":".71em").style("text-anchor","middle"),w.attr("d","M"+b[0]+","+P*o+"V0H"+b[1]+"V"+P*o)):(t=ia,M="y",A="x",k="y2",T="x2",L.attr("dy",".32em").style("text-anchor",0>P?"end":"start"),w.attr("d","M"+P*o+","+b[0]+"H0V"+b[1]+"H"+P*o)),E.attr(T,P*i),z.attr(A,P*y),S.attr(k,0).attr(T,P*i),I.attr(M,0).attr(A,P*y),h.rangeBand){var C=h,R=C.rangeBand()/2;c=h=function(t){return C(t)+R}}else c.rangeBand?c=h:m.call(t,h,c);v.call(t,c,h),g.call(t,h,h)})}var e,r=ca.scale.linear(),n=Yl,i=6,o=6,a=3,s=[10],l=null;return t.scale=function(e){return arguments.length?(r=e,t):r},t.orient=function(e){return arguments.length?(n=e in Wl?e+"":Yl,t):n},t.ticks=function(){return arguments.length?(s=fa(arguments),t):s},t.tickValues=function(e){return arguments.length?(l=e,t):l},t.tickFormat=function(r){return arguments.length?(e=r,t):e},t.tickSize=function(e){var r=arguments.length;return r?(i=+e,o=+arguments[r-1],t):i},t.innerTickSize=function(e){return arguments.length?(i=+e,t):i},t.outerTickSize=function(e){return arguments.length?(o=+e,t):o},t.tickPadding=function(e){return arguments.length?(a=+e,t):a},t.tickSubdivide=function(){return arguments.length&&t},t};var Yl="bottom",Wl={top:1,right:1,bottom:1,left:1};ca.svg.brush=function(){function t(n){n.each(function(){var n=ca.select(this).style("pointer-events","all").style("-webkit-tap-highlight-color","rgba(0,0,0,0)").on("mousedown.brush",o).on("touchstart.brush",o),a=n.selectAll(".background").data([0]);a.enter().append("rect").attr("class","background").style("visibility","hidden").style("cursor","crosshair"),n.selectAll(".extent").data([0]).enter().append("rect").attr("class","extent").style("cursor","move");var s=n.selectAll(".resize").data(v,x);s.exit().remove(),s.enter().append("g").attr("class",function(t){return"resize "+t}).style("cursor",function(t){return Zl[t]}).append("rect").attr("x",function(t){return/[ew]$/.test(t)?-3:null}).attr("y",function(t){return/^[ns]/.test(t)?-3:null}).attr("width",6).attr("height",6).style("visibility","hidden"),s.style("display",t.empty()?"none":null);var l,h=ca.transition(n),f=ca.transition(a);u&&(l=Xi(u),f.attr("x",l[0]).attr("width",l[1]-l[0]),r(h)),c&&(l=Xi(c),f.attr("y",l[0]).attr("height",l[1]-l[0]),i(h)),e(h)})}function e(t){t.selectAll(".resize").attr("transform",function(t){return"translate("+h[+/e$/.test(t)]+","+f[+/^s/.test(t)]+")"})}function r(t){t.select(".extent").attr("x",h[0]),t.selectAll(".extent,.n>rect,.s>rect").attr("width",h[1]-h[0])}function i(t){t.select(".extent").attr("y",f[0]),t.selectAll(".extent,.e>rect,.w>rect").attr("height",f[1]-f[0])}function o(){function o(){32==ca.event.keyCode&&(L||(b=null,I[0]-=h[1],I[1]-=f[1],L=2),T())}function v(){32==ca.event.keyCode&&2==L&&(I[0]+=h[1],I[1]+=f[1],L=0,T())}function m(){var t=ca.mouse(_),n=!1;x&&(t[0]+=x[0],t[1]+=x[1]),L||(ca.event.altKey?(b||(b=[(h[0]+h[1])/2,(f[0]+f[1])/2]),I[0]=h[+(t[0]<b[0])],I[1]=f[+(t[1]<b[1])]):b=null),E&&g(t,u,0)&&(r(k),n=!0),S&&g(t,c,1)&&(i(k),n=!0),n&&(e(k),M({type:"brush",mode:L?"move":"resize"}))}function g(t,e,r){var n,i,o=Xi(e),l=o[0],u=o[1],c=I[r],v=r?f:h,m=v[1]-v[0];return L&&(l-=c,u-=m+c),n=(r?p:d)?Math.max(l,Math.min(u,t[r])):t[r],L?i=(n+=c)+m:(b&&(c=Math.max(l,Math.min(u,2*b[r]-n))),n>c?(i=n,n=c):i=c),v[0]!=n||v[1]!=i?(r?s=null:a=null,v[0]=n,v[1]=i,!0):void 0}function y(){m(),k.style("pointer-events","all").selectAll(".resize").style("display",t.empty()?"none":null),ca.select("body").style("cursor",null),P.on("mousemove.brush",null).on("mouseup.brush",null).on("touchmove.brush",null).on("touchend.brush",null).on("keydown.brush",null).on("keyup.brush",null),z(),M({type:"brushend"})}var b,x,_=this,w=ca.select(ca.event.target),M=l.of(_,arguments),k=ca.select(_),A=w.datum(),E=!/^(n|s)$/.test(A)&&u,S=!/^(e|w)$/.test(A)&&c,L=w.classed("extent"),z=J(_),I=ca.mouse(_),P=ca.select(n(_)).on("keydown.brush",o).on("keyup.brush",v);if(ca.event.changedTouches?P.on("touchmove.brush",m).on("touchend.brush",y):P.on("mousemove.brush",m).on("mouseup.brush",y),k.interrupt().selectAll("*").interrupt(),L)I[0]=h[0]-I[0],I[1]=f[0]-I[1];else if(A){var C=+/w$/.test(A),R=+/^n/.test(A);x=[h[1-C]-I[0],f[1-R]-I[1]],I[0]=h[C],I[1]=f[R]}else ca.event.altKey&&(b=I.slice());k.style("pointer-events","none").selectAll(".resize").style("display",null),ca.select("body").style("cursor",w.style("cursor")),M({type:"brushstart"}),m()}var a,s,l=S(t,"brushstart","brush","brushend"),u=null,c=null,h=[0,0],f=[0,0],d=!0,p=!0,v=Kl[0];return t.event=function(t){t.each(function(){var t=l.of(this,arguments),e={x:h,y:f,i:a,j:s},r=this.__chart__||e;this.__chart__=e,Vl?ca.select(this).transition().each("start.brush",function(){a=r.i,s=r.j,h=r.x,f=r.y,t({type:"brushstart"})}).tween("brush:brush",function(){var r=wn(h,e.x),n=wn(f,e.y);return a=s=null,function(i){h=e.x=r(i),f=e.y=n(i),t({type:"brush",mode:"resize"})}}).each("end.brush",function(){a=e.i,s=e.j,t({type:"brush",mode:"resize"}),t({type:"brushend"})}):(t({type:"brushstart"}),t({type:"brush",mode:"resize"}),t({type:"brushend"}))})},t.x=function(e){return arguments.length?(u=e,v=Kl[!u<<1|!c],t):u},t.y=function(e){return arguments.length?(c=e,v=Kl[!u<<1|!c],t):c},t.clamp=function(e){return arguments.length?(u&&c?(d=!!e[0],p=!!e[1]):u?d=!!e:c&&(p=!!e),t):u&&c?[d,p]:u?d:c?p:null},t.extent=function(e){var r,n,i,o,l;return arguments.length?(u&&(r=e[0],n=e[1],c&&(r=r[0],n=n[0]),a=[r,n],u.invert&&(r=u(r),n=u(n)),r>n&&(l=r,r=n,n=l),r==h[0]&&n==h[1]||(h=[r,n])),c&&(i=e[0],o=e[1],u&&(i=i[1],o=o[1]),s=[i,o],c.invert&&(i=c(i),o=c(o)),i>o&&(l=i,i=o,o=l),i==f[0]&&o==f[1]||(f=[i,o])),t):(u&&(a?(r=a[0],n=a[1]):(r=h[0],n=h[1],u.invert&&(r=u.invert(r),n=u.invert(n)),r>n&&(l=r,r=n,n=l))),c&&(s?(i=s[0],o=s[1]):(i=f[0],o=f[1],c.invert&&(i=c.invert(i),o=c.invert(o)),i>o&&(l=i,i=o,o=l))),u&&c?[[r,i],[n,o]]:u?[r,n]:c&&[i,o])},t.clear=function(){return t.empty()||(h=[0,0],f=[0,0],a=s=null),t},t.empty=function(){return!!u&&h[0]==h[1]||!!c&&f[0]==f[1]},ca.rebind(t,l,"on")};var Zl={n:"ns-resize",e:"ew-resize",s:"ns-resize",w:"ew-resize",nw:"nwse-resize",ne:"nesw-resize",se:"nwse-resize",sw:"nesw-resize"},Kl=[["n","e","s","w","nw","ne","se","sw"],["e","w"],["n","s"],[]],Jl=ms.format=ws.timeFormat,$l=Jl.utc,Ql=$l("%Y-%m-%dT%H:%M:%S.%LZ");Jl.iso=Date.prototype.toISOString&&+new Date("2000-01-01T00:00:00.000Z")?oa:Ql,oa.parse=function(t){var e=new Date(t);return isNaN(e)?null:e},oa.toString=Ql.toString,ms.second=Vt(function(t){return new gs(1e3*Math.floor(t/1e3))},function(t,e){t.setTime(t.getTime()+1e3*Math.floor(e))},function(t){return t.getSeconds()}),ms.seconds=ms.second.range,ms.seconds.utc=ms.second.utc.range,ms.minute=Vt(function(t){return new gs(6e4*Math.floor(t/6e4))},function(t,e){t.setTime(t.getTime()+6e4*Math.floor(e))},function(t){return t.getMinutes()}),ms.minutes=ms.minute.range,ms.minutes.utc=ms.minute.utc.range,ms.hour=Vt(function(t){var e=t.getTimezoneOffset()/60;return new gs(36e5*(Math.floor(t/36e5-e)+e))},function(t,e){t.setTime(t.getTime()+36e5*Math.floor(e))},function(t){return t.getHours()}),ms.hours=ms.hour.range,ms.hours.utc=ms.hour.utc.range,ms.month=Vt(function(t){return t=ms.day(t),t.setDate(1),t},function(t,e){t.setMonth(t.getMonth()+e)},function(t){return t.getMonth()}),ms.months=ms.month.range,ms.months.utc=ms.month.utc.range;var tu=[1e3,5e3,15e3,3e4,6e4,3e5,9e5,18e5,36e5,108e5,216e5,432e5,864e5,1728e5,6048e5,2592e6,7776e6,31536e6],eu=[[ms.second,1],[ms.second,5],[ms.second,15],[ms.second,30],[ms.minute,1],[ms.minute,5],[ms.minute,15],[ms.minute,30],[ms.hour,1],[ms.hour,3],[ms.hour,6],[ms.hour,12],[ms.day,1],[ms.day,2],[ms.week,1],[ms.month,1],[ms.month,3],[ms.year,1]],ru=Jl.multi([[".%L",function(t){return t.getMilliseconds()}],[":%S",function(t){return t.getSeconds()}],["%I:%M",function(t){return t.getMinutes()}],["%I %p",function(t){return t.getHours()}],["%a %d",function(t){return t.getDay()&&1!=t.getDate()}],["%b %d",function(t){return 1!=t.getDate()}],["%B",function(t){return t.getMonth()}],["%Y",Ie]]),nu={range:function(t,e,r){return ca.range(Math.ceil(t/r)*r,+e,r).map(sa)},floor:x,ceil:x};eu.year=ms.year,ms.scale=function(){return aa(ca.scale.linear(),eu,ru)};var iu=eu.map(function(t){return[t[0].utc,t[1]]}),ou=$l.multi([[".%L",function(t){return t.getUTCMilliseconds()}],[":%S",function(t){return t.getUTCSeconds()}],["%I:%M",function(t){return t.getUTCMinutes()}],["%I %p",function(t){return t.getUTCHours()}],["%a %d",function(t){return t.getUTCDay()&&1!=t.getUTCDate()}],["%b %d",function(t){return 1!=t.getUTCDate()}],["%B",function(t){return t.getUTCMonth()}],["%Y",Ie]]);iu.year=ms.year.utc,ms.scale.utc=function(){return aa(ca.scale.linear(),iu,ou)},ca.text=Lt(function(t){return t.responseText}),ca.json=function(t,e){return zt(t,"application/json",la,e)},ca.html=function(t,e){return zt(t,"text/html",ua,e)},ca.xml=Lt(function(t){return t.responseXML}),"function"==typeof t&&t.amd?(this.d3=ca,t(ca)):"object"==typeof r&&r.exports?r.exports=ca:this.d3=ca}()},{}],120:[function(t,e,r){"use strict";function n(t,e){this.point=t,this.index=e}function i(t,e){for(var r=t.point,n=e.point,i=r.length,o=0;i>o;++o){var a=n[o]-r[o];if(a)return a}return 0}function o(t,e,r){if(1===t)return r?[[-1,0]]:[];var n=e.map(function(t,e){return[t[0],e]});n.sort(function(t,e){return t[0]-e[0]});for(var i=new Array(t-1),o=1;t>o;++o){var a=n[o-1],s=n[o];i[o-1]=[a[1],s[1]]}return r&&i.push([-1,i[0][1]],[i[t-1][1],-1]),i}function a(t,e){var r=t.length;if(0===r)return[];var a=t[0].length;if(1>a)return[];if(1===a)return o(r,t,e);for(var u=new Array(r),c=1,h=0;r>h;++h){for(var f=t[h],d=new Array(a+1),p=0,v=0;a>v;++v){var m=f[v];d[v]=m,p+=m*m;
}d[a]=p,u[h]=new n(d,h),c=Math.max(p,c)}l(u,i),r=u.length;for(var g=new Array(r+a+1),y=new Array(r+a+1),b=(a+1)*(a+1)*c,x=new Array(a+1),h=0;a>=h;++h)x[h]=0;x[a]=b,g[0]=x.slice(),y[0]=-1;for(var h=0;a>=h;++h){var d=x.slice();d[h]=1,g[h+1]=d,y[h+1]=-1}for(var h=0;r>h;++h){var _=u[h];g[h+a+1]=_.point,y[h+a+1]=_.index}var w=s(g,!1);if(w=e?w.filter(function(t){for(var e=0,r=0;a>=r;++r){var n=y[t[r]];if(0>n&&++e>=2)return!1;t[r]=n}return!0}):w.filter(function(t){for(var e=0;a>=e;++e){var r=y[t[e]];if(0>r)return!1;t[e]=r}return!0}),1&a)for(var h=0;h<w.length;++h){var _=w[h],d=_[0];_[0]=_[1],_[1]=d}return w}var s=t("incremental-convex-hull"),l=t("uniq");e.exports=a},{"incremental-convex-hull":241,uniq:459}],121:[function(t,e,r){"use strict";function n(t,e,r){var i=0|t[r];if(0>=i)return[];var o,a=new Array(i);if(r===t.length-1)for(o=0;i>o;++o)a[o]=e;else for(o=0;i>o;++o)a[o]=n(t,e,r+1);return a}function i(t,e){var r,n;for(r=new Array(t),n=0;t>n;++n)r[n]=e;return r}function o(t,e){switch("undefined"==typeof e&&(e=0),typeof t){case"number":if(t>0)return i(0|t,e);break;case"object":if("number"==typeof t.length)return n(t,e,0)}return[]}e.exports=o},{}],122:[function(e,r,n){(function(n,i){(function(){"use strict";function o(t){return"function"==typeof t||"object"==typeof t&&null!==t}function a(t){return"function"==typeof t}function s(t){X=t}function l(t){K=t}function u(){return function(){n.nextTick(p)}}function c(){return function(){H(p)}}function h(){var t=0,e=new Q(p),r=document.createTextNode("");return e.observe(r,{characterData:!0}),function(){r.data=t=++t%2}}function f(){var t=new MessageChannel;return t.port1.onmessage=p,function(){t.port2.postMessage(0)}}function d(){return function(){setTimeout(p,1)}}function p(){for(var t=0;Z>t;t+=2){var e=rt[t],r=rt[t+1];e(r),rt[t]=void 0,rt[t+1]=void 0}Z=0}function v(){try{var t=e,r=t("vertx");return H=r.runOnLoop||r.runOnContext,c()}catch(n){return d()}}function m(t,e){var r=this,n=r._state;if(n===at&&!t||n===st&&!e)return this;var i=new this.constructor(y),o=r._result;if(n){var a=arguments[n-1];K(function(){R(n,i,a,o)})}else z(r,i,t,e);return i}function g(t){var e=this;if(t&&"object"==typeof t&&t.constructor===e)return t;var r=new e(y);return T(r,t),r}function y(){}function b(){return new TypeError("You cannot resolve a promise with itself")}function x(){return new TypeError("A promises callback cannot return that same promise.")}function _(t){try{return t.then}catch(e){return lt.error=e,lt}}function w(t,e,r,n){try{t.call(e,r,n)}catch(i){return i}}function M(t,e,r){K(function(t){var n=!1,i=w(r,e,function(r){n||(n=!0,e!==r?T(t,r):S(t,r))},function(e){n||(n=!0,L(t,e))},"Settle: "+(t._label||" unknown promise"));!n&&i&&(n=!0,L(t,i))},t)}function k(t,e){e._state===at?S(t,e._result):e._state===st?L(t,e._result):z(e,void 0,function(e){T(t,e)},function(e){L(t,e)})}function A(t,e,r){e.constructor===t.constructor&&r===nt&&constructor.resolve===it?k(t,e):r===lt?L(t,lt.error):void 0===r?S(t,e):a(r)?M(t,e,r):S(t,e)}function T(t,e){t===e?L(t,b()):o(e)?A(t,e,_(e)):S(t,e)}function E(t){t._onerror&&t._onerror(t._result),I(t)}function S(t,e){t._state===ot&&(t._result=e,t._state=at,0!==t._subscribers.length&&K(I,t))}function L(t,e){t._state===ot&&(t._state=st,t._result=e,K(E,t))}function z(t,e,r,n){var i=t._subscribers,o=i.length;t._onerror=null,i[o]=e,i[o+at]=r,i[o+st]=n,0===o&&t._state&&K(I,t)}function I(t){var e=t._subscribers,r=t._state;if(0!==e.length){for(var n,i,o=t._result,a=0;a<e.length;a+=3)n=e[a],i=e[a+r],n?R(r,n,i,o):i(o);t._subscribers.length=0}}function P(){this.error=null}function C(t,e){try{return t(e)}catch(r){return ut.error=r,ut}}function R(t,e,r,n){var i,o,s,l,u=a(r);if(u){if(i=C(r,n),i===ut?(l=!0,o=i.error,i=null):s=!0,e===i)return void L(e,x())}else i=n,s=!0;e._state!==ot||(u&&s?T(e,i):l?L(e,o):t===at?S(e,i):t===st&&L(e,i))}function D(t,e){try{e(function(e){T(t,e)},function(e){L(t,e)})}catch(r){L(t,r)}}function O(t){return new vt(this,t).promise}function F(t){function e(t){T(i,t)}function r(t){L(i,t)}var n=this,i=new n(y);if(!W(t))return L(i,new TypeError("You must pass an array to race.")),i;for(var o=t.length,a=0;i._state===ot&&o>a;a++)z(n.resolve(t[a]),void 0,e,r);return i}function j(t){var e=this,r=new e(y);return L(r,t),r}function N(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function B(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}function U(t){this._id=dt++,this._state=void 0,this._result=void 0,this._subscribers=[],y!==t&&("function"!=typeof t&&N(),this instanceof U?D(this,t):B())}function V(t,e){this._instanceConstructor=t,this.promise=new t(y),Array.isArray(e)?(this._input=e,this.length=e.length,this._remaining=e.length,this._result=new Array(this.length),0===this.length?S(this.promise,this._result):(this.length=this.length||0,this._enumerate(),0===this._remaining&&S(this.promise,this._result))):L(this.promise,this._validationError())}function q(){var t;if("undefined"!=typeof i)t=i;else if("undefined"!=typeof self)t=self;else try{t=Function("return this")()}catch(e){throw new Error("polyfill failed because global object is unavailable in this environment")}var r=t.Promise;r&&"[object Promise]"===Object.prototype.toString.call(r.resolve())&&!r.cast||(t.Promise=pt)}var G;G=Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)};var H,X,Y,W=G,Z=0,K=function(t,e){rt[Z]=t,rt[Z+1]=e,Z+=2,2===Z&&(X?X(p):Y())},J="undefined"!=typeof window?window:void 0,$=J||{},Q=$.MutationObserver||$.WebKitMutationObserver,tt="undefined"!=typeof n&&"[object process]"==={}.toString.call(n),et="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,rt=new Array(1e3);Y=tt?u():Q?h():et?f():void 0===J&&"function"==typeof e?v():d();var nt=m,it=g,ot=void 0,at=1,st=2,lt=new P,ut=new P,ct=O,ht=F,ft=j,dt=0,pt=U;U.all=ct,U.race=ht,U.resolve=it,U.reject=ft,U._setScheduler=s,U._setAsap=l,U._asap=K,U.prototype={constructor:U,then:nt,"catch":function(t){return this.then(null,t)}};var vt=V;V.prototype._validationError=function(){return new Error("Array Methods must be provided an Array")},V.prototype._enumerate=function(){for(var t=this.length,e=this._input,r=0;this._state===ot&&t>r;r++)this._eachEntry(e[r],r)},V.prototype._eachEntry=function(t,e){var r=this._instanceConstructor,n=r.resolve;if(n===it){var i=_(t);if(i===nt&&t._state!==ot)this._settledAt(t._state,e,t._result);else if("function"!=typeof i)this._remaining--,this._result[e]=t;else if(r===pt){var o=new r(y);A(o,t,i),this._willSettleAt(o,e)}else this._willSettleAt(new r(function(e){e(t)}),e)}else this._willSettleAt(n(t),e)},V.prototype._settledAt=function(t,e,r){var n=this.promise;n._state===ot&&(this._remaining--,t===st?L(n,r):this._result[e]=r),0===this._remaining&&S(n,this._result)},V.prototype._willSettleAt=function(t,e){var r=this;z(t,void 0,function(t){r._settledAt(at,e,t)},function(t){r._settledAt(st,e,t)})};var mt=q,gt={Promise:pt,polyfill:mt};"function"==typeof t&&t.amd?t(function(){return gt}):"undefined"!=typeof r&&r.exports?r.exports=gt:"undefined"!=typeof this&&(this.ES6Promise=gt),mt()}).call(this)}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{_process:60}],123:[function(t,e,r){"use strict";function n(t){for(var e,r=t.length,n=0;r>n;n++)if(e=t.charCodeAt(n),(9>e||e>13)&&32!==e&&133!==e&&160!==e&&5760!==e&&6158!==e&&(8192>e||e>8205)&&8232!==e&&8233!==e&&8239!==e&&8287!==e&&8288!==e&&12288!==e&&65279!==e)return!1;return!0}e.exports=function(t){var e=typeof t;if("string"===e){var r=t;if(t=+t,0===t&&n(r))return!1}else if("number"!==e)return!1;return 1>t-t}},{}],124:[function(t,e,r){"use strict";function n(t,e,r,n,i){this.gl=t,this.type=e,this.handle=r,this.length=n,this.usage=i}function i(t,e,r,n,i,o){var a=i.length*i.BYTES_PER_ELEMENT;if(0>o)return t.bufferData(e,i,n),a;if(a+o>r)throw new Error("gl-buffer: If resizing buffer, must not specify offset");return t.bufferSubData(e,o,i),r}function o(t,e){for(var r=l.malloc(t.length,e),n=t.length,i=0;n>i;++i)r[i]=t[i];return r}function a(t,e){for(var r=1,n=e.length-1;n>=0;--n){if(e[n]!==r)return!1;r*=t[n]}return!0}function s(t,e,r,i){if(r=r||t.ARRAY_BUFFER,i=i||t.DYNAMIC_DRAW,r!==t.ARRAY_BUFFER&&r!==t.ELEMENT_ARRAY_BUFFER)throw new Error("gl-buffer: Invalid type for webgl buffer, must be either gl.ARRAY_BUFFER or gl.ELEMENT_ARRAY_BUFFER");if(i!==t.DYNAMIC_DRAW&&i!==t.STATIC_DRAW&&i!==t.STREAM_DRAW)throw new Error("gl-buffer: Invalid usage for buffer, must be either gl.DYNAMIC_DRAW, gl.STATIC_DRAW or gl.STREAM_DRAW");var o=t.createBuffer(),a=new n(t,r,o,0,i);return a.update(e),a}var l=t("typedarray-pool"),u=t("ndarray-ops"),c=t("ndarray"),h=["uint8","uint8_clamped","uint16","uint32","int8","int16","int32","float32"],f=n.prototype;f.bind=function(){this.gl.bindBuffer(this.type,this.handle)},f.unbind=function(){this.gl.bindBuffer(this.type,null)},f.dispose=function(){this.gl.deleteBuffer(this.handle)},f.update=function(t,e){if("number"!=typeof e&&(e=-1),this.bind(),"object"==typeof t&&"undefined"!=typeof t.shape){var r=t.dtype;if(h.indexOf(r)<0&&(r="float32"),this.type===this.gl.ELEMENT_ARRAY_BUFFER){var n=gl.getExtension("OES_element_index_uint");r=n&&"uint16"!==r?"uint32":"uint16"}if(r===t.dtype&&a(t.shape,t.stride))0===t.offset&&t.data.length===t.shape[0]?this.length=i(this.gl,this.type,this.length,this.usage,t.data,e):this.length=i(this.gl,this.type,this.length,this.usage,t.data.subarray(t.offset,t.shape[0]),e);else{var s=l.malloc(t.size,r),f=c(s,t.shape);u.assign(f,t),0>e?this.length=i(this.gl,this.type,this.length,this.usage,s,e):this.length=i(this.gl,this.type,this.length,this.usage,s.subarray(0,t.size),e),l.free(s)}}else if(Array.isArray(t)){var d;d=this.type===this.gl.ELEMENT_ARRAY_BUFFER?o(t,"uint16"):o(t,"float32"),0>e?this.length=i(this.gl,this.type,this.length,this.usage,d,e):this.length=i(this.gl,this.type,this.length,this.usage,d.subarray(0,t.length),e),l.free(d)}else if("object"==typeof t&&"number"==typeof t.length)this.length=i(this.gl,this.type,this.length,this.usage,t,e);else{if("number"!=typeof t&&void 0!==t)throw new Error("gl-buffer: Invalid data type");if(e>=0)throw new Error("gl-buffer: Cannot specify offset when resizing buffer");t=0|t,0>=t&&(t=1),this.gl.bufferData(this.type,0|t,this.usage),this.length=t}},e.exports=s},{ndarray:433,"ndarray-ops":432,"typedarray-pool":458}],125:[function(t,e,r){"use strict";function n(t,e,r){this.plot=t,this.shader=e,this.buffer=r,this.bounds=[1/0,1/0,-(1/0),-(1/0)],this.numPoints=0,this.color=[0,0,0,1]}function i(t,e){var r=o(t.gl,l.vertex,l.fragment),i=a(t.gl),s=new n(t,r,i);return s.update(e),t.addObject(s),s}var o=t("gl-shader"),a=t("gl-buffer"),s=t("typedarray-pool"),l=t("./lib/shaders");e.exports=i;var u=[[1,0,0,1,0,0],[1,0,0,-1,0,0],[-1,0,0,-1,0,0],[-1,0,0,-1,0,0],[-1,0,0,1,0,0],[1,0,0,1,0,0],[1,0,-1,0,0,1],[1,0,-1,0,0,-1],[1,0,1,0,0,-1],[1,0,1,0,0,-1],[1,0,1,0,0,1],[1,0,-1,0,0,1],[-1,0,-1,0,0,1],[-1,0,-1,0,0,-1],[-1,0,1,0,0,-1],[-1,0,1,0,0,-1],[-1,0,1,0,0,1],[-1,0,-1,0,0,1],[0,1,1,0,0,0],[0,1,-1,0,0,0],[0,-1,-1,0,0,0],[0,-1,-1,0,0,0],[0,1,1,0,0,0],[0,-1,1,0,0,0],[0,1,0,-1,1,0],[0,1,0,-1,-1,0],[0,1,0,1,-1,0],[0,1,0,1,1,0],[0,1,0,-1,1,0],[0,1,0,1,-1,0],[0,-1,0,-1,1,0],[0,-1,0,-1,-1,0],[0,-1,0,1,-1,0],[0,-1,0,1,1,0],[0,-1,0,-1,1,0],[0,-1,0,1,-1,0]],c=n.prototype;c.draw=function(){var t=[1,0,0,0,1,0,0,0,1],e=[1,1];return function(){var r=this.plot,n=this.shader,i=this.buffer,o=this.bounds,a=this.numPoints;if(a){var s=r.gl,l=r.dataBox,c=r.viewBox,h=r.pixelRatio,f=o[2]-o[0],d=o[3]-o[1],p=l[2]-l[0],v=l[3]-l[1];t[0]=2*f/p,t[4]=2*d/v,t[6]=2*(o[0]-l[0])/p-1,t[7]=2*(o[1]-l[1])/v-1;var m=c[2]-c[0],g=c[3]-c[1];e[0]=2*h/m,e[1]=2*h/g,i.bind(),n.bind(),n.uniforms.viewTransform=t,n.uniforms.pixelScale=e,n.uniforms.color=this.color,n.attributes.position.pointer(s.FLOAT,!1,16,0),n.attributes.pixelOffset.pointer(s.FLOAT,!1,16,8),s.drawArrays(s.TRIANGLES,0,a*u.length)}}}(),c.drawPick=function(t){return t},c.pick=function(t,e){return null},c.update=function(t){t=t||{};var e,r,n,i=t.positions||[],o=t.errors||[],a=1;"lineWidth"in t&&(a=+t.lineWidth);var l=5;"capSize"in t&&(l=+t.capSize),this.color=(t.color||[0,0,0,1]).slice();var c=this.bounds=[1/0,1/0,-(1/0),-(1/0)],h=this.numPoints=i.length>>1;for(e=0;h>e;++e)r=i[2*e],n=i[2*e+1],c[0]=Math.min(r,c[0]),c[1]=Math.min(n,c[1]),c[2]=Math.max(r,c[2]),c[3]=Math.max(n,c[3]);c[2]===c[0]&&(c[2]+=1),c[3]===c[1]&&(c[3]+=1);var f=1/(c[2]-c[0]),d=1/(c[3]-c[1]),p=c[0],v=c[1],m=s.mallocFloat32(h*u.length*4),g=0;for(e=0;h>e;++e){r=i[2*e],n=i[2*e+1];for(var y=o[4*e],b=o[4*e+1],x=o[4*e+2],_=o[4*e+3],w=0;w<u.length;++w){var M=u[w],k=M[0],A=M[1];0>k?k*=y:k>0&&(k*=b),0>A?A*=x:A>0&&(A*=_),m[g++]=f*(r-p+k),m[g++]=d*(n-v+A),m[g++]=a*M[2]+(l+a)*M[4],m[g++]=a*M[3]+(l+a)*M[5]}}this.buffer.update(m),s.free(m)},c.dispose=function(){this.plot.removeObject(this),this.shader.dispose(),this.buffer.dispose()}},{"./lib/shaders":126,"gl-buffer":124,"gl-shader":203,"typedarray-pool":458}],126:[function(t,e,r){e.exports={vertex:"precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 position;\nattribute vec2 pixelOffset;\n\nuniform mat3 viewTransform;\nuniform vec2 pixelScale;\n\nvoid main() {\n  vec3 scrPosition = viewTransform * vec3(position, 1);\n  gl_Position = vec4(\n    scrPosition.xy + scrPosition.z * pixelScale * pixelOffset,\n    0,\n    scrPosition.z);\n}\n",fragment:"precision mediump float;\n#define GLSLIFY 1\n\nuniform vec4 color;\n\nvoid main() {\n  gl_FragColor = vec4(color.rgb * color.a, color.a);\n}\n"}},{}],127:[function(t,e,r){"use strict";function n(t,e,r,n){this.gl=t,this.shader=n,this.buffer=e,this.vao=r,this.pixelRatio=1,this.bounds=[[1/0,1/0,1/0],[-(1/0),-(1/0),-(1/0)]],this.clipBounds=[[-(1/0),-(1/0),-(1/0)],[1/0,1/0,1/0]],this.lineWidth=[1,1,1],this.capSize=[10,10,10],this.lineCount=[0,0,0],this.lineOffset=[0,0,0],this.opacity=1}function i(t,e){for(var r=0;3>r;++r)t[0][r]=Math.min(t[0][r],e[r]),t[1][r]=Math.max(t[1][r],e[r])}function o(t,e,r,n){for(var i=f[n],o=0;o<i.length;++o){var a=i[o];t.push(e[0],e[1],e[2],r[0],r[1],r[2],r[3],a[0],a[1],a[2])}return i.length}function a(t){var e=t.gl,r=s(e),i=l(e,[{buffer:r,type:e.FLOAT,size:3,offset:0,stride:40},{buffer:r,type:e.FLOAT,size:4,offset:12,stride:40},{buffer:r,type:e.FLOAT,size:3,offset:28,stride:40}]),o=u(e);o.attributes.position.location=0,o.attributes.color.location=1,o.attributes.offset.location=2;var a=new n(e,r,i,o);return a.update(t),a}e.exports=a;var s=t("gl-buffer"),l=t("gl-vao"),u=t("./shaders/index"),c=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],h=n.prototype;h.isOpaque=function(){return this.opacity>=1},h.isTransparent=function(){return this.opacity<1},h.drawTransparent=h.draw=function(t){var e=this.gl,r=this.shader.uniforms;this.shader.bind();var n=r.view=t.view||c,i=r.projection=t.projection||c;r.model=t.model||c,r.clipBounds=this.clipBounds,r.opacity=this.opacity;var o=n[12],a=n[13],s=n[14],l=n[15],u=this.pixelRatio*(i[3]*o+i[7]*a+i[11]*s+i[15]*l)/e.drawingBufferHeight;this.vao.bind();for(var h=0;3>h;++h)e.lineWidth(this.lineWidth[h]),r.capSize=this.capSize[h]*u,e.drawArrays(e.LINES,this.lineOffset[h],this.lineCount[h]);this.vao.unbind()};var f=function(){for(var t=new Array(3),e=0;3>e;++e){for(var r=[],n=1;2>=n;++n)for(var i=-1;1>=i;i+=2){var o=(n+e)%3,a=[0,0,0];a[o]=i,r.push(a)}t[e]=r}return t}();h.update=function(t){t=t||{},"lineWidth"in t&&(this.lineWidth=t.lineWidth,Array.isArray(this.lineWidth)||(this.lineWidth=[this.lineWidth,this.lineWidth,this.lineWidth])),"capSize"in t&&(this.capSize=t.capSize,Array.isArray(this.capSize)||(this.capSize=[this.capSize,this.capSize,this.capSize])),"opacity"in t&&(this.opacity=t.opacity);var e=t.color||[[0,0,0],[0,0,0],[0,0,0]],r=t.position,n=t.error;if(Array.isArray(e[0])||(e=[e,e,e]),r&&n){var a=[],s=r.length,l=0;this.bounds=[[1/0,1/0,1/0],[-(1/0),-(1/0),-(1/0)]],this.lineCount=[0,0,0];for(var u=0;3>u;++u){this.lineOffset[u]=l;t:for(var c=0;s>c;++c){for(var h=r[c],f=0;3>f;++f)if(isNaN(h[f])||!isFinite(h[f]))continue t;var d=n[c],p=e[u];if(Array.isArray(p[0])&&(p=e[c]),3===p.length&&(p=[p[0],p[1],p[2],1]),!isNaN(d[0][u])&&!isNaN(d[1][u])){if(d[0][u]<0){var v=h.slice();v[u]+=d[0][u],a.push(h[0],h[1],h[2],p[0],p[1],p[2],p[3],0,0,0,v[0],v[1],v[2],p[0],p[1],p[2],p[3],0,0,0),i(this.bounds,v),l+=2+o(a,v,p,u)}if(d[1][u]>0){var v=h.slice();v[u]+=d[1][u],a.push(h[0],h[1],h[2],p[0],p[1],p[2],p[3],0,0,0,v[0],v[1],v[2],p[0],p[1],p[2],p[3],0,0,0),i(this.bounds,v),l+=2+o(a,v,p,u)}}}this.lineCount[u]=l-this.lineOffset[u]}this.buffer.update(a)}},h.dispose=function(){this.shader.dispose(),this.buffer.dispose(),this.vao.dispose()}},{"./shaders/index":128,"gl-buffer":124,"gl-vao":232}],128:[function(t,e,r){"use strict";var n=t("gl-shader"),i="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position, offset;\nattribute vec4 color;\nuniform mat4 model, view, projection;\nuniform float capSize;\nvarying vec4 fragColor;\nvarying vec3 fragPosition;\n\nvoid main() {\n  vec4 worldPosition  = model * vec4(position, 1.0);\n  worldPosition       = (worldPosition / worldPosition.w) + vec4(capSize * offset, 0.0);\n  gl_Position         = projection * view * worldPosition;\n  fragColor           = color;\n  fragPosition        = position;\n}",o="precision mediump float;\n#define GLSLIFY 1\nuniform vec3 clipBounds[2];\nuniform float opacity;\nvarying vec3 fragPosition;\nvarying vec4 fragColor;\n\nvoid main() {\n  if(any(lessThan(fragPosition, clipBounds[0])) || any(greaterThan(fragPosition, clipBounds[1]))) {\n    discard;\n  }\n  gl_FragColor = opacity * fragColor;\n}";e.exports=function(t){return n(t,i,o,null,[{name:"position",type:"vec3"},{name:"offset",type:"vec3"},{name:"color",type:"vec4"}])}},{"gl-shader":203}],129:[function(t,e,r){"use strict";function n(t){var e=t.getParameter(t.FRAMEBUFFER_BINDING),r=t.getParameter(t.RENDERBUFFER_BINDING),n=t.getParameter(t.TEXTURE_BINDING_2D);return[e,r,n]}function i(t,e){t.bindFramebuffer(t.FRAMEBUFFER,e[0]),t.bindRenderbuffer(t.RENDERBUFFER,e[1]),t.bindTexture(t.TEXTURE_2D,e[2])}function o(t,e){var r=t.getParameter(e.MAX_COLOR_ATTACHMENTS_WEBGL);y=new Array(r+1);for(var n=0;r>=n;++n){for(var i=new Array(r),o=0;n>o;++o)i[o]=t.COLOR_ATTACHMENT0+o;for(var o=n;r>o;++o)i[o]=t.NONE;y[n]=i}}function a(t){switch(t){case p:throw new Error("gl-fbo: Framebuffer unsupported");case v:throw new Error("gl-fbo: Framebuffer incomplete attachment");case m:throw new Error("gl-fbo: Framebuffer incomplete dimensions");case g:throw new Error("gl-fbo: Framebuffer incomplete missing attachment");default:throw new Error("gl-fbo: Framebuffer failed for unspecified reason")}}function s(t,e,r,n,i,o){if(!n)return null;var a=d(t,e,r,i,n);return a.magFilter=t.NEAREST,a.minFilter=t.NEAREST,a.mipSamples=1,a.bind(),t.framebufferTexture2D(t.FRAMEBUFFER,o,t.TEXTURE_2D,a.handle,0),a}function l(t,e,r,n,i){var o=t.createRenderbuffer();return t.bindRenderbuffer(t.RENDERBUFFER,o),t.renderbufferStorage(t.RENDERBUFFER,n,e,r),t.framebufferRenderbuffer(t.FRAMEBUFFER,i,t.RENDERBUFFER,o),o}function u(t){var e=n(t.gl),r=t.gl,o=t.handle=r.createFramebuffer(),u=t._shape[0],c=t._shape[1],h=t.color.length,f=t._ext,d=t._useStencil,p=t._useDepth,v=t._colorType;r.bindFramebuffer(r.FRAMEBUFFER,o);for(var m=0;h>m;++m)t.color[m]=s(r,u,c,v,r.RGBA,r.COLOR_ATTACHMENT0+m);0===h?(t._color_rb=l(r,u,c,r.RGBA4,r.COLOR_ATTACHMENT0),f&&f.drawBuffersWEBGL(y[0])):h>1&&f.drawBuffersWEBGL(y[h]);var g=r.getExtension("WEBGL_depth_texture");g?d?t.depth=s(r,u,c,g.UNSIGNED_INT_24_8_WEBGL,r.DEPTH_STENCIL,r.DEPTH_STENCIL_ATTACHMENT):p&&(t.depth=s(r,u,c,r.UNSIGNED_SHORT,r.DEPTH_COMPONENT,r.DEPTH_ATTACHMENT)):p&&d?t._depth_rb=l(r,u,c,r.DEPTH_STENCIL,r.DEPTH_STENCIL_ATTACHMENT):p?t._depth_rb=l(r,u,c,r.DEPTH_COMPONENT16,r.DEPTH_ATTACHMENT):d&&(t._depth_rb=l(r,u,c,r.STENCIL_INDEX,r.STENCIL_ATTACHMENT));var b=r.checkFramebufferStatus(r.FRAMEBUFFER);if(b!==r.FRAMEBUFFER_COMPLETE){t._destroyed=!0,r.bindFramebuffer(r.FRAMEBUFFER,null),r.deleteFramebuffer(t.handle),t.handle=null,t.depth&&(t.depth.dispose(),t.depth=null),t._depth_rb&&(r.deleteRenderbuffer(t._depth_rb),t._depth_rb=null);for(var m=0;m<t.color.length;++m)t.color[m].dispose(),t.color[m]=null;t._color_rb&&(r.deleteRenderbuffer(t._color_rb),t._color_rb=null),i(r,e),a(b)}i(r,e)}function c(t,e,r,n,i,o,a,s){this.gl=t,this._shape=[0|e,0|r],this._destroyed=!1,this._ext=s,this.color=new Array(i);for(var l=0;i>l;++l)this.color[l]=null;this._color_rb=null,this.depth=null,this._depth_rb=null,this._colorType=n,this._useDepth=o,this._useStencil=a;var c=this,h=[0|e,0|r];Object.defineProperties(h,{0:{get:function(){return c._shape[0]},set:function(t){return c.width=t}},1:{get:function(){return c._shape[1]},set:function(t){return c.height=t}}}),this._shapeVector=h,u(this)}function h(t,e,r){if(t._destroyed)throw new Error("gl-fbo: Can't resize destroyed FBO");if(t._shape[0]!==e||t._shape[1]!==r){var o=t.gl,s=o.getParameter(o.MAX_RENDERBUFFER_SIZE);if(0>e||e>s||0>r||r>s)throw new Error("gl-fbo: Can't resize FBO, invalid dimensions");t._shape[0]=e,t._shape[1]=r;for(var l=n(o),u=0;u<t.color.length;++u)t.color[u].shape=t._shape;t._color_rb&&(o.bindRenderbuffer(o.RENDERBUFFER,t._color_rb),o.renderbufferStorage(o.RENDERBUFFER,o.RGBA4,t._shape[0],t._shape[1])),t.depth&&(t.depth.shape=t._shape),t._depth_rb&&(o.bindRenderbuffer(o.RENDERBUFFER,t._depth_rb),t._useDepth&&t._useStencil?o.renderbufferStorage(o.RENDERBUFFER,o.DEPTH_STENCIL,t._shape[0],t._shape[1]):t._useDepth?o.renderbufferStorage(o.RENDERBUFFER,o.DEPTH_COMPONENT16,t._shape[0],t._shape[1]):t._useStencil&&o.renderbufferStorage(o.RENDERBUFFER,o.STENCIL_INDEX,t._shape[0],t._shape[1])),o.bindFramebuffer(o.FRAMEBUFFER,t.handle);var c=o.checkFramebufferStatus(o.FRAMEBUFFER);c!==o.FRAMEBUFFER_COMPLETE&&(t.dispose(),i(o,l),a(c)),i(o,l)}}function f(t,e,r,n){p||(p=t.FRAMEBUFFER_UNSUPPORTED,v=t.FRAMEBUFFER_INCOMPLETE_ATTACHMENT,m=t.FRAMEBUFFER_INCOMPLETE_DIMENSIONS,g=t.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT);var i=t.getExtension("WEBGL_draw_buffers");if(!y&&i&&o(t,i),Array.isArray(e)&&(n=r,r=0|e[1],e=0|e[0]),"number"!=typeof e)throw new Error("gl-fbo: Missing shape parameter");var a=t.getParameter(t.MAX_RENDERBUFFER_SIZE);if(0>e||e>a||0>r||r>a)throw new Error("gl-fbo: Parameters are too large for FBO");n=n||{};var s=1;if("color"in n){if(s=Math.max(0|n.color,0),0>s)throw new Error("gl-fbo: Must specify a nonnegative number of colors");if(s>1){if(!i)throw new Error("gl-fbo: Multiple draw buffer extension not supported");if(s>t.getParameter(i.MAX_COLOR_ATTACHMENTS_WEBGL))throw new Error("gl-fbo: Context does not support "+s+" draw buffers")}}var l=t.UNSIGNED_BYTE,u=t.getExtension("OES_texture_float");if(n.float&&s>0){if(!u)throw new Error("gl-fbo: Context does not support floating point textures");l=t.FLOAT}else n.preferFloat&&s>0&&u&&(l=t.FLOAT);var h=!0;"depth"in n&&(h=!!n.depth);var f=!1;return"stencil"in n&&(f=!!n.stencil),new c(t,e,r,l,s,h,f,i)}var d=t("gl-texture2d");e.exports=f;var p,v,m,g,y=null,b=c.prototype;Object.defineProperties(b,{shape:{get:function(){return this._destroyed?[0,0]:this._shapeVector},set:function(t){if(Array.isArray(t)||(t=[0|t,0|t]),2!==t.length)throw new Error("gl-fbo: Shape vector must be length 2");var e=0|t[0],r=0|t[1];return h(this,e,r),[e,r]},enumerable:!1},width:{get:function(){return this._destroyed?0:this._shape[0]},set:function(t){return t=0|t,h(this,t,this._shape[1]),t},enumerable:!1},height:{get:function(){return this._destroyed?0:this._shape[1]},set:function(t){return t=0|t,h(this,this._shape[0],t),t},enumerable:!1}}),b.bind=function(){if(!this._destroyed){var t=this.gl;t.bindFramebuffer(t.FRAMEBUFFER,this.handle),t.viewport(0,0,this._shape[0],this._shape[1])}},b.dispose=function(){if(!this._destroyed){this._destroyed=!0;var t=this.gl;t.deleteFramebuffer(this.handle),this.handle=null,this.depth&&(this.depth.dispose(),this.depth=null),this._depth_rb&&(t.deleteRenderbuffer(this._depth_rb),this._depth_rb=null);for(var e=0;e<this.color.length;++e)this.color[e].dispose(),this.color[e]=null;this._color_rb&&(t.deleteRenderbuffer(this._color_rb),this._color_rb=null)}}},{"gl-texture2d":228}],130:[function(t,e,r){r.lineVertex="precision mediump float;\n#define GLSLIFY 1\n\nfloat inverse_1_0(float m) {\n  return 1.0 / m;\n}\n\nmat2 inverse_1_0(mat2 m) {\n  return mat2(m[1][1],-m[0][1],\n             -m[1][0], m[0][0]) / (m[0][0]*m[1][1] - m[0][1]*m[1][0]);\n}\n\nmat3 inverse_1_0(mat3 m) {\n  float a00 = m[0][0], a01 = m[0][1], a02 = m[0][2];\n  float a10 = m[1][0], a11 = m[1][1], a12 = m[1][2];\n  float a20 = m[2][0], a21 = m[2][1], a22 = m[2][2];\n\n  float b01 = a22 * a11 - a12 * a21;\n  float b11 = -a22 * a10 + a12 * a20;\n  float b21 = a21 * a10 - a11 * a20;\n\n  float det = a00 * b01 + a01 * b11 + a02 * b21;\n\n  return mat3(b01, (-a22 * a01 + a02 * a21), (a12 * a01 - a02 * a11),\n              b11, (a22 * a00 - a02 * a20), (-a12 * a00 + a02 * a10),\n              b21, (-a21 * a00 + a01 * a20), (a11 * a00 - a01 * a10)) / det;\n}\n\nmat4 inverse_1_0(mat4 m) {\n  float\n      a00 = m[0][0], a01 = m[0][1], a02 = m[0][2], a03 = m[0][3],\n      a10 = m[1][0], a11 = m[1][1], a12 = m[1][2], a13 = m[1][3],\n      a20 = m[2][0], a21 = m[2][1], a22 = m[2][2], a23 = m[2][3],\n      a30 = m[3][0], a31 = m[3][1], a32 = m[3][2], a33 = m[3][3],\n\n      b00 = a00 * a11 - a01 * a10,\n      b01 = a00 * a12 - a02 * a10,\n      b02 = a00 * a13 - a03 * a10,\n      b03 = a01 * a12 - a02 * a11,\n      b04 = a01 * a13 - a03 * a11,\n      b05 = a02 * a13 - a03 * a12,\n      b06 = a20 * a31 - a21 * a30,\n      b07 = a20 * a32 - a22 * a30,\n      b08 = a20 * a33 - a23 * a30,\n      b09 = a21 * a32 - a22 * a31,\n      b10 = a21 * a33 - a23 * a31,\n      b11 = a22 * a33 - a23 * a32,\n\n      det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\n\n  return mat4(\n      a11 * b11 - a12 * b10 + a13 * b09,\n      a02 * b10 - a01 * b11 - a03 * b09,\n      a31 * b05 - a32 * b04 + a33 * b03,\n      a22 * b04 - a21 * b05 - a23 * b03,\n      a12 * b08 - a10 * b11 - a13 * b07,\n      a00 * b11 - a02 * b08 + a03 * b07,\n      a32 * b02 - a30 * b05 - a33 * b01,\n      a20 * b05 - a22 * b02 + a23 * b01,\n      a10 * b10 - a11 * b08 + a13 * b06,\n      a01 * b08 - a00 * b10 - a03 * b06,\n      a30 * b04 - a31 * b02 + a33 * b00,\n      a21 * b02 - a20 * b04 - a23 * b00,\n      a11 * b07 - a10 * b09 - a12 * b06,\n      a00 * b09 - a01 * b07 + a02 * b06,\n      a31 * b01 - a30 * b03 - a32 * b00,\n      a20 * b03 - a21 * b01 + a22 * b00) / det;\n}\n\n\n\nattribute vec2 a, d;\n\nuniform mat3 matrix;\nuniform vec2 screenShape;\nuniform float width;\n\nvarying vec2 direction;\n\nvoid main() {\n  vec2 dir = (matrix * vec3(d, 0)).xy;\n  vec3 base = matrix * vec3(a, 1);\n  vec2 n = 0.5 * width *\n    normalize(screenShape.yx * vec2(dir.y, -dir.x)) / screenShape.xy;\n  vec2 tangent = normalize(screenShape.xy * dir);\n  if(dir.x < 0.0 || (dir.x == 0.0 && dir.y < 0.0)) {\n    direction = -tangent;\n  } else {\n    direction = tangent;\n  }\n  gl_Position = vec4(base.xy/base.z + n, 0, 1);\n}\n",r.lineFragment="precision mediump float;\n#define GLSLIFY 1\n\nuniform vec4 color;\nuniform vec2 screenShape;\nuniform sampler2D dashPattern;\nuniform float dashLength;\n\nvarying vec2 direction;\n\nvoid main() {\n  float t = fract(dot(direction, gl_FragCoord.xy) / dashLength);\n  vec4 pcolor = color * texture2D(dashPattern, vec2(t, 0.0)).r;\n  gl_FragColor = vec4(pcolor.rgb * pcolor.a, pcolor.a);\n}\n",r.mitreVertex="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 p;\n\nuniform mat3  matrix;\nuniform vec2 screenShape;\nuniform float radius;\n\nvoid main() {\n  vec3 pp = matrix * vec3(p, 1);\n  gl_Position  = vec4(pp.xy, 0, pp.z);\n  gl_PointSize = radius;\n}\n",r.mitreFragment="precision mediump float;\n#define GLSLIFY 1\n\nuniform vec4 color;\n\nvoid main() {\n  if(length(gl_PointCoord.xy - 0.5) > 0.25) {\n    discard;\n  }\n  gl_FragColor = vec4(color.rgb, color.a);\n}\n",r.pickVertex="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 a, d;\nattribute vec4 pick0, pick1;\n\nuniform mat3 matrix;\nuniform vec2 screenShape;\nuniform float width;\n\nvarying vec4 pickA, pickB;\n\nfloat inverse_1_0(float m) {\n  return 1.0 / m;\n}\n\nmat2 inverse_1_0(mat2 m) {\n  return mat2(m[1][1],-m[0][1],\n             -m[1][0], m[0][0]) / (m[0][0]*m[1][1] - m[0][1]*m[1][0]);\n}\n\nmat3 inverse_1_0(mat3 m) {\n  float a00 = m[0][0], a01 = m[0][1], a02 = m[0][2];\n  float a10 = m[1][0], a11 = m[1][1], a12 = m[1][2];\n  float a20 = m[2][0], a21 = m[2][1], a22 = m[2][2];\n\n  float b01 = a22 * a11 - a12 * a21;\n  float b11 = -a22 * a10 + a12 * a20;\n  float b21 = a21 * a10 - a11 * a20;\n\n  float det = a00 * b01 + a01 * b11 + a02 * b21;\n\n  return mat3(b01, (-a22 * a01 + a02 * a21), (a12 * a01 - a02 * a11),\n              b11, (a22 * a00 - a02 * a20), (-a12 * a00 + a02 * a10),\n              b21, (-a21 * a00 + a01 * a20), (a11 * a00 - a01 * a10)) / det;\n}\n\nmat4 inverse_1_0(mat4 m) {\n  float\n      a00 = m[0][0], a01 = m[0][1], a02 = m[0][2], a03 = m[0][3],\n      a10 = m[1][0], a11 = m[1][1], a12 = m[1][2], a13 = m[1][3],\n      a20 = m[2][0], a21 = m[2][1], a22 = m[2][2], a23 = m[2][3],\n      a30 = m[3][0], a31 = m[3][1], a32 = m[3][2], a33 = m[3][3],\n\n      b00 = a00 * a11 - a01 * a10,\n      b01 = a00 * a12 - a02 * a10,\n      b02 = a00 * a13 - a03 * a10,\n      b03 = a01 * a12 - a02 * a11,\n      b04 = a01 * a13 - a03 * a11,\n      b05 = a02 * a13 - a03 * a12,\n      b06 = a20 * a31 - a21 * a30,\n      b07 = a20 * a32 - a22 * a30,\n      b08 = a20 * a33 - a23 * a30,\n      b09 = a21 * a32 - a22 * a31,\n      b10 = a21 * a33 - a23 * a31,\n      b11 = a22 * a33 - a23 * a32,\n\n      det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\n\n  return mat4(\n      a11 * b11 - a12 * b10 + a13 * b09,\n      a02 * b10 - a01 * b11 - a03 * b09,\n      a31 * b05 - a32 * b04 + a33 * b03,\n      a22 * b04 - a21 * b05 - a23 * b03,\n      a12 * b08 - a10 * b11 - a13 * b07,\n      a00 * b11 - a02 * b08 + a03 * b07,\n      a32 * b02 - a30 * b05 - a33 * b01,\n      a20 * b05 - a22 * b02 + a23 * b01,\n      a10 * b10 - a11 * b08 + a13 * b06,\n      a01 * b08 - a00 * b10 - a03 * b06,\n      a30 * b04 - a31 * b02 + a33 * b00,\n      a21 * b02 - a20 * b04 - a23 * b00,\n      a11 * b07 - a10 * b09 - a12 * b06,\n      a00 * b09 - a01 * b07 + a02 * b06,\n      a31 * b01 - a30 * b03 - a32 * b00,\n      a20 * b03 - a21 * b01 + a22 * b00) / det;\n}\n\n\n\nvoid main() {\n  vec3 base = matrix * vec3(a, 1);\n  vec2 n = width *\n    normalize(screenShape.yx * vec2(d.y, -d.x)) / screenShape.xy;\n  gl_Position = vec4(base.xy/base.z + n, 0, 1);\n  pickA = pick0;\n  pickB = pick1;\n}\n",r.pickFragment="precision mediump float;\n#define GLSLIFY 1\n\nuniform vec4 pickOffset;\n\nvarying vec4 pickA, pickB;\n\nvoid main() {\n  vec4 fragId = vec4(pickA.xyz, 0.0);\n  if(pickB.w > pickA.w) {\n    fragId.xyz = pickB.xyz;\n  }\n\n  fragId += pickOffset;\n\n  fragId.y += floor(fragId.x / 256.0);\n  fragId.x -= floor(fragId.x / 256.0) * 256.0;\n\n  fragId.z += floor(fragId.y / 256.0);\n  fragId.y -= floor(fragId.y / 256.0) * 256.0;\n\n  fragId.w += floor(fragId.z / 256.0);\n  fragId.z -= floor(fragId.z / 256.0) * 256.0;\n\n  gl_FragColor = fragId / 255.0;\n}\n",r.fillVertex="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 a, d;\n\nuniform mat3 matrix;\nuniform vec2 projectAxis;\nuniform float projectValue;\nuniform float depth;\n\nvoid main() {\n  vec3 base = matrix * vec3(a, 1);\n  vec2 p = base.xy / base.z;\n  if(d.y < 0.0 || (d.y == 0.0 && d.x < 0.0)) {\n    if(dot(p, projectAxis) < projectValue) {\n      p = p * (1.0 - abs(projectAxis)) + projectAxis * projectValue;\n    }\n  }\n  gl_Position = vec4(p, depth, 1);\n}\n",r.fillFragment="precision mediump float;\n#define GLSLIFY 1\n\nuniform vec4 color;\n\nvoid main() {\n  gl_FragColor = vec4(color.rgb * color.a, color.a);\n}\n";
},{}],131:[function(t,e,r){"use strict";function n(t,e,r,n,i,o,a,s){this.plot=t,this.dashPattern=e,this.lineBuffer=r,this.pickBuffer=n,this.lineShader=i,this.mitreShader=o,this.fillShader=a,this.pickShader=s,this.usingDashes=!1,this.bounds=[1/0,1/0,-(1/0),-(1/0)],this.width=1,this.color=[0,0,1,1],this.fill=[!1,!1,!1,!1],this.fillColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.data=null,this.numPoints=0,this.vertCount=0,this.pickOffset=0,this.lodBuffer=[]}function i(t){return t.map(function(t){return t.slice()})}function o(t,e){var r=t.gl,i=s(r),o=s(r),u=l(r,[1,1]),c=a(r,h.lineVertex,h.lineFragment),f=a(r,h.mitreVertex,h.mitreFragment),d=a(r,h.fillVertex,h.fillFragment),p=a(r,h.pickVertex,h.pickFragment),v=new n(t,u,i,o,c,f,d,p);return t.addObject(v),v.update(e),v}e.exports=o;var a=t("gl-shader"),s=t("gl-buffer"),l=t("gl-texture2d"),u=t("ndarray"),c=t("typedarray-pool"),h=t("./lib/shaders"),f=n.prototype;f.draw=function(){var t=[1,0,0,0,1,0,0,0,1],e=[0,0],r=[1,0],n=[-1,0],i=[0,1],o=[0,-1];return function(){var a=this.plot,s=this.color,l=this.width,u=(this.numPoints,this.bounds),c=this.vertCount;if(c){var h=a.gl,f=a.viewBox,d=a.dataBox,p=a.pixelRatio,v=u[2]-u[0],m=u[3]-u[1],g=d[2]-d[0],y=d[3]-d[1],b=f[2]-f[0],x=f[3]-f[1];t[0]=2*v/g,t[4]=2*m/y,t[6]=2*(u[0]-d[0])/g-1,t[7]=2*(u[1]-d[1])/y-1,e[0]=b,e[1]=x;var _=this.lineBuffer;_.bind();var w=this.fill;if(w[0]||w[1]||w[2]||w[3]){var M=this.fillShader;M.bind();var k=M.uniforms;k.matrix=t,k.depth=a.nextDepthValue();var A=M.attributes;A.a.pointer(h.FLOAT,!1,16,0),A.d.pointer(h.FLOAT,!1,16,8),h.depthMask(!0),h.enable(h.DEPTH_TEST);var T=this.fillColor;w[0]&&(k.color=T[0],k.projectAxis=n,k.projectValue=1,h.drawArrays(h.TRIANGLES,0,c)),w[1]&&(k.color=T[1],k.projectAxis=o,k.projectValue=1,h.drawArrays(h.TRIANGLES,0,c)),w[2]&&(k.color=T[2],k.projectAxis=r,k.projectValue=1,h.drawArrays(h.TRIANGLES,0,c)),w[3]&&(k.color=T[3],k.projectAxis=i,k.projectValue=1,h.drawArrays(h.TRIANGLES,0,c)),h.depthMask(!1),h.disable(h.DEPTH_TEST)}var E=this.lineShader;E.bind();var S=E.uniforms;S.matrix=t,S.color=s,S.width=l*p,S.screenShape=e,S.dashPattern=this.dashPattern.bind(),S.dashLength=this.dashLength*p;var L=E.attributes;if(L.a.pointer(h.FLOAT,!1,16,0),L.d.pointer(h.FLOAT,!1,16,8),h.drawArrays(h.TRIANGLES,0,c),l>2&&!this.usingDashes){var z=this.mitreShader;z.bind();var I=z.uniforms;I.matrix=t,I.color=s,I.screenShape=e,I.radius=l*p,z.attributes.p.pointer(h.FLOAT,!1,48,0),h.drawArrays(h.POINTS,0,c/3|0)}}}}(),f.drawPick=function(){var t=[1,0,0,0,1,0,0,0,1],e=[0,0],r=[0,0,0,0];return function(n){var i=this.plot,o=this.pickShader,a=this.lineBuffer,s=this.pickBuffer,l=this.width,u=this.numPoints,c=this.bounds,h=this.vertCount,f=i.gl,d=i.viewBox,p=i.dataBox,v=i.pickPixelRatio,m=c[2]-c[0],g=c[3]-c[1],y=p[2]-p[0],b=p[3]-p[1],x=d[2]-d[0],_=d[3]-d[1];if(this.pickOffset=n,!h)return n+u;t[0]=2*m/y,t[4]=2*g/b,t[6]=2*(c[0]-p[0])/y-1,t[7]=2*(c[1]-p[1])/b-1,e[0]=x,e[1]=_,r[0]=255&n,r[1]=n>>>8&255,r[2]=n>>>16&255,r[3]=n>>>24,o.bind();var w=o.uniforms;w.matrix=t,w.width=l*v,w.pickOffset=r,w.screenShape=e;var M=o.attributes;return a.bind(),M.a.pointer(f.FLOAT,!1,16,0),M.d.pointer(f.FLOAT,!1,16,8),s.bind(),M.pick0.pointer(f.UNSIGNED_BYTE,!1,8,0),M.pick1.pointer(f.UNSIGNED_BYTE,!1,8,4),f.drawArrays(f.TRIANGLES,0,h),n+u}}(),f.pick=function(t,e,r){var n=this.pickOffset,i=this.numPoints;if(n>r||r>=n+i)return null;var o=r-n,a=this.data;return{object:this,pointId:o,dataCoord:[a[2*o],a[2*o+1]]}},f.update=function(t){t=t||{};var e=this.plot.gl;!!t.connectGaps;this.color=(t.color||[0,0,1,1]).slice(),this.width=+(t.width||1),this.fill=(t.fill||[!1,!1,!1,!1]).slice(),this.fillColor=i(t.fillColor||[[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]]);for(var r=t.dashes||[1],n=0,o=0;o<r.length;++o)n+=r[o];for(var a=c.mallocUint8(n),s=0,h=255,o=0;o<r.length;++o){for(var f=0;f<r[o];++f)a[s++]=h;h^=255}this.dashPattern.dispose(),this.usingDashes=r.length>1,this.dashPattern=l(e,u(a,[n,1,4],[1,0,0])),this.dashPattern.minFilter=e.NEAREST,this.dashPattern.magFilter=e.NEAREST,this.dashLength=n,c.free(a);var d=t.positions;this.data=d;var p=this.bounds;p[0]=p[1]=1/0,p[2]=p[3]=-(1/0);var v=this.numPoints=d.length>>>1;if(0!==v){for(var o=0;v>o;++o){var m=d[2*o],g=d[2*o+1];isNaN(m)||isNaN(g)||(p[0]=Math.min(p[0],m),p[1]=Math.min(p[1],g),p[2]=Math.max(p[2],m),p[3]=Math.max(p[3],g))}p[0]===p[2]&&(p[2]+=1),p[3]===p[1]&&(p[3]+=1);for(var y=c.mallocFloat32(24*(v-1)),b=c.mallocUint32(12*(v-1)),x=y.length,_=b.length,s=v,w=0;s>1;){var M=--s,m=d[2*s],g=d[2*s+1],k=M-1,A=d[2*k],T=d[2*k+1];if(!(isNaN(m)||isNaN(g)||isNaN(A)||isNaN(T))){w+=1,m=(m-p[0])/(p[2]-p[0]),g=(g-p[1])/(p[3]-p[1]),A=(A-p[0])/(p[2]-p[0]),T=(T-p[1])/(p[3]-p[1]);var E=A-m,S=T-g,L=M|1<<24,z=M-1,I=M,P=M-1|1<<24;y[--x]=-S,y[--x]=-E,y[--x]=g,y[--x]=m,b[--_]=L,b[--_]=z,y[--x]=S,y[--x]=E,y[--x]=T,y[--x]=A,b[--_]=I,b[--_]=P,y[--x]=-S,y[--x]=-E,y[--x]=T,y[--x]=A,b[--_]=I,b[--_]=P,y[--x]=S,y[--x]=E,y[--x]=T,y[--x]=A,b[--_]=I,b[--_]=P,y[--x]=-S,y[--x]=-E,y[--x]=g,y[--x]=m,b[--_]=L,b[--_]=z,y[--x]=S,y[--x]=E,y[--x]=g,y[--x]=m,b[--_]=L,b[--_]=z}}this.vertCount=6*w,this.lineBuffer.update(y.subarray(x)),this.pickBuffer.update(b.subarray(_)),c.free(y),c.free(b)}},f.dispose=function(){this.plot.removeObject(this),this.lineBuffer.dispose(),this.pickBuffer.dispose(),this.lineShader.dispose(),this.mitreShader.dispose(),this.fillShader.dispose(),this.pickShader.dispose(),this.dashPattern.dispose()}},{"./lib/shaders":130,"gl-buffer":124,"gl-shader":203,"gl-texture2d":228,ndarray:433,"typedarray-pool":458}],132:[function(t,e,r){var n=t("gl-shader"),i="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position, nextPosition;\nattribute float arcLength, lineWidth;\nattribute vec4 color;\n\nuniform vec2 screenShape;\nuniform float pixelRatio;\nuniform mat4 model, view, projection;\n\nvarying vec4 fragColor;\nvarying vec3 worldPosition;\nvarying float pixelArcLength;\n\nvoid main() {\n  vec4 projected = projection * view * model * vec4(position, 1.0);\n  vec4 tangentClip = projection * view * model * vec4(nextPosition - position, 0.0);\n  vec2 tangent = normalize(screenShape * tangentClip.xy);\n  vec2 offset = 0.5 * pixelRatio * lineWidth * vec2(tangent.y, -tangent.x) / screenShape;\n\n  gl_Position = vec4(projected.xy + projected.w * offset, projected.zw);\n\n  worldPosition = position;\n  pixelArcLength = arcLength;\n  fragColor = color;\n}\n",o="precision mediump float;\n#define GLSLIFY 1\n\nuniform vec3      clipBounds[2];\nuniform sampler2D dashTexture;\nuniform float     dashScale;\nuniform float     opacity;\n\nvarying vec3    worldPosition;\nvarying float   pixelArcLength;\nvarying vec4    fragColor;\n\nvoid main() {\n  if(any(lessThan(worldPosition, clipBounds[0])) || any(greaterThan(worldPosition, clipBounds[1]))) {\n    discard;\n  }\n  float dashWeight = texture2D(dashTexture, vec2(dashScale * pixelArcLength, 0)).r;\n  if(dashWeight < 0.5) {\n    discard;\n  }\n  gl_FragColor = fragColor * opacity;\n}\n",a="precision mediump float;\n#define GLSLIFY 1\n\n#define FLOAT_MAX  1.70141184e38\n#define FLOAT_MIN  1.17549435e-38\n\nlowp vec4 encode_float_1_0(highp float v) {\n  highp float av = abs(v);\n\n  //Handle special cases\n  if(av < FLOAT_MIN) {\n    return vec4(0.0, 0.0, 0.0, 0.0);\n  } else if(v > FLOAT_MAX) {\n    return vec4(127.0, 128.0, 0.0, 0.0) / 255.0;\n  } else if(v < -FLOAT_MAX) {\n    return vec4(255.0, 128.0, 0.0, 0.0) / 255.0;\n  }\n\n  highp vec4 c = vec4(0,0,0,0);\n\n  //Compute exponent and mantissa\n  highp float e = floor(log2(av));\n  highp float m = av * pow(2.0, -e) - 1.0;\n  \n  //Unpack mantissa\n  c[1] = floor(128.0 * m);\n  m -= c[1] / 128.0;\n  c[2] = floor(32768.0 * m);\n  m -= c[2] / 32768.0;\n  c[3] = floor(8388608.0 * m);\n  \n  //Unpack exponent\n  highp float ebias = e + 127.0;\n  c[0] = floor(ebias / 2.0);\n  ebias -= c[0] * 2.0;\n  c[1] += floor(ebias) * 128.0; \n\n  //Unpack sign bit\n  c[0] += 128.0 * step(0.0, -v);\n\n  //Scale back to range\n  return c / 255.0;\n}\n\n\n\nuniform float pickId;\nuniform vec3 clipBounds[2];\n\nvarying vec3 worldPosition;\nvarying float pixelArcLength;\nvarying vec4 fragColor;\n\nvoid main() {\n  if(any(lessThan(worldPosition, clipBounds[0])) || any(greaterThan(worldPosition, clipBounds[1]))) {\n    discard;\n  }\n  gl_FragColor = vec4(pickId/255.0, encode_float_1_0(pixelArcLength).xyz);\n}",s=[{name:"position",type:"vec3"},{name:"nextPosition",type:"vec3"},{name:"arcLength",type:"float"},{name:"lineWidth",type:"float"},{name:"color",type:"vec4"}];r.createShader=function(t){return n(t,i,o,null,s)},r.createPickShader=function(t){return n(t,i,a,null,s)}},{"gl-shader":203}],133:[function(t,e,r){"use strict";function n(t,e){for(var r=0,n=0;3>n;++n){var i=t[n]-e[n];r+=i*i}return Math.sqrt(r)}function i(t){for(var e=[[-1e6,-1e6,-1e6],[1e6,1e6,1e6]],r=0;3>r;++r)e[0][r]=Math.max(t[0][r],e[0][r]),e[1][r]=Math.min(t[1][r],e[1][r]);return e}function o(t,e,r,n){this.arcLength=t,this.position=e,this.index=r,this.dataCoordinate=n}function a(t,e,r,n,i,o){this.gl=t,this.shader=e,this.pickShader=r,this.buffer=n,this.vao=i,this.clipBounds=[[-(1/0),-(1/0),-(1/0)],[1/0,1/0,1/0]],this.points=[],this.arcLength=[],this.vertexCount=0,this.bounds=[[0,0,0],[0,0,0]],this.pickId=0,this.lineWidth=1,this.texture=o,this.dashScale=1,this.opacity=1,this.dirty=!0,this.pixelRatio=1}function s(t){var e=t.gl||t.scene&&t.scene.gl,r=v(e);r.attributes.position.location=0,r.attributes.nextPosition.location=1,r.attributes.arcLength.location=2,r.attributes.lineWidth.location=3,r.attributes.color.location=4;var n=m(e);n.attributes.position.location=0,n.attributes.nextPosition.location=1,n.attributes.arcLength.location=2,n.attributes.lineWidth.location=3,n.attributes.color.location=4;for(var i=l(e),o=u(e,[{buffer:i,size:3,offset:0,stride:48},{buffer:i,size:3,offset:12,stride:48},{buffer:i,size:1,offset:24,stride:48},{buffer:i,size:1,offset:28,stride:48},{buffer:i,size:4,offset:32,stride:48}]),s=d(new Array(1024),[256,1,4]),h=0;1024>h;++h)s.data[h]=255;var f=c(e,s);f.wrap=e.REPEAT;var p=new a(e,r,n,i,o,f);return p.update(t),p}e.exports=s;var l=t("gl-buffer"),u=t("gl-vao"),c=t("gl-texture2d"),h=t("glsl-read-float"),f=t("binary-search-bounds"),d=t("ndarray"),p=t("./lib/shaders"),v=p.createShader,m=p.createPickShader,g=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],y=a.prototype;y.isTransparent=function(){return this.opacity<1},y.isOpaque=function(){return this.opacity>=1},y.pickSlots=1,y.setPickBase=function(t){this.pickId=t},y.drawTransparent=y.draw=function(t){var e=this.gl,r=this.shader,n=this.vao;r.bind(),r.uniforms={model:t.model||g,view:t.view||g,projection:t.projection||g,clipBounds:i(this.clipBounds),dashTexture:this.texture.bind(),dashScale:this.dashScale/this.arcLength[this.arcLength.length-1],opacity:this.opacity,screenShape:[e.drawingBufferWidth,e.drawingBufferHeight],pixelRatio:this.pixelRatio},n.bind(),n.draw(e.TRIANGLE_STRIP,this.vertexCount)},y.drawPick=function(t){var e=this.gl,r=this.pickShader,n=this.vao;r.bind(),r.uniforms={model:t.model||g,view:t.view||g,projection:t.projection||g,pickId:this.pickId,clipBounds:i(this.clipBounds),screenShape:[e.drawingBufferWidth,e.drawingBufferHeight],pixelRatio:this.pixelRatio},n.bind(),n.draw(e.TRIANGLE_STRIP,this.vertexCount)},y.update=function(t){var e,r;this.dirty=!0;var i=!!t.connectGaps;"dashScale"in t&&(this.dashScale=t.dashScale),"opacity"in t&&(this.opacity=+t.opacity);var o=t.position||t.positions;if(o){var a=t.color||t.colors||[0,0,0,1],s=t.lineWidth||1,l=[],u=[],c=[],h=0,p=0,v=[[1/0,1/0,1/0],[-(1/0),-(1/0),-(1/0)]],m=!1;t:for(e=1;e<o.length;++e){var g=o[e-1],y=o[e];for(u.push(h),c.push(g.slice()),r=0;3>r;++r){if(isNaN(g[r])||isNaN(y[r])||!isFinite(g[r])||!isFinite(y[r])){if(!i&&l.length>0){for(var b=0;24>b;++b)l.push(l[l.length-12]);p+=2,m=!0}continue t}v[0][r]=Math.min(v[0][r],g[r],y[r]),v[1][r]=Math.max(v[1][r],g[r],y[r])}var x,_;Array.isArray(a[0])?(x=a[e-1],_=a[e]):x=_=a,3===x.length&&(x=[x[0],x[1],x[2],1]),3===_.length&&(_=[_[0],_[1],_[2],1]);var w;w=Array.isArray(s)?s[e-1]:s;var M=h;if(h+=n(g,y),m){for(r=0;2>r;++r)l.push(g[0],g[1],g[2],y[0],y[1],y[2],M,w,x[0],x[1],x[2],x[3]);p+=2,m=!1}l.push(g[0],g[1],g[2],y[0],y[1],y[2],M,w,x[0],x[1],x[2],x[3],g[0],g[1],g[2],y[0],y[1],y[2],M,-w,x[0],x[1],x[2],x[3],y[0],y[1],y[2],g[0],g[1],g[2],h,-w,_[0],_[1],_[2],_[3],y[0],y[1],y[2],g[0],g[1],g[2],h,w,_[0],_[1],_[2],_[3]),p+=4}if(this.buffer.update(l),u.push(h),c.push(o[o.length-1].slice()),this.bounds=v,this.vertexCount=p,this.points=c,this.arcLength=u,"dashes"in t){var k=t.dashes,A=k.slice();for(A.unshift(0),e=1;e<A.length;++e)A[e]=A[e-1]+A[e];var T=d(new Array(1024),[256,1,4]);for(e=0;256>e;++e){for(r=0;4>r;++r)T.set(e,0,r,0);1&f.le(A,A[A.length-1]*e/255)?T.set(e,0,0,0):T.set(e,0,0,255)}this.texture.setPixels(T)}}},y.dispose=function(){this.shader.dispose(),this.vao.dispose(),this.buffer.dispose()},y.pick=function(t){if(!t)return null;if(t.id!==this.pickId)return null;var e=h(t.value[0],t.value[1],t.value[2],0),r=f.le(this.arcLength,e);if(0>r)return null;if(r===this.arcLength.length-1)return new o(this.arcLength[this.arcLength.length-1],this.points[this.points.length-1].slice(),r);for(var n=this.points[r],i=this.points[Math.min(r+1,this.points.length-1)],a=(e-this.arcLength[r])/(this.arcLength[r+1]-this.arcLength[r]),s=1-a,l=[0,0,0],u=0;3>u;++u)l[u]=s*n[u]+a*i[u];var c=Math.min(.5>a?r:r+1,this.points.length-1);return new o(e,l,c,this.points[c])}},{"./lib/shaders":132,"binary-search-bounds":134,"gl-buffer":124,"gl-texture2d":228,"gl-vao":232,"glsl-read-float":135,ndarray:433}],134:[function(t,e,r){arguments[4][22][0].apply(r,arguments)},{dup:22}],135:[function(t,e,r){function n(t,e,r,n){return i[0]=n,i[1]=r,i[2]=e,i[3]=t,o[0]}e.exports=n;var i=new Uint8Array(4),o=new Float32Array(i.buffer)},{}],136:[function(t,e,r){function n(t,e){var r=e[0],n=e[1],i=e[2],o=e[3],a=e[4],s=e[5],l=e[6],u=e[7],c=e[8],h=c*a-s*u,f=-c*o+s*l,d=u*o-a*l,p=r*h+n*f+i*d;return p?(p=1/p,t[0]=h*p,t[1]=(-c*n+i*u)*p,t[2]=(s*n-i*a)*p,t[3]=f*p,t[4]=(c*r-i*l)*p,t[5]=(-s*r+i*o)*p,t[6]=d*p,t[7]=(-u*r+n*l)*p,t[8]=(a*r-n*o)*p,t):null}e.exports=n},{}],137:[function(t,e,r){function n(t){var e=new Float32Array(16);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}e.exports=n},{}],138:[function(t,e,r){function n(){var t=new Float32Array(16);return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}e.exports=n},{}],139:[function(t,e,r){function n(t){var e=t[0],r=t[1],n=t[2],i=t[3],o=t[4],a=t[5],s=t[6],l=t[7],u=t[8],c=t[9],h=t[10],f=t[11],d=t[12],p=t[13],v=t[14],m=t[15],g=e*a-r*o,y=e*s-n*o,b=e*l-i*o,x=r*s-n*a,_=r*l-i*a,w=n*l-i*s,M=u*p-c*d,k=u*v-h*d,A=u*m-f*d,T=c*v-h*p,E=c*m-f*p,S=h*m-f*v;return g*S-y*E+b*T+x*A-_*k+w*M}e.exports=n},{}],140:[function(t,e,r){function n(t,e){var r=e[0],n=e[1],i=e[2],o=e[3],a=r+r,s=n+n,l=i+i,u=r*a,c=n*a,h=n*s,f=i*a,d=i*s,p=i*l,v=o*a,m=o*s,g=o*l;return t[0]=1-h-p,t[1]=c+g,t[2]=f-m,t[3]=0,t[4]=c-g,t[5]=1-u-p,t[6]=d+v,t[7]=0,t[8]=f+m,t[9]=d-v,t[10]=1-u-h,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}e.exports=n},{}],141:[function(t,e,r){function n(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3],s=n+n,l=i+i,u=o+o,c=n*s,h=n*l,f=n*u,d=i*l,p=i*u,v=o*u,m=a*s,g=a*l,y=a*u;return t[0]=1-(d+v),t[1]=h+y,t[2]=f-g,t[3]=0,t[4]=h-y,t[5]=1-(c+v),t[6]=p+m,t[7]=0,t[8]=f+g,t[9]=p-m,t[10]=1-(c+d),t[11]=0,t[12]=r[0],t[13]=r[1],t[14]=r[2],t[15]=1,t}e.exports=n},{}],142:[function(t,e,r){function n(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}e.exports=n},{}],143:[function(t,e,r){function n(t,e){var r=e[0],n=e[1],i=e[2],o=e[3],a=e[4],s=e[5],l=e[6],u=e[7],c=e[8],h=e[9],f=e[10],d=e[11],p=e[12],v=e[13],m=e[14],g=e[15],y=r*s-n*a,b=r*l-i*a,x=r*u-o*a,_=n*l-i*s,w=n*u-o*s,M=i*u-o*l,k=c*v-h*p,A=c*m-f*p,T=c*g-d*p,E=h*m-f*v,S=h*g-d*v,L=f*g-d*m,z=y*L-b*S+x*E+_*T-w*A+M*k;return z?(z=1/z,t[0]=(s*L-l*S+u*E)*z,t[1]=(i*S-n*L-o*E)*z,t[2]=(v*M-m*w+g*_)*z,t[3]=(f*w-h*M-d*_)*z,t[4]=(l*T-a*L-u*A)*z,t[5]=(r*L-i*T+o*A)*z,t[6]=(m*x-p*M-g*b)*z,t[7]=(c*M-f*x+d*b)*z,t[8]=(a*S-s*T+u*k)*z,t[9]=(n*T-r*S-o*k)*z,t[10]=(p*w-v*x+g*y)*z,t[11]=(h*x-c*w-d*y)*z,t[12]=(s*A-a*E-l*k)*z,t[13]=(r*E-n*A+i*k)*z,t[14]=(v*b-p*_-m*y)*z,t[15]=(c*_-h*b+f*y)*z,t):null}e.exports=n},{}],144:[function(t,e,r){function n(t,e,r,n){var o,a,s,l,u,c,h,f,d,p,v=e[0],m=e[1],g=e[2],y=n[0],b=n[1],x=n[2],_=r[0],w=r[1],M=r[2];return Math.abs(v-_)<1e-6&&Math.abs(m-w)<1e-6&&Math.abs(g-M)<1e-6?i(t):(h=v-_,f=m-w,d=g-M,p=1/Math.sqrt(h*h+f*f+d*d),h*=p,f*=p,d*=p,o=b*d-x*f,a=x*h-y*d,s=y*f-b*h,p=Math.sqrt(o*o+a*a+s*s),p?(p=1/p,o*=p,a*=p,s*=p):(o=0,a=0,s=0),l=f*s-d*a,u=d*o-h*s,c=h*a-f*o,p=Math.sqrt(l*l+u*u+c*c),p?(p=1/p,l*=p,u*=p,c*=p):(l=0,u=0,c=0),t[0]=o,t[1]=l,t[2]=h,t[3]=0,t[4]=a,t[5]=u,t[6]=f,t[7]=0,t[8]=s,t[9]=c,t[10]=d,t[11]=0,t[12]=-(o*v+a*m+s*g),t[13]=-(l*v+u*m+c*g),t[14]=-(h*v+f*m+d*g),t[15]=1,t)}var i=t("./identity");e.exports=n},{"./identity":142}],145:[function(t,e,r){function n(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3],s=e[4],l=e[5],u=e[6],c=e[7],h=e[8],f=e[9],d=e[10],p=e[11],v=e[12],m=e[13],g=e[14],y=e[15],b=r[0],x=r[1],_=r[2],w=r[3];return t[0]=b*n+x*s+_*h+w*v,t[1]=b*i+x*l+_*f+w*m,t[2]=b*o+x*u+_*d+w*g,t[3]=b*a+x*c+_*p+w*y,b=r[4],x=r[5],_=r[6],w=r[7],t[4]=b*n+x*s+_*h+w*v,t[5]=b*i+x*l+_*f+w*m,t[6]=b*o+x*u+_*d+w*g,t[7]=b*a+x*c+_*p+w*y,b=r[8],x=r[9],_=r[10],w=r[11],t[8]=b*n+x*s+_*h+w*v,t[9]=b*i+x*l+_*f+w*m,t[10]=b*o+x*u+_*d+w*g,t[11]=b*a+x*c+_*p+w*y,b=r[12],x=r[13],_=r[14],w=r[15],t[12]=b*n+x*s+_*h+w*v,t[13]=b*i+x*l+_*f+w*m,t[14]=b*o+x*u+_*d+w*g,t[15]=b*a+x*c+_*p+w*y,t}e.exports=n},{}],146:[function(t,e,r){function n(t,e,r,n,i){var o=1/Math.tan(e/2),a=1/(n-i);return t[0]=o/r,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=o,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=(i+n)*a,t[11]=-1,t[12]=0,t[13]=0,t[14]=2*i*n*a,t[15]=0,t}e.exports=n},{}],147:[function(t,e,r){function n(t,e,r,n){var i,o,a,s,l,u,c,h,f,d,p,v,m,g,y,b,x,_,w,M,k,A,T,E,S=n[0],L=n[1],z=n[2],I=Math.sqrt(S*S+L*L+z*z);return Math.abs(I)<1e-6?null:(I=1/I,S*=I,L*=I,z*=I,i=Math.sin(r),o=Math.cos(r),a=1-o,s=e[0],l=e[1],u=e[2],c=e[3],h=e[4],f=e[5],d=e[6],p=e[7],v=e[8],m=e[9],g=e[10],y=e[11],b=S*S*a+o,x=L*S*a+z*i,_=z*S*a-L*i,w=S*L*a-z*i,M=L*L*a+o,k=z*L*a+S*i,A=S*z*a+L*i,T=L*z*a-S*i,E=z*z*a+o,t[0]=s*b+h*x+v*_,t[1]=l*b+f*x+m*_,t[2]=u*b+d*x+g*_,t[3]=c*b+p*x+y*_,t[4]=s*w+h*M+v*k,t[5]=l*w+f*M+m*k,t[6]=u*w+d*M+g*k,t[7]=c*w+p*M+y*k,t[8]=s*A+h*T+v*E,t[9]=l*A+f*T+m*E,t[10]=u*A+d*T+g*E,t[11]=c*A+p*T+y*E,e!==t&&(t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t)}e.exports=n},{}],148:[function(t,e,r){function n(t,e,r){var n=Math.sin(r),i=Math.cos(r),o=e[4],a=e[5],s=e[6],l=e[7],u=e[8],c=e[9],h=e[10],f=e[11];return e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=o*i+u*n,t[5]=a*i+c*n,t[6]=s*i+h*n,t[7]=l*i+f*n,t[8]=u*i-o*n,t[9]=c*i-a*n,t[10]=h*i-s*n,t[11]=f*i-l*n,t}e.exports=n},{}],149:[function(t,e,r){function n(t,e,r){var n=Math.sin(r),i=Math.cos(r),o=e[0],a=e[1],s=e[2],l=e[3],u=e[8],c=e[9],h=e[10],f=e[11];return e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=o*i-u*n,t[1]=a*i-c*n,t[2]=s*i-h*n,t[3]=l*i-f*n,t[8]=o*n+u*i,t[9]=a*n+c*i,t[10]=s*n+h*i,t[11]=l*n+f*i,t}e.exports=n},{}],150:[function(t,e,r){function n(t,e,r){var n=Math.sin(r),i=Math.cos(r),o=e[0],a=e[1],s=e[2],l=e[3],u=e[4],c=e[5],h=e[6],f=e[7];return e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=o*i+u*n,t[1]=a*i+c*n,t[2]=s*i+h*n,t[3]=l*i+f*n,t[4]=u*i-o*n,t[5]=c*i-a*n,t[6]=h*i-s*n,t[7]=f*i-l*n,t}e.exports=n},{}],151:[function(t,e,r){function n(t,e,r){var n=r[0],i=r[1],o=r[2];return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*i,t[5]=e[5]*i,t[6]=e[6]*i,t[7]=e[7]*i,t[8]=e[8]*o,t[9]=e[9]*o,t[10]=e[10]*o,t[11]=e[11]*o,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}e.exports=n},{}],152:[function(t,e,r){function n(t,e,r){var n,i,o,a,s,l,u,c,h,f,d,p,v=r[0],m=r[1],g=r[2];return e===t?(t[12]=e[0]*v+e[4]*m+e[8]*g+e[12],t[13]=e[1]*v+e[5]*m+e[9]*g+e[13],t[14]=e[2]*v+e[6]*m+e[10]*g+e[14],t[15]=e[3]*v+e[7]*m+e[11]*g+e[15]):(n=e[0],i=e[1],o=e[2],a=e[3],s=e[4],l=e[5],u=e[6],c=e[7],h=e[8],f=e[9],d=e[10],p=e[11],t[0]=n,t[1]=i,t[2]=o,t[3]=a,t[4]=s,t[5]=l,t[6]=u,t[7]=c,t[8]=h,t[9]=f,t[10]=d,t[11]=p,t[12]=n*v+s*m+h*g+e[12],t[13]=i*v+l*m+f*g+e[13],t[14]=o*v+u*m+d*g+e[14],t[15]=a*v+c*m+p*g+e[15]),t}e.exports=n},{}],153:[function(t,e,r){function n(t,e){if(t===e){var r=e[1],n=e[2],i=e[3],o=e[6],a=e[7],s=e[11];t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=r,t[6]=e[9],t[7]=e[13],t[8]=n,t[9]=o,t[11]=e[14],t[12]=i,t[13]=a,t[14]=s}else t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=e[1],t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=e[14],t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15];return t}e.exports=n},{}],154:[function(t,e,r){"use strict";function n(t,e){for(var r=[0,0,0,0],n=0;4>n;++n)for(var i=0;4>i;++i)r[i]+=t[4*n+i]*e[n];return r}function i(t,e,r,i,o){for(var a=n(i,n(r,n(e,[t[0],t[1],t[2],1]))),s=0;3>s;++s)a[s]/=a[3];return[.5*o[0]*(1+a[0]),.5*o[1]*(1-a[1])]}function o(t,e){if(2===t.length){for(var r=0,n=0,i=0;2>i;++i)r+=Math.pow(e[i]-t[0][i],2),n+=Math.pow(e[i]-t[1][i],2);return r=Math.sqrt(r),n=Math.sqrt(n),1e-6>r+n?[1,0]:[n/(r+n),r/(n+r)]}if(3===t.length){var o=[0,0];return u(t[0],t[1],t[2],e,o),l(t,o)}return[]}function a(t,e){for(var r=[0,0,0],n=0;n<t.length;++n)for(var i=t[n],o=e[n],a=0;3>a;++a)r[a]+=o*i[a];return r}function s(t,e,r,n,s,l){if(1===t.length)return[0,t[0].slice()];for(var u=new Array(t.length),c=0;c<t.length;++c)u[c]=i(t[c],r,n,s,l);for(var h=0,f=1/0,c=0;c<u.length;++c){for(var d=0,p=0;2>p;++p)d+=Math.pow(u[c][p]-e[p],2);f>d&&(f=d,h=c)}for(var v=o(u,e),m=0,c=0;3>c;++c){if(v[c]<-.001||v[c]>1.0001)return null;m+=v[c]}return Math.abs(m-1)>.001?null:[h,a(t,v),v]}var l=t("barycentric"),u=t("polytope-closest-point/lib/closest_point_2d.js");e.exports=s},{barycentric:157,"polytope-closest-point/lib/closest_point_2d.js":159}],155:[function(t,e,r){var n="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position, normal;\nattribute vec4 color;\nattribute vec2 uv;\n\nuniform mat4 model\n           , view\n           , projection;\nuniform vec3 eyePosition\n           , lightPosition;\n\nvarying vec3 f_normal\n           , f_lightDirection\n           , f_eyeDirection\n           , f_data;\nvarying vec4 f_color;\nvarying vec2 f_uv;\n\nvoid main() {\n  vec4 m_position  = model * vec4(position, 1.0);\n  vec4 t_position  = view * m_position;\n  gl_Position      = projection * t_position;\n  f_color          = color;\n  f_normal         = normal;\n  f_data           = position;\n  f_eyeDirection   = eyePosition   - position;\n  f_lightDirection = lightPosition - position;\n  f_uv             = uv;\n}",i="precision mediump float;\n#define GLSLIFY 1\n\nfloat beckmannDistribution_2_0(float x, float roughness) {\n  float NdotH = max(x, 0.0001);\n  float cos2Alpha = NdotH * NdotH;\n  float tan2Alpha = (cos2Alpha - 1.0) / cos2Alpha;\n  float roughness2 = roughness * roughness;\n  float denom = 3.141592653589793 * roughness2 * cos2Alpha * cos2Alpha;\n  return exp(tan2Alpha / roughness2) / denom;\n}\n\n\n\nfloat cookTorranceSpecular_1_1(\n  vec3 lightDirection,\n  vec3 viewDirection,\n  vec3 surfaceNormal,\n  float roughness,\n  float fresnel) {\n\n  float VdotN = max(dot(viewDirection, surfaceNormal), 0.0);\n  float LdotN = max(dot(lightDirection, surfaceNormal), 0.0);\n\n  //Half angle vector\n  vec3 H = normalize(lightDirection + viewDirection);\n\n  //Geometric term\n  float NdotH = max(dot(surfaceNormal, H), 0.0);\n  float VdotH = max(dot(viewDirection, H), 0.000001);\n  float LdotH = max(dot(lightDirection, H), 0.000001);\n  float G1 = (2.0 * NdotH * VdotN) / VdotH;\n  float G2 = (2.0 * NdotH * LdotN) / LdotH;\n  float G = min(1.0, min(G1, G2));\n  \n  //Distribution term\n  float D = beckmannDistribution_2_0(NdotH, roughness);\n\n  //Fresnel term\n  float F = pow(1.0 - VdotN, fresnel);\n\n  //Multiply terms and done\n  return  G * F * D / max(3.14159265 * VdotN, 0.000001);\n}\n\n\n\nuniform vec3 clipBounds[2];\nuniform float roughness\n            , fresnel\n            , kambient\n            , kdiffuse\n            , kspecular\n            , opacity;\nuniform sampler2D texture;\n\nvarying vec3 f_normal\n           , f_lightDirection\n           , f_eyeDirection\n           , f_data;\nvarying vec4 f_color;\nvarying vec2 f_uv;\n\nvoid main() {\n  if(any(lessThan(f_data, clipBounds[0])) || \n     any(greaterThan(f_data, clipBounds[1]))) {\n    discard;\n  }\n\n  vec3 N = normalize(f_normal);\n  vec3 L = normalize(f_lightDirection);\n  vec3 V = normalize(f_eyeDirection);\n  \n  if(!gl_FrontFacing) {\n    N = -N;\n  }\n\n  float specular = cookTorranceSpecular_1_1(L, V, N, roughness, fresnel);\n  float diffuse  = min(kambient + kdiffuse * max(dot(N, L), 0.0), 1.0);\n\n  vec4 surfaceColor = f_color * texture2D(texture, f_uv);\n  vec4 litColor = surfaceColor.a * vec4(diffuse * surfaceColor.rgb + kspecular * vec3(1,1,1) * specular,  1.0);\n\n  gl_FragColor = litColor * opacity;\n}",o="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position;\nattribute vec4 color;\nattribute vec2 uv;\n\nuniform mat4 model, view, projection;\n\nvarying vec4 f_color;\nvarying vec3 f_data;\nvarying vec2 f_uv;\n\nvoid main() {\n  gl_Position = projection * view * model * vec4(position, 1.0);\n  f_color = color;\n  f_data  = position;\n  f_uv    = uv;\n}",a="precision mediump float;\n#define GLSLIFY 1\n\nuniform vec3 clipBounds[2];\nuniform sampler2D texture;\nuniform float opacity;\n\nvarying vec4 f_color;\nvarying vec3 f_data;\nvarying vec2 f_uv;\n\nvoid main() {\n  if(any(lessThan(f_data, clipBounds[0])) || \n     any(greaterThan(f_data, clipBounds[1]))) {\n    discard;\n  }\n\n  gl_FragColor = f_color * texture2D(texture, f_uv) * opacity;\n}",s="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position;\nattribute vec4 color;\nattribute vec2 uv;\nattribute float pointSize;\n\nuniform mat4 model, view, projection;\nuniform vec3 clipBounds[2];\n\nvarying vec4 f_color;\nvarying vec2 f_uv;\n\nvoid main() {\n  if(any(lessThan(position, clipBounds[0])) || \n     any(greaterThan(position, clipBounds[1]))) {\n    gl_Position = vec4(0,0,0,0);\n  } else {\n    gl_Position = projection * view * model * vec4(position, 1.0);\n  }\n  gl_PointSize = pointSize;\n  f_color = color;\n  f_uv = uv;\n}",l="precision mediump float;\n#define GLSLIFY 1\n\nuniform sampler2D texture;\nuniform float opacity;\n\nvarying vec4 f_color;\nvarying vec2 f_uv;\n\nvoid main() {\n  vec2 pointR = gl_PointCoord.xy - vec2(0.5,0.5);\n  if(dot(pointR, pointR) > 0.25) {\n    discard;\n  }\n  gl_FragColor = f_color * texture2D(texture, f_uv) * opacity;\n}",u="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position;\nattribute vec4 id;\n\nuniform mat4 model, view, projection;\n\nvarying vec3 f_position;\nvarying vec4 f_id;\n\nvoid main() {\n  gl_Position = projection * view * model * vec4(position, 1.0);\n  f_id        = id;\n  f_position  = position;\n}",c="precision mediump float;\n#define GLSLIFY 1\n\nuniform vec3  clipBounds[2];\nuniform float pickId;\n\nvarying vec3 f_position;\nvarying vec4 f_id;\n\nvoid main() {\n  if(any(lessThan(f_position, clipBounds[0])) || \n     any(greaterThan(f_position, clipBounds[1]))) {\n    discard;\n  }\n  gl_FragColor = vec4(pickId, f_id.xyz);\n}",h="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3  position;\nattribute float pointSize;\nattribute vec4  id;\n\nuniform mat4 model, view, projection;\nuniform vec3 clipBounds[2];\n\nvarying vec3 f_position;\nvarying vec4 f_id;\n\nvoid main() {\n  if(any(lessThan(position, clipBounds[0])) || \n     any(greaterThan(position, clipBounds[1]))) {\n    gl_Position = vec4(0,0,0,0);\n  } else {\n    gl_Position  = projection * view * model * vec4(position, 1.0);\n    gl_PointSize = pointSize;\n  }\n  f_id         = id;\n  f_position   = position;\n}",f="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position;\n\nuniform mat4 model, view, projection;\n\nvoid main() {\n  gl_Position = projection * view * model * vec4(position, 1.0);\n}",d="precision mediump float;\n#define GLSLIFY 1\n\nuniform vec3 contourColor;\n\nvoid main() {\n  gl_FragColor = vec4(contourColor,1);\n}\n";r.meshShader={vertex:n,fragment:i,attributes:[{name:"position",type:"vec3"},{name:"normal",type:"vec3"},{name:"color",type:"vec4"},{name:"uv",type:"vec2"}]},r.wireShader={vertex:o,fragment:a,attributes:[{name:"position",type:"vec3"},{name:"color",type:"vec4"},{name:"uv",type:"vec2"}]},r.pointShader={vertex:s,fragment:l,attributes:[{name:"position",type:"vec3"},{name:"color",type:"vec4"},{name:"uv",type:"vec2"},{name:"pointSize",type:"float"}]},r.pickShader={vertex:u,fragment:c,attributes:[{name:"position",type:"vec3"},{name:"id",type:"vec4"}]},r.pointPickShader={vertex:h,fragment:c,attributes:[{name:"position",type:"vec3"},{name:"pointSize",type:"float"},{name:"id",type:"vec4"}]},r.contourShader={vertex:f,fragment:d,attributes:[{name:"position",type:"vec3"}]}},{}],156:[function(t,e,r){"use strict";function n(t,e,r,n,i,o,a,s,l,u,c,h,f,d,p,v,m,g,y,b,x,_,w,M,k,A,T){this.gl=t,this.cells=[],this.positions=[],this.intensity=[],this.texture=e,this.dirty=!0,this.triShader=r,this.lineShader=n,this.pointShader=i,this.pickShader=o,this.pointPickShader=a,this.contourShader=s,this.trianglePositions=l,this.triangleColors=c,this.triangleNormals=f,this.triangleUVs=h,this.triangleIds=u,this.triangleVAO=d,this.triangleCount=0,this.lineWidth=1,this.edgePositions=p,this.edgeColors=m,this.edgeUVs=g,this.edgeIds=v,this.edgeVAO=y,this.edgeCount=0,this.pointPositions=b,this.pointColors=_,this.pointUVs=w,this.pointSizes=M,this.pointIds=x,this.pointVAO=k,this.pointCount=0,this.contourLineWidth=1,this.contourPositions=A,this.contourVAO=T,this.contourCount=0,this.contourColor=[0,0,0],this.contourEnable=!0,this.pickId=1,this.bounds=[[1/0,1/0,1/0],[-(1/0),-(1/0),-(1/0)]],this.clipBounds=[[-(1/0),-(1/0),-(1/0)],[1/0,1/0,1/0]],this.lightPosition=[1e5,1e5,0],this.ambientLight=.8,this.diffuseLight=.8,this.specularLight=2,this.roughness=.5,this.fresnel=1.5,this.opacity=1,this._model=D,this._view=D,this._projection=D,this._resolution=[1,1]}function i(t){for(var e=k({colormap:t,nshades:256,format:"rgba"}),r=new Uint8Array(1024),n=0;256>n;++n){for(var i=e[n],o=0;3>o;++o)r[4*n+o]=i[o];r[4*n+3]=255*i[3]}return M(r,[256,256,4],[4,0,1])}function o(t,e,r){for(var n=new Array(e),i=0;e>i;++i)n[i]=0;for(var o=t.length,i=0;o>i;++i)for(var a=t[i],s=0;s<a.length;++s)n[a[s]]=r[i];return n}function a(t){for(var e=t.length,r=new Array(e),n=0;e>n;++n)r[n]=t[n][2];return r}function s(t){var e=m(t,L);return e.attributes.position.location=0,e.attributes.color.location=2,e.attributes.uv.location=3,e.attributes.normal.location=4,e}function l(t){var e=m(t,z);return e.attributes.position.location=0,e.attributes.color.location=2,e.attributes.uv.location=3,e}function u(t){var e=m(t,I);return e.attributes.position.location=0,e.attributes.color.location=2,e.attributes.uv.location=3,e.attributes.pointSize.location=4,e}function c(t){var e=m(t,P);return e.attributes.position.location=0,e.attributes.id.location=1,e}function h(t){var e=m(t,C);return e.attributes.position.location=0,e.attributes.id.location=1,e.attributes.pointSize.location=4,e}function f(t){var e=m(t,R);return e.attributes.position.location=0,e}function d(t){var e=t.gl,r=s(e),i=l(e),o=u(e),a=c(e),d=h(e),p=f(e),v=b(e,M(new Uint8Array([255,255,255,255]),[1,1,4]));v.generateMipmap(),v.minFilter=e.LINEAR_MIPMAP_LINEAR,v.magFilter=e.LINEAR;var m=g(e),x=g(e),_=g(e),w=g(e),k=g(e),A=y(e,[{buffer:m,type:e.FLOAT,size:3},{buffer:k,type:e.UNSIGNED_BYTE,size:4,normalized:!0},{buffer:x,type:e.FLOAT,size:4},{buffer:_,type:e.FLOAT,size:2},{buffer:w,type:e.FLOAT,size:3}]),T=g(e),E=g(e),S=g(e),L=g(e),z=y(e,[{buffer:T,type:e.FLOAT,size:3},{buffer:L,type:e.UNSIGNED_BYTE,
size:4,normalized:!0},{buffer:E,type:e.FLOAT,size:4},{buffer:S,type:e.FLOAT,size:2}]),I=g(e),P=g(e),C=g(e),R=g(e),D=g(e),O=y(e,[{buffer:I,type:e.FLOAT,size:3},{buffer:D,type:e.UNSIGNED_BYTE,size:4,normalized:!0},{buffer:P,type:e.FLOAT,size:4},{buffer:C,type:e.FLOAT,size:2},{buffer:R,type:e.FLOAT,size:1}]),F=g(e),j=y(e,[{buffer:F,type:e.FLOAT,size:3}]),N=new n(e,v,r,i,o,a,d,p,m,k,x,_,w,A,T,L,E,S,z,I,D,P,C,R,O,F,j);return N.update(t),N}var p=1e-6,v=1e-6,m=t("gl-shader"),g=t("gl-buffer"),y=t("gl-vao"),b=t("gl-texture2d"),x=t("normals"),_=t("gl-mat4/multiply"),w=t("gl-mat4/invert"),M=t("ndarray"),k=t("colormap"),A=t("simplicial-complex-contour"),T=t("typedarray-pool"),E=t("./lib/shaders"),S=t("./lib/closest-point"),L=E.meshShader,z=E.wireShader,I=E.pointShader,P=E.pickShader,C=E.pointPickShader,R=E.contourShader,D=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],O=n.prototype;O.isOpaque=function(){return this.opacity>=1},O.isTransparent=function(){return this.opacity<1},O.pickSlots=1,O.setPickBase=function(t){this.pickId=t},O.highlight=function(t){if(!t||!this.contourEnable)return void(this.contourCount=0);for(var e=A(this.cells,this.intensity,t.intensity),r=e.cells,n=e.vertexIds,i=e.vertexWeights,o=r.length,a=T.mallocFloat32(6*o),s=0,l=0;o>l;++l)for(var u=r[l],c=0;2>c;++c){var h=u[0];2===u.length&&(h=u[c]);for(var f=n[h][0],d=n[h][1],p=i[h],v=1-p,m=this.positions[f],g=this.positions[d],y=0;3>y;++y)a[s++]=p*m[y]+v*g[y]}this.contourCount=s/3|0,this.contourPositions.update(a.subarray(0,s)),T.free(a)},O.update=function(t){t=t||{};var e=this.gl;this.dirty=!0,"contourEnable"in t&&(this.contourEnable=t.contourEnable),"contourColor"in t&&(this.contourColor=t.contourColor),"lineWidth"in t&&(this.lineWidth=t.lineWidth),"lightPosition"in t&&(this.lightPosition=t.lightPosition),"opacity"in t&&(this.opacity=t.opacity),"ambient"in t&&(this.ambientLight=t.ambient),"diffuse"in t&&(this.diffuseLight=t.diffuse),"specular"in t&&(this.specularLight=t.specular),"roughness"in t&&(this.roughness=t.roughness),"fresnel"in t&&(this.fresnel=t.fresnel),t.texture?(this.texture.dispose(),this.texture=b(e,t.texture)):t.colormap&&(this.texture.shape=[256,256],this.texture.minFilter=e.LINEAR_MIPMAP_LINEAR,this.texture.magFilter=e.LINEAR,this.texture.setPixels(i(t.colormap)),this.texture.generateMipmap());var r=t.cells,n=t.positions;if(n&&r){var s=[],l=[],u=[],c=[],h=[],f=[],d=[],m=[],g=[],y=[],_=[],w=[],M=[],k=[];this.cells=r,this.positions=n;var A=t.vertexNormals,T=t.cellNormals,E=void 0===t.vertexNormalsEpsilon?p:t.vertexNormalsEpsilon,S=void 0===t.faceNormalsEpsilon?v:t.faceNormalsEpsilon;t.useFacetNormals&&!T&&(T=x.faceNormals(r,n,S)),T||A||(A=x.vertexNormals(r,n,E));var L=t.vertexColors,z=t.cellColors,I=t.meshColor||[1,1,1,1],P=t.vertexUVs,C=t.vertexIntensity,R=t.cellUVs,D=t.cellIntensity,O=1/0,F=-(1/0);if(!P&&!R)if(C)for(var j=0;j<C.length;++j){var N=C[j];O=Math.min(O,N),F=Math.max(F,N)}else if(D)for(var j=0;j<D.length;++j){var N=D[j];O=Math.min(O,N),F=Math.max(F,N)}else for(var j=0;j<n.length;++j){var N=n[j][2];O=Math.min(O,N),F=Math.max(F,N)}C?this.intensity=C:D?this.intensity=o(r,n.length,D):this.intensity=a(n);var B=t.pointSizes,U=t.pointSize||1;this.bounds=[[1/0,1/0,1/0],[-(1/0),-(1/0),-(1/0)]];for(var j=0;j<n.length;++j)for(var V=n[j],q=0;3>q;++q)!isNaN(V[q])&&isFinite(V[q])&&(this.bounds[0][q]=Math.min(this.bounds[0][q],V[q]),this.bounds[1][q]=Math.max(this.bounds[1][q],V[q]));var G=0,H=0,X=0;t:for(var j=0;j<r.length;++j){var Y=r[j];switch(Y.length){case 1:for(var W=Y[0],V=n[W],q=0;3>q;++q)if(isNaN(V[q])||!isFinite(V[q]))continue t;y.push(V[0],V[1],V[2]);var Z;Z=L?L[W]:z?z[j]:I,3===Z.length?_.push(Z[0],Z[1],Z[2],1):_.push(Z[0],Z[1],Z[2],Z[3]);var K;K=P?P[W]:C?[(C[W]-O)/(F-O),0]:R?R[j]:D?[(D[j]-O)/(F-O),0]:[(V[2]-O)/(F-O),0],w.push(K[0],K[1]),B?M.push(B[W]):M.push(U),k.push(j),X+=1;break;case 2:for(var q=0;2>q;++q)for(var W=Y[q],V=n[W],J=0;3>J;++J)if(isNaN(V[J])||!isFinite(V[J]))continue t;for(var q=0;2>q;++q){var W=Y[q],V=n[W];f.push(V[0],V[1],V[2]);var Z;Z=L?L[W]:z?z[j]:I,3===Z.length?d.push(Z[0],Z[1],Z[2],1):d.push(Z[0],Z[1],Z[2],Z[3]);var K;K=P?P[W]:C?[(C[W]-O)/(F-O),0]:R?R[j]:D?[(D[j]-O)/(F-O),0]:[(V[2]-O)/(F-O),0],m.push(K[0],K[1]),g.push(j)}H+=1;break;case 3:for(var q=0;3>q;++q)for(var W=Y[q],V=n[W],J=0;3>J;++J)if(isNaN(V[J])||!isFinite(V[J]))continue t;for(var q=0;3>q;++q){var W=Y[q],V=n[W];s.push(V[0],V[1],V[2]);var Z;Z=L?L[W]:z?z[j]:I,3===Z.length?l.push(Z[0],Z[1],Z[2],1):l.push(Z[0],Z[1],Z[2],Z[3]);var K;K=P?P[W]:C?[(C[W]-O)/(F-O),0]:R?R[j]:D?[(D[j]-O)/(F-O),0]:[(V[2]-O)/(F-O),0],c.push(K[0],K[1]);var $;$=A?A[W]:T[j],u.push($[0],$[1],$[2]),h.push(j)}G+=1}}this.pointCount=X,this.edgeCount=H,this.triangleCount=G,this.pointPositions.update(y),this.pointColors.update(_),this.pointUVs.update(w),this.pointSizes.update(M),this.pointIds.update(new Uint32Array(k)),this.edgePositions.update(f),this.edgeColors.update(d),this.edgeUVs.update(m),this.edgeIds.update(new Uint32Array(g)),this.trianglePositions.update(s),this.triangleColors.update(l),this.triangleUVs.update(c),this.triangleNormals.update(u),this.triangleIds.update(new Uint32Array(h))}},O.drawTransparent=O.draw=function(t){t=t||{};for(var e=this.gl,r=t.model||D,n=t.view||D,i=t.projection||D,o=[[-1e6,-1e6,-1e6],[1e6,1e6,1e6]],a=0;3>a;++a)o[0][a]=Math.max(o[0][a],this.clipBounds[0][a]),o[1][a]=Math.min(o[1][a],this.clipBounds[1][a]);var s={model:r,view:n,projection:i,clipBounds:o,kambient:this.ambientLight,kdiffuse:this.diffuseLight,kspecular:this.specularLight,roughness:this.roughness,fresnel:this.fresnel,eyePosition:[0,0,0],lightPosition:[0,0,0],opacity:this.opacity,contourColor:this.contourColor,texture:0};this.texture.bind(0);var l=new Array(16);_(l,s.view,s.model),_(l,s.projection,l),w(l,l);for(var a=0;3>a;++a)s.eyePosition[a]=l[12+a]/l[15];for(var u=l[15],a=0;3>a;++a)u+=this.lightPosition[a]*l[4*a+3];for(var a=0;3>a;++a){for(var c=l[12+a],h=0;3>h;++h)c+=l[4*h+a]*this.lightPosition[h];s.lightPosition[a]=c/u}if(this.triangleCount>0){var f=this.triShader;f.bind(),f.uniforms=s,this.triangleVAO.bind(),e.drawArrays(e.TRIANGLES,0,3*this.triangleCount),this.triangleVAO.unbind()}if(this.edgeCount>0&&this.lineWidth>0){var f=this.lineShader;f.bind(),f.uniforms=s,this.edgeVAO.bind(),e.lineWidth(this.lineWidth),e.drawArrays(e.LINES,0,2*this.edgeCount),this.edgeVAO.unbind()}if(this.pointCount>0){var f=this.pointShader;f.bind(),f.uniforms=s,this.pointVAO.bind(),e.drawArrays(e.POINTS,0,this.pointCount),this.pointVAO.unbind()}if(this.contourEnable&&this.contourCount>0&&this.contourLineWidth>0){var f=this.contourShader;f.bind(),f.uniforms=s,this.contourVAO.bind(),e.drawArrays(e.LINES,0,this.contourCount),this.contourVAO.unbind()}},O.drawPick=function(t){t=t||{};for(var e=this.gl,r=t.model||D,n=t.view||D,i=t.projection||D,o=[[-1e6,-1e6,-1e6],[1e6,1e6,1e6]],a=0;3>a;++a)o[0][a]=Math.max(o[0][a],this.clipBounds[0][a]),o[1][a]=Math.min(o[1][a],this.clipBounds[1][a]);this._model=[].slice.call(r),this._view=[].slice.call(n),this._projection=[].slice.call(i),this._resolution=[e.drawingBufferWidth,e.drawingBufferHeight];var s={model:r,view:n,projection:i,clipBounds:o,pickId:this.pickId/255},l=this.pickShader;if(l.bind(),l.uniforms=s,this.triangleCount>0&&(this.triangleVAO.bind(),e.drawArrays(e.TRIANGLES,0,3*this.triangleCount),this.triangleVAO.unbind()),this.edgeCount>0&&(this.edgeVAO.bind(),e.lineWidth(this.lineWidth),e.drawArrays(e.LINES,0,2*this.edgeCount),this.edgeVAO.unbind()),this.pointCount>0){var l=this.pointPickShader;l.bind(),l.uniforms=s,this.pointVAO.bind(),e.drawArrays(e.POINTS,0,this.pointCount),this.pointVAO.unbind()}},O.pick=function(t){if(!t)return null;if(t.id!==this.pickId)return null;for(var e=t.value[0]+256*t.value[1]+65536*t.value[2],r=this.cells[e],n=this.positions,i=new Array(r.length),o=0;o<r.length;++o)i[o]=n[r[o]];var a=S(i,[t.coord[0],this._resolution[1]-t.coord[1]],this._model,this._view,this._projection,this._resolution);if(!a)return null;for(var s=a[2],l=0,o=0;o<r.length;++o)l+=s[o]*this.intensity[r[o]];return{position:a[1],index:r[a[0]],cell:r,cellId:e,intensity:l,dataCoordinate:this.positions[r[a[0]]]}},O.dispose=function(){this.texture.dispose(),this.triShader.dispose(),this.lineShader.dispose(),this.pointShader.dispose(),this.pickShader.dispose(),this.pointPickShader.dispose(),this.triangleVAO.dispose(),this.trianglePositions.dispose(),this.triangleColors.dispose(),this.triangleUVs.dispose(),this.triangleNormals.dispose(),this.triangleIds.dispose(),this.edgeVAO.dispose(),this.edgePositions.dispose(),this.edgeColors.dispose(),this.edgeUVs.dispose(),this.edgeIds.dispose(),this.pointVAO.dispose(),this.pointPositions.dispose(),this.pointColors.dispose(),this.pointUVs.dispose(),this.pointSizes.dispose(),this.pointIds.dispose(),this.contourVAO.dispose(),this.contourPositions.dispose(),this.contourShader.dispose()},e.exports=d},{"./lib/closest-point":154,"./lib/shaders":155,colormap:106,"gl-buffer":124,"gl-mat4/invert":143,"gl-mat4/multiply":145,"gl-shader":203,"gl-texture2d":228,"gl-vao":232,ndarray:433,normals:158,"simplicial-complex-contour":160,"typedarray-pool":458}],157:[function(t,e,r){"use strict";function n(t){for(var e=0,r=0;r<t.length;++r)e+=t[r];return e}function i(t,e){for(var r=e.length,i=new Array(r+1),a=0;r>a;++a){for(var s=new Array(r+1),l=0;r>=l;++l)s[l]=t[l][a];i[a]=s}i[r]=new Array(r+1);for(var a=0;r>=a;++a)i[r][a]=1;for(var u=new Array(r+1),a=0;r>a;++a)u[a]=e[a];u[r]=1;var c=o(i,u),h=n(c[r+1]);0===h&&(h=1);for(var f=new Array(r+1),a=0;r>=a;++a)f[a]=n(c[a])/h;return f}e.exports=i;var o=t("robust-linear-solve")},{"robust-linear-solve":436}],158:[function(t,e,r){var n=1e-6,i=1e-6;r.vertexNormals=function(t,e,r){for(var i=e.length,o=new Array(i),a=void 0===r?n:r,s=0;i>s;++s)o[s]=[0,0,0];for(var s=0;s<t.length;++s)for(var l=t[s],u=0,c=l[l.length-1],h=l[0],f=0;f<l.length;++f){u=c,c=h,h=l[(f+1)%l.length];for(var d=e[u],p=e[c],v=e[h],m=new Array(3),g=0,y=new Array(3),b=0,x=0;3>x;++x)m[x]=d[x]-p[x],g+=m[x]*m[x],y[x]=v[x]-p[x],b+=y[x]*y[x];if(g*b>a)for(var _=o[c],w=1/Math.sqrt(g*b),x=0;3>x;++x){var M=(x+1)%3,k=(x+2)%3;_[x]+=w*(y[M]*m[k]-y[k]*m[M])}}for(var s=0;i>s;++s){for(var _=o[s],A=0,x=0;3>x;++x)A+=_[x]*_[x];if(A>a)for(var w=1/Math.sqrt(A),x=0;3>x;++x)_[x]*=w;else for(var x=0;3>x;++x)_[x]=0}return o},r.faceNormals=function(t,e,r){for(var n=t.length,o=new Array(n),a=void 0===r?i:r,s=0;n>s;++s){for(var l=t[s],u=new Array(3),c=0;3>c;++c)u[c]=e[l[c]];for(var h=new Array(3),f=new Array(3),c=0;3>c;++c)h[c]=u[1][c]-u[0][c],f[c]=u[2][c]-u[0][c];for(var d=new Array(3),p=0,c=0;3>c;++c){var v=(c+1)%3,m=(c+2)%3;d[c]=h[v]*f[m]-h[m]*f[v],p+=d[c]*d[c]}p=p>a?1/Math.sqrt(p):0;for(var c=0;3>c;++c)d[c]*=p;o[s]=d}return o}},{}],159:[function(t,e,r){"use strict";function n(t,e,r,n,s){i.length<n.length&&(i=new Float64Array(n.length),o=new Float64Array(n.length),a=new Float64Array(n.length));for(var l=0;l<n.length;++l)i[l]=t[l]-n[l],o[l]=e[l]-t[l],a[l]=r[l]-t[l];for(var u=0,c=0,h=0,f=0,d=0,p=0,l=0;l<n.length;++l){var v=o[l],m=a[l],g=i[l];u+=v*v,c+=v*m,h+=m*m,f+=g*v,d+=g*m,p+=g*g}var y,b=Math.abs(u*h-c*c),x=c*d-h*f,_=c*f-u*d;if(b>=x+_)if(0>x)0>_&&0>f?(_=0,-f>=u?(x=1,y=u+2*f+p):(x=-f/u,y=f*x+p)):(x=0,d>=0?(_=0,y=p):-d>=h?(_=1,y=h+2*d+p):(_=-d/h,y=d*_+p));else if(0>_)_=0,f>=0?(x=0,y=p):-f>=u?(x=1,y=u+2*f+p):(x=-f/u,y=f*x+p);else{var w=1/b;x*=w,_*=w,y=x*(u*x+c*_+2*f)+_*(c*x+h*_+2*d)+p}else{var M,k,A,T;0>x?(M=c+f,k=h+d,k>M?(A=k-M,T=u-2*c+h,A>=T?(x=1,_=0,y=u+2*f+p):(x=A/T,_=1-x,y=x*(u*x+c*_+2*f)+_*(c*x+h*_+2*d)+p)):(x=0,0>=k?(_=1,y=h+2*d+p):d>=0?(_=0,y=p):(_=-d/h,y=d*_+p))):0>_?(M=c+d,k=u+f,k>M?(A=k-M,T=u-2*c+h,A>=T?(_=1,x=0,y=h+2*d+p):(_=A/T,x=1-_,y=x*(u*x+c*_+2*f)+_*(c*x+h*_+2*d)+p)):(_=0,0>=k?(x=1,y=u+2*f+p):f>=0?(x=0,y=p):(x=-f/u,y=f*x+p))):(A=h+d-c-f,0>=A?(x=0,_=1,y=h+2*d+p):(T=u-2*c+h,A>=T?(x=1,_=0,y=u+2*f+p):(x=A/T,_=1-x,y=x*(u*x+c*_+2*f)+_*(c*x+h*_+2*d)+p)))}for(var E=1-x-_,l=0;l<n.length;++l)s[l]=E*t[l]+x*e[l]+_*r[l];return 0>y?0:y}var i=new Float64Array(4),o=new Float64Array(4),a=new Float64Array(4);e.exports=n},{}],160:[function(t,e,r){"use strict";function n(t){for(var e=t.length,r=0,n=0;e>n;++n)r=0|Math.max(r,t[n].length);return r-1}function i(t,e){for(var r=t.length,n=h.mallocUint8(r),i=0;r>i;++i)n[i]=t[i]<e|0;return n}function o(t,e){for(var r=t.length,n=e*(e+1)/2*r|0,i=h.mallocUint32(2*n),o=0,a=0;r>a;++a)for(var s=t[a],e=s.length,l=0;e>l;++l)for(var u=0;l>u;++u){var d=s[u],p=s[l];i[o++]=0|Math.min(d,p),i[o++]=0|Math.max(d,p)}var v=o/2|0;f(c(i,[v,2]));for(var m=2,a=2;o>a;a+=2)i[a-2]===i[a]&&i[a-1]===i[a+1]||(i[m++]=i[a],i[m++]=i[a+1]);return c(i,[m/2|0,2])}function a(t,e,r,n){for(var i=t.data,o=t.shape[0],a=h.mallocDouble(o),s=0,l=0;o>l;++l){var u=i[2*l],f=i[2*l+1];if(r[u]!==r[f]){var d=e[u],p=e[f];i[2*s]=u,i[2*s+1]=f,a[s++]=(p-n)/(p-d)}}return t.shape[0]=s,c(a,[s])}function s(t,e){var r=h.mallocInt32(2*e),n=t.shape[0],i=t.data;r[0]=0;for(var o=0,a=0;n>a;++a){var s=i[2*a];if(s!==o){for(r[2*o+1]=a;++o<s;)r[2*o]=a,r[2*o+1]=a;r[2*o]=a}}for(r[2*o+1]=n;++o<e;)r[2*o]=r[2*o+1]=n;return r}function l(t){for(var e=0|t.shape[0],r=t.data,n=new Array(e),i=0;e>i;++i)n[i]=[r[2*i],r[2*i+1]];return n}function u(t,e,r,u){r=r||0,"undefined"==typeof u&&(u=n(t));var c=t.length;if(0===c||1>u)return{cells:[],vertexIds:[],vertexWeights:[]};var f=i(e,+r),p=o(t,u),v=a(p,e,f,+r),m=s(p,0|e.length),g=d(u)(t,p.data,m,f),y=l(p),b=[].slice.call(v.data,0,v.shape[0]);return h.free(f),h.free(p.data),h.free(v.data),h.free(m),{cells:g,vertexIds:y,vertexWeights:b}}e.exports=u;var c=t("ndarray"),h=t("typedarray-pool"),f=t("ndarray-sort"),d=t("./lib/codegen")},{"./lib/codegen":161,ndarray:433,"ndarray-sort":164,"typedarray-pool":458}],161:[function(t,e,r){"use strict";function n(t){function e(t){if(!(t.length<=0)){u.push("R.push(");for(var e=0;e<t.length;++e){var r=t[e];e>0&&u.push(","),u.push("[");for(var n=0;n<r.length;++n){var i=r[n];n>0&&u.push(","),u.push("B(C,E,c[",i[0],"],c[",i[1],"])")}u.push("]")}u.push(");")}}var r=0,n=new Array(t+1);n[0]=[[]];for(var i=1;t>=i;++i)for(var s=n[i]=a(i),l=0;l<s.length;++l)r=Math.max(r,s[i].length);for(var u=["function B(C,E,i,j){","var a=Math.min(i,j)|0,b=Math.max(i,j)|0,l=C[2*a],h=C[2*a+1];","while(l<h){","var m=(l+h)>>1,v=E[2*m+1];","if(v===b){return m}","if(b<v){h=m}else{l=m+1}","}","return l;","};","function getContour",t,"d(F,E,C,S){","var n=F.length,R=[];","for(var i=0;i<n;++i){var c=F[i],l=c.length;"],i=t+1;i>1;--i){t+1>i&&u.push("else "),u.push("if(l===",i,"){");for(var c=[],l=0;i>l;++l)c.push("(S[c["+l+"]]<<"+l+")");u.push("var M=",c.join("+"),";if(M===0||M===",(1<<i)-1,"){continue}switch(M){");for(var s=n[i-1],l=0;l<s.length;++l)u.push("case ",l,":"),e(s[l]),u.push("break;");u.push("}}")}u.push("}return R;};return getContour",t,"d");var h=new Function("pool",u.join(""));return h(o)}function i(t){var e=s[t];return e||(e=s[t]=n(t)),e}e.exports=i;var o=t("typedarray-pool"),a=t("marching-simplex-table"),s={}},{"marching-simplex-table":162,"typedarray-pool":458}],162:[function(t,e,r){"use strict";function n(t,e,r){for(var n=new Array(t),i=0;t>i;++i)n[i]=0,i===e&&(n[i]+=.5),i===r&&(n[i]+=.5);return n}function i(t,e){if(0===e||e===(1<<t+1)-1)return[];for(var r=[],i=[],o=0;t>=o;++o)if(e&1<<o){r.push(n(t,o-1,o-1)),i.push(null);for(var s=0;t>=s;++s)~e&1<<s&&(r.push(n(t,o-1,s-1)),i.push([o,s]))}var l=a(r),u=[];t:for(var o=0;o<l.length;++o){for(var c=l[o],h=[],s=0;s<c.length;++s){if(!i[c[s]])continue t;h.push(i[c[s]].slice())}u.push(h)}return u}function o(t){for(var e=1<<t+1,r=new Array(e),n=0;e>n;++n)r[n]=i(t,n);return r}e.exports=o;var a=t("convex-hull")},{"convex-hull":108}],163:[function(t,e,r){"use strict";function n(t){switch(t){case"uint8":return[l.mallocUint8,l.freeUint8];case"uint16":return[l.mallocUint16,l.freeUint16];case"uint32":return[l.mallocUint32,l.freeUint32];case"int8":return[l.mallocInt8,l.freeInt8];case"int16":return[l.mallocInt16,l.freeInt16];case"int32":return[l.mallocInt32,l.freeInt32];case"float32":return[l.mallocFloat,l.freeFloat];case"float64":return[l.mallocDouble,l.freeDouble];default:return null}}function i(t){for(var e=[],r=0;t>r;++r)e.push("s"+r);for(var r=0;t>r;++r)e.push("n"+r);for(var r=1;t>r;++r)e.push("d"+r);for(var r=1;t>r;++r)e.push("e"+r);for(var r=1;t>r;++r)e.push("f"+r);return e}function o(t,e){function r(t){return"generic"===e?["data.get(",t,")"].join(""):["data[",t,"]"].join("")}function o(t,r){return"generic"===e?["data.set(",t,",",r,")"].join(""):["data[",t,"]=",r].join("")}var a=["'use strict'"],s=["ndarrayInsertionSort",t.join("d"),e].join(""),l=["left","right","data","offset"].concat(i(t.length)),u=n(e),c=["i,j,cptr,ptr=left*s0+offset"];if(t.length>1){for(var h=[],f=1;f<t.length;++f)c.push("i"+f),h.push("n"+f);u?c.push("scratch=malloc("+h.join("*")+")"):c.push("scratch=new Array("+h.join("*")+")"),c.push("dptr","sptr","a","b")}else c.push("scratch");if(a.push(["function ",s,"(",l.join(","),"){var ",c.join(",")].join(""),"for(i=left+1;i<=right;++i){","j=i;ptr+=s0","cptr=ptr"),t.length>1){a.push("dptr=0;sptr=ptr");for(var f=t.length-1;f>=0;--f){var d=t[f];0!==d&&a.push(["for(i",d,"=0;i",d,"<n",d,";++i",d,"){"].join(""))}a.push("scratch[dptr++]=",r("sptr"));for(var f=0;f<t.length;++f){var d=t[f];0!==d&&a.push("sptr+=d"+d,"}")}a.push("__g:while(j-->left){","dptr=0","sptr=cptr-s0");for(var f=1;f<t.length;++f)1===f&&a.push("__l:"),a.push(["for(i",f,"=0;i",f,"<n",f,";++i",f,"){"].join(""));a.push(["a=",r("sptr"),"\nb=scratch[dptr]\nif(a<b){break __g}\nif(a>b){break __l}"].join(""));for(var f=t.length-1;f>=1;--f)a.push("sptr+=e"+f,"dptr+=f"+f,"}");a.push("dptr=cptr;sptr=cptr-s0");for(var f=t.length-1;f>=0;--f){var d=t[f];0!==d&&a.push(["for(i",d,"=0;i",d,"<n",d,";++i",d,"){"].join(""))}a.push(o("dptr",r("sptr")));for(var f=0;f<t.length;++f){var d=t[f];0!==d&&a.push(["dptr+=d",d,";sptr+=d",d].join(""),"}")}a.push("cptr-=s0\n}"),a.push("dptr=cptr;sptr=0");for(var f=t.length-1;f>=0;--f){var d=t[f];0!==d&&a.push(["for(i",d,"=0;i",d,"<n",d,";++i",d,"){"].join(""))}a.push(o("dptr","scratch[sptr++]"));for(var f=0;f<t.length;++f){var d=t[f];0!==d&&a.push("dptr+=d"+d,"}")}}else a.push("scratch="+r("ptr"),"while((j-->left)&&("+r("cptr-s0")+">scratch)){",o("cptr",r("cptr-s0")),"cptr-=s0","}",o("cptr","scratch"));if(a.push("}"),t.length>1&&u&&a.push("free(scratch)"),a.push("} return "+s),u){var p=new Function("malloc","free",a.join("\n"));return p(u[0],u[1])}var p=new Function(a.join("\n"));return p()}function a(t,e,r){function o(t){return["(offset+",t,"*s0)"].join("")}function a(t){return"generic"===e?["data.get(",t,")"].join(""):["data[",t,"]"].join("")}function s(t,r){return"generic"===e?["data.set(",t,",",r,")"].join(""):["data[",t,"]=",r].join("")}function l(e,r,n){if(1===e.length)_.push("ptr0="+o(e[0]));else for(var i=0;i<e.length;++i)_.push(["b_ptr",i,"=s0*",e[i]].join(""));r&&_.push("pivot_ptr=0"),_.push("ptr_shift=offset");for(var i=t.length-1;i>=0;--i){var a=t[i];0!==a&&_.push(["for(i",a,"=0;i",a,"<n",a,";++i",a,"){"].join(""))}if(e.length>1)for(var i=0;i<e.length;++i)_.push(["ptr",i,"=b_ptr",i,"+ptr_shift"].join(""));_.push(n),r&&_.push("++pivot_ptr");for(var i=0;i<t.length;++i){var a=t[i];0!==a&&(e.length>1?_.push("ptr_shift+=d"+a):_.push("ptr0+=d"+a),_.push("}"))}}function c(e,r,n,i){if(1===r.length)_.push("ptr0="+o(r[0]));else{for(var a=0;a<r.length;++a)_.push(["b_ptr",a,"=s0*",r[a]].join(""));_.push("ptr_shift=offset")}n&&_.push("pivot_ptr=0"),e&&_.push(e+":");for(var a=1;a<t.length;++a)_.push(["for(i",a,"=0;i",a,"<n",a,";++i",a,"){"].join(""));if(r.length>1)for(var a=0;a<r.length;++a)_.push(["ptr",a,"=b_ptr",a,"+ptr_shift"].join(""));_.push(i);for(var a=t.length-1;a>=1;--a)n&&_.push("pivot_ptr+=f"+a),r.length>1?_.push("ptr_shift+=e"+a):_.push("ptr0+=e"+a),_.push("}")}function h(){t.length>1&&k&&_.push("free(pivot1)","free(pivot2)")}function f(e,r){var n="el"+e,i="el"+r;if(t.length>1){var s="__l"+ ++A;c(s,[n,i],!1,["comp=",a("ptr0"),"-",a("ptr1"),"\n","if(comp>0){tmp0=",n,";",n,"=",i,";",i,"=tmp0;break ",s,"}\n","if(comp<0){break ",s,"}"].join(""))}else _.push(["if(",a(o(n)),">",a(o(i)),"){tmp0=",n,";",n,"=",i,";",i,"=tmp0}"].join(""))}function d(e,r){t.length>1?l([e,r],!1,s("ptr0",a("ptr1"))):_.push(s(o(e),a(o(r))))}function p(e,r,n){if(t.length>1){var i="__l"+ ++A;c(i,[r],!0,[e,"=",a("ptr0"),"-pivot",n,"[pivot_ptr]\n","if(",e,"!==0){break ",i,"}"].join(""))}else _.push([e,"=",a(o(r)),"-pivot",n].join(""))}function v(e,r){t.length>1?l([e,r],!1,["tmp=",a("ptr0"),"\n",s("ptr0",a("ptr1")),"\n",s("ptr1","tmp")].join("")):_.push(["ptr0=",o(e),"\n","ptr1=",o(r),"\n","tmp=",a("ptr0"),"\n",s("ptr0",a("ptr1")),"\n",s("ptr1","tmp")].join(""))}function m(e,r,n){t.length>1?(l([e,r,n],!1,["tmp=",a("ptr0"),"\n",s("ptr0",a("ptr1")),"\n",s("ptr1",a("ptr2")),"\n",s("ptr2","tmp")].join("")),_.push("++"+r,"--"+n)):_.push(["ptr0=",o(e),"\n","ptr1=",o(r),"\n","ptr2=",o(n),"\n","++",r,"\n","--",n,"\n","tmp=",a("ptr0"),"\n",s("ptr0",a("ptr1")),"\n",s("ptr1",a("ptr2")),"\n",s("ptr2","tmp")].join(""))}function g(t,e){v(t,e),_.push("--"+e)}function y(e,r,n){t.length>1?l([e,r],!0,[s("ptr0",a("ptr1")),"\n",s("ptr1",["pivot",n,"[pivot_ptr]"].join(""))].join("")):_.push(s(o(e),a(o(r))),s(o(r),"pivot"+n))}function b(e,r){_.push(["if((",r,"-",e,")<=",u,"){\n","insertionSort(",e,",",r,",data,offset,",i(t.length).join(","),")\n","}else{\n",w,"(",e,",",r,",data,offset,",i(t.length).join(","),")\n","}"].join(""))}function x(e,r,n){t.length>1?(_.push(["__l",++A,":while(true){"].join("")),l([e],!0,["if(",a("ptr0"),"!==pivot",r,"[pivot_ptr]){break __l",A,"}"].join("")),_.push(n,"}")):_.push(["while(",a(o(e)),"===pivot",r,"){",n,"}"].join(""))}var _=["'use strict'"],w=["ndarrayQuickSort",t.join("d"),e].join(""),M=["left","right","data","offset"].concat(i(t.length)),k=n(e),A=0;_.push(["function ",w,"(",M.join(","),"){"].join(""));var T=["sixth=((right-left+1)/6)|0","index1=left+sixth","index5=right-sixth","index3=(left+right)>>1","index2=index3-sixth","index4=index3+sixth","el1=index1","el2=index2","el3=index3","el4=index4","el5=index5","less=left+1","great=right-1","pivots_are_equal=true","tmp","tmp0","x","y","z","k","ptr0","ptr1","ptr2","comp_pivot1=0","comp_pivot2=0","comp=0"];if(t.length>1){for(var E=[],S=1;S<t.length;++S)E.push("n"+S),T.push("i"+S);for(var S=0;8>S;++S)T.push("b_ptr"+S);T.push("ptr3","ptr4","ptr5","ptr6","ptr7","pivot_ptr","ptr_shift","elementSize="+E.join("*")),k?T.push("pivot1=malloc(elementSize)","pivot2=malloc(elementSize)"):T.push("pivot1=new Array(elementSize),pivot2=new Array(elementSize)")}else T.push("pivot1","pivot2");if(_.push("var "+T.join(",")),f(1,2),f(4,5),f(1,3),f(2,3),f(1,4),f(3,4),f(2,5),f(2,3),f(4,5),t.length>1?l(["el1","el2","el3","el4","el5","index1","index3","index5"],!0,["pivot1[pivot_ptr]=",a("ptr1"),"\n","pivot2[pivot_ptr]=",a("ptr3"),"\n","pivots_are_equal=pivots_are_equal&&(pivot1[pivot_ptr]===pivot2[pivot_ptr])\n","x=",a("ptr0"),"\n","y=",a("ptr2"),"\n","z=",a("ptr4"),"\n",s("ptr5","x"),"\n",s("ptr6","y"),"\n",s("ptr7","z")].join("")):_.push(["pivot1=",a(o("el2")),"\n","pivot2=",a(o("el4")),"\n","pivots_are_equal=pivot1===pivot2\n","x=",a(o("el1")),"\n","y=",a(o("el3")),"\n","z=",a(o("el5")),"\n",s(o("index1"),"x"),"\n",s(o("index3"),"y"),"\n",s(o("index5"),"z")].join("")),d("index2","left"),d("index4","right"),_.push("if(pivots_are_equal){"),_.push("for(k=less;k<=great;++k){"),p("comp","k",1),_.push("if(comp===0){continue}"),_.push("if(comp<0){"),_.push("if(k!==less){"),v("k","less"),_.push("}"),_.push("++less"),_.push("}else{"),_.push("while(true){"),p("comp","great",1),_.push("if(comp>0){"),_.push("great--"),_.push("}else if(comp<0){"),m("k","less","great"),_.push("break"),_.push("}else{"),g("k","great"),_.push("break"),_.push("}"),_.push("}"),_.push("}"),_.push("}"),_.push("}else{"),_.push("for(k=less;k<=great;++k){"),p("comp_pivot1","k",1),_.push("if(comp_pivot1<0){"),_.push("if(k!==less){"),v("k","less"),_.push("}"),_.push("++less"),_.push("}else{"),p("comp_pivot2","k",2),_.push("if(comp_pivot2>0){"),_.push("while(true){"),p("comp","great",2),_.push("if(comp>0){"),_.push("if(--great<k){break}"),_.push("continue"),_.push("}else{"),p("comp","great",1),_.push("if(comp<0){"),m("k","less","great"),_.push("}else{"),g("k","great"),_.push("}"),_.push("break"),_.push("}"),_.push("}"),_.push("}"),_.push("}"),_.push("}"),_.push("}"),y("left","(less-1)",1),y("right","(great+1)",2),b("left","(less-2)"),b("(great+2)","right"),_.push("if(pivots_are_equal){"),h(),_.push("return"),_.push("}"),_.push("if(less<index1&&great>index5){"),x("less",1,"++less"),x("great",2,"--great"),_.push("for(k=less;k<=great;++k){"),p("comp_pivot1","k",1),_.push("if(comp_pivot1===0){"),_.push("if(k!==less){"),v("k","less"),_.push("}"),_.push("++less"),_.push("}else{"),p("comp_pivot2","k",2),_.push("if(comp_pivot2===0){"),_.push("while(true){"),p("comp","great",2),_.push("if(comp===0){"),_.push("if(--great<k){break}"),_.push("continue"),_.push("}else{"),p("comp","great",1),_.push("if(comp<0){"),m("k","less","great"),_.push("}else{"),g("k","great"),_.push("}"),_.push("break"),_.push("}"),_.push("}"),_.push("}"),_.push("}"),_.push("}"),_.push("}"),h(),b("less","great"),_.push("}return "+w),t.length>1&&k){var L=new Function("insertionSort","malloc","free",_.join("\n"));return L(r,k[0],k[1])}var L=new Function("insertionSort",_.join("\n"));return L(r)}function s(t,e){var r=["'use strict'"],n=["ndarraySortWrapper",t.join("d"),e].join(""),s=["array"];r.push(["function ",n,"(",s.join(","),"){"].join(""));for(var l=["data=array.data,offset=array.offset|0,shape=array.shape,stride=array.stride"],c=0;c<t.length;++c)l.push(["s",c,"=stride[",c,"]|0,n",c,"=shape[",c,"]|0"].join(""));for(var h=new Array(t.length),f=[],c=0;c<t.length;++c){var d=t[c];0!==d&&(0===f.length?h[d]="1":h[d]=f.join("*"),f.push("n"+d))}for(var p=-1,v=-1,c=0;c<t.length;++c){var m=t[c];0!==m&&(p>0?l.push(["d",m,"=s",m,"-d",p,"*n",p].join("")):l.push(["d",m,"=s",m].join("")),p=m);var d=t.length-1-c;0!==d&&(v>0?l.push(["e",d,"=s",d,"-e",v,"*n",v,",f",d,"=",h[d],"-f",v,"*n",v].join("")):l.push(["e",d,"=s",d,",f",d,"=",h[d]].join("")),v=d)}r.push("var "+l.join(","));var g=["0","n0-1","data","offset"].concat(i(t.length));r.push(["if(n0<=",u,"){","insertionSort(",g.join(","),")}else{","quickSort(",g.join(","),")}"].join("")),r.push("}return "+n);var y=new Function("insertionSort","quickSort",r.join("\n")),b=o(t,e),x=a(t,e,b);return y(b,x)}var l=t("typedarray-pool"),u=32;e.exports=s},{"typedarray-pool":458}],164:[function(t,e,r){"use strict";function n(t){var e=t.order,r=t.dtype,n=[e,r],a=n.join(":"),s=o[a];return s||(o[a]=s=i(e,r)),s(t),t}var i=t("./lib/compile_sort.js"),o={};e.exports=n},{"./lib/compile_sort.js":163}],165:[function(t,e,r){"use strict";function n(t,e,r){this.plot=t,this.vbo=e,this.shader=r}function i(t){var e=t.gl,r=o(e,[0,0,0,1,1,0,1,1]),i=a(e,s.boxVert,s.lineFrag);return new n(t,r,i)}e.exports=i;var o=t("gl-buffer"),a=t("gl-shader"),s=t("./shaders"),l=n.prototype;l.bind=function(){var t=this.shader;this.vbo.bind(),this.shader.bind(),t.attributes.coord.pointer(),t.uniforms.screenBox=this.plot.screenBox},l.drawBox=function(){var t=[0,0],e=[0,0];return function(r,n,i,o,a){var s=this.plot,l=this.shader,u=s.gl;t[0]=r,t[1]=n,e[0]=i,e[1]=o,l.uniforms.lo=t,l.uniforms.hi=e,l.uniforms.color=a,u.drawArrays(u.TRIANGLE_STRIP,0,4)}}(),l.dispose=function(){this.vbo.dispose(),this.shader.dispose()}},{"./shaders":168,"gl-buffer":124,"gl-shader":203}],166:[function(t,e,r){"use strict";function n(t,e,r,n){this.plot=t,this.vbo=e,this.shader=r,this.tickShader=n,this.ticks=[[],[]]}function i(t,e){return t-e}function o(t){var e=t.gl,r=a(e),i=s(e,u.gridVert,u.gridFrag),o=s(e,u.tickVert,u.gridFrag),l=new n(t,r,i,o);return l}e.exports=o;var a=t("gl-buffer"),s=t("gl-shader"),l=t("binary-search-bounds"),u=t("./shaders"),c=n.prototype;c.draw=function(){var t=[0,0],e=[0,0],r=[0,0];return function(){for(var n=this.plot,i=this.vbo,o=this.shader,a=this.ticks,s=n.gl,l=n._tickBounds,u=n.dataBox,c=n.viewBox,h=n.gridLineWidth,f=n.gridLineColor,d=n.gridLineEnable,p=n.pixelRatio,v=0;2>v;++v){var m=l[v],g=l[v+2],y=g-m,b=.5*(u[v+2]+u[v]),x=u[v+2]-u[v];e[v]=2*y/x,t[v]=2*(m-b)/x}o.bind(),i.bind(),o.attributes.dataCoord.pointer(),o.uniforms.dataShift=t,o.uniforms.dataScale=e;for(var _=0,v=0;2>v;++v){r[0]=r[1]=0,r[v]=1,o.uniforms.dataAxis=r,o.uniforms.lineWidth=h[v]/(c[v+2]-c[v])*p,o.uniforms.color=f[v];var w=6*a[v].length;d[v]&&w&&s.drawArrays(s.TRIANGLES,_,w),_+=w}}}(),c.drawTickMarks=function(){var t=[0,0],e=[0,0],r=[1,0],n=[0,1],o=[0,0],a=[0,0];return function(){for(var s=this.plot,u=this.vbo,c=this.tickShader,h=this.ticks,f=s.gl,d=s._tickBounds,p=s.dataBox,v=s.viewBox,m=s.pixelRatio,g=s.screenBox,y=g[2]-g[0],b=g[3]-g[1],x=v[2]-v[0],_=v[3]-v[1],w=0;2>w;++w){var M=d[w],k=d[w+2],A=k-M,T=.5*(p[w+2]+p[w]),E=p[w+2]-p[w];e[w]=2*A/E,t[w]=2*(M-T)/E}e[0]*=x/y,t[0]*=x/y,e[1]*=_/b,t[1]*=_/b,c.bind(),u.bind(),c.attributes.dataCoord.pointer();var S=c.uniforms;S.dataShift=t,S.dataScale=e;var L=s.tickMarkLength,z=s.tickMarkWidth,I=s.tickMarkColor,P=0,C=6*h[0].length,R=Math.min(l.ge(h[0],(p[0]-d[0])/(d[2]-d[0]),i),h[0].length),D=Math.min(l.gt(h[0],(p[2]-d[0])/(d[2]-d[0]),i),h[0].length),O=P+6*R,F=6*Math.max(0,D-R),j=Math.min(l.ge(h[1],(p[1]-d[1])/(d[3]-d[1]),i),h[1].length),N=Math.min(l.gt(h[1],(p[3]-d[1])/(d[3]-d[1]),i),h[1].length),B=C+6*j,U=6*Math.max(0,N-j);o[0]=2*(v[0]-L[1])/y-1,o[1]=(v[3]+v[1])/b-1,a[0]=L[1]*m/y,a[1]=z[1]*m/b,U&&(S.color=I[1],S.tickScale=a,S.dataAxis=n,S.screenOffset=o,f.drawArrays(f.TRIANGLES,B,U)),o[0]=(v[2]+v[0])/y-1,o[1]=2*(v[1]-L[0])/b-1,a[0]=z[0]*m/y,a[1]=L[0]*m/b,F&&(S.color=I[0],S.tickScale=a,S.dataAxis=r,S.screenOffset=o,f.drawArrays(f.TRIANGLES,O,F)),o[0]=2*(v[2]+L[3])/y-1,o[1]=(v[3]+v[1])/b-1,a[0]=L[3]*m/y,a[1]=z[3]*m/b,U&&(S.color=I[3],S.tickScale=a,S.dataAxis=n,S.screenOffset=o,f.drawArrays(f.TRIANGLES,B,U)),o[0]=(v[2]+v[0])/y-1,o[1]=2*(v[3]+L[2])/b-1,a[0]=z[2]*m/y,a[1]=L[2]*m/b,F&&(S.color=I[2],S.tickScale=a,S.dataAxis=r,S.screenOffset=o,f.drawArrays(f.TRIANGLES,O,F))}}(),c.update=function(){var t=[1,1,-1,-1,1,-1],e=[1,-1,1,1,-1,-1];return function(r){for(var n=r.ticks,i=r.bounds,o=new Float32Array(18*(n[0].length+n[1].length)),a=(this.plot.zeroLineEnable,0),s=[[],[]],l=0;2>l;++l)for(var u=s[l],c=n[l],h=i[l],f=i[l+2],d=0;d<c.length;++d){var p=(c[d].x-h)/(f-h);u.push(p);for(var v=0;6>v;++v)o[a++]=p,o[a++]=t[v],o[a++]=e[v]}this.ticks=s,this.vbo.update(o)}}(),c.dispose=function(){this.vbo.dispose(),this.shader.dispose(),this.tickShader.dispose()}},{"./shaders":168,"binary-search-bounds":170,"gl-buffer":124,"gl-shader":203}],167:[function(t,e,r){"use strict";function n(t,e,r){this.plot=t,this.vbo=e,this.shader=r}function i(t){var e=t.gl,r=o(e,[-1,-1,-1,1,1,-1,1,1]),i=a(e,s.lineVert,s.lineFrag),l=new n(t,r,i);return l}e.exports=i;var o=t("gl-buffer"),a=t("gl-shader"),s=t("./shaders"),l=n.prototype;l.bind=function(){var t=this.shader;this.vbo.bind(),this.shader.bind(),t.attributes.coord.pointer(),t.uniforms.screenBox=this.plot.screenBox},l.drawLine=function(){var t=[0,0],e=[0,0];return function(r,n,i,o,a,s){var l=this.plot,u=this.shader,c=l.gl;t[0]=r,t[1]=n,e[0]=i,e[1]=o,u.uniforms.start=t,u.uniforms.end=e,u.uniforms.width=a*l.pixelRatio,u.uniforms.color=s,c.drawArrays(c.TRIANGLE_STRIP,0,4)}}(),l.dispose=function(){this.vbo.dispose(),this.shader.dispose()}},{"./shaders":168,"gl-buffer":124,"gl-shader":203}],168:[function(t,e,r){"use strict";var n="precision lowp float;\n#define GLSLIFY 1\nuniform vec4 color;\nvoid main() {\n  gl_FragColor = vec4(color.xyz * color.w, color.w);\n}\n";e.exports={lineVert:"precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 coord;\n\nuniform vec4 screenBox;\nuniform vec2 start, end;\nuniform float width;\n\nvec2 perp(vec2 v) {\n  return vec2(v.y, -v.x);\n}\n\nvec2 screen(vec2 v) {\n  return 2.0 * (v - screenBox.xy) / (screenBox.zw - screenBox.xy) - 1.0;\n}\n\nvoid main() {\n  vec2 delta = normalize(perp(start - end));\n  vec2 offset = mix(start, end, 0.5 * (coord.y+1.0));\n  gl_Position = vec4(screen(offset + 0.5 * width * delta * coord.x), 0, 1);\n}\n",lineFrag:n,textVert:"#define GLSLIFY 1\nattribute vec3 textCoordinate;\n\nuniform vec2 dataScale, dataShift, dataAxis, screenOffset, textScale;\nuniform float angle;\n\nvoid main() {\n  float dataOffset  = textCoordinate.z;\n  vec2 glyphOffset  = textCoordinate.xy;\n  mat2 glyphMatrix = mat2(cos(angle), sin(angle), -sin(angle), cos(angle));\n  vec2 screenCoordinate = dataAxis * (dataScale * dataOffset + dataShift) +\n    glyphMatrix * glyphOffset * textScale + screenOffset;\n  gl_Position = vec4(screenCoordinate, 0, 1);\n}\n",
textFrag:n,gridVert:"precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 dataCoord;\n\nuniform vec2 dataAxis, dataShift, dataScale;\nuniform float lineWidth;\n\nvoid main() {\n  vec2 pos = dataAxis * (dataScale * dataCoord.x + dataShift);\n  pos += 10.0 * dataCoord.y * vec2(dataAxis.y, -dataAxis.x) + dataCoord.z * lineWidth;\n  gl_Position = vec4(pos, 0, 1);\n}\n",gridFrag:n,boxVert:"precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 coord;\n\nuniform vec4 screenBox;\nuniform vec2 lo, hi;\n\nvec2 screen(vec2 v) {\n  return 2.0 * (v - screenBox.xy) / (screenBox.zw - screenBox.xy) - 1.0;\n}\n\nvoid main() {\n  gl_Position = vec4(screen(mix(lo, hi, coord)), 0, 1);\n}\n",tickVert:"precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 dataCoord;\n\nuniform vec2 dataAxis, dataShift, dataScale, screenOffset, tickScale;\n\nvoid main() {\n  vec2 pos = dataAxis * (dataScale * dataCoord.x + dataShift);\n  gl_Position = vec4(pos + tickScale*dataCoord.yz + screenOffset, 0, 1);\n}\n"}},{}],169:[function(t,e,r){"use strict";function n(t,e,r){this.plot=t,this.vbo=e,this.shader=r,this.tickOffset=[[],[]],this.tickX=[[],[]],this.labelOffset=[0,0],this.labelCount=[0,0]}function i(t){var e=t.gl,r=o(e),i=a(e,u.textVert,u.textFrag),s=new n(t,r,i);return s}e.exports=i;var o=t("gl-buffer"),a=t("gl-shader"),s=t("text-cache"),l=t("binary-search-bounds"),u=t("./shaders"),c=n.prototype;c.drawTicks=function(){var t=[0,0],e=[0,0],r=[0,0];return function(n){var i=this.plot,o=this.shader,a=this.tickX[n],s=this.tickOffset[n],u=i.gl,c=i.viewBox,h=i.dataBox,f=i.screenBox,d=i.pixelRatio,p=i.tickEnable,v=i.tickPad,m=i.tickColor,g=i.tickAngle,y=(i.tickMarkLength,i.labelEnable),b=i.labelPad,x=i.labelColor,_=i.labelAngle,w=this.labelOffset[n],M=this.labelCount[n],k=l.lt(a,h[n]),A=l.le(a,h[n+2]);t[0]=t[1]=0,t[n]=1,e[n]=(c[2+n]+c[n])/(f[2+n]-f[n])-1;var T=2/f[2+(1^n)]-f[1^n];e[1^n]=T*c[1^n]-1,p[n]&&(e[1^n]-=T*d*v[n],A>k&&s[A]>s[k]&&(o.uniforms.dataAxis=t,o.uniforms.screenOffset=e,o.uniforms.color=m[n],o.uniforms.angle=g[n],u.drawArrays(u.TRIANGLES,s[k],s[A]-s[k]))),y[n]&&M&&(e[1^n]-=T*d*b[n],o.uniforms.dataAxis=r,o.uniforms.screenOffset=e,o.uniforms.color=x[n],o.uniforms.angle=_[n],u.drawArrays(u.TRIANGLES,w,M)),e[1^n]=T*c[2+(1^n)]-1,p[n+2]&&(e[1^n]+=T*d*v[n+2],A>k&&s[A]>s[k]&&(o.uniforms.dataAxis=t,o.uniforms.screenOffset=e,o.uniforms.color=m[n+2],o.uniforms.angle=g[n+2],u.drawArrays(u.TRIANGLES,s[k],s[A]-s[k]))),y[n+2]&&M&&(e[1^n]+=T*d*b[n+2],o.uniforms.dataAxis=r,o.uniforms.screenOffset=e,o.uniforms.color=x[n+2],o.uniforms.angle=_[n+2],u.drawArrays(u.TRIANGLES,w,M))}}(),c.drawTitle=function(){var t=[0,0],e=[0,0];return function(){var r=this.plot,n=this.shader,i=r.gl,o=r.screenBox,a=r.titleCenter,s=r.titleAngle,l=r.titleColor,a=r.titleCenter,u=r.pixelRatio;if(this.titleCount){for(var c=0;2>c;++c)e[c]=2*(a[c]*u-o[c])/(o[2+c]-o[c])-1;n.bind(),n.uniforms.dataAxis=t,n.uniforms.screenOffset=e,n.uniforms.angle=s,n.uniforms.color=l,i.drawArrays(i.TRIANGLES,this.titleOffset,this.titleCount)}}}(),c.bind=function(){var t=[0,0],e=[0,0],r=[0,0];return function(){var n=this.plot,i=this.shader,o=n._tickBounds,a=n.dataBox,s=n.screenBox,l=n.viewBox;i.bind();for(var u=0;2>u;++u){var c=o[u],h=o[u+2],f=h-c,d=.5*(a[u+2]+a[u]),p=a[u+2]-a[u],v=l[u],m=l[u+2],g=m-v,y=s[u],b=s[u+2],x=b-y;e[u]=2*f/p*g/x,t[u]=2*(c-d)/p*g/x}r[1]=2*n.pixelRatio/(s[3]-s[1]),r[0]=r[1]*(s[3]-s[1])/(s[2]-s[0]),i.uniforms.dataScale=e,i.uniforms.dataShift=t,i.uniforms.textScale=r,this.vbo.bind(),i.attributes.textCoordinate.pointer()}}(),c.update=function(t){for(var e=[],r=t.ticks,n=t.bounds,i=0;2>i;++i){for(var o=[Math.floor(e.length/3)],a=[-(1/0)],l=r[i],u=0;u<l.length;++u){for(var c=l[u],h=c.x,f=c.text,d=c.font||"sans-serif",p=c.fontSize||12,v=s(d,f).data,m=1/(n[i+2]-n[i]),g=n[i],y=0;y<v.length;y+=2)e.push(v[y]*p,-v[y+1]*p,(h-g)*m);o.push(Math.floor(e.length/3)),a.push(h)}this.tickOffset[i]=o,this.tickX[i]=a}for(var i=0;2>i;++i){this.labelOffset[i]=Math.floor(e.length/3);for(var v=s(t.labelFont[i],t.labels[i]).data,p=t.labelSize[i],u=0;u<v.length;u+=2)e.push(v[u]*p,-v[u+1]*p,0);this.labelCount[i]=Math.floor(e.length/3)-this.labelOffset[i]}this.titleOffset=Math.floor(e.length/3);for(var v=s(t.titleFont,t.title).data,p=t.titleSize,u=0;u<v.length;u+=2)e.push(v[u]*p,-v[u+1]*p,0);this.titleCount=Math.floor(e.length/3)-this.titleOffset,this.vbo.update(e)},c.dispose=function(){this.vbo.dispose(),this.shader.dispose()}},{"./shaders":168,"binary-search-bounds":170,"gl-buffer":124,"gl-shader":203,"text-cache":453}],170:[function(t,e,r){arguments[4][68][0].apply(r,arguments)},{dup:68}],171:[function(t,e,r){"use strict";function n(t,e){this.gl=t,this.pickBuffer=e,this.screenBox=[0,0,t.drawingBufferWidth,t.drawingBufferHeight],this.viewBox=[0,0,0,0],this.dataBox=[-10,-10,10,10],this.gridLineEnable=[!0,!0],this.gridLineWidth=[1,1],this.gridLineColor=[[0,0,0,1],[0,0,0,1]],this.pixelRatio=1,this.tickMarkLength=[0,0,0,0],this.tickMarkWidth=[0,0,0,0],this.tickMarkColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.tickPad=[15,15,15,15],this.tickAngle=[0,0,0,0],this.tickEnable=[!0,!0,!0,!0],this.tickColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.labelPad=[15,15,15,15],this.labelAngle=[0,Math.PI/2,0,3*Math.PI/2],this.labelEnable=[!0,!0,!0,!0],this.labelColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.titleCenter=[0,0],this.titleEnable=!0,this.titleAngle=0,this.titleColor=[0,0,0,1],this.borderColor=[0,0,0,0],this.backgroundColor=[0,0,0,0],this.zeroLineEnable=[!0,!0],this.zeroLineWidth=[4,4],this.zeroLineColor=[[0,0,0,1],[0,0,0,1]],this.borderLineEnable=[!0,!0,!0,!0],this.borderLineWidth=[2,2,2,2],this.borderLineColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.grid=null,this.text=null,this.line=null,this.box=null,this.objects=[],this.overlays=[],this._tickBounds=[1/0,1/0,-(1/0),-(1/0)],this.dirty=!1,this.pickDirty=!1,this.pickDelay=120,this.pickRadius=10,this._pickTimeout=null,this._drawPick=this.drawPick.bind(this),this._depthCounter=0}function i(t){for(var e=t.slice(),r=0;r<e.length;++r)e[r]=e[r].slice();return e}function o(t,e){return t.x-e.x}function a(t){var e=t.gl,r=s(e,[e.drawingBufferWidth,e.drawingBufferHeight]),i=new n(e,r);return i.grid=l(i),i.text=u(i),i.line=c(i),i.box=h(i),i.update(t),i}e.exports=a;var s=t("gl-select-static"),l=t("./lib/grid"),u=t("./lib/text"),c=t("./lib/line"),h=t("./lib/box"),f=n.prototype;f.setDirty=function(){this.dirty=this.pickDirty=!0},f.setOverlayDirty=function(){this.dirty=!0},f.nextDepthValue=function(){return this._depthCounter++/65536},f.draw=function(){return function(){var t=this.gl,e=this.screenBox,r=this.viewBox,n=this.dataBox,i=this.pixelRatio,o=this.grid,a=this.line,s=this.text,l=this.objects;if(this._depthCounter=0,this.pickDirty&&(this._pickTimeout&&clearTimeout(this._pickTimeout),this.pickDirty=!1,this._pickTimeout=setTimeout(this._drawPick,this.pickDelay)),this.dirty){this.dirty=!1,t.bindFramebuffer(t.FRAMEBUFFER,null),t.enable(t.SCISSOR_TEST),t.disable(t.DEPTH_TEST),t.depthFunc(t.LESS),t.depthMask(!1),t.enable(t.BLEND),t.blendEquation(t.FUNC_ADD,t.FUNC_ADD),t.blendFunc(t.ONE,t.ONE_MINUS_SRC_ALPHA),t.scissor(e[0],e[1],e[2]-e[0],e[3]-e[1]);var u=this.borderColor;t.clearColor(u[0]*u[3],u[1]*u[3],u[2]*u[3],u[3]),t.clear(t.COLOR_BUFFER_BIT|t.DEPTH_BUFFER_BIT),t.scissor(r[0],r[1],r[2]-r[0],r[3]-r[1]),t.viewport(r[0],r[1],r[2]-r[0],r[3]-r[1]);var c=this.backgroundColor;t.clearColor(c[0]*c[3],c[1]*c[3],c[2]*c[3],c[3]),t.clear(t.COLOR_BUFFER_BIT),o.draw();var h=this.zeroLineEnable,f=this.zeroLineColor,d=this.zeroLineWidth;if(h[0]||h[1]){a.bind();for(var p=0;2>p;++p)if(h[p]&&n[p]<=0&&n[p+2]>=0){var v=e[p]-n[p]*(e[p+2]-e[p])/(n[p+2]-n[p]);0===p?a.drawLine(v,e[1],v,e[3],d[p],f[p]):a.drawLine(e[0],v,e[2],v,d[p],f[p])}}for(var p=0;p<l.length;++p)l[p].draw();t.viewport(e[0],e[1],e[2]-e[0],e[3]-e[1]),t.scissor(e[0],e[1],e[2]-e[0],e[3]-e[1]),this.grid.drawTickMarks(),a.bind();var m=this.borderLineEnable,g=this.borderLineWidth,y=this.borderLineColor;m[1]&&a.drawLine(r[0],r[1]-.5*g[1]*i,r[0],r[3]+.5*g[3]*i,g[1],y[1]),m[0]&&a.drawLine(r[0]-.5*g[0]*i,r[1],r[2]+.5*g[2]*i,r[1],g[0],y[0]),m[3]&&a.drawLine(r[2],r[1]-.5*g[1]*i,r[2],r[3]+.5*g[3]*i,g[3],y[3]),m[2]&&a.drawLine(r[0]-.5*g[0]*i,r[3],r[2]+.5*g[2]*i,r[3],g[2],y[2]),s.bind();for(var p=0;2>p;++p)s.drawTicks(p);this.titleEnable&&s.drawTitle();for(var b=this.overlays,p=0;p<b.length;++p)b[p].draw();t.disable(t.SCISSOR_TEST),t.disable(t.BLEND),t.depthMask(!0)}}}(),f.drawPick=function(){return function(){var t=this.pickBuffer;this.gl;this._pickTimeout=null,t.begin();for(var e=1,r=this.objects,n=0;n<r.length;++n)e=r[n].drawPick(e);t.end()}}(),f.pick=function(){return function(t,e){var r=this.pixelRatio,n=this.pickPixelRatio,i=this.viewBox,o=0|Math.round((t-i[0]/r)*n),a=0|Math.round((e-i[1]/r)*n),s=this.pickBuffer.query(o,a,this.pickRadius);if(!s)return null;for(var l=s.id+(s.value[0]<<8)+(s.value[1]<<16)+(s.value[2]<<24),u=this.objects,c=0;c<u.length;++c){var h=u[c].pick(o,a,l);if(h)return h}return null}}(),f.setScreenBox=function(t){var e=this.screenBox,r=this.pixelRatio;e[0]=0|Math.round(t[0]*r),e[1]=0|Math.round(t[1]*r),e[2]=0|Math.round(t[2]*r),e[3]=0|Math.round(t[3]*r),this.setDirty()},f.setDataBox=function(t){var e=this.dataBox,r=e[0]!==t[0]||e[1]!==t[1]||e[2]!==t[2]||e[3]!==t[3];r&&(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],this.setDirty())},f.setViewBox=function(t){var e=this.pixelRatio,r=this.viewBox;r[0]=0|Math.round(t[0]*e),r[1]=0|Math.round(t[1]*e),r[2]=0|Math.round(t[2]*e),r[3]=0|Math.round(t[3]*e);var n=this.pickPixelRatio;this.pickBuffer.shape=[0|Math.round((t[2]-t[0])*n),0|Math.round((t[3]-t[1])*n)],this.setDirty()},f.update=function(t){t=t||{};var e=this.gl;this.pixelRatio=t.pixelRatio||1;var r=this.pixelRatio;this.pickPixelRatio=Math.max(r,1),this.setScreenBox(t.screenBox||[0,0,e.drawingBufferWidth/r,e.drawingBufferHeight/r]);this.screenBox;this.setViewBox(t.viewBox||[.125*(this.screenBox[2]-this.screenBox[0])/r,.125*(this.screenBox[3]-this.screenBox[1])/r,.875*(this.screenBox[2]-this.screenBox[0])/r,.875*(this.screenBox[3]-this.screenBox[1])/r]);var n=this.viewBox,a=(n[2]-n[0])/(n[3]-n[1]);this.setDataBox(t.dataBox||[-10,-10/a,10,10/a]),this.borderColor=(t.borderColor||[0,0,0,0]).slice(),this.backgroundColor=(t.backgroundColor||[0,0,0,0]).slice(),this.gridLineEnable=(t.gridLineEnable||[!0,!0]).slice(),this.gridLineWidth=(t.gridLineWidth||[1,1]).slice(),this.gridLineColor=i(t.gridLineColor||[[.5,.5,.5,1],[.5,.5,.5,1]]),this.zeroLineEnable=(t.zeroLineEnable||[!0,!0]).slice(),this.zeroLineWidth=(t.zeroLineWidth||[4,4]).slice(),this.zeroLineColor=i(t.zeroLineColor||[[0,0,0,1],[0,0,0,1]]),this.tickMarkLength=(t.tickMarkLength||[0,0,0,0]).slice(),this.tickMarkWidth=(t.tickMarkWidth||[0,0,0,0]).slice(),this.tickMarkColor=i(t.tickMarkColor||[[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]]),this.titleCenter=(t.titleCenter||[.5*(n[0]+n[2])/r,(n[3]+120)/r]).slice(),this.titleEnable=!("titleEnable"in t&&!t.titleEnable),this.titleAngle=t.titleAngle||0,this.titleColor=(t.titleColor||[0,0,0,1]).slice(),this.labelPad=(t.labelPad||[15,15,15,15]).slice(),this.labelAngle=(t.labelAngle||[0,Math.PI/2,0,3*Math.PI/2]).slice(),this.labelEnable=(t.labelEnable||[!0,!0,!0,!0]).slice(),this.labelColor=i(t.labelColor||[[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]]),this.tickPad=(t.tickPad||[15,15,15,15]).slice(),this.tickAngle=(t.tickAngle||[0,0,0,0]).slice(),this.tickEnable=(t.tickEnable||[!0,!0,!0,!0]).slice(),this.tickColor=i(t.tickColor||[[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]]),this.borderLineEnable=(t.borderLineEnable||[!0,!0,!0,!0]).slice(),this.borderLineWidth=(t.borderLineWidth||[2,2,2,2]).slice(),this.borderLineColor=i(t.borderLineColor||[[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]]);var s=t.ticks||[[],[]],l=this._tickBounds;l[0]=l[1]=1/0,l[2]=l[3]=-(1/0);for(var u=0;2>u;++u){var c=s[u].slice(0);0!==c.length&&(c.sort(o),l[u]=Math.min(l[u],c[0].x),l[u+2]=Math.max(l[u+2],c[c.length-1].x))}this.grid.update({bounds:l,ticks:s}),this.text.update({bounds:l,ticks:s,labels:t.labels||["x","y"],labelSize:t.labelSize||[12,12],labelFont:t.labelFont||["sans-serif","sans-serif"],title:t.title||"",titleSize:t.titleSize||18,titleFont:t.titleFont||"sans-serif"}),this.setDirty()},f.dispose=function(){this.box.dispose(),this.grid.dispose(),this.text.dispose(),this.line.dispose();for(var t=this.objects.length-1;t>=0;--t)this.objects[t].dispose();this.objects.length=0;for(var t=this.overlays.length-1;t>=0;--t)this.overlays[t].dispose();this.overlays.length=0,this.gl=null},f.addObject=function(t){this.objects.indexOf(t)<0&&(this.objects.push(t),this.setDirty())},f.removeObject=function(t){for(var e=this.objects,r=0;r<e.length;++r)if(e[r]===t){e.splice(r,1),this.setDirty();break}},f.addOverlay=function(t){this.overlays.indexOf(t)<0&&(this.overlays.push(t),this.setOverlayDirty())},f.removeOverlay=function(t){for(var e=this.overlays,r=0;r<e.length;++r)if(e[r]===t){e.splice(r,1),this.setOverlayDirty();break}}},{"./lib/box":165,"./lib/grid":166,"./lib/line":167,"./lib/text":169,"gl-select-static":202}],172:[function(t,e,r){var n=t("gl-shader"),i="precision mediump float;\n#define GLSLIFY 1\nattribute vec2 position;\nvarying vec2 uv;\nvoid main() {\n  uv = position;\n  gl_Position = vec4(position, 0, 1);\n}",o="precision mediump float;\n#define GLSLIFY 1\n\nuniform sampler2D accumBuffer;\nvarying vec2 uv;\n\nvoid main() {\n  vec4 accum = texture2D(accumBuffer, 0.5 * (uv + 1.0));\n  gl_FragColor = min(vec4(1,1,1,1), accum);\n}";e.exports=function(t){return n(t,i,o,null,[{name:"position",type:"vec2"}])}},{"gl-shader":203}],173:[function(t,e,r){"use strict";function n(t,e){t=t||document.body,e=e||{};var r=[.01,1/0];"distanceLimits"in e&&(r[0]=e.distanceLimits[0],r[1]=e.distanceLimits[1]),"zoomMin"in e&&(r[0]=e.zoomMin),"zoomMax"in e&&(r[1]=e.zoomMax);var n=o({center:e.center||[0,0,0],up:e.up||[0,1,0],eye:e.eye||[0,0,10],mode:e.mode||"orbit",distanceLimits:r}),l=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],u=0,c=t.clientWidth,h=t.clientHeight,f={view:n,element:t,delay:e.delay||16,rotateSpeed:e.rotateSpeed||1,zoomSpeed:e.zoomSpeed||1,translateSpeed:e.translateSpeed||1,flipX:!!e.flipX,flipY:!!e.flipY,modes:n.modes,tick:function(){var e=i(),r=this.delay;n.idle(e-r),n.flush(e-(100+2*r));var o=e-2*r;n.recalcMatrix(o);for(var a=!0,s=n.computedMatrix,f=0;16>f;++f)a=a&&l[f]===s[f],l[f]=s[f];var d=t.clientWidth===c&&t.clientHeight===h;return c=t.clientWidth,h=t.clientHeight,a?!d:(u=Math.exp(n.computedRadius[0]),!0)},lookAt:function(t,e,r){n.lookAt(n.lastT(),t,e,r)},rotate:function(t,e,r){n.rotate(n.lastT(),t,e,r)},pan:function(t,e,r){n.pan(n.lastT(),t,e,r)},translate:function(t,e,r){n.translate(n.lastT(),t,e,r)}};Object.defineProperties(f,{matrix:{get:function(){return n.computedMatrix},set:function(t){return n.setMatrix(n.lastT(),t),n.computedMatrix},enumerable:!0},mode:{get:function(){return n.getMode()},set:function(t){return n.setMode(t),n.getMode()},enumerable:!0},center:{get:function(){return n.computedCenter},set:function(t){return n.lookAt(n.lastT(),t),n.computedCenter},enumerable:!0},eye:{get:function(){return n.computedEye},set:function(t){return n.lookAt(n.lastT(),null,t),n.computedEye},enumerable:!0},up:{get:function(){return n.computedUp},set:function(t){return n.lookAt(n.lastT(),null,null,t),n.computedUp},enumerable:!0},distance:{get:function(){return u},set:function(t){return n.setDistance(n.lastT(),t),t},enumerable:!0},distanceLimits:{get:function(){return n.getDistanceLimits(r)},set:function(t){return n.setDistanceLimits(t),t},enumerable:!0}}),t.addEventListener("contextmenu",function(t){return t.preventDefault(),!1});var d=0,p=0;return a(t,function(e,r,o,a){var s=1/t.clientHeight,l=s*(r-d),c=s*(o-p),h=f.flipX?1:-1,v=f.flipY?1:-1,m=Math.PI*f.rotateSpeed,g=i();if(1&e)a.shift?n.rotate(g,0,0,-l*m):n.rotate(g,h*m*l,-v*m*c,0);else if(2&e)n.pan(g,-f.translateSpeed*l*u,f.translateSpeed*c*u,0);else if(4&e){var y=f.zoomSpeed*c/window.innerHeight*(g-n.lastT())*50;n.pan(g,0,0,u*(Math.exp(y)-1))}d=r,p=o}),s(t,function(t,e,r){var o=f.flipX?1:-1,a=f.flipY?1:-1,s=i();if(Math.abs(t)>Math.abs(e))n.rotate(s,0,0,-t*o*Math.PI*f.rotateSpeed/window.innerWidth);else{var l=f.zoomSpeed*a*e/window.innerHeight*(s-n.lastT())/100;n.pan(s,0,0,u*(Math.exp(l)-1))}},!0),f}e.exports=n;var i=t("right-now"),o=t("3d-view"),a=t("mouse-change"),s=t("mouse-wheel")},{"3d-view":40,"mouse-change":421,"mouse-wheel":425,"right-now":435}],174:[function(t,e,r){!function(){"use strict";function t(e){e.permitHostObjects___&&e.permitHostObjects___(t)}function r(t){return!(t.substr(0,d.length)==d&&"___"===t.substr(t.length-3))}function n(t){if(t!==Object(t))throw new TypeError("Not an object: "+t);var e=t[p];if(e&&e.key===t)return e;if(f(t)){e={key:t};try{return h(t,p,{value:e,writable:!1,enumerable:!1,configurable:!1}),e}catch(r){return}}}function i(t){return t.prototype=null,Object.freeze(t)}function o(){y||"undefined"==typeof console||(y=!0,console.warn("WeakMap should be invoked as new WeakMap(), not WeakMap(). This will be an error in the future."))}if("undefined"==typeof ses||!ses.ok||ses.ok()){"undefined"!=typeof ses&&(ses.weakMapPermitHostObjects=t);var a=!1;if("function"==typeof WeakMap){var s=WeakMap;if("undefined"!=typeof navigator&&/Firefox/.test(navigator.userAgent));else{var l=new s,u=Object.freeze({});if(l.set(u,1),1===l.get(u))return void(e.exports=WeakMap);a=!0}}var c=(Object.prototype.hasOwnProperty,Object.getOwnPropertyNames),h=Object.defineProperty,f=Object.isExtensible,d="weakmap:",p=d+"ident:"+Math.random()+"___";if("undefined"!=typeof crypto&&"function"==typeof crypto.getRandomValues&&"function"==typeof ArrayBuffer&&"function"==typeof Uint8Array){var v=new ArrayBuffer(25),m=new Uint8Array(v);crypto.getRandomValues(m),p=d+"rand:"+Array.prototype.map.call(m,function(t){return(t%36).toString(36)}).join("")+"___"}if(h(Object,"getOwnPropertyNames",{value:function(t){return c(t).filter(r)}}),"getPropertyNames"in Object){var g=Object.getPropertyNames;h(Object,"getPropertyNames",{value:function(t){return g(t).filter(r)}})}!function(){var t=Object.freeze;h(Object,"freeze",{value:function(e){return n(e),t(e)}});var e=Object.seal;h(Object,"seal",{value:function(t){return n(t),e(t)}});var r=Object.preventExtensions;h(Object,"preventExtensions",{value:function(t){return n(t),r(t)}})}();var y=!1,b=0,x=function(){function t(t,e){var r,i=n(t);return i?u in i?i[u]:e:(r=s.indexOf(t),r>=0?l[r]:e)}function e(t){var e=n(t);return e?u in e:s.indexOf(t)>=0}function r(t,e){var r,i=n(t);return i?i[u]=e:(r=s.indexOf(t),r>=0?l[r]=e:(r=s.length,l[r]=e,s[r]=t)),this}function a(t){var e,r,i=n(t);return i?u in i&&delete i[u]:(e=s.indexOf(t),0>e?!1:(r=s.length-1,s[e]=void 0,l[e]=l[r],s[e]=s[r],s.length=r,l.length=r,!0))}this instanceof x||o();var s=[],l=[],u=b++;return Object.create(x.prototype,{get___:{value:i(t)},has___:{value:i(e)},set___:{value:i(r)},delete___:{value:i(a)}})};x.prototype=Object.create(Object.prototype,{get:{value:function(t,e){return this.get___(t,e)},writable:!0,configurable:!0},has:{value:function(t){return this.has___(t)},writable:!0,configurable:!0},set:{value:function(t,e){return this.set___(t,e)},writable:!0,configurable:!0},"delete":{value:function(t){return this.delete___(t)},writable:!0,configurable:!0}}),"function"==typeof s?!function(){function r(){function e(t,e){return c?u.has(t)?u.get(t):c.get___(t,e):u.get(t,e)}function r(t){return u.has(t)||(c?c.has___(t):!1)}function n(t){var e=!!u.delete(t);return c?c.delete___(t)||e:e}this instanceof x||o();var l,u=new s,c=void 0,h=!1;return l=a?function(t,e){return u.set(t,e),u.has(t)||(c||(c=new x),c.set(t,e)),this}:function(t,e){if(h)try{u.set(t,e)}catch(r){c||(c=new x),c.set___(t,e)}else u.set(t,e);return this},Object.create(x.prototype,{get___:{value:i(e)},has___:{value:i(r)},set___:{value:i(l)},delete___:{value:i(n)},permitHostObjects___:{value:i(function(e){if(e!==t)throw new Error("bogus call to permitHostObjects___");h=!0})}})}a&&"undefined"!=typeof Proxy&&(Proxy=void 0),r.prototype=x.prototype,e.exports=r,Object.defineProperty(WeakMap.prototype,"constructor",{value:WeakMap,enumerable:!1,configurable:!0,writable:!0})}():("undefined"!=typeof Proxy&&(Proxy=void 0),e.exports=x)}}()},{}],175:[function(t,e,r){"use strict";function n(t){var e=s.get(t);if(!e||!t.isBuffer(e._triangleBuffer.buffer)){var r=o(t,new Float32Array([-1,-1,-1,4,4,-1]));e=a(t,[{buffer:r,type:t.FLOAT,size:2}]),e._triangleBuffer=r,s.set(t,e)}e.bind(),t.drawArrays(t.TRIANGLES,0,3),e.unbind()}var i="undefined"==typeof WeakMap?t("weak-map"):WeakMap,o=t("gl-buffer"),a=t("gl-vao"),s=new i;e.exports=n},{"gl-buffer":124,"gl-vao":232,"weak-map":174}],176:[function(t,e,r){"use strict";function n(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function i(t){this.gl=t,this.pixelRatio=1,this.bounds=[[-10,-10,-10],[10,10,10]],this.ticks=[[],[],[]],this.autoTicks=!0,this.tickSpacing=[1,1,1],this.tickEnable=[!0,!0,!0],this.tickFont=["sans-serif","sans-serif","sans-serif"],this.tickSize=[12,12,12],this.tickAngle=[0,0,0],this.tickColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.tickPad=[10,10,10],this.lastCubeProps={cubeEdges:[0,0,0],axis:[0,0,0]},this.labels=["x","y","z"],this.labelEnable=[!0,!0,!0],this.labelFont="sans-serif",this.labelSize=[20,20,20],this.labelAngle=[0,0,0],this.labelColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.labelPad=[10,10,10],this.lineEnable=[!0,!0,!0],this.lineMirror=[!1,!1,!1],this.lineWidth=[1,1,1],this.lineColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.lineTickEnable=[!0,!0,!0],this.lineTickMirror=[!1,!1,!1],this.lineTickLength=[0,0,0],this.lineTickWidth=[1,1,1],this.lineTickColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.gridEnable=[!0,!0,!0],this.gridWidth=[1,1,1],this.gridColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.zeroEnable=[!0,!0,!0],this.zeroLineColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.zeroLineWidth=[2,2,2],this.backgroundEnable=[!1,!1,!1],this.backgroundColor=[[.8,.8,.8,.5],[.8,.8,.8,.5],[.8,.8,.8,.5]],this._firstInit=!0,this._text=null,this._lines=null,this._background=c(t)}function o(){this.primalOffset=[0,0,0],this.primalMinor=[0,0,0],this.mirrorOffset=[0,0,0],this.mirrorMinor=[0,0,0]}function a(t,e,r,n,i){for(var o=t.primalOffset,a=t.primalMinor,s=t.mirrorOffset,l=t.mirrorMinor,u=n[e],c=0;3>c;++c)if(e!==c){var h=o,f=s,d=a,p=l;u&1<<c&&(h=s,f=o,d=l,p=a),h[c]=r[0][c],f[c]=r[1][c],i[c]>0?(d[c]=-1,p[c]=0):(d[c]=0,p[c]=1)}}function s(t,e){var r=new i(t);return r.update(e),r}e.exports=s;var l=t("./lib/text.js"),u=t("./lib/lines.js"),c=t("./lib/background.js"),h=t("./lib/cube.js"),f=t("./lib/ticks.js"),d=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),p=i.prototype;p.update=function(t){function e(e,r,n){if(n in t){var i,o=t[n],a=this[n];(e?Array.isArray(o)&&Array.isArray(o[0]):Array.isArray(o))?this[n]=i=[r(o[0]),r(o[1]),r(o[2])]:this[n]=i=[r(o),r(o),r(o)];for(var s=0;3>s;++s)if(i[s]!==a[s])return!0}return!1}t=t||{};var r,n=e.bind(this,!1,Number),i=e.bind(this,!1,Boolean),o=e.bind(this,!1,String),a=e.bind(this,!0,function(t){if(Array.isArray(t)){if(3===t.length)return[+t[0],+t[1],+t[2],1];if(4===t.length)return[+t[0],+t[1],+t[2],+t[3]]}return[0,0,0,1]}),s=!1,c=!1;if("bounds"in t)for(var h=t.bounds,d=0;2>d;++d)for(var p=0;3>p;++p)h[d][p]!==this.bounds[d][p]&&(c=!0),this.bounds[d][p]=h[d][p];if("ticks"in t){r=t.ticks,s=!0,this.autoTicks=!1;for(var d=0;3>d;++d)this.tickSpacing[d]=0}else n("tickSpacing")&&(this.autoTicks=!0,c=!0);if(this._firstInit&&("ticks"in t||"tickSpacing"in t||(this.autoTicks=!0),c=!0,s=!0,this._firstInit=!1),c&&this.autoTicks&&(r=f.create(this.bounds,this.tickSpacing),s=!0),s){for(var d=0;3>d;++d)r[d].sort(function(t,e){return t.x-e.x});f.equal(r,this.ticks)?s=!1:this.ticks=r}i("tickEnable"),o("tickFont")&&(s=!0),n("tickSize"),n("tickAngle"),n("tickPad"),a("tickColor");var v=o("labels");o("labelFont")&&(v=!0),i("labelEnable"),n("labelSize"),n("labelPad"),a("labelColor"),i("lineEnable"),i("lineMirror"),n("lineWidth"),a("lineColor"),i("lineTickEnable"),i("lineTickMirror"),n("lineTickLength"),n("lineTickWidth"),a("lineTickColor"),i("gridEnable"),n("gridWidth"),a("gridColor"),i("zeroEnable"),a("zeroLineColor"),n("zeroLineWidth"),i("backgroundEnable"),a("backgroundColor"),this._text?this._text&&(v||s)&&this._text.update(this.bounds,this.labels,this.labelFont,this.ticks,this.tickFont):this._text=l(this.gl,this.bounds,this.labels,this.labelFont,this.ticks,this.tickFont),this._lines&&s&&(this._lines.dispose(),this._lines=null),this._lines||(this._lines=u(this.gl,this.bounds,this.ticks))};var v=[new o,new o,new o],m=[0,0,0],g={model:d,view:d,projection:d};p.isOpaque=function(){return!0},p.isTransparent=function(){return!1},p.drawTransparent=function(t){};var y=[0,0,0],b=[0,0,0],x=[0,0,0];p.draw=function(t){t=t||g;for(var e=this.gl,r=t.model||d,i=t.view||d,o=t.projection||d,s=this.bounds,l=h(r,i,o,s),u=l.cubeEdges,c=l.axis,f=i[12],p=i[13],_=i[14],w=i[15],M=this.pixelRatio*(o[3]*f+o[7]*p+o[11]*_+o[15]*w)/e.drawingBufferHeight,k=0;3>k;++k)this.lastCubeProps.cubeEdges[k]=u[k],this.lastCubeProps.axis[k]=c[k];for(var A=v,k=0;3>k;++k)a(v[k],k,this.bounds,u,c);for(var e=this.gl,T=m,k=0;3>k;++k)this.backgroundEnable[k]?T[k]=c[k]:T[k]=0;this._background.draw(r,i,o,s,T,this.backgroundColor),this._lines.bind(r,i,o,this);for(var k=0;3>k;++k){var E=[0,0,0];c[k]>0?E[k]=s[1][k]:E[k]=s[0][k];for(var S=0;2>S;++S){var L=(k+1+S)%3,z=(k+1+(1^S))%3;this.gridEnable[L]&&this._lines.drawGrid(L,z,this.bounds,E,this.gridColor[L],this.gridWidth[L]*this.pixelRatio)}for(var S=0;2>S;++S){var L=(k+1+S)%3,z=(k+1+(1^S))%3;this.zeroEnable[z]&&s[0][z]<=0&&s[1][z]>=0&&this._lines.drawZero(L,z,this.bounds,E,this.zeroLineColor[z],this.zeroLineWidth[z]*this.pixelRatio)}}for(var k=0;3>k;++k){this.lineEnable[k]&&this._lines.drawAxisLine(k,this.bounds,A[k].primalOffset,this.lineColor[k],this.lineWidth[k]*this.pixelRatio),this.lineMirror[k]&&this._lines.drawAxisLine(k,this.bounds,A[k].mirrorOffset,this.lineColor[k],this.lineWidth[k]*this.pixelRatio);for(var I=n(y,A[k].primalMinor),P=n(b,A[k].mirrorMinor),C=this.lineTickLength,S=0;3>S;++S){var R=M/r[5*S];I[S]*=C[S]*R,P[S]*=C[S]*R}this.lineTickEnable[k]&&this._lines.drawAxisTicks(k,A[k].primalOffset,I,this.lineTickColor[k],this.lineTickWidth[k]*this.pixelRatio),this.lineTickMirror[k]&&this._lines.drawAxisTicks(k,A[k].mirrorOffset,P,this.lineTickColor[k],this.lineTickWidth[k]*this.pixelRatio)}this._text.bind(r,i,o,this.pixelRatio);for(var k=0;3>k;++k){for(var D=A[k].primalMinor,O=n(x,A[k].primalOffset),S=0;3>S;++S)this.lineTickEnable[k]&&(O[S]+=M*D[S]*Math.max(this.lineTickLength[S],0)/r[5*S]);if(this.tickEnable[k]){for(var S=0;3>S;++S)O[S]+=M*D[S]*this.tickPad[S]/r[5*S];this._text.drawTicks(k,this.tickSize[k],this.tickAngle[k],O,this.tickColor[k])}if(this.labelEnable[k]){for(var S=0;3>S;++S)O[S]+=M*D[S]*this.labelPad[S]/r[5*S];O[k]+=.5*(s[0][k]+s[1][k]),this._text.drawLabel(k,this.labelSize[k],this.labelAngle[k],O,this.labelColor[k])}}},p.dispose=function(){this._text.dispose(),this._lines.dispose(),this._background.dispose(),this._lines=null,this._text=null,this._background=null,this.gl=null}},{"./lib/background.js":177,"./lib/cube.js":178,"./lib/lines.js":179,"./lib/text.js":181,"./lib/ticks.js":182}],177:[function(t,e,r){"use strict";function n(t,e,r,n){this.gl=t,this.buffer=e,this.vao=r,this.shader=n}function i(t){for(var e=[],r=[],i=0,l=0;3>l;++l)for(var u=(l+1)%3,c=(l+2)%3,h=[0,0,0],f=[0,0,0],d=-1;1>=d;d+=2){r.push(i,i+2,i+1,i+1,i+2,i+3),h[l]=d,f[l]=d;for(var p=-1;1>=p;p+=2){h[u]=p;for(var v=-1;1>=v;v+=2)h[c]=v,e.push(h[0],h[1],h[2],f[0],f[1],f[2]),i+=1}var m=u;u=c,c=m}var g=o(t,new Float32Array(e)),y=o(t,new Uint16Array(r),t.ELEMENT_ARRAY_BUFFER),b=a(t,[{buffer:g,type:t.FLOAT,size:3,offset:0,stride:24},{buffer:g,type:t.FLOAT,size:3,offset:12,stride:24}],y),x=s(t);return x.attributes.position.location=0,x.attributes.normal.location=1,new n(t,g,b,x)}e.exports=i;var o=t("gl-buffer"),a=t("gl-vao"),s=t("./shaders").bg,l=n.prototype;l.draw=function(t,e,r,n,i,o){for(var a=!1,s=0;3>s;++s)a=a||i[s];if(a){var l=this.gl;l.enable(l.POLYGON_OFFSET_FILL),l.polygonOffset(1,2),this.shader.bind(),this.shader.uniforms={model:t,view:e,projection:r,bounds:n,enable:i,colors:o},this.vao.bind(),this.vao.draw(this.gl.TRIANGLES,36),l.disable(l.POLYGON_OFFSET_FILL)}},l.dispose=function(){this.vao.dispose(),this.buffer.dispose(),this.shader.dispose()}},{"./shaders":180,"gl-buffer":124,"gl-vao":232}],178:[function(t,e,r){"use strict";function n(t,e,r){for(var n=0;4>n;++n){t[n]=r[12+n];for(var i=0;3>i;++i)t[n]+=e[i]*r[4*i+n]}}function i(t){for(var e=0;e<v.length;++e)if(t=l.positive(t,v[e]),t.length<3)return 0;for(var r=t[0],n=r[0]/r[3],i=r[1]/r[3],o=0,e=1;e+1<t.length;++e){var a=t[e],s=t[e+1],u=a[0]/a[3],c=a[1]/a[3],h=s[0]/s[3],f=s[1]/s[3],d=u-n,p=c-i,m=h-n,g=f-i;o+=Math.abs(d*g-p*m)}return o}function o(t,e,r,o){s(c,e,t),s(c,r,c);for(var l=0,v=0;2>v;++v){d[2]=o[v][2];for(var b=0;2>b;++b){d[1]=o[b][1];for(var x=0;2>x;++x)d[0]=o[x][0],n(h[l],d,c),l+=1}}for(var _=-1,v=0;8>v;++v){for(var w=h[v][3],M=0;3>M;++M)f[v][M]=h[v][M]/w;0>w&&(0>_?_=v:f[v][2]<f[_][2]&&(_=v))}if(0>_){_=0;for(var k=0;3>k;++k){for(var A=(k+2)%3,T=(k+1)%3,E=-1,S=-1,L=0;2>L;++L){var z=L<<k,I=z+(L<<A)+(1-L<<T),P=z+(1-L<<A)+(L<<T);u(f[z],f[I],f[P],p)<0||(L?E=1:S=1)}if(0>E||0>S)S>E&&(_|=1<<k);else{for(var L=0;2>L;++L){var z=L<<k,I=z+(L<<A)+(1-L<<T),P=z+(1-L<<A)+(L<<T),C=i([h[z],h[I],h[P],h[z+(1<<A)+(1<<T)]]);L?E=C:S=C}S>E&&(_|=1<<k)}}}for(var R=7^_,D=-1,v=0;8>v;++v)v!==_&&v!==R&&(0>D?D=v:f[D][1]>f[v][1]&&(D=v));for(var O=-1,v=0;3>v;++v){var F=D^1<<v;if(F!==_&&F!==R){0>O&&(O=F);var T=f[F];T[0]<f[O][0]&&(O=F)}}for(var j=-1,v=0;3>v;++v){var F=D^1<<v;if(F!==_&&F!==R&&F!==O){0>j&&(j=F);var T=f[F];T[0]>f[j][0]&&(j=F)}}var N=m;N[0]=N[1]=N[2]=0,N[a.log2(O^D)]=D&O,N[a.log2(D^j)]=D&j;var B=7^j;B===_||B===R?(B=7^O,N[a.log2(j^B)]=B&j):N[a.log2(O^B)]=B&O;for(var U=g,V=_,k=0;3>k;++k)V&1<<k?U[k]=-1:U[k]=1;return y}e.exports=o;var a=t("bit-twiddle"),s=t("gl-mat4/multiply"),l=(t("gl-mat4/invert"),t("split-polygon")),u=t("robust-orientation"),c=new Array(16),h=(new Array(16),new Array(8)),f=new Array(8),d=new Array(3),p=[0,0,0];!function(){for(var t=0;8>t;++t)h[t]=[1,1,1,1],f[t]=[1,1,1]}();var v=[[0,0,1,0,0],[0,0,-1,1,0],[0,-1,0,1,0],[0,1,0,1,0],[-1,0,0,1,0],[1,0,0,1,0]],m=[1,1,1],g=[0,0,0],y={cubeEdges:m,axis:g}},{"bit-twiddle":51,"gl-mat4/invert":143,"gl-mat4/multiply":145,"robust-orientation":439,"split-polygon":184}],179:[function(t,e,r){"use strict";function n(t){return t[0]=t[1]=t[2]=0,t}function i(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function o(t,e,r,n,i,o,a,s){this.gl=t,this.vertBuffer=e,this.vao=r,this.shader=n,this.tickCount=i,this.tickOffset=o,this.gridCount=a,this.gridOffset=s}function a(t,e,r){var n=[],i=[0,0,0],a=[0,0,0],c=[0,0,0],h=[0,0,0];n.push(0,0,1,0,1,1,0,0,-1,0,0,-1,0,1,1,0,1,-1);for(var f=0;3>f;++f){for(var d=n.length/3|0,p=0;p<r[f].length;++p){var v=+r[f][p].x;n.push(v,0,1,v,1,1,v,0,-1,v,0,-1,v,1,1,v,1,-1)}var m=n.length/3|0;i[f]=d,a[f]=m-d;for(var d=n.length/3|0,g=0;g<r[f].length;++g){var v=+r[f][g].x;n.push(v,0,1,v,1,1,v,0,-1,v,0,-1,v,1,1,v,1,-1)}var m=n.length/3|0;c[f]=d,h[f]=m-d}var y=s(t,new Float32Array(n)),b=l(t,[{buffer:y,type:t.FLOAT,size:3,stride:0,offset:0}]),x=u(t);return x.attributes.position.location=0,new o(t,y,b,x,a,i,h,c)}e.exports=a;var s=t("gl-buffer"),l=t("gl-vao"),u=t("./shaders").line,c=[0,0,0],h=[0,0,0],f=[0,0,0],d=[0,0,0],p=[1,1],v=o.prototype;v.bind=function(t,e,r){this.shader.bind(),this.shader.uniforms.model=t,this.shader.uniforms.view=e,this.shader.uniforms.projection=r,p[0]=this.gl.drawingBufferWidth,p[1]=this.gl.drawingBufferHeight,this.shader.uniforms.screenShape=p,this.vao.bind()},v.drawAxisLine=function(t,e,r,o,a){var s=n(h);this.shader.uniforms.majorAxis=h,s[t]=e[1][t]-e[0][t],this.shader.uniforms.minorAxis=s;var l=i(d,r);l[t]+=e[0][t],this.shader.uniforms.offset=l,this.shader.uniforms.lineWidth=a,this.shader.uniforms.color=o;var u=n(f);u[(t+2)%3]=1,this.shader.uniforms.screenAxis=u,this.vao.draw(this.gl.TRIANGLES,6);var u=n(f);u[(t+1)%3]=1,this.shader.uniforms.screenAxis=u,this.vao.draw(this.gl.TRIANGLES,6)},v.drawAxisTicks=function(t,e,r,i,o){
if(this.tickCount[t]){var a=n(c);a[t]=1,this.shader.uniforms.majorAxis=a,this.shader.uniforms.offset=e,this.shader.uniforms.minorAxis=r,this.shader.uniforms.color=i,this.shader.uniforms.lineWidth=o;var s=n(f);s[t]=1,this.shader.uniforms.screenAxis=s,this.vao.draw(this.gl.TRIANGLES,this.tickCount[t],this.tickOffset[t])}},v.drawGrid=function(t,e,r,o,a,s){if(this.gridCount[t]){var l=n(h);l[e]=r[1][e]-r[0][e],this.shader.uniforms.minorAxis=l;var u=i(d,o);u[e]+=r[0][e],this.shader.uniforms.offset=u;var p=n(c);p[t]=1,this.shader.uniforms.majorAxis=p;var v=n(f);v[t]=1,this.shader.uniforms.screenAxis=v,this.shader.uniforms.lineWidth=s,this.shader.uniforms.color=a,this.vao.draw(this.gl.TRIANGLES,this.gridCount[t],this.gridOffset[t])}},v.drawZero=function(t,e,r,o,a,s){var l=n(h);this.shader.uniforms.majorAxis=l,l[t]=r[1][t]-r[0][t],this.shader.uniforms.minorAxis=l;var u=i(d,o);u[t]+=r[0][t],this.shader.uniforms.offset=u;var c=n(f);c[e]=1,this.shader.uniforms.screenAxis=c,this.shader.uniforms.lineWidth=s,this.shader.uniforms.color=a,this.vao.draw(this.gl.TRIANGLES,6)},v.dispose=function(){this.vao.dispose(),this.vertBuffer.dispose(),this.shader.dispose()}},{"./shaders":180,"gl-buffer":124,"gl-vao":232}],180:[function(t,e,r){"use strict";var n=t("gl-shader"),i="#define GLSLIFY 1\nattribute vec3 position;\n\nuniform mat4 model, view, projection;\nuniform vec3 offset, majorAxis, minorAxis, screenAxis;\nuniform float lineWidth;\nuniform vec2 screenShape;\n\nvec3 project(vec3 p) {\n  vec4 pp = projection * view * model * vec4(p, 1.0);\n  return pp.xyz / max(pp.w, 0.0001);\n}\n\nvoid main() {\n  vec3 major = position.x * majorAxis;\n  vec3 minor = position.y * minorAxis;\n\n  vec3 vPosition = major + minor + offset;\n  vec3 pPosition = project(vPosition);\n  vec3 offset = project(vPosition + screenAxis * position.z);\n\n  vec2 screen = normalize((offset - pPosition).xy * screenShape) / screenShape;\n\n  gl_Position = vec4(pPosition + vec3(0.5 * screen * lineWidth, 0), 1.0);\n}\n",o="precision mediump float;\n#define GLSLIFY 1\nuniform vec4 color;\nvoid main() {\n  gl_FragColor = color;\n}";r.line=function(t){return n(t,i,o,null,[{name:"position",type:"vec3"}])};var a="#define GLSLIFY 1\nattribute vec3 position;\n\nuniform mat4 model, view, projection;\nuniform vec3 offset, axis;\nuniform float scale, angle, pixelScale;\nuniform vec2 resolution;\n\nvoid main() {  \n  //Compute plane offset\n  vec2 planeCoord = position.xy * pixelScale;\n  mat2 planeXform = scale * mat2(cos(angle), sin(angle),\n                                -sin(angle), cos(angle));\n  vec2 viewOffset = 2.0 * planeXform * planeCoord / resolution;\n\n  //Compute world offset\n  float axisDistance = position.z;\n  vec3 dataPosition = axisDistance * axis + offset;\n  vec4 worldPosition = model * vec4(dataPosition, 1);\n  \n  //Compute clip position\n  vec4 viewPosition = view * worldPosition;\n  vec4 clipPosition = projection * viewPosition;\n  clipPosition /= clipPosition.w;\n\n  //Apply text offset in clip coordinates\n  clipPosition += vec4(viewOffset, 0, 0);\n\n  //Done\n  gl_Position = clipPosition;\n}",s="precision mediump float;\n#define GLSLIFY 1\nuniform vec4 color;\nvoid main() {\n  gl_FragColor = color;\n}";r.text=function(t){return n(t,a,s,null,[{name:"position",type:"vec3"}])};var l="#define GLSLIFY 1\nattribute vec3 position;\nattribute vec3 normal;\n\nuniform mat4 model, view, projection;\nuniform vec3 enable;\nuniform vec3 bounds[2];\n\nvarying vec3 colorChannel;\n\nvoid main() {\n  if(dot(normal, enable) > 0.0) {\n    vec3 nPosition = mix(bounds[0], bounds[1], 0.5 * (position + 1.0));\n    gl_Position = projection * view * model * vec4(nPosition, 1.0);\n  } else {\n    gl_Position = vec4(0,0,0,0);\n  }\n  colorChannel = abs(normal);\n}",u="precision mediump float;\n#define GLSLIFY 1\n\nuniform vec4 colors[3];\n\nvarying vec3 colorChannel;\n\nvoid main() {\n  gl_FragColor = colorChannel.x * colors[0] + \n                 colorChannel.y * colors[1] +\n                 colorChannel.z * colors[2];\n}";r.bg=function(t){return n(t,l,u,null,[{name:"position",type:"vec3"},{name:"normal",type:"vec3"}])}},{"gl-shader":203}],181:[function(t,e,r){(function(r){"use strict";function n(t,e,r,n){this.gl=t,this.shader=e,this.buffer=r,this.vao=n,this.tickOffset=this.tickCount=this.labelOffset=this.labelCount=null}function i(t,e){try{return l(t,e)}catch(r){return console.warn("error vectorizing text:",r),{cells:[],positions:[]}}}function o(t,e,r,i,o,l){var c=a(t),h=s(t,[{buffer:c,size:3}]),f=u(t);f.attributes.position.location=0;var d=new n(t,f,c,h);return d.update(e,r,i,o,l),d}e.exports=o;var a=t("gl-buffer"),s=t("gl-vao"),l=t("vectorize-text"),u=t("./shaders").text,c=window||r.global||{},h=c.__TEXT_CACHE||{};c.__TEXT_CACHE={};var f=3,d=n.prototype,p=[0,0];d.bind=function(t,e,r,n){this.vao.bind(),this.shader.bind();var i=this.shader.uniforms;i.model=t,i.view=e,i.projection=r,i.pixelScale=n,p[0]=this.gl.drawingBufferWidth,p[1]=this.gl.drawingBufferHeight,this.shader.uniforms.resolution=p},d.update=function(t,e,r,n,o){function a(t,e,r,n){var o=h[r];o||(o=h[r]={});var a=o[e];a||(a=o[e]=i(e,{triangles:!0,font:r,textAlign:"center",textBaseline:"middle"}));for(var l=(n||12)/12,u=a.positions,c=a.cells,f=0,d=c.length;d>f;++f)for(var p=c[f],v=2;v>=0;--v){var m=u[p[v]];s.push(l*m[0],-l*m[1],t)}}for(var s=(this.gl,[]),l=[0,0,0],u=[0,0,0],c=[0,0,0],d=[0,0,0],p=0;3>p;++p){c[p]=s.length/f|0,a(.5*(t[0][p]+t[1][p]),e[p],r),d[p]=(s.length/f|0)-c[p],l[p]=s.length/f|0;for(var v=0;v<n[p].length;++v)n[p][v].text&&a(n[p][v].x,n[p][v].text,n[p][v].font||o,n[p][v].fontSize||12);u[p]=(s.length/f|0)-l[p]}this.buffer.update(s),this.tickOffset=l,this.tickCount=u,this.labelOffset=c,this.labelCount=d};var v=[0,0,0];d.drawTicks=function(t,e,r,n,i){if(this.tickCount[t]){var o=v;o[0]=o[1]=o[2]=0,o[t]=1,this.shader.uniforms.axis=o,this.shader.uniforms.color=i,this.shader.uniforms.angle=r,this.shader.uniforms.scale=e,this.shader.uniforms.offset=n,this.vao.draw(this.gl.TRIANGLES,this.tickCount[t],this.tickOffset[t])}};var m=[0,0,0];d.drawLabel=function(t,e,r,n,i){this.labelCount[t]&&(this.shader.uniforms.axis=m,this.shader.uniforms.color=i,this.shader.uniforms.angle=r,this.shader.uniforms.scale=e,this.shader.uniforms.offset=n,this.vao.draw(this.gl.TRIANGLES,this.labelCount[t],this.labelOffset[t]))},d.dispose=function(){this.shader.dispose(),this.vao.dispose(),this.buffer.dispose()}}).call(this,t("_process"))},{"./shaders":180,_process:60,"gl-buffer":124,"gl-vao":232,"vectorize-text":460}],182:[function(t,e,r){"use strict";function n(t,e){var r=t+"",n=r.indexOf("."),i=0;n>=0&&(i=r.length-n-1);var o=Math.pow(10,i),a=Math.round(t*e*o),s=a+"";if(s.indexOf("e")>=0)return s;var l=a/o,u=a%o;0>a?(l=0|-Math.ceil(l),u=0|-u):(l=0|Math.floor(l),u=0|u);var c=""+l;if(0>a&&(c="-"+c),i){for(var h=""+u;h.length<i;)h="0"+h;return c+"."+h}return c}function i(t,e){for(var r=[],i=0;3>i;++i){for(var o=[],a=(.5*(t[0][i]+t[1][i]),0);a*e[i]<=t[1][i];++a)o.push({x:a*e[i],text:n(e[i],a)});for(var a=-1;a*e[i]>=t[0][i];--a)o.push({x:a*e[i],text:n(e[i],a)});r.push(o)}return r}function o(t,e){for(var r=0;3>r;++r){if(t[r].length!==e[r].length)return!1;for(var n=0;n<t[r].length;++n){var i=t[r][n],o=e[r][n];if(i.x!==o.x||i.text!==o.text)return!1}}return!0}r.create=i,r.equal=o},{}],183:[function(t,e,r){"use strict";function n(t,e,r){var n=e||0,i=r||1;return[[t[12]+t[0],t[13]+t[1],t[14]+t[2],t[15]+t[3]],[t[12]-t[0],t[13]-t[1],t[14]-t[2],t[15]-t[3]],[t[12]+t[4],t[13]+t[5],t[14]+t[6],t[15]+t[7]],[t[12]-t[4],t[13]-t[5],t[14]-t[6],t[15]-t[7]],[n*t[12]+t[8],n*t[13]+t[9],n*t[14]+t[10],n*t[15]+t[11]],[i*t[12]-t[8],i*t[13]-t[9],i*t[14]-t[10],i*t[15]-t[11]]]}e.exports=n},{}],184:[function(t,e,r){"use strict";function n(t,e){var r=u(l(t,e),[e[e.length-1]]);return r[r.length-1]}function i(t,e,r,n){var i=n-e,o=-e/i;0>o?o=0:o>1&&(o=1);for(var a=1-o,s=t.length,l=new Array(s),u=0;s>u;++u)l[u]=o*t[u]+a*r[u];return l}function o(t,e){for(var r=[],o=[],a=n(t[t.length-1],e),s=t[t.length-1],l=t[0],u=0;u<t.length;++u,s=l){l=t[u];var c=n(l,e);if(0>a&&c>0||a>0&&0>c){var h=i(s,c,l,a);r.push(h),o.push(h.slice())}0>c?o.push(l.slice()):c>0?r.push(l.slice()):(r.push(l.slice()),o.push(l.slice())),a=c}return{positive:r,negative:o}}function a(t,e){for(var r=[],o=n(t[t.length-1],e),a=t[t.length-1],s=t[0],l=0;l<t.length;++l,a=s){s=t[l];var u=n(s,e);(0>o&&u>0||o>0&&0>u)&&r.push(i(a,u,s,o)),u>=0&&r.push(s.slice()),o=u}return r}function s(t,e){for(var r=[],o=n(t[t.length-1],e),a=t[t.length-1],s=t[0],l=0;l<t.length;++l,a=s){s=t[l];var u=n(s,e);(0>o&&u>0||o>0&&0>u)&&r.push(i(a,u,s,o)),0>=u&&r.push(s.slice()),o=u}return r}var l=t("robust-dot-product"),u=t("robust-sum");e.exports=o,e.exports.positive=a,e.exports.negative=s},{"robust-dot-product":185,"robust-sum":442}],185:[function(t,e,r){"use strict";function n(t,e){for(var r=i(t[0],e[0]),n=1;n<t.length;++n)r=o(r,i(t[n],e[n]));return r}var i=t("two-product"),o=t("robust-sum");e.exports=n},{"robust-sum":442,"two-product":456}],186:[function(t,e,r){"use strict";function n(t,e,r){this.lo=t,this.hi=e,this.pixelsPerDataUnit=r}function i(t,e,r,n,i){for(var o=0;3>o;++o){for(var a=p,s=v,l=0;3>l;++l)s[l]=a[l]=r[l];s[3]=a[3]=1,s[o]+=1,h(s,s,e),s[3]<0&&(t[o]=1/0),a[o]-=1,h(a,a,e),a[3]<0&&(t[o]=1/0);var u=(a[0]/a[3]-s[0]/s[3])*n,c=(a[1]/a[3]-s[1]/s[3])*i;t[o]=.25*Math.sqrt(u*u+c*c)}return t}function o(t,e,r,n,o){var h=e.model||f,p=e.view||f,v=e.projection||f,y=t.bounds,o=o||l(h,p,v,y),b=o.axis;o.edges;u(d,p,h),u(d,v,d);for(var x=m,_=0;3>_;++_)x[_].lo=1/0,x[_].hi=-(1/0),x[_].pixelsPerDataUnit=1/0;var w=a(c(d,d));c(d,d);for(var M=0;3>M;++M){var k=(M+1)%3,A=(M+2)%3,T=g;t:for(var _=0;2>_;++_){var E=[];if(b[M]<0!=!!_){T[M]=y[_][M];for(var S=0;2>S;++S){T[k]=y[S^_][k];for(var L=0;2>L;++L)T[A]=y[L^S^_][A],E.push(T.slice())}for(var S=0;S<w.length;++S){if(0===E.length)continue t;E=s.positive(E,w[S])}for(var S=0;S<E.length;++S)for(var A=E[S],z=i(g,d,A,r,n),L=0;3>L;++L)x[L].lo=Math.min(x[L].lo,A[L]),x[L].hi=Math.max(x[L].hi,A[L]),L!==M&&(x[L].pixelsPerDataUnit=Math.min(x[L].pixelsPerDataUnit,Math.abs(z[L])))}}}return x}e.exports=o;var a=t("extract-frustum-planes"),s=t("split-polygon"),l=t("./lib/cube.js"),u=t("gl-mat4/multiply"),c=t("gl-mat4/transpose"),h=t("gl-vec4/transformMat4"),f=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),d=new Float32Array(16),p=[0,0,0,1],v=[0,0,0,1],m=[new n(1/0,-(1/0),1/0),new n(1/0,-(1/0),1/0),new n(1/0,-(1/0),1/0)],g=[0,0,0]},{"./lib/cube.js":178,"extract-frustum-planes":183,"gl-mat4/multiply":145,"gl-mat4/transpose":153,"gl-vec4/transformMat4":233,"split-polygon":184}],187:[function(t,e,r){"use strict";var n=t("gl-shader"),i="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position, color;\nattribute float weight;\n\nuniform mat4 model, view, projection;\nuniform vec3 coordinates[3];\nuniform vec4 colors[3];\nuniform vec2 screenShape;\nuniform float lineWidth;\n\nvarying vec4 fragColor;\n\nvoid main() {\n  vec3 vertexPosition = mix(coordinates[0],\n    mix(coordinates[2], coordinates[1], 0.5 * (position + 1.0)), abs(position));\n\n  vec4 clipPos = projection * view * model * vec4(vertexPosition, 1.0);\n  vec2 clipOffset = (projection * view * model * vec4(color, 0.0)).xy;\n  vec2 delta = weight * clipOffset * screenShape;\n  vec2 lineOffset = normalize(vec2(delta.y, -delta.x)) / screenShape;\n\n  gl_Position   = vec4(clipPos.xy + clipPos.w * 0.5 * lineWidth * lineOffset, clipPos.z, clipPos.w);\n  fragColor     = color.x * colors[0] + color.y * colors[1] + color.z * colors[2];\n}\n",o="precision mediump float;\n#define GLSLIFY 1\n\nvarying vec4 fragColor;\n\nvoid main() {\n  gl_FragColor = fragColor;\n}";e.exports=function(t){return n(t,i,o,null,[{name:"position",type:"vec3"},{name:"color",type:"vec3"},{name:"weight",type:"float"}])}},{"gl-shader":203}],188:[function(t,e,r){"use strict";function n(t,e,r,n){this.gl=t,this.buffer=e,this.vao=r,this.shader=n,this.pixelRatio=1,this.bounds=[[-1e3,-1e3,-1e3],[1e3,1e3,1e3]],this.position=[0,0,0],this.lineWidth=[2,2,2],this.colors=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.enabled=[!0,!0,!0],this.drawSides=[!0,!0,!0],this.axes=null}function i(t,e){function r(t,e,r,n,o,a){var s=[t,e,r,0,0,0,1];s[n+3]=1,s[n]=o,i.push.apply(i,s),s[6]=-1,i.push.apply(i,s),s[n]=a,i.push.apply(i,s),i.push.apply(i,s),s[6]=1,i.push.apply(i,s),s[n]=o,i.push.apply(i,s)}var i=[];r(0,0,0,0,0,1),r(0,0,0,1,0,1),r(0,0,0,2,0,1),r(1,0,0,1,-1,1),r(1,0,0,2,-1,1),r(0,1,0,0,-1,1),r(0,1,0,2,-1,1),r(0,0,1,0,-1,1),r(0,0,1,1,-1,1);var l=o(t,i),u=a(t,[{type:t.FLOAT,buffer:l,size:3,offset:0,stride:28},{type:t.FLOAT,buffer:l,size:3,offset:12,stride:28},{type:t.FLOAT,buffer:l,size:1,offset:24,stride:28}]),c=s(t);c.attributes.position.location=0,c.attributes.color.location=1,c.attributes.weight.location=2;var h=new n(t,l,u,c);return h.update(e),h}var o=t("gl-buffer"),a=t("gl-vao"),s=t("./shaders/index");e.exports=i;var l=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],u=n.prototype,c=[0,0,0],h=[0,0,0],f=[0,0];u.isTransparent=function(){return!1},u.drawTransparent=function(t){},u.draw=function(t){var e=this.gl,r=this.vao,n=this.shader;r.bind(),n.bind();var i,o=t.model||l,a=t.view||l,s=t.projection||l;this.axes&&(i=this.axes.lastCubeProps.axis);for(var u=c,d=h,p=0;3>p;++p)i&&i[p]<0?(u[p]=this.bounds[0][p],d[p]=this.bounds[1][p]):(u[p]=this.bounds[1][p],d[p]=this.bounds[0][p]);f[0]=e.drawingBufferWidth,f[1]=e.drawingBufferHeight,n.uniforms.model=o,n.uniforms.view=a,n.uniforms.projection=s,n.uniforms.coordinates=[this.position,u,d],n.uniforms.colors=this.colors,n.uniforms.screenShape=f;for(var p=0;3>p;++p)n.uniforms.lineWidth=this.lineWidth[p]*this.pixelRatio,this.enabled[p]&&(r.draw(e.TRIANGLES,6,6*p),this.drawSides[p]&&r.draw(e.TRIANGLES,12,18+12*p));r.unbind()},u.update=function(t){t&&("bounds"in t&&(this.bounds=t.bounds),"position"in t&&(this.position=t.position),"lineWidth"in t&&(this.lineWidth=t.lineWidth),"colors"in t&&(this.colors=t.colors),"enabled"in t&&(this.enabled=t.enabled),"drawSides"in t&&(this.drawSides=t.drawSides))},u.dispose=function(){this.vao.dispose(),this.buffer.dispose(),this.shader.dispose()}},{"./shaders/index":187,"gl-buffer":124,"gl-vao":232}],189:[function(t,e,r){"use strict";function n(){this.mouse=[-1,-1],this.screen=null,this.distance=1/0,this.index=null,this.dataCoordinate=null,this.dataPosition=null,this.object=null,this.data=null}function i(t,e){var r=null;try{r=t.getContext("webgl",e),r||(r=t.getContext("experimental-webgl",e))}catch(n){return null}return r}function o(t){var e=Math.round(Math.log(Math.abs(t))/Math.log(10));if(0>e){var r=Math.round(Math.pow(10,-e));return Math.ceil(t*r)/r}if(e>0){var r=Math.round(Math.pow(10,e));return Math.ceil(t/r)*r}return Math.ceil(t)}function a(t){return"boolean"==typeof t?t:!0}function s(t){function e(){if(!_&&G.autoResize){var t=w.parentNode,e=1,r=1;t&&t!==document.body?(e=t.clientWidth,r=t.clientHeight):(e=window.innerWidth,r=window.innerHeight);var n=0|Math.ceil(e*G.pixelRatio),i=0|Math.ceil(r*G.pixelRatio);if(n!==w.width||i!==w.height){w.width=n,w.height=i;var o=w.style;o.position=o.position||"absolute",o.left="0px",o.top="0px",o.width=e+"px",o.height=r+"px",j=!0}}}function r(){for(var t=R.length,e=F.length,r=0;e>r;++r)O[r]=0;t:for(var r=0;t>r;++r){var n=R[r],i=n.pickSlots;if(i){for(var o=0;e>o;++o)if(O[o]+i<255){D[r]=o,n.setPickBase(O[o]+1),O[o]+=i;continue t}var a=f(k,q);D[r]=e,F.push(a),O.push(i),n.setPickBase(1),e+=1}else D[r]=-1}for(;e>0&&0===O[e-1];)O.pop(),F.pop().dispose()}function s(){return G.contextLost?!0:void(k.isContextLost()&&(G.contextLost=!0,G.mouseListener.enabled=!1,G.selection.object=null,G.oncontextloss&&G.oncontextloss()))}function y(){if(!s()){k.colorMask(!0,!0,!0,!0),k.depthMask(!0),k.disable(k.BLEND),k.enable(k.DEPTH_TEST);for(var t=R.length,e=F.length,r=0;e>r;++r){var n=F[r];n.shape=H,n.begin();for(var i=0;t>i;++i)if(D[i]===r){var o=R[i];o.drawPick&&(o.pixelRatio=1,o.drawPick(V))}n.end()}}}function b(){if(!s()){e();var t=G.camera.tick();V.view=G.camera.matrix,j=j||t,N=N||t,I.pixelRatio=G.pixelRatio,C.pixelRatio=G.pixelRatio;var r=R.length,n=W[0],i=W[1];n[0]=n[1]=n[2]=1/0,i[0]=i[1]=i[2]=-(1/0);for(var a=0;r>a;++a){var l=R[a];l.pixelRatio=G.pixelRatio,l.axes=G.axes,j=j||!!l.dirty,N=N||!!l.dirty;var u=l.bounds;if(u)for(var h=u[0],f=u[1],d=0;3>d;++d)n[d]=Math.min(n[d],h[d]),i[d]=Math.max(i[d],f[d])}var v=G.bounds;if(G.autoBounds)for(var d=0;3>d;++d){if(i[d]<n[d])n[d]=-1,i[d]=1;else{n[d]===i[d]&&(n[d]-=1,i[d]+=1);var g=.05*(i[d]-n[d]);n[d]=n[d]-g,i[d]=i[d]+g}v[0][d]=n[d],v[1][d]=i[d]}for(var b=!1,d=0;3>d;++d)b=b||Z[0][d]!==v[0][d]||Z[1][d]!==v[1][d],Z[0][d]=v[0][d],Z[1][d]=v[1][d];if(b){for(var x=[0,0,0],a=0;3>a;++a)x[a]=o((v[1][a]-v[0][a])/10);I.autoTicks?I.update({bounds:v,tickSpacing:x}):I.update({bounds:v})}N=N||b,j=j||b;var _=k.drawingBufferWidth,w=k.drawingBufferHeight;q[0]=_,q[1]=w,H[0]=0|Math.max(_/G.pixelRatio,1),H[1]=0|Math.max(w/G.pixelRatio,1),m(B,G.fovy,_/w,G.zNear,G.zFar);for(var a=0;16>a;++a)U[a]=0;U[15]=1;for(var M=0,a=0;3>a;++a)M=Math.max(M,v[1][a]-v[0][a]);for(var a=0;3>a;++a)G.autoScale?U[5*a]=G.aspect[a]/(v[1][a]-v[0][a]):U[5*a]=1/M,G.autoCenter&&(U[12+a]=.5*-U[5*a]*(v[0][a]+v[1][a]));for(var a=0;r>a;++a){var l=R[a];l.axesBounds=v,G.clipToBounds&&(l.clipBounds=v)}if(T.object&&(G.snapToData?C.position=T.dataCoordinate:C.position=T.dataPosition,C.bounds=v),N&&(N=!1,y()),j){G.axesPixels=c(G.axes,V,_,w),G.onrender&&G.onrender(),k.bindFramebuffer(k.FRAMEBUFFER,null),k.viewport(0,0,_,w);var A=G.clearColor;k.clearColor(A[0],A[1],A[2],A[3]),k.clear(k.COLOR_BUFFER_BIT|k.DEPTH_BUFFER_BIT),k.depthMask(!0),k.colorMask(!0,!0,!0,!0),k.enable(k.DEPTH_TEST),k.depthFunc(k.LEQUAL),k.disable(k.BLEND),k.disable(k.CULL_FACE);var L=!1;I.enable&&(L=L||I.isTransparent(),I.draw(V)),C.axes=I,T.object&&C.draw(V),k.disable(k.CULL_FACE);for(var a=0;r>a;++a){var l=R[a];l.axes=I,l.pixelRatio=G.pixelRatio,l.isOpaque&&l.isOpaque()&&l.draw(V),l.isTransparent&&l.isTransparent()&&(L=!0)}if(L){E.shape=q,E.bind(),k.clear(k.DEPTH_BUFFER_BIT),k.colorMask(!1,!1,!1,!1),k.depthMask(!0),k.depthFunc(k.LESS),I.enable&&I.isTransparent()&&I.drawTransparent(V);for(var a=0;r>a;++a){var l=R[a];l.isOpaque&&l.isOpaque()&&l.draw(V)}k.enable(k.BLEND),k.blendEquation(k.FUNC_ADD),k.blendFunc(k.ONE,k.ONE_MINUS_SRC_ALPHA),k.colorMask(!0,!0,!0,!0),k.depthMask(!1),k.clearColor(0,0,0,0),k.clear(k.COLOR_BUFFER_BIT),I.isTransparent()&&I.drawTransparent(V);for(var a=0;r>a;++a){var l=R[a];l.isTransparent&&l.isTransparent()&&l.drawTransparent(V)}k.bindFramebuffer(k.FRAMEBUFFER,null),k.blendFunc(k.ONE,k.ONE_MINUS_SRC_ALPHA),k.disable(k.DEPTH_TEST),S.bind(),E.color[0].bind(0),S.uniforms.accumBuffer=0,p(k),k.disable(k.BLEND)}j=!1;for(var a=0;r>a;++a)R[a].dirty=!1}}}function x(){_||G.contextLost||(requestAnimationFrame(x),b())}t=t||{};var _=!1,w=(t.pixelRatio||parseFloat(window.devicePixelRatio),t.canvas);if(!w)if(w=document.createElement("canvas"),t.container){var M=t.container;M.appendChild(w)}else document.body.appendChild(w);var k=t.gl;if(k||(k=i(w,t.glOptions||{premultipliedAlpha:!0,antialias:!0})),!k)throw new Error("webgl not supported");var A=t.bounds||[[-10,-10,-10],[10,10,10]],T=new n,E=d(k,[k.drawingBufferWidth,k.drawingBufferHeight],{preferFloat:!0}),S=g(k),L=t.camera||{eye:[2,0,0],center:[0,0,0],up:[0,1,0],zoomMin:.1,zoomMax:100,mode:"turntable"},z=t.axes||{},I=u(k,z);I.enable=!z.disable;var P=t.spikes||{},C=h(k,P),R=[],D=[],O=[],F=[],j=!0,N=!0,B=new Array(16),U=new Array(16),V={view:null,projection:B,model:U},N=!0,q=[k.drawingBufferWidth,k.drawingBufferHeight],G={gl:k,contextLost:!1,pixelRatio:t.pixelRatio||parseFloat(window.devicePixelRatio),canvas:w,selection:T,camera:l(w,L),axes:I,axesPixels:null,spikes:C,bounds:A,objects:R,shape:q,aspect:t.aspectRatio||[1,1,1],pickRadius:t.pickRadius||10,zNear:t.zNear||.01,zFar:t.zFar||1e3,fovy:t.fovy||Math.PI/4,clearColor:t.clearColor||[0,0,0,0],autoResize:a(t.autoResize),autoBounds:a(t.autoBounds),autoScale:!!t.autoScale,autoCenter:a(t.autoCenter),clipToBounds:a(t.clipToBounds),snapToData:!!t.snapToData,onselect:t.onselect||null,onrender:t.onrender||null,onclick:t.onclick||null,cameraParams:V,oncontextloss:null,mouseListener:null},H=[k.drawingBufferWidth/G.pixelRatio|0,k.drawingBufferHeight/G.pixelRatio|0];G.autoResize&&e(),window.addEventListener("resize",e),G.update=function(t){_||(t=t||{},j=!0,N=!0)},G.add=function(t){_||(t.axes=I,R.push(t),D.push(-1),j=!0,N=!0,r())},G.remove=function(t){if(!_){var e=R.indexOf(t);0>e||(R.splice(e,1),D.pop(),j=!0,N=!0,r())}},G.dispose=function(){if(!_&&(_=!0,window.removeEventListener("resize",e),w.removeEventListener("webglcontextlost",s),G.mouseListener.enabled=!1,!G.contextLost)){I.dispose(),C.dispose();for(var t=0;t<R.length;++t)R[t].dispose();E.dispose();for(var t=0;t<F.length;++t)F[t].dispose();S.dispose(),k=null,I=null,C=null,R=[]}};var X=!1,Y=0;G.mouseListener=v(w,function(t,e,r){if(!_){var n=F.length,i=R.length,o=T.object;T.distance=1/0,T.mouse[0]=e,T.mouse[1]=r,T.object=null,T.screen=null,T.dataCoordinate=T.dataPosition=null;var a=!1;if(t&&Y)X=!0;else{X&&(N=!0),X=!1;for(var s=0;n>s;++s){var l=F[s].query(e,H[1]-r-1,G.pickRadius);if(l){if(l.distance>T.distance)continue;for(var u=0;i>u;++u){var c=R[u];if(D[u]===s){var h=c.pick(l);h&&(T.buttons=t,T.screen=l.coord,T.distance=l.distance,T.object=c,T.index=h.distance,T.dataPosition=h.position,T.dataCoordinate=h.dataCoordinate,T.data=h,a=!0)}}}}}o&&o!==T.object&&(o.highlight&&o.highlight(null),j=!0),T.object&&(T.object.highlight&&T.object.highlight(T.data),j=!0),a=a||T.object!==o,a&&G.onselect&&G.onselect(T),1&t&&!(1&Y)&&G.onclick&&G.onclick(T),Y=t}}),w.addEventListener("webglcontextlost",s);var W=[[1/0,1/0,1/0],[-(1/0),-(1/0),-(1/0)]],Z=[W[0].slice(),W[1].slice()];return x(),G.redraw=function(){_||(j=!0,b())},G}e.exports=s;var l=t("3d-view-controls"),u=t("gl-axes3d"),c=t("gl-axes3d/properties"),h=t("gl-spikes3d"),f=t("gl-select-static"),d=t("gl-fbo"),p=t("a-big-triangle"),v=t("mouse-change"),m=t("gl-mat4/perspective"),g=t("./lib/shader")},{"./lib/shader":172,"3d-view-controls":173,"a-big-triangle":175,"gl-axes3d":176,"gl-axes3d/properties":186,"gl-fbo":129,"gl-mat4/perspective":146,"gl-select-static":202,"gl-spikes3d":188,"mouse-change":421}],190:[function(t,e,r){"use strict";e.exports={vertex:"precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 position;\nattribute vec2 offset;\nattribute vec4 color;\n\nuniform mat3 viewTransform;\nuniform vec2 pixelScale;\n\nvarying vec4 fragColor;\n\nvec4 computePosition_1_0(vec2 position, vec2 offset, mat3 view, vec2 scale) {\n  vec3 xposition = view * vec3(position, 1.0);\n  return vec4(\n    xposition.xy + scale * offset * xposition.z,\n    0,\n    xposition.z);\n}\n\n\n\n\nvoid main() {\n  fragColor = color;\n\n  gl_Position = computePosition_1_0(\n    position,\n    offset,\n    viewTransform,\n    pixelScale);\n}\n",fragment:"precision lowp float;\n#define GLSLIFY 1\nvarying vec4 fragColor;\nvoid main() {\n  gl_FragColor = vec4(fragColor.rgb * fragColor.a, fragColor.a);\n}\n",pickVertex:"precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 position;\nattribute vec2 offset;\nattribute vec4 id;\n\nuniform mat3 viewTransform;\nuniform vec2 pixelScale;\nuniform vec4 pickOffset;\n\nvarying vec4 fragColor;\n\nvec4 computePosition_1_0(vec2 position, vec2 offset, mat3 view, vec2 scale) {\n  vec3 xposition = view * vec3(position, 1.0);\n  return vec4(\n    xposition.xy + scale * offset * xposition.z,\n    0,\n    xposition.z);\n}\n\n\n\n\nvoid main() {\n  vec4 fragId = id + pickOffset;\n\n  fragId.y += floor(fragId.x / 256.0);\n  fragId.x -= floor(fragId.x / 256.0) * 256.0;\n\n  fragId.z += floor(fragId.y / 256.0);\n  fragId.y -= floor(fragId.y / 256.0) * 256.0;\n\n  fragId.w += floor(fragId.z / 256.0);\n  fragId.z -= floor(fragId.z / 256.0) * 256.0;\n\n  fragColor = fragId / 255.0;\n\n  gl_Position = computePosition_1_0(\n    position,\n    offset,\n    viewTransform,\n    pixelScale);\n}\n",pickFragment:"precision lowp float;\n#define GLSLIFY 1\nvarying vec4 fragColor;\nvoid main() {\n  gl_FragColor = fragColor;\n}\n"}},{}],191:[function(t,e,r){"use strict";function n(t){if(t in f)return f[t];var e=c(t,{polygons:!0,font:"sans-serif",textAlign:"left",textBaseline:"alphabetic"}),r=[],n=[];e.forEach(function(t){t.forEach(function(t){for(var e=0;e<t.length;++e){var i=t[(e+t.length-1)%t.length],o=t[e],a=t[(e+1)%t.length],s=t[(e+2)%t.length],l=o[0]-i[0],u=o[1]-i[1],c=Math.sqrt(l*l+u*u);l/=c,u/=c,r.push(i[0],i[1]+1.4),n.push(u,-l),r.push(i[0],i[1]+1.4),n.push(-u,l),r.push(o[0],o[1]+1.4),n.push(-u,l),r.push(o[0],o[1]+1.4),n.push(-u,l),r.push(i[0],i[1]+1.4),n.push(u,-l),r.push(o[0],o[1]+1.4),n.push(u,-l);var h=s[0]-a[0],f=s[1]-a[1],d=Math.sqrt(h*h+f*f);h/=d,f/=d,r.push(o[0],o[1]+1.4),n.push(u,-l),r.push(o[0],o[1]+1.4),n.push(-u,l),r.push(a[0],a[1]+1.4),n.push(-f,h),r.push(a[0],a[1]+1.4),n.push(-f,h),r.push(o[0],o[1]+1.4),n.push(f,-h),r.push(a[0],a[1]+1.4),n.push(f,-h)}})});for(var i=[1/0,1/0,-(1/0),-(1/0)],o=0;o<r.length;o+=2)for(var a=0;2>a;++a)i[a]=Math.min(i[a],r[o+a]),i[2+a]=Math.max(i[2+a],r[o+a]);return f[t]={coords:r,normals:n,bounds:i}}function i(t,e,r,n,i,o,a){this.plot=t,this.shader=e,this.pickShader=r,this.positionBuffer=n,this.offsetBuffer=i,this.colorBuffer=o,this.idBuffer=a,this.bounds=[1/0,1/0,-(1/0),-(1/0)],this.numPoints=0,this.numVertices=0,this.pickOffset=0,this.points=null}function o(t,e){var r=t.gl,n=a(r,h.vertex,h.fragment),o=a(r,h.pickVertex,h.pickFragment),l=s(r),u=s(r),c=s(r),f=s(r),d=new i(t,n,o,l,u,c,f);return d.update(e),t.addObject(d),d}e.exports=o;var a=t("gl-shader"),s=t("gl-buffer"),l=t("text-cache"),u=t("typedarray-pool"),c=t("vectorize-text"),h=t("./lib/shaders"),f={},d=i.prototype;!function(){function t(){var t=this.plot,n=this.bounds,i=t.viewBox,o=t.dataBox,a=t.pixelRatio,s=n[2]-n[0],l=n[3]-n[1],u=o[2]-o[0],c=o[3]-o[1];e[0]=2*s/u,e[4]=2*l/c,e[6]=2*(n[0]-o[0])/u-1,e[7]=2*(n[1]-o[1])/c-1;var h=i[2]-i[0],f=i[3]-i[1];r[0]=2*a/h,r[1]=2*a/f}var e=[1,0,0,0,1,0,0,0,1],r=[1,1];d.draw=function(){var n=this.plot,i=this.shader,o=this.numVertices;if(o){var a=n.gl;t.call(this),i.bind(),i.uniforms.pixelScale=r,i.uniforms.viewTransform=e,this.positionBuffer.bind(),i.attributes.position.pointer(),this.offsetBuffer.bind(),i.attributes.offset.pointer(),this.colorBuffer.bind(),i.attributes.color.pointer(a.UNSIGNED_BYTE,!0),a.drawArrays(a.TRIANGLES,0,o)}};var n=[0,0,0,0];d.drawPick=function(i){var o=this.plot,a=this.pickShader,s=this.numVertices,l=o.gl;if(this.pickOffset=i,!s)return i;for(var u=0;4>u;++u)n[u]=i>>8*u&255;return t.call(this),a.bind(),a.uniforms.pixelScale=r,a.uniforms.viewTransform=e,a.uniforms.pickOffset=n,this.positionBuffer.bind(),a.attributes.position.pointer(),this.offsetBuffer.bind(),a.attributes.offset.pointer(),this.idBuffer.bind(),a.attributes.id.pointer(l.UNSIGNED_BYTE,!1),l.drawArrays(l.TRIANGLES,0,s),i+this.numPoints}}(),d.pick=function(t,e,r){var n=this.pickOffset,i=this.numPoints;if(n>r||r>=n+i)return null;var o=r-n,a=this.points;return{object:this,pointId:o,dataCoord:[a[2*o],a[2*o+1]]}},d.update=function(t){t=t||{};var e=t.positions||[],r=t.colors||[],i=t.glyphs||[],o=t.sizes||[],a=t.borderWidths||[],s=t.borderColors||[];this.points=e;for(var c=this.bounds=[1/0,1/0,-(1/0),-(1/0)],h=0,f=0;f<i.length;++f){h+=l("sans-serif",i[f]).data.length+n(i[f]).coords.length>>1;for(var d=0;2>d;++d)c[d]=Math.min(c[d],e[2*f+d]),c[2+d]=Math.max(c[2+d],e[2*f+d])}c[0]===c[2]&&(c[2]+=1),c[3]===c[1]&&(c[3]+=1);for(var p=1/(c[2]-c[0]),v=1/(c[3]-c[1]),m=c[0],g=c[1],y=u.mallocFloat32(2*h),b=u.mallocFloat32(2*h),x=u.mallocUint8(4*h),_=u.mallocUint32(h),w=0,f=0;f<i.length;++f){for(var M=l("sans-serif",i[f]),k=n(i[f]),A=p*(e[2*f]-m),T=v*(e[2*f+1]-g),E=o[f],S=255*r[4*f],L=255*r[4*f+1],z=255*r[4*f+2],I=255*r[4*f+3],P=.5*(k.bounds[0]+k.bounds[2]),C=.5*(k.bounds[1]+k.bounds[3]),d=0;d<M.data.length;d+=2)y[2*w]=A,y[2*w+1]=T,b[2*w]=-E*(M.data[d]-P),b[2*w+1]=-E*(M.data[d+1]-C),x[4*w]=S,x[4*w+1]=L,x[4*w+2]=z,x[4*w+3]=I,_[w]=f,w+=1;var R=a[f];S=255*s[4*f],L=255*s[4*f+1],z=255*s[4*f+2],I=255*s[4*f+3];for(var d=0;d<k.coords.length;d+=2)y[2*w]=A,y[2*w+1]=T,b[2*w]=-(E*(k.coords[d]-P)+R*k.normals[d]),b[2*w+1]=-(E*(k.coords[d+1]-C)+R*k.normals[d+1]),x[4*w]=S,x[4*w+1]=L,x[4*w+2]=z,x[4*w+3]=I,_[w]=f,w+=1}this.numPoints=i.length,this.numVertices=h,this.positionBuffer.update(y),this.offsetBuffer.update(b),this.colorBuffer.update(x),this.idBuffer.update(_),u.free(y),u.free(b),u.free(x),u.free(_)},d.dispose=function(){this.shader.dispose(),this.pickShader.dispose(),this.positionBuffer.dispose(),this.offsetBuffer.dispose(),this.colorBuffer.dispose(),this.idBuffer.dispose(),this.plot.removeObject(this)}},{"./lib/shaders":190,"gl-buffer":124,"gl-shader":203,"text-cache":453,"typedarray-pool":458,"vectorize-text":460}],192:[function(t,e,r){r.pointVertex="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 position;\nattribute float weight;\n\nuniform mat3 matrix;\nuniform float pointSize, useWeight;\n\nvarying float fragWeight;\n\nvoid main() {\n  vec3 hgPosition = matrix * vec3(position, 1);\n  gl_Position  = vec4(hgPosition.xy, 0, hgPosition.z);\n  gl_PointSize = pointSize;\n  fragWeight = mix(1.0, weight, useWeight);\n}\n",r.pointFragment="precision mediump float;\n#define GLSLIFY 1\n\nuniform vec4 color, borderColor;\nuniform float centerFraction;\n\nvarying float fragWeight;\n\nfloat smoothStep(float x, float y) {\n  return 1.0 / (1.0 + exp(50.0*(x - y)));\n}\n\nvoid main() {\n  float radius = length(2.0*gl_PointCoord.xy-1.0);\n  if(radius > 1.0) {\n    discard;\n  }\n  vec4 baseColor = mix(borderColor, color, smoothStep(radius, centerFraction));\n  float alpha = 1.0 - pow(1.0 - baseColor.a, fragWeight);\n  gl_FragColor = vec4(baseColor.rgb * alpha, alpha);\n}\n",r.pickVertex="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 position;\nattribute vec4 pickId;\n\nuniform mat3 matrix;\nuniform float pointSize;\nuniform vec4 pickOffset;\n\nvarying vec4 fragId;\n\nvoid main() {\n  vec3 hgPosition = matrix * vec3(position, 1);\n  gl_Position  = vec4(hgPosition.xy, 0, hgPosition.z);\n  gl_PointSize = pointSize;\n\n  vec4 id = pickId + pickOffset;\n  id.y += floor(id.x / 256.0);\n  id.x -= floor(id.x / 256.0) * 256.0;\n\n  id.z += floor(id.y / 256.0);\n  id.y -= floor(id.y / 256.0) * 256.0;\n\n  id.w += floor(id.z / 256.0);\n  id.z -= floor(id.z / 256.0) * 256.0;\n\n  fragId = id;\n}\n",r.pickFragment="precision mediump float;\n#define GLSLIFY 1\n\nvarying vec4 fragId;\n\nvoid main() {\n  float radius = length(2.0*gl_PointCoord.xy-1.0);\n  if(radius > 1.0) {\n    discard;\n  }\n  gl_FragColor = fragId / 255.0;\n}\n"},{}],193:[function(t,e,r){arguments[4][68][0].apply(r,arguments)},{dup:68}],194:[function(t,e,r){"use strict";function n(t,e,r,n,o){4*f>=o?i(0,o-1,t,e,r,n):h(0,o-1,t,e,r,n)}function i(t,e,r,n,i,o){for(var a=t+1;e>=a;++a){for(var s=r[a],l=n[2*a],u=n[2*a+1],c=i[a],h=o[a],f=a;f>t;){var d=r[f-1],p=n[2*(f-1)];if((d-s||l-p)>=0)break;r[f]=d,n[2*f]=p,n[2*f+1]=n[2*f-1],i[f]=i[f-1],o[f]=o[f-1],f-=1}r[f]=s,n[2*f]=l,n[2*f+1]=u,i[f]=c,o[f]=h}}function o(t,e,r,n,i,o){var a=r[t],s=n[2*t],l=n[2*t+1],u=i[t],c=o[t];r[t]=r[e],n[2*t]=n[2*e],n[2*t+1]=n[2*e+1],i[t]=i[e],o[t]=o[e],r[e]=a,n[2*e]=s,n[2*e+1]=l,i[e]=u,o[e]=c}function a(t,e,r,n,i,o){r[t]=r[e],n[2*t]=n[2*e],n[2*t+1]=n[2*e+1],i[t]=i[e],o[t]=o[e]}function s(t,e,r,n,i,o,a){var s=n[t],l=i[2*t],u=i[2*t+1],c=o[t],h=a[t];n[t]=n[e],i[2*t]=i[2*e],i[2*t+1]=i[2*e+1],o[t]=o[e],a[t]=a[e],n[e]=n[r],i[2*e]=i[2*r],i[2*e+1]=i[2*r+1],o[e]=o[r],a[e]=a[r],n[r]=s,i[2*r]=l,i[2*r+1]=u,o[r]=c,a[r]=h}function l(t,e,r,n,i,o,a,s,l,u,c){s[t]=s[e],l[2*t]=l[2*e],l[2*t+1]=l[2*e+1],u[t]=u[e],c[t]=c[e],s[e]=r,l[2*e]=n,l[2*e+1]=i,u[e]=o,c[e]=a}function u(t,e,r,n,i){return(r[t]-r[e]||n[2*e]-n[2*t]||i[t]-i[e])<0}function c(t,e,r,n,i,o,a,s){return(e-o[t]||a[2*t]-r||i-s[t])<0}function h(t,e,r,n,d,p){var v=(e-t+1)/6|0,m=t+v,g=e-v,y=t+e>>1,b=y-v,x=y+v,_=m,w=b,M=y,k=x,A=g,T=t+1,E=e-1,S=0;u(_,w,r,n,d,p)&&(S=_,_=w,w=S),u(k,A,r,n,d,p)&&(S=k,k=A,A=S),u(_,M,r,n,d,p)&&(S=_,_=M,M=S),u(w,M,r,n,d,p)&&(S=w,w=M,M=S),u(_,k,r,n,d,p)&&(S=_,_=k,k=S),u(M,k,r,n,d,p)&&(S=M,
M=k,k=S),u(w,A,r,n,d,p)&&(S=w,w=A,A=S),u(w,M,r,n,d,p)&&(S=w,w=M,M=S),u(k,A,r,n,d,p)&&(S=k,k=A,A=S);var L=r[w],z=n[2*w],I=n[2*w+1],P=d[w],C=p[w],R=r[k],D=n[2*k],O=n[2*k+1],F=d[k],j=p[k],N=_,B=M,U=A,V=m,q=y,G=g,H=r[N],X=r[B],Y=r[U];r[V]=H,r[q]=X,r[G]=Y;for(var W=0;2>W;++W){var Z=n[2*N+W],K=n[2*B+W],J=n[2*U+W];n[2*V+W]=Z,n[2*q+W]=K,n[2*G+W]=J}var $=d[N],Q=d[B],tt=d[U];d[V]=$,d[q]=Q,d[G]=tt;var et=p[N],rt=p[B],nt=p[U];p[V]=et,p[q]=rt,p[G]=nt,a(b,t,r,n,d,p),a(x,e,r,n,d,p);for(var it=T;E>=it;++it)if(c(it,L,z,I,P,r,n,d))it!==T&&o(it,T,r,n,d,p),++T;else if(!c(it,R,D,O,F,r,n,d))for(;;){if(c(E,R,D,O,F,r,n,d)){c(E,L,z,I,P,r,n,d)?(s(it,T,E,r,n,d,p),++T,--E):(o(it,E,r,n,d,p),--E);break}if(--E<it)break}l(t,T-1,L,z,I,P,C,r,n,d,p),l(e,E+1,R,D,O,F,j,r,n,d,p),f>=T-2-t?i(t,T-2,r,n,d,p):h(t,T-2,r,n,d,p),f>=e-(E+2)?i(E+2,e,r,n,d,p):h(E+2,e,r,n,d,p),f>=E-T?i(T,E,r,n,d,p):h(T,E,r,n,d,p)}e.exports=n;var f=32},{}],195:[function(t,e,r){"use strict";function n(t,e,r,n,i,o,a,s){for(var l=r,u=r;n>u;++u){var c=t[2*u],h=t[2*u+1],f=e[u];c>=i&&a>=c&&h>=o&&s>=h&&(u===l?l+=1:(t[2*u]=t[2*l],t[2*u+1]=t[2*l+1],e[u]=e[l],t[2*l]=c,t[2*l+1]=h,e[l]=f,l+=1))}return l}function i(t,e,r){this.pixelSize=t,this.offset=e,this.count=r}function o(t,e,r,o){function l(i,o,a,s,u,c){var h=.5*a,f=s+1,d=u-s;r[_]=d,x[_++]=c;for(var p=0;2>p;++p)for(var v=0;2>v;++v){var m=i+p*h,g=o+v*h,y=n(t,e,f,u,m,g,m+h,g+h);if(y!==f){if(y-f>=Math.max(.9*d,32)){var b=u+s>>>1;l(m,g,h,f,b,c+1),f=b}l(m,g,h,f,y,c+1),f=y}}}var u=t.length>>>1;if(1>u)return[];for(var c=1/0,h=1/0,f=-(1/0),d=-(1/0),p=0;u>p;++p){var v=t[2*p],m=t[2*p+1];c=Math.min(c,v),f=Math.max(f,v),h=Math.min(h,m),d=Math.max(d,m),e[p]=p}c===f&&(f+=1+Math.abs(f)),h===d&&(d+=1+Math.abs(f));var g=1/(f-c),y=1/(d-h),b=Math.max(f-c,d-h);o=o||[0,0,0,0],o[0]=c,o[1]=h,o[2]=f,o[3]=d;var x=a.mallocInt32(u),_=0;l(c,h,b,0,u,0),s(x,t,e,r,u);for(var w=[],M=0,k=u,_=u-1;_>=0;--_){t[2*_]=(t[2*_]-c)*g,t[2*_+1]=(t[2*_+1]-h)*y;var A=x[_];A!==M&&(w.push(new i(b*Math.pow(.5,A),_+1,k-(_+1))),k=_+1,M=A)}return w.push(new i(b*Math.pow(.5,A+1),0,k)),a.free(x),w}var a=t("typedarray-pool"),s=t("./lib/sort");e.exports=o},{"./lib/sort":194,"typedarray-pool":458}],196:[function(t,e,r){"use strict";function n(t,e,r,n,i,o){this.plot=t,this.offsetBuffer=e,this.pickBuffer=r,this.weightBuffer=n,this.shader=i,this.pickShader=o,this.scales=[],this.size=12,this.borderSize=1,this.pointCount=0,this.color=[1,0,0,1],this.borderColor=[0,0,0,1],this.bounds=[1/0,1/0,-(1/0),-(1/0)],this.pickOffset=0,this.points=null,this.xCoords=null}function i(t,e){var r=t.gl,i=a(r),s=a(r),l=a(r),u=o(r,c.pointVertex,c.pointFragment),h=o(r,c.pickVertex,c.pickFragment),f=new n(t,i,s,l,u,h);return f.update(e),t.addObject(f),f}var o=t("gl-shader"),a=t("gl-buffer"),s=t("binary-search-bounds"),l=t("snap-points-2d"),u=t("typedarray-pool"),c=t("./lib/shader");e.exports=i;var h=n.prototype;h.dispose=function(){this.shader.dispose(),this.pickShader.dispose(),this.offsetBuffer.dispose(),this.pickBuffer.dispose(),this.xCoords&&u.free(this.xCoords),this.plot.removeObject(this)},h.update=function(t){function e(e,r){return e in t?t[e]:r}t=t||{},this.size=e("size",12),this.color=e("color",[1,0,0,1]).slice(),this.borderSize=e("borderSize",1),this.borderColor=e("borderColor",[0,0,0,1]).slice(),this.xCoords&&u.free(this.xCoords);var r=t.positions,n=u.mallocFloat32(r.length),i=u.mallocInt32(r.length>>>1);n.set(r);var o=u.mallocFloat32(r.length);this.points=r,this.scales=l(n,i,o,this.bounds),this.offsetBuffer.update(n),this.pickBuffer.update(i),this.weightBuffer.update(o);for(var a=u.mallocFloat32(r.length>>>1),s=0,c=0;s<r.length;s+=2,++c)a[c]=n[s];u.free(i),u.free(n),u.free(o),this.xCoords=a,this.pointCount=r.length>>>1,this.pickOffset=0},h.drawPick=function(){var t=[1,0,0,0,1,0,0,0,1],e=[0,0,0,0];return function(r){var n=this.plot,i=this.pickShader,o=this.scales,a=this.offsetBuffer,l=this.pickBuffer,u=this.bounds,c=this.size,h=this.borderSize,f=n.gl,d=n.pickPixelRatio,p=n.viewBox,v=n.dataBox;if(0===this.pointCount)return r;var m=u[2]-u[0],g=u[3]-u[1],y=v[2]-v[0],b=v[3]-v[1],x=(p[2]-p[0])*d/n.pixelRatio,_=(p[3]-p[1])*d/n.pixelRatio,w=Math.min(y/x,b/_);t[0]=2*m/y,t[4]=2*g/b,t[6]=2*(u[0]-v[0])/y-1,t[7]=2*(u[1]-v[1])/b-1,this.pickOffset=r,e[0]=255&r,e[1]=r>>8&255,e[2]=r>>16&255,e[3]=r>>24&255,i.bind(),i.uniforms.matrix=t,i.uniforms.color=this.color,i.uniforms.borderColor=this.borderColor,i.uniforms.pointSize=d*(c+h),i.uniforms.pickOffset=e,0===this.borderSize?i.uniforms.centerFraction=2:i.uniforms.centerFraction=c/(c+h+1.25),a.bind(),i.attributes.position.pointer(),l.bind(),i.attributes.pickId.pointer(f.UNSIGNED_BYTE);for(var M=this.xCoords,k=(v[0]-u[0]-w*c*d)/m,A=(v[2]-u[0]+w*c*d)/m,T=o.length-1;T>=0;--T){var E=o[T];if(!(E.pixelSize<w&&T>1)){var S=E.offset,L=E.count+S,z=s.ge(M,k,S,L-1),I=s.lt(M,A,z,L-1)+1;I>z&&f.drawArrays(f.POINTS,z,I-z)}}return r+this.pointCount}}(),h.draw=function(){var t=[1,0,0,0,1,0,0,0,1];return function(){var e=this.plot,r=this.shader,n=this.scales,i=this.offsetBuffer,o=this.bounds,a=this.size,l=this.borderSize,u=e.gl,c=e.pixelRatio,h=e.viewBox,f=e.dataBox;if(0!==this.pointCount){var d=o[2]-o[0],p=o[3]-o[1],v=f[2]-f[0],m=f[3]-f[1],g=h[2]-h[0],y=h[3]-h[1],b=Math.min(v/g,m/y);t[0]=2*d/v,t[4]=2*p/m,t[6]=2*(o[0]-f[0])/v-1,t[7]=2*(o[1]-f[1])/m-1,r.bind(),r.uniforms.matrix=t,r.uniforms.color=this.color,r.uniforms.borderColor=this.borderColor,r.uniforms.pointSize=c*(a+l),r.uniforms.useWeight=1,0===this.borderSize?r.uniforms.centerFraction=2:r.uniforms.centerFraction=a/(a+l+1.25),i.bind(),r.attributes.position.pointer(),this.weightBuffer.bind(),r.attributes.weight.pointer();for(var x=this.xCoords,_=(f[0]-o[0]-b*a*c)/d,w=(f[2]-o[0]+b*a*c)/d,M=!0,k=n.length-1;k>=0;--k){var A=n[k];if(!(A.pixelSize<b&&k>1)){var T=A.offset,E=A.count+T,S=s.ge(x,_,T,E-1),L=s.lt(x,w,S,E-1)+1;L>S&&u.drawArrays(u.POINTS,S,L-S),M&&(M=!1,r.uniforms.useWeight=0)}}}}}(),h.pick=function(t,e,r){var n=this.pickOffset,i=this.pointCount;if(n>r||r>=n+i)return null;var o=r-n,a=this.points;return{object:this,pointId:o,dataCoord:[a[2*o],a[2*o+1]]}}},{"./lib/shader":192,"binary-search-bounds":193,"gl-buffer":124,"gl-shader":203,"snap-points-2d":195,"typedarray-pool":458}],197:[function(t,e,r){"use strict";function n(t,e){var r=o[e];if(r||(r=o[e]={}),t in r)return r[t];for(var n=i(t,{textAlign:"center",textBaseline:"middle",lineHeight:1,font:e}),a=i(t,{triangles:!0,textAlign:"center",textBaseline:"middle",lineHeight:1,font:e}),s=[[1/0,1/0],[-(1/0),-(1/0)]],l=0;l<n.positions.length;++l)for(var u=n.positions[l],c=0;2>c;++c)s[0][c]=Math.min(s[0][c],u[c]),s[1][c]=Math.max(s[1][c],u[c]);return r[t]=[a,n,s]}var i=t("vectorize-text");e.exports=n;var o={}},{"vectorize-text":460}],198:[function(t,e,r){function n(t,e){var r=i(t,e),n=r.attributes;return n.position.location=0,n.color.location=1,n.glyph.location=2,n.id.location=3,r}var i=t("gl-shader"),o="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position;\nattribute vec4 color;\nattribute vec2 glyph;\nattribute vec4 id;\n\n\nuniform vec4 highlightId;\nuniform float highlightScale;\nuniform mat4 model, view, projection;\nuniform vec3 clipBounds[2];\n\nvarying vec4 interpColor;\nvarying vec4 pickId;\nvarying vec3 dataCoordinate;\n\nvoid main() {\n  if(any(lessThan(position, clipBounds[0]))   || \n     any(greaterThan(position, clipBounds[1])) ) {\n    gl_Position = vec4(0,0,0,0);\n  } else {\n    float scale = 1.0;\n    if(distance(highlightId, id) < 0.0001) {\n      scale = highlightScale;\n    }\n\n    vec4 worldPosition = model * vec4(position, 1);\n    vec4 viewPosition = view * worldPosition;\n    viewPosition = viewPosition / viewPosition.w;\n    vec4 clipPosition = projection * (viewPosition + scale * vec4(glyph.x, -glyph.y, 0, 0));\n    \n    gl_Position = clipPosition;\n    interpColor = color;\n    pickId = id;\n    dataCoordinate = position;\n  }\n}",a="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position;\nattribute vec4 color;\nattribute vec2 glyph;\nattribute vec4 id;\n\nuniform mat4 model, view, projection;\nuniform vec2 screenSize;\nuniform vec3 clipBounds[2];\nuniform float highlightScale, pixelRatio;\nuniform vec4 highlightId;\n\nvarying vec4 interpColor;\nvarying vec4 pickId;\nvarying vec3 dataCoordinate;\n\nvoid main() {\n  if(any(lessThan(position, clipBounds[0])) || any(greaterThan(position, clipBounds[1]))) {\n    gl_Position = vec4(0,0,0,0);\n  } else {\n    float scale = pixelRatio;\n    if(distance(highlightId.bgr, id.bgr) < 0.001) {\n      scale *= highlightScale;\n    }\n\n    vec4 worldPosition = model * vec4(position, 1.0);\n    vec4 viewPosition = view * worldPosition;\n    vec4 clipPosition = projection * viewPosition;\n    clipPosition /= clipPosition.w;\n    \n    gl_Position = clipPosition + vec4(screenSize * scale * vec2(glyph.x, -glyph.y), 0.0, 0.0);\n    interpColor = color;\n    pickId = id;\n    dataCoordinate = position;\n  }\n}",s="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position;\nattribute vec4 color;\nattribute vec2 glyph;\nattribute vec4 id;\n\nuniform float highlightScale;\nuniform vec4 highlightId;\nuniform vec3 axes[2];\nuniform mat4 model, view, projection;\nuniform vec2 screenSize;\nuniform vec3 clipBounds[2];\nuniform float scale, pixelRatio;\n\nvarying vec4 interpColor;\nvarying vec4 pickId;\nvarying vec3 dataCoordinate;\n\nvoid main() {\n  if(any(lessThan(position, clipBounds[0]))   ||\n     any(greaterThan(position, clipBounds[1])) ) {\n    gl_Position = vec4(0,0,0,0);\n  } else {\n    float lscale = pixelRatio * scale;\n    if(distance(highlightId, id) < 0.0001) {\n      lscale *= highlightScale;\n    }\n\n    vec4 clipCenter   = projection * view * model * vec4(position, 1);\n    vec3 dataPosition = position + 0.5*lscale*(axes[0] * glyph.x + axes[1] * glyph.y) * clipCenter.w * screenSize.y;\n    vec4 clipPosition = projection * view * model * vec4(dataPosition, 1);\n\n    gl_Position = clipPosition;\n    interpColor = color;\n    pickId = id;\n    dataCoordinate = dataPosition;\n  }\n}\n",l="precision mediump float;\n#define GLSLIFY 1\n\nuniform vec3 fragClipBounds[2];\nuniform float opacity;\n\nvarying vec4 interpColor;\nvarying vec4 pickId;\nvarying vec3 dataCoordinate;\n\nvoid main() {\n  if(any(lessThan(dataCoordinate, fragClipBounds[0]))   ||\n     any(greaterThan(dataCoordinate, fragClipBounds[1])) ) {\n    discard;\n  } else {\n    gl_FragColor = interpColor * opacity;\n  }\n}\n",u="precision mediump float;\n#define GLSLIFY 1\n\nuniform vec3 fragClipBounds[2];\nuniform float pickGroup;\n\nvarying vec4 pickId;\nvarying vec3 dataCoordinate;\n\nvoid main() {\n  if(any(lessThan(dataCoordinate, fragClipBounds[0]))   || \n     any(greaterThan(dataCoordinate, fragClipBounds[1])) ) {\n    discard;\n  } else {\n    gl_FragColor = vec4(pickGroup, pickId.bgr);\n  }\n}",c=[{name:"position",type:"vec3"},{name:"color",type:"vec4"},{name:"glyph",type:"vec2"},{name:"id",type:"vec4"}],h={vertex:o,fragment:l,attributes:c},f={vertex:a,fragment:l,attributes:c},d={vertex:s,fragment:l,attributes:c},p={vertex:o,fragment:u,attributes:c},v={vertex:a,fragment:u,attributes:c},m={vertex:s,fragment:u,attributes:c};r.createPerspective=function(t){return n(t,h)},r.createOrtho=function(t){return n(t,f)},r.createProject=function(t){return n(t,d)},r.createPickPerspective=function(t){return n(t,p)},r.createPickOrtho=function(t){return n(t,v)},r.createPickProject=function(t){return n(t,m)}},{"gl-shader":203}],199:[function(t,e,r){"use strict";function n(t,e){var r=t[0],n=t[1],i=t[2],o=t[3];return t[0]=e[0]*r+e[4]*n+e[8]*i+e[12]*o,t[1]=e[1]*r+e[5]*n+e[9]*i+e[13]*o,t[2]=e[2]*r+e[6]*n+e[10]*i+e[14]*o,t[3]=e[3]*r+e[7]*n+e[11]*i+e[15]*o,t}function i(t,e,r,i){return n(i,i,r),n(i,i,e),n(i,i,t)}function o(t,e){this.index=t,this.dataCoordinate=this.position=e}function a(t,e,r,n,i,a,s,l,u,c,h,f){this.gl=t,this.pixelRatio=1,this.shader=e,this.orthoShader=r,this.projectShader=n,this.pointBuffer=i,this.colorBuffer=a,this.glyphBuffer=s,this.idBuffer=l,this.vao=u,this.vertexCount=0,this.lineVertexCount=0,this.opacity=1,this.lineWidth=0,this.projectScale=[2/3,2/3,2/3],this.projectOpacity=[1,1,1],this.pickId=0,this.pickPerspectiveShader=c,this.pickOrthoShader=h,this.pickProjectShader=f,this.points=[],this._selectResult=new o(0,[0,0,0]),this.useOrtho=!0,this.bounds=[[1/0,1/0,1/0],[-(1/0),-(1/0),-(1/0)]],this.axesProject=[!0,!0,!0],this.axesBounds=[[-(1/0),-(1/0),-(1/0)],[1/0,1/0,1/0]],this.highlightId=[1,1,1,1],this.highlightScale=2,this.clipBounds=[[-(1/0),-(1/0),-(1/0)],[1/0,1/0,1/0]],this.dirty=!0}function s(t){return t[0]=t[1]=t[2]=0,t}function l(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=1,t}function u(t,e,r,n){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[r]=n,t}function c(t){for(var e=L,r=0;2>r;++r)for(var n=0;3>n;++n)e[r][n]=Math.max(Math.min(t[r][n],1e8),-1e8);return e}function h(t,e,r,n,o){var a,h=e.axesProject,f=e.gl,d=t.uniforms,p=r.model||x,v=r.view||x,m=r.projection||x,y=e.axesBounds,b=c(e.clipBounds);a=e.axes?e.axes.lastCubeProps.axis:[1,1,1],w[0]=2/f.drawingBufferWidth,w[1]=2/f.drawingBufferHeight,t.bind(),d.view=v,d.projection=m,d.screenSize=w,d.highlightId=e.highlightId,d.highlightScale=e.highlightScale,d.clipBounds=b,d.pickGroup=e.pickId/255,d.pixelRatio=e.pixelRatio;for(var _=0;3>_;++_)if(h[_]&&e.projectOpacity[_]<1===n){d.scale=e.projectScale[_],d.opacity=e.projectOpacity[_];for(var L=E,z=0;16>z;++z)L[z]=0;for(var z=0;4>z;++z)L[5*z]=1;L[5*_]=0,a[_]<0?L[12+_]=y[0][_]:L[12+_]=y[1][_],g(L,p,L),d.model=L;var I=(_+1)%3,P=(_+2)%3,C=s(M),R=s(k);C[I]=1,R[P]=1;var D=i(m,v,p,l(A,C)),O=i(m,v,p,l(T,R));if(Math.abs(D[1])>Math.abs(O[1])){var F=D;D=O,O=F,F=C,C=R,R=F;var j=I;I=P,P=j}D[0]<0&&(C[I]=-1),O[1]>0&&(R[P]=-1);for(var N=0,B=0,z=0;4>z;++z)N+=Math.pow(p[4*I+z],2),B+=Math.pow(p[4*P+z],2);C[I]/=Math.sqrt(N),R[P]/=Math.sqrt(B),d.axes[0]=C,d.axes[1]=R,d.fragClipBounds[0]=u(S,b[0],_,-1e8),d.fragClipBounds[1]=u(S,b[1],_,1e8),e.vao.draw(f.TRIANGLES,e.vertexCount),e.lineWidth>0&&(f.lineWidth(e.lineWidth),e.vao.draw(f.LINES,e.lineVertexCount,e.vertexCount))}}function f(t,e,r,n,i,o){var a=r.gl;if(r.vao.bind(),i===r.opacity<1||o){t.bind();var s=t.uniforms;s.model=n.model||x,s.view=n.view||x,s.projection=n.projection||x,w[0]=2/a.drawingBufferWidth,w[1]=2/a.drawingBufferHeight,s.screenSize=w,s.highlightId=r.highlightId,s.highlightScale=r.highlightScale,s.fragClipBounds=P,s.clipBounds=r.axes.bounds,s.opacity=r.opacity,s.pickGroup=r.pickId/255,s.pixelRatio=r.pixelRatio,r.vao.draw(a.TRIANGLES,r.vertexCount),r.lineWidth>0&&(a.lineWidth(r.lineWidth),r.vao.draw(a.LINES,r.lineVertexCount,r.vertexCount))}h(e,r,n,i,o),r.vao.unbind()}function d(t){var e=t.gl,r=y.createPerspective(e),n=y.createOrtho(e),i=y.createProject(e),o=y.createPickPerspective(e),s=y.createPickOrtho(e),l=y.createPickProject(e),u=p(e),c=p(e),h=p(e),f=p(e),d=v(e,[{buffer:u,size:3,type:e.FLOAT},{buffer:c,size:4,type:e.FLOAT},{buffer:h,size:2,type:e.FLOAT},{buffer:f,size:4,type:e.UNSIGNED_BYTE,normalized:!0}]),m=new a(e,r,n,i,u,c,h,f,d,o,s,l);return m.update(t),m}var p=t("gl-buffer"),v=t("gl-vao"),m=t("typedarray-pool"),g=t("gl-mat4/multiply"),y=t("./lib/shaders"),b=t("./lib/glyphs"),x=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];e.exports=d;var _=a.prototype;_.pickSlots=1,_.setPickBase=function(t){this.pickId=t},_.isTransparent=function(){if(this.opacity<1)return!0;for(var t=0;3>t;++t)if(this.axesProject[t]&&this.projectOpacity[t]<1)return!0;return!1},_.isOpaque=function(){if(this.opacity>=1)return!0;for(var t=0;3>t;++t)if(this.axesProject[t]&&this.projectOpacity[t]>=1)return!0;return!1};var w=[0,0],M=[0,0,0],k=[0,0,0],A=[0,0,0,1],T=[0,0,0,1],E=x.slice(),S=[0,0,0],L=[[0,0,0],[0,0,0]],z=[-1e8,-1e8,-1e8],I=[1e8,1e8,1e8],P=[z,I];_.draw=function(t){var e=this.useOrtho?this.orthoShader:this.shader;f(e,this.projectShader,this,t,!1,!1)},_.drawTransparent=function(t){var e=this.useOrtho?this.orthoShader:this.shader;f(e,this.projectShader,this,t,!0,!1)},_.drawPick=function(t){var e=this.useOrtho?this.pickOrthoShader:this.pickPerspectiveShader;f(e,this.pickProjectShader,this,t,!1,!0)},_.pick=function(t){if(!t)return null;if(t.id!==this.pickId)return null;var e=t.value[2]+(t.value[1]<<8)+(t.value[0]<<16);if(e>=this.pointCount||0>e)return null;var r=this.points[e],n=this._selectResult;n.index=e;for(var i=0;3>i;++i)n.position[i]=n.dataCoordinate[i]=r[i];return n},_.highlight=function(t){if(t){var e=t.index,r=255&e,n=e>>8&255,i=e>>16&255;this.highlightId=[r/255,n/255,i/255,0]}else this.highlightId=[1,1,1,1]},_.update=function(t){if(t=t||{},"perspective"in t&&(this.useOrtho=!t.perspective),"orthographic"in t&&(this.useOrtho=!!t.orthographic),"lineWidth"in t&&(this.lineWidth=t.lineWidth),"project"in t)if(Array.isArray(t.project))this.axesProject=t.project;else{var e=!!t.project;this.axesProject=[e,e,e]}if("projectScale"in t)if(Array.isArray(t.projectScale))this.projectScale=t.projectScale.slice();else{var r=+t.projectScale;this.projectScale=[r,r,r]}if("projectOpacity"in t)if(Array.isArray(t.projectOpacity))this.projectOpacity=t.projectOpacity.slice();else{var r=+t.projectOpacity;this.projectOpacity=[r,r,r]}"opacity"in t&&(this.opacity=t.opacity),this.dirty=!0;var n=t.position;if(n){var i=t.font||"normal",o=t.alignment||[0,0],a=[1/0,1/0,1/0],s=[-(1/0),-(1/0),-(1/0)],l=t.glyph,u=t.color,c=t.size,h=t.angle,f=t.lineColor,d=0,p=0,v=0,g=n.length;t:for(var y=0;g>y;++y){for(var x=n[y],_=0;3>_;++_)if(isNaN(x[_])||!isFinite(x[_]))continue t;var w;w=Array.isArray(l)?b(l[y],i):l?b(l,i):b("\u25cf",i);var M=w[0],k=w[1],A=w[2];p+=3*M.cells.length,v+=2*k.edges.length}var T=p+v,E=m.mallocFloat(3*T),S=m.mallocFloat(4*T),L=m.mallocFloat(2*T),z=m.mallocUint32(T),I=[0,o[1]],P=0,C=p,R=[0,0,0,1],D=[0,0,0,1],O=Array.isArray(u)&&Array.isArray(u[0]),F=Array.isArray(f)&&Array.isArray(f[0]);t:for(var y=0;g>y;++y){for(var x=n[y],_=0;3>_;++_){if(isNaN(x[_])||!isFinite(x[_])){d+=1;continue t}s[_]=Math.max(s[_],x[_]),a[_]=Math.min(a[_],x[_])}var w;w=Array.isArray(l)?b(l[y],i):l?b(l,i):b("\u25cf",i);var M=w[0],k=w[1],A=w[2];if(Array.isArray(u)){var j;if(j=O?u[y]:u,3===j.length){for(var _=0;3>_;++_)R[_]=j[_];R[3]=1}else if(4===j.length)for(var _=0;4>_;++_)R[_]=j[_]}else R[0]=R[1]=R[2]=0,R[3]=1;if(Array.isArray(f)){var j;if(j=F?f[y]:f,3===j.length){for(var _=0;3>_;++_)D[_]=j[_];D[_]=1}else if(4===j.length)for(var _=0;4>_;++_)D[_]=j[_]}else D[0]=D[1]=D[2]=0,D[3]=1;var N=.5;Array.isArray(c)?N=+c[y]:c?N=+c:this.useOrtho&&(N=12);var B=0;Array.isArray(h)?B=+h[y]:h&&(B=+h);for(var U=Math.cos(B),V=Math.sin(B),x=n[y],_=0;3>_;++_)s[_]=Math.max(s[_],x[_]),a[_]=Math.min(a[_],x[_]);o[0]<0?I[0]=o[0]*(1+A[1][0]):o[0]>0&&(I[0]=-o[0]*(1+A[0][0]));for(var q=M.cells,G=M.positions,_=0;_<q.length;++_)for(var H=q[_],X=0;3>X;++X){for(var Y=0;3>Y;++Y)E[3*P+Y]=x[Y];for(var Y=0;4>Y;++Y)S[4*P+Y]=R[Y];z[P]=d;var W=G[H[X]];L[2*P]=N*(U*W[0]-V*W[1]+I[0]),L[2*P+1]=N*(V*W[0]+U*W[1]+I[1]),P+=1}for(var q=k.edges,G=k.positions,_=0;_<q.length;++_)for(var H=q[_],X=0;2>X;++X){for(var Y=0;3>Y;++Y)E[3*C+Y]=x[Y];for(var Y=0;4>Y;++Y)S[4*C+Y]=D[Y];z[C]=d;var W=G[H[X]];L[2*C]=N*(U*W[0]-V*W[1]+I[0]),L[2*C+1]=N*(V*W[0]+U*W[1]+I[1]),C+=1}d+=1}this.vertexCount=p,this.lineVertexCount=v,this.pointBuffer.update(E),this.colorBuffer.update(S),this.glyphBuffer.update(L),this.idBuffer.update(new Uint32Array(z)),m.free(E),m.free(S),m.free(L),m.free(z),this.bounds=[a,s],this.points=n,this.pointCount=n.length}},_.dispose=function(){this.shader.dispose(),this.orthoShader.dispose(),this.pickPerspectiveShader.dispose(),this.pickOrthoShader.dispose(),this.vao.dispose(),this.pointBuffer.dispose(),this.colorBuffer.dispose(),this.glyphBuffer.dispose(),this.idBuffer.dispose()}},{"./lib/glyphs":197,"./lib/shaders":198,"gl-buffer":124,"gl-mat4/multiply":145,"gl-vao":232,"typedarray-pool":458}],200:[function(t,e,r){"use strict";r.boxVertex="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 vertex;\n\nuniform vec2 cornerA, cornerB;\n\nvoid main() {\n  gl_Position = vec4(mix(cornerA, cornerB, vertex), 0, 1);\n}\n",r.boxFragment="precision mediump float;\n#define GLSLIFY 1\n\nuniform vec4 color;\n\nvoid main() {\n  gl_FragColor = color;\n}\n"},{}],201:[function(t,e,r){"use strict";function n(t,e,r){this.plot=t,this.boxBuffer=e,this.boxShader=r,this.enabled=!0,this.selectBox=[1/0,1/0,-(1/0),-(1/0)],this.borderColor=[0,0,0,1],this.innerFill=!1,this.innerColor=[0,0,0,.25],this.outerFill=!0,this.outerColor=[0,0,0,.5],this.borderWidth=10}function i(t,e){var r=t.gl,i=a(r,[0,0,0,1,1,0,1,1]),l=o(r,s.boxVertex,s.boxFragment),u=new n(t,i,l);return u.update(e),t.addOverlay(u),u}var o=t("gl-shader"),a=t("gl-buffer"),s=t("./lib/shaders");e.exports=i;var l=n.prototype;l.draw=function(){if(this.enabled){var t=this.plot,e=this.selectBox,r=this.borderWidth,n=(this.innerFill,this.innerColor),i=(this.outerFill,this.outerColor),o=this.borderColor,a=t.box,s=t.screenBox,l=t.dataBox,u=t.viewBox,c=t.pixelRatio,h=(e[0]-l[0])*(u[2]-u[0])/(l[2]-l[0])+u[0],f=(e[1]-l[1])*(u[3]-u[1])/(l[3]-l[1])+u[1],d=(e[2]-l[0])*(u[2]-u[0])/(l[2]-l[0])+u[0],p=(e[3]-l[1])*(u[3]-u[1])/(l[3]-l[1])+u[1];if(h=Math.max(h,u[0]),f=Math.max(f,u[1]),d=Math.min(d,u[2]),p=Math.min(p,u[3]),!(h>d||f>p)){a.bind();var v=s[2]-s[0],m=s[3]-s[1];if(this.outerFill&&(a.drawBox(0,0,v,f,i),a.drawBox(0,f,h,p,i),a.drawBox(0,p,v,m,i),a.drawBox(d,f,v,p,i)),this.innerFill&&a.drawBox(h,f,d,p,n),r>0){var g=r*c;a.drawBox(h-g,f-g,d+g,f+g,o),a.drawBox(h-g,p-g,d+g,p+g,o),a.drawBox(h-g,f-g,h+g,p+g,o),a.drawBox(d-g,f-g,d+g,p+g,o)}}}},l.update=function(t){t=t||{},this.innerFill=!!t.innerFill,this.outerFill=!!t.outerFill,this.innerColor=(t.innerColor||[0,0,0,.5]).slice(),this.outerColor=(t.outerColor||[0,0,0,.5]).slice(),this.borderColor=(t.borderColor||[0,0,0,1]).slice(),this.borderWidth=t.borderWidth||0,this.selectBox=(t.selectBox||this.selectBox).slice()},l.dispose=function(){this.boxBuffer.dispose(),this.boxShader.dispose(),this.plot.removeOverlay(this)}},{"./lib/shaders":200,"gl-buffer":124,"gl-shader":203}],202:[function(t,e,r){"use strict";function n(t,e,r,n,i){this.coord=[t,e],this.id=r,this.value=n,this.distance=i}function i(t,e,r){this.gl=t,this.fbo=e,this.buffer=r,this._readTimeout=null;var n=this;this._readCallback=function(){n.gl&&(e.bind(),t.readPixels(0,0,e.shape[0],e.shape[1],t.RGBA,t.UNSIGNED_BYTE,n.buffer),n._readTimeout=null)}}function o(t,e){var r=a(t,e),n=s.mallocUint8(e[0]*e[1]*4);return new i(t,r,n)}e.exports=o;var a=t("gl-fbo"),s=t("typedarray-pool"),l=t("ndarray"),u=t("bit-twiddle").nextPow2,c=t("cwise/lib/wrapper")({args:["array",{offset:[0,0,1],array:0},{offset:[0,0,2],array:0},{offset:[0,0,3],array:0},"scalar","scalar","index"],pre:{body:"{this_closestD2=1e8,this_closestX=-1,this_closestY=-1}",args:[],thisVars:["this_closestD2","this_closestX","this_closestY"],localVars:[]},body:{body:"{if(255>_inline_46_arg0_||255>_inline_46_arg1_||255>_inline_46_arg2_||255>_inline_46_arg3_){var _inline_46_l=_inline_46_arg4_-_inline_46_arg6_[0],_inline_46_a=_inline_46_arg5_-_inline_46_arg6_[1],_inline_46_f=_inline_46_l*_inline_46_l+_inline_46_a*_inline_46_a;_inline_46_f<this_closestD2&&(this_closestD2=_inline_46_f,this_closestX=_inline_46_arg6_[0],this_closestY=_inline_46_arg6_[1])}}",args:[{name:"_inline_46_arg0_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_46_arg1_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_46_arg2_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_46_arg3_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_46_arg4_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_46_arg5_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_46_arg6_",lvalue:!1,rvalue:!0,count:4}],thisVars:["this_closestD2","this_closestX","this_closestY"],localVars:["_inline_46_a","_inline_46_f","_inline_46_l"]},post:{body:"{return[this_closestX,this_closestY,this_closestD2]}",args:[],thisVars:["this_closestD2","this_closestX","this_closestY"],localVars:[]},debug:!1,funcName:"cwise",blockSize:64}),h=i.prototype;Object.defineProperty(h,"shape",{get:function(){return this.gl?this.fbo.shape.slice():[0,0]},set:function(t){if(this.gl){this.fbo.shape=t;var e=this.fbo.shape[0],r=this.fbo.shape[1];if(r*e*4>this.buffer.length){s.free(this.buffer);for(var n=this.buffer=s.mallocUint8(u(r*e*4)),i=0;r*e*4>i;++i)n[i]=255}return t}}}),h.begin=function(){var t=this.gl;this.shape;t&&(this.fbo.bind(),t.clearColor(1,1,1,1),t.clear(t.COLOR_BUFFER_BIT|t.DEPTH_BUFFER_BIT))},h.end=function(){var t=this.gl;t&&(t.bindFramebuffer(t.FRAMEBUFFER,null),this._readTimeout||clearTimeout(this._readTimeout),this._readTimeout=setTimeout(this._readCallback,1))},h.query=function(t,e,r){if(!this.gl)return null;var i=this.fbo.shape.slice();t=0|t,e=0|e,"number"!=typeof r&&(r=1);var o=0|Math.min(Math.max(t-r,0),i[0]),a=0|Math.min(Math.max(t+r,0),i[0]),s=0|Math.min(Math.max(e-r,0),i[1]),u=0|Math.min(Math.max(e+r,0),i[1]);if(o>=a||s>=u)return null;var h=[a-o,u-s],f=l(this.buffer,[h[0],h[1],4],[4,4*i[0],1],4*(o+i[0]*s)),d=c(f.hi(h[0],h[1],1),r,r),p=d[0],v=d[1];if(0>p||Math.pow(this.radius,2)<d[2])return null;var m=f.get(p,v,0),g=f.get(p,v,1),y=f.get(p,v,2),b=f.get(p,v,3);return new n(p+o|0,v+s|0,m,[g,y,b],Math.sqrt(d[2]))},h.dispose=function(){this.gl&&(this.fbo.dispose(),s.free(this.buffer),this.gl=null,this._readTimeout&&clearTimeout(this._readTimeout))}},{"bit-twiddle":51,"cwise/lib/wrapper":118,"gl-fbo":129,ndarray:433,"typedarray-pool":458}],203:[function(t,e,r){"use strict";function n(t){this.gl=t,this._vref=this._fref=this._relink=this.vertShader=this.fragShader=this.program=this.attributes=this.uniforms=this.types=null}function i(t,e){return t.name<e.name?-1:1}function o(t,e,r,i,o){var a=new n(t);return a.update(e,r,i,o),a}var a=t("./lib/create-uniforms"),s=t("./lib/create-attributes"),l=t("./lib/reflect"),u=t("./lib/shader-cache"),c=t("./lib/runtime-reflect"),h=t("./lib/GLError"),f=n.prototype;f.bind=function(){this.program||this._relink(),this.gl.useProgram(this.program)},f.dispose=function(){this._fref&&this._fref.dispose(),this._vref&&this._vref.dispose(),this.attributes=this.types=this.vertShader=this.fragShader=this.program=this._relink=this._fref=this._vref=null},f.update=function(t,e,r,n){function o(){d.program=u.program(p,d._vref,d._fref,x,_);for(var t=0;t<r.length;++t)S[t]=p.getUniformLocation(d.program,r[t].name)}if(!e||1===arguments.length){var f=t;t=f.vertex,e=f.fragment,r=f.uniforms,n=f.attributes}var d=this,p=d.gl,v=d._vref;d._vref=u.shader(p,p.VERTEX_SHADER,t),v&&v.dispose(),d.vertShader=d._vref.shader;var m=this._fref;if(d._fref=u.shader(p,p.FRAGMENT_SHADER,e),m&&m.dispose(),d.fragShader=d._fref.shader,!r||!n){var g=p.createProgram();if(p.attachShader(g,d.fragShader),p.attachShader(g,d.vertShader),p.linkProgram(g),!p.getProgramParameter(g,p.LINK_STATUS)){var y=p.getProgramInfoLog(g);throw new h(y,"Error linking program:"+y)}r=r||c.uniforms(p,g),n=n||c.attributes(p,g),p.deleteProgram(g)}n=n.slice(),n.sort(i);for(var b=[],x=[],_=[],w=0;w<n.length;++w){var M=n[w];if(M.type.indexOf("mat")>=0){for(var k=0|M.type.charAt(M.type.length-1),A=new Array(k),T=0;k>T;++T)A[T]=_.length,x.push(M.name+"["+T+"]"),"number"==typeof M.location?_.push(M.location+T):Array.isArray(M.location)&&M.location.length===k&&"number"==typeof M.location[T]?_.push(0|M.location[T]):_.push(-1);b.push({name:M.name,type:M.type,locations:A})}else b.push({name:M.name,type:M.type,locations:[_.length]}),x.push(M.name),"number"==typeof M.location?_.push(0|M.location):_.push(-1)}for(var E=0,w=0;w<_.length;++w)if(_[w]<0){for(;_.indexOf(E)>=0;)E+=1;_[w]=E}var S=new Array(r.length);o(),d._relink=o,d.types={uniforms:l(r),attributes:l(n)},d.attributes=s(p,d,b,_),Object.defineProperty(d,"uniforms",a(p,d,r,S))},e.exports=o},{"./lib/GLError":204,"./lib/create-attributes":205,"./lib/create-uniforms":206,"./lib/reflect":207,"./lib/runtime-reflect":208,"./lib/shader-cache":209}],204:[function(t,e,r){function n(t,e,r){this.shortMessage=e||"",this.longMessage=r||"",this.rawError=t||"",this.message="gl-shader: "+(e||t||"")+(r?"\n"+r:""),this.stack=(new Error).stack}n.prototype=new Error,n.prototype.name="GLError",n.prototype.constructor=n,e.exports=n},{}],205:[function(t,e,r){"use strict";function n(t,e,r,n,i,o){this._gl=t,this._wrapper=e,this._index=r,this._locations=n,this._dimension=i,this._constFunc=o}function i(t,e,r,i,o,a,s){for(var l=["gl","v"],u=[],c=0;o>c;++c)l.push("x"+c),u.push("x"+c);l.push("if(x0.length===void 0){return gl.vertexAttrib"+o+"f(v,"+u.join()+")}else{return gl.vertexAttrib"+o+"fv(v,x0)}");var h=Function.apply(null,l),f=new n(t,e,r,i,o,h);Object.defineProperty(a,s,{set:function(e){return t.disableVertexAttribArray(i[r]),h(t,i[r],e),e},get:function(){return f},enumerable:!0})}function o(t,e,r,n,o,a,s){for(var l=new Array(o),u=new Array(o),c=0;o>c;++c)i(t,e,r[c],n,o,l,c),u[c]=l[c];Object.defineProperty(l,"location",{set:function(t){if(Array.isArray(t))for(var e=0;o>e;++e)u[e].location=t[e];else for(var e=0;o>e;++e)u[e].location=t+e;return t},get:function(){for(var t=new Array(o),e=0;o>e;++e)t[e]=n[r[e]];return t},enumerable:!0}),l.pointer=function(e,i,a,s){e=e||t.FLOAT,i=!!i,a=a||o*o,s=s||0;for(var l=0;o>l;++l){var u=n[r[l]];t.vertexAttribPointer(u,o,e,i,a,s+l*o),t.enableVertexAttribArray(u)}};var h=new Array(o),f=t["vertexAttrib"+o+"fv"];Object.defineProperty(a,s,{set:function(e){for(var i=0;o>i;++i){var a=n[r[i]];if(t.disableVertexAttribArray(a),Array.isArray(e[0]))f.call(t,a,e[i]);else{for(var s=0;o>s;++s)h[s]=e[o*i+s];f.call(t,a,h)}}return e},get:function(){return l},enumerable:!0})}function a(t,e,r,n){for(var a={},l=0,u=r.length;u>l;++l){var c=r[l],h=c.name,f=c.type,d=c.locations;switch(f){case"bool":case"int":case"float":i(t,e,d[0],n,1,a,h);break;default:if(f.indexOf("vec")>=0){var p=f.charCodeAt(f.length-1)-48;if(2>p||p>4)throw new s("","Invalid data type for attribute "+h+": "+f);i(t,e,d[0],n,p,a,h)}else{if(!(f.indexOf("mat")>=0))throw new s("","Unknown data type for attribute "+h+": "+f);var p=f.charCodeAt(f.length-1)-48;if(2>p||p>4)throw new s("","Invalid data type for attribute "+h+": "+f);o(t,e,d,n,p,a,h)}}}return a}e.exports=a;var s=t("./GLError"),l=n.prototype;l.pointer=function(t,e,r,n){var i=this,o=i._gl,a=i._locations[i._index];o.vertexAttribPointer(a,i._dimension,t||o.FLOAT,!!e,r||0,n||0),o.enableVertexAttribArray(a)},l.set=function(t,e,r,n){return this._constFunc(this._locations[this._index],t,e,r,n)},Object.defineProperty(l,"location",{get:function(){return this._locations[this._index]},set:function(t){return t!==this._locations[this._index]&&(this._locations[this._index]=0|t,this._wrapper.program=null),0|t}})},{"./GLError":204}],206:[function(t,e,r){"use strict";function n(t){var e=new Function("y","return function(){return y}");return e(t)}function i(t,e){for(var r=new Array(t),n=0;t>n;++n)r[n]=e;return r}function o(t,e,r,o){function l(r){var n=new Function("gl","wrapper","locations","return function(){return gl.getUniform(wrapper.program,locations["+r+"])}");return n(t,e,o)}function u(t,e,r){switch(r){case"bool":case"int":case"sampler2D":case"samplerCube":return"gl.uniform1i(locations["+e+"],obj"+t+")";case"float":return"gl.uniform1f(locations["+e+"],obj"+t+")";default:var n=r.indexOf("vec");if(!(n>=0&&1>=n&&r.length===4+n)){if(0===r.indexOf("mat")&&4===r.length){var i=r.charCodeAt(r.length-1)-48;if(2>i||i>4)throw new s("","Invalid uniform dimension type for matrix "+name+": "+r);return"gl.uniformMatrix"+i+"fv(locations["+e+"],false,obj"+t+")"}throw new s("","Unknown uniform data type for "+name+": "+r)}var i=r.charCodeAt(r.length-1)-48;if(2>i||i>4)throw new s("","Invalid data type");switch(r.charAt(0)){case"b":case"i":return"gl.uniform"+i+"iv(locations["+e+"],obj"+t+")";case"v":return"gl.uniform"+i+"fv(locations["+e+"],obj"+t+")";default:throw new s("","Unrecognized data type for vector "+name+": "+r)}}}function c(t,e){if("object"!=typeof e)return[[t,e]];var r=[];for(var n in e){var i=e[n],o=t;o+=parseInt(n)+""===n?"["+n+"]":"."+n,"object"==typeof i?r.push.apply(r,c(o,i)):r.push([o,i])}return r}function h(e){for(var n=["return function updateProperty(obj){"],i=c("",e),a=0;a<i.length;++a){var s=i[a],l=s[0],h=s[1];o[h]&&n.push(u(l,h,r[h].type))}n.push("return obj}");var f=new Function("gl","locations",n.join("\n"));
return f(t,o)}function f(t){switch(t){case"bool":return!1;case"int":case"sampler2D":case"samplerCube":return 0;case"float":return 0;default:var e=t.indexOf("vec");if(e>=0&&1>=e&&t.length===4+e){var r=t.charCodeAt(t.length-1)-48;if(2>r||r>4)throw new s("","Invalid data type");return"b"===t.charAt(0)?i(r,!1):i(r,0)}if(0===t.indexOf("mat")&&4===t.length){var r=t.charCodeAt(t.length-1)-48;if(2>r||r>4)throw new s("","Invalid uniform dimension type for matrix "+name+": "+t);return i(r*r,0)}throw new s("","Unknown uniform data type for "+name+": "+t)}}function d(t,e,i){if("object"==typeof i){var a=p(i);Object.defineProperty(t,e,{get:n(a),set:h(i),enumerable:!0,configurable:!1})}else o[i]?Object.defineProperty(t,e,{get:l(i),set:h(i),enumerable:!0,configurable:!1}):t[e]=f(r[i].type)}function p(t){var e;if(Array.isArray(t)){e=new Array(t.length);for(var r=0;r<t.length;++r)d(e,r,t[r])}else{e={};for(var n in t)d(e,n,t[n])}return e}var v=a(r,!0);return{get:n(p(v)),set:h(v),enumerable:!0,configurable:!0}}var a=t("./reflect"),s=t("./GLError");e.exports=o},{"./GLError":204,"./reflect":207}],207:[function(t,e,r){"use strict";function n(t,e){for(var r={},n=0;n<t.length;++n)for(var i=t[n].name,o=i.split("."),a=r,s=0;s<o.length;++s){var l=o[s].split("[");if(l.length>1){l[0]in a||(a[l[0]]=[]),a=a[l[0]];for(var u=1;u<l.length;++u){var c=parseInt(l[u]);u<l.length-1||s<o.length-1?(c in a||(u<l.length-1?a[c]=[]:a[c]={}),a=a[c]):e?a[c]=n:a[c]=t[n].type}}else s<o.length-1?(l[0]in a||(a[l[0]]={}),a=a[l[0]]):e?a[l[0]]=n:a[l[0]]=t[n].type}return r}e.exports=n},{}],208:[function(t,e,r){"use strict";function n(t,e){if(!s){var r=Object.keys(a);s={};for(var n=0;n<r.length;++n){var i=r[n];s[t[i]]=a[i]}}return s[e]}function i(t,e){for(var r=t.getProgramParameter(e,t.ACTIVE_UNIFORMS),i=[],o=0;r>o;++o){var a=t.getActiveUniform(e,o);if(a){var s=n(t,a.type);if(a.size>1)for(var l=0;l<a.size;++l)i.push({name:a.name.replace("[0]","["+l+"]"),type:s});else i.push({name:a.name,type:s})}}return i}function o(t,e){for(var r=t.getProgramParameter(e,t.ACTIVE_ATTRIBUTES),i=[],o=0;r>o;++o){var a=t.getActiveAttrib(e,o);a&&i.push({name:a.name,type:n(t,a.type)})}return i}r.uniforms=i,r.attributes=o;var a={FLOAT:"float",FLOAT_VEC2:"vec2",FLOAT_VEC3:"vec3",FLOAT_VEC4:"vec4",INT:"int",INT_VEC2:"ivec2",INT_VEC3:"ivec3",INT_VEC4:"ivec4",BOOL:"bool",BOOL_VEC2:"bvec2",BOOL_VEC3:"bvec3",BOOL_VEC4:"bvec4",FLOAT_MAT2:"mat2",FLOAT_MAT3:"mat3",FLOAT_MAT4:"mat4",SAMPLER_2D:"sampler2D",SAMPLER_CUBE:"samplerCube"},s=null},{}],209:[function(t,e,r){"use strict";function n(t,e,r,n,i,o,a){this.id=t,this.src=e,this.type=r,this.shader=n,this.count=o,this.programs=[],this.cache=a}function i(t){this.gl=t,this.shaders=[{},{}],this.programs={}}function o(t,e,r){var n=t.createShader(e);if(t.shaderSource(n,r),t.compileShader(n),!t.getShaderParameter(n,t.COMPILE_STATUS)){var i=t.getShaderInfoLog(n);try{var o=h(i,r,e)}catch(a){throw console.warn("Failed to format compiler error: "+a),new c(i,"Error compiling shader:\n"+i)}throw new c(i,o.short,o.long)}return n}function a(t,e,r,n,i){var o=t.createProgram();t.attachShader(o,e),t.attachShader(o,r);for(var a=0;a<n.length;++a)t.bindAttribLocation(o,i[a],n[a]);if(t.linkProgram(o),!t.getProgramParameter(o,t.LINK_STATUS)){var s=t.getProgramInfoLog(o);throw new c(s,"Error linking program: "+s)}return o}function s(t){var e=d.get(t);return e||(e=new i(t),d.set(t,e)),e}function l(t,e,r){return s(t).getShaderReference(e,r)}function u(t,e,r,n,i){return s(t).getProgram(e,r,n,i)}r.shader=l,r.program=u;var c=t("./GLError"),h=t("gl-format-compiler-error"),f="undefined"==typeof WeakMap?t("weakmap-shim"):WeakMap,d=new f,p=0;n.prototype.dispose=function(){if(0===--this.count){for(var t=this.cache,e=t.gl,r=this.programs,n=0,i=r.length;i>n;++n){var o=t.programs[r[n]];o&&(delete t.programs[n],e.deleteProgram(o))}e.deleteShader(this.shader),delete t.shaders[this.type===e.FRAGMENT_SHADER|0][this.src]}};var v=i.prototype;v.getShaderReference=function(t,e){var r=this.gl,i=this.shaders[t===r.FRAGMENT_SHADER|0],a=i[e];if(a&&r.isShader(a.shader))a.count+=1;else{var s=o(r,t,e);a=i[e]=new n(p++,e,t,s,[],1,this)}return a},v.getProgram=function(t,e,r,n){var i=[t.id,e.id,r.join(":"),n.join(":")].join("@"),o=this.programs[i];return o&&this.gl.isProgram(o)||(this.programs[i]=o=a(this.gl,t.shader,e.shader,r,n),t.programs.push(i),e.programs.push(i)),o}},{"./GLError":204,"gl-format-compiler-error":210,"weakmap-shim":220}],210:[function(t,e,r){function n(t,e,r){"use strict";var n=a(e)||"of unknown name (see npm glsl-shader-name)",l="unknown type";void 0!==r&&(l=r===o.FRAGMENT_SHADER?"fragment":"vertex");for(var u=i("Error compiling %s shader %s:\n",l,n),c=i("%s%s",u,t),h=t.split("\n"),f={},d=0;d<h.length;d++){var p=h[d];if(""!==p){var v=parseInt(p.split(":")[2]);if(isNaN(v))throw new Error(i("Could not parse error: %s",p));f[v]=p}}for(var m=s(e).split("\n"),d=0;d<m.length;d++)if(f[d+3]||f[d+2]||f[d+1]){var g=m[d];if(u+=g+"\n",f[d+1]){var y=f[d+1];y=y.substr(y.split(":",3).join(":").length+1).trim(),u+=i("^^^ %s\n\n",y)}}return{"long":u.trim(),"short":c.trim()}}var i=t("sprintf-js").sprintf,o=t("gl-constants/lookup"),a=t("glsl-shader-name"),s=t("add-line-numbers");e.exports=n},{"add-line-numbers":211,"gl-constants/lookup":214,"glsl-shader-name":215,"sprintf-js":217}],211:[function(t,e,r){function n(t,e,r){e="number"==typeof e?e:1,r=r||": ";var n=t.split(/\r?\n/),o=String(n.length+e-1).length;return n.map(function(t,n){var a=n+e,s=String(a).length,l=i(a,o-s);return l+r+t}).join("\n")}var i=t("pad-left");e.exports=n},{"pad-left":212}],212:[function(t,e,r){"use strict";var n=t("repeat-string");e.exports=function(t,e,r){return r="undefined"!=typeof r?r+"":" ",n(r,e)+t}},{"repeat-string":434}],213:[function(t,e,r){e.exports={0:"NONE",1:"ONE",2:"LINE_LOOP",3:"LINE_STRIP",4:"TRIANGLES",5:"TRIANGLE_STRIP",6:"TRIANGLE_FAN",256:"DEPTH_BUFFER_BIT",512:"NEVER",513:"LESS",514:"EQUAL",515:"LEQUAL",516:"GREATER",517:"NOTEQUAL",518:"GEQUAL",519:"ALWAYS",768:"SRC_COLOR",769:"ONE_MINUS_SRC_COLOR",770:"SRC_ALPHA",771:"ONE_MINUS_SRC_ALPHA",772:"DST_ALPHA",773:"ONE_MINUS_DST_ALPHA",774:"DST_COLOR",775:"ONE_MINUS_DST_COLOR",776:"SRC_ALPHA_SATURATE",1024:"STENCIL_BUFFER_BIT",1028:"FRONT",1029:"BACK",1032:"FRONT_AND_BACK",1280:"INVALID_ENUM",1281:"INVALID_VALUE",1282:"INVALID_OPERATION",1285:"OUT_OF_MEMORY",1286:"INVALID_FRAMEBUFFER_OPERATION",2304:"CW",2305:"CCW",2849:"LINE_WIDTH",2884:"CULL_FACE",2885:"CULL_FACE_MODE",2886:"FRONT_FACE",2928:"DEPTH_RANGE",2929:"DEPTH_TEST",2930:"DEPTH_WRITEMASK",2931:"DEPTH_CLEAR_VALUE",2932:"DEPTH_FUNC",2960:"STENCIL_TEST",2961:"STENCIL_CLEAR_VALUE",2962:"STENCIL_FUNC",2963:"STENCIL_VALUE_MASK",2964:"STENCIL_FAIL",2965:"STENCIL_PASS_DEPTH_FAIL",2966:"STENCIL_PASS_DEPTH_PASS",2967:"STENCIL_REF",2968:"STENCIL_WRITEMASK",2978:"VIEWPORT",3024:"DITHER",3042:"BLEND",3088:"SCISSOR_BOX",3089:"SCISSOR_TEST",3106:"COLOR_CLEAR_VALUE",3107:"COLOR_WRITEMASK",3317:"UNPACK_ALIGNMENT",3333:"PACK_ALIGNMENT",3379:"MAX_TEXTURE_SIZE",3386:"MAX_VIEWPORT_DIMS",3408:"SUBPIXEL_BITS",3410:"RED_BITS",3411:"GREEN_BITS",3412:"BLUE_BITS",3413:"ALPHA_BITS",3414:"DEPTH_BITS",3415:"STENCIL_BITS",3553:"TEXTURE_2D",4352:"DONT_CARE",4353:"FASTEST",4354:"NICEST",5120:"BYTE",5121:"UNSIGNED_BYTE",5122:"SHORT",5123:"UNSIGNED_SHORT",5124:"INT",5125:"UNSIGNED_INT",5126:"FLOAT",5386:"INVERT",5890:"TEXTURE",6401:"STENCIL_INDEX",6402:"DEPTH_COMPONENT",6406:"ALPHA",6407:"RGB",6408:"RGBA",6409:"LUMINANCE",6410:"LUMINANCE_ALPHA",7680:"KEEP",7681:"REPLACE",7682:"INCR",7683:"DECR",7936:"VENDOR",7937:"RENDERER",7938:"VERSION",9728:"NEAREST",9729:"LINEAR",9984:"NEAREST_MIPMAP_NEAREST",9985:"LINEAR_MIPMAP_NEAREST",9986:"NEAREST_MIPMAP_LINEAR",9987:"LINEAR_MIPMAP_LINEAR",10240:"TEXTURE_MAG_FILTER",10241:"TEXTURE_MIN_FILTER",10242:"TEXTURE_WRAP_S",10243:"TEXTURE_WRAP_T",10497:"REPEAT",10752:"POLYGON_OFFSET_UNITS",16384:"COLOR_BUFFER_BIT",32769:"CONSTANT_COLOR",32770:"ONE_MINUS_CONSTANT_COLOR",32771:"CONSTANT_ALPHA",32772:"ONE_MINUS_CONSTANT_ALPHA",32773:"BLEND_COLOR",32774:"FUNC_ADD",32777:"BLEND_EQUATION_RGB",32778:"FUNC_SUBTRACT",32779:"FUNC_REVERSE_SUBTRACT",32819:"UNSIGNED_SHORT_4_4_4_4",32820:"UNSIGNED_SHORT_5_5_5_1",32823:"POLYGON_OFFSET_FILL",32824:"POLYGON_OFFSET_FACTOR",32854:"RGBA4",32855:"RGB5_A1",32873:"TEXTURE_BINDING_2D",32926:"SAMPLE_ALPHA_TO_COVERAGE",32928:"SAMPLE_COVERAGE",32936:"SAMPLE_BUFFERS",32937:"SAMPLES",32938:"SAMPLE_COVERAGE_VALUE",32939:"SAMPLE_COVERAGE_INVERT",32968:"BLEND_DST_RGB",32969:"BLEND_SRC_RGB",32970:"BLEND_DST_ALPHA",32971:"BLEND_SRC_ALPHA",33071:"CLAMP_TO_EDGE",33170:"GENERATE_MIPMAP_HINT",33189:"DEPTH_COMPONENT16",33306:"DEPTH_STENCIL_ATTACHMENT",33635:"UNSIGNED_SHORT_5_6_5",33648:"MIRRORED_REPEAT",33901:"ALIASED_POINT_SIZE_RANGE",33902:"ALIASED_LINE_WIDTH_RANGE",33984:"TEXTURE0",33985:"TEXTURE1",33986:"TEXTURE2",33987:"TEXTURE3",33988:"TEXTURE4",33989:"TEXTURE5",33990:"TEXTURE6",33991:"TEXTURE7",33992:"TEXTURE8",33993:"TEXTURE9",33994:"TEXTURE10",33995:"TEXTURE11",33996:"TEXTURE12",33997:"TEXTURE13",33998:"TEXTURE14",33999:"TEXTURE15",34e3:"TEXTURE16",34001:"TEXTURE17",34002:"TEXTURE18",34003:"TEXTURE19",34004:"TEXTURE20",34005:"TEXTURE21",34006:"TEXTURE22",34007:"TEXTURE23",34008:"TEXTURE24",34009:"TEXTURE25",34010:"TEXTURE26",34011:"TEXTURE27",34012:"TEXTURE28",34013:"TEXTURE29",34014:"TEXTURE30",34015:"TEXTURE31",34016:"ACTIVE_TEXTURE",34024:"MAX_RENDERBUFFER_SIZE",34041:"DEPTH_STENCIL",34055:"INCR_WRAP",34056:"DECR_WRAP",34067:"TEXTURE_CUBE_MAP",34068:"TEXTURE_BINDING_CUBE_MAP",34069:"TEXTURE_CUBE_MAP_POSITIVE_X",34070:"TEXTURE_CUBE_MAP_NEGATIVE_X",34071:"TEXTURE_CUBE_MAP_POSITIVE_Y",34072:"TEXTURE_CUBE_MAP_NEGATIVE_Y",34073:"TEXTURE_CUBE_MAP_POSITIVE_Z",34074:"TEXTURE_CUBE_MAP_NEGATIVE_Z",34076:"MAX_CUBE_MAP_TEXTURE_SIZE",34338:"VERTEX_ATTRIB_ARRAY_ENABLED",34339:"VERTEX_ATTRIB_ARRAY_SIZE",34340:"VERTEX_ATTRIB_ARRAY_STRIDE",34341:"VERTEX_ATTRIB_ARRAY_TYPE",34342:"CURRENT_VERTEX_ATTRIB",34373:"VERTEX_ATTRIB_ARRAY_POINTER",34466:"NUM_COMPRESSED_TEXTURE_FORMATS",34467:"COMPRESSED_TEXTURE_FORMATS",34660:"BUFFER_SIZE",34661:"BUFFER_USAGE",34816:"STENCIL_BACK_FUNC",34817:"STENCIL_BACK_FAIL",34818:"STENCIL_BACK_PASS_DEPTH_FAIL",34819:"STENCIL_BACK_PASS_DEPTH_PASS",34877:"BLEND_EQUATION_ALPHA",34921:"MAX_VERTEX_ATTRIBS",34922:"VERTEX_ATTRIB_ARRAY_NORMALIZED",34930:"MAX_TEXTURE_IMAGE_UNITS",34962:"ARRAY_BUFFER",34963:"ELEMENT_ARRAY_BUFFER",34964:"ARRAY_BUFFER_BINDING",34965:"ELEMENT_ARRAY_BUFFER_BINDING",34975:"VERTEX_ATTRIB_ARRAY_BUFFER_BINDING",35040:"STREAM_DRAW",35044:"STATIC_DRAW",35048:"DYNAMIC_DRAW",35632:"FRAGMENT_SHADER",35633:"VERTEX_SHADER",35660:"MAX_VERTEX_TEXTURE_IMAGE_UNITS",35661:"MAX_COMBINED_TEXTURE_IMAGE_UNITS",35663:"SHADER_TYPE",35664:"FLOAT_VEC2",35665:"FLOAT_VEC3",35666:"FLOAT_VEC4",35667:"INT_VEC2",35668:"INT_VEC3",35669:"INT_VEC4",35670:"BOOL",35671:"BOOL_VEC2",35672:"BOOL_VEC3",35673:"BOOL_VEC4",35674:"FLOAT_MAT2",35675:"FLOAT_MAT3",35676:"FLOAT_MAT4",35678:"SAMPLER_2D",35680:"SAMPLER_CUBE",35712:"DELETE_STATUS",35713:"COMPILE_STATUS",35714:"LINK_STATUS",35715:"VALIDATE_STATUS",35716:"INFO_LOG_LENGTH",35717:"ATTACHED_SHADERS",35718:"ACTIVE_UNIFORMS",35719:"ACTIVE_UNIFORM_MAX_LENGTH",35720:"SHADER_SOURCE_LENGTH",35721:"ACTIVE_ATTRIBUTES",35722:"ACTIVE_ATTRIBUTE_MAX_LENGTH",35724:"SHADING_LANGUAGE_VERSION",35725:"CURRENT_PROGRAM",36003:"STENCIL_BACK_REF",36004:"STENCIL_BACK_VALUE_MASK",36005:"STENCIL_BACK_WRITEMASK",36006:"FRAMEBUFFER_BINDING",36007:"RENDERBUFFER_BINDING",36048:"FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE",36049:"FRAMEBUFFER_ATTACHMENT_OBJECT_NAME",36050:"FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL",36051:"FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE",36053:"FRAMEBUFFER_COMPLETE",36054:"FRAMEBUFFER_INCOMPLETE_ATTACHMENT",36055:"FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT",36057:"FRAMEBUFFER_INCOMPLETE_DIMENSIONS",36061:"FRAMEBUFFER_UNSUPPORTED",36064:"COLOR_ATTACHMENT0",36096:"DEPTH_ATTACHMENT",36128:"STENCIL_ATTACHMENT",36160:"FRAMEBUFFER",36161:"RENDERBUFFER",36162:"RENDERBUFFER_WIDTH",36163:"RENDERBUFFER_HEIGHT",36164:"RENDERBUFFER_INTERNAL_FORMAT",36168:"STENCIL_INDEX8",36176:"RENDERBUFFER_RED_SIZE",36177:"RENDERBUFFER_GREEN_SIZE",36178:"RENDERBUFFER_BLUE_SIZE",36179:"RENDERBUFFER_ALPHA_SIZE",36180:"RENDERBUFFER_DEPTH_SIZE",36181:"RENDERBUFFER_STENCIL_SIZE",36194:"RGB565",36336:"LOW_FLOAT",36337:"MEDIUM_FLOAT",36338:"HIGH_FLOAT",36339:"LOW_INT",36340:"MEDIUM_INT",36341:"HIGH_INT",36346:"SHADER_COMPILER",36347:"MAX_VERTEX_UNIFORM_VECTORS",36348:"MAX_VARYING_VECTORS",36349:"MAX_FRAGMENT_UNIFORM_VECTORS",37440:"UNPACK_FLIP_Y_WEBGL",37441:"UNPACK_PREMULTIPLY_ALPHA_WEBGL",37442:"CONTEXT_LOST_WEBGL",37443:"UNPACK_COLORSPACE_CONVERSION_WEBGL",37444:"BROWSER_DEFAULT_WEBGL"}},{}],214:[function(t,e,r){var n=t("./1.0/numbers");e.exports=function(t){return n[t]}},{"./1.0/numbers":213}],215:[function(t,e,r){function n(t){for(var e=Array.isArray(t)?t:i(t),r=0;r<e.length;r++){var n=e[r];if("preprocessor"===n.type){var a=n.data.match(/\#define\s+SHADER_NAME(_B64)?\s+(.+)$/);if(a&&a[2]){var s=a[1],l=a[2];return(s?o(l):l).trim()}}}}var i=t("glsl-tokenizer"),o=t("atob-lite");e.exports=n},{"atob-lite":216,"glsl-tokenizer":240}],216:[function(t,e,r){e.exports=function(t){return atob(t)}},{}],217:[function(e,r,n){!function(e){function r(){var t=arguments[0],e=r.cache;return e[t]&&e.hasOwnProperty(t)||(e[t]=r.parse(t)),r.format.call(null,e[t],arguments)}function i(t){return Object.prototype.toString.call(t).slice(8,-1).toLowerCase()}function o(t,e){return Array(e+1).join(t)}var a={not_string:/[^s]/,number:/[diefg]/,json:/[j]/,not_json:/[^j]/,text:/^[^\x25]+/,modulo:/^\x25{2}/,placeholder:/^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijosuxX])/,key:/^([a-z_][a-z_\d]*)/i,key_access:/^\.([a-z_][a-z_\d]*)/i,index_access:/^\[(\d+)\]/,sign:/^[\+\-]/};r.format=function(t,e){var n,s,l,u,c,h,f,d=1,p=t.length,v="",m=[],g=!0,y="";for(s=0;p>s;s++)if(v=i(t[s]),"string"===v)m[m.length]=t[s];else if("array"===v){if(u=t[s],u[2])for(n=e[d],l=0;l<u[2].length;l++){if(!n.hasOwnProperty(u[2][l]))throw new Error(r("[sprintf] property '%s' does not exist",u[2][l]));n=n[u[2][l]]}else n=u[1]?e[u[1]]:e[d++];if("function"==i(n)&&(n=n()),a.not_string.test(u[8])&&a.not_json.test(u[8])&&"number"!=i(n)&&isNaN(n))throw new TypeError(r("[sprintf] expecting number but found %s",i(n)));switch(a.number.test(u[8])&&(g=n>=0),u[8]){case"b":n=n.toString(2);break;case"c":n=String.fromCharCode(n);break;case"d":case"i":n=parseInt(n,10);break;case"j":n=JSON.stringify(n,null,u[6]?parseInt(u[6]):0);break;case"e":n=u[7]?n.toExponential(u[7]):n.toExponential();break;case"f":n=u[7]?parseFloat(n).toFixed(u[7]):parseFloat(n);break;case"g":n=u[7]?parseFloat(n).toPrecision(u[7]):parseFloat(n);break;case"o":n=n.toString(8);break;case"s":n=(n=String(n))&&u[7]?n.substring(0,u[7]):n;break;case"u":n>>>=0;break;case"x":n=n.toString(16);break;case"X":n=n.toString(16).toUpperCase()}a.json.test(u[8])?m[m.length]=n:(!a.number.test(u[8])||g&&!u[3]?y="":(y=g?"+":"-",n=n.toString().replace(a.sign,"")),h=u[4]?"0"===u[4]?"0":u[4].charAt(1):" ",f=u[6]-(y+n).length,c=u[6]&&f>0?o(h,f):"",m[m.length]=u[5]?y+n+c:"0"===h?y+c+n:c+y+n)}return m.join("")},r.cache={},r.parse=function(t){for(var e=t,r=[],n=[],i=0;e;){if(null!==(r=a.text.exec(e)))n[n.length]=r[0];else if(null!==(r=a.modulo.exec(e)))n[n.length]="%";else{if(null===(r=a.placeholder.exec(e)))throw new SyntaxError("[sprintf] unexpected placeholder");if(r[2]){i|=1;var o=[],s=r[2],l=[];if(null===(l=a.key.exec(s)))throw new SyntaxError("[sprintf] failed to parse named argument key");for(o[o.length]=l[1];""!==(s=s.substring(l[0].length));)if(null!==(l=a.key_access.exec(s)))o[o.length]=l[1];else{if(null===(l=a.index_access.exec(s)))throw new SyntaxError("[sprintf] failed to parse named argument key");o[o.length]=l[1]}r[2]=o}else i|=2;if(3===i)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");n[n.length]=r}e=e.substring(r[0].length)}return n};var s=function(t,e,n){return n=(e||[]).slice(0),n.splice(0,0,t),r.apply(null,n)};"undefined"!=typeof n?(n.sprintf=r,n.vsprintf=s):(e.sprintf=r,e.vsprintf=s,"function"==typeof t&&t.amd&&t(function(){return{sprintf:r,vsprintf:s}}))}("undefined"==typeof window?this:window)},{}],218:[function(t,e,r){function n(){var t={};return function(e){if(("object"!=typeof e||null===e)&&"function"!=typeof e)throw new Error("Weakmap-shim: Key must be object");var r=e.valueOf(t);return r&&r.identity===t?r:i(e,t)}}var i=t("./hidden-store.js");e.exports=n},{"./hidden-store.js":219}],219:[function(t,e,r){function n(t,e){var r={identity:e},n=t.valueOf;return Object.defineProperty(t,"valueOf",{value:function(t){return t!==e?n.apply(this,arguments):r},writable:!0}),r}e.exports=n},{}],220:[function(t,e,r){function n(){var t=i();return{get:function(e,r){var n=t(e);return n.hasOwnProperty("value")?n.value:r},set:function(e,r){t(e).value=r},has:function(e){return"value"in t(e)},"delete":function(e){return delete t(e).value}}}var i=t("./create-store.js");e.exports=n},{"./create-store.js":218}],221:[function(t,e,r){"use strict";function n(t){this.plot=t,this.enable=[!0,!0,!1,!1],this.width=[1,1,1,1],this.color=[[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.center=[1/0,1/0]}function i(t,e){var r=new n(t);return r.update(e),t.addOverlay(r),r}e.exports=i;var o=n.prototype;o.update=function(t){t=t||{},this.enable=(t.enable||[!0,!0,!1,!1]).slice(),this.width=(t.width||[1,1,1,1]).slice(),this.color=(t.color||[[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]]).map(function(t){return t.slice()}),this.center=(t.center||[1/0,1/0]).slice(),this.plot.setOverlayDirty()},o.draw=function(){var t=this.enable,e=this.width,r=this.color,n=this.center,i=this.plot,o=i.line,a=i.dataBox,s=i.viewBox;if(o.bind(),a[0]<=n[0]&&n[0]<=a[2]&&a[1]<=n[1]&&n[1]<=a[3]){var l=s[0]+(n[0]-a[0])/(a[2]-a[0])*(s[2]-s[0]),u=s[1]+(n[1]-a[1])/(a[3]-a[1])*(s[3]-s[1]);t[0]&&o.drawLine(l,u,s[0],u,e[0],r[0]),t[1]&&o.drawLine(l,u,l,s[1],e[1],r[1]),t[2]&&o.drawLine(l,u,s[2],u,e[2],r[2]),t[3]&&o.drawLine(l,u,l,s[3],e[3],r[3])}},o.dispose=function(){this.plot.removeOverlay(this)}},{}],222:[function(t,e,r){var n=t("gl-shader"),i="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec4 uv;\nattribute vec3 f;\nattribute vec3 normal;\n\nuniform mat4 model, view, projection, inverseModel;\nuniform vec3 lightPosition, eyePosition;\n\nvarying float value, kill;\nvarying vec3 worldCoordinate;\nvarying vec2 planeCoordinate;\nvarying vec3 lightDirection, eyeDirection, surfaceNormal;\n\nvoid main() {\n  worldCoordinate = vec3(uv.zw, f.x);\n  vec4 worldPosition = model * vec4(worldCoordinate, 1.0);\n  vec4 clipPosition = projection * view * worldPosition;\n  gl_Position = clipPosition;\n  kill = f.y;\n  value = f.z;\n  planeCoordinate = uv.xy;\n\n  //Lighting geometry parameters\n  vec4 cameraCoordinate = view * worldPosition;\n  cameraCoordinate.xyz /= cameraCoordinate.w;\n  lightDirection = lightPosition - cameraCoordinate.xyz;\n  eyeDirection   = eyePosition - cameraCoordinate.xyz;\n  surfaceNormal  = normalize((vec4(normal,0) * inverseModel).xyz);\n}\n",o="precision mediump float;\n#define GLSLIFY 1\n\nfloat beckmannDistribution_2_0(float x, float roughness) {\n  float NdotH = max(x, 0.0001);\n  float cos2Alpha = NdotH * NdotH;\n  float tan2Alpha = (cos2Alpha - 1.0) / cos2Alpha;\n  float roughness2 = roughness * roughness;\n  float denom = 3.141592653589793 * roughness2 * cos2Alpha * cos2Alpha;\n  return exp(tan2Alpha / roughness2) / denom;\n}\n\n\n\nfloat beckmannSpecular_1_1(\n  vec3 lightDirection,\n  vec3 viewDirection,\n  vec3 surfaceNormal,\n  float roughness) {\n  return beckmannDistribution_2_0(dot(surfaceNormal, normalize(lightDirection + viewDirection)), roughness);\n}\n\n\n\nuniform vec3 lowerBound, upperBound;\nuniform float contourTint;\nuniform vec4 contourColor;\nuniform sampler2D colormap;\nuniform vec3 clipBounds[2];\nuniform float roughness, fresnel, kambient, kdiffuse, kspecular, opacity;\n\nvarying float value, kill;\nvarying vec3 worldCoordinate;\nvarying vec3 lightDirection, eyeDirection, surfaceNormal;\n\nvoid main() {\n  if(kill > 0.0 ||\n    any(lessThan(worldCoordinate, clipBounds[0])) || any(greaterThan(worldCoordinate, clipBounds[1]))) {\n    discard;\n  }\n\n  vec3 N = normalize(surfaceNormal);\n  vec3 V = normalize(eyeDirection);\n  vec3 L = normalize(lightDirection);\n\n  if(gl_FrontFacing) {\n    N = -N;\n  }\n\n  float specular = beckmannSpecular_1_1(L, V, N, roughness);\n  float diffuse  = min(kambient + kdiffuse * max(dot(N, L), 0.0), 1.0);\n\n  vec4 surfaceColor = texture2D(colormap, vec2(value, value));\n  vec4 litColor = surfaceColor.a * vec4(diffuse * surfaceColor.rgb + kspecular * vec3(1,1,1) * specular,  1.0);\n\n  gl_FragColor = mix(litColor, contourColor, contourTint) * opacity;\n}\n",a="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec4 uv;\nattribute float f;\n\nuniform mat3 permutation;\nuniform mat4 model, view, projection;\nuniform float height, zOffset;\n\nvarying float value, kill;\nvarying vec3 worldCoordinate;\nvarying vec2 planeCoordinate;\nvarying vec3 lightDirection, eyeDirection, surfaceNormal;\n\nvoid main() {\n  vec3 dataCoordinate = permutation * vec3(uv.xy, height);\n  vec4 worldPosition = model * vec4(dataCoordinate, 1.0);\n\n  vec4 clipPosition = projection * view * worldPosition;\n  clipPosition.z = clipPosition.z + zOffset;\n\n  gl_Position = clipPosition;\n  value = f;\n  kill = -1.0;\n  worldCoordinate = dataCoordinate;\n  planeCoordinate = uv.zw;\n\n  //Don't do lighting for contours\n  surfaceNormal   = vec3(1,0,0);\n  eyeDirection    = vec3(0,1,0);\n  lightDirection  = vec3(0,0,1);\n}\n",s="precision mediump float;\n#define GLSLIFY 1\n\nuniform vec2 shape;\nuniform vec3 clipBounds[2];\nuniform float pickId;\n\nvarying float value, kill;\nvarying vec3 worldCoordinate;\nvarying vec2 planeCoordinate;\nvarying vec3 surfaceNormal;\n\nvec2 splitFloat(float v) {\n  float vh = 255.0 * v;\n  float upper = floor(vh);\n  float lower = fract(vh);\n  return vec2(upper / 255.0, floor(lower * 16.0) / 16.0);\n}\n\nvoid main() {\n  if(kill > 0.0 ||\n    any(lessThan(worldCoordinate, clipBounds[0])) || any(greaterThan(worldCoordinate, clipBounds[1]))) {\n    discard;\n  }\n  vec2 ux = splitFloat(planeCoordinate.x / shape.x);\n  vec2 uy = splitFloat(planeCoordinate.y / shape.y);\n  gl_FragColor = vec4(pickId, ux.x, uy.x, ux.y + (uy.y/16.0));\n}\n";r.createShader=function(t){var e=n(t,i,o,null,[{name:"uv",type:"vec4"},{name:"f",type:"vec3"},{name:"normal",type:"vec3"}]);return e.attributes.uv.location=0,e.attributes.f.location=1,e.attributes.normal.location=2,e},r.createPickShader=function(t){var e=n(t,i,s,null,[{name:"uv",type:"vec4"},{name:"f",type:"vec3"},{name:"normal",type:"vec3"}]);return e.attributes.uv.location=0,e.attributes.f.location=1,e.attributes.normal.location=2,e},r.createContourShader=function(t){var e=n(t,a,o,null,[{name:"uv",type:"vec4"},{name:"f",type:"float"}]);return e.attributes.uv.location=0,e.attributes.f.location=1,e},r.createPickContourShader=function(t){var e=n(t,a,s,null,[{name:"uv",type:"vec4"},{name:"f",type:"float"}]);return e.attributes.uv.location=0,e.attributes.f.location=1,e}},{"gl-shader":203}],223:[function(t,e,r){arguments[4][22][0].apply(r,arguments)},{dup:22}],224:[function(t,e,r){"use strict";function n(t){if(t in l)return l[t];for(var e=[],r=0;t>r;++r)e.push("out",r,"s=0.5*(inp",r,"l-inp",r,"r);");for(var n=["array"],i=["junk"],r=0;t>r;++r){n.push("array"),i.push("out"+r+"s");var o=a(t);o[r]=-1,n.push({array:0,offset:o.slice()}),o[r]=1,n.push({array:0,offset:o.slice()}),i.push("inp"+r+"l","inp"+r+"r")}return l[t]=s({args:n,pre:c,post:c,body:{body:e.join(""),args:i.map(function(t){return{name:t,lvalue:0===t.indexOf("out"),rvalue:0===t.indexOf("inp"),count:"junk"!==t|0}}),thisVars:[],localVars:[]},funcName:"fdTemplate"+t})}function i(t){function e(e){for(var r=o-e.length,n=[],i=[],s=[],l=0;o>l;++l)e.indexOf(l+1)>=0?s.push("0"):e.indexOf(-(l+1))>=0?s.push("s["+l+"]-1"):(s.push("-1"),n.push("1"),i.push("s["+l+"]-2"));var u=".lo("+n.join()+").hi("+i.join()+")";if(0===n.length&&(u=""),r>0){a.push("if(1");for(var l=0;o>l;++l)e.indexOf(l+1)>=0||e.indexOf(-(l+1))>=0||a.push("&&s[",l,"]>2");a.push("){grad",r,"(src.pick(",s.join(),")",u);for(var l=0;o>l;++l)e.indexOf(l+1)>=0||e.indexOf(-(l+1))>=0||a.push(",dst.pick(",s.join(),",",l,")",u);a.push(");")}for(var l=0;l<e.length;++l){var c=Math.abs(e[l])-1,h="dst.pick("+s.join()+","+c+")"+u;switch(t[c]){case"clamp":var f=s.slice(),d=s.slice();e[l]<0?f[c]="s["+c+"]-2":d[c]="1",0===r?a.push("if(s[",c,"]>1){dst.set(",s.join(),",",c,",0.5*(src.get(",f.join(),")-src.get(",d.join(),")))}else{dst.set(",s.join(),",",c,",0)};"):a.push("if(s[",c,"]>1){diff(",h,",src.pick(",f.join(),")",u,",src.pick(",d.join(),")",u,");}else{zero(",h,");};");break;case"mirror":0===r?a.push("dst.set(",s.join(),",",c,",0);"):a.push("zero(",h,");");break;case"wrap":var p=s.slice(),v=s.slice();e[l]<0?(p[c]="s["+c+"]-2",v[c]="0"):(p[c]="s["+c+"]-1",v[c]="1"),0===r?a.push("if(s[",c,"]>2){dst.set(",s.join(),",",c,",0.5*(src.get(",p.join(),")-src.get(",v.join(),")))}else{dst.set(",s.join(),",",c,",0)};"):a.push("if(s[",c,"]>2){diff(",h,",src.pick(",p.join(),")",u,",src.pick(",v.join(),")",u,");}else{zero(",h,");};");break;default:throw new Error("ndarray-gradient: Invalid boundary condition")}}r>0&&a.push("};")}var r=t.join(),i=u[r];if(i)return i;for(var o=t.length,a=["function gradient(dst,src){var s=src.shape.slice();"],s=0;1<<o>s;++s){for(var c=[],d=0;o>d;++d)s&1<<d&&c.push(d+1);for(var p=0;p<1<<c.length;++p){for(var v=c.slice(),d=0;d<c.length;++d)p&1<<d&&(v[d]=-v[d]);e(v)}}a.push("return dst;};return gradient");for(var m=["diff","zero"],g=[h,f],s=1;o>=s;++s)m.push("grad"+s),g.push(n(s));m.push(a.join(""));var y=Function.apply(void 0,m),i=y.apply(void 0,g);return l[r]=i,i}function o(t,e,r){if(Array.isArray(r)){if(r.length!==e.dimension)throw new Error("ndarray-gradient: invalid boundary conditions")}else r="string"==typeof r?a(e.dimension,r):a(e.dimension,"clamp");if(t.dimension!==e.dimension+1)throw new Error("ndarray-gradient: output dimension must be +1 input dimension");if(t.shape[e.dimension]!==e.dimension)throw new Error("ndarray-gradient: output shape must match input shape");for(var n=0;n<e.dimension;++n)if(t.shape[n]!==e.shape[n])throw new Error("ndarray-gradient: shape mismatch");if(0===e.size)return t;if(e.dimension<=0)return t.set(0),t;var o=i(r);return o(t,e)}e.exports=o;var a=t("dup"),s=t("cwise-compiler"),l={},u={},c={body:"",args:[],thisVars:[],localVars:[]},h=s({args:["array","array","array"],pre:c,post:c,body:{args:[{name:"out",lvalue:!0,rvalue:!1,count:1},{name:"left",lvalue:!1,rvalue:!0,count:1},{name:"right",lvalue:!1,rvalue:!0,count:1}],body:"out=0.5*(left-right)",thisVars:[],localVars:[]},funcName:"cdiff"}),f=s({args:["array"],pre:c,post:c,body:{args:[{name:"out",lvalue:!0,rvalue:!1,count:1}],body:"out=0",thisVars:[],localVars:[]},funcName:"zero"})},{"cwise-compiler":115,dup:121}],225:[function(t,e,r){"use strict";var n=t("ndarray"),i=t("./doConvert.js");e.exports=function(t,e){for(var r=[],o=t,a=1;o instanceof Array;)r.push(o.length),a*=o.length,o=o[0];return 0===r.length?n():(e||(e=n(new Float64Array(a),r)),i(e,t),e)}},{"./doConvert.js":226,ndarray:433}],226:[function(t,e,r){e.exports=t("cwise-compiler")({args:["array","scalar","index"],pre:{body:"{}",args:[],thisVars:[],localVars:[]},body:{body:"{\nvar _inline_1_v=_inline_1_arg1_,_inline_1_i\nfor(_inline_1_i=0;_inline_1_i<_inline_1_arg2_.length-1;++_inline_1_i) {\n_inline_1_v=_inline_1_v[_inline_1_arg2_[_inline_1_i]]\n}\n_inline_1_arg0_=_inline_1_v[_inline_1_arg2_[_inline_1_arg2_.length-1]]\n}",args:[{name:"_inline_1_arg0_",lvalue:!0,rvalue:!1,count:1},{name:"_inline_1_arg1_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_1_arg2_",lvalue:!1,rvalue:!0,count:4}],thisVars:[],localVars:["_inline_1_i","_inline_1_v"]},post:{body:"{}",args:[],thisVars:[],localVars:[]},funcName:"convert",blockSize:64})},{"cwise-compiler":115}],227:[function(t,e,r){"use strict";function n(t,e,r,n,i){this.position=t,this.index=e,this.uv=r,this.level=n,this.dataCoordinate=i}function i(t){var e=x([y({colormap:t,nshades:O,format:"rgba"}).map(function(t){return[t[0],t[1],t[2],255*t[3]]})]);return b.divseq(e,255),e}function o(t,e,r,i,o,a,s,l,u,c,h,f,d,p){this.gl=t,this.shape=e,this.bounds=r,this.intensityBounds=[],this._shader=i,this._pickShader=o,this._coordinateBuffer=a,this._vao=s,this._colorMap=l,this._contourShader=u,this._contourPickShader=c,this._contourBuffer=h,this._contourVAO=f,this._contourOffsets=[[],[],[]],this._contourCounts=[[],[],[]],this._vertexCount=0,this._pickResult=new n([0,0,0],[0,0],[0,0],[0,0,0],[0,0,0]),this._dynamicBuffer=d,this._dynamicVAO=p,this._dynamicOffsets=[0,0,0],this._dynamicCounts=[0,0,0],this.contourWidth=[1,1,1],this.contourLevels=[[1],[1],[1]],this.contourTint=[0,0,0],this.contourColor=[[.5,.5,.5,1],[.5,.5,.5,1],[.5,.5,.5,1]],this.showContour=!0,this.showSurface=!0,this.enableHighlight=[!0,!0,!0],this.highlightColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.highlightTint=[1,1,1],this.highlightLevel=[-1,-1,-1],this.enableDynamic=[!0,!0,!0],this.dynamicLevel=[NaN,NaN,NaN],this.dynamicColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.dynamicTint=[1,1,1],this.dynamicWidth=[1,1,1],this.axesBounds=[[1/0,1/0,1/0],[-(1/0),-(1/0),-(1/0)]],this.surfaceProject=[!1,!1,!1],this.contourProject=[[!1,!1,!1],[!1,!1,!1],[!1,!1,!1]],this.colorBounds=[!1,!1],this._field=[_(g.mallocFloat(1024),[0,0]),_(g.mallocFloat(1024),[0,0]),_(g.mallocFloat(1024),[0,0])],this.pickId=1,this.clipBounds=[[-(1/0),-(1/0),-(1/0)],[1/0,1/0,1/0]],this.snapToData=!1,this.opacity=1,this.lightPosition=[10,1e4,0],this.ambientLight=.8,this.diffuseLight=.8,this.specularLight=2,this.roughness=.5,this.fresnel=1.5,this.dirty=!0}function a(t,e){var r,n,i,o=e.axes&&e.axes.lastCubeProps.axis||j,a=e.showSurface,s=e.showContour;for(r=0;3>r;++r)for(a=a||e.surfaceProject[r],n=0;3>n;++n)s=s||e.contourProject[r][n];for(r=0;3>r;++r){var l=N.projections[r];for(n=0;16>n;++n)l[n]=0;for(n=0;4>n;++n)l[5*n]=1;l[5*r]=0,l[12+r]=e.axesBounds[+(o[r]>0)][r],M(l,t.model,l);var u=N.clipBounds[r];for(i=0;2>i;++i)for(n=0;3>n;++n)u[i][n]=t.clipBounds[i][n];u[0][r]=-1e8,u[1][r]=1e8}return N.showSurface=a,N.showContour=s,N}function s(t,e){t=t||{};var r=this.gl;r.disable(r.CULL_FACE),this._colorMap.bind(0);var n=B;n.model=t.model||C,n.view=t.view||C,n.projection=t.projection||C,n.lowerBound=[this.bounds[0][0],this.bounds[0][1],this.colorBounds[0]||this.bounds[0][2]],n.upperBound=[this.bounds[1][0],this.bounds[1][1],this.colorBounds[1]||this.bounds[1][2]],n.contourColor=this.contourColor[0],n.inverseModel=k(n.inverseModel,n.model);for(var i=0;2>i;++i)for(var o=n.clipBounds[i],s=0;3>s;++s)o[s]=Math.min(Math.max(this.clipBounds[i][s],-1e8),1e8);n.kambient=this.ambientLight,n.kdiffuse=this.diffuseLight,n.kspecular=this.specularLight,n.roughness=this.roughness,n.fresnel=this.fresnel,n.opacity=this.opacity,n.height=0,n.permutation=V;var l=U;for(M(l,n.view,n.model),M(l,n.projection,l),k(l,l),i=0;3>i;++i)n.eyePosition[i]=l[12+i]/l[15];var u=l[15];for(i=0;3>i;++i)u+=this.lightPosition[i]*l[4*i+3];for(i=0;3>i;++i){var c=l[12+i];for(s=0;3>s;++s)c+=l[4*s+i]*this.lightPosition[s];n.lightPosition[i]=c/u}var h=a(n,this);if(h.showSurface&&e===this.opacity<1){for(this._shader.bind(),this._shader.uniforms=n,this._vao.bind(),this.showSurface&&this._vertexCount&&this._vao.draw(r.TRIANGLES,this._vertexCount),i=0;3>i;++i)this.surfaceProject[i]&&this.vertexCount&&(this._shader.uniforms.model=h.projections[i],this._shader.uniforms.clipBounds=h.clipBounds[i],this._vao.draw(r.TRIANGLES,this._vertexCount));this._vao.unbind()}if(h.showContour&&!e){var f=this._contourShader;n.kambient=1,n.kdiffuse=0,n.kspecular=0,n.opacity=1,f.bind(),f.uniforms=n;var d=this._contourVAO;for(d.bind(),i=0;3>i;++i)for(f.uniforms.permutation=D[i],r.lineWidth(this.contourWidth[i]),s=0;s<this.contourLevels[i].length;++s)this._contourCounts[i][s]&&(s===this.highlightLevel[i]?(f.uniforms.contourColor=this.highlightColor[i],
f.uniforms.contourTint=this.highlightTint[i]):0!==s&&s-1!==this.highlightLevel[i]||(f.uniforms.contourColor=this.contourColor[i],f.uniforms.contourTint=this.contourTint[i]),f.uniforms.height=this.contourLevels[i][s],d.draw(r.LINES,this._contourCounts[i][s],this._contourOffsets[i][s]));for(i=0;3>i;++i)for(f.uniforms.model=h.projections[i],f.uniforms.clipBounds=h.clipBounds[i],s=0;3>s;++s)if(this.contourProject[i][s]){f.uniforms.permutation=D[s],r.lineWidth(this.contourWidth[s]);for(var p=0;p<this.contourLevels[s].length;++p)p===this.highlightLevel[s]?(f.uniforms.contourColor=this.highlightColor[s],f.uniforms.contourTint=this.highlightTint[s]):0!==p&&p-1!==this.highlightLevel[s]||(f.uniforms.contourColor=this.contourColor[s],f.uniforms.contourTint=this.contourTint[s]),f.uniforms.height=this.contourLevels[s][p],d.draw(r.LINES,this._contourCounts[s][p],this._contourOffsets[s][p])}for(d=this._dynamicVAO,d.bind(),i=0;3>i;++i)if(0!==this._dynamicCounts[i])for(f.uniforms.model=n.model,f.uniforms.clipBounds=n.clipBounds,f.uniforms.permutation=D[i],r.lineWidth(this.dynamicWidth[i]),f.uniforms.contourColor=this.dynamicColor[i],f.uniforms.contourTint=this.dynamicTint[i],f.uniforms.height=this.dynamicLevel[i],d.draw(r.LINES,this._dynamicCounts[i],this._dynamicOffsets[i]),s=0;3>s;++s)this.contourProject[s][i]&&(f.uniforms.model=h.projections[s],f.uniforms.clipBounds=h.clipBounds[s],d.draw(r.LINES,this._dynamicCounts[i],this._dynamicOffsets[i]));d.unbind()}}function l(t,e){var r=e.shape.slice(),n=t.shape.slice();b.assign(t.lo(1,1).hi(r[0],r[1]),e),b.assign(t.lo(1).hi(r[0],1),e.hi(r[0],1)),b.assign(t.lo(1,n[1]-1).hi(r[0],1),e.lo(0,r[1]-1).hi(r[0],1)),b.assign(t.lo(0,1).hi(1,r[1]),e.hi(1)),b.assign(t.lo(n[0]-1,1).hi(1,r[1]),e.lo(r[0]-1)),t.set(0,0,e.get(0,0)),t.set(0,n[1]-1,e.get(0,r[1]-1)),t.set(n[0]-1,0,e.get(r[0]-1,0)),t.set(n[0]-1,n[1]-1,e.get(r[0]-1,r[1]-1))}function u(t,e){return Array.isArray(t)?[e(t[0]),e(t[1]),e(t[2])]:[e(t),e(t),e(t)]}function c(t){return Array.isArray(t)?3===t.length?[t[0],t[1],t[2],1]:[t[0],t[1],t[2],t[3]]:[0,0,0,1]}function h(t){if(Array.isArray(t)){if(Array.isArray(t))return[c(t[0]),c(t[1]),c(t[2])];var e=c(t);return[e.slice(),e.slice(),e.slice()]}}function f(t){var e=t.gl,r=S(e),n=z(e),i=L(e),a=I(e),s=p(e),l=v(e,[{buffer:s,size:4,stride:P,offset:0},{buffer:s,size:3,stride:P,offset:16},{buffer:s,size:3,stride:P,offset:28}]),u=p(e),c=v(e,[{buffer:u,size:4,stride:20,offset:0},{buffer:u,size:1,stride:20,offset:16}]),h=p(e),f=v(e,[{buffer:h,size:2,type:e.FLOAT}]),d=m(e,1,O,e.RGBA,e.UNSIGNED_BYTE);d.minFilter=e.LINEAR,d.magFilter=e.LINEAR;var g=new o(e,[0,0],[[0,0,0],[0,0,0]],r,n,s,l,d,i,a,u,c,h,f),y={levels:[[],[],[]]};for(var b in t)y[b]=t[b];return y.colormap=y.colormap||"jet",g.update(y),g}e.exports=f;var d=t("bit-twiddle"),p=t("gl-buffer"),v=t("gl-vao"),m=t("gl-texture2d"),g=t("typedarray-pool"),y=t("colormap"),b=t("ndarray-ops"),x=t("ndarray-pack"),_=t("ndarray"),w=t("surface-nets"),M=t("gl-mat4/multiply"),k=t("gl-mat4/invert"),A=t("binary-search-bounds"),T=t("ndarray-gradient"),E=t("./lib/shaders"),S=E.createShader,L=E.createContourShader,z=E.createPickShader,I=E.createPickContourShader,P=40,C=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],R=[[0,0],[0,1],[1,0],[1,1],[1,0],[0,1]],D=[[0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0]];!function(){for(var t=0;3>t;++t){var e=D[t],r=(t+1)%3,n=(t+2)%3;e[r+0]=1,e[n+3]=1,e[t+6]=1}}();var O=265,F=o.prototype;F.isTransparent=function(){return this.opacity<1},F.isOpaque=function(){if(this.opacity>=1)return!0;for(var t=0;3>t;++t)if(this._contourCounts[t].length>0||this._dynamicCounts[t]>0)return!0;return!1},F.pickSlots=1,F.setPickBase=function(t){this.pickId=t};var j=[0,0,0],N={showSurface:!1,showContour:!1,projections:[C.slice(),C.slice(),C.slice()],clipBounds:[[[0,0,0],[0,0,0]],[[0,0,0],[0,0,0]],[[0,0,0],[0,0,0]]]},B={model:C,view:C,projection:C,inverseModel:C.slice(),lowerBound:[0,0,0],upperBound:[0,0,0],colorMap:0,clipBounds:[[0,0,0],[0,0,0]],height:0,contourTint:0,contourColor:[0,0,0,1],permutation:[1,0,0,0,1,0,0,0,1],zOffset:-1e-4,kambient:1,kdiffuse:1,kspecular:1,lightPosition:[1e3,1e3,1e3],eyePosition:[0,0,0],roughness:1,fresnel:1,opacity:1},U=C.slice(),V=[1,0,0,0,1,0,0,0,1];F.draw=function(t){return s.call(this,t,!1)},F.drawTransparent=function(t){return s.call(this,t,!0)};var q={model:C,view:C,projection:C,inverseModel:C,clipBounds:[[0,0,0],[0,0,0]],height:0,shape:[0,0],pickId:0,lowerBound:[0,0,0],upperBound:[0,0,0],zOffset:0,permutation:[1,0,0,0,1,0,0,0,1],lightPosition:[0,0,0],eyePosition:[0,0,0]};F.drawPick=function(t){t=t||{};var e=this.gl;e.disable(e.CULL_FACE);var r=q;r.model=t.model||C,r.view=t.view||C,r.projection=t.projection||C,r.shape=this._field[2].shape,r.pickId=this.pickId/255,r.lowerBound=this.bounds[0],r.upperBound=this.bounds[1],r.permutation=V;for(var n=0;2>n;++n)for(var i=r.clipBounds[n],o=0;3>o;++o)i[o]=Math.min(Math.max(this.clipBounds[n][o],-1e8),1e8);var s=a(r,this);if(s.showSurface){for(this._pickShader.bind(),this._pickShader.uniforms=r,this._vao.bind(),this._vao.draw(e.TRIANGLES,this._vertexCount),n=0;3>n;++n)this.surfaceProject[n]&&(this._pickShader.uniforms.model=s.projections[n],this._pickShader.uniforms.clipBounds=s.clipBounds[n],this._vao.draw(e.TRIANGLES,this._vertexCount));this._vao.unbind()}if(s.showContour){var l=this._contourPickShader;l.bind(),l.uniforms=r;var u=this._contourVAO;for(u.bind(),o=0;3>o;++o)for(e.lineWidth(this.contourWidth[o]),l.uniforms.permutation=D[o],n=0;n<this.contourLevels[o].length;++n)this._contourCounts[o][n]&&(l.uniforms.height=this.contourLevels[o][n],u.draw(e.LINES,this._contourCounts[o][n],this._contourOffsets[o][n]));for(n=0;3>n;++n)for(l.uniforms.model=s.projections[n],l.uniforms.clipBounds=s.clipBounds[n],o=0;3>o;++o)if(this.contourProject[n][o]){l.uniforms.permutation=D[o],e.lineWidth(this.contourWidth[o]);for(var c=0;c<this.contourLevels[o].length;++c)this._contourCounts[o][c]&&(l.uniforms.height=this.contourLevels[o][c],u.draw(e.LINES,this._contourCounts[o][c],this._contourOffsets[o][c]))}u.unbind()}},F.pick=function(t){if(!t)return null;if(t.id!==this.pickId)return null;var e=this._field[2].shape,r=this._pickResult,n=e[0]*(t.value[0]+(t.value[2]>>4)/16)/255,i=Math.floor(n),o=n-i,a=e[1]*(t.value[1]+(15&t.value[2])/16)/255,s=Math.floor(a),l=a-s;i+=1,s+=1;var u=r.position;u[0]=u[1]=u[2]=0;for(var c=0;2>c;++c)for(var h=c?o:1-o,f=0;2>f;++f)for(var d=f?l:1-l,p=i+c,v=s+f,m=h*d,g=0;3>g;++g)u[g]+=this._field[g].get(p,v)*m;for(var y=this._pickResult.level,b=0;3>b;++b)if(y[b]=A.le(this.contourLevels[b],u[b]),y[b]<0)this.contourLevels[b].length>0&&(y[b]=0);else if(y[b]<this.contourLevels[b].length-1){var x=this.contourLevels[b][y[b]],_=this.contourLevels[b][y[b]+1];Math.abs(x-u[b])>Math.abs(_-u[b])&&(y[b]+=1)}for(r.index[0]=.5>o?i:i+1,r.index[1]=.5>l?s:s+1,r.uv[0]=n/e[0],r.uv[1]=a/e[1],g=0;3>g;++g)r.dataCoordinate[g]=this._field[g].get(r.index[0],r.index[1]);return r},F.update=function(t){t=t||{},this.dirty=!0,"contourWidth"in t&&(this.contourWidth=u(t.contourWidth,Number)),"showContour"in t&&(this.showContour=u(t.showContour,Boolean)),"showSurface"in t&&(this.showSurface=!!t.showSurface),"contourTint"in t&&(this.contourTint=u(t.contourTint,Boolean)),"contourColor"in t&&(this.contourColor=h(t.contourColor)),"contourProject"in t&&(this.contourProject=u(t.contourProject,function(t){return u(t,Boolean)})),"surfaceProject"in t&&(this.surfaceProject=t.surfaceProject),"dynamicColor"in t&&(this.dynamicColor=h(t.dynamicColor)),"dynamicTint"in t&&(this.dynamicTint=u(t.dynamicTint,Number)),"dynamicWidth"in t&&(this.dynamicWidth=u(t.dynamicWidth,Number)),"opacity"in t&&(this.opacity=t.opacity),"colorBounds"in t&&(this.colorBounds=t.colorBounds);var e=t.field||t.coords&&t.coords[2]||null,r=!1;if(e||(e=this._field[2].shape[0]||this._field[2].shape[2]?this._field[2].lo(1,1).hi(this._field[2].shape[0]-2,this._field[2].shape[1]-2):this._field[2].hi(0,0)),"field"in t||"coords"in t){var n=(e.shape[0]+2)*(e.shape[1]+2);n>this._field[2].data.length&&(g.freeFloat(this._field[2].data),this._field[2].data=g.mallocFloat(d.nextPow2(n))),this._field[2]=_(this._field[2].data,[e.shape[0]+2,e.shape[1]+2]),l(this._field[2],e),this.shape=e.shape.slice();for(var o=this.shape,a=0;2>a;++a)this._field[2].size>this._field[a].data.length&&(g.freeFloat(this._field[a].data),this._field[a].data=g.mallocFloat(this._field[2].size)),this._field[a]=_(this._field[a].data,[o[0]+2,o[1]+2]);if(t.coords){var s=t.coords;if(!Array.isArray(s)||3!==s.length)throw new Error("gl-surface: invalid coordinates for x/y");for(a=0;2>a;++a){var c=s[a];for(y=0;2>y;++y)if(c.shape[y]!==o[y])throw new Error("gl-surface: coords have incorrect shape");l(this._field[a],c)}}else if(t.ticks){var f=t.ticks;if(!Array.isArray(f)||2!==f.length)throw new Error("gl-surface: invalid ticks");for(a=0;2>a;++a){var p=f[a];if((Array.isArray(p)||p.length)&&(p=_(p)),p.shape[0]!==o[a])throw new Error("gl-surface: invalid tick length");var v=_(p.data,o);v.stride[a]=p.stride[0],v.stride[1^a]=0,l(this._field[a],v)}}else{for(a=0;2>a;++a){var m=[0,0];m[a]=1,this._field[a]=_(this._field[a].data,[o[0]+2,o[1]+2],m,0)}this._field[0].set(0,0,0);for(var y=0;y<o[0];++y)this._field[0].set(y+1,0,y);for(this._field[0].set(o[0]+1,0,o[0]-1),this._field[1].set(0,0,0),y=0;y<o[1];++y)this._field[1].set(0,y+1,y);this._field[1].set(0,o[1]+1,o[1]-1)}var b=this._field,x=_(g.mallocFloat(3*b[2].size*2),[3,o[0]+2,o[1]+2,2]);for(a=0;3>a;++a)T(x.pick(a),b[a],"mirror");var M=_(g.mallocFloat(3*b[2].size),[o[0]+2,o[1]+2,3]);for(a=0;a<o[0]+2;++a)for(y=0;y<o[1]+2;++y){var k=x.get(0,a,y,0),A=x.get(0,a,y,1),E=x.get(1,a,y,0),S=x.get(1,a,y,1),L=x.get(2,a,y,0),z=x.get(2,a,y,1),I=E*z-S*L,P=L*A-z*k,C=k*S-A*E,D=Math.sqrt(I*I+P*P+C*C);1e-8>D?(D=Math.max(Math.abs(I),Math.abs(P),Math.abs(C)),1e-8>D?(C=1,P=I=0,D=1):D=1/D):D=1/Math.sqrt(D),M.set(a,y,0,I*D),M.set(a,y,1,P*D),M.set(a,y,2,C*D)}g.free(x.data);var O=[1/0,1/0,1/0],F=[-(1/0),-(1/0),-(1/0)],j=1/0,N=-(1/0),B=(o[0]-1)*(o[1]-1)*6,U=g.mallocFloat(d.nextPow2(10*B)),V=0,q=0;for(a=0;a<o[0]-1;++a)t:for(y=0;y<o[1]-1;++y){for(var G=0;2>G;++G)for(var H=0;2>H;++H)for(var X=0;3>X;++X){var Y=this._field[X].get(1+a+G,1+y+H);if(isNaN(Y)||!isFinite(Y))continue t}for(X=0;6>X;++X){var W=a+R[X][0],Z=y+R[X][1],K=this._field[0].get(W+1,Z+1),J=this._field[1].get(W+1,Z+1);Y=this._field[2].get(W+1,Z+1);var $=Y;I=M.get(W+1,Z+1,0),P=M.get(W+1,Z+1,1),C=M.get(W+1,Z+1,2),t.intensity&&($=t.intensity.get(W,Z)),U[V++]=W,U[V++]=Z,U[V++]=K,U[V++]=J,U[V++]=Y,U[V++]=0,U[V++]=$,U[V++]=I,U[V++]=P,U[V++]=C,O[0]=Math.min(O[0],K),O[1]=Math.min(O[1],J),O[2]=Math.min(O[2],Y),j=Math.min(j,$),F[0]=Math.max(F[0],K),F[1]=Math.max(F[1],J),F[2]=Math.max(F[2],Y),N=Math.max(N,$),q+=1}}for(t.intensityBounds&&(j=+t.intensityBounds[0],N=+t.intensityBounds[1]),a=6;V>a;a+=10)U[a]=(U[a]-j)/(N-j);this._vertexCount=q,this._coordinateBuffer.update(U.subarray(0,V)),g.freeFloat(U),g.free(M.data),this.bounds=[O,F],this.intensity=t.intensity||this._field[2],this.intensityBounds[0]===j&&this.intensityBounds[1]===N||(r=!0),this.intensityBounds=[j,N]}if("levels"in t){var Q=t.levels;for(Q=Array.isArray(Q[0])?Q.slice():[[],[],Q],a=0;3>a;++a)Q[a]=Q[a].slice(),Q.sort(function(t,e){return t-e});t:for(a=0;3>a;++a){if(Q[a].length!==this.contourLevels[a].length){r=!0;break}for(y=0;y<Q[a].length;++y)if(Q[a][y]!==this.contourLevels[a][y]){r=!0;break t}}this.contourLevels=Q}if(r){b=this._field,o=this.shape;for(var tt=[],et=0;3>et;++et){Q=this.contourLevels[et];var rt=[],nt=[],it=[0,0,0];for(a=0;a<Q.length;++a){var ot=w(this._field[et],Q[a]);rt.push(tt.length/5|0),q=0;t:for(y=0;y<ot.cells.length;++y){var at=ot.cells[y];for(X=0;2>X;++X){var st=ot.positions[at[X]],lt=st[0],ut=0|Math.floor(lt),ct=lt-ut,ht=st[1],ft=0|Math.floor(ht),dt=ht-ft,pt=!1;e:for(var vt=0;3>vt;++vt){it[vt]=0;var mt=(et+vt+1)%3;for(G=0;2>G;++G){var gt=G?ct:1-ct;for(W=0|Math.min(Math.max(ut+G,0),o[0]),H=0;2>H;++H){var yt=H?dt:1-dt;if(Z=0|Math.min(Math.max(ft+H,0),o[1]),Y=2>vt?this._field[mt].get(W,Z):(this.intensity.get(W,Z)-this.intensityBounds[0])/(this.intensityBounds[1]-this.intensityBounds[0]),!isFinite(Y)||isNaN(Y)){pt=!0;break e}var bt=gt*yt;it[vt]+=bt*Y}}}if(pt){if(X>0){for(var xt=0;5>xt;++xt)tt.pop();q-=1}continue t}tt.push(it[0],it[1],st[0],st[1],it[2]),q+=1}}nt.push(q)}this._contourOffsets[et]=rt,this._contourCounts[et]=nt}var _t=g.mallocFloat(tt.length);for(a=0;a<tt.length;++a)_t[a]=tt[a];this._contourBuffer.update(_t),g.freeFloat(_t)}t.colormap&&this._colorMap.setPixels(i(t.colormap))},F.dispose=function(){this._shader.dispose(),this._vao.dispose(),this._coordinateBuffer.dispose(),this._colorMap.dispose(),this._contourBuffer.dispose(),this._contourVAO.dispose(),this._contourShader.dispose(),this._contourPickShader.dispose(),this._dynamicBuffer.dispose(),this._dynamicVAO.dispose();for(var t=0;3>t;++t)g.freeFloat(this._field[t].data)},F.highlight=function(t){if(!t)return this._dynamicCounts=[0,0,0],this.dyanamicLevel=[NaN,NaN,NaN],void(this.highlightLevel=[-1,-1,-1]);for(var e=0;3>e;++e)this.enableHighlight[e]?this.highlightLevel[e]=t.level[e]:this.highlightLevel[e]=-1;var r;if(r=this.snapToData?t.dataCoordinate:t.position,this.enableDynamic[0]&&r[0]!==this.dynamicLevel[0]||this.enableDynamic[1]&&r[1]!==this.dynamicLevel[1]||this.enableDynamic[2]&&r[2]!==this.dynamicLevel[2]){for(var n=0,i=this.shape,o=g.mallocFloat(12*i[0]*i[1]),a=0;3>a;++a)if(this.enableDynamic[a]){this.dynamicLevel[a]=r[a];var s=(a+1)%3,l=(a+2)%3,u=this._field[a],c=this._field[s],h=this._field[l],f=(this.intensity,w(u,r[a])),d=f.cells,p=f.positions;for(this._dynamicOffsets[a]=n,e=0;e<d.length;++e)for(var v=d[e],m=0;2>m;++m){var y=p[v[m]],b=+y[0],x=0|b,_=0|Math.min(x+1,i[0]),M=b-x,k=1-M,A=+y[1],T=0|A,E=0|Math.min(T+1,i[1]),S=A-T,L=1-S,z=k*L,I=k*S,P=M*L,C=M*S,R=z*c.get(x,T)+I*c.get(x,E)+P*c.get(_,T)+C*c.get(_,E),D=z*h.get(x,T)+I*h.get(x,E)+P*h.get(_,T)+C*h.get(_,E);if(isNaN(R)||isNaN(D)){m&&(n-=1);break}o[2*n+0]=R,o[2*n+1]=D,n+=1}this._dynamicCounts[a]=n-this._dynamicOffsets[a]}else this.dynamicLevel[a]=NaN,this._dynamicCounts[a]=0;this._dynamicBuffer.update(o.subarray(0,2*n)),g.freeFloat(o)}}},{"./lib/shaders":222,"binary-search-bounds":223,"bit-twiddle":51,colormap:106,"gl-buffer":124,"gl-mat4/invert":143,"gl-mat4/multiply":145,"gl-texture2d":228,"gl-vao":232,ndarray:433,"ndarray-gradient":224,"ndarray-ops":432,"ndarray-pack":225,"surface-nets":452,"typedarray-pool":458}],228:[function(t,e,r){"use strict";function n(t){m=[t.LINEAR,t.NEAREST_MIPMAP_LINEAR,t.LINEAR_MIPMAP_NEAREST,t.LINEAR_MIPMAP_NEAREST],g=[t.NEAREST,t.LINEAR,t.NEAREST_MIPMAP_NEAREST,t.NEAREST_MIPMAP_LINEAR,t.LINEAR_MIPMAP_NEAREST,t.LINEAR_MIPMAP_LINEAR],y=[t.REPEAT,t.CLAMP_TO_EDGE,t.MIRRORED_REPEAT]}function i(t,e,r){var n=t.gl,i=n.getParameter(n.MAX_TEXTURE_SIZE);if(0>e||e>i||0>r||r>i)throw new Error("gl-texture2d: Invalid texture size");return t._shape=[e,r],t.bind(),n.texImage2D(n.TEXTURE_2D,0,t.format,e,r,0,t.format,t.type,null),t._mipLevels=[0],t}function o(t,e,r,n,i,o){this.gl=t,this.handle=e,this.format=i,this.type=o,this._shape=[r,n],this._mipLevels=[0],this._magFilter=t.NEAREST,this._minFilter=t.NEAREST,this._wrapS=t.CLAMP_TO_EDGE,this._wrapT=t.CLAMP_TO_EDGE,this._anisoSamples=1;var a=this,s=[this._wrapS,this._wrapT];Object.defineProperties(s,[{get:function(){return a._wrapS},set:function(t){return a.wrapS=t}},{get:function(){return a._wrapT},set:function(t){return a.wrapT=t}}]),this._wrapVector=s;var l=[this._shape[0],this._shape[1]];Object.defineProperties(l,[{get:function(){return a._shape[0]},set:function(t){return a.width=t}},{get:function(){return a._shape[1]},set:function(t){return a.height=t}}]),this._shapeVector=l}function a(t,e){return 3===t.length?1===e[2]&&e[1]===t[0]*t[2]&&e[0]===t[2]:1===e[0]&&e[1]===t[0]}function s(t,e,r,n,i,o,s,l){var u=l.dtype,c=l.shape.slice();if(c.length<2||c.length>3)throw new Error("gl-texture2d: Invalid ndarray, must be 2d or 3d");var h=0,f=0,m=a(c,l.stride.slice());"float32"===u?h=t.FLOAT:"float64"===u?(h=t.FLOAT,m=!1,u="float32"):"uint8"===u?h=t.UNSIGNED_BYTE:(h=t.UNSIGNED_BYTE,m=!1,u="uint8");var g=1;if(2===c.length)f=t.LUMINANCE,c=[c[0],c[1],1],l=d(l.data,c,[l.stride[0],l.stride[1],1],l.offset);else{if(3!==c.length)throw new Error("gl-texture2d: Invalid shape for texture");if(1===c[2])f=t.ALPHA;else if(2===c[2])f=t.LUMINANCE_ALPHA;else if(3===c[2])f=t.RGB;else{if(4!==c[2])throw new Error("gl-texture2d: Invalid shape for pixel coords");f=t.RGBA}g=c[2]}if(f!==t.LUMINANCE&&f!==t.ALPHA||i!==t.LUMINANCE&&i!==t.ALPHA||(f=i),f!==i)throw new Error("gl-texture2d: Incompatible texture format for setPixels");var y=l.size,x=s.indexOf(n)<0;if(x&&s.push(n),h===o&&m)0===l.offset&&l.data.length===y?x?t.texImage2D(t.TEXTURE_2D,n,i,c[0],c[1],0,i,o,l.data):t.texSubImage2D(t.TEXTURE_2D,n,e,r,c[0],c[1],i,o,l.data):x?t.texImage2D(t.TEXTURE_2D,n,i,c[0],c[1],0,i,o,l.data.subarray(l.offset,l.offset+y)):t.texSubImage2D(t.TEXTURE_2D,n,e,r,c[0],c[1],i,o,l.data.subarray(l.offset,l.offset+y));else{var _;_=o===t.FLOAT?v.mallocFloat32(y):v.mallocUint8(y);var w=d(_,c,[c[2],c[2]*c[0],1]);h===t.FLOAT&&o===t.UNSIGNED_BYTE?b(w,l):p.assign(w,l),x?t.texImage2D(t.TEXTURE_2D,n,i,c[0],c[1],0,i,o,_.subarray(0,y)):t.texSubImage2D(t.TEXTURE_2D,n,e,r,c[0],c[1],i,o,_.subarray(0,y)),o===t.FLOAT?v.freeFloat32(_):v.freeUint8(_)}}function l(t){var e=t.createTexture();return t.bindTexture(t.TEXTURE_2D,e),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),e}function u(t,e,r,n,i){var a=t.getParameter(t.MAX_TEXTURE_SIZE);if(0>e||e>a||0>r||r>a)throw new Error("gl-texture2d: Invalid texture shape");if(i===t.FLOAT&&!t.getExtension("OES_texture_float"))throw new Error("gl-texture2d: Floating point textures not supported on this platform");var s=l(t);return t.texImage2D(t.TEXTURE_2D,0,n,e,r,0,n,i,null),new o(t,s,e,r,n,i)}function c(t,e,r,n){var i=l(t);return t.texImage2D(t.TEXTURE_2D,0,r,r,n,e),new o(t,i,0|e.width,0|e.height,r,n)}function h(t,e){var r=e.dtype,n=e.shape.slice(),i=t.getParameter(t.MAX_TEXTURE_SIZE);if(n[0]<0||n[0]>i||n[1]<0||n[1]>i)throw new Error("gl-texture2d: Invalid texture size");var s=a(n,e.stride.slice()),u=0;"float32"===r?u=t.FLOAT:"float64"===r?(u=t.FLOAT,s=!1,r="float32"):"uint8"===r?u=t.UNSIGNED_BYTE:(u=t.UNSIGNED_BYTE,s=!1,r="uint8");var c=0;if(2===n.length)c=t.LUMINANCE,n=[n[0],n[1],1],e=d(e.data,n,[e.stride[0],e.stride[1],1],e.offset);else{if(3!==n.length)throw new Error("gl-texture2d: Invalid shape for texture");if(1===n[2])c=t.ALPHA;else if(2===n[2])c=t.LUMINANCE_ALPHA;else if(3===n[2])c=t.RGB;else{if(4!==n[2])throw new Error("gl-texture2d: Invalid shape for pixel coords");c=t.RGBA}}u!==t.FLOAT||t.getExtension("OES_texture_float")||(u=t.UNSIGNED_BYTE,s=!1);var h,f,m=e.size;if(s)h=0===e.offset&&e.data.length===m?e.data:e.data.subarray(e.offset,e.offset+m);else{var g=[n[2],n[2]*n[0],1];f=v.malloc(m,r);var y=d(f,n,g,0);"float32"!==r&&"float64"!==r||u!==t.UNSIGNED_BYTE?p.assign(y,e):b(y,e),h=f.subarray(0,m)}var x=l(t);return t.texImage2D(t.TEXTURE_2D,0,c,n[0],n[1],0,c,u,h),s||v.free(f),new o(t,x,n[0],n[1],c,u)}function f(t){if(arguments.length<=1)throw new Error("gl-texture2d: Missing arguments for texture2d constructor");if(m||n(t),"number"==typeof arguments[1])return u(t,arguments[1],arguments[2],arguments[3]||t.RGBA,arguments[4]||t.UNSIGNED_BYTE);if(Array.isArray(arguments[1]))return u(t,0|arguments[1][0],0|arguments[1][1],arguments[2]||t.RGBA,arguments[3]||t.UNSIGNED_BYTE);if("object"==typeof arguments[1]){var e=arguments[1];if(e instanceof HTMLCanvasElement||e instanceof HTMLImageElement||e instanceof HTMLVideoElement||e instanceof ImageData)return c(t,e,arguments[2]||t.RGBA,arguments[3]||t.UNSIGNED_BYTE);if(e.shape&&e.data&&e.stride)return h(t,e)}throw new Error("gl-texture2d: Invalid arguments for texture2d constructor")}var d=t("ndarray"),p=t("ndarray-ops"),v=t("typedarray-pool");e.exports=f;var m=null,g=null,y=null,b=function(t,e){p.muls(t,e,255)},x=o.prototype;Object.defineProperties(x,{minFilter:{get:function(){return this._minFilter},set:function(t){this.bind();var e=this.gl;if(this.type===e.FLOAT&&m.indexOf(t)>=0&&(e.getExtension("OES_texture_float_linear")||(t=e.NEAREST)),g.indexOf(t)<0)throw new Error("gl-texture2d: Unknown filter mode "+t);return e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,t),this._minFilter=t}},magFilter:{get:function(){return this._magFilter},set:function(t){this.bind();var e=this.gl;if(this.type===e.FLOAT&&m.indexOf(t)>=0&&(e.getExtension("OES_texture_float_linear")||(t=e.NEAREST)),g.indexOf(t)<0)throw new Error("gl-texture2d: Unknown filter mode "+t);return e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,t),this._magFilter=t}},mipSamples:{get:function(){return this._anisoSamples},set:function(t){var e=this._anisoSamples;if(this._anisoSamples=0|Math.max(t,1),e!==this._anisoSamples){var r=gl.getExtension("EXT_texture_filter_anisotropic");r&&this.gl.texParameterf(this.gl.TEXTURE_2D,r.TEXTURE_MAX_ANISOTROPY_EXT,this._anisoSamples)}return this._anisoSamples}},wrapS:{get:function(){return this._wrapS},set:function(t){if(this.bind(),y.indexOf(t)<0)throw new Error("gl-texture2d: Unknown wrap mode "+t);return this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,t),this._wrapS=t}},wrapT:{get:function(){return this._wrapT},set:function(t){if(this.bind(),y.indexOf(t)<0)throw new Error("gl-texture2d: Unknown wrap mode "+t);return this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,t),this._wrapT=t}},wrap:{get:function(){return this._wrapVector},set:function(t){if(Array.isArray(t)||(t=[t,t]),2!==t.length)throw new Error("gl-texture2d: Must specify wrap mode for rows and columns");for(var e=0;2>e;++e)if(y.indexOf(t[e])<0)throw new Error("gl-texture2d: Unknown wrap mode "+t);this._wrapS=t[0],this._wrapT=t[1];var r=this.gl;return this.bind(),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,this._wrapS),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,this._wrapT),t}},shape:{get:function(){return this._shapeVector},set:function(t){if(Array.isArray(t)){if(2!==t.length)throw new Error("gl-texture2d: Invalid texture shape")}else t=[0|t,0|t];return i(this,0|t[0],0|t[1]),[0|t[0],0|t[1]]}},width:{get:function(){return this._shape[0]},set:function(t){return t=0|t,i(this,t,this._shape[1]),t}},height:{get:function(){return this._shape[1]},set:function(t){return t=0|t,i(this,this._shape[0],t),t}}}),x.bind=function(t){var e=this.gl;return void 0!==t&&e.activeTexture(e.TEXTURE0+(0|t)),e.bindTexture(e.TEXTURE_2D,this.handle),void 0!==t?0|t:e.getParameter(e.ACTIVE_TEXTURE)-e.TEXTURE0},x.dispose=function(){this.gl.deleteTexture(this.handle)},x.generateMipmap=function(){this.bind(),this.gl.generateMipmap(this.gl.TEXTURE_2D);for(var t=Math.min(this._shape[0],this._shape[1]),e=0;t>0;++e,t>>>=1)this._mipLevels.indexOf(e)<0&&this._mipLevels.push(e)},x.setPixels=function(t,e,r,n){var i=this.gl;if(this.bind(),Array.isArray(e)?(n=r,r=0|e[1],e=0|e[0]):(e=e||0,r=r||0),n=n||0,t instanceof HTMLCanvasElement||t instanceof ImageData||t instanceof HTMLImageElement||t instanceof HTMLVideoElement){var o=this._mipLevels.indexOf(n)<0;o?(i.texImage2D(i.TEXTURE_2D,0,this.format,this.format,this.type,t),this._mipLevels.push(n)):i.texSubImage2D(i.TEXTURE_2D,n,e,r,this.format,this.type,t)}else{if(!(t.shape&&t.stride&&t.data))throw new Error("gl-texture2d: Unsupported data type");if(t.shape.length<2||e+t.shape[1]>this._shape[1]>>>n||r+t.shape[0]>this._shape[0]>>>n||0>e||0>r)throw new Error("gl-texture2d: Texture dimensions are out of bounds");s(i,e,r,n,this.format,this.type,this._mipLevels,t)}}},{ndarray:433,"ndarray-ops":432,"typedarray-pool":458}],229:[function(t,e,r){"use strict";function n(t,e,r){e?e.bind():t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,null);var n=0|t.getParameter(t.MAX_VERTEX_ATTRIBS);if(r){if(r.length>n)throw new Error("gl-vao: Too many vertex attributes");for(var i=0;i<r.length;++i){var o=r[i];if(o.buffer){var a=o.buffer,s=o.size||4,l=o.type||t.FLOAT,u=!!o.normalized,c=o.stride||0,h=o.offset||0;a.bind(),t.enableVertexAttribArray(i),t.vertexAttribPointer(i,s,l,u,c,h)}else{if("number"==typeof o)t.vertexAttrib1f(i,o);else if(1===o.length)t.vertexAttrib1f(i,o[0]);else if(2===o.length)t.vertexAttrib2f(i,o[0],o[1]);else if(3===o.length)t.vertexAttrib3f(i,o[0],o[1],o[2]);else{if(4!==o.length)throw new Error("gl-vao: Invalid vertex attribute");t.vertexAttrib4f(i,o[0],o[1],o[2],o[3])}t.disableVertexAttribArray(i)}}for(;n>i;++i)t.disableVertexAttribArray(i)}else{t.bindBuffer(t.ARRAY_BUFFER,null);for(var i=0;n>i;++i)t.disableVertexAttribArray(i)}}e.exports=n},{}],230:[function(t,e,r){"use strict";function n(t){this.gl=t,this._elements=null,this._attributes=null,this._elementsType=t.UNSIGNED_SHORT}function i(t){return new n(t)}var o=t("./do-bind.js");n.prototype.bind=function(){o(this.gl,this._elements,this._attributes)},n.prototype.update=function(t,e,r){this._elements=e,this._attributes=t,this._elementsType=r||this.gl.UNSIGNED_SHORT},n.prototype.dispose=function(){},n.prototype.unbind=function(){},n.prototype.draw=function(t,e,r){r=r||0;var n=this.gl;this._elements?n.drawElements(t,e,this._elementsType,r):n.drawArrays(t,r,e)},e.exports=i},{"./do-bind.js":229}],231:[function(t,e,r){"use strict";function n(t,e,r,n,i,o){this.location=t,this.dimension=e,this.a=r,this.b=n,this.c=i,this.d=o}function i(t,e,r){this.gl=t,this._ext=e,this.handle=r,this._attribs=[],this._useElements=!1,this._elementsType=t.UNSIGNED_SHORT}function o(t,e){return new i(t,e,e.createVertexArrayOES())}var a=t("./do-bind.js");n.prototype.bind=function(t){switch(this.dimension){case 1:t.vertexAttrib1f(this.location,this.a);break;case 2:t.vertexAttrib2f(this.location,this.a,this.b);break;case 3:t.vertexAttrib3f(this.location,this.a,this.b,this.c);break;case 4:t.vertexAttrib4f(this.location,this.a,this.b,this.c,this.d)}},i.prototype.bind=function(){this._ext.bindVertexArrayOES(this.handle);for(var t=0;t<this._attribs.length;++t)this._attribs[t].bind(this.gl)},i.prototype.unbind=function(){this._ext.bindVertexArrayOES(null)},i.prototype.dispose=function(){this._ext.deleteVertexArrayOES(this.handle)},i.prototype.update=function(t,e,r){if(this.bind(),a(this.gl,e,t),this.unbind(),this._attribs.length=0,t)for(var i=0;i<t.length;++i){var o=t[i];"number"==typeof o?this._attribs.push(new n(i,1,o)):Array.isArray(o)&&this._attribs.push(new n(i,o.length,o[0],o[1],o[2],o[3]))}this._useElements=!!e,this._elementsType=r||this.gl.UNSIGNED_SHORT},i.prototype.draw=function(t,e,r){r=r||0;var n=this.gl;this._useElements?n.drawElements(t,e,this._elementsType,r):n.drawArrays(t,r,e)},e.exports=o},{"./do-bind.js":229}],232:[function(t,e,r){"use strict";function n(t,e,r,n){var a,s=t.getExtension("OES_vertex_array_object");return a=s?i(t,s):o(t),a.update(e,r,n),a}var i=t("./lib/vao-native.js"),o=t("./lib/vao-emulated.js");e.exports=n},{"./lib/vao-emulated.js":230,"./lib/vao-native.js":231}],233:[function(t,e,r){function n(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3];return t[0]=r[0]*n+r[4]*i+r[8]*o+r[12]*a,t[1]=r[1]*n+r[5]*i+r[9]*o+r[13]*a,t[2]=r[2]*n+r[6]*i+r[10]*o+r[14]*a,t[3]=r[3]*n+r[7]*i+r[11]*o+r[15]*a,t}e.exports=n},{}],234:[function(t,e,r){function n(t){function e(t){t.length&&V.push({type:M[B],data:t,position:H,line:q,column:G})}function r(t){j=0,W+=t,F=W.length;for(var e;D=W[j],F>j;){switch(e=j,B){case h:j=S();break;case f:j=E();break;case d:j=T();break;case p:j=L();break;case v:j=P();break;case w:j=I();break;case m:j=C();break;case c:j=R();break;case x:j=A();break;case u:j=k()}if(e!==j)switch(W[e]){case"\n":G=0,++q;break;default:++G}}return N+=j,W=W.slice(j),V}function n(t){return U.length&&e(U.join("")),B=_,e("(eof)"),V}function k(){return U=U.length?[]:U,"/"===O&&"*"===D?(H=N+j-1,B=h,O=D,j+1):"/"===O&&"/"===D?(H=N+j-1,B=f,O=D,j+1):"#"===D?(B=d,H=N+j,j):/\s/.test(D)?(B=x,H=N+j,j):(X=/\d/.test(D),Y=/[^\w_]/.test(D),H=N+j,B=X?v:Y?p:c,j)}function A(){return/[^\s]/g.test(D)?(e(U.join("")),B=u,j):(U.push(D),O=D,j+1)}function T(){return"\n"===D&&"\\"!==O?(e(U.join("")),B=u,j):(U.push(D),O=D,j+1)}function E(){return T()}function S(){return"/"===D&&"*"===O?(U.push(D),e(U.join("")),B=u,j+1):(U.push(D),O=D,j+1)}function L(){if("."===O&&/\d/.test(D))return B=m,j;if("/"===O&&"*"===D)return B=h,j;if("/"===O&&"/"===D)return B=f,j;if("."===D&&U.length){for(;z(U););return B=m,j}if(";"===D||")"===D||"("===D){if(U.length)for(;z(U););return e(D),B=u,j+1}var t=2===U.length&&"="!==D;if(/[\w_\d\s]/.test(D)||t){for(;z(U););return B=u,j}return U.push(D),O=D,j+1}function z(t){for(var r,n,i=0;;){if(r=o.indexOf(t.slice(0,t.length+i).join("")),n=o[r],-1===r){if(i--+t.length>0)continue;n=t.slice(0,1).join("")}return e(n),H+=n.length,U=U.slice(n.length),U.length}}function I(){return/[^a-fA-F0-9]/.test(D)?(e(U.join("")),B=u,j):(U.push(D),O=D,j+1)}function P(){return"."===D?(U.push(D),B=m,O=D,j+1):/[eE]/.test(D)?(U.push(D),B=m,O=D,j+1):"x"===D&&1===U.length&&"0"===U[0]?(B=w,U.push(D),O=D,j+1):/[^\d]/.test(D)?(e(U.join("")),B=u,j):(U.push(D),O=D,j+1)}function C(){return"f"===D&&(U.push(D),O=D,j+=1),/[eE]/.test(D)?(U.push(D),O=D,j+1):"-"===D&&/[eE]/.test(O)?(U.push(D),O=D,j+1):/[^\d]/.test(D)?(e(U.join("")),B=u,j):(U.push(D),O=D,j+1)}function R(){if(/[^\d\w_]/.test(D)){var t=U.join("");return B=K.indexOf(t)>-1?b:Z.indexOf(t)>-1?y:g,e(U.join("")),B=u,j}return U.push(D),O=D,j+1}var D,O,F,j=0,N=0,B=u,U=[],V=[],q=1,G=0,H=0,X=!1,Y=!1,W="";t=t||{};var Z=a,K=i;return"300 es"===t.version&&(Z=l,K=s),function(t){return V=[],null!==t?r(t):n()}}e.exports=n;var i=t("./lib/literals"),o=t("./lib/operators"),a=t("./lib/builtins"),s=t("./lib/literals-300es"),l=t("./lib/builtins-300es"),u=999,c=9999,h=0,f=1,d=2,p=3,v=4,m=5,g=6,y=7,b=8,x=9,_=10,w=11,M=["block-comment","line-comment","preprocessor","operator","integer","float","ident","builtin","keyword","whitespace","eof","integer"]},{"./lib/builtins":236,"./lib/builtins-300es":235,"./lib/literals":238,"./lib/literals-300es":237,"./lib/operators":239}],235:[function(t,e,r){var n=t("./builtins");n=n.slice().filter(function(t){return!/^(gl\_|texture)/.test(t)}),e.exports=n.concat(["gl_VertexID","gl_InstanceID","gl_Position","gl_PointSize","gl_FragCoord","gl_FrontFacing","gl_FragDepth","gl_PointCoord","gl_MaxVertexAttribs","gl_MaxVertexUniformVectors","gl_MaxVertexOutputVectors","gl_MaxFragmentInputVectors","gl_MaxVertexTextureImageUnits","gl_MaxCombinedTextureImageUnits","gl_MaxTextureImageUnits","gl_MaxFragmentUniformVectors","gl_MaxDrawBuffers","gl_MinProgramTexelOffset","gl_MaxProgramTexelOffset","gl_DepthRangeParameters","gl_DepthRange","trunc","round","roundEven","isnan","isinf","floatBitsToInt","floatBitsToUint","intBitsToFloat","uintBitsToFloat","packSnorm2x16","unpackSnorm2x16","packUnorm2x16","unpackUnorm2x16","packHalf2x16","unpackHalf2x16","outerProduct","transpose","determinant","inverse","texture","textureSize","textureProj","textureLod","textureOffset","texelFetch","texelFetchOffset","textureProjOffset","textureLodOffset","textureProjLod","textureProjLodOffset","textureGrad","textureGradOffset","textureProjGrad","textureProjGradOffset"])},{"./builtins":236}],236:[function(t,e,r){e.exports=["abs","acos","all","any","asin","atan","ceil","clamp","cos","cross","dFdx","dFdy","degrees","distance","dot","equal","exp","exp2","faceforward","floor","fract","gl_BackColor","gl_BackLightModelProduct","gl_BackLightProduct","gl_BackMaterial","gl_BackSecondaryColor","gl_ClipPlane","gl_ClipVertex","gl_Color","gl_DepthRange","gl_DepthRangeParameters","gl_EyePlaneQ","gl_EyePlaneR","gl_EyePlaneS","gl_EyePlaneT","gl_Fog","gl_FogCoord","gl_FogFragCoord","gl_FogParameters","gl_FragColor","gl_FragCoord","gl_FragData","gl_FragDepth","gl_FragDepthEXT","gl_FrontColor","gl_FrontFacing","gl_FrontLightModelProduct","gl_FrontLightProduct","gl_FrontMaterial","gl_FrontSecondaryColor","gl_LightModel","gl_LightModelParameters","gl_LightModelProducts","gl_LightProducts","gl_LightSource","gl_LightSourceParameters","gl_MaterialParameters","gl_MaxClipPlanes","gl_MaxCombinedTextureImageUnits","gl_MaxDrawBuffers","gl_MaxFragmentUniformComponents","gl_MaxLights","gl_MaxTextureCoords","gl_MaxTextureImageUnits","gl_MaxTextureUnits","gl_MaxVaryingFloats","gl_MaxVertexAttribs","gl_MaxVertexTextureImageUnits","gl_MaxVertexUniformComponents","gl_ModelViewMatrix","gl_ModelViewMatrixInverse","gl_ModelViewMatrixInverseTranspose","gl_ModelViewMatrixTranspose","gl_ModelViewProjectionMatrix","gl_ModelViewProjectionMatrixInverse","gl_ModelViewProjectionMatrixInverseTranspose","gl_ModelViewProjectionMatrixTranspose","gl_MultiTexCoord0","gl_MultiTexCoord1","gl_MultiTexCoord2","gl_MultiTexCoord3","gl_MultiTexCoord4","gl_MultiTexCoord5","gl_MultiTexCoord6","gl_MultiTexCoord7","gl_Normal","gl_NormalMatrix","gl_NormalScale","gl_ObjectPlaneQ","gl_ObjectPlaneR","gl_ObjectPlaneS","gl_ObjectPlaneT","gl_Point","gl_PointCoord","gl_PointParameters","gl_PointSize","gl_Position","gl_ProjectionMatrix","gl_ProjectionMatrixInverse","gl_ProjectionMatrixInverseTranspose","gl_ProjectionMatrixTranspose","gl_SecondaryColor","gl_TexCoord","gl_TextureEnvColor","gl_TextureMatrix","gl_TextureMatrixInverse","gl_TextureMatrixInverseTranspose","gl_TextureMatrixTranspose","gl_Vertex","greaterThan","greaterThanEqual","inversesqrt","length","lessThan","lessThanEqual","log","log2","matrixCompMult","max","min","mix","mod","normalize","not","notEqual","pow","radians","reflect","refract","sign","sin","smoothstep","sqrt","step","tan","texture2D","texture2DLod","texture2DProj","texture2DProjLod","textureCube","textureCubeLod","texture2DLodEXT","texture2DProjLodEXT","textureCubeLodEXT","texture2DGradEXT","texture2DProjGradEXT","textureCubeGradEXT"];
},{}],237:[function(t,e,r){var n=t("./literals");e.exports=n.slice().concat(["layout","centroid","smooth","case","mat2x2","mat2x3","mat2x4","mat3x2","mat3x3","mat3x4","mat4x2","mat4x3","mat4x4","uint","uvec2","uvec3","uvec4","samplerCubeShadow","sampler2DArray","sampler2DArrayShadow","isampler2D","isampler3D","isamplerCube","isampler2DArray","usampler2D","usampler3D","usamplerCube","usampler2DArray","coherent","restrict","readonly","writeonly","resource","atomic_uint","noperspective","patch","sample","subroutine","common","partition","active","filter","image1D","image2D","image3D","imageCube","iimage1D","iimage2D","iimage3D","iimageCube","uimage1D","uimage2D","uimage3D","uimageCube","image1DArray","image2DArray","iimage1DArray","iimage2DArray","uimage1DArray","uimage2DArray","image1DShadow","image2DShadow","image1DArrayShadow","image2DArrayShadow","imageBuffer","iimageBuffer","uimageBuffer","sampler1DArray","sampler1DArrayShadow","isampler1D","isampler1DArray","usampler1D","usampler1DArray","isampler2DRect","usampler2DRect","samplerBuffer","isamplerBuffer","usamplerBuffer","sampler2DMS","isampler2DMS","usampler2DMS","sampler2DMSArray","isampler2DMSArray","usampler2DMSArray"])},{"./literals":238}],238:[function(t,e,r){e.exports=["precision","highp","mediump","lowp","attribute","const","uniform","varying","break","continue","do","for","while","if","else","in","out","inout","float","int","void","bool","true","false","discard","return","mat2","mat3","mat4","vec2","vec3","vec4","ivec2","ivec3","ivec4","bvec2","bvec3","bvec4","sampler1D","sampler2D","sampler3D","samplerCube","sampler1DShadow","sampler2DShadow","struct","asm","class","union","enum","typedef","template","this","packed","goto","switch","default","inline","noinline","volatile","public","static","extern","external","interface","long","short","double","half","fixed","unsigned","input","output","hvec2","hvec3","hvec4","dvec2","dvec3","dvec4","fvec2","fvec3","fvec4","sampler2DRect","sampler3DRect","sampler2DRectShadow","sizeof","cast","namespace","using"]},{}],239:[function(t,e,r){e.exports=["<<=",">>=","++","--","<<",">>","<=",">=","==","!=","&&","||","+=","-=","*=","/=","%=","&=","^^","^=","|=","(",")","[","]",".","!","~","*","/","%","+","-","<",">","&","^","|","?",":","=",",",";","{","}"]},{}],240:[function(t,e,r){function n(t,e){var r=i(e),n=[];return n=n.concat(r(t)),n=n.concat(r(null))}var i=t("./index");e.exports=n},{"./index":234}],241:[function(t,e,r){"use strict";function n(t,e,r){this.vertices=t,this.adjacent=e,this.boundary=r,this.lastVisited=-1}function i(t,e,r){this.vertices=t,this.cell=e,this.index=r}function o(t,e){return c(t.vertices,e.vertices)}function a(t){for(var e=["function orient(){var tuple=this.tuple;return test("],r=0;t>=r;++r)r>0&&e.push(","),e.push("tuple[",r,"]");e.push(")}return orient");var n=new Function("test",e.join("")),i=u[t+1];return i||(i=u),n(i)}function s(t,e,r){this.dimension=t,this.vertices=e,this.simplices=r,this.interior=r.filter(function(t){return!t.boundary}),this.tuple=new Array(t+1);for(var n=0;t>=n;++n)this.tuple[n]=this.vertices[n];var i=h[t];i||(i=h[t]=a(t)),this.orient=i}function l(t,e){var r=t.length;if(0===r)throw new Error("Must have at least d+1 points");var i=t[0].length;if(i>=r)throw new Error("Must input at least d+1 points");var o=t.slice(0,i+1),a=u.apply(void 0,o);if(0===a)throw new Error("Input not in general position");for(var l=new Array(i+1),c=0;i>=c;++c)l[c]=c;0>a&&(l[0]=1,l[1]=0);for(var h=new n(l,new Array(i+1),!1),f=h.adjacent,d=new Array(i+2),c=0;i>=c;++c){for(var p=l.slice(),v=0;i>=v;++v)v===c&&(p[v]=-1);var m=p[0];p[0]=p[1],p[1]=m;var g=new n(p,new Array(i+1),!0);f[c]=g,d[c]=g}d[i+1]=h;for(var c=0;i>=c;++c)for(var p=f[c].vertices,y=f[c].adjacent,v=0;i>=v;++v){var b=p[v];if(0>b)y[v]=h;else for(var x=0;i>=x;++x)f[x].vertices.indexOf(b)<0&&(y[v]=f[x])}for(var _=new s(i,o,d),w=!!e,c=i+1;r>c;++c)_.insert(t[c],w);return _.boundary()}e.exports=l;var u=t("robust-orientation"),c=t("simplicial-complex").compareCells;n.prototype.flip=function(){var t=this.vertices[0];this.vertices[0]=this.vertices[1],this.vertices[1]=t;var e=this.adjacent[0];this.adjacent[0]=this.adjacent[1],this.adjacent[1]=e};var h=[],f=s.prototype;f.handleBoundaryDegeneracy=function(t,e){var r=this.dimension,n=this.vertices.length-1,i=this.tuple,o=this.vertices,a=[t];for(t.lastVisited=-n;a.length>0;){t=a.pop();for(var s=(t.vertices,t.adjacent),l=0;r>=l;++l){var u=s[l];if(u.boundary&&!(u.lastVisited<=-n)){for(var c=u.vertices,h=0;r>=h;++h){var f=c[h];0>f?i[h]=e:i[h]=o[f]}var d=this.orient();if(d>0)return u;u.lastVisited=-n,0===d&&a.push(u)}}}return null},f.walk=function(t,e){var r=this.vertices.length-1,n=this.dimension,i=this.vertices,o=this.tuple,a=e?this.interior.length*Math.random()|0:this.interior.length-1,s=this.interior[a];t:for(;!s.boundary;){for(var l=s.vertices,u=s.adjacent,c=0;n>=c;++c)o[c]=i[l[c]];s.lastVisited=r;for(var c=0;n>=c;++c){var h=u[c];if(!(h.lastVisited>=r)){var f=o[c];o[c]=t;var d=this.orient();if(o[c]=f,0>d){s=h;continue t}h.boundary?h.lastVisited=-r:h.lastVisited=r}}return}return s},f.addPeaks=function(t,e){var r=this.vertices.length-1,a=this.dimension,s=this.vertices,l=this.tuple,u=this.interior,c=this.simplices,h=[e];e.lastVisited=r,e.vertices[e.vertices.indexOf(-1)]=r,e.boundary=!1,u.push(e);for(var f=[];h.length>0;){var e=h.pop(),d=e.vertices,p=e.adjacent,v=d.indexOf(r);if(!(0>v))for(var m=0;a>=m;++m)if(m!==v){var g=p[m];if(g.boundary&&!(g.lastVisited>=r)){var y=g.vertices;if(g.lastVisited!==-r){for(var b=0,x=0;a>=x;++x)y[x]<0?(b=x,l[x]=t):l[x]=s[y[x]];var _=this.orient();if(_>0){y[b]=r,g.boundary=!1,u.push(g),h.push(g),g.lastVisited=r;continue}g.lastVisited=-r}var w=g.adjacent,M=d.slice(),k=p.slice(),A=new n(M,k,!0);c.push(A);var T=w.indexOf(e);if(!(0>T)){w[T]=A,k[v]=g,M[m]=-1,k[m]=e,p[m]=A,A.flip();for(var x=0;a>=x;++x){var E=M[x];if(!(0>E||E===r)){for(var S=new Array(a-1),L=0,z=0;a>=z;++z){var I=M[z];0>I||z===x||(S[L++]=I)}f.push(new i(S,A,x))}}}}}}f.sort(o);for(var m=0;m+1<f.length;m+=2){var P=f[m],C=f[m+1],R=P.index,D=C.index;0>R||0>D||(P.cell.adjacent[P.index]=C.cell,C.cell.adjacent[C.index]=P.cell)}},f.insert=function(t,e){var r=this.vertices;r.push(t);var n=this.walk(t,e);if(n){for(var i=this.dimension,o=this.tuple,a=0;i>=a;++a){var s=n.vertices[a];0>s?o[a]=t:o[a]=r[s]}var l=this.orient(o);0>l||(0!==l||(n=this.handleBoundaryDegeneracy(n,t)))&&this.addPeaks(t,n)}},f.boundary=function(){for(var t=this.dimension,e=[],r=this.simplices,n=r.length,i=0;n>i;++i){var o=r[i];if(o.boundary){for(var a=new Array(t),s=o.vertices,l=0,u=0,c=0;t>=c;++c)s[c]>=0?a[l++]=s[c]:u=1&c;if(u===(1&t)){var h=a[0];a[0]=a[1],a[1]=h}e.push(a)}}return e}},{"robust-orientation":439,"simplicial-complex":244}],242:[function(t,e,r){arguments[4][51][0].apply(r,arguments)},{dup:51}],243:[function(t,e,r){arguments[4][103][0].apply(r,arguments)},{dup:103}],244:[function(t,e,r){"use strict";"use restrict";function n(t){for(var e=0,r=Math.max,n=0,i=t.length;i>n;++n)e=r(e,t[n].length);return e-1}function i(t){for(var e=-1,r=Math.max,n=0,i=t.length;i>n;++n)for(var o=t[n],a=0,s=o.length;s>a;++a)e=r(e,o[a]);return e+1}function o(t){for(var e=new Array(t.length),r=0,n=t.length;n>r;++r)e[r]=t[r].slice(0);return e}function a(t,e){var r=t.length,n=t.length-e.length,i=Math.min;if(n)return n;switch(r){case 0:return 0;case 1:return t[0]-e[0];case 2:var o=t[0]+t[1]-e[0]-e[1];return o?o:i(t[0],t[1])-i(e[0],e[1]);case 3:var a=t[0]+t[1],s=e[0]+e[1];if(o=a+t[2]-(s+e[2]))return o;var l=i(t[0],t[1]),u=i(e[0],e[1]),o=i(l,t[2])-i(u,e[2]);return o?o:i(l+t[2],a)-i(u+e[2],s);default:var c=t.slice(0);c.sort();var h=e.slice(0);h.sort();for(var f=0;r>f;++f)if(n=c[f]-h[f])return n;return 0}}function s(t,e){return a(t[0],e[0])}function l(t,e){if(e){for(var r=t.length,n=new Array(r),i=0;r>i;++i)n[i]=[t[i],e[i]];n.sort(s);for(var i=0;r>i;++i)t[i]=n[i][0],e[i]=n[i][1];return t}return t.sort(a),t}function u(t){if(0===t.length)return[];for(var e=1,r=t.length,n=1;r>n;++n){var i=t[n];if(a(i,t[n-1])){if(n===e){e++;continue}t[e++]=i}}return t.length=e,t}function c(t,e){for(var r=0,n=t.length-1,i=-1;n>=r;){var o=r+n>>1,s=a(t[o],e);0>=s?(0===s&&(i=o),r=o+1):s>0&&(n=o-1)}return i}function h(t,e){for(var r=new Array(t.length),n=0,i=r.length;i>n;++n)r[n]=[];for(var o=[],n=0,s=e.length;s>n;++n)for(var l=e[n],u=l.length,h=1,f=1<<u;f>h;++h){o.length=b.popCount(h);for(var d=0,p=0;u>p;++p)h&1<<p&&(o[d++]=l[p]);var v=c(t,o);if(!(0>v))for(;;)if(r[v++].push(n),v>=t.length||0!==a(t[v],o))break}return r}function f(t,e){if(!e)return h(u(p(t,0)),t,0);for(var r=new Array(e),n=0;e>n;++n)r[n]=[];for(var n=0,i=t.length;i>n;++n)for(var o=t[n],a=0,s=o.length;s>a;++a)r[o[a]].push(n);return r}function d(t){for(var e=[],r=0,n=t.length;n>r;++r)for(var i=t[r],o=0|i.length,a=1,s=1<<o;s>a;++a){for(var u=[],c=0;o>c;++c)a>>>c&1&&u.push(i[c]);e.push(u)}return l(e)}function p(t,e){if(0>e)return[];for(var r=[],n=(1<<e+1)-1,i=0;i<t.length;++i)for(var o=t[i],a=n;a<1<<o.length;a=b.nextCombination(a)){for(var s=new Array(e+1),u=0,c=0;c<o.length;++c)a&1<<c&&(s[u++]=o[c]);r.push(s)}return l(r)}function v(t){for(var e=[],r=0,n=t.length;n>r;++r)for(var i=t[r],o=0,a=i.length;a>o;++o){for(var s=new Array(i.length-1),u=0,c=0;a>u;++u)u!==o&&(s[c++]=i[u]);e.push(s)}return l(e)}function m(t,e){for(var r=new x(e),n=0;n<t.length;++n)for(var i=t[n],o=0;o<i.length;++o)for(var a=o+1;a<i.length;++a)r.link(i[o],i[a]);for(var s=[],l=r.ranks,n=0;n<l.length;++n)l[n]=-1;for(var n=0;n<t.length;++n){var u=r.find(t[n][0]);l[u]<0?(l[u]=s.length,s.push([t[n].slice(0)])):s[l[u]].push(t[n].slice(0))}return s}function g(t){for(var e=u(l(p(t,0))),r=new x(e.length),n=0;n<t.length;++n)for(var i=t[n],o=0;o<i.length;++o)for(var a=c(e,[i[o]]),s=o+1;s<i.length;++s)r.link(a,c(e,[i[s]]));for(var h=[],f=r.ranks,n=0;n<f.length;++n)f[n]=-1;for(var n=0;n<t.length;++n){var d=r.find(c(e,[t[n][0]]));f[d]<0?(f[d]=h.length,h.push([t[n].slice(0)])):h[f[d]].push(t[n].slice(0))}return h}function y(t,e){return e?m(t,e):g(t)}var b=t("bit-twiddle"),x=t("union-find");r.dimension=n,r.countVertices=i,r.cloneCells=o,r.compareCells=a,r.normalize=l,r.unique=u,r.findCell=c,r.incidence=h,r.dual=f,r.explode=d,r.skeleton=p,r.boundary=v,r.connectedComponents=y},{"bit-twiddle":242,"union-find":243}],245:[function(t,e,r){"use strict";function n(t){for(var e=new Array(t),r=0;t>r;++r)e[r]=r;return e}e.exports=n},{}],246:[function(t,e,r){e.exports=function(t){return!(null==t||!(t._isBuffer||t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)))}},{}],247:[function(t,e,r){"use strict";function n(t){if(this.zoom=t.zoom,this.overscaling=t.overscaling,this.layer=t.layer,this.childLayers=t.childLayers,this.type=this.layer.type,this.features=[],this.id=this.layer.id,this.index=t.index,this.sourceLayer=this.layer.sourceLayer,this.sourceLayerIndex=t.sourceLayerIndex,this.minZoom=this.layer.minzoom,this.maxZoom=this.layer.maxzoom,this.paintAttributes=o(this),t.arrays){var e=this.childLayers;this.bufferGroups=c.mapObject(t.arrays,function(r,n){return r.map(function(r){var i=c.mapObject(r,function(e,r){return c.mapObject(e,function(e,i){var o=t.arrayTypes[n][r][i],a=o.members.length&&"vertices"===o.members[0].name?u.BufferType.ELEMENT:u.BufferType.VERTEX;return new u(e,o,a)})});i.vaos={},i.layout.element2&&(i.secondVaos={});for(var o=0;o<e.length;o++){var a=e[o].id;i.vaos[a]=new f,i.layout.element2&&(i.secondVaos[a]=new f)}return i})})}}function i(t){return new h({members:[{type:u.ELEMENT_ATTRIBUTE_TYPE,name:"vertices",components:t||3}]})}function o(t){var e={};for(var r in t.programInterfaces){for(var n=e[r]={},i=0;i<t.childLayers.length;i++){var o=t.childLayers[i];n[o.id]={attributes:[],uniforms:[]}}var l=t.programInterfaces[r];if(l.paintAttributes)for(var u=0;u<l.paintAttributes.length;u++)for(var h=l.paintAttributes[u],f=0;f<t.childLayers.length;f++){var d=t.childLayers[f],p=n[d.id];if(d.isPaintValueFeatureConstant(h.paintProperty))p.uniforms.push(h);else if(d.isPaintValueZoomConstant(h.paintProperty))p.attributes.push(h);else{for(var v=d.getPaintValueStopZoomLevels(h.paintProperty),m=0;m<v.length&&v[m]<t.zoom;)m++;for(var g=Math.max(0,Math.min(v.length-4,m-2)),y=[],b=0;4>b;b++)y.push(v[Math.min(g+b,v.length-1)]);var x=h.components;if(1===x)p.attributes.push(c.extend({},h,{getValue:a(h,y),isFunction:!0,components:4*x}));else for(var _=0;4>_;_++)p.attributes.push(c.extend({},h,{getValue:a(h,[y[_]]),isFunction:!0,name:h.name+_}));p.uniforms.push(c.extend({},h,{name:"u_"+h.name.slice(2)+"_t",getValue:s(h,g),components:1}))}}}return e}function a(t,e){return function(r,n,i){if(1===e.length)return t.getValue(r,c.extend({},n,{zoom:e[0]}),i);for(var o=[],a=0;a<e.length;a++){var s=e[a];o.push(t.getValue(r,c.extend({},n,{zoom:s}),i)[0])}return o}}function s(t,e){return function(r,n){var i=r.getPaintInterpolationT(t.paintProperty,n.zoom);return[Math.max(0,Math.min(4,i-e))]}}var l=t("feature-filter"),u=t("./buffer"),c=t("../util/util"),h=t("../util/struct_array"),f=t("../render/vertex_array_object");e.exports=n,n.create=function(e){var r={fill:t("./bucket/fill_bucket"),line:t("./bucket/line_bucket"),circle:t("./bucket/circle_bucket"),symbol:t("./bucket/symbol_bucket")};return new r[e.layer.type](e)},n.EXTENT=8192,n.prototype.populateBuffers=function(){this.createArrays(),this.recalculateStyleLayers();for(var t=0;t<this.features.length;t++)this.addFeature(this.features[t]);this.trimArrays()},n.prototype.makeRoomFor=function(t,e){var r=this.arrayGroups[t],n=r.length&&r[r.length-1];if(!n||n.layout.vertex.length+e>65535){var i=this.arrayTypes[t],o=i.layout.vertex,a=i.layout.element,s=i.layout.element2;n={index:r.length,layout:{},paint:{}},n.layout.vertex=new o,a&&(n.layout.element=new a),s&&(n.layout.element2=new s);for(var l=0;l<this.childLayers.length;l++){var u=this.childLayers[l].id,c=i.paint[u];n.paint[u]=new c}r.push(n)}return n},n.prototype.createArrays=function(){this.arrayGroups={},this.arrayTypes={};for(var t in this.programInterfaces){var e=this.programInterfaces[t],r=this.arrayTypes[t]={layout:{},paint:{}};if(this.arrayGroups[t]=[],e.vertexBuffer){var n=new h({members:this.programInterfaces[t].layoutAttributes,alignment:u.VERTEX_ATTRIBUTE_ALIGNMENT});r.layout.vertex=n;var o=this.paintAttributes[t];for(var a in o){var s=new h({members:o[a].attributes,alignment:u.VERTEX_ATTRIBUTE_ALIGNMENT});r.paint[a]=s}}if(e.elementBuffer){var l=i(e.elementBufferComponents);r.layout.element=l}if(e.elementBuffer2){var c=i(e.elementBuffer2Components);r.layout.element2=c}}},n.prototype.destroy=function(t){for(var e in this.bufferGroups)for(var r=this.bufferGroups[e],n=0;n<r.length;n++){var i=r[n];for(var o in i.paint)i.paint[o].destroy(t);for(var a in i.layout)i.layout[a].destroy(t);for(var s in i.vaos)i.vaos[s].destroy(t);for(var l in i.secondVaos)i.secondVaos[l].destroy(t)}},n.prototype.trimArrays=function(){for(var t in this.arrayGroups){var e=this.arrayGroups[t];for(var r in e.paint)e.paint[r].trim();for(var n in e.layout)e.layout[n].trim()}},n.prototype.setUniforms=function(t,e,r,n,i){for(var o=this.paintAttributes[e][n.id].uniforms,a=0;a<o.length;a++){var s=o[a],l=r[s.name];t["uniform"+s.components+"fv"](l,s.getValue(n,i))}},n.prototype.serialize=function(){return{layerId:this.layer.id,zoom:this.zoom,arrays:c.mapObject(this.arrayGroups,function(t){return t.map(function(t){return c.mapObject(t,function(t){return c.mapObject(t,function(t){return t.serialize()})})})}),arrayTypes:c.mapObject(this.arrayTypes,function(t){return c.mapObject(t,function(t){return c.mapObject(t,function(t){return t.serialize()})})}),childLayerIds:this.childLayers.map(function(t){return t.id})}},n.prototype.createFilter=function(){this.filter||(this.filter=l(this.layer.filter))};var d={lastIntegerZoom:1/0,lastIntegerZoomTime:0,lastZoom:0};n.prototype.recalculateStyleLayers=function(){for(var t=0;t<this.childLayers.length;t++)this.childLayers[t].recalculate(this.zoom,d)},n.prototype.getProgramMacros=function(t,e){for(var r=[],n=this.paintAttributes[t][e.id].attributes,i=0;i<n.length;i++){var o=n[i];r.push("ATTRIBUTE_"+(o.isFunction?"ZOOM_FUNCTION_":"")+o.name.toUpperCase())}return r},n.prototype.addPaintAttributes=function(t,e,r,n,i){for(var o=0;o<this.childLayers.length;o++)for(var a=this.childLayers[o],s=this.arrayGroups[t],l=n.index;l<s.length;l++){var u=s[l],c=u.layout.vertex.length,h=u.paint[a.id];h.resize(c);for(var f=this.paintAttributes[t][a.id].attributes,d=0;d<f.length;d++)for(var p=f[d],v=p.getValue(a,e,r),m=p.multiplier||1,g=p.components||1,y=i;c>y;y++)for(var b=h.get(y),x=0;g>x;x++){var _=g>1?p.name+x:p.name;b[_]=v[x]*m}}}},{"../render/vertex_array_object":273,"../util/struct_array":347,"../util/util":349,"./bucket/circle_bucket":248,"./bucket/fill_bucket":249,"./bucket/line_bucket":250,"./bucket/symbol_bucket":251,"./buffer":252,"feature-filter":352}],248:[function(t,e,r){"use strict";function n(){i.apply(this,arguments)}var i=t("../bucket"),o=t("../../util/util"),a=t("../load_geometry"),s=i.EXTENT;e.exports=n,n.prototype=o.inherit(i,{}),n.prototype.addCircleVertex=function(t,e,r,n,i){return t.emplaceBack(2*e+(n+1)/2,2*r+(i+1)/2)},n.prototype.programInterfaces={circle:{vertexBuffer:!0,elementBuffer:!0,layoutAttributes:[{name:"a_pos",components:2,type:"Int16"}],paintAttributes:[{name:"a_color",components:4,type:"Uint8",getValue:function(t,e,r){return o.premultiply(t.getPaintValue("circle-color",e,r))},multiplier:255,paintProperty:"circle-color"},{name:"a_radius",components:1,type:"Uint16",isLayerConstant:!1,getValue:function(t,e,r){return[t.getPaintValue("circle-radius",e,r)]},multiplier:10,paintProperty:"circle-radius"}]}},n.prototype.addFeature=function(t){for(var e={zoom:this.zoom},r=a(t),n=this.makeRoomFor("circle",0),i=n.layout.vertex.length,o=0;o<r.length;o++)for(var l=0;l<r[o].length;l++){var u=r[o][l].x,c=r[o][l].y;if(!(0>u||u>=s||0>c||c>=s)){var h=this.makeRoomFor("circle",4),f=h.layout.vertex,d=this.addCircleVertex(f,u,c,-1,-1);this.addCircleVertex(f,u,c,1,-1),this.addCircleVertex(f,u,c,1,1),this.addCircleVertex(f,u,c,-1,1),h.layout.element.emplaceBack(d,d+1,d+2),h.layout.element.emplaceBack(d,d+3,d+2)}}this.addPaintAttributes("circle",e,t.properties,n,i)}},{"../../util/util":349,"../bucket":247,"../load_geometry":254}],249:[function(t,e,r){"use strict";function n(){i.apply(this,arguments)}var i=t("../bucket"),o=t("../../util/util"),a=t("../load_geometry");e.exports=n,n.prototype=o.inherit(i,{}),n.prototype.programInterfaces={fill:{vertexBuffer:!0,elementBuffer:!0,elementBuffer2:!0,elementBuffer2Components:2,layoutAttributes:[{name:"a_pos",components:2,type:"Int16"}]}},n.prototype.addFeature=function(t){for(var e=a(t),r=0;r<e.length;r++)this.addFill(e[r])},n.prototype.addFill=function(t){if(!(t.length<3))for(var e,r,n=t.length,i=this.makeRoomFor("fill",n+1),o=0;o<t.length;o++){var a=t[o],s=i.layout.vertex.emplaceBack(a.x,a.y);0===o&&(e=s),o>=2&&(a.x!==t[0].x||a.y!==t[0].y)&&i.layout.element.emplaceBack(e,r,s),o>=1&&i.layout.element2.emplaceBack(r,s),r=s}}},{"../../util/util":349,"../bucket":247,"../load_geometry":254}],250:[function(t,e,r){"use strict";function n(){i.apply(this,arguments)}var i=t("../bucket"),o=t("../../util/util"),a=t("../load_geometry"),s=i.EXTENT,l=63,u=Math.cos(37.5*(Math.PI/180)),c=15,h=14,f=.5,d=Math.pow(2,h)/f;e.exports=n,n.prototype=o.inherit(i,{}),n.prototype.addLineVertex=function(t,e,r,n,i,o,a){return t.emplaceBack(e.x<<1|n,e.y<<1|i,Math.round(l*r.x)+128,Math.round(l*r.y)+128,(0===o?0:0>o?-1:1)+1|(a*f&63)<<2,a*f>>6)},n.prototype.programInterfaces={line:{vertexBuffer:!0,elementBuffer:!0,layoutAttributes:[{name:"a_pos",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}]}},n.prototype.addFeature=function(t){for(var e=a(t),r=0;r<e.length;r++)this.addLine(e[r],this.layer.layout["line-join"],this.layer.layout["line-cap"],this.layer.layout["line-miter-limit"],this.layer.layout["line-round-limit"])},n.prototype.addLine=function(t,e,r,n,i){for(var o=t.length;o>2&&t[o-1].equals(t[o-2]);)o--;if(!(t.length<2)){"bevel"===e&&(n=1.05);var a=c*(s/(512*this.overscaling)),l=t[0],h=t[o-1],f=l.equals(h);if(this.makeRoomFor("line",10*o),2!==o||!f){this.distance=0;var d,p,v,m,g,y,b,x=r,_=f?"butt":r,w=!0;this.e1=this.e2=this.e3=-1,f&&(d=t[o-2],g=l.sub(d)._unit()._perp());for(var M=0;o>M;M++)if(v=f&&M===o-1?t[1]:t[M+1],!v||!t[M].equals(v)){g&&(m=g),d&&(p=d),d=t[M],g=v?v.sub(d)._unit()._perp():m,m=m||g;var k=m.add(g)._unit(),A=k.x*g.x+k.y*g.y,T=1/A,E=u>A&&p&&v;if(E&&M>0){var S=d.dist(p);if(S>2*a){var L=d.sub(d.sub(p)._mult(a/S)._round());this.distance+=L.dist(p),this.addCurrentVertex(L,this.distance,m.mult(1),0,0,!1),p=L}}var z=p&&v,I=z?e:v?x:_;if(z&&"round"===I&&(i>T?I="miter":2>=T&&(I="fakeround")),"miter"===I&&T>n&&(I="bevel"),"bevel"===I&&(T>2&&(I="flipbevel"),n>T&&(I="miter")),p&&(this.distance+=d.dist(p)),"miter"===I)k._mult(T),this.addCurrentVertex(d,this.distance,k,0,0,!1);else if("flipbevel"===I){if(T>100)k=g.clone();else{var P=m.x*g.y-m.y*g.x>0?-1:1,C=T*m.add(g).mag()/m.sub(g).mag();k._perp()._mult(C*P)}this.addCurrentVertex(d,this.distance,k,0,0,!1),this.addCurrentVertex(d,this.distance,k.mult(-1),0,0,!1)}else if("bevel"===I||"fakeround"===I){var R=m.x*g.y-m.y*g.x>0,D=-Math.sqrt(T*T-1);if(R?(b=0,y=D):(y=0,b=D),w||this.addCurrentVertex(d,this.distance,m,y,b,!1),"fakeround"===I){for(var O,F=Math.floor(8*(.5-(A-.5))),j=0;F>j;j++)O=g.mult((j+1)/(F+1))._add(m)._unit(),this.addPieSliceVertex(d,this.distance,O,R);this.addPieSliceVertex(d,this.distance,k,R);for(var N=F-1;N>=0;N--)O=m.mult((N+1)/(F+1))._add(g)._unit(),this.addPieSliceVertex(d,this.distance,O,R)}v&&this.addCurrentVertex(d,this.distance,g,-y,-b,!1)}else"butt"===I?(w||this.addCurrentVertex(d,this.distance,m,0,0,!1),v&&this.addCurrentVertex(d,this.distance,g,0,0,!1)):"square"===I?(w||(this.addCurrentVertex(d,this.distance,m,1,1,!1),this.e1=this.e2=-1),v&&this.addCurrentVertex(d,this.distance,g,-1,-1,!1)):"round"===I&&(w||(this.addCurrentVertex(d,this.distance,m,0,0,!1),this.addCurrentVertex(d,this.distance,m,1,1,!0),this.e1=this.e2=-1),v&&(this.addCurrentVertex(d,this.distance,g,-1,-1,!0),this.addCurrentVertex(d,this.distance,g,0,0,!1)));if(E&&o-1>M){var B=d.dist(v);if(B>2*a){var U=d.add(v.sub(d)._mult(a/B)._round());this.distance+=U.dist(d),this.addCurrentVertex(U,this.distance,g.mult(1),0,0,!1),d=U}}w=!1}}}},n.prototype.addCurrentVertex=function(t,e,r,n,i,o){var a,s=o?1:0,l=this.arrayGroups.line[this.arrayGroups.line.length-1].layout,u=l.vertex,c=l.element;a=r.clone(),n&&a._sub(r.perp()._mult(n)),this.e3=this.addLineVertex(u,t,a,s,0,n,e),this.e1>=0&&this.e2>=0&&c.emplaceBack(this.e1,this.e2,this.e3),this.e1=this.e2,this.e2=this.e3,a=r.mult(-1),i&&a._sub(r.perp()._mult(i)),this.e3=this.addLineVertex(u,t,a,s,1,-i,e),this.e1>=0&&this.e2>=0&&c.emplaceBack(this.e1,this.e2,this.e3),this.e1=this.e2,this.e2=this.e3,e>d/2&&(this.distance=0,this.addCurrentVertex(t,this.distance,r,n,i,o))},n.prototype.addPieSliceVertex=function(t,e,r,n){var i=n?1:0;r=r.mult(n?-1:1);var o=this.arrayGroups.line[this.arrayGroups.line.length-1].layout,a=o.vertex,s=o.element;this.e3=this.addLineVertex(a,t,r,0,i,0,e),this.e1>=0&&this.e2>=0&&s.emplaceBack(this.e1,this.e2,this.e3),n?this.e2=this.e3:this.e1=this.e3}},{"../../util/util":349,"../bucket":247,"../load_geometry":254}],251:[function(t,e,r){"use strict";function n(t){s.apply(this,arguments),this.showCollisionBoxes=t.showCollisionBoxes,this.overscaling=t.overscaling,this.collisionBoxArray=t.collisionBoxArray,this.sdfIcons=t.sdfIcons,this.iconsNeedLinear=t.iconsNeedLinear,this.adjustedTextSize=t.adjustedTextSize,this.adjustedIconSize=t.adjustedIconSize,this.fontstack=t.fontstack}function i(t,e,r,n,i,o,a,s,l,u){return t.emplaceBack(e,r,Math.round(64*n),Math.round(64*i),o/4,a/4,10*(u||0),0,10*(s||0),10*Math.min(l||25,25))}function o(t,e,r,n,i,o,a,s,l,u,c,h,f,d,p,v,m){this.x=t.x,this.y=t.y,this.index=a,this.hasText=!!r,this.hasIcon=!!n,this.hasText&&(this.glyphQuads=o?_(t,r,h,e,i,d):[],this.textCollisionFeature=new y(s,e,t,l,u,c,r,h,f,d,!1)),this.hasIcon&&(this.iconQuads=o?w(t,n,p,e,i,m):[],this.iconCollisionFeature=new y(s,e,t,l,u,c,n,p,v,m,!0))}var a=t("point-geometry"),s=t("../bucket"),l=t("../../symbol/anchor"),u=t("../../symbol/get_anchors"),c=t("../../util/token"),h=t("../../symbol/quads"),f=t("../../symbol/shaping"),d=t("../../symbol/resolve_text"),p=t("../../symbol/mergelines"),v=t("../../symbol/clip_line"),m=t("../../util/util"),g=t("../load_geometry"),y=t("../../symbol/collision_feature"),b=f.shapeText,x=f.shapeIcon,_=h.getGlyphQuads,w=h.getIconQuads,M=s.EXTENT;e.exports=n,n.prototype=m.inherit(s,{}),n.prototype.serialize=function(){var t=s.prototype.serialize.apply(this);return t.sdfIcons=this.sdfIcons,t.iconsNeedLinear=this.iconsNeedLinear,t.adjustedTextSize=this.adjustedTextSize,t.adjustedIconSize=this.adjustedIconSize,t.fontstack=this.fontstack,t};var k=[{name:"a_pos",components:2,type:"Int16"},{name:"a_offset",components:2,type:"Int16"},{name:"a_data1",components:4,type:"Uint8"},{name:"a_data2",components:2,type:"Uint8"}];n.prototype.addCollisionBoxVertex=function(t,e,r,n,i){return t.emplaceBack(e.x,e.y,Math.round(r.x),Math.round(r.y),10*n,10*i)},n.prototype.programInterfaces={glyph:{vertexBuffer:!0,elementBuffer:!0,layoutAttributes:k},icon:{vertexBuffer:!0,elementBuffer:!0,layoutAttributes:k},collisionBox:{vertexBuffer:!0,layoutAttributes:[{name:"a_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"},{name:"a_data",components:2,type:"Uint8"}]}},n.prototype.populateBuffers=function(t,e,r){var n={lastIntegerZoom:1/0,lastIntegerZoomTime:0,lastZoom:0};this.adjustedTextMaxSize=this.layer.getLayoutValue("text-size",{zoom:18,zoomHistory:n}),this.adjustedTextSize=this.layer.getLayoutValue("text-size",{zoom:this.zoom+1,zoomHistory:n}),this.adjustedIconMaxSize=this.layer.getLayoutValue("icon-size",{zoom:18,zoomHistory:n}),this.adjustedIconSize=this.layer.getLayoutValue("icon-size",{zoom:this.zoom+1,zoomHistory:n});var i=512*this.overscaling;this.tilePixelRatio=M/i,this.compareText={},this.symbolInstances=[],this.iconsNeedLinear=!1;var o=this.layer.layout,a=this.features,s=this.textFeatures,l=.5,u=.5;switch(o["text-anchor"]){case"right":case"top-right":case"bottom-right":l=1;break;case"left":case"top-left":case"bottom-left":l=0}switch(o["text-anchor"]){case"bottom":case"bottom-right":case"bottom-left":u=1;break;case"top":case"top-right":case"top-left":u=0}for(var h="right"===o["text-justify"]?1:"left"===o["text-justify"]?0:.5,f=24,d=o["text-line-height"]*f,v="line"!==o["symbol-placement"]?o["text-max-width"]*f:0,m=o["text-letter-spacing"]*f,y=[o["text-offset"][0]*f,o["text-offset"][1]*f],_=this.fontstack=o["text-font"].join(","),w=[],k=0;k<a.length;k++)w.push(g(a[k]));if("line"===o["symbol-placement"]){var A=p(a,s,w);w=A.geometries,a=A.features,s=A.textFeatures}for(var T,E,S=0;S<a.length;S++)if(w[S]){if(T=s[S]?b(s[S],e[_],v,d,l,u,h,m,y):null,o["icon-image"]){var L=c(a[S].properties,o["icon-image"]),z=r[L];E=x(z,o),z&&(void 0===this.sdfIcons?this.sdfIcons=z.sdf:this.sdfIcons!==z.sdf&&console.warn("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),1!==z.pixelRatio&&(this.iconsNeedLinear=!0))}else E=null;(T||E)&&this.addFeature(w[S],T,E,a[S].index)}this.placeFeatures(t,this.showCollisionBoxes),this.trimArrays()},n.prototype.addFeature=function(t,e,r,n){var i=this.layer.layout,a=24,s=this.adjustedTextSize/a,c=void 0!==this.adjustedTextMaxSize?this.adjustedTextMaxSize:this.adjustedTextSize,h=this.tilePixelRatio*s,f=this.tilePixelRatio*c/a,d=this.tilePixelRatio*this.adjustedIconSize,p=this.tilePixelRatio*i["symbol-spacing"],m=i["symbol-avoid-edges"],g=i["text-padding"]*this.tilePixelRatio,y=i["icon-padding"]*this.tilePixelRatio,b=i["text-max-angle"]/180*Math.PI,x="map"===i["text-rotation-alignment"]&&"line"===i["symbol-placement"],_="map"===i["icon-rotation-alignment"]&&"line"===i["symbol-placement"],w=i["text-allow-overlap"]||i["icon-allow-overlap"]||i["text-ignore-placement"]||i["icon-ignore-placement"],k="line"===i["symbol-placement"],A=p/2;k&&(t=v(t,0,0,M,M));for(var T=0;T<t.length;T++){var E,S=t[T];E=k?u(S,p,b,e,r,a,f,this.overscaling,M):[new l(S[0].x,S[0].y,0)];for(var L=0,z=E.length;z>L;L++){var I=E[L];if(!(e&&k&&this.anchorIsTooClose(e.text,A,I))){var P=!(I.x<0||I.x>M||I.y<0||I.y>M);if(!m||P){var C=P||w;this.symbolInstances.push(new o(I,S,e,r,i,C,this.symbolInstances.length,this.collisionBoxArray,n,this.sourceLayerIndex,this.index,h,g,x,d,y,_))}}}}},n.prototype.anchorIsTooClose=function(t,e,r){var n=this.compareText;if(t in n){for(var i=n[t],o=i.length-1;o>=0;o--)if(r.dist(i[o])<e)return!0}else n[t]=[];return n[t].push(r),!1},n.prototype.placeFeatures=function(t,e){this.recalculateStyleLayers(),this.createArrays();var r=this.layer.layout,n=t.maxScale,i="map"===r["text-rotation-alignment"]&&"line"===r["symbol-placement"],o="map"===r["icon-rotation-alignment"]&&"line"===r["symbol-placement"],a=r["text-allow-overlap"]||r["icon-allow-overlap"]||r["text-ignore-placement"]||r["icon-ignore-placement"];if(a){var s=t.angle,l=Math.sin(s),u=Math.cos(s);this.symbolInstances.sort(function(t,e){var r=l*t.x+u*t.y|0,n=l*e.x+u*e.y|0;return r-n||e.index-t.index})}for(var c=0;c<this.symbolInstances.length;c++){var h=this.symbolInstances[c],f=h.hasText,d=h.hasIcon,p=r["text-optional"]||!f,v=r["icon-optional"]||!d,m=f?t.placeCollisionFeature(h.textCollisionFeature,r["text-allow-overlap"],r["symbol-avoid-edges"]):t.minScale,g=d?t.placeCollisionFeature(h.iconCollisionFeature,r["icon-allow-overlap"],r["symbol-avoid-edges"]):t.minScale;p||v?!v&&m?m=Math.max(g,m):!p&&g&&(g=Math.max(g,m)):g=m=Math.max(g,m),f&&(t.insertCollisionFeature(h.textCollisionFeature,m,r["text-ignore-placement"]),n>=m&&this.addSymbols("glyph",h.glyphQuads,m,r["text-keep-upright"],i,t.angle)),d&&(t.insertCollisionFeature(h.iconCollisionFeature,g,r["icon-ignore-placement"]),n>=g&&this.addSymbols("icon",h.iconQuads,g,r["icon-keep-upright"],o,t.angle))}e&&this.addToDebugBuffers(t)},n.prototype.addSymbols=function(t,e,r,n,o,a){for(var s=this.makeRoomFor(t,4*e.length),l=s.layout.element,u=s.layout.vertex,c=this.zoom,h=Math.max(Math.log(r)/Math.LN2+c,0),f=0;f<e.length;f++){var d=e[f],p=d.angle,v=(p+a+Math.PI)%(2*Math.PI);if(!(n&&o&&(v<=Math.PI/2||v>3*Math.PI/2))){var m=d.tl,g=d.tr,y=d.bl,b=d.br,x=d.tex,_=d.anchorPoint,w=Math.max(c+Math.log(d.minScale)/Math.LN2,h),M=Math.min(c+Math.log(d.maxScale)/Math.LN2,25);if(!(w>=M)){w===h&&(w=0);var k=i(u,_.x,_.y,m.x,m.y,x.x,x.y,w,M,h);i(u,_.x,_.y,g.x,g.y,x.x+x.w,x.y,w,M,h),i(u,_.x,_.y,y.x,y.y,x.x,x.y+x.h,w,M,h),i(u,_.x,_.y,b.x,b.y,x.x+x.w,x.y+x.h,w,M,h),l.emplaceBack(k,k+1,k+2),l.emplaceBack(k+1,k+2,k+3)}}}},n.prototype.updateIcons=function(t){this.recalculateStyleLayers();var e=this.layer.layout["icon-image"];if(e)for(var r=0;r<this.features.length;r++){var n=c(this.features[r].properties,e);n&&(t[n]=!0)}},n.prototype.updateFont=function(t){this.recalculateStyleLayers();var e=this.layer.layout["text-font"],r=t[e]=t[e]||{};this.textFeatures=d(this.features,this.layer.layout,r)},n.prototype.addToDebugBuffers=function(t){for(var e=this.makeRoomFor("collisionBox",0),r=e.layout.vertex,n=-t.angle,i=t.yStretch,o=0;o<this.symbolInstances.length;o++)for(var s=0;2>s;s++){var l=this.symbolInstances[o][0===s?"textCollisionFeature":"iconCollisionFeature"];if(l)for(var u=l.boxStartIndex;u<l.boxEndIndex;u++){var c=this.collisionBoxArray.get(u),h=c.anchorPoint,f=new a(c.x1,c.y1*i)._rotate(n),d=new a(c.x2,c.y1*i)._rotate(n),p=new a(c.x1,c.y2*i)._rotate(n),v=new a(c.x2,c.y2*i)._rotate(n),m=Math.max(0,Math.min(25,this.zoom+Math.log(c.maxScale)/Math.LN2)),g=Math.max(0,Math.min(25,this.zoom+Math.log(c.placementScale)/Math.LN2));this.addCollisionBoxVertex(r,h,f,m,g),this.addCollisionBoxVertex(r,h,d,m,g),this.addCollisionBoxVertex(r,h,d,m,g),this.addCollisionBoxVertex(r,h,v,m,g),this.addCollisionBoxVertex(r,h,v,m,g),this.addCollisionBoxVertex(r,h,p,m,g),this.addCollisionBoxVertex(r,h,p,m,g),this.addCollisionBoxVertex(r,h,f,m,g)}}}},{"../../symbol/anchor":303,"../../symbol/clip_line":305,"../../symbol/collision_feature":307,"../../symbol/get_anchors":309,
"../../symbol/mergelines":312,"../../symbol/quads":313,"../../symbol/resolve_text":314,"../../symbol/shaping":315,"../../util/token":348,"../../util/util":349,"../bucket":247,"../load_geometry":254,"point-geometry":404}],252:[function(t,e,r){"use strict";function n(t,e,r){this.arrayBuffer=t.arrayBuffer,this.length=t.length,this.attributes=e.members,this.itemSize=e.bytesPerElement,this.type=r,this.arrayType=e}var i=t("assert");e.exports=n,n.prototype.bind=function(t){var e=t[this.type];this.buffer?t.bindBuffer(e,this.buffer):(this.buffer=t.createBuffer(),t.bindBuffer(e,this.buffer),t.bufferData(e,this.arrayBuffer,t.STATIC_DRAW),this.arrayBuffer=null)};var o={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT"};n.prototype.setVertexAttribPointers=function(t,e){for(var r=0;r<this.attributes.length;r++){var n=this.attributes[r],a=e[n.name];i(void 0!==a,'array member "'+n.name+'" name does not match shader attribute name'),t.vertexAttribPointer(a,n.components,t[o[n.type]],!1,this.arrayType.bytesPerElement,n.offset)}},n.prototype.destroy=function(t){this.buffer&&t.deleteBuffer(this.buffer)},n.BufferType={VERTEX:"ARRAY_BUFFER",ELEMENT:"ELEMENT_ARRAY_BUFFER"},n.ELEMENT_ATTRIBUTE_TYPE="Uint16",n.VERTEX_ATTRIBUTE_ALIGNMENT=4},{assert:52}],253:[function(t,e,r){"use strict";function n(t,e,r){if(t.grid){var n=t,i=e;t=n.coord,e=n.overscaling,this.grid=new p(n.grid),this.featureIndexArray=new k(n.featureIndexArray),this.rawTileData=i,this.bucketLayerIDs=n.bucketLayerIDs}else this.grid=new p(h,16,0),this.featureIndexArray=new k;this.coord=t,this.overscaling=e,this.x=t.x,this.y=t.y,this.z=t.z-Math.log(e)/Math.LN2,this.setCollisionTile(r)}function i(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function o(t,e){return e-t}function a(t){return t["line-gap-width"]>0?t["line-gap-width"]+2*t["line-width"]:t["line-width"]}function s(t,e,r,n,i){if(!e[0]&&!e[1])return t;e=u.convert(e),"viewport"===r&&e._rotate(-n);for(var o=[],a=0;a<t.length;a++){for(var s=t[a],l=[],c=0;c<s.length;c++)l.push(s[c].sub(e._mult(i)));o.push(l)}return o}function l(t,e){for(var r=[],n=new u(0,0),i=0;i<t.length;i++){for(var o=t[i],a=[],s=0;s<o.length;s++){var l=o[s-1],c=o[s],h=o[s+1],f=0===s?n:c.sub(l)._unit()._perp(),d=s===o.length-1?n:h.sub(c)._unit()._perp(),p=f._add(d)._unit(),v=p.x*d.x+p.y*d.y;p._mult(1/v),a.push(p._mult(e)._add(c))}r.push(a)}return r}var u=t("point-geometry"),c=t("./load_geometry"),h=t("./bucket").EXTENT,f=t("feature-filter"),d=t("../util/struct_array"),p=t("grid-index"),v=t("../util/dictionary_coder"),m=t("vector-tile"),g=t("pbf"),y=t("../util/vectortile_to_geojson"),b=t("../util/util").arraysIntersect,x=t("../util/intersection_tests"),_=x.multiPolygonIntersectsBufferedMultiPoint,w=x.multiPolygonIntersectsMultiPolygon,M=x.multiPolygonIntersectsBufferedMultiLine,k=new d({members:[{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]});e.exports=n,n.prototype.insert=function(t,e,r,n){var i=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(e,r,n);for(var o=c(t),a=0;a<o.length;a++){for(var s=o[a],l=[1/0,1/0,-(1/0),-(1/0)],u=0;u<s.length;u++){var h=s[u];l[0]=Math.min(l[0],h.x),l[1]=Math.min(l[1],h.y),l[2]=Math.max(l[2],h.x),l[3]=Math.max(l[3],h.y)}this.grid.insert(i,l[0],l[1],l[2],l[3])}},n.prototype.setCollisionTile=function(t){this.collisionTile=t},n.prototype.serialize=function(){var t={coord:this.coord,overscaling:this.overscaling,grid:this.grid.toArrayBuffer(),featureIndexArray:this.featureIndexArray.serialize(),bucketLayerIDs:this.bucketLayerIDs};return{data:t,transferables:[t.grid,t.featureIndexArray.arrayBuffer]}},n.prototype.query=function(t,e){this.vtLayers||(this.vtLayers=new m.VectorTile(new g(new Uint8Array(this.rawTileData))).layers,this.sourceLayerCoder=new v(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"]));var r={},n=t.params||{},s=h/t.tileSize/t.scale,l=f(n.filter),c=0;for(var d in e){var p=e[d],y=p.paint,b=0;"line"===p.type?b=a(y)/2+Math.abs(y["line-offset"])+i(y["line-translate"]):"fill"===p.type?b=i(y["fill-translate"]):"circle"===p.type&&(b=y["circle-radius"]+i(y["circle-translate"])),c=Math.max(c,b*s)}for(var x=t.queryGeometry.map(function(t){return t.map(function(t){return new u(t.x,t.y)})}),_=1/0,w=1/0,M=-(1/0),k=-(1/0),A=0;A<x.length;A++)for(var T=x[A],E=0;E<T.length;E++){var S=T[E];_=Math.min(_,S.x),w=Math.min(w,S.y),M=Math.max(M,S.x),k=Math.max(k,S.y)}var L=this.grid.query(_-c,w-c,M+c,k+c);L.sort(o),this.filterMatching(r,L,this.featureIndexArray,x,l,n.layers,e,t.bearing,s);var z=this.collisionTile.queryRenderedSymbols(_,w,M,k,t.scale);return z.sort(),this.filterMatching(r,z,this.collisionTile.collisionBoxArray,x,l,n.layers,e,t.bearing,s),r},n.prototype.filterMatching=function(t,e,r,n,i,o,u,h,f){for(var d,p=0;p<e.length;p++){var v=e[p];if(v!==d){d=v;var m=r.get(v),g=this.bucketLayerIDs[m.bucketIndex];if(!o||b(o,g)){var x=this.sourceLayerCoder.decode(m.sourceLayerIndex),k=this.vtLayers[x],A=k.feature(m.featureIndex);if(i(A))for(var T=null,E=0;E<g.length;E++){var S=g[E];if(!(o&&o.indexOf(S)<0)){var L=u[S];if(L){var z;if("symbol"!==L.type){T||(T=c(A));var I=L.paint;if("line"===L.type){z=s(n,I["line-translate"],I["line-translate-anchor"],h,f);var P=a(I)/2*f;if(I["line-offset"]&&(T=l(T,I["line-offset"]*f)),!M(z,T,P))continue}else if("fill"===L.type){if(z=s(n,I["fill-translate"],I["fill-translate-anchor"],h,f),!w(z,T))continue}else if("circle"===L.type){z=s(n,I["circle-translate"],I["circle-translate-anchor"],h,f);var C=I["circle-radius"]*f;if(!_(z,T,C))continue}}var R=new y(A,this.z,this.x,this.y);R.layer=L.serialize({includeRefProperties:!0});var D=t[S];void 0===D&&(D=t[S]=[]),D.push(R)}}}}}}}},{"../util/dictionary_coder":340,"../util/intersection_tests":344,"../util/struct_array":347,"../util/util":349,"../util/vectortile_to_geojson":350,"./bucket":247,"./load_geometry":254,"feature-filter":352,"grid-index":373,pbf:402,"point-geometry":404,"vector-tile":413}],254:[function(t,e,r){"use strict";var n=t("./bucket").EXTENT,i=-2*n,o=2*n-1,a=!1;e.exports=function(t){for(var e=n/t.extent,r=t.loadGeometry(),s=0;s<r.length;s++)for(var l=r[s],u=0;u<l.length;u++){var c=l[u];c.x=Math.round(c.x*e),c.y=Math.round(c.y*e),a===!1&&(c.x<i||c.x>o||c.y<i||c.y>o)&&(console.warn("Geometry exceeds allowed extent, reduce your vector tile buffer size"),a=!0)}return r}},{"./bucket":247}],255:[function(t,e,r){"use strict";function n(t,e,r){this.column=t,this.row=e,this.zoom=r}e.exports=n,n.prototype={clone:function(){return new n(this.column,this.row,this.zoom)},zoomTo:function(t){return this.clone()._zoomTo(t)},sub:function(t){return this.clone()._sub(t)},_zoomTo:function(t){var e=Math.pow(2,t-this.zoom);return this.column*=e,this.row*=e,this.zoom=t,this},_sub:function(t){return t=t.zoomTo(this.zoom),this.column-=t.column,this.row-=t.row,this}}},{}],256:[function(t,e,r){"use strict";function n(t,e){if(isNaN(t)||isNaN(e))throw new Error("Invalid LngLat object: ("+t+", "+e+")");if(this.lng=+t,this.lat=+e,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}e.exports=n;var i=t("../util/util").wrap;n.prototype.wrap=function(){return new n(i(this.lng,-180,180),this.lat)},n.prototype.toArray=function(){return[this.lng,this.lat]},n.prototype.toString=function(){return"LngLat("+this.lng+", "+this.lat+")"},n.convert=function(t){return t instanceof n?t:Array.isArray(t)?new n(t[0],t[1]):t}},{"../util/util":349}],257:[function(t,e,r){"use strict";function n(t,e){t&&(e?this.extend(t).extend(e):4===t.length?this.extend([t[0],t[1]]).extend([t[2],t[3]]):this.extend(t[0]).extend(t[1]))}e.exports=n;var i=t("./lng_lat");n.prototype={extend:function(t){var e,r,o=this._sw,a=this._ne;if(t instanceof i)e=t,r=t;else{if(!(t instanceof n))return t?this.extend(i.convert(t)||n.convert(t)):this;if(e=t._sw,r=t._ne,!e||!r)return this}return o||a?(o.lng=Math.min(e.lng,o.lng),o.lat=Math.min(e.lat,o.lat),a.lng=Math.max(r.lng,a.lng),a.lat=Math.max(r.lat,a.lat)):(this._sw=new i(e.lng,e.lat),this._ne=new i(r.lng,r.lat)),this},getCenter:function(){return new i((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)},getSouthWest:function(){return this._sw},getNorthEast:function(){return this._ne},getNorthWest:function(){return new i(this.getWest(),this.getNorth())},getSouthEast:function(){return new i(this.getEast(),this.getSouth())},getWest:function(){return this._sw.lng},getSouth:function(){return this._sw.lat},getEast:function(){return this._ne.lng},getNorth:function(){return this._ne.lat},toArray:function(){return[this._sw.toArray(),this._ne.toArray()]},toString:function(){return"LngLatBounds("+this._sw.toString()+", "+this._ne.toString()+")"}},n.convert=function(t){return!t||t instanceof n?t:new n(t)}},{"./lng_lat":256}],258:[function(t,e,r){"use strict";function n(t,e){this.tileSize=512,this._minZoom=t||0,this._maxZoom=e||22,this.latRange=[-85.05113,85.05113],this.width=0,this.height=0,this._center=new i(0,0),this.zoom=0,this.angle=0,this._altitude=1.5,this._pitch=0,this._unmodified=!0}var i=t("./lng_lat"),o=t("point-geometry"),a=t("./coordinate"),s=t("../util/util").wrap,l=t("../util/interpolate"),u=t("../source/tile_coord"),c=t("../data/bucket").EXTENT,h=t("gl-matrix"),f=h.vec4,d=h.mat4,p=h.mat2;e.exports=n,n.prototype={get minZoom(){return this._minZoom},set minZoom(t){this._minZoom!==t&&(this._minZoom=t,this.zoom=Math.max(this.zoom,t))},get maxZoom(){return this._maxZoom},set maxZoom(t){this._maxZoom!==t&&(this._maxZoom=t,this.zoom=Math.min(this.zoom,t))},get worldSize(){return this.tileSize*this.scale},get centerPoint(){return this.size._div(2)},get size(){return new o(this.width,this.height)},get bearing(){return-this.angle/Math.PI*180},set bearing(t){var e=-s(t,-180,180)*Math.PI/180;this.angle!==e&&(this._unmodified=!1,this.angle=e,this._calcProjMatrix(),this.rotationMatrix=p.create(),p.rotate(this.rotationMatrix,this.rotationMatrix,this.angle))},get pitch(){return this._pitch/Math.PI*180},set pitch(t){var e=Math.min(60,t)/180*Math.PI;this._pitch!==e&&(this._unmodified=!1,this._pitch=e,this._calcProjMatrix())},get altitude(){return this._altitude},set altitude(t){var e=Math.max(.75,t);this._altitude!==e&&(this._unmodified=!1,this._altitude=e,this._calcProjMatrix())},get zoom(){return this._zoom},set zoom(t){var e=Math.min(Math.max(t,this.minZoom),this.maxZoom);this._zoom!==e&&(this._unmodified=!1,this._zoom=e,this.scale=this.zoomScale(e),this.tileZoom=Math.floor(e),this.zoomFraction=e-this.tileZoom,this._calcProjMatrix(),this._constrain())},get center(){return this._center},set center(t){t.lat===this._center.lat&&t.lng===this._center.lng||(this._unmodified=!1,this._center=t,this._calcProjMatrix(),this._constrain())},resize:function(t,e){this.width=t,this.height=e,this.pixelsToGLUnits=[2/t,-2/e],this._calcProjMatrix(),this._constrain()},get unmodified(){return this._unmodified},zoomScale:function(t){return Math.pow(2,t)},scaleZoom:function(t){return Math.log(t)/Math.LN2},project:function(t,e){return new o(this.lngX(t.lng,e),this.latY(t.lat,e))},unproject:function(t,e){return new i(this.xLng(t.x,e),this.yLat(t.y,e))},get x(){return this.lngX(this.center.lng)},get y(){return this.latY(this.center.lat)},get point(){return new o(this.x,this.y)},lngX:function(t,e){return(180+t)*(e||this.worldSize)/360},latY:function(t,e){var r=180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360));return(180-r)*(e||this.worldSize)/360},xLng:function(t,e){return 360*t/(e||this.worldSize)-180},yLat:function(t,e){var r=180-360*t/(e||this.worldSize);return 360/Math.PI*Math.atan(Math.exp(r*Math.PI/180))-90},panBy:function(t){var e=this.centerPoint._add(t);this.center=this.pointLocation(e)},setLocationAtPoint:function(t,e){var r=this.locationCoordinate(t),n=this.pointCoordinate(e),i=this.pointCoordinate(this.centerPoint),o=n._sub(r);this._unmodified=!1,this.center=this.coordinateLocation(i._sub(o))},locationPoint:function(t){return this.coordinatePoint(this.locationCoordinate(t))},pointLocation:function(t){return this.coordinateLocation(this.pointCoordinate(t))},locationCoordinate:function(t){var e=this.zoomScale(this.tileZoom)/this.worldSize,r=i.convert(t);return new a(this.lngX(r.lng)*e,this.latY(r.lat)*e,this.tileZoom)},coordinateLocation:function(t){var e=this.zoomScale(t.zoom);return new i(this.xLng(t.column,e),this.yLat(t.row,e))},pointCoordinate:function(t){var e=0,r=this.coordinatePointMatrix(this.tileZoom);if(d.invert(r,r),!r)throw new Error("failed to invert matrix");var n=[t.x,t.y,0,1],i=[t.x,t.y,1,1];f.transformMat4(n,n,r),f.transformMat4(i,i,r);var o=n[3],s=i[3],u=n[0]/o,c=i[0]/s,h=n[1]/o,p=i[1]/s,v=n[2]/o,m=i[2]/s,g=v===m?0:(e-v)/(m-v);return new a(l(u,c,g),l(h,p,g),this.tileZoom)},coordinatePoint:function(t){var e=this.coordinatePointMatrix(t.zoom),r=[t.column,t.row,0,1];return f.transformMat4(r,r,e),new o(r[0]/r[3],r[1]/r[3])},coordinatePointMatrix:function(t){var e=d.copy(new Float64Array(16),this.projMatrix),r=this.worldSize/this.zoomScale(t);return d.scale(e,e,[r,r,1]),d.multiply(e,this.getPixelMatrix(),e),e},getPixelMatrix:function(){var t=d.create();return d.scale(t,t,[this.width/2,-this.height/2,1]),d.translate(t,t,[1,-1,0]),t},calculatePosMatrix:function(t,e){void 0===e&&(e=1/0),t instanceof u&&(t=t.toCoordinate(e));var r=Math.min(t.zoom,e),n=this.worldSize/Math.pow(2,r),i=new Float64Array(16);return d.identity(i),d.translate(i,i,[t.column*n,t.row*n,0]),d.scale(i,i,[n/c,n/c,1]),d.multiply(i,this.projMatrix,i),new Float32Array(i)},_constrain:function(){if(this.center&&this.width&&this.height&&!this._constraining){this._constraining=!0;var t,e,r,n,i,a,s,l,u=this.size,c=this._unmodified;this.latRange&&(t=this.latY(this.latRange[1]),e=this.latY(this.latRange[0]),i=e-t<u.y?u.y/(e-t):0),this.lngRange&&(r=this.lngX(this.lngRange[0]),n=this.lngX(this.lngRange[1]),a=n-r<u.x?u.x/(n-r):0);var h=Math.max(a||0,i||0);if(h)return this.center=this.unproject(new o(a?(n+r)/2:this.x,i?(e+t)/2:this.y)),this.zoom+=this.scaleZoom(h),this._unmodified=c,void(this._constraining=!1);if(this.latRange){var f=this.y,d=u.y/2;t>f-d&&(l=t+d),f+d>e&&(l=e-d)}if(this.lngRange){var p=this.x,v=u.x/2;r>p-v&&(s=r+v),p+v>n&&(s=n-v)}void 0===s&&void 0===l||(this.center=this.unproject(new o(void 0!==s?s:this.x,void 0!==l?l:this.y))),this._unmodified=c,this._constraining=!1}},_calcProjMatrix:function(){var t=new Float64Array(16),e=Math.atan(.5/this.altitude),r=Math.sin(e)*this.altitude/Math.sin(Math.PI/2-this._pitch-e),n=Math.cos(Math.PI/2-this._pitch)*r+this.altitude;d.perspective(t,2*Math.atan(this.height/2/this.altitude),this.width/this.height,.1,n),d.translate(t,t,[0,0,-this.altitude]),d.scale(t,t,[1,-1,1/this.height]),d.rotateX(t,t,this._pitch),d.rotateZ(t,t,this.angle),d.translate(t,t,[-this.x,-this.y,0]),this.projMatrix=t}}},{"../data/bucket":247,"../source/tile_coord":281,"../util/interpolate":343,"../util/util":349,"./coordinate":255,"./lng_lat":256,"gl-matrix":363,"point-geometry":404}],259:[function(t,e,r){"use strict";var n={" ":[16,[]],"!":[10,[5,21,5,7,-1,-1,5,2,4,1,5,0,6,1,5,2]],'"':[16,[4,21,4,14,-1,-1,12,21,12,14]],"#":[21,[11,25,4,-7,-1,-1,17,25,10,-7,-1,-1,4,12,18,12,-1,-1,3,6,17,6]],$:[20,[8,25,8,-4,-1,-1,12,25,12,-4,-1,-1,17,18,15,20,12,21,8,21,5,20,3,18,3,16,4,14,5,13,7,12,13,10,15,9,16,8,17,6,17,3,15,1,12,0,8,0,5,1,3,3]],"%":[24,[21,21,3,0,-1,-1,8,21,10,19,10,17,9,15,7,14,5,14,3,16,3,18,4,20,6,21,8,21,10,20,13,19,16,19,19,20,21,21,-1,-1,17,7,15,6,14,4,14,2,16,0,18,0,20,1,21,3,21,5,19,7,17,7]],"&":[26,[23,12,23,13,22,14,21,14,20,13,19,11,17,6,15,3,13,1,11,0,7,0,5,1,4,2,3,4,3,6,4,8,5,9,12,13,13,14,14,16,14,18,13,20,11,21,9,20,8,18,8,16,9,13,11,10,16,3,18,1,20,0,22,0,23,1,23,2]],"'":[10,[5,19,4,20,5,21,6,20,6,18,5,16,4,15]],"(":[14,[11,25,9,23,7,20,5,16,4,11,4,7,5,2,7,-2,9,-5,11,-7]],")":[14,[3,25,5,23,7,20,9,16,10,11,10,7,9,2,7,-2,5,-5,3,-7]],"*":[16,[8,21,8,9,-1,-1,3,18,13,12,-1,-1,13,18,3,12]],"+":[26,[13,18,13,0,-1,-1,4,9,22,9]],",":[10,[6,1,5,0,4,1,5,2,6,1,6,-1,5,-3,4,-4]],"-":[26,[4,9,22,9]],".":[10,[5,2,4,1,5,0,6,1,5,2]],"/":[22,[20,25,2,-7]],0:[20,[9,21,6,20,4,17,3,12,3,9,4,4,6,1,9,0,11,0,14,1,16,4,17,9,17,12,16,17,14,20,11,21,9,21]],1:[20,[6,17,8,18,11,21,11,0]],2:[20,[4,16,4,17,5,19,6,20,8,21,12,21,14,20,15,19,16,17,16,15,15,13,13,10,3,0,17,0]],3:[20,[5,21,16,21,10,13,13,13,15,12,16,11,17,8,17,6,16,3,14,1,11,0,8,0,5,1,4,2,3,4]],4:[20,[13,21,3,7,18,7,-1,-1,13,21,13,0]],5:[20,[15,21,5,21,4,12,5,13,8,14,11,14,14,13,16,11,17,8,17,6,16,3,14,1,11,0,8,0,5,1,4,2,3,4]],6:[20,[16,18,15,20,12,21,10,21,7,20,5,17,4,12,4,7,5,3,7,1,10,0,11,0,14,1,16,3,17,6,17,7,16,10,14,12,11,13,10,13,7,12,5,10,4,7]],7:[20,[17,21,7,0,-1,-1,3,21,17,21]],8:[20,[8,21,5,20,4,18,4,16,5,14,7,13,11,12,14,11,16,9,17,7,17,4,16,2,15,1,12,0,8,0,5,1,4,2,3,4,3,7,4,9,6,11,9,12,13,13,15,14,16,16,16,18,15,20,12,21,8,21]],9:[20,[16,14,15,11,13,9,10,8,9,8,6,9,4,11,3,14,3,15,4,18,6,20,9,21,10,21,13,20,15,18,16,14,16,9,15,4,13,1,10,0,8,0,5,1,4,3]],":":[10,[5,14,4,13,5,12,6,13,5,14,-1,-1,5,2,4,1,5,0,6,1,5,2]],";":[10,[5,14,4,13,5,12,6,13,5,14,-1,-1,6,1,5,0,4,1,5,2,6,1,6,-1,5,-3,4,-4]],"<":[24,[20,18,4,9,20,0]],"=":[26,[4,12,22,12,-1,-1,4,6,22,6]],">":[24,[4,18,20,9,4,0]],"?":[18,[3,16,3,17,4,19,5,20,7,21,11,21,13,20,14,19,15,17,15,15,14,13,13,12,9,10,9,7,-1,-1,9,2,8,1,9,0,10,1,9,2]],"@":[27,[18,13,17,15,15,16,12,16,10,15,9,14,8,11,8,8,9,6,11,5,14,5,16,6,17,8,-1,-1,12,16,10,14,9,11,9,8,10,6,11,5,-1,-1,18,16,17,8,17,6,19,5,21,5,23,7,24,10,24,12,23,15,22,17,20,19,18,20,15,21,12,21,9,20,7,19,5,17,4,15,3,12,3,9,4,6,5,4,7,2,9,1,12,0,15,0,18,1,20,2,21,3,-1,-1,19,16,18,8,18,6,19,5]],A:[18,[9,21,1,0,-1,-1,9,21,17,0,-1,-1,4,7,14,7]],B:[21,[4,21,4,0,-1,-1,4,21,13,21,16,20,17,19,18,17,18,15,17,13,16,12,13,11,-1,-1,4,11,13,11,16,10,17,9,18,7,18,4,17,2,16,1,13,0,4,0]],C:[21,[18,16,17,18,15,20,13,21,9,21,7,20,5,18,4,16,3,13,3,8,4,5,5,3,7,1,9,0,13,0,15,1,17,3,18,5]],D:[21,[4,21,4,0,-1,-1,4,21,11,21,14,20,16,18,17,16,18,13,18,8,17,5,16,3,14,1,11,0,4,0]],E:[19,[4,21,4,0,-1,-1,4,21,17,21,-1,-1,4,11,12,11,-1,-1,4,0,17,0]],F:[18,[4,21,4,0,-1,-1,4,21,17,21,-1,-1,4,11,12,11]],G:[21,[18,16,17,18,15,20,13,21,9,21,7,20,5,18,4,16,3,13,3,8,4,5,5,3,7,1,9,0,13,0,15,1,17,3,18,5,18,8,-1,-1,13,8,18,8]],H:[22,[4,21,4,0,-1,-1,18,21,18,0,-1,-1,4,11,18,11]],I:[8,[4,21,4,0]],J:[16,[12,21,12,5,11,2,10,1,8,0,6,0,4,1,3,2,2,5,2,7]],K:[21,[4,21,4,0,-1,-1,18,21,4,7,-1,-1,9,12,18,0]],L:[17,[4,21,4,0,-1,-1,4,0,16,0]],M:[24,[4,21,4,0,-1,-1,4,21,12,0,-1,-1,20,21,12,0,-1,-1,20,21,20,0]],N:[22,[4,21,4,0,-1,-1,4,21,18,0,-1,-1,18,21,18,0]],O:[22,[9,21,7,20,5,18,4,16,3,13,3,8,4,5,5,3,7,1,9,0,13,0,15,1,17,3,18,5,19,8,19,13,18,16,17,18,15,20,13,21,9,21]],P:[21,[4,21,4,0,-1,-1,4,21,13,21,16,20,17,19,18,17,18,14,17,12,16,11,13,10,4,10]],Q:[22,[9,21,7,20,5,18,4,16,3,13,3,8,4,5,5,3,7,1,9,0,13,0,15,1,17,3,18,5,19,8,19,13,18,16,17,18,15,20,13,21,9,21,-1,-1,12,4,18,-2]],R:[21,[4,21,4,0,-1,-1,4,21,13,21,16,20,17,19,18,17,18,15,17,13,16,12,13,11,4,11,-1,-1,11,11,18,0]],S:[20,[17,18,15,20,12,21,8,21,5,20,3,18,3,16,4,14,5,13,7,12,13,10,15,9,16,8,17,6,17,3,15,1,12,0,8,0,5,1,3,3]],T:[16,[8,21,8,0,-1,-1,1,21,15,21]],U:[22,[4,21,4,6,5,3,7,1,10,0,12,0,15,1,17,3,18,6,18,21]],V:[18,[1,21,9,0,-1,-1,17,21,9,0]],W:[24,[2,21,7,0,-1,-1,12,21,7,0,-1,-1,12,21,17,0,-1,-1,22,21,17,0]],X:[20,[3,21,17,0,-1,-1,17,21,3,0]],Y:[18,[1,21,9,11,9,0,-1,-1,17,21,9,11]],Z:[20,[17,21,3,0,-1,-1,3,21,17,21,-1,-1,3,0,17,0]],"[":[14,[4,25,4,-7,-1,-1,5,25,5,-7,-1,-1,4,25,11,25,-1,-1,4,-7,11,-7]],"\\":[14,[0,21,14,-3]],"]":[14,[9,25,9,-7,-1,-1,10,25,10,-7,-1,-1,3,25,10,25,-1,-1,3,-7,10,-7]],"^":[16,[6,15,8,18,10,15,-1,-1,3,12,8,17,13,12,-1,-1,8,17,8,0]],_:[16,[0,-2,16,-2]],"`":[10,[6,21,5,20,4,18,4,16,5,15,6,16,5,17]],a:[19,[15,14,15,0,-1,-1,15,11,13,13,11,14,8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3]],b:[19,[4,21,4,0,-1,-1,4,11,6,13,8,14,11,14,13,13,15,11,16,8,16,6,15,3,13,1,11,0,8,0,6,1,4,3]],c:[18,[15,11,13,13,11,14,8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3]],d:[19,[15,21,15,0,-1,-1,15,11,13,13,11,14,8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3]],e:[18,[3,8,15,8,15,10,14,12,13,13,11,14,8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3]],f:[12,[10,21,8,21,6,20,5,17,5,0,-1,-1,2,14,9,14]],g:[19,[15,14,15,-2,14,-5,13,-6,11,-7,8,-7,6,-6,-1,-1,15,11,13,13,11,14,8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3]],h:[19,[4,21,4,0,-1,-1,4,10,7,13,9,14,12,14,14,13,15,10,15,0]],i:[8,[3,21,4,20,5,21,4,22,3,21,-1,-1,4,14,4,0]],j:[10,[5,21,6,20,7,21,6,22,5,21,-1,-1,6,14,6,-3,5,-6,3,-7,1,-7]],k:[17,[4,21,4,0,-1,-1,14,14,4,4,-1,-1,8,8,15,0]],l:[8,[4,21,4,0]],m:[30,[4,14,4,0,-1,-1,4,10,7,13,9,14,12,14,14,13,15,10,15,0,-1,-1,15,10,18,13,20,14,23,14,25,13,26,10,26,0]],n:[19,[4,14,4,0,-1,-1,4,10,7,13,9,14,12,14,14,13,15,10,15,0]],o:[19,[8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3,16,6,16,8,15,11,13,13,11,14,8,14]],p:[19,[4,14,4,-7,-1,-1,4,11,6,13,8,14,11,14,13,13,15,11,16,8,16,6,15,3,13,1,11,0,8,0,6,1,4,3]],q:[19,[15,14,15,-7,-1,-1,15,11,13,13,11,14,8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3]],r:[13,[4,14,4,0,-1,-1,4,8,5,11,7,13,9,14,12,14]],s:[17,[14,11,13,13,10,14,7,14,4,13,3,11,4,9,6,8,11,7,13,6,14,4,14,3,13,1,10,0,7,0,4,1,3,3]],t:[12,[5,21,5,4,6,1,8,0,10,0,-1,-1,2,14,9,14]],u:[19,[4,14,4,4,5,1,7,0,10,0,12,1,15,4,-1,-1,15,14,15,0]],v:[16,[2,14,8,0,-1,-1,14,14,8,0]],w:[22,[3,14,7,0,-1,-1,11,14,7,0,-1,-1,11,14,15,0,-1,-1,19,14,15,0]],x:[17,[3,14,14,0,-1,-1,14,14,3,0]],y:[16,[2,14,8,0,-1,-1,14,14,8,0,6,-4,4,-6,2,-7,1,-7]],z:[17,[14,14,3,0,-1,-1,3,14,14,14,-1,-1,3,0,14,0]],"{":[14,[9,25,7,24,6,23,5,21,5,19,6,17,7,16,8,14,8,12,6,10,-1,-1,7,24,6,22,6,20,7,18,8,17,9,15,9,13,8,11,4,9,8,7,9,5,9,3,8,1,7,0,6,-2,6,-4,7,-6,-1,-1,6,8,8,6,8,4,7,2,6,1,5,-1,5,-3,6,-5,7,-6,9,-7]],"|":[8,[4,25,4,-7]],"}":[14,[5,25,7,24,8,23,9,21,9,19,8,17,7,16,6,14,6,12,8,10,-1,-1,7,24,8,22,8,20,7,18,6,17,5,15,5,13,6,11,10,9,6,7,5,5,5,3,6,1,7,0,8,-2,8,-4,7,-6,-1,-1,8,8,6,6,6,4,7,2,8,1,9,-1,9,-3,8,-5,7,-6,5,-7]],"~":[24,[3,6,3,8,4,11,6,12,8,12,10,11,14,8,16,7,18,7,20,8,21,10,-1,-1,3,8,4,10,6,11,8,11,10,10,14,7,16,6,18,6,20,7,21,10,21,12]]};e.exports=function(t,e,r,i){i=i||1;var o,a,s,l,u,c,h,f,d=[];for(o=0,a=t.length;a>o;o++)if(u=n[t[o]]){for(f=null,s=0,l=u[1].length;l>s;s+=2)-1===u[1][s]&&-1===u[1][s+1]?f=null:(c=e+u[1][s]*i,h=r-u[1][s+1]*i,f&&d.push(f.x,f.y,c,h),f={x:c,y:h});e+=u[0]*i}return d}},{}],260:[function(t,e,r){"use strict";var n=e.exports={};n.Map=t("./ui/map"),n.Control=t("./ui/control/control"),n.Navigation=t("./ui/control/navigation"),n.Geolocate=t("./ui/control/geolocate"),n.Attribution=t("./ui/control/attribution"),n.Popup=t("./ui/popup"),n.GeoJSONSource=t("./source/geojson_source"),n.VideoSource=t("./source/video_source"),n.ImageSource=t("./source/image_source"),n.Style=t("./style/style"),n.LngLat=t("./geo/lng_lat"),n.LngLatBounds=t("./geo/lng_lat_bounds"),n.Point=t("point-geometry"),n.Evented=t("./util/evented"),n.util=t("./util/util"),n.supported=t("./util/browser").supported;var i=t("./util/ajax");n.util.getJSON=i.getJSON,n.util.getArrayBuffer=i.getArrayBuffer;var o=t("./util/config");n.config=o,Object.defineProperty(n,"accessToken",{get:function(){return o.ACCESS_TOKEN},set:function(t){o.ACCESS_TOKEN=t}})},{"./geo/lng_lat":256,"./geo/lng_lat_bounds":257,"./source/geojson_source":274,"./source/image_source":276,"./source/video_source":284,"./style/style":290,"./ui/control/attribution":318,"./ui/control/control":319,"./ui/control/geolocate":320,"./ui/control/navigation":321,"./ui/map":331,"./ui/popup":332,"./util/ajax":334,"./util/browser":335,"./util/config":339,"./util/evented":341,"./util/util":349,"point-geometry":404}],261:[function(t,e,r){"use strict";function n(t,e,r){var n,i=t.gl,l=t.transform,u=a.premultiply(r.paint["background-color"]),c=r.paint["background-pattern"],h=r.paint["background-opacity"],f=c?t.spriteAtlas.getPosition(c.from,!0):null,d=c?t.spriteAtlas.getPosition(c.to,!0):null;if(t.setDepthSublayer(0),f&&d){if(t.isOpaquePass)return;n=t.useProgram("pattern"),i.uniform1i(n.u_image,0),i.uniform2fv(n.u_pattern_tl_a,f.tl),i.uniform2fv(n.u_pattern_br_a,f.br),i.uniform2fv(n.u_pattern_tl_b,d.tl),i.uniform2fv(n.u_pattern_br_b,d.br),i.uniform1f(n.u_opacity,h),i.uniform1f(n.u_mix,c.t),t.spriteAtlas.bind(i,!0),t.tileExtentPatternVAO.bind(i,n,t.tileExtentBuffer)}else{if(t.isOpaquePass!==(1===u[3]))return;n=t.useProgram("fill"),i.uniform4fv(n.u_color,u),i.uniform1f(n.u_opacity,h),t.tileExtentVAO.bind(i,n,t.tileExtentBuffer)}i.disable(i.STENCIL_TEST);for(var p=o.coveringTiles(l),v=0;v<p.length;v++){var m=p[v],g=512;if(f&&d){var y=[f.size[0]*c.fromScale,f.size[1]*c.fromScale],b=[d.size[0]*c.toScale,d.size[1]*c.toScale],x={coord:m,tileSize:g};i.uniform2fv(n.u_patternscale_a,[1/s(x,y[0],t.transform.tileZoom),1/s(x,y[1],t.transform.tileZoom)]),i.uniform2fv(n.u_patternscale_b,[1/s(x,b[0],t.transform.tileZoom),1/s(x,b[1],t.transform.tileZoom)]);var _=g*Math.pow(2,t.transform.tileZoom-m.z),w=_/y[0]%1*(m.x+m.w*Math.pow(2,m.z)),M=_/y[1]%1*m.y,k=_/b[0]%1*(m.x+m.w*Math.pow(2,m.z)),A=_/b[1]%1*m.y;i.uniform2fv(n.u_offset_a,[w,M]),i.uniform2fv(n.u_offset_b,[k,A])}i.uniformMatrix4fv(n.u_matrix,!1,t.transform.calculatePosMatrix(m)),i.drawArrays(i.TRIANGLE_STRIP,0,t.tileExtentBuffer.length)}i.stencilMask(0),i.stencilFunc(i.EQUAL,128,128)}var i=t("../source/tile_pyramid"),o=new i({tileSize:512}),a=t("../util/util"),s=t("../source/pixels_to_tile_units");e.exports=n},{"../source/pixels_to_tile_units":277,"../source/tile_pyramid":282,"../util/util":349}],262:[function(t,e,r){"use strict";function n(t,e,r,n){if(!t.isOpaquePass){var o=t.gl;t.setDepthSublayer(0),t.depthMask(!1),o.disable(o.STENCIL_TEST);for(var a=0;a<n.length;a++){var s=n[a],l=e.getTile(s),u=l.getBucket(r);if(u){var c=u.bufferGroups.circle;if(c){var h=t.useProgram("circle",u.getProgramMacros("circle",r));o.uniform2fv(h.u_extrude_scale,t.transform.pixelsToGLUnits),o.uniform1f(h.u_blur,r.paint["circle-blur"]),o.uniform1f(h.u_devicepixelratio,i.devicePixelRatio),o.uniform1f(h.u_opacity,r.paint["circle-opacity"]),o.uniformMatrix4fv(h.u_matrix,!1,t.translatePosMatrix(s.posMatrix,l,r.paint["circle-translate"],r.paint["circle-translate-anchor"])),u.setUniforms(o,"circle",h,r,{zoom:t.transform.zoom});for(var f=0;f<c.length;f++){var d=c[f];d.vaos[r.id].bind(o,h,d.layout.vertex,d.layout.element,d.paint[r.id]),o.drawElements(o.TRIANGLES,3*d.layout.element.length,o.UNSIGNED_SHORT,0)}}}}}}var i=t("../util/browser");e.exports=n},{"../util/browser":335}],263:[function(t,e,r){"use strict";function n(t,e,r,n){var i=t.gl;i.enable(i.STENCIL_TEST);for(var o=t.useProgram("collisionbox"),a=0;a<n.length;a++){var s=n[a],l=e.getTile(s),u=l.getBucket(r);if(u){var c=u.bufferGroups.collisionBox;if(c&&c.length){var h=c[0];0!==h.layout.vertex.length&&(i.uniformMatrix4fv(o.u_matrix,!1,s.posMatrix),t.enableTileClippingMask(s),t.lineWidth(1),i.uniform1f(o.u_scale,Math.pow(2,t.transform.zoom-l.coord.z)),i.uniform1f(o.u_zoom,10*t.transform.zoom),i.uniform1f(o.u_maxzoom,10*(l.coord.z+1)),h.vaos[r.id].bind(i,o,h.layout.vertex),i.drawArrays(i.LINES,0,h.layout.vertex.length))}}}}e.exports=n},{}],264:[function(t,e,r){"use strict";function n(t,e,r){if(!t.isOpaquePass&&t.options.debug)for(var n=0;n<r.length;n++)i(t,e,r[n])}function i(t,e,r){var n=t.gl;n.disable(n.STENCIL_TEST),t.lineWidth(1*a.devicePixelRatio);var i=r.posMatrix,h=t.useProgram("debug");n.uniformMatrix4fv(h.u_matrix,!1,i),n.uniform4f(h.u_color,1,0,0,1),t.debugVAO.bind(n,h,t.debugBuffer),n.drawArrays(n.LINE_STRIP,0,t.debugBuffer.length);for(var f=o(r.toString(),50,200,5),d=new t.PosArray,p=0;p<f.length;p+=2)d.emplaceBack(f[p],f[p+1]);var v=new u(d.serialize(),t.PosArray.serialize(),u.BufferType.VERTEX),m=new c;m.bind(n,h,v),n.uniform4f(h.u_color,1,1,1,1);for(var g=e.getTile(r).tileSize,y=l/(Math.pow(2,t.transform.zoom-r.z)*g),b=[[-1,-1],[-1,1],[1,-1],[1,1]],x=0;x<b.length;x++){var _=b[x];n.uniformMatrix4fv(h.u_matrix,!1,s.translate([],i,[y*_[0],y*_[1],0])),n.drawArrays(n.LINES,0,v.length)}n.uniform4f(h.u_color,0,0,0,1),n.uniformMatrix4fv(h.u_matrix,!1,i),n.drawArrays(n.LINES,0,v.length)}var o=t("../lib/debugtext"),a=t("../util/browser"),s=t("gl-matrix").mat4,l=t("../data/bucket").EXTENT,u=t("../data/buffer"),c=t("./vertex_array_object");e.exports=n},{"../data/bucket":247,"../data/buffer":252,"../lib/debugtext":259,"../util/browser":335,"./vertex_array_object":273,"gl-matrix":363}],265:[function(t,e,r){"use strict";function n(t,e,r,n){var a=t.gl;a.enable(a.STENCIL_TEST);var l=s.premultiply(r.paint["fill-color"]),u=r.paint["fill-pattern"],c=s.premultiply(r.paint["fill-outline-color"]),h=r.paint["fill-opacity"];if(u?!t.isOpaquePass:t.isOpaquePass===(1===l[3]&&1===h))for(var f=0;f<n.length;f++)i(t,e,r,n[f]);if(!t.isOpaquePass&&r.paint["fill-antialias"])if(c||!r.paint["fill-pattern"]){var d=t.useProgram("outline");t.lineWidth(2),t.depthMask(!1),c?t.setDepthSublayer(2):t.setDepthSublayer(0),a.uniform2f(d.u_world,a.drawingBufferWidth,a.drawingBufferHeight),a.uniform4fv(d.u_color,c?c:l),a.uniform1f(d.u_opacity,h);for(var p=0;p<n.length;p++)o(t,e,r,n[p])}else{var v=t.useProgram("outlinepattern");t.lineWidth(2),t.depthMask(!1),t.setDepthSublayer(0),a.uniform2f(v.u_world,a.drawingBufferWidth,a.drawingBufferHeight);for(var m=0;m<n.length;m++)o(t,e,r,n[m])}}function i(t,e,r,n){var i=e.getTile(n),o=i.getBucket(r);if(o){var l=o.bufferGroups.fill;if(l){var u=t.gl,c=s.premultiply(r.paint["fill-color"]),h=r.paint["fill-pattern"],f=r.paint["fill-opacity"],d=n.posMatrix,p=t.translatePosMatrix(d,i,r.paint["fill-translate"],r.paint["fill-translate-anchor"]);t.setDepthSublayer(1),u.stencilMask(7),u.clear(u.STENCIL_BUFFER_BIT),t.enableTileClippingMask(n),u.stencilOpSeparate(u.FRONT,u.KEEP,u.KEEP,u.INCR_WRAP),u.stencilOpSeparate(u.BACK,u.KEEP,u.KEEP,u.DECR_WRAP),u.colorMask(!1,!1,!1,!1),t.depthMask(!1);var v=t.useProgram("fill");u.uniformMatrix4fv(v.u_matrix,!1,p);for(var m=0;m<l.length;m++){var g=l[m];g.vaos[r.id].bind(u,v,g.layout.vertex,g.layout.element),u.drawElements(u.TRIANGLES,3*g.layout.element.length,u.UNSIGNED_SHORT,0)}u.colorMask(!0,!0,!0,!0),t.depthMask(!0),u.stencilOp(u.KEEP,u.KEEP,u.KEEP),u.stencilMask(0);var y;h?(y=t.useProgram("pattern"),a(h,f,i,n,t,y),u.activeTexture(u.TEXTURE0),t.spriteAtlas.bind(u,!0),t.tileExtentPatternVAO.bind(u,y,t.tileExtentBuffer)):(y=t.useProgram("fill"),u.uniform4fv(v.u_color,c),u.uniform1f(v.u_opacity,f),t.tileExtentVAO.bind(u,y,t.tileExtentBuffer)),u.uniformMatrix4fv(y.u_matrix,!1,d),u.stencilFunc(u.NOTEQUAL,0,7),u.drawArrays(u.TRIANGLE_STRIP,0,t.tileExtentBuffer.length),u.stencilMask(0)}}}function o(t,e,r,n){var i=e.getTile(n),o=i.getBucket(r);if(o){var s=t.gl,l=o.bufferGroups.fill,u=r.paint["fill-pattern"],c=r.paint["fill-opacity"],h=u?t.useProgram("outlinepattern"):t.useProgram("outline");s.uniformMatrix4fv(h.u_matrix,!1,t.translatePosMatrix(n.posMatrix,i,r.paint["fill-translate"],r.paint["fill-translate-anchor"])),u&&a(u,c,i,n,t,h),t.enableTileClippingMask(n);for(var f=0;f<l.length;f++){var d=l[f];d.secondVaos[r.id].bind(s,h,d.layout.vertex,d.layout.element2),s.drawElements(s.LINES,2*d.layout.element2.length,s.UNSIGNED_SHORT,0)}}}function a(t,e,r,n,i,o){var a=i.gl,s=i.spriteAtlas.getPosition(t.from,!0),u=i.spriteAtlas.getPosition(t.to,!0);if(s&&u){a.uniform1i(o.u_image,0),a.uniform2fv(o.u_pattern_tl_a,s.tl),a.uniform2fv(o.u_pattern_br_a,s.br),a.uniform2fv(o.u_pattern_tl_b,u.tl),a.uniform2fv(o.u_pattern_br_b,u.br),a.uniform1f(o.u_opacity,e),a.uniform1f(o.u_mix,t.t);var c=[s.size[0]*t.fromScale,s.size[1]*t.fromScale],h=[u.size[0]*t.toScale,u.size[1]*t.toScale];a.uniform2fv(o.u_patternscale_a,[1/l(r,c[0],i.transform.tileZoom),1/l(r,c[1],i.transform.tileZoom)]),a.uniform2fv(o.u_patternscale_b,[1/l(r,h[0],i.transform.tileZoom),1/l(r,h[1],i.transform.tileZoom)]);var f=r.tileSize*Math.pow(2,i.transform.tileZoom-r.coord.z),d=f/c[0]%1*(r.coord.x+n.w*Math.pow(2,r.coord.z)),p=f/c[1]%1*r.coord.y,v=f/h[0]%1*(r.coord.x+n.w*Math.pow(2,r.coord.z)),m=f/h[1]%1*r.coord.y;a.uniform2fv(o.u_offset_a,[d,p]),a.uniform2fv(o.u_offset_b,[v,m]),a.activeTexture(a.TEXTURE0),i.spriteAtlas.bind(a,!0)}}var s=t("../util/util"),l=t("../source/pixels_to_tile_units");e.exports=n},{
"../source/pixels_to_tile_units":277,"../util/util":349}],266:[function(t,e,r){"use strict";var n=t("../util/browser"),i=t("gl-matrix").mat2,o=t("../util/util"),a=t("../source/pixels_to_tile_units");e.exports=function(t,e,r,s){if(!t.isOpaquePass){t.setDepthSublayer(0),t.depthMask(!1);var l=t.gl;if(l.enable(l.STENCIL_TEST),!(r.paint["line-width"]<=0)){var u=1/n.devicePixelRatio,c=r.paint["line-blur"]+u,h=r.paint["line-width"]/2,f=-1,d=0,p=0;r.paint["line-gap-width"]>0&&(f=r.paint["line-gap-width"]/2+.5*u,h=r.paint["line-width"],d=f-u/2);var v=d+h+u/2+p,m=o.premultiply(r.paint["line-color"]),g=t.transform,y=i.create();i.scale(y,y,[1,Math.cos(g._pitch)]),i.rotate(y,y,t.transform.angle);var b,x,_,w,M,k=Math.sqrt(g.height*g.height/4*(1+g.altitude*g.altitude)),A=g.height/2*Math.tan(g._pitch),T=(k+A)/k-1,E=r.paint["line-dasharray"],S=r.paint["line-pattern"];if(E)b=t.useProgram("linesdfpattern"),l.uniform2fv(b.u_linewidth,[v,f]),l.uniform1f(b.u_blur,c),l.uniform4fv(b.u_color,m),l.uniform1f(b.u_opacity,r.paint["line-opacity"]),x=t.lineAtlas.getDash(E.from,"round"===r.layout["line-cap"]),_=t.lineAtlas.getDash(E.to,"round"===r.layout["line-cap"]),l.uniform1i(b.u_image,0),l.activeTexture(l.TEXTURE0),t.lineAtlas.bind(l),l.uniform1f(b.u_tex_y_a,x.y),l.uniform1f(b.u_tex_y_b,_.y),l.uniform1f(b.u_mix,E.t),l.uniform1f(b.u_extra,T),l.uniform1f(b.u_offset,-r.paint["line-offset"]),l.uniformMatrix2fv(b.u_antialiasingmatrix,!1,y);else if(S){if(w=t.spriteAtlas.getPosition(S.from,!0),M=t.spriteAtlas.getPosition(S.to,!0),!w||!M)return;b=t.useProgram("linepattern"),l.uniform1i(b.u_image,0),l.activeTexture(l.TEXTURE0),t.spriteAtlas.bind(l,!0),l.uniform2fv(b.u_linewidth,[v,f]),l.uniform1f(b.u_blur,c),l.uniform2fv(b.u_pattern_tl_a,w.tl),l.uniform2fv(b.u_pattern_br_a,w.br),l.uniform2fv(b.u_pattern_tl_b,M.tl),l.uniform2fv(b.u_pattern_br_b,M.br),l.uniform1f(b.u_fade,S.t),l.uniform1f(b.u_opacity,r.paint["line-opacity"]),l.uniform1f(b.u_extra,T),l.uniform1f(b.u_offset,-r.paint["line-offset"]),l.uniformMatrix2fv(b.u_antialiasingmatrix,!1,y)}else b=t.useProgram("line"),l.uniform2fv(b.u_linewidth,[v,f]),l.uniform1f(b.u_blur,c),l.uniform1f(b.u_extra,T),l.uniform1f(b.u_offset,-r.paint["line-offset"]),l.uniformMatrix2fv(b.u_antialiasingmatrix,!1,y),l.uniform4fv(b.u_color,m),l.uniform1f(b.u_opacity,r.paint["line-opacity"]);for(var L=0;L<s.length;L++){var z=s[L],I=e.getTile(z),P=I.getBucket(r);if(P){var C=P.bufferGroups.line;if(C){t.enableTileClippingMask(z);var R=t.translatePosMatrix(z.posMatrix,I,r.paint["line-translate"],r.paint["line-translate-anchor"]);l.uniformMatrix4fv(b.u_matrix,!1,R);var D=1/a(I,1,t.transform.zoom);if(E){var O=x.width*E.fromScale,F=_.width*E.toScale,j=[1/a(I,O,t.transform.tileZoom),-x.height/2],N=[1/a(I,F,t.transform.tileZoom),-_.height/2],B=t.lineAtlas.width/(256*Math.min(O,F)*n.devicePixelRatio)/2;l.uniform1f(b.u_ratio,D),l.uniform2fv(b.u_patternscale_a,j),l.uniform2fv(b.u_patternscale_b,N),l.uniform1f(b.u_sdfgamma,B)}else S?(l.uniform1f(b.u_ratio,D),l.uniform2fv(b.u_pattern_size_a,[a(I,w.size[0]*S.fromScale,t.transform.tileZoom),M.size[1]]),l.uniform2fv(b.u_pattern_size_b,[a(I,M.size[0]*S.toScale,t.transform.tileZoom),M.size[1]])):l.uniform1f(b.u_ratio,D);for(var U=0;U<C.length;U++){var V=C[U];V.vaos[r.id].bind(l,b,V.layout.vertex,V.layout.element),l.drawElements(l.TRIANGLES,3*V.layout.element.length,l.UNSIGNED_SHORT,0)}}}}}}}},{"../source/pixels_to_tile_units":277,"../util/browser":335,"../util/util":349,"gl-matrix":363}],267:[function(t,e,r){"use strict";function n(t,e,r,n){if(!t.isOpaquePass){var o=t.gl;o.enable(o.DEPTH_TEST),t.depthMask(!0),o.depthFunc(o.LESS);for(var a=n.length&&n[0].z,s=0;s<n.length;s++){var l=n[s];t.setDepthSublayer(l.z-a),i(t,e,r,l)}o.depthFunc(o.LEQUAL)}}function i(t,e,r,n){var i=t.gl;i.disable(i.STENCIL_TEST);var u=e.getTile(n),c=t.transform.calculatePosMatrix(n,e.maxzoom),h=t.useProgram("raster");i.uniformMatrix4fv(h.u_matrix,!1,c),i.uniform1f(h.u_brightness_low,r.paint["raster-brightness-min"]),i.uniform1f(h.u_brightness_high,r.paint["raster-brightness-max"]),i.uniform1f(h.u_saturation_factor,s(r.paint["raster-saturation"])),i.uniform1f(h.u_contrast_factor,a(r.paint["raster-contrast"])),i.uniform3fv(h.u_spin_weights,o(r.paint["raster-hue-rotate"]));var f,d,p=u.source&&u.source._pyramid.findLoadedParent(n,0,{}),v=l(u,p,r,t.transform);i.activeTexture(i.TEXTURE0),i.bindTexture(i.TEXTURE_2D,u.texture),p?(i.activeTexture(i.TEXTURE1),i.bindTexture(i.TEXTURE_2D,p.texture),f=Math.pow(2,p.coord.z-u.coord.z),d=[u.coord.x*f%1,u.coord.y*f%1]):v[1]=0,i.uniform2fv(h.u_tl_parent,d||[0,0]),i.uniform1f(h.u_scale_parent,f||1),i.uniform1f(h.u_buffer_scale,1),i.uniform1f(h.u_opacity0,v[0]),i.uniform1f(h.u_opacity1,v[1]),i.uniform1i(h.u_image0,0),i.uniform1i(h.u_image1,1);var m=u.boundsBuffer||t.rasterBoundsBuffer,g=u.boundsVAO||t.rasterBoundsVAO;g.bind(i,h,m),i.drawArrays(i.TRIANGLE_STRIP,0,m.length)}function o(t){t*=Math.PI/180;var e=Math.sin(t),r=Math.cos(t);return[(2*r+1)/3,(-Math.sqrt(3)*e-r+1)/3,(Math.sqrt(3)*e-r+1)/3]}function a(t){return t>0?1/(1-t):1+t}function s(t){return t>0?1-1/(1.001-t):-t}function l(t,e,r,n){var i=[1,0],o=r.paint["raster-fade-duration"];if(t.source&&o>0){var a=(new Date).getTime(),s=(a-t.timeAdded)/o,l=e?(a-e.timeAdded)/o:-1,c=t.source._pyramid.coveringZoomLevel(n),h=e?Math.abs(e.coord.z-c)>Math.abs(t.coord.z-c):!1;!e||h?(i[0]=u.clamp(s,0,1),i[1]=1-i[0]):(i[0]=u.clamp(1-l,0,1),i[1]=1-i[0])}var f=r.paint["raster-opacity"];return i[0]*=f,i[1]*=f,i}var u=t("../util/util"),c=t("../util/struct_array");e.exports=n,n.RasterBoundsArray=new c({members:[{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]})},{"../util/struct_array":347,"../util/util":349}],268:[function(t,e,r){"use strict";function n(t,e,r,n){if(!t.isOpaquePass){var o=!(r.layout["text-allow-overlap"]||r.layout["icon-allow-overlap"]||r.layout["text-ignore-placement"]||r.layout["icon-ignore-placement"]),a=t.gl;o?a.disable(a.STENCIL_TEST):a.enable(a.STENCIL_TEST),t.setDepthSublayer(0),t.depthMask(!1),a.disable(a.DEPTH_TEST),i(t,e,r,n,!1,r.paint["icon-translate"],r.paint["icon-translate-anchor"],r.layout["icon-rotation-alignment"],r.layout["icon-size"],r.paint["icon-halo-width"],r.paint["icon-halo-color"],r.paint["icon-halo-blur"],r.paint["icon-opacity"],r.paint["icon-color"]),i(t,e,r,n,!0,r.paint["text-translate"],r.paint["text-translate-anchor"],r.layout["text-rotation-alignment"],r.layout["text-size"],r.paint["text-halo-width"],r.paint["text-halo-color"],r.paint["text-halo-blur"],r.paint["text-opacity"],r.paint["text-color"]),a.enable(a.DEPTH_TEST),s(t,e,r,n)}}function i(t,e,r,n,i,a,s,u,c,h,f,d,p,v){f=l.premultiply(f),v=l.premultiply(v);for(var m=0;m<n.length;m++){var g=e.getTile(n[m]),y=g.getBucket(r);if(y){var b=y.bufferGroups,x=i?b.glyph:b.icon;x.length&&(t.enableTileClippingMask(n[m]),o(t,r,n[m].posMatrix,g,y,x,i,i||y.sdfIcons,!i&&y.iconsNeedLinear,i?y.adjustedTextSize:y.adjustedIconSize,y.fontstack,a,s,u,c,h,f,d,p,v))}}}function o(t,e,r,n,i,o,s,l,c,h,f,d,p,v,m,g,y,b,x,_){var w,M,k,A=t.gl,T=t.transform,E="map"===v,S=s?24:1,L=m/S;E?(M=u(n,1,t.transform.zoom)*L,k=1/Math.cos(T._pitch),w=[M,M]):(M=t.transform.altitude*L,k=1,w=[T.pixelsToGLUnits[0]*M,T.pixelsToGLUnits[1]*M]);var z=Math.sqrt(T.height*T.height/4*(1+T.altitude*T.altitude)),I=T.height/2*Math.tan(T._pitch),P=(z+I)/z-1;if(s||t.style.sprite.loaded()){var C=t.useProgram(l?"sdf":"icon");if(A.uniformMatrix4fv(C.u_matrix,!1,t.translatePosMatrix(r,n,d,p)),A.uniform1i(C.u_skewed,E),A.uniform1f(C.u_extra,P),A.uniform2fv(C.u_extrude_scale,w),A.activeTexture(A.TEXTURE0),A.uniform1i(C.u_texture,0),s){var R=f&&t.glyphSource.getGlyphAtlas(f);if(!R)return;R.updateTexture(A),A.uniform2f(C.u_texsize,R.width/4,R.height/4)}else{var D=t.options.rotating||t.options.zooming,O=1!==L||a.devicePixelRatio!==t.spriteAtlas.pixelRatio||c,F=E||t.transform.pitch;t.spriteAtlas.bind(A,l||D||O||F),A.uniform2f(C.u_texsize,t.spriteAtlas.width/4,t.spriteAtlas.height/4)}var j=Math.log(m/h)/Math.LN2||0;A.uniform1f(C.u_zoom,10*(t.transform.zoom-j)),A.activeTexture(A.TEXTURE1),t.frameHistory.bind(A),A.uniform1i(C.u_fadetexture,1);var N;if(l){var B=8,U=1.19,V=6,q=.105*S/m/a.devicePixelRatio;if(g){A.uniform1f(C.u_gamma,(b*U/L/B+q)*k),A.uniform4fv(C.u_color,y),A.uniform1f(C.u_opacity,x),A.uniform1f(C.u_buffer,(V-g/L)/B);for(var G=0;G<o.length;G++)N=o[G],N.vaos[e.id].bind(A,C,N.layout.vertex,N.layout.element),A.drawElements(A.TRIANGLES,3*N.layout.element.length,A.UNSIGNED_SHORT,0)}A.uniform1f(C.u_gamma,q*k),A.uniform4fv(C.u_color,_),A.uniform1f(C.u_opacity,x),A.uniform1f(C.u_buffer,.75);for(var H=0;H<o.length;H++)N=o[H],N.vaos[e.id].bind(A,C,N.layout.vertex,N.layout.element),A.drawElements(A.TRIANGLES,3*N.layout.element.length,A.UNSIGNED_SHORT,0)}else{A.uniform1f(C.u_opacity,x);for(var X=0;X<o.length;X++)N=o[X],N.vaos[e.id].bind(A,C,N.layout.vertex,N.layout.element),A.drawElements(A.TRIANGLES,3*N.layout.element.length,A.UNSIGNED_SHORT,0)}}}var a=t("../util/browser"),s=t("./draw_collision_debug"),l=t("../util/util"),u=t("../source/pixels_to_tile_units");e.exports=n},{"../source/pixels_to_tile_units":277,"../util/browser":335,"../util/util":349,"./draw_collision_debug":263}],269:[function(t,e,r){"use strict";function n(){this.changeTimes=new Float64Array(256),this.changeOpacities=new Uint8Array(256),this.opacities=new Uint8ClampedArray(256),this.array=new Uint8Array(this.opacities.buffer),this.fadeDuration=300,this.previousZoom=0,this.firstFrame=!0}e.exports=n,n.prototype.record=function(t){var e=Date.now();this.firstFrame&&(e=0,this.firstFrame=!1),t=Math.floor(10*t);var r;if(t<this.previousZoom)for(r=t+1;r<=this.previousZoom;r++)this.changeTimes[r]=e,this.changeOpacities[r]=this.opacities[r];else for(r=t;r>this.previousZoom;r--)this.changeTimes[r]=e,this.changeOpacities[r]=this.opacities[r];for(r=0;256>r;r++){var n=e-this.changeTimes[r],i=n/this.fadeDuration*255;t>=r?this.opacities[r]=this.changeOpacities[r]+i:this.opacities[r]=this.changeOpacities[r]-i}this.changed=!0,this.previousZoom=t},n.prototype.bind=function(t){this.texture?(t.bindTexture(t.TEXTURE_2D,this.texture),this.changed&&(t.texSubImage2D(t.TEXTURE_2D,0,0,0,256,1,t.ALPHA,t.UNSIGNED_BYTE,this.array),this.changed=!1)):(this.texture=t.createTexture(),t.bindTexture(t.TEXTURE_2D,this.texture),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST),t.texImage2D(t.TEXTURE_2D,0,t.ALPHA,256,1,0,t.ALPHA,t.UNSIGNED_BYTE,this.array))}},{}],270:[function(t,e,r){"use strict";function n(t,e){this.width=t,this.height=e,this.nextRow=0,this.bytes=4,this.data=new Uint8Array(this.width*this.height*this.bytes),this.positions={}}e.exports=n,n.prototype.setSprite=function(t){this.sprite=t},n.prototype.getDash=function(t,e){var r=t.join(",")+e;return this.positions[r]||(this.positions[r]=this.addDash(t,e)),this.positions[r]},n.prototype.addDash=function(t,e){var r=e?7:0,n=2*r+1,i=128;if(this.nextRow+n>this.height)return console.warn("LineAtlas out of space"),null;for(var o=0,a=0;a<t.length;a++)o+=t[a];for(var s=this.width/o,l=s/2,u=t.length%2===1,c=-r;r>=c;c++)for(var h=this.nextRow+r+c,f=this.width*h,d=u?-t[t.length-1]:0,p=t[0],v=1,m=0;m<this.width;m++){for(;m/s>p;)d=p,p+=t[v],u&&v===t.length-1&&(p+=t[0]),v++;var g,y=Math.abs(m-d*s),b=Math.abs(m-p*s),x=Math.min(y,b),_=v%2===1;if(e){var w=r?c/r*(l+1):0;if(_){var M=l-Math.abs(w);g=Math.sqrt(x*x+M*M)}else g=l-Math.sqrt(x*x+w*w)}else g=(_?1:-1)*x;this.data[3+4*(f+m)]=Math.max(0,Math.min(255,g+i))}var k={y:(this.nextRow+r+.5)/this.height,height:2*r/this.height,width:o};return this.nextRow+=n,this.dirty=!0,k},n.prototype.bind=function(t){this.texture?(t.bindTexture(t.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,t.texSubImage2D(t.TEXTURE_2D,0,0,0,this.width,this.height,t.RGBA,t.UNSIGNED_BYTE,this.data))):(this.texture=t.createTexture(),t.bindTexture(t.TEXTURE_2D,this.texture),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.REPEAT),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.REPEAT),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,this.width,this.height,0,t.RGBA,t.UNSIGNED_BYTE,this.data))}},{}],271:[function(t,e,r){"use strict";function n(t,e){this.gl=t,this.transform=e,this.reusableTextures={},this.preFbos={},this.frameHistory=new a,this.setup(),this.numSublayers=s.maxUnderzooming+s.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.lineWidthRange=t.getParameter(t.ALIASED_LINE_WIDTH_RANGE)}var i=t("../util/browser"),o=t("gl-matrix").mat4,a=t("./frame_history"),s=t("../source/tile_pyramid"),l=t("../data/bucket").EXTENT,u=t("../source/pixels_to_tile_units"),c=t("../util/util"),h=t("../util/struct_array"),f=t("../data/buffer"),d=t("./vertex_array_object"),p=t("./draw_raster").RasterBoundsArray;e.exports=n,c.extend(n.prototype,t("./painter/use_program")),n.prototype.resize=function(t,e){var r=this.gl;this.width=t*i.devicePixelRatio,this.height=e*i.devicePixelRatio,r.viewport(0,0,this.width,this.height)},n.prototype.setup=function(){var t=this.gl;t.verbose=!0,t.enable(t.BLEND),t.blendFunc(t.ONE,t.ONE_MINUS_SRC_ALPHA),t.enable(t.STENCIL_TEST),t.enable(t.DEPTH_TEST),t.depthFunc(t.LEQUAL),this._depthMask=!1,t.depthMask(!1);var e=this.PosArray=new h({members:[{name:"a_pos",type:"Int16",components:2}]}),r=new e;r.emplaceBack(0,0),r.emplaceBack(l,0),r.emplaceBack(0,l),r.emplaceBack(l,l),this.tileExtentBuffer=new f(r.serialize(),e.serialize(),f.BufferType.VERTEX),this.tileExtentVAO=new d,this.tileExtentPatternVAO=new d;var n=new e;n.emplaceBack(0,0),n.emplaceBack(l,0),n.emplaceBack(l,l),n.emplaceBack(0,l),n.emplaceBack(0,0),this.debugBuffer=new f(n.serialize(),e.serialize(),f.BufferType.VERTEX),this.debugVAO=new d;var i=new p;i.emplaceBack(0,0,0,0),i.emplaceBack(l,0,32767,0),i.emplaceBack(0,l,0,32767),i.emplaceBack(l,l,32767,32767),this.rasterBoundsBuffer=new f(i.serialize(),p.serialize(),f.BufferType.VERTEX),this.rasterBoundsVAO=new d},n.prototype.clearColor=function(){var t=this.gl;t.clearColor(0,0,0,0),t.clear(t.COLOR_BUFFER_BIT)},n.prototype.clearStencil=function(){var t=this.gl;t.clearStencil(0),t.stencilMask(255),t.clear(t.STENCIL_BUFFER_BIT)},n.prototype.clearDepth=function(){var t=this.gl;t.clearDepth(1),this.depthMask(!0),t.clear(t.DEPTH_BUFFER_BIT)},n.prototype._renderTileClippingMasks=function(t){var e=this.gl;e.colorMask(!1,!1,!1,!1),this.depthMask(!1),e.disable(e.DEPTH_TEST),e.enable(e.STENCIL_TEST),e.stencilMask(248),e.stencilOp(e.KEEP,e.KEEP,e.REPLACE);var r=1;this._tileClippingMaskIDs={};for(var n=0;n<t.length;n++){var i=t[n],o=this._tileClippingMaskIDs[i.id]=r++<<3;e.stencilFunc(e.ALWAYS,o,248);var a=this.useProgram("fill");e.uniformMatrix4fv(a.u_matrix,!1,i.posMatrix),this.tileExtentVAO.bind(e,a,this.tileExtentBuffer),e.drawArrays(e.TRIANGLE_STRIP,0,this.tileExtentBuffer.length)}e.stencilMask(0),e.colorMask(!0,!0,!0,!0),this.depthMask(!0),e.enable(e.DEPTH_TEST)},n.prototype.enableTileClippingMask=function(t){var e=this.gl;e.stencilFunc(e.EQUAL,this._tileClippingMaskIDs[t.id],248)},n.prototype.prepareBuffers=function(){},n.prototype.bindDefaultFramebuffer=function(){var t=this.gl;t.bindFramebuffer(t.FRAMEBUFFER,null)};var v={symbol:t("./draw_symbol"),circle:t("./draw_circle"),line:t("./draw_line"),fill:t("./draw_fill"),raster:t("./draw_raster"),background:t("./draw_background"),debug:t("./draw_debug")};n.prototype.render=function(t,e){this.style=t,this.options=e,this.lineAtlas=t.lineAtlas,this.spriteAtlas=t.spriteAtlas,this.spriteAtlas.setSprite(t.sprite),this.glyphSource=t.glyphSource,this.frameHistory.record(this.transform.zoom),this.prepareBuffers(),this.clearColor(),this.clearDepth(),this.showOverdrawInspector(e.showOverdrawInspector),this.depthRange=(t._order.length+2)*this.numSublayers*this.depthEpsilon,this.renderPass({isOpaquePass:!0}),this.renderPass({isOpaquePass:!1})},n.prototype.renderPass=function(t){var e=this.style._groups,r=t.isOpaquePass;this.currentLayer=r?this.style._order.length:-1;for(var n=0;n<e.length;n++){var i,o=e[r?e.length-1-n:n],a=this.style.sources[o.source],s=[];if(a){for(s=a.getVisibleCoordinates(),i=0;i<s.length;i++)s[i].posMatrix=this.transform.calculatePosMatrix(s[i],a.maxzoom);this.clearStencil(),a.prepare&&a.prepare(),a.isTileClipped&&this._renderTileClippingMasks(s)}for(r?(this._showOverdrawInspector||this.gl.disable(this.gl.BLEND),this.isOpaquePass=!0):(this.gl.enable(this.gl.BLEND),this.isOpaquePass=!1,s.reverse()),i=0;i<o.length;i++){var l=o[r?o.length-1-i:i];this.currentLayer+=r?-1:1,this.renderLayer(this,a,l,s)}a&&v.debug(this,a,s)}},n.prototype.depthMask=function(t){t!==this._depthMask&&(this._depthMask=t,this.gl.depthMask(t))},n.prototype.renderLayer=function(t,e,r,n){r.isHidden(this.transform.zoom)||("background"===r.type||n.length)&&(this.id=r.id,v[r.type](t,e,r,n))},n.prototype.setDepthSublayer=function(t){var e=1-((1+this.currentLayer)*this.numSublayers+t)*this.depthEpsilon,r=e-1+this.depthRange;this.gl.depthRange(r,e)},n.prototype.translatePosMatrix=function(t,e,r,n){if(!r[0]&&!r[1])return t;if("viewport"===n){var i=Math.sin(-this.transform.angle),a=Math.cos(-this.transform.angle);r=[r[0]*a-r[1]*i,r[0]*i+r[1]*a]}var s=[u(e,r[0],this.transform.zoom),u(e,r[1],this.transform.zoom),0],l=new Float32Array(16);return o.translate(l,t,s),l},n.prototype.saveTexture=function(t){var e=this.reusableTextures[t.size];e?e.push(t):this.reusableTextures[t.size]=[t]},n.prototype.getTexture=function(t){var e=this.reusableTextures[t];return e&&e.length>0?e.pop():null},n.prototype.lineWidth=function(t){this.gl.lineWidth(c.clamp(t,this.lineWidthRange[0],this.lineWidthRange[1]))},n.prototype.showOverdrawInspector=function(t){if(t||this._showOverdrawInspector){this._showOverdrawInspector=t;var e=this.gl;if(t){e.blendFunc(e.CONSTANT_COLOR,e.ONE);var r=8,n=1/r;e.blendColor(n,n,n,0),e.clearColor(0,0,0,1),e.clear(e.COLOR_BUFFER_BIT)}else e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA)}}},{"../data/bucket":247,"../data/buffer":252,"../source/pixels_to_tile_units":277,"../source/tile_pyramid":282,"../util/browser":335,"../util/struct_array":347,"../util/util":349,"./draw_background":261,"./draw_circle":262,"./draw_debug":264,"./draw_fill":265,"./draw_line":266,"./draw_raster":267,"./draw_symbol":268,"./frame_history":269,"./painter/use_program":272,"./vertex_array_object":273,"gl-matrix":363}],272:[function(t,e,r){"use strict";var n=(t("path"),t("assert")),i=t("../../util/util"),o={debug:{fragmentSource:"precision mediump float;\n\nuniform lowp vec4 u_color;\n\nvoid main() {\n    gl_FragColor = u_color;\n}\n",vertexSource:"precision highp float;\n\nattribute vec2 a_pos;\n\nuniform mat4 u_matrix;\n\nvoid main() {\n    gl_Position = u_matrix * vec4(a_pos, step(32767.0, a_pos.x), 1);\n}\n"},fill:{fragmentSource:"precision mediump float;\n\nuniform lowp vec4 u_color;\nuniform lowp float u_opacity;\n\nvoid main() {\n    gl_FragColor = u_color * u_opacity;\n\n#ifdef OVERDRAW_INSPECTOR\n    gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"precision highp float;\n\nattribute vec2 a_pos;\nuniform mat4 u_matrix;\n\nvoid main() {\n    gl_Position = u_matrix * vec4(a_pos, 0, 1);\n}\n"},circle:{fragmentSource:"precision mediump float;\n\nuniform lowp float u_blur;\nuniform lowp float u_opacity;\n\nvarying lowp vec4 v_color;\nvarying vec2 v_extrude;\nvarying lowp float v_antialiasblur;\n\nvoid main() {\n    float t = smoothstep(1.0 - max(u_blur, v_antialiasblur), 1.0, length(v_extrude));\n    gl_FragColor = v_color * (1.0 - t) * u_opacity;\n\n#ifdef OVERDRAW_INSPECTOR\n    gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"precision highp float;\n\nuniform mat4 u_matrix;\nuniform vec2 u_extrude_scale;\nuniform float u_devicepixelratio;\n\nattribute vec2 a_pos;\n\n#ifdef ATTRIBUTE_A_COLOR\nattribute lowp vec4 a_color;\n#elif defined ATTRIBUTE_ZOOM_FUNCTION_A_COLOR0\nuniform lowp float u_color_t;\nattribute lowp vec4 a_color0;\nattribute lowp vec4 a_color1;\nattribute lowp vec4 a_color2;\nattribute lowp vec4 a_color3;\n#else\nuniform lowp vec4 a_color;\n#endif\n\n#ifdef ATTRIBUTE_A_RADIUS\nattribute mediump float a_radius;\n#elif defined ATTRIBUTE_ZOOM_FUNCTION_A_RADIUS\nuniform lowp float u_radius_t;\nattribute mediump vec4 a_radius;\n#else\nuniform mediump float a_radius;\n#endif\n\nvarying vec2 v_extrude;\nvarying lowp vec4 v_color;\nvarying lowp float v_antialiasblur;\n\nfloat evaluate_zoom_function_1(const vec4 values, const float t) {\n    if (t < 1.0) {\n        return mix(values[0], values[1], t);\n    } else if (t < 2.0) {\n        return mix(values[1], values[2], t - 1.0);\n    } else {\n        return mix(values[2], values[3], t - 2.0);\n    }\n}\n\nvec4 evaluate_zoom_function_4(const vec4 value0, const vec4 value1, const vec4 value2, const vec4 value3, const float t) {\n    if (t < 1.0) {\n        return mix(value0, value1, t);\n    } else if (t < 2.0) {\n        return mix(value1, value2, t - 1.0);\n    } else {\n        return mix(value2, value3, t - 2.0);\n    }\n}\n\nvoid main(void) {\n\n#ifdef ATTRIBUTE_A_RADIUS\n    mediump float radius = a_radius / 10.0;\n#elif defined ATTRIBUTE_ZOOM_FUNCTION_A_RADIUS\n    mediump float radius = evaluate_zoom_function_1(a_radius, u_radius_t) / 10.0;\n#else\n    mediump float radius = a_radius;\n#endif\n\n    // unencode the extrusion vector that we snuck into the a_pos vector\n    v_extrude = vec2(mod(a_pos, 2.0) * 2.0 - 1.0);\n\n    vec2 extrude = v_extrude * radius * u_extrude_scale;\n    // multiply a_pos by 0.5, since we had it * 2 in order to sneak\n    // in extrusion data\n    gl_Position = u_matrix * vec4(floor(a_pos * 0.5), 0, 1);\n\n    // gl_Position is divided by gl_Position.w after this shader runs.\n    // Multiply the extrude by it so that it isn't affected by it.\n    gl_Position.xy += extrude * gl_Position.w;\n\n#ifdef ATTRIBUTE_A_COLOR\n    v_color = a_color / 255.0;\n#elif defined ATTRIBUTE_ZOOM_FUNCTION_A_COLOR0\n    v_color = evaluate_zoom_function_4(a_color0, a_color1, a_color2, a_color3, u_color_t) / 255.0;\n#else\n    v_color = a_color;\n#endif\n\n    // This is a minimum blur distance that serves as a faux-antialiasing for\n    // the circle. since blur is a ratio of the circle's size and the intent is\n    // to keep the blur at roughly 1px, the two are inversely related.\n    v_antialiasblur = 1.0 / u_devicepixelratio / radius;\n}\n"},line:{fragmentSource:"precision mediump float;\n\nuniform vec2 u_linewidth;\nuniform lowp vec4 u_color;\nuniform lowp float u_opacity;\nuniform float u_blur;\n\nvarying vec2 v_normal;\nvarying float v_linesofar;\nvarying float v_gamma_scale;\n\nvoid main() {\n    // Calculate the distance of the pixel from the line in pixels.\n    float dist = length(v_normal) * u_linewidth.s;\n\n    // Calculate the antialiasing fade factor. This is either when fading in\n    // the line in case of an offset line (v_linewidth.t) or when fading out\n    // (v_linewidth.s)\n    float blur = u_blur * v_gamma_scale;\n    float alpha = clamp(min(dist - (u_linewidth.t - blur), u_linewidth.s - dist) / blur, 0.0, 1.0);\n\n    gl_FragColor = u_color * (alpha * u_opacity);\n\n#ifdef OVERDRAW_INSPECTOR\n    gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"precision highp float;\n\n// floor(127 / 2) == 63.0\n// the maximum allowed miter limit is 2.0 at the moment. the extrude normal is\n// stored in a byte (-128..127). we scale regular normals up to length 63, but\n// there are also \"special\" normals that have a bigger length (of up to 126 in\n// this case).\n// #define scale 63.0\n#define scale 0.015873016\n\nattribute vec2 a_pos;\nattribute vec4 a_data;\n\nuniform mat4 u_matrix;\nuniform float u_ratio;\nuniform mediump vec2 u_linewidth;\nuniform float u_extra;\nuniform mat2 u_antialiasingmatrix;\nuniform mediump float u_offset;\n\nvarying vec2 v_normal;\nvarying float v_linesofar;\nvarying float v_gamma_scale;\n\nvoid main() {\n    vec2 a_extrude = a_data.xy - 128.0;\n    float a_direction = mod(a_data.z, 4.0) - 1.0;\n\n    // We store the texture normals in the most insignificant bit\n    // transform y so that 0 => -1 and 1 => 1\n    // In the texture normal, x is 0 if the normal points straight up/down and 1 if it's a round cap\n    // y is 1 if the normal points up, and -1 if it points down\n    mediump vec2 normal = mod(a_pos, 2.0);\n    normal.y = sign(normal.y - 0.5);\n    v_normal = normal;\n\n    // Scale the extrusion vector down to a normal and then up by the line width\n    // of this vertex.\n    mediump vec4 dist = vec4(u_linewidth.s * a_extrude * scale, 0.0, 0.0);\n\n    // Calculate the offset when drawing a line that is to the side of the actual line.\n    // We do this by creating a vector that points towards the extrude, but rotate\n    // it when we're drawing round end points (a_direction = -1 or 1) since their\n    // extrude vector points in another direction.\n    mediump float u = 0.5 * a_direction;\n    mediump float t = 1.0 - abs(u);\n    mediump vec2 offset = u_offset * a_extrude * scale * normal.y * mat2(t, -u, u, t);\n\n    // Remove the texture normal bit of the position before scaling it with the\n    // model/view matrix.\n    gl_Position = u_matrix * vec4(floor(a_pos * 0.5) + (offset + dist.xy) / u_ratio, 0.0, 1.0);\n\n    // position of y on the screen\n    float y = gl_Position.y / gl_Position.w;\n\n    // how much features are squished in the y direction by the tilt\n    float squish_scale = length(a_extrude) / length(u_antialiasingmatrix * a_extrude);\n\n    // how much features are squished in all directions by the perspectiveness\n    float perspective_scale = 1.0 / (1.0 - min(y * u_extra, 0.9));\n\n    v_gamma_scale = perspective_scale * squish_scale;\n}\n"},linepattern:{fragmentSource:"precision mediump float;\n\nuniform vec2 u_linewidth;\nuniform float u_point;\nuniform float u_blur;\n\nuniform vec2 u_pattern_size_a;\nuniform vec2 u_pattern_size_b;\nuniform vec2 u_pattern_tl_a;\nuniform vec2 u_pattern_br_a;\nuniform vec2 u_pattern_tl_b;\nuniform vec2 u_pattern_br_b;\nuniform float u_fade;\nuniform float u_opacity;\n\nuniform sampler2D u_image;\n\nvarying vec2 v_normal;\nvarying float v_linesofar;\nvarying float v_gamma_scale;\n\nvoid main() {\n    // Calculate the distance of the pixel from the line in pixels.\n    float dist = length(v_normal) * u_linewidth.s;\n\n    // Calculate the antialiasing fade factor. This is either when fading in\n    // the line in case of an offset line (v_linewidth.t) or when fading out\n    // (v_linewidth.s)\n    float blur = u_blur * v_gamma_scale;\n    float alpha = clamp(min(dist - (u_linewidth.t - blur), u_linewidth.s - dist) / blur, 0.0, 1.0);\n\n    float x_a = mod(v_linesofar / u_pattern_size_a.x, 1.0);\n    float x_b = mod(v_linesofar / u_pattern_size_b.x, 1.0);\n    float y_a = 0.5 + (v_normal.y * u_linewidth.s / u_pattern_size_a.y);\n    float y_b = 0.5 + (v_normal.y * u_linewidth.s / u_pattern_size_b.y);\n    vec2 pos = mix(u_pattern_tl_a, u_pattern_br_a, vec2(x_a, y_a));\n    vec2 pos2 = mix(u_pattern_tl_b, u_pattern_br_b, vec2(x_b, y_b));\n\n    vec4 color = mix(texture2D(u_image, pos), texture2D(u_image, pos2), u_fade);\n\n    alpha *= u_opacity;\n\n    gl_FragColor = color * alpha;\n\n#ifdef OVERDRAW_INSPECTOR\n    gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"precision highp float;\n\n// floor(127 / 2) == 63.0\n// the maximum allowed miter limit is 2.0 at the moment. the extrude normal is\n// stored in a byte (-128..127). we scale regular normals up to length 63, but\n// there are also \"special\" normals that have a bigger length (of up to 126 in\n// this case).\n// #define scale 63.0\n#define scale 0.015873016\n\n// We scale the distance before adding it to the buffers so that we can store\n// long distances for long segments. Use this value to unscale the distance.\n#define LINE_DISTANCE_SCALE 2.0\n\nattribute vec2 a_pos;\nattribute vec4 a_data;\n\nuniform mat4 u_matrix;\nuniform mediump float u_ratio;\nuniform mediump vec2 u_linewidth;\nuniform float u_extra;\nuniform mat2 u_antialiasingmatrix;\nuniform mediump float u_offset;\n\nvarying vec2 v_normal;\nvarying float v_linesofar;\nvarying float v_gamma_scale;\n\nvoid main() {\n    vec2 a_extrude = a_data.xy - 128.0;\n    float a_direction = mod(a_data.z, 4.0) - 1.0;\n    float a_linesofar = (floor(a_data.z / 4.0) + a_data.w * 64.0) * LINE_DISTANCE_SCALE;\n\n    // We store the texture normals in the most insignificant bit\n    // transform y so that 0 => -1 and 1 => 1\n    // In the texture normal, x is 0 if the normal points straight up/down and 1 if it's a round cap\n    // y is 1 if the normal points up, and -1 if it points down\n    mediump vec2 normal = mod(a_pos, 2.0);\n    normal.y = sign(normal.y - 0.5);\n    v_normal = normal;\n\n    // Scale the extrusion vector down to a normal and then up by the line width\n    // of this vertex.\n    mediump vec2 extrude = a_extrude * scale;\n    mediump vec2 dist = u_linewidth.s * extrude;\n\n    // Calculate the offset when drawing a line that is to the side of the actual line.\n    // We do this by creating a vector that points towards the extrude, but rotate\n    // it when we're drawing round end points (a_direction = -1 or 1) since their\n    // extrude vector points in another direction.\n    mediump float u = 0.5 * a_direction;\n    mediump float t = 1.0 - abs(u);\n    mediump vec2 offset = u_offset * a_extrude * scale * normal.y * mat2(t, -u, u, t);\n\n    // Remove the texture normal bit of the position before scaling it with the\n    // model/view matrix.\n    gl_Position = u_matrix * vec4(floor(a_pos * 0.5) + (offset + dist.xy) / u_ratio, 0.0, 1.0);\n    v_linesofar = a_linesofar;\n\n    // position of y on the screen\n    float y = gl_Position.y / gl_Position.w;\n\n    // how much features are squished in the y direction by the tilt\n    float squish_scale = length(a_extrude) / length(u_antialiasingmatrix * a_extrude);\n\n    // how much features are squished in all directions by the perspectiveness\n    float perspective_scale = 1.0 / (1.0 - min(y * u_extra, 0.9));\n\n    v_gamma_scale = perspective_scale * squish_scale;\n}\n"},linesdfpattern:{fragmentSource:"precision mediump float;\n\nuniform vec2 u_linewidth;\nuniform lowp vec4 u_color;\nuniform lowp float u_opacity;\nuniform float u_blur;\nuniform sampler2D u_image;\nuniform float u_sdfgamma;\nuniform float u_mix;\n\nvarying vec2 v_normal;\nvarying vec2 v_tex_a;\nvarying vec2 v_tex_b;\nvarying float v_gamma_scale;\n\nvoid main() {\n    // Calculate the distance of the pixel from the line in pixels.\n    float dist = length(v_normal) * u_linewidth.s;\n\n    // Calculate the antialiasing fade factor. This is either when fading in\n    // the line in case of an offset line (v_linewidth.t) or when fading out\n    // (v_linewidth.s)\n    float blur = u_blur * v_gamma_scale;\n    float alpha = clamp(min(dist - (u_linewidth.t - blur), u_linewidth.s - dist) / blur, 0.0, 1.0);\n\n    float sdfdist_a = texture2D(u_image, v_tex_a).a;\n    float sdfdist_b = texture2D(u_image, v_tex_b).a;\n    float sdfdist = mix(sdfdist_a, sdfdist_b, u_mix);\n    alpha *= smoothstep(0.5 - u_sdfgamma, 0.5 + u_sdfgamma, sdfdist);\n\n    gl_FragColor = u_color * (alpha * u_opacity);\n\n#ifdef OVERDRAW_INSPECTOR\n    gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"precision highp float;\n\n// floor(127 / 2) == 63.0\n// the maximum allowed miter limit is 2.0 at the moment. the extrude normal is\n// stored in a byte (-128..127). we scale regular normals up to length 63, but\n// there are also \"special\" normals that have a bigger length (of up to 126 in\n// this case).\n// #define scale 63.0\n#define scale 0.015873016\n\n// We scale the distance before adding it to the buffers so that we can store\n// long distances for long segments. Use this value to unscale the distance.\n#define LINE_DISTANCE_SCALE 2.0\n\nattribute vec2 a_pos;\nattribute vec4 a_data;\n\nuniform mat4 u_matrix;\nuniform mediump vec2 u_linewidth;\nuniform mediump float u_ratio;\nuniform vec2 u_patternscale_a;\nuniform float u_tex_y_a;\nuniform vec2 u_patternscale_b;\nuniform float u_tex_y_b;\nuniform float u_extra;\nuniform mat2 u_antialiasingmatrix;\nuniform mediump float u_offset;\n\nvarying vec2 v_normal;\nvarying vec2 v_tex_a;\nvarying vec2 v_tex_b;\nvarying float v_gamma_scale;\n\nvoid main() {\n    vec2 a_extrude = a_data.xy - 128.0;\n    float a_direction = mod(a_data.z, 4.0) - 1.0;\n    float a_linesofar = (floor(a_data.z / 4.0) + a_data.w * 64.0) * LINE_DISTANCE_SCALE;\n\n    // We store the texture normals in the most insignificant bit\n    // transform y so that 0 => -1 and 1 => 1\n    // In the texture normal, x is 0 if the normal points straight up/down and 1 if it's a round cap\n    // y is 1 if the normal points up, and -1 if it points down\n    mediump vec2 normal = mod(a_pos, 2.0);\n    normal.y = sign(normal.y - 0.5);\n    v_normal = normal;\n\n    // Scale the extrusion vector down to a normal and then up by the line width\n    // of this vertex.\n    mediump vec4 dist = vec4(u_linewidth.s * a_extrude * scale, 0.0, 0.0);\n\n    // Calculate the offset when drawing a line that is to the side of the actual line.\n    // We do this by creating a vector that points towards the extrude, but rotate\n    // it when we're drawing round end points (a_direction = -1 or 1) since their\n    // extrude vector points in another direction.\n    mediump float u = 0.5 * a_direction;\n    mediump float t = 1.0 - abs(u);\n    mediump vec2 offset = u_offset * a_extrude * scale * normal.y * mat2(t, -u, u, t);\n\n    // Remove the texture normal bit of the position before scaling it with the\n    // model/view matrix.\n    gl_Position = u_matrix * vec4(floor(a_pos * 0.5) + (offset + dist.xy) / u_ratio, 0.0, 1.0);\n\n    v_tex_a = vec2(a_linesofar * u_patternscale_a.x, normal.y * u_patternscale_a.y + u_tex_y_a);\n    v_tex_b = vec2(a_linesofar * u_patternscale_b.x, normal.y * u_patternscale_b.y + u_tex_y_b);\n\n    // position of y on the screen\n    float y = gl_Position.y / gl_Position.w;\n\n    // how much features are squished in the y direction by the tilt\n    float squish_scale = length(a_extrude) / length(u_antialiasingmatrix * a_extrude);\n\n    // how much features are squished in all directions by the perspectiveness\n    float perspective_scale = 1.0 / (1.0 - min(y * u_extra, 0.9));\n\n    v_gamma_scale = perspective_scale * squish_scale;\n}\n"
},outline:{fragmentSource:"precision mediump float;\n\nuniform lowp vec4 u_color;\nuniform lowp float u_opacity;\n\nvarying vec2 v_pos;\n\nvoid main() {\n    float dist = length(v_pos - gl_FragCoord.xy);\n    float alpha = smoothstep(1.0, 0.0, dist);\n    gl_FragColor = u_color * (alpha * u_opacity);\n\n#ifdef OVERDRAW_INSPECTOR\n    gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"precision highp float;\n\nattribute vec2 a_pos;\n\nuniform mat4 u_matrix;\nuniform vec2 u_world;\n\nvarying vec2 v_pos;\n\nvoid main() {\n    gl_Position = u_matrix * vec4(a_pos, 0, 1);\n    v_pos = (gl_Position.xy/gl_Position.w + 1.0) / 2.0 * u_world;\n}\n"},outlinepattern:{fragmentSource:"precision mediump float;\n\nuniform float u_opacity;\nuniform vec2 u_pattern_tl_a;\nuniform vec2 u_pattern_br_a;\nuniform vec2 u_pattern_tl_b;\nuniform vec2 u_pattern_br_b;\nuniform float u_mix;\n\nuniform sampler2D u_image;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\nvarying vec2 v_pos;\n\nvoid main() {\n    vec2 imagecoord = mod(v_pos_a, 1.0);\n    vec2 pos = mix(u_pattern_tl_a, u_pattern_br_a, imagecoord);\n    vec4 color1 = texture2D(u_image, pos);\n\n    vec2 imagecoord_b = mod(v_pos_b, 1.0);\n    vec2 pos2 = mix(u_pattern_tl_b, u_pattern_br_b, imagecoord_b);\n    vec4 color2 = texture2D(u_image, pos2);\n\n    // find distance to outline for alpha interpolation\n\n    float dist = length(v_pos - gl_FragCoord.xy);\n    float alpha = smoothstep(1.0, 0.0, dist);\n    \n\n    gl_FragColor = mix(color1, color2, u_mix) * alpha * u_opacity;\n\n#ifdef OVERDRAW_INSPECTOR\n    gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"precision highp float;\n\nuniform vec2 u_patternscale_a;\nuniform vec2 u_patternscale_b;\nuniform vec2 u_offset_a;\nuniform vec2 u_offset_b;\n\nattribute vec2 a_pos;\n\nuniform mat4 u_matrix;\nuniform vec2 u_world;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\nvarying vec2 v_pos;\n\n\nvoid main() {\n    gl_Position = u_matrix * vec4(a_pos, 0, 1);\n    v_pos_a = u_patternscale_a * a_pos + u_offset_a;\n    v_pos_b = u_patternscale_b * a_pos + u_offset_b;\n    v_pos = (gl_Position.xy/gl_Position.w + 1.0) / 2.0 * u_world;\n}\n"},pattern:{fragmentSource:"precision mediump float;\n\nuniform float u_opacity;\nuniform vec2 u_pattern_tl_a;\nuniform vec2 u_pattern_br_a;\nuniform vec2 u_pattern_tl_b;\nuniform vec2 u_pattern_br_b;\nuniform float u_mix;\n\nuniform sampler2D u_image;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\n\nvoid main() {\n\n    vec2 imagecoord = mod(v_pos_a, 1.0);\n    vec2 pos = mix(u_pattern_tl_a, u_pattern_br_a, imagecoord);\n    vec4 color1 = texture2D(u_image, pos);\n\n    vec2 imagecoord_b = mod(v_pos_b, 1.0);\n    vec2 pos2 = mix(u_pattern_tl_b, u_pattern_br_b, imagecoord_b);\n    vec4 color2 = texture2D(u_image, pos2);\n\n    gl_FragColor = mix(color1, color2, u_mix) * u_opacity;\n\n#ifdef OVERDRAW_INSPECTOR\n    gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"precision highp float;\n\nuniform mat4 u_matrix;\nuniform vec2 u_patternscale_a;\nuniform vec2 u_patternscale_b;\nuniform vec2 u_offset_a;\nuniform vec2 u_offset_b;\n\nattribute vec2 a_pos;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\n\nvoid main() {\n    gl_Position = u_matrix * vec4(a_pos, 0, 1);\n    v_pos_a = u_patternscale_a * a_pos + u_offset_a;\n    v_pos_b = u_patternscale_b * a_pos + u_offset_b;\n}\n"},raster:{fragmentSource:"precision mediump float;\n\nuniform float u_opacity0;\nuniform float u_opacity1;\nuniform sampler2D u_image0;\nuniform sampler2D u_image1;\nvarying vec2 v_pos0;\nvarying vec2 v_pos1;\n\nuniform float u_brightness_low;\nuniform float u_brightness_high;\n\nuniform float u_saturation_factor;\nuniform float u_contrast_factor;\nuniform vec3 u_spin_weights;\n\nvoid main() {\n\n    // read and cross-fade colors from the main and parent tiles\n    vec4 color0 = texture2D(u_image0, v_pos0);\n    vec4 color1 = texture2D(u_image1, v_pos1);\n    vec4 color = color0 * u_opacity0 + color1 * u_opacity1;\n    vec3 rgb = color.rgb;\n\n    // spin\n    rgb = vec3(\n        dot(rgb, u_spin_weights.xyz),\n        dot(rgb, u_spin_weights.zxy),\n        dot(rgb, u_spin_weights.yzx));\n\n    // saturation\n    float average = (color.r + color.g + color.b) / 3.0;\n    rgb += (average - rgb) * u_saturation_factor;\n\n    // contrast\n    rgb = (rgb - 0.5) * u_contrast_factor + 0.5;\n\n    // brightness\n    vec3 u_high_vec = vec3(u_brightness_low, u_brightness_low, u_brightness_low);\n    vec3 u_low_vec = vec3(u_brightness_high, u_brightness_high, u_brightness_high);\n\n    gl_FragColor = vec4(mix(u_high_vec, u_low_vec, rgb), color.a);\n\n#ifdef OVERDRAW_INSPECTOR\n    gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"precision highp float;\n\nuniform mat4 u_matrix;\nuniform vec2 u_tl_parent;\nuniform float u_scale_parent;\nuniform float u_buffer_scale;\n\nattribute vec2 a_pos;\nattribute vec2 a_texture_pos;\n\nvarying vec2 v_pos0;\nvarying vec2 v_pos1;\n\nvoid main() {\n    gl_Position = u_matrix * vec4(a_pos, 0, 1);\n    v_pos0 = (((a_texture_pos / 32767.0) - 0.5) / u_buffer_scale ) + 0.5;\n    v_pos1 = (v_pos0 * u_scale_parent) + u_tl_parent;\n}\n"},icon:{fragmentSource:"precision mediump float;\n\nuniform sampler2D u_texture;\nuniform sampler2D u_fadetexture;\nuniform lowp float u_opacity;\n\nvarying vec2 v_tex;\nvarying vec2 v_fade_tex;\n\nvoid main() {\n    lowp float alpha = texture2D(u_fadetexture, v_fade_tex).a * u_opacity;\n    gl_FragColor = texture2D(u_texture, v_tex) * alpha;\n\n#ifdef OVERDRAW_INSPECTOR\n    gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"precision highp float;\n\nattribute vec2 a_pos;\nattribute vec2 a_offset;\nattribute vec4 a_data1;\nattribute vec4 a_data2;\n\n\n// matrix is for the vertex position, exmatrix is for rotating and projecting\n// the extrusion vector.\nuniform mat4 u_matrix;\n\nuniform mediump float u_zoom;\nuniform bool u_skewed;\nuniform float u_extra;\nuniform vec2 u_extrude_scale;\n\nuniform vec2 u_texsize;\n\nvarying vec2 v_tex;\nvarying vec2 v_fade_tex;\n\nvoid main() {\n    vec2 a_tex = a_data1.xy;\n    mediump float a_labelminzoom = a_data1[2];\n    mediump vec2 a_zoom = a_data2.st;\n    mediump float a_minzoom = a_zoom[0];\n    mediump float a_maxzoom = a_zoom[1];\n\n    // u_zoom is the current zoom level adjusted for the change in font size\n    mediump float z = 2.0 - step(a_minzoom, u_zoom) - (1.0 - step(a_maxzoom, u_zoom));\n\n    vec2 extrude = u_extrude_scale * (a_offset / 64.0);\n    if (u_skewed) {\n        gl_Position = u_matrix * vec4(a_pos + extrude, 0, 1);\n        gl_Position.z += z * gl_Position.w;\n    } else {\n        gl_Position = u_matrix * vec4(a_pos, 0, 1) + vec4(extrude, 0, 0);\n    }\n\n    v_tex = a_tex / u_texsize;\n    v_fade_tex = vec2(a_labelminzoom / 255.0, 0.0);\n}\n"},sdf:{fragmentSource:"precision mediump float;\n\nuniform sampler2D u_texture;\nuniform sampler2D u_fadetexture;\nuniform lowp vec4 u_color;\nuniform lowp float u_opacity;\nuniform lowp float u_buffer;\nuniform lowp float u_gamma;\n\nvarying vec2 v_tex;\nvarying vec2 v_fade_tex;\nvarying float v_gamma_scale;\n\nvoid main() {\n    lowp float dist = texture2D(u_texture, v_tex).a;\n    lowp float fade_alpha = texture2D(u_fadetexture, v_fade_tex).a;\n    lowp float gamma = u_gamma * v_gamma_scale;\n    lowp float alpha = smoothstep(u_buffer - gamma, u_buffer + gamma, dist) * fade_alpha;\n    gl_FragColor = u_color * (alpha * u_opacity);\n\n#ifdef OVERDRAW_INSPECTOR\n    gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"precision highp float;\n\nattribute vec2 a_pos;\nattribute vec2 a_offset;\nattribute vec4 a_data1;\nattribute vec4 a_data2;\n\n\n// matrix is for the vertex position, exmatrix is for rotating and projecting\n// the extrusion vector.\nuniform mat4 u_matrix;\n\nuniform mediump float u_zoom;\nuniform bool u_skewed;\nuniform float u_extra;\nuniform vec2 u_extrude_scale;\n\nuniform vec2 u_texsize;\n\nvarying vec2 v_tex;\nvarying vec2 v_fade_tex;\nvarying float v_gamma_scale;\n\nvoid main() {\n    vec2 a_tex = a_data1.xy;\n    mediump float a_labelminzoom = a_data1[2];\n    mediump vec2 a_zoom = a_data2.st;\n    mediump float a_minzoom = a_zoom[0];\n    mediump float a_maxzoom = a_zoom[1];\n\n    // u_zoom is the current zoom level adjusted for the change in font size\n    mediump float z = 2.0 - step(a_minzoom, u_zoom) - (1.0 - step(a_maxzoom, u_zoom));\n\n    vec2 extrude = u_extrude_scale * (a_offset / 64.0);\n    if (u_skewed) {\n        gl_Position = u_matrix * vec4(a_pos + extrude, 0, 1);\n        gl_Position.z += z * gl_Position.w;\n    } else {\n        gl_Position = u_matrix * vec4(a_pos, 0, 1) + vec4(extrude, 0, 0);\n    }\n\n    // position of y on the screen\n    float y = gl_Position.y / gl_Position.w;\n    // how much features are squished in all directions by the perspectiveness\n    float perspective_scale = 1.0 / (1.0 - y * u_extra);\n    v_gamma_scale = perspective_scale;\n\n    v_tex = a_tex / u_texsize;\n    v_fade_tex = vec2(a_labelminzoom / 255.0, 0.0);\n}\n"},collisionbox:{fragmentSource:"precision mediump float;\n\nuniform float u_zoom;\nuniform float u_maxzoom;\n\nvarying float v_max_zoom;\nvarying float v_placement_zoom;\n\nvoid main() {\n\n    float alpha = 0.5;\n\n    gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0) * alpha;\n\n    if (v_placement_zoom > u_zoom) {\n        gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0) * alpha;\n    }\n\n    if (u_zoom >= v_max_zoom) {\n        gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0) * alpha * 0.25;\n    }\n\n    if (v_placement_zoom >= u_maxzoom) {\n        gl_FragColor = vec4(0.0, 0.0, 1.0, 1.0) * alpha * 0.2;\n    }\n}\n",vertexSource:"precision highp float;\n\nattribute vec2 a_pos;\nattribute vec2 a_extrude;\nattribute vec2 a_data;\n\nuniform mat4 u_matrix;\nuniform float u_scale;\n\nvarying float v_max_zoom;\nvarying float v_placement_zoom;\n\nvoid main() {\n     gl_Position = u_matrix * vec4(a_pos + a_extrude / u_scale, 0.0, 1.0);\n\n     v_max_zoom = a_data.x;\n     v_placement_zoom = a_data.y;\n}\n"}};e.exports._createProgram=function(t,e){var r=this.gl,a=r.createProgram(),s=o[t],l="";if(e)for(var u=0;u<e.length;u++)l+="#define "+e[u]+"\n";var c=r.createShader(r.FRAGMENT_SHADER);r.shaderSource(c,l+s.fragmentSource),r.compileShader(c),n(r.getShaderParameter(c,r.COMPILE_STATUS),r.getShaderInfoLog(c)),r.attachShader(a,c);var h=r.createShader(r.VERTEX_SHADER);r.shaderSource(h,l+s.vertexSource),r.compileShader(h),n(r.getShaderParameter(h,r.COMPILE_STATUS),r.getShaderInfoLog(h)),r.attachShader(a,h),r.linkProgram(a),n(r.getProgramParameter(a,r.LINK_STATUS),r.getProgramInfoLog(a));for(var f={},d=r.getProgramParameter(a,r.ACTIVE_ATTRIBUTES),p=0;d>p;p++){var v=r.getActiveAttrib(a,p);f[v.name]=p}for(var m={},g=r.getProgramParameter(a,r.ACTIVE_UNIFORMS),y=0;g>y;y++){var b=r.getActiveUniform(a,y);m[b.name]=r.getUniformLocation(a,b.name)}return i.extend({program:a,definition:s,attributes:f,numAttributes:d},f,m)},e.exports._createProgramCached=function(t,e){this.cache=this.cache||{},this._showOverdrawInspector&&(e=e||[],e.push("OVERDRAW_INSPECTOR"));var r=JSON.stringify({name:t,macros:e});return this.cache[r]||(this.cache[r]=this._createProgram(t,e)),this.cache[r]},e.exports.useProgram=function(t,e){var r=this.gl,n=this._createProgramCached(t,e),i=this.currentProgram;return i!==n&&(r.useProgram(n.program),this.currentProgram=n),n}},{"../../util/util":349,assert:52,path:59}],273:[function(t,e,r){"use strict";function n(){this.boundProgram=null,this.boundVertexBuffer=null,this.boundVertexBuffer2=null,this.boundElementBuffer=null,this.vao=null}var i=t("assert");e.exports=n;var o=!1;n.prototype.bind=function(t,e,r,n,a){var s=t.extVertexArrayObject;if(void 0===s&&(s=t.extVertexArrayObject=t.getExtension("OES_vertex_array_object")),s?(this.vao||(this.vao=s.createVertexArrayOES()),s.bindVertexArrayOES(this.vao)):o||(console.warn("Not using VertexArrayObject extension."),o=!0),this.boundProgram)i(this.boundProgram===e,"trying to bind a VAO to a different shader"),i(this.boundVertexBuffer===r,"trying to bind a VAO to a different vertex buffer"),i(this.boundVertexBuffer2===a,"trying to bind a VAO to a different vertex buffer"),i(this.boundElementBuffer===n,"trying to bind a VAO to a different element buffer");else{var l,u=s?0:t.currentNumAttributes||0,c=e.numAttributes;for(l=u;c>l;l++)t.enableVertexAttribArray(l);if(!s){for(i(l>0),l=c;u>l;l++)t.disableVertexAttribArray(l);t.currentNumAttributes=c}r.bind(t),r.setVertexAttribPointers(t,e),a&&(a.bind(t),a.setVertexAttribPointers(t,e)),n&&n.bind(t),s&&(this.boundProgram=e,this.boundVertexBuffer=r,this.boundVertexBuffer2=a,this.boundElementBuffer=n)}},n.prototype.unbind=function(t){var e=t.extVertexArrayObject;e&&e.bindVertexArrayOES(null)},n.prototype.destroy=function(t){var e=t.extVertexArrayObject;e&&this.vao&&(e.deleteVertexArrayOES(this.vao),this.vao=null)}},{assert:52}],274:[function(t,e,r){"use strict";function n(t){t=t||{},this._data=t.data,void 0!==t.maxzoom&&(this.maxzoom=t.maxzoom);var e=u/this.tileSize;this.geojsonVtOptions={buffer:(void 0!==t.buffer?t.buffer:128)*e,tolerance:(void 0!==t.tolerance?t.tolerance:.375)*e,extent:u,maxZoom:this.maxzoom},this.cluster=t.cluster||!1,this.superclusterOptions={maxZoom:Math.min(t.clusterMaxZoom,this.maxzoom-1)||this.maxzoom-1,extent:u,radius:(t.clusterRadius||50)*e,log:!1},this._pyramid=new a({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!0,load:this._loadTile.bind(this),abort:this._abortTile.bind(this),unload:this._unloadTile.bind(this),add:this._addTile.bind(this),remove:this._removeTile.bind(this),redoPlacement:this._redoTilePlacement.bind(this)})}var i=t("../util/util"),o=t("../util/evented"),a=t("./tile_pyramid"),s=t("./source"),l=t("resolve-url"),u=t("../data/bucket").EXTENT;e.exports=n,n.prototype=i.inherit(o,{minzoom:0,maxzoom:18,tileSize:512,_dirty:!0,isTileClipped:!0,setData:function(t){return this._data=t,this._dirty=!0,this.fire("change"),this.map&&this.update(this.map.transform),this},onAdd:function(t){this.map=t},loaded:function(){return this._loaded&&this._pyramid.loaded()},update:function(t){this._dirty&&this._updateData(),this._loaded&&this._pyramid.update(this.used,t)},reload:function(){this._loaded&&this._pyramid.reload()},serialize:function(){return{type:"geojson",data:this._data}},getVisibleCoordinates:s._getVisibleCoordinates,getTile:s._getTile,queryRenderedFeatures:s._queryRenderedVectorFeatures,querySourceFeatures:s._querySourceFeatures,_updateData:function(){this._dirty=!1;var t={tileSize:this.tileSize,source:this.id,geojsonVtOptions:this.geojsonVtOptions,cluster:this.cluster,superclusterOptions:this.superclusterOptions},e=this._data;"string"==typeof e?t.url="undefined"!=typeof window?l(window.location.href,e):e:t.data=JSON.stringify(e),this.workerID=this.dispatcher.send("parse geojson",t,function(t){this._loaded=!0,t?this.fire("error",{error:t}):(this._pyramid.reload(),this.fire("change"))}.bind(this))},_loadTile:function(t){var e=t.coord.z>this.maxzoom?Math.pow(2,t.coord.z-this.maxzoom):1,r={uid:t.uid,coord:t.coord,zoom:t.coord.z,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,overscaling:e,angle:this.map.transform.angle,pitch:this.map.transform.pitch,showCollisionBoxes:this.map.showCollisionBoxes};t.workerID=this.dispatcher.send("load geojson tile",r,function(e,r){if(t.unloadVectorData(this.map.painter),!t.aborted){if(e)return void this.fire("tile.error",{tile:t});t.loadVectorData(r,this.map.style),t.redoWhenDone&&(t.redoWhenDone=!1,t.redoPlacement(this)),this.fire("tile.load",{tile:t})}}.bind(this),this.workerID)},_abortTile:function(t){t.aborted=!0},_addTile:function(t){this.fire("tile.add",{tile:t})},_removeTile:function(t){this.fire("tile.remove",{tile:t})},_unloadTile:function(t){t.unloadVectorData(this.map.painter),this.dispatcher.send("remove tile",{uid:t.uid,source:this.id},null,t.workerID)},redoPlacement:s.redoPlacement,_redoTilePlacement:function(t){t.redoPlacement(this)}})},{"../data/bucket":247,"../util/evented":341,"../util/util":349,"./source":279,"./tile_pyramid":282,"resolve-url":405}],275:[function(t,e,r){"use strict";function n(t){this.features=t,this.length=t.length,this.extent=s}function i(t){this.type=t.type,this.rawGeometry=1===t.type?[t.geometry]:t.geometry,this.properties=t.tags,this.extent=s}var o=t("point-geometry"),a=t("vector-tile").VectorTileFeature,s=t("../data/bucket").EXTENT;e.exports=n,n.prototype.feature=function(t){return new i(this.features[t])},i.prototype.loadGeometry=function(){var t=this.rawGeometry;this.geometry=[];for(var e=0;e<t.length;e++){for(var r=t[e],n=[],i=0;i<r.length;i++)n.push(new o(r[i][0],r[i][1]));this.geometry.push(n)}return this.geometry},i.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var t=this.geometry,e=1/0,r=-(1/0),n=1/0,i=-(1/0),o=0;o<t.length;o++)for(var a=t[o],s=0;s<a.length;s++){var l=a[s];e=Math.min(e,l.x),r=Math.max(r,l.x),n=Math.min(n,l.y),i=Math.max(i,l.y)}return[e,n,r,i]},i.prototype.toGeoJSON=a.prototype.toGeoJSON},{"../data/bucket":247,"point-geometry":404,"vector-tile":413}],276:[function(t,e,r){"use strict";function n(t){this.urls=t.urls,this.coordinates=t.coordinates,c.getImage(t.url,function(e,r){e||(this.image=r,this.image.addEventListener("load",function(){this.map._rerender()}.bind(this)),this._loaded=!0,this.map&&this.setCoordinates(t.coordinates))}.bind(this))}var i=t("../util/util"),o=t("./tile"),a=t("./tile_coord"),s=t("../geo/lng_lat"),l=t("point-geometry"),u=t("../util/evented"),c=t("../util/ajax"),h=t("../data/bucket").EXTENT,f=t("../render/draw_raster").RasterBoundsArray,d=t("../data/buffer"),p=t("../render/vertex_array_object");e.exports=n,n.prototype=i.inherit(u,{onAdd:function(t){this.map=t,this.image&&this.setCoordinates(this.coordinates)},setCoordinates:function(t){this.coordinates=t;var e=this.map,r=t.map(function(t){return e.transform.locationCoordinate(s.convert(t)).zoomTo(0)}),n=this.centerCoord=i.getCoordinatesCenter(r);n.column=Math.round(n.column),n.row=Math.round(n.row);var u=r.map(function(t){var e=t.zoomTo(n.zoom);return new l(Math.round((e.column-n.column)*h),Math.round((e.row-n.row)*h))}),c=32767,v=new f;return v.emplaceBack(u[0].x,u[0].y,0,0),v.emplaceBack(u[1].x,u[1].y,c,0),v.emplaceBack(u[3].x,u[3].y,0,c),v.emplaceBack(u[2].x,u[2].y,c,c),this.tile=new o(new a(n.zoom,n.column,n.row)),this.tile.buckets={},this.tile.boundsBuffer=new d(v.serialize(),f.serialize(),d.BufferType.VERTEX),this.tile.boundsVAO=new p,this.fire("change"),this},loaded:function(){return this.image&&this.image.complete},update:function(){},reload:function(){},prepare:function(){if(this._loaded&&this.loaded()){var t=this.map.painter,e=t.gl;this.tile.texture?(e.bindTexture(e.TEXTURE_2D,this.tile.texture),e.texSubImage2D(e.TEXTURE_2D,0,0,0,e.RGBA,e.UNSIGNED_BYTE,this.image)):(this.tile.texture=e.createTexture(),e.bindTexture(e.TEXTURE_2D,this.tile.texture),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,this.image))}},getVisibleCoordinates:function(){return this.tile?[this.tile.coord]:[]},getTile:function(){return this.tile},serialize:function(){return{type:"image",urls:this.urls,coordinates:this.coordinates}}})},{"../data/bucket":247,"../data/buffer":252,"../geo/lng_lat":256,"../render/draw_raster":267,"../render/vertex_array_object":273,"../util/ajax":334,"../util/evented":341,"../util/util":349,"./tile":280,"./tile_coord":281,"point-geometry":404}],277:[function(t,e,r){"use strict";var n=t("../data/bucket");e.exports=function(t,e,r){return e*(n.EXTENT/(t.tileSize*Math.pow(2,r-t.coord.z)))}},{"../data/bucket":247}],278:[function(t,e,r){"use strict";function n(t){i.extend(this,i.pick(t,["url","tileSize"])),s._loadTileJSON.call(this,t)}var i=t("../util/util"),o=t("../util/ajax"),a=t("../util/evented"),s=t("./source"),l=t("../util/mapbox").normalizeTileURL;e.exports=n,n.prototype=i.inherit(a,{minzoom:0,maxzoom:22,roundZoom:!0,tileSize:512,_loaded:!1,onAdd:function(t){this.map=t},loaded:function(){return this._pyramid&&this._pyramid.loaded()},update:function(t){this._pyramid&&this._pyramid.update(this.used,t,this.map.style.rasterFadeDuration)},reload:function(){},serialize:function(){return{type:"raster",url:this.url,tileSize:this.tileSize}},getVisibleCoordinates:s._getVisibleCoordinates,getTile:s._getTile,_loadTile:function(t){function e(e,r){if(delete t.request,!t.aborted){if(e)return t.errored=!0,void this.fire("tile.error",{tile:t,error:e});var n=this.map.painter.gl;t.texture=this.map.painter.getTexture(r.width),t.texture?(n.bindTexture(n.TEXTURE_2D,t.texture),n.texSubImage2D(n.TEXTURE_2D,0,0,0,n.RGBA,n.UNSIGNED_BYTE,r)):(t.texture=n.createTexture(),n.bindTexture(n.TEXTURE_2D,t.texture),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.LINEAR_MIPMAP_NEAREST),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,n.LINEAR),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0),n.texImage2D(n.TEXTURE_2D,0,n.RGBA,n.RGBA,n.UNSIGNED_BYTE,r),t.texture.size=r.width),n.generateMipmap(n.TEXTURE_2D),t.timeAdded=(new Date).getTime(),this.map.animationLoop.set(this.style.rasterFadeDuration),t.source=this,t.loaded=!0,this.fire("tile.load",{tile:t})}}var r=l(t.coord.url(this.tiles),this.url,this.tileSize);t.request=o.getImage(r,e.bind(this))},_abortTile:function(t){t.aborted=!0,t.request&&(t.request.abort(),delete t.request)},_addTile:function(t){this.fire("tile.add",{tile:t})},_removeTile:function(t){this.fire("tile.remove",{tile:t})},_unloadTile:function(t){t.texture&&this.map.painter.saveTexture(t.texture)}})},{"../util/ajax":334,"../util/evented":341,"../util/mapbox":346,"../util/util":349,"./source":279}],279:[function(t,e,r){"use strict";function n(t,e){var r=t.tile.coord,n=e.tile.coord;return r.z-n.z||r.y-n.y||r.x-n.x}function i(t){for(var e=t[0]||{},r=1;r<t.length;r++){var n=t[r];for(var i in n){var o=n[i],a=e[i];if(void 0===a)a=e[i]=o;else for(var s=0;s<o.length;s++)a.push(o[s])}}return e}var o=t("../util/util"),a=t("../util/ajax"),s=t("../util/browser"),l=t("./tile_pyramid"),u=t("../util/mapbox").normalizeSourceURL,c=t("./tile_coord");r._loadTileJSON=function(t){var e=function(t,e){return t?void this.fire("error",{error:t}):(o.extend(this,o.pick(e,["tiles","minzoom","maxzoom","attribution"])),e.vector_layers&&(this.vectorLayers=e.vector_layers,this.vectorLayerIds=this.vectorLayers.map(function(t){return t.id})),this._pyramid=new l({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,roundZoom:this.roundZoom,reparseOverscaled:this.reparseOverscaled,load:this._loadTile.bind(this),abort:this._abortTile.bind(this),unload:this._unloadTile.bind(this),add:this._addTile.bind(this),remove:this._removeTile.bind(this),redoPlacement:this._redoTilePlacement?this._redoTilePlacement.bind(this):void 0}),void this.fire("load"))}.bind(this);t.url?a.getJSON(u(t.url),e):s.frame(e.bind(this,null,t))},r.redoPlacement=function(){if(this._pyramid)for(var t=this._pyramid.orderedIDs(),e=0;e<t.length;e++){var r=this._pyramid.getTile(t[e]);this._redoTilePlacement(r)}},r._getTile=function(t){return this._pyramid.getTile(t.id)},r._getVisibleCoordinates=function(){return this._pyramid?this._pyramid.renderedIDs().map(c.fromID):[]},r._queryRenderedVectorFeatures=function(t,e,r,o){if(!this._pyramid)return{};var a=this._pyramid.tilesIn(t);a.sort(n);for(var s=this.map.style._layers,l=[],u=0;u<a.length;u++){var c=a[u];c.tile.featureIndex&&l.push(c.tile.featureIndex.query({queryGeometry:c.queryGeometry,scale:c.scale,tileSize:c.tile.tileSize,bearing:o,params:e},s))}return i(l)},r._querySourceFeatures=function(t){if(!this._pyramid)return[];for(var e=this._pyramid,r=e.renderedIDs().map(function(t){return e.getTile(t)}),n=[],i={},o=0;o<r.length;o++){var a=r[o],s=new c(Math.min(a.sourceMaxZoom,a.coord.z),a.coord.x,a.coord.y,0).id;i[s]||(i[s]=!0,a.querySourceFeatures(n,t))}return n},r.create=function(e){var n={vector:t("./vector_tile_source"),raster:t("./raster_tile_source"),geojson:t("./geojson_source"),video:t("./video_source"),image:t("./image_source")};return r.is(e)?e:new n[e.type](e)},r.is=function(e){var r={vector:t("./vector_tile_source"),raster:t("./raster_tile_source"),geojson:t("./geojson_source"),video:t("./video_source"),image:t("./image_source")};for(var n in r)if(e instanceof r[n])return!0;return!1}},{"../util/ajax":334,"../util/browser":335,"../util/mapbox":346,"../util/util":349,"./geojson_source":274,"./image_source":276,"./raster_tile_source":278,"./tile_coord":281,"./tile_pyramid":282,"./vector_tile_source":283,"./video_source":284}],280:[function(t,e,r){"use strict";function n(t,e,r){this.coord=t,this.uid=o.uniqueId(),this.loaded=!1,this.isUnloaded=!1,this.uses=0,this.tileSize=e,this.sourceMaxZoom=r,this.buckets={}}function i(t,e){for(var r={},n=0;n<t.length;n++){var i=e.getLayer(t[n].layerId);if(i){var s=a.create(o.extend({layer:i,childLayers:t[n].childLayerIds.map(e.getLayer.bind(e)).filter(function(t){return t})},t[n]));r[s.id]=s}}return r}var o=t("../util/util"),a=t("../data/bucket"),s=t("../data/feature_index"),l=t("vector-tile"),u=t("pbf"),c=t("../util/vectortile_to_geojson"),h=t("feature-filter"),f=t("../symbol/collision_tile"),d=t("../symbol/collision_box");e.exports=n,n.prototype={loadVectorData:function(t,e){this.loaded=!0,t&&(this.collisionBoxArray=new d(t.collisionBoxArray),this.collisionTile=new f(t.collisionTile,this.collisionBoxArray),this.featureIndex=new s(t.featureIndex,t.rawTileData,this.collisionTile),this.rawTileData=t.rawTileData,this.buckets=i(t.buckets,e))},reloadSymbolData:function(t,e,r){if(!this.isUnloaded){this.collisionTile=new f(t.collisionTile,this.collisionBoxArray),this.featureIndex.setCollisionTile(this.collisionTile);for(var n in this.buckets){var a=this.buckets[n];"symbol"===a.type&&(a.destroy(e.gl),delete this.buckets[n])}o.extend(this.buckets,i(t.buckets,r))}},unloadVectorData:function(t){for(var e in this.buckets){var r=this.buckets[e];r.destroy(t.gl)}this.collisionBoxArray=null,this.collisionTile=null,this.featureIndex=null,this.rawTileData=null,this.buckets=null,this.loaded=!1,this.isUnloaded=!0},redoPlacement:function(t){function e(e,r){this.reloadSymbolData(r,t.map.painter,t.map.style),t.fire("tile.load",{tile:this}),this.redoingPlacement=!1,this.redoWhenDone&&(this.redoPlacement(t),this.redoWhenDone=!1)}return!this.loaded||this.redoingPlacement?void(this.redoWhenDone=!0):(this.redoingPlacement=!0,void t.dispatcher.send("redo placement",{uid:this.uid,source:t.id,angle:t.map.transform.angle,pitch:t.map.transform.pitch,showCollisionBoxes:t.map.showCollisionBoxes},e.bind(this),this.workerID))},getBucket:function(t){return this.buckets&&this.buckets[t.ref||t.id]},querySourceFeatures:function(t,e){if(this.rawTileData){this.vtLayers||(this.vtLayers=new l.VectorTile(new u(new Uint8Array(this.rawTileData))).layers);var r=this.vtLayers._geojsonTileLayer||this.vtLayers[e.sourceLayer];if(r)for(var n=h(e.filter),i={z:this.coord.z,x:this.coord.x,y:this.coord.y},o=0;o<r.length;o++){var a=r.feature(o);if(n(a)){var s=new c(a,this.coord.z,this.coord.x,this.coord.y);s.tile=i,t.push(s)}}}}}},{"../data/bucket":247,"../data/feature_index":253,"../symbol/collision_box":306,"../symbol/collision_tile":308,"../util/util":349,"../util/vectortile_to_geojson":350,"feature-filter":352,pbf:402,"vector-tile":413}],281:[function(t,e,r){"use strict";function n(t,e,r,n){s(!isNaN(t)&&t>=0&&t%1===0),s(!isNaN(e)&&e>=0&&e%1===0),s(!isNaN(r)&&r>=0&&r%1===0),isNaN(n)&&(n=0),this.z=+t,this.x=+e,this.y=+r,this.w=+n,n*=2,0>n&&(n=-1*n-1);var i=1<<this.z;this.id=32*(i*i*n+i*this.y+this.x)+this.z,this.posMatrix=null}function i(t,e){if(t.row>e.row){var r=t;t=e,e=r}return{x0:t.column,y0:t.row,x1:e.column,y1:e.row,dx:e.column-t.column,dy:e.row-t.row}}function o(t,e,r,n,i){var o=Math.max(r,Math.floor(e.y0)),a=Math.min(n,Math.ceil(e.y1));if(t.x0===e.x0&&t.y0===e.y0?t.x0+e.dy/t.dy*t.dx<e.x1:t.x1-e.dy/t.dy*t.dx<e.x0){var s=t;t=e,e=s}for(var l=t.dx/t.dy,u=e.dx/e.dy,c=t.dx>0,h=e.dx<0,f=o;a>f;f++){var d=l*Math.max(0,Math.min(t.dy,f+c-t.y0))+t.x0,p=u*Math.max(0,Math.min(e.dy,f+h-e.y0))+e.x0;i(Math.floor(p),Math.ceil(d),f)}}function a(t,e,r,n,a,s){var l,u=i(t,e),c=i(e,r),h=i(r,t);u.dy>c.dy&&(l=u,u=c,c=l),u.dy>h.dy&&(l=u,u=h,h=l),c.dy>h.dy&&(l=c,c=h,h=l),u.dy&&o(h,u,n,a,s),c.dy&&o(h,c,n,a,s)}var s=t("assert"),l=t("../geo/coordinate");e.exports=n,n.prototype.toString=function(){return this.z+"/"+this.x+"/"+this.y},n.prototype.toCoordinate=function(t){var e=Math.min(this.z,t),r=Math.pow(2,e),n=this.y,i=this.x+r*this.w;return new l(i,n,e)},n.fromID=function(t){var e=t%32,r=1<<e,i=(t-e)/32,o=i%r,a=(i-o)/r%r,s=Math.floor(i/(r*r));return s%2!==0&&(s=-1*s-1),s/=2,new n(e,o,a,s)},n.prototype.url=function(t,e){return t[(this.x+this.y)%t.length].replace("{prefix}",(this.x%16).toString(16)+(this.y%16).toString(16)).replace("{z}",Math.min(this.z,e||this.z)).replace("{x}",this.x).replace("{y}",this.y)},n.prototype.parent=function(t){return 0===this.z?null:this.z>t?new n(this.z-1,this.x,this.y,this.w):new n(this.z-1,Math.floor(this.x/2),Math.floor(this.y/2),this.w)},n.prototype.wrapped=function(){return new n(this.z,this.x,this.y,0)},n.prototype.children=function(t){if(this.z>=t)return[new n(this.z+1,this.x,this.y,this.w)];var e=this.z+1,r=2*this.x,i=2*this.y;return[new n(e,r,i,this.w),new n(e,r+1,i,this.w),new n(e,r,i+1,this.w),new n(e,r+1,i+1,this.w)]},n.cover=function(t,e,r){function i(t,e,i){var a,l,u;if(i>=0&&o>=i)for(a=t;e>a;a++)l=(a%o+o)%o,u=new n(r,l,i,Math.floor(a/o)),s[u.id]=u}var o=1<<t,s={};return a(e[0],e[1],e[2],0,o,i),a(e[2],e[3],e[0],0,o,i),Object.keys(s).map(function(t){return s[t]})}},{"../geo/coordinate":255,assert:52}],282:[function(t,e,r){"use strict";function n(t){this.tileSize=t.tileSize,this.minzoom=t.minzoom,this.maxzoom=t.maxzoom,this.roundZoom=t.roundZoom,this.reparseOverscaled=t.reparseOverscaled,this._load=t.load,this._abort=t.abort,this._unload=t.unload,this._add=t.add,this._remove=t.remove,this._redoPlacement=t.redoPlacement,this._tiles={},this._cache=new u(0,function(t){return this._unload(t)}.bind(this)),this._filterRendered=this._filterRendered.bind(this)}function i(t,e,r){var n=r.zoomTo(Math.min(t.z,e));return{x:(n.column-(t.x+t.w*Math.pow(2,t.z)))*f,y:(n.row-t.y)*f}}function o(t,e){return t%32-e%32}var a=t("./tile"),s=t("./tile_coord"),l=t("point-geometry"),u=t("../util/lru_cache"),c=t("../geo/coordinate"),h=t("../util/util"),f=t("../data/bucket").EXTENT;e.exports=n,n.maxOverzooming=10,n.maxUnderzooming=3,n.prototype={loaded:function(){for(var t in this._tiles)if(!this._tiles[t].loaded&&!this._tiles[t].errored)return!1;return!0},orderedIDs:function(){return Object.keys(this._tiles).map(Number).sort(o)},renderedIDs:function(){return this.orderedIDs().filter(this._filterRendered)},_filterRendered:function(t){return this._tiles[t].loaded&&!this._coveredTiles[t]},reload:function(){this._cache.reset();for(var t in this._tiles)this._load(this._tiles[t])},getTile:function(t){return this._tiles[t]},getZoom:function(t){return t.zoom+Math.log(t.tileSize/this.tileSize)/Math.LN2},coveringZoomLevel:function(t){return(this.roundZoom?Math.round:Math.floor)(this.getZoom(t))},coveringTiles:function(t){var e=this.coveringZoomLevel(t),r=e;if(e<this.minzoom)return[];e>this.maxzoom&&(e=this.maxzoom);var n=t,i=n.locationCoordinate(n.center)._zoomTo(e),o=new l(i.column-.5,i.row-.5);return s.cover(e,[n.pointCoordinate(new l(0,0))._zoomTo(e),n.pointCoordinate(new l(n.width,0))._zoomTo(e),n.pointCoordinate(new l(n.width,n.height))._zoomTo(e),n.pointCoordinate(new l(0,n.height))._zoomTo(e)],this.reparseOverscaled?r:e).sort(function(t,e){return o.dist(t)-o.dist(e)})},findLoadedChildren:function(t,e,r){var n=!1;for(var i in this._tiles){var o=this._tiles[i];if(!(r[i]||!o.loaded||o.coord.z<=t.z||o.coord.z>e)){
var a=Math.pow(2,Math.min(o.coord.z,this.maxzoom)-Math.min(t.z,this.maxzoom));if(Math.floor(o.coord.x/a)===t.x&&Math.floor(o.coord.y/a)===t.y)for(r[i]=!0,n=!0;o&&o.coord.z-1>t.z;){var s=o.coord.parent(this.maxzoom).id;o=this._tiles[s],o&&o.loaded&&(delete r[i],r[s]=!0)}}}return n},findLoadedParent:function(t,e,r){for(var n=t.z-1;n>=e;n--){t=t.parent(this.maxzoom);var i=this._tiles[t.id];if(i&&i.loaded)return r[t.id]=!0,i;if(this._cache.has(t.id))return this.addTile(t),r[t.id]=!0,this._tiles[t.id]}},updateCacheSize:function(t){var e=Math.ceil(t.width/t.tileSize)+1,r=Math.ceil(t.height/t.tileSize)+1,n=e*r,i=5;this._cache.setMaxSize(Math.floor(n*i))},update:function(t,e,r){var i,o,a;this.updateCacheSize(e);var l=(this.roundZoom?Math.round:Math.floor)(this.getZoom(e)),u=Math.max(l-n.maxOverzooming,this.minzoom),c=Math.max(l+n.maxUnderzooming,this.minzoom),f={},d=(new Date).getTime();this._coveredTiles={};var p=t?this.coveringTiles(e):[];for(i=0;i<p.length;i++)o=p[i],a=this.addTile(o),f[o.id]=!0,a.loaded||this.findLoadedChildren(o,c,f)||this.findLoadedParent(o,u,f);for(var v={},m=Object.keys(f),g=0;g<m.length;g++){var y=m[g];o=s.fromID(y),a=this._tiles[y],a&&a.timeAdded>d-(r||0)&&(this.findLoadedChildren(o,c,f)&&(f[y]=!0),this.findLoadedParent(o,u,v))}var b;for(b in v)f[b]||(this._coveredTiles[b]=!0);for(b in v)f[b]=!0;var x=h.keysDifference(this._tiles,f);for(i=0;i<x.length;i++)this.removeTile(+x[i]);this.transform=e},addTile:function(t){var e=this._tiles[t.id];if(e)return e;var r=t.wrapped();if(e=this._tiles[r.id],e||(e=this._cache.get(r.id),e&&this._redoPlacement&&this._redoPlacement(e)),!e){var n=t.z,i=n>this.maxzoom?Math.pow(2,n-this.maxzoom):1;e=new a(r,this.tileSize*i,this.maxzoom),this._load(e)}return e.uses++,this._tiles[t.id]=e,this._add(e,t),e},removeTile:function(t){var e=this._tiles[t];e&&(e.uses--,delete this._tiles[t],this._remove(e),e.uses>0||(e.loaded?this._cache.add(e.coord.wrapped().id,e):(this._abort(e),this._unload(e))))},clearTiles:function(){for(var t in this._tiles)this.removeTile(t);this._cache.reset()},tilesIn:function(t){for(var e={},r=this.orderedIDs(),n=1/0,o=1/0,a=-(1/0),l=-(1/0),u=t[0].zoom,h=0;h<t.length;h++){var d=t[h];n=Math.min(n,d.column),o=Math.min(o,d.row),a=Math.max(a,d.column),l=Math.max(l,d.row)}for(var p=0;p<r.length;p++){var v=this._tiles[r[p]],m=s.fromID(r[p]),g=[i(m,v.sourceMaxZoom,new c(n,o,u)),i(m,v.sourceMaxZoom,new c(a,l,u))];if(g[0].x<f&&g[0].y<f&&g[1].x>=0&&g[1].y>=0){for(var y=[],b=0;b<t.length;b++)y.push(i(m,v.sourceMaxZoom,t[b]));var x=e[v.coord.id];void 0===x&&(x=e[v.coord.id]={tile:v,queryGeometry:[],scale:Math.pow(2,this.transform.zoom-v.coord.z)}),x.queryGeometry.push(y)}}var _=[];for(var w in e)_.push(e[w]);return _}}},{"../data/bucket":247,"../geo/coordinate":255,"../util/lru_cache":345,"../util/util":349,"./tile":280,"./tile_coord":281,"point-geometry":404}],283:[function(t,e,r){"use strict";function n(t){if(i.extend(this,i.pick(t,["url","tileSize"])),this._options=i.extend({type:"vector"},t),512!==this.tileSize)throw new Error("vector tile sources must have a tileSize of 512");a._loadTileJSON.call(this,t)}var i=t("../util/util"),o=t("../util/evented"),a=t("./source"),s=t("../util/mapbox").normalizeTileURL;e.exports=n,n.prototype=i.inherit(o,{minzoom:0,maxzoom:22,tileSize:512,reparseOverscaled:!0,_loaded:!1,isTileClipped:!0,onAdd:function(t){this.map=t},loaded:function(){return this._pyramid&&this._pyramid.loaded()},update:function(t){this._pyramid&&this._pyramid.update(this.used,t)},reload:function(){this._pyramid&&this._pyramid.reload()},serialize:function(){return i.extend({},this._options)},getVisibleCoordinates:a._getVisibleCoordinates,getTile:a._getTile,queryRenderedFeatures:a._queryRenderedVectorFeatures,querySourceFeatures:a._querySourceFeatures,_loadTile:function(t){var e=t.coord.z>this.maxzoom?Math.pow(2,t.coord.z-this.maxzoom):1,r={url:s(t.coord.url(this.tiles,this.maxzoom),this.url),uid:t.uid,coord:t.coord,zoom:t.coord.z,tileSize:this.tileSize*e,source:this.id,overscaling:e,angle:this.map.transform.angle,pitch:this.map.transform.pitch,showCollisionBoxes:this.map.showCollisionBoxes};t.workerID?(r.rawTileData=t.rawTileData,this.dispatcher.send("reload tile",r,this._tileLoaded.bind(this,t),t.workerID)):t.workerID=this.dispatcher.send("load tile",r,this._tileLoaded.bind(this,t))},_tileLoaded:function(t,e,r){if(!t.aborted){if(e)return t.errored=!0,void this.fire("tile.error",{tile:t,error:e});t.loadVectorData(r,this.map.style),t.redoWhenDone&&(t.redoWhenDone=!1,t.redoPlacement(this)),this.fire("tile.load",{tile:t}),this.fire("tile.stats",r.bucketStats)}},_abortTile:function(t){t.aborted=!0,this.dispatcher.send("abort tile",{uid:t.uid,source:this.id},null,t.workerID)},_addTile:function(t){this.fire("tile.add",{tile:t})},_removeTile:function(t){this.fire("tile.remove",{tile:t})},_unloadTile:function(t){t.unloadVectorData(this.map.painter),this.dispatcher.send("remove tile",{uid:t.uid,source:this.id},null,t.workerID)},redoPlacement:a.redoPlacement,_redoTilePlacement:function(t){t.redoPlacement(this)}})},{"../util/evented":341,"../util/mapbox":346,"../util/util":349,"./source":279}],284:[function(t,e,r){"use strict";function n(t){this.urls=t.urls,this.coordinates=t.coordinates,c.getVideo(t.urls,function(e,r){if(!e){this.video=r,this.video.loop=!0;var n;this.video.addEventListener("playing",function(){n=this.map.style.animationLoop.set(1/0),this.map._rerender()}.bind(this)),this.video.addEventListener("pause",function(){this.map.style.animationLoop.cancel(n)}.bind(this)),this._loaded=!0,this.map&&(this.video.play(),this.setCoordinates(t.coordinates))}}.bind(this))}var i=t("../util/util"),o=t("./tile"),a=t("./tile_coord"),s=t("../geo/lng_lat"),l=t("point-geometry"),u=t("../util/evented"),c=t("../util/ajax"),h=t("../data/bucket").EXTENT,f=t("../render/draw_raster").RasterBoundsArray,d=t("../data/buffer"),p=t("../render/vertex_array_object");e.exports=n,n.prototype=i.inherit(u,{roundZoom:!0,getVideo:function(){return this.video},onAdd:function(t){this.map=t,this.video&&(this.video.play(),this.setCoordinates(this.coordinates))},setCoordinates:function(t){this.coordinates=t;var e=this.map,r=t.map(function(t){return e.transform.locationCoordinate(s.convert(t)).zoomTo(0)}),n=this.centerCoord=i.getCoordinatesCenter(r);n.column=Math.round(n.column),n.row=Math.round(n.row);var u=r.map(function(t){var e=t.zoomTo(n.zoom);return new l(Math.round((e.column-n.column)*h),Math.round((e.row-n.row)*h))}),c=32767,v=new f;return v.emplaceBack(u[0].x,u[0].y,0,0),v.emplaceBack(u[1].x,u[1].y,c,0),v.emplaceBack(u[3].x,u[3].y,0,c),v.emplaceBack(u[2].x,u[2].y,c,c),this.tile=new o(new a(n.zoom,n.column,n.row)),this.tile.buckets={},this.tile.boundsBuffer=new d(v.serialize(),f.serialize(),d.BufferType.VERTEX),this.tile.boundsVAO=new p,this.fire("change"),this},loaded:function(){return this.video&&this.video.readyState>=2},update:function(){},reload:function(){},prepare:function(){if(this._loaded&&!(this.video.readyState<2)){var t=this.map.painter.gl;this.tile.texture?(t.bindTexture(t.TEXTURE_2D,this.tile.texture),t.texSubImage2D(t.TEXTURE_2D,0,0,0,t.RGBA,t.UNSIGNED_BYTE,this.video)):(this.tile.texture=t.createTexture(),t.bindTexture(t.TEXTURE_2D,this.tile.texture),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,this.video)),this._currentTime=this.video.currentTime}},getVisibleCoordinates:function(){return this.tile?[this.tile.coord]:[]},getTile:function(){return this.tile},serialize:function(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}})},{"../data/bucket":247,"../data/buffer":252,"../geo/lng_lat":256,"../render/draw_raster":267,"../render/vertex_array_object":273,"../util/ajax":334,"../util/evented":341,"../util/util":349,"./tile":280,"./tile_coord":281,"point-geometry":404}],285:[function(t,e,r){"use strict";function n(t){this.self=t,this.actor=new o(t,this),this.loading={},this.loaded={},this.geoJSONIndexes={}}function i(t){var e={};for(var r in t){var n=t[r],i=n.ref||n.id,o=t[i];o.layout&&"none"===o.layout.visibility||(e[i]=e[i]||[],r===i?e[i].unshift(n):e[i].push(n))}return e}var o=t("../util/actor"),a=t("./worker_tile"),s=t("../style/style_layer"),l=t("../util/util"),u=t("../util/ajax"),c=t("vector-tile"),h=t("pbf"),f=t("supercluster"),d=t("geojson-vt"),p=t("geojson-rewind"),v=t("./geojson_wrapper"),m=t("vt-pbf");e.exports=function(t){return new n(t)},l.extend(n.prototype,{"set layers":function(t){function e(t){var e=s.create(t,t.ref&&r.layers[t.ref]);e.updatePaintTransitions({},{transition:!1}),r.layers[e.id]=e}this.layers={};for(var r=this,n=[],o=0;o<t.length;o++){var a=t[o];"fill"!==a.type&&"line"!==a.type&&"circle"!==a.type&&"symbol"!==a.type||(a.ref?n.push(o):e(a))}for(var l=0;l<n.length;l++)e(t[n[l]]);this.layerFamilies=i(this.layers)},"update layers":function(t){function e(t){var e=o.layers[t.ref];o.layers[t.id]?o.layers[t.id].set(t,e):o.layers[t.id]=s.create(t,e),o.layers[t.id].updatePaintTransitions({},{transition:!1})}var r,n,o=this;for(r in t)n=t[r],n.ref&&e(n);for(r in t)n=t[r],n.ref||e(n);this.layerFamilies=i(this.layers)},"load tile":function(t,e){function r(t,r){return delete this.loading[n][i],t?e(t):(o.data=new c.VectorTile(new h(new Uint8Array(r))),o.parse(o.data,this.layerFamilies,this.actor,r,e),this.loaded[n]=this.loaded[n]||{},void(this.loaded[n][i]=o))}var n=t.source,i=t.uid;this.loading[n]||(this.loading[n]={});var o=this.loading[n][i]=new a(t);o.xhr=u.getArrayBuffer(t.url,r.bind(this))},"reload tile":function(t,e){var r=this.loaded[t.source],n=t.uid;if(r&&r[n]){var i=r[n];i.parse(i.data,this.layerFamilies,this.actor,t.rawTileData,e)}},"abort tile":function(t){var e=this.loading[t.source],r=t.uid;e&&e[r]&&(e[r].xhr.abort(),delete e[r])},"remove tile":function(t){var e=this.loaded[t.source],r=t.uid;e&&e[r]&&delete e[r]},"redo placement":function(t,e){var r=this.loaded[t.source],n=this.loading[t.source],i=t.uid;if(r&&r[i]){var o=r[i],a=o.redoPlacement(t.angle,t.pitch,t.showCollisionBoxes);a.result&&e(null,a.result,a.transferables)}else n&&n[i]&&(n[i].angle=t.angle)},"parse geojson":function(t,e){var r=function(r,n){if(p(n,!0),r)return e(r);if("object"!=typeof n)return e(new Error("Input data is not a valid GeoJSON object."));try{this.geoJSONIndexes[t.source]=t.cluster?f(t.superclusterOptions).load(n.features):d(n,t.geojsonVtOptions)}catch(r){return e(r)}e(null)}.bind(this);if(t.url)u.getJSON(t.url,r);else{if("string"!=typeof t.data)return e(new Error("Input data is not a valid GeoJSON object."));r(null,JSON.parse(t.data))}},"load geojson tile":function(t,e){var r=t.source,n=t.coord;if(!this.geoJSONIndexes[r])return e(null,null);var i=this.geoJSONIndexes[r].getTile(Math.min(n.z,t.maxZoom),n.x,n.y),o=i?new a(t):void 0;if(this.loaded[r]=this.loaded[r]||{},this.loaded[r][t.uid]=o,!i)return e(null,null);var s=new v(i.features);s.name="_geojsonTileLayer";var l=m({layers:{_geojsonTileLayer:s}}).buffer;o.parse(s,this.layerFamilies,this.actor,l,e)}})},{"../style/style_layer":293,"../util/actor":333,"../util/ajax":334,"../util/util":349,"./geojson_wrapper":275,"./worker_tile":286,"geojson-rewind":353,"geojson-vt":358,pbf:402,supercluster:407,"vector-tile":413,"vt-pbf":417}],286:[function(t,e,r){"use strict";function n(t){this.coord=t.coord,this.uid=t.uid,this.zoom=t.zoom,this.tileSize=t.tileSize,this.source=t.source,this.overscaling=t.overscaling,this.angle=t.angle,this.pitch=t.pitch,this.showCollisionBoxes=t.showCollisionBoxes}function i(t){for(var e in t.arrayGroups)for(var r=t.arrayGroups[e],n=0;n<r.length;n++){var i=r[n];for(var o in i){var a=i[o];for(var s in a)if(a[s].length>0)return!0}}return!1}function o(t){return t.serialize()}function a(t){var e=[];for(var r in t){var n=t[r];for(var i in n.arrayGroups)for(var o=n.arrayGroups[i],a=0;a<o.length;a++){var s=o[a];for(var l in s){var u=s[l];for(var c in u)e.push(u[c].arrayBuffer)}}}return e}function s(t){return t.id}var l=t("../data/feature_index"),u=t("../symbol/collision_tile"),c=t("../data/bucket"),h=t("../symbol/collision_box"),f=t("../util/dictionary_coder");e.exports=n,n.prototype.parse=function(t,e,r,n,d){function p(t,e){for(var r=0;r<t.length;r++){var n=t.feature(r);n.index=r;for(var i in e)e[i].filter(n)&&e[i].features.push(n)}}function v(t){if(t)return d(t);if(F++,2===F){for(var e=P.length-1;e>=0;e--)m(T,P[e]);g()}}function m(t,e){var r=Date.now();e.populateBuffers(w,O,D);var n=Date.now()-r;if("symbol"!==e.type)for(var i=0;i<e.features.length;i++){var o=e.features[i];M.insert(o,o.index,e.sourceLayerIndex,e.index)}e.features=null,A._total+=n,A[e.id]=(A[e.id]||0)+n}function g(){T.status="done",T.redoPlacementAfterDone&&(T.redoPlacement(T.angle,T.pitch,null),T.redoPlacementAfterDone=!1);var t=M.serialize(),e=w.serialize(),r=T.collisionBoxArray.serialize(),s=[n].concat(t.transferables).concat(e.transferables),l=I.filter(i);d(null,{buckets:l.map(o),bucketStats:A,featureIndex:t.data,collisionTile:e.data,collisionBoxArray:r,rawTileData:n},a(l).concat(s))}this.status="parsing",this.data=t,this.collisionBoxArray=new h;var y,b,x,_,w=new u(this.angle,this.pitch,this.collisionBoxArray),M=new l(this.coord,this.overscaling,w,t.layers),k=new f(t.layers?Object.keys(t.layers).sort():["_geojsonTileLayer"]),A={_total:0},T=this,E={},S={},L=0;for(var z in e)b=e[z][0],b.source===this.source&&(b.ref||b.minzoom&&this.zoom<b.minzoom||b.maxzoom&&this.zoom>=b.maxzoom||b.layout&&"none"===b.layout.visibility||t.layers&&!t.layers[b.sourceLayer]||(_=c.create({layer:b,index:L++,childLayers:e[z],zoom:this.zoom,overscaling:this.overscaling,showCollisionBoxes:this.showCollisionBoxes,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:k.encode(b.sourceLayer||"_geojsonTileLayer")}),_.createFilter(),E[b.id]=_,t.layers&&(x=b.sourceLayer,S[x]=S[x]||{},S[x][b.id]=_)));if(t.layers)for(x in S)b=t.layers[x],b&&p(b,S[x]);else p(t,E);var I=[],P=this.symbolBuckets=[],C=[];M.bucketLayerIDs={};for(var R in E)_=E[R],0!==_.features.length&&(M.bucketLayerIDs[_.index]=_.childLayers.map(s),I.push(_),"symbol"===_.type?P.push(_):C.push(_));var D={},O={},F=0;if(P.length>0){for(y=P.length-1;y>=0;y--)P[y].updateIcons(D),P[y].updateFont(O);for(var j in O)O[j]=Object.keys(O[j]).map(Number);D=Object.keys(D),r.send("get glyphs",{uid:this.uid,stacks:O},function(t,e){O=e,v(t)}),D.length?r.send("get icons",{icons:D},function(t,e){D=e,v(t)}):v()}for(y=C.length-1;y>=0;y--)m(this,C[y]);return 0===P.length?g():void 0},n.prototype.redoPlacement=function(t,e,r){if("done"!==this.status)return this.redoPlacementAfterDone=!0,this.angle=t,{};for(var n=new u(t,e,this.collisionBoxArray),s=this.symbolBuckets,l=s.length-1;l>=0;l--)s[l].placeFeatures(n,r);var c=n.serialize(),h=s.filter(i);return{result:{buckets:h.map(o),collisionTile:c.data},transferables:a(h).concat(c.transferables)}}},{"../data/bucket":247,"../data/feature_index":253,"../symbol/collision_box":306,"../symbol/collision_tile":308,"../util/dictionary_coder":340}],287:[function(t,e,r){"use strict";function n(){this.n=0,this.times=[]}e.exports=n,n.prototype.stopped=function(){return this.times=this.times.filter(function(t){return t.time>=(new Date).getTime()}),!this.times.length},n.prototype.set=function(t){return this.times.push({id:this.n,time:t+(new Date).getTime()}),this.n++},n.prototype.cancel=function(t){this.times=this.times.filter(function(e){return e.id!==t})}},{}],288:[function(t,e,r){"use strict";function n(t){this.base=t,this.retina=s.devicePixelRatio>1;var e=this.retina?"@2x":"";a.getJSON(l(t,e,".json"),function(t,e){return t?void this.fire("error",{error:t}):(this.data=e,void(this.img&&this.fire("load")))}.bind(this)),a.getImage(l(t,e,".png"),function(t,e){if(t)return void this.fire("error",{error:t});for(var r=e.getData(),n=e.data=new Uint8Array(r.length),i=0;i<r.length;i+=4){var o=r[i+3]/255;n[i+0]=r[i+0]*o,n[i+1]=r[i+1]*o,n[i+2]=r[i+2]*o,n[i+3]=r[i+3]}this.img=e,this.data&&this.fire("load")}.bind(this))}function i(){}var o=t("../util/evented"),a=t("../util/ajax"),s=t("../util/browser"),l=t("../util/mapbox").normalizeSpriteURL;e.exports=n,n.prototype=Object.create(o),n.prototype.toJSON=function(){return this.base},n.prototype.loaded=function(){return!(!this.data||!this.img)},n.prototype.resize=function(){if(s.devicePixelRatio>1!==this.retina){var t=new n(this.base);t.on("load",function(){this.img=t.img,this.data=t.data,this.retina=t.retina}.bind(this))}},i.prototype={x:0,y:0,width:0,height:0,pixelRatio:1,sdf:!1},n.prototype.getSpritePosition=function(t){if(!this.loaded())return new i;var e=this.data&&this.data[t];return e&&this.img?e:new i}},{"../util/ajax":334,"../util/browser":335,"../util/evented":341,"../util/mapbox":346}],289:[function(t,e,r){"use strict";function n(t){if(l[t])return l[t];if(Array.isArray(t))return t;if(t&&t.stops)return s.extend({},t,{stops:t.stops.map(i)});if("string"==typeof t){var e=a(t);if(!e)throw new Error("Invalid color "+t);var r=o(e);return l[t]=r,r}throw new Error("Invalid color "+t)}function i(t){return[t[0],n(t[1])]}function o(t){return[t[0]/255,t[1]/255,t[2]/255,t[3]/1]}var a=t("csscolorparser").parseCSSColor,s=t("../util/util"),l={};e.exports=n},{"../util/util":349,csscolorparser:351}],290:[function(t,e,r){"use strict";function n(t,e){this.animationLoop=e||new v,this.dispatcher=new p(Math.max(d.hardwareConcurrency-1,1),this),this.spriteAtlas=new l(512,512),this.lineAtlas=new u(256,512),this._layers={},this._order=[],this._groups=[],this.sources={},this.zoomHistory={},c.bindAll(["_forwardSourceEvent","_forwardTileEvent","_forwardLayerEvent","_redoPlacement"],this),this._resetUpdates();var r=function(t,e){if(t)return void this.fire("error",{error:t});if(!m.emitErrors(this,m(e))){this._loaded=!0,this.stylesheet=e,this.updateClasses();var r=e.sources;for(var n in r)this.addSource(n,r[n]);e.sprite&&(this.sprite=new a(e.sprite),this.sprite.on("load",this.fire.bind(this,"change"))),this.glyphSource=new s(e.glyphs),this._resolve(),this.fire("load")}}.bind(this);"string"==typeof t?h.getJSON(f(t),r):d.frame(r.bind(this,null,t)),this.on("source.load",function(t){var e=t.source;if(e&&e.vectorLayerIds)for(var r in this._layers){var n=this._layers[r];n.source===e.id&&this._validateLayer(n)}})}var i=t("../util/evented"),o=t("./style_layer"),a=t("./image_sprite"),s=t("../symbol/glyph_source"),l=t("../symbol/sprite_atlas"),u=t("../render/line_atlas"),c=t("../util/util"),h=t("../util/ajax"),f=t("../util/mapbox").normalizeStyleURL,d=t("../util/browser"),p=t("../util/dispatcher"),v=t("./animation_loop"),m=t("./validate_style"),g=t("../source/source"),y=t("./style_spec"),b=t("./style_function");e.exports=n,n.prototype=c.inherit(i,{_loaded:!1,_validateLayer:function(t){var e=this.sources[t.source];t.sourceLayer&&e&&e.vectorLayerIds&&-1===e.vectorLayerIds.indexOf(t.sourceLayer)&&this.fire("error",{error:new Error('Source layer "'+t.sourceLayer+'" does not exist on source "'+e.id+'" as specified by style layer "'+t.id+'"')})},loaded:function(){if(!this._loaded)return!1;for(var t in this.sources)if(!this.sources[t].loaded())return!1;return!this.sprite||this.sprite.loaded()},_resolve:function(){var t,e;this._layers={},this._order=this.stylesheet.layers.map(function(t){return t.id});for(var r=0;r<this.stylesheet.layers.length;r++)e=this.stylesheet.layers[r],e.ref||(t=o.create(e),this._layers[t.id]=t,t.on("error",this._forwardLayerEvent));for(var n=0;n<this.stylesheet.layers.length;n++)if(e=this.stylesheet.layers[n],e.ref){var i=this.getLayer(e.ref);t=o.create(e,i),this._layers[t.id]=t,t.on("error",this._forwardLayerEvent)}this._groupLayers(),this._updateWorkerLayers()},_groupLayers:function(){var t;this._groups=[];for(var e=0;e<this._order.length;++e){var r=this._layers[this._order[e]];t&&r.source===t.source||(t=[],t.source=r.source,this._groups.push(t)),t.push(r)}},_updateWorkerLayers:function(t){this.dispatcher.broadcast(t?"update layers":"set layers",this._serializeLayers(t))},_serializeLayers:function(t){t=t||this._order;for(var e=[],r={includeRefProperties:!0},n=0;n<t.length;n++)e.push(this._layers[t[n]].serialize(r));return e},_applyClasses:function(t,e){if(this._loaded){t=t||[],e=e||{transition:!0};var r=this.stylesheet.transition||{},n=this._updates.allPaintProps?this._layers:this._updates.paintProps;for(var i in n){var o=this._layers[i],a=this._updates.paintProps[i];if(this._updates.allPaintProps||a.all)o.updatePaintTransitions(t,e,r,this.animationLoop);else for(var s in a)this._layers[i].updatePaintTransition(s,t,e,r,this.animationLoop)}}},_recalculate:function(t){for(var e in this.sources)this.sources[e].used=!1;this._updateZoomHistory(t),this.rasterFadeDuration=300;for(var r in this._layers){var n=this._layers[r];n.recalculate(t,this.zoomHistory),!n.isHidden(t)&&n.source&&(this.sources[n.source].used=!0)}var i=300;Math.floor(this.z)!==Math.floor(t)&&this.animationLoop.set(i),this.z=t,this.fire("zoom")},_updateZoomHistory:function(t){var e=this.zoomHistory;void 0===e.lastIntegerZoom&&(e.lastIntegerZoom=Math.floor(t),e.lastIntegerZoomTime=0,e.lastZoom=t),Math.floor(e.lastZoom)<Math.floor(t)?(e.lastIntegerZoom=Math.floor(t),e.lastIntegerZoomTime=Date.now()):Math.floor(e.lastZoom)>Math.floor(t)&&(e.lastIntegerZoom=Math.floor(t+1),e.lastIntegerZoomTime=Date.now()),e.lastZoom=t},_checkLoaded:function(){if(!this._loaded)throw new Error("Style is not done loading")},update:function(t,e){if(!this._updates.changed)return this;if(this._updates.allLayers)this._groupLayers(),this._updateWorkerLayers();else{var r=Object.keys(this._updates.layers);r.length&&this._updateWorkerLayers(r)}var n,i=Object.keys(this._updates.sources);for(n=0;n<i.length;n++)this._reloadSource(i[n]);for(n=0;n<this._updates.events.length;n++){var o=this._updates.events[n];this.fire(o[0],o[1])}return this._applyClasses(t,e),this._updates.changed&&this.fire("change"),this._resetUpdates(),this},_resetUpdates:function(){this._updates={events:[],layers:{},sources:{},paintProps:{}}},addSource:function(t,e){if(this._checkLoaded(),void 0!==this.sources[t])throw new Error("There is already a source with this ID");return!g.is(e)&&this._handleErrors(m.source,"sources."+t,e)?this:(e=g.create(e),this.sources[t]=e,e.id=t,e.style=this,e.dispatcher=this.dispatcher,e.on("load",this._forwardSourceEvent).on("error",this._forwardSourceEvent).on("change",this._forwardSourceEvent).on("tile.add",this._forwardTileEvent).on("tile.load",this._forwardTileEvent).on("tile.error",this._forwardTileEvent).on("tile.remove",this._forwardTileEvent).on("tile.stats",this._forwardTileEvent),this._updates.events.push(["source.add",{source:e}]),this._updates.changed=!0,this)},removeSource:function(t){if(this._checkLoaded(),void 0===this.sources[t])throw new Error("There is no source with this ID");var e=this.sources[t];return delete this.sources[t],e.off("load",this._forwardSourceEvent).off("error",this._forwardSourceEvent).off("change",this._forwardSourceEvent).off("tile.add",this._forwardTileEvent).off("tile.load",this._forwardTileEvent).off("tile.error",this._forwardTileEvent).off("tile.remove",this._forwardTileEvent).off("tile.stats",this._forwardTileEvent),this._updates.events.push(["source.remove",{source:e}]),this._updates.changed=!0,this},getSource:function(t){return this.sources[t]},addLayer:function(t,e){if(this._checkLoaded(),!(t instanceof o)){if(this._handleErrors(m.layer,"layers."+t.id,t,!1,{arrayIndex:-1}))return this;var r=t.ref&&this.getLayer(t.ref);t=o.create(t,r)}return this._validateLayer(t),t.on("error",this._forwardLayerEvent),this._layers[t.id]=t,this._order.splice(e?this._order.indexOf(e):1/0,0,t.id),this._updates.allLayers=!0,t.source&&(this._updates.sources[t.source]=!0),this._updates.events.push(["layer.add",{layer:t}]),this.updateClasses(t.id)},removeLayer:function(t){this._checkLoaded();var e=this._layers[t];if(void 0===e)throw new Error("There is no layer with this ID");for(var r in this._layers)this._layers[r].ref===t&&this.removeLayer(r);return e.off("error",this._forwardLayerEvent),delete this._layers[t],this._order.splice(this._order.indexOf(t),1),this._updates.allLayers=!0,this._updates.events.push(["layer.remove",{layer:e}]),this._updates.changed=!0,this},getLayer:function(t){return this._layers[t]},getReferentLayer:function(t){var e=this.getLayer(t);return e.ref&&(e=this.getLayer(e.ref)),e},setLayerZoomRange:function(t,e,r){this._checkLoaded();var n=this.getReferentLayer(t);return n.minzoom===e&&n.maxzoom===r?this:(null!=e&&(n.minzoom=e),null!=r&&(n.maxzoom=r),this._updateLayer(n))},setFilter:function(t,e){this._checkLoaded();var r=this.getReferentLayer(t);return this._handleErrors(m.filter,"layers."+r.id+".filter",e)?this:c.deepEqual(r.filter,e)?this:(r.filter=c.clone(e),this._updateLayer(r))},getFilter:function(t){return this.getReferentLayer(t).filter},setLayoutProperty:function(t,e,r){this._checkLoaded();var n=this.getReferentLayer(t);return c.deepEqual(n.getLayoutProperty(e),r)?this:(n.setLayoutProperty(e,r),this._updateLayer(n))},getLayoutProperty:function(t,e){return this.getReferentLayer(t).getLayoutProperty(e)},setPaintProperty:function(t,e,r,n){this._checkLoaded();var i=this.getLayer(t);if(c.deepEqual(i.getPaintProperty(e,n),r))return this;var o=i.isPaintValueFeatureConstant(e);i.setPaintProperty(e,r,n);var a=!(b.isFunctionDefinition(r)&&"$zoom"!==r.property&&void 0!==r.property);return a&&o||(this._updates.layers[t]=!0,i.source&&(this._updates.sources[i.source]=!0)),this.updateClasses(t,e)},getPaintProperty:function(t,e,r){return this.getLayer(t).getPaintProperty(e,r)},updateClasses:function(t,e){if(this._updates.changed=!0,t){var r=this._updates.paintProps;r[t]||(r[t]={}),r[t][e||"all"]=!0}else this._updates.allPaintProps=!0;return this},serialize:function(){return c.filterObject({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,center:this.stylesheet.center,zoom:this.stylesheet.zoom,bearing:this.stylesheet.bearing,pitch:this.stylesheet.pitch,sprite:this.stylesheet.sprite,glyphs:this.stylesheet.glyphs,transition:this.stylesheet.transition,sources:c.mapObject(this.sources,function(t){return t.serialize()}),layers:this._order.map(function(t){return this._layers[t].serialize()},this)},function(t){return void 0!==t})},_updateLayer:function(t){return this._updates.layers[t.id]=!0,t.source&&(this._updates.sources[t.source]=!0),this._updates.changed=!0,this},_flattenRenderedFeatures:function(t){for(var e=[],r=this._order.length-1;r>=0;r--)for(var n=this._order[r],i=0;i<t.length;i++){var o=t[i][n];if(o)for(var a=0;a<o.length;a++)e.push(o[a])}return e},queryRenderedFeatures:function(t,e,r,n){e&&e.filter&&this._handleErrors(m.filter,"queryRenderedFeatures.filter",e.filter,!0);var i=[];for(var o in this.sources){var a=this.sources[o];a.queryRenderedFeatures&&i.push(a.queryRenderedFeatures(t,e,r,n))}return this._flattenRenderedFeatures(i)},querySourceFeatures:function(t,e){e&&e.filter&&this._handleErrors(m.filter,"querySourceFeatures.filter",e.filter,!0);var r=this.getSource(t);return r&&r.querySourceFeatures?r.querySourceFeatures(e):[]},_handleErrors:function(t,e,r,n,i){var o=n?m.throwErrors:m.emitErrors,a=t.call(m,c.extend({key:e,style:this.serialize(),value:r,styleSpec:y},i));return o.call(m,this,a)},_remove:function(){this.dispatcher.remove()},_reloadSource:function(t){this.sources[t].reload()},_updateSources:function(t){for(var e in this.sources)this.sources[e].update(t)},_redoPlacement:function(){for(var t in this.sources)this.sources[t].redoPlacement&&this.sources[t].redoPlacement()},_forwardSourceEvent:function(t){this.fire("source."+t.type,c.extend({source:t.target},t))},_forwardTileEvent:function(t){this.fire(t.type,c.extend({source:t.target},t))},_forwardLayerEvent:function(t){this.fire("layer."+t.type,c.extend({layer:{id:t.target.id}},t))},"get sprite json":function(t,e){var r=this.sprite;r.loaded()?e(null,{sprite:r.data,retina:r.retina}):r.on("load",function(){e(null,{sprite:r.data,retina:r.retina})})},"get icons":function(t,e){var r=this.sprite,n=this.spriteAtlas;r.loaded()?(n.setSprite(r),n.addIcons(t.icons,e)):r.on("load",function(){n.setSprite(r),n.addIcons(t.icons,e)})},"get glyphs":function(t,e){function r(t,r,n){t&&console.error(t),o[n]=r,i--,0===i&&e(null,o)}var n=t.stacks,i=Object.keys(n).length,o={};for(var a in n)this.glyphSource.getSimpleGlyphs(a,n[a],t.uid,r)}})},{"../render/line_atlas":270,"../source/source":279,"../symbol/glyph_source":311,"../symbol/sprite_atlas":316,"../util/ajax":334,"../util/browser":335,"../util/dispatcher":337,"../util/evented":341,"../util/mapbox":346,"../util/util":349,"./animation_loop":287,"./image_sprite":288,"./style_function":292,"./style_layer":293,"./style_spec":300,"./validate_style":302}],291:[function(t,e,r){"use strict";function n(t,e){this.type=t.type,this.transitionable=t.transition,this.value=s.clone(e),this.isFunction=!!e.stops,this.json=JSON.stringify(this.value);var r="color"===this.type?a(this.value):e;if(this.calculate=o[t.function||"piecewise-constant"](r),this.isFeatureConstant=this.calculate.isFeatureConstant,this.isZoomConstant=this.calculate.isZoomConstant,"piecewise-constant"===t.function&&t.transition&&(this.calculate=i(this.calculate)),!this.isFeatureConstant&&!this.isZoomConstant){this.stopZoomLevels=[];for(var n=[],l=this.value.stops,u=0;u<this.value.stops.length;u++){var c=l[u][0].zoom;this.stopZoomLevels.indexOf(c)<0&&(this.stopZoomLevels.push(c),n.push([c,n.length]))}this.calculateInterpolationT=o.interpolated({stops:n,base:e.base})}}function i(t){return function(e,r){var n,i,o,a=e.zoom,s=e.zoomHistory,l=e.duration,u=a%1,c=Math.min((Date.now()-s.lastIntegerZoomTime)/l,1),h=1,f=1;return a>s.lastIntegerZoom?(n=u+(1-u)*c,h*=2,i=t({zoom:a-1},r),o=t({zoom:a},r)):(n=1-(1-c)*u,o=t({zoom:a},r),i=t({zoom:a+1},r),h/=2),{from:i,fromScale:h,to:o,toScale:f,t:n}}}var o=t("./style_function"),a=t("./parse_color"),s=t("../util/util");e.exports=n},{"../util/util":349,"./parse_color":289,"./style_function":292}],292:[function(t,e,r){"use strict";var n=t("mapbox-gl-function");r.interpolated=function(t){var e=n.interpolated(t),r=function(t,r){return e(t&&t.zoom,r||{})};return r.isFeatureConstant=e.isFeatureConstant,r.isZoomConstant=e.isZoomConstant,r},r["piecewise-constant"]=function(t){var e=n["piecewise-constant"](t),r=function(t,r){return e(t&&t.zoom,r||{})};return r.isFeatureConstant=e.isFeatureConstant,r.isZoomConstant=e.isZoomConstant,r},r.isFunctionDefinition=n.isFunctionDefinition},{"mapbox-gl-function":374}],293:[function(t,e,r){"use strict";function n(t,e){this.set(t,e)}function i(t){return t.value}var o=t("../util/util"),a=t("./style_transition"),s=t("./style_declaration"),l=t("./style_spec"),u=t("./validate_style"),c=t("./parse_color"),h=t("../util/evented");e.exports=n;var f="-transition";n.create=function(e,r){var n={background:t("./style_layer/background_style_layer"),circle:t("./style_layer/circle_style_layer"),fill:t("./style_layer/fill_style_layer"),line:t("./style_layer/line_style_layer"),raster:t("./style_layer/raster_style_layer"),symbol:t("./style_layer/symbol_style_layer")};return new n[(r||e).type](e,r)},n.prototype=o.inherit(h,{set:function(t,e){this.id=t.id,this.ref=t.ref,this.metadata=t.metadata,this.type=(e||t).type,this.source=(e||t).source,this.sourceLayer=(e||t)["source-layer"],this.minzoom=(e||t).minzoom,this.maxzoom=(e||t).maxzoom,this.filter=(e||t).filter,this.paint={},this.layout={},this._paintSpecifications=l["paint_"+this.type],this._layoutSpecifications=l["layout_"+this.type],this._paintTransitions={},this._paintTransitionOptions={},this._paintDeclarations={},this._layoutDeclarations={},this._layoutFunctions={};var r,n;for(var i in t){var o=i.match(/^paint(?:\.(.*))?$/);if(o){var a=o[1]||"";for(r in t[i])this.setPaintProperty(r,t[i][r],a)}}if(this.ref)this._layoutDeclarations=e._layoutDeclarations;else for(n in t.layout)this.setLayoutProperty(n,t.layout[n]);for(r in this._paintSpecifications)this.paint[r]=this.getPaintValue(r);
for(n in this._layoutSpecifications)this._updateLayoutValue(n)},setLayoutProperty:function(t,e){if(null==e)delete this._layoutDeclarations[t];else{var r="layers."+this.id+".layout."+t;if(this._handleErrors(u.layoutProperty,r,t,e))return;this._layoutDeclarations[t]=new s(this._layoutSpecifications[t],e)}this._updateLayoutValue(t)},getLayoutProperty:function(t){return this._layoutDeclarations[t]&&this._layoutDeclarations[t].value},getLayoutValue:function(t,e,r){var n=this._layoutSpecifications[t],i=this._layoutDeclarations[t];return i?i.calculate(e,r):n.default},setPaintProperty:function(t,e,r){var n="layers."+this.id+(r?'["paint.'+r+'"].':".paint.")+t;if(o.endsWith(t,f))if(this._paintTransitionOptions[r||""]||(this._paintTransitionOptions[r||""]={}),null===e||void 0===e)delete this._paintTransitionOptions[r||""][t];else{if(this._handleErrors(u.paintProperty,n,t,e))return;this._paintTransitionOptions[r||""][t]=e}else if(this._paintDeclarations[r||""]||(this._paintDeclarations[r||""]={}),null===e||void 0===e)delete this._paintDeclarations[r||""][t];else{if(this._handleErrors(u.paintProperty,n,t,e))return;this._paintDeclarations[r||""][t]=new s(this._paintSpecifications[t],e)}},getPaintProperty:function(t,e){return e=e||"",o.endsWith(t,f)?this._paintTransitionOptions[e]&&this._paintTransitionOptions[e][t]:this._paintDeclarations[e]&&this._paintDeclarations[e][t]&&this._paintDeclarations[e][t].value},getPaintValue:function(t,e,r){var n=this._paintSpecifications[t],i=this._paintTransitions[t];return i?i.calculate(e,r):"color"===n.type&&n.default?c(n.default):n.default},getPaintValueStopZoomLevels:function(t){var e=this._paintTransitions[t];return e?e.declaration.stopZoomLevels:[]},getPaintInterpolationT:function(t,e){var r=this._paintTransitions[t];return r.declaration.calculateInterpolationT({zoom:e})},isPaintValueFeatureConstant:function(t){var e=this._paintTransitions[t];return e?e.declaration.isFeatureConstant:!0},isPaintValueZoomConstant:function(t){var e=this._paintTransitions[t];return e?e.declaration.isZoomConstant:!0},isHidden:function(t){return this.minzoom&&t<this.minzoom?!0:this.maxzoom&&t>=this.maxzoom?!0:"none"===this.layout.visibility?!0:0===this.paint[this.type+"-opacity"]},updatePaintTransitions:function(t,e,r,n){for(var i=o.extend({},this._paintDeclarations[""]),a=0;a<t.length;a++)o.extend(i,this._paintDeclarations[t[a]]);var s;for(s in i)this._applyPaintDeclaration(s,i[s],e,r,n);for(s in this._paintTransitions)s in i||this._applyPaintDeclaration(s,null,e,r,n)},updatePaintTransition:function(t,e,r,n,i){for(var o=this._paintDeclarations[""][t],a=0;a<e.length;a++){var s=this._paintDeclarations[e[a]];s&&s[t]&&(o=s[t])}this._applyPaintDeclaration(t,o,r,n,i)},recalculate:function(t,e){for(var r in this._paintTransitions)this.paint[r]=this.getPaintValue(r,{zoom:t,zoomHistory:e});for(var n in this._layoutFunctions)this.layout[n]=this.getLayoutValue(n,{zoom:t,zoomHistory:e})},serialize:function(t){var e={id:this.id,ref:this.ref,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom};for(var r in this._paintDeclarations){var n=""===r?"paint":"paint."+r;e[n]=o.mapObject(this._paintDeclarations[r],i)}return(!this.ref||t&&t.includeRefProperties)&&o.extend(e,{type:this.type,source:this.source,"source-layer":this.sourceLayer,filter:this.filter,layout:o.mapObject(this._layoutDeclarations,i)}),o.filterObject(e,function(t,e){return void 0!==t&&!("layout"===e&&!Object.keys(t).length)})},_applyPaintDeclaration:function(t,e,r,n,i){var l=r.transition?this._paintTransitions[t]:void 0;if(null===e||void 0===e){var u=this._paintSpecifications[t];e=new s(u,u.default)}if(!l||l.declaration.json!==e.json){var c=o.extend({duration:300,delay:0},n,this.getPaintProperty(t+f)),h=this._paintTransitions[t]=new a(e,l,c);h.instant()||(h.loopID=i.set(h.endTime-Date.now())),l&&i.cancel(l.loopID)}},_updateLayoutValue:function(t){var e=this._layoutDeclarations[t];e&&e.isFunction?this._layoutFunctions[t]=!0:(delete this._layoutFunctions[t],this.layout[t]=this.getLayoutValue(t))},_handleErrors:function(t,e,r,n){return u.emitErrors(this,t.call(u,{key:e,layerType:this.type,objectKey:r,value:n,styleSpec:l,style:{glyphs:!0,sprite:!0}}))}})},{"../util/evented":341,"../util/util":349,"./parse_color":289,"./style_declaration":291,"./style_layer/background_style_layer":294,"./style_layer/circle_style_layer":295,"./style_layer/fill_style_layer":296,"./style_layer/line_style_layer":297,"./style_layer/raster_style_layer":298,"./style_layer/symbol_style_layer":299,"./style_spec":300,"./style_transition":301,"./validate_style":302}],294:[function(t,e,r){"use strict";function n(){o.apply(this,arguments)}var i=t("../../util/util"),o=t("../style_layer");e.exports=n,n.prototype=i.inherit(o,{})},{"../../util/util":349,"../style_layer":293}],295:[function(t,e,r){"use strict";function n(){o.apply(this,arguments)}var i=t("../../util/util"),o=t("../style_layer");e.exports=n,n.prototype=i.inherit(o,{})},{"../../util/util":349,"../style_layer":293}],296:[function(t,e,r){"use strict";function n(){o.apply(this,arguments)}var i=t("../../util/util"),o=t("../style_layer");e.exports=n,n.prototype=i.inherit(o,{})},{"../../util/util":349,"../style_layer":293}],297:[function(t,e,r){"use strict";function n(){o.apply(this,arguments)}var i=t("../../util/util"),o=t("../style_layer");e.exports=n,n.prototype=i.inherit(o,{getPaintValue:function(t,e,r){var n=o.prototype.getPaintValue.apply(this,arguments);if(n&&"line-dasharray"===t){var i=Math.floor(e.zoom);this._flooredZoom!==i&&(this._flooredZoom=i,this._flooredLineWidth=this.getPaintValue("line-width",e,r)),n.fromScale*=this._flooredLineWidth,n.toScale*=this._flooredLineWidth}return n}})},{"../../util/util":349,"../style_layer":293}],298:[function(t,e,r){"use strict";function n(){o.apply(this,arguments)}var i=t("../../util/util"),o=t("../style_layer");e.exports=n,n.prototype=i.inherit(o,{})},{"../../util/util":349,"../style_layer":293}],299:[function(t,e,r){"use strict";function n(){o.apply(this,arguments)}var i=t("../../util/util"),o=t("../style_layer");e.exports=n,n.prototype=i.inherit(o,{isHidden:function(){if(o.prototype.isHidden.apply(this,arguments))return!0;var t=0===this.paint["text-opacity"]||!this.layout["text-field"],e=0===this.paint["icon-opacity"]||!this.layout["icon-image"];return!(!t||!e)},getLayoutValue:function(t,e,r){return("text-rotation-alignment"!==t||"line"!==this.getLayoutValue("symbol-placement",e,r)||this.getLayoutProperty("text-rotation-alignment"))&&("icon-rotation-alignment"!==t||"line"!==this.getLayoutValue("symbol-placement",e,r)||this.getLayoutProperty("icon-rotation-alignment"))?o.prototype.getLayoutValue.apply(this,arguments):"map"}})},{"../../util/util":349,"../style_layer":293}],300:[function(t,e,r){"use strict";e.exports=t("mapbox-gl-style-spec/reference/latest")},{"mapbox-gl-style-spec/reference/latest":397}],301:[function(t,e,r){"use strict";function n(t,e,r){this.declaration=t,this.startTime=this.endTime=(new Date).getTime();var n=t.type;"string"!==n&&"array"!==n||!t.transitionable?this.interp=a[n]:this.interp=i,this.oldTransition=e,this.duration=r.duration||0,this.delay=r.delay||0,this.instant()||(this.endTime=this.startTime+this.duration+this.delay,this.ease=o.easeCubicInOut),e&&e.endTime<=this.startTime&&delete e.oldTransition}function i(t,e,r){return{from:t.to,fromScale:t.toScale,to:e.to,toScale:e.toScale,t:r}}var o=t("../util/util"),a=t("../util/interpolate");e.exports=n,n.prototype.instant=function(){return!this.oldTransition||!this.interp||0===this.duration&&0===this.delay},n.prototype.calculate=function(t,e){var r=this.declaration.calculate(o.extend({},t,{duration:this.duration}),e);if(this.instant())return r;var n=t.time||Date.now();if(n<this.endTime){var i=this.oldTransition.calculate(o.extend({},t,{time:this.startTime}),e),a=this.ease((n-this.startTime-this.delay)/this.duration);r=this.interp(i,r,a)}return r}},{"../util/interpolate":343,"../util/util":349}],302:[function(t,e,r){"use strict";e.exports=t("mapbox-gl-style-spec/lib/validate_style.min"),e.exports.emitErrors=function(t,e){if(e&&e.length){for(var r=0;r<e.length;r++)t.fire("error",{error:new Error(e[r].message)});return!0}return!1},e.exports.throwErrors=function(t,e){if(e)for(var r=0;r<e.length;r++)throw new Error(e[r].message)}},{"mapbox-gl-style-spec/lib/validate_style.min":396}],303:[function(t,e,r){"use strict";function n(t,e,r,n){this.x=t,this.y=e,this.angle=r,void 0!==n&&(this.segment=n)}var i=t("point-geometry");e.exports=n,n.prototype=Object.create(i.prototype),n.prototype.clone=function(){return new n(this.x,this.y,this.angle,this.segment)}},{"point-geometry":404}],304:[function(t,e,r){"use strict";function n(t,e,r,n,i){if(void 0===e.segment)return!0;for(var o=e,a=e.segment+1,s=0;s>-r/2;){if(a--,0>a)return!1;s-=t[a].dist(o),o=t[a]}s+=t[a].dist(t[a+1]),a++;for(var l=[],u=0;r/2>s;){var c=t[a-1],h=t[a],f=t[a+1];if(!f)return!1;var d=c.angleTo(h)-h.angleTo(f);for(d=Math.abs((d+3*Math.PI)%(2*Math.PI)-Math.PI),l.push({distance:s,angleDelta:d}),u+=d;s-l[0].distance>n;)u-=l.shift().angleDelta;if(u>i)return!1;a++,s+=h.dist(f)}return!0}e.exports=n},{}],305:[function(t,e,r){"use strict";function n(t,e,r,n,o){for(var a=[],s=0;s<t.length;s++)for(var l,u=t[s],c=0;c<u.length-1;c++){var h=u[c],f=u[c+1];h.x<e&&f.x<e||(h.x<e?h=new i(e,h.y+(f.y-h.y)*((e-h.x)/(f.x-h.x)))._round():f.x<e&&(f=new i(e,h.y+(f.y-h.y)*((e-h.x)/(f.x-h.x)))._round()),h.y<r&&f.y<r||(h.y<r?h=new i(h.x+(f.x-h.x)*((r-h.y)/(f.y-h.y)),r)._round():f.y<r&&(f=new i(h.x+(f.x-h.x)*((r-h.y)/(f.y-h.y)),r)._round()),h.x>=n&&f.x>=n||(h.x>=n?h=new i(n,h.y+(f.y-h.y)*((n-h.x)/(f.x-h.x)))._round():f.x>=n&&(f=new i(n,h.y+(f.y-h.y)*((n-h.x)/(f.x-h.x)))._round()),h.y>=o&&f.y>=o||(h.y>=o?h=new i(h.x+(f.x-h.x)*((o-h.y)/(f.y-h.y)),o)._round():f.y>=o&&(f=new i(h.x+(f.x-h.x)*((o-h.y)/(f.y-h.y)),o)._round()),l&&h.equals(l[l.length-1])||(l=[h],a.push(l)),l.push(f)))))}return a}var i=t("point-geometry");e.exports=n},{"point-geometry":404}],306:[function(t,e,r){"use strict";var n=t("../util/struct_array"),i=t("../util/util"),o=t("point-geometry"),a=e.exports=new n({members:[{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Float32",name:"maxScale"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"},{type:"Int16",name:"bbox0"},{type:"Int16",name:"bbox1"},{type:"Int16",name:"bbox2"},{type:"Int16",name:"bbox3"},{type:"Float32",name:"placementScale"}]});i.extendAll(a.prototype.StructType.prototype,{get anchorPoint(){return new o(this.anchorPointX,this.anchorPointY)}})},{"../util/struct_array":347,"../util/util":349,"point-geometry":404}],307:[function(t,e,r){"use strict";function n(t,e,r,n,i,o,a,s,l,u,c){var h=a.top*s-l,f=a.bottom*s+l,d=a.left*s-l,p=a.right*s+l;if(this.boxStartIndex=t.length,u){var v=f-h,m=p-d;if(v>0)if(v=Math.max(10*s,v),c){var g=e[r.segment+1].sub(e[r.segment])._unit()._mult(m),y=[r.sub(g),r.add(g)];this._addLineCollisionBoxes(t,y,r,0,m,v,n,i,o)}else this._addLineCollisionBoxes(t,e,r,r.segment,m,v,n,i,o)}else t.emplaceBack(r.x,r.y,d,h,p,f,1/0,n,i,o,0,0,0,0,0);this.boxEndIndex=t.length}e.exports=n,n.prototype._addLineCollisionBoxes=function(t,e,r,n,i,o,a,s,l){var u=o/2,c=Math.floor(i/u),h=-o/2,f=this.boxes,d=r,p=n+1,v=h;do{if(p--,0>p)return f;v-=e[p].dist(d),d=e[p]}while(v>-i/2);for(var m=e[p].dist(e[p+1]),g=0;c>g;g++){for(var y=-i/2+g*u;y>v+m;){if(v+=m,p++,p+1>=e.length)return f;m=e[p].dist(e[p+1])}var b=y-v,x=e[p],_=e[p+1],w=_.sub(x)._unit()._mult(b)._add(x)._round(),M=Math.max(Math.abs(y-h)-u/2,0),k=i/2/M;t.emplaceBack(w.x,w.y,-o/2,-o/2,o/2,o/2,k,a,s,l,0,0,0,0,0)}return f}},{}],308:[function(t,e,r){"use strict";function n(t,e,r){if("object"==typeof t){var n=t;r=e,t=n.angle,e=n.pitch,this.grid=new a(n.grid),this.ignoredGrid=new a(n.ignoredGrid)}else this.grid=new a(o,12,6),this.ignoredGrid=new a(o,12,0);this.angle=t,this.pitch=e;var i=Math.sin(t),s=Math.cos(t);if(this.rotationMatrix=[s,-i,i,s],this.reverseRotationMatrix=[s,i,-i,s],this.yStretch=1/Math.cos(e/180*Math.PI),this.yStretch=Math.pow(this.yStretch,1.3),this.collisionBoxArray=r,0===r.length){r.emplaceBack();var l=32767;r.emplaceBack(0,0,0,-l,0,l,l,0,0,0,0,0,0,0,0,0),r.emplaceBack(o,0,0,-l,0,l,l,0,0,0,0,0,0,0,0,0),r.emplaceBack(0,0,-l,0,l,0,l,0,0,0,0,0,0,0,0,0),r.emplaceBack(0,o,-l,0,l,0,l,0,0,0,0,0,0,0,0,0)}this.tempCollisionBox=r.get(0),this.edges=[r.get(1),r.get(2),r.get(3),r.get(4)]}var i=t("point-geometry"),o=t("../data/bucket").EXTENT,a=t("grid-index");e.exports=n,n.prototype.serialize=function(){var t={angle:this.angle,pitch:this.pitch,grid:this.grid.toArrayBuffer(),ignoredGrid:this.ignoredGrid.toArrayBuffer()};return{data:t,transferables:[t.grid,t.ignoredGrid]}},n.prototype.minScale=.25,n.prototype.maxScale=2,n.prototype.placeCollisionFeature=function(t,e,r){for(var n=this.collisionBoxArray,o=this.minScale,a=this.rotationMatrix,s=this.yStretch,l=t.boxStartIndex;l<t.boxEndIndex;l++){var u=n.get(l),c=u.anchorPoint._matMult(a),h=c.x,f=c.y,d=h+u.x1,p=f+u.y1*s,v=h+u.x2,m=f+u.y2*s;if(u.bbox0=d,u.bbox1=p,u.bbox2=v,u.bbox3=m,!e)for(var g=this.grid.query(d,p,v,m),y=0;y<g.length;y++){var b=n.get(g[y]),x=b.anchorPoint._matMult(a);if(o=this.getPlacementScale(o,c,u,x,b),o>=this.maxScale)return o}if(r){var _;if(this.angle){var w=this.reverseRotationMatrix,M=new i(u.x1,u.y1).matMult(w),k=new i(u.x2,u.y1).matMult(w),A=new i(u.x1,u.y2).matMult(w),T=new i(u.x2,u.y2).matMult(w);_=this.tempCollisionBox,_.anchorPointX=u.anchorPoint.x,_.anchorPointY=u.anchorPoint.y,_.x1=Math.min(M.x,k.x,A.x,T.x),_.y1=Math.min(M.y,k.x,A.x,T.x),_.x2=Math.max(M.x,k.x,A.x,T.x),_.y2=Math.max(M.y,k.x,A.x,T.x),_.maxScale=u.maxScale}else _=u;for(var E=0;E<this.edges.length;E++){var S=this.edges[E];if(o=this.getPlacementScale(o,u.anchorPoint,_,S.anchorPoint,S),o>=this.maxScale)return o}}}return o},n.prototype.queryRenderedSymbols=function(t,e,r,n,o){var a={},s=[],l=this.collisionBoxArray,u=this.rotationMatrix,c=new i(t,e)._matMult(u),h=this.tempCollisionBox;h.anchorX=c.x,h.anchorY=c.y,h.x1=0,h.y1=0,h.x2=r-t,h.y2=n-e,h.maxScale=o,o=h.maxScale;for(var f=[c.x+h.x1/o,c.y+h.y1/o*this.yStretch,c.x+h.x2/o,c.y+h.y2/o*this.yStretch],d=this.grid.query(f[0],f[1],f[2],f[3]),p=this.ignoredGrid.query(f[0],f[1],f[2],f[3]),v=0;v<p.length;v++)d.push(p[v]);for(var m=0;m<d.length;m++){var g=l.get(d[m]),y=g.sourceLayerIndex,b=g.featureIndex;if(void 0===a[y]&&(a[y]={}),!a[y][b]){var x=g.anchorPoint.matMult(u),_=this.getPlacementScale(this.minScale,c,h,x,g);_>=o&&(a[y][b]=!0,s.push(d[m]))}}return s},n.prototype.getPlacementScale=function(t,e,r,n,i){var o=e.x-n.x,a=e.y-n.y,s=(i.x1-r.x2)/o,l=(i.x2-r.x1)/o,u=(i.y1-r.y2)*this.yStretch/a,c=(i.y2-r.y1)*this.yStretch/a;(isNaN(s)||isNaN(l))&&(s=l=1),(isNaN(u)||isNaN(c))&&(u=c=1);var h=Math.min(Math.max(s,l),Math.max(u,c)),f=i.maxScale,d=r.maxScale;return h>f&&(h=f),h>d&&(h=d),h>t&&h>=i.placementScale&&(t=h),t},n.prototype.insertCollisionFeature=function(t,e,r){for(var n=r?this.ignoredGrid:this.grid,i=this.collisionBoxArray,o=t.boxStartIndex;o<t.boxEndIndex;o++){var a=i.get(o);a.placementScale=e,e<this.maxScale&&n.insert(o,a.bbox0,a.bbox1,a.bbox2,a.bbox3)}}},{"../data/bucket":247,"grid-index":373,"point-geometry":404}],309:[function(t,e,r){"use strict";function n(t,e,r,n,o,a,s,l,u){var c=n?.6*a*s:0,h=Math.max(n?n.right-n.left:0,o?o.right-o.left:0),f=0===t[0].x||t[0].x===u||0===t[0].y||t[0].y===u;e/4>e-h*s&&(e=h*s+e/4);var d=2*a,p=f?e/2*l%e:(h/2+d)*s*l%e;return i(t,p,e,c,r,h*s,f,!1,u)}function i(t,e,r,n,l,u,c,h,f){for(var d=u/2,p=0,v=0;v<t.length-1;v++)p+=t[v].dist(t[v+1]);for(var m=0,g=e-r,y=[],b=0;b<t.length-1;b++){for(var x=t[b],_=t[b+1],w=x.dist(_),M=_.angleTo(x);m+w>g+r;){g+=r;var k=(g-m)/w,A=o(x.x,_.x,k),T=o(x.y,_.y,k);if(A>=0&&f>A&&T>=0&&f>T&&g-d>=0&&p>=g+d){var E=new a(A,T,M,b)._round();n&&!s(t,E,u,n,l)||y.push(E)}}m+=w}return h||y.length||c||(y=i(t,m/2,r,n,l,u,c,!0,f)),y}var o=t("../util/interpolate"),a=t("../symbol/anchor"),s=t("./check_max_angle");e.exports=n},{"../symbol/anchor":303,"../util/interpolate":343,"./check_max_angle":304}],310:[function(t,e,r){"use strict";function n(t,e){this.width=t,this.height=e,this.bin=new i(t,e),this.index={},this.ids={},this.data=new Uint8Array(t*e)}var i=t("shelf-pack");e.exports=n,n.prototype.getGlyphs=function(){var t,e,r,n={};for(var i in this.ids)t=i.split("#"),e=t[0],r=t[1],n[e]||(n[e]=[]),n[e].push(r);return n},n.prototype.getRects=function(){var t,e,r,n={};for(var i in this.ids)t=i.split("#"),e=t[0],r=t[1],n[e]||(n[e]={}),n[e][r]=this.index[i];return n},n.prototype.addGlyph=function(t,e,r,n){if(!r)return null;var i=e+"#"+r.id;if(this.index[i])return this.ids[i].indexOf(t)<0&&this.ids[i].push(t),this.index[i];if(!r.bitmap)return null;var o=r.width+2*n,a=r.height+2*n,s=1,l=o+2*s,u=a+2*s;l+=4-l%4,u+=4-u%4;var c=this.bin.packOne(l,u);if(c||(this.resize(),c=this.bin.packOne(l,u)),!c)return console.warn("glyph bitmap overflow"),null;this.index[i]=c,this.ids[i]=[t];for(var h=this.data,f=r.bitmap,d=0;a>d;d++)for(var p=this.width*(c.y+d+s)+c.x+s,v=o*d,m=0;o>m;m++)h[p+m]=f[v+m];return this.dirty=!0,c},n.prototype.resize=function(){var t=this.width,e=this.height;if(!(t>512||e>512)){this.texture&&(this.gl&&this.gl.deleteTexture(this.texture),this.texture=null),this.width*=2,this.height*=2,this.bin.resize(this.width,this.height);for(var r,n,i=new ArrayBuffer(this.width*this.height),o=0;e>o;o++)r=new Uint8Array(this.data.buffer,e*o,t),n=new Uint8Array(i,e*o*2,t),n.set(r);this.data=new Uint8Array(i)}},n.prototype.bind=function(t){this.gl=t,this.texture?t.bindTexture(t.TEXTURE_2D,this.texture):(this.texture=t.createTexture(),t.bindTexture(t.TEXTURE_2D,this.texture),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texImage2D(t.TEXTURE_2D,0,t.ALPHA,this.width,this.height,0,t.ALPHA,t.UNSIGNED_BYTE,null))},n.prototype.updateTexture=function(t){this.bind(t),this.dirty&&(t.texSubImage2D(t.TEXTURE_2D,0,0,0,this.width,this.height,t.ALPHA,t.UNSIGNED_BYTE,this.data),this.dirty=!1)}},{"shelf-pack":406}],311:[function(t,e,r){"use strict";function n(t){this.url=t&&a(t),this.atlases={},this.stacks={},this.loading={}}function i(t,e,r){var n=1;this.advance=t.advance,this.left=t.left-r-n,this.top=t.top+r+n,this.rect=e}function o(t,e,r,n){return n=n||"abc",r.replace("{s}",n[t.length%n.length]).replace("{fontstack}",t).replace("{range}",e)}var a=t("../util/mapbox").normalizeGlyphsURL,s=t("../util/ajax").getArrayBuffer,l=t("../util/glyphs"),u=t("../symbol/glyph_atlas"),c=t("pbf");e.exports=n,n.prototype.getSimpleGlyphs=function(t,e,r,n){void 0===this.stacks[t]&&(this.stacks[t]={}),void 0===this.atlases[t]&&(this.atlases[t]=new u(128,128));for(var o,a={},s=this.stacks[t],l=this.atlases[t],c=3,h={},f=0,d=0;d<e.length;d++){var p=e[d];if(o=Math.floor(p/256),s[o]){var v=s[o].glyphs[p],m=l.addGlyph(r,t,v,c);v&&(a[p]=new i(v,m,c))}else void 0===h[o]&&(h[o]=[],f++),h[o].push(p)}f||n(void 0,a,t);var g=function(e,o,s){if(!e)for(var u=this.stacks[t][o]=s.stacks[0],d=0;d<h[o].length;d++){var p=h[o][d],v=u.glyphs[p],m=l.addGlyph(r,t,v,c);v&&(a[p]=new i(v,m,c))}f--,f||n(void 0,a,t)}.bind(this);for(var y in h)this.loadRange(t,y,g)},n.prototype.loadRange=function(t,e,r){if(256*e>65535)return r("glyphs > 65535 not supported");void 0===this.loading[t]&&(this.loading[t]={});var n=this.loading[t];if(n[e])n[e].push(r);else{n[e]=[r];var i=256*e+"-"+(256*e+255),a=o(t,i,this.url);s(a,function(t,r){for(var i=!t&&new l(new c(new Uint8Array(r))),o=0;o<n[e].length;o++)n[e][o](t,e,i);delete n[e]})}},n.prototype.getGlyphAtlas=function(t){return this.atlases[t]}},{"../symbol/glyph_atlas":310,"../util/ajax":334,"../util/glyphs":342,"../util/mapbox":346,pbf:402}],312:[function(t,e,r){"use strict";e.exports=function(t,e,r){function n(n){c.push(t[n]),h.push(r[n]),f.push(e[n]),d++}function i(t,e,r){var n=u[t];return delete u[t],u[e]=n,h[n][0].pop(),h[n][0]=h[n][0].concat(r[0]),n}function o(t,e,r){var n=l[e];return delete l[e],l[t]=n,h[n][0].shift(),h[n][0]=r[0].concat(h[n][0]),n}function a(t,e,r){var n=r?e[0][e[0].length-1]:e[0][0];return t+":"+n.x+":"+n.y}var s,l={},u={},c=[],h=[],f=[],d=0;for(s=0;s<t.length;s++){var p=r[s],v=e[s];if(v){var m=a(v,p),g=a(v,p,!0);if(m in u&&g in l&&u[m]!==l[g]){var y=o(m,g,p),b=i(m,g,h[y]);delete l[m],delete u[g],u[a(v,h[b],!0)]=b,h[y]=null}else m in u?i(m,g,p):g in l?o(m,g,p):(n(s),l[m]=d-1,u[g]=d-1)}else n(s)}return{features:c,textFeatures:f,geometries:h}}},{}],313:[function(t,e,r){"use strict";function n(t,e,r,n,i,o,a,s,l){this.anchorPoint=t,this.tl=e,this.tr=r,this.bl=n,this.br=i,this.tex=o,this.angle=a,this.minScale=s,this.maxScale=l}function i(t,e,r,i,o,a){var u=e.image.rect,c=1,h=e.left-c,f=h+u.w/e.image.pixelRatio,d=e.top-c,p=d+u.h/e.image.pixelRatio,v=new s(h,d),m=new s(f,d),g=new s(f,p),y=new s(h,p),b=o["icon-rotate"]*Math.PI/180;if(a){var x=i[t.segment];if(t.y===x.y&&t.x===x.x&&t.segment+1<i.length){var _=i[t.segment+1];b+=Math.atan2(t.y-_.y,t.x-_.x)+Math.PI}else b+=Math.atan2(t.y-x.y,t.x-x.x)}if(b){var w=Math.sin(b),M=Math.cos(b),k=[M,-w,w,M];v=v.matMult(k),m=m.matMult(k),y=y.matMult(k),g=g.matMult(k)}return[new n(new s(t.x,t.y),v,m,y,g,e.image.rect,0,l,1/0)]}function o(t,e,r,i,o,u){for(var c=o["text-rotate"]*Math.PI/180,h=o["text-keep-upright"],f=e.positionedGlyphs,d=[],p=0;p<f.length;p++){var v=f[p],m=v.glyph,g=m.rect;if(g){var y,b=(v.x+m.advance/2)*r,x=l;u?(y=[],x=a(y,t,b,i,t.segment,!0),h&&(x=Math.min(x,a(y,t,b,i,t.segment,!1)))):y=[{anchorPoint:new s(t.x,t.y),offset:0,angle:0,maxScale:1/0,minScale:l}];for(var _=v.x+m.left,w=v.y-m.top,M=_+g.w,k=w+g.h,A=new s(_,w),T=new s(M,w),E=new s(_,k),S=new s(M,k),L=0;L<y.length;L++){var z=y[L],I=A,P=T,C=E,R=S,D=z.angle+c;if(D){var O=Math.sin(D),F=Math.cos(D),j=[F,-O,O,F];I=I.matMult(j),P=P.matMult(j),C=C.matMult(j),R=R.matMult(j)}var N=Math.max(z.minScale,x),B=(t.angle+c+z.offset+2*Math.PI)%(2*Math.PI);d.push(new n(z.anchorPoint,I,P,C,R,g,B,N,z.maxScale))}}}return d}function a(t,e,r,n,i,o){var a=!o;0>r&&(o=!o),o&&i++;var u=new s(e.x,e.y),c=n[i],h=1/0;r=Math.abs(r);for(var f=l;;){var d=u.dist(c),p=r/d,v=Math.atan2(c.y-u.y,c.x-u.x);if(o||(v+=Math.PI),a&&(v+=Math.PI),t.push({anchorPoint:u,offset:a?Math.PI:0,minScale:p,maxScale:h,angle:(v+2*Math.PI)%(2*Math.PI)}),f>=p)break;for(u=c;u.equals(c);)if(i+=o?1:-1,c=n[i],!c)return p;var m=c.sub(u)._unit();u=u.sub(m._mult(d)),h=p}return f}var s=t("point-geometry");e.exports={getIconQuads:i,getGlyphQuads:o};var l=.5},{"point-geometry":404}],314:[function(t,e,r){"use strict";function n(t,e,r){for(var n=[],o=0,a=t.length;a>o;o++){var s=i(t[o].properties,e["text-field"]);if(s){s=s.toString();var l=e["text-transform"];"uppercase"===l?s=s.toLocaleUpperCase():"lowercase"===l&&(s=s.toLocaleLowerCase());for(var u=0;u<s.length;u++)r[s.charCodeAt(u)]=!0;n[o]=s}else n[o]=null}return n}var i=t("../util/token");e.exports=n},{"../util/token":348}],315:[function(t,e,r){"use strict";function n(t,e,r,n){this.codePoint=t,this.x=e,this.y=r,this.glyph=n}function i(t,e,r,n,i,o){this.positionedGlyphs=t,this.text=e,this.top=r,this.bottom=n,this.left=i,this.right=o}function o(t,e,r,o,s,l,u,c,h){for(var f=[],d=new i(f,t,h[1],h[1],h[0],h[0]),p=-17,v=0,m=p,g=0;g<t.length;g++){var y=t.charCodeAt(g),b=e[y];b&&(f.push(new n(y,v,m,b)),v+=b.advance+c)}return f.length?(a(d,e,o,r,s,l,u,h),d):!1}function a(t,e,r,n,i,o,a,u){var c=null,d=0,p=0,v=0,m=0,g=t.positionedGlyphs;if(n)for(var y=0;y<g.length;y++){var b=g[y];if(b.x-=d,b.y+=r*v,b.x>n&&null!==c){var x=g[c+1].x;m=Math.max(x,m);for(var _=c+1;y>=_;_++)g[_].y+=r,g[_].x-=x;if(a){var w=c;h[g[c].codePoint]&&w--,s(g,e,p,w,a)}p=c+1,c=null,d+=x,v++}f[b.codePoint]&&(c=y)}var M=g[g.length-1],k=M.x+e[M.codePoint].advance;m=Math.max(m,k);var A=(v+1)*r;s(g,e,p,g.length-1,a),l(g,a,i,o,m,r,v,u),t.top+=-o*A,t.bottom=t.top+A,t.left+=-i*m,t.right=t.left+m}function s(t,e,r,n,i){for(var o=e[t[n].codePoint].advance,a=(t[n].x+o)*i,s=r;n>=s;s++)t[s].x-=a}function l(t,e,r,n,i,o,a,s){for(var l=(e-r)*i+s[0],u=(-n*(a+1)+.5)*o+s[1],c=0;c<t.length;c++)t[c].x+=l,t[c].y+=u}function u(t,e){if(!t||!t.rect)return null;var r=e["icon-offset"][0],n=e["icon-offset"][1],i=r-t.width/2,o=i+t.width,a=n-t.height/2,s=a+t.height;return new c(t,a,s,i,o)}function c(t,e,r,n,i){this.image=t,this.top=e,this.bottom=r,this.left=n,this.right=i}e.exports={shapeText:o,shapeIcon:u};var h={32:!0,8203:!0},f={32:!0,38:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0}},{}],316:[function(t,e,r){"use strict";function n(t,e){this.width=t,this.height=e,this.bin=new a(t,e),this.images={},this.data=!1,this.texture=0,this.filter=0,this.pixelRatio=1,this.dirty=!0}function i(t,e,r,n,i,o,a,s,l,u,c){var h,f,d=n*e+r,p=s*o+a;if(c)for(p-=o,f=-1;u>=f;f++,d=((f+u)%u+n)*e+r,p+=o)for(h=-1;l>=h;h++)i[p+h]=t[d+(h+l)%l];else for(f=0;u>f;f++,d+=e,p+=o)for(h=0;l>h;h++)i[p+h]=t[d+h]}function o(t,e,r,n,i){this.rect=t,this.width=e,this.height=r,this.sdf=n,this.pixelRatio=i}var a=t("shelf-pack"),s=t("../util/browser");e.exports=n,n.prototype.allocateImage=function(t,e){t/=this.pixelRatio,e/=this.pixelRatio;var r=2,n=t+r+(4-(t+r)%4),i=e+r+(4-(e+r)%4),o=this.bin.packOne(n,i);return o?o:(console.warn("SpriteAtlas out of space."),null)},n.prototype.getImage=function(t,e){if(this.images[t])return this.images[t];if(!this.sprite)return null;var r=this.sprite.getSpritePosition(t);if(!r.width||!r.height)return null;var n=this.allocateImage(r.width,r.height);if(!n)return null;var i=new o(n,r.width/r.pixelRatio,r.height/r.pixelRatio,r.sdf,r.pixelRatio/this.pixelRatio);return this.images[t]=i,this.copy(n,r,e),i},n.prototype.getPosition=function(t,e){var r=this.getImage(t,e),n=r&&r.rect;if(!n)return null;var i=r.width*r.pixelRatio,o=r.height*r.pixelRatio,a=1;return{size:[r.width,r.height],tl:[(n.x+a)/this.width,(n.y+a)/this.height],br:[(n.x+a+i)/this.width,(n.y+a+o)/this.height]}},n.prototype.allocate=function(){if(!this.data){var t=Math.floor(this.width*this.pixelRatio),e=Math.floor(this.height*this.pixelRatio);this.data=new Uint32Array(t*e);for(var r=0;r<this.data.length;r++)this.data[r]=0}},n.prototype.copy=function(t,e,r){if(this.sprite.img.data){var n=new Uint32Array(this.sprite.img.data.buffer);this.allocate();var o=this.data,a=1;i(n,this.sprite.img.width,e.x,e.y,o,this.width*this.pixelRatio,(t.x+a)*this.pixelRatio,(t.y+a)*this.pixelRatio,e.width,e.height,r),this.dirty=!0}},n.prototype.setSprite=function(t){t&&(this.pixelRatio=s.devicePixelRatio>1?2:1,this.canvas&&(this.canvas.width=this.width*this.pixelRatio,this.canvas.height=this.height*this.pixelRatio)),this.sprite=t},n.prototype.addIcons=function(t,e){for(var r=0;r<t.length;r++)this.getImage(t[r]);e(null,this.images)},n.prototype.bind=function(t,e){var r=!1;this.texture?t.bindTexture(t.TEXTURE_2D,this.texture):(this.texture=t.createTexture(),t.bindTexture(t.TEXTURE_2D,this.texture),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),r=!0);var n=e?t.LINEAR:t.NEAREST;n!==this.filter&&(t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,n),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,n),this.filter=n),this.dirty&&(this.allocate(),r?t.texImage2D(t.TEXTURE_2D,0,t.RGBA,this.width*this.pixelRatio,this.height*this.pixelRatio,0,t.RGBA,t.UNSIGNED_BYTE,new Uint8Array(this.data.buffer)):t.texSubImage2D(t.TEXTURE_2D,0,0,0,this.width*this.pixelRatio,this.height*this.pixelRatio,t.RGBA,t.UNSIGNED_BYTE,new Uint8Array(this.data.buffer)),this.dirty=!1)}},{"../util/browser":335,"shelf-pack":406}],317:[function(t,e,r){"use strict";var n=t("../util/util"),i=t("../util/interpolate"),o=t("../util/browser"),a=t("../geo/lng_lat"),s=t("../geo/lng_lat_bounds"),l=t("point-geometry"),u=e.exports=function(){};n.extend(u.prototype,{getCenter:function(){return this.transform.center},setCenter:function(t,e){return this.jumpTo({center:t},e),this},panBy:function(t,e,r){return this.panTo(this.transform.center,n.extend({offset:l.convert(t).mult(-1)},e),r),this},panTo:function(t,e,r){return this.easeTo(n.extend({center:t},e),r)},getZoom:function(){return this.transform.zoom},setZoom:function(t,e){return this.jumpTo({zoom:t},e),this},zoomTo:function(t,e,r){return this.easeTo(n.extend({zoom:t},e),r)},zoomIn:function(t,e){return this.zoomTo(this.getZoom()+1,t,e),this},zoomOut:function(t,e){return this.zoomTo(this.getZoom()-1,t,e),this},getBearing:function(){return this.transform.bearing},setBearing:function(t,e){return this.jumpTo({bearing:t},e),this},rotateTo:function(t,e,r){return this.easeTo(n.extend({bearing:t},e),r)},resetNorth:function(t,e){return this.rotateTo(0,n.extend({duration:1e3},t),e),this},snapToNorth:function(t,e){return Math.abs(this.getBearing())<this.options.bearingSnap?this.resetNorth(t,e):this},getPitch:function(){return this.transform.pitch},setPitch:function(t,e){return this.jumpTo({pitch:t},e),this},fitBounds:function(t,e,r){e=n.extend({padding:0,offset:[0,0],maxZoom:1/0},e),t=s.convert(t);var i=l.convert(e.offset),o=this.transform,a=o.project(t.getNorthWest()),u=o.project(t.getSouthEast()),c=u.sub(a),h=(o.width-2*e.padding-2*Math.abs(i.x))/c.x,f=(o.height-2*e.padding-2*Math.abs(i.y))/c.y;return e.center=o.unproject(a.add(u).div(2)),e.zoom=Math.min(o.scaleZoom(o.scale*Math.min(h,f)),e.maxZoom),e.bearing=0,e.linear?this.easeTo(e,r):this.flyTo(e,r)},jumpTo:function(t,e){this.stop();var r=this.transform,n=!1,i=!1,o=!1;return"zoom"in t&&r.zoom!==+t.zoom&&(n=!0,r.zoom=+t.zoom),"center"in t&&(r.center=a.convert(t.center)),"bearing"in t&&r.bearing!==+t.bearing&&(i=!0,r.bearing=+t.bearing),"pitch"in t&&r.pitch!==+t.pitch&&(o=!0,r.pitch=+t.pitch),this.fire("movestart",e).fire("move",e),n&&this.fire("zoomstart",e).fire("zoom",e).fire("zoomend",e),i&&this.fire("rotate",e),o&&this.fire("pitch",e),this.fire("moveend",e)},easeTo:function(t,e){this.stop(),t=n.extend({offset:[0,0],duration:500,easing:n.ease},t);var r,o,s=this.transform,u=l.convert(t.offset),c=this.getZoom(),h=this.getBearing(),f=this.getPitch(),d="zoom"in t?+t.zoom:c,p="bearing"in t?this._normalizeBearing(t.bearing,h):h,v="pitch"in t?+t.pitch:f;"center"in t?(r=a.convert(t.center),o=s.centerPoint.add(u)):"around"in t?(r=a.convert(t.around),o=s.locationPoint(r)):(o=s.centerPoint.add(u),r=s.pointLocation(o));var m=s.locationPoint(r);return t.animate===!1&&(t.duration=0),this.zooming=d!==c,this.rotating=h!==p,this.pitching=v!==f,t.noMoveStart||this.fire("movestart",e),this.zooming&&this.fire("zoomstart",e),clearTimeout(this._onEaseEnd),this._ease(function(t){this.zooming&&(s.zoom=i(c,d,t)),this.rotating&&(s.bearing=i(h,p,t)),this.pitching&&(s.pitch=i(f,v,t)),s.setLocationAtPoint(r,m.add(o.sub(m)._mult(t))),this.fire("move",e),this.zooming&&this.fire("zoom",e),this.rotating&&this.fire("rotate",e),this.pitching&&this.fire("pitch",e)},function(){t.delayEndEvents?this._onEaseEnd=setTimeout(this._easeToEnd.bind(this,e),t.delayEndEvents):this._easeToEnd(e)}.bind(this),t),this},_easeToEnd:function(t){this.zooming&&this.fire("zoomend",t),this.fire("moveend",t),this.zooming=!1,this.rotating=!1,this.pitching=!1},flyTo:function(t,e){function r(t){var e=(A*A-k*k+(t?-1:1)*L*L*T*T)/(2*(t?A:k)*L*T);return Math.log(Math.sqrt(e*e+1)-e)}function o(t){return(Math.exp(t)-Math.exp(-t))/2}function s(t){return(Math.exp(t)+Math.exp(-t))/2}function u(t){return o(t)/s(t)}this.stop(),t=n.extend({offset:[0,0],speed:1.2,curve:1.42,easing:n.ease},t);var c=this.transform,h=l.convert(t.offset),f=this.getZoom(),d=this.getBearing(),p=this.getPitch(),v="center"in t?a.convert(t.center):this.getCenter(),m="zoom"in t?+t.zoom:f,g="bearing"in t?this._normalizeBearing(t.bearing,d):d,y="pitch"in t?+t.pitch:p;Math.abs(c.center.lng)+Math.abs(v.lng)>180&&(c.center.lng>0&&v.lng<0?v.lng+=360:c.center.lng<0&&v.lng>0&&(v.lng-=360));var b=c.zoomScale(m-f),x=c.point,_="center"in t?c.project(v).sub(h.div(b)):x,w=c.worldSize,M=t.curve,k=Math.max(c.width,c.height),A=k/b,T=_.sub(x).mag();
if("minZoom"in t){var E=n.clamp(Math.min(t.minZoom,f,m),c.minZoom,c.maxZoom),S=k/c.zoomScale(E-f);M=Math.sqrt(S/T*2)}var L=M*M,z=r(0),I=function(t){return s(z)/s(z+M*t)},P=function(t){return k*((s(z)*u(z+M*t)-o(z))/L)/T},C=(r(1)-z)/M;if(Math.abs(T)<1e-6){if(Math.abs(k-A)<1e-6)return this.easeTo(t);var R=k>A?-1:1;C=Math.abs(Math.log(A/k))/M,P=function(){return 0},I=function(t){return Math.exp(R*M*t)}}if("duration"in t)t.duration=+t.duration;else{var D="screenSpeed"in t?+t.screenSpeed/M:+t.speed;t.duration=1e3*C/D}return this.zooming=!0,d!==g&&(this.rotating=!0),p!==y&&(this.pitching=!0),this.fire("movestart",e),this.fire("zoomstart",e),this._ease(function(t){var r=t*C,n=P(r);c.zoom=f+c.scaleZoom(1/I(r)),c.center=c.unproject(x.add(_.sub(x).mult(n)),w),this.rotating&&(c.bearing=i(d,g,t)),this.pitching&&(c.pitch=i(p,y,t)),this.fire("move",e),this.fire("zoom",e),this.rotating&&this.fire("rotate",e),this.pitching&&this.fire("pitch",e)},function(){this.fire("zoomend",e),this.fire("moveend",e),this.zooming=!1,this.rotating=!1,this.pitching=!1},t),this},isEasing:function(){return!!this._abortFn},stop:function(){return this._abortFn&&(this._abortFn(),this._finishEase()),this},_ease:function(t,e,r){this._finishFn=e,this._abortFn=o.timed(function(e){t.call(this,r.easing(e)),1===e&&this._finishEase()},r.animate===!1?0:r.duration,this)},_finishEase:function(){delete this._abortFn;var t=this._finishFn;delete this._finishFn,t.call(this)},_normalizeBearing:function(t,e){t=n.wrap(t,-180,180);var r=Math.abs(t-e);return Math.abs(t-360-e)<r&&(t-=360),Math.abs(t+360-e)<r&&(t+=360),t},_updateEasing:function(t,e,r){var i;if(this.ease){var o=this.ease,a=(Date.now()-o.start)/o.duration,s=o.easing(a+.01)-o.easing(a),l=.27/Math.sqrt(s*s+1e-4)*.01,u=Math.sqrt(.0729-l*l);i=n.bezier(l,u,.25,1)}else i=r?n.bezier.apply(n,r):n.ease;return this.ease={start:(new Date).getTime(),to:Math.pow(2,e),duration:t,easing:i},i}})},{"../geo/lng_lat":256,"../geo/lng_lat_bounds":257,"../util/browser":335,"../util/interpolate":343,"../util/util":349,"point-geometry":404}],318:[function(t,e,r){"use strict";function n(t){a.setOptions(this,t)}var i=t("./control"),o=t("../../util/dom"),a=t("../../util/util");e.exports=n,n.createAttributionString=function(t){var e=[];for(var r in t){var n=t[r];n.attribution&&e.indexOf(n.attribution)<0&&e.push(n.attribution)}return e.sort(function(t,e){return t.length-e.length}),e=e.filter(function(t,r){for(var n=r+1;n<e.length;n++)if(e[n].indexOf(t)>=0)return!1;return!0}),e.join(" | ")},n.prototype=a.inherit(i,{options:{position:"bottom-right"},onAdd:function(t){var e="mapboxgl-ctrl-attrib",r=this._container=o.create("div",e,t.getContainer());return this._update(),t.on("source.load",this._update.bind(this)),t.on("source.change",this._update.bind(this)),t.on("source.remove",this._update.bind(this)),t.on("moveend",this._updateEditLink.bind(this)),r},_update:function(){this._map.style&&(this._container.innerHTML=n.createAttributionString(this._map.style.sources)),this._editLink=this._container.getElementsByClassName("mapbox-improve-map")[0],this._updateEditLink()},_updateEditLink:function(){if(this._editLink){var t=this._map.getCenter();this._editLink.href="https://www.mapbox.com/map-feedback/#/"+t.lng+"/"+t.lat+"/"+Math.round(this._map.getZoom()+1)}}})},{"../../util/dom":338,"../../util/util":349,"./control":319}],319:[function(t,e,r){"use strict";function n(){}e.exports=n,n.prototype={addTo:function(t){this._map=t;var e=this._container=this.onAdd(t);if(this.options&&this.options.position){var r=this.options.position,n=t._controlCorners[r];e.className+=" mapboxgl-ctrl",-1!==r.indexOf("bottom")?n.insertBefore(e,n.firstChild):n.appendChild(e)}return this},remove:function(){return this._container.parentNode.removeChild(this._container),this.onRemove&&this.onRemove(this._map),this._map=null,this}}},{}],320:[function(t,e,r){"use strict";function n(t){s.setOptions(this,t)}var i=t("./control"),o=t("../../util/browser"),a=t("../../util/dom"),s=t("../../util/util");e.exports=n;var l={enableHighAccuracy:!1,timeout:6e3};n.prototype=s.inherit(i,{options:{position:"top-right"},onAdd:function(t){var e="mapboxgl-ctrl",r=this._container=a.create("div",e+"-group",t.getContainer());return o.supportsGeolocation?(this._container.addEventListener("contextmenu",this._onContextMenu.bind(this)),this._geolocateButton=a.create("button",e+"-icon "+e+"-geolocate",this._container),this._geolocateButton.addEventListener("click",this._onClickGeolocate.bind(this)),r):r},_onContextMenu:function(t){t.preventDefault()},_onClickGeolocate:function(){navigator.geolocation.getCurrentPosition(this._success.bind(this),this._error.bind(this),l),this._timeoutId=setTimeout(this._finish.bind(this),1e4)},_success:function(t){this._map.jumpTo({center:[t.coords.longitude,t.coords.latitude],zoom:17,bearing:0,pitch:0}),this._finish()},_error:function(){this._finish()},_finish:function(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}})},{"../../util/browser":335,"../../util/dom":338,"../../util/util":349,"./control":319}],321:[function(t,e,r){"use strict";function n(t){s.setOptions(this,t)}function i(t){return new MouseEvent(t.type,{button:2,buttons:2,bubbles:!0,cancelable:!0,detail:t.detail,view:t.view,screenX:t.screenX,screenY:t.screenY,clientX:t.clientX,clientY:t.clientY,movementX:t.movementX,movementY:t.movementY,ctrlKey:t.ctrlKey,shiftKey:t.shiftKey,altKey:t.altKey,metaKey:t.metaKey})}var o=t("./control"),a=t("../../util/dom"),s=t("../../util/util");e.exports=n,n.prototype=s.inherit(o,{options:{position:"top-right"},onAdd:function(t){var e="mapboxgl-ctrl",r=this._container=a.create("div",e+"-group",t.getContainer());return this._container.addEventListener("contextmenu",this._onContextMenu.bind(this)),this._zoomInButton=this._createButton(e+"-icon "+e+"-zoom-in",t.zoomIn.bind(t)),this._zoomOutButton=this._createButton(e+"-icon "+e+"-zoom-out",t.zoomOut.bind(t)),this._compass=this._createButton(e+"-icon "+e+"-compass",t.resetNorth.bind(t)),this._compassArrow=a.create("div","arrow",this._compass),this._compass.addEventListener("mousedown",this._onCompassDown.bind(this)),this._onCompassMove=this._onCompassMove.bind(this),this._onCompassUp=this._onCompassUp.bind(this),t.on("rotate",this._rotateCompassArrow.bind(this)),this._rotateCompassArrow(),this._el=t.getCanvasContainer(),r},_onContextMenu:function(t){t.preventDefault()},_onCompassDown:function(t){0===t.button&&(a.disableDrag(),document.addEventListener("mousemove",this._onCompassMove),document.addEventListener("mouseup",this._onCompassUp),this._el.dispatchEvent(i(t)),t.stopPropagation())},_onCompassMove:function(t){0===t.button&&(this._el.dispatchEvent(i(t)),t.stopPropagation())},_onCompassUp:function(t){0===t.button&&(document.removeEventListener("mousemove",this._onCompassMove),document.removeEventListener("mouseup",this._onCompassUp),a.enableDrag(),this._el.dispatchEvent(i(t)),t.stopPropagation())},_createButton:function(t,e){var r=a.create("button",t,this._container);return r.addEventListener("click",function(){e()}),r},_rotateCompassArrow:function(){var t="rotate("+this._map.transform.angle*(180/Math.PI)+"deg)";this._compassArrow.style.transform=t}})},{"../../util/dom":338,"../../util/util":349,"./control":319}],322:[function(t,e,r){"use strict";function n(t){this._map=t,this._el=t.getCanvasContainer(),this._container=t.getContainer(),a.bindHandlers(this)}var i=t("../../util/dom"),o=t("../../geo/lng_lat_bounds"),a=t("../../util/util");e.exports=n,n.prototype={_enabled:!1,_active:!1,isEnabled:function(){return this._enabled},isActive:function(){return this._active},enable:function(){this.isEnabled()||(this._el.addEventListener("mousedown",this._onMouseDown,!1),this._enabled=!0)},disable:function(){this.isEnabled()&&(this._el.removeEventListener("mousedown",this._onMouseDown),this._enabled=!1)},_onMouseDown:function(t){t.shiftKey&&0===t.button&&(document.addEventListener("mousemove",this._onMouseMove,!1),document.addEventListener("keydown",this._onKeyDown,!1),document.addEventListener("mouseup",this._onMouseUp,!1),i.disableDrag(),this._startPos=i.mousePos(this._el,t),this._active=!0)},_onMouseMove:function(t){var e=this._startPos,r=i.mousePos(this._el,t);this._box||(this._box=i.create("div","mapboxgl-boxzoom",this._container),this._container.classList.add("mapboxgl-crosshair"),this._fireEvent("boxzoomstart",t));var n=Math.min(e.x,r.x),o=Math.max(e.x,r.x),a=Math.min(e.y,r.y),s=Math.max(e.y,r.y);i.setTransform(this._box,"translate("+n+"px,"+a+"px)"),this._box.style.width=o-n+"px",this._box.style.height=s-a+"px"},_onMouseUp:function(t){if(0===t.button){var e=this._startPos,r=i.mousePos(this._el,t),n=new o(this._map.unproject(e),this._map.unproject(r));this._finish(),e.x===r.x&&e.y===r.y?this._fireEvent("boxzoomcancel",t):this._map.fitBounds(n,{linear:!0}).fire("boxzoomend",{originalEvent:t,boxZoomBounds:n})}},_onKeyDown:function(t){27===t.keyCode&&(this._finish(),this._fireEvent("boxzoomcancel",t))},_finish:function(){this._active=!1,document.removeEventListener("mousemove",this._onMouseMove,!1),document.removeEventListener("keydown",this._onKeyDown,!1),document.removeEventListener("mouseup",this._onMouseUp,!1),this._container.classList.remove("mapboxgl-crosshair"),this._box&&(this._box.parentNode.removeChild(this._box),this._box=null),i.enableDrag()},_fireEvent:function(t,e){return this._map.fire(t,{originalEvent:e})}}},{"../../geo/lng_lat_bounds":257,"../../util/dom":338,"../../util/util":349}],323:[function(t,e,r){"use strict";function n(t){this._map=t,this._onDblClick=this._onDblClick.bind(this)}e.exports=n,n.prototype={_enabled:!1,isEnabled:function(){return this._enabled},enable:function(){this.isEnabled()||(this._map.on("dblclick",this._onDblClick),this._enabled=!0)},disable:function(){this.isEnabled()&&(this._map.off("dblclick",this._onDblClick),this._enabled=!1)},_onDblClick:function(t){this._map.zoomTo(this._map.getZoom()+(t.originalEvent.shiftKey?-1:1),{around:t.lngLat})}}},{}],324:[function(t,e,r){"use strict";function n(t){this._map=t,this._el=t.getCanvasContainer(),o.bindHandlers(this)}var i=t("../../util/dom"),o=t("../../util/util");e.exports=n;var a=.3,s=o.bezier(0,0,a,1),l=1400,u=2500;n.prototype={_enabled:!1,_active:!1,isEnabled:function(){return this._enabled},isActive:function(){return this._active},enable:function(){this.isEnabled()||(this._el.addEventListener("mousedown",this._onDown),this._el.addEventListener("touchstart",this._onDown),this._enabled=!0)},disable:function(){this.isEnabled()&&(this._el.removeEventListener("mousedown",this._onDown),this._el.removeEventListener("touchstart",this._onDown),this._enabled=!1)},_onDown:function(t){this._ignoreEvent(t)||this.isActive()||(t.touches?(document.addEventListener("touchmove",this._onMove),document.addEventListener("touchend",this._onTouchEnd)):(document.addEventListener("mousemove",this._onMove),document.addEventListener("mouseup",this._onMouseUp)),this._active=!1,this._startPos=this._pos=i.mousePos(this._el,t),this._inertia=[[Date.now(),this._pos]])},_onMove:function(t){if(!this._ignoreEvent(t)){this.isActive()||(this._active=!0,this._fireEvent("dragstart",t),this._fireEvent("movestart",t));var e=i.mousePos(this._el,t),r=this._map;r.stop(),this._drainInertiaBuffer(),this._inertia.push([Date.now(),e]),r.transform.setLocationAtPoint(r.transform.pointLocation(this._pos),e),this._fireEvent("drag",t),this._fireEvent("move",t),this._pos=e,t.preventDefault()}},_onUp:function(t){if(this.isActive()){this._active=!1,this._fireEvent("dragend",t),this._drainInertiaBuffer();var e=function(){this._fireEvent("moveend",t)}.bind(this),r=this._inertia;if(r.length<2)return void e();var n=r[r.length-1],i=r[0],o=n[1].sub(i[1]),c=(n[0]-i[0])/1e3;if(0===c||n[1].equals(i[1]))return void e();var h=o.mult(a/c),f=h.mag();f>l&&(f=l,h._unit()._mult(f));var d=f/(u*a),p=h.mult(-d/2);this._map.panBy(p,{duration:1e3*d,easing:s,noMoveStart:!0},{originalEvent:t})}},_onMouseUp:function(t){this._ignoreEvent(t)||(this._onUp(t),document.removeEventListener("mousemove",this._onMove),document.removeEventListener("mouseup",this._onMouseUp))},_onTouchEnd:function(t){this._ignoreEvent(t)||(this._onUp(t),document.removeEventListener("touchmove",this._onMove),document.removeEventListener("touchend",this._onTouchEnd))},_fireEvent:function(t,e){return this._map.fire(t,{originalEvent:e})},_ignoreEvent:function(t){var e=this._map;if(e.boxZoom&&e.boxZoom.isActive())return!0;if(e.dragRotate&&e.dragRotate.isActive())return!0;if(t.touches)return t.touches.length>1;if(t.ctrlKey)return!0;var r=1,n=0;return"mousemove"===t.type?t.buttons&0===r:t.button!==n},_drainInertiaBuffer:function(){for(var t=this._inertia,e=Date.now(),r=160;t.length>0&&e-t[0][0]>r;)t.shift()}}},{"../../util/dom":338,"../../util/util":349}],325:[function(t,e,r){"use strict";function n(t){this._map=t,this._el=t.getCanvasContainer(),a.bindHandlers(this)}var i=t("../../util/dom"),o=t("point-geometry"),a=t("../../util/util");e.exports=n;var s=.25,l=a.bezier(0,0,s,1),u=180,c=720;n.prototype={_enabled:!1,_active:!1,isEnabled:function(){return this._enabled},isActive:function(){return this._active},enable:function(){this.isEnabled()||(this._el.addEventListener("mousedown",this._onDown),this._enabled=!0)},disable:function(){this.isEnabled()&&(this._el.removeEventListener("mousedown",this._onDown),this._enabled=!1)},_onDown:function(t){if(!this._ignoreEvent(t)&&!this.isActive()){document.addEventListener("mousemove",this._onMove),document.addEventListener("mouseup",this._onUp),this._active=!1,this._inertia=[[Date.now(),this._map.getBearing()]],this._startPos=this._pos=i.mousePos(this._el,t),this._center=this._map.transform.centerPoint;var e=this._startPos.sub(this._center),r=e.mag();200>r&&(this._center=this._startPos.add(new o(-200,0)._rotate(e.angle()))),t.preventDefault()}},_onMove:function(t){if(!this._ignoreEvent(t)){this.isActive()||(this._active=!0,this._fireEvent("rotatestart",t),this._fireEvent("movestart",t));var e=this._map;e.stop();var r=this._pos,n=i.mousePos(this._el,t),o=this._center,a=r.sub(o).angleWith(n.sub(o))/Math.PI*180,s=e.getBearing()-a,l=this._inertia,u=l[l.length-1];this._drainInertiaBuffer(),l.push([Date.now(),e._normalizeBearing(s,u[1])]),e.transform.bearing=s,this._fireEvent("rotate",t),this._fireEvent("move",t),this._pos=n}},_onUp:function(t){if(!this._ignoreEvent(t)&&(document.removeEventListener("mousemove",this._onMove),document.removeEventListener("mouseup",this._onUp),this.isActive())){this._active=!1,this._fireEvent("rotateend",t),this._drainInertiaBuffer();var e=this._map,r=e.getBearing(),n=this._inertia,i=function(){Math.abs(r)<e.options.bearingSnap?e.resetNorth({noMoveStart:!0},{originalEvent:t}):this._fireEvent("moveend",t)}.bind(this);if(n.length<2)return void i();var o=n[0],a=n[n.length-1],h=n[n.length-2],f=e._normalizeBearing(r,h[1]),d=a[1]-o[1],p=0>d?-1:1,v=(a[0]-o[0])/1e3;if(0===d||0===v)return void i();var m=Math.abs(d*(s/v));m>u&&(m=u);var g=m/(c*s),y=p*m*(g/2);f+=y,Math.abs(e._normalizeBearing(f,0))<e.options.bearingSnap&&(f=e._normalizeBearing(0,f)),e.rotateTo(f,{duration:1e3*g,easing:l,noMoveStart:!0},{originalEvent:t})}},_fireEvent:function(t,e){return this._map.fire(t,{originalEvent:e})},_ignoreEvent:function(t){var e=this._map;if(e.boxZoom&&e.boxZoom.isActive())return!0;if(e.dragPan&&e.dragPan.isActive())return!0;if(t.touches)return t.touches.length>1;var r=t.ctrlKey?1:2,n=t.ctrlKey?0:2;return"mousemove"===t.type?t.buttons&0===r:t.button!==n},_drainInertiaBuffer:function(){for(var t=this._inertia,e=Date.now(),r=160;t.length>0&&e-t[0][0]>r;)t.shift()}}},{"../../util/dom":338,"../../util/util":349,"point-geometry":404}],326:[function(t,e,r){"use strict";function n(t){this._map=t,this._el=t.getCanvasContainer(),this._onKeyDown=this._onKeyDown.bind(this)}e.exports=n;var i=80,o=2,a=5;n.prototype={_enabled:!1,isEnabled:function(){return this._enabled},enable:function(){this.isEnabled()||(this._el.addEventListener("keydown",this._onKeyDown,!1),this._enabled=!0)},disable:function(){this.isEnabled()&&(this._el.removeEventListener("keydown",this._onKeyDown),this._enabled=!1)},_onKeyDown:function(t){if(!(t.altKey||t.ctrlKey||t.metaKey)){var e=this._map,r={originalEvent:t};switch(t.keyCode){case 61:case 107:case 171:case 187:e.zoomTo(Math.round(e.getZoom())+(t.shiftKey?2:1),r);break;case 189:case 109:case 173:e.zoomTo(Math.round(e.getZoom())-(t.shiftKey?2:1),r);break;case 37:t.shiftKey?e.easeTo({bearing:e.getBearing()-o},r):(t.preventDefault(),e.panBy([-i,0],r));break;case 39:t.shiftKey?e.easeTo({bearing:e.getBearing()+o},r):(t.preventDefault(),e.panBy([i,0],r));break;case 38:t.shiftKey?e.easeTo({pitch:e.getPitch()+a},r):(t.preventDefault(),e.panBy([0,-i],r));break;case 40:t.shiftKey?e.easeTo({pitch:Math.max(e.getPitch()-a,0)},r):(t.preventDefault(),e.panBy([0,i],r))}}}}},{}],327:[function(t,e,r){"use strict";function n(t){this._map=t,this._el=t.getCanvasContainer(),a.bindHandlers(this)}var i=t("../../util/dom"),o=t("../../util/browser"),a=t("../../util/util");e.exports=n;var s="undefined"!=typeof navigator?navigator.userAgent.toLowerCase():"",l=-1!==s.indexOf("firefox"),u=-1!==s.indexOf("safari")&&-1===s.indexOf("chrom");n.prototype={_enabled:!1,isEnabled:function(){return this._enabled},enable:function(){this.isEnabled()||(this._el.addEventListener("wheel",this._onWheel,!1),this._el.addEventListener("mousewheel",this._onWheel,!1),this._enabled=!0)},disable:function(){this.isEnabled()&&(this._el.removeEventListener("wheel",this._onWheel),this._el.removeEventListener("mousewheel",this._onWheel),this._enabled=!1)},_onWheel:function(t){var e;"wheel"===t.type?(e=t.deltaY,l&&t.deltaMode===window.WheelEvent.DOM_DELTA_PIXEL&&(e/=o.devicePixelRatio),t.deltaMode===window.WheelEvent.DOM_DELTA_LINE&&(e*=40)):"mousewheel"===t.type&&(e=-t.wheelDeltaY,u&&(e/=3));var r=o.now(),n=r-(this._time||0);this._pos=i.mousePos(this._el,t),this._time=r,0!==e&&e%4.000244140625===0?(this._type="wheel",e=Math.floor(e/4)):0!==e&&Math.abs(e)<4?this._type="trackpad":n>400?(this._type=null,this._lastValue=e,this._timeout=setTimeout(this._onTimeout,40)):this._type||(this._type=Math.abs(n*e)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,e+=this._lastValue)),t.shiftKey&&e&&(e/=4),this._type&&this._zoom(-e,t),t.preventDefault()},_onTimeout:function(){this._type="wheel",this._zoom(-this._lastValue)},_zoom:function(t,e){if(0!==t){var r=this._map,n=2/(1+Math.exp(-Math.abs(t/100)));0>t&&0!==n&&(n=1/n);var i=r.ease?r.ease.to:r.transform.scale,o=r.transform.scaleZoom(i*n);r.zoomTo(o,{duration:0,around:r.unproject(this._pos),delayEndEvents:200},{originalEvent:e})}}}},{"../../util/browser":335,"../../util/dom":338,"../../util/util":349}],328:[function(t,e,r){"use strict";function n(t){this._map=t,this._el=t.getCanvasContainer(),o.bindHandlers(this)}var i=t("../../util/dom"),o=t("../../util/util");e.exports=n;var a=.15,s=o.bezier(0,0,a,1),l=12,u=2.5,c=.15,h=4;n.prototype={_enabled:!1,isEnabled:function(){return this._enabled},enable:function(){this.isEnabled()||(this._el.addEventListener("touchstart",this._onStart,!1),this._enabled=!0)},disable:function(){this.isEnabled()&&(this._el.removeEventListener("touchstart",this._onStart),this._enabled=!1)},disableRotation:function(){this._rotationDisabled=!0},enableRotation:function(){this._rotationDisabled=!1},_onStart:function(t){if(2===t.touches.length){var e=i.mousePos(this._el,t.touches[0]),r=i.mousePos(this._el,t.touches[1]);this._startVec=e.sub(r),this._startScale=this._map.transform.scale,this._startBearing=this._map.transform.bearing,this._gestureIntent=void 0,this._inertia=[],document.addEventListener("touchmove",this._onMove,!1),document.addEventListener("touchend",this._onEnd,!1)}},_onMove:function(t){if(2===t.touches.length){var e=i.mousePos(this._el,t.touches[0]),r=i.mousePos(this._el,t.touches[1]),n=e.add(r).div(2),o=e.sub(r),a=o.mag()/this._startVec.mag(),s=this._rotationDisabled?0:180*o.angleWith(this._startVec)/Math.PI,l=this._map;if(this._gestureIntent){var u={duration:0,around:l.unproject(n)};"rotate"===this._gestureIntent&&(u.bearing=this._startBearing+s),"zoom"!==this._gestureIntent&&"rotate"!==this._gestureIntent||(u.zoom=l.transform.scaleZoom(this._startScale*a)),l.stop(),this._drainInertiaBuffer(),this._inertia.push([Date.now(),a,n]),l.easeTo(u,{originalEvent:t})}else{var f=Math.abs(1-a)>c,d=Math.abs(s)>h;d?this._gestureIntent="rotate":f&&(this._gestureIntent="zoom"),this._gestureIntent&&(this._startVec=o,this._startScale=l.transform.scale,this._startBearing=l.transform.bearing)}t.preventDefault()}},_onEnd:function(t){document.removeEventListener("touchmove",this._onMove),document.removeEventListener("touchend",this._onEnd),this._drainInertiaBuffer();var e=this._inertia,r=this._map;if(e.length<2)return void r.snapToNorth({},{originalEvent:t});var n=e[e.length-1],i=e[0],o=r.transform.scaleZoom(this._startScale*n[1]),c=r.transform.scaleZoom(this._startScale*i[1]),h=o-c,f=(n[0]-i[0])/1e3,d=n[2];if(0===f||o===c)return void r.snapToNorth({},{originalEvent:t});var p=h*a/f;Math.abs(p)>u&&(p=p>0?u:-u);var v=1e3*Math.abs(p/(l*a)),m=o+p*v/2e3;0>m&&(m=0),r.easeTo({zoom:m,duration:v,easing:s,around:r.unproject(d)},{originalEvent:t})},_drainInertiaBuffer:function(){for(var t=this._inertia,e=Date.now(),r=160;t.length>2&&e-t[0][0]>r;)t.shift()}}},{"../../util/dom":338,"../../util/util":349}],329:[function(t,e,r){"use strict";function n(){i.bindAll(["_onHashChange","_updateHash"],this)}e.exports=n;var i=t("../util/util");n.prototype={addTo:function(t){return this._map=t,window.addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this},remove:function(){return window.removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),delete this._map,this},_onHashChange:function(){var t=location.hash.replace("#","").split("/");return t.length>=3?(this._map.jumpTo({center:[+t[2],+t[1]],zoom:+t[0],bearing:+(t[3]||0)}),!0):!1},_updateHash:function(){var t=this._map.getCenter(),e=this._map.getZoom(),r=this._map.getBearing(),n=Math.max(0,Math.ceil(Math.log(e)/Math.LN2)),i="#"+Math.round(100*e)/100+"/"+t.lat.toFixed(n)+"/"+t.lng.toFixed(n)+(r?"/"+Math.round(10*r)/10:"");window.history.replaceState("","",i)}}},{"../util/util":349}],330:[function(t,e,r){"use strict";function n(t){this._map=t,this._el=t.getCanvasContainer();for(var e in i)t[e]=new i[e](t);a.bindHandlers(this)}var i={scrollZoom:t("./handler/scroll_zoom"),boxZoom:t("./handler/box_zoom"),dragRotate:t("./handler/drag_rotate"),dragPan:t("./handler/drag_pan"),keyboard:t("./handler/keyboard"),doubleClickZoom:t("./handler/dblclick_zoom"),touchZoomRotate:t("./handler/touch_zoom_rotate")},o=t("../util/dom"),a=t("../util/util"),s=t("point-geometry");e.exports=n,n.prototype={enable:function(){var t=this._map.options,e=this._el;for(var r in i)t[r]&&this._map[r].enable();e.addEventListener("mousedown",this._onMouseDown,!1),e.addEventListener("mouseup",this._onMouseUp,!1),e.addEventListener("mousemove",this._onMouseMove,!1),e.addEventListener("touchstart",this._onTouchStart,!1),e.addEventListener("touchend",this._onTouchEnd,!1),e.addEventListener("touchmove",this._onTouchMove,!1),e.addEventListener("touchcancel",this._onTouchCancel,!1),e.addEventListener("click",this._onClick,!1),e.addEventListener("dblclick",this._onDblClick,!1),e.addEventListener("contextmenu",this._onContextMenu,!1)},disable:function(){var t=this._map.options,e=this._el;for(var r in i)t[r]&&this._map[r].disable();e.removeEventListener("mousedown",this._onMouseDown),e.removeEventListener("mouseup",this._onMouseUp),e.removeEventListener("mousemove",this._onMouseMove),e.removeEventListener("touchstart",this._onTouchStart),e.removeEventListener("touchend",this._onTouchEnd),e.removeEventListener("touchmove",this._onTouchMove),e.removeEventListener("touchcancel",this._onTouchCancel),e.removeEventListener("click",this._onClick),e.removeEventListener("dblclick",this._onDblClick),e.removeEventListener("contextmenu",this._onContextMenu)},_onMouseDown:function(t){this._map.stop(),this._startPos=o.mousePos(this._el,t),this._fireMouseEvent("mousedown",t)},_onMouseUp:function(t){var e=this._map,r=e.dragRotate&&e.dragRotate.isActive();this._contextMenuEvent&&!r&&this._fireMouseEvent("contextmenu",this._contextMenuEvent),this._contextMenuEvent=null,this._fireMouseEvent("mouseup",t)},_onMouseMove:function(t){var e=this._map,r=this._el;if(!(e.dragPan&&e.dragPan.isActive()||e.dragRotate&&e.dragRotate.isActive())){for(var n=t.toElement||t.target;n&&n!==r;)n=n.parentNode;n===r&&this._fireMouseEvent("mousemove",t)}},_onTouchStart:function(t){this._map.stop(),this._fireTouchEvent("touchstart",t),!t.touches||t.touches.length>1||(this._tapped?(clearTimeout(this._tapped),this._tapped=null,this._fireMouseEvent("dblclick",t)):this._tapped=setTimeout(this._onTouchTimeout,300))},_onTouchMove:function(t){this._fireTouchEvent("touchmove",t)},_onTouchEnd:function(t){this._fireTouchEvent("touchend",t)},_onTouchCancel:function(t){this._fireTouchEvent("touchcancel",t)},_onTouchTimeout:function(){this._tapped=null},_onClick:function(t){var e=o.mousePos(this._el,t);e.equals(this._startPos)&&this._fireMouseEvent("click",t)},_onDblClick:function(t){this._fireMouseEvent("dblclick",t),t.preventDefault()},_onContextMenu:function(t){this._contextMenuEvent=t,t.preventDefault()},_fireMouseEvent:function(t,e){var r=o.mousePos(this._el,e);return this._map.fire(t,{lngLat:this._map.unproject(r),point:r,originalEvent:e})},_fireTouchEvent:function(t,e){var r=o.touchPos(this._el,e),n=r.reduce(function(t,e,r,n){return t.add(e.div(n.length))},new s(0,0));return this._map.fire(t,{lngLat:this._map.unproject(n),point:n,lngLats:r.map(function(t){return this._map.unproject(t)},this),points:r,originalEvent:e})}}},{"../util/dom":338,"../util/util":349,"./handler/box_zoom":322,"./handler/dblclick_zoom":323,"./handler/drag_pan":324,"./handler/drag_rotate":325,"./handler/keyboard":326,"./handler/scroll_zoom":327,"./handler/touch_zoom_rotate":328,"point-geometry":404}],331:[function(t,e,r){"use strict";function n(t){t.parentNode&&t.parentNode.removeChild(t)}var i=t("../util/canvas"),o=t("../util/util"),a=t("../util/browser"),s=t("../util/evented"),l=t("../util/dom"),u=t("../style/style"),c=t("../style/animation_loop"),h=t("../render/painter"),f=t("../geo/transform"),d=t("./hash"),p=t("./interaction"),v=t("./camera"),m=t("../geo/lng_lat"),g=t("../geo/lng_lat_bounds"),y=t("point-geometry"),b=t("./control/attribution"),x=0,_=20,w=e.exports=function(t){t=o.inherit(this.options,t),this._interactive=t.interactive,this._failIfMajorPerformanceCaveat=t.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=t.preserveDrawingBuffer,"string"==typeof t.container?this._container=document.getElementById(t.container):this._container=t.container,this.animationLoop=new c,this.transform=new f(t.minZoom,t.maxZoom),t.maxBounds&&this.setMaxBounds(t.maxBounds),o.bindAll(["_forwardStyleEvent","_forwardSourceEvent","_forwardLayerEvent","_forwardTileEvent","_onStyleLoad","_onStyleChange","_onSourceAdd","_onSourceRemove","_onSourceUpdate","_onWindowResize","onError","_update","_render"],this),this._setupContainer(),this._setupPainter(),this.on("move",this._update.bind(this,!1)),this.on("zoom",this._update.bind(this,!0)),this.on("moveend",function(){this.animationLoop.set(300),this._rerender()}.bind(this)),"undefined"!=typeof window&&window.addEventListener("resize",this._onWindowResize,!1),this.interaction=new p(this),t.interactive&&this.interaction.enable(),this._hash=t.hash&&(new d).addTo(this),this._hash&&this._hash._onHashChange()||this.jumpTo(t),this.stacks={},this._classes=[],this.resize(),t.classes&&this.setClasses(t.classes),t.style&&this.setStyle(t.style),t.attributionControl&&this.addControl(new b(t.attributionControl)),this.on("style.error",this.onError),this.on("source.error",this.onError),this.on("tile.error",this.onError),this.on("layer.error",this.onError)};o.extend(w.prototype,s),o.extend(w.prototype,v.prototype),o.extend(w.prototype,{options:{center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:x,maxZoom:_,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,bearingSnap:7,hash:!1,attributionControl:!0,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1},addControl:function(t){return t.addTo(this),this},addClass:function(t,e){return this._classes.indexOf(t)>=0||""===t?this:(this._classes.push(t),this._classOptions=e,this.style&&this.style.updateClasses(),this._update(!0))},removeClass:function(t,e){var r=this._classes.indexOf(t);return 0>r||""===t?this:(this._classes.splice(r,1),this._classOptions=e,this.style&&this.style.updateClasses(),this._update(!0))},setClasses:function(t,e){for(var r={},n=0;n<t.length;n++)""!==t[n]&&(r[t[n]]=!0);return this._classes=Object.keys(r),this._classOptions=e,this.style&&this.style.updateClasses(),this._update(!0)},hasClass:function(t){return this._classes.indexOf(t)>=0},getClasses:function(){return this._classes},resize:function(){var t=0,e=0;return this._container&&(t=this._container.offsetWidth||400,e=this._container.offsetHeight||300),this._canvas.resize(t,e),this.transform.resize(t,e),this.painter.resize(t,e),this.fire("movestart").fire("move").fire("resize").fire("moveend")},getBounds:function(){var t=new g(this.transform.pointLocation(new y(0,0)),this.transform.pointLocation(this.transform.size));return(this.transform.angle||this.transform.pitch)&&(t.extend(this.transform.pointLocation(new y(this.transform.size.x,0))),t.extend(this.transform.pointLocation(new y(0,this.transform.size.y)))),t},setMaxBounds:function(t){if(t){var e=g.convert(t);this.transform.lngRange=[e.getWest(),e.getEast()],this.transform.latRange=[e.getSouth(),e.getNorth()],this.transform._constrain(),this._update()}else null!==t&&void 0!==t||(this.transform.lngRange=[],this.transform.latRange=[],this._update());return this},setMinZoom:function(t){if(t=null===t||void 0===t?x:t,t>=x&&t<=this.transform.maxZoom)return this.transform.minZoom=t,this._update(),this.getZoom()<t&&this.setZoom(t),this;throw new Error("minZoom must be between "+x+" and the current maxZoom, inclusive")},setMaxZoom:function(t){if(t=null===t||void 0===t?_:t,t>=this.transform.minZoom&&_>=t)return this.transform.maxZoom=t,this._update(),this.getZoom()>t&&this.setZoom(t),this;throw new Error("maxZoom must be between the current minZoom and "+_+", inclusive")},project:function(t){return this.transform.locationPoint(m.convert(t))},unproject:function(t){return this.transform.pointLocation(y.convert(t))},queryRenderedFeatures:function(t,e){t instanceof y||Array.isArray(t)||(e=t,t=void 0);var r=this._makeQueryGeometry(t);return this.style.queryRenderedFeatures(r,e,this.transform.zoom,this.transform.angle)},_makeQueryGeometry:function(t){void 0===t&&(t=[y.convert([0,0]),y.convert([this.transform.width,this.transform.height])]);var e,r=t instanceof y||"number"==typeof t[0];if(r){var n=y.convert(t);e=[n]}else{var i=[y.convert(t[0]),y.convert(t[1])];e=[i[0],new y(i[1].x,i[0].y),i[1],new y(i[0].x,i[1].y),i[0]]}return e=e.map(function(t){return this.transform.pointCoordinate(t)}.bind(this))},querySourceFeatures:function(t,e){return this.style.querySourceFeatures(t,e)},setStyle:function(t){return this.style&&(this.style.off("load",this._onStyleLoad).off("error",this._forwardStyleEvent).off("change",this._onStyleChange).off("source.add",this._onSourceAdd).off("source.remove",this._onSourceRemove).off("source.load",this._onSourceUpdate).off("source.error",this._forwardSourceEvent).off("source.change",this._onSourceUpdate).off("layer.add",this._forwardLayerEvent).off("layer.remove",this._forwardLayerEvent).off("layer.error",this._forwardLayerEvent).off("tile.add",this._forwardTileEvent).off("tile.remove",this._forwardTileEvent).off("tile.load",this._update).off("tile.error",this._forwardTileEvent).off("tile.stats",this._forwardTileEvent)._remove(),this.off("rotate",this.style._redoPlacement),
this.off("pitch",this.style._redoPlacement)),t?(t instanceof u?this.style=t:this.style=new u(t,this.animationLoop),this.style.on("load",this._onStyleLoad).on("error",this._forwardStyleEvent).on("change",this._onStyleChange).on("source.add",this._onSourceAdd).on("source.remove",this._onSourceRemove).on("source.load",this._onSourceUpdate).on("source.error",this._forwardSourceEvent).on("source.change",this._onSourceUpdate).on("layer.add",this._forwardLayerEvent).on("layer.remove",this._forwardLayerEvent).on("layer.error",this._forwardLayerEvent).on("tile.add",this._forwardTileEvent).on("tile.remove",this._forwardTileEvent).on("tile.load",this._update).on("tile.error",this._forwardTileEvent).on("tile.stats",this._forwardTileEvent),this.on("rotate",this.style._redoPlacement),this.on("pitch",this.style._redoPlacement),this):(this.style=null,this)},getStyle:function(){return this.style.serialize()},addSource:function(t,e){return this.style.addSource(t,e),this._update(!0),this},removeSource:function(t){return this.style.removeSource(t),this._update(!0),this},getSource:function(t){return this.style.getSource(t)},addLayer:function(t,e){return this.style.addLayer(t,e),this._update(!0),this},removeLayer:function(t){return this.style.removeLayer(t),this._update(!0),this},getLayer:function(t){return this.style.getLayer(t)},setFilter:function(t,e){return this.style.setFilter(t,e),this._update(!0),this},setLayerZoomRange:function(t,e,r){return this.style.setLayerZoomRange(t,e,r),this._update(!0),this},getFilter:function(t){return this.style.getFilter(t)},setPaintProperty:function(t,e,r,n){return this.style.setPaintProperty(t,e,r,n),this._update(!0),this},getPaintProperty:function(t,e,r){return this.style.getPaintProperty(t,e,r)},setLayoutProperty:function(t,e,r){return this.style.setLayoutProperty(t,e,r),this._update(!0),this},getLayoutProperty:function(t,e){return this.style.getLayoutProperty(t,e)},getContainer:function(){return this._container},getCanvasContainer:function(){return this._canvasContainer},getCanvas:function(){return this._canvas.getElement()},_setupContainer:function(){var t=this._container;t.classList.add("mapboxgl-map");var e=this._canvasContainer=l.create("div","mapboxgl-canvas-container",t);this._interactive&&e.classList.add("mapboxgl-interactive"),this._canvas=new i(this,e);var r=this._controlContainer=l.create("div","mapboxgl-control-container",t),n=this._controlCorners={};["top-left","top-right","bottom-left","bottom-right"].forEach(function(t){n[t]=l.create("div","mapboxgl-ctrl-"+t,r)})},_setupPainter:function(){var t=this._canvas.getWebGLContext({failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer});return t?void(this.painter=new h(t,this.transform)):void console.error("Failed to initialize WebGL")},_contextLost:function(t){t.preventDefault(),this._frameId&&a.cancelFrame(this._frameId),this.fire("webglcontextlost",{originalEvent:t})},_contextRestored:function(t){this._setupPainter(),this.resize(),this._update(),this.fire("webglcontextrestored",{originalEvent:t})},loaded:function(){return this._styleDirty||this._sourcesDirty?!1:!(!this.style||!this.style.loaded())},_update:function(t){return this.style?(this._styleDirty=this._styleDirty||t,this._sourcesDirty=!0,this._rerender(),this):this},_render:function(){return this.style&&this._styleDirty&&(this._styleDirty=!1,this.style.update(this._classes,this._classOptions),this._classOptions=null,this.style._recalculate(this.transform.zoom)),this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.painter.render(this.style,{debug:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,vertices:this.vertices,rotating:this.rotating,zooming:this.zooming}),this.fire("render"),this.loaded()&&!this._loaded&&(this._loaded=!0,this.fire("load")),this._frameId=null,this.animationLoop.stopped()||(this._styleDirty=!0),(this._sourcesDirty||this._repaint||!this.animationLoop.stopped())&&this._rerender(),this},remove:function(){this._hash&&this._hash.remove(),a.cancelFrame(this._frameId),this.setStyle(null),"undefined"!=typeof window&&window.removeEventListener("resize",this._onWindowResize,!1),n(this._canvasContainer),n(this._controlContainer),this._container.classList.remove("mapboxgl-map")},onError:function(t){console.error(t.error)},_rerender:function(){this.style&&!this._frameId&&(this._frameId=a.frame(this._render))},_forwardStyleEvent:function(t){this.fire("style."+t.type,o.extend({style:t.target},t))},_forwardSourceEvent:function(t){this.fire(t.type,o.extend({style:t.target},t))},_forwardLayerEvent:function(t){this.fire(t.type,o.extend({style:t.target},t))},_forwardTileEvent:function(t){this.fire(t.type,o.extend({style:t.target},t))},_onStyleLoad:function(t){this.transform.unmodified&&this.jumpTo(this.style.stylesheet),this.style.update(this._classes,{transition:!1}),this._forwardStyleEvent(t)},_onStyleChange:function(t){this._update(!0),this._forwardStyleEvent(t)},_onSourceAdd:function(t){var e=t.source;e.onAdd&&e.onAdd(this),this._forwardSourceEvent(t)},_onSourceRemove:function(t){var e=t.source;e.onRemove&&e.onRemove(this),this._forwardSourceEvent(t)},_onSourceUpdate:function(t){this._update(),this._forwardSourceEvent(t)},_onWindowResize:function(){this.stop().resize()._update()}}),o.extendAll(w.prototype,{_showTileBoundaries:!1,get showTileBoundaries(){return this._showTileBoundaries},set showTileBoundaries(t){this._showTileBoundaries!==t&&(this._showTileBoundaries=t,this._update())},_showCollisionBoxes:!1,get showCollisionBoxes(){return this._showCollisionBoxes},set showCollisionBoxes(t){this._showCollisionBoxes!==t&&(this._showCollisionBoxes=t,this.style._redoPlacement())},_showOverdrawInspector:!1,get showOverdrawInspector(){return this._showOverdrawInspector},set showOverdrawInspector(t){this._showOverdrawInspector!==t&&(this._showOverdrawInspector=t,this._update())},_repaint:!1,get repaint(){return this._repaint},set repaint(t){this._repaint=t,this._update()},_vertices:!1,get vertices(){return this._vertices},set vertices(t){this._vertices=t,this._update()}})},{"../geo/lng_lat":256,"../geo/lng_lat_bounds":257,"../geo/transform":258,"../render/painter":271,"../style/animation_loop":287,"../style/style":290,"../util/browser":335,"../util/canvas":336,"../util/dom":338,"../util/evented":341,"../util/util":349,"./camera":317,"./control/attribution":318,"./hash":329,"./interaction":330,"point-geometry":404}],332:[function(t,e,r){"use strict";function n(t){i.setOptions(this,t),i.bindAll(["_update","_onClickClose"],this)}e.exports=n;var i=t("../util/util"),o=t("../util/evented"),a=t("../util/dom"),s=t("../geo/lng_lat");n.prototype=i.inherit(o,{options:{closeButton:!0,closeOnClick:!0},addTo:function(t){return this._map=t,this._map.on("move",this._update),this.options.closeOnClick&&this._map.on("click",this._onClickClose),this._update(),this},remove:function(){return this._content&&this._content.parentNode&&this._content.parentNode.removeChild(this._content),this._container&&(this._container.parentNode.removeChild(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("click",this._onClickClose),delete this._map),this},getLngLat:function(){return this._lngLat},setLngLat:function(t){return this._lngLat=s.convert(t),this._update(),this},setText:function(t){return this.setDOMContent(document.createTextNode(t))},setHTML:function(t){var e,r=document.createDocumentFragment(),n=document.createElement("body");for(n.innerHTML=t;;){if(e=n.firstChild,!e)break;r.appendChild(e)}return this.setDOMContent(r)},setDOMContent:function(t){return this._createContent(),this._content.appendChild(t),this._update(),this},_createContent:function(){this._content&&this._content.parentNode&&this._content.parentNode.removeChild(this._content),this._content=a.create("div","mapboxgl-popup-content",this._container),this.options.closeButton&&(this._closeButton=a.create("button","mapboxgl-popup-close-button",this._content),this._closeButton.innerHTML="&#215;",this._closeButton.addEventListener("click",this._onClickClose))},_update:function(){if(this._map&&this._lngLat&&this._content){this._container||(this._container=a.create("div","mapboxgl-popup",this._map.getContainer()),this._tip=a.create("div","mapboxgl-popup-tip",this._container),this._container.appendChild(this._content));var t=this._map.project(this._lngLat).round(),e=this.options.anchor;if(!e){var r=this._container.offsetWidth,n=this._container.offsetHeight;e=t.y<n?["top"]:t.y>this._map.transform.height-n?["bottom"]:[],t.x<r/2?e.push("left"):t.x>this._map.transform.width-r/2&&e.push("right"),e=0===e.length?"bottom":e.join("-")}var i={top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"},o=this._container.classList;for(var s in i)o.remove("mapboxgl-popup-anchor-"+s);o.add("mapboxgl-popup-anchor-"+e),a.setTransform(this._container,i[e]+" translate("+t.x+"px,"+t.y+"px)")}},_onClickClose:function(){this.remove()}})},{"../geo/lng_lat":256,"../util/dom":338,"../util/evented":341,"../util/util":349}],333:[function(t,e,r){"use strict";function n(t,e){this.target=t,this.parent=e,this.callbacks={},this.callbackID=0,this.receive=this.receive.bind(this),this.target.addEventListener("message",this.receive,!1)}e.exports=n,n.prototype.receive=function(t){var e,r=t.data;if("<response>"===r.type)e=this.callbacks[r.id],delete this.callbacks[r.id],e(r.error||null,r.data);else if("undefined"!=typeof r.id){var n=r.id;this.parent[r.type](r.data,function(t,e,r){this.postMessage({type:"<response>",id:String(n),error:t?String(t):null,data:e},r)}.bind(this))}else this.parent[r.type](r.data)},n.prototype.send=function(t,e,r,n){var i=null;r&&(this.callbacks[i=this.callbackID++]=r),this.postMessage({type:t,id:String(i),data:e},n)},n.prototype.postMessage=function(t,e){this.target.postMessage(t,e)}},{}],334:[function(t,e,r){"use strict";function n(t){var e=document.createElement("a");return e.href=t,e.protocol===document.location.protocol&&e.host===document.location.host}r.getJSON=function(t,e){var r=new XMLHttpRequest;return r.open("GET",t,!0),r.setRequestHeader("Accept","application/json"),r.onerror=function(t){e(t)},r.onload=function(){if(r.status>=200&&r.status<300&&r.response){var t;try{t=JSON.parse(r.response)}catch(n){return e(n)}e(null,t)}else e(new Error(r.statusText))},r.send(),r},r.getArrayBuffer=function(t,e){var r=new XMLHttpRequest;return r.open("GET",t,!0),r.responseType="arraybuffer",r.onerror=function(t){e(t)},r.onload=function(){r.status>=200&&r.status<300&&r.response?e(null,r.response):e(new Error(r.statusText))},r.send(),r},r.getImage=function(t,e){return r.getArrayBuffer(t,function(t,r){if(t)return e(t);var n=new Image;n.onload=function(){e(null,n),(window.URL||window.webkitURL).revokeObjectURL(n.src)};var i=new Blob([new Uint8Array(r)],{type:"image/png"});return n.src=(window.URL||window.webkitURL).createObjectURL(i),n.getData=function(){var t=document.createElement("canvas"),e=t.getContext("2d");return t.width=n.width,t.height=n.height,e.drawImage(n,0,0),e.getImageData(0,0,n.width,n.height).data},n})},r.getVideo=function(t,e){var r=document.createElement("video");r.onloadstart=function(){e(null,r)};for(var i=0;i<t.length;i++){var o=document.createElement("source");n(t[i])||(r.crossOrigin="Anonymous"),o.src=t[i],r.appendChild(o)}return r.getData=function(){return r},r}},{}],335:[function(t,e,r){"use strict";e.exports.now=function(){return window.performance&&window.performance.now?window.performance.now.bind(window.performance):Date.now.bind(Date)}();var n=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame;r.frame=function(t){return n(t)};var i=window.cancelAnimationFrame||window.mozCancelAnimationFrame||window.webkitCancelAnimationFrame||window.msCancelAnimationFrame;r.cancelFrame=function(t){i(t)},r.timed=function(t,n,i){function o(l){a||(l=e.exports.now(),l>=s+n?t.call(i,1):(t.call(i,(l-s)/n),r.frame(o)))}if(!n)return t.call(i,1),null;var a=!1,s=e.exports.now();return r.frame(o),function(){a=!0}},r.supported=t("mapbox-gl-js-supported"),r.hardwareConcurrency=navigator.hardwareConcurrency||8,Object.defineProperty(r,"devicePixelRatio",{get:function(){return window.devicePixelRatio}}),r.supportsWebp=!1;var o=document.createElement("img");o.onload=function(){r.supportsWebp=!0},o.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=",r.supportsGeolocation=!!navigator.geolocation},{"mapbox-gl-js-supported":375}],336:[function(t,e,r){"use strict";function n(t,e){this.canvas=document.createElement("canvas"),t&&e&&(this.canvas.style.position="absolute",this.canvas.classList.add("mapboxgl-canvas"),this.canvas.addEventListener("webglcontextlost",t._contextLost.bind(t),!1),this.canvas.addEventListener("webglcontextrestored",t._contextRestored.bind(t),!1),this.canvas.setAttribute("tabindex",0),e.appendChild(this.canvas))}var i=t("../util"),o=t("mapbox-gl-js-supported");e.exports=n,n.prototype.resize=function(t,e){var r=window.devicePixelRatio||1;this.canvas.width=r*t,this.canvas.height=r*e,this.canvas.style.width=t+"px",this.canvas.style.height=e+"px"},n.prototype.getWebGLContext=function(t){return t=i.extend({},t,o.webGLContextAttributes),this.canvas.getContext("webgl",t)||this.canvas.getContext("experimental-webgl",t)},n.prototype.getElement=function(){return this.canvas}},{"../util":349,"mapbox-gl-js-supported":375}],337:[function(t,e,r){"use strict";function n(e,r){this.actors=[],this.currentActor=0;for(var n=0;e>n;n++){var a=new o(t("../../source/worker")),s=new i(a,r);s.name="Worker "+n,this.actors.push(s)}}var i=t("../actor"),o=t("webworkify");e.exports=n,n.prototype={broadcast:function(t,e){for(var r=0;r<this.actors.length;r++)this.actors[r].send(t,e)},send:function(t,e,r,n,i){return("number"!=typeof n||isNaN(n))&&(n=this.currentActor=(this.currentActor+1)%this.actors.length),this.actors[n].send(t,e,r,i),n},remove:function(){for(var t=0;t<this.actors.length;t++)this.actors[t].target.terminate();this.actors=[]}}},{"../../source/worker":285,"../actor":333,webworkify:420}],338:[function(t,e,r){"use strict";function n(t){for(var e=0;e<t.length;e++)if(t[e]in s)return t[e]}function i(t){t.preventDefault(),t.stopPropagation(),window.removeEventListener("click",i,!0)}var o=t("point-geometry");r.create=function(t,e,r){var n=document.createElement(t);return e&&(n.className=e),r&&r.appendChild(n),n};var a,s=document.documentElement.style,l=n(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]);r.disableDrag=function(){l&&(a=s[l],s[l]="none")},r.enableDrag=function(){l&&(s[l]=a)};var u=n(["transform","WebkitTransform"]);r.setTransform=function(t,e){t.style[u]=e},r.suppressClick=function(){window.addEventListener("click",i,!0),window.setTimeout(function(){window.removeEventListener("click",i,!0)},0)},r.mousePos=function(t,e){var r=t.getBoundingClientRect();return e=e.touches?e.touches[0]:e,new o(e.clientX-r.left-t.clientLeft,e.clientY-r.top-t.clientTop)},r.touchPos=function(t,e){for(var r=t.getBoundingClientRect(),n=[],i=0;i<e.touches.length;i++)n.push(new o(e.touches[i].clientX-r.left-t.clientLeft,e.touches[i].clientY-r.top-t.clientTop));return n}},{"point-geometry":404}],339:[function(t,e,r){"use strict";e.exports={API_URL:"https://api.mapbox.com",REQUIRE_ACCESS_TOKEN:!0}},{}],340:[function(t,e,r){"use strict";function n(t){this._stringToNumber={},this._numberToString=[];for(var e=0;e<t.length;e++){var r=t[e];this._stringToNumber[r]=e,this._numberToString[e]=r}}var i=t("assert");e.exports=n,n.prototype.encode=function(t){return i(t in this._stringToNumber),this._stringToNumber[t]},n.prototype.decode=function(t){return i(t<this._numberToString.length),this._numberToString[t]}},{assert:52}],341:[function(t,e,r){"use strict";var n=t("./util"),i={on:function(t,e){return this._events=this._events||{},this._events[t]=this._events[t]||[],this._events[t].push(e),this},off:function(t,e){if(!t)return delete this._events,this;if(!this.listens(t))return this;if(e){var r=this._events[t].indexOf(e);r>=0&&this._events[t].splice(r,1),this._events[t].length||delete this._events[t]}else delete this._events[t];return this},once:function(t,e){var r=function(n){this.off(t,r),e.call(this,n)}.bind(this);return this.on(t,r),this},fire:function(t,e){if(!this.listens(t))return this;e=n.extend({},e),n.extend(e,{type:t,target:this});for(var r=this._events[t].slice(),i=0;i<r.length;i++)r[i].call(this,e);return this},listens:function(t){return!(!this._events||!this._events[t])}};e.exports=i},{"./util":349}],342:[function(t,e,r){"use strict";function n(t,e){this.stacks=t.readFields(i,[],e)}function i(t,e,r){if(1===t){var n=r.readMessage(o,{glyphs:{}});e.push(n)}}function o(t,e,r){if(1===t)e.name=r.readString();else if(2===t)e.range=r.readString();else if(3===t){var n=r.readMessage(a,{});e.glyphs[n.id]=n}}function a(t,e,r){1===t?e.id=r.readVarint():2===t?e.bitmap=r.readBytes():3===t?e.width=r.readVarint():4===t?e.height=r.readVarint():5===t?e.left=r.readSVarint():6===t?e.top=r.readSVarint():7===t&&(e.advance=r.readVarint())}e.exports=n},{}],343:[function(t,e,r){"use strict";function n(t,e,r){return t*(1-r)+e*r}e.exports=n,n.number=n,n.vec2=function(t,e,r){return[n(t[0],e[0],r),n(t[1],e[1],r)]},n.color=function(t,e,r){return[n(t[0],e[0],r),n(t[1],e[1],r),n(t[2],e[2],r),n(t[3],e[3],r)]},n.array=function(t,e,r){return t.map(function(t,i){return n(t,e[i],r)})}},{}],344:[function(t,e,r){"use strict";function n(t,e,r){for(var n=0;n<t.length;n++)for(var i=t[n],o=0;o<e.length;o++)for(var a=e[o],s=0;s<a.length;s++){var l=a[s];if(d(i,l))return!0;if(c(l,i,r))return!0}return!1}function i(t,e){if(1===t.length&&1===t[0].length)return f(e,t[0][0]);for(var r=0;r<e.length;r++)for(var n=e[r],i=0;i<n.length;i++)if(f(t,n[i]))return!0;for(var o=0;o<t.length;o++){for(var a=t[o],l=0;l<a.length;l++)if(f(e,a[l]))return!0;for(var u=0;u<e.length;u++)if(s(a,e[u]))return!0}return!1}function o(t,e,r){for(var n=0;n<e.length;n++)for(var i=e[n],o=0;o<t.length;o++){var s=t[o];if(s.length>=3)for(var l=0;l<i.length;l++)if(d(s,i[l]))return!0;if(a(s,i,r))return!0}return!1}function a(t,e,r){if(t.length>1){if(s(t,e))return!0;for(var n=0;n<e.length;n++)if(c(e[n],t,r))return!0}for(var i=0;i<t.length;i++)if(c(t[i],e,r))return!0;return!1}function s(t,e){for(var r=0;r<t.length-1;r++)for(var n=t[r],i=t[r+1],o=0;o<e.length-1;o++){var a=e[o],s=e[o+1];if(u(n,i,a,s))return!0}return!1}function l(t,e,r){return(r.y-t.y)*(e.x-t.x)>(e.y-t.y)*(r.x-t.x)}function u(t,e,r,n){return l(t,r,n)!==l(e,r,n)&&l(t,e,r)!==l(t,e,n)}function c(t,e,r){var n=r*r;if(1===e.length)return t.distSqr(e[0])<n;for(var i=1;i<e.length;i++){var o=e[i-1],a=e[i];if(h(t,o,a)<n)return!0}return!1}function h(t,e,r){var n=e.distSqr(r);if(0===n)return t.distSqr(e);var i=((t.x-e.x)*(r.x-e.x)+(t.y-e.y)*(r.y-e.y))/n;return 0>i?t.distSqr(e):i>1?t.distSqr(r):t.distSqr(r.sub(e)._mult(i)._add(e))}function f(t,e){for(var r,n,i,o=!1,a=0;a<t.length;a++){r=t[a];for(var s=0,l=r.length-1;s<r.length;l=s++)n=r[s],i=r[l],n.y>e.y!=i.y>e.y&&e.x<(i.x-n.x)*(e.y-n.y)/(i.y-n.y)+n.x&&(o=!o)}return o}function d(t,e){for(var r=!1,n=0,i=t.length-1;n<t.length;i=n++){var o=t[n],a=t[i];o.y>e.y!=a.y>e.y&&e.x<(a.x-o.x)*(e.y-o.y)/(a.y-o.y)+o.x&&(r=!r)}return r}e.exports={multiPolygonIntersectsBufferedMultiPoint:n,multiPolygonIntersectsMultiPolygon:i,multiPolygonIntersectsBufferedMultiLine:o}},{}],345:[function(t,e,r){"use strict";function n(t,e){this.max=t,this.onRemove=e,this.reset()}e.exports=n,n.prototype.reset=function(){for(var t in this.data)this.onRemove(this.data[t]);return this.data={},this.order=[],this},n.prototype.add=function(t,e){if(this.has(t))this.order.splice(this.order.indexOf(t),1),this.data[t]=e,this.order.push(t);else if(this.data[t]=e,this.order.push(t),this.order.length>this.max){var r=this.get(this.order[0]);r&&this.onRemove(r)}return this},n.prototype.has=function(t){return t in this.data},n.prototype.keys=function(){return this.order},n.prototype.get=function(t){if(!this.has(t))return null;var e=this.data[t];return delete this.data[t],this.order.splice(this.order.indexOf(t),1),e},n.prototype.setMaxSize=function(t){for(this.max=t;this.order.length>this.max;){var e=this.get(this.order[0]);e&&this.onRemove(e)}return this}},{}],346:[function(t,e,r){"use strict";function n(t,e,r){if(r=r||i.ACCESS_TOKEN,!r&&i.REQUIRE_ACCESS_TOKEN)throw new Error("An API access token is required to use Mapbox GL. See https://www.mapbox.com/developers/api/#access-tokens");if(t=t.replace(/^mapbox:\/\//,i.API_URL+e),t+=-1!==t.indexOf("?")?"&access_token=":"?access_token=",i.REQUIRE_ACCESS_TOKEN){if("s"===r[0])throw new Error("Use a public access token (pk.*) with Mapbox GL JS, not a secret access token (sk.*). See https://www.mapbox.com/developers/api/#access-tokens");t+=r}return t}var i=t("./config"),o=t("./browser");e.exports.normalizeStyleURL=function(t,e){if(!t.match(/^mapbox:\/\/styles\//))return t;var r=t.split("/"),i=r[3],o=r[4],a=r[5]?"/draft":"";return n("mapbox://"+i+"/"+o+a,"/styles/v1/",e)},e.exports.normalizeSourceURL=function(t,e){return t.match(/^mapbox:\/\//)?n(t+".json","/v4/",e)+"&secure":t},e.exports.normalizeGlyphsURL=function(t,e){if(!t.match(/^mapbox:\/\//))return t;var r=t.split("/")[3];return n("mapbox://"+r+"/{fontstack}/{range}.pbf","/fonts/v1/",e)},e.exports.normalizeSpriteURL=function(t,e,r,i){if(!t.match(/^mapbox:\/\/sprites\//))return t+e+r;var o=t.split("/"),a=o[3],s=o[4],l=o[5]?"/draft":"";return n("mapbox://"+a+"/"+s+l+"/sprite"+e+r,"/styles/v1/",i)},e.exports.normalizeTileURL=function(t,e,r){if(!e||!e.match(/^mapbox:\/\//))return t;t=t.replace(/([?&]access_token=)tk\.[^&]+/,"$1"+i.ACCESS_TOKEN);var n=o.supportsWebp?"webp":"$1";return t.replace(/\.((?:png|jpg)\d*)(?=$|\?)/,o.devicePixelRatio>=2||512===r?"@2x."+n:"."+n)}},{"./browser":335,"./config":339}],347:[function(t,e,r){"use strict";function n(t){function e(){f.apply(this,arguments)}function r(){d.apply(this,arguments),this.members=e.prototype.members}var n=JSON.stringify(t);if(m[n])return m[n];void 0===t.alignment&&(t.alignment=1),e.prototype=Object.create(f.prototype);var s=0,u=0,g=["Uint8"];return e.prototype.members=t.members.map(function(r){r={name:r.name,type:r.type,components:r.components||1},p(r.name.length),p(r.type in v),g.indexOf(r.type)<0&&g.push(r.type);var n=a(r.type);u=Math.max(u,n),r.offset=s=o(s,Math.max(t.alignment,n));for(var i=0;i<r.components;i++)Object.defineProperty(e.prototype,r.name+(1===r.components?"":i),{get:c(r,i),set:h(r,i)});return s+=n*r.components,r}),e.prototype.alignment=t.alignment,e.prototype.size=o(s,Math.max(u,t.alignment)),r.serialize=i,r.prototype=Object.create(d.prototype),r.prototype.StructType=e,r.prototype.bytesPerElement=e.prototype.size,r.prototype.emplaceBack=l(e.prototype.members,e.prototype.size),r.prototype._usedTypes=g,m[n]=r,r}function i(){return{members:this.prototype.StructType.prototype.members,alignment:this.prototype.StructType.prototype.alignment,bytesPerElement:this.prototype.bytesPerElement}}function o(t,e){return Math.ceil(t/e)*e}function a(t){return v[t].BYTES_PER_ELEMENT}function s(t){return t.toLowerCase()}function l(t,e){for(var r=[],n=[],i="var i = this.length;\nthis.resize(this.length + 1);\n",o=0;o<t.length;o++){var l=t[o],u=a(l.type);r.indexOf(u)<0&&(r.push(u),i+="var o"+u.toFixed(0)+" = i * "+(e/u).toFixed(0)+";\n");for(var c=0;c<l.components;c++){var h="v"+n.length,f="o"+u.toFixed(0)+" + "+(l.offset/u+c).toFixed(0);i+="this."+s(l.type)+"["+f+"] = "+h+";\n",n.push(h)}}return i+="return i;",new Function(n,i)}function u(t,e){var r="this._pos"+a(t.type).toFixed(0),n=(t.offset/a(t.type)+e).toFixed(0),i=r+" + "+n;return"this._structArray."+s(t.type)+"["+i+"]"}function c(t,e){return new Function([],"return "+u(t,e)+";")}function h(t,e){return new Function(["x"],u(t,e)+" = x;")}function f(t,e){this._structArray=t,this._pos1=e*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}function d(t){void 0!==t?(this.arrayBuffer=t.arrayBuffer,this.length=t.length,this.capacity=this.arrayBuffer.byteLength/this.bytesPerElement,this._refreshViews()):(this.capacity=-1,this.resize(0))}var p=t("assert");e.exports=n;var v={Int8:Int8Array,Uint8:Uint8Array,Uint8Clamped:Uint8ClampedArray,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array,Float64:Float64Array},m={};d.prototype.DEFAULT_CAPACITY=128,d.prototype.RESIZE_MULTIPLIER=5,d.prototype.serialize=function(){return this.trim(),{length:this.length,arrayBuffer:this.arrayBuffer}},d.prototype.get=function(t){return new this.StructType(this,t)},d.prototype.trim=function(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())},d.prototype.resize=function(t){if(this.length=t,t>this.capacity){this.capacity=Math.max(t,Math.floor(this.capacity*this.RESIZE_MULTIPLIER),this.DEFAULT_CAPACITY),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);var e=this.uint8;this._refreshViews(),e&&this.uint8.set(e)}},d.prototype._refreshViews=function(){for(var t=0;t<this._usedTypes.length;t++){var e=this._usedTypes[t];this[s(e)]=new v[e](this.arrayBuffer)}}},{assert:52}],348:[function(t,e,r){"use strict";function n(t,e){return e.replace(/{([^{}()\[\]<>$=:;.,^]+)}/g,function(e,r){return r in t?t[r]:""})}e.exports=n},{}],349:[function(t,e,r){"use strict";var n=t("unitbezier"),i=t("../geo/coordinate");r.easeCubicInOut=function(t){if(0>=t)return 0;if(t>=1)return 1;var e=t*t,r=e*t;return 4*(.5>t?r:3*(t-e)+r-.75)},r.bezier=function(t,e,r,i){var o=new n(t,e,r,i);return function(t){return o.solve(t)}},r.ease=r.bezier(.25,.1,.25,1),r.premultiply=function(t){if(!t)return null;var e=t[3];return[t[0]*e,t[1]*e,t[2]*e,e]},r.clamp=function(t,e,r){return Math.min(r,Math.max(e,t))},r.wrap=function(t,e,r){var n=r-e,i=((t-e)%n+n)%n+e;return i===e?r:i},r.coalesce=function(){for(var t=0;t<arguments.length;t++){var e=arguments[t];if(null!==e&&void 0!==e)return e}},r.asyncAll=function(t,e,r){if(!t.length)return r(null,[]);var n=t.length,i=new Array(t.length),o=null;t.forEach(function(t,a){e(t,function(t,e){t&&(o=t),i[a]=e,0===--n&&r(o,i)})})},r.keysDifference=function(t,e){var r=[];for(var n in t)n in e||r.push(n);return r},r.extend=function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)t[n]=r[n]}return t},r.extendAll=function(t,e){for(var r in e)Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(e,r));return t},r.inherit=function(t,e){var n="function"==typeof t?t.prototype:t,i=Object.create(n);return r.extendAll(i,e),i},r.pick=function(t,e){for(var r={},n=0;n<e.length;n++){var i=e[n];i in t&&(r[i]=t[i])}return r};var o=1;r.uniqueId=function(){return o++},r.debounce=function(t,e){var r,n;return function(){n=arguments,clearTimeout(r),r=setTimeout(function(){t.apply(null,n)},e)}},r.bindAll=function(t,e){t.forEach(function(t){e[t]=e[t].bind(e)})},r.bindHandlers=function(t){for(var e in t)"function"==typeof t[e]&&0===e.indexOf("_on")&&(t[e]=t[e].bind(t))},r.setOptions=function(t,e){t.hasOwnProperty("options")||(t.options=t.options?Object.create(t.options):{});for(var r in e)t.options[r]=e[r];return t.options},r.getCoordinatesCenter=function(t){for(var e=1/0,r=1/0,n=-(1/0),o=-(1/0),a=0;a<t.length;a++)e=Math.min(e,t[a].column),r=Math.min(r,t[a].row),n=Math.max(n,t[a].column),o=Math.max(o,t[a].row);var s=n-e,l=o-r,u=Math.max(s,l);return new i((e+n)/2,(r+o)/2,0).zoomTo(Math.floor(-Math.log(u)/Math.LN2))},r.endsWith=function(t,e){return-1!==t.indexOf(e,t.length-e.length)},r.startsWith=function(t,e){return 0===t.indexOf(e)},r.mapObject=function(t,e,r){var n={};for(var i in t)n[i]=e.call(r||this,t[i],i,t);return n},r.filterObject=function(t,e,r){var n={};for(var i in t)e.call(r||this,t[i],i,t)&&(n[i]=t[i]);return n},r.deepEqual=function a(t,e){if(Array.isArray(t)){if(!Array.isArray(e)||t.length!==e.length)return!1;for(var r=0;r<t.length;r++)if(!a(t[r],e[r]))return!1;return!0}if("object"==typeof t){if("object"!=typeof e)return!1;var n=Object.keys(t);if(n.length!==Object.keys(e).length)return!1;for(var i in t)if(!a(t[i],e[i]))return!1;return!0}return t===e},r.clone=function(t){return Array.isArray(t)?t.map(r.clone):"object"==typeof t?r.mapObject(t,r.clone):t},r.arraysIntersect=function(t,e){for(var r=0;r<t.length;r++)if(e.indexOf(t[r])>=0)return!0;return!1}},{"../geo/coordinate":255,unitbezier:412}],350:[function(t,e,r){"use strict";function n(t,e,r,n){this._vectorTileFeature=t,t._z=e,t._x=r,t._y=n,this.properties=t.properties,t._id&&(this.id=t._id)}function i(t,e,r,n,i){for(var o=e*Math.pow(2,r),a=e*n,s=e*i,l=0;l<t.length;l++)for(var u=t[l],c=0;c<u.length;c++){var h=u[c],f=180-360*(h.y+s)/o;u[c]=[360*(h.x+a)/o-180,360/Math.PI*Math.atan(Math.exp(f*Math.PI/180))-90]}return t}var o=t("vector-tile").VectorTileFeature;e.exports=n,n.prototype={type:"Feature",get geometry(){if(void 0===this._geometry){var t=this._vectorTileFeature,e=i(t.loadGeometry(),t.extent,t._z,t._x,t._y),r=o.types[t.type];"Point"===r&&1===e.length?e=e[0][0]:"Point"===r?(e=e[0],r="MultiPoint"):"LineString"===r&&1===e.length?e=e[0]:"LineString"===r&&(r="MultiLineString"),this._geometry={type:r,coordinates:e},this._vectorTileFeature=null}return this._geometry},set geometry(t){this._geometry=t},toJSON:function(){var t={};for(var e in this)"_geometry"!==e&&"_vectorTileFeature"!==e&&(t[e]=this[e]);return t}}},{"vector-tile":413}],351:[function(t,e,r){function n(t){return t=Math.round(t),0>t?0:t>255?255:t}function i(t){return 0>t?0:t>1?1:t}function o(t){return n("%"===t[t.length-1]?parseFloat(t)/100*255:parseInt(t))}function a(t){return i("%"===t[t.length-1]?parseFloat(t)/100:parseFloat(t))}function s(t,e,r){return 0>r?r+=1:r>1&&(r-=1),1>6*r?t+(e-t)*r*6:1>2*r?e:2>3*r?t+(e-t)*(2/3-r)*6:t}function l(t){var e=t.replace(/ /g,"").toLowerCase();if(e in u)return u[e].slice();if("#"===e[0]){if(4===e.length){var r=parseInt(e.substr(1),16);return r>=0&&4095>=r?[(3840&r)>>4|(3840&r)>>8,240&r|(240&r)>>4,15&r|(15&r)<<4,1]:null}if(7===e.length){var r=parseInt(e.substr(1),16);return r>=0&&16777215>=r?[(16711680&r)>>16,(65280&r)>>8,255&r,1]:null}return null}var i=e.indexOf("("),l=e.indexOf(")");if(-1!==i&&l+1===e.length){var c=e.substr(0,i),h=e.substr(i+1,l-(i+1)).split(","),f=1;switch(c){case"rgba":if(4!==h.length)return null;f=a(h.pop());case"rgb":return 3!==h.length?null:[o(h[0]),o(h[1]),o(h[2]),f];case"hsla":if(4!==h.length)return null;f=a(h.pop());case"hsl":if(3!==h.length)return null;var d=(parseFloat(h[0])%360+360)%360/360,p=a(h[1]),v=a(h[2]),m=.5>=v?v*(p+1):v+p-v*p,g=2*v-m;return[n(255*s(g,m,d+1/3)),n(255*s(g,m,d)),n(255*s(g,m,d-1/3)),f];default:return null}}return null}var u={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],
dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};try{r.parseCSSColor=l}catch(c){}},{}],352:[function(t,e,r){"use strict";function n(t){return new Function("f","var p = (f && f.properties || {}); return "+i(t))}function i(t){if(!t)return"true";var e=t[0];if(t.length<=1)return"any"===e?"false":"true";var r="=="===e?a(t[1],t[2],"===",!1):"!="===e?a(t[1],t[2],"!==",!1):"<"===e||">"===e||"<="===e||">="===e?a(t[1],t[2],e,!0):"any"===e?s(t.slice(1),"||"):"all"===e?s(t.slice(1),"&&"):"none"===e?c(s(t.slice(1),"||")):"in"===e?l(t[1],t.slice(2)):"!in"===e?c(l(t[1],t.slice(2))):"has"===e?u(t[1]):"!has"===e?c(u([t[1]])):"true";return"("+r+")"}function o(t){return"$type"===t?"f.type":"p["+JSON.stringify(t)+"]"}function a(t,e,r,n){var i=o(t),a="$type"===t?f.indexOf(e):JSON.stringify(e);return(n?"typeof "+i+"=== typeof "+a+"&&":"")+i+r+a}function s(t,e){return t.map(i).join(e)}function l(t,e){"$type"===t&&(e=e.map(function(t){return f.indexOf(t)}));var r=JSON.stringify(e.sort(h)),n=o(t);return e.length<=200?r+".indexOf("+n+") !== -1":"function(v, a, i, j) {while (i <= j) { var m = (i + j) >> 1;    if (a[m] === v) return true; if (a[m] > v) j = m - 1; else i = m + 1;}return false; }("+n+", "+r+",0,"+(e.length-1)+")"}function u(t){return JSON.stringify(t)+" in p"}function c(t){return"!("+t+")"}function h(t,e){return e>t?-1:t>e?1:0}e.exports=n;var f=["Unknown","Point","LineString","Polygon"]},{}],353:[function(t,e,r){function n(t,e){switch(t&&t.type||null){case"FeatureCollection":return t.features=t.features.map(i(n,e)),t;case"Feature":return t.geometry=n(t.geometry,e),t;case"Polygon":case"MultiPolygon":return o(t,e);default:return t}}function i(t,e){return function(r){return t(r,e)}}function o(t,e){return"Polygon"===t.type?t.coordinates=a(t.coordinates,e):"MultiPolygon"===t.type&&(t.coordinates=t.coordinates.map(i(a,e))),t}function a(t,e){e=!!e,t[0]=s(t[0],!e);for(var r=1;r<t.length;r++)t[r]=s(t[r],e);return t}function s(t,e){return l(t)===e?t:t.reverse()}function l(t){return u.ring(t)>=0}var u=t("geojson-area");e.exports=n},{"geojson-area":354}],354:[function(t,e,r){function n(t){if("Polygon"===t.type)return i(t.coordinates);if("MultiPolygon"===t.type){for(var e=0,r=0;r<t.coordinates.length;r++)e+=i(t.coordinates[r]);return e}return null}function i(t){var e=0;if(t&&t.length>0){e+=Math.abs(o(t[0]));for(var r=1;r<t.length;r++)e-=Math.abs(o(t[r]))}return e}function o(t){var e=0;if(t.length>2){for(var r,n,i=0;i<t.length-1;i++)r=t[i],n=t[i+1],e+=a(n[0]-r[0])*(2+Math.sin(a(r[1]))+Math.sin(a(n[1])));e=e*s.RADIUS*s.RADIUS/2}return e}function a(t){return t*Math.PI/180}var s=t("wgs84");e.exports.geometry=n,e.exports.ring=o},{wgs84:355}],355:[function(t,e,r){e.exports.RADIUS=6378137,e.exports.FLATTENING=1/298.257223563,e.exports.POLAR_RADIUS=6356752.3142},{}],356:[function(t,e,r){"use strict";function n(t,e,r,n,a,s,l,u){if(r/=e,n/=e,l>=r&&n>=u)return t;if(l>n||r>u)return null;for(var c=[],h=0;h<t.length;h++){var f,d,p=t[h],v=p.geometry,m=p.type;if(f=p.min[a],d=p.max[a],f>=r&&n>=d)c.push(p);else if(!(f>n||r>d)){var g=1===m?i(v,r,n,a):o(v,r,n,a,s,3===m);g.length&&c.push({geometry:g,type:m,tags:t[h].tags||null,min:p.min,max:p.max})}}return c.length?c:null}function i(t,e,r,n){for(var i=[],o=0;o<t.length;o++){var a=t[o],s=a[n];s>=e&&r>=s&&i.push(a)}return i}function o(t,e,r,n,i,o){for(var s=[],l=0;l<t.length;l++){var u,c,h,f=0,d=0,p=null,v=t[l],m=v.area,g=v.dist,y=v.length,b=[];for(c=0;y-1>c;c++)u=p||v[c],p=v[c+1],f=d||u[n],d=p[n],e>f?d>r?(b.push(i(u,p,e),i(u,p,r)),o||(b=a(s,b,m,g))):d>=e&&b.push(i(u,p,e)):f>r?e>d?(b.push(i(u,p,r),i(u,p,e)),o||(b=a(s,b,m,g))):r>=d&&b.push(i(u,p,r)):(b.push(u),e>d?(b.push(i(u,p,e)),o||(b=a(s,b,m,g))):d>r&&(b.push(i(u,p,r)),o||(b=a(s,b,m,g))));u=v[y-1],f=u[n],f>=e&&r>=f&&b.push(u),h=b[b.length-1],o&&h&&(b[0][0]!==h[0]||b[0][1]!==h[1])&&b.push(b[0]),a(s,b,m,g)}return s}function a(t,e,r,n){return e.length&&(e.area=r,e.dist=n,t.push(e)),[]}e.exports=n},{}],357:[function(t,e,r){"use strict";function n(t,e){var r=[];if("FeatureCollection"===t.type)for(var n=0;n<t.features.length;n++)i(r,t.features[n],e);else"Feature"===t.type?i(r,t,e):i(r,{geometry:t},e);return r}function i(t,e,r){var n,l,u,c=e.geometry,h=c.type,f=c.coordinates,d=e.properties;if("Point"===h)t.push(o(d,1,[s(f)]));else if("MultiPoint"===h)t.push(o(d,1,a(f)));else if("LineString"===h)t.push(o(d,2,[a(f,r)]));else if("MultiLineString"===h||"Polygon"===h){for(u=[],n=0;n<f.length;n++)u.push(a(f[n],r));t.push(o(d,"Polygon"===h?3:2,u))}else if("MultiPolygon"===h){for(u=[],n=0;n<f.length;n++)for(l=0;l<f[n].length;l++)u.push(a(f[n][l],r));t.push(o(d,3,u))}else{if("GeometryCollection"!==h)throw new Error("Input data is not a valid GeoJSON object.");for(n=0;n<c.geometries.length;n++)i(t,{geometry:c.geometries[n],properties:d},r)}}function o(t,e,r){var n={geometry:r,type:e,tags:t||null,min:[2,1],max:[-1,0]};return u(n),n}function a(t,e){for(var r=[],n=0;n<t.length;n++)r.push(s(t[n]));return e&&(h(r,e),l(r)),r}function s(t){var e=Math.sin(t[1]*Math.PI/180),r=t[0]/360+.5,n=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return n=-1>n?-1:n>1?1:n,[r,n,0]}function l(t){for(var e,r,n=0,i=0,o=0;o<t.length-1;o++)e=r||t[o],r=t[o+1],n+=e[0]*r[1]-r[0]*e[1],i+=Math.abs(r[0]-e[0])+Math.abs(r[1]-e[1]);t.area=Math.abs(n/2),t.dist=i}function u(t){var e=t.geometry,r=t.min,n=t.max;if(1===t.type)c(r,n,e);else for(var i=0;i<e.length;i++)c(r,n,e[i]);return t}function c(t,e,r){for(var n,i=0;i<r.length;i++)n=r[i],t[0]=Math.min(n[0],t[0]),e[0]=Math.max(n[0],e[0]),t[1]=Math.min(n[1],t[1]),e[1]=Math.max(n[1],e[1])}e.exports=n;var h=t("./simplify")},{"./simplify":359}],358:[function(t,e,r){"use strict";function n(t,e){return new i(t,e)}function i(t,e){e=this.options=l(Object.create(this.options),e);var r=e.debug;r&&console.time("preprocess data");var n=1<<e.maxZoom,i=c(t,e.tolerance/(n*e.extent));this.tiles={},this.tileCoords=[],r&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",e.indexMaxZoom,e.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),i=d(i,e.buffer/e.extent,a),i.length&&this.splitTile(i,0,0,0),r&&(i.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}function o(t,e,r){return 32*((1<<t)*r+e)+t}function a(t,e,r){return[r,(r-t[0])*(e[1]-t[1])/(e[0]-t[0])+t[1],1]}function s(t,e,r){return[(r-t[1])*(e[0]-t[0])/(e[1]-t[1])+t[0],r,1]}function l(t,e){for(var r in e)t[r]=e[r];return t}function u(t,e,r){var n=t.source;if(1!==n.length)return!1;var i=n[0];if(3!==i.type||i.geometry.length>1)return!1;var o=i.geometry[0].length;if(5!==o)return!1;for(var a=0;o>a;a++){var s=h.point(i.geometry[0][a],e,t.z2,t.x,t.y);if(s[0]!==-r&&s[0]!==e+r||s[1]!==-r&&s[1]!==e+r)return!1}return!0}e.exports=n;var c=t("./convert"),h=t("./transform"),f=t("./clip"),d=t("./wrap"),p=t("./tile");i.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,solidChildren:!1,tolerance:3,extent:4096,buffer:64,debug:0},i.prototype.splitTile=function(t,e,r,n,i,l,c){for(var h=[t,e,r,n],d=this.options,v=d.debug,m=null;h.length;){n=h.pop(),r=h.pop(),e=h.pop(),t=h.pop();var g=1<<e,y=o(e,r,n),b=this.tiles[y],x=e===d.maxZoom?0:d.tolerance/(g*d.extent);if(!b&&(v>1&&console.time("creation"),b=this.tiles[y]=p(t,g,r,n,x,e===d.maxZoom),this.tileCoords.push({z:e,x:r,y:n}),v)){v>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",e,r,n,b.numFeatures,b.numPoints,b.numSimplified),console.timeEnd("creation"));var _="z"+e;this.stats[_]=(this.stats[_]||0)+1,this.total++}if(b.source=t,i){if(e===d.maxZoom||e===i)continue;var w=1<<i-e;if(r!==Math.floor(l/w)||n!==Math.floor(c/w))continue}else if(e===d.indexMaxZoom||b.numPoints<=d.indexMaxPoints)continue;if(d.solidChildren||!u(b,d.extent,d.buffer)){b.source=null,v>1&&console.time("clipping");var M,k,A,T,E,S,L=.5*d.buffer/d.extent,z=.5-L,I=.5+L,P=1+L;M=k=A=T=null,E=f(t,g,r-L,r+I,0,a,b.min[0],b.max[0]),S=f(t,g,r+z,r+P,0,a,b.min[0],b.max[0]),E&&(M=f(E,g,n-L,n+I,1,s,b.min[1],b.max[1]),k=f(E,g,n+z,n+P,1,s,b.min[1],b.max[1])),S&&(A=f(S,g,n-L,n+I,1,s,b.min[1],b.max[1]),T=f(S,g,n+z,n+P,1,s,b.min[1],b.max[1])),v>1&&console.timeEnd("clipping"),M&&h.push(M,e+1,2*r,2*n),k&&h.push(k,e+1,2*r,2*n+1),A&&h.push(A,e+1,2*r+1,2*n),T&&h.push(T,e+1,2*r+1,2*n+1)}else i&&(m=e)}return m},i.prototype.getTile=function(t,e,r){var n=this.options,i=n.extent,a=n.debug,s=1<<t;e=(e%s+s)%s;var l=o(t,e,r);if(this.tiles[l])return h.tile(this.tiles[l],i);a>1&&console.log("drilling down to z%d-%d-%d",t,e,r);for(var c,f=t,d=e,p=r;!c&&f>0;)f--,d=Math.floor(d/2),p=Math.floor(p/2),c=this.tiles[o(f,d,p)];if(!c||!c.source)return null;if(a>1&&console.log("found parent tile z%d-%d-%d",f,d,p),u(c,i,n.buffer))return h.tile(c,i);a>1&&console.time("drilling down");var v=this.splitTile(c.source,f,d,p,t,e,r);if(a>1&&console.timeEnd("drilling down"),null!==v){var m=1<<t-v;l=o(v,Math.floor(e/m),Math.floor(r/m))}return this.tiles[l]?h.tile(this.tiles[l],i):null}},{"./clip":356,"./convert":357,"./tile":360,"./transform":361,"./wrap":362}],359:[function(t,e,r){"use strict";function n(t,e){var r,n,o,a,s=e*e,l=t.length,u=0,c=l-1,h=[];for(t[u][2]=1,t[c][2]=1;c;){for(n=0,r=u+1;c>r;r++)o=i(t[r],t[u],t[c]),o>n&&(a=r,n=o);n>s?(t[a][2]=n,h.push(u),h.push(a),u=a):(c=h.pop(),u=h.pop())}}function i(t,e,r){var n=e[0],i=e[1],o=r[0],a=r[1],s=t[0],l=t[1],u=o-n,c=a-i;if(0!==u||0!==c){var h=((s-n)*u+(l-i)*c)/(u*u+c*c);h>1?(n=o,i=a):h>0&&(n+=u*h,i+=c*h)}return u=s-n,c=l-i,u*u+c*c}e.exports=n},{}],360:[function(t,e,r){"use strict";function n(t,e,r,n,o,a){for(var s={features:[],numPoints:0,numSimplified:0,numFeatures:0,source:null,x:r,y:n,z2:e,transformed:!1,min:[2,1],max:[-1,0]},l=0;l<t.length;l++){s.numFeatures++,i(s,t[l],o,a);var u=t[l].min,c=t[l].max;u[0]<s.min[0]&&(s.min[0]=u[0]),u[1]<s.min[1]&&(s.min[1]=u[1]),c[0]>s.max[0]&&(s.max[0]=c[0]),c[1]>s.max[1]&&(s.max[1]=c[1])}return s}function i(t,e,r,n){var i,o,a,s,l=e.geometry,u=e.type,c=[],h=r*r;if(1===u)for(i=0;i<l.length;i++)c.push(l[i]),t.numPoints++,t.numSimplified++;else for(i=0;i<l.length;i++)if(a=l[i],n||!(2===u&&a.dist<r||3===u&&a.area<h)){var f=[];for(o=0;o<a.length;o++)s=a[o],(n||s[2]>h)&&(f.push(s),t.numSimplified++),t.numPoints++;c.push(f)}else t.numPoints+=a.length;c.length&&t.features.push({geometry:c,type:u,tags:e.tags||null})}e.exports=n},{}],361:[function(t,e,r){"use strict";function n(t,e){if(t.transformed)return t;var r,n,o,a=t.z2,s=t.x,l=t.y;for(r=0;r<t.features.length;r++){var u=t.features[r],c=u.geometry,h=u.type;if(1===h)for(n=0;n<c.length;n++)c[n]=i(c[n],e,a,s,l);else for(n=0;n<c.length;n++){var f=c[n];for(o=0;o<f.length;o++)f[o]=i(f[o],e,a,s,l)}}return t.transformed=!0,t}function i(t,e,r,n,i){var o=Math.round(e*(t[0]*r-n)),a=Math.round(e*(t[1]*r-i));return[o,a]}r.tile=n,r.point=i},{}],362:[function(t,e,r){"use strict";function n(t,e,r){var n=t,o=a(t,1,-1-e,e,0,r,-1,2),s=a(t,1,1-e,2+e,0,r,-1,2);return(o||s)&&(n=a(t,1,-e,1+e,0,r,-1,2),o&&(n=i(o,1).concat(n)),s&&(n=n.concat(i(s,-1)))),n}function i(t,e){for(var r=[],n=0;n<t.length;n++){var i,a=t[n],s=a.type;if(1===s)i=o(a.geometry,e);else{i=[];for(var l=0;l<a.geometry.length;l++)i.push(o(a.geometry[l],e))}r.push({geometry:i,type:s,tags:a.tags,min:[a.min[0]+e,a.min[1]],max:[a.max[0]+e,a.max[1]]})}return r}function o(t,e){var r=[];r.area=t.area,r.dist=t.dist;for(var n=0;n<t.length;n++)r.push([t[n][0]+e,t[n][1],t[n][2]]);return r}var a=t("./clip");e.exports=n},{"./clip":356}],363:[function(t,e,r){r.glMatrix=t("./gl-matrix/common.js"),r.mat2=t("./gl-matrix/mat2.js"),r.mat2d=t("./gl-matrix/mat2d.js"),r.mat3=t("./gl-matrix/mat3.js"),r.mat4=t("./gl-matrix/mat4.js"),r.quat=t("./gl-matrix/quat.js"),r.vec2=t("./gl-matrix/vec2.js"),r.vec3=t("./gl-matrix/vec3.js"),r.vec4=t("./gl-matrix/vec4.js")},{"./gl-matrix/common.js":364,"./gl-matrix/mat2.js":365,"./gl-matrix/mat2d.js":366,"./gl-matrix/mat3.js":367,"./gl-matrix/mat4.js":368,"./gl-matrix/quat.js":369,"./gl-matrix/vec2.js":370,"./gl-matrix/vec3.js":371,"./gl-matrix/vec4.js":372}],364:[function(t,e,r){var n={};n.EPSILON=1e-6,n.ARRAY_TYPE="undefined"!=typeof Float32Array?Float32Array:Array,n.RANDOM=Math.random,n.ENABLE_SIMD=!1,n.SIMD_AVAILABLE=n.ARRAY_TYPE===Float32Array&&"SIMD"in this,n.USE_SIMD=n.ENABLE_SIMD&&n.SIMD_AVAILABLE,n.setMatrixArrayType=function(t){n.ARRAY_TYPE=t};var i=Math.PI/180;n.toRadian=function(t){return t*i},n.equals=function(t,e){return Math.abs(t-e)<=n.EPSILON*Math.max(1,Math.abs(t),Math.abs(e))},e.exports=n},{}],365:[function(t,e,r){var n=t("./common.js"),i={};i.create=function(){var t=new n.ARRAY_TYPE(4);return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t},i.clone=function(t){var e=new n.ARRAY_TYPE(4);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e},i.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t},i.identity=function(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t},i.fromValues=function(t,e,r,i){var o=new n.ARRAY_TYPE(4);return o[0]=t,o[1]=e,o[2]=r,o[3]=i,o},i.set=function(t,e,r,n,i){return t[0]=e,t[1]=r,t[2]=n,t[3]=i,t},i.transpose=function(t,e){if(t===e){var r=e[1];t[1]=e[2],t[2]=r}else t[0]=e[0],t[1]=e[2],t[2]=e[1],t[3]=e[3];return t},i.invert=function(t,e){var r=e[0],n=e[1],i=e[2],o=e[3],a=r*o-i*n;return a?(a=1/a,t[0]=o*a,t[1]=-n*a,t[2]=-i*a,t[3]=r*a,t):null},i.adjoint=function(t,e){var r=e[0];return t[0]=e[3],t[1]=-e[1],t[2]=-e[2],t[3]=r,t},i.determinant=function(t){return t[0]*t[3]-t[2]*t[1]},i.multiply=function(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3],s=r[0],l=r[1],u=r[2],c=r[3];return t[0]=n*s+o*l,t[1]=i*s+a*l,t[2]=n*u+o*c,t[3]=i*u+a*c,t},i.mul=i.multiply,i.rotate=function(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3],s=Math.sin(r),l=Math.cos(r);return t[0]=n*l+o*s,t[1]=i*l+a*s,t[2]=n*-s+o*l,t[3]=i*-s+a*l,t},i.scale=function(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3],s=r[0],l=r[1];return t[0]=n*s,t[1]=i*s,t[2]=o*l,t[3]=a*l,t},i.fromRotation=function(t,e){var r=Math.sin(e),n=Math.cos(e);return t[0]=n,t[1]=r,t[2]=-r,t[3]=n,t},i.fromScaling=function(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=e[1],t},i.str=function(t){return"mat2("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"},i.frob=function(t){return Math.sqrt(Math.pow(t[0],2)+Math.pow(t[1],2)+Math.pow(t[2],2)+Math.pow(t[3],2))},i.LDU=function(t,e,r,n){return t[2]=n[2]/n[0],r[0]=n[0],r[1]=n[1],r[3]=n[3]-t[2]*r[1],[t,e,r]},i.add=function(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t[3]=e[3]+r[3],t},i.subtract=function(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t[3]=e[3]-r[3],t},i.sub=i.subtract,i.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]},i.equals=function(t,e){var r=t[0],i=t[1],o=t[2],a=t[3],s=e[0],l=e[1],u=e[2],c=e[3];return Math.abs(r-s)<=n.EPSILON*Math.max(1,Math.abs(r),Math.abs(s))&&Math.abs(i-l)<=n.EPSILON*Math.max(1,Math.abs(i),Math.abs(l))&&Math.abs(o-u)<=n.EPSILON*Math.max(1,Math.abs(o),Math.abs(u))&&Math.abs(a-c)<=n.EPSILON*Math.max(1,Math.abs(a),Math.abs(c))},i.multiplyScalar=function(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t},i.multiplyScalarAndAdd=function(t,e,r,n){return t[0]=e[0]+r[0]*n,t[1]=e[1]+r[1]*n,t[2]=e[2]+r[2]*n,t[3]=e[3]+r[3]*n,t},e.exports=i},{"./common.js":364}],366:[function(t,e,r){var n=t("./common.js"),i={};i.create=function(){var t=new n.ARRAY_TYPE(6);return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=0,t[5]=0,t},i.clone=function(t){var e=new n.ARRAY_TYPE(6);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e},i.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t},i.identity=function(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=0,t[5]=0,t},i.fromValues=function(t,e,r,i,o,a){var s=new n.ARRAY_TYPE(6);return s[0]=t,s[1]=e,s[2]=r,s[3]=i,s[4]=o,s[5]=a,s},i.set=function(t,e,r,n,i,o,a){return t[0]=e,t[1]=r,t[2]=n,t[3]=i,t[4]=o,t[5]=a,t},i.invert=function(t,e){var r=e[0],n=e[1],i=e[2],o=e[3],a=e[4],s=e[5],l=r*o-n*i;return l?(l=1/l,t[0]=o*l,t[1]=-n*l,t[2]=-i*l,t[3]=r*l,t[4]=(i*s-o*a)*l,t[5]=(n*a-r*s)*l,t):null},i.determinant=function(t){return t[0]*t[3]-t[1]*t[2]},i.multiply=function(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3],s=e[4],l=e[5],u=r[0],c=r[1],h=r[2],f=r[3],d=r[4],p=r[5];return t[0]=n*u+o*c,t[1]=i*u+a*c,t[2]=n*h+o*f,t[3]=i*h+a*f,t[4]=n*d+o*p+s,t[5]=i*d+a*p+l,t},i.mul=i.multiply,i.rotate=function(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3],s=e[4],l=e[5],u=Math.sin(r),c=Math.cos(r);return t[0]=n*c+o*u,t[1]=i*c+a*u,t[2]=n*-u+o*c,t[3]=i*-u+a*c,t[4]=s,t[5]=l,t},i.scale=function(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3],s=e[4],l=e[5],u=r[0],c=r[1];return t[0]=n*u,t[1]=i*u,t[2]=o*c,t[3]=a*c,t[4]=s,t[5]=l,t},i.translate=function(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3],s=e[4],l=e[5],u=r[0],c=r[1];return t[0]=n,t[1]=i,t[2]=o,t[3]=a,t[4]=n*u+o*c+s,t[5]=i*u+a*c+l,t},i.fromRotation=function(t,e){var r=Math.sin(e),n=Math.cos(e);return t[0]=n,t[1]=r,t[2]=-r,t[3]=n,t[4]=0,t[5]=0,t},i.fromScaling=function(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=e[1],t[4]=0,t[5]=0,t},i.fromTranslation=function(t,e){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=e[0],t[5]=e[1],t},i.str=function(t){return"mat2d("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+")"},i.frob=function(t){return Math.sqrt(Math.pow(t[0],2)+Math.pow(t[1],2)+Math.pow(t[2],2)+Math.pow(t[3],2)+Math.pow(t[4],2)+Math.pow(t[5],2)+1)},i.add=function(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t[3]=e[3]+r[3],t[4]=e[4]+r[4],t[5]=e[5]+r[5],t},i.subtract=function(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t[3]=e[3]-r[3],t[4]=e[4]-r[4],t[5]=e[5]-r[5],t},i.sub=i.subtract,i.multiplyScalar=function(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t[4]=e[4]*r,t[5]=e[5]*r,t},i.multiplyScalarAndAdd=function(t,e,r,n){return t[0]=e[0]+r[0]*n,t[1]=e[1]+r[1]*n,t[2]=e[2]+r[2]*n,t[3]=e[3]+r[3]*n,t[4]=e[4]+r[4]*n,t[5]=e[5]+r[5]*n,t},i.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]},i.equals=function(t,e){var r=t[0],i=t[1],o=t[2],a=t[3],s=t[4],l=t[5],u=e[0],c=e[1],h=e[2],f=e[3],d=e[4],p=e[5];return Math.abs(r-u)<=n.EPSILON*Math.max(1,Math.abs(r),Math.abs(u))&&Math.abs(i-c)<=n.EPSILON*Math.max(1,Math.abs(i),Math.abs(c))&&Math.abs(o-h)<=n.EPSILON*Math.max(1,Math.abs(o),Math.abs(h))&&Math.abs(a-f)<=n.EPSILON*Math.max(1,Math.abs(a),Math.abs(f))&&Math.abs(s-d)<=n.EPSILON*Math.max(1,Math.abs(s),Math.abs(d))&&Math.abs(l-p)<=n.EPSILON*Math.max(1,Math.abs(l),Math.abs(p))},e.exports=i},{"./common.js":364}],367:[function(t,e,r){var n=t("./common.js"),i={};i.create=function(){var t=new n.ARRAY_TYPE(9);return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t},i.fromMat4=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[4],t[4]=e[5],t[5]=e[6],t[6]=e[8],t[7]=e[9],t[8]=e[10],t},i.clone=function(t){var e=new n.ARRAY_TYPE(9);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e},i.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t},i.fromValues=function(t,e,r,i,o,a,s,l,u){var c=new n.ARRAY_TYPE(9);return c[0]=t,c[1]=e,c[2]=r,c[3]=i,c[4]=o,c[5]=a,c[6]=s,c[7]=l,c[8]=u,c},i.set=function(t,e,r,n,i,o,a,s,l,u){return t[0]=e,t[1]=r,t[2]=n,t[3]=i,t[4]=o,t[5]=a,t[6]=s,t[7]=l,t[8]=u,t},i.identity=function(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t},i.transpose=function(t,e){if(t===e){var r=e[1],n=e[2],i=e[5];t[1]=e[3],t[2]=e[6],t[3]=r,t[5]=e[7],t[6]=n,t[7]=i}else t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8];return t},i.invert=function(t,e){var r=e[0],n=e[1],i=e[2],o=e[3],a=e[4],s=e[5],l=e[6],u=e[7],c=e[8],h=c*a-s*u,f=-c*o+s*l,d=u*o-a*l,p=r*h+n*f+i*d;return p?(p=1/p,t[0]=h*p,t[1]=(-c*n+i*u)*p,t[2]=(s*n-i*a)*p,t[3]=f*p,t[4]=(c*r-i*l)*p,t[5]=(-s*r+i*o)*p,t[6]=d*p,t[7]=(-u*r+n*l)*p,t[8]=(a*r-n*o)*p,t):null},i.adjoint=function(t,e){var r=e[0],n=e[1],i=e[2],o=e[3],a=e[4],s=e[5],l=e[6],u=e[7],c=e[8];return t[0]=a*c-s*u,t[1]=i*u-n*c,t[2]=n*s-i*a,t[3]=s*l-o*c,t[4]=r*c-i*l,t[5]=i*o-r*s,t[6]=o*u-a*l,t[7]=n*l-r*u,t[8]=r*a-n*o,t},i.determinant=function(t){var e=t[0],r=t[1],n=t[2],i=t[3],o=t[4],a=t[5],s=t[6],l=t[7],u=t[8];return e*(u*o-a*l)+r*(-u*i+a*s)+n*(l*i-o*s)},i.multiply=function(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3],s=e[4],l=e[5],u=e[6],c=e[7],h=e[8],f=r[0],d=r[1],p=r[2],v=r[3],m=r[4],g=r[5],y=r[6],b=r[7],x=r[8];return t[0]=f*n+d*a+p*u,t[1]=f*i+d*s+p*c,t[2]=f*o+d*l+p*h,t[3]=v*n+m*a+g*u,t[4]=v*i+m*s+g*c,t[5]=v*o+m*l+g*h,t[6]=y*n+b*a+x*u,t[7]=y*i+b*s+x*c,t[8]=y*o+b*l+x*h,t},i.mul=i.multiply,i.translate=function(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3],s=e[4],l=e[5],u=e[6],c=e[7],h=e[8],f=r[0],d=r[1];return t[0]=n,t[1]=i,t[2]=o,t[3]=a,t[4]=s,t[5]=l,t[6]=f*n+d*a+u,t[7]=f*i+d*s+c,t[8]=f*o+d*l+h,t},i.rotate=function(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3],s=e[4],l=e[5],u=e[6],c=e[7],h=e[8],f=Math.sin(r),d=Math.cos(r);return t[0]=d*n+f*a,t[1]=d*i+f*s,t[2]=d*o+f*l,t[3]=d*a-f*n,t[4]=d*s-f*i,t[5]=d*l-f*o,t[6]=u,t[7]=c,t[8]=h,t},i.scale=function(t,e,r){var n=r[0],i=r[1];return t[0]=n*e[0],t[1]=n*e[1],t[2]=n*e[2],t[3]=i*e[3],t[4]=i*e[4],t[5]=i*e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t},i.fromTranslation=function(t,e){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=e[0],t[7]=e[1],t[8]=1,t},i.fromRotation=function(t,e){var r=Math.sin(e),n=Math.cos(e);return t[0]=n,t[1]=r,t[2]=0,t[3]=-r,t[4]=n,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t},i.fromScaling=function(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=0,t[4]=e[1],t[5]=0,t[6]=0,t[7]=0,t[8]=1,t},i.fromMat2d=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=0,t[3]=e[2],t[4]=e[3],t[5]=0,t[6]=e[4],t[7]=e[5],t[8]=1,t},i.fromQuat=function(t,e){var r=e[0],n=e[1],i=e[2],o=e[3],a=r+r,s=n+n,l=i+i,u=r*a,c=n*a,h=n*s,f=i*a,d=i*s,p=i*l,v=o*a,m=o*s,g=o*l;return t[0]=1-h-p,t[3]=c-g,t[6]=f+m,t[1]=c+g,t[4]=1-u-p,t[7]=d-v,t[2]=f-m,t[5]=d+v,t[8]=1-u-h,t},i.normalFromMat4=function(t,e){var r=e[0],n=e[1],i=e[2],o=e[3],a=e[4],s=e[5],l=e[6],u=e[7],c=e[8],h=e[9],f=e[10],d=e[11],p=e[12],v=e[13],m=e[14],g=e[15],y=r*s-n*a,b=r*l-i*a,x=r*u-o*a,_=n*l-i*s,w=n*u-o*s,M=i*u-o*l,k=c*v-h*p,A=c*m-f*p,T=c*g-d*p,E=h*m-f*v,S=h*g-d*v,L=f*g-d*m,z=y*L-b*S+x*E+_*T-w*A+M*k;return z?(z=1/z,t[0]=(s*L-l*S+u*E)*z,t[1]=(l*T-a*L-u*A)*z,t[2]=(a*S-s*T+u*k)*z,t[3]=(i*S-n*L-o*E)*z,t[4]=(r*L-i*T+o*A)*z,t[5]=(n*T-r*S-o*k)*z,t[6]=(v*M-m*w+g*_)*z,t[7]=(m*x-p*M-g*b)*z,t[8]=(p*w-v*x+g*y)*z,t):null},i.str=function(t){return"mat3("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+", "+t[8]+")"},i.frob=function(t){return Math.sqrt(Math.pow(t[0],2)+Math.pow(t[1],2)+Math.pow(t[2],2)+Math.pow(t[3],2)+Math.pow(t[4],2)+Math.pow(t[5],2)+Math.pow(t[6],2)+Math.pow(t[7],2)+Math.pow(t[8],2))},i.add=function(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t[3]=e[3]+r[3],t[4]=e[4]+r[4],t[5]=e[5]+r[5],t[6]=e[6]+r[6],t[7]=e[7]+r[7],t[8]=e[8]+r[8],t},i.subtract=function(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t[3]=e[3]-r[3],t[4]=e[4]-r[4],t[5]=e[5]-r[5],t[6]=e[6]-r[6],t[7]=e[7]-r[7],t[8]=e[8]-r[8],t},i.sub=i.subtract,i.multiplyScalar=function(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t[4]=e[4]*r,t[5]=e[5]*r,t[6]=e[6]*r,t[7]=e[7]*r,t[8]=e[8]*r,t},i.multiplyScalarAndAdd=function(t,e,r,n){return t[0]=e[0]+r[0]*n,t[1]=e[1]+r[1]*n,t[2]=e[2]+r[2]*n,t[3]=e[3]+r[3]*n,t[4]=e[4]+r[4]*n,t[5]=e[5]+r[5]*n,t[6]=e[6]+r[6]*n,t[7]=e[7]+r[7]*n,t[8]=e[8]+r[8]*n,t},i.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[7]===e[7]&&t[8]===e[8]},i.equals=function(t,e){var r=t[0],i=t[1],o=t[2],a=t[3],s=t[4],l=t[5],u=t[6],c=t[7],h=t[8],f=e[0],d=e[1],p=e[2],v=e[3],m=e[4],g=e[5],y=t[6],b=e[7],x=e[8];return Math.abs(r-f)<=n.EPSILON*Math.max(1,Math.abs(r),Math.abs(f))&&Math.abs(i-d)<=n.EPSILON*Math.max(1,Math.abs(i),Math.abs(d))&&Math.abs(o-p)<=n.EPSILON*Math.max(1,Math.abs(o),Math.abs(p))&&Math.abs(a-v)<=n.EPSILON*Math.max(1,Math.abs(a),Math.abs(v))&&Math.abs(s-m)<=n.EPSILON*Math.max(1,Math.abs(s),Math.abs(m))&&Math.abs(l-g)<=n.EPSILON*Math.max(1,Math.abs(l),Math.abs(g))&&Math.abs(u-y)<=n.EPSILON*Math.max(1,Math.abs(u),Math.abs(y))&&Math.abs(c-b)<=n.EPSILON*Math.max(1,Math.abs(c),Math.abs(b))&&Math.abs(h-x)<=n.EPSILON*Math.max(1,Math.abs(h),Math.abs(x))},e.exports=i},{"./common.js":364}],368:[function(t,e,r){var n=t("./common.js"),i={scalar:{},SIMD:{}};i.create=function(){var t=new n.ARRAY_TYPE(16);return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},i.clone=function(t){var e=new n.ARRAY_TYPE(16);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e},i.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t},i.fromValues=function(t,e,r,i,o,a,s,l,u,c,h,f,d,p,v,m){var g=new n.ARRAY_TYPE(16);return g[0]=t,g[1]=e,g[2]=r,g[3]=i,g[4]=o,g[5]=a,g[6]=s,g[7]=l,g[8]=u,g[9]=c,g[10]=h,g[11]=f,g[12]=d,g[13]=p,g[14]=v,g[15]=m,g},i.set=function(t,e,r,n,i,o,a,s,l,u,c,h,f,d,p,v,m){return t[0]=e,t[1]=r,t[2]=n,t[3]=i,t[4]=o,t[5]=a,t[6]=s,t[7]=l,t[8]=u,t[9]=c,t[10]=h,t[11]=f,t[12]=d,t[13]=p,t[14]=v,t[15]=m,t},i.identity=function(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},i.scalar.transpose=function(t,e){if(t===e){var r=e[1],n=e[2],i=e[3],o=e[6],a=e[7],s=e[11];t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=r,t[6]=e[9],t[7]=e[13],t[8]=n,t[9]=o,t[11]=e[14],t[12]=i,t[13]=a,t[14]=s}else t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=e[1],t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=e[14],t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15];return t},i.SIMD.transpose=function(t,e){var r,n,i,o,a,s,l,u,c,h;return r=SIMD.Float32x4.load(e,0),n=SIMD.Float32x4.load(e,4),i=SIMD.Float32x4.load(e,8),o=SIMD.Float32x4.load(e,12),a=SIMD.Float32x4.shuffle(r,n,0,1,4,5),s=SIMD.Float32x4.shuffle(i,o,0,1,4,5),l=SIMD.Float32x4.shuffle(a,s,0,2,4,6),u=SIMD.Float32x4.shuffle(a,s,1,3,5,7),SIMD.Float32x4.store(t,0,l),SIMD.Float32x4.store(t,4,u),a=SIMD.Float32x4.shuffle(r,n,2,3,6,7),s=SIMD.Float32x4.shuffle(i,o,2,3,6,7),c=SIMD.Float32x4.shuffle(a,s,0,2,4,6),h=SIMD.Float32x4.shuffle(a,s,1,3,5,7),SIMD.Float32x4.store(t,8,c),SIMD.Float32x4.store(t,12,h),t},i.transpose=n.USE_SIMD?i.SIMD.transpose:i.scalar.transpose,i.scalar.invert=function(t,e){var r=e[0],n=e[1],i=e[2],o=e[3],a=e[4],s=e[5],l=e[6],u=e[7],c=e[8],h=e[9],f=e[10],d=e[11],p=e[12],v=e[13],m=e[14],g=e[15],y=r*s-n*a,b=r*l-i*a,x=r*u-o*a,_=n*l-i*s,w=n*u-o*s,M=i*u-o*l,k=c*v-h*p,A=c*m-f*p,T=c*g-d*p,E=h*m-f*v,S=h*g-d*v,L=f*g-d*m,z=y*L-b*S+x*E+_*T-w*A+M*k;return z?(z=1/z,t[0]=(s*L-l*S+u*E)*z,t[1]=(i*S-n*L-o*E)*z,t[2]=(v*M-m*w+g*_)*z,t[3]=(f*w-h*M-d*_)*z,t[4]=(l*T-a*L-u*A)*z,t[5]=(r*L-i*T+o*A)*z,t[6]=(m*x-p*M-g*b)*z,t[7]=(c*M-f*x+d*b)*z,t[8]=(a*S-s*T+u*k)*z,t[9]=(n*T-r*S-o*k)*z,t[10]=(p*w-v*x+g*y)*z,t[11]=(h*x-c*w-d*y)*z,t[12]=(s*A-a*E-l*k)*z,t[13]=(r*E-n*A+i*k)*z,t[14]=(v*b-p*_-m*y)*z,t[15]=(c*_-h*b+f*y)*z,t):null},i.SIMD.invert=function(t,e){var r,n,i,o,a,s,l,u,c,h,f=SIMD.Float32x4.load(e,0),d=SIMD.Float32x4.load(e,4),p=SIMD.Float32x4.load(e,8),v=SIMD.Float32x4.load(e,12);return a=SIMD.Float32x4.shuffle(f,d,0,1,4,5),n=SIMD.Float32x4.shuffle(p,v,0,1,4,5),r=SIMD.Float32x4.shuffle(a,n,0,2,4,6),n=SIMD.Float32x4.shuffle(n,a,1,3,5,7),a=SIMD.Float32x4.shuffle(f,d,2,3,6,7),o=SIMD.Float32x4.shuffle(p,v,2,3,6,7),i=SIMD.Float32x4.shuffle(a,o,0,2,4,6),o=SIMD.Float32x4.shuffle(o,a,1,3,5,7),a=SIMD.Float32x4.mul(i,o),a=SIMD.Float32x4.swizzle(a,1,0,3,2),s=SIMD.Float32x4.mul(n,a),l=SIMD.Float32x4.mul(r,a),a=SIMD.Float32x4.swizzle(a,2,3,0,1),s=SIMD.Float32x4.sub(SIMD.Float32x4.mul(n,a),s),l=SIMD.Float32x4.sub(SIMD.Float32x4.mul(r,a),l),l=SIMD.Float32x4.swizzle(l,2,3,0,1),a=SIMD.Float32x4.mul(n,i),a=SIMD.Float32x4.swizzle(a,1,0,3,2),s=SIMD.Float32x4.add(SIMD.Float32x4.mul(o,a),s),c=SIMD.Float32x4.mul(r,a),a=SIMD.Float32x4.swizzle(a,2,3,0,1),s=SIMD.Float32x4.sub(s,SIMD.Float32x4.mul(o,a)),c=SIMD.Float32x4.sub(SIMD.Float32x4.mul(r,a),c),c=SIMD.Float32x4.swizzle(c,2,3,0,1),a=SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(n,2,3,0,1),o),a=SIMD.Float32x4.swizzle(a,1,0,3,2),i=SIMD.Float32x4.swizzle(i,2,3,0,1),s=SIMD.Float32x4.add(SIMD.Float32x4.mul(i,a),s),u=SIMD.Float32x4.mul(r,a),a=SIMD.Float32x4.swizzle(a,2,3,0,1),s=SIMD.Float32x4.sub(s,SIMD.Float32x4.mul(i,a)),u=SIMD.Float32x4.sub(SIMD.Float32x4.mul(r,a),u),u=SIMD.Float32x4.swizzle(u,2,3,0,1),a=SIMD.Float32x4.mul(r,n),a=SIMD.Float32x4.swizzle(a,1,0,3,2),u=SIMD.Float32x4.add(SIMD.Float32x4.mul(o,a),u),c=SIMD.Float32x4.sub(SIMD.Float32x4.mul(i,a),c),a=SIMD.Float32x4.swizzle(a,2,3,0,1),u=SIMD.Float32x4.sub(SIMD.Float32x4.mul(o,a),u),c=SIMD.Float32x4.sub(c,SIMD.Float32x4.mul(i,a)),a=SIMD.Float32x4.mul(r,o),a=SIMD.Float32x4.swizzle(a,1,0,3,2),l=SIMD.Float32x4.sub(l,SIMD.Float32x4.mul(i,a)),u=SIMD.Float32x4.add(SIMD.Float32x4.mul(n,a),u),a=SIMD.Float32x4.swizzle(a,2,3,0,1),l=SIMD.Float32x4.add(SIMD.Float32x4.mul(i,a),l),u=SIMD.Float32x4.sub(u,SIMD.Float32x4.mul(n,a)),a=SIMD.Float32x4.mul(r,i),a=SIMD.Float32x4.swizzle(a,1,0,3,2),l=SIMD.Float32x4.add(SIMD.Float32x4.mul(o,a),l),c=SIMD.Float32x4.sub(c,SIMD.Float32x4.mul(n,a)),a=SIMD.Float32x4.swizzle(a,2,3,0,1),l=SIMD.Float32x4.sub(l,SIMD.Float32x4.mul(o,a)),c=SIMD.Float32x4.add(SIMD.Float32x4.mul(n,a),c),
h=SIMD.Float32x4.mul(r,s),h=SIMD.Float32x4.add(SIMD.Float32x4.swizzle(h,2,3,0,1),h),h=SIMD.Float32x4.add(SIMD.Float32x4.swizzle(h,1,0,3,2),h),a=SIMD.Float32x4.reciprocalApproximation(h),h=SIMD.Float32x4.sub(SIMD.Float32x4.add(a,a),SIMD.Float32x4.mul(h,SIMD.Float32x4.mul(a,a))),(h=SIMD.Float32x4.swizzle(h,0,0,0,0))?(SIMD.Float32x4.store(t,0,SIMD.Float32x4.mul(h,s)),SIMD.Float32x4.store(t,4,SIMD.Float32x4.mul(h,l)),SIMD.Float32x4.store(t,8,SIMD.Float32x4.mul(h,u)),SIMD.Float32x4.store(t,12,SIMD.Float32x4.mul(h,c)),t):null},i.invert=n.USE_SIMD?i.SIMD.invert:i.scalar.invert,i.scalar.adjoint=function(t,e){var r=e[0],n=e[1],i=e[2],o=e[3],a=e[4],s=e[5],l=e[6],u=e[7],c=e[8],h=e[9],f=e[10],d=e[11],p=e[12],v=e[13],m=e[14],g=e[15];return t[0]=s*(f*g-d*m)-h*(l*g-u*m)+v*(l*d-u*f),t[1]=-(n*(f*g-d*m)-h*(i*g-o*m)+v*(i*d-o*f)),t[2]=n*(l*g-u*m)-s*(i*g-o*m)+v*(i*u-o*l),t[3]=-(n*(l*d-u*f)-s*(i*d-o*f)+h*(i*u-o*l)),t[4]=-(a*(f*g-d*m)-c*(l*g-u*m)+p*(l*d-u*f)),t[5]=r*(f*g-d*m)-c*(i*g-o*m)+p*(i*d-o*f),t[6]=-(r*(l*g-u*m)-a*(i*g-o*m)+p*(i*u-o*l)),t[7]=r*(l*d-u*f)-a*(i*d-o*f)+c*(i*u-o*l),t[8]=a*(h*g-d*v)-c*(s*g-u*v)+p*(s*d-u*h),t[9]=-(r*(h*g-d*v)-c*(n*g-o*v)+p*(n*d-o*h)),t[10]=r*(s*g-u*v)-a*(n*g-o*v)+p*(n*u-o*s),t[11]=-(r*(s*d-u*h)-a*(n*d-o*h)+c*(n*u-o*s)),t[12]=-(a*(h*m-f*v)-c*(s*m-l*v)+p*(s*f-l*h)),t[13]=r*(h*m-f*v)-c*(n*m-i*v)+p*(n*f-i*h),t[14]=-(r*(s*m-l*v)-a*(n*m-i*v)+p*(n*l-i*s)),t[15]=r*(s*f-l*h)-a*(n*f-i*h)+c*(n*l-i*s),t},i.SIMD.adjoint=function(t,e){var r,n,i,o,a,s,l,u,c,h,f,d,p,r=SIMD.Float32x4.load(e,0),n=SIMD.Float32x4.load(e,4),i=SIMD.Float32x4.load(e,8),o=SIMD.Float32x4.load(e,12);return c=SIMD.Float32x4.shuffle(r,n,0,1,4,5),s=SIMD.Float32x4.shuffle(i,o,0,1,4,5),a=SIMD.Float32x4.shuffle(c,s,0,2,4,6),s=SIMD.Float32x4.shuffle(s,c,1,3,5,7),c=SIMD.Float32x4.shuffle(r,n,2,3,6,7),u=SIMD.Float32x4.shuffle(i,o,2,3,6,7),l=SIMD.Float32x4.shuffle(c,u,0,2,4,6),u=SIMD.Float32x4.shuffle(u,c,1,3,5,7),c=SIMD.Float32x4.mul(l,u),c=SIMD.Float32x4.swizzle(c,1,0,3,2),h=SIMD.Float32x4.mul(s,c),f=SIMD.Float32x4.mul(a,c),c=SIMD.Float32x4.swizzle(c,2,3,0,1),h=SIMD.Float32x4.sub(SIMD.Float32x4.mul(s,c),h),f=SIMD.Float32x4.sub(SIMD.Float32x4.mul(a,c),f),f=SIMD.Float32x4.swizzle(f,2,3,0,1),c=SIMD.Float32x4.mul(s,l),c=SIMD.Float32x4.swizzle(c,1,0,3,2),h=SIMD.Float32x4.add(SIMD.Float32x4.mul(u,c),h),p=SIMD.Float32x4.mul(a,c),c=SIMD.Float32x4.swizzle(c,2,3,0,1),h=SIMD.Float32x4.sub(h,SIMD.Float32x4.mul(u,c)),p=SIMD.Float32x4.sub(SIMD.Float32x4.mul(a,c),p),p=SIMD.Float32x4.swizzle(p,2,3,0,1),c=SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(s,2,3,0,1),u),c=SIMD.Float32x4.swizzle(c,1,0,3,2),l=SIMD.Float32x4.swizzle(l,2,3,0,1),h=SIMD.Float32x4.add(SIMD.Float32x4.mul(l,c),h),d=SIMD.Float32x4.mul(a,c),c=SIMD.Float32x4.swizzle(c,2,3,0,1),h=SIMD.Float32x4.sub(h,SIMD.Float32x4.mul(l,c)),d=SIMD.Float32x4.sub(SIMD.Float32x4.mul(a,c),d),d=SIMD.Float32x4.swizzle(d,2,3,0,1),c=SIMD.Float32x4.mul(a,s),c=SIMD.Float32x4.swizzle(c,1,0,3,2),d=SIMD.Float32x4.add(SIMD.Float32x4.mul(u,c),d),p=SIMD.Float32x4.sub(SIMD.Float32x4.mul(l,c),p),c=SIMD.Float32x4.swizzle(c,2,3,0,1),d=SIMD.Float32x4.sub(SIMD.Float32x4.mul(u,c),d),p=SIMD.Float32x4.sub(p,SIMD.Float32x4.mul(l,c)),c=SIMD.Float32x4.mul(a,u),c=SIMD.Float32x4.swizzle(c,1,0,3,2),f=SIMD.Float32x4.sub(f,SIMD.Float32x4.mul(l,c)),d=SIMD.Float32x4.add(SIMD.Float32x4.mul(s,c),d),c=SIMD.Float32x4.swizzle(c,2,3,0,1),f=SIMD.Float32x4.add(SIMD.Float32x4.mul(l,c),f),d=SIMD.Float32x4.sub(d,SIMD.Float32x4.mul(s,c)),c=SIMD.Float32x4.mul(a,l),c=SIMD.Float32x4.swizzle(c,1,0,3,2),f=SIMD.Float32x4.add(SIMD.Float32x4.mul(u,c),f),p=SIMD.Float32x4.sub(p,SIMD.Float32x4.mul(s,c)),c=SIMD.Float32x4.swizzle(c,2,3,0,1),f=SIMD.Float32x4.sub(f,SIMD.Float32x4.mul(u,c)),p=SIMD.Float32x4.add(SIMD.Float32x4.mul(s,c),p),SIMD.Float32x4.store(t,0,h),SIMD.Float32x4.store(t,4,f),SIMD.Float32x4.store(t,8,d),SIMD.Float32x4.store(t,12,p),t},i.adjoint=n.USE_SIMD?i.SIMD.adjoint:i.scalar.adjoint,i.determinant=function(t){var e=t[0],r=t[1],n=t[2],i=t[3],o=t[4],a=t[5],s=t[6],l=t[7],u=t[8],c=t[9],h=t[10],f=t[11],d=t[12],p=t[13],v=t[14],m=t[15],g=e*a-r*o,y=e*s-n*o,b=e*l-i*o,x=r*s-n*a,_=r*l-i*a,w=n*l-i*s,M=u*p-c*d,k=u*v-h*d,A=u*m-f*d,T=c*v-h*p,E=c*m-f*p,S=h*m-f*v;return g*S-y*E+b*T+x*A-_*k+w*M},i.SIMD.multiply=function(t,e,r){var n=SIMD.Float32x4.load(e,0),i=SIMD.Float32x4.load(e,4),o=SIMD.Float32x4.load(e,8),a=SIMD.Float32x4.load(e,12),s=SIMD.Float32x4.load(r,0),l=SIMD.Float32x4.add(SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(s,0,0,0,0),n),SIMD.Float32x4.add(SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(s,1,1,1,1),i),SIMD.Float32x4.add(SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(s,2,2,2,2),o),SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(s,3,3,3,3),a))));SIMD.Float32x4.store(t,0,l);var u=SIMD.Float32x4.load(r,4),c=SIMD.Float32x4.add(SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(u,0,0,0,0),n),SIMD.Float32x4.add(SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(u,1,1,1,1),i),SIMD.Float32x4.add(SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(u,2,2,2,2),o),SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(u,3,3,3,3),a))));SIMD.Float32x4.store(t,4,c);var h=SIMD.Float32x4.load(r,8),f=SIMD.Float32x4.add(SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(h,0,0,0,0),n),SIMD.Float32x4.add(SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(h,1,1,1,1),i),SIMD.Float32x4.add(SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(h,2,2,2,2),o),SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(h,3,3,3,3),a))));SIMD.Float32x4.store(t,8,f);var d=SIMD.Float32x4.load(r,12),p=SIMD.Float32x4.add(SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(d,0,0,0,0),n),SIMD.Float32x4.add(SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(d,1,1,1,1),i),SIMD.Float32x4.add(SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(d,2,2,2,2),o),SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(d,3,3,3,3),a))));return SIMD.Float32x4.store(t,12,p),t},i.scalar.multiply=function(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3],s=e[4],l=e[5],u=e[6],c=e[7],h=e[8],f=e[9],d=e[10],p=e[11],v=e[12],m=e[13],g=e[14],y=e[15],b=r[0],x=r[1],_=r[2],w=r[3];return t[0]=b*n+x*s+_*h+w*v,t[1]=b*i+x*l+_*f+w*m,t[2]=b*o+x*u+_*d+w*g,t[3]=b*a+x*c+_*p+w*y,b=r[4],x=r[5],_=r[6],w=r[7],t[4]=b*n+x*s+_*h+w*v,t[5]=b*i+x*l+_*f+w*m,t[6]=b*o+x*u+_*d+w*g,t[7]=b*a+x*c+_*p+w*y,b=r[8],x=r[9],_=r[10],w=r[11],t[8]=b*n+x*s+_*h+w*v,t[9]=b*i+x*l+_*f+w*m,t[10]=b*o+x*u+_*d+w*g,t[11]=b*a+x*c+_*p+w*y,b=r[12],x=r[13],_=r[14],w=r[15],t[12]=b*n+x*s+_*h+w*v,t[13]=b*i+x*l+_*f+w*m,t[14]=b*o+x*u+_*d+w*g,t[15]=b*a+x*c+_*p+w*y,t},i.multiply=n.USE_SIMD?i.SIMD.multiply:i.scalar.multiply,i.mul=i.multiply,i.scalar.translate=function(t,e,r){var n,i,o,a,s,l,u,c,h,f,d,p,v=r[0],m=r[1],g=r[2];return e===t?(t[12]=e[0]*v+e[4]*m+e[8]*g+e[12],t[13]=e[1]*v+e[5]*m+e[9]*g+e[13],t[14]=e[2]*v+e[6]*m+e[10]*g+e[14],t[15]=e[3]*v+e[7]*m+e[11]*g+e[15]):(n=e[0],i=e[1],o=e[2],a=e[3],s=e[4],l=e[5],u=e[6],c=e[7],h=e[8],f=e[9],d=e[10],p=e[11],t[0]=n,t[1]=i,t[2]=o,t[3]=a,t[4]=s,t[5]=l,t[6]=u,t[7]=c,t[8]=h,t[9]=f,t[10]=d,t[11]=p,t[12]=n*v+s*m+h*g+e[12],t[13]=i*v+l*m+f*g+e[13],t[14]=o*v+u*m+d*g+e[14],t[15]=a*v+c*m+p*g+e[15]),t},i.SIMD.translate=function(t,e,r){var n=SIMD.Float32x4.load(e,0),i=SIMD.Float32x4.load(e,4),o=SIMD.Float32x4.load(e,8),a=SIMD.Float32x4.load(e,12),s=SIMD.Float32x4(r[0],r[1],r[2],0);e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11]),n=SIMD.Float32x4.mul(n,SIMD.Float32x4.swizzle(s,0,0,0,0)),i=SIMD.Float32x4.mul(i,SIMD.Float32x4.swizzle(s,1,1,1,1)),o=SIMD.Float32x4.mul(o,SIMD.Float32x4.swizzle(s,2,2,2,2));var l=SIMD.Float32x4.add(n,SIMD.Float32x4.add(i,SIMD.Float32x4.add(o,a)));return SIMD.Float32x4.store(t,12,l),t},i.translate=n.USE_SIMD?i.SIMD.translate:i.scalar.translate,i.scalar.scale=function(t,e,r){var n=r[0],i=r[1],o=r[2];return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*i,t[5]=e[5]*i,t[6]=e[6]*i,t[7]=e[7]*i,t[8]=e[8]*o,t[9]=e[9]*o,t[10]=e[10]*o,t[11]=e[11]*o,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t},i.SIMD.scale=function(t,e,r){var n,i,o,a=SIMD.Float32x4(r[0],r[1],r[2],0);return n=SIMD.Float32x4.load(e,0),SIMD.Float32x4.store(t,0,SIMD.Float32x4.mul(n,SIMD.Float32x4.swizzle(a,0,0,0,0))),i=SIMD.Float32x4.load(e,4),SIMD.Float32x4.store(t,4,SIMD.Float32x4.mul(i,SIMD.Float32x4.swizzle(a,1,1,1,1))),o=SIMD.Float32x4.load(e,8),SIMD.Float32x4.store(t,8,SIMD.Float32x4.mul(o,SIMD.Float32x4.swizzle(a,2,2,2,2))),t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t},i.scale=n.USE_SIMD?i.SIMD.scale:i.scalar.scale,i.rotate=function(t,e,r,i){var o,a,s,l,u,c,h,f,d,p,v,m,g,y,b,x,_,w,M,k,A,T,E,S,L=i[0],z=i[1],I=i[2],P=Math.sqrt(L*L+z*z+I*I);return Math.abs(P)<n.EPSILON?null:(P=1/P,L*=P,z*=P,I*=P,o=Math.sin(r),a=Math.cos(r),s=1-a,l=e[0],u=e[1],c=e[2],h=e[3],f=e[4],d=e[5],p=e[6],v=e[7],m=e[8],g=e[9],y=e[10],b=e[11],x=L*L*s+a,_=z*L*s+I*o,w=I*L*s-z*o,M=L*z*s-I*o,k=z*z*s+a,A=I*z*s+L*o,T=L*I*s+z*o,E=z*I*s-L*o,S=I*I*s+a,t[0]=l*x+f*_+m*w,t[1]=u*x+d*_+g*w,t[2]=c*x+p*_+y*w,t[3]=h*x+v*_+b*w,t[4]=l*M+f*k+m*A,t[5]=u*M+d*k+g*A,t[6]=c*M+p*k+y*A,t[7]=h*M+v*k+b*A,t[8]=l*T+f*E+m*S,t[9]=u*T+d*E+g*S,t[10]=c*T+p*E+y*S,t[11]=h*T+v*E+b*S,e!==t&&(t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t)},i.scalar.rotateX=function(t,e,r){var n=Math.sin(r),i=Math.cos(r),o=e[4],a=e[5],s=e[6],l=e[7],u=e[8],c=e[9],h=e[10],f=e[11];return e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=o*i+u*n,t[5]=a*i+c*n,t[6]=s*i+h*n,t[7]=l*i+f*n,t[8]=u*i-o*n,t[9]=c*i-a*n,t[10]=h*i-s*n,t[11]=f*i-l*n,t},i.SIMD.rotateX=function(t,e,r){var n=SIMD.Float32x4.splat(Math.sin(r)),i=SIMD.Float32x4.splat(Math.cos(r));e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]);var o=SIMD.Float32x4.load(e,4),a=SIMD.Float32x4.load(e,8);return SIMD.Float32x4.store(t,4,SIMD.Float32x4.add(SIMD.Float32x4.mul(o,i),SIMD.Float32x4.mul(a,n))),SIMD.Float32x4.store(t,8,SIMD.Float32x4.sub(SIMD.Float32x4.mul(a,i),SIMD.Float32x4.mul(o,n))),t},i.rotateX=n.USE_SIMD?i.SIMD.rotateX:i.scalar.rotateX,i.scalar.rotateY=function(t,e,r){var n=Math.sin(r),i=Math.cos(r),o=e[0],a=e[1],s=e[2],l=e[3],u=e[8],c=e[9],h=e[10],f=e[11];return e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=o*i-u*n,t[1]=a*i-c*n,t[2]=s*i-h*n,t[3]=l*i-f*n,t[8]=o*n+u*i,t[9]=a*n+c*i,t[10]=s*n+h*i,t[11]=l*n+f*i,t},i.SIMD.rotateY=function(t,e,r){var n=SIMD.Float32x4.splat(Math.sin(r)),i=SIMD.Float32x4.splat(Math.cos(r));e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]);var o=SIMD.Float32x4.load(e,0),a=SIMD.Float32x4.load(e,8);return SIMD.Float32x4.store(t,0,SIMD.Float32x4.sub(SIMD.Float32x4.mul(o,i),SIMD.Float32x4.mul(a,n))),SIMD.Float32x4.store(t,8,SIMD.Float32x4.add(SIMD.Float32x4.mul(o,n),SIMD.Float32x4.mul(a,i))),t},i.rotateY=n.USE_SIMD?i.SIMD.rotateY:i.scalar.rotateY,i.scalar.rotateZ=function(t,e,r){var n=Math.sin(r),i=Math.cos(r),o=e[0],a=e[1],s=e[2],l=e[3],u=e[4],c=e[5],h=e[6],f=e[7];return e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=o*i+u*n,t[1]=a*i+c*n,t[2]=s*i+h*n,t[3]=l*i+f*n,t[4]=u*i-o*n,t[5]=c*i-a*n,t[6]=h*i-s*n,t[7]=f*i-l*n,t},i.SIMD.rotateZ=function(t,e,r){var n=SIMD.Float32x4.splat(Math.sin(r)),i=SIMD.Float32x4.splat(Math.cos(r));e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]);var o=SIMD.Float32x4.load(e,0),a=SIMD.Float32x4.load(e,4);return SIMD.Float32x4.store(t,0,SIMD.Float32x4.add(SIMD.Float32x4.mul(o,i),SIMD.Float32x4.mul(a,n))),SIMD.Float32x4.store(t,4,SIMD.Float32x4.sub(SIMD.Float32x4.mul(a,i),SIMD.Float32x4.mul(o,n))),t},i.rotateZ=n.USE_SIMD?i.SIMD.rotateZ:i.scalar.rotateZ,i.fromTranslation=function(t,e){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=e[0],t[13]=e[1],t[14]=e[2],t[15]=1,t},i.fromScaling=function(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e[1],t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=e[2],t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},i.fromRotation=function(t,e,r){var i,o,a,s=r[0],l=r[1],u=r[2],c=Math.sqrt(s*s+l*l+u*u);return Math.abs(c)<n.EPSILON?null:(c=1/c,s*=c,l*=c,u*=c,i=Math.sin(e),o=Math.cos(e),a=1-o,t[0]=s*s*a+o,t[1]=l*s*a+u*i,t[2]=u*s*a-l*i,t[3]=0,t[4]=s*l*a-u*i,t[5]=l*l*a+o,t[6]=u*l*a+s*i,t[7]=0,t[8]=s*u*a+l*i,t[9]=l*u*a-s*i,t[10]=u*u*a+o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t)},i.fromXRotation=function(t,e){var r=Math.sin(e),n=Math.cos(e);return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=n,t[6]=r,t[7]=0,t[8]=0,t[9]=-r,t[10]=n,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},i.fromYRotation=function(t,e){var r=Math.sin(e),n=Math.cos(e);return t[0]=n,t[1]=0,t[2]=-r,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=r,t[9]=0,t[10]=n,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},i.fromZRotation=function(t,e){var r=Math.sin(e),n=Math.cos(e);return t[0]=n,t[1]=r,t[2]=0,t[3]=0,t[4]=-r,t[5]=n,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},i.fromRotationTranslation=function(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3],s=n+n,l=i+i,u=o+o,c=n*s,h=n*l,f=n*u,d=i*l,p=i*u,v=o*u,m=a*s,g=a*l,y=a*u;return t[0]=1-(d+v),t[1]=h+y,t[2]=f-g,t[3]=0,t[4]=h-y,t[5]=1-(c+v),t[6]=p+m,t[7]=0,t[8]=f+g,t[9]=p-m,t[10]=1-(c+d),t[11]=0,t[12]=r[0],t[13]=r[1],t[14]=r[2],t[15]=1,t},i.getTranslation=function(t,e){return t[0]=e[12],t[1]=e[13],t[2]=e[14],t},i.getRotation=function(t,e){var r=e[0]+e[5]+e[10],n=0;return r>0?(n=2*Math.sqrt(r+1),t[3]=.25*n,t[0]=(e[6]-e[9])/n,t[1]=(e[8]-e[2])/n,t[2]=(e[1]-e[4])/n):e[0]>e[5]&e[0]>e[10]?(n=2*Math.sqrt(1+e[0]-e[5]-e[10]),t[3]=(e[6]-e[9])/n,t[0]=.25*n,t[1]=(e[1]+e[4])/n,t[2]=(e[8]+e[2])/n):e[5]>e[10]?(n=2*Math.sqrt(1+e[5]-e[0]-e[10]),t[3]=(e[8]-e[2])/n,t[0]=(e[1]+e[4])/n,t[1]=.25*n,t[2]=(e[6]+e[9])/n):(n=2*Math.sqrt(1+e[10]-e[0]-e[5]),t[3]=(e[1]-e[4])/n,t[0]=(e[8]+e[2])/n,t[1]=(e[6]+e[9])/n,t[2]=.25*n),t},i.fromRotationTranslationScale=function(t,e,r,n){var i=e[0],o=e[1],a=e[2],s=e[3],l=i+i,u=o+o,c=a+a,h=i*l,f=i*u,d=i*c,p=o*u,v=o*c,m=a*c,g=s*l,y=s*u,b=s*c,x=n[0],_=n[1],w=n[2];return t[0]=(1-(p+m))*x,t[1]=(f+b)*x,t[2]=(d-y)*x,t[3]=0,t[4]=(f-b)*_,t[5]=(1-(h+m))*_,t[6]=(v+g)*_,t[7]=0,t[8]=(d+y)*w,t[9]=(v-g)*w,t[10]=(1-(h+p))*w,t[11]=0,t[12]=r[0],t[13]=r[1],t[14]=r[2],t[15]=1,t},i.fromRotationTranslationScaleOrigin=function(t,e,r,n,i){var o=e[0],a=e[1],s=e[2],l=e[3],u=o+o,c=a+a,h=s+s,f=o*u,d=o*c,p=o*h,v=a*c,m=a*h,g=s*h,y=l*u,b=l*c,x=l*h,_=n[0],w=n[1],M=n[2],k=i[0],A=i[1],T=i[2];return t[0]=(1-(v+g))*_,t[1]=(d+x)*_,t[2]=(p-b)*_,t[3]=0,t[4]=(d-x)*w,t[5]=(1-(f+g))*w,t[6]=(m+y)*w,t[7]=0,t[8]=(p+b)*M,t[9]=(m-y)*M,t[10]=(1-(f+v))*M,t[11]=0,t[12]=r[0]+k-(t[0]*k+t[4]*A+t[8]*T),t[13]=r[1]+A-(t[1]*k+t[5]*A+t[9]*T),t[14]=r[2]+T-(t[2]*k+t[6]*A+t[10]*T),t[15]=1,t},i.fromQuat=function(t,e){var r=e[0],n=e[1],i=e[2],o=e[3],a=r+r,s=n+n,l=i+i,u=r*a,c=n*a,h=n*s,f=i*a,d=i*s,p=i*l,v=o*a,m=o*s,g=o*l;return t[0]=1-h-p,t[1]=c+g,t[2]=f-m,t[3]=0,t[4]=c-g,t[5]=1-u-p,t[6]=d+v,t[7]=0,t[8]=f+m,t[9]=d-v,t[10]=1-u-h,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},i.frustum=function(t,e,r,n,i,o,a){var s=1/(r-e),l=1/(i-n),u=1/(o-a);return t[0]=2*o*s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=2*o*l,t[6]=0,t[7]=0,t[8]=(r+e)*s,t[9]=(i+n)*l,t[10]=(a+o)*u,t[11]=-1,t[12]=0,t[13]=0,t[14]=a*o*2*u,t[15]=0,t},i.perspective=function(t,e,r,n,i){var o=1/Math.tan(e/2),a=1/(n-i);return t[0]=o/r,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=o,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=(i+n)*a,t[11]=-1,t[12]=0,t[13]=0,t[14]=2*i*n*a,t[15]=0,t},i.perspectiveFromFieldOfView=function(t,e,r,n){var i=Math.tan(e.upDegrees*Math.PI/180),o=Math.tan(e.downDegrees*Math.PI/180),a=Math.tan(e.leftDegrees*Math.PI/180),s=Math.tan(e.rightDegrees*Math.PI/180),l=2/(a+s),u=2/(i+o);return t[0]=l,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=u,t[6]=0,t[7]=0,t[8]=-((a-s)*l*.5),t[9]=(i-o)*u*.5,t[10]=n/(r-n),t[11]=-1,t[12]=0,t[13]=0,t[14]=n*r/(r-n),t[15]=0,t},i.ortho=function(t,e,r,n,i,o,a){var s=1/(e-r),l=1/(n-i),u=1/(o-a);return t[0]=-2*s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*l,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*u,t[11]=0,t[12]=(e+r)*s,t[13]=(i+n)*l,t[14]=(a+o)*u,t[15]=1,t},i.lookAt=function(t,e,r,o){var a,s,l,u,c,h,f,d,p,v,m=e[0],g=e[1],y=e[2],b=o[0],x=o[1],_=o[2],w=r[0],M=r[1],k=r[2];return Math.abs(m-w)<n.EPSILON&&Math.abs(g-M)<n.EPSILON&&Math.abs(y-k)<n.EPSILON?i.identity(t):(f=m-w,d=g-M,p=y-k,v=1/Math.sqrt(f*f+d*d+p*p),f*=v,d*=v,p*=v,a=x*p-_*d,s=_*f-b*p,l=b*d-x*f,v=Math.sqrt(a*a+s*s+l*l),v?(v=1/v,a*=v,s*=v,l*=v):(a=0,s=0,l=0),u=d*l-p*s,c=p*a-f*l,h=f*s-d*a,v=Math.sqrt(u*u+c*c+h*h),v?(v=1/v,u*=v,c*=v,h*=v):(u=0,c=0,h=0),t[0]=a,t[1]=u,t[2]=f,t[3]=0,t[4]=s,t[5]=c,t[6]=d,t[7]=0,t[8]=l,t[9]=h,t[10]=p,t[11]=0,t[12]=-(a*m+s*g+l*y),t[13]=-(u*m+c*g+h*y),t[14]=-(f*m+d*g+p*y),t[15]=1,t)},i.str=function(t){return"mat4("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+", "+t[8]+", "+t[9]+", "+t[10]+", "+t[11]+", "+t[12]+", "+t[13]+", "+t[14]+", "+t[15]+")"},i.frob=function(t){return Math.sqrt(Math.pow(t[0],2)+Math.pow(t[1],2)+Math.pow(t[2],2)+Math.pow(t[3],2)+Math.pow(t[4],2)+Math.pow(t[5],2)+Math.pow(t[6],2)+Math.pow(t[7],2)+Math.pow(t[8],2)+Math.pow(t[9],2)+Math.pow(t[10],2)+Math.pow(t[11],2)+Math.pow(t[12],2)+Math.pow(t[13],2)+Math.pow(t[14],2)+Math.pow(t[15],2))},i.add=function(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t[3]=e[3]+r[3],t[4]=e[4]+r[4],t[5]=e[5]+r[5],t[6]=e[6]+r[6],t[7]=e[7]+r[7],t[8]=e[8]+r[8],t[9]=e[9]+r[9],t[10]=e[10]+r[10],t[11]=e[11]+r[11],t[12]=e[12]+r[12],t[13]=e[13]+r[13],t[14]=e[14]+r[14],t[15]=e[15]+r[15],t},i.subtract=function(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t[3]=e[3]-r[3],t[4]=e[4]-r[4],t[5]=e[5]-r[5],t[6]=e[6]-r[6],t[7]=e[7]-r[7],t[8]=e[8]-r[8],t[9]=e[9]-r[9],t[10]=e[10]-r[10],t[11]=e[11]-r[11],t[12]=e[12]-r[12],t[13]=e[13]-r[13],t[14]=e[14]-r[14],t[15]=e[15]-r[15],t},i.sub=i.subtract,i.multiplyScalar=function(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t[4]=e[4]*r,t[5]=e[5]*r,t[6]=e[6]*r,t[7]=e[7]*r,t[8]=e[8]*r,t[9]=e[9]*r,t[10]=e[10]*r,t[11]=e[11]*r,t[12]=e[12]*r,t[13]=e[13]*r,t[14]=e[14]*r,t[15]=e[15]*r,t},i.multiplyScalarAndAdd=function(t,e,r,n){return t[0]=e[0]+r[0]*n,t[1]=e[1]+r[1]*n,t[2]=e[2]+r[2]*n,t[3]=e[3]+r[3]*n,t[4]=e[4]+r[4]*n,t[5]=e[5]+r[5]*n,t[6]=e[6]+r[6]*n,t[7]=e[7]+r[7]*n,t[8]=e[8]+r[8]*n,t[9]=e[9]+r[9]*n,t[10]=e[10]+r[10]*n,t[11]=e[11]+r[11]*n,t[12]=e[12]+r[12]*n,t[13]=e[13]+r[13]*n,t[14]=e[14]+r[14]*n,t[15]=e[15]+r[15]*n,t},i.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[7]===e[7]&&t[8]===e[8]&&t[9]===e[9]&&t[10]===e[10]&&t[11]===e[11]&&t[12]===e[12]&&t[13]===e[13]&&t[14]===e[14]&&t[15]===e[15]},i.equals=function(t,e){var r=t[0],i=t[1],o=t[2],a=t[3],s=t[4],l=t[5],u=t[6],c=t[7],h=t[8],f=t[9],d=t[10],p=t[11],v=t[12],m=t[13],g=t[14],y=t[15],b=e[0],x=e[1],_=e[2],w=e[3],M=e[4],k=e[5],A=e[6],T=e[7],E=e[8],S=e[9],L=e[10],z=e[11],I=e[12],P=e[13],C=e[14],R=e[15];return Math.abs(r-b)<=n.EPSILON*Math.max(1,Math.abs(r),Math.abs(b))&&Math.abs(i-x)<=n.EPSILON*Math.max(1,Math.abs(i),Math.abs(x))&&Math.abs(o-_)<=n.EPSILON*Math.max(1,Math.abs(o),Math.abs(_))&&Math.abs(a-w)<=n.EPSILON*Math.max(1,Math.abs(a),Math.abs(w))&&Math.abs(s-M)<=n.EPSILON*Math.max(1,Math.abs(s),Math.abs(M))&&Math.abs(l-k)<=n.EPSILON*Math.max(1,Math.abs(l),Math.abs(k))&&Math.abs(u-A)<=n.EPSILON*Math.max(1,Math.abs(u),Math.abs(A))&&Math.abs(c-T)<=n.EPSILON*Math.max(1,Math.abs(c),Math.abs(T))&&Math.abs(h-E)<=n.EPSILON*Math.max(1,Math.abs(h),Math.abs(E))&&Math.abs(f-S)<=n.EPSILON*Math.max(1,Math.abs(f),Math.abs(S))&&Math.abs(d-L)<=n.EPSILON*Math.max(1,Math.abs(d),Math.abs(L))&&Math.abs(p-z)<=n.EPSILON*Math.max(1,Math.abs(p),Math.abs(z))&&Math.abs(v-I)<=n.EPSILON*Math.max(1,Math.abs(v),Math.abs(I))&&Math.abs(m-P)<=n.EPSILON*Math.max(1,Math.abs(m),Math.abs(P))&&Math.abs(g-C)<=n.EPSILON*Math.max(1,Math.abs(g),Math.abs(C))&&Math.abs(y-R)<=n.EPSILON*Math.max(1,Math.abs(y),Math.abs(R))},e.exports=i},{"./common.js":364}],369:[function(t,e,r){var n=t("./common.js"),i=t("./mat3.js"),o=t("./vec3.js"),a=t("./vec4.js"),s={};s.create=function(){var t=new n.ARRAY_TYPE(4);return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t},s.rotationTo=function(){var t=o.create(),e=o.fromValues(1,0,0),r=o.fromValues(0,1,0);return function(n,i,a){var l=o.dot(i,a);return-.999999>l?(o.cross(t,e,i),o.length(t)<1e-6&&o.cross(t,r,i),o.normalize(t,t),s.setAxisAngle(n,t,Math.PI),n):l>.999999?(n[0]=0,n[1]=0,n[2]=0,n[3]=1,n):(o.cross(t,i,a),n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=1+l,s.normalize(n,n))}}(),s.setAxes=function(){var t=i.create();return function(e,r,n,i){return t[0]=n[0],t[3]=n[1],t[6]=n[2],t[1]=i[0],t[4]=i[1],t[7]=i[2],t[2]=-r[0],t[5]=-r[1],t[8]=-r[2],s.normalize(e,s.fromMat3(e,t))}}(),s.clone=a.clone,s.fromValues=a.fromValues,s.copy=a.copy,s.set=a.set,s.identity=function(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t},s.setAxisAngle=function(t,e,r){r=.5*r;var n=Math.sin(r);return t[0]=n*e[0],t[1]=n*e[1],t[2]=n*e[2],t[3]=Math.cos(r),t},s.getAxisAngle=function(t,e){var r=2*Math.acos(e[3]),n=Math.sin(r/2);return 0!=n?(t[0]=e[0]/n,t[1]=e[1]/n,t[2]=e[2]/n):(t[0]=1,t[1]=0,t[2]=0),r},s.add=a.add,s.multiply=function(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3],s=r[0],l=r[1],u=r[2],c=r[3];return t[0]=n*c+a*s+i*u-o*l,t[1]=i*c+a*l+o*s-n*u,t[2]=o*c+a*u+n*l-i*s,t[3]=a*c-n*s-i*l-o*u,t},s.mul=s.multiply,s.scale=a.scale,s.rotateX=function(t,e,r){r*=.5;var n=e[0],i=e[1],o=e[2],a=e[3],s=Math.sin(r),l=Math.cos(r);return t[0]=n*l+a*s,t[1]=i*l+o*s,t[2]=o*l-i*s,t[3]=a*l-n*s,t},s.rotateY=function(t,e,r){r*=.5;var n=e[0],i=e[1],o=e[2],a=e[3],s=Math.sin(r),l=Math.cos(r);return t[0]=n*l-o*s,t[1]=i*l+a*s,t[2]=o*l+n*s,t[3]=a*l-i*s,t},s.rotateZ=function(t,e,r){r*=.5;var n=e[0],i=e[1],o=e[2],a=e[3],s=Math.sin(r),l=Math.cos(r);return t[0]=n*l+i*s,t[1]=i*l-n*s,t[2]=o*l+a*s,t[3]=a*l-o*s,t},s.calculateW=function(t,e){var r=e[0],n=e[1],i=e[2];return t[0]=r,t[1]=n,t[2]=i,t[3]=Math.sqrt(Math.abs(1-r*r-n*n-i*i)),t},s.dot=a.dot,s.lerp=a.lerp,s.slerp=function(t,e,r,n){var i,o,a,s,l,u=e[0],c=e[1],h=e[2],f=e[3],d=r[0],p=r[1],v=r[2],m=r[3];return o=u*d+c*p+h*v+f*m,0>o&&(o=-o,d=-d,p=-p,v=-v,m=-m),1-o>1e-6?(i=Math.acos(o),a=Math.sin(i),s=Math.sin((1-n)*i)/a,l=Math.sin(n*i)/a):(s=1-n,l=n),t[0]=s*u+l*d,t[1]=s*c+l*p,t[2]=s*h+l*v,t[3]=s*f+l*m,t},s.sqlerp=function(){var t=s.create(),e=s.create();return function(r,n,i,o,a,l){return s.slerp(t,n,a,l),s.slerp(e,i,o,l),s.slerp(r,t,e,2*l*(1-l)),r}}(),s.invert=function(t,e){var r=e[0],n=e[1],i=e[2],o=e[3],a=r*r+n*n+i*i+o*o,s=a?1/a:0;return t[0]=-r*s,t[1]=-n*s,t[2]=-i*s,t[3]=o*s,t},s.conjugate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=e[3],t},s.length=a.length,s.len=s.length,s.squaredLength=a.squaredLength,s.sqrLen=s.squaredLength,s.normalize=a.normalize,s.fromMat3=function(t,e){var r,n=e[0]+e[4]+e[8];if(n>0)r=Math.sqrt(n+1),t[3]=.5*r,r=.5/r,t[0]=(e[5]-e[7])*r,t[1]=(e[6]-e[2])*r,t[2]=(e[1]-e[3])*r;else{var i=0;e[4]>e[0]&&(i=1),e[8]>e[3*i+i]&&(i=2);var o=(i+1)%3,a=(i+2)%3;r=Math.sqrt(e[3*i+i]-e[3*o+o]-e[3*a+a]+1),t[i]=.5*r,r=.5/r,t[3]=(e[3*o+a]-e[3*a+o])*r,t[o]=(e[3*o+i]+e[3*i+o])*r,t[a]=(e[3*a+i]+e[3*i+a])*r}return t},s.str=function(t){return"quat("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"},s.exactEquals=a.exactEquals,s.equals=a.equals,e.exports=s},{"./common.js":364,"./mat3.js":367,"./vec3.js":371,"./vec4.js":372}],370:[function(t,e,r){var n=t("./common.js"),i={};i.create=function(){var t=new n.ARRAY_TYPE(2);return t[0]=0,t[1]=0,t},i.clone=function(t){var e=new n.ARRAY_TYPE(2);return e[0]=t[0],e[1]=t[1],e},i.fromValues=function(t,e){var r=new n.ARRAY_TYPE(2);return r[0]=t,r[1]=e,r},i.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t},i.set=function(t,e,r){return t[0]=e,t[1]=r,t},i.add=function(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t},i.subtract=function(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t},i.sub=i.subtract,i.multiply=function(t,e,r){return t[0]=e[0]*r[0],t[1]=e[1]*r[1],t},i.mul=i.multiply,i.divide=function(t,e,r){return t[0]=e[0]/r[0],t[1]=e[1]/r[1],t},i.div=i.divide,i.ceil=function(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t},i.floor=function(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t},i.min=function(t,e,r){return t[0]=Math.min(e[0],r[0]),t[1]=Math.min(e[1],r[1]),t},i.max=function(t,e,r){return t[0]=Math.max(e[0],r[0]),t[1]=Math.max(e[1],r[1]),t},i.round=function(t,e){return t[0]=Math.round(e[0]),t[1]=Math.round(e[1]),t},i.scale=function(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t},i.scaleAndAdd=function(t,e,r,n){return t[0]=e[0]+r[0]*n,t[1]=e[1]+r[1]*n,t},i.distance=function(t,e){var r=e[0]-t[0],n=e[1]-t[1];return Math.sqrt(r*r+n*n)},i.dist=i.distance,i.squaredDistance=function(t,e){var r=e[0]-t[0],n=e[1]-t[1];return r*r+n*n},i.sqrDist=i.squaredDistance,i.length=function(t){var e=t[0],r=t[1];return Math.sqrt(e*e+r*r)},i.len=i.length,i.squaredLength=function(t){var e=t[0],r=t[1];return e*e+r*r},i.sqrLen=i.squaredLength,i.negate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t},i.inverse=function(t,e){return t[0]=1/e[0],t[1]=1/e[1],t},i.normalize=function(t,e){var r=e[0],n=e[1],i=r*r+n*n;return i>0&&(i=1/Math.sqrt(i),t[0]=e[0]*i,t[1]=e[1]*i),t},i.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]},i.cross=function(t,e,r){var n=e[0]*r[1]-e[1]*r[0];return t[0]=t[1]=0,t[2]=n,t},i.lerp=function(t,e,r,n){var i=e[0],o=e[1];return t[0]=i+n*(r[0]-i),t[1]=o+n*(r[1]-o),t},i.random=function(t,e){e=e||1;var r=2*n.RANDOM()*Math.PI;return t[0]=Math.cos(r)*e,t[1]=Math.sin(r)*e,t},i.transformMat2=function(t,e,r){var n=e[0],i=e[1];return t[0]=r[0]*n+r[2]*i,t[1]=r[1]*n+r[3]*i,t},i.transformMat2d=function(t,e,r){var n=e[0],i=e[1];return t[0]=r[0]*n+r[2]*i+r[4],t[1]=r[1]*n+r[3]*i+r[5],t},i.transformMat3=function(t,e,r){var n=e[0],i=e[1];return t[0]=r[0]*n+r[3]*i+r[6],t[1]=r[1]*n+r[4]*i+r[7],t},i.transformMat4=function(t,e,r){var n=e[0],i=e[1];return t[0]=r[0]*n+r[4]*i+r[12],t[1]=r[1]*n+r[5]*i+r[13],t},i.forEach=function(){var t=i.create();return function(e,r,n,i,o,a){var s,l;for(r||(r=2),n||(n=0),l=i?Math.min(i*r+n,e.length):e.length,s=n;l>s;s+=r)t[0]=e[s],t[1]=e[s+1],o(t,t,a),e[s]=t[0],e[s+1]=t[1];return e}}(),i.str=function(t){return"vec2("+t[0]+", "+t[1]+")"},i.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]},i.equals=function(t,e){var r=t[0],i=t[1],o=e[0],a=e[1];return Math.abs(r-o)<=n.EPSILON*Math.max(1,Math.abs(r),Math.abs(o))&&Math.abs(i-a)<=n.EPSILON*Math.max(1,Math.abs(i),Math.abs(a))},e.exports=i},{"./common.js":364}],371:[function(t,e,r){var n=t("./common.js"),i={};i.create=function(){var t=new n.ARRAY_TYPE(3);return t[0]=0,t[1]=0,t[2]=0,t},i.clone=function(t){var e=new n.ARRAY_TYPE(3);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e},i.fromValues=function(t,e,r){var i=new n.ARRAY_TYPE(3);return i[0]=t,i[1]=e,i[2]=r,i},i.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t},i.set=function(t,e,r,n){return t[0]=e,t[1]=r,t[2]=n,t},i.add=function(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t},i.subtract=function(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t},i.sub=i.subtract,i.multiply=function(t,e,r){return t[0]=e[0]*r[0],t[1]=e[1]*r[1],t[2]=e[2]*r[2],t},i.mul=i.multiply,i.divide=function(t,e,r){return t[0]=e[0]/r[0],t[1]=e[1]/r[1],t[2]=e[2]/r[2],t},i.div=i.divide,i.ceil=function(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t[2]=Math.ceil(e[2]),t},i.floor=function(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t[2]=Math.floor(e[2]),t},i.min=function(t,e,r){return t[0]=Math.min(e[0],r[0]),t[1]=Math.min(e[1],r[1]),t[2]=Math.min(e[2],r[2]),t},i.max=function(t,e,r){return t[0]=Math.max(e[0],r[0]),t[1]=Math.max(e[1],r[1]),t[2]=Math.max(e[2],r[2]),t},i.round=function(t,e){return t[0]=Math.round(e[0]),t[1]=Math.round(e[1]),t[2]=Math.round(e[2]),t},i.scale=function(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t},i.scaleAndAdd=function(t,e,r,n){return t[0]=e[0]+r[0]*n,t[1]=e[1]+r[1]*n,t[2]=e[2]+r[2]*n,t},i.distance=function(t,e){var r=e[0]-t[0],n=e[1]-t[1],i=e[2]-t[2];return Math.sqrt(r*r+n*n+i*i)},i.dist=i.distance,i.squaredDistance=function(t,e){var r=e[0]-t[0],n=e[1]-t[1],i=e[2]-t[2];return r*r+n*n+i*i},i.sqrDist=i.squaredDistance,i.length=function(t){var e=t[0],r=t[1],n=t[2];return Math.sqrt(e*e+r*r+n*n)},i.len=i.length,i.squaredLength=function(t){var e=t[0],r=t[1],n=t[2];return e*e+r*r+n*n},i.sqrLen=i.squaredLength,i.negate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t},i.inverse=function(t,e){return t[0]=1/e[0],t[1]=1/e[1],t[2]=1/e[2],t},i.normalize=function(t,e){var r=e[0],n=e[1],i=e[2],o=r*r+n*n+i*i;return o>0&&(o=1/Math.sqrt(o),t[0]=e[0]*o,t[1]=e[1]*o,t[2]=e[2]*o),t},i.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]},i.cross=function(t,e,r){var n=e[0],i=e[1],o=e[2],a=r[0],s=r[1],l=r[2];return t[0]=i*l-o*s,t[1]=o*a-n*l,t[2]=n*s-i*a,t},i.lerp=function(t,e,r,n){var i=e[0],o=e[1],a=e[2];return t[0]=i+n*(r[0]-i),t[1]=o+n*(r[1]-o),t[2]=a+n*(r[2]-a),t},i.hermite=function(t,e,r,n,i,o){var a=o*o,s=a*(2*o-3)+1,l=a*(o-2)+o,u=a*(o-1),c=a*(3-2*o);return t[0]=e[0]*s+r[0]*l+n[0]*u+i[0]*c,t[1]=e[1]*s+r[1]*l+n[1]*u+i[1]*c,t[2]=e[2]*s+r[2]*l+n[2]*u+i[2]*c,t},i.bezier=function(t,e,r,n,i,o){var a=1-o,s=a*a,l=o*o,u=s*a,c=3*o*s,h=3*l*a,f=l*o;return t[0]=e[0]*u+r[0]*c+n[0]*h+i[0]*f,t[1]=e[1]*u+r[1]*c+n[1]*h+i[1]*f,t[2]=e[2]*u+r[2]*c+n[2]*h+i[2]*f,t},i.random=function(t,e){e=e||1;var r=2*n.RANDOM()*Math.PI,i=2*n.RANDOM()-1,o=Math.sqrt(1-i*i)*e;return t[0]=Math.cos(r)*o,t[1]=Math.sin(r)*o,t[2]=i*e,t},i.transformMat4=function(t,e,r){var n=e[0],i=e[1],o=e[2],a=r[3]*n+r[7]*i+r[11]*o+r[15];return a=a||1,t[0]=(r[0]*n+r[4]*i+r[8]*o+r[12])/a,t[1]=(r[1]*n+r[5]*i+r[9]*o+r[13])/a,t[2]=(r[2]*n+r[6]*i+r[10]*o+r[14])/a,t},i.transformMat3=function(t,e,r){var n=e[0],i=e[1],o=e[2];return t[0]=n*r[0]+i*r[3]+o*r[6],t[1]=n*r[1]+i*r[4]+o*r[7],t[2]=n*r[2]+i*r[5]+o*r[8],t},i.transformQuat=function(t,e,r){var n=e[0],i=e[1],o=e[2],a=r[0],s=r[1],l=r[2],u=r[3],c=u*n+s*o-l*i,h=u*i+l*n-a*o,f=u*o+a*i-s*n,d=-a*n-s*i-l*o;return t[0]=c*u+d*-a+h*-l-f*-s,t[1]=h*u+d*-s+f*-a-c*-l,t[2]=f*u+d*-l+c*-s-h*-a,t},i.rotateX=function(t,e,r,n){var i=[],o=[];return i[0]=e[0]-r[0],i[1]=e[1]-r[1],i[2]=e[2]-r[2],o[0]=i[0],o[1]=i[1]*Math.cos(n)-i[2]*Math.sin(n),o[2]=i[1]*Math.sin(n)+i[2]*Math.cos(n),t[0]=o[0]+r[0],t[1]=o[1]+r[1],t[2]=o[2]+r[2],t},i.rotateY=function(t,e,r,n){var i=[],o=[];return i[0]=e[0]-r[0],i[1]=e[1]-r[1],i[2]=e[2]-r[2],o[0]=i[2]*Math.sin(n)+i[0]*Math.cos(n),o[1]=i[1],o[2]=i[2]*Math.cos(n)-i[0]*Math.sin(n),t[0]=o[0]+r[0],t[1]=o[1]+r[1],t[2]=o[2]+r[2],t},i.rotateZ=function(t,e,r,n){var i=[],o=[];return i[0]=e[0]-r[0],i[1]=e[1]-r[1],i[2]=e[2]-r[2],o[0]=i[0]*Math.cos(n)-i[1]*Math.sin(n),o[1]=i[0]*Math.sin(n)+i[1]*Math.cos(n),o[2]=i[2],t[0]=o[0]+r[0],t[1]=o[1]+r[1],t[2]=o[2]+r[2],t},i.forEach=function(){var t=i.create();return function(e,r,n,i,o,a){var s,l;for(r||(r=3),n||(n=0),l=i?Math.min(i*r+n,e.length):e.length,s=n;l>s;s+=r)t[0]=e[s],t[1]=e[s+1],t[2]=e[s+2],o(t,t,a),e[s]=t[0],e[s+1]=t[1],e[s+2]=t[2];return e}}(),i.angle=function(t,e){var r=i.fromValues(t[0],t[1],t[2]),n=i.fromValues(e[0],e[1],e[2]);i.normalize(r,r),i.normalize(n,n);var o=i.dot(r,n);return o>1?0:Math.acos(o)},i.str=function(t){return"vec3("+t[0]+", "+t[1]+", "+t[2]+")"},i.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]},i.equals=function(t,e){var r=t[0],i=t[1],o=t[2],a=e[0],s=e[1],l=e[2];return Math.abs(r-a)<=n.EPSILON*Math.max(1,Math.abs(r),Math.abs(a))&&Math.abs(i-s)<=n.EPSILON*Math.max(1,Math.abs(i),Math.abs(s))&&Math.abs(o-l)<=n.EPSILON*Math.max(1,Math.abs(o),Math.abs(l))},e.exports=i},{"./common.js":364}],372:[function(t,e,r){var n=t("./common.js"),i={};i.create=function(){var t=new n.ARRAY_TYPE(4);return t[0]=0,t[1]=0,t[2]=0,t[3]=0,t},i.clone=function(t){var e=new n.ARRAY_TYPE(4);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e},i.fromValues=function(t,e,r,i){var o=new n.ARRAY_TYPE(4);return o[0]=t,o[1]=e,o[2]=r,o[3]=i,o},i.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t},i.set=function(t,e,r,n,i){return t[0]=e,t[1]=r,t[2]=n,t[3]=i,t},i.add=function(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t[3]=e[3]+r[3],t},i.subtract=function(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t[3]=e[3]-r[3],t},i.sub=i.subtract,i.multiply=function(t,e,r){return t[0]=e[0]*r[0],
t[1]=e[1]*r[1],t[2]=e[2]*r[2],t[3]=e[3]*r[3],t},i.mul=i.multiply,i.divide=function(t,e,r){return t[0]=e[0]/r[0],t[1]=e[1]/r[1],t[2]=e[2]/r[2],t[3]=e[3]/r[3],t},i.div=i.divide,i.ceil=function(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t[2]=Math.ceil(e[2]),t[3]=Math.ceil(e[3]),t},i.floor=function(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t[2]=Math.floor(e[2]),t[3]=Math.floor(e[3]),t},i.min=function(t,e,r){return t[0]=Math.min(e[0],r[0]),t[1]=Math.min(e[1],r[1]),t[2]=Math.min(e[2],r[2]),t[3]=Math.min(e[3],r[3]),t},i.max=function(t,e,r){return t[0]=Math.max(e[0],r[0]),t[1]=Math.max(e[1],r[1]),t[2]=Math.max(e[2],r[2]),t[3]=Math.max(e[3],r[3]),t},i.round=function(t,e){return t[0]=Math.round(e[0]),t[1]=Math.round(e[1]),t[2]=Math.round(e[2]),t[3]=Math.round(e[3]),t},i.scale=function(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t},i.scaleAndAdd=function(t,e,r,n){return t[0]=e[0]+r[0]*n,t[1]=e[1]+r[1]*n,t[2]=e[2]+r[2]*n,t[3]=e[3]+r[3]*n,t},i.distance=function(t,e){var r=e[0]-t[0],n=e[1]-t[1],i=e[2]-t[2],o=e[3]-t[3];return Math.sqrt(r*r+n*n+i*i+o*o)},i.dist=i.distance,i.squaredDistance=function(t,e){var r=e[0]-t[0],n=e[1]-t[1],i=e[2]-t[2],o=e[3]-t[3];return r*r+n*n+i*i+o*o},i.sqrDist=i.squaredDistance,i.length=function(t){var e=t[0],r=t[1],n=t[2],i=t[3];return Math.sqrt(e*e+r*r+n*n+i*i)},i.len=i.length,i.squaredLength=function(t){var e=t[0],r=t[1],n=t[2],i=t[3];return e*e+r*r+n*n+i*i},i.sqrLen=i.squaredLength,i.negate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t},i.inverse=function(t,e){return t[0]=1/e[0],t[1]=1/e[1],t[2]=1/e[2],t[3]=1/e[3],t},i.normalize=function(t,e){var r=e[0],n=e[1],i=e[2],o=e[3],a=r*r+n*n+i*i+o*o;return a>0&&(a=1/Math.sqrt(a),t[0]=r*a,t[1]=n*a,t[2]=i*a,t[3]=o*a),t},i.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]},i.lerp=function(t,e,r,n){var i=e[0],o=e[1],a=e[2],s=e[3];return t[0]=i+n*(r[0]-i),t[1]=o+n*(r[1]-o),t[2]=a+n*(r[2]-a),t[3]=s+n*(r[3]-s),t},i.random=function(t,e){return e=e||1,t[0]=n.RANDOM(),t[1]=n.RANDOM(),t[2]=n.RANDOM(),t[3]=n.RANDOM(),i.normalize(t,t),i.scale(t,t,e),t},i.transformMat4=function(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3];return t[0]=r[0]*n+r[4]*i+r[8]*o+r[12]*a,t[1]=r[1]*n+r[5]*i+r[9]*o+r[13]*a,t[2]=r[2]*n+r[6]*i+r[10]*o+r[14]*a,t[3]=r[3]*n+r[7]*i+r[11]*o+r[15]*a,t},i.transformQuat=function(t,e,r){var n=e[0],i=e[1],o=e[2],a=r[0],s=r[1],l=r[2],u=r[3],c=u*n+s*o-l*i,h=u*i+l*n-a*o,f=u*o+a*i-s*n,d=-a*n-s*i-l*o;return t[0]=c*u+d*-a+h*-l-f*-s,t[1]=h*u+d*-s+f*-a-c*-l,t[2]=f*u+d*-l+c*-s-h*-a,t[3]=e[3],t},i.forEach=function(){var t=i.create();return function(e,r,n,i,o,a){var s,l;for(r||(r=4),n||(n=0),l=i?Math.min(i*r+n,e.length):e.length,s=n;l>s;s+=r)t[0]=e[s],t[1]=e[s+1],t[2]=e[s+2],t[3]=e[s+3],o(t,t,a),e[s]=t[0],e[s+1]=t[1],e[s+2]=t[2],e[s+3]=t[3];return e}}(),i.str=function(t){return"vec4("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"},i.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]},i.equals=function(t,e){var r=t[0],i=t[1],o=t[2],a=t[3],s=e[0],l=e[1],u=e[2],c=e[3];return Math.abs(r-s)<=n.EPSILON*Math.max(1,Math.abs(r),Math.abs(s))&&Math.abs(i-l)<=n.EPSILON*Math.max(1,Math.abs(i),Math.abs(l))&&Math.abs(o-u)<=n.EPSILON*Math.max(1,Math.abs(o),Math.abs(u))&&Math.abs(a-c)<=n.EPSILON*Math.max(1,Math.abs(a),Math.abs(c))},e.exports=i},{"./common.js":364}],373:[function(t,e,r){"use strict";function n(t,e,r){var n=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;var o=new Int32Array(this.arrayBuffer);t=o[0],e=o[1],r=o[2],this.d=e+2*r;for(var a=0;a<this.d*this.d;a++){var s=o[i+a],l=o[i+a+1];n.push(s===l?null:o.subarray(s,l))}var u=o[i+n.length],c=o[i+n.length+1];this.keys=o.subarray(u,c),this.bboxes=o.subarray(c),this.insert=this._insertReadonly}else{this.d=e+2*r;for(var h=0;h<this.d*this.d;h++)n.push([]);this.keys=[],this.bboxes=[]}this.n=e,this.extent=t,this.padding=r,this.scale=e/t,this.uid=0;var f=r/e*t;this.min=-f,this.max=t+f}e.exports=n;var i=3;n.prototype.insert=function(t,e,r,n,i){this._forEachCell(e,r,n,i,this._insertCell,this.uid++),this.keys.push(t),this.bboxes.push(e),this.bboxes.push(r),this.bboxes.push(n),this.bboxes.push(i)},n.prototype._insertReadonly=function(){throw"Cannot insert into a GridIndex created from an ArrayBuffer."},n.prototype._insertCell=function(t,e,r,n,i,o){this.cells[i].push(o)},n.prototype.query=function(t,e,r,n){var i=this.min,o=this.max;if(i>=t&&i>=e&&r>=o&&n>=o)return this.keys.slice();var a=[],s={};return this._forEachCell(t,e,r,n,this._queryCell,a,s),a},n.prototype._queryCell=function(t,e,r,n,i,o,a){var s=this.cells[i];if(null!==s)for(var l=this.keys,u=this.bboxes,c=0;c<s.length;c++){var h=s[c];if(void 0===a[h]){var f=4*h;t<=u[f+2]&&e<=u[f+3]&&r>=u[f+0]&&n>=u[f+1]?(a[h]=!0,o.push(l[h])):a[h]=!1}}},n.prototype._forEachCell=function(t,e,r,n,i,o,a){for(var s=this._convertToCellCoord(t),l=this._convertToCellCoord(e),u=this._convertToCellCoord(r),c=this._convertToCellCoord(n),h=s;u>=h;h++)for(var f=l;c>=f;f++){var d=this.d*f+h;if(i.call(this,t,e,r,n,d,o,a))return}},n.prototype._convertToCellCoord=function(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))},n.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;for(var t=this.cells,e=i+this.cells.length+1+1,r=0,n=0;n<this.cells.length;n++)r+=this.cells[n].length;var o=new Int32Array(e+r+this.keys.length+this.bboxes.length);o[0]=this.extent,o[1]=this.n,o[2]=this.padding;for(var a=e,s=0;s<t.length;s++){var l=t[s];o[i+s]=a,o.set(l,a),a+=l.length}return o[i+t.length]=a,o.set(this.keys,a),a+=this.keys.length,o[i+t.length+1]=a,o.set(this.bboxes,a),a+=this.bboxes.length,o.buffer}},{}],374:[function(t,e,r){"use strict";function n(t,e){var r;if(c(t)){var s,l="object"==typeof t.stops[0][0],u=l||void 0!==t.property,h=l||!u,f=t.type||e||"exponential";if("exponential"===f)s=a;else if("interval"===f)s=o;else{if("categorical"!==f)throw new Error('Unknown function type "'+f+'"');s=i}if(l){for(var d={},p=[],v=0;v<t.stops.length;v++){var m=t.stops[v];void 0===d[m[0].zoom]&&(d[m[0].zoom]={zoom:m[0].zoom,type:t.type,property:t.property,stops:[]}),d[m[0].zoom].stops.push([m[0].value,m[1]])}for(var g in d)p.push([d[g].zoom,n(d[g])]);r=function(e,r){return a({stops:p,base:t.base},e)(e,r)},r.isFeatureConstant=!1,r.isZoomConstant=!1}else h?(r=function(e){return s(t,e)},r.isFeatureConstant=!0,r.isZoomConstant=!1):(r=function(e,r){return s(t,r[t.property])},r.isFeatureConstant=!1,r.isZoomConstant=!0)}else r=function(){return t},r.isFeatureConstant=!0,r.isZoomConstant=!0;return r}function i(t,e){for(var r=0;r<t.stops.length;r++)if(e===t.stops[r][0])return t.stops[r][1];return t.stops[0][1]}function o(t,e){for(var r=0;r<t.stops.length&&!(e<t.stops[r][0]);r++);return t.stops[Math.max(r-1,0)][1]}function a(t,e){for(var r=void 0!==t.base?t.base:1,n=0;;){if(n>=t.stops.length)break;if(e<=t.stops[n][0])break;n++}return 0===n?t.stops[n][1]:n===t.stops.length?t.stops[n-1][1]:s(e,r,t.stops[n-1][0],t.stops[n][0],t.stops[n-1][1],t.stops[n][1])}function s(t,e,r,n,i,o){return"function"==typeof i?function(){var a=i.apply(void 0,arguments),l=o.apply(void 0,arguments);return s(t,e,r,n,a,l)}:i.length?u(t,e,r,n,i,o):l(t,e,r,n,i,o)}function l(t,e,r,n,i,o){var a,s=n-r,l=t-r;return a=1===e?l/s:(Math.pow(e,l)-1)/(Math.pow(e,s)-1),i*(1-a)+o*a}function u(t,e,r,n,i,o){for(var a=[],s=0;s<i.length;s++)a[s]=l(t,e,r,n,i[s],o[s]);return a}function c(t){return"object"==typeof t&&t.stops}e.exports.isFunctionDefinition=c,e.exports.interpolated=function(t){return n(t,"exponential")},e.exports["piecewise-constant"]=function(t){return n(t,"interval")}},{}],375:[function(t,e,r){"use strict";function n(t){return!!(i()&&o()&&a()&&s()&&l()&&u()&&c(t&&t.failIfMajorPerformanceCaveat))}function i(){return"undefined"!=typeof window&&"undefined"!=typeof document}function o(){return Array.prototype&&Array.prototype.every&&Array.prototype.filter&&Array.prototype.forEach&&Array.prototype.indexOf&&Array.prototype.lastIndexOf&&Array.prototype.map&&Array.prototype.some&&Array.prototype.reduce&&Array.prototype.reduceRight&&Array.isArray}function a(){return Function.prototype&&Function.prototype.bind}function s(){return Object.keys&&Object.create&&Object.getPrototypeOf&&Object.getOwnPropertyNames&&Object.isSealed&&Object.isFrozen&&Object.isExtensible&&Object.getOwnPropertyDescriptor&&Object.defineProperty&&Object.defineProperties&&Object.seal&&Object.freeze&&Object.preventExtensions}function l(){return"JSON"in window&&"parse"in JSON&&"stringify"in JSON}function u(){return"Worker"in window}function c(t){return void 0===f[t]&&(f[t]=h(t)),f[t]}function h(t){var e=document.createElement("canvas"),r=Object.create(n.webGLContextAttributes);return r.failIfMajorPerformanceCaveat=t,e.probablySupportsContext?e.probablySupportsContext("webgl",r)||e.probablySupportsContext("experimental-webgl",r):e.supportsContext?e.supportsContext("webgl",r)||e.supportsContext("experimental-webgl",r):e.getContext("webgl",r)||e.getContext("experimental-webgl",r)}"undefined"!=typeof e&&e.exports?e.exports=n:window&&(window.mapboxgl=window.mapboxgl||{},window.mapboxgl.supported=n);var f={};n.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0}},{}],376:[function(t,e,r){"use strict";function n(t,e){this.message=(t?t+": ":"")+i.apply(i,Array.prototype.slice.call(arguments,2)),null!==e&&void 0!==e&&e.__line__&&(this.line=e.__line__)}var i=t("util").format;e.exports=n},{util:62}],377:[function(t,e,r){"use strict";e.exports=function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)t[n]=r[n]}return t}},{}],378:[function(t,e,r){"use strict";e.exports=function(t){return t instanceof Number?"number":t instanceof String?"string":t instanceof Boolean?"boolean":Array.isArray(t)?"array":null===t?"null":typeof t}},{}],379:[function(t,e,r){"use strict";e.exports=function(t){return t instanceof Number||t instanceof String||t instanceof Boolean?t.valueOf():t}},{}],380:[function(t,e,r){"use strict";var n=t("../error/validation_error"),i=t("../util/get_type"),o=t("../util/extend");e.exports=function(e){var r=t("./validate_function"),a=t("./validate_object"),s={"*":function(){return[]},array:t("./validate_array"),"boolean":t("./validate_boolean"),number:t("./validate_number"),color:t("./validate_color"),constants:t("./validate_constants"),"enum":t("./validate_enum"),filter:t("./validate_filter"),"function":t("./validate_function"),layer:t("./validate_layer"),object:t("./validate_object"),source:t("./validate_source"),string:t("./validate_string")},l=e.value,u=e.valueSpec,c=e.key,h=e.styleSpec,f=e.style;if("string"===i(l)&&"@"===l[0]){if(h.$version>7)return[new n(c,l,"constants have been deprecated as of v8")];if(!(l in f.constants))return[new n(c,l,'constant "%s" not found',l)];e=o({},e,{value:f.constants[l]})}return u.function&&"object"===i(l)?r(e):u.type&&s[u.type]?s[u.type](e):a(o({},e,{valueSpec:u.type?h[u.type]:u}))}},{"../error/validation_error":376,"../util/extend":377,"../util/get_type":378,"./validate_array":381,"./validate_boolean":382,"./validate_color":383,"./validate_constants":384,"./validate_enum":385,"./validate_filter":386,"./validate_function":387,"./validate_layer":389,"./validate_number":391,"./validate_object":392,"./validate_source":394,"./validate_string":395}],381:[function(t,e,r){"use strict";var n=t("../util/get_type"),i=t("./validate"),o=t("../error/validation_error");e.exports=function(t){var e=t.value,r=t.valueSpec,a=t.style,s=t.styleSpec,l=t.key,u=t.arrayElementValidator||i;if("array"!==n(e))return[new o(l,e,"array expected, %s found",n(e))];if(r.length&&e.length!==r.length)return[new o(l,e,"array length %d expected, length %d found",r.length,e.length)];if(r["min-length"]&&e.length<r["min-length"])return[new o(l,e,"array length at least %d expected, length %d found",r["min-length"],e.length)];var c={type:r.value};s.$version<7&&(c.function=r.function),"object"===n(r.value)&&(c=r.value);for(var h=[],f=0;f<e.length;f++)h=h.concat(u({array:e,arrayIndex:f,value:e[f],valueSpec:c,style:a,styleSpec:s,key:l+"["+f+"]"}));return h}},{"../error/validation_error":376,"../util/get_type":378,"./validate":380}],382:[function(t,e,r){"use strict";var n=t("../util/get_type"),i=t("../error/validation_error");e.exports=function(t){var e=t.value,r=t.key,o=n(e);return"boolean"!==o?[new i(r,e,"boolean expected, %s found",o)]:[]}},{"../error/validation_error":376,"../util/get_type":378}],383:[function(t,e,r){"use strict";var n=t("../error/validation_error"),i=t("../util/get_type"),o=t("csscolorparser").parseCSSColor;e.exports=function(t){var e=t.key,r=t.value,a=i(r);return"string"!==a?[new n(e,r,"color expected, %s found",a)]:null===o(r)?[new n(e,r,'color expected, "%s" found',r)]:[]}},{"../error/validation_error":376,"../util/get_type":378,csscolorparser:351}],384:[function(t,e,r){"use strict";var n=t("../error/validation_error"),i=t("../util/get_type");e.exports=function(t){var e=t.key,r=t.value,o=t.styleSpec;if(o.$version>7)return r?[new n(e,r,"constants have been deprecated as of v8")]:[];var a=i(r);if("object"!==a)return[new n(e,r,"object expected, %s found",a)];var s=[];for(var l in r)"@"!==l[0]&&s.push(new n(e+"."+l,r[l],'constants must start with "@"'));return s}},{"../error/validation_error":376,"../util/get_type":378}],385:[function(t,e,r){"use strict";var n=t("../error/validation_error"),i=t("../util/unbundle_jsonlint");e.exports=function(t){var e=t.key,r=t.value,o=t.valueSpec,a=[];return-1===o.values.indexOf(i(r))&&a.push(new n(e,r,"expected one of [%s], %s found",o.values.join(", "),r)),a}},{"../error/validation_error":376,"../util/unbundle_jsonlint":379}],386:[function(t,e,r){"use strict";var n=t("../error/validation_error"),i=t("./validate_enum"),o=t("../util/get_type"),a=t("../util/unbundle_jsonlint");e.exports=function s(t){var e,r=t.value,l=t.key,u=t.styleSpec,c=[];if("array"!==o(r))return[new n(l,r,"array expected, %s found",o(r))];if(r.length<1)return[new n(l,r,"filter array must have at least 1 element")];switch(c=c.concat(i({key:l+"[0]",value:r[0],valueSpec:u.filter_operator,style:t.style,styleSpec:t.styleSpec})),a(r[0])){case"<":case"<=":case">":case">=":r.length>=2&&"$type"==r[1]&&c.push(new n(l,r,'"$type" cannot be use with operator "%s"',r[0]));case"==":case"!=":3!=r.length&&c.push(new n(l,r,'filter array for operator "%s" must have 3 elements',r[0]));case"in":case"!in":r.length>=2&&(e=o(r[1]),"string"!==e?c.push(new n(l+"[1]",r[1],"string expected, %s found",e)):"@"===r[1][0]&&c.push(new n(l+"[1]",r[1],"filter key cannot be a constant")));for(var h=2;h<r.length;h++)e=o(r[h]),"$type"==r[1]?c=c.concat(i({key:l+"["+h+"]",value:r[h],valueSpec:u.geometry_type,style:t.style,styleSpec:t.styleSpec})):"string"===e&&"@"===r[h][0]?c.push(new n(l+"["+h+"]",r[h],"filter value cannot be a constant")):"string"!==e&&"number"!==e&&"boolean"!==e&&c.push(new n(l+"["+h+"]",r[h],"string, number, or boolean expected, %s found",e));break;case"any":case"all":case"none":for(h=1;h<r.length;h++)c=c.concat(s({key:l+"["+h+"]",value:r[h],style:t.style,styleSpec:t.styleSpec}));break;case"has":case"!has":e=o(r[1]),2!==r.length?c.push(new n(l,r,'filter array for "%s" operator must have 2 elements',r[0])):"string"!==e?c.push(new n(l+"[1]",r[1],"string expected, %s found",e)):"@"===r[1][0]&&c.push(new n(l+"[1]",r[1],"filter key cannot be a constant"))}return c}},{"../error/validation_error":376,"../util/get_type":378,"../util/unbundle_jsonlint":379,"./validate_enum":385}],387:[function(t,e,r){"use strict";var n=t("../error/validation_error"),i=t("../util/get_type"),o=t("./validate"),a=t("./validate_object"),s=t("./validate_array"),l=t("./validate_number");e.exports=function(t){function e(t){var e=[],o=t.value;return e=e.concat(s({key:t.key,value:o,valueSpec:t.valueSpec,style:t.style,styleSpec:t.styleSpec,arrayElementValidator:r})),"array"===i(o)&&0===o.length&&e.push(new n(t.key,o,"array must have at least one stop")),e}function r(t){var e=[],r=t.value,s=t.key;if("array"!==i(r))return[new n(s,r,"array expected, %s found",i(r))];if(2!==r.length)return[new n(s,r,"array length %d expected, length %d found",2,r.length)];var d=i(r[0]);if(c||(c=d),d!==c)return[new n(s,r,"%s stop key type must match previous stop key type %s",d,c)];if("object"===d){if(void 0===r[0].zoom)return[new n(s,r,"object stop key must have zoom")];if(void 0===r[0].value)return[new n(s,r,"object stop key must have value")];e=e.concat(a({key:s+"[0]",value:r[0],valueSpec:{zoom:{}},style:t.style,styleSpec:t.styleSpec,objectElementValidators:{zoom:l,value:u}}))}else{var p=!f.property;e=e.concat((p?l:u)({key:s+"[0]",value:r[0],valueSpec:{},style:t.style,styleSpec:t.styleSpec}))}return e=e.concat(o({key:s+"[1]",value:r[1],valueSpec:h,style:t.style,styleSpec:t.styleSpec})),"number"===i(r[0])&&("piecewise-constant"===h.function&&r[0]%1!==0&&e.push(new n(s+"[0]",r[0],"zoom level for piecewise-constant functions must be an integer")),0!==t.arrayIndex&&r[0]<t.array[t.arrayIndex-1][0]&&e.push(new n(s+"[0]",r[0],"array stops must appear in ascending order"))),e}function u(t){var e=[],r=i(t.value);return"number"!==r&&"string"!==r&&"array"!==r&&e.push(new n(t.key,t.value,"property value must be a number, string or array")),e}var c,h=t.valueSpec,f=t.value;return a({key:t.key,value:t.value,valueSpec:t.styleSpec.function,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{stops:e}})}},{"../error/validation_error":376,"../util/get_type":378,"./validate":380,"./validate_array":381,"./validate_number":391,"./validate_object":392}],388:[function(t,e,r){"use strict";var n=t("../error/validation_error"),i=t("./validate_string");e.exports=function(t){var e=t.value,r=t.key,o=i(t);return o.length?o:(-1===e.indexOf("{fontstack}")&&o.push(new n(r,e,'"glyphs" url must include a "{fontstack}" token')),-1===e.indexOf("{range}")&&o.push(new n(r,e,'"glyphs" url must include a "{range}" token')),o)}},{"../error/validation_error":376,"./validate_string":395}],389:[function(t,e,r){"use strict";var n=t("../error/validation_error"),i=t("../util/unbundle_jsonlint"),o=t("./validate_object"),a=t("./validate_filter"),s=t("./validate_paint_property"),l=t("./validate_layout_property"),u=t("../util/extend");e.exports=function(t){var e=[],r=t.value,c=t.key,h=t.style,f=t.styleSpec;r.type||r.ref||e.push(new n(c,r,'either "type" or "ref" is required'));var d=i(r.type),p=i(r.ref);if(r.id)for(var v=0;v<t.arrayIndex;v++){var m=h.layers[v];i(m.id)===i(r.id)&&e.push(new n(c,r.id,'duplicate layer id "%s", previously used at line %d',r.id,m.id.__line__))}if("ref"in r){["type","source","source-layer","filter","layout"].forEach(function(t){t in r&&e.push(new n(c,r[t],'"%s" is prohibited for ref layers',t))});var g;h.layers.forEach(function(t){t.id==p&&(g=t)}),g?g.ref?e.push(new n(c,r.ref,"ref cannot reference another ref layer")):d=i(g.type):e.push(new n(c,r.ref,'ref layer "%s" not found',p))}else if("background"!==d)if(r.source){var y=h.sources[r.source];y?"vector"==y.type&&"raster"==d?e.push(new n(c,r.source,'layer "%s" requires a raster source',r.id)):"raster"==y.type&&"raster"!=d?e.push(new n(c,r.source,'layer "%s" requires a vector source',r.id)):"vector"!=y.type||r["source-layer"]||e.push(new n(c,r,'layer "%s" must specify a "source-layer"',r.id)):e.push(new n(c,r.source,'source "%s" not found',r.source))}else e.push(new n(c,r,'missing required property "source"'));return e=e.concat(o({key:c,value:r,valueSpec:f.layer,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{filter:a,layout:function(t){return o({layer:r,key:t.key,value:t.value,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{"*":function(t){return l(u({layerType:d},t))}}})},paint:function(t){return o({layer:r,key:t.key,value:t.value,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{"*":function(t){return s(u({layerType:d},t))}}})}}}))}},{"../error/validation_error":376,"../util/extend":377,"../util/unbundle_jsonlint":379,"./validate_filter":386,"./validate_layout_property":390,"./validate_object":392,"./validate_paint_property":393}],390:[function(t,e,r){"use strict";var n=t("./validate"),i=t("../error/validation_error");e.exports=function(t){var e=t.key,r=t.style,o=t.styleSpec,a=t.value,s=t.objectKey,l=o["layout_"+t.layerType];if(t.valueSpec||l[s]){var u=[];return"symbol"===t.layerType&&("icon-image"===s&&r&&!r.sprite?u.push(new i(e,a,'use of "icon-image" requires a style "sprite" property')):"text-field"===s&&r&&!r.glyphs&&u.push(new i(e,a,'use of "text-field" requires a style "glyphs" property'))),u.concat(n({key:t.key,value:a,valueSpec:t.valueSpec||l[s],style:r,styleSpec:o}))}return[new i(e,a,'unknown property "%s"',s)]}},{"../error/validation_error":376,"./validate":380}],391:[function(t,e,r){"use strict";var n=t("../util/get_type"),i=t("../error/validation_error");e.exports=function(t){var e=t.key,r=t.value,o=t.valueSpec,a=n(r);return"number"!==a?[new i(e,r,"number expected, %s found",a)]:"minimum"in o&&r<o.minimum?[new i(e,r,"%s is less than the minimum value %s",r,o.minimum)]:"maximum"in o&&r>o.maximum?[new i(e,r,"%s is greater than the maximum value %s",r,o.maximum)]:[]}},{"../error/validation_error":376,"../util/get_type":378}],392:[function(t,e,r){"use strict";var n=t("../error/validation_error"),i=t("../util/get_type"),o=t("./validate");e.exports=function(t){var e=t.key,r=t.value,a=t.valueSpec,s=t.objectElementValidators||{},l=t.style,u=t.styleSpec,c=[],h=i(r);if("object"!==h)return[new n(e,r,"object expected, %s found",h)];for(var f in r){var d=f.split(".")[0],p=a&&(a[d]||a["*"]),v=s[d]||s["*"];p||v?c=c.concat((v||o)({key:(e?e+".":e)+f,value:r[f],valueSpec:p,style:l,styleSpec:u,object:r,objectKey:f})):""!==e&&1!==e.split(".").length&&c.push(new n(e,r[f],'unknown property "%s"',f))}for(d in a)a[d].required&&void 0===a[d].default&&void 0===r[d]&&c.push(new n(e,r,'missing required property "%s"',d));return c}},{"../error/validation_error":376,"../util/get_type":378,"./validate":380}],393:[function(t,e,r){"use strict";var n=t("./validate"),i=t("../error/validation_error");e.exports=function(t){var e=t.key,r=t.style,o=t.styleSpec,a=t.value,s=t.objectKey,l=o["paint_"+t.layerType],u=s.match(/^(.*)-transition$/);return u&&l[u[1]]&&l[u[1]].transition?n({key:e,value:a,valueSpec:o.transition,style:r,styleSpec:o}):t.valueSpec||l[s]?n({key:t.key,value:a,valueSpec:t.valueSpec||l[s],style:r,styleSpec:o}):[new i(e,a,'unknown property "%s"',s)]}},{"../error/validation_error":376,"./validate":380}],394:[function(t,e,r){"use strict";var n=t("../error/validation_error"),i=t("../util/unbundle_jsonlint"),o=t("./validate_object"),a=t("./validate_enum");e.exports=function(t){var e=t.value,r=t.key,s=t.styleSpec,l=t.style;if(!e.type)return[new n(r,e,'"type" is required')];var u=i(e.type);switch(u){case"vector":case"raster":var c=[];if(c=c.concat(o({key:r,value:e,valueSpec:s.source_tile,style:t.style,styleSpec:s})),"url"in e)for(var h in e)["type","url","tileSize"].indexOf(h)<0&&c.push(new n(r+"."+h,e[h],'a source with a "url" property may not include a "%s" property',h));return c;case"geojson":return o({key:r,value:e,valueSpec:s.source_geojson,style:l,styleSpec:s});case"video":return o({key:r,value:e,valueSpec:s.source_video,style:l,styleSpec:s});case"image":return o({key:r,value:e,valueSpec:s.source_image,style:l,styleSpec:s});default:return a({key:r+".type",value:e.type,valueSpec:{values:["vector","raster","geojson","video","image"]},style:l,styleSpec:s})}}},{"../error/validation_error":376,"../util/unbundle_jsonlint":379,"./validate_enum":385,"./validate_object":392}],395:[function(t,e,r){"use strict";var n=t("../util/get_type"),i=t("../error/validation_error");e.exports=function(t){var e=t.value,r=t.key,o=n(e);return"string"!==o?[new i(r,e,"string expected, %s found",o)]:[]}},{"../error/validation_error":376,"../util/get_type":378}],396:[function(t,e,r){"use strict";function n(t,e){e=e||l;var r=[];return r=r.concat(s({key:"",value:t,valueSpec:e.$root,styleSpec:e,style:t,objectElementValidators:{glyphs:u}})),e.$version>7&&t.constants&&(r=r.concat(a({key:"constants",value:t.constants,style:t,styleSpec:e}))),i(r)}function i(t){return[].concat(t).sort(function(t,e){return t.line-e.line})}function o(t){return function(){return i(t.apply(this,arguments))}}var a=t("./validate/validate_constants"),s=t("./validate/validate"),l=t("../reference/latest.min"),u=t("./validate/validate_glyphs_url");n.source=o(t("./validate/validate_source")),n.layer=o(t("./validate/validate_layer")),n.filter=o(t("./validate/validate_filter")),n.paintProperty=o(t("./validate/validate_paint_property")),n.layoutProperty=o(t("./validate/validate_layout_property")),e.exports=n},{"../reference/latest.min":398,"./validate/validate":380,"./validate/validate_constants":384,"./validate/validate_filter":386,"./validate/validate_glyphs_url":388,"./validate/validate_layer":389,"./validate/validate_layout_property":390,"./validate/validate_paint_property":393,"./validate/validate_source":394}],397:[function(t,e,r){e.exports=t("./v8.json")},{"./v8.json":399}],398:[function(t,e,r){e.exports=t("./v8.min.json")},{"./v8.min.json":400}],399:[function(t,e,r){e.exports={$version:8,$root:{version:{required:!0,type:"enum",values:[8],doc:"Stylesheet version number. Must be 8.",example:8},name:{type:"string",doc:"A human-readable name for the style.",example:"Bright"},metadata:{type:"*",doc:"Arbitrary properties useful to track with the stylesheet, but do not influence rendering. Properties should be prefixed to avoid collisions, like 'mapbox:'."},center:{type:"array",value:"number",doc:"Default map center in longitude and latitude.  The style center will be used only if the map has not been positioned by other means (e.g. map options or user interaction).",example:[-73.9749,40.7736]},zoom:{type:"number",doc:"Default zoom level.  The style zoom will be used only if the map has not been positioned by other means (e.g. map options or user interaction).",example:12.5},bearing:{type:"number","default":0,period:360,units:"degrees",doc:"Default bearing, in degrees.  The style bearing will be used only if the map has not been positioned by other means (e.g. map options or user interaction).",example:29},pitch:{type:"number","default":0,units:"degrees",doc:"Default pitch, in degrees. Zero is perpendicular to the surface.  The style pitch will be used only if the map has not been positioned by other means (e.g. map options or user interaction).",example:50},sources:{required:!0,type:"sources",doc:"Data source specifications.",example:{"mapbox-streets":{type:"vector",url:"mapbox://mapbox.mapbox-streets-v6"}}},sprite:{type:"string",doc:"A base URL for retrieving the sprite image and metadata. The extensions `.png`, `.json` and scale factor `@2x.png` will be automatically appended. This property is required if any layer uses the 'sprite-image' layout property.",example:"mapbox://sprites/mapbox/bright-v8"},glyphs:{type:"string",doc:"A URL template for loading signed-distance-field glyph sets in PBF format. The URL must include `{fontstack}` and `{range}` tokens. This property is required if any layer uses the 'text-field' layout property.",example:"mapbox://fonts/mapbox/{fontstack}/{range}.pbf"},transition:{type:"transition",doc:"A global transition definition to use as a default across properties.",example:{duration:300,delay:0}},layers:{required:!0,type:"array",value:"layer",doc:"Layers will be drawn in the order of this array.",example:[{id:"water",source:"mapbox-streets","source-layer":"water",type:"fill",paint:{"fill-color":"#00ffff"}}]}},sources:{"*":{type:"source",doc:"Specification of a data source. For vector and raster sources, either TileJSON or a URL to a TileJSON must be provided. For GeoJSON and video sources, a URL must be provided."}},source:["source_tile","source_geojson","source_video","source_image"],source_tile:{type:{required:!0,type:"enum",values:["vector","raster"],doc:"The data type of the tile source."},url:{type:"string",doc:"A URL to a TileJSON resource. Supported protocols are `http:`, `https:`, and `mapbox://<mapid>`."},tiles:{type:"array",value:"string",doc:"An array of one or more tile source URLs, as in the TileJSON spec."},minzoom:{type:"number","default":0,doc:"Minimum zoom level for which tiles are available, as in the TileJSON spec."},maxzoom:{type:"number","default":22,doc:"Maximum zoom level for which tiles are available, as in the TileJSON spec. Data from tiles at the maxzoom are used when displaying the map at higher zoom levels."},tileSize:{type:"number","default":512,units:"pixels",doc:"The minimum visual size to display tiles for this layer. Only configurable for raster layers."},"*":{type:"*",doc:"Other keys to configure the data source."}},source_geojson:{type:{required:!0,type:"enum",values:["geojson"],doc:"The data type of the GeoJSON source."},data:{type:"*",doc:"A URL to a GeoJSON file, or inline GeoJSON."},maxzoom:{type:"number","default":14,doc:"Maximum zoom level at which to create vector tiles (higher means greater detail at high zoom levels)."},buffer:{type:"number","default":64,doc:"Tile buffer size on each side (higher means fewer rendering artifacts near tile edges but slower performance)."},tolerance:{type:"number","default":3,doc:"Douglas-Peucker simplification tolerance (higher means simpler geometries and faster performance)."},cluster:{type:"boolean","default":!1,doc:"If the data is a collection of point features, setting this to true clusters the points by radius into groups."},clusterRadius:{type:"number","default":400,doc:"Radius of each cluster when clustering points, relative to 4096 tile."},clusterMaxZoom:{type:"number",doc:"Max zoom to cluster points on. Defaults to one zoom less than maxzoom (so that last zoom features are not clustered)."}},source_video:{type:{required:!0,type:"enum",values:["video"],doc:"The data type of the video source."},urls:{required:!0,type:"array",value:"string",doc:"URLs to video content in order of preferred format."},coordinates:{required:!0,doc:"Corners of video specified in longitude, latitude pairs.",type:"array",length:4,value:{type:"array",length:2,value:"number",doc:"A single longitude, latitude pair."}}},source_image:{type:{required:!0,type:"enum",values:["image"],doc:"The data type of the image source."},url:{required:!0,type:"string",doc:"URL that points to an image"},coordinates:{required:!0,doc:"Corners of image specified in longitude, latitude pairs.",type:"array",length:4,value:{type:"array",length:2,value:"number",doc:"A single longitude, latitude pair."}}},layer:{id:{type:"string",doc:"Unique layer name.",required:!0},type:{type:"enum",values:["fill","line","symbol","circle","raster","background"],doc:"Rendering type of this layer."},metadata:{type:"*",doc:"Arbitrary properties useful to track with the layer, but do not influence rendering. Properties should be prefixed to avoid collisions, like 'mapbox:'."},ref:{type:"string",doc:"References another layer to copy `type`, `source`, `source-layer`, `minzoom`, `maxzoom`, `filter`, and `layout` properties from. This allows the layers to share processing and be more efficient."},source:{type:"string",doc:"Name of a source description to be used for this layer."},"source-layer":{type:"string",doc:"Layer to use from a vector tile source. Required if the source supports multiple layers."},minzoom:{type:"number",minimum:0,maximum:22,doc:"The minimum zoom level on which the layer gets parsed and appears on."},maxzoom:{type:"number",minimum:0,maximum:22,doc:"The maximum zoom level on which the layer gets parsed and appears on."},interactive:{type:"boolean",doc:"Enable querying of feature data from this layer for interactivity.","default":!1},filter:{type:"filter",doc:"A expression specifying conditions on source features. Only features that match the filter are displayed."},layout:{type:"layout",doc:"Layout properties for the layer."},paint:{type:"paint",doc:"Default paint properties for this layer."},"paint.*":{type:"paint",doc:"Class-specific paint properties for this layer. The class name is the part after the first dot."
}},layout:["layout_fill","layout_line","layout_circle","layout_symbol","layout_raster","layout_background"],layout_background:{visibility:{type:"enum","function":"piecewise-constant",values:["visible","none"],"default":"visible",doc:"The display of this layer. `none` hides this layer."}},layout_fill:{visibility:{type:"enum","function":"piecewise-constant",values:["visible","none"],"default":"visible",doc:"The display of this layer. `none` hides this layer."}},layout_circle:{visibility:{type:"enum","function":"piecewise-constant",values:["visible","none"],"default":"visible",doc:"The display of this layer. `none` hides this layer."}},layout_line:{"line-cap":{type:"enum","function":"piecewise-constant",values:["butt","round","square"],"default":"butt",doc:"The display of line endings."},"line-join":{type:"enum","function":"piecewise-constant",values:["bevel","round","miter"],"default":"miter",doc:"The display of lines when joining."},"line-miter-limit":{type:"number","default":2,"function":"interpolated",doc:"Used to automatically convert miter joins to bevel joins for sharp angles.",requires:[{"line-join":"miter"}]},"line-round-limit":{type:"number","default":1.05,"function":"interpolated",doc:"Used to automatically convert round joins to miter joins for shallow angles.",requires:[{"line-join":"round"}]},visibility:{type:"enum","function":"piecewise-constant",values:["visible","none"],"default":"visible",doc:"The display of this layer. `none` hides this layer."}},layout_symbol:{"symbol-placement":{type:"enum","function":"piecewise-constant",values:["point","line"],"default":"point",doc:"Label placement relative to its geometry. `line` can only be used on LineStrings and Polygons."},"symbol-spacing":{type:"number","default":250,minimum:1,"function":"interpolated",units:"pixels",doc:"Distance between two symbol anchors.",requires:[{"symbol-placement":"line"}]},"symbol-avoid-edges":{type:"boolean","function":"piecewise-constant","default":!1,doc:"If true, the symbols will not cross tile edges to avoid mutual collisions. Recommended in layers that don't have enough padding in the vector tile to prevent collisions, or if it is a point symbol layer placed after a line symbol layer."},"icon-allow-overlap":{type:"boolean","function":"piecewise-constant","default":!1,doc:"If true, the icon will be visible even if it collides with other previously drawn symbols.",requires:["icon-image"]},"icon-ignore-placement":{type:"boolean","function":"piecewise-constant","default":!1,doc:"If true, other symbols can be visible even if they collide with the icon.",requires:["icon-image"]},"icon-optional":{type:"boolean","function":"piecewise-constant","default":!1,doc:"If true, text will display without their corresponding icons when the icon collides with other symbols and the text does not.",requires:["icon-image","text-field"]},"icon-rotation-alignment":{type:"enum","function":"piecewise-constant",values:["map","viewport"],"default":"viewport",doc:"Orientation of icon when map is rotated.",requires:["icon-image"]},"icon-size":{type:"number","default":1,minimum:0,"function":"interpolated",doc:"Scale factor for icon. 1 is original size, 3 triples the size.",requires:["icon-image"]},"icon-image":{type:"string","function":"piecewise-constant",doc:"A string with {tokens} replaced, referencing the data property to pull from.",tokens:!0},"icon-rotate":{type:"number","default":0,period:360,"function":"interpolated",units:"degrees",doc:"Rotates the icon clockwise.",requires:["icon-image"]},"icon-padding":{type:"number","default":2,minimum:0,"function":"interpolated",units:"pixels",doc:"Size of the additional area around the icon bounding box used for detecting symbol collisions.",requires:["icon-image"]},"icon-keep-upright":{type:"boolean","function":"piecewise-constant","default":!1,doc:"If true, the icon may be flipped to prevent it from being rendered upside-down.",requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":"line"}]},"icon-offset":{type:"array",value:"number",length:2,"default":[0,0],"function":"interpolated",doc:"Offset distance of icon from its anchor. Positive values indicate right and down, while negative values indicate left and up.",requires:["icon-image"]},"text-rotation-alignment":{type:"enum","function":"piecewise-constant",values:["map","viewport"],"default":"viewport",doc:"Orientation of text when map is rotated.",requires:["text-field"]},"text-field":{type:"string","function":"piecewise-constant","default":"",tokens:!0,doc:"Value to use for a text label. Feature properties are specified using tokens like {field_name}."},"text-font":{type:"array",value:"string","function":"piecewise-constant","default":["Open Sans Regular","Arial Unicode MS Regular"],doc:"Font stack to use for displaying text.",requires:["text-field"]},"text-size":{type:"number","default":16,minimum:0,units:"pixels","function":"interpolated",doc:"Font size.",requires:["text-field"]},"text-max-width":{type:"number","default":10,minimum:0,units:"em","function":"interpolated",doc:"The maximum line width for text wrapping.",requires:["text-field"]},"text-line-height":{type:"number","default":1.2,units:"em","function":"interpolated",doc:"Text leading value for multi-line text.",requires:["text-field"]},"text-letter-spacing":{type:"number","default":0,units:"em","function":"interpolated",doc:"Text tracking amount.",requires:["text-field"]},"text-justify":{type:"enum","function":"piecewise-constant",values:["left","center","right"],"default":"center",doc:"Text justification options.",requires:["text-field"]},"text-anchor":{type:"enum","function":"piecewise-constant",values:["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"],"default":"center",doc:"Part of the text placed closest to the anchor.",requires:["text-field"]},"text-max-angle":{type:"number","default":45,units:"degrees","function":"interpolated",doc:"Maximum angle change between adjacent characters.",requires:["text-field",{"symbol-placement":"line"}]},"text-rotate":{type:"number","default":0,period:360,units:"degrees","function":"interpolated",doc:"Rotates the text clockwise.",requires:["text-field"]},"text-padding":{type:"number","default":2,minimum:0,units:"pixels","function":"interpolated",doc:"Size of the additional area around the text bounding box used for detecting symbol collisions.",requires:["text-field"]},"text-keep-upright":{type:"boolean","function":"piecewise-constant","default":!0,doc:"If true, the text may be flipped vertically to prevent it from being rendered upside-down.",requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":"line"}]},"text-transform":{type:"enum","function":"piecewise-constant",values:["none","uppercase","lowercase"],"default":"none",doc:"Specifies how to capitalize text, similar to the CSS `text-transform` property.",requires:["text-field"]},"text-offset":{type:"array",doc:"Offset distance of text from its anchor. Positive values indicate right and down, while negative values indicate left and up.",value:"number",units:"ems","function":"interpolated",length:2,"default":[0,0],requires:["text-field"]},"text-allow-overlap":{type:"boolean","function":"piecewise-constant","default":!1,doc:"If true, the text will be visible even if it collides with other previously drawn symbols.",requires:["text-field"]},"text-ignore-placement":{type:"boolean","function":"piecewise-constant","default":!1,doc:"If true, other symbols can be visible even if they collide with the text.",requires:["text-field"]},"text-optional":{type:"boolean","function":"piecewise-constant","default":!1,doc:"If true, icons will display without their corresponding text when the text collides with other symbols and the icon does not.",requires:["text-field","icon-image"]},visibility:{type:"enum","function":"piecewise-constant",values:["visible","none"],"default":"visible",doc:"The display of this layer. `none` hides this layer."}},layout_raster:{visibility:{type:"enum","function":"piecewise-constant",values:["visible","none"],"default":"visible",doc:"The display of this layer. `none` hides this layer."}},filter:{type:"array",value:"*",doc:"A filter selects specific features from a layer."},filter_operator:{type:"enum",values:["==","!=",">",">=","<","<=","in","!in","all","any","none","has","!has"],doc:"The filter operator."},geometry_type:{type:"enum",values:["Point","LineString","Polygon"],doc:"The geometry type for the filter to select."},color_operation:{type:"enum",values:["lighten","saturate","spin","fade","mix"],doc:"A color operation to apply."},"function":{stops:{type:"array",required:!0,doc:"An array of stops.",value:"function_stop"},base:{type:"number","default":1,minimum:0,doc:"The exponential base of the interpolation curve. It controls the rate at which the result increases. Higher values make the result increase more towards the high end of the range. With `1` the stops are interpolated linearly."},property:{type:"string",doc:"The name of a global property or feature property to use as the function input.","default":"$zoom"},type:{type:"enum",values:["exponential","interval","categorical"],doc:"The interpolation strategy to use in function evaluation.","default":"exponential"}},function_stop:{type:"array",minimum:0,maximum:22,value:["number","color"],length:2,doc:"Zoom level and value pair."},paint:["paint_fill","paint_line","paint_circle","paint_symbol","paint_raster","paint_background"],paint_fill:{"fill-antialias":{type:"boolean","function":"piecewise-constant","default":!0,doc:"Whether or not the fill should be antialiased."},"fill-opacity":{type:"number","function":"interpolated","default":1,minimum:0,maximum:1,doc:"The opacity given to the fill color.",transition:!0},"fill-color":{type:"color","default":"#000000",doc:"The color of the fill.","function":"interpolated",transition:!0,requires:[{"!":"fill-pattern"}]},"fill-outline-color":{type:"color",doc:"The outline color of the fill. Matches the value of `fill-color` if unspecified.","function":"interpolated",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}]},"fill-translate":{type:"array",value:"number",length:2,"default":[0,0],"function":"interpolated",transition:!0,units:"pixels",doc:"The geometry's offset. Values are [x, y] where negatives indicate left and up, respectively."},"fill-translate-anchor":{type:"enum","function":"piecewise-constant",values:["map","viewport"],doc:"Control whether the translation is relative to the map (north) or viewport (screen)","default":"map",requires:["fill-translate"]},"fill-pattern":{type:"string","function":"piecewise-constant",transition:!0,doc:"Name of image in sprite to use for drawing image fills. For seamless patterns, image width and height must be a factor of two (2, 4, 8, ..., 512)."}},paint_line:{"line-opacity":{type:"number",doc:"The opacity at which the line will be drawn.","function":"interpolated","default":1,minimum:0,maximum:1,transition:!0},"line-color":{type:"color",doc:"The color with which the line will be drawn.","default":"#000000","function":"interpolated",transition:!0,requires:[{"!":"line-pattern"}]},"line-translate":{type:"array",value:"number",length:2,"default":[0,0],"function":"interpolated",transition:!0,units:"pixels",doc:"The geometry's offset. Values are [x, y] where negatives indicate left and up, respectively."},"line-translate-anchor":{type:"enum","function":"piecewise-constant",values:["map","viewport"],doc:"Control whether the translation is relative to the map (north) or viewport (screen)","default":"map",requires:["line-translate"]},"line-width":{type:"number","default":1,minimum:0,"function":"interpolated",transition:!0,units:"pixels",doc:"Stroke thickness."},"line-gap-width":{type:"number","default":0,minimum:0,doc:"Draws a line casing outside of a line's actual path. Value indicates the width of the inner gap.","function":"interpolated",transition:!0,units:"pixels"},"line-offset":{type:"number","default":0,doc:'The line\'s offset perpendicular to its direction. Values may be positive or negative, where positive indicates "rightwards" (if you were moving in the direction of the line) and negative indicates "leftwards."',"function":"interpolated",transition:!0,units:"pixels"},"line-blur":{type:"number","default":0,minimum:0,"function":"interpolated",transition:!0,units:"pixels",doc:"Blur applied to the line, in pixels."},"line-dasharray":{type:"array",value:"number","function":"piecewise-constant",doc:"Specifies the lengths of the alternating dashes and gaps that form the dash pattern. The lengths are later scaled by the line width. To convert a dash length to pixels, multiply the length by the current line width.",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}]},"line-pattern":{type:"string","function":"piecewise-constant",transition:!0,doc:"Name of image in sprite to use for drawing image lines. For seamless patterns, image width must be a factor of two (2, 4, 8, ..., 512)."}},paint_circle:{"circle-radius":{type:"number","default":5,minimum:0,"function":"interpolated",transition:!0,units:"pixels",doc:"Circle radius."},"circle-color":{type:"color","default":"#000000",doc:"The color of the circle.","function":"interpolated",transition:!0},"circle-blur":{type:"number","default":0,doc:"Amount to blur the circle. 1 blurs the circle such that only the centerpoint is full opacity.","function":"interpolated",transition:!0},"circle-opacity":{type:"number",doc:"The opacity at which the circle will be drawn.","default":1,minimum:0,maximum:1,"function":"interpolated",transition:!0},"circle-translate":{type:"array",value:"number",length:2,"default":[0,0],"function":"interpolated",transition:!0,units:"pixels",doc:"The geometry's offset. Values are [x, y] where negatives indicate left and up, respectively."},"circle-translate-anchor":{type:"enum","function":"piecewise-constant",values:["map","viewport"],doc:"Control whether the translation is relative to the map (north) or viewport (screen)","default":"map",requires:["circle-translate"]}},paint_symbol:{"icon-opacity":{doc:"The opacity at which the icon will be drawn.",type:"number","default":1,minimum:0,maximum:1,"function":"interpolated",transition:!0,requires:["icon-image"]},"icon-color":{type:"color","default":"#000000","function":"interpolated",transition:!0,doc:"The color of the icon. This can only be used with sdf icons.",requires:["icon-image"]},"icon-halo-color":{type:"color","default":"rgba(0, 0, 0, 0)","function":"interpolated",transition:!0,doc:"The color of the icon's halo. Icon halos can only be used with sdf icons.",requires:["icon-image"]},"icon-halo-width":{type:"number","default":0,minimum:0,"function":"interpolated",transition:!0,units:"pixels",doc:"Distance of halo to the icon outline.",requires:["icon-image"]},"icon-halo-blur":{type:"number","default":0,minimum:0,"function":"interpolated",transition:!0,units:"pixels",doc:"Fade out the halo towards the outside.",requires:["icon-image"]},"icon-translate":{type:"array",value:"number",length:2,"default":[0,0],"function":"interpolated",transition:!0,units:"pixels",doc:"Distance that the icon's anchor is moved from its original placement. Positive values indicate right and down, while negative values indicate left and up.",requires:["icon-image"]},"icon-translate-anchor":{type:"enum","function":"piecewise-constant",values:["map","viewport"],doc:"Control whether the translation is relative to the map (north) or viewport (screen).","default":"map",requires:["icon-image","icon-translate"]},"text-opacity":{type:"number",doc:"The opacity at which the text will be drawn.","default":1,minimum:0,maximum:1,"function":"interpolated",transition:!0,requires:["text-field"]},"text-color":{type:"color",doc:"The color with which the text will be drawn.","default":"#000000","function":"interpolated",transition:!0,requires:["text-field"]},"text-halo-color":{type:"color","default":"rgba(0, 0, 0, 0)","function":"interpolated",transition:!0,doc:"The color of the text's halo, which helps it stand out from backgrounds.",requires:["text-field"]},"text-halo-width":{type:"number","default":0,minimum:0,"function":"interpolated",transition:!0,units:"pixels",doc:"Distance of halo to the font outline. Max text halo width is 1/4 of the font-size.",requires:["text-field"]},"text-halo-blur":{type:"number","default":0,minimum:0,"function":"interpolated",transition:!0,units:"pixels",doc:"The halo's fadeout distance towards the outside.",requires:["text-field"]},"text-translate":{type:"array",value:"number",length:2,"default":[0,0],"function":"interpolated",transition:!0,units:"pixels",doc:"Distance that the text's anchor is moved from its original placement. Positive values indicate right and down, while negative values indicate left and up.",requires:["text-field"]},"text-translate-anchor":{type:"enum","function":"piecewise-constant",values:["map","viewport"],doc:"Control whether the translation is relative to the map (north) or viewport (screen).","default":"map",requires:["text-field","text-translate"]}},paint_raster:{"raster-opacity":{type:"number",doc:"The opacity at which the image will be drawn.","default":1,minimum:0,maximum:1,"function":"interpolated",transition:!0},"raster-hue-rotate":{type:"number","default":0,period:360,"function":"interpolated",transition:!0,units:"degrees",doc:"Rotates hues around the color wheel."},"raster-brightness-min":{type:"number","function":"interpolated",doc:"Increase or reduce the brightness of the image. The value is the minimum brightness.","default":0,minimum:0,maximum:1,transition:!0},"raster-brightness-max":{type:"number","function":"interpolated",doc:"Increase or reduce the brightness of the image. The value is the maximum brightness.","default":1,minimum:0,maximum:1,transition:!0},"raster-saturation":{type:"number",doc:"Increase or reduce the saturation of the image.","default":0,minimum:-1,maximum:1,"function":"interpolated",transition:!0},"raster-contrast":{type:"number",doc:"Increase or reduce the contrast of the image.","default":0,minimum:-1,maximum:1,"function":"interpolated",transition:!0},"raster-fade-duration":{type:"number","default":300,minimum:0,"function":"interpolated",transition:!0,units:"milliseconds",doc:"Fade duration when a new tile is added."}},paint_background:{"background-color":{type:"color","default":"#000000",doc:"The color with which the background will be drawn.","function":"interpolated",transition:!0,requires:[{"!":"background-pattern"}]},"background-pattern":{type:"string","function":"piecewise-constant",transition:!0,doc:"Name of image in sprite to use for drawing an image background. For seamless patterns, image width and height must be a factor of two (2, 4, 8, ..., 512)."},"background-opacity":{type:"number","default":1,minimum:0,maximum:1,doc:"The opacity at which the background will be drawn.","function":"interpolated",transition:!0}},transition:{duration:{type:"number","default":300,minimum:0,units:"milliseconds",doc:"Time allotted for transitions to complete."},delay:{type:"number","default":0,minimum:0,units:"milliseconds",doc:"Length of time before a transition begins."}}}},{}],400:[function(t,e,r){e.exports={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},zoom:{type:"number"},bearing:{type:"number","default":0,period:360,units:"degrees"},pitch:{type:"number","default":0,units:"degrees"},sources:{required:!0,type:"sources"},sprite:{type:"string"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_tile","source_geojson","source_video","source_image"],source_tile:{type:{required:!0,type:"enum",values:["vector","raster"]},url:{type:"string"},tiles:{type:"array",value:"string"},minzoom:{type:"number","default":0},maxzoom:{type:"number","default":22},tileSize:{type:"number","default":512,units:"pixels"},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:["geojson"]},data:{type:"*"},maxzoom:{type:"number","default":14},buffer:{type:"number","default":64},tolerance:{type:"number","default":3},cluster:{type:"boolean","default":!1},clusterRadius:{type:"number","default":400},clusterMaxZoom:{type:"number"}},source_video:{type:{required:!0,type:"enum",values:["video"]},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:["image"]},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:["fill","line","symbol","circle","raster","background"]},metadata:{type:"*"},ref:{type:"string"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:22},maxzoom:{type:"number",minimum:0,maximum:22},interactive:{type:"boolean","default":!1},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"},"paint.*":{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_symbol","layout_raster","layout_background"],layout_background:{visibility:{type:"enum","function":"piecewise-constant",values:["visible","none"],"default":"visible"}},layout_fill:{visibility:{type:"enum","function":"piecewise-constant",values:["visible","none"],"default":"visible"}},layout_circle:{visibility:{type:"enum","function":"piecewise-constant",values:["visible","none"],"default":"visible"}},layout_line:{"line-cap":{type:"enum","function":"piecewise-constant",values:["butt","round","square"],"default":"butt"},"line-join":{type:"enum","function":"piecewise-constant",values:["bevel","round","miter"],"default":"miter"},"line-miter-limit":{type:"number","default":2,"function":"interpolated",requires:[{"line-join":"miter"}]},"line-round-limit":{type:"number","default":1.05,"function":"interpolated",requires:[{"line-join":"round"}]},visibility:{type:"enum","function":"piecewise-constant",values:["visible","none"],"default":"visible"}},layout_symbol:{"symbol-placement":{type:"enum","function":"piecewise-constant",values:["point","line"],"default":"point"},"symbol-spacing":{type:"number","default":250,minimum:1,"function":"interpolated",units:"pixels",requires:[{"symbol-placement":"line"}]},"symbol-avoid-edges":{type:"boolean","function":"piecewise-constant","default":!1},"icon-allow-overlap":{type:"boolean","function":"piecewise-constant","default":!1,requires:["icon-image"]},"icon-ignore-placement":{type:"boolean","function":"piecewise-constant","default":!1,requires:["icon-image"]},"icon-optional":{type:"boolean","function":"piecewise-constant","default":!1,requires:["icon-image","text-field"]},"icon-rotation-alignment":{type:"enum","function":"piecewise-constant",values:["map","viewport"],"default":"viewport",requires:["icon-image"]},"icon-size":{type:"number","default":1,minimum:0,"function":"interpolated",requires:["icon-image"]},"icon-image":{type:"string","function":"piecewise-constant",tokens:!0},"icon-rotate":{type:"number","default":0,period:360,"function":"interpolated",units:"degrees",requires:["icon-image"]},"icon-padding":{type:"number","default":2,minimum:0,"function":"interpolated",units:"pixels",requires:["icon-image"]},"icon-keep-upright":{type:"boolean","function":"piecewise-constant","default":!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":"line"}]},"icon-offset":{type:"array",value:"number",length:2,"default":[0,0],"function":"interpolated",requires:["icon-image"]},"text-rotation-alignment":{type:"enum","function":"piecewise-constant",values:["map","viewport"],"default":"viewport",requires:["text-field"]},"text-field":{type:"string","function":"piecewise-constant","default":"",tokens:!0},"text-font":{type:"array",value:"string","function":"piecewise-constant","default":["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"]},"text-size":{type:"number","default":16,minimum:0,units:"pixels","function":"interpolated",requires:["text-field"]},"text-max-width":{type:"number","default":10,minimum:0,units:"em","function":"interpolated",requires:["text-field"]},"text-line-height":{type:"number","default":1.2,units:"em","function":"interpolated",requires:["text-field"]},"text-letter-spacing":{type:"number","default":0,units:"em","function":"interpolated",requires:["text-field"]},"text-justify":{type:"enum","function":"piecewise-constant",values:["left","center","right"],"default":"center",requires:["text-field"]},"text-anchor":{type:"enum","function":"piecewise-constant",values:["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"],"default":"center",requires:["text-field"]},"text-max-angle":{type:"number","default":45,units:"degrees","function":"interpolated",requires:["text-field",{"symbol-placement":"line"}]},"text-rotate":{type:"number","default":0,period:360,units:"degrees","function":"interpolated",requires:["text-field"]},"text-padding":{type:"number","default":2,minimum:0,units:"pixels","function":"interpolated",requires:["text-field"]},"text-keep-upright":{type:"boolean","function":"piecewise-constant","default":!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":"line"}]},"text-transform":{type:"enum","function":"piecewise-constant",values:["none","uppercase","lowercase"],"default":"none",requires:["text-field"]},"text-offset":{type:"array",value:"number",units:"ems","function":"interpolated",length:2,"default":[0,0],requires:["text-field"]},"text-allow-overlap":{type:"boolean","function":"piecewise-constant","default":!1,requires:["text-field"]},"text-ignore-placement":{type:"boolean","function":"piecewise-constant","default":!1,requires:["text-field"]},"text-optional":{type:"boolean","function":"piecewise-constant","default":!1,requires:["text-field","icon-image"]},visibility:{type:"enum","function":"piecewise-constant",values:["visible","none"],"default":"visible"}},layout_raster:{visibility:{type:"enum","function":"piecewise-constant",values:["visible","none"],"default":"visible"}},filter:{type:"array",value:"*"},filter_operator:{type:"enum",values:["==","!=",">",">=","<","<=","in","!in","all","any","none","has","!has"]},geometry_type:{type:"enum",values:["Point","LineString","Polygon"]},color_operation:{type:"enum",values:["lighten","saturate","spin","fade","mix"]},"function":{stops:{type:"array",required:!0,value:"function_stop"},base:{type:"number","default":1,minimum:0},property:{type:"string","default":"$zoom"},type:{type:"enum",values:["exponential","interval","categorical"],"default":"exponential"}},function_stop:{type:"array",minimum:0,maximum:22,value:["number","color"],length:2},paint:["paint_fill","paint_line","paint_circle","paint_symbol","paint_raster","paint_background"],paint_fill:{"fill-antialias":{type:"boolean","function":"piecewise-constant","default":!0},"fill-opacity":{type:"number","function":"interpolated","default":1,minimum:0,maximum:1,transition:!0},"fill-color":{type:"color","default":"#000000","function":"interpolated",transition:!0,requires:[{"!":"fill-pattern"}]},"fill-outline-color":{type:"color","function":"interpolated",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}]},"fill-translate":{type:"array",value:"number",length:2,"default":[0,0],"function":"interpolated",transition:!0,units:"pixels"},"fill-translate-anchor":{type:"enum","function":"piecewise-constant",values:["map","viewport"],"default":"map",requires:["fill-translate"]},"fill-pattern":{type:"string","function":"piecewise-constant",transition:!0}},paint_line:{"line-opacity":{type:"number","function":"interpolated","default":1,minimum:0,maximum:1,transition:!0},"line-color":{type:"color","default":"#000000","function":"interpolated",transition:!0,requires:[{"!":"line-pattern"}]},"line-translate":{type:"array",value:"number",length:2,"default":[0,0],"function":"interpolated",transition:!0,units:"pixels"},"line-translate-anchor":{type:"enum","function":"piecewise-constant",values:["map","viewport"],"default":"map",requires:["line-translate"]},"line-width":{type:"number","default":1,minimum:0,"function":"interpolated",transition:!0,units:"pixels"},"line-gap-width":{type:"number","default":0,minimum:0,"function":"interpolated",transition:!0,units:"pixels"},"line-offset":{type:"number","default":0,"function":"interpolated",transition:!0,units:"pixels"},"line-blur":{type:"number","default":0,minimum:0,"function":"interpolated",transition:!0,units:"pixels"},"line-dasharray":{type:"array",value:"number","function":"piecewise-constant",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}]},"line-pattern":{type:"string","function":"piecewise-constant",transition:!0}},paint_circle:{"circle-radius":{type:"number","default":5,minimum:0,"function":"interpolated",transition:!0,units:"pixels"},"circle-color":{type:"color","default":"#000000","function":"interpolated",transition:!0},"circle-blur":{type:"number","default":0,"function":"interpolated",transition:!0},"circle-opacity":{type:"number","default":1,minimum:0,maximum:1,"function":"interpolated",transition:!0},"circle-translate":{type:"array",value:"number",length:2,"default":[0,0],"function":"interpolated",transition:!0,units:"pixels"},"circle-translate-anchor":{type:"enum","function":"piecewise-constant",values:["map","viewport"],"default":"map",requires:["circle-translate"]}},paint_symbol:{"icon-opacity":{type:"number","default":1,minimum:0,maximum:1,"function":"interpolated",transition:!0,requires:["icon-image"]},"icon-color":{type:"color","default":"#000000","function":"interpolated",transition:!0,requires:["icon-image"]},"icon-halo-color":{type:"color","default":"rgba(0, 0, 0, 0)","function":"interpolated",transition:!0,requires:["icon-image"]},"icon-halo-width":{type:"number","default":0,minimum:0,"function":"interpolated",transition:!0,units:"pixels",requires:["icon-image"]},"icon-halo-blur":{type:"number","default":0,minimum:0,"function":"interpolated",transition:!0,units:"pixels",requires:["icon-image"]},"icon-translate":{type:"array",value:"number",length:2,"default":[0,0],"function":"interpolated",transition:!0,units:"pixels",requires:["icon-image"]},"icon-translate-anchor":{type:"enum","function":"piecewise-constant",values:["map","viewport"],"default":"map",requires:["icon-image","icon-translate"]},"text-opacity":{type:"number","default":1,minimum:0,maximum:1,"function":"interpolated",transition:!0,requires:["text-field"]},"text-color":{type:"color","default":"#000000","function":"interpolated",transition:!0,requires:["text-field"]},"text-halo-color":{type:"color","default":"rgba(0, 0, 0, 0)","function":"interpolated",transition:!0,requires:["text-field"]},"text-halo-width":{type:"number","default":0,minimum:0,"function":"interpolated",transition:!0,units:"pixels",requires:["text-field"]},"text-halo-blur":{type:"number","default":0,minimum:0,"function":"interpolated",transition:!0,units:"pixels",requires:["text-field"]},"text-translate":{type:"array",value:"number",length:2,"default":[0,0],"function":"interpolated",transition:!0,units:"pixels",requires:["text-field"]},"text-translate-anchor":{type:"enum","function":"piecewise-constant",values:["map","viewport"],"default":"map",requires:["text-field","text-translate"]}},paint_raster:{"raster-opacity":{type:"number","default":1,minimum:0,maximum:1,"function":"interpolated",transition:!0},"raster-hue-rotate":{type:"number","default":0,period:360,"function":"interpolated",transition:!0,units:"degrees"},"raster-brightness-min":{type:"number","function":"interpolated","default":0,minimum:0,maximum:1,transition:!0},"raster-brightness-max":{type:"number","function":"interpolated","default":1,minimum:0,maximum:1,transition:!0},"raster-saturation":{type:"number","default":0,minimum:-1,maximum:1,"function":"interpolated",
transition:!0},"raster-contrast":{type:"number","default":0,minimum:-1,maximum:1,"function":"interpolated",transition:!0},"raster-fade-duration":{type:"number","default":300,minimum:0,"function":"interpolated",transition:!0,units:"milliseconds"}},paint_background:{"background-color":{type:"color","default":"#000000","function":"interpolated",transition:!0,requires:[{"!":"background-pattern"}]},"background-pattern":{type:"string","function":"piecewise-constant",transition:!0},"background-opacity":{type:"number","default":1,minimum:0,maximum:1,"function":"interpolated",transition:!0}},transition:{duration:{type:"number","default":300,minimum:0,units:"milliseconds"},delay:{type:"number","default":0,minimum:0,units:"milliseconds"}}}},{}],401:[function(t,e,r){"use strict";function n(t){var e;t&&t.length&&(e=t,t=e.length);var r=new Uint8Array(t||0);return e&&r.set(e),r.readUInt32LE=o.readUInt32LE,r.writeUInt32LE=o.writeUInt32LE,r.readInt32LE=o.readInt32LE,r.writeInt32LE=o.writeInt32LE,r.readFloatLE=o.readFloatLE,r.writeFloatLE=o.writeFloatLE,r.readDoubleLE=o.readDoubleLE,r.writeDoubleLE=o.writeDoubleLE,r.toString=o.toString,r.write=o.write,r.slice=o.slice,r.copy=o.copy,r._isBuffer=!0,r}function i(t){for(var e,r,n=t.length,i=[],o=0;n>o;o++){if(e=t.charCodeAt(o),e>55295&&57344>e){if(!r){e>56319||o+1===n?i.push(239,191,189):r=e;continue}if(56320>e){i.push(239,191,189),r=e;continue}e=r-55296<<10|e-56320|65536,r=null}else r&&(i.push(239,191,189),r=null);128>e?i.push(e):2048>e?i.push(e>>6|192,63&e|128):65536>e?i.push(e>>12|224,e>>6&63|128,63&e|128):i.push(e>>18|240,e>>12&63|128,e>>6&63|128,63&e|128)}return i}e.exports=n;var o,a,s,l=t("ieee754");o={readUInt32LE:function(t){return(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},writeUInt32LE:function(t,e){this[e]=t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24},readInt32LE:function(t){return(this[t]|this[t+1]<<8|this[t+2]<<16)+(this[t+3]<<24)},readFloatLE:function(t){return l.read(this,t,!0,23,4)},readDoubleLE:function(t){return l.read(this,t,!0,52,8)},writeFloatLE:function(t,e){return l.write(this,t,e,!0,23,4)},writeDoubleLE:function(t,e){return l.write(this,t,e,!0,52,8)},toString:function(t,e,r){var n="",i="";e=e||0,r=Math.min(this.length,r||this.length);for(var o=e;r>o;o++){var a=this[o];127>=a?(n+=decodeURIComponent(i)+String.fromCharCode(a),i=""):i+="%"+a.toString(16)}return n+=decodeURIComponent(i)},write:function(t,e){for(var r=t===a?s:i(t),n=0;n<r.length;n++)this[e+n]=r[n]},slice:function(t,e){return this.subarray(t,e)},copy:function(t,e){e=e||0;for(var r=0;r<this.length;r++)t[e+r]=this[r]}},o.writeInt32LE=o.writeUInt32LE,n.byteLength=function(t){return a=t,s=i(t),s.length},n.isBuffer=function(t){return!(!t||!t._isBuffer)}},{ieee754:403}],402:[function(t,e,r){(function(r){"use strict";function n(t){this.buf=m.isBuffer(t)?t:new m(t||0),this.pos=0,this.length=this.buf.length}function i(t,e){var r,n=e.buf;if(r=n[e.pos++],t+=268435456*(127&r),128>r)return t;if(r=n[e.pos++],t+=34359738368*(127&r),128>r)return t;if(r=n[e.pos++],t+=4398046511104*(127&r),128>r)return t;if(r=n[e.pos++],t+=562949953421312*(127&r),128>r)return t;if(r=n[e.pos++],t+=72057594037927940*(127&r),128>r)return t;if(r=n[e.pos++],t+=0x8000000000000000*(127&r),128>r)return t;throw new Error("Expected varint not more than 10 bytes")}function o(t,e){e.realloc(10);for(var r=e.pos+10;t>=1;){if(e.pos>=r)throw new Error("Given varint doesn't fit into 10 bytes");var n=255&t;e.buf[e.pos++]=n|(t>=128?128:0),t/=128}}function a(t,e,r){var n=16383>=e?1:2097151>=e?2:268435455>=e?3:Math.ceil(Math.log(e)/(7*Math.LN2));r.realloc(n);for(var i=r.pos-1;i>=t;i--)r.buf[i+n]=r.buf[i]}function s(t,e){for(var r=0;r<t.length;r++)e.writeVarint(t[r])}function l(t,e){for(var r=0;r<t.length;r++)e.writeSVarint(t[r])}function u(t,e){for(var r=0;r<t.length;r++)e.writeFloat(t[r])}function c(t,e){for(var r=0;r<t.length;r++)e.writeDouble(t[r])}function h(t,e){for(var r=0;r<t.length;r++)e.writeBoolean(t[r])}function f(t,e){for(var r=0;r<t.length;r++)e.writeFixed32(t[r])}function d(t,e){for(var r=0;r<t.length;r++)e.writeSFixed32(t[r])}function p(t,e){for(var r=0;r<t.length;r++)e.writeFixed64(t[r])}function v(t,e){for(var r=0;r<t.length;r++)e.writeSFixed64(t[r])}e.exports=n;var m=r.Buffer||t("./buffer");n.Varint=0,n.Fixed64=1,n.Bytes=2,n.Fixed32=5;var g=4294967296,y=1/g,b=Math.pow(2,63);n.prototype={destroy:function(){this.buf=null},readFields:function(t,e,r){for(r=r||this.length;this.pos<r;){var n=this.readVarint(),i=n>>3,o=this.pos;t(i,e,this),this.pos===o&&this.skip(n)}return e},readMessage:function(t,e){return this.readFields(t,e,this.readVarint()+this.pos)},readFixed32:function(){var t=this.buf.readUInt32LE(this.pos);return this.pos+=4,t},readSFixed32:function(){var t=this.buf.readInt32LE(this.pos);return this.pos+=4,t},readFixed64:function(){var t=this.buf.readUInt32LE(this.pos)+this.buf.readUInt32LE(this.pos+4)*g;return this.pos+=8,t},readSFixed64:function(){var t=this.buf.readUInt32LE(this.pos)+this.buf.readInt32LE(this.pos+4)*g;return this.pos+=8,t},readFloat:function(){var t=this.buf.readFloatLE(this.pos);return this.pos+=4,t},readDouble:function(){var t=this.buf.readDoubleLE(this.pos);return this.pos+=8,t},readVarint:function(){var t,e,r=this.buf;return e=r[this.pos++],t=127&e,128>e?t:(e=r[this.pos++],t|=(127&e)<<7,128>e?t:(e=r[this.pos++],t|=(127&e)<<14,128>e?t:(e=r[this.pos++],t|=(127&e)<<21,128>e?t:i(t,this))))},readVarint64:function(){var t=this.pos,e=this.readVarint();if(b>e)return e;for(var r=this.pos-2;255===this.buf[r];)r--;t>r&&(r=t),e=0;for(var n=0;r-t+1>n;n++){var i=127&~this.buf[t+n];e+=4>n?i<<7*n:i*Math.pow(2,7*n)}return-e-1},readSVarint:function(){var t=this.readVarint();return t%2===1?(t+1)/-2:t/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var t=this.readVarint()+this.pos,e=this.buf.toString("utf8",this.pos,t);return this.pos=t,e},readBytes:function(){var t=this.readVarint()+this.pos,e=this.buf.slice(this.pos,t);return this.pos=t,e},readPackedVarint:function(){for(var t=this.readVarint()+this.pos,e=[];this.pos<t;)e.push(this.readVarint());return e},readPackedSVarint:function(){for(var t=this.readVarint()+this.pos,e=[];this.pos<t;)e.push(this.readSVarint());return e},readPackedBoolean:function(){for(var t=this.readVarint()+this.pos,e=[];this.pos<t;)e.push(this.readBoolean());return e},readPackedFloat:function(){for(var t=this.readVarint()+this.pos,e=[];this.pos<t;)e.push(this.readFloat());return e},readPackedDouble:function(){for(var t=this.readVarint()+this.pos,e=[];this.pos<t;)e.push(this.readDouble());return e},readPackedFixed32:function(){for(var t=this.readVarint()+this.pos,e=[];this.pos<t;)e.push(this.readFixed32());return e},readPackedSFixed32:function(){for(var t=this.readVarint()+this.pos,e=[];this.pos<t;)e.push(this.readSFixed32());return e},readPackedFixed64:function(){for(var t=this.readVarint()+this.pos,e=[];this.pos<t;)e.push(this.readFixed64());return e},readPackedSFixed64:function(){for(var t=this.readVarint()+this.pos,e=[];this.pos<t;)e.push(this.readSFixed64());return e},skip:function(t){var e=7&t;if(e===n.Varint)for(;this.buf[this.pos++]>127;);else if(e===n.Bytes)this.pos=this.readVarint()+this.pos;else if(e===n.Fixed32)this.pos+=4;else{if(e!==n.Fixed64)throw new Error("Unimplemented type: "+e);this.pos+=8}},writeTag:function(t,e){this.writeVarint(t<<3|e)},realloc:function(t){for(var e=this.length||16;e<this.pos+t;)e*=2;if(e!==this.length){var r=new m(e);this.buf.copy(r),this.buf=r,this.length=e}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.slice(0,this.length)},writeFixed32:function(t){this.realloc(4),this.buf.writeUInt32LE(t,this.pos),this.pos+=4},writeSFixed32:function(t){this.realloc(4),this.buf.writeInt32LE(t,this.pos),this.pos+=4},writeFixed64:function(t){this.realloc(8),this.buf.writeInt32LE(-1&t,this.pos),this.buf.writeUInt32LE(Math.floor(t*y),this.pos+4),this.pos+=8},writeSFixed64:function(t){this.realloc(8),this.buf.writeInt32LE(-1&t,this.pos),this.buf.writeInt32LE(Math.floor(t*y),this.pos+4),this.pos+=8},writeVarint:function(t){return t=+t,t>268435455?void o(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),void(127>=t||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),127>=t||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),127>=t||(this.buf[this.pos++]=t>>>7&127)))))},writeSVarint:function(t){this.writeVarint(0>t?2*-t-1:2*t)},writeBoolean:function(t){this.writeVarint(Boolean(t))},writeString:function(t){t=String(t);var e=m.byteLength(t);this.writeVarint(e),this.realloc(e),this.buf.write(t,this.pos),this.pos+=e},writeFloat:function(t){this.realloc(4),this.buf.writeFloatLE(t,this.pos),this.pos+=4},writeDouble:function(t){this.realloc(8),this.buf.writeDoubleLE(t,this.pos),this.pos+=8},writeBytes:function(t){var e=t.length;this.writeVarint(e),this.realloc(e);for(var r=0;e>r;r++)this.buf[this.pos++]=t[r]},writeRawMessage:function(t,e){this.pos++;var r=this.pos;t(e,this);var n=this.pos-r;n>=128&&a(r,n,this),this.pos=r-1,this.writeVarint(n),this.pos+=n},writeMessage:function(t,e,r){this.writeTag(t,n.Bytes),this.writeRawMessage(e,r)},writePackedVarint:function(t,e){this.writeMessage(t,s,e)},writePackedSVarint:function(t,e){this.writeMessage(t,l,e)},writePackedBoolean:function(t,e){this.writeMessage(t,h,e)},writePackedFloat:function(t,e){this.writeMessage(t,u,e)},writePackedDouble:function(t,e){this.writeMessage(t,c,e)},writePackedFixed32:function(t,e){this.writeMessage(t,f,e)},writePackedSFixed32:function(t,e){this.writeMessage(t,d,e)},writePackedFixed64:function(t,e){this.writeMessage(t,p,e)},writePackedSFixed64:function(t,e){this.writeMessage(t,v,e)},writeBytesField:function(t,e){this.writeTag(t,n.Bytes),this.writeBytes(e)},writeFixed32Field:function(t,e){this.writeTag(t,n.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(t,e){this.writeTag(t,n.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(t,e){this.writeTag(t,n.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(t,e){this.writeTag(t,n.Fixed64),this.writeSFixed64(e)},writeVarintField:function(t,e){this.writeTag(t,n.Varint),this.writeVarint(e)},writeSVarintField:function(t,e){this.writeTag(t,n.Varint),this.writeSVarint(e)},writeStringField:function(t,e){this.writeTag(t,n.Bytes),this.writeString(e)},writeFloatField:function(t,e){this.writeTag(t,n.Fixed32),this.writeFloat(e)},writeDoubleField:function(t,e){this.writeTag(t,n.Fixed64),this.writeDouble(e)},writeBooleanField:function(t,e){this.writeVarintField(t,Boolean(e))}}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./buffer":401}],403:[function(t,e,r){arguments[4][55][0].apply(r,arguments)},{dup:55}],404:[function(t,e,r){"use strict";function n(t,e){this.x=t,this.y=e}e.exports=n,n.prototype={clone:function(){return new n(this.x,this.y)},add:function(t){return this.clone()._add(t)},sub:function(t){return this.clone()._sub(t)},mult:function(t){return this.clone()._mult(t)},div:function(t){return this.clone()._div(t)},rotate:function(t){return this.clone()._rotate(t)},matMult:function(t){return this.clone()._matMult(t)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(t){return this.x===t.x&&this.y===t.y},dist:function(t){return Math.sqrt(this.distSqr(t))},distSqr:function(t){var e=t.x-this.x,r=t.y-this.y;return e*e+r*r},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith:function(t){return this.angleWithSep(t.x,t.y)},angleWithSep:function(t,e){return Math.atan2(this.x*e-this.y*t,this.x*t+this.y*e)},_matMult:function(t){var e=t[0]*this.x+t[1]*this.y,r=t[2]*this.x+t[3]*this.y;return this.x=e,this.y=r,this},_add:function(t){return this.x+=t.x,this.y+=t.y,this},_sub:function(t){return this.x-=t.x,this.y-=t.y,this},_mult:function(t){return this.x*=t,this.y*=t,this},_div:function(t){return this.x/=t,this.y/=t,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var t=this.y;return this.y=this.x,this.x=-t,this},_rotate:function(t){var e=Math.cos(t),r=Math.sin(t),n=e*this.x-r*this.y,i=r*this.x+e*this.y;return this.x=n,this.y=i,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},n.convert=function(t){return t instanceof n?t:Array.isArray(t)?new n(t[0],t[1]):t}},{}],405:[function(e,r,n){void function(e,i){"function"==typeof t&&t.amd?t(i):"object"==typeof n?r.exports=i():e.resolveUrl=i()}(this,function(){function t(){var t=arguments.length;if(0===t)throw new Error("resolveUrl requires at least one argument; got none.");var e=document.createElement("base");if(e.href=arguments[0],1===t)return e.href;var r=document.getElementsByTagName("head")[0];r.insertBefore(e,r.firstChild);for(var n,i=document.createElement("a"),o=1;t>o;o++)i.href=arguments[o],n=i.href,e.href=n;return r.removeChild(e),n}return t})},{}],406:[function(t,e,r){"use strict";function n(t,e,r){r=r||{},this.w=t||64,this.h=e||64,this.autoResize=!!r.autoResize,this.shelves=[],this.stats={},this.count=function(t){this.stats[t]=(0|this.stats[t])+1}}function i(t,e,r){this.x=0,this.y=t,this.w=this.free=e,this.h=r}e.exports=n,n.prototype.pack=function(t,e){t=[].concat(t),e=e||{};for(var r,n,i,o=[],a=0;a<t.length;a++)if(r=t[a].w||t[a].width,n=t[a].h||t[a].height,r&&n){if(i=this.packOne(r,n),!i)continue;e.inPlace&&(t[a].x=i.x,t[a].y=i.y),o.push(i)}return o},n.prototype.packOne=function(t,e){for(var r,n,o=0,a={shelf:-1,waste:1/0},s=0;s<this.shelves.length;s++){if(r=this.shelves[s],o+=r.h,e===r.h&&t<=r.free)return this.count(e),r.alloc(t,e);e>r.h||t>r.free||e<r.h&&t<=r.free&&(n=r.h-e,n<a.waste&&(a.waste=n,a.shelf=s))}if(-1!==a.shelf)return r=this.shelves[a.shelf],this.count(e),r.alloc(t,e);if(e<=this.h-o&&t<=this.w)return r=new i(o,this.w,e),this.shelves.push(r),this.count(e),r.alloc(t,e);if(this.autoResize){var l,u,c,h;return l=u=this.h,c=h=this.w,(l>=c||t>c)&&(h=2*Math.max(t,c)),(c>l||e>l)&&(u=2*Math.max(e,l)),this.resize(h,u),this.packOne(t,e)}return null},n.prototype.clear=function(){this.shelves=[],this.stats={}},n.prototype.resize=function(t,e){if(t<this.w||e<this.h)return!1;this.w=t,this.h=e;for(var r=0;r<this.shelves.length;r++)this.shelves[r].resize(t);return!0},i.prototype.alloc=function(t,e){if(t>this.free||e>this.h)return null;var r=this.x;return this.x+=t,this.free-=t,{x:r,y:this.y,w:t,h:e,width:t,height:e}},i.prototype.resize=function(t){return t<this.w?!1:(this.free+=t-this.w,this.w=t,!0)}},{}],407:[function(t,e,r){"use strict";function n(t){return new i(t)}function i(t){this.options=d(Object.create(this.options),t),this.trees=new Array(this.options.maxZoom+1)}function o(t,e,r,n){return{x:t,y:e,zoom:1/0,id:n,numPoints:r}}function a(t,e){var r=t.geometry.coordinates;return o(u(r[0]),c(r[1]),1,e)}function s(t){return{type:"Feature",properties:l(t),geometry:{type:"Point",coordinates:[h(t.x),f(t.y)]}}}function l(t){var e=t.numPoints,r=e>=1e4?Math.round(e/1e3)+"k":e>=1e3?Math.round(e/100)/10+"k":e;return{cluster:!0,point_count:e,point_count_abbreviated:r}}function u(t){return t/360+.5}function c(t){var e=Math.sin(t*Math.PI/180),r=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return 0>r?0:r>1?1:r}function h(t){return 360*(t-.5)}function f(t){var e=(180-360*t)*Math.PI/180;return 360*Math.atan(Math.exp(e))/Math.PI-90}function d(t,e){for(var r in e)t[r]=e[r];return t}function p(t){return t.x}function v(t){return t.y}var m=t("kdbush");e.exports=n,i.prototype={options:{minZoom:0,maxZoom:16,radius:40,extent:512,nodeSize:64,log:!1},load:function(t){var e=this.options.log;e&&console.time("total time");var r="prepare "+t.length+" points";e&&console.time(r),this.points=t;var n=t.map(a);e&&console.timeEnd(r);for(var i=this.options.maxZoom;i>=this.options.minZoom;i--){var o=+Date.now();this.trees[i+1]=m(n,p,v,this.options.nodeSize,Float32Array),n=this._cluster(n,i),e&&console.log("z%d: %d clusters in %dms",i,n.length,+Date.now()-o)}return this.trees[this.options.minZoom]=m(n,p,v,this.options.nodeSize,Float32Array),e&&console.timeEnd("total time"),this},getClusters:function(t,e){for(var r=this.trees[this._limitZoom(e)],n=r.range(u(t[0]),c(t[3]),u(t[2]),c(t[1])),i=[],o=0;o<n.length;o++){var a=r.points[n[o]];i.push(-1!==a.id?this.points[a.id]:s(a))}return i},getTile:function(t,e,r){var n=Math.pow(2,t),i=this.options.extent,o=this.options.radius/i,a=this.trees[this._limitZoom(t)],s=a.range((e-o)/n,(r-o)/n,(e+1+o)/n,(r+1+o)/n);if(!s.length)return null;for(var u={features:[]},c=0;c<s.length;c++){var h=a.points[s[c]],f={type:1,geometry:[[Math.round(i*(h.x*n-e)),Math.round(i*(h.y*n-r))]],tags:-1!==h.id?this.points[h.id].properties:l(h)};u.features.push(f)}return u},_limitZoom:function(t){return Math.max(this.options.minZoom,Math.min(t,this.options.maxZoom+1))},_cluster:function(t,e){for(var r=[],n=this.options.radius/(this.options.extent*Math.pow(2,e)),i=0;i<t.length;i++){var a=t[i];if(!(a.zoom<=e)){a.zoom=e;for(var s=this.trees[e+1],l=s.within(a.x,a.y,n),u=!1,c=a.numPoints,h=a.x*c,f=a.y*c,d=0;d<l.length;d++){var p=s.points[l[d]];e<p.zoom&&(u=!0,p.zoom=e,h+=p.x*p.numPoints,f+=p.y*p.numPoints,c+=p.numPoints)}r.push(u?o(h/c,f/c,c,-1):a)}}return r}}},{kdbush:408}],408:[function(t,e,r){"use strict";function n(t,e,r,n,o){return new i(t,e,r,n,o)}function i(t,e,r,n,i){e=e||o,r=r||a,i=i||Array,this.nodeSize=n||64,this.points=t,this.ids=new i(t.length),this.coords=new i(2*t.length);for(var l=0;l<t.length;l++)this.ids[l]=l,this.coords[2*l]=e(t[l]),this.coords[2*l+1]=r(t[l]);s(this.ids,this.coords,this.nodeSize,0,this.ids.length-1,0)}function o(t){return t[0]}function a(t){return t[1]}var s=t("./sort"),l=t("./range"),u=t("./within");e.exports=n,i.prototype={range:function(t,e,r,n){return l(this.ids,this.coords,t,e,r,n,this.nodeSize)},within:function(t,e,r){return u(this.ids,this.coords,t,e,r,this.nodeSize)}}},{"./range":409,"./sort":410,"./within":411}],409:[function(t,e,r){"use strict";function n(t,e,r,n,i,o,a){for(var s,l,u=[0,t.length-1,0],c=[];u.length;){var h=u.pop(),f=u.pop(),d=u.pop();if(a>=f-d)for(var p=d;f>=p;p++)s=e[2*p],l=e[2*p+1],s>=r&&i>=s&&l>=n&&o>=l&&c.push(t[p]);else{var v=Math.floor((d+f)/2);s=e[2*v],l=e[2*v+1],s>=r&&i>=s&&l>=n&&o>=l&&c.push(t[v]);var m=(h+1)%2;(0===h?s>=r:l>=n)&&(u.push(d),u.push(v-1),u.push(m)),(0===h?i>=s:o>=l)&&(u.push(v+1),u.push(f),u.push(m))}}return c}e.exports=n},{}],410:[function(t,e,r){"use strict";function n(t,e,r,o,a,s){if(!(r>=a-o)){var l=Math.floor((o+a)/2);i(t,e,l,o,a,s%2),n(t,e,r,o,l-1,s+1),n(t,e,r,l+1,a,s+1)}}function i(t,e,r,n,a,s){for(;a>n;){if(a-n>600){var l=a-n+1,u=r-n+1,c=Math.log(l),h=.5*Math.exp(2*c/3),f=.5*Math.sqrt(c*h*(l-h)/l)*(0>u-l/2?-1:1),d=Math.max(n,Math.floor(r-u*h/l+f)),p=Math.min(a,Math.floor(r+(l-u)*h/l+f));i(t,e,r,d,p,s)}var v=e[2*r+s],m=n,g=a;for(o(t,e,n,r),e[2*a+s]>v&&o(t,e,n,a);g>m;){for(o(t,e,m,g),m++,g--;e[2*m+s]<v;)m++;for(;e[2*g+s]>v;)g--}e[2*n+s]===v?o(t,e,n,g):(g++,o(t,e,g,a)),r>=g&&(n=g+1),g>=r&&(a=g-1)}}function o(t,e,r,n){a(t,r,n),a(e,2*r,2*n),a(e,2*r+1,2*n+1)}function a(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}e.exports=n},{}],411:[function(t,e,r){"use strict";function n(t,e,r,n,o,a){for(var s=[0,t.length-1,0],l=[],u=o*o;s.length;){var c=s.pop(),h=s.pop(),f=s.pop();if(a>=h-f)for(var d=f;h>=d;d++)i(e[2*d],e[2*d+1],r,n)<=u&&l.push(t[d]);else{var p=Math.floor((f+h)/2),v=e[2*p],m=e[2*p+1];i(v,m,r,n)<=u&&l.push(t[p]);var g=(c+1)%2;(0===c?v>=r-o:m>=n-o)&&(s.push(f),s.push(p-1),s.push(g)),(0===c?r+o>=v:n+o>=m)&&(s.push(p+1),s.push(h),s.push(g))}}return l}function i(t,e,r,n){var i=t-r,o=e-n;return i*i+o*o}e.exports=n},{}],412:[function(t,e,r){function n(t,e,r,n){this.cx=3*t,this.bx=3*(r-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(n-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=n,this.p2x=r,this.p2y=n}e.exports=n,n.prototype.sampleCurveX=function(t){return((this.ax*t+this.bx)*t+this.cx)*t},n.prototype.sampleCurveY=function(t){return((this.ay*t+this.by)*t+this.cy)*t},n.prototype.sampleCurveDerivativeX=function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},n.prototype.solveCurveX=function(t,e){"undefined"==typeof e&&(e=1e-6);var r,n,i,o,a;for(i=t,a=0;8>a;a++){if(o=this.sampleCurveX(i)-t,Math.abs(o)<e)return i;var s=this.sampleCurveDerivativeX(i);if(Math.abs(s)<1e-6)break;i-=o/s}if(r=0,n=1,i=t,r>i)return r;if(i>n)return n;for(;n>r;){if(o=this.sampleCurveX(i),Math.abs(o-t)<e)return i;t>o?r=i:n=i,i=.5*(n-r)+r}return i},n.prototype.solve=function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))}},{}],413:[function(t,e,r){e.exports.VectorTile=t("./lib/vectortile.js"),e.exports.VectorTileFeature=t("./lib/vectortilefeature.js"),e.exports.VectorTileLayer=t("./lib/vectortilelayer.js")},{"./lib/vectortile.js":414,"./lib/vectortilefeature.js":415,"./lib/vectortilelayer.js":416}],414:[function(t,e,r){"use strict";function n(t,e){this.layers=t.readFields(i,{},e)}function i(t,e,r){if(3===t){var n=new o(r,r.readVarint()+r.pos);n.length&&(e[n.name]=n)}}var o=t("./vectortilelayer");e.exports=n},{"./vectortilelayer":416}],415:[function(t,e,r){"use strict";function n(t,e,r,n,o){this.properties={},this.extent=r,this.type=0,this._pbf=t,this._geometry=-1,this._keys=n,this._values=o,t.readFields(i,this,e)}function i(t,e,r){1==t?e._id=r.readVarint():2==t?o(r,e):3==t?e.type=r.readVarint():4==t&&(e._geometry=r.pos)}function o(t,e){for(var r=t.readVarint()+t.pos;t.pos<r;){var n=e._keys[t.readVarint()],i=e._values[t.readVarint()];e.properties[n]=i}}function a(t){var e=t.length;if(1>=e)return[t];for(var r,n,i=[],o=0;e>o;o++){var a=s(t[o]);0!==a&&(void 0===n&&(n=0>a),n===0>a?(r&&i.push(r),r=[t[o]]):r.push(t[o]))}return r&&i.push(r),i}function s(t){for(var e,r,n=0,i=0,o=t.length,a=o-1;o>i;a=i++)e=t[i],r=t[a],n+=(r.x-e.x)*(e.y+r.y);return n}var l=t("point-geometry");e.exports=n,n.types=["Unknown","Point","LineString","Polygon"],n.prototype.loadGeometry=function(){var t=this._pbf;t.pos=this._geometry;for(var e,r=t.readVarint()+t.pos,n=1,i=0,o=0,a=0,s=[];t.pos<r;){if(!i){var u=t.readVarint();n=7&u,i=u>>3}if(i--,1===n||2===n)o+=t.readSVarint(),a+=t.readSVarint(),1===n&&(e&&s.push(e),e=[]),e.push(new l(o,a));else{if(7!==n)throw new Error("unknown command "+n);e&&e.push(e[0].clone())}}return e&&s.push(e),s},n.prototype.bbox=function(){var t=this._pbf;t.pos=this._geometry;for(var e=t.readVarint()+t.pos,r=1,n=0,i=0,o=0,a=1/0,s=-(1/0),l=1/0,u=-(1/0);t.pos<e;){if(!n){var c=t.readVarint();r=7&c,n=c>>3}if(n--,1===r||2===r)i+=t.readSVarint(),o+=t.readSVarint(),a>i&&(a=i),i>s&&(s=i),l>o&&(l=o),o>u&&(u=o);else if(7!==r)throw new Error("unknown command "+r)}return[a,l,s,u]},n.prototype.toGeoJSON=function(t,e,r){function i(t){for(var e=0;e<t.length;e++){var r=t[e],n=180-360*(r.y+c)/l;t[e]=[360*(r.x+u)/l-180,360/Math.PI*Math.atan(Math.exp(n*Math.PI/180))-90]}}var o,s,l=this.extent*Math.pow(2,r),u=this.extent*t,c=this.extent*e,h=this.loadGeometry(),f=n.types[this.type];switch(this.type){case 1:var d=[];for(o=0;o<h.length;o++)d[o]=h[o][0];h=d,i(h);break;case 2:for(o=0;o<h.length;o++)i(h[o]);break;case 3:for(h=a(h),o=0;o<h.length;o++)for(s=0;s<h[o].length;s++)i(h[o][s])}1===h.length?h=h[0]:f="Multi"+f;var p={type:"Feature",geometry:{type:f,coordinates:h},properties:this.properties};return"_id"in this&&(p.id=this._id),p}},{"point-geometry":404}],416:[function(t,e,r){"use strict";function n(t,e){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=t,this._keys=[],this._values=[],this._features=[],t.readFields(i,this,e),this.length=this._features.length}function i(t,e,r){15===t?e.version=r.readVarint():1===t?e.name=r.readString():5===t?e.extent=r.readVarint():2===t?e._features.push(r.pos):3===t?e._keys.push(r.readString()):4===t&&e._values.push(o(r))}function o(t){for(var e=null,r=t.readVarint()+t.pos;t.pos<r;){var n=t.readVarint()>>3;e=1===n?t.readString():2===n?t.readFloat():3===n?t.readDouble():4===n?t.readVarint64():5===n?t.readVarint():6===n?t.readSVarint():7===n?t.readBoolean():null}return e}var a=t("./vectortilefeature.js");e.exports=n,n.prototype.feature=function(t){if(0>t||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];var e=this._pbf.readVarint()+this._pbf.pos;return new a(this._pbf,e,this.extent,this._keys,this._values)}},{"./vectortilefeature.js":415}],417:[function(t,e,r){function n(t){var e=[];for(var r in t.layers)e.push(o(t.layers[r]));var n=new c;return h.tile.write({layers:e},n),n.finish()}function i(t){var e={};for(var r in t)e[r]=new f(t[r].features),e[r].name=r;return n({layers:e})}function o(t){for(var e={name:t.name||"",version:t.version||1,extent:t.extent||4096,keys:[],values:[],features:[]},r={},n={},i=0;i<t.length;i++){var o=t.feature(i);o.geometry=l(o.loadGeometry());var a=[];for(var s in o.properties){var c=r[s];"undefined"==typeof c&&(e.keys.push(s),c=e.keys.length-1,r[s]=c);var h=u(o.properties[s]),f=n[h.key];"undefined"==typeof f&&(e.values.push(h),f=e.values.length-1,n[h.key]=f),a.push(c),a.push(f)}o.tags=a,e.features.push(o)}return e}function a(t,e){return(e<<3)+(7&t)}function s(t){return t<<1^t>>31}function l(t){for(var e=[],r=0,n=0,i=t.length,o=0;i>o;o++){var l=t[o];e.push(a(1,1));for(var u=0;u<l.length;u++){1===u&&e.push(a(2,l.length-1));var c=l[u].x-r,h=l[u].y-n;e.push(s(c),s(h)),r+=c,n+=h}}return e}function u(t){var e,r=typeof t;return e="string"===r?{string_value:t}:"boolean"===r?{bool_value:t}:"number"===r?t!==(0|t)?{float_value:t}:0>t?{sint_value:t}:{uint_value:t}:{string_value:""+t},e.key=r+":"+t,e}var c=t("pbf"),h=t("./vector-tile-pb"),f=t("./lib/geojson_wrapper");e.exports=n,e.exports.fromVectorTileJs=n,e.exports.fromGeojsonVt=i,e.exports.GeoJSONWrapper=f},{"./lib/geojson_wrapper":418,"./vector-tile-pb":419,pbf:402}],418:[function(t,e,r){"use strict";function n(t){this.features=t,this.length=t.length}function i(t){this.type=t.type,this.rawGeometry=1===t.type?[t.geometry]:t.geometry,this.properties=t.tags,this.extent=4096}var o=t("point-geometry"),a=t("vector-tile").VectorTileFeature;e.exports=n,n.prototype.feature=function(t){return new i(this.features[t])},i.prototype.loadGeometry=function(){var t=this.rawGeometry;this.geometry=[];for(var e=0;e<t.length;e++){for(var r=t[e],n=[],i=0;i<r.length;i++)n.push(new o(r[i][0],r[i][1]));this.geometry.push(n)}return this.geometry},i.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var t=this.geometry,e=1/0,r=-(1/0),n=1/0,i=-(1/0),o=0;o<t.length;o++)for(var a=t[o],s=0;s<a.length;s++){var l=a[s];e=Math.min(e,l.x),r=Math.max(r,l.x),n=Math.min(n,l.y),i=Math.max(i,l.y)}return[e,n,r,i]},i.prototype.toGeoJSON=a.prototype.toGeoJSON},{"point-geometry":404,"vector-tile":413}],419:[function(t,e,r){"use strict";function n(t,e){return t.readFields(i,{layers:[]},e)}function i(t,e,r){3===t&&e.layers.push(f(r,r.readVarint()+r.pos))}function o(t,e){var r;if(void 0!==t.layers)for(r=0;r<t.layers.length;r++)e.writeMessage(3,p,t.layers[r])}function a(t,e){return t.readFields(s,{},e)}function s(t,e,r){1===t?e.string_value=r.readString():2===t?e.float_value=r.readFloat():3===t?e.double_value=r.readDouble():4===t?e.int_value=r.readVarint():5===t?e.uint_value=r.readVarint():6===t?e.sint_value=r.readSVarint():7===t&&(e.bool_value=r.readBoolean())}function l(t,e){void 0!==t.string_value&&e.writeStringField(1,t.string_value),void 0!==t.float_value&&e.writeFloatField(2,t.float_value),void 0!==t.double_value&&e.writeDoubleField(3,t.double_value),void 0!==t.int_value&&e.writeVarintField(4,t.int_value),void 0!==t.uint_value&&e.writeVarintField(5,t.uint_value),void 0!==t.sint_value&&e.writeSVarintField(6,t.sint_value),void 0!==t.bool_value&&e.writeBooleanField(7,t.bool_value)}function u(t,e){var r=t.readFields(c,{},e);return void 0===r.type&&(r.type="Unknown"),r}function c(t,e,r){1===t?e.id=r.readVarint():2===t?e.tags=r.readPackedVarint():3===t?e.type=r.readVarint():4===t&&(e.geometry=r.readPackedVarint())}function h(t,e){void 0!==t.id&&e.writeVarintField(1,t.id),void 0!==t.tags&&e.writePackedVarint(2,t.tags),void 0!==t.type&&e.writeVarintField(3,t.type),void 0!==t.geometry&&e.writePackedVarint(4,t.geometry)}function f(t,e){return t.readFields(d,{features:[],keys:[],values:[]},e)}function d(t,e,r){15===t?e.version=r.readVarint():1===t?e.name=r.readString():2===t?e.features.push(u(r,r.readVarint()+r.pos)):3===t?e.keys.push(r.readString()):4===t?e.values.push(a(r,r.readVarint()+r.pos)):5===t&&(e.extent=r.readVarint())}function p(t,e){void 0!==t.version&&e.writeVarintField(15,t.version),void 0!==t.name&&e.writeStringField(1,t.name);var r;if(void 0!==t.features)for(r=0;r<t.features.length;r++)e.writeMessage(2,h,t.features[r]);if(void 0!==t.keys)for(r=0;r<t.keys.length;r++)e.writeStringField(3,t.keys[r]);if(void 0!==t.values)for(r=0;r<t.values.length;r++)e.writeMessage(4,l,t.values[r]);void 0!==t.extent&&e.writeVarintField(5,t.extent)}var v=r.tile={read:n,write:o};v.GeomType={Unknown:0,Point:1,LineString:2,Polygon:3},v.value={read:a,write:l},v.feature={read:u,write:h},v.layer={read:f,write:p}},{}],420:[function(t,e,r){var n=arguments[3],i=arguments[4],o=arguments[5],a=JSON.stringify;e.exports=function(t,e){for(var r,s=Object.keys(o),l=0,u=s.length;u>l;l++){var c=s[l],h=o[c].exports;if(h===t||h&&h.default===t){r=c;break}}if(!r){r=Math.floor(Math.pow(16,8)*Math.random()).toString(16);for(var f={},l=0,u=s.length;u>l;l++){var c=s[l];f[c]=c}i[r]=[Function(["require","module","exports"],"("+t+")(self)"),f]}var d=Math.floor(Math.pow(16,8)*Math.random()).toString(16),p={};p[r]=r,i[d]=[Function(["require"],"var f = require("+a(r)+");(f.default ? f.default : f)(self);"),p];var v="("+n+")({"+Object.keys(i).map(function(t){return a(t)+":["+i[t][0]+","+a(i[t][1])+"]"}).join(",")+"},{},["+a(d)+"])",m=window.URL||window.webkitURL||window.mozURL||window.msURL,g=new Blob([v],{type:"text/javascript"});if(e&&e.bare)return g;var y=m.createObjectURL(g),b=new Worker(y);return"function"==typeof m.revokeObjectURL&&m.revokeObjectURL(y),b}},{}],421:[function(t,e,r){"use strict";function n(t,e){function r(t){var e=!1;return"altKey"in t&&(e=e||t.altKey!==v.alt,v.alt=!!t.altKey),"shiftKey"in t&&(e=e||t.shiftKey!==v.shift,v.shift=!!t.shiftKey),"ctrlKey"in t&&(e=e||t.ctrlKey!==v.control,v.control=!!t.ctrlKey),"metaKey"in t&&(e=e||t.metaKey!==v.meta,v.meta=!!t.metaKey),e}function n(t,n){var o=i.x(n),a=i.y(n);"buttons"in n&&(t=0|n.buttons),(t!==f||o!==d||a!==p||r(n))&&(f=0|t,d=o||0,p=a||0,e(f,d,p,v))}function o(t){n(0,t)}function a(){(f||d||p||v.shift||v.alt||v.meta||v.control)&&(d=p=0,f=0,v.shift=v.alt=v.control=v.meta=!1,e(0,0,0,v))}function s(t){r(t)&&e(f,d,p,v)}function l(t){0===i.buttons(t)?n(0,t):n(f,t)}function u(t){n(f|i.buttons(t),t)}function c(t){n(f&~i.buttons(t),t)}function h(){m||(m=!0,t.addEventListener("mousemove",l),t.addEventListener("mousedown",u),t.addEventListener("mouseup",c),t.addEventListener("mouseleave",o),t.addEventListener("mouseenter",o),t.addEventListener("mouseout",o),t.addEventListener("mouseover",o),t.addEventListener("blur",a),t.addEventListener("keyup",s),t.addEventListener("keydown",s),t.addEventListener("keypress",s),t!==window&&(window.addEventListener("blur",a),window.addEventListener("keyup",s),window.addEventListener("keydown",s),window.addEventListener("keypress",s)))}e||(e=t,t=window);var f=0,d=0,p=0,v={shift:!1,alt:!1,control:!1,meta:!1},m=!1;h();var g={element:t};return Object.defineProperties(g,{enabled:{get:function(){return m},set:function(t){t&&h()},enumerable:!0},buttons:{get:function(){return f},enumerable:!0},x:{get:function(){return d},enumerable:!0},y:{get:function(){return p},enumerable:!0},mods:{get:function(){return v},enumerable:!0}}),g}e.exports=n;var i=t("mouse-event")},{"mouse-event":422}],422:[function(t,e,r){"use strict";function n(t){if("object"==typeof t){if("buttons"in t)return t.buttons;if("which"in t){var e=t.which;if(2===e)return 4;if(3===e)return 2;if(e>0)return 1<<e-1}else if("button"in t){var e=t.button;if(1===e)return 4;if(2===e)return 2;if(e>=0)return 1<<e}}return 0;
}function i(t){return t.target||t.srcElement||window}function o(t){if("object"==typeof t){if("offsetX"in t)return t.offsetX;var e=i(t),r=e.getBoundingClientRect();return t.clientX-r.left}return 0}function a(t){if("object"==typeof t){if("offsetY"in t)return t.offsetY;var e=i(t),r=e.getBoundingClientRect();return t.clientY-r.top}return 0}r.buttons=n,r.element=i,r.x=o,r.y=a},{}],423:[function(t,e,r){e.exports=function(t,e){e||(e=[0,""]),t=String(t);var r=parseFloat(t,10);return e[0]=r,e[1]=t.match(/[\d.\-\+]*\s*(.*)/)[1]||"",e}},{}],424:[function(t,e,r){"use strict";function n(t,e){var r=a(getComputedStyle(t).getPropertyValue(e));return r[0]*o(r[1],t)}function i(t,e){var r=document.createElement("div");r.style["font-size"]="128"+t,e.appendChild(r);var i=n(r,"font-size")/128;return e.removeChild(r),i}function o(t,e){switch(e=e||document.body,t=(t||"px").trim().toLowerCase(),e!==window&&e!==document||(e=document.body),t){case"%":return e.clientHeight/100;case"ch":case"ex":return i(t,e);case"em":return n(e,"font-size");case"rem":return n(document.body,"font-size");case"vw":return window.innerWidth/100;case"vh":return window.innerHeight/100;case"vmin":return Math.min(window.innerWidth,window.innerHeight)/100;case"vmax":return Math.max(window.innerWidth,window.innerHeight)/100;case"in":return s;case"cm":return s/2.54;case"mm":return s/25.4;case"pt":return s/72;case"pc":return s/6}return 1}var a=t("parse-unit");e.exports=o;var s=96},{"parse-unit":423}],425:[function(t,e,r){"use strict";function n(t,e,r){"function"==typeof t&&(r=!!e,e=t,t=window);var n=i("ex",t),o=function(t){r&&t.preventDefault();var i=t.deltaX||0,o=t.deltaY||0,a=t.deltaZ||0,s=t.deltaMode,l=1;switch(s){case 1:l=n;break;case 2:l=window.innerHeight}return i*=l,o*=l,a*=l,i||o||a?e(i,o,a):void 0};return t.addEventListener("wheel",o),o}var i=t("to-px");e.exports=n},{"to-px":424}],426:[function(t,e,r){"use strict";var n=t("cwise/lib/wrapper")({args:["index","array","scalar"],pre:{body:"{}",args:[],thisVars:[],localVars:[]},body:{body:"{_inline_1_arg1_=_inline_1_arg2_.apply(void 0,_inline_1_arg0_)}",args:[{name:"_inline_1_arg0_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_1_arg1_",lvalue:!0,rvalue:!1,count:1},{name:"_inline_1_arg2_",lvalue:!1,rvalue:!0,count:1}],thisVars:[],localVars:[]},post:{body:"{}",args:[],thisVars:[],localVars:[]},debug:!1,funcName:"cwise",blockSize:64});e.exports=function(t,e){return n(t,e),t}},{"cwise/lib/wrapper":118}],427:[function(t,e,r){"use strict";function n(t,e){switch(e.length){case 0:break;case 1:t[0]=1/e[0];break;case 4:i(t,e);break;case 9:o(t,e);break;case 16:a(t,e);break;default:throw new Error("currently supports matrices up to 4x4")}return t}e.exports=n;var i=t("gl-mat2/invert"),o=t("gl-mat3/invert"),a=t("gl-mat4/invert")},{"gl-mat2/invert":428,"gl-mat3/invert":136,"gl-mat4/invert":143}],428:[function(t,e,r){function n(t,e){var r=e[0],n=e[1],i=e[2],o=e[3],a=r*o-i*n;return a?(a=1/a,t[0]=o*a,t[1]=-n*a,t[2]=-i*a,t[3]=r*a,t):null}e.exports=n},{}],429:[function(t,e,r){"use strict";function n(t,e){var r=Math.floor(e),n=e-r,i=r>=0&&r<t.shape[0],o=r+1>=0&&r+1<t.shape[0],a=i?+t.get(r):0,s=o?+t.get(r+1):0;return(1-n)*a+n*s}function i(t,e,r){var n=Math.floor(e),i=e-n,o=n>=0&&n<t.shape[0],a=n+1>=0&&n+1<t.shape[0],s=Math.floor(r),l=r-s,u=s>=0&&s<t.shape[1],c=s+1>=0&&s+1<t.shape[1],h=o&&u?t.get(n,s):0,f=o&&c?t.get(n,s+1):0,d=a&&u?t.get(n+1,s):0,p=a&&c?t.get(n+1,s+1):0;return(1-l)*((1-i)*h+i*d)+l*((1-i)*f+i*p)}function o(t,e,r,n){var i=Math.floor(e),o=e-i,a=i>=0&&i<t.shape[0],s=i+1>=0&&i+1<t.shape[0],l=Math.floor(r),u=r-l,c=l>=0&&l<t.shape[1],h=l+1>=0&&l+1<t.shape[1],f=Math.floor(n),d=n-f,p=f>=0&&f<t.shape[2],v=f+1>=0&&f+1<t.shape[2],m=a&&c&&p?t.get(i,l,f):0,g=a&&h&&p?t.get(i,l+1,f):0,y=s&&c&&p?t.get(i+1,l,f):0,b=s&&h&&p?t.get(i+1,l+1,f):0,x=a&&c&&v?t.get(i,l,f+1):0,_=a&&h&&v?t.get(i,l+1,f+1):0,w=s&&c&&v?t.get(i+1,l,f+1):0,M=s&&h&&v?t.get(i+1,l+1,f+1):0;return(1-d)*((1-u)*((1-o)*m+o*y)+u*((1-o)*g+o*b))+d*((1-u)*((1-o)*x+o*w)+u*((1-o)*_+o*M))}function a(t){var e,r,n=0|t.shape.length,i=new Array(n),o=new Array(n),a=new Array(n),s=new Array(n);for(e=0;n>e;++e)r=+arguments[e+1],i[e]=Math.floor(r),o[e]=r-i[e],a[e]=0<=i[e]&&i[e]<t.shape[e],s[e]=0<=i[e]+1&&i[e]+1<t.shape[e];var l,u,c,h=0;t:for(e=0;1<<n>e;++e){for(u=1,c=t.offset,l=0;n>l;++l)if(e&1<<l){if(!s[l])continue t;u*=o[l],c+=t.stride[l]*(i[l]+1)}else{if(!a[l])continue t;u*=1-o[l],c+=t.stride[l]*i[l]}h+=u*t.data[c]}return h}function s(t,e,r,s){switch(t.shape.length){case 0:return 0;case 1:return n(t,e);case 2:return i(t,e,r);case 3:return o(t,e,r,s);default:return a.apply(void 0,arguments)}}e.exports=s,e.exports.d1=n,e.exports.d2=i,e.exports.d3=o},{}],430:[function(t,e,r){"use strict";var n=t("ndarray-linear-interpolate"),i=t("cwise/lib/wrapper")({args:["index","array","scalar","scalar","scalar"],pre:{body:"{this_warped=new Array(_inline_9_arg4_)}",args:[{name:"_inline_9_arg0_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_9_arg1_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_9_arg2_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_9_arg3_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_9_arg4_",lvalue:!1,rvalue:!0,count:1}],thisVars:["this_warped"],localVars:[]},body:{body:"{_inline_10_arg2_(this_warped,_inline_10_arg0_),_inline_10_arg1_=_inline_10_arg3_.apply(void 0,this_warped)}",args:[{name:"_inline_10_arg0_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_10_arg1_",lvalue:!0,rvalue:!1,count:1},{name:"_inline_10_arg2_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_10_arg3_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_10_arg4_",lvalue:!1,rvalue:!1,count:0}],thisVars:["this_warped"],localVars:[]},post:{body:"{}",args:[],thisVars:[],localVars:[]},debug:!1,funcName:"warpND",blockSize:64}),o=t("cwise/lib/wrapper")({args:["index","array","scalar","scalar","scalar"],pre:{body:"{this_warped=[0]}",args:[],thisVars:["this_warped"],localVars:[]},body:{body:"{_inline_13_arg2_(this_warped,_inline_13_arg0_),_inline_13_arg1_=_inline_13_arg3_(_inline_13_arg4_,this_warped[0])}",args:[{name:"_inline_13_arg0_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_13_arg1_",lvalue:!0,rvalue:!1,count:1},{name:"_inline_13_arg2_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_13_arg3_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_13_arg4_",lvalue:!1,rvalue:!0,count:1}],thisVars:["this_warped"],localVars:[]},post:{body:"{}",args:[],thisVars:[],localVars:[]},debug:!1,funcName:"warp1D",blockSize:64}),a=t("cwise/lib/wrapper")({args:["index","array","scalar","scalar","scalar"],pre:{body:"{this_warped=[0,0]}",args:[],thisVars:["this_warped"],localVars:[]},body:{body:"{_inline_16_arg2_(this_warped,_inline_16_arg0_),_inline_16_arg1_=_inline_16_arg3_(_inline_16_arg4_,this_warped[0],this_warped[1])}",args:[{name:"_inline_16_arg0_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_16_arg1_",lvalue:!0,rvalue:!1,count:1},{name:"_inline_16_arg2_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_16_arg3_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_16_arg4_",lvalue:!1,rvalue:!0,count:1}],thisVars:["this_warped"],localVars:[]},post:{body:"{}",args:[],thisVars:[],localVars:[]},debug:!1,funcName:"warp2D",blockSize:64}),s=t("cwise/lib/wrapper")({args:["index","array","scalar","scalar","scalar"],pre:{body:"{this_warped=[0,0,0]}",args:[],thisVars:["this_warped"],localVars:[]},body:{body:"{_inline_19_arg2_(this_warped,_inline_19_arg0_),_inline_19_arg1_=_inline_19_arg3_(_inline_19_arg4_,this_warped[0],this_warped[1],this_warped[2])}",args:[{name:"_inline_19_arg0_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_19_arg1_",lvalue:!0,rvalue:!1,count:1},{name:"_inline_19_arg2_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_19_arg3_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_19_arg4_",lvalue:!1,rvalue:!0,count:1}],thisVars:["this_warped"],localVars:[]},post:{body:"{}",args:[],thisVars:[],localVars:[]},debug:!1,funcName:"warp3D",blockSize:64});e.exports=function(t,e,r){switch(e.shape.length){case 1:o(t,r,n.d1,e);break;case 2:a(t,r,n.d2,e);break;case 3:s(t,r,n.d3,e);break;default:i(t,r,n.bind(void 0,e),e.shape.length)}return t}},{"cwise/lib/wrapper":118,"ndarray-linear-interpolate":429}],431:[function(t,e,r){"use strict";function n(t,e,r){var n=e.dimension,a=o([],r);return i(t,e,function(t,e){for(var r=0;n>r;++r){t[r]=a[(n+1)*n+r];for(var i=0;n>i;++i)t[r]+=a[(n+1)*i+r]*e[i]}for(var o=a[(n+1)*(n+1)-1],i=0;n>i;++i)o+=a[(n+1)*i+n]*e[i];for(var s=1/o,r=0;n>r;++r)t[r]*=s;return t}),t}var i=t("ndarray-warp"),o=t("gl-matrix-invert");e.exports=n},{"gl-matrix-invert":427,"ndarray-warp":430}],432:[function(t,e,r){"use strict";function n(t){if(!t)return s;for(var e=0;e<t.args.length;++e){var r=t.args[e];0===e?t.args[e]={name:r,lvalue:!0,rvalue:!!t.rvalue,count:t.count||1}:t.args[e]={name:r,lvalue:!1,rvalue:!0,count:1}}return t.thisVars||(t.thisVars=[]),t.localVars||(t.localVars=[]),t}function i(t){return a({args:t.args,pre:n(t.pre),body:n(t.body),post:n(t.proc),funcName:t.funcName})}function o(t){for(var e=[],r=0;r<t.args.length;++r)e.push("a"+r);var n=new Function("P",["return function ",t.funcName,"_ndarrayops(",e.join(","),") {P(",e.join(","),");return a0}"].join(""));return n(i(t))}var a=t("cwise-compiler"),s={body:"",args:[],thisVars:[],localVars:[]},l={add:"+",sub:"-",mul:"*",div:"/",mod:"%",band:"&",bor:"|",bxor:"^",lshift:"<<",rshift:">>",rrshift:">>>"};!function(){for(var t in l){var e=l[t];r[t]=o({args:["array","array","array"],body:{args:["a","b","c"],body:"a=b"+e+"c"},funcName:t}),r[t+"eq"]=o({args:["array","array"],body:{args:["a","b"],body:"a"+e+"=b"},rvalue:!0,funcName:t+"eq"}),r[t+"s"]=o({args:["array","array","scalar"],body:{args:["a","b","s"],body:"a=b"+e+"s"},funcName:t+"s"}),r[t+"seq"]=o({args:["array","scalar"],body:{args:["a","s"],body:"a"+e+"=s"},rvalue:!0,funcName:t+"seq"})}}();var u={not:"!",bnot:"~",neg:"-",recip:"1.0/"};!function(){for(var t in u){var e=u[t];r[t]=o({args:["array","array"],body:{args:["a","b"],body:"a="+e+"b"},funcName:t}),r[t+"eq"]=o({args:["array"],body:{args:["a"],body:"a="+e+"a"},rvalue:!0,count:2,funcName:t+"eq"})}}();var c={and:"&&",or:"||",eq:"===",neq:"!==",lt:"<",gt:">",leq:"<=",geq:">="};!function(){for(var t in c){var e=c[t];r[t]=o({args:["array","array","array"],body:{args:["a","b","c"],body:"a=b"+e+"c"},funcName:t}),r[t+"s"]=o({args:["array","array","scalar"],body:{args:["a","b","s"],body:"a=b"+e+"s"},funcName:t+"s"}),r[t+"eq"]=o({args:["array","array"],body:{args:["a","b"],body:"a=a"+e+"b"},rvalue:!0,count:2,funcName:t+"eq"}),r[t+"seq"]=o({args:["array","scalar"],body:{args:["a","s"],body:"a=a"+e+"s"},rvalue:!0,count:2,funcName:t+"seq"})}}();var h=["abs","acos","asin","atan","ceil","cos","exp","floor","log","round","sin","sqrt","tan"];!function(){for(var t=0;t<h.length;++t){var e=h[t];r[e]=o({args:["array","array"],pre:{args:[],body:"this_f=Math."+e,thisVars:["this_f"]},body:{args:["a","b"],body:"a=this_f(b)",thisVars:["this_f"]},funcName:e}),r[e+"eq"]=o({args:["array"],pre:{args:[],body:"this_f=Math."+e,thisVars:["this_f"]},body:{args:["a"],body:"a=this_f(a)",thisVars:["this_f"]},rvalue:!0,count:2,funcName:e+"eq"})}}();var f=["max","min","atan2","pow"];!function(){for(var t=0;t<f.length;++t){var e=f[t];r[e]=o({args:["array","array","array"],pre:{args:[],body:"this_f=Math."+e,thisVars:["this_f"]},body:{args:["a","b","c"],body:"a=this_f(b,c)",thisVars:["this_f"]},funcName:e}),r[e+"s"]=o({args:["array","array","scalar"],pre:{args:[],body:"this_f=Math."+e,thisVars:["this_f"]},body:{args:["a","b","c"],body:"a=this_f(b,c)",thisVars:["this_f"]},funcName:e+"s"}),r[e+"eq"]=o({args:["array","array"],pre:{args:[],body:"this_f=Math."+e,thisVars:["this_f"]},body:{args:["a","b"],body:"a=this_f(a,b)",thisVars:["this_f"]},rvalue:!0,count:2,funcName:e+"eq"}),r[e+"seq"]=o({args:["array","scalar"],pre:{args:[],body:"this_f=Math."+e,thisVars:["this_f"]},body:{args:["a","b"],body:"a=this_f(a,b)",thisVars:["this_f"]},rvalue:!0,count:2,funcName:e+"seq"})}}();var d=["atan2","pow"];!function(){for(var t=0;t<d.length;++t){var e=d[t];r[e+"op"]=o({args:["array","array","array"],pre:{args:[],body:"this_f=Math."+e,thisVars:["this_f"]},body:{args:["a","b","c"],body:"a=this_f(c,b)",thisVars:["this_f"]},funcName:e+"op"}),r[e+"ops"]=o({args:["array","array","scalar"],pre:{args:[],body:"this_f=Math."+e,thisVars:["this_f"]},body:{args:["a","b","c"],body:"a=this_f(c,b)",thisVars:["this_f"]},funcName:e+"ops"}),r[e+"opeq"]=o({args:["array","array"],pre:{args:[],body:"this_f=Math."+e,thisVars:["this_f"]},body:{args:["a","b"],body:"a=this_f(b,a)",thisVars:["this_f"]},rvalue:!0,count:2,funcName:e+"opeq"}),r[e+"opseq"]=o({args:["array","scalar"],pre:{args:[],body:"this_f=Math."+e,thisVars:["this_f"]},body:{args:["a","b"],body:"a=this_f(b,a)",thisVars:["this_f"]},rvalue:!0,count:2,funcName:e+"opseq"})}}(),r.any=a({args:["array"],pre:s,body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:1}],body:"if(a){return true}",localVars:[],thisVars:[]},post:{args:[],localVars:[],thisVars:[],body:"return false"},funcName:"any"}),r.all=a({args:["array"],pre:s,body:{args:[{name:"x",lvalue:!1,rvalue:!0,count:1}],body:"if(!x){return false}",localVars:[],thisVars:[]},post:{args:[],localVars:[],thisVars:[],body:"return true"},funcName:"all"}),r.sum=a({args:["array"],pre:{args:[],localVars:[],thisVars:["this_s"],body:"this_s=0"},body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:1}],body:"this_s+=a",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"sum"}),r.prod=a({args:["array"],pre:{args:[],localVars:[],thisVars:["this_s"],body:"this_s=1"},body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:1}],body:"this_s*=a",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"prod"}),r.norm2squared=a({args:["array"],pre:{args:[],localVars:[],thisVars:["this_s"],body:"this_s=0"},body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:2}],body:"this_s+=a*a",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"norm2squared"}),r.norm2=a({args:["array"],pre:{args:[],localVars:[],thisVars:["this_s"],body:"this_s=0"},body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:2}],body:"this_s+=a*a",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return Math.sqrt(this_s)"},funcName:"norm2"}),r.norminf=a({args:["array"],pre:{args:[],localVars:[],thisVars:["this_s"],body:"this_s=0"},body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:4}],body:"if(-a>this_s){this_s=-a}else if(a>this_s){this_s=a}",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"norminf"}),r.norm1=a({args:["array"],pre:{args:[],localVars:[],thisVars:["this_s"],body:"this_s=0"},body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:3}],body:"this_s+=a<0?-a:a",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"norm1"}),r.sup=a({args:["array"],pre:{body:"this_h=-Infinity",args:[],thisVars:["this_h"],localVars:[]},body:{body:"if(_inline_1_arg0_>this_h)this_h=_inline_1_arg0_",args:[{name:"_inline_1_arg0_",lvalue:!1,rvalue:!0,count:2}],thisVars:["this_h"],localVars:[]},post:{body:"return this_h",args:[],thisVars:["this_h"],localVars:[]}}),r.inf=a({args:["array"],pre:{body:"this_h=Infinity",args:[],thisVars:["this_h"],localVars:[]},body:{body:"if(_inline_1_arg0_<this_h)this_h=_inline_1_arg0_",args:[{name:"_inline_1_arg0_",lvalue:!1,rvalue:!0,count:2}],thisVars:["this_h"],localVars:[]},post:{body:"return this_h",args:[],thisVars:["this_h"],localVars:[]}}),r.argmin=a({args:["index","array","shape"],pre:{body:"{this_v=Infinity;this_i=_inline_0_arg2_.slice(0)}",args:[{name:"_inline_0_arg0_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_0_arg1_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_0_arg2_",lvalue:!1,rvalue:!0,count:1}],thisVars:["this_i","this_v"],localVars:[]},body:{body:"{if(_inline_1_arg1_<this_v){this_v=_inline_1_arg1_;for(var _inline_1_k=0;_inline_1_k<_inline_1_arg0_.length;++_inline_1_k){this_i[_inline_1_k]=_inline_1_arg0_[_inline_1_k]}}}",args:[{name:"_inline_1_arg0_",lvalue:!1,rvalue:!0,count:2},{name:"_inline_1_arg1_",lvalue:!1,rvalue:!0,count:2}],thisVars:["this_i","this_v"],localVars:["_inline_1_k"]},post:{body:"{return this_i}",args:[],thisVars:["this_i"],localVars:[]}}),r.argmax=a({args:["index","array","shape"],pre:{body:"{this_v=-Infinity;this_i=_inline_0_arg2_.slice(0)}",args:[{name:"_inline_0_arg0_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_0_arg1_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_0_arg2_",lvalue:!1,rvalue:!0,count:1}],thisVars:["this_i","this_v"],localVars:[]},body:{body:"{if(_inline_1_arg1_>this_v){this_v=_inline_1_arg1_;for(var _inline_1_k=0;_inline_1_k<_inline_1_arg0_.length;++_inline_1_k){this_i[_inline_1_k]=_inline_1_arg0_[_inline_1_k]}}}",args:[{name:"_inline_1_arg0_",lvalue:!1,rvalue:!0,count:2},{name:"_inline_1_arg1_",lvalue:!1,rvalue:!0,count:2}],thisVars:["this_i","this_v"],localVars:["_inline_1_k"]},post:{body:"{return this_i}",args:[],thisVars:["this_i"],localVars:[]}}),r.random=o({args:["array"],pre:{args:[],body:"this_f=Math.random",thisVars:["this_f"]},body:{args:["a"],body:"a=this_f()",thisVars:["this_f"]},funcName:"random"}),r.assign=o({args:["array","array"],body:{args:["a","b"],body:"a=b"},funcName:"assign"}),r.assigns=o({args:["array","scalar"],body:{args:["a","b"],body:"a=b"},funcName:"assigns"}),r.equals=a({args:["array","array"],pre:s,body:{args:[{name:"x",lvalue:!1,rvalue:!0,count:1},{name:"y",lvalue:!1,rvalue:!0,count:1}],body:"if(x!==y){return false}",localVars:[],thisVars:[]},post:{args:[],localVars:[],thisVars:[],body:"return true"},funcName:"equals"})},{"cwise-compiler":115}],433:[function(t,e,r){function n(t,e){return t[0]-e[0]}function i(){var t,e=this.stride,r=new Array(e.length);for(t=0;t<r.length;++t)r[t]=[Math.abs(e[t]),t];r.sort(n);var i=new Array(r.length);for(t=0;t<i.length;++t)i[t]=r[t][1];return i}function o(t,e){var r=["View",e,"d",t].join("");0>e&&(r="View_Nil"+t);var n="generic"===t;if(-1===e){var o="function "+r+"(a){this.data=a;};var proto="+r+".prototype;proto.dtype='"+t+"';proto.index=function(){return -1};proto.size=0;proto.dimension=-1;proto.shape=proto.stride=proto.order=[];proto.lo=proto.hi=proto.transpose=proto.step=function(){return new "+r+"(this.data);};proto.get=proto.set=function(){};proto.pick=function(){return null};return function construct_"+r+"(a){return new "+r+"(a);}",a=new Function(o);return a()}if(0===e){var o="function "+r+"(a,d) {this.data = a;this.offset = d};var proto="+r+".prototype;proto.dtype='"+t+"';proto.index=function(){return this.offset};proto.dimension=0;proto.size=1;proto.shape=proto.stride=proto.order=[];proto.lo=proto.hi=proto.transpose=proto.step=function "+r+"_copy() {return new "+r+"(this.data,this.offset)};proto.pick=function "+r+"_pick(){return TrivialArray(this.data);};proto.valueOf=proto.get=function "+r+"_get(){return "+(n?"this.data.get(this.offset)":"this.data[this.offset]")+"};proto.set=function "+r+"_set(v){return "+(n?"this.data.set(this.offset,v)":"this.data[this.offset]=v")+"};return function construct_"+r+"(a,b,c,d){return new "+r+"(a,d)}",a=new Function("TrivialArray",o);return a(h[t][0])}var o=["'use strict'"],s=l(e),u=s.map(function(t){return"i"+t}),c="this.offset+"+s.map(function(t){return"this.stride["+t+"]*i"+t}).join("+"),f=s.map(function(t){return"b"+t}).join(","),d=s.map(function(t){return"c"+t}).join(",");o.push("function "+r+"(a,"+f+","+d+",d){this.data=a","this.shape=["+f+"]","this.stride=["+d+"]","this.offset=d|0}","var proto="+r+".prototype","proto.dtype='"+t+"'","proto.dimension="+e),o.push("Object.defineProperty(proto,'size',{get:function "+r+"_size(){return "+s.map(function(t){return"this.shape["+t+"]"}).join("*"),"}})"),1===e?o.push("proto.order=[0]"):(o.push("Object.defineProperty(proto,'order',{get:"),4>e?(o.push("function "+r+"_order(){"),2===e?o.push("return (Math.abs(this.stride[0])>Math.abs(this.stride[1]))?[1,0]:[0,1]}})"):3===e&&o.push("var s0=Math.abs(this.stride[0]),s1=Math.abs(this.stride[1]),s2=Math.abs(this.stride[2]);if(s0>s1){if(s1>s2){return [2,1,0];}else if(s0>s2){return [1,2,0];}else{return [1,0,2];}}else if(s0>s2){return [2,0,1];}else if(s2>s1){return [0,1,2];}else{return [0,2,1];}}})")):o.push("ORDER})")),o.push("proto.set=function "+r+"_set("+u.join(",")+",v){"),n?o.push("return this.data.set("+c+",v)}"):o.push("return this.data["+c+"]=v}"),o.push("proto.get=function "+r+"_get("+u.join(",")+"){"),n?o.push("return this.data.get("+c+")}"):o.push("return this.data["+c+"]}"),o.push("proto.index=function "+r+"_index(",u.join(),"){return "+c+"}"),o.push("proto.hi=function "+r+"_hi("+u.join(",")+"){return new "+r+"(this.data,"+s.map(function(t){return["(typeof i",t,"!=='number'||i",t,"<0)?this.shape[",t,"]:i",t,"|0"].join("")}).join(",")+","+s.map(function(t){return"this.stride["+t+"]"}).join(",")+",this.offset)}");var p=s.map(function(t){return"a"+t+"=this.shape["+t+"]"}),v=s.map(function(t){return"c"+t+"=this.stride["+t+"]"});o.push("proto.lo=function "+r+"_lo("+u.join(",")+"){var b=this.offset,d=0,"+p.join(",")+","+v.join(","));for(var m=0;e>m;++m)o.push("if(typeof i"+m+"==='number'&&i"+m+">=0){d=i"+m+"|0;b+=c"+m+"*d;a"+m+"-=d}");o.push("return new "+r+"(this.data,"+s.map(function(t){return"a"+t}).join(",")+","+s.map(function(t){return"c"+t}).join(",")+",b)}"),o.push("proto.step=function "+r+"_step("+u.join(",")+"){var "+s.map(function(t){return"a"+t+"=this.shape["+t+"]"}).join(",")+","+s.map(function(t){return"b"+t+"=this.stride["+t+"]"}).join(",")+",c=this.offset,d=0,ceil=Math.ceil");for(var m=0;e>m;++m)o.push("if(typeof i"+m+"==='number'){d=i"+m+"|0;if(d<0){c+=b"+m+"*(a"+m+"-1);a"+m+"=ceil(-a"+m+"/d)}else{a"+m+"=ceil(a"+m+"/d)}b"+m+"*=d}");o.push("return new "+r+"(this.data,"+s.map(function(t){return"a"+t}).join(",")+","+s.map(function(t){return"b"+t}).join(",")+",c)}");for(var g=new Array(e),y=new Array(e),m=0;e>m;++m)g[m]="a[i"+m+"]",y[m]="b[i"+m+"]";o.push("proto.transpose=function "+r+"_transpose("+u+"){"+u.map(function(t,e){return t+"=("+t+"===undefined?"+e+":"+t+"|0)"}).join(";"),"var a=this.shape,b=this.stride;return new "+r+"(this.data,"+g.join(",")+","+y.join(",")+",this.offset)}"),o.push("proto.pick=function "+r+"_pick("+u+"){var a=[],b=[],c=this.offset");for(var m=0;e>m;++m)o.push("if(typeof i"+m+"==='number'&&i"+m+">=0){c=(c+this.stride["+m+"]*i"+m+")|0}else{a.push(this.shape["+m+"]);b.push(this.stride["+m+"])}");o.push("var ctor=CTOR_LIST[a.length+1];return ctor(this.data,a,b,c)}"),o.push("return function construct_"+r+"(data,shape,stride,offset){return new "+r+"(data,"+s.map(function(t){return"shape["+t+"]"}).join(",")+","+s.map(function(t){return"stride["+t+"]"}).join(",")+",offset)}");var a=new Function("CTOR_LIST","ORDER",o.join("\n"));return a(h[t],i)}function a(t){if(u(t))return"buffer";if(c)switch(Object.prototype.toString.call(t)){case"[object Float64Array]":return"float64";case"[object Float32Array]":return"float32";case"[object Int8Array]":return"int8";case"[object Int16Array]":return"int16";case"[object Int32Array]":return"int32";case"[object Uint8Array]":return"uint8";case"[object Uint16Array]":return"uint16";case"[object Uint32Array]":return"uint32";case"[object Uint8ClampedArray]":return"uint8_clamped"}return Array.isArray(t)?"array":"generic"}function s(t,e,r,n){if(void 0===t){var i=h.array[0];return i([])}"number"==typeof t&&(t=[t]),void 0===e&&(e=[t.length]);var s=e.length;if(void 0===r){r=new Array(s);for(var l=s-1,u=1;l>=0;--l)r[l]=u,u*=e[l]}if(void 0===n){n=0;for(var l=0;s>l;++l)r[l]<0&&(n-=(e[l]-1)*r[l])}for(var c=a(t),f=h[c];f.length<=s+1;)f.push(o(c,f.length-1));var i=f[s+1];return i(t,e,r,n)}var l=t("iota-array"),u=t("is-buffer"),c="undefined"!=typeof Float64Array,h={float32:[],float64:[],int8:[],int16:[],int32:[],uint8:[],uint16:[],uint32:[],array:[],uint8_clamped:[],buffer:[],generic:[]};e.exports=s},{"iota-array":245,"is-buffer":246}],434:[function(t,e,r){"use strict";function n(t,e){if("string"!=typeof t)throw new TypeError("repeat-string expects a string.");if(1===e)return t;if(2===e)return t+t;var r=t.length*e;for(i===t&&"undefined"!=typeof i||(i=t,o="");r>o.length&&e>0&&(1&e&&(o+=t),e>>=1);)t+=t;return o.substr(0,r)}var i,o="";e.exports=n},{}],435:[function(t,e,r){(function(t){e.exports=t.performance&&t.performance.now?function(){return performance.now()}:Date.now||function(){return+new Date}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],436:[function(t,e,r){"use strict";function n(t){for(var e="robustLinearSolve"+t+"d",r=["function ",e,"(A,b){return ["],n=0;t>n;++n){r.push("det([");for(var i=0;t>i;++i){i>0&&r.push(","),r.push("[");for(var o=0;t>o;++o)o>0&&r.push(","),o===n?r.push("+b[",i,"]"):r.push("+A[",i,"][",o,"]");r.push("]")}r.push("]),")}r.push("det(A)]}return ",e);var a=new Function("det",r.join(""));return a(6>t?s[t]:s)}function i(){return[0]}function o(t,e){return[[e[0]],[t[0][0]]]}function a(){for(;u.length<l;)u.push(n(u.length));for(var t=[],r=["function dispatchLinearSolve(A,b){switch(A.length){"],i=0;l>i;++i)t.push("s"+i),r.push("case ",i,":return s",i,"(A,b);");r.push("}var s=CACHE[A.length];if(!s)s=CACHE[A.length]=g(A.length);return s(A,b)}return dispatchLinearSolve"),t.push("CACHE","g",r.join(""));var o=Function.apply(void 0,t);e.exports=o.apply(void 0,u.concat([u,n]));for(var i=0;l>i;++i)e.exports[i]=u[i]}var s=t("robust-determinant"),l=6,u=[i,o];a()},{"robust-determinant":438}],437:[function(t,e,r){"use strict";function n(t){for(var e=t.length,r=t[t.length-1],n=e,i=e-2;i>=0;--i){var o=r,a=t[i];r=o+a;var s=r-o,l=a-s;l&&(t[--n]=r,r=l)}for(var u=0,i=n;e>i;++i){var o=t[i],a=r;r=o+a;var s=r-o,l=a-s;l&&(t[u++]=l)}return t[u++]=r,t.length=u,t}e.exports=n},{}],438:[function(t,e,r){"use strict";function n(t,e){for(var r=new Array(t.length-1),n=1;n<t.length;++n)for(var i=r[n-1]=new Array(t.length-1),o=0,a=0;o<t.length;++o)o!==e&&(i[a++]=t[n][o]);return r}function i(t){for(var e=new Array(t),r=0;t>r;++r){e[r]=new Array(t);for(var n=0;t>n;++n)e[r][n]=["m[",r,"][",n,"]"].join("")}return e}function o(t){return 1&t?"-":""}function a(t){if(1===t.length)return t[0];if(2===t.length)return["sum(",t[0],",",t[1],")"].join("");var e=t.length>>1;return["sum(",a(t.slice(0,e)),",",a(t.slice(e)),")"].join("")}function s(t){if(2===t.length)return["sum(prod(",t[0][0],",",t[1][1],"),prod(-",t[0][1],",",t[1][0],"))"].join("");for(var e=[],r=0;r<t.length;++r)e.push(["scale(",s(n(t,r)),",",o(r),t[0][r],")"].join(""));return a(e)}function l(t){var e=new Function("sum","scale","prod","compress",["function robustDeterminant",t,"(m){return compress(",s(i(t)),")};return robustDeterminant",t].join(""));return e(h,f,c,d)}function u(){for(;v.length<p;)v.push(l(v.length));for(var t=[],r=["function robustDeterminant(m){switch(m.length){"],n=0;p>n;++n)t.push("det"+n),r.push("case ",n,":return det",n,"(m);");r.push("}var det=CACHE[m.length];if(!det)det=CACHE[m.length]=gen(m.length);return det(m);}return robustDeterminant"),t.push("CACHE","gen",r.join(""));var i=Function.apply(void 0,t);e.exports=i.apply(void 0,v.concat([v,l]));for(var n=0;n<v.length;++n)e.exports[n]=v[n]}var c=t("two-product"),h=t("robust-sum"),f=t("robust-scale"),d=t("robust-compress"),p=6,v=[function(){return[0]},function(t){return[t[0][0]]}];u()},{"robust-compress":437,"robust-scale":440,"robust-sum":442,"two-product":456}],439:[function(t,e,r){"use strict";function n(t,e){for(var r=new Array(t.length-1),n=1;n<t.length;++n)for(var i=r[n-1]=new Array(t.length-1),o=0,a=0;o<t.length;++o)o!==e&&(i[a++]=t[n][o]);return r}function i(t){for(var e=new Array(t),r=0;t>r;++r){e[r]=new Array(t);for(var n=0;t>n;++n)e[r][n]=["m",n,"[",t-r-1,"]"].join("")}return e}function o(t){return 1&t?"-":""}function a(t){if(1===t.length)return t[0];if(2===t.length)return["sum(",t[0],",",t[1],")"].join("");var e=t.length>>1;return["sum(",a(t.slice(0,e)),",",a(t.slice(e)),")"].join("")}function s(t){if(2===t.length)return[["sum(prod(",t[0][0],",",t[1][1],"),prod(-",t[0][1],",",t[1][0],"))"].join("")];for(var e=[],r=0;r<t.length;++r)e.push(["scale(",a(s(n(t,r))),",",o(r),t[0][r],")"].join(""));return e}function l(t){for(var e=[],r=[],o=i(t),l=[],u=0;t>u;++u)0===(1&u)?e.push.apply(e,s(n(o,u))):r.push.apply(r,s(n(o,u))),l.push("m"+u);var c=a(e),v=a(r),m="orientation"+t+"Exact",g=["function ",m,"(",l.join(),"){var p=",c,",n=",v,",d=sub(p,n);return d[d.length-1];};return ",m].join(""),y=new Function("sum","prod","scale","sub",g);return y(f,h,d,p)}function u(t){var e=_[t.length];return e||(e=_[t.length]=l(t.length)),e.apply(void 0,t)}function c(){for(;_.length<=v;)_.push(l(_.length));for(var t=[],r=["slow"],n=0;v>=n;++n)t.push("a"+n),r.push("o"+n);for(var i=["function getOrientation(",t.join(),"){switch(arguments.length){case 0:case 1:return 0;"],n=2;v>=n;++n)i.push("case ",n,":return o",n,"(",t.slice(0,n).join(),");");i.push("}var s=new Array(arguments.length);for(var i=0;i<arguments.length;++i){s[i]=arguments[i]};return slow(s);}return getOrientation"),r.push(i.join(""));var o=Function.apply(void 0,r);e.exports=o.apply(void 0,[u].concat(_));for(var n=0;v>=n;++n)e.exports[n]=_[n]}var h=t("two-product"),f=t("robust-sum"),d=t("robust-scale"),p=t("robust-subtract"),v=5,m=1.1102230246251565e-16,g=(3+16*m)*m,y=(7+56*m)*m,b=l(3),x=l(4),_=[function(){return 0},function(){return 0},function(t,e){return e[0]-t[0]},function(t,e,r){var n,i=(t[1]-r[1])*(e[0]-r[0]),o=(t[0]-r[0])*(e[1]-r[1]),a=i-o;if(i>0){if(0>=o)return a;n=i+o}else{if(!(0>i))return a;if(o>=0)return a;n=-(i+o)}var s=g*n;return a>=s||-s>=a?a:b(t,e,r)},function(t,e,r,n){var i=t[0]-n[0],o=e[0]-n[0],a=r[0]-n[0],s=t[1]-n[1],l=e[1]-n[1],u=r[1]-n[1],c=t[2]-n[2],h=e[2]-n[2],f=r[2]-n[2],d=o*u,p=a*l,v=a*s,m=i*u,g=i*l,b=o*s,_=c*(d-p)+h*(v-m)+f*(g-b),w=(Math.abs(d)+Math.abs(p))*Math.abs(c)+(Math.abs(v)+Math.abs(m))*Math.abs(h)+(Math.abs(g)+Math.abs(b))*Math.abs(f),M=y*w;return _>M||-_>M?_:x(t,e,r,n)}];c()},{"robust-scale":440,"robust-subtract":441,"robust-sum":442,"two-product":456}],440:[function(t,e,r){"use strict";function n(t,e){var r=t.length;if(1===r){var n=i(t[0],e);return n[0]?n:[n[1]]}var a=new Array(2*r),s=[.1,.1],l=[.1,.1],u=0;i(t[0],e,s),s[0]&&(a[u++]=s[0]);for(var c=1;r>c;++c){i(t[c],e,l);var h=s[1];o(h,l[0],s),s[0]&&(a[u++]=s[0]);var f=l[1],d=s[1],p=f+d,v=p-f,m=d-v;s[1]=p,m&&(a[u++]=m)}return s[1]&&(a[u++]=s[1]),0===u&&(a[u++]=0),a.length=u,a}var i=t("two-product"),o=t("two-sum");e.exports=n},{"two-product":456,"two-sum":457}],441:[function(t,e,r){"use strict";function n(t,e){var r=t+e,n=r-t,i=r-n,o=e-n,a=t-i,s=a+o;return s?[s,r]:[r]}function i(t,e){var r=0|t.length,i=0|e.length;if(1===r&&1===i)return n(t[0],-e[0]);var o,a,s=r+i,l=new Array(s),u=0,c=0,h=0,f=Math.abs,d=t[c],p=f(d),v=-e[h],m=f(v);m>p?(a=d,c+=1,r>c&&(d=t[c],p=f(d))):(a=v,h+=1,i>h&&(v=-e[h],m=f(v))),r>c&&m>p||h>=i?(o=d,c+=1,r>c&&(d=t[c],p=f(d))):(o=v,h+=1,i>h&&(v=-e[h],m=f(v)));for(var g,y,b,x,_,w=o+a,M=w-o,k=a-M,A=k,T=w;r>c&&i>h;)m>p?(o=d,c+=1,r>c&&(d=t[c],p=f(d))):(o=v,h+=1,i>h&&(v=-e[h],m=f(v))),a=A,w=o+a,M=w-o,k=a-M,k&&(l[u++]=k),g=T+w,y=g-T,b=g-y,x=w-y,_=T-b,A=_+x,T=g;for(;r>c;)o=d,a=A,w=o+a,M=w-o,k=a-M,k&&(l[u++]=k),g=T+w,y=g-T,b=g-y,x=w-y,_=T-b,A=_+x,T=g,c+=1,r>c&&(d=t[c]);for(;i>h;)o=v,a=A,w=o+a,M=w-o,k=a-M,k&&(l[u++]=k),g=T+w,y=g-T,b=g-y,x=w-y,_=T-b,A=_+x,T=g,h+=1,i>h&&(v=-e[h]);return A&&(l[u++]=A),T&&(l[u++]=T),u||(l[u++]=0),l.length=u,l}e.exports=i},{}],442:[function(t,e,r){"use strict";function n(t,e){var r=t+e,n=r-t,i=r-n,o=e-n,a=t-i,s=a+o;return s?[s,r]:[r]}function i(t,e){var r=0|t.length,i=0|e.length;if(1===r&&1===i)return n(t[0],e[0]);var o,a,s=r+i,l=new Array(s),u=0,c=0,h=0,f=Math.abs,d=t[c],p=f(d),v=e[h],m=f(v);m>p?(a=d,c+=1,r>c&&(d=t[c],p=f(d))):(a=v,h+=1,i>h&&(v=e[h],m=f(v))),r>c&&m>p||h>=i?(o=d,c+=1,r>c&&(d=t[c],p=f(d))):(o=v,h+=1,i>h&&(v=e[h],m=f(v)));for(var g,y,b,x,_,w=o+a,M=w-o,k=a-M,A=k,T=w;r>c&&i>h;)m>p?(o=d,c+=1,r>c&&(d=t[c],p=f(d))):(o=v,h+=1,i>h&&(v=e[h],m=f(v))),a=A,w=o+a,M=w-o,k=a-M,k&&(l[u++]=k),g=T+w,y=g-T,b=g-y,x=w-y,_=T-b,A=_+x,T=g;for(;r>c;)o=d,a=A,w=o+a,M=w-o,k=a-M,k&&(l[u++]=k),
g=T+w,y=g-T,b=g-y,x=w-y,_=T-b,A=_+x,T=g,c+=1,r>c&&(d=t[c]);for(;i>h;)o=v,a=A,w=o+a,M=w-o,k=a-M,k&&(l[u++]=k),g=T+w,y=g-T,b=g-y,x=w-y,_=T-b,A=_+x,T=g,h+=1,i>h&&(v=e[h]);return A&&(l[u++]=A),T&&(l[u++]=T),u||(l[u++]=0),l.length=u,l}e.exports=i},{}],443:[function(t,e,r){"use strict";function n(t){return t.split("").map(function(t){return t in i?i[t]:""}).join("")}e.exports=n;var i={" ":" ",0:"\u2070",1:"\xb9",2:"\xb2",3:"\xb3",4:"\u2074",5:"\u2075",6:"\u2076",7:"\u2077",8:"\u2078",9:"\u2079","+":"\u207a","-":"\u207b",a:"\u1d43",b:"\u1d47",c:"\u1d9c",d:"\u1d48",e:"\u1d49",f:"\u1da0",g:"\u1d4d",h:"\u02b0",i:"\u2071",j:"\u02b2",k:"\u1d4f",l:"\u02e1",m:"\u1d50",n:"\u207f",o:"\u1d52",p:"\u1d56",r:"\u02b3",s:"\u02e2",t:"\u1d57",u:"\u1d58",v:"\u1d5b",w:"\u02b7",x:"\u02e3",y:"\u02b8",z:"\u1dbb"}},{}],444:[function(t,e,r){"use strict";function n(t){return"a"+t}function i(t){return"d"+t}function o(t,e){return"c"+t+"_"+e}function a(t){return"s"+t}function s(t,e){return"t"+t+"_"+e}function l(t){return"o"+t}function u(t){return"x"+t}function c(t){return"p"+t}function h(t,e){return"d"+t+"_"+e}function f(t){return"i"+t}function d(t,e){return"u"+t+"_"+e}function p(t){return"b"+t}function v(t){return"y"+t}function m(t){return"e"+t}function g(t){return"v"+t}function y(t,e,r){for(var n=0,i=0;t>i;++i)e&1<<i&&(n|=1<<r[i]);return n}function b(t,e,r,b,x,S){function L(t,e){j.push("for(",f(x[t]),"=",e,";",f(x[t]),"<",a(x[t]),";","++",f(x[t]),"){")}function z(t){for(var e=0;D>e;++e)j.push(c(e),"+=",d(e,x[t]),";");j.push("}")}function I(t){for(var e=t-1;e>=0;--e)L(e,0);for(var r=[],e=0;D>e;++e)S[e]?r.push(i(e)+".get("+c(e)+")"):r.push(i(e)+"["+c(e)+"]");for(var e=0;b>e;++e)r.push(u(e));j.push(M,"[",T,"++]=phase(",r.join(),");");for(var e=0;t>e;++e)z(e);for(var n=0;D>n;++n)j.push(c(n),"+=",d(n,x[t]),";")}function P(t){for(var e=0;D>e;++e)S[e]?j.push(o(e,0),"=",i(e),".get(",c(e),");"):j.push(o(e,0),"=",i(e),"[",c(e),"];");for(var r=[],e=0;D>e;++e)r.push(o(e,0));for(var e=0;b>e;++e)r.push(u(e));j.push(p(0),"=",M,"[",T,"]=phase(",r.join(),");");for(var n=1;1<<O>n;++n)j.push(p(n),"=",M,"[",T,"+",m(n),"];");for(var a=[],n=1;1<<O>n;++n)a.push("("+p(0)+"!=="+p(n)+")");j.push("if(",a.join("||"),"){");for(var s=[],e=0;O>e;++e)s.push(f(e));for(var e=0;D>e;++e){s.push(o(e,0));for(var n=1;1<<O>n;++n)S[e]?j.push(o(e,n),"=",i(e),".get(",c(e),"+",h(e,n),");"):j.push(o(e,n),"=",i(e),"[",c(e),"+",h(e,n),"];"),s.push(o(e,n))}for(var e=0;1<<O>e;++e)s.push(p(e));for(var e=0;b>e;++e)s.push(u(e));j.push("vertex(",s.join(),");",g(0),"=",w,"[",T,"]=",k,"++;");for(var l=(1<<O)-1,d=p(l),n=0;O>n;++n)if(0===(t&~(1<<n))){for(var v=l^1<<n,y=p(v),x=[],_=v;_>0;_=_-1&v)x.push(w+"["+T+"+"+m(_)+"]");x.push(g(0));for(var _=0;D>_;++_)1&n?x.push(o(_,l),o(_,v)):x.push(o(_,v),o(_,l));1&n?x.push(d,y):x.push(y,d);for(var _=0;b>_;++_)x.push(u(_));j.push("if(",d,"!==",y,"){","face(",x.join(),")}")}j.push("}",T,"+=1;")}function C(){for(var t=1;1<<O>t;++t)j.push(E,"=",m(t),";",m(t),"=",v(t),";",v(t),"=",E,";")}function R(t,e){if(0>t)return void P(e);I(t),j.push("if(",a(x[t]),">0){",f(x[t]),"=1;"),R(t-1,e|1<<x[t]);for(var r=0;D>r;++r)j.push(c(r),"+=",d(r,x[t]),";");t===O-1&&(j.push(T,"=0;"),C()),L(t,2),R(t-1,e),t===O-1&&(j.push("if(",f(x[O-1]),"&1){",T,"=0;}"),C()),z(t),j.push("}")}var D=S.length,O=x.length;if(2>O)throw new Error("ndarray-extract-contour: Dimension must be at least 2");for(var F="extractContour"+x.join("_"),j=[],N=[],B=[],U=0;D>U;++U)B.push(n(U));for(var U=0;b>U;++U)B.push(u(U));for(var U=0;O>U;++U)N.push(a(U)+"="+n(0)+".shape["+U+"]|0");for(var U=0;D>U;++U){N.push(i(U)+"="+n(U)+".data",l(U)+"="+n(U)+".offset|0");for(var V=0;O>V;++V)N.push(s(U,V)+"="+n(U)+".stride["+V+"]|0")}for(var U=0;D>U;++U){N.push(c(U)+"="+l(U)),N.push(o(U,0));for(var V=1;1<<O>V;++V){for(var q=[],G=0;O>G;++G)V&1<<G&&q.push("-"+s(U,G));N.push(h(U,V)+"=("+q.join("")+")|0"),N.push(o(U,V)+"=0")}}for(var U=0;D>U;++U)for(var V=0;O>V;++V){var H=[s(U,x[V])];V>0&&H.push(s(U,x[V-1])+"*"+a(x[V-1])),N.push(d(U,x[V])+"=("+H.join("-")+")|0")}for(var U=0;O>U;++U)N.push(f(U)+"=0");N.push(k+"=0");for(var X=["2"],U=O-2;U>=0;--U)X.push(a(x[U]));N.push(A+"=("+X.join("*")+")|0",M+"=mallocUint32("+A+")",w+"=mallocUint32("+A+")",T+"=0"),N.push(p(0)+"=0");for(var V=1;1<<O>V;++V){for(var Y=[],W=[],G=0;O>G;++G)V&1<<G&&(0===W.length?Y.push("1"):Y.unshift(W.join("*"))),W.push(a(x[G]));var Z="";Y[0].indexOf(a(x[O-2]))<0&&(Z="-");var K=y(O,V,x);N.push(m(K)+"=(-"+Y.join("-")+")|0",v(K)+"=("+Z+Y.join("-")+")|0",p(K)+"=0")}N.push(g(0)+"=0",E+"=0"),R(O-1,0),j.push("freeUint32(",w,");freeUint32(",M,");");var J=["'use strict';","function ",F,"(",B.join(),"){","var ",N.join(),";",j.join(""),"}","return ",F].join(""),$=new Function("vertex","face","phase","mallocUint32","freeUint32",J);return $(t,e,r,_.mallocUint32,_.freeUint32)}function x(t){function e(t){throw new Error("ndarray-extract-contour: "+t)}"object"!=typeof t&&e("Must specify arguments");var r=t.order;Array.isArray(r)||e("Must specify order");var n=t.arrayArguments||1;1>n&&e("Must have at least one array argument");var i=t.scalarArguments||0;0>i&&e("Scalar arg count must be > 0"),"function"!=typeof t.vertex&&e("Must specify vertex creation function"),"function"!=typeof t.cell&&e("Must specify cell creation function"),"function"!=typeof t.phase&&e("Must specify phase function");for(var o=t.getters||[],a=new Array(n),s=0;n>s;++s)o.indexOf(s)>=0?a[s]=!0:a[s]=!1;return b(t.vertex,t.cell,t.phase,i,r,a)}var _=t("typedarray-pool");e.exports=x;var w="V",M="P",k="N",A="Q",T="X",E="T"},{"typedarray-pool":458}],445:[function(t,e,r){function n(t){if(0>t)return Number("0/0");for(var e=s[0],r=s.length-1;r>0;--r)e+=s[r]/(t+r);var n=t+a+.5;return.5*Math.log(2*Math.PI)+(t+.5)*Math.log(n)-n+Math.log(e)-Math.log(t)}var i=7,o=[.9999999999998099,676.5203681218851,-1259.1392167224028,771.3234287776531,-176.6150291621406,12.507343278686905,-.13857109526572012,9984369578019572e-21,1.5056327351493116e-7],a=607/128,s=[.9999999999999971,57.15623566586292,-59.59796035547549,14.136097974741746,-.4919138160976202,3399464998481189e-20,4652362892704858e-20,-9837447530487956e-20,.0001580887032249125,-.00021026444172410488,.00021743961811521265,-.0001643181065367639,8441822398385275e-20,-26190838401581408e-21,36899182659531625e-22];e.exports=function l(t){if(.5>t)return Math.PI/(Math.sin(Math.PI*t)*l(1-t));if(t>100)return Math.exp(n(t));t-=1;for(var e=o[0],r=1;i+2>r;r++)e+=o[r]/(t+r);var a=t+i+.5;return Math.sqrt(2*Math.PI)*Math.pow(a,t+.5)*Math.exp(-a)*e},e.exports.log=n},{}],446:[function(t,e,r){"use strict";function n(t){var e=t.length;if(i>e){for(var r=1,n=0;e>n;++n)for(var a=0;n>a;++a)if(t[n]<t[a])r=-r;else if(t[n]===t[a])return 0;return r}for(var s=o.mallocUint8(e),n=0;e>n;++n)s[n]=0;for(var r=1,n=0;e>n;++n)if(!s[n]){var l=1;s[n]=1;for(var a=t[n];a!==n;a=t[a]){if(s[a])return o.freeUint8(s),0;l+=1,s[a]=1}1&l||(r=-r)}return o.freeUint8(s),r}e.exports=n;var i=32,o=t("typedarray-pool")},{"typedarray-pool":458}],447:[function(t,e,r){"use strict";function n(t){var e=t.length;switch(e){case 0:case 1:return 0;case 2:return t[1]}var r,n,i,s=o.mallocUint32(e),l=o.mallocUint32(e),u=0;for(a(t,l),i=0;e>i;++i)s[i]=t[i];for(i=e-1;i>0;--i)n=l[i],r=s[i],s[i]=s[n],s[n]=r,l[i]=l[r],l[r]=n,u=(u+r)*i;return o.freeUint32(l),o.freeUint32(s),u}function i(t,e,r){switch(t){case 0:return r?r:[];case 1:return r?(r[0]=0,r):[0];case 2:return r?(e?(r[0]=0,r[1]=1):(r[0]=1,r[1]=0),r):e?[0,1]:[1,0]}r=r||new Array(t);var n,i,o,a=1;for(r[0]=0,o=1;t>o;++o)r[o]=o,a=a*o|0;for(o=t-1;o>0;--o)n=e/a|0,e=e-n*a|0,a=a/o|0,i=0|r[o],r[o]=0|r[n],r[n]=0|i;return r}var o=t("typedarray-pool"),a=t("invert-permutation");r.rank=n,r.unrank=i},{"invert-permutation":448,"typedarray-pool":458}],448:[function(t,e,r){"use strict";function n(t,e){e=e||new Array(t.length);for(var r=0;r<t.length;++r)e[t[r]]=r;return e}e.exports=n},{}],449:[function(t,e,r){"use strict";function n(t){if(0>t)return[];if(0===t)return[[0]];for(var e=0|Math.round(a(t+1)),r=[],n=0;e>n;++n){for(var s=i.unrank(t,n),l=[0],u=0,c=0;c<s.length;++c)u+=1<<s[c],l.push(u);o(s)<1&&(l[0]=u,l[t]=0),r.push(l)}return r}e.exports=n;var i=t("permutation-rank"),o=t("permutation-parity"),a=t("gamma")},{gamma:445,"permutation-parity":446,"permutation-rank":447}],450:[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":115}],451:[function(t,e,r){"use strict";function n(t,e){var r=[];return e=+e||0,i(t.hi(t.shape[0]-1),r,e),r}e.exports=n;var i=t("./lib/zc-core")},{"./lib/zc-core":450}],452:[function(t,e,r){"use strict";function n(t,e){var r=t.length,n=["'use strict';"],i="surfaceNets"+t.join("_")+"d"+e;n.push("var contour=genContour({","order:[",t.join(),"],","scalarArguments: 3,","phase:function phaseFunc(p,a,b,c) { return (p > c)|0 },"),"generic"===e&&n.push("getters:[0],");for(var o=[],l=[],u=0;r>u;++u)o.push("d"+u),l.push("d"+u);for(var u=0;1<<r>u;++u)o.push("v"+u),l.push("v"+u);for(var u=0;1<<r>u;++u)o.push("p"+u),l.push("p"+u);o.push("a","b","c"),l.push("a","c"),n.push("vertex:function vertexFunc(",o.join(),"){");for(var c=[],u=0;1<<r>u;++u)c.push("(p"+u+"<<"+u+")");n.push("var m=(",c.join("+"),")|0;if(m===0||m===",(1<<(1<<r))-1,"){return}");var h=[],f=[];128>=1<<(1<<r)?(n.push("switch(m){"),f=n):n.push("switch(m>>>7){");for(var u=0;1<<(1<<r)>u;++u){if(1<<(1<<r)>128&&u%128===0){h.length>0&&f.push("}}");var d="vExtra"+h.length;n.push("case ",u>>>7,":",d,"(m&0x7f,",l.join(),");break;"),f=["function ",d,"(m,",l.join(),"){switch(m){"],h.push(f)}f.push("case ",127&u,":");for(var p=new Array(r),v=new Array(r),m=new Array(r),g=new Array(r),y=0,b=0;r>b;++b)p[b]=[],v[b]=[],m[b]=0,g[b]=0;for(var b=0;1<<r>b;++b)for(var x=0;r>x;++x){var _=b^1<<x;if(!(_>b)&&!(u&1<<_)!=!(u&1<<b)){var w=1;u&1<<_?v[x].push("v"+_+"-v"+b):(v[x].push("v"+b+"-v"+_),w=-w),0>w?(p[x].push("-v"+b+"-v"+_),m[x]+=2):(p[x].push("v"+b+"+v"+_),m[x]-=2),y+=1;for(var M=0;r>M;++M)M!==x&&(_&1<<M?g[M]+=1:g[M]-=1)}}for(var k=[],x=0;r>x;++x)if(0===p[x].length)k.push("d"+x+"-0.5");else{var A="";m[x]<0?A=m[x]+"*c":m[x]>0&&(A="+"+m[x]+"*c");var T=.5*(p[x].length/y),E=.5+.5*(g[x]/y);k.push("d"+x+"-"+E+"-"+T+"*("+p[x].join("+")+A+")/("+v[x].join("+")+")")}f.push("a.push([",k.join(),"]);","break;")}n.push("}},"),h.length>0&&f.push("}}");for(var S=[],u=0;1<<r-1>u;++u)S.push("v"+u);S.push("c0","c1","p0","p1","a","b","c"),n.push("cell:function cellFunc(",S.join(),"){");var L=s(r-1);n.push("if(p0){b.push(",L.map(function(t){return"["+t.map(function(t){return"v"+t})+"]"}).join(),")}else{b.push(",L.map(function(t){var e=t.slice();return e.reverse(),"["+e.map(function(t){return"v"+t})+"]"}).join(),")}}});function ",i,"(array,level){var verts=[],cells=[];contour(array,verts,cells,level);return {positions:verts,cells:cells};} return ",i,";");for(var u=0;u<h.length;++u)n.push(h[u].join(""));var z=new Function("genContour",n.join(""));return z(a)}function i(t,e){for(var r=l(t,e),n=r.length,i=new Array(n),o=new Array(n),a=0;n>a;++a)i[a]=[r[a]],o[a]=[a];return{positions:i,cells:o}}function o(t,e){if(t.dimension<=0)return{positions:[],cells:[]};if(1===t.dimension)return i(t,e);var r=t.order.join()+"-"+t.dtype,o=u[r],e=+e||0;return o||(o=u[r]=n(t.order,t.dtype)),o(t,e)}e.exports=o;var a=t("ndarray-extract-contour"),s=t("triangulate-hypercube"),l=t("zero-crossings"),u={}},{"ndarray-extract-contour":444,"triangulate-hypercube":449,"zero-crossings":451}],453:[function(t,e,r){(function(r){"use strict";function n(t){for(var e=t.cells,r=t.positions,n=new Float32Array(6*e.length),i=0,o=0,a=0;a<e.length;++a)for(var s=e[a],l=0;3>l;++l){var u=r[s[l]];n[i++]=u[0],n[i++]=u[1]+1.4,o=Math.max(u[0],o)}return{data:n,shape:o}}function i(t,e){var r=s[t];r||(r=s[t]={" ":{data:new Float32Array(0),shape:.2}});var a=r[e];if(!a)if(e.length<=1||!/\d/.test(e))a=r[e]=n(o(e,{triangles:!0,font:t,textAlign:"left",textBaseline:"alphabetic"}));else{for(var l=e.split(/(\d|\s)/),u=new Array(l.length),c=0,h=0,f=0;f<l.length;++f)u[f]=i(t,l[f]),c+=u[f].data.length,h+=u[f].shape,f>0&&(h+=.02);for(var d=new Float32Array(c),p=0,v=-.5*h,f=0;f<u.length;++f){for(var m=u[f].data,g=0;g<m.length;g+=2)d[p++]=m[g]+v,d[p++]=m[g+1];v+=u[f].shape+.02}a=r[e]={data:d,shape:h}}return a}e.exports=i;var o=t("vectorize-text"),a=window||r.global||{},s=a.__TEXT_CACHE||{};a.__TEXT_CACHE={}}).call(this,t("_process"))},{_process:60,"vectorize-text":460}],454:[function(e,r,n){!function(){function e(t,r){if(t=t?t:"",r=r||{},t instanceof e)return t;if(!(this instanceof e))return new e(t,r);var i=n(t);this._originalInput=t,this._r=i.r,this._g=i.g,this._b=i.b,this._a=i.a,this._roundA=U(100*this._a)/100,this._format=r.format||i.format,this._gradientType=r.gradientType,this._r<1&&(this._r=U(this._r)),this._g<1&&(this._g=U(this._g)),this._b<1&&(this._b=U(this._b)),this._ok=i.ok,this._tc_id=N++}function n(t){var e={r:0,g:0,b:0},r=1,n=!1,o=!1;return"string"==typeof t&&(t=D(t)),"object"==typeof t&&(t.hasOwnProperty("r")&&t.hasOwnProperty("g")&&t.hasOwnProperty("b")?(e=i(t.r,t.g,t.b),n=!0,o="%"===String(t.r).substr(-1)?"prgb":"rgb"):t.hasOwnProperty("h")&&t.hasOwnProperty("s")&&t.hasOwnProperty("v")?(t.s=P(t.s),t.v=P(t.v),e=l(t.h,t.s,t.v),n=!0,o="hsv"):t.hasOwnProperty("h")&&t.hasOwnProperty("s")&&t.hasOwnProperty("l")&&(t.s=P(t.s),t.l=P(t.l),e=a(t.h,t.s,t.l),n=!0,o="hsl"),t.hasOwnProperty("a")&&(r=t.a)),r=A(r),{ok:n,format:t.format||o,r:V(255,q(e.r,0)),g:V(255,q(e.g,0)),b:V(255,q(e.b,0)),a:r}}function i(t,e,r){return{r:255*T(t,255),g:255*T(e,255),b:255*T(r,255)}}function o(t,e,r){t=T(t,255),e=T(e,255),r=T(r,255);var n,i,o=q(t,e,r),a=V(t,e,r),s=(o+a)/2;if(o==a)n=i=0;else{var l=o-a;switch(i=s>.5?l/(2-o-a):l/(o+a),o){case t:n=(e-r)/l+(r>e?6:0);break;case e:n=(r-t)/l+2;break;case r:n=(t-e)/l+4}n/=6}return{h:n,s:i,l:s}}function a(t,e,r){function n(t,e,r){return 0>r&&(r+=1),r>1&&(r-=1),1/6>r?t+6*(e-t)*r:.5>r?e:2/3>r?t+(e-t)*(2/3-r)*6:t}var i,o,a;if(t=T(t,360),e=T(e,100),r=T(r,100),0===e)i=o=a=r;else{var s=.5>r?r*(1+e):r+e-r*e,l=2*r-s;i=n(l,s,t+1/3),o=n(l,s,t),a=n(l,s,t-1/3)}return{r:255*i,g:255*o,b:255*a}}function s(t,e,r){t=T(t,255),e=T(e,255),r=T(r,255);var n,i,o=q(t,e,r),a=V(t,e,r),s=o,l=o-a;if(i=0===o?0:l/o,o==a)n=0;else{switch(o){case t:n=(e-r)/l+(r>e?6:0);break;case e:n=(r-t)/l+2;break;case r:n=(t-e)/l+4}n/=6}return{h:n,s:i,v:s}}function l(t,e,r){t=6*T(t,360),e=T(e,100),r=T(r,100);var n=B.floor(t),i=t-n,o=r*(1-e),a=r*(1-i*e),s=r*(1-(1-i)*e),l=n%6,u=[r,a,o,o,s,r][l],c=[s,r,r,a,o,o][l],h=[o,o,s,r,r,a][l];return{r:255*u,g:255*c,b:255*h}}function u(t,e,r,n){var i=[I(U(t).toString(16)),I(U(e).toString(16)),I(U(r).toString(16))];return n&&i[0].charAt(0)==i[0].charAt(1)&&i[1].charAt(0)==i[1].charAt(1)&&i[2].charAt(0)==i[2].charAt(1)?i[0].charAt(0)+i[1].charAt(0)+i[2].charAt(0):i.join("")}function c(t,e,r,n){var i=[I(C(n)),I(U(t).toString(16)),I(U(e).toString(16)),I(U(r).toString(16))];return i.join("")}function h(t,r){r=0===r?0:r||10;var n=e(t).toHsl();return n.s-=r/100,n.s=E(n.s),e(n)}function f(t,r){r=0===r?0:r||10;var n=e(t).toHsl();return n.s+=r/100,n.s=E(n.s),e(n)}function d(t){return e(t).desaturate(100)}function p(t,r){r=0===r?0:r||10;var n=e(t).toHsl();return n.l+=r/100,n.l=E(n.l),e(n)}function v(t,r){r=0===r?0:r||10;var n=e(t).toRgb();return n.r=q(0,V(255,n.r-U(255*-(r/100)))),n.g=q(0,V(255,n.g-U(255*-(r/100)))),n.b=q(0,V(255,n.b-U(255*-(r/100)))),e(n)}function m(t,r){r=0===r?0:r||10;var n=e(t).toHsl();return n.l-=r/100,n.l=E(n.l),e(n)}function g(t,r){var n=e(t).toHsl(),i=(U(n.h)+r)%360;return n.h=0>i?360+i:i,e(n)}function y(t){var r=e(t).toHsl();return r.h=(r.h+180)%360,e(r)}function b(t){var r=e(t).toHsl(),n=r.h;return[e(t),e({h:(n+120)%360,s:r.s,l:r.l}),e({h:(n+240)%360,s:r.s,l:r.l})]}function x(t){var r=e(t).toHsl(),n=r.h;return[e(t),e({h:(n+90)%360,s:r.s,l:r.l}),e({h:(n+180)%360,s:r.s,l:r.l}),e({h:(n+270)%360,s:r.s,l:r.l})]}function _(t){var r=e(t).toHsl(),n=r.h;return[e(t),e({h:(n+72)%360,s:r.s,l:r.l}),e({h:(n+216)%360,s:r.s,l:r.l})]}function w(t,r,n){r=r||6,n=n||30;var i=e(t).toHsl(),o=360/n,a=[e(t)];for(i.h=(i.h-(o*r>>1)+720)%360;--r;)i.h=(i.h+o)%360,a.push(e(i));return a}function M(t,r){r=r||6;for(var n=e(t).toHsv(),i=n.h,o=n.s,a=n.v,s=[],l=1/r;r--;)s.push(e({h:i,s:o,v:a})),a=(a+l)%1;return s}function k(t){var e={};for(var r in t)t.hasOwnProperty(r)&&(e[t[r]]=r);return e}function A(t){return t=parseFloat(t),(isNaN(t)||0>t||t>1)&&(t=1),t}function T(t,e){L(t)&&(t="100%");var r=z(t);return t=V(e,q(0,parseFloat(t))),r&&(t=parseInt(t*e,10)/100),B.abs(t-e)<1e-6?1:t%e/parseFloat(e)}function E(t){return V(1,q(0,t))}function S(t){return parseInt(t,16)}function L(t){return"string"==typeof t&&-1!=t.indexOf(".")&&1===parseFloat(t)}function z(t){return"string"==typeof t&&-1!=t.indexOf("%")}function I(t){return 1==t.length?"0"+t:""+t}function P(t){return 1>=t&&(t=100*t+"%"),t}function C(t){return Math.round(255*parseFloat(t)).toString(16)}function R(t){return S(t)/255}function D(t){t=t.replace(F,"").replace(j,"").toLowerCase();var e=!1;if(H[t])t=H[t],e=!0;else if("transparent"==t)return{r:0,g:0,b:0,a:0,format:"name"};var r;return(r=Y.rgb.exec(t))?{r:r[1],g:r[2],b:r[3]}:(r=Y.rgba.exec(t))?{r:r[1],g:r[2],b:r[3],a:r[4]}:(r=Y.hsl.exec(t))?{h:r[1],s:r[2],l:r[3]}:(r=Y.hsla.exec(t))?{h:r[1],s:r[2],l:r[3],a:r[4]}:(r=Y.hsv.exec(t))?{h:r[1],s:r[2],v:r[3]}:(r=Y.hsva.exec(t))?{h:r[1],s:r[2],v:r[3],a:r[4]}:(r=Y.hex8.exec(t))?{a:R(r[1]),r:S(r[2]),g:S(r[3]),b:S(r[4]),format:e?"name":"hex8"}:(r=Y.hex6.exec(t))?{r:S(r[1]),g:S(r[2]),b:S(r[3]),format:e?"name":"hex"}:(r=Y.hex3.exec(t))?{r:S(r[1]+""+r[1]),g:S(r[2]+""+r[2]),b:S(r[3]+""+r[3]),format:e?"name":"hex"}:!1}function O(t){var e,r;return t=t||{level:"AA",size:"small"},e=(t.level||"AA").toUpperCase(),r=(t.size||"small").toLowerCase(),"AA"!==e&&"AAA"!==e&&(e="AA"),"small"!==r&&"large"!==r&&(r="small"),{level:e,size:r}}var F=/^\s+/,j=/\s+$/,N=0,B=Math,U=B.round,V=B.min,q=B.max,G=B.random;e.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var t=this.toRgb();return(299*t.r+587*t.g+114*t.b)/1e3},getLuminance:function(){var t,e,r,n,i,o,a=this.toRgb();return t=a.r/255,e=a.g/255,r=a.b/255,n=.03928>=t?t/12.92:Math.pow((t+.055)/1.055,2.4),i=.03928>=e?e/12.92:Math.pow((e+.055)/1.055,2.4),o=.03928>=r?r/12.92:Math.pow((r+.055)/1.055,2.4),.2126*n+.7152*i+.0722*o},setAlpha:function(t){return this._a=A(t),this._roundA=U(100*this._a)/100,this},toHsv:function(){var t=s(this._r,this._g,this._b);return{h:360*t.h,s:t.s,v:t.v,a:this._a}},toHsvString:function(){var t=s(this._r,this._g,this._b),e=U(360*t.h),r=U(100*t.s),n=U(100*t.v);return 1==this._a?"hsv("+e+", "+r+"%, "+n+"%)":"hsva("+e+", "+r+"%, "+n+"%, "+this._roundA+")"},toHsl:function(){var t=o(this._r,this._g,this._b);return{h:360*t.h,s:t.s,l:t.l,a:this._a}},toHslString:function(){var t=o(this._r,this._g,this._b),e=U(360*t.h),r=U(100*t.s),n=U(100*t.l);return 1==this._a?"hsl("+e+", "+r+"%, "+n+"%)":"hsla("+e+", "+r+"%, "+n+"%, "+this._roundA+")"},toHex:function(t){return u(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(){return c(this._r,this._g,this._b,this._a)},toHex8String:function(){return"#"+this.toHex8()},toRgb:function(){return{r:U(this._r),g:U(this._g),b:U(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+U(this._r)+", "+U(this._g)+", "+U(this._b)+")":"rgba("+U(this._r)+", "+U(this._g)+", "+U(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:U(100*T(this._r,255))+"%",g:U(100*T(this._g,255))+"%",b:U(100*T(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+U(100*T(this._r,255))+"%, "+U(100*T(this._g,255))+"%, "+U(100*T(this._b,255))+"%)":"rgba("+U(100*T(this._r,255))+"%, "+U(100*T(this._g,255))+"%, "+U(100*T(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":this._a<1?!1:X[u(this._r,this._g,this._b,!0)]||!1},toFilter:function(t){var r="#"+c(this._r,this._g,this._b,this._a),n=r,i=this._gradientType?"GradientType = 1, ":"";if(t){var o=e(t);n=o.toHex8String()}return"progid:DXImageTransform.Microsoft.gradient("+i+"startColorstr="+r+",endColorstr="+n+")"},toString:function(t){var e=!!t;t=t||this._format;var r=!1,n=this._a<1&&this._a>=0,i=!e&&n&&("hex"===t||"hex6"===t||"hex3"===t||"name"===t);return i?"name"===t&&0===this._a?this.toName():this.toRgbString():("rgb"===t&&(r=this.toRgbString()),"prgb"===t&&(r=this.toPercentageRgbString()),"hex"!==t&&"hex6"!==t||(r=this.toHexString()),"hex3"===t&&(r=this.toHexString(!0)),"hex8"===t&&(r=this.toHex8String()),"name"===t&&(r=this.toName()),"hsl"===t&&(r=this.toHslString()),"hsv"===t&&(r=this.toHsvString()),r||this.toHexString())},clone:function(){return e(this.toString())},_applyModification:function(t,e){var r=t.apply(null,[this].concat([].slice.call(e)));return this._r=r._r,this._g=r._g,this._b=r._b,this.setAlpha(r._a),this},lighten:function(){return this._applyModification(p,arguments)},brighten:function(){return this._applyModification(v,arguments)},darken:function(){return this._applyModification(m,arguments)},desaturate:function(){return this._applyModification(h,arguments)},saturate:function(){return this._applyModification(f,arguments)},greyscale:function(){return this._applyModification(d,arguments)},spin:function(){return this._applyModification(g,arguments)},_applyCombination:function(t,e){return t.apply(null,[this].concat([].slice.call(e)))},analogous:function(){return this._applyCombination(w,arguments)},complement:function(){return this._applyCombination(y,arguments)},monochromatic:function(){return this._applyCombination(M,arguments)},splitcomplement:function(){return this._applyCombination(_,arguments)},triad:function(){return this._applyCombination(b,arguments)},tetrad:function(){return this._applyCombination(x,arguments)}},e.fromRatio=function(t,r){if("object"==typeof t){var n={};for(var i in t)t.hasOwnProperty(i)&&("a"===i?n[i]=t[i]:n[i]=P(t[i]));t=n}return e(t,r)},e.equals=function(t,r){return t&&r?e(t).toRgbString()==e(r).toRgbString():!1},e.random=function(){return e.fromRatio({r:G(),g:G(),b:G()})},e.mix=function(t,r,n){n=0===n?0:n||50;var i,o=e(t).toRgb(),a=e(r).toRgb(),s=n/100,l=2*s-1,u=a.a-o.a;i=l*u==-1?l:(l+u)/(1+l*u),i=(i+1)/2;var c=1-i,h={r:a.r*i+o.r*c,g:a.g*i+o.g*c,b:a.b*i+o.b*c,a:a.a*s+o.a*(1-s)};return e(h)},e.readability=function(t,r){var n=e(t),i=e(r);return(Math.max(n.getLuminance(),i.getLuminance())+.05)/(Math.min(n.getLuminance(),i.getLuminance())+.05)},e.isReadable=function(t,r,n){var i,o,a=e.readability(t,r);switch(o=!1,i=O(n),i.level+i.size){case"AAsmall":case"AAAlarge":o=a>=4.5;break;case"AAlarge":o=a>=3;break;case"AAAsmall":o=a>=7}return o},e.mostReadable=function(t,r,n){var i,o,a,s,l=null,u=0;n=n||{},o=n.includeFallbackColors,a=n.level,s=n.size;for(var c=0;c<r.length;c++)i=e.readability(t,r[c]),i>u&&(u=i,l=e(r[c]));return e.isReadable(t,l,{level:a,size:s})||!o?l:(n.includeFallbackColors=!1,e.mostReadable(t,["#fff","#000"],n))};var H=e.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},X=e.hexNames=k(H),Y=function(){var t="[-\\+]?\\d+%?",e="[-\\+]?\\d*\\.\\d+%?",r="(?:"+e+")|(?:"+t+")",n="[\\s|\\(]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")\\s*\\)?",i="[\\s|\\(]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")\\s*\\)?";return{rgb:new RegExp("rgb"+n),rgba:new RegExp("rgba"+i),hsl:new RegExp("hsl"+n),hsla:new RegExp("hsla"+i),hsv:new RegExp("hsv"+n),hsva:new RegExp("hsva"+i),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();"undefined"!=typeof r&&r.exports?r.exports=e:"function"==typeof t&&t.amd?t(function(){return e}):window.tinycolor=e}()},{}],455:[function(e,r,n){!function(e,i){"object"==typeof n&&"undefined"!=typeof r?i(n):"function"==typeof t&&t.amd?t(["exports"],i):i(e.topojson={})}(this,function(t){"use strict";function e(){}function r(t){if(!t)return e;var r,n,i=t.scale[0],o=t.scale[1],a=t.translate[0],s=t.translate[1];return function(t,e){e||(r=n=0),t[0]=(r+=t[0])*i+a,t[1]=(n+=t[1])*o+s}}function n(t){if(!t)return e;var r,n,i=t.scale[0],o=t.scale[1],a=t.translate[0],s=t.translate[1];return function(t,e){e||(r=n=0);var l=(t[0]-a)/i|0,u=(t[1]-s)/o|0;t[0]=l-r,t[1]=u-n,r=l,n=u}}function i(t,e){for(var r,n=t.length,i=n-e;i<--n;)r=t[i],t[i++]=t[n],t[n]=r}function o(t,e){for(var r=0,n=t.length;n>r;){var i=r+n>>>1;t[i]<e?r=i+1:n=i}return r}function a(t,e){return"GeometryCollection"===e.type?{type:"FeatureCollection",features:e.geometries.map(function(e){return s(t,e)})}:s(t,e)}function s(t,e){var r={type:"Feature",id:e.id,properties:e.properties||{},geometry:l(t,e)};return null==e.id&&delete r.id,r}function l(t,e){function n(t,e){e.length&&e.pop();for(var r,n=h[0>t?~t:t],o=0,a=n.length;a>o;++o)e.push(r=n[o].slice()),c(r,o);0>t&&i(e,a)}function o(t){return t=t.slice(),c(t,0),t}function a(t){for(var e=[],r=0,i=t.length;i>r;++r)n(t[r],e);return e.length<2&&e.push(e[0].slice()),e}function s(t){for(var e=a(t);e.length<4;)e.push(e[0].slice());return e}function l(t){return t.map(s)}function u(t){var e=t.type;return"GeometryCollection"===e?{type:e,geometries:t.geometries.map(u)}:e in f?{type:e,coordinates:f[e](t)}:null}var c=r(t.transform),h=t.arcs,f={Point:function(t){return o(t.coordinates)},MultiPoint:function(t){return t.coordinates.map(o)},LineString:function(t){return a(t.arcs)},MultiLineString:function(t){return t.arcs.map(a)},Polygon:function(t){return l(t.arcs)},MultiPolygon:function(t){return t.arcs.map(l)}};return u(e)}function u(t,e){function r(e){var r,n=t.arcs[0>e?~e:e],i=n[0];return t.transform?(r=[0,0],n.forEach(function(t){r[0]+=t[0],r[1]+=t[1]})):r=n[n.length-1],0>e?[r,i]:[i,r]}function n(t,e){for(var r in t){var n=t[r];delete e[n.start],delete n.start,delete n.end,n.forEach(function(t){i[0>t?~t:t]=1}),s.push(n)}}var i={},o={},a={},s=[],l=-1;return e.forEach(function(r,n){var i,o=t.arcs[0>r?~r:r];o.length<3&&!o[1][0]&&!o[1][1]&&(i=e[++l],e[l]=r,e[n]=i)}),e.forEach(function(t){var e,n,i=r(t),s=i[0],l=i[1];if(e=a[s])if(delete a[e.end],e.push(t),e.end=l,n=o[l]){delete o[n.start];var u=n===e?e:e.concat(n);o[u.start=e.start]=a[u.end=n.end]=u}else o[e.start]=a[e.end]=e;else if(e=o[l])if(delete o[e.start],e.unshift(t),e.start=s,n=a[s]){delete a[n.end];var c=n===e?e:n.concat(e);o[c.start=n.start]=a[c.end=e.end]=c}else o[e.start]=a[e.end]=e;else e=[t],o[e.start=s]=a[e.end=l]=e}),n(a,o),n(o,a),e.forEach(function(t){i[0>t?~t:t]||s.push([t])}),s}function c(t){return l(t,h.apply(this,arguments))}function h(t,e,r){function n(t){var e=0>t?~t:t;(c[e]||(c[e]=[])).push({i:t,g:l})}function i(t){t.forEach(n)}function o(t){t.forEach(i)}function a(t){"GeometryCollection"===t.type?t.geometries.forEach(a):t.type in h&&(l=t,h[t.type](t.arcs))}var s=[];if(arguments.length>1){var l,c=[],h={LineString:i,MultiLineString:o,Polygon:o,MultiPolygon:function(t){t.forEach(o)}};a(e),c.forEach(arguments.length<3?function(t){s.push(t[0].i)}:function(t){r(t[0].g,t[t.length-1].g)&&s.push(t[0].i)})}else for(var f=0,d=t.arcs.length;d>f;++f)s.push(f);return{type:"MultiLineString",arcs:u(t,s)}}function f(t){var e=t[0],r=t[1],n=t[2];return Math.abs((e[0]-n[0])*(r[1]-e[1])-(e[0]-r[0])*(n[1]-e[1]))}function d(t){for(var e,r=-1,n=t.length,i=t[n-1],o=0;++r<n;)e=i,i=t[r],o+=e[0]*i[1]-e[1]*i[0];return o/2}function p(t){return l(t,v.apply(this,arguments))}function v(t,e){function r(t){t.forEach(function(e){e.forEach(function(e){(i[e=0>e?~e:e]||(i[e]=[])).push(t)})}),o.push(t)}function n(e){return d(l(t,{type:"Polygon",arcs:[e]}).coordinates[0])>0}var i={},o=[],a=[];return e.forEach(function(t){"Polygon"===t.type?r(t.arcs):"MultiPolygon"===t.type&&t.arcs.forEach(r)}),o.forEach(function(t){if(!t._){var e=[],r=[t];for(t._=1,a.push(e);t=r.pop();)e.push(t),t.forEach(function(t){t.forEach(function(t){i[0>t?~t:t].forEach(function(t){t._||(t._=1,r.push(t))})})})}}),o.forEach(function(t){delete t._}),{type:"MultiPolygon",arcs:a.map(function(e){var r,o=[];if(e.forEach(function(t){t.forEach(function(t){t.forEach(function(t){i[0>t?~t:t].length<2&&o.push(t)})})}),o=u(t,o),(r=o.length)>1)for(var a,s=n(e[0][0]),l=0;r>l;++l)if(s===n(o[l])){a=o[0],o[0]=o[l],o[l]=a;break}return o})}}function m(t){function e(t,e){t.forEach(function(t){0>t&&(t=~t);var r=i[t];r?r.push(e):i[t]=[e]})}function r(t,r){t.forEach(function(t){e(t,r)})}function n(t,e){
"GeometryCollection"===t.type?t.geometries.forEach(function(t){n(t,e)}):t.type in s&&s[t.type](t.arcs,e)}var i={},a=t.map(function(){return[]}),s={LineString:e,MultiLineString:r,Polygon:r,MultiPolygon:function(t,e){t.forEach(function(t){r(t,e)})}};t.forEach(n);for(var l in i)for(var u=i[l],c=u.length,h=0;c>h;++h)for(var f=h+1;c>f;++f){var d,p=u[h],v=u[f];(d=a[p])[l=o(d,v)]!==v&&d.splice(l,0,v),(d=a[v])[l=o(d,p)]!==p&&d.splice(l,0,p)}return a}function g(t,e){return t[1][2]-e[1][2]}function y(){function t(t,e){for(;e>0;){var r=(e+1>>1)-1,i=n[r];if(g(t,i)>=0)break;n[i._=e]=i,n[t._=e=r]=t}}function e(t,e){for(;;){var r=e+1<<1,o=r-1,a=e,s=n[a];if(i>o&&g(n[o],s)<0&&(s=n[a=o]),i>r&&g(n[r],s)<0&&(s=n[a=r]),a===e)break;n[s._=e]=s,n[t._=e=a]=t}}var r={},n=[],i=0;return r.push=function(e){return t(n[e._=i]=e,i++),i},r.pop=function(){if(!(0>=i)){var t,r=n[0];return--i>0&&(t=n[i],e(n[t._=0]=t,0)),r}},r.remove=function(r){var o,a=r._;if(n[a]===r)return a!==--i&&(o=n[i],(g(o,r)<0?t:e)(n[o._=a]=o,a)),a},r}function b(t,e){function i(t){s.remove(t),t[1][2]=e(t),s.push(t)}var o=r(t.transform),a=n(t.transform),s=y();return e||(e=f),t.arcs.forEach(function(t){var r,n,l,u,c=[],h=0;for(n=0,l=t.length;l>n;++n)u=t[n],o(t[n]=[u[0],u[1],1/0],n);for(n=1,l=t.length-1;l>n;++n)r=t.slice(n-1,n+2),r[1][2]=e(r),c.push(r),s.push(r);for(n=0,l=c.length;l>n;++n)r=c[n],r.previous=c[n-1],r.next=c[n+1];for(;r=s.pop();){var f=r.previous,d=r.next;r[1][2]<h?r[1][2]=h:h=r[1][2],f&&(f.next=d,f[2]=r[2],i(f)),d&&(d.previous=f,d[0]=r[0],i(d))}t.forEach(a)}),t}var x="1.6.24";t.version=x,t.mesh=c,t.meshArcs=h,t.merge=p,t.mergeArcs=v,t.feature=a,t.neighbors=m,t.presimplify=b})},{}],456:[function(t,e,r){"use strict";function n(t,e,r){var n=t*e,o=i*t,a=o-t,s=o-a,l=t-s,u=i*e,c=u-e,h=u-c,f=e-h,d=n-s*h,p=d-l*h,v=p-s*f,m=l*f-v;return r?(r[0]=m,r[1]=n,r):[m,n]}e.exports=n;var i=+(Math.pow(2,27)+1)},{}],457:[function(t,e,r){"use strict";function n(t,e,r){var n=t+e,i=n-t,o=n-i,a=e-i,s=t-o;return r?(r[0]=s+a,r[1]=n,r):[s+a,n]}e.exports=n},{}],458:[function(t,e,r){(function(e,n){"use strict";function i(t){if(t){var e=t.length||t.byteLength,r=y.log2(e);w[r].push(t)}}function o(t){i(t.buffer)}function a(t){var t=y.nextPow2(t),e=y.log2(t),r=w[e];return r.length>0?r.pop():new ArrayBuffer(t)}function s(t){return new Uint8Array(a(t),0,t)}function l(t){return new Uint16Array(a(2*t),0,t)}function u(t){return new Uint32Array(a(4*t),0,t)}function c(t){return new Int8Array(a(t),0,t)}function h(t){return new Int16Array(a(2*t),0,t)}function f(t){return new Int32Array(a(4*t),0,t)}function d(t){return new Float32Array(a(4*t),0,t)}function p(t){return new Float64Array(a(8*t),0,t)}function v(t){return x?new Uint8ClampedArray(a(t),0,t):s(t)}function m(t){return new DataView(a(t),0,t)}function g(t){t=y.nextPow2(t);var e=y.log2(t),r=M[e];return r.length>0?r.pop():new n(t)}var y=t("bit-twiddle"),b=t("dup");e.__TYPEDARRAY_POOL||(e.__TYPEDARRAY_POOL={UINT8:b([32,0]),UINT16:b([32,0]),UINT32:b([32,0]),INT8:b([32,0]),INT16:b([32,0]),INT32:b([32,0]),FLOAT:b([32,0]),DOUBLE:b([32,0]),DATA:b([32,0]),UINT8C:b([32,0]),BUFFER:b([32,0])});var x="undefined"!=typeof Uint8ClampedArray,_=e.__TYPEDARRAY_POOL;_.UINT8C||(_.UINT8C=b([32,0])),_.BUFFER||(_.BUFFER=b([32,0]));var w=_.DATA,M=_.BUFFER;r.free=function(t){if(n.isBuffer(t))M[y.log2(t.length)].push(t);else{if("[object ArrayBuffer]"!==Object.prototype.toString.call(t)&&(t=t.buffer),!t)return;var e=t.length||t.byteLength,r=0|y.log2(e);w[r].push(t)}},r.freeUint8=r.freeUint16=r.freeUint32=r.freeInt8=r.freeInt16=r.freeInt32=r.freeFloat32=r.freeFloat=r.freeFloat64=r.freeDouble=r.freeUint8Clamped=r.freeDataView=o,r.freeArrayBuffer=i,r.freeBuffer=function(t){M[y.log2(t.length)].push(t)},r.malloc=function(t,e){if(void 0===e||"arraybuffer"===e)return a(t);switch(e){case"uint8":return s(t);case"uint16":return l(t);case"uint32":return u(t);case"int8":return c(t);case"int16":return h(t);case"int32":return f(t);case"float":case"float32":return d(t);case"double":case"float64":return p(t);case"uint8_clamped":return v(t);case"buffer":return g(t);case"data":case"dataview":return m(t);default:return null}return null},r.mallocArrayBuffer=a,r.mallocUint8=s,r.mallocUint16=l,r.mallocUint32=u,r.mallocInt8=c,r.mallocInt16=h,r.mallocInt32=f,r.mallocFloat32=r.mallocFloat=d,r.mallocFloat64=r.mallocDouble=p,r.mallocUint8Clamped=v,r.mallocDataView=m,r.mallocBuffer=g,r.clearCache=function(){for(var t=0;32>t;++t)_.UINT8[t].length=0,_.UINT16[t].length=0,_.UINT32[t].length=0,_.INT8[t].length=0,_.INT16[t].length=0,_.INT32[t].length=0,_.FLOAT[t].length=0,_.DOUBLE[t].length=0,_.UINT8C[t].length=0,w[t].length=0,M[t].length=0}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer)},{"bit-twiddle":51,buffer:53,dup:121}],459:[function(t,e,r){"use strict";function n(t,e){for(var r=1,n=t.length,i=t[0],o=t[0],a=1;n>a;++a)if(o=i,i=t[a],e(i,o)){if(a===r){r++;continue}t[r++]=i}return t.length=r,t}function i(t){for(var e=1,r=t.length,n=t[0],i=t[0],o=1;r>o;++o,i=n)if(i=n,n=t[o],n!==i){if(o===e){e++;continue}t[e++]=n}return t.length=e,t}function o(t,e,r){return 0===t.length?t:e?(r||t.sort(e),n(t,e)):(r||t.sort(),i(t))}e.exports=o},{}],460:[function(t,e,r){"use strict";function n(t,e){return"object"==typeof e&&null!==e||(e={}),i(t,e.canvas||o,e.context||a,e)}e.exports=n;var i=t("./lib/vtext"),o=null,a=null;"undefined"!=typeof document&&(o=document.createElement("canvas"),o.width=8192,o.height=1024,a=o.getContext("2d"))},{"./lib/vtext":461}],461:[function(t,e,r){"use strict";function n(t,e,r){for(var n=e.textAlign||"start",i=e.textBaseline||"alphabetic",o=[1<<30,1<<30],a=[0,0],s=t.length,l=0;s>l;++l)for(var u=t[l],c=0;2>c;++c)o[c]=0|Math.min(o[c],u[c]),a[c]=0|Math.max(a[c],u[c]);var h=0;switch(n){case"center":h=-.5*(o[0]+a[0]);break;case"right":case"end":h=-a[0];break;case"left":case"start":h=-o[0];break;default:throw new Error("vectorize-text: Unrecognized textAlign: '"+n+"'")}var f=0;switch(i){case"hanging":case"top":f=-o[1];break;case"middle":f=-.5*(o[1]+a[1]);break;case"alphabetic":case"ideographic":f=-3*r;break;case"bottom":f=-a[1];break;default:throw new Error("vectorize-text: Unrecoginized textBaseline: '"+i+"'")}var d=1/r;return"lineHeight"in e?d*=+e.lineHeight:"width"in e?d=e.width/(a[0]-o[0]):"height"in e&&(d=e.height/(a[1]-o[1])),t.map(function(t){return[d*(t[0]+h),d*(t[1]+f)]})}function i(t,e,r,n){var i=0|Math.ceil(e.measureText(r).width+2*n);if(i>8192)throw new Error("vectorize-text: String too long (sorry, this will get fixed later)");var o=3*n;t.height<o&&(t.height=o),e.fillStyle="#000",e.fillRect(0,0,t.width,t.height),e.fillStyle="#fff",e.fillText(r,n,2*n);var a=e.getImageData(0,0,i,o),s=c(a.data,[o,i,4]);return s.pick(-1,-1,0).transpose(1,0)}function o(t,e){var r=u(t,128);return e?h(r.cells,r.positions,.25):{edges:r.cells,positions:r.positions}}function a(t,e,r,i){var a=o(t,i),s=n(a.positions,e,r),l=a.edges,u="ccw"===e.orientation;if(f(s,l),e.polygons||e.polygon||e.polyline){for(var c=p(l,s),h=new Array(c.length),v=0;v<c.length;++v){for(var m=c[v],g=new Array(m.length),y=0;y<m.length;++y){for(var b=m[y],x=new Array(b.length),_=0;_<b.length;++_)x[_]=s[b[_]].slice();u&&x.reverse(),g[y]=x}h[v]=g}return h}return e.triangles||e.triangulate||e.triangle?{cells:d(s,l,{delaunay:!1,exterior:!1,interior:!0}),positions:s}:{edges:l,positions:s}}function s(t,e,r){try{return a(t,e,r,!0)}catch(n){}try{return a(t,e,r,!1)}catch(n){}return e.polygons||e.polyline||e.polygon?[]:e.triangles||e.triangulate||e.triangle?{cells:[],positions:[]}:{edges:[],positions:[]}}function l(t,e,r,n){var o=n.size||64,a=n.font||"normal";r.font=o+"px "+a,r.textAlign="start",r.textBaseline="alphabetic",r.direction="ltr";var l=i(e,r,t,o);return s(l,n,o)}e.exports=l,e.exports.processPixels=s;var u=t("surface-nets"),c=t("ndarray"),h=t("simplify-planar-graph"),f=t("clean-pslg"),d=t("cdt2d"),p=t("planar-graph-to-polyline")},{cdt2d:63,"clean-pslg":70,ndarray:433,"planar-graph-to-polyline":474,"simplify-planar-graph":478,"surface-nets":452}],462:[function(t,e,r){"use strict";function n(t,e){for(var r=i(t,e.length),n=new Array(e.length),o=new Array(e.length),a=[],s=0;s<e.length;++s){var l=r[s].length;o[s]=l,n[s]=!0,1>=l&&a.push(s)}for(;a.length>0;){var u=a.pop();n[u]=!1;for(var c=r[u],s=0;s<c.length;++s){var h=c[s];0===--o[h]&&a.push(h)}}for(var f=new Array(e.length),d=[],s=0;s<e.length;++s)if(n[s]){var u=d.length;f[s]=u,d.push(e[s])}else f[s]=-1;for(var p=[],s=0;s<t.length;++s){var v=t[s];n[v[0]]&&n[v[1]]&&p.push([f[v[0]],f[v[1]]])}return[p,d]}e.exports=n;var i=t("edges-to-adjacency-list")},{"edges-to-adjacency-list":463}],463:[function(t,e,r){"use strict";function n(t,e){var r=t.length;if("number"!=typeof e){e=0;for(var n=0;r>n;++n){var o=t[n];e=Math.max(e,o[0],o[1])}e=(0|e)+1}e=0|e;for(var a=new Array(e),n=0;e>n;++n)a[n]=[];for(var n=0;r>n;++n){var o=t[n];a[o[0]].push(o[1]),a[o[1]].push(o[0])}for(var s=0;e>s;++s)i(a[s],function(t,e){return t-e});return a}e.exports=n;var i=t("uniq")},{uniq:459}],464:[function(t,e,r){"use strict";function n(t,e){function r(t,e){var r=u[e][t[e]];r.splice(r.indexOf(t),1)}function n(t,n,o){for(var a,s,l,c=0;2>c;++c)if(u[c][n].length>0){a=u[c][n][0],l=c;break}s=a[1^l];for(var h=0;2>h;++h)for(var f=u[h][n],d=0;d<f.length;++d){var p=f[d],v=p[1^h],m=i(e[t],e[n],e[s],e[v]);m>0&&(a=p,s=v,l=h)}return o?s:(a&&r(a,l),s)}function o(t,o){var a=u[o][t][0],s=[t];r(a,o);for(var l=a[1^o];;){for(;l!==t;)s.push(l),l=n(s[s.length-2],l,!1);if(u[0][t].length+u[1][t].length===0)break;var c=s[s.length-1],h=t,f=s[1],d=n(c,h,!0);if(i(e[c],e[h],e[f],e[d])<0)break;s.push(t),l=n(c,h)}return s}function a(t,e){return e[1]===e[e.length-1]}for(var s=0|e.length,l=t.length,u=[new Array(s),new Array(s)],c=0;s>c;++c)u[0][c]=[],u[1][c]=[];for(var c=0;l>c;++c){var h=t[c];u[0][h[0]].push(h),u[1][h[1]].push(h)}for(var f=[],c=0;s>c;++c)u[0][c].length+u[1][c].length===0&&f.push([c]);for(var c=0;s>c;++c)for(var d=0;2>d;++d){for(var p=[];u[d][c].length>0;){var v=(u[0][c].length,o(c,d));a(p,v)?p.push.apply(p,v):(p.length>0&&f.push(p),p=v)}p.length>0&&f.push(p)}return f}e.exports=n;var i=t("compare-angle")},{"compare-angle":465}],465:[function(t,e,r){"use strict";function n(t,e,r){var n=s(t[0],-e[0]),i=s(t[1],-e[1]),o=s(r[0],-e[0]),a=s(r[1],-e[1]),c=u(l(n,o),l(i,a));return c[c.length-1]>=0}function i(t,e,r,i){var s=o(e,r,i);if(0===s){var l=a(o(t,e,r)),u=a(o(t,e,i));if(l===u){if(0===l){var c=n(t,e,r),h=n(t,e,i);return c===h?0:c?1:-1}return 0}return 0===u?l>0?-1:n(t,e,i)?-1:1:0===l?u>0?1:n(t,e,r)?1:-1:a(u-l)}var f=o(t,e,r);if(f>0)return s>0&&o(t,e,i)>0?1:-1;if(0>f)return s>0||o(t,e,i)>0?1:-1;var d=o(t,e,i);return d>0?1:n(t,e,r)?1:-1}e.exports=i;var o=t("robust-orientation"),a=t("signum"),s=t("two-sum"),l=t("robust-product"),u=t("robust-sum")},{"robust-orientation":439,"robust-product":466,"robust-sum":442,signum:467,"two-sum":457}],466:[function(t,e,r){"use strict";function n(t,e){if(1===t.length)return o(e,t[0]);if(1===e.length)return o(t,e[0]);if(0===t.length||0===e.length)return[0];var r=[0];if(t.length<e.length)for(var n=0;n<t.length;++n)r=i(r,o(e,t[n]));else for(var n=0;n<e.length;++n)r=i(r,o(t,e[n]));return r}var i=t("robust-sum"),o=t("robust-scale");e.exports=n},{"robust-scale":440,"robust-sum":442}],467:[function(t,e,r){"use strict";e.exports=function(t){return 0>t?-1:t>0?1:0}},{}],468:[function(t,e,r){arguments[4][22][0].apply(r,arguments)},{dup:22}],469:[function(t,e,r){"use strict";function n(t,e,r,n,i){this.mid=t,this.left=e,this.right=r,this.leftPoints=n,this.rightPoints=i,this.count=(e?e.count:0)+(r?r.count:0)+n.length}function i(t,e){t.mid=e.mid,t.left=e.left,t.right=e.right,t.leftPoints=e.leftPoints,t.rightPoints=e.rightPoints,t.count=e.count}function o(t,e){var r=p(e);t.mid=r.mid,t.left=r.left,t.right=r.right,t.leftPoints=r.leftPoints,t.rightPoints=r.rightPoints,t.count=r.count}function a(t,e){var r=t.intervals([]);r.push(e),o(t,r)}function s(t,e){var r=t.intervals([]),n=r.indexOf(e);return 0>n?y:(r.splice(n,1),o(t,r),b)}function l(t,e,r){for(var n=0;n<t.length&&t[n][0]<=e;++n){var i=r(t[n]);if(i)return i}}function u(t,e,r){for(var n=t.length-1;n>=0&&t[n][1]>=e;--n){var i=r(t[n]);if(i)return i}}function c(t,e){for(var r=0;r<t.length;++r){var n=e(t[r]);if(n)return n}}function h(t,e){return t-e}function f(t,e){var r=t[0]-e[0];return r?r:t[1]-e[1]}function d(t,e){var r=t[1]-e[1];return r?r:t[0]-e[0]}function p(t){if(0===t.length)return null;for(var e=[],r=0;r<t.length;++r)e.push(t[r][0],t[r][1]);e.sort(h);for(var i=e[e.length>>1],o=[],a=[],s=[],r=0;r<t.length;++r){var l=t[r];l[1]<i?o.push(l):i<l[0]?a.push(l):s.push(l)}var u=s,c=s.slice();return u.sort(f),c.sort(d),new n(i,p(o),p(a),u,c)}function v(t){this.root=t}function m(t){return new v(t&&0!==t.length?p(t):null)}var g=t("binary-search-bounds"),y=0,b=1,x=2;e.exports=m;var _=n.prototype;_.intervals=function(t){return t.push.apply(t,this.leftPoints),this.left&&this.left.intervals(t),this.right&&this.right.intervals(t),t},_.insert=function(t){var e=this.count-this.leftPoints.length;if(this.count+=1,t[1]<this.mid)this.left?4*(this.left.count+1)>3*(e+1)?a(this,t):this.left.insert(t):this.left=p([t]);else if(t[0]>this.mid)this.right?4*(this.right.count+1)>3*(e+1)?a(this,t):this.right.insert(t):this.right=p([t]);else{var r=g.ge(this.leftPoints,t,f),n=g.ge(this.rightPoints,t,d);this.leftPoints.splice(r,0,t),this.rightPoints.splice(n,0,t)}},_.remove=function(t){var e=this.count-this.leftPoints;if(t[1]<this.mid){if(!this.left)return y;var r=this.right?this.right.count:0;if(4*r>3*(e-1))return s(this,t);var n=this.left.remove(t);return n===x?(this.left=null,this.count-=1,b):(n===b&&(this.count-=1),n)}if(t[0]>this.mid){if(!this.right)return y;var o=this.left?this.left.count:0;if(4*o>3*(e-1))return s(this,t);var n=this.right.remove(t);return n===x?(this.right=null,this.count-=1,b):(n===b&&(this.count-=1),n)}if(1===this.count)return this.leftPoints[0]===t?x:y;if(1===this.leftPoints.length&&this.leftPoints[0]===t){if(this.left&&this.right){for(var a=this,l=this.left;l.right;)a=l,l=l.right;if(a===this)l.right=this.right;else{var u=this.left,n=this.right;a.count-=l.count,a.right=l.left,l.left=u,l.right=n}i(this,l),this.count=(this.left?this.left.count:0)+(this.right?this.right.count:0)+this.leftPoints.length}else this.left?i(this,this.left):i(this,this.right);return b}for(var u=g.ge(this.leftPoints,t,f);u<this.leftPoints.length&&this.leftPoints[u][0]===t[0];++u)if(this.leftPoints[u]===t){this.count-=1,this.leftPoints.splice(u,1);for(var n=g.ge(this.rightPoints,t,d);n<this.rightPoints.length&&this.rightPoints[n][1]===t[1];++n)if(this.rightPoints[n]===t)return this.rightPoints.splice(n,1),b}return y},_.queryPoint=function(t,e){if(t<this.mid){if(this.left){var r=this.left.queryPoint(t,e);if(r)return r}return l(this.leftPoints,t,e)}if(t>this.mid){if(this.right){var r=this.right.queryPoint(t,e);if(r)return r}return u(this.rightPoints,t,e)}return c(this.leftPoints,e)},_.queryInterval=function(t,e,r){if(t<this.mid&&this.left){var n=this.left.queryInterval(t,e,r);if(n)return n}if(e>this.mid&&this.right){var n=this.right.queryInterval(t,e,r);if(n)return n}return e<this.mid?l(this.leftPoints,e,r):t>this.mid?u(this.rightPoints,t,r):c(this.leftPoints,r)};var w=v.prototype;w.insert=function(t){this.root?this.root.insert(t):this.root=new n(t[0],null,null,[t],[t])},w.remove=function(t){if(this.root){var e=this.root.remove(t);return e===x&&(this.root=null),e!==y}return!1},w.queryPoint=function(t,e){return this.root?this.root.queryPoint(t,e):void 0},w.queryInterval=function(t,e,r){return e>=t&&this.root?this.root.queryInterval(t,e,r):void 0},Object.defineProperty(w,"count",{get:function(){return this.root?this.root.count:0}}),Object.defineProperty(w,"intervals",{get:function(){return this.root?this.root.intervals([]):[]}})},{"binary-search-bounds":468}],470:[function(t,e,r){"use strict";function n(t,e){var r,n;if(e[0][0]<e[1][0])r=e[0],n=e[1];else{if(!(e[0][0]>e[1][0])){var i=Math.min(t[0][1],t[1][1]),a=Math.max(t[0][1],t[1][1]),s=Math.min(e[0][1],e[1][1]),l=Math.max(e[0][1],e[1][1]);return s>a?a-s:i>l?i-l:a-l}r=e[1],n=e[0]}var u,c;t[0][1]<t[1][1]?(u=t[0],c=t[1]):(u=t[1],c=t[0]);var h=o(n,r,u);return h?h:(h=o(n,r,c),h?h:c-n)}function i(t,e){var r,i;if(e[0][0]<e[1][0])r=e[0],i=e[1];else{if(!(e[0][0]>e[1][0]))return n(e,t);r=e[1],i=e[0]}var a,s;if(t[0][0]<t[1][0])a=t[0],s=t[1];else{if(!(t[0][0]>t[1][0]))return-n(t,e);a=t[1],s=t[0]}var l=o(r,i,s),u=o(r,i,a);if(0>l){if(0>=u)return l}else if(l>0){if(u>=0)return l}else if(u)return u;if(l=o(s,a,i),u=o(s,a,r),0>l){if(0>=u)return l}else if(l>0){if(u>=0)return l}else if(u)return u;return i[0]-s[0]}e.exports=i;var o=t("robust-orientation")},{"robust-orientation":439}],471:[function(t,e,r){"use strict";function n(t,e,r,n,i,o){this._color=t,this.key=e,this.value=r,this.left=n,this.right=i,this._count=o}function i(t){return new n(t._color,t.key,t.value,t.left,t.right,t._count)}function o(t,e){return new n(t,e.key,e.value,e.left,e.right,e._count)}function a(t){t._count=1+(t.left?t.left._count:0)+(t.right?t.right._count:0)}function s(t,e){this._compare=t,this.root=e}function l(t,e){if(e.left){var r=l(t,e.left);if(r)return r}var r=t(e.key,e.value);return r?r:e.right?l(t,e.right):void 0}function u(t,e,r,n){var i=e(t,n.key);if(0>=i){if(n.left){var o=u(t,e,r,n.left);if(o)return o}var o=r(n.key,n.value);if(o)return o}return n.right?u(t,e,r,n.right):void 0}function c(t,e,r,n,i){var o,a=r(t,i.key),s=r(e,i.key);if(0>=a){if(i.left&&(o=c(t,e,r,n,i.left)))return o;if(s>0&&(o=n(i.key,i.value)))return o}return s>0&&i.right?c(t,e,r,n,i.right):void 0}function h(t,e){this.tree=t,this._stack=e}function f(t,e){t.key=e.key,t.value=e.value,t.left=e.left,t.right=e.right,t._color=e._color,t._count=e._count}function d(t){for(var e,r,n,s,l=t.length-1;l>=0;--l){if(e=t[l],0===l)return void(e._color=g);if(r=t[l-1],r.left===e){if(n=r.right,n.right&&n.right._color===m){if(n=r.right=i(n),s=n.right=i(n.right),r.right=n.left,n.left=r,n.right=s,n._color=r._color,e._color=g,r._color=g,s._color=g,a(r),a(n),l>1){var u=t[l-2];u.left===r?u.left=n:u.right=n}return void(t[l-1]=n)}if(n.left&&n.left._color===m){if(n=r.right=i(n),s=n.left=i(n.left),r.right=s.left,n.left=s.right,s.left=r,s.right=n,s._color=r._color,r._color=g,n._color=g,e._color=g,a(r),a(n),a(s),l>1){var u=t[l-2];u.left===r?u.left=s:u.right=s}return void(t[l-1]=s)}if(n._color===g){if(r._color===m)return r._color=g,void(r.right=o(m,n));r.right=o(m,n);continue}if(n=i(n),r.right=n.left,n.left=r,n._color=r._color,r._color=m,a(r),a(n),l>1){var u=t[l-2];u.left===r?u.left=n:u.right=n}t[l-1]=n,t[l]=r,l+1<t.length?t[l+1]=e:t.push(e),l+=2}else{if(n=r.left,n.left&&n.left._color===m){if(n=r.left=i(n),s=n.left=i(n.left),r.left=n.right,n.right=r,n.left=s,n._color=r._color,e._color=g,r._color=g,s._color=g,a(r),a(n),l>1){var u=t[l-2];u.right===r?u.right=n:u.left=n}return void(t[l-1]=n)}if(n.right&&n.right._color===m){if(n=r.left=i(n),s=n.right=i(n.right),r.left=s.right,n.right=s.left,s.right=r,s.left=n,s._color=r._color,r._color=g,n._color=g,e._color=g,a(r),a(n),a(s),l>1){var u=t[l-2];u.right===r?u.right=s:u.left=s}return void(t[l-1]=s)}if(n._color===g){if(r._color===m)return r._color=g,void(r.left=o(m,n));r.left=o(m,n);continue}if(n=i(n),r.left=n.right,n.right=r,n._color=r._color,r._color=m,a(r),a(n),l>1){var u=t[l-2];u.right===r?u.right=n:u.left=n}t[l-1]=n,t[l]=r,l+1<t.length?t[l+1]=e:t.push(e),l+=2}}}function p(t,e){return e>t?-1:t>e?1:0}function v(t){return new s(t||p,null)}e.exports=v;var m=0,g=1,y=s.prototype;Object.defineProperty(y,"keys",{get:function(){var t=[];return this.forEach(function(e,r){t.push(e)}),t}}),Object.defineProperty(y,"values",{get:function(){var t=[];return this.forEach(function(e,r){t.push(r)}),t}}),Object.defineProperty(y,"length",{get:function(){return this.root?this.root._count:0}}),y.insert=function(t,e){for(var r=this._compare,i=this.root,l=[],u=[];i;){var c=r(t,i.key);l.push(i),u.push(c),i=0>=c?i.left:i.right}l.push(new n(m,t,e,null,null,1));for(var h=l.length-2;h>=0;--h){var i=l[h];u[h]<=0?l[h]=new n(i._color,i.key,i.value,l[h+1],i.right,i._count+1):l[h]=new n(i._color,i.key,i.value,i.left,l[h+1],i._count+1)}for(var h=l.length-1;h>1;--h){var f=l[h-1],i=l[h];if(f._color===g||i._color===g)break;var d=l[h-2];if(d.left===f)if(f.left===i){var p=d.right;if(!p||p._color!==m){if(d._color=m,d.left=f.right,f._color=g,f.right=d,l[h-2]=f,l[h-1]=i,a(d),a(f),h>=3){var v=l[h-3];v.left===d?v.left=f:v.right=f}break}f._color=g,d.right=o(g,p),d._color=m,h-=1}else{var p=d.right;if(!p||p._color!==m){if(f.right=i.left,d._color=m,d.left=i.right,i._color=g,i.left=f,i.right=d,l[h-2]=i,l[h-1]=f,a(d),a(f),a(i),h>=3){var v=l[h-3];v.left===d?v.left=i:v.right=i}break}f._color=g,d.right=o(g,p),d._color=m,h-=1}else if(f.right===i){var p=d.left;if(!p||p._color!==m){if(d._color=m,d.right=f.left,f._color=g,f.left=d,l[h-2]=f,l[h-1]=i,a(d),a(f),h>=3){var v=l[h-3];v.right===d?v.right=f:v.left=f}break}f._color=g,d.left=o(g,p),d._color=m,h-=1}else{var p=d.left;if(!p||p._color!==m){if(f.left=i.right,d._color=m,d.right=i.left,i._color=g,i.right=f,i.left=d,l[h-2]=i,l[h-1]=f,a(d),a(f),a(i),h>=3){var v=l[h-3];v.right===d?v.right=i:v.left=i}break}f._color=g,d.left=o(g,p),d._color=m,h-=1}}return l[0]._color=g,new s(r,l[0])},y.forEach=function(t,e,r){if(this.root)switch(arguments.length){case 1:return l(t,this.root);case 2:return u(e,this._compare,t,this.root);case 3:if(this._compare(e,r)>=0)return;return c(e,r,this._compare,t,this.root)}},Object.defineProperty(y,"begin",{get:function(){for(var t=[],e=this.root;e;)t.push(e),e=e.left;return new h(this,t)}}),Object.defineProperty(y,"end",{get:function(){for(var t=[],e=this.root;e;)t.push(e),e=e.right;return new h(this,t)}}),y.at=function(t){if(0>t)return new h(this,[]);for(var e=this.root,r=[];;){if(r.push(e),e.left){if(t<e.left._count){e=e.left;continue}t-=e.left._count}if(!t)return new h(this,r);if(t-=1,!e.right)break;if(t>=e.right._count)break;e=e.right}return new h(this,[])},y.ge=function(t){for(var e=this._compare,r=this.root,n=[],i=0;r;){var o=e(t,r.key);n.push(r),0>=o&&(i=n.length),r=0>=o?r.left:r.right}return n.length=i,new h(this,n)},y.gt=function(t){for(var e=this._compare,r=this.root,n=[],i=0;r;){var o=e(t,r.key);n.push(r),0>o&&(i=n.length),r=0>o?r.left:r.right}return n.length=i,new h(this,n)},y.lt=function(t){for(var e=this._compare,r=this.root,n=[],i=0;r;){var o=e(t,r.key);n.push(r),o>0&&(i=n.length),r=0>=o?r.left:r.right}return n.length=i,new h(this,n)},y.le=function(t){for(var e=this._compare,r=this.root,n=[],i=0;r;){var o=e(t,r.key);n.push(r),o>=0&&(i=n.length),r=0>o?r.left:r.right}return n.length=i,new h(this,n)},y.find=function(t){for(var e=this._compare,r=this.root,n=[];r;){var i=e(t,r.key);if(n.push(r),0===i)return new h(this,n);r=0>=i?r.left:r.right}return new h(this,[])},y.remove=function(t){var e=this.find(t);return e?e.remove():this},y.get=function(t){for(var e=this._compare,r=this.root;r;){var n=e(t,r.key);if(0===n)return r.value;r=0>=n?r.left:r.right}};var b=h.prototype;Object.defineProperty(b,"valid",{get:function(){return this._stack.length>0}}),Object.defineProperty(b,"node",{get:function(){return this._stack.length>0?this._stack[this._stack.length-1]:null},enumerable:!0}),b.clone=function(){return new h(this.tree,this._stack.slice())},b.remove=function(){var t=this._stack;if(0===t.length)return this.tree;var e=new Array(t.length),r=t[t.length-1];e[e.length-1]=new n(r._color,r.key,r.value,r.left,r.right,r._count);for(var i=t.length-2;i>=0;--i){var r=t[i];r.left===t[i+1]?e[i]=new n(r._color,r.key,r.value,e[i+1],r.right,r._count):e[i]=new n(r._color,r.key,r.value,r.left,e[i+1],r._count)}if(r=e[e.length-1],r.left&&r.right){var o=e.length;for(r=r.left;r.right;)e.push(r),r=r.right;var a=e[o-1];e.push(new n(r._color,a.key,a.value,r.left,r.right,r._count)),e[o-1].key=r.key,e[o-1].value=r.value;for(var i=e.length-2;i>=o;--i)r=e[i],e[i]=new n(r._color,r.key,r.value,r.left,e[i+1],r._count);e[o-1].left=e[o]}if(r=e[e.length-1],r._color===m){var l=e[e.length-2];l.left===r?l.left=null:l.right===r&&(l.right=null),e.pop();for(var i=0;i<e.length;++i)e[i]._count--;return new s(this.tree._compare,e[0])}if(r.left||r.right){r.left?f(r,r.left):r.right&&f(r,r.right),r._color=g;for(var i=0;i<e.length-1;++i)e[i]._count--;return new s(this.tree._compare,e[0])}if(1===e.length)return new s(this.tree._compare,null);for(var i=0;i<e.length;++i)e[i]._count--;var u=e[e.length-2];return d(e),u.left===r?u.left=null:u.right=null,new s(this.tree._compare,e[0])},Object.defineProperty(b,"key",{get:function(){return this._stack.length>0?this._stack[this._stack.length-1].key:void 0},enumerable:!0}),Object.defineProperty(b,"value",{get:function(){return this._stack.length>0?this._stack[this._stack.length-1].value:void 0},enumerable:!0}),Object.defineProperty(b,"index",{get:function(){var t=0,e=this._stack;if(0===e.length){var r=this.tree.root;return r?r._count:0}e[e.length-1].left&&(t=e[e.length-1].left._count);for(var n=e.length-2;n>=0;--n)e[n+1]===e[n].right&&(++t,e[n].left&&(t+=e[n].left._count));return t},enumerable:!0}),b.next=function(){var t=this._stack;if(0!==t.length){var e=t[t.length-1];if(e.right)for(e=e.right;e;)t.push(e),e=e.left;else for(t.pop();t.length>0&&t[t.length-1].right===e;)e=t[t.length-1],t.pop()}},Object.defineProperty(b,"hasNext",{get:function(){var t=this._stack;if(0===t.length)return!1;if(t[t.length-1].right)return!0;for(var e=t.length-1;e>0;--e)if(t[e-1].left===t[e])return!0;return!1}}),b.update=function(t){var e=this._stack;if(0===e.length)throw new Error("Can't update empty node!");var r=new Array(e.length),i=e[e.length-1];r[r.length-1]=new n(i._color,i.key,t,i.left,i.right,i._count);for(var o=e.length-2;o>=0;--o)i=e[o],i.left===e[o+1]?r[o]=new n(i._color,i.key,i.value,r[o+1],i.right,i._count):r[o]=new n(i._color,i.key,i.value,i.left,r[o+1],i._count);return new s(this.tree._compare,r[0])},b.prev=function(){var t=this._stack;if(0!==t.length){var e=t[t.length-1];if(e.left)for(e=e.left;e;)t.push(e),e=e.right;else for(t.pop();t.length>0&&t[t.length-1].left===e;)e=t[t.length-1],t.pop()}},Object.defineProperty(b,"hasPrev",{get:function(){var t=this._stack;if(0===t.length)return!1;if(t[t.length-1].left)return!0;for(var e=t.length-1;e>0;--e)if(t[e-1].right===t[e])return!0;return!1}})},{}],472:[function(t,e,r){"use strict";function n(t,e,r){this.slabs=t,this.coordinates=e,this.horizontal=r}function i(t,e){return t.y-e}function o(t,e){for(var r=null;t;){var n,i,a=t.key;a[0][0]<a[1][0]?(n=a[0],i=a[1]):(n=a[1],i=a[0]);var s=h(n,i,e);if(0>s)t=t.left;else if(s>0)if(e[0]!==a[1][0])r=t,t=t.right;else{var l=o(t.right,e);if(l)return l;t=t.left}else{if(e[0]!==a[1][0])return t;var l=o(t.right,e);if(l)return l;t=t.left}}return r}function a(t,e,r,n){this.y=t,this.index=e,this.start=r,this.closed=n}function s(t,e,r,n){this.x=t,this.segment=e,this.create=r,this.index=n}function l(t){for(var e=t.length,r=2*e,i=new Array(r),o=0;e>o;++o){var l=t[o],u=l[0][0]<l[1][0];i[2*o]=new s(l[0][0],l,u,o),i[2*o+1]=new s(l[1][0],l,!u,o)}i.sort(function(t,e){var r=t.x-e.x;return r?r:(r=t.create-e.create,r?r:Math.min(t.segment[0][1],t.segment[1][1])-Math.min(e.segment[0][1],e.segment[1][1]))});for(var h=c(f),d=[],p=[],v=[],o=0;r>o;){for(var m=i[o].x,g=[];r>o;){var y=i[o];if(y.x!==m)break;o+=1,y.segment[0][0]===y.x&&y.segment[1][0]===y.x?y.create&&(y.segment[0][1]<y.segment[1][1]?(g.push(new a(y.segment[0][1],y.index,!0,!0)),g.push(new a(y.segment[1][1],y.index,!1,!1))):(g.push(new a(y.segment[1][1],y.index,!0,!1)),g.push(new a(y.segment[0][1],y.index,!1,!0)))):h=y.create?h.insert(y.segment,y.index):h.remove(y.segment)}d.push(h.root),p.push(m),v.push(g)}return new n(d,p,v)}e.exports=l;var u=t("binary-search-bounds"),c=t("functional-red-black-tree"),h=t("robust-orientation"),f=t("./lib/order-segments"),d=n.prototype;d.castUp=function(t){var e=u.le(this.coordinates,t[0]);if(0>e)return-1;var r=(this.slabs[e],o(this.slabs[e],t)),n=-1;if(r&&(n=r.value),this.coordinates[e]===t[0]){var a=null;if(r&&(a=r.key),e>0){var s=o(this.slabs[e-1],t);s&&(a?f(s.key,a)>0&&(a=s.key,n=s.value):(n=s.value,a=s.key))}var l=this.horizontal[e];if(l.length>0){var c=u.ge(l,t[1],i);if(c<l.length){var d=l[c];if(t[1]===d.y){if(d.closed)return d.index;for(;c<l.length-1&&l[c+1].y===t[1];)if(c+=1,d=l[c],d.closed)return d.index;if(d.y===t[1]&&!d.start){if(c+=1,c>=l.length)return n;d=l[c]}}if(d.start)if(a){var p=h(a[0],a[1],[t[0],d.y]);a[0][0]>a[1][0]&&(p=-p),p>0&&(n=d.index)}else n=d.index;else d.y!==t[1]&&(n=d.index)}}}return n}},{"./lib/order-segments":470,"binary-search-bounds":468,"functional-red-black-tree":471,"robust-orientation":439}],473:[function(t,e,r){function n(){return!0}function i(t){return function(e,r){var i=t[e];return i?!!i.queryPoint(r,n):!1}}function o(t){for(var e={},r=0;r<t.length;++r){var n=t[r],o=n[0][0],a=n[0][1],s=n[1][1],l=[Math.min(a,s),Math.max(a,s)];o in e?e[o].push(l):e[o]=[l]}for(var u={},c=Object.keys(e),r=0;r<c.length;++r){var h=e[c[r]];u[c[r]]=d(h)}return i(u)}function a(t,e){return function(r){var n=p.le(e,r[0]);if(0>n)return 1;var i=t[n];if(!i){if(!(n>0&&e[n]===r[0]))return 1;i=t[n-1]}for(var o=1;i;){var a=i.key,s=h(r,a[0],a[1]);if(a[0][0]<a[1][0])if(0>s)i=i.left;else{if(!(s>0))return 0;o=-1,i=i.right}else if(s>0)i=i.left;else{if(!(0>s))return 0;o=1,i=i.right}}return o}}function s(t){return 1}function l(t){return function(e){return t(e[0],e[1])?0:1}}function u(t,e){return function(r){return t(r[0],r[1])?0:e(r)}}function c(t){for(var e=t.length,r=[],n=[],i=0;e>i;++i)for(var c=t[i],h=c.length,d=h-1,p=0;h>p;d=p++){var v=c[d],m=c[p];v[0]===m[0]?n.push([v,m]):r.push([v,m])}if(0===r.length)return 0===n.length?s:l(o(n));var g=f(r),y=a(g.slabs,g.coordinates);return 0===n.length?y:u(o(n),y)}e.exports=c;var h=t("robust-orientation")[3],f=t("slab-decomposition"),d=t("interval-tree-1d"),p=t("binary-search-bounds")},{"binary-search-bounds":468,"interval-tree-1d":469,"robust-orientation":439,"slab-decomposition":472}],474:[function(t,e,r){"use strict";function n(t,e){for(var r=new Array(t),n=0;t>n;++n)r[n]=e;return r}function i(t){for(var e=new Array(t),r=0;t>r;++r)e[r]=[];return e}function o(t,e){function r(t){for(var r=t.length,n=[0],i=0;r>i;++i){var o=e[t[i]],a=e[t[(i+1)%r]],s=u(-o[0],o[1]),l=u(-o[0],a[1]),h=u(a[0],o[1]),f=u(a[0],a[1]);n=c(n,c(c(s,l),c(h,f)))}return n[n.length-1]>0}function o(t){for(var e=t.length,r=0;e>r;++r)if(!R[t[r]])return!1;return!0}var d=f(t,e);t=d[0],e=d[1];for(var p=e.length,v=(t.length,a(t,e.length)),m=0;p>m;++m)if(v[m].length%2===1)throw new Error("planar-graph-to-polyline: graph must be manifold");var g=s(t,e);g=g.filter(r);for(var y=g.length,b=new Array(y),x=new Array(y),m=0;y>m;++m){b[m]=m;var _=new Array(y),w=g[m].map(function(t){return e[t]}),M=l([w]),k=0;t:for(var A=0;y>A;++A)if(_[A]=0,m!==A){for(var T=g[A],E=T.length,S=0;E>S;++S){var L=M(e[T[S]]);if(0!==L){0>L&&(_[A]=1,k+=1);continue t}}_[A]=1,k+=1}x[m]=[k,m,_]}x.sort(function(t,e){return e[0]-t[0]});for(var m=0;y>m;++m)for(var _=x[m],z=_[1],I=_[2],A=0;y>A;++A)I[A]&&(b[A]=z);for(var P=i(y),m=0;y>m;++m)P[m].push(b[m]),P[b[m]].push(m);for(var C={},R=n(p,!1),m=0;y>m;++m)for(var T=g[m],E=T.length,A=0;E>A;++A){var D=T[A],O=T[(A+1)%E],F=Math.min(D,O)+":"+Math.max(D,O);if(F in C){var j=C[F];P[j].push(m),P[m].push(j),R[D]=R[O]=!0}else C[F]=m}for(var N=[],B=n(y,-1),m=0;y>m;++m)b[m]!==m||o(g[m])?B[m]=-1:(N.push(m),B[m]=0);for(var d=[];N.length>0;){var U=N.pop(),V=P[U];h(V,function(t,e){return t-e});var q,G=V.length,H=B[U];if(0===H){var T=g[U];q=[T]}for(var m=0;G>m;++m){var X=V[m];if(!(B[X]>=0)&&(B[X]=1^H,N.push(X),0===H)){var T=g[X];o(T)||(T.reverse(),q.push(T))}}0===H&&d.push(q)}return d}e.exports=o;var a=t("edges-to-adjacency-list"),s=t("planar-dual"),l=t("point-in-big-polygon"),u=t("two-product"),c=t("robust-sum"),h=t("uniq"),f=t("./lib/trim-leaves")},{"./lib/trim-leaves":462,"edges-to-adjacency-list":463,"planar-dual":464,"point-in-big-polygon":473,"robust-sum":442,"two-product":456,uniq:459}],475:[function(t,e,r){arguments[4][51][0].apply(r,arguments)},{dup:51}],476:[function(t,e,r){"use strict";
"use restrict";function n(t){this.roots=new Array(t),this.ranks=new Array(t);for(var e=0;t>e;++e)this.roots[e]=e,this.ranks[e]=0}e.exports=n,n.prototype.length=function(){return this.roots.length},n.prototype.makeSet=function(){var t=this.roots.length;return this.roots.push(t),this.ranks.push(0),t},n.prototype.find=function(t){for(var e=this.roots;e[t]!==t;){var r=e[t];e[t]=e[r],t=r}return t},n.prototype.link=function(t,e){var r=this.find(t),n=this.find(e);if(r!==n){var i=this.ranks,o=this.roots,a=i[r],s=i[n];s>a?o[r]=n:a>s?o[n]=r:(o[n]=r,++i[r])}}},{}],477:[function(t,e,r){arguments[4][244][0].apply(r,arguments)},{"bit-twiddle":475,dup:244,"union-find":476}],478:[function(t,e,r){"use strict";function n(t,e,r){var n=Math.abs(o(t,e,r)),i=Math.sqrt(Math.pow(e[0]-r[0],2)+Math.pow(e[1]-r[1],2));return n/i}function i(t,e,r){function i(t){if(x[t])return 1/0;var r=g[t],i=y[t];return 0>r||0>i?1/0:n(e[t],e[r],e[i])}function o(t,e){var r=A[t],n=A[e];A[t]=n,A[e]=r,T[r]=e,T[n]=t}function s(t){return b[A[t]]}function l(t){return 1&t?t-1>>1:(t>>1)-1}function u(t){for(var e=s(t);;){var r=e,n=2*t+1,i=2*(t+1),a=t;if(S>n){var l=s(n);r>l&&(a=n,r=l)}if(S>i){var u=s(i);r>u&&(a=i)}if(a===t)return t;o(t,a),t=a}}function c(t){for(var e=s(t);t>0;){var r=l(t);if(r>=0){var n=s(r);if(n>e){o(t,r),t=r;continue}}return t}}function h(){if(S>0){var t=A[0];return o(0,S-1),S-=1,u(0),t}return-1}function f(t,e){var r=A[t];return b[r]===e?t:(b[r]=-(1/0),c(t),h(),b[r]=e,S+=1,c(S-1))}function d(t){if(!x[t]){x[t]=!0;var e=g[t],r=y[t];g[r]>=0&&(g[r]=e),y[e]>=0&&(y[e]=r),T[e]>=0&&f(T[e],i(e)),T[r]>=0&&f(T[r],i(r))}}function p(t,e){if(t[e]<0)return e;var r=e,n=e;do{var i=t[n];if(!x[n]||0>i||i===n)break;if(n=i,i=t[n],!x[n]||0>i||i===n)break;n=i,r=t[r]}while(r!==n);for(var o=e;o!==n;o=t[o])t[o]=n;return n}for(var v=e.length,m=t.length,g=new Array(v),y=new Array(v),b=new Array(v),x=new Array(v),_=0;v>_;++_)g[_]=y[_]=-1,b[_]=1/0,x[_]=!1;for(var _=0;m>_;++_){var w=t[_];if(2!==w.length)throw new Error("Input must be a graph");var M=w[1],k=w[0];-1!==y[k]?y[k]=-2:y[k]=M,-1!==g[M]?g[M]=-2:g[M]=k}for(var A=[],T=new Array(v),_=0;v>_;++_){var E=b[_]=i(_);1/0>E?(T[_]=A.length,A.push(_)):T[_]=-1}for(var S=A.length,_=S>>1;_>=0;--_)u(_);for(;;){var L=h();if(0>L||b[L]>r)break;d(L)}for(var z=[],_=0;v>_;++_)x[_]||(T[_]=z.length,z.push(e[_].slice()));var I=(z.length,[]);return t.forEach(function(t){var e=p(g,t[0]),r=p(y,t[1]);if(e>=0&&r>=0&&e!==r){var n=T[e],i=T[r];n!==i&&I.push([n,i])}}),a.unique(a.normalize(I)),{positions:z,edges:I}}e.exports=i;var o=t("robust-orientation"),a=t("simplicial-complex")},{"robust-orientation":439,"simplicial-complex":477}],479:[function(t,e,r){"use strict";e.exports=["",{path:"M-2.4,-3V3L0.6,0Z",backoff:.6},{path:"M-3.7,-2.5V2.5L1.3,0Z",backoff:1.3},{path:"M-4.45,-3L-1.65,-0.2V0.2L-4.45,3L1.55,0Z",backoff:1.55},{path:"M-2.2,-2.2L-0.2,-0.2V0.2L-2.2,2.2L-1.4,3L1.6,0L-1.4,-3Z",backoff:1.6},{path:"M-4.4,-2.1L-0.6,-0.2V0.2L-4.4,2.1L-4,3L2,0L-4,-3Z",backoff:2},{path:"M2,0A2,2 0 1,1 0,-2A2,2 0 0,1 2,0Z",backoff:0},{path:"M2,2V-2H-2V2Z",backoff:0}]},{}],480:[function(t,e,r){"use strict";var n=t("./arrow_paths"),i=t("../../plots/font_attributes"),o=t("../../plots/cartesian/constants"),a=t("../../lib/extend").extendFlat;e.exports={_isLinkedToArray:!0,text:{valType:"string"},textangle:{valType:"angle",dflt:0},font:a({},i,{}),opacity:{valType:"number",min:0,max:1,dflt:1},align:{valType:"enumerated",values:["left","center","right"],dflt:"center"},bgcolor:{valType:"color",dflt:"rgba(0,0,0,0)"},bordercolor:{valType:"color",dflt:"rgba(0,0,0,0)"},borderpad:{valType:"number",min:0,dflt:1},borderwidth:{valType:"number",min:0,dflt:1},showarrow:{valType:"boolean",dflt:!0},arrowcolor:{valType:"color"},arrowhead:{valType:"integer",min:0,max:n.length,dflt:1},arrowsize:{valType:"number",min:.3,dflt:1},arrowwidth:{valType:"number",min:.1},ax:{valType:"number",dflt:-10},ay:{valType:"number",dflt:-30},axref:{valType:"enumerated",dflt:"pixel",values:["pixel",o.idRegex.x.toString()]},ayref:{valType:"enumerated",dflt:"pixel",values:["pixel",o.idRegex.y.toString()]},xref:{valType:"enumerated",values:["paper",o.idRegex.x.toString()]},x:{valType:"number"},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"auto"},yref:{valType:"enumerated",values:["paper",o.idRegex.y.toString()]},y:{valType:"number"},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto"},_deprecated:{ref:{valType:"string"}}}},{"../../lib/extend":563,"../../plots/cartesian/constants":597,"../../plots/font_attributes":610,"./arrow_paths":479}],481:[function(t,e,r){"use strict";function n(t,e){function r(e,r){return u.coerce(t,n,m.layoutAttributes,e,r)}var n={};r("opacity"),r("align"),r("bgcolor");var i=r("bordercolor"),o=h.opacity(i);r("borderpad");var a=r("borderwidth"),s=r("showarrow");s&&(r("arrowcolor",o?n.bordercolor:h.defaultLine),r("arrowhead"),r("arrowsize"),r("arrowwidth",2*(o&&a||1)),r("ax"),r("ay"),r("axref"),r("ayref"),u.noneOrAll(t,n,["ax","ay"])),r("text",s?"&nbsp;":"new text"),r("textangle"),u.coerceFont(r,"font",e.font);for(var l=["x","y"],f=0;2>f;f++){var d=l[f],p={_fullLayout:e},v=c.coerceRef(t,n,p,d),g=c.coerceARef(t,n,p,d),y=.5;if("paper"!==v){var b=c.getFromId(p,v);if(y=b.range[0]+y*(b.range[1]-b.range[0]),-1!==["date","category"].indexOf(b.type)&&"string"==typeof t[d]){var x;if("date"===b.type){if(x=u.dateTime2ms(t[d]),x!==!1&&(t[d]=x),g===v){var _=u.dateTime2ms(t["a"+d]);_!==!1&&(t["a"+d]=_)}}else(b._categories||[]).length&&(x=b._categories.indexOf(t[d]),-1!==x&&(t[d]=x))}}r(d,y),s||r(d+"anchor")}return u.noneOrAll(t,n,["x","y"]),n}function i(t){var e=t._fullLayout;e.annotations.forEach(function(e){var r=c.getFromId(t,e.xref),n=c.getFromId(t,e.yref);if(r||n){var i=(e._xsize||0)/2,o=e._xshift||0,a=(e._ysize||0)/2,s=e._yshift||0,l=i-o,u=i+o,h=a-s,f=a+s;if(e.showarrow){var d=3*e.arrowsize*e.arrowwidth;l=Math.max(l,d),u=Math.max(u,d),h=Math.max(h,d),f=Math.max(f,d)}r&&r.autorange&&c.expand(r,[r.l2c(e.x)],{ppadplus:u,ppadminus:l}),n&&n.autorange&&c.expand(n,[n.l2c(e.y)],{ppadplus:f,ppadminus:h})}})}function o(t,e,r,n,i,o,a,s){var l=r-t,u=i-t,c=a-i,h=n-e,f=o-e,d=s-o,p=l*d-c*h;if(0===p)return null;var v=(u*d-c*f)/p,m=(u*h-l*f)/p;return 0>m||m>1||0>v||v>1?null:{x:t+l*v,y:e+h*v}}var a=t("d3"),s=t("fast-isnumeric"),l=t("../../plotly"),u=t("../../lib"),c=t("../../plots/cartesian/axes"),h=t("../color"),f=t("../drawing"),d=t("../../lib/svg_text_utils"),p=t("../../lib/setcursor"),v=t("../dragelement"),m=e.exports={};m.ARROWPATHS=t("./arrow_paths"),m.layoutAttributes=t("./attributes"),m.supplyLayoutDefaults=function(t,e){for(var r=t.annotations||[],i=e.annotations=[],o=0;o<r.length;o++)i.push(n(r[o]||{},e))},m.drawAll=function(t){var e=t._fullLayout;e._infolayer.selectAll(".annotation").remove();for(var r=0;r<e.annotations.length;r++)m.draw(t,r);return l.Plots.previousPromises(t)},m.add=function(t){var e=t._fullLayout.annotations.length;l.relayout(t,"annotations["+e+"]","add")},m.draw=function(t,e,r,i){function g(t){return t.call(f.font,Q).attr({"text-anchor":{left:"start",right:"end"}[U.align]||"middle"}),d.convertToTspans(t,y),t}function y(){function r(t,e){return"auto"===e&&(e=1/3>t?"left":t>2/3?"right":"center"),{center:0,middle:0,left:.5,bottom:-.5,right:-.5,top:.5}[e]}tt.selectAll("tspan.line").attr({y:0,x:0});var n=W.select(".annotation-math-group"),i=!n.empty(),s=f.bBox((i?n:tt).node()),d=s.width,g=s.height,y=Math.round(d+2*J),b=Math.round(g+2*J);U._w=d,U._h=g;var x=!1;if(["x","y"].forEach(function(e){var n,i=U[e+"ref"]||e,o=c.getFromId(t,i),a=(H+("x"===e?0:90))*Math.PI/180,s=y*Math.abs(Math.cos(a))+b*Math.abs(Math.sin(a)),l=U[e+"anchor"];if(o){if(!o.autorange&&(U[e]-o.range[0])*(U[e]-o.range[1])>0&&(U["a"+e+"ref"]===i?(U["a"+e]-o.range[0])*(U["a"+e]-o.range[1])>0&&(x=!0):x=!0,x))return;G[e]=o._offset+o.l2p(U[e]),n=.5}else n=U[e],"y"===e&&(n=1-n),G[e]="x"===e?L.l+L.w*n:L.t+L.h*n;var u=0;U["a"+e+"ref"]===i?G["aa"+e]=o._offset+o.l2p(U["a"+e]):(u=U.showarrow?U["a"+e]:s*r(n,l),G[e]+=u),U["_"+e+"type"]=o&&o.type,U["_"+e+"size"]=s,U["_"+e+"shift"]=u}),x)return void W.remove();var w,M;U.showarrow&&(w=U.axref===U.xref?G.x:u.constrain(G.x-U.ax,1,_.width-1),M=U.ayref===U.yref?G.y:u.constrain(G.y-U.ay,1,_.height-1)),G.x=u.constrain(G.x,1,_.width-1),G.y=u.constrain(G.y,1,_.height-1);var k=J-s.top,A=J-s.left;i?n.select("svg").attr({x:J-1,y:J}):(tt.attr({x:A,y:k}),tt.selectAll("tspan.line").attr({y:k,x:A})),$.call(f.setRect,Z/2,Z/2,y-Z,b-Z);var T=0,E=0;T=U.axref===U.xref?Math.round(G.aax-y/2):Math.round(G.x-y/2),E=U.ayref===U.yref?Math.round(G.aay-b/2):Math.round(G.y-b/2),W.call(u.setTranslate,T,E);var S="annotations["+e+"]",z=function(r,n){a.select(t).selectAll('.annotation-arrow-g[data-index="'+e+'"]').remove();var i,s;i=U.axref===U.xref?G.aax+r:G.x+r,s=U.ayref===U.yref?G.aay+n:G.y+n;var c=u.rotationXYMatrix(H,i,s),f=u.apply2DTransform(c),d=u.apply2DTransform2(c),p=$.attr("width")/2,g=$.attr("height")/2,y=[[i-p,s-g,i-p,s+g],[i-p,s+g,i+p,s+g],[i+p,s+g,i+p,s-g],[i+p,s-g,i-p,s-g]].map(d);if(!y.reduce(function(t,e){return t^!!o(w,M,w+1e6,M+1e6,e[0],e[1],e[2],e[3])},!1)){y.forEach(function(t){var e=o(i,s,w,M,t[0],t[1],t[2],t[3]);e&&(i=e.x,s=e.y)});var b=U.arrowwidth,x=U.arrowcolor,_=X.append("g").style({opacity:h.opacity(x)}).classed("annotation-arrow-g",!0).attr("data-index",String(e)),k=_.append("path").attr("d","M"+i+","+s+"L"+w+","+M).style("stroke-width",b+"px").call(h.stroke,h.rgb(x));m.arrowhead(k,U.arrowhead,"end",U.arrowsize);var A=_.append("path").classed("annotation",!0).classed("anndrag",!0).attr({"data-index":String(e),d:"M3,3H-3V-3H3ZM0,0L"+(i-w)+","+(s-M),transform:"translate("+w+","+M+")"}).style("stroke-width",b+6+"px").call(h.stroke,"rgba(0,0,0,0)").call(h.fill,"rgba(0,0,0,0)");if(t._context.editable){var T,E,z;v.init({element:A.node(),prepFn:function(){var t=u.getTranslate(W);E=t.x,z=t.y,T={},V&&V.autorange&&(T[V._name+".autorange"]=!0),q&&q.autorange&&(T[q._name+".autorange"]=!0)},moveFn:function(t,e){_.attr("transform","translate("+t+","+e+")");var r=f(E,z),n=r[0]+t,i=r[1]+e;W.call(u.setTranslate,n,i),T[S+".x"]=V?U.x+t/V._m:(w+t-L.l)/L.w,T[S+".y"]=q?U.y+e/q._m:1-(M+e-L.t)/L.h,U.axref===U.xref&&(T[S+".ax"]=V?U.ax+t/V._m:(w+t-L.l)/L.w),U.ayref===U.yref&&(T[S+".ay"]=q?U.ay+e/q._m:1-(M+e-L.t)/L.h),Y.attr({transform:"rotate("+H+","+n+","+i+")"})},doneFn:function(e){if(e){l.relayout(t,T);var r=document.querySelector(".js-notes-box-panel");r&&r.redraw(r.selectedObj)}}})}}};U.showarrow&&z(0,0);var I=u.rotationXYMatrix(H,G.x,G.y),P=u.apply2DTransform(I);if(t._context.editable){var C,R,D;v.init({element:W.node(),prepFn:function(){var t=u.getTranslate(W);C=t.x,R=t.y,D={}},moveFn:function(t,e){W.call(u.setTranslate,C+t,R+e);var r="pointer";if(U.showarrow)U.axref===U.xref?D[S+".ax"]=V.p2l(V.l2p(U.ax)+t):D[S+".ax"]=U.ax+t,U.ayref===U.yref?D[S+".ay"]=q.p2l(q.l2p(U.ay)+e):D[S+".ay"]=U.ay+e,z(t,e);else{if(V)D[S+".x"]=U.x+t/V._m;else{var n=U._xsize/L.w,i=U.x+U._xshift/L.w-n/2;D[S+".x"]=v.align(i+t/L.w,n,0,1,U.xanchor)}if(q)D[S+".y"]=U.y+e/q._m;else{var o=U._ysize/L.h,a=U.y-U._yshift/L.h-o/2;D[S+".y"]=v.align(a-e/L.h,o,0,1,U.yanchor)}V&&q||(r=v.getCursor(V?.5:D[S+".x"],q?.5:D[S+".y"],U.xanchor,U.yanchor))}var s=P(C,R),l=s[0]+t,c=s[1]+e;W.call(u.setTranslate,C+t,R+e),Y.attr({transform:"rotate("+H+","+l+","+c+")"}),p(W,r)},doneFn:function(e){if(p(W),e){l.relayout(t,D);var r=document.querySelector(".js-notes-box-panel");r&&r.redraw(r.selectedObj)}}})}}var b,x=t.layout,_=t._fullLayout;if(!s(e)||-1===e){if(!e&&Array.isArray(i))return x.annotations=i,m.supplyLayoutDefaults(x,_),void m.drawAll(t);if("remove"===i)return delete x.annotations,_.annotations=[],void m.drawAll(t);if(r&&"add"!==i){for(b=0;b<_.annotations.length;b++)m.draw(t,b,r,i);return}e=_.annotations.length,_.annotations.push({})}if(!r&&i){if("remove"===i){for(_._infolayer.selectAll('.annotation[data-index="'+e+'"]').remove(),_.annotations.splice(e,1),x.annotations.splice(e,1),b=e;b<_.annotations.length;b++)_._infolayer.selectAll('.annotation[data-index="'+(b+1)+'"]').attr("data-index",String(b)),m.draw(t,b);return}if("add"===i||u.isPlainObject(i)){_.annotations.splice(e,0,{});var w=u.isPlainObject(i)?u.extendFlat({},i):{text:"New text"};for(x.annotations?x.annotations.splice(e,0,w):x.annotations=[w],b=_.annotations.length-1;b>e;b--)_._infolayer.selectAll('.annotation[data-index="'+(b-1)+'"]').attr("data-index",String(b)),m.draw(t,b)}}_._infolayer.selectAll('.annotation[data-index="'+e+'"]').remove();var M=x.annotations[e],k=_.annotations[e];if(M){var A={xref:M.xref,yref:M.yref},T={};"string"==typeof r&&r?T[r]=i:u.isPlainObject(r)&&(T=r);var E=Object.keys(T);for(b=0;b<E.length;b++){var S=E[b];u.nestedProperty(M,S).set(T[S])}var L=_._size,z=["x","y"];for(b=0;2>b;b++){var I=z[b];if(void 0===T[I]&&void 0!==M[I]){var P=c.getFromId(t,c.coerceRef(A,{},t,I)),C=c.getFromId(t,c.coerceRef(M,{},t,I)),R=M[I],D=k["_"+I+"type"];if(void 0!==T[I+"ref"]){var O="auto"===M[I+"anchor"],F="x"===I?L.w:L.h,j=(k["_"+I+"size"]||0)/(2*F);if(P&&C)R=(R-P.range[0])/(P.range[1]-P.range[0]),R=C.range[0]+R*(C.range[1]-C.range[0]);else if(P){if(R=(R-P.range[0])/(P.range[1]-P.range[0]),R=P.domain[0]+R*(P.domain[1]-P.domain[0]),O){var N=R+j,B=R-j;2/3>R+B?R=B:R+N>4/3&&(R=N)}}else C&&(O&&(1/3>R?R+=j:R>2/3&&(R-=j)),R=(R-C.domain[0])/(C.domain[1]-C.domain[0]),R=C.range[0]+R*(C.range[1]-C.range[0]))}C&&C===P&&D&&("log"===D&&"log"!==C.type?R=Math.pow(10,R):"log"!==D&&"log"===C.type&&(R=R>0?Math.log(R)/Math.LN10:void 0)),M[I]=R}}var U=n(M,_);_.annotations[e]=U;var V=c.getFromId(t,U.xref),q=c.getFromId(t,U.yref),G={x:0,y:0},H=+U.textangle||0,X=_._infolayer.append("g").classed("annotation",!0).attr("data-index",String(e)).style("opacity",U.opacity).on("click",function(){t._dragging=!1,t.emit("plotly_clickannotation",{index:e,annotation:M,fullAnnotation:U})}),Y=X.append("g").classed("annotation-text-g",!0).attr("data-index",String(e)),W=Y.append("g"),Z=U.borderwidth,K=U.borderpad,J=Z+K,$=W.append("rect").attr("class","bg").style("stroke-width",Z+"px").call(h.stroke,U.bordercolor).call(h.fill,U.bgcolor),Q=U.font,tt=W.append("text").classed("annotation",!0).attr("data-unformatted",U.text).text(U.text);t._context.editable?tt.call(d.makeEditable,W).call(g).on("edit",function(r){U.text=r,this.attr({"data-unformatted":U.text}),this.call(g);var n={};n["annotations["+e+"].text"]=U.text,V&&V.autorange&&(n[V._name+".autorange"]=!0),q&&q.autorange&&(n[q._name+".autorange"]=!0),l.relayout(t,n)}):tt.call(g),Y.attr({transform:"rotate("+H+","+G.x+","+G.y+")"}).call(f.setPosition,G.x,G.y)}},m.arrowhead=function(t,e,r,n){s(n)||(n=1);var i=t.node(),o=m.ARROWPATHS[e||0];if(o){"string"==typeof r&&r||(r="end");var l,u,c,d,p=(f.getPx(t,"stroke-width")||1)*n,v=t.style("stroke")||h.defaultLine,g=t.style("stroke-opacity")||1,y=r.indexOf("start")>=0,b=r.indexOf("end")>=0,x=o.backoff*p;if("line"===i.nodeName){if(l={x:+t.attr("x1"),y:+t.attr("y1")},u={x:+t.attr("x2"),y:+t.attr("y2")},c=Math.atan2(l.y-u.y,l.x-u.x),d=c+Math.PI,x){var _=x*Math.cos(c),w=x*Math.sin(c);y&&(l.x-=_,l.y-=w,t.attr({x1:l.x,y1:l.y})),b&&(u.x+=_,u.y+=w,t.attr({x2:u.x,y2:u.y}))}}else if("path"===i.nodeName){var M=i.getTotalLength(),k="";if(y){var A=i.getPointAtLength(0),T=i.getPointAtLength(.1);c=Math.atan2(A.y-T.y,A.x-T.x),l=i.getPointAtLength(Math.min(x,M)),x&&(k="0px,"+x+"px,")}if(b){var E=i.getPointAtLength(M),S=i.getPointAtLength(M-.1);if(d=Math.atan2(E.y-S.y,E.x-S.x),u=i.getPointAtLength(Math.max(0,M-x)),x){var L=k?2*x:x;k+=M-L+"px,"+M+"px"}}else k&&(k+=M+"px");k&&t.style("stroke-dasharray",k)}var z=function(r,n){e>5&&(n=0),a.select(i.parentElement).append("path").attr({"class":t.attr("class"),d:o.path,transform:"translate("+r.x+","+r.y+")rotate("+180*n/Math.PI+")scale("+p+")"}).style({fill:v,opacity:g,"stroke-width":0})};y&&z(l,c),b&&z(u,d)}},m.calcAutorange=function(t){var e=t._fullLayout,r=e.annotations;if(r.length&&t._fullData.length){var n={};r.forEach(function(t){n[t.xref]=!0,n[t.yref]=!0});var o=c.list(t).filter(function(t){return t.autorange&&n[t._id]});if(o.length)return u.syncOrAsync([m.drawAll,i],t)}}},{"../../lib":568,"../../lib/setcursor":577,"../../lib/svg_text_utils":581,"../../plotly":589,"../../plots/cartesian/axes":592,"../color":483,"../dragelement":504,"../drawing":506,"./arrow_paths":479,"./attributes":480,d3:119,"fast-isnumeric":123}],482:[function(t,e,r){"use strict";r.defaults=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],r.defaultLine="#444",r.lightLine="#eee",r.background="#fff",r.borderLine="#BEC8D9",r.lightFraction=1e3/11},{}],483:[function(t,e,r){"use strict";function n(t){if(o(t)||"string"!=typeof t)return t;var e=t.trim();if("rgb"!==e.substr(0,3))return t;var r=e.match(/^rgba?\s*\(([^()]*)\)$/);if(!r)return t;var n=r[1].trim().split(/\s*[\s,]\s*/),i="a"===e.charAt(3)&&4===n.length;if(!i&&3!==n.length)return t;for(var a=0;a<n.length;a++){if(!n[a].length)return t;if(n[a]=Number(n[a]),!(n[a]>=0))return t;if(3===a)n[a]>1&&(n[a]=1);else if(n[a]>=1)return t}var s=Math.round(255*n[0])+", "+Math.round(255*n[1])+", "+Math.round(255*n[2]);return i?"rgba("+s+", "+n[3]+")":"rgb("+s+")"}var i=t("tinycolor2"),o=t("fast-isnumeric"),a=e.exports={},s=t("./attributes");a.defaults=s.defaults,a.defaultLine=s.defaultLine,a.lightLine=s.lightLine,a.background=s.background,a.tinyRGB=function(t){var e=t.toRgb();return"rgb("+Math.round(e.r)+", "+Math.round(e.g)+", "+Math.round(e.b)+")"},a.rgb=function(t){return a.tinyRGB(i(t))},a.opacity=function(t){return t?i(t).getAlpha():0},a.addOpacity=function(t,e){var r=i(t).toRgb();return"rgba("+Math.round(r.r)+", "+Math.round(r.g)+", "+Math.round(r.b)+", "+e+")"},a.combine=function(t,e){var r=i(t).toRgb();if(1===r.a)return i(t).toRgbString();var n=i(e||a.background).toRgb(),o=1===n.a?n:{r:255*(1-n.a)+n.r*n.a,g:255*(1-n.a)+n.g*n.a,b:255*(1-n.a)+n.b*n.a},s={r:o.r*(1-r.a)+r.r*r.a,g:o.g*(1-r.a)+r.g*r.a,b:o.b*(1-r.a)+r.b*r.a};return i(s).toRgbString()},a.contrast=function(t,e,r){var n=i(t),o=n.isLight()?n.darken(r):n.lighten(e);return o.toString()},a.stroke=function(t,e){var r=i(e);t.style({stroke:a.tinyRGB(r),"stroke-opacity":r.getAlpha()})},a.fill=function(t,e){var r=i(e);t.style({fill:a.tinyRGB(r),"fill-opacity":r.getAlpha()})},a.clean=function(t){if(t&&"object"==typeof t){var e,r,i,o,s=Object.keys(t);for(e=0;e<s.length;e++)if(i=s[e],o=t[i],"color"===i.substr(i.length-5))if(Array.isArray(o))for(r=0;r<o.length;r++)o[r]=n(o[r]);else t[i]=n(o);else if("colorscale"===i.substr(i.length-10)&&Array.isArray(o))for(r=0;r<o.length;r++)Array.isArray(o[r])&&(o[r][1]=n(o[r][1]));else if(Array.isArray(o)){var l=o[0];if(!Array.isArray(l)&&l&&"object"==typeof l)for(r=0;r<o.length;r++)a.clean(o[r])}else o&&"object"==typeof o&&a.clean(o)}}},{"./attributes":482,"fast-isnumeric":123,tinycolor2:454}],484:[function(t,e,r){"use strict";var n=t("../../plots/cartesian/layout_attributes"),i=t("../../plots/font_attributes"),o=t("../../lib/extend").extendFlat;e.exports={thicknessmode:{valType:"enumerated",values:["fraction","pixels"],dflt:"pixels"},thickness:{valType:"number",min:0,dflt:30},lenmode:{valType:"enumerated",values:["fraction","pixels"],dflt:"fraction"},len:{valType:"number",min:0,dflt:1},x:{valType:"number",dflt:1.02,min:-2,max:3},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left"},xpad:{valType:"number",min:0,dflt:10},y:{valType:"number",dflt:.5,min:-2,max:3},yanchor:{valType:"enumerated",values:["top","middle","bottom"],dflt:"middle"},ypad:{valType:"number",min:0,dflt:10},outlinecolor:n.linecolor,outlinewidth:n.linewidth,bordercolor:n.linecolor,borderwidth:{valType:"number",min:0,dflt:0},bgcolor:{valType:"color",dflt:"rgba(0,0,0,0)"},tickmode:n.tickmode,nticks:n.nticks,tick0:n.tick0,dtick:n.dtick,tickvals:n.tickvals,ticktext:n.ticktext,ticks:o({},n.ticks,{dflt:""}),ticklen:n.ticklen,tickwidth:n.tickwidth,tickcolor:n.tickcolor,showticklabels:n.showticklabels,tickfont:n.tickfont,tickangle:n.tickangle,tickformat:n.tickformat,tickprefix:n.tickprefix,showtickprefix:n.showtickprefix,ticksuffix:n.ticksuffix,showticksuffix:n.showticksuffix,exponentformat:n.exponentformat,showexponent:n.showexponent,title:{valType:"string",dflt:"Click to enter colorscale title"},titlefont:o({},i,{}),titleside:{valType:"enumerated",values:["right","top","bottom"],dflt:"top"}}},{"../../lib/extend":563,"../../plots/cartesian/layout_attributes":601,"../../plots/font_attributes":610}],485:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../plots/cartesian/tick_value_defaults"),o=t("../../plots/cartesian/tick_mark_defaults"),a=t("../../plots/cartesian/tick_label_defaults"),s=t("./attributes");e.exports=function(t,e,r){function l(t,e){return n.coerce(c,u,s,t,e)}var u=e.colorbar={},c=t.colorbar||{},h=l("thicknessmode");l("thickness","fraction"===h?30/(r.width-r.margin.l-r.margin.r):30);var f=l("lenmode");l("len","fraction"===f?1:r.height-r.margin.t-r.margin.b),l("x"),l("xanchor"),l("xpad"),l("y"),l("yanchor"),l("ypad"),n.noneOrAll(c,u,["x","y"]),l("outlinecolor"),l("outlinewidth"),l("bordercolor"),l("borderwidth"),l("bgcolor"),i(c,u,l,"linear"),a(c,u,l,"linear",{outerTicks:!1,font:r.font,noHover:!0}),o(c,u,l,"linear",{outerTicks:!1,font:r.font,noHover:!0}),l("title"),n.coerceFont(l,"titlefont",r.font),l("titleside")}},{"../../lib":568,"../../plots/cartesian/tick_label_defaults":607,"../../plots/cartesian/tick_mark_defaults":608,"../../plots/cartesian/tick_value_defaults":609,"./attributes":484}],486:[function(t,e,r){"use strict";var n=t("d3"),i=t("tinycolor2"),o=t("../../plotly"),a=t("../../plots/plots"),s=t("../../plots/cartesian/axes"),l=t("../dragelement"),u=t("../../lib"),c=t("../../lib/extend").extendFlat,h=t("../../lib/setcursor"),f=t("../drawing"),d=t("../color"),p=t("../titles"),v=t("../../plots/cartesian/axis_defaults"),m=t("../../plots/cartesian/position_defaults"),g=t("../../plots/cartesian/layout_attributes"),y=t("./attributes");e.exports=function(t,e){function r(){function y(t,e){return u.coerce(J,$,g,t,e)}function _(){if(-1!==["top","bottom"].indexOf(x.titleside)){var e=it.select(".cbtitle"),r=e.select("text"),o=[-x.outlinewidth/2,x.outlinewidth/2],a=e.select(".h"+$._id+"title-math-group").node(),l=15.6;if(r.node()&&(l=1.3*parseInt(r.style("font-size"),10)),a?(at=f.bBox(a).height,at>l&&(o[1]-=(at-l)/2)):r.node()&&!r.classed("js-placeholder")&&(at=f.bBox(e.node()).height),at){if(at+=5,"top"===x.titleside)$.domain[1]-=at/A.h,o[1]*=-1;else{$.domain[0]+=at/A.h;var c=Math.max(1,r.selectAll("tspan.line").size());o[1]+=(1-c)*l}e.attr("transform","translate("+o+")"),$.setScale()}}it.selectAll(".cbfills,.cblines,.cbaxis").attr("transform","translate(0,"+Math.round(A.h*(1-$.domain[1]))+")");var h=it.select(".cbfills").selectAll("rect.cbfill").data(L);h.enter().append("rect").classed("cbfill",!0).style("stroke","none"),h.exit().remove(),h.each(function(t,e){var r=[0===e?E[0]:(L[e]+L[e-1])/2,e===L.length-1?E[1]:(L[e]+L[e+1])/2].map($.c2p).map(Math.round);e!==L.length-1&&(r[1]+=r[1]>r[0]?1:-1);var o=I(t).replace("e-",""),a=i(o).toHexString();n.select(this).attr({x:X,width:Math.max(N,2),y:n.min(r),height:Math.max(n.max(r)-n.min(r),2),fill:a})});var d=it.select(".cblines").selectAll("path.cbline").data(x.line.color&&x.line.width?S:[]);return d.enter().append("path").classed("cbline",!0),d.exit().remove(),d.each(function(t){n.select(this).attr("d","M"+X+","+(Math.round($.c2p(t))+x.line.width/2%1)+"h"+N).call(f.lineGroupStyle,x.line.width,z(t),x.line.dash)}),$._axislayer.selectAll("g."+$._id+"tick,path").remove(),$._pos=X+N+(x.outlinewidth||0)/2-("outside"===x.ticks?1:0),$.side="right",u.syncOrAsync([function(){return s.doTicks(t,$,!0)},function(){if(-1===["top","bottom"].indexOf(x.titleside)){var e=$.titlefont.size,r=$._offset+$._length/2,i=A.l+($.position||0)*A.w+("right"===$.side?10+e*($.showticklabels?1:.5):-10-e*($.showticklabels?.5:0));w("h"+$._id+"title",{avoid:{selection:n.select(t).selectAll("g."+$._id+"tick"),side:x.titleside,offsetLeft:A.l,offsetTop:A.t,maxShift:k.width},attributes:{x:i,y:r,"text-anchor":"middle"},transform:{rotate:"-90",offset:0}})}}])}function w(e,r){var n,i=b();n=a.traceIs(i,"markerColorscale")?"marker.colorbar.title":"colorbar.title";var o={propContainer:$,propName:n,traceIndex:i.index,dfltName:"colorscale",containerGroup:it.select(".cbtitle")},s="h"===e.charAt(0)?e.substr(1):"h"+e;it.selectAll("."+s+",."+s+"-math-group").remove(),p.draw(t,e,c(o,r||{}))}function M(){var r=N+x.outlinewidth/2+f.bBox($._axislayer.node()).width;if(O=ot.select("text"),O.node()&&!O.classed("js-placeholder")){var n,i=ot.select(".h"+$._id+"title-math-group").node();n=i&&-1!==["top","bottom"].indexOf(x.titleside)?f.bBox(i).width:f.bBox(ot.node()).right-X-A.l,r=Math.max(r,n)}var o=2*x.xpad+r+x.borderwidth+x.outlinewidth/2,s=Z-K;it.select(".cbbg").attr({x:X-x.xpad-(x.borderwidth+x.outlinewidth)/2,y:K-G,width:Math.max(o,2),height:Math.max(s+2*G,2)}).call(d.fill,x.bgcolor).call(d.stroke,x.bordercolor).style({"stroke-width":x.borderwidth}),it.selectAll(".cboutline").attr({x:X,y:K+x.ypad+("top"===x.titleside?at:0),width:Math.max(N,2),height:Math.max(s-2*x.ypad-at,2)}).call(d.stroke,x.outlinecolor).style({fill:"None","stroke-width":x.outlinewidth});var l=({center:.5,right:1}[x.xanchor]||0)*o;it.attr("transform","translate("+(A.l-l)+","+A.t+")"),a.autoMargin(t,e,{x:x.x,y:x.y,l:o*({right:1,center:.5}[x.xanchor]||0),r:o*({left:1,center:.5}[x.xanchor]||0),t:s*({bottom:1,middle:.5}[x.yanchor]||0),b:s*({top:1,middle:.5}[x.yanchor]||0)})}var k=t._fullLayout,A=k._size;if("function"!=typeof x.fillcolor&&"function"!=typeof x.line.color)return void k._infolayer.selectAll("g."+e).remove();var T,E=n.extent(("function"==typeof x.fillcolor?x.fillcolor:x.line.color).domain()),S=[],L=[],z="function"==typeof x.line.color?x.line.color:function(){return x.line.color},I="function"==typeof x.fillcolor?x.fillcolor:function(){return x.fillcolor},P=x.levels.end+x.levels.size/100,C=x.levels.size,R=1.001*E[0]-.001*E[1],D=1.001*E[1]-.001*E[0];for(T=x.levels.start;0>(T-P)*C;T+=C)T>R&&D>T&&S.push(T);if("function"==typeof x.fillcolor)if(x.filllevels)for(P=x.filllevels.end+x.filllevels.size/100,C=x.filllevels.size,T=x.filllevels.start;0>(T-P)*C;T+=C)T>E[0]&&T<E[1]&&L.push(T);else L=S.map(function(t){return t-x.levels.size/2}),L.push(L[L.length-1]+x.levels.size);else x.fillcolor&&"string"==typeof x.fillcolor&&(L=[0]);x.levels.size<0&&(S.reverse(),L.reverse());var O,F=k.height-k.margin.t-k.margin.b,j=k.width-k.margin.l-k.margin.r,N=Math.round(x.thickness*("fraction"===x.thicknessmode?j:1)),B=N/A.w,U=Math.round(x.len*("fraction"===x.lenmode?F:1)),V=U/A.h,q=x.xpad/A.w,G=(x.borderwidth+x.outlinewidth)/2,H=x.ypad/A.h,X=Math.round(x.x*A.w+x.xpad),Y=x.x-B*({middle:.5,right:1}[x.xanchor]||0),W=x.y+V*(({top:-.5,bottom:.5}[x.yanchor]||0)-.5),Z=Math.round(A.h*(1-W)),K=Z-U,J={type:"linear",range:E,tickmode:x.tickmode,nticks:x.nticks,tick0:x.tick0,dtick:x.dtick,tickvals:x.tickvals,ticktext:x.ticktext,ticks:x.ticks,ticklen:x.ticklen,tickwidth:x.tickwidth,tickcolor:x.tickcolor,showticklabels:x.showticklabels,tickfont:x.tickfont,tickangle:x.tickangle,tickformat:x.tickformat,exponentformat:x.exponentformat,showexponent:x.showexponent,showtickprefix:x.showtickprefix,tickprefix:x.tickprefix,showticksuffix:x.showticksuffix,ticksuffix:x.ticksuffix,title:x.title,titlefont:x.titlefont,anchor:"free",position:1},$={},Q={letter:"y",font:k.font,noHover:!0};if(v(J,$,y,Q),m(J,$,y,Q),$._id="y"+e,$._gd=t,$.position=x.x+q+B,r.axis=$,-1!==["top","bottom"].indexOf(x.titleside)&&($.titleside=x.titleside,$.titlex=x.x+q,$.titley=W+("top"===x.titleside?V-H:H)),x.line.color&&"auto"===x.tickmode){$.tickmode="linear",$.tick0=x.levels.start;var tt=x.levels.size,et=u.constrain((Z-K)/50,4,15)+1,rt=(E[1]-E[0])/((x.nticks||et)*tt);if(rt>1){var nt=Math.pow(10,Math.floor(Math.log(rt)/Math.LN10));tt*=nt*u.roundUp(rt/nt,[2,5,10]),(Math.abs(x.levels.start)/x.levels.size+1e-6)%1<2e-6&&($.tick0=0)}$.dtick=tt}$.domain=[W+H,W+V-H],$.setScale();var it=k._infolayer.selectAll("g."+e).data([0]);it.enter().append("g").classed(e,!0).each(function(){var t=n.select(this);t.append("rect").classed("cbbg",!0),t.append("g").classed("cbfills",!0),t.append("g").classed("cblines",!0),t.append("g").classed("cbaxis",!0).classed("crisp",!0),t.append("g").classed("cbtitleunshift",!0).append("g").classed("cbtitle",!0),t.append("rect").classed("cboutline",!0),t.select(".cbtitle").datum(0)}),it.attr("transform","translate("+Math.round(A.l)+","+Math.round(A.t)+")");var ot=it.select(".cbtitleunshift").attr("transform","translate(-"+Math.round(A.l)+",-"+Math.round(A.t)+")");$._axislayer=it.select(".cbaxis");var at=0;if(-1!==["top","bottom"].indexOf(x.titleside)){var st,lt=A.l+(x.x+q)*A.w,ut=$.titlefont.size;st="top"===x.titleside?(1-(W+V-H))*A.h+A.t+3+.75*ut:(1-(W+H))*A.h+A.t-3-.25*ut,w($._id+"title",{attributes:{x:lt,y:st,"text-anchor":"start"}})}var ct=u.syncOrAsync([a.previousPromises,_,a.previousPromises,M],t);if(ct&&ct.then&&(t._promises||[]).push(ct),t._context.editable){var ht,ft,dt;l.init({element:it.node(),prepFn:function(){ht=it.attr("transform"),h(it)},moveFn:function(t,e){it.attr("transform",ht+" translate("+t+","+e+")"),ft=l.align(Y+t/A.w,B,0,1,x.xanchor),dt=l.align(W-e/A.h,V,0,1,x.yanchor);var r=l.getCursor(ft,dt,x.xanchor,x.yanchor);h(it,r)},doneFn:function(e){h(it),e&&void 0!==ft&&void 0!==dt&&o.restyle(t,{"colorbar.x":ft,"colorbar.y":dt},b().index)}})}return ct}function b(){var r,n,i=e.substr(2);for(r=0;r<t._fullData.length;r++)if(n=t._fullData[r],n.uid===i)return n}var x={};return Object.keys(y).forEach(function(t){x[t]=null}),x.fillcolor=null,x.line={color:null,width:null,dash:null},x.levels={start:null,end:null,size:null},x.filllevels=null,Object.keys(x).forEach(function(t){r[t]=function(e){return arguments.length?(x[t]=u.isPlainObject(x[t])?u.extendFlat(x[t],e):e,r):x[t]}}),r.options=function(t){return Object.keys(t).forEach(function(e){"function"==typeof r[e]&&r[e](t[e])}),r},r._opts=x,r}},{"../../lib":568,"../../lib/extend":563,"../../lib/setcursor":577,"../../plotly":589,"../../plots/cartesian/axes":592,"../../plots/cartesian/axis_defaults":593,"../../plots/cartesian/layout_attributes":601,"../../plots/cartesian/position_defaults":604,"../../plots/plots":648,"../color":483,"../dragelement":504,"../drawing":506,"../titles":546,"./attributes":484,d3:119,tinycolor2:454}],487:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function(t){return n.isPlainObject(t.colorbar)}},{"../../lib":568}],488:[function(t,e,r){"use strict";r.attributes=t("./attributes"),r.supplyDefaults=t("./defaults"),r.draw=t("./draw"),r.hasColorbar=t("./has_colorbar")},{"./attributes":484,"./defaults":485,"./draw":486,"./has_colorbar":487}],489:[function(t,e,r){"use strict";e.exports={zauto:{valType:"boolean",dflt:!0},zmin:{valType:"number",dflt:null},zmax:{valType:"number",dflt:null},colorscale:{valType:"colorscale"},autocolorscale:{valType:"boolean",dflt:!0},reversescale:{valType:"boolean",dflt:!1},showscale:{valType:"boolean",dflt:!0}}},{}],490:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("./scales"),o=t("./flip_scale");e.exports=function(t,e,r,a){var s,l;r?(s=n.nestedProperty(t,r).get(),l=n.nestedProperty(t._input,r).get()):(s=t,l=t._input);var u=s[a+"auto"],c=s[a+"min"],h=s[a+"max"],f=s.colorscale;u===!1&&void 0!==c||(c=n.aggNums(Math.min,null,e)),u===!1&&void 0!==h||(h=n.aggNums(Math.max,null,e)),c===h&&(c-=.5,h+=.5),s[a+"min"]=c,s[a+"max"]=h,l[a+"min"]=c,l[a+"max"]=h,s.autocolorscale&&(f=0>c*h?i.RdBu:c>=0?i.Reds:i.Blues,l.colorscale=f,s.reversescale&&(f=o(f)),s.colorscale=f)}},{"../../lib":568,"./flip_scale":494,"./scales":501}],491:[function(t,e,r){"use strict";var n=t("./attributes"),i=t("../../lib/extend").extendDeep;t("./scales.js");e.exports=function(t){return{color:{valType:"color",arrayOk:!0},colorscale:i({},n.colorscale,{}),cauto:i({},n.zauto,{}),cmax:i({},n.zmax,{}),cmin:i({},n.zmin,{}),autocolorscale:i({},n.autocolorscale,{}),reversescale:i({},n.reversescale,{})}}},{"../../lib/extend":563,"./attributes":489,"./scales.js":501}],492:[function(t,e,r){"use strict";var n=t("./scales");
e.exports=n.RdBu},{"./scales":501}],493:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../lib"),o=t("../colorbar/has_colorbar"),a=t("../colorbar/defaults"),s=t("./is_valid_scale"),l=t("./flip_scale");e.exports=function(t,e,r,u,c){var h=c.prefix,f=c.cLetter,d=h.slice(0,h.length-1),p=h?i.nestedProperty(t,d).get()||{}:t,v=h?i.nestedProperty(e,d).get()||{}:e,m=p[f+"min"],g=p[f+"max"],y=p.colorscale,b=n(m)&&n(g)&&g>m;u(h+f+"auto",!b),u(h+f+"min"),u(h+f+"max");var x;void 0!==y&&(x=!s(y)),u(h+"autocolorscale",x);var _=u(h+"colorscale"),w=u(h+"reversescale");if(w&&(v.colorscale=l(_)),"marker.line."!==h){var M;h&&(M=o(p));var k=u(h+"showscale",M);k&&a(p,v,r)}}},{"../../lib":568,"../colorbar/defaults":485,"../colorbar/has_colorbar":487,"./flip_scale":494,"./is_valid_scale":498,"fast-isnumeric":123}],494:[function(t,e,r){"use strict";e.exports=function(t){for(var e,r=t.length,n=new Array(r),i=r-1,o=0;i>=0;i--,o++)e=t[i],n[o]=[1-e[0],e[1]];return n}},{}],495:[function(t,e,r){"use strict";var n=t("./scales"),i=t("./default_scale"),o=t("./is_valid_scale_array");e.exports=function(t,e){function r(){try{t=n[t]||JSON.parse(t)}catch(r){t=e}}return e||(e=i),t?("string"==typeof t&&(r(),"string"==typeof t&&r()),o(t)?t:e):e}},{"./default_scale":492,"./is_valid_scale_array":499,"./scales":501}],496:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../lib"),o=t("./is_valid_scale");e.exports=function(t,e){var r=e?i.nestedProperty(t,e).get()||{}:t,a=r.color,s=!1;if(Array.isArray(a))for(var l=0;l<a.length;l++)if(n(a[l])){s=!0;break}return i.isPlainObject(r)&&(s||r.showscale===!0||n(r.cmin)&&n(r.cmax)||o(r.colorscale)||i.isPlainObject(r.colorbar))}},{"../../lib":568,"./is_valid_scale":498,"fast-isnumeric":123}],497:[function(t,e,r){"use strict";r.scales=t("./scales"),r.defaultScale=t("./default_scale"),r.attributes=t("./attributes"),r.handleDefaults=t("./defaults"),r.calc=t("./calc"),r.hasColorscale=t("./has_colorscale"),r.isValidScale=t("./is_valid_scale"),r.getScale=t("./get_scale"),r.flipScale=t("./flip_scale"),r.makeScaleFunction=t("./make_scale_function")},{"./attributes":489,"./calc":490,"./default_scale":492,"./defaults":493,"./flip_scale":494,"./get_scale":495,"./has_colorscale":496,"./is_valid_scale":498,"./make_scale_function":500,"./scales":501}],498:[function(t,e,r){"use strict";var n=t("./scales"),i=t("./is_valid_scale_array");e.exports=function(t){return void 0!==n[t]?!0:i(t)}},{"./is_valid_scale_array":499,"./scales":501}],499:[function(t,e,r){"use strict";var n=t("tinycolor2");e.exports=function(t){var e=0;if(!Array.isArray(t)||t.length<2)return!1;if(!t[0]||!t[t.length-1])return!1;if(0!==+t[0][0]||1!==+t[t.length-1][0])return!1;for(var r=0;r<t.length;r++){var i=t[r];if(2!==i.length||+i[0]<e||!n(i[1]).isValid())return!1;e=+i[0]}return!0}},{tinycolor2:454}],500:[function(t,e,r){"use strict";var n=t("d3"),i=t("tinycolor2"),o=t("fast-isnumeric"),a=t("../../lib"),s=t("../color");e.exports=function(t,e,r){for(var l,u=t.length,c=new Array(u),h=new Array(u),f=0;u>f;f++)l=t[f],c[f]=e+l[0]*(r-e),h[f]=i(l[1]).toRgb();var d=n.scale.linear().domain(c).interpolate(n.interpolateObject).range(h);return function(t){if(o(t)){var n=a.constrain(t,e,r),l=d(n);return i(l).toRgbString()}return i(t).isValid()?t:s.defaultLine}}},{"../../lib":568,"../color":483,d3:119,"fast-isnumeric":123,tinycolor2:454}],501:[function(t,e,r){"use strict";e.exports={Greys:[[0,"rgb(0,0,0)"],[1,"rgb(255,255,255)"]],YlGnBu:[[0,"rgb(8,29,88)"],[.125,"rgb(37,52,148)"],[.25,"rgb(34,94,168)"],[.375,"rgb(29,145,192)"],[.5,"rgb(65,182,196)"],[.625,"rgb(127,205,187)"],[.75,"rgb(199,233,180)"],[.875,"rgb(237,248,217)"],[1,"rgb(255,255,217)"]],Greens:[[0,"rgb(0,68,27)"],[.125,"rgb(0,109,44)"],[.25,"rgb(35,139,69)"],[.375,"rgb(65,171,93)"],[.5,"rgb(116,196,118)"],[.625,"rgb(161,217,155)"],[.75,"rgb(199,233,192)"],[.875,"rgb(229,245,224)"],[1,"rgb(247,252,245)"]],YlOrRd:[[0,"rgb(128,0,38)"],[.125,"rgb(189,0,38)"],[.25,"rgb(227,26,28)"],[.375,"rgb(252,78,42)"],[.5,"rgb(253,141,60)"],[.625,"rgb(254,178,76)"],[.75,"rgb(254,217,118)"],[.875,"rgb(255,237,160)"],[1,"rgb(255,255,204)"]],Bluered:[[0,"rgb(0,0,255)"],[1,"rgb(255,0,0)"]],RdBu:[[0,"rgb(5,10,172)"],[.35,"rgb(106,137,247)"],[.5,"rgb(190,190,190)"],[.6,"rgb(220,170,132)"],[.7,"rgb(230,145,90)"],[1,"rgb(178,10,28)"]],Reds:[[0,"rgb(220,220,220)"],[.2,"rgb(245,195,157)"],[.4,"rgb(245,160,105)"],[1,"rgb(178,10,28)"]],Blues:[[0,"rgb(5,10,172)"],[.35,"rgb(40,60,190)"],[.5,"rgb(70,100,245)"],[.6,"rgb(90,120,245)"],[.7,"rgb(106,137,247)"],[1,"rgb(220,220,220)"]],Picnic:[[0,"rgb(0,0,255)"],[.1,"rgb(51,153,255)"],[.2,"rgb(102,204,255)"],[.3,"rgb(153,204,255)"],[.4,"rgb(204,204,255)"],[.5,"rgb(255,255,255)"],[.6,"rgb(255,204,255)"],[.7,"rgb(255,153,255)"],[.8,"rgb(255,102,204)"],[.9,"rgb(255,102,102)"],[1,"rgb(255,0,0)"]],Rainbow:[[0,"rgb(150,0,90)"],[.125,"rgb(0,0,200)"],[.25,"rgb(0,25,255)"],[.375,"rgb(0,152,255)"],[.5,"rgb(44,255,150)"],[.625,"rgb(151,255,0)"],[.75,"rgb(255,234,0)"],[.875,"rgb(255,111,0)"],[1,"rgb(255,0,0)"]],Portland:[[0,"rgb(12,51,131)"],[.25,"rgb(10,136,186)"],[.5,"rgb(242,211,56)"],[.75,"rgb(242,143,56)"],[1,"rgb(217,30,30)"]],Jet:[[0,"rgb(0,0,131)"],[.125,"rgb(0,60,170)"],[.375,"rgb(5,255,255)"],[.625,"rgb(255,255,0)"],[.875,"rgb(250,0,0)"],[1,"rgb(128,0,0)"]],Hot:[[0,"rgb(0,0,0)"],[.3,"rgb(230,0,0)"],[.6,"rgb(255,210,0)"],[1,"rgb(255,255,255)"]],Blackbody:[[0,"rgb(0,0,0)"],[.2,"rgb(230,0,0)"],[.4,"rgb(230,210,0)"],[.7,"rgb(255,255,255)"],[1,"rgb(160,200,255)"]],Earth:[[0,"rgb(0,0,130)"],[.1,"rgb(0,180,180)"],[.2,"rgb(40,210,40)"],[.4,"rgb(230,230,50)"],[.6,"rgb(120,70,20)"],[1,"rgb(255,255,255)"]],Electric:[[0,"rgb(0,0,0)"],[.15,"rgb(30,0,100)"],[.4,"rgb(120,0,100)"],[.6,"rgb(160,90,0)"],[.8,"rgb(230,200,0)"],[1,"rgb(255,250,220)"]],Viridis:[[0,"#440154"],[.06274509803921569,"#48186a"],[.12549019607843137,"#472d7b"],[.18823529411764706,"#424086"],[.25098039215686274,"#3b528b"],[.3137254901960784,"#33638d"],[.3764705882352941,"#2c728e"],[.4392156862745098,"#26828e"],[.5019607843137255,"#21918c"],[.5647058823529412,"#1fa088"],[.6274509803921569,"#28ae80"],[.6901960784313725,"#3fbc73"],[.7529411764705882,"#5ec962"],[.8156862745098039,"#84d44b"],[.8784313725490196,"#addc30"],[.9411764705882353,"#d8e219"],[1,"#fde725"]]}},{}],502:[function(t,e,r){"use strict";e.exports=function(t,e,r,n,i){var o=(t-r)/(n-r),a=o+e/(n-r),s=(o+a)/2;return"left"===i||"bottom"===i?o:"center"===i||"middle"===i?s:"right"===i||"top"===i?a:2/3-s>o?o:a>4/3-s?a:s}},{}],503:[function(t,e,r){"use strict";var n=t("../../lib"),i=[["sw-resize","s-resize","se-resize"],["w-resize","move","e-resize"],["nw-resize","n-resize","ne-resize"]];e.exports=function(t,e,r,o){return t="left"===r?0:"center"===r?1:"right"===r?2:n.constrain(Math.floor(3*t),0,2),e="bottom"===o?0:"middle"===o?1:"top"===o?2:n.constrain(Math.floor(3*e),0,2),i[e][t]}},{"../../lib":568}],504:[function(t,e,r){"use strict";function n(){var t=document.createElement("div");t.className="dragcover";var e=t.style;return e.position="fixed",e.left=0,e.right=0,e.top=0,e.bottom=0,e.zIndex=999999999,e.background="none",document.body.appendChild(t),t}function i(t){t._dragging=!1,t._replotPending&&o.plot(t)}var o=t("../../plotly"),a=t("../../lib"),s=t("../../plots/cartesian/constants"),l=e.exports={};l.align=t("./align"),l.getCursor=t("./cursor");var u=t("./unhover");l.unhover=u.wrapped,l.unhoverRaw=u.raw,l.init=function(t){function e(e){return t.element.onmousemove=p,v._dragged=!1,v._dragging=!0,u=e.clientX,c=e.clientY,d=e.target,h=(new Date).getTime(),h-v._mouseDownTime<g?m+=1:(m=1,v._mouseDownTime=h),t.prepFn&&t.prepFn(e,u,c),f=n(),f.onmousemove=r,f.onmouseup=o,f.onmouseout=o,f.style.cursor=window.getComputedStyle(t.element).cursor,a.pauseEvent(e)}function r(e){var r=e.clientX-u,n=e.clientY-c,i=t.minDrag||s.MINDRAG;return Math.abs(r)<i&&(r=0),Math.abs(n)<i&&(n=0),(r||n)&&(v._dragged=!0,l.unhover(v)),t.moveFn&&t.moveFn(r,n,v._dragged),a.pauseEvent(e)}function o(e){if(p=t.element.onmousemove,t.setCursor&&(t.element.onmousemove=t.setCursor),f.onmousemove=null,f.onmouseup=null,f.onmouseout=null,a.removeElement(f),!v._dragging)return void(v._dragged=!1);if(v._dragging=!1,(new Date).getTime()-v._mouseDownTime>g&&(m=Math.max(m-1,1)),t.doneFn&&t.doneFn(v._dragged,m),!v._dragged){var r=document.createEvent("MouseEvents");r.initEvent("click",!0,!0),d.dispatchEvent(r)}return i(v),v._dragged=!1,a.pauseEvent(e)}var u,c,h,f,d,p,v=a.getPlotDiv(t.element)||{},m=1,g=s.DBLCLICKDELAY;v._mouseDownTime||(v._mouseDownTime=0),p=t.element.onmousemove,t.setCursor&&(t.element.onmousemove=t.setCursor),t.element.onmousedown=e,t.element.style.pointerEvents="all"}},{"../../lib":568,"../../plotly":589,"../../plots/cartesian/constants":597,"./align":502,"./cursor":503,"./unhover":505}],505:[function(t,e,r){"use strict";var n=t("../../lib/events"),i=e.exports={};i.wrapped=function(t,e,r){"string"==typeof t&&(t=document.getElementById(t)),t._hoverTimer&&(clearTimeout(t._hoverTimer),t._hoverTimer=void 0),i.raw(t,e,r)},i.raw=function(t,e){var r=t._fullLayout;e||(e={}),e.target&&n.triggerHandler(t,"plotly_beforehover",e)===!1||(r._hoverlayer.selectAll("g").remove(),e.target&&t._hoverdata&&t.emit("plotly_unhover",{points:t._hoverdata}),t._hoverdata=void 0)}},{"../../lib/events":562}],506:[function(t,e,r){"use strict";function n(t,e,r,n){var o=t[0]-e[0],a=t[1]-e[1],s=r[0]-e[0],l=r[1]-e[1],u=Math.pow(o*o+a*a,x/2),c=Math.pow(s*s+l*l,x/2),h=(c*c*o-u*u*s)*n,f=(c*c*a-u*u*l)*n,d=3*c*(u+c),p=3*u*(u+c);return[[i.round(e[0]+(d&&h/d),2),i.round(e[1]+(d&&f/d),2)],[i.round(e[0]-(p&&h/p),2),i.round(e[1]-(p&&f/p),2)]]}var i=t("d3"),o=t("fast-isnumeric"),a=t("../../plots/plots"),s=t("../color"),l=t("../colorscale"),u=t("../../lib"),c=t("../../lib/svg_text_utils"),h=t("../../constants/xmlns_namespaces"),f=t("../../traces/scatter/subtypes"),d=t("../../traces/scatter/make_bubble_size_func"),p=e.exports={};p.font=function(t,e,r,n){e&&e.family&&(n=e.color,r=e.size,e=e.family),e&&t.style("font-family",e),r+1&&t.style("font-size",r+"px"),n&&t.call(s.fill,n)},p.setPosition=function(t,e,r){t.attr("x",e).attr("y",r)},p.setSize=function(t,e,r){t.attr("width",e).attr("height",r)},p.setRect=function(t,e,r,n,i){t.call(p.setPosition,e,r).call(p.setSize,n,i)},p.translatePoints=function(t,e,r){t.each(function(t){var n=t.xp||e.c2p(t.x),a=t.yp||r.c2p(t.y),s=i.select(this);o(n)&&o(a)?"text"===this.nodeName?s.attr("x",n).attr("y",a):s.attr("transform","translate("+n+","+a+")"):s.remove()})},p.getPx=function(t,e){return Number(t.style(e).replace(/px$/,""))},p.crispRound=function(t,e,r){return e&&o(e)?t._context.staticPlot?e:1>e?1:Math.round(e):r||0},p.lineGroupStyle=function(t,e,r,n){t.style("fill","none").each(function(t){var o=(((t||[])[0]||{}).trace||{}).line||{},a=e||o.width||0,l=n||o.dash||"";i.select(this).call(s.stroke,r||o.color).call(p.dashLine,l,a)})},p.dashLine=function(t,e,r){var n=Math.max(r,3);"solid"===e?e="":"dot"===e?e=n+"px,"+n+"px":"dash"===e?e=3*n+"px,"+3*n+"px":"longdash"===e?e=5*n+"px,"+5*n+"px":"dashdot"===e?e=3*n+"px,"+n+"px,"+n+"px,"+n+"px":"longdashdot"===e&&(e=5*n+"px,"+2*n+"px,"+n+"px,"+2*n+"px"),t.style({"stroke-dasharray":e,"stroke-width":r+"px"})},p.fillGroupStyle=function(t){t.style("stroke-width",0).each(function(e){var r=i.select(this);try{r.call(s.fill,e[0].trace.fillcolor)}catch(n){u.error(n,t),r.remove()}})};var v=t("./symbol_defs");p.symbolNames=[],p.symbolFuncs=[],p.symbolNeedLines={},p.symbolNoDot={},p.symbolList=[],Object.keys(v).forEach(function(t){var e=v[t];p.symbolList=p.symbolList.concat([e.n,t,e.n+100,t+"-open"]),p.symbolNames[e.n]=t,p.symbolFuncs[e.n]=e.f,e.needLine&&(p.symbolNeedLines[e.n]=!0),e.noDot?p.symbolNoDot[e.n]=!0:p.symbolList=p.symbolList.concat([e.n+200,t+"-dot",e.n+300,t+"-open-dot"])});var m=p.symbolNames.length,g="M0,0.5L0.5,0L0,-0.5L-0.5,0Z";p.symbolNumber=function(t){if("string"==typeof t){var e=0;t.indexOf("-open")>0&&(e=100,t=t.replace("-open","")),t.indexOf("-dot")>0&&(e+=200,t=t.replace("-dot","")),t=p.symbolNames.indexOf(t),t>=0&&(t+=e)}return t%100>=m||t>=400?0:Math.floor(Math.max(t,0))},p.pointStyle=function(t,e){if(t.size()){var r=e.marker,n=r.line;if(a.traceIs(e,"symbols")){var o=d(e);t.attr("d",function(t){var n;n="various"===t.ms||"various"===r.size?3:f.isBubble(e)?o(t.ms):(r.size||6)/2,t.mrc=n;var i=p.symbolNumber(t.mx||r.symbol)||0,a=i%100;return t.om=i%200>=100,p.symbolFuncs[a](n)+(i>=200?g:"")}).style("opacity",function(t){return(t.mo+1||r.opacity+1)-1})}var l=(e._input||{}).marker||{},u=p.tryColorscale(r,l,""),c=p.tryColorscale(r,l,"line.");t.each(function(t){var e,o,a;t.so?(a=n.outlierwidth,o=n.outliercolor,e=r.outliercolor):(a=(t.mlw+1||n.width+1||(t.trace?t.trace.marker.line.width:0)+1)-1,o="mlc"in t?t.mlcc=c(t.mlc):Array.isArray(n.color)?s.defaultLine:n.color,e="mc"in t?t.mcc=u(t.mc):Array.isArray(r.color)?s.defaultLine:r.color||"rgba(0,0,0,0)");var l=i.select(this);t.om?l.call(s.stroke,e).style({"stroke-width":(a||1)+"px",fill:"none"}):(l.style("stroke-width",a+"px").call(s.fill,e),a&&l.call(s.stroke,o))})}},p.tryColorscale=function(t,e,r){var n=u.nestedProperty(t,r+"color").get(),i=u.nestedProperty(t,r+"colorscale").get(),a=u.nestedProperty(t,r+"cauto").get(),s=u.nestedProperty(t,r+"cmin"),c=u.nestedProperty(t,r+"cmax"),h=s.get(),f=c.get();return i&&Array.isArray(n)?(!a&&o(h)&&o(f)||(h=1/0,f=-(1/0),n.forEach(function(t){o(t)&&(h>t&&(h=+t),t>f&&(f=+t))}),h>f&&(h=0,f=1),s.set(h),c.set(f),u.nestedProperty(e,r+"cmin").set(h),u.nestedProperty(e,r+"cmax").set(f)),l.makeScaleFunction(i,h,f)):u.identity};var y={start:1,end:-1,middle:0,bottom:1,top:-1},b=1.3;p.textPointStyle=function(t,e){t.each(function(t){var r=i.select(this),n=t.tx||e.text;if(!n||Array.isArray(n))return void r.remove();var a=t.tp||e.textposition,s=-1!==a.indexOf("top")?"top":-1!==a.indexOf("bottom")?"bottom":"middle",l=-1!==a.indexOf("left")?"end":-1!==a.indexOf("right")?"start":"middle",u=t.ts||e.textfont.size,h=t.mrc?t.mrc/.8+1:0;u=o(u)&&u>0?u:0,r.call(p.font,t.tf||e.textfont.family,u,t.tc||e.textfont.color).attr("text-anchor",l).text(n).call(c.convertToTspans);var f=i.select(this.parentNode),d=r.selectAll("tspan.line"),v=((d[0].length||1)-1)*b+1,m=y[l]*h,g=.75*u+y[s]*h+(y[s]-1)*v*u/2;f.attr("transform","translate("+m+","+g+")"),v>1&&d.attr({x:r.attr("x"),y:r.attr("y")})})};var x=.5;p.smoothopen=function(t,e){if(t.length<3)return"M"+t.join("L");var r,i="M"+t[0],o=[];for(r=1;r<t.length-1;r++)o.push(n(t[r-1],t[r],t[r+1],e));for(i+="Q"+o[0][0]+" "+t[1],r=2;r<t.length-1;r++)i+="C"+o[r-2][1]+" "+o[r-1][0]+" "+t[r];return i+="Q"+o[t.length-3][1]+" "+t[t.length-1]},p.smoothclosed=function(t,e){if(t.length<3)return"M"+t.join("L")+"Z";var r,i="M"+t[0],o=t.length-1,a=[n(t[o],t[0],t[1],e)];for(r=1;o>r;r++)a.push(n(t[r-1],t[r],t[r+1],e));for(a.push(n(t[o-1],t[o],t[0],e)),r=1;o>=r;r++)i+="C"+a[r-1][1]+" "+a[r][0]+" "+t[r];return i+="C"+a[o][1]+" "+a[0][0]+" "+t[0]+"Z"};var _={hv:function(t,e){return"H"+i.round(e[0],2)+"V"+i.round(e[1],2)},vh:function(t,e){return"V"+i.round(e[1],2)+"H"+i.round(e[0],2)},hvh:function(t,e){return"H"+i.round((t[0]+e[0])/2,2)+"V"+i.round(e[1],2)+"H"+i.round(e[0],2)},vhv:function(t,e){return"V"+i.round((t[1]+e[1])/2,2)+"H"+i.round(e[0],2)+"V"+i.round(e[1],2)}},w=function(t,e){return"L"+i.round(e[0],2)+","+i.round(e[1],2)};p.steps=function(t){var e=_[t]||w;return function(t){for(var r="M"+i.round(t[0][0],2)+","+i.round(t[0][1],2),n=1;n<t.length;n++)r+=e(t[n-1],t[n]);return r}},p.makeTester=function(t){var e=i.select("body").selectAll("#js-plotly-tester").data([0]);e.enter().append("svg").attr("id","js-plotly-tester").attr(h.svgAttrs).style({position:"absolute",left:"-10000px",top:"-10000px",width:"9000px",height:"9000px","z-index":"1"});var r=e.selectAll(".js-reference-point").data([0]);r.enter().append("path").classed("js-reference-point",!0).attr("d","M0,0H1V1H0Z").style({"stroke-width":0,fill:"black"}),e.node()._cache||(e.node()._cache={}),t._tester=e,t._testref=r};var M=[],k=1e4;p.bBox=function(t){var e=t.attributes["data-bb"];if(e&&e.value)return u.extendFlat({},M[e.value]);var r=i.select("#js-plotly-tester"),n=r.node(),o=t.cloneNode(!0);n.appendChild(o),i.select(o).attr({x:0,y:0,transform:""});var a=o.getBoundingClientRect(),s=r.select(".js-reference-point").node().getBoundingClientRect();n.removeChild(o);var l={height:a.height,width:a.width,left:a.left-s.left,top:a.top-s.top,right:a.right-s.left,bottom:a.bottom-s.top};return M.length>=k&&(i.selectAll("[data-bb]").attr("data-bb",null),M=[]),t.setAttribute("data-bb",M.length),M.push(l),u.extendFlat({},l)},p.setClipUrl=function(t,e){if(!e)return void t.attr("clip-path",null);var r="#"+e,n=i.select("base");n.size()&&n.attr("href")&&(r=window.location.href+r),t.attr("clip-path","url("+r+")")}},{"../../constants/xmlns_namespaces":556,"../../lib":568,"../../lib/svg_text_utils":581,"../../plots/plots":648,"../../traces/scatter/make_bubble_size_func":764,"../../traces/scatter/subtypes":769,"../color":483,"../colorscale":497,"./symbol_defs":507,d3:119,"fast-isnumeric":123}],507:[function(t,e,r){"use strict";var n=t("d3");e.exports={circle:{n:0,f:function(t){var e=n.round(t,2);return"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"}},square:{n:1,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"}},diamond:{n:2,f:function(t){var e=n.round(1.3*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"Z"}},cross:{n:3,f:function(t){var e=n.round(.4*t,2),r=n.round(1.2*t,2);return"M"+r+","+e+"H"+e+"V"+r+"H-"+e+"V"+e+"H-"+r+"V-"+e+"H-"+e+"V-"+r+"H"+e+"V-"+e+"H"+r+"Z"}},x:{n:4,f:function(t){var e=n.round(.8*t/Math.sqrt(2),2),r="l"+e+","+e,i="l"+e+",-"+e,o="l-"+e+",-"+e,a="l-"+e+","+e;return"M0,"+e+r+i+o+i+o+a+o+a+r+a+r+"Z"}},"triangle-up":{n:5,f:function(t){var e=n.round(2*t/Math.sqrt(3),2),r=n.round(t/2,2),i=n.round(t,2);return"M-"+e+","+r+"H"+e+"L0,-"+i+"Z"}},"triangle-down":{n:6,f:function(t){var e=n.round(2*t/Math.sqrt(3),2),r=n.round(t/2,2),i=n.round(t,2);return"M-"+e+",-"+r+"H"+e+"L0,"+i+"Z"}},"triangle-left":{n:7,f:function(t){var e=n.round(2*t/Math.sqrt(3),2),r=n.round(t/2,2),i=n.round(t,2);return"M"+r+",-"+e+"V"+e+"L-"+i+",0Z"}},"triangle-right":{n:8,f:function(t){var e=n.round(2*t/Math.sqrt(3),2),r=n.round(t/2,2),i=n.round(t,2);return"M-"+r+",-"+e+"V"+e+"L"+i+",0Z"}},"triangle-ne":{n:9,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M-"+r+",-"+e+"H"+e+"V"+r+"Z"}},"triangle-se":{n:10,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M"+e+",-"+r+"V"+e+"H-"+r+"Z"}},"triangle-sw":{n:11,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M"+r+","+e+"H-"+e+"V-"+r+"Z"}},"triangle-nw":{n:12,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M-"+e+","+r+"V-"+e+"H"+r+"Z"}},pentagon:{n:13,f:function(t){var e=n.round(.951*t,2),r=n.round(.588*t,2),i=n.round(-t,2),o=n.round(t*-.309,2),a=n.round(.809*t,2);return"M"+e+","+o+"L"+r+","+a+"H-"+r+"L-"+e+","+o+"L0,"+i+"Z"}},hexagon:{n:14,f:function(t){var e=n.round(t,2),r=n.round(t/2,2),i=n.round(t*Math.sqrt(3)/2,2);return"M"+i+",-"+r+"V"+r+"L0,"+e+"L-"+i+","+r+"V-"+r+"L0,-"+e+"Z"}},hexagon2:{n:15,f:function(t){var e=n.round(t,2),r=n.round(t/2,2),i=n.round(t*Math.sqrt(3)/2,2);return"M-"+r+","+i+"H"+r+"L"+e+",0L"+r+",-"+i+"H-"+r+"L-"+e+",0Z"}},octagon:{n:16,f:function(t){var e=n.round(.924*t,2),r=n.round(.383*t,2);return"M-"+r+",-"+e+"H"+r+"L"+e+",-"+r+"V"+r+"L"+r+","+e+"H-"+r+"L-"+e+","+r+"V-"+r+"Z"}},star:{n:17,f:function(t){var e=1.4*t,r=n.round(.225*e,2),i=n.round(.951*e,2),o=n.round(.363*e,2),a=n.round(.588*e,2),s=n.round(-e,2),l=n.round(e*-.309,2),u=n.round(.118*e,2),c=n.round(.809*e,2),h=n.round(.382*e,2);return"M"+r+","+l+"H"+i+"L"+o+","+u+"L"+a+","+c+"L0,"+h+"L-"+a+","+c+"L-"+o+","+u+"L-"+i+","+l+"H-"+r+"L0,"+s+"Z"}},hexagram:{n:18,f:function(t){var e=n.round(.66*t,2),r=n.round(.38*t,2),i=n.round(.76*t,2);return"M-"+i+",0l-"+r+",-"+e+"h"+i+"l"+r+",-"+e+"l"+r+","+e+"h"+i+"l-"+r+","+e+"l"+r+","+e+"h-"+i+"l-"+r+","+e+"l-"+r+",-"+e+"h-"+i+"Z"}},"star-triangle-up":{n:19,f:function(t){var e=n.round(t*Math.sqrt(3)*.8,2),r=n.round(.8*t,2),i=n.round(1.6*t,2),o=n.round(4*t,2),a="A "+o+","+o+" 0 0 1 ";return"M-"+e+","+r+a+e+","+r+a+"0,-"+i+a+"-"+e+","+r+"Z"}},"star-triangle-down":{n:20,f:function(t){var e=n.round(t*Math.sqrt(3)*.8,2),r=n.round(.8*t,2),i=n.round(1.6*t,2),o=n.round(4*t,2),a="A "+o+","+o+" 0 0 1 ";return"M"+e+",-"+r+a+"-"+e+",-"+r+a+"0,"+i+a+e+",-"+r+"Z"}},"star-square":{n:21,f:function(t){var e=n.round(1.1*t,2),r=n.round(2*t,2),i="A "+r+","+r+" 0 0 1 ";return"M-"+e+",-"+e+i+"-"+e+","+e+i+e+","+e+i+e+",-"+e+i+"-"+e+",-"+e+"Z"}},"star-diamond":{n:22,f:function(t){var e=n.round(1.4*t,2),r=n.round(1.9*t,2),i="A "+r+","+r+" 0 0 1 ";return"M-"+e+",0"+i+"0,"+e+i+e+",0"+i+"0,-"+e+i+"-"+e+",0Z"}},"diamond-tall":{n:23,f:function(t){var e=n.round(.7*t,2),r=n.round(1.4*t,2);return"M0,"+r+"L"+e+",0L0,-"+r+"L-"+e+",0Z"}},"diamond-wide":{n:24,f:function(t){var e=n.round(1.4*t,2),r=n.round(.7*t,2);return"M0,"+r+"L"+e+",0L0,-"+r+"L-"+e+",0Z"}},hourglass:{n:25,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"H-"+e+"L"+e+",-"+e+"H-"+e+"Z"},noDot:!0},bowtie:{n:26,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"V-"+e+"L-"+e+","+e+"V-"+e+"Z"},noDot:!0},"circle-cross":{n:27,f:function(t){var e=n.round(t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"},needLine:!0,noDot:!0},"circle-x":{n:28,f:function(t){var e=n.round(t,2),r=n.round(t/Math.sqrt(2),2);return"M"+r+","+r+"L-"+r+",-"+r+"M"+r+",-"+r+"L-"+r+","+r+"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"},needLine:!0,noDot:!0},"square-cross":{n:29,f:function(t){var e=n.round(t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"},needLine:!0,noDot:!0},"square-x":{n:30,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e+"M"+e+",-"+e+"L-"+e+","+e+"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"},needLine:!0,noDot:!0},"diamond-cross":{n:31,f:function(t){var e=n.round(1.3*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"ZM0,-"+e+"V"+e+"M-"+e+",0H"+e},needLine:!0,noDot:!0},"diamond-x":{n:32,f:function(t){var e=n.round(1.3*t,2),r=n.round(.65*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"ZM-"+r+",-"+r+"L"+r+","+r+"M-"+r+","+r+"L"+r+",-"+r},needLine:!0,noDot:!0},"cross-thin":{n:33,f:function(t){var e=n.round(1.4*t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e},needLine:!0,noDot:!0},"x-thin":{n:34,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e+"M"+e+",-"+e+"L-"+e+","+e},needLine:!0,noDot:!0},asterisk:{n:35,f:function(t){var e=n.round(1.2*t,2),r=n.round(.85*t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+r+","+r+"L-"+r+",-"+r+"M"+r+",-"+r+"L-"+r+","+r},needLine:!0,noDot:!0},hash:{n:36,f:function(t){var e=n.round(t/2,2),r=n.round(t,2);return"M"+e+","+r+"V-"+r+"m-"+r+",0V"+r+"M"+r+","+e+"H-"+r+"m0,-"+r+"H"+r},needLine:!0},"y-up":{n:37,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),i=n.round(.8*t,2);return"M-"+e+","+i+"L0,0M"+e+","+i+"L0,0M0,-"+r+"L0,0"},needLine:!0,noDot:!0},"y-down":{n:38,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),i=n.round(.8*t,2);return"M-"+e+",-"+i+"L0,0M"+e+",-"+i+"L0,0M0,"+r+"L0,0"},needLine:!0,noDot:!0},"y-left":{n:39,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),i=n.round(.8*t,2);return"M"+i+","+e+"L0,0M"+i+",-"+e+"L0,0M-"+r+",0L0,0"},needLine:!0,noDot:!0},"y-right":{n:40,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),i=n.round(.8*t,2);return"M-"+i+","+e+"L0,0M-"+i+",-"+e+"L0,0M"+r+",0L0,0"},needLine:!0,noDot:!0},"line-ew":{n:41,f:function(t){var e=n.round(1.4*t,2);return"M"+e+",0H-"+e},needLine:!0,noDot:!0},"line-ns":{n:42,f:function(t){var e=n.round(1.4*t,2);return"M0,"+e+"V-"+e},needLine:!0,noDot:!0},"line-ne":{n:43,f:function(t){var e=n.round(t,2);return"M"+e+",-"+e+"L-"+e+","+e},needLine:!0,noDot:!0},"line-nw":{n:44,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e},needLine:!0,noDot:!0}}},{d3:119}],508:[function(t,e,r){"use strict";e.exports={visible:{valType:"boolean"},type:{valType:"enumerated",values:["percent","constant","sqrt","data"]},symmetric:{valType:"boolean"},array:{valType:"data_array"},arrayminus:{valType:"data_array"},value:{valType:"number",min:0,dflt:10},valueminus:{valType:"number",min:0,dflt:10},traceref:{valType:"integer",min:0,dflt:0},tracerefminus:{valType:"integer",min:0,dflt:0},copy_ystyle:{valType:"boolean"},copy_zstyle:{valType:"boolean"},color:{valType:"color"},thickness:{valType:"number",min:0,dflt:2},width:{valType:"number",min:0},_deprecated:{opacity:{valType:"number"}}}},{}],509:[function(t,e,r){"use strict";function n(t,e,r,n){var o=e["error_"+n]||{},l=o.visible&&-1!==["linear","log"].indexOf(r.type),u=[];if(l){for(var c=s(o),h=0;h<t.length;h++){var f=t[h],d=f[n];if(i(r.c2l(d))){var p=c(d,h);if(i(p[0])&&i(p[1])){var v=f[n+"s"]=d-p[0],m=f[n+"h"]=d+p[1];u.push(v,m)}}}a.expand(r,u,{padded:!0})}}var i=t("fast-isnumeric"),o=t("../../plots/plots"),a=t("../../plots/cartesian/axes"),s=t("./compute_error");e.exports=function(t){for(var e=t.calcdata,r=0;r<e.length;r++){var i=e[r],s=i[0].trace;if(o.traceIs(s,"errorBarsOK")){var l=a.getFromId(t,s.xaxis),u=a.getFromId(t,s.yaxis);n(i,s,l,"x"),n(i,s,u,"y")}}}},{"../../plots/cartesian/axes":592,"../../plots/plots":648,"./compute_error":510,"fast-isnumeric":123}],510:[function(t,e,r){"use strict";function n(t,e){return"percent"===t?function(t){return Math.abs(t*e/100)}:"constant"===t?function(){return Math.abs(e)}:"sqrt"===t?function(t){return Math.sqrt(Math.abs(t))}:void 0}e.exports=function(t){var e=t.type,r=t.symmetric;if("data"===e){var i=t.array,o=t.arrayminus;return r||void 0===o?function(t,e){var r=+i[e];return[r,r]}:function(t,e){return[+o[e],+i[e]]}}var a=n(e,t.value),s=n(e,t.valueminus);return r||void 0===t.valueminus?function(t){var e=a(t);return[e,e]}:function(t){return[s(t),a(t)]}}},{}],511:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../plots/plots"),o=t("../../lib"),a=t("./attributes");e.exports=function(t,e,r,s){function l(t,e){return o.coerce(h,c,a,t,e)}var u="error_"+s.axis,c=e[u]={},h=t[u]||{},f=void 0!==h.array||void 0!==h.value||"sqrt"===h.type,d=l("visible",f);if(d!==!1){var p=l("type","array"in h?"data":"percent"),v=!0;if("sqrt"!==p&&(v=l("symmetric",!(("data"===p?"arrayminus":"valueminus")in h))),"data"===p){var m=l("array");if(m||(c.array=[]),l("traceref"),!v){var g=l("arrayminus");g||(c.arrayminus=[]),l("tracerefminus")}}else"percent"!==p&&"constant"!==p||(l("value"),v||l("valueminus"));var y="copy_"+s.inherit+"style";if(s.inherit){var b=e["error_"+s.inherit];(b||{}).visible&&l(y,!(h.color||n(h.thickness)||n(h.width)))}s.inherit&&c[y]||(l("color",r),l("thickness"),l("width",i.traceIs(e,"gl3d")?0:4))}}},{"../../lib":568,"../../plots/plots":648,"./attributes":508,"fast-isnumeric":123}],512:[function(t,e,r){"use strict";var n=e.exports={};n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.calc=t("./calc"),n.calcFromTrace=function(t,e){for(var r=t.x||[],i=t.y,o=r.length||i.length,a=new Array(o),s=0;o>s;s++)a[s]={x:r[s],y:i[s]};return a[0].trace=t,n.calc({calcdata:[a],_fullLayout:e}),a},n.plot=t("./plot"),n.style=t("./style"),n.hoverInfo=function(t,e,r){(e.error_y||{}).visible&&(r.yerr=t.yh-t.y,e.error_y.symmetric||(r.yerrneg=t.y-t.ys)),(e.error_x||{}).visible&&(r.xerr=t.xh-t.x,e.error_x.symmetric||(r.xerrneg=t.x-t.xs))}},{"./attributes":508,"./calc":509,"./defaults":511,"./plot":513,"./style":514}],513:[function(t,e,r){"use strict";function n(t,e,r){var n={x:e.c2p(t.x),y:r.c2p(t.y)};return void 0!==t.yh&&(n.yh=r.c2p(t.yh),n.ys=r.c2p(t.ys),o(n.ys)||(n.noYS=!0,n.ys=r.c2p(t.ys,!0))),void 0!==t.xh&&(n.xh=e.c2p(t.xh),n.xs=e.c2p(t.xs),o(n.xs)||(n.noXS=!0,n.xs=e.c2p(t.xs,!0))),n}var i=t("d3"),o=t("fast-isnumeric"),a=t("../../lib"),s=t("../../traces/scatter/subtypes");e.exports=function(t,e){var r=e.x(),l=e.y();t.each(function(t){var e=t[0].trace,u=e.error_x||{},c=e.error_y||{},h=s.hasMarkers(e)&&e.marker.maxdisplayed>0;if(c.visible||u.visible){var f=i.select(this).selectAll("g.errorbar").data(a.identity);f.enter().append("g").classed("errorbar",!0),f.each(function(t){var e=i.select(this),a=n(t,r,l);if(!h||t.vis){var s;if(c.visible&&o(a.x)&&o(a.yh)&&o(a.ys)){var f=c.width;s="M"+(a.x-f)+","+a.yh+"h"+2*f+"m-"+f+",0V"+a.ys,a.noYS||(s+="m-"+f+",0h"+2*f),e.append("path").classed("yerror",!0).attr("d",s)}if(u.visible&&o(a.y)&&o(a.xh)&&o(a.xs)){var d=(u.copy_ystyle?c:u).width;s="M"+a.xh+","+(a.y-d)+"v"+2*d+"m0,-"+d+"H"+a.xs,a.noXS||(s+="m0,-"+d+"v"+2*d),e.append("path").classed("xerror",!0).attr("d",s)}}})}})}},{"../../lib":568,"../../traces/scatter/subtypes":769,d3:119,"fast-isnumeric":123}],514:[function(t,e,r){"use strict";var n=t("d3"),i=t("../color");e.exports=function(t){t.each(function(t){var e=t[0].trace,r=e.error_y||{},o=e.error_x||{},a=n.select(this);a.selectAll("path.yerror").style("stroke-width",r.thickness+"px").call(i.stroke,r.color),o.copy_ystyle&&(o=r),a.selectAll("path.xerror").style("stroke-width",o.thickness+"px").call(i.stroke,o.color)})}},{"../color":483,d3:119}],515:[function(t,e,r){"use strict";var n=t("../../plots/cartesian/constants");e.exports={_isLinkedToArray:!0,source:{valType:"string"},layer:{valType:"enumerated",values:["below","above"],dflt:"above"},sizex:{valType:"number",dflt:0},sizey:{valType:"number",dflt:0},sizing:{valType:"enumerated",values:["fill","contain","stretch"],dflt:"contain"},opacity:{valType:"number",min:0,max:1,dflt:1},x:{valType:"number",dflt:0},y:{valType:"number",dflt:0},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left"},yanchor:{valType:"enumerated",values:["top","middle","bottom"],dflt:"top"},xref:{valType:"enumerated",values:["paper",n.idRegex.x.toString()],dflt:"paper"},yref:{valType:"enumerated",values:["paper",n.idRegex.y.toString()],dflt:"paper"}}},{"../../plots/cartesian/constants":597}],516:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return o.coerce(t,e,a,r,n)}e=e||{},n("source"),n("layer"),n("x"),n("y"),n("xanchor"),n("yanchor"),n("sizex"),n("sizey"),n("sizing"),n("opacity");for(var s=0;2>s;s++){var l={_fullLayout:r},u=["x","y"][s];i.coerceRef(t,e,l,u,"paper")}return e}var i=t("../../plots/cartesian/axes"),o=t("../../lib"),a=t("./attributes");e.exports=function(t,e){if(t.images&&Array.isArray(t.images))for(var r=t.images,i=e.images=[],o=0;o<r.length;o++){var a=r[o];if(a.source){var s=n(r[o]||{},i[o]||{},e);i.push(s)}}}},{"../../lib":568,"../../plots/cartesian/axes":592,"./attributes":515}],517:[function(t,e,r){"use strict";var n=t("d3"),i=t("../drawing"),o=t("../../plots/cartesian/axes");e.exports=function(t){function e(e){var r=n.select(this),i=new Promise(function(t){function n(){r.remove(),t()}var i=new Image;i.setAttribute("crossOrigin","anonymous"),i.onerror=n,i.onload=function(){var t=document.createElement("canvas");t.width=this.width,t.height=this.height;var e=t.getContext("2d");e.drawImage(this,0,0);var n=t.toDataURL("image/png");r.attr("xlink:href",n)},r.on("error",n),r.on("load",t),i.src=e.source});t._promises.push(i)}function r(e){var r=n.select(this),a=o.getFromId(t,e.xref),l=o.getFromId(t,e.yref),u=s._size,c=a?Math.abs(a.l2p(e.sizex)-a.l2p(0)):e.sizex*u.w,h=l?Math.abs(l.l2p(e.sizey)-l.l2p(0)):e.sizey*u.h,f=c*d.x[e.xanchor].offset,p=h*d.y[e.yanchor].offset,v=d.x[e.xanchor].sizing+d.y[e.yanchor].sizing,m=(a?a.l2p(e.x)+a._offset:e.x*u.w+u.l)+f,g=(l?l.l2p(e.y)+l._offset:u.h-e.y*u.h+u.t)+p;switch(e.sizing){case"fill":v+=" slice";break;case"stretch":v="none"}r.attr({x:m,y:g,width:c,height:h,preserveAspectRatio:v,opacity:e.opacity});var y=a?a._id:"",b=l?l._id:"",x=y+b;r.call(i.setClipUrl,"clip"+s._uid+x)}function a(t,e){return t.source+e}var s=t._fullLayout,l=[],u=[],c=[];if(s.images){for(var h=0;h<s.images.length;h++){var f=s.images[h];"below"===f.layer&&"paper"!==f.xref&&"paper"!==f.yref?u.push(f):"above"===f.layer?l.push(f):c.push(f)}var d={x:{left:{sizing:"xMin",offset:0},center:{sizing:"xMid",offset:-0.5},right:{sizing:"xMax",offset:-1}},y:{top:{sizing:"YMin",offset:0},middle:{sizing:"YMid",offset:-0.5},bottom:{sizing:"YMax",offset:-1}}},p=s._imageLowerLayer.selectAll("image").data(c,a),v=s._imageSubplotLayer.selectAll("image").data(u,a),m=s._imageUpperLayer.selectAll("image").data(l,a);
p.enter().append("image").each(e),v.enter().append("image").each(e),m.enter().append("image").each(e),p.exit().remove(),v.exit().remove(),m.exit().remove(),p.each(r),v.each(r),m.each(r)}}},{"../../plots/cartesian/axes":592,"../drawing":506,d3:119}],518:[function(t,e,r){"use strict";var n=t("./draw"),i=t("./defaults"),o=t("./attributes");e.exports={draw:n,layoutAttributes:o,supplyLayoutDefaults:i}},{"./attributes":515,"./defaults":516,"./draw":517}],519:[function(t,e,r){"use strict";r.isRightAnchor=function(t){return"right"===t.xanchor||"auto"===t.xanchor&&t.x>=2/3},r.isCenterAnchor=function(t){return"center"===t.xanchor||"auto"===t.xanchor&&t.x>1/3&&t.x<2/3},r.isBottomAnchor=function(t){return"bottom"===t.yanchor||"auto"===t.yanchor&&t.y<=1/3},r.isMiddleAnchor=function(t){return"middle"===t.yanchor||"auto"===t.yanchor&&t.y>1/3&&t.y<2/3}},{}],520:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),i=t("../color/attributes"),o=t("../../lib/extend").extendFlat;e.exports={bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:i.defaultLine},borderwidth:{valType:"number",min:0,dflt:0},font:o({},n,{}),orientation:{valType:"enumerated",values:["v","h"],dflt:"v"},traceorder:{valType:"flaglist",flags:["reversed","grouped"],extras:["normal"]},tracegroupgap:{valType:"number",min:0,dflt:10},x:{valType:"number",min:-2,max:3,dflt:1.02},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left"},y:{valType:"number",min:-2,max:3,dflt:1},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto"}}},{"../../lib/extend":563,"../../plots/font_attributes":610,"../color/attributes":482}],521:[function(t,e,r){"use strict";e.exports={scrollBarWidth:4,scrollBarHeight:20,scrollBarColor:"#808BA4",scrollBarMargin:4}},{}],522:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../plots/plots"),o=t("./attributes"),a=t("./helpers");e.exports=function(t,e,r){function s(t,e){return n.coerce(f,d,o,t,e)}for(var l,u,c,h,f=t.legend||{},d=e.legend={},p=0,v="normal",m=0;m<r.length;m++){var g=r[m];a.legendGetsTrace(g)&&(p++,i.traceIs(g,"pie")&&p++),(i.traceIs(g,"bar")&&"stack"===e.barmode||-1!==["tonextx","tonexty"].indexOf(g.fill))&&(v=a.isGrouped({traceorder:v})?"grouped+reversed":"reversed"),void 0!==g.legendgroup&&""!==g.legendgroup&&(v=a.isReversed({traceorder:v})?"reversed+grouped":"grouped")}var y=n.coerce(t,e,i.layoutAttributes,"showlegend",p>1);if(y!==!1){if(s("bgcolor",e.paper_bgcolor),s("bordercolor"),s("borderwidth"),n.coerceFont(s,"font",e.font),s("orientation"),"h"===d.orientation){var b=t.xaxis;b&&b.rangeslider&&b.rangeslider.visible?(l=0,c="left",u=1.1,h="bottom"):(l=0,c="left",u=-.1,h="top")}s("traceorder",v),a.isGrouped(e.legend)&&s("tracegroupgap"),s("x",l),s("xanchor",c),s("y",u),s("yanchor",h),n.noneOrAll(f,d,["x","y"])}}},{"../../lib":568,"../../plots/plots":648,"./attributes":520,"./helpers":525}],523:[function(t,e,r){"use strict";function n(t,e){function r(r){c.util.convertToTspans(r,function(){r.selectAll("tspan.line").attr({x:r.attr("x")}),t.call(o,e)})}var n=t.data()[0][0],i=e._fullLayout,a=n.trace,s=f.traceIs(a,"pie"),l=a.index,u=s?n.label:a.name,h=t.selectAll("text.legendtext").data([0]);h.enter().append("text").classed("legendtext",!0),h.attr({x:40,y:0,"data-unformatted":u}).style("text-anchor","start").classed("user-select-none",!0).call(p.font,i.legend.font).text(u),e._context.editable&&!s?h.call(c.util.makeEditable).call(r).on("edit",function(t){this.attr({"data-unformatted":t}),this.text(t).call(r),this.text()||(t="    "),c.restyle(e,"name",t,l)}):h.call(r)}function i(t,e){var r=e._fullLayout.hiddenlabels?e._fullLayout.hiddenlabels.slice():[],n=t.selectAll("rect").data([0]);n.enter().append("rect").classed("legendtoggle",!0).style("cursor","pointer").attr("pointer-events","all").call(v.fill,"rgba(0,0,0,0)"),n.on("click",function(){if(!e._dragged){var n,i,o=t.data()[0][0],a=e._fullData,s=o.trace,l=s.legendgroup,u=[];if(f.traceIs(s,"pie")){var h=o.label,d=r.indexOf(h);-1===d?r.push(h):r.splice(d,1),c.relayout(e,"hiddenlabels",r)}else{if(""===l)u=[s.index];else for(var p=0;p<a.length;p++)n=a[p],n.legendgroup===l&&u.push(n.index);i=s.visible===!0?"legendonly":!0,c.restyle(e,"visible",i,u)}}})}function o(t,e){var r,n,i=t.data()[0][0],o=t.selectAll(".legendtoggle"),a=t.select("g[class*=math-group]"),s=e._fullLayout.legend,l=1.3*s.font.size;if(!i.trace.showlegend)return void t.remove();if(a.node()){var u=p.bBox(a.node());r=u.height,n=u.width,h.setTranslate(a,0,r/4)}else{var c=t.selectAll(".legendtext"),f=t.selectAll(".legendtext>tspan"),d=f[0].length||1;r=l*d,n=c.node()&&p.bBox(c.node()).width;var v=l*(.3+(1-d)/2);c.attr("y",v),f.attr("y",v)}r=Math.max(r,16)+3,o.attr({x:0,y:-r/2,height:r}),i.height=r,i.width=n}function a(t,e,r){var n=t._fullLayout,i=n.legend,o=i.borderwidth,a=b.isGrouped(i);if(b.isVertical(i))a&&e.each(function(t,e){h.setTranslate(this,0,e*i.tracegroupgap)}),i.width=0,i.height=0,r.each(function(t){var e=t[0],r=e.height,n=e.width;h.setTranslate(this,o,5+o+i.height+r/2),i.height+=r,i.width=Math.max(i.width,n)}),i.width+=45+2*o,i.height+=10+2*o,a&&(i.height+=(i._lgroupsLength-1)*i.tracegroupgap),r.selectAll(".legendtoggle").attr("width",(t._context.editable?0:i.width)+40),i.width=Math.ceil(i.width),i.height=Math.ceil(i.height);else if(a){i.width=0,i.height=0;for(var s=[i.width],l=e.data(),c=0,f=l.length;f>c;c++){var d=l[c].map(function(t){return t[0].width}),p=40+Math.max.apply(null,d);i.width+=i.tracegroupgap+p,s.push(i.width)}e.each(function(t,e){h.setTranslate(this,s[e],0)}),e.each(function(){var t=u.select(this),e=t.selectAll("g.traces"),r=0;e.each(function(t){var e=t[0],n=e.height;h.setTranslate(this,0,5+o+r+n/2),r+=n}),i.height=Math.max(i.height,r)}),i.height+=10+2*o,i.width+=2*o,i.width=Math.ceil(i.width),i.height=Math.ceil(i.height),r.selectAll(".legendtoggle").attr("width",t._context.editable?0:i.width)}else{i.width=0,i.height=0;var v=0,m=0,g=0,y=0;r.each(function(t){g=Math.max(40+t[0].width,g)}),r.each(function(t){var e=t[0],r=g,a=i.tracegroupgap||5;o+y+a+r>n.width-(n.margin.r+n.margin.l)&&(y=0,v+=m,i.height=i.height+m,m=0),h.setTranslate(this,o+y,5+o+e.height/2+v),i.width+=a+r,i.height=Math.max(i.height,e.height),y+=a+r,m=Math.max(e.height,m)}),i.width+=2*o,i.height+=10+2*o,i.width=Math.ceil(i.width),i.height=Math.ceil(i.height),r.selectAll(".legendtoggle").attr("width",t._context.editable?0:i.width)}}function s(t){var e=t._fullLayout,r=e.legend,n="left";x.isRightAnchor(r)?n="right":x.isCenterAnchor(r)&&(n="center");var i="top";x.isBottomAnchor(r)?i="bottom":x.isMiddleAnchor(r)&&(i="middle"),f.autoMargin(t,"legend",{x:r.x,y:r.y,l:r.width*({right:1,center:.5}[n]||0),r:r.width*({left:1,center:.5}[n]||0),b:r.height*({top:1,middle:.5}[i]||0),t:r.height*({bottom:1,middle:.5}[i]||0)})}function l(t){var e=t._fullLayout,r=e.legend,n="left";x.isRightAnchor(r)?n="right":x.isCenterAnchor(r)&&(n="center"),f.autoMargin(t,"legend",{x:r.x,y:.5,l:r.width*({right:1,center:.5}[n]||0),r:r.width*({left:1,center:.5}[n]||0),b:0,t:0})}var u=t("d3"),c=t("../../plotly"),h=t("../../lib"),f=t("../../plots/plots"),d=t("../dragelement"),p=t("../drawing"),v=t("../color"),m=t("./constants"),g=t("./get_legend_data"),y=t("./style"),b=t("./helpers"),x=t("./anchor_utils");e.exports=function(t){function e(t,e){T.attr("data-scroll",e).call(h.setTranslate,0,e),E.call(p.setRect,j,t,m.scrollBarWidth,m.scrollBarHeight),k.select("rect").attr({y:b.borderwidth-e})}var r=t._fullLayout,o="legend"+r._uid;if(r._infolayer&&t.calcdata){var b=r.legend,_=r.showlegend&&g(t.calcdata,b),w=r.hiddenlabels||[];if(!r.showlegend||!_.length)return r._infolayer.selectAll(".legend").remove(),r._topdefs.select("#"+o).remove(),void f.autoMargin(t,"legend");var M=r._infolayer.selectAll("g.legend").data([0]);M.enter().append("g").attr({"class":"legend","pointer-events":"all"});var k=r._topdefs.selectAll("#"+o).data([0]);k.enter().append("clipPath").attr("id",o).append("rect");var A=M.selectAll("rect.bg").data([0]);A.enter().append("rect").attr({"class":"bg","shape-rendering":"crispEdges"}),A.call(v.stroke,b.bordercolor),A.call(v.fill,b.bgcolor),A.style("stroke-width",b.borderwidth+"px");var T=M.selectAll("g.scrollbox").data([0]);T.enter().append("g").attr("class","scrollbox");var E=M.selectAll("rect.scrollbar").data([0]);E.enter().append("rect").attr({"class":"scrollbar",rx:20,ry:2,width:0,height:0}).call(v.fill,"#808BA4");var S=T.selectAll("g.groups").data(_);S.enter().append("g").attr("class","groups"),S.exit().remove();var L=S.selectAll("g.traces").data(h.identity);L.enter().append("g").attr("class","traces"),L.exit().remove(),L.call(y).style("opacity",function(t){var e=t[0].trace;return f.traceIs(e,"pie")?-1!==w.indexOf(t[0].label)?.5:1:"legendonly"===e.visible?.5:1}).each(function(){u.select(this).call(n,t).call(i,t)});var z=0!==M.enter().size();z&&(a(t,S,L),s(t));var I=0,P=r.width,C=0,R=r.height;a(t,S,L),b.height>R?l(t):s(t);var D=r._size,O=D.l+D.w*b.x,F=D.t+D.h*(1-b.y);x.isRightAnchor(b)?O-=b.width:x.isCenterAnchor(b)&&(O-=b.width/2),x.isBottomAnchor(b)?F-=b.height:x.isMiddleAnchor(b)&&(F-=b.height/2);var j=b.width,N=D.w;j>N?(O=D.l,j=N):(O+j>P&&(O=P-j),I>O&&(O=I),j=Math.min(P-O,b.width));var B=b.height,U=D.h;B>U?(F=D.t,B=U):(F+B>R&&(F=R-B),C>F&&(F=C),B=Math.min(R-F,b.height)),h.setTranslate(M,O,F);var V,q,G=B-m.scrollBarHeight-2*m.scrollBarMargin,H=b.height-B;if(b.height<=B||t._context.staticPlot)A.attr({width:j-b.borderwidth,height:B-b.borderwidth,x:b.borderwidth/2,y:b.borderwidth/2}),h.setTranslate(T,0,0),k.select("rect").attr({width:j-2*b.borderwidth,height:B-2*b.borderwidth,x:b.borderwidth,y:b.borderwidth}),T.call(p.setClipUrl,o);else{V=m.scrollBarMargin,q=T.attr("data-scroll")||0,A.attr({width:j-2*b.borderwidth+m.scrollBarWidth+m.scrollBarMargin,height:B-b.borderwidth,x:b.borderwidth/2,y:b.borderwidth/2}),k.select("rect").attr({width:j-2*b.borderwidth+m.scrollBarWidth+m.scrollBarMargin,height:B-2*b.borderwidth,x:b.borderwidth,y:b.borderwidth-q}),T.call(p.setClipUrl,o),z&&e(V,q),M.on("wheel",null),M.on("wheel",function(){q=h.constrain(T.attr("data-scroll")-u.event.deltaY/G*H,-H,0),V=m.scrollBarMargin-q/H*G,e(V,q),u.event.preventDefault()}),E.on(".drag",null),T.on(".drag",null);var X=u.behavior.drag().on("drag",function(){V=h.constrain(u.event.y-m.scrollBarHeight/2,m.scrollBarMargin,m.scrollBarMargin+G),q=-(V-m.scrollBarMargin)/G*H,e(V,q)});E.call(X),T.call(X)}if(t._context.editable){var Y,W,Z,K;M.classed("cursor-move",!0),d.init({element:M.node(),prepFn:function(){var t=h.getTranslate(M);Z=t.x,K=t.y},moveFn:function(t,e){var r=Z+t,n=K+e;h.setTranslate(M,r,n),Y=d.align(r,0,D.l,D.l+D.w,b.xanchor),W=d.align(n,0,D.t+D.h,D.t,b.yanchor)},doneFn:function(e){e&&void 0!==Y&&void 0!==W&&c.relayout(t,{"legend.x":Y,"legend.y":W})}})}}}},{"../../lib":568,"../../plotly":589,"../../plots/plots":648,"../color":483,"../dragelement":504,"../drawing":506,"./anchor_utils":519,"./constants":521,"./get_legend_data":524,"./helpers":525,"./style":527,d3:119}],524:[function(t,e,r){"use strict";var n=t("../../plots/plots"),i=t("./helpers");e.exports=function(t,e){function r(t,r){if(""!==t&&i.isGrouped(e))-1===l.indexOf(t)?(l.push(t),u=!0,s[t]=[[r]]):s[t].push([r]);else{var n="~~i"+h;l.push(n),s[n]=[[r]],h++}}var o,a,s={},l=[],u=!1,c={},h=0;for(o=0;o<t.length;o++){var f=t[o],d=f[0],p=d.trace,v=p.legendgroup;if(i.legendGetsTrace(p)&&p.showlegend)if(n.traceIs(p,"pie"))for(c[v]||(c[v]={}),a=0;a<f.length;a++){var m=f[a].label;c[v][m]||(r(v,{label:m,color:f[a].color,i:f[a].i,trace:p}),c[v][m]=!0)}else r(v,d)}if(!l.length)return[];var g,y,b=l.length;if(u&&i.isGrouped(e))for(y=new Array(b),o=0;b>o;o++)g=s[l[o]],y[o]=i.isReversed(e)?g.reverse():g;else{for(y=[new Array(b)],o=0;b>o;o++)g=s[l[o]][0],y[0][i.isReversed(e)?b-o-1:o]=g;b=1}return e._lgroupsLength=b,y}},{"../../plots/plots":648,"./helpers":525}],525:[function(t,e,r){"use strict";var n=t("../../plots/plots");r.legendGetsTrace=function(t){return t.visible&&n.traceIs(t,"showLegend")},r.isGrouped=function(t){return-1!==(t.traceorder||"").indexOf("grouped")},r.isVertical=function(t){return"h"!==t.orientation},r.isReversed=function(t){return-1!==(t.traceorder||"").indexOf("reversed")}},{"../../plots/plots":648}],526:[function(t,e,r){"use strict";var n=e.exports={};n.layoutAttributes=t("./attributes"),n.supplyLayoutDefaults=t("./defaults"),n.draw=t("./draw"),n.style=t("./style")},{"./attributes":520,"./defaults":522,"./draw":523,"./style":527}],527:[function(t,e,r){"use strict";function n(t){var e=t[0].trace,r=e.visible&&e.fill&&"none"!==e.fill,n=d.hasLines(e),i=l.select(this).select(".legendfill").selectAll("path").data(r?[t]:[]);i.enter().append("path").classed("js-fill",!0),i.exit().remove(),i.attr("d","M5,0h30v6h-30z").call(h.fillGroupStyle);var o=l.select(this).select(".legendlines").selectAll("path").data(n?[t]:[]);o.enter().append("path").classed("js-line",!0).attr("d","M5,0h30"),o.exit().remove(),o.call(h.lineGroupStyle)}function i(t){function e(t,e,r){var n=u.nestedProperty(a,t).get(),i=Array.isArray(n)&&e?e(n):n;if(r){if(i<r[0])return r[0];if(i>r[1])return r[1]}return i}function r(t){return t[0]}var n,i,o=t[0],a=o.trace,s=d.hasMarkers(a),c=d.hasText(a),f=d.hasLines(a);if(s||c||f){var p={},v={};s&&(p.mc=e("marker.color",r),p.mo=e("marker.opacity",u.mean,[.2,1]),p.ms=e("marker.size",u.mean,[2,16]),p.mlc=e("marker.line.color",r),p.mlw=e("marker.line.width",u.mean,[0,5]),v.marker={sizeref:1,sizemin:1,sizemode:"diameter"}),f&&(v.line={width:e("line.width",r,[0,10])}),c&&(p.tx="Aa",p.tp=e("textposition",r),p.ts=10,p.tc=e("textfont.color",r),p.tf=e("textfont.family",r)),n=[u.minExtend(o,p)],i=u.minExtend(a,v)}var m=l.select(this).select("g.legendpoints"),g=m.selectAll("path.scatterpts").data(s?n:[]);g.enter().append("path").classed("scatterpts",!0).attr("transform","translate(20,0)"),g.exit().remove(),g.call(h.pointStyle,i),s&&(n[0].mrc=3);var y=m.selectAll("g.pointtext").data(c?n:[]);y.enter().append("g").classed("pointtext",!0).append("text").attr("transform","translate(20,0)"),y.exit().remove(),y.selectAll("text").call(h.textPointStyle,i)}function o(t){var e=t[0].trace,r=e.marker||{},n=r.line||{},i=l.select(this).select("g.legendpoints").selectAll("path.legendbar").data(c.traceIs(e,"bar")?[t]:[]);i.enter().append("path").classed("legendbar",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),i.exit().remove(),i.each(function(t){var e=(t.mlw+1||n.width+1)-1,i=l.select(this);i.style("stroke-width",e+"px").call(f.fill,t.mc||r.color),e&&i.call(f.stroke,t.mlc||n.color)})}function a(t){var e=t[0].trace,r=l.select(this).select("g.legendpoints").selectAll("path.legendbox").data(c.traceIs(e,"box")&&e.visible?[t]:[]);r.enter().append("path").classed("legendbox",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),r.exit().remove(),r.each(function(t){var r=(t.lw+1||e.line.width+1)-1,n=l.select(this);n.style("stroke-width",r+"px").call(f.fill,t.fc||e.fillcolor),r&&n.call(f.stroke,t.lc||e.line.color)})}function s(t){var e=t[0].trace,r=l.select(this).select("g.legendpoints").selectAll("path.legendpie").data(c.traceIs(e,"pie")&&e.visible?[t]:[]);r.enter().append("path").classed("legendpie",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),r.exit().remove(),r.size()&&r.call(p,t[0],e)}var l=t("d3"),u=t("../../lib"),c=t("../../plots/plots"),h=t("../drawing"),f=t("../color"),d=t("../../traces/scatter/subtypes"),p=t("../../traces/pie/style_one");e.exports=function(t){t.each(function(t){var e=l.select(this),r=e.selectAll("g.legendfill").data([t]);r.enter().append("g").classed("legendfill",!0);var n=e.selectAll("g.legendlines").data([t]);n.enter().append("g").classed("legendlines",!0);var i=e.selectAll("g.legendsymbols").data([t]);i.enter().append("g").classed("legendsymbols",!0),i.style("opacity",t[0].trace.opacity),i.selectAll("g.legendpoints").data([t]).enter().append("g").classed("legendpoints",!0)}).each(o).each(a).each(s).each(n).each(i)}},{"../../lib":568,"../../plots/plots":648,"../../traces/pie/style_one":748,"../../traces/scatter/subtypes":769,"../color":483,"../drawing":506,d3:119}],528:[function(t,e,r){"use strict";function n(t,e){var r=e.currentTarget,n=r.getAttribute("data-attr"),i=r.getAttribute("data-val")||!0,o=t._fullLayout,a={};if("zoom"===n){for(var s,l,c="in"===i?.5:2,h=(1+c)/2,f=(1-c)/2,d=u.Axes.list(t,null,!0),p=0;p<d.length;p++)if(s=d[p],!s.fixedrange)if(l=s._name,"auto"===i)a[l+".autorange"]=!0;else if("reset"===i)if(void 0===s._rangeInitial)a[l+".autorange"]=!0;else{var v=s._rangeInitial.slice();a[l+".range[0]"]=v[0],a[l+".range[1]"]=v[1]}else{var m=s.range;a[l+".range[0]"]=h*m[0]+f*m[1],a[l+".range[1]"]=h*m[1]+f*m[0]}}else"hovermode"!==n||"x"!==i&&"y"!==i||(i=o._isHoriz?"y":"x",r.setAttribute("data-val",i)),a[n]=i;u.relayout(t,a)}function i(t,e){for(var r=e.currentTarget,n=r.getAttribute("data-attr"),i=r.getAttribute("data-val")||!0,o=t._fullLayout,a=u.Plots.getSubplotIds(o,"gl3d"),s={},l=n.split("."),c=0;c<a.length;c++)s[a[c]+"."+l[1]]=i;u.relayout(t,s)}function o(t,e){for(var r=e.currentTarget,n=r.getAttribute("data-attr"),i=t._fullLayout,o=u.Plots.getSubplotIds(i,"gl3d"),a=0;a<o.length;a++){var s=o[a],l=i[s],c=l._scene;"resetDefault"===n?c.setCameraToDefault():"resetLastSave"===n&&c.setCamera(l.camera)}}function a(t,e){var r=e.currentTarget,n=r._previousVal||!1,i=t.layout,o=t._fullLayout,a=u.Plots.getSubplotIds(o,"gl3d"),s=["xaxis","yaxis","zaxis"],l=["showspikes","spikesides","spikethickness","spikecolor"],h={},f={},d={};if(n)d=c.extendDeep(i,n),r._previousVal=null;else{d={"allaxes.showspikes":!1};for(var p=0;p<a.length;p++){var v=a[p],m=o[v],g=h[v]={};g.hovermode=m.hovermode,d[v+".hovermode"]=!1;for(var y=0;3>y;y++){var b=s[y];f=g[b]={};for(var x=0;x<l.length;x++){var _=l[x];f[_]=m[b][_]}}}r._previousVal=c.extendDeep({},h)}u.relayout(t,d)}function s(t,e){for(var r=e.currentTarget,n=r.getAttribute("data-attr"),i=r.getAttribute("data-val")||!0,o=t._fullLayout,a=u.Plots.getSubplotIds(o,"geo"),s=0;s<a.length;s++){var l=o[a[s]]._geo;if("zoom"===n){var c=l.projection.scale(),h="in"===i?2*c:.5*c;l.projection.scale(h),l.zoom.scale(h),l.render()}else"reset"===n&&l.zoomReset()}}function l(t){var e,r=t._fullLayout;e=r._has("cartesian")?r._isHoriz?"y":"x":"closest";var n=t._fullLayout.hovermode?!1:e;u.relayout(t,"hovermode",n)}var u=t("../../plotly"),c=t("../../lib"),h=t("../../snapshot/download"),f=t("../../../build/ploticon"),d=e.exports={};d.toImage={name:"toImage",title:"Download plot as a png",icon:f.camera,click:function(t){var e="png";c.notifier("Taking snapshot - this may take a few seconds","long"),c.isIE()&&(c.notifier("IE only supports svg.  Changing format to svg.","long"),e="svg"),h(t,{format:e}).then(function(t){c.notifier("Snapshot succeeded - "+t,"long")}).catch(function(){c.notifier("Sorry there was a problem downloading your snapshot!","long")})}},d.sendDataToCloud={name:"sendDataToCloud",title:"Save and edit plot in cloud",icon:f.disk,click:function(t){u.Plots.sendDataToCloud(t)}},d.zoom2d={name:"zoom2d",title:"Zoom",attr:"dragmode",val:"zoom",icon:f.zoombox,click:n},d.pan2d={name:"pan2d",title:"Pan",attr:"dragmode",val:"pan",icon:f.pan,click:n},d.select2d={name:"select2d",title:"Box Select",attr:"dragmode",val:"select",icon:f.selectbox,click:n},d.lasso2d={name:"lasso2d",title:"Lasso Select",attr:"dragmode",val:"lasso",icon:f.lasso,click:n},d.zoomIn2d={name:"zoomIn2d",title:"Zoom in",attr:"zoom",val:"in",icon:f.zoom_plus,click:n},d.zoomOut2d={name:"zoomOut2d",title:"Zoom out",attr:"zoom",val:"out",icon:f.zoom_minus,click:n},d.autoScale2d={name:"autoScale2d",title:"Autoscale",attr:"zoom",val:"auto",icon:f.autoscale,click:n},d.resetScale2d={name:"resetScale2d",title:"Reset axes",attr:"zoom",val:"reset",icon:f.home,click:n},d.hoverClosestCartesian={name:"hoverClosestCartesian",title:"Show closest data on hover",attr:"hovermode",val:"closest",icon:f.tooltip_basic,gravity:"ne",click:n},d.hoverCompareCartesian={name:"hoverCompareCartesian",title:"Compare data on hover",attr:"hovermode",val:function(t){return t._fullLayout._isHoriz?"y":"x"},icon:f.tooltip_compare,gravity:"ne",click:n},d.zoom3d={name:"zoom3d",title:"Zoom",attr:"scene.dragmode",val:"zoom",icon:f.zoombox,click:i},d.pan3d={name:"pan3d",title:"Pan",attr:"scene.dragmode",val:"pan",icon:f.pan,click:i},d.orbitRotation={name:"orbitRotation",title:"orbital rotation",attr:"scene.dragmode",val:"orbit",icon:f["3d_rotate"],click:i},d.tableRotation={name:"tableRotation",title:"turntable rotation",attr:"scene.dragmode",val:"turntable",icon:f["z-axis"],click:i},d.resetCameraDefault3d={name:"resetCameraDefault3d",title:"Reset camera to default",attr:"resetDefault",icon:f.home,click:o},d.resetCameraLastSave3d={name:"resetCameraLastSave3d",title:"Reset camera to last save",attr:"resetLastSave",icon:f.movie,click:o},d.hoverClosest3d={name:"hoverClosest3d",title:"Toggle show closest data on hover",attr:"hovermode",val:null,toggle:!0,icon:f.tooltip_basic,gravity:"ne",click:a},d.zoomInGeo={name:"zoomInGeo",title:"Zoom in",attr:"zoom",val:"in",icon:f.zoom_plus,click:s},d.zoomOutGeo={name:"zoomOutGeo",title:"Zoom out",attr:"zoom",val:"out",icon:f.zoom_minus,click:s},d.resetGeo={name:"resetGeo",title:"Reset",attr:"reset",val:null,icon:f.autoscale,click:s},d.hoverClosestGeo={name:"hoverClosestGeo",title:"Toggle show closest data on hover",attr:"hovermode",val:null,toggle:!0,icon:f.tooltip_basic,gravity:"ne",click:l},d.hoverClosestGl2d={name:"hoverClosestGl2d",title:"Toggle show closest data on hover",attr:"hovermode",val:null,toggle:!0,icon:f.tooltip_basic,gravity:"ne",click:l},d.hoverClosestPie={name:"hoverClosestPie",title:"Toggle show closest data on hover",attr:"hovermode",val:"closest",icon:f.tooltip_basic,gravity:"ne",click:l},d.toggleHover={name:"toggleHover",title:"Toggle show closest data on hover",attr:"hovermode",val:null,toggle:!0,icon:f.tooltip_basic,gravity:"ne",click:function(t,e){l(t),a(t,e)}},d.resetViews={name:"resetViews",title:"Reset views",icon:f.home,click:function(t,e){var r=e.currentTarget;r.setAttribute("data-attr","zoom"),r.setAttribute("data-val","reset"),n(t,e),r.setAttribute("data-attr","resetLastSave"),o(t,e)}}},{"../../../build/ploticon":2,"../../lib":568,"../../plotly":589,"../../snapshot/download":663}],529:[function(t,e,r){"use strict";function n(t){this.container=t.container,this.element=document.createElement("div"),this.update(t.graphInfo,t.buttons),this.container.appendChild(this.element)}function i(t,e){var r=t._fullLayout,i=new n({graphInfo:t,container:r._paperdiv.node(),buttons:e});return r._privateplot&&o.select(i.element).append("span").classed("badge-private float--left",!0).text("PRIVATE"),i}var o=t("d3"),a=t("../../lib"),s=t("../../../build/ploticon"),l=n.prototype;l.update=function(t,e){this.graphInfo=t;var r=this.graphInfo._context;"hover"===r.displayModeBar?this.element.className="modebar modebar--hover":this.element.className="modebar";var n=!this.hasButtons(e),i=this.hasLogo!==r.displaylogo;(n||i)&&(this.removeAllButtons(),this.updateButtons(e),r.displaylogo&&(this.element.appendChild(this.getLogo()),this.hasLogo=!0)),this.updateActiveButton()},l.updateButtons=function(t){var e=this;this.buttons=t,this.buttonElements=[],this.buttonsNames=[],this.buttons.forEach(function(t){var r=e.createGroup();t.forEach(function(t){var n=t.name;if(!n)throw new Error("must provide button 'name' in button config");if(-1!==e.buttonsNames.indexOf(n))throw new Error("button name '"+n+"' is taken");e.buttonsNames.push(n);var i=e.createButton(t);e.buttonElements.push(i),r.appendChild(i)}),e.element.appendChild(r)})},l.createGroup=function(){var t=document.createElement("div");return t.className="modebar-group",t},l.createButton=function(t){var e=this,r=document.createElement("a");r.setAttribute("rel","tooltip"),r.className="modebar-btn";var n=t.title;void 0===n&&(n=t.name),(n||0===n)&&r.setAttribute("data-title",n),void 0!==t.attr&&r.setAttribute("data-attr",t.attr);var i=t.val;void 0!==i&&("function"==typeof i&&(i=i(this.graphInfo)),r.setAttribute("data-val",i));var o=t.click;if("function"!=typeof o)throw new Error("must provide button 'click' function in button config");return r.addEventListener("click",function(r){t.click(e.graphInfo,r),e.updateActiveButton(r.currentTarget)}),r.setAttribute("data-toggle",t.toggle||!1),t.toggle&&r.classList.add("active"),r.appendChild(this.createIcon(t.icon||s.question)),r.setAttribute("data-gravity",t.gravity||"n"),r},l.createIcon=function(t){var e=t.ascent-t.descent,r="http://www.w3.org/2000/svg",n=document.createElementNS(r,"svg"),i=document.createElementNS(r,"path");return n.setAttribute("height","1em"),n.setAttribute("width",t.width/e+"em"),n.setAttribute("viewBox",[0,0,t.width,e].join(" ")),i.setAttribute("d",t.path),i.setAttribute("transform","matrix(1 0 0 -1 0 "+t.ascent+")"),n.appendChild(i),n},l.updateActiveButton=function(t){var e=this.graphInfo._fullLayout,r=void 0!==t?t.getAttribute("data-attr"):null;this.buttonElements.forEach(function(t){var n=t.getAttribute("data-val")||!0,i=t.getAttribute("data-attr"),s="true"===t.getAttribute("data-toggle"),l=o.select(t);if(s)i===r&&l.classed("active",!l.classed("active"));else{var u=null===i?i:a.nestedProperty(e,i).get();l.classed("active",u===n)}})},l.hasButtons=function(t){var e=this.buttons;if(!e)return!1;if(t.length!==e.length)return!1;for(var r=0;r<t.length;++r){if(t[r].length!==e[r].length)return!1;for(var n=0;n<t[r].length;n++)if(t[r][n].name!==e[r][n].name)return!1}return!0},l.getLogo=function(){var t=this.createGroup(),e=document.createElement("a");return e.href="https://plot.ly/",e.target="_blank",e.setAttribute("data-title","Produced with Plotly"),e.className="modebar-btn plotlyjsicon modebar-btn--logo",e.appendChild(this.createIcon(s.plotlylogo)),t.appendChild(e),t},l.removeAllButtons=function(){for(;this.element.firstChild;)this.element.removeChild(this.element.firstChild);this.hasLogo=!1},l.destroy=function(){a.removeElement(this.container.querySelector(".modebar"))},e.exports=i},{"../../../build/ploticon":2,"../../lib":568,d3:119}],530:[function(t,e,r){"use strict";function n(t,e,r){function n(t){for(var r=[],n=0;n<t.length;n++){var i=t[n];-1===e.indexOf(i)&&r.push(h[i])}m.push(r)}var s=t._fullLayout,l=t._fullData,u=s._has("cartesian"),c=s._has("gl3d"),f=s._has("geo"),d=s._has("pie"),p=s._has("gl2d"),v=s._has("ternary"),m=[];if(n(["toImage","sendDataToCloud"]),(u||p||d||v)+f+c>1)return n(["resetViews","toggleHover"]),a(m,r);c&&(n(["zoom3d","pan3d","orbitRotation","tableRotation"]),n(["resetCameraDefault3d","resetCameraLastSave3d"]),n(["hoverClosest3d"])),f&&(n(["zoomInGeo","zoomOutGeo","resetGeo"]),n(["hoverClosestGeo"]));var g=i(s),y=[];return((u||p)&&!g||v)&&(y=["zoom2d","pan2d"]),(u||v)&&o(l)&&(y.push("select2d"),y.push("lasso2d")),y.length&&n(y),!u&&!p||g||v||n(["zoomIn2d","zoomOut2d","autoScale2d","resetScale2d"]),u&&d?n(["toggleHover"]):p?n(["hoverClosestGl2d"]):u?n(["hoverClosestCartesian","hoverCompareCartesian"]):d&&n(["hoverClosestPie"]),a(m,r)}function i(t){for(var e=l.Axes.list({_fullLayout:t},null,!0),r=!0,n=0;n<e.length;n++)if(!e[n].fixedrange){r=!1;break}return r}function o(t){for(var e=!1,r=0;r<t.length&&!e;r++){var n=t[r];n._module&&n._module.selectPoints&&("scatter"===n.type||"scatterternary"===n.type?(u.hasMarkers(n)||u.hasText(n))&&(e=!0):e=!0)}return e}function a(t,e){if(e.length)if(Array.isArray(e[0]))for(var r=0;r<e.length;r++)t.push(e[r]);else t.push(e);return t}function s(t){for(var e=0;e<t.length;e++)for(var r=t[e],n=0;n<r.length;n++){var i=r[n];if("string"==typeof i){if(void 0===h[i])throw new Error(["*modeBarButtons* configuration options","invalid button name"].join(" "));t[e][n]=h[i]}}return t}var l=t("../../plotly"),u=t("../../traces/scatter/subtypes"),c=t("./"),h=t("./buttons");e.exports=function(t){var e=t._fullLayout,r=t._context,i=e._modeBar;if(!r.displayModeBar)return void(i&&(i.destroy(),delete e._modeBar));if(!Array.isArray(r.modeBarButtonsToRemove))throw new Error(["*modeBarButtonsToRemove* configuration options","must be an array."].join(" "));if(!Array.isArray(r.modeBarButtonsToAdd))throw new Error(["*modeBarButtonsToAdd* configuration options","must be an array."].join(" "));var o,a=r.modeBarButtons;o=Array.isArray(a)&&a.length?s(a):n(t,r.modeBarButtonsToRemove,r.modeBarButtonsToAdd),i?i.update(t,o):e._modeBar=c(t,o)}},{"../../plotly":589,"../../traces/scatter/subtypes":769,"./":529,"./buttons":528}],531:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),i=t("../color/attributes"),o=t("../../lib/extend").extendFlat,a=t("./button_attributes");a=o(a,{_isLinkedToArray:!0}),e.exports={visible:{valType:"boolean"},buttons:a,x:{valType:"number",min:-2,max:3},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left"},y:{valType:"number",min:-2,max:3},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"bottom"},font:o({},n,{}),bgcolor:{valType:"color",dflt:i.lightLine},activecolor:{valType:"color"},bordercolor:{valType:"color",dflt:i.defaultLine},borderwidth:{valType:"number",min:0,dflt:0}}},{"../../lib/extend":563,"../../plots/font_attributes":610,"../color/attributes":482,"./button_attributes":532}],532:[function(t,e,r){"use strict";e.exports={step:{valType:"enumerated",values:["month","year","day","hour","minute","second","all"],dflt:"month"},stepmode:{valType:"enumerated",values:["backward","todate"],dflt:"backward"},count:{valType:"number",min:0,dflt:1},label:{valType:"string"}}},{}],533:[function(t,e,r){"use strict";e.exports={yPad:.02,minButtonWidth:30,rx:3,ry:3,lightAmount:25,darkAmount:10}},{}],534:[function(t,e,r){"use strict";function n(t,e){function r(t,e){return o.coerce(n,i,l,t,e)}for(var n,i,a=t.buttons||[],s=e.buttons=[],u=0;u<a.length;u++)if(n=a[u],i={},o.isPlainObject(n)){var c=r("step");"all"!==c&&(r("stepmode"),r("count")),r("label"),i._index=u,s.push(i)}return s}function i(t,e,r){for(var n=r.filter(function(r){return e[r].anchor===t._id}),i=0,o=0;o<n.length;o++)i=Math.max(e[n[o]].domain[1],i);return[t.domain[0],i+u.yPad]}var o=t("../../lib"),a=t("../color"),s=t("./attributes"),l=t("./button_attributes"),u=t("./constants");e.exports=function(t,e,r,l){function c(t,e){return o.coerce(h,f,s,t,e)}var h=t.rangeselector||{},f=e.rangeselector={},d=n(h,f),p=c("visible",d.length>0);if(p){var v=i(e,r,l);c("x",v[0]),c("y",v[1]),o.noneOrAll(t,e,["x","y"]),c("xanchor"),c("yanchor"),o.coerceFont(c,"font",r.font);var m=c("bgcolor");c("activecolor",a.contrast(m,u.lightAmount,u.darkAmount)),c("bordercolor"),c("borderwidth")}}},{"../../lib":568,"../color":483,"./attributes":531,"./button_attributes":532,"./constants":533}],535:[function(t,e,r){"use strict";function n(t){for(var e=g.list(t,"x",!0),r=[],n=0;n<e.length;n++){var i=e[n];i.rangeselector&&i.rangeselector.visible&&r.push(i)}return r}function i(t){return t._id}function o(t,e,r){if("all"===e.step)return t.autorange===!0;var n=Object.keys(r);return t.range[0]===r[n[0]]&&t.range[1]===r[n[1]]}function a(t,e,r){var n=t.selectAll("rect").data([0]);n.enter().append("rect").classed("selector-rect",!0),n.attr("shape-rendering","crispEdges"),n.attr({rx:b.rx,ry:b.ry}),n.call(p.stroke,e.bordercolor).call(p.fill,s(e,r)).style("stroke-width",e.borderwidth+"px")}function s(t,e){return e.isActive||e.isHovered?t.activecolor:t.bgcolor}function l(t,e,r){function n(t){m.convertToTspans(t)}var i=t.selectAll("text").data([0]);i.enter().append("text").classed("selector-text",!0).classed("user-select-none",!0),i.attr("text-anchor","middle"),i.call(v.font,e.font).text(u(r)).call(n)}function u(t){return t.label?t.label:"all"===t.step?"all":t.count+t.step.charAt(0)}function c(t,e,r,n){r.width=0,r.height=0;var i=r.borderwidth;e.each(function(){var t=h.select(this),e=t.select(".selector-text"),n=e.selectAll("tspan"),i=1.3*r.font.size,o=n[0].length||1,a=Math.max(i*o,16)+3;r.height=Math.max(r.height,a)}),e.each(function(){var t=h.select(this),e=t.select(".selector-rect"),n=t.select(".selector-text"),o=n.selectAll("tspan"),a=n.node()&&v.bBox(n.node()).width,s=1.3*r.font.size,l=o[0].length||1,u=Math.max(a+10,b.minButtonWidth);
t.attr("transform","translate("+(i+r.width)+","+i+")"),e.attr({x:0,y:0,width:u,height:r.height});var c={x:u/2,y:r.height/2-(l-1)*s/2+3};n.attr(c),o.attr(c),r.width+=u+5}),e.selectAll("rect").attr("height",r.height);var o=t._fullLayout._size;r.lx=o.l+o.w*r.x,r.ly=o.t+o.h*(1-r.y);var a="left";y.isRightAnchor(r)&&(r.lx-=r.width,a="right"),y.isCenterAnchor(r)&&(r.lx-=r.width/2,a="center");var s="top";y.isBottomAnchor(r)&&(r.ly-=r.height,s="bottom"),y.isMiddleAnchor(r)&&(r.ly-=r.height/2,s="middle"),r.width=Math.ceil(r.width),r.height=Math.ceil(r.height),r.lx=Math.round(r.lx),r.ly=Math.round(r.ly),d.autoMargin(t,n+"-range-selector",{x:r.x,y:r.y,l:r.width*({right:1,center:.5}[a]||0),r:r.width*({left:1,center:.5}[a]||0),b:r.height*({top:1,middle:.5}[s]||0),t:r.height*({bottom:1,middle:.5}[s]||0)})}var h=t("d3"),f=t("../../plotly"),d=t("../../plots/plots"),p=t("../color"),v=t("../drawing"),m=t("../../lib/svg_text_utils"),g=t("../../plots/cartesian/axis_ids"),y=t("../legend/anchor_utils"),b=t("./constants"),x=t("./get_update_object");e.exports=function(t){var e=t._fullLayout,r=e._infolayer.selectAll(".rangeselector").data(n(t),i);r.enter().append("g").classed("rangeselector",!0),r.exit().remove(),r.style({cursor:"pointer","pointer-events":"all"}),r.each(function(e){var r=h.select(this),n=e,i=n.rangeselector,s=r.selectAll("g.button").data(i.buttons);s.enter().append("g").classed("button",!0),s.exit().remove(),s.each(function(e){var r=h.select(this),s=x(n,e);e.isActive=o(n,e,s),r.call(a,i,e),r.call(l,i,e),r.on("click",function(){t._dragged||f.relayout(t,s)}),r.on("mouseover",function(){e.isHovered=!0,r.call(a,i,e)}),r.on("mouseout",function(){e.isHovered=!1,r.call(a,i,e)})}),c(t,s,i,n._name),r.attr("transform","translate("+i.lx+","+i.ly+")")})}},{"../../lib/svg_text_utils":581,"../../plotly":589,"../../plots/cartesian/axis_ids":594,"../../plots/plots":648,"../color":483,"../drawing":506,"../legend/anchor_utils":519,"./constants":533,"./get_update_object":536,d3:119}],536:[function(t,e,r){"use strict";function n(t,e){var r,n=t.range,o=new Date(n[1]),a=e.step,s=e.count;switch(e.stepmode){case"backward":r=i.time[a].offset(o,-s).getTime();break;case"todate":var l=i.time[a].offset(o,-(s-1));r=i.time[a].floor(l).getTime()}var u=n[1];return[r,u]}var i=t("d3");e.exports=function(t,e){var r=t._name,i={};if("all"===e.step)i[r+".autorange"]=!0;else{var o=n(t,e);i[r+".range[0]"]=o[0],i[r+".range[1]"]=o[1]}return i}},{d3:119}],537:[function(t,e,r){"use strict";r.attributes=t("./attributes"),r.supplyLayoutDefaults=t("./defaults"),r.draw=t("./draw")},{"./attributes":531,"./defaults":534,"./draw":535}],538:[function(t,e,r){"use strict";var n=t("../color/attributes");e.exports={bgcolor:{valType:"color",dflt:n.background},bordercolor:{valType:"color",dflt:n.defaultLine},borderwidth:{valType:"integer",dflt:0,min:0},range:{valType:"info_array",items:[{valType:"number"},{valType:"number"}]},thickness:{valType:"number",dflt:.15,min:0,max:1},visible:{valType:"boolean",dflt:!0}}},{"../color/attributes":482}],539:[function(t,e,r){"use strict";var n=t("../../plotly"),i=t("../../plots/cartesian/axes"),o=t("../../lib"),a=t("../../constants/xmlns_namespaces").svg,s=t("./helpers"),l=t("./range_plot");e.exports=function(t){function e(t){var e=d.range[0],r=d.range[1],n=r-e,i=t/p*n+e;return i=o.constrain(i,e,r)}function r(t,e){t=t||-(1/0),e=e||1/0;var r=d.range[0],n=d.range[1],i=n-r,o=(t-r)/i*p,a=(e-r)/i*p;c(o,a)}function u(e,r){window.requestAnimationFrame?window.requestAnimationFrame(function(){n.relayout(t,"xaxis.range",[e,r])}):setTimeout(function(){n.relayout(t,"xaxis.range",[e,r])},16)}function c(t,e){if(t=o.constrain(t,0,p),e=o.constrain(e,0,p),t>e){var r=e;e=t,t=r}s.setAttributes(w,{"data-min":t,"data-max":e}),s.setAttributes(C,{x:t,width:e-t}),s.setAttributes(A,{width:t}),s.setAttributes(T,{x:e,width:p-e}),s.setAttributes(E,{transform:"translate("+(t-m-1)+")"}),s.setAttributes(z,{transform:"translate("+e+")"})}var h=t._fullLayout,f=h._infolayer.selectAll("g.range-slider"),d=h.xaxis.rangeslider,p=h._size.w,v=(h.height-h.margin.b-h.margin.t)*d.thickness,m=2,g=Math.floor(d.borderwidth/2),y=h.margin.l,b=h.height-v-h.margin.b,x=0,_=p,w=document.createElementNS(a,"g");s.setAttributes(w,{"class":"range-slider","data-min":x,"data-max":_,"pointer-events":"all",transform:"translate("+y+","+b+")"});var M=document.createElementNS(a,"rect"),k=d.borderwidth%2===0?d.borderwidth:d.borderwidth-1;s.setAttributes(M,{fill:d.bgcolor,stroke:d.bordercolor,"stroke-width":d.borderwidth,height:v+k,width:p+k,transform:"translate(-"+g+", -"+g+")","shape-rendering":"crispEdges"});var A=document.createElementNS(a,"rect");s.setAttributes(A,{x:0,width:x,height:v,fill:"rgba(0,0,0,0.4)"});var T=document.createElementNS(a,"rect");s.setAttributes(T,{x:_,width:p-_,height:v,fill:"rgba(0,0,0,0.4)"});var E=document.createElementNS(a,"g"),S=document.createElementNS(a,"rect"),L=document.createElementNS(a,"rect");s.setAttributes(E,{transform:"translate("+(x-m-1)+")"}),s.setAttributes(S,{width:10,height:v,x:-6,fill:"transparent",cursor:"col-resize"}),s.setAttributes(L,{width:m,height:v/2,y:v/4,rx:1,fill:"white",stroke:"#666","shape-rendering":"crispEdges"}),s.appendChildren(E,[L,S]);var z=document.createElementNS(a,"g"),I=document.createElementNS(a,"rect"),P=document.createElementNS(a,"rect");s.setAttributes(z,{transform:"translate("+_+")"}),s.setAttributes(I,{width:10,height:v,x:-2,fill:"transparent",cursor:"col-resize"}),s.setAttributes(P,{width:m,height:v/2,y:v/4,rx:1,fill:"white",stroke:"#666","shape-rendering":"crispEdges"}),s.appendChildren(z,[P,I]);var C=document.createElementNS(a,"rect");s.setAttributes(C,{x:x,width:_-x,height:v,cursor:"ew-resize",fill:"transparent"}),w.addEventListener("mousedown",function(t){function r(t){var r,n,h=+t.clientX-o;switch(i){case C:w.style.cursor="ew-resize",r=+s+h,n=+l+h,c(r,n),u(e(r),e(n));break;case S:w.style.cursor="col-resize",r=+s+h,n=+l,c(r,n),u(e(r),e(n));break;case I:w.style.cursor="col-resize",r=+s,n=+l+h,c(r,n),u(e(r),e(n));break;default:w.style.cursor="ew-resize",r=a,n=a+h,c(r,n),u(e(r),e(n))}}function n(){window.removeEventListener("mousemove",r),window.removeEventListener("mouseup",n),w.style.cursor="auto"}var i=t.target,o=t.clientX,a=o-w.getBoundingClientRect().left,s=w.getAttribute("data-min"),l=w.getAttribute("data-max");window.addEventListener("mousemove",r),window.addEventListener("mouseup",n)}),d.range||(d.range=i.getAutoRange(h.xaxis));var R=l(t,p,v);s.appendChildren(w,[M,R,A,T,C,E,z]),r(h.xaxis.range[0],h.xaxis.range[1]),f.data([0]).enter().append(function(){return d.setRange=r,w})}},{"../../constants/xmlns_namespaces":556,"../../lib":568,"../../plotly":589,"../../plots/cartesian/axes":592,"./helpers":541,"./range_plot":543}],540:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("./attributes");e.exports=function(t,e,r,o){function a(t,e){return n.coerce(s,l,i,t,e)}if(t[r].rangeslider){var s=n.isPlainObject(t[r].rangeslider)?t[r].rangeslider:{},l=e[r].rangeslider={};if(a("bgcolor"),a("bordercolor"),a("borderwidth"),a("thickness"),a("visible"),a("range"),l.range&&!e[r].autorange){var u=l.range,c=e[r].range;u[0]=Math.min(u[0],c[0]),u[1]=Math.max(u[1],c[1])}else e[r]._needsExpand=!0;l.visible&&o.forEach(function(t){var r=e[t]||{};r.fixedrange=!0,e[t]=r})}}},{"../../lib":568,"./attributes":538}],541:[function(t,e,r){"use strict";r.setAttributes=function(t,e){for(var r in e)t.setAttribute(r,e[r])},r.appendChildren=function(t,e){for(var r=0;r<e.length;r++)e[r]&&t.appendChild(e[r])}},{}],542:[function(t,e,r){"use strict";function n(t){if(t._fullLayout.xaxis){var e=t._fullLayout,r=e._infolayer.selectAll("g.range-slider"),n=e.xaxis.rangeslider;if(!n||!n.visible)return r.data([]).exit().remove(),void i.autoMargin(t,"range-slider");var a=(e.height-e.margin.b-e.margin.t)*n.thickness,s=Math.floor(n.borderwidth/2);0!==r[0].length||e._has("gl2d")||o(t);var l=e.xaxis._boundingBox?e.xaxis._boundingBox.height:0;i.autoMargin(t,"range-slider",{x:0,y:0,l:0,r:0,t:0,b:a+e.margin.b+l,pad:15+2*s})}}var i=t("../../plots/plots"),o=t("./create_slider"),a=t("./defaults");e.exports={draw:n,supplyLayoutDefaults:a}},{"../../plots/plots":648,"./create_slider":539,"./defaults":540}],543:[function(t,e,r){"use strict";function n(t,e){for(var r=e.makeCalcdata(t||[],e._id[0]),n=0;n<r.length;n++)r[n]=e.c2l(r[n]);return r}function i(t,e,r,n){var i,o,h;if(t.line){i=document.createElementNS(c,"path");var f=l.smoothopen(e,t.line.smoothing||0);u.setAttributes(i,{d:f,fill:"none",stroke:t.line?t.line.color:"transparent","stroke-width":t.line.width/2||1,opacity:1})}if(t.marker){o=document.createElementNS(c,"g");var d=e.map(function(e,r){var n,i=document.createElementNS(c,"g"),o=document.createElementNS(c,"path");return n=Array.isArray(t.marker.size)?"number"==typeof t.marker.size[r]?Math.max(t.marker.size[r]/(t.marker.sizeref||1)/15,0):0:Math.max(t.marker.size/15,2),u.setAttributes(o,{d:s[t.marker.symbol].f(n),fill:t.marker.color,stroke:t.marker.line.color,"stroke-width":t.marker.line.width,opacity:t.marker.opacity}),u.setAttributes(i,{transform:"translate("+e[0]+","+e[1]+")"}),i.appendChild(o),i});u.appendChildren(o,d)}if("none"!==t.fill){switch(h=document.createElementNS(c,"path"),t.fill){case"tozeroy":e.unshift([e[0][0],n]),e.push([e[e.length-1][0],n]);break;case"tozerox":e.unshift([0,e[e.length-1][1]]);break;default:a.warn("Fill type "+t.fill+" not supported for range slider! (yet...)")}var p=l.smoothopen(e,t.line.smoothing||0);u.setAttributes(h,{d:p,fill:t.fillcolor||"transparent"})}return[i,o,h]}var o=t("d3"),a=t("../../lib"),s=t("../drawing/symbol_defs"),l=t("../drawing"),u=t("./helpers"),c=t("../../constants/xmlns_namespaces").svg;e.exports=function h(t,e,r){var s=t._fullLayout,f=t._fullData,d=s.xaxis,p=s.yaxis,v=d.rangeslider.range[0],m=d.rangeslider.range[1],g=p.range[0],y=p.range[1],b=document.createElementNS(c,"path");b.setAttribute("d",["M0,0",e+",0",e+","+r,"0,"+r,"Z"].join(" "));var x=document.createElementNS(c,"clipPath");x.setAttribute("id","range-clip-path"),x.appendChild(b);var _=document.createElementNS(c,"defs");_.appendChild(x);var h=document.createElementNS(c,"g");o.select(h).call(l.setClipUrl,"range-clip-path"),h.appendChild(_);for(var w=["scatter"],M=0;M<f.length;M++){var k=f[M],A=[];if(w.indexOf(k.type)<0)a.warn("Trace type "+k.type+" not supported for range slider!");else{for(var T=n(k,d),E=n(k,p),S=0;S<T.length;S++){var L=e*(T[S]-v)/(m-v),z=r*(1-(E[S]-g)/(y-g));isNaN(L)||isNaN(z)||A.push([L,z])}u.appendChildren(h,i(k,A,e,r))}}return h}},{"../../constants/xmlns_namespaces":556,"../../lib":568,"../drawing":506,"../drawing/symbol_defs":507,"./helpers":541,d3:119}],544:[function(t,e,r){"use strict";var n=t("../annotations/attributes"),i=t("../../traces/scatter/attributes"),o=t("../../lib/extend").extendFlat,a=i.line;e.exports={_isLinkedToArray:!0,type:{valType:"enumerated",values:["circle","rect","path","line"]},layer:{valType:"enumerated",values:["below","above"],dflt:"above"},xref:o({},n.xref,{}),x0:{valType:"any"},x1:{valType:"any"},yref:o({},n.yref,{}),y0:{valType:"any"},y1:{valType:"any"},path:{valType:"string"},opacity:{valType:"number",min:0,max:1,dflt:1},line:{color:a.color,width:a.width,dash:a.dash},fillcolor:{valType:"color",dflt:"rgba(0,0,0,0)"}}},{"../../lib/extend":563,"../../traces/scatter/attributes":750,"../annotations/attributes":480}],545:[function(t,e,r){"use strict";function n(t,e){function r(e,r){return k.coerce(t,n,z.layoutAttributes,e,r)}var n={};r("layer"),r("opacity"),r("fillcolor"),r("line.color"),r("line.width"),r("line.dash");for(var i=t.path?"path":"rect",a=r("type",i),s=["x","y"],l=0;2>l;l++){var u=s[l],c={_fullLayout:e},h=A.coerceRef(t,n,c,u);if("path"!==a){var f=.25,d=.75;if("paper"!==h){var p=A.getFromId(c,h),v=o(p);f=v(p.range[0]+f*(p.range[1]-p.range[0])),d=v(p.range[0]+d*(p.range[1]-p.range[0]))}r(u+"0",f),r(u+"1",d)}}return"path"===a?r("path"):k.noneOrAll(t,n,["x0","x1","y0","y1"]),n}function i(t){return"category"===t.type?t.c2l:t.d2l}function o(t){return"category"===t.type?t.l2c:t.l2d}function a(t,e){t.layout.shapes=e,z.supplyLayoutDefaults(t.layout,t._fullLayout),z.drawAll(t)}function s(t){delete t.layout.shapes,t._fullLayout.shapes=[],z.drawAll(t)}function l(t,e,r){for(var n=0;n<t._fullLayout.shapes.length;n++)z.draw(t,n,e,r)}function u(t,e){d(t,e).selectAll('[data-index="'+e+'"]').remove(),t._fullLayout.shapes.splice(e,1),t.layout.shapes.splice(e,1);for(var r=e;r<t._fullLayout.shapes.length;r++)d(t,r).selectAll('[data-index="'+(r+1)+'"]').attr("data-index",r),z.draw(t,r)}function c(t,e,r){t._fullLayout.shapes.splice(e,0,{});var n=k.isPlainObject(r)?k.extendFlat({},r):{text:"New text"};t.layout.shapes?t.layout.shapes.splice(e,0,n):t.layout.shapes=[n];for(var i=t._fullLayout.shapes.length-1;i>e;i--)d(t,i).selectAll('[data-index="'+(i-1)+'"]').attr("data-index",i),z.draw(t,i)}function h(t,e,r,a){function s(r){var n={"data-index":e,"fill-rule":"evenodd",d:b(t,z)},i=z.line.width?z.line.color:"rgba(0,0,0,0)",o=r.append("path").attr(n).style("opacity",z.opacity).call(T.stroke,i).call(T.fill,z.fillcolor).call(E.dashLine,z.line.dash,z.line.width);I&&o.call(E.setClipUrl,"clip"+t._fullLayout._uid+I),t._context.editable&&f(t,o,z,e)}var l,u;d(t,e).selectAll('[data-index="'+e+'"]').remove();var c=t.layout.shapes[e];if(c){var h={xref:c.xref,yref:c.yref},v={};"string"==typeof r&&r?v[r]=a:k.isPlainObject(r)&&(v=r);var m=Object.keys(v);for(l=0;l<m.length;l++){var g=m[l];k.nestedProperty(c,g).set(v[g])}var y=["x0","x1","y0","y1"];for(l=0;4>l;l++){var x=y[l];if(void 0===v[x]&&void 0!==c[x]){var _,w=x.charAt(0),M=A.getFromId(t,A.coerceRef(h,{},t,w)),S=A.getFromId(t,A.coerceRef(c,{},t,w)),L=c[x];void 0!==v[w+"ref"]&&(M?(_=i(M)(L),L=(_-M.range[0])/(M.range[1]-M.range[0])):L=(L-S.domain[0])/(S.domain[1]-S.domain[0]),S?(_=S.range[0]+L*(S.range[1]-S.range[0]),L=o(S)(_)):L=M.domain[0]+L*(M.domain[1]-M.domain[0])),c[x]=L}}var z=n(c,t._fullLayout);t._fullLayout.shapes[e]=z;var I;if("below"!==z.layer)I=(z.xref+z.yref).replace(/paper/g,""),s(t._fullLayout._shapeUpperLayer);else if("paper"===z.xref&&"paper"===z.yref)I="",s(t._fullLayout._shapeLowerLayer);else{var P,C=t._fullLayout._plots||{},R=Object.keys(C);for(l=0,u=R.length;u>l;l++)P=C[R[l]],I=R[l],p(t,z,P)&&s(P.shapelayer)}}}function f(t,e,r,n){function i(t){var r=J.right-J.left,n=J.bottom-J.top,i=t.clientX-J.left,o=t.clientY-J.top,a=r>W&&n>Z&&!t.shiftKey?S.getCursor(i/r,1-o/n):"move";L(e,a),Y=a.split("-")[0]}function o(e){U=A.getFromId(t,r.xref),V=A.getFromId(t,r.yref),q=g(t,U),G=g(t,V,!0),H=y(t,U),X=y(t,V,!0);var o="shapes["+n+"]";"path"===r.type?(N=r.path,B=o+".path"):(c=q(r.x0),h=G(r.y0),f=q(r.x1),d=G(r.y1),p=o+".x0",v=o+".y0",_=o+".x1",w=o+".y1"),f>c?(E=c,C=o+".x0",F="x0",z=f,R=o+".x1",j="x1"):(E=f,C=o+".x1",F="x1",z=c,R=o+".x0",j="x0"),d>h?(k=h,I=o+".y0",D="y0",T=d,P=o+".y1",O="y1"):(k=d,I=o+".y1",D="y1",T=h,P=o+".y0",O="y0"),u={},i(e),K.moveFn="move"===Y?s:l}function a(r){L(e),r&&M.relayout(t,u)}function s(n,i){if("path"===r.type){var o=function(t){return H(q(t)+n)};U&&"date"===U.type&&(o=m(o));var a=function(t){return X(G(t)+i)};V&&"date"===V.type&&(a=m(a)),r.path=x(N,o,a),u[B]=r.path}else u[p]=r.x0=H(c+n),u[v]=r.y0=X(h+i),u[_]=r.x1=H(f+n),u[w]=r.y1=X(d+i);e.attr("d",b(t,r))}function l(n,i){if("path"===r.type){var o=function(t){return H(q(t)+n)};U&&"date"===U.type&&(o=m(o));var a=function(t){return X(G(t)+i)};V&&"date"===V.type&&(a=m(a)),r.path=x(N,o,a),u[B]=r.path}else{var s=~Y.indexOf("n")?k+i:k,l=~Y.indexOf("s")?T+i:T,c=~Y.indexOf("w")?E+n:E,h=~Y.indexOf("e")?z+n:z;l-s>Z&&(u[I]=r[D]=X(s),u[P]=r[O]=X(l)),h-c>W&&(u[C]=r[F]=H(c),u[R]=r[j]=H(h))}e.attr("d",b(t,r))}var u,c,h,f,d,p,v,_,w,k,T,E,z,I,P,C,R,D,O,F,j,N,B,U,V,q,G,H,X,Y,W=10,Z=10,K={setCursor:i,element:e.node(),prepFn:o,doneFn:a},J=K.element.getBoundingClientRect();S.init(K)}function d(t,e){var r=t._fullLayout.shapes[e],n=t._fullLayout._shapeUpperLayer;return r?"below"===r.layer&&(n="paper"===r.xref&&"paper"===r.yref?t._fullLayout._shapeLowerLayer:t._fullLayout._shapeSubplotLayer):k.log("getShapeLayer: undefined shape: index",e),n}function p(t,e,r){var n=M.Axes.getFromId(t,r.id,"x")._id,i=M.Axes.getFromId(t,r.id,"y")._id,o="below"===e.layer,a=n===e.xref||i===e.yref,s=!!r.shapelayer;return o&&a&&s}function v(t){return function(e){return e.replace&&(e=e.replace("_"," ")),t(e)}}function m(t){return function(e){return t(e).replace(" ","_")}}function g(t,e,r){var n,o=t._fullLayout._size;if(e){var a=i(e);n=function(t){return e._offset+e.l2p(a(t,!0))},"date"===e.type&&(n=v(n))}else n=r?function(t){return o.t+o.h*(1-t)}:function(t){return o.l+o.w*t};return n}function y(t,e,r){var n,i=t._fullLayout._size;if(e){var a=o(e);n=function(t){return a(e.p2l(t-e._offset))}}else n=r?function(t){return 1-(t-i.t)/i.h}:function(t){return(t-i.l)/i.w};return n}function b(t,e){var r,n,o,a,s=e.type,l=A.getFromId(t,e.xref),u=A.getFromId(t,e.yref),c=t._fullLayout._size;if(l?(r=i(l),n=function(t){return l._offset+l.l2p(r(t,!0))}):n=function(t){return c.l+c.w*t},u?(o=i(u),a=function(t){return u._offset+u.l2p(o(t,!0))}):a=function(t){return c.t+c.h*(1-t)},"path"===s)return l&&"date"===l.type&&(n=v(n)),u&&"date"===u.type&&(a=v(a)),z.convertPath(e.path,n,a);var h=n(e.x0),f=n(e.x1),d=a(e.y0),p=a(e.y1);if("line"===s)return"M"+h+","+d+"L"+f+","+p;if("rect"===s)return"M"+h+","+d+"H"+f+"V"+p+"H"+h+"Z";var m=(h+f)/2,g=(d+p)/2,y=Math.abs(m-h),b=Math.abs(g-d),x="A"+y+","+b,_=m+y+","+g,w=m+","+(g-b);return"M"+_+x+" 0 1,1 "+w+x+" 0 0,1 "+_+"Z"}function x(t,e,r){return t.replace(I,function(t){var n=0,i=t.charAt(0),o=C[i],a=R[i],s=D[i],l=t.substr(1).replace(P,function(t){return n>=s?t:(o[n]?t=e(t):a[n]&&(t=r(t)),n++,t)});return i+l})}function _(t,e,r,n,i){var o="category"===t.type?Number:t.d2c;if(void 0!==e)return[o(e),o(r)];if(n){var a,s,l,u,c,h=1/0,f=-(1/0),d=n.match(I);for("date"===t.type&&(o=v(o)),a=0;a<d.length;a++)s=d[a],l=i[s.charAt(0)].drawn,void 0!==l&&(u=d[a].substr(1).match(P),!u||u.length<l||(c=o(u[l]),h>c&&(h=c),c>f&&(f=c)));return f>=h?[h,f]:void 0}}var w=t("fast-isnumeric"),M=t("../../plotly"),k=t("../../lib"),A=t("../../plots/cartesian/axes"),T=t("../color"),E=t("../drawing"),S=t("../dragelement"),L=t("../../lib/setcursor"),z=e.exports={};z.layoutAttributes=t("./attributes"),z.supplyLayoutDefaults=function(t,e){for(var r=t.shapes||[],i=e.shapes=[],o=0;o<r.length;o++)i.push(n(r[o]||{},e))},z.drawAll=function(t){var e=t._fullLayout;e._shapeUpperLayer.selectAll("path").remove(),e._shapeLowerLayer.selectAll("path").remove(),e._shapeSubplotLayer.selectAll("path").remove();for(var r=0;r<e.shapes.length;r++)z.draw(t,r)},z.add=function(t){var e=t._fullLayout.shapes.length;M.relayout(t,"shapes["+e+"]","add")},z.draw=function(t,e,r,n){if(!w(e)||-1===e){if(!e&&Array.isArray(n))return void a(t,n);if("remove"===n)return void s(t);if(r&&"add"!==n)return void l(t,r,n);e=t._fullLayout.shapes.length,t._fullLayout.shapes.push({})}if(!r&&n){if("remove"===n)return void u(t,e);("add"===n||k.isPlainObject(n))&&c(t,e,n)}h(t,e,r,n)};var I=/[MLHVQCTSZ][^MLHVQCTSZ]*/g,P=/[^\s,]+/g,C={M:{0:!0,drawn:0},L:{0:!0,drawn:0},H:{0:!0,drawn:0},V:{},Q:{0:!0,2:!0,drawn:2},C:{0:!0,2:!0,4:!0,drawn:4},T:{0:!0,drawn:0},S:{0:!0,2:!0,drawn:2},Z:{}},R={M:{1:!0,drawn:1},L:{1:!0,drawn:1},H:{},V:{0:!0,drawn:0},Q:{1:!0,3:!0,drawn:3},C:{1:!0,3:!0,5:!0,drawn:5},T:{1:!0,drawn:1},S:{1:!0,3:!0,drawn:5},Z:{}},D={M:2,L:2,H:1,V:1,Q:4,C:6,T:2,S:4,Z:0};z.convertPath=function(t,e,r){return t.replace(I,function(t){var n=0,i=t.charAt(0),o=C[i],a=R[i],s=D[i],l=t.substr(1).replace(P,function(t){return o[n]?t=e(t):a[n]&&(t=r(t)),n++,n>s&&(t="X"),t});return n>s&&(l=l.replace(/[\s,]*X.*/,""),k.log("Ignoring extra params in segment "+t)),i+l})},z.calcAutorange=function(t){var e,r,n,i,o,a=t._fullLayout,s=a.shapes;if(s.length&&t._fullData.length)for(e=0;e<s.length;e++)r=s[e],n=r.line.width/2,"paper"!==r.xref&&(i=A.getFromId(t,r.xref),o=_(i,r.x0,r.x1,r.path,C),o&&A.expand(i,o,{ppad:n})),"paper"!==r.yref&&(i=A.getFromId(t,r.yref),o=_(i,r.y0,r.y1,r.path,R),o&&A.expand(i,o,{ppad:n}))}},{"../../lib":568,"../../lib/setcursor":577,"../../plotly":589,"../../plots/cartesian/axes":592,"../color":483,"../dragelement":504,"../drawing":506,"./attributes":544,"fast-isnumeric":123}],546:[function(t,e,r){"use strict";var n=t("d3"),i=t("fast-isnumeric"),o=t("../../plotly"),a=t("../../plots/plots"),s=t("../../lib"),l=t("../drawing"),u=t("../color"),c=t("../../lib/svg_text_utils"),h=e.exports={};h.draw=function(t,e,r){function h(t){s.syncOrAsync([f,d],t)}function f(e){return e.attr("transform",_?"rotate("+[_.rotate,x.x,x.y]+") translate(0, "+_.offset+")":null),e.style({"font-family":k,"font-size":n.round(A,2)+"px",fill:u.rgb(T),opacity:E*u.opacity(T),"font-weight":a.fontWeight}).attr(x).call(c.convertToTspans).attr(x),e.selectAll("tspan.line").attr(x),a.previousPromises(t)}function d(t){var e=n.select(t.node().parentNode);if(b&&b.selection&&b.side&&L){e.attr("transform",null);var r=0,o={left:"right",right:"left",top:"bottom",bottom:"top"}[b.side],a=-1!==["left","top"].indexOf(b.side)?-1:1,u=i(b.pad)?b.pad:2,c=l.bBox(e.node()),h={left:0,top:0,right:M.width,bottom:M.height},f=b.maxShift||(h[b.side]-c[b.side])*("left"===b.side||"top"===b.side?-1:1);if(0>f?r=f:(c.left-=b.offsetLeft,c.right-=b.offsetLeft,c.top-=b.offsetTop,c.bottom-=b.offsetTop,b.selection.each(function(){var t=l.bBox(this);s.bBoxIntersect(c,t,u)&&(r=Math.max(r,a*(t[b.side]-c[o])+u))}),r=Math.min(f,r)),r>0||0>f){var d={left:[-r,0],right:[r,0],top:[0,-r],bottom:[0,r]}[b.side];e.attr("transform","translate("+d+")")}}}function p(){E=0,S=!0,L=I,M._infolayer.select("."+e).attr({"data-unformatted":L}).text(L).on("mouseover.opacity",function(){n.select(this).transition().duration(100).style("opacity",1)}).on("mouseout.opacity",function(){n.select(this).transition().duration(1e3).style("opacity",0)})}var v=r.propContainer,m=r.propName,g=r.traceIndex,y=r.dfltName,b=r.avoid||{},x=r.attributes,_=r.transform,w=r.containerGroup,M=t._fullLayout,k=v.titlefont.family,A=v.titlefont.size,T=v.titlefont.color,E=1,S=!1,L=v.title.trim();""===L&&(E=0),L.match(/Click to enter .+ title/)&&(E=.2,S=!0),w||(w=M._infolayer.selectAll(".g-"+e).data([0]),w.enter().append("g").classed("g-"+e,!0));var z=w.selectAll("text").data([0]);z.enter().append("text"),z.text(L).attr("class",e),z.attr({"data-unformatted":L}).call(h);var I="Click to enter "+y+" title";t._context.editable?(L||p(),z.call(c.makeEditable).on("edit",function(e){void 0!==g?o.restyle(t,m,e,g):o.relayout(t,m,e)}).on("cancel",function(){this.text(this.attr("data-unformatted")).call(h)}).on("input",function(t){this.text(t||" ").attr(x).selectAll("tspan.line").attr(x)})):L&&!L.match(/Click to enter .+ title/)||z.remove(),z.classed("js-placeholder",S)}},{"../../lib":568,"../../lib/svg_text_utils":581,"../../plotly":589,"../../plots/plots":648,"../color":483,"../drawing":506,d3:119,"fast-isnumeric":123}],547:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),i=t("../color/attributes"),o=t("../../lib/extend").extendFlat,a={_isLinkedToArray:!0,method:{valType:"enumerated",values:["restyle","relayout"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string",dflt:""}};e.exports={_isLinkedToArray:!0,visible:{valType:"boolean"},active:{valType:"integer",min:-1,dflt:0},buttons:a,x:{valType:"number",min:-2,max:3,dflt:-.05},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"right"},y:{valType:"number",min:-2,max:3,dflt:1},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"bottom"},font:o({},n,{}),bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:i.borderLine},borderwidth:{valType:"number",min:0,dflt:1}}},{"../../lib/extend":563,"../../plots/font_attributes":610,"../color/attributes":482}],548:[function(t,e,r){"use strict";e.exports={name:"updatemenus",itemName:"updatemenu",containerClassName:"updatemenu-container",headerGroupClassName:"updatemenu-header-group",headerClassName:"updatemenu-header",headerArrowClassName:"updatemenu-header-arrow",buttonGroupClassName:"updatemenu-button-group",buttonClassName:"updatemenu-button",itemRectClassName:"updatemenu-item-rect",itemTextClassName:"updatemenu-item-text",menuIndexAttrName:"updatemenu-active-index",autoMarginIdRoot:"updatemenu-",blankHeaderOpts:{label:"  "},minWidth:30,minHeight:30,textPadX:40,fontSizeToHeight:1.3,rx:2,ry:2,textOffsetX:12,textOffsetY:3,arrowOffsetX:4,gapButtonHeader:5,gapButton:2,activeColor:"#F4FAFF",hoverColor:"#F4FAFF"}},{}],549:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return o.coerce(t,e,a,r,n)}var s=i(t,e),l=n("visible",s.length>0);l&&(n("active"),n("x"),n("y"),o.noneOrAll(t,e,["x","y"]),n("xanchor"),n("yanchor"),o.coerceFont(n,"font",r.font),n("bgcolor",r.paper_bgcolor),n("bordercolor"),n("borderwidth"))}function i(t,e){function r(t,e){return o.coerce(n,i,u,t,e)}for(var n,i,a=t.buttons||[],s=e.buttons=[],l=0;l<a.length;l++)n=a[l],i={},o.isPlainObject(n)&&Array.isArray(n.args)&&(r("method"),r("args"),r("label"),i._index=l,s.push(i));return s}var o=t("../../lib"),a=t("./attributes"),s=t("./constants"),l=s.name,u=a.buttons;e.exports=function(t,e){for(var r=Array.isArray(t[l])?t[l]:[],i=e[l]=[],o=0;o<r.length;o++){var a=r[o]||{},s={};n(a,s,e),s._input=a,s._index=o,i.push(s)}}},{"../../lib":568,"./attributes":547,"./constants":548}],550:[function(t,e,r){"use strict";function n(t){for(var e=t[T.name],r=[],n=0;n<e.length;n++){var i=e[n];i.visible&&r.push(i)}return r}function i(t){return t._index}function o(t,e){var r=+t.attr(T.menuIndexAttrName);return r===e._index}function a(t,e,r,n){var i=e.selectAll("g."+T.headerClassName).data([0]);i.enter().append("g").classed(T.headerClassName,!0).style("pointer-events","all");var a=n.active,u=n.buttons[a]||T.blankHeaderOpts,c={y:0,yPad:0};i.call(l,n,u).call(v,n,c);var h=e.selectAll("text."+T.headerArrowClassName).data([0]);h.enter().append("text").classed(T.headerArrowClassName,!0).classed("user-select-none",!0).attr("text-anchor","end").call(M.font,n.font).text("\u25bc"),h.attr({x:n.width-T.arrowOffsetX,y:n.height1/2+T.textOffsetY}),i.on("click",function(){r.call(m),r.attr(T.menuIndexAttrName,o(r,n)?"-1":String(n._index)),s(t,e,r,n)}),i.on("mouseover",function(){i.call(f)}),i.on("mouseout",function(){i.call(d,n)}),_.setTranslate(e,n.lx,n.ly)}function s(t,e,r,n){var i="-1"!==r.attr(T.menuIndexAttrName)?n.buttons:[],o=r.selectAll("g."+T.buttonClassName).data(i);o.enter().append("g").classed(T.buttonClassName,!0).attr("opacity","0").transition().attr("opacity","1"),o.exit().transition().attr("opacity","0").remove();var u={y:n.height1+T.gapButtonHeader,yPad:T.gapButton};o.each(function(i,c){var p=y.select(this);p.call(l,n,i).call(v,n,u),p.on("click",function(){n._input.active=n.active=c,r.attr(T.menuIndexAttrName,"-1"),a(t,e,r,n),s(t,e,r,n);var o=i.args;b[i.method](t,o[0],o[1],o[2])}),p.on("mouseover",function(){p.call(f)}),p.on("mouseout",function(){p.call(d,n),o.call(h,n)})}),o.call(h,n),_.setTranslate(r,n.lx,n.ly)}function l(t,e,r){t.call(u,e).call(c,e,r)}function u(t,e){var r=t.selectAll("rect").data([0]);r.enter().append("rect").classed(T.itemRectClassName,!0).attr({rx:T.rx,ry:T.ry,"shape-rendering":"crispEdges"}),r.call(w.stroke,e.bordercolor).call(w.fill,e.bgcolor).style("stroke-width",e.borderwidth+"px")}function c(t,e,r){var n=t.selectAll("text").data([0]);n.enter().append("text").classed(T.itemTextClassName,!0).classed("user-select-none",!0).attr("text-anchor","start"),n.call(M.font,e.font).text(r.label).call(k.convertToTspans)}function h(t,e){var r=e.active;t.each(function(t,e){var n=y.select(this);e===r&&n.select("rect."+T.itemRectClassName).call(w.fill,T.activeColor)})}function f(t){t.select("rect."+T.itemRectClassName).call(w.fill,T.hoverColor)}function d(t,e){t.select("rect."+T.itemRectClassName).call(w.fill,e.bgcolor)}function p(t,e){e.width=0,e.height=0,e.height1=0,e.lx=0,e.ly=0;var r=t._tester.selectAll("g."+T.buttonClassName).data(e.buttons);r.enter().append("g").classed(T.buttonClassName,!0),r.each(function(t){var r=y.select(this);r.call(l,e,t);var n=r.select("."+T.itemTextClassName),i=n.selectAll("tspan"),o=n.node()&&M.bBox(n.node()).width,a=Math.max(o+T.textPadX,T.minWidth),s=e.font.size*T.fontSizeToHeight,u=i[0].length||1,c=Math.max(s*u,T.minHeight)+T.textOffsetY;e.width=Math.max(e.width,a),e.height1=Math.max(e.height1,c),e.height+=e.height1}),r.remove();var n=t._fullLayout._size;e.lx=n.l+n.w*e.x,e.ly=n.t+n.h*(1-e.y);var i="left";A.isRightAnchor(e)&&(e.lx-=e.width,i="right"),A.isCenterAnchor(e)&&(e.lx-=e.width/2,i="center");var o="top";A.isBottomAnchor(e)&&(e.ly-=e.height,o="bottom"),A.isMiddleAnchor(e)&&(e.ly-=e.height/2,o="middle"),e.width=Math.ceil(e.width),e.height=Math.ceil(e.height),e.lx=Math.round(e.lx),e.ly=Math.round(e.ly),x.autoMargin(t,T.autoMarginIdRoot+e._index,{x:e.x,y:e.y,l:e.width*({right:1,center:.5}[i]||0),r:e.width*({left:1,center:.5}[i]||0),b:e.height*({top:1,middle:.5}[o]||0),t:e.height*({bottom:1,middle:.5}[o]||0)})}function v(t,e,r){var n=t.select("."+T.itemRectClassName),i=t.select("."+T.itemTextClassName),o=i.selectAll("tspan"),a=e.borderwidth;_.setTranslate(t,a,a+r.y),n.attr({x:0,y:0,width:e.width,height:e.height1});var s=e.font.size*T.fontSizeToHeight,l=o[0].length||1,u=(l-1)*s/4,c={x:T.textOffsetX,y:e.height1/2-u+T.textOffsetY};i.attr(c),o.attr(c),r.y+=e.height1+r.yPad}function m(t){t.selectAll("g."+T.buttonClassName).remove()}function g(t){for(var e=t._fullLayout._pushmargin||{},r=Object.keys(e),n=0;n<r.length;n++){var i=r[n];-1!==i.indexOf(T.autoMarginIdRoot)&&x.autoMargin(t,i)}}var y=t("d3"),b=t("../../plotly"),x=t("../../plots/plots"),_=t("../../lib"),w=t("../color"),M=t("../drawing"),k=t("../../lib/svg_text_utils"),A=t("../legend/anchor_utils"),T=t("./constants");e.exports=function(t){var e=t._fullLayout,r=n(e),l=e._infolayer.selectAll("g."+T.containerClassName).data(r.length>0?[0]:[]);if(l.enter().append("g").classed(T.containerClassName,!0).style("cursor","pointer"),l.exit().remove(),l.exit().size()&&g(t),0!==r.length){var u=l.selectAll("g."+T.headerGroupClassName).data(r,i);u.enter().append("g").classed(T.headerGroupClassName,!0);var c=l.selectAll("g."+T.buttonGroupClassName).data([0]);c.enter().append("g").classed(T.buttonGroupClassName,!0).style("pointer-events","all"),u.enter().size()&&c.call(m).attr(T.menuIndexAttrName,"-1"),u.exit().each(function(e){y.select(this).remove(),c.call(m).attr(T.menuIndexAttrName,"-1"),x.autoMargin(t,T.autoMarginIdRoot+e._index)});for(var h=0;h<r.length;h++){var f=r[h];p(t,f)}u.each(function(e){var r=y.select(this);a(t,r,c,e),o(c,e)&&s(t,r,c,e)})}}},{"../../lib":568,"../../lib/svg_text_utils":581,"../../plotly":589,"../../plots/plots":648,"../color":483,"../drawing":506,"../legend/anchor_utils":519,"./constants":548,d3:119}],551:[function(t,e,r){"use strict";r.layoutAttributes=t("./attributes"),r.supplyLayoutDefaults=t("./defaults"),r.draw=t("./draw")},{"./attributes":547,"./defaults":549,"./draw":550}],552:[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]}},{}],553:[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]}},{}],554:[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"}},{}],555:[function(t,e,r){"use strict";e.exports={entityToUnicode:{mu:"\u03bc",amp:"&",lt:"<",gt:">",nbsp:"\xa0",times:"\xd7",plusmn:"\xb1",deg:"\xb0"},unicodeToEntity:{"&":"amp","<":"lt",">":"gt",'"':"quot","'":"#x27","/":"#x2F"}}},{}],556:[function(t,e,r){"use strict";r.xmlns="http://www.w3.org/2000/xmlns/",r.svg="http://www.w3.org/2000/svg",r.xlink="http://www.w3.org/1999/xlink",r.svgAttrs={xmlns:r.svg,"xmlns:xlink":r.xlink}},{}],557:[function(t,e,r){"use strict";var n=t("./plotly");r.version="1.16.2",r.plot=n.plot,r.newPlot=n.newPlot,r.restyle=n.restyle,r.relayout=n.relayout,
r.redraw=n.redraw,r.extendTraces=n.extendTraces,r.prependTraces=n.prependTraces,r.addTraces=n.addTraces,r.deleteTraces=n.deleteTraces,r.moveTraces=n.moveTraces,r.purge=n.purge,r.setPlotConfig=t("./plot_api/set_plot_config"),r.register=n.register,r.toImage=t("./plot_api/to_image"),r.downloadImage=t("./snapshot/download"),r.validate=t("./plot_api/validate"),r.Icons=t("../build/ploticon"),r.Plots=n.Plots,r.Fx=n.Fx,r.Snapshot=n.Snapshot,r.PlotSchema=n.PlotSchema,r.Queue=n.Queue,r.d3=t("d3")},{"../build/ploticon":2,"./plot_api/set_plot_config":586,"./plot_api/to_image":587,"./plot_api/validate":588,"./plotly":589,"./snapshot/download":663,d3:119}],558:[function(t,e,r){"use strict";"undefined"!=typeof MathJax?(r.MathJax=!0,MathJax.Hub.Config({messageStyle:"none",skipStartupTypeset:!0,displayAlign:"left",tex2jax:{inlineMath:[["$","$"],["\\(","\\)"]]}}),MathJax.Hub.Configured()):r.MathJax=!1},{}],559:[function(t,e,r){"use strict";e.exports=function(t,e,r,n){Array.isArray(t)&&(e[r]=t[n])}},{}],560:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("tinycolor2"),o=t("./nested_property"),a=t("../components/colorscale/get_scale"),s=(Object.keys(t("../components/colorscale/scales")),/^([2-9]|[1-9][0-9]+)$/);r.valObjects={data_array:{coerceFunction:function(t,e,r){Array.isArray(t)?e.set(t):void 0!==r&&e.set(r)}},enumerated:{coerceFunction:function(t,e,r,n){n.coerceNumber&&(t=+t),-1===n.values.indexOf(t)?e.set(r):e.set(t)}},"boolean":{coerceFunction:function(t,e,r){t===!0||t===!1?e.set(t):e.set(r)}},number:{coerceFunction:function(t,e,r,i){!n(t)||void 0!==i.min&&t<i.min||void 0!==i.max&&t>i.max?e.set(r):e.set(+t)}},integer:{coerceFunction:function(t,e,r,i){t%1||!n(t)||void 0!==i.min&&t<i.min||void 0!==i.max&&t>i.max?e.set(r):e.set(+t)}},string:{coerceFunction:function(t,e,r,n){if("string"!=typeof t){var i="number"==typeof t;n.strict!==!0&&i?e.set(String(t)):e.set(r)}else n.noBlank&&!t?e.set(r):e.set(t)}},color:{coerceFunction:function(t,e,r){i(t).isValid()?e.set(t):e.set(r)}},colorscale:{coerceFunction:function(t,e,r){e.set(a(t,r))}},angle:{coerceFunction:function(t,e,r){"auto"===t?e.set("auto"):n(t)?(Math.abs(t)>180&&(t-=360*Math.round(t/360)),e.set(+t)):e.set(r)}},subplotid:{coerceFunction:function(t,e,r){var n=r.length;return"string"==typeof t&&t.substr(0,n)===r&&s.test(t.substr(n))?void e.set(t):void e.set(r)},validateFunction:function(t,e){var r=e.dflt,n=r.length;return t===r?!0:"string"!=typeof t?!1:!(t.substr(0,n)!==r||!s.test(t.substr(n)))}},flaglist:{coerceFunction:function(t,e,r,n){if("string"!=typeof t)return void e.set(r);if(-1!==(n.extras||[]).indexOf(t))return void e.set(t);for(var i=t.split("+"),o=0;o<i.length;){var a=i[o];-1===n.flags.indexOf(a)||i.indexOf(a)<o?i.splice(o,1):o++}i.length?e.set(i.join("+")):e.set(r)}},any:{coerceFunction:function(t,e,r){void 0===t?e.set(r):e.set(t)}},info_array:{coerceFunction:function(t,e,n,i){if(!Array.isArray(t))return void e.set(n);var o=i.items,a=[];n=Array.isArray(n)?n:[];for(var s=0;s<o.length;s++)r.coerce(t,a,o,"["+s+"]",n[s]);e.set(a)},validateFunction:function(t,e){if(!Array.isArray(t))return!1;var n=e.items;if(!e.freeLength&&t.length!==n.length)return!1;for(var i=0;i<t.length;i++){var o=r.validate(t[i],e.items[i]);if(!o)return!1}return!0}}},r.coerce=function(t,e,n,i,a){var s=o(n,i).get(),l=o(t,i),u=o(e,i),c=l.get();return void 0===a&&(a=s.dflt),s.arrayOk&&Array.isArray(c)?(u.set(c),c):(r.valObjects[s.valType].coerceFunction(c,u,a,s),u.get())},r.coerce2=function(t,e,n,i,a){var s=o(t,i),l=r.coerce(t,e,n,i,a);return s.get()?l:!1},r.coerceFont=function(t,e,r){var n={};return r=r||{},n.family=t(e+".family",r.family),n.size=t(e+".size",r.size),n.color=t(e+".color",r.color),n},r.validate=function(t,e){var n=r.valObjects[e.valType];if(e.arrayOk&&Array.isArray(t))return!0;if(n.validateFunction)return n.validateFunction(t,e);var i={},o=i,a={set:function(t){o=t}};return n.coerceFunction(t,a,i,e),o!==i}},{"../components/colorscale/get_scale":495,"../components/colorscale/scales":501,"./nested_property":572,"fast-isnumeric":123,tinycolor2:454}],561:[function(t,e,r){"use strict";function n(t,e){return String(t+Math.pow(10,e)).substr(1)}function i(t){var e;return e=b.test(t)?"Y":"y",e+=x.test(t)?"b":""}function o(t){var e;return e=w.test(t)?_.test(t)?"I":"H":"D"}var a=t("d3"),s=t("fast-isnumeric"),l=t("../lib");r.dateTime2ms=function(t){try{if(t.getTime)return+t}catch(e){return!1}var r,n,i,o,a=String(t).split(" ");if(a.length>2)return!1;var l=a[0].split("-");if(l.length>3||3!==l.length&&a[1])return!1;if(4===l[0].length)r=Number(l[0]);else{if(2!==l[0].length)return!1;var u=(new Date).getFullYear();r=((Number(l[0])-u+70)%100+200)%100+u-70}return s(r)?1===l.length?new Date(r,0,1).getTime():(n=Number(l[1])-1,l[1].length>2||!(n>=0&&11>=n)?!1:2===l.length?new Date(r,n,1).getTime():(i=Number(l[2]),l[2].length>2||!(i>=1&&31>=i)?!1:(i=new Date(r,n,i).getTime(),a[1]?(l=a[1].split(":"),l.length>3?!1:(o=Number(l[0]),l[0].length>2||!(o>=0&&23>=o)?!1:(i+=36e5*o,1===l.length?i:(n=Number(l[1]),l[1].length>2||!(n>=0&&59>=n)?!1:(i+=6e4*n,2===l.length?i:(t=Number(l[2]),t>=0&&60>t?i+1e3*t:!1)))))):i))):!1},r.isDateTime=function(t){return r.dateTime2ms(t)!==!1},r.ms2DateTime=function(t,e){if("undefined"==typeof a)return void l.error("d3 is not defined.");e||(e=0);var r=new Date(t),i=a.time.format("%Y-%m-%d")(r);return 7776e6>e?(i+=" "+n(r.getHours(),2),432e6>e&&(i+=":"+n(r.getMinutes(),2),108e5>e&&(i+=":"+n(r.getSeconds(),2),3e5>e&&(i+="."+n(r.getMilliseconds(),3)))),i.replace(/([:\s]00)*\.?[0]*$/,"")):i};var u={H:["%H:%M:%S~%L","%H:%M:%S","%H:%M"],I:["%I:%M:%S~%L%p","%I:%M:%S%p","%I:%M%p"],D:["%H","%I%p","%Hh"]},c={Y:["%Y~%m~%d","%Y%m%d","%y%m%d","%m~%d~%Y","%d~%m~%Y"],Yb:["%b~%d~%Y","%d~%b~%Y","%Y~%d~%b","%Y~%b~%d"],y:["%m~%d~%y","%d~%m~%y","%y~%m~%d"],yb:["%b~%d~%y","%d~%b~%y","%y~%d~%b","%y~%b~%d"]},h=a.time.format.utc,f={Y:{H:["%Y~%m~%dT%H:%M:%S","%Y~%m~%dT%H:%M:%S~%L"].map(h),I:[],D:["%Y%m%d%H%M%S","%Y~%m","%m~%Y"].map(h)},Yb:{H:[],I:[],D:["%Y~%b","%b~%Y"].map(h)},y:{H:[],I:[],D:[]},yb:{H:[],I:[],D:[]}};["Y","Yb","y","yb"].forEach(function(t){c[t].forEach(function(e){f[t].D.push(h(e)),["H","I","D"].forEach(function(r){u[r].forEach(function(n){var i=f[t][r];i.push(h(e+"~"+n)),i.push(h(n+"~"+e))})})})});var d=/[a-z]*/g,p=function(t){return t.substr(0,3)},v=/(mon|tue|wed|thu|fri|sat|sun|the|of|st|nd|rd|th)/g,m=/[\s,\/\-\.\(\)]+/g,g=/~?([ap])~?m(~|$)/,y=function(t,e){return e+"m "},b=/\d\d\d\d/,x=/(^|~)[a-z]{3}/,_=/[ap]m/,w=/:/,M=/q([1-4])/,k=["31~mar","30~jun","30~sep","31~dec"],A=function(t,e){return k[e-1]},T=/ ?([+\-]\d\d:?\d\d|Z)$/;r.parseDate=function(t){if(t.getTime)return t;if("string"!=typeof t)return!1;t=t.toLowerCase().replace(d,p).replace(v,"").replace(m,"~").replace(g,y).replace(M,A).trim().replace(T,"");var e,r,n=null,a=i(t),s=o(t);e=f[a][s],r=e.length;for(var l=0;r>l&&!(n=e[l].parse(t));l++);if(!(n instanceof Date))return!1;var u=n.getTimezoneOffset();return n.setTime(n.getTime()+60*u*1e3),n}},{"../lib":568,d3:119,"fast-isnumeric":123}],562:[function(t,e,r){"use strict";var n=t("events").EventEmitter,i={init:function(t){if(t._ev instanceof n)return t;var e=new n;return t._ev=e,t.on=e.on.bind(e),t.once=e.once.bind(e),t.removeListener=e.removeListener.bind(e),t.removeAllListeners=e.removeAllListeners.bind(e),t.emit=function(r,n){"undefined"!=typeof jQuery&&jQuery(t).trigger(r,n),e.emit(r,n)},t},triggerHandler:function(t,e,r){var n,i;"undefined"!=typeof jQuery&&(n=jQuery(t).triggerHandler(e,r));var o=t._ev;if(!o)return n;var a=o._events[e];if(!a)return n;"function"==typeof a&&(a=[a]);for(var s=a.pop(),l=0;l<a.length;l++)a[l](r);return i=s(r),void 0!==n?n:i},purge:function(t){return delete t._ev,delete t.on,delete t.once,delete t.removeListener,delete t.removeAllListeners,delete t.emit,t}};e.exports=i},{events:57}],563:[function(t,e,r){"use strict";function n(t,e){var r,n;for(r=0;r<t.length;r++){if(n=t[r],null!==n&&"object"==typeof n)return!1;void 0!==n&&(e[r]=n)}return!0}function i(t,e,r,s){var l,u,c,h,f,d,p,v=t[0],m=t.length;if(2===m&&a(v)&&a(t[1])&&0===v.length){if(p=n(t[1],v))return v;v.splice(0,v.length)}for(var g=1;m>g;g++){l=t[g];for(u in l)c=v[u],h=l[u],s&&a(h)?v[u]=h:e&&h&&(o(h)||(f=a(h)))?(f?(f=!1,d=c&&a(c)?c:[]):d=c&&o(c)?c:{},v[u]=i([d,h],e,r,s)):("undefined"!=typeof h||r)&&(v[u]=h)}return v}var o=t("./is_plain_object.js"),a=Array.isArray;r.extendFlat=function(){return i(arguments,!1,!1,!1)},r.extendDeep=function(){return i(arguments,!0,!1,!1)},r.extendDeepAll=function(){return i(arguments,!0,!0,!1)},r.extendDeepNoArrays=function(){return i(arguments,!0,!1,!0)}},{"./is_plain_object.js":569}],564:[function(t,e,r){"use strict";e.exports=function(t){for(var e=[],r=0;r<t.length;r++){var n=t[r];n.visible===!0&&e.push(n)}return e}},{}],565:[function(t,e,r){"use strict";function n(t,e){var r=l[t];return r(e)}function i(t){for(var e,r,n=0;n<s.length;n++)if(e=s[n],r=new RegExp(o[e]),r.test(t.toLowerCase()))return e;a.warn("Unrecognized country name: "+t+".")}var o=t("country-regex"),a=t("../lib"),s=Object.keys(o),l={"ISO-3":a.identity,"USA-states":a.identity,"country names":i};r.locationToFeature=function(t,e,r){for(var i,o=n(t,e),s=0;s<r.length;s++)if(i=r[s],i.id===o)return i;a.warn(["Location with id",o,"does not have a matching topojson feature at this resolution."].join(" "))}},{"../lib":568,"country-regex":114}],566:[function(t,e,r){"use strict";function n(t,e){var r=h(t);return r[3]*=e,r}function i(t){return s(t).isValid()?t:c}function o(t){return l(t)?t:f}function a(t,e,r){var a,s,l,h,d,p=t.color,v=Array.isArray(p),m=Array.isArray(e),g=[];if(a=void 0!==t.colorscale?u(t.colorscale,t.cmin,t.cmax):i,s=v?function(t,e){return void 0===t[e]?c:a(t[e])}:i,l=m?function(t,e){return void 0===t[e]?f:o(t[e])}:o,v||m)for(var y=0;r>y;y++)h=s(p,y),d=l(e,y),g[y]=n(h,d);else g=n(p,e);return g}var s=t("tinycolor2"),l=t("fast-isnumeric"),u=t("../components/colorscale/make_scale_function"),c=t("../components/color/attributes").defaultLine,h=t("./str2rgbarray"),f=1;e.exports=a},{"../components/color/attributes":482,"../components/colorscale/make_scale_function":500,"./str2rgbarray":580,"fast-isnumeric":123,tinycolor2:454}],567:[function(t,e,r){"use strict";function n(t){for(var e=0;(e=t.indexOf("<sup>",e))>=0;){var r=t.indexOf("</sup>",e);if(e>r)break;t=t.slice(0,e)+l(t.slice(e+5,r))+t.slice(r+6)}return t}function i(t){return t.replace(/\<br\>/g,"\n")}function o(t){return t.replace(/\<.*\>/g,"")}function a(t){for(var e=u.entityToUnicode,r=0;(r=t.indexOf("&",r))>=0;){var n=t.indexOf(";",r);if(r>n)r+=1;else{var i=e[t.slice(r+1,n)];t=i?t.slice(0,r)+i+t.slice(n+1):t.slice(0,r)+t.slice(n+1)}}return t}function s(t){return""+a(o(n(i(t))))}var l=t("superscript-text"),u=t("../constants/string_mappings");e.exports=s},{"../constants/string_mappings":555,"superscript-text":443}],568:[function(t,e,r){"use strict";var n=t("d3"),i=e.exports={};i.nestedProperty=t("./nested_property"),i.isPlainObject=t("./is_plain_object");var o=t("./coerce");i.valObjects=o.valObjects,i.coerce=o.coerce,i.coerce2=o.coerce2,i.coerceFont=o.coerceFont,i.validate=o.validate;var a=t("./dates");i.dateTime2ms=a.dateTime2ms,i.isDateTime=a.isDateTime,i.ms2DateTime=a.ms2DateTime,i.parseDate=a.parseDate;var s=t("./search");i.findBin=s.findBin,i.sorterAsc=s.sorterAsc,i.sorterDes=s.sorterDes,i.distinctVals=s.distinctVals,i.roundUp=s.roundUp;var l=t("./stats");i.aggNums=l.aggNums,i.len=l.len,i.mean=l.mean,i.variance=l.variance,i.stdev=l.stdev,i.interp=l.interp;var u=t("./matrix");i.init2dArray=u.init2dArray,i.transposeRagged=u.transposeRagged,i.dot=u.dot,i.translationMatrix=u.translationMatrix,i.rotationMatrix=u.rotationMatrix,i.rotationXYMatrix=u.rotationXYMatrix,i.apply2DTransform=u.apply2DTransform,i.apply2DTransform2=u.apply2DTransform2;var c=t("./extend");i.extendFlat=c.extendFlat,i.extendDeep=c.extendDeep,i.extendDeepAll=c.extendDeepAll,i.extendDeepNoArrays=c.extendDeepNoArrays;var h=t("./loggers");i.log=h.log,i.warn=h.warn,i.error=h.error,i.notifier=t("./notifier"),i.swapAttrs=function(t,e,r,n){r||(r="x"),n||(n="y");for(var o=0;o<e.length;o++){var a=e[o],s=i.nestedProperty(t,a.replace("?",r)),l=i.nestedProperty(t,a.replace("?",n)),u=s.get();s.set(l.get()),l.set(u)}},i.pauseEvent=function(t){return t.stopPropagation&&t.stopPropagation(),t.preventDefault&&t.preventDefault(),t.cancelBubble=!0,!1},i.constrain=function(t,e,r){return e>r?Math.max(r,Math.min(e,t)):Math.max(e,Math.min(r,t))},i.bBoxIntersect=function(t,e,r){return r=r||0,t.left<=e.right+r&&e.left<=t.right+r&&t.top<=e.bottom+r&&e.top<=t.bottom+r},i.identity=function(t){return t},i.randstr=function f(t,e,r){if(r||(r=16),void 0===e&&(e=24),0>=e)return"0";var n,i,o,a=Math.log(Math.pow(2,e))/Math.log(r),s="";for(n=2;a===1/0;n*=2)a=Math.log(Math.pow(2,e/n))/Math.log(r)*n;var l=a-Math.floor(a);for(n=0;n<Math.floor(a);n++)o=Math.floor(Math.random()*r).toString(r),s=o+s;l&&(i=Math.pow(r,l),o=Math.floor(Math.random()*i).toString(r),s=o+s);var u=parseInt(s,r);return t&&t.indexOf(s)>-1||u!==1/0&&u>=Math.pow(2,e)?f(t,e,r):s},i.OptionControl=function(t,e){t||(t={}),e||(e="opt");var r={};return r.optionList=[],r._newoption=function(n){n[e]=t,r[n.name]=n,r.optionList.push(n)},r["_"+e]=t,r},i.smooth=function(t,e){if(e=Math.round(e)||0,2>e)return t;var r,n,i,o,a=t.length,s=2*a,l=2*e-1,u=new Array(l),c=new Array(a);for(r=0;l>r;r++)u[r]=(1-Math.cos(Math.PI*(r+1)/e))/(2*e);for(r=0;a>r;r++){for(o=0,n=0;l>n;n++)i=r+n+1-e,-a>i?i-=s*Math.round(i/s):i>=s&&(i-=s*Math.floor(i/s)),0>i?i=-1-i:i>=a&&(i=s-1-i),o+=t[i]*u[n];c[r]=o}return c},i.syncOrAsync=function(t,e,r){function n(){return i.syncOrAsync(t,e,r)}for(var o,a;t.length;)if(a=t.splice(0,1)[0],o=a(e),o&&o.then)return o.then(n).then(void 0,i.promiseError);return r&&r(e)},i.stripTrailingSlash=function(t){return"/"===t.substr(-1)?t.substr(0,t.length-1):t},i.noneOrAll=function(t,e,r){if(t){var n,i,o=!1,a=!0;for(n=0;n<r.length;n++)i=t[r[n]],void 0!==i&&null!==i?o=!0:a=!1;if(o&&!a)for(n=0;n<r.length;n++)t[r[n]]=e[r[n]]}},i.pushUnique=function(t,e){return e&&-1===t.indexOf(e)&&t.push(e),t},i.mergeArray=function(t,e,r){if(Array.isArray(t))for(var n=Math.min(t.length,e.length),i=0;n>i;i++)e[i][r]=t[i]},i.minExtend=function(t,e){var r={};"object"!=typeof e&&(e={});var n,o,a,s=3,l=Object.keys(t);for(n=0;n<l.length;n++)o=l[n],a=t[o],"_"!==o.charAt(0)&&"function"!=typeof a&&("module"===o?r[o]=a:Array.isArray(a)?r[o]=a.slice(0,s):a&&"object"==typeof a?r[o]=i.minExtend(t[o],e[o]):r[o]=a);for(l=Object.keys(e),n=0;n<l.length;n++)o=l[n],a=e[o],"object"==typeof a&&o in r&&"object"==typeof r[o]||(r[o]=a);return r},i.titleCase=function(t){return t.charAt(0).toUpperCase()+t.substr(1)},i.containsAny=function(t,e){for(var r=0;r<e.length;r++)if(-1!==t.indexOf(e[r]))return!0;return!1},i.getPlotDiv=function(t){for(;t&&t.removeAttribute;t=t.parentNode)if(i.isPlotDiv(t))return t},i.isPlotDiv=function(t){var e=n.select(t);return e.size()&&e.classed("js-plotly-plot")},i.removeElement=function(t){var e=t&&t.parentNode;e&&e.removeChild(t)},i.addStyleRule=function(t,e){if(!i.styleSheet){var r=document.createElement("style");r.appendChild(document.createTextNode("")),document.head.appendChild(r),i.styleSheet=r.sheet}var n=i.styleSheet;n.insertRule?n.insertRule(t+"{"+e+"}",0):n.addRule?n.addRule(t,e,0):i.warn("addStyleRule failed")},i.getTranslate=function(t){var e=/.*\btranslate\((\d*\.?\d*)[^\d]*(\d*\.?\d*)[^\d].*/,r=t.attr?"attr":"getAttribute",n=t[r]("transform")||"",i=n.replace(e,function(t,e,r){return[e,r].join(" ")}).split(" ");return{x:+i[0]||0,y:+i[1]||0}},i.setTranslate=function(t,e,r){var n=/(\btranslate\(.*?\);?)/,i=t.attr?"attr":"getAttribute",o=t.attr?"attr":"setAttribute",a=t[i]("transform")||"";return e=e||0,r=r||0,a=a.replace(n,"").trim(),a+=" translate("+e+", "+r+")",a=a.trim(),t[o]("transform",a),a},i.getScale=function(t){var e=/.*\bscale\((\d*\.?\d*)[^\d]*(\d*\.?\d*)[^\d].*/,r=t.attr?"attr":"getAttribute",n=t[r]("transform")||"",i=n.replace(e,function(t,e,r){return[e,r].join(" ")}).split(" ");return{x:+i[0]||1,y:+i[1]||1}},i.setScale=function(t,e,r){var n=/(\bscale\(.*?\);?)/,i=t.attr?"attr":"getAttribute",o=t.attr?"attr":"setAttribute",a=t[i]("transform")||"";return e=e||1,r=r||1,a=a.replace(n,"").trim(),a+=" scale("+e+", "+r+")",a=a.trim(),t[o]("transform",a),a},i.setPointGroupScale=function(t,e,r){var n,i,o;return e=e||1,r=r||1,i=1===e&&1===r?"":" scale("+e+","+r+")",o=/\s*sc.*/,t.each(function(){n=(this.getAttribute("transform")||"").replace(o,""),n+=i,n=n.trim(),this.setAttribute("transform",n)}),i},i.isIE=function(){return"undefined"!=typeof window.navigator.msSaveBlob},i.objectFromPath=function(t,e){for(var r,n=t.split("."),i=r={},o=0;o<n.length;o++){var a=n[o],s=null,l=n[o].match(/(.*)\[([0-9]+)\]/);l?(a=l[1],s=l[2],r=r[a]=[],o===n.length-1?r[s]=e:r[s]={},r=r[s]):(o===n.length-1?r[a]=e:r[a]={},r=r[a])}return i},i.numSeparate=function(t,e){if("string"!=typeof e||0===e.length)throw new Error("Separator string required for formatting!");"number"==typeof t&&(t=String(t));var r=/(\d+)(\d{3})/,n=e.charAt(0),i=e.charAt(1),o=t.split("."),a=o[0],s=o.length>1?n+o[1]:"";if(i&&(o.length>1||a.length>4))for(;r.test(a);)a=a.replace(r,"$1"+i+"$2");return a+s}},{"./coerce":560,"./dates":561,"./extend":563,"./is_plain_object":569,"./loggers":570,"./matrix":571,"./nested_property":572,"./notifier":573,"./search":576,"./stats":579,d3:119}],569:[function(t,e,r){"use strict";e.exports=function(t){return window&&window.process&&window.process.versions?"[object Object]"===Object.prototype.toString.call(t):"[object Object]"===Object.prototype.toString.call(t)&&Object.getPrototypeOf(t)===Object.prototype}},{}],570:[function(t,e,r){"use strict";var n=t("../plot_api/plot_config"),i=e.exports={};i.log=function(){if(n.logging>1){for(var t=["LOG:"],e=0;e<arguments.length;e++)t.push(arguments[e]);console.trace?console.trace.apply(console,t):console.log.apply(console,t)}},i.warn=function(){if(n.logging>0){for(var t=["WARN:"],e=0;e<arguments.length;e++)t.push(arguments[e]);console.trace?console.trace.apply(console,t):console.log.apply(console,t)}},i.error=function(){if(n.logging>0){for(var t=["ERROR:"],e=0;e<arguments.length;e++)t.push(arguments[e]);console.error.apply(console,arguments)}}},{"../plot_api/plot_config":584}],571:[function(t,e,r){"use strict";r.init2dArray=function(t,e){for(var r=new Array(t),n=0;t>n;n++)r[n]=new Array(e);return r},r.transposeRagged=function(t){var e,r,n=0,i=t.length;for(e=0;i>e;e++)n=Math.max(n,t[e].length);var o=new Array(n);for(e=0;n>e;e++)for(o[e]=new Array(i),r=0;i>r;r++)o[e][r]=t[r][e];return o},r.dot=function(t,e){if(!t.length||!e.length||t.length!==e.length)return null;var n,i,o=t.length;if(t[0].length)for(n=new Array(o),i=0;o>i;i++)n[i]=r.dot(t[i],e);else if(e[0].length){var a=r.transposeRagged(e);for(n=new Array(a.length),i=0;i<a.length;i++)n[i]=r.dot(t,a[i])}else for(n=0,i=0;o>i;i++)n+=t[i]*e[i];return n},r.translationMatrix=function(t,e){return[[1,0,t],[0,1,e],[0,0,1]]},r.rotationMatrix=function(t){var e=t*Math.PI/180;return[[Math.cos(e),-Math.sin(e),0],[Math.sin(e),Math.cos(e),0],[0,0,1]]},r.rotationXYMatrix=function(t,e,n){return r.dot(r.dot(r.translationMatrix(e,n),r.rotationMatrix(t)),r.translationMatrix(-e,-n))},r.apply2DTransform=function(t){return function(){var e=arguments;3===e.length&&(e=e[0]);var n=1===arguments.length?e[0]:[e[0],e[1]];return r.dot(t,[n[0],n[1],1]).slice(0,2)}},r.apply2DTransform2=function(t){var e=r.apply2DTransform(t);return function(t){return e(t.slice(0,2)).concat(e(t.slice(2,4)))}}},{}],572:[function(t,e,r){"use strict";function n(t,e){return function(){var r,i,o,a,s,l=t;for(a=0;a<e.length-1;a++){if(r=e[a],-1===r){for(i=!0,o=[],s=0;s<l.length;s++)o[s]=n(l[s],e.slice(a+1))(),o[s]!==o[0]&&(i=!1);return i?o[0]:o}if("number"==typeof r&&!Array.isArray(l))return;if(l=l[r],"object"!=typeof l||null===l)return}if("object"==typeof l&&null!==l&&(o=l[e[a]],null!==o))return o}}function i(t,e){var r=["annotations","shapes","range","domain","buttons"],n=-1===r.indexOf(e);return Array.isArray(t)&&n}function o(t,e){return function(r){var n,o,c=t,h=[t],f=u(r)&&!i(r,e[e.length-1]);for(o=0;o<e.length-1;o++){if(n=e[o],"number"==typeof n&&!Array.isArray(c))throw"array index but container is not an array";if(-1===n){if(f=!a(c,e.slice(o+1),r))break;return}if(!s(c,n,e[o+1],f))break;if(c=c[n],"object"!=typeof c||null===c)throw"container is not an object";h.push(c)}f?(o===e.length-1&&delete c[e[o]],l(h)):c[e[o]]=r}}function a(t,e,r){var n,i=Array.isArray(r),a=!0,l=r,c=i?!1:u(r),h=e[0];for(n=0;n<t.length;n++)i&&(l=r[n%r.length],c=u(l)),c&&(a=!1),s(t,n,h,c)&&o(t[n],e)(l);return a}function s(t,e,r,n){if(void 0===t[e]){if(n)return!1;"number"==typeof r?t[e]=[]:t[e]={}}return!0}function l(t){var e,r,n,o,a;for(e=t.length-1;e>=0;e--){if(n=t[e],a=!1,Array.isArray(n))for(r=n.length-1;r>=0;r--)u(n[r])?a?n[r]=void 0:n.pop():a=!0;else if("object"==typeof n&&null!==n)for(o=Object.keys(n),a=!1,r=o.length-1;r>=0;r--)u(n[o[r]])&&!i(n[o[r]],o[r])?delete n[o[r]]:a=!0;if(a)return}}function u(t){return void 0===t||null===t?!0:"object"!=typeof t?!1:Array.isArray(t)?!t.length:!Object.keys(t).length}function c(t,e,r){return{set:function(){throw"bad container"},get:function(){},astr:e,parts:r,obj:t}}var h=t("fast-isnumeric");e.exports=function(t,e){if(h(e))e=String(e);else if("string"!=typeof e||"[-1]"===e.substr(e.length-4))throw"bad property string";for(var r,i,a,s=0,l=e.split(".");s<l.length;){if(r=String(l[s]).match(/^([^\[\]]*)((\[\-?[0-9]*\])+)$/)){if(r[1])l[s]=r[1];else{if(0!==s)throw"bad property string";l.splice(0,1)}for(i=r[2].substr(1,r[2].length-2).split("]["),a=0;a<i.length;a++)s++,l.splice(s,0,Number(i[a]))}s++}return"object"!=typeof t?c(t,e,l):{set:o(t,l),get:n(t,l),astr:e,parts:l,obj:t}}},{"fast-isnumeric":123}],573:[function(t,e,r){"use strict";var n=t("d3"),i=t("fast-isnumeric"),o=[];e.exports=function(t,e){function r(t){t.duration(700).style("opacity",0).each("end",function(t){var e=o.indexOf(t);-1!==e&&o.splice(e,1),n.select(this).remove()})}if(-1===o.indexOf(t)){o.push(t);var a=1e3;i(e)?a=e:"long"===e&&(a=3e3);var s=n.select("body").selectAll(".plotly-notifier").data([0]);s.enter().append("div").classed("plotly-notifier",!0);var l=s.selectAll(".notifier-note").data(o);l.enter().append("div").classed("notifier-note",!0).style("opacity",0).each(function(t){var e=n.select(this);e.append("button").classed("notifier-close",!0).html("&times;").on("click",function(){e.transition().call(r)}),e.append("p").html(t),e.transition().duration(700).style("opacity",1).transition().delay(a).call(r)})}}},{d3:119,"fast-isnumeric":123}],574:[function(t,e,r){"use strict";var n=t("./matrix").dot,i=e.exports={};i.tester=function(t){function e(t,e){var r=t[0],n=t[1];return i>r||r>o||a>n||n>s?!1:!e||!u(t)}function r(t,e){var r=t[0],l=t[1];if(i>r||r>o||a>l||l>s)return!1;var u,c,h,f,d,p=n.length,v=n[0][0],m=n[0][1],g=0;for(u=1;p>u;u++)if(c=v,h=m,v=n[u][0],m=n[u][1],f=Math.min(c,v),!(f>r||r>Math.max(c,v)||l>Math.max(h,m)))if(l<Math.min(h,m))r!==f&&g++;else{if(d=v===c?l:h+(r-c)*(m-h)/(v-c),l===d)return 1!==u||!e;d>=l&&r!==f&&g++}return g%2===1}var n=t.slice(),i=n[0][0],o=i,a=n[0][1],s=a;n.push(n[0]);for(var l=1;l<n.length;l++)i=Math.min(i,n[l][0]),o=Math.max(o,n[l][0]),a=Math.min(a,n[l][1]),s=Math.max(s,n[l][1]);var u,c=!1;return 5===n.length&&(n[0][0]===n[1][0]?n[2][0]===n[3][0]&&n[0][1]===n[3][1]&&n[1][1]===n[2][1]&&(c=!0,u=function(t){return t[0]===n[0][0]}):n[0][1]===n[1][1]&&n[2][1]===n[3][1]&&n[0][0]===n[3][0]&&n[1][0]===n[2][0]&&(c=!0,u=function(t){return t[1]===n[0][1]})),{xmin:i,xmax:o,ymin:a,ymax:s,pts:n,contains:c?e:r,isRect:c}};var o=i.isSegmentBent=function(t,e,r,i){var o,a,s,l=t[e],u=[t[r][0]-l[0],t[r][1]-l[1]],c=n(u,u),h=Math.sqrt(c),f=[-u[1]/h,u[0]/h];for(o=e+1;r>o;o++)if(a=[t[o][0]-l[0],t[o][1]-l[1]],s=n(a,u),0>s||s>c||Math.abs(n(a,f))>i)return!0;return!1};i.filter=function(t,e){function r(r){t.push(r);var s=n.length,l=i;n.splice(a+1);for(var u=l+1;u<t.length;u++)(u===t.length-1||o(t,l,u+1,e))&&(n.push(t[u]),n.length<s-2&&(i=u,a=n.length-1),l=u)}var n=[t[0]],i=0,a=0;if(t.length>1){var s=t.pop();r(s)}return{addPt:r,raw:t,filtered:n}}},{"./matrix":571}],575:[function(t,e,r){"use strict";function n(t,e){for(var r,n=[],o=0;o<e.length;o++)r=e[o],r===t?n[o]=r:"object"==typeof r?n[o]=Array.isArray(r)?i.extendDeep([],r):i.extendDeepAll({},r):n[o]=r;return n}var i=t("../lib"),o=t("../plot_api/plot_config"),a={};a.add=function(t,e,r,n,i){var a,s;return t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},s=t.undoQueue.index,t.autoplay?void(t.undoQueue.inSequence||(t.autoplay=!1)):(!t.undoQueue.sequence||t.undoQueue.beginSequence?(a={undo:{calls:[],args:[]},redo:{calls:[],args:[]}},t.undoQueue.queue.splice(s,t.undoQueue.queue.length-s,a),t.undoQueue.index+=1):a=t.undoQueue.queue[s-1],t.undoQueue.beginSequence=!1,a&&(a.undo.calls.unshift(e),a.undo.args.unshift(r),a.redo.calls.push(n),a.redo.args.push(i)),void(t.undoQueue.queue.length>o.queueLength&&(t.undoQueue.queue.shift(),t.undoQueue.index--)))},a.startSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!0,t.undoQueue.beginSequence=!0},a.stopSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!1,t.undoQueue.beginSequence=!1},a.undo=function(t){var e,r;if(t.framework&&t.framework.isPolar)return void t.framework.undo();if(!(void 0===t.undoQueue||isNaN(t.undoQueue.index)||t.undoQueue.index<=0)){for(t.undoQueue.index--,e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,r=0;r<e.undo.calls.length;r++)a.plotDo(t,e.undo.calls[r],e.undo.args[r]);t.undoQueue.inSequence=!1,t.autoplay=!1}},a.redo=function(t){var e,r;if(t.framework&&t.framework.isPolar)return void t.framework.redo();if(!(void 0===t.undoQueue||isNaN(t.undoQueue.index)||t.undoQueue.index>=t.undoQueue.queue.length)){for(e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,r=0;r<e.redo.calls.length;r++)a.plotDo(t,e.redo.calls[r],e.redo.args[r]);t.undoQueue.inSequence=!1,t.autoplay=!1,t.undoQueue.index++}},a.plotDo=function(t,e,r){t.autoplay=!0,r=n(t,r),e.apply(null,r)},e.exports=a},{"../lib":568,"../plot_api/plot_config":584}],576:[function(t,e,r){"use strict";function n(t,e){return e>t}function i(t,e){return e>=t}function o(t,e){return t>e}function a(t,e){return t>=e}var s=t("fast-isnumeric"),l=t("../lib");r.findBin=function(t,e,r){if(s(e.start))return r?Math.ceil((t-e.start)/e.size)-1:Math.floor((t-e.start)/e.size);var u,c,h=0,f=e.length,d=0;for(c=e[e.length-1]>=e[0]?r?n:i:r?a:o;f>h&&d++<100;)u=Math.floor((h+f)/2),c(e[u],t)?h=u+1:f=u;return d>90&&l.log("Long binary search..."),h-1},r.sorterAsc=function(t,e){return t-e},r.sorterDes=function(t,e){return e-t},r.distinctVals=function(t){var e=t.slice();e.sort(r.sorterAsc);for(var n=e.length-1,i=e[n]-e[0]||1,o=i/(n||1)/1e4,a=[e[0]],s=0;n>s;s++)e[s+1]>e[s]+o&&(i=Math.min(i,e[s+1]-e[s]),a.push(e[s+1]));return{vals:a,minDiff:i}},r.roundUp=function(t,e,r){for(var n,i=0,o=e.length-1,a=0,s=r?0:1,l=r?1:0,u=r?Math.ceil:Math.floor;o>i&&a++<100;)n=u((i+o)/2),e[n]<=t?i=n+s:o=n-l;return e[i]}},{"../lib":568,"fast-isnumeric":123}],577:[function(t,e,r){"use strict";e.exports=function(t,e){(t.attr("class")||"").split(" ").forEach(function(e){0===e.indexOf("cursor-")&&t.classed(e,!1)}),e&&t.classed("cursor-"+e,!0)}},{}],578:[function(t,e,r){"use strict";var n=t("../components/color"),i=function(){};e.exports=function(t){for(var e in t)"function"==typeof t[e]&&(t[e]=i);t.destroy=function(){t.container.parentNode.removeChild(t.container)};var r=document.createElement("div");return r.textContent="Webgl is not supported by your browser - visit http://get.webgl.org for more info",r.style.cursor="pointer",r.style.fontSize="24px",r.style.color=n.defaults[0],t.container.appendChild(r),t.container.style.background="#FFFFFF",t.container.onclick=function(){window.open("http://get.webgl.org")},!1}},{"../components/color":483}],579:[function(t,e,r){"use strict";var n=t("fast-isnumeric");r.aggNums=function(t,e,i,o){var a,s;if(o||(o=i.length),n(e)||(e=!1),Array.isArray(i[0])){for(s=new Array(o),a=0;o>a;a++)s[a]=r.aggNums(t,e,i[a]);i=s}for(a=0;o>a;a++)n(e)?n(i[a])&&(e=t(+e,+i[a])):e=i[a];return e},r.len=function(t){return r.aggNums(function(t){return t+1},0,t)},r.mean=function(t,e){return e||(e=r.len(t)),r.aggNums(function(t,e){return t+e},0,t)/e},r.variance=function(t,e,i){return e||(e=r.len(t)),n(i)||(i=r.mean(t,e)),r.aggNums(function(t,e){return t+Math.pow(e-i,2)},0,t)/e},r.stdev=function(t,e,n){return Math.sqrt(r.variance(t,e,n))},r.interp=function(t,e){if(!n(e))throw"n should be a finite number";if(e=e*t.length-.5,0>e)return t[0];if(e>t.length-1)return t[t.length-1];var r=e%1;return r*t[Math.ceil(e)]+(1-r)*t[Math.floor(e)]}},{"fast-isnumeric":123}],580:[function(t,e,r){"use strict";function n(t){return t=i(t),o.str2RgbaArray(t.toRgbString())}var i=t("tinycolor2"),o=t("arraytools");e.exports=n},{arraytools:50,tinycolor2:454}],581:[function(t,e,r){"use strict";function n(t,e){return t.node().getBoundingClientRect()[e]}function i(t){return t.replace(/(<|&lt;|&#60;)/g,"\\lt ").replace(/(>|&gt;|&#62;)/g,"\\gt ")}function o(t,e,r){var n="math-output-"+f.randstr([],64),o=h.select("body").append("div").attr({id:n}).style({visibility:"hidden",position:"absolute"}).style({"font-size":e.fontSize+"px"}).text(i(t));MathJax.Hub.Queue(["Typeset",MathJax.Hub,o.node()],function(){var e=h.select("body").select("#MathJax_SVG_glyphs");if(o.select(".MathJax_SVG").empty()||!o.select("svg").node())f.log("There was an error in the tex syntax.",t),r();else{var n=o.select("svg").node().getBoundingClientRect();r(o.select(".MathJax_SVG"),e,n)}o.remove()})}function a(t,e){for(var r=t||"",n=0;n<e.length;n++){var i=e[n];r=r.replace(i.regExp,i.sub)}return r}function s(t){return a(t,y)}function l(t){return a(t,b)}function u(t){t=s(t);for(var e=t.split(/(<[^<>]*>)/).map(function(t){var e=t.match(/<(\/?)([^ >]*)\s*(.*)>/i),n=e&&e[2].toLowerCase(),i=v[n];if(void 0!==i){var o=e[1],a=e[3],s=a.match(/^style\s*=\s*"([^"]+)"\s*/i);if("a"===n){if(o)return"</a>";if("href"!==a.substr(0,4).toLowerCase())return"<a>";var u=a.substr(4).replace(/["']/g,"").replace(/=/,""),c=document.createElement("a");return c.href=u,-1===m.indexOf(c.protocol)?"<a>":'<a xlink:show="new" xlink:href="'+l(u)+'">'}if("br"===n)return"<br>";if(o)return"sup"===n?'</tspan><tspan dy="0.42em">&#x200b;</tspan>':"sub"===n?'</tspan><tspan dy="-0.21em">&#x200b;</tspan>':"</tspan>";var h="<tspan";return"sup"!==n&&"sub"!==n||(h="&#x200b;"+h),s&&(s=s[1].replace(/(^|;)\s*color:/,"$1 fill:"),i=(i?i+";":"")+l(s)),h+(i?' style="'+i+'"':"")+">"}return r.xml_entity_encode(t).replace(/</g,"&lt;")}),n=[],i=e.indexOf("<br>");i>0;i=e.indexOf("<br>",i+1))n.push(i);var o=0;n.forEach(function(t){for(var r=t+o,n=e.slice(0,r),i="",a=n.length-1;a>=0;a--){var s=n[a].match(/<(\/?).*>/i);if(s&&"<br>"!==n[a]){s[1]||(i=n[a]);break}}i&&(e.splice(r+1,0,i),e.splice(r,0,"</tspan>"),o+=2)});var a=e.join(""),u=a.split(/<br>/gi);return u.length>1&&(e=u.map(function(t,e){return'<tspan class="line" dy="'+1.3*e+'em">'+t+"</tspan>"})),e.join("")}function c(t,e,r){var n,i,o,a=r.horizontalAlign,s=r.verticalAlign||"top",l=t.node().getBoundingClientRect(),u=e.node().getBoundingClientRect();return i="bottom"===s?function(){return l.bottom-n.height}:"middle"===s?function(){return l.top+(l.height-n.height)/2}:function(){return l.top},o="right"===a?function(){return l.right-n.width}:"center"===a?function(){return l.left+(l.width-n.width)/2}:function(){return l.left},function(){return n=this.node().getBoundingClientRect(),this.style({top:i()-u.top+"px",left:o()-u.left+"px","z-index":1e3}),this}}var h=t("d3"),f=t("../lib"),d=t("../constants/xmlns_namespaces"),p=t("../constants/string_mappings");h.selection.prototype.appendSVG=function(t){for(var e=['<svg xmlns="',d.svg,'" ','xmlns:xlink="',d.xlink,'">',t,"</svg>"].join(""),r=(new DOMParser).parseFromString(e,"application/xml"),n=r.documentElement.firstChild;n;)this.node().appendChild(this.node().ownerDocument.importNode(n,!0)),n=n.nextSibling;return r.querySelector("parsererror")?(f.log(r.querySelector("parsererror div").textContent),
null):h.select(this.node().lastChild)},r.html_entity_decode=function(t){var e=h.select("body").append("div").style({display:"none"}).html(""),r=t.replace(/(&[^;]*;)/gi,function(t){return"&lt;"===t?"&#60;":"&rt;"===t?"&#62;":e.html(t).text()});return e.remove(),r},r.xml_entity_encode=function(t){return t.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g,"&amp;")},r.convertToTspans=function(t,e){function r(){d.empty()||(p=s.attr("class")+"-math",d.select("svg."+p).remove()),t.text("").style({visibility:"visible","white-space":"pre"}),c=t.appendSVG(a),c||t.text(i),t.select("a").size()&&t.style("pointer-events","all"),e&&e.call(s)}var i=t.text(),a=u(i),s=t,l=!s.attr("data-notex")&&a.match(/([^$]*)([$]+[^$]*[$]+)([^$]*)/),c=i,d=h.select(s.node().parentNode);if(!d.empty()){var p=s.attr("class")?s.attr("class").split(" ")[0]:"text";p+="-math",d.selectAll("svg."+p).remove(),d.selectAll("g."+p+"-group").remove(),t.style({visibility:null});for(var v=t.node();v&&v.removeAttribute;v=v.parentNode)v.removeAttribute("data-bb");if(l){var m=f.getPlotDiv(s.node());(m&&m._promises||[]).push(new Promise(function(t){s.style({visibility:"hidden"});var i={fontSize:parseInt(s.style("font-size"),10)};o(l[2],i,function(i,o,a){d.selectAll("svg."+p).remove(),d.selectAll("g."+p+"-group").remove();var l=i&&i.select("svg");if(!l||!l.node())return r(),void t();var u=d.append("g").classed(p+"-group",!0).attr({"pointer-events":"none"});u.node().appendChild(l.node()),o&&o.node()&&l.node().insertBefore(o.node().cloneNode(!0),l.node().firstChild),l.attr({"class":p,height:a.height,preserveAspectRatio:"xMinYMin meet"}).style({overflow:"visible","pointer-events":"none"});var c=s.style("fill")||"black";l.select("g").attr({fill:c,stroke:c});var h=n(l,"width"),f=n(l,"height"),v=+s.attr("x")-h*{start:0,middle:.5,end:1}[s.attr("text-anchor")||"start"],m=parseInt(s.style("font-size"),10)||n(s,"height"),g=-m/4;"y"===p[0]?(u.attr({transform:"rotate("+[-90,+s.attr("x"),+s.attr("y")]+") translate("+[-h/2,g-f/2]+")"}),l.attr({x:+s.attr("x"),y:+s.attr("y")})):"l"===p[0]?l.attr({x:s.attr("x"),y:g-f/2}):"a"===p[0]?l.attr({x:0,y:g}):l.attr({x:v,y:+s.attr("y")+g-f/2}),e&&e.call(s,u),t(u)})}))}else r();return t}};var v={sup:'font-size:70%" dy="-0.6em',sub:'font-size:70%" dy="0.3em',b:"font-weight:bold",i:"font-style:italic",a:"",span:"",br:"",em:"font-style:italic;font-weight:bold"},m=["http:","https:","mailto:"],g=new RegExp("</?("+Object.keys(v).join("|")+")( [^>]*)?/?>","g"),y=Object.keys(p.entityToUnicode).map(function(t){return{regExp:new RegExp("&"+t+";","g"),sub:p.entityToUnicode[t]}}),b=Object.keys(p.unicodeToEntity).map(function(t){return{regExp:new RegExp(t,"g"),sub:"&"+p.unicodeToEntity[t]+";"}});r.plainText=function(t){return(t||"").replace(g," ")},r.makeEditable=function(t,e,r){function n(){o(),a.style({opacity:0});var t,e=u.attr("class");t=e?"."+e.split(" ")[0]+"-math-group":"[class*=-math-group]",t&&h.select(a.node().parentNode).select(t).style({opacity:0})}function i(t){var e=t.node(),r=document.createRange();r.selectNodeContents(e);var n=window.getSelection();n.removeAllRanges(),n.addRange(r),e.focus()}function o(){var t=h.select(f.getPlotDiv(a.node())),e=t.select(".svg-container"),n=e.append("div");n.classed("plugin-editable editable",!0).style({position:"absolute","font-family":a.style("font-family")||"Arial","font-size":a.style("font-size")||12,color:r.fill||a.style("fill")||"black",opacity:1,"background-color":r.background||"transparent",outline:"#ffffff33 1px solid",margin:[-parseFloat(a.style("font-size"))/8+1,0,0,-1].join("px ")+"px",padding:"0","box-sizing":"border-box"}).attr({contenteditable:!0}).text(r.text||a.attr("data-unformatted")).call(c(a,e,r)).on("blur",function(){a.text(this.textContent).style({opacity:1});var t,e=h.select(this).attr("class");t=e?"."+e.split(" ")[0]+"-math-group":"[class*=-math-group]",t&&h.select(a.node().parentNode).select(t).style({opacity:0});var r=this.textContent;h.select(this).transition().duration(0).remove(),h.select(document).on("mouseup",null),s.edit.call(a,r)}).on("focus",function(){var t=this;h.select(document).on("mouseup",function(){return h.event.target===t?!1:void(document.activeElement===n.node()&&n.node().blur())})}).on("keyup",function(){27===h.event.which?(a.style({opacity:1}),h.select(this).style({opacity:0}).on("blur",function(){return!1}).transition().remove(),s.cancel.call(a,this.textContent)):(s.input.call(a,this.textContent),h.select(this).call(c(a,e,r)))}).on("keydown",function(){13===h.event.which&&this.blur()}).call(i)}r||(r={});var a=this,s=h.dispatch("edit","input","cancel"),l=h.select(this.node()).style({"pointer-events":"all"}),u=e||l;return e&&l.style({"pointer-events":"none"}),r.immediate?n():u.on("click",n),h.rebind(this,s,"on")}},{"../constants/string_mappings":555,"../constants/xmlns_namespaces":556,"../lib":568,d3:119}],582:[function(t,e,r){"use strict";var n=e.exports={},i=t("../plots/geo/constants").locationmodeToLayer,o=t("topojson").feature;n.getTopojsonName=function(t){return[t.scope.replace(/ /g,"-"),"_",t.resolution.toString(),"m"].join("")},n.getTopojsonPath=function(t,e){return t+e+".json"},n.getTopojsonFeatures=function(t,e){var r=i[t.locationmode],n=e.objects[r];return o(e,n).features}},{"../plots/geo/constants":611,topojson:455}],583:[function(t,e,r){"use strict";function n(t){var e;if("string"==typeof t){if(e=document.getElementById(t),null===e)throw new Error("No DOM element with id '"+t+"' exists on the page.");return e}if(null===t||void 0===t)throw new Error("DOM element provided is null or undefined");return t}function i(t){Array.isArray(t._promises)&&t._promises.length>0&&R.log("Clearing previous rejected promises from queue."),t._promises=[]}function o(t,e){t._fullLayout._paperdiv.style("background","white"),C.defaultConfig.setBackground(t,e)}function a(t,e){t._context||(t._context=R.extendFlat({},C.defaultConfig));var r=t._context;e&&(Object.keys(e).forEach(function(t){t in r&&("setBackground"===t&&"opaque"===e[t]?r[t]=o:r[t]=e[t])}),e.plot3dPixelRatio&&!r.plotGlPixelRatio&&(r.plotGlPixelRatio=r.plot3dPixelRatio)),r.staticPlot&&(r.editable=!1,r.autosizable=!1,r.scrollZoom=!1,r.doubleClick=!1,r.showTips=!1,r.showLink=!1,r.displayModeBar=!1)}function s(t,e,r){var n=z.select(t).selectAll(".plot-container").data([0]);n.enter().insert("div",":first-child").classed("plot-container plotly",!0);var i=n.selectAll(".svg-container").data([0]);i.enter().append("div").classed("svg-container",!0).style("position","relative"),i.html(""),e&&(t.data=e),r&&(t.layout=r),C.micropolar.manager.fillLayout(t),"initial"===t._fullLayout.autosize&&t._context.autosizable&&(M(t,{}),t._fullLayout.autosize=r.autosize=!0),i.style({width:t._fullLayout.width+"px",height:t._fullLayout.height+"px"}),t.framework=C.micropolar.manager.framework(t),t.framework({data:t.data,layout:t.layout},i.node()),t.framework.setUndoPoint();var o=t.framework.svg(),a=1,s=t._fullLayout.title;""!==s&&s||(a=0);var l="Click to enter title",u=function(){this.call(C.util.convertToTspans)},c=o.select(".title-group text").call(u);if(t._context.editable){c.attr({"data-unformatted":s}),s&&s!==l||(a=.2,c.attr({"data-unformatted":l}).text(l).style({opacity:a}).on("mouseover.opacity",function(){z.select(this).transition().duration(100).style("opacity",1)}).on("mouseout.opacity",function(){z.select(this).transition().duration(1e3).style("opacity",0)}));var h=function(){this.call(C.util.makeEditable).on("edit",function(e){t.framework({layout:{title:e}}),this.attr({"data-unformatted":e}).text(e).call(u),this.call(h)}).on("cancel",function(){var t=this.attr("data-unformatted");this.text(t).call(u)})};c.call(h)}return t._context.setBackground(t,t._fullLayout.paper_bgcolor),F.addLinks(t),Promise.resolve()}function l(t){var e,r;t||(t={}),t.xaxis1&&(t.xaxis||(t.xaxis=t.xaxis1),delete t.xaxis1),t.yaxis1&&(t.yaxis||(t.yaxis=t.yaxis1),delete t.yaxis1);var n=C.Axes.list({_fullLayout:t});for(e=0;e<n.length;e++){var i=n[e];i.anchor&&"free"!==i.anchor&&(i.anchor=C.Axes.cleanId(i.anchor)),i.overlaying&&(i.overlaying=C.Axes.cleanId(i.overlaying)),i.type||(i.isdate?i.type="date":i.islog?i.type="log":i.isdate===!1&&i.islog===!1&&(i.type="linear")),"withzero"!==i.autorange&&"tozero"!==i.autorange||(i.autorange=!0,i.rangemode="tozero"),delete i.islog,delete i.isdate,delete i.categories,f(i,"domain")&&delete i.domain,void 0!==i.autotick&&(void 0===i.tickmode&&(i.tickmode=i.autotick?"auto":"linear"),delete i.autotick)}void 0===t.annotations||Array.isArray(t.annotations)||(R.warn("Annotations must be an array."),delete t.annotations);var o=(t.annotations||[]).length;for(e=0;o>e;e++){var a=t.annotations[e];a.ref&&("paper"===a.ref?(a.xref="paper",a.yref="paper"):"data"===a.ref&&(a.xref="x",a.yref="y"),delete a.ref),u(a,"xref"),u(a,"yref")}void 0===t.shapes||Array.isArray(t.shapes)||(R.warn("Shapes must be an array."),delete t.shapes);var s=(t.shapes||[]).length;for(e=0;s>e;e++){var l=t.shapes[e];u(l,"xref"),u(l,"yref")}var c=t.legend;c&&(c.x>3?(c.x=1.02,c.xanchor="left"):c.x<-2&&(c.x=-.02,c.xanchor="right"),c.y>3?(c.y=1.02,c.yanchor="bottom"):c.y<-2&&(c.y=-.02,c.yanchor="top")),"rotate"===t.dragmode&&(t.dragmode="orbit"),t.scene1&&(t.scene||(t.scene=t.scene1),delete t.scene1);var h=F.getSubplotIds(t,"gl3d");for(e=0;e<h.length;e++){var d=t[h[e]],p=d.cameraposition;if(Array.isArray(p)&&4===p[0].length){var v=p[0],m=p[1],g=p[2],y=I([],v),b=[];for(r=0;3>r;++r)b[r]=m[e]+g*y[2+4*r];d.camera={eye:{x:b[0],y:b[1],z:b[2]},center:{x:m[0],y:m[1],z:m[2]},up:{x:y[1],y:y[5],z:y[9]}},delete d.cameraposition}}return N.clean(t),t}function u(t,e){var r=t[e],n=e.charAt(0);r&&"paper"!==r&&(t[e]=C.Axes.cleanId(r,n))}function c(t,e){for(var r=[],n=(t.concat(Array.isArray(e)?e:[]).filter(function(t){return"uid"in t}).map(function(t){return t.uid})),i=0;i<t.length;i++){var o,a=t[i];if(!("uid"in a)||-1!==r.indexOf(a.uid)){var s;for(o=0;100>o&&(s=R.randstr(n),-1!==r.indexOf(s));o++);a.uid=R.randstr(n),n.push(a.uid)}if(r.push(a.uid),"histogramy"===a.type&&"xbins"in a&&!("ybins"in a)&&(a.ybins=a.xbins,delete a.xbins),a.error_y&&"opacity"in a.error_y){var l=N.defaults,u=a.error_y.color||(F.traceIs(a,"bar")?N.defaultLine:l[i%l.length]);a.error_y.color=N.addOpacity(N.rgb(u),N.opacity(u)*a.error_y.opacity),delete a.error_y.opacity}if("bardir"in a&&("h"!==a.bardir||!F.traceIs(a,"bar")&&"histogram"!==a.type.substr(0,9)||(a.orientation="h",_(a)),delete a.bardir),"histogramy"===a.type&&_(a),"histogramx"!==a.type&&"histogramy"!==a.type||(a.type="histogram"),"scl"in a&&(a.colorscale=a.scl,delete a.scl),"reversescl"in a&&(a.reversescale=a.reversescl,delete a.reversescl),a.xaxis&&(a.xaxis=C.Axes.cleanId(a.xaxis,"x")),a.yaxis&&(a.yaxis=C.Axes.cleanId(a.yaxis,"y")),F.traceIs(a,"gl3d")&&a.scene&&(a.scene=F.subplotsRegistry.gl3d.cleanId(a.scene)),F.traceIs(a,"pie")||(Array.isArray(a.textposition)?a.textposition=a.textposition.map(h):a.textposition&&(a.textposition=h(a.textposition))),F.traceIs(a,"2dMap")&&("YIGnBu"===a.colorscale&&(a.colorscale="YlGnBu"),"YIOrRd"===a.colorscale&&(a.colorscale="YlOrRd")),F.traceIs(a,"markerColorscale")&&a.marker){var c=a.marker;"YIGnBu"===c.colorscale&&(c.colorscale="YlGnBu"),"YIOrRd"===c.colorscale&&(c.colorscale="YlOrRd")}if("surface"===a.type&&R.isPlainObject(a.contours)){var d=["x","y","z"];for(o=0;o<d.length;o++){var p=a.contours[d[o]];R.isPlainObject(p)&&(p.highlightColor&&(p.highlightcolor=p.highlightColor,delete p.highlightColor),p.highlightWidth&&(p.highlightwidth=p.highlightWidth,delete p.highlightWidth))}}f(a,"line")&&delete a.line,"marker"in a&&(f(a.marker,"line")&&delete a.marker.line,f(a,"marker")&&delete a.marker),N.clean(a)}}function h(t){var e="middle",r="center";return-1!==t.indexOf("top")?e="top":-1!==t.indexOf("bottom")&&(e="bottom"),-1!==t.indexOf("left")?r="left":-1!==t.indexOf("right")&&(r="right"),e+" "+r}function f(t,e){return e in t&&"object"==typeof t[e]&&0===Object.keys(t[e]).length}function d(t){var e,r=C.Axes.list(t),n=t._fullData,i=t._fullLayout,o=t.calcdata=new Array(n.length);for(t.firstscatter=!0,t.numboxes=0,t._hmpixcount=0,t._hmlumcount=0,i._piecolormap={},i._piedefaultcolorcount=0,e=0;e<r.length;e++)r[e]._categories=r[e]._initialCategories.slice();for(e=0;e<n.length;e++){var a=n[e],s=a._module,l=[];s&&a.visible===!0&&s.calc&&(l=s.calc(t,a)),Array.isArray(l)&&l[0]||(l=[{x:!1,y:!1}]),l[0].t||(l[0].t={}),l[0].trace=a,o[e]=l}}function p(t,e){var r,n,i=e+1,o=[];for(r=0;r<t.length;r++)n=t[r],0>n?o.push(i+n):o.push(n);return o}function v(t,e,r){var n,i;for(n=0;n<e.length;n++){if(i=e[n],i!==parseInt(i,10))throw new Error("all values in "+r+" must be integers");if(i>=t.data.length||i<-t.data.length)throw new Error(r+" must be valid indices for gd.data.");if(e.indexOf(i,n+1)>-1||i>=0&&e.indexOf(-t.data.length+i)>-1||0>i&&e.indexOf(t.data.length+i)>-1)throw new Error("each index in "+r+" must be unique.")}}function m(t,e,r){if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("currentIndices is a required argument.");if(Array.isArray(e)||(e=[e]),v(t,e,"currentIndices"),"undefined"==typeof r||Array.isArray(r)||(r=[r]),"undefined"!=typeof r&&v(t,r,"newIndices"),"undefined"!=typeof r&&e.length!==r.length)throw new Error("current and new indices must be of equal length.")}function g(t,e,r){var n,i;if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("traces must be defined.");for(Array.isArray(e)||(e=[e]),n=0;n<e.length;n++)if(i=e[n],"object"!=typeof i||Array.isArray(i)||null===i)throw new Error("all values in traces array must be non-array objects");if("undefined"==typeof r||Array.isArray(r)||(r=[r]),"undefined"!=typeof r&&r.length!==e.length)throw new Error("if indices is specified, traces.length must equal indices.length")}function y(t,e,r,n){var i=R.isPlainObject(n);if(!Array.isArray(t.data))throw new Error("gd.data must be an array");if(!R.isPlainObject(e))throw new Error("update must be a key:value object");if("undefined"==typeof r)throw new Error("indices must be an integer or array of integers");v(t,r,"indices");for(var o in e){if(!Array.isArray(e[o])||e[o].length!==r.length)throw new Error("attribute "+o+" must be an array of length equal to indices array length");if(i&&(!(o in n)||!Array.isArray(n[o])||n[o].length!==e[o].length))throw new Error("when maxPoints is set as a key:value object it must contain a 1:1 corrispondence with the keys and number of traces in the update object")}}function b(t,e,r,n){var i,o,a,s,l,u=R.isPlainObject(n),c=[];Array.isArray(r)||(r=[r]),r=p(r,t.data.length-1);for(var h in e)for(var f=0;f<r.length;f++){if(i=t.data[r[f]],a=R.nestedProperty(i,h),o=a.get(),s=e[h][f],!Array.isArray(s))throw new Error("attribute: "+h+" index: "+f+" must be an array");if(!Array.isArray(o))throw new Error("cannot extend missing or non-array attribute: "+h);l=u?n[h][f]:n,P(l)||(l=-1),c.push({prop:a,target:o,insert:s,maxp:Math.floor(l)})}return c}function x(t,e,r,n,i,o){y(t,e,r,n);for(var a,s,l,u=b(t,e,r,n),c=[],h={},f={},d=0;d<u.length;d++)s=u[d].prop,l=u[d].maxp,a=i(u[d].target,u[d].insert),l>=0&&l<a.length&&(c=o(a,l)),l=u[d].target.length,s.set(a),Array.isArray(h[s.astr])||(h[s.astr]=[]),Array.isArray(f[s.astr])||(f[s.astr]=[]),h[s.astr].push(c),f[s.astr].push(l);return{update:h,maxPoints:f}}function _(t){var e;if(R.swapAttrs(t,["?","?0","d?","?bins","nbins?","autobin?","?src","error_?"]),Array.isArray(t.z)&&Array.isArray(t.z[0])&&(t.transpose?delete t.transpose:t.transpose=!0),t.error_x&&t.error_y){var r=t.error_y,n="copy_ystyle"in r?r.copy_ystyle:!(r.color||r.thickness||r.width);R.swapAttrs(t,["error_?.copy_ystyle"]),n&&R.swapAttrs(t,["error_?.color","error_?.thickness","error_?.width"])}if(t.hoverinfo){var i=t.hoverinfo.split("+");for(e=0;e<i.length;e++)"x"===i[e]?i[e]="y":"y"===i[e]&&(i[e]="x");t.hoverinfo=i.join("+")}}function w(t){var e,r={left:0,right:0,bottom:0,top:0};if(t)for(e in t)t.hasOwnProperty(e)&&(r.left+=t[e].left||0,r.right+=t[e].right||0,r.bottom+=t[e].bottom||0,r.top+=t[e].top||0);return r}function M(t,e){var r,n,i,o=t._fullLayout,a=t._context;if(t.emit("plotly_autosize"),t._context.fillFrame)i=window.innerWidth,n=window.innerHeight,document.body.style.overflow="hidden";else if(P(a.frameMargins)&&a.frameMargins>0){var s=w(t._boundingBoxMargins),l=s.left+s.right,u=s.bottom+s.top,c=o._container.node().getBoundingClientRect(),h=1-2*a.frameMargins;i=Math.round(h*(c.width-l)),n=Math.round(h*(c.height-u))}else r=window.getComputedStyle(t),n=parseFloat(r.height)||o.height,i=parseFloat(r.width)||o.width;return Math.abs(o.width-i)>1||Math.abs(o.height-n)>1?(o.height=t.layout.height=n,o.width=t.layout.width=i):"initial"!==o.autosize&&(delete e.autosize,o.autosize=t.layout.autosize=!0),F.sanitizeMargins(o),e}function k(t){var e=z.select(t),r=t._fullLayout;if(r._container=e.selectAll(".plot-container").data([0]),r._container.enter().insert("div",":first-child").classed("plot-container",!0).classed("plotly",!0),r._paperdiv=r._container.selectAll(".svg-container").data([0]),r._paperdiv.enter().append("div").classed("svg-container",!0).style("position","relative"),"initial"===r.autosize&&(M(t,{}),r.autosize=!0,t.layout.autosize=!0),r._glcontainer=r._paperdiv.selectAll(".gl-container").data([0]),r._glcontainer.enter().append("div").classed("gl-container",!0),r._geocontainer=r._paperdiv.selectAll(".geo-container").data([0]),r._geocontainer.enter().append("div").classed("geo-container",!0),r._paperdiv.selectAll(".main-svg").remove(),r._paper=r._paperdiv.insert("svg",":first-child").classed("main-svg",!0),r._toppaper=r._paperdiv.append("svg").classed("main-svg",!0),!r._uid){var n=[];z.selectAll("defs").each(function(){this.id&&n.push(this.id.split("-")[1])}),r._uid=R.randstr(n)}r._paperdiv.selectAll(".main-svg").attr(K.svgAttrs),r._defs=r._paper.append("defs").attr("id","defs-"+r._uid),r._topdefs=r._toppaper.append("defs").attr("id","topdefs-"+r._uid),r._draggers=r._paper.append("g").classed("draglayer",!0);var i=r._paper.append("g").classed("layer-below",!0);r._imageLowerLayer=i.append("g").classed("imagelayer",!0),r._shapeLowerLayer=i.append("g").classed("shapelayer",!0);var o=C.Axes.getSubplots(t);o.join("")!==Object.keys(t._fullLayout._plots||{}).join("")&&A(t,o),r._has("cartesian")&&T(t,o),r._ternarylayer=r._paper.append("g").classed("ternarylayer",!0);var a=r._paper.selectAll(".layer-subplot");r._imageSubplotLayer=a.selectAll(".imagelayer"),r._shapeSubplotLayer=a.selectAll(".shapelayer");var s=r._paper.append("g").classed("layer-above",!0);r._imageUpperLayer=s.append("g").classed("imagelayer",!0),r._shapeUpperLayer=s.append("g").classed("shapelayer",!0),r._pielayer=r._paper.append("g").classed("pielayer",!0),r._glimages=r._paper.append("g").classed("glimages",!0),r._geoimages=r._paper.append("g").classed("geoimages",!0),r._infolayer=r._toppaper.append("g").classed("infolayer",!0),r._zoomlayer=r._toppaper.append("g").classed("zoomlayer",!0),r._hoverlayer=r._toppaper.append("g").classed("hoverlayer",!0),t.emit("plotly_framework");var l=R.syncOrAsync([E,function(){return C.Axes.doTicks(t,"redraw")},j.init],t);return l&&l.then&&t._promises.push(l),l}function A(t,e){function r(e,r){return function(){return C.Axes.getFromId(t,e,r)}}for(var n,i,o=t._fullLayout._plots={},a=0;a<e.length;a++)n=e[a],i=o[n]={},i.id=n,i.x=r(n,"x"),i.y=r(n,"y"),i.xaxis=i.x(),i.yaxis=i.y()}function T(t,e){function r(t){t.append("g").classed("imagelayer",!0),t.append("g").classed("maplayer",!0),t.append("g").classed("barlayer",!0),t.append("g").classed("boxlayer",!0),t.append("g").classed("scatterlayer",!0)}var n=t._fullLayout,i=[];n._paper.selectAll("g.subplot").data(e).enter().append("g").classed("subplot",!0).each(function(o){var a=n._plots[o],s=a.plotgroup=z.select(this).classed(o,!0),l=a.xaxis,u=a.yaxis;a.overlays=[];var c=C.Axes.getFromId(t,l.overlaying)||l;c!==l&&c.overlaying&&(c=l,l.overlaying=!1);var h=C.Axes.getFromId(t,u.overlaying)||u;h!==u&&h.overlaying&&(h=u,u.overlaying=!1);var f=c._id+h._id;if(f!==o&&-1!==e.indexOf(f))a.mainplot=f,i.push(a),l.domain=c.domain.slice(),u.domain=h.domain.slice();else{a.bg=s.append("rect").style("stroke-width",0);var d=s.append("g").classed("layer-subplot",!0);a.shapelayer=d.append("g").classed("shapelayer",!0),a.imagelayer=d.append("g").classed("imagelayer",!0),a.gridlayer=s.append("g"),a.overgrid=s.append("g"),a.zerolinelayer=s.append("g"),a.overzero=s.append("g"),a.plot=s.append("g").call(r),a.overplot=s.append("g"),a.xlines=s.append("path"),a.ylines=s.append("path"),a.overlines=s.append("g"),a.xaxislayer=s.append("g"),a.yaxislayer=s.append("g"),a.overaxes=s.append("g")}a.draglayer=n._draggers.append("g")}),i.forEach(function(t){var e=n._plots[t.mainplot];e.overlays.push(t),t.gridlayer=e.overgrid.append("g"),t.zerolinelayer=e.overzero.append("g"),t.plot=e.overplot.append("g").call(r),t.xlines=e.overlines.append("path"),t.ylines=e.overlines.append("path"),t.xaxislayer=e.overaxes.append("g"),t.yaxislayer=e.overaxes.append("g")}),e.forEach(function(t){var e=n._plots[t];e.xlines.style("fill","none").classed("crisp",!0),e.ylines.style("fill","none").classed("crisp",!0)})}function E(t){return R.syncOrAsync([F.doAutoMargin,S],t)}function S(t){var e,r=t._fullLayout,n=r._size,i=C.Axes.list(t);for(e=0;e<i.length;e++)i[e]._linepositions={};r._paperdiv.style({width:r.width+"px",height:r.height+"px"}).selectAll(".main-svg").call(B.setSize,r.width,r.height),t._context.setBackground(t,r.paper_bgcolor);var o=[];return r._paper.selectAll("g.subplot").each(function(e){var i=r._plots[e],a=C.Axes.getFromId(t,e,"x"),s=C.Axes.getFromId(t,e,"y");a.setScale(),s.setScale(),i.bg&&i.bg.call(B.setRect,a._offset-n.p,s._offset-n.p,a._length+2*n.p,s._length+2*n.p).call(N.fill,r.plot_bgcolor),i.clipId="clip"+r._uid+e+"plot";var l=r._defs.selectAll("g.clips").selectAll("#"+i.clipId).data([0]);l.enter().append("clipPath").attr({"class":"plotclip",id:i.clipId}).append("rect"),l.selectAll("rect").attr({width:a._length,height:s._length}),i.plot.call(R.setTranslate,a._offset,s._offset),i.plot.call(B.setClipUrl,i.clipId);var u=B.crispRound(t,a.linewidth,1),c=B.crispRound(t,s.linewidth,1),h=n.p+c,f="M"+-h+",",d="h"+(a._length+2*h),p="free"===a.anchor&&-1===o.indexOf(a._id),v=n.h*(1-(a.position||0))+u/2%1,m=a.anchor===s._id&&(a.mirror||"top"!==a.side)||"all"===a.mirror||"allticks"===a.mirror||a.mirrors&&a.mirrors[s._id+"bottom"],g=s._length+n.p+u/2,y=a.anchor===s._id&&(a.mirror||"top"===a.side)||"all"===a.mirror||"allticks"===a.mirror||a.mirrors&&a.mirrors[s._id+"top"],b=-n.p-u/2,x=n.p,_=m?0:u,w=y?0:u,M=","+(-x-w)+"v"+(s._length+2*x+w+_),k="free"===s.anchor&&-1===o.indexOf(s._id),A=n.w*(s.position||0)+c/2%1,T=s.anchor===a._id&&(s.mirror||"right"!==s.side)||"all"===s.mirror||"allticks"===s.mirror||s.mirrors&&s.mirrors[a._id+"left"],E=-n.p-c/2,S=s.anchor===a._id&&(s.mirror||"right"===s.side)||"all"===s.mirror||"allticks"===s.mirror||s.mirrors&&s.mirrors[a._id+"right"],L=a._length+n.p+c/2;a._linepositions[e]=[m?g:void 0,y?b:void 0,p?v:void 0],a.anchor===s._id?a._linepositions[e][3]="top"===a.side?b:g:p&&(a._linepositions[e][3]=v),s._linepositions[e]=[T?E:void 0,S?L:void 0,k?A:void 0],s.anchor===a._id?s._linepositions[e][3]="right"===s.side?L:E:k&&(s._linepositions[e][3]=A);var z="translate("+a._offset+","+s._offset+")",I=z,P=z;p&&(I="translate("+a._offset+","+n.t+")",b+=s._offset-n.t,g+=s._offset-n.t),k&&(P="translate("+n.l+","+s._offset+")",E+=a._offset-n.l,L+=a._offset-n.l),i.xlines.attr("transform",I).attr("d",(m?f+g+d:"")+(y?f+b+d:"")+(p?f+v+d:"")||"M0,0").style("stroke-width",u+"px").call(N.stroke,a.showline?a.linecolor:"rgba(0,0,0,0)"),i.ylines.attr("transform",P).attr("d",(T?"M"+E+M:"")+(S?"M"+L+M:"")+(k?"M"+A+M:"")||"M0,0").attr("stroke-width",c+"px").call(N.stroke,s.showline?s.linecolor:"rgba(0,0,0,0)"),i.xaxislayer.attr("transform",I),i.yaxislayer.attr("transform",P),i.gridlayer.attr("transform",z),i.zerolinelayer.attr("transform",z),i.draglayer.attr("transform",z),p&&o.push(a._id),k&&o.push(s._id)}),C.Axes.makeClipPaths(t),L(t),Z(t),t._promises.length&&Promise.all(t._promises)}function L(t){var e=t._fullLayout;W.draw(t,"gtitle",{propContainer:e,propName:"title",dfltName:"Plot",attributes:{x:e.width/2,y:e._size.t/2,"text-anchor":"middle"}})}var z=t("d3"),I=t("gl-mat4/fromQuat"),P=t("fast-isnumeric"),C=t("../plotly"),R=t("../lib"),D=t("../lib/events"),O=t("../lib/queue"),F=t("../plots/plots"),j=t("../plots/cartesian/graph_interact"),N=t("../components/color"),B=t("../components/drawing"),U=t("../components/errorbars"),V=t("../components/images"),q=t("../components/legend"),G=t("../components/rangeslider"),H=t("../components/rangeselector"),X=t("../components/updatemenus"),Y=t("../components/shapes"),W=t("../components/titles"),Z=t("../components/modebar/manage"),K=t("../constants/xmlns_namespaces");C.plot=function(t,e,r,i){function o(){var e,r,n,i=t.calcdata;for(q.draw(t),H.draw(t),X.draw(t),e=0;e<i.length;e++)r=i[e],n=r[0].trace,n.visible===!0&&n._module.colorbar?n._module.colorbar(t,r):F.autoMargin(t,"cb"+n.uid);return F.doAutoMargin(t),F.previousPromises(t)}function u(){var e=JSON.stringify(A._size)===L?[]:[o,E];return R.syncOrAsync(e.concat(j.init),t)}function h(){if(T){for(var e,r,n=F.getSubplotIds(A,"cartesian"),i=A._modules,o=0;o<n.length;o++){e=A._plots[n[o]];for(var a=0;a<i.length;a++)r=i[a],r.setPositions&&r.setPositions(t,e)}return U.calc(t),R.syncOrAsync([Y.calcAutorange,C.Annotations.calcAutorange,f],t)}}function f(){for(var e=C.Axes.list(t,"",!0),r=0;r<e.length;r++)C.Axes.doAutoRange(e[r])}function p(){return C.Axes.doTicks(t,"redraw")}function v(){var e,r=t.calcdata;for(e=0;e<r.length;e++){var n=r[e][0].trace,i=n.visible===!0,o=n.uid;i&&F.traceIs(n,"2dMap")||A._paper.selectAll(".hm"+o+",.contour"+o+",#clip"+o).remove(),i&&n._module.colorbar||A._infolayer.selectAll(".cb"+o).remove()}var a=A._basePlotModules;for(e=0;e<a.length;e++)a[e].plot(t);return F.style(t),Y.drawAll(t),C.Annotations.drawAll(t),F.addLinks(t),t._replotting=!1,F.previousPromises(t)}function m(){Y.drawAll(t),V.draw(t),C.Annotations.drawAll(t),q.draw(t),G.draw(t),H.draw(t),X.draw(t)}function g(){t.emit("plotly_afterplot")}t=n(t),D.init(t);var y=D.triggerHandler(t,"plotly_beforeplot",[e,r,i]);if(y===!1)return Promise.reject();e||r||R.isPlotDiv(t)||R.warn("Calling Plotly.plot as if redrawing but this container doesn't yet have a plot.",t),a(t,i),r||(r={}),z.select(t).classed("js-plotly-plot",!0),B.makeTester(t),t._promises=[];var b=0===(t.data||[]).length&&Array.isArray(e);if(Array.isArray(e)&&(c(e,t.data),b?t.data=e:t.data.push.apply(t.data,e),t.empty=!1),t.layout&&!b||(t.layout=l(r)),t._dragging)return t._replotPending=!0,Promise.reject();if(t._replotPending=!1,F.supplyDefaults(t),e&&e[0]&&e[0].r)return s(t,e,r);t._replotting=!0;var x=t._fullData.length>0,_=C.Axes.getSubplots(t).join(""),w=Object.keys(t._fullLayout._plots||{}).join(""),M=w===_;x?t.framework===k&&!b&&M||(t.framework=k,k(t)):M?b&&k(t):(t.framework=k,k(t)),b&&C.Axes.saveRangeInitial(t);var A=t._fullLayout,T=!t.calcdata||t.calcdata.length!==(t.data||[]).length;T&&d(t);for(var S=0;S<t.calcdata.length;S++)t.calcdata[S][0].trace=t._fullData[S];var L=JSON.stringify(A._size);return R.syncOrAsync([F.previousPromises,o,u,h,E,p,v,m],t,g),Promise.all(t._promises).then(function(){return t})},C.redraw=function(t){return t=n(t),R.isPlotDiv(t)?(t.calcdata=void 0,C.plot(t).then(function(){return t.emit("plotly_redraw"),t})):void R.warn("This element is not a Plotly plot.",t)},C.newPlot=function(t,e,r,i){return t=n(t),F.cleanPlot([],{},t._fullData||{},t._fullLayout||{}),F.purge(t),C.plot(t,e,r,i)},C.extendTraces=function J(t,e,r,i){t=n(t);var o=x(t,e,r,i,function(t,e){return t.concat(e)},function(t,e){return t.splice(0,t.length-e)}),a=C.redraw(t),s=[t,o.update,r,o.maxPoints];return O.add(t,C.prependTraces,s,J,arguments),a},C.prependTraces=function $(t,e,r,i){t=n(t);var o=x(t,e,r,i,function(t,e){return e.concat(t)},function(t,e){return t.splice(e,t.length)}),a=C.redraw(t),s=[t,o.update,r,o.maxPoints];return O.add(t,C.extendTraces,s,$,arguments),a},C.addTraces=function Q(t,e,r){t=n(t);var i,o,a=[],s=C.deleteTraces,l=Q,u=[t,a],h=[t,e];for(g(t,e,r),Array.isArray(e)||(e=[e]),c(e,t.data),i=0;i<e.length;i+=1)t.data.push(e[i]);for(i=0;i<e.length;i++)a.push(-e.length+i);if("undefined"==typeof r)return o=C.redraw(t),O.add(t,s,u,l,h),o;Array.isArray(r)||(r=[r]);try{m(t,a,r)}catch(f){throw t.data.splice(t.data.length-e.length,e.length),f}return O.startSequence(t),O.add(t,s,u,l,h),o=C.moveTraces(t,a,r),O.stopSequence(t),o},C.deleteTraces=function tt(t,e){t=n(t);var r,i,o=[],a=C.addTraces,s=tt,l=[t,o,e],u=[t,e];if("undefined"==typeof e)throw new Error("indices must be an integer or array of integers.");for(Array.isArray(e)||(e=[e]),v(t,e,"indices"),e=p(e,t.data.length-1),e.sort(R.sorterDes),r=0;r<e.length;r+=1)i=t.data.splice(e[r],1)[0],o.push(i);var c=C.redraw(t);return O.add(t,a,l,s,u),c},C.moveTraces=function et(t,e,r){t=n(t);var i,o=[],a=[],s=et,l=et,u=[t,r,e],c=[t,e,r];if(m(t,e,r),e=Array.isArray(e)?e:[e],"undefined"==typeof r)for(r=[],i=0;i<e.length;i++)r.push(-e.length+i);for(r=Array.isArray(r)?r:[r],e=p(e,t.data.length-1),r=p(r,t.data.length-1),i=0;i<t.data.length;i++)-1===e.indexOf(i)&&o.push(t.data[i]);for(i=0;i<e.length;i++)a.push({newIndex:r[i],trace:t.data[e[i]]});for(a.sort(function(t,e){return t.newIndex-e.newIndex}),i=0;i<a.length;i+=1)o.splice(a[i].newIndex,0,a[i].trace);t.data=o;var h=C.redraw(t);return O.add(t,s,u,l,c),h},C.restyle=function rt(t,e,r,o){function a(){return o.map(function(){})}function s(t){var e=C.Axes.id2name(t);-1===v.indexOf(e)&&v.push(e)}function l(t){return"LAYOUT"+t+".autorange"}function u(t){return"LAYOUT"+t+".range"}function c(e,r,n){if(Array.isArray(e))return void e.forEach(function(t){c(t,r,n)});if(!(e in d)){var i;i="LAYOUT"===e.substr(0,6)?R.nestedProperty(t.layout,e.replace("LAYOUT","")):R.nestedProperty(t.data[o[n]],e),e in E||(E[e]=a()),void 0===E[e][n]&&(E[e][n]=i.get()),void 0!==r&&i.set(r)}}t=n(t),i(t);var h,f=t._fullLayout,d={};if("string"==typeof e)d[e]=r;else{if(!R.isPlainObject(e))return R.warn("Restyle fail.",e,r,o),Promise.reject();d=e,void 0===o&&(o=r)}Object.keys(d).length&&(t.changed=!0),P(o)?o=[o]:Array.isArray(o)&&o.length||(o=t.data.map(function(t,e){return e}));var p=["mode","visible","type","orientation","fill","histfunc","histnorm","text","x","y","z","a","b","c","xtype","x0","dx","ytype","y0","dy","xaxis","yaxis","line.width","connectgaps","transpose","zsmooth","showscale","marker.showscale","zauto","marker.cauto","autocolorscale","marker.autocolorscale","colorscale","marker.colorscale","reversescale","marker.reversescale","autobinx","nbinsx","xbins","xbins.start","xbins.end","xbins.size","autobiny","nbinsy","ybins","ybins.start","ybins.end","ybins.size","autocontour","ncontours","contours","contours.coloring","error_y","error_y.visible","error_y.value","error_y.type","error_y.traceref","error_y.array","error_y.symmetric","error_y.arrayminus","error_y.valueminus","error_y.tracerefminus","error_x","error_x.visible","error_x.value","error_x.type","error_x.traceref","error_x.array","error_x.symmetric","error_x.arrayminus","error_x.valueminus","error_x.tracerefminus","swapxy","swapxyaxes","orientationaxes","marker.colors","values","labels","label0","dlabel","sort","textinfo","textposition","textfont.size","textfont.family","textfont.color","insidetextfont.size","insidetextfont.family","insidetextfont.color","outsidetextfont.size","outsidetextfont.family","outsidetextfont.color","hole","scalegroup","domain","domain.x","domain.y","domain.x[0]","domain.x[1]","domain.y[0]","domain.y[1]","tilt","tiltaxis","depth","direction","rotation","pull","line.showscale","line.cauto","line.autocolorscale","line.reversescale","marker.line.showscale","marker.line.cauto","marker.line.autocolorscale","marker.line.reversescale"];for(h=0;h<o.length;h++)if(F.traceIs(t._fullData[o[h]],"box")){p.push("name");break}var v,m=["marker","marker.size","textfont","boxpoints","jitter","pointpos","whiskerwidth","boxmean"],g=["zmin","zmax","zauto","marker.cmin","marker.cmax","marker.cauto","line.cmin","line.cmax","marker.line.cmin","marker.line.cmax","contours.start","contours.end","contours.size","contours.showlines","line","line.smoothing","line.shape","error_y.width","error_x.width","error_x.copy_ystyle","marker.maxdisplayed"],y=["type","x","y","x0","y0","orientation","xaxis","yaxis"],b=!1,x=!1,w=!1,M=!1,k=!1,A=!1,T={},E={},S={},L=["cartesian","pie","ternary"];
f._basePlotModules.forEach(function(t){-1===L.indexOf(t.name)&&(b=!0)});var z=["zmin","zmax"],I=["xbins.start","xbins.end","xbins.size"],D=["ybins.start","ybins.end","ybins.size"],j=["contours.start","contours.end","contours.size"];for(var N in d){var B,U,V,G,H,X=d[N];if(T[N]=X,"LAYOUT"!==N.substr(0,6)){for("transforms"===N.substr(0,10)&&(b=!0),E[N]=a(),h=0;h<o.length;h++){if(B=t.data[o[h]],U=t._fullData[o[h]],V=R.nestedProperty(B,N),G=V.get(),H=Array.isArray(X)?X[h%X.length]:X,-1!==z.indexOf(N))c("zauto",!1,h);else if("colorscale"===N)c("autocolorscale",!1,h);else if("autocolorscale"===N)c("colorscale",void 0,h);else if("marker.colorscale"===N)c("marker.autocolorscale",!1,h);else if("marker.autocolorscale"===N)c("marker.colorscale",void 0,h);else if("zauto"===N)c(z,void 0,h);else if(-1!==I.indexOf(N))c("autobinx",!1,h);else if("autobinx"===N)c(I,void 0,h);else if(-1!==D.indexOf(N))c("autobiny",!1,h);else if("autobiny"===N)c(D,void 0,h);else if(-1!==j.indexOf(N))c("autocontour",!1,h);else if("autocontour"===N)c(j,void 0,h);else if(-1!==["x0","dx"].indexOf(N)&&U.x&&"scaled"!==U.xtype)c("xtype","scaled",h);else if(-1!==["y0","dy"].indexOf(N)&&U.y&&"scaled"!==U.ytype)c("ytype","scaled",h);else if("colorbar.thicknessmode"===N&&V.get()!==H&&-1!==["fraction","pixels"].indexOf(H)&&U.colorbar){var Y=-1!==["top","bottom"].indexOf(U.colorbar.orient)?f.height-f.margin.t-f.margin.b:f.width-f.margin.l-f.margin.r;c("colorbar.thickness",U.colorbar.thickness*("fraction"===H?1/Y:Y),h)}else if("colorbar.lenmode"===N&&V.get()!==H&&-1!==["fraction","pixels"].indexOf(H)&&U.colorbar){var W=-1!==["top","bottom"].indexOf(U.colorbar.orient)?f.width-f.margin.l-f.margin.r:f.height-f.margin.t-f.margin.b;c("colorbar.len",U.colorbar.len*("fraction"===H?1/W:W),h)}else"colorbar.tick0"===N||"colorbar.dtick"===N?c("colorbar.tickmode","linear",h):"colorbar.tickmode"===N&&c(["colorbar.tick0","colorbar.dtick"],void 0,h);if("type"===N&&"pie"===H!=("pie"===G)){var Z="x",K="y";"bar"!==H&&"bar"!==G||"h"!==B.orientation||(Z="y",K="x"),R.swapAttrs(B,["?","?src"],"labels",Z),R.swapAttrs(B,["d?","?0"],"label",Z),R.swapAttrs(B,["?","?src"],"values",K),"pie"===G?(R.nestedProperty(B,"marker.color").set(R.nestedProperty(B,"marker.colors").get()),f._pielayer.selectAll("g.trace").remove()):F.traceIs(B,"cartesian")&&(R.nestedProperty(B,"marker.colors").set(R.nestedProperty(B,"marker.color").get()),S[B.xaxis||"x"]=!0,S[B.yaxis||"y"]=!0)}E[N][h]=G;var J=["swapxy","swapxyaxes","orientation","orientationaxes"];if(-1!==J.indexOf(N)){if("orientation"===N){if(V.set(H),V.get()===E[N][h])continue}else"orientationaxes"===N&&(B.orientation={v:"h",h:"v"}[U.orientation]);_(B)}else V.set(H)}if(-1!==["swapxyaxes","orientationaxes"].indexOf(N)&&C.Axes.swap(t,o),"orientationaxes"===N){var $=R.nestedProperty(t.layout,"hovermode");"x"===$.get()?$.set("y"):"y"===$.get()&&$.set("x")}if(-1!==o.indexOf(0)&&-1!==y.indexOf(N)&&(C.Axes.clearTypes(t,o),b=!0),-1!==["autobinx","autobiny","zauto"].indexOf(N)&&H===!1||(k=!0),(-1!==["colorbar","line"].indexOf(V.parts[0])||"marker"===V.parts[0]&&"colorbar"===V.parts[1])&&(A=!0),-1!==p.indexOf(N)){if(-1!==["orientation","type"].indexOf(N)){for(v=[],h=0;h<o.length;h++){var Q=t.data[o[h]];F.traceIs(Q,"cartesian")&&(s(Q.xaxis||"x"),s(Q.yaxis||"y"),"type"===e&&c(["autobinx","autobiny"],!0,h))}c(v.map(l),!0,0),c(v.map(u),[0,1],0)}b=!0}else-1!==g.indexOf(N)?w=!0:-1!==m.indexOf(N)&&(x=!0)}else V=R.nestedProperty(t.layout,N.replace("LAYOUT","")),E[N]=[V.get()],V.set(Array.isArray(X)?X[0]:X),b=!0}var tt=Object.keys(S);t:for(h=0;h<tt.length;h++){for(var et=tt[h],nt=et.charAt(0),it=nt+"axis",ot=0;ot<t.data.length;ot++)if(F.traceIs(t.data[ot],"cartesian")&&(t.data[ot][it]||nt)===et)continue t;c("LAYOUT"+C.Axes.id2name(et),null,0)}O.add(t,rt,[t,E,o],rt,[t,T,o]);var at=!1;C.Axes.list(t).forEach(function(t){t.autorange&&(at=!0)}),(b||M||x&&at)&&(t.calcdata=void 0);var st;M?st=[function(){var e=t.layout;return t.layout=void 0,C.plot(t,"",e)}]:b||w||x?st=[C.plot]:(F.supplyDefaults(t),st=[F.previousPromises],k&&st.push(function(){var e,r,n;for(e=0;e<t.calcdata.length;e++)r=t.calcdata[e],n=(((r[0]||{}).trace||{})._module||{}).arraysToCalcdata,n&&n(r);return F.style(t),q.draw(t),F.previousPromises(t)}),A&&st.push(function(){return t.calcdata.forEach(function(t){if((t[0].t||{}).cb){var e=t[0].trace,r=t[0].t.cb;F.traceIs(e,"contour")&&r.line({width:e.contours.showlines!==!1?e.line.width:0,dash:e.line.dash,color:"line"===e.contours.coloring?r._opts.line.color:e.line.color}),F.traceIs(e,"markerColorscale")?r.options(e.marker.colorbar)():r.options(e.colorbar)()}}),F.previousPromises(t)}));var lt=R.syncOrAsync(st,t);return lt&&lt.then||(lt=Promise.resolve()),lt.then(function(){return t.emit("plotly_restyle",R.extendDeep([],[T,o])),t})},C.relayout=function nt(t,e,r){function o(t,e){if(Array.isArray(t))return void t.forEach(function(t){o(t,e)});if(!(t in g)){var r=R.nestedProperty(v,t);t in S||(S[t]=r.get()),void 0!==e&&r.set(e)}}function a(t,e){var r=C.Axes.id2name(t[e+"ref"]||e);return(m[r]||{}).autorange}function s(t){var e=t["xaxis.range"]?t["xaxis.range"][0]:t["xaxis.range[0]"],r=t["xaxis.range"]?t["xaxis.range"][1]:t["xaxis.range[1]"],n=m.xaxis&&m.xaxis.rangeslider?m.xaxis.rangeslider:{};n.visible&&(e||r?m.xaxis.rangeslider.setRange(e,r):t["xaxis.autorange"]&&m.xaxis.rangeslider.setRange())}if(t=n(t),i(t),t.framework&&t.framework.isPolar)return Promise.resolve(t);var l,u,c,h,f,d,p,v=t.layout,m=t._fullLayout,g={},y=!1,b=!1,x=!1,_=!1,w=!1,k=!1;if("string"==typeof e)g[e]=r;else{if(!R.isPlainObject(e))return R.warn("Relayout fail.",e,r),Promise.reject();g=e}for(Object.keys(g).length&&(t.changed=!0),c=Object.keys(g),u=C.Axes.list(t),p=0;p<c.length;p++){if(0===c[p].indexOf("allaxes")){for(var A=0;A<u.length;A++)f=u[A]._id.substr(1),d=-1!==f.indexOf("scene")?f+".":"",l=c[p].replace("allaxes",d+u[A]._name),g[l]||(g[l]=g[c[p]]);delete g[c[p]]}c[p].match(/^annotations\[[0-9-]+\].ref$/)&&(h=g[c[p]].split("y"),g[c[p].replace("ref","xref")]=h[0],g[c[p].replace("ref","yref")]=2===h.length?"y"+h[1]:"paper",delete g[c[p]])}var T={},S={},z=["height","width"];for(var I in g){var P,D=R.nestedProperty(v,I),j=g[I],N=D.parts.length,B="string"==typeof D.parts[N-1]?N-1:N-2,U=D.parts[B],G=D.parts[B-1]+"."+U,H=D.parts.slice(0,B).join("."),X=R.nestedProperty(t.layout,H).get(),Y=R.nestedProperty(m,H).get();if(T[I]=j,S[I]="reverse"===U?j:D.get(),-1!==z.indexOf(I)?o("autosize",!1):"autosize"===I?o(z,void 0):G.match(/^[xyz]axis[0-9]*\.range(\[[0|1]\])?$/)?o(H+".autorange",!1):G.match(/^[xyz]axis[0-9]*\.autorange$/)?o([H+".range[0]",H+".range[1]"],void 0):G.match(/^aspectratio\.[xyz]$/)?o(D.parts[0]+".aspectmode","manual"):G.match(/^aspectmode$/)?o([H+".x",H+".y",H+".z"],void 0):"tick0"===U||"dtick"===U?o(H+".tickmode","linear"):"tickmode"===U?o([H+".tick0",H+".dtick"],void 0):/[xy]axis[0-9]*?$/.test(U)&&!Object.keys(j||{}).length?w=!0:/[xy]axis[0-9]*\.categoryorder$/.test(G)?w=!0:/[xy]axis[0-9]*\.categoryarray/.test(G)&&(w=!0),-1!==G.indexOf("rangeslider")&&(w=!0),"type"===U&&"log"===Y.type!=("log"===j)){var W=X;if(W&&W.range)if(Y.autorange)"log"===j&&(W.range=W.range[1]>W.range[0]?[1,2]:[2,1]);else{var K=W.range[0],J=W.range[1];"log"===j?(0>=K&&0>=J&&o(H+".autorange",!0),0>=K?K=J/1e6:0>=J&&(J=K/1e6),o(H+".range[0]",Math.log(K)/Math.LN10),o(H+".range[1]",Math.log(J)/Math.LN10)):(o(H+".range[0]",Math.pow(10,K)),o(H+".range[1]",Math.pow(10,J)))}else o(H+".autorange",!0)}if("reverse"===U)X.range?X.range.reverse():(o(H+".autorange",!0),X.range=[1,0]),Y.autorange?w=!0:_=!0;else if("annotations"===D.parts[0]||"shapes"===D.parts[0]){var $=D.parts[1],Q=D.parts[0],tt=v[Q]||[],et=C[R.titleCase(Q)],rt=tt[$]||{};2===D.parts.length&&("add"===g[I]||R.isPlainObject(g[I])?S[I]="remove":"remove"===g[I]?-1===$?(S[Q]=tt,delete S[I]):S[I]=rt:R.log("???",g)),!a(rt,"x")&&!a(rt,"y")||R.containsAny(I,["color","opacity","align","dash"])||(w=!0),et.draw(t,$,D.parts.slice(2).join("."),g[I]),delete g[I]}else if("images"===D.parts[0]){var it=R.objectFromPath(I,j);R.extendDeepAll(t.layout,it),V.supplyLayoutDefaults(t.layout,t._fullLayout),V.draw(t)}else if("mapbox"===D.parts[0]&&"layers"===D.parts[1]){R.extendDeepAll(t.layout,R.objectFromPath(I,j));var ot=(t._fullLayout.mapbox||{}).layers||[];for(P=D.parts[2]+1-ot.length,p=0;P>p;p++)ot.push({});_=!0}else if("updatemenus"===D.parts[0]){R.extendDeepAll(t.layout,R.objectFromPath(I,j));var at=t._fullLayout.updatemenus||[];for(P=D.parts[2]+1-at.length,p=0;P>p;p++)at.push({});_=!0}else 0===D.parts[0].indexOf("scene")?_=!0:0===D.parts[0].indexOf("geo")?_=!0:0===D.parts[0].indexOf("ternary")?_=!0:!m._has("gl2d")||-1===I.indexOf("axis")&&"plot_bgcolor"!==D.parts[0]?"hiddenlabels"===I?w=!0:-1!==D.parts[0].indexOf("legend")?y=!0:-1!==I.indexOf("title")?b=!0:-1!==D.parts[0].indexOf("bgcolor")?x=!0:D.parts.length>1&&R.containsAny(D.parts[1],["tick","exponent","grid","zeroline"])?b=!0:-1!==I.indexOf(".linewidth")&&-1!==I.indexOf("axis")?b=x=!0:D.parts.length>1&&-1!==D.parts[1].indexOf("line")?x=!0:D.parts.length>1&&"mirror"===D.parts[1]?b=x=!0:"margin.pad"===I?b=x=!0:"margin"===D.parts[0]||"autorange"===D.parts[1]||"rangemode"===D.parts[1]||"type"===D.parts[1]||"domain"===D.parts[1]||I.match(/^(bar|box|font)/)?w=!0:-1!==["hovermode","dragmode"].indexOf(I)?k=!0:-1===["hovermode","dragmode","height","width","autosize"].indexOf(I)&&(_=!0):_=!0,D.set(j)}O.add(t,nt,[t,S],nt,[t,T]),g.autosize&&(g=M(t,g)),(g.height||g.width||g.autosize)&&(w=!0);var st=Object.keys(g),lt=[F.previousPromises];if(_||w)lt.push(function(){return t.layout=void 0,w&&(t.calcdata=void 0),C.plot(t,"",v)});else if(st.length&&(F.supplyDefaults(t),m=t._fullLayout,y&&lt.push(function(){return q.draw(t),F.previousPromises(t)}),x&&lt.push(E),b&&lt.push(function(){return C.Axes.doTicks(t,"redraw"),L(t),F.previousPromises(t)}),k)){var ut;for(Z(t),C.Fx.supplyLayoutDefaults(t.layout,m,t._fullData),C.Fx.init(t),ut=F.getSubplotIds(m,"gl3d"),p=0;p<ut.length;p++)f=m[ut[p]]._scene,f.updateFx(m.dragmode,m.hovermode);for(ut=F.getSubplotIds(m,"gl2d"),p=0;p<ut.length;p++)f=m._plots[ut[p]]._scene2d,f.updateFx(m);for(ut=F.getSubplotIds(m,"geo"),p=0;p<ut.length;p++){var ct=m[ut[p]]._geo;ct.updateFx(m.hovermode)}}var ht=R.syncOrAsync(lt,t);return ht&&ht.then||(ht=Promise.resolve(t)),ht.then(function(){var e=R.extendDeep({},T);return s(e),t.emit("plotly_relayout",e),t})},C.purge=function(t){t=n(t);var e=t._fullLayout||{},r=t._fullData||[];return F.cleanPlot([],{},r,e),F.purge(t),D.purge(t),e._container&&e._container.remove(),delete t._context,delete t._replotPending,delete t._mouseDownTime,delete t._hmpixcount,delete t._hmlumcount,t}},{"../components/color":483,"../components/drawing":506,"../components/errorbars":512,"../components/images":518,"../components/legend":526,"../components/modebar/manage":530,"../components/rangeselector":537,"../components/rangeslider":542,"../components/shapes":545,"../components/titles":546,"../components/updatemenus":551,"../constants/xmlns_namespaces":556,"../lib":568,"../lib/events":562,"../lib/queue":575,"../plotly":589,"../plots/cartesian/graph_interact":599,"../plots/plots":648,d3:119,"fast-isnumeric":123,"gl-mat4/fromQuat":140}],584:[function(t,e,r){"use strict";function n(t,e){try{t._fullLayout._paper.style("background",e)}catch(r){i.error(r)}}var i=t("../lib");e.exports={staticPlot:!1,editable:!1,queueLength:0,autosizable:!1,fillFrame:!1,frameMargins:0,scrollZoom:!1,doubleClick:"reset+autosize",showTips:!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}},{"../lib":568}],585:[function(t,e,r){"use strict";function n(t){var e=g.attributes,r=u({type:t}),n=h(t),i=d(t),o={},a={};o.type=null,x(o,e),o=s(r.attributes,o,"attributes",t),void 0!==i.attributes&&x(o,i.attributes),o.type=t,o=c(o),l(o),S.traces[t]=b({},n,{attributes:o}),void 0!==r.layoutAttributes&&(a=s(r.layoutAttributes,a,"layoutAttributes",t),l(a),S.traces[t].layoutAttributes=a)}function i(){var t=g.layoutAttributes,e={};e=s(t,e,"layoutAttributes","*"),e=f(e),e=p(e),e=c(e),l(e),v(e),S.layout={layoutAttributes:e}}function o(t){var e=g.transformsRegistry[t],r={};r=s(r,e.attributes||{},"attributes","*"),r=c(r),l(r),v(r),S.transforms[t]={attributes:r}}function a(){S.defs={valObjects:y.valObjects,metaKeys:E.concat(["description","role"])}}function s(t,e,r,n){var i,o,a,l,c;return Object.keys(t).forEach(function(h){return h===w?void Object.keys(t[h]).forEach(function(l){i=u({module:t[h][l]}),void 0!==i&&(o=i[r],a=s(o,{},r,n),y.nestedProperty(e,l).set(x({},a)))}):h===M?void Object.keys(t[h]).forEach(function(i){i===n&&(l=u({module:t[h][i]}),void 0!==l&&(c=l[r],c=s(c,{},r,n),_(e,c)))}):void(e[h]=y.isPlainObject(t[h])?_({},t[h]):t[h])}),e}function l(t){function e(t){return{valType:"string"}}function r(t,r,n){I.isValObject(t)?"data_array"===t.valType?(t.role="data",n[r+"src"]=e(r)):t.arrayOk===!0&&(n[r+"src"]=e(r)):y.isPlainObject(t)&&(t.role="object")}I.crawl(t,r)}function u(t){if("type"in t)return"area"===t.type?{attributes:L}:g.getModule({type:t.type});var e=g.subplotsRegistry,r=t.module;return e[r]?e[r]:"module"in t?m[r]:void 0}function c(t){return Object.keys(t).forEach(function(e){"_"===e.charAt(0)&&-1===E.indexOf(e)&&delete t[e]}),t}function h(t){return"area"===t?{}:g.modules[t].meta||{}}function f(t){return b(t,{radialaxis:z.radialaxis,angularaxis:z.angularaxis}),b(t,z.layout),t}function d(t){if("area"===t)return{};var e=g.subplotsRegistry,r=Object.keys(e).filter(function(e){return g.traceIs({type:t},e)})[0];return void 0===r?{}:e[r]}function p(t){var e=g.subplotsRegistry;return Object.keys(t).forEach(function(r){Object.keys(e).forEach(function(n){var i,o=e[n];o.attrRegex&&(i="cartesian"===n||"gl2d"===n?o.attrRegex.x.test(r)||o.attrRegex.y.test(r):o.attrRegex.test(r),i&&(t[r][k]=!0))})}),t}function v(t){function e(t,e,r){if(t[A]===!0){var n=e.substr(0,e.length-1);delete t[A],r[e]={items:{}},r[e].items[n]=t,r[e].role="object"}}I.crawl(t,e)}var m=t("../plotly"),g=t("../plots/plots"),y=t("../lib"),b=y.extendFlat,x=y.extendDeep,_=y.extendDeepAll,w="_nestedModules",M="_composedModules",k="_isSubplotObj",A="_isLinkedToArray",T="_deprecated",E=[k,A,T],S={traces:{},layout:{},transforms:{},defs:{}},L=t("../plots/polar/area_attributes"),z=t("../plots/polar/axis_attributes"),I=e.exports={};I.get=function(){return g.allTypes.concat("area").forEach(n),i(),Object.keys(g.transformsRegistry).forEach(o),a(),S},I.crawl=function(t,e){Object.keys(t).forEach(function(r){var n=t[r];-1===E.indexOf(r)&&(e(n,r,t),I.isValObject(n)||y.isPlainObject(n)&&I.crawl(n,e))})},I.isValObject=function(t){return t&&void 0!==t.valType}},{"../lib":568,"../plotly":589,"../plots/plots":648,"../plots/polar/area_attributes":649,"../plots/polar/axis_attributes":650}],586:[function(t,e,r){"use strict";var n=t("../plotly"),i=t("../lib");e.exports=function(t){return i.extendFlat(n.defaultConfig,t)}},{"../lib":568,"../plotly":589}],587:[function(t,e,r){"use strict";function n(e,r){var n=t("../snapshot"),s=new Promise(function(t,s){function l(){var t=n.getDelay(h._fullLayout);return new Promise(function(e,i){setTimeout(function(){var t=n.toSVG(h),o=document.createElement("canvas");o.id=a.randstr(),n.svgToImg({format:r.format,width:h._fullLayout.width,height:h._fullLayout.height,canvas:o,svg:t,promise:!0}).then(function(t){h&&document.body.removeChild(h),e(t)}).catch(function(t){i(t)})},t)})}r=r||{},r.format=r.format||"png";var u=function(t){return void 0===t||null===t?!0:!!(i(t)&&t>1)};u(r.width)&&u(r.height)||s(new Error("Height and width should be pixel values."));var c=n.clone(e,{format:"png",height:r.height,width:r.width}),h=c.td;h.style.position="absolute",h.style.left="-5000px",document.body.appendChild(h);var f=n.getRedrawFunc(h);o.plot(h,c.data,c.layout,c.config).then(f).then(l).then(function(e){t(e)}).catch(function(t){s(t)})});return s}var i=t("fast-isnumeric"),o=t("../plotly"),a=t("../lib");e.exports=n},{"../lib":568,"../plotly":589,"../snapshot":665,"fast-isnumeric":123}],588:[function(t,e,r){"use strict";function n(t,e,r,i,o,u){u=u||[];for(var c=Object.keys(t),f=0;f<c.length;f++){var d=c[f];if("transforms"!==d){var m=u.slice();m.push(d);var g=t[d],y=e[d],b=l(r,d),x="info_array"===(b||{}).valType;if(s(r,d))if(p(g)&&p(y))n(g,y,b,i,o,m);else if(b.items&&!x&&v(g)){var _,w,M=d.substr(0,d.length-1),k=[];for(_=0;_<y.length;_++){var A=b.items[M],T=y[_]._index||_;w=m.slice(),w.push(T),p(g[T])&&p(y[_])&&(k.push(T),n(g[T],y[_],A,i,o,w))}for(_=0;_<g.length;_++)w=m.slice(),w.push(_),p(g[_])?-1===k.indexOf(_)&&i.push(a("unused",o,w)):i.push(a("object",o,w,g[_]))}else!p(g)&&p(y)?i.push(a("object",o,m,g)):v(g)||!v(y)||x?d in e?h.validate(g,b)||i.push(a("value",o,m,g)):i.push(a("unused",o,m,g)):i.push(a("array",o,m,g));else i.push(a("schema",o,m))}}return i}function i(t,e){for(var r=0;r<e.length;r++){var n=e[r].type,i=t.traces[n].layoutAttributes;i&&h.extendFlat(t.layout.layoutAttributes,i)}return t.layout.layoutAttributes}function o(t){return v(t)?"In data trace "+t[1]+", ":"In "+t+", "}function a(t,e,r,n){r=r||"";var i,o;v(e)?(i=e[0],o=e[1]):(i=e,o=null);var a=c(r),s=m[t](e,a,n);return h.log(s),{code:t,container:i,trace:o,path:r,astr:a,msg:s}}function s(t,e){var r=u(e),n=r.keyMinusId,i=r.id;return n in t&&t[n]._isSubplotObj&&i?!0:e in t}function l(t,e){var r=u(e);return t[r.keyMinusId]}function u(t){var e=/([2-9]|[1-9][0-9]+)$/,r=t.split(e)[0],n=t.substr(r.length,t.length);return{keyMinusId:r,id:n}}function c(t){if(!v(t))return String(t);for(var e="",r=0;r<t.length;r++){var n=t[r];"number"==typeof n?e=e.substr(0,e.length-1)+"["+n+"]":e+=n,r<t.length-1&&(e+=".")}return e}var h=t("../lib"),f=t("../plots/plots"),d=t("./plot_schema"),p=h.isPlainObject,v=Array.isArray;e.exports=function(t,e){var r,o,s=d.get(),l=[],u={};v(t)?(u.data=h.extendDeep([],t),r=t):(u.data=[],r=[],l.push(a("array","data"))),p(e)?(u.layout=h.extendDeep({},e),o=e):(u.layout={},o={},arguments.length>1&&l.push(a("object","layout"))),f.supplyDefaults(u);for(var c=u._fullData,m=r.length,g=0;m>g;g++){var y=r[g],b=["data",g];if(p(y)){var x=c[g],_=x.type,w=s.traces[_].attributes;w.type={valType:"enumerated",values:[_]},x.visible===!1&&y.visible!==!1&&l.push(a("invisible",b)),n(y,x,w,l,b);var M=y.transforms,k=x.transforms;if(M){v(M)||l.push(a("array",b,["transforms"])),b.push("transforms");for(var A=0;A<M.length;A++){var T=["transforms",A],E=M[A].type;if(p(M[A])){var S=s.transforms[E]?s.transforms[E].attributes:{};S.type={valType:"enumerated",values:Object.keys(s.transforms)},n(M[A],k[A],S,l,b,T)}else l.push(a("object",b,T))}}}else l.push(a("object",b))}var L=u._fullLayout,z=i(s,c);return n(o,L,z,l,"layout"),0===l.length?void 0:l};var m={object:function(t,e){var r;return r="layout"===t&&""===e?"The layout argument":"data"===t[0]&&""===e?"Trace "+t[1]+" in the data argument":o(t)+"key "+e,r+" must be linked to an object container"},array:function(t,e){var r;return r="data"===t?"The data argument":o(t)+"key "+e,r+" must be linked to an array container"},schema:function(t,e){return o(t)+"key "+e+" is not part of the schema"},unused:function(t,e,r){var n=p(r)?"container":"key";return o(t)+n+" "+e+" did not get coerced"},invisible:function(t){return"Trace "+t[1]+" got defaulted to be not visible"},value:function(t,e,r){return[o(t)+"key "+e,"is set to an invalid value ("+r+")"].join(" ")}}},{"../lib":568,"../plots/plots":648,"./plot_schema":585}],589:[function(t,e,r){"use strict";t("es6-promise").polyfill();var n=r.Lib=t("./lib");r.util=t("./lib/svg_text_utils"),r.Queue=t("./lib/queue"),t("../build/plotcss"),r.MathJaxConfig=t("./fonts/mathjax_config"),r.defaultConfig=t("./plot_api/plot_config");var i=r.Plots=t("./plots/plots");r.Axes=t("./plots/cartesian/axes"),r.Fx=t("./plots/cartesian/graph_interact"),r.micropolar=t("./plots/polar/micropolar"),r.Color=t("./components/color"),r.Drawing=t("./components/drawing"),r.Colorscale=t("./components/colorscale"),r.Colorbar=t("./components/colorbar"),r.ErrorBars=t("./components/errorbars"),r.Annotations=t("./components/annotations"),r.Shapes=t("./components/shapes"),r.Legend=t("./components/legend"),r.Images=t("./components/images"),r.UpdateMenus=t("./components/updatemenus"),r.ModeBar=t("./components/modebar"),r.register=function(t){if(!t)throw new Error("No argument passed to Plotly.register.");t&&!Array.isArray(t)&&(t=[t]);for(var e=0;e<t.length;e++){var r=t[e];if(!r)throw new Error("Invalid module was attempted to be registered!");switch(r.moduleType){case"trace":i.register(r,r.name,r.categories,r.meta),i.subplotsRegistry[r.basePlotModule.name]||i.registerSubplot(r.basePlotModule);break;case"transform":if("string"!=typeof r.name)throw new Error("Transform module *name* must be a string.");var o="Transform module "+r.name;if("function"!=typeof r.transform)throw new Error(o+" is missing a *transform* function.");n.isPlainObject(r.attributes)||n.log(o+" registered without an *attributes* object."),"function"!=typeof r.supplyDefaults&&n.log(o+" registered without a *supplyDefaults* function."),i.transformsRegistry[r.name]=r;break;default:throw new Error("Invalid module was attempted to be registered!")}}},r.register(t("./traces/scatter")),t("./plot_api/plot_api"),r.PlotSchema=t("./plot_api/plot_schema"),r.Snapshot=t("./snapshot")},{"../build/plotcss":1,"./components/annotations":481,"./components/color":483,"./components/colorbar":488,"./components/colorscale":497,"./components/drawing":506,"./components/errorbars":512,"./components/images":518,"./components/legend":526,"./components/modebar":529,"./components/shapes":545,"./components/updatemenus":551,"./fonts/mathjax_config":558,"./lib":568,"./lib/queue":575,"./lib/svg_text_utils":581,"./plot_api/plot_api":583,"./plot_api/plot_config":584,"./plot_api/plot_schema":585,"./plots/cartesian/axes":592,"./plots/cartesian/graph_interact":599,"./plots/plots":648,"./plots/polar/micropolar":651,"./snapshot":665,"./traces/scatter":760,"es6-promise":122}],590:[function(t,e,r){"use strict";e.exports={type:{valType:"enumerated",values:[],dflt:"scatter"},visible:{valType:"enumerated",values:[!0,!1,"legendonly"],dflt:!0},showlegend:{valType:"boolean",dflt:!0},legendgroup:{valType:"string",dflt:""},opacity:{valType:"number",min:0,max:1,dflt:1},name:{valType:"string"},uid:{valType:"string",dflt:""},hoverinfo:{valType:"flaglist",flags:["x","y","z","text","name"],extras:["all","none"],dflt:"all"},stream:{token:{valType:"string",noBlank:!0,strict:!0},maxpoints:{valType:"number",min:0}}}},{}],591:[function(t,e,r){"use strict";e.exports={xaxis:{valType:"subplotid",dflt:"x"},yaxis:{valType:"subplotid",dflt:"y"}}},{}],592:[function(t,e,r){"use strict";function n(t){var e,r,n=t.tickvals,i=t.ticktext,o=new Array(n.length),a=1.0001*t.range[0]-1e-4*t.range[1],l=1.0001*t.range[1]-1e-4*t.range[0],u=Math.min(a,l),c=Math.max(a,l),h=0;for(Array.isArray(i)||(i=[]),r=0;r<n.length;r++)e=t.d2l(n[r]),e>u&&c>e&&(void 0===i[r]?o[h]=T.tickText(t,e):o[h]=s(t,e,String(i[r])),h++);return h<n.length&&o.splice(h,n.length-h),o}function i(t,e,r){return e*_.roundUp(t/e,r)}function o(t){var e,r=t.dtick;if(t._tickexponent=0,b(r)||"string"==typeof r||(r=1),"category"===t.type)t._tickround=null;else if(b(r)||"L"===r.charAt(0))if("date"===t.type)r>=864e5?t._tickround="d":r>=36e5?t._tickround="H":r>=6e4?t._tickround="M":r>=1e3?t._tickround="S":t._tickround=3-Math.round(Math.log(r/2)/Math.LN10);else{b(r)||(r=Number(r.substr(1))),t._tickround=2-Math.floor(Math.log(r)/Math.LN10+.01),e="log"===t.type?Math.pow(10,Math.max(t.range[0],t.range[1])):Math.max(Math.abs(t.range[0]),Math.abs(t.range[1]));var n=Math.floor(Math.log(e)/Math.LN10+.01);Math.abs(n)>3&&("SI"===t.exponentformat||"B"===t.exponentformat?t._tickexponent=3*Math.round((n-1)/3):t._tickexponent=n)}else"M"===r.charAt(0)?t._tickround=2===r.length?"m":"y":t._tickround=null}function a(t,e){var r=t.match(U),n=new Date(e);if(r){var i=Math.min(+r[1]||6,6),o=String(e/1e3%1+2.0000005).substr(2,i).replace(/0+$/,"")||"0";return y.time.format(t.replace(U,o))(n)}return y.time.format(t)(n)}function s(t,e,r){var n=t.tickfont||t._gd._fullLayout.font;return{x:e,dx:0,dy:0,text:r||"",fontSize:n.size,font:n.family,fontColor:n.color}}function l(t,e,r,n){var i,o=e.x,s=t._tickround,l=new Date(o),u="";r&&t.hoverformat?i=a(t.hoverformat,o):t.tickformat?i=a(t.tickformat,o):(n&&(b(s)?s+=2:s={y:"m",m:"d",d:"H",H:"M",M:"S",S:2}[s]),"y"===s?i=D(l):"m"===s?i=O(l):(o!==t._tmin||r||(u="<br>"+D(l)),"d"===s?i=F(l):"H"===s?i=j(l):(o!==t._tmin||r||(u="<br>"+F(l)+", "+D(l)),i=N(l),"M"!==s&&(i+=B(l),"S"!==s&&(i+=f(g(o/1e3,1),t,"none",r).substr(1)))))),e.text=i+u}function u(t,e,r,n,i){var o=t.dtick,a=e.x;if(!n||"string"==typeof o&&"L"===o.charAt(0)||(o="L3"),t.tickformat||"string"==typeof o&&"L"===o.charAt(0))e.text=f(Math.pow(10,a),t,i,n);else if(b(o)||"D"===o.charAt(0)&&g(a+.01,1)<.1)if(-1!==["e","E","power"].indexOf(t.exponentformat)){var s=Math.round(a);0===s?e.text=1:1===s?e.text="10":s>1?e.text="10<sup>"+s+"</sup>":e.text="10<sup>\u2212"+-s+"</sup>",e.fontSize*=1.25}else e.text=f(Math.pow(10,a),t,"","fakehover"),"D1"===o&&"y"===t._id.charAt(0)&&(e.dy-=e.fontSize/6);else{if("D"!==o.charAt(0))throw"unrecognized dtick "+String(o);e.text=String(Math.round(Math.pow(10,g(a,1)))),e.fontSize*=.75}if("D1"===t.dtick){var l=String(e.text).charAt(0);"0"!==l&&"1"!==l||("y"===t._id.charAt(0)?e.dx-=e.fontSize/4:(e.dy+=e.fontSize/2,e.dx+=(t.range[1]>t.range[0]?1:-1)*e.fontSize*(0>a?.5:.25)))}}function c(t,e){var r=t._categories[Math.round(e.x)];void 0===r&&(r=""),e.text=String(r)}function h(t,e,r,n,i){"all"===t.showexponent&&Math.abs(e.x/t.dtick)<1e-6&&(i="hide"),e.text=f(e.x,t,i,n)}function f(t,e,r,n){var i=0>t,a=e._tickround,s=r||e.exponentformat||"B",l=e._tickexponent,u=e.tickformat;if(n){var c={exponentformat:e.exponentformat,dtick:"none"===e.showexponent?e.dtick:b(t)?Math.abs(t)||1:1,range:"none"===e.showexponent?e.range:[0,t||1]};o(c),a=(Number(c._tickround)||0)+4,l=c._tickexponent,e.hoverformat&&(u=e.hoverformat)}if(u)return y.format(u)(t).replace(/-/g,"\u2212");var h=Math.pow(10,-a)/2;if("none"===s&&(l=0),t=Math.abs(t),h>t)t="0",i=!1;else{if(t+=h,l&&(t*=Math.pow(10,-l),a+=l),0===a)t=String(Math.floor(t));else if(0>a){t=String(Math.round(t)),t=t.substr(0,t.length+a);for(var f=a;0>f;f++)t+="0"}else{t=String(t);var d=t.indexOf(".")+1;d&&(t=t.substr(0,d+a).replace(/\.?0+$/,""))}t=_.numSeparate(t,e._gd._fullLayout.separators)}if(l&&"hide"!==s){var p;p=0>l?"\u2212"+-l:"power"!==s?"+"+l:String(l),"e"===s||("SI"===s||"B"===s)&&(l>12||-15>l)?t+="e"+p:"E"===s?t+="E"+p:"power"===s?t+="\xd710<sup>"+p+"</sup>":"B"===s&&9===l?t+="B":"SI"!==s&&"B"!==s||(t+=V[l/3+5])}return i?"\u2212"+t:t}function d(t,e){var r,n,i=[];for(r=0;r<e.length;r++){var o=[],a=t._fullData[e[r]].xaxis,s=t._fullData[e[r]].yaxis;if(a&&s){for(n=0;n<i.length;n++)-1===i[n].x.indexOf(a)&&-1===i[n].y.indexOf(s)||o.push(n);if(o.length){var l,u=i[o[0]];if(o.length>1)for(n=1;n<o.length;n++)l=i[o[n]],p(u.x,l.x),p(u.y,l.y);p(u.x,[a]),p(u.y,[s])}else i.push({x:[a],y:[s]})}}return i}function p(t,e){for(var r=0;r<e.length;r++)-1===t.indexOf(e[r])&&t.push(e[r])}function v(t,e,r){var n,i,o=[],a=[],s=t.layout;for(n=0;n<e.length;n++)o.push(T.getFromId(t,e[n]));for(n=0;n<r.length;n++)a.push(T.getFromId(t,r[n]));var l=Object.keys(o[0]),u=["anchor","domain","overlaying","position","side","tickangle"],c=["linear","log"];for(n=0;n<l.length;n++){var h=l[n],f=o[0][h],d=a[0][h],p=!0,v=!1,g=!1;if("_"!==h.charAt(0)&&"function"!=typeof f&&-1===u.indexOf(h)){for(i=1;i<o.length&&p;i++){var y=o[i][h];"type"===h&&-1!==c.indexOf(f)&&-1!==c.indexOf(y)&&f!==y?v=!0:y!==f&&(p=!1)}for(i=1;i<a.length&&p;i++){var b=a[i][h];"type"===h&&-1!==c.indexOf(d)&&-1!==c.indexOf(b)&&d!==b?g=!0:a[i][h]!==d&&(p=!1)}p&&(v&&(s[o[0]._name].type="linear"),g&&(s[a[0]._name].type="linear"),m(s,h,o,a))}}for(n=0;n<t._fullLayout.annotations.length;n++){var x=t._fullLayout.annotations[n];-1!==e.indexOf(x.xref)&&-1!==r.indexOf(x.yref)&&_.swapAttrs(s.annotations[n],["?"])}}function m(t,e,r,n){var i,o=_.nestedProperty,a=o(t[r[0]._name],e).get(),s=o(t[n[0]._name],e).get();for("title"===e&&("Click to enter X axis title"===a&&(a="Click to enter Y axis title"),"Click to enter Y axis title"===s&&(s="Click to enter X axis title")),i=0;i<r.length;i++)o(t,r[i]._name+"."+e).set(s);for(i=0;i<n.length;i++)o(t,n[i]._name+"."+e).set(a)}function g(t,e){return(t%e+e)%e}var y=t("d3"),b=t("fast-isnumeric"),x=t("../../plotly"),_=t("../../lib"),w=t("../../lib/svg_text_utils"),M=t("../../components/titles"),k=t("../../components/color"),A=t("../../components/drawing"),T=e.exports={};T.layoutAttributes=t("./layout_attributes"),T.supplyLayoutDefaults=t("./layout_defaults"),T.setConvert=t("./set_convert");var E=t("./axis_ids");T.id2name=E.id2name,T.cleanId=E.cleanId,T.list=E.list,T.listIds=E.listIds,T.getFromId=E.getFromId,T.getFromTrace=E.getFromTrace,T.coerceRef=function(t,e,r,n,i){var o=r._fullLayout._has("gl2d")?[]:T.listIds(r,n),a=n+"ref",s={};return s[a]={valType:"enumerated",values:o.concat(["paper"]),dflt:i||o[0]||"paper"},_.coerce(t,e,s,a)},T.coerceARef=function(t,e,r,n,i){var o=r._fullLayout._has("gl2d")?[]:T.listIds(r,n),a="a"+n+"ref",s={};return s[a]={valType:"enumerated",values:o.concat(["pixel"]),dflt:i||"pixel"||o[0]},_.coerce(t,e,s,a)},T.clearTypes=function(t,e){Array.isArray(e)&&e.length||(e=t._fullData.map(function(t,e){return e})),e.forEach(function(e){var r=t.data[e];delete(T.getFromId(t,r.xaxis)||{}).type,delete(T.getFromId(t,r.yaxis)||{}).type})},T.counterLetter=function(t){var e=t.charAt(0);return"x"===e?"y":"y"===e?"x":void 0},T.minDtick=function(t,e,r,n){-1===["log","category"].indexOf(t.type)&&n?null===t._minDtick?(t._minDtick=e,t._forceTick0=r):t._minDtick&&((t._minDtick/e+1e-6)%1<2e-6&&((r-t._forceTick0)/e%1+1.000001)%1<2e-6?(t._minDtick=e,t._forceTick0=r):((e/t._minDtick+1e-6)%1>2e-6||((r-t._forceTick0)/t._minDtick%1+1.000001)%1>2e-6)&&(t._minDtick=0)):t._minDtick=0},T.getAutoRange=function(t){var e,r=[],n=t._min[0].val,i=t._max[0].val;for(e=1;e<t._min.length&&n===i;e++)n=Math.min(n,t._min[e].val);for(e=1;e<t._max.length&&n===i;e++)i=Math.max(i,t._max[e].val);var o,a,s,l,u,c,h,f=0,d=t.range&&t.range[1]<t.range[0];for("reversed"===t.autorange&&(d=!0,t.autorange=!0),e=0;e<t._min.length;e++)for(a=t._min[e],o=0;o<t._max.length;o++)s=t._max[o],h=s.val-a.val,c=t._length-a.pad-s.pad,h>0&&c>0&&h/c>f&&(l=a,u=s,f=h/c);if(n===i){var p=n-1,v=n+1;r="tozero"===t.rangemode?0>n?[p,0]:[0,v]:"nonnegative"===t.rangemode?[Math.max(0,p),Math.max(0,v)]:[p,v]}else f&&("linear"!==t.type&&"-"!==t.type||("tozero"===t.rangemode?(l.val>=0&&(l={val:0,pad:0}),u.val<=0&&(u={val:0,pad:0})):"nonnegative"===t.rangemode&&(l.val-f*l.pad<0&&(l={val:0,pad:0}),u.val<0&&(u={val:1,pad:0})),f=(u.val-l.val)/(t._length-l.pad-u.pad)),r=[l.val-f*l.pad,u.val+f*u.pad]);return r[0]===r[1]&&("tozero"===t.rangemode?r=r[0]<0?[r[0],0]:r[0]>0?[0,r[0]]:[0,1]:(r=[r[0]-1,r[0]+1],"nonnegative"===t.rangemode&&(r[0]=Math.max(0,r[0])))),d&&r.reverse(),r},T.doAutoRange=function(t){t._length||t.setScale();var e=t._min&&t._max&&t._min.length&&t._max.length;if(t.autorange&&e){t.range=T.getAutoRange(t);var r=t._gd.layout[t._name];r||(t._gd.layout[t._name]=r={}),r!==t&&(r.range=t.range.slice(),r.autorange=t.autorange)}},T.saveRangeInitial=function(t,e){for(var r=T.list(t,"",!0),n=!1,i=0;i<r.length;i++){var o=r[i],a=void 0===o._rangeInitial,s=a||!(o.range[0]===o._rangeInitial[0]&&o.range[1]===o._rangeInitial[1]);(a&&o.autorange===!1||e&&s)&&(o._rangeInitial=o.range.slice(),n=!0)}return n};var S=Number.MAX_VALUE/2;T.expand=function(t,e,r){function n(t){if(Array.isArray(t))return function(e){return Math.max(Number(t[e]||0),0)};var e=Math.max(Number(t||0),0);return function(){return e}}function i(r){function n(t){return b(t)&&Math.abs(t)<S}if(l=e[r],b(l)){if(h=x(r)+g,f=_(r)+g,p=l-M(r),v=l+w(r),"log"===t.type&&v/10>p&&(p=v/10),u=t.c2l(p),c=t.c2l(v),y&&(u=Math.min(0,u),c=Math.max(0,c)),n(u)){for(d=!0,a=0;a<t._min.length&&d;a++)s=t._min[a],
s.val<=u&&s.pad>=f?d=!1:s.val>=u&&s.pad<=f&&(t._min.splice(a,1),a--);d&&t._min.push({val:u,pad:y&&0===u?0:f})}if(n(c)){for(d=!0,a=0;a<t._max.length&&d;a++)s=t._max[a],s.val>=c&&s.pad>=h?d=!1:s.val<=c&&s.pad<=h&&(t._max.splice(a,1),a--);d&&t._max.push({val:c,pad:y&&0===c?0:h})}}}if((t.autorange||t._needsExpand)&&e){t._min||(t._min=[]),t._max||(t._max=[]),r||(r={}),t._m||t.setScale();var o,a,s,l,u,c,h,f,d,p,v,m=e.length,g=r.padded?.05*t._length:0,y=r.tozero&&("linear"===t.type||"-"===t.type),x=n((t._m>0?r.ppadplus:r.ppadminus)||r.ppad||0),_=n((t._m>0?r.ppadminus:r.ppadplus)||r.ppad||0),w=n(r.vpadplus||r.vpad),M=n(r.vpadminus||r.vpad);for(o=0;6>o;o++)i(o);for(o=m-1;o>5;o--)i(o)}},T.autoBin=function(t,e,r,n){function i(t){return(1+100*(t-d)/h.dtick)%100<2}var o=_.aggNums(Math.min,null,t),a=_.aggNums(Math.max,null,t);if("category"===e.type)return{start:o-.5,end:a+.5,size:1};var s;if(r)s=(a-o)/r;else{var l=_.distinctVals(t),u=Math.pow(10,Math.floor(Math.log(l.minDiff)/Math.LN10)),c=u*_.roundUp(l.minDiff/u,[.9,1.9,4.9,9.9],!0);s=Math.max(c,2*_.stdev(t)/Math.pow(t.length,n?.25:.4))}var h={type:"log"===e.type?"linear":e.type,range:[o,a]};T.autoTicks(h,s);var f,d=T.tickIncrement(T.tickFirst(h),h.dtick,"reverse");if("number"==typeof h.dtick){for(var p=0,v=0,m=0,g=0,y=0;y<t.length;y++)t[y]%1===0?m++:b(t[y])||g++,i(t[y])&&p++,i(t[y]+h.dtick/2)&&v++;var x=t.length-g;if(m===x&&"date"!==e.type)h.dtick<1?d=o-.5*h.dtick:d-=.5;else if(.1*x>v&&(p>.3*x||i(o)||i(a))){var w=h.dtick/2;d+=o>d+w?w:-w}var M=1+Math.floor((a-d)/h.dtick);f=d+M*h.dtick}else for(f=d;a>=f;)f=T.tickIncrement(f,h.dtick);return{start:d,end:f,size:h.dtick}},T.calcTicks=function(t){if("array"===t.tickmode)return n(t);if("auto"===t.tickmode||!t.dtick){var e,r=t.nticks;r||("category"===t.type?(e=t.tickfont?1.2*(t.tickfont.size||12):15,r=t._length/e):(e="y"===t._id.charAt(0)?40:80,r=_.constrain(t._length/e,4,9)+1)),T.autoTicks(t,Math.abs(t.range[1]-t.range[0])/r),t._minDtick>0&&t.dtick<2*t._minDtick&&(t.dtick=t._minDtick,t.tick0=t._forceTick0)}t.tick0||(t.tick0="date"===t.type?new Date(2e3,0,1).getTime():0),o(t),t._tmin=T.tickFirst(t);var i=t.range[1]<t.range[0],a=[],s=1.0001*t.range[1]-1e-4*t.range[0];"category"===t.type&&(s=i?Math.max(-.5,s):Math.min(t._categories.length-.5,s));for(var l=t._tmin;(i?l>=s:s>=l)&&(a.push(l),!(a.length>1e3));l=T.tickIncrement(l,t.dtick,i));t._tmax=a[a.length-1];for(var u=new Array(a.length),c=0;c<a.length;c++)u[c]=T.tickText(t,a[c]);return u};var L=[2,5,10],z=[1,2,3,6,12],I=[1,2,5,10,15,30],P=[1,2,3,7,14],C=[-.046,0,.301,.477,.602,.699,.778,.845,.903,.954,1],R=[-.301,0,.301,.699,1];T.autoTicks=function(t,e){var r;if("date"===t.type)t.tick0=new Date(2e3,0,1).getTime(),e>157788e5?(e/=315576e5,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="M"+12*i(e,r,L)):e>12096e5?(e/=26298e5,t.dtick="M"+i(e,1,z)):e>432e5?(t.dtick=i(e,864e5,P),t.tick0=new Date(2e3,0,2).getTime()):e>18e5?t.dtick=i(e,36e5,z):e>3e4?t.dtick=i(e,6e4,I):e>500?t.dtick=i(e,1e3,I):(r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=i(e,r,L));else if("log"===t.type)if(t.tick0=0,e>.7)t.dtick=Math.ceil(e);else if(Math.abs(t.range[1]-t.range[0])<1){var n=1.5*Math.abs((t.range[1]-t.range[0])/e);e=Math.abs(Math.pow(10,t.range[1])-Math.pow(10,t.range[0]))/n,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="L"+i(e,r,L)}else t.dtick=e>.3?"D2":"D1";else"category"===t.type?(t.tick0=0,t.dtick=Math.ceil(Math.max(e,1))):(t.tick0=0,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=i(e,r,L));if(0===t.dtick&&(t.dtick=1),!b(t.dtick)&&"string"!=typeof t.dtick){var o=t.dtick;throw t.dtick=1,"ax.dtick error: "+String(o)}},T.tickIncrement=function(t,e,r){var n=r?-1:1;if(b(e))return t+n*e;var i=e.charAt(0),o=n*Number(e.substr(1));if("M"===i){var a=new Date(t);return a.setMonth(a.getMonth()+o)}if("L"===i)return Math.log(Math.pow(10,t)+o)/Math.LN10;if("D"===i){var s="D2"===e?R:C,l=t+.01*n,u=_.roundUp(g(l,1),s,r);return Math.floor(l)+Math.log(y.round(Math.pow(10,u),1))/Math.LN10}throw"unrecognized dtick "+String(e)},T.tickFirst=function(t){var e=t.range[1]<t.range[0],r=e?Math.floor:Math.ceil,n=1.0001*t.range[0]-1e-4*t.range[1],i=t.dtick,o=t.tick0;if(b(i)){var a=r((n-o)/i)*i+o;return"category"===t.type&&(a=_.constrain(a,0,t._categories.length-1)),a}var s,l,u,c=i.charAt(0),h=Number(i.substr(1));if("M"===c){for(s=new Date(o),n=new Date(n),l=12*(n.getFullYear()-s.getFullYear())+n.getMonth()-s.getMonth(),u=s.setMonth(s.getMonth()+(Math.round(l/h)+(e?1:-1))*h);e?u>n:n>u;)u=T.tickIncrement(u,i,e);return u}if("L"===c)return Math.log(r((Math.pow(10,n)-o)/h)*h+o)/Math.LN10;if("D"===c){var f="D2"===i?R:C,d=_.roundUp(g(n,1),f,e);return Math.floor(n)+Math.log(y.round(Math.pow(10,d),1))/Math.LN10}throw"unrecognized dtick "+String(i)};var D=y.time.format("%Y"),O=y.time.format("%b %Y"),F=y.time.format("%b %-d"),j=y.time.format("%b %-d %Hh"),N=y.time.format("%H:%M"),B=y.time.format(":%S"),U=/%(\d?)f/g;T.tickText=function(t,e,r){function n(n){var i;return void 0===n?!0:r?"none"===n:(i={first:t._tmin,last:t._tmax}[n],"all"!==n&&e!==i)}var i,o,a=s(t,e),f="array"===t.tickmode,d=r||f;if(f&&Array.isArray(t.ticktext)){var p=Math.abs(t.range[1]-t.range[0])/1e4;for(o=0;o<t.ticktext.length&&!(Math.abs(e-t.d2l(t.tickvals[o]))<p);o++);if(o<t.ticktext.length)return a.text=String(t.ticktext[o]),a}return i="none"!==t.exponentformat&&n(t.showexponent)?"hide":"","date"===t.type?l(t,a,r,d):"log"===t.type?u(t,a,r,d,i):"category"===t.type?c(t,a):h(t,a,r,d,i),t.tickprefix&&!n(t.showtickprefix)&&(a.text=t.tickprefix+a.text),t.ticksuffix&&!n(t.showticksuffix)&&(a.text+=t.ticksuffix),a};var V=["f","p","n","\u03bc","m","","k","M","G","T"];T.subplotMatch=/^x([0-9]*)y([0-9]*)$/,T.getSubplots=function(t,e){function r(t,e){return-1!==t.indexOf(e._id)}var n,i,o,a=[],s=t.data||[];for(n=0;n<s.length;n++){var l=s[n];if(l.visible!==!1&&"legendonly"!==l.visible&&(x.Plots.traceIs(l,"cartesian")||x.Plots.traceIs(l,"gl2d"))){var u=l.xaxis||"x",c=l.yaxis||"y";o=u+c,-1===a.indexOf(o)&&a.push(o)}}var h=T.list(t,"",!0);for(n=0;n<h.length;n++){var f=h[n],d=f._id.charAt(0),p="free"===f.anchor?"x"===d?"y":"x":f.anchor,v=T.getFromId(t,p),m=!1;for(i=0;i<a.length;i++)if(r(a[i],f)){m=!0;break}"free"===f.anchor&&m||v&&(o="x"===d?f._id+v._id:v._id+f._id,-1===a.indexOf(o)&&a.push(o))}var g=T.subplotMatch,y=[];for(n=0;n<a.length;n++)o=a[n],g.test(o)&&y.push(o);return y.sort(function(t,e){var r=t.match(g),n=e.match(g);return r[1]===n[1]?+(r[2]||1)-(n[2]||1):+(r[1]||0)-(n[1]||0)}),e?T.findSubplotsWithAxis(y,e):y},T.findSubplotsWithAxis=function(t,e){for(var r=new RegExp("x"===e._id.charAt(0)?"^"+e._id+"y":e._id+"$"),n=[],i=0;i<t.length;i++){var o=t[i];r.test(o)&&n.push(o)}return n},T.makeClipPaths=function(t){var e,r,n=t._fullLayout,i=n._defs,o={_offset:0,_length:n.width,_id:""},a={_offset:0,_length:n.height,_id:""},s=T.list(t,"x",!0),l=T.list(t,"y",!0),u=[];for(e=0;e<s.length;e++)for(u.push({x:s[e],y:a}),r=0;r<l.length;r++)0===e&&u.push({x:o,y:l[r]}),u.push({x:s[e],y:l[r]});var c=i.selectAll("g.clips").data([0]);c.enter().append("g").classed("clips",!0);var h=c.selectAll(".axesclip").data(u,function(t){return t.x._id+t.y._id});h.enter().append("clipPath").classed("axesclip",!0).attr("id",function(t){return"clip"+n._uid+t.x._id+t.y._id}).append("rect"),h.exit().remove(),h.each(function(t){y.select(this).select("rect").attr({x:t.x._offset||0,y:t.y._offset||0,width:t.x._length||1,height:t.y._length||1})})},T.doTicks=function(t,e,r){function n(t){var e=u.l2p(t.x);return e>1&&e<u._length-1}function i(t,e){var r=t.selectAll("path."+z).data("inside"===u.ticks?V:S,L);e&&u.ticks?(r.enter().append("path").classed(z,1).classed("ticks",1).classed("crisp",1).call(k.stroke,u.tickcolor).style("stroke-width",j+"px").attr("d",e),r.attr("transform",d),r.exit().remove()):r.remove()}function o(r,n){function i(t,e){t.each(function(t){var r=p(e),n=y.select(this),i=n.select(".text-math-group"),o=d(t)+(b(e)&&0!==+e?" rotate("+e+","+h(t)+","+(f(t)-t.fontSize/2)+")":"");if(i.empty()){var a=n.select("text").attr({transform:o,"text-anchor":r});a.empty()||a.selectAll("tspan.line").attr({x:a.attr("x"),y:a.attr("y")})}else{var s=A.bBox(i.node()).width*{end:-.5,start:.5}[r];i.attr("transform",o+(s?"translate("+s+",0)":""))}})}function o(){return T.length&&Promise.all(T)}function s(){if(i(c,u.tickangle),"x"===m&&!b(u.tickangle)&&("log"!==u.type||"D"!==String(u.dtick).charAt(0))){var t=[];for(c.each(function(e){var r=y.select(this),n=r.select(".text-math-group"),i=u.l2p(e.x);n.empty()&&(n=r.select("text"));var o=A.bBox(n.node());t.push({top:0,bottom:10,height:10,left:i-o.width/2,right:i+o.width/2+2,width:o.width+2})}),v=0;v<t.length-1;v++)if(_.bBoxIntersect(t[v],t[v+1])){k=30;break}if(k){var r=Math.abs((S[S.length-1].x-S[0].x)*u._m)/(S.length-1);2.5*M>r&&(k=90),i(c,k)}u._lastangle=k}return a(e),e+" done"}function l(){u._boundingBox=r.node().getBoundingClientRect()}var c=r.selectAll("g."+z).data(S,L);if(!u.showticklabels||!b(n))return c.remove(),void a(e);var h,f,p,g,x;"x"===m?(x="bottom"===B?1:-1,h=function(t){return t.dx+D*x},g=n+(R+C)*x,f=function(t){return t.dy+g+t.fontSize*("bottom"===B?1:-.5)},p=function(t){return b(t)&&0!==t&&180!==t?0>t*x?"end":"start":"middle"}):(x="right"===B?1:-1,f=function(t){return t.dy+t.fontSize/2-D*x},h=function(t){return t.dx+n+(R+C+(90===Math.abs(u.tickangle)?t.fontSize/2:0))*x},p=function(t){return b(t)&&90===Math.abs(t)?"middle":"right"===B?"start":"end"});var M=0,k=0,T=[];c.enter().append("g").classed(z,1).append("text").attr("text-anchor","middle").each(function(e){var r=y.select(this),n=t._promises.length;r.call(A.setPosition,h(e),f(e)).call(A.font,e.font,e.fontSize,e.fontColor).text(e.text).call(w.convertToTspans),n=t._promises[n],n?T.push(t._promises.pop().then(function(){i(r,u.tickangle)})):i(r,u.tickangle)}),c.exit().remove(),c.each(function(t){M=Math.max(M,t.fontSize)}),i(c,u._lastangle||u.tickangle);var E=_.syncOrAsync([o,s,l]);return E&&E.then&&t._promises.push(E),E}function a(e){if(!r){var n,i,o,a,s=E.getFromId(t,e),l=y.select(t).selectAll("g."+e+"tick"),u={selection:l,side:s.side},h=e.charAt(0),f=t._fullLayout._size,d=1.5,p=s.titlefont.size;if(l.size()){var v=y.select(l.node().parentNode).attr("transform").match(/translate\(([-\.\d]+),([-\.\d]+)\)/);v&&(u.offsetLeft=+v[1],u.offsetTop=+v[2])}"x"===h?(i="free"===s.anchor?{_offset:f.t+(1-(s.position||0))*f.h,_length:0}:E.getFromId(t,s.anchor),o=s._offset+s._length/2,a=i._offset+("top"===s.side?-10-p*(d+(s.showticklabels?1:0)):i._length+10+p*(d+(s.showticklabels?1.5:.5))),s.rangeslider&&s.rangeslider.visible&&s._boundingBox&&(a+=(c.height-c.margin.b-c.margin.t)*s.rangeslider.thickness+s._boundingBox.height),u.side||(u.side="bottom")):(i="free"===s.anchor?{_offset:f.l+(s.position||0)*f.w,_length:0}:E.getFromId(t,s.anchor),a=s._offset+s._length/2,o=i._offset+("right"===s.side?i._length+10+p*(d+(s.showticklabels?1:.5)):-10-p*(d+(s.showticklabels?.5:0))),n={rotate:"-90",offset:0},u.side||(u.side="left")),M.draw(t,e+"title",{propContainer:s,propName:s._name+".title",dfltName:h.toUpperCase()+" axis",avoid:u,transform:n,attributes:{x:o,y:a,"text-anchor":"middle"}})}}function s(t,e){return t.visible!==!0||t.xaxis+t.yaxis!==e?!1:x.Plots.traceIs(t,"bar")&&t.orientation==={x:"h",y:"v"}[m]?!0:t.fill&&t.fill.charAt(t.fill.length-1)===m}function l(e,r,i){var o=e.gridlayer,a=e.zerolinelayer,l=e["hidegrid"+m]?[]:V,c=u._gridpath||"M0,0"+("x"===m?"v":"h")+r._length,h=o.selectAll("path."+I).data(u.showgrid===!1?[]:l,L);if(h.enter().append("path").classed(I,1).classed("crisp",1).attr("d",c).each(function(t){u.zeroline&&("linear"===u.type||"-"===u.type)&&Math.abs(t.x)<u.dtick/100&&y.select(this).remove()}),h.attr("transform",d).call(k.stroke,u.gridcolor||"#ddd").style("stroke-width",O+"px"),h.exit().remove(),a){for(var f=!1,p=0;p<t._fullData.length;p++)if(s(t._fullData[p],i)){f=!0;break}var v=u.range[0]*u.range[1]<=0&&u.zeroline&&("linear"===u.type||"-"===u.type)&&l.length&&(f||n({x:0})||!u.showline),g=a.selectAll("path."+P).data(v?[{x:0}]:[]);g.enter().append("path").classed(P,1).classed("zl",1).classed("crisp",1).attr("d",c),g.attr("transform",d).call(k.stroke,u.zerolinecolor||k.defaultLine).style("stroke-width",F+"px"),g.exit().remove()}}var u,c=t._fullLayout,h=!1;if("object"==typeof e)u=e,e=u._id,h=!0;else if(u=T.getFromId(t,e),"redraw"===e&&c._paper.selectAll("g.subplot").each(function(t){var e=c._plots[t],r=e.x(),n=e.y();e.xaxislayer.selectAll("."+r._id+"tick").remove(),e.yaxislayer.selectAll("."+n._id+"tick").remove(),e.gridlayer.selectAll("path").remove(),e.zerolinelayer.selectAll("path").remove()}),!e||"redraw"===e)return _.syncOrAsync(T.list(t,"",!0).map(function(r){return function(){if(r._id){var n=T.doTicks(t,r._id);return"redraw"===e&&(r._r=r.range.slice()),n}}}));u.tickformat||(-1===["none","e","E","power","SI","B"].indexOf(u.exponentformat)&&(u.exponentformat="e"),-1===["all","first","last","none"].indexOf(u.showexponent)&&(u.showexponent="all")),u.range=[+u.range[0],+u.range[1]],u.setScale();var f,d,p,v,m=e.charAt(0),g=T.counterLetter(e),S=T.calcTicks(u),L=function(t){return t.text+t.x+u.mirror},z=e+"tick",I=e+"grid",P=e+"zl",C=(u.linewidth||1)/2,R=("outside"===u.ticks?u.ticklen:1)+(u.linewidth||0),D=0,O=A.crispRound(t,u.gridwidth,1),F=A.crispRound(t,u.zerolinewidth,O),j=A.crispRound(t,u.tickwidth,1);if(u._counterangle&&"outside"===u.ticks){var N=u._counterangle*Math.PI/180;R=u.ticklen*Math.cos(N)+(u.linewidth||0),D=u.ticklen*Math.sin(N)}if("x"===m)f=["bottom","top"],d=function(t){return"translate("+u.l2p(t.x)+",0)"},p=function(t,e){if(u._counterangle){var r=u._counterangle*Math.PI/180;return"M0,"+t+"l"+Math.sin(r)*e+","+Math.cos(r)*e}return"M0,"+t+"v"+e};else{if("y"!==m)return void _.warn("Unrecognized doTicks axis:",e);f=["left","right"],d=function(t){return"translate(0,"+u.l2p(t.x)+")"},p=function(t,e){if(u._counterangle){var r=u._counterangle*Math.PI/180;return"M"+t+",0l"+Math.cos(r)*e+","+-Math.sin(r)*e}return"M"+t+",0h"+e}}var B=u.side||f[0],U=[-1,1,B===f[1]?1:-1];"inside"!==u.ticks==("x"===m)&&(U=U.map(function(t){return-t}));var V=S.filter(n);if(h){if(i(u._axislayer,p(u._pos+C*U[2],U[2]*u.ticklen)),u._counteraxis){var q={gridlayer:u._gridlayer,zerolinelayer:u._zerolinelayer};l(q,u._counteraxis)}return o(u._axislayer,u._pos)}var G=T.getSubplots(t,u).map(function(t){var e=c._plots[t];if(c._has("cartesian")){var r=e[m+"axislayer"],n=u._linepositions[t]||[],a=e[g](),s=a._id===u.anchor,h=[!1,!1,!1],d="";if("allticks"===u.mirror?h=[!0,!0,!1]:s&&("ticks"===u.mirror?h=[!0,!0,!1]:h[f.indexOf(B)]=!0),u.mirrors)for(v=0;2>v;v++){var y=u.mirrors[a._id+f[v]];"ticks"!==y&&"labels"!==y||(h[v]=!0)}return void 0!==n[2]&&(h[2]=!0),h.forEach(function(t,e){var r=n[e],i=U[e];t&&b(r)&&(d+=p(r+C*i,i*u.ticklen))}),i(r,d),l(e,a,t),o(r,n[3])}}).filter(function(t){return t&&t.then});return G.length?Promise.all(G):0},T.swap=function(t,e){for(var r=d(t,e),n=0;n<r.length;n++)v(t,r[n].x,r[n].y)}},{"../../components/color":483,"../../components/drawing":506,"../../components/titles":546,"../../lib":568,"../../lib/svg_text_utils":581,"../../plotly":589,"./axis_ids":594,"./layout_attributes":601,"./layout_defaults":602,"./set_convert":606,d3:119,"fast-isnumeric":123}],593:[function(t,e,r){"use strict";function n(t,e){if("-"===t.type){var r=t._id,n=r.charAt(0);-1!==r.indexOf("scene")&&(r=n);var l=s(e,r,n);if(l){if("histogram"===l.type&&n==={v:"y",h:"x"}[l.orientation||"v"])return void(t.type="linear");if(o(l,n)){for(var u,c=i(l),h=[],f=0;f<e.length;f++)u=e[f],p.traceIs(u,"box")&&(u[n+"axis"]||n)===r&&(void 0!==u[c]?h.push(u[c][0]):void 0!==u.name?h.push(u.name):h.push("text"));t.type=a(h)}else t.type=a(l[n]||[l[n+"0"]])}}}function i(t){return{v:"x",h:"y"}[t.orientation||"v"]}function o(t,e){var r=i(t);return p.traceIs(t,"box")&&e===r&&void 0===t[r]&&void 0===t[r+"0"]}function a(t){return u(t)?"date":c(t)?"category":l(t)?"linear":"-"}function s(t,e,r){for(var n=0;n<t.length;n++){var i=t[n];if((i[r+"axis"]||r)===e){if(o(i,r))return i;if((i[r]||[]).length||i[r+"0"])return i}}}function l(t){if(!t)return!1;for(var e=0;e<t.length;e++)if(h(t[e]))return!0;return!1}function u(t){for(var e,r=0,n=0,i=Math.max(1,(t.length-1)/1e3),o=0;o<t.length;o+=i)e=t[Math.round(o)],d.isDateTime(e)&&(r+=1),h(e)&&(n+=1);return r>2*n}function c(t){for(var e,r=Math.max(1,(t.length-1)/1e3),n=0,i=0,o=0;o<t.length;o+=r)e=M(t[Math.round(o)]),h(e)?n++:"string"==typeof e&&""!==e&&"None"!==e&&i++;return i>2*n}var h=t("fast-isnumeric"),f=t("tinycolor2").mix,d=t("../../lib"),p=t("../plots"),v=t("../../components/color/attributes").lightFraction,m=t("./layout_attributes"),g=t("./tick_value_defaults"),y=t("./tick_mark_defaults"),b=t("./tick_label_defaults"),x=t("./category_order_defaults"),_=t("./set_convert"),w=t("./ordered_categories"),M=t("./clean_datum"),k=t("./axis_ids");e.exports=function(t,e,r,i){function o(r,n){return d.coerce2(t,e,m,r,n)}var a=i.letter,s=i.font||{},l="Click to enter "+(i.title||a.toUpperCase()+" axis")+" title";i.name&&(e._name=i.name,e._id=k.name2id(i.name));var u=r("type");"-"===u&&(n(e,i.data),"-"===e.type?e.type="linear":u=t.type=e.type),_(e);var c=r("color"),p=c===t.color?c:s.color;r("title",l),d.coerceFont(r,"titlefont",{family:s.family,size:Math.round(1.2*s.size),color:p});var M=2===(t.range||[]).length&&h(t.range[0])&&h(t.range[1]),A=r("autorange",!M);A&&r("rangemode");var T=r("range",[-1,"x"===a?6:4]);T[0]===T[1]&&(e.range=[T[0]-1,T[0]+1]),d.noneOrAll(t.range,e.range,[0,1]),r("fixedrange"),g(t,e,r,u),b(t,e,r,u,i),y(t,e,r,i),x(t,e,r);var E=o("linecolor",c),S=o("linewidth"),L=r("showline",!!E||!!S);L||(delete e.linecolor,delete e.linewidth),(L||e.ticks)&&r("mirror");var z=o("gridcolor",f(c,i.bgColor,v).toRgbString()),I=o("gridwidth"),P=r("showgrid",i.showGrid||!!z||!!I);P||(delete e.gridcolor,delete e.gridwidth);var C=o("zerolinecolor",c),R=o("zerolinewidth"),D=r("zeroline",i.showGrid||!!C||!!R);return D||(delete e.zerolinecolor,delete e.zerolinewidth),e._initialCategories="category"===u?w(a,e.categoryorder,e.categoryarray,i.data):[],e}},{"../../components/color/attributes":482,"../../lib":568,"../plots":648,"./axis_ids":594,"./category_order_defaults":595,"./clean_datum":596,"./layout_attributes":601,"./ordered_categories":603,"./set_convert":606,"./tick_label_defaults":607,"./tick_mark_defaults":608,"./tick_value_defaults":609,"fast-isnumeric":123,tinycolor2:454}],594:[function(t,e,r){"use strict";function n(t,e,r){function n(t,r){for(var n=Object.keys(t),i=/^[xyz]axis[0-9]*/,o=[],a=0;a<n.length;a++){var s=n[a];e&&s.charAt(0)!==e||i.test(s)&&o.push(r+s)}return o.sort()}var o=t._fullLayout;if(!o)return[];var a=n(o,"");if(r)return a;for(var s=i.getSubplotIds(o,"gl3d")||[],l=0;l<s.length;l++){var u=s[l];a=a.concat(n(o[u],u+"."))}return a}var i=t("../plots"),o=t("../../lib"),a=t("./constants");r.id2name=function(t){if("string"==typeof t&&t.match(a.AX_ID_PATTERN)){var e=t.substr(1);return"1"===e&&(e=""),t.charAt(0)+"axis"+e}},r.name2id=function(t){if(t.match(a.AX_NAME_PATTERN)){var e=t.substr(5);return"1"===e&&(e=""),t.charAt(0)+e}},r.cleanId=function(t,e){if(t.match(a.AX_ID_PATTERN)&&(!e||t.charAt(0)===e)){var r=t.substr(1).replace(/^0+/,"");return"1"===r&&(r=""),t.charAt(0)+r}},r.list=function(t,e,r){return n(t,e,r).map(function(e){return o.nestedProperty(t._fullLayout,e).get()})},r.listIds=function(t,e){return n(t,e,!0).map(r.name2id)},r.getFromId=function(t,e,n){var i=t._fullLayout;return"x"===n?e=e.replace(/y[0-9]*/,""):"y"===n&&(e=e.replace(/x[0-9]*/,"")),i[r.id2name(e)]},r.getFromTrace=function(t,e,n){var o=t._fullLayout,a=null;if(i.traceIs(e,"gl3d")){var s=e.scene;"scene"===s.substr(0,5)&&(a=o[s][n+"axis"])}else a=r.getFromId(t,e[n+"axis"]||n);return a}},{"../../lib":568,"../plots":648,"./constants":597}],595:[function(t,e,r){"use strict";e.exports=function(t,e,r){if("category"===e.type){var n,i=t.categoryarray,o=Array.isArray(i)&&i.length>0;o&&(n="array");var a=r("categoryorder",n);"array"===a&&r("categoryarray"),o||"array"!==a||(e.categoryorder="trace")}}},{}],596:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../lib");e.exports=function(t){try{if("object"==typeof t&&null!==t&&t.getTime)return i.ms2DateTime(t);if("string"!=typeof t&&!n(t))return"";t=t.toString().replace(/['"%,$# ]/g,"")}catch(e){i.error(e,t)}return t}},{"../../lib":568,"fast-isnumeric":123}],597:[function(t,e,r){"use strict";e.exports={idRegex:{x:/^x([2-9]|[1-9][0-9]+)?$/,y:/^y([2-9]|[1-9][0-9]+)?$/},attrRegex:{x:/^xaxis([2-9]|[1-9][0-9]+)?$/,y:/^yaxis([2-9]|[1-9][0-9]+)?$/},BADNUM:void 0,xAxisMatch:/^xaxis[0-9]*$/,yAxisMatch:/^yaxis[0-9]*$/,AX_ID_PATTERN:/^[xyz][0-9]*$/,AX_NAME_PATTERN:/^[xyz]axis[0-9]*$/,DBLCLICKDELAY:300,MINDRAG:8,MINSELECT:12,MINZOOM:20,DRAGGERSIZE:20,MAXDIST:20,YANGLE:60,HOVERARROWSIZE:6,HOVERTEXTPAD:3,HOVERFONTSIZE:13,HOVERFONT:"Arial, sans-serif",HOVERMINTIME:50,BENDPX:1.5,REDRAWDELAY:50}},{}],598:[function(t,e,r){"use strict";function n(t,e){var r,n=t.range[e],i=Math.abs(n-t.range[1-e]);return"date"===t.type?c.ms2DateTime(n,i):"log"===t.type?(r=Math.ceil(Math.max(0,-Math.log(i)/Math.LN10))+3,s.format("."+r+"g")(Math.pow(10,n))):(r=Math.floor(Math.log(Math.abs(n))/Math.LN10)-Math.floor(Math.log(i)/Math.LN10)+4,s.format("."+String(r)+"g")(n))}function i(t,e){return t?"nsew"===t?"pan"===e?"move":"crosshair":t.toLowerCase()+"-resize":"pointer"}function o(t){s.select(t).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}function a(t){var e=["lasso","select"];return-1!==e.indexOf(t)}var s=t("d3"),l=t("tinycolor2"),u=t("../../plotly"),c=t("../../lib"),h=t("../../lib/svg_text_utils"),f=t("../../components/color"),d=t("../../components/drawing"),p=t("../../lib/setcursor"),v=t("../../components/dragelement"),m=t("./axes"),g=t("./select"),y=t("./constants"),b=!0;e.exports=function(t,e,r,s,x,_,w,M){function k(t,e){for(var r=0;r<t.length;r++)if(!t[r].fixedrange)return e;return""}function A(t){t[0]=Number(t[0]),t[1]=Number(t[1])}function T(e,r,n){var i=rt.getBoundingClientRect();it=r-i.left,ot=n-i.top,at={l:it,r:it,w:0,t:ot,b:ot,h:0},st=t._hmpixcount?t._hmlumcount/t._hmpixcount:l(t._fullLayout.plot_bgcolor).getLuminance(),lt="M0,0H"+V+"V"+q+"H0V0",ut=!1,ct="xy",ht=dt.append("path").attr("class","zoombox").style({fill:st>.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("transform","translate("+pt+", "+vt+")").attr("d",lt+"Z"),ft=dt.append("path").attr("class","zoombox-corners").style({fill:f.background,stroke:f.defaultLine,"stroke-width":1,opacity:0}).attr("transform","translate("+pt+", "+vt+")").attr("d","M0,0Z"),E();for(var o=0;o<K.length;o++)A(K[o].range)}function E(){dt.selectAll(".select-outline").remove()}function S(t,e){var r=Math.max(0,Math.min(V,t+it)),n=Math.max(0,Math.min(q,e+ot)),i=Math.abs(r-it),o=Math.abs(n-ot),a=Math.floor(Math.min(o,i,H)/2);at.l=Math.min(it,r),at.r=Math.max(it,r),at.t=Math.min(ot,n),at.b=Math.max(ot,n),!$||o<Math.min(Math.max(.6*i,G),H)?G>i?(ct="",at.r=at.l,at.t=at.b,ft.attr("d","M0,0Z")):(at.t=0,at.b=q,ct="x",ft.attr("d","M"+(at.l-.5)+","+(ot-H-.5)+"h-3v"+(2*H+1)+"h3ZM"+(at.r+.5)+","+(ot-H-.5)+"h3v"+(2*H+1)+"h-3Z")):!J||i<Math.min(.6*o,H)?(at.l=0,at.r=V,ct="y",ft.attr("d","M"+(it-H-.5)+","+(at.t-.5)+"v-3h"+(2*H+1)+"v3ZM"+(it-H-.5)+","+(at.b+.5)+"v3h"+(2*H+1)+"v-3Z")):(ct="xy",ft.attr("d","M"+(at.l-3.5)+","+(at.t-.5+a)+"h3v"+-a+"h"+a+"v-3h-"+(a+3)+"ZM"+(at.r+3.5)+","+(at.t-.5+a)+"h-3v"+-a+"h"+-a+"v-3h"+(a+3)+"ZM"+(at.r+3.5)+","+(at.b+.5-a)+"h-3v"+a+"h"+-a+"v3h"+(a+3)+"ZM"+(at.l-3.5)+","+(at.b+.5-a)+"h3v"+a+"h"+a+"v3h-"+(a+3)+"Z")),at.w=at.r-at.l,at.h=at.b-at.t,ht.attr("d",lt+"M"+at.l+","+at.t+"v"+at.h+"h"+at.w+"v-"+at.h+"h-"+at.w+"Z"),ut||(ht.transition().style("fill",st>.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200),ft.transition().style("opacity",1).duration(200),ut=!0)}function L(t,e,r){var n,i,o;for(n=0;n<t.length;n++)i=t[n],i.fixedrange||(o=i.range,i.range=[o[0]+(o[1]-o[0])*e,o[0]+(o[1]-o[0])*r])}function z(e,r){return Math.min(at.h,at.w)<2*G?(2===r&&D(),o(t)):("xy"!==ct&&"x"!==ct||L(B,at.l/V,at.r/V),"xy"!==ct&&"y"!==ct||L(U,(q-at.b)/q,(q-at.t)/q),o(t),O(ct),void(b&&t.data&&t._context.showTips&&(c.notifier("Double-click to<br>zoom back out","long"),b=!1)))}function I(e,r){var i=1===(w+M).length;if(e)O();else if(2!==r||i){if(1===r&&i){var o=w?U[0]:B[0],a="s"===w||"w"===M?0:1,s=o._name+".range["+a+"]",l=n(o,a),c="left",f="middle";if(o.fixedrange)return;w?(f="n"===w?"top":"bottom","right"===o.side&&(c="right")):"e"===M&&(c="right"),et.call(h.makeEditable,null,{immediate:!0,background:j.paper_bgcolor,text:String(l),fill:o.tickfont?o.tickfont.color:"#444",horizontalAlign:c,verticalAlign:f}).on("edit",function(e){var r="category"===o.type?o.c2l(e):o.d2l(e);void 0!==r&&u.relayout(t,s,r)})}}else D()}function P(e){function r(t,e,r){if(!t.fixedrange){A(t.range);var n=t.range,i=n[0]+(n[1]-n[0])*e;t.range=[i+(n[0]-i)*r,i+(n[1]-i)*r]}}if(t._context.scrollZoom||j._enablescrollzoom){var n=t.querySelector(".plotly");if(!(n.scrollHeight-n.clientHeight>10||n.scrollWidth-n.clientWidth>10)){clearTimeout(gt);var i=-e.deltaY;if(isFinite(i)||(i=e.wheelDelta/10),!isFinite(i))return void c.log("Did not find wheel motion attributes: ",e);var o,a=Math.exp(-Math.min(Math.max(i,-20),20)/100),s=bt.draglayer.select(".nsewdrag").node().getBoundingClientRect(),l=(e.clientX-s.left)/s.width,u=mt[0]+mt[2]*l,h=(s.bottom-e.clientY)/s.height,f=mt[1]+mt[3]*(1-h);if(M){for(o=0;o<B.length;o++)r(B[o],l,a);mt[2]*=a,mt[0]=u-mt[2]*l}if(w){for(o=0;o<U.length;o++)r(U[o],h,a);mt[3]*=a,mt[1]=f-mt[3]*(1-h)}return F(mt),R(w,M),gt=setTimeout(function(){mt=[0,0,V,q],O()},yt),c.pauseEvent(e)}}}function C(t,e){function r(t,e){for(var r=0;r<t.length;r++){var n=t[r];n.fixedrange||(n.range=[n._r[0]-e/n._m,n._r[1]-e/n._m])}}function n(t){return 1-(t>=0?Math.min(t,.9):1/(1/Math.max(t,-.3)+3.222))}function i(t,e,r){for(var i=1-e,o=0,a=0;a<t.length;a++){var s=t[a];s.fixedrange||(o=a,s.range[e]=s._r[i]+(s._r[e]-s._r[i])/n(r/s._length))}return t[o]._length*(t[o]._r[e]-t[o].range[e])/(t[o]._r[e]-t[o]._r[i])}return"ew"===J||"ns"===$?(J&&r(B,t),$&&r(U,e),F([J?-t:0,$?-e:0,V,q]),void R($,J)):("w"===J?t=i(B,0,t):"e"===J?t=i(B,1,-t):J||(t=0),"n"===$?e=i(U,1,e):"s"===$?e=i(U,0,-e):$||(e=0),F(["w"===J?t:0,"n"===$?e:0,V-t,q-e]),void R($,J))}function R(e,r){function n(t){for(o=0;o<t.length;o++)t[o].fixedrange||a.push(t[o]._id)}function i(n,i){var s;for(o=0;o<n.length;o++)s=n[o],(r&&-1!==a.indexOf(s.xref)||e&&-1!==a.indexOf(s.yref))&&i.draw(t,o)}var o,a=[];for(r&&n(B),e&&n(U),o=0;o<a.length;o++)m.doTicks(t,a[o],!0);i(j.annotations||[],u.Annotations),i(j.shapes||[],u.Shapes),i(j.images||[],u.Images)}function D(){var e,r,n,i=t._context.doubleClick,o=(J?B:[]).concat($?U:[]),a={};if("autosize"===i)for(r=0;r<o.length;r++)e=o[r],e.fixedrange||(a[e._name+".autorange"]=!0);else if("reset"===i)for(r=0;r<o.length;r++)e=o[r],e._rangeInitial?(n=e._rangeInitial.slice(),a[e._name+".range[0]"]=n[0],a[e._name+".range[1]"]=n[1]):a[e._name+".autorange"]=!0;else if("reset+autosize"===i)for(r=0;r<o.length;r++)e=o[r],e.fixedrange||(void 0===e._rangeInitial||e.range[0]===e._rangeInitial[0]&&e.range[1]===e._rangeInitial[1]?a[e._name+".autorange"]=!0:(n=e._rangeInitial.slice(),a[e._name+".range[0]"]=n[0],a[e._name+".range[1]"]=n[1]));t.emit("plotly_doubleclick",null),u.relayout(t,a)}function O(e){for(var r={},n=0;n<K.length;n++){var i=K[n];e&&-1===e.indexOf(i._id.charAt(0))||(i._r[0]!==i.range[0]&&(r[i._name+".range[0]"]=i.range[0]),i._r[1]!==i.range[1]&&(r[i._name+".range[1]"]=i.range[1]),i.range=i._r.slice())}F([0,0,V,q]),u.relayout(t,r)}function F(t){for(var e=j._plots,r=Object.keys(e),n=0;n<r.length;n++){var i=e[r[n]],o=i.x(),a=i.y(),s=M&&-1!==B.indexOf(o)&&!o.fixedrange,l=w&&-1!==U.indexOf(a)&&!a.fixedrange,u=s?o._length/t[2]:1,h=l?a._length/t[3]:1,f=s?t[0]:0,d=l?t[1]:0,p=s?t[0]/t[2]*o._length:0,v=l?t[1]/t[3]*a._length:0,m=o._offset-p,g=a._offset-v;j._defs.selectAll("#"+i.clipId).call(c.setTranslate,f,d).call(c.setScale,1/u,1/h),i.plot.call(c.setTranslate,m,g).call(c.setScale,u,h).selectAll(".points").selectAll(".point").call(c.setPointGroupScale,1/u,1/h)}}for(var j=t._fullLayout,N=[e].concat(w&&M?e.overlays:[]),B=[e.x()],U=[e.y()],V=B[0]._length,q=U[0]._length,G=y.MINDRAG,H=y.MINZOOM,X=w+M==="nsew",Y=1;Y<N.length;Y++){var W=N[Y].x(),Z=N[Y].y();-1===B.indexOf(W)&&B.push(W),-1===U.indexOf(Z)&&U.push(Z)}var K=B.concat(U),J=k(B,M),$=k(U,w),Q=i($+J,j.dragmode),tt=w+M+"drag",et=e.draglayer.selectAll("."+tt).data([0]);et.enter().append("rect").classed("drag",!0).classed(tt,!0).style({fill:"transparent","stroke-width":0}).attr("data-subplot",e.id),et.call(d.setRect,r,s,x,_).call(p,Q);var rt=et.node();if(!$&&!J&&!a(j.dragmode))return rt.onmousedown=null,rt.style.pointerEvents=X?"all":"none",rt;var nt={element:rt,gd:t,plotinfo:e,xaxes:B,yaxes:U,doubleclick:D,prepFn:function(e,r,n){var i=t._fullLayout.dragmode;X?e.shiftKey&&(i="pan"===i?"zoom":"pan"):i="pan","lasso"===i?nt.minDrag=1:nt.minDrag=void 0,"zoom"===i?(nt.moveFn=S,nt.doneFn=z,T(e,r,n)):"pan"===i?(nt.moveFn=C,nt.doneFn=I,E()):a(i)&&g(e,r,n,nt,i)}};v.init(nt);var it,ot,at,st,lt,ut,ct,ht,ft,dt=t._fullLayout._zoomlayer,pt=e.x()._offset,vt=e.y()._offset,mt=[0,0,V,q],gt=null,yt=y.REDRAWDELAY,bt=e.mainplot?j._plots[e.mainplot]:e;return w.length*M.length!==1&&(void 0!==rt.onwheel?rt.onwheel=P:void 0!==rt.onmousewheel&&(rt.onmousewheel=P)),rt}},{"../../components/color":483,"../../components/dragelement":504,"../../components/drawing":506,"../../lib":568,"../../lib/setcursor":577,"../../lib/svg_text_utils":581,"../../plotly":589,"./axes":592,"./constants":597,"./select":605,d3:119,tinycolor2:454}],599:[function(t,e,r){"use strict";function n(t,e){for(var r=[],n=t.length;n>0;n--)r.push(e);return r}function i(t,e){for(var r=[],n=0;n<t.length;n++)r.push(t[n].p2c(e));return r}function o(t,e){return function(r){var n=t(r),i=e(r);return Math.sqrt(n*n+i*i)}}function a(t,e,r){if("pie"===r)return void t.emit("plotly_hover",{points:[e]});r||(r="xy");var o=Array.isArray(r)?r:[r],a=t._fullLayout,d=a._plots||[],p=d[r];if(p){var y=p.overlays.map(function(t){return t.id});o=o.concat(y)}for(var x=o.length,k=new Array(x),A=new Array(x),T=0;x>T;T++){var E=o[T],S=d[E];if(S)k[T]=w.getFromId(t,S.xaxis._id),A[T]=w.getFromId(t,S.yaxis._id);else{var L=a[E]._subplot;k[T]=L.xaxis,A[T]=L.yaxis}}var z=e.hovermode||a.hovermode;if(-1===["x","y","closest"].indexOf(z)||!t.calcdata||t.querySelector(".zoombox")||t._dragging)return _.unhoverRaw(t,e);var I,P,C,R,D,O,F,j,N,B,U,V,q=[],G=[];if(Array.isArray(e))for(z="array",C=0;C<e.length;C++)D=t.calcdata[e[C].curveNumber||0],G.push(D);else{for(R=0;R<t.calcdata.length;R++)D=t.calcdata[R],O=D[0].trace,-1!==o.indexOf(s(O))&&G.push(D);var H,X;if(e.target&&"clientX"in e&&"clientY"in e){if(g.triggerHandler(t,"plotly_beforehover",e)===!1)return;var Y=e.target.getBoundingClientRect();if(H=e.clientX-Y.left,X=e.clientY-Y.top,0>H||H>Y.width||0>X||X>Y.height)return _.unhoverRaw(t,e)}else H="xpx"in e?e.xpx:k[0]._length/2,X="ypx"in e?e.ypx:A[0]._length/2;if(I="xval"in e?n(o,e.xval):i(k,H),P="yval"in e?n(o,e.yval):i(A,X),!v(I[0])||!v(P[0]))return m.warn("Plotly.Fx.hover failed",e,t),_.unhoverRaw(t,e)}var W=1/0;for(R=0;R<G.length;R++)if(D=G[R],D&&D[0]&&D[0].trace&&D[0].trace.visible===!0){if(O=D[0].trace,F=o.indexOf(s(O)),j=z,U={cd:D,trace:O,xa:k[F],ya:A[F],name:t.data.length>1||-1!==O.hoverinfo.indexOf("name")?O.name:void 0,index:!1,distance:Math.min(W,M.MAXDIST),color:b.defaultLine,x0:void 0,x1:void 0,y0:void 0,y1:void 0,xLabelVal:void 0,yLabelVal:void 0,zLabelVal:void 0,text:void 0},V=q.length,"array"===j){var Z=e[R];"pointNumber"in Z?(U.index=Z.pointNumber,j="closest"):(j="","xval"in Z&&(N=Z.xval,j="x"),"yval"in Z&&(B=Z.yval,j=j?"closest":"y"))}else N=I[F],B=P[F];if(O._module&&O._module.hoverPoints){var K=O._module.hoverPoints(U,N,B,j);if(K)for(var J,$=0;$<K.length;$++)J=K[$],v(J.x0)&&v(J.y0)&&q.push(l(J,z))}else m.log("Unrecognized trace type in hover:",O);"closest"===z&&q.length>V&&(q.splice(0,V),W=q[0].distance)}if(0===q.length)return _.unhoverRaw(t,e);var Q="y"===z&&G.length>1;q.sort(function(t,e){return t.distance-e.distance});var tt=b.combine(a.plot_bgcolor||b.background,a.paper_bgcolor),et={
hovermode:z,rotateLabels:Q,bgColor:tt,container:a._hoverlayer,outerContainer:a._paperdiv},rt=u(q,et);c(q,Q?"xa":"ya"),h(rt,Q);var nt=t._hoverdata,it=[];for(C=0;C<q.length;C++){var ot=q[C],at={data:ot.trace._input,fullData:ot.trace,curveNumber:ot.trace.index,pointNumber:ot.index,x:ot.xVal,y:ot.yVal,xaxis:ot.xa,yaxis:ot.ya};void 0!==ot.zLabelVal&&(at.z=ot.zLabelVal),it.push(at)}t._hoverdata=it,f(t,e,nt)&&(nt&&t.emit("plotly_unhover",{points:nt}),t.emit("plotly_hover",{points:t._hoverdata,xaxes:k,yaxes:A,xvals:I,yvals:P}))}function s(t){return t.subplot||t.xaxis+t.yaxis}function l(t,e){t.posref="y"===e?(t.x0+t.x1)/2:(t.y0+t.y1)/2,t.x0=m.constrain(t.x0,0,t.xa._length),t.x1=m.constrain(t.x1,0,t.xa._length),t.y0=m.constrain(t.y0,0,t.ya._length),t.y1=m.constrain(t.y1,0,t.ya._length);var r;if(void 0!==t.xLabelVal){r="log"===t.xa.type&&t.xLabelVal<=0;var n=w.tickText(t.xa,t.xa.c2l(r?-t.xLabelVal:t.xLabelVal),"hover");r?0===t.xLabelVal?t.xLabel="0":t.xLabel="-"+n.text:t.xLabel=n.text,t.xVal=t.xa.c2d(t.xLabelVal)}if(void 0!==t.yLabelVal){r="log"===t.ya.type&&t.yLabelVal<=0;var i=w.tickText(t.ya,t.ya.c2l(r?-t.yLabelVal:t.yLabelVal),"hover");r?0===t.yLabelVal?t.yLabel="0":t.yLabel="-"+i.text:t.yLabel=i.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 o=w.tickText(t.xa,t.xa.c2l(t.xerr),"hover").text;void 0!==t.xerrneg?t.xLabel+=" +"+o+" / -"+w.tickText(t.xa,t.xa.c2l(t.xerrneg),"hover").text:t.xLabel+=" \xb1 "+o,"x"===e&&(t.distance+=1)}if(!(isNaN(t.yerr)||"log"===t.ya.type&&t.yerr<=0)){var a=w.tickText(t.ya,t.ya.c2l(t.yerr),"hover").text;void 0!==t.yerrneg?t.yLabel+=" +"+a+" / -"+w.tickText(t.ya,t.ya.c2l(t.yerrneg),"hover").text:t.yLabel+=" \xb1 "+a,"y"===e&&(t.distance+=1)}var s=t.trace.hoverinfo;return"all"!==s&&(s=s.split("+"),-1===s.indexOf("x")&&(t.xLabel=void 0),-1===s.indexOf("y")&&(t.yLabel=void 0),-1===s.indexOf("z")&&(t.zLabel=void 0),-1===s.indexOf("text")&&(t.text=void 0),-1===s.indexOf("name")&&(t.name=void 0)),t}function u(t,e){var r,n,i=e.hovermode,o=e.rotateLabels,a=e.bgColor,s=e.container,l=e.outerContainer,u=t[0],c=u.xa,h=u.ya,f="y"===i?"yLabel":"xLabel",v=u[f],m=(String(v)||"").split(" ")[0],g=l.node().getBoundingClientRect(),_=g.top,w=g.width,k=g.height,A=u.distance<=M.MAXDIST&&("x"===i||"y"===i);for(r=0;r<t.length;r++){n=t[r].trace.hoverinfo;var E=n.split("+");if(-1===E.indexOf("all")&&-1===E.indexOf(i)){A=!1;break}}var S=s.selectAll("g.axistext").data(A?[0]:[]);S.enter().append("g").classed("axistext",!0),S.exit().remove(),S.each(function(){var e=d.select(this),r=e.selectAll("path").data([0]),n=e.selectAll("text").data([0]);r.enter().append("path").style({fill:b.defaultLine,"stroke-width":"1px",stroke:b.background}),n.enter().append("text").call(x.font,R,C,b.background).attr("data-notex",1),n.text(v).call(y.convertToTspans).call(x.setPosition,0,0).selectAll("tspan.line").call(x.setPosition,0,0),e.attr("transform","");var o=n.node().getBoundingClientRect();if("x"===i){n.attr("text-anchor","middle").call(x.setPosition,0,"top"===c.side?_-o.bottom-I-P:_-o.top+I+P).selectAll("tspan.line").attr({x:n.attr("x"),y:n.attr("y")});var a="top"===c.side?"-":"";r.attr("d","M0,0L"+I+","+a+I+"H"+(P+o.width/2)+"v"+a+(2*P+o.height)+"H-"+(P+o.width/2)+"V"+a+I+"H-"+I+"Z"),e.attr("transform","translate("+(c._offset+(u.x0+u.x1)/2)+","+(h._offset+("top"===c.side?0:h._length))+")")}else{n.attr("text-anchor","right"===h.side?"start":"end").call(x.setPosition,("right"===h.side?1:-1)*(P+I),_-o.top-o.height/2).selectAll("tspan.line").attr({x:n.attr("x"),y:n.attr("y")});var s="right"===h.side?"":"-";r.attr("d","M0,0L"+s+I+","+I+"V"+(P+o.height/2)+"h"+s+(2*P+o.width)+"V-"+(P+o.height/2)+"H"+s+I+"V-"+I+"Z"),e.attr("transform","translate("+(c._offset+("right"===h.side?c._length:0))+","+(h._offset+(u.y0+u.y1)/2)+")")}t=t.filter(function(t){return void 0!==t.zLabelVal||(t[f]||"").split(" ")[0]===m})});var L=s.selectAll("g.hovertext").data(t,function(t){return[t.trace.index,t.index,t.x0,t.y0,t.name,t.attr,t.xa,t.ya||""].join(",")});return L.enter().append("g").classed("hovertext",!0).each(function(){var t=d.select(this);t.append("rect").call(b.fill,b.addOpacity(a,.8)),t.append("text").classed("name",!0).call(x.font,R,C),t.append("path").style("stroke-width","1px"),t.append("text").classed("nums",!0).call(x.font,R,C)}),L.exit().remove(),L.each(function(t){var e=d.select(this).attr("transform",""),r="",n="",s=b.opacity(t.color)?t.color:b.defaultLine,l=b.combine(s,a),u=p(l).getBrightness()>128?"#000":b.background;if(t.name&&void 0===t.zLabelVal){var c=document.createElement("p");c.innerHTML=t.name,r=c.textContent||"",r.length>15&&(r=r.substr(0,12)+"...")}void 0!==t.extraText&&(n+=t.extraText),void 0!==t.zLabel?(void 0!==t.xLabel&&(n+="x: "+t.xLabel+"<br>"),void 0!==t.yLabel&&(n+="y: "+t.yLabel+"<br>"),n+=(n?"z: ":"")+t.zLabel):A&&t[i+"Label"]===v?n=t[("x"===i?"y":"x")+"Label"]||"":void 0===t.xLabel?void 0!==t.yLabel&&(n=t.yLabel):n=void 0===t.yLabel?t.xLabel:"("+t.xLabel+", "+t.yLabel+")",t.text&&!Array.isArray(t.text)&&(n+=(n?"<br>":"")+t.text),""===n&&(""===r&&e.remove(),n=r);var h=e.select("text.nums").style("fill",u).call(x.setPosition,0,0).text(n).attr("data-notex",1).call(y.convertToTspans);h.selectAll("tspan.line").call(x.setPosition,0,0);var f=e.select("text.name"),m=0;r&&r!==n?(f.style("fill",l).text(r).call(x.setPosition,0,0).attr("data-notex",1).call(y.convertToTspans),f.selectAll("tspan.line").call(x.setPosition,0,0),m=f.node().getBoundingClientRect().width+2*P):(f.remove(),e.select("rect").remove()),e.select("path").style({fill:l,stroke:u});var g,M,E=h.node().getBoundingClientRect(),S=t.xa._offset+(t.x0+t.x1)/2,L=t.ya._offset+(t.y0+t.y1)/2,z=Math.abs(t.x1-t.x0),C=Math.abs(t.y1-t.y0),R=E.width+I+P+m;t.ty0=_-E.top,t.bx=E.width+2*P,t.by=E.height+2*P,t.anchor="start",t.txwidth=E.width,t.tx2width=m,t.offset=0,o?(t.pos=S,g=k>=L+C/2+R,M=L-C/2-R>=0,"top"!==t.idealAlign&&g||!M?g?(L+=C/2,t.anchor="start"):t.anchor="middle":(L-=C/2,t.anchor="end")):(t.pos=L,g=w>=S+z/2+R,M=S-z/2-R>=0,"left"!==t.idealAlign&&g||!M?g?(S+=z/2,t.anchor="start"):t.anchor="middle":(S-=z/2,t.anchor="end")),h.attr("text-anchor",t.anchor),m&&f.attr("text-anchor",t.anchor),e.attr("transform","translate("+S+","+L+")"+(o?"rotate("+T+")":""))}),L}function c(t,e){function r(t){var e=t[0],r=t[t.length-1];if(i=e.pmin-e.pos-e.dp+e.size,o=r.pos+r.dp+r.size-e.pmax,i>.01){for(s=t.length-1;s>=0;s--)t[s].dp+=i;n=!1}if(!(.01>o)){if(-.01>i){for(s=t.length-1;s>=0;s--)t[s].dp-=o;n=!1}if(n){var u=0;for(a=0;a<t.length;a++)l=t[a],l.pos+l.dp+l.size>e.pmax&&u++;for(a=t.length-1;a>=0&&!(0>=u);a--)l=t[a],l.pos>e.pmax-1&&(l.del=!0,u--);for(a=0;a<t.length&&!(0>=u);a++)if(l=t[a],l.pos<e.pmin+1)for(l.del=!0,u--,o=2*l.size,s=t.length-1;s>=0;s--)t[s].dp-=o;for(a=t.length-1;a>=0&&!(0>=u);a--)l=t[a],l.pos+l.dp+l.size>e.pmax&&(l.del=!0,u--)}}}for(var n,i,o,a,s,l,u,c=0,h=t.map(function(t,r){var n=t[e];return[{i:r,dp:0,pos:t.pos,posref:t.posref,size:t.by*("x"===n._id.charAt(0)?S:1)/2,pmin:n._offset,pmax:n._offset+n._length}]}).sort(function(t,e){return t[0].posref-e[0].posref});!n&&c<=t.length;){for(c++,n=!0,a=0;a<h.length-1;){var f=h[a],d=h[a+1],p=f[f.length-1],v=d[0];if(i=p.pos+p.dp+p.size-v.pos-v.dp+v.size,i>.01&&p.pmin===v.pmin&&p.pmax===v.pmax){for(s=d.length-1;s>=0;s--)d[s].dp+=i;for(f.push.apply(f,d),h.splice(a+1,1),u=0,s=f.length-1;s>=0;s--)u+=f[s].dp;for(o=u/f.length,s=f.length-1;s>=0;s--)f[s].dp-=o;n=!1}else a++}h.forEach(r)}for(a=h.length-1;a>=0;a--){var m=h[a];for(s=m.length-1;s>=0;s--){var g=m[s],y=t[g.i];y.offset=g.dp,y.del=g.del}}}function h(t,e){t.each(function(t){var r=d.select(this);if(t.del)return void r.remove();var n="end"===t.anchor?-1:1,i=r.select("text.nums"),o={start:1,end:-1,middle:0}[t.anchor],a=o*(I+P),s=a+o*(t.txwidth+P),l=0,u=t.offset;"middle"===t.anchor&&(a-=t.tx2width/2,s-=t.tx2width/2),e&&(u*=-z,l=t.offset*L),r.select("path").attr("d","middle"===t.anchor?"M-"+t.bx/2+",-"+t.by/2+"h"+t.bx+"v"+t.by+"h-"+t.bx+"Z":"M0,0L"+(n*I+l)+","+(I+u)+"v"+(t.by/2-I)+"h"+n*t.bx+"v-"+t.by+"H"+(n*I+l)+"V"+(u-I)+"Z"),i.call(x.setPosition,a+l,u+t.ty0-t.by/2+P).selectAll("tspan.line").attr({x:i.attr("x"),y:i.attr("y")}),t.tx2width&&(r.select("text.name, text.name tspan.line").call(x.setPosition,s+o*P+l,u+t.ty0-t.by/2+P),r.select("rect").call(x.setRect,s+(o-1)*t.tx2width/2+l,u-t.by/2-1,t.tx2width,t.by+2))})}function f(t,e,r){if(!e.target)return!1;if(!r||r.length!==t._hoverdata.length)return!0;for(var n=r.length-1;n>=0;n--){var i=r[n],o=t._hoverdata[n];if(i.curveNumber!==o.curveNumber||String(i.pointNumber)!==String(o.pointNumber))return!0}return!1}var d=t("d3"),p=t("tinycolor2"),v=t("fast-isnumeric"),m=t("../../lib"),g=t("../../lib/events"),y=t("../../lib/svg_text_utils"),b=t("../../components/color"),x=t("../../components/drawing"),_=t("../../components/dragelement"),w=t("./axes"),M=t("./constants"),k=t("./dragbox"),A=e.exports={};A.unhover=_.unhover,A.layoutAttributes={dragmode:{valType:"enumerated",values:["zoom","pan","select","lasso","orbit","turntable"],dflt:"zoom"},hovermode:{valType:"enumerated",values:["x","y","closest",!1]}},A.supplyLayoutDefaults=function(t,e,r){function n(r,n){return m.coerce(t,e,A.layoutAttributes,r,n)}n("dragmode");var i;if(e._has("cartesian")){var o=e._isHoriz=A.isHoriz(r);i=o?"y":"x"}else i="closest";n("hovermode",i)},A.isHoriz=function(t){for(var e=!0,r=0;r<t.length;r++){var n=t[r];if("h"!==n.orientation){e=!1;break}}return e},A.init=function(t){var e=t._fullLayout;if(e._has("cartesian")&&!t._context.staticPlot){var r=Object.keys(e._plots||{}).sort(function(t,r){if((e._plots[t].mainplot&&!0)===(e._plots[r].mainplot&&!0)){var n=t.split("y"),i=r.split("y");return n[0]===i[0]?Number(n[1]||1)-Number(i[1]||1):Number(n[0]||1)-Number(i[0]||1)}return e._plots[t].mainplot?1:-1});r.forEach(function(r){var n=e._plots[r];if(e._has("cartesian")){var i=n.x(),o=n.y(),a=(i._linepositions[r]||[])[3],s=(o._linepositions[r]||[])[3],l=M.DRAGGERSIZE;if(v(a)&&"top"===i.side&&(a-=l),v(s)&&"right"!==o.side&&(s-=l),!n.mainplot){var u=k(t,n,0,0,i._length,o._length,"ns","ew");u.onmousemove=function(n){A.hover(t,n,r),e._lasthover=u,e._hoversubplot=r},u.onmouseout=function(e){t._dragging||_.unhover(t,e)},u.onclick=function(e){A.click(t,e)},k(t,n,-l,-l,l,l,"n","w"),k(t,n,i._length,-l,l,l,"n","e"),k(t,n,-l,o._length,l,l,"s","w"),k(t,n,i._length,o._length,l,l,"s","e")}v(a)&&("free"===i.anchor&&(a-=e._size.h*(1-o.domain[1])),k(t,n,.1*i._length,a,.8*i._length,l,"","ew"),k(t,n,0,a,.1*i._length,l,"","w"),k(t,n,.9*i._length,a,.1*i._length,l,"","e")),v(s)&&("free"===o.anchor&&(s-=e._size.w*i.domain[0]),k(t,n,s,.1*o._length,l,.8*o._length,"ns",""),k(t,n,s,.9*o._length,l,.1*o._length,"s",""),k(t,n,s,0,l,.1*o._length,"n",""))}});var n=e._hoverlayer.node();n.onmousemove=function(r){r.target=e._lasthover,A.hover(t,r,e._hoversubplot)},n.onclick=function(r){r.target=e._lasthover,A.click(t,r)},n.onmousedown=function(t){e._lasthover.onmousedown(t)}}};var T=M.YANGLE,E=Math.PI*T/180,S=1/Math.sin(E),L=Math.cos(E),z=Math.sin(E),I=M.HOVERARROWSIZE,P=M.HOVERTEXTPAD,C=M.HOVERFONTSIZE,R=M.HOVERFONT;A.hover=function(t,e,r){return"string"==typeof t&&(t=document.getElementById(t)),void 0===t._lastHoverTime&&(t._lastHoverTime=0),void 0!==t._hoverTimer&&(clearTimeout(t._hoverTimer),t._hoverTimer=void 0),Date.now()>t._lastHoverTime+M.HOVERMINTIME?(a(t,e,r),void(t._lastHoverTime=Date.now())):void(t._hoverTimer=setTimeout(function(){a(t,e,r),t._lastHoverTime=Date.now(),t._hoverTimer=void 0},M.HOVERMINTIME))},A.getDistanceFunction=function(t,e,r,n){return"closest"===t?n||o(e,r):"x"===t?e:r},A.getClosest=function(t,e,r){if(r.index!==!1)r.index>=0&&r.index<t.length?r.distance=0:r.index=!1;else for(var n=0;n<t.length;n++){var i=e(t[n]);i<=r.distance&&(r.index=n,r.distance=i)}return r},A.loneHover=function(t,e){var r={color:t.color||b.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,trace:{index:0,hoverinfo:""},xa:{_offset:0},ya:{_offset:0},index:0},n=d.select(e.container),i=e.outerContainer?d.select(e.outerContainer):n,o={hovermode:"closest",rotateLabels:!1,bgColor:e.bgColor||b.background,container:n,outerContainer:i},a=u([r],o);return h(a,o.rotateLabels),a.node()},A.loneUnhover=function(t){var e=t instanceof d.selection?t:d.select(t);e.selectAll("g.hovertext").remove()},A.click=function(t,e){t._hoverdata&&e&&e.target&&(t.emit("plotly_click",{points:t._hoverdata}),e.stopImmediatePropagation&&e.stopImmediatePropagation())},A.inbox=function(t,e){return 0>t*e||0===t?M.MAXDIST*(.6-.3/Math.max(3,Math.abs(t-e))):1/0}},{"../../components/color":483,"../../components/dragelement":504,"../../components/drawing":506,"../../lib":568,"../../lib/events":562,"../../lib/svg_text_utils":581,"./axes":592,"./constants":597,"./dragbox":598,d3:119,"fast-isnumeric":123,tinycolor2:454}],600:[function(t,e,r){"use strict";var n=t("../plots"),i=t("./constants");r.name="cartesian",r.attr=["xaxis","yaxis"],r.idRoot=["x","y"],r.idRegex=i.idRegex,r.attrRegex=i.attrRegex,r.attributes=t("./attributes"),r.plot=function(t){function e(t,e){for(var r=[],n=0;n<t.length;n++){var i=t[n],o=i[0].trace;o.xaxis+o.yaxis===e&&r.push(i)}return r}function r(t,e){for(var r=[],n=0;n<t.length;n++){var i=t[n],o=i[0].trace;o._module===e&&o.visible===!0&&r.push(i)}return r}for(var i=t._fullLayout,o=n.getSubplotIds(i,"cartesian"),a=t.calcdata,s=i._modules,l=0;l<o.length;l++){var u=o[l],c=i._plots[u],h=e(a,u);c.plot&&c.plot.selectAll("g.trace").remove();for(var f=0;f<s.length;f++){var d=s[f];if("cartesian"===d.basePlotModule.name){var p=r(h,d);d.plot(t,c,p)}}}}},{"../plots":648,"./attributes":591,"./constants":597}],601:[function(t,e,r){"use strict";var n=t("../font_attributes"),i=t("../../components/color/attributes"),o=t("../../lib/extend").extendFlat,a=t("../../components/rangeslider/attributes"),s=t("../../components/rangeselector/attributes"),l=t("./constants");e.exports={color:{valType:"color",dflt:i.defaultLine},title:{valType:"string"},titlefont:o({},n,{}),type:{valType:"enumerated",values:["-","linear","log","date","category"],dflt:"-"},autorange:{valType:"enumerated",values:[!0,!1,"reversed"],dflt:!0},rangemode:{valType:"enumerated",values:["normal","tozero","nonnegative"],dflt:"normal"},range:{valType:"info_array",items:[{valType:"number"},{valType:"number"}]},rangeslider:a,rangeselector:s,fixedrange:{valType:"boolean",dflt:!1},tickmode:{valType:"enumerated",values:["auto","linear","array"]},nticks:{valType:"integer",min:0,dflt:0},tick0:{valType:"number",dflt:0},dtick:{valType:"any",dflt:1},tickvals:{valType:"data_array"},ticktext:{valType:"data_array"},ticks:{valType:"enumerated",values:["outside","inside",""]},mirror:{valType:"enumerated",values:[!0,"ticks",!1,"all","allticks"],dflt:!1},ticklen:{valType:"number",min:0,dflt:5},tickwidth:{valType:"number",min:0,dflt:1},tickcolor:{valType:"color",dflt:i.defaultLine},showticklabels:{valType:"boolean",dflt:!0},tickfont:o({},n,{}),tickangle:{valType:"angle",dflt:"auto"},tickprefix:{valType:"string",dflt:""},showtickprefix:{valType:"enumerated",values:["all","first","last","none"],dflt:"all"},ticksuffix:{valType:"string",dflt:""},showticksuffix:{valType:"enumerated",values:["all","first","last","none"],dflt:"all"},showexponent:{valType:"enumerated",values:["all","first","last","none"],dflt:"all"},exponentformat:{valType:"enumerated",values:["none","e","E","power","SI","B"],dflt:"B"},tickformat:{valType:"string",dflt:""},hoverformat:{valType:"string",dflt:""},showline:{valType:"boolean",dflt:!1},linecolor:{valType:"color",dflt:i.defaultLine},linewidth:{valType:"number",min:0,dflt:1},showgrid:{valType:"boolean"},gridcolor:{valType:"color",dflt:i.lightLine},gridwidth:{valType:"number",min:0,dflt:1},zeroline:{valType:"boolean"},zerolinecolor:{valType:"color",dflt:i.defaultLine},zerolinewidth:{valType:"number",dflt:1},anchor:{valType:"enumerated",values:["free",l.idRegex.x.toString(),l.idRegex.y.toString()]},side:{valType:"enumerated",values:["top","bottom","left","right"]},overlaying:{valType:"enumerated",values:["free",l.idRegex.x.toString(),l.idRegex.y.toString()]},domain:{valType:"info_array",items:[{valType:"number",min:0,max:1},{valType:"number",min:0,max:1}],dflt:[0,1]},position:{valType:"number",min:0,max:1,dflt:0},categoryorder:{valType:"enumerated",values:["trace","category ascending","category descending","array"],dflt:"trace"},categoryarray:{valType:"data_array"},_deprecated:{autotick:{valType:"boolean"}}}},{"../../components/color/attributes":482,"../../components/rangeselector/attributes":531,"../../components/rangeslider/attributes":538,"../../lib/extend":563,"../font_attributes":610,"./constants":597}],602:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../plots"),o=t("../../components/color"),a=t("../../components/rangeslider"),s=t("../../components/rangeselector"),l=t("./constants"),u=t("./layout_attributes"),c=t("./axis_defaults"),h=t("./position_defaults"),f=t("./axis_ids");e.exports=function(t,e,r){function d(t,e){var r=Number(t.substr(5)||1),n=Number(e.substr(5)||1);return r-n}var p,v=Object.keys(t),m=[],g=[],y=[],b=[],x={},_={};for(p=0;p<r.length;p++){var w,M,k=r[p];if(i.traceIs(k,"cartesian"))w=m,M=g;else{if(!i.traceIs(k,"gl2d"))continue;w=y,M=b}var A=f.id2name(k.xaxis),T=f.id2name(k.yaxis);if(A&&-1===w.indexOf(A)&&w.push(A),T&&-1===M.indexOf(T)&&M.push(T),i.traceIs(k,"2dMap")&&(x[A]=!0,x[T]=!0),i.traceIs(k,"oriented")){var E="h"===k.orientation?T:A;_[E]=!0}}var S=e._has("gl3d")||e._has("geo");if(!S)for(p=0;p<v.length;p++){var L=v[p];-1===y.indexOf(L)&&-1===m.indexOf(L)&&l.xAxisMatch.test(L)?m.push(L):-1===b.indexOf(L)&&-1===g.indexOf(L)&&l.yAxisMatch.test(L)&&g.push(L)}m.length&&g.length&&n.pushUnique(e._basePlotModules,i.subplotsRegistry.cartesian);var z=m.concat(y).sort(d),I=g.concat(b).sort(d),P=z.concat(I),C=o.background;z.length&&I.length&&(C=n.coerce(t,e,i.layoutAttributes,"plot_bgcolor"));var R=o.combine(C,e.paper_bgcolor);P.forEach(function(i){function o(t,e){return n.coerce(s,l,u,t,e)}var a=i.charAt(0),s=t[i]||{},l={},d={letter:a,font:e.font,outerTicks:x[i],showGrid:!_[i],name:i,data:r,bgColor:R},p={letter:a,counterAxes:{x:I,y:z}[a].map(f.name2id),overlayableAxes:{x:z,y:I}[a].filter(function(e){return e!==i&&!(t[e]||{}).overlaying}).map(f.name2id)};c(s,l,o,d),h(s,l,o,p),e[i]=l,t[i]||"-"===s.type||(t[i]={type:s.type})}),P.forEach(function(r){var n=r.charAt(0),i=t[r],o=e[r],l={x:I,y:z}[n];a.supplyLayoutDefaults(t,e,r,l),"x"===n&&"date"===o.type&&s.supplyLayoutDefaults(i,o,e,l)})}},{"../../components/color":483,"../../components/rangeselector":537,"../../components/rangeslider":542,"../../lib":568,"../plots":648,"./axis_defaults":593,"./axis_ids":594,"./constants":597,"./layout_attributes":601,"./position_defaults":604}],603:[function(t,e,r){"use strict";function n(t,e,r){var n,o,a,s,l,u=[],c=r.map(function(e){return e[t]}),h=i.bisector(e).left;for(n=0;n<c.length;n++)for(a=c[n],o=0;o<a.length;o++)s=a[o],null!==s&&void 0!==s&&(l=h(u,s),l<u.length-1&&u[l]===s||u.splice(l,0,s));return u}var i=t("d3");e.exports=function(t,e,r,o){switch(e){case"array":return Array.isArray(r)?r.slice():[];case"category ascending":return n(t,i.ascending,o);case"category descending":return n(t,i.descending,o);case"trace":return[];default:return[]}}},{d3:119}],604:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../lib");e.exports=function(t,e,r,o){var a=o.counterAxes||[],s=o.overlayableAxes||[],l=o.letter,u=i.coerce(t,e,{anchor:{valType:"enumerated",values:["free"].concat(a),dflt:n(t.position)?"free":a[0]||"free"}},"anchor");"free"===u&&r("position"),i.coerce(t,e,{side:{valType:"enumerated",values:"x"===l?["bottom","top"]:["left","right"],dflt:"x"===l?"bottom":"left"}},"side");var c=!1;if(s.length&&(c=i.coerce(t,e,{overlaying:{valType:"enumerated",values:[!1].concat(s),dflt:!1}},"overlaying")),!c){var h=r("domain");h[0]>h[1]-.01&&(e.domain=[0,1]),i.noneOrAll(t.domain,e.domain,[0,1])}return e}},{"../../lib":568,"fast-isnumeric":123}],605:[function(t,e,r){"use strict";function n(t){return t._id}var i=t("../../lib/polygon"),o=t("../../components/color"),a=t("./axes"),s=t("./constants"),l=i.filter,u=i.tester,c=s.MINSELECT;e.exports=function(t,e,r,i,h){function f(t){var e="y"===t._id.charAt(0)?1:0;return function(r){return t.p2d(r[e])}}function d(t,e){return t-e}var p,v=i.gd._fullLayout._zoomlayer,m=i.element.getBoundingClientRect(),g=i.plotinfo.x()._offset,y=i.plotinfo.y()._offset,b=e-m.left,x=r-m.top,_=b,w=x,M="M"+b+","+x,k=i.xaxes[0]._length,A=i.yaxes[0]._length,T=i.xaxes.map(n),E=i.yaxes.map(n),S=i.xaxes.concat(i.yaxes);"lasso"===h&&(p=l([[b,x]],s.BENDPX));var L=v.selectAll("path.select-outline").data([1,2]);L.enter().append("path").attr("class",function(t){return"select-outline select-outline-"+t}).attr("transform","translate("+g+", "+y+")").attr("d",M+"Z");var z,I,P,C,R,D=v.append("path").attr("class","zoombox-corners").style({fill:o.background,stroke:o.defaultLine,"stroke-width":1}).attr("transform","translate("+g+", "+y+")").attr("d","M0,0Z"),O=[],F=i.gd,j=[];for(z=0;z<F.calcdata.length;z++)if(I=F.calcdata[z],P=I[0].trace,P._module&&P._module.selectPoints)if(i.subplot){if(P.subplot!==i.subplot)continue;O.push({selectPoints:P._module.selectPoints,cd:I,xaxis:i.xaxes[0],yaxis:i.yaxes[0]})}else{if(-1===T.indexOf(P.xaxis))continue;if(-1===E.indexOf(P.yaxis))continue;O.push({selectPoints:P._module.selectPoints,cd:I,xaxis:a.getFromId(F,P.xaxis),yaxis:a.getFromId(F,P.yaxis)})}i.moveFn=function(t,e){var r,n;_=Math.max(0,Math.min(k,t+b)),w=Math.max(0,Math.min(A,e+x));var o=Math.abs(_-b),a=Math.abs(w-x);for("select"===h?(a<Math.min(.6*o,c)?(r=u([[b,0],[b,A],[_,A],[_,0]]),D.attr("d","M"+r.xmin+","+(x-c)+"h-4v"+2*c+"h4ZM"+(r.xmax-1)+","+(x-c)+"h4v"+2*c+"h-4Z")):o<Math.min(.6*a,c)?(r=u([[0,x],[0,w],[k,w],[k,x]]),D.attr("d","M"+(b-c)+","+r.ymin+"v-4h"+2*c+"v4ZM"+(b-c)+","+(r.ymax-1)+"v4h"+2*c+"v-4Z")):(r=u([[b,x],[b,w],[_,w],[_,x]]),D.attr("d","M0,0Z")),L.attr("d","M"+r.xmin+","+r.ymin+"H"+(r.xmax-1)+"V"+(r.ymax-1)+"H"+r.xmin+"Z")):"lasso"===h&&(p.addPt([_,w]),r=u(p.filtered),L.attr("d","M"+p.filtered.join("L")+"Z")),j=[],z=0;z<O.length;z++)C=O[z],[].push.apply(j,C.selectPoints(C,r));if(R={points:j},"select"===h){var s,l=R.range={};for(z=0;z<S.length;z++)n=S[z],s=n._id.charAt(0),l[n._id]=[n.p2d(r[s+"min"]),n.p2d(r[s+"max"])].sort(d)}else{var v=R.lassoPoints={};for(z=0;z<S.length;z++)n=S[z],v[n._id]=p.filtered.map(f(n))}i.gd.emit("plotly_selecting",R)},i.doneFn=function(t,e){if(D.remove(),t||2!==e)i.gd.emit("plotly_selected",R);else{for(L.remove(),z=0;z<O.length;z++)C=O[z],C.selectPoints(C,!1);F.emit("plotly_deselect",null)}}}},{"../../components/color":483,"../../lib/polygon":574,"./axes":592,"./constants":597}],606:[function(t,e,r){"use strict";var n=t("d3"),i=t("fast-isnumeric"),o=t("../../lib"),a=t("./constants"),s=t("./clean_datum"),l=t("./axis_ids");e.exports=function(t){function e(e,r){if(e>0)return Math.log(e)/Math.LN10;if(0>=e&&r&&t.range&&2===t.range.length){var n=t.range[0],i=t.range[1];return.5*(n+i-3*c*Math.abs(n-i))}return a.BADNUM}function r(t){return Math.pow(10,t)}function u(t){return i(t)?Number(t):a.BADNUM}var c=10;if(t.c2l="log"===t.type?e:u,t.l2c="log"===t.type?r:u,t.l2d=function(e){return t.c2d(t.l2c(e))},t.p2d=function(e){return t.l2d(t.p2l(e))},t.setScale=function(){var e,r=t._gd._fullLayout._size;if(t._categories||(t._categories=[]),t.overlaying){var n=l.getFromId(t._gd,t.overlaying);t.domain=n.domain}for(t.range&&2===t.range.length&&t.range[0]!==t.range[1]||(t.range=[-1,1]),e=0;2>e;e++)i(t.range[e])||(t.range[e]=i(t.range[1-e])?t.range[1-e]*(e?10:.1):e?1:-1),t.range[e]<-(Number.MAX_VALUE/2)?t.range[e]=-(Number.MAX_VALUE/2):t.range[e]>Number.MAX_VALUE/2&&(t.range[e]=Number.MAX_VALUE/2);if("y"===t._id.charAt(0)?(t._offset=r.t+(1-t.domain[1])*r.h,t._length=r.h*(t.domain[1]-t.domain[0]),t._m=t._length/(t.range[0]-t.range[1]),t._b=-t._m*t.range[1]):(t._offset=r.l+t.domain[0]*r.w,t._length=r.w*(t.domain[1]-t.domain[0]),t._m=t._length/(t.range[1]-t.range[0]),t._b=-t._m*t.range[0]),!isFinite(t._m)||!isFinite(t._b))throw o.notifier("Something went wrong with axis scaling","long"),t._gd._replotting=!1,new Error("axis scaling")},t.l2p=function(e){return i(e)?n.round(t._b+t._m*e,2):a.BADNUM},t.p2l=function(e){return(e-t._b)/t._m},t.c2p=function(e,r){return t.l2p(t.c2l(e,r))},t.p2c=function(e){return t.l2c(t.p2l(e))},-1!==["linear","log","-"].indexOf(t.type))t.c2d=u,t.d2c=function(t){return t=s(t),i(t)?Number(t):a.BADNUM},t.d2l=function(e,r){return"log"===t.type?t.c2l(t.d2c(e),r):t.d2c(e)};else if("date"===t.type){if(t.c2d=function(t){return i(t)?o.ms2DateTime(t):a.BADNUM},t.d2c=function(t){return i(t)?Number(t):o.dateTime2ms(t)},t.d2l=t.d2c,t.range&&t.range.length>1)try{var h=t.range.map(o.dateTime2ms);!i(t.range[0])&&i(h[0])&&(t.range[0]=h[0]),!i(t.range[1])&&i(h[1])&&(t.range[1]=h[1])}catch(f){o.error(f,t.range)}}else"category"===t.type&&(t.c2d=function(e){return t._categories[Math.round(e)]},t.d2c=function(e){null!==e&&void 0!==e&&-1===t._categories.indexOf(e)&&t._categories.push(e);var r=t._categories.indexOf(e);return-1===r?a.BADNUM:r},t.d2l=t.d2c);t.makeCalcdata=function(e,r){var n,i,o;if(r in e)for(n=e[r],i=new Array(n.length),o=0;o<n.length;o++)i[o]=t.d2c(n[o]);else{var a=r+"0"in e?t.d2c(e[r+"0"]):0,s=e["d"+r]?Number(e["d"+r]):1;for(n=e[{x:"y",y:"x"}[r]],i=new Array(n.length),o=0;o<n.length;o++)i[o]=a+o*s}return i},t._min=[],t._max=[],t._minDtick=null,t._forceTick0=null}},{"../../lib":568,"./axis_ids":594,"./clean_datum":596,"./constants":597,d3:119,"fast-isnumeric":123}],607:[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]]};return r.every(n)||1===r.length?t[r[0]]:void 0}var i=t("../../lib");e.exports=function(t,e,r,o,a){var s=n(t),l=r("tickprefix");l&&r("showtickprefix",s);var u=r("ticksuffix");u&&r("showticksuffix",s);var c=r("showticklabels");if(c){var h=a.font||{},f=e.color===t.color?e.color:h.color;if(i.coerceFont(r,"tickfont",{family:h.family,size:h.size,color:f}),r("tickangle"),"category"!==o){var d=r("tickformat");d||"date"===o||(r("showexponent",s),r("exponentformat"))}}"category"===o||a.noHover||r("hoverformat")}},{"../../lib":568}],608:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("./layout_attributes");e.exports=function(t,e,r,o){var a=n.coerce2(t,e,i,"ticklen"),s=n.coerce2(t,e,i,"tickwidth"),l=n.coerce2(t,e,i,"tickcolor",e.color),u=r("ticks",o.outerTicks||a||s||l?"outside":"");u||(delete e.ticklen,delete e.tickwidth,delete e.tickcolor)}},{"../../lib":568,"./layout_attributes":601}],609:[function(t,e,r){"use strict";var n=t("fast-isnumeric");e.exports=function(t,e,r,i){var o="auto";"array"!==t.tickmode||"log"!==i&&"date"!==i||(t.tickmode="auto"),Array.isArray(t.tickvals)?o="array":t.dtick&&n(t.dtick)&&(o="linear");var a=r("tickmode",o);if("auto"===a)r("nticks");else if("linear"===a)r("tick0"),r("dtick");else{var s=r("tickvals");void 0===s?e.tickmode="auto":r("ticktext")}}},{"fast-isnumeric":123}],610:[function(t,e,r){"use strict";e.exports={family:{valType:"string",noBlank:!0,strict:!0},size:{valType:"number",min:1},color:{valType:"color"}}},{}],611:[function(t,e,r){"use strict";var n=e.exports={};n.projNames={equirectangular:"equirectangular",mercator:"mercator",orthographic:"orthographic","natural earth":"naturalEarth",kavrayskiy7:"kavrayskiy7",miller:"miller",robinson:"robinson",eckert4:"eckert4","azimuthal equal area":"azimuthalEqualArea","azimuthal equidistant":"azimuthalEquidistant","conic equal area":"conicEqualArea","conic conformal":"conicConformal","conic equidistant":"conicEquidistant",gnomonic:"gnomonic",stereographic:"stereographic",mollweide:"mollweide",hammer:"hammer","transverse mercator":"transverseMercator","albers usa":"albersUsa","winkel tripel":"winkel3"},n.axesNames=["lonaxis","lataxis"],n.lonaxisSpan={orthographic:180,"azimuthal equal area":360,"azimuthal equidistant":360,"conic conformal":180,gnomonic:160,stereographic:180,"transverse mercator":180,"*":360},n.lataxisSpan={"conic conformal":150,stereographic:179.5,"*":180},n.scopeDefaults={world:{lonaxisRange:[-180,180],lataxisRange:[-90,90],projType:"equirectangular",projRotate:[0,0,0]},usa:{lonaxisRange:[-180,-50],lataxisRange:[15,80],projType:"albers usa"},europe:{lonaxisRange:[-30,60],lataxisRange:[30,80],projType:"conic conformal",projRotate:[15,0,0],projParallels:[0,60]},asia:{lonaxisRange:[22,160],lataxisRange:[-15,55],projType:"mercator",projRotate:[0,0,0]},africa:{lonaxisRange:[-30,60],lataxisRange:[-40,40],projType:"mercator",projRotate:[0,0,0]},"north america":{lonaxisRange:[-180,-45],lataxisRange:[5,85],projType:"conic conformal",projRotate:[-100,0,0],projParallels:[29.5,45.5]},"south america":{lonaxisRange:[-100,-30],lataxisRange:[-60,15],projType:"mercator",projRotate:[0,0,0]}},n.clipPad=.001,n.precision=.1,n.landColor="#F0DC82",n.waterColor="#3399FF",n.locationmodeToLayer={"ISO-3":"countries","USA-states":"subunits","country names":"countries"},n.sphereSVG={type:"Sphere"},n.fillLayers=["ocean","land","lakes"],n.lineLayers=["subunits","countries","coastlines","rivers","frame"],n.baseLayers=["ocean","land","lakes","subunits","countries","coastlines","rivers","lataxis","lonaxis","frame"],n.layerNameToAdjective={ocean:"ocean",land:"land",lakes:"lake",subunits:"subunit",countries:"country",coastlines:"coastline",rivers:"river",frame:"frame"},n.baseLayersOverChoropleth=["rivers","lakes"]},{}],612:[function(t,e,r){"use strict";function n(t,e){this.id=t.id,this.graphDiv=t.graphDiv,this.container=t.container,this.topojsonURL=t.topojsonURL,p(u),this.hoverContainer=null,this.topojsonName=null,this.topojson=null,this.projectionType=null,this.projection=null,this.clipAngle=null,this.setScale=null,this.path=null,this.zoom=null,this.zoomReset=null,this.makeFramework(),this.updateFx(e.hovermode),this.traceHash={}}function i(t,e,r){return u.geo.graticule().extent([[t[0],e[0]],[t[1],e[1]]]).step(r)}function o(t,e,r){var n=y.layerNameToAdjective[e];t.select("."+e).selectAll("path").attr("stroke","none").call(c.fill,r[n+"color"])}function a(t,e,r){var n=y.layerNameToAdjective[e];t.select("."+e).selectAll("path").attr("fill","none").call(c.stroke,r[n+"color"]).call(h.dashLine,"",r[n+"width"])}function s(t,e,r){t.select("."+e+"graticule").selectAll("path").attr("fill","none").call(c.stroke,r[e].gridcolor).call(h.dashLine,"",r[e].gridwidth)}function l(t){var e={type:"linear",showexponent:"all",exponentformat:f.layoutAttributes.exponentformat.dflt,_gd:{_fullLayout:t}};return f.setConvert(e),e}var u=t("d3"),c=t("../../components/color"),h=t("../../components/drawing"),f=t("../../plots/cartesian/axes"),d=t("../../lib/filter_visible"),p=t("./projections"),v=t("./set_scale"),m=t("./zoom"),g=t("./zoom_reset"),y=t("./constants"),b=t("../../constants/xmlns_namespaces"),x=t("../../lib/topojson_utils"),_=t("topojson").feature;e.exports=n;var w=n.prototype;w.plot=function(t,e,r){var n,i,o=this,a=e[o.id],s=e._size;o.projection=null,o.setScale=v(a,s),o.makeProjection(a),o.makePath(),o.adjustLayout(a,s),o.zoom=m(o,a),o.zoomReset=g(o,a),o.mockAxis=l(e),o.framework.call(o.zoom).on("dblclick.zoom",o.zoomReset),n=x.getTopojsonName(a),null===o.topojson||n!==o.topojsonName?(o.topojsonName=n,void 0!==PlotlyGeoAssets.topojson[o.topojsonName]?(o.topojson=PlotlyGeoAssets.topojson[o.topojsonName],o.onceTopojsonIsLoaded(t,a)):(i=x.getTopojsonPath(o.topojsonURL,o.topojsonName),r.push(new Promise(function(e,r){u.json(i,function(n,s){return n?void r(404===n.status?new Error(["plotly.js could not find topojson file at",i,".","Make sure the *topojsonURL* plot config option","is set properly."].join(" ")):new Error(["unexpected error while fetching topojson file at",i].join(" "))):(o.topojson=s,PlotlyGeoAssets.topojson[o.topojsonName]=s,o.onceTopojsonIsLoaded(t,a),void e())})})))):o.onceTopojsonIsLoaded(t,a)},w.onceTopojsonIsLoaded=function(t,e){var r;this.drawLayout(e);
var n=this.traceHash,i={};for(r=0;r<t.length;r++){var o=t[r];i[o.type]=i[o.type]||[],i[o.type].push(o)}var a=Object.keys(n),s=Object.keys(i);for(r=0;r<a.length;r++){var l=a[r];if(-1===s.indexOf(l)){var u=n[l][0];u.visible=!1,i[l]=[u]}}for(s=Object.keys(i),r=0;r<s.length;r++){var c=i[s[r]],h=c[0]._module;h.plot(this,d(c),e)}this.traceHash=i,this.render()},w.updateFx=function(t){this.showHover=t!==!1},w.makeProjection=function(t){var e,r=t.projection,n=r.type,i=null===this.projection||n!==this.projectionType;i?(this.projectionType=n,e=this.projection=u.geo[y.projNames[n]]()):e=this.projection,e.translate(r._translate0).precision(y.precision),t._isAlbersUsa||e.rotate(r._rotate).center(r._center),t._clipAngle?(this.clipAngle=t._clipAngle,e.clipAngle(t._clipAngle-y.clipPad)):this.clipAngle=null,r.parallels&&e.parallels(r.parallels),i&&this.setScale(e),e.translate(r._translate).scale(r._scale)},w.makePath=function(){this.path=u.geo.path().projection(this.projection)},w.makeFramework=function(){var t=this.geoDiv=u.select(this.container).append("div");t.attr("id",this.id).style("position","absolute");var e=this.hoverContainer=t.append("svg");e.attr(b.svgAttrs).style({position:"absolute","z-index":20,"pointer-events":"none"});var r=this.framework=t.append("svg");r.attr(b.svgAttrs).attr({position:"absolute",preserveAspectRatio:"none"}),r.append("g").attr("class","bglayer").append("rect"),r.append("g").attr("class","baselayer"),r.append("g").attr("class","choroplethlayer"),r.append("g").attr("class","baselayeroverchoropleth"),r.append("g").attr("class","scattergeolayer"),r.on("dblclick.zoom",null)},w.adjustLayout=function(t,e){var r=t.domain;this.geoDiv.style({left:e.l+e.w*r.x[0]+t._marginX+"px",top:e.t+e.h*(1-r.y[1])+t._marginY+"px",width:t._width+"px",height:t._height+"px"}),this.hoverContainer.attr({width:t._width,height:t._height}),this.framework.attr({width:t._width,height:t._height}),this.framework.select(".bglayer").select("rect").attr({width:t._width,height:t._height}).call(c.fill,t.bgcolor)},w.drawTopo=function(t,e,r){if(r["show"+e]===!0){var n=this.topojson,i="frame"===e?y.sphereSVG:_(n,n.objects[e]);t.append("g").datum(i).attr("class",e).append("path").attr("class","basepath")}},w.drawGraticule=function(t,e,r){var n=r[e];if(n.showgrid===!0){var o=y.scopeDefaults[r.scope],a=o.lonaxisRange,s=o.lataxisRange,l="lonaxis"===e?[n.dtick]:[0,n.dtick],u=i(a,s,l);t.append("g").datum(u).attr("class",e+"graticule").append("path").attr("class","graticulepath")}},w.drawLayout=function(t){var e,r=this.framework.select("g.baselayer"),n=y.baseLayers,i=y.axesNames;r.selectAll("*").remove();for(var o=0;o<n.length;o++)e=n[o],-1!==i.indexOf(e)?this.drawGraticule(r,e,t):this.drawTopo(r,e,t);this.styleLayout(t)},w.styleLayer=function(t,e,r){var n=y.fillLayers,i=y.lineLayers;-1!==n.indexOf(e)?o(t,e,r):-1!==i.indexOf(e)&&a(t,e,r)},w.styleLayout=function(t){for(var e,r=this.framework.select("g.baselayer"),n=y.baseLayers,i=y.axesNames,o=0;o<n.length;o++)e=n[o],-1!==i.indexOf(e)?s(r,e,t):this.styleLayer(r,e,t)},w.render=function(){function t(t){var e=o([t.lon,t.lat]);return e?"translate("+e[0]+","+e[1]+")":null}function e(t){var e=o.rotate(),r=u.geo.distance([t.lon,t.lat],[-e[0],-e[1]]),n=s*Math.PI/180;return r>n?"0":"1.0"}var r=this.framework,n=r.select("g.choroplethlayer"),i=r.select("g.scattergeolayer"),o=this.projection,a=this.path,s=this.clipAngle;r.selectAll("path.basepath").attr("d",a),r.selectAll("path.graticulepath").attr("d",a),n.selectAll("path.choroplethlocation").attr("d",a),n.selectAll("path.basepath").attr("d",a),i.selectAll("path.js-line").attr("d",a),null!==s?(i.selectAll("path.point").style("opacity",e).attr("transform",t),i.selectAll("text").style("opacity",e).attr("transform",t)):(i.selectAll("path.point").attr("transform",t),i.selectAll("text").attr("transform",t))}},{"../../components/color":483,"../../components/drawing":506,"../../constants/xmlns_namespaces":556,"../../lib/filter_visible":564,"../../lib/topojson_utils":582,"../../plots/cartesian/axes":592,"./constants":611,"./projections":619,"./set_scale":620,"./zoom":621,"./zoom_reset":622,d3:119,topojson:455}],613:[function(t,e,r){"use strict";var n=t("./geo"),i=t("../../plots/plots");r.name="geo",r.attr="geo",r.idRoot="geo",r.idRegex=/^geo([2-9]|[1-9][0-9]+)?$/,r.attrRegex=/^geo([2-9]|[1-9][0-9]+)?$/,r.attributes=t("./layout/attributes"),r.layoutAttributes=t("./layout/layout_attributes"),r.supplyLayoutDefaults=t("./layout/defaults"),r.plot=function(t){var e=t._fullLayout,r=t._fullData,o=i.getSubplotIds(e,"geo");void 0===window.PlotlyGeoAssets&&(window.PlotlyGeoAssets={topojson:{}});for(var a=0;a<o.length;a++){var s=o[a],l=i.getSubplotData(r,"geo",s),u=e[s]._geo;void 0===u&&(u=new n({id:s,graphDiv:t,container:e._geocontainer.node(),topojsonURL:t._context.topojsonURL},e),e[s]._geo=u),u.plot(l,e,t._promises)}},r.clean=function(t,e,r,n){for(var o=i.getSubplotIds(n,"geo"),a=0;a<o.length;a++){var s=o[a],l=n[s]._geo;!e[s]&&l&&l.geoDiv.remove()}},r.toSVG=function(t){for(var e=t._fullLayout,r=i.getSubplotIds(e,"geo"),n=e._size,o=0;o<r.length;o++){var a=e[r[o]],s=a.domain,l=a._geo.framework;l.attr("style",null),l.attr({x:n.l+n.w*s.x[0]+a._marginX,y:n.t+n.h*(1-s.y[1])+a._marginY,width:a._width,height:a._height}),e._geoimages.node().appendChild(l.node())}}},{"../../plots/plots":648,"./geo":612,"./layout/attributes":614,"./layout/defaults":617,"./layout/layout_attributes":618}],614:[function(t,e,r){"use strict";e.exports={geo:{valType:"subplotid",dflt:"geo"}}},{}],615:[function(t,e,r){"use strict";var n=t("../../../components/color/attributes");e.exports={range:{valType:"info_array",items:[{valType:"number"},{valType:"number"}]},showgrid:{valType:"boolean",dflt:!1},tick0:{valType:"number"},dtick:{valType:"number"},gridcolor:{valType:"color",dflt:n.lightLine},gridwidth:{valType:"number",min:0,dflt:1}}},{"../../../components/color/attributes":482}],616:[function(t,e,r){"use strict";var n=t("../../../lib"),i=t("../constants"),o=t("./axis_attributes");e.exports=function(t,e){function r(t,e){return n.coerce(s,l,o,t,e)}function a(t){var r,n,o,a,s,l,u=e.scope;return"world"===u?(r=e.projection,n=r.type,o=r.rotation,s=i[t+"Span"],l=void 0!==s[n]?s[n]/2:s["*"]/2,a="lonaxis"===t?o.lon:o.lat,[a-l,a+l]):i.scopeDefaults[u][t+"Range"]}for(var s,l,u=i.axesNames,c=0;c<u.length;c++){var h=u[c];s=t[h]||{},l={};var f=a(h),d=r("range",f);n.noneOrAll(s.range,l.range,[0,1]),r("tick0",d[0]),r("dtick","lonaxis"===h?30:10);var p=r("showgrid");p&&(r("gridcolor"),r("gridwidth")),e[h]=l,e[h]._fullRange=f}}},{"../../../lib":568,"../constants":611,"./axis_attributes":615}],617:[function(t,e,r){"use strict";function n(t,e,r){var n,i=r("scope"),a="world"!==i,l=o.scopeDefaults[i],u=r("resolution"),c=r("projection.type",l.projType),h="albers usa"===c,f=-1!==c.indexOf("conic");if(f){var d=l.projParallels||[0,60];r("projection.parallels",d)}if(h)e.scope="usa";else{var p=l.projRotate||[0,0,0];r("projection.rotation.lon",p[0]),r("projection.rotation.lat",p[1]),r("projection.rotation.roll",p[2]),n=r("showcoastlines",!a),n&&(r("coastlinecolor"),r("coastlinewidth")),n=r("showocean"),n&&r("oceancolor")}r("projection.scale"),n=r("showland"),n&&r("landcolor"),n=r("showlakes"),n&&r("lakecolor"),n=r("showrivers"),n&&(r("rivercolor"),r("riverwidth")),n=r("showcountries",a),n&&(r("countrycolor"),r("countrywidth")),("usa"===i||"north america"===i&&50===u)&&(r("showsubunits",!0),r("subunitcolor"),r("subunitwidth")),a||(n=r("showframe",!0),n&&(r("framecolor"),r("framewidth"))),r("bgcolor"),s(t,e),e._isHighRes=50===u,e._clipAngle=o.lonaxisSpan[c]/2,e._isAlbersUsa=h,e._isConic=f,e._isScoped=a;var v=e.projection.rotation||{};e.projection._rotate=[-v.lon||0,-v.lat||0,v.roll||0]}var i=t("../../subplot_defaults"),o=t("../constants"),a=t("./layout_attributes"),s=t("./axis_defaults");e.exports=function(t,e,r){i(t,e,r,{type:"geo",attributes:a,handleDefaults:n,partition:"y"})}},{"../../subplot_defaults":654,"../constants":611,"./axis_defaults":616,"./layout_attributes":618}],618:[function(t,e,r){"use strict";var n=t("../../../components/color/attributes"),i=t("../constants"),o=t("./axis_attributes");e.exports={domain:{x:{valType:"info_array",items:[{valType:"number",min:0,max:1},{valType:"number",min:0,max:1}],dflt:[0,1]},y:{valType:"info_array",items:[{valType:"number",min:0,max:1},{valType:"number",min:0,max:1}],dflt:[0,1]}},resolution:{valType:"enumerated",values:[110,50],dflt:110,coerceNumber:!0},scope:{valType:"enumerated",values:Object.keys(i.scopeDefaults),dflt:"world"},projection:{type:{valType:"enumerated",values:Object.keys(i.projNames)},rotation:{lon:{valType:"number"},lat:{valType:"number"},roll:{valType:"number"}},parallels:{valType:"info_array",items:[{valType:"number"},{valType:"number"}]},scale:{valType:"number",min:0,max:10,dflt:1}},showcoastlines:{valType:"boolean"},coastlinecolor:{valType:"color",dflt:n.defaultLine},coastlinewidth:{valType:"number",min:0,dflt:1},showland:{valType:"boolean",dflt:!1},landcolor:{valType:"color",dflt:i.landColor},showocean:{valType:"boolean",dflt:!1},oceancolor:{valType:"color",dflt:i.waterColor},showlakes:{valType:"boolean",dflt:!1},lakecolor:{valType:"color",dflt:i.waterColor},showrivers:{valType:"boolean",dflt:!1},rivercolor:{valType:"color",dflt:i.waterColor},riverwidth:{valType:"number",min:0,dflt:1},showcountries:{valType:"boolean"},countrycolor:{valType:"color",dflt:n.defaultLine},countrywidth:{valType:"number",min:0,dflt:1},showsubunits:{valType:"boolean"},subunitcolor:{valType:"color",dflt:n.defaultLine},subunitwidth:{valType:"number",min:0,dflt:1},showframe:{valType:"boolean"},framecolor:{valType:"color",dflt:n.defaultLine},framewidth:{valType:"number",min:0,dflt:1},bgcolor:{valType:"color",dflt:n.background},lonaxis:o,lataxis:o}},{"../../../components/color/attributes":482,"../constants":611,"./axis_attributes":615}],619:[function(t,e,r){"use strict";function n(t){function e(t,e){return{type:"Feature",id:t.id,properties:t.properties,geometry:r(t.geometry,e)}}function r(e,n){if(!e)return null;if("GeometryCollection"===e.type)return{type:"GeometryCollection",geometries:object.geometries.map(function(t){return r(t,n)})};if(!S.hasOwnProperty(e.type))return null;var i=S[e.type];return t.geo.stream(e,n(i)),i.result()}function n(){}function i(t){if((e=t.length)<4)return!1;for(var e,r=0,n=t[e-1][1]*t[0][0]-t[e-1][0]*t[0][1];++r<e;)n+=t[r-1][1]*t[r][0]-t[r-1][0]*t[r][1];return 0>=n}function o(t,e){for(var r=e[0],n=e[1],i=!1,o=0,a=t.length,s=a-1;a>o;s=o++){var l=t[o],u=l[0],c=l[1],h=t[s],f=h[0],d=h[1];c>n^d>n&&(f-u)*(n-c)/(d-c)+u>r&&(i=!i)}return i}function a(t){return t?t/Math.sin(t):1}function s(t){return t>1?P:-1>t?-P:Math.asin(t)}function l(t){return t>1?0:-1>t?I:Math.acos(t)}function u(t,e){var r=(2+P)*Math.sin(e);e/=2;for(var n=0,i=1/0;10>n&&Math.abs(i)>L;n++){var o=Math.cos(e);e-=i=(e+Math.sin(e)*(o+2)-r)/(2*o*(1+o))}return[2/Math.sqrt(I*(4+I))*t*(1+Math.cos(e)),2*Math.sqrt(I/(4+I))*Math.sin(e)]}function c(t,e){function r(r,n){var i=F(r/e,n);return i[0]*=t,i}return arguments.length<2&&(e=t),1===e?F:e===1/0?f:(r.invert=function(r,n){var i=F.invert(r/t,n);return i[0]*=e,i},r)}function h(){var t=2,e=O(c),r=e(t);return r.coefficient=function(r){return arguments.length?e(t=+r):t},r}function f(t,e){return[t*Math.cos(e)/Math.cos(e/=2),2*Math.sin(e)]}function d(t,e){return[3*t/(2*I)*Math.sqrt(I*I/3-e*e),e]}function p(t,e){return[t,1.25*Math.log(Math.tan(I/4+.4*e))]}function v(t){return function(e){var r,n=t*Math.sin(e),i=30;do e-=r=(e+Math.sin(e)-n)/(1+Math.cos(e));while(Math.abs(r)>L&&--i>0);return e/2}}function m(t,e,r){function n(r,n){return[t*r*Math.cos(n=i(n)),e*Math.sin(n)]}var i=v(r);return n.invert=function(n,i){var o=s(i/e);return[n/(t*Math.cos(o)),s((2*o+Math.sin(2*o))/r)]},n}function g(t,e){var r=e*e,n=r*r;return[t*(.8707-.131979*r+n*(-.013791+n*(.003971*r-.001529*n))),e*(1.007226+r*(.015085+n*(-.044475+.028874*r-.005916*n)))]}function y(t,e){var r,n=Math.min(18,36*Math.abs(e)/I),i=Math.floor(n),o=n-i,a=(r=N[i])[0],s=r[1],l=(r=N[++i])[0],u=r[1],c=(r=N[Math.min(19,++i)])[0],h=r[1];return[t*(l+o*(c-a)/2+o*o*(c-2*l+a)/2),(e>0?P:-P)*(u+o*(h-s)/2+o*o*(h-2*u+s)/2)]}function b(t,e){return[t*Math.cos(e),e]}function x(t,e){var r=Math.cos(e),n=a(l(r*Math.cos(t/=2)));return[2*r*Math.sin(t)*n,Math.sin(e)*n]}function _(t,e){var r=x(t,e);return[(r[0]+t/P)/2,(r[1]+e)/2]}t.geo.project=function(t,e){var n=e.stream;if(!n)throw new Error("not yet supported");return(t&&w.hasOwnProperty(t.type)?w[t.type]:r)(t,n)};var w={Feature:e,FeatureCollection:function(t,r){return{type:"FeatureCollection",features:t.features.map(function(t){return e(t,r)})}}},M=[],k=[],A={point:function(t,e){M.push([t,e])},result:function(){var t=M.length?M.length<2?{type:"Point",coordinates:M[0]}:{type:"MultiPoint",coordinates:M}:null;return M=[],t}},T={lineStart:n,point:function(t,e){M.push([t,e])},lineEnd:function(){M.length&&(k.push(M),M=[])},result:function(){var t=k.length?k.length<2?{type:"LineString",coordinates:k[0]}:{type:"MultiLineString",coordinates:k}:null;return k=[],t}},E={polygonStart:n,lineStart:n,point:function(t,e){M.push([t,e])},lineEnd:function(){var t=M.length;if(t){do M.push(M[0].slice());while(++t<4);k.push(M),M=[]}},polygonEnd:n,result:function(){if(!k.length)return null;var t=[],e=[];return k.forEach(function(r){i(r)?t.push([r]):e.push(r)}),e.forEach(function(e){var r=e[0];t.some(function(t){return o(t[0],r)?(t.push(e),!0):void 0})||t.push([e])}),k=[],t.length?t.length>1?{type:"MultiPolygon",coordinates:t}:{type:"Polygon",coordinates:t[0]}:null}},S={Point:A,MultiPoint:A,LineString:T,MultiLineString:T,Polygon:E,MultiPolygon:E,Sphere:E},L=1e-6,z=L*L,I=Math.PI,P=I/2,C=(Math.sqrt(I),I/180),R=180/I,D=t.geo.projection,O=t.geo.projectionMutator;t.geo.interrupt=function(e){function r(t,r){for(var n=0>r?-1:1,i=l[+(0>r)],o=0,a=i.length-1;a>o&&t>i[o][2][0];++o);var s=e(t-i[o][1][0],r);return s[0]+=e(i[o][1][0],n*r>n*i[o][0][1]?i[o][0][1]:r)[0],s}function n(){s=l.map(function(t){return t.map(function(t){var r,n=e(t[0][0],t[0][1])[0],i=e(t[2][0],t[2][1])[0],o=e(t[1][0],t[0][1])[1],a=e(t[1][0],t[1][1])[1];return o>a&&(r=o,o=a,a=r),[[n,o],[i,a]]})})}function i(){for(var e=1e-6,r=[],n=0,i=l[0].length;i>n;++n){var a=l[0][n],s=180*a[0][0]/I,u=180*a[0][1]/I,c=180*a[1][1]/I,h=180*a[2][0]/I,f=180*a[2][1]/I;r.push(o([[s+e,u+e],[s+e,c-e],[h-e,c-e],[h-e,f+e]],30))}for(var n=l[1].length-1;n>=0;--n){var a=l[1][n],s=180*a[0][0]/I,u=180*a[0][1]/I,c=180*a[1][1]/I,h=180*a[2][0]/I,f=180*a[2][1]/I;r.push(o([[h-e,f-e],[h-e,c+e],[s+e,c+e],[s+e,u-e]],30))}return{type:"Polygon",coordinates:[t.merge(r)]}}function o(t,e){for(var r,n,i,o=-1,a=t.length,s=t[0],l=[];++o<a;){r=t[o],n=(r[0]-s[0])/e,i=(r[1]-s[1])/e;for(var u=0;e>u;++u)l.push([s[0]+u*n,s[1]+u*i]);s=r}return l.push(r),l}function a(t,e){return Math.abs(t[0]-e[0])<L&&Math.abs(t[1]-e[1])<L}var s,l=[[[[-I,0],[0,P],[I,0]]],[[[-I,0],[0,-P],[I,0]]]];e.invert&&(r.invert=function(t,n){for(var i=s[+(0>n)],o=l[+(0>n)],u=0,c=i.length;c>u;++u){var h=i[u];if(h[0][0]<=t&&t<h[1][0]&&h[0][1]<=n&&n<h[1][1]){var f=e.invert(t-e(o[u][1][0],0)[0],n);return f[0]+=o[u][1][0],a(r(f[0],f[1]),[t,n])?f:null}}});var u=t.geo.projection(r),c=u.stream;return u.stream=function(e){var r=u.rotate(),n=c(e),o=(u.rotate([0,0]),c(e));return u.rotate(r),n.sphere=function(){t.geo.stream(i(),o)},n},u.lobes=function(t){return arguments.length?(l=t.map(function(t){return t.map(function(t){return[[t[0][0]*I/180,t[0][1]*I/180],[t[1][0]*I/180,t[1][1]*I/180],[t[2][0]*I/180,t[2][1]*I/180]]})}),n(),u):l.map(function(t){return t.map(function(t){return[[180*t[0][0]/I,180*t[0][1]/I],[180*t[1][0]/I,180*t[1][1]/I],[180*t[2][0]/I,180*t[2][1]/I]]})})},u},u.invert=function(t,e){var r=.5*e*Math.sqrt((4+I)/I),n=s(r),i=Math.cos(n);return[t/(2/Math.sqrt(I*(4+I))*(1+i)),s((n+r*(i+2))/(2+P))]},(t.geo.eckert4=function(){return D(u)}).raw=u;var F=t.geo.azimuthalEqualArea.raw;f.invert=function(t,e){var r=2*s(e/2);return[t*Math.cos(r/2)/Math.cos(r),r]},(t.geo.hammer=h).raw=c,d.invert=function(t,e){return[2/3*I*t/Math.sqrt(I*I/3-e*e),e]},(t.geo.kavrayskiy7=function(){return D(d)}).raw=d,p.invert=function(t,e){return[t,2.5*Math.atan(Math.exp(.8*e))-.625*I]},(t.geo.miller=function(){return D(p)}).raw=p;var j=(v(I),m(Math.SQRT2/P,Math.SQRT2,I));(t.geo.mollweide=function(){return D(j)}).raw=j,g.invert=function(t,e){var r,n=e,i=25;do{var o=n*n,a=o*o;n-=r=(n*(1.007226+o*(.015085+a*(-.044475+.028874*o-.005916*a)))-e)/(1.007226+o*(.045255+a*(-0.311325+.259866*o-.005916*11*a)))}while(Math.abs(r)>L&&--i>0);return[t/(.8707+(o=n*n)*(-.131979+o*(-.013791+o*o*o*(.003971-.001529*o)))),n]},(t.geo.naturalEarth=function(){return D(g)}).raw=g;var N=[[.9986,-.062],[1,0],[.9986,.062],[.9954,.124],[.99,.186],[.9822,.248],[.973,.31],[.96,.372],[.9427,.434],[.9216,.4958],[.8962,.5571],[.8679,.6176],[.835,.6769],[.7986,.7346],[.7597,.7903],[.7186,.8435],[.6732,.8936],[.6213,.9394],[.5722,.9761],[.5322,1]];N.forEach(function(t){t[1]*=1.0144}),y.invert=function(t,e){var r=e/P,n=90*r,i=Math.min(18,Math.abs(n/5)),o=Math.max(0,Math.floor(i));do{var a=N[o][1],s=N[o+1][1],l=N[Math.min(19,o+2)][1],u=l-a,c=l-2*s+a,h=2*(Math.abs(r)-s)/u,f=c/u,d=h*(1-f*h*(1-2*f*h));if(d>=0||1===o){n=(e>=0?5:-5)*(d+i);var p,v=50;do i=Math.min(18,Math.abs(n)/5),o=Math.floor(i),d=i-o,a=N[o][1],s=N[o+1][1],l=N[Math.min(19,o+2)][1],n-=(p=(e>=0?P:-P)*(s+d*(l-a)/2+d*d*(l-2*s+a)/2)-e)*R;while(Math.abs(p)>z&&--v>0);break}}while(--o>=0);var m=N[o][0],g=N[o+1][0],y=N[Math.min(19,o+2)][0];return[t/(g+d*(y-m)/2+d*d*(y-2*g+m)/2),n*C]},(t.geo.robinson=function(){return D(y)}).raw=y,b.invert=function(t,e){return[t/Math.cos(e),e]},(t.geo.sinusoidal=function(){return D(b)}).raw=b,x.invert=function(t,e){if(!(t*t+4*e*e>I*I+L)){var r=t,n=e,i=25;do{var o,a=Math.sin(r),s=Math.sin(r/2),u=Math.cos(r/2),c=Math.sin(n),h=Math.cos(n),f=Math.sin(2*n),d=c*c,p=h*h,v=s*s,m=1-p*u*u,g=m?l(h*u)*Math.sqrt(o=1/m):o=0,y=2*g*h*s-t,b=g*c-e,x=o*(p*v+g*h*u*d),_=o*(.5*a*f-2*g*c*s),w=.25*o*(f*s-g*c*p*a),M=o*(d*u+g*v*h),k=_*w-M*x;if(!k)break;var A=(b*_-y*M)/k,T=(y*w-b*x)/k;r-=A,n-=T}while((Math.abs(A)>L||Math.abs(T)>L)&&--i>0);return[r,n]}},(t.geo.aitoff=function(){return D(x)}).raw=x,_.invert=function(t,e){var r=t,n=e,i=25;do{var o,a=Math.cos(n),s=Math.sin(n),u=Math.sin(2*n),c=s*s,h=a*a,f=Math.sin(r),d=Math.cos(r/2),p=Math.sin(r/2),v=p*p,m=1-h*d*d,g=m?l(a*d)*Math.sqrt(o=1/m):o=0,y=.5*(2*g*a*p+r/P)-t,b=.5*(g*s+n)-e,x=.5*o*(h*v+g*a*d*c)+.5/P,_=o*(f*u/4-g*s*p),w=.125*o*(u*p-g*s*h*f),M=.5*o*(c*d+g*v*a)+.5,k=_*w-M*x,A=(b*_-y*M)/k,T=(y*w-b*x)/k;r-=A,n-=T}while((Math.abs(A)>L||Math.abs(T)>L)&&--i>0);return[r,n]},(t.geo.winkel3=function(){return D(_)}).raw=_}e.exports=n},{}],620:[function(t,e,r){"use strict";function n(t,e){var r=t.projection,n=t.lonaxis,a=t.lataxis,l=t.domain,u=t.framewidth||0,c=e.w*(l.x[1]-l.x[0]),h=e.h*(l.y[1]-l.y[0]),f=n.range[0]+s,d=n.range[1]-s,p=a.range[0]+s,v=a.range[1]-s,m=n._fullRange[0]+s,g=n._fullRange[1]-s,y=a._fullRange[0]+s,b=a._fullRange[1]-s;r._translate0=[e.l+c/2,e.t+h/2];var x=d-f,_=v-p,w=[f+x/2,p+_/2],M=r._rotate;r._center=[w[0]+M[0],w[1]+M[1]];var k=function(e){function n(t){return Math.min(_*c/(t[1][0]-t[0][0]),_*h/(t[1][1]-t[0][1]))}var a,s,l,x,_=e.scale(),w=r._translate0,M=i(f,p,d,v),k=i(m,y,g,b);l=o(e,M),a=n(l),x=o(e,k),r._fullScale=n(x),e.scale(a),l=o(e,M),s=[w[0]-l[0][0]+u,w[1]-l[0][1]+u],r._translate=s,e.translate(s),l=o(e,M),t._isAlbersUsa||e.clipExtent(l),a=r.scale*a,r._scale=a,t._width=Math.round(l[1][0])+u,t._height=Math.round(l[1][1])+u,t._marginX=(c-Math.round(l[1][0]))/2,t._marginY=(h-Math.round(l[1][1]))/2};return k}function i(t,e,r,n){var i=(r-t)/4;return{type:"Polygon",coordinates:[[[t,e],[t,n],[t+i,n],[t+2*i,n],[t+3*i,n],[r,n],[r,e],[r-i,e],[r-2*i,e],[r-3*i,e],[t,e]]]}}function o(t,e){return a.geo.path().projection(t).bounds(e)}var a=t("d3"),s=t("./constants").clipPad;e.exports=n},{"./constants":611,d3:119}],621:[function(t,e,r){"use strict";function n(t,e){var r;return(r=e._isScoped?o:e._clipAngle?s:a)(t,e.projection)}function i(t,e){var r=e._fullScale;return _.behavior.zoom().translate(t.translate()).scale(t.scale()).scaleExtent([.5*r,100*r])}function o(t,e){function r(){_.select(this).style(k)}function n(){a.scale(_.event.scale).translate(_.event.translate),t.render()}function o(){_.select(this).style(A)}var a=t.projection,s=i(a,e);return s.on("zoomstart",r).on("zoom",n).on("zoomend",o),s}function a(t,e){function r(t){return m.invert(t)}function n(t){var e=m(r(t));return Math.abs(e[0]-t[0])>y||Math.abs(e[1]-t[1])>y}function o(){_.select(this).style(k),l=_.mouse(this),u=m.rotate(),c=m.translate(),h=u,f=r(l)}function a(){return d=_.mouse(this),n(l)?(g.scale(m.scale()),void g.translate(m.translate())):(m.scale(_.event.scale),m.translate([c[0],_.event.translate[1]]),f?r(d)&&(v=r(d),p=[h[0]+(v[0]-f[0]),u[1],u[2]],m.rotate(p),h=p):(l=d,f=r(l)),void t.render())}function s(){_.select(this).style(A)}var l,u,c,h,f,d,p,v,m=t.projection,g=i(m,e),y=2;return g.on("zoomstart",o).on("zoom",a).on("zoomend",s),g}function s(t,e){function r(t){g++||t({type:"zoomstart"})}function n(t){t({type:"zoom"})}function o(t){--g||t({type:"zoomend"})}var a,s=t.projection,d={r:s.rotate(),k:s.scale()},p=i(s,e),v=x(p,"zoomstart","zoom","zoomend"),g=0,y=p.on;return p.on("zoomstart",function(){_.select(this).style(k);var t=_.mouse(this),e=s.rotate(),i=e,o=s.translate(),g=u(e);a=l(s,t),y.call(p,"zoom",function(){var r=_.mouse(this);if(s.scale(d.k=_.event.scale),a){if(l(s,r)){s.rotate(e).translate(o);var u=l(s,r),p=h(a,u),y=m(c(g,p)),b=d.r=f(y,a,i);isFinite(b[0])&&isFinite(b[1])&&isFinite(b[2])||(b=i),s.rotate(b),i=b}}else t=r,a=l(s,t);n(v.of(this,arguments))}),r(v.of(this,arguments))}).on("zoomend",function(){_.select(this).style(A),y.call(p,"zoom",null),o(v.of(this,arguments))}).on("zoom.redraw",function(){t.render()}),_.rebind(p,v,"on")}function l(t,e){var r=t.invert(e);return r&&isFinite(r[0])&&isFinite(r[1])&&g(r)}function u(t){var e=.5*t[0]*w,r=.5*t[1]*w,n=.5*t[2]*w,i=Math.sin(e),o=Math.cos(e),a=Math.sin(r),s=Math.cos(r),l=Math.sin(n),u=Math.cos(n);return[o*s*u+i*a*l,i*s*u-o*a*l,o*a*u+i*s*l,o*s*l-i*a*u]}function c(t,e){var r=t[0],n=t[1],i=t[2],o=t[3],a=e[0],s=e[1],l=e[2],u=e[3];return[r*a-n*s-i*l-o*u,r*s+n*a+i*u-o*l,r*l-n*u+i*a+o*s,r*u+n*l-i*s+o*a]}function h(t,e){if(t&&e){var r=b(t,e),n=Math.sqrt(y(r,r)),i=.5*Math.acos(Math.max(-1,Math.min(1,y(t,e)))),o=Math.sin(i)/n;return n&&[Math.cos(i),r[2]*o,-r[1]*o,r[0]*o]}}function f(t,e,r){var n=v(e,2,t[0]);n=v(n,1,t[1]),n=v(n,0,t[2]-r[2]);var i,o,a=e[0],s=e[1],l=e[2],u=n[0],c=n[1],h=n[2],f=Math.atan2(s,a)*M,p=Math.sqrt(a*a+s*s);Math.abs(c)>p?(o=(c>0?90:-90)-f,i=0):(o=Math.asin(c/p)*M-f,i=Math.sqrt(p*p-c*c));var m=180-o-2*f,g=(Math.atan2(h,u)-Math.atan2(l,i))*M,y=(Math.atan2(h,u)-Math.atan2(l,-i))*M,b=d(r[0],r[1],o,g),x=d(r[0],r[1],m,y);return x>=b?[o,g,r[2]]:[m,y,r[2]]}function d(t,e,r,n){var i=p(r-t),o=p(n-e);return Math.sqrt(i*i+o*o)}function p(t){return(t%360+540)%360-180}function v(t,e,r){var n=r*w,i=t.slice(),o=0===e?1:0,a=2===e?1:2,s=Math.cos(n),l=Math.sin(n);return i[o]=t[o]*s-t[a]*l,i[a]=t[a]*s+t[o]*l,i}function m(t){return[Math.atan2(2*(t[0]*t[1]+t[2]*t[3]),1-2*(t[1]*t[1]+t[2]*t[2]))*M,Math.asin(Math.max(-1,Math.min(1,2*(t[0]*t[2]-t[3]*t[1]))))*M,Math.atan2(2*(t[0]*t[3]+t[1]*t[2]),1-2*(t[2]*t[2]+t[3]*t[3]))*M]}function g(t){var e=t[0]*w,r=t[1]*w,n=Math.cos(r);return[n*Math.cos(e),n*Math.sin(e),Math.sin(r)]}function y(t,e){for(var r=0,n=0,i=t.length;i>n;++n)r+=t[n]*e[n];return r}function b(t,e){return[t[1]*e[2]-t[2]*e[1],t[2]*e[0]-t[0]*e[2],t[0]*e[1]-t[1]*e[0]]}function x(t){for(var e=0,r=arguments.length,n=[];++e<r;)n.push(arguments[e]);var i=_.dispatch.apply(null,n);return i.of=function(e,r){return function(n){var o;try{o=n.sourceEvent=_.event,n.target=t,_.event=n,i[n.type].apply(e,r)}finally{_.event=o}}},i}var _=t("d3"),w=Math.PI/180,M=180/Math.PI,k={cursor:"pointer"},A={cursor:"auto"};e.exports=n},{d3:119}],622:[function(t,e,r){"use strict";function n(t,e){var r=t.projection,n=t.zoom,o=function(){t.makeProjection(e),t.makePath(),n.scale(r.scale()),n.translate(r.translate()),i.loneUnhover(t.hoverContainer),t.render()};return o}var i=t("../cartesian/graph_interact");e.exports=n},{"../cartesian/graph_interact":599}],623:[function(t,e,r){"use strict";function n(t,e){this.element=t,this.plot=e,this.mouseListener=null,this.wheelListener=null,this.lastInputTime=Date.now(),this.lastPos=[0,0],this.boxEnabled=!1,this.boxStart=[0,0],this.boxEnd=[0,0]}function i(t){var e=t.mouseContainer,r=t.glplot,i=new n(e,r);return i.mouseListener=o(e,function(e,n,o){function a(e,r,n){var o=Math.min(r,n),a=Math.max(r,n);o!==a?(e[0]=o,e[1]=a,i.dataBox=e):(t.selectBox.selectBox=[0,0,1,1],t.glplot.setDirty())}var s=t.xaxis.range,l=t.yaxis.range,u=r.viewBox,c=i.lastPos[0],h=i.lastPos[1];switch(n*=r.pixelRatio,o*=r.pixelRatio,o=u[3]-u[1]-o,t.fullLayout.dragmode){case"zoom":if(e){var f=n/(u[2]-u[0])*(s[1]-s[0])+s[0],d=o/(u[3]-u[1])*(l[1]-l[0])+l[0];i.boxEnabled||(i.boxStart[0]=f,i.boxStart[1]=d),i.boxEnd[0]=f,i.boxEnd[1]=d,i.boxEnabled=!0}else i.boxEnabled&&(a(s,i.boxStart[0],i.boxEnd[0]),a(l,i.boxStart[1],i.boxEnd[1]),i.boxEnabled=!1);break;case"pan":if(i.boxEnabled=!1,e){var p=(c-n)*(s[1]-s[0])/(r.viewBox[2]-r.viewBox[0]),v=(h-o)*(l[1]-l[0])/(r.viewBox[3]-r.viewBox[1]);s[0]+=p,s[1]+=p,l[0]+=v,l[1]+=v,i.lastInputTime=Date.now(),t.cameraChanged()}}i.lastPos[0]=n,i.lastPos[1]=o}),i.wheelListener=a(e,function(e,n){var o=t.xaxis.range,a=t.yaxis.range,s=r.viewBox,l=i.lastPos[0],u=i.lastPos[1];switch(t.fullLayout.dragmode){case"zoom":break;case"pan":var c=Math.exp(.1*n/(s[3]-s[1])),h=l/(s[2]-s[0])*(o[1]-o[0])+o[0],f=u/(s[3]-s[1])*(a[1]-a[0])+a[0];o[0]=(o[0]-h)*c+h,o[1]=(o[1]-h)*c+h,a[0]=(a[0]-f)*c+f,a[1]=(a[1]-f)*c+f,i.lastInputTime=Date.now(),t.cameraChanged()}return!0}),i}var o=t("mouse-change"),a=t("mouse-wheel");e.exports=i},{"mouse-change":421,"mouse-wheel":425}],624:[function(t,e,r){"use strict";function n(t){this.scene=t,this.gl=t.gl,this.pixelRatio=t.pixelRatio,this.screenBox=[0,0,1,1],this.viewBox=[0,0,1,1],this.dataBox=[-1,-1,1,1],this.borderLineEnable=[!1,!1,!1,!1],this.borderLineWidth=[1,1,1,1],this.borderLineColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.ticks=[[],[]],this.tickEnable=[!0,!0,!1,!1],this.tickPad=[15,15,15,15],this.tickAngle=[0,0,0,0],this.tickColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.tickMarkLength=[0,0,0,0],this.tickMarkWidth=[0,0,0,0],this.tickMarkColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.labels=["x","y"],this.labelEnable=[!0,!0,!1,!1],this.labelAngle=[0,Math.PI/2,0,3*Math.PI/2],this.labelPad=[15,15,15,15],this.labelSize=[12,12],this.labelFont=["sans-serif","sans-serif"],this.labelColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.title="",this.titleEnable=!0,this.titleCenter=[0,0,0,0],this.titleAngle=0,this.titleColor=[0,0,0,1],this.titleFont="sans-serif",this.titleSize=18,this.gridLineEnable=[!0,!0],this.gridLineColor=[[0,0,0,.5],[0,0,0,.5]],this.gridLineWidth=[1,1],this.zeroLineEnable=[!0,!0],this.zeroLineWidth=[1,1],this.zeroLineColor=[[0,0,0,1],[0,0,0,1]],this.borderColor=[0,0,0,0],this.backgroundColor=[0,0,0,0]}function i(t){return new n(t)}var o=t("../../plotly"),a=t("../../lib/html2unicode"),s=t("../../lib/str2rgbarray"),l=n.prototype,u=["xaxis","yaxis"];l.merge=function(t){this.titleEnable=!1,this.backgroundColor=s(t.plot_bgcolor);var e,r,n,i,o,l,c,h,f,d,p;for(d=0;2>d;++d){for(e=u[d],r=t[this.scene[e]._name],n=/Click to enter .+ title/.test(r.title)?"":r.title,p=0;2>=p;p+=2)this.labelEnable[d+p]=!1,this.labels[d+p]=a(n),this.labelColor[d+p]=s(r.titlefont.color),this.labelFont[d+p]=r.titlefont.family,this.labelSize[d+p]=r.titlefont.size,this.labelPad[d+p]=this.getLabelPad(e,r),this.tickEnable[d+p]=!1,this.tickColor[d+p]=s((r.tickfont||{}).color),this.tickAngle[d+p]="auto"===r.tickangle?0:Math.PI*-r.tickangle/180,this.tickPad[d+p]=this.getTickPad(r),this.tickMarkLength[d+p]=0,this.tickMarkWidth[d+p]=r.tickwidth||0,this.tickMarkColor[d+p]=s(r.tickcolor),this.borderLineEnable[d+p]=!1,this.borderLineColor[d+p]=s(r.linecolor),this.borderLineWidth[d+p]=r.linewidth||0;c=this.hasSharedAxis(r),o=this.hasAxisInDfltPos(e,r)&&!c,l=this.hasAxisInAltrPos(e,r)&&!c,i=r.mirror||!1,h=c?-1!==String(i).indexOf("all"):!!i,f=c?"allticks"===i:-1!==String(i).indexOf("ticks"),o?this.labelEnable[d]=!0:l&&(this.labelEnable[d+2]=!0),o?this.tickEnable[d]=r.showticklabels:l&&(this.tickEnable[d+2]=r.showticklabels),(o||h)&&(this.borderLineEnable[d]=r.showline),(l||h)&&(this.borderLineEnable[d+2]=r.showline),(o||f)&&(this.tickMarkLength[d]=this.getTickMarkLength(r)),(l||f)&&(this.tickMarkLength[d+2]=this.getTickMarkLength(r)),this.gridLineEnable[d]=r.showgrid,this.gridLineColor[d]=s(r.gridcolor),this.gridLineWidth[d]=r.gridwidth,this.zeroLineEnable[d]=r.zeroline,this.zeroLineColor[d]=s(r.zerolinecolor),this.zeroLineWidth[d]=r.zerolinewidth}},l.hasSharedAxis=function(t){var e=this.scene,r=o.Plots.getSubplotIds(e.fullLayout,"gl2d"),n=o.Axes.findSubplotsWithAxis(r,t);return 0!==n.indexOf(e.id)},l.hasAxisInDfltPos=function(t,e){var r=e.side;return"xaxis"===t?"bottom"===r:"yaxis"===t?"left"===r:void 0},l.hasAxisInAltrPos=function(t,e){var r=e.side;return"xaxis"===t?"top"===r:"yaxis"===t?"right"===r:void 0},l.getLabelPad=function(t,e){var r=1.5,n=e.titlefont.size,i=e.showticklabels;return"xaxis"===t?"top"===e.side?-10+n*(r+(i?1:0)):-10+n*(r+(i?.5:0)):"yaxis"===t?"right"===e.side?10+n*(r+(i?1:.5)):10+n*(r+(i?.5:0)):void 0},l.getTickPad=function(t){return"outside"===t.ticks?10+t.ticklen:15},l.getTickMarkLength=function(t){if(!t.ticks)return 0;var e=t.ticklen;return"inside"===t.ticks?-e:e},e.exports=i},{"../../lib/html2unicode":567,"../../lib/str2rgbarray":580,"../../plotly":589}],625:[function(t,e,r){"use strict";var n=t("./scene2d"),i=t("../plots"),o=t("../../constants/xmlns_namespaces");r.name="gl2d",r.attr=["xaxis","yaxis"],r.idRoot=["x","y"],r.idRegex={x:/^x([2-9]|[1-9][0-9]+)?$/,y:/^y([2-9]|[1-9][0-9]+)?$/},r.attrRegex={x:/^xaxis([2-9]|[1-9][0-9]+)?$/,y:/^yaxis([2-9]|[1-9][0-9]+)?$/},r.attributes=t("../cartesian/attributes"),r.plot=function(t){for(var e=t._fullLayout,r=t._fullData,o=i.getSubplotIds(e,"gl2d"),a=0;a<o.length;a++){var s=o[a],l=e._plots[s],u=i.getSubplotData(r,"gl2d",s),c=l._scene2d;void 0===c&&(c=new n({id:s,graphDiv:t,container:t.querySelector(".gl-container"),staticPlot:t._context.staticPlot,plotGlPixelRatio:t._context.plotGlPixelRatio},e),l._scene2d=c),c.plot(u,t.calcdata,e,t.layout)}},r.clean=function(t,e,r,n){for(var o=i.getSubplotIds(n,"gl2d"),a=0;a<o.length;a++){var s=o[a],l=n._plots[s];if(l._scene2d){var u=i.getSubplotData(t,"gl2d",s);0===u.length&&(l._scene2d.destroy(),delete n._plots[s])}}},r.toSVG=function(t){for(var e=t._fullLayout,r=i.getSubplotIds(e,"gl2d"),n=0;n<r.length;n++){var a=e._plots[r[n]],s=a._scene2d,l=s.toImage("png"),u=e._glimages.append("svg:image");u.attr({xmlns:o.svg,"xlink:href":l,x:0,y:0,width:"100%",height:"100%",preserveAspectRatio:"none"}),s.destroy()}}},{"../../constants/xmlns_namespaces":556,"../cartesian/attributes":591,"../plots":648,"./scene2d":626}],626:[function(t,e,r){"use strict";function n(t,e){this.container=t.container,this.graphDiv=t.graphDiv,this.pixelRatio=t.plotGlPixelRatio||window.devicePixelRatio,this.id=t.id,this.staticPlot=!!t.staticPlot,this.fullLayout=e,this.updateAxes(e),this.makeFramework(),this.glplotOptions=f(this),this.glplotOptions.merge(e),this.glplot=u(this.glplotOptions),this.camera=d(this),this.traces={},this.spikes=c(this.glplot),this.selectBox=h(this.glplot,{innerFill:!1,outerFill:!0}),this.pickResult=null,this.bounds=[1/0,1/0,-(1/0),-(1/0)],this.stopped=!1,this.redraw=this.draw.bind(this),this.redraw()}function i(t,e){for(var r=0;2>r;++r){var n=t[r],i=e[r];if(n.length!==i.length)return!0;for(var o=0;o<n.length;++o)if(n[o].x!==i[o].x)return!0}return!1}var o,a,s=t("../../plots/cartesian/axes"),l=t("../../plots/cartesian/graph_interact"),u=t("gl-plot2d"),c=t("gl-spikes2d"),h=t("gl-select-box"),f=t("./convert"),d=t("./camera"),p=t("../../lib/html2unicode"),v=t("../../lib/show_no_webgl_msg"),m=["xaxis","yaxis"];e.exports=n;var g=n.prototype;g.makeFramework=function(){
if(this.staticPlot){if(!a){o=document.createElement("canvas");try{a=o.getContext("webgl",{preserveDrawingBuffer:!0,premultipliedAlpha:!0,antialias:!0})}catch(t){throw new Error(["Error creating static canvas/context for image server"].join(" "))}}this.canvas=o,this.gl=a}else{var e,r=document.createElement("canvas"),n={premultipliedAlpha:!0};try{e=r.getContext("webgl",n)}catch(t){}if(!e)try{e=r.getContext("experimental-webgl",n)}catch(t){}e||v(this),this.canvas=r,this.gl=e}var i=this.canvas,s=this.pixelRatio,l=this.fullLayout;i.width=0|Math.ceil(s*l.width),i.height=0|Math.ceil(s*l.height),i.style.width="100%",i.style.height="100%",i.style.position="absolute",i.style.top="0px",i.style.left="0px",i.style["pointer-events"]="none";var u=this.svgContainer=document.createElementNS("http://www.w3.org/2000/svg","svg");u.style.position="absolute",u.style.top=u.style.left="0px",u.style.width=u.style.height="100%",u.style["z-index"]=20,u.style["pointer-events"]="none";var c=this.mouseContainer=document.createElement("div");c.style.position="absolute";var h=this.container;h.appendChild(i),h.appendChild(u),h.appendChild(c)},g.toImage=function(t){t||(t="png"),this.stopped=!0,this.staticPlot&&this.container.appendChild(o),this.glplot.setDirty(),this.glplot.draw();var e=this.glplot.gl,r=e.drawingBufferWidth,n=e.drawingBufferHeight;e.bindFramebuffer(e.FRAMEBUFFER,null);var i=new Uint8Array(r*n*4);e.readPixels(0,0,r,n,e.RGBA,e.UNSIGNED_BYTE,i);for(var a=0,s=n-1;s>a;++a,--s)for(var l=0;r>l;++l)for(var u=0;4>u;++u){var c=i[4*(r*a+l)+u];i[4*(r*a+l)+u]=i[4*(r*s+l)+u],i[4*(r*s+l)+u]=c}var h=document.createElement("canvas");h.width=r,h.height=n;var f=h.getContext("2d"),d=f.createImageData(r,n);d.data.set(i),f.putImageData(d,0,0);var p;switch(t){case"jpeg":p=h.toDataURL("image/jpeg");break;case"webp":p=h.toDataURL("image/webp");break;default:p=h.toDataURL("image/png")}return this.staticPlot&&this.container.removeChild(o),p},g.computeTickMarks=function(){this.xaxis._length=this.glplot.viewBox[2]-this.glplot.viewBox[0],this.yaxis._length=this.glplot.viewBox[3]-this.glplot.viewBox[1];for(var t=[s.calcTicks(this.xaxis),s.calcTicks(this.yaxis)],e=0;2>e;++e)for(var r=0;r<t[e].length;++r)t[e][r].text=p(t[e][r].text+"").replace(/\n/g," ");return t},g.updateAxes=function(t){var e=s.subplotMatch,r="xaxis"+this.id.match(e)[1],n="yaxis"+this.id.match(e)[2];this.xaxis=t[r],this.yaxis=t[n]},g.updateFx=function(t){var e=this.fullLayout;e.dragmode=t.dragmode,e.hovermode=t.hovermode};var y=function(t){var e=t.xaxis.range,r=t.yaxis.range;t.graphDiv.layout.xaxis.range=e.slice(0),t.graphDiv.layout.yaxis.range=r.slice(0);var n={lastInputTime:t.camera.lastInputTime};n[t.xaxis._name]=e.slice(),n[t.yaxis._name]=r.slice(),t.graphDiv.emit("plotly_relayout",n)};g.cameraChanged=function(){var t=this.camera,e=this.xaxis.range,r=this.yaxis.range;this.glplot.setDataBox([e[0],r[0],e[1],r[1]]);var n=this.computeTickMarks(),o=this.glplotOptions.ticks;i(n,o)&&(this.glplotOptions.ticks=n,this.glplotOptions.dataBox=t.dataBox,this.glplot.update(this.glplotOptions),y(this))},g.destroy=function(){var t=this.traces;t&&Object.keys(t).map(function(e){t[e].dispose(),delete t[e]}),this.glplot.dispose(),this.staticPlot||this.container.removeChild(this.canvas),this.container.removeChild(this.svgContainer),this.container.removeChild(this.mouseContainer),this.glplot=null,this.stopped=!0},g.plot=function(t,e,r){var n,i,o,a=this.glplot,l=this.pixelRatio;this.fullLayout=r,this.updateAxes(r);var u=r.width,c=r.height,h=0|Math.ceil(l*u),f=0|Math.ceil(l*c),d=this.canvas;for(d.width===h&&d.height===f||(d.width=h,d.height=f),n=0;n<t.length;++n){var p=t[n],v=e[n];o=this.traces[p.uid],o?o.update(p,v):o=p._module.plot(this,p,v),this.traces[p.uid]=o}var g=Object.keys(this.traces);t:for(n=0;n<g.length;++n){for(i=0;i<e.length;++i)if(e[i][0].trace.uid===g[n])continue t;o=this.traces[g[n]],o.dispose(),delete this.traces[g[n]]}var y=this.glplotOptions;y.merge(r),y.screenBox=[0,0,u,c];var b=r._size,x=this.xaxis.domain,_=this.yaxis.domain;y.viewBox=[b.l+x[0]*b.w,b.b+_[0]*b.h,u-b.r-(1-x[1])*b.w,c-b.t-(1-_[1])*b.h],this.mouseContainer.style.width=b.w*(x[1]-x[0])+"px",this.mouseContainer.style.height=b.h*(_[1]-_[0])+"px",this.mouseContainer.height=b.h*(_[1]-_[0]),this.mouseContainer.style.left=b.l+x[0]*b.w+"px",this.mouseContainer.style.top=b.t+(1-_[1])*b.h+"px";var w=this.bounds;for(w[0]=w[1]=1/0,w[2]=w[3]=-(1/0),g=Object.keys(this.traces),n=0;n<g.length;++n){o=this.traces[g[n]];for(var M=0;2>M;++M)w[M]=Math.min(w[M],o.bounds[M]),w[M+2]=Math.max(w[M+2],o.bounds[M+2])}var k;for(n=0;2>n;++n)w[n]>w[n+2]&&(w[n]=-1,w[n+2]=1),k=this[m[n]],k._length=y.viewBox[n+2]-y.viewBox[n],s.doAutoRange(k);y.ticks=this.computeTickMarks();var A=this.xaxis.range,T=this.yaxis.range;y.dataBox=[A[0],T[0],A[1],T[1]],y.merge(r),a.update(y),this.glplot.draw()},g.draw=function(){if(!this.stopped){requestAnimationFrame(this.redraw);var t=this.glplot,e=this.camera,r=e.mouseListener,n=this.fullLayout;this.cameraChanged();var i=r.x*t.pixelRatio,o=this.canvas.height-t.pixelRatio*r.y;if(e.boxEnabled&&"zoom"===n.dragmode)this.selectBox.enabled=!0,this.selectBox.selectBox=[Math.min(e.boxStart[0],e.boxEnd[0]),Math.min(e.boxStart[1],e.boxEnd[1]),Math.max(e.boxStart[0],e.boxEnd[0]),Math.max(e.boxStart[1],e.boxEnd[1])],t.setDirty();else{this.selectBox.enabled=!1;var a=n._size,s=this.xaxis.domain,u=this.yaxis.domain,c=t.pick(i/t.pixelRatio+a.l+s[0]*a.w,o/t.pixelRatio-(a.t+(1-u[1])*a.h));if(c&&n.hovermode){var h=c.object._trace.handlePick(c);if(h&&(!this.lastPickResult||this.lastPickResult.traceUid!==h.trace.uid||this.lastPickResult.dataCoord[0]!==h.dataCoord[0]||this.lastPickResult.dataCoord[1]!==h.dataCoord[1])){var f=h;this.lastPickResult={traceUid:h.trace?h.trace.uid:null,dataCoord:h.dataCoord.slice()},this.spikes.update({center:c.dataCoord}),f.screenCoord=[((t.viewBox[2]-t.viewBox[0])*(c.dataCoord[0]-t.dataBox[0])/(t.dataBox[2]-t.dataBox[0])+t.viewBox[0])/t.pixelRatio,(this.canvas.height-(t.viewBox[3]-t.viewBox[1])*(c.dataCoord[1]-t.dataBox[1])/(t.dataBox[3]-t.dataBox[1])-t.viewBox[1])/t.pixelRatio];var d=f.hoverinfo;if("all"!==d){var p=d.split("+");-1===p.indexOf("x")&&(f.traceCoord[0]=void 0),-1===p.indexOf("y")&&(f.traceCoord[1]=void 0),-1===p.indexOf("z")&&(f.traceCoord[2]=void 0),-1===p.indexOf("text")&&(f.textLabel=void 0),-1===p.indexOf("name")&&(f.name=void 0)}l.loneHover({x:f.screenCoord[0],y:f.screenCoord[1],xLabel:this.hoverFormatter("xaxis",f.traceCoord[0]),yLabel:this.hoverFormatter("yaxis",f.traceCoord[1]),zLabel:f.traceCoord[2],text:f.textLabel,name:f.name,color:f.color},{container:this.svgContainer})}}else!c&&this.lastPickResult&&(this.spikes.update({}),this.lastPickResult=null,l.loneUnhover(this.svgContainer))}t.draw()}},g.hoverFormatter=function(t,e){if(void 0!==e){var r=this[t];return s.tickText(r,r.c2l(e),"hover").text}}},{"../../lib/html2unicode":567,"../../lib/show_no_webgl_msg":578,"../../plots/cartesian/axes":592,"../../plots/cartesian/graph_interact":599,"./camera":623,"./convert":624,"gl-plot2d":171,"gl-select-box":201,"gl-spikes2d":221}],627:[function(t,e,r){"use strict";function n(t,e){t=t||document.body,e=e||{};var r=[.01,1/0];"distanceLimits"in e&&(r[0]=e.distanceLimits[0],r[1]=e.distanceLimits[1]),"zoomMin"in e&&(r[0]=e.zoomMin),"zoomMax"in e&&(r[1]=e.zoomMax);var n=o({center:e.center||[0,0,0],up:e.up||[0,1,0],eye:e.eye||[0,0,10],mode:e.mode||"orbit",distanceLimits:r}),l=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],u=0,c=t.clientWidth,h=t.clientHeight,f={keyBindingMode:"rotate",view:n,element:t,delay:e.delay||16,rotateSpeed:e.rotateSpeed||1,zoomSpeed:e.zoomSpeed||1,translateSpeed:e.translateSpeed||1,flipX:!!e.flipX,flipY:!!e.flipY,modes:n.modes,tick:function(){var e=i(),r=this.delay,o=e-2*r;n.idle(e-r),n.recalcMatrix(o),n.flush(e-(100+2*r));for(var a=!0,s=n.computedMatrix,f=0;16>f;++f)a=a&&l[f]===s[f],l[f]=s[f];var d=t.clientWidth===c&&t.clientHeight===h;return c=t.clientWidth,h=t.clientHeight,a?!d:(u=Math.exp(n.computedRadius[0]),!0)},lookAt:function(t,e,r){n.lookAt(n.lastT(),t,e,r)},rotate:function(t,e,r){n.rotate(n.lastT(),t,e,r)},pan:function(t,e,r){n.pan(n.lastT(),t,e,r)},translate:function(t,e,r){n.translate(n.lastT(),t,e,r)}};Object.defineProperties(f,{matrix:{get:function(){return n.computedMatrix},set:function(t){return n.setMatrix(n.lastT(),t),n.computedMatrix},enumerable:!0},mode:{get:function(){return n.getMode()},set:function(t){var e=n.computedUp.slice(),r=n.computedEye.slice(),o=n.computedCenter.slice();if(n.setMode(t),"turntable"===t){var a=i();n._active.lookAt(a,r,o,e),n._active.lookAt(a+500,r,o,[0,0,1]),n._active.flush(a)}return n.getMode()},enumerable:!0},center:{get:function(){return n.computedCenter},set:function(t){return n.lookAt(n.lastT(),null,t),n.computedCenter},enumerable:!0},eye:{get:function(){return n.computedEye},set:function(t){return n.lookAt(n.lastT(),t),n.computedEye},enumerable:!0},up:{get:function(){return n.computedUp},set:function(t){return n.lookAt(n.lastT(),null,null,t),n.computedUp},enumerable:!0},distance:{get:function(){return u},set:function(t){return n.setDistance(n.lastT(),t),t},enumerable:!0},distanceLimits:{get:function(){return n.getDistanceLimits(r)},set:function(t){return n.setDistanceLimits(t),t},enumerable:!0}}),t.addEventListener("contextmenu",function(t){return t.preventDefault(),!1});var d=0,p=0;return a(t,function(e,r,o,a){var s="rotate"===f.keyBindingMode,l="pan"===f.keyBindingMode,c="zoom"===f.keyBindingMode,h=!!a.control,v=!!a.alt,m=!!a.shift,g=!!(1&e),y=!!(2&e),b=!!(4&e),x=1/t.clientHeight,_=x*(r-d),w=x*(o-p),M=f.flipX?1:-1,k=f.flipY?1:-1,A=i(),T=Math.PI*f.rotateSpeed;if((s&&g&&!h&&!v&&!m||g&&!h&&!v&&m)&&n.rotate(A,M*T*_,-k*T*w,0),(l&&g&&!h&&!v&&!m||y||g&&h&&!v&&!m)&&n.pan(A,-f.translateSpeed*_*u,f.translateSpeed*w*u,0),c&&g&&!h&&!v&&!m||b||g&&!h&&v&&!m){var E=-f.zoomSpeed*w/window.innerHeight*(A-n.lastT())*100;n.pan(A,0,0,u*(Math.exp(E)-1))}return d=r,p=o,!0}),s(t,function(t,e){var r=f.flipX?1:-1,o=f.flipY?1:-1,a=i();if(Math.abs(t)>Math.abs(e))n.rotate(a,0,0,-t*r*Math.PI*f.rotateSpeed/window.innerWidth);else{var s=-f.zoomSpeed*o*e/window.innerHeight*(a-n.lastT())/100;n.pan(a,0,0,u*(Math.exp(s)-1))}},!0),f}e.exports=n;var i=t("right-now"),o=t("3d-view"),a=t("mouse-change"),s=t("mouse-wheel")},{"3d-view":40,"mouse-change":421,"mouse-wheel":425,"right-now":435}],628:[function(t,e,r){"use strict";function n(t,e){for(var r=0;3>r;++r){var n=s[r];e[n]._gd=t}}var i=t("./scene"),o=t("../plots"),a=t("../../constants/xmlns_namespaces"),s=["xaxis","yaxis","zaxis"];r.name="gl3d",r.attr="scene",r.idRoot="scene",r.idRegex=/^scene([2-9]|[1-9][0-9]+)?$/,r.attrRegex=/^scene([2-9]|[1-9][0-9]+)?$/,r.attributes=t("./layout/attributes"),r.layoutAttributes=t("./layout/layout_attributes"),r.supplyLayoutDefaults=t("./layout/defaults"),r.plot=function(t){var e=t._fullLayout,r=t._fullData,a=o.getSubplotIds(e,"gl3d");e._paperdiv.style({width:e.width+"px",height:e.height+"px"}),t._context.setBackground(t,e.paper_bgcolor);for(var s=0;s<a.length;s++){var l=a[s],u=o.getSubplotData(r,"gl3d",l),c=e[l],h=c._scene;void 0===h&&(n(t,c),h=new i({id:l,graphDiv:t,container:t.querySelector(".gl-container"),staticPlot:t._context.staticPlot,plotGlPixelRatio:t._context.plotGlPixelRatio},e),c._scene=h),h.plot(u,e,t.layout)}},r.clean=function(t,e,r,n){for(var i=o.getSubplotIds(n,"gl3d"),a=0;a<i.length;a++){var s=i[a];!e[s]&&n[s]._scene&&n[s]._scene.destroy()}},r.toSVG=function(t){for(var e=t._fullLayout,r=o.getSubplotIds(e,"gl3d"),n=e._size,i=0;i<r.length;i++){var s=e[r[i]],l=s.domain,u=s._scene,c=u.toImage("png"),h=e._glimages.append("svg:image");h.attr({xmlns:a.svg,"xlink:href":c,x:n.l+n.w*l.x[0],y:n.t+n.h*(1-l.y[1]),width:n.w*(l.x[1]-l.x[0]),height:n.h*(l.y[1]-l.y[0]),preserveAspectRatio:"none"}),u.destroy()}},r.cleanId=function(t){if(t.match(/^scene[0-9]*$/)){var e=t.substr(5);return"1"===e&&(e=""),"scene"+e}},r.setConvert=t("./set_convert")},{"../../constants/xmlns_namespaces":556,"../plots":648,"./layout/attributes":629,"./layout/defaults":633,"./layout/layout_attributes":634,"./scene":638,"./set_convert":639}],629:[function(t,e,r){"use strict";e.exports={scene:{valType:"subplotid",dflt:"scene"}}},{}],630:[function(t,e,r){"use strict";var n=t("../../../components/color"),i=t("../../cartesian/layout_attributes"),o=t("../../../lib/extend").extendFlat;e.exports={showspikes:{valType:"boolean",dflt:!0},spikesides:{valType:"boolean",dflt:!0},spikethickness:{valType:"number",min:0,dflt:2},spikecolor:{valType:"color",dflt:n.defaultLine},showbackground:{valType:"boolean",dflt:!1},backgroundcolor:{valType:"color",dflt:"rgba(204, 204, 204, 0.5)"},showaxeslabels:{valType:"boolean",dflt:!0},color:i.color,categoryorder:i.categoryorder,categoryarray:i.categoryarray,title:i.title,titlefont:i.titlefont,type:i.type,autorange:i.autorange,rangemode:i.rangemode,range:i.range,fixedrange:i.fixedrange,tickmode:i.tickmode,nticks:i.nticks,tick0:i.tick0,dtick:i.dtick,tickvals:i.tickvals,ticktext:i.ticktext,ticks:i.ticks,mirror:i.mirror,ticklen:i.ticklen,tickwidth:i.tickwidth,tickcolor:i.tickcolor,showticklabels:i.showticklabels,tickfont:i.tickfont,tickangle:i.tickangle,tickprefix:i.tickprefix,showtickprefix:i.showtickprefix,ticksuffix:i.ticksuffix,showticksuffix:i.showticksuffix,showexponent:i.showexponent,exponentformat:i.exponentformat,tickformat:i.tickformat,hoverformat:i.hoverformat,showline:i.showline,linecolor:i.linecolor,linewidth:i.linewidth,showgrid:i.showgrid,gridcolor:o({},i.gridcolor,{dflt:"rgb(204, 204, 204)"}),gridwidth:i.gridwidth,zeroline:i.zeroline,zerolinecolor:i.zerolinecolor,zerolinewidth:i.zerolinewidth}},{"../../../components/color":483,"../../../lib/extend":563,"../../cartesian/layout_attributes":601}],631:[function(t,e,r){"use strict";var n=t("tinycolor2").mix,i=t("../../../lib"),o=t("./axis_attributes"),a=t("../../cartesian/axis_defaults"),s=["xaxis","yaxis","zaxis"],l=function(){},u=13600/187;e.exports=function(t,e,r){function c(t,e){return i.coerce(h,f,o,t,e)}for(var h,f,d=0;d<s.length;d++){var p=s[d];h=t[p]||{},f={_id:p[0]+r.scene,_name:p},e[p]=f=a(h,f,c,{font:r.font,letter:p[0],data:r.data,showGrid:!0,bgColor:r.bgColor}),c("gridcolor",n(f.color,r.bgColor,u).toRgbString()),c("title",p[0]),f.setScale=l,c("showspikes")&&(c("spikesides"),c("spikethickness"),c("spikecolor",f.color)),c("showaxeslabels"),c("showbackground")&&c("backgroundcolor")}}},{"../../../lib":568,"../../cartesian/axis_defaults":593,"./axis_attributes":630,tinycolor2:454}],632:[function(t,e,r){"use strict";function n(){this.bounds=[[-10,-10,-10],[10,10,10]],this.ticks=[[],[],[]],this.tickEnable=[!0,!0,!0],this.tickFont=["sans-serif","sans-serif","sans-serif"],this.tickSize=[12,12,12],this.tickAngle=[0,0,0],this.tickColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.tickPad=[18,18,18],this.labels=["x","y","z"],this.labelEnable=[!0,!0,!0],this.labelFont=["Open Sans","Open Sans","Open Sans"],this.labelSize=[20,20,20],this.labelAngle=[0,0,0],this.labelColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.labelPad=[30,30,30],this.lineEnable=[!0,!0,!0],this.lineMirror=[!1,!1,!1],this.lineWidth=[1,1,1],this.lineColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.lineTickEnable=[!0,!0,!0],this.lineTickMirror=[!1,!1,!1],this.lineTickLength=[10,10,10],this.lineTickWidth=[1,1,1],this.lineTickColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.gridEnable=[!0,!0,!0],this.gridWidth=[1,1,1],this.gridColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.zeroEnable=[!0,!0,!0],this.zeroLineColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.zeroLineWidth=[2,2,2],this.backgroundEnable=[!0,!0,!0],this.backgroundColor=[[.8,.8,.8,.5],[.8,.8,.8,.5],[.8,.8,.8,.5]],this._defaultTickPad=l(this.tickPad),this._defaultLabelPad=l(this.labelPad),this._defaultLineTickLength=l(this.lineTickLength)}function i(t){var e=new n;return e.merge(t),e}var o=t("arraytools"),a=t("../../../lib/html2unicode"),s=t("../../../lib/str2rgbarray"),l=o.copy1D,u=["xaxis","yaxis","zaxis"],c=n.prototype;c.merge=function(t){for(var e=this,r=0;3>r;++r){var n=t[u[r]];e.labels[r]=a(n.title),"titlefont"in n&&(n.titlefont.color&&(e.labelColor[r]=s(n.titlefont.color)),n.titlefont.family&&(e.labelFont[r]=n.titlefont.family),n.titlefont.size&&(e.labelSize[r]=n.titlefont.size)),"showline"in n&&(e.lineEnable[r]=n.showline),"linecolor"in n&&(e.lineColor[r]=s(n.linecolor)),"linewidth"in n&&(e.lineWidth[r]=n.linewidth),"showgrid"in n&&(e.gridEnable[r]=n.showgrid),"gridcolor"in n&&(e.gridColor[r]=s(n.gridcolor)),"gridwidth"in n&&(e.gridWidth[r]=n.gridwidth),"log"===n.type?e.zeroEnable[r]=!1:"zeroline"in n&&(e.zeroEnable[r]=n.zeroline),"zerolinecolor"in n&&(e.zeroLineColor[r]=s(n.zerolinecolor)),"zerolinewidth"in n&&(e.zeroLineWidth[r]=n.zerolinewidth),"ticks"in n&&n.ticks?e.lineTickEnable[r]=!0:e.lineTickEnable[r]=!1,"ticklen"in n&&(e.lineTickLength[r]=e._defaultLineTickLength[r]=n.ticklen),"tickcolor"in n&&(e.lineTickColor[r]=s(n.tickcolor)),"tickwidth"in n&&(e.lineTickWidth[r]=n.tickwidth),"tickangle"in n&&(e.tickAngle[r]="auto"===n.tickangle?0:Math.PI*-n.tickangle/180),"showticklabels"in n&&(e.tickEnable[r]=n.showticklabels),"tickfont"in n&&(n.tickfont.color&&(e.tickColor[r]=s(n.tickfont.color)),n.tickfont.family&&(e.tickFont[r]=n.tickfont.family),n.tickfont.size&&(e.tickSize[r]=n.tickfont.size)),"mirror"in n?-1!==["ticks","all","allticks"].indexOf(n.mirror)?(e.lineTickMirror[r]=!0,e.lineMirror[r]=!0):n.mirror===!0?(e.lineTickMirror[r]=!1,e.lineMirror[r]=!0):(e.lineTickMirror[r]=!1,e.lineMirror[r]=!1):e.lineMirror[r]=!1,"showbackground"in n&&n.showbackground!==!1?(e.backgroundEnable[r]=!0,e.backgroundColor[r]=s(n.backgroundcolor)):e.backgroundEnable[r]=!1}},e.exports=i},{"../../../lib/html2unicode":567,"../../../lib/str2rgbarray":580,arraytools:50}],633:[function(t,e,r){"use strict";function n(t,e,r,n){for(var o=r("bgcolor"),l=i.combine(o,n.paper_bgcolor),u=Object.keys(a.camera),c=0;c<u.length;c++)r("camera."+u[c]+".x"),r("camera."+u[c]+".y"),r("camera."+u[c]+".z");var h=!!r("aspectratio.x")&&!!r("aspectratio.y")&&!!r("aspectratio.z"),f=h?"manual":"auto",d=r("aspectmode",f);h||(t.aspectratio=e.aspectratio={x:1,y:1,z:1},"manual"===d&&(e.aspectmode="auto")),s(t,e,{font:n.font,scene:n.id,data:n.fullData,bgColor:l}),r("dragmode",n.getDfltFromLayout("dragmode")),r("hovermode",n.getDfltFromLayout("hovermode"))}var i=t("../../../components/color"),o=t("../../subplot_defaults"),a=t("./layout_attributes"),s=t("./axis_defaults");e.exports=function(t,e,r){function i(e){if(!s){var r=-1!==a[e].values.indexOf(t[e]);return r?t[e]:void 0}}var s=e._has("cartesian")||e._has("geo")||e._has("gl2d")||e._has("pie")||e._has("ternary");o(t,e,r,{type:"gl3d",attributes:a,handleDefaults:n,font:e.font,fullData:r,getDfltFromLayout:i,paper_bgcolor:e.paper_bgcolor})}},{"../../../components/color":483,"../../subplot_defaults":654,"./axis_defaults":631,"./layout_attributes":634}],634:[function(t,e,r){"use strict";function n(t,e,r){return{x:{valType:"number",dflt:t},y:{valType:"number",dflt:e},z:{valType:"number",dflt:r}}}var i=t("./axis_attributes"),o=t("../../../lib/extend").extendFlat;e.exports={bgcolor:{valType:"color",dflt:"rgba(0,0,0,0)"},camera:{up:o(n(0,0,1),{}),center:o(n(0,0,0),{}),eye:o(n(1.25,1.25,1.25),{})},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]}},aspectmode:{valType:"enumerated",values:["auto","cube","data","manual"],dflt:"auto"},aspectratio:{x:{valType:"number",min:0},y:{valType:"number",min:0},z:{valType:"number",min:0}},xaxis:i,yaxis:i,zaxis:i,dragmode:{valType:"enumerated",values:["orbit","turntable","zoom","pan"],dflt:"turntable"},hovermode:{valType:"enumerated",values:["closest",!1],dflt:"closest"},_deprecated:{cameraposition:{valType:"info_array"}}}},{"../../../lib/extend":563,"./axis_attributes":630}],635:[function(t,e,r){"use strict";function n(){this.enabled=[!0,!0,!0],this.colors=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.drawSides=[!0,!0,!0],this.lineWidth=[1,1,1]}function i(t){var e=new n;return e.merge(t),e}var o=t("../../../lib/str2rgbarray"),a=["xaxis","yaxis","zaxis"],s=n.prototype;s.merge=function(t){for(var e=0;3>e;++e){var r=t[a[e]];this.enabled[e]=r.showspikes,this.colors[e]=o(r.spikecolor),this.drawSides[e]=r.spikesides,this.lineWidth[e]=r.spikethickness}},e.exports=i},{"../../../lib/str2rgbarray":580}],636:[function(t,e,r){"use strict";function n(t){for(var e=new Array(3),r=0;3>r;++r){for(var n=t[r],i=new Array(n.length),o=0;o<n.length;++o)i[o]=n[o].x;e[r]=i}return e}function i(t){for(var e=t.axesOptions,r=t.glplot.axesPixels,i=t.fullSceneLayout,u=[[],[],[]],c=0;3>c;++c){var h=i[s[c]];if(h._length=(r[c].hi-r[c].lo)*r[c].pixelsPerDataUnit/t.dataScale[c],Math.abs(h._length)===1/0)u[c]=[];else{h.range[0]=r[c].lo/t.dataScale[c],h.range[1]=r[c].hi/t.dataScale[c],h._m=1/(t.dataScale[c]*r[c].pixelsPerDataUnit),h.range[0]===h.range[1]&&(h.range[0]-=1,h.range[1]+=1);var f=h.tickmode;if("auto"===h.tickmode){h.tickmode="linear";var d=h.nticks||o.Lib.constrain(h._length/40,4,9);o.Axes.autoTicks(h,Math.abs(h.range[1]-h.range[0])/d)}for(var p=o.Axes.calcTicks(h),v=0;v<p.length;++v)p[v].x=p[v].x*t.dataScale[c],p[v].text=a(p[v].text);u[c]=p,h.tickmode=f}}e.ticks=u;for(var c=0;3>c;++c){l[c]=.5*(t.glplot.bounds[0][c]+t.glplot.bounds[1][c]);for(var v=0;2>v;++v)e.bounds[v][c]=t.glplot.bounds[v][c]}t.contourLevels=n(u)}e.exports=i;var o=t("../../../plotly"),a=t("../../../lib/html2unicode"),s=["xaxis","yaxis","zaxis"],l=[0,0,0]},{"../../../lib/html2unicode":567,"../../../plotly":589}],637:[function(t,e,r){"use strict";function n(t,e){var r,n,i=[0,0,0,0];for(r=0;4>r;++r)for(n=0;4>n;++n)i[n]+=t[4*r+n]*e[r];return i}function i(t,e){var r=n(t.projection,n(t.view,n(t.model,[e[0],e[1],e[2],1])));return r}e.exports=i},{}],638:[function(t,e,r){"use strict";function n(t){function e(e,r){if("string"==typeof r)return r;var n=t.fullSceneLayout[e];return v.tickText(n,n.c2l(r),"hover").text}var r,n=t.svgContainer,i=t.container.getBoundingClientRect(),o=i.width,a=i.height;n.setAttributeNS(null,"viewBox","0 0 "+o+" "+a),n.setAttributeNS(null,"width",o),n.setAttributeNS(null,"height",a),k(t),t.glplot.axes.update(t.axesOptions);for(var s=Object.keys(t.traces),l=null,u=t.glplot.selection,c=0;c<s.length;++c)r=t.traces[s[c]],r.handlePick(u)&&(l=r),r.setContourLevels&&r.setContourLevels();var h;if(null!==l){var f=x(t.glplot.cameraParams,u.dataCoordinate);r=l.data;var d=r.hoverinfo,p=e("xaxis",u.traceCoordinate[0]),g=e("yaxis",u.traceCoordinate[1]),y=e("zaxis",u.traceCoordinate[2]);if("all"!==d){var b=d.split("+");-1===b.indexOf("x")&&(p=void 0),-1===b.indexOf("y")&&(g=void 0),-1===b.indexOf("z")&&(y=void 0),-1===b.indexOf("text")&&(u.textLabel=void 0),-1===b.indexOf("name")&&(l.name=void 0)}t.fullSceneLayout.hovermode&&m.loneHover({x:(.5+.5*f[0]/f[3])*o,y:(.5-.5*f[1]/f[3])*a,xLabel:p,yLabel:g,zLabel:y,text:u.textLabel,name:l.name,color:l.color},{container:n});var _={points:[{x:p,y:g,z:y,data:r._input,fullData:r,curveNumber:r.index,pointNumber:u.data.index}]};u.buttons&&u.distance<5?t.graphDiv.emit("plotly_click",_):t.graphDiv.emit("plotly_hover",_),h=_}else m.loneUnhover(n),t.graphDiv.emit("plotly_unhover",h)}function i(t,e,r,i){var o={canvas:r,gl:i,container:t.container,axes:t.axesOptions,spikes:t.spikeOptions,pickRadius:10,snapToData:!0,autoScale:!0,autoBounds:!1};if(t.staticMode){if(!h){c=document.createElement("canvas");try{h=c.getContext("webgl",{preserveDrawingBuffer:!0,premultipliedAlpha:!0,antialias:!0})}catch(a){throw new Error("error creating static canvas/context for image server")}}o.pixelRatio=t.pixelRatio,o.gl=h,o.canvas=c}try{t.glplot=f(o)}catch(a){y(t)}var s=function(t){var e={};e[t.id]=u(t.camera),t.saveCamera(t.graphDiv.layout),t.graphDiv.emit("plotly_relayout",e)};if(t.glplot.canvas.addEventListener("mouseup",s.bind(null,t)),t.glplot.canvas.addEventListener("wheel",s.bind(null,t)),t.staticMode||t.glplot.canvas.addEventListener("webglcontextlost",function(t){d.warn("Lost WebGL context."),t.preventDefault()}),!t.camera){var l=t.fullSceneLayout.camera;t.camera=b(t.container,{center:[l.center.x,l.center.y,l.center.z],eye:[l.eye.x,l.eye.y,l.eye.z],up:[l.up.x,l.up.y,l.up.z],zoomMin:.1,zoomMax:100,mode:"orbit"})}return t.glplot.mouseListener.enabled=!1,t.glplot.camera=t.camera,t.glplot.oncontextloss=function(){t.recoverContext()},t.glplot.onrender=n.bind(null,t),t.traces={},!0}function o(t,e){var r=document.createElement("div"),n=t.container;this.graphDiv=t.graphDiv;var o=document.createElementNS("http://www.w3.org/2000/svg","svg");o.style.position="absolute",o.style.top=o.style.left="0px",o.style.width=o.style.height="100%",o.style["z-index"]=20,o.style["pointer-events"]="none",r.appendChild(o),this.svgContainer=o,r.id=t.id,r.style.position="absolute",r.style.top=r.style.left="0px",r.style.width=r.style.height="100%",n.appendChild(r),this.fullLayout=e,this.id=t.id||"scene",this.fullSceneLayout=e[this.id],this.plotArgs=[[],{},{}],this.axesOptions=w(e[this.id]),this.spikeOptions=M(e[this.id]),this.container=r,this.staticMode=!!t.staticPlot,this.pixelRatio=t.plotGlPixelRatio||2,this.dataScale=[1,1,1],this.contourLevels=[[],[],[]],!i(this,e)}function a(t,e,r,n){for(var i,o=0;o<e.length;++o)if(Array.isArray(e[o]))for(var a=0;a<e[o].length;++a)i=t.d2l(e[o][a]),!isNaN(i)&&isFinite(i)&&(n[0][r]=Math.min(n[0][r],i),n[1][r]=Math.max(n[1][r],i));else i=t.d2l(e[o]),!isNaN(i)&&isFinite(i)&&(n[0][r]=Math.min(n[0][r],i),n[1][r]=Math.max(n[1][r],i))}function s(t,e,r){var n=t.fullSceneLayout;a(n.xaxis,e.x,0,r),a(n.yaxis,e.y,1,r),a(n.zaxis,e.z,2,r)}function l(t){return[[t.eye.x,t.eye.y,t.eye.z],[t.center.x,t.center.y,t.center.z],[t.up.x,t.up.y,t.up.z]]}function u(t){return{up:{x:t.up[0],y:t.up[1],z:t.up[2]},center:{x:t.center[0],y:t.center[1],z:t.center[2]},eye:{x:t.eye[0],y:t.eye[1],z:t.eye[2]}}}var c,h,f=t("gl-plot3d"),d=t("../../lib"),p=t("../../plots/plots"),v=t("../../plots/cartesian/axes"),m=t("../../plots/cartesian/graph_interact"),g=t("../../lib/str2rgbarray"),y=t("../../lib/show_no_webgl_msg"),b=t("./camera"),x=t("./project"),_=t("./set_convert"),w=t("./layout/convert"),M=t("./layout/spikes"),k=t("./layout/tick_marks"),A=o.prototype;A.recoverContext=function(){function t(){return r.isContextLost()?void requestAnimationFrame(t):i(e,e.fullLayout,n,r)?void e.plot.apply(e,e.plotArgs):void d.error("Catastrophic and unrecoverable WebGL error. Context lost.")}var e=this,r=this.glplot.gl,n=this.glplot.canvas;this.glplot.dispose(),requestAnimationFrame(t)};var T=["xaxis","yaxis","zaxis"];A.plot=function(t,e,r){if(this.plotArgs=[t,e,r],!this.glplot.contextLost){var n,i,o,a,l,u,c=e[this.id],h=r[this.id];for(c.bgcolor?this.glplot.clearColor=g(c.bgcolor):this.glplot.clearColor=[0,0,0,0],this.glplot.snapToData=!0,this.fullSceneLayout=c,this.glplotLayout=c,this.axesOptions.merge(c),this.spikeOptions.merge(c),this.updateFx(c.dragmode,c.hovermode),this.glplot.update({}),o=0;3>o;++o)l=c[T[o]],_(l);t?Array.isArray(t)||(t=[t]):t=[];var f=[[1/0,1/0,1/0],[-(1/0),-(1/0),-(1/0)]];for(o=0;o<t.length;++o)n=t[o],n.visible===!0&&s(this,n,f);var d=[1,1,1];for(a=0;3>a;++a)f[0][a]>f[1][a]?d[a]=1:f[1][a]===f[0][a]?d[a]=1:d[a]=1/(f[1][a]-f[0][a]);for(this.dataScale=d,o=0;o<t.length;++o)if(n=t[o],n.visible===!0){if(i=this.traces[n.uid])i.update(n);else{var v=p.getModule(n.type);i=v.plot(this,n),this.traces[n.uid]=i}i.name=n.name}var m=Object.keys(this.traces);t:for(o=0;o<m.length;++o){for(a=0;a<t.length;++a)if(t[a].uid===m[o]&&t[a].visible===!0)continue t;i=this.traces[m[o]],i.dispose(),delete this.traces[m[o]]}var y=[[0,0,0],[0,0,0]],b=[],x={};for(o=0;3>o;++o){if(l=c[T[o]],u=l.type,u in x?(x[u].acc*=d[o],x[u].count+=1):x[u]={acc:d[o],count:1},l.autorange){for(y[0][o]=1/0,y[1][o]=-(1/0),a=0;a<this.glplot.objects.length;++a){var w=this.glplot.objects[a].bounds;y[0][o]=Math.min(y[0][o],w[0][o]/d[o]),y[1][o]=Math.max(y[1][o],w[1][o]/d[o])}if("rangemode"in l&&"tozero"===l.rangemode&&(y[0][o]=Math.min(y[0][o],0),y[1][o]=Math.max(y[1][o],0)),y[0][o]>y[1][o])y[0][o]=-1,y[1][o]=1;else{var M=y[1][o]-y[0][o];y[0][o]-=M/32,y[1][o]+=M/32}}else{var k=c[T[o]].range;y[0][o]=k[0],y[1][o]=k[1]}y[0][o]===y[1][o]&&(y[0][o]-=1,y[1][o]+=1),b[o]=y[1][o]-y[0][o],this.glplot.bounds[0][o]=y[0][o]*d[o],this.glplot.bounds[1][o]=y[1][o]*d[o]}var A=[1,1,1];for(o=0;3>o;++o){l=c[T[o]],u=l.type;var E=x[u];A[o]=Math.pow(E.acc,1/E.count)/d[o]}var S,L=4;if("auto"===c.aspectmode)S=Math.max.apply(null,A)/Math.min.apply(null,A)<=L?A:[1,1,1];else if("cube"===c.aspectmode)S=[1,1,1];else if("data"===c.aspectmode)S=A;else{if("manual"!==c.aspectmode)throw new Error("scene.js aspectRatio was not one of the enumerated types");var z=c.aspectratio;S=[z.x,z.y,z.z]}c.aspectratio.x=h.aspectratio.x=S[0],c.aspectratio.y=h.aspectratio.y=S[1],c.aspectratio.z=h.aspectratio.z=S[2],this.glplot.aspect=S;var I=c.domain||null,P=e._size||null;if(I&&P){var C=this.container.style;C.position="absolute",C.left=P.l+I.x[0]*P.w+"px",C.top=P.t+(1-I.y[1])*P.h+"px",C.width=P.w*(I.x[1]-I.x[0])+"px",C.height=P.h*(I.y[1]-I.y[0])+"px"}this.glplot.redraw()}},A.destroy=function(){this.glplot.dispose(),this.container.parentNode.removeChild(this.container),this.glplot=null},A.setCameraToDefault=function(){this.setCamera({eye:{x:1.25,y:1.25,z:1.25},center:{x:0,y:0,z:0},up:{x:0,y:0,z:1}})},A.getCamera=function(){return this.glplot.camera.view.recalcMatrix(this.camera.view.lastT()),u(this.glplot.camera)},A.setCamera=function(t){var e={};e[this.id]=t,this.glplot.camera.lookAt.apply(this,l(t)),this.graphDiv.emit("plotly_relayout",e)},A.saveCamera=function(t){function e(t,e,r,n){var i=["up","center","eye"],o=["x","y","z"];return e[i[r]]&&t[i[r]][o[n]]===e[i[r]][o[n]]}var r=this.getCamera(),n=d.nestedProperty(t,this.id+".camera"),i=n.get(),o=!1;if(void 0===i)o=!0;else for(var a=0;3>a;a++)for(var s=0;3>s;s++)if(!e(r,i,a,s)){o=!0;break}return o&&n.set(r),o},A.updateFx=function(t,e){var r=this.camera;r&&("orbit"===t?(r.mode="orbit",r.keyBindingMode="rotate"):"turntable"===t?(r.up=[0,0,1],r.mode="turntable",r.keyBindingMode="rotate"):r.keyBindingMode=t),this.fullSceneLayout.hovermode=e},A.toImage=function(t){t||(t="png"),this.staticMode&&this.container.appendChild(c),this.glplot.redraw();var e=this.glplot.gl,r=e.drawingBufferWidth,n=e.drawingBufferHeight;e.bindFramebuffer(e.FRAMEBUFFER,null);var i=new Uint8Array(r*n*4);e.readPixels(0,0,r,n,e.RGBA,e.UNSIGNED_BYTE,i);for(var o=0,a=n-1;a>o;++o,--a)for(var s=0;r>s;++s)for(var l=0;4>l;++l){var u=i[4*(r*o+s)+l];i[4*(r*o+s)+l]=i[4*(r*a+s)+l],i[4*(r*a+s)+l]=u}var h=document.createElement("canvas");h.width=r,h.height=n;var f=h.getContext("2d"),d=f.createImageData(r,n);d.data.set(i),f.putImageData(d,0,0);var p;switch(t){case"jpeg":p=h.toDataURL("image/jpeg");break;case"webp":p=h.toDataURL("image/webp");break;default:p=h.toDataURL("image/png")}return this.staticMode&&this.container.removeChild(c),p},e.exports=o},{"../../lib":568,"../../lib/show_no_webgl_msg":578,"../../lib/str2rgbarray":580,"../../plots/cartesian/axes":592,"../../plots/cartesian/graph_interact":599,"../../plots/plots":648,"./camera":627,"./layout/convert":632,"./layout/spikes":635,"./layout/tick_marks":636,"./project":637,"./set_convert":639,"gl-plot3d":189}],639:[function(t,e,r){"use strict";var n=t("../cartesian/axes"),i=function(){};e.exports=function(t){n.setConvert(t),t.setScale=i}},{"../cartesian/axes":592}],640:[function(t,e,r){"use strict";var n=t("../plotly"),i=t("./font_attributes"),o=t("../components/color/attributes"),a=n.Lib.extendFlat;e.exports={font:{family:a({},i.family,{dflt:'"Open Sans", verdana, arial, sans-serif'}),size:a({},i.size,{dflt:12}),color:a({},i.color,{dflt:o.defaultLine})},title:{valType:"string",dflt:"Click to enter Plot title"},titlefont:a({},i,{}),autosize:{valType:"enumerated",values:[!0,!1,"initial"]},width:{valType:"number",min:10,dflt:700},height:{valType:"number",min:10,dflt:450},margin:{l:{valType:"number",min:0,dflt:80},r:{valType:"number",min:0,dflt:80},t:{valType:"number",min:0,dflt:100},b:{valType:"number",min:0,dflt:80},pad:{valType:"number",min:0,dflt:0},autoexpand:{
valType:"boolean",dflt:!0}},paper_bgcolor:{valType:"color",dflt:o.background},plot_bgcolor:{valType:"color",dflt:o.background},separators:{valType:"string",dflt:".,"},hidesources:{valType:"boolean",dflt:!1},smith:{valType:"enumerated",values:[!1],dflt:!1},showlegend:{valType:"boolean"},_composedModules:{"*":"Fx"},_nestedModules:{xaxis:"Axes",yaxis:"Axes",scene:"gl3d",geo:"geo",legend:"Legend",annotations:"Annotations",shapes:"Shapes",images:"Images",updatemenus:"UpdateMenus",ternary:"ternary",mapbox:"mapbox"}}},{"../components/color/attributes":482,"../plotly":589,"./font_attributes":610}],641:[function(t,e,r){"use strict";e.exports={styleUrlPrefix:"mapbox://styles/mapbox/",styleUrlSuffix:"v9",controlContainerClassName:"mapboxgl-control-container",noAccessTokenErrorMsg:["Missing Mapbox access token.","Mapbox trace type require a Mapbox access token to be registered.","For example:","  Plotly.plot(gd, data, layout, { mapboxAccessToken: 'my-access-token' });","More info here: https://www.mapbox.com/help/define-access-token/"].join("\n"),mapOnErrorMsg:"Mapbox error."}},{}],642:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function(t,e){var r=t.split(" "),i=r[0],o=r[1],a=Array.isArray(e)?n.mean(e):e,s=.5+a/100,l=1.5+a/100,u=["",""],c=[0,0];switch(i){case"top":u[0]="top",c[1]=-l;break;case"bottom":u[0]="bottom",c[1]=l}switch(o){case"left":u[1]="right",c[0]=-s;break;case"right":u[1]="left",c[0]=s}var h;return h=u[0]&&u[1]?u.join("-"):u[0]?u[0]:u[1]?u[1]:"center",{anchor:h,offset:c}}},{"../../lib":568}],643:[function(t,e,r){"use strict";function n(t,e){for(var r=[],n=0;n<t.length;n++){var i=t[n],o=i[0].trace;o.subplot===e&&r.push(i)}return r}function i(t,e){for(var r=t._fullLayout,n=t._context,i=n.mapboxAccessToken,o=0;o<e.length;o++){var a=r[e[o]];if(a.accesstoken){i=a.accesstoken;break}}if(!i)throw new Error(u.noAccessTokenErrorMsg);return i}var o=t("mapbox-gl"),a=t("../plots"),s=t("../../constants/xmlns_namespaces"),l=t("./mapbox"),u=t("./constants");r.name="mapbox",r.attr="subplot",r.idRoot="mapbox",r.idRegex=/^mapbox([2-9]|[1-9][0-9]+)?$/,r.attrRegex=/^mapbox([2-9]|[1-9][0-9]+)?$/,r.attributes={subplot:{valType:"subplotid",dflt:"mapbox"}},r.layoutAttributes=t("./layout_attributes"),r.supplyLayoutDefaults=t("./layout_defaults"),r.plot=function(t){var e=t._fullLayout,r=t.calcdata,s=a.getSubplotIds(e,"mapbox"),u=i(t,s);o.accessToken=u;for(var c=0;c<s.length;c++){var h=s[c],f=n(r,h),d=e[h],p=d._subplot;d.accesstoken=u,p||(p=l({gd:t,container:e._glcontainer.node(),id:h,fullLayout:e,staticPlot:t._context.staticPlot}),e[h]._subplot=p),p.plot(f,e,t._promises)}},r.clean=function(t,e,r,n){for(var i=a.getSubplotIds(n,"mapbox"),o=0;o<i.length;o++){var s=i[o];!e[s]&&n[s]._subplot&&n[s]._subplot.destroy()}},r.toSVG=function(t){for(var e=t._fullLayout,r=a.getSubplotIds(e,"mapbox"),n=e._size,i=0;i<r.length;i++){var o=e[r[i]],l=o.domain,u=o._subplot,c=u.toImage("png"),h=e._glimages.append("svg:image");h.attr({xmlns:s.svg,"xlink:href":c,x:n.l+n.w*l.x[0],y:n.t+n.h*(1-l.y[1]),width:n.w*(l.x[1]-l.x[0]),height:n.h*(l.y[1]-l.y[0]),preserveAspectRatio:"none"}),u.destroy()}}},{"../../constants/xmlns_namespaces":556,"../plots":648,"./constants":641,"./layout_attributes":645,"./layout_defaults":646,"./mapbox":647,"mapbox-gl":260}],644:[function(t,e,r){"use strict";function n(t,e){this.mapbox=t,this.map=t.map,this.uid=t.uid+"-layer"+e,this.idSource=this.uid+"-source",this.idLayer=this.uid+"-layer",this.sourceType=null,this.source=null,this.layerType=null,this.below=null,this.visible=!1}function i(t){var e=t.source;return s.isPlainObject(e)||"string"==typeof e&&e.length>0}function o(t){var e={},r={};switch(t.type){case"circle":s.extendFlat(r,{"circle-radius":t.circle.radius,"circle-color":t.color,"circle-opacity":t.opacity});break;case"line":s.extendFlat(r,{"line-width":t.line.width,"line-color":t.color,"line-opacity":t.opacity});break;case"fill":s.extendFlat(r,{"fill-color":t.color,"fill-outline-color":t.fill.outlinecolor,"fill-opacity":t.opacity});break;case"symbol":var n=t.symbol,i=l(n.textposition,n.iconsize);s.extendFlat(e,{"icon-image":n.icon+"-15","icon-size":n.iconsize/10,"text-field":n.text,"text-size":n.textfont.size,"text-anchor":i.anchor,"text-offset":i.offset}),s.extendFlat(r,{"icon-color":t.color,"text-color":n.textfont.color,"text-opacity":t.opacity})}return{layout:e,paint:r}}function a(t){var e,r=t.sourcetype,n=t.source,i={type:r},o="string"==typeof n;return"geojson"===r?e="data":"vector"===r&&(e=o?"url":"tiles"),i[e]=n,i}var s=t("../../lib"),l=t("./convert_text_opts"),u=n.prototype;u.update=function(t){this.visible?this.needsNewSource(t)?(this.updateLayer(t),this.updateSource(t)):this.needsNewLayer(t)&&this.updateLayer(t):(this.updateSource(t),this.updateLayer(t)),this.updateStyle(t),this.visible=i(t)},u.needsNewSource=function(t){return this.sourceType!==t.sourcetype||this.source!==t.source||this.layerType!==t.type},u.needsNewLayer=function(t){return this.layerType!==t.type||this.below!==t.below},u.updateSource=function(t){var e=this.map;if(e.getSource(this.idSource)&&e.removeSource(this.idSource),this.sourceType=t.sourcetype,this.source=t.source,i(t)){var r=a(t);e.addSource(this.idSource,r)}},u.updateLayer=function(t){var e=this.map;if(e.getLayer(this.idLayer)&&e.removeLayer(this.idLayer),this.layerType=t.type,i(t)){e.addLayer({id:this.idLayer,source:this.idSource,"source-layer":t.sourcelayer||"",type:t.type},t.below);var r={visibility:"visible"};this.mapbox.setOptions(this.idLayer,"setLayoutProperty",r)}},u.updateStyle=function(t){var e=o(t);i(t)&&(this.mapbox.setOptions(this.idLayer,"setLayoutProperty",e.layout),this.mapbox.setOptions(this.idLayer,"setPaintProperty",e.paint))},u.dispose=function(){var t=this.map;t.removeLayer(this.idLayer),t.removeSource(this.idSource)},e.exports=function(t,e,r){var i=new n(t,e);return i.update(r),i}},{"../../lib":568,"./convert_text_opts":642}],645:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../components/color").defaultLine,o=t("../font_attributes"),a=t("../../traces/scatter/attributes").textposition;e.exports={domain:{x:{valType:"info_array",items:[{valType:"number",min:0,max:1},{valType:"number",min:0,max:1}],dflt:[0,1]},y:{valType:"info_array",items:[{valType:"number",min:0,max:1},{valType:"number",min:0,max:1}],dflt:[0,1]}},accesstoken:{valType:"string",noBlank:!0,strict:!0},style:{valType:"any",values:["basic","streets","outdoors","light","dark","satellite","satellite-streets"],dflt:"basic"},center:{lon:{valType:"number",dflt:0},lat:{valType:"number",dflt:0}},zoom:{valType:"number",dflt:1},bearing:{valType:"number",dflt:0},pitch:{valType:"number",dflt:0},layers:{_isLinkedToArray:!0,sourcetype:{valType:"enumerated",values:["geojson","vector"],dflt:"geojson"},source:{valType:"any"},sourcelayer:{valType:"string",dflt:""},type:{valType:"enumerated",values:["circle","line","fill","symbol"],dflt:"circle"},below:{valType:"string",dflt:""},color:{valType:"color",dflt:i},opacity:{valType:"number",min:0,max:1,dflt:1},circle:{radius:{valType:"number",dflt:15}},line:{width:{valType:"number",dflt:2}},fill:{outlinecolor:{valType:"color",dflt:i}},symbol:{icon:{valType:"string",dflt:"marker"},iconsize:{valType:"number",dflt:10},text:{valType:"string",dflt:""},textfont:n.extendDeep({},o,{family:{dflt:"Open Sans Regular, Arial Unicode MS Regular"}}),textposition:n.extendFlat({},a,{arrayOk:!1})}}}},{"../../components/color":483,"../../lib":568,"../../traces/scatter/attributes":750,"../font_attributes":610}],646:[function(t,e,r){"use strict";function n(t,e,r){r("accesstoken"),r("style"),r("center.lon"),r("center.lat"),r("zoom"),r("bearing"),r("pitch"),i(t,e),e._input=t}function i(t,e){function r(t,e){return o.coerce(n,i,s.layers,t,e)}for(var n,i,a=t.layers||[],l=e.layers=[],u=0;u<a.length;u++)if(n=a[u],i={},o.isPlainObject(n)){var c=r("sourcetype");r("source"),"vector"===c&&r("sourcelayer");var h=r("type");r("below"),r("color"),r("opacity"),"circle"===h&&r("circle.radius"),"line"===h&&r("line.width"),"fill"===h&&r("fill.outlinecolor"),"symbol"===h&&(r("symbol.icon"),r("symbol.iconsize"),r("symbol.text"),o.coerceFont(r,"symbol.textfont"),r("symbol.textposition")),i._index=u,l.push(i)}}var o=t("../../lib"),a=t("../subplot_defaults"),s=t("./layout_attributes");e.exports=function(t,e,r){a(t,e,r,{type:"mapbox",attributes:s,handleDefaults:n,partition:"y"})}},{"../../lib":568,"../subplot_defaults":654,"./layout_attributes":645}],647:[function(t,e,r){"use strict";function n(t){this.id=t.id,this.gd=t.gd,this.container=t.container,this.isStatic=t.staticPlot;var e=t.fullLayout;this.uid=e._uid+"-"+this.id,this.opts=e[this.id],this.div=null,this.xaxis=null,this.yaxis=null,this.createFramework(e),this.map=null,this.accessToken=null,this.styleObj=null,this.traceHash={},this.layerList=[]}function i(t){var e=h.style.values,r=h.style.dflt,n={};return u.isPlainObject(t)?(n.id=t.id,n.style=t):"string"==typeof t?(n.id=t,n.style=-1!==e.indexOf(t)?o(t):t):(n.id=r,n.style=o(r)),n}function o(t){return c.styleUrlPrefix+t+"-"+c.styleUrlSuffix}function a(t){return[t.lon,t.lat]}var s=t("mapbox-gl"),l=t("../cartesian/graph_interact"),u=t("../../lib"),c=t("./constants"),h=t("./layout_attributes"),f=t("./layers"),d=n.prototype;e.exports=function(t){var e=new n(t);return e},d.plot=function(t,e,r){var n=this,i=n.opts=e[this.id];n.map&&i.accesstoken!==n.accessToken&&(n.map.remove(),n.map=null,n.styleObj=null,n.traceHash=[],n.layerList={});var o;o=n.map?new Promise(function(r,i){n.updateMap(t,e,r,i)}):new Promise(function(r,i){n.createMap(t,e,r,i)}),r.push(o)},d.createMap=function(t,e,r,n){function o(){l.loneUnhover(e._toppaper)}var h=this,f=h.gd,d=h.opts,p=h.styleObj=i(d.style);h.accessToken=d.accesstoken;var v=h.map=new s.Map({container:h.div,style:p.style,center:a(d.center),zoom:d.zoom,bearing:d.bearing,pitch:d.pitch,interactive:!h.isStatic,preserveDrawingBuffer:h.isStatic}),m=c.controlContainerClassName,g=h.div.getElementsByClassName(m)[0];h.div.removeChild(g),h.rejectOnError(n),v.once("load",function(){h.updateData(t),h.updateLayout(e),h.resolveOnRender(r)}),v.on("move",function(){var t=h.getView();d._input.center=d.center=t.center,d._input.zoom=d.zoom=t.zoom,d._input.bearing=d.bearing=t.bearing,d._input.pitch=d.pitch=t.pitch;var e={};e[h.id]=u.extendFlat({},t),f.emit("plotly_relayout",e)}),v.on("mousemove",function(t){var e=h.div.getBoundingClientRect();t.clientX=t.point.x+e.left,t.clientY=t.point.y+e.top,t.target.getBoundingClientRect=function(){return e},h.xaxis.p2c=function(){return t.lngLat.lng},h.yaxis.p2c=function(){return t.lngLat.lat},l.hover(f,t,h.id)}),v.on("click",function(){l.click(f,{target:!0})}),v.on("dragstart",o),v.on("zoomstart",o)},d.updateMap=function(t,e,r,n){var o=this,a=o.map;o.rejectOnError(n);var s=i(o.opts.style);o.styleObj.id!==s.id?(o.styleObj=s,a.setStyle(s.style),a.style.once("load",function(){o.traceHash={},o.updateData(t),o.updateLayout(e),o.resolveOnRender(r)})):(o.updateData(t),o.updateLayout(e),o.resolveOnRender(r))},d.updateData=function(t){var e,r,n,i,o=this.traceHash;for(n=0;n<t.length;n++){var a=t[n];r=a[0].trace,e=o[r.uid],e?e.update(a):o[r.uid]=r._module.plot(this,a)}var s=Object.keys(o);t:for(n=0;n<s.length;n++){var l=s[n];for(i=0;i<t.length;i++)if(r=t[i][0].trace,l===r.uid)continue t;e=o[l],e.dispose(),delete o[l]}},d.updateLayout=function(t){var e=this.map,r=this.opts;e.setCenter(a(r.center)),e.setZoom(r.zoom),e.setBearing(r.bearing),e.setPitch(r.pitch),this.updateLayers(),this.updateFramework(t),this.map.resize()},d.resolveOnRender=function(t){var e=this.map;e.on("render",function r(){e.loaded()&&(e.off("render",r),t())})},d.rejectOnError=function(t){function e(){t(new Error(c.mapOnErrorMsg))}var r=this.map;r.once("error",e),r.once("style.error",e),r.once("source.error",e),r.once("tile.error",e),r.once("layer.error",e)},d.createFramework=function(t){var e=this,r=e.div=document.createElement("div");r.id=e.uid,r.style.position="absolute",e.container.appendChild(r),e.xaxis={_id:"x",c2p:function(t){return e.project(t).x}},e.yaxis={_id:"y",c2p:function(t){return e.project(t).y}},e.updateFramework(t)},d.updateFramework=function(t){var e=t[this.id].domain,r=t._size,n=this.div.style;n.width=r.w*(e.x[1]-e.x[0])+"px",n.height=r.h*(e.y[1]-e.y[0])+"px",n.left=r.l+e.x[0]*r.w+"px",n.top=r.t+(1-e.y[1])*r.h+"px",this.xaxis._offset=r.l+e.x[0]*r.w,this.xaxis._length=r.w*(e.x[1]-e.x[0]),this.yaxis._offset=r.t+(1-e.y[1])*r.h,this.yaxis._length=r.h*(e.y[1]-e.y[0])},d.updateLayers=function(){var t,e=this.opts,r=e.layers,n=this.layerList;if(r.length!==n.length){for(t=0;t<n.length;t++)n[t].dispose();for(n=this.layerList=[],t=0;t<r.length;t++)n.push(f(this,t,r[t]))}else for(t=0;t<r.length;t++)n[t].update(r[t])},d.destroy=function(){this.map&&this.map.remove(),this.container.removeChild(this.div)},d.toImage=function(){return this.map.getCanvas().toDataURL()},d.createGeoJSONSource=function(){var t={type:"Feature",geometry:{type:"Point",coordinates:[]}};return new s.GeoJSONSource({data:t})},d.setOptions=function(t,e,r){for(var n=this.map,i=Object.keys(r),o=0;o<i.length;o++){var a=i[o];n[e](t,a,r[a])}},d.project=function(t){return this.map.project(new s.LngLat(t[0],t[1]))},d.getView=function(){var t=this.map,e=t.getCenter(),r={lon:e.lng,lat:e.lat};return{center:r,zoom:t.getZoom(),bearing:t.getBearing(),pitch:t.getPitch()}}},{"../../lib":568,"../cartesian/graph_interact":599,"./constants":641,"./layers":644,"./layout_attributes":645,"mapbox-gl":260}],648:[function(t,e,r){"use strict";function n(t){return"object"==typeof t&&(t=t.type),t}function i(t,e){e.text("");var r=e.append("a").attr({"xlink:xlink:href":"#","class":"link--impt link--embedview","font-weight":"bold"}).text(t._context.linkText+" "+String.fromCharCode(187));if(t._context.sendData)r.on("click",function(){d.sendDataToCloud(t)});else{var n=window.location.pathname.split("/"),i=window.location.search;r.attr({"xlink:xlink:show":"new","xlink:xlink:href":"/"+n[2].split(".")[0]+"/"+n[1]+i})}}function o(t,e){for(var r=h.isPlainObject,n=Array.isArray,i=Object.keys(e),a=0;a<i.length;a++){var s=i[a],l=e[s],u=t[s];if("_"===s.charAt(0)||"function"==typeof l){if(s in t)continue;t[s]=l}else if(n(l)&&n(u)&&r(l[0]))for(var c=0;c<l.length;c++)r(l[c])&&r(u[c])&&o(u[c],l[c]);else r(l)&&r(u)&&(o(u,l),Object.keys(u).length||delete t[s])}}function a(t,e,r){if(Array.isArray(t.transforms))for(var n=t.transforms,i=e.transforms=[],o=0;o<n.length;o++){var a,s=n[o],l=s.type,u=y[l];u||h.warn("Unrecognized transform type "+l+"."),u&&u.supplyDefaults?(a=u.supplyDefaults(s,e,r),a.type=l):a=h.extendFlat({},s),i.push(a)}}function s(t,e,r){for(var n=t.transforms,i=[t],o=0;o<n.length;o++){var a=n[o],s=a.type,l=y[s];l&&(i=l.transform(i,{transform:a,fullTrace:t,fullData:e,layout:r}))}return i}var l=t("d3"),u=t("fast-isnumeric"),c=t("../plotly"),h=t("../lib"),f=t("../components/color"),d=e.exports={},p=d.modules={},v=d.allTypes=[],m=d.allCategories={},g=d.subplotsRegistry={},y=d.transformsRegistry={};d.attributes=t("./attributes"),d.attributes.type.values=v,d.fontAttrs=t("./font_attributes"),d.layoutAttributes=t("./layout_attributes"),d.fontWeight="normal",d.register=function(t,e,r,n){if(p[e])return void h.log("Type "+e+" already registered");for(var i={},o=0;o<r.length;o++)i[r[o]]=!0,m[r[o]]=!0;p[e]={_module:t,categories:i},n&&Object.keys(n).length&&(p[e].meta=n),v.push(e)},d.getModule=function(t){if(void 0!==t.r)return h.warn("Tried to put a polar trace on an incompatible graph of cartesian data. Ignoring this dataset.",t),!1;var e=p[n(t)];return e?e._module:!1},d.traceIs=function(t,e){if(t=n(t),"various"===t)return!1;var r=p[t];return r||(void 0!==t&&h.log("Unrecognized trace type "+t+"."),r=p[d.attributes.type.dflt]),!!r.categories[e]},d.registerSubplot=function(t){var e=t.name;return g[e]?void h.log("Plot type "+e+" already registered."):void(g[e]=t)},d.findSubplotIds=function(t,e){var r=[];if(void 0===d.subplotsRegistry[e])return r;for(var n=d.subplotsRegistry[e].attr,i=0;i<t.length;i++){var o=t[i];d.traceIs(o,e)&&-1===r.indexOf(o[n])&&r.push(o[n])}return r},d.getSubplotIds=function(t,e){var r=d.subplotsRegistry[e];if(void 0===r)return[];if(!("cartesian"!==e||t._has&&t._has("cartesian")))return[];if(!("gl2d"!==e||t._has&&t._has("gl2d")))return[];if("cartesian"===e||"gl2d"===e)return Object.keys(t._plots||{});for(var n=r.idRegex,i=Object.keys(t),o=[],a=0;a<i.length;a++){var s=i[a];n.test(s)&&o.push(s)}var l=r.idRoot.length;return o.sort(function(t,e){var r=+(t.substr(l)||1),n=+(e.substr(l)||1);return r-n}),o},d.getSubplotData=function(t,e,r){if(void 0===d.subplotsRegistry[e])return[];for(var n,i=d.subplotsRegistry[e].attr,o=[],a=0;a<t.length;a++)if(n=t[a],"gl2d"===e&&d.traceIs(n,"gl2d")){var s=c.Axes.subplotMatch,l="x"+r.match(s)[1],u="y"+r.match(s)[2];n[i[0]]===l&&n[i[1]]===u&&o.push(n)}else n[i]===r&&o.push(n);return o},d.redrawText=function(t){return t.data&&t.data[0]&&t.data[0].r?void 0:new Promise(function(e){setTimeout(function(){c.Annotations.drawAll(t),c.Legend.draw(t),(t.calcdata||[]).forEach(function(t){t[0]&&t[0].t&&t[0].t.cb&&t[0].t.cb()}),e(d.previousPromises(t))},300)})},d.resize=function(t){return new Promise(function(e,r){t&&"none"!==l.select(t).style("display")||r(new Error("Resize must be passed a plot div element.")),t._redrawTimer&&clearTimeout(t._redrawTimer),t._redrawTimer=setTimeout(function(){if((t._fullLayout||{}).autosize){var r=t.changed;t.autoplay=!0,c.relayout(t,{autosize:!0}),t.changed=r,e(t)}},100)})},d.previousPromises=function(t){return(t._promises||[]).length?Promise.all(t._promises).then(function(){t._promises=[]}):void 0},d.addLinks=function(t){var e=t._fullLayout,r=e._paper.selectAll("text.js-plot-link-container").data([0]);r.enter().append("text").classed("js-plot-link-container",!0).style({"font-family":'"Open Sans", Arial, sans-serif',"font-size":"12px",fill:f.defaultLine,"pointer-events":"all"}).each(function(){var t=l.select(this);t.append("tspan").classed("js-link-to-tool",!0),t.append("tspan").classed("js-link-spacer",!0),t.append("tspan").classed("js-sourcelinks",!0)});var n=r.node(),o={y:e._paper.attr("height")-9};document.body.contains(n)&&n.getComputedTextLength()>=e.width-20?(o["text-anchor"]="start",o.x=5):(o["text-anchor"]="end",o.x=e._paper.attr("width")-7),r.attr(o);var a=r.select(".js-link-to-tool"),s=r.select(".js-link-spacer"),u=r.select(".js-sourcelinks");t._context.showSources&&t._context.showSources(t),t._context.showLink&&i(t,a),s.text(a.text()&&u.text()?" - ":"")},d.sendDataToCloud=function(t){t.emit("plotly_beforeexport");var e=window.PLOTLYENV&&window.PLOTLYENV.BASE_URL||"https://plot.ly",r=l.select(t).append("div").attr("id","hiddenform").style("display","none"),n=r.append("form").attr({action:e+"/external",method:"post",target:"_blank"}),i=n.append("input").attr({type:"text",name:"data"});return i.node().value=d.graphJson(t,!1,"keepdata"),n.node().submit(),r.remove(),t.emit("plotly_afterexport"),!1},d.supplyDefaults=function(t){var e,r=t._fullLayout||{},n=t._fullLayout={},i=t.layout||{},a=t._fullData||[],s=t._fullData=[],l=t.data||[];d.supplyLayoutGlobalDefaults(i,n),n._dataLength=l.length,d.supplyDataDefaults(l,s,n),n._has=d._hasPlotType.bind(n);var u=n._modules;for(e=0;e<u.length;e++){var h=u[e];h.cleanData&&h.cleanData(s)}if(a.length===l.length)for(e=0;e<s.length;e++)o(s[e],a[e]);d.supplyLayoutModuleDefaults(i,n,s),n._hasCartesian=n._has("cartesian"),n._hasGeo=n._has("geo"),n._hasGL3D=n._has("gl3d"),n._hasGL2D=n._has("gl2d"),n._hasTernary=n._has("ternary"),n._hasPie=n._has("pie"),d.cleanPlot(s,n,a,r),o(n,r),d.doAutoMargin(t);var f=c.Axes.list(t);for(e=0;e<f.length;e++){var p=f[e];p._gd=t,p.setScale()}if((t.calcdata||[]).length===s.length)for(e=0;e<s.length;e++){var v=s[e];(t.calcdata[e][0]||{}).trace=v}},d._hasPlotType=function(t){for(var e=this._basePlotModules||[],r=0;r<e.length;r++){var n=e[r];if(n.name===t)return!0}return!1},d.cleanPlot=function(t,e,r,n){var i,o,a=n._basePlotModules||[];for(i=0;i<a.length;i++){var s=a[i];s.clean&&s.clean(t,e,r,n)}var l=!!n._paper,u=!!n._infolayer;t:for(i=0;i<r.length;i++){var c=r[i],h=c.uid;for(o=0;o<t.length;o++){var f=t[o];if(h===f.uid)continue t}l&&n._paper.selectAll(".hm"+h+",.contour"+h+",#clip"+h).remove(),u&&n._infolayer.selectAll(".cb"+h).remove()}},d.supplyDataDefaults=function(t,e,r){function n(t){e.push(t);var r=t._module;r&&(h.pushUnique(i,r),h.pushUnique(o,t._module.basePlotModule),a++)}for(var i=r._modules=[],o=r._basePlotModules=[],a=0,l=0;l<t.length;l++){var u=t[l],c=d.supplyTraceDefaults(u,a,r);if(c.transforms&&c.transforms.length)for(var f=s(c,e,r),p=0;p<f.length;p++){var v=f[p],m=d.supplyTraceDefaults(v,a,r);v.uid=m.uid=c.uid+p,m.index=l,m._input=u,m._fullInput=c,m._expandedIndex=a,m._expandedInput=v,n(m)}else c.index=l,c._input=u,c._expandedIndex=a,n(c)}},d.supplyTraceDefaults=function(t,e,r){function n(e,r){return h.coerce(t,o,d.attributes,e,r)}function i(e,r){return d.traceIs(o,e)?h.coerce(t,o,d.subplotsRegistry[e].attributes,r):void 0}var o={},s=f.defaults[e%f.defaults.length],l=n("visible");n("type"),n("uid");for(var u=Object.keys(g),c=0;c<u.length;c++){var p=u[c];if(-1===["cartesian","gl2d"].indexOf(p)){var v=g[p].attr;v&&i(p,v)}}if(l){var m=d.getModule(o);o._module=m,n("hoverinfo",1===r._dataLength?"x+y+z+text":void 0),m&&m.supplyDefaults(t,o,s,r),n("name","trace "+e),d.traceIs(o,"noOpacity")||n("opacity"),i("cartesian","xaxis"),i("cartesian","yaxis"),i("gl2d","xaxis"),i("gl2d","yaxis"),d.traceIs(o,"showLegend")&&(n("showlegend"),n("legendgroup")),a(t,o,r)}return o},d.supplyLayoutGlobalDefaults=function(t,e){function r(r,n){return h.coerce(t,e,d.layoutAttributes,r,n)}var n=h.coerceFont(r,"font");r("title"),h.coerceFont(r,"titlefont",{family:n.family,size:Math.round(1.4*n.size),color:n.color});var i=r("autosize",t.width&&t.height?!1:"initial");r("width"),r("height"),r("margin.l"),r("margin.r"),r("margin.t"),r("margin.b"),r("margin.pad"),r("margin.autoexpand"),"initial"!==i&&d.sanitizeMargins(e),r("paper_bgcolor"),r("separators"),r("hidesources"),r("smith")},d.supplyLayoutModuleDefaults=function(t,e,r){var n,i;c.Axes.supplyLayoutDefaults(t,e,r);var o=e._basePlotModules;for(n=0;n<o.length;n++)i=o[n],"cartesian"!==i.name&&i.supplyLayoutDefaults&&i.supplyLayoutDefaults(t,e,r);var a=e._modules;for(n=0;n<a.length;n++)i=a[n],i.supplyLayoutDefaults&&i.supplyLayoutDefaults(t,e,r);var s=["Fx","Annotations","Shapes","Legend","Images","UpdateMenus"];for(n=0;n<s.length;n++)i=s[n],c[i]&&c[i].supplyLayoutDefaults(t,e,r)},d.purge=function(t){var e=t._fullLayout||{};void 0!==e._glcontainer&&e._glcontainer.remove(),void 0!==e._geocontainer&&e._geocontainer.remove(),e._modeBar&&e._modeBar.destroy(),delete t.data,delete t.layout,delete t._fullData,delete t._fullLayout,delete t.calcdata,delete t.framework,delete t.empty,delete t.fid,delete t.undoqueue,delete t.undonum,delete t.autoplay,delete t.changed,delete t._tester,delete t._testref,delete t._promises,delete t._redrawTimer,delete t._replotting,delete t.firstscatter,delete t.hmlumcount,delete t.hmpixcount,delete t.numboxes,delete t._hoverTimer,delete t._lastHoverTime,t.removeAllListeners&&t.removeAllListeners()},d.style=function(t){for(var e=t._fullLayout._modules,r=0;r<e.length;r++){var n=e[r];n.style&&n.style(t)}},d.sanitizeMargins=function(t){if(t&&t.margin){var e,r=t.width,n=t.height,i=t.margin,o=r-(i.l+i.r),a=n-(i.t+i.b);0>o&&(e=(r-1)/(i.l+i.r),i.l=Math.floor(e*i.l),i.r=Math.floor(e*i.r)),0>a&&(e=(n-1)/(i.t+i.b),i.t=Math.floor(e*i.t),i.b=Math.floor(e*i.b))}},d.autoMargin=function(t,e,r){var n=t._fullLayout;if(n._pushmargin||(n._pushmargin={}),n.margin.autoexpand!==!1){if(r){var i=void 0===r.pad?12:r.pad;r.l+r.r>.5*n.width&&(r.l=r.r=0),r.b+r.t>.5*n.height&&(r.b=r.t=0),n._pushmargin[e]={l:{val:r.x,size:r.l+i},r:{val:r.x,size:r.r+i},b:{val:r.y,size:r.b+i},t:{val:r.y,size:r.t+i}}}else delete n._pushmargin[e];t._replotting||d.doAutoMargin(t)}},d.doAutoMargin=function(t){var e=t._fullLayout;e._size||(e._size={}),e._pushmargin||(e._pushmargin={});var r=e._size,n=JSON.stringify(r),i=Math.max(e.margin.l||0,0),o=Math.max(e.margin.r||0,0),a=Math.max(e.margin.t||0,0),s=Math.max(e.margin.b||0,0),l=e._pushmargin;return e.margin.autoexpand!==!1&&(l.base={l:{val:0,size:i},r:{val:1,size:o},t:{val:1,size:a},b:{val:0,size:s}},Object.keys(l).forEach(function(t){var r=l[t].l||{},n=l[t].b||{},c=r.val,h=r.size,f=n.val,d=n.size;Object.keys(l).forEach(function(t){if(u(h)&&l[t].r){var r=l[t].r.val,n=l[t].r.size;if(r>c){var p=(h*r+(n-e.width)*c)/(r-c),v=(n*(1-c)+(h-e.width)*(1-r))/(r-c);p>=0&&v>=0&&p+v>i+o&&(i=p,o=v)}}if(u(d)&&l[t].t){var m=l[t].t.val,g=l[t].t.size;if(m>f){var y=(d*m+(g-e.height)*f)/(m-f),b=(g*(1-f)+(d-e.height)*(1-m))/(m-f);y>=0&&b>=0&&y+b>s+a&&(s=y,a=b)}}})})),r.l=Math.round(i),r.r=Math.round(o),r.t=Math.round(a),r.b=Math.round(s),r.p=Math.round(e.margin.pad),r.w=Math.round(e.width)-r.l-r.r,r.h=Math.round(e.height)-r.t-r.b,t._replotting||"{}"===n||n===JSON.stringify(e._size)?void 0:c.plot(t)},d.graphJson=function(t,e,r,n,i){function o(t){if("function"==typeof t)return null;if(h.isPlainObject(t)){var e,n,i={};for(e in t)if("function"!=typeof t[e]&&-1===["_","["].indexOf(e.charAt(0))){if("keepdata"===r){if("src"===e.substr(e.length-3))continue}else if("keepstream"===r){if(n=t[e+"src"],"string"==typeof n&&n.indexOf(":")>0&&!h.isPlainObject(t.stream))continue}else if("keepall"!==r&&(n=t[e+"src"],"string"==typeof n&&n.indexOf(":")>0))continue;i[e]=o(t[e])}return i}return Array.isArray(t)?t.map(o):t&&t.getTime?h.ms2DateTime(t):t}(i&&e&&!t._fullData||i&&!e&&!t._fullLayout)&&d.supplyDefaults(t);var a=i?t._fullData:t.data,s=i?t._fullLayout:t.layout,l={data:(a||[]).map(function(t){var r=o(t);return e&&delete r.fit,r})};return e||(l.layout=o(s)),t.framework&&t.framework.isPolar&&(l=t.framework.getConfig()),"object"===n?l:JSON.stringify(l)}},{"../components/color":483,"../lib":568,"../plotly":589,"./attributes":590,"./font_attributes":610,"./layout_attributes":640,d3:119,"fast-isnumeric":123}],649:[function(t,e,r){"use strict";var n=t("../../traces/scatter/attributes"),i=n.marker;e.exports={r:n.r,t:n.t,marker:{color:i.color,size:i.size,symbol:i.symbol,opacity:i.opacity}}},{"../../traces/scatter/attributes":750}],650:[function(t,e,r){"use strict";function n(t,e){var r={showline:{valType:"boolean"},showticklabels:{valType:"boolean"},tickorientation:{valType:"enumerated",values:["horizontal","vertical"]},ticklen:{valType:"number",min:0},tickcolor:{valType:"color"},ticksuffix:{valType:"string"},endpadding:{valType:"number"},visible:{valType:"boolean"}};return o({},e,r)}var i=t("../cartesian/layout_attributes"),o=t("../../lib/extend").extendFlat,a=o({},i.domain,{});e.exports={radialaxis:n("radial",{range:{valType:"info_array",items:[{valType:"number"},{valType:"number"}]},domain:a,orientation:{valType:"number"}}),angularaxis:n("angular",{range:{valType:"info_array",items:[{valType:"number",dflt:0},{valType:"number",dflt:360}]},domain:a}),layout:{direction:{valType:"enumerated",values:["clockwise","counterclockwise"]},orientation:{valType:"angle"}}}},{"../../lib/extend":563,"../cartesian/layout_attributes":601}],651:[function(t,e,r){var n=t("../../plotly"),i=t("d3"),o=e.exports={version:"0.2.2",manager:t("./micropolar_manager")},a=n.Lib.extendDeepAll;o.Axis=function(){function t(t){r=t||r;var u=l.data,h=l.layout;return("string"==typeof r||r.nodeName)&&(r=i.select(r)),r.datum(u).each(function(t,r){function l(t,e){return s(t)%360+h.orientation}var u=t.slice();c={data:o.util.cloneJson(u),layout:o.util.cloneJson(h)};var f=0;u.forEach(function(t,e){t.color||(t.color=h.defaultColorRange[f],f=(f+1)%h.defaultColorRange.length),t.strokeColor||(t.strokeColor="LinePlot"===t.geometry?t.color:i.rgb(t.color).darker().toString()),c.data[e].color=t.color,c.data[e].strokeColor=t.strokeColor,c.data[e].strokeDash=t.strokeDash,c.data[e].strokeSize=t.strokeSize});var d=u.filter(function(t,e){var r=t.visible;return"undefined"==typeof r||r===!0}),p=!1,v=d.map(function(t,e){return p=p||"undefined"!=typeof t.groupId,t});if(p){var m=i.nest().key(function(t,e){return"undefined"!=typeof t.groupId?t.groupId:"unstacked"}).entries(v),g=[],y=m.map(function(t,e){if("unstacked"===t.key)return t.values;var r=t.values[0].r.map(function(t,e){return 0});return t.values.forEach(function(t,e,n){t.yStack=[r],g.push(r),r=o.util.sumArrays(t.r,r)}),t.values});d=i.merge(y)}d.forEach(function(t,e){t.t=Array.isArray(t.t[0])?t.t:[t.t],t.r=Array.isArray(t.r[0])?t.r:[t.r]});var b=Math.min(h.width-h.margin.left-h.margin.right,h.height-h.margin.top-h.margin.bottom)/2;b=Math.max(10,b);var x,_=[h.margin.left+b,h.margin.top+b];if(p){var w=i.max(o.util.sumArrays(o.util.arrayLast(d).r[0],o.util.arrayLast(g)));x=[0,w]}else x=i.extent(o.util.flattenArray(d.map(function(t,e){return t.r})));h.radialAxis.domain!=o.DATAEXTENT&&(x[0]=0),n=i.scale.linear().domain(h.radialAxis.domain!=o.DATAEXTENT&&h.radialAxis.domain?h.radialAxis.domain:x).range([0,b]),c.layout.radialAxis.domain=n.domain();var M,k=o.util.flattenArray(d.map(function(t,e){return t.t})),A="string"==typeof k[0];A&&(k=o.util.deduplicate(k),M=k.slice(),k=i.range(k.length),d=d.map(function(t,e){var r=t;return t.t=[k],p&&(r.yStack=t.yStack),r}));var T=d.filter(function(t,e){return"LinePlot"===t.geometry||"DotPlot"===t.geometry}).length===d.length,E=null===h.needsEndSpacing?A||!T:h.needsEndSpacing,S=h.angularAxis.domain&&h.angularAxis.domain!=o.DATAEXTENT&&!A&&h.angularAxis.domain[0]>=0,L=S?h.angularAxis.domain:i.extent(k),z=Math.abs(k[1]-k[0]);T&&!A&&(z=0);var I=L.slice();E&&A&&(I[1]+=z);var P=h.angularAxis.ticksCount||4;P>8&&(P=P/(P/8)+P%8),h.angularAxis.ticksStep&&(P=(I[1]-I[0])/P);var C=h.angularAxis.ticksStep||(I[1]-I[0])/(P*(h.minorTicks+1));M&&(C=Math.max(Math.round(C),1)),I[2]||(I[2]=C);var R=i.range.apply(this,I);if(R=R.map(function(t,e){return parseFloat(t.toPrecision(12))}),s=i.scale.linear().domain(I.slice(0,2)).range("clockwise"===h.direction?[0,360]:[360,0]),c.layout.angularAxis.domain=s.domain(),c.layout.angularAxis.endPadding=E?z:0,e=i.select(this).select("svg.chart-root"),"undefined"==typeof e||e.empty()){var D="<svg xmlns='http://www.w3.org/2000/svg' class='chart-root'>' + '<g class='outer-group'>' + '<g class='chart-group'>' + '<circle class='background-circle'></circle>' + '<g class='geometry-group'></g>' + '<g class='radial axis-group'>' + '<circle class='outside-circle'></circle>' + '</g>' + '<g class='angular axis-group'></g>' + '<g class='guides-group'><line></line><circle r='0'></circle></g>' + '</g>' + '<g class='legend-group'></g>' + '<g class='tooltips-group'></g>' + '<g class='title-group'><text></text></g>' + '</g>' + '</svg>",O=(new DOMParser).parseFromString(D,"application/xml"),F=this.appendChild(this.ownerDocument.importNode(O.documentElement,!0));e=i.select(F)}e.select(".guides-group").style({"pointer-events":"none"}),e.select(".angular.axis-group").style({"pointer-events":"none"}),e.select(".radial.axis-group").style({"pointer-events":"none"});var j,N=e.select(".chart-group"),B={fill:"none",stroke:h.tickColor},U={"font-size":h.font.size,"font-family":h.font.family,fill:h.font.color,"text-shadow":["-1px 0px","1px -1px","-1px 1px","1px 1px"].map(function(t,e){return" "+t+" 0 "+h.font.outlineColor}).join(",")};if(h.showLegend){j=e.select(".legend-group").attr({transform:"translate("+[b,h.margin.top]+")"}).style({display:"block"});var V=d.map(function(t,e){var r=o.util.cloneJson(t);return r.symbol="DotPlot"===t.geometry?t.dotType||"circle":"LinePlot"!=t.geometry?"square":"line",r.visibleInLegend="undefined"==typeof t.visibleInLegend||t.visibleInLegend,r.color="LinePlot"===t.geometry?t.strokeColor:t.color,r});o.Legend().config({data:d.map(function(t,e){return t.name||"Element"+e}),legendConfig:a({},o.Legend.defaultConfig().legendConfig,{container:j,elements:V,reverseOrder:h.legend.reverseOrder})})();var q=j.node().getBBox();b=Math.min(h.width-q.width-h.margin.left-h.margin.right,h.height-h.margin.top-h.margin.bottom)/2,b=Math.max(10,b),_=[h.margin.left+b,h.margin.top+b],n.range([0,b]),c.layout.radialAxis.domain=n.domain(),j.attr("transform","translate("+[_[0]+b,_[1]-b]+")");
}else j=e.select(".legend-group").style({display:"none"});e.attr({width:h.width,height:h.height}).style({opacity:h.opacity}),N.attr("transform","translate("+_+")").style({cursor:"crosshair"});var G=[(h.width-(h.margin.left+h.margin.right+2*b+(q?q.width:0)))/2,(h.height-(h.margin.top+h.margin.bottom+2*b))/2];if(G[0]=Math.max(0,G[0]),G[1]=Math.max(0,G[1]),e.select(".outer-group").attr("transform","translate("+G+")"),h.title){var H=e.select("g.title-group text").style(U).text(h.title),X=H.node().getBBox();H.attr({x:_[0]-X.width/2,y:_[1]-b-20})}var Y=e.select(".radial.axis-group");if(h.radialAxis.gridLinesVisible){var W=Y.selectAll("circle.grid-circle").data(n.ticks(5));W.enter().append("circle").attr({"class":"grid-circle"}).style(B),W.attr("r",n),W.exit().remove()}Y.select("circle.outside-circle").attr({r:b}).style(B);var Z=e.select("circle.background-circle").attr({r:b}).style({fill:h.backgroundColor,stroke:h.stroke});if(h.radialAxis.visible){var K=i.svg.axis().scale(n).ticks(5).tickSize(5);Y.call(K).attr({transform:"rotate("+h.radialAxis.orientation+")"}),Y.selectAll(".domain").style(B),Y.selectAll("g>text").text(function(t,e){return this.textContent+h.radialAxis.ticksSuffix}).style(U).style({"text-anchor":"start"}).attr({x:0,y:0,dx:0,dy:0,transform:function(t,e){return"horizontal"===h.radialAxis.tickOrientation?"rotate("+-h.radialAxis.orientation+") translate("+[0,U["font-size"]]+")":"translate("+[0,U["font-size"]]+")"}}),Y.selectAll("g>line").style({stroke:"black"})}var J=e.select(".angular.axis-group").selectAll("g.angular-tick").data(R),$=J.enter().append("g").classed("angular-tick",!0);J.attr({transform:function(t,e){return"rotate("+l(t,e)+")"}}).style({display:h.angularAxis.visible?"block":"none"}),J.exit().remove(),$.append("line").classed("grid-line",!0).classed("major",function(t,e){return e%(h.minorTicks+1)==0}).classed("minor",function(t,e){return!(e%(h.minorTicks+1)==0)}).style(B),$.selectAll(".minor").style({stroke:h.minorTickColor}),J.select("line.grid-line").attr({x1:h.tickLength?b-h.tickLength:0,x2:b}).style({display:h.angularAxis.gridLinesVisible?"block":"none"}),$.append("text").classed("axis-text",!0).style(U);var Q=J.select("text.axis-text").attr({x:b+h.labelOffset,dy:".35em",transform:function(t,e){var r=l(t,e),n=b+h.labelOffset,i=h.angularAxis.tickOrientation;return"horizontal"==i?"rotate("+-r+" "+n+" 0)":"radial"==i?270>r&&r>90?"rotate(180 "+n+" 0)":null:"rotate("+(180>=r&&r>0?-90:90)+" "+n+" 0)"}}).style({"text-anchor":"middle",display:h.angularAxis.labelsVisible?"block":"none"}).text(function(t,e){return e%(h.minorTicks+1)!=0?"":M?M[t]+h.angularAxis.ticksSuffix:t+h.angularAxis.ticksSuffix}).style(U);h.angularAxis.rewriteTicks&&Q.text(function(t,e){return e%(h.minorTicks+1)!=0?"":h.angularAxis.rewriteTicks(this.textContent,e)});var tt=i.max(N.selectAll(".angular-tick text")[0].map(function(t,e){return t.getCTM().e+t.getBBox().width}));j.attr({transform:"translate("+[b+tt,h.margin.top]+")"});var et=e.select("g.geometry-group").selectAll("g").size()>0,rt=e.select("g.geometry-group").selectAll("g.geometry").data(d);if(rt.enter().append("g").attr({"class":function(t,e){return"geometry geometry"+e}}),rt.exit().remove(),d[0]||et){var nt=[];d.forEach(function(t,e){var r={};r.radialScale=n,r.angularScale=s,r.container=rt.filter(function(t,r){return r==e}),r.geometry=t.geometry,r.orientation=h.orientation,r.direction=h.direction,r.index=e,nt.push({data:t,geometryConfig:r})});var it=i.nest().key(function(t,e){return"undefined"!=typeof t.data.groupId||"unstacked"}).entries(nt),ot=[];it.forEach(function(t,e){"unstacked"===t.key?ot=ot.concat(t.values.map(function(t,e){return[t]})):ot.push(t.values)}),ot.forEach(function(t,e){var r;r=Array.isArray(t)?t[0].geometryConfig.geometry:t.geometryConfig.geometry;var n=t.map(function(t,e){return a(o[r].defaultConfig(),t)});o[r]().config(n)()})}var at,st,lt=e.select(".guides-group"),ut=e.select(".tooltips-group"),ct=o.tooltipPanel().config({container:ut,fontSize:8})(),ht=o.tooltipPanel().config({container:ut,fontSize:8})(),ft=o.tooltipPanel().config({container:ut,hasTick:!0})();if(!A){var dt=lt.select("line").attr({x1:0,y1:0,y2:0}).style({stroke:"grey","pointer-events":"none"});N.on("mousemove.angular-guide",function(t,e){var r=o.util.getMousePos(Z).angle;dt.attr({x2:-b,transform:"rotate("+r+")"}).style({opacity:.5});var n=(r+180+360-h.orientation)%360;at=s.invert(n);var i=o.util.convertToCartesian(b+12,r+180);ct.text(o.util.round(at)).move([i[0]+_[0],i[1]+_[1]])}).on("mouseout.angular-guide",function(t,e){lt.select("line").style({opacity:0})})}var pt=lt.select("circle").style({stroke:"grey",fill:"none"});N.on("mousemove.radial-guide",function(t,e){var r=o.util.getMousePos(Z).radius;pt.attr({r:r}).style({opacity:.5}),st=n.invert(o.util.getMousePos(Z).radius);var i=o.util.convertToCartesian(r,h.radialAxis.orientation);ht.text(o.util.round(st)).move([i[0]+_[0],i[1]+_[1]])}).on("mouseout.radial-guide",function(t,e){pt.style({opacity:0}),ft.hide(),ct.hide(),ht.hide()}),e.selectAll(".geometry-group .mark").on("mouseover.tooltip",function(t,r){var n=i.select(this),a=n.style("fill"),s="black",l=n.style("opacity")||1;if(n.attr({"data-opacity":l}),"none"!=a){n.attr({"data-fill":a}),s=i.hsl(a).darker().toString(),n.style({fill:s,opacity:1});var u={t:o.util.round(t[0]),r:o.util.round(t[1])};A&&(u.t=M[t[0]]);var c="t: "+u.t+", r: "+u.r,h=this.getBoundingClientRect(),f=e.node().getBoundingClientRect(),d=[h.left+h.width/2-G[0]-f.left,h.top+h.height/2-G[1]-f.top];ft.config({color:s}).text(c),ft.move(d)}else a=n.style("stroke"),n.attr({"data-stroke":a}),s=i.hsl(a).darker().toString(),n.style({stroke:s,opacity:1})}).on("mousemove.tooltip",function(t,e){return 0!=i.event.which?!1:void(i.select(this).attr("data-fill")&&ft.show())}).on("mouseout.tooltip",function(t,e){ft.hide();var r=i.select(this),n=r.attr("data-fill");n?r.style({fill:n,opacity:r.attr("data-opacity")}):r.style({stroke:r.attr("data-stroke"),opacity:r.attr("data-opacity")})})}),f}var e,r,n,s,l={data:[],layout:{}},u={},c={},h=i.dispatch("hover"),f={};return f.render=function(e){return t(e),this},f.config=function(t){if(!arguments.length)return l;var e=o.util.cloneJson(t);return e.data.forEach(function(t,e){l.data[e]||(l.data[e]={}),a(l.data[e],o.Axis.defaultConfig().data[0]),a(l.data[e],t)}),a(l.layout,o.Axis.defaultConfig().layout),a(l.layout,e.layout),this},f.getLiveConfig=function(){return c},f.getinputConfig=function(){return u},f.radialScale=function(t){return n},f.angularScale=function(t){return s},f.svg=function(){return e},i.rebind(f,h,"on"),f},o.Axis.defaultConfig=function(t,e){var r={data:[{t:[1,2,3,4],r:[10,11,12,13],name:"Line1",geometry:"LinePlot",color:null,strokeDash:"solid",strokeColor:null,strokeSize:"1",visibleInLegend:!0,opacity:1}],layout:{defaultColorRange:i.scale.category10().range(),title:null,height:450,width:500,margin:{top:40,right:40,bottom:40,left:40},font:{size:12,color:"gray",outlineColor:"white",family:"Tahoma, sans-serif"},direction:"clockwise",orientation:0,labelOffset:10,radialAxis:{domain:null,orientation:-45,ticksSuffix:"",visible:!0,gridLinesVisible:!0,tickOrientation:"horizontal",rewriteTicks:null},angularAxis:{domain:[0,360],ticksSuffix:"",visible:!0,gridLinesVisible:!0,labelsVisible:!0,tickOrientation:"horizontal",rewriteTicks:null,ticksCount:null,ticksStep:null},minorTicks:0,tickLength:null,tickColor:"silver",minorTickColor:"#eee",backgroundColor:"none",needsEndSpacing:null,showLegend:!0,legend:{reverseOrder:!1},opacity:1}};return r},o.util={},o.DATAEXTENT="dataExtent",o.AREA="AreaChart",o.LINE="LinePlot",o.DOT="DotPlot",o.BAR="BarChart",o.util._override=function(t,e){for(var r in t)r in e&&(e[r]=t[r])},o.util._extend=function(t,e){for(var r in t)e[r]=t[r]},o.util._rndSnd=function(){return 2*Math.random()-1+(2*Math.random()-1)+(2*Math.random()-1)},o.util.dataFromEquation2=function(t,e){var r=e||6,n=i.range(0,360+r,r).map(function(e,r){var n=e*Math.PI/180,i=t(n);return[e,i]});return n},o.util.dataFromEquation=function(t,e,r){var n=e||6,o=[],a=[];i.range(0,360+n,n).forEach(function(e,r){var n=e*Math.PI/180,i=t(n);o.push(e),a.push(i)});var s={t:o,r:a};return r&&(s.name=r),s},o.util.ensureArray=function(t,e){if("undefined"==typeof t)return null;var r=[].concat(t);return i.range(e).map(function(t,e){return r[e]||r[0]})},o.util.fillArrays=function(t,e,r){return e.forEach(function(e,n){t[e]=o.util.ensureArray(t[e],r)}),t},o.util.cloneJson=function(t){return JSON.parse(JSON.stringify(t))},o.util.validateKeys=function(t,e){"string"==typeof e&&(e=e.split("."));var r=e.shift();return t[r]&&(!e.length||objHasKeys(t[r],e))},o.util.sumArrays=function(t,e){return i.zip(t,e).map(function(t,e){return i.sum(t)})},o.util.arrayLast=function(t){return t[t.length-1]},o.util.arrayEqual=function(t,e){for(var r=Math.max(t.length,e.length,1);r-- >=0&&t[r]===e[r];);return-2===r},o.util.flattenArray=function(t){for(var e=[];!o.util.arrayEqual(e,t);)e=t,t=[].concat.apply([],t);return t},o.util.deduplicate=function(t){return t.filter(function(t,e,r){return r.indexOf(t)==e})},o.util.convertToCartesian=function(t,e){var r=e*Math.PI/180,n=t*Math.cos(r),i=t*Math.sin(r);return[n,i]},o.util.round=function(t,e){var r=e||2,n=Math.pow(10,r);return Math.round(t*n)/n},o.util.getMousePos=function(t){var e=i.mouse(t.node()),r=e[0],n=e[1],o={};return o.x=r,o.y=n,o.pos=e,o.angle=180*(Math.atan2(n,r)+Math.PI)/Math.PI,o.radius=Math.sqrt(r*r+n*n),o},o.util.duplicatesCount=function(t){for(var e,r={},n={},i=0,o=t.length;o>i;i++)e=t[i],e in r?(r[e]++,n[e]=r[e]):r[e]=1;return n},o.util.duplicates=function(t){return Object.keys(o.util.duplicatesCount(t))},o.util.translator=function(t,e,r,n){if(n){var i=r.slice();r=e,e=i}var o=e.reduce(function(t,e){return"undefined"!=typeof t?t[e]:void 0},t);"undefined"!=typeof o&&(e.reduce(function(t,r,n){return"undefined"!=typeof t?(n===e.length-1&&delete t[r],t[r]):void 0},t),r.reduce(function(t,e,n){return"undefined"==typeof t[e]&&(t[e]={}),n===r.length-1&&(t[e]=o),t[e]},t))},o.PolyChart=function(){function t(){var t=r[0].geometryConfig,e=t.container;"string"==typeof e&&(e=i.select(e)),e.datum(r).each(function(e,r){function n(e,r){var n=t.radialScale(e[1]),i=(t.angularScale(e[0])+t.orientation)*Math.PI/180;return{r:n,t:i}}function o(t){var e=t.r*Math.cos(t.t),r=t.r*Math.sin(t.t);return{x:e,y:r}}var a=!!e[0].data.yStack,l=e.map(function(t,e){return a?i.zip(t.data.t[0],t.data.r[0],t.data.yStack[0]):i.zip(t.data.t[0],t.data.r[0])}),u=t.angularScale,c=t.radialScale.domain()[0],h={};h.bar=function(r,n,o){var a=e[o].data,s=t.radialScale(r[1])-t.radialScale(0),l=t.radialScale(r[2]||0),c=a.barWidth;i.select(this).attr({"class":"mark bar",d:"M"+[[s+l,-c/2],[s+l,c/2],[l,c/2],[l,-c/2]].join("L")+"Z",transform:function(e,r){return"rotate("+(t.orientation+u(e[0]))+")"}})},h.dot=function(t,r,a){var s=t[2]?[t[0],t[1]+t[2]]:t,l=i.svg.symbol().size(e[a].data.dotSize).type(e[a].data.dotType)(t,r);i.select(this).attr({"class":"mark dot",d:l,transform:function(t,e){var r=o(n(s));return"translate("+[r.x,r.y]+")"}})};var f=i.svg.line.radial().interpolate(e[0].data.lineInterpolation).radius(function(e){return t.radialScale(e[1])}).angle(function(e){return t.angularScale(e[0])*Math.PI/180});h.line=function(r,n,o){var a=r[2]?l[o].map(function(t,e){return[t[0],t[1]+t[2]]}):l[o];if(i.select(this).each(h.dot).style({opacity:function(t,r){return+e[o].data.dotVisible},fill:m.stroke(r,n,o)}).attr({"class":"mark dot"}),!(n>0)){var s=i.select(this.parentNode).selectAll("path.line").data([0]);s.enter().insert("path"),s.attr({"class":"line",d:f(a),transform:function(e,r){return"rotate("+(t.orientation+90)+")"},"pointer-events":"none"}).style({fill:function(t,e){return m.fill(r,n,o)},"fill-opacity":0,stroke:function(t,e){return m.stroke(r,n,o)},"stroke-width":function(t,e){return m["stroke-width"](r,n,o)},"stroke-dasharray":function(t,e){return m["stroke-dasharray"](r,n,o)},opacity:function(t,e){return m.opacity(r,n,o)},display:function(t,e){return m.display(r,n,o)}})}};var d=t.angularScale.range(),p=Math.abs(d[1]-d[0])/l[0].length*Math.PI/180,v=i.svg.arc().startAngle(function(t){return-p/2}).endAngle(function(t){return p/2}).innerRadius(function(e){return t.radialScale(c+(e[2]||0))}).outerRadius(function(e){return t.radialScale(c+(e[2]||0))+t.radialScale(e[1])});h.arc=function(e,r,n){i.select(this).attr({"class":"mark arc",d:v,transform:function(e,r){return"rotate("+(t.orientation+u(e[0])+90)+")"}})};var m={fill:function(t,r,n){return e[n].data.color},stroke:function(t,r,n){return e[n].data.strokeColor},"stroke-width":function(t,r,n){return e[n].data.strokeSize+"px"},"stroke-dasharray":function(t,r,n){return s[e[n].data.strokeDash]},opacity:function(t,r,n){return e[n].data.opacity},display:function(t,r,n){return"undefined"==typeof e[n].data.visible||e[n].data.visible?"block":"none"}},g=i.select(this).selectAll("g.layer").data(l);g.enter().append("g").attr({"class":"layer"});var y=g.selectAll("path.mark").data(function(t,e){return t});y.enter().append("path").attr({"class":"mark"}),y.style(m).each(h[t.geometryType]),y.exit().remove(),g.exit().remove()})}var e,r=[o.PolyChart.defaultConfig()],n=i.dispatch("hover"),s={solid:"none",dash:[5,2],dot:[2,5]};return t.config=function(t){return arguments.length?(t.forEach(function(t,e){r[e]||(r[e]={}),a(r[e],o.PolyChart.defaultConfig()),a(r[e],t)}),this):r},t.getColorScale=function(){return e},i.rebind(t,n,"on"),t},o.PolyChart.defaultConfig=function(){var t={data:{name:"geom1",t:[[1,2,3,4]],r:[[1,2,3,4]],dotType:"circle",dotSize:64,dotVisible:!1,barWidth:20,color:"#ffa500",strokeSize:1,strokeColor:"silver",strokeDash:"solid",opacity:1,index:0,visible:!0,visibleInLegend:!0},geometryConfig:{geometry:"LinePlot",geometryType:"arc",direction:"clockwise",orientation:0,container:"body",radialScale:null,angularScale:null,colorScale:i.scale.category20()}};return t},o.BarChart=function(){return o.PolyChart()},o.BarChart.defaultConfig=function(){var t={geometryConfig:{geometryType:"bar"}};return t},o.AreaChart=function(){return o.PolyChart()},o.AreaChart.defaultConfig=function(){var t={geometryConfig:{geometryType:"arc"}};return t},o.DotPlot=function(){return o.PolyChart()},o.DotPlot.defaultConfig=function(){var t={geometryConfig:{geometryType:"dot",dotType:"circle"}};return t},o.LinePlot=function(){return o.PolyChart()},o.LinePlot.defaultConfig=function(){var t={geometryConfig:{geometryType:"line"}};return t},o.Legend=function(){function t(){var r=e.legendConfig,n=e.data.map(function(t,e){return[].concat(t).map(function(t,n){var i=a({},r.elements[e]);return i.name=t,i.color=[].concat(r.elements[e].color)[n],i})}),o=i.merge(n);o=o.filter(function(t,e){return r.elements[e]&&(r.elements[e].visibleInLegend||"undefined"==typeof r.elements[e].visibleInLegend)}),r.reverseOrder&&(o=o.reverse());var s=r.container;("string"==typeof s||s.nodeName)&&(s=i.select(s));var l=o.map(function(t,e){return t.color}),u=r.fontSize,c=null==r.isContinuous?"number"==typeof o[0]:r.isContinuous,h=c?r.height:u*o.length,f=s.classed("legend-group",!0),d=f.selectAll("svg").data([0]),p=d.enter().append("svg").attr({width:300,height:h+u,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",version:"1.1"});p.append("g").classed("legend-axis",!0),p.append("g").classed("legend-marks",!0);var v=i.range(o.length),m=i.scale[c?"linear":"ordinal"]().domain(v).range(l),g=i.scale[c?"linear":"ordinal"]().domain(v)[c?"range":"rangePoints"]([0,h]),y=function(t,e){var r=3*e;return"line"===t?"M"+[[-e/2,-e/12],[e/2,-e/12],[e/2,e/12],[-e/2,e/12]]+"Z":-1!=i.svg.symbolTypes.indexOf(t)?i.svg.symbol().type(t).size(r)():i.svg.symbol().type("square").size(r)()};if(c){var b=d.select(".legend-marks").append("defs").append("linearGradient").attr({id:"grad1",x1:"0%",y1:"0%",x2:"0%",y2:"100%"}).selectAll("stop").data(l);b.enter().append("stop"),b.attr({offset:function(t,e){return e/(l.length-1)*100+"%"}}).style({"stop-color":function(t,e){return t}}),d.append("rect").classed("legend-mark",!0).attr({height:r.height,width:r.colorBandWidth,fill:"url(#grad1)"})}else{var x=d.select(".legend-marks").selectAll("path.legend-mark").data(o);x.enter().append("path").classed("legend-mark",!0),x.attr({transform:function(t,e){return"translate("+[u/2,g(e)+u/2]+")"},d:function(t,e){var r=t.symbol;return y(r,u)},fill:function(t,e){return m(e)}}),x.exit().remove()}var _=i.svg.axis().scale(g).orient("right"),w=d.select("g.legend-axis").attr({transform:"translate("+[c?r.colorBandWidth:u,u/2]+")"}).call(_);return w.selectAll(".domain").style({fill:"none",stroke:"none"}),w.selectAll("line").style({fill:"none",stroke:c?r.textColor:"none"}),w.selectAll("text").style({fill:r.textColor,"font-size":r.fontSize}).text(function(t,e){return o[e].name}),t}var e=o.Legend.defaultConfig(),r=i.dispatch("hover");return t.config=function(t){return arguments.length?(a(e,t),this):e},i.rebind(t,r,"on"),t},o.Legend.defaultConfig=function(t,e){var r={data:["a","b","c"],legendConfig:{elements:[{symbol:"line",color:"red"},{symbol:"square",color:"yellow"},{symbol:"diamond",color:"limegreen"}],height:150,colorBandWidth:30,fontSize:12,container:"body",isContinuous:null,textColor:"grey",reverseOrder:!1}};return r},o.tooltipPanel=function(){var t,e,r,n={container:null,hasTick:!1,fontSize:12,color:"white",padding:5},s="tooltip-"+o.tooltipPanel.uid++,l=10,u=function(){t=n.container.selectAll("g."+s).data([0]);var i=t.enter().append("g").classed(s,!0).style({"pointer-events":"none",display:"none"});return r=i.append("path").style({fill:"white","fill-opacity":.9}).attr({d:"M0 0"}),e=i.append("text").attr({dx:n.padding+l,dy:.3*+n.fontSize}),u};return u.text=function(o){var a=i.hsl(n.color).l,s=a>=.5?"#aaa":"white",c=a>=.5?"black":"white",h=o||"";e.style({fill:c,"font-size":n.fontSize+"px"}).text(h);var f=n.padding,d=e.node().getBBox(),p={fill:n.color,stroke:s,"stroke-width":"2px"},v=d.width+2*f+l,m=d.height+2*f;return r.attr({d:"M"+[[l,-m/2],[l,-m/4],[n.hasTick?0:l,0],[l,m/4],[l,m/2],[v,m/2],[v,-m/2]].join("L")+"Z"}).style(p),t.attr({transform:"translate("+[l,-m/2+2*f]+")"}),t.style({display:"block"}),u},u.move=function(e){return t?(t.attr({transform:"translate("+[e[0],e[1]]+")"}).style({display:"block"}),u):void 0},u.hide=function(){return t?(t.style({display:"none"}),u):void 0},u.show=function(){return t?(t.style({display:"block"}),u):void 0},u.config=function(t){return a(n,t),u},u},o.tooltipPanel.uid=1,o.adapter={},o.adapter.plotly=function(){var t={};return t.convert=function(t,e){var r={};if(t.data&&(r.data=t.data.map(function(t,r){var n=a({},t),i=[[n,["marker","color"],["color"]],[n,["marker","opacity"],["opacity"]],[n,["marker","line","color"],["strokeColor"]],[n,["marker","line","dash"],["strokeDash"]],[n,["marker","line","width"],["strokeSize"]],[n,["marker","symbol"],["dotType"]],[n,["marker","size"],["dotSize"]],[n,["marker","barWidth"],["barWidth"]],[n,["line","interpolation"],["lineInterpolation"]],[n,["showlegend"],["visibleInLegend"]]];return i.forEach(function(t,r){o.util.translator.apply(null,t.concat(e))}),e||delete n.marker,e&&delete n.groupId,e?("LinePlot"===n.geometry?(n.type="scatter",n.dotVisible===!0?(delete n.dotVisible,n.mode="lines+markers"):n.mode="lines"):"DotPlot"===n.geometry?(n.type="scatter",n.mode="markers"):"AreaChart"===n.geometry?n.type="area":"BarChart"===n.geometry&&(n.type="bar"),delete n.geometry):("scatter"===n.type?"lines"===n.mode?n.geometry="LinePlot":"markers"===n.mode?n.geometry="DotPlot":"lines+markers"===n.mode&&(n.geometry="LinePlot",n.dotVisible=!0):"area"===n.type?n.geometry="AreaChart":"bar"===n.type&&(n.geometry="BarChart"),delete n.mode,delete n.type),n}),!e&&t.layout&&"stack"===t.layout.barmode)){var n=o.util.duplicates(r.data.map(function(t,e){return t.geometry}));r.data.forEach(function(t,e){var i=n.indexOf(t.geometry);-1!=i&&(r.data[e].groupId=i)})}if(t.layout){var s=a({},t.layout),l=[[s,["plot_bgcolor"],["backgroundColor"]],[s,["showlegend"],["showLegend"]],[s,["radialaxis"],["radialAxis"]],[s,["angularaxis"],["angularAxis"]],[s.angularaxis,["showline"],["gridLinesVisible"]],[s.angularaxis,["showticklabels"],["labelsVisible"]],[s.angularaxis,["nticks"],["ticksCount"]],[s.angularaxis,["tickorientation"],["tickOrientation"]],[s.angularaxis,["ticksuffix"],["ticksSuffix"]],[s.angularaxis,["range"],["domain"]],[s.angularaxis,["endpadding"],["endPadding"]],[s.radialaxis,["showline"],["gridLinesVisible"]],[s.radialaxis,["tickorientation"],["tickOrientation"]],[s.radialaxis,["ticksuffix"],["ticksSuffix"]],[s.radialaxis,["range"],["domain"]],[s.angularAxis,["showline"],["gridLinesVisible"]],[s.angularAxis,["showticklabels"],["labelsVisible"]],[s.angularAxis,["nticks"],["ticksCount"]],[s.angularAxis,["tickorientation"],["tickOrientation"]],[s.angularAxis,["ticksuffix"],["ticksSuffix"]],[s.angularAxis,["range"],["domain"]],[s.angularAxis,["endpadding"],["endPadding"]],[s.radialAxis,["showline"],["gridLinesVisible"]],[s.radialAxis,["tickorientation"],["tickOrientation"]],[s.radialAxis,["ticksuffix"],["ticksSuffix"]],[s.radialAxis,["range"],["domain"]],[s.font,["outlinecolor"],["outlineColor"]],[s.legend,["traceorder"],["reverseOrder"]],[s,["labeloffset"],["labelOffset"]],[s,["defaultcolorrange"],["defaultColorRange"]]];if(l.forEach(function(t,r){o.util.translator.apply(null,t.concat(e))}),e?("undefined"!=typeof s.tickLength&&(s.angularaxis.ticklen=s.tickLength,delete s.tickLength),s.tickColor&&(s.angularaxis.tickcolor=s.tickColor,delete s.tickColor)):(s.angularAxis&&"undefined"!=typeof s.angularAxis.ticklen&&(s.tickLength=s.angularAxis.ticklen),s.angularAxis&&"undefined"!=typeof s.angularAxis.tickcolor&&(s.tickColor=s.angularAxis.tickcolor)),s.legend&&"boolean"!=typeof s.legend.reverseOrder&&(s.legend.reverseOrder="normal"!=s.legend.reverseOrder),s.legend&&"boolean"==typeof s.legend.traceorder&&(s.legend.traceorder=s.legend.traceorder?"reversed":"normal",delete s.legend.reverseOrder),s.margin&&"undefined"!=typeof s.margin.t){var u=["t","r","b","l","pad"],c=["top","right","bottom","left","pad"],h={};i.entries(s.margin).forEach(function(t,e){h[c[u.indexOf(t.key)]]=t.value}),s.margin=h}e&&(delete s.needsEndSpacing,delete s.minorTickColor,delete s.minorTicks,delete s.angularaxis.ticksCount,delete s.angularaxis.ticksCount,delete s.angularaxis.ticksStep,delete s.angularaxis.rewriteTicks,delete s.angularaxis.nticks,delete s.radialaxis.ticksCount,delete s.radialaxis.ticksCount,delete s.radialaxis.ticksStep,delete s.radialaxis.rewriteTicks,delete s.radialaxis.nticks),r.layout=s}return r},t}},{"../../plotly":589,"./micropolar_manager":652,d3:119}],652:[function(t,e,r){"use strict";var n=t("../../plotly"),i=t("d3"),o=t("./undo_manager"),a=e.exports={},s=n.Lib.extendDeepAll;a.framework=function(t){function e(e,o){return o&&(h=o),i.select(i.select(h).node().parentNode).selectAll(".svg-container>*:not(.chart-root)").remove(),r=r?s(r,e):e,u||(u=n.micropolar.Axis()),c=n.micropolar.adapter.plotly().convert(r),u.config(c).render(h),t.data=r.data,t.layout=r.layout,a.fillLayout(t),r}var r,l,u,c,h,f=new o;return e.isPolar=!0,e.svg=function(){return u.svg()},e.getConfig=function(){return r},e.getLiveConfig=function(){return n.micropolar.adapter.plotly().convert(u.getLiveConfig(),!0)},e.getLiveScales=function(){return{t:u.angularScale(),r:u.radialScale()}},e.setUndoPoint=function(){var t=this,e=n.micropolar.util.cloneJson(r);!function(e,r){f.add({undo:function(){r&&t(r)},redo:function(){t(e)}})}(e,l),l=n.micropolar.util.cloneJson(e)},e.undo=function(){f.undo()},e.redo=function(){f.redo()},e},a.fillLayout=function(t){var e=i.select(t).selectAll(".plot-container"),r=e.selectAll(".svg-container"),o=t.framework&&t.framework.svg&&t.framework.svg(),a={width:800,height:600,paper_bgcolor:n.Color.background,_container:e,_paperdiv:r,_paper:o};t._fullLayout=s(a,t.layout)}},{"../../plotly":589,"./undo_manager":653,d3:119}],653:[function(t,e,r){"use strict";e.exports=function(){function t(t,e){return t?(i=!0,t[e](),i=!1,this):this}var e,r=[],n=-1,i=!1;return{add:function(t){return i?this:(r.splice(n+1,r.length-n),r.push(t),n=r.length-1,this)},setCallback:function(t){e=t},undo:function(){var i=r[n];return i?(t(i,"undo"),n-=1,e&&e(i.undo),this):this},redo:function(){var i=r[n+1];return i?(t(i,"redo"),n+=1,e&&e(i.redo),this):this},clear:function(){r=[],n=-1},hasUndo:function(){return-1!==n},hasRedo:function(){return n<r.length-1},getCommands:function(){return r},getPreviousCommand:function(){return r[n-1]},getIndex:function(){return n}}}},{}],654:[function(t,e,r){"use strict";var n=t("../lib"),i=t("./plots");e.exports=function(t,e,r,o){function a(t,e){return n.coerce(s,l,c,t,e)}for(var s,l,u=o.type,c=o.attributes,h=o.handleDefaults,f=o.partition||"x",d=i.findSubplotIds(r,u),p=d.length,v=0;p>v;v++){var m=d[v];s=t[m]?t[m]:t[m]={},e[m]=l={},a("domain."+f,[v/p,(v+1)/p]),a("domain."+{x:"y",y:"x"}[f]),o.id=m,h(s,l,a,o)}}},{"../lib":568,"./plots":648}],655:[function(t,e,r){"use strict";var n=t("./ternary"),i=t("../../plots/plots");r.name="ternary",r.attr="subplot",r.idRoot="ternary",r.idRegex=/^ternary([2-9]|[1-9][0-9]+)?$/,r.attrRegex=/^ternary([2-9]|[1-9][0-9]+)?$/,r.attributes=t("./layout/attributes"),r.layoutAttributes=t("./layout/layout_attributes"),r.supplyLayoutDefaults=t("./layout/defaults"),r.plot=function(t){for(var e=t._fullLayout,r=t._fullData,o=i.getSubplotIds(e,"ternary"),a=0;a<o.length;a++){var s=o[a],l=i.getSubplotData(r,"ternary",s),u=e[s]._subplot;void 0===u&&(u=new n({id:s,graphDiv:t,container:e._ternarylayer.node()},e),e[s]._subplot=u),u.plot(l,e,t._promises)}},r.clean=function(t,e,r,n){for(var o=i.getSubplotIds(n,"ternary"),a=0;a<o.length;a++){var s=o[a],l=n[s]._subplot;!e[s]&&l&&(l.plotContainer.remove(),l.clipDef.remove())}}},{"../../plots/plots":648,"./layout/attributes":656,"./layout/defaults":659,"./layout/layout_attributes":660,"./ternary":661}],656:[function(t,e,r){"use strict";e.exports={subplot:{valType:"subplotid",dflt:"ternary"}}},{}],657:[function(t,e,r){"use strict";var n=t("../../cartesian/layout_attributes"),i=t("../../../lib/extend").extendFlat;e.exports={title:n.title,titlefont:n.titlefont,color:n.color,tickmode:n.tickmode,nticks:i({},n.nticks,{dflt:6,min:1}),tick0:n.tick0,dtick:n.dtick,tickvals:n.tickvals,ticktext:n.ticktext,ticks:n.ticks,ticklen:n.ticklen,tickwidth:n.tickwidth,tickcolor:n.tickcolor,showticklabels:n.showticklabels,showtickprefix:n.showtickprefix,tickprefix:n.tickprefix,showticksuffix:n.showticksuffix,ticksuffix:n.ticksuffix,showexponent:n.showexponent,exponentformat:n.exponentformat,tickfont:n.tickfont,tickangle:n.tickangle,tickformat:n.tickformat,hoverformat:n.hoverformat,showline:i({},n.showline,{dflt:!0}),linecolor:n.linecolor,linewidth:n.linewidth,showgrid:i({},n.showgrid,{dflt:!0}),gridcolor:n.gridcolor,gridwidth:n.gridwidth,min:{valType:"number",dflt:0,min:0}}},{"../../../lib/extend":563,"../../cartesian/layout_attributes":601}],658:[function(t,e,r){"use strict";var n=t("tinycolor2").mix,i=t("../../../lib"),o=t("./axis_attributes"),a=t("../../cartesian/tick_label_defaults"),s=t("../../cartesian/tick_mark_defaults"),l=t("../../cartesian/tick_value_defaults");e.exports=function(t,e,r){function u(r,n){return i.coerce(t,e,o,r,n)}e.type="linear";var c=u("color"),h=c===t.color?c:r.font.color,f=e._name,d=f.charAt(0).toUpperCase(),p="Component "+d,v=u("title",p);e._hovertitle=v===p?v:d,i.coerceFont(u,"titlefont",{family:r.font.family,size:Math.round(1.2*r.font.size),color:h}),u("min"),l(t,e,u,"linear"),a(t,e,u,"linear",{noHover:!1}),s(t,e,u,{outerTicks:!0});var m=u("showticklabels");m&&(i.coerceFont(u,"tickfont",{family:r.font.family,size:r.font.size,color:h}),u("tickangle"),u("tickformat")),u("hoverformat");var g=u("showline");g&&(u("linecolor",c),u("linewidth"));var y=u("showgrid");y&&(u("gridcolor",n(c,r.bgColor,60).toRgbString()),u("gridwidth"))}},{"../../../lib":568,"../../cartesian/tick_label_defaults":607,"../../cartesian/tick_mark_defaults":608,"../../cartesian/tick_value_defaults":609,"./axis_attributes":657,tinycolor2:454}],659:[function(t,e,r){"use strict";function n(t,e,r,n){var o=r("bgcolor"),a=r("sum");n.bgColor=i.combine(o,n.paper_bgcolor);for(var u,c,h,f=0;f<l.length;f++)u=l[f],c=t[u]||{},h=e[u]={_name:u},s(c,h,n);var d=e.aaxis,p=e.baxis,v=e.caxis;d.min+p.min+v.min>=a&&(d.min=0,p.min=0,v.min=0,t.aaxis&&delete t.aaxis.min,t.baxis&&delete t.baxis.min,t.caxis&&delete t.caxis.min)}var i=t("../../../components/color"),o=t("../../subplot_defaults"),a=t("./layout_attributes"),s=t("./axis_defaults"),l=["aaxis","baxis","caxis"];e.exports=function(t,e,r){o(t,e,r,{type:"ternary",attributes:a,handleDefaults:n,font:e.font,paper_bgcolor:e.paper_bgcolor})}},{"../../../components/color":483,"../../subplot_defaults":654,"./axis_defaults":658,"./layout_attributes":660}],660:[function(t,e,r){"use strict";var n=t("../../../components/color/attributes"),i=t("./axis_attributes");e.exports={domain:{x:{valType:"info_array",items:[{valType:"number",min:0,max:1},{valType:"number",min:0,max:1}],dflt:[0,1]},y:{valType:"info_array",items:[{valType:"number",min:0,max:1},{valType:"number",min:0,max:1}],dflt:[0,1]}},bgcolor:{valType:"color",dflt:n.background},sum:{valType:"number",dflt:1,min:0},aaxis:i,baxis:i,caxis:i}},{"../../../components/color/attributes":482,"./axis_attributes":657}],661:[function(t,e,r){"use strict";function n(t,e){this.id=t.id,this.graphDiv=t.graphDiv,this.init(e),this.makeFramework()}function i(t){o.select(t).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}var o=t("d3"),a=t("tinycolor2"),s=t("../../plotly"),l=t("../../lib"),u=t("../../components/color"),c=t("../../components/drawing"),h=t("../cartesian/set_convert"),f=t("../../lib/extend").extendFlat,d=t("../cartesian/axes"),p=t("../../lib/filter_visible"),v=t("../../components/dragelement"),m=t("../../components/titles"),g=t("../cartesian/select"),y=t("../cartesian/constants"),b=t("../cartesian/graph_interact");e.exports=n;var x=n.prototype;x.init=function(t){this.container=t._ternarylayer,this.defs=t._defs,this.layoutId=t._uid,this.traceHash={}},x.plot=function(t,e){var r,n=this,i=e[n.id],o=e._size;l.getPlotDiv(n.plotContainer.node())!==n.graphDiv&&(n.init(n.graphDiv._fullLayout),n.makeFramework()),n.adjustLayout(i,o);var a=n.traceHash,s={};for(r=0;r<t.length;r++){var c=t[r];s[c.type]=s[c.type]||[],s[c.type].push(c)}var h=Object.keys(a),f=Object.keys(s);for(r=0;r<h.length;r++){var d=h[r];if(-1===f.indexOf(d)){var v=a[d][0];v.visible=!1,s[d]=[v]}}for(f=Object.keys(s),r=0;r<f.length;r++){var m=s[f[r]],g=m[0]._module;g.plot(n,p(m),i)}n.traceHash=s,n.layers.plotbg.select("path").call(u.fill,i.bgcolor)},x.makeFramework=function(){var t=this,e=t.defs.selectAll("g.clips").data([0]);e.enter().append("g").classed("clips",!0);var r="clip"+t.layoutId+t.id;t.clipDef=e.selectAll("#"+r).data([0]),t.clipDef.enter().append("clipPath").attr("id",r).append("path").attr("d","M0,0Z"),t.plotContainer=t.container.selectAll("g."+t.id).data([0]),t.plotContainer.enter().append("g").classed(t.id,!0),t.layers={};var n=["draglayer","plotbg","backplot","grids","frontplot","zoom","aaxis","baxis","caxis","axlines"],i=t.plotContainer.selectAll("g.toplevel").data(n);i.enter().append("g").attr("class",function(t){return"toplevel "+t}).each(function(e){var r=o.select(this);t.layers[e]=r,"frontplot"===e?r.append("g").classed("scatterlayer",!0):"backplot"===e?r.append("g").classed("maplayer",!0):"plotbg"===e?r.append("path").attr("d","M0,0Z"):"axlines"===e&&r.selectAll("path").data(["aline","bline","cline"]).enter().append("path").each(function(t){o.select(this).classed(t,!0)})});var a=t.plotContainer.select(".grids").selectAll("g.grid").data(["agrid","bgrid","cgrid"]);a.enter().append("g").attr("class",function(t){return"grid "+t}).each(function(e){t.layers[e]=o.select(this)}),t.plotContainer.selectAll(".backplot,.frontplot,.grids").call(c.setClipUrl,r),t.graphDiv._context.staticPlot||t.initInteractions()};var _=Math.sqrt(4/3);x.adjustLayout=function(t,e){var r,n,i,o,a,s,l=this,c=t.domain,d=(c.x[0]+c.x[1])/2,p=(c.y[0]+c.y[1])/2,v=c.x[1]-c.x[0],m=c.y[1]-c.y[0],g=v*e.w,y=m*e.h,b=t.sum,x=t.aaxis.min,w=t.baxis.min,M=t.caxis.min;
g>_*y?(o=y,i=o*_):(i=g,o=i/_),a=v*i/g,s=m*o/y,r=e.l+e.w*d-i/2,n=e.t+e.h*(1-p)-o/2,l.x0=r,l.y0=n,l.w=i,l.h=o,l.sum=b,l.xaxis={type:"linear",range:[x+2*M-b,b-x-2*w],domain:[d-a/2,d+a/2],_id:"x",_gd:l.graphDiv},h(l.xaxis),l.xaxis.setScale(),l.yaxis={type:"linear",range:[x,b-w-M],domain:[p-s/2,p+s/2],_id:"y",_gd:l.graphDiv},h(l.yaxis),l.yaxis.setScale();var k=l.yaxis.domain[0],A=l.aaxis=f({},t.aaxis,{range:[x,b-w-M],side:"left",_counterangle:30,tickangle:(+t.aaxis.tickangle||0)-30,domain:[k,k+s*_],_axislayer:l.layers.aaxis,_gridlayer:l.layers.agrid,_pos:0,_gd:l.graphDiv,_id:"y",_length:i,_gridpath:"M0,0l"+o+",-"+i/2});h(A);var T=l.baxis=f({},t.baxis,{range:[b-x-M,w],side:"bottom",_counterangle:30,domain:l.xaxis.domain,_axislayer:l.layers.baxis,_gridlayer:l.layers.bgrid,_counteraxis:l.aaxis,_pos:0,_gd:l.graphDiv,_id:"x",_length:i,_gridpath:"M0,0l-"+i/2+",-"+o});h(T),A._counteraxis=T;var E=l.caxis=f({},t.caxis,{range:[b-x-w,M],side:"right",_counterangle:30,tickangle:(+t.caxis.tickangle||0)+30,domain:[k,k+s*_],_axislayer:l.layers.caxis,_gridlayer:l.layers.cgrid,_counteraxis:l.baxis,_pos:0,_gd:l.graphDiv,_id:"y",_length:i,_gridpath:"M0,0l-"+o+","+i/2});h(E);var S="M"+r+","+(n+o)+"h"+i+"l-"+i/2+",-"+o+"Z";l.clipDef.select("path").attr("d",S),l.layers.plotbg.select("path").attr("d",S);var L="translate("+r+","+n+")";l.plotContainer.selectAll(".scatterlayer,.maplayer,.zoom").attr("transform",L);var z="translate("+r+","+(n+o)+")";l.layers.baxis.attr("transform",z),l.layers.bgrid.attr("transform",z);var I="translate("+(r+i/2)+","+n+")rotate(30)";l.layers.aaxis.attr("transform",I),l.layers.agrid.attr("transform",I);var P="translate("+(r+i/2)+","+n+")rotate(-30)";l.layers.caxis.attr("transform",P),l.layers.cgrid.attr("transform",P),l.drawAxes(!0),l.plotContainer.selectAll(".crisp").classed("crisp",!1);var C=l.layers.axlines;C.select(".aline").attr("d",A.showline?"M"+r+","+(n+o)+"l"+i/2+",-"+o:"M0,0").call(u.stroke,A.linecolor||"#000").style("stroke-width",(A.linewidth||0)+"px"),C.select(".bline").attr("d",T.showline?"M"+r+","+(n+o)+"h"+i:"M0,0").call(u.stroke,T.linecolor||"#000").style("stroke-width",(T.linewidth||0)+"px"),C.select(".cline").attr("d",E.showline?"M"+(r+i/2)+","+n+"l"+i/2+","+o:"M0,0").call(u.stroke,E.linecolor||"#000").style("stroke-width",(E.linewidth||0)+"px")},x.drawAxes=function(t){var e=this,r=e.graphDiv,n=e.id.substr(7)+"title",i=e.aaxis,o=e.baxis,a=e.caxis;if(d.doTicks(r,i,!0),d.doTicks(r,o,!0),d.doTicks(r,a,!0),t){var s=Math.max(i.showticklabels?i.tickfont.size/2:0,(a.showticklabels?.75*a.tickfont.size:0)+("outside"===a.ticks?.87*a.ticklen:0));m.draw(r,"a"+n,{propContainer:i,propName:e.id+".aaxis.title",dfltName:"Component A",attributes:{x:e.x0+e.w/2,y:e.y0-i.titlefont.size/3-s,"text-anchor":"middle"}});var l=(o.showticklabels?o.tickfont.size:0)+("outside"===o.ticks?o.ticklen:0)+3;m.draw(r,"b"+n,{propContainer:o,propName:e.id+".baxis.title",dfltName:"Component B",attributes:{x:e.x0-l,y:e.y0+e.h+.83*o.titlefont.size+l,"text-anchor":"middle"}}),m.draw(r,"c"+n,{propContainer:a,propName:e.id+".caxis.title",dfltName:"Component C",attributes:{x:e.x0+e.w+l,y:e.y0+e.h+.83*a.titlefont.size+l,"text-anchor":"middle"}})}};var w=y.MINZOOM/2+.87,M="m-0.87,.5h"+w+"v3h-"+(w+5.2)+"l"+(w/2+2.6)+",-"+(.87*w+4.5)+"l2.6,1.5l-"+w/2+","+.87*w+"Z",k="m0.87,.5h-"+w+"v3h"+(w+5.2)+"l-"+(w/2+2.6)+",-"+(.87*w+4.5)+"l-2.6,1.5l"+w/2+","+.87*w+"Z",A="m0,1l"+w/2+","+.87*w+"l2.6,-1.5l-"+(w/2+2.6)+",-"+(.87*w+4.5)+"l-"+(w/2+2.6)+","+(.87*w+4.5)+"l2.6,1.5l"+w/2+",-"+.87*w+"Z",T="m0.5,0.5h5v-2h-5v-5h-2v5h-5v2h5v5h2Z",E=!0;x.initInteractions=function(){function t(t,e,r){var n=F.getBoundingClientRect();x=e-n.left,w=r-n.top,S={a:O.aaxis.range[0],b:O.baxis.range[1],c:O.caxis.range[1]},z=S,L=O.aaxis.range[1]-S.a,I=a(O.graphDiv._fullLayout[O.id].bgcolor).getLuminance(),P="M0,"+O.h+"L"+O.w/2+", 0L"+O.w+","+O.h+"Z",C=!1,R=N.append("path").attr("class","zoombox").style({fill:I>.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("d",P),D=N.append("path").attr("class","zoombox-corners").style({fill:u.background,stroke:u.defaultLine,"stroke-width":1,opacity:0}).attr("d","M0,0Z"),p()}function e(t,e){return 1-e/O.h}function r(t,e){return 1-(t+(O.h-e)/Math.sqrt(3))/O.w}function n(t,e){return(t-(O.h-e)/Math.sqrt(3))/O.w}function o(t,i){var o=x+t,a=w+i,s=Math.max(0,Math.min(1,e(x,w),e(o,a))),l=Math.max(0,Math.min(1,r(x,w),r(o,a))),u=Math.max(0,Math.min(1,n(x,w),n(o,a))),c=(s/2+u)*O.w,h=(1-s/2-l)*O.w,f=(c+h)/2,d=h-c,p=(1-s)*O.h,v=p-d/_;d<y.MINZOOM?(z=S,R.attr("d",P),D.attr("d","M0,0Z")):(z={a:S.a+s*L,b:S.b+l*L,c:S.c+u*L},R.attr("d",P+"M"+c+","+p+"H"+h+"L"+f+","+v+"L"+c+","+p+"Z"),D.attr("d","M"+x+","+w+T+"M"+c+","+p+M+"M"+h+","+p+k+"M"+f+","+v+A)),C||(R.transition().style("fill",I>.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200),D.transition().style("opacity",1).duration(200),C=!0)}function c(t,e){if(z===S)return 2===e&&m(),i(j);i(j);var r={};r[O.id+".aaxis.min"]=z.a,r[O.id+".baxis.min"]=z.b,r[O.id+".caxis.min"]=z.c,s.relayout(j,r),E&&j.data&&j._context.showTips&&(l.notifier("Double-click to<br>zoom back out","long"),E=!1)}function h(){S={a:O.aaxis.range[0],b:O.baxis.range[1],c:O.caxis.range[1]},z=S}function f(t,e){var r=t/O.xaxis._m,n=e/O.yaxis._m;z={a:S.a-n,b:S.b+(r+n)/2,c:S.c-(r-n)/2};var i=[z.a,z.b,z.c].sort(),o={a:i.indexOf(z.a),b:i.indexOf(z.b),c:i.indexOf(z.c)};i[0]<0&&(i[1]+i[0]/2<0?(i[2]+=i[0]+i[1],i[0]=i[1]=0):(i[2]+=i[0]/2,i[1]+=i[0]/2,i[0]=0),z={a:i[o.a],b:i[o.b],c:i[o.c]},e=(S.a-z.a)*O.yaxis._m,t=(S.c-z.c-S.b+z.b)*O.xaxis._m);var a="translate("+(O.x0+t)+","+(O.y0+e)+")";O.plotContainer.selectAll(".scatterlayer,.maplayer").attr("transform",a),O.aaxis.range=[z.a,O.sum-z.b-z.c],O.baxis.range=[O.sum-z.a-z.c,z.b],O.caxis.range=[O.sum-z.a-z.b,z.c],O.drawAxes(!1),O.plotContainer.selectAll(".crisp").classed("crisp",!1)}function d(t,e){if(t){var r={};r[O.id+".aaxis.min"]=z.a,r[O.id+".baxis.min"]=z.b,r[O.id+".caxis.min"]=z.c,s.relayout(j,r)}else 2===e&&m()}function p(){O.plotContainer.selectAll(".select-outline").remove()}function m(){var t={};t[O.id+".aaxis.min"]=0,t[O.id+".baxis.min"]=0,t[O.id+".caxis.min"]=0,j.emit("plotly_doubleclick",null),s.relayout(j,t)}var x,w,S,L,z,I,P,C,R,D,O=this,F=O.layers.plotbg.select("path").node(),j=O.graphDiv,N=O.layers.zoom,B={element:F,gd:j,plotinfo:{plot:N},doubleclick:m,subplot:O.id,prepFn:function(e,r,n){B.xaxes=[O.xaxis],B.yaxes=[O.yaxis];var i=j._fullLayout.dragmode;e.shiftKey&&(i="pan"===i?"zoom":"pan"),"lasso"===i?B.minDrag=1:B.minDrag=void 0,"zoom"===i?(B.moveFn=o,B.doneFn=c,t(e,r,n)):"pan"===i?(B.moveFn=f,B.doneFn=d,h(),p()):"select"!==i&&"lasso"!==i||g(e,r,n,B,i)}};F.onmousemove=function(t){b.hover(j,t,O.id),j._fullLayout._lasthover=F,j._fullLayout._hoversubplot=O.id},F.onmouseout=function(t){j._dragging||v.unhover(j,t)},F.onclick=function(t){b.click(j,t)},v.init(B)}},{"../../components/color":483,"../../components/dragelement":504,"../../components/drawing":506,"../../components/titles":546,"../../lib":568,"../../lib/extend":563,"../../lib/filter_visible":564,"../../plotly":589,"../cartesian/axes":592,"../cartesian/constants":597,"../cartesian/graph_interact":599,"../cartesian/select":605,"../cartesian/set_convert":606,d3:119,tinycolor2:454}],662:[function(t,e,r){"use strict";function n(t){var e;switch(t){case"themes__thumb":e={autosize:!0,width:150,height:150,title:"",showlegend:!1,margin:{l:5,r:5,t:5,b:5,pad:0},annotations:[]};break;case"thumbnail":e={title:"",hidesources:!0,showlegend:!1,borderwidth:0,bordercolor:"",margin:{l:1,r:1,t:1,b:1,pad:0},annotations:[]};break;default:e={}}return e}function i(t){var e=["xaxis","yaxis","zaxis"];return e.indexOf(t.slice(0,5))>-1}var o=t("../plotly"),a=o.Lib.extendFlat,s=o.Lib.extendDeep;e.exports=function(t,e){t.framework&&t.framework.isPolar&&(t=t.framework.getConfig());var r,l=t.data,u=t.layout,c=s([],l),h=s({},u,n(e.tileClass));if(e.width&&(h.width=e.width),e.height&&(h.height=e.height),"thumbnail"===e.tileClass||"themes__thumb"===e.tileClass){h.annotations=[];var f=Object.keys(h);for(r=0;r<f.length;r++)i(f[r])&&(h[f[r]].title="");for(r=0;r<c.length;r++){var d=c[r];d.showscale=!1,d.marker&&(d.marker.showscale=!1),"pie"===d.type&&(d.textposition="none")}}if(Array.isArray(e.annotations))for(r=0;r<e.annotations.length;r++)h.annotations.push(e.annotations[r]);var p=o.Plots.getSubplotIds(h,"gl3d");if(p.length){var v={};for("thumbnail"===e.tileClass&&(v={title:"",showaxeslabels:!1,showticklabels:!1,linetickenable:!1}),r=0;r<p.length;r++){var m=p[r];a(h[m].xaxis,v),a(h[m].yaxis,v),a(h[m].zaxis,v),h[m]._scene=null}}var g=document.createElement("div");e.tileClass&&(g.className=e.tileClass);var y={td:g,layout:h,data:c,config:{staticPlot:void 0===e.staticPlot?!0:e.staticPlot,plotGlPixelRatio:void 0===e.plotGlPixelRatio?2:e.plotGlPixelRatio,displaylogo:e.displaylogo||!1,showLink:e.showLink||!1,showTips:e.showTips||!1}};return"transparent"!==e.setBackground&&(y.config.setBackground=e.setBackground||"opaque"),y.td.defaultLayout=n(e.tileClass),y}},{"../plotly":589}],663:[function(t,e,r){"use strict";function n(t,e){return e=e||{},e.format=e.format||"png",new Promise(function(r,n){t._snapshotInProgress&&n(new Error("Snapshotting already in progress.")),o.isIE()&&"svg"!==e.format&&n(new Error("Sorry IE does not support downloading from canvas. Try {format:'svg'} instead.")),t._snapshotInProgress=!0;var s=i(t,e),l=e.filename||t.fn||"newplot";l+="."+e.format,s.then(function(e){return t._snapshotInProgress=!1,a(e,l)}).then(function(t){r(t)}).catch(function(e){t._snapshotInProgress=!1,n(e)})})}var i=t("../plot_api/to_image"),o=t("../lib"),a=t("./filesaver");e.exports=n},{"../lib":568,"../plot_api/to_image":587,"./filesaver":664}],664:[function(t,e,r){"use strict";var n=function(t,e){var r=document.createElement("a"),n="download"in r,i=/Version\/[\d\.]+.*Safari/.test(navigator.userAgent),o=new Promise(function(o,a){"undefined"!=typeof navigator&&/MSIE [1-9]\./.test(navigator.userAgent)&&a(new Error("IE < 10 unsupported")),i&&(document.location.href="data:application/octet-stream"+t.slice(t.search(/[,;]/)),o(e)),e||(e="download"),n&&(r.href=t,r.download=e,document.body.appendChild(r),r.click(),document.body.removeChild(r),o(e)),"undefined"!=typeof navigator&&navigator.msSaveBlob&&(navigator.msSaveBlob(new Blob([t]),e),o(e)),a(new Error("download error"))});return o};e.exports=n},{}],665:[function(t,e,r){"use strict";function n(t){return t._has&&(t._has("gl3d")||t._has("gl2d"))?500:0}function i(t){return t.data&&t.data[0]&&t.data[0].r?void 0:function(){(t.calcdata||[]).forEach(function(t){t[0]&&t[0].t&&t[0].t.cb&&t[0].t.cb()})}}var o={getDelay:n,getRedrawFunc:i,clone:t("./cloneplot"),toSVG:t("./tosvg"),svgToImg:t("./svgtoimg"),toImage:t("./toimage"),downloadImage:t("./download")};e.exports=o},{"./cloneplot":662,"./download":663,"./svgtoimg":666,"./toimage":667,"./tosvg":668}],666:[function(t,e,r){"use strict";function n(t){var e=t.emitter||new o,r=new Promise(function(n,o){var a=window.Image,s=t.svg,l=t.format||"png";if(i.isIE()&&(s=s.replace(/"/gi,"'"),s=s.replace(/(\('#)(.*)('\))/gi,'("$2")'),s=s.replace(/(\\')/gi,'"'),"svg"!==l)){var u=new Error("Sorry IE does not support downloading from canvas. Try {format:'svg'} instead.");return o(u),t.promise?r:e.emit("error",u)}var c=t.canvas,h=c.getContext("2d"),f=new a,d="data:image/svg+xml,"+encodeURIComponent(s);c.height=t.height||150,c.width=t.width||300,f.onload=function(){var r;switch("svg"!==l&&h.drawImage(f,0,0),l){case"jpeg":r=c.toDataURL("image/jpeg");break;case"png":r=c.toDataURL("image/png");break;case"webp":r=c.toDataURL("image/webp");break;case"svg":r=d;break;default:if(o(new Error("Image format is not jpeg, png or svg")),!t.promise)return e.emit("error","Image format is not jpeg, png or svg")}n(r),t.promise||e.emit("success",r)},f.onerror=function(r){return o(r),t.promise?void 0:e.emit("error",r)},f.src=d});return t.promise?r:e}var i=t("../lib"),o=t("events").EventEmitter;e.exports=n},{"../lib":568,events:57}],667:[function(t,e,r){"use strict";function n(t,e){function r(){var t=n.getDelay(u._fullLayout);setTimeout(function(){var t=o.Snapshot.toSVG(u),r=document.createElement("canvas");r.id=a.randstr(),s=o.Snapshot.svgToImg({format:e.format,width:u._fullLayout.width,height:u._fullLayout.height,canvas:r,emitter:s,svg:t}),s.clean=function(){u&&document.body.removeChild(u)}},t)}var n=o.Snapshot,s=new i,l=n.clone(t,{format:"png"}),u=l.td;u.style.position="absolute",u.style.left="-5000px",document.body.appendChild(u);var c=n.getRedrawFunc(u);return o.plot(u,l.data,l.layout,l.config).then(c).then(r).catch(function(t){s.emit("error",t)}),s}var i=t("events").EventEmitter,o=t("../plotly"),a=t("../lib");e.exports=n},{"../lib":568,"../plotly":589,events:57}],668:[function(t,e,r){"use strict";var n=t("d3"),i=t("../lib/svg_text_utils"),o=t("../components/drawing"),a=t("../components/color"),s=t("../constants/xmlns_namespaces");e.exports=function(t,e){var r,l=t._fullLayout,u=l._paper,c=l._toppaper;u.insert("rect",":first-child").call(o.setRect,0,0,l.width,l.height).call(a.fill,l.paper_bgcolor);var h=l._basePlotModules||[];for(r=0;r<h.length;r++){var f=h[r];f.toSVG&&f.toSVG(t)}if(c){var d=c.node().childNodes,p=Array.prototype.slice.call(d);for(r=0;r<p.length;r++){var v=p[r];v.childNodes.length&&u.node().appendChild(v)}}l._draggers&&l._draggers.remove(),u.node().style.background="",u.selectAll("text").attr("data-unformatted",null).each(function(){var t=n.select(this);if("hidden"===t.style("visibility"))return void t.remove();var e=t.style("font-family");e&&-1!==e.indexOf('"')&&t.style("font-family",e.replace(/"/g,"TOBESTRIPPED"))}),"pdf"!==e&&"eps"!==e||u.selectAll("#MathJax_SVG_glyphs path").attr("stroke-width",0),u.node().setAttributeNS(s.xmlns,"xmlns",s.svg),u.node().setAttributeNS(s.xmlns,"xmlns:xlink",s.xlink);var m=(new window.XMLSerializer).serializeToString(u.node());return m=i.html_entity_decode(m),m=i.xml_entity_encode(m),m=m.replace(/("TOBESTRIPPED)|(TOBESTRIPPED")/g,"'")}},{"../components/color":483,"../components/drawing":506,"../constants/xmlns_namespaces":556,"../lib/svg_text_utils":581,d3:119}],669:[function(t,e,r){"use strict";var n=t("../../lib").mergeArray;e.exports=function(t){var e=t[0].trace,r=e.marker,i=r.line;n(e.text,t,"tx"),n(r.opacity,t,"mo"),n(r.color,t,"mc"),n(i.color,t,"mlc"),n(i.width,t,"mlw")}},{"../../lib":568}],670:[function(t,e,r){"use strict";var n=t("../scatter/attributes"),i=t("../../components/colorscale/color_attributes"),o=t("../../lib/extend").extendFlat,a=n.marker,s=a.line,l=o({},s.width,{dflt:0}),u=o({},{width:l},i("marker.line")),c=o({},{showscale:a.showscale,line:u},i("marker"));e.exports={x:n.x,x0:n.x0,dx:n.dx,y:n.y,y0:n.y0,dy:n.dy,text:n.text,orientation:{valType:"enumerated",values:["v","h"]},marker:c,r:n.r,t:n.t,_nestedModules:{error_y:"ErrorBars",error_x:"ErrorBars","marker.colorbar":"Colorbar"},_deprecated:{bardir:{valType:"enumerated",values:["v","h"]}}}},{"../../components/colorscale/color_attributes":491,"../../lib/extend":563,"../scatter/attributes":750}],671:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../plots/cartesian/axes"),o=t("../../components/colorscale/has_colorscale"),a=t("../../components/colorscale/calc");e.exports=function(t,e){var r,s,l,u=i.getFromId(t,e.xaxis||"x"),c=i.getFromId(t,e.yaxis||"y"),h=e.orientation||(e.x&&!e.y?"h":"v");"h"===h?(s=u.makeCalcdata(e,"x"),r=c.makeCalcdata(e,"y")):(s=c.makeCalcdata(e,"y"),r=u.makeCalcdata(e,"x"));var f=Math.min(r.length,s.length),d=[];for(l=0;f>l;l++)n(r[l])&&d.push({p:r[l],s:s[l],b:0});return o(e,"marker")&&a(e,e.marker.color,"marker","c"),o(e,"marker.line")&&a(e,e.marker.line.color,"marker.line","c"),d}},{"../../components/colorscale/calc":490,"../../components/colorscale/has_colorscale":496,"../../plots/cartesian/axes":592,"fast-isnumeric":123}],672:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../components/color"),o=t("../scatter/xy_defaults"),a=t("../bar/style_defaults"),s=t("../../components/errorbars/defaults"),l=t("./attributes");e.exports=function(t,e,r,u){function c(r,i){return n.coerce(t,e,l,r,i)}var h=o(t,e,c);return h?(c("orientation",e.x&&!e.y?"h":"v"),c("text"),a(t,e,c,r,u),s(t,e,i.defaultLine,{axis:"y"}),void s(t,e,i.defaultLine,{axis:"x",inherit:"y"})):void(e.visible=!1)}},{"../../components/color":483,"../../components/errorbars/defaults":511,"../../lib":568,"../bar/style_defaults":680,"../scatter/xy_defaults":771,"./attributes":670}],673:[function(t,e,r){"use strict";var n=t("../../plots/cartesian/graph_interact"),i=t("../../components/errorbars"),o=t("../../components/color");e.exports=function(t,e,r,a){var s,l=t.cd,u=l[0].trace,c=l[0].t,h=t.xa,f=t.ya,d="closest"===a?c.barwidth/2:c.dbar*(1-h._gd._fullLayout.bargap)/2;s="closest"!==a?function(t){return t.p}:"h"===u.orientation?function(t){return t.y}:function(t){return t.x};var p,v;"h"===u.orientation?(p=function(t){return n.inbox(t.b-e,t.x-e)+(t.x-e)/(t.x-t.b)},v=function(t){var e=s(t)-r;return n.inbox(e-d,e+d)}):(v=function(t){return n.inbox(t.b-r,t.y-r)+(t.y-r)/(t.y-t.b)},p=function(t){var r=s(t)-e;return n.inbox(r-d,r+d)});var m=n.getDistanceFunction(a,p,v);if(n.getClosest(l,m,t),t.index!==!1){var g=l[t.index],y=g.mcc||u.marker.color,b=g.mlcc||u.marker.line.color,x=g.mlw||u.marker.line.width;return o.opacity(y)?t.color=y:o.opacity(b)&&x&&(t.color=b),"h"===u.orientation?(t.x0=t.x1=h.c2p(g.x,!0),t.xLabelVal=g.s,t.y0=f.c2p(s(g)-d,!0),t.y1=f.c2p(s(g)+d,!0),t.yLabelVal=g.p):(t.y0=t.y1=f.c2p(g.y,!0),t.yLabelVal=g.s,t.x0=h.c2p(s(g)-d,!0),t.x1=h.c2p(s(g)+d,!0),t.xLabelVal=g.p),g.tx&&(t.text=g.tx),i.hoverInfo(g,u,t),[t]}}},{"../../components/color":483,"../../components/errorbars":512,"../../plots/cartesian/graph_interact":599}],674:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.layoutAttributes=t("./layout_attributes"),n.supplyDefaults=t("./defaults"),n.supplyLayoutDefaults=t("./layout_defaults"),n.calc=t("./calc"),n.setPositions=t("./set_positions"),n.colorbar=t("../scatter/colorbar"),n.arraysToCalcdata=t("./arrays_to_calcdata"),n.plot=t("./plot"),n.style=t("./style"),n.hoverPoints=t("./hover"),n.moduleType="trace",n.name="bar",n.basePlotModule=t("../../plots/cartesian"),n.categories=["cartesian","bar","oriented","markerColorscale","errorBarsOK","showLegend"],n.meta={},e.exports=n},{"../../plots/cartesian":600,"../scatter/colorbar":753,"./arrays_to_calcdata":669,"./attributes":670,"./calc":671,"./defaults":672,"./hover":673,"./layout_attributes":675,"./layout_defaults":676,"./plot":677,"./set_positions":678,"./style":679}],675:[function(t,e,r){"use strict";e.exports={barmode:{valType:"enumerated",values:["stack","group","overlay","relative"],dflt:"group"},barnorm:{valType:"enumerated",values:["","fraction","percent"],dflt:""},bargap:{valType:"number",min:0,max:1},bargroupgap:{valType:"number",min:0,max:1,dflt:0}}},{}],676:[function(t,e,r){"use strict";var n=t("../../plots/plots"),i=t("../../plots/cartesian/axes"),o=t("../../lib"),a=t("./layout_attributes");e.exports=function(t,e,r){function s(r,n){return o.coerce(t,e,a,r,n)}for(var l=!1,u=!1,c=!1,h={},f=0;f<r.length;f++){var d=r[f];if(n.traceIs(d,"bar")){if(l=!0,"overlay"!==t.barmode&&"stack"!==t.barmode){var p=d.xaxis+d.yaxis;h[p]&&(c=!0),h[p]=!0}if(d.visible&&"histogram"===d.type){var v=i.getFromId({_fullLayout:e},d["v"===d.orientation?"xaxis":"yaxis"]);"category"!==v.type&&(u=!0)}}}if(l){var m=s("barmode");"overlay"!==m&&s("barnorm"),s("bargap",u&&!c?0:.2),s("bargroupgap")}}},{"../../lib":568,"../../plots/cartesian/axes":592,"../../plots/plots":648,"./layout_attributes":675}],677:[function(t,e,r){"use strict";var n=t("d3"),i=t("fast-isnumeric"),o=t("../../lib"),a=t("../../components/color"),s=t("../../components/errorbars"),l=t("./arrays_to_calcdata");e.exports=function(t,e,r){var u=e.x(),c=e.y(),h=t._fullLayout,f=e.plot.select(".barlayer").selectAll("g.trace.bars").data(r).enter().append("g").attr("class","trace bars");f.append("g").attr("class","points").each(function(e){var r=e[0].t,s=e[0].trace;l(e),n.select(this).selectAll("path").data(o.identity).enter().append("path").each(function(e){function o(t){return 0===h.bargap&&0===h.bargroupgap?n.round(Math.round(t)-g,2):t}function l(t,e){return Math.abs(t-e)>=2?o(t):t>e?Math.ceil(t):Math.floor(t)}var f,d,p,v;if("h"===s.orientation?(p=c.c2p(r.poffset+e.p,!0),v=c.c2p(r.poffset+e.p+r.barwidth,!0),f=u.c2p(e.b,!0),d=u.c2p(e.s+e.b,!0)):(f=u.c2p(r.poffset+e.p,!0),d=u.c2p(r.poffset+e.p+r.barwidth,!0),v=c.c2p(e.s+e.b,!0),p=c.c2p(e.b,!0)),!(i(f)&&i(d)&&i(p)&&i(v)&&f!==d&&p!==v))return void n.select(this).remove();var m=(e.mlw+1||s.marker.line.width+1||(e.trace?e.trace.marker.line.width:0)+1)-1,g=n.round(m/2%1,2);if(!t._context.staticPlot){var y=a.opacity(e.mc||s.marker.color),b=1>y||m>.01?o:l;f=b(f,d),d=b(d,f),p=b(p,v),v=b(v,p)}n.select(this).attr("d","M"+f+","+p+"V"+v+"H"+d+"V"+p+"Z")})}),f.call(s.plot,e)}},{"../../components/color":483,"../../components/errorbars":512,"../../lib":568,"./arrays_to_calcdata":669,d3:119,"fast-isnumeric":123}],678:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../plots/plots"),o=t("../../plots/cartesian/axes"),a=t("../../lib");e.exports=function(t,e){var r,s,l=t._fullLayout,u=e.x(),c=e.y();["v","h"].forEach(function(h){function f(e){function r(t){t[p]=t.p+f}var n=[];e.forEach(function(e){t.calcdata[e].forEach(function(t){n.push(t.p)})});var i=a.distinctVals(n),s=i.vals,u=i.minDiff,c=!1,h=[];"group"===l.barmode&&e.forEach(function(e){c||(t.calcdata[e].forEach(function(t){c||h.forEach(function(e){Math.abs(t.p-e)<u&&(c=!0)})}),c||t.calcdata[e].forEach(function(t){h.push(t.p)}))}),o.minDtick(m,u,s[0],c),o.expand(m,s,{vpad:u/2}),u*=1-l.bargap,c&&(u/=d.length);for(var f,v=0;v<e.length;v++){var g=t.calcdata[e[v]][0].t;g.barwidth=u*(1-l.bargroupgap),g.poffset=((c?(2*v+1-e.length)*u:0)-g.barwidth)/2,g.dbar=i.minDiff,f=g.poffset+g.barwidth/2,t.calcdata[e[v]].forEach(r)}}var d=[],p={v:"x",h:"y"}[h],v={v:"y",h:"x"}[h],m=e[p](),g=e[v]();if(t._fullData.forEach(function(t,e){t.visible===!0&&i.traceIs(t,"bar")&&t.orientation===h&&t.xaxis===u._id&&t.yaxis===c._id&&d.push(e)}),d.length){"overlay"===l.barmode?d.forEach(function(t){f([t])}):f(d);var y="stack"===l.barmode,b="relative"===l.barmode,x=l.barnorm;if(y||b||x){var _,w,M,k=g.l2c(g.c2l(0)),A=k,T={},E=t.calcdata[d[0]][0].t.barwidth/100,S=0,L=!0;for(r=0;r<d.length;r++)for(w=t.calcdata[d[r]],s=0;s<w.length;s++)if(n(w[s].s)){S=Math.round(w[s].p/E),b&&w[s].s<0&&(S="-"+S);var z=T[S]||0;(y||b)&&(w[s].b=z),_=w[s].b+w[s].s,T[S]=z+w[s].s,(y||b)&&(w[s][v]=_,!x&&n(g.c2l(_))&&(k=Math.max(k,_),A=Math.min(A,_)))}if(x){var I="fraction"===x?1:100,P=!1,C=I/1e9;for(L=!1,A=0,k=y?I:0,r=0;r<d.length;r++)for(w=t.calcdata[d[r]],s=0;s<w.length;s++)P=b&&w[s].s<0,S=Math.round(w[s].p/E),P&&(S="-"+S),M=I/T[S],P&&(M*=-1),w[s].b*=M,w[s].s*=M,_=w[s].b+w[s].s,w[s][v]=_,n(g.c2l(_))&&(A-C>_&&(L=!0,A=_),_>k+C&&(L=!0,k=_))}o.expand(g,[A,k],{tozero:!0,padded:L})}else{var R=function(t){return t[v]=t.s,t.s};for(r=0;r<d.length;r++)o.expand(g,t.calcdata[d[r]].map(R),{tozero:!0,padded:!0})}}})}},{"../../lib":568,"../../plots/cartesian/axes":592,"../../plots/plots":648,"fast-isnumeric":123}],679:[function(t,e,r){"use strict";var n=t("d3"),i=t("../../components/color"),o=t("../../components/drawing"),a=t("../../components/errorbars");e.exports=function(t){var e=n.select(t).selectAll("g.trace.bars"),r=e.size(),s=t._fullLayout;e.style("opacity",function(t){return t[0].trace.opacity}).each(function(t){("stack"===s.barmode&&r>1||0===s.bargap&&0===s.bargroupgap&&!t[0].trace.marker.line.width)&&n.select(this).attr("shape-rendering","crispEdges")}),e.selectAll("g.points").each(function(t){var e=t[0].trace,r=e.marker,a=r.line,s=(e._input||{}).marker||{},l=o.tryColorscale(r,s,""),u=o.tryColorscale(r,s,"line.");n.select(this).selectAll("path").each(function(t){var e,o,s=(t.mlw+1||a.width+1)-1,c=n.select(this);e="mc"in t?t.mcc=l(t.mc):Array.isArray(r.color)?i.defaultLine:r.color,c.style("stroke-width",s+"px").call(i.fill,e),s&&(o="mlc"in t?t.mlcc=u(t.mlc):Array.isArray(a.color)?i.defaultLine:a.color,c.call(i.stroke,o))})}),e.call(a.style)}},{"../../components/color":483,"../../components/drawing":506,"../../components/errorbars":512,d3:119}],680:[function(t,e,r){"use strict";var n=t("../../components/color"),i=t("../../components/colorscale/has_colorscale"),o=t("../../components/colorscale/defaults");e.exports=function(t,e,r,a,s){r("marker.color",a),i(t,"marker")&&o(t,e,s,r,{prefix:"marker.",cLetter:"c"}),r("marker.line.color",n.defaultLine),i(t,"marker.line")&&o(t,e,s,r,{prefix:"marker.line.",cLetter:"c"}),r("marker.line.width")}},{"../../components/color":483,"../../components/colorscale/defaults":493,"../../components/colorscale/has_colorscale":496}],681:[function(t,e,r){"use strict";var n=t("../scatter/attributes"),i=t("../../components/color/attributes"),o=t("../../lib/extend").extendFlat,a=n.marker,s=a.line;e.exports={y:{valType:"data_array"},x:{valType:"data_array"},x0:{valType:"any"},y0:{valType:"any"},whiskerwidth:{valType:"number",min:0,max:1,dflt:.5},boxpoints:{valType:"enumerated",values:["all","outliers","suspectedoutliers",!1],dflt:"outliers"},boxmean:{valType:"enumerated",values:[!0,"sd",!1],dflt:!1},jitter:{valType:"number",min:0,max:1},pointpos:{valType:"number",min:-2,max:2},orientation:{valType:"enumerated",values:["v","h"]},marker:{outliercolor:{valType:"color",dflt:"rgba(0, 0, 0, 0)"},symbol:o({},a.symbol,{arrayOk:!1}),opacity:o({},a.opacity,{arrayOk:!1,dflt:1}),size:o({},a.size,{arrayOk:!1}),color:o({},a.color,{arrayOk:!1}),line:{color:o({},s.color,{arrayOk:!1,dflt:i.defaultLine}),width:o({},s.width,{arrayOk:!1,dflt:0}),outliercolor:{valType:"color"},outlierwidth:{valType:"number",min:0,dflt:1}}},line:{color:{valType:"color"},width:{valType:"number",min:0,dflt:2}},fillcolor:n.fillcolor}},{"../../components/color/attributes":482,"../../lib/extend":563,"../scatter/attributes":750}],682:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../lib"),o=t("../../plots/cartesian/axes");e.exports=function(t,e){function r(t,e,r,o,a){var s;return r in e?p=o.makeCalcdata(e,r):(s=r+"0"in e?e[r+"0"]:"name"in e&&("category"===o.type||n(e.name)&&-1!==["linear","log"].indexOf(o.type)||i.isDateTime(e.name)&&"date"===o.type)?e.name:t.numboxes,s=o.d2c(s),p=a.map(function(){return s})),p}function a(t,e,r,o,a){var s,l,u,c,h=o.length,f=e.length,d=[],p=[];for(s=0;h>s;++s)l=o[s],t[s]={pos:l},p[s]=l-a,d[s]=[];for(p.push(o[h-1]+a),s=0;f>s;++s)c=e[s],n(c)&&(u=i.findBin(r[s],p),u>=0&&f>u&&d[u].push(c));return d}function s(t,e){var r,n,o,a;for(a=0;a<e.length;++a)r=e[a].sort(i.sorterAsc),n=r.length,o=t[a],o.val=r,o.min=r[0],o.max=r[n-1],o.mean=i.mean(r,n),o.sd=i.stdev(r,n,o.mean),o.q1=i.interp(r,.25),o.med=i.interp(r,.5),o.q3=i.interp(r,.75),o.lf=Math.min(o.q1,r[Math.min(i.findBin(2.5*o.q1-1.5*o.q3,r,!0)+1,n-1)]),o.uf=Math.max(o.q3,r[Math.max(i.findBin(2.5*o.q3-1.5*o.q1,r),0)]),o.lo=4*o.q1-3*o.q3,o.uo=4*o.q3-3*o.q1}var l,u,c,h,f,d,p,v,m,g=o.getFromId(t,e.xaxis||"x"),y=o.getFromId(t,e.yaxis||"y"),b=e.orientation,x=[];"h"===b?(l=g,u="x",f=y,d="y"):(l=y,u="y",f=g,d="x"),c=l.makeCalcdata(e,u),o.expand(l,c,{padded:!0}),p=r(t,e,d,f,c);var _=i.distinctVals(p);return v=_.vals,m=_.minDiff/2,h=a(x,c,p,v,m),s(x,h),x=x.filter(function(t){return t.val&&t.val.length}),x.length?(x[0].t={boxnum:t.numboxes,dPos:m},t.numboxes++,x):[{t:{emptybox:!0}}]}},{"../../lib":568,"../../plots/cartesian/axes":592,"fast-isnumeric":123}],683:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../components/color"),o=t("./attributes");e.exports=function(t,e,r){function a(r,i){return n.coerce(t,e,o,r,i)}var s,l=a("y"),u=a("x");if(l&&l.length)s="v",u||a("x0");else{if(!u||!u.length)return void(e.visible=!1);s="h",a("y0")}a("orientation",s),a("line.color",(t.marker||{}).color||r),a("line.width",2),a("fillcolor",i.addOpacity(e.line.color,.5)),a("whiskerwidth"),a("boxmean");var c=n.coerce2(t,e,o,"marker.outliercolor"),h=a("marker.line.outliercolor"),f=c||h?a("boxpoints","suspectedoutliers"):a("boxpoints");f&&(a("jitter","all"===f?.3:0),a("pointpos","all"===f?-1.5:0),a("marker.symbol"),a("marker.opacity"),a("marker.size"),a("marker.color",e.line.color),a("marker.line.color"),a("marker.line.width"),"suspectedoutliers"===f&&(a("marker.line.outliercolor",e.marker.color),a("marker.line.outlierwidth")))}},{"../../components/color":483,"../../lib":568,"./attributes":681}],684:[function(t,e,r){"use strict";var n=t("../../plots/cartesian/axes"),i=t("../../plots/cartesian/graph_interact"),o=t("../../lib"),a=t("../../components/color");e.exports=function(t,e,r,s){var l,u,c,h,f,d,p,v,m,g=t.cd,y=g[0].trace,b=g[0].t,x=t.xa,_=t.ya,w=[];if(h="closest"===s?2.5*b.bdPos:b.bdPos,"h"===y.orientation?(l=function(t){return i.inbox(t.min-e,t.max-e)},u=function(t){var e=t.pos+b.bPos-r;return i.inbox(e-h,e+h)},f="y",d=_,v="x",m=x):(l=function(t){var r=t.pos+b.bPos-e;return i.inbox(r-h,r+h)},u=function(t){return i.inbox(t.min-r,t.max-r)},f="x",d=x,v="y",m=_),c=i.getDistanceFunction(s,l,u),i.getClosest(g,c,t),t.index!==!1){var M=g[t.index],k=y.line.color,A=(y.marker||{}).color;a.opacity(k)&&y.line.width?t.color=k:a.opacity(A)&&y.boxpoints?t.color=A:t.color=y.fillcolor,t[f+"0"]=d.c2p(M.pos+b.bPos-b.bdPos,!0),t[f+"1"]=d.c2p(M.pos+b.bPos+b.bdPos,!0),n.tickText(d,d.c2l(M.pos),"hover").text,t[f+"LabelVal"]=M.pos;var T,E,S={},L=["med","min","q1","q3","max"];y.boxmean&&L.push("mean"),y.boxpoints&&[].push.apply(L,["lf","uf"]);for(var z=0;z<L.length;z++)T=L[z],T in M&&!(M[T]in S)&&(S[M[T]]=!0,p=m.c2p(M[T],!0),E=o.extendFlat({},t),E[v+"0"]=E[v+"1"]=p,E[v+"LabelVal"]=M[T],E.attr=T,"mean"===T&&"sd"in M&&"sd"===y.boxmean&&(E[v+"err"]=M.sd),t.name="",w.push(E));return w}}},{"../../components/color":483,"../../lib":568,"../../plots/cartesian/axes":592,"../../plots/cartesian/graph_interact":599}],685:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.layoutAttributes=t("./layout_attributes"),n.supplyDefaults=t("./defaults"),n.supplyLayoutDefaults=t("./layout_defaults"),n.calc=t("./calc"),n.setPositions=t("./set_positions"),n.plot=t("./plot"),n.style=t("./style"),n.hoverPoints=t("./hover"),n.moduleType="trace",n.name="box",n.basePlotModule=t("../../plots/cartesian"),n.categories=["cartesian","symbols","oriented","box","showLegend"],n.meta={},e.exports=n},{"../../plots/cartesian":600,"./attributes":681,"./calc":682,"./defaults":683,"./hover":684,"./layout_attributes":686,"./layout_defaults":687,"./plot":688,"./set_positions":689,"./style":690}],686:[function(t,e,r){"use strict";e.exports={boxmode:{valType:"enumerated",values:["group","overlay"],dflt:"overlay"},boxgap:{valType:"number",min:0,max:1,dflt:.3},boxgroupgap:{valType:"number",min:0,max:1,dflt:.3}}},{}],687:[function(t,e,r){"use strict";var n=t("../../plots/plots"),i=t("../../lib"),o=t("./layout_attributes");e.exports=function(t,e,r){function a(r,n){return i.coerce(t,e,o,r,n)}for(var s,l=0;l<r.length;l++)if(n.traceIs(r[l],"box")){s=!0;break}s&&(a("boxmode"),a("boxgap"),a("boxgroupgap"))}},{"../../lib":568,"../../plots/plots":648,"./layout_attributes":686}],688:[function(t,e,r){"use strict";function n(){l=2e9}function i(){var t=l;return l=(69069*l+1)%4294967296,Math.abs(l-t)<429496729?i():l/4294967296}var o=t("d3"),a=t("../../lib"),s=t("../../components/drawing"),l=2e9,u=5,c=.01;e.exports=function(t,e,r){var l,h,f=t._fullLayout,d=e.x(),p=e.y(),v=e.plot.select(".boxlayer").selectAll("g.trace.boxes").data(r).enter().append("g").attr("class","trace boxes");v.each(function(e){var r=e[0].t,v=e[0].trace,m="group"===f.boxmode&&t.numboxes>1,g=r.dPos*(1-f.boxgap)*(1-f.boxgroupgap)/(m?t.numboxes:1),y=m?2*r.dPos*(-.5+(r.boxnum+.5)/t.numboxes)*(1-f.boxgap):0,b=g*v.whiskerwidth;return v.visible!==!0||r.emptybox?void o.select(this).remove():("h"===v.orientation?(l=p,h=d):(l=d,h=p),r.bPos=y,r.bdPos=g,n(),o.select(this).selectAll("path.box").data(a.identity).enter().append("path").attr("class","box").each(function(t){var e=l.c2p(t.pos+y,!0),r=l.c2p(t.pos+y-g,!0),n=l.c2p(t.pos+y+g,!0),i=l.c2p(t.pos+y-b,!0),s=l.c2p(t.pos+y+b,!0),u=h.c2p(t.q1,!0),c=h.c2p(t.q3,!0),f=a.constrain(h.c2p(t.med,!0),Math.min(u,c)+1,Math.max(u,c)-1),d=h.c2p(v.boxpoints===!1?t.min:t.lf,!0),p=h.c2p(v.boxpoints===!1?t.max:t.uf,!0);
"h"===v.orientation?o.select(this).attr("d","M"+f+","+r+"V"+n+"M"+u+","+r+"V"+n+"H"+c+"V"+r+"ZM"+u+","+e+"H"+d+"M"+c+","+e+"H"+p+(0===v.whiskerwidth?"":"M"+d+","+i+"V"+s+"M"+p+","+i+"V"+s)):o.select(this).attr("d","M"+r+","+f+"H"+n+"M"+r+","+u+"H"+n+"V"+c+"H"+r+"ZM"+e+","+u+"V"+d+"M"+e+","+c+"V"+p+(0===v.whiskerwidth?"":"M"+i+","+d+"H"+s+"M"+i+","+p+"H"+s))}),v.boxpoints&&o.select(this).selectAll("g.points").data(function(t){return t.forEach(function(t){t.t=r,t.trace=v}),t}).enter().append("g").attr("class","points").selectAll("path").data(function(t){var e,r,n,o,s,l,h,f="all"===v.boxpoints?t.val:t.val.filter(function(e){return e<t.lf||e>t.uf}),d=(t.q3-t.q1)*c,p=[],m=0;if(v.jitter){for(e=0;e<f.length;e++)r=Math.max(0,e-u),o=f[r],n=Math.min(f.length-1,e+u),s=f[n],"all"!==v.boxpoints&&(f[e]<t.lf?s=Math.min(s,t.lf):o=Math.max(o,t.uf)),l=Math.sqrt(d*(n-r)/(s-o))||0,l=a.constrain(Math.abs(l),0,1),p.push(l),m=Math.max(l,m);h=2*v.jitter/m}return f.map(function(e,r){var n,o=v.pointpos;return v.jitter&&(o+=h*p[r]*(i()-.5)),n="h"===v.orientation?{y:t.pos+o*g+y,x:e}:{x:t.pos+o*g+y,y:e},"suspectedoutliers"===v.boxpoints&&e<t.uo&&e>t.lo&&(n.so=!0),n})}).enter().append("path").call(s.translatePoints,d,p),void(v.boxmean&&o.select(this).selectAll("path.mean").data(a.identity).enter().append("path").attr("class","mean").style("fill","none").each(function(t){var e=l.c2p(t.pos+y,!0),r=l.c2p(t.pos+y-g,!0),n=l.c2p(t.pos+y+g,!0),i=h.c2p(t.mean,!0),a=h.c2p(t.mean-t.sd,!0),s=h.c2p(t.mean+t.sd,!0);"h"===v.orientation?o.select(this).attr("d","M"+i+","+r+"V"+n+("sd"!==v.boxmean?"":"m0,0L"+a+","+e+"L"+i+","+r+"L"+s+","+e+"Z")):o.select(this).attr("d","M"+r+","+i+"H"+n+("sd"!==v.boxmean?"":"m0,0L"+e+","+a+"L"+r+","+i+"L"+e+","+s+"Z"))})))})}},{"../../components/drawing":506,"../../lib":568,d3:119}],689:[function(t,e,r){"use strict";var n=t("../../plots/plots"),i=t("../../plots/cartesian/axes"),o=t("../../lib");e.exports=function(t,e){var r,a,s,l,u=t._fullLayout,c=e.x(),h=e.y(),f=["v","h"];for(a=0;a<f.length;++a){var d,p,v,m=f[a],g=[],y=[],b=0,x=0;for(r="h"===m?h:c,s=0;s<t.calcdata.length;++s)d=t.calcdata[s],p=d[0].t,v=d[0].trace,v.visible===!0&&n.traceIs(v,"box")&&!p.emptybox&&v.orientation===m&&v.xaxis===c._id&&v.yaxis===h._id&&(g.push(s),v.boxpoints!==!1&&(b=Math.max(b,v.jitter-v.pointpos-1),x=Math.max(x,v.jitter+v.pointpos-1)));for(s=0;s<g.length;s++)for(d=t.calcdata[g[s]],l=0;l<d.length;l++)y.push(d[l].pos);if(y.length){var _=o.distinctVals(y),w=_.minDiff/2;for(y.length===_.vals.length&&(t.numboxes=1),i.minDtick(r,_.minDiff,_.vals[0],!0),a=0;a<g.length;++a)t.calcdata[a][0].t.dPos=w;var M=(1-u.boxgap)*(1-u.boxgroupgap)*w/t.numboxes;i.expand(r,_.vals,{vpadminus:w+b*M,vpadplus:w+x*M})}}}},{"../../lib":568,"../../plots/cartesian/axes":592,"../../plots/plots":648}],690:[function(t,e,r){"use strict";var n=t("d3"),i=t("../../components/color"),o=t("../../components/drawing");e.exports=function(t){var e=n.select(t).selectAll("g.trace.boxes");e.style("opacity",function(t){return t[0].trace.opacity}).each(function(t){var e=t[0].trace,r=e.line.width;n.select(this).selectAll("path.box").style("stroke-width",r+"px").call(i.stroke,e.line.color).call(i.fill,e.fillcolor),n.select(this).selectAll("path.mean").style({"stroke-width":r,"stroke-dasharray":2*r+"px,"+r+"px"}).call(i.stroke,e.line.color),n.select(this).selectAll("g.points path").call(o.pointStyle,e)})}},{"../../components/color":483,"../../components/drawing":506,d3:119}],691:[function(t,e,r){"use strict";var n=t("../scattergeo/attributes"),i=t("../../components/colorscale/attributes"),o=t("../../plots/attributes"),a=t("../../lib/extend").extendFlat,s=n.marker.line;e.exports=a({},{locations:{valType:"data_array"},locationmode:n.locationmode,z:{valType:"data_array"},text:{valType:"data_array"},marker:{line:{color:s.color,width:s.width}},hoverinfo:a({},o.hoverinfo,{flags:["location","z","text","name"]}),_nestedModules:{colorbar:"Colorbar"}},i)},{"../../components/colorscale/attributes":489,"../../lib/extend":563,"../../plots/attributes":590,"../scattergeo/attributes":778}],692:[function(t,e,r){"use strict";var n=t("../../components/colorscale/calc");e.exports=function(t,e){n(e,e.z,"","z")}},{"../../components/colorscale/calc":490}],693:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../components/colorscale/defaults"),o=t("./attributes");e.exports=function(t,e,r,a){function s(r,i){return n.coerce(t,e,o,r,i)}var l,u=s("locations");if(u&&(l=u.length),!u||!l)return void(e.visible=!1);var c=s("z");return Array.isArray(c)?(c.length>l&&(e.z=c.slice(0,l)),s("locationmode"),s("text"),s("marker.line.color"),s("marker.line.width"),i(t,e,a,s,{prefix:"",cLetter:"z"}),void s("hoverinfo",1===a._dataLength?"location+z+text":void 0)):void(e.visible=!1)}},{"../../components/colorscale/defaults":493,"../../lib":568,"./attributes":691}],694:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.colorbar=t("../heatmap/colorbar"),n.calc=t("./calc"),n.plot=t("./plot").plot,n.moduleType="trace",n.name="choropleth",n.basePlotModule=t("../../plots/geo"),n.categories=["geo","noOpacity"],n.meta={},e.exports=n},{"../../plots/geo":613,"../heatmap/colorbar":708,"./attributes":691,"./calc":692,"./defaults":693,"./plot":695}],695:[function(t,e,r){"use strict";function n(t,e){function r(e){var r=t.mockAxis;return a.tickText(r,r.c2l(e),"hover").text}var n=e.hoverinfo;if("none"===n)return function(t){delete t.nameLabel,delete t.textLabel};var i="all"===n?m.hoverinfo.flags:n.split("+"),o=-1!==i.indexOf("name"),s=-1!==i.indexOf("location"),l=-1!==i.indexOf("z"),u=-1!==i.indexOf("text"),c=!o&&s;return function(t){var n=[];c?t.nameLabel=t.id:(o&&(t.nameLabel=e.name),s&&n.push(t.id)),l&&n.push(r(t.z)),u&&n.push(t.tx),t.textLabel=n.join("<br>")}}function i(t){return function(e,r){return{points:[{data:t._input,fullData:t,curveNumber:t.index,pointNumber:r,location:e.id,z:e.z}]}}}var o=t("d3"),a=t("../../plots/cartesian/axes"),s=t("../../plots/cartesian/graph_interact"),l=t("../../components/color"),u=t("../../components/drawing"),c=t("../../components/colorscale/get_scale"),h=t("../../components/colorscale/make_scale_function"),f=t("../../lib/topojson_utils").getTopojsonFeatures,d=t("../../lib/geo_location_utils").locationToFeature,p=t("../../lib/array_to_calc_item"),v=t("../../plots/geo/constants"),m=t("./attributes"),g=e.exports={};g.calcGeoJSON=function(t,e){for(var r,n=[],i=t.locations,o=i.length,a=f(t,e),s=(t.marker||{}).line||{},l=0;o>l;l++)r=d(t.locationmode,i[l],a),void 0!==r&&(r.z=t.z[l],void 0!==t.text&&(r.tx=t.text[l]),p(s.color,r,"mlc",l),p(s.width,r,"mlw",l),n.push(r));return n.length>0&&(n[0].trace=t),n},g.plot=function(t,e,r){var a,l=t.framework,u=l.select("g.choroplethlayer"),c=l.select("g.baselayer"),h=l.select("g.baselayeroverchoropleth"),f=v.baseLayersOverChoropleth,d=u.selectAll("g.trace.choropleth").data(e,function(t){return t.uid});d.enter().append("g").attr("class","trace choropleth"),d.exit().remove(),d.each(function(e){function r(e,r){if(t.showHover){var n=t.projection(e.properties.ct);u(e),s.loneHover({x:n[0],y:n[1],name:e.nameLabel,text:e.textLabel},{container:t.hoverContainer.node()}),h=c(e,r),t.graphDiv.emit("plotly_hover",h)}}function a(e,r){t.graphDiv.emit("plotly_click",c(e,r))}var l=g.calcGeoJSON(e,t.topojson),u=n(t,e),c=i(e),h=null,f=o.select(this).selectAll("path.choroplethlocation").data(l);f.enter().append("path").classed("choroplethlocation",!0).on("mouseover",r).on("click",a).on("mouseout",function(){s.loneUnhover(t.hoverContainer),t.graphDiv.emit("plotly_unhover",h)}).on("mousedown",function(){s.loneUnhover(t.hoverContainer)}).on("mouseup",r),f.exit().remove()}),h.selectAll("*").remove();for(var p=0;p<f.length;p++)a=f[p],c.select("g."+a).remove(),t.drawTopo(h,a,r),t.styleLayer(h,a,r);g.style(t)},g.style=function(t){t.framework.selectAll("g.trace.choropleth").each(function(t){var e=o.select(this),r=t.marker||{},n=r.line||{},i=t.zmin,a=t.zmax,s=c(t.colorscale),f=h(s,i,a);e.selectAll("path.choroplethlocation").each(function(t){o.select(this).attr("fill",function(t){return f(t.z)}).call(l.stroke,t.mlc||n.color).call(u.dashLine,"",t.mlw||n.width)})})}},{"../../components/color":483,"../../components/colorscale/get_scale":495,"../../components/colorscale/make_scale_function":500,"../../components/drawing":506,"../../lib/array_to_calc_item":559,"../../lib/geo_location_utils":565,"../../lib/topojson_utils":582,"../../plots/cartesian/axes":592,"../../plots/cartesian/graph_interact":599,"../../plots/geo/constants":611,"./attributes":691,d3:119}],696:[function(t,e,r){"use strict";var n=t("../heatmap/attributes"),i=t("../scatter/attributes"),o=t("../../components/colorscale/attributes"),a=t("../../lib/extend").extendFlat,s=i.line;e.exports=a({},{z:n.z,x:n.x,x0:n.x0,dx:n.dx,y:n.y,y0:n.y0,dy:n.dy,text:n.text,transpose:n.transpose,xtype:n.xtype,ytype:n.ytype,connectgaps:n.connectgaps,autocontour:{valType:"boolean",dflt:!0},ncontours:{valType:"integer",dflt:0},contours:{start:{valType:"number",dflt:null},end:{valType:"number",dflt:null},size:{valType:"number",dflt:null},coloring:{valType:"enumerated",values:["fill","heatmap","lines","none"],dflt:"fill"},showlines:{valType:"boolean",dflt:!0}},line:{color:a({},s.color,{}),width:s.width,dash:s.dash,smoothing:a({},s.smoothing,{})},_nestedModules:{colorbar:"Colorbar"}},o,{autocolorscale:a({},o.autocolorscale,{dflt:!1})})},{"../../components/colorscale/attributes":489,"../../lib/extend":563,"../heatmap/attributes":706,"../scatter/attributes":750}],697:[function(t,e,r){"use strict";var n=t("../../plots/cartesian/axes"),i=t("../heatmap/calc");e.exports=function(t,e){var r=i(t,e),o=e.contours;if(e.autocontour!==!1){var a={type:"linear",range:[e.zmin,e.zmax]};n.autoTicks(a,(e.zmax-e.zmin)/(e.ncontours||15)),o.start=n.tickFirst(a),o.size=a.dtick,a.range.reverse(),o.end=n.tickFirst(a),o.start===e.zmin&&(o.start+=o.size),o.end===e.zmax&&(o.end-=o.size),o.end+=o.size/100,e._input.contours=o}return r}},{"../../plots/cartesian/axes":592,"../heatmap/calc":707}],698:[function(t,e,r){"use strict";var n=t("../../plots/plots"),i=t("../../components/colorbar/draw"),o=t("./make_color_map");e.exports=function(t,e){var r=e[0].trace,a="cb"+r.uid;if(t._fullLayout._infolayer.selectAll("."+a).remove(),r.showscale===!1)return void n.autoMargin(t,a);var s=i(t,a);e[0].t.cb=s;var l=r.contours,u=r.line,c=l.size||1,h=l.coloring,f=o(r,{isColorbar:!0});"heatmap"===h&&s.filllevels({start:r.zmin,end:r.zmax,size:(r.zmax-r.zmin)/254}),s.fillcolor("fill"===h||"heatmap"===h?f:"").line({color:"lines"===h?f:u.color,width:l.showlines!==!1?u.width:0,dash:u.dash}).levels({start:l.start,end:l.end,size:c}).options(r.colorbar)()}},{"../../components/colorbar/draw":486,"../../plots/plots":648,"./make_color_map":702}],699:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../heatmap/has_columns"),o=t("../heatmap/xyz_defaults"),a=t("../contour/style_defaults"),s=t("./attributes");e.exports=function(t,e,r,l){function u(r,i){return n.coerce(t,e,s,r,i)}var c=o(t,e,u);if(!c)return void(e.visible=!1);u("text"),u("connectgaps",i(e));var h=n.coerce2(t,e,s,"contours.start"),f=n.coerce2(t,e,s,"contours.end"),d=u("autocontour",!(h&&f));u(d?"ncontours":"contours.size"),a(t,e,u,l)}},{"../../lib":568,"../contour/style_defaults":705,"../heatmap/has_columns":711,"../heatmap/xyz_defaults":717,"./attributes":696}],700:[function(t,e,r){"use strict";var n=t("../heatmap/hover");e.exports=function(t,e,r,i){return n(t,e,r,i,!0)}},{"../heatmap/hover":712}],701:[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.style=t("./style"),n.colorbar=t("./colorbar"),n.hoverPoints=t("./hover"),n.moduleType="trace",n.name="contour",n.basePlotModule=t("../../plots/cartesian"),n.categories=["cartesian","2dMap","contour"],n.meta={},e.exports=n},{"../../plots/cartesian":600,"./attributes":696,"./calc":697,"./colorbar":698,"./defaults":699,"./hover":700,"./plot":703,"./style":704}],702:[function(t,e,r){"use strict";var n=t("d3"),i=t("../../components/colorscale/get_scale");e.exports=function(t){var e,r,o=t.contours,a=o.start,s=o.end,l=o.size||1,u=Math.floor((s+l/10-a)/l)+1,c="lines"===o.coloring?0:1,h=i(t.colorscale),f=h.length,d=new Array(f),p=new Array(f);if("heatmap"===o.coloring){for(t.zauto&&t.autocontour===!1&&(t.zmin=a-l/2,t.zmax=t.zmin+u*l),r=0;f>r;r++)e=h[r],d[r]=e[0]*(t.zmax-t.zmin)+t.zmin,p[r]=e[1];var v=n.extent([t.zmin,t.zmax,o.start,o.start+l*(u-1)]),m=v[t.zmin<t.zmax?0:1],g=v[t.zmin<t.zmax?1:0];m!==t.zmin&&(d.splice(0,0,m),p.splice(0,0,Range[0])),g!==t.zmax&&(d.push(g),p.push(p[p.length-1]))}else for(r=0;f>r;r++)e=h[r],d[r]=(e[0]*(u+c-1)-c/2)*l+a,p[r]=e[1];var y=n.scale.linear().interpolate(n.interpolateRgb).domain(d).range(p);return y}},{"../../components/colorscale/get_scale":495,d3:119}],703:[function(t,e,r){"use strict";function n(t,e,r){var n=r[0].trace,o=r[0].x,s=r[0].y,u=n.contours,c=n.uid,h=e.x(),f=e.y(),m=t._fullLayout,b="contour"+c,x=i(u,e,r[0]);if(n.visible!==!0)return m._paper.selectAll("."+b+",.hm"+c).remove(),void m._infolayer.selectAll(".cb"+c).remove();"heatmap"===u.coloring?(n.zauto&&n.autocontour===!1&&(n._input.zmin=n.zmin=u.start-u.size/2,n._input.zmax=n.zmax=n.zmin+x.length*u.size),M(t,e,[r])):m._paper.selectAll(".hm"+c).remove(),a(x),l(x);var _=h.c2p(o[0],!0),w=h.c2p(o[o.length-1],!0),k=f.c2p(s[0],!0),A=f.c2p(s[s.length-1],!0),T=[[_,A],[w,A],[w,k],[_,k]],E=d(e,r,b);p(E,T,u),v(E,x,T,u),g(E,x,u),y(E,e,r[0],T)}function i(t,e,r){for(var n=t.size||1,i=[],o=t.start;o<t.end+n/10;o+=n)i.push({level:o,crossings:{},starts:[],edgepaths:[],paths:[],xaxis:e.x(),yaxis:e.y(),x:r.x,y:r.y,z:r.z,smoothing:r.trace.line.smoothing});return i}function o(t,e){var r=(e[0][0]>t?0:1)+(e[0][1]>t?0:2)+(e[1][1]>t?0:4)+(e[1][0]>t?0:8);if(5===r||10===r){var n=(e[0][0]+e[0][1]+e[1][0]+e[1][1])/4;return t>n?5===r?713:1114:5===r?104:208}return 15===r?0:r}function a(t){var e,r,n,i,a,s,l,u,c,h=t[0].z,f=h.length,d=h[0].length,p=2===f||2===d;for(r=0;f-1>r;r++)for(i=[],0===r&&(i=i.concat(k)),r===f-2&&(i=i.concat(A)),e=0;d-1>e;e++)for(n=i.slice(),0===e&&(n=n.concat(T)),e===d-2&&(n=n.concat(E)),a=e+","+r,s=[[h[r][e],h[r][e+1]],[h[r+1][e],h[r+1][e+1]]],c=0;c<t.length;c++)u=t[c],l=o(u.level,s),l&&(u.crossings[a]=l,-1!==n.indexOf(l)&&(u.starts.push([e,r]),p&&-1!==n.indexOf(l,n.indexOf(l)+1)&&u.starts.push([e,r])))}function s(t,e,r){function n(t){return d[t%d.length]}var i,o=e.join(","),a=o,s=t.crossings[a],l=u(s,r,e),d=[f(t,e,[-l[0],-l[1]])],p=l.join(","),v=t.z.length,m=t.z[0].length;for(i=0;1e4>i;i++){if(s>20?(s=L[s][(l[0]||l[1])<0?0:1],t.crossings[a]=z[s]):delete t.crossings[a],l=S[s],!l){_.log("Found bad marching index:",s,e,t.level);break}if(d.push(f(t,e,l)),e[0]+=l[0],e[1]+=l[1],c(d[d.length-1],d[d.length-2])&&d.pop(),a=e.join(","),a===o&&l.join(",")===p||r&&(l[0]&&(e[0]<0||e[0]>m-2)||l[1]&&(e[1]<0||e[1]>v-2)))break;s=t.crossings[a]}1e4===i&&_.log("Infinite loop in contour?");var g,y,b,x,w,M,k,A=c(d[0],d[d.length-1]),T=0,E=.2*t.smoothing,I=[],P=0;for(i=1;i<d.length;i++)k=h(d[i],d[i-1]),T+=k,I.push(k);var C=T/I.length*E;for(i=d.length-2;i>=P;i--)if(g=I[i],C>g){for(b=0,y=i-1;y>=P&&g+I[y]<C;y--)g+=I[y];if(A&&i===d.length-2)for(b=0;y>b&&g+I[b]<C;b++)g+=I[b];w=i-y+b+1,M=Math.floor((i+y+b+2)/2),x=A||i!==d.length-2?A||-1!==y?w%2?n(M):[(n(M)[0]+n(M+1)[0])/2,(n(M)[1]+n(M+1)[1])/2]:d[0]:d[d.length-1],d.splice(y+1,i-y+1,x),i=y+1,b&&(P=b),A&&(i===d.length-2?d[b]=d[d.length-1]:0===i&&(d[d.length-1]=d[0]))}if(d.splice(0,P),!(d.length<2))if(A)d.pop(),t.paths.push(d);else{r||_.log("Unclosed interior contour?",t.level,o,d.join("L"));var R=!1;t.edgepaths.forEach(function(e,r){if(!R&&c(e[0],d[d.length-1])){d.pop(),R=!0;var n=!1;t.edgepaths.forEach(function(e,i){!n&&c(e[e.length-1],d[0])&&(n=!0,d.splice(0,1),t.edgepaths.splice(r,1),i===r?t.paths.push(d.concat(e)):t.edgepaths[i]=t.edgepaths[i].concat(d,e))}),n||(t.edgepaths[r]=d.concat(e))}}),t.edgepaths.forEach(function(e,r){!R&&c(e[e.length-1],d[0])&&(d.splice(0,1),t.edgepaths[r]=e.concat(d),R=!0)}),R||t.edgepaths.push(d)}}function l(t){var e,r,n,i,o;for(n=0;n<t.length;n++){for(i=t[n],o=0;o<i.starts.length;o++)r=i.starts[o],s(i,r,"edge");for(e=0;Object.keys(i.crossings).length&&1e4>e;)e++,r=Object.keys(i.crossings)[0].split(",").map(Number),s(i,r);1e4===e&&_.log("Infinite loop in contour?")}}function u(t,e,r){var n=0,i=0;return t>20&&e?208===t||1114===t?n=0===r[0]?1:-1:i=0===r[1]?1:-1:-1!==k.indexOf(t)?i=1:-1!==T.indexOf(t)?n=1:-1!==A.indexOf(t)?i=-1:n=-1,[n,i]}function c(t,e){return Math.abs(t[0]-e[0])<.01&&Math.abs(t[1]-e[1])<.01}function h(t,e){var r=t[0]-e[0],n=t[1]-e[1];return Math.sqrt(r*r+n*n)}function f(t,e,r){var n=e[0]+Math.max(r[0],0),i=e[1]+Math.max(r[1],0),o=t.z[i][n],a=t.xaxis,s=t.yaxis;if(r[1]){var l=(t.level-o)/(t.z[i][n+1]-o);return[a.c2p((1-l)*t.x[n]+l*t.x[n+1],!0),s.c2p(t.y[i],!0)]}var u=(t.level-o)/(t.z[i+1][n]-o);return[a.c2p(t.x[n],!0),s.c2p((1-u)*t.y[i]+u*t.y[i+1],!0)]}function d(t,e,r){var n=t.plot.select(".maplayer").selectAll("g.contour."+r).data(e);return n.enter().append("g").classed("contour",!0).classed(r,!0),n.exit().remove(),n}function p(t,e,r){var n=t.selectAll("g.contourbg").data([0]);n.enter().append("g").classed("contourbg",!0);var i=n.selectAll("path").data("fill"===r.coloring?[0]:[]);i.enter().append("path"),i.exit().remove(),i.attr("d","M"+e.join("L")+"Z").style("stroke","none")}function v(t,e,r,n){var i=t.selectAll("g.contourfill").data([0]);i.enter().append("g").classed("contourfill",!0);var o=i.selectAll("path").data("fill"===n.coloring?e:[]);o.enter().append("path"),o.exit().remove(),o.each(function(t){var e=m(t,r);e?x.select(this).attr("d",e).style("stroke","none"):x.select(this).remove()})}function m(t,e){function r(t){return Math.abs(t[1]-e[0][1])<.01}function n(t){return Math.abs(t[1]-e[2][1])<.01}function i(t){return Math.abs(t[0]-e[0][0])<.01}function o(t){return Math.abs(t[0]-e[2][0])<.01}for(var a,s,l,u,c,h,f=t.edgepaths.length||t.z[0][0]<t.level?"":"M"+e.join("L")+"Z",d=0,p=t.edgepaths.map(function(t,e){return e}),v=!0;p.length;){for(h=w.smoothopen(t.edgepaths[d],t.smoothing),f+=v?h:h.replace(/^M/,"L"),p.splice(p.indexOf(d),1),a=t.edgepaths[d][t.edgepaths[d].length-1],u=-1,l=0;4>l;l++){if(!a){_.log("Missing end?",d,t);break}for(r(a)&&!o(a)?s=e[1]:i(a)?s=e[0]:n(a)?s=e[3]:o(a)&&(s=e[2]),c=0;c<t.edgepaths.length;c++){var m=t.edgepaths[c][0];Math.abs(a[0]-s[0])<.01?Math.abs(a[0]-m[0])<.01&&(m[1]-a[1])*(s[1]-m[1])>=0&&(s=m,u=c):Math.abs(a[1]-s[1])<.01?Math.abs(a[1]-m[1])<.01&&(m[0]-a[0])*(s[0]-m[0])>=0&&(s=m,u=c):_.log("endpt to newendpt is not vert. or horz.",a,s,m)}if(a=s,u>=0)break;f+="L"+s}if(u===t.edgepaths.length){_.log("unclosed perimeter path");break}d=u,v=-1===p.indexOf(d),v&&(d=p[0],f+="Z")}for(d=0;d<t.paths.length;d++)f+=w.smoothclosed(t.paths[d],t.smoothing);return f}function g(t,e,r){var n=e[0].smoothing,i=t.selectAll("g.contourlevel").data(r.showlines===!1?[]:e);i.enter().append("g").classed("contourlevel",!0),i.exit().remove();var o=i.selectAll("path.openline").data(function(t){return t.edgepaths});o.enter().append("path").classed("openline",!0),o.exit().remove(),o.attr("d",function(t){return w.smoothopen(t,n)}).style("stroke-miterlimit",1);var a=i.selectAll("path.closedline").data(function(t){return t.paths});a.enter().append("path").classed("closedline",!0),a.exit().remove(),a.attr("d",function(t){return w.smoothclosed(t,n)}).style("stroke-miterlimit",1)}function y(t,e,r,n){var i="clip"+r.trace.uid,o=e.plot.selectAll("defs").data([0]);o.enter().append("defs");var s=o.selectAll("#"+i).data(r.trace.connectgaps?[]:[0]);if(s.enter().append("clipPath").attr("id",i),s.exit().remove(),r.trace.connectgaps===!1){var u={level:.9,crossings:{},starts:[],edgepaths:[],paths:[],xaxis:e.x(),yaxis:e.y(),x:r.x,y:r.y,z:b(r),smoothing:0};a([u]),l([u]);var c=m(u,n),h=s.selectAll("path").data([0]);h.enter().append("path"),h.attr("d",c)}else i=null;t.call(w.setClipUrl,i),e.plot.selectAll(".hm"+r.trace.uid).call(w.setClipUrl,i)}function b(t){var e,r,n=t.trace._emptypoints,i=[],o=t.z.length,a=t.z[0].length,s=[];for(e=0;a>e;e++)s.push(1);for(e=0;o>e;e++)i.push(s.slice());for(e=0;e<n.length;e++)r=n[e],i[r[0]][r[1]]=0;return t.zmask=i,i}var x=t("d3"),_=t("../../lib"),w=t("../../components/drawing"),M=t("../heatmap/plot");e.exports=function(t,e,r){for(var i=0;i<r.length;i++)n(t,e,r[i])};var k=[1,9,13,104,713],A=[4,6,7,104,713],T=[8,12,14,208,1114],E=[2,3,11,208,1114],S=[null,[-1,0],[0,-1],[-1,0],[1,0],null,[0,-1],[-1,0],[0,1],[0,1],null,[0,1],[1,0],[1,0],[0,-1]],L={104:[4,1],208:[2,8],713:[7,13],1114:[11,14]},z={1:4,2:8,4:1,7:13,8:2,11:14,13:7,14:11}},{"../../components/drawing":506,"../../lib":568,"../heatmap/plot":715,d3:119}],704:[function(t,e,r){"use strict";var n=t("d3"),i=t("../../components/drawing"),o=t("../heatmap/style"),a=t("./make_color_map");e.exports=function(t){var e=n.select(t).selectAll("g.contour");e.style("opacity",function(t){return t.trace.opacity}),e.each(function(t){var e=n.select(this),r=t.trace,o=r.contours,s=r.line,l=o.size||1,u=o.start,c=a(r);e.selectAll("g.contourlevel").each(function(t,e){n.select(this).selectAll("path").call(i.lineGroupStyle,s.width,"lines"===o.coloring?c(u+e*l):s.color,s.dash)}),e.selectAll("g.contourbg path").style("fill",c(u-l/2)),e.selectAll("g.contourfill path").style("fill",function(t,e){return c(u+(e+.5)*l)})}),o(t)}},{"../../components/drawing":506,"../heatmap/style":716,"./make_color_map":702,d3:119}],705:[function(t,e,r){"use strict";var n=t("../../components/colorscale/defaults");e.exports=function(t,e,r,i){var o,a=r("contours.coloring");"fill"===a&&(o=r("contours.showlines")),o!==!1&&("lines"!==a&&r("line.color","#000"),r("line.width",.5),r("line.dash")),r("line.smoothing"),"none"!==(e.contours||{}).coloring&&n(t,e,i,r,{prefix:"",cLetter:"z"})}},{"../../components/colorscale/defaults":493}],706:[function(t,e,r){"use strict";var n=t("../scatter/attributes"),i=t("../../components/colorscale/attributes"),o=t("../../lib/extend").extendFlat;e.exports=o({},{z:{valType:"data_array"},x:n.x,x0:n.x0,dx:n.dx,y:n.y,y0:n.y0,dy:n.dy,text:{valType:"data_array"},transpose:{valType:"boolean",dflt:!1},xtype:{valType:"enumerated",values:["array","scaled"]},ytype:{valType:"enumerated",values:["array","scaled"]},zsmooth:{valType:"enumerated",values:["fast","best",!1],dflt:!1},connectgaps:{valType:"boolean",dflt:!1},_nestedModules:{colorbar:"Colorbar"}},i,{autocolorscale:o({},i.autocolorscale,{dflt:!1})})},{"../../components/colorscale/attributes":489,"../../lib/extend":563,"../scatter/attributes":750}],707:[function(t,e,r){"use strict";function n(t){function e(t){return u(t)?+t:void 0}var r,n,i,o,a,s,l=t.z;if(t.transpose){for(r=0,a=0;a<l.length;a++)r=Math.max(r,l[a].length);if(0===r)return!1;i=function(t){return t.length},o=function(t,e,r){return t[r][e]}}else r=l.length,i=function(t,e){return t[e].length},o=function(t,e,r){return t[e][r]};var c=new Array(r);for(a=0;r>a;a++)for(n=i(l,a),c[a]=new Array(n),s=0;n>s;s++)c[a][s]=e(o(l,a,s));return c}function i(t,e,r,n,i,o){var a,s,l,u=[],c=f.traceIs(t,"contour"),h=f.traceIs(t,"histogram"),d=f.traceIs(t,"gl2d"),p=Array.isArray(e)&&e.length>1;if(p&&!h&&"category"!==o.type){e=e.map(o.d2c);var v=e.length;if(!(i>=v))return c?e.slice(0,i):e.slice(0,i+1);if(c||d)u=e.slice(0,i);else if(1===i)u=[e[0]-.5,e[0]+.5];else{for(u=[1.5*e[0]-.5*e[1]],l=1;v>l;l++)u.push(.5*(e[l-1]+e[l]));u.push(1.5*e[v-1]-.5*e[v-2])}if(i>v){var m=u[u.length-1],g=m-u[u.length-2];for(l=v;i>l;l++)m+=g,u.push(m)}}else for(s=n||1,a=h||"category"===o.type?r||0:Array.isArray(e)&&1===e.length?e[0]:void 0===r?0:o.d2c(r),l=c||d?0:-.5;i>l;l++)u.push(a+s*l);return u}function o(t){return.5-.25*Math.min(1,.5*t)}function a(t,e,r){var n,i,a=1;if(Array.isArray(r))for(n=0;n<e.length;n++)i=e[n],t[i[0]][i[1]]=r[i[0]][i[1]];else l(t,e);for(n=0;n<e.length&&!(e[n][2]<4);n++);for(e=e.slice(n),n=0;100>n&&a>y;n++)a=l(t,e,o(a));return a>y&&c.log("interp2d didn't converge quickly",a),t}function s(t){var e,r,n,i,o,a,s,l,u=[],c={},h=[],f=t[0],d=[],p=[0,0,0],v=g(t);for(r=0;r<t.length;r++)for(e=d,d=f,f=t[r+1]||[],n=0;v>n;n++)void 0===d[n]&&(a=(void 0!==d[n-1]?1:0)+(void 0!==d[n+1]?1:0)+(void 0!==e[n]?1:0)+(void 0!==f[n]?1:0),a?(0===r&&a++,0===n&&a++,r===t.length-1&&a++,n===d.length-1&&a++,4>a&&(c[[r,n]]=[r,n,a]),u.push([r,n,a])):h.push([r,n]));for(;h.length;){for(s={},l=!1,o=h.length-1;o>=0;o--)i=h[o],r=i[0],n=i[1],a=((c[[r-1,n]]||p)[2]+(c[[r+1,n]]||p)[2]+(c[[r,n-1]]||p)[2]+(c[[r,n+1]]||p)[2])/20,a&&(s[i]=[r,n,a],h.splice(o,1),l=!0);if(!l)throw"findEmpties iterated with no new neighbors";for(i in s)c[i]=s[i],u.push(s[i])}return u.sort(function(t,e){return e[2]-t[2]})}function l(t,e,r){var n,i,o,a,s,l,u,c,h,f,d,p,v,m=0;for(a=0;a<e.length;a++){for(n=e[a],i=n[0],o=n[1],d=t[i][o],f=0,h=0,s=0;4>s;s++)l=b[s],u=t[i+l[0]],u&&(c=u[o+l[1]],void 0!==c&&(0===f?p=v=c:(p=Math.min(p,c),v=Math.max(v,c)),h++,f+=c));if(0===h)throw"iterateInterp2d order is wrong: no defined neighbors";t[i][o]=f/h,void 0===d?4>h&&(m=1):(t[i][o]=(1+r)*t[i][o]-r*d,v>p&&(m=Math.max(m,Math.abs(t[i][o]-d)/(v-p))))}return m}var u=t("fast-isnumeric"),c=t("../../lib"),h=t("../../plots/cartesian/axes"),f=t("../../plots/plots"),d=t("../histogram2d/calc"),p=t("../../components/colorscale/calc"),v=t("./has_columns"),m=t("./convert_column_xyz"),g=t("./max_row_length");e.exports=function(t,e){function r(t){E=e._input.zsmooth=e.zsmooth=!1,c.notifier("cannot fast-zsmooth: "+t)}var o,l,u,y,b,x,_,w,M=h.getFromId(t,e.xaxis||"x"),k=h.getFromId(t,e.yaxis||"y"),A=f.traceIs(e,"contour"),T=f.traceIs(e,"histogram"),E=A?"best":e.zsmooth;if(M._minDtick=0,k._minDtick=0,T){var S=d(t,e);o=S.x,l=S.x0,u=S.dx,y=S.y,b=S.y0,x=S.dy,_=S.z}else v(e)&&m(e,M,k),o=e.x?M.makeCalcdata(e,"x"):[],y=e.y?k.makeCalcdata(e,"y"):[],l=e.x0||0,u=e.dx||1,b=e.y0||0,x=e.dy||1,_=n(e),(A||e.connectgaps)&&(e._emptypoints=s(_),e._interpz=a(_,e._emptypoints,e._interpz));if("fast"===E)if("log"===M.type||"log"===k.type)r("log axis found");else if(!T){if(o.length){var L=(o[o.length-1]-o[0])/(o.length-1),z=Math.abs(L/100);for(w=0;w<o.length-1;w++)if(Math.abs(o[w+1]-o[w]-L)>z){r("x scale is not linear");break}}if(y.length&&"fast"===E){var I=(y[y.length-1]-y[0])/(y.length-1),P=Math.abs(I/100);for(w=0;w<y.length-1;w++)if(Math.abs(y[w+1]-y[w]-I)>P){r("y scale is not linear");break}}}var C=g(_),R="scaled"===e.xtype?"":e.x,D=i(e,R,l,u,C,M),O="scaled"===e.ytype?"":e.y,F=i(e,O,b,x,_.length,k);h.expand(M,D),h.expand(k,F);var j={x:D,y:F,z:_};if(p(e,_,"","z"),A&&e.contours&&"heatmap"===e.contours.coloring){var N="contour"===e.type?"heatmap":"histogram2d";j.xfill=i(N,R,l,u,C,M),j.yfill=i(N,O,b,x,_.length,k)}return[j]};var y=.01,b=[[-1,0],[1,0],[0,-1],[0,1]]},{"../../components/colorscale/calc":490,"../../lib":568,"../../plots/cartesian/axes":592,"../../plots/plots":648,"../histogram2d/calc":727,"./convert_column_xyz":709,"./has_columns":711,"./max_row_length":714,"fast-isnumeric":123}],708:[function(t,e,r){"use strict";var n=t("d3"),i=t("fast-isnumeric"),o=t("../../lib"),a=t("../../plots/plots"),s=t("../../components/colorscale/get_scale"),l=t("../../components/colorbar/draw");e.exports=function(t,e){var r=e[0].trace,u="cb"+r.uid,c=s(r.colorscale),h=r.zmin,f=r.zmax;if(i(h)||(h=o.aggNums(Math.min,null,r.z)),i(f)||(f=o.aggNums(Math.max,null,r.z)),t._fullLayout._infolayer.selectAll("."+u).remove(),!r.showscale)return void a.autoMargin(t,u);var d=e[0].t.cb=l(t,u);d.fillcolor(n.scale.linear().domain(c.map(function(t){return h+t[0]*(f-h)})).range(c.map(function(t){return t[1]}))).filllevels({start:h,end:f,size:(f-h)/254}).options(r.colorbar)()}},{"../../components/colorbar/draw":486,"../../components/colorscale/get_scale":495,"../../lib":568,"../../plots/plots":648,d3:119,"fast-isnumeric":123}],709:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function(t,e,r){var i,o=t.x.slice(),a=t.y.slice(),s=t.z,l=t.text,u=Math.min(o.length,a.length,s.length),c=void 0!==l&&!Array.isArray(l[0]);for(u<o.length&&(o=o.slice(0,u)),u<a.length&&(a=a.slice(0,u)),i=0;u>i;i++)o[i]=e.d2c(o[i]),a[i]=r.d2c(a[i]);var h,f,d,p=n.distinctVals(o),v=p.vals,m=n.distinctVals(a),g=m.vals,y=n.init2dArray(g.length,v.length);for(c&&(d=n.init2dArray(g.length,v.length)),i=0;u>i;i++)h=n.findBin(o[i]+p.minDiff/2,v),f=n.findBin(a[i]+m.minDiff/2,g),y[f][h]=s[i],c&&(d[f][h]=l[i]);t.x=v,t.y=g,t.z=y,c&&(t.text=d)}},{"../../lib":568}],710:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("./has_columns"),o=t("./xyz_defaults"),a=t("../../components/colorscale/defaults"),s=t("./attributes");e.exports=function(t,e,r,l){function u(r,i){return n.coerce(t,e,s,r,i)}var c=o(t,e,u);return c?(u("text"),u("zsmooth"),u("connectgaps",i(e)&&e.zsmooth!==!1),void a(t,e,l,u,{prefix:"",cLetter:"z"})):void(e.visible=!1)}},{"../../components/colorscale/defaults":493,"../../lib":568,"./attributes":706,"./has_columns":711,"./xyz_defaults":717}],711:[function(t,e,r){"use strict";e.exports=function(t){return!Array.isArray(t.z[0])}},{}],712:[function(t,e,r){"use strict";var n=t("../../plots/cartesian/graph_interact"),i=t("../../lib"),o=t("../../plots/cartesian/constants").MAXDIST;e.exports=function(t,e,r,a,s){if(!(t.distance<o)){var l,u,c,h,f=t.cd[0],d=f.trace,p=t.xa,v=t.ya,m=f.x,g=f.y,y=f.z,b=f.zmask,x=m,_=g;if(t.index!==!1){try{c=Math.round(t.index[1]),h=Math.round(t.index[0])}catch(w){return void i.error("Error hovering on heatmap, pointNumber must be [row,col], found:",t.index)}if(0>c||c>=y[0].length||0>h||h>y.length)return}else{if(n.inbox(e-m[0],e-m[m.length-1])>o||n.inbox(r-g[0],r-g[g.length-1])>o)return;if(s){var M;for(x=[2*m[0]-m[1]],M=1;M<m.length;M++)x.push((m[M]+m[M-1])/2);for(x.push([2*m[m.length-1]-m[m.length-2]]),_=[2*g[0]-g[1]],M=1;M<g.length;M++)_.push((g[M]+g[M-1])/2);_.push([2*g[g.length-1]-g[g.length-2]])}c=Math.max(0,Math.min(x.length-2,i.findBin(e,x))),h=Math.max(0,Math.min(_.length-2,i.findBin(r,_)))}var k=p.c2p(m[c]),A=p.c2p(m[c+1]),T=v.c2p(g[h]),E=v.c2p(g[h+1]);s?(A=k,l=m[c],E=T,u=g[h]):(l=(m[c]+m[c+1])/2,u=(g[h]+g[h+1])/2,d.zsmooth&&(k=A=(k+A)/2,T=E=(T+E)/2));var S=y[h][c];b&&!b[h][c]&&(S=void 0);var L;return Array.isArray(d.text)&&Array.isArray(d.text[h])&&(L=d.text[h][c]),[i.extendFlat(t,{index:[h,c],distance:o+10,x0:k,x1:A,y0:T,y1:E,xLabelVal:l,yLabelVal:u,zLabelVal:S,text:L})]}}},{"../../lib":568,"../../plots/cartesian/constants":597,"../../plots/cartesian/graph_interact":599}],713:[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.style=t("./style"),n.hoverPoints=t("./hover"),n.moduleType="trace",n.name="heatmap",n.basePlotModule=t("../../plots/cartesian"),n.categories=["cartesian","2dMap"],n.meta={},e.exports=n},{"../../plots/cartesian":600,"./attributes":706,"./calc":707,"./colorbar":708,"./defaults":710,"./hover":712,"./plot":715,"./style":716}],714:[function(t,e,r){"use strict";e.exports=function(t){for(var e=0,r=0;r<t.length;r++)e=Math.max(e,t[r].length);return e}},{}],715:[function(t,e,r){"use strict";function n(t,e,r){function n(t,e){var r=e.length-2,n=a.constrain(a.findBin(t,e),0,r),i=e[n],o=e[n+1],s=a.constrain(n+(t-i)/(o-i)-.5,0,r),l=Math.round(s),u=Math.abs(s-l);return s&&s!==r&&u?{bin0:l,frac:u,bin1:Math.round(l+u/(s-l))}:{bin0:l,bin1:l,frac:0}}function h(t,e){if(void 0!==t){var r=Z((t-E)/(S-E));return r[0]=Math.round(r[0]),r[1]=Math.round(r[1]),r[2]=Math.round(r[2]),at+=e,st+=r[0]*e,lt+=r[1]*e,ut+=r[2]*e,r}return[0,0,0,0]}function f(t,e,r){t[e]=r[0],t[e+1]=r[1],t[e+2]=r[2],t[e+3]=Math.round(255*r[3])}function d(t,e,r,n){var i=t[r.bin0];if(void 0===i)return h(void 0,1);var o,a=t[r.bin1],s=e[r.bin0],l=e[r.bin1],u=a-i||0,c=s-i||0;return o=void 0===a?void 0===l?0:void 0===s?2*(l-i):2*(2*l-s-i)/3:void 0===l?void 0===s?0:2*(2*i-a-s)/3:void 0===s?2*(2*l-a-i)/3:l+i-a-s,h(i+r.frac*u+n.frac*(c+r.frac*o))}var p=r[0].trace,v=p.uid,m=e.x(),g=e.y(),y=t._fullLayout,b="hm"+v;if(y._paper.selectAll(".contour"+v).remove(),p.visible!==!0)return y._paper.selectAll("."+b).remove(),void y._infolayer.selectAll(".cb"+v).remove();
var x,_,w,M,k,A,T=r[0].z,E=p.zmin,S=p.zmax,L=l(p.colorscale),z=r[0].x,I=r[0].y,P=s.traceIs(p,"contour"),C=P?"best":p.zsmooth,R=T.length,D=c(T),O=!1,F=!1;for(A=0;void 0===x&&A<z.length-1;)x=m.c2p(z[A]),A++;for(A=z.length-1;void 0===_&&A>0;)_=m.c2p(z[A]),A--;for(x>_&&(w=_,_=x,x=w,O=!0),A=0;void 0===M&&A<I.length-1;)M=g.c2p(I[A]),A++;for(A=I.length-1;void 0===k&&A>0;)k=g.c2p(I[A]),A--;if(M>k&&(w=M,M=k,k=w,F=!0),P&&(z=r[0].xfill,I=r[0].yfill),"fast"!==C){var j="best"===C?0:.5;x=Math.max(-j*m._length,x),_=Math.min((1+j)*m._length,_),M=Math.max(-j*g._length,M),k=Math.min((1+j)*g._length,k)}var N=Math.round(_-x),B=Math.round(k-M),U=0>=N||0>=B,V=e.plot.select(".imagelayer").selectAll("g.hm."+b).data(U?[]:[0]);if(V.enter().append("g").classed("hm",!0).classed(b,!0),V.exit().remove(),!U){var q,G;"fast"===C?(q=D,G=R):(q=N,G=B);var H=document.createElement("canvas");H.width=q,H.height=G;var X,Y,W=H.getContext("2d"),Z=i.scale.linear().domain(L.map(function(t){return t[0]})).range(L.map(function(t){var e=o(t[1]).toRgb();return[e.r,e.g,e.b,e.a]})).clamp(!0);"fast"===C?(X=O?function(t){return D-1-t}:a.identity,Y=F?function(t){return R-1-t}:a.identity):(X=function(t){return a.constrain(Math.round(m.c2p(z[t])-x),0,N)},Y=function(t){return a.constrain(Math.round(g.c2p(I[t])-M),0,B)});var K,J,$,Q,tt,et,rt=Y(0),nt=[rt,rt],it=O?0:1,ot=F?0:1,at=0,st=0,lt=0,ut=0;if(C){var ct=0,ht=new Uint8Array(N*B*4);if("best"===C){var ft,dt,pt,vt=new Array(z.length),mt=new Array(I.length),gt=new Array(N);for(A=0;A<z.length;A++)vt[A]=Math.round(m.c2p(z[A])-x);for(A=0;A<I.length;A++)mt[A]=Math.round(g.c2p(I[A])-M);for(A=0;N>A;A++)gt[A]=n(A,vt);for(J=0;B>J;J++)for(ft=n(J,mt),dt=T[ft.bin0],pt=T[ft.bin1],A=0;N>A;A++,ct+=4)et=d(dt,pt,gt[A],ft),f(ht,ct,et)}else for(J=0;R>J;J++)for(tt=T[J],nt=Y(J),A=0;N>A;A++)et=h(tt[A],1),ct=4*(nt*N+X(A)),f(ht,ct,et);var yt=W.createImageData(N,B);yt.data.set(ht),W.putImageData(yt,0,0)}else for(J=0;R>J;J++)if(tt=T[J],nt.reverse(),nt[ot]=Y(J+1),nt[0]!==nt[1]&&void 0!==nt[0]&&void 0!==nt[1])for($=X(0),K=[$,$],A=0;D>A;A++)K.reverse(),K[it]=X(A+1),K[0]!==K[1]&&void 0!==K[0]&&void 0!==K[1]&&(Q=tt[A],et=h(Q,(K[1]-K[0])*(nt[1]-nt[0])),W.fillStyle="rgba("+et.join(",")+")",W.fillRect(K[0],nt[0],K[1]-K[0],nt[1]-nt[0]));st=Math.round(st/at),lt=Math.round(lt/at),ut=Math.round(ut/at);var bt=o("rgb("+st+","+lt+","+ut+")");t._hmpixcount=(t._hmpixcount||0)+at,t._hmlumcount=(t._hmlumcount||0)+at*bt.getLuminance();var xt=V.selectAll("image").data(r);xt.enter().append("svg:image").attr({xmlns:u.svg,preserveAspectRatio:"none"}),xt.attr({height:B,width:N,x:x,y:M,"xlink:href":H.toDataURL("image/png")}),xt.exit().remove()}}var i=t("d3"),o=t("tinycolor2"),a=t("../../lib"),s=t("../../plots/plots"),l=t("../../components/colorscale/get_scale"),u=t("../../constants/xmlns_namespaces"),c=t("./max_row_length");e.exports=function(t,e,r){for(var i=0;i<r.length;i++)n(t,e,r[i])}},{"../../components/colorscale/get_scale":495,"../../constants/xmlns_namespaces":556,"../../lib":568,"../../plots/plots":648,"./max_row_length":714,d3:119,tinycolor2:454}],716:[function(t,e,r){"use strict";var n=t("d3");e.exports=function(t){n.select(t).selectAll(".hm image").style("opacity",function(t){return t.trace.opacity})}},{d3:119}],717:[function(t,e,r){"use strict";function n(t,e){var r=e(t),n=r?e(t+"type","array"):"scaled";return"scaled"===n&&(e(t+"0"),e("d"+t)),r}function i(t){for(var e,r=!0,n=!1,i=!1,a=0;a<t.length;a++){if(e=t[a],!Array.isArray(e)){r=!1;break}e.length>0&&(n=!0);for(var s=0;s<e.length;s++)if(o(e[s])){i=!0;break}}return r&&n&&i}var o=t("fast-isnumeric"),a=t("./has_columns");e.exports=function(t,e,r){var o,s,l=r("z");if(void 0===l||!l.length)return 0;if(a(t)){if(o=r("x"),s=r("y"),!o||!s)return 0}else{if(o=n("x",r),s=n("y",r),!i(l))return 0;r("transpose")}return e.z.length}},{"./has_columns":711,"fast-isnumeric":123}],718:[function(t,e,r){"use strict";function n(t){return{start:{valType:"number",dflt:null},end:{valType:"number",dflt:null},size:{valType:"any",dflt:1}}}var i=t("../bar/attributes");e.exports={x:{valType:"data_array"},y:{valType:"data_array"},text:i.text,orientation:i.orientation,histfunc:{valType:"enumerated",values:["count","sum","avg","min","max"],dflt:"count"},histnorm:{valType:"enumerated",values:["","percent","probability","density","probability density"],dflt:""},autobinx:{valType:"boolean",dflt:!0},nbinsx:{valType:"integer",min:0,dflt:0},xbins:n("x"),autobiny:{valType:"boolean",dflt:!0},nbinsy:{valType:"integer",min:0,dflt:0},ybins:n("y"),marker:i.marker,_nestedModules:{error_y:"ErrorBars",error_x:"ErrorBars","marker.colorbar":"Colorbar"},_deprecated:{bardir:i._deprecated.bardir}}},{"../bar/attributes":670}],719:[function(t,e,r){"use strict";e.exports=function(t,e){for(var r=t.length,n=0,i=0;r>i;i++)e[i]?(t[i]/=e[i],n+=t[i]):t[i]=null;return n}},{}],720:[function(t,e,r){"use strict";e.exports=function(t,e,r,n){return r("histnorm"),n.forEach(function(t){var e=r(t+"bins.start"),n=r(t+"bins.end"),i=r("autobin"+t,!(e&&n));r(i?"nbins"+t:t+"bins.size")}),e}},{}],721:[function(t,e,r){"use strict";var n=t("fast-isnumeric");e.exports={count:function(t,e,r){return r[t]++,1},sum:function(t,e,r,i){var o=i[e];return n(o)?(o=Number(o),r[t]+=o,o):0},avg:function(t,e,r,i,o){var a=i[e];return n(a)&&(a=Number(a),r[t]+=a,o[t]++),0},min:function(t,e,r,i){var o=i[e];if(n(o)){if(o=Number(o),!n(r[t]))return r[t]=o,o;if(r[t]>o)return r[t]=o,o-r[t]}return 0},max:function(t,e,r,i){var o=i[e];if(n(o)){if(o=Number(o),!n(r[t]))return r[t]=o,o;if(r[t]<o)return r[t]=o,o-r[t]}return 0}}},{"fast-isnumeric":123}],722:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../lib"),o=t("../../plots/cartesian/axes"),a=t("./bin_functions"),s=t("./norm_functions"),l=t("./average");e.exports=function(t,e){if(e.visible===!0){var r,u=[],c=[],h=o.getFromId(t,"h"===e.orientation?e.yaxis||"y":e.xaxis||"x"),f="h"===e.orientation?"y":"x",d={x:"y",y:"x"}[f],p=h.makeCalcdata(e,f);e["autobin"+f]===!1&&f+"bins"in e||(e[f+"bins"]=o.autoBin(p,h,e["nbins"+f]),e._input[f+"bins"]=e[f+"bins"]);var v,m,g,y,b=e[f+"bins"],x="string"==typeof b.size,_=x?[]:b,w=[],M=[],k=0,A=e.histnorm,T=e.histfunc,E=-1!==A.indexOf("density"),S="max"===T||"min"===T,L=S?null:0,z=a.count,I=s[A],P=!1;for(Array.isArray(e[d])&&"count"!==T&&(y=e[d],P="avg"===T,z=a[T]),r=b.start,m=b.end+(b.start-o.tickIncrement(b.start,b.size))/1e6;m>r&&u.length<5e3;)v=o.tickIncrement(r,b.size),u.push((r+v)/2),c.push(L),x&&_.push(r),E&&w.push(1/(v-r)),P&&M.push(0),r=v;var C=c.length;for(r=0;r<p.length;r++)g=i.findBin(p[r],_),g>=0&&C>g&&(k+=z(g,r,c,y,M));P&&(k=l(c,M)),I&&I(c,k,w);var R=Math.min(u.length,c.length),D=[],O=0,F=R-1;for(r=0;R>r;r++)if(c[r]){O=r;break}for(r=R-1;r>O;r--)if(c[r]){F=r;break}for(r=O;F>=r;r++)n(u[r])&&n(c[r])&&D.push({p:u[r],s:c[r],b:0});return D}}},{"../../lib":568,"../../plots/cartesian/axes":592,"./average":719,"./bin_functions":721,"./norm_functions":725,"fast-isnumeric":123}],723:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../components/color"),o=t("./bin_defaults"),a=t("../bar/style_defaults"),s=t("../../components/errorbars/defaults"),l=t("./attributes");e.exports=function(t,e,r,u){function c(r,i){return n.coerce(t,e,l,r,i)}var h=c("x"),f=c("y");c("text");var d=c("orientation",f&&!h?"h":"v"),p=e["v"===d?"x":"y"];if(!p||!p.length)return void(e.visible=!1);var v=e["h"===d?"x":"y"];v&&c("histfunc");var m="h"===d?["y"]:["x"];o(t,e,c,m),a(t,e,c,r,u),s(t,e,i.defaultLine,{axis:"y"}),s(t,e,i.defaultLine,{axis:"x",inherit:"y"})}},{"../../components/color":483,"../../components/errorbars/defaults":511,"../../lib":568,"../bar/style_defaults":680,"./attributes":718,"./bin_defaults":720}],724:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.layoutAttributes=t("../bar/layout_attributes"),n.supplyDefaults=t("./defaults"),n.supplyLayoutDefaults=t("../bar/layout_defaults"),n.calc=t("./calc"),n.setPositions=t("../bar/set_positions"),n.plot=t("../bar/plot"),n.style=t("../bar/style"),n.colorbar=t("../scatter/colorbar"),n.hoverPoints=t("../bar/hover"),n.moduleType="trace",n.name="histogram",n.basePlotModule=t("../../plots/cartesian"),n.categories=["cartesian","bar","histogram","oriented","errorBarsOK","showLegend"],n.meta={},e.exports=n},{"../../plots/cartesian":600,"../bar/hover":673,"../bar/layout_attributes":675,"../bar/layout_defaults":676,"../bar/plot":677,"../bar/set_positions":678,"../bar/style":679,"../scatter/colorbar":753,"./attributes":718,"./calc":722,"./defaults":723}],725:[function(t,e,r){"use strict";e.exports={percent:function(t,e){for(var r=t.length,n=100/e,i=0;r>i;i++)t[i]*=n},probability:function(t,e){for(var r=t.length,n=0;r>n;n++)t[n]/=e},density:function(t,e,r,n){var i=t.length;n=n||1;for(var o=0;i>o;o++)t[o]*=r[o]*n},"probability density":function(t,e,r,n){var i=t.length;n&&(e/=n);for(var o=0;i>o;o++)t[o]*=r[o]/e}}},{}],726:[function(t,e,r){"use strict";var n=t("../histogram/attributes"),i=t("../heatmap/attributes"),o=t("../../components/colorscale/attributes"),a=t("../../lib/extend").extendFlat;e.exports=a({},{x:n.x,y:n.y,z:{valType:"data_array"},marker:{color:{valType:"data_array"}},histnorm:n.histnorm,histfunc:n.histfunc,autobinx:n.autobinx,nbinsx:n.nbinsx,xbins:n.xbins,autobiny:n.autobiny,nbinsy:n.nbinsy,ybins:n.ybins,zsmooth:i.zsmooth,_nestedModules:{colorbar:"Colorbar"}},o,{autocolorscale:a({},o.autocolorscale,{dflt:!1})})},{"../../components/colorscale/attributes":489,"../../lib/extend":563,"../heatmap/attributes":706,"../histogram/attributes":718}],727:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../plots/cartesian/axes"),o=t("../histogram/bin_functions"),a=t("../histogram/norm_functions"),s=t("../histogram/average");e.exports=function(t,e){var r,l,u,c,h,f,d=i.getFromId(t,e.xaxis||"x"),p=e.x?d.makeCalcdata(e,"x"):[],v=i.getFromId(t,e.yaxis||"y"),m=e.y?v.makeCalcdata(e,"y"):[],g=Math.min(p.length,m.length);p.length>g&&p.splice(g,p.length-g),m.length>g&&m.splice(g,m.length-g),!e.autobinx&&"xbins"in e||(e.xbins=i.autoBin(p,d,e.nbinsx,"2d"),"histogram2dcontour"===e.type&&(e.xbins.start-=e.xbins.size,e.xbins.end+=e.xbins.size),e._input.xbins=e.xbins),!e.autobiny&&"ybins"in e||(e.ybins=i.autoBin(m,v,e.nbinsy,"2d"),"histogram2dcontour"===e.type&&(e.ybins.start-=e.ybins.size,e.ybins.end+=e.ybins.size),e._input.ybins=e.ybins),h=[];var y,b,x=[],_=[],w="string"==typeof e.xbins.size?[]:e.xbins,M="string"==typeof e.xbins.size?[]:e.ybins,k=0,A=[],T=e.histnorm,E=e.histfunc,S=-1!==T.indexOf("density"),L="max"===E||"min"===E,z=L?null:0,I=o.count,P=a[T],C=!1,R=[],D=[],O="z"in e?e.z:"marker"in e&&Array.isArray(e.marker.color)?e.marker.color:"";O&&"count"!==E&&(C="avg"===E,I=o[E]);var F=e.xbins,j=F.end+(F.start-i.tickIncrement(F.start,F.size))/1e6;for(f=F.start;j>f;f=i.tickIncrement(f,F.size))x.push(z),Array.isArray(w)&&w.push(f),C&&_.push(0);Array.isArray(w)&&w.push(f);var N=x.length;for(r=e.xbins.start,l=(f-r)/N,r+=l/2,F=e.ybins,j=F.end+(F.start-i.tickIncrement(F.start,F.size))/1e6,f=F.start;j>f;f=i.tickIncrement(f,F.size))h.push(x.concat()),Array.isArray(M)&&M.push(f),C&&A.push(_.concat());Array.isArray(M)&&M.push(f);var B=h.length;for(u=e.ybins.start,c=(f-u)/B,u+=c/2,S&&(R=x.map(function(t,e){return Array.isArray(w)?1/(w[e+1]-w[e]):1/l}),D=h.map(function(t,e){return Array.isArray(M)?1/(M[e+1]-M[e]):1/c})),f=0;g>f;f++)y=n.findBin(p[f],w),b=n.findBin(m[f],M),y>=0&&N>y&&b>=0&&B>b&&(k+=I(y,f,h[b],O,A[b]));if(C)for(b=0;B>b;b++)k+=s(h[b],A[b]);if(P)for(b=0;B>b;b++)P(h[b],k,R,D[b]);return{x:p,x0:r,dx:l,y:m,y0:u,dy:c,z:h}}},{"../../lib":568,"../../plots/cartesian/axes":592,"../histogram/average":719,"../histogram/bin_functions":721,"../histogram/norm_functions":725}],728:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("./sample_defaults"),o=t("../../components/colorscale/defaults"),a=t("./attributes");e.exports=function(t,e,r){function s(r,i){return n.coerce(t,e,a,r,i)}i(t,e,s),s("zsmooth"),o(t,e,r,s,{prefix:"",cLetter:"z"})}},{"../../components/colorscale/defaults":493,"../../lib":568,"./attributes":726,"./sample_defaults":730}],729:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.calc=t("../heatmap/calc"),n.plot=t("../heatmap/plot"),n.colorbar=t("../heatmap/colorbar"),n.style=t("../heatmap/style"),n.hoverPoints=t("../heatmap/hover"),n.moduleType="trace",n.name="histogram2d",n.basePlotModule=t("../../plots/cartesian"),n.categories=["cartesian","2dMap","histogram"],n.meta={},e.exports=n},{"../../plots/cartesian":600,"../heatmap/calc":707,"../heatmap/colorbar":708,"../heatmap/hover":712,"../heatmap/plot":715,"../heatmap/style":716,"./attributes":726,"./defaults":728}],730:[function(t,e,r){"use strict";var n=t("../histogram/bin_defaults");e.exports=function(t,e,r){var i=r("x"),o=r("y");if(!(i&&i.length&&o&&o.length))return void(e.visible=!1);var a=r("z")||r("marker.color");a&&r("histfunc");var s=["x","y"];n(t,e,r,s)}},{"../histogram/bin_defaults":720}],731:[function(t,e,r){"use strict";var n=t("../histogram2d/attributes"),i=t("../contour/attributes"),o=t("../../components/colorscale/attributes"),a=t("../../lib/extend").extendFlat;e.exports=a({},{x:n.x,y:n.y,z:n.z,marker:n.marker,histnorm:n.histnorm,histfunc:n.histfunc,autobinx:n.autobinx,nbinsx:n.nbinsx,xbins:n.xbins,autobiny:n.autobiny,nbinsy:n.nbinsy,ybins:n.ybins,autocontour:i.autocontour,ncontours:i.ncontours,contours:i.contours,line:i.line,_nestedModules:{colorbar:"Colorbar"}},o)},{"../../components/colorscale/attributes":489,"../../lib/extend":563,"../contour/attributes":696,"../histogram2d/attributes":726}],732:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../histogram2d/sample_defaults"),o=t("../contour/style_defaults"),a=t("./attributes");e.exports=function(t,e,r,s){function l(r,i){return n.coerce(t,e,a,r,i)}i(t,e,l);var u=n.coerce2(t,e,a,"contours.start"),c=n.coerce2(t,e,a,"contours.end"),h=l("autocontour",!(u&&c));l(h?"ncontours":"contours.size"),o(t,e,l,s)}},{"../../lib":568,"../contour/style_defaults":705,"../histogram2d/sample_defaults":730,"./attributes":731}],733:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.calc=t("../contour/calc"),n.plot=t("../contour/plot"),n.style=t("../contour/style"),n.colorbar=t("../contour/colorbar"),n.hoverPoints=t("../contour/hover"),n.moduleType="trace",n.name="histogram2dcontour",n.basePlotModule=t("../../plots/cartesian"),n.categories=["cartesian","2dMap","contour","histogram"],n.meta={},e.exports=n},{"../../plots/cartesian":600,"../contour/calc":697,"../contour/colorbar":698,"../contour/hover":700,"../contour/plot":703,"../contour/style":704,"./attributes":731,"./defaults":732}],734:[function(t,e,r){"use strict";var n=t("../../components/colorscale/attributes"),i=t("../surface/attributes"),o=t("../../lib/extend").extendFlat;e.exports={x:{valType:"data_array"},y:{valType:"data_array"},z:{valType:"data_array"},i:{valType:"data_array"},j:{valType:"data_array"},k:{valType:"data_array"},delaunayaxis:{valType:"enumerated",values:["x","y","z"],dflt:"z"},alphahull:{valType:"number",dflt:-1},intensity:{valType:"data_array"},color:{valType:"color"},vertexcolor:{valType:"data_array"},facecolor:{valType:"data_array"},opacity:o({},i.opacity),flatshading:{valType:"boolean",dflt:!1},contour:{show:o({},i.contours.x.show,{}),color:o({},i.contours.x.color),width:o({},i.contours.x.width)},colorscale:n.colorscale,reversescale:n.reversescale,showscale:n.showscale,lightposition:{x:o({},i.lightposition.x,{dflt:1e5}),y:o({},i.lightposition.y,{dflt:1e5}),z:o({},i.lightposition.z,{dflt:0})},lighting:o({},{vertexnormalsepsilon:{valType:"number",min:0,max:1,dflt:1e-12},facenormalsepsilon:{valType:"number",min:0,max:1,dflt:1e-6}},i.lighting),_nestedModules:{colorbar:"Colorbar"}}},{"../../components/colorscale/attributes":489,"../../lib/extend":563,"../surface/attributes":802}],735:[function(t,e,r){"use strict";function n(t,e,r){this.scene=t,this.uid=r,this.mesh=e,this.name="",this.color="#fff",this.data=null,this.showContour=!1}function i(t){return t.map(function(t){var e=t[0],r=u(t[1]),n=r.toRgb();return{index:e,rgb:[n.r,n.g,n.b,1]}})}function o(t){return t.map(d)}function a(t,e,r){for(var n=new Array(t.length),i=0;i<t.length;++i)n[i]=[t[i],e[i],r[i]];return n}function s(t,e){var r=t.glplot.gl,i=l({gl:r}),o=new n(t,i,e.uid);return o.update(e),t.glplot.add(i),o}var l=t("gl-mesh3d"),u=t("tinycolor2"),c=t("delaunay-triangulate"),h=t("alpha-shape"),f=t("convex-hull"),d=t("../../lib/str2rgbarray"),p=n.prototype;p.handlePick=function(t){if(t.object===this.mesh){var e=t.data.index;return t.traceCoordinate=[this.data.x[e],this.data.y[e],this.data.z[e]],!0}},p.update=function(t){function e(t,e,r){return e.map(function(e){return t.d2l(e)*r})}var r=this.scene,n=r.fullSceneLayout;this.data=t;var s,l=a(e(n.xaxis,t.x,r.dataScale[0]),e(n.yaxis,t.y,r.dataScale[1]),e(n.zaxis,t.z,r.dataScale[2]));if(t.i&&t.j&&t.k)s=a(t.i,t.j,t.k);else if(0===t.alphahull)s=f(l);else if(t.alphahull>0)s=h(t.alphahull,l);else{var u=["x","y","z"].indexOf(t.delaunayaxis);s=c(l.map(function(t){return[t[(u+1)%3],t[(u+2)%3]]}))}var p={positions:l,cells:s,lightPosition:[t.lightposition.x,t.lightposition.y,t.lightposition.z],ambient:t.lighting.ambient,diffuse:t.lighting.diffuse,specular:t.lighting.specular,roughness:t.lighting.roughness,fresnel:t.lighting.fresnel,vertexNormalsEpsilon:t.lighting.vertexnormalsepsilon,faceNormalsEpsilon:t.lighting.facenormalsepsilon,opacity:t.opacity,contourEnable:t.contour.show,contourColor:d(t.contour.color).slice(0,3),contourWidth:t.contour.width,useFacetNormals:t.flatshading};t.intensity?(this.color="#fff",p.vertexIntensity=t.intensity,p.colormap=i(t.colorscale)):t.vertexcolor?(this.color=t.vertexcolors[0],p.vertexColors=o(t.vertexcolor)):t.facecolor?(this.color=t.facecolor[0],p.cellColors=o(t.facecolor)):(this.color=t.color,p.meshColor=d(t.color)),this.mesh.update(p)},p.dispose=function(){this.scene.glplot.remove(this.mesh),this.mesh.dispose()},e.exports=s},{"../../lib/str2rgbarray":580,"alpha-shape":41,"convex-hull":108,"delaunay-triangulate":120,"gl-mesh3d":156,tinycolor2:454}],736:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../components/colorbar/defaults"),o=t("./attributes");e.exports=function(t,e,r,a){function s(r,i){return n.coerce(t,e,o,r,i)}function l(t){var e=t.map(function(t){var e=s(t);return e&&Array.isArray(e)?e:null});return e.every(function(t){return t&&t.length===e[0].length})&&e}var u=l(["x","y","z"]),c=l(["i","j","k"]);return u?(c&&c.forEach(function(t){for(var e=0;e<t.length;++e)t[e]|=0}),["lighting.ambient","lighting.diffuse","lighting.specular","lighting.roughness","lighting.fresnel","lighting.vertexnormalsepsilon","lighting.facenormalsepsilon","lightposition.x","lightposition.y","lightposition.z","contour.show","contour.color","contour.width","colorscale","reversescale","flatshading","alphahull","delaunayaxis","opacity"].forEach(function(t){s(t)}),"intensity"in t?(s("intensity"),s("showscale",!0)):(e.showscale=!1,"vertexcolor"in t?s("vertexcolor"):"facecolor"in t?s("facecolor"):s("color",r)),e.reversescale&&(e.colorscale=e.colorscale.map(function(t){return[1-t[0],t[1]]}).reverse()),void(e.showscale&&i(t,e,a))):void(e.visible=!1)}},{"../../components/colorbar/defaults":485,"../../lib":568,"./attributes":734}],737:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.colorbar=t("../heatmap/colorbar"),n.plot=t("./convert"),n.moduleType="trace",n.name="mesh3d",n.basePlotModule=t("../../plots/gl3d"),n.categories=["gl3d"],n.meta={},e.exports=n},{"../../plots/gl3d":628,"../heatmap/colorbar":708,"./attributes":734,"./convert":735,"./defaults":736}],738:[function(t,e,r){"use strict";var n=t("../../components/color/attributes"),i=t("../../plots/font_attributes"),o=t("../../plots/attributes"),a=t("../../lib/extend").extendFlat;e.exports={labels:{valType:"data_array"},label0:{valType:"number",dflt:0},dlabel:{valType:"number",dflt:1},values:{valType:"data_array"},marker:{colors:{valType:"data_array"},line:{color:{valType:"color",dflt:n.defaultLine,arrayOk:!0},width:{valType:"number",min:0,dflt:0,arrayOk:!0}}},text:{valType:"data_array"},scalegroup:{valType:"string",dflt:""},textinfo:{valType:"flaglist",flags:["label","text","value","percent"],extras:["none"]},hoverinfo:a({},o.hoverinfo,{flags:["label","text","value","percent","name"]}),textposition:{valType:"enumerated",values:["inside","outside","auto","none"],dflt:"auto",arrayOk:!0},textfont:a({},i,{}),insidetextfont:a({},i,{}),outsidetextfont:a({},i,{}),domain:{x:{valType:"info_array",items:[{valType:"number",min:0,max:1},{valType:"number",min:0,max:1}],dflt:[0,1]},y:{valType:"info_array",items:[{valType:"number",min:0,max:1},{valType:"number",min:0,max:1}],dflt:[0,1]}},hole:{valType:"number",min:0,max:1,dflt:0},sort:{valType:"boolean",dflt:!0},direction:{valType:"enumerated",values:["clockwise","counterclockwise"],dflt:"counterclockwise"},rotation:{valType:"number",min:-360,max:360,dflt:0},pull:{valType:"number",min:0,max:1,dflt:0,arrayOk:!0}}},{"../../components/color/attributes":482,"../../lib/extend":563,"../../plots/attributes":590,"../../plots/font_attributes":610}],739:[function(t,e,r){"use strict";function n(t,e){for(var r=[],n=0;n<t.length;n++){var i=t[n],o=i[0].trace;o._module===e&&o.visible===!0&&r.push(i)}return r}var i=t("../../plots/plots");r.name="pie",r.plot=function(t){var e=i.getModule("pie"),r=n(t.calcdata,e);r.length&&e.plot(t,r)},r.clean=function(t,e,r,n){var i=n._has&&n._has("pie"),o=e._has&&e._has("pie");i&&!o&&n._pielayer.selectAll("g.trace").remove()}},{"../../plots/plots":648}],740:[function(t,e,r){"use strict";function n(t){if(!l){var e=a.defaults;l=e.slice();var r;for(r=0;r<e.length;r++)l.push(o(e[r]).lighten(20).toHexString());for(r=0;r<a.defaults.length;r++)l.push(o(e[r]).darken(20).toHexString())}return l[t%l.length]}var i=t("fast-isnumeric"),o=t("tinycolor2"),a=t("../../components/color"),s=t("./helpers");e.exports=function(t,e){var r,l,u,c,h,f,d=e.values,p=e.labels,v=[],m=t._fullLayout,g=m._piecolormap,y={},b=!1,x=0,_=m.hiddenlabels||[];if(e.dlabel)for(p=new Array(d.length),r=0;r<d.length;r++)p[r]=String(e.label0+r*e.dlabel);for(r=0;r<d.length;r++)l=d[r],i(l)&&(l=+l,0>l||(u=p[r],void 0!==u&&""!==u||(u=r),u=String(u),void 0===y[u]&&(y[u]=!0,c=o(e.marker.colors[r]),c.isValid()?(c=a.addOpacity(c,c.getAlpha()),g[u]||(g[u]=c)):g[u]?c=g[u]:(c=!1,b=!0),h=-1!==_.indexOf(u),h||(x+=l),v.push({v:l,label:u,color:c,i:r,hidden:h}))));if(e.sort&&v.sort(function(t,e){return e.v-t.v}),b)for(r=0;r<v.length;r++)f=v[r],f.color===!1&&(g[f.label]=f.color=n(m._piedefaultcolorcount),m._piedefaultcolorcount++);if(v[0]&&(v[0].vTotal=x),e.textinfo&&"none"!==e.textinfo){var w,M=-1!==e.textinfo.indexOf("label"),k=-1!==e.textinfo.indexOf("text"),A=-1!==e.textinfo.indexOf("value"),T=-1!==e.textinfo.indexOf("percent"),E=m.separators;for(r=0;r<v.length;r++)f=v[r],w=M?[f.label]:[],k&&e.text[f.i]&&w.push(e.text[f.i]),A&&w.push(s.formatPieValue(f.v,E)),T&&w.push(s.formatPiePercent(f.v/x,E)),f.text=w.join("<br>")}return v};var l},{"../../components/color":483,"./helpers":742,"fast-isnumeric":123,tinycolor2:454}],741:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("./attributes");e.exports=function(t,e,r,o){function a(r,o){return n.coerce(t,e,i,r,o)}var s=n.coerceFont,l=a("values");if(!Array.isArray(l)||!l.length)return void(e.visible=!1);var u=a("labels");Array.isArray(u)||(a("label0"),a("dlabel"));var c=a("marker.line.width");c&&a("marker.line.color");var h=a("marker.colors");Array.isArray(h)||(e.marker.colors=[]),a("scalegroup");var f=a("text"),d=a("textinfo",Array.isArray(f)?"text+percent":"percent");if(a("hoverinfo",1===o._dataLength?"label+text+value+percent":void 0),d&&"none"!==d){var p=a("textposition"),v=Array.isArray(p)||"auto"===p,m=v||"inside"===p,g=v||"outside"===p;if(m||g){var y=s(a,"textfont",o.font);m&&s(a,"insidetextfont",y),g&&s(a,"outsidetextfont",y)}}a("domain.x"),a("domain.y"),a("hole"),a("sort"),a("direction"),a("rotation"),a("pull")}},{"../../lib":568,"./attributes":738}],742:[function(t,e,r){"use strict";var n=t("../../lib");r.formatPiePercent=function(t,e){var r=(100*t).toPrecision(3);return-1!==r.lastIndexOf(".")&&(r=r.replace(/[.]?0+$/,"")),n.numSeparate(r,e)+"%"},r.formatPieValue=function(t,e){var r=t.toPrecision(10);return-1!==r.lastIndexOf(".")&&(r=r.replace(/[.]?0+$/,"")),n.numSeparate(r,e)}},{"../../lib":568}],743:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.supplyLayoutDefaults=t("./layout_defaults"),n.layoutAttributes=t("./layout_attributes"),n.calc=t("./calc"),n.plot=t("./plot"),n.style=t("./style"),n.styleOne=t("./style_one"),n.moduleType="trace",n.name="pie",n.basePlotModule=t("./base_plot"),n.categories=["pie","showLegend"],n.meta={},e.exports=n},{"./attributes":738,"./base_plot":739,"./calc":740,"./defaults":741,"./layout_attributes":744,"./layout_defaults":745,"./plot":746,"./style":747,"./style_one":748}],744:[function(t,e,r){"use strict";e.exports={hiddenlabels:{valType:"data_array"}}},{}],745:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("./layout_attributes");e.exports=function(t,e){function r(r,o){return n.coerce(t,e,i,r,o)}r("hiddenlabels")}},{"../../lib":568,"./layout_attributes":744}],746:[function(t,e,r){"use strict";function n(t,e,r){var n=Math.sqrt(t.width*t.width+t.height*t.height),o=t.width/t.height,a=Math.PI*Math.min(e.v/r.vTotal,.5),s=1-r.trace.hole,l=i(e,r),u={scale:l*r.r*2/n,rCenter:1-l,rotate:0};if(u.scale>=1)return u;var c=o+1/(2*Math.tan(a)),h=r.r*Math.min(1/(Math.sqrt(c*c+.5)+c),s/(Math.sqrt(o*o+s/2)+o)),f={scale:2*h/t.height,rCenter:Math.cos(h/r.r)-h*o/r.r,rotate:(180/Math.PI*e.midangle+720)%180-90},d=1/o,p=d+1/(2*Math.tan(a)),v=r.r*Math.min(1/(Math.sqrt(p*p+.5)+p),s/(Math.sqrt(d*d+s/2)+d)),m={scale:2*v/t.width,rCenter:Math.cos(v/r.r)-v/o/r.r,rotate:(180/Math.PI*e.midangle+810)%180-90},g=m.scale>f.scale?m:f;return u.scale<1&&g.scale>u.scale?g:u}function i(t,e){if(t.v===e.vTotal&&!e.trace.hole)return 1;var r=Math.PI*Math.min(t.v/e.vTotal,.5);return Math.min(1/(1+1/Math.sin(r)),(1-e.trace.hole)/2)}function o(t,e){var r=e.pxmid[0],n=e.pxmid[1],i=t.width/2,o=t.height/2;return 0>r&&(i*=-1),0>n&&(o*=-1),{scale:1,rCenter:1,rotate:0,x:i+Math.abs(o)*(i>0?1:-1)/2,y:o/(1+r*r/(n*n)),outside:!0}}function a(t,e){function r(t,e){return t.pxmid[1]-e.pxmid[1]}function n(t,e){return e.pxmid[1]-t.pxmid[1]}function i(t,r){r||(r={});var n,i,o,s,f,d,v=r.labelExtraY+(a?r.yLabelMax:r.yLabelMin),m=a?t.yLabelMin:t.yLabelMax,g=a?t.yLabelMax:t.yLabelMin,y=t.cyFinal+u(t.px0[1],t.px1[1]),b=v-m;if(b*h>0&&(t.labelExtraY=b),Array.isArray(e.pull))for(i=0;i<p.length;i++)o=p[i],o===t||(e.pull[t.i]||0)>=e.pull[o.i]||((t.pxmid[1]-o.pxmid[1])*h>0?(s=o.cyFinal+u(o.px0[1],o.px1[1]),b=s-m-t.labelExtraY,b*h>0&&(t.labelExtraY+=b)):(g+t.labelExtraY-y)*h>0&&(n=3*c*Math.abs(i-p.indexOf(t)),f=o.cxFinal+l(o.px0[0],o.px1[0]),d=f+n-(t.cxFinal+t.pxmid[0])-t.labelExtraX,d*c>0&&(t.labelExtraX+=d)))}var o,a,s,l,u,c,h,f,d,p,v,m,g;for(a=0;2>a;a++)for(s=a?r:n,u=a?Math.max:Math.min,h=a?1:-1,o=0;2>o;o++){for(l=o?Math.max:Math.min,c=o?1:-1,f=t[a][o],f.sort(s),d=t[1-a][o],p=d.concat(f),m=[],v=0;v<f.length;v++)void 0!==f[v].yLabelMid&&m.push(f[v]);for(g=!1,v=0;a&&v<d.length;v++)if(void 0!==d[v].yLabelMid){g=d[v];break}for(v=0;v<m.length;v++){var y=v&&m[v-1];g&&!v&&(y=g),i(m[v],y)}}}function s(t,e){var r,n,i,o,a,s,l,c,h,f,d=[];for(i=0;i<t.length;i++){if(a=t[i][0],s=a.trace,r=e.w*(s.domain.x[1]-s.domain.x[0]),n=e.h*(s.domain.y[1]-s.domain.y[0]),l=s.tiltaxis*Math.PI/180,c=s.pull,Array.isArray(c))for(c=0,o=0;o<s.pull.length;o++)s.pull[o]>c&&(c=s.pull[o]);a.r=Math.min(r/u(s.tilt,Math.sin(l),s.depth),n/u(s.tilt,Math.cos(l),s.depth))/(2+2*c),a.cx=e.l+e.w*(s.domain.x[1]+s.domain.x[0])/2,a.cy=e.t+e.h*(2-s.domain.y[1]-s.domain.y[0])/2,s.scalegroup&&-1===d.indexOf(s.scalegroup)&&d.push(s.scalegroup)}for(o=0;o<d.length;o++){for(f=1/0,h=d[o],i=0;i<t.length;i++)a=t[i][0],a.trace.scalegroup===h&&(f=Math.min(f,a.r*a.r/a.vTotal));for(i=0;i<t.length;i++)a=t[i][0],a.trace.scalegroup===h&&(a.r=Math.sqrt(f*a.vTotal))}}function l(t){function e(t){var e=h.r*Math.sin(t),r=-h.r*Math.cos(t);return d?[e*(1-s*n*n)+r*a*s,e*a*s+r*(1-s*i*i),Math.sin(o)*(r*i-e*n)]:[e,r]}var r,n,i,o,a,s,l,u,c,h=t[0],f=h.trace,d=f.tilt,p=f.rotation*Math.PI/180,v=2*Math.PI/h.vTotal,m="px0",g="px1";if("counterclockwise"===f.direction){for(l=0;l<t.length&&t[l].hidden;l++);if(l===t.length)return;p+=v*t[l].v,v*=-1,m="px1",g="px0"}for(d&&(o=d*Math.PI/180,r=f.tiltaxis*Math.PI/180,a=Math.sin(r)*Math.cos(r),s=1-Math.cos(o),n=Math.sin(r),i=Math.cos(r)),c=e(p),l=0;l<t.length;l++)u=t[l],u.hidden||(u[m]=c,p+=v*u.v/2,u.pxmid=e(p),u.midangle=p,p+=v*u.v/2,c=e(p),u[g]=c,u.largeArc=u.v>h.vTotal/2?1:0)}function u(t,e,r){if(!t)return 1;var n=Math.sin(t*Math.PI/180);return Math.max(.01,r*n*Math.abs(e)+2*Math.sqrt(1-n*n*e*e))}var c=t("d3"),h=t("../../plots/cartesian/graph_interact"),f=t("../../components/color"),d=t("../../components/drawing"),p=t("../../lib/svg_text_utils"),v=t("./helpers");e.exports=function(t,e){var r=t._fullLayout;s(e,r._size);var u=r._pielayer.selectAll("g.trace").data(e);u.enter().append("g").attr({"stroke-linejoin":"round","class":"trace"}),u.exit().remove(),u.order(),u.each(function(e){var s=c.select(this),u=e[0],m=u.trace,g=0,y=(m.depth||0)*u.r*Math.sin(g)/2,b=m.tiltaxis||0,x=b*Math.PI/180,_=[y*Math.sin(x),y*Math.cos(x)],w=u.r*Math.cos(g),M=s.selectAll("g.part").data(m.tilt?["top","sides"]:["top"]);M.enter().append("g").attr("class",function(t){return t+" part"}),M.exit().remove(),M.order(),l(e),s.selectAll(".top").each(function(){var s=c.select(this).selectAll("g.slice").data(e);s.enter().append("g").classed("slice",!0),s.exit().remove();var l=[[[],[]],[[],[]]],g=!1;s.each(function(a){function s(e){var n=t._fullLayout,o=t._fullData[m.index],s=o.hoverinfo;if("all"===s&&(s="label+text+value+percent+name"),!t._dragging&&n.hovermode!==!1&&"none"!==s&&s){var l=i(a,u),c=M+a.pxmid[0]*(1-l),f=k+a.pxmid[1]*(1-l),d=r.separators,p=[];-1!==s.indexOf("label")&&p.push(a.label),o.text&&o.text[a.i]&&-1!==s.indexOf("text")&&p.push(o.text[a.i]),-1!==s.indexOf("value")&&p.push(v.formatPieValue(a.v,d)),-1!==s.indexOf("percent")&&p.push(v.formatPiePercent(a.v/u.vTotal,d)),h.loneHover({x0:c-l*u.r,x1:c+l*u.r,y:f,text:p.join("<br>"),name:-1!==s.indexOf("name")?o.name:void 0,color:a.color,idealAlign:a.pxmid[0]<0?"left":"right"},{container:n._hoverlayer.node(),outerContainer:n._paper.node()}),h.hover(t,e,"pie"),E=!0}}function f(e){t.emit("plotly_unhover",{points:[e]}),E&&(h.loneUnhover(r._hoverlayer.node()),E=!1)}function y(){t._hoverdata=[a],t._hoverdata.trace=e.trace,h.click(t,{target:!0})}function x(t,e,r,n){return"a"+n*u.r+","+n*w+" "+b+" "+a.largeArc+(r?" 1 ":" 0 ")+n*(e[0]-t[0])+","+n*(e[1]-t[1])}if(a.hidden)return void c.select(this).selectAll("path,g").remove();l[a.pxmid[1]<0?0:1][a.pxmid[0]<0?0:1].push(a);var M=u.cx+_[0],k=u.cy+_[1],A=c.select(this),T=A.selectAll("path.surface").data([a]),E=!1;if(T.enter().append("path").classed("surface",!0).style({"pointer-events":"all"}),A.select("path.textline").remove(),A.on("mouseover",s).on("mouseout",f).on("click",y),m.pull){var S=+(Array.isArray(m.pull)?m.pull[a.i]:m.pull)||0;S>0&&(M+=S*a.pxmid[0],k+=S*a.pxmid[1])}a.cxFinal=M,a.cyFinal=k;var L=m.hole;if(a.v===u.vTotal){var z="M"+(M+a.px0[0])+","+(k+a.px0[1])+x(a.px0,a.pxmid,!0,1)+x(a.pxmid,a.px0,!0,1)+"Z";L?T.attr("d","M"+(M+L*a.px0[0])+","+(k+L*a.px0[1])+x(a.px0,a.pxmid,!1,L)+x(a.pxmid,a.px0,!1,L)+"Z"+z):T.attr("d",z)}else{var I=x(a.px0,a.px1,!0,1);if(L){var P=1-L;T.attr("d","M"+(M+L*a.px1[0])+","+(k+L*a.px1[1])+x(a.px1,a.px0,!1,L)+"l"+P*a.px0[0]+","+P*a.px0[1]+I+"Z")}else T.attr("d","M"+M+","+k+"l"+a.px0[0]+","+a.px0[1]+I+"Z")}var C=Array.isArray(m.textposition)?m.textposition[a.i]:m.textposition,R=A.selectAll("g.slicetext").data(a.text&&"none"!==C?[0]:[]);R.enter().append("g").classed("slicetext",!0),R.exit().remove(),R.each(function(){var t=c.select(this).selectAll("text").data([0]);t.enter().append("text").attr("data-notex",1),
t.exit().remove(),t.text(a.text).attr({"class":"slicetext",transform:"","data-bb":"","text-anchor":"middle",x:0,y:0}).call(d.font,"outside"===C?m.outsidetextfont:m.insidetextfont).call(p.convertToTspans),t.selectAll("tspan.line").attr({x:0,y:0});var e,r=d.bBox(t.node());"outside"===C?e=o(r,a):(e=n(r,a,u),"auto"===C&&e.scale<1&&(t.call(d.font,m.outsidetextfont),m.outsidetextfont.family===m.insidetextfont.family&&m.outsidetextfont.size===m.insidetextfont.size||(t.attr({"data-bb":""}),r=d.bBox(t.node())),e=o(r,a)));var i=M+a.pxmid[0]*e.rCenter+(e.x||0),s=k+a.pxmid[1]*e.rCenter+(e.y||0);e.outside&&(a.yLabelMin=s-r.height/2,a.yLabelMid=s,a.yLabelMax=s+r.height/2,a.labelExtraX=0,a.labelExtraY=0,g=!0),t.attr("transform","translate("+i+","+s+")"+(e.scale<1?"scale("+e.scale+")":"")+(e.rotate?"rotate("+e.rotate+")":"")+"translate("+-(r.left+r.right)/2+","+-(r.top+r.bottom)/2+")")})}),g&&a(l,m),s.each(function(t){if(t.labelExtraX||t.labelExtraY){var e=c.select(this),r=e.select("g.slicetext text");r.attr("transform","translate("+t.labelExtraX+","+t.labelExtraY+")"+r.attr("transform"));var n=t.cxFinal+t.pxmid[0],i=t.cyFinal+t.pxmid[1],o="M"+n+","+i,a=(t.yLabelMax-t.yLabelMin)*(t.pxmid[0]<0?-1:1)/4;if(t.labelExtraX){var s=t.labelExtraX*t.pxmid[1]/t.pxmid[0],l=t.yLabelMid+t.labelExtraY-(t.cyFinal+t.pxmid[1]);o+=Math.abs(s)>Math.abs(l)?"l"+l*t.pxmid[0]/t.pxmid[1]+","+l+"H"+(n+t.labelExtraX+a):"l"+t.labelExtraX+","+s+"v"+(l-s)+"h"+a}else o+="V"+(t.yLabelMid+t.labelExtraY)+"h"+a;e.append("path").classed("textline",!0).call(f.stroke,m.outsidetextfont.color).attr({"stroke-width":Math.min(2,m.outsidetextfont.size/8),d:o,fill:"none"})}})})}),setTimeout(function(){u.selectAll("tspan").each(function(){var t=c.select(this);t.attr("dy")&&t.attr("dy",t.attr("dy"))})},0)}},{"../../components/color":483,"../../components/drawing":506,"../../lib/svg_text_utils":581,"../../plots/cartesian/graph_interact":599,"./helpers":742,d3:119}],747:[function(t,e,r){"use strict";var n=t("d3"),i=t("./style_one");e.exports=function(t){t._fullLayout._pielayer.selectAll(".trace").each(function(t){var e=t[0],r=e.trace,o=n.select(this);o.style({opacity:r.opacity}),o.selectAll(".top path.surface").each(function(t){n.select(this).call(i,t,r)})})}},{"./style_one":748,d3:119}],748:[function(t,e,r){"use strict";var n=t("../../components/color");e.exports=function(t,e,r){var i=r.marker.line.color;Array.isArray(i)&&(i=i[e.i]||n.defaultLine);var o=r.marker.line.width||0;Array.isArray(o)&&(o=o[e.i]||0),t.style({"stroke-width":o,fill:e.color}).call(n.stroke,i)}},{"../../components/color":483}],749:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function(t){var e=t[0].trace,r=e.marker;if(n.mergeArray(e.text,t,"tx"),n.mergeArray(e.textposition,t,"tp"),e.textfont&&(n.mergeArray(e.textfont.size,t,"ts"),n.mergeArray(e.textfont.color,t,"tc"),n.mergeArray(e.textfont.family,t,"tf")),r&&r.line){var i=r.line;n.mergeArray(r.opacity,t,"mo"),n.mergeArray(r.symbol,t,"mx"),n.mergeArray(r.color,t,"mc"),n.mergeArray(i.color,t,"mlc"),n.mergeArray(i.width,t,"mlw")}}},{"../../lib":568}],750:[function(t,e,r){"use strict";var n=t("../../components/colorscale/color_attributes"),i=t("../../components/drawing"),o=(t("./constants"),t("../../lib/extend").extendFlat);e.exports={x:{valType:"data_array"},x0:{valType:"any",dflt:0},dx:{valType:"number",dflt:1},y:{valType:"data_array"},y0:{valType:"any",dflt:0},dy:{valType:"number",dflt:1},text:{valType:"string",dflt:"",arrayOk:!0},mode:{valType:"flaglist",flags:["lines","markers","text"],extras:["none"]},hoveron:{valType:"flaglist",flags:["points","fills"]},line:{color:{valType:"color"},width:{valType:"number",min:0,dflt:2},shape:{valType:"enumerated",values:["linear","spline","hv","vh","hvh","vhv"],dflt:"linear"},smoothing:{valType:"number",min:0,max:1.3,dflt:1},dash:{valType:"string",values:["solid","dot","dash","longdash","dashdot","longdashdot"],dflt:"solid"}},connectgaps:{valType:"boolean",dflt:!1},fill:{valType:"enumerated",values:["none","tozeroy","tozerox","tonexty","tonextx","toself","tonext"],dflt:"none"},fillcolor:{valType:"color"},marker:o({},{symbol:{valType:"enumerated",values:i.symbolList,dflt:"circle",arrayOk:!0},opacity:{valType:"number",min:0,max:1,arrayOk:!0},size:{valType:"number",min:0,dflt:6,arrayOk:!0},maxdisplayed:{valType:"number",min:0,dflt:0},sizeref:{valType:"number",dflt:1},sizemin:{valType:"number",min:0,dflt:0},sizemode:{valType:"enumerated",values:["diameter","area"],dflt:"diameter"},showscale:{valType:"boolean",dflt:!1},line:o({},{width:{valType:"number",min:0,arrayOk:!0}},n("marker.line"))},n("marker")),textposition:{valType:"enumerated",values:["top left","top center","top right","middle left","middle center","middle right","bottom left","bottom center","bottom right"],dflt:"middle center",arrayOk:!0},textfont:{family:{valType:"string",noBlank:!0,strict:!0,arrayOk:!0},size:{valType:"number",min:1,arrayOk:!0},color:{valType:"color",arrayOk:!0}},r:{valType:"data_array"},t:{valType:"data_array"},_nestedModules:{error_y:"ErrorBars",error_x:"ErrorBars","marker.colorbar":"Colorbar"}}},{"../../components/colorscale/color_attributes":491,"../../components/drawing":506,"../../lib/extend":563,"./constants":755}],751:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../plots/cartesian/axes"),o=t("../../lib"),a=t("./subtypes"),s=t("./colorscale_calc");e.exports=function(t,e){var r,l,u,c=i.getFromId(t,e.xaxis||"x"),h=i.getFromId(t,e.yaxis||"y"),f=c.makeCalcdata(e,"x"),d=h.makeCalcdata(e,"y"),p=Math.min(f.length,d.length);c._minDtick=0,h._minDtick=0,f.length>p&&f.splice(p,f.length-p),d.length>p&&d.splice(p,d.length-p);var v={padded:!0},m={padded:!0};if(a.hasMarkers(e)){if(r=e.marker,l=r.size,Array.isArray(l)){var g={type:"linear"};i.setConvert(g),l=g.makeCalcdata(e.marker,"size"),l.length>p&&l.splice(p,l.length-p)}var y,b=1.6*(e.marker.sizeref||1);y="area"===e.marker.sizemode?function(t){return Math.max(Math.sqrt((t||0)/b),3)}:function(t){return Math.max((t||0)/b,3)},v.ppad=m.ppad=Array.isArray(l)?l.map(y):y(l)}s(e),!("tozerox"===e.fill||"tonextx"===e.fill&&t.firstscatter)||f[0]===f[p-1]&&d[0]===d[p-1]?e.error_y.visible||-1===["tonexty","tozeroy"].indexOf(e.fill)&&(a.hasMarkers(e)||a.hasText(e))||(v.padded=!1,v.ppad=0):v.tozero=!0,!("tozeroy"===e.fill||"tonexty"===e.fill&&t.firstscatter)||f[0]===f[p-1]&&d[0]===d[p-1]?-1!==["tonextx","tozerox"].indexOf(e.fill)&&(m.padded=!1):m.tozero=!0,i.expand(c,f,v),i.expand(h,d,m);var x=new Array(p);for(u=0;p>u;u++)x[u]=n(f[u])&&n(d[u])?{x:f[u],y:d[u]}:{x:!1,y:!1};return void 0!==typeof l&&o.mergeArray(l,x,"ms"),t.firstscatter=!1,x}},{"../../lib":568,"../../plots/cartesian/axes":592,"./colorscale_calc":754,"./subtypes":769,"fast-isnumeric":123}],752:[function(t,e,r){"use strict";e.exports=function(t){var e,r,n,i,o;for(e=0;e<t.length;e++)if(r=t[e],n=r.fill,"none"!==n&&"scatter"===r.type&&(r.opacity=void 0,"tonexty"===n||"tonextx"===n))for(i=e-1;i>=0;i--)if(o=t[i],"scatter"===o.type&&o.xaxis===r.xaxis&&o.yaxis===r.yaxis){o.opacity=void 0;break}}},{}],753:[function(t,e,r){"use strict";var n=t("d3"),i=t("fast-isnumeric"),o=t("../../lib"),a=t("../../plots/plots"),s=t("../../components/colorscale/get_scale"),l=t("../../components/colorbar/draw");e.exports=function(t,e){var r=e[0].trace,u=r.marker,c="cb"+r.uid;if(t._fullLayout._infolayer.selectAll("."+c).remove(),void 0===u||!u.showscale)return void a.autoMargin(t,c);var h=s(u.colorscale),f=u.color,d=u.cmin,p=u.cmax;i(d)||(d=o.aggNums(Math.min,null,f)),i(p)||(p=o.aggNums(Math.max,null,f));var v=e[0].t.cb=l(t,c);v.fillcolor(n.scale.linear().domain(h.map(function(t){return d+t[0]*(p-d)})).range(h.map(function(t){return t[1]}))).filllevels({start:d,end:p,size:(p-d)/254}).options(u.colorbar)()}},{"../../components/colorbar/draw":486,"../../components/colorscale/get_scale":495,"../../lib":568,"../../plots/plots":648,d3:119,"fast-isnumeric":123}],754:[function(t,e,r){"use strict";var n=t("../../components/colorscale/has_colorscale"),i=t("../../components/colorscale/calc"),o=t("./subtypes");e.exports=function(t){o.hasLines(t)&&n(t,"line")&&i(t,t.line.color,"line","c"),o.hasMarkers(t)&&(n(t,"marker")&&i(t,t.marker.color,"marker","c"),n(t,"marker.line")&&i(t,t.marker.line.color,"marker.line","c"))}},{"../../components/colorscale/calc":490,"../../components/colorscale/has_colorscale":496,"./subtypes":769}],755:[function(t,e,r){"use strict";e.exports={PTS_LINESONLY:20}},{}],756:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("./attributes"),o=t("./constants"),a=t("./subtypes"),s=t("./xy_defaults"),l=t("./marker_defaults"),u=t("./line_defaults"),c=t("./line_shape_defaults"),h=t("./text_defaults"),f=t("./fillcolor_defaults"),d=t("../../components/errorbars/defaults");e.exports=function(t,e,r,p){function v(r,o){return n.coerce(t,e,i,r,o)}var m=s(t,e,v),g=m<o.PTS_LINESONLY?"lines+markers":"lines";if(!m)return void(e.visible=!1);v("text"),v("mode",g),a.hasLines(e)&&(u(t,e,r,p,v),c(t,e,v),v("connectgaps")),a.hasMarkers(e)&&l(t,e,r,p,v),a.hasText(e)&&h(t,e,p,v);var y=[];(a.hasMarkers(e)||a.hasText(e))&&(v("marker.maxdisplayed"),y.push("points")),v("fill"),"none"!==e.fill&&(f(t,e,r,v),a.hasLines(e)||c(t,e,v)),"tonext"!==e.fill&&"toself"!==e.fill||y.push("fills"),v("hoveron",y.join("+")||"points"),d(t,e,r,{axis:"y"}),d(t,e,r,{axis:"x",inherit:"y"})}},{"../../components/errorbars/defaults":511,"../../lib":568,"./attributes":750,"./constants":755,"./fillcolor_defaults":757,"./line_defaults":761,"./line_shape_defaults":763,"./marker_defaults":765,"./subtypes":769,"./text_defaults":770,"./xy_defaults":771}],757:[function(t,e,r){"use strict";var n=t("../../components/color");e.exports=function(t,e,r,i){var o=!1;if(e.marker){var a=e.marker.color,s=(e.marker.line||{}).color;a&&!Array.isArray(a)?o=a:s&&!Array.isArray(s)&&(o=s)}i("fillcolor",n.addOpacity((e.line||{}).color||o||r,.5))}},{"../../components/color":483}],758:[function(t,e,r){"use strict";var n=t("../../components/color"),i=t("./subtypes");e.exports=function(t,e){var r,o;if("lines"===t.mode)return r=t.line.color,r&&n.opacity(r)?r:t.fillcolor;if("none"===t.mode)return t.fill?t.fillcolor:"";var a=e.mcc||(t.marker||{}).color,s=e.mlcc||((t.marker||{}).line||{}).color;return o=a&&n.opacity(a)?a:s&&n.opacity(s)&&(e.mlw||((t.marker||{}).line||{}).width)?s:"",o?n.opacity(o)<.3?n.addOpacity(o,.3):o:(r=(t.line||{}).color,r&&n.opacity(r)&&i.hasLines(t)&&t.line.width?r:t.fillcolor)}},{"../../components/color":483,"./subtypes":769}],759:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../plots/cartesian/graph_interact"),o=t("../../plots/cartesian/constants"),a=t("../../components/errorbars"),s=t("./get_trace_color"),l=t("../../components/color");e.exports=function(t,e,r,u){var c=t.cd,h=c[0].trace,f=t.xa,d=t.ya,p=f.c2p(e),v=d.c2p(r),m=[p,v];if(-1!==h.hoveron.indexOf("points")){var g=function(t){var e=Math.max(3,t.mrc||0);return Math.max(Math.abs(f.c2p(t.x)-p)-e,1-3/e)},y=function(t){var e=Math.max(3,t.mrc||0);return Math.max(Math.abs(d.c2p(t.y)-v)-e,1-3/e)},b=function(t){var e=Math.max(3,t.mrc||0),r=f.c2p(t.x)-p,n=d.c2p(t.y)-v;return Math.max(Math.sqrt(r*r+n*n)-e,1-3/e)},x=i.getDistanceFunction(u,g,y,b);if(i.getClosest(c,x,t),t.index!==!1){var _=c[t.index],w=f.c2p(_.x,!0),M=d.c2p(_.y,!0),k=_.mrc||1;return n.extendFlat(t,{color:s(h,_),x0:w-k,x1:w+k,xLabelVal:_.x,y0:M-k,y1:M+k,yLabelVal:_.y}),_.tx?t.text=_.tx:h.text&&(t.text=h.text),a.hoverInfo(_,h,t),[t]}}if(-1!==h.hoveron.indexOf("fills")&&h._polygons){var A,T,E,S,L,z,I,P,C,R=h._polygons,D=[],O=!1,F=1/0,j=-(1/0),N=1/0,B=-(1/0);for(A=0;A<R.length;A++)E=R[A],E.contains(m)&&(O=!O,D.push(E),N=Math.min(N,E.ymin),B=Math.max(B,E.ymax));if(O){N=Math.max(N,0),B=Math.min(B,d._length);var U=(N+B)/2;for(A=0;A<D.length;A++)for(S=D[A].pts,T=1;T<S.length;T++)P=S[T-1][1],C=S[T][1],P>U!=C>=U&&(z=S[T-1][0],I=S[T][0],L=z+(I-z)*(U-P)/(C-P),F=Math.min(F,L),j=Math.max(j,L));F=Math.max(F,0),j=Math.min(j,f._length);var V=l.defaultLine;return l.opacity(h.fillcolor)?V=h.fillcolor:l.opacity((h.line||{}).color)&&(V=h.line.color),n.extendFlat(t,{distance:o.MAXDIST+10,x0:F,x1:j,y0:U,y1:U,color:V}),delete t.index,h.text&&!Array.isArray(h.text)?t.text=String(h.text):t.text=h.name,[t]}}}},{"../../components/color":483,"../../components/errorbars":512,"../../lib":568,"../../plots/cartesian/constants":597,"../../plots/cartesian/graph_interact":599,"./get_trace_color":758}],760:[function(t,e,r){"use strict";var n={},i=t("./subtypes");n.hasLines=i.hasLines,n.hasMarkers=i.hasMarkers,n.hasText=i.hasText,n.isBubble=i.isBubble,n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.cleanData=t("./clean_data"),n.calc=t("./calc"),n.arraysToCalcdata=t("./arrays_to_calcdata"),n.plot=t("./plot"),n.colorbar=t("./colorbar"),n.style=t("./style"),n.hoverPoints=t("./hover"),n.selectPoints=t("./select"),n.moduleType="trace",n.name="scatter",n.basePlotModule=t("../../plots/cartesian"),n.categories=["cartesian","symbols","markerColorscale","errorBarsOK","showLegend"],n.meta={},e.exports=n},{"../../plots/cartesian":600,"./arrays_to_calcdata":749,"./attributes":750,"./calc":751,"./clean_data":752,"./colorbar":753,"./defaults":756,"./hover":759,"./plot":766,"./select":767,"./style":768,"./subtypes":769}],761:[function(t,e,r){"use strict";var n=t("../../components/colorscale/has_colorscale"),i=t("../../components/colorscale/defaults");e.exports=function(t,e,r,o,a){var s=(t.marker||{}).color;if(a("line.color",r),n(t,"line"))i(t,e,o,a,{prefix:"line.",cLetter:"c"});else{var l=(Array.isArray(s)?!1:s)||r;a("line.color",l)}a("line.width"),a("line.dash")}},{"../../components/colorscale/defaults":493,"../../components/colorscale/has_colorscale":496}],762:[function(t,e,r){"use strict";var n=t("../../plots/cartesian/axes");e.exports=function(t,e){function r(e){var r=w.c2p(t[e].x),n=M.c2p(t[e].y);return r===S||n===S?!1:[r,n]}function i(t){var e=t[0]/w._length,r=t[1]/M._length;return(1+10*Math.max(0,-e,e-1,-r,r-1))*A}function o(t,e){var r=t[0]-e[0],n=t[1]-e[1];return Math.sqrt(r*r+n*n)}var a,s,l,u,c,h,f,d,p,v,m,g,y,b,x,_,w=e.xaxis,M=e.yaxis,k=e.connectGaps,A=e.baseTolerance,T=e.linear,E=[],S=n.BADNUM,L=.2,z=new Array(t.length),I=0;for(a=0;a<t.length;a++)if(s=r(a)){for(I=0,z[I++]=s,a++;a<t.length;a++){if(u=r(a),!u){if(k)continue;break}if(T){if(f=o(u,s),!(f<i(u)*L)){for(p=[(u[0]-s[0])/f,(u[1]-s[1])/f],c=s,m=f,g=b=x=0,d=!1,l=u,a++;a<t.length;a++){if(h=r(a),!h){if(k)continue;break}if(v=[h[0]-s[0],h[1]-s[1]],_=v[0]*p[1]-v[1]*p[0],b=Math.min(b,_),x=Math.max(x,_),x-b>i(h))break;l=h,y=v[0]*p[0]+v[1]*p[1],y>m?(m=y,u=h,d=!1):g>y&&(g=y,c=h,d=!0)}if(d?(z[I++]=u,l!==c&&(z[I++]=c)):(c!==s&&(z[I++]=c),l!==u&&(z[I++]=u)),z[I++]=l,a>=t.length||!h)break;z[I++]=h,s=h}}else z[I++]=u}E.push(z.slice(0,I))}return E}},{"../../plots/cartesian/axes":592}],763:[function(t,e,r){"use strict";e.exports=function(t,e,r){var n=r("line.shape");"spline"===n&&r("line.smoothing")}},{}],764:[function(t,e,r){"use strict";var n=t("fast-isnumeric");e.exports=function(t){var e=t.marker,r=e.sizeref||1,i=e.sizemin||0,o="area"===e.sizemode?function(t){return Math.sqrt(t/r)}:function(t){return t/r};return function(t){var e=o(t/2);return n(e)&&e>0?Math.max(e,i):0}}},{"fast-isnumeric":123}],765:[function(t,e,r){"use strict";var n=t("../../components/color"),i=t("../../components/colorscale/has_colorscale"),o=t("../../components/colorscale/defaults"),a=t("./subtypes");e.exports=function(t,e,r,s,l){var u,c=a.isBubble(t),h=(t.line||{}).color;h&&(r=h),l("marker.symbol"),l("marker.opacity",c?.7:1),l("marker.size"),l("marker.color",r),i(t,"marker")&&o(t,e,s,l,{prefix:"marker.",cLetter:"c"}),u=h&&!Array.isArray(h)&&e.marker.color!==h?h:c?n.background:n.defaultLine,l("marker.line.color",u),i(t,"marker.line")&&o(t,e,s,l,{prefix:"marker.line.",cLetter:"c"}),l("marker.line.width",c?1:0),c&&(l("marker.sizeref"),l("marker.sizemin"),l("marker.sizemode"))}},{"../../components/color":483,"../../components/colorscale/defaults":493,"../../components/colorscale/has_colorscale":496,"./subtypes":769}],766:[function(t,e,r){"use strict";function n(t,e,r){var n=e.x(),o=e.y(),a=i.extent(n.range.map(n.l2c)),s=i.extent(o.range.map(o.l2c));r.forEach(function(t,e){var n=t[0].trace;if(u.hasMarkers(n)){var i=n.marker.maxdisplayed;if(0!==i){var o=t.filter(function(t){return t.x>=a[0]&&t.x<=a[1]&&t.y>=s[0]&&t.y<=s[1]}),l=Math.ceil(o.length/i),c=0;r.forEach(function(t,r){var n=t[0].trace;u.hasMarkers(n)&&n.marker.maxdisplayed>0&&e>r&&c++});var h=Math.round(c*l/3+Math.floor(c/3)*l/7.1);t.forEach(function(t){delete t.vis}),o.forEach(function(t,e){0===Math.round((e+h)%l)&&(t.vis=!0)})}}})}var i=t("d3"),o=t("../../lib"),a=t("../../components/drawing"),s=t("../../components/errorbars"),l=t("../../lib/polygon").tester,u=t("./subtypes"),c=t("./arrays_to_calcdata"),h=t("./line_points");e.exports=function(t,e,r){function f(t){return t.filter(function(t){return t.vis})}n(t,e,r);var d=e.x(),p=e.y(),v=e.plot.select(".scatterlayer").selectAll("g.trace.scatter").data(r);v.enter().append("g").attr("class","trace scatter").style("stroke-miterlimit",2),v.call(s.plot,e);var m,g,y,b,x="",_=[];v.each(function(t){var e=t[0].trace,r=e.line,n=i.select(this);if(e.visible===!0&&(g=e.fill.charAt(e.fill.length-1),"x"!==g&&"y"!==g&&(g=""),t[0].node3=n,c(t),u.hasLines(e)||"none"!==e.fill)){var o,s,f,v,w,M="",k="";m="tozero"===e.fill.substr(0,6)||"toself"===e.fill||"to"===e.fill.substr(0,2)&&!x?n.append("path").classed("js-fill",!0):null,b&&(y=b.datum(t)),b=n.append("path").classed("js-fill",!0),-1!==["hv","vh","hvh","vhv"].indexOf(r.shape)?(f=a.steps(r.shape),v=a.steps(r.shape.split("").reverse().join(""))):f=v="spline"===r.shape?function(t){var e=t[t.length-1];return t[0][0]===e[0]&&t[0][1]===e[1]?a.smoothclosed(t.slice(1),r.smoothing):a.smoothopen(t,r.smoothing)}:function(t){return"M"+t.join("L")},w=function(t){return v(t.reverse())};var A,T=h(t,{xaxis:d,yaxis:p,connectGaps:e.connectgaps,baseTolerance:Math.max(r.width||1,3)/4,linear:"linear"===r.shape}),E=e._polygons=new Array(T.length);for(A=0;A<T.length;A++)e._polygons[A]=l(T[A]);if(T.length){var S=T[0][0],L=T[T.length-1],z=L[L.length-1];for(A=0;A<T.length;A++){var I=T[A];o=f(I),s=w(I),M?g?(M+="L"+o.substr(1),k=s+("L"+k.substr(1))):(M+="Z"+o,k=s+"Z"+k):(M=o,k=s),u.hasLines(e)&&I.length>1&&n.append("path").classed("js-line",!0).style("vector-effect","non-scaling-stroke").attr("d",o)}m?S&&z&&(g?("y"===g?S[1]=z[1]=p.c2p(0,!0):"x"===g&&(S[0]=z[0]=d.c2p(0,!0)),m.attr("d",M+"L"+z+"L"+S+"Z")):m.attr("d",M+"Z")):"tonext"===e.fill.substr(0,6)&&M&&x&&("tonext"===e.fill?y.attr("d",M+"Z"+x+"Z"):y.attr("d",M+"L"+x.substr(1)+"Z"),e._polygons=e._polygons.concat(_)),x=k,_=E}}}),v.selectAll("path:not([d])").remove(),v.append("g").attr("class","points").each(function(t){var e=t[0].trace,r=i.select(this),n=u.hasMarkers(e),s=u.hasText(e);!n&&!s||e.visible!==!0?r.remove():(n&&r.selectAll("path.point").data(e.marker.maxdisplayed?f:o.identity).enter().append("path").classed("point",!0).call(a.translatePoints,d,p),s&&r.selectAll("g").data(e.marker.maxdisplayed?f:o.identity).enter().append("g").append("text").call(a.translatePoints,d,p))})}},{"../../components/drawing":506,"../../components/errorbars":512,"../../lib":568,"../../lib/polygon":574,"./arrays_to_calcdata":749,"./line_points":762,"./subtypes":769,d3:119}],767:[function(t,e,r){"use strict";var n=t("./subtypes"),i=.2;e.exports=function(t,e){var r,o,a,s,l=t.cd,u=t.xaxis,c=t.yaxis,h=[],f=l[0].trace,d=f.index,p=f.marker,v=!n.hasMarkers(f)&&!n.hasText(f);if(f.visible===!0&&!v){var m=Array.isArray(p.opacity)?1:p.opacity;if(e===!1)for(r=0;r<l.length;r++)l[r].dim=0;else for(r=0;r<l.length;r++)o=l[r],a=u.c2p(o.x),s=c.c2p(o.y),e.contains([a,s])?(h.push({curveNumber:d,pointNumber:r,x:o.x,y:o.y}),o.dim=0):o.dim=1;return l[0].node3.selectAll("path.point").style("opacity",function(t){return((t.mo+1||m+1)-1)*(t.dim?i:1)}),l[0].node3.selectAll("text").style("opacity",function(t){return t.dim?i:1}),h}}},{"./subtypes":769}],768:[function(t,e,r){"use strict";var n=t("d3"),i=t("../../components/drawing"),o=t("../../components/errorbars");e.exports=function(t){var e=n.select(t).selectAll("g.trace.scatter");e.style("opacity",function(t){return t[0].trace.opacity}),e.selectAll("g.points").each(function(t){n.select(this).selectAll("path.point").call(i.pointStyle,t.trace||t[0].trace),n.select(this).selectAll("text").call(i.textPointStyle,t.trace||t[0].trace)}),e.selectAll("g.trace path.js-line").call(i.lineGroupStyle),e.selectAll("g.trace path.js-fill").call(i.fillGroupStyle),e.call(o.style)}},{"../../components/drawing":506,"../../components/errorbars":512,d3:119}],769:[function(t,e,r){"use strict";var n=t("../../lib");e.exports={hasLines:function(t){return t.visible&&t.mode&&-1!==t.mode.indexOf("lines")},hasMarkers:function(t){return t.visible&&t.mode&&-1!==t.mode.indexOf("markers")},hasText:function(t){return t.visible&&t.mode&&-1!==t.mode.indexOf("text")},isBubble:function(t){return n.isPlainObject(t.marker)&&Array.isArray(t.marker.size)}}},{"../../lib":568}],770:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function(t,e,r,i){i("textposition"),n.coerceFont(i,"textfont",r.font)}},{"../../lib":568}],771:[function(t,e,r){"use strict";e.exports=function(t,e,r){var n,i=r("x"),o=r("y");if(i)o?(n=Math.min(i.length,o.length),n<i.length&&(e.x=i.slice(0,n)),n<o.length&&(e.y=o.slice(0,n))):(n=i.length,r("y0"),r("dy"));else{if(!o)return 0;n=e.y.length,r("x0"),r("dx")}return n}},{}],772:[function(t,e,r){"use strict";function n(t){return{show:{valType:"boolean",dflt:!1},opacity:{valType:"number",min:0,max:1,dflt:1},scale:{valType:"number",min:0,max:10,dflt:2/3}}}var i=t("../scatter/attributes"),o=t("../../components/colorscale/color_attributes"),a=t("../../constants/gl_markers"),s=t("../../lib/extend").extendFlat,l=i.line,u=i.marker,c=u.line;e.exports={x:{valType:"data_array"},y:{valType:"data_array"},z:{valType:"data_array"},text:s({},i.text,{}),mode:s({},i.mode,{dflt:"lines+markers"}),surfaceaxis:{valType:"enumerated",values:[-1,0,1,2],dflt:-1},surfacecolor:{valType:"color"},projection:{x:n("x"),y:n("y"),z:n("z")},connectgaps:i.connectgaps,line:s({},{width:l.width,dash:l.dash,showscale:{valType:"boolean",dflt:!1}},o("line")),marker:s({},{symbol:{valType:"enumerated",values:Object.keys(a),dflt:"circle",arrayOk:!0},size:s({},u.size,{dflt:8}),sizeref:u.sizeref,sizemin:u.sizemin,sizemode:u.sizemode,opacity:s({},u.opacity,{arrayOk:!1}),showscale:u.showscale,line:s({},{width:s({},c.width,{arrayOk:!1})},o("marker.line"))},o("marker")),textposition:s({},i.textposition,{dflt:"top center"}),textfont:i.textfont,_nestedModules:{error_x:"ErrorBars",error_y:"ErrorBars",error_z:"ErrorBars","marker.colorbar":"Colorbar"}}},{"../../components/colorscale/color_attributes":491,"../../constants/gl_markers":554,"../../lib/extend":563,"../scatter/attributes":750}],773:[function(t,e,r){"use strict";var n=t("../scatter/arrays_to_calcdata"),i=t("../scatter/colorscale_calc");e.exports=function(t,e){var r=[{x:!1,y:!1,trace:e,t:{}}];return n(r),i(e),r}},{"../scatter/arrays_to_calcdata":749,"../scatter/colorscale_calc":754}],774:[function(t,e,r){"use strict";function n(t,e,r){if(!e||!e.visible)return null;for(var n=a(e),i=new Array(t.length),o=0;o<t.length;o++){var s=n(+t[o],o);i[o]=[-s[0]*r,s[1]*r]}return i}function i(t){for(var e=0;e<t.length;e++)if(t[e])return t[e].length;return 0}function o(t,e){var r=[n(t.x,t.error_x,e[0]),n(t.y,t.error_y,e[1]),n(t.z,t.error_z,e[2])],o=i(r);if(0===o)return null;for(var a=new Array(o),s=0;o>s;s++){for(var l=[[0,0,0],[0,0,0]],u=0;3>u;u++)if(r[u])for(var c=0;2>c;c++)l[c][u]=r[u][s][c];a[s]=l}return a}var a=t("../../components/errorbars/compute_error");e.exports=o},{"../../components/errorbars/compute_error":510}],775:[function(t,e,r){"use strict";function n(t,e){this.scene=t,this.uid=e,this.linePlot=null,this.scatterPlot=null,this.errorBars=null,this.textMarkers=null,this.delaunayMesh=null,this.color=null,this.mode="",this.dataPoints=[],this.axesBounds=[[-(1/0),-(1/0),-(1/0)],[1/0,1/0,1/0]],this.textLabels=null,this.data=null}function i(t,e,r){var n,i=(r+1)%3,o=(r+2)%3,a=[],s=[];for(n=0;n<t.length;++n){var l=t[n];!isNaN(l[i])&&isFinite(l[i])&&!isNaN(l[o])&&isFinite(l[o])&&(a.push([l[i],l[o]]),s.push(n))}var u=g(a);for(n=0;n<u.length;++n)for(var c=u[n],h=0;h<c.length;++h)c[h]=s[c[h]];return{positions:t,cells:u,meshColor:e}}function o(t){for(var e=[0,0,0],r=[[0,0,0],[0,0,0],[0,0,0]],n=[0,0,0],i=0;3>i;i++){var o=t[i];o&&o.copy_zstyle!==!1&&(o=t[2]),o&&(e[i]=o.width/2,r[i]=b(o.color),n=o.thickness)}return{capSize:e,color:r,lineWidth:n}}function a(t){var e=[0,0];return Array.isArray(t)?[0,-1]:(t.indexOf("bottom")>=0&&(e[1]+=1),t.indexOf("top")>=0&&(e[1]-=1),t.indexOf("left")>=0&&(e[0]-=1),t.indexOf("right")>=0&&(e[0]+=1),e)}function s(t,e){return e(4*t)}function l(t){return M[t]}function u(t,e,r,n,i){var o=null;if(Array.isArray(t)){o=[];for(var a=0;e>a;a++)void 0===t[a]?o[a]=n:o[a]=r(t[a],i)}else o=r(t,y.identity);return o}function c(t,e){var r,n,i,c,h,f,d=[],p=t.fullSceneLayout,v=t.dataScale,m=p.xaxis,g=p.yaxis,w=p.zaxis,M=e.marker,A=e.line,T=e.x||[],E=e.y||[],S=e.z||[],L=T.length;for(n=0;L>n;n++)i=m.d2l(T[n])*v[0],c=g.d2l(E[n])*v[1],h=w.d2l(S[n])*v[2],d[n]=[i,c,h];if(Array.isArray(e.text))f=e.text;else if(void 0!==e.text)for(f=new Array(L),n=0;L>n;n++)f[n]=e.text;if(r={position:d,mode:e.mode,text:f},"line"in e&&(r.lineColor=x(A,1,L),r.lineWidth=A.width,r.lineDashes=A.dash),"marker"in e){var z=_(e);r.scatterColor=x(M,1,L),r.scatterSize=u(M.size,L,s,20,z),r.scatterMarker=u(M.symbol,L,l,"\u25cf"),r.scatterLineWidth=M.line.width,r.scatterLineColor=x(M.line,1,L),r.scatterAngle=0}"textposition"in e&&(r.textOffset=a(e.textposition),r.textColor=x(e.textfont,1,L),r.textSize=u(e.textfont.size,L,y.identity,12),r.textFont=e.textfont.family,r.textAngle=0);var I=["x","y","z"];for(r.project=[!1,!1,!1],r.projectScale=[1,1,1],r.projectOpacity=[1,1,1],n=0;3>n;++n){var P=e.projection[I[n]];(r.project[n]=P.show)&&(r.projectOpacity[n]=P.opacity,r.projectScale[n]=P.scale)}r.errorBounds=k(e,v);var C=o([e.error_x,e.error_y,e.error_z]);return r.errorColor=C.color,r.errorLineWidth=C.lineWidth,r.errorCapSize=C.capSize,r.delaunayAxis=e.surfaceaxis,r.delaunayColor=b(e.surfacecolor),r}function h(t){if(Array.isArray(t)){var e=t[0];return Array.isArray(e)&&(t=e),"rgb("+t.slice(0,3).map(function(t){return Math.round(255*t)})+")"}return null}function f(t,e){var r=new n(t,e.uid);return r.update(e),r}var d=t("gl-line3d"),p=t("gl-scatter3d"),v=t("gl-error3d"),m=t("gl-mesh3d"),g=t("delaunay-triangulate"),y=t("../../lib"),b=t("../../lib/str2rgbarray"),x=t("../../lib/gl_format_color"),_=t("../scatter/make_bubble_size_func"),w=t("../../constants/gl3d_dashes"),M=t("../../constants/gl_markers"),k=t("./calc_errors"),A=n.prototype;A.handlePick=function(t){if(t.object&&(t.object===this.linePlot||t.object===this.delaunayMesh||t.object===this.textMarkers||t.object===this.scatterPlot)){t.object.highlight&&t.object.highlight(null),this.scatterPlot&&(t.object=this.scatterPlot,this.scatterPlot.highlight(t.data)),this.textLabels&&void 0!==this.textLabels[t.data.index]?t.textLabel=this.textLabels[t.data.index]:t.textLabel="";var e=t.data.index;return t.traceCoordinate=[this.data.x[e],this.data.y[e],this.data.z[e]],!0}},A.update=function(t){var e,r,n,o,a=this.scene.glplot.gl,s=w.solid;this.data=t;var l=c(this.scene,t);"mode"in l&&(this.mode=l.mode),"lineDashes"in l&&l.lineDashes in w&&(s=w[l.lineDashes]),this.color=h(l.scatterColor)||h(l.lineColor),this.dataPoints=l.position,e={gl:a,position:l.position,color:l.lineColor,lineWidth:l.lineWidth||1,dashes:s[0],dashScale:s[1],opacity:t.opacity,connectGaps:t.connectgaps},-1!==this.mode.indexOf("lines")?this.linePlot?this.linePlot.update(e):(this.linePlot=d(e),this.scene.glplot.add(this.linePlot)):this.linePlot&&(this.scene.glplot.remove(this.linePlot),this.linePlot.dispose(),this.linePlot=null);var u=t.opacity;if(t.marker&&t.marker.opacity&&(u*=t.marker.opacity),r={gl:a,position:l.position,color:l.scatterColor,size:l.scatterSize,glyph:l.scatterMarker,opacity:u,orthographic:!0,lineWidth:l.scatterLineWidth,lineColor:l.scatterLineColor,project:l.project,projectScale:l.projectScale,projectOpacity:l.projectOpacity},-1!==this.mode.indexOf("markers")?this.scatterPlot?this.scatterPlot.update(r):(this.scatterPlot=p(r),this.scatterPlot.highlightScale=1,this.scene.glplot.add(this.scatterPlot)):this.scatterPlot&&(this.scene.glplot.remove(this.scatterPlot),this.scatterPlot.dispose(),this.scatterPlot=null),o={gl:a,position:l.position,glyph:l.text,color:l.textColor,size:l.textSize,angle:l.textAngle,alignment:l.textOffset,font:l.textFont,orthographic:!0,lineWidth:0,project:!1,opacity:t.opacity},this.textLabels=l.text,-1!==this.mode.indexOf("text")?this.textMarkers?this.textMarkers.update(o):(this.textMarkers=p(o),this.textMarkers.highlightScale=1,this.scene.glplot.add(this.textMarkers)):this.textMarkers&&(this.scene.glplot.remove(this.textMarkers),this.textMarkers.dispose(),this.textMarkers=null),n={gl:a,position:l.position,color:l.errorColor,error:l.errorBounds,lineWidth:l.errorLineWidth,capSize:l.errorCapSize,opacity:t.opacity},this.errorBars?l.errorBounds?this.errorBars.update(n):(this.scene.glplot.remove(this.errorBars),this.errorBars.dispose(),this.errorBars=null):l.errorBounds&&(this.errorBars=v(n),this.scene.glplot.add(this.errorBars)),l.delaunayAxis>=0){var f=i(l.position,l.delaunayColor,l.delaunayAxis);f.opacity=t.opacity,this.delaunayMesh?this.delaunayMesh.update(f):(f.gl=a,this.delaunayMesh=m(f),this.scene.glplot.add(this.delaunayMesh))}else this.delaunayMesh&&(this.scene.glplot.remove(this.delaunayMesh),this.delaunayMesh.dispose(),this.delaunayMesh=null)},A.dispose=function(){this.linePlot&&(this.scene.glplot.remove(this.linePlot),this.linePlot.dispose()),this.scatterPlot&&(this.scene.glplot.remove(this.scatterPlot),this.scatterPlot.dispose()),this.errorBars&&(this.scene.glplot.remove(this.errorBars),this.errorBars.dispose()),this.textMarkers&&(this.scene.glplot.remove(this.textMarkers),this.textMarkers.dispose()),this.delaunayMesh&&(this.scene.glplot.remove(this.delaunayMesh),this.delaunayMesh.dispose())},e.exports=f},{"../../constants/gl3d_dashes":553,"../../constants/gl_markers":554,"../../lib":568,"../../lib/gl_format_color":566,"../../lib/str2rgbarray":580,"../scatter/make_bubble_size_func":764,"./calc_errors":774,"delaunay-triangulate":120,"gl-error3d":127,"gl-line3d":133,"gl-mesh3d":156,"gl-scatter3d":199}],776:[function(t,e,r){"use strict";function n(t,e,r){var n=0,i=r("x"),o=r("y"),a=r("z");return i&&o&&a&&(n=Math.min(i.length,o.length,a.length),n<i.length&&(e.x=i.slice(0,n)),n<o.length&&(e.y=o.slice(0,n)),n<a.length&&(e.z=a.slice(0,n))),n}var i=t("../../lib"),o=t("../scatter/subtypes"),a=t("../scatter/marker_defaults"),s=t("../scatter/line_defaults"),l=t("../scatter/text_defaults"),u=t("../../components/errorbars/defaults"),c=t("./attributes");e.exports=function(t,e,r,h){function f(r,n){return i.coerce(t,e,c,r,n)}var d=n(t,e,f);if(!d)return void(e.visible=!1);f("text"),f("mode"),o.hasLines(e)&&(f("connectgaps"),s(t,e,r,h,f)),o.hasMarkers(e)&&a(t,e,r,h,f),o.hasText(e)&&l(t,e,h,f);var p=(e.line||{}).color,v=(e.marker||{}).color;f("surfaceaxis")>=0&&f("surfacecolor",p||v);for(var m=["x","y","z"],g=0;3>g;++g){var y="projection."+m[g];f(y+".show")&&(f(y+".opacity"),f(y+".scale"))}u(t,e,r,{axis:"z"}),u(t,e,r,{axis:"y",inherit:"z"}),u(t,e,r,{axis:"x",inherit:"z"})}},{"../../components/errorbars/defaults":511,"../../lib":568,"../scatter/line_defaults":761,"../scatter/marker_defaults":765,"../scatter/subtypes":769,"../scatter/text_defaults":770,"./attributes":772}],777:[function(t,e,r){"use strict";var n={};n.plot=t("./convert"),n.attributes=t("./attributes"),n.markerSymbols=t("../../constants/gl_markers"),n.supplyDefaults=t("./defaults"),n.colorbar=t("../scatter/colorbar"),n.calc=t("./calc"),n.moduleType="trace",n.name="scatter3d",n.basePlotModule=t("../../plots/gl3d"),n.categories=["gl3d","symbols","markerColorscale","showLegend"],n.meta={},e.exports=n},{"../../constants/gl_markers":554,"../../plots/gl3d":628,
"../scatter/colorbar":753,"./attributes":772,"./calc":773,"./convert":775,"./defaults":776}],778:[function(t,e,r){"use strict";var n=t("../scatter/attributes"),i=t("../../plots/attributes"),o=t("../../components/colorscale/color_attributes"),a=t("../../lib/extend").extendFlat,s=n.marker,l=n.line,u=s.line;e.exports={lon:{valType:"data_array"},lat:{valType:"data_array"},locations:{valType:"data_array"},locationmode:{valType:"enumerated",values:["ISO-3","USA-states","country names"],dflt:"ISO-3"},mode:a({},n.mode,{dflt:"markers"}),text:a({},n.text,{}),line:{color:l.color,width:l.width,dash:l.dash},marker:a({},{symbol:s.symbol,opacity:s.opacity,size:s.size,sizeref:s.sizeref,sizemin:s.sizemin,sizemode:s.sizemode,showscale:s.showscale,line:a({},{width:u.width},o("marker.line"))},o("marker")),textfont:n.textfont,textposition:n.textposition,hoverinfo:a({},i.hoverinfo,{flags:["lon","lat","location","text","name"]}),_nestedModules:{"marker.colorbar":"Colorbar"}}},{"../../components/colorscale/color_attributes":491,"../../lib/extend":563,"../../plots/attributes":590,"../scatter/attributes":750}],779:[function(t,e,r){"use strict";var n=t("../scatter/colorscale_calc");e.exports=function(t,e){var r=[{x:!1,y:!1,trace:e,t:{}}];return n(e),r}},{"../scatter/colorscale_calc":754}],780:[function(t,e,r){"use strict";function n(t,e,r){var n,i,o=0,a=r("locations");return a?(r("locationmode"),o=a.length):(n=r("lon")||[],i=r("lat")||[],o=Math.min(n.length,i.length),o<n.length&&(e.lon=n.slice(0,o)),o<i.length&&(e.lat=i.slice(0,o)),o)}var i=t("../../lib"),o=t("../scatter/subtypes"),a=t("../scatter/marker_defaults"),s=t("../scatter/line_defaults"),l=t("../scatter/text_defaults"),u=t("./attributes");e.exports=function(t,e,r,c){function h(r,n){return i.coerce(t,e,u,r,n)}var f=n(t,e,h);return f?(h("text"),h("mode"),o.hasLines(e)&&s(t,e,r,c,h),o.hasMarkers(e)&&a(t,e,r,c,h),o.hasText(e)&&l(t,e,c,h),void h("hoverinfo",1===c._dataLength?"lon+lat+location+text":void 0)):void(e.visible=!1)}},{"../../lib":568,"../scatter/line_defaults":761,"../scatter/marker_defaults":765,"../scatter/subtypes":769,"../scatter/text_defaults":770,"./attributes":778}],781:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.colorbar=t("../scatter/colorbar"),n.calc=t("./calc"),n.plot=t("./plot").plot,n.moduleType="trace",n.name="scattergeo",n.basePlotModule=t("../../plots/geo"),n.categories=["geo","symbols","markerColorscale","showLegend"],n.meta={},e.exports=n},{"../../plots/geo":613,"../scatter/colorbar":753,"./attributes":778,"./calc":779,"./defaults":780,"./plot":782}],782:[function(t,e,r){"use strict";function n(t,e,r){function n(t,n){f(t,e,n,r)}var i=t.marker;if(n(t.text,"tx"),n(t.textposition,"tp"),t.textfont&&(n(t.textfont.size,"ts"),n(t.textfont.color,"tc"),n(t.textfont.family,"tf")),i&&i.line){var o=i.line;n(i.opacity,"mo"),n(i.symbol,"mx"),n(i.color,"mc"),n(i.size,"ms"),n(o.color,"mlc"),n(o.width,"mlw")}}function i(t){for(var e=t.lon.length,r=new Array(e),n=0;e>n;n++)r[n]=[t.lon[n],t.lat[n]];return{type:"LineString",coordinates:r,trace:t}}function o(t,e){function r(e){var r=t.mockAxis;return u.tickText(r,r.c2l(e),"hover").text+"\xb0"}var n=e.hoverinfo;if("none"===n)return function(t){delete t.textLabel};var i="all"===n?m.hoverinfo.flags:n.split("+"),o=-1!==i.indexOf("location")&&Array.isArray(e.locations),a=-1!==i.indexOf("lon"),s=-1!==i.indexOf("lat"),l=-1!==i.indexOf("text");return function(t){var n=[];o?n.push(t.location):a&&s?n.push("("+r(t.lon)+", "+r(t.lat)+")"):a?n.push("lon: "+r(t.lon)):s&&n.push("lat: "+r(t.lat)),l&&n.push(t.tx||e.text),t.textLabel=n.join("<br>")}}function a(t){var e=Array.isArray(t.locations);return function(r,n){return{points:[{data:t._input,fullData:t,curveNumber:t.index,pointNumber:n,lon:r.lon,lat:r.lat,location:e?r.location:null}]}}}var s=t("d3"),l=t("../../plots/cartesian/graph_interact"),u=t("../../plots/cartesian/axes"),c=t("../../lib/topojson_utils").getTopojsonFeatures,h=t("../../lib/geo_location_utils").locationToFeature,f=t("../../lib/array_to_calc_item"),d=t("../../components/color"),p=t("../../components/drawing"),v=t("../scatter/subtypes"),m=t("./attributes"),g=e.exports={};g.calcGeoJSON=function(t,e){var r,i,o,a,s=[],l=Array.isArray(t.locations);l?(a=t.locations,r=a.length,i=c(t,e),o=function(t,e){var r=h(t.locationmode,a[e],i);return void 0!==r?r.properties.ct:void 0}):(r=t.lon.length,o=function(t,e){return[t.lon[e],t.lat[e]]});for(var u=0;r>u;u++){var f=o(t,u);if(f){var d={lon:f[0],lat:f[1],location:l?t.locations[u]:null};n(t,d,u),s.push(d)}}return s.length>0&&(s[0].trace=t),s},g.plot=function(t,e){var r=t.framework.select(".scattergeolayer").selectAll("g.trace.scattergeo").data(e,function(t){return t.uid});r.enter().append("g").attr("class","trace scattergeo"),r.exit().remove(),r.selectAll("*").remove(),r.each(function(t){var e=s.select(this);v.hasLines(t)&&e.selectAll("path.js-line").data([i(t)]).enter().append("path").classed("js-line",!0)}),r.each(function(e){function r(r,n){if(t.showHover){var i=t.projection([r.lon,r.lat]);f(r),l.loneHover({x:i[0],y:i[1],name:m?e.name:void 0,text:r.textLabel,color:r.mc||(e.marker||{}).color},{container:t.hoverContainer.node()}),y=d(r,n),t.graphDiv.emit("plotly_hover",y)}}function n(e,r){t.graphDiv.emit("plotly_click",d(e,r))}var i=s.select(this),u=v.hasMarkers(e),c=v.hasText(e);if(u||c){var h=g.calcGeoJSON(e,t.topojson),f=o(t,e),d=a(e),p=e.hoverinfo,m="all"===p||-1!==p.indexOf("name"),y=null;u&&i.selectAll("path.point").data(h).enter().append("path").classed("point",!0).on("mouseover",r).on("click",n).on("mouseout",function(){l.loneUnhover(t.hoverContainer),t.graphDiv.emit("plotly_unhover",y)}).on("mousedown",function(){l.loneUnhover(t.hoverContainer)}).on("mouseup",r),c&&i.selectAll("g").data(h).enter().append("g").append("text")}}),g.style(t)},g.style=function(t){var e=t.framework.selectAll("g.trace.scattergeo");e.style("opacity",function(t){return t.opacity}),e.each(function(t){s.select(this).selectAll("path.point").call(p.pointStyle,t),s.select(this).selectAll("text").call(p.textPointStyle,t)}),e.selectAll("path.js-line").style("fill","none").each(function(t){var e=t.trace,r=e.line||{};s.select(this).call(d.stroke,r.color).call(p.dashLine,r.dash||"",r.width||0)})}},{"../../components/color":483,"../../components/drawing":506,"../../lib/array_to_calc_item":559,"../../lib/geo_location_utils":565,"../../lib/topojson_utils":582,"../../plots/cartesian/axes":592,"../../plots/cartesian/graph_interact":599,"../scatter/subtypes":769,"./attributes":778,d3:119}],783:[function(t,e,r){"use strict";var n=t("../scatter/attributes"),i=t("../../components/colorscale/color_attributes"),o=t("../../constants/gl2d_dashes"),a=t("../../constants/gl_markers"),s=t("../../lib/extend").extendFlat,l=t("../../lib/extend").extendDeep,u=n.line,c=n.marker,h=c.line;e.exports={x:n.x,x0:n.x0,dx:n.dx,y:n.y,y0:n.y0,dy:n.dy,text:s({},n.text,{}),mode:{valType:"flaglist",flags:["lines","markers"],extras:["none"]},line:{color:u.color,width:u.width,dash:{valType:"enumerated",values:Object.keys(o),dflt:"solid"}},marker:l({},i("marker"),{symbol:{valType:"enumerated",values:Object.keys(a),dflt:"circle",arrayOk:!0},size:c.size,sizeref:c.sizeref,sizemin:c.sizemin,sizemode:c.sizemode,opacity:c.opacity,showscale:c.showscale,line:l({},i("marker.line"),{width:h.width})}),connectgaps:n.connectgaps,fill:s({},n.fill,{values:["none","tozeroy","tozerox"]}),fillcolor:n.fillcolor,_nestedModules:{error_x:"ErrorBars",error_y:"ErrorBars","marker.colorbar":"Colorbar"}}},{"../../components/colorscale/color_attributes":491,"../../constants/gl2d_dashes":552,"../../constants/gl_markers":554,"../../lib/extend":563,"../scatter/attributes":750}],784:[function(t,e,r){"use strict";function n(t,e){this.scene=t,this.uid=e,this.pickXData=[],this.pickYData=[],this.xData=[],this.yData=[],this.textLabels=[],this.color="rgb(0, 0, 0)",this.name="",this.hoverinfo="all",this.connectgaps=!0,this.idToIndex=[],this.bounds=[0,0,0,0],this.hasLines=!1,this.lineOptions={positions:new Float32Array(0),color:[0,0,0,1],width:1,fill:[!1,!1,!1,!1],fillColor:[[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]],dashes:[1]},this.line=d(t.glplot,this.lineOptions),this.line._trace=this,this.hasErrorX=!1,this.errorXOptions={positions:new Float32Array(0),errors:new Float32Array(0),lineWidth:1,capSize:0,color:[0,0,0,1]},this.errorX=p(t.glplot,this.errorXOptions),this.errorX._trace=this,this.hasErrorY=!1,this.errorYOptions={positions:new Float32Array(0),errors:new Float32Array(0),lineWidth:1,capSize:0,color:[0,0,0,1]},this.errorY=p(t.glplot,this.errorYOptions),this.errorY._trace=this,this.hasMarkers=!1,this.scatterOptions={positions:new Float32Array(0),sizes:[],colors:[],glyphs:[],borderWidths:[],borderColors:[],size:12,color:[0,0,0,1],borderSize:1,borderColor:[0,0,0,1]},this.scatter=h(t.glplot,this.scatterOptions),this.scatter._trace=this,this.fancyScatter=f(t.glplot,this.scatterOptions),this.fancyScatter._trace=this}function i(t,e,r){return Array.isArray(e)||(e=[e]),o(t,e,r)}function o(t,e,r){for(var n=new Array(r),i=e[0],o=0;r>o;++o)n[o]=t(o>=e.length?i:e[o]);return n}function a(t,e,r){return l(L(t,r),S(e,r),r)}function s(t,e,r,n){var i=x(t,e,n);return i=Array.isArray(i[0])?i:o(m.identity,[i],n),l(i,S(r,n),n)}function l(t,e,r){for(var n=new Array(4*r),i=0;r>i;++i){for(var o=0;3>o;++o)n[4*i+o]=t[i][o];n[4*i+3]=t[i][3]*e[i]}return n}function u(t,e){if(void 0===Float32Array.slice){for(var r=new Float32Array(e),n=0;e>n;n++)r[n]=t[n];return r}return t.slice(0,e)}function c(t,e){var r=new n(t,e.uid);return r.update(e),r}var h=t("gl-scatter2d"),f=t("gl-scatter2d-fancy"),d=t("gl-line2d"),p=t("gl-error2d"),v=t("fast-isnumeric"),m=t("../../lib"),g=t("../../plots/cartesian/axes"),y=t("../../components/errorbars"),b=t("../../lib/str2rgbarray"),x=t("../../lib/gl_format_color"),_=t("../scatter/subtypes"),w=t("../scatter/make_bubble_size_func"),M=t("../scatter/get_trace_color"),k=t("../../constants/gl_markers"),A=t("../../constants/gl2d_dashes"),T=["xaxis","yaxis"],E=n.prototype;E.handlePick=function(t){var e=t.pointId;return(t.object!==this.line||this.connectgaps)&&(e=this.idToIndex[t.pointId]),{trace:this,dataCoord:t.dataCoord,traceCoord:[this.pickXData[e],this.pickYData[e]],textLabel:Array.isArray(this.textLabels)?this.textLabels[e]:this.textLabels,color:Array.isArray(this.color)?this.color[e]:this.color,name:this.name,hoverinfo:this.hoverinfo}},E.isFancy=function(t){if("linear"!==this.scene.xaxis.type)return!0;if("linear"!==this.scene.yaxis.type)return!0;if(!t.x||!t.y)return!0;if(this.hasMarkers){var e=t.marker||{};if(Array.isArray(e.symbol)||"circle"!==e.symbol||Array.isArray(e.size)||Array.isArray(e.color)||Array.isArray(e.line.width)||Array.isArray(e.line.color)||Array.isArray(e.opacity))return!0}return this.hasLines&&!this.connectgaps?!0:this.hasErrorX?!0:!!this.hasErrorY};var S=i.bind(null,function(t){return+t}),L=i.bind(null,b),z=i.bind(null,function(t){return k[t]||"\u25cf"});E.update=function(t){t.visible!==!0?(this.hasLines=!1,this.hasErrorX=!1,this.hasErrorY=!1,this.hasMarkers=!1):(this.hasLines=_.hasLines(t),this.hasErrorX=t.error_x.visible===!0,this.hasErrorY=t.error_y.visible===!0,this.hasMarkers=_.hasMarkers(t)),this.textLabels=t.text,this.name=t.name,this.hoverinfo=t.hoverinfo,this.bounds=[1/0,1/0,-(1/0),-(1/0)],this.connectgaps=!!t.connectgaps,this.isFancy(t)?this.updateFancy(t):this.updateFast(t),this.color=M(t,{})},E.updateFast=function(t){for(var e,r,n=this.xData=this.pickXData=t.x,i=this.yData=this.pickYData=t.y,o=n.length,a=new Array(o),s=new Float32Array(2*o),l=this.bounds,c=0,h=0,f=0;o>f;++f)e=n[f],r=i[f],v(e)&&v(r)&&(a[c++]=f,s[h++]=e,s[h++]=r,l[0]=Math.min(l[0],e),l[1]=Math.min(l[1],r),l[2]=Math.max(l[2],e),l[3]=Math.max(l[3],r));s=u(s,h),this.idToIndex=a,this.updateLines(t,s),this.updateError("X",t),this.updateError("Y",t);var d;if(this.hasMarkers){this.scatterOptions.positions=s;var p=b(t.marker.color),m=b(t.marker.line.color),g=t.opacity*t.marker.opacity;p[3]*=g,this.scatterOptions.color=p,m[3]*=g,this.scatterOptions.borderColor=m,d=t.marker.size,this.scatterOptions.size=d,this.scatterOptions.borderSize=t.marker.line.width,this.scatter.update(this.scatterOptions)}else this.scatterOptions.positions=new Float32Array(0),this.scatterOptions.glyphs=[],this.scatter.update(this.scatterOptions);this.scatterOptions.positions=new Float32Array(0),this.scatterOptions.glyphs=[],this.fancyScatter.update(this.scatterOptions),this.expandAxesFast(l,d)},E.updateFancy=function(t){var e=this.scene,r=e.xaxis,n=e.yaxis,o=this.bounds,a=this.pickXData=r.makeCalcdata(t,"x").slice(),l=this.pickYData=n.makeCalcdata(t,"y").slice();this.xData=a.slice(),this.yData=l.slice();var c,h,f,d,p,v,m,g,b=y.calcFromTrace(t,e.fullLayout),x=a.length,_=new Array(x),M=new Float32Array(2*x),k=new Float32Array(4*x),A=new Float32Array(4*x),T=0,E=0,L=0,I=0,P="log"===r.type?function(t){return r.d2l(t)}:function(t){return t},C="log"===n.type?function(t){return n.d2l(t)}:function(t){return t};for(c=0;x>c;++c)this.xData[c]=f=P(a[c]),this.yData[c]=d=C(l[c]),isNaN(f)||isNaN(d)||(_[T++]=c,M[E++]=f,M[E++]=d,p=k[L++]=f-b[c].xs||0,v=k[L++]=b[c].xh-f||0,k[L++]=0,k[L++]=0,A[I++]=0,A[I++]=0,m=A[I++]=d-b[c].ys||0,g=A[I++]=b[c].yh-d||0,o[0]=Math.min(o[0],f-p),o[1]=Math.min(o[1],d-m),o[2]=Math.max(o[2],f+v),o[3]=Math.max(o[3],d+g));M=u(M,E),this.idToIndex=_,this.updateLines(t,M),this.updateError("X",t,M,k),this.updateError("Y",t,M,A);var R;if(this.hasMarkers){this.scatterOptions.positions=M,this.scatterOptions.sizes=new Array(T),this.scatterOptions.glyphs=new Array(T),this.scatterOptions.borderWidths=new Array(T),this.scatterOptions.colors=new Array(4*T),this.scatterOptions.borderColors=new Array(4*T);var D,O=w(t),F=t.marker,j=F.opacity,N=t.opacity,B=s(F,j,N,x),U=z(F.symbol,x),V=S(F.line.width,x),q=s(F.line,j,N,x);for(R=i(O,F.size,x),c=0;T>c;++c)for(D=_[c],this.scatterOptions.sizes[c]=4*R[D],this.scatterOptions.glyphs[c]=U[D],this.scatterOptions.borderWidths[c]=.5*V[D],h=0;4>h;++h)this.scatterOptions.colors[4*c+h]=B[4*D+h],this.scatterOptions.borderColors[4*c+h]=q[4*D+h];this.fancyScatter.update(this.scatterOptions)}else this.scatterOptions.positions=new Float32Array(0),this.scatterOptions.glyphs=[],this.fancyScatter.update(this.scatterOptions);this.scatterOptions.positions=new Float32Array(0),this.scatterOptions.glyphs=[],this.scatter.update(this.scatterOptions),this.expandAxesFancy(a,l,R)},E.updateLines=function(t,e){var r;if(this.hasLines){var n=e;if(!t.connectgaps){var i=0,o=this.xData,s=this.yData;for(n=new Float32Array(2*o.length),r=0;r<o.length;++r)n[i++]=o[r],n[i++]=s[r]}this.lineOptions.positions=n;var l=a(t.line.color,t.opacity,1),u=Math.round(.5*this.lineOptions.width),c=(A[t.line.dash]||[1]).slice();for(r=0;r<c.length;++r)c[r]*=u;switch(t.fill){case"tozeroy":this.lineOptions.fill=[!1,!0,!1,!1];break;case"tozerox":this.lineOptions.fill=[!0,!1,!1,!1];break;default:this.lineOptions.fill=[!1,!1,!1,!1]}var h=b(t.fillcolor);this.lineOptions.color=l,this.lineOptions.width=2*t.line.width,this.lineOptions.dashes=c,this.lineOptions.fillColor=[h,h,h,h]}else this.lineOptions.positions=new Float32Array(0);this.line.update(this.lineOptions)},E.updateError=function(t,e,r,n){var i=this["error"+t],o=e["error_"+t.toLowerCase()],s=this["error"+t+"Options"];"x"===t.toLowerCase()&&o.copy_ystyle&&(o=e.error_y),this["hasError"+t]?(s.positions=r,s.errors=n,s.capSize=o.width,s.lineWidth=o.thickness/2,s.color=a(o.color,1,1)):s.positions=new Float32Array(0),i.update(s)},E.expandAxesFast=function(t,e){for(var r,n,i,o=e||10,a=0;2>a;a++)r=this.scene[T[a]],n=r._min,n||(n=[]),n.push({val:t[a],pad:o}),i=r._max,i||(i=[]),i.push({val:t[a+2],pad:o})},E.expandAxesFancy=function(t,e,r){var n=this.scene,i={padded:!0,ppad:r};g.expand(n.xaxis,t,i),g.expand(n.yaxis,e,i)},E.dispose=function(){this.line.dispose(),this.errorX.dispose(),this.errorY.dispose(),this.scatter.dispose(),this.fancyScatter.dispose()},e.exports=c},{"../../components/errorbars":512,"../../constants/gl2d_dashes":552,"../../constants/gl_markers":554,"../../lib":568,"../../lib/gl_format_color":566,"../../lib/str2rgbarray":580,"../../plots/cartesian/axes":592,"../scatter/get_trace_color":758,"../scatter/make_bubble_size_func":764,"../scatter/subtypes":769,"fast-isnumeric":123,"gl-error2d":125,"gl-line2d":131,"gl-scatter2d":196,"gl-scatter2d-fancy":191}],785:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../scatter/constants"),o=t("../scatter/subtypes"),a=t("../scatter/xy_defaults"),s=t("../scatter/marker_defaults"),l=t("../scatter/line_defaults"),u=t("../scatter/fillcolor_defaults"),c=t("../../components/errorbars/defaults"),h=t("./attributes");e.exports=function(t,e,r,f){function d(r,i){return n.coerce(t,e,h,r,i)}var p=a(t,e,d);return p?(d("text"),d("mode",p<i.PTS_LINESONLY?"lines+markers":"lines"),o.hasLines(e)&&(d("connectgaps"),l(t,e,r,f,d)),o.hasMarkers(e)&&s(t,e,r,f,d),d("fill"),"none"!==e.fill&&u(t,e,r,d),c(t,e,r,{axis:"y"}),void c(t,e,r,{axis:"x",inherit:"y"})):void(e.visible=!1)}},{"../../components/errorbars/defaults":511,"../../lib":568,"../scatter/constants":755,"../scatter/fillcolor_defaults":757,"../scatter/line_defaults":761,"../scatter/marker_defaults":765,"../scatter/subtypes":769,"../scatter/xy_defaults":771,"./attributes":783}],786:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.colorbar=t("../scatter/colorbar"),n.calc=t("../scatter3d/calc"),n.plot=t("./convert"),n.moduleType="trace",n.name="scattergl",n.basePlotModule=t("../../plots/gl2d"),n.categories=["gl2d","symbols","errorBarsOK","markerColorscale","showLegend"],n.meta={},e.exports=n},{"../../plots/gl2d":625,"../scatter/colorbar":753,"../scatter3d/calc":773,"./attributes":783,"./convert":784,"./defaults":785}],787:[function(t,e,r){"use strict";var n=t("../scattergeo/attributes"),i=t("../scatter/attributes"),o=t("../../plots/mapbox/layout_attributes"),a=t("../../plots/attributes"),s=t("../../lib/extend").extendFlat,l=n.line,u=n.marker;e.exports={lon:n.lon,lat:n.lat,mode:{valType:"flaglist",flags:["lines","markers","text"],dflt:"markers",extras:["none"]},text:s({},i.text,{}),line:{color:l.color,width:l.width,dash:l.dash},connectgaps:i.connectgaps,marker:{symbol:{valType:"string",dflt:"circle",arrayOk:!0},opacity:s({},u.opacity,{arrayOk:!1}),size:u.size,sizeref:u.sizeref,sizemin:u.sizemin,sizemode:u.sizemode,color:u.color,colorscale:u.colorscale,cauto:u.cauto,cmax:u.cmax,cmin:u.cmin,autocolorscale:u.autocolorscale,reversescale:u.reversescale,showscale:u.showscale},fill:{valType:"enumerated",values:["none","toself"],dflt:"none"},fillcolor:i.fillcolor,textfont:o.layers.symbol.textfont,textposition:o.layers.symbol.textposition,hoverinfo:s({},a.hoverinfo,{flags:["lon","lat","text","name"]}),_nestedModules:{"marker.colorbar":"Colorbar"}}},{"../../lib/extend":563,"../../plots/attributes":590,"../../plots/mapbox/layout_attributes":645,"../scatter/attributes":750,"../scattergeo/attributes":778}],788:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../lib"),o=t("../../components/colorscale/has_colorscale"),a=t("../../components/colorscale/make_scale_function"),s=t("../scatter/subtypes"),l=t("../scatter/colorscale_calc"),u=t("../scatter/make_bubble_size_func");e.exports=function(t,e){var r=e.lon.length,c=e.marker,h=s.hasMarkers(e),f=h&&Array.isArray(c.color),d=h&&Array.isArray(c.size),p=h&&Array.isArray(c.symbol),v=Array.isArray(e.text);l(e);for(var m=o(e,"marker")?a(c.colorscale,c.cmin,c.cmax):i.identity,g=s.isBubble(e)?u(e):i.identity,y=[],b=0,x=0;r>x;x++){var _=e.lon[x],w=e.lat[x];if(n(_)&&n(w)){var M={};if(b++,M.lonlat=[+_,+w],h){if(f){var k=c.color[x];M.mc=k,M.mcc=m(k)}if(d){var A=c.size[x];M.ms=A,M.mrc=g(A)}if(p){var T=c.symbol[x];M.mx="string"==typeof T?T:"circle"}}if(v){var E=e.text[x];M.tx="string"==typeof E?E:""}y.push(M)}else b>0&&(y[b-1].gapAfter=!0)}return y}},{"../../components/colorscale/has_colorscale":496,"../../components/colorscale/make_scale_function":500,"../../lib":568,"../scatter/colorscale_calc":754,"../scatter/make_bubble_size_func":764,"../scatter/subtypes":769,"fast-isnumeric":123}],789:[function(t,e,r){"use strict";function n(){return{geojson:i(),layout:{visibility:"none"},paint:{}}}function i(){return{type:"Point",coordinates:[]}}function o(t,e){return{type:"Polygon",coordinates:e}}function a(t,e){return{type:"MultiLineString",coordinates:e}}function s(t,e){function r(t,r,n,i){void 0===e[r][n]&&(e[r][n]=i),t[r]=e[r][n]}for(var n=t[0].trace,i=n.marker,o=Array.isArray(i.color),a=Array.isArray(i.size),s=[],l=0;l<t.length;l++){var u=t[l],c={};o&&r(c,g,u.mcc,l),a&&r(c,y,u.mrc,l),s.push({type:"Feature",geometry:{type:"Point",coordinates:u.lonlat},properties:c})}return{type:"FeatureCollection",features:s}}function l(t){for(var e=t[0].trace,r=e.marker||{},n=r.symbol,i=e.text,o="circle"!==n?f(n):d,a=v.hasText(e)?f(i):d,s=[],l=0;l<t.length;l++){var u=t[l];s.push({type:"Feature",geometry:{type:"Point",coordinates:u.lonlat},properties:{symbol:o(u.mx),text:a(u.tx)}})}return{type:"FeatureCollection",features:s}}function u(t,e){var r,n=t.marker;if(Array.isArray(n.color)){for(var i=Object.keys(e[g]),o=[],a=0;a<i.length;a++){var s=i[a];o.push([e[g][s],s])}r={property:g,stops:o}}else r=n.color;return r}function c(t,e){var r,n=t.marker;if(Array.isArray(n.size)){for(var i=Object.keys(e[y]),o=[],a=0;a<i.length;a++){var s=i[a];o.push([e[y][s],+s])}o.sort(function(t,e){return t[0]-e[0]}),r={property:y,stops:o}}else r=n.size/2;return r}function h(t){for(var e=t[0].trace,r=e.connectgaps,n=[],i=[],o=0;o<t.length;o++){var a=t[o];i.push(a.lonlat),!r&&a.gapAfter&&i.length>0&&(n.push(i),i=[])}return n.push(i),n}function f(t){return Array.isArray(t)?function(t){return t}:t?function(){return t}:d}function d(){return""}var p=t("../../lib"),v=t("../scatter/subtypes"),m=t("../../plots/mapbox/convert_text_opts"),g="circle-color",y="circle-radius";e.exports=function(t){var e=t[0].trace,r=e.visible===!0,i="none"!==e.fill,f=v.hasLines(e),d=v.hasMarkers(e),b=v.hasText(e),x=d&&"circle"===e.marker.symbol,_=d&&"circle"!==e.marker.symbol,w=n(),M=n(),k=n(),A=n(),T={fill:w,line:M,circle:k,symbol:A};if(!r)return T;var E;if((i||f)&&(E=h(t)),i&&(w.geojson=o(t,E),w.layout.visibility="visible",p.extendFlat(w.paint,{"fill-color":e.fillcolor})),f&&(M.geojson=a(t,E),M.layout.visibility="visible",p.extendFlat(M.paint,{"line-width":e.line.width,"line-color":e.line.color,"line-opacity":e.opacity})),x){var S={};S[g]={},S[y]={},k.geojson=s(t,S),k.layout.visibility="visible",p.extendFlat(k.paint,{"circle-opacity":e.opacity*e.marker.opacity,"circle-color":u(e,S),"circle-radius":c(e,S)})}if((_||b)&&(A.geojson=l(t),p.extendFlat(A.layout,{visibility:"visible","icon-image":"{symbol}-15","text-field":"{text}"}),_&&(p.extendFlat(A.layout,{"icon-size":e.marker.size/10}),p.extendFlat(A.paint,{"icon-opacity":e.opacity*e.marker.opacity,"icon-color":e.marker.color})),b)){var L=(e.marker||{}).size,z=m(e.textposition,L);p.extendFlat(A.layout,{"text-size":e.textfont.size,"text-anchor":z.anchor,"text-offset":z.offset}),p.extendFlat(A.paint,{"text-color":e.textfont.color,"text-opacity":e.opacity})}return T}},{"../../lib":568,"../../plots/mapbox/convert_text_opts":642,"../scatter/subtypes":769}],790:[function(t,e,r){"use strict";function n(t,e,r){var n=r("lon")||[],i=r("lat")||[],o=Math.min(n.length,i.length);return o<n.length&&(e.lon=n.slice(0,o)),o<i.length&&(e.lat=i.slice(0,o)),o}var i=t("../../lib"),o=t("../scatter/subtypes"),a=t("../scatter/marker_defaults"),s=t("../scatter/line_defaults"),l=t("../scatter/text_defaults"),u=t("../scatter/fillcolor_defaults"),c=t("./attributes"),h=t("../scatter/attributes");e.exports=function(t,e,r,f){function d(r,n){return i.coerce(t,e,c,r,n)}function p(r,n){var o=-1===r.indexOf(".line")?c:h;return i.coerce(t,e,o,r,n)}var v=n(t,e,d);if(!v)return void(e.visible=!1);if(d("text"),d("mode"),o.hasLines(e)&&(s(t,e,r,f,d),d("connectgaps")),o.hasMarkers(e)){a(t,e,r,f,p);var m=e.marker;"circle"!==m.symbol&&(Array.isArray(m.size)&&(m.size=m.size[0]),Array.isArray(m.color)&&(m.color=m.color[0]))}o.hasText(e)&&l(t,e,f,d),d("fill"),"none"!==e.fill&&u(t,e,r,d),d("hoverinfo",1===f._dataLength?"lon+lat+text":void 0)}},{"../../lib":568,"../scatter/attributes":750,"../scatter/fillcolor_defaults":757,"../scatter/line_defaults":761,"../scatter/marker_defaults":765,"../scatter/subtypes":769,"../scatter/text_defaults":770,"./attributes":787}],791:[function(t,e,r){"use strict";function n(t,e){function r(t){return t+"\xb0"}var n=t.hoverinfo.split("+"),i=-1!==n.indexOf("all"),o=-1!==n.indexOf("lon"),a=-1!==n.indexOf("lat"),s=e.lonlat,l=[];return i||o&&a?l.push("("+r(s[0])+", "+r(s[1])+")"):o?l.push("lon: "+r(s[0])):a&&l.push("lat: "+r(s[1])),(i||-1!==n.indexOf("text"))&&l.push(e.tx||t.text),l.join("<br>")}var i=t("../../plots/cartesian/graph_interact"),o=t("../scatter/get_trace_color");e.exports=function(t,e,r){function a(t){var e=t.lonlat,n=Math.abs(u.c2p(e)-u.c2p([d,e[1]])),i=Math.abs(c.c2p(e)-c.c2p([e[0],r])),o=Math.max(3,t.mrc||0);return Math.max(Math.sqrt(n*n+i*i)-o,1-3/o)}var s=t.cd,l=s[0].trace,u=t.xa,c=t.ya,h=e>=0?Math.floor((e+180)/360):Math.ceil((e-180)/360),f=360*h,d=e-f;if(i.getClosest(s,a,t),t.index!==!1){var p=s[t.index],v=p.lonlat,m=[v[0]+f,v[1]],g=u.c2p(m),y=c.c2p(m),b=p.mrc||1;return t.x0=g-b,t.x1=g+b,t.y0=y-b,t.y1=y+b,t.color=o(l,p),t.extraText=n(l,p),[t]}}},{"../../plots/cartesian/graph_interact":599,"../scatter/get_trace_color":758}],792:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.colorbar=t("../scatter/colorbar"),n.calc=t("./calc"),n.hoverPoints=t("./hover"),n.plot=t("./plot"),n.moduleType="trace",n.name="scattermapbox",n.basePlotModule=t("../../plots/mapbox"),n.categories=["mapbox","gl","symbols","markerColorscale","showLegend"],n.meta={},e.exports=n},{"../../plots/mapbox":643,"../scatter/colorbar":753,"./attributes":787,"./calc":788,"./defaults":790,"./hover":791,"./plot":793}],793:[function(t,e,r){"use strict";function n(t,e){this.mapbox=t,this.map=t.map,this.uid=e,this.idSourceFill=e+"-source-fill",this.idSourceLine=e+"-source-line",this.idSourceCircle=e+"-source-circle",this.idSourceSymbol=e+"-source-symbol",this.idLayerFill=e+"-layer-fill",this.idLayerLine=e+"-layer-line",this.idLayerCircle=e+"-layer-circle",this.idLayerSymbol=e+"-layer-symbol",this.sourceFill=t.createGeoJSONSource(),this.map.addSource(this.idSourceFill,this.sourceFill),this.sourceLine=t.createGeoJSONSource(),this.map.addSource(this.idSourceLine,this.sourceLine),this.sourceCircle=t.createGeoJSONSource(),this.map.addSource(this.idSourceCircle,this.sourceCircle),this.sourceSymbol=t.createGeoJSONSource(),this.map.addSource(this.idSourceSymbol,this.sourceSymbol),this.map.addLayer({id:this.idLayerFill,source:this.idSourceFill,type:"fill"}),this.map.addLayer({id:this.idLayerLine,source:this.idSourceLine,type:"line"}),this.map.addLayer({id:this.idLayerCircle,source:this.idSourceCircle,type:"circle"}),this.map.addLayer({id:this.idLayerSymbol,source:this.idSourceSymbol,type:"symbol"})}function i(t){return"visible"===t.layout.visibility}var o=t("./convert"),a=n.prototype;a.update=function(t){var e=this.mapbox,r=o(t);e.setOptions(this.idLayerFill,"setLayoutProperty",r.fill.layout),e.setOptions(this.idLayerLine,"setLayoutProperty",r.line.layout),e.setOptions(this.idLayerCircle,"setLayoutProperty",r.circle.layout),e.setOptions(this.idLayerSymbol,"setLayoutProperty",r.symbol.layout),i(r.fill)&&(this.sourceFill.setData(r.fill.geojson),e.setOptions(this.idLayerFill,"setPaintProperty",r.fill.paint)),i(r.line)&&(this.sourceLine.setData(r.line.geojson),e.setOptions(this.idLayerLine,"setPaintProperty",r.line.paint)),i(r.circle)&&(this.sourceCircle.setData(r.circle.geojson),e.setOptions(this.idLayerCircle,"setPaintProperty",r.circle.paint)),i(r.symbol)&&(this.sourceSymbol.setData(r.symbol.geojson),e.setOptions(this.idLayerSymbol,"setPaintProperty",r.symbol.paint))},a.dispose=function(){var t=this.map;t.removeLayer(this.idLayerFill),t.removeLayer(this.idLayerLine),t.removeLayer(this.idLayerCircle),t.removeLayer(this.idLayerSymbol),t.removeSource(this.idSourceFill),t.removeSource(this.idSourceLine),t.removeSource(this.idSourceCircle),t.removeSource(this.idSourceSymbol)},e.exports=function(t,e){var r=e[0].trace,i=new n(t,r.uid);return i.update(e),i}},{"./convert":789}],794:[function(t,e,r){"use strict";var n=t("../scatter/attributes"),i=t("../../plots/attributes"),o=t("../../components/colorscale/color_attributes"),a=t("../../lib/extend").extendFlat,s=n.marker,l=n.line,u=s.line;e.exports={a:{valType:"data_array"},b:{valType:"data_array"},c:{valType:"data_array"},sum:{valType:"number",dflt:0,min:0},mode:a({},n.mode,{dflt:"markers"}),text:a({},n.text,{}),line:{color:l.color,width:l.width,dash:l.dash,shape:a({},l.shape,{values:["linear","spline"]}),smoothing:l.smoothing},connectgaps:n.connectgaps,fill:a({},n.fill,{values:["none","toself","tonext"]}),fillcolor:n.fillcolor,marker:a({},{symbol:s.symbol,opacity:s.opacity,maxdisplayed:s.maxdisplayed,size:s.size,sizeref:s.sizeref,sizemin:s.sizemin,sizemode:s.sizemode,showscale:s.showscale,line:a({},{width:u.width},o("marker".line))},o("marker")),textfont:n.textfont,textposition:n.textposition,hoverinfo:a({},i.hoverinfo,{flags:["a","b","c","text","name"]}),hoveron:n.hoveron,_nestedModules:{"marker.colorbar":"Colorbar"}}},{"../../components/colorscale/color_attributes":491,"../../lib/extend":563,"../../plots/attributes":590,"../scatter/attributes":750}],795:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../plots/cartesian/axes"),o=t("../../lib"),a=t("../scatter/subtypes"),s=t("../scatter/colorscale_calc"),l=["a","b","c"],u={a:["b","c"],b:["a","c"],c:["a","b"]};e.exports=function(t,e){var r,c,h,f,d,p,v=t._fullLayout[e.subplot],m=v.sum,g=e.sum||m;for(r=0;r<l.length;r++)if(h=l[r],!e[h]){for(d=e[u[h][0]],p=e[u[h][1]],f=new Array(d.length),c=0;c<d.length;c++)f[c]=g-d[c]-p[c];e[h]=f}var y,b,x,_,w,M,k=e.a.length,A=new Array(k);for(r=0;k>r;r++)y=e.a[r],b=e.b[r],x=e.c[r],n(y)&&n(b)&&n(x)?(y=+y,b=+b,x=+x,_=m/(y+b+x),1!==_&&(y*=_,b*=_,x*=_),M=y,w=x-b,A[r]={x:w,y:M,a:y,b:b,c:x}):A[r]={x:!1,y:!1};var T,E;if(a.hasMarkers(e)&&(T=e.marker,E=T.size,Array.isArray(E))){var S={type:"linear"};i.setConvert(S),E=S.makeCalcdata(e.marker,"size"),E.length>k&&E.splice(k,E.length-k)}return s(e),void 0!==typeof E&&o.mergeArray(E,A,"ms"),A}},{"../../lib":568,"../../plots/cartesian/axes":592,"../scatter/colorscale_calc":754,"../scatter/subtypes":769,"fast-isnumeric":123}],796:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../scatter/constants"),o=t("../scatter/subtypes"),a=t("../scatter/marker_defaults"),s=t("../scatter/line_defaults"),l=t("../scatter/line_shape_defaults"),u=t("../scatter/text_defaults"),c=t("../scatter/fillcolor_defaults"),h=t("./attributes");e.exports=function(t,e,r,f){function d(r,i){return n.coerce(t,e,h,r,i)}var p,v=d("a"),m=d("b"),g=d("c");if(v?(p=v.length,m?(p=Math.min(p,m.length),g&&(p=Math.min(p,g.length))):p=g?Math.min(p,g.length):0):m&&g&&(p=Math.min(m.length,g.length)),!p)return void(e.visible=!1);v&&p<v.length&&(e.a=v.slice(0,p)),m&&p<m.length&&(e.b=m.slice(0,p)),g&&p<g.length&&(e.c=g.slice(0,p)),d("sum"),d("text");var y=p<i.PTS_LINESONLY?"lines+markers":"lines";d("mode",y),o.hasLines(e)&&(s(t,e,r,f,d),l(t,e,d),d("connectgaps")),o.hasMarkers(e)&&a(t,e,r,f,d),o.hasText(e)&&u(t,e,f,d);var b=[];(o.hasMarkers(e)||o.hasText(e))&&(d("marker.maxdisplayed"),b.push("points")),d("fill"),"none"!==e.fill&&(c(t,e,r,d),o.hasLines(e)||l(t,e,d)),d("hoverinfo",1===f._dataLength?"a+b+c+text":void 0),"tonext"!==e.fill&&"toself"!==e.fill||b.push("fills"),d("hoveron",b.join("+")||"points")}},{"../../lib":568,"../scatter/constants":755,"../scatter/fillcolor_defaults":757,"../scatter/line_defaults":761,"../scatter/line_shape_defaults":763,"../scatter/marker_defaults":765,"../scatter/subtypes":769,"../scatter/text_defaults":770,"./attributes":794}],797:[function(t,e,r){"use strict";var n=t("../scatter/hover"),i=t("../../plots/cartesian/axes");
e.exports=function(t,e,r,o){function a(t,e){g.push(t._hovertitle+": "+i.tickText(t,e,"hover").text)}var s=n(t,e,r,o);if(s&&s[0].index!==!1){var l=s[0];if(void 0===l.index){var u=1-l.y0/t.ya._length,c=t.xa._length,h=c*u/2,f=c-h;return l.x0=Math.max(Math.min(l.x0,f),h),l.x1=Math.max(Math.min(l.x1,f),h),s}var d=l.cd[l.index];l.a=d.a,l.b=d.b,l.c=d.c,l.xLabelVal=void 0,l.yLabelVal=void 0;var p=l.trace,v=p._ternary,m=p.hoverinfo.split("+"),g=[];return-1!==m.indexOf("all")&&(m=["a","b","c"]),-1!==m.indexOf("a")&&a(v.aaxis,d.a),-1!==m.indexOf("b")&&a(v.baxis,d.b),-1!==m.indexOf("c")&&a(v.caxis,d.c),l.extraText=g.join("<br>"),s}}},{"../../plots/cartesian/axes":592,"../scatter/hover":759}],798:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.colorbar=t("../scatter/colorbar"),n.calc=t("./calc"),n.plot=t("./plot"),n.style=t("./style"),n.hoverPoints=t("./hover"),n.selectPoints=t("./select"),n.moduleType="trace",n.name="scatterternary",n.basePlotModule=t("../../plots/ternary"),n.categories=["ternary","symbols","markerColorscale","showLegend"],n.meta={},e.exports=n},{"../../plots/ternary":655,"../scatter/colorbar":753,"./attributes":794,"./calc":795,"./defaults":796,"./hover":797,"./plot":799,"./select":800,"./style":801}],799:[function(t,e,r){"use strict";var n=t("../scatter/plot");e.exports=function(t,e){var r=t.plotContainer;r.select(".scatterlayer").selectAll("*").remove();for(var i={x:function(){return t.xaxis},y:function(){return t.yaxis},plot:r},o=new Array(e.length),a=t.graphDiv.calcdata,s=0;s<a.length;s++){var l=e.indexOf(a[s][0].trace);-1!==l&&(o[l]=a[s],e[l]._ternary=t)}n(t.graphDiv,i,o)}},{"../scatter/plot":766}],800:[function(t,e,r){"use strict";var n=t("../scatter/select");e.exports=function(t,e){var r=n(t,e);if(r){var i,o,a,s=t.cd;for(a=0;a<r.length;a++)i=r[a],o=s[i.pointNumber],i.a=o.a,i.b=o.b,i.c=o.c,delete i.x,delete i.y;return r}}},{"../scatter/select":767}],801:[function(t,e,r){"use strict";var n=t("../scatter/style");e.exports=function(t){for(var e=t._fullLayout._modules,r=0;r<e.length;r++)if("scatter"===e[r].name)return;n(t)}},{"../scatter/style":768}],802:[function(t,e,r){"use strict";function n(t){return{valType:"boolean",dflt:!1}}function i(t){return{show:{valType:"boolean",dflt:!1},project:{x:n("x"),y:n("y"),z:n("z")},color:{valType:"color",dflt:o.defaultLine},usecolormap:{valType:"boolean",dflt:!1},width:{valType:"number",min:1,max:16,dflt:2},highlight:{valType:"boolean",dflt:!0},highlightcolor:{valType:"color",dflt:o.defaultLine},highlightwidth:{valType:"number",min:1,max:16,dflt:2}}}var o=t("../../components/color"),a=t("../../components/colorscale/attributes"),s=t("../../lib/extend").extendFlat;e.exports={z:{valType:"data_array"},x:{valType:"data_array"},y:{valType:"data_array"},text:{valType:"data_array"},surfacecolor:{valType:"data_array"},cauto:a.zauto,cmin:a.zmin,cmax:a.zmax,colorscale:a.colorscale,autocolorscale:s({},a.autocolorscale,{dflt:!1}),reversescale:a.reversescale,showscale:a.showscale,contours:{x:i("x"),y:i("y"),z:i("z")},hidesurface:{valType:"boolean",dflt:!1},lightposition:{x:{valType:"number",min:-1e5,max:1e5,dflt:10},y:{valType:"number",min:-1e5,max:1e5,dflt:1e4},z:{valType:"number",min:-1e5,max:1e5,dflt:0}},lighting:{ambient:{valType:"number",min:0,max:1,dflt:.8},diffuse:{valType:"number",min:0,max:1,dflt:.8},specular:{valType:"number",min:0,max:2,dflt:.05},roughness:{valType:"number",min:0,max:1,dflt:.5},fresnel:{valType:"number",min:0,max:5,dflt:.2}},opacity:{valType:"number",min:0,max:1,dflt:1},_nestedModules:{colorbar:"Colorbar"},_deprecated:{zauto:s({},a.zauto,{}),zmin:s({},a.zmin,{}),zmax:s({},a.zmax,{})}}},{"../../components/color":483,"../../components/colorscale/attributes":489,"../../lib/extend":563}],803:[function(t,e,r){"use strict";var n=t("../../components/colorscale/calc");e.exports=function(t,e){e.surfacecolor?n(e,e.surfacecolor,"","c"):n(e,e.z,"","c")}},{"../../components/colorscale/calc":490}],804:[function(t,e,r){"use strict";var n=t("d3"),i=t("fast-isnumeric"),o=t("../../lib"),a=t("../../plots/plots"),s=t("../../components/colorscale/get_scale"),l=t("../../components/colorbar/draw");e.exports=function(t,e){var r=e[0].trace,u="cb"+r.uid,c=s(r.colorscale),h=r.cmin,f=r.cmax,d=r.surfacecolor||r.z;if(i(h)||(h=o.aggNums(Math.min,null,d)),i(f)||(f=o.aggNums(Math.max,null,d)),t._fullLayout._infolayer.selectAll("."+u).remove(),!r.showscale)return void a.autoMargin(t,u);var p=e[0].t.cb=l(t,u);p.fillcolor(n.scale.linear().domain(c.map(function(t){return h+t[0]*(f-h)})).range(c.map(function(t){return t[1]}))).filllevels({start:h,end:f,size:(f-h)/254}).options(r.colorbar)()}},{"../../components/colorbar/draw":486,"../../components/colorscale/get_scale":495,"../../lib":568,"../../plots/plots":648,d3:119,"fast-isnumeric":123}],805:[function(t,e,r){"use strict";function n(t,e,r){this.scene=t,this.uid=r,this.surface=e,this.data=null,this.showContour=[!1,!1,!1],this.dataScale=1}function i(t,e){return void 0===e&&(e=1),t.map(function(t){var r=t[0],n=d(t[1]),i=n.toRgb();return{index:r,rgb:[i.r,i.g,i.b,e]}})}function o(t){var e=t.shape,r=[e[0]+2,e[1]+2],n=u(new Float32Array(r[0]*r[1]),r);return f.assign(n.lo(1,1).hi(e[0],e[1]),t),f.assign(n.lo(1).hi(e[0],1),t.hi(e[0],1)),f.assign(n.lo(1,r[1]-1).hi(e[0],1),t.lo(0,e[1]-1).hi(e[0],1)),f.assign(n.lo(0,1).hi(1,e[1]),t.hi(1)),f.assign(n.lo(r[0]-1,1).hi(1,e[1]),t.lo(e[0]-1)),n.set(0,0,t.get(0,0)),n.set(0,r[1]-1,t.get(0,e[1]-1)),n.set(r[0]-1,0,t.get(e[0]-1,0)),n.set(r[0]-1,r[1]-1,t.get(e[0]-1,e[1]-1)),n}function a(t){var e=Math.max(t[0].shape[0],t[0].shape[1]);if(v>e){for(var r=v/e,n=[0|Math.floor(t[0].shape[0]*r+1),0|Math.floor(t[0].shape[1]*r+1)],i=n[0]*n[1],a=0;a<t.length;++a){var s=o(t[a]),l=u(new Float32Array(i),n);c(l,s,[r,0,0,0,r,0,0,0,1]),t[a]=l}return r}return 1}function s(t,e){var r=t.glplot.gl,i=l({gl:r}),o=new n(t,i,e.uid);return o.update(e),t.glplot.add(i),o}var l=t("gl-surface3d"),u=t("ndarray"),c=t("ndarray-homography"),h=t("ndarray-fill"),f=t("ndarray-ops"),d=t("tinycolor2"),p=t("../../lib/str2rgbarray"),v=128,m=n.prototype;m.handlePick=function(t){if(t.object===this.surface){var e=[Math.min(0|Math.round(t.data.index[0]/this.dataScale-1),this.data.z[0].length-1),Math.min(0|Math.round(t.data.index[1]/this.dataScale-1),this.data.z.length-1)],r=[0,0,0];Array.isArray(this.data.x[0])?r[0]=this.data.x[e[1]][e[0]]:r[0]=this.data.x[e[0]],Array.isArray(this.data.y[0])?r[1]=this.data.y[e[1]][e[0]]:r[1]=this.data.y[e[1]],r[2]=this.data.z[e[1]][e[0]],t.traceCoordinate=r;var n=this.scene.fullSceneLayout;t.dataCoordinate=[n.xaxis.d2l(r[0])*this.scene.dataScale[0],n.yaxis.d2l(r[1])*this.scene.dataScale[1],n.zaxis.d2l(r[2])*this.scene.dataScale[2]];var i=this.data.text;return i&&i[e[1]]&&void 0!==i[e[1]][e[0]]?t.textLabel=i[e[1]][e[0]]:t.textLabel="",t.data.dataCoordinate=t.dataCoordinate.slice(),this.surface.highlight(t.data),this.scene.glplot.spikes.position=t.dataCoordinate,!0}},m.setContourLevels=function(){for(var t=[[],[],[]],e=!1,r=0;3>r;++r)this.showContour[r]&&(e=!0,t[r]=this.scene.contourLevels[r]);e&&this.surface.update({levels:t})},m.update=function(t){var e,r=this.scene,n=r.fullSceneLayout,o=this.surface,s=t.opacity,l=i(t.colorscale,s),c=t.z,f=t.x,d=t.y,v=n.xaxis,m=n.yaxis,g=n.zaxis,y=r.dataScale,b=c[0].length,x=c.length,_=[u(new Float32Array(b*x),[b,x]),u(new Float32Array(b*x),[b,x]),u(new Float32Array(b*x),[b,x])],w=_[0],M=_[1],k=r.contourLevels;this.data=t,h(_[2],function(t,e){return g.d2l(c[e][t])*y[2]}),Array.isArray(f[0])?h(w,function(t,e){return v.d2l(f[e][t])*y[0]}):h(w,function(t){return v.d2l(f[t])*y[0]}),Array.isArray(d[0])?h(M,function(t,e){return m.d2l(d[e][t])*y[1]}):h(M,function(t,e){return m.d2l(d[e])*y[1]});var A={colormap:l,levels:[[],[],[]],showContour:[!0,!0,!0],showSurface:!t.hidesurface,contourProject:[[!1,!1,!1],[!1,!1,!1],[!1,!1,!1]],contourWidth:[1,1,1],contourColor:[[1,1,1,1],[1,1,1,1],[1,1,1,1]],contourTint:[1,1,1],dynamicColor:[[1,1,1,1],[1,1,1,1],[1,1,1,1]],dynamicWidth:[1,1,1],dynamicTint:[1,1,1],opacity:1};if(A.intensityBounds=[t.cmin,t.cmax],t.surfacecolor){var T=u(new Float32Array(b*x),[b,x]);h(T,function(e,r){return t.surfacecolor[r][e]}),_.push(T)}else A.intensityBounds[0]*=y[2],A.intensityBounds[1]*=y[2];this.dataScale=a(_),t.surfacecolor&&(A.intensity=_.pop()),"opacity"in t&&t.opacity<1&&(A.opacity=.25*t.opacity);var E=[!0,!0,!0],S=["x","y","z"];for(e=0;3>e;++e){var L=t.contours[S[e]];E[e]=L.highlight,A.showContour[e]=L.show||L.highlight,A.showContour[e]&&(A.contourProject[e]=[L.project.x,L.project.y,L.project.z],L.show?(this.showContour[e]=!0,A.levels[e]=k[e],o.highlightColor[e]=A.contourColor[e]=p(L.color),L.usecolormap?o.highlightTint[e]=A.contourTint[e]=0:o.highlightTint[e]=A.contourTint[e]=1,A.contourWidth[e]=L.width):this.showContour[e]=!1,L.highlight&&(A.dynamicColor[e]=p(L.highlightcolor),A.dynamicWidth[e]=L.highlightwidth))}A.coords=_,o.update(A),o.visible=t.visible,o.enableDynamic=E,o.snapToData=!0,"lighting"in t&&(o.ambientLight=t.lighting.ambient,o.diffuseLight=t.lighting.diffuse,o.specularLight=t.lighting.specular,o.roughness=t.lighting.roughness,o.fresnel=t.lighting.fresnel),"lightposition"in t&&(o.lightPosition=[t.lightposition.x,t.lightposition.y,t.lightposition.z]),s&&1>s&&(o.supportsTransparency=!0)},m.dispose=function(){this.scene.glplot.remove(this.surface),this.surface.dispose()},e.exports=s},{"../../lib/str2rgbarray":580,"gl-surface3d":227,ndarray:433,"ndarray-fill":426,"ndarray-homography":431,"ndarray-ops":432,tinycolor2:454}],806:[function(t,e,r){"use strict";function n(t,e,r){e in t&&!(r in t)&&(t[r]=t[e])}var i=t("../../lib"),o=t("../../components/colorscale/defaults"),a=t("./attributes");e.exports=function(t,e,r,s){function l(r,n){return i.coerce(t,e,a,r,n)}var u,c,h=l("z");if(!h)return void(e.visible=!1);var f=h[0].length,d=h.length;if(l("x"),l("y"),!Array.isArray(e.x))for(e.x=[],u=0;f>u;++u)e.x[u]=u;if(l("text"),!Array.isArray(e.y))for(e.y=[],u=0;d>u;++u)e.y[u]=u;["lighting.ambient","lighting.diffuse","lighting.specular","lighting.roughness","lighting.fresnel","lightposition.x","lightposition.y","lightposition.z","hidesurface","opacity"].forEach(function(t){l(t)});var p=l("surfacecolor");l("colorscale");var v=["x","y","z"];for(u=0;3>u;++u){var m="contours."+v[u],g=l(m+".show"),y=l(m+".highlight");if(g||y)for(c=0;3>c;++c)l(m+".project."+v[c]);g&&(l(m+".color"),l(m+".width"),l(m+".usecolormap")),y&&(l(m+".highlightcolor"),l(m+".highlightwidth"))}p||(n(t,"zmin","cmin"),n(t,"zmax","cmax"),n(t,"zauto","cauto")),o(t,e,s,l,{prefix:"",cLetter:"c"})}},{"../../components/colorscale/defaults":493,"../../lib":568,"./attributes":802}],807:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.colorbar=t("./colorbar"),n.calc=t("./calc"),n.plot=t("./convert"),n.moduleType="trace",n.name="surface",n.basePlotModule=t("../../plots/gl3d"),n.categories=["gl3d","noOpacity"],n.meta={},e.exports=n},{"../../plots/gl3d":628,"./attributes":802,"./calc":803,"./colorbar":804,"./convert":805,"./defaults":806}]},{},[12])(12)});