Skip to content

Instantly share code, notes, and snippets.

@etpinard
Created December 18, 2017 17:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save etpinard/3f0f5550fd47a5bda6e59bc433c87689 to your computer and use it in GitHub Desktop.
Save etpinard/3f0f5550fd47a5bda6e59bc433c87689 to your computer and use it in GitHub Desktop.
Demo of violins with persistent selections
<!DOCTYPE html>
<html>
<head>
<script src="plotly.min.js"></script>
</head>
<body>
<div id="graph"></div>
<script src="main.js"></script>
</body>
</html>
var gd = document.getElementById('graph')
var gen = v => Math.round(Math.random(v) * 10)
var n = 100
var x = new Array(n).fill(0).map(gen)
var y = new Array(n).fill(0).map(gen)
var c = '#984ea3'
var usmo = 0
Plotly.newPlot(gd, [{
mode: 'markers',
x: x,
y: y,
marker: {color: c},
unselected: { marker: {opacity: usmo} }
}, {
type: 'violin',
name: 'x',
x: x,
points: 'all',
pointpos: 1.5,
box: {visible: true},
yaxis: 'y2',
marker: {color: c},
unselected: { marker: {opacity: usmo} }
}, {
type: 'violin',
name: 'y',
y: y,
points: 'all',
pointpos: 1.5,
box: {visible: true},
xaxis: 'x2',
marker: {color: c},
unselected: { marker: {opacity: usmo} }
}], {
xaxis: {
domain: [0, 0.48]
},
yaxis: {
domain: [0, 0.48]
},
xaxis2: {
domain: [0.52, 1]
},
yaxis2: {
domain: [0.52, 1]
},
showlegend: false,
dragmode: 'lasso',
hovermode: 'closest',
width: 500,
height: 500
})
gd.on('plotly_selected', d => {
if(d && d.points && d.points.length) {
var sel = d.points.map(p => p.pointIndex)
Plotly.restyle(gd, 'selectedpoints', [sel.slice(), sel.slice(), sel.slice()])
} else {
Plotly.restyle(gd, 'selectedpoints', null)
}
})
This file has been truncated, but you can view the full file.
/**
* plotly.js v1.31.2
* Copyright 2012-2017, 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{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).Plotly=t()}}(function(){return function t(e,r,n){function i(o,s){if(!r[o]){if(!e[o]){var l="function"==typeof require&&require;if(!s&&l)return l(o,!0);if(a)return a(o,!0);var c=new Error("Cannot find module '"+o+"'");throw c.code="MODULE_NOT_FOUND",c}var u=r[o]={exports:{}};e[o][0].call(u.exports,function(t){var r=e[o][1][t];return i(r||t)},u,u.exports,t,e,r,n)}return r[o].exports}for(var a="function"==typeof require&&require,o=0;o<n.length;o++)i(n[o]);return i}({1:[function(t,e,r){"use strict";var n=t("../src/lib"),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-default":"cursor:default;","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;overflow-wrap:break-word;word-wrap:break-word;-ms-hyphens:auto;-webkit-hyphens:auto;hyphens:auto;","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 a in i){var o=a.replace(/^,/," ,").replace(/X/g,".js-plotly-plot .plotly").replace(/Y/g,".plotly-notifier");n.addStyleRule(o,i[a])}},{"../src/lib":740}],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},spikeline:{width:1e3,path:"M512 409c0-57-46-104-103-104-57 0-104 47-104 104 0 57 47 103 104 103 57 0 103-46 103-103z m-327-39l92 0 0 92-92 0z m-185 0l92 0 0 92-92 0z m370-186l92 0 0 93-92 0z m0-184l92 0 0 92-92 0z",ascent:850,descent:-150}}},{}],3:[function(t,e,r){"use strict";e.exports=t("../src/transforms/aggregate")},{"../src/transforms/aggregate":1148}],4:[function(t,e,r){"use strict";e.exports=t("../src/traces/bar")},{"../src/traces/bar":873}],5:[function(t,e,r){"use strict";e.exports=t("../src/traces/box")},{"../src/traces/box":886}],6:[function(t,e,r){"use strict";e.exports=t("../src/components/calendars")},{"../src/components/calendars":613}],7:[function(t,e,r){"use strict";e.exports=t("../src/traces/candlestick")},{"../src/traces/candlestick":895}],8:[function(t,e,r){"use strict";e.exports=t("../src/traces/carpet")},{"../src/traces/carpet":916}],9:[function(t,e,r){"use strict";e.exports=t("../src/traces/choropleth")},{"../src/traces/choropleth":931}],10:[function(t,e,r){"use strict";e.exports=t("../src/traces/contour")},{"../src/traces/contour":944}],11:[function(t,e,r){"use strict";e.exports=t("../src/traces/contourcarpet")},{"../src/traces/contourcarpet":959}],12:[function(t,e,r){"use strict";e.exports=t("../src/core")},{"../src/core":722}],13:[function(t,e,r){"use strict";e.exports=t("../src/transforms/filter")},{"../src/transforms/filter":1149}],14:[function(t,e,r){"use strict";e.exports=t("../src/transforms/groupby")},{"../src/transforms/groupby":1150}],15:[function(t,e,r){"use strict";e.exports=t("../src/traces/heatmap")},{"../src/traces/heatmap":972}],16:[function(t,e,r){"use strict";e.exports=t("../src/traces/heatmapgl")},{"../src/traces/heatmapgl":982}],17:[function(t,e,r){"use strict";e.exports=t("../src/traces/histogram")},{"../src/traces/histogram":993}],18:[function(t,e,r){"use strict";e.exports=t("../src/traces/histogram2d")},{"../src/traces/histogram2d":999}],19:[function(t,e,r){"use strict";e.exports=t("../src/traces/histogram2dcontour")},{"../src/traces/histogram2dcontour":1003}],20:[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("./scatterternary"),t("./violin"),t("./scatter3d"),t("./surface"),t("./mesh3d"),t("./scattergeo"),t("./choropleth"),t("./scattergl"),t("./pointcloud"),t("./heatmapgl"),t("./parcoords"),t("./scattermapbox"),t("./sankey"),t("./table"),t("./carpet"),t("./scattercarpet"),t("./contourcarpet"),t("./ohlc"),t("./candlestick")]),n.register([t("./aggregate"),t("./filter"),t("./groupby"),t("./sort")]),n.register([t("./calendars")]),n.register([t("./locale-en.js"),t("./locale-en-us.js")]),e.exports=n},{"./aggregate":3,"./bar":4,"./box":5,"./calendars":6,"./candlestick":7,"./carpet":8,"./choropleth":9,"./contour":10,"./contourcarpet":11,"./core":12,"./filter":13,"./groupby":14,"./heatmap":15,"./heatmapgl":16,"./histogram":17,"./histogram2d":18,"./histogram2dcontour":19,"./locale-en-us.js":21,"./locale-en.js":22,"./mesh3d":23,"./ohlc":24,"./parcoords":25,"./pie":26,"./pointcloud":27,"./sankey":28,"./scatter3d":29,"./scattercarpet":30,"./scattergeo":31,"./scattergl":32,"./scattermapbox":33,"./scatterternary":34,"./sort":35,"./surface":36,"./table":37,"./violin":38}],21:[function(t,e,r){"use strict";e.exports={moduleType:"locale",name:"en-US",dictionary:{"Click to enter Colorscale title":"Click to enter Colorscale title"}}},{}],22:[function(t,e,r){"use strict";e.exports={moduleType:"locale",name:"en",dictionary:{"Click to enter Colorscale title":"Click to enter Colourscale title"}}},{}],23:[function(t,e,r){"use strict";e.exports=t("../src/traces/mesh3d")},{"../src/traces/mesh3d":1009}],24:[function(t,e,r){"use strict";e.exports=t("../src/traces/ohlc")},{"../src/traces/ohlc":1014}],25:[function(t,e,r){"use strict";e.exports=t("../src/traces/parcoords")},{"../src/traces/parcoords":1023}],26:[function(t,e,r){"use strict";e.exports=t("../src/traces/pie")},{"../src/traces/pie":1033}],27:[function(t,e,r){"use strict";e.exports=t("../src/traces/pointcloud")},{"../src/traces/pointcloud":1042}],28:[function(t,e,r){"use strict";e.exports=t("../src/traces/sankey")},{"../src/traces/sankey":1048}],29:[function(t,e,r){"use strict";e.exports=t("../src/traces/scatter3d")},{"../src/traces/scatter3d":1082}],30:[function(t,e,r){"use strict";e.exports=t("../src/traces/scattercarpet")},{"../src/traces/scattercarpet":1088}],31:[function(t,e,r){"use strict";e.exports=t("../src/traces/scattergeo")},{"../src/traces/scattergeo":1096}],32:[function(t,e,r){"use strict";e.exports=t("../src/traces/scattergl")},{"../src/traces/scattergl":1104}],33:[function(t,e,r){"use strict";e.exports=t("../src/traces/scattermapbox")},{"../src/traces/scattermapbox":1111}],34:[function(t,e,r){"use strict";e.exports=t("../src/traces/scatterternary")},{"../src/traces/scatterternary":1119}],35:[function(t,e,r){"use strict";e.exports=t("../src/transforms/sort")},{"../src/transforms/sort":1152}],36:[function(t,e,r){"use strict";e.exports=t("../src/traces/surface")},{"../src/traces/surface":1127}],37:[function(t,e,r){"use strict";e.exports=t("../src/traces/table")},{"../src/traces/table":1135}],38:[function(t,e,r){"use strict";e.exports=t("../src/traces/violin")},{"../src/traces/violin":1142}],39:[function(t,e,r){"use strict";e.exports=function(t,e){function r(e,r,i,a){var o=1/t.clientHeight,s=o*(r-m),l=o*(i-g),u=p.flipX?1:-1,f=p.flipY?1:-1,d=Math.PI*p.rotateSpeed,y=n();if(1&e)a.shift?c.rotate(y,0,0,-s*d):c.rotate(y,u*d*s,-f*d*l,0);else if(2&e)c.pan(y,-p.translateSpeed*s*h,p.translateSpeed*l*h,0);else if(4&e){var b=p.zoomSpeed*l/window.innerHeight*(y-c.lastT())*50;c.pan(y,0,0,h*(Math.exp(b)-1))}m=r,g=i,v=a}t=t||document.body;var l=[.01,1/0];"distanceLimits"in(e=e||{})&&(l[0]=e.distanceLimits[0],l[1]=e.distanceLimits[1]),"zoomMin"in e&&(l[0]=e.zoomMin),"zoomMax"in e&&(l[1]=e.zoomMax);var c=i({center:e.center||[0,0,0],up:e.up||[0,1,0],eye:e.eye||[0,0,10],mode:e.mode||"orbit",distanceLimits:l}),u=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],h=0,f=t.clientWidth,d=t.clientHeight,p={view:c,element:t,delay:e.delay||16,rotateSpeed:e.rotateSpeed||1,zoomSpeed:e.zoomSpeed||1,translateSpeed:e.translateSpeed||1,flipX:!!e.flipX,flipY:!!e.flipY,modes:c.modes,tick:function(){var e=n(),r=this.delay;c.idle(e-r),c.flush(e-(100+2*r));var i=e-2*r;c.recalcMatrix(i);for(var a=!0,o=c.computedMatrix,s=0;s<16;++s)a=a&&u[s]===o[s],u[s]=o[s];var l=t.clientWidth===f&&t.clientHeight===d;return f=t.clientWidth,d=t.clientHeight,a?!l:(h=Math.exp(c.computedRadius[0]),!0)},lookAt:function(t,e,r){c.lookAt(c.lastT(),t,e,r)},rotate:function(t,e,r){c.rotate(c.lastT(),t,e,r)},pan:function(t,e,r){c.pan(c.lastT(),t,e,r)},translate:function(t,e,r){c.translate(c.lastT(),t,e,r)}};Object.defineProperties(p,{matrix:{get:function(){return c.computedMatrix},set:function(t){return c.setMatrix(c.lastT(),t),c.computedMatrix},enumerable:!0},mode:{get:function(){return c.getMode()},set:function(t){return c.setMode(t),c.getMode()},enumerable:!0},center:{get:function(){return c.computedCenter},set:function(t){return c.lookAt(c.lastT(),t),c.computedCenter},enumerable:!0},eye:{get:function(){return c.computedEye},set:function(t){return c.lookAt(c.lastT(),null,t),c.computedEye},enumerable:!0},up:{get:function(){return c.computedUp},set:function(t){return c.lookAt(c.lastT(),null,null,t),c.computedUp},enumerable:!0},distance:{get:function(){return h},set:function(t){return c.setDistance(c.lastT(),t),t},enumerable:!0},distanceLimits:{get:function(){return c.getDistanceLimits(l)},set:function(t){return c.setDistanceLimits(t),t},enumerable:!0}}),t.addEventListener("contextmenu",function(t){return t.preventDefault(),!1});var m=0,g=0,v={shift:!1,control:!1,alt:!1,meta:!1};return a(t,r),t.addEventListener("touchstart",function(e){var n=s(e.changedTouches[0],t);r(0,n[0],n[1],v),r(1,n[0],n[1],v)}),t.addEventListener("touchmove",function(e){var n=s(e.changedTouches[0],t);r(1,n[0],n[1],v)}),t.addEventListener("touchend",function(e){s(e.changedTouches[0],t),r(0,m,g,v)}),o(t,function(t,e,r){var i=p.flipX?1:-1,a=p.flipY?1:-1,o=n();if(Math.abs(t)>Math.abs(e))c.rotate(o,0,0,-t*i*Math.PI*p.rotateSpeed/window.innerWidth);else{var s=p.zoomSpeed*a*e/window.innerHeight*(o-c.lastT())/100;c.pan(o,0,0,h*(Math.exp(s)-1))}},!0),p};var n=t("right-now"),i=t("3d-view"),a=t("mouse-change"),o=t("mouse-wheel"),s=t("mouse-event-offset")},{"3d-view":40,"mouse-change":455,"mouse-event-offset":456,"mouse-wheel":458,"right-now":513}],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}e.exports=function(t){var e=(t=t||{}).eye||[0,0,1],r=t.center||[0,0,0],s=t.up||[0,1,0],l=t.distanceLimits||[0,1/0],c=t.mode||"turntable",u=i(),h=a(),f=o();return u.setDistanceLimits(l[0],l[1]),u.lookAt(0,e,r,s),h.setDistanceLimits(l[0],l[1]),h.lookAt(0,e,r,s),f.setDistanceLimits(l[0],l[1]),f.lookAt(0,e,r,s),new n({turntable:u,orbit:h,matrix:f},c)};var i=t("turntable-camera-controller"),a=t("orbit-camera-controller"),o=t("matrix-camera-controller"),s=n.prototype;[["flush",1],["idle",1],["lookAt",4],["rotate",4],["pan",4],["translate",4],["setMatrix",2],["setDistanceLimits",2],["setDistance",2]].forEach(function(t){for(var e=t[0],r=[],n=0;n<t[1];++n)r.push("a"+n);var i="var cc=this._controllerList;for(var i=0;i<cc.length;++i){cc[i]."+t[0]+"("+r.join()+")}";s[e]=Function.apply(null,r.concat(i))}),s.recalcMatrix=function(t){this._active.recalcMatrix(t)},s.getDistance=function(t){return this._active.getDistance(t)},s.getDistanceLimits=function(t){return this._active.getDistanceLimits(t)},s.lastT=function(){return this._active.lastT()},s.setMode=function(t){if(t!==this._mode){var e=this._controllerNames.indexOf(t);if(!(e<0)){var r=this._active,n=this._controllerList[e],i=Math.max(r.lastT(),n.lastT());r.recalcMatrix(i),n.setMatrix(i,r.computedMatrix),this._active=n,this._mode=t,this.computedMatrix=this._active.computedMatrix,this.computedEye=this._active.computedEye,this.computedUp=this._active.computedUp,this.computedCenter=this._active.computedCenter,this.computedRadius=this._active.computedRadius}}},s.getMode=function(){return this._mode}},{"matrix-camera-controller":453,"orbit-camera-controller":476,"turntable-camera-controller":549}],41:[function(t,e,r){!function(n,i){"object"==typeof r&&void 0!==e?i(r,t("d3-array"),t("d3-collection"),t("d3-interpolate")):i(n.d3=n.d3||{},n.d3,n.d3,n.d3)}(this,function(t,e,r,n){"use strict";t.sankey=function(){function t(){for(var t,e=f,r=0;e.length;)t=[],e.forEach(function(e){e.x=r,e.dx=c,e.sourceLinks.forEach(function(e){t.indexOf(e.target)<0&&t.push(e.target)})}),e=t,++r;!function(t){f.forEach(function(e){e.sourceLinks.length||(e.x=t-1)})}(r),function(t){f.forEach(function(e){e.x*=t})}((h[0]-c)/(r-1))}function i(t){function n(){a.forEach(function(t){var e,r,n,a=0,o=t.length;for(t.sort(i),n=0;n<o;++n)(r=a-(e=t[n]).y)>0&&(e.y+=r),a=e.y+e.dy+u;if((r=a-u-h[1])>0)for(a=e.y-=r,n=o-2;n>=0;--n)(r=(e=t[n]).y+e.dy+u-a)>0&&(e.y-=r),a=e.y})}function i(t,e){return t.y-e.y}var a=r.nest().key(function(t){return t.x}).sortKeys(e.ascending).entries(f).map(function(t){return t.values});!function(){var t=e.min(a,function(t){return(h[1]-(t.length-1)*u)/e.sum(t,s)});a.forEach(function(e){e.forEach(function(e,r){e.y=r,e.dy=e.value*t})}),d.forEach(function(e){e.dy=e.value*t})}(),n();for(var l=1;t>0;--t)!function(t){function r(t){return o(t.target)*t.value}a.slice().reverse().forEach(function(n){n.forEach(function(n){if(n.sourceLinks.length){var i=e.sum(n.sourceLinks,r)/e.sum(n.sourceLinks,s);n.y+=(i-o(n))*t}})})}(l*=.99),n(),function(t){function r(t){return o(t.source)*t.value}a.forEach(function(n){n.forEach(function(n){if(n.targetLinks.length){var i=e.sum(n.targetLinks,r)/e.sum(n.targetLinks,s);n.y+=(i-o(n))*t}})})}(l),n()}function a(){function t(t,e){return t.source.y-e.source.y||t.originalIndex-e.originalIndex}function e(t,e){return t.target.y-e.target.y||t.originalIndex-e.originalIndex}f.forEach(function(r){r.sourceLinks.sort(e),r.targetLinks.sort(t)}),f.forEach(function(t){var e=0,r=0;t.sourceLinks.forEach(function(t){t.sy=e,e+=t.dy}),t.targetLinks.forEach(function(t){t.ty=r,r+=t.dy})})}function o(t){return t.y+t.dy/2}function s(t){return t.value}var l={},c=24,u=8,h=[1,1],f=[],d=[];return l.nodeWidth=function(t){return arguments.length?(c=+t,l):c},l.nodePadding=function(t){return arguments.length?(u=+t,l):u},l.nodes=function(t){return arguments.length?(f=t,l):f},l.links=function(t){return arguments.length?(d=t,l):d},l.size=function(t){return arguments.length?(h=t,l):h},l.layout=function(r){return f.forEach(function(t){t.sourceLinks=[],t.targetLinks=[]}),d.forEach(function(t,e){var r=t.source,n=t.target;"number"==typeof r&&(r=t.source=f[t.source]),"number"==typeof n&&(n=t.target=f[t.target]),t.originalIndex=e,r.sourceLinks.push(t),n.targetLinks.push(t)}),f.forEach(function(t){t.value=Math.max(e.sum(t.sourceLinks,s),e.sum(t.targetLinks,s))}),t(),i(r),a(),l},l.relayout=function(){return a(),l},l.link=function(){function t(t){var r=t.source.x+t.source.dx,i=t.target.x,a=n.interpolateNumber(r,i),o=a(e),s=a(1-e),l=t.source.y+t.sy,c=l+t.dy,u=t.target.y+t.ty,h=u+t.dy;return"M"+r+","+l+"C"+o+","+l+" "+s+","+u+" "+i+","+u+"L"+i+","+h+"C"+s+","+h+" "+o+","+c+" "+r+","+c+"Z"}var e=.5;return t.curvature=function(r){return arguments.length?(e=+r,t):e},t},l},Object.defineProperty(t,"__esModule",{value:!0})})},{"d3-array":117,"d3-collection":118,"d3-interpolate":122}],42:[function(t,e,r){"use strict";var n="undefined"==typeof WeakMap?t("weak-map"):WeakMap,i=t("gl-buffer"),a=t("gl-vao"),o=new n;e.exports=function(t){var e=o.get(t),r=e&&(e._triangleBuffer.handle||e._triangleBuffer.buffer);if(!r||!t.isBuffer(r)){var n=i(t,new Float32Array([-1,-1,-1,4,4,-1]));(e=a(t,[{buffer:n,type:t.FLOAT,size:2}]))._triangleBuffer=n,o.set(t,e)}e.bind(),t.drawArrays(t.TRIANGLES,0,3),e.unbind()}},{"gl-buffer":159,"gl-vao":274,"weak-map":570}],43:[function(t,e,r){var n=t("pad-left");e.exports=function(t,e,r){e="number"==typeof e?e:1,r=r||": ";var i=t.split(/\r?\n/),a=String(i.length+e-1).length;return i.map(function(t,i){var o=i+e,s=String(o).length;return n(o,a-s)+r+t}).join("\n")}},{"pad-left":477}],44:[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(n=0;n<=t.length;++n){for(var a=t.length;a<=e;++a){for(var o=new Array(e),s=0;s<e;++s)o[s]=Math.pow(a+1-n,s);r[a]=o}if(i.apply(void 0,r))return!0}return!1}e.exports=function(t){var e=t.length;if(0===e)return[];if(1===e)return[0];for(var r=t[0].length,i=[t[0]],a=[0],o=1;o<e;++o)if(i.push(t[o]),n(i,r)){if(a.push(o),a.length===r+1)return a}else i.pop();return a};var i=t("robust-orientation")},{"robust-orientation":519}],45:[function(t,e,r){"use strict";e.exports=function(t,e){return n(e).filter(function(r){for(var n=new Array(r.length),a=0;a<r.length;++a)n[a]=e[r[a]];return i(n)*t<1})};var n=t("delaunay-triangulate"),i=t("circumradius")},{circumradius:90,"delaunay-triangulate":126}],46:[function(t,e,r){e.exports=function(t,e){return i(n(t,e))};var n=t("alpha-complex"),i=t("simplicial-complex-boundary")},{"alpha-complex":45,"simplicial-complex-boundary":527}],47:[function(t,e,r){"use strict";e.exports=function(t,e){if(!t||null==t.length)throw Error("Argument should be an array");e=null==e?1:Math.floor(e);for(var r=Array(2*e),n=0;n<e;n++){for(var i=-1/0,a=1/0,o=n,s=t.length;o<s;o+=e)t[o]>i&&(i=t[o]),t[o]<a&&(a=t[o]);r[n]=a,r[e+n]=i}return r}},{}],48:[function(t,e,r){"use strict";var n=t("array-bounds");e.exports=function(t,e,r){if(!t||null==t.length)throw Error("Argument should be an array");null==e&&(e=1),null==r&&(r=n(t,e));for(var i=0;i<e;i++){var a=r[e+i],o=r[i],s=i,l=t.length;if(a===1/0&&o===-1/0)for(s=i;s<l;s+=e)t[s]=t[s]===a?1:t[s]===o?0:.5;else if(a===1/0)for(s=i;s<l;s+=e)t[s]=t[s]===a?1:0;else if(o===-1/0)for(s=i;s<l;s+=e)t[s]=t[s]===o?0:1;else{var c=a-o;for(s=i;s<l;s+=e)t[s]=(t[s]-o)/c}}return t}},{"array-bounds":47}],49:[function(t,e,r){"use strict";e.exports=function(){var t={},e=/^rgba?\(\s*\d{1,3}\s*,\s*\d{1,3}\s*,\s*\d{1,3}\s*(,.*)?\)$/,r=/^rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,?\s*(.*)?\)$/;return t.isPlainObject=function(t){return!Array.isArray(t)&&null!==t&&"object"==typeof t},t.linspace=function(t,e,r){for(var n=(e-t)/Math.max(r-1,1),i=[],a=0;a<r;a++)i.push(t+a*n);return i},t.zip3=function(t,e,r){for(var n=Math.min.apply(null,[t.length,e.length,r.length]),i=[],a=0;a<n;a++)i.push([t[a],e[a],r[a]]);return i},t.sum=function(t){function e(t){for(var n=0;n<t.length;n++)Array.isArray(t[n])?e(t[n]):r+=t[n]}var r=0;return e(t),r},t.zip=function(){for(var t=[].slice.call(arguments),e=t.map(function(t){return t.length}),r=Math.min.apply(null,e),n=[],i=0;i<r;i++){n[i]=[];for(var a=0;a<t.length;++a)n[i][a]=t[a][i]}return n},t.isEqual=function(t,e){if(t.length!==e.length)return!1;for(var r=t.length;r--;)if(t[r]!==e[r])return!1;return!0},t.copy2D=function(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},t.copy1D=function(t){for(var e=[],r=0;r<t.length;++r)e[r]=t[r];return e},t.str2RgbArray=function(t,n){var i,a;if("string"!=typeof t)return t;if(i=[],"#"===t[0]?(3===(t=t.substr(1)).length&&(t+=t),a=parseInt(t,16),i[0]=a>>16&255,i[1]=a>>8&255,i[2]=255&a):e.test(t)&&(a=t.match(r),i[0]=parseInt(a[1]),i[1]=parseInt(a[2]),i[2]=parseInt(a[3])),!n)for(var o=0;o<3;++o)i[o]=i[o]/255;return i},t.str2RgbaArray=function(t,n){var i,a;if("string"!=typeof t)return t;if(i=[],"#"===t[0]?(3===(t=t.substr(1)).length&&(t+=t),a=parseInt(t,16),i[0]=a>>16&255,i[1]=a>>8&255,i[2]=255&a):e.test(t)&&(a=t.match(r),i[0]=parseInt(a[1]),i[1]=parseInt(a[2]),i[2]=parseInt(a[3]),a[4]?i[3]=parseFloat(a[4]):i[3]=1),!n)for(var o=0;o<3;++o)i[o]=i[o]/255;return i},t}()},{}],50:[function(t,e,r){(function(r){"use strict";function n(t,e){if(t===e)return 0;for(var r=t.length,n=e.length,i=0,a=Math.min(r,n);i<a;++i)if(t[i]!==e[i]){r=t[i],n=e[i];break}return r<n?-1:n<r?1:0}function i(t){return r.Buffer&&"function"==typeof r.Buffer.isBuffer?r.Buffer.isBuffer(t):!(null==t||!t._isBuffer)}function a(t){return Object.prototype.toString.call(t)}function o(t){return!i(t)&&("function"==typeof r.ArrayBuffer&&("function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(t):!!t&&(t instanceof DataView||!!(t.buffer&&t.buffer instanceof ArrayBuffer))))}function s(t){if(v.isFunction(t)){if(x)return t.name;var e=t.toString().match(w);return e&&e[1]}}function l(t,e){return"string"==typeof t?t.length<e?t:t.slice(0,e):t}function c(t){if(x||!v.isFunction(t))return v.inspect(t);var e=s(t);return"[Function"+(e?": "+e:"")+"]"}function u(t,e,r,n,i){throw new _.AssertionError({message:r,actual:t,expected:e,operator:n,stackStartFunction:i})}function h(t,e){t||u(t,!0,e,"==",_.ok)}function f(t,e,r,s){if(t===e)return!0;if(i(t)&&i(e))return 0===n(t,e);if(v.isDate(t)&&v.isDate(e))return t.getTime()===e.getTime();if(v.isRegExp(t)&&v.isRegExp(e))return t.source===e.source&&t.global===e.global&&t.multiline===e.multiline&&t.lastIndex===e.lastIndex&&t.ignoreCase===e.ignoreCase;if(null!==t&&"object"==typeof t||null!==e&&"object"==typeof e){if(o(t)&&o(e)&&a(t)===a(e)&&!(t instanceof Float32Array||t instanceof Float64Array))return 0===n(new Uint8Array(t.buffer),new Uint8Array(e.buffer));if(i(t)!==i(e))return!1;var l=(s=s||{actual:[],expected:[]}).actual.indexOf(t);return-1!==l&&l===s.expected.indexOf(e)||(s.actual.push(t),s.expected.push(e),function(t,e,r,n){if(null===t||void 0===t||null===e||void 0===e)return!1;if(v.isPrimitive(t)||v.isPrimitive(e))return t===e;if(r&&Object.getPrototypeOf(t)!==Object.getPrototypeOf(e))return!1;var i=d(t),a=d(e);if(i&&!a||!i&&a)return!1;if(i)return t=b.call(t),e=b.call(e),f(t,e,r);var o,s,l=M(t),c=M(e);if(l.length!==c.length)return!1;for(l.sort(),c.sort(),s=l.length-1;s>=0;s--)if(l[s]!==c[s])return!1;for(s=l.length-1;s>=0;s--)if(o=l[s],!f(t[o],e[o],r,n))return!1;return!0}(t,e,r,s))}return r?t===e:t==e}function d(t){return"[object Arguments]"==Object.prototype.toString.call(t)}function p(t,e,r){f(t,e,!0)&&u(t,e,r,"notDeepStrictEqual",p)}function m(t,e){if(!t||!e)return!1;if("[object RegExp]"==Object.prototype.toString.call(e))return e.test(t);try{if(t instanceof e)return!0}catch(t){}return!Error.isPrototypeOf(e)&&!0===e.call({},t)}function g(t,e,r,n){var i;if("function"!=typeof e)throw new TypeError('"block" argument must be a function');"string"==typeof r&&(n=r,r=null),i=function(t){var e;try{t()}catch(t){e=t}return e}(e),n=(r&&r.name?" ("+r.name+").":".")+(n?" "+n:"."),t&&!i&&u(i,r,"Missing expected exception"+n);var a="string"==typeof n,o=!t&&v.isError(i),s=!t&&i&&!r;if((o&&a&&m(i,r)||s)&&u(i,r,"Got unwanted exception"+n),t&&i&&r&&!m(i,r)||!t&&i)throw i}var v=t("util/"),y=Object.prototype.hasOwnProperty,b=Array.prototype.slice,x="foo"===function(){}.name,_=e.exports=h,w=/\s*function\s+([^\(\s]*)\s*/;_.AssertionError=function(t){this.name="AssertionError",this.actual=t.actual,this.expected=t.expected,this.operator=t.operator,t.message?(this.message=t.message,this.generatedMessage=!1):(this.message=function(t){return l(c(t.actual),128)+" "+t.operator+" "+l(c(t.expected),128)}(this),this.generatedMessage=!0);var e=t.stackStartFunction||u;if(Error.captureStackTrace)Error.captureStackTrace(this,e);else{var r=new Error;if(r.stack){var n=r.stack,i=s(e),a=n.indexOf("\n"+i);if(a>=0){var o=n.indexOf("\n",a+1);n=n.substring(o+1)}this.stack=n}}},v.inherits(_.AssertionError,Error),_.fail=u,_.ok=h,_.equal=function(t,e,r){t!=e&&u(t,e,r,"==",_.equal)},_.notEqual=function(t,e,r){t==e&&u(t,e,r,"!=",_.notEqual)},_.deepEqual=function(t,e,r){f(t,e,!1)||u(t,e,r,"deepEqual",_.deepEqual)},_.deepStrictEqual=function(t,e,r){f(t,e,!0)||u(t,e,r,"deepStrictEqual",_.deepStrictEqual)},_.notDeepEqual=function(t,e,r){f(t,e,!1)&&u(t,e,r,"notDeepEqual",_.notDeepEqual)},_.notDeepStrictEqual=p,_.strictEqual=function(t,e,r){t!==e&&u(t,e,r,"===",_.strictEqual)},_.notStrictEqual=function(t,e,r){t===e&&u(t,e,r,"!==",_.notStrictEqual)},_.throws=function(t,e,r){g(!0,t,e,r)},_.doesNotThrow=function(t,e,r){g(!1,t,e,r)},_.ifError=function(t){if(t)throw t};var M=Object.keys||function(t){var e=[];for(var r in t)y.call(t,r)&&e.push(r);return e}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"util/":560}],51:[function(t,e,r){e.exports=function(t){return atob(t)}},{}],52:[function(t,e,r){"use strict";function n(t){for(var e=0,r=0;r<t.length;++r)e+=t[r];return e}e.exports=function(t,e){for(var r=e.length,a=new Array(r+1),o=0;o<r;++o){for(var s=new Array(r+1),l=0;l<=r;++l)s[l]=t[l][o];a[o]=s}for(a[r]=new Array(r+1),o=0;o<=r;++o)a[r][o]=1;for(var c=new Array(r+1),o=0;o<r;++o)c[o]=e[o];c[r]=1;var u=i(a,c),h=n(u[r+1]);0===h&&(h=1);for(var f=new Array(r+1),o=0;o<=r;++o)f[o]=n(u[o])/h;return f};var i=t("robust-linear-solve")},{"robust-linear-solve":518}],53:[function(t,e,r){"use strict";var n=t("./lib/rationalize");e.exports=function(t,e){return n(t[0].mul(e[1]).add(e[0].mul(t[1])),t[1].mul(e[1]))}},{"./lib/rationalize":63}],54:[function(t,e,r){"use strict";e.exports=function(t,e){return t[0].mul(e[1]).cmp(e[0].mul(t[1]))}},{}],55:[function(t,e,r){"use strict";var n=t("./lib/rationalize");e.exports=function(t,e){return n(t[0].mul(e[1]),t[1].mul(e[0]))}},{"./lib/rationalize":63}],56:[function(t,e,r){"use strict";function n(t,e){if(i(t))return e?c(t,n(e)):[t[0].clone(),t[1].clone()];var r,u,h=0;if(a(t))r=t.clone();else if("string"==typeof t)r=s(t);else{if(0===t)return[o(0),o(1)];if(t===Math.floor(t))r=o(t);else{for(;t!==Math.floor(t);)t*=Math.pow(2,256),h-=256;r=o(t)}}if(i(e))r.mul(e[1]),u=e[0].clone();else if(a(e))u=e.clone();else if("string"==typeof e)u=s(e);else if(e)if(e===Math.floor(e))u=o(e);else{for(;e!==Math.floor(e);)e*=Math.pow(2,256),h+=256;u=o(e)}else u=o(1);return h>0?r=r.ushln(h):h<0&&(u=u.ushln(-h)),l(r,u)}var i=t("./is-rat"),a=t("./lib/is-bn"),o=t("./lib/num-to-bn"),s=t("./lib/str-to-bn"),l=t("./lib/rationalize"),c=t("./div");e.exports=n},{"./div":55,"./is-rat":57,"./lib/is-bn":61,"./lib/num-to-bn":62,"./lib/rationalize":63,"./lib/str-to-bn":64}],57:[function(t,e,r){"use strict";var n=t("./lib/is-bn");e.exports=function(t){return Array.isArray(t)&&2===t.length&&n(t[0])&&n(t[1])}},{"./lib/is-bn":61}],58:[function(t,e,r){"use strict";var n=t("bn.js");e.exports=function(t){return t.cmp(new n(0))}},{"bn.js":71}],59:[function(t,e,r){"use strict";var n=t("./bn-sign");e.exports=function(t){var e=t.length,r=t.words,i=0;if(1===e)i=r[0];else if(2===e)i=r[0]+67108864*r[1];else for(var a=0;a<e;a++)i+=r[a]*Math.pow(67108864,a);return n(t)*i}},{"./bn-sign":58}],60:[function(t,e,r){"use strict";var n=t("double-bits"),i=t("bit-twiddle").countTrailingZeros;e.exports=function(t){var e=i(n.lo(t));if(e<32)return e;var r=i(n.hi(t));return r>20?52:r+32}},{"bit-twiddle":70,"double-bits":127}],61:[function(t,e,r){"use strict";t("bn.js");e.exports=function(t){return t&&"object"==typeof t&&Boolean(t.words)}},{"bn.js":71}],62:[function(t,e,r){"use strict";var n=t("bn.js"),i=t("double-bits");e.exports=function(t){var e=i.exponent(t);return e<52?new n(t):new n(t*Math.pow(2,52-e)).ushln(e-52)}},{"bn.js":71,"double-bits":127}],63:[function(t,e,r){"use strict";var n=t("./num-to-bn"),i=t("./bn-sign");e.exports=function(t,e){var r=i(t),a=i(e);if(0===r)return[n(0),n(1)];if(0===a)return[n(0),n(0)];a<0&&(t=t.neg(),e=e.neg());var o=t.gcd(e);return o.cmpn(1)?[t.div(o),e.div(o)]:[t,e]}},{"./bn-sign":58,"./num-to-bn":62}],64:[function(t,e,r){"use strict";var n=t("bn.js");e.exports=function(t){return new n(t)}},{"bn.js":71}],65:[function(t,e,r){"use strict";var n=t("./lib/rationalize");e.exports=function(t,e){return n(t[0].mul(e[0]),t[1].mul(e[1]))}},{"./lib/rationalize":63}],66:[function(t,e,r){"use strict";var n=t("./lib/bn-sign");e.exports=function(t){return n(t[0])*n(t[1])}},{"./lib/bn-sign":58}],67:[function(t,e,r){"use strict";var n=t("./lib/rationalize");e.exports=function(t,e){return n(t[0].mul(e[1]).sub(t[1].mul(e[0])),t[1].mul(e[1]))}},{"./lib/rationalize":63}],68:[function(t,e,r){"use strict";var n=t("./lib/bn-to-num"),i=t("./lib/ctz");e.exports=function(t){var e=t[0],r=t[1];if(0===e.cmpn(0))return 0;var a=e.abs().divmod(r.abs()),o=a.div,s=n(o),l=a.mod,c=e.negative!==r.negative?-1:1;if(0===l.cmpn(0))return c*s;if(s){var u=i(s)+4;return c*(s+(f=n(l.ushln(u).divRound(r)))*Math.pow(2,-u))}var h=r.bitLength()-l.bitLength()+53,f=n(l.ushln(h).divRound(r));return h<1023?c*f*Math.pow(2,-h):(f*=Math.pow(2,-1023),c*f*Math.pow(2,1023-h))}},{"./lib/bn-to-num":59,"./lib/ctz":60}],69:[function(t,e,r){"use strict";function n(t,e,r,n,i,a){var o=["function ",t,"(a,l,h,",n.join(","),"){",a?"":"var i=",r?"l-1":"h+1",";while(l<=h){var m=(l+h)>>>1,x=a",i?".get(m)":"[m]"];return a?e.indexOf("c")<0?o.push(";if(x===y){return m}else if(x<=y){"):o.push(";var p=c(x,y);if(p===0){return m}else if(p<=0){"):o.push(";if(",e,"){i=m;"),r?o.push("l=m+1}else{h=m-1}"):o.push("h=m-1}else{l=m+1}"),o.push("}"),a?o.push("return -1};"):o.push("return i};"),o.join("")}function i(t,e,r,i){return new Function([n("A","x"+t+"y",e,["y"],!1,i),n("B","x"+t+"y",e,["y"],!0,i),n("P","c(x,y)"+t+"0",e,["y","c"],!1,i),n("Q","c(x,y)"+t+"0",e,["y","c"],!0,i),"function dispatchBsearch",r,"(a,y,c,l,h){if(a.shape){if(typeof(c)==='function'){return Q(a,(l===undefined)?0:l|0,(h===undefined)?a.shape[0]-1:h|0,y,c)}else{return B(a,(c===undefined)?0:c|0,(l===undefined)?a.shape[0]-1:l|0,y)}}else{if(typeof(c)==='function'){return P(a,(l===undefined)?0:l|0,(h===undefined)?a.length-1:h|0,y,c)}else{return A(a,(c===undefined)?0:c|0,(l===undefined)?a.length-1:l|0,y)}}}return dispatchBsearch",r].join(""))()}e.exports={ge:i(">=",!1,"GE"),gt:i(">",!1,"GT"),lt:i("<",!0,"LT"),le:i("<=",!0,"LE"),eq:i("-",!0,"EQ",!0)}},{}],70:[function(t,e,r){"use strict";"use restrict";function n(t){var e=32;return(t&=-t)&&e--,65535&t&&(e-=16),16711935&t&&(e-=8),252645135&t&&(e-=4),858993459&t&&(e-=2),1431655765&t&&(e-=1),e}r.INT_BITS=32,r.INT_MAX=2147483647,r.INT_MIN=-1<<31,r.sign=function(t){return(t>0)-(t<0)},r.abs=function(t){var e=t>>31;return(t^e)-e},r.min=function(t,e){return e^(t^e)&-(t<e)},r.max=function(t,e){return t^(t^e)&-(t<e)},r.isPow2=function(t){return!(t&t-1||!t)},r.log2=function(t){var e,r;return e=(t>65535)<<4,t>>>=e,r=(t>255)<<3,t>>>=r,e|=r,r=(t>15)<<2,t>>>=r,e|=r,r=(t>3)<<1,t>>>=r,(e|=r)|t>>1},r.log10=function(t){return t>=1e9?9:t>=1e8?8:t>=1e7?7:t>=1e6?6:t>=1e5?5:t>=1e4?4:t>=1e3?3:t>=100?2:t>=10?1:0},r.popCount=function(t){return t-=t>>>1&1431655765,16843009*((t=(858993459&t)+(t>>>2&858993459))+(t>>>4)&252645135)>>>24},r.countTrailingZeros=n,r.nextPow2=function(t){return t+=0===t,--t,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,(t|=t>>>16)+1},r.prevPow2=function(t){return t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,(t|=t>>>16)-(t>>>1)},r.parity=function(t){return t^=t>>>16,t^=t>>>8,t^=t>>>4,27030>>>(t&=15)&1};var i=new Array(256);!function(t){for(var e=0;e<256;++e){var r=e,n=e,i=7;for(r>>>=1;r;r>>>=1)n<<=1,n|=1&r,--i;t[e]=n<<i&255}}(i),r.reverse=function(t){return i[255&t]<<24|i[t>>>8&255]<<16|i[t>>>16&255]<<8|i[t>>>24&255]},r.interleave2=function(t,e){return t&=65535,t=16711935&(t|t<<8),t=252645135&(t|t<<4),t=858993459&(t|t<<2),t=1431655765&(t|t<<1),e&=65535,e=16711935&(e|e<<8),e=252645135&(e|e<<4),e=858993459&(e|e<<2),e=1431655765&(e|e<<1),t|e<<1},r.deinterleave2=function(t,e){return t=t>>>e&1431655765,t=858993459&(t|t>>>1),t=252645135&(t|t>>>2),t=16711935&(t|t>>>4),(t=65535&(t|t>>>16))<<16>>16},r.interleave3=function(t,e,r){return t&=1023,t=4278190335&(t|t<<16),t=251719695&(t|t<<8),t=3272356035&(t|t<<4),t=1227133513&(t|t<<2),e&=1023,e=4278190335&(e|e<<16),e=251719695&(e|e<<8),e=3272356035&(e|e<<4),e=1227133513&(e|e<<2),t|=e<<1,r&=1023,r=4278190335&(r|r<<16),r=251719695&(r|r<<8),r=3272356035&(r|r<<4),r=1227133513&(r|r<<2),t|r<<2},r.deinterleave3=function(t,e){return t=t>>>e&1227133513,t=3272356035&(t|t>>>2),t=251719695&(t|t>>>4),t=4278190335&(t|t>>>8),(t=1023&(t|t>>>16))<<22>>22},r.nextCombination=function(t){var e=t|t-1;return e+1|(~e&-~e)-1>>>n(t)+1}},{}],71:[function(t,e,r){!function(e,r){"use strict";function n(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function a(t,e,r){if(a.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}function o(t,e,r){for(var n=0,i=Math.min(t.length,r),a=e;a<i;a++){var o=t.charCodeAt(a)-48;n<<=4,n|=o>=49&&o<=54?o-49+10:o>=17&&o<=22?o-17+10:15&o}return n}function s(t,e,r,n){for(var i=0,a=Math.min(t.length,r),o=e;o<a;o++){var s=t.charCodeAt(o)-48;i*=n,i+=s>=49?s-49+10:s>=17?s-17+10:s}return i}function l(t,e,r){r.negative=e.negative^t.negative;var n=t.length+e.length|0;r.length=n,n=n-1|0;var i=0|t.words[0],a=0|e.words[0],o=i*a,s=67108863&o,l=o/67108864|0;r.words[0]=s;for(var c=1;c<n;c++){for(var u=l>>>26,h=67108863&l,f=Math.min(c,e.length-1),d=Math.max(0,c-t.length+1);d<=f;d++){var p=c-d|0;u+=(o=(i=0|t.words[p])*(a=0|e.words[d])+h)/67108864|0,h=67108863&o}r.words[c]=0|h,l=0|u}return 0!==l?r.words[c]=0|l:r.length--,r.strip()}function c(t,e,r){return(new u).mulp(t,e,r)}function u(t,e){this.x=t,this.y=e}function h(t,e){this.name=t,this.p=new a(e,16),this.n=this.p.bitLength(),this.k=new a(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function f(){h.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function d(){h.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function p(){h.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function m(){h.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function g(t){if("string"==typeof t){var e=a._prime(t);this.m=e.p,this.prime=e}else n(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function v(t){g.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new a(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}"object"==typeof e?e.exports=a:r.BN=a,a.BN=a,a.wordSize=26;var y;try{y=t("buffer").Buffer}catch(t){}a.isBN=function(t){return t instanceof a||null!==t&&"object"==typeof t&&t.constructor.wordSize===a.wordSize&&Array.isArray(t.words)},a.max=function(t,e){return t.cmp(e)>0?t:e},a.min=function(t,e){return t.cmp(e)<0?t:e},a.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),n(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&i++,16===e?this._parseHex(t,i):this._parseBase(t,e,i),"-"===t[0]&&(this.negative=1),this.strip(),"le"===r&&this._initArray(this.toArray(),e,r)},a.prototype._initNumber=function(t,e,r){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(n(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),e,r)},a.prototype._initArray=function(t,e,r){if(n("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var a,o,s=0;if("be"===r)for(i=t.length-1,a=0;i>=0;i-=3)o=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[a]|=o<<s&67108863,this.words[a+1]=o>>>26-s&67108863,(s+=24)>=26&&(s-=26,a++);else if("le"===r)for(i=0,a=0;i<t.length;i+=3)o=t[i]|t[i+1]<<8|t[i+2]<<16,this.words[a]|=o<<s&67108863,this.words[a+1]=o>>>26-s&67108863,(s+=24)>=26&&(s-=26,a++);return this.strip()},a.prototype._parseHex=function(t,e){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;var n,i,a=0;for(r=t.length-6,n=0;r>=e;r-=6)i=o(t,r,r+6),this.words[n]|=i<<a&67108863,this.words[n+1]|=i>>>26-a&4194303,(a+=24)>=26&&(a-=26,n++);r+6!==e&&(i=o(t,e,r+6),this.words[n]|=i<<a&67108863,this.words[n+1]|=i>>>26-a&4194303),this.strip()},a.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=e)n++;n--,i=i/e|0;for(var a=t.length-r,o=a%n,l=Math.min(a,a-o)+r,c=0,u=r;u<l;u+=n)c=s(t,u,u+n,e),this.imuln(i),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c);if(0!==o){var h=1;for(c=s(t,u,t.length,e),u=0;u<o;u++)h*=e;this.imuln(h),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c)}},a.prototype.copy=function(t){t.words=new Array(this.length);for(var e=0;e<this.length;e++)t.words[e]=this.words[e];t.length=this.length,t.negative=this.negative,t.red=this.red},a.prototype.clone=function(){var t=new a(null);return this.copy(t),t},a.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},a.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},a.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},a.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var b=["","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"],x=[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],_=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];a.prototype.toString=function(t,e){t=t||10,e=0|e||1;var r;if(16===t||"hex"===t){r="";for(var i=0,a=0,o=0;o<this.length;o++){var s=this.words[o],l=(16777215&(s<<i|a)).toString(16);r=0!==(a=s>>>24-i&16777215)||o!==this.length-1?b[6-l.length]+l+r:l+r,(i+=2)>=26&&(i-=26,o--)}for(0!==a&&(r=a.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var c=x[t],u=_[t];r="";var h=this.clone();for(h.negative=0;!h.isZero();){var f=h.modn(u).toString(t);r=(h=h.idivn(u)).isZero()?f+r:b[c-f.length]+f+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},a.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},a.prototype.toJSON=function(){return this.toString(16)},a.prototype.toBuffer=function(t,e){return n(void 0!==y),this.toArrayLike(y,t,e)},a.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},a.prototype.toArrayLike=function(t,e,r){var i=this.byteLength(),a=r||Math.max(1,i);n(i<=a,"byte array longer than desired length"),n(a>0,"Requested array length <= 0"),this.strip();var o,s,l="le"===e,c=new t(a),u=this.clone();if(l){for(s=0;!u.isZero();s++)o=u.andln(255),u.iushrn(8),c[s]=o;for(;s<a;s++)c[s]=0}else{for(s=0;s<a-i;s++)c[s]=0;for(s=0;!u.isZero();s++)o=u.andln(255),u.iushrn(8),c[a-s-1]=o}return c},Math.clz32?a.prototype._countBits=function(t){return 32-Math.clz32(t)}:a.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},a.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},a.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},a.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var r=this._zeroBits(this.words[e]);if(t+=r,26!==r)break}return t},a.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},a.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},a.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},a.prototype.isNeg=function(){return 0!==this.negative},a.prototype.neg=function(){return this.clone().ineg()},a.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},a.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var e=0;e<t.length;e++)this.words[e]=this.words[e]|t.words[e];return this.strip()},a.prototype.ior=function(t){return n(0==(this.negative|t.negative)),this.iuor(t)},a.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},a.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},a.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;r<e.length;r++)this.words[r]=this.words[r]&t.words[r];return this.length=e.length,this.strip()},a.prototype.iand=function(t){return n(0==(this.negative|t.negative)),this.iuand(t)},a.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},a.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},a.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;n<r.length;n++)this.words[n]=e.words[n]^r.words[n];if(this!==e)for(;n<e.length;n++)this.words[n]=e.words[n];return this.length=e.length,this.strip()},a.prototype.ixor=function(t){return n(0==(this.negative|t.negative)),this.iuxor(t)},a.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},a.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},a.prototype.inotn=function(t){n("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var i=0;i<e;i++)this.words[i]=67108863&~this.words[i];return r>0&&(this.words[i]=~this.words[i]&67108863>>26-r),this.strip()},a.prototype.notn=function(t){return this.clone().inotn(t)},a.prototype.setn=function(t,e){n("number"==typeof t&&t>=0);var r=t/26|0,i=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<<i:this.words[r]&~(1<<i),this.strip()},a.prototype.iadd=function(t){var e;if(0!==this.negative&&0===t.negative)return this.negative=0,e=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,e=this.isub(t),t.negative=1,e._normSign();var r,n;this.length>t.length?(r=this,n=t):(r=t,n=this);for(var i=0,a=0;a<n.length;a++)e=(0|r.words[a])+(0|n.words[a])+i,this.words[a]=67108863&e,i=e>>>26;for(;0!==i&&a<r.length;a++)e=(0|r.words[a])+i,this.words[a]=67108863&e,i=e>>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;a<r.length;a++)this.words[a]=r.words[a];return this},a.prototype.add=function(t){var e;return 0!==t.negative&&0===this.negative?(t.negative=0,e=this.sub(t),t.negative^=1,e):0===t.negative&&0!==this.negative?(this.negative=0,e=t.sub(this),this.negative=1,e):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},a.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r=this.cmp(t);if(0===r)return this.negative=0,this.length=1,this.words[0]=0,this;var n,i;r>0?(n=this,i=t):(n=t,i=this);for(var a=0,o=0;o<i.length;o++)a=(e=(0|n.words[o])-(0|i.words[o])+a)>>26,this.words[o]=67108863&e;for(;0!==a&&o<n.length;o++)a=(e=(0|n.words[o])+a)>>26,this.words[o]=67108863&e;if(0===a&&o<n.length&&n!==this)for(;o<n.length;o++)this.words[o]=n.words[o];return this.length=Math.max(this.length,o),n!==this&&(this.negative=1),this.strip()},a.prototype.sub=function(t){return this.clone().isub(t)};var w=function(t,e,r){var n,i,a,o=t.words,s=e.words,l=r.words,c=0,u=0|o[0],h=8191&u,f=u>>>13,d=0|o[1],p=8191&d,m=d>>>13,g=0|o[2],v=8191&g,y=g>>>13,b=0|o[3],x=8191&b,_=b>>>13,w=0|o[4],M=8191&w,k=w>>>13,T=0|o[5],A=8191&T,S=T>>>13,E=0|o[6],L=8191&E,C=E>>>13,I=0|o[7],z=8191&I,D=I>>>13,P=0|o[8],O=8191&P,R=P>>>13,F=0|o[9],j=8191&F,N=F>>>13,B=0|s[0],U=8191&B,V=B>>>13,H=0|s[1],q=8191&H,G=H>>>13,Y=0|s[2],W=8191&Y,X=Y>>>13,Z=0|s[3],J=8191&Z,K=Z>>>13,Q=0|s[4],$=8191&Q,tt=Q>>>13,et=0|s[5],rt=8191&et,nt=et>>>13,it=0|s[6],at=8191&it,ot=it>>>13,st=0|s[7],lt=8191&st,ct=st>>>13,ut=0|s[8],ht=8191&ut,ft=ut>>>13,dt=0|s[9],pt=8191&dt,mt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var gt=(c+(n=Math.imul(h,U))|0)+((8191&(i=(i=Math.imul(h,V))+Math.imul(f,U)|0))<<13)|0;c=((a=Math.imul(f,V))+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,n=Math.imul(p,U),i=(i=Math.imul(p,V))+Math.imul(m,U)|0,a=Math.imul(m,V);var vt=(c+(n=n+Math.imul(h,q)|0)|0)+((8191&(i=(i=i+Math.imul(h,G)|0)+Math.imul(f,q)|0))<<13)|0;c=((a=a+Math.imul(f,G)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(v,U),i=(i=Math.imul(v,V))+Math.imul(y,U)|0,a=Math.imul(y,V),n=n+Math.imul(p,q)|0,i=(i=i+Math.imul(p,G)|0)+Math.imul(m,q)|0,a=a+Math.imul(m,G)|0;var yt=(c+(n=n+Math.imul(h,W)|0)|0)+((8191&(i=(i=i+Math.imul(h,X)|0)+Math.imul(f,W)|0))<<13)|0;c=((a=a+Math.imul(f,X)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(x,U),i=(i=Math.imul(x,V))+Math.imul(_,U)|0,a=Math.imul(_,V),n=n+Math.imul(v,q)|0,i=(i=i+Math.imul(v,G)|0)+Math.imul(y,q)|0,a=a+Math.imul(y,G)|0,n=n+Math.imul(p,W)|0,i=(i=i+Math.imul(p,X)|0)+Math.imul(m,W)|0,a=a+Math.imul(m,X)|0;var bt=(c+(n=n+Math.imul(h,J)|0)|0)+((8191&(i=(i=i+Math.imul(h,K)|0)+Math.imul(f,J)|0))<<13)|0;c=((a=a+Math.imul(f,K)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(M,U),i=(i=Math.imul(M,V))+Math.imul(k,U)|0,a=Math.imul(k,V),n=n+Math.imul(x,q)|0,i=(i=i+Math.imul(x,G)|0)+Math.imul(_,q)|0,a=a+Math.imul(_,G)|0,n=n+Math.imul(v,W)|0,i=(i=i+Math.imul(v,X)|0)+Math.imul(y,W)|0,a=a+Math.imul(y,X)|0,n=n+Math.imul(p,J)|0,i=(i=i+Math.imul(p,K)|0)+Math.imul(m,J)|0,a=a+Math.imul(m,K)|0;var xt=(c+(n=n+Math.imul(h,$)|0)|0)+((8191&(i=(i=i+Math.imul(h,tt)|0)+Math.imul(f,$)|0))<<13)|0;c=((a=a+Math.imul(f,tt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(A,U),i=(i=Math.imul(A,V))+Math.imul(S,U)|0,a=Math.imul(S,V),n=n+Math.imul(M,q)|0,i=(i=i+Math.imul(M,G)|0)+Math.imul(k,q)|0,a=a+Math.imul(k,G)|0,n=n+Math.imul(x,W)|0,i=(i=i+Math.imul(x,X)|0)+Math.imul(_,W)|0,a=a+Math.imul(_,X)|0,n=n+Math.imul(v,J)|0,i=(i=i+Math.imul(v,K)|0)+Math.imul(y,J)|0,a=a+Math.imul(y,K)|0,n=n+Math.imul(p,$)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(m,$)|0,a=a+Math.imul(m,tt)|0;var _t=(c+(n=n+Math.imul(h,rt)|0)|0)+((8191&(i=(i=i+Math.imul(h,nt)|0)+Math.imul(f,rt)|0))<<13)|0;c=((a=a+Math.imul(f,nt)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(L,U),i=(i=Math.imul(L,V))+Math.imul(C,U)|0,a=Math.imul(C,V),n=n+Math.imul(A,q)|0,i=(i=i+Math.imul(A,G)|0)+Math.imul(S,q)|0,a=a+Math.imul(S,G)|0,n=n+Math.imul(M,W)|0,i=(i=i+Math.imul(M,X)|0)+Math.imul(k,W)|0,a=a+Math.imul(k,X)|0,n=n+Math.imul(x,J)|0,i=(i=i+Math.imul(x,K)|0)+Math.imul(_,J)|0,a=a+Math.imul(_,K)|0,n=n+Math.imul(v,$)|0,i=(i=i+Math.imul(v,tt)|0)+Math.imul(y,$)|0,a=a+Math.imul(y,tt)|0,n=n+Math.imul(p,rt)|0,i=(i=i+Math.imul(p,nt)|0)+Math.imul(m,rt)|0,a=a+Math.imul(m,nt)|0;var wt=(c+(n=n+Math.imul(h,at)|0)|0)+((8191&(i=(i=i+Math.imul(h,ot)|0)+Math.imul(f,at)|0))<<13)|0;c=((a=a+Math.imul(f,ot)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(z,U),i=(i=Math.imul(z,V))+Math.imul(D,U)|0,a=Math.imul(D,V),n=n+Math.imul(L,q)|0,i=(i=i+Math.imul(L,G)|0)+Math.imul(C,q)|0,a=a+Math.imul(C,G)|0,n=n+Math.imul(A,W)|0,i=(i=i+Math.imul(A,X)|0)+Math.imul(S,W)|0,a=a+Math.imul(S,X)|0,n=n+Math.imul(M,J)|0,i=(i=i+Math.imul(M,K)|0)+Math.imul(k,J)|0,a=a+Math.imul(k,K)|0,n=n+Math.imul(x,$)|0,i=(i=i+Math.imul(x,tt)|0)+Math.imul(_,$)|0,a=a+Math.imul(_,tt)|0,n=n+Math.imul(v,rt)|0,i=(i=i+Math.imul(v,nt)|0)+Math.imul(y,rt)|0,a=a+Math.imul(y,nt)|0,n=n+Math.imul(p,at)|0,i=(i=i+Math.imul(p,ot)|0)+Math.imul(m,at)|0,a=a+Math.imul(m,ot)|0;var Mt=(c+(n=n+Math.imul(h,lt)|0)|0)+((8191&(i=(i=i+Math.imul(h,ct)|0)+Math.imul(f,lt)|0))<<13)|0;c=((a=a+Math.imul(f,ct)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(O,U),i=(i=Math.imul(O,V))+Math.imul(R,U)|0,a=Math.imul(R,V),n=n+Math.imul(z,q)|0,i=(i=i+Math.imul(z,G)|0)+Math.imul(D,q)|0,a=a+Math.imul(D,G)|0,n=n+Math.imul(L,W)|0,i=(i=i+Math.imul(L,X)|0)+Math.imul(C,W)|0,a=a+Math.imul(C,X)|0,n=n+Math.imul(A,J)|0,i=(i=i+Math.imul(A,K)|0)+Math.imul(S,J)|0,a=a+Math.imul(S,K)|0,n=n+Math.imul(M,$)|0,i=(i=i+Math.imul(M,tt)|0)+Math.imul(k,$)|0,a=a+Math.imul(k,tt)|0,n=n+Math.imul(x,rt)|0,i=(i=i+Math.imul(x,nt)|0)+Math.imul(_,rt)|0,a=a+Math.imul(_,nt)|0,n=n+Math.imul(v,at)|0,i=(i=i+Math.imul(v,ot)|0)+Math.imul(y,at)|0,a=a+Math.imul(y,ot)|0,n=n+Math.imul(p,lt)|0,i=(i=i+Math.imul(p,ct)|0)+Math.imul(m,lt)|0,a=a+Math.imul(m,ct)|0;var kt=(c+(n=n+Math.imul(h,ht)|0)|0)+((8191&(i=(i=i+Math.imul(h,ft)|0)+Math.imul(f,ht)|0))<<13)|0;c=((a=a+Math.imul(f,ft)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(j,U),i=(i=Math.imul(j,V))+Math.imul(N,U)|0,a=Math.imul(N,V),n=n+Math.imul(O,q)|0,i=(i=i+Math.imul(O,G)|0)+Math.imul(R,q)|0,a=a+Math.imul(R,G)|0,n=n+Math.imul(z,W)|0,i=(i=i+Math.imul(z,X)|0)+Math.imul(D,W)|0,a=a+Math.imul(D,X)|0,n=n+Math.imul(L,J)|0,i=(i=i+Math.imul(L,K)|0)+Math.imul(C,J)|0,a=a+Math.imul(C,K)|0,n=n+Math.imul(A,$)|0,i=(i=i+Math.imul(A,tt)|0)+Math.imul(S,$)|0,a=a+Math.imul(S,tt)|0,n=n+Math.imul(M,rt)|0,i=(i=i+Math.imul(M,nt)|0)+Math.imul(k,rt)|0,a=a+Math.imul(k,nt)|0,n=n+Math.imul(x,at)|0,i=(i=i+Math.imul(x,ot)|0)+Math.imul(_,at)|0,a=a+Math.imul(_,ot)|0,n=n+Math.imul(v,lt)|0,i=(i=i+Math.imul(v,ct)|0)+Math.imul(y,lt)|0,a=a+Math.imul(y,ct)|0,n=n+Math.imul(p,ht)|0,i=(i=i+Math.imul(p,ft)|0)+Math.imul(m,ht)|0,a=a+Math.imul(m,ft)|0;var Tt=(c+(n=n+Math.imul(h,pt)|0)|0)+((8191&(i=(i=i+Math.imul(h,mt)|0)+Math.imul(f,pt)|0))<<13)|0;c=((a=a+Math.imul(f,mt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(j,q),i=(i=Math.imul(j,G))+Math.imul(N,q)|0,a=Math.imul(N,G),n=n+Math.imul(O,W)|0,i=(i=i+Math.imul(O,X)|0)+Math.imul(R,W)|0,a=a+Math.imul(R,X)|0,n=n+Math.imul(z,J)|0,i=(i=i+Math.imul(z,K)|0)+Math.imul(D,J)|0,a=a+Math.imul(D,K)|0,n=n+Math.imul(L,$)|0,i=(i=i+Math.imul(L,tt)|0)+Math.imul(C,$)|0,a=a+Math.imul(C,tt)|0,n=n+Math.imul(A,rt)|0,i=(i=i+Math.imul(A,nt)|0)+Math.imul(S,rt)|0,a=a+Math.imul(S,nt)|0,n=n+Math.imul(M,at)|0,i=(i=i+Math.imul(M,ot)|0)+Math.imul(k,at)|0,a=a+Math.imul(k,ot)|0,n=n+Math.imul(x,lt)|0,i=(i=i+Math.imul(x,ct)|0)+Math.imul(_,lt)|0,a=a+Math.imul(_,ct)|0,n=n+Math.imul(v,ht)|0,i=(i=i+Math.imul(v,ft)|0)+Math.imul(y,ht)|0,a=a+Math.imul(y,ft)|0;var At=(c+(n=n+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;c=((a=a+Math.imul(m,mt)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(j,W),i=(i=Math.imul(j,X))+Math.imul(N,W)|0,a=Math.imul(N,X),n=n+Math.imul(O,J)|0,i=(i=i+Math.imul(O,K)|0)+Math.imul(R,J)|0,a=a+Math.imul(R,K)|0,n=n+Math.imul(z,$)|0,i=(i=i+Math.imul(z,tt)|0)+Math.imul(D,$)|0,a=a+Math.imul(D,tt)|0,n=n+Math.imul(L,rt)|0,i=(i=i+Math.imul(L,nt)|0)+Math.imul(C,rt)|0,a=a+Math.imul(C,nt)|0,n=n+Math.imul(A,at)|0,i=(i=i+Math.imul(A,ot)|0)+Math.imul(S,at)|0,a=a+Math.imul(S,ot)|0,n=n+Math.imul(M,lt)|0,i=(i=i+Math.imul(M,ct)|0)+Math.imul(k,lt)|0,a=a+Math.imul(k,ct)|0,n=n+Math.imul(x,ht)|0,i=(i=i+Math.imul(x,ft)|0)+Math.imul(_,ht)|0,a=a+Math.imul(_,ft)|0;var St=(c+(n=n+Math.imul(v,pt)|0)|0)+((8191&(i=(i=i+Math.imul(v,mt)|0)+Math.imul(y,pt)|0))<<13)|0;c=((a=a+Math.imul(y,mt)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(j,J),i=(i=Math.imul(j,K))+Math.imul(N,J)|0,a=Math.imul(N,K),n=n+Math.imul(O,$)|0,i=(i=i+Math.imul(O,tt)|0)+Math.imul(R,$)|0,a=a+Math.imul(R,tt)|0,n=n+Math.imul(z,rt)|0,i=(i=i+Math.imul(z,nt)|0)+Math.imul(D,rt)|0,a=a+Math.imul(D,nt)|0,n=n+Math.imul(L,at)|0,i=(i=i+Math.imul(L,ot)|0)+Math.imul(C,at)|0,a=a+Math.imul(C,ot)|0,n=n+Math.imul(A,lt)|0,i=(i=i+Math.imul(A,ct)|0)+Math.imul(S,lt)|0,a=a+Math.imul(S,ct)|0,n=n+Math.imul(M,ht)|0,i=(i=i+Math.imul(M,ft)|0)+Math.imul(k,ht)|0,a=a+Math.imul(k,ft)|0;var Et=(c+(n=n+Math.imul(x,pt)|0)|0)+((8191&(i=(i=i+Math.imul(x,mt)|0)+Math.imul(_,pt)|0))<<13)|0;c=((a=a+Math.imul(_,mt)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(j,$),i=(i=Math.imul(j,tt))+Math.imul(N,$)|0,a=Math.imul(N,tt),n=n+Math.imul(O,rt)|0,i=(i=i+Math.imul(O,nt)|0)+Math.imul(R,rt)|0,a=a+Math.imul(R,nt)|0,n=n+Math.imul(z,at)|0,i=(i=i+Math.imul(z,ot)|0)+Math.imul(D,at)|0,a=a+Math.imul(D,ot)|0,n=n+Math.imul(L,lt)|0,i=(i=i+Math.imul(L,ct)|0)+Math.imul(C,lt)|0,a=a+Math.imul(C,ct)|0,n=n+Math.imul(A,ht)|0,i=(i=i+Math.imul(A,ft)|0)+Math.imul(S,ht)|0,a=a+Math.imul(S,ft)|0;var Lt=(c+(n=n+Math.imul(M,pt)|0)|0)+((8191&(i=(i=i+Math.imul(M,mt)|0)+Math.imul(k,pt)|0))<<13)|0;c=((a=a+Math.imul(k,mt)|0)+(i>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,n=Math.imul(j,rt),i=(i=Math.imul(j,nt))+Math.imul(N,rt)|0,a=Math.imul(N,nt),n=n+Math.imul(O,at)|0,i=(i=i+Math.imul(O,ot)|0)+Math.imul(R,at)|0,a=a+Math.imul(R,ot)|0,n=n+Math.imul(z,lt)|0,i=(i=i+Math.imul(z,ct)|0)+Math.imul(D,lt)|0,a=a+Math.imul(D,ct)|0,n=n+Math.imul(L,ht)|0,i=(i=i+Math.imul(L,ft)|0)+Math.imul(C,ht)|0,a=a+Math.imul(C,ft)|0;var Ct=(c+(n=n+Math.imul(A,pt)|0)|0)+((8191&(i=(i=i+Math.imul(A,mt)|0)+Math.imul(S,pt)|0))<<13)|0;c=((a=a+Math.imul(S,mt)|0)+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,n=Math.imul(j,at),i=(i=Math.imul(j,ot))+Math.imul(N,at)|0,a=Math.imul(N,ot),n=n+Math.imul(O,lt)|0,i=(i=i+Math.imul(O,ct)|0)+Math.imul(R,lt)|0,a=a+Math.imul(R,ct)|0,n=n+Math.imul(z,ht)|0,i=(i=i+Math.imul(z,ft)|0)+Math.imul(D,ht)|0,a=a+Math.imul(D,ft)|0;var It=(c+(n=n+Math.imul(L,pt)|0)|0)+((8191&(i=(i=i+Math.imul(L,mt)|0)+Math.imul(C,pt)|0))<<13)|0;c=((a=a+Math.imul(C,mt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,n=Math.imul(j,lt),i=(i=Math.imul(j,ct))+Math.imul(N,lt)|0,a=Math.imul(N,ct),n=n+Math.imul(O,ht)|0,i=(i=i+Math.imul(O,ft)|0)+Math.imul(R,ht)|0,a=a+Math.imul(R,ft)|0;var zt=(c+(n=n+Math.imul(z,pt)|0)|0)+((8191&(i=(i=i+Math.imul(z,mt)|0)+Math.imul(D,pt)|0))<<13)|0;c=((a=a+Math.imul(D,mt)|0)+(i>>>13)|0)+(zt>>>26)|0,zt&=67108863,n=Math.imul(j,ht),i=(i=Math.imul(j,ft))+Math.imul(N,ht)|0,a=Math.imul(N,ft);var Dt=(c+(n=n+Math.imul(O,pt)|0)|0)+((8191&(i=(i=i+Math.imul(O,mt)|0)+Math.imul(R,pt)|0))<<13)|0;c=((a=a+Math.imul(R,mt)|0)+(i>>>13)|0)+(Dt>>>26)|0,Dt&=67108863;var Pt=(c+(n=Math.imul(j,pt))|0)+((8191&(i=(i=Math.imul(j,mt))+Math.imul(N,pt)|0))<<13)|0;return c=((a=Math.imul(N,mt))+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,l[0]=gt,l[1]=vt,l[2]=yt,l[3]=bt,l[4]=xt,l[5]=_t,l[6]=wt,l[7]=Mt,l[8]=kt,l[9]=Tt,l[10]=At,l[11]=St,l[12]=Et,l[13]=Lt,l[14]=Ct,l[15]=It,l[16]=zt,l[17]=Dt,l[18]=Pt,0!==c&&(l[19]=c,r.length++),r};Math.imul||(w=l),a.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?w(this,t,e):r<63?l(this,t,e):r<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var n=0,i=0,a=0;a<r.length-1;a++){var o=i;i=0;for(var s=67108863&n,l=Math.min(a,e.length-1),c=Math.max(0,a-t.length+1);c<=l;c++){var u=a-c,h=(0|t.words[u])*(0|e.words[c]),f=67108863&h;s=67108863&(f=f+s|0),i+=(o=(o=o+(h/67108864|0)|0)+(f>>>26)|0)>>>26,o&=67108863}r.words[a]=s,n=o,o=i}return 0!==n?r.words[a]=n:r.length--,r.strip()}(this,t,e):c(this,t,e)},u.prototype.makeRBT=function(t){for(var e=new Array(t),r=a.prototype._countBits(t)-1,n=0;n<t;n++)e[n]=this.revBin(n,r,t);return e},u.prototype.revBin=function(t,e,r){if(0===t||t===r-1)return t;for(var n=0,i=0;i<e;i++)n|=(1&t)<<e-i-1,t>>=1;return n},u.prototype.permute=function(t,e,r,n,i,a){for(var o=0;o<a;o++)n[o]=e[t[o]],i[o]=r[t[o]]},u.prototype.transform=function(t,e,r,n,i,a){this.permute(a,t,e,r,n,i);for(var o=1;o<i;o<<=1)for(var s=o<<1,l=Math.cos(2*Math.PI/s),c=Math.sin(2*Math.PI/s),u=0;u<i;u+=s)for(var h=l,f=c,d=0;d<o;d++){var p=r[u+d],m=n[u+d],g=r[u+d+o],v=n[u+d+o],y=h*g-f*v;v=h*v+f*g,g=y,r[u+d]=p+g,n[u+d]=m+v,r[u+d+o]=p-g,n[u+d+o]=m-v,d!==s&&(y=l*h-c*f,f=l*f+c*h,h=y)}},u.prototype.guessLen13b=function(t,e){var r=1|Math.max(e,t),n=1&r,i=0;for(r=r/2|0;r;r>>>=1)i++;return 1<<i+1+n},u.prototype.conjugate=function(t,e,r){if(!(r<=1))for(var n=0;n<r/2;n++){var i=t[n];t[n]=t[r-n-1],t[r-n-1]=i,i=e[n],e[n]=-e[r-n-1],e[r-n-1]=-i}},u.prototype.normalize13b=function(t,e){for(var r=0,n=0;n<e/2;n++){var i=8192*Math.round(t[2*n+1]/e)+Math.round(t[2*n]/e)+r;t[n]=67108863&i,r=i<67108864?0:i/67108864|0}return t},u.prototype.convert13b=function(t,e,r,i){for(var a=0,o=0;o<e;o++)a+=0|t[o],r[2*o]=8191&a,a>>>=13,r[2*o+1]=8191&a,a>>>=13;for(o=2*e;o<i;++o)r[o]=0;n(0===a),n(0==(-8192&a))},u.prototype.stub=function(t){for(var e=new Array(t),r=0;r<t;r++)e[r]=0;return e},u.prototype.mulp=function(t,e,r){var n=2*this.guessLen13b(t.length,e.length),i=this.makeRBT(n),a=this.stub(n),o=new Array(n),s=new Array(n),l=new Array(n),c=new Array(n),u=new Array(n),h=new Array(n),f=r.words;f.length=n,this.convert13b(t.words,t.length,o,n),this.convert13b(e.words,e.length,c,n),this.transform(o,a,s,l,n,i),this.transform(c,a,u,h,n,i);for(var d=0;d<n;d++){var p=s[d]*u[d]-l[d]*h[d];l[d]=s[d]*h[d]+l[d]*u[d],s[d]=p}return this.conjugate(s,l,n),this.transform(s,l,f,a,n,i),this.conjugate(f,a,n),this.normalize13b(f,n),r.negative=t.negative^e.negative,r.length=t.length+e.length,r.strip()},a.prototype.mul=function(t){var e=new a(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},a.prototype.mulf=function(t){var e=new a(null);return e.words=new Array(this.length+t.length),c(this,t,e)},a.prototype.imul=function(t){return this.clone().mulTo(t,this)},a.prototype.imuln=function(t){n("number"==typeof t),n(t<67108864);for(var e=0,r=0;r<this.length;r++){var i=(0|this.words[r])*t,a=(67108863&i)+(67108863&e);e>>=26,e+=i/67108864|0,e+=a>>>26,this.words[r]=67108863&a}return 0!==e&&(this.words[r]=e,this.length++),this},a.prototype.muln=function(t){return this.clone().imuln(t)},a.prototype.sqr=function(){return this.mul(this)},a.prototype.isqr=function(){return this.imul(this.clone())},a.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r<e.length;r++){var n=r/26|0,i=r%26;e[r]=(t.words[n]&1<<i)>>>i}return e}(t);if(0===e.length)return new a(1);for(var r=this,n=0;n<e.length&&0===e[n];n++,r=r.sqr());if(++n<e.length)for(var i=r.sqr();n<e.length;n++,i=i.sqr())0!==e[n]&&(r=r.mul(i));return r},a.prototype.iushln=function(t){n("number"==typeof t&&t>=0);var e,r=t%26,i=(t-r)/26,a=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(e=0;e<this.length;e++){var s=this.words[e]&a,l=(0|this.words[e])-s<<r;this.words[e]=l|o,o=s>>>26-r}o&&(this.words[e]=o,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e<i;e++)this.words[e]=0;this.length+=i}return this.strip()},a.prototype.ishln=function(t){return n(0===this.negative),this.iushln(t)},a.prototype.iushrn=function(t,e,r){n("number"==typeof t&&t>=0);var i;i=e?(e-e%26)/26:0;var a=t%26,o=Math.min((t-a)/26,this.length),s=67108863^67108863>>>a<<a,l=r;if(i-=o,i=Math.max(0,i),l){for(var c=0;c<o;c++)l.words[c]=this.words[c];l.length=o}if(0===o);else if(this.length>o)for(this.length-=o,c=0;c<this.length;c++)this.words[c]=this.words[c+o];else this.words[0]=0,this.length=1;var u=0;for(c=this.length-1;c>=0&&(0!==u||c>=i);c--){var h=0|this.words[c];this.words[c]=u<<26-a|h>>>a,u=h&s}return l&&0!==u&&(l.words[l.length++]=u),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},a.prototype.ishrn=function(t,e,r){return n(0===this.negative),this.iushrn(t,e,r)},a.prototype.shln=function(t){return this.clone().ishln(t)},a.prototype.ushln=function(t){return this.clone().iushln(t)},a.prototype.shrn=function(t){return this.clone().ishrn(t)},a.prototype.ushrn=function(t){return this.clone().iushrn(t)},a.prototype.testn=function(t){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,i=1<<e;if(this.length<=r)return!1;return!!(this.words[r]&i)},a.prototype.imaskn=function(t){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var i=67108863^67108863>>>e<<e;this.words[this.length-1]&=i}return this.strip()},a.prototype.maskn=function(t){return this.clone().imaskn(t)},a.prototype.iaddn=function(t){return n("number"==typeof t),n(t<67108864),t<0?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])<t?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},a.prototype._iaddn=function(t){this.words[0]+=t;for(var e=0;e<this.length&&this.words[e]>=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},a.prototype.isubn=function(t){if(n("number"==typeof t),n(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e<this.length&&this.words[e]<0;e++)this.words[e]+=67108864,this.words[e+1]-=1;return this.strip()},a.prototype.addn=function(t){return this.clone().iaddn(t)},a.prototype.subn=function(t){return this.clone().isubn(t)},a.prototype.iabs=function(){return this.negative=0,this},a.prototype.abs=function(){return this.clone().iabs()},a.prototype._ishlnsubmul=function(t,e,r){var i,a=t.length+r;this._expand(a);var o,s=0;for(i=0;i<t.length;i++){o=(0|this.words[i+r])+s;var l=(0|t.words[i])*e;s=((o-=67108863&l)>>26)-(l/67108864|0),this.words[i+r]=67108863&o}for(;i<this.length-r;i++)s=(o=(0|this.words[i+r])+s)>>26,this.words[i+r]=67108863&o;if(0===s)return this.strip();for(n(-1===s),s=0,i=0;i<this.length;i++)s=(o=-(0|this.words[i])+s)>>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},a.prototype._wordDiv=function(t,e){var r=this.length-t.length,n=this.clone(),i=t,o=0|i.words[i.length-1];0!==(r=26-this._countBits(o))&&(i=i.ushln(r),n.iushln(r),o=0|i.words[i.length-1]);var s,l=n.length-i.length;if("mod"!==e){(s=new a(null)).length=l+1,s.words=new Array(s.length);for(var c=0;c<s.length;c++)s.words[c]=0}var u=n.clone()._ishlnsubmul(i,1,l);0===u.negative&&(n=u,s&&(s.words[l]=1));for(var h=l-1;h>=0;h--){var f=67108864*(0|n.words[i.length+h])+(0|n.words[i.length+h-1]);for(f=Math.min(f/o|0,67108863),n._ishlnsubmul(i,f,h);0!==n.negative;)f--,n.negative=0,n._ishlnsubmul(i,1,h),n.isZero()||(n.negative^=1);s&&(s.words[h]=f)}return s&&s.strip(),n.strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:s||null,mod:n}},a.prototype.divmod=function(t,e,r){if(n(!t.isZero()),this.isZero())return{div:new a(0),mod:new a(0)};var i,o,s;return 0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(i=s.div.neg()),"div"!==e&&(o=s.mod.neg(),r&&0!==o.negative&&o.iadd(t)),{div:i,mod:o}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(i=s.div.neg()),{div:i,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(o=s.mod.neg(),r&&0!==o.negative&&o.isub(t)),{div:s.div,mod:o}):t.length>this.length||this.cmp(t)<0?{div:new a(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new a(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new a(this.modn(t.words[0]))}:this._wordDiv(t,e)},a.prototype.div=function(t){return this.divmod(t,"div",!1).div},a.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},a.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},a.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,n=t.ushrn(1),i=t.andln(1),a=r.cmp(n);return a<0||1===i&&0===a?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},a.prototype.modn=function(t){n(t<=67108863);for(var e=(1<<26)%t,r=0,i=this.length-1;i>=0;i--)r=(e*r+(0|this.words[i]))%t;return r},a.prototype.idivn=function(t){n(t<=67108863);for(var e=0,r=this.length-1;r>=0;r--){var i=(0|this.words[r])+67108864*e;this.words[r]=i/t|0,e=i%t}return this.strip()},a.prototype.divn=function(t){return this.clone().idivn(t)},a.prototype.egcd=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new a(1),o=new a(0),s=new a(0),l=new a(1),c=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++c;for(var u=r.clone(),h=e.clone();!e.isZero();){for(var f=0,d=1;0==(e.words[0]&d)&&f<26;++f,d<<=1);if(f>0)for(e.iushrn(f);f-- >0;)(i.isOdd()||o.isOdd())&&(i.iadd(u),o.isub(h)),i.iushrn(1),o.iushrn(1);for(var p=0,m=1;0==(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(s.isOdd()||l.isOdd())&&(s.iadd(u),l.isub(h)),s.iushrn(1),l.iushrn(1);e.cmp(r)>=0?(e.isub(r),i.isub(s),o.isub(l)):(r.isub(e),s.isub(i),l.isub(o))}return{a:s,b:l,gcd:r.iushln(c)}},a.prototype._invmp=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new a(1),o=new a(0),s=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var l=0,c=1;0==(e.words[0]&c)&&l<26;++l,c<<=1);if(l>0)for(e.iushrn(l);l-- >0;)i.isOdd()&&i.iadd(s),i.iushrn(1);for(var u=0,h=1;0==(r.words[0]&h)&&u<26;++u,h<<=1);if(u>0)for(r.iushrn(u);u-- >0;)o.isOdd()&&o.iadd(s),o.iushrn(1);e.cmp(r)>=0?(e.isub(r),i.isub(o)):(r.isub(e),o.isub(i))}var f;return(f=0===e.cmpn(1)?i:o).cmpn(0)<0&&f.iadd(t),f},a.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var n=0;e.isEven()&&r.isEven();n++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=e.cmp(r);if(i<0){var a=e;e=r,r=a}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.iushln(n)},a.prototype.invm=function(t){return this.egcd(t).a.umod(t)},a.prototype.isEven=function(){return 0==(1&this.words[0])},a.prototype.isOdd=function(){return 1==(1&this.words[0])},a.prototype.andln=function(t){return this.words[0]&t},a.prototype.bincn=function(t){n("number"==typeof t);var e=t%26,r=(t-e)/26,i=1<<e;if(this.length<=r)return this._expand(r+1),this.words[r]|=i,this;for(var a=i,o=r;0!==a&&o<this.length;o++){var s=0|this.words[o];a=(s+=a)>>>26,s&=67108863,this.words[o]=s}return 0!==a&&(this.words[o]=a,this.length++),this},a.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},a.prototype.cmpn=function(t){var e=t<0;if(0!==this.negative&&!e)return-1;if(0===this.negative&&e)return 1;this.strip();var r;if(this.length>1)r=1;else{e&&(t=-t),n(t<=67108863,"Number is too big");var i=0|this.words[0];r=i===t?0:i<t?-1:1}return 0!==this.negative?0|-r:r},a.prototype.cmp=function(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var e=this.ucmp(t);return 0!==this.negative?0|-e:e},a.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var e=0,r=this.length-1;r>=0;r--){var n=0|this.words[r],i=0|t.words[r];if(n!==i){n<i?e=-1:n>i&&(e=1);break}}return e},a.prototype.gtn=function(t){return 1===this.cmpn(t)},a.prototype.gt=function(t){return 1===this.cmp(t)},a.prototype.gten=function(t){return this.cmpn(t)>=0},a.prototype.gte=function(t){return this.cmp(t)>=0},a.prototype.ltn=function(t){return-1===this.cmpn(t)},a.prototype.lt=function(t){return-1===this.cmp(t)},a.prototype.lten=function(t){return this.cmpn(t)<=0},a.prototype.lte=function(t){return this.cmp(t)<=0},a.prototype.eqn=function(t){return 0===this.cmpn(t)},a.prototype.eq=function(t){return 0===this.cmp(t)},a.red=function(t){return new g(t)},a.prototype.toRed=function(t){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},a.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},a.prototype._forceRed=function(t){return this.red=t,this},a.prototype.forceRed=function(t){return n(!this.red,"Already a number in reduction context"),this._forceRed(t)},a.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},a.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},a.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},a.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},a.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},a.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},a.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},a.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},a.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},a.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},a.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},a.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},a.prototype.redPow=function(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var M={k256:null,p224:null,p192:null,p25519:null};h.prototype._tmp=function(){var t=new a(null);return t.words=new Array(Math.ceil(this.n/13)),t},h.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var n=e<this.n?-1:r.ucmp(this.p);return 0===n?(r.words[0]=0,r.length=1):n>0?r.isub(this.p):r.strip(),r},h.prototype.split=function(t,e){t.iushrn(this.n,0,e)},h.prototype.imulK=function(t){return t.imul(this.k)},i(f,h),f.prototype.split=function(t,e){for(var r=Math.min(t.length,9),n=0;n<r;n++)e.words[n]=t.words[n];if(e.length=r,t.length<=9)return t.words[0]=0,void(t.length=1);var i=t.words[9];for(e.words[e.length++]=4194303&i,n=10;n<t.length;n++){var a=0|t.words[n];t.words[n-10]=(4194303&a)<<4|i>>>22,i=a}i>>>=22,t.words[n-10]=i,0===i&&t.length>10?t.length-=10:t.length-=9},f.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r<t.length;r++){var n=0|t.words[r];e+=977*n,t.words[r]=67108863&e,e=64*n+(e/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},i(d,h),i(p,h),i(m,h),m.prototype.imulK=function(t){for(var e=0,r=0;r<t.length;r++){var n=19*(0|t.words[r])+e,i=67108863&n;n>>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},a._prime=function(t){if(M[t])return M[t];var e;if("k256"===t)e=new f;else if("p224"===t)e=new d;else if("p192"===t)e=new p;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new m}return M[t]=e,e},g.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},g.prototype._verify2=function(t,e){n(0==(t.negative|e.negative),"red works only with positives"),n(t.red&&t.red===e.red,"red works only with red numbers")},g.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},g.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},g.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)},g.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},g.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)},g.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},g.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},g.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},g.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},g.prototype.isqr=function(t){return this.imul(t,t.clone())},g.prototype.sqr=function(t){return this.mul(t,t)},g.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(n(e%2==1),3===e){var r=this.m.add(new a(1)).iushrn(2);return this.pow(t,r)}for(var i=this.m.subn(1),o=0;!i.isZero()&&0===i.andln(1);)o++,i.iushrn(1);n(!i.isZero());var s=new a(1).toRed(this),l=s.redNeg(),c=this.m.subn(1).iushrn(1),u=this.m.bitLength();for(u=new a(2*u*u).toRed(this);0!==this.pow(u,c).cmp(l);)u.redIAdd(l);for(var h=this.pow(u,i),f=this.pow(t,i.addn(1).iushrn(1)),d=this.pow(t,i),p=o;0!==d.cmp(s);){for(var m=d,g=0;0!==m.cmp(s);g++)m=m.redSqr();n(g<p);var v=this.pow(h,new a(1).iushln(p-g-1));f=f.redMul(v),h=v.redSqr(),d=d.redMul(h),p=g}return f},g.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},g.prototype.pow=function(t,e){if(e.isZero())return new a(1);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new a(1).toRed(this),r[1]=t;for(var n=2;n<r.length;n++)r[n]=this.mul(r[n-1],t);var i=r[0],o=0,s=0,l=e.bitLength()%26;for(0===l&&(l=26),n=e.length-1;n>=0;n--){for(var c=e.words[n],u=l-1;u>=0;u--){var h=c>>u&1;i!==r[0]&&(i=this.sqr(i)),0!==h||0!==o?(o<<=1,o|=h,(4===++s||0===n&&0===u)&&(i=this.mul(i,r[o]),s=0,o=0)):s=0}l=26}return i},g.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},g.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},a.mont=function(t){return new v(t)},i(v,g),v.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},v.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},v.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),a=i;return i.cmp(this.m)>=0?a=i.isub(this.m):i.cmpn(0)<0&&(a=i.iadd(this.m)),a._forceRed(this)},v.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new a(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},v.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(void 0===e||e,this)},{}],72:[function(t,e,r){"use strict";e.exports=function(t){var e,r,n,i=t.length,a=0;for(e=0;e<i;++e)a+=t[e].length;var o=new Array(a),s=0;for(e=0;e<i;++e){var l=t[e],c=l.length;for(r=0;r<c;++r){var u=o[s++]=new Array(c-1),h=0;for(n=0;n<c;++n)n!==r&&(u[h++]=l[n]);if(1&r){var f=u[1];u[1]=u[0],u[0]=f}}}return o}},{}],73:[function(t,e,r){"use strict";function n(t,e){for(var r=0;r<t;++r)if(!(e[r]<=e[r+t]))return!0;return!1}function i(t,e,r,i){for(var a=0,o=0,s=0,l=t.length;s<l;++s){var c=t[s];if(!n(e,c)){for(var u=0;u<2*e;++u)r[a++]=c[u];i[o++]=s}}return o}function a(t,e,r,n){var a=t.length,o=e.length;if(!(a<=0||o<=0)){var s=t[0].length>>>1;if(!(s<=0)){var h,f=l.mallocDouble(2*s*a),d=l.mallocInt32(a);if((a=i(t,s,f,d))>0){if(1===s&&n)c.init(a),h=c.sweepComplete(s,r,0,a,f,d,0,a,f,d);else{var p=l.mallocDouble(2*s*o),m=l.mallocInt32(o);(o=i(e,s,p,m))>0&&(c.init(a+o),h=1===s?c.sweepBipartite(s,r,0,a,f,d,0,o,p,m):u(s,r,n,a,f,d,o,p,m),l.free(p),l.free(m))}l.free(f),l.free(d)}return h}}}function o(t,e){s.push([t,e])}e.exports=function(t,e,r){switch(arguments.length){case 1:return s=[],a(t,t,o,!0),s;case 2:return"function"==typeof e?a(t,t,e,!0):(s=[],a(t,e,o,!1),s);case 3:return a(t,e,r,!1);default:throw new Error("box-intersect: Invalid arguments")}};var s,l=t("typedarray-pool"),c=t("./lib/sweep"),u=t("./lib/intersect")},{"./lib/intersect":75,"./lib/sweep":79,"typedarray-pool":552}],74:[function(t,e,r){"use strict";function n(t){function e(e,r){var s=function(t,e,r){var n="bruteForce"+(t?"Red":"Blue")+(e?"Flip":"")+(r?"Full":""),s=["function ",n,"(",_.join(),"){","var ",l,"=2*",i,";"],w="for(var i="+c+","+d+"="+l+"*"+c+";i<"+u+";++i,"+d+"+="+l+"){var x0="+h+"["+a+"+"+d+"],x1="+h+"["+a+"+"+d+"+"+i+"],xi="+f+"[i];",M="for(var j="+p+","+y+"="+l+"*"+p+";j<"+m+";++j,"+y+"+="+l+"){var y0="+g+"["+a+"+"+y+"],"+(r?"y1="+g+"["+a+"+"+y+"+"+i+"],":"")+"yi="+v+"[j];";return t?s.push(w,x,":",M):s.push(M,x,":",w),r?s.push("if(y1<x0||x1<y0)continue;"):e?s.push("if(y0<=x0||x1<y0)continue;"):s.push("if(y0<x0||x1<y0)continue;"),s.push("for(var k="+a+"+1;k<"+i+";++k){var r0="+h+"[k+"+d+"],r1="+h+"[k+"+i+"+"+d+"],b0="+g+"[k+"+y+"],b1="+g+"[k+"+i+"+"+y+"];if(r1<b0||b1<r0)continue "+x+";}var "+b+"="+o+"("),e?s.push("yi,xi"):s.push("xi,yi"),s.push(");if("+b+"!==void 0)return "+b+";}}}"),{name:n,code:s.join("")}}(e,r,t);n.push(s.code),M.push("return "+s.name+"("+_.join()+");")}var r="bruteForce"+(t?"Full":"Partial"),n=[],w=_.slice();t||w.splice(3,0,s);var M=["function "+r+"("+w.join()+"){"];M.push("if("+u+"-"+c+">"+m+"-"+p+"){"),t?(e(!0,!1),M.push("}else{"),e(!1,!1)):(M.push("if("+s+"){"),e(!0,!0),M.push("}else{"),e(!0,!1),M.push("}}else{if("+s+"){"),e(!1,!0),M.push("}else{"),e(!1,!1),M.push("}")),M.push("}}return "+r);var k=n.join("")+M.join("");return new Function(k)()}var i="d",a="ax",o="vv",s="fp",l="es",c="rs",u="re",h="rb",f="ri",d="rp",p="bs",m="be",g="bb",v="bi",y="bp",b="rv",x="Q",_=[i,a,o,c,u,h,f,p,m,g,v];r.partial=n(!1),r.full=n(!0)},{}],75:[function(t,e,r){"use strict";function n(t,e,r,n,i,a,o,s,l){var c=M*t;T[c]=e,T[c+1]=r,T[c+2]=n,T[c+3]=i,T[c+4]=a,T[c+5]=o;var u=k*t;A[u]=s,A[u+1]=l}function i(t,e,r,n,i,a,o,s,l,c,u){var h=2*t,f=l*h,d=c[f+e];t:for(var p=i,m=i*h;p<a;++p,m+=h){var g=o[m+e],v=o[m+e+t];if(!(d<g||v<d)&&(!n||d!==g)){for(var y=s[p],b=e+1;b<t;++b){var g=o[m+b],v=o[m+b+t],x=c[f+b],_=c[f+b+t];if(v<x||_<g)continue t}var w;if(void 0!==(w=n?r(u,y):r(y,u)))return w}}}function a(t,e,r,n,i,a,o,s,l,c){var u=2*t,h=s*u,f=l[h+e];t:for(var d=n,p=n*u;d<i;++d,p+=u){var m=o[d];if(m!==c){var g=a[p+e],v=a[p+e+t];if(!(f<g||v<f)){for(var y=e+1;y<t;++y){var g=a[p+y],v=a[p+y+t],b=l[h+y],x=l[h+y+t];if(v<b||x<g)continue t}var _=r(m,c);if(void 0!==_)return _}}}}e.exports=function(t,e,r,l,d,S,E,L,C){!function(t,e){var r=8*s.log2(e+1)*(t+1)|0,n=s.nextPow2(M*r);T.length<n&&(o.free(T),T=o.mallocInt32(n));var i=s.nextPow2(k*r);A<i&&(o.free(A),A=o.mallocDouble(i))}(t,l+E);var I,z=0,D=2*t;for(n(z++,0,0,l,0,E,r?16:0,-1/0,1/0),r||n(z++,0,0,E,0,l,1,-1/0,1/0);z>0;){var P=(z-=1)*M,O=T[P],R=T[P+1],F=T[P+2],j=T[P+3],N=T[P+4],B=T[P+5],U=z*k,V=A[U],H=A[U+1],q=1&B,G=!!(16&B),Y=d,W=S,X=L,Z=C;if(q&&(Y=L,W=C,X=d,Z=S),!(2&B&&(F=b(t,O,R,F,Y,W,H),R>=F)||4&B&&(R=x(t,O,R,F,Y,W,V))>=F)){var J=F-R,K=N-j;if(G){if(t*J*(J+K)<g){if(void 0!==(I=h.scanComplete(t,O,e,R,F,Y,W,j,N,X,Z)))return I;continue}}else{if(t*Math.min(J,K)<p){if(void 0!==(I=c(t,O,e,q,R,F,Y,W,j,N,X,Z)))return I;continue}if(t*J*K<m){if(void 0!==(I=h.scanBipartite(t,O,e,q,R,F,Y,W,j,N,X,Z)))return I;continue}}var Q=v(t,O,R,F,Y,W,V,H);if(R<Q)if(t*(Q-R)<p){if(void 0!==(I=u(t,O+1,e,R,Q,Y,W,j,N,X,Z)))return I}else if(O===t-2){if(void 0!==(I=q?h.sweepBipartite(t,e,j,N,X,Z,R,Q,Y,W):h.sweepBipartite(t,e,R,Q,Y,W,j,N,X,Z)))return I}else n(z++,O+1,R,Q,j,N,q,-1/0,1/0),n(z++,O+1,j,N,R,Q,1^q,-1/0,1/0);if(Q<F){var $=f(t,O,j,N,X,Z),tt=X[D*$+O],et=y(t,O,$,N,X,Z,tt);if(et<N&&n(z++,O,Q,F,et,N,(4|q)+(G?16:0),tt,H),j<$&&n(z++,O,Q,F,j,$,(2|q)+(G?16:0),V,tt),$+1===et){if(void 0!==(I=G?a(t,O,e,Q,F,Y,W,$,X,Z[$]):i(t,O,e,q,Q,F,Y,W,$,X,Z[$])))return I}else if($<et){var rt;if(G){if(rt=_(t,O,Q,F,Y,W,tt),Q<rt){var nt=y(t,O,Q,rt,Y,W,tt);if(O===t-2){if(Q<nt&&void 0!==(I=h.sweepComplete(t,e,Q,nt,Y,W,$,et,X,Z)))return I;if(nt<rt&&void 0!==(I=h.sweepBipartite(t,e,nt,rt,Y,W,$,et,X,Z)))return I}else Q<nt&&n(z++,O+1,Q,nt,$,et,16,-1/0,1/0),nt<rt&&(n(z++,O+1,nt,rt,$,et,0,-1/0,1/0),n(z++,O+1,$,et,nt,rt,1,-1/0,1/0))}}else Q<(rt=q?w(t,O,Q,F,Y,W,tt):_(t,O,Q,F,Y,W,tt))&&(O===t-2?I=q?h.sweepBipartite(t,e,$,et,X,Z,Q,rt,Y,W):h.sweepBipartite(t,e,Q,rt,Y,W,$,et,X,Z):(n(z++,O+1,Q,rt,$,et,q,-1/0,1/0),n(z++,O+1,$,et,Q,rt,1^q,-1/0,1/0)))}}}}};var o=t("typedarray-pool"),s=t("bit-twiddle"),l=t("./brute"),c=l.partial,u=l.full,h=t("./sweep"),f=t("./median"),d=t("./partition"),p=128,m=1<<22,g=1<<22,v=d("!(lo>=p0)&&!(p1>=hi)",["p0","p1"]),y=d("lo===p0",["p0"]),b=d("lo<p0",["p0"]),x=d("hi<=p0",["p0"]),_=d("lo<=p0&&p0<=hi",["p0"]),w=d("lo<p0&&p0<=hi",["p0"]),M=6,k=2,T=o.mallocInt32(1024),A=o.mallocDouble(1024)},{"./brute":74,"./median":76,"./partition":77,"./sweep":79,"bit-twiddle":70,"typedarray-pool":552}],76:[function(t,e,r){"use strict";function n(t,e,r,n,i,a){for(var o=2*t,s=o*(r+1)+e,l=r+1;l<n;++l,s+=o)for(var c=i[s],u=l,h=o*(l-1);u>r&&i[h+e]>c;--u,h-=o){for(var f=h,d=h+o,p=0;p<o;++p,++f,++d){var m=i[f];i[f]=i[d],i[d]=m}var g=a[u];a[u]=a[u-1],a[u-1]=g}}e.exports=function(t,e,r,o,s,l){if(o<=r+1)return r;for(var c=r,u=o,h=o+r>>>1,f=2*t,d=h,p=s[f*h+e];c<u;){if(u-c<a){n(t,e,c,u,s,l),p=s[f*h+e];break}var m=u-c,g=Math.random()*m+c|0,v=s[f*g+e],y=Math.random()*m+c|0,b=s[f*y+e],x=Math.random()*m+c|0,_=s[f*x+e];v<=b?_>=b?(d=y,p=b):v>=_?(d=g,p=v):(d=x,p=_):b>=_?(d=y,p=b):_>=v?(d=g,p=v):(d=x,p=_);for(var w=f*(u-1),M=f*d,k=0;k<f;++k,++w,++M)T=s[w],s[w]=s[M],s[M]=T;A=l[u-1],l[u-1]=l[d],l[d]=A;for(var w=f*(u-1),M=f*(d=i(t,e,c,u-1,s,l,p)),k=0;k<f;++k,++w,++M){var T=s[w];s[w]=s[M],s[M]=T}var A=l[u-1];if(l[u-1]=l[d],l[d]=A,h<d){for(u=d-1;c<u&&s[f*(u-1)+e]===p;)u-=1;u+=1}else{if(!(d<h))break;for(c=d+1;c<u&&s[f*c+e]===p;)c+=1}}return i(t,e,r,h,s,l,s[f*h+e])};var i=t("./partition")("lo<p0",["p0"]),a=8},{"./partition":77}],77:[function(t,e,r){"use strict";e.exports=function(t,e){var r="abcdef".split("").concat(e),i=[];return t.indexOf("lo")>=0&&i.push("lo=e[k+n]"),t.indexOf("hi")>=0&&i.push("hi=e[k+o]"),r.push(n.replace("_",i.join()).replace("$",t)),Function.apply(void 0,r)};var n="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"},{}],78:[function(t,e,r){"use strict";function n(t,e,r){for(var n=2*(t+1),i=t+1;i<=e;++i){for(var a=r[n++],o=r[n++],s=i,l=n-2;s-- >t;){var c=r[l-2],u=r[l-1];if(c<a)break;if(c===a&&u<o)break;r[l]=c,r[l+1]=u,l-=2}r[l]=a,r[l+1]=o}}function i(t,e,r){e*=2;var n=r[t*=2],i=r[t+1];r[t]=r[e],r[t+1]=r[e+1],r[e]=n,r[e+1]=i}function a(t,e,r){e*=2,r[t*=2]=r[e],r[t+1]=r[e+1]}function o(t,e,r,n){e*=2,r*=2;var i=n[t*=2],a=n[t+1];n[t]=n[e],n[t+1]=n[e+1],n[e]=n[r],n[e+1]=n[r+1],n[r]=i,n[r+1]=a}function s(t,e,r,n,i){e*=2,i[t*=2]=i[e],i[e]=r,i[t+1]=i[e+1],i[e+1]=n}function l(t,e,r){e*=2;var n=r[t*=2],i=r[e];return!(n<i)&&(n!==i||r[t+1]>r[e+1])}function c(t,e,r,n){var i=n[t*=2];return i<e||i===e&&n[t+1]<r}function u(t,e,r){var f=(e-t+1)/6|0,d=t+f,p=e-f,m=t+e>>1,g=m-f,v=m+f,y=d,b=g,x=m,_=v,w=p,M=t+1,k=e-1,T=0;l(y,b,r)&&(T=y,y=b,b=T),l(_,w,r)&&(T=_,_=w,w=T),l(y,x,r)&&(T=y,y=x,x=T),l(b,x,r)&&(T=b,b=x,x=T),l(y,_,r)&&(T=y,y=_,_=T),l(x,_,r)&&(T=x,x=_,_=T),l(b,w,r)&&(T=b,b=w,w=T),l(b,x,r)&&(T=b,b=x,x=T),l(_,w,r)&&(T=_,_=w,w=T);for(var A=r[2*b],S=r[2*b+1],E=r[2*_],L=r[2*_+1],C=2*y,I=2*x,z=2*w,D=2*d,P=2*m,O=2*p,R=0;R<2;++R){var F=r[C+R],j=r[I+R],N=r[z+R];r[D+R]=F,r[P+R]=j,r[O+R]=N}a(g,t,r),a(v,e,r);for(var B=M;B<=k;++B)if(c(B,A,S,r))B!==M&&i(B,M,r),++M;else if(!c(B,E,L,r))for(;;){if(c(k,E,L,r)){c(k,A,S,r)?(o(B,M,k,r),++M,--k):(i(B,k,r),--k);break}if(--k<B)break}s(t,M-1,A,S,r),s(e,k+1,E,L,r),M-2-t<=h?n(t,M-2,r):u(t,M-2,r),e-(k+2)<=h?n(k+2,e,r):u(k+2,e,r),k-M<=h?n(M,k,r):u(M,k,r)}e.exports=function(t,e){e<=4*h?n(0,e-1,t):u(0,e-1,t)};var h=32},{}],79:[function(t,e,r){"use strict";function n(t,e,r,n){var i=e[n],a=t[r-1];t[i]=a,e[a]=i}function i(t,e,r,n){t[r]=n,e[n]=r}e.exports={init:function(t){var e=o.nextPow2(t);c.length<e&&(a.free(c),c=a.mallocInt32(e)),u.length<e&&(a.free(u),u=a.mallocInt32(e)),h.length<e&&(a.free(h),h=a.mallocInt32(e)),f.length<e&&(a.free(f),f=a.mallocInt32(e)),d.length<e&&(a.free(d),d=a.mallocInt32(e)),p.length<e&&(a.free(p),p=a.mallocInt32(e));var r=8*e;m.length<r&&(a.free(m),m=a.mallocDouble(r))},sweepBipartite:function(t,e,r,a,o,d,p,g,v,y){for(var b=0,x=2*t,_=t-1,w=x-1,M=r;M<a;++M){var k=d[M],T=x*M;m[b++]=o[T+_],m[b++]=-(k+1),m[b++]=o[T+w],m[b++]=k}for(M=p;M<g;++M){var k=y[M]+l,A=x*M;m[b++]=v[A+_],m[b++]=-k,m[b++]=v[A+w],m[b++]=k}var S=b>>>1;s(m,S);for(var E=0,L=0,M=0;M<S;++M){var C=0|m[2*M+1];if(C>=l)n(h,f,L--,C=C-l|0);else if(C>=0)n(c,u,E--,C);else if(C<=-l){for(C=-C-l|0,I=0;I<E;++I)if(void 0!==(z=e(c[I],C)))return z;i(h,f,L++,C)}else{C=-C-1|0;for(var I=0;I<L;++I){var z=e(C,h[I]);if(void 0!==z)return z}i(c,u,E++,C)}}},sweepComplete:function(t,e,r,a,o,l,g,v,y,b){for(var x=0,_=2*t,w=t-1,M=_-1,k=r;k<a;++k){var T=l[k]+1<<1,A=_*k;m[x++]=o[A+w],m[x++]=-T,m[x++]=o[A+M],m[x++]=T}for(k=g;k<v;++k){var T=b[k]+1<<1,S=_*k;m[x++]=y[S+w],m[x++]=1|-T,m[x++]=y[S+M],m[x++]=1|T}var E=x>>>1;s(m,E);for(var L=0,C=0,I=0,k=0;k<E;++k){var z=0|m[2*k+1],D=1&z;if(k<E-1&&z>>1==m[2*k+3]>>1&&(D=2,k+=1),z<0){for(var P=-(z>>1)-1,O=0;O<I;++O)if(void 0!==(R=e(d[O],P)))return R;if(0!==D)for(O=0;O<L;++O)if(void 0!==(R=e(c[O],P)))return R;if(1!==D)for(O=0;O<C;++O){var R=e(h[O],P);if(void 0!==R)return R}0===D?i(c,u,L++,P):1===D?i(h,f,C++,P):2===D&&i(d,p,I++,P)}else P=(z>>1)-1,0===D?n(c,u,L--,P):1===D?n(h,f,C--,P):2===D&&n(d,p,I--,P)}},scanBipartite:function(t,e,r,a,o,h,f,d,p,g,v,y){var b=0,x=2*t,_=e,w=e+t,M=1,k=1;for(a?k=l:M=l,C=o;C<h;++C){var T=C+M,A=x*C;m[b++]=f[A+_],m[b++]=-T,m[b++]=f[A+w],m[b++]=T}for(C=p;C<g;++C){var T=C+k,S=x*C;m[b++]=v[S+_],m[b++]=-T}var E=b>>>1;s(m,E);for(var L=0,C=0;C<E;++C){var I=0|m[2*C+1];if(I<0){var z=!1;if((T=-I)>=l?(z=!a,T-=l):(z=!!a,T-=1),z)i(c,u,L++,T);else{var D=y[T],P=x*T,O=v[P+e+1],R=v[P+e+1+t];t:for(var F=0;F<L;++F){var j=c[F],N=x*j;if(!(R<f[N+e+1]||f[N+e+1+t]<O)){for(var B=e+2;B<t;++B)if(v[P+B+t]<f[N+B]||f[N+B+t]<v[P+B])continue t;var U,V=d[j];if(void 0!==(U=a?r(D,V):r(V,D)))return U}}}}else n(c,u,L--,I-M)}},scanComplete:function(t,e,r,n,i,a,o,u,h,f,d){for(var p=0,g=2*t,v=e,y=e+t,b=n;b<i;++b){var x=b+l,_=g*b;m[p++]=a[_+v],m[p++]=-x,m[p++]=a[_+y],m[p++]=x}for(b=u;b<h;++b){var x=b+1,w=g*b;m[p++]=f[w+v],m[p++]=-x}var M=p>>>1;s(m,M);for(var k=0,b=0;b<M;++b){var T=0|m[2*b+1];if(T<0)if((x=-T)>=l)c[k++]=x-l;else{var A=d[x-=1],S=g*x,E=f[S+e+1],L=f[S+e+1+t];t:for(P=0;P<k;++P){var C=c[P],I=o[C];if(I===A)break;var z=g*C;if(!(L<a[z+e+1]||a[z+e+1+t]<E)){for(O=e+2;O<t;++O)if(f[S+O+t]<a[z+O]||a[z+O+t]<f[S+O])continue t;var D=r(I,A);if(void 0!==D)return D}}}else{for(var x=T-l,P=k-1;P>=0;--P)if(c[P]===x){for(var O=P+1;O<k;++O)c[O-1]=c[O];break}--k}}}};var a=t("typedarray-pool"),o=t("bit-twiddle"),s=t("./sort"),l=1<<28,c=a.mallocInt32(1024),u=a.mallocInt32(1024),h=a.mallocInt32(1024),f=a.mallocInt32(1024),d=a.mallocInt32(1024),p=a.mallocInt32(1024),m=a.mallocDouble(8192)},{"./sort":78,"bit-twiddle":70,"typedarray-pool":552}],80:[function(t,e,r){"use strict";function n(t){if(t>P)throw new RangeError("Invalid typed array length");var e=new Uint8Array(t);return e.__proto__=i.prototype,e}function i(t,e,r){if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return s(t)}return a(t,e,r)}function a(t,e,r){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return t instanceof ArrayBuffer?function(t,e,r){if(e<0||t.byteLength<e)throw new RangeError("'offset' is out of bounds");if(t.byteLength<e+(r||0))throw new RangeError("'length' is out of bounds");var n;n=void 0===e&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,e):new Uint8Array(t,e,r);return n.__proto__=i.prototype,n}(t,e,r):"string"==typeof t?function(t,e){"string"==typeof e&&""!==e||(e="utf8");if(!i.isEncoding(e))throw new TypeError('"encoding" must be a valid string encoding');var r=0|u(t,e),a=n(r),o=a.write(t,e);o!==r&&(a=a.slice(0,o));return a}(t,e):function(t){if(i.isBuffer(t)){var e=0|c(t.length),r=n(e);return 0===r.length?r:(t.copy(r,0,0,e),r)}if(t){if(C(t)||"length"in t)return"number"!=typeof t.length||I(t.length)?n(0):l(t);if("Buffer"===t.type&&Array.isArray(t.data))return l(t.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t)}function o(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function s(t){return o(t),n(t<0?0:0|c(t))}function l(t){for(var e=t.length<0?0:0|c(t.length),r=n(e),i=0;i<e;i+=1)r[i]=255&t[i];return r}function c(t){if(t>=P)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+P.toString(16)+" bytes");return 0|t}function u(t,e){if(i.isBuffer(t))return t.length;if(C(t)||t instanceof ArrayBuffer)return t.byteLength;"string"!=typeof t&&(t=""+t);var r=t.length;if(0===r)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return S(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return E(t).length;default:if(n)return S(t).length;e=(""+e).toLowerCase(),n=!0}}function h(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if(r>>>=0,e>>>=0,r<=e)return"";for(t||(t="utf8");;)switch(t){case"hex":return function(t,e,r){var n=t.length;(!e||e<0)&&(e=0);(!r||r<0||r>n)&&(r=n);for(var i="",a=e;a<r;++a)i+=function(t){return t<16?"0"+t.toString(16):t.toString(16)}(t[a]);return i}(this,e,r);case"utf8":case"utf-8":return _(this,e,r);case"ascii":return function(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(127&t[i]);return n}(this,e,r);case"latin1":case"binary":return function(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(t[i]);return n}(this,e,r);case"base64":return function(t,e,r){return 0===e&&r===t.length?z.fromByteArray(t):z.fromByteArray(t.slice(e,r))}(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return function(t,e,r){for(var n=t.slice(e,r),i="",a=0;a<n.length;a+=2)i+=String.fromCharCode(n[a]+256*n[a+1]);return i}(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function f(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function d(t,e,r,n,a){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,I(r)&&(r=a?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(a)return-1;r=t.length-1}else if(r<0){if(!a)return-1;r=0}if("string"==typeof e&&(e=i.from(e,n)),i.isBuffer(e))return 0===e.length?-1:p(t,e,r,n,a);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?a?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):p(t,[e],r,n,a);throw new TypeError("val must be string, number or Buffer")}function p(t,e,r,n,i){function a(t,e){return 1===o?t[e]:t.readUInt16BE(e*o)}var o=1,s=t.length,l=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;o=2,s/=2,l/=2,r/=2}var c;if(i){var u=-1;for(c=r;c<s;c++)if(a(t,c)===a(e,-1===u?0:c-u)){if(-1===u&&(u=c),c-u+1===l)return u*o}else-1!==u&&(c-=c-u),u=-1}else for(r+l>s&&(r=s-l),c=r;c>=0;c--){for(var h=!0,f=0;f<l;f++)if(a(t,c+f)!==a(e,f)){h=!1;break}if(h)return c}return-1}function m(t,e,r,n){r=Number(r)||0;var i=t.length-r;n?(n=Number(n))>i&&(n=i):n=i;var a=e.length;if(a%2!=0)throw new TypeError("Invalid hex string");n>a/2&&(n=a/2);for(var o=0;o<n;++o){var s=parseInt(e.substr(2*o,2),16);if(I(s))return o;t[r+o]=s}return o}function g(t,e,r,n){return L(S(e,t.length-r),t,r,n)}function v(t,e,r,n){return L(function(t){for(var e=[],r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,n)}function y(t,e,r,n){return v(t,e,r,n)}function b(t,e,r,n){return L(E(e),t,r,n)}function x(t,e,r,n){return L(function(t,e){for(var r,n,i,a=[],o=0;o<t.length&&!((e-=2)<0);++o)r=t.charCodeAt(o),n=r>>8,i=r%256,a.push(i),a.push(n);return a}(e,t.length-r),t,r,n)}function _(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i<r;){var a=t[i],o=null,s=a>239?4:a>223?3:a>191?2:1;if(i+s<=r){var l,c,u,h;switch(s){case 1:a<128&&(o=a);break;case 2:128==(192&(l=t[i+1]))&&(h=(31&a)<<6|63&l)>127&&(o=h);break;case 3:l=t[i+1],c=t[i+2],128==(192&l)&&128==(192&c)&&(h=(15&a)<<12|(63&l)<<6|63&c)>2047&&(h<55296||h>57343)&&(o=h);break;case 4:l=t[i+1],c=t[i+2],u=t[i+3],128==(192&l)&&128==(192&c)&&128==(192&u)&&(h=(15&a)<<18|(63&l)<<12|(63&c)<<6|63&u)>65535&&h<1114112&&(o=h)}}null===o?(o=65533,s=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|1023&o),n.push(o),i+=s}return function(t){var e=t.length;if(e<=O)return String.fromCharCode.apply(String,t);var r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=O));return r}(n)}function w(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function M(t,e,r,n,a,o){if(!i.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>a||e<o)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}function k(t,e,r,n,i,a){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function T(t,e,r,n,i){return e=+e,r>>>=0,i||k(t,0,r,4),D.write(t,e,r,n,23,4),r+4}function A(t,e,r,n,i){return e=+e,r>>>=0,i||k(t,0,r,8),D.write(t,e,r,n,52,8),r+8}function S(t,e){e=e||1/0;for(var r,n=t.length,i=null,a=[],o=0;o<n;++o){if((r=t.charCodeAt(o))>55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&a.push(239,191,189);continue}if(o+1===n){(e-=3)>-1&&a.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&a.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&a.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;a.push(r)}else if(r<2048){if((e-=2)<0)break;a.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;a.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;a.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return a}function E(t){return z.toByteArray(function(t){if((t=t.trim().replace(R,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function L(t,e,r,n){for(var i=0;i<n&&!(i+r>=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function C(t){return"function"==typeof ArrayBuffer.isView&&ArrayBuffer.isView(t)}function I(t){return t!=t}var z=t("base64-js"),D=t("ieee754");r.Buffer=i,r.SlowBuffer=function(t){return+t!=t&&(t=0),i.alloc(+t)},r.INSPECT_MAX_BYTES=50;var P=2147483647;r.kMaxLength=P,(i.TYPED_ARRAY_SUPPORT=function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()}catch(t){return!1}}())||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),"undefined"!=typeof Symbol&&Symbol.species&&i[Symbol.species]===i&&Object.defineProperty(i,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),i.poolSize=8192,i.from=function(t,e,r){return a(t,e,r)},i.prototype.__proto__=Uint8Array.prototype,i.__proto__=Uint8Array,i.alloc=function(t,e,r){return function(t,e,r){return o(t),t<=0?n(t):void 0!==e?"string"==typeof r?n(t).fill(e,r):n(t).fill(e):n(t)}(t,e,r)},i.allocUnsafe=function(t){return s(t)},i.allocUnsafeSlow=function(t){return s(t)},i.isBuffer=function(t){return null!=t&&!0===t._isBuffer},i.compare=function(t,e){if(!i.isBuffer(t)||!i.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,n=e.length,a=0,o=Math.min(r,n);a<o;++a)if(t[a]!==e[a]){r=t[a],n=e[a];break}return r<n?-1:n<r?1:0},i.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},i.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return i.alloc(0);var r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var n=i.allocUnsafe(e),a=0;for(r=0;r<t.length;++r){var o=t[r];if(!i.isBuffer(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(n,a),a+=o.length}return n},i.byteLength=u,i.prototype._isBuffer=!0,i.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)f(this,e,e+1);return this},i.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)f(this,e,e+3),f(this,e+1,e+2);return this},i.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)f(this,e,e+7),f(this,e+1,e+6),f(this,e+2,e+5),f(this,e+3,e+4);return this},i.prototype.toString=function(){var t=this.length;return 0===t?"":0===arguments.length?_(this,0,t):h.apply(this,arguments)},i.prototype.equals=function(t){if(!i.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===i.compare(this,t)},i.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+">"},i.prototype.compare=function(t,e,r,n,a){if(!i.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===a&&(a=this.length),e<0||r>t.length||n<0||a>this.length)throw new RangeError("out of range index");if(n>=a&&e>=r)return 0;if(n>=a)return-1;if(e>=r)return 1;if(e>>>=0,r>>>=0,n>>>=0,a>>>=0,this===t)return 0;for(var o=a-n,s=r-e,l=Math.min(o,s),c=this.slice(n,a),u=t.slice(e,r),h=0;h<l;++h)if(c[h]!==u[h]){o=c[h],s=u[h];break}return o<s?-1:s<o?1:0},i.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},i.prototype.indexOf=function(t,e,r){return d(this,t,e,r,!0)},i.prototype.lastIndexOf=function(t,e,r){return d(this,t,e,r,!1)},i.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-e;if((void 0===r||r>i)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var a=!1;;)switch(n){case"hex":return m(this,t,e,r);case"utf8":case"utf-8":return g(this,t,e,r);case"ascii":return v(this,t,e,r);case"latin1":case"binary":return y(this,t,e,r);case"base64":return b(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return x(this,t,e,r);default:if(a)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),a=!0}},i.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var O=4096;i.prototype.slice=function(t,e){var r=this.length;t=~~t,e=void 0===e?r:~~e,t<0?(t+=r)<0&&(t=0):t>r&&(t=r),e<0?(e+=r)<0&&(e=0):e>r&&(e=r),e<t&&(e=t);var n=this.subarray(t,e);return n.__proto__=i.prototype,n},i.prototype.readUIntLE=function(t,e,r){t>>>=0,e>>>=0,r||w(t,e,this.length);for(var n=this[t],i=1,a=0;++a<e&&(i*=256);)n+=this[t+a]*i;return n},i.prototype.readUIntBE=function(t,e,r){t>>>=0,e>>>=0,r||w(t,e,this.length);for(var n=this[t+--e],i=1;e>0&&(i*=256);)n+=this[t+--e]*i;return n},i.prototype.readUInt8=function(t,e){return t>>>=0,e||w(t,1,this.length),this[t]},i.prototype.readUInt16LE=function(t,e){return t>>>=0,e||w(t,2,this.length),this[t]|this[t+1]<<8},i.prototype.readUInt16BE=function(t,e){return t>>>=0,e||w(t,2,this.length),this[t]<<8|this[t+1]},i.prototype.readUInt32LE=function(t,e){return t>>>=0,e||w(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},i.prototype.readUInt32BE=function(t,e){return t>>>=0,e||w(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},i.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||w(t,e,this.length);for(var n=this[t],i=1,a=0;++a<e&&(i*=256);)n+=this[t+a]*i;return i*=128,n>=i&&(n-=Math.pow(2,8*e)),n},i.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||w(t,e,this.length);for(var n=e,i=1,a=this[t+--n];n>0&&(i*=256);)a+=this[t+--n]*i;return i*=128,a>=i&&(a-=Math.pow(2,8*e)),a},i.prototype.readInt8=function(t,e){return t>>>=0,e||w(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},i.prototype.readInt16LE=function(t,e){t>>>=0,e||w(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},i.prototype.readInt16BE=function(t,e){t>>>=0,e||w(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},i.prototype.readInt32LE=function(t,e){return t>>>=0,e||w(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},i.prototype.readInt32BE=function(t,e){return t>>>=0,e||w(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},i.prototype.readFloatLE=function(t,e){return t>>>=0,e||w(t,4,this.length),D.read(this,t,!0,23,4)},i.prototype.readFloatBE=function(t,e){return t>>>=0,e||w(t,4,this.length),D.read(this,t,!1,23,4)},i.prototype.readDoubleLE=function(t,e){return t>>>=0,e||w(t,8,this.length),D.read(this,t,!0,52,8)},i.prototype.readDoubleBE=function(t,e){return t>>>=0,e||w(t,8,this.length),D.read(this,t,!1,52,8)},i.prototype.writeUIntLE=function(t,e,r,n){if(t=+t,e>>>=0,r>>>=0,!n){M(this,t,e,r,Math.pow(2,8*r)-1,0)}var i=1,a=0;for(this[e]=255&t;++a<r&&(i*=256);)this[e+a]=t/i&255;return e+r},i.prototype.writeUIntBE=function(t,e,r,n){if(t=+t,e>>>=0,r>>>=0,!n){M(this,t,e,r,Math.pow(2,8*r)-1,0)}var i=r-1,a=1;for(this[e+i]=255&t;--i>=0&&(a*=256);)this[e+i]=t/a&255;return e+r},i.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||M(this,t,e,1,255,0),this[e]=255&t,e+1},i.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||M(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},i.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||M(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},i.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||M(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},i.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||M(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},i.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var i=Math.pow(2,8*r-1);M(this,t,e,r,i-1,-i)}var a=0,o=1,s=0;for(this[e]=255&t;++a<r&&(o*=256);)t<0&&0===s&&0!==this[e+a-1]&&(s=1),this[e+a]=(t/o>>0)-s&255;return e+r},i.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var i=Math.pow(2,8*r-1);M(this,t,e,r,i-1,-i)}var a=r-1,o=1,s=0;for(this[e+a]=255&t;--a>=0&&(o*=256);)t<0&&0===s&&0!==this[e+a+1]&&(s=1),this[e+a]=(t/o>>0)-s&255;return e+r},i.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||M(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},i.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||M(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},i.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||M(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},i.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||M(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},i.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||M(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},i.prototype.writeFloatLE=function(t,e,r){return T(this,t,e,!0,r)},i.prototype.writeFloatBE=function(t,e,r){return T(this,t,e,!1,r)},i.prototype.writeDoubleLE=function(t,e,r){return A(this,t,e,!0,r)},i.prototype.writeDoubleBE=function(t,e,r){return A(this,t,e,!1,r)},i.prototype.copy=function(t,e,r,n){if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e<n-r&&(n=t.length-e+r);var i,a=n-r;if(this===t&&r<e&&e<n)for(i=a-1;i>=0;--i)t[i+e]=this[i+r];else if(a<1e3)for(i=0;i<a;++i)t[i+e]=this[i+r];else Uint8Array.prototype.set.call(t,this.subarray(r,r+a),e);return a},i.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),1===t.length){var a=t.charCodeAt(0);a<256&&(t=a)}if(void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!i.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0);var o;if("number"==typeof t)for(o=e;o<r;++o)this[o]=t;else{var s=i.isBuffer(t)?t:new i(t,n),l=s.length;for(o=0;o<r-e;++o)this[o+e]=s[o%l]}return this};var R=/[^+/0-9A-Za-z-_]/g},{"base64-js":81,ieee754:292}],81:[function(t,e,r){"use strict";function n(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===t[e-2]?2:"="===t[e-1]?1:0}function i(t){return o[t>>18&63]+o[t>>12&63]+o[t>>6&63]+o[63&t]}function a(t,e,r){for(var n,a=[],o=e;o<r;o+=3)n=(t[o]<<16)+(t[o+1]<<8)+t[o+2],a.push(i(n));return a.join("")}r.byteLength=function(t){return 3*t.length/4-n(t)},r.toByteArray=function(t){var e,r,i,a,o,c,u=t.length;o=n(t),c=new l(3*u/4-o),i=o>0?u-4:u;var h=0;for(e=0,r=0;e<i;e+=4,r+=3)a=s[t.charCodeAt(e)]<<18|s[t.charCodeAt(e+1)]<<12|s[t.charCodeAt(e+2)]<<6|s[t.charCodeAt(e+3)],c[h++]=a>>16&255,c[h++]=a>>8&255,c[h++]=255&a;return 2===o?(a=s[t.charCodeAt(e)]<<2|s[t.charCodeAt(e+1)]>>4,c[h++]=255&a):1===o&&(a=s[t.charCodeAt(e)]<<10|s[t.charCodeAt(e+1)]<<4|s[t.charCodeAt(e+2)]>>2,c[h++]=a>>8&255,c[h++]=255&a),c},r.fromByteArray=function(t){for(var e,r=t.length,n=r%3,i="",s=[],l=0,c=r-n;l<c;l+=16383)s.push(a(t,l,l+16383>c?c:l+16383));return 1===n?(e=t[r-1],i+=o[e>>2],i+=o[e<<4&63],i+="=="):2===n&&(e=(t[r-2]<<8)+t[r-1],i+=o[e>>10],i+=o[e>>4&63],i+=o[e<<2&63],i+="="),s.push(i),s.join("")};for(var o=[],s=[],l="undefined"!=typeof Uint8Array?Uint8Array:Array,c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",u=0,h=c.length;u<h;++u)o[u]=c[u],s[c.charCodeAt(u)]=u;s["-".charCodeAt(0)]=62,s["_".charCodeAt(0)]=63},{}],82:[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 a(t,e,r){return e in t?t[e]:r}var o=t("./lib/monotone"),s=t("./lib/triangulation"),l=t("./lib/delaunay"),c=t("./lib/filter");e.exports=function(t,e,r){Array.isArray(e)?(r=r||{},e=e||[]):(r=e||{},e=[]);var u=!!a(r,"delaunay",!0),h=!!a(r,"interior",!0),f=!!a(r,"exterior",!0),d=!!a(r,"infinity",!1);if(!h&&!f||0===t.length)return[];var p=o(t,e);if(u||h!==f||d){for(var m=s(t.length,e.map(n).sort(i)),g=0;g<p.length;++g){var v=p[g];m.addTriangle(v[0],v[1],v[2])}return u&&l(t,m),f?h?d?c(m,0,d):m.cells():c(m,1,d):c(m,-1)}return p}},{"./lib/delaunay":83,"./lib/filter":84,"./lib/monotone":85,"./lib/triangulation":86}],83:[function(t,e,r){"use strict";function n(t,e,r,n,a,o){var s=e.opposite(n,a);if(!(s<0)){if(a<n){var l=n;n=a,a=l,l=o,o=s,s=l}e.isConstraint(n,a)||i(t[n],t[a],t[o],t[s])<0&&r.push(n,a)}}var i=t("robust-in-sphere")[4];t("binary-search-bounds");e.exports=function(t,e){for(var r=[],a=t.length,o=e.stars,s=0;s<a;++s)for(var l=o[s],c=1;c<l.length;c+=2)if(!((d=l[c])<s||e.isConstraint(s,d))){for(var u=l[c-1],h=-1,f=1;f<l.length;f+=2)if(l[f-1]===d){h=l[f];break}h<0||i(t[s],t[d],t[u],t[h])<0&&r.push(s,d)}for(;r.length>0;){for(var d=r.pop(),u=-1,h=-1,l=o[s=r.pop()],p=1;p<l.length;p+=2){var m=l[p-1],g=l[p];m===d?h=g:g===d&&(u=m)}u<0||h<0||i(t[s],t[d],t[u],t[h])>=0||(e.flip(s,d),n(t,e,r,u,s,h),n(t,e,r,s,h,u),n(t,e,r,h,d,u),n(t,e,r,d,u,h))}}},{"binary-search-bounds":87,"robust-in-sphere":517}],84:[function(t,e,r){"use strict";function n(t,e,r,n,i,a,o){this.cells=t,this.neighbor=e,this.flags=n,this.constraint=r,this.active=i,this.next=a,this.boundary=o}function i(t,e){return t[0]-e[0]||t[1]-e[1]||t[2]-e[2]}function a(t,e){for(var r=t.cells(),a=r.length,o=0;o<a;++o){var s=(v=r[o])[0],l=v[1],c=v[2];l<c?l<s&&(v[0]=l,v[1]=c,v[2]=s):c<s&&(v[0]=c,v[1]=s,v[2]=l)}r.sort(i);for(var u=new Array(a),o=0;o<u.length;++o)u[o]=0;var h=[],f=[],d=new Array(3*a),p=new Array(3*a),m=null;e&&(m=[]);for(var g=new n(r,d,p,u,h,f,m),o=0;o<a;++o)for(var v=r[o],y=0;y<3;++y){var s=v[y],l=v[(y+1)%3],b=d[3*o+y]=g.locate(l,s,t.opposite(l,s)),x=p[3*o+y]=t.isConstraint(s,l);b<0&&(x?f.push(o):(h.push(o),u[o]=1),e&&m.push([l,s,-1]))}return g}var o=t("binary-search-bounds");e.exports=function(t,e,r){var n=a(t,r);if(0===e)return r?n.cells.concat(n.boundary):n.cells;for(var i=1,o=n.active,s=n.next,l=n.flags,c=n.cells,u=n.constraint,h=n.neighbor;o.length>0||s.length>0;){for(;o.length>0;){var f=o.pop();if(l[f]!==-i){l[f]=i,c[f];for(var d=0;d<3;++d){var p=h[3*f+d];p>=0&&0===l[p]&&(u[3*f+d]?s.push(p):(o.push(p),l[p]=i))}}}var m=s;s=o,o=m,s.length=0,i=-i}var g=function(t,e,r){for(var n=0,i=0;i<t.length;++i)e[i]===r&&(t[n++]=t[i]);return t.length=n,t}(c,l,e);return r?g.concat(n.boundary):g};n.prototype.locate=function(){var t=[0,0,0];return function(e,r,n){var a=e,s=r,l=n;return r<n?r<e&&(a=r,s=n,l=e):n<e&&(a=n,s=e,l=r),a<0?-1:(t[0]=a,t[1]=s,t[2]=l,o.eq(this.cells,t,i))}}()},{"binary-search-bounds":87}],85:[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 a(t,e){var r=t.a[0]-e.a[0]||t.a[1]-e.a[1]||t.type-e.type;return r||(t.type!==d&&(r=f(t.a,t.b,e.b))?r:t.idx-e.idx)}function o(t,e){return f(t.a,t.b,e)}function s(t,e,r,n,i){for(var a=h.lt(e,n,o),s=h.gt(e,n,o),l=a;l<s;++l){for(var c=e[l],u=c.lowerIds,d=u.length;d>1&&f(r[u[d-2]],r[u[d-1]],n)>0;)t.push([u[d-1],u[d-2],i]),d-=1;u.length=d,u.push(i);for(var p=c.upperIds,d=p.length;d>1&&f(r[p[d-2]],r[p[d-1]],n)<0;)t.push([p[d-2],p[d-1],i]),d-=1;p.length=d,p.push(i)}}function l(t,e){var r;return(r=t.a[0]<e.a[0]?f(t.a,t.b,e.a):f(e.b,e.a,t.a))?r:(r=e.b[0]<t.b[0]?f(t.a,t.b,e.b):f(e.b,e.a,t.b))||t.idx-e.idx}function c(t,e,r){var i=h.le(t,r,l),a=t[i],o=a.upperIds,s=o[o.length-1];a.upperIds=[s],t.splice(i+1,0,new n(r.a,r.b,r.idx,[s],o))}function u(t,e,r){var n=r.a;r.a=r.b,r.b=n;var i=h.eq(t,r,l),a=t[i];t[i-1].upperIds=a.upperIds,t.splice(i,1)}var h=t("binary-search-bounds"),f=t("robust-orientation")[3],d=0,p=1,m=2;e.exports=function(t,e){for(var r=t.length,o=e.length,l=[],h=0;h<r;++h)l.push(new i(t[h],null,d,h));for(h=0;h<o;++h){var f=e[h],g=t[f[0]],v=t[f[1]];g[0]<v[0]?l.push(new i(g,v,m,h),new i(v,g,p,h)):g[0]>v[0]&&l.push(new i(v,g,m,h),new i(g,v,p,h))}l.sort(a);for(var y=l[0].a[0]-(1+Math.abs(l[0].a[0]))*Math.pow(2,-52),b=[new n([y,1],[y,0],-1,[],[],[],[])],x=[],h=0,_=l.length;h<_;++h){var w=l[h],M=w.type;M===d?s(x,b,t,w.a,w.idx):M===m?c(b,0,w):u(b,0,w)}return x}},{"binary-search-bounds":87,"robust-orientation":519}],86:[function(t,e,r){"use strict";function n(t,e){this.stars=t,this.edges=e}function i(t,e,r){for(var n=1,i=t.length;n<i;n+=2)if(t[n-1]===e&&t[n]===r)return t[n-1]=t[i-2],t[n]=t[i-1],void(t.length=i-2)}var a=t("binary-search-bounds");e.exports=function(t,e){for(var r=new Array(t),i=0;i<t;++i)r[i]=[];return new n(r,e)};var o=n.prototype;o.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}}(),o.removeTriangle=function(t,e,r){var n=this.stars;i(n[t],e,r),i(n[e],r,t),i(n[r],t,e)},o.addTriangle=function(t,e,r){var n=this.stars;n[t].push(e,r),n[e].push(r,t),n[r].push(t,e)},o.opposite=function(t,e){for(var r=this.stars[e],n=1,i=r.length;n<i;n+=2)if(r[n]===t)return r[n-1];return-1},o.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)},o.edges=function(){for(var t=this.stars,e=[],r=0,n=t.length;r<n;++r)for(var i=t[r],a=0,o=i.length;a<o;a+=2)e.push([i[a],i[a+1]]);return e},o.cells=function(){for(var t=this.stars,e=[],r=0,n=t.length;r<n;++r)for(var i=t[r],a=0,o=i.length;a<o;a+=2){var s=i[a],l=i[a+1];r<Math.min(s,l)&&e.push([r,s,l])}return e}},{"binary-search-bounds":87}],87:[function(t,e,r){"use strict";function n(t,e,r,n,i){var a=["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?a.push(";if(x===y){return m}else if(x<=y){"):a.push(";var p=c(x,y);if(p===0){return m}else if(p<=0){"):a.push(";if(",e,"){i=m;"),r?a.push("l=m+1}else{h=m-1}"):a.push("h=m-1}else{l=m+1}"),a.push("}"),i?a.push("return -1};"):a.push("return i};"),a.join("")}function i(t,e,r,i){return new Function([n("A","x"+t+"y",e,["y"],i),n("P","c(x,y)"+t+"0",e,["y","c"],i),"function dispatchBsearch",r,"(a,y,c,l,h){if(typeof(c)==='function'){return P(a,(l===void 0)?0:l|0,(h===void 0)?a.length-1:h|0,y,c)}else{return A(a,(c===void 0)?0:c|0,(l===void 0)?a.length-1:l|0,y)}}return dispatchBsearch",r].join(""))()}e.exports={ge:i(">=",!1,"GE"),gt:i(">",!1,"GT"),lt:i("<",!0,"LT"),le:i("<=",!0,"LE"),eq:i("-",!0,"EQ",!0)}},{}],88:[function(t,e,r){"use strict";e.exports=function(t){for(var e=1,r=1;r<t.length;++r)for(var n=0;n<r;++n)if(t[r]<t[n])e=-e;else if(t[n]===t[r])return 0;return e}},{}],89:[function(t,e,r){"use strict";function n(t,e){for(var r=0,n=t.length,i=0;i<n;++i)r+=t[i]*e[i];return r}function i(t){var e=t.length;if(0===e)return[];t[0].length;var r=o([t.length+1,t.length+1],1),i=o([t.length+1],1);r[e][e]=0;for(u=0;u<e;++u){for(d=0;d<=u;++d)r[d][u]=r[u][d]=2*n(t[u],t[d]);i[u]=n(t[u],t[u])}for(var a=s(r,i),l=0,c=a[e+1],u=0;u<c.length;++u)l+=c[u];for(var h=new Array(e),u=0;u<e;++u){for(var c=a[u],f=0,d=0;d<c.length;++d)f+=c[d];h[u]=f/l}return h}function a(t){if(0===t.length)return[];for(var e=t[0].length,r=o([e]),n=i(t),a=0;a<t.length;++a)for(var s=0;s<e;++s)r[s]+=t[a][s]*n[a];return r}var o=t("dup"),s=t("robust-linear-solve");a.barycenetric=i,e.exports=a},{dup:128,"robust-linear-solve":518}],90:[function(t,e,r){e.exports=function(t){for(var e=n(t),r=0,i=0;i<t.length;++i)for(var a=t[i],o=0;o<e.length;++o)r+=Math.pow(a[o]-e[o],2);return Math.sqrt(r/t.length)};var n=t("circumcenter")},{circumcenter:89}],91:[function(t,e,r){e.exports=function(t,e,r){return e<r?t<e?e:t>r?r:t:t<r?r:t>e?e:t}},{}],92:[function(t,e,r){"use strict";function n(t){var e=g(t);return[y(e,-1/0),y(e,1/0)]}function i(t){for(var e=new Array(t.length),r=0;r<t.length;++r){var n=t[r];e[r]=[y(n[0],-1/0),y(n[1],-1/0),y(n[0],1/0),y(n[1],1/0)]}return e}function a(t,e,r,n,i){var a,o,s=t.map(function(t){return[p(t[0]),p(t[1])]});for(a=0;a<r.length;++a){var l=r[a];o=l[0];var c=l[1],u=e[o],h=e[c],f=b(v(t[u[0]]),v(t[u[1]]),v(t[h[0]]),v(t[h[1]]));if(f){var d=t.length;t.push([g(f[0]),g(f[1])]),s.push(f),n.push([o,d],[c,d])}}for(n.sort(function(t,e){if(t[0]!==e[0])return t[0]-e[0];var r=s[t[1]],n=s[e[1]];return m(r[0],n[0])||m(r[1],n[1])}),a=n.length-1;a>=0;--a){var y=n[a],x=e[o=y[0]],_=x[0],w=x[1],M=t[_],k=t[w];if((M[0]-k[0]||M[1]-k[1])<0){var T=_;_=w,w=T}x[0]=_;var A,S=x[1]=y[1];for(i&&(A=x[2]);a>0&&n[a-1][0]===o;){var E=(y=n[--a])[1];i?e.push([S,E,A]):e.push([S,E]),S=E}i?e.push([S,w,A]):e.push([S,w])}return s}function o(t,e,r){for(var i=e.length,a=new h(i),o=[],s=0;s<e.length;++s){var l=e[s],c=n(l[0]),u=n(l[1]);o.push([y(c[0],-1/0),y(u[0],-1/0),y(c[1],1/0),y(u[1],1/0)])}f(o,function(t,e){a.link(t,e)});for(var d=!0,p=new Array(i),s=0;s<i;++s){(g=a.find(s))!==s&&(d=!1,t[g]=[Math.min(t[s][0],t[g][0]),Math.min(t[s][1],t[g][1])])}if(d)return null;for(var m=0,s=0;s<i;++s){var g=a.find(s);g===s?(p[s]=m,t[m++]=t[s]):p[s]=-1}t.length=m;for(s=0;s<i;++s)p[s]<0&&(p[s]=p[a.find(s)]);return p}function s(t,e){return t[0]-e[0]||t[1]-e[1]}function l(t,e){var r=t[0]-e[0]||t[1]-e[1];return r||(t[2]<e[2]?-1:t[2]>e[2]?1:0)}function c(t,e,r){if(0!==t.length){if(e)for(c=0;c<t.length;++c){var n=e[(a=t[c])[0]],i=e[a[1]];a[0]=Math.min(n,i),a[1]=Math.max(n,i)}else for(c=0;c<t.length;++c){var a=t[c],n=a[0],i=a[1];a[0]=Math.min(n,i),a[1]=Math.max(n,i)}r?t.sort(l):t.sort(s);for(var o=1,c=1;c<t.length;++c){var u=t[c-1],h=t[c];(h[0]!==u[0]||h[1]!==u[1]||r&&h[2]!==u[2])&&(t[o++]=h)}t.length=o}}function u(t,e,r){var n=function(t,e){for(var r=new Array(e.length),n=0;n<e.length;++n){var i=e[n],a=t[i[0]],o=t[i[1]];r[n]=[y(Math.min(a[0],o[0]),-1/0),y(Math.min(a[1],o[1]),-1/0),y(Math.max(a[0],o[0]),1/0),y(Math.max(a[1],o[1]),1/0)]}return r}(t,e),s=function(t,e,r){var n=[];return f(r,function(r,i){var a=e[r],o=e[i];if(a[0]!==o[0]&&a[0]!==o[1]&&a[1]!==o[0]&&a[1]!==o[1]){var s=t[a[0]],l=t[a[1]],c=t[o[0]],u=t[o[1]];d(s,l,c,u)&&n.push([r,i])}}),n}(t,e,n),l=i(t),u=function(t,e,r,n){var i=[];return f(r,n,function(r,n){var a=e[r];if(a[0]!==n&&a[1]!==n){var o=t[n],s=t[a[0]],l=t[a[1]];d(s,l,o,o)&&i.push([r,n])}}),i}(t,e,n,l),h=o(t,a(t,e,s,u,r));return c(e,h,r),!!h||(s.length>0||u.length>0)}e.exports=function(t,e,r){var n;if(r){n=e;for(var a=new Array(e.length),s=0;s<e.length;++s)h=e[s],a[s]=[h[0],h[1],r[s]];e=a}for(var l=function(e,r,n){var a=o(t,[],i(t));return c(r,a,n),!!a}(0,e,!!r);u(t,e,!!r);)l=!0;if(r&&l)for(n.length=0,r.length=0,s=0;s<e.length;++s){var h=e[s];n.push([h[0],h[1]]),r.push(h[2])}return l};var h=t("union-find"),f=t("box-intersect"),d=t("robust-segment-intersect"),p=t("big-rat"),m=t("big-rat/cmp"),g=t("big-rat/to-float"),v=t("rat-vec"),y=t("nextafter"),b=t("./lib/rat-seg-intersect")},{"./lib/rat-seg-intersect":93,"big-rat":56,"big-rat/cmp":54,"big-rat/to-float":68,"box-intersect":73,nextafter:471,"rat-vec":506,"robust-segment-intersect":522,"union-find":553}],93:[function(t,e,r){"use strict";function n(t,e){return o(i(t[0],e[1]),i(t[1],e[0]))}e.exports=function(t,e,r,i){var o=l(e,t),h=l(i,r),f=n(o,h);if(0===s(f))return null;var d=n(h,l(t,r)),p=a(d,f),m=u(o,p);return c(t,m)};var i=t("big-rat/mul"),a=t("big-rat/div"),o=t("big-rat/sub"),s=t("big-rat/sign"),l=t("rat-vec/sub"),c=t("rat-vec/add"),u=t("rat-vec/muls")},{"big-rat/div":55,"big-rat/mul":65,"big-rat/sign":66,"big-rat/sub":67,"rat-vec/add":505,"rat-vec/muls":507,"rat-vec/sub":508}],94:[function(t,e,r){(function(t){var r=function(){"use strict";function e(r,i,a,o){function s(r,a){if(null===r)return null;if(0==a)return r;var h,f;if("object"!=typeof r)return r;if(e.__isArray(r))h=[];else if(e.__isRegExp(r))h=new RegExp(r.source,n(r)),r.lastIndex&&(h.lastIndex=r.lastIndex);else if(e.__isDate(r))h=new Date(r.getTime());else{if(u&&t.isBuffer(r))return h=new t(r.length),r.copy(h),h;void 0===o?(f=Object.getPrototypeOf(r),h=Object.create(f)):(h=Object.create(o),f=o)}if(i){var d=l.indexOf(r);if(-1!=d)return c[d];l.push(r),c.push(h)}for(var p in r){var m;f&&(m=Object.getOwnPropertyDescriptor(f,p)),m&&null==m.set||(h[p]=s(r[p],a-1))}return h}"object"==typeof i&&(a=i.depth,o=i.prototype,i.filter,i=i.circular);var l=[],c=[],u=void 0!==t;return void 0===i&&(i=!0),void 0===a&&(a=1/0),s(r,a)}function r(t){return Object.prototype.toString.call(t)}function n(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=function(t){return"object"==typeof t&&"[object Date]"===r(t)},e.__isArray=function(t){return"object"==typeof t&&"[object Array]"===r(t)},e.__isRegExp=function(t){return"object"==typeof t&&"[object RegExp]"===r(t)},e.__getRegExpFlags=n,e}();"object"==typeof e&&e.exports&&(e.exports=r)}).call(this,t("buffer").Buffer)},{buffer:80}],95:[function(t,e,r){"use strict";function n(t,e){null==e&&(e=!0);var r=t[0],n=t[1],a=t[2],o=t[3];null==o&&(o=e?1:255),e&&(r*=255,n*=255,a*=255,o*=255);return 16777216*(r=255&i(r,0,255))+((n=255&i(n,0,255))<<16)+((a=255&i(a,0,255))<<8)+(o=255&i(o,0,255))}var i=t("clamp");e.exports=n,e.exports.to=n,e.exports.from=function(t,e){var r=(t=+t)>>>24,n=(16711680&t)>>>16,i=(65280&t)>>>8,a=255&t;return!1===e?[r,n,i,a]:[r/255,n/255,i/255,a/255]}},{clamp:91}],96:[function(t,e,r){"use strict";e.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}},{}],97:[function(t,e,r){(function(r){"use strict";e.exports=function(t){var e,o,s=[],l=1;if("string"==typeof t)if(n[t])s=n[t].slice(),o="rgb";else if("transparent"===t)l=0,o="rgb",s=[0,0,0];else if(/^#[A-Fa-f0-9]+$/.test(t))c=t.slice(1),l=1,(h=c.length)<=4?(s=[parseInt(c[0]+c[0],16),parseInt(c[1]+c[1],16),parseInt(c[2]+c[2],16)],4===h&&(l=parseInt(c[3]+c[3],16)/255)):(s=[parseInt(c[0]+c[1],16),parseInt(c[2]+c[3],16),parseInt(c[4]+c[5],16)],8===h&&(l=parseInt(c[6]+c[7],16)/255)),s[0]||(s[0]=0),s[1]||(s[1]=0),s[2]||(s[2]=0),o="rgb";else if(e=/^((?:rgb|hs[lvb]|hwb|cmyk?|xy[zy]|gray|lab|lchu?v?|[ly]uv|lms)a?)\s*\(([^\)]*)\)/.exec(t)){var c,u=e[1];o=c=u.replace(/a$/,"");var h="cmyk"===c?4:"gray"===c?1:3;s=e[2].trim().split(/\s*,\s*/).map(function(t,e){if(/%$/.test(t))return e===h?parseFloat(t)/100:"rgb"===c?255*parseFloat(t)/100:parseFloat(t);if("h"===c[e]){if(/deg$/.test(t))return parseFloat(t);if(void 0!==a[t])return a[t]}return parseFloat(t)}),u===c&&s.push(1),l=void 0===s[h]?1:s[h],s=s.slice(0,h)}else t.length>10&&/[0-9](?:\s|\/)/.test(t)&&(s=t.match(/([0-9]+)/g).map(function(t){return parseFloat(t)}),o=t.match(/([a-z])/gi).join("").toLowerCase());else"number"==typeof t?(o="rgb",s=[t>>>16,(65280&t)>>>8,255&t]):i(t)?(null!=t.r?(s=[t.r,t.g,t.b],o="rgb"):null!=t.red?(s=[t.red,t.green,t.blue],o="rgb"):null!=t.h?(s=[t.h,t.s,t.l],o="hsl"):null!=t.hue&&(s=[t.hue,t.saturation,t.lightness],o="hsl"),null!=t.a?l=t.a:null!=t.alpha?l=t.alpha:null!=t.opacity&&(l=t.opacity/100)):(Array.isArray(t)||r.ArrayBuffer&&ArrayBuffer.isView&&ArrayBuffer.isView(t))&&(s=[t[0],t[1],t[2]],o="rgb",l=4===t.length?t[3]:1);return{space:o,values:s,alpha:l}};var n=t("color-name"),i=t("is-plain-obj"),a={red:0,orange:60,yellow:120,green:180,blue:240,purple:300}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"color-name":96,"is-plain-obj":300}],98:[function(t,e,r){"use strict";var n=t("color-parse"),i=t("color-space/hsl"),a=t("clamp");e.exports=function(t,e){if(Array.isArray(t))return t;null==e&&(e=!0);var r=n(t);if(!r.space)return[];var o,s=r.values,l=s.length;for(o=0;o<l;o++)s[o]=a(s[o],0,255);if("h"===r.space[0]&&(s=i.rgb(s)),e)for(o=0;o<l;o++)s[o]/=255;return s.push(a(r.alpha,0,1)),s}},{clamp:91,"color-parse":97,"color-space/hsl":99}],99:[function(t,e,r){"use strict";var n=t("./rgb");e.exports={name:"hsl",min:[0,0,0],max:[360,100,100],channel:["hue","saturation","lightness"],alias:["HSL"],rgb:function(t){var e,r,n,i,a,o=t[0]/360,s=t[1]/100,l=t[2]/100;if(0===s)return a=255*l,[a,a,a];e=2*l-(r=l<.5?l*(1+s):l+s-l*s),i=[0,0,0];for(var c=0;c<3;c++)(n=o+1/3*-(c-1))<0?n++:n>1&&n--,a=6*n<1?e+6*(r-e)*n:2*n<1?r:3*n<2?e+(r-e)*(2/3-n)*6:e,i[c]=255*a;return i}},n.hsl=function(t){var e,r,n,i=t[0]/255,a=t[1]/255,o=t[2]/255,s=Math.min(i,a,o),l=Math.max(i,a,o),c=l-s;return l===s?e=0:i===l?e=(a-o)/c:a===l?e=2+(o-i)/c:o===l&&(e=4+(i-a)/c),(e=Math.min(60*e,360))<0&&(e+=360),n=(s+l)/2,r=l===s?0:n<=.5?c/(l+s):c/(2-l-s),[e,100*r,100*n]}},{"./rgb":100}],100:[function(t,e,r){"use strict";e.exports={name:"rgb",min:[0,0,0],max:[255,255,255],channel:["red","green","blue"],alias:["RGB"]}},{}],101:[function(t,e,r){e.exports={jet:[{index:0,rgb:[0,0,131]},{index:.125,rgb:[0,60,170]},{index:.375,rgb:[5,255,255]},{index:.625,rgb:[255,255,0]},{index:.875,rgb:[250,0,0]},{index:1,rgb:[128,0,0]}],hsv:[{index:0,rgb:[255,0,0]},{index:.169,rgb:[253,255,2]},{index:.173,rgb:[247,255,2]},{index:.337,rgb:[0,252,4]},{index:.341,rgb:[0,252,10]},{index:.506,rgb:[1,249,255]},{index:.671,rgb:[2,0,253]},{index:.675,rgb:[8,0,253]},{index:.839,rgb:[255,0,251]},{index:.843,rgb:[255,0,245]},{index:1,rgb:[255,0,6]}],hot:[{index:0,rgb:[0,0,0]},{index:.3,rgb:[230,0,0]},{index:.6,rgb:[255,210,0]},{index:1,rgb:[255,255,255]}],cool:[{index:0,rgb:[0,255,255]},{index:1,rgb:[255,0,255]}],spring:[{index:0,rgb:[255,0,255]},{index:1,rgb:[255,255,0]}],summer:[{index:0,rgb:[0,128,102]},{index:1,rgb:[255,255,102]}],autumn:[{index:0,rgb:[255,0,0]},{index:1,rgb:[255,255,0]}],winter:[{index:0,rgb:[0,0,255]},{index:1,rgb:[0,255,128]}],bone:[{index:0,rgb:[0,0,0]},{index:.376,rgb:[84,84,116]},{index:.753,rgb:[169,200,200]},{index:1,rgb:[255,255,255]}],copper:[{index:0,rgb:[0,0,0]},{index:.804,rgb:[255,160,102]},{index:1,rgb:[255,199,127]}],greys:[{index:0,rgb:[0,0,0]},{index:1,rgb:[255,255,255]}],yignbu:[{index:0,rgb:[8,29,88]},{index:.125,rgb:[37,52,148]},{index:.25,rgb:[34,94,168]},{index:.375,rgb:[29,145,192]},{index:.5,rgb:[65,182,196]},{index:.625,rgb:[127,205,187]},{index:.75,rgb:[199,233,180]},{index:.875,rgb:[237,248,217]},{index:1,rgb:[255,255,217]}],greens:[{index:0,rgb:[0,68,27]},{index:.125,rgb:[0,109,44]},{index:.25,rgb:[35,139,69]},{index:.375,rgb:[65,171,93]},{index:.5,rgb:[116,196,118]},{index:.625,rgb:[161,217,155]},{index:.75,rgb:[199,233,192]},{index:.875,rgb:[229,245,224]},{index:1,rgb:[247,252,245]}],yiorrd:[{index:0,rgb:[128,0,38]},{index:.125,rgb:[189,0,38]},{index:.25,rgb:[227,26,28]},{index:.375,rgb:[252,78,42]},{index:.5,rgb:[253,141,60]},{index:.625,rgb:[254,178,76]},{index:.75,rgb:[254,217,118]},{index:.875,rgb:[255,237,160]},{index:1,rgb:[255,255,204]}],bluered:[{index:0,rgb:[0,0,255]},{index:1,rgb:[255,0,0]}],rdbu:[{index:0,rgb:[5,10,172]},{index:.35,rgb:[106,137,247]},{index:.5,rgb:[190,190,190]},{index:.6,rgb:[220,170,132]},{index:.7,rgb:[230,145,90]},{index:1,rgb:[178,10,28]}],picnic:[{index:0,rgb:[0,0,255]},{index:.1,rgb:[51,153,255]},{index:.2,rgb:[102,204,255]},{index:.3,rgb:[153,204,255]},{index:.4,rgb:[204,204,255]},{index:.5,rgb:[255,255,255]},{index:.6,rgb:[255,204,255]},{index:.7,rgb:[255,153,255]},{index:.8,rgb:[255,102,204]},{index:.9,rgb:[255,102,102]},{index:1,rgb:[255,0,0]}],rainbow:[{index:0,rgb:[150,0,90]},{index:.125,rgb:[0,0,200]},{index:.25,rgb:[0,25,255]},{index:.375,rgb:[0,152,255]},{index:.5,rgb:[44,255,150]},{index:.625,rgb:[151,255,0]},{index:.75,rgb:[255,234,0]},{index:.875,rgb:[255,111,0]},{index:1,rgb:[255,0,0]}],portland:[{index:0,rgb:[12,51,131]},{index:.25,rgb:[10,136,186]},{index:.5,rgb:[242,211,56]},{index:.75,rgb:[242,143,56]},{index:1,rgb:[217,30,30]}],blackbody:[{index:0,rgb:[0,0,0]},{index:.2,rgb:[230,0,0]},{index:.4,rgb:[230,210,0]},{index:.7,rgb:[255,255,255]},{index:1,rgb:[160,200,255]}],earth:[{index:0,rgb:[0,0,130]},{index:.1,rgb:[0,180,180]},{index:.2,rgb:[40,210,40]},{index:.4,rgb:[230,230,50]},{index:.6,rgb:[120,70,20]},{index:1,rgb:[255,255,255]}],electric:[{index:0,rgb:[0,0,0]},{index:.15,rgb:[30,0,100]},{index:.4,rgb:[120,0,100]},{index:.6,rgb:[160,90,0]},{index:.8,rgb:[230,200,0]},{index:1,rgb:[255,250,220]}],alpha:[{index:0,rgb:[255,255,255,0]},{index:0,rgb:[255,255,255,1]}],viridis:[{index:0,rgb:[68,1,84]},{index:.13,rgb:[71,44,122]},{index:.25,rgb:[59,81,139]},{index:.38,rgb:[44,113,142]},{index:.5,rgb:[33,144,141]},{index:.63,rgb:[39,173,129]},{index:.75,rgb:[92,200,99]},{index:.88,rgb:[170,220,50]},{index:1,rgb:[253,231,37]}],inferno:[{index:0,rgb:[0,0,4]},{index:.13,rgb:[31,12,72]},{index:.25,rgb:[85,15,109]},{index:.38,rgb:[136,34,106]},{index:.5,rgb:[186,54,85]},{index:.63,rgb:[227,89,51]},{index:.75,rgb:[249,140,10]},{index:.88,rgb:[249,201,50]},{index:1,rgb:[252,255,164]}],magma:[{index:0,rgb:[0,0,4]},{index:.13,rgb:[28,16,68]},{index:.25,rgb:[79,18,123]},{index:.38,rgb:[129,37,129]},{index:.5,rgb:[181,54,122]},{index:.63,rgb:[229,80,100]},{index:.75,rgb:[251,135,97]},{index:.88,rgb:[254,194,135]},{index:1,rgb:[252,253,191]}],plasma:[{index:0,rgb:[13,8,135]},{index:.13,rgb:[75,3,161]},{index:.25,rgb:[125,3,168]},{index:.38,rgb:[168,34,150]},{index:.5,rgb:[203,70,121]},{index:.63,rgb:[229,107,93]},{index:.75,rgb:[248,148,65]},{index:.88,rgb:[253,195,40]},{index:1,rgb:[240,249,33]}],warm:[{index:0,rgb:[125,0,179]},{index:.13,rgb:[172,0,187]},{index:.25,rgb:[219,0,170]},{index:.38,rgb:[255,0,130]},{index:.5,rgb:[255,63,74]},{index:.63,rgb:[255,123,0]},{index:.75,rgb:[234,176,0]},{index:.88,rgb:[190,228,0]},{index:1,rgb:[147,255,0]}],cool:[{index:0,rgb:[125,0,179]},{index:.13,rgb:[116,0,218]},{index:.25,rgb:[98,74,237]},{index:.38,rgb:[68,146,231]},{index:.5,rgb:[0,204,197]},{index:.63,rgb:[0,247,146]},{index:.75,rgb:[0,255,88]},{index:.88,rgb:[40,255,8]},{index:1,rgb:[147,255,0]}],"rainbow-soft":[{index:0,rgb:[125,0,179]},{index:.1,rgb:[199,0,180]},{index:.2,rgb:[255,0,121]},{index:.3,rgb:[255,108,0]},{index:.4,rgb:[222,194,0]},{index:.5,rgb:[150,255,0]},{index:.6,rgb:[0,255,55]},{index:.7,rgb:[0,246,150]},{index:.8,rgb:[50,167,222]},{index:.9,rgb:[103,51,235]},{index:1,rgb:[124,0,186]}],bathymetry:[{index:0,rgb:[40,26,44]},{index:.13,rgb:[59,49,90]},{index:.25,rgb:[64,76,139]},{index:.38,rgb:[63,110,151]},{index:.5,rgb:[72,142,158]},{index:.63,rgb:[85,174,163]},{index:.75,rgb:[120,206,163]},{index:.88,rgb:[187,230,172]},{index:1,rgb:[253,254,204]}],cdom:[{index:0,rgb:[47,15,62]},{index:.13,rgb:[87,23,86]},{index:.25,rgb:[130,28,99]},{index:.38,rgb:[171,41,96]},{index:.5,rgb:[206,67,86]},{index:.63,rgb:[230,106,84]},{index:.75,rgb:[242,149,103]},{index:.88,rgb:[249,193,135]},{index:1,rgb:[254,237,176]}],chlorophyll:[{index:0,rgb:[18,36,20]},{index:.13,rgb:[25,63,41]},{index:.25,rgb:[24,91,59]},{index:.38,rgb:[13,119,72]},{index:.5,rgb:[18,148,80]},{index:.63,rgb:[80,173,89]},{index:.75,rgb:[132,196,122]},{index:.88,rgb:[175,221,162]},{index:1,rgb:[215,249,208]}],density:[{index:0,rgb:[54,14,36]},{index:.13,rgb:[89,23,80]},{index:.25,rgb:[110,45,132]},{index:.38,rgb:[120,77,178]},{index:.5,rgb:[120,113,213]},{index:.63,rgb:[115,151,228]},{index:.75,rgb:[134,185,227]},{index:.88,rgb:[177,214,227]},{index:1,rgb:[230,241,241]}],"freesurface-blue":[{index:0,rgb:[30,4,110]},{index:.13,rgb:[47,14,176]},{index:.25,rgb:[41,45,236]},{index:.38,rgb:[25,99,212]},{index:.5,rgb:[68,131,200]},{index:.63,rgb:[114,156,197]},{index:.75,rgb:[157,181,203]},{index:.88,rgb:[200,208,216]},{index:1,rgb:[241,237,236]}],"freesurface-red":[{index:0,rgb:[60,9,18]},{index:.13,rgb:[100,17,27]},{index:.25,rgb:[142,20,29]},{index:.38,rgb:[177,43,27]},{index:.5,rgb:[192,87,63]},{index:.63,rgb:[205,125,105]},{index:.75,rgb:[216,162,148]},{index:.88,rgb:[227,199,193]},{index:1,rgb:[241,237,236]}],oxygen:[{index:0,rgb:[64,5,5]},{index:.13,rgb:[106,6,15]},{index:.25,rgb:[144,26,7]},{index:.38,rgb:[168,64,3]},{index:.5,rgb:[188,100,4]},{index:.63,rgb:[206,136,11]},{index:.75,rgb:[220,174,25]},{index:.88,rgb:[231,215,44]},{index:1,rgb:[248,254,105]}],par:[{index:0,rgb:[51,20,24]},{index:.13,rgb:[90,32,35]},{index:.25,rgb:[129,44,34]},{index:.38,rgb:[159,68,25]},{index:.5,rgb:[182,99,19]},{index:.63,rgb:[199,134,22]},{index:.75,rgb:[212,171,35]},{index:.88,rgb:[221,210,54]},{index:1,rgb:[225,253,75]}],phase:[{index:0,rgb:[145,105,18]},{index:.13,rgb:[184,71,38]},{index:.25,rgb:[186,58,115]},{index:.38,rgb:[160,71,185]},{index:.5,rgb:[110,97,218]},{index:.63,rgb:[50,123,164]},{index:.75,rgb:[31,131,110]},{index:.88,rgb:[77,129,34]},{index:1,rgb:[145,105,18]}],salinity:[{index:0,rgb:[42,24,108]},{index:.13,rgb:[33,50,162]},{index:.25,rgb:[15,90,145]},{index:.38,rgb:[40,118,137]},{index:.5,rgb:[59,146,135]},{index:.63,rgb:[79,175,126]},{index:.75,rgb:[120,203,104]},{index:.88,rgb:[193,221,100]},{index:1,rgb:[253,239,154]}],temperature:[{index:0,rgb:[4,35,51]},{index:.13,rgb:[23,51,122]},{index:.25,rgb:[85,59,157]},{index:.38,rgb:[129,79,143]},{index:.5,rgb:[175,95,130]},{index:.63,rgb:[222,112,101]},{index:.75,rgb:[249,146,66]},{index:.88,rgb:[249,196,65]},{index:1,rgb:[232,250,91]}],turbidity:[{index:0,rgb:[34,31,27]},{index:.13,rgb:[65,50,41]},{index:.25,rgb:[98,69,52]},{index:.38,rgb:[131,89,57]},{index:.5,rgb:[161,112,59]},{index:.63,rgb:[185,140,66]},{index:.75,rgb:[202,174,88]},{index:.88,rgb:[216,209,126]},{index:1,rgb:[233,246,171]}],"velocity-blue":[{index:0,rgb:[17,32,64]},{index:.13,rgb:[35,52,116]},{index:.25,rgb:[29,81,156]},{index:.38,rgb:[31,113,162]},{index:.5,rgb:[50,144,169]},{index:.63,rgb:[87,173,176]},{index:.75,rgb:[149,196,189]},{index:.88,rgb:[203,221,211]},{index:1,rgb:[254,251,230]}],"velocity-green":[{index:0,rgb:[23,35,19]},{index:.13,rgb:[24,64,38]},{index:.25,rgb:[11,95,45]},{index:.38,rgb:[39,123,35]},{index:.5,rgb:[95,146,12]},{index:.63,rgb:[152,165,18]},{index:.75,rgb:[201,186,69]},{index:.88,rgb:[233,216,137]},{index:1,rgb:[255,253,205]}],cubehelix:[{index:0,rgb:[0,0,0]},{index:.07,rgb:[22,5,59]},{index:.13,rgb:[60,4,105]},{index:.2,rgb:[109,1,135]},{index:.27,rgb:[161,0,147]},{index:.33,rgb:[210,2,142]},{index:.4,rgb:[251,11,123]},{index:.47,rgb:[255,29,97]},{index:.53,rgb:[255,54,69]},{index:.6,rgb:[255,85,46]},{index:.67,rgb:[255,120,34]},{index:.73,rgb:[255,157,37]},{index:.8,rgb:[241,191,57]},{index:.87,rgb:[224,220,93]},{index:.93,rgb:[218,241,142]},{index:1,rgb:[227,253,198]}]}},{}],102:[function(t,e,r){"use strict";function n(t){for(var e,r="#",n=0;n<3;++n)r+=("00"+(e=(e=t[n]).toString(16))).substr(e.length);return r}function i(t){return"rgba("+t.join(",")+")"}var a=t("arraytools"),o=t("clone"),s=t("./colorScales");e.exports=function(t){var e,r,l,c,u,h,f,d,p,m,g,v,y,b=[],x=[],_=[],w=[];if(a.isPlainObject(t)||(t={}),p=t.nshades||72,d=t.format||"hex",(f=t.colormap)||(f="jet"),"string"==typeof f){if(f=f.toLowerCase(),!s[f])throw Error(f+" not a supported colorscale");h=o(s[f])}else{if(!Array.isArray(f))throw Error("unsupported colormap option",f);h=o(f)}if(h.length>p)throw new Error(f+" map requires nshades to be at least size "+h.length);for(g=Array.isArray(t.alpha)?2!==t.alpha.length?[1,1]:o(t.alpha):"number"==typeof t.alpha?[t.alpha,t.alpha]:[1,1],e=h.map(function(t){return Math.round(t.index*p)}),g[0]<0&&(g[0]=0),g[1]<0&&(g[0]=0),g[0]>1&&(g[0]=1),g[1]>1&&(g[0]=1),y=0;y<e.length;++y)v=h[y].index,4===(r=h[y].rgb).length&&r[3]>=0&&r[3]<=1||(r[3]=g[0]+(g[1]-g[0])*v);for(y=0;y<e.length-1;++y)u=e[y+1]-e[y],l=h[y].rgb,c=h[y+1].rgb,b=b.concat(a.linspace(l[0],c[0],u)),x=x.concat(a.linspace(l[1],c[1],u)),_=_.concat(a.linspace(l[2],c[2],u)),w=w.concat(a.linspace(l[3],c[3],u));return b=b.map(Math.round),x=x.map(Math.round),_=_.map(Math.round),m=a.zip(b,x,_,w),"hex"===d&&(m=m.map(n)),"rgbaString"===d&&(m=m.map(i)),m}},{"./colorScales":101,arraytools:49,clone:94}],103:[function(t,e,r){"use strict";function n(t,e,r){var n=o(t[0],-e[0]),i=o(t[1],-e[1]),a=o(r[0],-e[0]),c=o(r[1],-e[1]),u=l(s(n,a),s(i,c));return u[u.length-1]>=0}e.exports=function(t,e,r,o){var s=i(e,r,o);if(0===s){var l=a(i(t,e,r)),c=a(i(t,e,o));if(l===c){if(0===l){var u=n(t,e,r);return u===n(t,e,o)?0:u?1:-1}return 0}return 0===c?l>0?-1:n(t,e,o)?-1:1:0===l?c>0?1:n(t,e,r)?1:-1:a(c-l)}var h=i(t,e,r);return h>0?s>0&&i(t,e,o)>0?1:-1:h<0?s>0||i(t,e,o)>0?1:-1:i(t,e,o)>0?1:n(t,e,r)?1:-1};var i=t("robust-orientation"),a=t("signum"),o=t("two-sum"),s=t("robust-product"),l=t("robust-sum")},{"robust-orientation":519,"robust-product":520,"robust-sum":524,signum:526,"two-sum":551}],104:[function(t,e,r){function n(t,e){return t-e}e.exports=function(t,e){var r=t.length,a=t.length-e.length;if(a)return a;switch(r){case 0:return 0;case 1:return t[0]-e[0];case 2:return t[0]+t[1]-e[0]-e[1]||i(t[0],t[1])-i(e[0],e[1]);case 3:var o=t[0]+t[1],s=e[0]+e[1];if(a=o+t[2]-(s+e[2]))return a;var l=i(t[0],t[1]),c=i(e[0],e[1]);return i(l,t[2])-i(c,e[2])||i(l+t[2],o)-i(c+e[2],s);case 4:var u=t[0],h=t[1],f=t[2],d=t[3],p=e[0],m=e[1],g=e[2],v=e[3];return u+h+f+d-(p+m+g+v)||i(u,h,f,d)-i(p,m,g,v,p)||i(u+h,u+f,u+d,h+f,h+d,f+d)-i(p+m,p+g,p+v,m+g,m+v,g+v)||i(u+h+f,u+h+d,u+f+d,h+f+d)-i(p+m+g,p+m+v,p+g+v,m+g+v);default:for(var y=t.slice().sort(n),b=e.slice().sort(n),x=0;x<r;++x)if(a=y[x]-b[x])return a;return 0}};var i=Math.min},{}],105:[function(t,e,r){"use strict";var n=t("compare-cell"),i=t("cell-orientation");e.exports=function(t,e){return n(t,e)||i(t)-i(e)}},{"cell-orientation":88,"compare-cell":104}],106:[function(t,e,r){"use strict";var n=t("./lib/ch1d"),i=t("./lib/ch2d"),a=t("./lib/chnd");e.exports=function(t){var e=t.length;if(0===e)return[];if(1===e)return[[0]];var r=t[0].length;return 0===r?[]:1===r?n(t):2===r?i(t):a(t,r)}},{"./lib/ch1d":107,"./lib/ch2d":108,"./lib/chnd":109}],107:[function(t,e,r){"use strict";e.exports=function(t){for(var e=0,r=0,n=1;n<t.length;++n)t[n][0]<t[e][0]&&(e=n),t[n][0]>t[r][0]&&(r=n);return e<r?[[e],[r]]:e>r?[[r],[e]]:[[e]]}},{}],108:[function(t,e,r){"use strict";e.exports=function(t){var e=n(t),r=e.length;if(r<=2)return[];for(var i=new Array(r),a=e[r-1],o=0;o<r;++o){var s=e[o];i[o]=[a,s],a=s}return i};var n=t("monotone-convex-hull-2d")},{"monotone-convex-hull-2d":454}],109:[function(t,e,r){"use strict";e.exports=function(t,e){try{return n(t,!0)}catch(o){var r=i(t);if(r.length<=e)return[];var a=function(t,e){for(var r=t.length,n=new Array(r),i=0;i<e.length;++i)n[i]=t[e[i]];for(var a=e.length,i=0;i<r;++i)e.indexOf(i)<0&&(n[a++]=t[i]);return n}(t,r);return function(t,e){for(var r=t.length,n=e.length,i=0;i<r;++i)for(var a=t[i],o=0;o<a.length;++o){var s=a[o];if(s<n)a[o]=e[s];else{s-=n;for(var l=0;l<n;++l)s>=e[l]&&(s+=1);a[o]=s}}return t}(n(a,!0),r)}};var n=t("incremental-convex-hull"),i=t("affine-hull")},{"affine-hull":44,"incremental-convex-hull":293}],110:[function(t,e,r){e.exports={AFG:"afghan",ALA:"\\b\\wland",ALB:"albania",DZA:"algeria",ASM:"^(?=.*americ).*samoa",AND:"andorra",AGO:"angola",AIA:"anguill?a",ATA:"antarctica",ATG:"antigua",ARG:"argentin",ARM:"armenia",ABW:"^(?!.*bonaire).*\\baruba",AUS:"australia",AUT:"^(?!.*hungary).*austria|\\baustri.*\\bemp",AZE:"azerbaijan",BHS:"bahamas",BHR:"bahrain",BGD:"bangladesh|^(?=.*east).*paki?stan",BRB:"barbados",BLR:"belarus|byelo",BEL:"^(?!.*luxem).*belgium",BLZ:"belize|^(?=.*british).*honduras",BEN:"benin|dahome",BMU:"bermuda",BTN:"bhutan",BOL:"bolivia",BES:"^(?=.*bonaire).*eustatius|^(?=.*carib).*netherlands|\\bbes.?islands",BIH:"herzegovina|bosnia",BWA:"botswana|bechuana",BVT:"bouvet",BRA:"brazil",IOT:"british.?indian.?ocean",BRN:"brunei",BGR:"bulgaria",BFA:"burkina|\\bfaso|upper.?volta",BDI:"burundi",CPV:"verde",KHM:"cambodia|kampuchea|khmer",CMR:"cameroon",CAN:"canada",CYM:"cayman",CAF:"\\bcentral.african.republic",TCD:"\\bchad",CHL:"\\bchile",CHN:"^(?!.*\\bmac)(?!.*\\bhong)(?!.*\\btai)(?!.*\\brep).*china|^(?=.*peo)(?=.*rep).*china",CXR:"christmas",CCK:"\\bcocos|keeling",COL:"colombia",COM:"comoro",COG:"^(?!.*\\bdem)(?!.*\\bd[\\.]?r)(?!.*kinshasa)(?!.*zaire)(?!.*belg)(?!.*l.opoldville)(?!.*free).*\\bcongo",COK:"\\bcook",CRI:"costa.?rica",CIV:"ivoire|ivory",HRV:"croatia",CUB:"\\bcuba",CUW:"^(?!.*bonaire).*\\bcura(c|\xe7)ao",CYP:"cyprus",CSK:"czechoslovakia",CZE:"^(?=.*rep).*czech|czechia|bohemia",COD:"\\bdem.*congo|congo.*\\bdem|congo.*\\bd[\\.]?r|\\bd[\\.]?r.*congo|belgian.?congo|congo.?free.?state|kinshasa|zaire|l.opoldville|drc|droc|rdc",DNK:"denmark",DJI:"djibouti",DMA:"dominica(?!n)",DOM:"dominican.rep",ECU:"ecuador",EGY:"egypt",SLV:"el.?salvador",GNQ:"guine.*eq|eq.*guine|^(?=.*span).*guinea",ERI:"eritrea",EST:"estonia",ETH:"ethiopia|abyssinia",FLK:"falkland|malvinas",FRO:"faroe|faeroe",FJI:"fiji",FIN:"finland",FRA:"^(?!.*\\bdep)(?!.*martinique).*france|french.?republic|\\bgaul",GUF:"^(?=.*french).*guiana",PYF:"french.?polynesia|tahiti",ATF:"french.?southern",GAB:"gabon",GMB:"gambia",GEO:"^(?!.*south).*georgia",DDR:"german.?democratic.?republic|democratic.?republic.*germany|east.germany",DEU:"^(?!.*east).*germany|^(?=.*\\bfed.*\\brep).*german",GHA:"ghana|gold.?coast",GIB:"gibraltar",GRC:"greece|hellenic|hellas",GRL:"greenland",GRD:"grenada",GLP:"guadeloupe",GUM:"\\bguam",GTM:"guatemala",GGY:"guernsey",GIN:"^(?!.*eq)(?!.*span)(?!.*bissau)(?!.*portu)(?!.*new).*guinea",GNB:"bissau|^(?=.*portu).*guinea",GUY:"guyana|british.?guiana",HTI:"haiti",HMD:"heard.*mcdonald",VAT:"holy.?see|vatican|papal.?st",HND:"^(?!.*brit).*honduras",HKG:"hong.?kong",HUN:"^(?!.*austr).*hungary",ISL:"iceland",IND:"india(?!.*ocea)",IDN:"indonesia",IRN:"\\biran|persia",IRQ:"\\biraq|mesopotamia",IRL:"(^ireland)|(^republic.*ireland)",IMN:"^(?=.*isle).*\\bman",ISR:"israel",ITA:"italy",JAM:"jamaica",JPN:"japan",JEY:"jersey",JOR:"jordan",KAZ:"kazak",KEN:"kenya|british.?east.?africa|east.?africa.?prot",KIR:"kiribati",PRK:"^(?=.*democrat|people|north|d.*p.*.r).*\\bkorea|dprk|korea.*(d.*p.*r)",KWT:"kuwait",KGZ:"kyrgyz|kirghiz",LAO:"\\blaos?\\b",LVA:"latvia",LBN:"lebanon",LSO:"lesotho|basuto",LBR:"liberia",LBY:"libya",LIE:"liechtenstein",LTU:"lithuania",LUX:"^(?!.*belg).*luxem",MAC:"maca(o|u)",MDG:"madagascar|malagasy",MWI:"malawi|nyasa",MYS:"malaysia",MDV:"maldive",MLI:"\\bmali\\b",MLT:"\\bmalta",MHL:"marshall",MTQ:"martinique",MRT:"mauritania",MUS:"mauritius",MYT:"\\bmayotte",MEX:"\\bmexic",FSM:"fed.*micronesia|micronesia.*fed",MCO:"monaco",MNG:"mongolia",MNE:"^(?!.*serbia).*montenegro",MSR:"montserrat",MAR:"morocco|\\bmaroc",MOZ:"mozambique",MMR:"myanmar|burma",NAM:"namibia",NRU:"nauru",NPL:"nepal",NLD:"^(?!.*\\bant)(?!.*\\bcarib).*netherlands",ANT:"^(?=.*\\bant).*(nether|dutch)",NCL:"new.?caledonia",NZL:"new.?zealand",NIC:"nicaragua",NER:"\\bniger(?!ia)",NGA:"nigeria",NIU:"niue",NFK:"norfolk",MNP:"mariana",NOR:"norway",OMN:"\\boman|trucial",PAK:"^(?!.*east).*paki?stan",PLW:"palau",PSE:"palestin|\\bgaza|west.?bank",PAN:"panama",PNG:"papua|new.?guinea",PRY:"paraguay",PER:"peru",PHL:"philippines",PCN:"pitcairn",POL:"poland",PRT:"portugal",PRI:"puerto.?rico",QAT:"qatar",KOR:"^(?!.*d.*p.*r)(?!.*democrat)(?!.*people)(?!.*north).*\\bkorea(?!.*d.*p.*r)",MDA:"moldov|b(a|e)ssarabia",REU:"r(e|\xe9)union",ROU:"r(o|u|ou)mania",RUS:"\\brussia|soviet.?union|u\\.?s\\.?s\\.?r|socialist.?republics",RWA:"rwanda",BLM:"barth(e|\xe9)lemy",SHN:"helena",KNA:"kitts|\\bnevis",LCA:"\\blucia",MAF:"^(?=.*collectivity).*martin|^(?=.*france).*martin(?!ique)|^(?=.*french).*martin(?!ique)",SPM:"miquelon",VCT:"vincent",WSM:"^(?!.*amer).*samoa",SMR:"san.?marino",STP:"\\bs(a|\xe3)o.?tom(e|\xe9)",SAU:"\\bsa\\w*.?arabia",SEN:"senegal",SRB:"^(?!.*monte).*serbia",SYC:"seychell",SLE:"sierra",SGP:"singapore",SXM:"^(?!.*martin)(?!.*saba).*maarten",SVK:"^(?!.*cze).*slovak",SVN:"slovenia",SLB:"solomon",SOM:"somali",ZAF:"south.africa|s\\\\..?africa",SGS:"south.?georgia|sandwich",SSD:"\\bs\\w*.?sudan",ESP:"spain",LKA:"sri.?lanka|ceylon",SDN:"^(?!.*\\bs(?!u)).*sudan",SUR:"surinam|dutch.?guiana",SJM:"svalbard",SWZ:"swaziland",SWE:"sweden",CHE:"switz|swiss",SYR:"syria",TWN:"taiwan|taipei|formosa|^(?!.*peo)(?=.*rep).*china",TJK:"tajik",THA:"thailand|\\bsiam",MKD:"macedonia|fyrom",TLS:"^(?=.*leste).*timor|^(?=.*east).*timor",TGO:"togo",TKL:"tokelau",TON:"tonga",TTO:"trinidad|tobago",TUN:"tunisia",TUR:"turkey",TKM:"turkmen",TCA:"turks",TUV:"tuvalu",UGA:"uganda",UKR:"ukrain",ARE:"emirates|^u\\.?a\\.?e\\.?$|united.?arab.?em",GBR:"united.?kingdom|britain|^u\\.?k\\.?$",TZA:"tanzania",USA:"united.?states\\b(?!.*islands)|\\bu\\.?s\\.?a\\.?\\b|^\\s*u\\.?s\\.?\\b(?!.*islands)",UMI:"minor.?outlying.?is",URY:"uruguay",UZB:"uzbek",VUT:"vanuatu|new.?hebrides",VEN:"venezuela",VNM:"^(?!.*republic).*viet.?nam|^(?=.*socialist).*viet.?nam",VGB:"^(?=.*\\bu\\.?\\s?k).*virgin|^(?=.*brit).*virgin|^(?=.*kingdom).*virgin",VIR:"^(?=.*\\bu\\.?\\s?s).*virgin|^(?=.*states).*virgin",WLF:"futuna|wallis",ESH:"western.sahara",YEM:"^(?!.*arab)(?!.*north)(?!.*sana)(?!.*peo)(?!.*dem)(?!.*south)(?!.*aden)(?!.*\\bp\\.?d\\.?r).*yemen",YMD:"^(?=.*peo).*yemen|^(?!.*rep)(?=.*dem).*yemen|^(?=.*south).*yemen|^(?=.*aden).*yemen|^(?=.*\\bp\\.?d\\.?r).*yemen",YUG:"yugoslavia",ZMB:"zambia|northern.?rhodesia",EAZ:"zanzibar",ZWE:"zimbabwe|^(?!.*northern).*rhodesia"}},{}],111:[function(t,e,r){function n(t){return(t=Math.round(t))<0?0:t>255?255:t}function i(t){return t<0?0:t>1?1:t}function a(t){return n("%"===t[t.length-1]?parseFloat(t)/100*255:parseInt(t))}function o(t){return i("%"===t[t.length-1]?parseFloat(t)/100:parseFloat(t))}function s(t,e,r){return r<0?r+=1:r>1&&(r-=1),6*r<1?t+(e-t)*r*6:2*r<1?e:3*r<2?t+(e-t)*(2/3-r)*6:t}function l(t){var e=t.replace(/ /g,"").toLowerCase();if(e in c)return c[e].slice();if("#"===e[0]){if(4===e.length){return(r=parseInt(e.substr(1),16))>=0&&r<=4095?[(3840&r)>>4|(3840&r)>>8,240&r|(240&r)>>4,15&r|(15&r)<<4,1]:null}if(7===e.length){var r=parseInt(e.substr(1),16);return r>=0&&r<=16777215?[(16711680&r)>>16,(65280&r)>>8,255&r,1]:null}return null}var i=e.indexOf("("),l=e.indexOf(")");if(-1!==i&&l+1===e.length){var u=e.substr(0,i),h=e.substr(i+1,l-(i+1)).split(","),f=1;switch(u){case"rgba":if(4!==h.length)return null;f=o(h.pop());case"rgb":return 3!==h.length?null:[a(h[0]),a(h[1]),a(h[2]),f];case"hsla":if(4!==h.length)return null;f=o(h.pop());case"hsl":if(3!==h.length)return null;var d=(parseFloat(h[0])%360+360)%360/360,p=o(h[1]),m=o(h[2]),g=m<=.5?m*(p+1):m+p-m*p,v=2*m-g;return[n(255*s(v,g,d+1/3)),n(255*s(v,g,d)),n(255*s(v,g,d-1/3)),f];default:return null}}return null}var c={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],rebeccapurple:[102,51,153,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};try{r.parseCSSColor=l}catch(t){}},{}],112:[function(t,e,r){"use strict";e.exports=function(t,e,r,n,i,a){var o=i-1,s=i*i,l=o*o,c=(1+2*i)*l,u=i*l,h=s*(3-2*i),f=s*o;if(t.length){a||(a=new Array(t.length));for(var d=t.length-1;d>=0;--d)a[d]=c*t[d]+u*e[d]+h*r[d]+f*n[d];return a}return c*t+u*e+h*r+f*n},e.exports.derivative=function(t,e,r,n,i,a){var o=6*i*i-6*i,s=3*i*i-4*i+1,l=-6*i*i+6*i,c=3*i*i-2*i;if(t.length){a||(a=new Array(t.length));for(var u=t.length-1;u>=0;--u)a[u]=o*t[u]+s*e[u]+l*r[u]+c*n[u];return a}return o*t+s*e+l*r[u]+c*n}},{}],113:[function(t,e,r){"use strict";var n=t("./lib/thunk.js");e.exports=function(t){var e=new function(){this.argTypes=[],this.shimArgs=[],this.arrayArgs=[],this.arrayBlockIndices=[],this.scalarArgs=[],this.offsetArgs=[],this.offsetArgIndex=[],this.indexArgs=[],this.shapeArgs=[],this.funcName="",this.pre=null,this.body=null,this.post=null,this.debug=!1};e.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,n(e)}},{"./lib/thunk.js":115}],114:[function(t,e,r){"use strict";function n(t,e,r){var n,i,a=t.length,o=e.arrayArgs.length,s=e.indexArgs.length>0,l=[],c=[],u=0,h=0;for(n=0;n<a;++n)c.push(["i",n,"=0"].join(""));for(i=0;i<o;++i)for(n=0;n<a;++n)h=u,u=t[n],0===n?c.push(["d",i,"s",n,"=t",i,"p",u].join("")):c.push(["d",i,"s",n,"=(t",i,"p",u,"-s",h,"*t",i,"p",h,")"].join(""));for(c.length>0&&l.push("var "+c.join(",")),n=a-1;n>=0;--n)u=t[n],l.push(["for(i",n,"=0;i",n,"<s",u,";++i",n,"){"].join(""));for(l.push(r),n=0;n<a;++n){for(h=u,u=t[n],i=0;i<o;++i)l.push(["p",i,"+=d",i,"s",n].join(""));s&&(n>0&&l.push(["index[",h,"]-=s",h].join("")),l.push(["++index[",u,"]"].join(""))),l.push("}")}return l.join("\n")}function i(t,e,r){for(var n=t.body,i=[],a=[],o=0;o<t.args.length;++o){var s=t.args[o];if(!(s.count<=0)){var l=new RegExp(s.name,"g"),c="",u=e.arrayArgs.indexOf(o);switch(e.argTypes[o]){case"offset":var h=e.offsetArgIndex.indexOf(o);u=e.offsetArgs[h].array,c="+q"+h;case"array":c="p"+u+c;var f="l"+o,d="a"+u;if(0===e.arrayBlockIndices[u])1===s.count?"generic"===r[u]?s.lvalue?(i.push(["var ",f,"=",d,".get(",c,")"].join("")),n=n.replace(l,f),a.push([d,".set(",c,",",f,")"].join(""))):n=n.replace(l,[d,".get(",c,")"].join("")):n=n.replace(l,[d,"[",c,"]"].join("")):"generic"===r[u]?(i.push(["var ",f,"=",d,".get(",c,")"].join("")),n=n.replace(l,f),s.lvalue&&a.push([d,".set(",c,",",f,")"].join(""))):(i.push(["var ",f,"=",d,"[",c,"]"].join("")),n=n.replace(l,f),s.lvalue&&a.push([d,"[",c,"]=",f].join("")));else{for(var p=[s.name],m=[c],g=0;g<Math.abs(e.arrayBlockIndices[u]);g++)p.push("\\s*\\[([^\\]]+)\\]"),m.push("$"+(g+1)+"*t"+u+"b"+g);if(l=new RegExp(p.join(""),"g"),c=m.join("+"),"generic"===r[u])throw new Error("cwise: Generic arrays not supported in combination with blocks!");n=n.replace(l,[d,"[",c,"]"].join(""))}break;case"scalar":n=n.replace(l,"Y"+e.scalarArgs.indexOf(o));break;case"index":n=n.replace(l,"index");break;case"shape":n=n.replace(l,"shape")}}}return[i.join("\n"),n,a.join("\n")].join("\n").trim()}var a=t("uniq");e.exports=function(t,e){for(var r=e[1].length-Math.abs(t.arrayBlockIndices[0])|0,o=new Array(t.arrayArgs.length),s=new Array(t.arrayArgs.length),l=0;l<t.arrayArgs.length;++l)s[l]=e[2*l],o[l]=e[2*l+1];for(var c=[],u=[],h=[],f=[],d=[],l=0;l<t.arrayArgs.length;++l){t.arrayBlockIndices[l]<0?(h.push(0),f.push(r),c.push(r),u.push(r+t.arrayBlockIndices[l])):(h.push(t.arrayBlockIndices[l]),f.push(t.arrayBlockIndices[l]+r),c.push(0),u.push(t.arrayBlockIndices[l]));for(var p=[],m=0;m<o[l].length;m++)h[l]<=o[l][m]&&o[l][m]<f[l]&&p.push(o[l][m]-h[l]);d.push(p)}for(var g=["SS"],v=["'use strict'"],y=[],m=0;m<r;++m)y.push(["s",m,"=SS[",m,"]"].join(""));for(l=0;l<t.arrayArgs.length;++l){for(g.push("a"+l),g.push("t"+l),g.push("p"+l),m=0;m<r;++m)y.push(["t",l,"p",m,"=t",l,"[",h[l]+m,"]"].join(""));for(m=0;m<Math.abs(t.arrayBlockIndices[l]);++m)y.push(["t",l,"b",m,"=t",l,"[",c[l]+m,"]"].join(""))}for(l=0;l<t.scalarArgs.length;++l)g.push("Y"+l);if(t.shapeArgs.length>0&&y.push("shape=SS.slice(0)"),t.indexArgs.length>0){for(var b=new Array(r),l=0;l<r;++l)b[l]="0";y.push(["index=[",b.join(","),"]"].join(""))}for(l=0;l<t.offsetArgs.length;++l){for(var x=t.offsetArgs[l],_=[],m=0;m<x.offset.length;++m)0!==x.offset[m]&&(1===x.offset[m]?_.push(["t",x.array,"p",m].join("")):_.push([x.offset[m],"*t",x.array,"p",m].join("")));0===_.length?y.push("q"+l+"=0"):y.push(["q",l,"=",_.join("+")].join(""))}var w=a([].concat(t.pre.thisVars).concat(t.body.thisVars).concat(t.post.thisVars));for((y=y.concat(w)).length>0&&v.push("var "+y.join(",")),l=0;l<t.arrayArgs.length;++l)v.push("p"+l+"|=0");t.pre.body.length>3&&v.push(i(t.pre,t,s));var M=i(t.body,t,s),k=function(t){for(var e=0,r=t[0].length;e<r;){for(var n=1;n<t.length;++n)if(t[n][e]!==t[0][e])return e;++e}return e}(d);k<r?v.push(function(t,e,r,i){for(var a=e.length,o=r.arrayArgs.length,s=r.blockSize,l=r.indexArgs.length>0,c=[],u=0;u<o;++u)c.push(["var offset",u,"=p",u].join(""));for(u=t;u<a;++u)c.push(["for(var j"+u+"=SS[",e[u],"]|0;j",u,">0;){"].join("")),c.push(["if(j",u,"<",s,"){"].join("")),c.push(["s",e[u],"=j",u].join("")),c.push(["j",u,"=0"].join("")),c.push(["}else{s",e[u],"=",s].join("")),c.push(["j",u,"-=",s,"}"].join("")),l&&c.push(["index[",e[u],"]=j",u].join(""));for(u=0;u<o;++u){for(var h=["offset"+u],f=t;f<a;++f)h.push(["j",f,"*t",u,"p",e[f]].join(""));c.push(["p",u,"=(",h.join("+"),")"].join(""))}for(c.push(n(e,r,i)),u=t;u<a;++u)c.push("}");return c.join("\n")}(k,d[0],t,M)):v.push(n(d[0],t,M)),t.post.body.length>3&&v.push(i(t.post,t,s)),t.debug&&console.log("-----Generated cwise routine for ",e,":\n"+v.join("\n")+"\n----------");var T=[t.funcName||"unnamed","_cwise_loop_",o[0].join("s"),"m",k,function(t){for(var e=new Array(t.length),r=!0,n=0;n<t.length;++n){var i=t[n],a=i.match(/\d+/);a=a?a[0]:"",0===i.charAt(0)?e[n]="u"+i.charAt(1)+a:e[n]=i.charAt(0)+a,n>0&&(r=r&&e[n]===e[n-1])}return r?e[0]:e.join("")}(s)].join("");return new Function(["function ",T,"(",g.join(","),"){",v.join("\n"),"} return ",T].join(""))()}},{uniq:554}],115:[function(t,e,r){"use strict";var n=t("./compile.js");e.exports=function(t){var e=["'use strict'","var CACHED={}"],r=[],i=t.funcName+"_cwise_thunk";e.push(["return function ",i,"(",t.shimArgs.join(","),"){"].join(""));for(var a=[],o=[],s=[["array",t.arrayArgs[0],".shape.slice(",Math.max(0,t.arrayBlockIndices[0]),t.arrayBlockIndices[0]<0?","+t.arrayBlockIndices[0]+")":")"].join("")],l=[],c=[],u=0;u<t.arrayArgs.length;++u){var h=t.arrayArgs[u];r.push(["t",h,"=array",h,".dtype,","r",h,"=array",h,".order"].join("")),a.push("t"+h),a.push("r"+h),o.push("t"+h),o.push("r"+h+".join()"),s.push("array"+h+".data"),s.push("array"+h+".stride"),s.push("array"+h+".offset|0"),u>0&&(l.push("array"+t.arrayArgs[0]+".shape.length===array"+h+".shape.length+"+(Math.abs(t.arrayBlockIndices[0])-Math.abs(t.arrayBlockIndices[u]))),c.push("array"+t.arrayArgs[0]+".shape[shapeIndex+"+Math.max(0,t.arrayBlockIndices[0])+"]===array"+h+".shape[shapeIndex+"+Math.max(0,t.arrayBlockIndices[u])+"]"))}for(t.arrayArgs.length>1&&(e.push("if (!("+l.join(" && ")+")) throw new Error('cwise: Arrays do not all have the same dimensionality!')"),e.push("for(var shapeIndex=array"+t.arrayArgs[0]+".shape.length-"+Math.abs(t.arrayBlockIndices[0])+"; shapeIndex--\x3e0;) {"),e.push("if (!("+c.join(" && ")+")) throw new Error('cwise: Arrays do not all have the same shape!')"),e.push("}")),u=0;u<t.scalarArgs.length;++u)s.push("scalar"+t.scalarArgs[u]);return r.push(["type=[",o.join(","),"].join()"].join("")),r.push("proc=CACHED[type]"),e.push("var "+r.join(",")),e.push(["if(!proc){","CACHED[type]=proc=compile([",a.join(","),"])}","return proc(",s.join(","),")}"].join("")),t.debug&&console.log("-----Generated thunk:\n"+e.join("\n")+"\n----------"),new Function("compile",e.join("\n"))(n.bind(void 0,t))}},{"./compile.js":114}],116:[function(t,e,r){e.exports=t("cwise-compiler")},{"cwise-compiler":113}],117:[function(t,e,r){!function(t,n){n("object"==typeof r&&void 0!==e?r:t.d3=t.d3||{})}(this,function(t){"use strict";function e(t,e){return[t,e]}function r(t,e,r){var n=(e-t)/Math.max(0,r),i=Math.floor(Math.log(n)/Math.LN10),a=n/Math.pow(10,i);return i>=0?(a>=x?10:a>=_?5:a>=w?2:1)*Math.pow(10,i):-Math.pow(10,-i)/(a>=x?10:a>=_?5:a>=w?2:1)}function n(t,e,r){var n=Math.abs(e-t)/Math.max(0,r),i=Math.pow(10,Math.floor(Math.log(n)/Math.LN10)),a=n/i;return a>=x?i*=10:a>=_?i*=5:a>=w&&(i*=2),e<t?-i:i}function i(t){return t.length}var a=function(t,e){return t<e?-1:t>e?1:t>=e?0:NaN},o=function(t){return 1===t.length&&(t=function(t){return function(e,r){return a(t(e),r)}}(t)),{left:function(e,r,n,i){for(null==n&&(n=0),null==i&&(i=e.length);n<i;){var a=n+i>>>1;t(e[a],r)<0?n=a+1:i=a}return n},right:function(e,r,n,i){for(null==n&&(n=0),null==i&&(i=e.length);n<i;){var a=n+i>>>1;t(e[a],r)>0?i=a:n=a+1}return n}}},s=o(a),l=s.right,c=s.left,u=function(t){return null===t?NaN:+t},h=function(t,e){var r,n,i=t.length,a=0,o=-1,s=0,l=0;if(null==e)for(;++o<i;)isNaN(r=u(t[o]))||(l+=(n=r-s)*(r-(s+=n/++a)));else for(;++o<i;)isNaN(r=u(e(t[o],o,t)))||(l+=(n=r-s)*(r-(s+=n/++a)));if(a>1)return l/(a-1)},f=function(t,e){var r=h(t,e);return r?Math.sqrt(r):r},d=function(t,e){var r,n,i,a=t.length,o=-1;if(null==e){for(;++o<a;)if(null!=(r=t[o])&&r>=r)for(n=i=r;++o<a;)null!=(r=t[o])&&(n>r&&(n=r),i<r&&(i=r))}else for(;++o<a;)if(null!=(r=e(t[o],o,t))&&r>=r)for(n=i=r;++o<a;)null!=(r=e(t[o],o,t))&&(n>r&&(n=r),i<r&&(i=r));return[n,i]},p=Array.prototype,m=p.slice,g=p.map,v=function(t){return function(){return t}},y=function(t){return t},b=function(t,e,r){t=+t,e=+e,r=(i=arguments.length)<2?(e=t,t=0,1):i<3?1:+r;for(var n=-1,i=0|Math.max(0,Math.ceil((e-t)/r)),a=new Array(i);++n<i;)a[n]=t+n*r;return a},x=Math.sqrt(50),_=Math.sqrt(10),w=Math.sqrt(2),M=function(t){return Math.ceil(Math.log(t.length)/Math.LN2)+1},k=function(t,e,r){if(null==r&&(r=u),n=t.length){if((e=+e)<=0||n<2)return+r(t[0],0,t);if(e>=1)return+r(t[n-1],n-1,t);var n,i=(n-1)*e,a=Math.floor(i),o=+r(t[a],a,t);return o+(+r(t[a+1],a+1,t)-o)*(i-a)}},T=function(t,e){var r,n,i=t.length,a=-1;if(null==e){for(;++a<i;)if(null!=(r=t[a])&&r>=r)for(n=r;++a<i;)null!=(r=t[a])&&n>r&&(n=r)}else for(;++a<i;)if(null!=(r=e(t[a],a,t))&&r>=r)for(n=r;++a<i;)null!=(r=e(t[a],a,t))&&n>r&&(n=r);return n},A=function(t){if(!(a=t.length))return[];for(var e=-1,r=T(t,i),n=new Array(r);++e<r;)for(var a,o=-1,s=n[e]=new Array(a);++o<a;)s[o]=t[o][e];return n};t.bisect=l,t.bisectRight=l,t.bisectLeft=c,t.ascending=a,t.bisector=o,t.cross=function(t,r,n){var i,a,o,s,l=t.length,c=r.length,u=new Array(l*c);for(null==n&&(n=e),i=o=0;i<l;++i)for(s=t[i],a=0;a<c;++a,++o)u[o]=n(s,r[a]);return u},t.descending=function(t,e){return e<t?-1:e>t?1:e>=t?0:NaN},t.deviation=f,t.extent=d,t.histogram=function(){function t(t){var a,o,s=t.length,c=new Array(s);for(a=0;a<s;++a)c[a]=e(t[a],a,t);var u=r(c),h=u[0],f=u[1],d=i(c,h,f);Array.isArray(d)||(d=n(h,f,d),d=b(Math.ceil(h/d)*d,Math.floor(f/d)*d,d));for(var p=d.length;d[0]<=h;)d.shift(),--p;for(;d[p-1]>f;)d.pop(),--p;var m,g=new Array(p+1);for(a=0;a<=p;++a)(m=g[a]=[]).x0=a>0?d[a-1]:h,m.x1=a<p?d[a]:f;for(a=0;a<s;++a)h<=(o=c[a])&&o<=f&&g[l(d,o,0,p)].push(t[a]);return g}var e=y,r=d,i=M;return t.value=function(r){return arguments.length?(e="function"==typeof r?r:v(r),t):e},t.domain=function(e){return arguments.length?(r="function"==typeof e?e:v([e[0],e[1]]),t):r},t.thresholds=function(e){return arguments.length?(i="function"==typeof e?e:v(Array.isArray(e)?m.call(e):e),t):i},t},t.thresholdFreedmanDiaconis=function(t,e,r){return t=g.call(t,u).sort(a),Math.ceil((r-e)/(2*(k(t,.75)-k(t,.25))*Math.pow(t.length,-1/3)))},t.thresholdScott=function(t,e,r){return Math.ceil((r-e)/(3.5*f(t)*Math.pow(t.length,-1/3)))},t.thresholdSturges=M,t.max=function(t,e){var r,n,i=t.length,a=-1;if(null==e){for(;++a<i;)if(null!=(r=t[a])&&r>=r)for(n=r;++a<i;)null!=(r=t[a])&&r>n&&(n=r)}else for(;++a<i;)if(null!=(r=e(t[a],a,t))&&r>=r)for(n=r;++a<i;)null!=(r=e(t[a],a,t))&&r>n&&(n=r);return n},t.mean=function(t,e){var r,n=t.length,i=n,a=-1,o=0;if(null==e)for(;++a<n;)isNaN(r=u(t[a]))?--i:o+=r;else for(;++a<n;)isNaN(r=u(e(t[a],a,t)))?--i:o+=r;if(i)return o/i},t.median=function(t,e){var r,n=t.length,i=-1,o=[];if(null==e)for(;++i<n;)isNaN(r=u(t[i]))||o.push(r);else for(;++i<n;)isNaN(r=u(e(t[i],i,t)))||o.push(r);return k(o.sort(a),.5)},t.merge=function(t){for(var e,r,n,i=t.length,a=-1,o=0;++a<i;)o+=t[a].length;for(r=new Array(o);--i>=0;)for(e=(n=t[i]).length;--e>=0;)r[--o]=n[e];return r},t.min=T,t.pairs=function(t,r){null==r&&(r=e);for(var n=0,i=t.length-1,a=t[0],o=new Array(i<0?0:i);n<i;)o[n]=r(a,a=t[++n]);return o},t.permute=function(t,e){for(var r=e.length,n=new Array(r);r--;)n[r]=t[e[r]];return n},t.quantile=k,t.range=b,t.scan=function(t,e){if(r=t.length){var r,n,i=0,o=0,s=t[o];for(null==e&&(e=a);++i<r;)(e(n=t[i],s)<0||0!==e(s,s))&&(s=n,o=i);return 0===e(s,s)?o:void 0}},t.shuffle=function(t,e,r){for(var n,i,a=(null==r?t.length:r)-(e=null==e?0:+e);a;)i=Math.random()*a--|0,n=t[a+e],t[a+e]=t[i+e],t[i+e]=n;return t},t.sum=function(t,e){var r,n=t.length,i=-1,a=0;if(null==e)for(;++i<n;)(r=+t[i])&&(a+=r);else for(;++i<n;)(r=+e(t[i],i,t))&&(a+=r);return a},t.ticks=function(t,e,n){var i,a,o,s=e<t,l=-1;if(s&&(i=t,t=e,e=i),0===(o=r(t,e,n))||!isFinite(o))return[];if(o>0)for(t=Math.ceil(t/o),e=Math.floor(e/o),a=new Array(i=Math.ceil(e-t+1));++l<i;)a[l]=(t+l)*o;else for(t=Math.floor(t*o),e=Math.ceil(e*o),a=new Array(i=Math.ceil(t-e+1));++l<i;)a[l]=(t-l)/o;return s&&a.reverse(),a},t.tickIncrement=r,t.tickStep=n,t.transpose=A,t.variance=h,t.zip=function(){return A(arguments)},Object.defineProperty(t,"__esModule",{value:!0})})},{}],118:[function(t,e,r){!function(t,n){n("object"==typeof r&&void 0!==e?r:t.d3=t.d3||{})}(this,function(t){"use strict";function e(){}function r(t,r){var n=new e;if(t instanceof e)t.each(function(t,e){n.set(e,t)});else if(Array.isArray(t)){var i,a=-1,o=t.length;if(null==r)for(;++a<o;)n.set(a,t[a]);else for(;++a<o;)n.set(r(i=t[a],a,t),i)}else if(t)for(var s in t)n.set(s,t[s]);return n}function n(){return{}}function i(t,e,r){t[e]=r}function a(){return r()}function o(t,e,r){t.set(e,r)}function s(){}function l(t,e){var r=new s;if(t instanceof s)t.each(function(t){r.add(t)});else if(t){var n=-1,i=t.length;if(null==e)for(;++n<i;)r.add(t[n]);else for(;++n<i;)r.add(e(t[n],n,t))}return r}e.prototype=r.prototype={constructor:e,has:function(t){return"$"+t in this},get:function(t){return this["$"+t]},set:function(t,e){return this["$"+t]=e,this},remove:function(t){var e="$"+t;return e in this&&delete this[e]},clear:function(){for(var t in this)"$"===t[0]&&delete this[t]},keys:function(){var t=[];for(var e in this)"$"===e[0]&&t.push(e.slice(1));return t},values:function(){var t=[];for(var e in this)"$"===e[0]&&t.push(this[e]);return t},entries:function(){var t=[];for(var e in this)"$"===e[0]&&t.push({key:e.slice(1),value:this[e]});return t},size:function(){var t=0;for(var e in this)"$"===e[0]&&++t;return t},empty:function(){for(var t in this)if("$"===t[0])return!1;return!0},each:function(t){for(var e in this)"$"===e[0]&&t(this[e],e.slice(1),this)}};var c=r.prototype;s.prototype=l.prototype={constructor:s,has:c.has,add:function(t){return t+="",this["$"+t]=t,this},remove:c.remove,clear:c.clear,values:c.keys,size:c.size,empty:c.empty,each:c.each};t.nest=function(){function t(e,n,i,a){if(n>=u.length)return null!=l?l(e):null!=s?e.sort(s):e;for(var o,c,h,f=-1,d=e.length,p=u[n++],m=r(),g=i();++f<d;)(h=m.get(o=p(c=e[f])+""))?h.push(c):m.set(o,[c]);return m.each(function(e,r){a(g,r,t(e,n,i,a))}),g}function e(t,r){if(++r>u.length)return t;var n,i=h[r-1];return null!=l&&r>=u.length?n=t.entries():(n=[],t.each(function(t,i){n.push({key:i,values:e(t,r)})})),null!=i?n.sort(function(t,e){return i(t.key,e.key)}):n}var s,l,c,u=[],h=[];return c={object:function(e){return t(e,0,n,i)},map:function(e){return t(e,0,a,o)},entries:function(r){return e(t(r,0,a,o),0)},key:function(t){return u.push(t),c},sortKeys:function(t){return h[u.length-1]=t,c},sortValues:function(t){return s=t,c},rollup:function(t){return l=t,c}}},t.set=l,t.map=r,t.keys=function(t){var e=[];for(var r in t)e.push(r);return e},t.values=function(t){var e=[];for(var r in t)e.push(t[r]);return e},t.entries=function(t){var e=[];for(var r in t)e.push({key:r,value:t[r]});return e},Object.defineProperty(t,"__esModule",{value:!0})})},{}],119:[function(t,e,r){!function(t,n){n("object"==typeof r&&void 0!==e?r:t.d3=t.d3||{})}(this,function(t){"use strict";function e(t,e){var r=Object.create(t.prototype);for(var n in e)r[n]=e[n];return r}function r(){}function n(t){var e;return t=(t+"").trim().toLowerCase(),(e=E.exec(t))?(e=parseInt(e[1],16),new l(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1)):(e=L.exec(t))?i(parseInt(e[1],16)):(e=C.exec(t))?new l(e[1],e[2],e[3],1):(e=I.exec(t))?new l(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=z.exec(t))?a(e[1],e[2],e[3],e[4]):(e=D.exec(t))?a(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=P.exec(t))?c(e[1],e[2]/100,e[3]/100,1):(e=O.exec(t))?c(e[1],e[2]/100,e[3]/100,e[4]):R.hasOwnProperty(t)?i(R[t]):"transparent"===t?new l(NaN,NaN,NaN,0):null}function i(t){return new l(t>>16&255,t>>8&255,255&t,1)}function a(t,e,r,n){return n<=0&&(t=e=r=NaN),new l(t,e,r,n)}function o(t){return t instanceof r||(t=n(t)),t?(t=t.rgb(),new l(t.r,t.g,t.b,t.opacity)):new l}function s(t,e,r,n){return 1===arguments.length?o(t):new l(t,e,r,null==n?1:n)}function l(t,e,r,n){this.r=+t,this.g=+e,this.b=+r,this.opacity=+n}function c(t,e,r,n){return n<=0?t=e=r=NaN:r<=0||r>=1?t=e=NaN:e<=0&&(t=NaN),new h(t,e,r,n)}function u(t,e,i,a){return 1===arguments.length?function(t){if(t instanceof h)return new h(t.h,t.s,t.l,t.opacity);if(t instanceof r||(t=n(t)),!t)return new h;if(t instanceof h)return t;var e=(t=t.rgb()).r/255,i=t.g/255,a=t.b/255,o=Math.min(e,i,a),s=Math.max(e,i,a),l=NaN,c=s-o,u=(s+o)/2;return c?(l=e===s?(i-a)/c+6*(i<a):i===s?(a-e)/c+2:(e-i)/c+4,c/=u<.5?s+o:2-s-o,l*=60):c=u>0&&u<1?0:l,new h(l,c,u,t.opacity)}(t):new h(t,e,i,null==a?1:a)}function h(t,e,r,n){this.h=+t,this.s=+e,this.l=+r,this.opacity=+n}function f(t,e,r){return 255*(t<60?e+(r-e)*t/60:t<180?r:t<240?e+(r-e)*(240-t)/60:e)}function d(t){if(t instanceof m)return new m(t.l,t.a,t.b,t.opacity);if(t instanceof _){var e=t.h*F;return new m(t.l,Math.cos(e)*t.c,Math.sin(e)*t.c,t.opacity)}t instanceof l||(t=o(t));var r=b(t.r),n=b(t.g),i=b(t.b),a=g((.4124564*r+.3575761*n+.1804375*i)/N),s=g((.2126729*r+.7151522*n+.072175*i)/B);return new m(116*s-16,500*(a-s),200*(s-g((.0193339*r+.119192*n+.9503041*i)/U)),t.opacity)}function p(t,e,r,n){return 1===arguments.length?d(t):new m(t,e,r,null==n?1:n)}function m(t,e,r,n){this.l=+t,this.a=+e,this.b=+r,this.opacity=+n}function g(t){return t>G?Math.pow(t,1/3):t/q+V}function v(t){return t>H?t*t*t:q*(t-V)}function y(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function b(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function x(t,e,r,n){return 1===arguments.length?function(t){if(t instanceof _)return new _(t.h,t.c,t.l,t.opacity);t instanceof m||(t=d(t));var e=Math.atan2(t.b,t.a)*j;return new _(e<0?e+360:e,Math.sqrt(t.a*t.a+t.b*t.b),t.l,t.opacity)}(t):new _(t,e,r,null==n?1:n)}function _(t,e,r,n){this.h=+t,this.c=+e,this.l=+r,this.opacity=+n}function w(t,e,r,n){return 1===arguments.length?function(t){if(t instanceof M)return new M(t.h,t.s,t.l,t.opacity);t instanceof l||(t=o(t));var e=t.r/255,r=t.g/255,n=t.b/255,i=(K*n+Z*e-J*r)/(K+Z-J),a=n-i,s=(X*(r-i)-Y*a)/W,c=Math.sqrt(s*s+a*a)/(X*i*(1-i)),u=c?Math.atan2(s,a)*j-120:NaN;return new M(u<0?u+360:u,c,i,t.opacity)}(t):new M(t,e,r,null==n?1:n)}function M(t,e,r,n){this.h=+t,this.s=+e,this.l=+r,this.opacity=+n}var k=function(t,e,r){t.prototype=e.prototype=r,r.constructor=t},T="\\s*([+-]?\\d+)\\s*",A="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",S="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",E=/^#([0-9a-f]{3})$/,L=/^#([0-9a-f]{6})$/,C=new RegExp("^rgb\\("+[T,T,T]+"\\)$"),I=new RegExp("^rgb\\("+[S,S,S]+"\\)$"),z=new RegExp("^rgba\\("+[T,T,T,A]+"\\)$"),D=new RegExp("^rgba\\("+[S,S,S,A]+"\\)$"),P=new RegExp("^hsl\\("+[A,S,S]+"\\)$"),O=new RegExp("^hsla\\("+[A,S,S,A]+"\\)$"),R={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};k(r,n,{displayable:function(){return this.rgb().displayable()},toString:function(){return this.rgb()+""}}),k(l,s,e(r,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new l(this.r*t,this.g*t,this.b*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new l(this.r*t,this.g*t,this.b*t,this.opacity)},rgb:function(){return this},displayable:function(){return 0<=this.r&&this.r<=255&&0<=this.g&&this.g<=255&&0<=this.b&&this.b<=255&&0<=this.opacity&&this.opacity<=1},toString:function(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(1===t?")":", "+t+")")}})),k(h,u,e(r,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new h(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new h(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=this.h%360+360*(this.h<0),e=isNaN(t)||isNaN(this.s)?0:this.s,r=this.l,n=r+(r<.5?r:1-r)*e,i=2*r-n;return new l(f(t>=240?t-240:t+120,i,n),f(t,i,n),f(t<120?t+240:t-120,i,n),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1}}));var F=Math.PI/180,j=180/Math.PI,N=.95047,B=1,U=1.08883,V=4/29,H=6/29,q=3*H*H,G=H*H*H;k(m,p,e(r,{brighter:function(t){return new m(this.l+18*(null==t?1:t),this.a,this.b,this.opacity)},darker:function(t){return new m(this.l-18*(null==t?1:t),this.a,this.b,this.opacity)},rgb:function(){var t=(this.l+16)/116,e=isNaN(this.a)?t:t+this.a/500,r=isNaN(this.b)?t:t-this.b/200;return t=B*v(t),e=N*v(e),r=U*v(r),new l(y(3.2404542*e-1.5371385*t-.4985314*r),y(-.969266*e+1.8760108*t+.041556*r),y(.0556434*e-.2040259*t+1.0572252*r),this.opacity)}})),k(_,x,e(r,{brighter:function(t){return new _(this.h,this.c,this.l+18*(null==t?1:t),this.opacity)},darker:function(t){return new _(this.h,this.c,this.l-18*(null==t?1:t),this.opacity)},rgb:function(){return d(this).rgb()}}));var Y=-.29227,W=-.90649,X=1.97294,Z=X*W,J=1.78277*X,K=1.78277*Y- -.14861*W;k(M,w,e(r,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new M(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new M(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=isNaN(this.h)?0:(this.h+120)*F,e=+this.l,r=isNaN(this.s)?0:this.s*e*(1-e),n=Math.cos(t),i=Math.sin(t);return new l(255*(e+r*(-.14861*n+1.78277*i)),255*(e+r*(Y*n+W*i)),255*(e+r*(X*n)),this.opacity)}})),t.color=n,t.rgb=s,t.hsl=u,t.lab=p,t.hcl=x,t.cubehelix=w,Object.defineProperty(t,"__esModule",{value:!0})})},{}],120:[function(t,e,r){!function(t,n){n("object"==typeof r&&void 0!==e?r:t.d3=t.d3||{})}(this,function(t){"use strict";function e(){for(var t,e=0,n=arguments.length,i={};e<n;++e){if(!(t=arguments[e]+"")||t in i)throw new Error("illegal type: "+t);i[t]=[]}return new r(i)}function r(t){this._=t}function n(t,e,r){for(var n=0,a=t.length;n<a;++n)if(t[n].name===e){t[n]=i,t=t.slice(0,n).concat(t.slice(n+1));break}return null!=r&&t.push({name:e,value:r}),t}var i={value:function(){}};r.prototype=e.prototype={constructor:r,on:function(t,e){var r,i=this._,a=function(t,e){return t.trim().split(/^|\s+/).map(function(t){var r="",n=t.indexOf(".");if(n>=0&&(r=t.slice(n+1),t=t.slice(0,n)),t&&!e.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:r}})}(t+"",i),o=-1,s=a.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++o<s;)if(r=(t=a[o]).type)i[r]=n(i[r],t.name,e);else if(null==e)for(r in i)i[r]=n(i[r],t.name,null);return this}for(;++o<s;)if((r=(t=a[o]).type)&&(r=function(t,e){for(var r,n=0,i=t.length;n<i;++n)if((r=t[n]).name===e)return r.value}(i[r],t.name)))return r},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new r(t)},call:function(t,e){if((r=arguments.length-2)>0)for(var r,n,i=new Array(r),a=0;a<r;++a)i[a]=arguments[a+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(a=0,r=(n=this._[t]).length;a<r;++a)n[a].value.apply(e,i)},apply:function(t,e,r){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var n=this._[t],i=0,a=n.length;i<a;++i)n[i].value.apply(e,r)}},t.dispatch=e,Object.defineProperty(t,"__esModule",{value:!0})})},{}],121:[function(t,e,r){!function(n,i){"object"==typeof r&&void 0!==e?i(r,t("d3-quadtree"),t("d3-collection"),t("d3-dispatch"),t("d3-timer")):i(n.d3=n.d3||{},n.d3,n.d3,n.d3,n.d3)}(this,function(t,e,r,n,i){"use strict";function a(t){return t.x+t.vx}function o(t){return t.y+t.vy}function s(t){return t.index}function l(t,e){var r=t.get(e);if(!r)throw new Error("missing: "+e);return r}function c(t){return t.x}function u(t){return t.y}var h=function(t){return function(){return t}},f=function(){return 1e-6*(Math.random()-.5)},d=10,p=Math.PI*(3-Math.sqrt(5));t.forceCenter=function(t,e){function r(){var r,i,a=n.length,o=0,s=0;for(r=0;r<a;++r)o+=(i=n[r]).x,s+=i.y;for(o=o/a-t,s=s/a-e,r=0;r<a;++r)(i=n[r]).x-=o,i.y-=s}var n;return null==t&&(t=0),null==e&&(e=0),r.initialize=function(t){n=t},r.x=function(e){return arguments.length?(t=+e,r):t},r.y=function(t){return arguments.length?(e=+t,r):e},r},t.forceCollide=function(t){function r(){function t(t,e,r,n,i){var a=t.data,o=t.r,s=m+o;if(!a)return e>d+s||n<d-s||r>p+s||i<p-s;if(a.index>h.index){var l=d-a.x-a.vx,u=p-a.y-a.vy,v=l*l+u*u;v<s*s&&(0===l&&(l=f(),v+=l*l),0===u&&(u=f(),v+=u*u),v=(s-(v=Math.sqrt(v)))/v*c,h.vx+=(l*=v)*(s=(o*=o)/(g+o)),h.vy+=(u*=v)*s,a.vx-=l*(s=1-s),a.vy-=u*s)}}for(var r,i,h,d,p,m,g,v=s.length,y=0;y<u;++y)for(i=e.quadtree(s,a,o).visitAfter(n),r=0;r<v;++r)h=s[r],m=l[h.index],g=m*m,d=h.x+h.vx,p=h.y+h.vy,i.visit(t)}function n(t){if(t.data)return t.r=l[t.data.index];for(var e=t.r=0;e<4;++e)t[e]&&t[e].r>t.r&&(t.r=t[e].r)}function i(){if(s){var e,r,n=s.length;for(l=new Array(n),e=0;e<n;++e)r=s[e],l[r.index]=+t(r,e,s)}}var s,l,c=1,u=1;return"function"!=typeof t&&(t=h(null==t?1:+t)),r.initialize=function(t){s=t,i()},r.iterations=function(t){return arguments.length?(u=+t,r):u},r.strength=function(t){return arguments.length?(c=+t,r):c},r.radius=function(e){return arguments.length?(t="function"==typeof e?e:h(+e),i(),r):t},r},t.forceLink=function(t){function e(e){for(var r=0,n=t.length;r<y;++r)for(var i,a,s,l,u,h,d,m=0;m<n;++m)a=(i=t[m]).source,l=(s=i.target).x+s.vx-a.x-a.vx||f(),u=s.y+s.vy-a.y-a.vy||f(),l*=h=((h=Math.sqrt(l*l+u*u))-c[m])/h*e*o[m],u*=h,s.vx-=l*(d=p[m]),s.vy-=u*d,a.vx+=l*(d=1-d),a.vy+=u*d}function n(){if(u){var e,n,s=u.length,h=t.length,f=r.map(u,m);for(e=0,d=new Array(s);e<h;++e)(n=t[e]).index=e,"object"!=typeof n.source&&(n.source=l(f,n.source)),"object"!=typeof n.target&&(n.target=l(f,n.target)),d[n.source.index]=(d[n.source.index]||0)+1,d[n.target.index]=(d[n.target.index]||0)+1;for(e=0,p=new Array(h);e<h;++e)n=t[e],p[e]=d[n.source.index]/(d[n.source.index]+d[n.target.index]);o=new Array(h),i(),c=new Array(h),a()}}function i(){if(u)for(var e=0,r=t.length;e<r;++e)o[e]=+g(t[e],e,t)}function a(){if(u)for(var e=0,r=t.length;e<r;++e)c[e]=+v(t[e],e,t)}var o,c,u,d,p,m=s,g=function(t){return 1/Math.min(d[t.source.index],d[t.target.index])},v=h(30),y=1;return null==t&&(t=[]),e.initialize=function(t){u=t,n()},e.links=function(r){return arguments.length?(t=r,n(),e):t},e.id=function(t){return arguments.length?(m=t,e):m},e.iterations=function(t){return arguments.length?(y=+t,e):y},e.strength=function(t){return arguments.length?(g="function"==typeof t?t:h(+t),i(),e):g},e.distance=function(t){return arguments.length?(v="function"==typeof t?t:h(+t),a(),e):v},e},t.forceManyBody=function(){function t(t){var r,l=a.length,h=e.quadtree(a,c,u).visitAfter(n);for(s=t,r=0;r<l;++r)o=a[r],h.visit(i)}function r(){if(a){var t,e,r=a.length;for(l=new Array(r),t=0;t<r;++t)e=a[t],l[e.index]=+d(e,t,a)}}function n(t){var e,r,n,i,a,o=0;if(t.length){for(n=i=a=0;a<4;++a)(e=t[a])&&(r=e.value)&&(o+=r,n+=r*e.x,i+=r*e.y);t.x=n/o,t.y=i/o}else{(e=t).x=e.data.x,e.y=e.data.y;do{o+=l[e.data.index]}while(e=e.next)}t.value=o}function i(t,e,r,n){if(!t.value)return!0;var i=t.x-o.x,a=t.y-o.y,c=n-e,u=i*i+a*a;if(c*c/g<u)return u<m&&(0===i&&(i=f(),u+=i*i),0===a&&(a=f(),u+=a*a),u<p&&(u=Math.sqrt(p*u)),o.vx+=i*t.value*s/u,o.vy+=a*t.value*s/u),!0;if(!(t.length||u>=m)){(t.data!==o||t.next)&&(0===i&&(i=f(),u+=i*i),0===a&&(a=f(),u+=a*a),u<p&&(u=Math.sqrt(p*u)));do{t.data!==o&&(c=l[t.data.index]*s/u,o.vx+=i*c,o.vy+=a*c)}while(t=t.next)}}var a,o,s,l,d=h(-30),p=1,m=1/0,g=.81;return t.initialize=function(t){a=t,r()},t.strength=function(e){return arguments.length?(d="function"==typeof e?e:h(+e),r(),t):d},t.distanceMin=function(e){return arguments.length?(p=e*e,t):Math.sqrt(p)},t.distanceMax=function(e){return arguments.length?(m=e*e,t):Math.sqrt(m)},t.theta=function(e){return arguments.length?(g=e*e,t):Math.sqrt(g)},t},t.forceSimulation=function(t){function e(){a(),y.call("tick",l),c<u&&(v.stop(),y.call("end",l))}function a(){var e,r,n=t.length;for(c+=(f-c)*h,g.each(function(t){t(c)}),e=0;e<n;++e)null==(r=t[e]).fx?r.x+=r.vx*=m:(r.x=r.fx,r.vx=0),null==r.fy?r.y+=r.vy*=m:(r.y=r.fy,r.vy=0)}function o(){for(var e,r=0,n=t.length;r<n;++r){if(e=t[r],e.index=r,isNaN(e.x)||isNaN(e.y)){var i=d*Math.sqrt(r),a=r*p;e.x=i*Math.cos(a),e.y=i*Math.sin(a)}(isNaN(e.vx)||isNaN(e.vy))&&(e.vx=e.vy=0)}}function s(e){return e.initialize&&e.initialize(t),e}var l,c=1,u=.001,h=1-Math.pow(u,1/300),f=0,m=.6,g=r.map(),v=i.timer(e),y=n.dispatch("tick","end");return null==t&&(t=[]),o(),l={tick:a,restart:function(){return v.restart(e),l},stop:function(){return v.stop(),l},nodes:function(e){return arguments.length?(t=e,o(),g.each(s),l):t},alpha:function(t){return arguments.length?(c=+t,l):c},alphaMin:function(t){return arguments.length?(u=+t,l):u},alphaDecay:function(t){return arguments.length?(h=+t,l):+h},alphaTarget:function(t){return arguments.length?(f=+t,l):f},velocityDecay:function(t){return arguments.length?(m=1-t,l):1-m},force:function(t,e){return arguments.length>1?(null==e?g.remove(t):g.set(t,s(e)),l):g.get(t)},find:function(e,r,n){var i,a,o,s,l,c=0,u=t.length;for(null==n?n=1/0:n*=n,c=0;c<u;++c)(o=(i=e-(s=t[c]).x)*i+(a=r-s.y)*a)<n&&(l=s,n=o);return l},on:function(t,e){return arguments.length>1?(y.on(t,e),l):y.on(t)}}},t.forceX=function(t){function e(t){for(var e,r=0,o=n.length;r<o;++r)(e=n[r]).vx+=(a[r]-e.x)*i[r]*t}function r(){if(n){var e,r=n.length;for(i=new Array(r),a=new Array(r),e=0;e<r;++e)i[e]=isNaN(a[e]=+t(n[e],e,n))?0:+o(n[e],e,n)}}var n,i,a,o=h(.1);return"function"!=typeof t&&(t=h(null==t?0:+t)),e.initialize=function(t){n=t,r()},e.strength=function(t){return arguments.length?(o="function"==typeof t?t:h(+t),r(),e):o},e.x=function(n){return arguments.length?(t="function"==typeof n?n:h(+n),r(),e):t},e},t.forceY=function(t){function e(t){for(var e,r=0,o=n.length;r<o;++r)(e=n[r]).vy+=(a[r]-e.y)*i[r]*t}function r(){if(n){var e,r=n.length;for(i=new Array(r),a=new Array(r),e=0;e<r;++e)i[e]=isNaN(a[e]=+t(n[e],e,n))?0:+o(n[e],e,n)}}var n,i,a,o=h(.1);return"function"!=typeof t&&(t=h(null==t?0:+t)),e.initialize=function(t){n=t,r()},e.strength=function(t){return arguments.length?(o="function"==typeof t?t:h(+t),r(),e):o},e.y=function(n){return arguments.length?(t="function"==typeof n?n:h(+n),r(),e):t},e},Object.defineProperty(t,"__esModule",{value:!0})})},{"d3-collection":118,"d3-dispatch":120,"d3-quadtree":123,"d3-timer":124}],122:[function(t,e,r){!function(n,i){"object"==typeof r&&void 0!==e?i(r,t("d3-color")):i(n.d3=n.d3||{},n.d3)}(this,function(t,e){"use strict";function r(t,e,r,n,i){var a=t*t,o=a*t;return((1-3*t+3*a-o)*e+(4-6*a+3*o)*r+(1+3*t+3*a-3*o)*n+o*i)/6}function n(t,e){return function(r){return t+r*e}}function i(t,e){var r=e-t;return r?n(t,r>180||r<-180?r-360*Math.round(r/360):r):b(isNaN(t)?e:t)}function a(t){return 1==(t=+t)?o:function(e,r){return r-e?function(t,e,r){return t=Math.pow(t,r),e=Math.pow(e,r)-t,r=1/r,function(n){return Math.pow(t+n*e,r)}}(e,r,t):b(isNaN(e)?r:e)}}function o(t,e){var r=e-t;return r?n(t,r):b(isNaN(t)?e:t)}function s(t){return function(r){var n,i,a=r.length,o=new Array(a),s=new Array(a),l=new Array(a);for(n=0;n<a;++n)i=e.rgb(r[n]),o[n]=i.r||0,s[n]=i.g||0,l[n]=i.b||0;return o=t(o),s=t(s),l=t(l),i.opacity=1,function(t){return i.r=o(t),i.g=s(t),i.b=l(t),i+""}}}function l(t,e,r,n){function i(t){return t.length?t.pop()+" ":""}return function(a,o){var s=[],l=[];return a=t(a),o=t(o),function(t,n,i,a,o,s){if(t!==i||n!==a){var l=o.push("translate(",null,e,null,r);s.push({i:l-4,x:T(t,i)},{i:l-2,x:T(n,a)})}else(i||a)&&o.push("translate("+i+e+a+r)}(a.translateX,a.translateY,o.translateX,o.translateY,s,l),function(t,e,r,a){t!==e?(t-e>180?e+=360:e-t>180&&(t+=360),a.push({i:r.push(i(r)+"rotate(",null,n)-2,x:T(t,e)})):e&&r.push(i(r)+"rotate("+e+n)}(a.rotate,o.rotate,s,l),function(t,e,r,a){t!==e?a.push({i:r.push(i(r)+"skewX(",null,n)-2,x:T(t,e)}):e&&r.push(i(r)+"skewX("+e+n)}(a.skewX,o.skewX,s,l),function(t,e,r,n,a,o){if(t!==r||e!==n){var s=a.push(i(a)+"scale(",null,",",null,")");o.push({i:s-4,x:T(t,r)},{i:s-2,x:T(e,n)})}else 1===r&&1===n||a.push(i(a)+"scale("+r+","+n+")")}(a.scaleX,a.scaleY,o.scaleX,o.scaleY,s,l),a=o=null,function(t){for(var e,r=-1,n=l.length;++r<n;)s[(e=l[r]).i]=e.x(t);return s.join("")}}}function c(t){return((t=Math.exp(t))+1/t)/2}function u(t){return function(r,n){var i=t((r=e.hsl(r)).h,(n=e.hsl(n)).h),a=o(r.s,n.s),s=o(r.l,n.l),l=o(r.opacity,n.opacity);return function(t){return r.h=i(t),r.s=a(t),r.l=s(t),r.opacity=l(t),r+""}}}function h(t){return function(r,n){var i=t((r=e.hcl(r)).h,(n=e.hcl(n)).h),a=o(r.c,n.c),s=o(r.l,n.l),l=o(r.opacity,n.opacity);return function(t){return r.h=i(t),r.c=a(t),r.l=s(t),r.opacity=l(t),r+""}}}function f(t){return function r(n){function i(r,i){var a=t((r=e.cubehelix(r)).h,(i=e.cubehelix(i)).h),s=o(r.s,i.s),l=o(r.l,i.l),c=o(r.opacity,i.opacity);return function(t){return r.h=a(t),r.s=s(t),r.l=l(Math.pow(t,n)),r.opacity=c(t),r+""}}return n=+n,i.gamma=r,i}(1)}var d,p,m,g,v=function(t){var e=t.length-1;return function(n){var i=n<=0?n=0:n>=1?(n=1,e-1):Math.floor(n*e),a=t[i],o=t[i+1],s=i>0?t[i-1]:2*a-o,l=i<e-1?t[i+2]:2*o-a;return r((n-i/e)*e,s,a,o,l)}},y=function(t){var e=t.length;return function(n){var i=Math.floor(((n%=1)<0?++n:n)*e),a=t[(i+e-1)%e],o=t[i%e],s=t[(i+1)%e],l=t[(i+2)%e];return r((n-i/e)*e,a,o,s,l)}},b=function(t){return function(){return t}},x=function t(r){function n(t,r){var n=i((t=e.rgb(t)).r,(r=e.rgb(r)).r),a=i(t.g,r.g),s=i(t.b,r.b),l=o(t.opacity,r.opacity);return function(e){return t.r=n(e),t.g=a(e),t.b=s(e),t.opacity=l(e),t+""}}var i=a(r);return n.gamma=t,n}(1),_=s(v),w=s(y),M=function(t,e){var r,n=e?e.length:0,i=t?Math.min(n,t.length):0,a=new Array(n),o=new Array(n);for(r=0;r<i;++r)a[r]=C(t[r],e[r]);for(;r<n;++r)o[r]=e[r];return function(t){for(r=0;r<i;++r)o[r]=a[r](t);return o}},k=function(t,e){var r=new Date;return t=+t,e-=t,function(n){return r.setTime(t+e*n),r}},T=function(t,e){return t=+t,e-=t,function(r){return t+e*r}},A=function(t,e){var r,n={},i={};null!==t&&"object"==typeof t||(t={}),null!==e&&"object"==typeof e||(e={});for(r in e)r in t?n[r]=C(t[r],e[r]):i[r]=e[r];return function(t){for(r in n)i[r]=n[r](t);return i}},S=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,E=new RegExp(S.source,"g"),L=function(t,e){var r,n,i,a=S.lastIndex=E.lastIndex=0,o=-1,s=[],l=[];for(t+="",e+="";(r=S.exec(t))&&(n=E.exec(e));)(i=n.index)>a&&(i=e.slice(a,i),s[o]?s[o]+=i:s[++o]=i),(r=r[0])===(n=n[0])?s[o]?s[o]+=n:s[++o]=n:(s[++o]=null,l.push({i:o,x:T(r,n)})),a=E.lastIndex;return a<e.length&&(i=e.slice(a),s[o]?s[o]+=i:s[++o]=i),s.length<2?l[0]?function(t){return function(e){return t(e)+""}}(l[0].x):function(t){return function(){return t}}(e):(e=l.length,function(t){for(var r,n=0;n<e;++n)s[(r=l[n]).i]=r.x(t);return s.join("")})},C=function(t,r){var n,i=typeof r;return null==r||"boolean"===i?b(r):("number"===i?T:"string"===i?(n=e.color(r))?(r=n,x):L:r instanceof e.color?x:r instanceof Date?k:Array.isArray(r)?M:"function"!=typeof r.valueOf&&"function"!=typeof r.toString||isNaN(r)?A:T)(t,r)},I=180/Math.PI,z={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1},D=function(t,e,r,n,i,a){var o,s,l;return(o=Math.sqrt(t*t+e*e))&&(t/=o,e/=o),(l=t*r+e*n)&&(r-=t*l,n-=e*l),(s=Math.sqrt(r*r+n*n))&&(r/=s,n/=s,l/=s),t*n<e*r&&(t=-t,e=-e,l=-l,o=-o),{translateX:i,translateY:a,rotate:Math.atan2(e,t)*I,skewX:Math.atan(l)*I,scaleX:o,scaleY:s}},P=l(function(t){return"none"===t?z:(d||(d=document.createElement("DIV"),p=document.documentElement,m=document.defaultView),d.style.transform=t,t=m.getComputedStyle(p.appendChild(d),null).getPropertyValue("transform"),p.removeChild(d),t=t.slice(7,-1).split(","),D(+t[0],+t[1],+t[2],+t[3],+t[4],+t[5]))},"px, ","px)","deg)"),O=l(function(t){return null==t?z:(g||(g=document.createElementNS("http://www.w3.org/2000/svg","g")),g.setAttribute("transform",t),(t=g.transform.baseVal.consolidate())?(t=t.matrix,D(t.a,t.b,t.c,t.d,t.e,t.f)):z)},", ",")",")"),R=Math.SQRT2,F=u(i),j=u(o),N=h(i),B=h(o),U=f(i),V=f(o);t.interpolate=C,t.interpolateArray=M,t.interpolateBasis=v,t.interpolateBasisClosed=y,t.interpolateDate=k,t.interpolateNumber=T,t.interpolateObject=A,t.interpolateRound=function(t,e){return t=+t,e-=t,function(r){return Math.round(t+e*r)}},t.interpolateString=L,t.interpolateTransformCss=P,t.interpolateTransformSvg=O,t.interpolateZoom=function(t,e){var r,n,i=t[0],a=t[1],o=t[2],s=e[0],l=e[1],u=e[2],h=s-i,f=l-a,d=h*h+f*f;if(d<1e-12)n=Math.log(u/o)/R,r=function(t){return[i+t*h,a+t*f,o*Math.exp(R*t*n)]};else{var p=Math.sqrt(d),m=(u*u-o*o+4*d)/(2*o*2*p),g=(u*u-o*o-4*d)/(2*u*2*p),v=Math.log(Math.sqrt(m*m+1)-m),y=Math.log(Math.sqrt(g*g+1)-g);n=(y-v)/R,r=function(t){var e=t*n,r=c(v),s=o/(2*p)*(r*function(t){return((t=Math.exp(2*t))-1)/(t+1)}(R*e+v)-function(t){return((t=Math.exp(t))-1/t)/2}(v));return[i+s*h,a+s*f,o*r/c(R*e+v)]}}return r.duration=1e3*n,r},t.interpolateRgb=x,t.interpolateRgbBasis=_,t.interpolateRgbBasisClosed=w,t.interpolateHsl=F,t.interpolateHslLong=j,t.interpolateLab=function(t,r){var n=o((t=e.lab(t)).l,(r=e.lab(r)).l),i=o(t.a,r.a),a=o(t.b,r.b),s=o(t.opacity,r.opacity);return function(e){return t.l=n(e),t.a=i(e),t.b=a(e),t.opacity=s(e),t+""}},t.interpolateHcl=N,t.interpolateHclLong=B,t.interpolateCubehelix=U,t.interpolateCubehelixLong=V,t.quantize=function(t,e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t(n/(e-1));return r},Object.defineProperty(t,"__esModule",{value:!0})})},{"d3-color":119}],123:[function(t,e,r){!function(t,n){n("object"==typeof r&&void 0!==e?r:t.d3=t.d3||{})}(this,function(t){"use strict";function e(t,e,r,n){if(isNaN(e)||isNaN(r))return t;var i,a,o,s,l,c,u,h,f,d=t._root,p={data:n},m=t._x0,g=t._y0,v=t._x1,y=t._y1;if(!d)return t._root=p,t;for(;d.length;)if((c=e>=(a=(m+v)/2))?m=a:v=a,(u=r>=(o=(g+y)/2))?g=o:y=o,i=d,!(d=d[h=u<<1|c]))return i[h]=p,t;if(s=+t._x.call(null,d.data),l=+t._y.call(null,d.data),e===s&&r===l)return p.next=d,i?i[h]=p:t._root=p,t;do{i=i?i[h]=new Array(4):t._root=new Array(4),(c=e>=(a=(m+v)/2))?m=a:v=a,(u=r>=(o=(g+y)/2))?g=o:y=o}while((h=u<<1|c)==(f=(l>=o)<<1|s>=a));return i[f]=d,i[h]=p,t}function r(t,e,r){var i=new n(null==e?function(t){return t[0]}:e,null==r?function(t){return t[1]}:r,NaN,NaN,NaN,NaN);return null==t?i:i.addAll(t)}function n(t,e,r,n,i,a){this._x=t,this._y=e,this._x0=r,this._y0=n,this._x1=i,this._y1=a,this._root=void 0}function i(t){for(var e={data:t.data},r=e;t=t.next;)r=r.next={data:t.data};return e}var a=function(t,e,r,n,i){this.node=t,this.x0=e,this.y0=r,this.x1=n,this.y1=i},o=r.prototype=n.prototype;o.copy=function(){var t,e,r=new n(this._x,this._y,this._x0,this._y0,this._x1,this._y1),a=this._root;if(!a)return r;if(!a.length)return r._root=i(a),r;for(t=[{source:a,target:r._root=new Array(4)}];a=t.pop();)for(var o=0;o<4;++o)(e=a.source[o])&&(e.length?t.push({source:e,target:a.target[o]=new Array(4)}):a.target[o]=i(e));return r},o.add=function(t){var r=+this._x.call(null,t),n=+this._y.call(null,t);return e(this.cover(r,n),r,n,t)},o.addAll=function(t){var r,n,i,a,o=t.length,s=new Array(o),l=new Array(o),c=1/0,u=1/0,h=-1/0,f=-1/0;for(n=0;n<o;++n)isNaN(i=+this._x.call(null,r=t[n]))||isNaN(a=+this._y.call(null,r))||(s[n]=i,l[n]=a,i<c&&(c=i),i>h&&(h=i),a<u&&(u=a),a>f&&(f=a));for(h<c&&(c=this._x0,h=this._x1),f<u&&(u=this._y0,f=this._y1),this.cover(c,u).cover(h,f),n=0;n<o;++n)e(this,s[n],l[n],t[n]);return this},o.cover=function(t,e){if(isNaN(t=+t)||isNaN(e=+e))return this;var r=this._x0,n=this._y0,i=this._x1,a=this._y1;if(isNaN(r))i=(r=Math.floor(t))+1,a=(n=Math.floor(e))+1;else{if(!(r>t||t>i||n>e||e>a))return this;var o,s,l=i-r,c=this._root;switch(s=(e<(n+a)/2)<<1|t<(r+i)/2){case 0:do{o=new Array(4),o[s]=c,c=o}while(l*=2,i=r+l,a=n+l,t>i||e>a);break;case 1:do{o=new Array(4),o[s]=c,c=o}while(l*=2,r=i-l,a=n+l,r>t||e>a);break;case 2:do{o=new Array(4),o[s]=c,c=o}while(l*=2,i=r+l,n=a-l,t>i||n>e);break;case 3:do{o=new Array(4),o[s]=c,c=o}while(l*=2,r=i-l,n=a-l,r>t||n>e)}this._root&&this._root.length&&(this._root=c)}return this._x0=r,this._y0=n,this._x1=i,this._y1=a,this},o.data=function(){var t=[];return this.visit(function(e){if(!e.length)do{t.push(e.data)}while(e=e.next)}),t},o.extent=function(t){return arguments.length?this.cover(+t[0][0],+t[0][1]).cover(+t[1][0],+t[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]},o.find=function(t,e,r){var n,i,o,s,l,c,u,h=this._x0,f=this._y0,d=this._x1,p=this._y1,m=[],g=this._root;for(g&&m.push(new a(g,h,f,d,p)),null==r?r=1/0:(h=t-r,f=e-r,d=t+r,p=e+r,r*=r);c=m.pop();)if(!(!(g=c.node)||(i=c.x0)>d||(o=c.y0)>p||(s=c.x1)<h||(l=c.y1)<f))if(g.length){var v=(i+s)/2,y=(o+l)/2;m.push(new a(g[3],v,y,s,l),new a(g[2],i,y,v,l),new a(g[1],v,o,s,y),new a(g[0],i,o,v,y)),(u=(e>=y)<<1|t>=v)&&(c=m[m.length-1],m[m.length-1]=m[m.length-1-u],m[m.length-1-u]=c)}else{var b=t-+this._x.call(null,g.data),x=e-+this._y.call(null,g.data),_=b*b+x*x;if(_<r){var w=Math.sqrt(r=_);h=t-w,f=e-w,d=t+w,p=e+w,n=g.data}}return n},o.remove=function(t){if(isNaN(a=+this._x.call(null,t))||isNaN(o=+this._y.call(null,t)))return this;var e,r,n,i,a,o,s,l,c,u,h,f,d=this._root,p=this._x0,m=this._y0,g=this._x1,v=this._y1;if(!d)return this;if(d.length)for(;;){if((c=a>=(s=(p+g)/2))?p=s:g=s,(u=o>=(l=(m+v)/2))?m=l:v=l,e=d,!(d=d[h=u<<1|c]))return this;if(!d.length)break;(e[h+1&3]||e[h+2&3]||e[h+3&3])&&(r=e,f=h)}for(;d.data!==t;)if(n=d,!(d=d.next))return this;return(i=d.next)&&delete d.next,n?(i?n.next=i:delete n.next,this):e?(i?e[h]=i:delete e[h],(d=e[0]||e[1]||e[2]||e[3])&&d===(e[3]||e[2]||e[1]||e[0])&&!d.length&&(r?r[f]=d:this._root=d),this):(this._root=i,this)},o.removeAll=function(t){for(var e=0,r=t.length;e<r;++e)this.remove(t[e]);return this},o.root=function(){return this._root},o.size=function(){var t=0;return this.visit(function(e){if(!e.length)do{++t}while(e=e.next)}),t},o.visit=function(t){var e,r,n,i,o,s,l=[],c=this._root;for(c&&l.push(new a(c,this._x0,this._y0,this._x1,this._y1));e=l.pop();)if(!t(c=e.node,n=e.x0,i=e.y0,o=e.x1,s=e.y1)&&c.length){var u=(n+o)/2,h=(i+s)/2;(r=c[3])&&l.push(new a(r,u,h,o,s)),(r=c[2])&&l.push(new a(r,n,h,u,s)),(r=c[1])&&l.push(new a(r,u,i,o,h)),(r=c[0])&&l.push(new a(r,n,i,u,h))}return this},o.visitAfter=function(t){var e,r=[],n=[];for(this._root&&r.push(new a(this._root,this._x0,this._y0,this._x1,this._y1));e=r.pop();){var i=e.node;if(i.length){var o,s=e.x0,l=e.y0,c=e.x1,u=e.y1,h=(s+c)/2,f=(l+u)/2;(o=i[0])&&r.push(new a(o,s,l,h,f)),(o=i[1])&&r.push(new a(o,h,l,c,f)),(o=i[2])&&r.push(new a(o,s,f,h,u)),(o=i[3])&&r.push(new a(o,h,f,c,u))}n.push(e)}for(;e=n.pop();)t(e.node,e.x0,e.y0,e.x1,e.y1);return this},o.x=function(t){return arguments.length?(this._x=t,this):this._x},o.y=function(t){return arguments.length?(this._y=t,this):this._y},t.quadtree=r,Object.defineProperty(t,"__esModule",{value:!0})})},{}],124:[function(t,e,r){!function(t,n){n("object"==typeof r&&void 0!==e?r:t.d3=t.d3||{})}(this,function(t){"use strict";function e(){return g||(b(r),g=y.now()+v)}function r(){g=0}function n(){this._call=this._time=this._next=null}function i(t,e,r){var i=new n;return i.restart(t,e,r),i}function a(){e(),++h;for(var t,r=c;r;)(t=g-r._time)>=0&&r._call.call(null,t),r=r._next;--h}function o(){g=(m=y.now())+v,h=f=0;try{a()}finally{h=0,function(){var t,e,r=c,n=1/0;for(;r;)r._call?(n>r._time&&(n=r._time),t=r,r=r._next):(e=r._next,r._next=null,r=t?t._next=e:c=e);u=t,l(n)}(),g=0}}function s(){var t=y.now(),e=t-m;e>p&&(v-=e,m=t)}function l(t){if(!h){f&&(f=clearTimeout(f));var e=t-g;e>24?(t<1/0&&(f=setTimeout(o,e)),d&&(d=clearInterval(d))):(d||(m=g,d=setInterval(s,p)),h=1,b(o))}}var c,u,h=0,f=0,d=0,p=1e3,m=0,g=0,v=0,y="object"==typeof performance&&performance.now?performance:Date,b="function"==typeof requestAnimationFrame?requestAnimationFrame:function(t){setTimeout(t,17)};n.prototype=i.prototype={constructor:n,restart:function(t,r,n){if("function"!=typeof t)throw new TypeError("callback is not a function");n=(null==n?e():+n)+(null==r?0:+r),this._next||u===this||(u?u._next=this:c=this,u=this),this._call=t,this._time=n,l()},stop:function(){this._call&&(this._call=null,this._time=1/0,l())}};t.now=e,t.timer=i,t.timerFlush=a,t.timeout=function(t,e,r){var i=new n;return e=null==e?0:+e,i.restart(function(r){i.stop(),t(r+e)},e,r),i},t.interval=function(t,r,i){var a=new n,o=r;return null==r?(a.restart(t,r,i),a):(r=+r,i=null==i?e():+i,a.restart(function e(n){n+=o,a.restart(e,o+=r,i),t(n)},r,i),a)},Object.defineProperty(t,"__esModule",{value:!0})})},{}],125:[function(t,e,r){!function(){function t(t){return t&&(t.ownerDocument||t.document||t).documentElement}function r(t){return t&&(t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView)}function n(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function i(t){return null===t?NaN:+t}function a(t){return!isNaN(t)}function o(t){return{left:function(e,r,n,i){for(arguments.length<3&&(n=0),arguments.length<4&&(i=e.length);n<i;){var a=n+i>>>1;t(e[a],r)<0?n=a+1:i=a}return n},right:function(e,r,n,i){for(arguments.length<3&&(n=0),arguments.length<4&&(i=e.length);n<i;){var a=n+i>>>1;t(e[a],r)>0?i=a:n=a+1}return n}}}function s(t){return t.length}function l(t,e){for(var r in e)Object.defineProperty(t.prototype,r,{value:e[r],enumerable:!1})}function c(){this._=Object.create(null)}function u(t){return(t+="")===oa||t[0]===sa?sa+t:t}function h(t){return(t+="")[0]===sa?t.slice(1):t}function f(t){return u(t)in this._}function d(t){return(t=u(t))in this._&&delete this._[t]}function p(){var t=[];for(var e in this._)t.push(h(e));return t}function m(){var t=0;for(var e in this._)++t;return t}function g(){for(var t in this._)return!1;return!0}function v(){this._=Object.create(null)}function y(t){return t}function b(t,e){if(e in t)return e;e=e.charAt(0).toUpperCase()+e.slice(1);for(var r=0,n=la.length;r<n;++r){var i=la[r]+e;if(i in t)return i}}function x(){}function _(){}function w(t){function e(){for(var e,n=r,i=-1,a=n.length;++i<a;)(e=n[i].on)&&e.apply(this,arguments);return t}var r=[],n=new c;return e.on=function(e,i){var a,o=n.get(e);return arguments.length<2?o&&o.on:(o&&(o.on=null,r=r.slice(0,a=r.indexOf(o)).concat(r.slice(a+1)),n.remove(e)),i&&r.push(n.set(e,{on:i})),t)},e}function M(){Zi.event.preventDefault()}function k(){for(var t,e=Zi.event;t=e.sourceEvent;)e=t;return e}function T(t){for(var e=new _,r=0,n=arguments.length;++r<n;)e[arguments[r]]=w(e);return e.of=function(r,n){return function(i){try{var a=i.sourceEvent=Zi.event;i.target=t,Zi.event=i,e[i.type].apply(r,n)}finally{Zi.event=a}}},e}function A(t){return ua(t,pa),t}function S(t){return"function"==typeof t?t:function(){return ha(t,this)}}function E(t){return"function"==typeof t?t:function(){return fa(t,this)}}function L(t,e){return t=Zi.ns.qualify(t),null==e?t.local?function(){this.removeAttributeNS(t.space,t.local)}:function(){this.removeAttribute(t)}:"function"==typeof e?t.local?function(){var r=e.apply(this,arguments);null==r?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,r)}:function(){var r=e.apply(this,arguments);null==r?this.removeAttribute(t):this.setAttribute(t,r)}:t.local?function(){this.setAttributeNS(t.space,t.local,e)}:function(){this.setAttribute(t,e)}}function C(t){return t.trim().replace(/\s+/g," ")}function I(t){return new RegExp("(?:^|\\s+)"+Zi.requote(t)+"(?:\\s+|$)","g")}function z(t){return(t+"").trim().split(/^|\s+/)}function D(t,e){var r=(t=z(t).map(P)).length;return"function"==typeof e?function(){for(var n=-1,i=e.apply(this,arguments);++n<r;)t[n](this,i)}:function(){for(var n=-1;++n<r;)t[n](this,e)}}function P(t){var e=I(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 O(t,e,r){return null==e?function(){this.style.removeProperty(t)}:"function"==typeof e?function(){var n=e.apply(this,arguments);null==n?this.style.removeProperty(t):this.style.setProperty(t,n,r)}:function(){this.style.setProperty(t,e,r)}}function R(t,e){return null==e?function(){delete this[t]}:"function"==typeof e?function(){var r=e.apply(this,arguments);null==r?delete this[t]:this[t]=r}:function(){this[t]=e}}function F(t){return"function"==typeof t?t:(t=Zi.ns.qualify(t)).local?function(){return this.ownerDocument.createElementNS(t.space,t.local)}:function(){var e=this.ownerDocument,r=this.namespaceURI;return r===ma&&e.documentElement.namespaceURI===ma?e.createElement(t):e.createElementNS(r,t)}}function j(){var t=this.parentNode;t&&t.removeChild(this)}function N(t){return{__data__:t}}function B(t){return function(){return da(this,t)}}function U(t,e){for(var r=0,n=t.length;r<n;r++)for(var i,a=t[r],o=0,s=a.length;o<s;o++)(i=a[o])&&e(i,o,r);return t}function V(t){return ua(t,va),t}function H(t,e,r){function n(){var e=this[i];e&&(this.removeEventListener(t,e,e.$),delete this[i])}var i="__on"+t,a=t.indexOf("."),o=q;a>0&&(t=t.slice(0,a));var s=ya.get(t);return s&&(t=s,o=G),a?e?function(){var a=o(e,Ki(arguments));n.call(this),this.addEventListener(t,this[i]=a,a.$=r),a._=e}:n:e?x:function(){var e,r=new RegExp("^__on([^.]+)"+Zi.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]}}}function q(t,e){return function(r){var n=Zi.event;Zi.event=r,e[0]=this.__data__;try{t.apply(this,e)}finally{Zi.event=n}}}function G(t,e){var r=q(t,e);return function(t){var e=this,n=t.relatedTarget;n&&(n===e||8&n.compareDocumentPosition(e))||r.call(e,t)}}function Y(e){var n=".dragsuppress-"+ ++xa,i="click"+n,a=Zi.select(r(e)).on("touchmove"+n,M).on("dragstart"+n,M).on("selectstart"+n,M);if(null==ba&&(ba=!("onselectstart"in e)&&b(e.style,"userSelect")),ba){var o=t(e).style,s=o[ba];o[ba]="none"}return function(t){if(a.on(n,null),ba&&(o[ba]=s),t){var e=function(){a.on(i,null)};a.on(i,function(){M(),e()},!0),setTimeout(e,0)}}}function W(t,e){e.changedTouches&&(e=e.changedTouches[0]);var n=t.ownerSVGElement||t;if(n.createSVGPoint){var i=n.createSVGPoint();if(_a<0){var a=r(t);if(a.scrollX||a.scrollY){var o=(n=Zi.select("body").append("svg").style({position:"absolute",top:0,left:0,margin:0,padding:0,border:"none"},"important"))[0][0].getScreenCTM();_a=!(o.f||o.e),n.remove()}}return _a?(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 X(){return Zi.event.changedTouches[0].identifier}function Z(t){return t>0?1:t<0?-1:0}function J(t,e,r){return(e[0]-t[0])*(r[1]-t[1])-(e[1]-t[1])*(r[0]-t[0])}function K(t){return t>1?0:t<-1?ka:Math.acos(t)}function Q(t){return t>1?Sa:t<-1?-Sa:Math.asin(t)}function $(t){return((t=Math.exp(t))+1/t)/2}function tt(t){return(t=Math.sin(t/2))*t}function et(){}function rt(t,e,r){return this instanceof rt?(this.h=+t,this.s=+e,void(this.l=+r)):arguments.length<2?t instanceof rt?new rt(t.h,t.s,t.l):gt(""+t,vt,rt):new rt(t,e,r)}function nt(t,e,r){function n(t){return Math.round(255*function(t){return t>360?t-=360:t<0&&(t+=360),t<60?i+(a-i)*t/60:t<180?a:t<240?i+(a-i)*(240-t)/60:i}(t))}var i,a;return t=isNaN(t)?0:(t%=360)<0?t+360:t,e=isNaN(e)?0:e<0?0:e>1?1:e,r=r<0?0:r>1?1:r,a=r<=.5?r*(1+e):r+e-r*e,i=2*r-a,new ft(n(t+120),n(t),n(t-120))}function it(t,e,r){return this instanceof it?(this.h=+t,this.c=+e,void(this.l=+r)):arguments.length<2?t instanceof it?new it(t.h,t.c,t.l):t instanceof ot?lt(t.l,t.a,t.b):lt((t=yt((t=Zi.rgb(t)).r,t.g,t.b)).l,t.a,t.b):new it(t,e,r)}function at(t,e,r){return isNaN(t)&&(t=0),isNaN(e)&&(e=0),new ot(r,Math.cos(t*=Ea)*e,Math.sin(t)*e)}function ot(t,e,r){return this instanceof ot?(this.l=+t,this.a=+e,void(this.b=+r)):arguments.length<2?t instanceof ot?new ot(t.l,t.a,t.b):t instanceof it?at(t.h,t.c,t.l):yt((t=ft(t)).r,t.g,t.b):new ot(t,e,r)}function st(t,e,r){var n=(t+16)/116,i=n+e/500,a=n-r/200;return i=ct(i)*Fa,n=ct(n)*ja,a=ct(a)*Na,new ft(ht(3.2404542*i-1.5371385*n-.4985314*a),ht(-.969266*i+1.8760108*n+.041556*a),ht(.0556434*i-.2040259*n+1.0572252*a))}function lt(t,e,r){return t>0?new it(Math.atan2(r,e)*La,Math.sqrt(e*e+r*r),t):new it(NaN,NaN,t)}function ct(t){return t>.206893034?t*t*t:(t-4/29)/7.787037}function ut(t){return t>.008856?Math.pow(t,1/3):7.787037*t+4/29}function ht(t){return Math.round(255*(t<=.00304?12.92*t:1.055*Math.pow(t,1/2.4)-.055))}function ft(t,e,r){return this instanceof ft?(this.r=~~t,this.g=~~e,void(this.b=~~r)):arguments.length<2?t instanceof ft?new ft(t.r,t.g,t.b):gt(""+t,ft,nt):new ft(t,e,r)}function dt(t){return new ft(t>>16,t>>8&255,255&t)}function pt(t){return dt(t)+""}function mt(t){return t<16?"0"+Math.max(0,t).toString(16):Math.min(255,t).toString(16)}function gt(t,e,r){var n,i,a,o=0,s=0,l=0;if(n=/([a-z]+)\((.*)\)/.exec(t=t.toLowerCase()))switch(i=n[2].split(","),n[1]){case"hsl":return r(parseFloat(i[0]),parseFloat(i[1])/100,parseFloat(i[2])/100);case"rgb":return e(xt(i[0]),xt(i[1]),xt(i[2]))}return(a=Va.get(t))?e(a.r,a.g,a.b):(null==t||"#"!==t.charAt(0)||isNaN(a=parseInt(t.slice(1),16))||(4===t.length?(o=(3840&a)>>4,o|=o>>4,s=240&a,s|=s>>4,l=15&a,l|=l<<4):7===t.length&&(o=(16711680&a)>>16,s=(65280&a)>>8,l=255&a)),e(o,s,l))}function vt(t,e,r){var n,i,a=Math.min(t/=255,e/=255,r/=255),o=Math.max(t,e,r),s=o-a,l=(o+a)/2;return s?(i=l<.5?s/(o+a):s/(2-o-a),n=t==o?(e-r)/s+(e<r?6:0):e==o?(r-t)/s+2:(t-e)/s+4,n*=60):(n=NaN,i=l>0&&l<1?0:n),new rt(n,i,l)}function yt(t,e,r){var n=ut((.4124564*(t=bt(t))+.3575761*(e=bt(e))+.1804375*(r=bt(r)))/Fa),i=ut((.2126729*t+.7151522*e+.072175*r)/ja);return ot(116*i-16,500*(n-i),200*(i-ut((.0193339*t+.119192*e+.9503041*r)/Na)))}function bt(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function xt(t){var e=parseFloat(t);return"%"===t.charAt(t.length-1)?Math.round(2.55*e):e}function _t(t){return"function"==typeof t?t:function(){return t}}function wt(t){return function(e,r,n){return 2===arguments.length&&"function"==typeof r&&(n=r,r=null),Mt(e,r,t,n)}}function Mt(t,e,r,n){function i(){var t,e=l.status;if(!e&&function(t){var e=t.responseType;return e&&"text"!==e?t.response:t.responseText}(l)||e>=200&&e<300||304===e){try{t=r.call(a,l)}catch(t){return void o.error.call(a,t)}o.load.call(a,t)}else o.error.call(a,l)}var a={},o=Zi.dispatch("beforesend","progress","load","error"),s={},l=new XMLHttpRequest,c=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=Zi.event;Zi.event=t;try{o.progress.call(a,l)}finally{Zi.event=e}},a.header=function(t,e){return t=(t+"").toLowerCase(),arguments.length<2?s[t]:(null==e?delete s[t]:s[t]=e+"",a)},a.mimeType=function(t){return arguments.length?(e=null==t?null:t+"",a):e},a.responseType=function(t){return arguments.length?(c=t,a):c},a.response=function(t){return r=t,a},["get","post"].forEach(function(t){a[t]=function(){return a.send.apply(a,[t].concat(Ki(arguments)))}}),a.send=function(r,n,i){if(2===arguments.length&&"function"==typeof n&&(i=n,n=null),l.open(r,t,!0),null==e||"accept"in s||(s.accept=e+",*/*"),l.setRequestHeader)for(var u in s)l.setRequestHeader(u,s[u]);return null!=e&&l.overrideMimeType&&l.overrideMimeType(e),null!=c&&(l.responseType=c),null!=i&&a.on("error",i).on("load",function(t){i(null,t)}),o.beforesend.call(a,l),l.send(null==n?null:n),a},a.abort=function(){return l.abort(),a},Zi.rebind(a,o,"on"),null==n?a:a.get(function(t){return 1===t.length?function(e,r){t(null==e?r:null)}:t}(n))}function kt(t,e,r){var n=arguments.length;n<2&&(e=0),n<3&&(r=Date.now());var i={c:t,t:r+e,n:null};return qa?qa.n=i:Ha=i,qa=i,Ga||(Ya=clearTimeout(Ya),Ga=1,Wa(Tt)),i}function Tt(){var t=At(),e=St()-t;e>24?(isFinite(e)&&(clearTimeout(Ya),Ya=setTimeout(Tt,e)),Ga=0):(Ga=1,Wa(Tt))}function At(){for(var t=Date.now(),e=Ha;e;)t>=e.t&&e.c(t-e.t)&&(e.c=null),e=e.n;return t}function St(){for(var t,e=Ha,r=1/0;e;)e.c?(e.t<r&&(r=e.t),e=(t=e).n):e=t?t.n=e.n:Ha=e.n;return qa=t,r}function Et(t,e){return e-(t?Math.ceil(Math.log(t)/Math.LN10):1)}function Lt(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}function Ct(t,e,r){function n(e){var r=t(e),n=a(r,1);return e-r<n-e?r:n}function i(r){return e(r=t(new Qa(r-1)),1),r}function a(t,r){return e(t=new Qa(+t),r),t}function o(t,n,a){var o=i(t),s=[];if(a>1)for(;o<n;)r(o)%a||s.push(new Date(+o)),e(o,1);else for(;o<n;)s.push(new Date(+o)),e(o,1);return s}t.floor=t,t.round=n,t.ceil=i,t.offset=a,t.range=o;var s=t.utc=It(t);return s.floor=s,s.round=It(n),s.ceil=It(i),s.offset=It(a),s.range=function(t,e,r){try{Qa=Lt;var n=new Lt;return n._=t,o(n,e,r)}finally{Qa=Date}},t}function It(t){return function(e,r){try{Qa=Lt;var n=new Lt;return n._=e,t(n,r)._}finally{Qa=Date}}}function zt(t,e,r){var n=t<0?"-":"",i=(n?-t:t)+"",a=i.length;return n+(a<r?new Array(r-a+1).join(e)+i:i)}function Dt(t){return new RegExp("^(?:"+t.map(Zi.requote).join("|")+")","i")}function Pt(t){for(var e=new c,r=-1,n=t.length;++r<n;)e.set(t[r].toLowerCase(),r);return e}function Ot(t,e,r){eo.lastIndex=0;var n=eo.exec(e.slice(r,r+1));return n?(t.w=+n[0],r+n[0].length):-1}function Rt(t,e,r){eo.lastIndex=0;var n=eo.exec(e.slice(r));return n?(t.U=+n[0],r+n[0].length):-1}function Ft(t,e,r){eo.lastIndex=0;var n=eo.exec(e.slice(r));return n?(t.W=+n[0],r+n[0].length):-1}function jt(t,e,r){eo.lastIndex=0;var n=eo.exec(e.slice(r,r+4));return n?(t.y=+n[0],r+n[0].length):-1}function Nt(t,e,r){eo.lastIndex=0;var n=eo.exec(e.slice(r,r+2));return n?(t.y=function(t){return t+(t>68?1900:2e3)}(+n[0]),r+n[0].length):-1}function Bt(t,e,r){return/^[+-]\d{4}$/.test(e=e.slice(r,r+5))?(t.Z=-e,r+5):-1}function Ut(t,e,r){eo.lastIndex=0;var n=eo.exec(e.slice(r,r+2));return n?(t.m=n[0]-1,r+n[0].length):-1}function Vt(t,e,r){eo.lastIndex=0;var n=eo.exec(e.slice(r,r+2));return n?(t.d=+n[0],r+n[0].length):-1}function Ht(t,e,r){eo.lastIndex=0;var n=eo.exec(e.slice(r,r+3));return n?(t.j=+n[0],r+n[0].length):-1}function qt(t,e,r){eo.lastIndex=0;var n=eo.exec(e.slice(r,r+2));return n?(t.H=+n[0],r+n[0].length):-1}function Gt(t,e,r){eo.lastIndex=0;var n=eo.exec(e.slice(r,r+2));return n?(t.M=+n[0],r+n[0].length):-1}function Yt(t,e,r){eo.lastIndex=0;var n=eo.exec(e.slice(r,r+2));return n?(t.S=+n[0],r+n[0].length):-1}function Wt(t,e,r){eo.lastIndex=0;var n=eo.exec(e.slice(r,r+3));return n?(t.L=+n[0],r+n[0].length):-1}function Xt(t){var e=t.getTimezoneOffset(),r=e>0?"-":"+",n=aa(e)/60|0,i=aa(e)%60;return r+zt(n,"0",2)+zt(i,"0",2)}function Zt(t,e,r){ro.lastIndex=0;var n=ro.exec(e.slice(r,r+1));return n?r+n[0].length:-1}function Jt(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 Kt(){}function Qt(t,e,r){var n=r.s=t+e,i=n-t,a=n-i;r.t=t-a+(e-i)}function $t(t,e){t&&oo.hasOwnProperty(t.type)&&oo[t.type](t,e)}function te(t,e,r){var n,i=-1,a=t.length-r;for(e.lineStart();++i<a;)n=t[i],e.point(n[0],n[1],n[2]);e.lineEnd()}function ee(t,e){var r=-1,n=t.length;for(e.polygonStart();++r<n;)te(t[r],e,1);e.polygonEnd()}function re(){function t(t,e){e=e*Ea/2+ka/4;var r=(t*=Ea)-n,o=r>=0?1:-1,s=o*r,l=Math.cos(e),c=Math.sin(e),u=a*c,h=i*l+u*Math.cos(s),f=u*o*Math.sin(s);lo.add(Math.atan2(f,h)),n=t,i=l,a=c}var e,r,n,i,a;co.point=function(o,s){co.point=t,n=(e=o)*Ea,i=Math.cos(s=(r=s)*Ea/2+ka/4),a=Math.sin(s)},co.lineEnd=function(){t(e,r)}}function ne(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 ie(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function ae(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 oe(t,e){t[0]+=e[0],t[1]+=e[1],t[2]+=e[2]}function se(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function le(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 ce(t){return[Math.atan2(t[1],t[0]),Q(t[2])]}function ue(t,e){return aa(t[0]-e[0])<wa&&aa(t[1]-e[1])<wa}function he(t,e){t*=Ea;var r=Math.cos(e*=Ea);fe(r*Math.cos(t),r*Math.sin(t),Math.sin(e))}function fe(t,e,r){fo+=(t-fo)/++uo,po+=(e-po)/uo,mo+=(r-mo)/uo}function de(){function t(t,i){t*=Ea;var a=Math.cos(i*=Ea),o=a*Math.cos(t),s=a*Math.sin(t),l=Math.sin(i),c=Math.atan2(Math.sqrt((c=r*l-n*s)*c+(c=n*o-e*l)*c+(c=e*s-r*o)*c),e*o+r*s+n*l);ho+=c,go+=c*(e+(e=o)),vo+=c*(r+(r=s)),yo+=c*(n+(n=l)),fe(e,r,n)}var e,r,n;wo.point=function(i,a){i*=Ea;var o=Math.cos(a*=Ea);e=o*Math.cos(i),r=o*Math.sin(i),n=Math.sin(a),wo.point=t,fe(e,r,n)}}function pe(){wo.point=he}function me(){function t(t,e){t*=Ea;var r=Math.cos(e*=Ea),o=r*Math.cos(t),s=r*Math.sin(t),l=Math.sin(e),c=i*l-a*s,u=a*o-n*l,h=n*s-i*o,f=Math.sqrt(c*c+u*u+h*h),d=n*o+i*s+a*l,p=f&&-K(d)/f,m=Math.atan2(f,d);bo+=p*c,xo+=p*u,_o+=p*h,ho+=m,go+=m*(n+(n=o)),vo+=m*(i+(i=s)),yo+=m*(a+(a=l)),fe(n,i,a)}var e,r,n,i,a;wo.point=function(o,s){e=o,r=s,wo.point=t,o*=Ea;var l=Math.cos(s*=Ea);n=l*Math.cos(o),i=l*Math.sin(o),a=Math.sin(s),fe(n,i,a)},wo.lineEnd=function(){t(e,r),wo.lineEnd=pe,wo.point=he}}function ge(t,e){function r(r,n){return r=t(r,n),e(r[0],r[1])}return t.invert&&e.invert&&(r.invert=function(r,n){return(r=e.invert(r,n))&&t.invert(r[0],r[1])}),r}function ve(){return!0}function ye(t,e,r,n,i){var a=[],o=[];if(t.forEach(function(t){if(!((e=t.length-1)<=0)){var e,r=t[0],n=t[e];if(ue(r,n)){i.lineStart();for(var s=0;s<e;++s)i.point((r=t[s])[0],r[1]);i.lineEnd()}else{var l=new xe(r,t,null,!0),c=new xe(r,null,l,!1);l.o=c,a.push(l),o.push(c),c=new xe(n,null,l=new xe(n,t,null,!1),!0),l.o=c,a.push(l),o.push(c)}}}),o.sort(e),be(a),be(o),a.length){for(var s=0,l=r,c=o.length;s<c;++s)o[s].e=l=!l;for(var u,h,f=a[0];;){for(var d=f,p=!0;d.v;)if((d=d.n)===f)return;u=d.z,i.lineStart();do{if(d.v=d.o.v=!0,d.e){if(p)for(var s=0,c=u.length;s<c;++s)i.point((h=u[s])[0],h[1]);else n(d.x,d.n.x,1,i);d=d.n}else{if(p)for(s=(u=d.p.z).length-1;s>=0;--s)i.point((h=u[s])[0],h[1]);else n(d.x,d.p.x,-1,i);d=d.p}u=(d=d.o).z,p=!p}while(!d.v);i.lineEnd()}}}function be(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 xe(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 _e(t,e,r,n){return function(i,a){function o(e,r){var n=i(e,r);t(e=n[0],r=n[1])&&a.point(e,r)}function s(t,e){var r=i(t,e);g.point(r[0],r[1])}function l(){y.point=s,g.lineStart()}function c(){y.point=o,g.lineEnd()}function u(t,e){m.push([t,e]);var r=i(t,e);x.point(r[0],r[1])}function h(){x.lineStart(),m=[]}function f(){u(m[0][0],m[0][1]),x.lineEnd();var t,e=x.clean(),r=b.buffer(),n=r.length;if(m.pop(),p.push(m),m=null,n)if(1&e){var i,o=-1;if((n=(t=r[0]).length-1)>0){for(_||(a.polygonStart(),_=!0),a.lineStart();++o<n;)a.point((i=t[o])[0],i[1]);a.lineEnd()}}else n>1&&2&e&&r.push(r.pop().concat(r.shift())),d.push(r.filter(we))}var d,p,m,g=e(a),v=i.invert(n[0],n[1]),y={point:o,lineStart:l,lineEnd:c,polygonStart:function(){y.point=u,y.lineStart=h,y.lineEnd=f,d=[],p=[]},polygonEnd:function(){y.point=o,y.lineStart=l,y.lineEnd=c,d=Zi.merge(d);var t=function(t,e){var r=t[0],n=t[1],i=[Math.sin(r),-Math.cos(r),0],a=0,o=0;lo.reset();for(var s=0,l=e.length;s<l;++s){var c=e[s],u=c.length;if(u)for(var h=c[0],f=h[0],d=h[1]/2+ka/4,p=Math.sin(d),m=Math.cos(d),g=1;;){g===u&&(g=0);var v=(t=c[g])[0],y=t[1]/2+ka/4,b=Math.sin(y),x=Math.cos(y),_=v-f,w=_>=0?1:-1,M=w*_,k=M>ka,T=p*b;if(lo.add(Math.atan2(T*w*Math.sin(M),m*x+T*Math.cos(M))),a+=k?_+w*Ta:_,k^f>=r^v>=r){var A=ae(ne(h),ne(t));le(A);var S=ae(i,A);le(S);var E=(k^_>=0?-1:1)*Q(S[2]);(n>E||n===E&&(A[0]||A[1]))&&(o+=k^_>=0?1:-1)}if(!g++)break;f=v,p=b,m=x,h=t}}return(a<-wa||a<wa&&lo<-wa)^1&o}(v,p);d.length?(_||(a.polygonStart(),_=!0),ye(d,ke,t,r,a)):t&&(_||(a.polygonStart(),_=!0),a.lineStart(),r(null,null,1,a),a.lineEnd()),_&&(a.polygonEnd(),_=!1),d=p=null},sphere:function(){a.polygonStart(),a.lineStart(),r(null,null,1,a),a.lineEnd(),a.polygonEnd()}},b=Me(),x=e(b),_=!1;return y}}function we(t){return t.length>1}function Me(){var t,e=[];return{lineStart:function(){e.push(t=[])},point:function(e,r){t.push([e,r])},lineEnd:x,buffer:function(){var r=e;return e=[],t=null,r},rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))}}}function ke(t,e){return((t=t.x)[0]<0?t[1]-Sa-wa:Sa-t[1])-((e=e.x)[0]<0?e[1]-Sa-wa:Sa-e[1])}function Te(t,e,r,n){return function(i){var a,o=i.a,s=i.b,l=o.x,c=o.y,u=0,h=1,f=s.x-l,d=s.y-c;if(a=t-l,f||!(a>0)){if(a/=f,f<0){if(a<u)return;a<h&&(h=a)}else if(f>0){if(a>h)return;a>u&&(u=a)}if(a=r-l,f||!(a<0)){if(a/=f,f<0){if(a>h)return;a>u&&(u=a)}else if(f>0){if(a<u)return;a<h&&(h=a)}if(a=e-c,d||!(a>0)){if(a/=d,d<0){if(a<u)return;a<h&&(h=a)}else if(d>0){if(a>h)return;a>u&&(u=a)}if(a=n-c,d||!(a<0)){if(a/=d,d<0){if(a>h)return;a>u&&(u=a)}else if(d>0){if(a<u)return;a<h&&(h=a)}return u>0&&(i.a={x:l+u*f,y:c+u*d}),h<1&&(i.b={x:l+h*f,y:c+h*d}),i}}}}}}function Ae(t,e,r,n){function i(n,i){return aa(n[0]-t)<wa?i>0?0:3:aa(n[0]-r)<wa?i>0?2:1:aa(n[1]-e)<wa?i>0?1:0:i>0?3:2}function a(t,e){return o(t.x,e.x)}function o(t,e){var r=i(t,1),n=i(e,1);return r!==n?r-n:0===r?e[1]-t[1]:1===r?t[0]-e[0]:2===r?t[1]-e[1]:e[0]-t[0]}return function(s){function l(a,s,l,c){var u=0,h=0;if(null==a||(u=i(a,l))!==(h=i(s,l))||o(a,s)<0^l>0)do{c.point(0===u||3===u?t:r,u>1?n:e)}while((u=(u+l+4)%4)!==h);else c.point(s[0],s[1])}function c(i,a){return t<=i&&i<=r&&e<=a&&a<=n}function u(t,e){c(t,e)&&s.point(t,e)}function h(t,e){var r=c(t=Math.max(-ko,Math.min(ko,t)),e=Math.max(-ko,Math.min(ko,e)));if(d&&p.push([t,e]),_)m=t,g=e,v=r,_=!1,r&&(s.lineStart(),s.point(t,e));else if(r&&x)s.point(t,e);else{var n={a:{x:y,y:b},b:{x:t,y:e}};T(n)?(x||(s.lineStart(),s.point(n.a.x,n.a.y)),s.point(n.b.x,n.b.y),r||s.lineEnd(),w=!1):r&&(s.lineStart(),s.point(t,e),w=!1)}y=t,b=e,x=r}var f,d,p,m,g,v,y,b,x,_,w,M=s,k=Me(),T=Te(t,e,r,n),A={point:u,lineStart:function(){A.point=h,d&&d.push(p=[]),_=!0,x=!1,y=b=NaN},lineEnd:function(){f&&(h(m,g),v&&x&&k.rejoin(),f.push(k.buffer())),A.point=u,x&&s.lineEnd()},polygonStart:function(){s=k,f=[],d=[],w=!0},polygonEnd:function(){s=M,f=Zi.merge(f);var e=function(t){for(var e=0,r=d.length,n=t[1],i=0;i<r;++i)for(var a,o=1,s=d[i],l=s.length,c=s[0];o<l;++o)a=s[o],c[1]<=n?a[1]>n&&J(c,a,t)>0&&++e:a[1]<=n&&J(c,a,t)<0&&--e,c=a;return 0!==e}([t,n]),r=w&&e,i=f.length;(r||i)&&(s.polygonStart(),r&&(s.lineStart(),l(null,null,1,s),s.lineEnd()),i&&ye(f,a,e,l,s),s.polygonEnd()),f=d=p=null}};return A}}function Se(t){var e=0,r=ka/3,n=Ne(t),i=n(e,r);return i.parallels=function(t){return arguments.length?n(e=t[0]*ka/180,r=t[1]*ka/180):[e/ka*180,r/ka*180]},i}function Ee(t,e){function r(t,e){var r=Math.sqrt(a-2*i*Math.sin(e))/i;return[r*Math.sin(t*=i),o-r*Math.cos(t)]}var n=Math.sin(t),i=(n+Math.sin(e))/2,a=1+n*(2*i-n),o=Math.sqrt(a)/i;return r.invert=function(t,e){var r=o-e;return[Math.atan2(t,r)/i,Q((a-(t*t+r*r)*i*i)/(2*i))]},r}function Le(){function t(t,e){Ao+=i*t-n*e,n=t,i=e}var e,r,n,i;Io.point=function(a,o){Io.point=t,e=n=a,r=i=o},Io.lineEnd=function(){t(e,r)}}function Ce(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function Ie(t,e){fo+=t,po+=e,++mo}function ze(){function t(t,n){var i=t-e,a=n-r,o=Math.sqrt(i*i+a*a);go+=o*(e+t)/2,vo+=o*(r+n)/2,yo+=o,Ie(e=t,r=n)}var e,r;Do.point=function(n,i){Do.point=t,Ie(e=n,r=i)}}function De(){Do.point=Ie}function Pe(){function t(t,e){var r=t-n,a=e-i,o=Math.sqrt(r*r+a*a);go+=o*(n+t)/2,vo+=o*(i+e)/2,yo+=o,bo+=(o=i*t-n*e)*(n+t),xo+=o*(i+e),_o+=3*o,Ie(n=t,i=e)}var e,r,n,i;Do.point=function(a,o){Do.point=t,Ie(e=n=a,r=i=o)},Do.lineEnd=function(){t(e,r)}}function Oe(t){function e(e){return(a?function(e){function n(r,n){r=t(r,n),e.point(r[0],r[1])}function i(){b=NaN,k.point=o,e.lineStart()}function o(n,i){var o=ne([n,i]),s=t(n,i);r(b,x,y,_,w,M,b=s[0],x=s[1],y=n,_=o[0],w=o[1],M=o[2],a,e),e.point(b,x)}function s(){k.point=n,e.lineEnd()}function l(){i(),k.point=c,k.lineEnd=u}function c(t,e){o(h=t,f=e),d=b,p=x,m=_,g=w,v=M,k.point=o}function u(){r(b,x,y,_,w,M,d,p,h,m,g,v,a,e),k.lineEnd=s,s()}var h,f,d,p,m,g,v,y,b,x,_,w,M,k={point:n,lineStart:i,lineEnd:s,polygonStart:function(){e.polygonStart(),k.lineStart=l},polygonEnd:function(){e.polygonEnd(),k.lineStart=i}};return k}:function(e){return Fe(e,function(r,n){r=t(r,n),e.point(r[0],r[1])})})(e)}function r(e,a,o,s,l,c,u,h,f,d,p,m,g,v){var y=u-e,b=h-a,x=y*y+b*b;if(x>4*n&&g--){var _=s+d,w=l+p,M=c+m,k=Math.sqrt(_*_+w*w+M*M),T=Math.asin(M/=k),A=aa(aa(M)-1)<wa||aa(o-f)<wa?(o+f)/2:Math.atan2(w,_),S=t(A,T),E=S[0],L=S[1],C=E-e,I=L-a,z=b*C-y*I;(z*z/x>n||aa((y*C+b*I)/x-.5)>.3||s*d+l*p+c*m<i)&&(r(e,a,o,s,l,c,E,L,A,_/=k,w/=k,M,g,v),v.point(E,L),r(E,L,A,_,w,M,u,h,f,d,p,m,g,v))}}var n=.5,i=Math.cos(30*Ea),a=16;return e.precision=function(t){return arguments.length?(a=(n=t*t)>0&&16,e):Math.sqrt(n)},e}function Re(t){this.stream=t}function Fe(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 je(t){return Ne(function(){return t})()}function Ne(t){function e(t){return t=o(t[0]*Ea,t[1]*Ea),[t[0]*h+s,l-t[1]*h]}function r(){o=ge(a=He(g,v,b),i);var t=i(p,m);return s=f-t[0]*h,l=d+t[1]*h,n()}function n(){return c&&(c.valid=!1,c=null),e}var i,a,o,s,l,c,u=Oe(function(t,e){return t=i(t,e),[t[0]*h+s,l-t[1]*h]}),h=150,f=480,d=250,p=0,m=0,g=0,v=0,b=0,x=Mo,_=y,w=null,M=null;return e.stream=function(t){return c&&(c.valid=!1),c=Be(x(a,u(_(t)))),c.valid=!0,c},e.clipAngle=function(t){return arguments.length?(x=null==t?(w=t,Mo):function(t){function e(t,e){return Math.cos(t)*Math.cos(e)>i}function r(t,e,r){var n=[1,0,0],a=ae(ne(t),ne(e)),o=ie(a,a),s=a[0],l=o-s*s;if(!l)return!r&&t;var c=i*o/l,u=-i*s/l,h=ae(n,a),f=se(n,c);oe(f,se(a,u));var d=h,p=ie(f,d),m=ie(d,d),g=p*p-m*(ie(f,f)-1);if(!(g<0)){var v=Math.sqrt(g),y=se(d,(-p-v)/m);if(oe(y,f),y=ce(y),!r)return y;var b,x=t[0],_=e[0],w=t[1],M=e[1];_<x&&(b=x,x=_,_=b);var k=_-x,T=aa(k-ka)<wa;if(!T&&M<w&&(b=w,w=M,M=b),T||k<wa?T?w+M>0^y[1]<(aa(y[0]-x)<wa?w:M):w<=y[1]&&y[1]<=M:k>ka^(x<=y[0]&&y[0]<=_)){var A=se(d,(-p+v)/m);return oe(A,f),[y,ce(A)]}}}function n(e,r){var n=a?t:ka-t,i=0;return e<-n?i|=1:e>n&&(i|=2),r<-n?i|=4:r>n&&(i|=8),i}var i=Math.cos(t),a=i>0,o=aa(i)>wa;return _e(e,function(t){var i,s,l,c,u;return{lineStart:function(){c=l=!1,u=1},point:function(h,f){var d,p=[h,f],m=e(h,f),g=a?m?0:n(h,f):m?n(h+(h<0?ka:-ka),f):0;if(!i&&(c=l=m)&&t.lineStart(),m!==l&&(d=r(i,p),(ue(i,d)||ue(p,d))&&(p[0]+=wa,p[1]+=wa,m=e(p[0],p[1]))),m!==l)u=0,m?(t.lineStart(),d=r(p,i),t.point(d[0],d[1])):(d=r(i,p),t.point(d[0],d[1]),t.lineEnd()),i=d;else if(o&&i&&a^m){var v;g&s||!(v=r(p,i,!0))||(u=0,a?(t.lineStart(),t.point(v[0][0],v[0][1]),t.point(v[1][0],v[1][1]),t.lineEnd()):(t.point(v[1][0],v[1][1]),t.lineEnd(),t.lineStart(),t.point(v[0][0],v[0][1])))}!m||i&&ue(i,p)||t.point(p[0],p[1]),i=p,l=m,s=g},lineEnd:function(){l&&t.lineEnd(),i=null},clean:function(){return u|(c&&l)<<1}}},We(t,6*Ea),a?[0,-t]:[-ka,t-ka])}((w=+t)*Ea),n()):w},e.clipExtent=function(t){return arguments.length?(M=t,_=t?Ae(t[0][0],t[0][1],t[1][0],t[1][1]):y,n()):M},e.scale=function(t){return arguments.length?(h=+t,r()):h},e.translate=function(t){return arguments.length?(f=+t[0],d=+t[1],r()):[f,d]},e.center=function(t){return arguments.length?(p=t[0]%360*Ea,m=t[1]%360*Ea,r()):[p*La,m*La]},e.rotate=function(t){return arguments.length?(g=t[0]%360*Ea,v=t[1]%360*Ea,b=t.length>2?t[2]%360*Ea:0,r()):[g*La,v*La,b*La]},Zi.rebind(e,u,"precision"),function(){return i=t.apply(this,arguments),e.invert=i.invert&&function(t){return(t=o.invert((t[0]-s)/h,(l-t[1])/h))&&[t[0]*La,t[1]*La]},r()}}function Be(t){return Fe(t,function(e,r){t.point(e*Ea,r*Ea)})}function Ue(t,e){return[t,e]}function Ve(t,e){return[t>ka?t-Ta:t<-ka?t+Ta:t,e]}function He(t,e,r){return t?e||r?ge(Ge(t),Ye(e,r)):Ge(t):e||r?Ye(e,r):Ve}function qe(t){return function(e,r){return e+=t,[e>ka?e-Ta:e<-ka?e+Ta:e,r]}}function Ge(t){var e=qe(t);return e.invert=qe(-t),e}function Ye(t,e){function r(t,e){var r=Math.cos(e),s=Math.cos(t)*r,l=Math.sin(t)*r,c=Math.sin(e),u=c*n+s*i;return[Math.atan2(l*a-u*o,s*n-c*i),Q(u*a+l*o)]}var n=Math.cos(t),i=Math.sin(t),a=Math.cos(e),o=Math.sin(e);return r.invert=function(t,e){var r=Math.cos(e),s=Math.cos(t)*r,l=Math.sin(t)*r,c=Math.sin(e),u=c*a-l*o;return[Math.atan2(l*a+c*o,s*n+u*i),Q(u*n-s*i)]},r}function We(t,e){var r=Math.cos(t),n=Math.sin(t);return function(i,a,o,s){var l=o*e;null!=i?(i=Xe(r,i),a=Xe(r,a),(o>0?i<a:i>a)&&(i+=o*Ta)):(i=t+o*Ta,a=t-.5*l);for(var c,u=i;o>0?u>a:u<a;u-=l)s.point((c=ce([r,-n*Math.cos(u),-n*Math.sin(u)]))[0],c[1])}}function Xe(t,e){var r=ne(e);r[0]-=t,le(r);var n=K(-r[1]);return((-r[2]<0?-n:n)+2*Math.PI-wa)%(2*Math.PI)}function Ze(t,e,r){var n=Zi.range(t,e-wa,r).concat(e);return function(t){return n.map(function(e){return[t,e]})}}function Je(t,e,r){var n=Zi.range(t,e-wa,r).concat(e);return function(t){return n.map(function(e){return[e,t]})}}function Ke(t){return t.source}function Qe(t){return t.target}function $e(t,e){function r(e,r){var n=Math.cos(e),i=Math.cos(r),a=t(n*i);return[a*i*Math.sin(e),a*Math.sin(r)]}return r.invert=function(t,r){var n=Math.sqrt(t*t+r*r),i=e(n),a=Math.sin(i),o=Math.cos(i);return[Math.atan2(t*a,n*o),Math.asin(n&&r*a/n)]},r}function tr(t,e){function r(t,e){o>0?e<-Sa+wa&&(e=-Sa+wa):e>Sa-wa&&(e=Sa-wa);var r=o/Math.pow(i(e),a);return[r*Math.sin(a*t),o-r*Math.cos(a*t)]}var n=Math.cos(t),i=function(t){return Math.tan(ka/4+t/2)},a=t===e?Math.sin(t):Math.log(n/Math.cos(e))/Math.log(i(e)/i(t)),o=n*Math.pow(i(t),a)/a;return a?(r.invert=function(t,e){var r=o-e,n=Z(a)*Math.sqrt(t*t+r*r);return[Math.atan2(t,r)/a,2*Math.atan(Math.pow(o/n,1/a))-Sa]},r):rr}function er(t,e){function r(t,e){var r=a-e;return[r*Math.sin(i*t),a-r*Math.cos(i*t)]}var n=Math.cos(t),i=t===e?Math.sin(t):(n-Math.cos(e))/(e-t),a=n/i+t;return aa(i)<wa?Ue:(r.invert=function(t,e){var r=a-e;return[Math.atan2(t,r)/i,a-Z(i)*Math.sqrt(t*t+r*r)]},r)}function rr(t,e){return[t,Math.log(Math.tan(ka/4+e/2))]}function nr(t){var e,r=je(t),n=r.scale,i=r.translate,a=r.clipExtent;return r.scale=function(){var t=n.apply(r,arguments);return t===r?e?r.clipExtent(null):r:t},r.translate=function(){var t=i.apply(r,arguments);return t===r?e?r.clipExtent(null):r:t},r.clipExtent=function(t){var o=a.apply(r,arguments);if(o===r){if(e=null==t){var s=ka*n(),l=i();a([[l[0]-s,l[1]-s],[l[0]+s,l[1]+s]])}}else e&&(o=null);return o},r.clipExtent(null)}function ir(t,e){return[Math.log(Math.tan(ka/4+e/2)),-t]}function ar(t){return t[0]}function or(t){return t[1]}function sr(t){for(var e=t.length,r=[0,1],n=2,i=2;i<e;i++){for(;n>1&&J(t[r[n-2]],t[r[n-1]],t[i])<=0;)--n;r[n++]=i}return r.slice(0,n)}function lr(t,e){return t[0]-e[0]||t[1]-e[1]}function cr(t,e,r){return(r[0]-e[0])*(t[1]-e[1])<(r[1]-e[1])*(t[0]-e[0])}function ur(t,e,r,n){var i=t[0],a=r[0],o=e[0]-i,s=n[0]-a,l=t[1],c=r[1],u=e[1]-l,h=n[1]-c,f=(s*(l-c)-h*(i-a))/(h*o-s*u);return[i+f*o,l+f*u]}function hr(t){var e=t[0],r=t[t.length-1];return!(e[0]-r[0]||e[1]-r[1])}function fr(t){var e=Wo.pop()||new function(){Sr(this),this.edge=this.site=this.circle=null};return e.site=t,e}function dr(t){_r(t),qo.remove(t),Wo.push(t),Sr(t)}function pr(t){var e=t.circle,r=e.x,n=e.cy,i={x:r,y:n},a=t.P,o=t.N,s=[t];dr(t);for(var l=a;l.circle&&aa(r-l.circle.x)<wa&&aa(n-l.circle.cy)<wa;)a=l.P,s.unshift(l),dr(l),l=a;s.unshift(l),_r(l);for(var c=o;c.circle&&aa(r-c.circle.x)<wa&&aa(n-c.circle.cy)<wa;)o=c.N,s.push(c),dr(c),c=o;s.push(c),_r(c);var u,h=s.length;for(u=1;u<h;++u)c=s[u],l=s[u-1],kr(c.edge,l.site,c.site,i);l=s[0],(c=s[h-1]).edge=Mr(l.site,c.site,null,i),xr(l),xr(c)}function mr(t){for(var e,r,n,i,a=t.x,o=t.y,s=qo._;s;)if((n=gr(s,o)-a)>wa)s=s.L;else{if(!((i=a-function(t,e){var r=t.N;if(r)return gr(r,e);var n=t.site;return n.y===e?n.x:1/0}(s,o))>wa)){n>-wa?(e=s.P,r=s):i>-wa?(e=s,r=s.N):e=r=s;break}if(!s.R){e=s;break}s=s.R}var l=fr(t);if(qo.insert(e,l),e||r){if(e===r)return _r(e),r=fr(e.site),qo.insert(l,r),l.edge=r.edge=Mr(e.site,l.site),xr(e),void xr(r);if(r){_r(e),_r(r);var c=e.site,u=c.x,h=c.y,f=t.x-u,d=t.y-h,p=r.site,m=p.x-u,g=p.y-h,v=2*(f*g-d*m),y=f*f+d*d,b=m*m+g*g,x={x:(g*y-d*b)/v+u,y:(f*b-m*y)/v+h};kr(r.edge,c,p,x),l.edge=Mr(c,t,null,x),r.edge=Mr(t,p,null,x),xr(e),xr(r)}else l.edge=Mr(e.site,l.site)}}function gr(t,e){var r=t.site,n=r.x,i=r.y,a=i-e;if(!a)return n;var o=t.P;if(!o)return-1/0;var s=(r=o.site).x,l=r.y,c=l-e;if(!c)return s;var u=s-n,h=1/a-1/c,f=u/c;return h?(-f+Math.sqrt(f*f-2*h*(u*u/(-2*c)-l+c/2+i-a/2)))/h+n:(n+s)/2}function vr(t){this.site=t,this.edges=[]}function yr(t){for(var e,r,n,i,a,o,s,l,c,u,h=t[0][0],f=t[1][0],d=t[0][1],p=t[1][1],m=Ho,g=m.length;g--;)if((a=m[g])&&a.prepare())for(l=(s=a.edges).length,o=0;o<l;)n=(u=s[o].end()).x,i=u.y,e=(c=s[++o%l].start()).x,r=c.y,(aa(n-e)>wa||aa(i-r)>wa)&&(s.splice(o,0,new Tr(function(t,e,r){var n=new wr(t,null);return n.a=e,n.b=r,Vo.push(n),n}(a.site,u,aa(n-h)<wa&&p-i>wa?{x:h,y:aa(e-h)<wa?r:p}:aa(i-p)<wa&&f-n>wa?{x:aa(r-p)<wa?e:f,y:p}:aa(n-f)<wa&&i-d>wa?{x:f,y:aa(e-f)<wa?r:d}:aa(i-d)<wa&&n-h>wa?{x:aa(r-d)<wa?e:h,y:d}:null),a.site,null)),++l)}function br(t,e){return e.angle-t.angle}function xr(t){var e=t.P,r=t.N;if(e&&r){var n=e.site,i=t.site,a=r.site;if(n!==a){var o=i.x,s=i.y,l=n.x-o,c=n.y-s,u=a.x-o,h=2*(l*(g=a.y-s)-c*u);if(!(h>=-Ma)){var f=l*l+c*c,d=u*u+g*g,p=(g*f-c*d)/h,m=(l*d-u*f)/h,g=m+s,v=Xo.pop()||new function(){Sr(this),this.x=this.y=this.arc=this.site=this.cy=null};v.arc=t,v.site=i,v.x=p+o,v.y=g+Math.sqrt(p*p+m*m),v.cy=g,t.circle=v;for(var y=null,b=Yo._;b;)if(v.y<b.y||v.y===b.y&&v.x<=b.x){if(!b.L){y=b.P;break}b=b.L}else{if(!b.R){y=b;break}b=b.R}Yo.insert(y,v),y||(Go=v)}}}}function _r(t){var e=t.circle;e&&(e.P||(Go=e.N),Yo.remove(e),Xo.push(e),Sr(e),t.circle=null)}function wr(t,e){this.l=t,this.r=e,this.a=this.b=null}function Mr(t,e,r,n){var i=new wr(t,e);return Vo.push(i),r&&kr(i,t,e,r),n&&kr(i,e,t,n),Ho[t.i].edges.push(new Tr(i,t,e)),Ho[e.i].edges.push(new Tr(i,e,t)),i}function kr(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 Tr(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 Ar(){this._=null}function Sr(t){t.U=t.C=t.L=t.R=t.P=t.N=null}function Er(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 Lr(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 Cr(t){for(;t.L;)t=t.L;return t}function Ir(t,e){var r,n,i,a=t.sort(zr).pop();for(Vo=[],Ho=new Array(t.length),qo=new Ar,Yo=new Ar;;)if(i=Go,a&&(!i||a.y<i.y||a.y===i.y&&a.x<i.x))a.x===r&&a.y===n||(Ho[a.i]=new vr(a),mr(a),r=a.x,n=a.y),a=t.pop();else{if(!i)break;pr(i.arc)}e&&(function(t){for(var e,r=Vo,n=Te(t[0][0],t[0][1],t[1][0],t[1][1]),i=r.length;i--;)(!function(t,e){var r=t.b;if(r)return!0;var n,i,a=t.a,o=e[0][0],s=e[1][0],l=e[0][1],c=e[1][1],u=t.l,h=t.r,f=u.x,d=u.y,p=h.x,m=h.y,g=(f+p)/2,v=(d+m)/2;if(m===d){if(g<o||g>=s)return;if(f>p){if(a){if(a.y>=c)return}else a={x:g,y:l};r={x:g,y:c}}else{if(a){if(a.y<l)return}else a={x:g,y:c};r={x:g,y:l}}}else if(n=(f-p)/(m-d),i=v-n*g,n<-1||n>1)if(f>p){if(a){if(a.y>=c)return}else a={x:(l-i)/n,y:l};r={x:(c-i)/n,y:c}}else{if(a){if(a.y<l)return}else a={x:(c-i)/n,y:c};r={x:(l-i)/n,y:l}}else if(d<m){if(a){if(a.x>=s)return}else a={x:o,y:n*o+i};r={x:s,y:n*s+i}}else{if(a){if(a.x<o)return}else a={x:s,y:n*s+i};r={x:o,y:n*o+i}}return t.a=a,t.b=r,!0}(e=r[i],t)||!n(e)||aa(e.a.x-e.b.x)<wa&&aa(e.a.y-e.b.y)<wa)&&(e.a=e.b=null,r.splice(i,1))}(e),yr(e));var o={cells:Ho,edges:Vo};return qo=Yo=Vo=Ho=null,o}function zr(t,e){return e.y-t.y||e.x-t.x}function Dr(t){return t.x}function Pr(t){return t.y}function Or(t,e,r,n,i,a){if(!t(e,r,n,i,a)){var o=.5*(r+i),s=.5*(n+a),l=e.nodes;l[0]&&Or(t,l[0],r,n,o,s),l[1]&&Or(t,l[1],o,n,i,s),l[2]&&Or(t,l[2],r,s,o,a),l[3]&&Or(t,l[3],o,s,i,a)}}function Rr(t,e){t=Zi.rgb(t),e=Zi.rgb(e);var r=t.r,n=t.g,i=t.b,a=e.r-r,o=e.g-n,s=e.b-i;return function(t){return"#"+mt(Math.round(r+a*t))+mt(Math.round(n+o*t))+mt(Math.round(i+s*t))}}function Fr(t,e){var r,n={},i={};for(r in t)r in e?n[r]=Br(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 jr(t,e){return t=+t,e=+e,function(r){return t*(1-r)+e*r}}function Nr(t,e){var r,n,i,a=Jo.lastIndex=Ko.lastIndex=0,o=-1,s=[],l=[];for(t+="",e+="";(r=Jo.exec(t))&&(n=Ko.exec(e));)(i=n.index)>a&&(i=e.slice(a,i),s[o]?s[o]+=i:s[++o]=i),(r=r[0])===(n=n[0])?s[o]?s[o]+=n:s[++o]=n:(s[++o]=null,l.push({i:o,x:jr(r,n)})),a=Ko.lastIndex;return a<e.length&&(i=e.slice(a),s[o]?s[o]+=i:s[++o]=i),s.length<2?l[0]?(e=l[0].x,function(t){return e(t)+""}):function(){return e}:(e=l.length,function(t){for(var r,n=0;n<e;++n)s[(r=l[n]).i]=r.x(t);return s.join("")})}function Br(t,e){for(var r,n=Zi.interpolators.length;--n>=0&&!(r=Zi.interpolators[n](t,e)););return r}function Ur(t,e){var r,n=[],i=[],a=t.length,o=e.length,s=Math.min(t.length,e.length);for(r=0;r<s;++r)n.push(Br(t[r],e[r]));for(;r<a;++r)i[r]=t[r];for(;r<o;++r)i[r]=e[r];return function(t){for(r=0;r<s;++r)i[r]=n[r](t);return i}}function Vr(t){return function(e){return 1-t(1-e)}}function Hr(t){return function(e){return.5*(e<.5?t(2*e):2-t(2-2*e))}}function qr(t){return t*t}function Gr(t){return t*t*t}function Yr(t){return 1-Math.cos(t*Sa)}function Wr(t){return Math.pow(2,10*(t-1))}function Xr(t){return 1-Math.sqrt(1-t*t)}function Zr(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375}function Jr(t,e){return e-=t,function(r){return Math.round(t+e*r)}}function Kr(t){var e=[t.a,t.b],r=[t.c,t.d],n=$r(e),i=Qr(e,r),a=$r(function(t,e,r){return t[0]+=r*e[0],t[1]+=r*e[1],t}(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]))*La,this.translate=[t.e,t.f],this.scale=[n,a],this.skew=a?Math.atan2(i,a)*La:0}function Qr(t,e){return t[0]*e[0]+t[1]*e[1]}function $r(t){var e=Math.sqrt(Qr(t,t));return e&&(t[0]/=e,t[1]/=e),e}function tn(t){return t.length?t.pop()+",":""}function en(t,e){var r=[],n=[];return t=Zi.transform(t),e=Zi.transform(e),function(t,e,r,n){if(t[0]!==e[0]||t[1]!==e[1]){var i=r.push("translate(",null,",",null,")");n.push({i:i-4,x:jr(t[0],e[0])},{i:i-2,x:jr(t[1],e[1])})}else(e[0]||e[1])&&r.push("translate("+e+")")}(t.translate,e.translate,r,n),function(t,e,r,n){t!==e?(t-e>180?e+=360:e-t>180&&(t+=360),n.push({i:r.push(tn(r)+"rotate(",null,")")-2,x:jr(t,e)})):e&&r.push(tn(r)+"rotate("+e+")")}(t.rotate,e.rotate,r,n),function(t,e,r,n){t!==e?n.push({i:r.push(tn(r)+"skewX(",null,")")-2,x:jr(t,e)}):e&&r.push(tn(r)+"skewX("+e+")")}(t.skew,e.skew,r,n),function(t,e,r,n){if(t[0]!==e[0]||t[1]!==e[1]){var i=r.push(tn(r)+"scale(",null,",",null,")");n.push({i:i-4,x:jr(t[0],e[0])},{i:i-2,x:jr(t[1],e[1])})}else 1===e[0]&&1===e[1]||r.push(tn(r)+"scale("+e+")")}(t.scale,e.scale,r,n),t=e=null,function(t){for(var e,i=-1,a=n.length;++i<a;)r[(e=n[i]).i]=e.x(t);return r.join("")}}function rn(t){for(var e=t.source,r=t.target,n=function(t,e){if(t===e)return t;var r=nn(t),n=nn(e),i=r.pop(),a=n.pop(),o=null;for(;i===a;)o=i,i=r.pop(),a=n.pop();return o}(e,r),i=[e];e!==n;)e=e.parent,i.push(e);for(var a=i.length;r!==n;)i.splice(a,0,r),r=r.parent;return i}function nn(t){for(var e=[],r=t.parent;null!=r;)e.push(t),t=r,r=r.parent;return e.push(t),e}function an(t){t.fixed|=2}function on(t){t.fixed&=-7}function sn(t){t.fixed|=4,t.px=t.x,t.py=t.y}function ln(t){t.fixed&=-5}function cn(t,e,r){var n=0,i=0;if(t.charge=0,!t.leaf)for(var a,o=t.nodes,s=o.length,l=-1;++l<s;)null!=(a=o[l])&&(cn(a,e,r),t.charge+=a.charge,n+=a.charge*a.cx,i+=a.charge*a.cy);if(t.point){t.leaf||(t.point.x+=Math.random()-.5,t.point.y+=Math.random()-.5);var c=e*r[t.point.index];t.charge+=t.pointCharge=c,n+=c*t.point.x,i+=c*t.point.y}t.cx=n/t.charge,t.cy=i/t.charge}function un(t,e){return Zi.rebind(t,e,"sort","children","value"),t.nodes=t,t.links=gn,t}function hn(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 fn(t,e){for(var r=[t],n=[];null!=(t=r.pop());)if(n.push(t),(a=t.children)&&(i=a.length))for(var i,a,o=-1;++o<i;)r.push(a[o]);for(;null!=(t=n.pop());)e(t)}function dn(t){return t.children}function pn(t){return t.value}function mn(t,e){return e.value-t.value}function gn(t){return Zi.merge(t.map(function(t){return(t.children||[]).map(function(e){return{source:t,target:e}})}))}function vn(t){return t.x}function yn(t){return t.y}function bn(t,e,r){t.y0=e,t.y=r}function xn(t){return Zi.range(t.length)}function _n(t){for(var e=-1,r=t[0].length,n=[];++e<r;)n[e]=0;return n}function wn(t){for(var e,r=1,n=0,i=t[0][1],a=t.length;r<a;++r)(e=t[r][1])>i&&(n=r,i=e);return n}function Mn(t){return t.reduce(kn,0)}function kn(t,e){return t+e[1]}function Tn(t,e){return An(t,Math.ceil(Math.log(e.length)/Math.LN2+1))}function An(t,e){for(var r=-1,n=+t[0],i=(t[1]-n)/e,a=[];++r<=e;)a[r]=i*r+n;return a}function Sn(t){return[Zi.min(t),Zi.max(t)]}function En(t,e){return t.value-e.value}function Ln(t,e){var r=t._pack_next;t._pack_next=e,e._pack_prev=t,e._pack_next=r,r._pack_prev=e}function Cn(t,e){t._pack_next=e,e._pack_prev=t}function In(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 zn(t){function e(t){u=Math.min(t.x-t.r,u),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)&&(c=r.length)){var r,n,i,a,o,s,l,c,u=1/0,h=-1/0,f=1/0,d=-1/0;if(r.forEach(Dn),n=r[0],n.x=-n.r,n.y=0,e(n),c>1&&(i=r[1],i.x=i.r,i.y=0,e(i),c>2))for(Rn(n,i,a=r[2]),e(a),Ln(n,a),n._pack_prev=a,Ln(a,i),i=n._pack_next,o=3;o<c;o++){Rn(n,i,a=r[o]);var p=0,m=1,g=1;for(s=i._pack_next;s!==i;s=s._pack_next,m++)if(In(s,a)){p=1;break}if(1==p)for(l=n._pack_prev;l!==s._pack_prev&&!In(l,a);l=l._pack_prev,g++);p?(m<g||m==g&&i.r<n.r?Cn(n,i=s):Cn(n=l,i),o--):(Ln(n,a),i=a,e(a))}var v=(u+h)/2,y=(f+d)/2,b=0;for(o=0;o<c;o++)(a=r[o]).x-=v,a.y-=y,b=Math.max(b,a.r+Math.sqrt(a.x*a.x+a.y*a.y));t.r=b,r.forEach(Pn)}}function Dn(t){t._pack_next=t._pack_prev=t}function Pn(t){delete t._pack_next,delete t._pack_prev}function On(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 a=-1,o=i.length;++a<o;)On(i[a],e,r,n)}function Rn(t,e,r){var n=t.r+r.r,i=e.x-t.x,a=e.y-t.y;if(n&&(i||a)){var o=e.r+r.r,s=i*i+a*a,l=.5+((n*=n)-(o*=o))/(2*s),c=Math.sqrt(Math.max(0,2*o*(n+s)-(n-=s)*n-o*o))/(2*s);r.x=t.x+l*i+c*a,r.y=t.y+l*a-c*i}else r.x=t.x+n,r.y=t.y}function Fn(t,e){return t.parent==e.parent?1:2}function jn(t){var e=t.children;return e.length?e[0]:t.t}function Nn(t){var e,r=t.children;return(e=r.length)?r[e-1]:t.t}function Bn(t){var e=t.children;return e&&e.length?Bn(e[0]):t}function Un(t){var e,r=t.children;return r&&(e=r.length)?Un(r[e-1]):t}function Vn(t){return{x:t.x,y:t.y,dx:t.dx,dy:t.dy}}function Hn(t,e){var r=t.x+e[3],n=t.y+e[0],i=t.dx-e[1]-e[3],a=t.dy-e[0]-e[2];return i<0&&(r+=i/2,i=0),a<0&&(n+=a/2,a=0),{x:r,y:n,dx:i,dy:a}}function qn(t){var e=t[0],r=t[t.length-1];return e<r?[e,r]:[r,e]}function Gn(t){return t.rangeExtent?t.rangeExtent():qn(t.range())}function Yn(t,e){var r,n=0,i=t.length-1,a=t[n],o=t[i];return o<a&&(r=n,n=i,i=r,r=a,a=o,o=r),t[n]=e.floor(a),t[i]=e.ceil(o),t}function Wn(t){return t?{floor:function(e){return Math.floor(e/t)*t},ceil:function(e){return Math.ceil(e/t)*t}}:ls}function Xn(t,e,r,n){function i(){var i=Math.min(t.length,e.length)>2?function(t,e,r,n){var i=[],a=[],o=0,s=Math.min(t.length,e.length)-1;for(t[s]<t[0]&&(t=t.slice().reverse(),e=e.slice().reverse());++o<=s;)i.push(r(t[o-1],t[o])),a.push(n(e[o-1],e[o]));return function(e){var r=Zi.bisect(t,e,1,s)-1;return a[r](i[r](e))}}:function(t,e,r,n){var i=r(t[0],t[1]),a=n(e[0],e[1]);return function(t){return a(i(t))}},l=n?function(t,e){return e=(e-=t=+t)||1/e,function(r){return Math.max(0,Math.min(1,(r-t)/e))}}:function(t,e){return e=(e-=t=+t)||1/e,function(r){return(r-t)/e}};return o=i(t,e,l,r),s=i(e,t,l,Br),a}function a(t){return o(t)}var o,s;return a.invert=function(t){return s(t)},a.domain=function(e){return arguments.length?(t=e.map(Number),i()):t},a.range=function(t){return arguments.length?(e=t,i()):e},a.rangeRound=function(t){return a.range(t).interpolate(Jr)},a.clamp=function(t){return arguments.length?(n=t,i()):n},a.interpolate=function(t){return arguments.length?(r=t,i()):r},a.ticks=function(e){return Qn(t,e)},a.tickFormat=function(e,r){return $n(t,e,r)},a.nice=function(e){return Jn(t,e),i()},a.copy=function(){return Xn(t,e,r,n)},i()}function Zn(t,e){return Zi.rebind(t,e,"range","rangeRound","interpolate","clamp")}function Jn(t,e){return Yn(t,Wn(Kn(t,e)[2])),Yn(t,Wn(Kn(t,e)[2])),t}function Kn(t,e){null==e&&(e=10);var r=qn(t),n=r[1]-r[0],i=Math.pow(10,Math.floor(Math.log(n/e)/Math.LN10)),a=e/n*i;return a<=.15?i*=10:a<=.35?i*=5:a<=.75&&(i*=2),r[0]=Math.ceil(r[0]/i)*i,r[1]=Math.floor(r[1]/i)*i+.5*i,r[2]=i,r}function Qn(t,e){return Zi.range.apply(Zi,Kn(t,e))}function $n(t,e,r){var n=Kn(t,e);if(r){var i=Za.exec(r);if(i.shift(),"s"===i[8]){var a=Zi.formatPrefix(Math.max(aa(n[0]),aa(n[1])));return i[7]||(i[7]="."+ti(a.scale(n[2]))),i[8]="f",r=Zi.format(i.join("")),function(t){return r(a.scale(t))+a.symbol}}i[7]||(i[7]="."+function(t,e){var r=ti(e[2]);return t in cs?Math.abs(r-ti(Math.max(aa(e[0]),aa(e[1]))))+ +("e"!==t):r-2*("%"===t)}(i[8],n)),r=i.join("")}else r=",."+ti(n[2])+"f";return Zi.format(r)}function ti(t){return-Math.floor(Math.log(t)/Math.LN10+.01)}function ei(t,e,r,n){function i(t){return(r?Math.log(t<0?0:t):-Math.log(t>0?0:-t))/Math.log(e)}function a(t){return r?Math.pow(e,t):-Math.pow(e,-t)}function o(e){return t(i(e))}return o.invert=function(e){return a(t.invert(e))},o.domain=function(e){return arguments.length?(r=e[0]>=0,t.domain((n=e.map(Number)).map(i)),o):n},o.base=function(r){return arguments.length?(e=+r,t.domain(n.map(i)),o):e},o.nice=function(){var e=Yn(n.map(i),r?Math:hs);return t.domain(e),n=e.map(a),o},o.ticks=function(){var t=qn(n),o=[],s=t[0],l=t[1],c=Math.floor(i(s)),u=Math.ceil(i(l)),h=e%1?2:e;if(isFinite(u-c)){if(r){for(;c<u;c++)for(f=1;f<h;f++)o.push(a(c)*f);o.push(a(c))}else for(o.push(a(c));c++<u;)for(var f=h-1;f>0;f--)o.push(a(c)*f);for(c=0;o[c]<s;c++);for(u=o.length;o[u-1]>l;u--);o=o.slice(c,u)}return o},o.tickFormat=function(t,r){if(!arguments.length)return us;arguments.length<2?r=us:"function"!=typeof r&&(r=Zi.format(r));var n=Math.max(1,e*t/o.ticks().length);return function(t){var o=t/a(Math.round(i(t)));return o*e<e-.5&&(o*=e),o<=n?r(t):""}},o.copy=function(){return ei(t.copy(),e,r,n)},Zn(o,t)}function ri(t,e,r){function n(e){return t(i(e))}var i=ni(e),a=ni(1/e);return n.invert=function(e){return a(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 Qn(r,t)},n.tickFormat=function(t,e){return $n(r,t,e)},n.nice=function(t){return n.domain(Jn(r,t))},n.exponent=function(o){return arguments.length?(i=ni(e=o),a=ni(1/e),t.domain(r.map(i)),n):e},n.copy=function(){return ri(t.copy(),e,r)},Zn(n,t)}function ni(t){return function(e){return e<0?-Math.pow(-e,t):Math.pow(e,t)}}function ii(t,e){function r(r){return a[((i.get(r)||("range"===e.t?i.set(r,t.push(r)):NaN))-1)%a.length]}function n(e,r){return Zi.range(t.length).map(function(t){return e+r*t})}var i,a,o;return r.domain=function(n){if(!arguments.length)return t;t=[],i=new c;for(var a,o=-1,s=n.length;++o<s;)i.has(a=n[o])||i.set(a,t.push(a));return r[e.t].apply(r,e.a)},r.range=function(t){return arguments.length?(a=t,o=0,e={t:"range",a:arguments},r):a},r.rangePoints=function(i,s){arguments.length<2&&(s=0);var l=i[0],c=i[1],u=t.length<2?(l=(l+c)/2,0):(c-l)/(t.length-1+s);return a=n(l+u*s/2,u),o=0,e={t:"rangePoints",a:arguments},r},r.rangeRoundPoints=function(i,s){arguments.length<2&&(s=0);var l=i[0],c=i[1],u=t.length<2?(l=c=Math.round((l+c)/2),0):(c-l)/(t.length-1+s)|0;return a=n(l+Math.round(u*s/2+(c-l-(t.length-1+s)*u)/2),u),o=0,e={t:"rangeRoundPoints",a:arguments},r},r.rangeBands=function(i,s,l){arguments.length<2&&(s=0),arguments.length<3&&(l=s);var c=i[1]<i[0],u=i[c-0],h=(i[1-c]-u)/(t.length-s+2*l);return a=n(u+h*l,h),c&&a.reverse(),o=h*(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 c=i[1]<i[0],u=i[c-0],h=i[1-c],f=Math.floor((h-u)/(t.length-s+2*l));return a=n(u+Math.round((h-u-(t.length-s)*f)/2),f),c&&a.reverse(),o=Math.round(f*(1-s)),e={t:"rangeRoundBands",a:arguments},r},r.rangeBand=function(){return o},r.rangeExtent=function(){return qn(e.a[0])},r.copy=function(){return ii(t,e)},r.domain(t)}function ai(t,e){function r(){var r=0,n=e.length;for(s=[];++r<n;)s[r-1]=Zi.quantile(t,r/n);return o}function o(t){if(!isNaN(t=+t))return e[Zi.bisect(s,t)]}var s;return o.domain=function(e){return arguments.length?(t=e.map(i).filter(a).sort(n),r()):t},o.range=function(t){return arguments.length?(e=t,r()):e},o.quantiles=function(){return s},o.invertExtent=function(r){return(r=e.indexOf(r))<0?[NaN,NaN]:[r>0?s[r-1]:t[0],r<s.length?s[r]:t[t.length-1]]},o.copy=function(){return ai(t,e)},r()}function oi(t,e,r){function n(e){return r[Math.max(0,Math.min(o,Math.floor(a*(e-t))))]}function i(){return a=r.length/(e-t),o=r.length-1,n}var a,o;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=e<0?NaN:e/a+t,[e,e+1/a]},n.copy=function(){return oi(t,e,r)},i()}function si(t,e){function r(r){if(r<=r)return e[Zi.bisect(t,r)]}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 si(t,e)},r}function li(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 Qn(t,e)},e.tickFormat=function(e,r){return $n(t,e,r)},e.copy=function(){return li(t)},e}function ci(){return 0}function ui(t){return t.innerRadius}function hi(t){return t.outerRadius}function fi(t){return t.startAngle}function di(t){return t.endAngle}function pi(t){return t&&t.padAngle}function mi(t,e,r,n){return(t-r)*e-(e-n)*t>0?0:1}function gi(t,e,r,n,i){var a=t[0]-e[0],o=t[1]-e[1],s=(i?n:-n)/Math.sqrt(a*a+o*o),l=s*o,c=-s*a,u=t[0]+l,h=t[1]+c,f=e[0]+l,d=e[1]+c,p=(u+f)/2,m=(h+d)/2,g=f-u,v=d-h,y=g*g+v*v,b=r-n,x=u*d-f*h,_=(v<0?-1:1)*Math.sqrt(Math.max(0,b*b*y-x*x)),w=(x*v-g*_)/y,M=(-x*g-v*_)/y,k=(x*v+g*_)/y,T=(-x*g+v*_)/y,A=w-p,S=M-m,E=k-p,L=T-m;return A*A+S*S>E*E+L*L&&(w=k,M=T),[[w-l,M-c],[w*r/b,M*r/b]]}function vi(t){function e(e){function o(){c.push("M",a(t(u),s))}for(var l,c=[],u=[],h=-1,f=e.length,d=_t(r),p=_t(n);++h<f;)i.call(this,l=e[h],h)?u.push([+d.call(this,l,h),+p.call(this,l,h)]):u.length&&(o(),u=[]);return u.length&&o(),c.length?c.join(""):null}var r=ar,n=or,i=ve,a=yi,o=a.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?(o="function"==typeof t?a=t:(a=vs.get(t)||yi).key,e):o},e.tension=function(t){return arguments.length?(s=t,e):s},e}function yi(t){return t.length>1?t.join("L"):t+"Z"}function bi(t){return t.join("L")+"Z"}function xi(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 _i(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 wi(t,e){if(e.length<1||t.length!=e.length&&t.length!=e.length+2)return yi(t);var r=t.length!=e.length,n="",i=t[0],a=t[1],o=e[0],s=o,l=1;if(r&&(n+="Q"+(a[0]-2*o[0]/3)+","+(a[1]-2*o[1]/3)+","+a[0]+","+a[1],i=t[1],l=2),e.length>1){s=e[1],a=t[l],l++,n+="C"+(i[0]+o[0])+","+(i[1]+o[1])+","+(a[0]-s[0])+","+(a[1]-s[1])+","+a[0]+","+a[1];for(var c=2;c<e.length;c++,l++)a=t[l],s=e[c],n+="S"+(a[0]-s[0])+","+(a[1]-s[1])+","+a[0]+","+a[1]}if(r){var u=t[l];n+="Q"+(a[0]+2*s[0]/3)+","+(a[1]+2*s[1]/3)+","+u[0]+","+u[1]}return n}function Mi(t,e){for(var r,n=[],i=(1-e)/2,a=t[0],o=t[1],s=1,l=t.length;++s<l;)r=a,a=o,o=t[s],n.push([i*(o[0]-r[0]),i*(o[1]-r[1])]);return n}function ki(t){if(t.length<3)return yi(t);var e=1,r=t.length,n=t[0],i=n[0],a=n[1],o=[i,i,i,(n=t[1])[0]],s=[a,a,a,n[1]],l=[i,",",a,"L",Ti(xs,o),",",Ti(xs,s)];for(t.push(t[r-1]);++e<=r;)n=t[e],o.shift(),o.push(n[0]),s.shift(),s.push(n[1]),Ai(l,o,s);return t.pop(),l.push("L",n),l.join("")}function Ti(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]}function Ai(t,e,r){t.push("C",Ti(ys,e),",",Ti(ys,r),",",Ti(bs,e),",",Ti(bs,r),",",Ti(xs,e),",",Ti(xs,r))}function Si(t,e){return(e[1]-t[1])/(e[0]-t[0])}function Ei(t){for(var e,r,n,i,a=[],o=function(t){for(var e=0,r=t.length-1,n=[],i=t[0],a=t[1],o=n[0]=Si(i,a);++e<r;)n[e]=(o+(o=Si(i=a,a=t[e+1])))/2;return n[e]=o,n}(t),s=-1,l=t.length-1;++s<l;)e=Si(t[s],t[s+1]),aa(e)<wa?o[s]=o[s+1]=0:(i=(r=o[s]/e)*r+(n=o[s+1]/e)*n)>9&&(i=3*e/Math.sqrt(i),o[s]=i*r,o[s+1]=i*n);for(s=-1;++s<=l;)i=(t[Math.min(l,s+1)][0]-t[Math.max(0,s-1)][0])/(6*(1+o[s]*o[s])),a.push([i||0,o[s]*i||0]);return a}function Li(t){for(var e,r,n,i=-1,a=t.length;++i<a;)r=(e=t[i])[0],n=e[1]-Sa,e[0]=r*Math.cos(n),e[1]=r*Math.sin(n);return t}function Ci(t){function e(e){function l(){m.push("M",s(t(v),h),u,c(t(g.reverse()),h),"Z")}for(var f,d,p,m=[],g=[],v=[],y=-1,b=e.length,x=_t(r),_=_t(i),w=r===n?function(){return d}:_t(n),M=i===a?function(){return p}:_t(a);++y<b;)o.call(this,f=e[y],y)?(g.push([d=+x.call(this,f,y),p=+_.call(this,f,y)]),v.push([+w.call(this,f,y),+M.call(this,f,y)])):g.length&&(l(),g=[],v=[]);return g.length&&l(),m.length?m.join(""):null}var r=ar,n=ar,i=0,a=or,o=ve,s=yi,l=s.key,c=s,u="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=a=t,e):a},e.y0=function(t){return arguments.length?(i=t,e):i},e.y1=function(t){return arguments.length?(a=t,e):a},e.defined=function(t){return arguments.length?(o=t,e):o},e.interpolate=function(t){return arguments.length?(l="function"==typeof t?s=t:(s=vs.get(t)||yi).key,c=s.reverse||s,u=s.closed?"M":"L",e):l},e.tension=function(t){return arguments.length?(h=t,e):h},e}function Ii(t){return t.radius}function zi(t){return[t.x,t.y]}function Di(){return 64}function Pi(){return"circle"}function Oi(t){var e=Math.sqrt(t/ka);return"M0,"+e+"A"+e+","+e+" 0 1,1 0,"+-e+"A"+e+","+e+" 0 1,1 0,"+e+"Z"}function Ri(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 Fi(t,e,r){return ua(t,Ss),t.namespace=e,t.id=r,t}function ji(t,e,r,n){var i=t.id,a=t.namespace;return U(t,"function"==typeof r?function(t,o,s){t[a][i].tween.set(e,n(r.call(t,t.__data__,o,s)))}:(r=n(r),function(t){t[a][i].tween.set(e,r)}))}function Ni(t){return null==t&&(t=""),function(){this.textContent=t}}function Bi(t){return null==t?"__transition__":"__transition_"+t+"__"}function Ui(t,e,r,n,i){function a(t){var e=m.delay;if(u.t=e+l,e<=t)return o(t-e);u.c=o}function o(r){var i=p.active,a=p[i];a&&(a.timer.c=null,a.timer.t=NaN,--p.count,delete p[i],a.event&&a.event.interrupt.call(t,t.__data__,a.index));for(var o in p)if(+o<n){var c=p[o];c.timer.c=null,c.timer.t=NaN,--p.count,delete p[o]}u.c=s,kt(function(){return u.c&&s(r||1)&&(u.c=null,u.t=NaN),1},0,l),p.active=n,m.event&&m.event.start.call(t,t.__data__,e),d=[],m.tween.forEach(function(r,n){(n=n.call(t,t.__data__,e))&&d.push(n)}),f=m.ease,h=m.duration}function s(i){for(var a=i/h,o=f(a),s=d.length;s>0;)d[--s].call(t,o);if(a>=1)return m.event&&m.event.end.call(t,t.__data__,e),--p.count?delete p[n]:delete t[r],1}var l,u,h,f,d,p=t[r]||(t[r]={active:0,count:0}),m=p[n];m||(l=i.time,u=kt(a,0,l),m=p[n]={tween:new c,time:l,timer:u,delay:i.delay,duration:i.duration,ease:i.ease,index:e},i=null,++p.count)}function Vi(t,e,r){t.attr("transform",function(t){var n=e(t);return"translate("+(isFinite(n)?n:r(t))+",0)"})}function Hi(t,e,r){t.attr("transform",function(t){var n=e(t);return"translate(0,"+(isFinite(n)?n:r(t))+")"})}function qi(t){return t.toISOString()}function Gi(t,e,r){function n(e){return t(e)}function i(t,r){var n=(t[1]-t[0])/r,i=Zi.bisect(Rs,n);return i==Rs.length?[e.year,Kn(t.map(function(t){return t/31536e6}),r)[2]]:i?e[n/Rs[i-1]<Rs[i]/n?i-1:i]:[Ns,Kn(t,r)[2]]}return n.invert=function(e){return Yi(t.invert(e))},n.domain=function(e){return arguments.length?(t.domain(e),n):t.domain().map(Yi)},n.nice=function(t,e){function r(r){return!isNaN(r)&&!t.range(r,Yi(+r+1),e).length}var a=n.domain(),o=qn(a),s=null==t?i(o,10):"number"==typeof t&&i(o,t);return s&&(t=s[0],e=s[1]),n.domain(Yn(a,e>1?{floor:function(e){for(;r(e=t.floor(e));)e=Yi(e-1);return e},ceil:function(e){for(;r(e=t.ceil(e));)e=Yi(+e+1);return e}}:t))},n.ticks=function(t,e){var r=qn(n.domain()),a=null==t?i(r,10):"number"==typeof t?i(r,t):!t.range&&[{range:t},e];return a&&(t=a[0],e=a[1]),t.range(r[0],Yi(+r[1]+1),e<1?1:e)},n.tickFormat=function(){return r},n.copy=function(){return Gi(t.copy(),e,r)},Zn(n,t)}function Yi(t){return new Date(t)}function Wi(t){return JSON.parse(t.responseText)}function Xi(t){var e=Qi.createRange();return e.selectNode(Qi.body),e.createContextualFragment(t.responseText)}var Zi={version:"3.5.17"},Ji=[].slice,Ki=function(t){return Ji.call(t)},Qi=this.document;if(Qi)try{Ki(Qi.documentElement.childNodes)[0].nodeType}catch(t){Ki=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}),Qi)try{Qi.createElement("DIV").style.setProperty("opacity",0,"")}catch(t){var $i=this.Element.prototype,ta=$i.setAttribute,ea=$i.setAttributeNS,ra=this.CSSStyleDeclaration.prototype,na=ra.setProperty;$i.setAttribute=function(t,e){ta.call(this,t,e+"")},$i.setAttributeNS=function(t,e,r){ea.call(this,t,e,r+"")},ra.setProperty=function(t,e,r){na.call(this,t,e+"",r)}}Zi.ascending=n,Zi.descending=function(t,e){return e<t?-1:e>t?1:e>=t?0:NaN},Zi.min=function(t,e){var r,n,i=-1,a=t.length;if(1===arguments.length){for(;++i<a;)if(null!=(n=t[i])&&n>=n){r=n;break}for(;++i<a;)null!=(n=t[i])&&r>n&&(r=n)}else{for(;++i<a;)if(null!=(n=e.call(t,t[i],i))&&n>=n){r=n;break}for(;++i<a;)null!=(n=e.call(t,t[i],i))&&r>n&&(r=n)}return r},Zi.max=function(t,e){var r,n,i=-1,a=t.length;if(1===arguments.length){for(;++i<a;)if(null!=(n=t[i])&&n>=n){r=n;break}for(;++i<a;)null!=(n=t[i])&&n>r&&(r=n)}else{for(;++i<a;)if(null!=(n=e.call(t,t[i],i))&&n>=n){r=n;break}for(;++i<a;)null!=(n=e.call(t,t[i],i))&&n>r&&(r=n)}return r},Zi.extent=function(t,e){var r,n,i,a=-1,o=t.length;if(1===arguments.length){for(;++a<o;)if(null!=(n=t[a])&&n>=n){r=i=n;break}for(;++a<o;)null!=(n=t[a])&&(r>n&&(r=n),i<n&&(i=n))}else{for(;++a<o;)if(null!=(n=e.call(t,t[a],a))&&n>=n){r=i=n;break}for(;++a<o;)null!=(n=e.call(t,t[a],a))&&(r>n&&(r=n),i<n&&(i=n))}return[r,i]},Zi.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},Zi.mean=function(t,e){var r,n=0,o=t.length,s=-1,l=o;if(1===arguments.length)for(;++s<o;)a(r=i(t[s]))?n+=r:--l;else for(;++s<o;)a(r=i(e.call(t,t[s],s)))?n+=r:--l;if(l)return n/l},Zi.quantile=function(t,e){var r=(t.length-1)*e+1,n=Math.floor(r),i=+t[n-1],a=r-n;return a?i+a*(t[n]-i):i},Zi.median=function(t,e){var r,o=[],s=t.length,l=-1;if(1===arguments.length)for(;++l<s;)a(r=i(t[l]))&&o.push(r);else for(;++l<s;)a(r=i(e.call(t,t[l],l)))&&o.push(r);if(o.length)return Zi.quantile(o.sort(n),.5)},Zi.variance=function(t,e){var r,n,o=t.length,s=0,l=0,c=-1,u=0;if(1===arguments.length)for(;++c<o;)a(r=i(t[c]))&&(l+=(n=r-s)*(r-(s+=n/++u)));else for(;++c<o;)a(r=i(e.call(t,t[c],c)))&&(l+=(n=r-s)*(r-(s+=n/++u)));if(u>1)return l/(u-1)},Zi.deviation=function(){var t=Zi.variance.apply(this,arguments);return t?Math.sqrt(t):t};var ia=o(n);Zi.bisectLeft=ia.left,Zi.bisect=Zi.bisectRight=ia.right,Zi.bisector=function(t){return o(1===t.length?function(e,r){return n(t(e),r)}:t)},Zi.shuffle=function(t,e,r){(a=arguments.length)<3&&(r=t.length,a<2&&(e=0));for(var n,i,a=r-e;a;)i=Math.random()*a--|0,n=t[a+e],t[a+e]=t[i+e],t[i+e]=n;return t},Zi.permute=function(t,e){for(var r=e.length,n=new Array(r);r--;)n[r]=t[e[r]];return n},Zi.pairs=function(t){for(var e=0,r=t.length-1,n=t[0],i=new Array(r<0?0:r);e<r;)i[e]=[n,n=t[++e]];return i},Zi.transpose=function(t){if(!(i=t.length))return[];for(var e=-1,r=Zi.min(t,s),n=new Array(r);++e<r;)for(var i,a=-1,o=n[e]=new Array(i);++a<i;)o[a]=t[a][e];return n},Zi.zip=function(){return Zi.transpose(arguments)},Zi.keys=function(t){var e=[];for(var r in t)e.push(r);return e},Zi.values=function(t){var e=[];for(var r in t)e.push(t[r]);return e},Zi.entries=function(t){var e=[];for(var r in t)e.push({key:r,value:t[r]});return e},Zi.merge=function(t){for(var e,r,n,i=t.length,a=-1,o=0;++a<i;)o+=t[a].length;for(r=new Array(o);--i>=0;)for(e=(n=t[i]).length;--e>=0;)r[--o]=n[e];return r};var aa=Math.abs;Zi.range=function(t,e,r){if(arguments.length<3&&(r=1,arguments.length<2&&(e=t,t=0)),(e-t)/r==1/0)throw new Error("infinite range");var n,i=[],a=function(t){for(var e=1;t*e%1;)e*=10;return e}(aa(r)),o=-1;if(t*=a,e*=a,(r*=a)<0)for(;(n=t+r*++o)>e;)i.push(n/a);else for(;(n=t+r*++o)<e;)i.push(n/a);return i},Zi.map=function(t,e){var r=new c;if(t instanceof c)t.forEach(function(t,e){r.set(t,e)});else if(Array.isArray(t)){var n,i=-1,a=t.length;if(1===arguments.length)for(;++i<a;)r.set(i,t[i]);else for(;++i<a;)r.set(e.call(t,n=t[i],i),n)}else for(var o in t)r.set(o,t[o]);return r};var oa="__proto__",sa="\0";l(c,{has:f,get:function(t){return this._[u(t)]},set:function(t,e){return this._[u(t)]=e},remove:d,keys:p,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:h(e),value:this._[e]});return t},size:m,empty:g,forEach:function(t){for(var e in this._)t.call(this,h(e),this._[e])}}),Zi.nest=function(){function t(e,o,s){if(s>=a.length)return n?n.call(i,o):r?o.sort(r):o;for(var l,u,h,f,d=-1,p=o.length,m=a[s++],g=new c;++d<p;)(f=g.get(l=m(u=o[d])))?f.push(u):g.set(l,[u]);return e?(u=e(),h=function(r,n){u.set(r,t(e,n,s))}):(u={},h=function(r,n){u[r]=t(e,n,s)}),g.forEach(h),u}function e(t,r){if(r>=a.length)return t;var n=[],i=o[r++];return t.forEach(function(t,i){n.push({key:t,values:e(i,r)})}),i?n.sort(function(t,e){return i(t.key,e.key)}):n}var r,n,i={},a=[],o=[];return i.map=function(e,r){return t(r,e,0)},i.entries=function(r){return e(t(Zi.map,r,0),0)},i.key=function(t){return a.push(t),i},i.sortKeys=function(t){return o[a.length-1]=t,i},i.sortValues=function(t){return r=t,i},i.rollup=function(t){return n=t,i},i},Zi.set=function(t){var e=new v;if(t)for(var r=0,n=t.length;r<n;++r)e.add(t[r]);return e},l(v,{has:f,add:function(t){return this._[u(t+="")]=!0,t},remove:d,values:p,size:m,empty:g,forEach:function(t){for(var e in this._)t.call(this,h(e))}}),Zi.behavior={},Zi.rebind=function(t,e){for(var r,n=1,i=arguments.length;++n<i;)t[r=arguments[n]]=function(t,e,r){return function(){var n=r.apply(e,arguments);return n===e?t:n}}(t,e,e[r]);return t};var la=["webkit","ms","moz","Moz","o","O"];Zi.dispatch=function(){for(var t=new _,e=-1,r=arguments.length;++e<r;)t[arguments[e]]=w(t);return t},_.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}},Zi.event=null,Zi.requote=function(t){return t.replace(ca,"\\$&")};var ca=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,ua={}.__proto__?function(t,e){t.__proto__=e}:function(t,e){for(var r in e)t[r]=e[r]},ha=function(t,e){return e.querySelector(t)},fa=function(t,e){return e.querySelectorAll(t)},da=function(t,e){var r=t.matches||t[b(t,"matchesSelector")];return(da=function(t,e){return r.call(t,e)})(t,e)};"function"==typeof Sizzle&&(ha=function(t,e){return Sizzle(t,e)[0]||null},fa=Sizzle,da=Sizzle.matchesSelector),Zi.selection=function(){return Zi.select(Qi.documentElement)};var pa=Zi.selection.prototype=[];pa.select=function(t){var e,r,n,i,a=[];t=S(t);for(var o=-1,s=this.length;++o<s;){a.push(e=[]),e.parentNode=(n=this[o]).parentNode;for(var l=-1,c=n.length;++l<c;)(i=n[l])?(e.push(r=t.call(i,i.__data__,l,o)),r&&"__data__"in i&&(r.__data__=i.__data__)):e.push(null)}return A(a)},pa.selectAll=function(t){var e,r,n=[];t=E(t);for(var i=-1,a=this.length;++i<a;)for(var o=this[i],s=-1,l=o.length;++s<l;)(r=o[s])&&(n.push(e=Ki(t.call(r,r.__data__,s,i))),e.parentNode=r);return A(n)};var ma="http://www.w3.org/1999/xhtml",ga={svg:"http://www.w3.org/2000/svg",xhtml:ma,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};Zi.ns={prefix:ga,qualify:function(t){var e=t.indexOf(":"),r=t;return e>=0&&"xmlns"!==(r=t.slice(0,e))&&(t=t.slice(e+1)),ga.hasOwnProperty(r)?{space:ga[r],local:t}:t}},pa.attr=function(t,e){if(arguments.length<2){if("string"==typeof t){var r=this.node();return(t=Zi.ns.qualify(t)).local?r.getAttributeNS(t.space,t.local):r.getAttribute(t)}for(e in t)this.each(L(e,t[e]));return this}return this.each(L(t,e))},pa.classed=function(t,e){if(arguments.length<2){if("string"==typeof t){var r=this.node(),n=(t=z(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(!I(t[i]).test(e))return!1;return!0}for(e in t)this.each(D(e,t[e]));return this}return this.each(D(t,e))},pa.style=function(t,e,n){var i=arguments.length;if(i<3){if("string"!=typeof t){i<2&&(e="");for(n in t)this.each(O(n,t[n],e));return this}if(i<2){var a=this.node();return r(a).getComputedStyle(a,null).getPropertyValue(t)}n=""}return this.each(O(t,e,n))},pa.property=function(t,e){if(arguments.length<2){if("string"==typeof t)return this.node()[t];for(e in t)this.each(R(e,t[e]));return this}return this.each(R(t,e))},pa.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},pa.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},pa.append=function(t){return t=F(t),this.select(function(){return this.appendChild(t.apply(this,arguments))})},pa.insert=function(t,e){return t=F(t),e=S(e),this.select(function(){return this.insertBefore(t.apply(this,arguments),e.apply(this,arguments)||null)})},pa.remove=function(){return this.each(j)},pa.data=function(t,e){function r(t,r){var n,i,a,o=t.length,h=r.length,f=Math.min(o,h),d=new Array(h),p=new Array(h),m=new Array(o);if(e){var g,v=new c,y=new Array(o);for(n=-1;++n<o;)(i=t[n])&&(v.has(g=e.call(i,i.__data__,n))?m[n]=i:v.set(g,i),y[n]=g);for(n=-1;++n<h;)(i=v.get(g=e.call(r,a=r[n],n)))?!0!==i&&(d[n]=i,i.__data__=a):p[n]=N(a),v.set(g,!0);for(n=-1;++n<o;)n in y&&!0!==v.get(y[n])&&(m[n]=t[n])}else{for(n=-1;++n<f;)i=t[n],a=r[n],i?(i.__data__=a,d[n]=i):p[n]=N(a);for(;n<h;++n)p[n]=N(r[n]);for(;n<o;++n)m[n]=t[n]}p.update=d,p.parentNode=d.parentNode=m.parentNode=t.parentNode,s.push(p),l.push(d),u.push(m)}var n,i,a=-1,o=this.length;if(!arguments.length){for(t=new Array(o=(n=this[0]).length);++a<o;)(i=n[a])&&(t[a]=i.__data__);return t}var s=V([]),l=A([]),u=A([]);if("function"==typeof t)for(;++a<o;)r(n=this[a],t.call(n,n.parentNode.__data__,a));else for(;++a<o;)r(n=this[a],t);return l.enter=function(){return s},l.exit=function(){return u},l},pa.datum=function(t){return arguments.length?this.property("__data__",t):this.property("__data__")},pa.filter=function(t){var e,r,n,i=[];"function"!=typeof t&&(t=B(t));for(var a=0,o=this.length;a<o;a++){i.push(e=[]),e.parentNode=(r=this[a]).parentNode;for(var s=0,l=r.length;s<l;s++)(n=r[s])&&t.call(n,n.__data__,s,a)&&e.push(n)}return A(i)},pa.order=function(){for(var t=-1,e=this.length;++t<e;)for(var r,n=this[t],i=n.length-1,a=n[i];--i>=0;)(r=n[i])&&(a&&a!==r.nextSibling&&a.parentNode.insertBefore(r,a),a=r);return this},pa.sort=function(t){t=function(t){return arguments.length||(t=n),function(e,r){return e&&r?t(e.__data__,r.__data__):!e-!r}}.apply(this,arguments);for(var e=-1,r=this.length;++e<r;)this[e].sort(t);return this.order()},pa.each=function(t){return U(this,function(e,r,n){t.call(e,e.__data__,r,n)})},pa.call=function(t){var e=Ki(arguments);return t.apply(e[0]=this,e),this},pa.empty=function(){return!this.node()},pa.node=function(){for(var t=0,e=this.length;t<e;t++)for(var r=this[t],n=0,i=r.length;n<i;n++){var a=r[n];if(a)return a}return null},pa.size=function(){var t=0;return U(this,function(){++t}),t};var va=[];Zi.selection.enter=V,Zi.selection.enter.prototype=va,va.append=pa.append,va.empty=pa.empty,va.node=pa.node,va.call=pa.call,va.size=pa.size,va.select=function(t){for(var e,r,n,i,a,o=[],s=-1,l=this.length;++s<l;){n=(i=this[s]).update,o.push(e=[]),e.parentNode=i.parentNode;for(var c=-1,u=i.length;++c<u;)(a=i[c])?(e.push(n[c]=r=t.call(i.parentNode,a.__data__,c,s)),r.__data__=a.__data__):e.push(null)}return A(o)},va.insert=function(t,e){return arguments.length<2&&(e=function(t){var e,r;return function(n,i,a){var o,s=t[a].update,l=s.length;for(a!=r&&(r=a,e=0),i>=e&&(e=i+1);!(o=s[e])&&++e<l;);return o}}(this)),pa.insert.call(this,t,e)},Zi.select=function(e){var r;return"string"==typeof e?(r=[ha(e,Qi)]).parentNode=Qi.documentElement:(r=[e]).parentNode=t(e),A([r])},Zi.selectAll=function(t){var e;return"string"==typeof t?(e=Ki(fa(t,Qi))).parentNode=Qi.documentElement:(e=Ki(t)).parentNode=null,A([e])},pa.on=function(t,e,r){var n=arguments.length;if(n<3){if("string"!=typeof t){n<2&&(e=!1);for(r in t)this.each(H(r,t[r],e));return this}if(n<2)return(n=this.node()["__on"+t])&&n._;r=!1}return this.each(H(t,e,r))};var ya=Zi.map({mouseenter:"mouseover",mouseleave:"mouseout"});Qi&&ya.forEach(function(t){"on"+t in Qi&&ya.remove(t)});var ba,xa=0;Zi.mouse=function(t){return W(t,k())};var _a=this.navigator&&/WebKit/.test(this.navigator.userAgent)?-1:0;Zi.touch=function(t,e,r){if(arguments.length<3&&(r=e,e=k().changedTouches),e)for(var n,i=0,a=e.length;i<a;++i)if((n=e[i]).identifier===r)return W(t,n)},Zi.behavior.drag=function(){function t(){this.on("mousedown.drag",a).on("touchstart.drag",o)}function e(t,e,r,a,o){return function(){var s,l=this,c=Zi.event.target.correspondingElement||Zi.event.target,u=l.parentNode,h=n.of(l,arguments),f=0,d=t(),p=".drag"+(null==d?"":"-"+d),m=Zi.select(r(c)).on(a+p,function(){var t,r,n=e(u,d);n&&(t=n[0]-v[0],r=n[1]-v[1],f|=t|r,v=n,h({type:"drag",x:n[0]+s[0],y:n[1]+s[1],dx:t,dy:r}))}).on(o+p,function(){e(u,d)&&(m.on(a+p,null).on(o+p,null),g(f),h({type:"dragend"}))}),g=Y(c),v=e(u,d);s=i?[(s=i.apply(l,arguments)).x-v[0],s.y-v[1]]:[0,0],h({type:"dragstart"})}}var n=T(t,"drag","dragstart","dragend"),i=null,a=e(x,Zi.mouse,r,"mousemove","mouseup"),o=e(X,Zi.touch,y,"touchmove","touchend");return t.origin=function(e){return arguments.length?(i=e,t):i},Zi.rebind(t,n,"on")},Zi.touches=function(t,e){return arguments.length<2&&(e=k().touches),e?Ki(e).map(function(e){var r=W(t,e);return r.identifier=e.identifier,r}):[]};var wa=1e-6,Ma=wa*wa,ka=Math.PI,Ta=2*ka,Aa=Ta-wa,Sa=ka/2,Ea=ka/180,La=180/ka,Ca=Math.SQRT2;Zi.interpolateZoom=function(t,e){var r,n,i=t[0],a=t[1],o=t[2],s=e[0],l=e[1],c=e[2],u=s-i,h=l-a,f=u*u+h*h;if(f<Ma)n=Math.log(c/o)/Ca,r=function(t){return[i+t*u,a+t*h,o*Math.exp(Ca*t*n)]};else{var d=Math.sqrt(f),p=(c*c-o*o+4*f)/(2*o*2*d),m=(c*c-o*o-4*f)/(2*c*2*d),g=Math.log(Math.sqrt(p*p+1)-p),v=Math.log(Math.sqrt(m*m+1)-m);n=(v-g)/Ca,r=function(t){var e=t*n,r=$(g),s=o/(2*d)*(r*function(t){return((t=Math.exp(2*t))-1)/(t+1)}(Ca*e+g)-function(t){return((t=Math.exp(t))-1/t)/2}(g));return[i+s*u,a+s*h,o*r/$(Ca*e+g)]}}return r.duration=1e3*n,r},Zi.behavior.zoom=function(){function t(t){t.on(C,u).on(za+".zoom",f).on("dblclick.zoom",d).on(D,h)}function e(t){return[(t[0]-k.x)/k.k,(t[1]-k.y)/k.k]}function n(t){k.k=Math.max(S[0],Math.min(S[1],t))}function i(t,e){e=function(t){return[t[0]*k.k+k.x,t[1]*k.k+k.y]}(e),k.x+=t[0]-e[0],k.y+=t[1]-e[1]}function a(e,r,a,o){e.__chart__={x:k.x,y:k.y,k:k.k},n(Math.pow(2,o)),i(m=r,a),e=Zi.select(e),E>0&&(e=e.transition().duration(E)),e.call(t.event)}function o(){x&&x.domain(b.range().map(function(t){return(t-k.x)/k.k}).map(b.invert)),w&&w.domain(_.range().map(function(t){return(t-k.y)/k.k}).map(_.invert))}function s(t){L++||t({type:"zoomstart"})}function l(t){o(),t({type:"zoom",scale:k.k,translate:[k.x,k.y]})}function c(t){--L||(t({type:"zoomend"}),m=null)}function u(){var t=this,n=P.of(t,arguments),a=0,o=Zi.select(r(t)).on(I,function(){a=1,i(Zi.mouse(t),u),l(n)}).on(z,function(){o.on(I,null).on(z,null),h(a),c(n)}),u=e(Zi.mouse(t)),h=Y(t);As.call(t),s(n)}function h(){function t(){var t=Zi.touches(p);return d=k.k,t.forEach(function(t){t.identifier in g&&(g[t.identifier]=e(t))}),t}function r(){var e=Zi.event.target;Zi.select(e).on(x,o).on(_,f),w.push(e);for(var r=Zi.event.changedTouches,n=0,i=r.length;n<i;++n)g[r[n].identifier]=null;var s=t(),l=Date.now();if(1===s.length){if(l-y<500){c=s[0];a(p,c,g[c.identifier],Math.floor(Math.log(k.k)/Math.LN2)+1),M()}y=l}else if(s.length>1){var c=s[0],u=s[1],h=c[0]-u[0],d=c[1]-u[1];v=h*h+d*d}}function o(){var t,e,r,a,o=Zi.touches(p);As.call(p);for(var s=0,c=o.length;s<c;++s,a=null)if(r=o[s],a=g[r.identifier]){if(e)break;t=r,e=a}if(a){var u=(u=r[0]-t[0])*u+(u=r[1]-t[1])*u,h=v&&Math.sqrt(u/v);t=[(t[0]+r[0])/2,(t[1]+r[1])/2],e=[(e[0]+a[0])/2,(e[1]+a[1])/2],n(h*d)}y=null,i(t,e),l(m)}function f(){if(Zi.event.touches.length){for(var e=Zi.event.changedTouches,r=0,n=e.length;r<n;++r)delete g[e[r].identifier];for(var i in g)return void t()}Zi.selectAll(w).on(b,null),T.on(C,u).on(D,h),A(),c(m)}var d,p=this,m=P.of(p,arguments),g={},v=0,b=".zoom-"+Zi.event.changedTouches[0].identifier,x="touchmove"+b,_="touchend"+b,w=[],T=Zi.select(p),A=Y(p);r(),s(m),T.on(C,null).on(D,r)}function f(){var t=P.of(this,arguments);v?clearTimeout(v):(As.call(this),p=e(m=g||Zi.mouse(this)),s(t)),v=setTimeout(function(){v=null,c(t)},50),M(),n(Math.pow(2,.002*Ia())*k.k),i(m,p),l(t)}function d(){var t=Zi.mouse(this),r=Math.log(k.k)/Math.LN2;a(this,t,e(t),Zi.event.shiftKey?Math.ceil(r)-1:Math.floor(r)+1)}var p,m,g,v,y,b,x,_,w,k={x:0,y:0,k:1},A=[960,500],S=Da,E=250,L=0,C="mousedown.zoom",I="mousemove.zoom",z="mouseup.zoom",D="touchstart.zoom",P=T(t,"zoomstart","zoom","zoomend");return za||(za="onwheel"in Qi?(Ia=function(){return-Zi.event.deltaY*(Zi.event.deltaMode?120:1)},"wheel"):"onmousewheel"in Qi?(Ia=function(){return Zi.event.wheelDelta},"mousewheel"):(Ia=function(){return-Zi.event.detail},"MozMousePixelScroll")),t.event=function(t){t.each(function(){var t=P.of(this,arguments),e=k;ks?Zi.select(this).transition().each("start.zoom",function(){k=this.__chart__||{x:0,y:0,k:1},s(t)}).tween("zoom:zoom",function(){var r=A[0],n=A[1],i=m?m[0]:r/2,a=m?m[1]:n/2,o=Zi.interpolateZoom([(i-k.x)/k.k,(a-k.y)/k.k,r/k.k],[(i-e.x)/e.k,(a-e.y)/e.k,r/e.k]);return function(e){var n=o(e),s=r/n[2];this.__chart__=k={x:i-n[0]*s,y:a-n[1]*s,k:s},l(t)}}).each("interrupt.zoom",function(){c(t)}).each("end.zoom",function(){c(t)}):(this.__chart__=k,s(t),l(t),c(t))})},t.translate=function(e){return arguments.length?(k={x:+e[0],y:+e[1],k:k.k},o(),t):[k.x,k.y]},t.scale=function(e){return arguments.length?(k={x:k.x,y:k.y,k:null},n(+e),o(),t):k.k},t.scaleExtent=function(e){return arguments.length?(S=null==e?Da:[+e[0],+e[1]],t):S},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?(E=+e,t):E},t.x=function(e){return arguments.length?(x=e,b=e.copy(),k={x:0,y:0,k:1},t):x},t.y=function(e){return arguments.length?(w=e,_=e.copy(),k={x:0,y:0,k:1},t):w},Zi.rebind(t,P,"on")};var Ia,za,Da=[0,1/0];Zi.color=et,et.prototype.toString=function(){return this.rgb()+""},Zi.hsl=rt;var Pa=rt.prototype=new et;Pa.brighter=function(t){return t=Math.pow(.7,arguments.length?t:1),new rt(this.h,this.s,this.l/t)},Pa.darker=function(t){return t=Math.pow(.7,arguments.length?t:1),new rt(this.h,this.s,t*this.l)},Pa.rgb=function(){return nt(this.h,this.s,this.l)},Zi.hcl=it;var Oa=it.prototype=new et;Oa.brighter=function(t){return new it(this.h,this.c,Math.min(100,this.l+Ra*(arguments.length?t:1)))},Oa.darker=function(t){return new it(this.h,this.c,Math.max(0,this.l-Ra*(arguments.length?t:1)))},Oa.rgb=function(){return at(this.h,this.c,this.l).rgb()},Zi.lab=ot;var Ra=18,Fa=.95047,ja=1,Na=1.08883,Ba=ot.prototype=new et;Ba.brighter=function(t){return new ot(Math.min(100,this.l+Ra*(arguments.length?t:1)),this.a,this.b)},Ba.darker=function(t){return new ot(Math.max(0,this.l-Ra*(arguments.length?t:1)),this.a,this.b)},Ba.rgb=function(){return st(this.l,this.a,this.b)},Zi.rgb=ft;var Ua=ft.prototype=new et;Ua.brighter=function(t){t=Math.pow(.7,arguments.length?t:1);var e=this.r,r=this.g,n=this.b;return e||r||n?(e&&e<30&&(e=30),r&&r<30&&(r=30),n&&n<30&&(n=30),new ft(Math.min(255,e/t),Math.min(255,r/t),Math.min(255,n/t))):new ft(30,30,30)},Ua.darker=function(t){return t=Math.pow(.7,arguments.length?t:1),new ft(t*this.r,t*this.g,t*this.b)},Ua.hsl=function(){return vt(this.r,this.g,this.b)},Ua.toString=function(){return"#"+mt(this.r)+mt(this.g)+mt(this.b)};var Va=Zi.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});Va.forEach(function(t,e){Va.set(t,dt(e))}),Zi.functor=_t,Zi.xhr=wt(y),Zi.dsv=function(t,e){function r(t,r,a){arguments.length<3&&(a=r,r=null);var o=Mt(t,e,null==r?n:i(r),a);return o.row=function(t){return arguments.length?o.response(null==(r=t)?n:i(t)):r},o}function n(t){return r.parse(t.responseText)}function i(t){return function(e){return r.parse(e.responseText,t)}}function a(e){return e.map(o).join(t)}function o(t){return s.test(t)?'"'+t.replace(/\"/g,'""')+'"':t}var s=new RegExp('["'+t+"\n]"),l=t.charCodeAt(0);return 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(u>=c)return o;if(i)return i=!1,a;var e=u;if(34===t.charCodeAt(e)){for(var r=e;r++<c;)if(34===t.charCodeAt(r)){if(34!==t.charCodeAt(r+1))break;++r}u=r+2;return 13===(n=t.charCodeAt(r+1))?(i=!0,10===t.charCodeAt(r+2)&&++u):10===n&&(i=!0),t.slice(e+1,r).replace(/""/g,'"')}for(;u<c;){var n=t.charCodeAt(u++),s=1;if(10===n)i=!0;else if(13===n)i=!0,10===t.charCodeAt(u)&&(++u,++s);else if(n!==l)continue;return t.slice(e,u-s)}return t.slice(e)}for(var n,i,a={},o={},s=[],c=t.length,u=0,h=0;(n=r())!==o;){for(var f=[];n!==a&&n!==o;)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 v,i=[];return e.forEach(function(t){for(var e in t)n.has(e)||i.push(n.add(e))}),[i.map(o).join(t)].concat(e.map(function(e){return i.map(function(t){return o(e[t])}).join(t)})).join("\n")},r.formatRows=function(t){return t.map(a).join("\n")},r},Zi.csv=Zi.dsv(",","text/csv"),Zi.tsv=Zi.dsv("\t","text/tab-separated-values");var Ha,qa,Ga,Ya,Wa=this[b(this,"requestAnimationFrame")]||function(t){setTimeout(t,17)};Zi.timer=function(){kt.apply(this,arguments)},Zi.timer.flush=function(){At(),St()},Zi.round=function(t,e){return e?Math.round(t*(e=Math.pow(10,e)))/e:Math.round(t)};var Xa=["y","z","a","f","p","n","\xb5","m","","k","M","G","T","P","E","Z","Y"].map(function(t,e){var r=Math.pow(10,3*aa(8-e));return{scale:e>8?function(t){return t/r}:function(t){return t*r},symbol:t}});Zi.formatPrefix=function(t,e){var r=0;return(t=+t)&&(t<0&&(t*=-1),e&&(t=Zi.round(t,Et(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)))),Xa[8+r/3]};var Za=/(?:([^{])?([<>=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i,Ja=Zi.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=Zi.round(t,Et(t,e))).toFixed(Math.max(0,Math.min(20,Et(t*(1+1e-15),e))))}}),Ka=Zi.time={},Qa=Date;Lt.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(){$a.setUTCDate.apply(this._,arguments)},setDay:function(){$a.setUTCDay.apply(this._,arguments)},setFullYear:function(){$a.setUTCFullYear.apply(this._,arguments)},setHours:function(){$a.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){$a.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){$a.setUTCMinutes.apply(this._,arguments)},setMonth:function(){$a.setUTCMonth.apply(this._,arguments)},setSeconds:function(){$a.setUTCSeconds.apply(this._,arguments)},setTime:function(){$a.setTime.apply(this._,arguments)}};var $a=Date.prototype;Ka.year=Ct(function(t){return(t=Ka.day(t)).setMonth(0,1),t},function(t,e){t.setFullYear(t.getFullYear()+e)},function(t){return t.getFullYear()}),Ka.years=Ka.year.range,Ka.years.utc=Ka.year.utc.range,Ka.day=Ct(function(t){var e=new Qa(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}),Ka.days=Ka.day.range,Ka.days.utc=Ka.day.utc.range,Ka.dayOfYear=function(t){var e=Ka.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=Ka[t]=Ct(function(t){return(t=Ka.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=Ka.year(t).getDay();return Math.floor((Ka.dayOfYear(t)+(r+e)%7)/7)-(r!==e)});Ka[t+"s"]=r.range,Ka[t+"s"].utc=r.utc.range,Ka[t+"OfYear"]=function(t){var r=Ka.year(t).getDay();return Math.floor((Ka.dayOfYear(t)+(r+e)%7)/7)}}),Ka.week=Ka.sunday,Ka.weeks=Ka.sunday.range,Ka.weeks.utc=Ka.sunday.utc.range,Ka.weekOfYear=Ka.sundayOfYear;var to={"-":"",_:" ",0:"0"},eo=/^\s*\d+/,ro=/^%/;Zi.locale=function(t){return{numberFormat:function(t){var e=t.decimal,r=t.thousands,n=t.grouping,i=t.currency,a=n&&r?function(t,e){for(var i=t.length,a=[],o=0,s=n[0],l=0;i>0&&s>0&&(l+s+1>e&&(s=Math.max(1,e-l)),a.push(t.substring(i-=s,i+s)),!((l+=s+1)>e));)s=n[o=(o+1)%n.length];return a.reverse().join(r)}:y;return function(t){var r=Za.exec(t),n=r[1]||" ",o=r[2]||">",s=r[3]||"-",l=r[4]||"",c=r[5],u=+r[6],h=r[7],f=r[8],d=r[9],p=1,m="",g="",v=!1,y=!0;switch(f&&(f=+f.substring(1)),(c||"0"===n&&"="===o)&&(c=n="0",o="="),d){case"n":h=!0,d="g";break;case"%":p=100,g="%",d="f";break;case"p":p=100,g="%",d="r";break;case"b":case"o":case"x":case"X":"#"===l&&(m="0"+d.toLowerCase());case"c":y=!1;case"d":v=!0,f=0;break;case"s":p=-1,d="r"}"$"===l&&(m=i[0],g=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=Ja.get(d)||function(t){return t+""};var b=c&&h;return function(t){var r=g;if(v&&t%1)return"";var i=t<0||0===t&&1/t<0?(t=-t,"-"):"-"===s?"":s;if(p<0){var l=Zi.formatPrefix(t,f);t=l.scale(t),r=l.symbol+g}else t*=p;var x,_,w=(t=d(t,f)).lastIndexOf(".");if(w<0){var M=y?t.lastIndexOf("e"):-1;M<0?(x=t,_=""):(x=t.substring(0,M),_=t.substring(M))}else x=t.substring(0,w),_=e+t.substring(w+1);!c&&h&&(x=a(x,1/0));var k=m.length+x.length+_.length+(b?0:i.length),T=k<u?new Array(k=u-k+1).join(n):"";return b&&(x=a(T+x,T.length?u-_.length:1/0)),i+=m,t=x+_,("<"===o?i+t+T:">"===o?T+i+t:"^"===o?T.substring(0,k>>=1)+i+t+T.substring(k):i+(b?t:T+t))+r}}}(t),timeFormat:function(t){function e(t){function e(e){for(var r,i,a,o=[],s=-1,l=0;++s<n;)37===t.charCodeAt(s)&&(o.push(t.slice(l,s)),null!=(i=to[r=t.charAt(++s)])&&(r=t.charAt(++s)),(a=x[r])&&(r=a(e,null==i?"e"===r?" ":"0":i)),o.push(r),l=s+1);return o.push(t.slice(l,s)),o.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};if(r(n,t,e,0)!=e.length)return null;"p"in n&&(n.H=n.H%12+12*n.p);var i=null!=n.Z&&Qa!==Lt,a=new(i?Lt:Qa);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),i?a._:a},e.toString=function(){return t},e}function r(t,e,r,n){for(var i,a,o,s=0,l=e.length,c=r.length;s<l;){if(n>=c)return-1;if(37===(i=e.charCodeAt(s++))){if(o=e.charAt(s++),!(a=_[o in to?e.charAt(s++):o])||(n=a(t,r,n))<0)return-1}else if(i!=r.charCodeAt(n++))return-1}return n}var n=t.dateTime,i=t.date,a=t.time,o=t.periods,s=t.days,l=t.shortDays,c=t.months,u=t.shortMonths;e.multi=(e.utc=function(t){function r(t){try{var e=new(Qa=Lt);return e._=t,n(e)}finally{Qa=Date}}var n=e(t);return r.parse=function(t){try{Qa=Lt;var e=n.parse(t);return e&&e._}finally{Qa=Date}},r.toString=n.toString,r}).multi=Jt;var h=Zi.map(),f=Dt(s),d=Pt(s),p=Dt(l),m=Pt(l),g=Dt(c),v=Pt(c),y=Dt(u),b=Pt(u);o.forEach(function(t,e){h.set(t.toLowerCase(),e)});var x={a:function(t){return l[t.getDay()]},A:function(t){return s[t.getDay()]},b:function(t){return u[t.getMonth()]},B:function(t){return c[t.getMonth()]},c:e(n),d:function(t,e){return zt(t.getDate(),e,2)},e:function(t,e){return zt(t.getDate(),e,2)},H:function(t,e){return zt(t.getHours(),e,2)},I:function(t,e){return zt(t.getHours()%12||12,e,2)},j:function(t,e){return zt(1+Ka.dayOfYear(t),e,3)},L:function(t,e){return zt(t.getMilliseconds(),e,3)},m:function(t,e){return zt(t.getMonth()+1,e,2)},M:function(t,e){return zt(t.getMinutes(),e,2)},p:function(t){return o[+(t.getHours()>=12)]},S:function(t,e){return zt(t.getSeconds(),e,2)},U:function(t,e){return zt(Ka.sundayOfYear(t),e,2)},w:function(t){return t.getDay()},W:function(t,e){return zt(Ka.mondayOfYear(t),e,2)},x:e(i),X:e(a),y:function(t,e){return zt(t.getFullYear()%100,e,2)},Y:function(t,e){return zt(t.getFullYear()%1e4,e,4)},Z:Xt,"%":function(){return"%"}},_={a:function(t,e,r){p.lastIndex=0;var n=p.exec(e.slice(r));return n?(t.w=m.get(n[0].toLowerCase()),r+n[0].length):-1},A:function(t,e,r){f.lastIndex=0;var n=f.exec(e.slice(r));return n?(t.w=d.get(n[0].toLowerCase()),r+n[0].length):-1},b:function(t,e,r){y.lastIndex=0;var n=y.exec(e.slice(r));return n?(t.m=b.get(n[0].toLowerCase()),r+n[0].length):-1},B:function(t,e,r){g.lastIndex=0;var n=g.exec(e.slice(r));return n?(t.m=v.get(n[0].toLowerCase()),r+n[0].length):-1},c:function(t,e,n){return r(t,x.c.toString(),e,n)},d:Vt,e:Vt,H:qt,I:qt,j:Ht,L:Wt,m:Ut,M:Gt,p:function(t,e,r){var n=h.get(e.slice(r,r+=2).toLowerCase());return null==n?-1:(t.p=n,r)},S:Yt,U:Rt,w:Ot,W:Ft,x:function(t,e,n){return r(t,x.x.toString(),e,n)},X:function(t,e,n){return r(t,x.X.toString(),e,n)},y:Nt,Y:jt,Z:Bt,"%":Zt};return e}(t)}};var no=Zi.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"]});Zi.format=no.numberFormat,Zi.geo={},Kt.prototype={s:0,t:0,add:function(t){Qt(t,this.t,io),Qt(io.s,this.s,this),this.s?this.t+=io.t:this.s=io.t},reset:function(){this.s=this.t=0},valueOf:function(){return this.s}};var io=new Kt;Zi.geo.stream=function(t,e){t&&ao.hasOwnProperty(t.type)?ao[t.type](t,e):$t(t,e)};var ao={Feature:function(t,e){$t(t.geometry,e)},FeatureCollection:function(t,e){for(var r=t.features,n=-1,i=r.length;++n<i;)$t(r[n].geometry,e)}},oo={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){te(t.coordinates,e,0)},MultiLineString:function(t,e){for(var r=t.coordinates,n=-1,i=r.length;++n<i;)te(r[n],e,0)},Polygon:function(t,e){ee(t.coordinates,e)},MultiPolygon:function(t,e){for(var r=t.coordinates,n=-1,i=r.length;++n<i;)ee(r[n],e)},GeometryCollection:function(t,e){for(var r=t.geometries,n=-1,i=r.length;++n<i;)$t(r[n],e)}};Zi.geo.area=function(t){return so=0,Zi.geo.stream(t,co),so};var so,lo=new Kt,co={sphere:function(){so+=4*ka},point:x,lineStart:x,lineEnd:x,polygonStart:function(){lo.reset(),co.lineStart=re},polygonEnd:function(){var t=2*lo;so+=t<0?4*ka+t:t,co.lineStart=co.lineEnd=co.point=x}};Zi.geo.bounds=function(){function t(t,e){b.push(x=[u=t,f=t]),e<h&&(h=e),e>d&&(d=e)}function e(e,r){var n=ne([e*Ea,r*Ea]);if(v){var i=ae(v,n),a=ae([i[1],-i[0],0],i);le(a),a=ce(a);var o=e-p,l=o>0?1:-1,c=a[0]*La*l,m=aa(o)>180;if(m^(l*p<c&&c<l*e)){(g=a[1]*La)>d&&(d=g)}else if(c=(c+360)%360-180,m^(l*p<c&&c<l*e)){var g=-a[1]*La;g<h&&(h=g)}else r<h&&(h=r),r>d&&(d=r);m?e<p?s(u,e)>s(u,f)&&(f=e):s(e,f)>s(u,f)&&(u=e):f>=u?(e<u&&(u=e),e>f&&(f=e)):e>p?s(u,e)>s(u,f)&&(f=e):s(e,f)>s(u,f)&&(u=e)}else t(e,r);v=n,p=e}function r(){_.point=e}function n(){x[0]=u,x[1]=f,_.point=t,v=null}function i(t,r){if(v){var n=t-p;y+=aa(n)>180?n+(n>0?360:-360):n}else m=t,g=r;co.point(t,r),e(t,r)}function a(){co.lineStart()}function o(){i(m,g),co.lineEnd(),aa(y)>wa&&(u=-(f=180)),x[0]=u,x[1]=f,v=null}function s(t,e){return(e-=t)<0?e+360:e}function l(t,e){return t[0]-e[0]}function c(t,e){return e[0]<=e[1]?e[0]<=t&&t<=e[1]:t<e[0]||e[1]<t}var u,h,f,d,p,m,g,v,y,b,x,_={point:t,lineStart:r,lineEnd:n,polygonStart:function(){_.point=i,_.lineStart=a,_.lineEnd=o,y=0,co.polygonStart()},polygonEnd:function(){co.polygonEnd(),_.point=t,_.lineStart=r,_.lineEnd=n,lo<0?(u=-(f=180),h=-(d=90)):y>wa?d=90:y<-wa&&(h=-90),x[0]=u,x[1]=f}};return function(t){d=f=-(u=h=1/0),b=[],Zi.geo.stream(t,_);i=b.length;if(i){b.sort(l);for(var e=1,r=[p=b[0]];e<i;++e)c((a=b[e])[0],p)||c(a[1],p)?(s(p[0],a[1])>s(p[0],p[1])&&(p[1]=a[1]),s(a[0],p[1])>s(p[0],p[1])&&(p[0]=a[0])):r.push(p=a);for(var n,i,a,o=-1/0,e=0,p=r[i=r.length-1];e<=i;p=a,++e)a=r[e],(n=s(p[1],a[0]))>o&&(o=n,u=a[0],f=p[1])}return b=x=null,u===1/0||h===1/0?[[NaN,NaN],[NaN,NaN]]:[[u,h],[f,d]]}}(),Zi.geo.centroid=function(t){uo=ho=fo=po=mo=go=vo=yo=bo=xo=_o=0,Zi.geo.stream(t,wo);var e=bo,r=xo,n=_o,i=e*e+r*r+n*n;return i<Ma&&(e=go,r=vo,n=yo,ho<wa&&(e=fo,r=po,n=mo),(i=e*e+r*r+n*n)<Ma)?[NaN,NaN]:[Math.atan2(r,e)*La,Q(n/Math.sqrt(i))*La]};var uo,ho,fo,po,mo,go,vo,yo,bo,xo,_o,wo={sphere:x,point:he,lineStart:de,lineEnd:pe,polygonStart:function(){wo.lineStart=me},polygonEnd:function(){wo.lineStart=de}},Mo=_e(ve,function(t){var e,r=NaN,n=NaN,i=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(a,o){var s=a>0?ka:-ka,l=aa(a-r);aa(l-ka)<wa?(t.point(r,n=(n+o)/2>0?Sa:-Sa),t.point(i,n),t.lineEnd(),t.lineStart(),t.point(s,n),t.point(a,n),e=0):i!==s&&l>=ka&&(aa(r-i)<wa&&(r-=i*wa),aa(a-s)<wa&&(a-=s*wa),n=function(t,e,r,n){var i,a,o=Math.sin(t-r);return aa(o)>wa?Math.atan((Math.sin(e)*(a=Math.cos(n))*Math.sin(r)-Math.sin(n)*(i=Math.cos(e))*Math.sin(t))/(i*a*o)):(e+n)/2}(r,n,a,o),t.point(i,n),t.lineEnd(),t.lineStart(),t.point(s,n),e=0),t.point(r=a,n=o),i=s},lineEnd:function(){t.lineEnd(),r=n=NaN},clean:function(){return 2-e}}},function(t,e,r,n){var i;if(null==t)i=r*Sa,n.point(-ka,i),n.point(0,i),n.point(ka,i),n.point(ka,0),n.point(ka,-i),n.point(0,-i),n.point(-ka,-i),n.point(-ka,0),n.point(-ka,i);else if(aa(t[0]-e[0])>wa){var a=t[0]<e[0]?ka:-ka;i=r*a/2,n.point(-a,i),n.point(0,i),n.point(a,i)}else n.point(e[0],e[1])},[-ka,-ka/2]),ko=1e9;Zi.geo.clipExtent=function(){var t,e,r,n,i,a,o={stream:function(t){return i&&(i.valid=!1),i=a(t),i.valid=!0,i},extent:function(s){return arguments.length?(a=Ae(t=+s[0][0],e=+s[0][1],r=+s[1][0],n=+s[1][1]),i&&(i.valid=!1,i=null),o):[[t,e],[r,n]]}};return o.extent([[0,0],[960,500]])},(Zi.geo.conicEqualArea=function(){return Se(Ee)}).raw=Ee,Zi.geo.albers=function(){return Zi.geo.conicEqualArea().rotate([96,0]).center([-.6,38.7]).parallels([29.5,45.5]).scale(1070)},Zi.geo.albersUsa=function(){function t(t){var a=t[0],o=t[1];return e=null,r(a,o),e||(n(a,o),e)||i(a,o),e}var e,r,n,i,a=Zi.geo.albers(),o=Zi.geo.conicEqualArea().rotate([154,0]).center([-2,58.5]).parallels([55,65]),s=Zi.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=a.scale(),r=a.translate(),n=(t[0]-r[0])/e,i=(t[1]-r[1])/e;return(i>=.12&&i<.234&&n>=-.425&&n<-.214?o:i>=.166&&i<.234&&n>=-.214&&n<-.115?s:a).invert(t)},t.stream=function(t){var e=a.stream(t),r=o.stream(t),n=s.stream(t);return{point:function(t,i){e.point(t,i),r.point(t,i),n.point(t,i)},sphere:function(){e.sphere(),r.sphere(),n.sphere()},lineStart:function(){e.lineStart(),r.lineStart(),n.lineStart()},lineEnd:function(){e.lineEnd(),r.lineEnd(),n.lineEnd()},polygonStart:function(){e.polygonStart(),r.polygonStart(),n.polygonStart()},polygonEnd:function(){e.polygonEnd(),r.polygonEnd(),n.polygonEnd()}}},t.precision=function(e){return arguments.length?(a.precision(e),o.precision(e),s.precision(e),t):a.precision()},t.scale=function(e){return arguments.length?(a.scale(e),o.scale(.35*e),s.scale(e),t.translate(a.translate())):a.scale()},t.translate=function(e){if(!arguments.length)return a.translate();var c=a.scale(),u=+e[0],h=+e[1];return r=a.translate(e).clipExtent([[u-.455*c,h-.238*c],[u+.455*c,h+.238*c]]).stream(l).point,n=o.translate([u-.307*c,h+.201*c]).clipExtent([[u-.425*c+wa,h+.12*c+wa],[u-.214*c-wa,h+.234*c-wa]]).stream(l).point,i=s.translate([u-.205*c,h+.212*c]).clipExtent([[u-.214*c+wa,h+.166*c+wa],[u-.115*c-wa,h+.234*c-wa]]).stream(l).point,t},t.scale(1070)};var To,Ao,So,Eo,Lo,Co,Io={point:x,lineStart:x,lineEnd:x,polygonStart:function(){Ao=0,Io.lineStart=Le},polygonEnd:function(){Io.lineStart=Io.lineEnd=Io.point=x,To+=aa(Ao/2)}},zo={point:function(t,e){t<So&&(So=t),t>Lo&&(Lo=t),e<Eo&&(Eo=e),e>Co&&(Co=e)},lineStart:x,lineEnd:x,polygonStart:x,polygonEnd:x},Do={point:Ie,lineStart:ze,lineEnd:De,polygonStart:function(){Do.lineStart=Pe},polygonEnd:function(){Do.point=Ie,Do.lineStart=ze,Do.lineEnd=De}};Zi.geo.path=function(){function t(t){return t&&("function"==typeof s&&a.pointRadius(+s.apply(this,arguments)),o&&o.valid||(o=i(a)),Zi.geo.stream(t,o)),a.result()}function e(){return o=null,t}var r,n,i,a,o,s=4.5;return t.area=function(t){return To=0,Zi.geo.stream(t,i(Io)),To},t.centroid=function(t){return fo=po=mo=go=vo=yo=bo=xo=_o=0,Zi.geo.stream(t,i(Do)),_o?[bo/_o,xo/_o]:yo?[go/yo,vo/yo]:mo?[fo/mo,po/mo]:[NaN,NaN]},t.bounds=function(t){return Lo=Co=-(So=Eo=1/0),Zi.geo.stream(t,i(zo)),[[So,Eo],[Lo,Co]]},t.projection=function(t){return arguments.length?(i=(r=t)?t.stream||function(t){var e=Oe(function(e,r){return t([e*La,r*La])});return function(t){return Be(e(t))}}(t):y,e()):r},t.context=function(t){return arguments.length?(a=null==(n=t)?new function(){function t(t,e){o.push("M",t,",",e,a)}function e(t,e){o.push("M",t,",",e),s.point=r}function r(t,e){o.push("L",t,",",e)}function n(){s.point=t}function i(){o.push("Z")}var a=Ce(4.5),o=[],s={point:t,lineStart:function(){s.point=e},lineEnd:n,polygonStart:function(){s.lineEnd=i},polygonEnd:function(){s.lineEnd=n,s.point=t},pointRadius:function(t){return a=Ce(t),s},result:function(){if(o.length){var t=o.join("");return o=[],t}}};return s}:new function(t){function e(e,r){t.moveTo(e+o,r),t.arc(e,r,o,0,Ta)}function r(e,r){t.moveTo(e,r),s.point=n}function n(e,r){t.lineTo(e,r)}function i(){s.point=e}function a(){t.closePath()}var o=4.5,s={point:e,lineStart:function(){s.point=r},lineEnd:i,polygonStart:function(){s.lineEnd=a},polygonEnd:function(){s.lineEnd=i,s.point=e},pointRadius:function(t){return o=t,s},result:x};return s}(t),"function"!=typeof s&&a.pointRadius(s),e()):n},t.pointRadius=function(e){return arguments.length?(s="function"==typeof e?e:(a.pointRadius(+e),+e),t):s},t.projection(Zi.geo.albersUsa()).context(null)},Zi.geo.transform=function(t){return{stream:function(e){var r=new Re(e);for(var n in t)r[n]=t[n];return r}}},Re.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()}},Zi.geo.projection=je,Zi.geo.projectionMutator=Ne,(Zi.geo.equirectangular=function(){return je(Ue)}).raw=Ue.invert=Ue,Zi.geo.rotation=function(t){function e(e){return e=t(e[0]*Ea,e[1]*Ea),e[0]*=La,e[1]*=La,e}return t=He(t[0]%360*Ea,t[1]*Ea,t.length>2?t[2]*Ea:0),e.invert=function(e){return e=t.invert(e[0]*Ea,e[1]*Ea),e[0]*=La,e[1]*=La,e},e},Ve.invert=Ue,Zi.geo.circle=function(){function t(){var t="function"==typeof n?n.apply(this,arguments):n,e=He(-t[0]*Ea,-t[1]*Ea,0).invert,i=[];return r(null,null,1,{point:function(t,r){i.push(t=e(t,r)),t[0]*=La,t[1]*=La}}),{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=We((e=+n)*Ea,i*Ea),t):e},t.precision=function(n){return arguments.length?(r=We(e*Ea,(i=+n)*Ea),t):i},t.angle(90)},Zi.geo.distance=function(t,e){var r,n=(e[0]-t[0])*Ea,i=t[1]*Ea,a=e[1]*Ea,o=Math.sin(n),s=Math.cos(n),l=Math.sin(i),c=Math.cos(i),u=Math.sin(a),h=Math.cos(a);return Math.atan2(Math.sqrt((r=h*o)*r+(r=c*u-l*h*s)*r),l*u+c*h*s)},Zi.geo.graticule=function(){function t(){return{type:"MultiLineString",coordinates:e()}}function e(){return Zi.range(Math.ceil(a/g)*g,i,g).map(f).concat(Zi.range(Math.ceil(c/v)*v,l,v).map(d)).concat(Zi.range(Math.ceil(n/p)*p,r,p).filter(function(t){return aa(t%g)>wa}).map(u)).concat(Zi.range(Math.ceil(s/m)*m,o,m).filter(function(t){return aa(t%v)>wa}).map(h))}var r,n,i,a,o,s,l,c,u,h,f,d,p=10,m=p,g=90,v=360,y=2.5;return t.lines=function(){return e().map(function(t){return{type:"LineString",coordinates:t}})},t.outline=function(){return{type:"Polygon",coordinates:[f(a).concat(d(l).slice(1),f(i).reverse().slice(1),d(c).reverse().slice(1))]}},t.extent=function(e){return arguments.length?t.majorExtent(e).minorExtent(e):t.minorExtent()},t.majorExtent=function(e){return arguments.length?(a=+e[0][0],i=+e[1][0],c=+e[0][1],l=+e[1][1],a>i&&(e=a,a=i,i=e),c>l&&(e=c,c=l,l=e),t.precision(y)):[[a,c],[i,l]]},t.minorExtent=function(e){return arguments.length?(n=+e[0][0],r=+e[1][0],s=+e[0][1],o=+e[1][1],n>r&&(e=n,n=r,r=e),s>o&&(e=s,s=o,o=e),t.precision(y)):[[n,s],[r,o]]},t.step=function(e){return arguments.length?t.majorStep(e).minorStep(e):t.minorStep()},t.majorStep=function(e){return arguments.length?(g=+e[0],v=+e[1],t):[g,v]},t.minorStep=function(e){return arguments.length?(p=+e[0],m=+e[1],t):[p,m]},t.precision=function(e){return arguments.length?(y=+e,u=Ze(s,o,90),h=Je(n,r,y),f=Ze(c,l,90),d=Je(a,i,y),t):y},t.majorExtent([[-180,-90+wa],[180,90-wa]]).minorExtent([[-180,-80-wa],[180,80+wa]])},Zi.geo.greatArc=function(){function t(){return{type:"LineString",coordinates:[e||n.apply(this,arguments),r||i.apply(this,arguments)]}}var e,r,n=Ke,i=Qe;return t.distance=function(){return Zi.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},Zi.geo.interpolate=function(t,e){return function(t,e,r,n){var i=Math.cos(e),a=Math.sin(e),o=Math.cos(n),s=Math.sin(n),l=i*Math.cos(t),c=i*Math.sin(t),u=o*Math.cos(r),h=o*Math.sin(r),f=2*Math.asin(Math.sqrt(tt(n-e)+i*o*tt(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*u,i=r*c+e*h,o=r*a+e*s;return[Math.atan2(i,n)*La,Math.atan2(o,Math.sqrt(n*n+i*i))*La]}:function(){return[t*La,e*La]};return p.distance=f,p}(t[0]*Ea,t[1]*Ea,e[0]*Ea,e[1]*Ea)},Zi.geo.length=function(t){return Po=0,Zi.geo.stream(t,Oo),Po};var Po,Oo={sphere:x,point:x,lineStart:function(){function t(t,i){var a=Math.sin(i*=Ea),o=Math.cos(i),s=aa((t*=Ea)-e),l=Math.cos(s);Po+=Math.atan2(Math.sqrt((s=o*Math.sin(s))*s+(s=n*a-r*o*l)*s),r*a+n*o*l),e=t,r=a,n=o}var e,r,n;Oo.point=function(i,a){e=i*Ea,r=Math.sin(a*=Ea),n=Math.cos(a),Oo.point=t},Oo.lineEnd=function(){Oo.point=Oo.lineEnd=x}},lineEnd:x,polygonStart:x,polygonEnd:x},Ro=$e(function(t){return Math.sqrt(2/(1+t))},function(t){return 2*Math.asin(t/2)});(Zi.geo.azimuthalEqualArea=function(){return je(Ro)}).raw=Ro;var Fo=$e(function(t){var e=Math.acos(t);return e&&e/Math.sin(e)},y);(Zi.geo.azimuthalEquidistant=function(){return je(Fo)}).raw=Fo,(Zi.geo.conicConformal=function(){return Se(tr)}).raw=tr,(Zi.geo.conicEquidistant=function(){return Se(er)}).raw=er;var jo=$e(function(t){return 1/t},Math.atan);(Zi.geo.gnomonic=function(){return je(jo)}).raw=jo,rr.invert=function(t,e){return[t,2*Math.atan(Math.exp(e))-Sa]},(Zi.geo.mercator=function(){return nr(rr)}).raw=rr;var No=$e(function(){return 1},Math.asin);(Zi.geo.orthographic=function(){return je(No)}).raw=No;var Bo=$e(function(t){return 1/(1+t)},function(t){return 2*Math.atan(t)});(Zi.geo.stereographic=function(){return je(Bo)}).raw=Bo,ir.invert=function(t,e){return[-e,2*Math.atan(Math.exp(t))-Sa]},(Zi.geo.transverseMercator=function(){var t=nr(ir),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=ir,Zi.geom={},Zi.geom.hull=function(t){function e(t){if(t.length<3)return[];var e,i=_t(r),a=_t(n),o=t.length,s=[],l=[];for(e=0;e<o;e++)s.push([+i.call(this,t[e],e),+a.call(this,t[e],e),e]);for(s.sort(lr),e=0;e<o;e++)l.push([s[e][0],-s[e][1]]);var c=sr(s),u=sr(l),h=u[0]===c[0],f=u[u.length-1]===c[c.length-1],d=[];for(e=c.length-1;e>=0;--e)d.push(t[s[c[e]][2]]);for(e=+h;e<u.length-f;++e)d.push(t[s[u[e]][2]]);return d}var r=ar,n=or;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)},Zi.geom.polygon=function(t){return ua(t,Uo),t};var Uo=Zi.geom.polygon.prototype=[];Uo.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},Uo.centroid=function(t){var e,r,n=-1,i=this.length,a=0,o=0,s=this[i-1];for(arguments.length||(t=-1/(6*this.area()));++n<i;)e=s,s=this[n],r=e[0]*s[1]-s[0]*e[1],a+=(e[0]+s[0])*r,o+=(e[1]+s[1])*r;return[a*t,o*t]},Uo.clip=function(t){for(var e,r,n,i,a,o,s=hr(t),l=-1,c=this.length-hr(this),u=this[c-1];++l<c;){for(e=t.slice(),t.length=0,i=this[l],a=e[(n=e.length-s)-1],r=-1;++r<n;)cr(o=e[r],u,i)?(cr(a,u,i)||t.push(ur(a,o,u,i)),t.push(o)):cr(a,u,i)&&t.push(ur(a,o,u,i)),a=o;s&&t.push(t[0]),u=i}return t};var Vo,Ho,qo,Go,Yo,Wo=[],Xo=[];vr.prototype.prepare=function(){for(var t,e=this.edges,r=e.length;r--;)(t=e[r].edge).b&&t.a||e.splice(r,1);return e.sort(br),e.length},Tr.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}},Ar.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=Cr(this._),e.P=null,e.N=t,t.P=t.L=e,r=t):(e.P=e.N=null,this._=e,r=null);for(e.L=e.R=null,e.U=r,e.C=!0,t=e;r&&r.C;)r===(n=r.U).L?(i=n.R)&&i.C?(r.C=i.C=!1,n.C=!0,t=n):(t===r.R&&(Er(this,r),r=(t=r).U),r.C=!1,n.C=!0,Lr(this,n)):(i=n.L)&&i.C?(r.C=i.C=!1,n.C=!0,t=n):(t===r.L&&(Lr(this,r),r=(t=r).U),r.C=!1,n.C=!0,Er(this,n)),r=t.U;this._.C=!1},remove:function(t){t.N&&(t.N.P=t.P),t.P&&(t.P.N=t.N),t.N=t.P=null;var e,r,n,i=t.U,a=t.L,o=t.R;if(r=a?o?Cr(o):a:o,i?i.L===t?i.L=r:i.R=r:this._=r,a&&o?(n=r.C,r.C=t.C,r.L=a,a.U=r,r!==o?(i=r.U,r.U=t.U,t=r.R,i.L=t,r.R=o,o.U=r):(r.U=i,i=r,t=r.R)):(n=t.C,t=r),t&&(t.U=i),!n)if(t&&t.C)t.C=!1;else{do{if(t===this._)break;if(t===i.L){if((e=i.R).C&&(e.C=!1,i.C=!0,Er(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,Lr(this,e),e=i.R),e.C=i.C,i.C=e.R.C=!1,Er(this,i),t=this._;break}}else if((e=i.L).C&&(e.C=!1,i.C=!0,Lr(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,Er(this,e),e=i.L),e.C=i.C,i.C=e.L.C=!1,Lr(this,i),t=this._;break}e.C=!0,t=i,i=i.U}while(!t.C);t&&(t.C=!1)}}},Zi.geom.voronoi=function(t){function e(t){var e=new Array(t.length),n=s[0][0],i=s[0][1],a=s[1][0],o=s[1][1];return Ir(r(t),s).cells.forEach(function(r,s){var l=r.edges,c=r.site;(e[s]=l.length?l.map(function(t){var e=t.start();return[e.x,e.y]}):c.x>=n&&c.x<=a&&c.y>=i&&c.y<=o?[[n,o],[a,o],[a,i],[n,i]]:[]).point=t[s]}),e}function r(t){return t.map(function(t,e){return{x:Math.round(a(t,e)/wa)*wa,y:Math.round(o(t,e)/wa)*wa,i:e}})}var n=ar,i=or,a=n,o=i,s=Zo;return t?e(t):(e.links=function(t){return Ir(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 Ir(r(t)).cells.forEach(function(r,n){for(var i,a=r.site,o=r.edges.sort(br),s=-1,l=o.length,c=o[l-1].edge,u=c.l===a?c.r:c.l;++s<l;)c,i=u,u=(c=o[s].edge).l===a?c.r:c.l,n<i.i&&n<u.i&&function(t,e,r){return(t.x-r.x)*(e.y-t.y)-(t.x-e.x)*(r.y-t.y)}(a,i,u)<0&&e.push([t[n],t[i.i],t[u.i]])}),e},e.x=function(t){return arguments.length?(a=_t(n=t),e):n},e.y=function(t){return arguments.length?(o=_t(i=t),e):i},e.clipExtent=function(t){return arguments.length?(s=null==t?Zo:t,e):s===Zo?null:s},e.size=function(t){return arguments.length?e.clipExtent(t&&[[0,0],t]):s===Zo?null:s&&s[1]},e)};var Zo=[[-1e6,-1e6],[1e6,1e6]];Zi.geom.delaunay=function(t){return Zi.geom.voronoi().triangles(t)},Zi.geom.quadtree=function(t,e,r,n,i){function a(t){function a(t,e,r,n,i,a,o,s){if(!isNaN(r)&&!isNaN(n))if(t.leaf){var l=t.x,u=t.y;if(null!=l)if(aa(l-r)+aa(u-n)<.01)c(t,e,r,n,i,a,o,s);else{var h=t.point;t.x=t.y=t.point=null,c(t,h,l,u,i,a,o,s),c(t,e,r,n,i,a,o,s)}else t.x=r,t.y=n,t.point=e}else c(t,e,r,n,i,a,o,s)}function c(t,e,r,n,i,o,s,l){var c=.5*(i+s),u=.5*(o+l),h=r>=c,f=n>=u,d=f<<1|h;t.leaf=!1,t=t.nodes[d]||(t.nodes[d]={leaf:!0,nodes:[],point:null,x:null,y:null}),h?i=c:s=c,f?o=u:l=u,a(t,e,r,n,i,o,s,l)}var u,h,f,d,p,m,g,v,y,b=_t(s),x=_t(l);if(null!=e)m=e,g=r,v=n,y=i;else if(v=y=-(m=g=1/0),h=[],f=[],p=t.length,o)for(d=0;d<p;++d)(u=t[d]).x<m&&(m=u.x),u.y<g&&(g=u.y),u.x>v&&(v=u.x),u.y>y&&(y=u.y),h.push(u.x),f.push(u.y);else for(d=0;d<p;++d){var _=+b(u=t[d],d),w=+x(u,d);_<m&&(m=_),w<g&&(g=w),_>v&&(v=_),w>y&&(y=w),h.push(_),f.push(w)}var M=v-m,k=y-g;M>k?y=g+M:v=m+k;var T={leaf:!0,nodes:[],point:null,x:null,y:null};if(T.add=function(t){a(T,t,+b(t,++d),+x(t,d),m,g,v,y)},T.visit=function(t){Or(t,T,m,g,v,y)},T.find=function(t){return function(t,e,r,n,i,a,o){var s,l=1/0;return function t(c,u,h,f,d){if(!(u>a||h>o||f<n||d<i)){if(p=c.point){var p,m=e-c.x,g=r-c.y,v=m*m+g*g;if(v<l){var y=Math.sqrt(l=v);n=e-y,i=r-y,a=e+y,o=r+y,s=p}}for(var b=c.nodes,x=.5*(u+f),_=.5*(h+d),w=(r>=_)<<1|e>=x,M=w+4;w<M;++w)if(c=b[3&w])switch(3&w){case 0:t(c,u,h,x,_);break;case 1:t(c,x,h,f,_);break;case 2:t(c,u,_,x,d);break;case 3:t(c,x,_,f,d)}}}(t,n,i,a,o),s}(T,t[0],t[1],m,g,v,y)},d=-1,null==e){for(;++d<p;)a(T,t[d],h[d],f[d],m,g,v,y);--d}else t.forEach(T.add);return h=f=t=u=null,T}var o,s=ar,l=or;return(o=arguments.length)?(s=Dr,l=Pr,3===o&&(i=r,n=e,r=e=0),a(t)):(a.x=function(t){return arguments.length?(s=t,a):s},a.y=function(t){return arguments.length?(l=t,a):l},a.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]),a):null==e?null:[[e,r],[n,i]]},a.size=function(t){return arguments.length?(null==t?e=r=n=i=null:(e=r=0,n=+t[0],i=+t[1]),a):null==e?null:[n-e,i-r]},a)},Zi.interpolateRgb=Rr,Zi.interpolateObject=Fr,Zi.interpolateNumber=jr,Zi.interpolateString=Nr;var Jo=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Ko=new RegExp(Jo.source,"g");Zi.interpolate=Br,Zi.interpolators=[function(t,e){var r=typeof e;return("string"===r?Va.has(e.toLowerCase())||/^(#|rgb\(|hsl\()/i.test(e)?Rr:Nr:e instanceof et?Rr:Array.isArray(e)?Ur:"object"===r&&isNaN(e)?Fr:jr)(t,e)}],Zi.interpolateArray=Ur;var Qo=function(){return y},$o=Zi.map({linear:Qo,poly:function(t){return function(e){return Math.pow(e,t)}},quad:function(){return qr},cubic:function(){return Gr},sin:function(){return Yr},exp:function(){return Wr},circle:function(){return Xr},elastic:function(t,e){var r;return arguments.length<2&&(e=.45),arguments.length?r=e/Ta*Math.asin(1/t):(t=1,r=e/4),function(n){return 1+t*Math.pow(2,-10*n)*Math.sin((n-r)*Ta/e)}},back:function(t){return t||(t=1.70158),function(e){return e*e*((t+1)*e-t)}},bounce:function(){return Zr}}),ts=Zi.map({in:y,out:Vr,"in-out":Hr,"out-in":function(t){return Hr(Vr(t))}});Zi.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=$o.get(r)||Qo,n=ts.get(n)||y,function(t){return function(e){return e<=0?0:e>=1?1:t(e)}}(n(r.apply(null,Ji.call(arguments,1))))},Zi.interpolateHcl=function(t,e){t=Zi.hcl(t),e=Zi.hcl(e);var r=t.h,n=t.c,i=t.l,a=e.h-r,o=e.c-n,s=e.l-i;return isNaN(o)&&(o=0,n=isNaN(n)?e.c:n),isNaN(a)?(a=0,r=isNaN(r)?e.h:r):a>180?a-=360:a<-180&&(a+=360),function(t){return at(r+a*t,n+o*t,i+s*t)+""}},Zi.interpolateHsl=function(t,e){t=Zi.hsl(t),e=Zi.hsl(e);var r=t.h,n=t.s,i=t.l,a=e.h-r,o=e.s-n,s=e.l-i;return isNaN(o)&&(o=0,n=isNaN(n)?e.s:n),isNaN(a)?(a=0,r=isNaN(r)?e.h:r):a>180?a-=360:a<-180&&(a+=360),function(t){return nt(r+a*t,n+o*t,i+s*t)+""}},Zi.interpolateLab=function(t,e){t=Zi.lab(t),e=Zi.lab(e);var r=t.l,n=t.a,i=t.b,a=e.l-r,o=e.a-n,s=e.b-i;return function(t){return st(r+a*t,n+o*t,i+s*t)+""}},Zi.interpolateRound=Jr,Zi.transform=function(t){var e=Qi.createElementNS(Zi.ns.prefix.svg,"g");return(Zi.transform=function(t){if(null!=t){e.setAttribute("transform",t);var r=e.transform.baseVal.consolidate()}return new Kr(r?r.matrix:es)})(t)},Kr.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var es={a:1,b:0,c:0,d:1,e:0,f:0};Zi.interpolateTransform=en,Zi.layout={},Zi.layout.bundle=function(){return function(t){for(var e=[],r=-1,n=t.length;++r<n;)e.push(rn(t[r]));return e}},Zi.layout.chord=function(){function t(){var t,c,h,f,d,p={},m=[],g=Zi.range(a),v=[];for(r=[],n=[],t=0,f=-1;++f<a;){for(c=0,d=-1;++d<a;)c+=i[f][d];m.push(c),v.push(Zi.range(a)),t+=c}for(o&&g.sort(function(t,e){return o(m[t],m[e])}),s&&v.forEach(function(t,e){t.sort(function(t,r){return s(i[e][t],i[e][r])})}),t=(Ta-u*a)/t,c=0,f=-1;++f<a;){for(h=c,d=-1;++d<a;){var y=g[f],b=v[y][d],x=i[y][b],_=c,w=c+=x*t;p[y+"-"+b]={index:y,subindex:b,startAngle:_,endAngle:w,value:x}}n[y]={index:y,startAngle:h,endAngle:c,value:m[y]},c+=u}for(f=-1;++f<a;)for(d=f-1;++d<a;){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,a,o,s,l,c={},u=0;return c.matrix=function(t){return arguments.length?(a=(i=t)&&i.length,r=n=null,c):i},c.padding=function(t){return arguments.length?(u=t,r=n=null,c):u},c.sortGroups=function(t){return arguments.length?(o=t,r=n=null,c):o},c.sortSubgroups=function(t){return arguments.length?(s=t,r=null,c):s},c.sortChords=function(t){return arguments.length?(l=t,r&&e(),c):l},c.chords=function(){return r||t(),r},c.groups=function(){return n||t(),n},c},Zi.layout.force=function(){function t(t){return function(e,r,n,i){if(e.point!==t){var a=e.cx-t.x,o=e.cy-t.y,s=i-r,l=a*a+o*o;if(s*s/v<l){if(l<m){c=e.charge/l;t.px-=a*c,t.py-=o*c}return!0}if(e.point&&l&&l<m){var c=e.pointCharge/l;t.px-=a*c,t.py-=o*c}}return!e.charge}}function e(t){t.px=Zi.event.x,t.py=Zi.event.y,l.resume()}var r,n,i,a,o,s,l={},c=Zi.dispatch("start","tick","end"),u=[1,1],h=.9,f=rs,d=ns,p=-30,m=is,g=.1,v=.64,b=[],x=[];return l.tick=function(){if((i*=.99)<.005)return r=null,c.end({type:"end",alpha:i=0}),!0;var e,n,l,f,d,m,v,y,_,w=b.length,M=x.length;for(n=0;n<M;++n)f=(l=x[n]).source,(m=(y=(d=l.target).x-f.x)*y+(_=d.y-f.y)*_)&&(y*=m=i*o[n]*((m=Math.sqrt(m))-a[n])/m,_*=m,d.x-=y*(v=f.weight+d.weight?f.weight/(f.weight+d.weight):.5),d.y-=_*v,f.x+=y*(v=1-v),f.y+=_*v);if((v=i*g)&&(y=u[0]/2,_=u[1]/2,n=-1,v))for(;++n<w;)(l=b[n]).x+=(y-l.x)*v,l.y+=(_-l.y)*v;if(p)for(cn(e=Zi.geom.quadtree(b),i,s),n=-1;++n<w;)(l=b[n]).fixed||e.visit(t(l));for(n=-1;++n<w;)(l=b[n]).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);c.tick({type:"tick",alpha:i})},l.nodes=function(t){return arguments.length?(b=t,l):b},l.links=function(t){return arguments.length?(x=t,l):x},l.size=function(t){return arguments.length?(u=t,l):u},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?(m=t*t,l):Math.sqrt(m)},l.gravity=function(t){return arguments.length?(g=+t,l):g},l.theta=function(t){return arguments.length?(v=t*t,l):Math.sqrt(v)},l.alpha=function(t){return arguments.length?(t=+t,i?t>0?i=t:(r.c=null,r.t=NaN,r=null,c.end({type:"end",alpha:i=0})):t>0&&(c.start({type:"start",alpha:i=t}),r=kt(l.tick)),l):i},l.start=function(){function t(t,n){if(!r){for(r=new Array(i),l=0;l<i;++l)r[l]=[];for(l=0;l<c;++l){var a=x[l];r[a.source.index].push(a.target),r[a.target.index].push(a.source)}}for(var o,s=r[e],l=-1,u=s.length;++l<u;)if(!isNaN(o=s[l][t]))return o;return Math.random()*n}var e,r,n,i=b.length,c=x.length,h=u[0],m=u[1];for(e=0;e<i;++e)(n=b[e]).index=e,n.weight=0;for(e=0;e<c;++e)"number"==typeof(n=x[e]).source&&(n.source=b[n.source]),"number"==typeof n.target&&(n.target=b[n.target]),++n.source.weight,++n.target.weight;for(e=0;e<i;++e)n=b[e],isNaN(n.x)&&(n.x=t("x",h)),isNaN(n.y)&&(n.y=t("y",m)),isNaN(n.px)&&(n.px=n.x),isNaN(n.py)&&(n.py=n.y);if(a=[],"function"==typeof f)for(e=0;e<c;++e)a[e]=+f.call(this,x[e],e);else for(e=0;e<c;++e)a[e]=f;if(o=[],"function"==typeof d)for(e=0;e<c;++e)o[e]=+d.call(this,x[e],e);else for(e=0;e<c;++e)o[e]=d;if(s=[],"function"==typeof p)for(e=0;e<i;++e)s[e]=+p.call(this,b[e],e);else for(e=0;e<i;++e)s[e]=p;return l.resume()},l.resume=function(){return l.alpha(.1)},l.stop=function(){return l.alpha(0)},l.drag=function(){if(n||(n=Zi.behavior.drag().origin(y).on("dragstart.force",an).on("drag.force",e).on("dragend.force",on)),!arguments.length)return n;this.on("mouseover.force",sn).on("mouseout.force",ln).call(n)},Zi.rebind(l,c,"on")};var rs=20,ns=1,is=1/0;Zi.layout.hierarchy=function(){function t(i){var a,o=[i],s=[];for(i.depth=0;null!=(a=o.pop());)if(s.push(a),(c=r.call(t,a,a.depth))&&(l=c.length)){for(var l,c,u;--l>=0;)o.push(u=c[l]),u.parent=a,u.depth=a.depth+1;n&&(a.value=0),a.children=c}else n&&(a.value=+n.call(t,a,a.depth)||0),delete a.children;return fn(i,function(t){var r,i;e&&(r=t.children)&&r.sort(e),n&&(i=t.parent)&&(i.value+=t.value)}),s}var e=mn,r=dn,n=pn;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&&(hn(e,function(t){t.children&&(t.value=0)}),fn(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},Zi.layout.partition=function(){function t(e,r,n,i){var a=e.children;if(e.x=r,e.y=e.depth*i,e.dx=n,e.dy=i,a&&(o=a.length)){var o,s,l,c=-1;for(n=e.value?n/e.value:0;++c<o;)t(s=a[c],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,a=-1;++a<i;)n=Math.max(n,e(r[a]));return 1+n}function r(r,a){var o=n.call(this,r,a);return t(o[0],0,i[0],i[1]/e(o[0])),o}var n=Zi.layout.hierarchy(),i=[1,1];return r.size=function(t){return arguments.length?(i=t,r):i},un(r,n)},Zi.layout.pie=function(){function t(o){var s,l=o.length,c=o.map(function(r,n){return+e.call(t,r,n)}),u=+("function"==typeof n?n.apply(this,arguments):n),h=("function"==typeof i?i.apply(this,arguments):i)-u,f=Math.min(Math.abs(h)/l,+("function"==typeof a?a.apply(this,arguments):a)),d=f*(h<0?-1:1),p=Zi.sum(c),m=p?(h-l*d)/p:0,g=Zi.range(l),v=[];return null!=r&&g.sort(r===as?function(t,e){return c[e]-c[t]}:function(t,e){return r(o[t],o[e])}),g.forEach(function(t){v[t]={data:o[t],value:s=c[t],startAngle:u,endAngle:u+=s*m+d,padAngle:f}}),v}var e=Number,r=as,n=0,i=Ta,a=0;return t.value=function(r){return arguments.length?(e=r,t):e},t.sort=function(e){return arguments.length?(r=e,t):r},t.startAngle=function(e){return arguments.length?(n=e,t):n},t.endAngle=function(e){return arguments.length?(i=e,t):i},t.padAngle=function(e){return arguments.length?(a=e,t):a},t};var as={};Zi.layout.stack=function(){function t(s,l){if(!(f=s.length))return s;var c=s.map(function(r,n){return e.call(t,r,n)}),u=c.map(function(e){return e.map(function(e,r){return[a.call(t,e,r),o.call(t,e,r)]})}),h=r.call(t,u,l);c=Zi.permute(c,h),u=Zi.permute(u,h);var f,d,p,m,g=n.call(t,u,l),v=c[0].length;for(p=0;p<v;++p)for(i.call(t,c[0][p],m=g[p],u[0][p][1]),d=1;d<f;++d)i.call(t,c[d][p],m+=u[d-1][p][1],u[d][p][1]);return s}var e=y,r=xn,n=_n,i=bn,a=vn,o=yn;return t.values=function(r){return arguments.length?(e=r,t):e},t.order=function(e){return arguments.length?(r="function"==typeof e?e:os.get(e)||xn,t):r},t.offset=function(e){return arguments.length?(n="function"==typeof e?e:ss.get(e)||_n,t):n},t.x=function(e){return arguments.length?(a=e,t):a},t.y=function(e){return arguments.length?(o=e,t):o},t.out=function(e){return arguments.length?(i=e,t):i},t};var os=Zi.map({"inside-out":function(t){var e,r,n=t.length,i=t.map(wn),a=t.map(Mn),o=Zi.range(n).sort(function(t,e){return i[t]-i[e]}),s=0,l=0,c=[],u=[];for(e=0;e<n;++e)r=o[e],s<l?(s+=a[r],c.push(r)):(l+=a[r],u.push(r));return u.reverse().concat(c)},reverse:function(t){return Zi.range(t.length).reverse()},default:xn}),ss=Zi.map({silhouette:function(t){var e,r,n,i=t.length,a=t[0].length,o=[],s=0,l=[];for(r=0;r<a;++r){for(e=0,n=0;e<i;e++)n+=t[e][r][1];n>s&&(s=n),o.push(n)}for(r=0;r<a;++r)l[r]=(s-o[r])/2;return l},wiggle:function(t){var e,r,n,i,a,o,s,l,c,u=t.length,h=t[0],f=h.length,d=[];for(d[0]=l=c=0,r=1;r<f;++r){for(e=0,i=0;e<u;++e)i+=t[e][r][1];for(e=0,a=0,s=h[r][0]-h[r-1][0];e<u;++e){for(n=0,o=(t[e][r][1]-t[e][r-1][1])/(2*s);n<e;++n)o+=(t[n][r][1]-t[n][r-1][1])/s;a+=o*t[e][r][1]}d[r]=l-=i?a/i*s:0,l<c&&(c=l)}for(r=0;r<f;++r)d[r]-=c;return d},expand:function(t){var e,r,n,i=t.length,a=t[0].length,o=1/i,s=[];for(r=0;r<a;++r){for(e=0,n=0;e<i;e++)n+=t[e][r][1];if(n)for(e=0;e<i;e++)t[e][r][1]/=n;else for(e=0;e<i;e++)t[e][r][1]=o}for(r=0;r<a;++r)s[r]=0;return s},zero:_n});Zi.layout.histogram=function(){function t(t,a){for(var o,s,l=[],c=t.map(r,this),u=n.call(this,c,a),h=i.call(this,u,c,a),a=-1,f=c.length,d=h.length-1,p=e?1:1/f;++a<d;)(o=l[a]=[]).dx=h[a+1]-(o.x=h[a]),o.y=0;if(d>0)for(a=-1;++a<f;)(s=c[a])>=u[0]&&s<=u[1]&&((o=l[Zi.bisect(h,s,1,d)-1]).y+=p,o.push(t[a]));return l}var e=!0,r=Number,n=Sn,i=Tn;return t.value=function(e){return arguments.length?(r=e,t):r},t.range=function(e){return arguments.length?(n=_t(e),t):n},t.bins=function(e){return arguments.length?(i="number"==typeof e?function(t){return An(t,e)}:_t(e),t):i},t.frequency=function(r){return arguments.length?(e=!!r,t):e},t},Zi.layout.pack=function(){function t(t,a){var o=r.call(this,t,a),s=o[0],l=i[0],c=i[1],u=null==e?Math.sqrt:"function"==typeof e?e:function(){return e};if(s.x=s.y=0,fn(s,function(t){t.r=+u(t.value)}),fn(s,zn),n){var h=n*(e?1:Math.max(2*s.r/l,2*s.r/c))/2;fn(s,function(t){t.r+=h}),fn(s,zn),fn(s,function(t){t.r-=h})}return On(s,l/2,c/2,e?1:1/Math.max(2*s.r/l,2*s.r/c)),o}var e,r=Zi.layout.hierarchy().sort(En),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},un(t,r)},Zi.layout.tree=function(){function t(t,l){var c=i.call(this,t,l),u=c[0],h=function(t){var e,r={A:null,children:[t]},n=[r];for(;null!=(e=n.pop());)for(var i,a=e.children,o=0,s=a.length;o<s;++o)n.push((a[o]=i={_:a[o],parent:e,children:(i=a[o].children)&&i.slice()||[],A:null,a:null,z:0,m:0,c:0,s:0,t:null,i:o}).a=i);return r.children[0]}(u);if(fn(h,e),h.parent.m=-h.z,hn(h,r),s)hn(u,n);else{var f=u,d=u,p=u;hn(u,function(t){t.x<f.x&&(f=t),t.x>d.x&&(d=t),t.depth>p.depth&&(p=t)});var m=a(f,d)/2-f.x,g=o[0]/(d.x+a(d,f)/2+m),v=o[1]/(p.depth||1);hn(u,function(t){t.x=(t.x+m)*g,t.y=t.depth*v})}return c}function e(t){var e=t.children,r=t.parent.children,n=t.i?r[t.i-1]:null;if(e.length){!function(t){for(var e,r=0,n=0,i=t.children,a=i.length;--a>=0;)(e=i[a]).z+=r,e.m+=r,r+=e.s+(n+=e.c)}(t);var i=(e[0].z+e[e.length-1].z)/2;n?(t.z=n.z+a(t._,n._),t.m=t.z-i):t.z=i}else n&&(t.z=n.z+a(t._,n._));t.parent.A=function(t,e,r){if(e){for(var n,i=t,o=t,s=e,l=i.parent.children[0],c=i.m,u=o.m,h=s.m,f=l.m;s=Nn(s),i=jn(i),s&&i;)l=jn(l),(o=Nn(o)).a=t,(n=s.z+h-i.z-c+a(s._,i._))>0&&(!function(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(t,e,r){return t.a.parent===e.parent?t.a:r}(s,t,r),t,n),c+=n,u+=n),h+=s.m,c+=i.m,f+=l.m,u+=o.m;s&&!Nn(o)&&(o.t=s,o.m+=h-u),i&&!jn(l)&&(l.t=i,l.m+=c-f,r=t)}return r}(t,n,t.parent.A||r[0])}function r(t){t._.x=t.z+t.parent.m,t.m+=t.parent.m}function n(t){t.x*=o[0],t.y=t.depth*o[1]}var i=Zi.layout.hierarchy().sort(null).value(null),a=Fn,o=[1,1],s=null;return t.separation=function(e){return arguments.length?(a=e,t):a},t.size=function(e){return arguments.length?(s=null==(o=e)?n:null,t):s?null:o},t.nodeSize=function(e){return arguments.length?(s=null==(o=e)?null:n,t):s?o:null},un(t,i)},Zi.layout.cluster=function(){function t(t,a){var o,s=e.call(this,t,a),l=s[0],c=0;fn(l,function(t){var e=t.children;e&&e.length?(t.x=function(t){return t.reduce(function(t,e){return t+e.x},0)/t.length}(e),t.y=function(t){return 1+Zi.max(t,function(t){return t.y})}(e)):(t.x=o?c+=r(t,o):0,t.y=0,o=t)});var u=Bn(l),h=Un(l),f=u.x-r(u,h)/2,d=h.x+r(h,u)/2;return fn(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=Zi.layout.hierarchy().sort(null).value(null),r=Fn,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},un(t,e)},Zi.layout.treemap=function(){function t(t,e){for(var r,n,i=-1,a=t.length;++i<a;)n=(r=t[i]).value*(e<0?0:e),r.area=isNaN(n)||n<=0?0:n}function e(r){var i=r.children;if(i&&i.length){var a,o,s,l=u(r),c=[],h=i.slice(),p=1/0,m="slice"===f?l.dx:"dice"===f?l.dy:"slice-dice"===f?1&r.depth?l.dy:l.dx:Math.min(l.dx,l.dy);for(t(h,l.dx*l.dy/r.value),c.area=0;(s=h.length)>0;)c.push(a=h[s-1]),c.area+=a.area,"squarify"!==f||(o=function(t,e){var r,n=t.area,i=0,a=1/0,o=-1,s=t.length;for(;++o<s;)(r=t[o].area)&&(r<a&&(a=r),r>i&&(i=r));return n*=n,e*=e,n?Math.max(e*i*d/n,n/(e*a*d)):1/0}(c,m))<=p?(h.pop(),p=o):(c.area-=c.pop().area,n(c,m,l,!1),m=Math.min(l.dx,l.dy),c.length=c.area=0,p=1/0);c.length&&(n(c,m,l,!0),c.length=c.area=0),i.forEach(e)}}function r(e){var i=e.children;if(i&&i.length){var a,o=u(e),s=i.slice(),l=[];for(t(s,o.dx*o.dy/e.value),l.area=0;a=s.pop();)l.push(a),l.area+=a.area,null!=a.z&&(n(l,a.z?o.dx:o.dy,o,!s.length),l.length=l.area=0);i.forEach(r)}}function n(t,e,r,n){var i,a=-1,o=t.length,l=r.x,c=r.y,u=e?s(t.area/e):0;if(e==r.dx){for((n||u>r.dy)&&(u=r.dy);++a<o;)(i=t[a]).x=l,i.y=c,i.dy=u,l+=i.dx=Math.min(r.x+r.dx-l,u?s(i.area/u):0);i.z=!0,i.dx+=r.x+r.dx-l,r.y+=u,r.dy-=u}else{for((n||u>r.dx)&&(u=r.dx);++a<o;)(i=t[a]).x=l,i.y=c,i.dx=u,c+=i.dy=Math.min(r.y+r.dy-c,u?s(i.area/u):0);i.z=!1,i.dy+=r.y+r.dy-c,r.x+=u,r.dx-=u}}function i(n){var i=a||o(n),s=i[0];return s.x=s.y=0,s.value?(s.dx=l[0],s.dy=l[1]):s.dx=s.dy=0,a&&o.revalue(s),t([s],s.dx*s.dy/s.value),(a?r:e)(s),h&&(a=i),i}var a,o=Zi.layout.hierarchy(),s=Math.round,l=[1,1],c=null,u=Vn,h=!1,f="squarify",d=.5*(1+Math.sqrt(5));return i.size=function(t){return arguments.length?(l=t,i):l},i.padding=function(t){function e(e){return Hn(e,t)}if(!arguments.length)return c;var r;return u=null==(c=t)?Vn:"function"==(r=typeof t)?function(e){var r=t.call(i,e,e.depth);return null==r?Vn(e):Hn(e,"number"==typeof r?[r,r,r,r]:r)}:"number"===r?(t=[t,t,t,t],e):e,i},i.round=function(t){return arguments.length?(s=t?Math.round:Number,i):s!=Number},i.sticky=function(t){return arguments.length?(h=t,a=null,i):h},i.ratio=function(t){return arguments.length?(d=t,i):d},i.mode=function(t){return arguments.length?(f=t+"",i):f},un(i,o)},Zi.random={normal:function(t,e){var r=arguments.length;return r<2&&(e=1),r<1&&(t=0),function(){var r,n,i;do{i=(r=2*Math.random()-1)*r+(n=2*Math.random()-1)*n}while(!i||i>1);return t+e*r*Math.sqrt(-2*Math.log(i)/i)}},logNormal:function(){var t=Zi.random.normal.apply(Zi,arguments);return function(){return Math.exp(t())}},bates:function(t){var e=Zi.random.irwinHall(t);return function(){return e()/t}},irwinHall:function(t){return function(){for(var e=0,r=0;r<t;r++)e+=Math.random();return e}}},Zi.scale={};var ls={floor:y,ceil:y};Zi.scale.linear=function(){return Xn([0,1],[0,1],Br,!1)};var cs={s:1,g:1,p:1,r:1,e:1};Zi.scale.log=function(){return ei(Zi.scale.linear().domain([0,1]),10,!0,[1,10])};var us=Zi.format(".0e"),hs={floor:function(t){return-Math.ceil(-t)},ceil:function(t){return-Math.floor(-t)}};Zi.scale.pow=function(){return ri(Zi.scale.linear(),1,[0,1])},Zi.scale.sqrt=function(){return Zi.scale.pow().exponent(.5)},Zi.scale.ordinal=function(){return ii([],{t:"range",a:[[]]})},Zi.scale.category10=function(){return Zi.scale.ordinal().range(fs)},Zi.scale.category20=function(){return Zi.scale.ordinal().range(ds)},Zi.scale.category20b=function(){return Zi.scale.ordinal().range(ps)},Zi.scale.category20c=function(){return Zi.scale.ordinal().range(ms)};var fs=[2062260,16744206,2924588,14034728,9725885,9197131,14907330,8355711,12369186,1556175].map(pt),ds=[2062260,11454440,16744206,16759672,2924588,10018698,14034728,16750742,9725885,12955861,9197131,12885140,14907330,16234194,8355711,13092807,12369186,14408589,1556175,10410725].map(pt),ps=[3750777,5395619,7040719,10264286,6519097,9216594,11915115,13556636,9202993,12426809,15186514,15190932,8666169,11356490,14049643,15177372,8077683,10834324,13528509,14589654].map(pt),ms=[3244733,7057110,10406625,13032431,15095053,16616764,16625259,16634018,3253076,7652470,10607003,13101504,7695281,10394312,12369372,14342891,6513507,9868950,12434877,14277081].map(pt);Zi.scale.quantile=function(){return ai([],[])},Zi.scale.quantize=function(){return oi(0,1,[0,1])},Zi.scale.threshold=function(){return si([.5],[0,1])},Zi.scale.identity=function(){return li([0,1])},Zi.svg={},Zi.svg.arc=function(){function t(){var t=Math.max(0,+r.apply(this,arguments)),c=Math.max(0,+n.apply(this,arguments)),u=o.apply(this,arguments)-Sa,h=s.apply(this,arguments)-Sa,f=Math.abs(h-u),d=u>h?0:1;if(c<t&&(p=c,c=t,t=p),f>=Aa)return e(c,d)+(t?e(t,1-d):"")+"Z";var p,m,g,v,y,b,x,_,w,M,k,T,A=0,S=0,E=[];if((v=(+l.apply(this,arguments)||0)/2)&&(g=a===gs?Math.sqrt(t*t+c*c):+a.apply(this,arguments),d||(S*=-1),c&&(S=Q(g/c*Math.sin(v))),t&&(A=Q(g/t*Math.sin(v)))),c){y=c*Math.cos(u+S),b=c*Math.sin(u+S),x=c*Math.cos(h-S),_=c*Math.sin(h-S);var L=Math.abs(h-u-2*S)<=ka?0:1;if(S&&mi(y,b,x,_)===d^L){var C=(u+h)/2;y=c*Math.cos(C),b=c*Math.sin(C),x=_=null}}else y=b=0;if(t){w=t*Math.cos(h-A),M=t*Math.sin(h-A),k=t*Math.cos(u+A),T=t*Math.sin(u+A);var I=Math.abs(u-h+2*A)<=ka?0:1;if(A&&mi(w,M,k,T)===1-d^I){var z=(u+h)/2;w=t*Math.cos(z),M=t*Math.sin(z),k=T=null}}else w=M=0;if(f>wa&&(p=Math.min(Math.abs(c-t)/2,+i.apply(this,arguments)))>.001){m=t<c^d?0:1;var D=p,P=p;if(f<ka){var O=null==k?[w,M]:null==x?[y,b]:ur([y,b],[k,T],[x,_],[w,M]),R=y-O[0],F=b-O[1],j=x-O[0],N=_-O[1],B=1/Math.sin(Math.acos((R*j+F*N)/(Math.sqrt(R*R+F*F)*Math.sqrt(j*j+N*N)))/2),U=Math.sqrt(O[0]*O[0]+O[1]*O[1]);P=Math.min(p,(t-U)/(B-1)),D=Math.min(p,(c-U)/(B+1))}if(null!=x){var V=gi(null==k?[w,M]:[k,T],[y,b],c,D,d),H=gi([x,_],[w,M],c,D,d);p===D?E.push("M",V[0],"A",D,",",D," 0 0,",m," ",V[1],"A",c,",",c," 0 ",1-d^mi(V[1][0],V[1][1],H[1][0],H[1][1]),",",d," ",H[1],"A",D,",",D," 0 0,",m," ",H[0]):E.push("M",V[0],"A",D,",",D," 0 1,",m," ",H[0])}else E.push("M",y,",",b);if(null!=k){var q=gi([y,b],[k,T],t,-P,d),G=gi([w,M],null==x?[y,b]:[x,_],t,-P,d);p===P?E.push("L",G[0],"A",P,",",P," 0 0,",m," ",G[1],"A",t,",",t," 0 ",d^mi(G[1][0],G[1][1],q[1][0],q[1][1]),",",1-d," ",q[1],"A",P,",",P," 0 0,",m," ",q[0]):E.push("L",G[0],"A",P,",",P," 0 0,",m," ",q[0])}else E.push("L",w,",",M)}else E.push("M",y,",",b),null!=x&&E.push("A",c,",",c," 0 ",L,",",d," ",x,",",_),E.push("L",w,",",M),null!=k&&E.push("A",t,",",t," 0 ",I,",",1-d," ",k,",",T);return E.push("Z"),E.join("")}function e(t,e){return"M0,"+t+"A"+t+","+t+" 0 1,"+e+" 0,"+-t+"A"+t+","+t+" 0 1,"+e+" 0,"+t}var r=ui,n=hi,i=ci,a=gs,o=fi,s=di,l=pi;return t.innerRadius=function(e){return arguments.length?(r=_t(e),t):r},t.outerRadius=function(e){return arguments.length?(n=_t(e),t):n},t.cornerRadius=function(e){return arguments.length?(i=_t(e),t):i},t.padRadius=function(e){return arguments.length?(a=e==gs?gs:_t(e),t):a},t.startAngle=function(e){return arguments.length?(o=_t(e),t):o},t.endAngle=function(e){return arguments.length?(s=_t(e),t):s},t.padAngle=function(e){return arguments.length?(l=_t(e),t):l},t.centroid=function(){var t=(+r.apply(this,arguments)+ +n.apply(this,arguments))/2,e=(+o.apply(this,arguments)+ +s.apply(this,arguments))/2-Sa;return[Math.cos(e)*t,Math.sin(e)*t]},t};var gs="auto";Zi.svg.line=function(){return vi(y)};var vs=Zi.map({linear:yi,"linear-closed":bi,step:function(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("")},"step-before":xi,"step-after":_i,basis:ki,"basis-open":function(t){if(t.length<4)return yi(t);for(var e,r=[],n=-1,i=t.length,a=[0],o=[0];++n<3;)e=t[n],a.push(e[0]),o.push(e[1]);for(r.push(Ti(xs,a)+","+Ti(xs,o)),--n;++n<i;)e=t[n],a.shift(),a.push(e[0]),o.shift(),o.push(e[1]),Ai(r,a,o);return r.join("")},"basis-closed":function(t){for(var e,r,n=-1,i=t.length,a=i+4,o=[],s=[];++n<4;)r=t[n%i],o.push(r[0]),s.push(r[1]);for(e=[Ti(xs,o),",",Ti(xs,s)],--n;++n<a;)r=t[n%i],o.shift(),o.push(r[0]),s.shift(),s.push(r[1]),Ai(e,o,s);return e.join("")},bundle:function(t,e){var r=t.length-1;if(r)for(var n,i,a=t[0][0],o=t[0][1],s=t[r][0]-a,l=t[r][1]-o,c=-1;++c<=r;)i=c/r,(n=t[c])[0]=e*n[0]+(1-e)*(a+i*s),n[1]=e*n[1]+(1-e)*(o+i*l);return ki(t)},cardinal:function(t,e){return t.length<3?yi(t):t[0]+wi(t,Mi(t,e))},"cardinal-open":function(t,e){return t.length<4?yi(t):t[1]+wi(t.slice(1,-1),Mi(t,e))},"cardinal-closed":function(t,e){return t.length<3?bi(t):t[0]+wi((t.push(t[0]),t),Mi([t[t.length-2]].concat(t,[t[1]]),e))},monotone:function(t){return t.length<3?yi(t):t[0]+wi(t,Ei(t))}});vs.forEach(function(t,e){e.key=t,e.closed=/-closed$/.test(t)});var ys=[0,2/3,1/3,0],bs=[0,1/3,2/3,0],xs=[0,1/6,2/3,1/6];Zi.svg.line.radial=function(){var t=vi(Li);return t.radius=t.x,delete t.x,t.angle=t.y,delete t.y,t},xi.reverse=_i,_i.reverse=xi,Zi.svg.area=function(){return Ci(y)},Zi.svg.area.radial=function(){var t=Ci(Li);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},Zi.svg.chord=function(){function t(t,o){var s=e(this,i,t,o),l=e(this,a,t,o);return"M"+s.p0+r(s.r,s.p1,s.a1-s.a0)+(function(t,e){return t.a0==e.a0&&t.a1==e.a1}(s,l)?n(s.r,s.p1,s.r,s.p0):n(s.r,s.p1,l.r,l.p0)+r(l.r,l.p1,l.a1-l.a0)+n(l.r,l.p1,s.r,s.p0))+"Z"}function e(t,e,r,n){var i=e.call(t,r,n),a=o.call(t,i,n),c=s.call(t,i,n)-Sa,u=l.call(t,i,n)-Sa;return{r:a,a0:c,a1:u,p0:[a*Math.cos(c),a*Math.sin(c)],p1:[a*Math.cos(u),a*Math.sin(u)]}}function r(t,e,r){return"A"+t+","+t+" 0 "+ +(r>ka)+",1 "+e}function n(t,e,r,n){return"Q 0,0 "+n}var i=Ke,a=Qe,o=Ii,s=fi,l=di;return t.radius=function(e){return arguments.length?(o=_t(e),t):o},t.source=function(e){return arguments.length?(i=_t(e),t):i},t.target=function(e){return arguments.length?(a=_t(e),t):a},t.startAngle=function(e){return arguments.length?(s=_t(e),t):s},t.endAngle=function(e){return arguments.length?(l=_t(e),t):l},t},Zi.svg.diagonal=function(){function t(t,i){var a=e.call(this,t,i),o=r.call(this,t,i),s=(a.y+o.y)/2,l=[a,{x:a.x,y:s},{x:o.x,y:s},o];return"M"+(l=l.map(n))[0]+"C"+l[1]+" "+l[2]+" "+l[3]}var e=Ke,r=Qe,n=zi;return t.source=function(r){return arguments.length?(e=_t(r),t):e},t.target=function(e){return arguments.length?(r=_t(e),t):r},t.projection=function(e){return arguments.length?(n=e,t):n},t},Zi.svg.diagonal.radial=function(){var t=Zi.svg.diagonal(),e=zi,r=t.projection;return t.projection=function(t){return arguments.length?r(function(t){return function(){var e=t.apply(this,arguments),r=e[0],n=e[1]-Sa;return[r*Math.cos(n),r*Math.sin(n)]}}(e=t)):e},t},Zi.svg.symbol=function(){function t(t,n){return(_s.get(e.call(this,t,n))||Oi)(r.call(this,t,n))}var e=Pi,r=Di;return t.type=function(r){return arguments.length?(e=_t(r),t):e},t.size=function(e){return arguments.length?(r=_t(e),t):r},t};var _s=Zi.map({circle:Oi,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*Ms)),r=e*Ms;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/ws),r=e*ws/2;return"M0,"+r+"L"+e+","+-r+" "+-e+","+-r+"Z"},"triangle-up":function(t){var e=Math.sqrt(t/ws),r=e*ws/2;return"M0,"+-r+"L"+e+","+r+" "+-e+","+r+"Z"}});Zi.svg.symbolTypes=_s.keys();var ws=Math.sqrt(3),Ms=Math.tan(30*Ea);pa.transition=function(t){for(var e,r,n=ks||++Es,i=Bi(t),a=[],o=Ts||{time:Date.now(),ease:function(t){if(t<=0)return 0;if(t>=1)return 1;var e=t*t,r=e*t;return 4*(t<.5?r:3*(t-e)+r-.75)},delay:0,duration:250},s=-1,l=this.length;++s<l;){a.push(e=[]);for(var c=this[s],u=-1,h=c.length;++u<h;)(r=c[u])&&Ui(r,u,i,n,o),e.push(r)}return Fi(a,i,n)},pa.interrupt=function(t){return this.each(null==t?As:Ri(Bi(t)))};var ks,Ts,As=Ri(Bi()),Ss=[],Es=0;Ss.call=pa.call,Ss.empty=pa.empty,Ss.node=pa.node,Ss.size=pa.size,Zi.transition=function(t,e){return t&&t.transition?ks?t.transition(e):t:Zi.selection().transition(t)},Zi.transition.prototype=Ss,Ss.select=function(t){var e,r,n,i=this.id,a=this.namespace,o=[];t=S(t);for(var s=-1,l=this.length;++s<l;){o.push(e=[]);for(var c=this[s],u=-1,h=c.length;++u<h;)(n=c[u])&&(r=t.call(n,n.__data__,u,s))?("__data__"in n&&(r.__data__=n.__data__),Ui(r,u,a,i,n[a][i]),e.push(r)):e.push(null)}return Fi(o,a,i)},Ss.selectAll=function(t){var e,r,n,i,a,o=this.id,s=this.namespace,l=[];t=E(t);for(var c=-1,u=this.length;++c<u;)for(var h=this[c],f=-1,d=h.length;++f<d;)if(n=h[f]){a=n[s][o],r=t.call(n,n.__data__,f,c),l.push(e=[]);for(var p=-1,m=r.length;++p<m;)(i=r[p])&&Ui(i,p,s,o,a),e.push(i)}return Fi(l,s,o)},Ss.filter=function(t){var e,r,n=[];"function"!=typeof t&&(t=B(t));for(var i=0,a=this.length;i<a;i++){n.push(e=[]);for(var o,s=0,l=(o=this[i]).length;s<l;s++)(r=o[s])&&t.call(r,r.__data__,s,i)&&e.push(r)}return Fi(n,this.namespace,this.id)},Ss.tween=function(t,e){var r=this.id,n=this.namespace;return arguments.length<2?this.node()[n][r].tween.get(t):U(this,null==e?function(e){e[n][r].tween.remove(t)}:function(i){i[n][r].tween.set(t,e)})},Ss.attr=function(t,e){if(arguments.length<2){for(e in t)this.attr(e,t[e]);return this}var r="transform"==t?en:Br,n=Zi.ns.qualify(t);return ji(this,"attr."+t,e,n.local?function(t){return null==t?function(){this.removeAttributeNS(n.space,n.local)}:(t+="",function(){var e,i=this.getAttributeNS(n.space,n.local);return i!==t&&(e=r(i,t),function(t){this.setAttributeNS(n.space,n.local,e(t))})})}:function(t){return null==t?function(){this.removeAttribute(n)}:(t+="",function(){var e,i=this.getAttribute(n);return i!==t&&(e=r(i,t),function(t){this.setAttribute(n,e(t))})})})},Ss.attrTween=function(t,e){var r=Zi.ns.qualify(t);return this.tween("attr."+t,r.local?function(t,n){var i=e.call(this,t,n,this.getAttributeNS(r.space,r.local));return i&&function(t){this.setAttributeNS(r.space,r.local,i(t))}}:function(t,n){var i=e.call(this,t,n,this.getAttribute(r));return i&&function(t){this.setAttribute(r,i(t))}})},Ss.style=function(t,e,n){var i=arguments.length;if(i<3){if("string"!=typeof t){i<2&&(e="");for(n in t)this.style(n,t[n],e);return this}n=""}return ji(this,"style."+t,e,function(e){return null==e?function(){this.style.removeProperty(t)}:(e+="",function(){var i,a=r(this).getComputedStyle(this,null).getPropertyValue(t);return a!==e&&(i=Br(a,e),function(e){this.style.setProperty(t,i(e),n)})})})},Ss.styleTween=function(t,e,n){return arguments.length<3&&(n=""),this.tween("style."+t,function(i,a){var o=e.call(this,i,a,r(this).getComputedStyle(this,null).getPropertyValue(t));return o&&function(e){this.style.setProperty(t,o(e),n)}})},Ss.text=function(t){return ji(this,"text",t,Ni)},Ss.remove=function(){var t=this.namespace;return this.each("end.transition",function(){var e;this[t].count<2&&(e=this.parentNode)&&e.removeChild(this)})},Ss.ease=function(t){var e=this.id,r=this.namespace;return arguments.length<1?this.node()[r][e].ease:("function"!=typeof t&&(t=Zi.ease.apply(Zi,arguments)),U(this,function(n){n[r][e].ease=t}))},Ss.delay=function(t){var e=this.id,r=this.namespace;return arguments.length<1?this.node()[r][e].delay:U(this,"function"==typeof t?function(n,i,a){n[r][e].delay=+t.call(n,n.__data__,i,a)}:(t=+t,function(n){n[r][e].delay=t}))},Ss.duration=function(t){var e=this.id,r=this.namespace;return arguments.length<1?this.node()[r][e].duration:U(this,"function"==typeof t?function(n,i,a){n[r][e].duration=Math.max(1,t.call(n,n.__data__,i,a))}:(t=Math.max(1,t),function(n){n[r][e].duration=t}))},Ss.each=function(t,e){var r=this.id,n=this.namespace;if(arguments.length<2){var i=Ts,a=ks;try{ks=r,U(this,function(e,i,a){Ts=e[n][r],t.call(e,e.__data__,i,a)})}finally{Ts=i,ks=a}}else U(this,function(i){var a=i[n][r];(a.event||(a.event=Zi.dispatch("start","end","interrupt"))).on(t,e)});return this},Ss.transition=function(){for(var t,e,r,n=this.id,i=++Es,a=this.namespace,o=[],s=0,l=this.length;s<l;s++){o.push(t=[]);for(var c,u=0,h=(c=this[s]).length;u<h;u++)(e=c[u])&&Ui(e,u,a,i,{time:(r=e[a][n]).time,ease:r.ease,delay:r.delay+r.duration,duration:r.duration}),t.push(e)}return Fi(o,a,i)},Zi.svg.axis=function(){function t(t){t.each(function(){var t,c=Zi.select(this),u=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):y:e,p=c.selectAll(".tick").data(f,h),m=p.enter().insert("g",".domain").attr("class","tick").style("opacity",wa),g=Zi.transition(p.exit()).style("opacity",wa).remove(),v=Zi.transition(p.order()).style("opacity",1),b=Math.max(i,0)+o,x=Gn(h),_=c.selectAll(".domain").data([0]),w=(_.enter().append("path").attr("class","domain"),Zi.transition(_));m.append("line"),m.append("text");var M,k,T,A,S=m.select("line"),E=v.select("line"),L=p.select("text").text(d),C=m.select("text"),I=v.select("text"),z="top"===n||"left"===n?-1:1;if("bottom"===n||"top"===n?(t=Vi,M="x",T="y",k="x2",A="y2",L.attr("dy",z<0?"0em":".71em").style("text-anchor","middle"),w.attr("d","M"+x[0]+","+z*a+"V0H"+x[1]+"V"+z*a)):(t=Hi,M="y",T="x",k="y2",A="x2",L.attr("dy",".32em").style("text-anchor",z<0?"end":"start"),w.attr("d","M"+z*a+","+x[0]+"H0V"+x[1]+"H"+z*a)),S.attr(A,z*i),C.attr(T,z*b),E.attr(k,0).attr(A,z*i),I.attr(M,0).attr(T,z*b),h.rangeBand){var D=h,P=D.rangeBand()/2;u=h=function(t){return D(t)+P}}else u.rangeBand?u=h:g.call(t,h,u);m.call(t,u,h),v.call(t,h,h)})}var e,r=Zi.scale.linear(),n=Ls,i=6,a=6,o=3,s=[10],l=null;return t.scale=function(e){return arguments.length?(r=e,t):r},t.orient=function(e){return arguments.length?(n=e in Cs?e+"":Ls,t):n},t.ticks=function(){return arguments.length?(s=Ki(arguments),t):s},t.tickValues=function(e){return arguments.length?(l=e,t):l},t.tickFormat=function(r){return arguments.length?(e=r,t):e},t.tickSize=function(e){var r=arguments.length;return r?(i=+e,a=+arguments[r-1],t):i},t.innerTickSize=function(e){return arguments.length?(i=+e,t):i},t.outerTickSize=function(e){return arguments.length?(a=+e,t):a},t.tickPadding=function(e){return arguments.length?(o=+e,t):o},t.tickSubdivide=function(){return arguments.length&&t},t};var Ls="bottom",Cs={top:1,right:1,bottom:1,left:1};Zi.svg.brush=function(){function t(r){r.each(function(){var r=Zi.select(this).style("pointer-events","all").style("-webkit-tap-highlight-color","rgba(0,0,0,0)").on("mousedown.brush",a).on("touchstart.brush",a),o=r.selectAll(".background").data([0]);o.enter().append("rect").attr("class","background").style("visibility","hidden").style("cursor","crosshair"),r.selectAll(".extent").data([0]).enter().append("rect").attr("class","extent").style("cursor","move");var s=r.selectAll(".resize").data(m,y);s.exit().remove(),s.enter().append("g").attr("class",function(t){return"resize "+t}).style("cursor",function(t){return Is[t]}).append("rect").attr("x",function(t){return/[ew]$/.test(t)?-3:null}).attr("y",function(t){return/^[ns]/.test(t)?-3:null}).attr("width",6).attr("height",6).style("visibility","hidden"),s.style("display",t.empty()?"none":null);var l,h=Zi.transition(r),f=Zi.transition(o);c&&(l=Gn(c),f.attr("x",l[0]).attr("width",l[1]-l[0]),n(h)),u&&(l=Gn(u),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 n(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 a(){function a(){var t=Zi.mouse(b),r=!1;y&&(t[0]+=y[0],t[1]+=y[1]),S||(Zi.event.altKey?(v||(v=[(h[0]+h[1])/2,(f[0]+f[1])/2]),L[0]=h[+(t[0]<v[0])],L[1]=f[+(t[1]<v[1])]):v=null),T&&m(t,c,0)&&(n(w),r=!0),A&&m(t,u,1)&&(i(w),r=!0),r&&(e(w),_({type:"brush",mode:S?"move":"resize"}))}function m(t,e,r){var n,i,a=Gn(e),l=a[0],c=a[1],u=L[r],m=r?f:h,g=m[1]-m[0];if(S&&(l-=u,c-=g+u),n=(r?p:d)?Math.max(l,Math.min(c,t[r])):t[r],S?i=(n+=u)+g:(v&&(u=Math.max(l,Math.min(c,2*v[r]-n))),u<n?(i=n,n=u):i=u),m[0]!=n||m[1]!=i)return r?s=null:o=null,m[0]=n,m[1]=i,!0}function g(){a(),w.style("pointer-events","all").selectAll(".resize").style("display",t.empty()?"none":null),Zi.select("body").style("cursor",null),C.on("mousemove.brush",null).on("mouseup.brush",null).on("touchmove.brush",null).on("touchend.brush",null).on("keydown.brush",null).on("keyup.brush",null),E(),_({type:"brushend"})}var v,y,b=this,x=Zi.select(Zi.event.target),_=l.of(b,arguments),w=Zi.select(b),k=x.datum(),T=!/^(n|s)$/.test(k)&&c,A=!/^(e|w)$/.test(k)&&u,S=x.classed("extent"),E=Y(b),L=Zi.mouse(b),C=Zi.select(r(b)).on("keydown.brush",function(){32==Zi.event.keyCode&&(S||(v=null,L[0]-=h[1],L[1]-=f[1],S=2),M())}).on("keyup.brush",function(){32==Zi.event.keyCode&&2==S&&(L[0]+=h[1],L[1]+=f[1],S=0,M())});if(Zi.event.changedTouches?C.on("touchmove.brush",a).on("touchend.brush",g):C.on("mousemove.brush",a).on("mouseup.brush",g),w.interrupt().selectAll("*").interrupt(),S)L[0]=h[0]-L[0],L[1]=f[0]-L[1];else if(k){var I=+/w$/.test(k),z=+/^n/.test(k);y=[h[1-I]-L[0],f[1-z]-L[1]],L[0]=h[I],L[1]=f[z]}else Zi.event.altKey&&(v=L.slice());w.style("pointer-events","none").selectAll(".resize").style("display",null),Zi.select("body").style("cursor",x.style("cursor")),_({type:"brushstart"}),a()}var o,s,l=T(t,"brushstart","brush","brushend"),c=null,u=null,h=[0,0],f=[0,0],d=!0,p=!0,m=zs[0];return t.event=function(t){t.each(function(){var t=l.of(this,arguments),e={x:h,y:f,i:o,j:s},r=this.__chart__||e;this.__chart__=e,ks?Zi.select(this).transition().each("start.brush",function(){o=r.i,s=r.j,h=r.x,f=r.y,t({type:"brushstart"})}).tween("brush:brush",function(){var r=Ur(h,e.x),n=Ur(f,e.y);return o=s=null,function(i){h=e.x=r(i),f=e.y=n(i),t({type:"brush",mode:"resize"})}}).each("end.brush",function(){o=e.i,s=e.j,t({type:"brush",mode:"resize"}),t({type:"brushend"})}):(t({type:"brushstart"}),t({type:"brush",mode:"resize"}),t({type:"brushend"}))})},t.x=function(e){return arguments.length?(c=e,m=zs[!c<<1|!u],t):c},t.y=function(e){return arguments.length?(u=e,m=zs[!c<<1|!u],t):u},t.clamp=function(e){return arguments.length?(c&&u?(d=!!e[0],p=!!e[1]):c?d=!!e:u&&(p=!!e),t):c&&u?[d,p]:c?d:u?p:null},t.extent=function(e){var r,n,i,a,l;return arguments.length?(c&&(r=e[0],n=e[1],u&&(r=r[0],n=n[0]),o=[r,n],c.invert&&(r=c(r),n=c(n)),n<r&&(l=r,r=n,n=l),r==h[0]&&n==h[1]||(h=[r,n])),u&&(i=e[0],a=e[1],c&&(i=i[1],a=a[1]),s=[i,a],u.invert&&(i=u(i),a=u(a)),a<i&&(l=i,i=a,a=l),i==f[0]&&a==f[1]||(f=[i,a])),t):(c&&(o?(r=o[0],n=o[1]):(r=h[0],n=h[1],c.invert&&(r=c.invert(r),n=c.invert(n)),n<r&&(l=r,r=n,n=l))),u&&(s?(i=s[0],a=s[1]):(i=f[0],a=f[1],u.invert&&(i=u.invert(i),a=u.invert(a)),a<i&&(l=i,i=a,a=l))),c&&u?[[r,i],[n,a]]:c?[r,n]:u&&[i,a])},t.clear=function(){return t.empty()||(h=[0,0],f=[0,0],o=s=null),t},t.empty=function(){return!!c&&h[0]==h[1]||!!u&&f[0]==f[1]},Zi.rebind(t,l,"on")};var Is={n:"ns-resize",e:"ew-resize",s:"ns-resize",w:"ew-resize",nw:"nwse-resize",ne:"nesw-resize",se:"nwse-resize",sw:"nesw-resize"},zs=[["n","e","s","w","nw","ne","se","sw"],["e","w"],["n","s"],[]],Ds=Ka.format=no.timeFormat,Ps=Ds.utc,Os=Ps("%Y-%m-%dT%H:%M:%S.%LZ");Ds.iso=Date.prototype.toISOString&&+new Date("2000-01-01T00:00:00.000Z")?qi:Os,qi.parse=function(t){var e=new Date(t);return isNaN(e)?null:e},qi.toString=Os.toString,Ka.second=Ct(function(t){return new Qa(1e3*Math.floor(t/1e3))},function(t,e){t.setTime(t.getTime()+1e3*Math.floor(e))},function(t){return t.getSeconds()}),Ka.seconds=Ka.second.range,Ka.seconds.utc=Ka.second.utc.range,Ka.minute=Ct(function(t){return new Qa(6e4*Math.floor(t/6e4))},function(t,e){t.setTime(t.getTime()+6e4*Math.floor(e))},function(t){return t.getMinutes()}),Ka.minutes=Ka.minute.range,Ka.minutes.utc=Ka.minute.utc.range,Ka.hour=Ct(function(t){var e=t.getTimezoneOffset()/60;return new Qa(36e5*(Math.floor(t/36e5-e)+e))},function(t,e){t.setTime(t.getTime()+36e5*Math.floor(e))},function(t){return t.getHours()}),Ka.hours=Ka.hour.range,Ka.hours.utc=Ka.hour.utc.range,Ka.month=Ct(function(t){return(t=Ka.day(t)).setDate(1),t},function(t,e){t.setMonth(t.getMonth()+e)},function(t){return t.getMonth()}),Ka.months=Ka.month.range,Ka.months.utc=Ka.month.utc.range;var Rs=[1e3,5e3,15e3,3e4,6e4,3e5,9e5,18e5,36e5,108e5,216e5,432e5,864e5,1728e5,6048e5,2592e6,7776e6,31536e6],Fs=[[Ka.second,1],[Ka.second,5],[Ka.second,15],[Ka.second,30],[Ka.minute,1],[Ka.minute,5],[Ka.minute,15],[Ka.minute,30],[Ka.hour,1],[Ka.hour,3],[Ka.hour,6],[Ka.hour,12],[Ka.day,1],[Ka.day,2],[Ka.week,1],[Ka.month,1],[Ka.month,3],[Ka.year,1]],js=Ds.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",ve]]),Ns={range:function(t,e,r){return Zi.range(Math.ceil(t/r)*r,+e,r).map(Yi)},floor:y,ceil:y};Fs.year=Ka.year,Ka.scale=function(){return Gi(Zi.scale.linear(),Fs,js)};var Bs=Fs.map(function(t){return[t[0].utc,t[1]]}),Us=Ps.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",ve]]);Bs.year=Ka.year.utc,Ka.scale.utc=function(){return Gi(Zi.scale.linear(),Bs,Us)},Zi.text=wt(function(t){return t.responseText}),Zi.json=function(t,e){return Mt(t,"application/json",Wi,e)},Zi.html=function(t,e){return Mt(t,"text/html",Xi,e)},Zi.xml=wt(function(t){return t.responseXML}),"object"==typeof e&&e.exports?e.exports=Zi:this.d3=Zi}()},{}],126:[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,a=0;a<i;++a){var o=n[a]-r[a];if(o)return o}return 0}var a=t("incremental-convex-hull"),o=t("uniq");e.exports=function(t,e){var r=t.length;if(0===r)return[];var s=t[0].length;if(s<1)return[];if(1===s)return function(t,e,r){if(1===t)return r?[[-1,0]]:[];var n=e.map(function(t,e){return[t[0],e]});n.sort(function(t,e){return t[0]-e[0]});for(var i=new Array(t-1),a=1;a<t;++a){var o=n[a-1],s=n[a];i[a-1]=[o[1],s[1]]}return r&&i.push([-1,i[0][1]],[i[t-1][1],-1]),i}(r,t,e);for(var l=new Array(r),c=1,u=0;u<r;++u){for(var h=t[u],f=new Array(s+1),d=0,p=0;p<s;++p){var m=h[p];f[p]=m,d+=m*m}f[s]=d,l[u]=new n(f,u),c=Math.max(d,c)}o(l,i),r=l.length;for(var g=new Array(r+s+1),v=new Array(r+s+1),y=(s+1)*(s+1)*c,b=new Array(s+1),u=0;u<=s;++u)b[u]=0;for(b[s]=y,g[0]=b.slice(),v[0]=-1,u=0;u<=s;++u)(f=b.slice())[u]=1,g[u+1]=f,v[u+1]=-1;for(u=0;u<r;++u)_=l[u],g[u+s+1]=_.point,v[u+s+1]=_.index;var x=a(g,!1);if(x=e?x.filter(function(t){for(var e=0,r=0;r<=s;++r){var n=v[t[r]];if(n<0&&++e>=2)return!1;t[r]=n}return!0}):x.filter(function(t){for(var e=0;e<=s;++e){var r=v[t[e]];if(r<0)return!1;t[e]=r}return!0}),1&s)for(u=0;u<x.length;++u){var _,f=(_=x[u])[0];_[0]=_[1],_[1]=f}return x}},{"incremental-convex-hull":293,uniq:554}],127:[function(t,e,r){(function(t){var r=!1;if("undefined"!=typeof Float64Array){var n=new Float64Array(1),i=new Uint32Array(n.buffer);if(n[0]=1,r=!0,1072693248===i[1]){e.exports=function(t){return n[0]=t,[i[0],i[1]]};function a(t,e){return i[0]=t,i[1]=e,n[0]}e.exports.pack=a;function o(t){return n[0]=t,i[0]}e.exports.lo=o;function s(t){return n[0]=t,i[1]}e.exports.hi=s}else if(1072693248===i[0]){e.exports=function(t){return n[0]=t,[i[1],i[0]]};function l(t,e){return i[1]=t,i[0]=e,n[0]}e.exports.pack=l;function c(t){return n[0]=t,i[1]}e.exports.lo=c;function u(t){return n[0]=t,i[0]}e.exports.hi=u}else r=!1}if(!r){var h=new t(8);e.exports=function(t){return h.writeDoubleLE(t,0,!0),[h.readUInt32LE(0,!0),h.readUInt32LE(4,!0)]};function f(t,e){return h.writeUInt32LE(t,0,!0),h.writeUInt32LE(e,4,!0),h.readDoubleLE(0,!0)}e.exports.pack=f;function d(t){return h.writeDoubleLE(t,0,!0),h.readUInt32LE(0,!0)}e.exports.lo=d;function p(t){return h.writeDoubleLE(t,0,!0),h.readUInt32LE(4,!0)}e.exports.hi=p}e.exports.sign=function(t){return e.exports.hi(t)>>>31},e.exports.exponent=function(t){return(e.exports.hi(t)<<1>>>21)-1023},e.exports.fraction=function(t){var r=e.exports.lo(t),n=e.exports.hi(t),i=1048575&n;return 2146435072&n&&(i+=1<<20),[r,i]},e.exports.denormalized=function(t){return!(2146435072&e.exports.hi(t))}}).call(this,t("buffer").Buffer)},{buffer:80}],128:[function(t,e,r){"use strict";function n(t,e,r){var i=0|t[r];if(i<=0)return[];var a,o=new Array(i);if(r===t.length-1)for(a=0;a<i;++a)o[a]=e;else for(a=0;a<i;++a)o[a]=n(t,e,r+1);return o}e.exports=function(t,e){switch(void 0===e&&(e=0),typeof t){case"number":if(t>0)return function(t,e){var r,n;for(r=new Array(t),n=0;n<t;++n)r[n]=e;return r}(0|t,e);break;case"object":if("number"==typeof t.length)return n(t,e,0)}return[]}},{}],129:[function(t,e,r){"use strict";function n(t,e,r){r=r||2;var n=e&&e.length,l=n?e[0]*r:t.length,u=i(t,0,l,r,!0),h=[];if(!u)return h;var f,m,g,v,y,b,x;if(n&&(u=function(t,e,r,n){var o,l,u,h,f,m=[];for(o=0,l=e.length;o<l;o++)u=e[o]*n,h=o<l-1?e[o+1]*n:t.length,(f=i(t,u,h,n,!1))===f.next&&(f.steiner=!0),m.push(function(t){var e=t,r=t;do{e.x<r.x&&(r=e),e=e.next}while(e!==t);return r}(f));for(m.sort(s),o=0;o<m.length;o++)!function(t,e){if(e=function(t,e){var r,n=e,i=t.x,a=t.y,o=-1/0;do{if(a<=n.y&&a>=n.next.y){var s=n.x+(a-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(s<=i&&s>o){if(o=s,s===i){if(a===n.y)return n;if(a===n.next.y)return n.next}r=n.x<n.next.x?n:n.next}}n=n.next}while(n!==e);if(!r)return null;if(i===o)return r.prev;var l,u=r,h=r.x,f=r.y,p=1/0;for(n=r.next;n!==u;)i>=n.x&&n.x>=h&&c(a<f?i:o,a,h,f,a<f?o:i,a,n.x,n.y)&&((l=Math.abs(a-n.y)/(i-n.x))<p||l===p&&n.x>r.x)&&d(n,t)&&(r=n,p=l),n=n.next;return r}(t,e)){var r=p(e,t);a(r,r.next)}}(m[o],r),r=a(r,r.next);return r}(t,e,u,r)),t.length>80*r){f=g=t[0],m=v=t[1];for(var _=r;_<l;_+=r)y=t[_],b=t[_+1],y<f&&(f=y),b<m&&(m=b),y>g&&(g=y),b>v&&(v=b);x=Math.max(g-f,v-m)}return o(u,h,r,f,m,x),h}function i(t,e,r,n,i){var a,o;if(i===y(t,e,r,n)>0)for(a=e;a<r;a+=n)o=m(a,t[a],t[a+1],o);else for(a=r-n;a>=e;a-=n)o=m(a,t[a],t[a+1],o);return o&&h(o,o.next)&&(g(o),o=o.next),o}function a(t,e){if(!t)return t;e||(e=t);var r,n=t;do{if(r=!1,n.steiner||!h(n,n.next)&&0!==u(n.prev,n,n.next))n=n.next;else{if(g(n),(n=e=n.prev)===n.next)return null;r=!0}}while(r||n!==e);return e}function o(t,e,r,n,i,s,m){if(t){!m&&s&&function(t,e,r,n){var i=t;do{null===i.z&&(i.z=l(i.x,i.y,e,r,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,function(t){var e,r,n,i,a,o,s,l,c=1;do{for(r=t,t=null,a=null,o=0;r;){for(o++,n=r,s=0,e=0;e<c&&(s++,n=n.nextZ);e++);for(l=c;s>0||l>0&&n;)0===s?(i=n,n=n.nextZ,l--):0!==l&&n?r.z<=n.z?(i=r,r=r.nextZ,s--):(i=n,n=n.nextZ,l--):(i=r,r=r.nextZ,s--),a?a.nextZ=i:t=i,i.prevZ=a,a=i;r=n}a.nextZ=null,c*=2}while(o>1)}(i)}(t,n,i,s);for(var v,y,b=t;t.prev!==t.next;)if(v=t.prev,y=t.next,s?function(t,e,r,n){var i=t.prev,a=t,o=t.next;if(u(i,a,o)>=0)return!1;var s=i.x<a.x?i.x<o.x?i.x:o.x:a.x<o.x?a.x:o.x,h=i.y<a.y?i.y<o.y?i.y:o.y:a.y<o.y?a.y:o.y,f=i.x>a.x?i.x>o.x?i.x:o.x:a.x>o.x?a.x:o.x,d=i.y>a.y?i.y>o.y?i.y:o.y:a.y>o.y?a.y:o.y,p=l(s,h,e,r,n),m=l(f,d,e,r,n),g=t.nextZ;for(;g&&g.z<=m;){if(g!==t.prev&&g!==t.next&&c(i.x,i.y,a.x,a.y,o.x,o.y,g.x,g.y)&&u(g.prev,g,g.next)>=0)return!1;g=g.nextZ}g=t.prevZ;for(;g&&g.z>=p;){if(g!==t.prev&&g!==t.next&&c(i.x,i.y,a.x,a.y,o.x,o.y,g.x,g.y)&&u(g.prev,g,g.next)>=0)return!1;g=g.prevZ}return!0}(t,n,i,s):function(t){var e=t.prev,r=t,n=t.next;if(u(e,r,n)>=0)return!1;var i=t.next.next;for(;i!==t.prev;){if(c(e.x,e.y,r.x,r.y,n.x,n.y,i.x,i.y)&&u(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}(t))e.push(v.i/r),e.push(t.i/r),e.push(y.i/r),g(t),t=y.next,b=y.next;else if((t=y)===b){m?1===m?o(t=function(t,e,r){var n=t;do{var i=n.prev,a=n.next.next;!h(i,a)&&f(i,n,n.next,a)&&d(i,a)&&d(a,i)&&(e.push(i.i/r),e.push(n.i/r),e.push(a.i/r),g(n),g(n.next),n=t=a),n=n.next}while(n!==t);return n}(t,e,r),e,r,n,i,s,2):2===m&&function(t,e,r,n,i,s){var l=t;do{for(var c=l.next.next;c!==l.prev;){if(l.i!==c.i&&function(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var r=t;do{if(r.i!==t.i&&r.next.i!==t.i&&r.i!==e.i&&r.next.i!==e.i&&f(r,r.next,t,e))return!0;r=r.next}while(r!==t);return!1}(t,e)&&d(t,e)&&d(e,t)&&function(t,e){var r=t,n=!1,i=(t.x+e.x)/2,a=(t.y+e.y)/2;do{r.y>a!=r.next.y>a&&i<(r.next.x-r.x)*(a-r.y)/(r.next.y-r.y)+r.x&&(n=!n),r=r.next}while(r!==t);return n}(t,e)}(l,c)){var u=p(l,c);return l=a(l,l.next),u=a(u,u.next),o(l,e,r,n,i,s),void o(u,e,r,n,i,s)}c=c.next}l=l.next}while(l!==t)}(t,e,r,n,i,s):o(a(t),e,r,n,i,s,1);break}}}function s(t,e){return t.x-e.x}function l(t,e,r,n,i){return t=32767*(t-r)/i,e=32767*(e-n)/i,t=16711935&(t|t<<8),t=252645135&(t|t<<4),t=858993459&(t|t<<2),t=1431655765&(t|t<<1),e=16711935&(e|e<<8),e=252645135&(e|e<<4),e=858993459&(e|e<<2),e=1431655765&(e|e<<1),t|e<<1}function c(t,e,r,n,i,a,o,s){return(i-o)*(e-s)-(t-o)*(a-s)>=0&&(t-o)*(n-s)-(r-o)*(e-s)>=0&&(r-o)*(a-s)-(i-o)*(n-s)>=0}function u(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function h(t,e){return t.x===e.x&&t.y===e.y}function f(t,e,r,n){return!!(h(t,e)&&h(r,n)||h(t,n)&&h(r,e))||u(t,e,r)>0!=u(t,e,n)>0&&u(r,n,t)>0!=u(r,n,e)>0}function d(t,e){return u(t.prev,t,t.next)<0?u(t,e,t.next)>=0&&u(t,t.prev,e)>=0:u(t,e,t.prev)<0||u(t,t.next,e)<0}function p(t,e){var r=new v(t.i,t.x,t.y),n=new v(e.i,e.x,e.y),i=t.next,a=e.prev;return t.next=e,e.prev=t,r.next=i,i.prev=r,n.next=r,r.prev=n,a.next=n,n.prev=a,n}function m(t,e,r,n){var i=new v(t,e,r);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function g(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function v(t,e,r){this.i=t,this.x=e,this.y=r,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function y(t,e,r,n){for(var i=0,a=e,o=r-n;a<r;a+=n)i+=(t[o]-t[a])*(t[a+1]+t[o+1]),o=a;return i}e.exports=n,n.deviation=function(t,e,r,n){var i=e&&e.length,a=i?e[0]*r:t.length,o=Math.abs(y(t,0,a,r));if(i)for(var s=0,l=e.length;s<l;s++){var c=e[s]*r,u=s<l-1?e[s+1]*r:t.length;o-=Math.abs(y(t,c,u,r))}var h=0;for(s=0;s<n.length;s+=3){var f=n[s]*r,d=n[s+1]*r,p=n[s+2]*r;h+=Math.abs((t[f]-t[p])*(t[d+1]-t[f+1])-(t[f]-t[d])*(t[p+1]-t[f+1]))}return 0===o&&0===h?0:Math.abs((h-o)/o)},n.flatten=function(t){for(var e=t[0][0].length,r={vertices:[],holes:[],dimensions:e},n=0,i=0;i<t.length;i++){for(var a=0;a<t[i].length;a++)for(var o=0;o<e;o++)r.vertices.push(t[i][a][o]);i>0&&(n+=t[i-1].length,r.holes.push(n))}return r}},{}],130:[function(t,e,r){"use strict";e.exports=function(t,e){var r=t.length;if("number"!=typeof e){for(e=0,a=0;a<r;++a)o=t[a],e=Math.max(e,o[0],o[1]);e=1+(0|e)}e|=0;for(var i=new Array(e),a=0;a<e;++a)i[a]=[];for(a=0;a<r;++a){var o;i[(o=t[a])[0]].push(o[1]),i[o[1]].push(o[0])}for(var s=0;s<e;++s)n(i[s],function(t,e){return t-e});return i};var n=t("uniq")},{uniq:554}],131:[function(t,e,r){(function(n,i){!function(t,n){"object"==typeof r&&void 0!==e?e.exports=n():t.ES6Promise=n()}(this,function(){"use strict";function e(t){return"function"==typeof t}function r(){var t=setTimeout;return function(){return t(a,1)}}function a(){for(var t=0;t<A;t+=2){(0,O[t])(O[t+1]),O[t]=void 0,O[t+1]=void 0}A=0}function o(){try{var e=t("vertx");return S=e.runOnLoop||e.runOnContext,function(){S(a)}}catch(t){return r()}}function s(t,e){var r=arguments,n=this,i=new this.constructor(c);void 0===i[F]&&x(i);var a=n._state;return a?function(){var t=r[a-1];L(function(){return b(a,i,t,n._result)})}():g(n,i,t,e),i}function l(t){if(t&&"object"==typeof t&&t.constructor===this)return t;var e=new this(c);return f(e,t),e}function c(){}function u(t){try{return t.then}catch(t){return U.error=t,U}}function h(t,r,n){r.constructor===t.constructor&&n===s&&r.constructor.resolve===l?function(t,e){e._state===N?p(t,e._result):e._state===B?m(t,e._result):g(e,void 0,function(e){return f(t,e)},function(e){return m(t,e)})}(t,r):n===U?m(t,U.error):void 0===n?p(t,r):e(n)?function(t,e,r){L(function(t){var n=!1,i=function(t,e,r,n){try{t.call(e,r,n)}catch(t){return t}}(r,e,function(r){n||(n=!0,e!==r?f(t,r):p(t,r))},function(e){n||(n=!0,m(t,e))},t._label);!n&&i&&(n=!0,m(t,i))},t)}(t,r,n):p(t,r)}function f(t,e){t===e?m(t,new TypeError("You cannot resolve a promise with itself")):!function(t){return"function"==typeof t||"object"==typeof t&&null!==t}(e)?p(t,e):h(t,e,u(e))}function d(t){t._onerror&&t._onerror(t._result),v(t)}function p(t,e){t._state===j&&(t._result=e,t._state=N,0!==t._subscribers.length&&L(v,t))}function m(t,e){t._state===j&&(t._state=B,t._result=e,L(d,t))}function g(t,e,r,n){var i=t._subscribers,a=i.length;t._onerror=null,i[a]=e,i[a+N]=r,i[a+B]=n,0===a&&t._state&&L(v,t)}function v(t){var e=t._subscribers,r=t._state;if(0!==e.length){for(var n=void 0,i=void 0,a=t._result,o=0;o<e.length;o+=3)n=e[o],i=e[o+r],n?b(r,n,i,a):i(a);t._subscribers.length=0}}function y(){this.error=null}function b(t,r,n,i){var a=e(n),o=void 0,s=void 0,l=void 0,c=void 0;if(a){if((o=function(t,e){try{return t(e)}catch(t){return V.error=t,V}}(n,i))===V?(c=!0,s=o.error,o=null):l=!0,r===o)return void m(r,new TypeError("A promises callback cannot return that same promise."))}else o=i,l=!0;r._state!==j||(a&&l?f(r,o):c?m(r,s):t===N?p(r,o):t===B&&m(r,o))}function x(t){t[F]=H++,t._state=void 0,t._result=void 0,t._subscribers=[]}function _(t,e){this._instanceConstructor=t,this.promise=new t(c),this.promise[F]||x(this.promise),T(e)?(this._input=e,this.length=e.length,this._remaining=e.length,this._result=new Array(this.length),0===this.length?p(this.promise,this._result):(this.length=this.length||0,this._enumerate(),0===this._remaining&&p(this.promise,this._result))):m(this.promise,new Error("Array Methods must be provided an Array"))}function w(t){this[F]=H++,this._result=this._state=void 0,this._subscribers=[],c!==t&&("function"!=typeof t&&function(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}(),this instanceof w?function(t,e){try{e(function(e){f(t,e)},function(e){m(t,e)})}catch(e){m(t,e)}}(this,t):function(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}())}function M(){var t=void 0;if(void 0!==i)t=i;else if("undefined"!=typeof self)t=self;else try{t=Function("return this")()}catch(t){throw new Error("polyfill failed because global object is unavailable in this environment")}var e=t.Promise;if(e){var r=null;try{r=Object.prototype.toString.call(e.resolve())}catch(t){}if("[object Promise]"===r&&!e.cast)return}t.Promise=w}var k=void 0,T=k=Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)},A=0,S=void 0,E=void 0,L=function(t,e){O[A]=t,O[A+1]=e,2===(A+=2)&&(E?E(a):R())},C="undefined"!=typeof window?window:void 0,I=C||{},z=I.MutationObserver||I.WebKitMutationObserver,D="undefined"==typeof self&&void 0!==n&&"[object process]"==={}.toString.call(n),P="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,O=new Array(1e3),R=void 0;R=D?function(){return n.nextTick(a)}:z?function(){var t=0,e=new z(a),r=document.createTextNode("");return e.observe(r,{characterData:!0}),function(){r.data=t=++t%2}}():P?function(){var t=new MessageChannel;return t.port1.onmessage=a,function(){return t.port2.postMessage(0)}}():void 0===C&&"function"==typeof t?o():r();var F=Math.random().toString(36).substring(16),j=void 0,N=1,B=2,U=new y,V=new y,H=0;return _.prototype._enumerate=function(){for(var t=this.length,e=this._input,r=0;this._state===j&&r<t;r++)this._eachEntry(e[r],r)},_.prototype._eachEntry=function(t,e){var r=this._instanceConstructor,n=r.resolve;if(n===l){var i=u(t);if(i===s&&t._state!==j)this._settledAt(t._state,e,t._result);else if("function"!=typeof i)this._remaining--,this._result[e]=t;else if(r===w){var a=new r(c);h(a,t,i),this._willSettleAt(a,e)}else this._willSettleAt(new r(function(e){return e(t)}),e)}else this._willSettleAt(n(t),e)},_.prototype._settledAt=function(t,e,r){var n=this.promise;n._state===j&&(this._remaining--,t===B?m(n,r):this._result[e]=r),0===this._remaining&&p(n,this._result)},_.prototype._willSettleAt=function(t,e){var r=this;g(t,void 0,function(t){return r._settledAt(N,e,t)},function(t){return r._settledAt(B,e,t)})},w.all=function(t){return new _(this,t).promise},w.race=function(t){var e=this;return new e(T(t)?function(r,n){for(var i=t.length,a=0;a<i;a++)e.resolve(t[a]).then(r,n)}:function(t,e){return e(new TypeError("You must pass an array to race."))})},w.resolve=l,w.reject=function(t){var e=new this(c);return m(e,t),e},w._setScheduler=function(t){E=t},w._setAsap=function(t){L=t},w._asap=L,w.prototype={constructor:w,then:s,catch:function(t){return this.then(null,t)}},M(),w.polyfill=M,w.Promise=w,w})}).call(this,t("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{_process:498}],132:[function(t,e,r){function n(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function i(t){return"function"==typeof t}function a(t){return"object"==typeof t&&null!==t}function o(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(!function(t){return"number"==typeof t}(t)||t<0||isNaN(t))throw TypeError("n must be a positive number");return this._maxListeners=t,this},n.prototype.emit=function(t){var e,r,n,s,l,c;if(this._events||(this._events={}),"error"===t&&(!this._events.error||a(this._events.error)&&!this._events.error.length)){if((e=arguments[1])instanceof Error)throw e;var u=new Error('Uncaught, unspecified "error" event. ('+e+")");throw u.context=e,u}if(r=this._events[t],o(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:s=Array.prototype.slice.call(arguments,1),r.apply(this,s)}else if(a(r))for(s=Array.prototype.slice.call(arguments,1),n=(c=r.slice()).length,l=0;l<n;l++)c[l].apply(this,s);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=o(this._maxListeners)?n.defaultMaxListeners:this._maxListeners)&&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(n<0)return this;1===r.length?(r.length=0,delete this._events[t]):r.splice(n,1),this._events.removeListener&&this.emit("removeListener",t,e)}return this},n.prototype.removeAllListeners=function(t){var e,r;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[t]&&delete this._events[t],this;if(0===arguments.length){for(e in this._events)"removeListener"!==e&&this.removeAllListeners(e);return this.removeAllListeners("removeListener"),this._events={},this}if(r=this._events[t],i(r))this.removeListener(t,r);else if(r)for(;r.length;)this.removeListener(t,r[r.length-1]);return delete this._events[t],this},n.prototype.listeners=function(t){return this._events&&this._events[t]?i(this._events[t])?[this._events[t]]:this._events[t].slice():[]},n.prototype.listenerCount=function(t){if(this._events){var e=this._events[t];if(i(e))return 1;if(e)return e.length}return 0},n.listenerCount=function(t,e){return t.listenerCount(e)}},{}],133:[function(t,e,r){"use strict";e.exports=function(t,e,r){var n=e||0,i=r||1;return[[t[12]+t[0],t[13]+t[1],t[14]+t[2],t[15]+t[3]],[t[12]-t[0],t[13]-t[1],t[14]-t[2],t[15]-t[3]],[t[12]+t[4],t[13]+t[5],t[14]+t[6],t[15]+t[7]],[t[12]-t[4],t[13]-t[5],t[14]-t[6],t[15]-t[7]],[n*t[12]+t[8],n*t[13]+t[9],n*t[14]+t[10],n*t[15]+t[11]],[i*t[12]-t[8],i*t[13]-t[9],i*t[14]-t[10],i*t[15]-t[11]]]}},{}],134:[function(t,e,r){"use strict";e.exports=function(t){var e=typeof t;if("string"===e){var r=t;if(0===(t=+t)&&function(t){for(var e,r=t.length,n=0;n<r;n++)if(((e=t.charCodeAt(n))<9||e>13)&&32!==e&&133!==e&&160!==e&&5760!==e&&6158!==e&&(e<8192||e>8205)&&8232!==e&&8233!==e&&8239!==e&&8287!==e&&8288!==e&&12288!==e&&65279!==e)return!1;return!0}(r))return!1}else if("number"!==e)return!1;return t-t<1}},{}],135:[function(t,e,r){"use strict";function n(t){if(!t)return"true";var e=t[0];if(t.length<=1)return"any"===e?"false":"true";return"("+("=="===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?o(t.slice(1),"||"):"all"===e?o(t.slice(1),"&&"):"none"===e?c(o(t.slice(1),"||")):"in"===e?s(t[1],t.slice(2)):"!in"===e?c(s(t[1],t.slice(2))):"has"===e?l(t[1]):"!has"===e?c(l([t[1]])):"true")+")"}function i(t){return"$type"===t?"f.type":"$id"===t?"f.id":"p["+JSON.stringify(t)+"]"}function a(t,e,r,n){var a=i(t),o="$type"===t?h.indexOf(e):JSON.stringify(e);return(n?"typeof "+a+"=== typeof "+o+"&&":"")+a+r+o}function o(t,e){return t.map(n).join(e)}function s(t,e){"$type"===t&&(e=e.map(function(t){return h.indexOf(t)}));var r=JSON.stringify(e.sort(u)),n=i(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 l(t){return JSON.stringify(t)+" in p"}function c(t){return"!("+t+")"}function u(t,e){return t<e?-1:t>e?1:0}e.exports=function(t){return new Function("f","var p = (f && f.properties || {}); return "+n(t))};var h=["Unknown","Point","LineString","Polygon"]},{}],136:[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 a(t){for(var e=new Array(t),r=0;r<t;++r)e[r]=0;return e}e.exports=function(t,e,r){switch(arguments.length){case 0:return new i([0],[0],0);case 1:return"number"==typeof t?new i(n=a(t),n,0):new i(t,a(t.length),0);case 2:if("number"==typeof e){var n=a(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)}};var o=t("cubic-hermite"),s=t("binary-search-bounds"),l=i.prototype;l.flush=function(t){var e=s.gt(this._time,t)-1;e<=0||(this._time.splice(0,e),this._state.splice(0,e*this.dimension),this._velocity.splice(0,e*this.dimension))},l.curve=function(t){var e=this._time,r=e.length,i=s.le(e,t),a=this._scratch[0],l=this._state,c=this._velocity,u=this.dimension,h=this.bounds;if(i<0)for(var f=u-1,d=0;d<u;++d,--f)a[d]=l[f];else if(i>=r-1)for(var f=l.length-1,p=t-e[r-1],d=0;d<u;++d,--f)a[d]=l[f]+p*c[f];else{for(var f=u*(i+1)-1,m=e[i],g=e[i+1]-m||1,v=this._scratch[1],y=this._scratch[2],b=this._scratch[3],x=this._scratch[4],_=!0,d=0;d<u;++d,--f)v[d]=l[f],b[d]=c[f]*g,y[d]=l[f+u],x[d]=c[f+u]*g,_=_&&v[d]===y[d]&&b[d]===x[d]&&0===b[d];if(_)for(d=0;d<u;++d)a[d]=v[d];else o(v,b,y,x,(t-m)/g,a)}for(var w=h[0],M=h[1],d=0;d<u;++d)a[d]=n(w[d],M[d],a[d]);return a},l.dcurve=function(t){var e=this._time,r=e.length,n=s.le(e,t),i=this._scratch[0],a=this._state,l=this._velocity,c=this.dimension;if(n>=r-1)for(var u=a.length-1,h=(e[r-1],0);h<c;++h,--u)i[h]=l[u];else{for(var u=c*(n+1)-1,f=e[n],d=e[n+1]-f||1,p=this._scratch[1],m=this._scratch[2],g=this._scratch[3],v=this._scratch[4],y=!0,h=0;h<c;++h,--u)p[h]=a[u],g[h]=l[u]*d,m[h]=a[u+c],v[h]=l[u+c]*d,y=y&&p[h]===m[h]&&g[h]===v[h]&&0===g[h];if(y)for(h=0;h<c;++h)i[h]=0;else{o.derivative(p,g,m,v,(t-f)/d,i);for(h=0;h<c;++h)i[h]/=d}}return i},l.lastT=function(){var t=this._time;return t[t.length-1]},l.stable=function(){for(var t=this._velocity,e=t.length,r=this.dimension-1;r>=0;--r)if(t[--e])return!1;return!0},l.jump=function(t){var e=this.lastT(),r=this.dimension;if(!(t<e||arguments.length!==r+1)){var i=this._state,a=this._velocity,o=i.length-this.dimension,s=this.bounds,l=s[0],c=s[1];this._time.push(e,t);for(var u=0;u<2;++u)for(h=0;h<r;++h)i.push(i[o++]),a.push(0);this._time.push(t);for(var h=r;h>0;--h)i.push(n(l[h-1],c[h-1],arguments[h])),a.push(0)}},l.push=function(t){var e=this.lastT(),r=this.dimension;if(!(t<e||arguments.length!==r+1)){var i=this._state,a=this._velocity,o=i.length-this.dimension,s=t-e,l=this.bounds,c=l[0],u=l[1],h=s>1e-6?1/s:0;this._time.push(t);for(var f=r;f>0;--f){var d=n(c[f-1],u[f-1],arguments[f]);i.push(d),a.push((d-i[o++])*h)}}},l.set=function(t){var e=this.dimension;if(!(t<this.lastT()||arguments.length!==e+1)){var r=this._state,i=this._velocity,a=this.bounds,o=a[0],s=a[1];this._time.push(t);for(var l=e;l>0;--l)r.push(n(o[l-1],s[l-1],arguments[l])),i.push(0)}},l.move=function(t){var e=this.lastT(),r=this.dimension;if(!(t<=e||arguments.length!==r+1)){var i=this._state,a=this._velocity,o=i.length-this.dimension,s=this.bounds,l=s[0],c=s[1],u=t-e,h=u>1e-6?1/u:0;this._time.push(t);for(var f=r;f>0;--f){var d=arguments[f];i.push(n(l[f-1],c[f-1],i[o++]+d)),a.push(d*h)}}},l.idle=function(t){var e=this.lastT();if(!(t<e)){var r=this.dimension,i=this._state,a=this._velocity,o=i.length-r,s=this.bounds,l=s[0],c=s[1],u=t-e;this._time.push(t);for(var h=r-1;h>=0;--h)i.push(n(l[h],c[h],i[o]+u*a[o])),a.push(0),o+=1}}},{"binary-search-bounds":69,"cubic-hermite":112}],137:[function(t,e,r){"use strict";var n=t("tiny-sdf"),i=t("optical-properties");e.exports=function(t){var e,r,o=(t=t||{}).canvas||document.createElement("canvas"),s=t.family||"sans-serif",l=t.shape||[512,512],c=t.step||[32,32],u=parseFloat(t.size)||16,h=t.chars||[32,126],f=Math.floor((c[0]-u)/2),d=t.radius||1.5*f,p=new n(u,f,d,0,s),m=null==t.align?"optical":t.align,g=null==t.fit||1==t.fit?.5:t.fit;if(Array.isArray(h)){if(2===h.length&&"number"==typeof h[0]&&"number"==typeof h[1]){var v=[];for(e=h[0],r=0;e<=h[1];e++)v[r++]=String.fromCharCode(e);h=v}}else h=String(h).split("");l=l.slice(),o.width=l[0],o.height=l[1];var y=o.getContext("2d");y.fillStyle="#000",y.fillRect(0,0,o.width,o.height),y.textBaseline="middle";var b=c[0],x=c[1],_=0,w=0,M=u/x,k=Math.min(h.length,Math.floor(l[0]/b)*Math.ceil(l[1]/x)),T=p.ctx.textAlign,A=p.buffer,S=p.middle;for(p.ctx.textAlign="center",p.buffer=p.size/2,e=0;e<k;e++)if(h[e]){var E=function(t,e,r){if(a[e]&&a[e][t])return a[e][t];var n=i(t,{size:200,fontSize:200*r,fontFamily:e});a[e]||(a[e]={});var o={center:[n.center[0]/200,n.center[1]/200],bounds:n.bounds.map(function(t){return t/200}),radius:n.radius/200};return a[e][t]=o,o}(h[e],s,M),L=1,C=[0,0];if(g){var I=g;Array.isArray(g)&&(I=g[e]);var z=.5*(E.bounds[3]-E.bounds[1]),D=.5*(E.bounds[2]-E.bounds[0]),P=Math.max(z,D),O=Math.sqrt(z*z+D*D);L=x*I/((.333*E.radius+.333*P+.333*O)*x*2),p.ctx.font=u*L+"px "+s}else p.ctx.font=u+"px "+s;m&&(C="optical"===m||!0===m?[.5*b-b*E.center[0],.5*x-x*E.center[1]]:[.5*b-b*(E.bounds[2]+E.bounds[0])*.5,.5*x-x*(E.bounds[3]+E.bounds[1])*.5],p.middle=S+C[1]*L);var R=p.draw(h[e]);y.putImageData(R,_+C[0]*L,w),(_+=c[0])>l[0]-c[0]&&(_=0,w+=c[1])}return p.ctx.textAlign=T,p.buffer=A,p.middle=S,o};var a={}},{"optical-properties":474,"tiny-sdf":544}],138:[function(t,e,r){"use strict";function n(t,e,r,n,i,a){this._color=t,this.key=e,this.value=r,this.left=n,this.right=i,this._count=a}function i(t){return new n(t._color,t.key,t.value,t.left,t.right,t._count)}function a(t,e){return new n(t,e.key,e.value,e.left,e.right,e._count)}function o(t){t._count=1+(t.left?t.left._count:0)+(t.right?t.right._count:0)}function s(t,e){this._compare=t,this.root=e}function l(t,e){if(e.left){if(r=l(t,e.left))return r}var r=t(e.key,e.value);return r||(e.right?l(t,e.right):void 0)}function c(t,e,r,n){if(e(t,n.key)<=0){if(n.left){if(i=c(t,e,r,n.left))return i}var i=r(n.key,n.value);if(i)return i}if(n.right)return c(t,e,r,n.right)}function u(t,e,r,n,i){var a,o=r(t,i.key),s=r(e,i.key);if(o<=0){if(i.left&&(a=u(t,e,r,n,i.left)))return a;if(s>0&&(a=n(i.key,i.value)))return a}if(s>0&&i.right)return u(t,e,r,n,i.right)}function h(t,e){this.tree=t,this._stack=e}function f(t,e){t.key=e.key,t.value=e.value,t.left=e.left,t.right=e.right,t._color=e._color,t._count=e._count}function d(t){for(var e,r,n,s,l=t.length-1;l>=0;--l){if(e=t[l],0===l)return void(e._color=m);if((r=t[l-1]).left===e){if((n=r.right).right&&n.right._color===p){if(n=r.right=i(n),s=n.right=i(n.right),r.right=n.left,n.left=r,n.right=s,n._color=r._color,e._color=m,r._color=m,s._color=m,o(r),o(n),l>1){(c=t[l-2]).left===r?c.left=n:c.right=n}return void(t[l-1]=n)}if(n.left&&n.left._color===p){if(n=r.right=i(n),s=n.left=i(n.left),r.right=s.left,n.left=s.right,s.left=r,s.right=n,s._color=r._color,r._color=m,n._color=m,e._color=m,o(r),o(n),o(s),l>1){(c=t[l-2]).left===r?c.left=s:c.right=s}return void(t[l-1]=s)}if(n._color===m){if(r._color===p)return r._color=m,void(r.right=a(p,n));r.right=a(p,n);continue}if(n=i(n),r.right=n.left,n.left=r,n._color=r._color,r._color=p,o(r),o(n),l>1){(c=t[l-2]).left===r?c.left=n:c.right=n}t[l-1]=n,t[l]=r,l+1<t.length?t[l+1]=e:t.push(e),l+=2}else{if((n=r.left).left&&n.left._color===p){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=m,r._color=m,s._color=m,o(r),o(n),l>1){(c=t[l-2]).right===r?c.right=n:c.left=n}return void(t[l-1]=n)}if(n.right&&n.right._color===p){if(n=r.left=i(n),s=n.right=i(n.right),r.left=s.right,n.right=s.left,s.right=r,s.left=n,s._color=r._color,r._color=m,n._color=m,e._color=m,o(r),o(n),o(s),l>1){(c=t[l-2]).right===r?c.right=s:c.left=s}return void(t[l-1]=s)}if(n._color===m){if(r._color===p)return r._color=m,void(r.left=a(p,n));r.left=a(p,n);continue}if(n=i(n),r.left=n.right,n.right=r,n._color=r._color,r._color=p,o(r),o(n),l>1){var c=t[l-2];c.right===r?c.right=n:c.left=n}t[l-1]=n,t[l]=r,l+1<t.length?t[l+1]=e:t.push(e),l+=2}}}e.exports=function(t){return new s(t||function(t,e){return t<e?-1:t>e?1:0},null)};var p=0,m=1,g=s.prototype;Object.defineProperty(g,"keys",{get:function(){var t=[];return this.forEach(function(e,r){t.push(e)}),t}}),Object.defineProperty(g,"values",{get:function(){var t=[];return this.forEach(function(e,r){t.push(r)}),t}}),Object.defineProperty(g,"length",{get:function(){return this.root?this.root._count:0}}),g.insert=function(t,e){for(var r=this._compare,i=this.root,l=[],c=[];i;){var u=r(t,i.key);l.push(i),c.push(u),i=u<=0?i.left:i.right}l.push(new n(p,t,e,null,null,1));for(h=l.length-2;h>=0;--h){i=l[h];c[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===m||i._color===m)break;var d=l[h-2];if(d.left===f)if(f.left===i){if(!(g=d.right)||g._color!==p){if(d._color=p,d.left=f.right,f._color=m,f.right=d,l[h-2]=f,l[h-1]=i,o(d),o(f),h>=3){(v=l[h-3]).left===d?v.left=f:v.right=f}break}f._color=m,d.right=a(m,g),d._color=p,h-=1}else{if(!(g=d.right)||g._color!==p){if(f.right=i.left,d._color=p,d.left=i.right,i._color=m,i.left=f,i.right=d,l[h-2]=i,l[h-1]=f,o(d),o(f),o(i),h>=3){(v=l[h-3]).left===d?v.left=i:v.right=i}break}f._color=m,d.right=a(m,g),d._color=p,h-=1}else if(f.right===i){if(!(g=d.left)||g._color!==p){if(d._color=p,d.right=f.left,f._color=m,f.left=d,l[h-2]=f,l[h-1]=i,o(d),o(f),h>=3){(v=l[h-3]).right===d?v.right=f:v.left=f}break}f._color=m,d.left=a(m,g),d._color=p,h-=1}else{var g=d.left;if(!g||g._color!==p){if(f.left=i.right,d._color=p,d.right=i.left,i._color=m,i.right=f,i.left=d,l[h-2]=i,l[h-1]=f,o(d),o(f),o(i),h>=3){var v=l[h-3];v.right===d?v.right=i:v.left=i}break}f._color=m,d.left=a(m,g),d._color=p,h-=1}}return l[0]._color=m,new s(r,l[0])},g.forEach=function(t,e,r){if(this.root)switch(arguments.length){case 1:return l(t,this.root);case 2:return c(e,this._compare,t,this.root);case 3:if(this._compare(e,r)>=0)return;return u(e,r,this._compare,t,this.root)}},Object.defineProperty(g,"begin",{get:function(){for(var t=[],e=this.root;e;)t.push(e),e=e.left;return new h(this,t)}}),Object.defineProperty(g,"end",{get:function(){for(var t=[],e=this.root;e;)t.push(e),e=e.right;return new h(this,t)}}),g.at=function(t){if(t<0)return new h(this,[]);for(var e=this.root,r=[];;){if(r.push(e),e.left){if(t<e.left._count){e=e.left;continue}t-=e.left._count}if(!t)return new h(this,r);if(t-=1,!e.right)break;if(t>=e.right._count)break;e=e.right}return new h(this,[])},g.ge=function(t){for(var e=this._compare,r=this.root,n=[],i=0;r;){var a=e(t,r.key);n.push(r),a<=0&&(i=n.length),r=a<=0?r.left:r.right}return n.length=i,new h(this,n)},g.gt=function(t){for(var e=this._compare,r=this.root,n=[],i=0;r;){var a=e(t,r.key);n.push(r),a<0&&(i=n.length),r=a<0?r.left:r.right}return n.length=i,new h(this,n)},g.lt=function(t){for(var e=this._compare,r=this.root,n=[],i=0;r;){var a=e(t,r.key);n.push(r),a>0&&(i=n.length),r=a<=0?r.left:r.right}return n.length=i,new h(this,n)},g.le=function(t){for(var e=this._compare,r=this.root,n=[],i=0;r;){var a=e(t,r.key);n.push(r),a>=0&&(i=n.length),r=a<0?r.left:r.right}return n.length=i,new h(this,n)},g.find=function(t){for(var e=this._compare,r=this.root,n=[];r;){var i=e(t,r.key);if(n.push(r),0===i)return new h(this,n);r=i<=0?r.left:r.right}return new h(this,[])},g.remove=function(t){var e=this.find(t);return e?e.remove():this},g.get=function(t){for(var e=this._compare,r=this.root;r;){var n=e(t,r.key);if(0===n)return r.value;r=n<=0?r.left:r.right}};var v=h.prototype;Object.defineProperty(v,"valid",{get:function(){return this._stack.length>0}}),Object.defineProperty(v,"node",{get:function(){return this._stack.length>0?this._stack[this._stack.length-1]:null},enumerable:!0}),v.clone=function(){return new h(this.tree,this._stack.slice())},v.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(l=t.length-2;l>=0;--l){(r=t[l]).left===t[l+1]?e[l]=new n(r._color,r.key,r.value,e[l+1],r.right,r._count):e[l]=new n(r._color,r.key,r.value,r.left,e[l+1],r._count)}if((r=e[e.length-1]).left&&r.right){var i=e.length;for(r=r.left;r.right;)e.push(r),r=r.right;var a=e[i-1];e.push(new n(r._color,a.key,a.value,r.left,r.right,r._count)),e[i-1].key=r.key,e[i-1].value=r.value;for(l=e.length-2;l>=i;--l)r=e[l],e[l]=new n(r._color,r.key,r.value,r.left,e[l+1],r._count);e[i-1].left=e[i]}if((r=e[e.length-1])._color===p){var o=e[e.length-2];o.left===r?o.left=null:o.right===r&&(o.right=null),e.pop();for(l=0;l<e.length;++l)e[l]._count--;return new s(this.tree._compare,e[0])}if(r.left||r.right){r.left?f(r,r.left):r.right&&f(r,r.right),r._color=m;for(l=0;l<e.length-1;++l)e[l]._count--;return new s(this.tree._compare,e[0])}if(1===e.length)return new s(this.tree._compare,null);for(var l=0;l<e.length;++l)e[l]._count--;var c=e[e.length-2];return d(e),c.left===r?c.left=null:c.right=null,new s(this.tree._compare,e[0])},Object.defineProperty(v,"key",{get:function(){if(this._stack.length>0)return this._stack[this._stack.length-1].key},enumerable:!0}),Object.defineProperty(v,"value",{get:function(){if(this._stack.length>0)return this._stack[this._stack.length-1].value},enumerable:!0}),Object.defineProperty(v,"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}),v.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(v,"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}}),v.update=function(t){var e=this._stack;if(0===e.length)throw new Error("Can't update empty node!");var r=new Array(e.length),i=e[e.length-1];r[r.length-1]=new n(i._color,i.key,t,i.left,i.right,i._count);for(var a=e.length-2;a>=0;--a)(i=e[a]).left===e[a+1]?r[a]=new n(i._color,i.key,i.value,r[a+1],i.right,i._count):r[a]=new n(i._color,i.key,i.value,i.left,r[a+1],i._count);return new s(this.tree._compare,r[0])},v.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(v,"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}})},{}],139:[function(t,e,r){function n(t){if(t<0)return Number("0/0");for(var e=o[0],r=o.length-1;r>0;--r)e+=o[r]/(t+r);var n=t+a+.5;return.5*Math.log(2*Math.PI)+(t+.5)*Math.log(n)-n+Math.log(e)-Math.log(t)}var i=[.9999999999998099,676.5203681218851,-1259.1392167224028,771.3234287776531,-176.6150291621406,12.507343278686905,-.13857109526572012,9984369578019572e-21,1.5056327351493116e-7],a=607/128,o=[.9999999999999971,57.15623566586292,-59.59796035547549,14.136097974741746,-.4919138160976202,3399464998481189e-20,4652362892704858e-20,-9837447530487956e-20,.0001580887032249125,-.00021026444172410488,.00021743961811521265,-.0001643181065367639,8441822398385275e-20,-26190838401581408e-21,36899182659531625e-22];e.exports=function t(e){if(e<.5)return Math.PI/(Math.sin(Math.PI*e)*t(1-e));if(e>100)return Math.exp(n(e));e-=1;for(var r=i[0],a=1;a<9;a++)r+=i[a]/(e+a);var o=e+7+.5;return Math.sqrt(2*Math.PI)*Math.pow(o,e+.5)*Math.exp(-o)*r},e.exports.log=n},{}],140:[function(t,e,r){function n(t){var e=0;if(t&&t.length>0){e+=Math.abs(i(t[0]));for(var r=1;r<t.length;r++)e-=Math.abs(i(t[r]))}return e}function i(t){var e=0;if(t.length>2){for(var r,n,i=0;i<t.length-1;i++)r=t[i],e+=a((n=t[i+1])[0]-r[0])*(2+Math.sin(a(r[1]))+Math.sin(a(n[1])));e=e*o.RADIUS*o.RADIUS/2}return e}function a(t){return t*Math.PI/180}var o=t("wgs84");e.exports.geometry=function(t){if("Polygon"===t.type)return n(t.coordinates);if("MultiPolygon"===t.type){for(var e=0,r=0;r<t.coordinates.length;r++)e+=n(t.coordinates[r]);return e}return null},e.exports.ring=i},{wgs84:576}],141:[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 function(t,e){"Polygon"===t.type?t.coordinates=a(t.coordinates,e):"MultiPolygon"===t.type&&(t.coordinates=t.coordinates.map(i(a,e)));return t}(t,e);default:return t}}function i(t,e){return function(r){return t(r,e)}}function a(t,e){e=!!e,t[0]=o(t[0],!e);for(var r=1;r<t.length;r++)t[r]=o(t[r],e);return t}function o(t,e){return function(t){return s.ring(t)>=0}(t)===e?t:t.reverse()}var s=t("geojson-area");e.exports=n},{"geojson-area":140}],142:[function(t,e,r){"use strict";function n(t,e,r,n,i){return e.length&&(e.area=r,e.dist=n,void 0!==i&&(e.outer=i),t.push(e)),[]}e.exports=function(t,e,r,a,o,s,l,c){if(r/=e,a/=e,l>=r&&c<=a)return t;if(l>a||c<r)return null;for(var u=[],h=0;h<t.length;h++){var f,d,p=t[h],m=p.geometry,g=p.type;if(f=p.min[o],d=p.max[o],f>=r&&d<=a)u.push(p);else if(!(f>a||d<r)){var v=1===g?function(t,e,r,n){for(var i=[],a=0;a<t.length;a++){var o=t[a],s=o[n];s>=e&&s<=r&&i.push(o)}return i}(m,r,a,o):function(t,e,r,i,a,o){for(var s=[],l=0;l<t.length;l++){var c,u,h,f=0,d=0,p=null,m=t[l],g=m.area,v=m.dist,y=m.outer,b=m.length,x=[];for(u=0;u<b-1;u++)c=p||m[u],p=m[u+1],f=d||c[i],d=p[i],f<e?d>r?(x.push(a(c,p,e),a(c,p,r)),o||(x=n(s,x,g,v,y))):d>=e&&x.push(a(c,p,e)):f>r?d<e?(x.push(a(c,p,r),a(c,p,e)),o||(x=n(s,x,g,v,y))):d<=r&&x.push(a(c,p,r)):(x.push(c),d<e?(x.push(a(c,p,e)),o||(x=n(s,x,g,v,y))):d>r&&(x.push(a(c,p,r)),o||(x=n(s,x,g,v,y))));c=m[b-1],(f=c[i])>=e&&f<=r&&x.push(c),h=x[x.length-1],o&&h&&(x[0][0]!==h[0]||x[0][1]!==h[1])&&x.push(x[0]),n(s,x,g,v,y)}return s}(m,r,a,o,s,3===g);v.length&&u.push(i(p.tags,g,v,p.id))}}return u.length?u:null};var i=t("./feature")},{"./feature":144}],143:[function(t,e,r){"use strict";function n(t,e,r){if(null!==e.geometry){var o,l,c,u,h=e.geometry,f=h.type,d=h.coordinates,p=e.properties,m=e.id;if("Point"===f)t.push(s(p,1,[a(d)],m));else if("MultiPoint"===f)t.push(s(p,1,i(d),m));else if("LineString"===f)t.push(s(p,2,[i(d,r)],m));else if("MultiLineString"===f||"Polygon"===f){for(c=[],o=0;o<d.length;o++)u=i(d[o],r),"Polygon"===f&&(u.outer=0===o),c.push(u);t.push(s(p,"Polygon"===f?3:2,c,m))}else if("MultiPolygon"===f){for(c=[],o=0;o<d.length;o++)for(l=0;l<d[o].length;l++)(u=i(d[o][l],r)).outer=0===l,c.push(u);t.push(s(p,3,c,m))}else{if("GeometryCollection"!==f)throw new Error("Input data is not a valid GeoJSON object.");for(o=0;o<h.geometries.length;o++)n(t,{geometry:h.geometries[o],properties:p},r)}}}function i(t,e){for(var r=[],n=0;n<t.length;n++)r.push(a(t[n]));return e&&(o(r,e),function(t){for(var e,r,n=0,i=0,a=0;a<t.length-1;a++)e=r||t[a],r=t[a+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}(r)),r}function a(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=n<0?0:n>1?1:n,[r,n,0]}e.exports=function(t,e){var r=[];if("FeatureCollection"===t.type)for(var i=0;i<t.features.length;i++)n(r,t.features[i],e);else"Feature"===t.type?n(r,t,e):n(r,{geometry:t},e);return r};var o=t("./simplify"),s=t("./feature")},{"./feature":144,"./simplify":146}],144:[function(t,e,r){"use strict";function n(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=function(t,e,r,i){var a={id:i||null,type:e,geometry:r,tags:t||null,min:[1/0,1/0],max:[-1/0,-1/0]};return function(t){var e=t.geometry,r=t.min,i=t.max;if(1===t.type)n(r,i,e);else for(var a=0;a<e.length;a++)n(r,i,e[a])}(a),a}},{}],145:[function(t,e,r){"use strict";function n(t,e){var r=(e=this.options=function(t,e){for(var r in e)t[r]=e[r];return t}(Object.create(this.options),e)).debug;r&&console.time("preprocess data");var n=1<<e.maxZoom,i=l(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=h(i,e.buffer/e.extent,a)).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 i(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 o(t,e,r){return[(r-t[1])*(e[0]-t[0])/(e[1]-t[1])+t[0],r,1]}function s(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 a=i.geometry[0].length;if(5!==a)return!1;for(var o=0;o<a;o++){var s=c.point(i.geometry[0][o],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=function(t,e){return new n(t,e)};var l=t("./convert"),c=t("./transform"),u=t("./clip"),h=t("./wrap"),f=t("./tile");n.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,solidChildren:!1,tolerance:3,extent:4096,buffer:64,debug:0},n.prototype.splitTile=function(t,e,r,n,l,c,h){for(var d=[t,e,r,n],p=this.options,m=p.debug,g=null;d.length;){n=d.pop(),r=d.pop(),e=d.pop(),t=d.pop();var v=1<<e,y=i(e,r,n),b=this.tiles[y],x=e===p.maxZoom?0:p.tolerance/(v*p.extent);if(!b&&(m>1&&console.time("creation"),b=this.tiles[y]=f(t,v,r,n,x,e===p.maxZoom),this.tileCoords.push({z:e,x:r,y:n}),m)){m>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",e,r,n,b.numFeatures,b.numPoints,b.numSimplified),console.timeEnd("creation"));var _="z"+e;this.stats[_]=(this.stats[_]||0)+1,this.total++}if(b.source=t,l){if(e===p.maxZoom||e===l)continue;var w=1<<l-e;if(r!==Math.floor(c/w)||n!==Math.floor(h/w))continue}else if(e===p.indexMaxZoom||b.numPoints<=p.indexMaxPoints)continue;if(p.solidChildren||!s(b,p.extent,p.buffer)){b.source=null,m>1&&console.time("clipping");var M,k,T,A,S,E,L=.5*p.buffer/p.extent,C=.5-L,I=.5+L,z=1+L;M=k=T=A=null,S=u(t,v,r-L,r+I,0,a,b.min[0],b.max[0]),E=u(t,v,r+C,r+z,0,a,b.min[0],b.max[0]),S&&(M=u(S,v,n-L,n+I,1,o,b.min[1],b.max[1]),k=u(S,v,n+C,n+z,1,o,b.min[1],b.max[1])),E&&(T=u(E,v,n-L,n+I,1,o,b.min[1],b.max[1]),A=u(E,v,n+C,n+z,1,o,b.min[1],b.max[1])),m>1&&console.timeEnd("clipping"),t.length&&(d.push(M||[],e+1,2*r,2*n),d.push(k||[],e+1,2*r,2*n+1),d.push(T||[],e+1,2*r+1,2*n),d.push(A||[],e+1,2*r+1,2*n+1))}else l&&(g=e)}return g},n.prototype.getTile=function(t,e,r){var n=this.options,a=n.extent,o=n.debug,l=1<<t,u=i(t,e=(e%l+l)%l,r);if(this.tiles[u])return c.tile(this.tiles[u],a);o>1&&console.log("drilling down to z%d-%d-%d",t,e,r);for(var h,f=t,d=e,p=r;!h&&f>0;)f--,d=Math.floor(d/2),p=Math.floor(p/2),h=this.tiles[i(f,d,p)];if(!h||!h.source)return null;if(o>1&&console.log("found parent tile z%d-%d-%d",f,d,p),s(h,a,n.buffer))return c.tile(h,a);o>1&&console.time("drilling down");var m=this.splitTile(h.source,f,d,p,t,e,r);if(o>1&&console.timeEnd("drilling down"),null!==m){var g=1<<t-m;u=i(m,Math.floor(e/g),Math.floor(r/g))}return this.tiles[u]?c.tile(this.tiles[u],a):null}},{"./clip":142,"./convert":143,"./tile":147,"./transform":148,"./wrap":149}],146:[function(t,e,r){"use strict";e.exports=function(t,e){var r,n,i,a,o=e*e,s=0,l=t.length-1,c=[];for(t[s][2]=1,t[l][2]=1;l;){for(n=0,r=s+1;r<l;r++)(i=function(t,e,r){var n=e[0],i=e[1],a=r[0],o=r[1],s=t[0],l=t[1],c=a-n,u=o-i;if(0!==c||0!==u){var h=((s-n)*c+(l-i)*u)/(c*c+u*u);h>1?(n=a,i=o):h>0&&(n+=c*h,i+=u*h)}return c=s-n,u=l-i,c*c+u*u}(t[r],t[s],t[l]))>n&&(a=r,n=i);n>o?(t[a][2]=n,c.push(s),c.push(a),s=a):(l=c.pop(),s=c.pop())}}},{}],147:[function(t,e,r){"use strict";e.exports=function(t,e,r,n,i,a){for(var o={features:[],numPoints:0,numSimplified:0,numFeatures:0,source:null,x:r,y:n,z2:e,transformed:!1,min:[2,1],max:[-1,0]},s=0;s<t.length;s++){o.numFeatures++,function(t,e,r,n){var i,a,o,s,l=e.geometry,c=e.type,u=[],h=r*r;if(1===c)for(i=0;i<l.length;i++)u.push(l[i]),t.numPoints++,t.numSimplified++;else for(i=0;i<l.length;i++)if(o=l[i],n||!(2===c&&o.dist<r||3===c&&o.area<h)){var f=[];for(a=0;a<o.length;a++)s=o[a],(n||s[2]>h)&&(f.push(s),t.numSimplified++),t.numPoints++;3===c&&function(t,e){(function(t){for(var e,r,n=0,i=0,a=t.length,o=a-1;i<a;o=i++)e=t[i],r=t[o],n+=(r[0]-e[0])*(e[1]+r[1]);return n})(t)<0===e&&t.reverse()}(f,o.outer),u.push(f)}else t.numPoints+=o.length;if(u.length){var d={geometry:u,type:c,tags:e.tags||null};null!==e.id&&(d.id=e.id),t.features.push(d)}}(o,t[s],i,a);var l=t[s].min,c=t[s].max;l[0]<o.min[0]&&(o.min[0]=l[0]),l[1]<o.min[1]&&(o.min[1]=l[1]),c[0]>o.max[0]&&(o.max[0]=c[0]),c[1]>o.max[1]&&(o.max[1]=c[1])}return o}},{}],148:[function(t,e,r){"use strict";function n(t,e,r,n,i){return[Math.round(e*(t[0]*r-n)),Math.round(e*(t[1]*r-i))]}r.tile=function(t,e){if(t.transformed)return t;var r,i,a,o=t.z2,s=t.x,l=t.y;for(r=0;r<t.features.length;r++){var c=t.features[r],u=c.geometry;if(1===c.type)for(i=0;i<u.length;i++)u[i]=n(u[i],e,o,s,l);else for(i=0;i<u.length;i++){var h=u[i];for(a=0;a<h.length;a++)h[a]=n(h[a],e,o,s,l)}}return t.transformed=!0,t},r.point=n},{}],149:[function(t,e,r){"use strict";function n(t,e){for(var r=[],n=0;n<t.length;n++){var a,s=t[n],l=s.type;if(1===l)a=i(s.geometry,e);else{a=[];for(var c=0;c<s.geometry.length;c++)a.push(i(s.geometry[c],e))}r.push(o(s.tags,l,a,s.id))}return r}function i(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"),o=t("./feature");e.exports=function(t,e,r){var i=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)&&(i=a(t,1,-e,1+e,0,r,-1,2)||[],o&&(i=n(o,1).concat(i)),s&&(i=i.concat(n(s,-1)))),i}},{"./clip":142,"./feature":144}],150:[function(t,e,r){e.exports=function(t,e){if("string"!=typeof t)throw new TypeError("must specify type string");if(e=e||{},"undefined"==typeof document&&!e.canvas)return null;var r=e.canvas||document.createElement("canvas");"number"==typeof e.width&&(r.width=e.width),"number"==typeof e.height&&(r.height=e.height);var n,i=e;try{var a=[t];0===t.indexOf("webgl")&&a.push("experimental-"+t);for(var o=0;o<a.length;o++)if(n=r.getContext(a[o],i))return n}catch(t){n=null}return n||null}},{}],151:[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 a(){this.primalOffset=[0,0,0],this.primalMinor=[0,0,0],this.mirrorOffset=[0,0,0],this.mirrorMinor=[0,0,0]}function o(t,e,r,n,i){for(var a=t.primalOffset,o=t.primalMinor,s=t.mirrorOffset,l=t.mirrorMinor,c=n[e],u=0;u<3;++u)if(e!==u){var h=a,f=s,d=o,p=l;c&1<<u&&(h=s,f=a,d=l,p=o),h[u]=r[0][u],f[u]=r[1][u],i[u]>0?(d[u]=-1,p[u]=0):(d[u]=0,p[u]=1)}}e.exports=function(t,e){var r=new i(t);return r.update(e),r};var s=t("./lib/text.js"),l=t("./lib/lines.js"),c=t("./lib/background.js"),u=t("./lib/cube.js"),h=t("./lib/ticks.js"),f=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),d=i.prototype;d.update=function(t){function e(e,r,n){if(n in t){var i,a=t[n],o=this[n];(e?Array.isArray(a)&&Array.isArray(a[0]):Array.isArray(a))?this[n]=i=[r(a[0]),r(a[1]),r(a[2])]:this[n]=i=[r(a),r(a),r(a)];for(var s=0;s<3;++s)if(i[s]!==o[s])return!0}return!1}t=t||{};var r,n=e.bind(this,!1,Number),i=e.bind(this,!1,Boolean),a=e.bind(this,!1,String),o=e.bind(this,!0,function(t){if(Array.isArray(t)){if(3===t.length)return[+t[0],+t[1],+t[2],1];if(4===t.length)return[+t[0],+t[1],+t[2],+t[3]]}return[0,0,0,1]}),c=!1,u=!1;if("bounds"in t)for(var f=t.bounds,d=0;d<2;++d)for(var p=0;p<3;++p)f[d][p]!==this.bounds[d][p]&&(u=!0),this.bounds[d][p]=f[d][p];if("ticks"in t){r=t.ticks,c=!0,this.autoTicks=!1;for(d=0;d<3;++d)this.tickSpacing[d]=0}else n("tickSpacing")&&(this.autoTicks=!0,u=!0);if(this._firstInit&&("ticks"in t||"tickSpacing"in t||(this.autoTicks=!0),u=!0,c=!0,this._firstInit=!1),u&&this.autoTicks&&(r=h.create(this.bounds,this.tickSpacing),c=!0),c){for(d=0;d<3;++d)r[d].sort(function(t,e){return t.x-e.x});h.equal(r,this.ticks)?c=!1:this.ticks=r}i("tickEnable"),a("tickFont")&&(c=!0),n("tickSize"),n("tickAngle"),n("tickPad"),o("tickColor");var m=a("labels");a("labelFont")&&(m=!0),i("labelEnable"),n("labelSize"),n("labelPad"),o("labelColor"),i("lineEnable"),i("lineMirror"),n("lineWidth"),o("lineColor"),i("lineTickEnable"),i("lineTickMirror"),n("lineTickLength"),n("lineTickWidth"),o("lineTickColor"),i("gridEnable"),n("gridWidth"),o("gridColor"),i("zeroEnable"),o("zeroLineColor"),n("zeroLineWidth"),i("backgroundEnable"),o("backgroundColor"),this._text?this._text&&(m||c)&&this._text.update(this.bounds,this.labels,this.labelFont,this.ticks,this.tickFont):this._text=s(this.gl,this.bounds,this.labels,this.labelFont,this.ticks,this.tickFont),this._lines&&c&&(this._lines.dispose(),this._lines=null),this._lines||(this._lines=l(this.gl,this.bounds,this.ticks))};var p=[new a,new a,new a],m=[0,0,0],g={model:f,view:f,projection:f};d.isOpaque=function(){return!0},d.isTransparent=function(){return!1},d.drawTransparent=function(t){};var v=[0,0,0],y=[0,0,0],b=[0,0,0];d.draw=function(t){t=t||g;for(var e=this.gl,r=t.model||f,i=t.view||f,a=t.projection||f,s=this.bounds,l=u(r,i,a,s),c=l.cubeEdges,h=l.axis,d=i[12],x=i[13],_=i[14],w=i[15],M=this.pixelRatio*(a[3]*d+a[7]*x+a[11]*_+a[15]*w)/e.drawingBufferHeight,k=0;k<3;++k)this.lastCubeProps.cubeEdges[k]=c[k],this.lastCubeProps.axis[k]=h[k];for(var T=p,k=0;k<3;++k)o(p[k],k,this.bounds,c,h);for(var e=this.gl,A=m,k=0;k<3;++k)this.backgroundEnable[k]?A[k]=h[k]:A[k]=0;this._background.draw(r,i,a,s,A,this.backgroundColor),this._lines.bind(r,i,a,this);for(k=0;k<3;++k){var S=[0,0,0];h[k]>0?S[k]=s[1][k]:S[k]=s[0][k];for(D=0;D<2;++D){var E=(k+1+D)%3,L=(k+1+(1^D))%3;this.gridEnable[E]&&this._lines.drawGrid(E,L,this.bounds,S,this.gridColor[E],this.gridWidth[E]*this.pixelRatio)}for(D=0;D<2;++D){var E=(k+1+D)%3,L=(k+1+(1^D))%3;this.zeroEnable[L]&&s[0][L]<=0&&s[1][L]>=0&&this._lines.drawZero(E,L,this.bounds,S,this.zeroLineColor[L],this.zeroLineWidth[L]*this.pixelRatio)}}for(k=0;k<3;++k){this.lineEnable[k]&&this._lines.drawAxisLine(k,this.bounds,T[k].primalOffset,this.lineColor[k],this.lineWidth[k]*this.pixelRatio),this.lineMirror[k]&&this._lines.drawAxisLine(k,this.bounds,T[k].mirrorOffset,this.lineColor[k],this.lineWidth[k]*this.pixelRatio);for(var C=n(v,T[k].primalMinor),I=n(y,T[k].mirrorMinor),z=this.lineTickLength,D=0;D<3;++D){var P=M/r[5*D];C[D]*=z[D]*P,I[D]*=z[D]*P}this.lineTickEnable[k]&&this._lines.drawAxisTicks(k,T[k].primalOffset,C,this.lineTickColor[k],this.lineTickWidth[k]*this.pixelRatio),this.lineTickMirror[k]&&this._lines.drawAxisTicks(k,T[k].mirrorOffset,I,this.lineTickColor[k],this.lineTickWidth[k]*this.pixelRatio)}this._text.bind(r,i,a,this.pixelRatio);for(k=0;k<3;++k){for(var O=T[k].primalMinor,R=n(b,T[k].primalOffset),D=0;D<3;++D)this.lineTickEnable[k]&&(R[D]+=M*O[D]*Math.max(this.lineTickLength[D],0)/r[5*D]);if(this.tickEnable[k]){for(D=0;D<3;++D)R[D]+=M*O[D]*this.tickPad[D]/r[5*D];this._text.drawTicks(k,this.tickSize[k],this.tickAngle[k],R,this.tickColor[k])}if(this.labelEnable[k]){for(D=0;D<3;++D)R[D]+=M*O[D]*this.labelPad[D]/r[5*D];R[k]+=.5*(s[0][k]+s[1][k]),this._text.drawLabel(k,this.labelSize[k],this.labelAngle[k],R,this.labelColor[k])}}},d.dispose=function(){this._text.dispose(),this._lines.dispose(),this._background.dispose(),this._lines=null,this._text=null,this._background=null,this.gl=null}},{"./lib/background.js":152,"./lib/cube.js":153,"./lib/lines.js":154,"./lib/text.js":156,"./lib/ticks.js":157}],152:[function(t,e,r){"use strict";function n(t,e,r,n){this.gl=t,this.buffer=e,this.vao=r,this.shader=n}e.exports=function(t){for(var e=[],r=[],s=0,l=0;l<3;++l)for(var c=(l+1)%3,u=(l+2)%3,h=[0,0,0],f=[0,0,0],d=-1;d<=1;d+=2){r.push(s,s+2,s+1,s+1,s+2,s+3),h[l]=d,f[l]=d;for(var p=-1;p<=1;p+=2){h[c]=p;for(var m=-1;m<=1;m+=2)h[u]=m,e.push(h[0],h[1],h[2],f[0],f[1],f[2]),s+=1}var g=c;c=u,u=g}var v=i(t,new Float32Array(e)),y=i(t,new Uint16Array(r),t.ELEMENT_ARRAY_BUFFER),b=a(t,[{buffer:v,type:t.FLOAT,size:3,offset:0,stride:24},{buffer:v,type:t.FLOAT,size:3,offset:12,stride:24}],y),x=o(t);return x.attributes.position.location=0,x.attributes.normal.location=1,new n(t,v,b,x)};var i=t("gl-buffer"),a=t("gl-vao"),o=t("./shaders").bg,s=n.prototype;s.draw=function(t,e,r,n,i,a){for(var o=!1,s=0;s<3;++s)o=o||i[s];if(o){var l=this.gl;l.enable(l.POLYGON_OFFSET_FILL),l.polygonOffset(1,2),this.shader.bind(),this.shader.uniforms={model:t,view:e,projection:r,bounds:n,enable:i,colors:a},this.vao.bind(),this.vao.draw(this.gl.TRIANGLES,36),l.disable(l.POLYGON_OFFSET_FILL)}},s.dispose=function(){this.vao.dispose(),this.buffer.dispose(),this.shader.dispose()}},{"./shaders":155,"gl-buffer":159,"gl-vao":274}],153:[function(t,e,r){"use strict";function n(t,e,r){for(var n=0;n<4;++n){t[n]=r[12+n];for(var i=0;i<3;++i)t[n]+=e[i]*r[4*i+n]}}function i(t){for(a=0;a<p.length;++a)if((t=s.positive(t,p[a])).length<3)return 0;for(var e=t[0],r=e[0]/e[3],n=e[1]/e[3],i=0,a=1;a+1<t.length;++a){var o=t[a],l=t[a+1],c=o[0]/o[3]-r,u=o[1]/o[3]-n,h=l[0]/l[3]-r,f=l[1]/l[3]-n;i+=Math.abs(c*f-u*h)}return i}e.exports=function(t,e,r,s){o(c,e,t),o(c,r,c);for(var p=0,y=0;y<2;++y){f[2]=s[y][2];for(var b=0;b<2;++b){f[1]=s[b][1];for(var x=0;x<2;++x)f[0]=s[x][0],n(u[p],f,c),p+=1}}for(var _=-1,y=0;y<8;++y){for(var w=u[y][3],M=0;M<3;++M)h[y][M]=u[y][M]/w;w<0&&(_<0?_=y:h[y][2]<h[_][2]&&(_=y))}if(_<0)for(_=0,V=0;V<3;++V){for(var k=(V+2)%3,T=(V+1)%3,A=-1,S=-1,E=0;E<2;++E){var L=(I=E<<V)+(E<<k)+(1-E<<T),C=I+(1-E<<k)+(E<<T);l(h[I],h[L],h[C],d)<0||(E?A=1:S=1)}if(A<0||S<0)S>A&&(_|=1<<V);else{for(E=0;E<2;++E){var I=E<<V,L=I+(E<<k)+(1-E<<T),C=I+(1-E<<k)+(E<<T),z=i([u[I],u[L],u[C],u[I+(1<<k)+(1<<T)]]);E?A=z:S=z}S>A&&(_|=1<<V)}}for(var D=7^_,P=-1,y=0;y<8;++y)y!==_&&y!==D&&(P<0?P=y:h[P][1]>h[y][1]&&(P=y));for(var O=-1,y=0;y<3;++y)(F=P^1<<y)!==_&&F!==D&&(O<0&&(O=F),(T=h[F])[0]<h[O][0]&&(O=F));for(var R=-1,y=0;y<3;++y){var F=P^1<<y;F!==_&&F!==D&&F!==O&&(R<0&&(R=F),(T=h[F])[0]>h[R][0]&&(R=F))}var j=m;j[0]=j[1]=j[2]=0,j[a.log2(O^P)]=P&O,j[a.log2(P^R)]=P&R;var N=7^R;N===_||N===D?(N=7^O,j[a.log2(R^N)]=N&R):j[a.log2(O^N)]=N&O;for(var B=g,U=_,V=0;V<3;++V)B[V]=U&1<<V?-1:1;return v};var a=t("bit-twiddle"),o=t("gl-mat4/multiply"),s=(t("gl-mat4/invert"),t("split-polygon")),l=t("robust-orientation"),c=new Array(16),u=(new Array(16),new Array(8)),h=new Array(8),f=new Array(3),d=[0,0,0];!function(){for(var t=0;t<8;++t)u[t]=[1,1,1,1],h[t]=[1,1,1]}();var p=[[0,0,1,0,0],[0,0,-1,1,0],[0,-1,0,1,0],[0,1,0,1,0],[-1,0,0,1,0],[1,0,0,1,0]],m=[1,1,1],g=[0,0,0],v={cubeEdges:m,axis:g}},{"bit-twiddle":70,"gl-mat4/invert":184,"gl-mat4/multiply":186,"robust-orientation":519,"split-polygon":537}],154:[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 a(t,e,r,n,i,a,o,s){this.gl=t,this.vertBuffer=e,this.vao=r,this.shader=n,this.tickCount=i,this.tickOffset=a,this.gridCount=o,this.gridOffset=s}e.exports=function(t,e,r){var n=[],i=[0,0,0],c=[0,0,0],u=[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;f<3;++f){for(var d=n.length/3|0,p=0;p<r[f].length;++p)g=+r[f][p].x,n.push(g,0,1,g,1,1,g,0,-1,g,0,-1,g,1,1,g,1,-1);v=n.length/3|0,i[f]=d,c[f]=v-d;for(var d=n.length/3|0,m=0;m<r[f].length;++m){var g=+r[f][m].x;n.push(g,0,1,g,1,1,g,0,-1,g,0,-1,g,1,1,g,1,-1)}var v=n.length/3|0;u[f]=d,h[f]=v-d}var y=o(t,new Float32Array(n)),b=s(t,[{buffer:y,type:t.FLOAT,size:3,stride:0,offset:0}]),x=l(t);return x.attributes.position.location=0,new a(t,y,b,x,c,i,h,u)};var o=t("gl-buffer"),s=t("gl-vao"),l=t("./shaders").line,c=[0,0,0],u=[0,0,0],h=[0,0,0],f=[0,0,0],d=[1,1],p=a.prototype;p.bind=function(t,e,r){this.shader.bind(),this.shader.uniforms.model=t,this.shader.uniforms.view=e,this.shader.uniforms.projection=r,d[0]=this.gl.drawingBufferWidth,d[1]=this.gl.drawingBufferHeight,this.shader.uniforms.screenShape=d,this.vao.bind()},p.drawAxisLine=function(t,e,r,a,o){var s=n(u);this.shader.uniforms.majorAxis=u,s[t]=e[1][t]-e[0][t],this.shader.uniforms.minorAxis=s;var l=i(f,r);l[t]+=e[0][t],this.shader.uniforms.offset=l,this.shader.uniforms.lineWidth=o,this.shader.uniforms.color=a;c=n(h);c[(t+2)%3]=1,this.shader.uniforms.screenAxis=c,this.vao.draw(this.gl.TRIANGLES,6);var c;(c=n(h))[(t+1)%3]=1,this.shader.uniforms.screenAxis=c,this.vao.draw(this.gl.TRIANGLES,6)},p.drawAxisTicks=function(t,e,r,i,a){if(this.tickCount[t]){var o=n(c);o[t]=1,this.shader.uniforms.majorAxis=o,this.shader.uniforms.offset=e,this.shader.uniforms.minorAxis=r,this.shader.uniforms.color=i,this.shader.uniforms.lineWidth=a;var s=n(h);s[t]=1,this.shader.uniforms.screenAxis=s,this.vao.draw(this.gl.TRIANGLES,this.tickCount[t],this.tickOffset[t])}},p.drawGrid=function(t,e,r,a,o,s){if(this.gridCount[t]){var l=n(u);l[e]=r[1][e]-r[0][e],this.shader.uniforms.minorAxis=l;var d=i(f,a);d[e]+=r[0][e],this.shader.uniforms.offset=d;var p=n(c);p[t]=1,this.shader.uniforms.majorAxis=p;var m=n(h);m[t]=1,this.shader.uniforms.screenAxis=m,this.shader.uniforms.lineWidth=s,this.shader.uniforms.color=o,this.vao.draw(this.gl.TRIANGLES,this.gridCount[t],this.gridOffset[t])}},p.drawZero=function(t,e,r,a,o,s){var l=n(u);this.shader.uniforms.majorAxis=l,l[t]=r[1][t]-r[0][t],this.shader.uniforms.minorAxis=l;var c=i(f,a);c[t]+=r[0][t],this.shader.uniforms.offset=c;var d=n(h);d[e]=1,this.shader.uniforms.screenAxis=d,this.shader.uniforms.lineWidth=s,this.shader.uniforms.color=o,this.vao.draw(this.gl.TRIANGLES,6)},p.dispose=function(){this.vao.dispose(),this.vertBuffer.dispose(),this.shader.dispose()}},{"./shaders":155,"gl-buffer":159,"gl-vao":274}],155:[function(t,e,r){"use strict";var n=t("gl-shader");r.line=function(t){return n(t,"#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","precision mediump float;\n#define GLSLIFY 1\nuniform vec4 color;\nvoid main() {\n gl_FragColor = color;\n}",null,[{name:"position",type:"vec3"}])};r.text=function(t){return n(t,"#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}","precision mediump float;\n#define GLSLIFY 1\nuniform vec4 color;\nvoid main() {\n gl_FragColor = color;\n}",null,[{name:"position",type:"vec3"}])};r.bg=function(t){return n(t,"#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}","precision mediump float;\n#define GLSLIFY 1\n\nuniform vec4 colors[3];\n\nvarying vec3 colorChannel;\n\nvoid main() {\n gl_FragColor = colorChannel.x * colors[0] + \n colorChannel.y * colors[1] +\n colorChannel.z * colors[2];\n}",null,[{name:"position",type:"vec3"},{name:"normal",type:"vec3"}])}},{"gl-shader":258}],156:[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}e.exports=function(t,e,r,o,l,c){var u=i(t),h=a(t,[{buffer:u,size:3}]),f=s(t);f.attributes.position.location=0;var d=new n(t,f,u,h);return d.update(e,r,o,l,c),d};var i=t("gl-buffer"),a=t("gl-vao"),o=t("vectorize-text"),s=t("./shaders").text,l=window||r.global||{},c=l.__TEXT_CACHE||{};l.__TEXT_CACHE={};var u=n.prototype,h=[0,0];u.bind=function(t,e,r,n){this.vao.bind(),this.shader.bind();var i=this.shader.uniforms;i.model=t,i.view=e,i.projection=r,i.pixelScale=n,h[0]=this.gl.drawingBufferWidth,h[1]=this.gl.drawingBufferHeight,this.shader.uniforms.resolution=h},u.update=function(t,e,r,n,i){function a(t,e,r,n){var i=c[r];i||(i=c[r]={});var a=i[e];a||(a=i[e]=function(t,e){try{return o(t,e)}catch(t){return console.warn("error vectorizing text:",t),{cells:[],positions:[]}}}(e,{triangles:!0,font:r,textAlign:"center",textBaseline:"middle"}));for(var l=(n||12)/12,u=a.positions,h=a.cells,f=0,d=h.length;f<d;++f)for(var p=h[f],m=2;m>=0;--m){var g=u[p[m]];s.push(l*g[0],-l*g[1],t)}}this.gl;for(var s=[],l=[0,0,0],u=[0,0,0],h=[0,0,0],f=[0,0,0],d=0;d<3;++d){h[d]=s.length/3|0,a(.5*(t[0][d]+t[1][d]),e[d],r),f[d]=(s.length/3|0)-h[d],l[d]=s.length/3|0;for(var p=0;p<n[d].length;++p)n[d][p].text&&a(n[d][p].x,n[d][p].text,n[d][p].font||i,n[d][p].fontSize||12);u[d]=(s.length/3|0)-l[d]}this.buffer.update(s),this.tickOffset=l,this.tickCount=u,this.labelOffset=h,this.labelCount=f};var f=[0,0,0];u.drawTicks=function(t,e,r,n,i){if(this.tickCount[t]){var a=f;a[0]=a[1]=a[2]=0,a[t]=1,this.shader.uniforms.axis=a,this.shader.uniforms.color=i,this.shader.uniforms.angle=r,this.shader.uniforms.scale=e,this.shader.uniforms.offset=n,this.vao.draw(this.gl.TRIANGLES,this.tickCount[t],this.tickOffset[t])}};var d=[0,0,0];u.drawLabel=function(t,e,r,n,i){this.labelCount[t]&&(this.shader.uniforms.axis=d,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]))},u.dispose=function(){this.shader.dispose(),this.vao.dispose(),this.buffer.dispose()}}).call(this,t("_process"))},{"./shaders":155,_process:498,"gl-buffer":159,"gl-vao":274,"vectorize-text":565}],157:[function(t,e,r){"use strict";function n(t,e){var r=t+"",n=r.indexOf("."),i=0;n>=0&&(i=r.length-n-1);var a=Math.pow(10,i),o=Math.round(t*e*a),s=o+"";if(s.indexOf("e")>=0)return s;var l=o/a,c=o%a;o<0?(l=0|-Math.ceil(l),c=0|-c):(l=0|Math.floor(l),c|=0);var u=""+l;if(o<0&&(u="-"+u),i){for(var h=""+c;h.length<i;)h="0"+h;return u+"."+h}return u}r.create=function(t,e){for(var r=[],i=0;i<3;++i){for(var a=[],o=(t[0][i],t[1][i],0);o*e[i]<=t[1][i];++o)a.push({x:o*e[i],text:n(e[i],o)});for(o=-1;o*e[i]>=t[0][i];--o)a.push({x:o*e[i],text:n(e[i],o)});r.push(a)}return r},r.equal=function(t,e){for(var r=0;r<3;++r){if(t[r].length!==e[r].length)return!1;for(var n=0;n<t[r].length;++n){var i=t[r][n],a=e[r][n];if(i.x!==a.x||i.text!==a.text||i.font!==a.font||i.fontColor!==a.fontColor||i.fontSize!==a.fontSize||i.dx!==a.dx||i.dy!==a.dy)return!1}}return!0}},{}],158:[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 a=0;a<3;++a){for(var o=d,s=p,l=0;l<3;++l)s[l]=o[l]=r[l];s[3]=o[3]=1,s[a]+=1,u(s,s,e),s[3]<0&&(t[a]=1/0),o[a]-=1,u(o,o,e),o[3]<0&&(t[a]=1/0);var c=(o[0]/o[3]-s[0]/s[3])*n,h=(o[1]/o[3]-s[1]/s[3])*i;t[a]=.25*Math.sqrt(c*c+h*h)}return t}e.exports=function(t,e,r,n,u){var d=e.model||h,p=e.view||h,v=e.projection||h,y=t.bounds,b=(u=u||s(d,p,v,y)).axis;u.edges,l(f,p,d),l(f,v,f);for(var x=m,_=0;_<3;++_)x[_].lo=1/0,x[_].hi=-1/0,x[_].pixelsPerDataUnit=1/0;var w=a(c(f,f));c(f,f);for(var M=0;M<3;++M){var k=(M+1)%3,T=(M+2)%3,A=g;t:for(_=0;_<2;++_){var S=[];if(b[M]<0!=!!_){for(A[M]=y[_][M],E=0;E<2;++E)for(A[k]=y[E^_][k],C=0;C<2;++C)A[T]=y[C^E^_][T],S.push(A.slice());for(E=0;E<w.length;++E){if(0===S.length)continue t;S=o.positive(S,w[E])}for(var E=0;E<S.length;++E)for(var T=S[E],L=i(g,f,T,r,n),C=0;C<3;++C)x[C].lo=Math.min(x[C].lo,T[C]),x[C].hi=Math.max(x[C].hi,T[C]),C!==M&&(x[C].pixelsPerDataUnit=Math.min(x[C].pixelsPerDataUnit,Math.abs(L[C])))}}}return x};var a=t("extract-frustum-planes"),o=t("split-polygon"),s=t("./lib/cube.js"),l=t("gl-mat4/multiply"),c=t("gl-mat4/transpose"),u=t("gl-vec4/transformMat4"),h=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),f=new Float32Array(16),d=[0,0,0,1],p=[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":153,"extract-frustum-planes":133,"gl-mat4/multiply":186,"gl-mat4/transpose":194,"gl-vec4/transformMat4":280,"split-polygon":537}],159:[function(t,e,r){"use strict";function n(t,e,r,n,i){this.gl=t,this.type=e,this.handle=r,this.length=n,this.usage=i}function i(t,e,r,n,i,a){var o=i.length*i.BYTES_PER_ELEMENT;if(a<0)return t.bufferData(e,i,n),o;if(o+a>r)throw new Error("gl-buffer: If resizing buffer, must not specify offset");return t.bufferSubData(e,a,i),r}function a(t,e){for(var r=o.malloc(t.length,e),n=t.length,i=0;i<n;++i)r[i]=t[i];return r}var o=t("typedarray-pool"),s=t("ndarray-ops"),l=t("ndarray"),c=["uint8","uint8_clamped","uint16","uint32","int8","int16","int32","float32"],u=n.prototype;u.bind=function(){this.gl.bindBuffer(this.type,this.handle)},u.unbind=function(){this.gl.bindBuffer(this.type,null)},u.dispose=function(){this.gl.deleteBuffer(this.handle)},u.update=function(t,e){if("number"!=typeof e&&(e=-1),this.bind(),"object"==typeof t&&void 0!==t.shape){var r=t.dtype;if(c.indexOf(r)<0&&(r="float32"),this.type===this.gl.ELEMENT_ARRAY_BUFFER){r=gl.getExtension("OES_element_index_uint")&&"uint16"!==r?"uint32":"uint16"}if(r===t.dtype&&function(t,e){for(var r=1,n=e.length-1;n>=0;--n){if(e[n]!==r)return!1;r*=t[n]}return!0}(t.shape,t.stride))0===t.offset&&t.data.length===t.shape[0]?this.length=i(this.gl,this.type,this.length,this.usage,t.data,e):this.length=i(this.gl,this.type,this.length,this.usage,t.data.subarray(t.offset,t.shape[0]),e);else{var n=o.malloc(t.size,r),u=l(n,t.shape);s.assign(u,t),this.length=e<0?i(this.gl,this.type,this.length,this.usage,n,e):i(this.gl,this.type,this.length,this.usage,n.subarray(0,t.size),e),o.free(n)}}else if(Array.isArray(t)){var h;h=this.type===this.gl.ELEMENT_ARRAY_BUFFER?a(t,"uint16"):a(t,"float32"),this.length=e<0?i(this.gl,this.type,this.length,this.usage,h,e):i(this.gl,this.type,this.length,this.usage,h.subarray(0,t.length),e),o.free(h)}else if("object"==typeof t&&"number"==typeof t.length)this.length=i(this.gl,this.type,this.length,this.usage,t,e);else{if("number"!=typeof t&&void 0!==t)throw new Error("gl-buffer: Invalid data type");if(e>=0)throw new Error("gl-buffer: Cannot specify offset when resizing buffer");(t|=0)<=0&&(t=1),this.gl.bufferData(this.type,0|t,this.usage),this.length=t}},e.exports=function(t,e,r,i){if(r=r||t.ARRAY_BUFFER,i=i||t.DYNAMIC_DRAW,r!==t.ARRAY_BUFFER&&r!==t.ELEMENT_ARRAY_BUFFER)throw new Error("gl-buffer: Invalid type for webgl buffer, must be either gl.ARRAY_BUFFER or gl.ELEMENT_ARRAY_BUFFER");if(i!==t.DYNAMIC_DRAW&&i!==t.STATIC_DRAW&&i!==t.STREAM_DRAW)throw new Error("gl-buffer: Invalid usage for buffer, must be either gl.DYNAMIC_DRAW, gl.STATIC_DRAW or gl.STREAM_DRAW");var a=new n(t,r,t.createBuffer(),0,i);return a.update(e),a}},{ndarray:470,"ndarray-ops":464,"typedarray-pool":552}],160:[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"}},{}],161:[function(t,e,r){var n=t("./1.0/numbers");e.exports=function(t){return n[t]}},{"./1.0/numbers":160}],162:[function(t,e,r){"use strict";function n(t,e,r,n){this.plot=t,this.shader=e,this.bufferHi=r,this.bufferLo=n,this.bounds=[1/0,1/0,-1/0,-1/0],this.numPoints=0,this.color=[0,0,0,1]}var i=t("gl-shader"),a=t("gl-buffer"),o=t("typedarray-pool"),s=t("./lib/shaders");e.exports=function(t,e){var r=new n(t,i(t.gl,s.vertex,s.fragment),a(t.gl),a(t.gl));return r.update(e),t.addObject(r),r};var l=[[1,0,0,1,0,0],[1,0,0,-1,0,0],[-1,0,0,-1,0,0],[-1,0,0,-1,0,0],[-1,0,0,1,0,0],[1,0,0,1,0,0],[1,0,-1,0,0,1],[1,0,-1,0,0,-1],[1,0,1,0,0,-1],[1,0,1,0,0,-1],[1,0,1,0,0,1],[1,0,-1,0,0,1],[-1,0,-1,0,0,1],[-1,0,-1,0,0,-1],[-1,0,1,0,0,-1],[-1,0,1,0,0,-1],[-1,0,1,0,0,1],[-1,0,-1,0,0,1],[0,1,1,0,0,0],[0,1,-1,0,0,0],[0,-1,-1,0,0,0],[0,-1,-1,0,0,0],[0,1,1,0,0,0],[0,-1,1,0,0,0],[0,1,0,-1,1,0],[0,1,0,-1,-1,0],[0,1,0,1,-1,0],[0,1,0,1,1,0],[0,1,0,-1,1,0],[0,1,0,1,-1,0],[0,-1,0,-1,1,0],[0,-1,0,-1,-1,0],[0,-1,0,1,-1,0],[0,-1,0,1,1,0],[0,-1,0,-1,1,0],[0,-1,0,1,-1,0]],c=n.prototype;c.draw=function(){var t=new Float32Array([0,0]),e=new Float32Array([0,0]),r=new Float32Array([0,0]),n=new Float32Array([0,0]),i=[1,1];return function(){var a=this.plot,o=this.shader,s=this.bounds,c=this.numPoints;if(c){var u=a.gl,h=a.dataBox,f=a.viewBox,d=a.pixelRatio,p=s[2]-s[0],m=s[3]-s[1],g=h[2]-h[0],v=h[3]-h[1],y=2*p/g,b=2*m/v,x=(s[0]-h[0]-.5*g)/p,_=(s[1]-h[1]-.5*v)/m;t[0]=y,t[1]=b,e[0]=y-t[0],e[1]=b-t[1],r[0]=x,r[1]=_,n[0]=x-r[0],n[1]=_-r[1];var w=f[2]-f[0],M=f[3]-f[1];i[0]=2*d/w,i[1]=2*d/M,o.bind(),o.uniforms.scaleHi=t,o.uniforms.scaleLo=e,o.uniforms.translateHi=r,o.uniforms.translateLo=n,o.uniforms.pixelScale=i,o.uniforms.color=this.color,this.bufferLo.bind(),o.attributes.positionLo.pointer(u.FLOAT,!1,16,0),this.bufferHi.bind(),o.attributes.positionHi.pointer(u.FLOAT,!1,16,0),o.attributes.pixelOffset.pointer(u.FLOAT,!1,16,8),u.drawArrays(u.TRIANGLES,0,c*l.length)}}}(),c.drawPick=function(t){return t},c.pick=function(){return null},c.update=function(t){var e,r,n,i=(t=t||{}).positions||[],a=t.errors||[],s=1;"lineWidth"in t&&(s=+t.lineWidth);var c=5;"capSize"in t&&(c=+t.capSize),this.color=(t.color||[0,0,0,1]).slice();var u=this.bounds=[1/0,1/0,-1/0,-1/0],h=this.numPoints=i.length>>1;for(e=0;e<h;++e)r=i[2*e],n=i[2*e+1],u[0]=Math.min(r,u[0]),u[1]=Math.min(n,u[1]),u[2]=Math.max(r,u[2]),u[3]=Math.max(n,u[3]);u[2]===u[0]&&(u[2]+=1),u[3]===u[1]&&(u[3]+=1);var f=1/(u[2]-u[0]),d=1/(u[3]-u[1]),p=u[0],m=u[1],g=o.mallocFloat64(h*l.length*4),v=o.mallocFloat32(h*l.length*4),y=o.mallocFloat32(h*l.length*4),b=0;for(e=0;e<h;++e){r=i[2*e],n=i[2*e+1];for(var x=a[4*e],_=a[4*e+1],w=a[4*e+2],M=a[4*e+3],k=0;k<l.length;++k){var T=l[k],A=T[0],S=T[1];A<0?A*=x:A>0&&(A*=_),S<0?S*=w:S>0&&(S*=M),g[b++]=f*(r-p+A),g[b++]=d*(n-m+S),g[b++]=s*T[2]+(c+s)*T[4],g[b++]=s*T[3]+(c+s)*T[5]}}for(e=0;e<g.length;e++)v[e]=g[e],y[e]=g[e]-v[e];this.bufferHi.update(v),this.bufferLo.update(y),o.free(g)},c.dispose=function(){this.plot.removeObject(this),this.shader.dispose(),this.bufferHi.dispose(),this.bufferLo.dispose()}},{"./lib/shaders":163,"gl-buffer":159,"gl-shader":258,"typedarray-pool":552}],163:[function(t,e,r){e.exports={vertex:"precision highp float;\n#define GLSLIFY 1\n\nattribute vec2 positionHi;\nattribute vec2 positionLo;\nattribute vec2 pixelOffset;\n\nuniform vec2 scaleHi, scaleLo, translateHi, translateLo, pixelScale;\n\nvec2 project(vec2 scHi, vec2 trHi, vec2 scLo, vec2 trLo, vec2 posHi, vec2 posLo) {\n return (posHi + trHi) * scHi\n + (posLo + trLo) * scHi\n + (posHi + trHi) * scLo\n + (posLo + trLo) * scLo;\n}\n\nvoid main() {\n vec3 scrPosition = vec3(\n project(scaleHi, translateHi, scaleLo, translateLo, positionHi, positionLo),\n 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"}},{}],164:[function(t,e,r){"use strict";function n(t,e,r,n){this.gl=t,this.shader=n,this.buffer=e,this.vao=r,this.pixelRatio=1,this.bounds=[[1/0,1/0,1/0],[-1/0,-1/0,-1/0]],this.clipBounds=[[-1/0,-1/0,-1/0],[1/0,1/0,1/0]],this.lineWidth=[1,1,1],this.capSize=[10,10,10],this.lineCount=[0,0,0],this.lineOffset=[0,0,0],this.opacity=1}function i(t,e){for(var r=0;r<3;++r)t[0][r]=Math.min(t[0][r],e[r]),t[1][r]=Math.max(t[1][r],e[r])}function a(t,e,r,n){for(var i=h[n],a=0;a<i.length;++a){var o=i[a];t.push(e[0],e[1],e[2],r[0],r[1],r[2],r[3],o[0],o[1],o[2])}return i.length}e.exports=function(t){var e=t.gl,r=o(e),i=s(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}]),a=l(e);a.attributes.position.location=0,a.attributes.color.location=1,a.attributes.offset.location=2;var c=new n(e,r,i,a);return c.update(t),c};var o=t("gl-buffer"),s=t("gl-vao"),l=t("./shaders/index"),c=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],u=n.prototype;u.isOpaque=function(){return this.opacity>=1},u.isTransparent=function(){return this.opacity<1},u.drawTransparent=u.draw=function(t){var e=this.gl,r=this.shader.uniforms;this.shader.bind();var n=r.view=t.view||c,i=r.projection=t.projection||c;r.model=t.model||c,r.clipBounds=this.clipBounds,r.opacity=this.opacity;var a=n[12],o=n[13],s=n[14],l=n[15],u=this.pixelRatio*(i[3]*a+i[7]*o+i[11]*s+i[15]*l)/e.drawingBufferHeight;this.vao.bind();for(var h=0;h<3;++h)e.lineWidth(this.lineWidth[h]),r.capSize=this.capSize[h]*u,this.lineCount[h]&&e.drawArrays(e.LINES,this.lineOffset[h],this.lineCount[h]);this.vao.unbind()};var h=function(){for(var t=new Array(3),e=0;e<3;++e){for(var r=[],n=1;n<=2;++n)for(var i=-1;i<=1;i+=2){var a=[0,0,0];a[(n+e)%3]=i,r.push(a)}t[e]=r}return t}();u.update=function(t){"lineWidth"in(t=t||{})&&(this.lineWidth=t.lineWidth,Array.isArray(this.lineWidth)||(this.lineWidth=[this.lineWidth,this.lineWidth,this.lineWidth])),"capSize"in t&&(this.capSize=t.capSize,Array.isArray(this.capSize)||(this.capSize=[this.capSize,this.capSize,this.capSize])),"opacity"in t&&(this.opacity=t.opacity);var e=t.color||[[0,0,0],[0,0,0],[0,0,0]],r=t.position,n=t.error;if(Array.isArray(e[0])||(e=[e,e,e]),r&&n){var o=[],s=r.length,l=0;this.bounds=[[1/0,1/0,1/0],[-1/0,-1/0,-1/0]],this.lineCount=[0,0,0];for(var c=0;c<3;++c){this.lineOffset[c]=l;t:for(var u=0;u<s;++u){for(var h=r[u],f=0;f<3;++f)if(isNaN(h[f])||!isFinite(h[f]))continue t;var d=n[u],p=e[c];if(Array.isArray(p[0])&&(p=e[u]),3===p.length&&(p=[p[0],p[1],p[2],1]),!isNaN(d[0][c])&&!isNaN(d[1][c])){if(d[0][c]<0){(m=h.slice())[c]+=d[0][c],o.push(h[0],h[1],h[2],p[0],p[1],p[2],p[3],0,0,0,m[0],m[1],m[2],p[0],p[1],p[2],p[3],0,0,0),i(this.bounds,m),l+=2+a(o,m,p,c)}if(d[1][c]>0){var m=h.slice();m[c]+=d[1][c],o.push(h[0],h[1],h[2],p[0],p[1],p[2],p[3],0,0,0,m[0],m[1],m[2],p[0],p[1],p[2],p[3],0,0,0),i(this.bounds,m),l+=2+a(o,m,p,c)}}}this.lineCount[c]=l-this.lineOffset[c]}this.buffer.update(o)}},u.dispose=function(){this.shader.dispose(),this.buffer.dispose(),this.vao.dispose()}},{"./shaders/index":166,"gl-buffer":159,"gl-vao":274}],165:[function(t,e,r){e.exports=function(t){"string"==typeof t&&(t=[t]);for(var e=[].slice.call(arguments,1),r=[],n=0;n<t.length-1;n++)r.push(t[n],e[n]||"");return r.push(t[n]),r.join("")}},{}],166:[function(t,e,r){"use strict";var n=t("glslify"),i=t("gl-shader"),a=n(["precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position, offset;\nattribute vec4 color;\nuniform mat4 model, view, projection;\nuniform float capSize;\nvarying vec4 fragColor;\nvarying vec3 fragPosition;\n\nvoid main() {\n vec4 worldPosition = model * vec4(position, 1.0);\n worldPosition = (worldPosition / worldPosition.w) + vec4(capSize * offset, 0.0);\n gl_Position = projection * view * worldPosition;\n fragColor = color;\n fragPosition = position;\n}"]),o=n(["precision 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 i(t,a,o,null,[{name:"position",type:"vec3"},{name:"color",type:"vec4"},{name:"offset",type:"vec3"}])}},{"gl-shader":258,glslify:165}],167:[function(t,e,r){"use strict";function n(t){return[t.getParameter(t.FRAMEBUFFER_BINDING),t.getParameter(t.RENDERBUFFER_BINDING),t.getParameter(t.TEXTURE_BINDING_2D)]}function i(t,e){t.bindFramebuffer(t.FRAMEBUFFER,e[0]),t.bindRenderbuffer(t.RENDERBUFFER,e[1]),t.bindTexture(t.TEXTURE_2D,e[2])}function a(t){switch(t){case h:throw new Error("gl-fbo: Framebuffer unsupported");case f:throw new Error("gl-fbo: Framebuffer incomplete attachment");case d:throw new Error("gl-fbo: Framebuffer incomplete dimensions");case p:throw new Error("gl-fbo: Framebuffer incomplete missing attachment");default:throw new Error("gl-fbo: Framebuffer failed for unspecified reason")}}function o(t,e,r,n,i,a){if(!n)return null;var o=u(t,e,r,i,n);return o.magFilter=t.NEAREST,o.minFilter=t.NEAREST,o.mipSamples=1,o.bind(),t.framebufferTexture2D(t.FRAMEBUFFER,a,t.TEXTURE_2D,o.handle,0),o}function s(t,e,r,n,i){var a=t.createRenderbuffer();return t.bindRenderbuffer(t.RENDERBUFFER,a),t.renderbufferStorage(t.RENDERBUFFER,n,e,r),t.framebufferRenderbuffer(t.FRAMEBUFFER,i,t.RENDERBUFFER,a),a}function l(t,e,r,l,c,u,h,f){this.gl=t,this._shape=[0|e,0|r],this._destroyed=!1,this._ext=f,this.color=new Array(c);for(var d=0;d<c;++d)this.color[d]=null;this._color_rb=null,this.depth=null,this._depth_rb=null,this._colorType=l,this._useDepth=u,this._useStencil=h;var p=this,g=[0|e,0|r];Object.defineProperties(g,{0:{get:function(){return p._shape[0]},set:function(t){return p.width=t}},1:{get:function(){return p._shape[1]},set:function(t){return p.height=t}}}),this._shapeVector=g,function(t){var e=n(t.gl),r=t.gl,l=t.handle=r.createFramebuffer(),c=t._shape[0],u=t._shape[1],h=t.color.length,f=t._ext,d=t._useStencil,p=t._useDepth,g=t._colorType;for(r.bindFramebuffer(r.FRAMEBUFFER,l),b=0;b<h;++b)t.color[b]=o(r,c,u,g,r.RGBA,r.COLOR_ATTACHMENT0+b);0===h?(t._color_rb=s(r,c,u,r.RGBA4,r.COLOR_ATTACHMENT0),f&&f.drawBuffersWEBGL(m[0])):h>1&&f.drawBuffersWEBGL(m[h]);var v=r.getExtension("WEBGL_depth_texture");v?d?t.depth=o(r,c,u,v.UNSIGNED_INT_24_8_WEBGL,r.DEPTH_STENCIL,r.DEPTH_STENCIL_ATTACHMENT):p&&(t.depth=o(r,c,u,r.UNSIGNED_SHORT,r.DEPTH_COMPONENT,r.DEPTH_ATTACHMENT)):p&&d?t._depth_rb=s(r,c,u,r.DEPTH_STENCIL,r.DEPTH_STENCIL_ATTACHMENT):p?t._depth_rb=s(r,c,u,r.DEPTH_COMPONENT16,r.DEPTH_ATTACHMENT):d&&(t._depth_rb=s(r,c,u,r.STENCIL_INDEX,r.STENCIL_ATTACHMENT));var y=r.checkFramebufferStatus(r.FRAMEBUFFER);if(y!==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 b=0;b<t.color.length;++b)t.color[b].dispose(),t.color[b]=null;t._color_rb&&(r.deleteRenderbuffer(t._color_rb),t._color_rb=null),i(r,e),a(y)}i(r,e)}(this)}function c(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(e<0||e>s||r<0||r>s)throw new Error("gl-fbo: Can't resize FBO, invalid dimensions");t._shape[0]=e,t._shape[1]=r;for(var l=n(o),c=0;c<t.color.length;++c)t.color[c].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 u=o.checkFramebufferStatus(o.FRAMEBUFFER);u!==o.FRAMEBUFFER_COMPLETE&&(t.dispose(),i(o,l),a(u)),i(o,l)}}var u=t("gl-texture2d");e.exports=function(t,e,r,n){h||(h=t.FRAMEBUFFER_UNSUPPORTED,f=t.FRAMEBUFFER_INCOMPLETE_ATTACHMENT,d=t.FRAMEBUFFER_INCOMPLETE_DIMENSIONS,p=t.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT);var i=t.getExtension("WEBGL_draw_buffers");if(!m&&i&&function(t,e){var r=t.getParameter(e.MAX_COLOR_ATTACHMENTS_WEBGL);m=new Array(r+1);for(var n=0;n<=r;++n){for(var i=new Array(r),a=0;a<n;++a)i[a]=t.COLOR_ATTACHMENT0+a;for(a=n;a<r;++a)i[a]=t.NONE;m[n]=i}}(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(e<0||e>a||r<0||r>a)throw new Error("gl-fbo: Parameters are too large for FBO");var o=1;if("color"in(n=n||{})){if((o=Math.max(0|n.color,0))<0)throw new Error("gl-fbo: Must specify a nonnegative number of colors");if(o>1){if(!i)throw new Error("gl-fbo: Multiple draw buffer extension not supported");if(o>t.getParameter(i.MAX_COLOR_ATTACHMENTS_WEBGL))throw new Error("gl-fbo: Context does not support "+o+" draw buffers")}}var s=t.UNSIGNED_BYTE,c=t.getExtension("OES_texture_float");if(n.float&&o>0){if(!c)throw new Error("gl-fbo: Context does not support floating point textures");s=t.FLOAT}else n.preferFloat&&o>0&&c&&(s=t.FLOAT);var u=!0;"depth"in n&&(u=!!n.depth);var g=!1;return"stencil"in n&&(g=!!n.stencil),new l(t,e,r,s,o,u,g,i)};var h,f,d,p,m=null,g=l.prototype;Object.defineProperties(g,{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 c(this,e,r),[e,r]},enumerable:!1},width:{get:function(){return this._destroyed?0:this._shape[0]},set:function(t){return t|=0,c(this,t,this._shape[1]),t},enumerable:!1},height:{get:function(){return this._destroyed?0:this._shape[1]},set:function(t){return t|=0,c(this,this._shape[0],t),t},enumerable:!1}}),g.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])}},g.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":270}],168:[function(t,e,r){var n=t("sprintf-js").sprintf,i=t("gl-constants/lookup"),a=t("glsl-shader-name"),o=t("add-line-numbers");e.exports=function(t,e,r){"use strict";var s=a(e)||"of unknown name (see npm glsl-shader-name)",l="unknown type";void 0!==r&&(l=r===i.FRAGMENT_SHADER?"fragment":"vertex");for(var c=n("Error compiling %s shader %s:\n",l,s),u=n("%s%s",c,t),h=t.split("\n"),f={},d=0;d<h.length;d++){var p=h[d];if(""!==p){var m=parseInt(p.split(":")[2]);if(isNaN(m))throw new Error(n("Could not parse error: %s",p));f[m]=p}}for(var g=o(e).split("\n"),d=0;d<g.length;d++)if((f[d+3]||f[d+2]||f[d+1])&&(c+=g[d]+"\n",f[d+1])){var v=f[d+1];v=v.substr(v.split(":",3).join(":").length+1).trim(),c+=n("^^^ %s\n\n",v)}return{long:c.trim(),short:u.trim()}}},{"add-line-numbers":43,"gl-constants/lookup":161,"glsl-shader-name":282,"sprintf-js":538}],169:[function(t,e,r){"use strict";function n(t,e,r,n,i,a,o){this.plot=t,this.shader=e,this.pickShader=r,this.positionBuffer=n,this.weightBuffer=i,this.colorBuffer=a,this.idBuffer=o,this.xData=[],this.yData=[],this.shape=[0,0],this.bounds=[1/0,1/0,-1/0,-1/0],this.pickOffset=0}e.exports=function(t,e){var r=t.gl,i=new n(t,s(r,c.vertex,c.fragment),s(r,c.pickVertex,c.pickFragment),l(r),l(r),l(r),l(r));return i.update(e),t.addObject(i),i};var i=t("binary-search-bounds"),a=t("iota-array"),o=t("typedarray-pool"),s=t("gl-shader"),l=t("gl-buffer"),c=t("./lib/shaders"),u=n.prototype,h=[0,0,1,0,0,1,1,0,1,1,0,1];u.draw=function(){var t=[1,0,0,0,1,0,0,0,1];return function(){var e=this.plot,r=this.shader,n=this.bounds,i=this.numVertices;if(!(i<=0)){var a=e.gl,o=e.dataBox,s=n[2]-n[0],l=n[3]-n[1],c=o[2]-o[0],u=o[3]-o[1];t[0]=2*s/c,t[4]=2*l/u,t[6]=2*(n[0]-o[0])/c-1,t[7]=2*(n[1]-o[1])/u-1,r.bind();var h=r.uniforms;h.viewTransform=t,h.shape=this.shape;var f=r.attributes;this.positionBuffer.bind(),f.position.pointer(),this.weightBuffer.bind(),f.weight.pointer(a.UNSIGNED_BYTE,!1),this.colorBuffer.bind(),f.color.pointer(a.UNSIGNED_BYTE,!0),a.drawArrays(a.TRIANGLES,0,i)}}}(),u.drawPick=function(){var t=[1,0,0,0,1,0,0,0,1],e=[0,0,0,0];return function(r){var n=this.plot,i=this.pickShader,a=this.bounds,o=this.numVertices;if(!(o<=0)){var s=n.gl,l=n.dataBox,c=a[2]-a[0],u=a[3]-a[1],h=l[2]-l[0],f=l[3]-l[1];t[0]=2*c/h,t[4]=2*u/f,t[6]=2*(a[0]-l[0])/h-1,t[7]=2*(a[1]-l[1])/f-1;for(var d=0;d<4;++d)e[d]=r>>8*d&255;this.pickOffset=r,i.bind();var p=i.uniforms;p.viewTransform=t,p.pickOffset=e,p.shape=this.shape;var m=i.attributes;return this.positionBuffer.bind(),m.position.pointer(),this.weightBuffer.bind(),m.weight.pointer(s.UNSIGNED_BYTE,!1),this.idBuffer.bind(),m.pickId.pointer(s.UNSIGNED_BYTE,!1),s.drawArrays(s.TRIANGLES,0,o),r+this.shape[0]*this.shape[1]}}}(),u.pick=function(t,e,r){var n=this.pickOffset,i=this.shape[0]*this.shape[1];if(r<n||r>=n+i)return null;var a=r-n,o=this.xData,s=this.yData;return{object:this,pointId:a,dataCoord:[o[a%this.shape[0]],s[a/this.shape[0]|0]]}},u.update=function(t){var e=(t=t||{}).shape||[0,0],r=t.x||a(e[0]),n=t.y||a(e[1]),s=t.z||new Float32Array(e[0]*e[1]);this.xData=r,this.yData=n;var l=t.colorLevels||[0],c=t.colorValues||[0,0,0,1],u=l.length,f=this.bounds,d=f[0]=r[0],p=f[1]=n[0],m=1/((f[2]=r[r.length-1])-d),g=1/((f[3]=n[n.length-1])-p),v=e[0],y=e[1];this.shape=[v,y];var b=(v-1)*(y-1)*(h.length>>>1);this.numVertices=b;for(var x=o.mallocUint8(4*b),_=o.mallocFloat32(2*b),w=o.mallocUint8(2*b),M=o.mallocUint32(b),k=0,T=0;T<y-1;++T)for(var A=g*(n[T]-p),S=g*(n[T+1]-p),E=0;E<v-1;++E)for(var L=m*(r[E]-d),C=m*(r[E+1]-d),I=0;I<h.length;I+=2){var z,D,P,O,R=h[I],F=h[I+1],j=s[(T+F)*v+(E+R)],N=i.le(l,j);if(N<0)z=c[0],D=c[1],P=c[2],O=c[3];else if(N===u-1)z=c[4*u-4],D=c[4*u-3],P=c[4*u-2],O=c[4*u-1];else{var B=(j-l[N])/(l[N+1]-l[N]),U=1-B,V=4*N,H=4*(N+1);z=U*c[V]+B*c[H],D=U*c[V+1]+B*c[H+1],P=U*c[V+2]+B*c[H+2],O=U*c[V+3]+B*c[H+3]}x[4*k]=255*z,x[4*k+1]=255*D,x[4*k+2]=255*P,x[4*k+3]=255*O,_[2*k]=.5*L+.5*C,_[2*k+1]=.5*A+.5*S,w[2*k]=R,w[2*k+1]=F,M[k]=T*v+E,k+=1}this.positionBuffer.update(_),this.weightBuffer.update(w),this.colorBuffer.update(x),this.idBuffer.update(M),o.free(_),o.free(x),o.free(w),o.free(M)},u.dispose=function(){this.shader.dispose(),this.pickShader.dispose(),this.positionBuffer.dispose(),this.weightBuffer.dispose(),this.colorBuffer.dispose(),this.idBuffer.dispose(),this.plot.removeObject(this)}},{"./lib/shaders":170,"binary-search-bounds":171,"gl-buffer":159,"gl-shader":258,"iota-array":296,"typedarray-pool":552}],170:[function(t,e,r){"use strict";e.exports={fragment:"precision lowp float;\n#define GLSLIFY 1\nvarying vec4 fragColor;\nvoid main() {\n gl_FragColor = vec4(fragColor.rgb * fragColor.a, fragColor.a);\n}\n",vertex:"precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 position;\nattribute vec4 color;\nattribute vec2 weight;\n\nuniform vec2 shape;\nuniform mat3 viewTransform;\n\nvarying vec4 fragColor;\n\nvoid main() {\n vec3 vPosition = viewTransform * vec3( position + (weight-.5)/(shape-1.) , 1.0);\n fragColor = color;\n gl_Position = vec4(vPosition.xy, 0, vPosition.z);\n}\n",pickFragment:"precision mediump float;\n#define GLSLIFY 1\n\nvarying vec4 fragId;\nvarying vec2 vWeight;\n\nuniform vec2 shape;\nuniform vec4 pickOffset;\n\nvoid main() {\n vec2 d = step(.5, vWeight);\n vec4 id = fragId + pickOffset;\n id.x += d.x + d.y*shape.x;\n\n id.y += floor(id.x / 256.0);\n id.x -= floor(id.x / 256.0) * 256.0;\n\n id.z += floor(id.y / 256.0);\n id.y -= floor(id.y / 256.0) * 256.0;\n\n id.w += floor(id.z / 256.0);\n id.z -= floor(id.z / 256.0) * 256.0;\n\n gl_FragColor = id/255.;\n}\n",pickVertex:"precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 position;\nattribute vec4 pickId;\nattribute vec2 weight;\n\nuniform vec2 shape;\nuniform mat3 viewTransform;\n\nvarying vec4 fragId;\nvarying vec2 vWeight;\n\nvoid main() {\n vWeight = weight;\n\n fragId = pickId;\n\n vec3 vPosition = viewTransform * vec3( position + (weight-.5)/(shape-1.) , 1.0);\n gl_Position = vec4(vPosition.xy, 0, vPosition.z);\n}\n"}},{}],171:[function(t,e,r){arguments[4][87][0].apply(r,arguments)},{dup:87}],172:[function(t,e,r){r.lineVertex="precision highp float;\n#define GLSLIFY 1\n\nattribute vec2 aHi, aLo, dHi, dLo;\n\nuniform vec2 scaleHi, translateHi, scaleLo, translateLo, screenShape;\nuniform float width;\n\nvarying vec2 direction;\n\n\nvec2 project_1_0(vec2 scHi, vec2 trHi, vec2 scLo, vec2 trLo, vec2 posHi, vec2 posLo) {\n return (posHi + trHi) * scHi\n + (posLo + trLo) * scHi\n + (posHi + trHi) * scLo\n + (posLo + trLo) * scLo;\n}\n\n\nvec2 project_2_1(vec2 scHi, vec2 scLo, vec2 posHi, vec2 posLo) {\n return scHi * posHi\n + scLo * posHi\n + scHi * posLo\n + scLo * posLo;\n}\n\nvoid main() {\n vec2 p = project_1_0(scaleHi, translateHi, scaleLo, translateLo, aHi, aLo);\n vec2 dir = project_2_1(scaleHi, scaleLo, dHi, dLo);\n vec2 n = 0.5 * width * normalize(screenShape.yx * vec2(dir.y, -dir.x)) / screenShape.xy;\n vec2 tangent = normalize(screenShape.xy * dir);\n if(dir.x < 0.0 || (dir.x == 0.0 && dir.y < 0.0)) {\n direction = -tangent;\n } else {\n direction = tangent;\n }\n gl_Position = vec4(p + n, 0.0, 1.0);\n}",r.lineFragment="precision highp float;\n#define GLSLIFY 1\n\nuniform vec4 color;\nuniform vec2 screenShape;\nuniform sampler2D dashPattern;\nuniform float dashLength;\n\nvarying vec2 direction;\n\nvoid main() {\n float t = fract(dot(direction, gl_FragCoord.xy) / dashLength);\n vec4 pcolor = color * texture2D(dashPattern, vec2(t, 0.0)).r;\n gl_FragColor = vec4(pcolor.rgb * pcolor.a, pcolor.a);\n}",r.mitreVertex="precision highp float;\n#define GLSLIFY 1\n\nattribute vec2 aHi, aLo;\n\nuniform vec2 scaleHi, translateHi, scaleLo, translateLo;\nuniform float radius;\n\n\nvec2 project_1_0(vec2 scHi, vec2 trHi, vec2 scLo, vec2 trLo, vec2 posHi, vec2 posLo) {\n return (posHi + trHi) * scHi\n + (posLo + trLo) * scHi\n + (posHi + trHi) * scLo\n + (posLo + trLo) * scLo;\n}\n\n\nvoid main() {\n vec2 p = project_1_0(scaleHi, translateHi, scaleLo, translateLo, aHi, aLo);\n gl_Position = vec4(p, 0.0, 1.0);\n gl_PointSize = radius;\n}",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}",r.pickVertex="precision highp float;\n#define GLSLIFY 1\n\nattribute vec2 aHi, aLo, dHi;\nattribute vec4 pick0, pick1;\n\nuniform vec2 scaleHi, translateHi, scaleLo, translateLo, screenShape;\nuniform float width;\n\nvarying vec4 pickA, pickB;\n\n\nvec2 project_1_0(vec2 scHi, vec2 trHi, vec2 scLo, vec2 trLo, vec2 posHi, vec2 posLo) {\n return (posHi + trHi) * scHi\n + (posLo + trLo) * scHi\n + (posHi + trHi) * scLo\n + (posLo + trLo) * scLo;\n}\n\n\nvoid main() {\n vec2 p = project_1_0(scaleHi, translateHi, scaleLo, translateLo, aHi, aLo);\n vec2 n = width * normalize(screenShape.yx * vec2(dHi.y, -dHi.x)) / screenShape.xy;\n gl_Position = vec4(p + n, 0, 1);\n pickA = pick0;\n pickB = pick1;\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}",r.fillVertex="precision highp float;\n#define GLSLIFY 1\n\nattribute vec2 aHi, aLo, dHi;\n\nuniform vec2 scaleHi, translateHi, scaleLo, translateLo, projectAxis;\nuniform float projectValue, depth;\n\n\nvec2 project_1_0(vec2 scHi, vec2 trHi, vec2 scLo, vec2 trLo, vec2 posHi, vec2 posLo) {\n return (posHi + trHi) * scHi\n + (posLo + trLo) * scHi\n + (posHi + trHi) * scLo\n + (posLo + trLo) * scLo;\n}\n\n\nvoid main() {\n vec2 p = project_1_0(scaleHi, translateHi, scaleLo, translateLo, aHi, aLo);\n if(dHi.y < 0.0 || (dHi.y == 0.0 && dHi.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}",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}"},{}],173:[function(t,e,r){"use strict";function n(t,e,r,n,i,a,o,s,l){this.plot=t,this.dashPattern=e,this.lineBufferHi=r,this.lineBufferLo=n,this.pickBuffer=i,this.lineShader=a,this.mitreShader=o,this.fillShader=s,this.pickShader=l,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}e.exports=function(t,e){var r=t.gl,s=a(r),l=a(r),u=a(r),h=new n(t,o(r,[1,1]),s,l,u,i(r,c.lineVertex,c.lineFragment),i(r,c.mitreVertex,c.mitreFragment),i(r,c.fillVertex,c.fillFragment),i(r,c.pickVertex,c.pickFragment));return t.addObject(h),h.update(e),h};var i=t("gl-shader"),a=t("gl-buffer"),o=t("gl-texture2d"),s=t("ndarray"),l=t("typedarray-pool"),c=t("./lib/shaders"),u=n.prototype;u.setProjectionModel=function(){var t={scaleHi:new Float32Array([0,0]),scaleLo:new Float32Array([0,0]),translateHi:new Float32Array([0,0]),translateLo:new Float32Array([0,0]),screenShape:[0,0]};return function(){var e=this.bounds,r=this.plot.viewBox,n=this.plot.dataBox,i=e[2]-e[0],a=e[3]-e[1],o=n[2]-n[0],s=n[3]-n[1],l=r[2]-r[0],c=r[3]-r[1],u=2*i/o,h=2*a/s,f=(e[0]-n[0]-.5*o)/i,d=(e[1]-n[1]-.5*s)/a;return t.scaleHi[0]=u,t.scaleHi[1]=h,t.scaleLo[0]=u-t.scaleHi[0],t.scaleLo[1]=h-t.scaleHi[1],t.translateHi[0]=f,t.translateHi[1]=d,t.translateLo[0]=f-t.translateHi[0],t.translateLo[1]=d-t.translateHi[1],t.screenShape[0]=l,t.screenShape[1]=c,t}}(),u.setProjectionUniforms=function(t,e){t.scaleHi=e.scaleHi,t.scaleLo=e.scaleLo,t.translateHi=e.translateHi,t.translateLo=e.translateLo,t.screenShape=e.screenShape},u.draw=function(){var t=[1,0],e=[-1,0],r=[0,1],n=[0,-1];return function(){var i=this.vertCount;if(i){var a=this.setProjectionModel(),o=this.plot,s=this.width,l=o.gl,c=o.pixelRatio,u=this.color,h=this.fillShader.attributes;this.lineBufferLo.bind(),h.aLo.pointer(l.FLOAT,!1,16,0),this.lineBufferHi.bind();var f=this.fill;if(f[0]||f[1]||f[2]||f[3]){var d=this.fillShader;d.bind();var p=d.uniforms;this.setProjectionUniforms(p,a),p.depth=o.nextDepthValue(),h.aHi.pointer(l.FLOAT,!1,16,0),h.dHi.pointer(l.FLOAT,!1,16,8),l.depthMask(!0),l.enable(l.DEPTH_TEST);var m=this.fillColor;f[0]&&(p.color=m[0],p.projectAxis=e,p.projectValue=1,l.drawArrays(l.TRIANGLES,0,i)),f[1]&&(p.color=m[1],p.projectAxis=n,p.projectValue=1,l.drawArrays(l.TRIANGLES,0,i)),f[2]&&(p.color=m[2],p.projectAxis=t,p.projectValue=1,l.drawArrays(l.TRIANGLES,0,i)),f[3]&&(p.color=m[3],p.projectAxis=r,p.projectValue=1,l.drawArrays(l.TRIANGLES,0,i)),l.depthMask(!1),l.disable(l.DEPTH_TEST)}var g=this.lineShader;g.bind(),this.lineBufferLo.bind(),g.attributes.aLo.pointer(l.FLOAT,!1,16,0),g.attributes.dLo.pointer(l.FLOAT,!1,16,8),this.lineBufferHi.bind();var v=g.uniforms;this.setProjectionUniforms(v,a),v.color=u,v.width=s*c,v.dashPattern=this.dashPattern.bind(),v.dashLength=this.dashLength*c;var y=g.attributes;if(y.aHi.pointer(l.FLOAT,!1,16,0),y.dHi.pointer(l.FLOAT,!1,16,8),l.drawArrays(l.TRIANGLES,0,i),s>2&&!this.usingDashes){var b=this.mitreShader;this.lineBufferLo.bind(),b.attributes.aLo.pointer(l.FLOAT,!1,48,0),this.lineBufferHi.bind(),b.bind();var x=b.uniforms;this.setProjectionUniforms(x,a),x.color=u,x.radius=s*c,b.attributes.aHi.pointer(l.FLOAT,!1,48,0),l.drawArrays(l.POINTS,0,i/3|0)}}}}(),u.drawPick=function(){var t=[0,0,0,0];return function(e){var r=this.vertCount,n=this.numPoints;if(this.pickOffset=e,!r)return e+n;var i=this.setProjectionModel(),a=this.plot,o=this.width,s=a.gl,l=a.pickPixelRatio,c=this.pickShader,u=this.pickBuffer;t[0]=255&e,t[1]=e>>>8&255,t[2]=e>>>16&255,t[3]=e>>>24,c.bind();var h=c.uniforms;this.setProjectionUniforms(h,i),h.width=o*l,h.pickOffset=t;var f=c.attributes;return this.lineBufferHi.bind(),f.aHi.pointer(s.FLOAT,!1,16,0),f.dHi.pointer(s.FLOAT,!1,16,8),this.lineBufferLo.bind(),f.aLo.pointer(s.FLOAT,!1,16,0),u.bind(),f.pick0.pointer(s.UNSIGNED_BYTE,!1,8,0),f.pick1.pointer(s.UNSIGNED_BYTE,!1,8,4),s.drawArrays(s.TRIANGLES,0,r),e+n}}(),u.pick=function(t,e,r){var n=this.pickOffset,i=this.numPoints;if(r<n||r>=n+i)return null;var a=r-n,o=this.data;return{object:this,pointId:a,dataCoord:[o[2*a],o[2*a+1]]}},u.update=function(t){t=t||{};var e,r,n,i,a,c=this.plot.gl;this.color=(t.color||[0,0,1,1]).slice(),this.width=+(t.width||1),this.fill=(t.fill||[!1,!1,!1,!1]).slice(),this.fillColor=function(t){return t.map(function(t){return t.slice()})}(t.fillColor||[[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]]);var u=t.dashes||[1],h=0;for(e=0;e<u.length;++e)h+=u[e];var f=l.mallocUint8(h);n=0;var d=255;for(e=0;e<u.length;++e){for(r=0;r<u[e];++r)f[n++]=d;d^=255}this.dashPattern.dispose(),this.usingDashes=u.length>1,this.dashPattern=o(c,s(f,[h,1,4],[1,0,0])),this.dashPattern.minFilter=c.NEAREST,this.dashPattern.magFilter=c.NEAREST,this.dashLength=h,l.free(f);var p=t.positions;this.data=p;var m=this.bounds;m[0]=m[1]=1/0,m[2]=m[3]=-1/0;var g=this.numPoints=p.length>>>1;if(0!==g){for(e=0;e<g;++e)i=p[2*e],a=p[2*e+1],isNaN(i)||isNaN(a)||(m[0]=Math.min(m[0],i),m[1]=Math.min(m[1],a),m[2]=Math.max(m[2],i),m[3]=Math.max(m[3],a));m[0]===m[2]&&(m[2]+=1),m[3]===m[1]&&(m[3]+=1);var v=l.mallocFloat64(24*(g-1)),y=l.mallocFloat32(24*(g-1)),b=l.mallocFloat32(24*(g-1)),x=l.mallocUint32(12*(g-1)),_=y.length,w=x.length;n=g;for(var M=0;n>1;){var k=--n;i=p[2*n],a=p[2*n+1];var T=k-1,A=p[2*T],S=p[2*T+1];if(!(isNaN(i)||isNaN(a)||isNaN(A)||isNaN(S))){M+=1,i=(i-m[0])/(m[2]-m[0]),a=(a-m[1])/(m[3]-m[1]);var E=(A=(A-m[0])/(m[2]-m[0]))-i,L=(S=(S-m[1])/(m[3]-m[1]))-a,C=k|1<<24,I=k-1,z=k,D=k-1|1<<24;v[--_]=-L,v[--_]=-E,v[--_]=a,v[--_]=i,x[--w]=C,x[--w]=I,v[--_]=L,v[--_]=E,v[--_]=S,v[--_]=A,x[--w]=z,x[--w]=D,v[--_]=-L,v[--_]=-E,v[--_]=S,v[--_]=A,x[--w]=z,x[--w]=D,v[--_]=L,v[--_]=E,v[--_]=S,v[--_]=A,x[--w]=z,x[--w]=D,v[--_]=-L,v[--_]=-E,v[--_]=a,v[--_]=i,x[--w]=C,x[--w]=I,v[--_]=L,v[--_]=E,v[--_]=a,v[--_]=i,x[--w]=C,x[--w]=I}}for(e=0;e<v.length;e++)y[e]=v[e],b[e]=v[e]-y[e];this.vertCount=6*M,this.lineBufferHi.update(y.subarray(_)),this.lineBufferLo.update(b.subarray(_)),this.pickBuffer.update(x.subarray(w)),l.free(v),l.free(y),l.free(b),l.free(x)}},u.dispose=function(){this.plot.removeObject(this),this.lineBufferLo.dispose(),this.lineBufferHi.dispose(),this.pickBuffer.dispose(),this.lineShader.dispose(),this.mitreShader.dispose(),this.fillShader.dispose(),this.pickShader.dispose(),this.dashPattern.dispose()}},{"./lib/shaders":172,"gl-buffer":159,"gl-shader":258,"gl-texture2d":270,ndarray:470,"typedarray-pool":552}],174:[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",a=[{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,"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",null,a)},r.createPickShader=function(t){return n(t,i,"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}",null,a)}},{"gl-shader":258}],175:[function(t,e,r){"use strict";function n(t,e){for(var r=0,n=0;n<3;++n){var i=t[n]-e[n];r+=i*i}return Math.sqrt(r)}function i(t){for(var e=[[-1e6,-1e6,-1e6],[1e6,1e6,1e6]],r=0;r<3;++r)e[0][r]=Math.max(t[0][r],e[0][r]),e[1][r]=Math.min(t[1][r],e[1][r]);return e}function a(t,e,r,n){this.arcLength=t,this.position=e,this.index=r,this.dataCoordinate=n}function o(t,e,r,n,i,a){this.gl=t,this.shader=e,this.pickShader=r,this.buffer=n,this.vao=i,this.clipBounds=[[-1/0,-1/0,-1/0],[1/0,1/0,1/0]],this.points=[],this.arcLength=[],this.vertexCount=0,this.bounds=[[0,0,0],[0,0,0]],this.pickId=0,this.lineWidth=1,this.texture=a,this.dashScale=1,this.opacity=1,this.dirty=!0,this.pixelRatio=1}e.exports=function(t){var e=t.gl||t.scene&&t.scene.gl,r=p(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=s(e),a=l(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}]),u=f(new Array(1024),[256,1,4]),h=0;h<1024;++h)u.data[h]=255;var d=c(e,u);d.wrap=e.REPEAT;var g=new o(e,r,n,i,a,d);return g.update(t),g};var s=t("gl-buffer"),l=t("gl-vao"),c=t("gl-texture2d"),u=t("glsl-read-float"),h=t("binary-search-bounds"),f=t("ndarray"),d=t("./lib/shaders"),p=d.createShader,m=d.createPickShader,g=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],v=o.prototype;v.isTransparent=function(){return this.opacity<1},v.isOpaque=function(){return this.opacity>=1},v.pickSlots=1,v.setPickBase=function(t){this.pickId=t},v.drawTransparent=v.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)},v.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)},v.update=function(t){var e,r;this.dirty=!0;var i=!!t.connectGaps;"dashScale"in t&&(this.dashScale=t.dashScale),"opacity"in t&&(this.opacity=+t.opacity);var a=t.position||t.positions;if(a){var o=t.color||t.colors||[0,0,0,1],s=t.lineWidth||1,l=[],c=[],u=[],d=0,p=0,m=[[1/0,1/0,1/0],[-1/0,-1/0,-1/0]],g=!1;t:for(e=1;e<a.length;++e){var v=a[e-1],y=a[e];for(c.push(d),u.push(v.slice()),r=0;r<3;++r){if(isNaN(v[r])||isNaN(y[r])||!isFinite(v[r])||!isFinite(y[r])){if(!i&&l.length>0){for(var b=0;b<24;++b)l.push(l[l.length-12]);p+=2,g=!0}continue t}m[0][r]=Math.min(m[0][r],v[r],y[r]),m[1][r]=Math.max(m[1][r],v[r],y[r])}var x,_;Array.isArray(o[0])?(x=o[e-1],_=o[e]):x=_=o,3===x.length&&(x=[x[0],x[1],x[2],1]),3===_.length&&(_=[_[0],_[1],_[2],1]);var w;w=Array.isArray(s)?s[e-1]:s;var M=d;if(d+=n(v,y),g){for(r=0;r<2;++r)l.push(v[0],v[1],v[2],y[0],y[1],y[2],M,w,x[0],x[1],x[2],x[3]);p+=2,g=!1}l.push(v[0],v[1],v[2],y[0],y[1],y[2],M,w,x[0],x[1],x[2],x[3],v[0],v[1],v[2],y[0],y[1],y[2],M,-w,x[0],x[1],x[2],x[3],y[0],y[1],y[2],v[0],v[1],v[2],d,-w,_[0],_[1],_[2],_[3],y[0],y[1],y[2],v[0],v[1],v[2],d,w,_[0],_[1],_[2],_[3]),p+=4}if(this.buffer.update(l),c.push(d),u.push(a[a.length-1].slice()),this.bounds=m,this.vertexCount=p,this.points=u,this.arcLength=c,"dashes"in t){var k=t.dashes.slice();for(k.unshift(0),e=1;e<k.length;++e)k[e]=k[e-1]+k[e];var T=f(new Array(1024),[256,1,4]);for(e=0;e<256;++e){for(r=0;r<4;++r)T.set(e,0,r,0);1&h.le(k,k[k.length-1]*e/255)?T.set(e,0,0,0):T.set(e,0,0,255)}this.texture.setPixels(T)}}},v.dispose=function(){this.shader.dispose(),this.vao.dispose(),this.buffer.dispose()},v.pick=function(t){if(!t)return null;if(t.id!==this.pickId)return null;var e=u(t.value[0],t.value[1],t.value[2],0),r=h.le(this.arcLength,e);if(r<0)return null;if(r===this.arcLength.length-1)return new a(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)],o=(e-this.arcLength[r])/(this.arcLength[r+1]-this.arcLength[r]),s=1-o,l=[0,0,0],c=0;c<3;++c)l[c]=s*n[c]+o*i[c];var f=Math.min(o<.5?r:r+1,this.points.length-1);return new a(e,l,f,this.points[f])}},{"./lib/shaders":174,"binary-search-bounds":69,"gl-buffer":159,"gl-texture2d":270,"gl-vao":274,"glsl-read-float":281,ndarray:470}],176:[function(t,e,r){e.exports=function(t,e){var r=e[0],n=e[1],i=e[2],a=e[3],o=r*a-i*n;return o?(o=1/o,t[0]=a*o,t[1]=-n*o,t[2]=-i*o,t[3]=r*o,t):null}},{}],177:[function(t,e,r){e.exports=function(t,e){var r=e[0],n=e[1],i=e[2],a=e[3],o=e[4],s=e[5],l=e[6],c=e[7],u=e[8],h=u*o-s*c,f=-u*a+s*l,d=c*a-o*l,p=r*h+n*f+i*d;return p?(p=1/p,t[0]=h*p,t[1]=(-u*n+i*c)*p,t[2]=(s*n-i*o)*p,t[3]=f*p,t[4]=(u*r-i*l)*p,t[5]=(-s*r+i*a)*p,t[6]=d*p,t[7]=(-c*r+n*l)*p,t[8]=(o*r-n*a)*p,t):null}},{}],178:[function(t,e,r){e.exports=function(t){var e=new Float32Array(16);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}},{}],179:[function(t,e,r){e.exports=function(){var t=new Float32Array(16);return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}},{}],180:[function(t,e,r){e.exports=function(t){var e=t[0],r=t[1],n=t[2],i=t[3],a=t[4],o=t[5],s=t[6],l=t[7],c=t[8],u=t[9],h=t[10],f=t[11],d=t[12],p=t[13],m=t[14],g=t[15];return(e*o-r*a)*(h*g-f*m)-(e*s-n*a)*(u*g-f*p)+(e*l-i*a)*(u*m-h*p)+(r*s-n*o)*(c*g-f*d)-(r*l-i*o)*(c*m-h*d)+(n*l-i*s)*(c*p-u*d)}},{}],181:[function(t,e,r){e.exports=function(t,e){var r=e[0],n=e[1],i=e[2],a=e[3],o=r+r,s=n+n,l=i+i,c=r*o,u=n*o,h=n*s,f=i*o,d=i*s,p=i*l,m=a*o,g=a*s,v=a*l;return t[0]=1-h-p,t[1]=u+v,t[2]=f-g,t[3]=0,t[4]=u-v,t[5]=1-c-p,t[6]=d+m,t[7]=0,t[8]=f+g,t[9]=d-m,t[10]=1-c-h,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}},{}],182:[function(t,e,r){e.exports=function(t,e,r){var n=e[0],i=e[1],a=e[2],o=e[3],s=n+n,l=i+i,c=a+a,u=n*s,h=n*l,f=n*c,d=i*l,p=i*c,m=a*c,g=o*s,v=o*l,y=o*c;return t[0]=1-(d+m),t[1]=h+y,t[2]=f-v,t[3]=0,t[4]=h-y,t[5]=1-(u+m),t[6]=p+g,t[7]=0,t[8]=f+v,t[9]=p-g,t[10]=1-(u+d),t[11]=0,t[12]=r[0],t[13]=r[1],t[14]=r[2],t[15]=1,t}},{}],183:[function(t,e,r){e.exports=function(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}},{}],184:[function(t,e,r){e.exports=function(t,e){var r=e[0],n=e[1],i=e[2],a=e[3],o=e[4],s=e[5],l=e[6],c=e[7],u=e[8],h=e[9],f=e[10],d=e[11],p=e[12],m=e[13],g=e[14],v=e[15],y=r*s-n*o,b=r*l-i*o,x=r*c-a*o,_=n*l-i*s,w=n*c-a*s,M=i*c-a*l,k=u*m-h*p,T=u*g-f*p,A=u*v-d*p,S=h*g-f*m,E=h*v-d*m,L=f*v-d*g,C=y*L-b*E+x*S+_*A-w*T+M*k;return C?(C=1/C,t[0]=(s*L-l*E+c*S)*C,t[1]=(i*E-n*L-a*S)*C,t[2]=(m*M-g*w+v*_)*C,t[3]=(f*w-h*M-d*_)*C,t[4]=(l*A-o*L-c*T)*C,t[5]=(r*L-i*A+a*T)*C,t[6]=(g*x-p*M-v*b)*C,t[7]=(u*M-f*x+d*b)*C,t[8]=(o*E-s*A+c*k)*C,t[9]=(n*A-r*E-a*k)*C,t[10]=(p*w-m*x+v*y)*C,t[11]=(h*x-u*w-d*y)*C,t[12]=(s*T-o*S-l*k)*C,t[13]=(r*S-n*T+i*k)*C,t[14]=(m*b-p*_-g*y)*C,t[15]=(u*_-h*b+f*y)*C,t):null}},{}],185:[function(t,e,r){var n=t("./identity");e.exports=function(t,e,r,i){var a,o,s,l,c,u,h,f,d,p,m=e[0],g=e[1],v=e[2],y=i[0],b=i[1],x=i[2],_=r[0],w=r[1],M=r[2];return Math.abs(m-_)<1e-6&&Math.abs(g-w)<1e-6&&Math.abs(v-M)<1e-6?n(t):(h=m-_,f=g-w,d=v-M,p=1/Math.sqrt(h*h+f*f+d*d),h*=p,f*=p,d*=p,a=b*d-x*f,o=x*h-y*d,s=y*f-b*h,(p=Math.sqrt(a*a+o*o+s*s))?(a*=p=1/p,o*=p,s*=p):(a=0,o=0,s=0),l=f*s-d*o,c=d*a-h*s,u=h*o-f*a,(p=Math.sqrt(l*l+c*c+u*u))?(l*=p=1/p,c*=p,u*=p):(l=0,c=0,u=0),t[0]=a,t[1]=l,t[2]=h,t[3]=0,t[4]=o,t[5]=c,t[6]=f,t[7]=0,t[8]=s,t[9]=u,t[10]=d,t[11]=0,t[12]=-(a*m+o*g+s*v),t[13]=-(l*m+c*g+u*v),t[14]=-(h*m+f*g+d*v),t[15]=1,t)}},{"./identity":183}],186:[function(t,e,r){e.exports=function(t,e,r){var n=e[0],i=e[1],a=e[2],o=e[3],s=e[4],l=e[5],c=e[6],u=e[7],h=e[8],f=e[9],d=e[10],p=e[11],m=e[12],g=e[13],v=e[14],y=e[15],b=r[0],x=r[1],_=r[2],w=r[3];return t[0]=b*n+x*s+_*h+w*m,t[1]=b*i+x*l+_*f+w*g,t[2]=b*a+x*c+_*d+w*v,t[3]=b*o+x*u+_*p+w*y,b=r[4],x=r[5],_=r[6],w=r[7],t[4]=b*n+x*s+_*h+w*m,t[5]=b*i+x*l+_*f+w*g,t[6]=b*a+x*c+_*d+w*v,t[7]=b*o+x*u+_*p+w*y,b=r[8],x=r[9],_=r[10],w=r[11],t[8]=b*n+x*s+_*h+w*m,t[9]=b*i+x*l+_*f+w*g,t[10]=b*a+x*c+_*d+w*v,t[11]=b*o+x*u+_*p+w*y,b=r[12],x=r[13],_=r[14],w=r[15],t[12]=b*n+x*s+_*h+w*m,t[13]=b*i+x*l+_*f+w*g,t[14]=b*a+x*c+_*d+w*v,t[15]=b*o+x*u+_*p+w*y,t}},{}],187:[function(t,e,r){e.exports=function(t,e,r,n,i){var a=1/Math.tan(e/2),o=1/(n-i);return t[0]=a/r,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=a,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=(i+n)*o,t[11]=-1,t[12]=0,t[13]=0,t[14]=2*i*n*o,t[15]=0,t}},{}],188:[function(t,e,r){e.exports=function(t,e,r,n){var i,a,o,s,l,c,u,h,f,d,p,m,g,v,y,b,x,_,w,M,k,T,A,S,E=n[0],L=n[1],C=n[2],I=Math.sqrt(E*E+L*L+C*C);return Math.abs(I)<1e-6?null:(I=1/I,E*=I,L*=I,C*=I,i=Math.sin(r),a=Math.cos(r),o=1-a,s=e[0],l=e[1],c=e[2],u=e[3],h=e[4],f=e[5],d=e[6],p=e[7],m=e[8],g=e[9],v=e[10],y=e[11],b=E*E*o+a,x=L*E*o+C*i,_=C*E*o-L*i,w=E*L*o-C*i,M=L*L*o+a,k=C*L*o+E*i,T=E*C*o+L*i,A=L*C*o-E*i,S=C*C*o+a,t[0]=s*b+h*x+m*_,t[1]=l*b+f*x+g*_,t[2]=c*b+d*x+v*_,t[3]=u*b+p*x+y*_,t[4]=s*w+h*M+m*k,t[5]=l*w+f*M+g*k,t[6]=c*w+d*M+v*k,t[7]=u*w+p*M+y*k,t[8]=s*T+h*A+m*S,t[9]=l*T+f*A+g*S,t[10]=c*T+d*A+v*S,t[11]=u*T+p*A+y*S,e!==t&&(t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t)}},{}],189:[function(t,e,r){e.exports=function(t,e,r){var n=Math.sin(r),i=Math.cos(r),a=e[4],o=e[5],s=e[6],l=e[7],c=e[8],u=e[9],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]=a*i+c*n,t[5]=o*i+u*n,t[6]=s*i+h*n,t[7]=l*i+f*n,t[8]=c*i-a*n,t[9]=u*i-o*n,t[10]=h*i-s*n,t[11]=f*i-l*n,t}},{}],190:[function(t,e,r){e.exports=function(t,e,r){var n=Math.sin(r),i=Math.cos(r),a=e[0],o=e[1],s=e[2],l=e[3],c=e[8],u=e[9],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]=a*i-c*n,t[1]=o*i-u*n,t[2]=s*i-h*n,t[3]=l*i-f*n,t[8]=a*n+c*i,t[9]=o*n+u*i,t[10]=s*n+h*i,t[11]=l*n+f*i,t}},{}],191:[function(t,e,r){e.exports=function(t,e,r){var n=Math.sin(r),i=Math.cos(r),a=e[0],o=e[1],s=e[2],l=e[3],c=e[4],u=e[5],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]=a*i+c*n,t[1]=o*i+u*n,t[2]=s*i+h*n,t[3]=l*i+f*n,t[4]=c*i-a*n,t[5]=u*i-o*n,t[6]=h*i-s*n,t[7]=f*i-l*n,t}},{}],192:[function(t,e,r){e.exports=function(t,e,r){var n=r[0],i=r[1],a=r[2];return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*i,t[5]=e[5]*i,t[6]=e[6]*i,t[7]=e[7]*i,t[8]=e[8]*a,t[9]=e[9]*a,t[10]=e[10]*a,t[11]=e[11]*a,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}},{}],193:[function(t,e,r){e.exports=function(t,e,r){var n,i,a,o,s,l,c,u,h,f,d,p,m=r[0],g=r[1],v=r[2];return e===t?(t[12]=e[0]*m+e[4]*g+e[8]*v+e[12],t[13]=e[1]*m+e[5]*g+e[9]*v+e[13],t[14]=e[2]*m+e[6]*g+e[10]*v+e[14],t[15]=e[3]*m+e[7]*g+e[11]*v+e[15]):(n=e[0],i=e[1],a=e[2],o=e[3],s=e[4],l=e[5],c=e[6],u=e[7],h=e[8],f=e[9],d=e[10],p=e[11],t[0]=n,t[1]=i,t[2]=a,t[3]=o,t[4]=s,t[5]=l,t[6]=c,t[7]=u,t[8]=h,t[9]=f,t[10]=d,t[11]=p,t[12]=n*m+s*g+h*v+e[12],t[13]=i*m+l*g+f*v+e[13],t[14]=a*m+c*g+d*v+e[14],t[15]=o*m+u*g+p*v+e[15]),t}},{}],194:[function(t,e,r){e.exports=function(t,e){if(t===e){var r=e[1],n=e[2],i=e[3],a=e[6],o=e[7],s=e[11];t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=r,t[6]=e[9],t[7]=e[13],t[8]=n,t[9]=a,t[11]=e[14],t[12]=i,t[13]=o,t[14]=s}else t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=e[1],t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=e[14],t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15];return t}},{}],195:[function(t,e,r){"use strict";e.exports=function(t,e){switch(e.length){case 0:break;case 1:t[0]=1/e[0];break;case 4:n(t,e);break;case 9:i(t,e);break;case 16:a(t,e);break;default:throw new Error("currently supports matrices up to 4x4")}return t};var n=t("gl-mat2/invert"),i=t("gl-mat3/invert"),a=t("gl-mat4/invert")},{"gl-mat2/invert":176,"gl-mat3/invert":177,"gl-mat4/invert":184}],196:[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":197,"./gl-matrix/mat2.js":198,"./gl-matrix/mat2d.js":199,"./gl-matrix/mat3.js":200,"./gl-matrix/mat4.js":201,"./gl-matrix/quat.js":202,"./gl-matrix/vec2.js":203,"./gl-matrix/vec3.js":204,"./gl-matrix/vec4.js":205}],197:[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},{}],198:[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 a=new n.ARRAY_TYPE(4);return a[0]=t,a[1]=e,a[2]=r,a[3]=i,a},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],a=e[3],o=r*a-i*n;return o?(o=1/o,t[0]=a*o,t[1]=-n*o,t[2]=-i*o,t[3]=r*o,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],a=e[2],o=e[3],s=r[0],l=r[1],c=r[2],u=r[3];return t[0]=n*s+a*l,t[1]=i*s+o*l,t[2]=n*c+a*u,t[3]=i*c+o*u,t},i.mul=i.multiply,i.rotate=function(t,e,r){var n=e[0],i=e[1],a=e[2],o=e[3],s=Math.sin(r),l=Math.cos(r);return t[0]=n*l+a*s,t[1]=i*l+o*s,t[2]=n*-s+a*l,t[3]=i*-s+o*l,t},i.scale=function(t,e,r){var n=e[0],i=e[1],a=e[2],o=e[3],s=r[0],l=r[1];return t[0]=n*s,t[1]=i*s,t[2]=a*l,t[3]=o*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],a=t[2],o=t[3],s=e[0],l=e[1],c=e[2],u=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(a-c)<=n.EPSILON*Math.max(1,Math.abs(a),Math.abs(c))&&Math.abs(o-u)<=n.EPSILON*Math.max(1,Math.abs(o),Math.abs(u))},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":197}],199:[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,a,o){var s=new n.ARRAY_TYPE(6);return s[0]=t,s[1]=e,s[2]=r,s[3]=i,s[4]=a,s[5]=o,s},i.set=function(t,e,r,n,i,a,o){return t[0]=e,t[1]=r,t[2]=n,t[3]=i,t[4]=a,t[5]=o,t},i.invert=function(t,e){var r=e[0],n=e[1],i=e[2],a=e[3],o=e[4],s=e[5],l=r*a-n*i;return l?(l=1/l,t[0]=a*l,t[1]=-n*l,t[2]=-i*l,t[3]=r*l,t[4]=(i*s-a*o)*l,t[5]=(n*o-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],a=e[2],o=e[3],s=e[4],l=e[5],c=r[0],u=r[1],h=r[2],f=r[3],d=r[4],p=r[5];return t[0]=n*c+a*u,t[1]=i*c+o*u,t[2]=n*h+a*f,t[3]=i*h+o*f,t[4]=n*d+a*p+s,t[5]=i*d+o*p+l,t},i.mul=i.multiply,i.rotate=function(t,e,r){var n=e[0],i=e[1],a=e[2],o=e[3],s=e[4],l=e[5],c=Math.sin(r),u=Math.cos(r);return t[0]=n*u+a*c,t[1]=i*u+o*c,t[2]=n*-c+a*u,t[3]=i*-c+o*u,t[4]=s,t[5]=l,t},i.scale=function(t,e,r){var n=e[0],i=e[1],a=e[2],o=e[3],s=e[4],l=e[5],c=r[0],u=r[1];return t[0]=n*c,t[1]=i*c,t[2]=a*u,t[3]=o*u,t[4]=s,t[5]=l,t},i.translate=function(t,e,r){var n=e[0],i=e[1],a=e[2],o=e[3],s=e[4],l=e[5],c=r[0],u=r[1];return t[0]=n,t[1]=i,t[2]=a,t[3]=o,t[4]=n*c+a*u+s,t[5]=i*c+o*u+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],a=t[2],o=t[3],s=t[4],l=t[5],c=e[0],u=e[1],h=e[2],f=e[3],d=e[4],p=e[5];return Math.abs(r-c)<=n.EPSILON*Math.max(1,Math.abs(r),Math.abs(c))&&Math.abs(i-u)<=n.EPSILON*Math.max(1,Math.abs(i),Math.abs(u))&&Math.abs(a-h)<=n.EPSILON*Math.max(1,Math.abs(a),Math.abs(h))&&Math.abs(o-f)<=n.EPSILON*Math.max(1,Math.abs(o),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":197}],200:[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,a,o,s,l,c){var u=new n.ARRAY_TYPE(9);return u[0]=t,u[1]=e,u[2]=r,u[3]=i,u[4]=a,u[5]=o,u[6]=s,u[7]=l,u[8]=c,u},i.set=function(t,e,r,n,i,a,o,s,l,c){return t[0]=e,t[1]=r,t[2]=n,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=l,t[8]=c,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],a=e[3],o=e[4],s=e[5],l=e[6],c=e[7],u=e[8],h=u*o-s*c,f=-u*a+s*l,d=c*a-o*l,p=r*h+n*f+i*d;return p?(p=1/p,t[0]=h*p,t[1]=(-u*n+i*c)*p,t[2]=(s*n-i*o)*p,t[3]=f*p,t[4]=(u*r-i*l)*p,t[5]=(-s*r+i*a)*p,t[6]=d*p,t[7]=(-c*r+n*l)*p,t[8]=(o*r-n*a)*p,t):null},i.adjoint=function(t,e){var r=e[0],n=e[1],i=e[2],a=e[3],o=e[4],s=e[5],l=e[6],c=e[7],u=e[8];return t[0]=o*u-s*c,t[1]=i*c-n*u,t[2]=n*s-i*o,t[3]=s*l-a*u,t[4]=r*u-i*l,t[5]=i*a-r*s,t[6]=a*c-o*l,t[7]=n*l-r*c,t[8]=r*o-n*a,t},i.determinant=function(t){var e=t[0],r=t[1],n=t[2],i=t[3],a=t[4],o=t[5],s=t[6],l=t[7],c=t[8];return e*(c*a-o*l)+r*(-c*i+o*s)+n*(l*i-a*s)},i.multiply=function(t,e,r){var n=e[0],i=e[1],a=e[2],o=e[3],s=e[4],l=e[5],c=e[6],u=e[7],h=e[8],f=r[0],d=r[1],p=r[2],m=r[3],g=r[4],v=r[5],y=r[6],b=r[7],x=r[8];return t[0]=f*n+d*o+p*c,t[1]=f*i+d*s+p*u,t[2]=f*a+d*l+p*h,t[3]=m*n+g*o+v*c,t[4]=m*i+g*s+v*u,t[5]=m*a+g*l+v*h,t[6]=y*n+b*o+x*c,t[7]=y*i+b*s+x*u,t[8]=y*a+b*l+x*h,t},i.mul=i.multiply,i.translate=function(t,e,r){var n=e[0],i=e[1],a=e[2],o=e[3],s=e[4],l=e[5],c=e[6],u=e[7],h=e[8],f=r[0],d=r[1];return t[0]=n,t[1]=i,t[2]=a,t[3]=o,t[4]=s,t[5]=l,t[6]=f*n+d*o+c,t[7]=f*i+d*s+u,t[8]=f*a+d*l+h,t},i.rotate=function(t,e,r){var n=e[0],i=e[1],a=e[2],o=e[3],s=e[4],l=e[5],c=e[6],u=e[7],h=e[8],f=Math.sin(r),d=Math.cos(r);return t[0]=d*n+f*o,t[1]=d*i+f*s,t[2]=d*a+f*l,t[3]=d*o-f*n,t[4]=d*s-f*i,t[5]=d*l-f*a,t[6]=c,t[7]=u,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],a=e[3],o=r+r,s=n+n,l=i+i,c=r*o,u=n*o,h=n*s,f=i*o,d=i*s,p=i*l,m=a*o,g=a*s,v=a*l;return t[0]=1-h-p,t[3]=u-v,t[6]=f+g,t[1]=u+v,t[4]=1-c-p,t[7]=d-m,t[2]=f-g,t[5]=d+m,t[8]=1-c-h,t},i.normalFromMat4=function(t,e){var r=e[0],n=e[1],i=e[2],a=e[3],o=e[4],s=e[5],l=e[6],c=e[7],u=e[8],h=e[9],f=e[10],d=e[11],p=e[12],m=e[13],g=e[14],v=e[15],y=r*s-n*o,b=r*l-i*o,x=r*c-a*o,_=n*l-i*s,w=n*c-a*s,M=i*c-a*l,k=u*m-h*p,T=u*g-f*p,A=u*v-d*p,S=h*g-f*m,E=h*v-d*m,L=f*v-d*g,C=y*L-b*E+x*S+_*A-w*T+M*k;return C?(C=1/C,t[0]=(s*L-l*E+c*S)*C,t[1]=(l*A-o*L-c*T)*C,t[2]=(o*E-s*A+c*k)*C,t[3]=(i*E-n*L-a*S)*C,t[4]=(r*L-i*A+a*T)*C,t[5]=(n*A-r*E-a*k)*C,t[6]=(m*M-g*w+v*_)*C,t[7]=(g*x-p*M-v*b)*C,t[8]=(p*w-m*x+v*y)*C,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],a=t[2],o=t[3],s=t[4],l=t[5],c=t[6],u=t[7],h=t[8],f=e[0],d=e[1],p=e[2],m=e[3],g=e[4],v=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(a-p)<=n.EPSILON*Math.max(1,Math.abs(a),Math.abs(p))&&Math.abs(o-m)<=n.EPSILON*Math.max(1,Math.abs(o),Math.abs(m))&&Math.abs(s-g)<=n.EPSILON*Math.max(1,Math.abs(s),Math.abs(g))&&Math.abs(l-v)<=n.EPSILON*Math.max(1,Math.abs(l),Math.abs(v))&&Math.abs(c-y)<=n.EPSILON*Math.max(1,Math.abs(c),Math.abs(y))&&Math.abs(u-b)<=n.EPSILON*Math.max(1,Math.abs(u),Math.abs(b))&&Math.abs(h-x)<=n.EPSILON*Math.max(1,Math.abs(h),Math.abs(x))},e.exports=i},{"./common.js":197}],201:[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,a,o,s,l,c,u,h,f,d,p,m,g){var v=new n.ARRAY_TYPE(16);return v[0]=t,v[1]=e,v[2]=r,v[3]=i,v[4]=a,v[5]=o,v[6]=s,v[7]=l,v[8]=c,v[9]=u,v[10]=h,v[11]=f,v[12]=d,v[13]=p,v[14]=m,v[15]=g,v},i.set=function(t,e,r,n,i,a,o,s,l,c,u,h,f,d,p,m,g){return t[0]=e,t[1]=r,t[2]=n,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=l,t[8]=c,t[9]=u,t[10]=h,t[11]=f,t[12]=d,t[13]=p,t[14]=m,t[15]=g,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],a=e[6],o=e[7],s=e[11];t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=r,t[6]=e[9],t[7]=e[13],t[8]=n,t[9]=a,t[11]=e[14],t[12]=i,t[13]=o,t[14]=s}else t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=e[1],t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=e[14],t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15];return t},i.SIMD.transpose=function(t,e){var r,n,i,a,o,s,l,c,u,h;return r=SIMD.Float32x4.load(e,0),n=SIMD.Float32x4.load(e,4),i=SIMD.Float32x4.load(e,8),a=SIMD.Float32x4.load(e,12),o=SIMD.Float32x4.shuffle(r,n,0,1,4,5),s=SIMD.Float32x4.shuffle(i,a,0,1,4,5),l=SIMD.Float32x4.shuffle(o,s,0,2,4,6),c=SIMD.Float32x4.shuffle(o,s,1,3,5,7),SIMD.Float32x4.store(t,0,l),SIMD.Float32x4.store(t,4,c),o=SIMD.Float32x4.shuffle(r,n,2,3,6,7),s=SIMD.Float32x4.shuffle(i,a,2,3,6,7),u=SIMD.Float32x4.shuffle(o,s,0,2,4,6),h=SIMD.Float32x4.shuffle(o,s,1,3,5,7),SIMD.Float32x4.store(t,8,u),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],a=e[3],o=e[4],s=e[5],l=e[6],c=e[7],u=e[8],h=e[9],f=e[10],d=e[11],p=e[12],m=e[13],g=e[14],v=e[15],y=r*s-n*o,b=r*l-i*o,x=r*c-a*o,_=n*l-i*s,w=n*c-a*s,M=i*c-a*l,k=u*m-h*p,T=u*g-f*p,A=u*v-d*p,S=h*g-f*m,E=h*v-d*m,L=f*v-d*g,C=y*L-b*E+x*S+_*A-w*T+M*k;return C?(C=1/C,t[0]=(s*L-l*E+c*S)*C,t[1]=(i*E-n*L-a*S)*C,t[2]=(m*M-g*w+v*_)*C,t[3]=(f*w-h*M-d*_)*C,t[4]=(l*A-o*L-c*T)*C,t[5]=(r*L-i*A+a*T)*C,t[6]=(g*x-p*M-v*b)*C,t[7]=(u*M-f*x+d*b)*C,t[8]=(o*E-s*A+c*k)*C,t[9]=(n*A-r*E-a*k)*C,t[10]=(p*w-m*x+v*y)*C,t[11]=(h*x-u*w-d*y)*C,t[12]=(s*T-o*S-l*k)*C,t[13]=(r*S-n*T+i*k)*C,t[14]=(m*b-p*_-g*y)*C,t[15]=(u*_-h*b+f*y)*C,t):null},i.SIMD.invert=function(t,e){var r,n,i,a,o,s,l,c,u,h,f=SIMD.Float32x4.load(e,0),d=SIMD.Float32x4.load(e,4),p=SIMD.Float32x4.load(e,8),m=SIMD.Float32x4.load(e,12);return o=SIMD.Float32x4.shuffle(f,d,0,1,4,5),n=SIMD.Float32x4.shuffle(p,m,0,1,4,5),r=SIMD.Float32x4.shuffle(o,n,0,2,4,6),n=SIMD.Float32x4.shuffle(n,o,1,3,5,7),o=SIMD.Float32x4.shuffle(f,d,2,3,6,7),a=SIMD.Float32x4.shuffle(p,m,2,3,6,7),i=SIMD.Float32x4.shuffle(o,a,0,2,4,6),a=SIMD.Float32x4.shuffle(a,o,1,3,5,7),o=SIMD.Float32x4.mul(i,a),o=SIMD.Float32x4.swizzle(o,1,0,3,2),s=SIMD.Float32x4.mul(n,o),l=SIMD.Float32x4.mul(r,o),o=SIMD.Float32x4.swizzle(o,2,3,0,1),s=SIMD.Float32x4.sub(SIMD.Float32x4.mul(n,o),s),l=SIMD.Float32x4.sub(SIMD.Float32x4.mul(r,o),l),l=SIMD.Float32x4.swizzle(l,2,3,0,1),o=SIMD.Float32x4.mul(n,i),o=SIMD.Float32x4.swizzle(o,1,0,3,2),s=SIMD.Float32x4.add(SIMD.Float32x4.mul(a,o),s),u=SIMD.Float32x4.mul(r,o),o=SIMD.Float32x4.swizzle(o,2,3,0,1),s=SIMD.Float32x4.sub(s,SIMD.Float32x4.mul(a,o)),u=SIMD.Float32x4.sub(SIMD.Float32x4.mul(r,o),u),u=SIMD.Float32x4.swizzle(u,2,3,0,1),o=SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(n,2,3,0,1),a),o=SIMD.Float32x4.swizzle(o,1,0,3,2),i=SIMD.Float32x4.swizzle(i,2,3,0,1),s=SIMD.Float32x4.add(SIMD.Float32x4.mul(i,o),s),c=SIMD.Float32x4.mul(r,o),o=SIMD.Float32x4.swizzle(o,2,3,0,1),s=SIMD.Float32x4.sub(s,SIMD.Float32x4.mul(i,o)),c=SIMD.Float32x4.sub(SIMD.Float32x4.mul(r,o),c),c=SIMD.Float32x4.swizzle(c,2,3,0,1),o=SIMD.Float32x4.mul(r,n),o=SIMD.Float32x4.swizzle(o,1,0,3,2),c=SIMD.Float32x4.add(SIMD.Float32x4.mul(a,o),c),u=SIMD.Float32x4.sub(SIMD.Float32x4.mul(i,o),u),o=SIMD.Float32x4.swizzle(o,2,3,0,1),c=SIMD.Float32x4.sub(SIMD.Float32x4.mul(a,o),c),u=SIMD.Float32x4.sub(u,SIMD.Float32x4.mul(i,o)),o=SIMD.Float32x4.mul(r,a),o=SIMD.Float32x4.swizzle(o,1,0,3,2),l=SIMD.Float32x4.sub(l,SIMD.Float32x4.mul(i,o)),c=SIMD.Float32x4.add(SIMD.Float32x4.mul(n,o),c),o=SIMD.Float32x4.swizzle(o,2,3,0,1),l=SIMD.Float32x4.add(SIMD.Float32x4.mul(i,o),l),c=SIMD.Float32x4.sub(c,SIMD.Float32x4.mul(n,o)),o=SIMD.Float32x4.mul(r,i),o=SIMD.Float32x4.swizzle(o,1,0,3,2),l=SIMD.Float32x4.add(SIMD.Float32x4.mul(a,o),l),u=SIMD.Float32x4.sub(u,SIMD.Float32x4.mul(n,o)),o=SIMD.Float32x4.swizzle(o,2,3,0,1),l=SIMD.Float32x4.sub(l,SIMD.Float32x4.mul(a,o)),u=SIMD.Float32x4.add(SIMD.Float32x4.mul(n,o),u),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),o=SIMD.Float32x4.reciprocalApproximation(h),h=SIMD.Float32x4.sub(SIMD.Float32x4.add(o,o),SIMD.Float32x4.mul(h,SIMD.Float32x4.mul(o,o))),(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,c)),SIMD.Float32x4.store(t,12,SIMD.Float32x4.mul(h,u)),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],a=e[3],o=e[4],s=e[5],l=e[6],c=e[7],u=e[8],h=e[9],f=e[10],d=e[11],p=e[12],m=e[13],g=e[14],v=e[15];return t[0]=s*(f*v-d*g)-h*(l*v-c*g)+m*(l*d-c*f),t[1]=-(n*(f*v-d*g)-h*(i*v-a*g)+m*(i*d-a*f)),t[2]=n*(l*v-c*g)-s*(i*v-a*g)+m*(i*c-a*l),t[3]=-(n*(l*d-c*f)-s*(i*d-a*f)+h*(i*c-a*l)),t[4]=-(o*(f*v-d*g)-u*(l*v-c*g)+p*(l*d-c*f)),t[5]=r*(f*v-d*g)-u*(i*v-a*g)+p*(i*d-a*f),t[6]=-(r*(l*v-c*g)-o*(i*v-a*g)+p*(i*c-a*l)),t[7]=r*(l*d-c*f)-o*(i*d-a*f)+u*(i*c-a*l),t[8]=o*(h*v-d*m)-u*(s*v-c*m)+p*(s*d-c*h),t[9]=-(r*(h*v-d*m)-u*(n*v-a*m)+p*(n*d-a*h)),t[10]=r*(s*v-c*m)-o*(n*v-a*m)+p*(n*c-a*s),t[11]=-(r*(s*d-c*h)-o*(n*d-a*h)+u*(n*c-a*s)),t[12]=-(o*(h*g-f*m)-u*(s*g-l*m)+p*(s*f-l*h)),t[13]=r*(h*g-f*m)-u*(n*g-i*m)+p*(n*f-i*h),t[14]=-(r*(s*g-l*m)-o*(n*g-i*m)+p*(n*l-i*s)),t[15]=r*(s*f-l*h)-o*(n*f-i*h)+u*(n*l-i*s),t},i.SIMD.adjoint=function(t,e){var r,n,i,a,o,s,l,c,u,h=SIMD.Float32x4.load(e,0),f=SIMD.Float32x4.load(e,4),d=SIMD.Float32x4.load(e,8),p=SIMD.Float32x4.load(e,12);return o=SIMD.Float32x4.shuffle(h,f,0,1,4,5),n=SIMD.Float32x4.shuffle(d,p,0,1,4,5),r=SIMD.Float32x4.shuffle(o,n,0,2,4,6),n=SIMD.Float32x4.shuffle(n,o,1,3,5,7),o=SIMD.Float32x4.shuffle(h,f,2,3,6,7),a=SIMD.Float32x4.shuffle(d,p,2,3,6,7),i=SIMD.Float32x4.shuffle(o,a,0,2,4,6),a=SIMD.Float32x4.shuffle(a,o,1,3,5,7),o=SIMD.Float32x4.mul(i,a),o=SIMD.Float32x4.swizzle(o,1,0,3,2),s=SIMD.Float32x4.mul(n,o),l=SIMD.Float32x4.mul(r,o),o=SIMD.Float32x4.swizzle(o,2,3,0,1),s=SIMD.Float32x4.sub(SIMD.Float32x4.mul(n,o),s),l=SIMD.Float32x4.sub(SIMD.Float32x4.mul(r,o),l),l=SIMD.Float32x4.swizzle(l,2,3,0,1),o=SIMD.Float32x4.mul(n,i),o=SIMD.Float32x4.swizzle(o,1,0,3,2),s=SIMD.Float32x4.add(SIMD.Float32x4.mul(a,o),s),u=SIMD.Float32x4.mul(r,o),o=SIMD.Float32x4.swizzle(o,2,3,0,1),s=SIMD.Float32x4.sub(s,SIMD.Float32x4.mul(a,o)),u=SIMD.Float32x4.sub(SIMD.Float32x4.mul(r,o),u),u=SIMD.Float32x4.swizzle(u,2,3,0,1),o=SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(n,2,3,0,1),a),o=SIMD.Float32x4.swizzle(o,1,0,3,2),i=SIMD.Float32x4.swizzle(i,2,3,0,1),s=SIMD.Float32x4.add(SIMD.Float32x4.mul(i,o),s),c=SIMD.Float32x4.mul(r,o),o=SIMD.Float32x4.swizzle(o,2,3,0,1),s=SIMD.Float32x4.sub(s,SIMD.Float32x4.mul(i,o)),c=SIMD.Float32x4.sub(SIMD.Float32x4.mul(r,o),c),c=SIMD.Float32x4.swizzle(c,2,3,0,1),o=SIMD.Float32x4.mul(r,n),o=SIMD.Float32x4.swizzle(o,1,0,3,2),c=SIMD.Float32x4.add(SIMD.Float32x4.mul(a,o),c),u=SIMD.Float32x4.sub(SIMD.Float32x4.mul(i,o),u),o=SIMD.Float32x4.swizzle(o,2,3,0,1),c=SIMD.Float32x4.sub(SIMD.Float32x4.mul(a,o),c),u=SIMD.Float32x4.sub(u,SIMD.Float32x4.mul(i,o)),o=SIMD.Float32x4.mul(r,a),o=SIMD.Float32x4.swizzle(o,1,0,3,2),l=SIMD.Float32x4.sub(l,SIMD.Float32x4.mul(i,o)),c=SIMD.Float32x4.add(SIMD.Float32x4.mul(n,o),c),o=SIMD.Float32x4.swizzle(o,2,3,0,1),l=SIMD.Float32x4.add(SIMD.Float32x4.mul(i,o),l),c=SIMD.Float32x4.sub(c,SIMD.Float32x4.mul(n,o)),o=SIMD.Float32x4.mul(r,i),o=SIMD.Float32x4.swizzle(o,1,0,3,2),l=SIMD.Float32x4.add(SIMD.Float32x4.mul(a,o),l),u=SIMD.Float32x4.sub(u,SIMD.Float32x4.mul(n,o)),o=SIMD.Float32x4.swizzle(o,2,3,0,1),l=SIMD.Float32x4.sub(l,SIMD.Float32x4.mul(a,o)),u=SIMD.Float32x4.add(SIMD.Float32x4.mul(n,o),u),SIMD.Float32x4.store(t,0,s),SIMD.Float32x4.store(t,4,l),SIMD.Float32x4.store(t,8,c),SIMD.Float32x4.store(t,12,u),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],a=t[4],o=t[5],s=t[6],l=t[7],c=t[8],u=t[9],h=t[10],f=t[11],d=t[12],p=t[13],m=t[14],g=t[15];return(e*o-r*a)*(h*g-f*m)-(e*s-n*a)*(u*g-f*p)+(e*l-i*a)*(u*m-h*p)+(r*s-n*o)*(c*g-f*d)-(r*l-i*o)*(c*m-h*d)+(n*l-i*s)*(c*p-u*d)},i.SIMD.multiply=function(t,e,r){var n=SIMD.Float32x4.load(e,0),i=SIMD.Float32x4.load(e,4),a=SIMD.Float32x4.load(e,8),o=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),a),SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(s,3,3,3,3),o))));SIMD.Float32x4.store(t,0,l);var c=SIMD.Float32x4.load(r,4),u=SIMD.Float32x4.add(SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(c,0,0,0,0),n),SIMD.Float32x4.add(SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(c,1,1,1,1),i),SIMD.Float32x4.add(SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(c,2,2,2,2),a),SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(c,3,3,3,3),o))));SIMD.Float32x4.store(t,4,u);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),a),SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(h,3,3,3,3),o))));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),a),SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(d,3,3,3,3),o))));return SIMD.Float32x4.store(t,12,p),t},i.scalar.multiply=function(t,e,r){var n=e[0],i=e[1],a=e[2],o=e[3],s=e[4],l=e[5],c=e[6],u=e[7],h=e[8],f=e[9],d=e[10],p=e[11],m=e[12],g=e[13],v=e[14],y=e[15],b=r[0],x=r[1],_=r[2],w=r[3];return t[0]=b*n+x*s+_*h+w*m,t[1]=b*i+x*l+_*f+w*g,t[2]=b*a+x*c+_*d+w*v,t[3]=b*o+x*u+_*p+w*y,b=r[4],x=r[5],_=r[6],w=r[7],t[4]=b*n+x*s+_*h+w*m,t[5]=b*i+x*l+_*f+w*g,t[6]=b*a+x*c+_*d+w*v,t[7]=b*o+x*u+_*p+w*y,b=r[8],x=r[9],_=r[10],w=r[11],t[8]=b*n+x*s+_*h+w*m,t[9]=b*i+x*l+_*f+w*g,t[10]=b*a+x*c+_*d+w*v,t[11]=b*o+x*u+_*p+w*y,b=r[12],x=r[13],_=r[14],w=r[15],t[12]=b*n+x*s+_*h+w*m,t[13]=b*i+x*l+_*f+w*g,t[14]=b*a+x*c+_*d+w*v,t[15]=b*o+x*u+_*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,a,o,s,l,c,u,h,f,d,p,m=r[0],g=r[1],v=r[2];return e===t?(t[12]=e[0]*m+e[4]*g+e[8]*v+e[12],t[13]=e[1]*m+e[5]*g+e[9]*v+e[13],t[14]=e[2]*m+e[6]*g+e[10]*v+e[14],t[15]=e[3]*m+e[7]*g+e[11]*v+e[15]):(n=e[0],i=e[1],a=e[2],o=e[3],s=e[4],l=e[5],c=e[6],u=e[7],h=e[8],f=e[9],d=e[10],p=e[11],t[0]=n,t[1]=i,t[2]=a,t[3]=o,t[4]=s,t[5]=l,t[6]=c,t[7]=u,t[8]=h,t[9]=f,t[10]=d,t[11]=p,t[12]=n*m+s*g+h*v+e[12],t[13]=i*m+l*g+f*v+e[13],t[14]=a*m+c*g+d*v+e[14],t[15]=o*m+u*g+p*v+e[15]),t},i.SIMD.translate=function(t,e,r){var n=SIMD.Float32x4.load(e,0),i=SIMD.Float32x4.load(e,4),a=SIMD.Float32x4.load(e,8),o=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)),a=SIMD.Float32x4.mul(a,SIMD.Float32x4.swizzle(s,2,2,2,2));var l=SIMD.Float32x4.add(n,SIMD.Float32x4.add(i,SIMD.Float32x4.add(a,o)));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],a=r[2];return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*i,t[5]=e[5]*i,t[6]=e[6]*i,t[7]=e[7]*i,t[8]=e[8]*a,t[9]=e[9]*a,t[10]=e[10]*a,t[11]=e[11]*a,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t},i.SIMD.scale=function(t,e,r){var n,i,a,o=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(o,0,0,0,0))),i=SIMD.Float32x4.load(e,4),SIMD.Float32x4.store(t,4,SIMD.Float32x4.mul(i,SIMD.Float32x4.swizzle(o,1,1,1,1))),a=SIMD.Float32x4.load(e,8),SIMD.Float32x4.store(t,8,SIMD.Float32x4.mul(a,SIMD.Float32x4.swizzle(o,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 a,o,s,l,c,u,h,f,d,p,m,g,v,y,b,x,_,w,M,k,T,A,S,E,L=i[0],C=i[1],I=i[2],z=Math.sqrt(L*L+C*C+I*I);return Math.abs(z)<n.EPSILON?null:(z=1/z,L*=z,C*=z,I*=z,a=Math.sin(r),o=Math.cos(r),s=1-o,l=e[0],c=e[1],u=e[2],h=e[3],f=e[4],d=e[5],p=e[6],m=e[7],g=e[8],v=e[9],y=e[10],b=e[11],x=L*L*s+o,_=C*L*s+I*a,w=I*L*s-C*a,M=L*C*s-I*a,k=C*C*s+o,T=I*C*s+L*a,A=L*I*s+C*a,S=C*I*s-L*a,E=I*I*s+o,t[0]=l*x+f*_+g*w,t[1]=c*x+d*_+v*w,t[2]=u*x+p*_+y*w,t[3]=h*x+m*_+b*w,t[4]=l*M+f*k+g*T,t[5]=c*M+d*k+v*T,t[6]=u*M+p*k+y*T,t[7]=h*M+m*k+b*T,t[8]=l*A+f*S+g*E,t[9]=c*A+d*S+v*E,t[10]=u*A+p*S+y*E,t[11]=h*A+m*S+b*E,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),a=e[4],o=e[5],s=e[6],l=e[7],c=e[8],u=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]=a*i+c*n,t[5]=o*i+u*n,t[6]=s*i+h*n,t[7]=l*i+f*n,t[8]=c*i-a*n,t[9]=u*i-o*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 a=SIMD.Float32x4.load(e,4),o=SIMD.Float32x4.load(e,8);return SIMD.Float32x4.store(t,4,SIMD.Float32x4.add(SIMD.Float32x4.mul(a,i),SIMD.Float32x4.mul(o,n))),SIMD.Float32x4.store(t,8,SIMD.Float32x4.sub(SIMD.Float32x4.mul(o,i),SIMD.Float32x4.mul(a,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),a=e[0],o=e[1],s=e[2],l=e[3],c=e[8],u=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]=a*i-c*n,t[1]=o*i-u*n,t[2]=s*i-h*n,t[3]=l*i-f*n,t[8]=a*n+c*i,t[9]=o*n+u*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 a=SIMD.Float32x4.load(e,0),o=SIMD.Float32x4.load(e,8);return SIMD.Float32x4.store(t,0,SIMD.Float32x4.sub(SIMD.Float32x4.mul(a,i),SIMD.Float32x4.mul(o,n))),SIMD.Float32x4.store(t,8,SIMD.Float32x4.add(SIMD.Float32x4.mul(a,n),SIMD.Float32x4.mul(o,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),a=e[0],o=e[1],s=e[2],l=e[3],c=e[4],u=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]=a*i+c*n,t[1]=o*i+u*n,t[2]=s*i+h*n,t[3]=l*i+f*n,t[4]=c*i-a*n,t[5]=u*i-o*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 a=SIMD.Float32x4.load(e,0),o=SIMD.Float32x4.load(e,4);return SIMD.Float32x4.store(t,0,SIMD.Float32x4.add(SIMD.Float32x4.mul(a,i),SIMD.Float32x4.mul(o,n))),SIMD.Float32x4.store(t,4,SIMD.Float32x4.sub(SIMD.Float32x4.mul(o,i),SIMD.Float32x4.mul(a,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,a,o,s=r[0],l=r[1],c=r[2],u=Math.sqrt(s*s+l*l+c*c);return Math.abs(u)<n.EPSILON?null:(u=1/u,s*=u,l*=u,c*=u,i=Math.sin(e),a=Math.cos(e),o=1-a,t[0]=s*s*o+a,t[1]=l*s*o+c*i,t[2]=c*s*o-l*i,t[3]=0,t[4]=s*l*o-c*i,t[5]=l*l*o+a,t[6]=c*l*o+s*i,t[7]=0,t[8]=s*c*o+l*i,t[9]=l*c*o-s*i,t[10]=c*c*o+a,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],a=e[2],o=e[3],s=n+n,l=i+i,c=a+a,u=n*s,h=n*l,f=n*c,d=i*l,p=i*c,m=a*c,g=o*s,v=o*l,y=o*c;return t[0]=1-(d+m),t[1]=h+y,t[2]=f-v,t[3]=0,t[4]=h-y,t[5]=1-(u+m),t[6]=p+g,t[7]=0,t[8]=f+v,t[9]=p-g,t[10]=1-(u+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],a=e[1],o=e[2],s=e[3],l=i+i,c=a+a,u=o+o,h=i*l,f=i*c,d=i*u,p=a*c,m=a*u,g=o*u,v=s*l,y=s*c,b=s*u,x=n[0],_=n[1],w=n[2];return t[0]=(1-(p+g))*x,t[1]=(f+b)*x,t[2]=(d-y)*x,t[3]=0,t[4]=(f-b)*_,t[5]=(1-(h+g))*_,t[6]=(m+v)*_,t[7]=0,t[8]=(d+y)*w,t[9]=(m-v)*w,t[10]=(1-(h+p))*w,t[11]=0,t[12]=r[0],t[13]=r[1],t[14]=r[2],t[15]=1,t},i.fromRotationTranslationScaleOrigin=function(t,e,r,n,i){var a=e[0],o=e[1],s=e[2],l=e[3],c=a+a,u=o+o,h=s+s,f=a*c,d=a*u,p=a*h,m=o*u,g=o*h,v=s*h,y=l*c,b=l*u,x=l*h,_=n[0],w=n[1],M=n[2],k=i[0],T=i[1],A=i[2];return t[0]=(1-(m+v))*_,t[1]=(d+x)*_,t[2]=(p-b)*_,t[3]=0,t[4]=(d-x)*w,t[5]=(1-(f+v))*w,t[6]=(g+y)*w,t[7]=0,t[8]=(p+b)*M,t[9]=(g-y)*M,t[10]=(1-(f+m))*M,t[11]=0,t[12]=r[0]+k-(t[0]*k+t[4]*T+t[8]*A),t[13]=r[1]+T-(t[1]*k+t[5]*T+t[9]*A),t[14]=r[2]+A-(t[2]*k+t[6]*T+t[10]*A),t[15]=1,t},i.fromQuat=function(t,e){var r=e[0],n=e[1],i=e[2],a=e[3],o=r+r,s=n+n,l=i+i,c=r*o,u=n*o,h=n*s,f=i*o,d=i*s,p=i*l,m=a*o,g=a*s,v=a*l;return t[0]=1-h-p,t[1]=u+v,t[2]=f-g,t[3]=0,t[4]=u-v,t[5]=1-c-p,t[6]=d+m,t[7]=0,t[8]=f+g,t[9]=d-m,t[10]=1-c-h,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},i.frustum=function(t,e,r,n,i,a,o){var s=1/(r-e),l=1/(i-n),c=1/(a-o);return t[0]=2*a*s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=2*a*l,t[6]=0,t[7]=0,t[8]=(r+e)*s,t[9]=(i+n)*l,t[10]=(o+a)*c,t[11]=-1,t[12]=0,t[13]=0,t[14]=o*a*2*c,t[15]=0,t},i.perspective=function(t,e,r,n,i){var a=1/Math.tan(e/2),o=1/(n-i);return t[0]=a/r,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=a,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=(i+n)*o,t[11]=-1,t[12]=0,t[13]=0,t[14]=2*i*n*o,t[15]=0,t},i.perspectiveFromFieldOfView=function(t,e,r,n){var i=Math.tan(e.upDegrees*Math.PI/180),a=Math.tan(e.downDegrees*Math.PI/180),o=Math.tan(e.leftDegrees*Math.PI/180),s=Math.tan(e.rightDegrees*Math.PI/180),l=2/(o+s),c=2/(i+a);return t[0]=l,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=c,t[6]=0,t[7]=0,t[8]=-(o-s)*l*.5,t[9]=(i-a)*c*.5,t[10]=n/(r-n),t[11]=-1,t[12]=0,t[13]=0,t[14]=n*r/(r-n),t[15]=0,t},i.ortho=function(t,e,r,n,i,a,o){var s=1/(e-r),l=1/(n-i),c=1/(a-o);return t[0]=-2*s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*l,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*c,t[11]=0,t[12]=(e+r)*s,t[13]=(i+n)*l,t[14]=(o+a)*c,t[15]=1,t},i.lookAt=function(t,e,r,a){var o,s,l,c,u,h,f,d,p,m,g=e[0],v=e[1],y=e[2],b=a[0],x=a[1],_=a[2],w=r[0],M=r[1],k=r[2];return Math.abs(g-w)<n.EPSILON&&Math.abs(v-M)<n.EPSILON&&Math.abs(y-k)<n.EPSILON?i.identity(t):(f=g-w,d=v-M,p=y-k,m=1/Math.sqrt(f*f+d*d+p*p),f*=m,d*=m,p*=m,o=x*p-_*d,s=_*f-b*p,l=b*d-x*f,(m=Math.sqrt(o*o+s*s+l*l))?(o*=m=1/m,s*=m,l*=m):(o=0,s=0,l=0),c=d*l-p*s,u=p*o-f*l,h=f*s-d*o,(m=Math.sqrt(c*c+u*u+h*h))?(c*=m=1/m,u*=m,h*=m):(c=0,u=0,h=0),t[0]=o,t[1]=c,t[2]=f,t[3]=0,t[4]=s,t[5]=u,t[6]=d,t[7]=0,t[8]=l,t[9]=h,t[10]=p,t[11]=0,t[12]=-(o*g+s*v+l*y),t[13]=-(c*g+u*v+h*y),t[14]=-(f*g+d*v+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],a=t[2],o=t[3],s=t[4],l=t[5],c=t[6],u=t[7],h=t[8],f=t[9],d=t[10],p=t[11],m=t[12],g=t[13],v=t[14],y=t[15],b=e[0],x=e[1],_=e[2],w=e[3],M=e[4],k=e[5],T=e[6],A=e[7],S=e[8],E=e[9],L=e[10],C=e[11],I=e[12],z=e[13],D=e[14],P=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(a-_)<=n.EPSILON*Math.max(1,Math.abs(a),Math.abs(_))&&Math.abs(o-w)<=n.EPSILON*Math.max(1,Math.abs(o),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(c-T)<=n.EPSILON*Math.max(1,Math.abs(c),Math.abs(T))&&Math.abs(u-A)<=n.EPSILON*Math.max(1,Math.abs(u),Math.abs(A))&&Math.abs(h-S)<=n.EPSILON*Math.max(1,Math.abs(h),Math.abs(S))&&Math.abs(f-E)<=n.EPSILON*Math.max(1,Math.abs(f),Math.abs(E))&&Math.abs(d-L)<=n.EPSILON*Math.max(1,Math.abs(d),Math.abs(L))&&Math.abs(p-C)<=n.EPSILON*Math.max(1,Math.abs(p),Math.abs(C))&&Math.abs(m-I)<=n.EPSILON*Math.max(1,Math.abs(m),Math.abs(I))&&Math.abs(g-z)<=n.EPSILON*Math.max(1,Math.abs(g),Math.abs(z))&&Math.abs(v-D)<=n.EPSILON*Math.max(1,Math.abs(v),Math.abs(D))&&Math.abs(y-P)<=n.EPSILON*Math.max(1,Math.abs(y),Math.abs(P))},e.exports=i},{"./common.js":197}],202:[function(t,e,r){var n=t("./common.js"),i=t("./mat3.js"),a=t("./vec3.js"),o=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=a.create(),e=a.fromValues(1,0,0),r=a.fromValues(0,1,0);return function(n,i,o){var l=a.dot(i,o);return l<-.999999?(a.cross(t,e,i),a.length(t)<1e-6&&a.cross(t,r,i),a.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):(a.cross(t,i,o),n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=1+l,s.normalize(n,n))}}(),s.setAxes=function(){var t=i.create();return function(e,r,n,i){return t[0]=n[0],t[3]=n[1],t[6]=n[2],t[1]=i[0],t[4]=i[1],t[7]=i[2],t[2]=-r[0],t[5]=-r[1],t[8]=-r[2],s.normalize(e,s.fromMat3(e,t))}}(),s.clone=o.clone,s.fromValues=o.fromValues,s.copy=o.copy,s.set=o.set,s.identity=function(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t},s.setAxisAngle=function(t,e,r){r*=.5;var n=Math.sin(r);return t[0]=n*e[0],t[1]=n*e[1],t[2]=n*e[2],t[3]=Math.cos(r),t},s.getAxisAngle=function(t,e){var r=2*Math.acos(e[3]),n=Math.sin(r/2);return 0!=n?(t[0]=e[0]/n,t[1]=e[1]/n,t[2]=e[2]/n):(t[0]=1,t[1]=0,t[2]=0),r},s.add=o.add,s.multiply=function(t,e,r){var n=e[0],i=e[1],a=e[2],o=e[3],s=r[0],l=r[1],c=r[2],u=r[3];return t[0]=n*u+o*s+i*c-a*l,t[1]=i*u+o*l+a*s-n*c,t[2]=a*u+o*c+n*l-i*s,t[3]=o*u-n*s-i*l-a*c,t},s.mul=s.multiply,s.scale=o.scale,s.rotateX=function(t,e,r){r*=.5;var n=e[0],i=e[1],a=e[2],o=e[3],s=Math.sin(r),l=Math.cos(r);return t[0]=n*l+o*s,t[1]=i*l+a*s,t[2]=a*l-i*s,t[3]=o*l-n*s,t},s.rotateY=function(t,e,r){r*=.5;var n=e[0],i=e[1],a=e[2],o=e[3],s=Math.sin(r),l=Math.cos(r);return t[0]=n*l-a*s,t[1]=i*l+o*s,t[2]=a*l+n*s,t[3]=o*l-i*s,t},s.rotateZ=function(t,e,r){r*=.5;var n=e[0],i=e[1],a=e[2],o=e[3],s=Math.sin(r),l=Math.cos(r);return t[0]=n*l+i*s,t[1]=i*l-n*s,t[2]=a*l+o*s,t[3]=o*l-a*s,t},s.calculateW=function(t,e){var r=e[0],n=e[1],i=e[2];return t[0]=r,t[1]=n,t[2]=i,t[3]=Math.sqrt(Math.abs(1-r*r-n*n-i*i)),t},s.dot=o.dot,s.lerp=o.lerp,s.slerp=function(t,e,r,n){var i,a,o,s,l,c=e[0],u=e[1],h=e[2],f=e[3],d=r[0],p=r[1],m=r[2],g=r[3];return(a=c*d+u*p+h*m+f*g)<0&&(a=-a,d=-d,p=-p,m=-m,g=-g),1-a>1e-6?(i=Math.acos(a),o=Math.sin(i),s=Math.sin((1-n)*i)/o,l=Math.sin(n*i)/o):(s=1-n,l=n),t[0]=s*c+l*d,t[1]=s*u+l*p,t[2]=s*h+l*m,t[3]=s*f+l*g,t},s.sqlerp=function(){var t=s.create(),e=s.create();return function(r,n,i,a,o,l){return s.slerp(t,n,o,l),s.slerp(e,i,a,l),s.slerp(r,t,e,2*l*(1-l)),r}}(),s.invert=function(t,e){var r=e[0],n=e[1],i=e[2],a=e[3],o=r*r+n*n+i*i+a*a,s=o?1/o:0;return t[0]=-r*s,t[1]=-n*s,t[2]=-i*s,t[3]=a*s,t},s.conjugate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=e[3],t},s.length=o.length,s.len=s.length,s.squaredLength=o.squaredLength,s.sqrLen=s.squaredLength,s.normalize=o.normalize,s.fromMat3=function(t,e){var r,n=e[0]+e[4]+e[8];if(n>0)r=Math.sqrt(n+1),t[3]=.5*r,r=.5/r,t[0]=(e[5]-e[7])*r,t[1]=(e[6]-e[2])*r,t[2]=(e[1]-e[3])*r;else{var i=0;e[4]>e[0]&&(i=1),e[8]>e[3*i+i]&&(i=2);var a=(i+1)%3,o=(i+2)%3;r=Math.sqrt(e[3*i+i]-e[3*a+a]-e[3*o+o]+1),t[i]=.5*r,r=.5/r,t[3]=(e[3*a+o]-e[3*o+a])*r,t[a]=(e[3*a+i]+e[3*i+a])*r,t[o]=(e[3*o+i]+e[3*i+o])*r}return t},s.str=function(t){return"quat("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"},s.exactEquals=o.exactEquals,s.equals=o.equals,e.exports=s},{"./common.js":197,"./mat3.js":200,"./vec3.js":204,"./vec4.js":205}],203:[function(t,e,r){var n=t("./common.js"),i={};i.create=function(){var t=new n.ARRAY_TYPE(2);return t[0]=0,t[1]=0,t},i.clone=function(t){var e=new n.ARRAY_TYPE(2);return e[0]=t[0],e[1]=t[1],e},i.fromValues=function(t,e){var r=new n.ARRAY_TYPE(2);return r[0]=t,r[1]=e,r},i.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t},i.set=function(t,e,r){return t[0]=e,t[1]=r,t},i.add=function(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t},i.subtract=function(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t},i.sub=i.subtract,i.multiply=function(t,e,r){return t[0]=e[0]*r[0],t[1]=e[1]*r[1],t},i.mul=i.multiply,i.divide=function(t,e,r){return t[0]=e[0]/r[0],t[1]=e[1]/r[1],t},i.div=i.divide,i.ceil=function(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t},i.floor=function(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t},i.min=function(t,e,r){return t[0]=Math.min(e[0],r[0]),t[1]=Math.min(e[1],r[1]),t},i.max=function(t,e,r){return t[0]=Math.max(e[0],r[0]),t[1]=Math.max(e[1],r[1]),t},i.round=function(t,e){return t[0]=Math.round(e[0]),t[1]=Math.round(e[1]),t},i.scale=function(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t},i.scaleAndAdd=function(t,e,r,n){return t[0]=e[0]+r[0]*n,t[1]=e[1]+r[1]*n,t},i.distance=function(t,e){var r=e[0]-t[0],n=e[1]-t[1];return Math.sqrt(r*r+n*n)},i.dist=i.distance,i.squaredDistance=function(t,e){var r=e[0]-t[0],n=e[1]-t[1];return r*r+n*n},i.sqrDist=i.squaredDistance,i.length=function(t){var e=t[0],r=t[1];return Math.sqrt(e*e+r*r)},i.len=i.length,i.squaredLength=function(t){var e=t[0],r=t[1];return e*e+r*r},i.sqrLen=i.squaredLength,i.negate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t},i.inverse=function(t,e){return t[0]=1/e[0],t[1]=1/e[1],t},i.normalize=function(t,e){var r=e[0],n=e[1],i=r*r+n*n;return i>0&&(i=1/Math.sqrt(i),t[0]=e[0]*i,t[1]=e[1]*i),t},i.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]},i.cross=function(t,e,r){var n=e[0]*r[1]-e[1]*r[0];return t[0]=t[1]=0,t[2]=n,t},i.lerp=function(t,e,r,n){var i=e[0],a=e[1];return t[0]=i+n*(r[0]-i),t[1]=a+n*(r[1]-a),t},i.random=function(t,e){e=e||1;var r=2*n.RANDOM()*Math.PI;return t[0]=Math.cos(r)*e,t[1]=Math.sin(r)*e,t},i.transformMat2=function(t,e,r){var n=e[0],i=e[1];return t[0]=r[0]*n+r[2]*i,t[1]=r[1]*n+r[3]*i,t},i.transformMat2d=function(t,e,r){var n=e[0],i=e[1];return t[0]=r[0]*n+r[2]*i+r[4],t[1]=r[1]*n+r[3]*i+r[5],t},i.transformMat3=function(t,e,r){var n=e[0],i=e[1];return t[0]=r[0]*n+r[3]*i+r[6],t[1]=r[1]*n+r[4]*i+r[7],t},i.transformMat4=function(t,e,r){var n=e[0],i=e[1];return t[0]=r[0]*n+r[4]*i+r[12],t[1]=r[1]*n+r[5]*i+r[13],t},i.forEach=function(){var t=i.create();return function(e,r,n,i,a,o){var s,l;for(r||(r=2),n||(n=0),l=i?Math.min(i*r+n,e.length):e.length,s=n;s<l;s+=r)t[0]=e[s],t[1]=e[s+1],a(t,t,o),e[s]=t[0],e[s+1]=t[1];return e}}(),i.str=function(t){return"vec2("+t[0]+", "+t[1]+")"},i.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]},i.equals=function(t,e){var r=t[0],i=t[1],a=e[0],o=e[1];return Math.abs(r-a)<=n.EPSILON*Math.max(1,Math.abs(r),Math.abs(a))&&Math.abs(i-o)<=n.EPSILON*Math.max(1,Math.abs(i),Math.abs(o))},e.exports=i},{"./common.js":197}],204:[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],a=r*r+n*n+i*i;return a>0&&(a=1/Math.sqrt(a),t[0]=e[0]*a,t[1]=e[1]*a,t[2]=e[2]*a),t},i.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]},i.cross=function(t,e,r){var n=e[0],i=e[1],a=e[2],o=r[0],s=r[1],l=r[2];return t[0]=i*l-a*s,t[1]=a*o-n*l,t[2]=n*s-i*o,t},i.lerp=function(t,e,r,n){var i=e[0],a=e[1],o=e[2];return t[0]=i+n*(r[0]-i),t[1]=a+n*(r[1]-a),t[2]=o+n*(r[2]-o),t},i.hermite=function(t,e,r,n,i,a){var o=a*a,s=o*(2*a-3)+1,l=o*(a-2)+a,c=o*(a-1),u=o*(3-2*a);return t[0]=e[0]*s+r[0]*l+n[0]*c+i[0]*u,t[1]=e[1]*s+r[1]*l+n[1]*c+i[1]*u,t[2]=e[2]*s+r[2]*l+n[2]*c+i[2]*u,t},i.bezier=function(t,e,r,n,i,a){var o=1-a,s=o*o,l=a*a,c=s*o,u=3*a*s,h=3*l*o,f=l*a;return t[0]=e[0]*c+r[0]*u+n[0]*h+i[0]*f,t[1]=e[1]*c+r[1]*u+n[1]*h+i[1]*f,t[2]=e[2]*c+r[2]*u+n[2]*h+i[2]*f,t},i.random=function(t,e){e=e||1;var r=2*n.RANDOM()*Math.PI,i=2*n.RANDOM()-1,a=Math.sqrt(1-i*i)*e;return t[0]=Math.cos(r)*a,t[1]=Math.sin(r)*a,t[2]=i*e,t},i.transformMat4=function(t,e,r){var n=e[0],i=e[1],a=e[2],o=r[3]*n+r[7]*i+r[11]*a+r[15];return o=o||1,t[0]=(r[0]*n+r[4]*i+r[8]*a+r[12])/o,t[1]=(r[1]*n+r[5]*i+r[9]*a+r[13])/o,t[2]=(r[2]*n+r[6]*i+r[10]*a+r[14])/o,t},i.transformMat3=function(t,e,r){var n=e[0],i=e[1],a=e[2];return t[0]=n*r[0]+i*r[3]+a*r[6],t[1]=n*r[1]+i*r[4]+a*r[7],t[2]=n*r[2]+i*r[5]+a*r[8],t},i.transformQuat=function(t,e,r){var n=e[0],i=e[1],a=e[2],o=r[0],s=r[1],l=r[2],c=r[3],u=c*n+s*a-l*i,h=c*i+l*n-o*a,f=c*a+o*i-s*n,d=-o*n-s*i-l*a;return t[0]=u*c+d*-o+h*-l-f*-s,t[1]=h*c+d*-s+f*-o-u*-l,t[2]=f*c+d*-l+u*-s-h*-o,t},i.rotateX=function(t,e,r,n){var i=[],a=[];return i[0]=e[0]-r[0],i[1]=e[1]-r[1],i[2]=e[2]-r[2],a[0]=i[0],a[1]=i[1]*Math.cos(n)-i[2]*Math.sin(n),a[2]=i[1]*Math.sin(n)+i[2]*Math.cos(n),t[0]=a[0]+r[0],t[1]=a[1]+r[1],t[2]=a[2]+r[2],t},i.rotateY=function(t,e,r,n){var i=[],a=[];return i[0]=e[0]-r[0],i[1]=e[1]-r[1],i[2]=e[2]-r[2],a[0]=i[2]*Math.sin(n)+i[0]*Math.cos(n),a[1]=i[1],a[2]=i[2]*Math.cos(n)-i[0]*Math.sin(n),t[0]=a[0]+r[0],t[1]=a[1]+r[1],t[2]=a[2]+r[2],t},i.rotateZ=function(t,e,r,n){var i=[],a=[];return i[0]=e[0]-r[0],i[1]=e[1]-r[1],i[2]=e[2]-r[2],a[0]=i[0]*Math.cos(n)-i[1]*Math.sin(n),a[1]=i[0]*Math.sin(n)+i[1]*Math.cos(n),a[2]=i[2],t[0]=a[0]+r[0],t[1]=a[1]+r[1],t[2]=a[2]+r[2],t},i.forEach=function(){var t=i.create();return function(e,r,n,i,a,o){var s,l;for(r||(r=3),n||(n=0),l=i?Math.min(i*r+n,e.length):e.length,s=n;s<l;s+=r)t[0]=e[s],t[1]=e[s+1],t[2]=e[s+2],a(t,t,o),e[s]=t[0],e[s+1]=t[1],e[s+2]=t[2];return e}}(),i.angle=function(t,e){var 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 a=i.dot(r,n);return a>1?0:Math.acos(a)},i.str=function(t){return"vec3("+t[0]+", "+t[1]+", "+t[2]+")"},i.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]},i.equals=function(t,e){var r=t[0],i=t[1],a=t[2],o=e[0],s=e[1],l=e[2];return Math.abs(r-o)<=n.EPSILON*Math.max(1,Math.abs(r),Math.abs(o))&&Math.abs(i-s)<=n.EPSILON*Math.max(1,Math.abs(i),Math.abs(s))&&Math.abs(a-l)<=n.EPSILON*Math.max(1,Math.abs(a),Math.abs(l))},e.exports=i},{"./common.js":197}],205:[function(t,e,r){var n=t("./common.js"),i={};i.create=function(){var t=new n.ARRAY_TYPE(4);return t[0]=0,t[1]=0,t[2]=0,t[3]=0,t},i.clone=function(t){var e=new n.ARRAY_TYPE(4);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e},i.fromValues=function(t,e,r,i){var a=new n.ARRAY_TYPE(4);return a[0]=t,a[1]=e,a[2]=r,a[3]=i,a},i.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t},i.set=function(t,e,r,n,i){return t[0]=e,t[1]=r,t[2]=n,t[3]=i,t},i.add=function(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t[3]=e[3]+r[3],t},i.subtract=function(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t[3]=e[3]-r[3],t},i.sub=i.subtract,i.multiply=function(t,e,r){return t[0]=e[0]*r[0],t[1]=e[1]*r[1],t[2]=e[2]*r[2],t[3]=e[3]*r[3],t},i.mul=i.multiply,i.divide=function(t,e,r){return t[0]=e[0]/r[0],t[1]=e[1]/r[1],t[2]=e[2]/r[2],t[3]=e[3]/r[3],t},i.div=i.divide,i.ceil=function(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t[2]=Math.ceil(e[2]),t[3]=Math.ceil(e[3]),t},i.floor=function(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t[2]=Math.floor(e[2]),t[3]=Math.floor(e[3]),t},i.min=function(t,e,r){return t[0]=Math.min(e[0],r[0]),t[1]=Math.min(e[1],r[1]),t[2]=Math.min(e[2],r[2]),t[3]=Math.min(e[3],r[3]),t},i.max=function(t,e,r){return t[0]=Math.max(e[0],r[0]),t[1]=Math.max(e[1],r[1]),t[2]=Math.max(e[2],r[2]),t[3]=Math.max(e[3],r[3]),t},i.round=function(t,e){return t[0]=Math.round(e[0]),t[1]=Math.round(e[1]),t[2]=Math.round(e[2]),t[3]=Math.round(e[3]),t},i.scale=function(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t},i.scaleAndAdd=function(t,e,r,n){return t[0]=e[0]+r[0]*n,t[1]=e[1]+r[1]*n,t[2]=e[2]+r[2]*n,t[3]=e[3]+r[3]*n,t},i.distance=function(t,e){var r=e[0]-t[0],n=e[1]-t[1],i=e[2]-t[2],a=e[3]-t[3];return Math.sqrt(r*r+n*n+i*i+a*a)},i.dist=i.distance,i.squaredDistance=function(t,e){var r=e[0]-t[0],n=e[1]-t[1],i=e[2]-t[2],a=e[3]-t[3];return r*r+n*n+i*i+a*a},i.sqrDist=i.squaredDistance,i.length=function(t){var e=t[0],r=t[1],n=t[2],i=t[3];return Math.sqrt(e*e+r*r+n*n+i*i)},i.len=i.length,i.squaredLength=function(t){var e=t[0],r=t[1],n=t[2],i=t[3];return e*e+r*r+n*n+i*i},i.sqrLen=i.squaredLength,i.negate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t},i.inverse=function(t,e){return t[0]=1/e[0],t[1]=1/e[1],t[2]=1/e[2],t[3]=1/e[3],t},i.normalize=function(t,e){var r=e[0],n=e[1],i=e[2],a=e[3],o=r*r+n*n+i*i+a*a;return o>0&&(o=1/Math.sqrt(o),t[0]=r*o,t[1]=n*o,t[2]=i*o,t[3]=a*o),t},i.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]},i.lerp=function(t,e,r,n){var i=e[0],a=e[1],o=e[2],s=e[3];return t[0]=i+n*(r[0]-i),t[1]=a+n*(r[1]-a),t[2]=o+n*(r[2]-o),t[3]=s+n*(r[3]-s),t},i.random=function(t,e){return e=e||1,t[0]=n.RANDOM(),t[1]=n.RANDOM(),t[2]=n.RANDOM(),t[3]=n.RANDOM(),i.normalize(t,t),i.scale(t,t,e),t},i.transformMat4=function(t,e,r){var n=e[0],i=e[1],a=e[2],o=e[3];return t[0]=r[0]*n+r[4]*i+r[8]*a+r[12]*o,t[1]=r[1]*n+r[5]*i+r[9]*a+r[13]*o,t[2]=r[2]*n+r[6]*i+r[10]*a+r[14]*o,t[3]=r[3]*n+r[7]*i+r[11]*a+r[15]*o,t},i.transformQuat=function(t,e,r){var n=e[0],i=e[1],a=e[2],o=r[0],s=r[1],l=r[2],c=r[3],u=c*n+s*a-l*i,h=c*i+l*n-o*a,f=c*a+o*i-s*n,d=-o*n-s*i-l*a;return t[0]=u*c+d*-o+h*-l-f*-s,t[1]=h*c+d*-s+f*-o-u*-l,t[2]=f*c+d*-l+u*-s-h*-o,t[3]=e[3],t},i.forEach=function(){var t=i.create();return function(e,r,n,i,a,o){var s,l;for(r||(r=4),n||(n=0),l=i?Math.min(i*r+n,e.length):e.length,s=n;s<l;s+=r)t[0]=e[s],t[1]=e[s+1],t[2]=e[s+2],t[3]=e[s+3],a(t,t,o),e[s]=t[0],e[s+1]=t[1],e[s+2]=t[2],e[s+3]=t[3];return e}}(),i.str=function(t){return"vec4("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"},i.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]},i.equals=function(t,e){var r=t[0],i=t[1],a=t[2],o=t[3],s=e[0],l=e[1],c=e[2],u=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(a-c)<=n.EPSILON*Math.max(1,Math.abs(a),Math.abs(c))&&Math.abs(o-u)<=n.EPSILON*Math.max(1,Math.abs(o),Math.abs(u))},e.exports=i},{"./common.js":197}],206:[function(t,e,r){"use strict";function n(t,e){for(var r=[0,0,0,0],n=0;n<4;++n)for(var i=0;i<4;++i)r[i]+=t[4*n+i]*e[n];return r}function i(t,e,r,i,a){for(var o=n(i,n(r,n(e,[t[0],t[1],t[2],1]))),s=0;s<3;++s)o[s]/=o[3];return[.5*a[0]*(1+o[0]),.5*a[1]*(1-o[1])]}var a=t("barycentric"),o=t("polytope-closest-point/lib/closest_point_2d.js");e.exports=function(t,e,r,n,s,l){if(1===t.length)return[0,t[0].slice()];for(var c=new Array(t.length),u=0;u<t.length;++u)c[u]=i(t[u],r,n,s,l);for(var h=0,f=1/0,u=0;u<c.length;++u){for(var d=0,p=0;p<2;++p)d+=Math.pow(c[u][p]-e[p],2);d<f&&(f=d,h=u)}for(var m=function(t,e){if(2===t.length){for(var r=0,n=0,i=0;i<2;++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),r+n<1e-6?[1,0]:[n/(r+n),r/(n+r)]}if(3===t.length){var s=[0,0];return o(t[0],t[1],t[2],e,s),a(t,s)}return[]}(c,e),g=0,u=0;u<3;++u){if(m[u]<-.001||m[u]>1.0001)return null;g+=m[u]}return Math.abs(g-1)>.001?null:[h,function(t,e){for(var r=[0,0,0],n=0;n<t.length;++n)for(var i=t[n],a=e[n],o=0;o<3;++o)r[o]+=a*i[o];return r}(t,m),m]}},{barycentric:52,"polytope-closest-point/lib/closest_point_2d.js":497}],207:[function(t,e,r){var n="precision mediump float;\n#define GLSLIFY 1\n\nuniform vec3 clipBounds[2];\nuniform float pickId;\n\nvarying vec3 f_position;\nvarying vec4 f_id;\n\nvoid main() {\n if(any(lessThan(f_position, clipBounds[0])) || \n any(greaterThan(f_position, clipBounds[1]))) {\n discard;\n }\n gl_FragColor = vec4(pickId, f_id.xyz);\n}";r.meshShader={vertex:"precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position, normal;\nattribute vec4 color;\nattribute vec2 uv;\n\nuniform mat4 model\n , view\n , projection;\nuniform vec3 eyePosition\n , lightPosition;\n\nvarying vec3 f_normal\n , f_lightDirection\n , f_eyeDirection\n , f_data;\nvarying vec4 f_color;\nvarying vec2 f_uv;\n\nvoid main() {\n vec4 m_position = model * vec4(position, 1.0);\n vec4 t_position = view * m_position;\n gl_Position = projection * t_position;\n f_color = color;\n f_normal = normal;\n f_data = position;\n f_eyeDirection = eyePosition - position;\n f_lightDirection = lightPosition - position;\n f_uv = uv;\n}",fragment:"precision mediump float;\n#define GLSLIFY 1\n\nfloat beckmannDistribution_2_0(float x, float roughness) {\n float NdotH = max(x, 0.0001);\n float cos2Alpha = NdotH * NdotH;\n float tan2Alpha = (cos2Alpha - 1.0) / cos2Alpha;\n float roughness2 = roughness * roughness;\n float denom = 3.141592653589793 * roughness2 * cos2Alpha * cos2Alpha;\n return exp(tan2Alpha / roughness2) / denom;\n}\n\n\n\nfloat cookTorranceSpecular_1_1(\n vec3 lightDirection,\n vec3 viewDirection,\n vec3 surfaceNormal,\n float roughness,\n float fresnel) {\n\n float VdotN = max(dot(viewDirection, surfaceNormal), 0.0);\n float LdotN = max(dot(lightDirection, surfaceNormal), 0.0);\n\n //Half angle vector\n vec3 H = normalize(lightDirection + viewDirection);\n\n //Geometric term\n float NdotH = max(dot(surfaceNormal, H), 0.0);\n float VdotH = max(dot(viewDirection, H), 0.000001);\n float LdotH = max(dot(lightDirection, H), 0.000001);\n float G1 = (2.0 * NdotH * VdotN) / VdotH;\n float G2 = (2.0 * NdotH * LdotN) / LdotH;\n float G = min(1.0, min(G1, G2));\n \n //Distribution term\n float D = beckmannDistribution_2_0(NdotH, roughness);\n\n //Fresnel term\n float F = pow(1.0 - VdotN, fresnel);\n\n //Multiply terms and done\n return G * F * D / max(3.14159265 * VdotN, 0.000001);\n}\n\n\n\nuniform vec3 clipBounds[2];\nuniform float roughness\n , fresnel\n , kambient\n , kdiffuse\n , kspecular\n , opacity;\nuniform sampler2D texture;\n\nvarying vec3 f_normal\n , f_lightDirection\n , f_eyeDirection\n , f_data;\nvarying vec4 f_color;\nvarying vec2 f_uv;\n\nvoid main() {\n if(any(lessThan(f_data, clipBounds[0])) || \n any(greaterThan(f_data, clipBounds[1]))) {\n discard;\n }\n\n vec3 N = normalize(f_normal);\n vec3 L = normalize(f_lightDirection);\n vec3 V = normalize(f_eyeDirection);\n \n if(!gl_FrontFacing) {\n N = -N;\n }\n\n float specular = cookTorranceSpecular_1_1(L, V, N, roughness, fresnel);\n float diffuse = min(kambient + kdiffuse * max(dot(N, L), 0.0), 1.0);\n\n vec4 surfaceColor = f_color * texture2D(texture, f_uv);\n vec4 litColor = surfaceColor.a * vec4(diffuse * surfaceColor.rgb + kspecular * vec3(1,1,1) * specular, 1.0);\n\n gl_FragColor = litColor * opacity;\n}",attributes:[{name:"position",type:"vec3"},{name:"normal",type:"vec3"},{name:"color",type:"vec4"},{name:"uv",type:"vec2"}]},r.wireShader={vertex:"precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position;\nattribute vec4 color;\nattribute vec2 uv;\n\nuniform mat4 model, view, projection;\n\nvarying vec4 f_color;\nvarying vec3 f_data;\nvarying vec2 f_uv;\n\nvoid main() {\n gl_Position = projection * view * model * vec4(position, 1.0);\n f_color = color;\n f_data = position;\n f_uv = uv;\n}",fragment:"precision mediump float;\n#define GLSLIFY 1\n\nuniform vec3 clipBounds[2];\nuniform sampler2D texture;\nuniform float opacity;\n\nvarying vec4 f_color;\nvarying vec3 f_data;\nvarying vec2 f_uv;\n\nvoid main() {\n if(any(lessThan(f_data, clipBounds[0])) || \n any(greaterThan(f_data, clipBounds[1]))) {\n discard;\n }\n\n gl_FragColor = f_color * texture2D(texture, f_uv) * opacity;\n}",attributes:[{name:"position",type:"vec3"},{name:"color",type:"vec4"},{name:"uv",type:"vec2"}]},r.pointShader={vertex:"precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position;\nattribute vec4 color;\nattribute vec2 uv;\nattribute float pointSize;\n\nuniform mat4 model, view, projection;\nuniform vec3 clipBounds[2];\n\nvarying vec4 f_color;\nvarying vec2 f_uv;\n\nvoid main() {\n if(any(lessThan(position, clipBounds[0])) || \n any(greaterThan(position, clipBounds[1]))) {\n gl_Position = vec4(0,0,0,0);\n } else {\n gl_Position = projection * view * model * vec4(position, 1.0);\n }\n gl_PointSize = pointSize;\n f_color = color;\n f_uv = uv;\n}",fragment:"precision mediump float;\n#define GLSLIFY 1\n\nuniform sampler2D texture;\nuniform float opacity;\n\nvarying vec4 f_color;\nvarying vec2 f_uv;\n\nvoid main() {\n vec2 pointR = gl_PointCoord.xy - vec2(0.5,0.5);\n if(dot(pointR, pointR) > 0.25) {\n discard;\n }\n gl_FragColor = f_color * texture2D(texture, f_uv) * opacity;\n}",attributes:[{name:"position",type:"vec3"},{name:"color",type:"vec4"},{name:"uv",type:"vec2"},{name:"pointSize",type:"float"}]},r.pickShader={vertex:"precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position;\nattribute vec4 id;\n\nuniform mat4 model, view, projection;\n\nvarying vec3 f_position;\nvarying vec4 f_id;\n\nvoid main() {\n gl_Position = projection * view * model * vec4(position, 1.0);\n f_id = id;\n f_position = position;\n}",fragment:n,attributes:[{name:"position",type:"vec3"},{name:"id",type:"vec4"}]},r.pointPickShader={vertex:"precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position;\nattribute float pointSize;\nattribute vec4 id;\n\nuniform mat4 model, view, projection;\nuniform vec3 clipBounds[2];\n\nvarying vec3 f_position;\nvarying vec4 f_id;\n\nvoid main() {\n if(any(lessThan(position, clipBounds[0])) || \n any(greaterThan(position, clipBounds[1]))) {\n gl_Position = vec4(0,0,0,0);\n } else {\n gl_Position = projection * view * model * vec4(position, 1.0);\n gl_PointSize = pointSize;\n }\n f_id = id;\n f_position = position;\n}",fragment:n,attributes:[{name:"position",type:"vec3"},{name:"pointSize",type:"float"},{name:"id",type:"vec4"}]},r.contourShader={vertex:"precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position;\n\nuniform mat4 model, view, projection;\n\nvoid main() {\n gl_Position = projection * view * model * vec4(position, 1.0);\n}",fragment:"precision mediump float;\n#define GLSLIFY 1\n\nuniform vec3 contourColor;\n\nvoid main() {\n gl_FragColor = vec4(contourColor,1);\n}\n",attributes:[{name:"position",type:"vec3"}]}},{}],208:[function(t,e,r){"use strict";function n(t,e,r,n,i,a,o,s,l,c,u,h,f,d,p,m,g,v,y,b,x,_,w,k,T,A,S){this.gl=t,this.cells=[],this.positions=[],this.intensity=[],this.texture=e,this.dirty=!0,this.triShader=r,this.lineShader=n,this.pointShader=i,this.pickShader=a,this.pointPickShader=o,this.contourShader=s,this.trianglePositions=l,this.triangleColors=u,this.triangleNormals=f,this.triangleUVs=h,this.triangleIds=c,this.triangleVAO=d,this.triangleCount=0,this.lineWidth=1,this.edgePositions=p,this.edgeColors=g,this.edgeUVs=v,this.edgeIds=m,this.edgeVAO=y,this.edgeCount=0,this.pointPositions=b,this.pointColors=_,this.pointUVs=w,this.pointSizes=k,this.pointIds=x,this.pointVAO=T,this.pointCount=0,this.contourLineWidth=1,this.contourPositions=A,this.contourVAO=S,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=M,this._view=M,this._projection=M,this._resolution=[1,1]}var i=t("gl-shader"),a=t("gl-buffer"),o=t("gl-vao"),s=t("gl-texture2d"),l=t("normals"),c=t("gl-mat4/multiply"),u=t("gl-mat4/invert"),h=t("ndarray"),f=t("colormap"),d=t("simplicial-complex-contour"),p=t("typedarray-pool"),m=t("./lib/shaders"),g=t("./lib/closest-point"),v=m.meshShader,y=m.wireShader,b=m.pointShader,x=m.pickShader,_=m.pointPickShader,w=m.contourShader,M=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],k=n.prototype;k.isOpaque=function(){return this.opacity>=1},k.isTransparent=function(){return this.opacity<1},k.pickSlots=1,k.setPickBase=function(t){this.pickId=t},k.highlight=function(t){if(t&&this.contourEnable){for(var e=d(this.cells,this.intensity,t.intensity),r=e.cells,n=e.vertexIds,i=e.vertexWeights,a=r.length,o=p.mallocFloat32(6*a),s=0,l=0;l<a;++l)for(var c=r[l],u=0;u<2;++u){var h=c[0];2===c.length&&(h=c[u]);for(var f=n[h][0],m=n[h][1],g=i[h],v=1-g,y=this.positions[f],b=this.positions[m],x=0;x<3;++x)o[s++]=g*y[x]+v*b[x]}this.contourCount=s/3|0,this.contourPositions.update(o.subarray(0,s)),p.free(o)}else this.contourCount=0},k.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=s(e,t.texture)):t.colormap&&(this.texture.shape=[256,256],this.texture.minFilter=e.LINEAR_MIPMAP_LINEAR,this.texture.magFilter=e.LINEAR,this.texture.setPixels(function(t){for(var e=f({colormap:t,nshades:256,format:"rgba"}),r=new Uint8Array(1024),n=0;n<256;++n){for(var i=e[n],a=0;a<3;++a)r[4*n+a]=i[a];r[4*n+3]=255*i[3]}return h(r,[256,256,4],[4,0,1])}(t.colormap)),this.texture.generateMipmap());var r=t.cells,n=t.positions;if(n&&r){var i=[],a=[],o=[],c=[],u=[],d=[],p=[],m=[],g=[],v=[],y=[],b=[],x=[],_=[];this.cells=r,this.positions=n;var w=t.vertexNormals,M=t.cellNormals,k=void 0===t.vertexNormalsEpsilon?1e-6:t.vertexNormalsEpsilon,T=void 0===t.faceNormalsEpsilon?1e-6:t.faceNormalsEpsilon;t.useFacetNormals&&!M&&(M=l.faceNormals(r,n,T)),M||w||(w=l.vertexNormals(r,n,k));var A=t.vertexColors,S=t.cellColors,E=t.meshColor||[1,1,1,1],L=t.vertexUVs,C=t.vertexIntensity,I=t.cellUVs,z=t.cellIntensity,D=1/0,P=-1/0;if(!L&&!I)if(C)if(t.vertexIntensityBounds)D=+t.vertexIntensityBounds[0],P=+t.vertexIntensityBounds[1];else for(H=0;H<C.length;++H){O=C[H];D=Math.min(D,O),P=Math.max(P,O)}else if(z)for(H=0;H<z.length;++H){O=z[H];D=Math.min(D,O),P=Math.max(P,O)}else for(H=0;H<n.length;++H){var O=n[H][2];D=Math.min(D,O),P=Math.max(P,O)}this.intensity=C||(z?function(t,e,r){for(var n=new Array(e),i=0;i<e;++i)n[i]=0;for(var a=t.length,i=0;i<a;++i)for(var o=t[i],s=0;s<o.length;++s)n[o[s]]=r[i];return n}(r,n.length,z):function(t){for(var e=t.length,r=new Array(e),n=0;n<e;++n)r[n]=t[n][2];return r}(n));var R=t.pointSizes,F=t.pointSize||1;this.bounds=[[1/0,1/0,1/0],[-1/0,-1/0,-1/0]];for(H=0;H<n.length;++H)for(var j=n[H],N=0;N<3;++N)!isNaN(j[N])&&isFinite(j[N])&&(this.bounds[0][N]=Math.min(this.bounds[0][N],j[N]),this.bounds[1][N]=Math.max(this.bounds[1][N],j[N]));var B=0,U=0,V=0;t:for(var H=0;H<r.length;++H){var q=r[H];switch(q.length){case 1:for(var j=n[Y=q[0]],N=0;N<3;++N)if(isNaN(j[N])||!isFinite(j[N]))continue t;v.push(j[0],j[1],j[2]);3===(W=A?A[Y]:S?S[H]:E).length?y.push(W[0],W[1],W[2],1):y.push(W[0],W[1],W[2],W[3]);X=L?L[Y]:C?[(C[Y]-D)/(P-D),0]:I?I[H]:z?[(z[H]-D)/(P-D),0]:[(j[2]-D)/(P-D),0],b.push(X[0],X[1]),R?x.push(R[Y]):x.push(F),_.push(H),V+=1;break;case 2:for(N=0;N<2;++N)for(var j=n[Y=q[N]],G=0;G<3;++G)if(isNaN(j[G])||!isFinite(j[G]))continue t;for(N=0;N<2;++N){j=n[Y=q[N]];d.push(j[0],j[1],j[2]);3===(W=A?A[Y]:S?S[H]:E).length?p.push(W[0],W[1],W[2],1):p.push(W[0],W[1],W[2],W[3]);X=L?L[Y]:C?[(C[Y]-D)/(P-D),0]:I?I[H]:z?[(z[H]-D)/(P-D),0]:[(j[2]-D)/(P-D),0],m.push(X[0],X[1]),g.push(H)}U+=1;break;case 3:for(N=0;N<3;++N)for(var j=n[Y=q[N]],G=0;G<3;++G)if(isNaN(j[G])||!isFinite(j[G]))continue t;for(N=0;N<3;++N){var Y=q[N],j=n[Y];i.push(j[0],j[1],j[2]);var W;3===(W=A?A[Y]:S?S[H]:E).length?a.push(W[0],W[1],W[2],1):a.push(W[0],W[1],W[2],W[3]);var X;X=L?L[Y]:C?[(C[Y]-D)/(P-D),0]:I?I[H]:z?[(z[H]-D)/(P-D),0]:[(j[2]-D)/(P-D),0],c.push(X[0],X[1]);var Z;Z=w?w[Y]:M[H],o.push(Z[0],Z[1],Z[2]),u.push(H)}B+=1}}this.pointCount=V,this.edgeCount=U,this.triangleCount=B,this.pointPositions.update(v),this.pointColors.update(y),this.pointUVs.update(b),this.pointSizes.update(x),this.pointIds.update(new Uint32Array(_)),this.edgePositions.update(d),this.edgeColors.update(p),this.edgeUVs.update(m),this.edgeIds.update(new Uint32Array(g)),this.trianglePositions.update(i),this.triangleColors.update(a),this.triangleUVs.update(c),this.triangleNormals.update(o),this.triangleIds.update(new Uint32Array(u))}},k.drawTransparent=k.draw=function(t){t=t||{};for(var e=this.gl,r=t.model||M,n=t.view||M,i=t.projection||M,a=[[-1e6,-1e6,-1e6],[1e6,1e6,1e6]],o=0;o<3;++o)a[0][o]=Math.max(a[0][o],this.clipBounds[0][o]),a[1][o]=Math.min(a[1][o],this.clipBounds[1][o]);var s={model:r,view:n,projection:i,clipBounds:a,kambient:this.ambientLight,kdiffuse:this.diffuseLight,kspecular:this.specularLight,roughness:this.roughness,fresnel:this.fresnel,eyePosition:[0,0,0],lightPosition:[0,0,0],opacity:this.opacity,contourColor:this.contourColor,texture:0};this.texture.bind(0);var l=new Array(16);c(l,s.view,s.model),c(l,s.projection,l),u(l,l);for(o=0;o<3;++o)s.eyePosition[o]=l[12+o]/l[15];for(var h=l[15],o=0;o<3;++o)h+=this.lightPosition[o]*l[4*o+3];for(o=0;o<3;++o){for(var f=l[12+o],d=0;d<3;++d)f+=l[4*d+o]*this.lightPosition[d];s.lightPosition[o]=f/h}if(this.triangleCount>0){(p=this.triShader).bind(),p.uniforms=s,this.triangleVAO.bind(),e.drawArrays(e.TRIANGLES,0,3*this.triangleCount),this.triangleVAO.unbind()}if(this.edgeCount>0&&this.lineWidth>0){(p=this.lineShader).bind(),p.uniforms=s,this.edgeVAO.bind(),e.lineWidth(this.lineWidth),e.drawArrays(e.LINES,0,2*this.edgeCount),this.edgeVAO.unbind()}if(this.pointCount>0){(p=this.pointShader).bind(),p.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 p=this.contourShader;p.bind(),p.uniforms=s,this.contourVAO.bind(),e.drawArrays(e.LINES,0,this.contourCount),this.contourVAO.unbind()}},k.drawPick=function(t){t=t||{};for(var e=this.gl,r=t.model||M,n=t.view||M,i=t.projection||M,a=[[-1e6,-1e6,-1e6],[1e6,1e6,1e6]],o=0;o<3;++o)a[0][o]=Math.max(a[0][o],this.clipBounds[0][o]),a[1][o]=Math.min(a[1][o],this.clipBounds[1][o]);this._model=[].slice.call(r),this._view=[].slice.call(n),this._projection=[].slice.call(i),this._resolution=[e.drawingBufferWidth,e.drawingBufferHeight];var s={model:r,view:n,projection:i,clipBounds:a,pickId:this.pickId/255},l=this.pickShader;if(l.bind(),l.uniforms=s,this.triangleCount>0&&(this.triangleVAO.bind(),e.drawArrays(e.TRIANGLES,0,3*this.triangleCount),this.triangleVAO.unbind()),this.edgeCount>0&&(this.edgeVAO.bind(),e.lineWidth(this.lineWidth),e.drawArrays(e.LINES,0,2*this.edgeCount),this.edgeVAO.unbind()),this.pointCount>0){(l=this.pointPickShader).bind(),l.uniforms=s,this.pointVAO.bind(),e.drawArrays(e.POINTS,0,this.pointCount),this.pointVAO.unbind()}},k.pick=function(t){if(!t)return null;if(t.id!==this.pickId)return null;for(var e=t.value[0]+256*t.value[1]+65536*t.value[2],r=this.cells[e],n=this.positions,i=new Array(r.length),a=0;a<r.length;++a)i[a]=n[r[a]];var o=g(i,[t.coord[0],this._resolution[1]-t.coord[1]],this._model,this._view,this._projection,this._resolution);if(!o)return null;for(var s=o[2],l=0,a=0;a<r.length;++a)l+=s[a]*this.intensity[r[a]];return{position:o[1],index:r[o[0]],cell:r,cellId:e,intensity:l,dataCoordinate:this.positions[r[o[0]]]}},k.dispose=function(){this.texture.dispose(),this.triShader.dispose(),this.lineShader.dispose(),this.pointShader.dispose(),this.pickShader.dispose(),this.pointPickShader.dispose(),this.triangleVAO.dispose(),this.trianglePositions.dispose(),this.triangleColors.dispose(),this.triangleUVs.dispose(),this.triangleNormals.dispose(),this.triangleIds.dispose(),this.edgeVAO.dispose(),this.edgePositions.dispose(),this.edgeColors.dispose(),this.edgeUVs.dispose(),this.edgeIds.dispose(),this.pointVAO.dispose(),this.pointPositions.dispose(),this.pointColors.dispose(),this.pointUVs.dispose(),this.pointSizes.dispose(),this.pointIds.dispose(),this.contourVAO.dispose(),this.contourPositions.dispose(),this.contourShader.dispose()},e.exports=function(t,e){1===arguments.length&&(t=(e=t).gl);var r=function(e){var r=i(t,v.vertex,v.fragment);return r.attributes.position.location=0,r.attributes.color.location=2,r.attributes.uv.location=3,r.attributes.normal.location=4,r}(),l=function(e){var r=i(t,y.vertex,y.fragment);return r.attributes.position.location=0,r.attributes.color.location=2,r.attributes.uv.location=3,r}(),c=function(e){var r=i(t,b.vertex,b.fragment);return r.attributes.position.location=0,r.attributes.color.location=2,r.attributes.uv.location=3,r.attributes.pointSize.location=4,r}(),u=function(e){var r=i(t,x.vertex,x.fragment);return r.attributes.position.location=0,r.attributes.id.location=1,r}(),f=function(e){var r=i(t,_.vertex,_.fragment);return r.attributes.position.location=0,r.attributes.id.location=1,r.attributes.pointSize.location=4,r}(),d=function(e){var r=i(t,w.vertex,w.fragment);return r.attributes.position.location=0,r}(),p=s(t,h(new Uint8Array([255,255,255,255]),[1,1,4]));p.generateMipmap(),p.minFilter=t.LINEAR_MIPMAP_LINEAR,p.magFilter=t.LINEAR;var m=a(t),g=a(t),M=a(t),k=a(t),T=a(t),A=o(t,[{buffer:m,type:t.FLOAT,size:3},{buffer:T,type:t.UNSIGNED_BYTE,size:4,normalized:!0},{buffer:g,type:t.FLOAT,size:4},{buffer:M,type:t.FLOAT,size:2},{buffer:k,type:t.FLOAT,size:3}]),S=a(t),E=a(t),L=a(t),C=a(t),I=o(t,[{buffer:S,type:t.FLOAT,size:3},{buffer:C,type:t.UNSIGNED_BYTE,size:4,normalized:!0},{buffer:E,type:t.FLOAT,size:4},{buffer:L,type:t.FLOAT,size:2}]),z=a(t),D=a(t),P=a(t),O=a(t),R=a(t),F=o(t,[{buffer:z,type:t.FLOAT,size:3},{buffer:R,type:t.UNSIGNED_BYTE,size:4,normalized:!0},{buffer:D,type:t.FLOAT,size:4},{buffer:P,type:t.FLOAT,size:2},{buffer:O,type:t.FLOAT,size:1}]),j=a(t),N=new n(t,p,r,l,c,u,f,d,m,T,g,M,k,A,S,C,E,L,I,z,R,D,P,O,F,j,o(t,[{buffer:j,type:t.FLOAT,size:3}]));return N.update(e),N}},{"./lib/closest-point":206,"./lib/shaders":207,colormap:102,"gl-buffer":159,"gl-mat4/invert":184,"gl-mat4/multiply":186,"gl-shader":258,"gl-texture2d":270,"gl-vao":274,ndarray:470,normals:472,"simplicial-complex-contour":528,"typedarray-pool":552}],209:[function(t,e,r){"use strict";function n(t,e,r){this.plot=t,this.vbo=e,this.shader=r}e.exports=function(t){var e=t.gl;return new n(t,i(e,[0,0,0,1,1,0,1,1]),a(e,o.boxVert,o.lineFrag))};var i=t("gl-buffer"),a=t("gl-shader"),o=t("./shaders"),s=n.prototype;s.bind=function(){var t=this.shader;this.vbo.bind(),this.shader.bind(),t.attributes.coord.pointer(),t.uniforms.screenBox=this.plot.screenBox},s.drawBox=function(){var t=[0,0],e=[0,0];return function(r,n,i,a,o){var s=this.plot,l=this.shader,c=s.gl;t[0]=r,t[1]=n,e[0]=i,e[1]=a,l.uniforms.lo=t,l.uniforms.hi=e,l.uniforms.color=o,c.drawArrays(c.TRIANGLE_STRIP,0,4)}}(),s.dispose=function(){this.vbo.dispose(),this.shader.dispose()}},{"./shaders":212,"gl-buffer":159,"gl-shader":215}],210:[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}e.exports=function(t){var e=t.gl;return new n(t,a(e),o(e,l.gridVert,l.gridFrag),o(e,l.tickVert,l.gridFrag))};var a=t("gl-buffer"),o=t("gl-shader"),s=t("binary-search-bounds"),l=t("./shaders"),c=n.prototype;c.draw=function(){var t=[0,0],e=[0,0],r=[0,0];return function(){for(var n=this.plot,i=this.vbo,a=this.shader,o=this.ticks,s=n.gl,l=n._tickBounds,c=n.dataBox,u=n.viewBox,h=n.gridLineWidth,f=n.gridLineColor,d=n.gridLineEnable,p=n.pixelRatio,m=0;m<2;++m){var g=l[m],v=l[m+2]-g,y=.5*(c[m+2]+c[m]),b=c[m+2]-c[m];e[m]=2*v/b,t[m]=2*(g-y)/b}a.bind(),i.bind(),a.attributes.dataCoord.pointer(),a.uniforms.dataShift=t,a.uniforms.dataScale=e;for(var x=0,m=0;m<2;++m){r[0]=r[1]=0,r[m]=1,a.uniforms.dataAxis=r,a.uniforms.lineWidth=h[m]/(u[m+2]-u[m])*p,a.uniforms.color=f[m];var _=6*o[m].length;d[m]&&_&&s.drawArrays(s.TRIANGLES,x,_),x+=_}}}(),c.drawTickMarks=function(){var t=[0,0],e=[0,0],r=[1,0],n=[0,1],a=[0,0],o=[0,0];return function(){for(var l=this.plot,c=this.vbo,u=this.tickShader,h=this.ticks,f=l.gl,d=l._tickBounds,p=l.dataBox,m=l.viewBox,g=l.pixelRatio,v=l.screenBox,y=v[2]-v[0],b=v[3]-v[1],x=m[2]-m[0],_=m[3]-m[1],w=0;w<2;++w){var M=d[w],k=d[w+2]-M,T=.5*(p[w+2]+p[w]),A=p[w+2]-p[w];e[w]=2*k/A,t[w]=2*(M-T)/A}e[0]*=x/y,t[0]*=x/y,e[1]*=_/b,t[1]*=_/b,u.bind(),c.bind(),u.attributes.dataCoord.pointer();var S=u.uniforms;S.dataShift=t,S.dataScale=e;var E=l.tickMarkLength,L=l.tickMarkWidth,C=l.tickMarkColor,I=6*h[0].length,z=Math.min(s.ge(h[0],(p[0]-d[0])/(d[2]-d[0]),i),h[0].length),D=Math.min(s.gt(h[0],(p[2]-d[0])/(d[2]-d[0]),i),h[0].length),P=0+6*z,O=6*Math.max(0,D-z),R=Math.min(s.ge(h[1],(p[1]-d[1])/(d[3]-d[1]),i),h[1].length),F=Math.min(s.gt(h[1],(p[3]-d[1])/(d[3]-d[1]),i),h[1].length),j=I+6*R,N=6*Math.max(0,F-R);a[0]=2*(m[0]-E[1])/y-1,a[1]=(m[3]+m[1])/b-1,o[0]=E[1]*g/y,o[1]=L[1]*g/b,N&&(S.color=C[1],S.tickScale=o,S.dataAxis=n,S.screenOffset=a,f.drawArrays(f.TRIANGLES,j,N)),a[0]=(m[2]+m[0])/y-1,a[1]=2*(m[1]-E[0])/b-1,o[0]=L[0]*g/y,o[1]=E[0]*g/b,O&&(S.color=C[0],S.tickScale=o,S.dataAxis=r,S.screenOffset=a,f.drawArrays(f.TRIANGLES,P,O)),a[0]=2*(m[2]+E[3])/y-1,a[1]=(m[3]+m[1])/b-1,o[0]=E[3]*g/y,o[1]=L[3]*g/b,N&&(S.color=C[3],S.tickScale=o,S.dataAxis=n,S.screenOffset=a,f.drawArrays(f.TRIANGLES,j,N)),a[0]=(m[2]+m[0])/y-1,a[1]=2*(m[3]+E[2])/b-1,o[0]=L[2]*g/y,o[1]=E[2]*g/b,O&&(S.color=C[2],S.tickScale=o,S.dataAxis=r,S.screenOffset=a,f.drawArrays(f.TRIANGLES,P,O))}}(),c.update=function(){var t=[1,1,-1,-1,1,-1],e=[1,-1,1,1,-1,-1];return function(r){for(var n=r.ticks,i=r.bounds,a=new Float32Array(18*(n[0].length+n[1].length)),o=(this.plot.zeroLineEnable,0),s=[[],[]],l=0;l<2;++l)for(var c=s[l],u=n[l],h=i[l],f=i[l+2],d=0;d<u.length;++d){var p=(u[d].x-h)/(f-h);c.push(p);for(var m=0;m<6;++m)a[o++]=p,a[o++]=t[m],a[o++]=e[m]}this.ticks=s,this.vbo.update(a)}}(),c.dispose=function(){this.vbo.dispose(),this.shader.dispose(),this.tickShader.dispose()}},{"./shaders":212,"binary-search-bounds":214,"gl-buffer":159,"gl-shader":215}],211:[function(t,e,r){"use strict";function n(t,e,r){this.plot=t,this.vbo=e,this.shader=r}e.exports=function(t){var e=t.gl;return new n(t,i(e,[-1,-1,-1,1,1,-1,1,1]),a(e,o.lineVert,o.lineFrag))};var i=t("gl-buffer"),a=t("gl-shader"),o=t("./shaders"),s=n.prototype;s.bind=function(){var t=this.shader;this.vbo.bind(),this.shader.bind(),t.attributes.coord.pointer(),t.uniforms.screenBox=this.plot.screenBox},s.drawLine=function(){var t=[0,0],e=[0,0];return function(r,n,i,a,o,s){var l=this.plot,c=this.shader,u=l.gl;t[0]=r,t[1]=n,e[0]=i,e[1]=a,c.uniforms.start=t,c.uniforms.end=e,c.uniforms.width=o*l.pixelRatio,c.uniforms.color=s,u.drawArrays(u.TRIANGLE_STRIP,0,4)}}(),s.dispose=function(){this.vbo.dispose(),this.shader.dispose()}},{"./shaders":212,"gl-buffer":159,"gl-shader":215}],212:[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"}},{}],213:[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]}e.exports=function(t){var e=t.gl;return new n(t,i(e),a(e,l.textVert,l.textFrag))};var i=t("gl-buffer"),a=t("gl-shader"),o=t("text-cache"),s=t("binary-search-bounds"),l=t("./shaders"),c=n.prototype;c.drawTicks=function(){var t=[0,0],e=[0,0],r=[0,0];return function(n){var i=this.plot,a=this.shader,o=this.tickX[n],l=this.tickOffset[n],c=i.gl,u=i.viewBox,h=i.dataBox,f=i.screenBox,d=i.pixelRatio,p=i.tickEnable,m=i.tickPad,g=i.tickColor,v=i.tickAngle,y=i.labelEnable,b=i.labelPad,x=i.labelColor,_=i.labelAngle,w=this.labelOffset[n],M=this.labelCount[n],k=s.lt(o,h[n]),T=s.le(o,h[n+2]);t[0]=t[1]=0,t[n]=1,e[n]=(u[2+n]+u[n])/(f[2+n]-f[n])-1;var A=2/f[2+(1^n)]-f[1^n];e[1^n]=A*u[1^n]-1,p[n]&&(e[1^n]-=A*d*m[n],k<T&&l[T]>l[k]&&(a.uniforms.dataAxis=t,a.uniforms.screenOffset=e,a.uniforms.color=g[n],a.uniforms.angle=v[n],c.drawArrays(c.TRIANGLES,l[k],l[T]-l[k]))),y[n]&&M&&(e[1^n]-=A*d*b[n],a.uniforms.dataAxis=r,a.uniforms.screenOffset=e,a.uniforms.color=x[n],a.uniforms.angle=_[n],c.drawArrays(c.TRIANGLES,w,M)),e[1^n]=A*u[2+(1^n)]-1,p[n+2]&&(e[1^n]+=A*d*m[n+2],k<T&&l[T]>l[k]&&(a.uniforms.dataAxis=t,a.uniforms.screenOffset=e,a.uniforms.color=g[n+2],a.uniforms.angle=v[n+2],c.drawArrays(c.TRIANGLES,l[k],l[T]-l[k]))),y[n+2]&&M&&(e[1^n]+=A*d*b[n+2],a.uniforms.dataAxis=r,a.uniforms.screenOffset=e,a.uniforms.color=x[n+2],a.uniforms.angle=_[n+2],c.drawArrays(c.TRIANGLES,w,M))}}(),c.drawTitle=function(){var t=[0,0],e=[0,0];return function(){var r=this.plot,n=this.shader,i=r.gl,a=r.screenBox,o=r.titleCenter,s=r.titleAngle,l=r.titleColor,c=r.pixelRatio;if(this.titleCount){for(var u=0;u<2;++u)e[u]=2*(o[u]*c-a[u])/(a[2+u]-a[u])-1;n.bind(),n.uniforms.dataAxis=t,n.uniforms.screenOffset=e,n.uniforms.angle=s,n.uniforms.color=l,i.drawArrays(i.TRIANGLES,this.titleOffset,this.titleCount)}}}(),c.bind=function(){var t=[0,0],e=[0,0],r=[0,0];return function(){var n=this.plot,i=this.shader,a=n._tickBounds,o=n.dataBox,s=n.screenBox,l=n.viewBox;i.bind();for(var c=0;c<2;++c){var u=a[c],h=a[c+2]-u,f=.5*(o[c+2]+o[c]),d=o[c+2]-o[c],p=l[c],m=l[c+2]-p,g=s[c],v=s[c+2]-g;e[c]=2*h/d*m/v,t[c]=2*(u-f)/d*m/v}r[1]=2*n.pixelRatio/(s[3]-s[1]),r[0]=r[1]*(s[3]-s[1])/(s[2]-s[0]),i.uniforms.dataScale=e,i.uniforms.dataShift=t,i.uniforms.textScale=r,this.vbo.bind(),i.attributes.textCoordinate.pointer()}}(),c.update=function(t){var e,r,n,i,a,s=[],l=t.ticks,c=t.bounds;for(a=0;a<2;++a){var u=[Math.floor(s.length/3)],h=[-1/0],f=l[a];for(e=0;e<f.length;++e){var d=f[e],p=d.x,m=d.text,g=d.font||"sans-serif";i=d.fontSize||12;for(var v=1/(c[a+2]-c[a]),y=c[a],b=m.split("\n"),x=0;x<b.length;x++)for(n=o(g,b[x]).data,r=0;r<n.length;r+=2)s.push(n[r]*i,-n[r+1]*i-x*i*1.2,(p-y)*v);u.push(Math.floor(s.length/3)),h.push(p)}this.tickOffset[a]=u,this.tickX[a]=h}for(a=0;a<2;++a){for(this.labelOffset[a]=Math.floor(s.length/3),n=o(t.labelFont[a],t.labels[a],{textAlign:"center"}).data,i=t.labelSize[a],e=0;e<n.length;e+=2)s.push(n[e]*i,-n[e+1]*i,0);this.labelCount[a]=Math.floor(s.length/3)-this.labelOffset[a]}for(this.titleOffset=Math.floor(s.length/3),n=o(t.titleFont,t.title).data,i=t.titleSize,e=0;e<n.length;e+=2)s.push(n[e]*i,-n[e+1]*i,0);this.titleCount=Math.floor(s.length/3)-this.titleOffset,this.vbo.update(s)},c.dispose=function(){this.vbo.dispose(),this.shader.dispose()}},{"./shaders":212,"binary-search-bounds":214,"gl-buffer":159,"gl-shader":215,"text-cache":543}],214:[function(t,e,r){arguments[4][87][0].apply(r,arguments)},{dup:87}],215:[function(t,e,r){"use strict";function n(t){this.gl=t,this.gl.lastAttribCount=0,this._vref=this._fref=this._relink=this.vertShader=this.fragShader=this.program=this.attributes=this.uniforms=this.types=null}function i(t,e){return t.name<e.name?-1:1}var a=t("./lib/create-uniforms"),o=t("./lib/create-attributes"),s=t("./lib/reflect"),l=t("./lib/shader-cache"),c=t("./lib/runtime-reflect"),u=t("./lib/GLError"),h=n.prototype;h.bind=function(){this.program||this._relink();var t,e=this.gl.getProgramParameter(this.program,this.gl.ACTIVE_ATTRIBUTES),r=this.gl.lastAttribCount;if(e>r)for(t=r;t<e;t++)this.gl.enableVertexAttribArray(t);else if(r>e)for(t=e;t<r;t++)this.gl.disableVertexAttribArray(t);this.gl.lastAttribCount=e,this.gl.useProgram(this.program)},h.dispose=function(){for(var t=this.gl.lastAttribCount,e=0;e<t;e++)this.gl.disableVertexAttribArray(e);this.gl.lastAttribCount=0,this._fref&&this._fref.dispose(),this._vref&&this._vref.dispose(),this.attributes=this.types=this.vertShader=this.fragShader=this.program=this._relink=this._fref=this._vref=null},h.update=function(t,e,r,n){function h(){d.program=l.program(p,d._vref,d._fref,_,w);for(var t=0;t<r.length;++t)E[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,m=d._vref;d._vref=l.shader(p,p.VERTEX_SHADER,t),m&&m.dispose(),d.vertShader=d._vref.shader;var g=this._fref;if(d._fref=l.shader(p,p.FRAGMENT_SHADER,e),g&&g.dispose(),d.fragShader=d._fref.shader,!r||!n){var v=p.createProgram();if(p.attachShader(v,d.fragShader),p.attachShader(v,d.vertShader),p.linkProgram(v),!p.getProgramParameter(v,p.LINK_STATUS)){var y=p.getProgramInfoLog(v);throw new u(y,"Error linking program:"+y)}r=r||c.uniforms(p,v),n=n||c.attributes(p,v),p.deleteProgram(v)}(n=n.slice()).sort(i);var b,x=[],_=[],w=[];for(b=0;b<n.length;++b){var M=n[b];if(M.type.indexOf("mat")>=0){for(var k=0|M.type.charAt(M.type.length-1),T=new Array(k),A=0;A<k;++A)T[A]=w.length,_.push(M.name+"["+A+"]"),"number"==typeof M.location?w.push(M.location+A):Array.isArray(M.location)&&M.location.length===k&&"number"==typeof M.location[A]?w.push(0|M.location[A]):w.push(-1);x.push({name:M.name,type:M.type,locations:T})}else x.push({name:M.name,type:M.type,locations:[w.length]}),_.push(M.name),"number"==typeof M.location?w.push(0|M.location):w.push(-1)}var S=0;for(b=0;b<w.length;++b)if(w[b]<0){for(;w.indexOf(S)>=0;)S+=1;w[b]=S}var E=new Array(r.length);h(),d._relink=h,d.types={uniforms:s(r),attributes:s(n)},d.attributes=o(p,d,x,w),Object.defineProperty(d,"uniforms",a(p,d,r,E))},e.exports=function(t,e,r,i,a){var o=new n(t);return o.update(e,r,i,a),o}},{"./lib/GLError":216,"./lib/create-attributes":217,"./lib/create-uniforms":218,"./lib/reflect":219,"./lib/runtime-reflect":220,"./lib/shader-cache":221}],216:[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).name="GLError",n.prototype.constructor=n,e.exports=n},{}],217:[function(t,e,r){"use strict";function n(t,e,r,n,i,a){this._gl=t,this._wrapper=e,this._index=r,this._locations=n,this._dimension=i,this._constFunc=a}function i(t,e,r,i,a,o,s){for(var l=["gl","v"],c=[],u=0;u<a;++u)l.push("x"+u),c.push("x"+u);l.push("if(x0.length===void 0){return gl.vertexAttrib"+a+"f(v,"+c.join()+")}else{return gl.vertexAttrib"+a+"fv(v,x0)}");var h=Function.apply(null,l),f=new n(t,e,r,i,a,h);Object.defineProperty(o,s,{set:function(e){return t.disableVertexAttribArray(i[r]),h(t,i[r],e),e},get:function(){return f},enumerable:!0})}function a(t,e,r,n,a,o,s){for(var l=new Array(a),c=new Array(a),u=0;u<a;++u)i(t,e,r[u],n,a,l,u),c[u]=l[u];Object.defineProperty(l,"location",{set:function(t){if(Array.isArray(t))for(e=0;e<a;++e)c[e].location=t[e];else for(var e=0;e<a;++e)c[e].location=t+e;return t},get:function(){for(var t=new Array(a),e=0;e<a;++e)t[e]=n[r[e]];return t},enumerable:!0}),l.pointer=function(e,i,o,s){e=e||t.FLOAT,i=!!i,o=o||a*a,s=s||0;for(var l=0;l<a;++l){var c=n[r[l]];t.vertexAttribPointer(c,a,e,i,o,s+l*a),t.enableVertexAttribArray(c)}};var h=new Array(a),f=t["vertexAttrib"+a+"fv"];Object.defineProperty(o,s,{set:function(e){for(var i=0;i<a;++i){var o=n[r[i]];if(t.disableVertexAttribArray(o),Array.isArray(e[0]))f.call(t,o,e[i]);else{for(var s=0;s<a;++s)h[s]=e[a*i+s];f.call(t,o,h)}}return e},get:function(){return l},enumerable:!0})}e.exports=function(t,e,r,n){for(var s={},l=0,c=r.length;l<c;++l){var u=r[l],h=u.name,f=u.type,d=u.locations;switch(f){case"bool":case"int":case"float":i(t,e,d[0],n,1,s,h);break;default:if(f.indexOf("vec")>=0){if((p=f.charCodeAt(f.length-1)-48)<2||p>4)throw new o("","Invalid data type for attribute "+h+": "+f);i(t,e,d[0],n,p,s,h)}else{if(!(f.indexOf("mat")>=0))throw new o("","Unknown data type for attribute "+h+": "+f);var p=f.charCodeAt(f.length-1)-48;if(p<2||p>4)throw new o("","Invalid data type for attribute "+h+": "+f);a(t,e,d,n,p,s,h)}}}return s};var o=t("./GLError"),s=n.prototype;s.pointer=function(t,e,r,n){var i=this._gl,a=this._locations[this._index];i.vertexAttribPointer(a,this._dimension,t||i.FLOAT,!!e,r||0,n||0),i.enableVertexAttribArray(a)},s.set=function(t,e,r,n){return this._constFunc(this._locations[this._index],t,e,r,n)},Object.defineProperty(s,"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":216}],218:[function(t,e,r){"use strict";function n(t){return new Function("y","return function(){return y}")(t)}function i(t,e){for(var r=new Array(t),n=0;n<t;++n)r[n]=e;return r}var a=t("./reflect"),o=t("./GLError");e.exports=function(t,e,r,s){function l(t,e,r){switch(r){case"bool":case"int":case"sampler2D":case"samplerCube":return"gl.uniform1i(locations["+e+"],obj"+t+")";case"float":return"gl.uniform1f(locations["+e+"],obj"+t+")";default:var n=r.indexOf("vec");if(!(0<=n&&n<=1&&r.length===4+n)){if(0===r.indexOf("mat")&&4===r.length){if((i=r.charCodeAt(r.length-1)-48)<2||i>4)throw new o("","Invalid uniform dimension type for matrix "+name+": "+r);return"gl.uniformMatrix"+i+"fv(locations["+e+"],false,obj"+t+")"}throw new o("","Unknown uniform data type for "+name+": "+r)}var i;if((i=r.charCodeAt(r.length-1)-48)<2||i>4)throw new o("","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 o("","Unrecognized data type for vector "+name+": "+r)}}}function c(t,e){if("object"!=typeof e)return[[t,e]];var r=[];for(var n in e){var i=e[n],a=t;parseInt(n)+""===n?a+="["+n+"]":a+="."+n,"object"==typeof i?r.push.apply(r,c(a,i)):r.push([a,i])}return r}function u(e){for(var n=["return function updateProperty(obj){"],i=c("",e),a=0;a<i.length;++a){var o=i[a],u=o[0],h=o[1];s[h]&&n.push(l(u,h,r[h].type))}return n.push("return obj}"),new Function("gl","locations",n.join("\n"))(t,s)}function h(t){switch(t){case"bool":return!1;case"int":case"sampler2D":case"samplerCube":case"float":return 0;default:var e=t.indexOf("vec");if(0<=e&&e<=1&&t.length===4+e){if((r=t.charCodeAt(t.length-1)-48)<2||r>4)throw new o("","Invalid data type");return"b"===t.charAt(0)?i(r,!1):i(r,0)}if(0===t.indexOf("mat")&&4===t.length){var r=t.charCodeAt(t.length-1)-48;if(r<2||r>4)throw new o("","Invalid uniform dimension type for matrix "+name+": "+t);return i(r*r,0)}throw new o("","Unknown uniform data type for "+name+": "+t)}}function f(i,a,o){if("object"==typeof o){var l=d(o);Object.defineProperty(i,a,{get:n(l),set:u(o),enumerable:!0,configurable:!1})}else s[o]?Object.defineProperty(i,a,{get:function(r){return new Function("gl","wrapper","locations","return function(){return gl.getUniform(wrapper.program,locations["+r+"])}")(t,e,s)}(o),set:u(o),enumerable:!0,configurable:!1}):i[a]=h(r[o].type)}function d(t){var e;if(Array.isArray(t)){e=new Array(t.length);for(var r=0;r<t.length;++r)f(e,r,t[r])}else{e={};for(var n in t)f(e,n,t[n])}return e}var p=a(r,!0);return{get:n(d(p)),set:u(p),enumerable:!0,configurable:!0}}},{"./GLError":216,"./reflect":219}],219:[function(t,e,r){"use strict";e.exports=function(t,e){for(var r={},n=0;n<t.length;++n)for(var i=t[n].name.split("."),a=r,o=0;o<i.length;++o){var s=i[o].split("[");if(s.length>1){s[0]in a||(a[s[0]]=[]),a=a[s[0]];for(var l=1;l<s.length;++l){var c=parseInt(s[l]);l<s.length-1||o<i.length-1?(c in a||(l<s.length-1?a[c]=[]:a[c]={}),a=a[c]):a[c]=e?n:t[n].type}}else o<i.length-1?(s[0]in a||(a[s[0]]={}),a=a[s[0]]):a[s[0]]=e?n:t[n].type}return r}},{}],220:[function(t,e,r){"use strict";function n(t,e){if(!a){var r=Object.keys(i);a={};for(var n=0;n<r.length;++n){var o=r[n];a[t[o]]=i[o]}}return a[e]}r.uniforms=function(t,e){for(var r=t.getProgramParameter(e,t.ACTIVE_UNIFORMS),i=[],a=0;a<r;++a){var o=t.getActiveUniform(e,a);if(o){var s=n(t,o.type);if(o.size>1)for(var l=0;l<o.size;++l)i.push({name:o.name.replace("[0]","["+l+"]"),type:s});else i.push({name:o.name,type:s})}}return i},r.attributes=function(t,e){for(var r=t.getProgramParameter(e,t.ACTIVE_ATTRIBUTES),i=[],a=0;a<r;++a){var o=t.getActiveAttrib(e,a);o&&i.push({name:o.name,type:n(t,o.type)})}return i};var i={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"},a=null},{}],221:[function(t,e,r){"use strict";function n(t,e,r,n,i,a,o){this.id=t,this.src=e,this.type=r,this.shader=n,this.count=a,this.programs=[],this.cache=o}function i(t){this.gl=t,this.shaders=[{},{}],this.programs={}}function a(t){var e=l.get(t);return e||(e=new i(t),l.set(t,e)),e}r.shader=function(t,e,r){return a(t).getShaderReference(e,r)},r.program=function(t,e,r,n,i){return a(t).getProgram(e,r,n,i)};var o=t("./GLError"),s=t("gl-format-compiler-error"),l=new("undefined"==typeof WeakMap?t("weakmap-shim"):WeakMap),c=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;n<i;++n){var a=t.programs[r[n]];a&&(delete t.programs[n],e.deleteProgram(a))}e.deleteShader(this.shader),delete t.shaders[this.type===e.FRAGMENT_SHADER|0][this.src]}};var u=i.prototype;u.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 l=function(t,e,r){var n=t.createShader(e);if(t.shaderSource(n,r),t.compileShader(n),!t.getShaderParameter(n,t.COMPILE_STATUS)){var i=t.getShaderInfoLog(n);try{var a=s(i,r,e)}catch(t){throw console.warn("Failed to format compiler error: "+t),new o(i,"Error compiling shader:\n"+i)}throw new o(i,a.short,a.long)}return n}(r,t,e);a=i[e]=new n(c++,e,t,l,[],1,this)}return a},u.getProgram=function(t,e,r,n){var i=[t.id,e.id,r.join(":"),n.join(":")].join("@"),a=this.programs[i];return a&&this.gl.isProgram(a)||(this.programs[i]=a=function(t,e,r,n,i){var a=t.createProgram();t.attachShader(a,e),t.attachShader(a,r);for(var s=0;s<n.length;++s)t.bindAttribLocation(a,i[s],n[s]);if(t.linkProgram(a),!t.getProgramParameter(a,t.LINK_STATUS)){var l=t.getProgramInfoLog(a);throw new o(l,"Error linking program: "+l)}return a}(this.gl,t.shader,e.shader,r,n),t.programs.push(i),e.programs.push(i)),a}},{"./GLError":216,"gl-format-compiler-error":168,"weakmap-shim":573}],222:[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.static=!1,this.dirty=!1,this.pickDirty=!1,this.pickDelay=120,this.pickRadius=10,this._pickTimeout=null,this._drawPick=this.drawPick.bind(this),this._depthCounter=0}function i(t){for(var e=t.slice(),r=0;r<e.length;++r)e[r]=e[r].slice();return e}function a(t,e){return t.x-e.x}e.exports=function(t){var e=t.gl,r=new n(e,o(e,[e.drawingBufferWidth,e.drawingBufferHeight]));return r.grid=s(r),r.text=l(r),r.line=c(r),r.box=u(r),r.update(t),r};var o=t("gl-select-static"),s=t("./lib/grid"),l=t("./lib/text"),c=t("./lib/line"),u=t("./lib/box"),h=n.prototype;h.setDirty=function(){this.dirty=this.pickDirty=!0},h.setOverlayDirty=function(){this.dirty=!0},h.nextDepthValue=function(){return this._depthCounter++/65536},h.draw=function(){var t=this.gl,e=this.screenBox,r=this.viewBox,n=this.dataBox,i=this.pixelRatio,a=this.grid,o=this.line,s=this.text,l=this.objects;if(this._depthCounter=0,this.pickDirty&&(this._pickTimeout&&clearTimeout(this._pickTimeout),this.pickDirty=!1,this._pickTimeout=setTimeout(this._drawPick,this.pickDelay)),this.dirty){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 c=this.borderColor;t.clearColor(c[0]*c[3],c[1]*c[3],c[2]*c[3],c[3]),t.clear(t.COLOR_BUFFER_BIT|t.DEPTH_BUFFER_BIT),t.scissor(r[0],r[1],r[2]-r[0],r[3]-r[1]),t.viewport(r[0],r[1],r[2]-r[0],r[3]-r[1]);var u=this.backgroundColor;t.clearColor(u[0]*u[3],u[1]*u[3],u[2]*u[3],u[3]),t.clear(t.COLOR_BUFFER_BIT),a.draw();var h=this.zeroLineEnable,f=this.zeroLineColor,d=this.zeroLineWidth;if(h[0]||h[1]){o.bind();for(b=0;b<2;++b)if(h[b]&&n[b]<=0&&n[b+2]>=0){var p=e[b]-n[b]*(e[b+2]-e[b])/(n[b+2]-n[b]);0===b?o.drawLine(p,e[1],p,e[3],d[b],f[b]):o.drawLine(e[0],p,e[2],p,d[b],f[b])}}for(b=0;b<l.length;++b)l[b].draw();t.viewport(e[0],e[1],e[2]-e[0],e[3]-e[1]),t.scissor(e[0],e[1],e[2]-e[0],e[3]-e[1]),this.grid.drawTickMarks(),o.bind();var m=this.borderLineEnable,g=this.borderLineWidth,v=this.borderLineColor;m[1]&&o.drawLine(r[0],r[1]-.5*g[1]*i,r[0],r[3]+.5*g[3]*i,g[1],v[1]),m[0]&&o.drawLine(r[0]-.5*g[0]*i,r[1],r[2]+.5*g[2]*i,r[1],g[0],v[0]),m[3]&&o.drawLine(r[2],r[1]-.5*g[1]*i,r[2],r[3]+.5*g[3]*i,g[3],v[3]),m[2]&&o.drawLine(r[0]-.5*g[0]*i,r[3],r[2]+.5*g[2]*i,r[3],g[2],v[2]),s.bind();for(b=0;b<2;++b)s.drawTicks(b);this.titleEnable&&s.drawTitle();for(var y=this.overlays,b=0;b<y.length;++b)y[b].draw();t.disable(t.SCISSOR_TEST),t.disable(t.BLEND),t.depthMask(!0)}},h.drawPick=function(){if(!this.static){var t=this.pickBuffer;this.gl;this._pickTimeout=null,t.begin();for(var e=1,r=this.objects,n=0;n<r.length;++n)e=r[n].drawPick(e);t.end()}},h.pick=function(t,e){if(!this.static){var r=this.pixelRatio,n=this.pickPixelRatio,i=this.viewBox,a=0|Math.round((t-i[0]/r)*n),o=0|Math.round((e-i[1]/r)*n),s=this.pickBuffer.query(a,o,this.pickRadius);if(!s)return null;for(var l=s.id+(s.value[0]<<8)+(s.value[1]<<16)+(s.value[2]<<24),c=this.objects,u=0;u<c.length;++u){var h=c[u].pick(a,o,l);if(h)return h}return null}},h.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()},h.setDataBox=function(t){var e=this.dataBox;(e[0]!==t[0]||e[1]!==t[1]||e[2]!==t[2]||e[3]!==t[3])&&(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],this.setDirty())},h.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()},h.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,o=(n[2]-n[0])/(n[3]-n[1]);this.setDataBox(t.dataBox||[-10,-10/o,10,10/o]),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 c=0;c<2;++c){var u=s[c].slice(0);0!==u.length&&(u.sort(a),l[c]=Math.min(l[c],u[0].x),l[c+2]=Math.max(l[c+2],u[u.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.static=!!t.static,this.setDirty()},h.dispose=function(){this.box.dispose(),this.grid.dispose(),this.text.dispose(),this.line.dispose();for(t=this.objects.length-1;t>=0;--t)this.objects[t].dispose();this.objects.length=0;for(var t=this.overlays.length-1;t>=0;--t)this.overlays[t].dispose();this.overlays.length=0,this.gl=null},h.addObject=function(t){this.objects.indexOf(t)<0&&(this.objects.push(t),this.setDirty())},h.removeObject=function(t){for(var e=this.objects,r=0;r<e.length;++r)if(e[r]===t){e.splice(r,1),this.setDirty();break}},h.addOverlay=function(t){this.overlays.indexOf(t)<0&&(this.overlays.push(t),this.setOverlayDirty())},h.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":209,"./lib/grid":210,"./lib/line":211,"./lib/text":213,"gl-select-static":257}],223:[function(t,e,r){var n=t("gl-shader");e.exports=function(t){return n(t,"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}","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}",null,[{name:"position",type:"vec2"}])}},{"gl-shader":258}],224:[function(t,e,r){"use strict";function n(t){var e=Math.round(Math.log(Math.abs(t))/Math.log(10));if(e<0){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 i(t){return"boolean"!=typeof t||t}e.exports=function(t){function e(){if(!b&&U.autoResize){var t=x.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*U.pixelRatio),i=0|Math.ceil(r*U.pixelRatio);if(n!==x.width||i!==x.height){x.width=n,x.height=i;var a=x.style;a.position=a.position||"absolute",a.left="0px",a.top="0px",a.width=e+"px",a.height=r+"px",O=!0}}}function r(){for(var t=I.length,e=P.length,r=0;r<e;++r)D[r]=0;t:for(r=0;r<t;++r){var n=I[r],i=n.pickSlots;if(i){for(var a=0;a<e;++a)if(D[a]+i<255){z[r]=a,n.setPickBase(D[a]+1),D[a]+=i;continue t}var o=c(_,B);z[r]=e,P.push(o),D.push(i),n.setPickBase(1),e+=1}else z[r]=-1}for(;e>0&&0===D[e-1];)D.pop(),P.pop().dispose()}function g(){if(U.contextLost)return!0;_.isContextLost()&&(U.contextLost=!0,U.mouseListener.enabled=!1,U.selection.object=null,U.oncontextloss&&U.oncontextloss())}function v(){if(!g()){e();var t=U.camera.tick();N.view=U.camera.matrix,O=O||t,R=R||t,E.pixelRatio=U.pixelRatio,C.pixelRatio=U.pixelRatio;var r=I.length,i=G[0],a=G[1];for(i[0]=i[1]=i[2]=1/0,a[0]=a[1]=a[2]=-1/0,y=0;y<r;++y){(L=I[y]).pixelRatio=U.pixelRatio,L.axes=U.axes,O=O||!!L.dirty,R=R||!!L.dirty;var o=L.bounds;if(o)for(var l=o[0],c=o[1],u=0;u<3;++u)i[u]=Math.min(i[u],l[u]),a[u]=Math.max(a[u],c[u])}var f=U.bounds;if(U.autoBounds)for(u=0;u<3;++u){if(a[u]<i[u])i[u]=-1,a[u]=1;else{i[u]===a[u]&&(i[u]-=1,a[u]+=1);var p=.05*(a[u]-i[u]);i[u]=i[u]-p,a[u]=a[u]+p}f[0][u]=i[u],f[1][u]=a[u]}for(var m=!1,u=0;u<3;++u)m=m||Y[0][u]!==f[0][u]||Y[1][u]!==f[1][u],Y[0][u]=f[0][u],Y[1][u]=f[1][u];if(R=R||m,O=O||m){if(m){for(var v=[0,0,0],y=0;y<3;++y)v[y]=n((f[1][y]-f[0][y])/10);E.autoTicks?E.update({bounds:f,tickSpacing:v}):E.update({bounds:f})}var b=_.drawingBufferWidth,x=_.drawingBufferHeight;for(B[0]=b,B[1]=x,V[0]=0|Math.max(b/U.pixelRatio,1),V[1]=0|Math.max(x/U.pixelRatio,1),d(F,U.fovy,b/x,U.zNear,U.zFar),y=0;y<16;++y)j[y]=0;j[15]=1;for(var w=0,y=0;y<3;++y)w=Math.max(w,f[1][y]-f[0][y]);for(y=0;y<3;++y)U.autoScale?j[5*y]=U.aspect[y]/(f[1][y]-f[0][y]):j[5*y]=1/w,U.autoCenter&&(j[12+y]=.5*-j[5*y]*(f[0][y]+f[1][y]));for(y=0;y<r;++y)(L=I[y]).axesBounds=f,U.clipToBounds&&(L.clipBounds=f);M.object&&(U.snapToData?C.position=M.dataCoordinate:C.position=M.dataPosition,C.bounds=f),R&&(R=!1,function(){if(!g()){_.colorMask(!0,!0,!0,!0),_.depthMask(!0),_.disable(_.BLEND),_.enable(_.DEPTH_TEST);for(var t=I.length,e=P.length,r=0;r<e;++r){var n=P[r];n.shape=V,n.begin();for(var i=0;i<t;++i)if(z[i]===r){var a=I[i];a.drawPick&&(a.pixelRatio=1,a.drawPick(N))}n.end()}}}()),U.axesPixels=s(U.axes,N,b,x),U.onrender&&U.onrender(),_.bindFramebuffer(_.FRAMEBUFFER,null),_.viewport(0,0,b,x);var A=U.clearColor;_.clearColor(A[0],A[1],A[2],A[3]),_.clear(_.COLOR_BUFFER_BIT|_.DEPTH_BUFFER_BIT),_.depthMask(!0),_.colorMask(!0,!0,!0,!0),_.enable(_.DEPTH_TEST),_.depthFunc(_.LEQUAL),_.disable(_.BLEND),_.disable(_.CULL_FACE);var S=!1;for(E.enable&&(S=S||E.isTransparent(),E.draw(N)),C.axes=E,M.object&&C.draw(N),_.disable(_.CULL_FACE),y=0;y<r;++y)(L=I[y]).axes=E,L.pixelRatio=U.pixelRatio,L.isOpaque&&L.isOpaque()&&L.draw(N),L.isTransparent&&L.isTransparent()&&(S=!0);if(S){for(k.shape=B,k.bind(),_.clear(_.DEPTH_BUFFER_BIT),_.colorMask(!1,!1,!1,!1),_.depthMask(!0),_.depthFunc(_.LESS),E.enable&&E.isTransparent()&&E.drawTransparent(N),y=0;y<r;++y)(L=I[y]).isOpaque&&L.isOpaque()&&L.draw(N);for(_.enable(_.BLEND),_.blendEquation(_.FUNC_ADD),_.blendFunc(_.ONE,_.ONE_MINUS_SRC_ALPHA),_.colorMask(!0,!0,!0,!0),_.depthMask(!1),_.clearColor(0,0,0,0),_.clear(_.COLOR_BUFFER_BIT),E.isTransparent()&&E.drawTransparent(N),y=0;y<r;++y){var L=I[y];L.isTransparent&&L.isTransparent()&&L.drawTransparent(N)}_.bindFramebuffer(_.FRAMEBUFFER,null),_.blendFunc(_.ONE,_.ONE_MINUS_SRC_ALPHA),_.disable(_.DEPTH_TEST),T.bind(),k.color[0].bind(0),T.uniforms.accumBuffer=0,h(_),_.disable(_.BLEND)}for(O=!1,y=0;y<r;++y)I[y].dirty=!1}}}function y(){b||U.contextLost||(requestAnimationFrame(y),v())}var b=!1,x=((t=t||{}).pixelRatio||parseFloat(window.devicePixelRatio),t.canvas);x||(x=document.createElement("canvas"),t.container?t.container.appendChild(x):document.body.appendChild(x));var _=t.gl;if(_||(_=function(t,e){var r=null;try{(r=t.getContext("webgl",e))||(r=t.getContext("experimental-webgl",e))}catch(t){return null}return r}(x,t.glOptions||{premultipliedAlpha:!0,antialias:!0})),!_)throw new Error("webgl not supported");var w=t.bounds||[[-10,-10,-10],[10,10,10]],M=new function(){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},k=u(_,[_.drawingBufferWidth,_.drawingBufferHeight],{preferFloat:!m}),T=p(_),A=t.camera||{eye:[2,0,0],center:[0,0,0],up:[0,1,0],zoomMin:.1,zoomMax:100,mode:"turntable"},S=t.axes||{},E=o(_,S);E.enable=!S.disable;var L=t.spikes||{},C=l(_,L),I=[],z=[],D=[],P=[],O=!0,R=!0,F=new Array(16),j=new Array(16),N={view:null,projection:F,model:j},R=!0,B=[_.drawingBufferWidth,_.drawingBufferHeight],U={gl:_,contextLost:!1,pixelRatio:t.pixelRatio||parseFloat(window.devicePixelRatio),canvas:x,selection:M,camera:a(x,A),axes:E,axesPixels:null,spikes:C,bounds:w,objects:I,shape:B,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:i(t.autoResize),autoBounds:i(t.autoBounds),autoScale:!!t.autoScale,autoCenter:i(t.autoCenter),clipToBounds:i(t.clipToBounds),snapToData:!!t.snapToData,onselect:t.onselect||null,onrender:t.onrender||null,onclick:t.onclick||null,cameraParams:N,oncontextloss:null,mouseListener:null},V=[_.drawingBufferWidth/U.pixelRatio|0,_.drawingBufferHeight/U.pixelRatio|0];U.autoResize&&e(),window.addEventListener("resize",e),U.update=function(t){b||(t=t||{},O=!0,R=!0)},U.add=function(t){b||(t.axes=E,I.push(t),z.push(-1),O=!0,R=!0,r())},U.remove=function(t){if(!b){var e=I.indexOf(t);e<0||(I.splice(e,1),z.pop(),O=!0,R=!0,r())}},U.dispose=function(){if(!b&&(b=!0,window.removeEventListener("resize",e),x.removeEventListener("webglcontextlost",g),U.mouseListener.enabled=!1,!U.contextLost)){for(E.dispose(),C.dispose(),t=0;t<I.length;++t)I[t].dispose();k.dispose();for(var t=0;t<P.length;++t)P[t].dispose();T.dispose(),_=null,E=null,C=null,I=[]}};var H=!1,q=0;U.mouseListener=f(x,function(t,e,r){if(!b){var n=P.length,i=I.length,a=M.object;M.distance=1/0,M.mouse[0]=e,M.mouse[1]=r,M.object=null,M.screen=null,M.dataCoordinate=M.dataPosition=null;var o=!1;if(t&&q)H=!0;else{H&&(R=!0),H=!1;for(var s=0;s<n;++s){var l=P[s].query(e,V[1]-r-1,U.pickRadius);if(l){if(l.distance>M.distance)continue;for(var c=0;c<i;++c){var u=I[c];if(z[c]===s){var h=u.pick(l);h&&(M.buttons=t,M.screen=l.coord,M.distance=l.distance,M.object=u,M.index=h.distance,M.dataPosition=h.position,M.dataCoordinate=h.dataCoordinate,M.data=h,o=!0)}}}}}a&&a!==M.object&&(a.highlight&&a.highlight(null),O=!0),M.object&&(M.object.highlight&&M.object.highlight(M.data),O=!0),(o=o||M.object!==a)&&U.onselect&&U.onselect(M),1&t&&!(1&q)&&U.onclick&&U.onclick(M),q=t}}),x.addEventListener("webglcontextlost",g);var G=[[1/0,1/0,1/0],[-1/0,-1/0,-1/0]],Y=[G[0].slice(),G[1].slice()];return y(),U.redraw=function(){b||(O=!0,v())},U};var a=t("3d-view-controls"),o=t("gl-axes3d"),s=t("gl-axes3d/properties"),l=t("gl-spikes3d"),c=t("gl-select-static"),u=t("gl-fbo"),h=t("a-big-triangle"),f=t("mouse-change"),d=t("gl-mat4/perspective"),p=t("./lib/shader"),m=t("is-mobile")()},{"./lib/shader":223,"3d-view-controls":39,"a-big-triangle":42,"gl-axes3d":151,"gl-axes3d/properties":158,"gl-fbo":167,"gl-mat4/perspective":187,"gl-select-static":257,"gl-spikes3d":267,"is-mobile":299,"mouse-change":455}],225:[function(t,e,r){r.pointVertex="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 position;\n\nuniform mat3 matrix;\nuniform float pointSize;\nuniform float pointCloud;\n\nhighp float rand(vec2 co) {\n highp float a = 12.9898;\n highp float b = 78.233;\n highp float c = 43758.5453;\n highp float d = dot(co.xy, vec2(a, b));\n highp float e = mod(d, 3.14);\n return fract(sin(e) * c);\n}\n\nvoid main() {\n vec3 hgPosition = matrix * vec3(position, 1);\n gl_Position = vec4(hgPosition.xy, 0, hgPosition.z);\n // if we don't jitter the point size a bit, overall point cloud\n // saturation 'jumps' on zooming, which is disturbing and confusing\n gl_PointSize = pointSize * ((19.5 + rand(position)) / 20.0);\n if(pointCloud != 0.0) { // pointCloud is truthy\n // get the same square surface as circle would be\n gl_PointSize *= 0.886;\n }\n}",r.pointFragment="precision mediump float;\n#define GLSLIFY 1\n\nuniform vec4 color, borderColor;\nuniform float centerFraction;\nuniform float pointCloud;\n\nvoid main() {\n float radius;\n vec4 baseColor;\n if(pointCloud != 0.0) { // pointCloud is truthy\n if(centerFraction == 1.0) {\n gl_FragColor = color;\n } else {\n gl_FragColor = mix(borderColor, color, centerFraction);\n }\n } else {\n radius = length(2.0 * gl_PointCoord.xy - 1.0);\n if(radius > 1.0) {\n discard;\n }\n baseColor = mix(borderColor, color, step(radius, centerFraction));\n gl_FragColor = vec4(baseColor.rgb * baseColor.a, baseColor.a);\n }\n}\n",r.pickVertex="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"},{}],226:[function(t,e,r){arguments[4][215][0].apply(r,arguments)},{"./lib/GLError":227,"./lib/create-attributes":228,"./lib/create-uniforms":229,"./lib/reflect":230,"./lib/runtime-reflect":231,"./lib/shader-cache":232,dup:215}],227:[function(t,e,r){arguments[4][216][0].apply(r,arguments)},{dup:216}],228:[function(t,e,r){arguments[4][217][0].apply(r,arguments)},{"./GLError":227,dup:217}],229:[function(t,e,r){arguments[4][218][0].apply(r,arguments)},{"./GLError":227,"./reflect":230,dup:218}],230:[function(t,e,r){arguments[4][219][0].apply(r,arguments)},{dup:219}],231:[function(t,e,r){arguments[4][220][0].apply(r,arguments)},{dup:220}],232:[function(t,e,r){arguments[4][221][0].apply(r,arguments)},{"./GLError":227,dup:221,"gl-format-compiler-error":168,"weakmap-shim":573}],233:[function(t,e,r){"use strict";function n(t,e,r,n,i){this.plot=t,this.offsetBuffer=e,this.pickBuffer=r,this.shader=n,this.pickShader=i,this.sizeMin=.5,this.sizeMinCap=2,this.sizeMax=20,this.areaRatio=1,this.pointCount=0,this.color=[1,0,0,1],this.borderColor=[0,0,0,1],this.blend=!1,this.pickOffset=0,this.points=null}var i=t("gl-shader"),a=t("gl-buffer"),o=t("typedarray-pool"),s=t("./lib/shader");e.exports=function(t,e){var r=t.gl,o=new n(t,a(r),a(r),i(r,s.pointVertex,s.pointFragment),i(r,s.pickVertex,s.pickFragment));return o.update(e),t.addObject(o),o};var l=n.prototype;l.dispose=function(){this.shader.dispose(),this.pickShader.dispose(),this.offsetBuffer.dispose(),this.pickBuffer.dispose(),this.plot.removeObject(this)},l.update=function(t){function e(e,r){return e in t?t[e]:r}var r;t=t||{},this.sizeMin=e("sizeMin",.5),this.sizeMax=e("sizeMax",20),this.color=e("color",[1,0,0,1]).slice(),this.areaRatio=e("areaRatio",1),this.borderColor=e("borderColor",[0,0,0,1]).slice(),this.blend=e("blend",!1);var n=t.positions.length>>>1,i=t.positions instanceof Float32Array,a=t.idToIndex instanceof Int32Array&&t.idToIndex.length>=n,s=t.positions,l=i?s:o.mallocFloat32(s.length),c=a?t.idToIndex:o.mallocInt32(n);if(i||l.set(s),!a)for(l.set(s),r=0;r<n;r++)c[r]=r;this.points=s,this.offsetBuffer.update(l),this.pickBuffer.update(c),i||o.free(l),a||o.free(c),this.pointCount=n,this.pickOffset=0},l.unifiedDraw=function(){var t=[1,0,0,0,1,0,0,0,1],e=[0,0,0,0];return function(r){var n=void 0!==r,i=n?this.pickShader:this.shader,a=this.plot.gl,o=this.plot.dataBox;if(0===this.pointCount)return r;var s=o[2]-o[0],l=o[3]-o[1],c=function(t,e){var r,n=0,i=t.length>>>1;for(r=0;r<i;r++){var a=t[2*r],o=t[2*r+1];a>=e[0]&&a<=e[2]&&o>=e[1]&&o<=e[3]&&n++}return n}(this.points,o),u=this.plot.pickPixelRatio*Math.max(Math.min(this.sizeMinCap,this.sizeMin),Math.min(this.sizeMax,this.sizeMax/Math.pow(c,.33333)));t[0]=2/s,t[4]=2/l,t[6]=-2*o[0]/s-1,t[7]=-2*o[1]/l-1,this.offsetBuffer.bind(),i.bind(),i.attributes.position.pointer(),i.uniforms.matrix=t,i.uniforms.color=this.color,i.uniforms.borderColor=this.borderColor,i.uniforms.pointCloud=u<5,i.uniforms.pointSize=u,i.uniforms.centerFraction=Math.min(1,Math.max(0,Math.sqrt(1-this.areaRatio))),n&&(e[0]=255&r,e[1]=r>>8&255,e[2]=r>>16&255,e[3]=r>>24&255,this.pickBuffer.bind(),i.attributes.pickId.pointer(a.UNSIGNED_BYTE),i.uniforms.pickOffset=e,this.pickOffset=r);var h=a.getParameter(a.BLEND),f=a.getParameter(a.DITHER);return h&&!this.blend&&a.disable(a.BLEND),f&&a.disable(a.DITHER),a.drawArrays(a.POINTS,0,this.pointCount),h&&!this.blend&&a.enable(a.BLEND),f&&a.enable(a.DITHER),r+this.pointCount}}(),l.draw=l.unifiedDraw,l.drawPick=l.unifiedDraw,l.pick=function(t,e,r){var n=this.pickOffset,i=this.pointCount;if(r<n||r>=n+i)return null;var a=r-n,o=this.points;return{object:this,pointId:a,dataCoord:[o[2*a],o[2*a+1]]}}},{"./lib/shader":225,"gl-buffer":159,"gl-shader":226,"typedarray-pool":552}],234:[function(t,e,r){e.exports=function(t,e,r,n){var i,a,o,s,l,c=e[0],u=e[1],h=e[2],f=e[3],d=r[0],p=r[1],m=r[2],g=r[3];return(a=c*d+u*p+h*m+f*g)<0&&(a=-a,d=-d,p=-p,m=-m,g=-g),1-a>1e-6?(i=Math.acos(a),o=Math.sin(i),s=Math.sin((1-n)*i)/o,l=Math.sin(n*i)/o):(s=1-n,l=n),t[0]=s*c+l*d,t[1]=s*u+l*p,t[2]=s*h+l*m,t[3]=s*f+l*g,t}},{}],235:[function(t,e,r){"use strict";e.exports={vertex:"precision highp float;\n#define GLSLIFY 1\n\n\nvec4 computePosition_1_0(vec2 posHi, vec2 posLo, vec2 scHi, vec2 scLo, vec2 trHi, vec2 trLo) {\n return vec4((posHi + trHi) * scHi\n \t\t\t//FIXME: this thingy does not give noticeable precision gain, need test\n + (posLo + trLo) * scHi\n + (posHi + trHi) * scLo\n + (posLo + trLo) * scLo\n , 0, 1);\n}\n\n\nattribute vec2 positionHi, positionLo;\nattribute float size, border;\nattribute vec2 char, color;\n\n//this is 64-bit form of scale and translate\nuniform vec2 scaleHi, scaleLo, translateHi, translateLo;\nuniform float pixelRatio;\nuniform vec4 viewBox;\nuniform sampler2D palette;\n\nvarying vec4 charColor, borderColor;\nvarying vec2 charId;\nvarying vec2 pointCoord;\nvarying float pointSize;\nvarying float borderWidth;\n\n\nvoid main() {\n charColor = texture2D(palette, vec2(color.x / 255., 0));\n borderColor = texture2D(palette, vec2(color.y / 255., 0));\n\n gl_PointSize = size * pixelRatio;\n pointSize = size * pixelRatio;\n\n charId = char;\n borderWidth = border;\n\n gl_Position = computePosition_1_0(\n positionHi, positionLo,\n scaleHi, scaleLo,\n translateHi, translateLo);\n\n pointCoord = viewBox.xy + (viewBox.zw - viewBox.xy) * (gl_Position.xy * .5 + .5);\n}\n",fragment:"precision highp float;\n#define GLSLIFY 1\n\nuniform sampler2D chars;\nuniform vec2 charsShape;\nuniform float charsStep, pixelRatio, charOffset;\n\nvarying vec4 borderColor;\nvarying vec4 charColor;\nvarying vec2 charId;\nvarying vec2 pointCoord;\nvarying float pointSize;\nvarying float borderWidth;\n\nvoid main() {\n\tvec2 pointUV = (pointCoord - gl_FragCoord.xy + pointSize * .5) / pointSize;\n\tpointUV.x = 1. - pointUV.x;\n\tvec2 texCoord = ((charId + pointUV) * charsStep) / charsShape;\n\tfloat dist = texture2D(chars, texCoord).r;\n\n\t//max-distance alpha\n\tif (dist < 1e-2)\n\t\tdiscard;\n\n\tfloat gamma = .0045 * charsStep / pointSize;\n\n //null-border case\n \tif (borderWidth * borderColor.a == 0.) {\n\t\tfloat charAmt = smoothstep(.748 - gamma, .748 + gamma, dist);\n\t\tgl_FragColor = vec4(charColor.rgb, charAmt*charColor.a);\n\t\treturn;\n\t}\n\n\tfloat dif = 5. * pixelRatio * borderWidth / pointSize;\n\tfloat borderLevel = .748 - dif * .5;\n\tfloat charLevel = .748 + dif * .5;\n\n\tfloat borderAmt = smoothstep(borderLevel - gamma, borderLevel + gamma, dist);\n\tfloat charAmt = smoothstep(charLevel - gamma, charLevel + gamma, dist);\n\n\tvec4 color = borderColor;\n\tcolor.a *= borderAmt;\n\n\tgl_FragColor = mix(color, charColor, charAmt);\n}\n",pickVertex:"precision highp float;\n#define GLSLIFY 1\n\nattribute vec2 positionHi, positionLo;\nattribute vec4 id;\nattribute float size;\n\nuniform vec2 scaleHi, scaleLo, translateHi, translateLo;\nuniform vec4 pickOffset;\nuniform float pixelRatio;\n\nvarying vec4 fragColor;\n\n\nvec4 computePosition_1_0(vec2 posHi, vec2 posLo, vec2 scHi, vec2 scLo, vec2 trHi, vec2 trLo) {\n return vec4((posHi + trHi) * scHi\n \t\t\t//FIXME: this thingy does not give noticeable precision gain, need test\n + (posLo + trLo) * scHi\n + (posHi + trHi) * scLo\n + (posLo + trLo) * scLo\n , 0, 1);\n}\n\n\nvoid main() {\n vec4 fragId = id + pickOffset;\n\n fragId.y += floor(fragId.x / 256.0);\n fragId.x -= floor(fragId.x / 256.0) * 256.0;\n\n fragId.z += floor(fragId.y / 256.0);\n fragId.y -= floor(fragId.y / 256.0) * 256.0;\n\n fragId.w += floor(fragId.z / 256.0);\n fragId.z -= floor(fragId.z / 256.0) * 256.0;\n\n fragColor = fragId / 255.0;\n\n gl_PointSize = size * .25 * pixelRatio;\n\n gl_Position = computePosition_1_0(\n positionHi, positionLo,\n scaleHi, scaleLo,\n translateHi, translateLo);\n}\n",pickFragment:"precision lowp float;\n#define GLSLIFY 1\nvarying vec4 fragColor;\nvoid main() {\n gl_FragColor = fragColor;\n}\n"}},{}],236:[function(t,e,r){arguments[4][87][0].apply(r,arguments)},{dup:87}],237:[function(t,e,r){arguments[4][215][0].apply(r,arguments)},{"./lib/GLError":238,"./lib/create-attributes":239,"./lib/create-uniforms":240,"./lib/reflect":241,"./lib/runtime-reflect":242,"./lib/shader-cache":243,dup:215}],238:[function(t,e,r){arguments[4][216][0].apply(r,arguments)},{dup:216}],239:[function(t,e,r){arguments[4][217][0].apply(r,arguments)},{"./GLError":238,dup:217}],240:[function(t,e,r){arguments[4][218][0].apply(r,arguments)},{"./GLError":238,"./reflect":241,dup:218}],241:[function(t,e,r){arguments[4][219][0].apply(r,arguments)},{dup:219}],242:[function(t,e,r){arguments[4][220][0].apply(r,arguments)},{dup:220}],243:[function(t,e,r){arguments[4][221][0].apply(r,arguments)},{"./GLError":238,dup:221,"gl-format-compiler-error":168,"weakmap-shim":573}],244:[function(t,e,r){"use strict";function n(t,e,r,n,i,a){for(var o=t+1;o<=e;++o){for(var s=r[o],l=n[2*o],c=n[2*o+1],u=i[o],h=a[o],f=o;f>t;){var d=r[f-1],p=n[2*(f-1)];if((d-s||l-p)>=0)break;r[f]=d,n[2*f]=p,n[2*f+1]=n[2*f-1],i[f]=i[f-1],a[f]=a[f-1],f-=1}r[f]=s,n[2*f]=l,n[2*f+1]=c,i[f]=u,a[f]=h}}function i(t,e,r,n,i,a){var o=r[t],s=n[2*t],l=n[2*t+1],c=i[t],u=a[t];r[t]=r[e],n[2*t]=n[2*e],n[2*t+1]=n[2*e+1],i[t]=i[e],a[t]=a[e],r[e]=o,n[2*e]=s,n[2*e+1]=l,i[e]=c,a[e]=u}function a(t,e,r,n,i,a){r[t]=r[e],n[2*t]=n[2*e],n[2*t+1]=n[2*e+1],i[t]=i[e],a[t]=a[e]}function o(t,e,r,n,i,a,o){var s=n[t],l=i[2*t],c=i[2*t+1],u=a[t],h=o[t];n[t]=n[e],i[2*t]=i[2*e],i[2*t+1]=i[2*e+1],a[t]=a[e],o[t]=o[e],n[e]=n[r],i[2*e]=i[2*r],i[2*e+1]=i[2*r+1],a[e]=a[r],o[e]=o[r],n[r]=s,i[2*r]=l,i[2*r+1]=c,a[r]=u,o[r]=h}function s(t,e,r,n,i,a,o,s,l,c,u){s[t]=s[e],l[2*t]=l[2*e],l[2*t+1]=l[2*e+1],c[t]=c[e],u[t]=u[e],s[e]=r,l[2*e]=n,l[2*e+1]=i,c[e]=a,u[e]=o}function l(t,e,r,n,i){return(r[t]-r[e]||n[2*e]-n[2*t]||i[t]-i[e])<0}function c(t,e,r,n,i,a,o,s){return(e-a[t]||o[2*t]-r||i-s[t])<0}function u(t,e,r,f,d,p){var m=(e-t+1)/6|0,g=t+m,v=e-m,y=t+e>>1,b=y-m,x=y+m,_=g,w=b,M=y,k=x,T=v,A=t+1,S=e-1,E=0;l(_,w,r,f,d)&&(E=_,_=w,w=E),l(k,T,r,f,d)&&(E=k,k=T,T=E),l(_,M,r,f,d)&&(E=_,_=M,M=E),l(w,M,r,f,d)&&(E=w,w=M,M=E),l(_,k,r,f,d)&&(E=_,_=k,k=E),l(M,k,r,f,d)&&(E=M,M=k,k=E),l(w,T,r,f,d)&&(E=w,w=T,T=E),l(w,M,r,f,d)&&(E=w,w=M,M=E),l(k,T,r,f,d)&&(E=k,k=T,T=E);var L=r[w],C=f[2*w],I=f[2*w+1],z=d[w],D=p[w],P=r[k],O=f[2*k],R=f[2*k+1],F=d[k],j=p[k],N=_,B=M,U=T,V=g,H=y,q=v,G=r[N],Y=r[B],W=r[U];r[V]=G,r[H]=Y,r[q]=W;for(var X=0;X<2;++X){var Z=f[2*N+X],J=f[2*B+X],K=f[2*U+X];f[2*V+X]=Z,f[2*H+X]=J,f[2*q+X]=K}var Q=d[N],$=d[B],tt=d[U];d[V]=Q,d[H]=$,d[q]=tt;var et=p[N],rt=p[B],nt=p[U];p[V]=et,p[H]=rt,p[q]=nt,a(b,t,r,f,d,p),a(x,e,r,f,d,p);for(var it=A;it<=S;++it)if(c(it,L,C,0,z,r,f,d))it!==A&&i(it,A,r,f,d,p),++A;else if(!c(it,P,O,0,F,r,f,d))for(;;){if(c(S,P,O,0,F,r,f,d)){c(S,L,C,0,z,r,f,d)?(o(it,A,S,r,f,d,p),++A,--S):(i(it,S,r,f,d,p),--S);break}if(--S<it)break}s(t,A-1,L,C,I,z,D,r,f,d,p),s(e,S+1,P,O,R,F,j,r,f,d,p),A-2-t<=h?n(t,A-2,r,f,d,p):u(t,A-2,r,f,d,p),e-(S+2)<=h?n(S+2,e,r,f,d,p):u(S+2,e,r,f,d,p),S-A<=h?n(A,S,r,f,d,p):u(A,S,r,f,d,p)}e.exports=function(t,e,r,i,a){a<=4*h?n(0,a-1,t,e,r,i):u(0,a-1,t,e,r,i)};var h=32},{}],245:[function(t,e,r){"use strict";function n(t,e,r,n,i,a,o,s){for(var l=r,c=r;c<n;++c){var u=t[2*c],h=t[2*c+1],f=e[c];i<=u&&u<=o&&a<=h&&h<=s&&(c===l?l+=1:(t[2*c]=t[2*l],t[2*c+1]=t[2*l+1],e[c]=e[l],t[2*l]=u,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}var a=t("typedarray-pool"),o=t("./lib/sort");e.exports=function(t,e,r,s){function l(i,a,o,s,c,u){var h=.5*o,f=s+1,d=c-s;r[_]=d,x[_++]=u;for(var p=0;p<2;++p)for(var m=0;m<2;++m){var g=i+p*h,v=a+m*h,y=n(t,e,f,c,g,v,g+h,v+h);if(y!==f){if(y-f>=Math.max(.9*d,32)){var b=c+s>>>1;l(g,v,h,f,b,u+1),f=b}l(g,v,h,f,y,u+1),f=y}}}var c=t.length>>>1;if(c<1)return[];for(var u=1/0,h=1/0,f=-1/0,d=-1/0,p=0;p<c;++p){var m=t[2*p],g=t[2*p+1];u=Math.min(u,m),f=Math.max(f,m),h=Math.min(h,g),d=Math.max(d,g),e[p]=p}u===f&&(f+=1+Math.abs(f)),h===d&&(d+=1+Math.abs(f));var v=1/(f-u),y=1/(d-h),b=Math.max(f-u,d-h);(s=s||[0,0,0,0])[0]=u,s[1]=h,s[2]=f,s[3]=d;var x=a.mallocInt32(c),_=0;l(u,h,b,0,c,0),o(x,t,e,r,c);for(var w=[],M=0,k=c,_=c-1;_>=0;--_){t[2*_]=(t[2*_]-u)*v,t[2*_+1]=(t[2*_+1]-h)*y;var T=x[_];T!==M&&(w.push(new i(b*Math.pow(.5,T),_+1,k-(_+1))),k=_+1,M=T)}return w.push(new i(b*Math.pow(.5,T+1),0,k)),a.free(x),w}},{"./lib/sort":244,"typedarray-pool":552}],246:[function(t,e,r){"use strict";function n(t,e,r,n,i,a,o,s){this.plot=t,this.shader=e,this.pickShader=r,this.positionBuffer=n,this.sizeBuffer=i,this.colorBuffer=a,this.idBuffer=o,this.charBuffer=s,this.pointCount=0,this.pickOffset=0,this.points=null,this.scales=[],this.xCoords=[],this.charCanvas=document.createElement("canvas"),this.charTexture=d(this.plot.gl,this.charCanvas),this.charStep=400,this.charFit=.255,this.snapThreshold=1e4,this.paletteTexture=d(this.plot.gl,[256,1])}e.exports=function(t,e){var r=t.gl,i=new n(t,s(r,u.vertex,u.fragment),s(r,u.pickVertex,u.pickFragment),l(r),l(r),l(r),l(r),l(r));return i.update(e),t.addObject(i),i};var i,a,o,s=t("gl-shader"),l=t("gl-buffer"),c=t("typedarray-pool"),u=t("./lib/shaders"),h=t("snap-points-2d"),f=t("font-atlas-sdf"),d=t("gl-texture2d"),p=t("color-id"),m=t("ndarray"),g=t("clamp"),v=t("binary-search-bounds"),y=n.prototype,b=new Float32Array([0,0]),x=new Float32Array([0,0]),_=new Float32Array([0,0]),w=new Float32Array([0,0]),M=[0,0],k=[0,0,0,0];y.drawPick=function(t){var e=void 0!==t,r=this.plot,n=this.pointCount,s=n>this.snapThreshold;if(!n)return t;(function(){var t=this.plot,e=t.viewBox,r=t.dataBox,n=t.pixelRatio,s=r[2]-r[0],l=r[3]-r[1],c=2/s,u=2/l,h=-r[0]-.5*s,f=-r[1]-.5*l;b[0]=c,x[0]=c-b[0],b[1]=u,x[1]=u-b[1],_[0]=h,w[0]=h-_[0],_[1]=f,w[1]=f-_[1];var d=e[2]-e[0],p=e[3]-e[1];i=Math.min(s/d,l/p),M[0]=2*n/d,M[1]=2*n/p,a=r[0],o=r[2]}).call(this);var l=r.gl,c=e?this.pickShader:this.shader,u=l.isEnabled(l.BLEND);if(c.bind(),e){this.pickOffset=t;for(var h=0;h<4;++h)k[h]=t>>8*h&255;c.uniforms.pickOffset=k,this.idBuffer.bind(),c.attributes.id.pointer(l.UNSIGNED_BYTE,!1)}else l.blendFuncSeparate(l.SRC_ALPHA,l.ONE_MINUS_SRC_ALPHA,l.ONE,l.ONE_MINUS_SRC_ALPHA),l.blendColor(0,0,0,1),u||l.enable(l.BLEND),this.colorBuffer.bind(),c.attributes.color.pointer(l.UNSIGNED_BYTE,!1),this.charBuffer.bind(),c.attributes.char.pointer(l.UNSIGNED_BYTE,!1),c.uniforms.chars=this.charTexture.bind(0),c.uniforms.charsShape=[this.charCanvas.width,this.charCanvas.height],c.uniforms.charsStep=this.charStep,c.uniforms.palette=this.paletteTexture.bind(1);this.sizeBuffer.bind(),c.attributes.size.pointer(l.FLOAT,!1,8,0),e||c.attributes.border.pointer(l.FLOAT,!1,8,4),this.positionBuffer.bind(),c.attributes.positionHi.pointer(l.FLOAT,!1,16,0),c.attributes.positionLo.pointer(l.FLOAT,!1,16,8),c.uniforms.pixelRatio=r.pixelRatio,c.uniforms.scaleHi=b,c.uniforms.scaleLo=x,c.uniforms.translateHi=_,c.uniforms.translateLo=w,c.uniforms.viewBox=r.viewBox;var f=this.scales;if(s)for(var d=f.length-1;d>=0;d--){var p=f[d];if(!(p.pixelSize&&p.pixelSize<1.25*i&&d>1)){var m=p.offset,g=p.count+m,y=v.ge(this.xCoords,a,m,g-1),T=v.lt(this.xCoords,o,y,g-1)+1;T>y&&l.drawArrays(l.POINTS,y,T-y)}}else l.drawArrays(l.POINTS,0,n);if(e)return t+n;u?l.blendFunc(l.ONE,l.ONE_MINUS_SRC_ALPHA):l.disable(l.BLEND)},y.draw=y.drawPick,y.pick=function(t,e,r){var n=this.pickOffset,i=this.pointCount;if(r<n||r>=n+i)return null;var a=r-n,o=this.points;return{object:this,pointId:a,dataCoord:[o[2*a],o[2*a+1]]}},y.update=function(t){var e=(t=t||{}).positions||[],r=t.colors||[],n=t.glyphs||[],i=t.sizes||[],a=t.borderWidths||[],o=t.borderColors||[],s=this.plot.gl,l=this.pointCount,u=l>this.snapThreshold;if(null!=t.positions){this.points=e,u=(l=this.points.length/2)>this.snapThreshold;var d=c.mallocFloat32(2*l),v=c.mallocFloat64(2*l),y=c.mallocUint32(l),b=c.mallocFloat32(4*l);v.set(this.points),u&&(this.i2idx&&c.free(this.i2idx),this.i2idx=c.mallocInt32(l),this.scales=h(v,this.i2idx,d)),this.pointCount=l;for(L=0;L<l;++L){q=u?this.i2idx[L]:L;y[L]=q;var x=e[2*q],_=e[2*q+1];b[4*L]=x,b[4*L+1]=_,b[4*L+2]=x-b[4*L],b[4*L+3]=_-b[4*L+1],this.xCoords[L]=x}this.idBuffer.update(y),this.positionBuffer.update(b),c.free(b),c.free(y),c.free(v),c.free(d)}for(var w=c.mallocFloat32(2*l),M=c.mallocUint8(2*l),k=c.mallocUint8(2*l),T={},A=[],S=[],E=[],L=0,C=l,I=0;L<C;++L){var z=[255*r[4*L],255*r[4*L+1],255*r[4*L+2],255*r[4*L+3]];null==T[W=p(z,!1)]&&(T[W]=I++,S.push(z[0]),S.push(z[1]),S.push(z[2]),S.push(z[3])),A.push(W),o&&o.length&&(null==T[W=p(z=[255*o[4*L],255*o[4*L+1],255*o[4*L+2],255*o[4*L+3]],!1)]&&(T[W]=I++,S.push(z[0]),S.push(z[1]),S.push(z[2]),S.push(z[3])),E.push(W))}for(var D={},L=0,C=l,I=0;L<C;L++){null==D[J=n[L]]&&(D[J]=I++)}for(var P=0,L=0,C=i.length;L<C;++L)i[L]>P&&(P=i[L]);var O=this.charStep;this.charStep=g(Math.ceil(4*P),128,768);var R=Object.keys(D),F=this.charStep,j=Math.floor(F/2),N=s.getParameter(s.MAX_TEXTURE_SIZE),B=N/F*(N/F),U=Math.min(N,F*R.length),V=Math.min(N,F*Math.ceil(F*R.length/N)),H=Math.floor(U/F);R.length>B&&console.warn("gl-scatter2d-fancy: number of characters is more than maximum texture size. Try reducing it."),this.chars&&this.chars+""==R+""&&this.charStep==O||(this.charCanvas=f({canvas:this.charCanvas,family:"sans-serif",size:j,shape:[U,V],step:[F,F],chars:R,align:!0,fit:this.charFit}),this.chars=R);for(L=0;L<l;++L){var q,G=i[q=u?this.i2idx[L]:L],Y=a[q];w[2*L]=2*G,w[2*L+1]=Y;var W=A[q],X=T[W];M[2*L]=X;var Z=T[E[q]];M[2*L+1]=Z;var J=n[q],K=D[J];k[2*L+1]=Math.floor(K/H),k[2*L]=K%H}this.sizeBuffer.update(w),this.colorBuffer.update(M),this.charBuffer.update(k),this.charTexture.shape=[this.charCanvas.width,this.charCanvas.height],this.charCanvas&&this.charCanvas.width&&this.charTexture.setPixels(this.charCanvas),this.paletteTexture.setPixels(m(S.slice(0,1024),[256,1,4])),c.free(w),c.free(M),c.free(k)},y.dispose=function(){this.shader.dispose(),this.pickShader.dispose(),this.positionBuffer.dispose(),this.sizeBuffer.dispose(),this.colorBuffer.dispose(),this.idBuffer.dispose(),this.charBuffer.dispose(),this.plot.removeObject(this)}},{"./lib/shaders":235,"binary-search-bounds":236,clamp:91,"color-id":95,"font-atlas-sdf":137,"gl-buffer":159,"gl-shader":237,"gl-texture2d":270,ndarray:470,"snap-points-2d":245,"typedarray-pool":552}],247:[function(t,e,r){r.pointVertex="precision highp float;\n#define GLSLIFY 1\n\nattribute vec2 positionHi, positionLo;\nattribute float weight;\n\nuniform vec2 scaleHi, scaleLo, translateHi, translateLo;\nuniform float pointSize, useWeight;\n\nvarying float fragWeight;\n\n\nvec4 pfx_1_0(vec2 scaleHi, vec2 scaleLo, vec2 translateHi, vec2 translateLo, vec2 positionHi, vec2 positionLo) {\n return vec4((positionHi + translateHi) * scaleHi\n + (positionLo + translateLo) * scaleHi\n + (positionHi + translateHi) * scaleLo\n + (positionLo + translateLo) * scaleLo, 0.0, 1.0);\n}\n\nvoid main() {\n gl_Position = pfx_1_0(scaleHi, scaleLo, translateHi, translateLo, positionHi, positionLo);\n gl_PointSize = pointSize;\n fragWeight = mix(1.0, weight, useWeight);\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 highp float;\n#define GLSLIFY 1\n\nvec4 pfx_1_0(vec2 scaleHi, vec2 scaleLo, vec2 translateHi, vec2 translateLo, vec2 positionHi, vec2 positionLo) {\n return vec4((positionHi + translateHi) * scaleHi\n + (positionLo + translateLo) * scaleHi\n + (positionHi + translateHi) * scaleLo\n + (positionLo + translateLo) * scaleLo, 0.0, 1.0);\n}\n\nattribute vec2 positionHi, positionLo;\nattribute vec4 pickId;\n\nuniform vec2 scaleHi, scaleLo, translateHi, translateLo;\nuniform float pointSize;\nuniform vec4 pickOffset;\n\nvarying vec4 fragId;\n\nvoid main() {\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 gl_Position = pfx_1_0(scaleHi, scaleLo, translateHi, translateLo, positionHi, positionLo);\n gl_PointSize = pointSize;\n fragId = id;\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}"},{}],248:[function(t,e,r){arguments[4][87][0].apply(r,arguments)},{dup:87}],249:[function(t,e,r){arguments[4][244][0].apply(r,arguments)},{dup:244}],250:[function(t,e,r){arguments[4][245][0].apply(r,arguments)},{"./lib/sort":249,dup:245,"typedarray-pool":552}],251:[function(t,e,r){"use strict";function n(t,e,r,n,i,a,o){this.plot=t,this.positionBufferHi=e,this.positionBufferLo=r,this.pickBuffer=n,this.weightBuffer=i,this.shader=a,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,this.snapPoints=!0}var i=t("gl-shader"),a=t("gl-buffer"),o=t("binary-search-bounds"),s=t("snap-points-2d"),l=t("typedarray-pool"),c=t("./lib/shader"),u=t("array-normalize"),h=t("array-bounds");e.exports=function(t,e){var r=t.gl,o=new n(t,a(r),a(r),a(r),a(r),i(r,c.pointVertex,c.pointFragment),i(r,c.pickVertex,c.pickFragment));return o.update(e),t.addObject(o),o};var f=n.prototype,d=new Float32Array(2),p=new Float32Array(2),m=new Float32Array(2),g=new Float32Array(2),v=[0,0,0,0];f.dispose=function(){this.shader.dispose(),this.pickShader.dispose(),this.positionBufferHi.dispose(),this.positionBufferLo.dispose(),this.pickBuffer.dispose(),this.xCoords&&l.free(this.xCoords),this.plot.removeObject(this)},f.update=function(t){function e(e,r){return e in t?t[e]:r}if(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.snapPoints=e("snapPoints",!0),null!=t.positions){this.xCoords&&l.free(this.xCoords),this.points=t.positions;var r=this.points.length>>>1,n=l.mallocInt32(r),i=l.mallocFloat32(r),a=l.mallocFloat64(2*r);if(a.set(this.points),this.snapPoints)this.scales=s(a,n,i,this.bounds);else{this.bounds=h(a,2),u(a,2,this.bounds);for(d=0;d<r;d++)n[d]=d,i[d]=1}var o=l.mallocFloat64(r),c=l.mallocFloat32(2*r),f=l.mallocFloat32(2*r);c.set(a);for(var d=0,p=0;d<r;d++,p+=2)f[p]=a[p]-c[p],f[p+1]=a[p+1]-c[p+1],o[d]=a[p];this.positionBufferHi.update(c),this.positionBufferLo.update(f),this.pickBuffer.update(n),this.weightBuffer.update(i),l.free(c),l.free(f),l.free(i),l.free(a),l.free(n),this.xCoords=o,this.pointCount=r,this.pickOffset=0}},f.draw=function(t){var e=void 0!==t,r=this.plot,n=e?this.pickShader:this.shader,i=this.scales,a=this.positionBufferHi,o=this.positionBufferLo,s=this.pickBuffer,l=this.bounds,c=this.size,u=this.borderSize,h=r.gl,f=e?r.pickPixelRatio:r.pixelRatio,y=r.viewBox,b=r.dataBox;if(0===this.pointCount)return t;var x=l[2]-l[0],_=l[3]-l[1],w=b[2]-b[0],M=b[3]-b[1],k=(y[2]-y[0])*f/r.pixelRatio,T=(y[3]-y[1])*f/r.pixelRatio,A=this.pixelSize=Math.min(w/k,M/T),S=2*x/w,E=2*_/M;d[0]=S,d[1]=E,p[0]=S-d[0],p[1]=E-d[1];var L=(l[0]-b[0]-.5*w)/x,C=(l[1]-b[1]-.5*M)/_;m[0]=L,m[1]=C,g[0]=L-m[0],g[1]=C-m[1],n.bind(),n.uniforms.scaleHi=d,n.uniforms.scaleLo=p,n.uniforms.translateHi=m,n.uniforms.translateLo=g,n.uniforms.color=this.color,n.uniforms.borderColor=this.borderColor,n.uniforms.pointSize=f*(c+u),n.uniforms.centerFraction=0===this.borderSize?2:c/(c+u+1.25),a.bind(),n.attributes.positionHi.pointer(),o.bind(),n.attributes.positionLo.pointer(),e?(this.pickOffset=t,v[0]=255&t,v[1]=t>>8&255,v[2]=t>>16&255,v[3]=t>>24&255,n.uniforms.pickOffset=v,s.bind(),n.attributes.pickId.pointer(h.UNSIGNED_BYTE)):(n.uniforms.useWeight=1,this.weightBuffer.bind(),n.attributes.weight.pointer());var I=!0;if(this.snapPoints)for(var z=i.length-1;z>=0;z--){var D=i[z];if(!(D.pixelSize<A&&z>1)){var P=this.getVisibleRange(D),O=P[0],R=P[1];R>O&&h.drawArrays(h.POINTS,O,R-O),!e&&I&&(I=!1,n.uniforms.useWeight=0)}}else h.drawArrays(h.POINTS,0,this.pointCount);return t+this.pointCount},f.getVisibleRange=function(t){var e=this.plot.dataBox,r=this.bounds,n=this.pixelSize,i=this.size,a=this.plot.pixelRatio,s=r[2]-r[0];r[3],r[1];if(!t)for(var l=this.scales.length-1;l>=0&&((t=this.scales[l]).pixelSize<n&&l>1);l--);var c=this.xCoords,u=(e[0]-r[0]-n*i*a)/s,h=(e[2]-r[0]+n*i*a)/s,f=t.offset,d=t.count+f,p=o.ge(c,u,f,d-1);return[p,o.lt(c,h,p,d-1)+1]},f.drawPick=f.draw,f.pick=function(t,e,r){var n=r-this.pickOffset;return n<0||n>=this.pointCount?null:{object:this,pointId:n,dataCoord:[this.points[2*n],this.points[2*n+1]]}}},{"./lib/shader":247,"array-bounds":47,"array-normalize":48,"binary-search-bounds":248,"gl-buffer":159,"gl-shader":258,"snap-points-2d":250,"typedarray-pool":552}],252:[function(t,e,r){"use strict";var n=t("vectorize-text");e.exports=function(t,e){var r=i[e];if(r||(r=i[e]={}),t in r)return r[t];for(var a=n(t,{textAlign:"center",textBaseline:"middle",lineHeight:1,font:e}),o=n(t,{triangles:!0,textAlign:"center",textBaseline:"middle",lineHeight:1,font:e}),s=[[1/0,1/0],[-1/0,-1/0]],l=0;l<a.positions.length;++l)for(var c=a.positions[l],u=0;u<2;++u)s[0][u]=Math.min(s[0][u],c[u]),s[1][u]=Math.max(s[1][u],c[u]);return r[t]=[o,a,s]};var i={}},{"vectorize-text":565}],253:[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"),a="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}",o="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",c="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}",u=[{name:"position",type:"vec3"},{name:"color",type:"vec4"},{name:"glyph",type:"vec2"},{name:"id",type:"vec4"}],h={vertex:a,fragment:l,attributes:u},f={vertex:o,fragment:l,attributes:u},d={vertex:s,fragment:l,attributes:u},p={vertex:a,fragment:c,attributes:u},m={vertex:o,fragment:c,attributes:u},g={vertex:s,fragment:c,attributes:u};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,m)},r.createPickProject=function(t){return n(t,g)}},{"gl-shader":258}],254:[function(t,e,r){"use strict";function n(t,e){var r=t[0],n=t[1],i=t[2],a=t[3];return t[0]=e[0]*r+e[4]*n+e[8]*i+e[12]*a,t[1]=e[1]*r+e[5]*n+e[9]*i+e[13]*a,t[2]=e[2]*r+e[6]*n+e[10]*i+e[14]*a,t[3]=e[3]*r+e[7]*n+e[11]*i+e[15]*a,t}function i(t,e,r,i){return n(i,i),n(i,i),n(i,i)}function a(t,e,r,n,i,a,o,s,l,c,u,h){this.gl=t,this.pixelRatio=1,this.shader=e,this.orthoShader=r,this.projectShader=n,this.pointBuffer=i,this.colorBuffer=a,this.glyphBuffer=o,this.idBuffer=s,this.vao=l,this.vertexCount=0,this.lineVertexCount=0,this.opacity=1,this.lineWidth=0,this.projectScale=[2/3,2/3,2/3],this.projectOpacity=[1,1,1],this.pickId=0,this.pickPerspectiveShader=c,this.pickOrthoShader=u,this.pickProjectShader=h,this.points=[],this._selectResult=new function(t,e){this.index=t,this.dataCoordinate=this.position=e}(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 o(t){return t[0]=t[1]=t[2]=0,t}function s(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=1,t}function l(t,e,r,n){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[r]=n,t}function c(t,e,r,n,a){var c,u=e.axesProject,h=e.gl,f=t.uniforms,d=r.model||v,m=r.view||v,g=r.projection||v,y=e.axesBounds,S=function(t){for(var e=A,r=0;r<2;++r)for(var n=0;n<3;++n)e[r][n]=Math.max(Math.min(t[r][n],1e8),-1e8);return e}(e.clipBounds);c=e.axes?e.axes.lastCubeProps.axis:[1,1,1],b[0]=2/h.drawingBufferWidth,b[1]=2/h.drawingBufferHeight,t.bind(),f.view=m,f.projection=g,f.screenSize=b,f.highlightId=e.highlightId,f.highlightScale=e.highlightScale,f.clipBounds=S,f.pickGroup=e.pickId/255,f.pixelRatio=e.pixelRatio;for(var E=0;E<3;++E)if(u[E]&&e.projectOpacity[E]<1===n){f.scale=e.projectScale[E],f.opacity=e.projectOpacity[E];for(var L=k,C=0;C<16;++C)L[C]=0;for(C=0;C<4;++C)L[5*C]=1;L[5*E]=0,c[E]<0?L[12+E]=y[0][E]:L[12+E]=y[1][E],p(L,d,L),f.model=L;var I=(E+1)%3,z=(E+2)%3,D=o(x),P=o(_);D[I]=1,P[z]=1;var O=i(0,0,0,s(w,D)),R=i(0,0,0,s(M,P));if(Math.abs(O[1])>Math.abs(R[1])){var F=O;O=R,R=F,F=D,D=P,P=F;var j=I;I=z,z=j}O[0]<0&&(D[I]=-1),R[1]>0&&(P[z]=-1);for(var N=0,B=0,C=0;C<4;++C)N+=Math.pow(d[4*I+C],2),B+=Math.pow(d[4*z+C],2);D[I]/=Math.sqrt(N),P[z]/=Math.sqrt(B),f.axes[0]=D,f.axes[1]=P,f.fragClipBounds[0]=l(T,S[0],E,-1e8),f.fragClipBounds[1]=l(T,S[1],E,1e8),e.vao.draw(h.TRIANGLES,e.vertexCount),e.lineWidth>0&&(h.lineWidth(e.lineWidth),e.vao.draw(h.LINES,e.lineVertexCount,e.vertexCount))}}function u(t,e,r,n,i,a){var o=r.gl;if(r.vao.bind(),i===r.opacity<1||a){t.bind();var s=t.uniforms;s.model=n.model||v,s.view=n.view||v,s.projection=n.projection||v,b[0]=2/o.drawingBufferWidth,b[1]=2/o.drawingBufferHeight,s.screenSize=b,s.highlightId=r.highlightId,s.highlightScale=r.highlightScale,s.fragClipBounds=S,s.clipBounds=r.axes.bounds,s.opacity=r.opacity,s.pickGroup=r.pickId/255,s.pixelRatio=r.pixelRatio,r.vao.draw(o.TRIANGLES,r.vertexCount),r.lineWidth>0&&(o.lineWidth(r.lineWidth),r.vao.draw(o.LINES,r.lineVertexCount,r.vertexCount))}c(e,r,n,i),r.vao.unbind()}var h=t("gl-buffer"),f=t("gl-vao"),d=t("typedarray-pool"),p=t("gl-mat4/multiply"),m=t("./lib/shaders"),g=t("./lib/glyphs"),v=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];e.exports=function(t){var e=t.gl,r=m.createPerspective(e),n=m.createOrtho(e),i=m.createProject(e),o=m.createPickPerspective(e),s=m.createPickOrtho(e),l=m.createPickProject(e),c=h(e),u=h(e),d=h(e),p=h(e),g=new a(e,r,n,i,c,u,d,p,f(e,[{buffer:c,size:3,type:e.FLOAT},{buffer:u,size:4,type:e.FLOAT},{buffer:d,size:2,type:e.FLOAT},{buffer:p,size:4,type:e.UNSIGNED_BYTE,normalized:!0}]),o,s,l);return g.update(t),g};var y=a.prototype;y.pickSlots=1,y.setPickBase=function(t){this.pickId=t},y.isTransparent=function(){if(this.opacity<1)return!0;for(var t=0;t<3;++t)if(this.axesProject[t]&&this.projectOpacity[t]<1)return!0;return!1},y.isOpaque=function(){if(this.opacity>=1)return!0;for(var t=0;t<3;++t)if(this.axesProject[t]&&this.projectOpacity[t]>=1)return!0;return!1};var b=[0,0],x=[0,0,0],_=[0,0,0],w=[0,0,0,1],M=[0,0,0,1],k=v.slice(),T=[0,0,0],A=[[0,0,0],[0,0,0]],S=[[-1e8,-1e8,-1e8],[1e8,1e8,1e8]];y.draw=function(t){u(this.useOrtho?this.orthoShader:this.shader,this.projectShader,this,t,!1,!1)},y.drawTransparent=function(t){u(this.useOrtho?this.orthoShader:this.shader,this.projectShader,this,t,!0,!1)},y.drawPick=function(t){u(this.useOrtho?this.pickOrthoShader:this.pickPerspectiveShader,this.pickProjectShader,this,t,!1,!0)},y.pick=function(t){if(!t)return null;if(t.id!==this.pickId)return null;var e=t.value[2]+(t.value[1]<<8)+(t.value[0]<<16);if(e>=this.pointCount||e<0)return null;var r=this.points[e],n=this._selectResult;n.index=e;for(var i=0;i<3;++i)n.position[i]=n.dataCoordinate[i]=r[i];return n},y.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]},y.update=function(t){if("perspective"in(t=t||{})&&(this.useOrtho=!t.perspective),"orthographic"in t&&(this.useOrtho=!!t.orthographic),"lineWidth"in t&&(this.lineWidth=t.lineWidth),"project"in t)if(Array.isArray(t.project))this.axesProject=t.project;else{var e=!!t.project;this.axesProject=[e,e,e]}if("projectScale"in t)if(Array.isArray(t.projectScale))this.projectScale=t.projectScale.slice();else{r=+t.projectScale;this.projectScale=[r,r,r]}if("projectOpacity"in t)if(Array.isArray(t.projectOpacity))this.projectOpacity=t.projectOpacity.slice();else{var r=+t.projectOpacity;this.projectOpacity=[r,r,r]}"opacity"in t&&(this.opacity=t.opacity),this.dirty=!0;var n=t.position;if(n){var i=t.font||"normal",a=t.alignment||[0,0],o=[1/0,1/0,1/0],s=[-1/0,-1/0,-1/0],l=t.glyph,c=t.color,u=t.size,h=t.angle,f=t.lineColor,p=0,m=0,v=0,y=n.length;t:for(R=0;R<y;++R){for(var b=n[R],x=0;x<3;++x)if(isNaN(b[x])||!isFinite(b[x]))continue t;var _=(F=Array.isArray(l)?g(l[R],i):l?g(l,i):g("\u25cf",i))[0],w=F[1],M=F[2];m+=3*_.cells.length,v+=2*w.edges.length}var k=m+v,T=d.mallocFloat(3*k),A=d.mallocFloat(4*k),S=d.mallocFloat(2*k),E=d.mallocUint32(k),L=[0,a[1]],C=0,I=m,z=[0,0,0,1],D=[0,0,0,1],P=Array.isArray(c)&&Array.isArray(c[0]),O=Array.isArray(f)&&Array.isArray(f[0]);t:for(var R=0;R<y;++R){for(var b=n[R],x=0;x<3;++x){if(isNaN(b[x])||!isFinite(b[x])){p+=1;continue t}s[x]=Math.max(s[x],b[x]),o[x]=Math.min(o[x],b[x])}var F,_=(F=Array.isArray(l)?g(l[R],i):l?g(l,i):g("\u25cf",i))[0],w=F[1],M=F[2];if(Array.isArray(c)){if(3===(j=P?c[R]:c).length){for(x=0;x<3;++x)z[x]=j[x];z[3]=1}else if(4===j.length)for(x=0;x<4;++x)z[x]=j[x]}else z[0]=z[1]=z[2]=0,z[3]=1;if(Array.isArray(f)){var j;if(3===(j=O?f[R]:f).length){for(x=0;x<3;++x)D[x]=j[x];D[x]=1}else if(4===j.length)for(x=0;x<4;++x)D[x]=j[x]}else D[0]=D[1]=D[2]=0,D[3]=1;var N=.5;Array.isArray(u)?N=+u[R]:u?N=+u:this.useOrtho&&(N=12);var B=0;Array.isArray(h)?B=+h[R]:h&&(B=+h);for(var U=Math.cos(B),V=Math.sin(B),b=n[R],x=0;x<3;++x)s[x]=Math.max(s[x],b[x]),o[x]=Math.min(o[x],b[x]);a[0]<0?L[0]=a[0]*(1+M[1][0]):a[0]>0&&(L[0]=-a[0]*(1+M[0][0]));for(var H=_.cells,q=_.positions,x=0;x<H.length;++x)for(var G=H[x],Y=0;Y<3;++Y){for(W=0;W<3;++W)T[3*C+W]=b[W];for(W=0;W<4;++W)A[4*C+W]=z[W];E[C]=p;X=q[G[Y]];S[2*C]=N*(U*X[0]-V*X[1]+L[0]),S[2*C+1]=N*(V*X[0]+U*X[1]+L[1]),C+=1}for(var H=w.edges,q=w.positions,x=0;x<H.length;++x)for(var G=H[x],Y=0;Y<2;++Y){for(W=0;W<3;++W)T[3*I+W]=b[W];for(var W=0;W<4;++W)A[4*I+W]=D[W];E[I]=p;var X=q[G[Y]];S[2*I]=N*(U*X[0]-V*X[1]+L[0]),S[2*I+1]=N*(V*X[0]+U*X[1]+L[1]),I+=1}p+=1}this.vertexCount=m,this.lineVertexCount=v,this.pointBuffer.update(T),this.colorBuffer.update(A),this.glyphBuffer.update(S),this.idBuffer.update(new Uint32Array(E)),d.free(T),d.free(A),d.free(S),d.free(E),this.bounds=[o,s],this.points=n,this.pointCount=n.length}},y.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":252,"./lib/shaders":253,"gl-buffer":159,"gl-mat4/multiply":186,"gl-vao":274,"typedarray-pool":552}],255:[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"},{}],256:[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}var i=t("gl-shader"),a=t("gl-buffer"),o=t("./lib/shaders");e.exports=function(t,e){var r=t.gl,s=new n(t,a(r,[0,0,0,1,1,0,1,1]),i(r,o.boxVertex,o.boxFragment));return s.update(e),t.addOverlay(s),s};var s=n.prototype;s.draw=function(){if(this.enabled){var t=this.plot,e=this.selectBox,r=this.borderWidth,n=(this.innerFill,this.innerColor),i=(this.outerFill,this.outerColor),a=this.borderColor,o=t.box,s=t.screenBox,l=t.dataBox,c=t.viewBox,u=t.pixelRatio,h=(e[0]-l[0])*(c[2]-c[0])/(l[2]-l[0])+c[0],f=(e[1]-l[1])*(c[3]-c[1])/(l[3]-l[1])+c[1],d=(e[2]-l[0])*(c[2]-c[0])/(l[2]-l[0])+c[0],p=(e[3]-l[1])*(c[3]-c[1])/(l[3]-l[1])+c[1];if(h=Math.max(h,c[0]),f=Math.max(f,c[1]),d=Math.min(d,c[2]),p=Math.min(p,c[3]),!(d<h||p<f)){o.bind();var m=s[2]-s[0],g=s[3]-s[1];if(this.outerFill&&(o.drawBox(0,0,m,f,i),o.drawBox(0,f,h,p,i),o.drawBox(0,p,m,g,i),o.drawBox(d,f,m,p,i)),this.innerFill&&o.drawBox(h,f,d,p,n),r>0){var v=r*u;o.drawBox(h-v,f-v,d+v,f+v,a),o.drawBox(h-v,p-v,d+v,p+v,a),o.drawBox(h-v,f-v,h+v,p+v,a),o.drawBox(d-v,f-v,d+v,p+v,a)}}}},s.update=function(t){t=t||{},this.innerFill=!!t.innerFill,this.outerFill=!!t.outerFill,this.innerColor=(t.innerColor||[0,0,0,.5]).slice(),this.outerColor=(t.outerColor||[0,0,0,.5]).slice(),this.borderColor=(t.borderColor||[0,0,0,1]).slice(),this.borderWidth=t.borderWidth||0,this.selectBox=(t.selectBox||this.selectBox).slice()},s.dispose=function(){this.boxBuffer.dispose(),this.boxShader.dispose(),this.plot.removeOverlay(this)}},{"./lib/shaders":255,"gl-buffer":159,"gl-shader":258}],257:[function(t,e,r){"use strict";function n(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)}}e.exports=function(t,e){return new n(t,i(t,e),a.mallocUint8(e[0]*e[1]*4))};var i=t("gl-fbo"),a=t("typedarray-pool"),o=t("ndarray"),s=t("bit-twiddle").nextPow2,l=t("cwise/lib/wrapper")({args:["array",{offset:[0,0,1],array:0},{offset:[0,0,2],array:0},{offset:[0,0,3],array:0},"scalar","scalar","index"],pre:{body:"{this_closestD2=1e8,this_closestX=-1,this_closestY=-1}",args:[],thisVars:["this_closestD2","this_closestX","this_closestY"],localVars:[]},body:{body:"{if(_inline_55_arg0_<255||_inline_55_arg1_<255||_inline_55_arg2_<255||_inline_55_arg3_<255){var _inline_55_l=_inline_55_arg4_-_inline_55_arg6_[0],_inline_55_a=_inline_55_arg5_-_inline_55_arg6_[1],_inline_55_f=_inline_55_l*_inline_55_l+_inline_55_a*_inline_55_a;_inline_55_f<this_closestD2&&(this_closestD2=_inline_55_f,this_closestX=_inline_55_arg6_[0],this_closestY=_inline_55_arg6_[1])}}",args:[{name:"_inline_55_arg0_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_55_arg1_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_55_arg2_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_55_arg3_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_55_arg4_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_55_arg5_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_55_arg6_",lvalue:!1,rvalue:!0,count:4}],thisVars:["this_closestD2","this_closestX","this_closestY"],localVars:["_inline_55_a","_inline_55_f","_inline_55_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}),c=n.prototype;Object.defineProperty(c,"shape",{get:function(){return this.gl?this.fbo.shape.slice():[0,0]},set:function(t){if(this.gl){this.fbo.shape=t;var e=this.fbo.shape[0],r=this.fbo.shape[1];if(r*e*4>this.buffer.length){a.free(this.buffer);for(var n=this.buffer=a.mallocUint8(s(r*e*4)),i=0;i<r*e*4;++i)n[i]=255}return t}}}),c.begin=function(){var t=this.gl;this.shape;t&&(this.fbo.bind(),t.clearColor(1,1,1,1),t.clear(t.COLOR_BUFFER_BIT|t.DEPTH_BUFFER_BIT))},c.end=function(){var t=this.gl;t&&(t.bindFramebuffer(t.FRAMEBUFFER,null),this._readTimeout||clearTimeout(this._readTimeout),this._readTimeout=setTimeout(this._readCallback,1))},c.query=function(t,e,r){if(!this.gl)return null;var n=this.fbo.shape.slice();t|=0,e|=0,"number"!=typeof r&&(r=1);var i=0|Math.min(Math.max(t-r,0),n[0]),a=0|Math.min(Math.max(t+r,0),n[0]),s=0|Math.min(Math.max(e-r,0),n[1]),c=0|Math.min(Math.max(e+r,0),n[1]);if(a<=i||c<=s)return null;var u=[a-i,c-s],h=o(this.buffer,[u[0],u[1],4],[4,4*n[0],1],4*(i+n[0]*s)),f=l(h.hi(u[0],u[1],1),r,r),d=f[0],p=f[1];if(d<0||Math.pow(this.radius,2)<f[2])return null;return new function(t,e,r,n,i){this.coord=[t,e],this.id=r,this.value=n,this.distance=i}(d+i|0,p+s|0,h.get(d,p,0),[h.get(d,p,1),h.get(d,p,2),h.get(d,p,3)],Math.sqrt(f[2]))},c.dispose=function(){this.gl&&(this.fbo.dispose(),a.free(this.buffer),this.gl=null,this._readTimeout&&clearTimeout(this._readTimeout))}},{"bit-twiddle":70,"cwise/lib/wrapper":116,"gl-fbo":167,ndarray:470,"typedarray-pool":552}],258:[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}var a=t("./lib/create-uniforms"),o=t("./lib/create-attributes"),s=t("./lib/reflect"),l=t("./lib/shader-cache"),c=t("./lib/runtime-reflect"),u=t("./lib/GLError"),h=n.prototype;h.bind=function(){this.program||this._relink(),this.gl.useProgram(this.program)},h.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},h.update=function(t,e,r,n){function h(){d.program=l.program(p,d._vref,d._fref,x,_);for(var t=0;t<r.length;++t)E[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,m=d._vref;d._vref=l.shader(p,p.VERTEX_SHADER,t),m&&m.dispose(),d.vertShader=d._vref.shader;var g=this._fref;if(d._fref=l.shader(p,p.FRAGMENT_SHADER,e),g&&g.dispose(),d.fragShader=d._fref.shader,!r||!n){var v=p.createProgram();if(p.attachShader(v,d.fragShader),p.attachShader(v,d.vertShader),p.linkProgram(v),!p.getProgramParameter(v,p.LINK_STATUS)){var y=p.getProgramInfoLog(v);throw new u(y,"Error linking program:"+y)}r=r||c.uniforms(p,v),n=n||c.attributes(p,v),p.deleteProgram(v)}(n=n.slice()).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),T=new Array(k),A=0;A<k;++A)T[A]=_.length,x.push(M.name+"["+A+"]"),"number"==typeof M.location?_.push(M.location+A):Array.isArray(M.location)&&M.location.length===k&&"number"==typeof M.location[A]?_.push(0|M.location[A]):_.push(-1);b.push({name:M.name,type:M.type,locations:T})}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 S=0,w=0;w<_.length;++w)if(_[w]<0){for(;_.indexOf(S)>=0;)S+=1;_[w]=S}var E=new Array(r.length);h(),d._relink=h,d.types={uniforms:s(r),attributes:s(n)},d.attributes=o(p,d,b,_),Object.defineProperty(d,"uniforms",a(p,d,r,E))},e.exports=function(t,e,r,i,a){var o=new n(t);return o.update(e,r,i,a),o}},{"./lib/GLError":259,"./lib/create-attributes":260,"./lib/create-uniforms":261,"./lib/reflect":262,"./lib/runtime-reflect":263,"./lib/shader-cache":264}],259:[function(t,e,r){arguments[4][216][0].apply(r,arguments)},{dup:216}],260:[function(t,e,r){arguments[4][217][0].apply(r,arguments)},{"./GLError":259,dup:217}],261:[function(t,e,r){arguments[4][218][0].apply(r,arguments)},{"./GLError":259,"./reflect":262,dup:218}],262:[function(t,e,r){arguments[4][219][0].apply(r,arguments)},{dup:219}],263:[function(t,e,r){arguments[4][220][0].apply(r,arguments)},{dup:220}],264:[function(t,e,r){arguments[4][221][0].apply(r,arguments)},{"./GLError":259,dup:221,"gl-format-compiler-error":168,"weakmap-shim":573}],265:[function(t,e,r){"use strict";function n(t){this.plot=t,this.enable=[!0,!0,!1,!1],this.width=[1,1,1,1],this.color=[[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.center=[1/0,1/0]}e.exports=function(t,e){var r=new n(t);return r.update(e),t.addOverlay(r),r};var i=n.prototype;i.update=function(t){t=t||{},this.enable=(t.enable||[!0,!0,!1,!1]).slice(),this.width=(t.width||[1,1,1,1]).slice(),this.color=(t.color||[[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]]).map(function(t){return t.slice()}),this.center=(t.center||[1/0,1/0]).slice(),this.plot.setOverlayDirty()},i.draw=function(){var t=this.enable,e=this.width,r=this.color,n=this.center,i=this.plot,a=i.line,o=i.dataBox,s=i.viewBox;if(a.bind(),o[0]<=n[0]&&n[0]<=o[2]&&o[1]<=n[1]&&n[1]<=o[3]){var l=s[0]+(n[0]-o[0])/(o[2]-o[0])*(s[2]-s[0]),c=s[1]+(n[1]-o[1])/(o[3]-o[1])*(s[3]-s[1]);t[0]&&a.drawLine(l,c,s[0],c,e[0],r[0]),t[1]&&a.drawLine(l,c,l,s[1],e[1],r[1]),t[2]&&a.drawLine(l,c,s[2],c,e[2],r[2]),t[3]&&a.drawLine(l,c,l,s[3],e[3],r[3])}},i.dispose=function(){this.plot.removeOverlay(this)}},{}],266:[function(t,e,r){"use strict";var n=t("gl-shader");e.exports=function(t){return n(t,"precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position, color;\nattribute float weight;\n\nuniform mat4 model, view, projection;\nuniform vec3 coordinates[3];\nuniform vec4 colors[3];\nuniform vec2 screenShape;\nuniform float lineWidth;\n\nvarying vec4 fragColor;\n\nvoid main() {\n vec3 vertexPosition = mix(coordinates[0],\n mix(coordinates[2], coordinates[1], 0.5 * (position + 1.0)), abs(position));\n\n vec4 clipPos = projection * view * model * vec4(vertexPosition, 1.0);\n vec2 clipOffset = (projection * view * model * vec4(color, 0.0)).xy;\n vec2 delta = weight * clipOffset * screenShape;\n vec2 lineOffset = normalize(vec2(delta.y, -delta.x)) / screenShape;\n\n gl_Position = vec4(clipPos.xy + clipPos.w * 0.5 * lineWidth * lineOffset, clipPos.z, clipPos.w);\n fragColor = color.x * colors[0] + color.y * colors[1] + color.z * colors[2];\n}\n","precision mediump float;\n#define GLSLIFY 1\n\nvarying vec4 fragColor;\n\nvoid main() {\n gl_FragColor = fragColor;\n}",null,[{name:"position",type:"vec3"},{name:"color",type:"vec3"},{name:"weight",type:"float"}])}},{"gl-shader":258}],267:[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}var i=t("gl-buffer"),a=t("gl-vao"),o=t("./shaders/index");e.exports=function(t,e){function r(t,e,r,n,i,a){var o=[t,e,r,0,0,0,1];o[n+3]=1,o[n]=i,s.push.apply(s,o),o[6]=-1,s.push.apply(s,o),o[n]=a,s.push.apply(s,o),s.push.apply(s,o),o[6]=1,s.push.apply(s,o),o[n]=i,s.push.apply(s,o)}var s=[];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=i(t,s),c=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}]),u=o(t);u.attributes.position.location=0,u.attributes.color.location=1,u.attributes.weight.location=2;var h=new n(t,l,c,u);return h.update(e),h};var s=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],l=n.prototype,c=[0,0,0],u=[0,0,0],h=[0,0];l.isTransparent=function(){return!1},l.drawTransparent=function(t){},l.draw=function(t){var e=this.gl,r=this.vao,n=this.shader;r.bind(),n.bind();var i,a=t.model||s,o=t.view||s,l=t.projection||s;this.axes&&(i=this.axes.lastCubeProps.axis);for(var f=c,d=u,p=0;p<3;++p)i&&i[p]<0?(f[p]=this.bounds[0][p],d[p]=this.bounds[1][p]):(f[p]=this.bounds[1][p],d[p]=this.bounds[0][p]);h[0]=e.drawingBufferWidth,h[1]=e.drawingBufferHeight,n.uniforms.model=a,n.uniforms.view=o,n.uniforms.projection=l,n.uniforms.coordinates=[this.position,f,d],n.uniforms.colors=this.colors,n.uniforms.screenShape=h;for(p=0;p<3;++p)n.uniforms.lineWidth=this.lineWidth[p]*this.pixelRatio,this.enabled[p]&&(r.draw(e.TRIANGLES,6,6*p),this.drawSides[p]&&r.draw(e.TRIANGLES,12,18+12*p));r.unbind()},l.update=function(t){t&&("bounds"in t&&(this.bounds=t.bounds),"position"in t&&(this.position=t.position),"lineWidth"in t&&(this.lineWidth=t.lineWidth),"colors"in t&&(this.colors=t.colors),"enabled"in t&&(this.enabled=t.enabled),"drawSides"in t&&(this.drawSides=t.drawSides))},l.dispose=function(){this.vao.dispose(),this.buffer.dispose(),this.shader.dispose()}},{"./shaders/index":266,"gl-buffer":159,"gl-vao":274}],268:[function(t,e,r){var n=t("gl-shader"),i="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec4 uv;\nattribute vec3 f;\nattribute vec3 normal;\n\nuniform mat4 model, view, projection, inverseModel;\nuniform vec3 lightPosition, eyePosition;\nuniform sampler2D colormap;\n\nvarying float value, kill;\nvarying vec3 worldCoordinate;\nvarying vec2 planeCoordinate;\nvarying vec3 lightDirection, eyeDirection, surfaceNormal;\nvarying vec4 vColor;\n\nvoid main() {\n worldCoordinate = vec3(uv.zw, f.x);\n vec4 worldPosition = model * vec4(worldCoordinate, 1.0);\n vec4 clipPosition = projection * view * worldPosition;\n gl_Position = clipPosition;\n kill = f.y;\n value = f.z;\n planeCoordinate = uv.xy;\n\n vColor = texture2D(colormap, vec2(value, value));\n\n //Lighting geometry parameters\n vec4 cameraCoordinate = view * worldPosition;\n cameraCoordinate.xyz /= cameraCoordinate.w;\n lightDirection = lightPosition - cameraCoordinate.xyz;\n eyeDirection = eyePosition - cameraCoordinate.xyz;\n surfaceNormal = normalize((vec4(normal,0) * inverseModel).xyz);\n}\n",a="precision mediump float;\n#define GLSLIFY 1\n\nfloat beckmannDistribution_2_0(float x, float roughness) {\n float NdotH = max(x, 0.0001);\n float cos2Alpha = NdotH * NdotH;\n float tan2Alpha = (cos2Alpha - 1.0) / cos2Alpha;\n float roughness2 = roughness * roughness;\n float denom = 3.141592653589793 * roughness2 * cos2Alpha * cos2Alpha;\n return exp(tan2Alpha / roughness2) / denom;\n}\n\n\n\nfloat beckmannSpecular_1_1(\n vec3 lightDirection,\n vec3 viewDirection,\n vec3 surfaceNormal,\n float roughness) {\n return beckmannDistribution_2_0(dot(surfaceNormal, normalize(lightDirection + viewDirection)), roughness);\n}\n\n\n\nuniform vec3 lowerBound, upperBound;\nuniform float contourTint;\nuniform vec4 contourColor;\nuniform sampler2D colormap;\nuniform vec3 clipBounds[2];\nuniform float roughness, fresnel, kambient, kdiffuse, kspecular, opacity;\nuniform float vertexColor;\n\nvarying float value, kill;\nvarying vec3 worldCoordinate;\nvarying vec3 lightDirection, eyeDirection, surfaceNormal;\nvarying vec4 vColor;\n\nvoid main() {\n if (kill > 0.0 ||\n any(lessThan(worldCoordinate, clipBounds[0])) || any(greaterThan(worldCoordinate, clipBounds[1]))) {\n discard;\n }\n\n vec3 N = normalize(surfaceNormal);\n vec3 V = normalize(eyeDirection);\n vec3 L = normalize(lightDirection);\n\n if(gl_FrontFacing) {\n N = -N;\n }\n\n float specular = max(beckmannSpecular_1_1(L, V, N, roughness), 0.);\n float diffuse = min(kambient + kdiffuse * max(dot(N, L), 0.0), 1.0);\n\n //decide how to interpolate color \u2014 in vertex or in fragment\n vec4 surfaceColor = step(vertexColor, .5) * texture2D(colormap, vec2(value, value)) + step(.5, vertexColor) * vColor;\n\n vec4 litColor = surfaceColor.a * vec4(diffuse * surfaceColor.rgb + kspecular * vec3(1,1,1) * specular, 1.0);\n\n gl_FragColor = mix(litColor, contourColor, contourTint) * opacity;\n}\n",o="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec4 uv;\nattribute float f;\n\nuniform mat3 permutation;\nuniform mat4 model, view, projection;\nuniform float height, zOffset;\nuniform sampler2D colormap;\n\nvarying float value, kill;\nvarying vec3 worldCoordinate;\nvarying vec2 planeCoordinate;\nvarying vec3 lightDirection, eyeDirection, surfaceNormal;\nvarying vec4 vColor;\n\nvoid main() {\n vec3 dataCoordinate = permutation * vec3(uv.xy, height);\n vec4 worldPosition = model * vec4(dataCoordinate, 1.0);\n\n vec4 clipPosition = projection * view * worldPosition;\n clipPosition.z = clipPosition.z + zOffset;\n\n gl_Position = clipPosition;\n value = f;\n kill = -1.0;\n worldCoordinate = dataCoordinate;\n planeCoordinate = uv.zw;\n\n vColor = texture2D(colormap, vec2(value, value));\n\n //Don't do lighting for contours\n surfaceNormal = vec3(1,0,0);\n eyeDirection = vec3(0,1,0);\n lightDirection = vec3(0,0,1);\n}\n",s="precision mediump float;\n#define GLSLIFY 1\n\nuniform vec2 shape;\nuniform vec3 clipBounds[2];\nuniform float pickId;\n\nvarying float value, kill;\nvarying vec3 worldCoordinate;\nvarying vec2 planeCoordinate;\nvarying vec3 surfaceNormal;\n\nvec2 splitFloat(float v) {\n float vh = 255.0 * v;\n float upper = floor(vh);\n float lower = fract(vh);\n return vec2(upper / 255.0, floor(lower * 16.0) / 16.0);\n}\n\nvoid main() {\n if(kill > 0.0 ||\n any(lessThan(worldCoordinate, clipBounds[0])) || any(greaterThan(worldCoordinate, clipBounds[1]))) {\n discard;\n }\n vec2 ux = splitFloat(planeCoordinate.x / shape.x);\n vec2 uy = splitFloat(planeCoordinate.y / shape.y);\n gl_FragColor = vec4(pickId, ux.x, uy.x, ux.y + (uy.y/16.0));\n}\n";r.createShader=function(t){var e=n(t,i,a,null,[{name:"uv",type:"vec4"},{name:"f",type:"vec3"},{name:"normal",type:"vec3"}]);return e.attributes.uv.location=0,e.attributes.f.location=1,e.attributes.normal.location=2,e},r.createPickShader=function(t){var e=n(t,i,s,null,[{name:"uv",type:"vec4"},{name:"f",type:"vec3"},{name:"normal",type:"vec3"}]);return e.attributes.uv.location=0,e.attributes.f.location=1,e.attributes.normal.location=2,e},r.createContourShader=function(t){var e=n(t,o,a,null,[{name:"uv",type:"vec4"},{name:"f",type:"float"}]);return e.attributes.uv.location=0,e.attributes.f.location=1,e},r.createPickContourShader=function(t){var e=n(t,o,s,null,[{name:"uv",type:"vec4"},{name:"f",type:"float"}]);return e.attributes.uv.location=0,e.attributes.f.location=1,e}},{"gl-shader":258}],269:[function(t,e,r){"use strict";function n(t,e,r,n,i,a,o,s,l,c,u,h,f,d){this.gl=t,this.shape=e,this.bounds=r,this.intensityBounds=[],this._shader=n,this._pickShader=i,this._coordinateBuffer=a,this._vao=o,this._colorMap=s,this._contourShader=l,this._contourPickShader=c,this._contourBuffer=u,this._contourVAO=h,this._contourOffsets=[[],[],[]],this._contourCounts=[[],[],[]],this._vertexCount=0,this._pickResult=new function(t,e,r,n,i){this.position=t,this.index=e,this.uv=r,this.level=n,this.dataCoordinate=i}([0,0,0],[0,0],[0,0],[0,0,0],[0,0,0]),this._dynamicBuffer=f,this._dynamicVAO=d,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=[y(p.mallocFloat(1024),[0,0]),y(p.mallocFloat(1024),[0,0]),y(p.mallocFloat(1024),[0,0])],this.pickId=1,this.clipBounds=[[-1/0,-1/0,-1/0],[1/0,1/0,1/0]],this.snapToData=!1,this.opacity=1,this.lightPosition=[10,1e4,0],this.ambientLight=.8,this.diffuseLight=.8,this.specularLight=2,this.roughness=.5,this.fresnel=1.5,this.vertexColor=0,this.dirty=!0}function i(t,e){var r,n,i,a=e.axes&&e.axes.lastCubeProps.axis||O,o=e.showSurface,s=e.showContour;for(r=0;r<3;++r)for(o=o||e.surfaceProject[r],n=0;n<3;++n)s=s||e.contourProject[r][n];for(r=0;r<3;++r){var l=R.projections[r];for(n=0;n<16;++n)l[n]=0;for(n=0;n<4;++n)l[5*n]=1;l[5*r]=0,l[12+r]=e.axesBounds[+(a[r]>0)][r],x(l,t.model,l);var c=R.clipBounds[r];for(i=0;i<2;++i)for(n=0;n<3;++n)c[i][n]=t.clipBounds[i][n];c[0][r]=-1e8,c[1][r]=1e8}return R.showSurface=o,R.showContour=s,R}function a(t,e){t=t||{};var r=this.gl;r.disable(r.CULL_FACE),this._colorMap.bind(0);var n=F;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=_(n.inverseModel,n.model);for(var a=0;a<2;++a)for(var o=n.clipBounds[a],s=0;s<3;++s)o[s]=Math.min(Math.max(this.clipBounds[a][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=N,n.vertexColor=this.vertexColor;var l=j;for(x(l,n.view,n.model),x(l,n.projection,l),_(l,l),a=0;a<3;++a)n.eyePosition[a]=l[12+a]/l[15];var c=l[15];for(a=0;a<3;++a)c+=this.lightPosition[a]*l[4*a+3];for(a=0;a<3;++a){var u=l[12+a];for(s=0;s<3;++s)u+=l[4*s+a]*this.lightPosition[s];n.lightPosition[a]=u/c}var h=i(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),a=0;a<3;++a)this.surfaceProject[a]&&this.vertexCount&&(this._shader.uniforms.model=h.projections[a],this._shader.uniforms.clipBounds=h.clipBounds[a],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(),a=0;a<3;++a)for(f.uniforms.permutation=z[a],r.lineWidth(this.contourWidth[a]),s=0;s<this.contourLevels[a].length;++s)this._contourCounts[a][s]&&(s===this.highlightLevel[a]?(f.uniforms.contourColor=this.highlightColor[a],f.uniforms.contourTint=this.highlightTint[a]):0!==s&&s-1!==this.highlightLevel[a]||(f.uniforms.contourColor=this.contourColor[a],f.uniforms.contourTint=this.contourTint[a]),f.uniforms.height=this.contourLevels[a][s],d.draw(r.LINES,this._contourCounts[a][s],this._contourOffsets[a][s]));for(a=0;a<3;++a)for(f.uniforms.model=h.projections[a],f.uniforms.clipBounds=h.clipBounds[a],s=0;s<3;++s)if(this.contourProject[a][s]){f.uniforms.permutation=z[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).bind(),a=0;a<3;++a)if(0!==this._dynamicCounts[a])for(f.uniforms.model=n.model,f.uniforms.clipBounds=n.clipBounds,f.uniforms.permutation=z[a],r.lineWidth(this.dynamicWidth[a]),f.uniforms.contourColor=this.dynamicColor[a],f.uniforms.contourTint=this.dynamicTint[a],f.uniforms.height=this.dynamicLevel[a],d.draw(r.LINES,this._dynamicCounts[a],this._dynamicOffsets[a]),s=0;s<3;++s)this.contourProject[s][a]&&(f.uniforms.model=h.projections[s],f.uniforms.clipBounds=h.clipBounds[s],d.draw(r.LINES,this._dynamicCounts[a],this._dynamicOffsets[a]));d.unbind()}}function o(t,e){var r=e.shape.slice(),n=t.shape.slice();g.assign(t.lo(1,1).hi(r[0],r[1]),e),g.assign(t.lo(1).hi(r[0],1),e.hi(r[0],1)),g.assign(t.lo(1,n[1]-1).hi(r[0],1),e.lo(0,r[1]-1).hi(r[0],1)),g.assign(t.lo(0,1).hi(1,r[1]),e.hi(1)),g.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 s(t,e){return Array.isArray(t)?[e(t[0]),e(t[1]),e(t[2])]:[e(t),e(t),e(t)]}function l(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 c(t){if(Array.isArray(t)){if(Array.isArray(t))return[l(t[0]),l(t[1]),l(t[2])];var e=l(t);return[e.slice(),e.slice(),e.slice()]}}e.exports=function(t){var e=t.gl,r=T(e),i=S(e),a=A(e),o=E(e),s=h(e),l=f(e,[{buffer:s,size:4,stride:L,offset:0},{buffer:s,size:3,stride:L,offset:16},{buffer:s,size:3,stride:L,offset:28}]),c=h(e),u=f(e,[{buffer:c,size:4,stride:20,offset:0},{buffer:c,size:1,stride:20,offset:16}]),p=h(e),m=f(e,[{buffer:p,size:2,type:e.FLOAT}]),g=d(e,1,D,e.RGBA,e.UNSIGNED_BYTE);g.minFilter=e.LINEAR,g.magFilter=e.LINEAR;var v=new n(e,[0,0],[[0,0,0],[0,0,0]],r,i,s,l,g,a,o,c,u,p,m),y={levels:[[],[],[]]};for(var b in t)y[b]=t[b];return y.colormap=y.colormap||"jet",v.update(y),v};var u=t("bit-twiddle"),h=t("gl-buffer"),f=t("gl-vao"),d=t("gl-texture2d"),p=t("typedarray-pool"),m=t("colormap"),g=t("ndarray-ops"),v=t("ndarray-pack"),y=t("ndarray"),b=t("surface-nets"),x=t("gl-mat4/multiply"),_=t("gl-mat4/invert"),w=t("binary-search-bounds"),M=t("ndarray-gradient"),k=t("./lib/shaders"),T=k.createShader,A=k.createContourShader,S=k.createPickShader,E=k.createPickContourShader,L=40,C=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],I=[[0,0],[0,1],[1,0],[1,1],[1,0],[0,1]],z=[[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;t<3;++t){var e=z[t],r=(t+2)%3;e[(t+1)%3+0]=1,e[r+3]=1,e[t+6]=1}}();var D=256,P=n.prototype;P.isTransparent=function(){return this.opacity<1},P.isOpaque=function(){if(this.opacity>=1)return!0;for(var t=0;t<3;++t)if(this._contourCounts[t].length>0||this._dynamicCounts[t]>0)return!0;return!1},P.pickSlots=1,P.setPickBase=function(t){this.pickId=t};var O=[0,0,0],R={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]]]},F={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,vertexColor:0},j=C.slice(),N=[1,0,0,0,1,0,0,0,1];P.draw=function(t){return a.call(this,t,!1)},P.drawTransparent=function(t){return a.call(this,t,!0)};var B={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]};P.drawPick=function(t){t=t||{};var e=this.gl;e.disable(e.CULL_FACE);var r=B;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=N;for(var n=0;n<2;++n)for(var a=r.clipBounds[n],o=0;o<3;++o)a[o]=Math.min(Math.max(this.clipBounds[n][o],-1e8),1e8);var s=i(r,this);if(s.showSurface){for(this._pickShader.bind(),this._pickShader.uniforms=r,this._vao.bind(),this._vao.draw(e.TRIANGLES,this._vertexCount),n=0;n<3;++n)this.surfaceProject[n]&&(this._pickShader.uniforms.model=s.projections[n],this._pickShader.uniforms.clipBounds=s.clipBounds[n],this._vao.draw(e.TRIANGLES,this._vertexCount));this._vao.unbind()}if(s.showContour){var l=this._contourPickShader;l.bind(),l.uniforms=r;var c=this._contourVAO;for(c.bind(),o=0;o<3;++o)for(e.lineWidth(this.contourWidth[o]),l.uniforms.permutation=z[o],n=0;n<this.contourLevels[o].length;++n)this._contourCounts[o][n]&&(l.uniforms.height=this.contourLevels[o][n],c.draw(e.LINES,this._contourCounts[o][n],this._contourOffsets[o][n]));for(n=0;n<3;++n)for(l.uniforms.model=s.projections[n],l.uniforms.clipBounds=s.clipBounds[n],o=0;o<3;++o)if(this.contourProject[n][o]){l.uniforms.permutation=z[o],e.lineWidth(this.contourWidth[o]);for(var u=0;u<this.contourLevels[o].length;++u)this._contourCounts[o][u]&&(l.uniforms.height=this.contourLevels[o][u],c.draw(e.LINES,this._contourCounts[o][u],this._contourOffsets[o][u]))}c.unbind()}},P.pick=function(t){if(!t)return null;if(t.id!==this.pickId)return null;var e=this._field[2].shape,r=this._pickResult,n=e[0]*(t.value[0]+(t.value[2]>>4)/16)/255,i=Math.floor(n),a=n-i,o=e[1]*(t.value[1]+(15&t.value[2])/16)/255,s=Math.floor(o),l=o-s;i+=1,s+=1;var c=r.position;c[0]=c[1]=c[2]=0;for(var u=0;u<2;++u)for(var h=u?a:1-a,f=0;f<2;++f)for(var d=i+u,p=s+f,m=h*(f?l:1-l),g=0;g<3;++g)c[g]+=this._field[g].get(d,p)*m;for(var v=this._pickResult.level,y=0;y<3;++y)if(v[y]=w.le(this.contourLevels[y],c[y]),v[y]<0)this.contourLevels[y].length>0&&(v[y]=0);else if(v[y]<this.contourLevels[y].length-1){var b=this.contourLevels[y][v[y]],x=this.contourLevels[y][v[y]+1];Math.abs(b-c[y])>Math.abs(x-c[y])&&(v[y]+=1)}for(r.index[0]=a<.5?i:i+1,r.index[1]=l<.5?s:s+1,r.uv[0]=n/e[0],r.uv[1]=o/e[1],g=0;g<3;++g)r.dataCoordinate[g]=this._field[g].get(r.index[0],r.index[1]);return r},P.update=function(t){t=t||{},this.dirty=!0,"contourWidth"in t&&(this.contourWidth=s(t.contourWidth,Number)),"showContour"in t&&(this.showContour=s(t.showContour,Boolean)),"showSurface"in t&&(this.showSurface=!!t.showSurface),"contourTint"in t&&(this.contourTint=s(t.contourTint,Boolean)),"contourColor"in t&&(this.contourColor=c(t.contourColor)),"contourProject"in t&&(this.contourProject=s(t.contourProject,function(t){return s(t,Boolean)})),"surfaceProject"in t&&(this.surfaceProject=t.surfaceProject),"dynamicColor"in t&&(this.dynamicColor=c(t.dynamicColor)),"dynamicTint"in t&&(this.dynamicTint=s(t.dynamicTint,Number)),"dynamicWidth"in t&&(this.dynamicWidth=s(t.dynamicWidth,Number)),"opacity"in t&&(this.opacity=t.opacity),"colorBounds"in t&&(this.colorBounds=t.colorBounds),"vertexColor"in t&&(this.vertexColor=t.vertexColor?1:0);var e=t.field||t.coords&&t.coords[2]||null,r=!1;if(e||(e=this._field[2].shape[0]||this._field[2].shape[2]?this._field[2].lo(1,1).hi(this._field[2].shape[0]-2,this._field[2].shape[1]-2):this._field[2].hi(0,0)),"field"in t||"coords"in t){var n=(e.shape[0]+2)*(e.shape[1]+2);n>this._field[2].data.length&&(p.freeFloat(this._field[2].data),this._field[2].data=p.mallocFloat(u.nextPow2(n))),this._field[2]=y(this._field[2].data,[e.shape[0]+2,e.shape[1]+2]),o(this._field[2],e),this.shape=e.shape.slice();for(var i=this.shape,a=0;a<2;++a)this._field[2].size>this._field[a].data.length&&(p.freeFloat(this._field[a].data),this._field[a].data=p.mallocFloat(this._field[2].size)),this._field[a]=y(this._field[a].data,[i[0]+2,i[1]+2]);if(t.coords){var l=t.coords;if(!Array.isArray(l)||3!==l.length)throw new Error("gl-surface: invalid coordinates for x/y");for(a=0;a<2;++a){var h=l[a];for(w=0;w<2;++w)if(h.shape[w]!==i[w])throw new Error("gl-surface: coords have incorrect shape");o(this._field[a],h)}}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;a<2;++a){var d=f[a];if((Array.isArray(d)||d.length)&&(d=y(d)),d.shape[0]!==i[a])throw new Error("gl-surface: invalid tick length");var x=y(d.data,i);x.stride[a]=d.stride[0],x.stride[1^a]=0,o(this._field[a],x)}}else{for(a=0;a<2;++a){var _=[0,0];_[a]=1,this._field[a]=y(this._field[a].data,[i[0]+2,i[1]+2],_,0)}this._field[0].set(0,0,0);for(var w=0;w<i[0];++w)this._field[0].set(w+1,0,w);for(this._field[0].set(i[0]+1,0,i[0]-1),this._field[1].set(0,0,0),w=0;w<i[1];++w)this._field[1].set(0,w+1,w);this._field[1].set(0,i[1]+1,i[1]-1)}var k=this._field,T=y(p.mallocFloat(3*k[2].size*2),[3,i[0]+2,i[1]+2,2]);for(a=0;a<3;++a)M(T.pick(a),k[a],"mirror");var A=y(p.mallocFloat(3*k[2].size),[i[0]+2,i[1]+2,3]);for(a=0;a<i[0]+2;++a)for(w=0;w<i[1]+2;++w){var S=T.get(0,a,w,0),E=T.get(0,a,w,1),L=T.get(1,a,w,0),C=T.get(1,a,w,1),z=T.get(2,a,w,0),P=T.get(2,a,w,1),O=L*P-C*z,R=z*E-P*S,F=S*C-E*L,j=Math.sqrt(O*O+R*R+F*F);j<1e-8?(j=Math.max(Math.abs(O),Math.abs(R),Math.abs(F)))<1e-8?(F=1,R=O=0,j=1):j=1/j:j=1/Math.sqrt(j),A.set(a,w,0,O*j),A.set(a,w,1,R*j),A.set(a,w,2,F*j)}p.free(T.data);var N=[1/0,1/0,1/0],B=[-1/0,-1/0,-1/0],U=1/0,V=-1/0,H=(i[0]-1)*(i[1]-1)*6,q=p.mallocFloat(u.nextPow2(10*H)),G=0,Y=0;for(a=0;a<i[0]-1;++a)t:for(w=0;w<i[1]-1;++w){for(var W=0;W<2;++W)for(var X=0;X<2;++X)for(var Z=0;Z<3;++Z){var J=this._field[Z].get(1+a+W,1+w+X);if(isNaN(J)||!isFinite(J))continue t}for(Z=0;Z<6;++Z){var K=a+I[Z][0],Q=w+I[Z][1],$=this._field[0].get(K+1,Q+1),tt=this._field[1].get(K+1,Q+1),et=J=this._field[2].get(K+1,Q+1);O=A.get(K+1,Q+1,0),R=A.get(K+1,Q+1,1),F=A.get(K+1,Q+1,2),t.intensity&&(et=t.intensity.get(K,Q)),q[G++]=K,q[G++]=Q,q[G++]=$,q[G++]=tt,q[G++]=J,q[G++]=0,q[G++]=et,q[G++]=O,q[G++]=R,q[G++]=F,N[0]=Math.min(N[0],$),N[1]=Math.min(N[1],tt),N[2]=Math.min(N[2],J),U=Math.min(U,et),B[0]=Math.max(B[0],$),B[1]=Math.max(B[1],tt),B[2]=Math.max(B[2],J),V=Math.max(V,et),Y+=1}}for(t.intensityBounds&&(U=+t.intensityBounds[0],V=+t.intensityBounds[1]),a=6;a<G;a+=10)q[a]=(q[a]-U)/(V-U);this._vertexCount=Y,this._coordinateBuffer.update(q.subarray(0,G)),p.freeFloat(q),p.free(A.data),this.bounds=[N,B],this.intensity=t.intensity||this._field[2],this.intensityBounds[0]===U&&this.intensityBounds[1]===V||(r=!0),this.intensityBounds=[U,V]}if("levels"in t){var rt=t.levels;for(rt=Array.isArray(rt[0])?rt.slice():[[],[],rt],a=0;a<3;++a)rt[a]=rt[a].slice(),rt.sort(function(t,e){return t-e});t:for(a=0;a<3;++a){if(rt[a].length!==this.contourLevels[a].length){r=!0;break}for(w=0;w<rt[a].length;++w)if(rt[a][w]!==this.contourLevels[a][w]){r=!0;break t}}this.contourLevels=rt}if(r){k=this._field,i=this.shape;for(var nt=[],it=0;it<3;++it){rt=this.contourLevels[it];var at=[],ot=[],st=[0,0,0];for(a=0;a<rt.length;++a){var lt=b(this._field[it],rt[a]);at.push(nt.length/5|0),Y=0;t:for(w=0;w<lt.cells.length;++w){var ct=lt.cells[w];for(Z=0;Z<2;++Z){var ut=lt.positions[ct[Z]],ht=ut[0],ft=0|Math.floor(ht),dt=ht-ft,pt=ut[1],mt=0|Math.floor(pt),gt=pt-mt,vt=!1;e:for(var yt=0;yt<3;++yt){st[yt]=0;var bt=(it+yt+1)%3;for(W=0;W<2;++W){var xt=W?dt:1-dt;for(K=0|Math.min(Math.max(ft+W,0),i[0]),X=0;X<2;++X){var _t=X?gt:1-gt;if(Q=0|Math.min(Math.max(mt+X,0),i[1]),J=yt<2?this._field[bt].get(K,Q):(this.intensity.get(K,Q)-this.intensityBounds[0])/(this.intensityBounds[1]-this.intensityBounds[0]),!isFinite(J)||isNaN(J)){vt=!0;break e}var wt=xt*_t;st[yt]+=wt*J}}}if(vt){if(Z>0){for(var Mt=0;Mt<5;++Mt)nt.pop();Y-=1}continue t}nt.push(st[0],st[1],ut[0],ut[1],st[2]),Y+=1}}ot.push(Y)}this._contourOffsets[it]=at,this._contourCounts[it]=ot}var kt=p.mallocFloat(nt.length);for(a=0;a<nt.length;++a)kt[a]=nt[a];this._contourBuffer.update(kt),p.freeFloat(kt)}t.colormap&&this._colorMap.setPixels(function(t){var e=v([m({colormap:t,nshades:D,format:"rgba"}).map(function(t){return[t[0],t[1],t[2],255*t[3]]})]);return g.divseq(e,255),e}(t.colormap))},P.dispose=function(){this._shader.dispose(),this._vao.dispose(),this._coordinateBuffer.dispose(),this._colorMap.dispose(),this._contourBuffer.dispose(),this._contourVAO.dispose(),this._contourShader.dispose(),this._contourPickShader.dispose(),this._dynamicBuffer.dispose(),this._dynamicVAO.dispose();for(var t=0;t<3;++t)p.freeFloat(this._field[t].data)},P.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;e<3;++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,a=p.mallocFloat(12*i[0]*i[1]),o=0;o<3;++o)if(this.enableDynamic[o]){this.dynamicLevel[o]=r[o];var s=(o+1)%3,l=(o+2)%3,c=this._field[o],u=this._field[s],h=this._field[l],f=(this.intensity,b(c,r[o])),d=f.cells,m=f.positions;for(this._dynamicOffsets[o]=n,e=0;e<d.length;++e)for(var g=d[e],v=0;v<2;++v){var y=m[g[v]],x=+y[0],_=0|x,w=0|Math.min(_+1,i[0]),M=x-_,k=1-M,T=+y[1],A=0|T,S=0|Math.min(A+1,i[1]),E=T-A,L=1-E,C=k*L,I=k*E,z=M*L,D=M*E,P=C*u.get(_,A)+I*u.get(_,S)+z*u.get(w,A)+D*u.get(w,S),O=C*h.get(_,A)+I*h.get(_,S)+z*h.get(w,A)+D*h.get(w,S);if(isNaN(P)||isNaN(O)){v&&(n-=1);break}a[2*n+0]=P,a[2*n+1]=O,n+=1}this._dynamicCounts[o]=n-this._dynamicOffsets[o]}else this.dynamicLevel[o]=NaN,this._dynamicCounts[o]=0;this._dynamicBuffer.update(a.subarray(0,2*n)),p.freeFloat(a)}}},{"./lib/shaders":268,"binary-search-bounds":69,"bit-twiddle":70,colormap:102,"gl-buffer":159,"gl-mat4/invert":184,"gl-mat4/multiply":186,"gl-texture2d":270,"gl-vao":274,ndarray:470,"ndarray-gradient":461,"ndarray-ops":464,"ndarray-pack":465,"surface-nets":542,"typedarray-pool":552}],270:[function(t,e,r){"use strict";function n(t){return"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLVideoElement&&t instanceof HTMLVideoElement||"undefined"!=typeof ImageData&&t instanceof ImageData}function i(t,e,r){var n=t.gl,i=n.getParameter(n.MAX_TEXTURE_SIZE);if(e<0||e>i||r<0||r>i)throw new Error("gl-texture2d: Invalid texture size");return t._shape=[e,r],t.bind(),n.texImage2D(n.TEXTURE_2D,0,t.format,e,r,0,t.format,t.type,null),t._mipLevels=[0],t}function a(t,e,r,n,i,a){this.gl=t,this.handle=e,this.format=i,this.type=a,this._shape=[r,n],this._mipLevels=[0],this._magFilter=t.NEAREST,this._minFilter=t.NEAREST,this._wrapS=t.CLAMP_TO_EDGE,this._wrapT=t.CLAMP_TO_EDGE,this._anisoSamples=1;var o=this,s=[this._wrapS,this._wrapT];Object.defineProperties(s,[{get:function(){return o._wrapS},set:function(t){return o.wrapS=t}},{get:function(){return o._wrapT},set:function(t){return o.wrapT=t}}]),this._wrapVector=s;var l=[this._shape[0],this._shape[1]];Object.defineProperties(l,[{get:function(){return o._shape[0]},set:function(t){return o.width=t}},{get:function(){return o._shape[1]},set:function(t){return o.height=t}}]),this._shapeVector=l}function o(t,e){return 3===t.length?1===e[2]&&e[1]===t[0]*t[2]&&e[0]===t[2]:1===e[0]&&e[1]===t[0]}function s(t){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 l(t,e,r,n,i){var o=t.getParameter(t.MAX_TEXTURE_SIZE);if(e<0||e>o||r<0||r>o)throw new Error("gl-texture2d: Invalid texture shape");if(i===t.FLOAT&&!t.getExtension("OES_texture_float"))throw new Error("gl-texture2d: Floating point textures not supported on this platform");var l=s(t);return t.texImage2D(t.TEXTURE_2D,0,n,e,r,0,n,i,null),new a(t,l,e,r,n,i)}var c=t("ndarray"),u=t("ndarray-ops"),h=t("typedarray-pool");e.exports=function(t){if(arguments.length<=1)throw new Error("gl-texture2d: Missing arguments for texture2d constructor");if(f||function(t){f=[t.LINEAR,t.NEAREST_MIPMAP_LINEAR,t.LINEAR_MIPMAP_NEAREST,t.LINEAR_MIPMAP_NEAREST],d=[t.NEAREST,t.LINEAR,t.NEAREST_MIPMAP_NEAREST,t.NEAREST_MIPMAP_LINEAR,t.LINEAR_MIPMAP_NEAREST,t.LINEAR_MIPMAP_LINEAR],p=[t.REPEAT,t.CLAMP_TO_EDGE,t.MIRRORED_REPEAT]}(t),"number"==typeof arguments[1])return l(t,arguments[1],arguments[2],arguments[3]||t.RGBA,arguments[4]||t.UNSIGNED_BYTE);if(Array.isArray(arguments[1]))return l(t,0|arguments[1][0],0|arguments[1][1],arguments[2]||t.RGBA,arguments[3]||t.UNSIGNED_BYTE);if("object"==typeof arguments[1]){var e=arguments[1],r=n(e)?e:e.raw;if(r)return function(t,e,r,n,i,o){var l=s(t);return t.texImage2D(t.TEXTURE_2D,0,i,i,o,e),new a(t,l,r,n,i,o)}(t,r,0|e.width,0|e.height,arguments[2]||t.RGBA,arguments[3]||t.UNSIGNED_BYTE);if(e.shape&&e.data&&e.stride)return function(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 l=o(n,e.stride.slice()),f=0;"float32"===r?f=t.FLOAT:"float64"===r?(f=t.FLOAT,l=!1,r="float32"):"uint8"===r?f=t.UNSIGNED_BYTE:(f=t.UNSIGNED_BYTE,l=!1,r="uint8");var d=0;if(2===n.length)d=t.LUMINANCE,n=[n[0],n[1],1],e=c(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])d=t.ALPHA;else if(2===n[2])d=t.LUMINANCE_ALPHA;else if(3===n[2])d=t.RGB;else{if(4!==n[2])throw new Error("gl-texture2d: Invalid shape for pixel coords");d=t.RGBA}}f!==t.FLOAT||t.getExtension("OES_texture_float")||(f=t.UNSIGNED_BYTE,l=!1);var p,g,v=e.size;if(l)p=0===e.offset&&e.data.length===v?e.data:e.data.subarray(e.offset,e.offset+v);else{var y=[n[2],n[2]*n[0],1];g=h.malloc(v,r);var b=c(g,n,y,0);"float32"!==r&&"float64"!==r||f!==t.UNSIGNED_BYTE?u.assign(b,e):m(b,e),p=g.subarray(0,v)}var x=s(t);return t.texImage2D(t.TEXTURE_2D,0,d,n[0],n[1],0,d,f,p),l||h.free(g),new a(t,x,n[0],n[1],d,f)}(t,e)}throw new Error("gl-texture2d: Invalid arguments for texture2d constructor")};var f=null,d=null,p=null,m=function(t,e){u.muls(t,e,255)},g=a.prototype;Object.defineProperties(g,{minFilter:{get:function(){return this._minFilter},set:function(t){this.bind();var e=this.gl;if(this.type===e.FLOAT&&f.indexOf(t)>=0&&(e.getExtension("OES_texture_float_linear")||(t=e.NEAREST)),d.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&&f.indexOf(t)>=0&&(e.getExtension("OES_texture_float_linear")||(t=e.NEAREST)),d.indexOf(t)<0)throw new Error("gl-texture2d: Unknown filter mode "+t);return e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,t),this._magFilter=t}},mipSamples:{get:function(){return this._anisoSamples},set:function(t){var e=this._anisoSamples;if(this._anisoSamples=0|Math.max(t,1),e!==this._anisoSamples){var r=this.gl.getExtension("EXT_texture_filter_anisotropic");r&&this.gl.texParameterf(this.gl.TEXTURE_2D,r.TEXTURE_MAX_ANISOTROPY_EXT,this._anisoSamples)}return this._anisoSamples}},wrapS:{get:function(){return this._wrapS},set:function(t){if(this.bind(),p.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(),p.indexOf(t)<0)throw new Error("gl-texture2d: Unknown wrap mode "+t);return this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,t),this._wrapT=t}},wrap:{get:function(){return this._wrapVector},set:function(t){if(Array.isArray(t)||(t=[t,t]),2!==t.length)throw new Error("gl-texture2d: Must specify wrap mode for rows and columns");for(var e=0;e<2;++e)if(p.indexOf(t[e])<0)throw new Error("gl-texture2d: Unknown wrap mode "+t);this._wrapS=t[0],this._wrapT=t[1];var r=this.gl;return this.bind(),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,this._wrapS),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,this._wrapT),t}},shape:{get:function(){return this._shapeVector},set:function(t){if(Array.isArray(t)){if(2!==t.length)throw new Error("gl-texture2d: Invalid texture shape")}else t=[0|t,0|t];return i(this,0|t[0],0|t[1]),[0|t[0],0|t[1]]}},width:{get:function(){return this._shape[0]},set:function(t){return t|=0,i(this,t,this._shape[1]),t}},height:{get:function(){return this._shape[1]},set:function(t){return t|=0,i(this,this._shape[0],t),t}}}),g.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},g.dispose=function(){this.gl.deleteTexture(this.handle)},g.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)},g.setPixels=function(t,e,r,i){var a=this.gl;this.bind(),Array.isArray(e)?(i=r,r=0|e[1],e=0|e[0]):(e=e||0,r=r||0),i=i||0;var s=n(t)?t:t.raw;if(s){this._mipLevels.indexOf(i)<0?(a.texImage2D(a.TEXTURE_2D,0,this.format,this.format,this.type,s),this._mipLevels.push(i)):a.texSubImage2D(a.TEXTURE_2D,i,e,r,this.format,this.type,s)}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]>>>i||r+t.shape[0]>this._shape[0]>>>i||e<0||r<0)throw new Error("gl-texture2d: Texture dimensions are out of bounds");!function(t,e,r,n,i,a,s,l){var f=l.dtype,d=l.shape.slice();if(d.length<2||d.length>3)throw new Error("gl-texture2d: Invalid ndarray, must be 2d or 3d");var p=0,g=0,v=o(d,l.stride.slice());if("float32"===f?p=t.FLOAT:"float64"===f?(p=t.FLOAT,v=!1,f="float32"):"uint8"===f?p=t.UNSIGNED_BYTE:(p=t.UNSIGNED_BYTE,v=!1,f="uint8"),2===d.length)g=t.LUMINANCE,d=[d[0],d[1],1],l=c(l.data,d,[l.stride[0],l.stride[1],1],l.offset);else{if(3!==d.length)throw new Error("gl-texture2d: Invalid shape for texture");if(1===d[2])g=t.ALPHA;else if(2===d[2])g=t.LUMINANCE_ALPHA;else if(3===d[2])g=t.RGB;else{if(4!==d[2])throw new Error("gl-texture2d: Invalid shape for pixel coords");g=t.RGBA}d[2]}if(g!==t.LUMINANCE&&g!==t.ALPHA||i!==t.LUMINANCE&&i!==t.ALPHA||(g=i),g!==i)throw new Error("gl-texture2d: Incompatible texture format for setPixels");var y=l.size,b=s.indexOf(n)<0;if(b&&s.push(n),p===a&&v)0===l.offset&&l.data.length===y?b?t.texImage2D(t.TEXTURE_2D,n,i,d[0],d[1],0,i,a,l.data):t.texSubImage2D(t.TEXTURE_2D,n,e,r,d[0],d[1],i,a,l.data):b?t.texImage2D(t.TEXTURE_2D,n,i,d[0],d[1],0,i,a,l.data.subarray(l.offset,l.offset+y)):t.texSubImage2D(t.TEXTURE_2D,n,e,r,d[0],d[1],i,a,l.data.subarray(l.offset,l.offset+y));else{var x;x=a===t.FLOAT?h.mallocFloat32(y):h.mallocUint8(y);var _=c(x,d,[d[2],d[2]*d[0],1]);p===t.FLOAT&&a===t.UNSIGNED_BYTE?m(_,l):u.assign(_,l),b?t.texImage2D(t.TEXTURE_2D,n,i,d[0],d[1],0,i,a,x.subarray(0,y)):t.texSubImage2D(t.TEXTURE_2D,n,e,r,d[0],d[1],i,a,x.subarray(0,y)),a===t.FLOAT?h.freeFloat32(x):h.freeUint8(x)}}(a,e,r,i,this.format,this.type,this._mipLevels,t)}}},{ndarray:470,"ndarray-ops":464,"typedarray-pool":552}],271:[function(t,e,r){"use strict";e.exports=function(t,e,r){e?e.bind():t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,null);var n=0|t.getParameter(t.MAX_VERTEX_ATTRIBS);if(r){if(r.length>n)throw new Error("gl-vao: Too many vertex attributes");for(h=0;h<r.length;++h){var i=r[h];if(i.buffer){var a=i.buffer,o=i.size||4,s=i.type||t.FLOAT,l=!!i.normalized,c=i.stride||0,u=i.offset||0;a.bind(),t.enableVertexAttribArray(h),t.vertexAttribPointer(h,o,s,l,c,u)}else{if("number"==typeof i)t.vertexAttrib1f(h,i);else if(1===i.length)t.vertexAttrib1f(h,i[0]);else if(2===i.length)t.vertexAttrib2f(h,i[0],i[1]);else if(3===i.length)t.vertexAttrib3f(h,i[0],i[1],i[2]);else{if(4!==i.length)throw new Error("gl-vao: Invalid vertex attribute");t.vertexAttrib4f(h,i[0],i[1],i[2],i[3])}t.disableVertexAttribArray(h)}}for(;h<n;++h)t.disableVertexAttribArray(h)}else{t.bindBuffer(t.ARRAY_BUFFER,null);for(var h=0;h<n;++h)t.disableVertexAttribArray(h)}}},{}],272:[function(t,e,r){"use strict";function n(t){this.gl=t,this._elements=null,this._attributes=null,this._elementsType=t.UNSIGNED_SHORT}var i=t("./do-bind.js");n.prototype.bind=function(){i(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=function(t){return new n(t)}},{"./do-bind.js":271}],273:[function(t,e,r){"use strict";function n(t,e,r,n,i,a){this.location=t,this.dimension=e,this.a=r,this.b=n,this.c=i,this.d=a}function i(t,e,r){this.gl=t,this._ext=e,this.handle=r,this._attribs=[],this._useElements=!1,this._elementsType=t.UNSIGNED_SHORT}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=function(t,e){return new i(t,e,e.createVertexArrayOES())}},{"./do-bind.js":271}],274:[function(t,e,r){"use strict";var n=t("./lib/vao-native.js"),i=t("./lib/vao-emulated.js");e.exports=function(t,e,r,a){var o,s=t.createVertexArray?new function(t){this.bindVertexArrayOES=t.bindVertexArray.bind(t),this.createVertexArrayOES=t.createVertexArray.bind(t),this.deleteVertexArrayOES=t.deleteVertexArray.bind(t)}(t):t.getExtension("OES_vertex_array_object");return(o=s?n(t,s):i(t)).update(e,r,a),o}},{"./lib/vao-emulated.js":272,"./lib/vao-native.js":273}],275:[function(t,e,r){e.exports=function(t,e,r){var n=e[0],i=e[1],a=e[2],o=r[0],s=r[1],l=r[2];return t[0]=i*l-a*s,t[1]=a*o-n*l,t[2]=n*s-i*o,t}},{}],276:[function(t,e,r){e.exports=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}},{}],277:[function(t,e,r){e.exports=function(t){var e=t[0],r=t[1],n=t[2];return Math.sqrt(e*e+r*r+n*n)}},{}],278:[function(t,e,r){e.exports=function(t,e,r,n){var i=e[0],a=e[1],o=e[2];return t[0]=i+n*(r[0]-i),t[1]=a+n*(r[1]-a),t[2]=o+n*(r[2]-o),t}},{}],279:[function(t,e,r){e.exports=function(t,e){var r=e[0],n=e[1],i=e[2],a=r*r+n*n+i*i;return a>0&&(a=1/Math.sqrt(a),t[0]=e[0]*a,t[1]=e[1]*a,t[2]=e[2]*a),t}},{}],280:[function(t,e,r){e.exports=function(t,e,r){var n=e[0],i=e[1],a=e[2],o=e[3];return t[0]=r[0]*n+r[4]*i+r[8]*a+r[12]*o,t[1]=r[1]*n+r[5]*i+r[9]*a+r[13]*o,t[2]=r[2]*n+r[6]*i+r[10]*a+r[14]*o,t[3]=r[3]*n+r[7]*i+r[11]*a+r[15]*o,t}},{}],281:[function(t,e,r){e.exports=function(t,e,r,a){return n[0]=a,n[1]=r,n[2]=e,n[3]=t,i[0]};var n=new Uint8Array(4),i=new Float32Array(n.buffer)},{}],282:[function(t,e,r){var n=t("glsl-tokenizer"),i=t("atob-lite");e.exports=function(t){for(var e=Array.isArray(t)?t:n(t),r=0;r<e.length;r++){var a=e[r];if("preprocessor"===a.type){var o=a.data.match(/\#define\s+SHADER_NAME(_B64)?\s+(.+)$/);if(o&&o[2]){var s=o[1],l=o[2];return(s?i(l):l).trim()}}}}},{"atob-lite":51,"glsl-tokenizer":289}],283:[function(t,e,r){e.exports=function(t){function e(t){t.length&&z.push({type:w[C],data:t,position:O,line:D,column:P})}function r(t){E=0,S=(j+=t).length;for(var r;T=j[E],E<S;){switch(r=E,C){case u:E="/"===T&&"*"===A?(I.push(T),e(I.join("")),C=l,E+1):(I.push(T),A=T,E+1);break;case h:case f:E=M();break;case d:E=function(){if("."===A&&/\d/.test(T))return C=m,E;if("/"===A&&"*"===T)return C=u,E;if("/"===A&&"/"===T)return C=h,E;if("."===T&&I.length){for(;k(I););return C=m,E}if(";"===T||")"===T||"("===T){if(I.length)for(;k(I););return e(T),C=l,E+1}var t=2===I.length&&"="!==T;if(/[\w_\d\s]/.test(T)||t){for(;k(I););return C=l,E}return I.push(T),A=T,E+1}();break;case p:E="."===T?(I.push(T),C=m,A=T,E+1):/[eE]/.test(T)?(I.push(T),C=m,A=T,E+1):"x"===T&&1===I.length&&"0"===I[0]?(C=_,I.push(T),A=T,E+1):/[^\d]/.test(T)?(e(I.join("")),C=l,E):(I.push(T),A=T,E+1);break;case _:E=/[^a-fA-F0-9]/.test(T)?(e(I.join("")),C=l,E):(I.push(T),A=T,E+1);break;case m:"f"===T&&(I.push(T),A=T,E+=1),E=/[eE]/.test(T)?(I.push(T),A=T,E+1):"-"===T&&/[eE]/.test(A)?(I.push(T),A=T,E+1):/[^\d]/.test(T)?(e(I.join("")),C=l,E):(I.push(T),A=T,E+1);break;case c:E=function(){if(/[^\d\w_]/.test(T)){var t=I.join("");return C=B.indexOf(t)>-1?y:N.indexOf(t)>-1?v:g,e(I.join("")),C=l,E}return I.push(T),A=T,E+1}();break;case b:E=/[^\s]/g.test(T)?(e(I.join("")),C=l,E):(I.push(T),A=T,E+1);break;case l:I=I.length?[]:I,E="/"===A&&"*"===T?(O=L+E-1,C=u,A=T,E+1):"/"===A&&"/"===T?(O=L+E-1,C=h,A=T,E+1):"#"===T?(C=f,O=L+E,E):/\s/.test(T)?(C=b,O=L+E,E):(R=/\d/.test(T),F=/[^\w_]/.test(T),O=L+E,C=R?p:F?d:c,E)}if(r!==E)switch(j[r]){case"\n":P=0,++D;break;default:++P}}return L+=E,j=j.slice(E),z}function M(){return"\r"!==T&&"\n"!==T||"\\"===A?(I.push(T),A=T,E+1):(e(I.join("")),C=l,E)}function k(t){for(var r,n,a=0;;){if(r=i.indexOf(t.slice(0,t.length+a).join("")),n=i[r],-1===r){if(a--+t.length>0)continue;n=t.slice(0,1).join("")}return e(n),O+=n.length,(I=I.slice(n.length)).length}}var T,A,S,E=0,L=0,C=l,I=[],z=[],D=1,P=0,O=0,R=!1,F=!1,j="",N=a,B=n;return"300 es"===(t=t||{}).version&&(N=s,B=o),function(t){return z=[],null!==t?r(t.replace?t.replace(/\r\n/g,"\n"):t):(I.length&&e(I.join("")),C=x,e("(eof)"),z)}};var n=t("./lib/literals"),i=t("./lib/operators"),a=t("./lib/builtins"),o=t("./lib/literals-300es"),s=t("./lib/builtins-300es"),l=999,c=9999,u=0,h=1,f=2,d=3,p=4,m=5,g=6,v=7,y=8,b=9,x=10,_=11,w=["block-comment","line-comment","preprocessor","operator","integer","float","ident","builtin","keyword","whitespace","eof","integer"]},{"./lib/builtins":285,"./lib/builtins-300es":284,"./lib/literals":287,"./lib/literals-300es":286,"./lib/operators":288}],284:[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":285}],285:[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"]},{}],286:[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":287}],287:[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"]},{}],288:[function(t,e,r){e.exports=["<<=",">>=","++","--","<<",">>","<=",">=","==","!=","&&","||","+=","-=","*=","/=","%=","&=","^^","^=","|=","(",")","[","]",".","!","~","*","/","%","+","-","<",">","&","^","|","?",":","=",",",";","{","}"]},{}],289:[function(t,e,r){var n=t("./index");e.exports=function(t,e){var r=n(e),i=[];return i=i.concat(r(t)),i=i.concat(r(null))}},{"./index":283}],290:[function(t,e,r){"use strict";function n(t,e,r){var n=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;var a=new Int32Array(this.arrayBuffer);t=a[0],e=a[1],r=a[2],this.d=e+2*r;for(var o=0;o<this.d*this.d;o++){var s=a[i+o],l=a[i+o+1];n.push(s===l?null:a.subarray(s,l))}var c=a[i+n.length],u=a[i+n.length+1];this.keys=a.subarray(c,u),this.bboxes=a.subarray(u),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,a){this.cells[i].push(a)},n.prototype.query=function(t,e,r,n){var i=this.min,a=this.max;if(t<=i&&e<=i&&a<=r&&a<=n)return Array.prototype.slice.call(this.keys);var o=[],s={};return this._forEachCell(t,e,r,n,this._queryCell,o,s),o},n.prototype._queryCell=function(t,e,r,n,i,a,o){var s=this.cells[i];if(null!==s)for(var l=this.keys,c=this.bboxes,u=0;u<s.length;u++){var h=s[u];if(void 0===o[h]){var f=4*h;t<=c[f+2]&&e<=c[f+3]&&r>=c[f+0]&&n>=c[f+1]?(o[h]=!0,a.push(l[h])):o[h]=!1}}},n.prototype._forEachCell=function(t,e,r,n,i,a,o){for(var s=this._convertToCellCoord(t),l=this._convertToCellCoord(e),c=this._convertToCellCoord(r),u=this._convertToCellCoord(n),h=s;h<=c;h++)for(var f=l;f<=u;f++){var d=this.d*f+h;if(i.call(this,t,e,r,n,d,a,o))return}},n.prototype._convertToCellCoord=function(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))},n.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;for(var t=this.cells,e=i+this.cells.length+1+1,r=0,n=0;n<this.cells.length;n++)r+=this.cells[n].length;var a=new Int32Array(e+r+this.keys.length+this.bboxes.length);a[0]=this.extent,a[1]=this.n,a[2]=this.padding;for(var o=e,s=0;s<t.length;s++){var l=t[s];a[i+s]=o,a.set(l,o),o+=l.length}return a[i+t.length]=o,a.set(this.keys,o),o+=this.keys.length,a[i+t.length+1]=o,a.set(this.bboxes,o),o+=this.bboxes.length,a.buffer}},{}],291:[function(t,e,r){(function(r){"use strict";var n,i=t("is-browser");n="function"==typeof r.matchMedia?!r.matchMedia("(hover: none)").matches:i,e.exports=n}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"is-browser":297}],292:[function(t,e,r){r.read=function(t,e,r,n,i){var a,o,s=8*i-n-1,l=(1<<s)-1,c=l>>1,u=-7,h=r?i-1:0,f=r?-1:1,d=t[e+h];for(h+=f,a=d&(1<<-u)-1,d>>=-u,u+=s;u>0;a=256*a+t[e+h],h+=f,u-=8);for(o=a&(1<<-u)-1,a>>=-u,u+=n;u>0;o=256*o+t[e+h],h+=f,u-=8);if(0===a)a=1-c;else{if(a===l)return o?NaN:1/0*(d?-1:1);o+=Math.pow(2,n),a-=c}return(d?-1:1)*o*Math.pow(2,a-n)},r.write=function(t,e,r,n,i,a){var o,s,l,c=8*a-i-1,u=(1<<c)-1,h=u>>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:a-1,p=n?1:-1,m=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,o=u):(o=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-o))<1&&(o--,l*=2),(e+=o+h>=1?f/l:f*Math.pow(2,1-h))*l>=2&&(o++,l/=2),o+h>=u?(s=0,o=u):o+h>=1?(s=(e*l-1)*Math.pow(2,i),o+=h):(s=e*Math.pow(2,h-1)*Math.pow(2,i),o=0));i>=8;t[r+d]=255&s,d+=p,s/=256,i-=8);for(o=o<<i|s,c+=i;c>0;t[r+d]=255&o,d+=p,o/=256,c-=8);t[r+d-p]|=128*m}},{}],293:[function(t,e,r){"use strict";function n(t,e,r){this.vertices=t,this.adjacent=e,this.boundary=r,this.lastVisited=-1}function i(t,e,r){this.vertices=t,this.cell=e,this.index=r}function a(t,e){return l(t.vertices,e.vertices)}function o(t,e,r){this.dimension=t,this.vertices=e,this.simplices=r,this.interior=r.filter(function(t){return!t.boundary}),this.tuple=new Array(t+1);for(var n=0;n<=t;++n)this.tuple[n]=this.vertices[n];var i=c[t];i||(i=c[t]=function(t){for(var e=["function orient(){var tuple=this.tuple;return test("],r=0;r<=t;++r)r>0&&e.push(","),e.push("tuple[",r,"]");e.push(")}return orient");var n=new Function("test",e.join("")),i=s[t+1];return i||(i=s),n(i)}(t)),this.orient=i}e.exports=function(t,e){var r=t.length;if(0===r)throw new Error("Must have at least d+1 points");var i=t[0].length;if(r<=i)throw new Error("Must input at least d+1 points");var a=t.slice(0,i+1),l=s.apply(void 0,a);if(0===l)throw new Error("Input not in general position");for(var c=new Array(i+1),u=0;u<=i;++u)c[u]=u;l<0&&(c[0]=1,c[1]=0);for(var h=new n(c,new Array(i+1),!1),f=h.adjacent,d=new Array(i+2),u=0;u<=i;++u){for(var p=c.slice(),m=0;m<=i;++m)m===u&&(p[m]=-1);var g=p[0];p[0]=p[1],p[1]=g;var v=new n(p,new Array(i+1),!0);f[u]=v,d[u]=v}for(d[i+1]=h,u=0;u<=i;++u)for(var p=f[u].vertices,y=f[u].adjacent,m=0;m<=i;++m){var b=p[m];if(b<0)y[m]=h;else for(var x=0;x<=i;++x)f[x].vertices.indexOf(b)<0&&(y[m]=f[x])}for(var _=new o(i,a,d),w=!!e,u=i+1;u<r;++u)_.insert(t[u],w);return _.boundary()};var s=t("robust-orientation"),l=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 c=[],u=o.prototype;u.handleBoundaryDegeneracy=function(t,e){var r=this.dimension,n=this.vertices.length-1,i=this.tuple,a=this.vertices,o=[t];for(t.lastVisited=-n;o.length>0;){(t=o.pop()).vertices;for(var s=t.adjacent,l=0;l<=r;++l){var c=s[l];if(c.boundary&&!(c.lastVisited<=-n)){for(var u=c.vertices,h=0;h<=r;++h){var f=u[h];i[h]=f<0?e:a[f]}var d=this.orient();if(d>0)return c;c.lastVisited=-n,0===d&&o.push(c)}}}return null},u.walk=function(t,e){var r=this.vertices.length-1,n=this.dimension,i=this.vertices,a=this.tuple,o=e?this.interior.length*Math.random()|0:this.interior.length-1,s=this.interior[o];t:for(;!s.boundary;){for(var l=s.vertices,c=s.adjacent,u=0;u<=n;++u)a[u]=i[l[u]];s.lastVisited=r;for(u=0;u<=n;++u){var h=c[u];if(!(h.lastVisited>=r)){var f=a[u];a[u]=t;var d=this.orient();if(a[u]=f,d<0){s=h;continue t}h.boundary?h.lastVisited=-r:h.lastVisited=r}}return}return s},u.addPeaks=function(t,e){var r=this.vertices.length-1,o=this.dimension,s=this.vertices,l=this.tuple,c=this.interior,u=this.simplices,h=[e];e.lastVisited=r,e.vertices[e.vertices.indexOf(-1)]=r,e.boundary=!1,c.push(e);for(var f=[];h.length>0;){var d=(e=h.pop()).vertices,p=e.adjacent,m=d.indexOf(r);if(!(m<0))for(C=0;C<=o;++C)if(C!==m){var g=p[C];if(g.boundary&&!(g.lastVisited>=r)){var v=g.vertices;if(g.lastVisited!==-r){for(var y=0,b=0;b<=o;++b)v[b]<0?(y=b,l[b]=t):l[b]=s[v[b]];if(this.orient()>0){v[y]=r,g.boundary=!1,c.push(g),h.push(g),g.lastVisited=r;continue}g.lastVisited=-r}var x=g.adjacent,_=d.slice(),w=p.slice(),M=new n(_,w,!0);u.push(M);var k=x.indexOf(e);if(!(k<0)){x[k]=M,w[m]=g,_[C]=-1,w[C]=e,p[C]=M,M.flip();for(b=0;b<=o;++b){var T=_[b];if(!(T<0||T===r)){for(var A=new Array(o-1),S=0,E=0;E<=o;++E){var L=_[E];L<0||E===b||(A[S++]=L)}f.push(new i(A,M,b))}}}}}}f.sort(a);for(var C=0;C+1<f.length;C+=2){var I=f[C],z=f[C+1],D=I.index,P=z.index;D<0||P<0||(I.cell.adjacent[I.index]=z.cell,z.cell.adjacent[z.index]=I.cell)}},u.insert=function(t,e){var r=this.vertices;r.push(t);var n=this.walk(t,e);if(n){for(var i=this.dimension,a=this.tuple,o=0;o<=i;++o){var s=n.vertices[o];a[o]=s<0?t:r[s]}var l=this.orient(a);l<0||(0!==l||(n=this.handleBoundaryDegeneracy(n,t)))&&this.addPeaks(t,n)}},u.boundary=function(){for(var t=this.dimension,e=[],r=this.simplices,n=r.length,i=0;i<n;++i){var a=r[i];if(a.boundary){for(var o=new Array(t),s=a.vertices,l=0,c=0,u=0;u<=t;++u)s[u]>=0?o[l++]=s[u]:c=1&u;if(c===(1&t)){var h=o[0];o[0]=o[1],o[1]=h}e.push(o)}}return e}},{"robust-orientation":519,"simplicial-complex":530}],294:[function(t,e,r){"use strict";function n(t,e,r,n,i){this.mid=t,this.left=e,this.right=r,this.leftPoints=n,this.rightPoints=i,this.count=(e?e.count:0)+(r?r.count:0)+n.length}function i(t,e){t.mid=e.mid,t.left=e.left,t.right=e.right,t.leftPoints=e.leftPoints,t.rightPoints=e.rightPoints,t.count=e.count}function a(t,e){var r=p(e);t.mid=r.mid,t.left=r.left,t.right=r.right,t.leftPoints=r.leftPoints,t.rightPoints=r.rightPoints,t.count=r.count}function o(t,e){var r=t.intervals([]);r.push(e),a(t,r)}function s(t,e){var r=t.intervals([]),n=r.indexOf(e);return n<0?v:(r.splice(n,1),a(t,r),y)}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 c(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 u(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||t[1]-e[1]}function d(t,e){var r=t[1]-e[1];return 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],a=[],o=[],s=[],r=0;r<t.length;++r){var l=t[r];l[1]<i?a.push(l):i<l[0]?o.push(l):s.push(l)}var c=s,u=s.slice();return c.sort(f),u.sort(d),new n(i,p(a),p(o),c,u)}function m(t){this.root=t}var g=t("binary-search-bounds"),v=0,y=1;e.exports=function(t){return new m(t&&0!==t.length?p(t):null)};var b=n.prototype;b.intervals=function(t){return t.push.apply(t,this.leftPoints),this.left&&this.left.intervals(t),this.right&&this.right.intervals(t),t},b.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)?o(this,t):this.left.insert(t):this.left=p([t]);else if(t[0]>this.mid)this.right?4*(this.right.count+1)>3*(e+1)?o(this,t):this.right.insert(t):this.right=p([t]);else{var r=g.ge(this.leftPoints,t,f),n=g.ge(this.rightPoints,t,d);this.leftPoints.splice(r,0,t),this.rightPoints.splice(n,0,t)}},b.remove=function(t){var e=this.count-this.leftPoints;if(t[1]<this.mid){if(!this.left)return v;if(4*(this.right?this.right.count:0)>3*(e-1))return s(this,t);return 2===(o=this.left.remove(t))?(this.left=null,this.count-=1,y):(o===y&&(this.count-=1),o)}if(t[0]>this.mid){if(!this.right)return v;if(4*(this.left?this.left.count:0)>3*(e-1))return s(this,t);return 2===(o=this.right.remove(t))?(this.right=null,this.count-=1,y):(o===y&&(this.count-=1),o)}if(1===this.count)return this.leftPoints[0]===t?2:v;if(1===this.leftPoints.length&&this.leftPoints[0]===t){if(this.left&&this.right){for(var r=this,n=this.left;n.right;)r=n,n=n.right;if(r===this)n.right=this.right;else{var a=this.left,o=this.right;r.count-=n.count,r.right=n.left,n.left=a,n.right=o}i(this,n),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 y}for(a=g.ge(this.leftPoints,t,f);a<this.leftPoints.length&&this.leftPoints[a][0]===t[0];++a)if(this.leftPoints[a]===t){this.count-=1,this.leftPoints.splice(a,1);for(o=g.ge(this.rightPoints,t,d);o<this.rightPoints.length&&this.rightPoints[o][1]===t[1];++o)if(this.rightPoints[o]===t)return this.rightPoints.splice(o,1),y}return v},b.queryPoint=function(t,e){if(t<this.mid){if(this.left){if(r=this.left.queryPoint(t,e))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 c(this.rightPoints,t,e)}return u(this.leftPoints,e)},b.queryInterval=function(t,e,r){if(t<this.mid&&this.left){if(n=this.left.queryInterval(t,e,r))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?c(this.rightPoints,t,r):u(this.leftPoints,r)};var x=m.prototype;x.insert=function(t){this.root?this.root.insert(t):this.root=new n(t[0],null,null,[t],[t])},x.remove=function(t){if(this.root){var e=this.root.remove(t);return 2===e&&(this.root=null),e!==v}return!1},x.queryPoint=function(t,e){if(this.root)return this.root.queryPoint(t,e)},x.queryInterval=function(t,e,r){if(t<=e&&this.root)return this.root.queryInterval(t,e,r)},Object.defineProperty(x,"count",{get:function(){return this.root?this.root.count:0}}),Object.defineProperty(x,"intervals",{get:function(){return this.root?this.root.intervals([]):[]}})},{"binary-search-bounds":69}],295:[function(t,e,r){"use strict";e.exports=function(t,e){e=e||new Array(t.length);for(var r=0;r<t.length;++r)e[t[r]]=r;return e}},{}],296:[function(t,e,r){"use strict";e.exports=function(t){for(var e=new Array(t),r=0;r<t;++r)e[r]=r;return e}},{}],297:[function(t,e,r){e.exports=!0},{}],298:[function(t,e,r){function n(t){return!!t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)}e.exports=function(t){return null!=t&&(n(t)||function(t){return"function"==typeof t.readFloatLE&&"function"==typeof t.slice&&n(t.slice(0,0))}(t)||!!t._isBuffer)}},{}],299:[function(t,e,r){e.exports=function(t){return t||"undefined"==typeof navigator||(t=navigator.userAgent),t&&t.headers&&"string"==typeof t.headers["user-agent"]&&(t=t.headers["user-agent"]),"string"==typeof t&&(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(t)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(t.substr(0,4)))}},{}],300:[function(t,e,r){"use strict";var n=Object.prototype.toString;e.exports=function(t){var e;return"[object Object]"===n.call(t)&&(null===(e=Object.getPrototypeOf(t))||e===Object.getPrototypeOf({}))}},{}],301:[function(t,e,r){"use strict";function n(t,e,r,n,a){e=e||function(t){return t[0]},r=r||function(t){return t[1]},a=a||Array,this.nodeSize=n||64,this.points=t,this.ids=new a(t.length),this.coords=new a(2*t.length);for(var o=0;o<t.length;o++)this.ids[o]=o,this.coords[2*o]=e(t[o]),this.coords[2*o+1]=r(t[o]);i(this.ids,this.coords,this.nodeSize,0,this.ids.length-1,0)}var i=t("./sort"),a=t("./range"),o=t("./within");e.exports=function(t,e,r,i,a){return new n(t,e,r,i,a)},n.prototype={range:function(t,e,r,n){return a(this.ids,this.coords,t,e,r,n,this.nodeSize)},within:function(t,e,r){return o(this.ids,this.coords,t,e,r,this.nodeSize)}}},{"./range":302,"./sort":303,"./within":304}],302:[function(t,e,r){"use strict";e.exports=function(t,e,r,n,i,a,o){for(var s,l,c=[0,t.length-1,0],u=[];c.length;){var h=c.pop(),f=c.pop(),d=c.pop();if(f-d<=o)for(var p=d;p<=f;p++)s=e[2*p],l=e[2*p+1],s>=r&&s<=i&&l>=n&&l<=a&&u.push(t[p]);else{var m=Math.floor((d+f)/2);s=e[2*m],l=e[2*m+1],s>=r&&s<=i&&l>=n&&l<=a&&u.push(t[m]);var g=(h+1)%2;(0===h?r<=s:n<=l)&&(c.push(d),c.push(m-1),c.push(g)),(0===h?i>=s:a>=l)&&(c.push(m+1),c.push(f),c.push(g))}}return u}},{}],303:[function(t,e,r){"use strict";function n(t,e,r,a,o,s){if(!(o-a<=r)){var l=Math.floor((a+o)/2);i(t,e,l,a,o,s%2),n(t,e,r,a,l-1,s+1),n(t,e,r,l+1,o,s+1)}}function i(t,e,r,n,o,s){for(;o>n;){if(o-n>600){var l=o-n+1,c=r-n+1,u=Math.log(l),h=.5*Math.exp(2*u/3),f=.5*Math.sqrt(u*h*(l-h)/l)*(c-l/2<0?-1:1);i(t,e,r,Math.max(n,Math.floor(r-c*h/l+f)),Math.min(o,Math.floor(r+(l-c)*h/l+f)),s)}var d=e[2*r+s],p=n,m=o;for(a(t,e,n,r),e[2*o+s]>d&&a(t,e,n,o);p<m;){for(a(t,e,p,m),p++,m--;e[2*p+s]<d;)p++;for(;e[2*m+s]>d;)m--}e[2*n+s]===d?a(t,e,n,m):a(t,e,++m,o),m<=r&&(n=m+1),r<=m&&(o=m-1)}}function a(t,e,r,n){o(t,r,n),o(e,2*r,2*n),o(e,2*r+1,2*n+1)}function o(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}e.exports=n},{}],304:[function(t,e,r){"use strict";function n(t,e,r,n){var i=t-r,a=e-n;return i*i+a*a}e.exports=function(t,e,r,i,a,o){for(var s=[0,t.length-1,0],l=[],c=a*a;s.length;){var u=s.pop(),h=s.pop(),f=s.pop();if(h-f<=o)for(var d=f;d<=h;d++)n(e[2*d],e[2*d+1],r,i)<=c&&l.push(t[d]);else{var p=Math.floor((f+h)/2),m=e[2*p],g=e[2*p+1];n(m,g,r,i)<=c&&l.push(t[p]);var v=(u+1)%2;(0===u?r-a<=m:i-a<=g)&&(s.push(f),s.push(p-1),s.push(v)),(0===u?r+a>=m:i+a>=g)&&(s.push(p+1),s.push(h),s.push(v))}}return l}},{}],305:[function(t,e,r){"use strict";function n(t,e){var r;if(u(t)){var l,c=t.stops&&"object"==typeof t.stops[0][0],h=c||void 0!==t.property,f=c||!h,d=t.type||e||"exponential";if("exponential"===d)l=o;else if("interval"===d)l=a;else if("categorical"===d)l=i;else{if("identity"!==d)throw new Error('Unknown function type "'+d+'"');l=s}if(c){for(var p={},m=[],g=0;g<t.stops.length;g++){var v=t.stops[g];void 0===p[v[0].zoom]&&(p[v[0].zoom]={zoom:v[0].zoom,type:t.type,property:t.property,stops:[]}),p[v[0].zoom].stops.push([v[0].value,v[1]])}for(var y in p)m.push([p[y].zoom,n(p[y])]);(r=function(e,r){return o({stops:m,base:t.base},e)(e,r)}).isFeatureConstant=!1,r.isZoomConstant=!1}else f?((r=function(e){return l(t,e)}).isFeatureConstant=!0,r.isZoomConstant=!1):((r=function(e,r){return l(t,r[t.property])}).isFeatureConstant=!1,r.isZoomConstant=!0)}else(r=function(){return t}).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 a(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 o(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]:l(e,r,t.stops[n-1][0],t.stops[n][0],t.stops[n-1][1],t.stops[n][1])}function s(t,e){return e}function l(t,e,r,n,i,a){return"function"==typeof i?function(){var o=i.apply(void 0,arguments),s=a.apply(void 0,arguments);return l(t,e,r,n,o,s)}:i.length?function(t,e,r,n,i,a){for(var o=[],s=0;s<i.length;s++)o[s]=c(t,e,r,n,i[s],a[s]);return o}(t,e,r,n,i,a):c(t,e,r,n,i,a)}function c(t,e,r,n,i,a){var o,s=n-r,l=t-r;return o=1===e?l/s:(Math.pow(e,l)-1)/(Math.pow(e,s)-1),i*(1-o)+a*o}function u(t){return"object"==typeof t&&(t.stops||"identity"===t.type)}e.exports.isFunctionDefinition=u,e.exports.interpolated=function(t){return n(t,"exponential")},e.exports["piecewise-constant"]=function(t){return n(t,"interval")}},{}],306:[function(t,e,r){t("path");e.exports={debug:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform lowp vec4 u_color;\n\nvoid main() {\n gl_FragColor = u_color;\n}\n",vertexSource:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nattribute vec2 a_pos;\n\nuniform mat4 u_matrix;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, step(32767.0, a_pos.x), 1);\n}\n"},fill:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\n#pragma mapbox: define lowp vec4 color\n#pragma mapbox: define lowp float opacity\n\nvoid main() {\n #pragma mapbox: initialize lowp vec4 color\n #pragma mapbox: initialize lowp float opacity\n\n gl_FragColor = color * opacity;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nattribute vec2 a_pos;\n\nuniform mat4 u_matrix;\n\n#pragma mapbox: define lowp vec4 color\n#pragma mapbox: define lowp float opacity\n\nvoid main() {\n #pragma mapbox: initialize lowp vec4 color\n #pragma mapbox: initialize lowp float opacity\n\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n}\n"},circle:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\n#pragma mapbox: define lowp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n\nvarying vec2 v_extrude;\nvarying lowp float v_antialiasblur;\n\nvoid main() {\n #pragma mapbox: initialize lowp vec4 color\n #pragma mapbox: initialize lowp float blur\n #pragma mapbox: initialize lowp float opacity\n\n float t = smoothstep(1.0 - max(blur, v_antialiasblur), 1.0, length(v_extrude));\n gl_FragColor = color * (1.0 - t) * opacity;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform mat4 u_matrix;\nuniform bool u_scale_with_map;\nuniform vec2 u_extrude_scale;\nuniform float u_devicepixelratio;\n\nattribute vec2 a_pos;\n\n#pragma mapbox: define lowp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n\nvarying vec2 v_extrude;\nvarying lowp float v_antialiasblur;\n\nvoid main(void) {\n #pragma mapbox: initialize lowp vec4 color\n #pragma mapbox: initialize mediump float radius\n #pragma mapbox: initialize lowp float blur\n #pragma mapbox: initialize lowp float opacity\n\n // unencode the extrusion vector that we snuck into the a_pos vector\n v_extrude = vec2(mod(a_pos, 2.0) * 2.0 - 1.0);\n\n vec2 extrude = v_extrude * radius * u_extrude_scale;\n // multiply a_pos by 0.5, since we had it * 2 in order to sneak\n // in extrusion data\n gl_Position = u_matrix * vec4(floor(a_pos * 0.5), 0, 1);\n\n if (u_scale_with_map) {\n gl_Position.xy += extrude;\n } else {\n gl_Position.xy += extrude * gl_Position.w;\n }\n\n // This is a minimum blur distance that serves as a faux-antialiasing for\n // the circle. since blur is a ratio of the circle's size and the intent is\n // to keep the blur at roughly 1px, the two are inversely related.\n v_antialiasblur = 1.0 / u_devicepixelratio / radius;\n}\n"},line:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform lowp vec4 u_color;\nuniform lowp float u_opacity;\nuniform float u_blur;\n\nvarying vec2 v_linewidth;\nvarying vec2 v_normal;\nvarying float v_gamma_scale;\n\nvoid main() {\n // Calculate the distance of the pixel from the line in pixels.\n float dist = length(v_normal) * v_linewidth.s;\n\n // Calculate the antialiasing fade factor. This is either when fading in\n // the line in case of an offset line (v_linewidth.t) or when fading out\n // (v_linewidth.s)\n float blur = u_blur * v_gamma_scale;\n float alpha = clamp(min(dist - (v_linewidth.t - blur), v_linewidth.s - dist) / blur, 0.0, 1.0);\n\n gl_FragColor = u_color * (alpha * u_opacity);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\n// floor(127 / 2) == 63.0\n// the maximum allowed miter limit is 2.0 at the moment. the extrude normal is\n// stored in a byte (-128..127). we scale regular normals up to length 63, but\n// there are also \"special\" normals that have a bigger length (of up to 126 in\n// this case).\n// #define scale 63.0\n#define scale 0.015873016\n\nattribute vec2 a_pos;\nattribute vec4 a_data;\n\nuniform mat4 u_matrix;\nuniform mediump float u_ratio;\nuniform mediump float u_linewidth;\nuniform mediump float u_gapwidth;\nuniform mediump float u_antialiasing;\nuniform mediump float u_extra;\nuniform mat2 u_antialiasingmatrix;\nuniform mediump float u_offset;\nuniform mediump float u_blur;\n\nvarying vec2 v_normal;\nvarying vec2 v_linewidth;\nvarying float v_gamma_scale;\n\nvoid main() {\n vec2 a_extrude = a_data.xy - 128.0;\n float a_direction = mod(a_data.z, 4.0) - 1.0;\n\n // We store the texture normals in the most insignificant bit\n // transform y so that 0 => -1 and 1 => 1\n // In the texture normal, x is 0 if the normal points straight up/down and 1 if it's a round cap\n // y is 1 if the normal points up, and -1 if it points down\n mediump vec2 normal = mod(a_pos, 2.0);\n normal.y = sign(normal.y - 0.5);\n v_normal = normal;\n\n float inset = u_gapwidth + (u_gapwidth > 0.0 ? u_antialiasing : 0.0);\n float outset = u_gapwidth + u_linewidth * (u_gapwidth > 0.0 ? 2.0 : 1.0) + u_antialiasing;\n\n // Scale the extrusion vector down to a normal and then up by the line width\n // of this vertex.\n mediump vec2 dist = outset * a_extrude * scale;\n\n // Calculate the offset when drawing a line that is to the side of the actual line.\n // We do this by creating a vector that points towards the extrude, but rotate\n // it when we're drawing round end points (a_direction = -1 or 1) since their\n // extrude vector points in another direction.\n mediump float u = 0.5 * a_direction;\n mediump float t = 1.0 - abs(u);\n mediump vec2 offset = u_offset * a_extrude * scale * normal.y * mat2(t, -u, u, t);\n\n // Remove the texture normal bit of the position before scaling it with the\n // model/view matrix.\n gl_Position = u_matrix * vec4(floor(a_pos * 0.5) + (offset + dist) / u_ratio, 0.0, 1.0);\n\n // position of y on the screen\n float y = gl_Position.y / gl_Position.w;\n\n // how much features are squished in the y direction by the tilt\n float squish_scale = length(a_extrude) / length(u_antialiasingmatrix * a_extrude);\n\n // how much features are squished in all directions by the perspectiveness\n float perspective_scale = 1.0 / (1.0 - min(y * u_extra, 0.9));\n\n v_linewidth = vec2(outset, inset);\n v_gamma_scale = perspective_scale * squish_scale;\n}\n"},linepattern:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform float u_blur;\n\nuniform vec2 u_pattern_size_a;\nuniform vec2 u_pattern_size_b;\nuniform vec2 u_pattern_tl_a;\nuniform vec2 u_pattern_br_a;\nuniform vec2 u_pattern_tl_b;\nuniform vec2 u_pattern_br_b;\nuniform float u_fade;\nuniform float u_opacity;\n\nuniform sampler2D u_image;\n\nvarying vec2 v_normal;\nvarying vec2 v_linewidth;\nvarying float v_linesofar;\nvarying float v_gamma_scale;\n\nvoid main() {\n // Calculate the distance of the pixel from the line in pixels.\n float dist = length(v_normal) * v_linewidth.s;\n\n // Calculate the antialiasing fade factor. This is either when fading in\n // the line in case of an offset line (v_linewidth.t) or when fading out\n // (v_linewidth.s)\n float blur = u_blur * v_gamma_scale;\n float alpha = clamp(min(dist - (v_linewidth.t - blur), v_linewidth.s - dist) / blur, 0.0, 1.0);\n\n float x_a = mod(v_linesofar / u_pattern_size_a.x, 1.0);\n float x_b = mod(v_linesofar / u_pattern_size_b.x, 1.0);\n float y_a = 0.5 + (v_normal.y * v_linewidth.s / u_pattern_size_a.y);\n float y_b = 0.5 + (v_normal.y * v_linewidth.s / u_pattern_size_b.y);\n vec2 pos_a = mix(u_pattern_tl_a, u_pattern_br_a, vec2(x_a, y_a));\n vec2 pos_b = mix(u_pattern_tl_b, u_pattern_br_b, vec2(x_b, y_b));\n\n vec4 color = mix(texture2D(u_image, pos_a), texture2D(u_image, pos_b), u_fade);\n\n alpha *= u_opacity;\n\n gl_FragColor = color * alpha;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\n// floor(127 / 2) == 63.0\n// the maximum allowed miter limit is 2.0 at the moment. the extrude normal is\n// stored in a byte (-128..127). we scale regular normals up to length 63, but\n// there are also \"special\" normals that have a bigger length (of up to 126 in\n// this case).\n// #define scale 63.0\n#define scale 0.015873016\n\n// We scale the distance before adding it to the buffers so that we can store\n// long distances for long segments. Use this value to unscale the distance.\n#define LINE_DISTANCE_SCALE 2.0\n\nattribute vec2 a_pos;\nattribute vec4 a_data;\n\nuniform mat4 u_matrix;\nuniform mediump float u_ratio;\nuniform mediump float u_linewidth;\nuniform mediump float u_gapwidth;\nuniform mediump float u_antialiasing;\nuniform mediump float u_extra;\nuniform mat2 u_antialiasingmatrix;\nuniform mediump float u_offset;\n\nvarying vec2 v_normal;\nvarying vec2 v_linewidth;\nvarying float v_linesofar;\nvarying float v_gamma_scale;\n\nvoid main() {\n vec2 a_extrude = a_data.xy - 128.0;\n float a_direction = mod(a_data.z, 4.0) - 1.0;\n float a_linesofar = (floor(a_data.z / 4.0) + a_data.w * 64.0) * LINE_DISTANCE_SCALE;\n\n // We store the texture normals in the most insignificant bit\n // transform y so that 0 => -1 and 1 => 1\n // In the texture normal, x is 0 if the normal points straight up/down and 1 if it's a round cap\n // y is 1 if the normal points up, and -1 if it points down\n mediump vec2 normal = mod(a_pos, 2.0);\n normal.y = sign(normal.y - 0.5);\n v_normal = normal;\n\n float inset = u_gapwidth + (u_gapwidth > 0.0 ? u_antialiasing : 0.0);\n float outset = u_gapwidth + u_linewidth * (u_gapwidth > 0.0 ? 2.0 : 1.0) + u_antialiasing;\n\n // Scale the extrusion vector down to a normal and then up by the line width\n // of this vertex.\n mediump vec2 dist = outset * a_extrude * scale;\n\n // Calculate the offset when drawing a line that is to the side of the actual line.\n // We do this by creating a vector that points towards the extrude, but rotate\n // it when we're drawing round end points (a_direction = -1 or 1) since their\n // extrude vector points in another direction.\n mediump float u = 0.5 * a_direction;\n mediump float t = 1.0 - abs(u);\n mediump vec2 offset = u_offset * a_extrude * scale * normal.y * mat2(t, -u, u, t);\n\n // Remove the texture normal bit of the position before scaling it with the\n // model/view matrix.\n gl_Position = u_matrix * vec4(floor(a_pos * 0.5) + (offset + dist) / u_ratio, 0.0, 1.0);\n v_linesofar = a_linesofar;\n\n // position of y on the screen\n float y = gl_Position.y / gl_Position.w;\n\n // how much features are squished in the y direction by the tilt\n float squish_scale = length(a_extrude) / length(u_antialiasingmatrix * a_extrude);\n\n // how much features are squished in all directions by the perspectiveness\n float perspective_scale = 1.0 / (1.0 - min(y * u_extra, 0.9));\n\n v_linewidth = vec2(outset, inset);\n v_gamma_scale = perspective_scale * squish_scale;\n}\n"},linesdfpattern:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform lowp vec4 u_color;\nuniform lowp float u_opacity;\n\nuniform float u_blur;\nuniform sampler2D u_image;\nuniform float u_sdfgamma;\nuniform float u_mix;\n\nvarying vec2 v_normal;\nvarying vec2 v_linewidth;\nvarying vec2 v_tex_a;\nvarying vec2 v_tex_b;\nvarying float v_gamma_scale;\n\nvoid main() {\n // Calculate the distance of the pixel from the line in pixels.\n float dist = length(v_normal) * v_linewidth.s;\n\n // Calculate the antialiasing fade factor. This is either when fading in\n // the line in case of an offset line (v_linewidth.t) or when fading out\n // (v_linewidth.s)\n float blur = u_blur * v_gamma_scale;\n float alpha = clamp(min(dist - (v_linewidth.t - blur), v_linewidth.s - dist) / blur, 0.0, 1.0);\n\n float sdfdist_a = texture2D(u_image, v_tex_a).a;\n float sdfdist_b = texture2D(u_image, v_tex_b).a;\n float sdfdist = mix(sdfdist_a, sdfdist_b, u_mix);\n alpha *= smoothstep(0.5 - u_sdfgamma, 0.5 + u_sdfgamma, sdfdist);\n\n gl_FragColor = u_color * (alpha * u_opacity);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\n// floor(127 / 2) == 63.0\n// the maximum allowed miter limit is 2.0 at the moment. the extrude normal is\n// stored in a byte (-128..127). we scale regular normals up to length 63, but\n// there are also \"special\" normals that have a bigger length (of up to 126 in\n// this case).\n// #define scale 63.0\n#define scale 0.015873016\n\n// We scale the distance before adding it to the buffers so that we can store\n// long distances for long segments. Use this value to unscale the distance.\n#define LINE_DISTANCE_SCALE 2.0\n\nattribute vec2 a_pos;\nattribute vec4 a_data;\n\nuniform mat4 u_matrix;\nuniform mediump float u_ratio;\nuniform mediump float u_linewidth;\nuniform mediump float u_gapwidth;\nuniform mediump float u_antialiasing;\nuniform vec2 u_patternscale_a;\nuniform float u_tex_y_a;\nuniform vec2 u_patternscale_b;\nuniform float u_tex_y_b;\nuniform float u_extra;\nuniform mat2 u_antialiasingmatrix;\nuniform mediump float u_offset;\n\nvarying vec2 v_normal;\nvarying vec2 v_linewidth;\nvarying vec2 v_tex_a;\nvarying vec2 v_tex_b;\nvarying float v_gamma_scale;\n\nvoid main() {\n vec2 a_extrude = a_data.xy - 128.0;\n float a_direction = mod(a_data.z, 4.0) - 1.0;\n float a_linesofar = (floor(a_data.z / 4.0) + a_data.w * 64.0) * LINE_DISTANCE_SCALE;\n\n // We store the texture normals in the most insignificant bit\n // transform y so that 0 => -1 and 1 => 1\n // In the texture normal, x is 0 if the normal points straight up/down and 1 if it's a round cap\n // y is 1 if the normal points up, and -1 if it points down\n mediump vec2 normal = mod(a_pos, 2.0);\n normal.y = sign(normal.y - 0.5);\n v_normal = normal;\n\n float inset = u_gapwidth + (u_gapwidth > 0.0 ? u_antialiasing : 0.0);\n float outset = u_gapwidth + u_linewidth * (u_gapwidth > 0.0 ? 2.0 : 1.0) + u_antialiasing;\n\n // Scale the extrusion vector down to a normal and then up by the line width\n // of this vertex.\n mediump vec2 dist = outset * a_extrude * scale;\n\n // Calculate the offset when drawing a line that is to the side of the actual line.\n // We do this by creating a vector that points towards the extrude, but rotate\n // it when we're drawing round end points (a_direction = -1 or 1) since their\n // extrude vector points in another direction.\n mediump float u = 0.5 * a_direction;\n mediump float t = 1.0 - abs(u);\n mediump vec2 offset = u_offset * a_extrude * scale * normal.y * mat2(t, -u, u, t);\n\n // Remove the texture normal bit of the position before scaling it with the\n // model/view matrix.\n gl_Position = u_matrix * vec4(floor(a_pos * 0.5) + (offset + dist) / u_ratio, 0.0, 1.0);\n\n v_tex_a = vec2(a_linesofar * u_patternscale_a.x, normal.y * u_patternscale_a.y + u_tex_y_a);\n v_tex_b = vec2(a_linesofar * u_patternscale_b.x, normal.y * u_patternscale_b.y + u_tex_y_b);\n\n // position of y on the screen\n float y = gl_Position.y / gl_Position.w;\n\n // how much features are squished in the y direction by the tilt\n float squish_scale = length(a_extrude) / length(u_antialiasingmatrix * a_extrude);\n\n // how much features are squished in all directions by the perspectiveness\n float perspective_scale = 1.0 / (1.0 - min(y * u_extra, 0.9));\n\n v_linewidth = vec2(outset, inset);\n v_gamma_scale = perspective_scale * squish_scale;\n}\n"},outline:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\n#pragma mapbox: define lowp vec4 outline_color\n#pragma mapbox: define lowp float opacity\n\nvarying vec2 v_pos;\n\nvoid main() {\n #pragma mapbox: initialize lowp vec4 outline_color\n #pragma mapbox: initialize lowp float opacity\n\n float dist = length(v_pos - gl_FragCoord.xy);\n float alpha = smoothstep(1.0, 0.0, dist);\n gl_FragColor = outline_color * (alpha * opacity);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nattribute vec2 a_pos;\n\nuniform mat4 u_matrix;\nuniform vec2 u_world;\n\nvarying vec2 v_pos;\n\n#pragma mapbox: define lowp vec4 outline_color\n#pragma mapbox: define lowp float opacity\n\nvoid main() {\n #pragma mapbox: initialize lowp vec4 outline_color\n #pragma mapbox: initialize lowp float opacity\n\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n v_pos = (gl_Position.xy / gl_Position.w + 1.0) / 2.0 * u_world;\n}\n"},outlinepattern:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform float u_opacity;\nuniform vec2 u_pattern_tl_a;\nuniform vec2 u_pattern_br_a;\nuniform vec2 u_pattern_tl_b;\nuniform vec2 u_pattern_br_b;\nuniform float u_mix;\n\nuniform sampler2D u_image;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\nvarying vec2 v_pos;\n\nvoid main() {\n vec2 imagecoord = mod(v_pos_a, 1.0);\n vec2 pos = mix(u_pattern_tl_a, u_pattern_br_a, imagecoord);\n vec4 color1 = texture2D(u_image, pos);\n\n vec2 imagecoord_b = mod(v_pos_b, 1.0);\n vec2 pos2 = mix(u_pattern_tl_b, u_pattern_br_b, imagecoord_b);\n vec4 color2 = texture2D(u_image, pos2);\n\n // find distance to outline for alpha interpolation\n\n float dist = length(v_pos - gl_FragCoord.xy);\n float alpha = smoothstep(1.0, 0.0, dist);\n \n\n gl_FragColor = mix(color1, color2, u_mix) * alpha * u_opacity;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform vec2 u_pattern_size_a;\nuniform vec2 u_pattern_size_b;\nuniform vec2 u_pixel_coord_upper;\nuniform vec2 u_pixel_coord_lower;\nuniform float u_scale_a;\nuniform float u_scale_b;\nuniform float u_tile_units_to_pixels;\n\nattribute vec2 a_pos;\n\nuniform mat4 u_matrix;\nuniform vec2 u_world;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\nvarying vec2 v_pos;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n vec2 scaled_size_a = u_scale_a * u_pattern_size_a;\n vec2 scaled_size_b = u_scale_b * u_pattern_size_b;\n\n // the correct offset needs to be calculated.\n //\n // The offset depends on how many pixels are between the world origin and\n // the edge of the tile:\n // vec2 offset = mod(pixel_coord, size)\n //\n // At high zoom levels there are a ton of pixels between the world origin\n // and the edge of the tile. The glsl spec only guarantees 16 bits of\n // precision for highp floats. We need more than that.\n //\n // The pixel_coord is passed in as two 16 bit values:\n // pixel_coord_upper = floor(pixel_coord / 2^16)\n // pixel_coord_lower = mod(pixel_coord, 2^16)\n //\n // The offset is calculated in a series of steps that should preserve this precision:\n vec2 offset_a = mod(mod(mod(u_pixel_coord_upper, scaled_size_a) * 256.0, scaled_size_a) * 256.0 + u_pixel_coord_lower, scaled_size_a);\n vec2 offset_b = mod(mod(mod(u_pixel_coord_upper, scaled_size_b) * 256.0, scaled_size_b) * 256.0 + u_pixel_coord_lower, scaled_size_b);\n\n v_pos_a = (u_tile_units_to_pixels * a_pos + offset_a) / scaled_size_a;\n v_pos_b = (u_tile_units_to_pixels * a_pos + offset_b) / scaled_size_b;\n\n v_pos = (gl_Position.xy / gl_Position.w + 1.0) / 2.0 * u_world;\n}\n"},pattern:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform float u_opacity;\nuniform vec2 u_pattern_tl_a;\nuniform vec2 u_pattern_br_a;\nuniform vec2 u_pattern_tl_b;\nuniform vec2 u_pattern_br_b;\nuniform float u_mix;\n\nuniform sampler2D u_image;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\n\nvoid main() {\n\n vec2 imagecoord = mod(v_pos_a, 1.0);\n vec2 pos = mix(u_pattern_tl_a, u_pattern_br_a, imagecoord);\n vec4 color1 = texture2D(u_image, pos);\n\n vec2 imagecoord_b = mod(v_pos_b, 1.0);\n vec2 pos2 = mix(u_pattern_tl_b, u_pattern_br_b, imagecoord_b);\n vec4 color2 = texture2D(u_image, pos2);\n\n gl_FragColor = mix(color1, color2, u_mix) * u_opacity;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform mat4 u_matrix;\nuniform vec2 u_pattern_size_a;\nuniform vec2 u_pattern_size_b;\nuniform vec2 u_pixel_coord_upper;\nuniform vec2 u_pixel_coord_lower;\nuniform float u_scale_a;\nuniform float u_scale_b;\nuniform float u_tile_units_to_pixels;\n\nattribute vec2 a_pos;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n vec2 scaled_size_a = u_scale_a * u_pattern_size_a;\n vec2 scaled_size_b = u_scale_b * u_pattern_size_b;\n\n // the correct offset needs to be calculated.\n //\n // The offset depends on how many pixels are between the world origin and\n // the edge of the tile:\n // vec2 offset = mod(pixel_coord, size)\n //\n // At high zoom levels there are a ton of pixels between the world origin\n // and the edge of the tile. The glsl spec only guarantees 16 bits of\n // precision for highp floats. We need more than that.\n //\n // The pixel_coord is passed in as two 16 bit values:\n // pixel_coord_upper = floor(pixel_coord / 2^16)\n // pixel_coord_lower = mod(pixel_coord, 2^16)\n //\n // The offset is calculated in a series of steps that should preserve this precision:\n vec2 offset_a = mod(mod(mod(u_pixel_coord_upper, scaled_size_a) * 256.0, scaled_size_a) * 256.0 + u_pixel_coord_lower, scaled_size_a);\n vec2 offset_b = mod(mod(mod(u_pixel_coord_upper, scaled_size_b) * 256.0, scaled_size_b) * 256.0 + u_pixel_coord_lower, scaled_size_b);\n\n v_pos_a = (u_tile_units_to_pixels * a_pos + offset_a) / scaled_size_a;\n v_pos_b = (u_tile_units_to_pixels * a_pos + offset_b) / scaled_size_b;\n}\n"},raster:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform float u_opacity0;\nuniform float u_opacity1;\nuniform sampler2D u_image0;\nuniform sampler2D u_image1;\nvarying vec2 v_pos0;\nvarying vec2 v_pos1;\n\nuniform float u_brightness_low;\nuniform float u_brightness_high;\n\nuniform float u_saturation_factor;\nuniform float u_contrast_factor;\nuniform vec3 u_spin_weights;\n\nvoid main() {\n\n // read and cross-fade colors from the main and parent tiles\n vec4 color0 = texture2D(u_image0, v_pos0);\n vec4 color1 = texture2D(u_image1, v_pos1);\n vec4 color = color0 * u_opacity0 + color1 * u_opacity1;\n vec3 rgb = color.rgb;\n\n // spin\n rgb = vec3(\n dot(rgb, u_spin_weights.xyz),\n dot(rgb, u_spin_weights.zxy),\n dot(rgb, u_spin_weights.yzx));\n\n // saturation\n float average = (color.r + color.g + color.b) / 3.0;\n rgb += (average - rgb) * u_saturation_factor;\n\n // contrast\n rgb = (rgb - 0.5) * u_contrast_factor + 0.5;\n\n // brightness\n vec3 u_high_vec = vec3(u_brightness_low, u_brightness_low, u_brightness_low);\n vec3 u_low_vec = vec3(u_brightness_high, u_brightness_high, u_brightness_high);\n\n gl_FragColor = vec4(mix(u_high_vec, u_low_vec, rgb), color.a);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform mat4 u_matrix;\nuniform vec2 u_tl_parent;\nuniform float u_scale_parent;\nuniform float u_buffer_scale;\n\nattribute vec2 a_pos;\nattribute vec2 a_texture_pos;\n\nvarying vec2 v_pos0;\nvarying vec2 v_pos1;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n v_pos0 = (((a_texture_pos / 32767.0) - 0.5) / u_buffer_scale ) + 0.5;\n v_pos1 = (v_pos0 * u_scale_parent) + u_tl_parent;\n}\n"},icon:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform sampler2D u_texture;\nuniform sampler2D u_fadetexture;\nuniform lowp float u_opacity;\n\nvarying vec2 v_tex;\nvarying vec2 v_fade_tex;\n\nvoid main() {\n lowp float alpha = texture2D(u_fadetexture, v_fade_tex).a * u_opacity;\n gl_FragColor = texture2D(u_texture, v_tex) * alpha;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nattribute vec2 a_pos;\nattribute vec2 a_offset;\nattribute vec2 a_texture_pos;\nattribute vec4 a_data;\n\n\n// matrix is for the vertex position.\nuniform mat4 u_matrix;\n\nuniform mediump float u_zoom;\nuniform bool u_rotate_with_map;\nuniform vec2 u_extrude_scale;\n\nuniform vec2 u_texsize;\n\nvarying vec2 v_tex;\nvarying vec2 v_fade_tex;\n\nvoid main() {\n vec2 a_tex = a_texture_pos.xy;\n mediump float a_labelminzoom = a_data[0];\n mediump vec2 a_zoom = a_data.pq;\n mediump float a_minzoom = a_zoom[0];\n mediump float a_maxzoom = a_zoom[1];\n\n // u_zoom is the current zoom level adjusted for the change in font size\n mediump float z = 2.0 - step(a_minzoom, u_zoom) - (1.0 - step(a_maxzoom, u_zoom));\n\n vec2 extrude = u_extrude_scale * (a_offset / 64.0);\n if (u_rotate_with_map) {\n gl_Position = u_matrix * vec4(a_pos + extrude, 0, 1);\n gl_Position.z += z * gl_Position.w;\n } else {\n gl_Position = u_matrix * vec4(a_pos, 0, 1) + vec4(extrude, 0, 0);\n }\n\n v_tex = a_tex / u_texsize;\n v_fade_tex = vec2(a_labelminzoom / 255.0, 0.0);\n}\n"},sdf:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform sampler2D u_texture;\nuniform sampler2D u_fadetexture;\nuniform lowp vec4 u_color;\nuniform lowp float u_opacity;\nuniform lowp float u_buffer;\nuniform lowp float u_gamma;\n\nvarying vec2 v_tex;\nvarying vec2 v_fade_tex;\nvarying float v_gamma_scale;\n\nvoid main() {\n lowp float dist = texture2D(u_texture, v_tex).a;\n lowp float fade_alpha = texture2D(u_fadetexture, v_fade_tex).a;\n lowp float gamma = u_gamma * v_gamma_scale;\n lowp float alpha = smoothstep(u_buffer - gamma, u_buffer + gamma, dist) * fade_alpha;\n\n gl_FragColor = u_color * (alpha * u_opacity);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nconst float PI = 3.141592653589793;\n\nattribute vec2 a_pos;\nattribute vec2 a_offset;\nattribute vec2 a_texture_pos;\nattribute vec4 a_data;\n\n\n// matrix is for the vertex position.\nuniform mat4 u_matrix;\n\nuniform mediump float u_zoom;\nuniform bool u_rotate_with_map;\nuniform bool u_pitch_with_map;\nuniform mediump float u_pitch;\nuniform mediump float u_bearing;\nuniform mediump float u_aspect_ratio;\nuniform vec2 u_extrude_scale;\n\nuniform vec2 u_texsize;\n\nvarying vec2 v_tex;\nvarying vec2 v_fade_tex;\nvarying float v_gamma_scale;\n\nvoid main() {\n vec2 a_tex = a_texture_pos.xy;\n mediump float a_labelminzoom = a_data[0];\n mediump vec2 a_zoom = a_data.pq;\n mediump float a_minzoom = a_zoom[0];\n mediump float a_maxzoom = a_zoom[1];\n\n // u_zoom is the current zoom level adjusted for the change in font size\n mediump float z = 2.0 - step(a_minzoom, u_zoom) - (1.0 - step(a_maxzoom, u_zoom));\n\n // pitch-alignment: map\n // rotation-alignment: map | viewport\n if (u_pitch_with_map) {\n lowp float angle = u_rotate_with_map ? (a_data[1] / 256.0 * 2.0 * PI) : u_bearing;\n lowp float asin = sin(angle);\n lowp float acos = cos(angle);\n mat2 RotationMatrix = mat2(acos, asin, -1.0 * asin, acos);\n vec2 offset = RotationMatrix * a_offset;\n vec2 extrude = u_extrude_scale * (offset / 64.0);\n gl_Position = u_matrix * vec4(a_pos + extrude, 0, 1);\n gl_Position.z += z * gl_Position.w;\n // pitch-alignment: viewport\n // rotation-alignment: map\n } else if (u_rotate_with_map) {\n // foreshortening factor to apply on pitched maps\n // as a label goes from horizontal <=> vertical in angle\n // it goes from 0% foreshortening to up to around 70% foreshortening\n lowp float pitchfactor = 1.0 - cos(u_pitch * sin(u_pitch * 0.75));\n\n lowp float lineangle = a_data[1] / 256.0 * 2.0 * PI;\n\n // use the lineangle to position points a,b along the line\n // project the points and calculate the label angle in projected space\n // this calculation allows labels to be rendered unskewed on pitched maps\n vec4 a = u_matrix * vec4(a_pos, 0, 1);\n vec4 b = u_matrix * vec4(a_pos + vec2(cos(lineangle),sin(lineangle)), 0, 1);\n lowp float angle = atan((b[1]/b[3] - a[1]/a[3])/u_aspect_ratio, b[0]/b[3] - a[0]/a[3]);\n lowp float asin = sin(angle);\n lowp float acos = cos(angle);\n mat2 RotationMatrix = mat2(acos, -1.0 * asin, asin, acos);\n\n vec2 offset = RotationMatrix * (vec2((1.0-pitchfactor)+(pitchfactor*cos(angle*2.0)), 1.0) * a_offset);\n vec2 extrude = u_extrude_scale * (offset / 64.0);\n gl_Position = u_matrix * vec4(a_pos, 0, 1) + vec4(extrude, 0, 0);\n gl_Position.z += z * gl_Position.w;\n // pitch-alignment: viewport\n // rotation-alignment: viewport\n } else {\n vec2 extrude = u_extrude_scale * (a_offset / 64.0);\n gl_Position = u_matrix * vec4(a_pos, 0, 1) + vec4(extrude, 0, 0);\n }\n\n v_gamma_scale = (gl_Position.w - 0.5);\n\n v_tex = a_tex / u_texsize;\n v_fade_tex = vec2(a_labelminzoom / 255.0, 0.0);\n}\n"},collisionbox:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform float u_zoom;\nuniform float u_maxzoom;\n\nvarying float v_max_zoom;\nvarying float v_placement_zoom;\n\nvoid main() {\n\n float alpha = 0.5;\n\n gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0) * alpha;\n\n if (v_placement_zoom > u_zoom) {\n gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0) * alpha;\n }\n\n if (u_zoom >= v_max_zoom) {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0) * alpha * 0.25;\n }\n\n if (v_placement_zoom >= u_maxzoom) {\n gl_FragColor = vec4(0.0, 0.0, 1.0, 1.0) * alpha * 0.2;\n }\n}\n",vertexSource:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nattribute vec2 a_pos;\nattribute vec2 a_extrude;\nattribute vec2 a_data;\n\nuniform mat4 u_matrix;\nuniform float u_scale;\n\nvarying float v_max_zoom;\nvarying float v_placement_zoom;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos + a_extrude / u_scale, 0.0, 1.0);\n\n v_max_zoom = a_data.x;\n v_placement_zoom = a_data.y;\n}\n"}},e.exports.util="float evaluate_zoom_function_1(const vec4 values, const float t) {\n if (t < 1.0) {\n return mix(values[0], values[1], t);\n } else if (t < 2.0) {\n return mix(values[1], values[2], t - 1.0);\n } else {\n return mix(values[2], values[3], t - 2.0);\n }\n}\nvec4 evaluate_zoom_function_4(const vec4 value0, const vec4 value1, const vec4 value2, const vec4 value3, const float t) {\n if (t < 1.0) {\n return mix(value0, value1, t);\n } else if (t < 2.0) {\n return mix(value1, value2, t - 1.0);\n } else {\n return mix(value2, value3, t - 2.0);\n }\n}\n"},{path:479}],307:[function(t,e,r){"use strict";var n=t("util").format;e.exports=function(t,e){this.message=(t?t+": ":"")+n.apply(n,Array.prototype.slice.call(arguments,2)),null!==e&&void 0!==e&&e.__line__&&(this.line=e.__line__)}},{util:560}],308:[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}},{}],309:[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}},{}],310:[function(t,e,r){"use strict";e.exports=function(t){return t instanceof Number||t instanceof String||t instanceof Boolean?t.valueOf():t}},{}],311:[function(t,e,r){"use strict";var n=t("../error/validation_error"),i=t("../util/get_type"),a=t("../util/extend");e.exports=function(e){var r=t("./validate_function"),o=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,c=e.valueSpec,u=e.key,h=e.styleSpec,f=e.style;if("string"===i(l)&&"@"===l[0]){if(h.$version>7)return[new n(u,l,"constants have been deprecated as of v8")];if(!(l in f.constants))return[new n(u,l,'constant "%s" not found',l)];e=a({},e,{value:f.constants[l]})}return c.function&&"object"===i(l)?r(e):c.type&&s[c.type]?s[c.type](e):o(a({},e,{valueSpec:c.type?h[c.type]:c}))}},{"../error/validation_error":307,"../util/extend":308,"../util/get_type":309,"./validate_array":312,"./validate_boolean":313,"./validate_color":314,"./validate_constants":315,"./validate_enum":316,"./validate_filter":317,"./validate_function":318,"./validate_layer":320,"./validate_number":322,"./validate_object":323,"./validate_source":325,"./validate_string":326}],312:[function(t,e,r){"use strict";var n=t("../util/get_type"),i=t("./validate"),a=t("../error/validation_error");e.exports=function(t){var e=t.value,r=t.valueSpec,o=t.style,s=t.styleSpec,l=t.key,c=t.arrayElementValidator||i;if("array"!==n(e))return[new a(l,e,"array expected, %s found",n(e))];if(r.length&&e.length!==r.length)return[new a(l,e,"array length %d expected, length %d found",r.length,e.length)];if(r["min-length"]&&e.length<r["min-length"])return[new a(l,e,"array length at least %d expected, length %d found",r["min-length"],e.length)];var u={type:r.value};s.$version<7&&(u.function=r.function),"object"===n(r.value)&&(u=r.value);for(var h=[],f=0;f<e.length;f++)h=h.concat(c({array:e,arrayIndex:f,value:e[f],valueSpec:u,style:o,styleSpec:s,key:l+"["+f+"]"}));return h}},{"../error/validation_error":307,"../util/get_type":309,"./validate":311}],313:[function(t,e,r){"use strict";var n=t("../util/get_type"),i=t("../error/validation_error");e.exports=function(t){var e=t.value,r=t.key,a=n(e);return"boolean"!==a?[new i(r,e,"boolean expected, %s found",a)]:[]}},{"../error/validation_error":307,"../util/get_type":309}],314:[function(t,e,r){"use strict";var n=t("../error/validation_error"),i=t("../util/get_type"),a=t("csscolorparser").parseCSSColor;e.exports=function(t){var e=t.key,r=t.value,o=i(r);return"string"!==o?[new n(e,r,"color expected, %s found",o)]:null===a(r)?[new n(e,r,'color expected, "%s" found',r)]:[]}},{"../error/validation_error":307,"../util/get_type":309,csscolorparser:111}],315:[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;if(t.styleSpec.$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 o=[];for(var s in r)"@"!==s[0]&&o.push(new n(e+"."+s,r[s],'constants must start with "@"'));return o}},{"../error/validation_error":307,"../util/get_type":309}],316:[function(t,e,r){"use strict";var n=t("../error/validation_error"),i=t("../util/unbundle_jsonlint");e.exports=function(t){var e=t.key,r=t.value,a=t.valueSpec,o=[];return-1===a.values.indexOf(i(r))&&o.push(new n(e,r,"expected one of [%s], %s found",a.values.join(", "),r)),o}},{"../error/validation_error":307,"../util/unbundle_jsonlint":310}],317:[function(t,e,r){"use strict";var n=t("../error/validation_error"),i=t("./validate_enum"),a=t("../util/get_type"),o=t("../util/unbundle_jsonlint");e.exports=function t(e){var r,s=e.value,l=e.key,c=e.styleSpec,u=[];if("array"!==a(s))return[new n(l,s,"array expected, %s found",a(s))];if(s.length<1)return[new n(l,s,"filter array must have at least 1 element")];switch(u=u.concat(i({key:l+"[0]",value:s[0],valueSpec:c.filter_operator,style:e.style,styleSpec:e.styleSpec})),o(s[0])){case"<":case"<=":case">":case">=":s.length>=2&&"$type"==s[1]&&u.push(new n(l,s,'"$type" cannot be use with operator "%s"',s[0]));case"==":case"!=":3!=s.length&&u.push(new n(l,s,'filter array for operator "%s" must have 3 elements',s[0]));case"in":case"!in":s.length>=2&&("string"!==(r=a(s[1]))?u.push(new n(l+"[1]",s[1],"string expected, %s found",r)):"@"===s[1][0]&&u.push(new n(l+"[1]",s[1],"filter key cannot be a constant")));for(var h=2;h<s.length;h++)r=a(s[h]),"$type"==s[1]?u=u.concat(i({key:l+"["+h+"]",value:s[h],valueSpec:c.geometry_type,style:e.style,styleSpec:e.styleSpec})):"string"===r&&"@"===s[h][0]?u.push(new n(l+"["+h+"]",s[h],"filter value cannot be a constant")):"string"!==r&&"number"!==r&&"boolean"!==r&&u.push(new n(l+"["+h+"]",s[h],"string, number, or boolean expected, %s found",r));break;case"any":case"all":case"none":for(h=1;h<s.length;h++)u=u.concat(t({key:l+"["+h+"]",value:s[h],style:e.style,styleSpec:e.styleSpec}));break;case"has":case"!has":r=a(s[1]),2!==s.length?u.push(new n(l,s,'filter array for "%s" operator must have 2 elements',s[0])):"string"!==r?u.push(new n(l+"[1]",s[1],"string expected, %s found",r)):"@"===s[1][0]&&u.push(new n(l+"[1]",s[1],"filter key cannot be a constant"))}return u}},{"../error/validation_error":307,"../util/get_type":309,"../util/unbundle_jsonlint":310,"./validate_enum":316}],318:[function(t,e,r){"use strict";var n=t("../error/validation_error"),i=t("../util/get_type"),a=t("./validate"),o=t("./validate_object"),s=t("./validate_array"),l=t("./validate_number");e.exports=function(t){function e(t){var e=[],s=t.value,h=t.key;if("array"!==i(s))return[new n(h,s,"array expected, %s found",i(s))];if(2!==s.length)return[new n(h,s,"array length %d expected, length %d found",2,s.length)];var d=i(s[0]);if(c||(c=d),d!==c)return[new n(h,s,"%s stop key type must match previous stop key type %s",d,c)];if("object"===d){if(void 0===s[0].zoom)return[new n(h,s,"object stop key must have zoom")];if(void 0===s[0].value)return[new n(h,s,"object stop key must have value")];e=e.concat(o({key:h+"[0]",value:s[0],valueSpec:{zoom:{}},style:t.style,styleSpec:t.styleSpec,objectElementValidators:{zoom:l,value:r}}))}else e=e.concat((f?l:r)({key:h+"[0]",value:s[0],valueSpec:{},style:t.style,styleSpec:t.styleSpec}));return e=e.concat(a({key:h+"[1]",value:s[1],valueSpec:u,style:t.style,styleSpec:t.styleSpec})),"number"===i(s[0])&&("piecewise-constant"===u.function&&s[0]%1!=0&&e.push(new n(h+"[0]",s[0],"zoom level for piecewise-constant functions must be an integer")),0!==t.arrayIndex&&s[0]<t.array[t.arrayIndex-1][0]&&e.push(new n(h+"[0]",s[0],"array stops must appear in ascending order"))),e}function r(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,u=t.valueSpec,h=void 0!==t.value.property||"object"===c,f=void 0===t.value.property||"object"===c,d=o({key:t.key,value:t.value,valueSpec:t.styleSpec.function,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{stops:function(t){var r=[],a=t.value;return r=r.concat(s({key:t.key,value:a,valueSpec:t.valueSpec,style:t.style,styleSpec:t.styleSpec,arrayElementValidator:e})),"array"===i(a)&&0===a.length&&r.push(new n(t.key,a,"array must have at least one stop")),r}}});return t.styleSpec.$version>=8&&(h&&!t.valueSpec["property-function"]?d.push(new n(t.key,t.value,"property functions not supported")):f&&!t.valueSpec["zoom-function"]&&d.push(new n(t.key,t.value,"zoom functions not supported"))),d}},{"../error/validation_error":307,"../util/get_type":309,"./validate":311,"./validate_array":312,"./validate_number":322,"./validate_object":323}],319:[function(t,e,r){"use strict";var n=t("../error/validation_error"),i=t("./validate_string");e.exports=function(t){var e=t.value,r=t.key,a=i(t);return a.length?a:(-1===e.indexOf("{fontstack}")&&a.push(new n(r,e,'"glyphs" url must include a "{fontstack}" token')),-1===e.indexOf("{range}")&&a.push(new n(r,e,'"glyphs" url must include a "{range}" token')),a)}},{"../error/validation_error":307,"./validate_string":326}],320:[function(t,e,r){"use strict";var n=t("../error/validation_error"),i=t("../util/unbundle_jsonlint"),a=t("./validate_object"),o=t("./validate_filter"),s=t("./validate_paint_property"),l=t("./validate_layout_property"),c=t("../util/extend");e.exports=function(t){var e=[],r=t.value,u=t.key,h=t.style,f=t.styleSpec;r.type||r.ref||e.push(new n(u,r,'either "type" or "ref" is required'));var d=i(r.type),p=i(r.ref);if(r.id)for(var m=0;m<t.arrayIndex;m++){var g=h.layers[m];i(g.id)===i(r.id)&&e.push(new n(u,r.id,'duplicate layer id "%s", previously used at line %d',r.id,g.id.__line__))}if("ref"in r){["type","source","source-layer","filter","layout"].forEach(function(t){t in r&&e.push(new n(u,r[t],'"%s" is prohibited for ref layers',t))});var v;h.layers.forEach(function(t){t.id==p&&(v=t)}),v?v.ref?e.push(new n(u,r.ref,"ref cannot reference another ref layer")):d=i(v.type):e.push(new n(u,r.ref,'ref layer "%s" not found',p))}else if("background"!==d)if(r.source){var y=h.sources&&h.sources[r.source];y?"vector"==y.type&&"raster"==d?e.push(new n(u,r.source,'layer "%s" requires a raster source',r.id)):"raster"==y.type&&"raster"!=d?e.push(new n(u,r.source,'layer "%s" requires a vector source',r.id)):"vector"!=y.type||r["source-layer"]||e.push(new n(u,r,'layer "%s" must specify a "source-layer"',r.id)):e.push(new n(u,r.source,'source "%s" not found',r.source))}else e.push(new n(u,r,'missing required property "source"'));return e=e.concat(a({key:u,value:r,valueSpec:f.layer,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{filter:o,layout:function(t){return a({layer:r,key:t.key,value:t.value,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{"*":function(t){return l(c({layerType:d},t))}}})},paint:function(t){return a({layer:r,key:t.key,value:t.value,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{"*":function(t){return s(c({layerType:d},t))}}})}}}))}},{"../error/validation_error":307,"../util/extend":308,"../util/unbundle_jsonlint":310,"./validate_filter":317,"./validate_layout_property":321,"./validate_object":323,"./validate_paint_property":324}],321:[function(t,e,r){"use strict";var n=t("./validate"),i=t("../error/validation_error");e.exports=function(t){var e=t.key,r=t.style,a=t.styleSpec,o=t.value,s=t.objectKey,l=a["layout_"+t.layerType];if(t.valueSpec||l[s]){var c=[];return"symbol"===t.layerType&&("icon-image"===s&&r&&!r.sprite?c.push(new i(e,o,'use of "icon-image" requires a style "sprite" property')):"text-field"===s&&r&&!r.glyphs&&c.push(new i(e,o,'use of "text-field" requires a style "glyphs" property'))),c.concat(n({key:t.key,value:o,valueSpec:t.valueSpec||l[s],style:r,styleSpec:a}))}return[new i(e,o,'unknown property "%s"',s)]}},{"../error/validation_error":307,"./validate":311}],322:[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,a=t.valueSpec,o=n(r);return"number"!==o?[new i(e,r,"number expected, %s found",o)]:"minimum"in a&&r<a.minimum?[new i(e,r,"%s is less than the minimum value %s",r,a.minimum)]:"maximum"in a&&r>a.maximum?[new i(e,r,"%s is greater than the maximum value %s",r,a.maximum)]:[]}},{"../error/validation_error":307,"../util/get_type":309}],323:[function(t,e,r){"use strict";var n=t("../error/validation_error"),i=t("../util/get_type"),a=t("./validate");e.exports=function(t){var e=t.key,r=t.value,o=t.valueSpec,s=t.objectElementValidators||{},l=t.style,c=t.styleSpec,u=[],h=i(r);if("object"!==h)return[new n(e,r,"object expected, %s found",h)];for(var f in r){var d=f.split(".")[0],p=o&&(o[d]||o["*"]),m=s[d]||s["*"];p||m?u=u.concat((m||a)({key:(e?e+".":e)+f,value:r[f],valueSpec:p,style:l,styleSpec:c,object:r,objectKey:f})):""!==e&&1!==e.split(".").length&&u.push(new n(e,r[f],'unknown property "%s"',f))}for(d in o)o[d].required&&void 0===o[d].default&&void 0===r[d]&&u.push(new n(e,r,'missing required property "%s"',d));return u}},{"../error/validation_error":307,"../util/get_type":309,"./validate":311}],324:[function(t,e,r){"use strict";var n=t("./validate"),i=t("../error/validation_error");e.exports=function(t){var e=t.key,r=t.style,a=t.styleSpec,o=t.value,s=t.objectKey,l=a["paint_"+t.layerType],c=s.match(/^(.*)-transition$/);return c&&l[c[1]]&&l[c[1]].transition?n({key:e,value:o,valueSpec:a.transition,style:r,styleSpec:a}):t.valueSpec||l[s]?n({key:t.key,value:o,valueSpec:t.valueSpec||l[s],style:r,styleSpec:a}):[new i(e,o,'unknown property "%s"',s)]}},{"../error/validation_error":307,"./validate":311}],325:[function(t,e,r){"use strict";var n=t("../error/validation_error"),i=t("../util/unbundle_jsonlint"),a=t("./validate_object"),o=t("./validate_enum");e.exports=function(t){var e=t.value,r=t.key,s=t.styleSpec,l=t.style;if(!e.type)return[new n(r,e,'"type" is required')];switch(i(e.type)){case"vector":case"raster":var c=[];if(c=c.concat(a({key:r,value:e,valueSpec:s.source_tile,style:t.style,styleSpec:s})),"url"in e)for(var u in e)["type","url","tileSize"].indexOf(u)<0&&c.push(new n(r+"."+u,e[u],'a source with a "url" property may not include a "%s" property',u));return c;case"geojson":return a({key:r,value:e,valueSpec:s.source_geojson,style:l,styleSpec:s});case"video":return a({key:r,value:e,valueSpec:s.source_video,style:l,styleSpec:s});case"image":return a({key:r,value:e,valueSpec:s.source_image,style:l,styleSpec:s});default:return o({key:r+".type",value:e.type,valueSpec:{values:["vector","raster","geojson","video","image"]},style:l,styleSpec:s})}}},{"../error/validation_error":307,"../util/unbundle_jsonlint":310,"./validate_enum":316,"./validate_object":323}],326:[function(t,e,r){"use strict";var n=t("../util/get_type"),i=t("../error/validation_error");e.exports=function(t){var e=t.value,r=t.key,a=n(e);return"string"!==a?[new i(r,e,"string expected, %s found",a)]:[]}},{"../error/validation_error":307,"../util/get_type":309}],327:[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:c}})),e.$version>7&&t.constants&&(r=r.concat(o({key:"constants",value:t.constants,style:t,styleSpec:e}))),i(r)}function i(t){return[].concat(t).sort(function(t,e){return t.line-e.line})}function a(t){return function(){return i(t.apply(this,arguments))}}var o=t("./validate/validate_constants"),s=t("./validate/validate"),l=t("../reference/latest.min"),c=t("./validate/validate_glyphs_url");n.source=a(t("./validate/validate_source")),n.layer=a(t("./validate/validate_layer")),n.filter=a(t("./validate/validate_filter")),n.paintProperty=a(t("./validate/validate_paint_property")),n.layoutProperty=a(t("./validate/validate_layout_property")),e.exports=n},{"../reference/latest.min":328,"./validate/validate":311,"./validate/validate_constants":315,"./validate/validate_filter":317,"./validate/validate_glyphs_url":319,"./validate/validate_layer":320,"./validate/validate_layout_property":321,"./validate/validate_paint_property":324,"./validate/validate_source":325}],328:[function(t,e,r){e.exports=t("./v8.min.json")},{"./v8.min.json":329}],329:[function(t,e,r){e.exports={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},sources:{required:!0,type:"sources"},sprite:{type:"string"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_tile","source_geojson","source_video","source_image"],source_tile:{type:{required:!0,type:"enum",values:["vector","raster"]},url:{type:"string"},tiles:{type:"array",value:"string"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:["geojson"]},data:{type:"*"},maxzoom:{type:"number",default:14},buffer:{type:"number",default:64},tolerance:{type:"number",default:3},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:400},clusterMaxZoom:{type:"number"}},source_video:{type:{required:!0,type:"enum",values:["video"]},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:["image"]},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:["fill","line","symbol","circle","raster","background"]},metadata:{type:"*"},ref:{type:"string"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:22},maxzoom:{type:"number",minimum:0,maximum:22},interactive:{type:"boolean",default:!1},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"},"paint.*":{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_symbol","layout_raster","layout_background"],layout_background:{visibility:{type:"enum",function:"piecewise-constant","zoom-function":!0,values:["visible","none"],default:"visible"}},layout_fill:{visibility:{type:"enum",function:"piecewise-constant","zoom-function":!0,values:["visible","none"],default:"visible"}},layout_circle:{visibility:{type:"enum",function:"piecewise-constant","zoom-function":!0,values:["visible","none"],default:"visible"}},layout_line:{"line-cap":{type:"enum",function:"piecewise-constant","zoom-function":!0,"property-function":!0,values:["butt","round","square"],default:"butt"},"line-join":{type:"enum",function:"piecewise-constant","zoom-function":!0,"property-function":!0,values:["bevel","round","miter"],default:"miter"},"line-miter-limit":{type:"number",default:2,function:"interpolated","zoom-function":!0,"property-function":!0,requires:[{"line-join":"miter"}]},"line-round-limit":{type:"number",default:1.05,function:"interpolated","zoom-function":!0,"property-function":!0,requires:[{"line-join":"round"}]},visibility:{type:"enum",function:"piecewise-constant","zoom-function":!0,values:["visible","none"],default:"visible"}},layout_symbol:{"symbol-placement":{type:"enum",function:"piecewise-constant","zoom-function":!0,"property-function":!0,values:["point","line"],default:"point"},"symbol-spacing":{type:"number",default:250,minimum:1,function:"interpolated","zoom-function":!0,"property-function":!0,units:"pixels",requires:[{"symbol-placement":"line"}]},"symbol-avoid-edges":{type:"boolean",function:"piecewise-constant","zoom-function":!0,"property-function":!0,default:!1},"icon-allow-overlap":{type:"boolean",function:"piecewise-constant","zoom-function":!0,"property-function":!0,default:!1,requires:["icon-image"]},"icon-ignore-placement":{type:"boolean",function:"piecewise-constant","zoom-function":!0,"property-function":!0,default:!1,requires:["icon-image"]},"icon-optional":{type:"boolean",function:"piecewise-constant","zoom-function":!0,"property-function":!0,default:!1,requires:["icon-image","text-field"]},"icon-rotation-alignment":{type:"enum",function:"piecewise-constant","zoom-function":!0,"property-function":!0,values:["map","viewport"],default:"viewport",requires:["icon-image"]},"icon-size":{type:"number",default:1,minimum:0,function:"interpolated","zoom-function":!0,"property-function":!0,requires:["icon-image"]},"icon-text-fit":{type:"enum",function:"piecewise-constant","zoom-function":!0,"property-function":!1,values:["none","both","width","height"],default:"none",requires:["icon-image","text-field"]},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",function:"interpolated","zoom-function":!0,"property-function":!0,requires:["icon-image","icon-text-fit","text-field"]},"icon-image":{type:"string",function:"piecewise-constant","zoom-function":!0,"property-function":!0,tokens:!0},"icon-rotate":{type:"number",default:0,period:360,function:"interpolated","zoom-function":!0,"property-function":!0,units:"degrees",requires:["icon-image"]},"icon-padding":{type:"number",default:2,minimum:0,function:"interpolated","zoom-function":!0,"property-function":!0,units:"pixels",requires:["icon-image"]},"icon-keep-upright":{type:"boolean",function:"piecewise-constant","zoom-function":!0,"property-function":!0,default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":"line"}]},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],function:"interpolated","zoom-function":!0,"property-function":!0,requires:["icon-image"]},"text-pitch-alignment":{type:"enum",function:"piecewise-constant","zoom-function":!0,"property-function":!0,values:["map","viewport"],requires:["text-field"]},"text-rotation-alignment":{type:"enum",function:"piecewise-constant","zoom-function":!0,"property-function":!0,values:["map","viewport"],default:"viewport",requires:["text-field"]},"text-field":{type:"string",function:"piecewise-constant","zoom-function":!0,"property-function":!0,default:"",tokens:!0},"text-font":{type:"array",value:"string",function:"piecewise-constant","zoom-function":!0,"property-function":!0,default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"]},"text-size":{type:"number",default:16,minimum:0,units:"pixels",function:"interpolated","zoom-function":!0,"property-function":!0,requires:["text-field"]},"text-max-width":{type:"number",default:10,minimum:0,units:"em",function:"interpolated","zoom-function":!0,"property-function":!0,requires:["text-field"]},"text-line-height":{type:"number",default:1.2,units:"em",function:"interpolated","zoom-function":!0,"property-function":!0,requires:["text-field"]},"text-letter-spacing":{type:"number",default:0,units:"em",function:"interpolated","zoom-function":!0,"property-function":!0,requires:["text-field"]},"text-justify":{type:"enum",function:"piecewise-constant","zoom-function":!0,"property-function":!0,values:["left","center","right"],default:"center",requires:["text-field"]},"text-anchor":{type:"enum",function:"piecewise-constant","zoom-function":!0,"property-function":!0,values:["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"],default:"center",requires:["text-field"]},"text-max-angle":{type:"number",default:45,units:"degrees",function:"interpolated","zoom-function":!0,"property-function":!0,requires:["text-field",{"symbol-placement":"line"}]},"text-rotate":{type:"number",default:0,period:360,units:"degrees",function:"interpolated","zoom-function":!0,"property-function":!0,requires:["text-field"]},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",function:"interpolated","zoom-function":!0,"property-function":!0,requires:["text-field"]},"text-keep-upright":{type:"boolean",function:"piecewise-constant","zoom-function":!0,"property-function":!0,default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":"line"}]},"text-transform":{type:"enum",function:"piecewise-constant","zoom-function":!0,"property-function":!0,values:["none","uppercase","lowercase"],default:"none",requires:["text-field"]},"text-offset":{type:"array",value:"number",units:"ems",function:"interpolated","zoom-function":!0,"property-function":!0,length:2,default:[0,0],requires:["text-field"]},"text-allow-overlap":{type:"boolean",function:"piecewise-constant","zoom-function":!0,"property-function":!0,default:!1,requires:["text-field"]},"text-ignore-placement":{type:"boolean",function:"piecewise-constant","zoom-function":!0,"property-function":!0,default:!1,requires:["text-field"]},"text-optional":{type:"boolean",function:"piecewise-constant","zoom-function":!0,"property-function":!0,default:!1,requires:["text-field","icon-image"]},visibility:{type:"enum",function:"piecewise-constant","zoom-function":!0,values:["visible","none"],default:"visible"}},layout_raster:{visibility:{type:"enum",function:"piecewise-constant","zoom-function":!0,values:["visible","none"],default:"visible"}},filter:{type:"array",value:"*"},filter_operator:{type:"enum",values:["==","!=",">",">=","<","<=","in","!in","all","any","none","has","!has"]},geometry_type:{type:"enum",values:["Point","LineString","Polygon"]},color_operation:{type:"enum",values:["lighten","saturate","spin","fade","mix"]},function:{stops:{type:"array",required:!0,value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:["exponential","interval","categorical"],default:"exponential"}},function_stop:{type:"array",minimum:0,maximum:22,value:["number","color"],length:2},paint:["paint_fill","paint_line","paint_circle","paint_symbol","paint_raster","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",function:"piecewise-constant","zoom-function":!0,"property-function":!0,default:!0},"fill-opacity":{type:"number",function:"interpolated","zoom-function":!0,"property-function":!0,default:1,minimum:0,maximum:1,transition:!0},"fill-color":{type:"color",default:"#000000",function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0,requires:[{"!":"fill-pattern"}]},"fill-outline-color":{type:"color",function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}]},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels"},"fill-translate-anchor":{type:"enum",function:"piecewise-constant","zoom-function":!0,"property-function":!0,values:["map","viewport"],default:"map",requires:["fill-translate"]},"fill-pattern":{type:"string",function:"piecewise-constant","zoom-function":!0,"property-function":!0,transition:!0}},paint_line:{"line-opacity":{type:"number",function:"interpolated","zoom-function":!0,"property-function":!0,default:1,minimum:0,maximum:1,transition:!0},"line-color":{type:"color",default:"#000000",function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0,requires:[{"!":"line-pattern"}]},"line-translate":{type:"array",value:"number",length:2,default:[0,0],function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels"},"line-translate-anchor":{type:"enum",function:"piecewise-constant","zoom-function":!0,"property-function":!0,values:["map","viewport"],default:"map",requires:["line-translate"]},"line-width":{type:"number",default:1,minimum:0,function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels"},"line-gap-width":{type:"number",default:0,minimum:0,function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels"},"line-offset":{type:"number",default:0,function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels"},"line-blur":{type:"number",default:0,minimum:0,function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels"},"line-dasharray":{type:"array",value:"number",function:"piecewise-constant","zoom-function":!0,"property-function":!0,minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}]},"line-pattern":{type:"string",function:"piecewise-constant","zoom-function":!0,"property-function":!0,transition:!0}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels"},"circle-color":{type:"color",default:"#000000",function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0},"circle-blur":{type:"number",default:0,function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels"},"circle-translate-anchor":{type:"enum",function:"piecewise-constant","zoom-function":!0,"property-function":!0,values:["map","viewport"],default:"map",requires:["circle-translate"]},"circle-pitch-scale":{type:"enum",function:"piecewise-constant","zoom-function":!0,"property-function":!0,values:["map","viewport"],default:"map"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0,requires:["icon-image"]},"icon-color":{type:"color",default:"#000000",function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0,requires:["icon-image"]},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0,requires:["icon-image"]},"icon-halo-width":{type:"number",default:0,minimum:0,function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels",requires:["icon-image"]},"icon-halo-blur":{type:"number",default:0,minimum:0,function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels",requires:["icon-image"]},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels",requires:["icon-image"]},"icon-translate-anchor":{type:"enum",function:"piecewise-constant","zoom-function":!0,"property-function":!0,values:["map","viewport"],default:"map",requires:["icon-image","icon-translate"]},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0,requires:["text-field"]},"text-color":{type:"color",default:"#000000",function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0,requires:["text-field"]},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0,requires:["text-field"]},"text-halo-width":{type:"number",default:0,minimum:0,function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels",requires:["text-field"]},"text-halo-blur":{type:"number",default:0,minimum:0,function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels",requires:["text-field"]},"text-translate":{type:"array",value:"number",length:2,default:[0,0],function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels",requires:["text-field"]},"text-translate-anchor":{type:"enum",function:"piecewise-constant","zoom-function":!0,"property-function":!0,values:["map","viewport"],default:"map",requires:["text-field","text-translate"]}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,function:"interpolated","zoom-function":!0,transition:!0},"raster-hue-rotate":{type:"number",default:0,period:360,function:"interpolated","zoom-function":!0,transition:!0,units:"degrees"},"raster-brightness-min":{type:"number",function:"interpolated","zoom-function":!0,default:0,minimum:0,maximum:1,transition:!0},"raster-brightness-max":{type:"number",function:"interpolated","zoom-function":!0,default:1,minimum:0,maximum:1,transition:!0},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,function:"interpolated","zoom-function":!0,transition:!0},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,function:"interpolated","zoom-function":!0,transition:!0},"raster-fade-duration":{type:"number",default:300,minimum:0,function:"interpolated","zoom-function":!0,transition:!0,units:"milliseconds"}},paint_background:{"background-color":{type:"color",default:"#000000",function:"interpolated","zoom-function":!0,transition:!0,requires:[{"!":"background-pattern"}]},"background-pattern":{type:"string",function:"piecewise-constant","zoom-function":!0,transition:!0},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,function:"interpolated","zoom-function":!0,transition:!0}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}}}},{}],330:[function(t,e,r){"use strict";function n(t){return!!("undefined"!=typeof window&&"undefined"!=typeof document&&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.prototype&&Function.prototype.bind&&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&&"JSON"in window&&"parse"in JSON&&"stringify"in JSON&&"Worker"in window&&"Uint8ClampedArray"in window&&function(t){void 0===i[t]&&(i[t]=function(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)}(t));return i[t]}(t&&t.failIfMajorPerformanceCaveat))}void 0!==e&&e.exports?e.exports=n:window&&(window.mapboxgl=window.mapboxgl||{},window.mapboxgl.supported=n);var i={};n.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0}},{}],331:[function(t,e,r){"use strict";function n(t){var e=t.layoutVertexArrayType;this.layoutVertexArray=new e;var r=t.elementArrayType;r&&(this.elementArray=new r);var n=t.elementArrayType2;n&&(this.elementArray2=new n),this.paintVertexArrays=i.mapObject(t.paintVertexArrayTypes,function(t){return new t})}var i=t("../util/util");e.exports=n,n.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,n.prototype.hasCapacityFor=function(t){return this.layoutVertexArray.length+t<=n.MAX_VERTEX_ARRAY_LENGTH},n.prototype.isEmpty=function(){return 0===this.layoutVertexArray.length},n.prototype.trim=function(){this.layoutVertexArray.trim(),this.elementArray&&this.elementArray.trim(),this.elementArray2&&this.elementArray2.trim();for(var t in this.paintVertexArrays)this.paintVertexArrays[t].trim()},n.prototype.serialize=function(){return{layoutVertexArray:this.layoutVertexArray.serialize(),elementArray:this.elementArray&&this.elementArray.serialize(),elementArray2:this.elementArray2&&this.elementArray2.serialize(),paintVertexArrays:i.mapObject(this.paintVertexArrays,function(t){return t.serialize()})}},n.prototype.getTransferables=function(t){t.push(this.layoutVertexArray.arrayBuffer),this.elementArray&&t.push(this.elementArray.arrayBuffer),this.elementArray2&&t.push(this.elementArray2.arrayBuffer);for(var e in this.paintVertexArrays)t.push(this.paintVertexArrays[e].arrayBuffer)}},{"../util/util":445}],332:[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=function(t){var e={};for(var r in t.programInterfaces){for(var n=e[r]={},a=0;a<t.childLayers.length;a++){var o=t.childLayers[a];n[o.id]={attributes:[],uniforms:[],defines:[],vertexPragmas:{define:{},initialize:{}},fragmentPragmas:{define:{},initialize:{}}}}var s=t.programInterfaces[r];if(s.paintAttributes)for(var c="{precision}",h="{type}",f=0;f<s.paintAttributes.length;f++){var d=s.paintAttributes[f];d.multiplier=d.multiplier||1;for(var p=0;p<t.childLayers.length;p++){var m=t.childLayers[p],g=n[m.id],v=d.name;u("a_"===d.name.slice(0,2));var y,b=d.name.slice(2);if(g.fragmentPragmas.initialize[b]="",m.isPaintValueFeatureConstant(d.paintProperty))g.uniforms.push(d),g.fragmentPragmas.define[b]=g.vertexPragmas.define[b]=["uniform",c,h,v].join(" ")+";",g.fragmentPragmas.initialize[b]=g.vertexPragmas.initialize[b]=[c,h,b,"=",v].join(" ")+";\n";else if(m.isPaintValueZoomConstant(d.paintProperty)){g.attributes.push(l.extend({},d,{name:v})),y=["varying",c,h,b].join(" ")+";\n";var x=[g.fragmentPragmas.define[b],"attribute",c,h,v].join(" ")+";\n";g.fragmentPragmas.define[b]=y,g.vertexPragmas.define[b]=y+x,g.vertexPragmas.initialize[b]=[b,"=",v,"/",d.multiplier.toFixed(1)].join(" ")+";\n"}else{for(var _="u_"+v.slice(2)+"_t",w=m.getPaintValueStopZoomLevels(d.paintProperty),M=0;M<w.length&&w[M]<t.zoom;)M++;for(var k=Math.max(0,Math.min(w.length-4,M-2)),T=[],A=0;A<4;A++)T.push(w[Math.min(k+A,w.length-1)]);y=["varying",c,h,b].join(" ")+";\n",g.vertexPragmas.define[b]=y+["uniform","lowp","float",_].join(" ")+";\n",g.fragmentPragmas.define[b]=y,g.uniforms.push(l.extend({},d,{name:_,getValue:function(t,e){return function(r,n){var i=r.getPaintInterpolationT(t.paintProperty,n.zoom);return[Math.max(0,Math.min(4,i-e))]}}(d,k),components:1}));var S=d.components;if(1===S)g.attributes.push(l.extend({},d,{getValue:i(d,T),isFunction:!0,components:4*S})),g.vertexPragmas.define[b]+=["attribute",c,"vec4",v].join(" ")+";\n",g.vertexPragmas.initialize[b]=[b,"=","evaluate_zoom_function_1("+v+", "+_+")","/",d.multiplier.toFixed(1)].join(" ")+";\n";else{for(var E=[],L=0;L<4;L++)E.push(v+L),g.attributes.push(l.extend({},d,{getValue:i(d,[T[L]]),isFunction:!0,name:v+L})),g.vertexPragmas.define[b]+=["attribute",c,h,v+L].join(" ")+";\n";g.vertexPragmas.initialize[b]=[b," = ","evaluate_zoom_function_4("+E.join(", ")+", "+_+")","/",d.multiplier.toFixed(1)].join(" ")+";\n"}}}}}return e}(this),t.arrays){var e=this.programInterfaces;this.bufferGroups=l.mapObject(t.arrays,function(r,n){var i=e[n],a=t.paintVertexArrayTypes[n];return r.map(function(t){return new s(t,{layoutVertexArrayType:i.layoutVertexArrayType.serialize(),elementArrayType:i.elementArrayType&&i.elementArrayType.serialize(),elementArrayType2:i.elementArrayType2&&i.elementArrayType2.serialize(),paintVertexArrayTypes:a})})})}}function i(t,e){return function(r,n,i){if(1===e.length)return t.getValue(r,l.extend({},n,{zoom:e[0]}),i);for(var a=[],o=0;o<e.length;o++){var s=e[o];a.push(t.getValue(r,l.extend({},n,{zoom:s}),i)[0])}return a}}var a=t("feature-filter"),o=t("./array_group"),s=t("./buffer_group"),l=t("../util/util"),c=t("../util/struct_array"),u=t("assert");e.exports=n,n.create=function(e){return new({fill:t("./bucket/fill_bucket"),line:t("./bucket/line_bucket"),circle:t("./bucket/circle_bucket"),symbol:t("./bucket/symbol_bucket")}[e.layer.type])(e)},n.EXTENT=8192,n.prototype.populateArrays=function(){this.createArrays(),this.recalculateStyleLayers();for(var t=0;t<this.features.length;t++)this.addFeature(this.features[t]);this.trimArrays()},n.prototype.prepareArrayGroup=function(t,e){var r=this.arrayGroups[t],n=r.length&&r[r.length-1];return n&&n.hasCapacityFor(e)||((n=new o({layoutVertexArrayType:this.programInterfaces[t].layoutVertexArrayType,elementArrayType:this.programInterfaces[t].elementArrayType,elementArrayType2:this.programInterfaces[t].elementArrayType2,paintVertexArrayTypes:this.paintVertexArrayTypes[t]})).index=r.length,r.push(n)),n},n.prototype.createArrays=function(){this.arrayGroups={},this.paintVertexArrayTypes={};for(var t in this.programInterfaces){this.arrayGroups[t]=[];var e=this.paintVertexArrayTypes[t]={},r=this.paintAttributes[t];for(var i in r)e[i]=new n.VertexArrayType(r[i].attributes)}},n.prototype.destroy=function(t){for(var e in this.bufferGroups)for(var r=this.bufferGroups[e],n=0;n<r.length;n++)r[n].destroy(t)},n.prototype.trimArrays=function(){for(var t in this.arrayGroups)for(var e=this.arrayGroups[t],r=0;r<e.length;r++)e[r].trim()},n.prototype.isEmpty=function(){for(var t in this.arrayGroups)for(var e=this.arrayGroups[t],r=0;r<e.length;r++)if(!e[r].isEmpty())return!1;return!0},n.prototype.getTransferables=function(t){for(var e in this.arrayGroups)for(var r=this.arrayGroups[e],n=0;n<r.length;n++)r[n].getTransferables(t)},n.prototype.setUniforms=function(t,e,r,n,i){for(var a=this.paintAttributes[e][n.id].uniforms,o=0;o<a.length;o++){var s=a[o],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:l.mapObject(this.arrayGroups,function(t){return t.map(function(t){return t.serialize()})}),paintVertexArrayTypes:l.mapObject(this.paintVertexArrayTypes,function(t){return l.mapObject(t,function(t){return t.serialize()})}),childLayerIds:this.childLayers.map(function(t){return t.id})}},n.prototype.createFilter=function(){this.filter||(this.filter=a(this.layer.filter))};var h={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,h)},n.prototype.populatePaintArrays=function(t,e,r,n,i){for(var a=0;a<this.childLayers.length;a++)for(var o=this.childLayers[a],s=this.arrayGroups[t],l=n.index;l<s.length;l++){var c=s[l],u=c.layoutVertexArray.length,h=c.paintVertexArrays[o.id];h.resize(u);for(var f=this.paintAttributes[t][o.id].attributes,d=0;d<f.length;d++)for(var p=f[d],m=p.getValue(o,e,r),g=p.multiplier||1,v=p.components||1,y=l===n.index?i:0;y<u;y++)for(var b=h.get(y),x=0;x<v;x++){b[v>1?p.name+x:p.name]=m[x]*g}}},n.VertexArrayType=function(t){return new c({members:t,alignment:4})},n.ElementArrayType=function(t){return new c({members:[{type:"Uint16",name:"vertices",components:t||3}]})}},{"../util/struct_array":443,"../util/util":445,"./array_group":331,"./bucket/circle_bucket":333,"./bucket/fill_bucket":334,"./bucket/line_bucket":335,"./bucket/symbol_bucket":336,"./buffer_group":338,assert:50,"feature-filter":135}],333:[function(t,e,r){"use strict";function n(){i.apply(this,arguments)}var i=t("../bucket"),a=t("../../util/util"),o=t("../load_geometry"),s=i.EXTENT;e.exports=n,(n.prototype=a.inherit(i,{})).addCircleVertex=function(t,e,r,n,i){return t.emplaceBack(2*e+(n+1)/2,2*r+(i+1)/2)},n.prototype.programInterfaces={circle:{layoutVertexArrayType:new i.VertexArrayType([{name:"a_pos",components:2,type:"Int16"}]),elementArrayType:new i.ElementArrayType,paintAttributes:[{name:"a_color",components:4,type:"Uint8",getValue:function(t,e,r){return t.getPaintValue("circle-color",e,r)},multiplier:255,paintProperty:"circle-color"},{name:"a_radius",components:1,type:"Uint16",isLayerConstant:!1,getValue:function(t,e,r){return[t.getPaintValue("circle-radius",e,r)]},multiplier:10,paintProperty:"circle-radius"},{name:"a_blur",components:1,type:"Uint16",isLayerConstant:!1,getValue:function(t,e,r){return[t.getPaintValue("circle-blur",e,r)]},multiplier:10,paintProperty:"circle-blur"},{name:"a_opacity",components:1,type:"Uint16",isLayerConstant:!1,getValue:function(t,e,r){return[t.getPaintValue("circle-opacity",e,r)]},multiplier:255,paintProperty:"circle-opacity"}]}},n.prototype.addFeature=function(t){for(var e={zoom:this.zoom},r=o(t),n=this.prepareArrayGroup("circle",0),i=n.layoutVertexArray.length,a=0;a<r.length;a++)for(var l=0;l<r[a].length;l++){var c=r[a][l].x,u=r[a][l].y;if(!(c<0||c>=s||u<0||u>=s)){var h=this.prepareArrayGroup("circle",4),f=h.layoutVertexArray,d=this.addCircleVertex(f,c,u,-1,-1);this.addCircleVertex(f,c,u,1,-1),this.addCircleVertex(f,c,u,1,1),this.addCircleVertex(f,c,u,-1,1),h.elementArray.emplaceBack(d,d+1,d+2),h.elementArray.emplaceBack(d,d+3,d+2)}}this.populatePaintArrays("circle",e,t.properties,n,i)}},{"../../util/util":445,"../bucket":332,"../load_geometry":340}],334:[function(t,e,r){"use strict";function n(){i.apply(this,arguments)}var i=t("../bucket"),a=t("../../util/util"),o=t("../load_geometry"),s=t("earcut"),l=t("../../util/classify_rings");e.exports=n,(n.prototype=a.inherit(i,{})).programInterfaces={fill:{layoutVertexArrayType:new i.VertexArrayType([{name:"a_pos",components:2,type:"Int16"}]),elementArrayType:new i.ElementArrayType(1),elementArrayType2:new i.ElementArrayType(2),paintAttributes:[{name:"a_color",components:4,type:"Uint8",getValue:function(t,e,r){return t.getPaintValue("fill-color",e,r)},multiplier:255,paintProperty:"fill-color"},{name:"a_outline_color",components:4,type:"Uint8",getValue:function(t,e,r){return t.getPaintValue("fill-outline-color",e,r)},multiplier:255,paintProperty:"fill-outline-color"},{name:"a_opacity",components:1,type:"Uint8",getValue:function(t,e,r){return[t.getPaintValue("fill-opacity",e,r)]},multiplier:255,paintProperty:"fill-opacity"}]}},n.prototype.addFeature=function(t){for(var e=o(t),r=l(e,500),n=this.prepareArrayGroup("fill",0),i=n.layoutVertexArray.length,a=0;a<r.length;a++)this.addPolygon(r[a]);this.populatePaintArrays("fill",{zoom:this.zoom},t.properties,n,i)},n.prototype.addPolygon=function(t){for(var e=0,r=0;r<t.length;r++)e+=t[r].length;for(var n=this.prepareArrayGroup("fill",e),i=[],a=[],o=n.layoutVertexArray.length,l=0;l<t.length;l++){var c=t[l];l>0&&a.push(i.length/2);for(var u=0;u<c.length;u++){var h=c[u],f=n.layoutVertexArray.emplaceBack(h.x,h.y);u>=1&&n.elementArray2.emplaceBack(f-1,f),i.push(h.x),i.push(h.y)}}for(var d=s(i,a),p=0;p<d.length;p++)n.elementArray.emplaceBack(d[p]+o)}},{"../../util/classify_rings":433,"../../util/util":445,"../bucket":332,"../load_geometry":340,earcut:129}],335:[function(t,e,r){"use strict";function n(){i.apply(this,arguments)}var i=t("../bucket"),a=t("../../util/util"),o=t("../load_geometry"),s=i.EXTENT,l=Math.cos(Math.PI/180*37.5),c=Math.pow(2,14)/.5;e.exports=n,(n.prototype=a.inherit(i,{})).addLineVertex=function(t,e,r,n,i,a,o){return t.emplaceBack(e.x<<1|n,e.y<<1|i,Math.round(63*r.x)+128,Math.round(63*r.y)+128,1+(0===a?0:a<0?-1:1)|(.5*o&63)<<2,.5*o>>6)},n.prototype.programInterfaces={line:{layoutVertexArrayType:new i.VertexArrayType([{name:"a_pos",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}]),elementArrayType:new i.ElementArrayType}},n.prototype.addFeature=function(t){for(var e=o(t,15),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 a=t.length;a>2&&t[a-1].equals(t[a-2]);)a--;if(!(t.length<2)){"bevel"===e&&(n=1.05);var o=s/(512*this.overscaling)*15,c=t[0],u=t[a-1],h=c.equals(u);if(this.prepareArrayGroup("line",10*a),2!==a||!h){this.distance=0;var f,d,p,m,g,v,y,b=r,x=h?"butt":r,_=!0;this.e1=this.e2=this.e3=-1,h&&(f=t[a-2],g=c.sub(f)._unit()._perp());for(var w=0;w<a;w++)if(!(p=h&&w===a-1?t[1]:t[w+1])||!t[w].equals(p)){g&&(m=g),f&&(d=f),f=t[w],g=p?p.sub(f)._unit()._perp():m;var M=(m=m||g).add(g)._unit(),k=M.x*g.x+M.y*g.y,T=1/k,A=k<l&&d&&p;if(A&&w>0){var S=f.dist(d);if(S>2*o){var E=f.sub(f.sub(d)._mult(o/S)._round());this.distance+=E.dist(d),this.addCurrentVertex(E,this.distance,m.mult(1),0,0,!1),d=E}}var L=d&&p,C=L?e:p?b:x;if(L&&"round"===C&&(T<i?C="miter":T<=2&&(C="fakeround")),"miter"===C&&T>n&&(C="bevel"),"bevel"===C&&(T>2&&(C="flipbevel"),T<n&&(C="miter")),d&&(this.distance+=f.dist(d)),"miter"===C)M._mult(T),this.addCurrentVertex(f,this.distance,M,0,0,!1);else if("flipbevel"===C){if(T>100)M=g.clone();else{var I=m.x*g.y-m.y*g.x>0?-1:1,z=T*m.add(g).mag()/m.sub(g).mag();M._perp()._mult(z*I)}this.addCurrentVertex(f,this.distance,M,0,0,!1),this.addCurrentVertex(f,this.distance,M.mult(-1),0,0,!1)}else if("bevel"===C||"fakeround"===C){var D=m.x*g.y-m.y*g.x>0,P=-Math.sqrt(T*T-1);if(D?(y=0,v=P):(v=0,y=P),_||this.addCurrentVertex(f,this.distance,m,v,y,!1),"fakeround"===C){for(var O,R=Math.floor(8*(.5-(k-.5))),F=0;F<R;F++)O=g.mult((F+1)/(R+1))._add(m)._unit(),this.addPieSliceVertex(f,this.distance,O,D);this.addPieSliceVertex(f,this.distance,M,D);for(var j=R-1;j>=0;j--)O=m.mult((j+1)/(R+1))._add(g)._unit(),this.addPieSliceVertex(f,this.distance,O,D)}p&&this.addCurrentVertex(f,this.distance,g,-v,-y,!1)}else"butt"===C?(_||this.addCurrentVertex(f,this.distance,m,0,0,!1),p&&this.addCurrentVertex(f,this.distance,g,0,0,!1)):"square"===C?(_||(this.addCurrentVertex(f,this.distance,m,1,1,!1),this.e1=this.e2=-1),p&&this.addCurrentVertex(f,this.distance,g,-1,-1,!1)):"round"===C&&(_||(this.addCurrentVertex(f,this.distance,m,0,0,!1),this.addCurrentVertex(f,this.distance,m,1,1,!0),this.e1=this.e2=-1),p&&(this.addCurrentVertex(f,this.distance,g,-1,-1,!0),this.addCurrentVertex(f,this.distance,g,0,0,!1)));if(A&&w<a-1){var N=f.dist(p);if(N>2*o){var B=f.add(p.sub(f)._mult(o/N)._round());this.distance+=B.dist(f),this.addCurrentVertex(B,this.distance,g.mult(1),0,0,!1),f=B}}_=!1}}}},n.prototype.addCurrentVertex=function(t,e,r,n,i,a){var o,s=a?1:0,l=this.arrayGroups.line[this.arrayGroups.line.length-1],u=l.layoutVertexArray,h=l.elementArray;o=r.clone(),n&&o._sub(r.perp()._mult(n)),this.e3=this.addLineVertex(u,t,o,s,0,n,e),this.e1>=0&&this.e2>=0&&h.emplaceBack(this.e1,this.e2,this.e3),this.e1=this.e2,this.e2=this.e3,o=r.mult(-1),i&&o._sub(r.perp()._mult(i)),this.e3=this.addLineVertex(u,t,o,s,1,-i,e),this.e1>=0&&this.e2>=0&&h.emplaceBack(this.e1,this.e2,this.e3),this.e1=this.e2,this.e2=this.e3,e>c/2&&(this.distance=0,this.addCurrentVertex(t,this.distance,r,n,i,a))},n.prototype.addPieSliceVertex=function(t,e,r,n){var i=n?1:0;r=r.mult(n?-1:1);var a=this.arrayGroups.line[this.arrayGroups.line.length-1],o=a.layoutVertexArray,s=a.elementArray;this.e3=this.addLineVertex(o,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":445,"../bucket":332,"../load_geometry":340}],336:[function(t,e,r){"use strict";function n(t){o.apply(this,arguments),this.showCollisionBoxes=t.showCollisionBoxes,this.overscaling=t.overscaling,this.collisionBoxArray=t.collisionBoxArray,this.symbolQuadsArray=t.symbolQuadsArray,this.symbolInstancesArray=t.symbolInstancesArray,this.sdfIcons=t.sdfIcons,this.iconsNeedLinear=t.iconsNeedLinear,this.adjustedTextSize=t.adjustedTextSize,this.adjustedIconSize=t.adjustedIconSize,this.fontstack=t.fontstack}function i(t,e,r,n,i,a,o,s,l,c,u){return t.emplaceBack(e,r,Math.round(64*n),Math.round(64*i),a/4,o/4,10*(c||0),u,10*(s||0),10*Math.min(l||25,25))}var a=t("point-geometry"),o=t("../bucket"),s=t("../../symbol/anchor"),l=t("../../symbol/get_anchors"),c=t("../../util/token"),u=t("../../symbol/quads"),h=t("../../symbol/shaping"),f=t("../../symbol/resolve_text"),d=t("../../symbol/mergelines"),p=t("../../symbol/clip_line"),m=t("../../util/util"),g=t("../load_geometry"),v=t("../../symbol/collision_feature"),y=h.shapeText,b=h.shapeIcon,x=u.getGlyphQuads,_=u.getIconQuads,w=o.EXTENT;e.exports=n,n.MAX_QUADS=65535,(n.prototype=m.inherit(o,{})).serialize=function(){var t=o.prototype.serialize.apply(this);return t.sdfIcons=this.sdfIcons,t.iconsNeedLinear=this.iconsNeedLinear,t.adjustedTextSize=this.adjustedTextSize,t.adjustedIconSize=this.adjustedIconSize,t.fontstack=this.fontstack,t};var M=new o.VertexArrayType([{name:"a_pos",components:2,type:"Int16"},{name:"a_offset",components:2,type:"Int16"},{name:"a_texture_pos",components:2,type:"Uint16"},{name:"a_data",components:4,type:"Uint8"}]),k=new o.ElementArrayType;n.prototype.addCollisionBoxVertex=function(t,e,r,n,i){return t.emplaceBack(e.x,e.y,Math.round(r.x),Math.round(r.y),10*n,10*i)},n.prototype.programInterfaces={glyph:{layoutVertexArrayType:M,elementArrayType:k},icon:{layoutVertexArrayType:M,elementArrayType:k},collisionBox:{layoutVertexArrayType:new o.VertexArrayType([{name:"a_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"},{name:"a_data",components:2,type:"Uint8"}])}},n.prototype.populateArrays=function(t,e,r){var n={lastIntegerZoom:1/0,lastIntegerZoomTime:0,lastZoom:0};this.adjustedTextMaxSize=this.layer.getLayoutValue("text-size",{zoom:18,zoomHistory:n}),this.adjustedTextSize=this.layer.getLayoutValue("text-size",{zoom:this.zoom+1,zoomHistory:n}),this.adjustedIconMaxSize=this.layer.getLayoutValue("icon-size",{zoom:18,zoomHistory:n}),this.adjustedIconSize=this.layer.getLayoutValue("icon-size",{zoom:this.zoom+1,zoomHistory:n});var i=512*this.overscaling;this.tilePixelRatio=w/i,this.compareText={},this.iconsNeedLinear=!1,this.symbolInstancesStartIndex=this.symbolInstancesArray.length;var a=this.layer.layout,o=this.features,s=this.textFeatures,l=.5,u=.5;switch(a["text-anchor"]){case"right":case"top-right":case"bottom-right":l=1;break;case"left":case"top-left":case"bottom-left":l=0}switch(a["text-anchor"]){case"bottom":case"bottom-right":case"bottom-left":u=1;break;case"top":case"top-right":case"top-left":u=0}for(var h="right"===a["text-justify"]?1:"left"===a["text-justify"]?0:.5,f=24*a["text-line-height"],p="line"!==a["symbol-placement"]?24*a["text-max-width"]:0,v=24*a["text-letter-spacing"],x=[24*a["text-offset"][0],24*a["text-offset"][1]],_=this.fontstack=a["text-font"].join(","),M=[],k=0;k<o.length;k++)M.push(g(o[k]));if("line"===a["symbol-placement"]){var T=d(o,s,M);M=T.geometries,o=T.features,s=T.textFeatures}for(var A,S,E=0;E<o.length;E++)if(M[E]){if(A=s[E]?y(s[E],e[_],p,f,l,u,h,v,x):null,a["icon-image"]){var L=r[c(o[E].properties,a["icon-image"])];S=b(L,a),L&&(void 0===this.sdfIcons?this.sdfIcons=L.sdf:this.sdfIcons!==L.sdf&&m.warnOnce("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),1!==L.pixelRatio?this.iconsNeedLinear=!0:0===a["icon-rotate"]&&this.layer.isLayoutValueFeatureConstant("icon-rotate")||(this.iconsNeedLinear=!0))}else S=null;(A||S)&&this.addFeature(M[E],A,S,o[E])}this.symbolInstancesEndIndex=this.symbolInstancesArray.length,this.placeFeatures(t,this.showCollisionBoxes),this.trimArrays()},n.prototype.addFeature=function(t,e,r,n){var i=this.layer.layout,a=this.adjustedTextSize/24,o=void 0!==this.adjustedTextMaxSize?this.adjustedTextMaxSize:this.adjustedTextSize,c=this.tilePixelRatio*a,u=this.tilePixelRatio*o/24,h=this.tilePixelRatio*this.adjustedIconSize,f=this.tilePixelRatio*i["symbol-spacing"],d=i["symbol-avoid-edges"],m=i["text-padding"]*this.tilePixelRatio,g=i["icon-padding"]*this.tilePixelRatio,v=i["text-max-angle"]/180*Math.PI,y="map"===i["text-rotation-alignment"]&&"line"===i["symbol-placement"],b="map"===i["icon-rotation-alignment"]&&"line"===i["symbol-placement"],x=i["text-allow-overlap"]||i["icon-allow-overlap"]||i["text-ignore-placement"]||i["icon-ignore-placement"],_="line"===i["symbol-placement"],M=f/2;_&&(t=p(t,0,0,w,w));for(var k=0;k<t.length;k++)for(var T,A=t[k],S=0,E=(T=_?l(A,f,v,e,r,24,u,this.overscaling,w):[new s(A[0].x,A[0].y,0)]).length;S<E;S++){var L=T[S];if(!(e&&_&&this.anchorIsTooClose(e.text,M,L))){var C=!(L.x<0||L.x>w||L.y<0||L.y>w);if(!d||C){var I=C||x;this.addSymbolInstance(L,A,e,r,this.layer,I,this.symbolInstancesArray.length,this.collisionBoxArray,n.index,this.sourceLayerIndex,this.index,c,m,y,h,g,b,{zoom:this.zoom},n.properties)}}}},n.prototype.anchorIsTooClose=function(t,e,r){var n=this.compareText;if(t in n){for(var i=n[t],a=i.length-1;a>=0;a--)if(r.dist(i[a])<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"],a="map"===r["icon-rotation-alignment"]&&"line"===r["symbol-placement"];if(r["text-allow-overlap"]||r["icon-allow-overlap"]||r["text-ignore-placement"]||r["icon-ignore-placement"]){var o=this.symbolInstancesArray.toArray(this.symbolInstancesStartIndex,this.symbolInstancesEndIndex),s=t.angle,l=Math.sin(s),c=Math.cos(s);this.sortedSymbolInstances=o.sort(function(t,e){return(l*t.anchorPointX+c*t.anchorPointY|0)-(l*e.anchorPointX+c*e.anchorPointY|0)||e.index-t.index})}for(var u=this.symbolInstancesStartIndex;u<this.symbolInstancesEndIndex;u++){var h=this.sortedSymbolInstances?this.sortedSymbolInstances[u-this.symbolInstancesStartIndex]:this.symbolInstancesArray.get(u),f={boxStartIndex:h.textBoxStartIndex,boxEndIndex:h.textBoxEndIndex},d={boxStartIndex:h.iconBoxStartIndex,boxEndIndex:h.iconBoxEndIndex},p=!(h.textBoxStartIndex===h.textBoxEndIndex),m=!(h.iconBoxStartIndex===h.iconBoxEndIndex),g=r["text-optional"]||!p,v=r["icon-optional"]||!m,y=p?t.placeCollisionFeature(f,r["text-allow-overlap"],r["symbol-avoid-edges"]):t.minScale,b=m?t.placeCollisionFeature(d,r["icon-allow-overlap"],r["symbol-avoid-edges"]):t.minScale;g||v?!v&&y?y=Math.max(b,y):!g&&b&&(b=Math.max(b,y)):b=y=Math.max(b,y),p&&(t.insertCollisionFeature(f,y,r["text-ignore-placement"]),y<=n&&this.addSymbols("glyph",h.glyphQuadStartIndex,h.glyphQuadEndIndex,y,r["text-keep-upright"],i,t.angle)),m&&(t.insertCollisionFeature(d,b,r["icon-ignore-placement"]),b<=n&&this.addSymbols("icon",h.iconQuadStartIndex,h.iconQuadEndIndex,b,r["icon-keep-upright"],a,t.angle))}e&&this.addToDebugBuffers(t)},n.prototype.addSymbols=function(t,e,r,n,a,o,s){for(var l=this.prepareArrayGroup(t,4*(r-e)),c=l.elementArray,u=l.layoutVertexArray,h=this.zoom,f=Math.max(Math.log(n)/Math.LN2+h,0),d=e;d<r;d++){var p=this.symbolQuadsArray.get(d).SymbolQuad,m=(p.anchorAngle+s+Math.PI)%(2*Math.PI);if(!(a&&o&&(m<=Math.PI/2||m>3*Math.PI/2))){var g=p.tl,v=p.tr,y=p.bl,b=p.br,x=p.tex,_=p.anchorPoint,w=Math.max(h+Math.log(p.minScale)/Math.LN2,f),M=Math.min(h+Math.log(p.maxScale)/Math.LN2,25);if(!(M<=w)){w===f&&(w=0);var k=Math.round(p.glyphAngle/(2*Math.PI)*256),T=i(u,_.x,_.y,g.x,g.y,x.x,x.y,w,M,f,k);i(u,_.x,_.y,v.x,v.y,x.x+x.w,x.y,w,M,f,k),i(u,_.x,_.y,y.x,y.y,x.x,x.y+x.h,w,M,f,k),i(u,_.x,_.y,b.x,b.y,x.x+x.w,x.y+x.h,w,M,f,k),c.emplaceBack(T,T+1,T+2),c.emplaceBack(T+1,T+2,T+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=f(this.features,this.layer.layout,r)},n.prototype.addToDebugBuffers=function(t){for(var e=this.prepareArrayGroup("collisionBox",0).layoutVertexArray,r=-t.angle,n=t.yStretch,i=this.symbolInstancesStartIndex;i<this.symbolInstancesEndIndex;i++){var o=this.symbolInstancesArray.get(i);o.textCollisionFeature={boxStartIndex:o.textBoxStartIndex,boxEndIndex:o.textBoxEndIndex},o.iconCollisionFeature={boxStartIndex:o.iconBoxStartIndex,boxEndIndex:o.iconBoxEndIndex};for(var s=0;s<2;s++){var l=o[0===s?"textCollisionFeature":"iconCollisionFeature"];if(l)for(var c=l.boxStartIndex;c<l.boxEndIndex;c++){var u=this.collisionBoxArray.get(c),h=u.anchorPoint,f=new a(u.x1,u.y1*n)._rotate(r),d=new a(u.x2,u.y1*n)._rotate(r),p=new a(u.x1,u.y2*n)._rotate(r),m=new a(u.x2,u.y2*n)._rotate(r),g=Math.max(0,Math.min(25,this.zoom+Math.log(u.maxScale)/Math.LN2)),v=Math.max(0,Math.min(25,this.zoom+Math.log(u.placementScale)/Math.LN2));this.addCollisionBoxVertex(e,h,f,g,v),this.addCollisionBoxVertex(e,h,d,g,v),this.addCollisionBoxVertex(e,h,d,g,v),this.addCollisionBoxVertex(e,h,m,g,v),this.addCollisionBoxVertex(e,h,m,g,v),this.addCollisionBoxVertex(e,h,p,g,v),this.addCollisionBoxVertex(e,h,p,g,v),this.addCollisionBoxVertex(e,h,f,g,v)}}}},n.prototype.addSymbolInstance=function(t,e,r,i,a,o,s,l,c,u,h,f,d,p,g,y,b,w,M){var k,T,A,S,E,L,C,I;if(r&&(C=o?x(t,r,f,e,a,p):[],E=new v(l,e,t,c,u,h,r,f,d,p,!1)),k=this.symbolQuadsArray.length,C&&C.length)for(var z=0;z<C.length;z++)this.addSymbolQuad(C[z]);T=this.symbolQuadsArray.length;var D=E?E.boxStartIndex:this.collisionBoxArray.length,P=E?E.boxEndIndex:this.collisionBoxArray.length;i&&(I=o?_(t,i,g,e,a,b,r,w,M):[],L=new v(l,e,t,c,u,h,i,g,y,b,!0)),A=this.symbolQuadsArray.length,I&&1===I.length&&this.addSymbolQuad(I[0]),S=this.symbolQuadsArray.length;var O=L?L.boxStartIndex:this.collisionBoxArray.length,R=L?L.boxEndIndex:this.collisionBoxArray.length;return S>n.MAX_QUADS&&m.warnOnce("Too many symbols being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),T>n.MAX_QUADS&&m.warnOnce("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),this.symbolInstancesArray.emplaceBack(D,P,O,R,k,T,A,S,t.x,t.y,s)},n.prototype.addSymbolQuad=function(t){return this.symbolQuadsArray.emplaceBack(t.anchorPoint.x,t.anchorPoint.y,t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y,t.tex.h,t.tex.w,t.tex.x,t.tex.y,t.anchorAngle,t.glyphAngle,t.maxScale,t.minScale)}},{"../../symbol/anchor":394,"../../symbol/clip_line":396,"../../symbol/collision_feature":398,"../../symbol/get_anchors":400,"../../symbol/mergelines":403,"../../symbol/quads":404,"../../symbol/resolve_text":405,"../../symbol/shaping":406,"../../util/token":444,"../../util/util":445,"../bucket":332,"../load_geometry":340,"point-geometry":487}],337:[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}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 i={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];void 0!==a&&t.vertexAttribPointer(a,n.components,t[i[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"}},{}],338:[function(t,e,r){"use strict";function n(t,e){this.layoutVertexBuffer=new a(t.layoutVertexArray,e.layoutVertexArrayType,a.BufferType.VERTEX),t.elementArray&&(this.elementBuffer=new a(t.elementArray,e.elementArrayType,a.BufferType.ELEMENT));var r,n=this.vaos={};t.elementArray2&&(this.elementBuffer2=new a(t.elementArray2,e.elementArrayType2,a.BufferType.ELEMENT),r=this.secondVaos={}),this.paintVertexBuffers=i.mapObject(t.paintVertexArrays,function(i,s){return n[s]=new o,t.elementArray2&&(r[s]=new o),new a(i,e.paintVertexArrayTypes[s],a.BufferType.VERTEX)})}var i=t("../util/util"),a=t("./buffer"),o=t("../render/vertex_array_object");e.exports=n,n.prototype.destroy=function(t){this.layoutVertexBuffer.destroy(t),this.elementBuffer&&this.elementBuffer.destroy(t),this.elementBuffer2&&this.elementBuffer2.destroy(t);for(var e in this.paintVertexBuffers)this.paintVertexBuffers[e].destroy(t);for(var r in this.vaos)this.vaos[r].destroy(t);for(var n in this.secondVaos)this.secondVaos[n].destroy(t)}},{"../render/vertex_array_object":360,"../util/util":445,"./buffer":337}],339:[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 d(n.grid),this.featureIndexArray=new M(n.featureIndexArray),this.rawTileData=i,this.bucketLayerIDs=n.bucketLayerIDs}else this.grid=new d(u,16,0),this.featureIndexArray=new M;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 a(t,e){return e-t}function o(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=l.convert(e),"viewport"===r&&e._rotate(-n);for(var a=[],o=0;o<t.length;o++){for(var s=t[o],c=[],u=0;u<s.length;u++)c.push(s[u].sub(e._mult(i)));a.push(c)}return a}var l=t("point-geometry"),c=t("./load_geometry"),u=t("./bucket").EXTENT,h=t("feature-filter"),f=t("../util/struct_array"),d=t("grid-index"),p=t("../util/dictionary_coder"),m=t("vector-tile"),g=t("pbf"),v=t("../util/vectortile_to_geojson"),y=t("../util/util").arraysIntersect,b=t("../util/intersection_tests"),x=b.multiPolygonIntersectsBufferedMultiPoint,_=b.multiPolygonIntersectsMultiPolygon,w=b.multiPolygonIntersectsBufferedMultiLine,M=new f({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 a=c(t),o=0;o<a.length;o++){for(var s=a[o],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 p(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"]));var r={},n=t.params||{},s=u/t.tileSize/t.scale,c=h(n.filter),f=0;for(var d in e){var v=e[d],y=v.paint,b=0;"line"===v.type?b=o(y)/2+Math.abs(y["line-offset"])+i(y["line-translate"]):"fill"===v.type?b=i(y["fill-translate"]):"circle"===v.type&&(b=y["circle-radius"]+i(y["circle-translate"])),f=Math.max(f,b*s)}for(var x=t.queryGeometry.map(function(t){return t.map(function(t){return new l(t.x,t.y)})}),_=1/0,w=1/0,M=-1/0,k=-1/0,T=0;T<x.length;T++)for(var A=x[T],S=0;S<A.length;S++){var E=A[S];_=Math.min(_,E.x),w=Math.min(w,E.y),M=Math.max(M,E.x),k=Math.max(k,E.y)}var L=this.grid.query(_-f,w-f,M+f,k+f);L.sort(a),this.filterMatching(r,L,this.featureIndexArray,x,c,n.layers,e,t.bearing,s);var C=this.collisionTile.queryRenderedSymbols(_,w,M,k,t.scale);return C.sort(),this.filterMatching(r,C,this.collisionTile.collisionBoxArray,x,c,n.layers,e,t.bearing,s),r},n.prototype.filterMatching=function(t,e,r,n,i,a,u,h,f){for(var d,p=0;p<e.length;p++){var m=e[p];if(m!==d){d=m;var g=r.get(m),b=this.bucketLayerIDs[g.bucketIndex];if(!a||y(a,b)){var M=this.sourceLayerCoder.decode(g.sourceLayerIndex),k=this.vtLayers[M].feature(g.featureIndex);if(i(k))for(var T=null,A=0;A<b.length;A++){var S=b[A];if(!(a&&a.indexOf(S)<0)){var E=u[S];if(E){var L;if("symbol"!==E.type){T||(T=c(k));var C=E.paint;if("line"===E.type){L=s(n,C["line-translate"],C["line-translate-anchor"],h,f);var I=o(C)/2*f;if(C["line-offset"]&&(T=function(t,e){for(var r=[],n=new l(0,0),i=0;i<t.length;i++){for(var a=t[i],o=[],s=0;s<a.length;s++){var c=a[s-1],u=a[s],h=a[s+1],f=0===s?n:u.sub(c)._unit()._perp(),d=s===a.length-1?n:h.sub(u)._unit()._perp(),p=f._add(d)._unit(),m=p.x*d.x+p.y*d.y;p._mult(1/m),o.push(p._mult(e)._add(u))}r.push(o)}return r}(T,C["line-offset"]*f)),!w(L,T,I))continue}else if("fill"===E.type){if(L=s(n,C["fill-translate"],C["fill-translate-anchor"],h,f),!_(L,T))continue}else if("circle"===E.type){L=s(n,C["circle-translate"],C["circle-translate-anchor"],h,f);var z=C["circle-radius"]*f;if(!x(L,T,z))continue}}var D=new v(k,this.z,this.x,this.y);D.layer=E.serialize({includeRefProperties:!0});var P=t[S];void 0===P&&(P=t[S]=[]),P.push(D)}}}}}}}},{"../util/dictionary_coder":435,"../util/intersection_tests":440,"../util/struct_array":443,"../util/util":445,"../util/vectortile_to_geojson":446,"./bucket":332,"./load_geometry":340,"feature-filter":135,"grid-index":290,pbf:481,"point-geometry":487,"vector-tile":561}],340:[function(t,e,r){"use strict";function n(t){return{min:-1*Math.pow(2,t-1),max:Math.pow(2,t-1)-1}}var i=t("../util/util"),a=t("./bucket").EXTENT,o=t("assert"),s={15:n(15),16:n(16)};e.exports=function(t,e){var r=s[e||16];o(r);for(var n=a/t.extent,l=t.loadGeometry(),c=0;c<l.length;c++)for(var u=l[c],h=0;h<u.length;h++){var f=u[h];f.x=Math.round(f.x*n),f.y=Math.round(f.y*n),(f.x<r.min||f.x>r.max||f.y<r.min||f.y>r.max)&&i.warnOnce("Geometry exceeds allowed extent, reduce your vector tile buffer size")}return l}},{"../util/util":445,"./bucket":332,assert:50}],341:[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}}},{}],342:[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":445}],343:[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,a=this._sw,o=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 a||o?(a.lng=Math.min(e.lng,a.lng),a.lat=Math.min(e.lat,a.lat),o.lng=Math.max(r.lng,o.lng),o.lat=Math.max(r.lat,o.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":342}],344:[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"),a=t("point-geometry"),o=t("./coordinate"),s=t("../util/util").wrap,l=t("../util/interpolate"),c=t("../source/tile_coord"),u=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 a(this.width,this.height)},get bearing(){return-this.angle/Math.PI*180},set bearing(t){var e=-s(t,-180,180)*Math.PI/180;this.angle!==e&&(this._unmodified=!1,this.angle=e,this._calcMatrices(),this.rotationMatrix=p.create(),p.rotate(this.rotationMatrix,this.rotationMatrix,this.angle))},get pitch(){return this._pitch/Math.PI*180},set pitch(t){var e=Math.min(60,t)/180*Math.PI;this._pitch!==e&&(this._unmodified=!1,this._pitch=e,this._calcMatrices())},get altitude(){return this._altitude},set altitude(t){var e=Math.max(.75,t);this._altitude!==e&&(this._unmodified=!1,this._altitude=e,this._calcMatrices())},get zoom(){return this._zoom},set zoom(t){var e=Math.min(Math.max(t,this.minZoom),this.maxZoom);this._zoom!==e&&(this._unmodified=!1,this._zoom=e,this.scale=this.zoomScale(e),this.tileZoom=Math.floor(e),this.zoomFraction=e-this.tileZoom,this._calcMatrices(),this._constrain())},get center(){return this._center},set center(t){t.lat===this._center.lat&&t.lng===this._center.lng||(this._unmodified=!1,this._center=t,this._calcMatrices(),this._constrain())},coveringZoomLevel:function(t){return(t.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/t.tileSize))},coveringTiles:function(t){var e=this.coveringZoomLevel(t),r=e;if(e<t.minzoom)return[];e>t.maxzoom&&(e=t.maxzoom);var n=this.locationCoordinate(this.center)._zoomTo(e),i=new a(n.column-.5,n.row-.5);return c.cover(e,[this.pointCoordinate(new a(0,0))._zoomTo(e),this.pointCoordinate(new a(this.width,0))._zoomTo(e),this.pointCoordinate(new a(this.width,this.height))._zoomTo(e),this.pointCoordinate(new a(0,this.height))._zoomTo(e)],t.reparseOverscaled?r:e).sort(function(t,e){return i.dist(t)-i.dist(e)})},resize:function(t,e){this.width=t,this.height=e,this.pixelsToGLUnits=[2/t,-2/e],this._calcMatrices(),this._constrain()},get unmodified(){return this._unmodified},zoomScale:function(t){return Math.pow(2,t)},scaleZoom:function(t){return Math.log(t)/Math.LN2},project:function(t,e){return new a(this.lngX(t.lng,e),this.latY(t.lat,e))},unproject:function(t,e){return new i(this.xLng(t.x,e),this.yLat(t.y,e))},get x(){return this.lngX(this.center.lng)},get y(){return this.latY(this.center.lat)},get point(){return new a(this.x,this.y)},lngX:function(t,e){return(180+t)*(e||this.worldSize)/360},latY:function(t,e){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))*(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),a=n._sub(r);this._unmodified=!1,this.center=this.coordinateLocation(i._sub(a))},locationPoint:function(t){return this.coordinatePoint(this.locationCoordinate(t))},pointLocation:function(t){return this.coordinateLocation(this.pointCoordinate(t))},locationCoordinate:function(t){var e=this.zoomScale(this.tileZoom)/this.worldSize,r=i.convert(t);return new o(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=[t.x,t.y,0,1],r=[t.x,t.y,1,1];f.transformMat4(e,e,this.pixelMatrixInverse),f.transformMat4(r,r,this.pixelMatrixInverse);var n=e[3],i=r[3],a=e[0]/n,s=r[0]/i,c=e[1]/n,u=r[1]/i,h=e[2]/n,d=r[2]/i,p=h===d?0:(0-h)/(d-h),m=this.worldSize/this.zoomScale(this.tileZoom);return new o(l(a,s,p)/m,l(c,u,p)/m,this.tileZoom)},coordinatePoint:function(t){var e=this.worldSize/this.zoomScale(t.zoom),r=[t.column*e,t.row*e,0,1];return f.transformMat4(r,r,this.pixelMatrix),new a(r[0]/r[3],r[1]/r[3])},calculatePosMatrix:function(t,e){void 0===e&&(e=1/0),t instanceof c&&(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/u,n/u,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,o,s,l,c=this.size,u=this._unmodified;this.latRange&&(t=this.latY(this.latRange[1]),i=(e=this.latY(this.latRange[0]))-t<c.y?c.y/(e-t):0),this.lngRange&&(r=this.lngX(this.lngRange[0]),o=(n=this.lngX(this.lngRange[1]))-r<c.x?c.x/(n-r):0);var h=Math.max(o||0,i||0);if(h)return this.center=this.unproject(new a(o?(n+r)/2:this.x,i?(e+t)/2:this.y)),this.zoom+=this.scaleZoom(h),this._unmodified=u,void(this._constraining=!1);if(this.latRange){var f=this.y,d=c.y/2;f-d<t&&(l=t+d),f+d>e&&(l=e-d)}if(this.lngRange){var p=this.x,m=c.x/2;p-m<r&&(s=r+m),p+m>n&&(s=n-m)}void 0===s&&void 0===l||(this.center=this.unproject(new a(void 0!==s?s:this.x,void 0!==l?l:this.y))),this._unmodified=u,this._constraining=!1}},_calcMatrices:function(){if(this.height){var t=Math.atan(.5/this.altitude),e=Math.sin(t)*this.altitude/Math.sin(Math.PI/2-this._pitch-t),r=Math.cos(Math.PI/2-this._pitch)*e+this.altitude,n=new Float64Array(16);if(d.perspective(n,2*Math.atan(this.height/2/this.altitude),this.width/this.height,.1,r),d.translate(n,n,[0,0,-this.altitude]),d.scale(n,n,[1,-1,1/this.height]),d.rotateX(n,n,this._pitch),d.rotateZ(n,n,this.angle),d.translate(n,n,[-this.x,-this.y,0]),this.projMatrix=n,n=d.create(),d.scale(n,n,[this.width/2,-this.height/2,1]),d.translate(n,n,[1,-1,0]),this.pixelMatrix=d.multiply(new Float64Array(16),n,this.projMatrix),!(n=d.invert(new Float64Array(16),this.pixelMatrix)))throw new Error("failed to invert matrix");this.pixelMatrixInverse=n}}}},{"../data/bucket":332,"../source/tile_coord":372,"../util/interpolate":439,"../util/util":445,"./coordinate":341,"./lng_lat":342,"gl-matrix":196,"point-geometry":487}],345:[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 a,o,s,l,c,u,h,f,d=[];for(a=0,o=t.length;a<o;a++)if(c=n[t[a]]){for(f=null,s=0,l=c[1].length;s<l;s+=2)-1===c[1][s]&&-1===c[1][s+1]?f=null:(u=e+c[1][s]*i,h=r-c[1][s+1]*i,f&&d.push(f.x,f.y,u,h),f={x:u,y:h});e+=c[0]*i}return d}},{}],346:[function(t,e,r){"use strict";var n=e.exports={};n.version=t("../package.json").version,n.Map=t("./ui/map"),n.Control=t("./ui/control/control"),n.Navigation=t("./ui/control/navigation"),n.Geolocate=t("./ui/control/geolocate"),n.Attribution=t("./ui/control/attribution"),n.Popup=t("./ui/popup"),n.Marker=t("./ui/marker"),n.Style=t("./style/style"),n.LngLat=t("./geo/lng_lat"),n.LngLatBounds=t("./geo/lng_lat_bounds"),n.Point=t("point-geometry"),n.Evented=t("./util/evented"),n.util=t("./util/util"),n.supported=t("./util/browser").supported;var i=t("./util/ajax");n.util.getJSON=i.getJSON,n.util.getArrayBuffer=i.getArrayBuffer;var a=t("./util/config");n.config=a,Object.defineProperty(n,"accessToken",{get:function(){return a.ACCESS_TOKEN},set:function(t){a.ACCESS_TOKEN=t}})},{"../package.json":447,"./geo/lng_lat":342,"./geo/lng_lat_bounds":343,"./style/style":381,"./ui/control/attribution":412,"./ui/control/control":413,"./ui/control/geolocate":414,"./ui/control/navigation":415,"./ui/map":424,"./ui/marker":425,"./ui/popup":426,"./util/ajax":428,"./util/browser":429,"./util/config":434,"./util/evented":437,"./util/util":445,"point-geometry":487}],347:[function(t,e,r){"use strict";var n=t("assert");e.exports=function(t){for(var e={define:{},initialize:{}},r=0;r<t.length;r++){var i=t[r];n("u_"===i.name.slice(0,2));var a="{precision} "+(1===i.components?"float":"vec"+i.components);e.define[i.name.slice(2)]="uniform "+a+" "+i.name+";\n",e.initialize[i.name.slice(2)]=a+" "+i.name.slice(2)+" = "+i.name+";\n"}return e}},{assert:50}],348:[function(t,e,r){"use strict";var n=t("../source/pixels_to_tile_units"),i=t("./create_uniform_pragmas"),a=512;e.exports=function(t,e,r){var o,s=t.gl,l=t.transform,c=r.paint["background-color"],u=r.paint["background-pattern"],h=r.paint["background-opacity"],f=u?t.spriteAtlas.getPosition(u.from,!0):null,d=u?t.spriteAtlas.getPosition(u.to,!0):null;if(t.setDepthSublayer(0),f&&d){if(t.isOpaquePass)return;o=t.useProgram("pattern"),s.uniform1i(o.u_image,0),s.uniform2fv(o.u_pattern_tl_a,f.tl),s.uniform2fv(o.u_pattern_br_a,f.br),s.uniform2fv(o.u_pattern_tl_b,d.tl),s.uniform2fv(o.u_pattern_br_b,d.br),s.uniform1f(o.u_opacity,h),s.uniform1f(o.u_mix,u.t),s.uniform2fv(o.u_pattern_size_a,f.size),s.uniform2fv(o.u_pattern_size_b,d.size),s.uniform1f(o.u_scale_a,u.fromScale),s.uniform1f(o.u_scale_b,u.toScale),s.activeTexture(s.TEXTURE0),t.spriteAtlas.bind(s,!0),t.tileExtentPatternVAO.bind(s,o,t.tileExtentBuffer)}else{if(t.isOpaquePass!==(1===c[3]))return;var p=i([{name:"u_color",components:4},{name:"u_opacity",components:1}]);o=t.useProgram("fill",[],p,p),s.uniform4fv(o.u_color,c),s.uniform1f(o.u_opacity,h),t.tileExtentVAO.bind(s,o,t.tileExtentBuffer)}s.disable(s.STENCIL_TEST);for(var m=l.coveringTiles({tileSize:a}),g=0;g<m.length;g++){var v=m[g];if(f&&d){var y={coord:v,tileSize:a};s.uniform1f(o.u_tile_units_to_pixels,1/n(y,1,t.transform.tileZoom));var b=y.tileSize*Math.pow(2,t.transform.tileZoom-y.coord.z),x=b*(y.coord.x+v.w*Math.pow(2,y.coord.z)),_=b*y.coord.y;s.uniform2f(o.u_pixel_coord_upper,x>>16,_>>16),s.uniform2f(o.u_pixel_coord_lower,65535&x,65535&_)}s.uniformMatrix4fv(o.u_matrix,!1,t.transform.calculatePosMatrix(v)),s.drawArrays(s.TRIANGLE_STRIP,0,t.tileExtentBuffer.length)}s.stencilMask(0),s.stencilFunc(s.EQUAL,128,128)}},{"../source/pixels_to_tile_units":366,"./create_uniform_pragmas":347}],349:[function(t,e,r){"use strict";var n=t("../util/browser");e.exports=function(t,e,r,i){if(!t.isOpaquePass){var a=t.gl;t.setDepthSublayer(0),t.depthMask(!1),a.disable(a.STENCIL_TEST);for(var o=0;o<i.length;o++){var s=i[o],l=e.getTile(s),c=l.getBucket(r);if(c){var u=c.bufferGroups.circle;if(u){var h=c.paintAttributes.circle[r.id],f=t.useProgram("circle",h.defines,h.vertexPragmas,h.fragmentPragmas);"map"===r.paint["circle-pitch-scale"]?(a.uniform1i(f.u_scale_with_map,!0),a.uniform2f(f.u_extrude_scale,t.transform.pixelsToGLUnits[0]*t.transform.altitude,t.transform.pixelsToGLUnits[1]*t.transform.altitude)):(a.uniform1i(f.u_scale_with_map,!1),a.uniform2fv(f.u_extrude_scale,t.transform.pixelsToGLUnits)),a.uniform1f(f.u_devicepixelratio,n.devicePixelRatio),a.uniformMatrix4fv(f.u_matrix,!1,t.translatePosMatrix(s.posMatrix,l,r.paint["circle-translate"],r.paint["circle-translate-anchor"])),c.setUniforms(a,"circle",f,r,{zoom:t.transform.zoom});for(var d=0;d<u.length;d++){var p=u[d];p.vaos[r.id].bind(a,f,p.layoutVertexBuffer,p.elementBuffer,p.paintVertexBuffers[r.id]),a.drawElements(a.TRIANGLES,3*p.elementBuffer.length,a.UNSIGNED_SHORT,0)}}}}}}},{"../util/browser":429}],350:[function(t,e,r){"use strict";e.exports=function(t,e,r,n){var i=t.gl;i.enable(i.STENCIL_TEST);for(var a=t.useProgram("collisionbox"),o=0;o<n.length;o++){var s=n[o],l=e.getTile(s),c=l.getBucket(r);if(c){var u=c.bufferGroups.collisionBox;if(u&&u.length){var h=u[0];0!==h.layoutVertexBuffer.length&&(i.uniformMatrix4fv(a.u_matrix,!1,s.posMatrix),t.enableTileClippingMask(s),t.lineWidth(1),i.uniform1f(a.u_scale,Math.pow(2,t.transform.zoom-l.coord.z)),i.uniform1f(a.u_zoom,10*t.transform.zoom),i.uniform1f(a.u_maxzoom,10*(l.coord.z+1)),h.vaos[r.id].bind(i,a,h.layoutVertexBuffer),i.drawArrays(i.LINES,0,h.layoutVertexBuffer.length))}}}}},{}],351:[function(t,e,r){"use strict";var n=t("../lib/debugtext"),i=t("../util/browser"),a=t("gl-matrix").mat4,o=t("../data/bucket").EXTENT,s=t("../data/buffer"),l=t("./vertex_array_object");e.exports=function(t,e,r){if(!t.isOpaquePass&&t.options.debug)for(var c=0;c<r.length;c++)!function(t,e,r){var c=t.gl;c.disable(c.STENCIL_TEST),t.lineWidth(1*i.devicePixelRatio);var u=r.posMatrix,h=t.useProgram("debug");c.uniformMatrix4fv(h.u_matrix,!1,u),c.uniform4f(h.u_color,1,0,0,1),t.debugVAO.bind(c,h,t.debugBuffer),c.drawArrays(c.LINE_STRIP,0,t.debugBuffer.length);for(var f=n(r.toString(),50,200,5),d=new t.PosArray,p=0;p<f.length;p+=2)d.emplaceBack(f[p],f[p+1]);var m=new s(d.serialize(),t.PosArray.serialize(),s.BufferType.VERTEX);(new l).bind(c,h,m),c.uniform4f(h.u_color,1,1,1,1);for(var g=e.getTile(r).tileSize,v=o/(Math.pow(2,t.transform.zoom-r.z)*g),y=[[-1,-1],[-1,1],[1,-1],[1,1]],b=0;b<y.length;b++){var x=y[b];c.uniformMatrix4fv(h.u_matrix,!1,a.translate([],u,[v*x[0],v*x[1],0])),c.drawArrays(c.LINES,0,m.length)}c.uniform4f(h.u_color,0,0,0,1),c.uniformMatrix4fv(h.u_matrix,!1,u),c.drawArrays(c.LINES,0,m.length)}(t,e,r[c])}},{"../data/bucket":332,"../data/buffer":337,"../lib/debugtext":345,"../util/browser":429,"./vertex_array_object":360,"gl-matrix":196}],352:[function(t,e,r){"use strict";function n(t,e,r,n,a,o){var s=a.gl,l=a.spriteAtlas.getPosition(t.from,!0),c=a.spriteAtlas.getPosition(t.to,!0);if(l&&c){s.uniform1i(o.u_image,0),s.uniform2fv(o.u_pattern_tl_a,l.tl),s.uniform2fv(o.u_pattern_br_a,l.br),s.uniform2fv(o.u_pattern_tl_b,c.tl),s.uniform2fv(o.u_pattern_br_b,c.br),s.uniform1f(o.u_opacity,e),s.uniform1f(o.u_mix,t.t),s.uniform1f(o.u_tile_units_to_pixels,1/i(r,1,a.transform.tileZoom)),s.uniform2fv(o.u_pattern_size_a,l.size),s.uniform2fv(o.u_pattern_size_b,c.size),s.uniform1f(o.u_scale_a,t.fromScale),s.uniform1f(o.u_scale_b,t.toScale);var u=r.tileSize*Math.pow(2,a.transform.tileZoom-r.coord.z),h=u*(r.coord.x+n.w*Math.pow(2,r.coord.z)),f=u*r.coord.y;s.uniform2f(o.u_pixel_coord_upper,h>>16,f>>16),s.uniform2f(o.u_pixel_coord_lower,65535&h,65535&f),s.activeTexture(s.TEXTURE0),a.spriteAtlas.bind(s,!0)}}var i=t("../source/pixels_to_tile_units");e.exports=function(t,e,r,i){var a=t.gl;a.enable(a.STENCIL_TEST);var o;if(o=!r.paint["fill-pattern"]&&r.isPaintValueFeatureConstant("fill-color")&&r.isPaintValueFeatureConstant("fill-opacity")&&1===r.paint["fill-color"][3]&&1===r.paint["fill-opacity"],t.isOpaquePass===o){t.setDepthSublayer(1);for(var s=0;s<i.length;s++)!function(t,e,r,i){var a=e.getTile(i),o=a.getBucket(r);if(o){var s=o.bufferGroups.fill;if(s){var l,c=t.gl,u=r.paint["fill-pattern"];if(u)l=t.useProgram("pattern"),n(u,r.paint["fill-opacity"],a,i,t,l),c.activeTexture(c.TEXTURE0),t.spriteAtlas.bind(c,!0);else{var h=o.paintAttributes.fill[r.id];l=t.useProgram("fill",h.defines,h.vertexPragmas,h.fragmentPragmas),o.setUniforms(c,"fill",l,r,{zoom:t.transform.zoom})}c.uniformMatrix4fv(l.u_matrix,!1,t.translatePosMatrix(i.posMatrix,a,r.paint["fill-translate"],r.paint["fill-translate-anchor"])),t.enableTileClippingMask(i);for(var f=0;f<s.length;f++){var d=s[f];d.vaos[r.id].bind(c,l,d.layoutVertexBuffer,d.elementBuffer,d.paintVertexBuffers[r.id]),c.drawElements(c.TRIANGLES,d.elementBuffer.length,c.UNSIGNED_SHORT,0)}}}}(t,e,r,i[s])}if(!t.isOpaquePass&&r.paint["fill-antialias"]){t.lineWidth(2),t.depthMask(!1);var l=r.getPaintProperty("fill-outline-color");!l&&r.paint["fill-pattern"]||!l?t.setDepthSublayer(0):t.setDepthSublayer(2);for(var c=0;c<i.length;c++)!function(t,e,r,i){var a=e.getTile(i),o=a.getBucket(r);if(o){var s,l=t.gl,c=o.bufferGroups.fill,u=r.paint["fill-pattern"],h=r.paint["fill-opacity"],f=r.getPaintProperty("fill-outline-color");if(u&&!f)s=t.useProgram("outlinepattern"),l.uniform2f(s.u_world,l.drawingBufferWidth,l.drawingBufferHeight);else{var d=o.paintAttributes.fill[r.id];s=t.useProgram("outline",d.defines,d.vertexPragmas,d.fragmentPragmas),l.uniform2f(s.u_world,l.drawingBufferWidth,l.drawingBufferHeight),l.uniform1f(s.u_opacity,h),o.setUniforms(l,"fill",s,r,{zoom:t.transform.zoom})}l.uniformMatrix4fv(s.u_matrix,!1,t.translatePosMatrix(i.posMatrix,a,r.paint["fill-translate"],r.paint["fill-translate-anchor"])),u&&n(u,h,a,i,t,s),t.enableTileClippingMask(i);for(var p=0;p<c.length;p++){var m=c[p];m.secondVaos[r.id].bind(l,s,m.layoutVertexBuffer,m.elementBuffer2,m.paintVertexBuffers[r.id]),l.drawElements(l.LINES,2*m.elementBuffer2.length,l.UNSIGNED_SHORT,0)}}}(t,e,r,i[c])}}},{"../source/pixels_to_tile_units":366}],353:[function(t,e,r){"use strict";var n=t("../util/browser"),i=t("gl-matrix").mat2,a=t("../source/pixels_to_tile_units");e.exports=function(t,e,r,o){if(!t.isOpaquePass){t.setDepthSublayer(0),t.depthMask(!1);var s=t.gl;if(s.enable(s.STENCIL_TEST),!(r.paint["line-width"]<=0)){var l=1/n.devicePixelRatio,c=r.paint["line-blur"]+l,u=r.paint["line-color"],h=t.transform,f=i.create();i.scale(f,f,[1,Math.cos(h._pitch)]),i.rotate(f,f,t.transform.angle);var d,p,m,g,v,y=Math.sqrt(h.height*h.height/4*(1+h.altitude*h.altitude)),b=(y+h.height/2*Math.tan(h._pitch))/y-1,x=r.paint["line-dasharray"],_=r.paint["line-pattern"];if(x)d=t.useProgram("linesdfpattern"),s.uniform1f(d.u_linewidth,r.paint["line-width"]/2),s.uniform1f(d.u_gapwidth,r.paint["line-gap-width"]/2),s.uniform1f(d.u_antialiasing,l/2),s.uniform1f(d.u_blur,c),s.uniform4fv(d.u_color,u),s.uniform1f(d.u_opacity,r.paint["line-opacity"]),p=t.lineAtlas.getDash(x.from,"round"===r.layout["line-cap"]),m=t.lineAtlas.getDash(x.to,"round"===r.layout["line-cap"]),s.uniform1i(d.u_image,0),s.activeTexture(s.TEXTURE0),t.lineAtlas.bind(s),s.uniform1f(d.u_tex_y_a,p.y),s.uniform1f(d.u_tex_y_b,m.y),s.uniform1f(d.u_mix,x.t),s.uniform1f(d.u_extra,b),s.uniform1f(d.u_offset,-r.paint["line-offset"]),s.uniformMatrix2fv(d.u_antialiasingmatrix,!1,f);else if(_){if(g=t.spriteAtlas.getPosition(_.from,!0),v=t.spriteAtlas.getPosition(_.to,!0),!g||!v)return;d=t.useProgram("linepattern"),s.uniform1i(d.u_image,0),s.activeTexture(s.TEXTURE0),t.spriteAtlas.bind(s,!0),s.uniform1f(d.u_linewidth,r.paint["line-width"]/2),s.uniform1f(d.u_gapwidth,r.paint["line-gap-width"]/2),s.uniform1f(d.u_antialiasing,l/2),s.uniform1f(d.u_blur,c),s.uniform2fv(d.u_pattern_tl_a,g.tl),s.uniform2fv(d.u_pattern_br_a,g.br),s.uniform2fv(d.u_pattern_tl_b,v.tl),s.uniform2fv(d.u_pattern_br_b,v.br),s.uniform1f(d.u_fade,_.t),s.uniform1f(d.u_opacity,r.paint["line-opacity"]),s.uniform1f(d.u_extra,b),s.uniform1f(d.u_offset,-r.paint["line-offset"]),s.uniformMatrix2fv(d.u_antialiasingmatrix,!1,f)}else d=t.useProgram("line"),s.uniform1f(d.u_linewidth,r.paint["line-width"]/2),s.uniform1f(d.u_gapwidth,r.paint["line-gap-width"]/2),s.uniform1f(d.u_antialiasing,l/2),s.uniform1f(d.u_blur,c),s.uniform1f(d.u_extra,b),s.uniform1f(d.u_offset,-r.paint["line-offset"]),s.uniformMatrix2fv(d.u_antialiasingmatrix,!1,f),s.uniform4fv(d.u_color,u),s.uniform1f(d.u_opacity,r.paint["line-opacity"]);for(var w=0;w<o.length;w++){var M=o[w],k=e.getTile(M),T=k.getBucket(r);if(T){var A=T.bufferGroups.line;if(A){t.enableTileClippingMask(M);var S=t.translatePosMatrix(M.posMatrix,k,r.paint["line-translate"],r.paint["line-translate-anchor"]);s.uniformMatrix4fv(d.u_matrix,!1,S);var E=1/a(k,1,t.transform.zoom);if(x){var L=p.width*x.fromScale,C=m.width*x.toScale,I=[1/a(k,L,t.transform.tileZoom),-p.height/2],z=[1/a(k,C,t.transform.tileZoom),-m.height/2],D=t.lineAtlas.width/(256*Math.min(L,C)*n.devicePixelRatio)/2;s.uniform1f(d.u_ratio,E),s.uniform2fv(d.u_patternscale_a,I),s.uniform2fv(d.u_patternscale_b,z),s.uniform1f(d.u_sdfgamma,D)}else _?(s.uniform1f(d.u_ratio,E),s.uniform2fv(d.u_pattern_size_a,[a(k,g.size[0]*_.fromScale,t.transform.tileZoom),v.size[1]]),s.uniform2fv(d.u_pattern_size_b,[a(k,v.size[0]*_.toScale,t.transform.tileZoom),v.size[1]])):s.uniform1f(d.u_ratio,E);for(var P=0;P<A.length;P++){var O=A[P];O.vaos[r.id].bind(s,d,O.layoutVertexBuffer,O.elementBuffer),s.drawElements(s.TRIANGLES,3*O.elementBuffer.length,s.UNSIGNED_SHORT,0)}}}}}}}},{"../source/pixels_to_tile_units":366,"../util/browser":429,"gl-matrix":196}],354:[function(t,e,r){"use strict";function n(t,e,r,n){if(!t.isOpaquePass){var a=t.gl;a.enable(a.DEPTH_TEST),t.depthMask(!0),a.depthFunc(a.LESS);for(var o=n.length&&n[0].z,s=0;s<n.length;s++){var l=n[s];t.setDepthSublayer(l.z-o),function(t,e,r,n){var a=t.gl;a.disable(a.STENCIL_TEST);var o=e.getTile(n),s=t.transform.calculatePosMatrix(n,e.maxzoom),l=t.useProgram("raster");a.uniformMatrix4fv(l.u_matrix,!1,s),a.uniform1f(l.u_brightness_low,r.paint["raster-brightness-min"]),a.uniform1f(l.u_brightness_high,r.paint["raster-brightness-max"]),a.uniform1f(l.u_saturation_factor,function(t){return t>0?1-1/(1.001-t):-t}(r.paint["raster-saturation"])),a.uniform1f(l.u_contrast_factor,function(t){return t>0?1/(1-t):1+t}(r.paint["raster-contrast"])),a.uniform3fv(l.u_spin_weights,function(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]}(r.paint["raster-hue-rotate"]));var c,u,h=o.source&&o.source.findLoadedParent(n,0,{}),f=function(t,e,r,n){var a=[1,0],o=r.paint["raster-fade-duration"];if(t.source&&o>0){var s=(new Date).getTime(),l=(s-t.timeAdded)/o,c=e?(s-e.timeAdded)/o:-1,u=n.coveringZoomLevel(t.source),h=!!e&&Math.abs(e.coord.z-u)>Math.abs(t.coord.z-u);!e||h?(a[0]=i.clamp(l,0,1),a[1]=1-a[0]):(a[0]=i.clamp(1-c,0,1),a[1]=1-a[0])}var f=r.paint["raster-opacity"];return a[0]*=f,a[1]*=f,a}(o,h,r,t.transform);a.activeTexture(a.TEXTURE0),a.bindTexture(a.TEXTURE_2D,o.texture),a.activeTexture(a.TEXTURE1),h?(a.bindTexture(a.TEXTURE_2D,h.texture),c=Math.pow(2,h.coord.z-o.coord.z),u=[o.coord.x*c%1,o.coord.y*c%1]):(a.bindTexture(a.TEXTURE_2D,o.texture),f[1]=0);a.uniform2fv(l.u_tl_parent,u||[0,0]),a.uniform1f(l.u_scale_parent,c||1),a.uniform1f(l.u_buffer_scale,1),a.uniform1f(l.u_opacity0,f[0]),a.uniform1f(l.u_opacity1,f[1]),a.uniform1i(l.u_image0,0),a.uniform1i(l.u_image1,1);var d=o.boundsBuffer||t.rasterBoundsBuffer;(o.boundsVAO||t.rasterBoundsVAO).bind(a,l,d),a.drawArrays(a.TRIANGLE_STRIP,0,d.length)}(t,e,r,l)}a.depthFunc(a.LEQUAL)}}var i=t("../util/util"),a=t("../util/struct_array");e.exports=n,n.RasterBoundsArray=new a({members:[{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]})},{"../util/struct_array":443,"../util/util":445}],355:[function(t,e,r){"use strict";function n(t,e,r,n,a,s,l,c,u,h,f,d,p,m,g){for(var v=0;v<n.length;v++){var y=e.getTile(n[v]),b=y.getBucket(r);if(b){var x=b.bufferGroups,_=a?x.glyph:x.icon;_.length&&(t.enableTileClippingMask(n[v]),function(t,e,r,n,a,s,l,c,u,h,f,d,p,m,g,v,y,b,x,_,w){var M,k,T,A=t.gl,S=t.transform,E="map"===m,L="map"===g,C=l?24:1,I=v/C;L?(k=o(n,1,t.transform.zoom)*I,T=1/Math.cos(S._pitch),M=[k,k]):(k=t.transform.altitude*I,T=1,M=[S.pixelsToGLUnits[0]*k,S.pixelsToGLUnits[1]*k]);if(!l&&!t.style.sprite.loaded())return;var z=t.useProgram(c?"sdf":"icon");if(A.uniformMatrix4fv(z.u_matrix,!1,t.translatePosMatrix(r,n,d,p)),A.uniform1i(z.u_rotate_with_map,E),A.uniform1i(z.u_pitch_with_map,L),A.uniform2fv(z.u_extrude_scale,M),A.activeTexture(A.TEXTURE0),A.uniform1i(z.u_texture,0),l){var D=f&&t.glyphSource.getGlyphAtlas(f);if(!D)return;D.updateTexture(A),A.uniform2f(z.u_texsize,D.width/4,D.height/4)}else{var P=t.options.rotating||t.options.zooming,O=1!==I||i.devicePixelRatio!==t.spriteAtlas.pixelRatio||u,R=L||t.transform.pitch;t.spriteAtlas.bind(A,c||P||O||R),A.uniform2f(z.u_texsize,t.spriteAtlas.width/4,t.spriteAtlas.height/4)}var F=Math.log(v/h)/Math.LN2||0;A.uniform1f(z.u_zoom,10*(t.transform.zoom-F)),A.activeTexture(A.TEXTURE1),t.frameHistory.bind(A),A.uniform1i(z.u_fadetexture,1);var j;if(c){var N=.105*C/v/i.devicePixelRatio;if(y){A.uniform1f(z.u_gamma,(1.19*x/I/8+N)*T),A.uniform4fv(z.u_color,b),A.uniform1f(z.u_opacity,_),A.uniform1f(z.u_buffer,(6-y/I)/8);for(var B=0;B<s.length;B++)(j=s[B]).vaos[e.id].bind(A,z,j.layoutVertexBuffer,j.elementBuffer),A.drawElements(A.TRIANGLES,3*j.elementBuffer.length,A.UNSIGNED_SHORT,0)}A.uniform1f(z.u_gamma,N*T),A.uniform4fv(z.u_color,w),A.uniform1f(z.u_opacity,_),A.uniform1f(z.u_buffer,.75),A.uniform1f(z.u_pitch,S.pitch/360*2*Math.PI),A.uniform1f(z.u_bearing,S.bearing/360*2*Math.PI),A.uniform1f(z.u_aspect_ratio,S.width/S.height);for(var U=0;U<s.length;U++)(j=s[U]).vaos[e.id].bind(A,z,j.layoutVertexBuffer,j.elementBuffer),A.drawElements(A.TRIANGLES,3*j.elementBuffer.length,A.UNSIGNED_SHORT,0)}else{A.uniform1f(z.u_opacity,_);for(var V=0;V<s.length;V++)(j=s[V]).vaos[e.id].bind(A,z,j.layoutVertexBuffer,j.elementBuffer),A.drawElements(A.TRIANGLES,3*j.elementBuffer.length,A.UNSIGNED_SHORT,0)}}(t,r,n[v].posMatrix,y,0,_,a,a||b.sdfIcons,!a&&b.iconsNeedLinear,a?b.adjustedTextSize:b.adjustedIconSize,b.fontstack,s,l,c,u,h,f,d,p,m,g))}}}var i=t("../util/browser"),a=t("./draw_collision_debug"),o=t("../source/pixels_to_tile_units");e.exports=function(t,e,r,i){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"]),s=t.gl;o?s.disable(s.STENCIL_TEST):s.enable(s.STENCIL_TEST),t.setDepthSublayer(0),t.depthMask(!1),s.disable(s.DEPTH_TEST),n(t,e,r,i,!1,r.paint["icon-translate"],r.paint["icon-translate-anchor"],r.layout["icon-rotation-alignment"],r.layout["icon-rotation-alignment"],r.layout["icon-size"],r.paint["icon-halo-width"],r.paint["icon-halo-color"],r.paint["icon-halo-blur"],r.paint["icon-opacity"],r.paint["icon-color"]),n(t,e,r,i,!0,r.paint["text-translate"],r.paint["text-translate-anchor"],r.layout["text-rotation-alignment"],r.layout["text-pitch-alignment"],r.layout["text-size"],r.paint["text-halo-width"],r.paint["text-halo-color"],r.paint["text-halo-blur"],r.paint["text-opacity"],r.paint["text-color"]),s.enable(s.DEPTH_TEST),e.map.showCollisionBoxes&&a(t,e,r,i)}}},{"../source/pixels_to_tile_units":366,"../util/browser":429,"./draw_collision_debug":350}],356:[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);var r;if((t=Math.floor(10*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;r<256;r++){var n=(e-this.changeTimes[r])/this.fadeDuration*255;this.opacities[r]=r<=t?this.changeOpacities[r]+n:this.changeOpacities[r]-n}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))}},{}],357:[function(t,e,r){"use strict";function n(t,e){this.width=t,this.height=e,this.nextRow=0,this.bytes=4,this.data=new Uint8Array(this.width*this.height*this.bytes),this.positions={}}var i=t("../util/util");e.exports=n,n.prototype.setSprite=function(t){this.sprite=t},n.prototype.getDash=function(t,e){var r=t.join(",")+e;return this.positions[r]||(this.positions[r]=this.addDash(t,e)),this.positions[r]},n.prototype.addDash=function(t,e){var r=e?7:0,n=2*r+1;if(this.nextRow+n>this.height)return i.warnOnce("LineAtlas out of space"),null;for(var a=0,o=0;o<t.length;o++)a+=t[o];for(var s=this.width/a,l=s/2,c=t.length%2==1,u=-r;u<=r;u++)for(var h=this.nextRow+r+u,f=this.width*h,d=c?-t[t.length-1]:0,p=t[0],m=1,g=0;g<this.width;g++){for(;p<g/s;)d=p,p+=t[m],c&&m===t.length-1&&(p+=t[0]),m++;var v,y=Math.abs(g-d*s),b=Math.abs(g-p*s),x=Math.min(y,b),_=m%2==1;if(e){var w=r?u/r*(l+1):0;if(_){var M=l-Math.abs(w);v=Math.sqrt(x*x+M*M)}else v=l-Math.sqrt(x*x+w*w)}else v=(_?1:-1)*x;this.data[3+4*(f+g)]=Math.max(0,Math.min(255,v+128))}var k={y:(this.nextRow+r+.5)/this.height,height:2*r/this.height,width:a};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))}},{"../util/util":445}],358:[function(t,e,r){"use strict";function n(t,e){this.gl=t,this.transform=e,this.reusableTextures={},this.preFbos={},this.frameHistory=new o,this.setup(),this.numSublayers=s.maxUnderzooming+s.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.lineWidthRange=t.getParameter(t.ALIASED_LINE_WIDTH_RANGE)}var i=t("../util/browser"),a=t("gl-matrix").mat4,o=t("./frame_history"),s=t("../source/source_cache"),l=t("../data/bucket").EXTENT,c=t("../source/pixels_to_tile_units"),u=t("../util/util"),h=t("../util/struct_array"),f=t("../data/buffer"),d=t("./vertex_array_object"),p=t("./draw_raster").RasterBoundsArray,m=t("./create_uniform_pragmas");e.exports=n,u.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],a=this._tileClippingMaskIDs[i.id]=r++<<3;e.stencilFunc(e.ALWAYS,a,248);var o=m([{name:"u_color",components:4},{name:"u_opacity",components:1}]),s=this.useProgram("fill",[],o,o);e.uniformMatrix4fv(s.u_matrix,!1,i.posMatrix),this.tileExtentVAO.bind(e,s,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 g={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,a=e[r?e.length-1-n:n],o=this.style.sources[a.source],s=[];if(o){for(s=o.getVisibleCoordinates(),i=0;i<s.length;i++)s[i].posMatrix=this.transform.calculatePosMatrix(s[i],o.maxzoom);this.clearStencil(),o.prepare&&o.prepare(),o.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<a.length;i++){var l=a[r?a.length-1-i:i];this.currentLayer+=r?-1:1,this.renderLayer(this,o,l,s)}o&&g.debug(this,o,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,g[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),o=Math.cos(-this.transform.angle);r=[r[0]*o-r[1]*i,r[0]*i+r[1]*o]}var s=[c(e,r[0],this.transform.zoom),c(e,r[1],this.transform.zoom),0],l=new Float32Array(16);return a.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(u.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);e.blendColor(1/8,1/8,1/8,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":332,"../data/buffer":337,"../source/pixels_to_tile_units":366,"../source/source_cache":370,"../util/browser":429,"../util/struct_array":443,"../util/util":445,"./create_uniform_pragmas":347,"./draw_background":348,"./draw_circle":349,"./draw_debug":351,"./draw_fill":352,"./draw_line":353,"./draw_raster":354,"./draw_symbol":355,"./frame_history":356,"./painter/use_program":359,"./vertex_array_object":360,"gl-matrix":196}],359:[function(t,e,r){"use strict";function n(t,e){return t.replace(/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,function(t,r,n,i,a){return e[r][a].replace(/{type}/g,i).replace(/{precision}/g,n)})}var i=t("assert"),a=t("../../util/util"),o=t("mapbox-gl-shaders"),s=o.util;e.exports._createProgram=function(t,e,r,l){for(var c=this.gl,u=c.createProgram(),h=o[t],f="#define MAPBOX_GL_JS;\n",d=0;d<e.length;d++)f+="#define "+e[d]+";\n";var p=c.createShader(c.FRAGMENT_SHADER);c.shaderSource(p,n(f+h.fragmentSource,l)),c.compileShader(p),i(c.getShaderParameter(p,c.COMPILE_STATUS),c.getShaderInfoLog(p)),c.attachShader(u,p);var m=c.createShader(c.VERTEX_SHADER);c.shaderSource(m,n(f+s+h.vertexSource,r)),c.compileShader(m),i(c.getShaderParameter(m,c.COMPILE_STATUS),c.getShaderInfoLog(m)),c.attachShader(u,m),c.linkProgram(u),i(c.getProgramParameter(u,c.LINK_STATUS),c.getProgramInfoLog(u));for(var g={},v=c.getProgramParameter(u,c.ACTIVE_ATTRIBUTES),y=0;y<v;y++){var b=c.getActiveAttrib(u,y);g[b.name]=c.getAttribLocation(u,b.name)}for(var x={},_=c.getProgramParameter(u,c.ACTIVE_UNIFORMS),w=0;w<_;w++){var M=c.getActiveUniform(u,w);x[M.name]=c.getUniformLocation(u,M.name)}return a.extend({program:u,definition:h,attributes:g,numAttributes:v},g,x)},e.exports._createProgramCached=function(t,e,r,n){this.cache=this.cache||{};var i=JSON.stringify({name:t,defines:e,vertexPragmas:r,fragmentPragmas:n});return this.cache[i]||(this.cache[i]=this._createProgram(t,e,r,n)),this.cache[i]},e.exports.useProgram=function(t,e,r,n){var i=this.gl;e=e||[],this._showOverdrawInspector&&(e=e.concat("OVERDRAW_INSPECTOR"));var a=this._createProgramCached(t,e,r,n);return this.currentProgram!==a&&(i.useProgram(a.program),this.currentProgram=a),a}},{"../../util/util":445,assert:50,"mapbox-gl-shaders":306}],360:[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,n.prototype.bind=function(t,e,r,n,i){void 0===t.extVertexArrayObject&&(t.extVertexArrayObject=t.getExtension("OES_vertex_array_object"));var a=!this.vao||this.boundProgram!==e||this.boundVertexBuffer!==r||this.boundVertexBuffer2!==i||this.boundElementBuffer!==n;!t.extVertexArrayObject||a?this.freshBind(t,e,r,n,i):t.extVertexArrayObject.bindVertexArrayOES(this.vao)},n.prototype.freshBind=function(t,e,r,n,a){var o,s=e.numAttributes;if(t.extVertexArrayObject)this.vao&&this.destroy(t),this.vao=t.extVertexArrayObject.createVertexArrayOES(),t.extVertexArrayObject.bindVertexArrayOES(this.vao),o=0,this.boundProgram=e,this.boundVertexBuffer=r,this.boundVertexBuffer2=a,this.boundElementBuffer=n;else{o=t.currentNumAttributes||0;for(var l=s;l<o;l++)i(0!==l),t.disableVertexAttribArray(l)}for(var c=o;c<s;c++)t.enableVertexAttribArray(c);r.bind(t),r.setVertexAttribPointers(t,e),a&&(a.bind(t),a.setVertexAttribPointers(t,e)),n&&n.bind(t),t.currentNumAttributes=s},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:50}],361:[function(t,e,r){"use strict";function n(t,e,r){e=e||{},this.id=t,this.dispatcher=r,this._data=e.data,void 0!==e.maxzoom&&(this.maxzoom=e.maxzoom),e.type&&(this.type=e.type);var n=s/this.tileSize;this.workerOptions=a.extend({source:this.id,cluster:e.cluster||!1,geojsonVtOptions:{buffer:(void 0!==e.buffer?e.buffer:128)*n,tolerance:(void 0!==e.tolerance?e.tolerance:.375)*n,extent:s,maxZoom:this.maxzoom},superclusterOptions:{maxZoom:Math.min(e.clusterMaxZoom,this.maxzoom-1)||this.maxzoom-1,extent:s,radius:(e.clusterRadius||50)*n,log:!1}},e.workerOptions),this._updateWorkerData(function(t){t?this.fire("error",{error:t}):this.fire("load")}.bind(this))}var i=t("../util/evented"),a=t("../util/util"),o=t("resolve-url"),s=t("../data/bucket").EXTENT;e.exports=n,n.prototype=a.inherit(i,{type:"geojson",minzoom:0,maxzoom:18,tileSize:512,isTileClipped:!0,reparseOverscaled:!0,onAdd:function(t){this.map=t},setData:function(t){return this._data=t,this._updateWorkerData(function(t){if(t)return this.fire("error",{error:t});this.fire("change")}.bind(this)),this},_updateWorkerData:function(t){var e=a.extend({},this.workerOptions),r=this._data;"string"==typeof r?e.url="undefined"!=typeof window?o(window.location.href,r):r:e.data=JSON.stringify(r),this.workerID=this.dispatcher.send(this.type+".loadData",e,function(e){this._loaded=!0,t(e)}.bind(this))},loadTile:function(t,e){var r=t.coord.z>this.maxzoom?Math.pow(2,t.coord.z-this.maxzoom):1,n={type:this.type,uid:t.uid,coord:t.coord,zoom:t.coord.z,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,overscaling:r,angle:this.map.transform.angle,pitch:this.map.transform.pitch,showCollisionBoxes:this.map.showCollisionBoxes};t.workerID=this.dispatcher.send("load tile",n,function(r,n){if(t.unloadVectorData(this.map.painter),!t.aborted)return r?e(r):(t.loadVectorData(n,this.map.style),t.redoWhenDone&&(t.redoWhenDone=!1,t.redoPlacement(this)),e(null))}.bind(this),this.workerID)},abortTile:function(t){t.aborted=!0},unloadTile:function(t){t.unloadVectorData(this.map.painter),this.dispatcher.send("remove tile",{uid:t.uid,source:this.id},function(){},t.workerID)},serialize:function(){return{type:this.type,data:this._data}}})},{"../data/bucket":332,"../util/evented":437,"../util/util":445,"resolve-url":512}],362:[function(t,e,r){"use strict";function n(t,e,r){r&&(this.loadGeoJSON=r),h.call(this,t,e)}var i=t("../util/util"),a=t("../util/ajax"),o=t("geojson-rewind"),s=t("./geojson_wrapper"),l=t("vt-pbf"),c=t("supercluster"),u=t("geojson-vt"),h=t("./vector_tile_worker_source");e.exports=n,n.prototype=i.inherit(h,{_geoJSONIndexes:{},loadVectorData:function(t,e){var r=t.source,n=t.coord;if(!this._geoJSONIndexes[r])return e(null,null);var i=this._geoJSONIndexes[r].getTile(Math.min(n.z,t.maxZoom),n.x,n.y);if(!i)return e(null,null);var a=new s(i.features);a.name="_geojsonTileLayer";var o=l({layers:{_geojsonTileLayer:a}});0===o.byteOffset&&o.byteLength===o.buffer.byteLength||(o=new Uint8Array(o)),e(null,{tile:a,rawTileData:o.buffer})},loadData:function(t,e){var r=function(r,n){return r?e(r):"object"!=typeof n?e(new Error("Input data is not a valid GeoJSON object.")):(o(n,!0),void this._indexData(n,t,function(r,n){if(r)return e(r);this._geoJSONIndexes[t.source]=n,e(null)}.bind(this)))}.bind(this);this.loadGeoJSON(t,r)},loadGeoJSON:function(t,e){if(t.url)a.getJSON(t.url,e);else{if("string"!=typeof t.data)return e(new Error("Input data is not a valid GeoJSON object."));try{return e(null,JSON.parse(t.data))}catch(t){return e(new Error("Input data is not a valid GeoJSON object."))}}},_indexData:function(t,e,r){try{e.cluster?r(null,c(e.superclusterOptions).load(t.features)):r(null,u(t,e.geojsonVtOptions))}catch(t){return r(t)}}})},{"../util/ajax":428,"../util/util":445,"./geojson_wrapper":363,"./vector_tile_worker_source":374,"geojson-rewind":141,"geojson-vt":145,supercluster:540,"vt-pbf":567}],363:[function(t,e,r){"use strict";function n(t){this.features=t,this.length=t.length,this.extent=s}function i(t){if(this.type=t.type,1===t.type){this.rawGeometry=[];for(var e=0;e<t.geometry.length;e++)this.rawGeometry.push([t.geometry[e]])}else this.rawGeometry=t.geometry;this.properties=t.tags,this.extent=s}var a=t("point-geometry"),o=t("vector-tile").VectorTileFeature,s=t("../data/bucket").EXTENT;e.exports=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 a(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,a=0;a<t.length;a++)for(var o=t[a],s=0;s<o.length;s++){var l=o[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=o.prototype.toGeoJSON},{"../data/bucket":332,"point-geometry":487,"vector-tile":561}],364:[function(t,e,r){"use strict";function n(t,e,r){this.id=t,this.dispatcher=r,this.url=e.url,this.coordinates=e.coordinates,c.getImage(e.url,function(t,r){if(t)return this.fire("error",{error:t});this.image=r,this.image.addEventListener("load",function(){this.map._rerender()}.bind(this)),this._loaded=!0,this.fire("load"),this.map&&this.setCoordinates(e.coordinates)}.bind(this))}var i=t("../util/util"),a=t("./tile_coord"),o=t("../geo/lng_lat"),s=t("point-geometry"),l=t("../util/evented"),c=t("../util/ajax"),u=t("../data/bucket").EXTENT,h=t("../render/draw_raster").RasterBoundsArray,f=t("../data/buffer"),d=t("../render/vertex_array_object");e.exports=n,n.prototype=i.inherit(l,{minzoom:0,maxzoom:22,tileSize:512,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(o.convert(t)).zoomTo(0)}),n=this.centerCoord=i.getCoordinatesCenter(r);return n.column=Math.round(n.column),n.row=Math.round(n.row),this.minzoom=this.maxzoom=n.zoom,this._coord=new a(n.zoom,n.column,n.row),this._tileCoords=r.map(function(t){var e=t.zoomTo(n.zoom);return new s(Math.round((e.column-n.column)*u),Math.round((e.row-n.row)*u))}),this.fire("change"),this},_setTile:function(t){this._prepared=!1,this.tile=t;var e=new h;e.emplaceBack(this._tileCoords[0].x,this._tileCoords[0].y,0,0),e.emplaceBack(this._tileCoords[1].x,this._tileCoords[1].y,32767,0),e.emplaceBack(this._tileCoords[3].x,this._tileCoords[3].y,0,32767),e.emplaceBack(this._tileCoords[2].x,this._tileCoords[2].y,32767,32767),this.tile.buckets={},this.tile.boundsBuffer=new f(e.serialize(),h.serialize(),f.BufferType.VERTEX),this.tile.boundsVAO=new d,this.tile.state="loaded"},prepare:function(){if(this._loaded&&this.image&&this.image.complete&&this.tile){var t=this.map.painter.gl;this._prepared?(t.bindTexture(t.TEXTURE_2D,this.tile.texture),t.texSubImage2D(t.TEXTURE_2D,0,0,0,t.RGBA,t.UNSIGNED_BYTE,this.image)):(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.image))}},loadTile:function(t,e){this._coord&&this._coord.toString()===t.coord.toString()?(this._setTile(t),e(null)):(t.state="errored",e(null))},serialize:function(){return{type:"image",urls:this.url,coordinates:this.coordinates}}})},{"../data/bucket":332,"../data/buffer":337,"../geo/lng_lat":342,"../render/draw_raster":354,"../render/vertex_array_object":360,"../util/ajax":428,"../util/evented":437,"../util/util":445,"./tile_coord":372,"point-geometry":487}],365:[function(t,e,r){"use strict";var n=t("../util/util"),i=t("../util/ajax"),a=t("../util/browser"),o=t("../util/mapbox").normalizeSourceURL;e.exports=function(t,e){var r=function(t,r){if(t)return e(t);var i=n.pick(r,["tiles","minzoom","maxzoom","attribution"]);r.vector_layers&&(i.vectorLayers=r.vector_layers,i.vectorLayerIds=i.vectorLayers.map(function(t){return t.id})),e(null,i)};t.url?i.getJSON(o(t.url),r):a.frame(r.bind(null,null,t))}},{"../util/ajax":428,"../util/browser":429,"../util/mapbox":442,"../util/util":445}],366:[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":332}],367:[function(t,e,r){"use strict";function n(t,e){var r=t.coord,n=e.coord;return r.z-n.z||r.y-n.y||r.w-n.w||r.x-n.x}var i=t("./tile_coord");r.rendered=function(t,e,r,i,a,o){var s=t.tilesIn(r);s.sort(n);for(var l=[],c=0;c<s.length;c++){var u=s[c];u.tile.featureIndex&&l.push(u.tile.featureIndex.query({queryGeometry:u.queryGeometry,scale:u.scale,tileSize:u.tile.tileSize,bearing:o,params:i},e))}return function(t){for(var e=t[0]||{},r=1;r<t.length;r++){var n=t[r];for(var i in n){var a=n[i],o=e[i];if(void 0===o)o=e[i]=a;else for(var s=0;s<a.length;s++)o.push(a[s])}}return e}(l)},r.source=function(t,e){for(var r=t.getRenderableIds().map(function(e){return t.getTileByID(e)}),n=[],a={},o=0;o<r.length;o++){var s=r[o],l=new i(Math.min(s.sourceMaxZoom,s.coord.z),s.coord.x,s.coord.y,0).id;a[l]||(a[l]=!0,s.querySourceFeatures(n,e))}return n}},{"./tile_coord":372}],368:[function(t,e,r){"use strict";function n(t,e,r){this.id=t,this.dispatcher=r,i.extend(this,i.pick(e,["url","scheme","tileSize"])),s(e,function(t,e){if(t)return this.fire("error",t);i.extend(this,e),this.fire("load")}.bind(this))}var i=t("../util/util"),a=t("../util/ajax"),o=t("../util/evented"),s=t("./load_tilejson"),l=t("../util/mapbox").normalizeTileURL;e.exports=n,n.prototype=i.inherit(o,{minzoom:0,maxzoom:22,roundZoom:!0,scheme:"xyz",tileSize:512,_loaded:!1,onAdd:function(t){this.map=t},serialize:function(){return{type:"raster",url:this.url,tileSize:this.tileSize}},loadTile:function(t,e){var r=l(t.coord.url(this.tiles,null,this.scheme),this.url,this.tileSize);t.request=a.getImage(r,function(r,n){if(delete t.request,!t.aborted){if(r)return e(r);var i=this.map.painter.gl;t.texture=this.map.painter.getTexture(n.width),t.texture?(i.bindTexture(i.TEXTURE_2D,t.texture),i.texSubImage2D(i.TEXTURE_2D,0,0,0,i.RGBA,i.UNSIGNED_BYTE,n)):(t.texture=i.createTexture(),i.bindTexture(i.TEXTURE_2D,t.texture),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.LINEAR_MIPMAP_NEAREST),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,i.RGBA,i.UNSIGNED_BYTE,n),t.texture.size=n.width),i.generateMipmap(i.TEXTURE_2D),this.map.animationLoop.set(this.map.style.rasterFadeDuration),t.state="loaded",e(null)}}.bind(this))},abortTile:function(t){t.request&&(t.request.abort(),delete t.request)},unloadTile:function(t){t.texture&&this.map.painter.saveTexture(t.texture)}})},{"../util/ajax":428,"../util/evented":437,"../util/mapbox":442,"../util/util":445,"./load_tilejson":365}],369:[function(t,e,r){"use strict";var n=t("../util/util"),i={vector:t("../source/vector_tile_source"),raster:t("../source/raster_tile_source"),geojson:t("../source/geojson_source"),video:t("../source/video_source"),image:t("../source/image_source")};r.create=function(t,e,r){if((e=new i[e.type](t,e,r)).id!==t)throw new Error("Expected Source id to be "+t+" instead of "+e.id);return n.bindAll(["load","abort","unload","serialize","prepare"],e),e},r.getType=function(t){return i[t]},r.setType=function(t,e){i[t]=e}},{"../source/geojson_source":361,"../source/image_source":364,"../source/raster_tile_source":368,"../source/vector_tile_source":373,"../source/video_source":375,"../util/util":445}],370:[function(t,e,r){"use strict";function n(t,e,r){this.id=t,this.dispatcher=r;var n=this._source=o.create(t,e,r).on("load",function(){this.map&&this._source.onAdd&&this._source.onAdd(this.map),this._sourceLoaded=!0,this.tileSize=n.tileSize,this.minzoom=n.minzoom,this.maxzoom=n.maxzoom,this.roundZoom=n.roundZoom,this.reparseOverscaled=n.reparseOverscaled,this.isTileClipped=n.isTileClipped,this.attribution=n.attribution,this.vectorLayerIds=n.vectorLayerIds,this.fire("load")}.bind(this)).on("error",function(t){this._sourceErrored=!0,this.fire("error",t)}.bind(this)).on("change",function(){this.reload(),this.transform&&this.update(this.transform,this.map&&this.map.style.rasterFadeDuration),this.fire("change")}.bind(this));this._tiles={},this._cache=new u(0,this.unloadTile.bind(this)),this._isIdRenderable=this._isIdRenderable.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)))*d,y:(n.row-t.y)*d}}function a(t,e){return t%32-e%32}var o=t("./source"),s=t("./tile"),l=t("../util/evented"),c=t("./tile_coord"),u=t("../util/lru_cache"),h=t("../geo/coordinate"),f=t("../util/util"),d=t("../data/bucket").EXTENT;e.exports=n,n.maxOverzooming=10,n.maxUnderzooming=3,n.prototype=f.inherit(l,{onAdd:function(t){this.map=t,this._source&&this._source.onAdd&&this._source.onAdd(t)},loaded:function(){if(this._sourceErrored)return!0;if(!this._sourceLoaded)return!1;for(var t in this._tiles){var e=this._tiles[t];if("loaded"!==e.state&&"errored"!==e.state)return!1}return!0},getSource:function(){return this._source},loadTile:function(t,e){return this._source.loadTile(t,e)},unloadTile:function(t){if(this._source.unloadTile)return this._source.unloadTile(t)},abortTile:function(t){if(this._source.abortTile)return this._source.abortTile(t)},serialize:function(){return this._source.serialize()},prepare:function(){if(this._sourceLoaded&&this._source.prepare)return this._source.prepare()},getIds:function(){return Object.keys(this._tiles).map(Number).sort(a)},getRenderableIds:function(){return this.getIds().filter(this._isIdRenderable)},_isIdRenderable:function(t){return this._tiles[t].isRenderable()&&!this._coveredTiles[t]},reload:function(){this._cache.reset();for(var t in this._tiles){var e=this._tiles[t];"loading"!==e.state&&(e.state="reloading"),this.loadTile(this._tiles[t],this._tileLoaded.bind(this,this._tiles[t]))}},_tileLoaded:function(t,e){if(e)return t.state="errored",this.fire("tile.error",{tile:t,error:e}),void this._source.fire("tile.error",{tile:t,error:e});t.source=this,t.timeAdded=(new Date).getTime(),this.fire("tile.load",{tile:t}),this._source.fire("tile.load",{tile:t})},getTile:function(t){return this.getTileByID(t.id)},getTileByID:function(t){return this._tiles[t]},getZoom:function(t){return t.zoom+t.scaleZoom(t.tileSize/this.tileSize)},findLoadedChildren:function(t,e,r){var n=!1;for(var i in this._tiles){var a=this._tiles[i];if(!(r[i]||!a.isRenderable()||a.coord.z<=t.z||a.coord.z>e)){var o=Math.pow(2,Math.min(a.coord.z,this.maxzoom)-Math.min(t.z,this.maxzoom));if(Math.floor(a.coord.x/o)===t.x&&Math.floor(a.coord.y/o)===t.y)for(r[i]=!0,n=!0;a&&a.coord.z-1>t.z;){var s=a.coord.parent(this.maxzoom).id;(a=this._tiles[s])&&a.isRenderable()&&(delete r[i],r[s]=!0)}}}return n},findLoadedParent:function(t,e,r){for(var n=t.z-1;n>=e;n--){t=t.parent(this.maxzoom);var i=this._tiles[t.id];if(i&&i.isRenderable())return r[t.id]=!0,i;if(this._cache.has(t.id))return this.addTile(t),r[t.id]=!0,this._tiles[t.id]}},updateCacheSize:function(t){var e=(Math.ceil(t.width/t.tileSize)+1)*(Math.ceil(t.height/t.tileSize)+1);this._cache.setMaxSize(Math.floor(5*e))},update:function(t,e){if(this._sourceLoaded){var r,i,a;this.updateCacheSize(t);var o=(this.roundZoom?Math.round:Math.floor)(this.getZoom(t)),s=Math.max(o-n.maxOverzooming,this.minzoom),l=Math.max(o+n.maxUnderzooming,this.minzoom),u={},h=(new Date).getTime();this._coveredTiles={};var d=this.used?t.coveringTiles(this._source):[];for(r=0;r<d.length;r++)i=d[r],a=this.addTile(i),u[i.id]=!0,a.isRenderable()||this.findLoadedChildren(i,l,u)||this.findLoadedParent(i,s,u);for(var p={},m=Object.keys(u),g=0;g<m.length;g++){var v=m[g];i=c.fromID(v),(a=this._tiles[v])&&a.timeAdded>h-(e||0)&&(this.findLoadedChildren(i,l,u)&&(u[v]=!0),this.findLoadedParent(i,s,p))}var y;for(y in p)u[y]||(this._coveredTiles[y]=!0);for(y in p)u[y]=!0;var b=f.keysDifference(this._tiles,u);for(r=0;r<b.length;r++)this.removeTile(+b[r]);this.transform=t}},addTile:function(t){var e=this._tiles[t.id];if(e)return e;var r=t.wrapped();if((e=this._tiles[r.id])||(e=this._cache.get(r.id))&&this._redoPlacement&&this._redoPlacement(e),!e){var n=t.z,i=n>this.maxzoom?Math.pow(2,n-this.maxzoom):1;e=new s(r,this.tileSize*i,this.maxzoom),this.loadTile(e,this._tileLoaded.bind(this,e))}return e.uses++,this._tiles[t.id]=e,this.fire("tile.add",{tile:e}),this._source.fire("tile.add",{tile:e}),e},removeTile:function(t){var e=this._tiles[t];e&&(e.uses--,delete this._tiles[t],this.fire("tile.remove",{tile:e}),this._source.fire("tile.remove",{tile:e}),e.uses>0||(e.isRenderable()?this._cache.add(e.coord.wrapped().id,e):(e.aborted=!0,this.abortTile(e),this.unloadTile(e))))},clearTiles:function(){for(var t in this._tiles)this.removeTile(t);this._cache.reset()},tilesIn:function(t){for(var e={},r=this.getIds(),n=1/0,a=1/0,o=-1/0,s=-1/0,l=t[0].zoom,u=0;u<t.length;u++){var f=t[u];n=Math.min(n,f.column),a=Math.min(a,f.row),o=Math.max(o,f.column),s=Math.max(s,f.row)}for(var p=0;p<r.length;p++){var m=this._tiles[r[p]],g=c.fromID(r[p]),v=[i(g,m.sourceMaxZoom,new h(n,a,l)),i(g,m.sourceMaxZoom,new h(o,s,l))];if(v[0].x<d&&v[0].y<d&&v[1].x>=0&&v[1].y>=0){for(var y=[],b=0;b<t.length;b++)y.push(i(g,m.sourceMaxZoom,t[b]));var x=e[m.coord.id];void 0===x&&(x=e[m.coord.id]={tile:m,coord:g,queryGeometry:[],scale:Math.pow(2,this.transform.zoom-m.coord.z)}),x.queryGeometry.push(y)}}var _=[];for(var w in e)_.push(e[w]);return _},redoPlacement:function(){for(var t=this.getIds(),e=0;e<t.length;e++){this.getTileByID(t[e]).redoPlacement(this)}},getVisibleCoordinates:function(){return this.getRenderableIds().map(c.fromID)}})},{"../data/bucket":332,"../geo/coordinate":341,"../util/evented":437,"../util/lru_cache":441,"../util/util":445,"./source":369,"./tile":371,"./tile_coord":372}],371:[function(t,e,r){"use strict";function n(t,e,r){this.coord=t,this.uid=a.uniqueId(),this.uses=0,this.tileSize=e,this.sourceMaxZoom=r,this.buckets={},this.state="loading"}function i(t,e){if(e){for(var r={},n=0;n<t.length;n++){var i=e.getLayer(t[n].layerId);if(i){var s=o.create(a.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 a=t("../util/util"),o=t("../data/bucket"),s=t("../data/feature_index"),l=t("vector-tile"),c=t("pbf"),u=t("../util/vectortile_to_geojson"),h=t("feature-filter"),f=t("../symbol/collision_tile"),d=t("../symbol/collision_box"),p=t("../symbol/symbol_instances"),m=t("../symbol/symbol_quads");e.exports=n,n.prototype={loadVectorData:function(t,e){this.state="loaded",t&&(this.collisionBoxArray=new d(t.collisionBoxArray),this.collisionTile=new f(t.collisionTile,this.collisionBoxArray),this.symbolInstancesArray=new p(t.symbolInstancesArray),this.symbolQuadsArray=new m(t.symbolQuadsArray),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("unloaded"!==this.state){this.collisionTile=new f(t.collisionTile,this.collisionBoxArray),this.featureIndex.setCollisionTile(this.collisionTile);for(var n in this.buckets){var o=this.buckets[n];"symbol"===o.type&&(o.destroy(e.gl),delete this.buckets[n])}a.extend(this.buckets,i(t.buckets,r))}},unloadVectorData:function(t){for(var e in this.buckets){this.buckets[e].destroy(t.gl)}this.collisionBoxArray=null,this.symbolQuadsArray=null,this.symbolInstancesArray=null,this.collisionTile=null,this.featureIndex=null,this.rawTileData=null,this.buckets=null,this.state="unloaded"},redoPlacement:function(t){"loaded"===this.state&&"reloading"!==this.state?(this.state="reloading",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},function(e,r){this.reloadSymbolData(r,t.map.painter,t.map.style),t.fire("tile.load",{tile:this}),this.state="loaded",this.redoWhenDone&&(this.redoPlacement(t),this.redoWhenDone=!1)}.bind(this),this.workerID)):this.redoWhenDone=!0},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 c(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},a=0;a<r.length;a++){var o=r.feature(a);if(n(o)){var s=new u(o,this.coord.z,this.coord.x,this.coord.y);s.tile=i,t.push(s)}}}},isRenderable:function(){return"loaded"===this.state||"reloading"===this.state}}},{"../data/bucket":332,"../data/feature_index":339,"../symbol/collision_box":397,"../symbol/collision_tile":399,"../symbol/symbol_instances":408,"../symbol/symbol_quads":409,"../util/util":445,"../util/vectortile_to_geojson":446,"feature-filter":135,pbf:481,"vector-tile":561}],372:[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=-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 a(t,e,r,n,i){var a=Math.max(r,Math.floor(e.y0)),o=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,c=e.dx/e.dy,u=t.dx>0,h=e.dx<0,f=a;f<o;f++){var d=l*Math.max(0,Math.min(t.dy,f+u-t.y0))+t.x0,p=c*Math.max(0,Math.min(e.dy,f+h-e.y0))+e.x0;i(Math.floor(p),Math.ceil(d),f)}}function o(t,e,r,n,o,s){var l,c=i(t,e),u=i(e,r),h=i(r,t);c.dy>u.dy&&(l=c,c=u,u=l),c.dy>h.dy&&(l=c,c=h,h=l),u.dy>h.dy&&(l=u,u=h,h=l),c.dy&&a(h,c,n,o,s),u.dy&&a(h,u,n,o,s)}var s=t("assert"),l=t("whoots-js"),c=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 c(i,n,e)},n.fromID=function(t){var e=t%32,r=1<<e,i=(t-e)/32,a=i%r,o=(i-a)/r%r,s=Math.floor(i/(r*r));return s%2!=0&&(s=-1*s-1),s/=2,new n(e,a,o,s)},n.prototype.url=function(t,e,r){var n=l.getTileBBox(this.x,this.y,this.z),i=function(t,e,r){for(var n,i="",a=t;a>0;a--)i+=(e&(n=1<<a-1)?1:0)+(r&n?2:0);return i}(this.z,this.x,this.y);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}","tms"===r?Math.pow(2,this.z)-this.y-1:this.y).replace("{quadkey}",i).replace("{bbox-epsg-3857}",n)},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 o,l;if(i>=0&&i<=a)for(o=t;o<e;o++)l=new n(r,(o%a+a)%a,i,Math.floor(o/a)),s[l.id]=l}var a=1<<t,s={};return o(e[0],e[1],e[2],0,a,i),o(e[2],e[3],e[0],0,a,i),Object.keys(s).map(function(t){return s[t]})}},{"../geo/coordinate":341,assert:50,"whoots-js":577}],373:[function(t,e,r){"use strict";function n(t,e,r){if(this.id=t,this.dispatcher=r,a.extend(this,a.pick(e,["url","scheme","tileSize"])),this._options=a.extend({type:"vector"},e),512!==this.tileSize)throw new Error("vector tile sources must have a tileSize of 512");o(e,function(t,e){t?this.fire("error",t):(a.extend(this,e),this.fire("load"))}.bind(this))}var i=t("../util/evented"),a=t("../util/util"),o=t("./load_tilejson"),s=t("../util/mapbox").normalizeTileURL;e.exports=n,n.prototype=a.inherit(i,{minzoom:0,maxzoom:22,scheme:"xyz",tileSize:512,reparseOverscaled:!0,isTileClipped:!0,onAdd:function(t){this.map=t},serialize:function(){return a.extend({},this._options)},loadTile:function(t,e){function r(r,n){if(!t.aborted){if(r)return e(r);t.loadVectorData(n,this.map.style),t.redoWhenDone&&(t.redoWhenDone=!1,t.redoPlacement(this)),e(null),t.reloadCallback&&(this.loadTile(t,t.reloadCallback),t.reloadCallback=null)}}var n=t.coord.z>this.maxzoom?Math.pow(2,t.coord.z-this.maxzoom):1,i={url:s(t.coord.url(this.tiles,this.maxzoom,this.scheme),this.url),uid:t.uid,coord:t.coord,zoom:t.coord.z,tileSize:this.tileSize*n,source:this.id,overscaling:n,angle:this.map.transform.angle,pitch:this.map.transform.pitch,showCollisionBoxes:this.map.showCollisionBoxes};t.workerID?"loading"===t.state?t.reloadCallback=e:(i.rawTileData=t.rawTileData,this.dispatcher.send("reload tile",i,r.bind(this),t.workerID)):t.workerID=this.dispatcher.send("load tile",i,r.bind(this))},abortTile:function(t){this.dispatcher.send("abort tile",{uid:t.uid,source:this.id},null,t.workerID)},unloadTile:function(t){t.unloadVectorData(this.map.painter),this.dispatcher.send("remove tile",{uid:t.uid,source:this.id},null,t.workerID)}})},{"../util/evented":437,"../util/mapbox":442,"../util/util":445,"./load_tilejson":365}],374:[function(t,e,r){"use strict";function n(t,e,r){this.actor=t,this.styleLayers=e,r&&(this.loadVectorData=r),this.loading={},this.loaded={}}var i=t("../util/ajax"),a=t("vector-tile"),o=t("pbf"),s=t("./worker_tile");e.exports=n,n.prototype={loadTile:function(t,e){var r=t.source,n=t.uid;this.loading[r]||(this.loading[r]={});var i=this.loading[r][n]=new s(t);i.abort=this.loadVectorData(t,function(t,a){return delete this.loading[r][n],t?e(t):a?(i.data=a.tile,i.parse(i.data,this.styleLayers.getLayerFamilies(),this.actor,a.rawTileData,e),this.loaded[r]=this.loaded[r]||{},void(this.loaded[r][n]=i)):e(null,null)}.bind(this))},reloadTile:function(t,e){var r=this.loaded[t.source],n=t.uid;if(r&&r[n]){var i=r[n];i.parse(i.data,this.styleLayers.getLayerFamilies(),this.actor,t.rawTileData,e)}},abortTile:function(t){var e=this.loading[t.source],r=t.uid;e&&e[r]&&e[r].abort&&(e[r].abort(),delete e[r])},removeTile:function(t){var e=this.loaded[t.source],r=t.uid;e&&e[r]&&delete e[r]},loadVectorData:function(t,e){var r=i.getArrayBuffer(t.url,function(t,r){if(t)return e(t);var n=new a.VectorTile(new o(new Uint8Array(r)));e(t,{tile:n,rawTileData:r})}.bind(this));return function(){r.abort()}},redoPlacement:function(t,e){var r=this.loaded[t.source],n=this.loading[t.source],i=t.uid;if(r&&r[i]){var a=r[i].redoPlacement(t.angle,t.pitch,t.showCollisionBoxes);a.result&&e(null,a.result,a.transferables)}else n&&n[i]&&(n[i].angle=t.angle)}}},{"../util/ajax":428,"./worker_tile":377,pbf:481,"vector-tile":561}],375:[function(t,e,r){"use strict";function n(t,e){this.id=t,this.urls=e.urls,this.coordinates=e.coordinates,c.getVideo(e.urls,function(t,r){if(t)return this.fire("error",{error:t});this.video=r,this.video.loop=!0;var n;this.video.addEventListener("playing",function(){n=this.map.style.animationLoop.set(1/0),this.map._rerender()}.bind(this)),this.video.addEventListener("pause",function(){this.map.style.animationLoop.cancel(n)}.bind(this)),this.map&&(this.video.play(),this.setCoordinates(e.coordinates)),this.fire("load")}.bind(this))}var i=t("../util/util"),a=t("./tile_coord"),o=t("../geo/lng_lat"),s=t("point-geometry"),l=t("../util/evented"),c=t("../util/ajax"),u=t("../data/bucket").EXTENT,h=t("../render/draw_raster").RasterBoundsArray,f=t("../data/buffer"),d=t("../render/vertex_array_object");e.exports=n,n.prototype=i.inherit(l,{minzoom:0,maxzoom:22,tileSize:512,roundZoom:!0,getVideo:function(){return this.video},onAdd:function(t){this.map||(this.map=t,this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))},setCoordinates:function(t){this.coordinates=t;var e=this.map,r=t.map(function(t){return e.transform.locationCoordinate(o.convert(t)).zoomTo(0)}),n=this.centerCoord=i.getCoordinatesCenter(r);return n.column=Math.round(n.column),n.row=Math.round(n.row),this.minzoom=this.maxzoom=n.zoom,this._coord=new a(n.zoom,n.column,n.row),this._tileCoords=r.map(function(t){var e=t.zoomTo(n.zoom);return new s(Math.round((e.column-n.column)*u),Math.round((e.row-n.row)*u))}),this.fire("change"),this},_setTile:function(t){this._prepared=!1,this.tile=t;var e=new h;e.emplaceBack(this._tileCoords[0].x,this._tileCoords[0].y,0,0),e.emplaceBack(this._tileCoords[1].x,this._tileCoords[1].y,32767,0),e.emplaceBack(this._tileCoords[3].x,this._tileCoords[3].y,0,32767),e.emplaceBack(this._tileCoords[2].x,this._tileCoords[2].y,32767,32767),this.tile.buckets={},this.tile.boundsBuffer=new f(e.serialize(),h.serialize(),f.BufferType.VERTEX),this.tile.boundsVAO=new d,this.tile.state="loaded"},prepare:function(){if(!(this.video.readyState<2)&&this.tile){var t=this.map.painter.gl;this._prepared?(t.bindTexture(t.TEXTURE_2D,this.tile.texture),t.texSubImage2D(t.TEXTURE_2D,0,0,0,t.RGBA,t.UNSIGNED_BYTE,this.video)):(this._prepared=!0,this.tile.texture=t.createTexture(),t.bindTexture(t.TEXTURE_2D,this.tile.texture),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,this.video)),this._currentTime=this.video.currentTime}},loadTile:function(t,e){this._coord&&this._coord.toString()===t.coord.toString()?(this._setTile(t),e(null)):(t.state="errored",e(null))},serialize:function(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}})},{"../data/bucket":332,"../data/buffer":337,"../geo/lng_lat":342,"../render/draw_raster":354,"../render/vertex_array_object":360,"../util/ajax":428,"../util/evented":437,"../util/util":445,"./tile_coord":372,"point-geometry":487}],376:[function(t,e,r){"use strict";function n(t){this.self=t,this.actor=new a(t,this);var e={getLayers:function(){return this.layers}.bind(this),getLayerFamilies:function(){return this.layerFamilies}.bind(this)};this.workerSources={vector:new l(this.actor,e),geojson:new c(this.actor,e)},this.self.registerWorkerSource=function(t,r){if(this.workerSources[t])throw new Error('Worker source with name "'+t+'" already registered.');this.workerSources[t]=new r(this.actor,e)}.bind(this)}function i(t){var e={};for(var r in t){var n=t[r],i=n.ref||n.id,a=t[i];a.layout&&"none"===a.layout.visibility||(e[i]=e[i]||[],r===i?e[i].unshift(n):e[i].push(n))}return e}var a=t("../util/actor"),o=t("../style/style_layer"),s=t("../util/util"),l=t("./vector_tile_worker_source"),c=t("./geojson_worker_source");e.exports=function(t){return new n(t)},s.extend(n.prototype,{"set layers":function(t){function e(t){var e=o.create(t,t.ref&&r.layers[t.ref]);e.updatePaintTransitions({},{transition:!1}),r.layers[e.id]=e}this.layers={};for(var r=this,n=[],a=0;a<t.length;a++){var s=t[a];"fill"!==s.type&&"line"!==s.type&&"circle"!==s.type&&"symbol"!==s.type||(s.ref?n.push(a):e(s))}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=a.layers[t.ref];a.layers[t.id]?a.layers[t.id].set(t,e):a.layers[t.id]=o.create(t,e),a.layers[t.id].updatePaintTransitions({},{transition:!1})}var r,n,a=this;for(r in t)(n=t[r]).ref&&e(n);for(r in t)(n=t[r]).ref||e(n);this.layerFamilies=i(this.layers)},"load tile":function(t,e){var r=t.type||"vector";this.workerSources[r].loadTile(t,e)},"reload tile":function(t,e){var r=t.type||"vector";this.workerSources[r].reloadTile(t,e)},"abort tile":function(t){var e=t.type||"vector";this.workerSources[e].abortTile(t)},"remove tile":function(t){var e=t.type||"vector";this.workerSources[e].removeTile(t)},"redo placement":function(t,e){var r=t.type||"vector";this.workerSources[r].redoPlacement(t,e)},"load worker source":function(t,e){try{this.self.importScripts(t.url),e()}catch(t){e(t)}}})},{"../style/style_layer":384,"../util/actor":427,"../util/util":445,"./geojson_worker_source":362,"./vector_tile_worker_source":374}],377:[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){return!t.isEmpty()}function a(t){return t.serialize()}function o(t){var e=[];for(var r in t)t[r].getTransferables(e);return e}function s(t){return t.id}var l=t("../data/feature_index"),c=t("../symbol/collision_tile"),u=t("../data/bucket"),h=t("../symbol/collision_box"),f=t("../util/dictionary_coder"),d=t("../util/util"),p=t("../symbol/symbol_instances"),m=t("../symbol/symbol_quads");e.exports=n,n.prototype.parse=function(t,e,r,n,g){function v(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 y(t){if(t)return g(t);if(2==++N){for(var e=P.length-1;e>=0;e--)b(E,P[e]);x()}}function b(t,e){if(e.populateArrays(T,j,F),"symbol"!==e.type)for(var r=0;r<e.features.length;r++){var n=e.features[r];A.insert(n,n.index,e.sourceLayerIndex,e.index)}e.features=null}function x(){E.status="done",E.redoPlacementAfterDone&&(E.redoPlacement(E.angle,E.pitch,null),E.redoPlacementAfterDone=!1);var t=A.serialize(),e=T.serialize(),r=E.collisionBoxArray.serialize(),s=E.symbolInstancesArray.serialize(),l=E.symbolQuadsArray.serialize(),c=[n].concat(t.transferables).concat(e.transferables),u=D.filter(i);g(null,{buckets:u.map(a),featureIndex:t.data,collisionTile:e.data,collisionBoxArray:r,symbolInstancesArray:s,symbolQuadsArray:l,rawTileData:n},o(u).concat(c))}this.status="parsing",this.data=t,this.collisionBoxArray=new h,this.symbolInstancesArray=new p,this.symbolQuadsArray=new m;var _,w,M,k,T=new c(this.angle,this.pitch,this.collisionBoxArray),A=new l(this.coord,this.overscaling,T,t.layers),S=new f(t.layers?Object.keys(t.layers).sort():["_geojsonTileLayer"]),E=this,L={},C={},I=0;for(var z in e)(w=e[z][0]).source===this.source&&(w.ref||w.minzoom&&this.zoom<w.minzoom||w.maxzoom&&this.zoom>=w.maxzoom||w.layout&&"none"===w.layout.visibility||t.layers&&!t.layers[w.sourceLayer]||((k=u.create({layer:w,index:I++,childLayers:e[z],zoom:this.zoom,overscaling:this.overscaling,showCollisionBoxes:this.showCollisionBoxes,collisionBoxArray:this.collisionBoxArray,symbolQuadsArray:this.symbolQuadsArray,symbolInstancesArray:this.symbolInstancesArray,sourceLayerIndex:S.encode(w.sourceLayer||"_geojsonTileLayer")})).createFilter(),L[w.id]=k,t.layers&&(C[M=w.sourceLayer]=C[M]||{},C[M][w.id]=k)));if(t.layers)for(M in C)1===w.version&&d.warnOnce('Vector tile source "'+this.source+'" layer "'+M+'" does not use vector tile spec v2 and therefore may have some rendering errors.'),(w=t.layers[M])&&v(w,C[M]);else v(t,L);var D=[],P=this.symbolBuckets=[],O=[];A.bucketLayerIDs={};for(var R in L)0!==(k=L[R]).features.length&&(A.bucketLayerIDs[k.index]=k.childLayers.map(s),D.push(k),"symbol"===k.type?P.push(k):O.push(k));var F={},j={},N=0;if(P.length>0){for(_=P.length-1;_>=0;_--)P[_].updateIcons(F),P[_].updateFont(j);for(var B in j)j[B]=Object.keys(j[B]).map(Number);F=Object.keys(F),r.send("get glyphs",{uid:this.uid,stacks:j},function(t,e){j=e,y(t)}),F.length?r.send("get icons",{icons:F},function(t,e){F=e,y(t)}):y()}for(_=O.length-1;_>=0;_--)b(0,O[_]);if(0===P.length)return x()},n.prototype.redoPlacement=function(t,e,r){if("done"!==this.status)return this.redoPlacementAfterDone=!0,this.angle=t,{};for(var n=new c(t,e,this.collisionBoxArray),s=this.symbolBuckets,l=s.length-1;l>=0;l--)s[l].placeFeatures(n,r);var u=n.serialize(),h=s.filter(i);return{result:{buckets:h.map(a),collisionTile:u.data},transferables:o(h).concat(u.transferables)}}},{"../data/bucket":332,"../data/feature_index":339,"../symbol/collision_box":397,"../symbol/collision_tile":399,"../symbol/symbol_instances":408,"../symbol/symbol_quads":409,"../util/dictionary_coder":435,"../util/util":445}],378:[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})}},{}],379:[function(t,e,r){"use strict";function n(t){this.base=t,this.retina=s.devicePixelRatio>1;var e=this.retina?"@2x":"";o.getJSON(l(t,e,".json"),function(t,e){t?this.fire("error",{error:t}):(this.data=e,this.img&&this.fire("load"))}.bind(this)),o.getImage(l(t,e,".png"),function(t,e){if(t)this.fire("error",{error:t});else{for(var r=e.getData(),n=e.data=new Uint8Array(r.length),i=0;i<r.length;i+=4){var a=r[i+3]/255;n[i+0]=r[i+0]*a,n[i+1]=r[i+1]*a,n[i+2]=r[i+2]*a,n[i+3]=r[i+3]}this.img=e,this.data&&this.fire("load")}}.bind(this))}function i(){}var a=t("../util/evented"),o=t("../util/ajax"),s=t("../util/browser"),l=t("../util/mapbox").normalizeSpriteURL;e.exports=n,(n.prototype=Object.create(a)).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":428,"../util/browser":429,"../util/evented":437,"../util/mapbox":442}],380:[function(t,e,r){"use strict";var n=t("csscolorparser").parseCSSColor,i=t("../util/util"),a=t("./style_function"),o={};e.exports=function t(e){if(a.isFunctionDefinition(e))return i.extend({},e,{stops:e.stops.map(function(e){return[e[0],t(e[1])]})});if("string"==typeof e){if(!o[e]){var r=n(e);if(!r)throw new Error("Invalid color "+e);o[e]=[r[0]/255*r[3],r[1]/255*r[3],r[2]/255*r[3],r[3]]}return o[e]}throw new Error("Invalid color "+e)}},{"../util/util":445,"./style_function":383,csscolorparser:111}],381:[function(t,e,r){"use strict";function n(t,e,r){this.animationLoop=e||new m,this.dispatcher=new p(r||1,this),this.spriteAtlas=new l(1024,1024),this.lineAtlas=new c(256,512),this._layers={},this._order=[],this._groups=[],this.sources={},this.zoomHistory={},u.bindAll(["_forwardSourceEvent","_forwardTileEvent","_forwardLayerEvent","_redoPlacement"],this),this._resetUpdates();var n=function(t,e){if(t)this.fire("error",{error:t});else if(!g.emitErrors(this,g(e))){this._loaded=!0,this.stylesheet=e,this.updateClasses();var r=e.sources;for(var n in r)this.addSource(n,r[n]);e.sprite&&(this.sprite=new o(e.sprite),this.sprite.on("load",this.fire.bind(this,"change"))),this.glyphSource=new s(e.glyphs),this._resolve(),this.fire("load")}}.bind(this);"string"==typeof t?h.getJSON(f(t),n):d.frame(n.bind(this,null,t)),this.on("source.load",function(t){var e=t.source;if(e&&e.vectorLayerIds)for(var r in this._layers){var n=this._layers[r];n.source===e.id&&this._validateLayer(n)}})}var i=t("../util/evented"),a=t("./style_layer"),o=t("./image_sprite"),s=t("../symbol/glyph_source"),l=t("../symbol/sprite_atlas"),c=t("../render/line_atlas"),u=t("../util/util"),h=t("../util/ajax"),f=t("../util/mapbox").normalizeStyleURL,d=t("../util/browser"),p=t("../util/dispatcher"),m=t("./animation_loop"),g=t("./validate_style"),v=t("../source/source"),y=t("../source/query_features"),b=t("../source/source_cache"),x=t("./style_spec"),_=t("./style_function");e.exports=n,n.prototype=u.inherit(i,{_loaded:!1,_validateLayer:function(t){var e=this.sources[t.source];t.sourceLayer&&e&&e.vectorLayerIds&&-1===e.vectorLayerIds.indexOf(t.sourceLayer)&&this.fire("error",{error:new Error('Source layer "'+t.sourceLayer+'" does not exist on source "'+e.id+'" as specified by style layer "'+t.id+'"')})},loaded:function(){if(!this._loaded)return!1;if(Object.keys(this._updates.sources).length)return!1;for(var t in this.sources)if(!this.sources[t].loaded())return!1;return!(this.sprite&&!this.sprite.loaded())},_resolve:function(){var t,e;this._layers={},this._order=this.stylesheet.layers.map(function(t){return t.id});for(var r=0;r<this.stylesheet.layers.length;r++)(e=this.stylesheet.layers[r]).ref||(t=a.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]).ref){var i=this.getLayer(e.ref);t=a.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=[]).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 a=this._layers[i],o=this._updates.paintProps[i];if(this._updates.allPaintProps||o.all)a.updatePaintTransitions(t,e,r,this.animationLoop);else for(var s in o)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)}Math.floor(this.z)!==Math.floor(t)&&this.animationLoop.set(300),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 a=this._updates.events[n];this.fire(a[0],a[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");if(!e.type)throw new Error("The type property must be defined, but the only the following properties were given: "+Object.keys(e)+".");return["vector","raster","geojson","video","image"].indexOf(e.type)>=0&&this._handleErrors(g.source,"sources."+t,e)?this:(e=new b(t,e,this.dispatcher),this.sources[t]=e,e.style=this,e.on("load",this._forwardSourceEvent).on("error",this._forwardSourceEvent).on("change",this._forwardSourceEvent).on("tile.add",this._forwardTileEvent).on("tile.load",this._forwardTileEvent).on("tile.error",this._forwardTileEvent).on("tile.remove",this._forwardTileEvent).on("tile.stats",this._forwardTileEvent),this._updates.events.push(["source.add",{source:e}]),this._updates.changed=!0,this)},removeSource:function(t){if(this._checkLoaded(),void 0===this.sources[t])throw new Error("There is no source with this ID");var e=this.sources[t];return delete this.sources[t],delete this._updates.sources[t],e.off("load",this._forwardSourceEvent).off("error",this._forwardSourceEvent).off("change",this._forwardSourceEvent).off("tile.add",this._forwardTileEvent).off("tile.load",this._forwardTileEvent).off("tile.error",this._forwardTileEvent).off("tile.remove",this._forwardTileEvent).off("tile.stats",this._forwardTileEvent),this._updates.events.push(["source.remove",{source:e}]),this._updates.changed=!0,this},getSource:function(t){return this.sources[t]&&this.sources[t].getSource()},addLayer:function(t,e){if(this._checkLoaded(),!(t instanceof a)){if(this._handleErrors(g.layer,"layers."+t.id,t,!1,{arrayIndex:-1}))return this;var r=t.ref&&this.getLayer(t.ref);t=a.create(t,r)}return this._validateLayer(t),t.on("error",this._forwardLayerEvent),this._layers[t.id]=t,this._order.splice(e?this._order.indexOf(e):1/0,0,t.id),this._updates.allLayers=!0,t.source&&(this._updates.sources[t.source]=!0),this._updates.events.push(["layer.add",{layer:t}]),this.updateClasses(t.id)},removeLayer:function(t){this._checkLoaded();var e=this._layers[t];if(void 0===e)throw new Error("There is no layer with this ID");for(var r in this._layers)this._layers[r].ref===t&&this.removeLayer(r);return e.off("error",this._forwardLayerEvent),delete this._layers[t],delete this._updates.layers[t],delete this._updates.paintProps[t],this._order.splice(this._order.indexOf(t),1),this._updates.allLayers=!0,this._updates.events.push(["layer.remove",{layer:e}]),this._updates.changed=!0,this},getLayer:function(t){return this._layers[t]},getReferentLayer:function(t){var e=this.getLayer(t);return e.ref&&(e=this.getLayer(e.ref)),e},setLayerZoomRange:function(t,e,r){this._checkLoaded();var n=this.getReferentLayer(t);return n.minzoom===e&&n.maxzoom===r?this:(null!=e&&(n.minzoom=e),null!=r&&(n.maxzoom=r),this._updateLayer(n))},setFilter:function(t,e){this._checkLoaded();var r=this.getReferentLayer(t);return null!==e&&this._handleErrors(g.filter,"layers."+r.id+".filter",e)?this:u.deepEqual(r.filter,e)?this:(r.filter=u.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 u.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(u.deepEqual(i.getPaintProperty(e,n),r))return this;var a=i.isPaintValueFeatureConstant(e);i.setPaintProperty(e,r,n);return!(r&&_.isFunctionDefinition(r)&&"$zoom"!==r.property&&void 0!==r.property)&&a||(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 u.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:u.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){r
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment