diff --git a/dev/line_chart.html b/dev/line_chart.html index 6769530..fd486a5 100644 --- a/dev/line_chart.html +++ b/dev/line_chart.html @@ -26,7 +26,7 @@ /* eslint-disable no-magic-numbers */ // time, number, string -const keyType = "time" +const keyType = "string" const dataConfig = { keyType, range: [-100, 100], @@ -61,6 +61,9 @@ const chartNode1 = document.querySelector(".chart1") const chart1 = mapd3.Chart(chartNode1) .setConfig({ + annotationPoints: [ + data.series[0].values[5] + ], // common width: 800, height: 400, diff --git a/dist/mapd3.js b/dist/mapd3.js index f99bf1a..20f8eee 100644 --- a/dist/mapd3.js +++ b/dist/mapd3.js @@ -70,7 +70,7 @@ return /******/ (function(modules) { // webpackBootstrap /******/ __webpack_require__.p = ""; /******/ /******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = 18); +/******/ return __webpack_require__(__webpack_require__.s = 17); /******/ }) /************************************************************************/ /******/ ([ @@ -78,14 +78,14 @@ return /******/ (function(modules) { // webpackBootstrap /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -eval("Object.defineProperty(__webpack_exports__, \"__esModule\", { value: true });\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__ = __webpack_require__(19);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_d3_build_d3___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__);\n/* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__, \"axisBottom\")) __webpack_require__.d(__webpack_exports__, \"axisBottom\", function() { return __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__[\"axisBottom\"]; });\n/* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__, \"axisLeft\")) __webpack_require__.d(__webpack_exports__, \"axisLeft\", function() { return __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__[\"axisLeft\"]; });\n/* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__, \"axisRight\")) __webpack_require__.d(__webpack_exports__, \"axisRight\", function() { return __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__[\"axisRight\"]; });\n/* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__, \"utcParse\")) __webpack_require__.d(__webpack_exports__, \"utcParse\", function() { return __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__[\"utcParse\"]; });\n/* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__, \"utcFormat\")) __webpack_require__.d(__webpack_exports__, \"utcFormat\", function() { return __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__[\"utcFormat\"]; });\n/* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__, \"format\")) __webpack_require__.d(__webpack_exports__, \"format\", function() { return __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__[\"format\"]; });\n/* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__, \"formatPrefix\")) __webpack_require__.d(__webpack_exports__, \"formatPrefix\", function() { return __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__[\"formatPrefix\"]; });\n/* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__, \"bisector\")) __webpack_require__.d(__webpack_exports__, \"bisector\", function() { return __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__[\"bisector\"]; });\n/* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__, \"extent\")) __webpack_require__.d(__webpack_exports__, \"extent\", function() { return __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__[\"extent\"]; });\n/* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__, \"sum\")) __webpack_require__.d(__webpack_exports__, \"sum\", function() { return __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__[\"sum\"]; });\n/* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__, \"range\")) __webpack_require__.d(__webpack_exports__, \"range\", function() { return __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__[\"range\"]; });\n/* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__, \"merge\")) __webpack_require__.d(__webpack_exports__, \"merge\", function() { return __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__[\"merge\"]; });\n/* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__, \"nest\")) __webpack_require__.d(__webpack_exports__, \"nest\", function() { return __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__[\"nest\"]; });\n/* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__, \"dispatch\")) __webpack_require__.d(__webpack_exports__, \"dispatch\", function() { return __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__[\"dispatch\"]; });\n/* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__, \"easeLinear\")) __webpack_require__.d(__webpack_exports__, \"easeLinear\", function() { return __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__[\"easeLinear\"]; });\n/* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__, \"easeQuadInOut\")) __webpack_require__.d(__webpack_exports__, \"easeQuadInOut\", function() { return __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__[\"easeQuadInOut\"]; });\n/* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__, \"select\")) __webpack_require__.d(__webpack_exports__, \"select\", function() { return __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__[\"select\"]; });\n/* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__, \"mouse\")) __webpack_require__.d(__webpack_exports__, \"mouse\", function() { return __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__[\"mouse\"]; });\n/* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__, \"event\")) __webpack_require__.d(__webpack_exports__, \"event\", function() { return __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__[\"event\"]; });\n/* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__, \"transition\")) __webpack_require__.d(__webpack_exports__, \"transition\", function() { return __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__[\"transition\"]; });\n/* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__, \"randomUniform\")) __webpack_require__.d(__webpack_exports__, \"randomUniform\", function() { return __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__[\"randomUniform\"]; });\n/* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__, \"randomNormal\")) __webpack_require__.d(__webpack_exports__, \"randomNormal\", function() { return __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__[\"randomNormal\"]; });\n/* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__, \"utcYear\")) __webpack_require__.d(__webpack_exports__, \"utcYear\", function() { return __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__[\"utcYear\"]; });\n/* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__, \"utcMonth\")) __webpack_require__.d(__webpack_exports__, \"utcMonth\", function() { return __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__[\"utcMonth\"]; });\n/* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__, \"utcWeek\")) __webpack_require__.d(__webpack_exports__, \"utcWeek\", function() { return __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__[\"utcWeek\"]; });\n/* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__, \"utcDay\")) __webpack_require__.d(__webpack_exports__, \"utcDay\", function() { return __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__[\"utcDay\"]; });\n/* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__, \"utcHour\")) __webpack_require__.d(__webpack_exports__, \"utcHour\", function() { return __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__[\"utcHour\"]; });\n/* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__, \"utcMinute\")) __webpack_require__.d(__webpack_exports__, \"utcMinute\", function() { return __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__[\"utcMinute\"]; });\n/* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__, \"utcSecond\")) __webpack_require__.d(__webpack_exports__, \"utcSecond\", function() { return __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__[\"utcSecond\"]; });\n/* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__, \"utcMillisecond\")) __webpack_require__.d(__webpack_exports__, \"utcMillisecond\", function() { return __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__[\"utcMillisecond\"]; });\n/* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__, \"timeMillisecond\")) __webpack_require__.d(__webpack_exports__, \"timeMillisecond\", function() { return __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__[\"timeMillisecond\"]; });\n/* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__, \"timeSecond\")) __webpack_require__.d(__webpack_exports__, \"timeSecond\", function() { return __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__[\"timeSecond\"]; });\n/* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__, \"timeMinute\")) __webpack_require__.d(__webpack_exports__, \"timeMinute\", function() { return __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__[\"timeMinute\"]; });\n/* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__, \"timeHour\")) __webpack_require__.d(__webpack_exports__, \"timeHour\", function() { return __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__[\"timeHour\"]; });\n/* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__, \"timeDay\")) __webpack_require__.d(__webpack_exports__, \"timeDay\", function() { return __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__[\"timeDay\"]; });\n/* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__, \"timeMonth\")) __webpack_require__.d(__webpack_exports__, \"timeMonth\", function() { return __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__[\"timeMonth\"]; });\n/* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__, \"timeYear\")) __webpack_require__.d(__webpack_exports__, \"timeYear\", function() { return __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__[\"timeYear\"]; });\n/* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__, \"area\")) __webpack_require__.d(__webpack_exports__, \"area\", function() { return __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__[\"area\"]; });\n/* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__, \"curveCatmullRom\")) __webpack_require__.d(__webpack_exports__, \"curveCatmullRom\", function() { return __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__[\"curveCatmullRom\"]; });\n/* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__, \"line\")) __webpack_require__.d(__webpack_exports__, \"line\", function() { return __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__[\"line\"]; });\n/* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__, \"stack\")) __webpack_require__.d(__webpack_exports__, \"stack\", function() { return __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__[\"stack\"]; });\n/* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__, \"stackOffsetNone\")) __webpack_require__.d(__webpack_exports__, \"stackOffsetNone\", function() { return __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__[\"stackOffsetNone\"]; });\n/* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__, \"stackOffsetExpand\")) __webpack_require__.d(__webpack_exports__, \"stackOffsetExpand\", function() { return __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__[\"stackOffsetExpand\"]; });\n/* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__, \"stackOffsetWiggle\")) __webpack_require__.d(__webpack_exports__, \"stackOffsetWiggle\", function() { return __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__[\"stackOffsetWiggle\"]; });\n/* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__, \"stackOffsetSilhouette\")) __webpack_require__.d(__webpack_exports__, \"stackOffsetSilhouette\", function() { return __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__[\"stackOffsetSilhouette\"]; });\n/* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__, \"stackOffsetDiverging\")) __webpack_require__.d(__webpack_exports__, \"stackOffsetDiverging\", function() { return __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__[\"stackOffsetDiverging\"]; });\n/* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__, \"stackOrderNone\")) __webpack_require__.d(__webpack_exports__, \"stackOrderNone\", function() { return __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__[\"stackOrderNone\"]; });\n/* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__, \"scaleTime\")) __webpack_require__.d(__webpack_exports__, \"scaleTime\", function() { return __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__[\"scaleTime\"]; });\n/* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__, \"scaleUtc\")) __webpack_require__.d(__webpack_exports__, \"scaleUtc\", function() { return __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__[\"scaleUtc\"]; });\n/* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__, \"scalePoint\")) __webpack_require__.d(__webpack_exports__, \"scalePoint\", function() { return __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__[\"scalePoint\"]; });\n/* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__, \"scaleBand\")) __webpack_require__.d(__webpack_exports__, \"scaleBand\", function() { return __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__[\"scaleBand\"]; });\n/* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__, \"scaleLinear\")) __webpack_require__.d(__webpack_exports__, \"scaleLinear\", function() { return __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__[\"scaleLinear\"]; });\n/* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__, \"scaleOrdinal\")) __webpack_require__.d(__webpack_exports__, \"scaleOrdinal\", function() { return __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__[\"scaleOrdinal\"]; });\n/* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__, \"symbol\")) __webpack_require__.d(__webpack_exports__, \"symbol\", function() { return __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__[\"symbol\"]; });\n/* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__, \"symbolTriangle\")) __webpack_require__.d(__webpack_exports__, \"symbolTriangle\", function() { return __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__[\"symbolTriangle\"]; });\n/* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__, \"brushX\")) __webpack_require__.d(__webpack_exports__, \"brushX\", function() { return __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__[\"brushX\"]; });\n/* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__, \"zoom\")) __webpack_require__.d(__webpack_exports__, \"zoom\", function() { return __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__[\"zoom\"]; });\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/charts/helpers/d3-service.js\n// module id = 0\n// module chunks = 0\n\n//# sourceURL=webpack:///./src/charts/helpers/d3-service.js?"); +eval("Object.defineProperty(__webpack_exports__, \"__esModule\", { value: true });\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__ = __webpack_require__(18);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_d3_build_d3___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__);\n/* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__, \"axisBottom\")) __webpack_require__.d(__webpack_exports__, \"axisBottom\", function() { return __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__[\"axisBottom\"]; });\n/* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__, \"axisLeft\")) __webpack_require__.d(__webpack_exports__, \"axisLeft\", function() { return __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__[\"axisLeft\"]; });\n/* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__, \"axisRight\")) __webpack_require__.d(__webpack_exports__, \"axisRight\", function() { return __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__[\"axisRight\"]; });\n/* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__, \"utcParse\")) __webpack_require__.d(__webpack_exports__, \"utcParse\", function() { return __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__[\"utcParse\"]; });\n/* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__, \"utcFormat\")) __webpack_require__.d(__webpack_exports__, \"utcFormat\", function() { return __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__[\"utcFormat\"]; });\n/* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__, \"format\")) __webpack_require__.d(__webpack_exports__, \"format\", function() { return __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__[\"format\"]; });\n/* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__, \"formatPrefix\")) __webpack_require__.d(__webpack_exports__, \"formatPrefix\", function() { return __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__[\"formatPrefix\"]; });\n/* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__, \"bisector\")) __webpack_require__.d(__webpack_exports__, \"bisector\", function() { return __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__[\"bisector\"]; });\n/* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__, \"extent\")) __webpack_require__.d(__webpack_exports__, \"extent\", function() { return __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__[\"extent\"]; });\n/* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__, \"sum\")) __webpack_require__.d(__webpack_exports__, \"sum\", function() { return __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__[\"sum\"]; });\n/* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__, \"range\")) __webpack_require__.d(__webpack_exports__, \"range\", function() { return __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__[\"range\"]; });\n/* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__, \"merge\")) __webpack_require__.d(__webpack_exports__, \"merge\", function() { return __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__[\"merge\"]; });\n/* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__, \"nest\")) __webpack_require__.d(__webpack_exports__, \"nest\", function() { return __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__[\"nest\"]; });\n/* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__, \"dispatch\")) __webpack_require__.d(__webpack_exports__, \"dispatch\", function() { return __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__[\"dispatch\"]; });\n/* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__, \"easeLinear\")) __webpack_require__.d(__webpack_exports__, \"easeLinear\", function() { return __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__[\"easeLinear\"]; });\n/* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__, \"easeQuadInOut\")) __webpack_require__.d(__webpack_exports__, \"easeQuadInOut\", function() { return __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__[\"easeQuadInOut\"]; });\n/* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__, \"select\")) __webpack_require__.d(__webpack_exports__, \"select\", function() { return __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__[\"select\"]; });\n/* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__, \"mouse\")) __webpack_require__.d(__webpack_exports__, \"mouse\", function() { return __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__[\"mouse\"]; });\n/* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__, \"event\")) __webpack_require__.d(__webpack_exports__, \"event\", function() { return __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__[\"event\"]; });\n/* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__, \"transition\")) __webpack_require__.d(__webpack_exports__, \"transition\", function() { return __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__[\"transition\"]; });\n/* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__, \"randomUniform\")) __webpack_require__.d(__webpack_exports__, \"randomUniform\", function() { return __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__[\"randomUniform\"]; });\n/* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__, \"randomNormal\")) __webpack_require__.d(__webpack_exports__, \"randomNormal\", function() { return __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__[\"randomNormal\"]; });\n/* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__, \"utcYear\")) __webpack_require__.d(__webpack_exports__, \"utcYear\", function() { return __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__[\"utcYear\"]; });\n/* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__, \"utcMonth\")) __webpack_require__.d(__webpack_exports__, \"utcMonth\", function() { return __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__[\"utcMonth\"]; });\n/* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__, \"utcWeek\")) __webpack_require__.d(__webpack_exports__, \"utcWeek\", function() { return __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__[\"utcWeek\"]; });\n/* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__, \"utcDay\")) __webpack_require__.d(__webpack_exports__, \"utcDay\", function() { return __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__[\"utcDay\"]; });\n/* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__, \"utcHour\")) __webpack_require__.d(__webpack_exports__, \"utcHour\", function() { return __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__[\"utcHour\"]; });\n/* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__, \"utcMinute\")) __webpack_require__.d(__webpack_exports__, \"utcMinute\", function() { return __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__[\"utcMinute\"]; });\n/* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__, \"utcSecond\")) __webpack_require__.d(__webpack_exports__, \"utcSecond\", function() { return __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__[\"utcSecond\"]; });\n/* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__, \"utcMillisecond\")) __webpack_require__.d(__webpack_exports__, \"utcMillisecond\", function() { return __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__[\"utcMillisecond\"]; });\n/* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__, \"timeMillisecond\")) __webpack_require__.d(__webpack_exports__, \"timeMillisecond\", function() { return __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__[\"timeMillisecond\"]; });\n/* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__, \"timeSecond\")) __webpack_require__.d(__webpack_exports__, \"timeSecond\", function() { return __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__[\"timeSecond\"]; });\n/* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__, \"timeMinute\")) __webpack_require__.d(__webpack_exports__, \"timeMinute\", function() { return __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__[\"timeMinute\"]; });\n/* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__, \"timeHour\")) __webpack_require__.d(__webpack_exports__, \"timeHour\", function() { return __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__[\"timeHour\"]; });\n/* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__, \"timeDay\")) __webpack_require__.d(__webpack_exports__, \"timeDay\", function() { return __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__[\"timeDay\"]; });\n/* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__, \"timeMonth\")) __webpack_require__.d(__webpack_exports__, \"timeMonth\", function() { return __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__[\"timeMonth\"]; });\n/* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__, \"timeYear\")) __webpack_require__.d(__webpack_exports__, \"timeYear\", function() { return __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__[\"timeYear\"]; });\n/* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__, \"area\")) __webpack_require__.d(__webpack_exports__, \"area\", function() { return __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__[\"area\"]; });\n/* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__, \"curveCatmullRom\")) __webpack_require__.d(__webpack_exports__, \"curveCatmullRom\", function() { return __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__[\"curveCatmullRom\"]; });\n/* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__, \"line\")) __webpack_require__.d(__webpack_exports__, \"line\", function() { return __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__[\"line\"]; });\n/* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__, \"stack\")) __webpack_require__.d(__webpack_exports__, \"stack\", function() { return __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__[\"stack\"]; });\n/* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__, \"stackOffsetNone\")) __webpack_require__.d(__webpack_exports__, \"stackOffsetNone\", function() { return __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__[\"stackOffsetNone\"]; });\n/* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__, \"stackOffsetExpand\")) __webpack_require__.d(__webpack_exports__, \"stackOffsetExpand\", function() { return __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__[\"stackOffsetExpand\"]; });\n/* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__, \"stackOffsetWiggle\")) __webpack_require__.d(__webpack_exports__, \"stackOffsetWiggle\", function() { return __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__[\"stackOffsetWiggle\"]; });\n/* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__, \"stackOffsetSilhouette\")) __webpack_require__.d(__webpack_exports__, \"stackOffsetSilhouette\", function() { return __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__[\"stackOffsetSilhouette\"]; });\n/* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__, \"stackOffsetDiverging\")) __webpack_require__.d(__webpack_exports__, \"stackOffsetDiverging\", function() { return __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__[\"stackOffsetDiverging\"]; });\n/* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__, \"stackOrderNone\")) __webpack_require__.d(__webpack_exports__, \"stackOrderNone\", function() { return __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__[\"stackOrderNone\"]; });\n/* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__, \"scaleTime\")) __webpack_require__.d(__webpack_exports__, \"scaleTime\", function() { return __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__[\"scaleTime\"]; });\n/* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__, \"scaleUtc\")) __webpack_require__.d(__webpack_exports__, \"scaleUtc\", function() { return __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__[\"scaleUtc\"]; });\n/* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__, \"scalePoint\")) __webpack_require__.d(__webpack_exports__, \"scalePoint\", function() { return __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__[\"scalePoint\"]; });\n/* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__, \"scaleBand\")) __webpack_require__.d(__webpack_exports__, \"scaleBand\", function() { return __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__[\"scaleBand\"]; });\n/* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__, \"scaleLinear\")) __webpack_require__.d(__webpack_exports__, \"scaleLinear\", function() { return __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__[\"scaleLinear\"]; });\n/* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__, \"scaleOrdinal\")) __webpack_require__.d(__webpack_exports__, \"scaleOrdinal\", function() { return __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__[\"scaleOrdinal\"]; });\n/* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__, \"symbol\")) __webpack_require__.d(__webpack_exports__, \"symbol\", function() { return __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__[\"symbol\"]; });\n/* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__, \"symbolTriangle\")) __webpack_require__.d(__webpack_exports__, \"symbolTriangle\", function() { return __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__[\"symbolTriangle\"]; });\n/* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__, \"brushX\")) __webpack_require__.d(__webpack_exports__, \"brushX\", function() { return __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__[\"brushX\"]; });\n/* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0_d3_build_d3__, \"zoom\")) __webpack_require__.d(__webpack_exports__, \"zoom\", function() { return __WEBPACK_IMPORTED_MODULE_0_d3_build_d3__[\"zoom\"]; });\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/charts/helpers/d3-service.js\n// module id = 0\n// module chunks = 0\n\n//# sourceURL=webpack:///./src/charts/helpers/d3-service.js?"); /***/ }), /* 1 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -eval("Object.defineProperty(__webpack_exports__, \"__esModule\", { value: true });\n/* harmony export (immutable) */ __webpack_exports__[\"sortData\"] = sortData;\n/* harmony export (immutable) */ __webpack_exports__[\"getUnique\"] = getUnique;\n/* harmony export (immutable) */ __webpack_exports__[\"invertScale\"] = invertScale;\n/* harmony export (immutable) */ __webpack_exports__[\"override\"] = override;\n/* harmony export (immutable) */ __webpack_exports__[\"rebind\"] = rebind;\n/* harmony export (immutable) */ __webpack_exports__[\"stringToType\"] = stringToType;\n/* harmony export (immutable) */ __webpack_exports__[\"isNumberString\"] = isNumberString;\n/* harmony export (immutable) */ __webpack_exports__[\"isNumeric\"] = isNumeric;\n/* harmony export (immutable) */ __webpack_exports__[\"extentIsValid\"] = extentIsValid;\n/* harmony export (immutable) */ __webpack_exports__[\"uniqueId\"] = uniqueId;\n/* harmony export (immutable) */ __webpack_exports__[\"ascendingComparator\"] = ascendingComparator;\n/* harmony export (immutable) */ __webpack_exports__[\"descendingComparator\"] = descendingComparator;\n/* harmony export (immutable) */ __webpack_exports__[\"clamp\"] = clamp;\n/* harmony export (immutable) */ __webpack_exports__[\"hasBars\"] = hasBars;\n/* harmony export (immutable) */ __webpack_exports__[\"getChartClass\"] = getChartClass;\n/* harmony export (immutable) */ __webpack_exports__[\"getDomainSign\"] = getDomainSign;\n/* harmony export (immutable) */ __webpack_exports__[\"filterByKey\"] = filterByKey;\n/* harmony export (immutable) */ __webpack_exports__[\"filterByDate\"] = filterByDate;\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__constants__ = __webpack_require__(2);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__d3_service__ = __webpack_require__(0);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_lodash_clonedeep__ = __webpack_require__(6);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_lodash_clonedeep___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_lodash_clonedeep__);\nfunction _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }\n\n\n\n\n\nfunction sortData(_data, _keyType) {\n var sortedData = __WEBPACK_IMPORTED_MODULE_2_lodash_clonedeep___default()(_data);\n if (_keyType === \"time\") {\n sortedData.forEach(function (d) {\n d[__WEBPACK_IMPORTED_MODULE_0__constants__[\"keys\"].KEY] = new Date(d[__WEBPACK_IMPORTED_MODULE_0__constants__[\"keys\"].KEY]);\n });\n sortedData.sort(function (a, b) {\n return a[__WEBPACK_IMPORTED_MODULE_0__constants__[\"keys\"].KEY].getTime() - b[__WEBPACK_IMPORTED_MODULE_0__constants__[\"keys\"].KEY].getTime();\n });\n } else if (_keyType === \"string\") {\n sortedData.sort(function (a, b) {\n return a[__WEBPACK_IMPORTED_MODULE_0__constants__[\"keys\"].KEY].localeCompare(b[__WEBPACK_IMPORTED_MODULE_0__constants__[\"keys\"].KEY], \"en\", { numeric: false });\n });\n } else {\n sortedData.sort(function (a, b) {\n return a[__WEBPACK_IMPORTED_MODULE_0__constants__[\"keys\"].KEY] - b[__WEBPACK_IMPORTED_MODULE_0__constants__[\"keys\"].KEY];\n });\n }\n return sortedData;\n}\n\nfunction getUnique(arr, _keyType) {\n var allKeys = Array.from(new Set(arr));\n if (_keyType === \"time\") {\n return allKeys.map(function (d) {\n return new Date(d);\n });\n } else {\n return allKeys;\n }\n}\n\nfunction invertScale(_scale, _mouseX, _keyType) {\n if (_keyType === \"time\" || _keyType === \"number\") {\n return _scale.invert(_mouseX);\n } else {\n var index = Math.round(_mouseX / _scale.step() - 0.5);\n return _scale.domain()[index];\n }\n}\n\nfunction override(a, b) {\n var accum = {};\n for (var x in a) {\n if (a.hasOwnProperty(x)) {\n accum[x] = x in b ? b[x] : a[x];\n }\n }\n return accum;\n}\n\nfunction rebind(target) {\n return function reapply() {\n for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n target.on.apply(target, [args[0] + \".rebind\"].concat(_toConsumableArray(args.slice(1))));\n return this;\n };\n}\n\nfunction stringToType(str, type) {\n var converted = str;\n if (type === \"time\") {\n converted = __WEBPACK_IMPORTED_MODULE_1__d3_service__[\"utcParse\"](\"%m-%d-%Y\")(str);\n } else if (type === \"number\") {\n converted = Number(str);\n }\n return converted;\n}\n\nfunction isNumberString(val) {\n // eslint-disable-next-line eqeqeq\n return Number(parseFloat(val)) == val;\n}\n\nfunction isNumeric(val) {\n return Number(parseFloat(val)) === val;\n}\n\nfunction extentIsValid(extent) {\n return extent && extent.length && extent.filter(function (d) {\n return typeof d !== \"undefined\" && d !== null && !isNaN(d.valueOf());\n } // valueOf also catches Invalid Date\n ).length === 2;\n}\n\nfunction uniqueId() {\n return \"id-\" + Math.random().toString(36).substr(2, 16);\n}\n\nfunction ascendingComparator(key, keyType) {\n if (keyType === \"string\" && key === \"key\") {\n return function (a, b) {\n return a[key].localeCompare(b[key], \"en\", { numeric: false });\n };\n } else {\n return function (a, b) {\n if (a[key] < b[key]) {\n return -1;\n }\n if (a[key] > b[key]) {\n return 1;\n }\n return 0;\n };\n }\n}\n\nfunction descendingComparator(key, keyType) {\n if (keyType === \"string\" && key === \"key\") {\n return function (a, b) {\n return b[key].localeCompare(a[key], \"en\", { numeric: false });\n };\n } else {\n return function (a, b) {\n if (b[key] < a[key]) {\n return -1;\n }\n if (b[key] > a[key]) {\n return 1;\n }\n return 0;\n };\n }\n}\n\nfunction clamp(value, clampMinMax) {\n return Math.min(Math.max(clampMinMax[0], value), clampMinMax[1]);\n}\n\nfunction hasBars(_chartType) {\n return _chartType === \"bar\" || _chartType === \"stackedBar\" || _chartType === \"groupedBar\" || Array.isArray(_chartType) && _chartType.filter(function (d) {\n return d === \"bar\";\n }).length > 0;\n}\n\nfunction getChartClass(_chartType) {\n switch (_chartType) {\n case \"bar\":\n case \"stackedBar\":\n return \"bar\";\n\n case \"line\":\n case \"stackedArea\":\n return \"line\";\n\n // TO DO: handle bar line combo chartType...\n case Array.isArray(_chartType):\n return \"combo\";\n\n default:\n return \"\";\n }\n}\n\nfunction getDomainSign(domain) {\n var domainSign = null;\n if (domain[0] >= 0 && domain[1] >= 0) {\n domainSign = \"++\";\n } else if (domain[0] <= 0 && domain[1] <= 0) {\n domainSign = \"--\";\n } else {\n domainSign = domain.map(function (d) {\n return d >= 0 ? \"+\" : \"-\";\n }).join(\"\");\n }\n return domainSign;\n}\n\nfunction filterByKey(_data, _extent) {\n var data = __WEBPACK_IMPORTED_MODULE_2_lodash_clonedeep___default()(_data);\n\n data[__WEBPACK_IMPORTED_MODULE_0__constants__[\"keys\"].SERIES].forEach(function (series) {\n var values = series[__WEBPACK_IMPORTED_MODULE_0__constants__[\"keys\"].VALUES];\n var allKeys = values.map(function (d) {\n return d[__WEBPACK_IMPORTED_MODULE_0__constants__[\"keys\"].KEY];\n });\n var extentMinIndex = allKeys.indexOf(_extent[0]);\n var extentMaxIndex = allKeys.indexOf(_extent[1]);\n series[__WEBPACK_IMPORTED_MODULE_0__constants__[\"keys\"].VALUES] = series[__WEBPACK_IMPORTED_MODULE_0__constants__[\"keys\"].VALUES].slice(extentMinIndex, extentMaxIndex);\n });\n return data;\n}\n\nfunction filterByDate(_data, _extent) {\n var data = __WEBPACK_IMPORTED_MODULE_2_lodash_clonedeep___default()(_data);\n\n data[__WEBPACK_IMPORTED_MODULE_0__constants__[\"keys\"].SERIES].forEach(function (series) {\n series[__WEBPACK_IMPORTED_MODULE_0__constants__[\"keys\"].VALUES] = series[__WEBPACK_IMPORTED_MODULE_0__constants__[\"keys\"].VALUES].filter(function (d) {\n var date = new Date(d[__WEBPACK_IMPORTED_MODULE_0__constants__[\"keys\"].KEY]);\n return date >= _extent[0] && date <= _extent[1];\n });\n });\n return data;\n}\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/charts/helpers/common.js\n// module id = 1\n// module chunks = 0\n\n//# sourceURL=webpack:///./src/charts/helpers/common.js?"); +eval("Object.defineProperty(__webpack_exports__, \"__esModule\", { value: true });\n/* harmony export (immutable) */ __webpack_exports__[\"sortData\"] = sortData;\n/* harmony export (immutable) */ __webpack_exports__[\"getUnique\"] = getUnique;\n/* harmony export (immutable) */ __webpack_exports__[\"invertScale\"] = invertScale;\n/* harmony export (immutable) */ __webpack_exports__[\"override\"] = override;\n/* harmony export (immutable) */ __webpack_exports__[\"rebind\"] = rebind;\n/* harmony export (immutable) */ __webpack_exports__[\"stringToType\"] = stringToType;\n/* harmony export (immutable) */ __webpack_exports__[\"isNumberString\"] = isNumberString;\n/* harmony export (immutable) */ __webpack_exports__[\"isNumeric\"] = isNumeric;\n/* harmony export (immutable) */ __webpack_exports__[\"extentIsValid\"] = extentIsValid;\n/* harmony export (immutable) */ __webpack_exports__[\"uniqueId\"] = uniqueId;\n/* harmony export (immutable) */ __webpack_exports__[\"ascendingComparator\"] = ascendingComparator;\n/* harmony export (immutable) */ __webpack_exports__[\"descendingComparator\"] = descendingComparator;\n/* harmony export (immutable) */ __webpack_exports__[\"clamp\"] = clamp;\n/* harmony export (immutable) */ __webpack_exports__[\"hasBars\"] = hasBars;\n/* harmony export (immutable) */ __webpack_exports__[\"getChartClass\"] = getChartClass;\n/* harmony export (immutable) */ __webpack_exports__[\"getDomainSign\"] = getDomainSign;\n/* harmony export (immutable) */ __webpack_exports__[\"filterByKey\"] = filterByKey;\n/* harmony export (immutable) */ __webpack_exports__[\"filterByDate\"] = filterByDate;\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__constants__ = __webpack_require__(2);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__d3_service__ = __webpack_require__(0);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_lodash_clonedeep__ = __webpack_require__(20);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_lodash_clonedeep___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_lodash_clonedeep__);\nfunction _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }\n\n\n\n\n\nfunction sortData(_data, _keyType) {\n var sortedData = __WEBPACK_IMPORTED_MODULE_2_lodash_clonedeep___default()(_data);\n if (_keyType === \"time\") {\n sortedData.forEach(function (d) {\n d[__WEBPACK_IMPORTED_MODULE_0__constants__[\"keys\"].KEY] = new Date(d[__WEBPACK_IMPORTED_MODULE_0__constants__[\"keys\"].KEY]);\n });\n sortedData.sort(function (a, b) {\n return a[__WEBPACK_IMPORTED_MODULE_0__constants__[\"keys\"].KEY].getTime() - b[__WEBPACK_IMPORTED_MODULE_0__constants__[\"keys\"].KEY].getTime();\n });\n } else if (_keyType === \"string\") {\n sortedData.sort(function (a, b) {\n return a[__WEBPACK_IMPORTED_MODULE_0__constants__[\"keys\"].KEY].localeCompare(b[__WEBPACK_IMPORTED_MODULE_0__constants__[\"keys\"].KEY], \"en\", { numeric: false });\n });\n } else {\n sortedData.sort(function (a, b) {\n return a[__WEBPACK_IMPORTED_MODULE_0__constants__[\"keys\"].KEY] - b[__WEBPACK_IMPORTED_MODULE_0__constants__[\"keys\"].KEY];\n });\n }\n return sortedData;\n}\n\nfunction getUnique(arr, _keyType) {\n var allKeys = Array.from(new Set(arr));\n if (_keyType === \"time\") {\n return allKeys.map(function (d) {\n return new Date(d);\n });\n } else {\n return allKeys;\n }\n}\n\nfunction invertScale(_scale, _mouseX, _keyType) {\n if (_keyType === \"time\" || _keyType === \"number\") {\n return _scale.invert(_mouseX);\n } else {\n var index = Math.round(_mouseX / _scale.step() - 0.5);\n return _scale.domain()[index];\n }\n}\n\nfunction override(a, b) {\n var accum = {};\n for (var x in a) {\n if (a.hasOwnProperty(x)) {\n accum[x] = x in b ? b[x] : a[x];\n }\n }\n return accum;\n}\n\nfunction rebind(target) {\n return function reapply() {\n for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n target.on.apply(target, [args[0] + \".rebind\"].concat(_toConsumableArray(args.slice(1))));\n return this;\n };\n}\n\nfunction stringToType(str, type) {\n var converted = str;\n if (type === \"time\") {\n converted = __WEBPACK_IMPORTED_MODULE_1__d3_service__[\"utcParse\"](\"%m-%d-%Y\")(str);\n } else if (type === \"number\") {\n converted = Number(str);\n }\n return converted;\n}\n\nfunction isNumberString(val) {\n // eslint-disable-next-line eqeqeq\n return Number(parseFloat(val)) == val;\n}\n\nfunction isNumeric(val) {\n return Number(parseFloat(val)) === val;\n}\n\nfunction extentIsValid(extent) {\n return extent && extent.length && extent.filter(function (d) {\n return typeof d !== \"undefined\" && d !== null && !isNaN(d.valueOf());\n } // valueOf also catches Invalid Date\n ).length === 2;\n}\n\nfunction uniqueId() {\n return \"id-\" + Math.random().toString(36).substr(2, 16);\n}\n\nfunction ascendingComparator(key, keyType) {\n if (keyType === \"string\" && key === \"key\") {\n return function (a, b) {\n return a[key].localeCompare(b[key], \"en\", { numeric: false });\n };\n } else {\n return function (a, b) {\n if (a[key] < b[key]) {\n return -1;\n }\n if (a[key] > b[key]) {\n return 1;\n }\n return 0;\n };\n }\n}\n\nfunction descendingComparator(key, keyType) {\n if (keyType === \"string\" && key === \"key\") {\n return function (a, b) {\n return b[key].localeCompare(a[key], \"en\", { numeric: false });\n };\n } else {\n return function (a, b) {\n if (b[key] < a[key]) {\n return -1;\n }\n if (b[key] > a[key]) {\n return 1;\n }\n return 0;\n };\n }\n}\n\nfunction clamp(value, clampMinMax) {\n return Math.min(Math.max(clampMinMax[0], value), clampMinMax[1]);\n}\n\nfunction hasBars(_chartType) {\n return _chartType === \"bar\" || _chartType === \"stackedBar\" || _chartType === \"groupedBar\" || Array.isArray(_chartType) && _chartType.filter(function (d) {\n return d === \"bar\";\n }).length > 0;\n}\n\nfunction getChartClass(_chartType) {\n switch (_chartType) {\n case \"bar\":\n case \"stackedBar\":\n return \"bar\";\n\n case \"line\":\n case \"stackedArea\":\n return \"line\";\n\n // TO DO: handle bar line combo chartType...\n case Array.isArray(_chartType):\n return \"combo\";\n\n default:\n return \"\";\n }\n}\n\nfunction getDomainSign(domain) {\n var domainSign = null;\n if (domain[0] >= 0 && domain[1] >= 0) {\n domainSign = \"++\";\n } else if (domain[0] <= 0 && domain[1] <= 0) {\n domainSign = \"--\";\n } else {\n domainSign = domain.map(function (d) {\n return d >= 0 ? \"+\" : \"-\";\n }).join(\"\");\n }\n return domainSign;\n}\n\nfunction filterByKey(_data, _extent) {\n var data = __WEBPACK_IMPORTED_MODULE_2_lodash_clonedeep___default()(_data);\n\n data[__WEBPACK_IMPORTED_MODULE_0__constants__[\"keys\"].SERIES].forEach(function (series) {\n var values = series[__WEBPACK_IMPORTED_MODULE_0__constants__[\"keys\"].VALUES];\n var allKeys = values.map(function (d) {\n return d[__WEBPACK_IMPORTED_MODULE_0__constants__[\"keys\"].KEY];\n });\n var extentMinIndex = allKeys.indexOf(_extent[0]);\n var extentMaxIndex = allKeys.indexOf(_extent[1]);\n series[__WEBPACK_IMPORTED_MODULE_0__constants__[\"keys\"].VALUES] = series[__WEBPACK_IMPORTED_MODULE_0__constants__[\"keys\"].VALUES].slice(extentMinIndex, extentMaxIndex);\n });\n return data;\n}\n\nfunction filterByDate(_data, _extent) {\n var data = __WEBPACK_IMPORTED_MODULE_2_lodash_clonedeep___default()(_data);\n\n data[__WEBPACK_IMPORTED_MODULE_0__constants__[\"keys\"].SERIES].forEach(function (series) {\n series[__WEBPACK_IMPORTED_MODULE_0__constants__[\"keys\"].VALUES] = series[__WEBPACK_IMPORTED_MODULE_0__constants__[\"keys\"].VALUES].filter(function (d) {\n var date = new Date(d[__WEBPACK_IMPORTED_MODULE_0__constants__[\"keys\"].KEY]);\n return date >= _extent[0] && date <= _extent[1];\n });\n });\n return data;\n}\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/charts/helpers/common.js\n// module id = 1\n// module chunks = 0\n\n//# sourceURL=webpack:///./src/charts/helpers/common.js?"); /***/ }), /* 2 */ @@ -106,7 +106,7 @@ eval("Object.defineProperty(__webpack_exports__, \"__esModule\", { value: true } /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -eval("/* unused harmony export applyFormat */\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"c\", function() { return formatTooltipTitle; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"b\", function() { return formatDataPoint; });\n/* harmony export (immutable) */ __webpack_exports__[\"a\"] = Tooltip;\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__ = __webpack_require__(0);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__helpers_constants__ = __webpack_require__(2);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__helpers_common__ = __webpack_require__(1);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__helpers_formatters__ = __webpack_require__(10);\nvar _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"]) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); } }; }();\n\nfunction _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }\n\n\n\n\n\n\n\nvar applyFormat = function applyFormat(_value, _format) {\n if (typeof _format === \"function\") {\n return _format(_value);\n } else if (typeof _format === \"string\" && _format !== \"auto\") {\n return __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"format\"](_format)(_value);\n } else {\n return Object(__WEBPACK_IMPORTED_MODULE_3__helpers_formatters__[\"e\" /* formatTooltipNumber */])(_value);\n }\n};\n\nvar getMeasureFormatter = function getMeasureFormatter(tooltipFormatter, measureName) {\n // Running a function, _just_ to test to see if one of it's inputs are valid is _insane_.\n // But alas, that's what's happening here just to see if we have a specific measure formatter. So we should\n // prolly think about not doing this at some point.\n if (typeof tooltipFormatter === \"function\" && tooltipFormatter(null, measureName)) {\n return function (v) {\n return tooltipFormatter(v, measureName);\n };\n }\n};\n\nvar formatTooltipTitle = function formatTooltipTitle(title, format, dateFormat, binningResolution) {\n if (Object(__WEBPACK_IMPORTED_MODULE_2__helpers_common__[\"isNumberString\"])(title)) {\n title = Number(parseFloat(title));\n }\n if (typeof format === \"function\" && typeof title !== \"string\") {\n title = format(title);\n } else if (title instanceof Date) {\n var specifier = __WEBPACK_IMPORTED_MODULE_3__helpers_formatters__[\"b\" /* binTranslation */][binningResolution];\n if (format && format !== \"auto\") {\n title = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"utcFormat\"](format)(title);\n } else if (specifier) {\n title = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"utcFormat\"](specifier)(title);\n } else if ([\"1w\", \"1q\", \"10y\", \"1c\"].indexOf(binningResolution) > -1) {\n // handle bin translation for bin types not available in d3-time (century, decade, quarter)\n title = Object(__WEBPACK_IMPORTED_MODULE_3__helpers_formatters__[\"c\" /* formatOddDateBin */])(binningResolution, title);\n } else {\n title = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"utcFormat\"](dateFormat)(title);\n }\n } else if (Object(__WEBPACK_IMPORTED_MODULE_2__helpers_common__[\"isNumeric\"])(title)) {\n title = Number(parseFloat(title));\n if (format) {\n title = applyFormat(title, format);\n } else {\n title = Object(__WEBPACK_IMPORTED_MODULE_3__helpers_formatters__[\"e\" /* formatTooltipNumber */])(title);\n }\n }\n return title;\n};\n\nvar formatTooltipValue = function formatTooltipValue(_value, tooltipFormat, measureFormatter) {\n var hasStringFormatterForMeasure = typeof tooltipFormat === \"string\" && tooltipFormat !== \"auto\";\n\n if (typeof measureFormatter === \"function\") {\n return measureFormatter(_value);\n } else if (hasStringFormatterForMeasure) {\n return __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"format\"](tooltipFormat)(_value);\n } else {\n return Object(__WEBPACK_IMPORTED_MODULE_3__helpers_formatters__[\"e\" /* formatTooltipNumber */])(_value);\n }\n};\n\nvar formatDataPoint = function formatDataPoint(d, tooltipFormat, yAxisPercentageFormat, measureFormatter) {\n // Check for percentage value (presence of absolute-value metadata)\n if (typeof d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].ABSOLUTEVAL] !== \"undefined\") {\n // Assume VALUE is not undefined, since ABSOLUTEVAL is derived from it\n var percentageValue = d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].VALUE];\n var absoluteValue = d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].ABSOLUTEVAL];\n\n var formattedAbsoluteValue = formatTooltipValue(absoluteValue, tooltipFormat, measureFormatter);\n var formattedPercentageValue = applyFormat(percentageValue, Object(__WEBPACK_IMPORTED_MODULE_3__helpers_formatters__[\"d\" /* formatPercentage */])(yAxisPercentageFormat));\n\n return formattedAbsoluteValue + \" (\" + formattedPercentageValue + \")\";\n } else if (typeof d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].VALUE] !== \"undefined\") {\n var value = d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].VALUE];\n return formatTooltipValue(value, tooltipFormat, measureFormatter);\n }\n};\n\nfunction Tooltip(_container) {\n var _isLegend = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n\n var config = {\n margin: {\n top: 2,\n right: 2,\n bottom: 2,\n left: 2\n },\n width: 250,\n height: 45,\n\n dateFormat: \"%b %d, %Y\",\n tooltipIsEnabled: true,\n tooltipTitle: null,\n binningResolution: null,\n binningIsAuto: null,\n chartType: null,\n colorSchema: [\"skyblue\"],\n keyType: \"time\",\n tooltipFormat: null,\n yAxisPercentageFormat: null,\n tooltipTitleFormat: null,\n\n markPanelWidth: null,\n chartWidth: null,\n chartHeight: null\n };\n\n var scales = {\n colorScale: null,\n styleScale: null,\n measureNameLookup: null\n };\n\n var cache = {\n container: _container,\n root: null,\n tooltipDivider: null,\n tooltipBody: null,\n tooltipTitle: null,\n tooltipBackground: null,\n xPosition: null,\n yPosition: null,\n content: null,\n title: null\n };\n\n function build() {\n if (!cache.root) {\n cache.root = cache.container.append(\"div\").attr(\"class\", _isLegend ? \"legend-group\" : \"tooltip-group\").style(\"position\", \"absolute\");\n\n var panel = cache.root.append(\"div\").attr(\"class\", \"tooltip-panel\");\n\n cache.tooltipTitleSection = panel.append(\"div\").attr(\"class\", \"tooltip-title-section\");\n\n cache.tooltipTitle = cache.tooltipTitleSection.append(\"div\").attr(\"class\", \"tooltip-title\");\n\n cache.tooltipBody = panel.append(\"div\").attr(\"class\", \"tooltip-body\");\n\n if (_isLegend) {\n cache.tooltipTitleSection.append(\"div\").attr(\"class\", \"tooltip-collapse\").html(\"↗\");\n\n cache.tooltipTitleSection.on(\"click\", function click() {\n var isCollapsed = this.classList.toggle(\"collapsed\");\n toggleCollapse(isCollapsed);\n });\n } else {\n cache.root.style(\"pointer-events\", \"none\");\n }\n\n if (!config.tooltipIsEnabled) {\n hide();\n }\n }\n\n if (_isLegend) {\n cache.root.style(\"max-height\", config.chartHeight);\n if (config.tooltipIsEnabled) {\n show();\n } else {\n hide();\n }\n }\n }\n\n function calculateTooltipPosition(_mouseX, _mouseY) {\n var OFFSET = 4;\n var tooltipSize = cache.root.node().getBoundingClientRect();\n var tooltipX = _mouseX;\n var avoidanceOffset = OFFSET;\n var tooltipY = _mouseY + config.margin.top - tooltipSize.height / 2;\n\n if (_mouseX > config.chartWidth / 2) {\n avoidanceOffset = -tooltipSize.width - OFFSET;\n }\n\n return [tooltipX + avoidanceOffset, tooltipY];\n }\n\n function move() {\n var xPosition = cache.xPosition === \"auto\" ? config.chartWidth : cache.xPosition;\n\n var yPosition = cache.yPosition === \"auto\" ? config.margin.top : cache.yPosition;\n\n cache.root.style(\"top\", yPosition + \"px\").style(\"left\", function left() {\n var width = cache.xPosition === \"auto\" ? this.getBoundingClientRect().width : 0;\n return xPosition + config.margin.left - width + \"px\";\n });\n\n if (_isLegend) {\n // set max-height in case there are too many legend items\n cache.root.style(\"max-height\", config.chartHeight + \"px\");\n }\n\n return this;\n }\n\n function drawContent() {\n var tooltipItems = cache.tooltipBody.selectAll(\".tooltip-item\").data(cache.content);\n var tooltipItemsUpdate = tooltipItems.enter().append(\"div\").attr(\"class\", \"tooltip-item\").merge(tooltipItems);\n tooltipItems.exit().remove();\n\n var tooltipItem = tooltipItemsUpdate.selectAll(\".section\").data(function (d, i) {\n var legendData = [{\n key: \"tooltip-color\",\n value: scales.colorScale(d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].ID]),\n style: scales.styleScale(d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].ID]),\n index: i\n }];\n\n if (typeof d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].LABEL] !== \"undefined\") {\n legendData.push({ key: \"tooltip-label\", value: d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].LABEL] });\n }\n\n if (typeof d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].ABSOLUTEVAL] !== \"undefined\" || typeof d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].VALUE] !== \"undefined\") {\n var measureName = scales.measureNameLookup(d.id);\n var measureFormatter = getMeasureFormatter(config.tooltipFormat, measureName);\n var _config2 = config,\n tooltipFormat = _config2.tooltipFormat,\n yAxisPercentageFormat = _config2.yAxisPercentageFormat;\n\n legendData.push({\n key: \"value\",\n value: formatDataPoint(d, tooltipFormat, yAxisPercentageFormat, measureFormatter)\n });\n }\n\n return legendData;\n });\n tooltipItem.enter().append(\"div\").merge(tooltipItem).attr(\"class\", function (d) {\n return [\"section\", d.key].join(\" \");\n }).each(function each(d) {\n var selection = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"select\"](this);\n if (d.key === \"tooltip-color\") {\n var size = 12;\n var offset = size / 2;\n var svg = selection.html(\"\").select(\"svg\").attr(\"width\", size).attr(\"height\", size);\n\n if (config.chartType === \"line\" || Array.isArray(config.chartType) && config.chartType[d.index] === \"line\") {\n\n svg.append(\"line\").attr(\"x1\", 0).attr(\"y1\", offset).attr(\"x2\", size).attr(\"y2\", offset).attr(\"stroke\", d.value).attr(\"stroke-width\", 2.5).attr(\"stroke-dasharray\", function (dB) {\n return __WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"dashStylesTranslation\"][dB.style];\n });\n } else {\n svg.append(\"rect\").attr(\"x\", 0).attr(\"y\", 0).attr(\"width\", size).attr(\"height\", size).style(\"fill\", d.value);\n }\n } else {\n selection.html(d.value);\n }\n });\n tooltipItem.exit().remove();\n\n return this;\n }\n\n function toggleCollapse(_isCollapsed) {\n if (_isCollapsed) {\n cache.tooltipTitle.html(\"Legend\");\n cache.tooltipBody.style(\"display\", \"none\");\n move();\n } else {\n drawTitle();\n cache.tooltipBody.style(\"display\", \"block\");\n move();\n }\n return this;\n }\n\n function drawTitle() {\n cache.tooltipTitle.html(formatTooltipTitle(config.tooltipTitle || cache.title, config.tooltipTitleFormat, config.dateFormat, config.binningResolution));\n return this;\n }\n\n function setupContent(_series) {\n cache.content = [].concat(_toConsumableArray(_series));\n return this;\n }\n\n function hide() {\n if (!cache.root) {\n return null;\n }\n cache.root.style(\"display\", \"none\");\n return this;\n }\n\n function show() {\n if (!cache.root || !config.tooltipIsEnabled) {\n return null;\n }\n cache.root.style(\"display\", \"block\");\n return this;\n }\n\n function setupTooltip(_dataPoint, _xPosition, _yPosition, _panelXPosition) {\n build();\n\n var _calculateTooltipPosi = calculateTooltipPosition(_panelXPosition, _yPosition),\n _calculateTooltipPosi2 = _slicedToArray(_calculateTooltipPosi, 2),\n tooltipX = _calculateTooltipPosi2[0],\n tooltipY = _calculateTooltipPosi2[1];\n\n setXPosition(tooltipX);\n setYPosition(tooltipY);\n\n var title = _dataPoint[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].KEY];\n if (Object(__WEBPACK_IMPORTED_MODULE_2__helpers_common__[\"isNumberString\"])(title)) {\n title = Number(parseFloat(title));\n }\n setTitle(title);\n setupContent(_dataPoint[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].SERIES]);\n\n render();\n return this;\n }\n\n function bindEvents(_dispatcher) {\n _dispatcher.on(\"mouseOverPanel.tooltip\", show).on(\"mouseMovePanel.tooltip\", setupTooltip).on(\"mouseOutPanel.tooltip\", hide);\n return this;\n }\n\n function setConfig(_config) {\n config = Object(__WEBPACK_IMPORTED_MODULE_2__helpers_common__[\"override\"])(config, _config);\n return this;\n }\n\n function setScales(_scales) {\n scales = Object(__WEBPACK_IMPORTED_MODULE_2__helpers_common__[\"override\"])(scales, _scales);\n return this;\n }\n\n function setTitle(_title) {\n cache.title = _title;\n return this;\n }\n\n function setXPosition(_xPosition) {\n cache.xPosition = _xPosition;\n return this;\n }\n\n function setYPosition(_yPosition) {\n cache.yPosition = _yPosition;\n return this;\n }\n\n function setContent(_content) {\n cache.content = _content;\n render();\n return this;\n }\n\n function render() {\n build();\n drawTitle();\n drawContent();\n move();\n return this;\n }\n\n function destroy() {\n if (cache.root) {\n cache.root.remove();\n cache.root = null;\n }\n return this;\n }\n\n return {\n bindEvents: bindEvents,\n setXPosition: setXPosition,\n setYPosition: setYPosition,\n setContent: setContent,\n setTitle: setTitle,\n hide: hide,\n show: show,\n setConfig: setConfig,\n setScales: setScales,\n destroy: destroy\n };\n}\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/charts/tooltip.js\n// module id = 4\n// module chunks = 0\n\n//# sourceURL=webpack:///./src/charts/tooltip.js?"); +eval("/* unused harmony export applyFormat */\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"c\", function() { return formatTooltipTitle; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"b\", function() { return formatDataPoint; });\n/* harmony export (immutable) */ __webpack_exports__[\"a\"] = Tooltip;\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__ = __webpack_require__(0);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__helpers_constants__ = __webpack_require__(2);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__helpers_common__ = __webpack_require__(1);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__helpers_formatters__ = __webpack_require__(9);\nvar _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"]) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); } }; }();\n\nfunction _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }\n\n\n\n\n\n\n\nvar applyFormat = function applyFormat(_value, _format) {\n if (typeof _format === \"function\") {\n return _format(_value);\n } else if (typeof _format === \"string\" && _format !== \"auto\") {\n return __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"format\"](_format)(_value);\n } else {\n return Object(__WEBPACK_IMPORTED_MODULE_3__helpers_formatters__[\"e\" /* formatTooltipNumber */])(_value);\n }\n};\n\nvar getMeasureFormatter = function getMeasureFormatter(tooltipFormatter, measureName) {\n // Running a function, _just_ to test to see if one of it's inputs are valid is _insane_.\n // But alas, that's what's happening here just to see if we have a specific measure formatter. So we should\n // prolly think about not doing this at some point.\n if (typeof tooltipFormatter === \"function\" && tooltipFormatter(null, measureName)) {\n return function (v) {\n return tooltipFormatter(v, measureName);\n };\n }\n};\n\nvar formatTooltipTitle = function formatTooltipTitle(title, format, dateFormat, binningResolution) {\n if (Object(__WEBPACK_IMPORTED_MODULE_2__helpers_common__[\"isNumberString\"])(title)) {\n title = Number(parseFloat(title));\n }\n if (typeof format === \"function\" && typeof title !== \"string\") {\n title = format(title);\n } else if (title instanceof Date) {\n var specifier = __WEBPACK_IMPORTED_MODULE_3__helpers_formatters__[\"b\" /* binTranslation */][binningResolution];\n if (format && format !== \"auto\") {\n title = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"utcFormat\"](format)(title);\n } else if (specifier) {\n title = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"utcFormat\"](specifier)(title);\n } else if ([\"1w\", \"1q\", \"10y\", \"1c\"].indexOf(binningResolution) > -1) {\n // handle bin translation for bin types not available in d3-time (century, decade, quarter)\n title = Object(__WEBPACK_IMPORTED_MODULE_3__helpers_formatters__[\"c\" /* formatOddDateBin */])(binningResolution, title);\n } else {\n title = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"utcFormat\"](dateFormat)(title);\n }\n } else if (Object(__WEBPACK_IMPORTED_MODULE_2__helpers_common__[\"isNumeric\"])(title)) {\n title = Number(parseFloat(title));\n if (format) {\n title = applyFormat(title, format);\n } else {\n title = Object(__WEBPACK_IMPORTED_MODULE_3__helpers_formatters__[\"e\" /* formatTooltipNumber */])(title);\n }\n }\n return title;\n};\n\nvar formatTooltipValue = function formatTooltipValue(_value, tooltipFormat, measureFormatter) {\n var hasStringFormatterForMeasure = typeof tooltipFormat === \"string\" && tooltipFormat !== \"auto\";\n\n if (typeof measureFormatter === \"function\") {\n return measureFormatter(_value);\n } else if (hasStringFormatterForMeasure) {\n return __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"format\"](tooltipFormat)(_value);\n } else {\n return Object(__WEBPACK_IMPORTED_MODULE_3__helpers_formatters__[\"e\" /* formatTooltipNumber */])(_value);\n }\n};\n\nvar formatDataPoint = function formatDataPoint(d, tooltipFormat, yAxisPercentageFormat, measureFormatter) {\n // Check for percentage value (presence of absolute-value metadata)\n if (typeof d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].ABSOLUTEVAL] !== \"undefined\") {\n // Assume VALUE is not undefined, since ABSOLUTEVAL is derived from it\n var percentageValue = d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].VALUE];\n var absoluteValue = d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].ABSOLUTEVAL];\n\n var formattedAbsoluteValue = formatTooltipValue(absoluteValue, tooltipFormat, measureFormatter);\n var formattedPercentageValue = applyFormat(percentageValue, Object(__WEBPACK_IMPORTED_MODULE_3__helpers_formatters__[\"d\" /* formatPercentage */])(yAxisPercentageFormat));\n\n return formattedAbsoluteValue + \" (\" + formattedPercentageValue + \")\";\n } else if (typeof d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].VALUE] !== \"undefined\") {\n var value = d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].VALUE];\n return formatTooltipValue(value, tooltipFormat, measureFormatter);\n }\n};\n\nfunction Tooltip(_container) {\n var _isLegend = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n\n var config = {\n margin: {\n top: 2,\n right: 2,\n bottom: 2,\n left: 2\n },\n width: 250,\n height: 45,\n\n dateFormat: \"%b %d, %Y\",\n tooltipIsEnabled: true,\n tooltipTitle: null,\n binningResolution: null,\n binningIsAuto: null,\n chartType: null,\n colorSchema: [\"skyblue\"],\n keyType: \"time\",\n tooltipFormat: null,\n yAxisPercentageFormat: null,\n tooltipTitleFormat: null,\n\n markPanelWidth: null,\n chartWidth: null,\n chartHeight: null\n };\n\n var scales = {\n colorScale: null,\n styleScale: null,\n measureNameLookup: null\n };\n\n var cache = {\n container: _container,\n root: null,\n tooltipDivider: null,\n tooltipBody: null,\n tooltipTitle: null,\n tooltipBackground: null,\n xPosition: null,\n yPosition: null,\n content: null,\n title: null\n };\n\n function build() {\n if (!cache.root) {\n cache.root = cache.container.append(\"div\").attr(\"class\", _isLegend ? \"legend-group\" : \"tooltip-group\").style(\"position\", \"absolute\");\n\n var panel = cache.root.append(\"div\").attr(\"class\", \"tooltip-panel\");\n\n cache.tooltipTitleSection = panel.append(\"div\").attr(\"class\", \"tooltip-title-section\");\n\n cache.tooltipTitle = cache.tooltipTitleSection.append(\"div\").attr(\"class\", \"tooltip-title\");\n\n cache.tooltipBody = panel.append(\"div\").attr(\"class\", \"tooltip-body\");\n\n if (_isLegend) {\n cache.tooltipTitleSection.append(\"div\").attr(\"class\", \"tooltip-collapse\").html(\"↗\");\n\n cache.tooltipTitleSection.on(\"click\", function click() {\n var isCollapsed = this.classList.toggle(\"collapsed\");\n toggleCollapse(isCollapsed);\n });\n } else {\n cache.root.style(\"pointer-events\", \"none\");\n }\n\n if (!config.tooltipIsEnabled) {\n hide();\n }\n }\n\n if (_isLegend) {\n cache.root.style(\"max-height\", config.chartHeight);\n if (config.tooltipIsEnabled) {\n show();\n } else {\n hide();\n }\n }\n }\n\n function calculateTooltipPosition(_mouseX, _mouseY) {\n var OFFSET = 4;\n var tooltipSize = cache.root.node().getBoundingClientRect();\n var tooltipX = _mouseX;\n var avoidanceOffset = OFFSET;\n var tooltipY = _mouseY + config.margin.top - tooltipSize.height / 2;\n\n if (_mouseX > config.chartWidth / 2) {\n avoidanceOffset = -tooltipSize.width - OFFSET;\n }\n\n return [tooltipX + avoidanceOffset, tooltipY];\n }\n\n function move() {\n var xPosition = cache.xPosition === \"auto\" ? config.chartWidth : cache.xPosition;\n\n var yPosition = cache.yPosition === \"auto\" ? config.margin.top : cache.yPosition;\n\n cache.root.style(\"top\", yPosition + \"px\").style(\"left\", function left() {\n var width = cache.xPosition === \"auto\" ? this.getBoundingClientRect().width : 0;\n return xPosition + config.margin.left - width + \"px\";\n });\n\n if (_isLegend) {\n // set max-height in case there are too many legend items\n cache.root.style(\"max-height\", config.chartHeight + \"px\");\n }\n\n return this;\n }\n\n function drawContent() {\n var tooltipItems = cache.tooltipBody.selectAll(\".tooltip-item\").data(cache.content);\n var tooltipItemsUpdate = tooltipItems.enter().append(\"div\").attr(\"class\", \"tooltip-item\").merge(tooltipItems);\n tooltipItems.exit().remove();\n\n var tooltipItem = tooltipItemsUpdate.selectAll(\".section\").data(function (d, i) {\n var legendData = [{\n key: \"tooltip-color\",\n value: scales.colorScale(d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].ID]),\n style: scales.styleScale(d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].ID]),\n index: i\n }];\n\n if (typeof d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].LABEL] !== \"undefined\") {\n legendData.push({ key: \"tooltip-label\", value: d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].LABEL] });\n }\n\n if (typeof d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].ABSOLUTEVAL] !== \"undefined\" || typeof d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].VALUE] !== \"undefined\") {\n var measureName = scales.measureNameLookup(d.id);\n var measureFormatter = getMeasureFormatter(config.tooltipFormat, measureName);\n var _config2 = config,\n tooltipFormat = _config2.tooltipFormat,\n yAxisPercentageFormat = _config2.yAxisPercentageFormat;\n\n legendData.push({\n key: \"value\",\n value: formatDataPoint(d, tooltipFormat, yAxisPercentageFormat, measureFormatter)\n });\n }\n\n return legendData;\n });\n tooltipItem.enter().append(\"div\").merge(tooltipItem).attr(\"class\", function (d) {\n return [\"section\", d.key].join(\" \");\n }).each(function each(d) {\n var selection = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"select\"](this);\n if (d.key === \"tooltip-color\") {\n var size = 12;\n var offset = size / 2;\n var svg = selection.html(\"\").select(\"svg\").attr(\"width\", size).attr(\"height\", size);\n\n if (config.chartType === \"line\" || Array.isArray(config.chartType) && config.chartType[d.index] === \"line\") {\n\n svg.append(\"line\").attr(\"x1\", 0).attr(\"y1\", offset).attr(\"x2\", size).attr(\"y2\", offset).attr(\"stroke\", d.value).attr(\"stroke-width\", 2.5).attr(\"stroke-dasharray\", function (dB) {\n return __WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"dashStylesTranslation\"][dB.style];\n });\n } else {\n svg.append(\"rect\").attr(\"x\", 0).attr(\"y\", 0).attr(\"width\", size).attr(\"height\", size).style(\"fill\", d.value);\n }\n } else {\n selection.html(d.value);\n }\n });\n tooltipItem.exit().remove();\n\n return this;\n }\n\n function toggleCollapse(_isCollapsed) {\n if (_isCollapsed) {\n cache.tooltipTitle.html(\"Legend\");\n cache.tooltipBody.style(\"display\", \"none\");\n move();\n } else {\n drawTitle();\n cache.tooltipBody.style(\"display\", \"block\");\n move();\n }\n return this;\n }\n\n function drawTitle() {\n cache.tooltipTitle.html(formatTooltipTitle(config.tooltipTitle || cache.title, config.tooltipTitleFormat, config.dateFormat, config.binningResolution));\n return this;\n }\n\n function setupContent(_series) {\n cache.content = [].concat(_toConsumableArray(_series));\n return this;\n }\n\n function hide() {\n if (!cache.root) {\n return null;\n }\n cache.root.style(\"display\", \"none\");\n return this;\n }\n\n function show() {\n if (!cache.root || !config.tooltipIsEnabled) {\n return null;\n }\n cache.root.style(\"display\", \"block\");\n return this;\n }\n\n function setupTooltip(_dataPoint, _xPosition, _yPosition, _panelXPosition) {\n build();\n\n var _calculateTooltipPosi = calculateTooltipPosition(_panelXPosition, _yPosition),\n _calculateTooltipPosi2 = _slicedToArray(_calculateTooltipPosi, 2),\n tooltipX = _calculateTooltipPosi2[0],\n tooltipY = _calculateTooltipPosi2[1];\n\n setXPosition(tooltipX);\n setYPosition(tooltipY);\n\n var title = _dataPoint[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].KEY];\n if (Object(__WEBPACK_IMPORTED_MODULE_2__helpers_common__[\"isNumberString\"])(title)) {\n title = Number(parseFloat(title));\n }\n setTitle(title);\n setupContent(_dataPoint[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].SERIES]);\n\n render();\n return this;\n }\n\n function bindEvents(_dispatcher) {\n _dispatcher.on(\"mouseOverPanel.tooltip\", show).on(\"mouseMovePanel.tooltip\", setupTooltip).on(\"mouseOutPanel.tooltip\", hide);\n return this;\n }\n\n function setConfig(_config) {\n config = Object(__WEBPACK_IMPORTED_MODULE_2__helpers_common__[\"override\"])(config, _config);\n return this;\n }\n\n function setScales(_scales) {\n scales = Object(__WEBPACK_IMPORTED_MODULE_2__helpers_common__[\"override\"])(scales, _scales);\n return this;\n }\n\n function setTitle(_title) {\n cache.title = _title;\n return this;\n }\n\n function setXPosition(_xPosition) {\n cache.xPosition = _xPosition;\n return this;\n }\n\n function setYPosition(_yPosition) {\n cache.yPosition = _yPosition;\n return this;\n }\n\n function setContent(_content) {\n cache.content = _content;\n render();\n return this;\n }\n\n function render() {\n build();\n drawTitle();\n drawContent();\n move();\n return this;\n }\n\n function destroy() {\n if (cache.root) {\n cache.root.remove();\n cache.root = null;\n }\n return this;\n }\n\n return {\n bindEvents: bindEvents,\n setXPosition: setXPosition,\n setYPosition: setYPosition,\n setContent: setContent,\n setTitle: setTitle,\n hide: hide,\n show: show,\n setConfig: setConfig,\n setScales: setScales,\n destroy: destroy\n };\n}\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/charts/tooltip.js\n// module id = 4\n// module chunks = 0\n\n//# sourceURL=webpack:///./src/charts/tooltip.js?"); /***/ }), /* 5 */ @@ -117,105 +117,105 @@ eval("/* unused harmony export mapdUI */\n/* unused harmony export mapdColors */ /***/ }), /* 6 */ -/***/ (function(module, exports, __webpack_require__) { +/***/ (function(module, exports) { -eval("/* WEBPACK VAR INJECTION */(function(global, module) {/**\n * lodash (Custom Build) \n * Build: `lodash modularize exports=\"npm\" -o ./`\n * Copyright jQuery Foundation and other contributors \n * Released under MIT license \n * Based on Underscore.js 1.8.3 \n * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n */\n\n/** Used as the size to enable large array optimizations. */\nvar LARGE_ARRAY_SIZE = 200;\n\n/** Used to stand-in for `undefined` hash values. */\nvar HASH_UNDEFINED = '__lodash_hash_undefined__';\n\n/** Used as references for various `Number` constants. */\nvar MAX_SAFE_INTEGER = 9007199254740991;\n\n/** `Object#toString` result references. */\nvar argsTag = '[object Arguments]',\n arrayTag = '[object Array]',\n boolTag = '[object Boolean]',\n dateTag = '[object Date]',\n errorTag = '[object Error]',\n funcTag = '[object Function]',\n genTag = '[object GeneratorFunction]',\n mapTag = '[object Map]',\n numberTag = '[object Number]',\n objectTag = '[object Object]',\n promiseTag = '[object Promise]',\n regexpTag = '[object RegExp]',\n setTag = '[object Set]',\n stringTag = '[object String]',\n symbolTag = '[object Symbol]',\n weakMapTag = '[object WeakMap]';\n\nvar arrayBufferTag = '[object ArrayBuffer]',\n dataViewTag = '[object DataView]',\n float32Tag = '[object Float32Array]',\n float64Tag = '[object Float64Array]',\n int8Tag = '[object Int8Array]',\n int16Tag = '[object Int16Array]',\n int32Tag = '[object Int32Array]',\n uint8Tag = '[object Uint8Array]',\n uint8ClampedTag = '[object Uint8ClampedArray]',\n uint16Tag = '[object Uint16Array]',\n uint32Tag = '[object Uint32Array]';\n\n/**\n * Used to match `RegExp`\n * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).\n */\nvar reRegExpChar = /[\\\\^$.*+?()[\\]{}|]/g;\n\n/** Used to match `RegExp` flags from their coerced string values. */\nvar reFlags = /\\w*$/;\n\n/** Used to detect host constructors (Safari). */\nvar reIsHostCtor = /^\\[object .+?Constructor\\]$/;\n\n/** Used to detect unsigned integer values. */\nvar reIsUint = /^(?:0|[1-9]\\d*)$/;\n\n/** Used to identify `toStringTag` values supported by `_.clone`. */\nvar cloneableTags = {};\ncloneableTags[argsTag] = cloneableTags[arrayTag] =\ncloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =\ncloneableTags[boolTag] = cloneableTags[dateTag] =\ncloneableTags[float32Tag] = cloneableTags[float64Tag] =\ncloneableTags[int8Tag] = cloneableTags[int16Tag] =\ncloneableTags[int32Tag] = cloneableTags[mapTag] =\ncloneableTags[numberTag] = cloneableTags[objectTag] =\ncloneableTags[regexpTag] = cloneableTags[setTag] =\ncloneableTags[stringTag] = cloneableTags[symbolTag] =\ncloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =\ncloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;\ncloneableTags[errorTag] = cloneableTags[funcTag] =\ncloneableTags[weakMapTag] = false;\n\n/** Detect free variable `global` from Node.js. */\nvar freeGlobal = typeof global == 'object' && global && global.Object === Object && global;\n\n/** Detect free variable `self`. */\nvar freeSelf = typeof self == 'object' && self && self.Object === Object && self;\n\n/** Used as a reference to the global object. */\nvar root = freeGlobal || freeSelf || Function('return this')();\n\n/** Detect free variable `exports`. */\nvar freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;\n\n/** Detect free variable `module`. */\nvar freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;\n\n/** Detect the popular CommonJS extension `module.exports`. */\nvar moduleExports = freeModule && freeModule.exports === freeExports;\n\n/**\n * Adds the key-value `pair` to `map`.\n *\n * @private\n * @param {Object} map The map to modify.\n * @param {Array} pair The key-value pair to add.\n * @returns {Object} Returns `map`.\n */\nfunction addMapEntry(map, pair) {\n // Don't return `map.set` because it's not chainable in IE 11.\n map.set(pair[0], pair[1]);\n return map;\n}\n\n/**\n * Adds `value` to `set`.\n *\n * @private\n * @param {Object} set The set to modify.\n * @param {*} value The value to add.\n * @returns {Object} Returns `set`.\n */\nfunction addSetEntry(set, value) {\n // Don't return `set.add` because it's not chainable in IE 11.\n set.add(value);\n return set;\n}\n\n/**\n * A specialized version of `_.forEach` for arrays without support for\n * iteratee shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns `array`.\n */\nfunction arrayEach(array, iteratee) {\n var index = -1,\n length = array ? array.length : 0;\n\n while (++index < length) {\n if (iteratee(array[index], index, array) === false) {\n break;\n }\n }\n return array;\n}\n\n/**\n * Appends the elements of `values` to `array`.\n *\n * @private\n * @param {Array} array The array to modify.\n * @param {Array} values The values to append.\n * @returns {Array} Returns `array`.\n */\nfunction arrayPush(array, values) {\n var index = -1,\n length = values.length,\n offset = array.length;\n\n while (++index < length) {\n array[offset + index] = values[index];\n }\n return array;\n}\n\n/**\n * A specialized version of `_.reduce` for arrays without support for\n * iteratee shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @param {*} [accumulator] The initial value.\n * @param {boolean} [initAccum] Specify using the first element of `array` as\n * the initial value.\n * @returns {*} Returns the accumulated value.\n */\nfunction arrayReduce(array, iteratee, accumulator, initAccum) {\n var index = -1,\n length = array ? array.length : 0;\n\n if (initAccum && length) {\n accumulator = array[++index];\n }\n while (++index < length) {\n accumulator = iteratee(accumulator, array[index], index, array);\n }\n return accumulator;\n}\n\n/**\n * The base implementation of `_.times` without support for iteratee shorthands\n * or max array length checks.\n *\n * @private\n * @param {number} n The number of times to invoke `iteratee`.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the array of results.\n */\nfunction baseTimes(n, iteratee) {\n var index = -1,\n result = Array(n);\n\n while (++index < n) {\n result[index] = iteratee(index);\n }\n return result;\n}\n\n/**\n * Gets the value at `key` of `object`.\n *\n * @private\n * @param {Object} [object] The object to query.\n * @param {string} key The key of the property to get.\n * @returns {*} Returns the property value.\n */\nfunction getValue(object, key) {\n return object == null ? undefined : object[key];\n}\n\n/**\n * Checks if `value` is a host object in IE < 9.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a host object, else `false`.\n */\nfunction isHostObject(value) {\n // Many host objects are `Object` objects that can coerce to strings\n // despite having improperly defined `toString` methods.\n var result = false;\n if (value != null && typeof value.toString != 'function') {\n try {\n result = !!(value + '');\n } catch (e) {}\n }\n return result;\n}\n\n/**\n * Converts `map` to its key-value pairs.\n *\n * @private\n * @param {Object} map The map to convert.\n * @returns {Array} Returns the key-value pairs.\n */\nfunction mapToArray(map) {\n var index = -1,\n result = Array(map.size);\n\n map.forEach(function(value, key) {\n result[++index] = [key, value];\n });\n return result;\n}\n\n/**\n * Creates a unary function that invokes `func` with its argument transformed.\n *\n * @private\n * @param {Function} func The function to wrap.\n * @param {Function} transform The argument transform.\n * @returns {Function} Returns the new function.\n */\nfunction overArg(func, transform) {\n return function(arg) {\n return func(transform(arg));\n };\n}\n\n/**\n * Converts `set` to an array of its values.\n *\n * @private\n * @param {Object} set The set to convert.\n * @returns {Array} Returns the values.\n */\nfunction setToArray(set) {\n var index = -1,\n result = Array(set.size);\n\n set.forEach(function(value) {\n result[++index] = value;\n });\n return result;\n}\n\n/** Used for built-in method references. */\nvar arrayProto = Array.prototype,\n funcProto = Function.prototype,\n objectProto = Object.prototype;\n\n/** Used to detect overreaching core-js shims. */\nvar coreJsData = root['__core-js_shared__'];\n\n/** Used to detect methods masquerading as native. */\nvar maskSrcKey = (function() {\n var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');\n return uid ? ('Symbol(src)_1.' + uid) : '';\n}());\n\n/** Used to resolve the decompiled source of functions. */\nvar funcToString = funcProto.toString;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar objectToString = objectProto.toString;\n\n/** Used to detect if a method is native. */\nvar reIsNative = RegExp('^' +\n funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\\\$&')\n .replace(/hasOwnProperty|(function).*?(?=\\\\\\()| for .+?(?=\\\\\\])/g, '$1.*?') + '$'\n);\n\n/** Built-in value references. */\nvar Buffer = moduleExports ? root.Buffer : undefined,\n Symbol = root.Symbol,\n Uint8Array = root.Uint8Array,\n getPrototype = overArg(Object.getPrototypeOf, Object),\n objectCreate = Object.create,\n propertyIsEnumerable = objectProto.propertyIsEnumerable,\n splice = arrayProto.splice;\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeGetSymbols = Object.getOwnPropertySymbols,\n nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,\n nativeKeys = overArg(Object.keys, Object);\n\n/* Built-in method references that are verified to be native. */\nvar DataView = getNative(root, 'DataView'),\n Map = getNative(root, 'Map'),\n Promise = getNative(root, 'Promise'),\n Set = getNative(root, 'Set'),\n WeakMap = getNative(root, 'WeakMap'),\n nativeCreate = getNative(Object, 'create');\n\n/** Used to detect maps, sets, and weakmaps. */\nvar dataViewCtorString = toSource(DataView),\n mapCtorString = toSource(Map),\n promiseCtorString = toSource(Promise),\n setCtorString = toSource(Set),\n weakMapCtorString = toSource(WeakMap);\n\n/** Used to convert symbols to primitives and strings. */\nvar symbolProto = Symbol ? Symbol.prototype : undefined,\n symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;\n\n/**\n * Creates a hash object.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction Hash(entries) {\n var index = -1,\n length = entries ? entries.length : 0;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n/**\n * Removes all key-value entries from the hash.\n *\n * @private\n * @name clear\n * @memberOf Hash\n */\nfunction hashClear() {\n this.__data__ = nativeCreate ? nativeCreate(null) : {};\n}\n\n/**\n * Removes `key` and its value from the hash.\n *\n * @private\n * @name delete\n * @memberOf Hash\n * @param {Object} hash The hash to modify.\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction hashDelete(key) {\n return this.has(key) && delete this.__data__[key];\n}\n\n/**\n * Gets the hash value for `key`.\n *\n * @private\n * @name get\n * @memberOf Hash\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction hashGet(key) {\n var data = this.__data__;\n if (nativeCreate) {\n var result = data[key];\n return result === HASH_UNDEFINED ? undefined : result;\n }\n return hasOwnProperty.call(data, key) ? data[key] : undefined;\n}\n\n/**\n * Checks if a hash value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf Hash\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction hashHas(key) {\n var data = this.__data__;\n return nativeCreate ? data[key] !== undefined : hasOwnProperty.call(data, key);\n}\n\n/**\n * Sets the hash `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf Hash\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the hash instance.\n */\nfunction hashSet(key, value) {\n var data = this.__data__;\n data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;\n return this;\n}\n\n// Add methods to `Hash`.\nHash.prototype.clear = hashClear;\nHash.prototype['delete'] = hashDelete;\nHash.prototype.get = hashGet;\nHash.prototype.has = hashHas;\nHash.prototype.set = hashSet;\n\n/**\n * Creates an list cache object.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction ListCache(entries) {\n var index = -1,\n length = entries ? entries.length : 0;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n/**\n * Removes all key-value entries from the list cache.\n *\n * @private\n * @name clear\n * @memberOf ListCache\n */\nfunction listCacheClear() {\n this.__data__ = [];\n}\n\n/**\n * Removes `key` and its value from the list cache.\n *\n * @private\n * @name delete\n * @memberOf ListCache\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction listCacheDelete(key) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n if (index < 0) {\n return false;\n }\n var lastIndex = data.length - 1;\n if (index == lastIndex) {\n data.pop();\n } else {\n splice.call(data, index, 1);\n }\n return true;\n}\n\n/**\n * Gets the list cache value for `key`.\n *\n * @private\n * @name get\n * @memberOf ListCache\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction listCacheGet(key) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n return index < 0 ? undefined : data[index][1];\n}\n\n/**\n * Checks if a list cache value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf ListCache\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction listCacheHas(key) {\n return assocIndexOf(this.__data__, key) > -1;\n}\n\n/**\n * Sets the list cache `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf ListCache\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the list cache instance.\n */\nfunction listCacheSet(key, value) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n if (index < 0) {\n data.push([key, value]);\n } else {\n data[index][1] = value;\n }\n return this;\n}\n\n// Add methods to `ListCache`.\nListCache.prototype.clear = listCacheClear;\nListCache.prototype['delete'] = listCacheDelete;\nListCache.prototype.get = listCacheGet;\nListCache.prototype.has = listCacheHas;\nListCache.prototype.set = listCacheSet;\n\n/**\n * Creates a map cache object to store key-value pairs.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction MapCache(entries) {\n var index = -1,\n length = entries ? entries.length : 0;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n/**\n * Removes all key-value entries from the map.\n *\n * @private\n * @name clear\n * @memberOf MapCache\n */\nfunction mapCacheClear() {\n this.__data__ = {\n 'hash': new Hash,\n 'map': new (Map || ListCache),\n 'string': new Hash\n };\n}\n\n/**\n * Removes `key` and its value from the map.\n *\n * @private\n * @name delete\n * @memberOf MapCache\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction mapCacheDelete(key) {\n return getMapData(this, key)['delete'](key);\n}\n\n/**\n * Gets the map value for `key`.\n *\n * @private\n * @name get\n * @memberOf MapCache\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction mapCacheGet(key) {\n return getMapData(this, key).get(key);\n}\n\n/**\n * Checks if a map value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf MapCache\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction mapCacheHas(key) {\n return getMapData(this, key).has(key);\n}\n\n/**\n * Sets the map `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf MapCache\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the map cache instance.\n */\nfunction mapCacheSet(key, value) {\n getMapData(this, key).set(key, value);\n return this;\n}\n\n// Add methods to `MapCache`.\nMapCache.prototype.clear = mapCacheClear;\nMapCache.prototype['delete'] = mapCacheDelete;\nMapCache.prototype.get = mapCacheGet;\nMapCache.prototype.has = mapCacheHas;\nMapCache.prototype.set = mapCacheSet;\n\n/**\n * Creates a stack cache object to store key-value pairs.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction Stack(entries) {\n this.__data__ = new ListCache(entries);\n}\n\n/**\n * Removes all key-value entries from the stack.\n *\n * @private\n * @name clear\n * @memberOf Stack\n */\nfunction stackClear() {\n this.__data__ = new ListCache;\n}\n\n/**\n * Removes `key` and its value from the stack.\n *\n * @private\n * @name delete\n * @memberOf Stack\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction stackDelete(key) {\n return this.__data__['delete'](key);\n}\n\n/**\n * Gets the stack value for `key`.\n *\n * @private\n * @name get\n * @memberOf Stack\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction stackGet(key) {\n return this.__data__.get(key);\n}\n\n/**\n * Checks if a stack value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf Stack\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction stackHas(key) {\n return this.__data__.has(key);\n}\n\n/**\n * Sets the stack `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf Stack\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the stack cache instance.\n */\nfunction stackSet(key, value) {\n var cache = this.__data__;\n if (cache instanceof ListCache) {\n var pairs = cache.__data__;\n if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {\n pairs.push([key, value]);\n return this;\n }\n cache = this.__data__ = new MapCache(pairs);\n }\n cache.set(key, value);\n return this;\n}\n\n// Add methods to `Stack`.\nStack.prototype.clear = stackClear;\nStack.prototype['delete'] = stackDelete;\nStack.prototype.get = stackGet;\nStack.prototype.has = stackHas;\nStack.prototype.set = stackSet;\n\n/**\n * Creates an array of the enumerable property names of the array-like `value`.\n *\n * @private\n * @param {*} value The value to query.\n * @param {boolean} inherited Specify returning inherited property names.\n * @returns {Array} Returns the array of property names.\n */\nfunction arrayLikeKeys(value, inherited) {\n // Safari 8.1 makes `arguments.callee` enumerable in strict mode.\n // Safari 9 makes `arguments.length` enumerable in strict mode.\n var result = (isArray(value) || isArguments(value))\n ? baseTimes(value.length, String)\n : [];\n\n var length = result.length,\n skipIndexes = !!length;\n\n for (var key in value) {\n if ((inherited || hasOwnProperty.call(value, key)) &&\n !(skipIndexes && (key == 'length' || isIndex(key, length)))) {\n result.push(key);\n }\n }\n return result;\n}\n\n/**\n * Assigns `value` to `key` of `object` if the existing value is not equivalent\n * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * for equality comparisons.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {string} key The key of the property to assign.\n * @param {*} value The value to assign.\n */\nfunction assignValue(object, key, value) {\n var objValue = object[key];\n if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||\n (value === undefined && !(key in object))) {\n object[key] = value;\n }\n}\n\n/**\n * Gets the index at which the `key` is found in `array` of key-value pairs.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {*} key The key to search for.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\nfunction assocIndexOf(array, key) {\n var length = array.length;\n while (length--) {\n if (eq(array[length][0], key)) {\n return length;\n }\n }\n return -1;\n}\n\n/**\n * The base implementation of `_.assign` without support for multiple sources\n * or `customizer` functions.\n *\n * @private\n * @param {Object} object The destination object.\n * @param {Object} source The source object.\n * @returns {Object} Returns `object`.\n */\nfunction baseAssign(object, source) {\n return object && copyObject(source, keys(source), object);\n}\n\n/**\n * The base implementation of `_.clone` and `_.cloneDeep` which tracks\n * traversed objects.\n *\n * @private\n * @param {*} value The value to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @param {boolean} [isFull] Specify a clone including symbols.\n * @param {Function} [customizer] The function to customize cloning.\n * @param {string} [key] The key of `value`.\n * @param {Object} [object] The parent object of `value`.\n * @param {Object} [stack] Tracks traversed objects and their clone counterparts.\n * @returns {*} Returns the cloned value.\n */\nfunction baseClone(value, isDeep, isFull, customizer, key, object, stack) {\n var result;\n if (customizer) {\n result = object ? customizer(value, key, object, stack) : customizer(value);\n }\n if (result !== undefined) {\n return result;\n }\n if (!isObject(value)) {\n return value;\n }\n var isArr = isArray(value);\n if (isArr) {\n result = initCloneArray(value);\n if (!isDeep) {\n return copyArray(value, result);\n }\n } else {\n var tag = getTag(value),\n isFunc = tag == funcTag || tag == genTag;\n\n if (isBuffer(value)) {\n return cloneBuffer(value, isDeep);\n }\n if (tag == objectTag || tag == argsTag || (isFunc && !object)) {\n if (isHostObject(value)) {\n return object ? value : {};\n }\n result = initCloneObject(isFunc ? {} : value);\n if (!isDeep) {\n return copySymbols(value, baseAssign(result, value));\n }\n } else {\n if (!cloneableTags[tag]) {\n return object ? value : {};\n }\n result = initCloneByTag(value, tag, baseClone, isDeep);\n }\n }\n // Check for circular references and return its corresponding clone.\n stack || (stack = new Stack);\n var stacked = stack.get(value);\n if (stacked) {\n return stacked;\n }\n stack.set(value, result);\n\n if (!isArr) {\n var props = isFull ? getAllKeys(value) : keys(value);\n }\n arrayEach(props || value, function(subValue, key) {\n if (props) {\n key = subValue;\n subValue = value[key];\n }\n // Recursively populate clone (susceptible to call stack limits).\n assignValue(result, key, baseClone(subValue, isDeep, isFull, customizer, key, value, stack));\n });\n return result;\n}\n\n/**\n * The base implementation of `_.create` without support for assigning\n * properties to the created object.\n *\n * @private\n * @param {Object} prototype The object to inherit from.\n * @returns {Object} Returns the new object.\n */\nfunction baseCreate(proto) {\n return isObject(proto) ? objectCreate(proto) : {};\n}\n\n/**\n * The base implementation of `getAllKeys` and `getAllKeysIn` which uses\n * `keysFunc` and `symbolsFunc` to get the enumerable property names and\n * symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Function} keysFunc The function to get the keys of `object`.\n * @param {Function} symbolsFunc The function to get the symbols of `object`.\n * @returns {Array} Returns the array of property names and symbols.\n */\nfunction baseGetAllKeys(object, keysFunc, symbolsFunc) {\n var result = keysFunc(object);\n return isArray(object) ? result : arrayPush(result, symbolsFunc(object));\n}\n\n/**\n * The base implementation of `getTag`.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n */\nfunction baseGetTag(value) {\n return objectToString.call(value);\n}\n\n/**\n * The base implementation of `_.isNative` without bad shim checks.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a native function,\n * else `false`.\n */\nfunction baseIsNative(value) {\n if (!isObject(value) || isMasked(value)) {\n return false;\n }\n var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor;\n return pattern.test(toSource(value));\n}\n\n/**\n * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\nfunction baseKeys(object) {\n if (!isPrototype(object)) {\n return nativeKeys(object);\n }\n var result = [];\n for (var key in Object(object)) {\n if (hasOwnProperty.call(object, key) && key != 'constructor') {\n result.push(key);\n }\n }\n return result;\n}\n\n/**\n * Creates a clone of `buffer`.\n *\n * @private\n * @param {Buffer} buffer The buffer to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Buffer} Returns the cloned buffer.\n */\nfunction cloneBuffer(buffer, isDeep) {\n if (isDeep) {\n return buffer.slice();\n }\n var result = new buffer.constructor(buffer.length);\n buffer.copy(result);\n return result;\n}\n\n/**\n * Creates a clone of `arrayBuffer`.\n *\n * @private\n * @param {ArrayBuffer} arrayBuffer The array buffer to clone.\n * @returns {ArrayBuffer} Returns the cloned array buffer.\n */\nfunction cloneArrayBuffer(arrayBuffer) {\n var result = new arrayBuffer.constructor(arrayBuffer.byteLength);\n new Uint8Array(result).set(new Uint8Array(arrayBuffer));\n return result;\n}\n\n/**\n * Creates a clone of `dataView`.\n *\n * @private\n * @param {Object} dataView The data view to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Object} Returns the cloned data view.\n */\nfunction cloneDataView(dataView, isDeep) {\n var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;\n return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);\n}\n\n/**\n * Creates a clone of `map`.\n *\n * @private\n * @param {Object} map The map to clone.\n * @param {Function} cloneFunc The function to clone values.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Object} Returns the cloned map.\n */\nfunction cloneMap(map, isDeep, cloneFunc) {\n var array = isDeep ? cloneFunc(mapToArray(map), true) : mapToArray(map);\n return arrayReduce(array, addMapEntry, new map.constructor);\n}\n\n/**\n * Creates a clone of `regexp`.\n *\n * @private\n * @param {Object} regexp The regexp to clone.\n * @returns {Object} Returns the cloned regexp.\n */\nfunction cloneRegExp(regexp) {\n var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));\n result.lastIndex = regexp.lastIndex;\n return result;\n}\n\n/**\n * Creates a clone of `set`.\n *\n * @private\n * @param {Object} set The set to clone.\n * @param {Function} cloneFunc The function to clone values.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Object} Returns the cloned set.\n */\nfunction cloneSet(set, isDeep, cloneFunc) {\n var array = isDeep ? cloneFunc(setToArray(set), true) : setToArray(set);\n return arrayReduce(array, addSetEntry, new set.constructor);\n}\n\n/**\n * Creates a clone of the `symbol` object.\n *\n * @private\n * @param {Object} symbol The symbol object to clone.\n * @returns {Object} Returns the cloned symbol object.\n */\nfunction cloneSymbol(symbol) {\n return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};\n}\n\n/**\n * Creates a clone of `typedArray`.\n *\n * @private\n * @param {Object} typedArray The typed array to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Object} Returns the cloned typed array.\n */\nfunction cloneTypedArray(typedArray, isDeep) {\n var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;\n return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);\n}\n\n/**\n * Copies the values of `source` to `array`.\n *\n * @private\n * @param {Array} source The array to copy values from.\n * @param {Array} [array=[]] The array to copy values to.\n * @returns {Array} Returns `array`.\n */\nfunction copyArray(source, array) {\n var index = -1,\n length = source.length;\n\n array || (array = Array(length));\n while (++index < length) {\n array[index] = source[index];\n }\n return array;\n}\n\n/**\n * Copies properties of `source` to `object`.\n *\n * @private\n * @param {Object} source The object to copy properties from.\n * @param {Array} props The property identifiers to copy.\n * @param {Object} [object={}] The object to copy properties to.\n * @param {Function} [customizer] The function to customize copied values.\n * @returns {Object} Returns `object`.\n */\nfunction copyObject(source, props, object, customizer) {\n object || (object = {});\n\n var index = -1,\n length = props.length;\n\n while (++index < length) {\n var key = props[index];\n\n var newValue = customizer\n ? customizer(object[key], source[key], key, object, source)\n : undefined;\n\n assignValue(object, key, newValue === undefined ? source[key] : newValue);\n }\n return object;\n}\n\n/**\n * Copies own symbol properties of `source` to `object`.\n *\n * @private\n * @param {Object} source The object to copy symbols from.\n * @param {Object} [object={}] The object to copy symbols to.\n * @returns {Object} Returns `object`.\n */\nfunction copySymbols(source, object) {\n return copyObject(source, getSymbols(source), object);\n}\n\n/**\n * Creates an array of own enumerable property names and symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names and symbols.\n */\nfunction getAllKeys(object) {\n return baseGetAllKeys(object, keys, getSymbols);\n}\n\n/**\n * Gets the data for `map`.\n *\n * @private\n * @param {Object} map The map to query.\n * @param {string} key The reference key.\n * @returns {*} Returns the map data.\n */\nfunction getMapData(map, key) {\n var data = map.__data__;\n return isKeyable(key)\n ? data[typeof key == 'string' ? 'string' : 'hash']\n : data.map;\n}\n\n/**\n * Gets the native function at `key` of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {string} key The key of the method to get.\n * @returns {*} Returns the function if it's native, else `undefined`.\n */\nfunction getNative(object, key) {\n var value = getValue(object, key);\n return baseIsNative(value) ? value : undefined;\n}\n\n/**\n * Creates an array of the own enumerable symbol properties of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of symbols.\n */\nvar getSymbols = nativeGetSymbols ? overArg(nativeGetSymbols, Object) : stubArray;\n\n/**\n * Gets the `toStringTag` of `value`.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n */\nvar getTag = baseGetTag;\n\n// Fallback for data views, maps, sets, and weak maps in IE 11,\n// for data views in Edge < 14, and promises in Node.js.\nif ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||\n (Map && getTag(new Map) != mapTag) ||\n (Promise && getTag(Promise.resolve()) != promiseTag) ||\n (Set && getTag(new Set) != setTag) ||\n (WeakMap && getTag(new WeakMap) != weakMapTag)) {\n getTag = function(value) {\n var result = objectToString.call(value),\n Ctor = result == objectTag ? value.constructor : undefined,\n ctorString = Ctor ? toSource(Ctor) : undefined;\n\n if (ctorString) {\n switch (ctorString) {\n case dataViewCtorString: return dataViewTag;\n case mapCtorString: return mapTag;\n case promiseCtorString: return promiseTag;\n case setCtorString: return setTag;\n case weakMapCtorString: return weakMapTag;\n }\n }\n return result;\n };\n}\n\n/**\n * Initializes an array clone.\n *\n * @private\n * @param {Array} array The array to clone.\n * @returns {Array} Returns the initialized clone.\n */\nfunction initCloneArray(array) {\n var length = array.length,\n result = array.constructor(length);\n\n // Add properties assigned by `RegExp#exec`.\n if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {\n result.index = array.index;\n result.input = array.input;\n }\n return result;\n}\n\n/**\n * Initializes an object clone.\n *\n * @private\n * @param {Object} object The object to clone.\n * @returns {Object} Returns the initialized clone.\n */\nfunction initCloneObject(object) {\n return (typeof object.constructor == 'function' && !isPrototype(object))\n ? baseCreate(getPrototype(object))\n : {};\n}\n\n/**\n * Initializes an object clone based on its `toStringTag`.\n *\n * **Note:** This function only supports cloning values with tags of\n * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.\n *\n * @private\n * @param {Object} object The object to clone.\n * @param {string} tag The `toStringTag` of the object to clone.\n * @param {Function} cloneFunc The function to clone values.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Object} Returns the initialized clone.\n */\nfunction initCloneByTag(object, tag, cloneFunc, isDeep) {\n var Ctor = object.constructor;\n switch (tag) {\n case arrayBufferTag:\n return cloneArrayBuffer(object);\n\n case boolTag:\n case dateTag:\n return new Ctor(+object);\n\n case dataViewTag:\n return cloneDataView(object, isDeep);\n\n case float32Tag: case float64Tag:\n case int8Tag: case int16Tag: case int32Tag:\n case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:\n return cloneTypedArray(object, isDeep);\n\n case mapTag:\n return cloneMap(object, isDeep, cloneFunc);\n\n case numberTag:\n case stringTag:\n return new Ctor(object);\n\n case regexpTag:\n return cloneRegExp(object);\n\n case setTag:\n return cloneSet(object, isDeep, cloneFunc);\n\n case symbolTag:\n return cloneSymbol(object);\n }\n}\n\n/**\n * Checks if `value` is a valid array-like index.\n *\n * @private\n * @param {*} value The value to check.\n * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.\n * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.\n */\nfunction isIndex(value, length) {\n length = length == null ? MAX_SAFE_INTEGER : length;\n return !!length &&\n (typeof value == 'number' || reIsUint.test(value)) &&\n (value > -1 && value % 1 == 0 && value < length);\n}\n\n/**\n * Checks if `value` is suitable for use as unique object key.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is suitable, else `false`.\n */\nfunction isKeyable(value) {\n var type = typeof value;\n return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')\n ? (value !== '__proto__')\n : (value === null);\n}\n\n/**\n * Checks if `func` has its source masked.\n *\n * @private\n * @param {Function} func The function to check.\n * @returns {boolean} Returns `true` if `func` is masked, else `false`.\n */\nfunction isMasked(func) {\n return !!maskSrcKey && (maskSrcKey in func);\n}\n\n/**\n * Checks if `value` is likely a prototype object.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.\n */\nfunction isPrototype(value) {\n var Ctor = value && value.constructor,\n proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;\n\n return value === proto;\n}\n\n/**\n * Converts `func` to its source code.\n *\n * @private\n * @param {Function} func The function to process.\n * @returns {string} Returns the source code.\n */\nfunction toSource(func) {\n if (func != null) {\n try {\n return funcToString.call(func);\n } catch (e) {}\n try {\n return (func + '');\n } catch (e) {}\n }\n return '';\n}\n\n/**\n * This method is like `_.clone` except that it recursively clones `value`.\n *\n * @static\n * @memberOf _\n * @since 1.0.0\n * @category Lang\n * @param {*} value The value to recursively clone.\n * @returns {*} Returns the deep cloned value.\n * @see _.clone\n * @example\n *\n * var objects = [{ 'a': 1 }, { 'b': 2 }];\n *\n * var deep = _.cloneDeep(objects);\n * console.log(deep[0] === objects[0]);\n * // => false\n */\nfunction cloneDeep(value) {\n return baseClone(value, true, true);\n}\n\n/**\n * Performs a\n * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * comparison between two values to determine if they are equivalent.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n * @example\n *\n * var object = { 'a': 1 };\n * var other = { 'a': 1 };\n *\n * _.eq(object, object);\n * // => true\n *\n * _.eq(object, other);\n * // => false\n *\n * _.eq('a', 'a');\n * // => true\n *\n * _.eq('a', Object('a'));\n * // => false\n *\n * _.eq(NaN, NaN);\n * // => true\n */\nfunction eq(value, other) {\n return value === other || (value !== value && other !== other);\n}\n\n/**\n * Checks if `value` is likely an `arguments` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an `arguments` object,\n * else `false`.\n * @example\n *\n * _.isArguments(function() { return arguments; }());\n * // => true\n *\n * _.isArguments([1, 2, 3]);\n * // => false\n */\nfunction isArguments(value) {\n // Safari 8.1 makes `arguments.callee` enumerable in strict mode.\n return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') &&\n (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag);\n}\n\n/**\n * Checks if `value` is classified as an `Array` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an array, else `false`.\n * @example\n *\n * _.isArray([1, 2, 3]);\n * // => true\n *\n * _.isArray(document.body.children);\n * // => false\n *\n * _.isArray('abc');\n * // => false\n *\n * _.isArray(_.noop);\n * // => false\n */\nvar isArray = Array.isArray;\n\n/**\n * Checks if `value` is array-like. A value is considered array-like if it's\n * not a function and has a `value.length` that's an integer greater than or\n * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is array-like, else `false`.\n * @example\n *\n * _.isArrayLike([1, 2, 3]);\n * // => true\n *\n * _.isArrayLike(document.body.children);\n * // => true\n *\n * _.isArrayLike('abc');\n * // => true\n *\n * _.isArrayLike(_.noop);\n * // => false\n */\nfunction isArrayLike(value) {\n return value != null && isLength(value.length) && !isFunction(value);\n}\n\n/**\n * This method is like `_.isArrayLike` except that it also checks if `value`\n * is an object.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an array-like object,\n * else `false`.\n * @example\n *\n * _.isArrayLikeObject([1, 2, 3]);\n * // => true\n *\n * _.isArrayLikeObject(document.body.children);\n * // => true\n *\n * _.isArrayLikeObject('abc');\n * // => false\n *\n * _.isArrayLikeObject(_.noop);\n * // => false\n */\nfunction isArrayLikeObject(value) {\n return isObjectLike(value) && isArrayLike(value);\n}\n\n/**\n * Checks if `value` is a buffer.\n *\n * @static\n * @memberOf _\n * @since 4.3.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.\n * @example\n *\n * _.isBuffer(new Buffer(2));\n * // => true\n *\n * _.isBuffer(new Uint8Array(2));\n * // => false\n */\nvar isBuffer = nativeIsBuffer || stubFalse;\n\n/**\n * Checks if `value` is classified as a `Function` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a function, else `false`.\n * @example\n *\n * _.isFunction(_);\n * // => true\n *\n * _.isFunction(/abc/);\n * // => false\n */\nfunction isFunction(value) {\n // The use of `Object#toString` avoids issues with the `typeof` operator\n // in Safari 8-9 which returns 'object' for typed array and other constructors.\n var tag = isObject(value) ? objectToString.call(value) : '';\n return tag == funcTag || tag == genTag;\n}\n\n/**\n * Checks if `value` is a valid array-like length.\n *\n * **Note:** This method is loosely based on\n * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.\n * @example\n *\n * _.isLength(3);\n * // => true\n *\n * _.isLength(Number.MIN_VALUE);\n * // => false\n *\n * _.isLength(Infinity);\n * // => false\n *\n * _.isLength('3');\n * // => false\n */\nfunction isLength(value) {\n return typeof value == 'number' &&\n value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;\n}\n\n/**\n * Checks if `value` is the\n * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)\n * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n var type = typeof value;\n return !!value && (type == 'object' || type == 'function');\n}\n\n/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n return !!value && typeof value == 'object';\n}\n\n/**\n * Creates an array of the own enumerable property names of `object`.\n *\n * **Note:** Non-object values are coerced to objects. See the\n * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)\n * for more details.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.keys(new Foo);\n * // => ['a', 'b'] (iteration order is not guaranteed)\n *\n * _.keys('hi');\n * // => ['0', '1']\n */\nfunction keys(object) {\n return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);\n}\n\n/**\n * This method returns a new empty array.\n *\n * @static\n * @memberOf _\n * @since 4.13.0\n * @category Util\n * @returns {Array} Returns the new empty array.\n * @example\n *\n * var arrays = _.times(2, _.stubArray);\n *\n * console.log(arrays);\n * // => [[], []]\n *\n * console.log(arrays[0] === arrays[1]);\n * // => false\n */\nfunction stubArray() {\n return [];\n}\n\n/**\n * This method returns `false`.\n *\n * @static\n * @memberOf _\n * @since 4.13.0\n * @category Util\n * @returns {boolean} Returns `false`.\n * @example\n *\n * _.times(2, _.stubFalse);\n * // => [false, false]\n */\nfunction stubFalse() {\n return false;\n}\n\nmodule.exports = cloneDeep;\n\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(7), __webpack_require__(21)(module)))\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/lodash.clonedeep/index.js\n// module id = 6\n// module chunks = 0\n\n//# sourceURL=webpack:///./node_modules/lodash.clonedeep/index.js?"); +eval("var g;\r\n\r\n// This works in non-strict mode\r\ng = (function() {\r\n\treturn this;\r\n})();\r\n\r\ntry {\r\n\t// This works if eval is allowed (see CSP)\r\n\tg = g || Function(\"return this\")() || (1,eval)(\"this\");\r\n} catch(e) {\r\n\t// This works if the window reference is available\r\n\tif(typeof window === \"object\")\r\n\t\tg = window;\r\n}\r\n\r\n// g can still be undefined, but nothing to do about it...\r\n// We return undefined, instead of nothing here, so it's\r\n// easier to handle this case. if(!global) { ...}\r\n\r\nmodule.exports = g;\r\n\n\n//////////////////\n// WEBPACK FOOTER\n// (webpack)/buildin/global.js\n// module id = 6\n// module chunks = 0\n\n//# sourceURL=webpack:///(webpack)/buildin/global.js?"); /***/ }), /* 7 */ -/***/ (function(module, exports) { +/***/ (function(module, __webpack_exports__, __webpack_require__) { -eval("var g;\r\n\r\n// This works in non-strict mode\r\ng = (function() {\r\n\treturn this;\r\n})();\r\n\r\ntry {\r\n\t// This works if eval is allowed (see CSP)\r\n\tg = g || Function(\"return this\")() || (1,eval)(\"this\");\r\n} catch(e) {\r\n\t// This works if the window reference is available\r\n\tif(typeof window === \"object\")\r\n\t\tg = window;\r\n}\r\n\r\n// g can still be undefined, but nothing to do about it...\r\n// We return undefined, instead of nothing here, so it's\r\n// easier to handle this case. if(!global) { ...}\r\n\r\nmodule.exports = g;\r\n\n\n//////////////////\n// WEBPACK FOOTER\n// (webpack)/buildin/global.js\n// module id = 7\n// module chunks = 0\n\n//# sourceURL=webpack:///(webpack)/buildin/global.js?"); +"use strict"; +eval("/* harmony export (immutable) */ __webpack_exports__[\"b\"] = DataGenerator;\n/* harmony export (immutable) */ __webpack_exports__[\"a\"] = augmentData;\n/* harmony export (immutable) */ __webpack_exports__[\"c\"] = getNearestDataPoint;\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__ = __webpack_require__(0);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__helpers_constants__ = __webpack_require__(2);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__helpers_common__ = __webpack_require__(1);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_lodash_clonedeep__ = __webpack_require__(20);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_lodash_clonedeep___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_lodash_clonedeep__);\nvar _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };\n\nfunction _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }\n\n\n\n\n\n\n\nfunction DataGenerator() {\n /* eslint-disable no-magic-numbers */\n var config = {\n keyType: \"number\", // number, string, time,\n range: [0, 100],\n pointCount: 200,\n groupCount: 2,\n lineCount: 4,\n stringMinMaxLength: [4, 8],\n randomStepSize: 50,\n nullRatio: null\n };\n var cache = {\n data: null,\n baseDate: null\n };\n\n var DAY_IN_MS = 1000 * 60 * 60 * 24;\n\n function generateRandomString(_length) {\n var stringLength = _length;\n if (!_length) {\n var range = config.stringMinMaxLength;\n stringLength = Math.round(Math.random() * (range[1] - range[0])) + range[0];\n }\n return [].concat(_toConsumableArray(Array(stringLength))).map(function () {\n return String.fromCharCode(Math.round(Math.random() * 25) + 97);\n }).join(\"\");\n }\n\n function generateSeries(_dataKeys, _range) {\n var value = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"randomUniform\"].apply(__WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__, _toConsumableArray(_range))();\n var randomWalkStepSize = (_range[1] - _range[0]) / config.randomStepSize;\n var rnd = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"randomNormal\"](0, 1);\n return _dataKeys.map(function (d) {\n var isRandomNull = config.nullRatio && Math.random() * 100 / config.nullRatio < 1;\n value = Object(__WEBPACK_IMPORTED_MODULE_2__helpers_common__[\"clamp\"])(value + rnd() * randomWalkStepSize, _range);\n return {\n y: isRandomNull ? null : value,\n x: config.keyType === \"time\" ? d.toISOString() : d\n };\n });\n }\n\n function generateTestDataset() {\n var dataKeys = null;\n if (config.keyType === \"time\") {\n cache.baseDate = new Date();\n var previousDate = new Date(cache.baseDate.getTime() - DAY_IN_MS * config.pointCount);\n dataKeys = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"utcDay\"].range(previousDate, cache.baseDate);\n } else if (config.keyType === \"string\") {\n dataKeys = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"range\"](0, config.pointCount).map(function () {\n return generateRandomString();\n });\n dataKeys.sort(function (a, b) {\n return a.localeCompare(b, \"en\", { numeric: false });\n });\n } else if (config.keyType === \"number\") {\n dataKeys = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"range\"](0, config.pointCount).map(function (d, i) {\n return i;\n });\n }\n\n var series = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"range\"](config.lineCount).map(function (d) {\n return {\n name: \"Name \" + d,\n label: \"Label \" + d,\n id: d,\n group: d < config.groupCount ? d : 0,\n values: generateSeries(dataKeys, config.range),\n measureName: \"Measure \" + d\n };\n });\n\n cache.data = { series: series\n\n // console.log(\"generated data\", cache.data)\n\n };return cache.data;\n }\n\n function setConfig(_config) {\n config = Object.assign({}, config, _config);\n return this;\n }\n\n return {\n generateTestDataset: generateTestDataset,\n generateSeries: generateSeries,\n setConfig: setConfig\n };\n}\n\n// accessors\nvar getKey = function getKey(d) {\n return d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].KEY];\n};\nvar getID = function getID(d) {\n return d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].ID];\n};\n\nfunction augmentData(_data, _keyType, _sortBy, _fillData, _stackOffset, _yAxisPercentageFormat) {\n var dataBySeries = __WEBPACK_IMPORTED_MODULE_3_lodash_clonedeep___default()(_data[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].SERIES]);\n dataBySeries.forEach(function (serie) {\n // convert type\n serie[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].VALUES].forEach(function (d) {\n if (_keyType === \"time\") {\n d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].KEY] = convertToDate(d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].KEY]);\n }\n if (_fillData) {\n d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].VALUE] = Number(d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].VALUE]);\n }\n });\n });\n var flatData = [];\n\n // get all unique keys\n var allKeys = [];\n dataBySeries.forEach(function (d) {\n allKeys = allKeys.concat(d.values);\n });\n allKeys = allKeys.map(function (d) {\n return d.key;\n });\n allKeys = Object(__WEBPACK_IMPORTED_MODULE_2__helpers_common__[\"getUnique\"])(allKeys, _keyType);\n\n // Normalize dataBySeries\n dataBySeries.forEach(function (serie) {\n var keyValues = {};\n serie[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].VALUES].forEach(function (d) {\n keyValues[d.key] = d.value;\n });\n // fill data\n var filled = serie[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].VALUES];\n if (_fillData) {\n filled = allKeys.map(function (d) {\n return {\n key: d,\n value: typeof keyValues[d] === \"undefined\" ? null : keyValues[d]\n };\n });\n }\n\n // sort\n serie[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].VALUES] = Object(__WEBPACK_IMPORTED_MODULE_2__helpers_common__[\"sortData\"])(filled, _keyType);\n });\n\n // flatten data\n dataBySeries.forEach(function (serie) {\n serie[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].VALUES].forEach(function (d) {\n var dataPoint = _extends({}, serie);\n dataPoint[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].KEY] = d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].KEY];\n dataPoint[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].VALUE] = d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].VALUE];\n dataPoint[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].COUNTVAL] = d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].COUNTVAL];\n dataPoint[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].ABSOLUTEVAL] = d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].ABSOLUTEVAL];\n flatData.push(dataPoint);\n });\n });\n // sort flat data\n var flatDataSorted = Object(__WEBPACK_IMPORTED_MODULE_2__helpers_common__[\"sortData\"])(flatData, _keyType);\n\n var dataByKey = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"nest\"]().key(getKey).entries(flatDataSorted.map(function (d) {\n return _extends({}, d, {\n x: _keyType === \"time\" ? d.x.toISOString() : d.x\n });\n })).map(function (d) {\n var dataPoint = {};\n dataPoint[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].KEY] = _keyType === \"time\" ? new Date(d.key) : d.key;\n dataPoint[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].SERIES] = d.values;\n return dataPoint;\n });\n\n // get group keys\n var groupKeys = {};\n dataBySeries.forEach(function (d) {\n if (!groupKeys[d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].GROUP]]) {\n groupKeys[d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].GROUP]] = [];\n }\n groupKeys[d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].GROUP]].push(d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].ID]);\n });\n\n // stack data\n var stackData = dataByKey.map(function (d) {\n var points = {\n key: d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].KEY]\n };\n d.series.forEach(function (dB) {\n points[dB[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].ID]] = dB[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].VALUE];\n });\n return points;\n });\n\n // d3 stack\n var stack = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"stack\"]().keys(dataBySeries.map(getID)).value(function (d, key) {\n return d[key] || 0;\n }).order(__WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"stackOrderNone\"]).offset(__WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[_stackOffset]);\n\n // get stack totals\n var allKeyTotals = dataByKey.map(function (d) {\n return _extends({\n key: d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].KEY],\n total: __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"sum\"](d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].SERIES].map(function (dB) {\n return dB[typeof _yAxisPercentageFormat === \"string\" ? __WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].ABSOLUTEVAL : __WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].VALUE];\n }))\n }, d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].SERIES][0][__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].COUNTVAL] && { countval: __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"sum\"](d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].SERIES].map(function (dB) {\n return dB[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].COUNTVAL];\n })) });\n });\n\n // sort\n switch (_sortBy) {\n case __WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"comparators\"].TOTAL_ASCENDING:\n allKeyTotals.sort(Object(__WEBPACK_IMPORTED_MODULE_2__helpers_common__[\"ascendingComparator\"])(\"total\", _keyType));\n break;\n case __WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"comparators\"].TOTAL_DESCENDING:\n allKeyTotals.sort(Object(__WEBPACK_IMPORTED_MODULE_2__helpers_common__[\"descendingComparator\"])(\"total\", _keyType));\n break;\n case __WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"comparators\"].ALPHA_ASCENDING:\n allKeyTotals.sort(Object(__WEBPACK_IMPORTED_MODULE_2__helpers_common__[\"ascendingComparator\"])(\"key\", _keyType));\n break;\n case __WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"comparators\"].ALPHA_DESCENDING:\n allKeyTotals.sort(Object(__WEBPACK_IMPORTED_MODULE_2__helpers_common__[\"descendingComparator\"])(\"key\", _keyType));\n break;\n case __WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"comparators\"].COUNTVAL_ASCENDING:\n allKeyTotals.sort(Object(__WEBPACK_IMPORTED_MODULE_2__helpers_common__[\"ascendingComparator\"])(\"countval\", _keyType));\n break;\n case __WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"comparators\"].COUNTVAL_DESCENDING:\n allKeyTotals.sort(Object(__WEBPACK_IMPORTED_MODULE_2__helpers_common__[\"descendingComparator\"])(\"countval\", _keyType));\n break;\n default:\n break;\n }\n\n return { dataBySeries: dataBySeries, dataByKey: dataByKey, stack: stack, stackData: stackData, flatDataSorted: flatDataSorted, groupKeys: groupKeys, allKeyTotals: allKeyTotals };\n}\n\nfunction getNearestDataPoint(_mouseX, _dataObject, _scales, _keyType) {\n var keyFromInvertedX = Object(__WEBPACK_IMPORTED_MODULE_2__helpers_common__[\"invertScale\"])(_scales.xScale, _mouseX, _keyType);\n\n if (_keyType === \"string\") {\n // if we are keying on strings, simply find the value via a key match\n return _dataObject.dataByKey.find(function (d) {\n return d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].KEY] === keyFromInvertedX;\n });\n }\n\n var bisectLeft = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"bisector\"](getKey).left;\n var dataEntryIndex = bisectLeft(_dataObject.dataByKey, keyFromInvertedX);\n var dataEntryForXPosition = _dataObject.dataByKey[dataEntryIndex];\n var dataEntryForXPositionPrev = _dataObject.dataByKey[Math.max(dataEntryIndex - 1, 0)];\n\n var nearestDataPoint = null;\n if (keyFromInvertedX && dataEntryForXPosition && dataEntryForXPositionPrev) {\n if (keyFromInvertedX - dataEntryForXPositionPrev[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].KEY] < dataEntryForXPosition[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].KEY] - keyFromInvertedX) {\n nearestDataPoint = dataEntryForXPositionPrev;\n } else {\n nearestDataPoint = dataEntryForXPosition;\n }\n }\n return nearestDataPoint;\n}\n\nfunction convertToDate(_date) {\n // hacks to handle invalid date like \"0014-06-08T00:00:00.000Z\"\n return new Date(new Date(_date).toISOString());\n}\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/charts/data-manager.js\n// module id = 7\n// module chunks = 0\n\n//# sourceURL=webpack:///./src/charts/data-manager.js?"); /***/ }), /* 8 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -eval("/* harmony export (immutable) */ __webpack_exports__[\"b\"] = DataGenerator;\n/* harmony export (immutable) */ __webpack_exports__[\"a\"] = augmentData;\n/* harmony export (immutable) */ __webpack_exports__[\"c\"] = getNearestDataPoint;\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__ = __webpack_require__(0);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__helpers_constants__ = __webpack_require__(2);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__helpers_common__ = __webpack_require__(1);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_lodash_clonedeep__ = __webpack_require__(6);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_lodash_clonedeep___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_lodash_clonedeep__);\nvar _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };\n\nfunction _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }\n\n\n\n\n\n\n\nfunction DataGenerator() {\n /* eslint-disable no-magic-numbers */\n var config = {\n keyType: \"number\", // number, string, time,\n range: [0, 100],\n pointCount: 200,\n groupCount: 2,\n lineCount: 4,\n stringMinMaxLength: [4, 8],\n randomStepSize: 50,\n nullRatio: null\n };\n var cache = {\n data: null,\n baseDate: null\n };\n\n var DAY_IN_MS = 1000 * 60 * 60 * 24;\n\n function generateRandomString(_length) {\n var stringLength = _length;\n if (!_length) {\n var range = config.stringMinMaxLength;\n stringLength = Math.round(Math.random() * (range[1] - range[0])) + range[0];\n }\n return [].concat(_toConsumableArray(Array(stringLength))).map(function () {\n return String.fromCharCode(Math.round(Math.random() * 25) + 97);\n }).join(\"\");\n }\n\n function generateSeries(_dataKeys, _range) {\n var value = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"randomUniform\"].apply(__WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__, _toConsumableArray(_range))();\n var randomWalkStepSize = (_range[1] - _range[0]) / config.randomStepSize;\n var rnd = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"randomNormal\"](0, 1);\n return _dataKeys.map(function (d) {\n var isRandomNull = config.nullRatio && Math.random() * 100 / config.nullRatio < 1;\n value = Object(__WEBPACK_IMPORTED_MODULE_2__helpers_common__[\"clamp\"])(value + rnd() * randomWalkStepSize, _range);\n return {\n y: isRandomNull ? null : value,\n x: config.keyType === \"time\" ? d.toISOString() : d\n };\n });\n }\n\n function generateTestDataset() {\n var dataKeys = null;\n if (config.keyType === \"time\") {\n cache.baseDate = new Date();\n var previousDate = new Date(cache.baseDate.getTime() - DAY_IN_MS * config.pointCount);\n dataKeys = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"utcDay\"].range(previousDate, cache.baseDate);\n } else if (config.keyType === \"string\") {\n dataKeys = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"range\"](0, config.pointCount).map(function () {\n return generateRandomString();\n });\n dataKeys.sort(function (a, b) {\n return a.localeCompare(b, \"en\", { numeric: false });\n });\n } else if (config.keyType === \"number\") {\n dataKeys = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"range\"](0, config.pointCount).map(function (d, i) {\n return i;\n });\n }\n\n var series = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"range\"](config.lineCount).map(function (d) {\n return {\n name: \"Name \" + d,\n label: \"Label \" + d,\n id: d,\n group: d < config.groupCount ? d : 0,\n values: generateSeries(dataKeys, config.range),\n measureName: \"Measure \" + d\n };\n });\n\n cache.data = { series: series\n\n // console.log(\"generated data\", cache.data)\n\n };return cache.data;\n }\n\n function setConfig(_config) {\n config = Object.assign({}, config, _config);\n return this;\n }\n\n return {\n generateTestDataset: generateTestDataset,\n generateSeries: generateSeries,\n setConfig: setConfig\n };\n}\n\n// accessors\nvar getKey = function getKey(d) {\n return d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].KEY];\n};\nvar getID = function getID(d) {\n return d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].ID];\n};\n\nfunction augmentData(_data, _keyType, _sortBy, _fillData, _stackOffset, _yAxisPercentageFormat) {\n var dataBySeries = __WEBPACK_IMPORTED_MODULE_3_lodash_clonedeep___default()(_data[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].SERIES]);\n dataBySeries.forEach(function (serie) {\n // convert type\n serie[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].VALUES].forEach(function (d) {\n if (_keyType === \"time\") {\n d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].KEY] = convertToDate(d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].KEY]);\n }\n if (_fillData) {\n d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].VALUE] = Number(d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].VALUE]);\n }\n });\n });\n var flatData = [];\n\n // get all unique keys\n var allKeys = [];\n dataBySeries.forEach(function (d) {\n allKeys = allKeys.concat(d.values);\n });\n allKeys = allKeys.map(function (d) {\n return d.key;\n });\n allKeys = Object(__WEBPACK_IMPORTED_MODULE_2__helpers_common__[\"getUnique\"])(allKeys, _keyType);\n\n // Normalize dataBySeries\n dataBySeries.forEach(function (serie) {\n var keyValues = {};\n serie[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].VALUES].forEach(function (d) {\n keyValues[d.key] = d.value;\n });\n // fill data\n var filled = serie[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].VALUES];\n if (_fillData) {\n filled = allKeys.map(function (d) {\n return {\n key: d,\n value: typeof keyValues[d] === \"undefined\" ? null : keyValues[d]\n };\n });\n }\n\n // sort\n serie[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].VALUES] = Object(__WEBPACK_IMPORTED_MODULE_2__helpers_common__[\"sortData\"])(filled, _keyType);\n });\n\n // flatten data\n dataBySeries.forEach(function (serie) {\n serie[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].VALUES].forEach(function (d) {\n var dataPoint = _extends({}, serie);\n dataPoint[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].KEY] = d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].KEY];\n dataPoint[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].VALUE] = d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].VALUE];\n dataPoint[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].COUNTVAL] = d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].COUNTVAL];\n dataPoint[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].ABSOLUTEVAL] = d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].ABSOLUTEVAL];\n flatData.push(dataPoint);\n });\n });\n // sort flat data\n var flatDataSorted = Object(__WEBPACK_IMPORTED_MODULE_2__helpers_common__[\"sortData\"])(flatData, _keyType);\n\n var dataByKey = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"nest\"]().key(getKey).entries(flatDataSorted.map(function (d) {\n return _extends({}, d, {\n x: _keyType === \"time\" ? d.x.toISOString() : d.x\n });\n })).map(function (d) {\n var dataPoint = {};\n dataPoint[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].KEY] = _keyType === \"time\" ? new Date(d.key) : d.key;\n dataPoint[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].SERIES] = d.values;\n return dataPoint;\n });\n\n // get group keys\n var groupKeys = {};\n dataBySeries.forEach(function (d) {\n if (!groupKeys[d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].GROUP]]) {\n groupKeys[d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].GROUP]] = [];\n }\n groupKeys[d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].GROUP]].push(d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].ID]);\n });\n\n // stack data\n var stackData = dataByKey.map(function (d) {\n var points = {\n key: d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].KEY]\n };\n d.series.forEach(function (dB) {\n points[dB[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].ID]] = dB[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].VALUE];\n });\n return points;\n });\n\n // d3 stack\n var stack = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"stack\"]().keys(dataBySeries.map(getID)).value(function (d, key) {\n return d[key] || 0;\n }).order(__WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"stackOrderNone\"]).offset(__WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[_stackOffset]);\n\n // get stack totals\n var allKeyTotals = dataByKey.map(function (d) {\n return _extends({\n key: d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].KEY],\n total: __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"sum\"](d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].SERIES].map(function (dB) {\n return dB[typeof _yAxisPercentageFormat === \"string\" ? __WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].ABSOLUTEVAL : __WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].VALUE];\n }))\n }, d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].SERIES][0][__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].COUNTVAL] && { countval: __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"sum\"](d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].SERIES].map(function (dB) {\n return dB[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].COUNTVAL];\n })) });\n });\n\n // sort\n switch (_sortBy) {\n case __WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"comparators\"].TOTAL_ASCENDING:\n allKeyTotals.sort(Object(__WEBPACK_IMPORTED_MODULE_2__helpers_common__[\"ascendingComparator\"])(\"total\", _keyType));\n break;\n case __WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"comparators\"].TOTAL_DESCENDING:\n allKeyTotals.sort(Object(__WEBPACK_IMPORTED_MODULE_2__helpers_common__[\"descendingComparator\"])(\"total\", _keyType));\n break;\n case __WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"comparators\"].ALPHA_ASCENDING:\n allKeyTotals.sort(Object(__WEBPACK_IMPORTED_MODULE_2__helpers_common__[\"ascendingComparator\"])(\"key\", _keyType));\n break;\n case __WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"comparators\"].ALPHA_DESCENDING:\n allKeyTotals.sort(Object(__WEBPACK_IMPORTED_MODULE_2__helpers_common__[\"descendingComparator\"])(\"key\", _keyType));\n break;\n case __WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"comparators\"].COUNTVAL_ASCENDING:\n allKeyTotals.sort(Object(__WEBPACK_IMPORTED_MODULE_2__helpers_common__[\"ascendingComparator\"])(\"countval\", _keyType));\n break;\n case __WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"comparators\"].COUNTVAL_DESCENDING:\n allKeyTotals.sort(Object(__WEBPACK_IMPORTED_MODULE_2__helpers_common__[\"descendingComparator\"])(\"countval\", _keyType));\n break;\n default:\n break;\n }\n\n return { dataBySeries: dataBySeries, dataByKey: dataByKey, stack: stack, stackData: stackData, flatDataSorted: flatDataSorted, groupKeys: groupKeys, allKeyTotals: allKeyTotals };\n}\n\nfunction getNearestDataPoint(_mouseX, _dataObject, _scales, _keyType) {\n var keyFromInvertedX = Object(__WEBPACK_IMPORTED_MODULE_2__helpers_common__[\"invertScale\"])(_scales.xScale, _mouseX, _keyType);\n\n if (_keyType === \"string\") {\n // if we are keying on strings, simply find the value via a key match\n return _dataObject.dataByKey.find(function (d) {\n return d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].KEY] === keyFromInvertedX;\n });\n }\n\n var bisectLeft = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"bisector\"](getKey).left;\n var dataEntryIndex = bisectLeft(_dataObject.dataByKey, keyFromInvertedX);\n var dataEntryForXPosition = _dataObject.dataByKey[dataEntryIndex];\n var dataEntryForXPositionPrev = _dataObject.dataByKey[Math.max(dataEntryIndex - 1, 0)];\n\n var nearestDataPoint = null;\n if (keyFromInvertedX && dataEntryForXPosition && dataEntryForXPositionPrev) {\n if (keyFromInvertedX - dataEntryForXPositionPrev[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].KEY] < dataEntryForXPosition[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].KEY] - keyFromInvertedX) {\n nearestDataPoint = dataEntryForXPositionPrev;\n } else {\n nearestDataPoint = dataEntryForXPosition;\n }\n }\n return nearestDataPoint;\n}\n\nfunction convertToDate(_date) {\n // hacks to handle invalid date like \"0014-06-08T00:00:00.000Z\"\n return new Date(new Date(_date).toISOString());\n}\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/charts/data-manager.js\n// module id = 8\n// module chunks = 0\n\n//# sourceURL=webpack:///./src/charts/data-manager.js?"); +eval("/* harmony export (immutable) */ __webpack_exports__[\"a\"] = Scale;\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__ = __webpack_require__(0);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__helpers_constants__ = __webpack_require__(2);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__helpers_common__ = __webpack_require__(1);\n\n\n\n\n\nfunction Scale() {\n\n var config = {\n keyType: null,\n chartType: null,\n colorSchema: null,\n defaultColor: null,\n xDomain: \"auto\",\n yDomain: \"auto\",\n y2Domain: \"auto\",\n\n chartWidth: null,\n chartHeight: null,\n markPanelWidth: null,\n markWidth: null\n };\n\n var data = {\n dataByKey: null,\n dataBySeries: null,\n flatDataSorted: null,\n groupKeys: null,\n allKeyTotals: null\n };\n\n var getID = function getID(d) {\n return d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].ID];\n };\n var getKey = function getKey(d) {\n return d.key;\n };\n var getValue = function getValue(d) {\n return d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].VALUE];\n };\n\n function buildXScale(_allKeys) {\n var xScale = null;\n var domain = null;\n\n if (config.keyType === \"time\") {\n xScale = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"scaleUtc\"]();\n } else if (config.keyType === \"number\") {\n xScale = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"scaleLinear\"]();\n } else {\n xScale = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"scalePoint\"]();\n xScale.padding(0);\n }\n\n if (config.xDomain === \"auto\") {\n if (config.keyType === \"string\") {\n domain = _allKeys;\n } else if (config.keyType === \"number\") {\n domain = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"extent\"](_allKeys.map(function (d) {\n return Number(d);\n }));\n } else {\n domain = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"extent\"](_allKeys);\n }\n } else {\n domain = config.xDomain;\n }\n\n var needsXOuterPadding = config.chartType === \"bar\" || config.chartType === \"stackedBar\" || Array.isArray(config.chartType) && config.chartType.filter(function (d) {\n return d === \"bar\";\n }).length;\n\n var markWidthOffset = needsXOuterPadding ? config.markWidth / 2 : 0;\n xScale.domain(domain).range([markWidthOffset, config.markPanelWidth - markWidthOffset]);\n\n return xScale;\n }\n\n function buildYScale(_extent) {\n var yScale = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"scaleLinear\"]().domain(_extent).rangeRound([config.chartHeight, 0]);\n\n return yScale;\n }\n\n function buildColorScale() {\n var ids = data.dataBySeries.map(getID);\n var colorScale = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"scaleOrdinal\"]().range(config.colorSchema.map(function (d) {\n return d.value;\n })).domain(config.colorSchema.map(function (d, i) {\n return typeof d.id === \"undefined\" ? ids[i] : d.id;\n })).unknown(config.defaultColor);\n\n return colorScale;\n }\n\n function buildStyleScale() {\n var ids = data.dataBySeries.map(getID);\n var styleScale = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"scaleOrdinal\"]().range(config.colorSchema.map(function (d) {\n return d.style;\n })).domain(config.colorSchema.map(function (d, i) {\n return d.id || ids[i];\n })).unknown(\"solid\");\n\n return styleScale;\n }\n\n function buildMeasureNameLookup() {\n return function (d) {\n if (d === \"x\") {\n return data.dataBySeries[0] && data.dataBySeries[0].dimensionName;\n } else if (d === \"y\") {\n var groupKey = data.groupKeys[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"LEFT_AXIS_GROUP_INDEX\"]][0];\n var groupData = data.dataBySeries.find(function (ds) {\n return ds.id === groupKey;\n });\n return groupData.measureName;\n } else if (d === \"y2\") {\n var _groupKey = data.groupKeys[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"RIGHT_AXIS_GROUP_INDEX\"]][0];\n var _groupData = data.dataBySeries.find(function (ds) {\n return ds.id === _groupKey;\n });\n return _groupData.measureName;\n } else {\n var _groupData2 = data.dataBySeries.find(function (ds) {\n return ds.id === d;\n });\n if (_groupData2) {\n return _groupData2.measureName;\n }\n return data.dataBySeries[d] && data.dataBySeries[d].measureName;\n }\n };\n }\n\n function buildChartTypeScale() {\n var ids = data.dataBySeries.map(getID);\n var chartTypeScale = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"scaleOrdinal\"]().range(config.colorSchema.map(function (d) {\n return d.type;\n })).domain(config.colorSchema.map(function (d, i) {\n return d.id || ids[i];\n })).unknown(\"line\");\n\n return chartTypeScale;\n }\n\n function splitByGroups() {\n var groups = {};\n data.dataBySeries.forEach(function (d) {\n var key = d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].GROUP];\n if (!groups[key]) {\n groups[key] = {\n allValues: [],\n allKeys: []\n };\n }\n groups[key].allValues = groups[key].allValues.concat(d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].VALUES].map(getValue));\n groups[key].allKeys = groups[key].allKeys.concat(d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].VALUES].map(getKey));\n });\n\n return groups;\n }\n\n function getStackedScales() {\n var stack = data.stack(data.stackData);\n var allKeys = data.allKeyTotals.map(getKey);\n\n var xScale = buildXScale(allKeys);\n var colorScale = buildColorScale();\n var styleScale = buildStyleScale();\n var chartTypeScale = buildChartTypeScale();\n var measureNameLookup = buildMeasureNameLookup();\n\n var yDomain = null;\n if (config.yDomain === \"auto\") {\n var valuesExtent = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"extent\"](__WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"merge\"](__WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"merge\"](stack)));\n if (valuesExtent[0] < 0) {\n yDomain = valuesExtent;\n } else {\n // force domain to 0 if domain min is positive\n yDomain = [0, valuesExtent[1]];\n }\n } else {\n yDomain = config.yDomain;\n }\n\n var yDomainSign = Object(__WEBPACK_IMPORTED_MODULE_2__helpers_common__[\"getDomainSign\"])(yDomain);\n\n var yScale = buildYScale(yDomain);\n var y2Scale = null;\n\n return {\n xScale: xScale,\n yScale: yScale,\n y2Scale: y2Scale,\n colorScale: colorScale,\n styleScale: styleScale,\n chartTypeScale: chartTypeScale,\n measureNameLookup: measureNameLookup,\n yDomainSign: yDomainSign\n };\n }\n\n function validateDomain(domain) {\n if (typeof domain[0] === \"undefined\" || typeof domain[1] === \"undefined\") {\n return [0, 0];\n } else {\n return domain;\n }\n }\n\n function getHorizontalScales() {\n var groups = splitByGroups();\n var groupKeys = Object.keys(groups) || [];\n var allKeys = data.allKeyTotals.map(getKey);\n\n var hasLeftAxis = groupKeys.indexOf(__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"LEFT_AXIS_GROUP_INDEX\"]) > -1;\n var hasRightAxis = groupKeys.indexOf(__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"RIGHT_AXIS_GROUP_INDEX\"]) > -1;\n\n var xScale = buildXScale(allKeys);\n\n var colorScale = buildColorScale();\n var styleScale = buildStyleScale();\n var chartTypeScale = buildChartTypeScale();\n var measureNameLookup = buildMeasureNameLookup();\n\n var yDomainSign = \"++\";\n var y2DomainSign = \"++\";\n\n var yScale = null;\n if (hasLeftAxis) {\n var yDomain = null;\n if (config.yDomain === \"auto\") {\n var groupLeftAxis = groups[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"LEFT_AXIS_GROUP_INDEX\"]];\n yDomain = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"extent\"](groupLeftAxis.allValues);\n } else {\n yDomain = config.yDomain;\n }\n\n yDomainSign = Object(__WEBPACK_IMPORTED_MODULE_2__helpers_common__[\"getDomainSign\"])(yDomain);\n yScale = buildYScale(validateDomain(yDomain));\n }\n\n var y2Scale = null;\n if (hasRightAxis) {\n var y2Domain = null;\n if (config.y2Domain === \"auto\") {\n var groupRightAxis = groups[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"RIGHT_AXIS_GROUP_INDEX\"]];\n y2Domain = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"extent\"](groupRightAxis.allValues);\n } else {\n y2Domain = config.y2Domain;\n }\n\n y2DomainSign = Object(__WEBPACK_IMPORTED_MODULE_2__helpers_common__[\"getDomainSign\"])(y2Domain);\n\n y2Scale = buildYScale(y2Domain);\n }\n\n return {\n hasSecondAxis: hasRightAxis,\n yDomainSign: yDomainSign,\n y2DomainSign: y2DomainSign,\n xScale: xScale,\n yScale: yScale,\n y2Scale: y2Scale,\n colorScale: colorScale,\n styleScale: styleScale,\n chartTypeScale: chartTypeScale,\n measureNameLookup: measureNameLookup\n };\n }\n\n function getScales() {\n if (config.chartType === \"stackedBar\" || config.chartType === \"stackedArea\") {\n return getStackedScales();\n } else {\n return getHorizontalScales();\n }\n }\n\n function setConfig(_config) {\n config = Object(__WEBPACK_IMPORTED_MODULE_2__helpers_common__[\"override\"])(config, _config);\n return this;\n }\n\n function setData(_data) {\n data = Object.assign({}, data, _data);\n return this;\n }\n\n return {\n setConfig: setConfig,\n setData: setData,\n getScales: getScales\n };\n}\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/charts/scale.js\n// module id = 8\n// module chunks = 0\n\n//# sourceURL=webpack:///./src/charts/scale.js?"); /***/ }), /* 9 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -eval("/* harmony export (immutable) */ __webpack_exports__[\"a\"] = Scale;\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__ = __webpack_require__(0);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__helpers_constants__ = __webpack_require__(2);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__helpers_common__ = __webpack_require__(1);\n\n\n\n\n\nfunction Scale() {\n\n var config = {\n keyType: null,\n chartType: null,\n colorSchema: null,\n defaultColor: null,\n xDomain: \"auto\",\n yDomain: \"auto\",\n y2Domain: \"auto\",\n\n chartWidth: null,\n chartHeight: null,\n markPanelWidth: null,\n markWidth: null\n };\n\n var data = {\n dataByKey: null,\n dataBySeries: null,\n flatDataSorted: null,\n groupKeys: null,\n allKeyTotals: null\n };\n\n var getID = function getID(d) {\n return d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].ID];\n };\n var getKey = function getKey(d) {\n return d.key;\n };\n var getValue = function getValue(d) {\n return d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].VALUE];\n };\n\n function buildXScale(_allKeys) {\n var xScale = null;\n var domain = null;\n\n if (config.keyType === \"time\") {\n xScale = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"scaleUtc\"]();\n } else if (config.keyType === \"number\") {\n xScale = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"scaleLinear\"]();\n } else {\n xScale = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"scalePoint\"]();\n xScale.padding(0);\n }\n\n if (config.xDomain === \"auto\") {\n if (config.keyType === \"string\") {\n domain = _allKeys;\n } else if (config.keyType === \"number\") {\n domain = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"extent\"](_allKeys.map(function (d) {\n return Number(d);\n }));\n } else {\n domain = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"extent\"](_allKeys);\n }\n } else {\n domain = config.xDomain;\n }\n\n var needsXOuterPadding = config.chartType === \"bar\" || config.chartType === \"stackedBar\" || Array.isArray(config.chartType) && config.chartType.filter(function (d) {\n return d === \"bar\";\n }).length;\n\n var markWidthOffset = needsXOuterPadding ? config.markWidth / 2 : 0;\n xScale.domain(domain).range([markWidthOffset, config.markPanelWidth - markWidthOffset]);\n\n return xScale;\n }\n\n function buildYScale(_extent) {\n var yScale = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"scaleLinear\"]().domain(_extent).rangeRound([config.chartHeight, 0]);\n\n return yScale;\n }\n\n function buildColorScale() {\n var ids = data.dataBySeries.map(getID);\n var colorScale = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"scaleOrdinal\"]().range(config.colorSchema.map(function (d) {\n return d.value;\n })).domain(config.colorSchema.map(function (d, i) {\n return typeof d.id === \"undefined\" ? ids[i] : d.id;\n })).unknown(config.defaultColor);\n\n return colorScale;\n }\n\n function buildStyleScale() {\n var ids = data.dataBySeries.map(getID);\n var styleScale = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"scaleOrdinal\"]().range(config.colorSchema.map(function (d) {\n return d.style;\n })).domain(config.colorSchema.map(function (d, i) {\n return d.id || ids[i];\n })).unknown(\"solid\");\n\n return styleScale;\n }\n\n function buildMeasureNameLookup() {\n return function (d) {\n if (d === \"x\") {\n return data.dataBySeries[0] && data.dataBySeries[0].dimensionName;\n } else if (d === \"y\") {\n var groupKey = data.groupKeys[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"LEFT_AXIS_GROUP_INDEX\"]][0];\n var groupData = data.dataBySeries.find(function (ds) {\n return ds.id === groupKey;\n });\n return groupData.measureName;\n } else if (d === \"y2\") {\n var _groupKey = data.groupKeys[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"RIGHT_AXIS_GROUP_INDEX\"]][0];\n var _groupData = data.dataBySeries.find(function (ds) {\n return ds.id === _groupKey;\n });\n return _groupData.measureName;\n } else {\n var _groupData2 = data.dataBySeries.find(function (ds) {\n return ds.id === d;\n });\n if (_groupData2) {\n return _groupData2.measureName;\n }\n return data.dataBySeries[d] && data.dataBySeries[d].measureName;\n }\n };\n }\n\n function buildChartTypeScale() {\n var ids = data.dataBySeries.map(getID);\n var chartTypeScale = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"scaleOrdinal\"]().range(config.colorSchema.map(function (d) {\n return d.type;\n })).domain(config.colorSchema.map(function (d, i) {\n return d.id || ids[i];\n })).unknown(\"line\");\n\n return chartTypeScale;\n }\n\n function splitByGroups() {\n var groups = {};\n data.dataBySeries.forEach(function (d) {\n var key = d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].GROUP];\n if (!groups[key]) {\n groups[key] = {\n allValues: [],\n allKeys: []\n };\n }\n groups[key].allValues = groups[key].allValues.concat(d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].VALUES].map(getValue));\n groups[key].allKeys = groups[key].allKeys.concat(d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].VALUES].map(getKey));\n });\n\n return groups;\n }\n\n function getStackedScales() {\n var stack = data.stack(data.stackData);\n var allKeys = data.allKeyTotals.map(getKey);\n\n var xScale = buildXScale(allKeys);\n var colorScale = buildColorScale();\n var styleScale = buildStyleScale();\n var chartTypeScale = buildChartTypeScale();\n var measureNameLookup = buildMeasureNameLookup();\n\n var yDomain = null;\n if (config.yDomain === \"auto\") {\n var valuesExtent = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"extent\"](__WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"merge\"](__WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"merge\"](stack)));\n if (valuesExtent[0] < 0) {\n yDomain = valuesExtent;\n } else {\n // force domain to 0 if domain min is positive\n yDomain = [0, valuesExtent[1]];\n }\n } else {\n yDomain = config.yDomain;\n }\n\n var yDomainSign = Object(__WEBPACK_IMPORTED_MODULE_2__helpers_common__[\"getDomainSign\"])(yDomain);\n\n var yScale = buildYScale(yDomain);\n var y2Scale = null;\n\n return {\n xScale: xScale,\n yScale: yScale,\n y2Scale: y2Scale,\n colorScale: colorScale,\n styleScale: styleScale,\n chartTypeScale: chartTypeScale,\n measureNameLookup: measureNameLookup,\n yDomainSign: yDomainSign\n };\n }\n\n function validateDomain(domain) {\n if (typeof domain[0] === \"undefined\" || typeof domain[1] === \"undefined\") {\n return [0, 0];\n } else {\n return domain;\n }\n }\n\n function getHorizontalScales() {\n var groups = splitByGroups();\n var groupKeys = Object.keys(groups) || [];\n var allKeys = data.allKeyTotals.map(getKey);\n\n var hasLeftAxis = groupKeys.indexOf(__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"LEFT_AXIS_GROUP_INDEX\"]) > -1;\n var hasRightAxis = groupKeys.indexOf(__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"RIGHT_AXIS_GROUP_INDEX\"]) > -1;\n\n var xScale = buildXScale(allKeys);\n\n var colorScale = buildColorScale();\n var styleScale = buildStyleScale();\n var chartTypeScale = buildChartTypeScale();\n var measureNameLookup = buildMeasureNameLookup();\n\n var yDomainSign = \"++\";\n var y2DomainSign = \"++\";\n\n var yScale = null;\n if (hasLeftAxis) {\n var yDomain = null;\n if (config.yDomain === \"auto\") {\n var groupLeftAxis = groups[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"LEFT_AXIS_GROUP_INDEX\"]];\n yDomain = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"extent\"](groupLeftAxis.allValues);\n } else {\n yDomain = config.yDomain;\n }\n\n yDomainSign = Object(__WEBPACK_IMPORTED_MODULE_2__helpers_common__[\"getDomainSign\"])(yDomain);\n yScale = buildYScale(validateDomain(yDomain));\n }\n\n var y2Scale = null;\n if (hasRightAxis) {\n var y2Domain = null;\n if (config.y2Domain === \"auto\") {\n var groupRightAxis = groups[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"RIGHT_AXIS_GROUP_INDEX\"]];\n y2Domain = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"extent\"](groupRightAxis.allValues);\n } else {\n y2Domain = config.y2Domain;\n }\n\n y2DomainSign = Object(__WEBPACK_IMPORTED_MODULE_2__helpers_common__[\"getDomainSign\"])(y2Domain);\n\n y2Scale = buildYScale(y2Domain);\n }\n\n return {\n hasSecondAxis: hasRightAxis,\n yDomainSign: yDomainSign,\n y2DomainSign: y2DomainSign,\n xScale: xScale,\n yScale: yScale,\n y2Scale: y2Scale,\n colorScale: colorScale,\n styleScale: styleScale,\n chartTypeScale: chartTypeScale,\n measureNameLookup: measureNameLookup\n };\n }\n\n function getScales() {\n if (config.chartType === \"stackedBar\" || config.chartType === \"stackedArea\") {\n return getStackedScales();\n } else {\n return getHorizontalScales();\n }\n }\n\n function setConfig(_config) {\n config = Object(__WEBPACK_IMPORTED_MODULE_2__helpers_common__[\"override\"])(config, _config);\n return this;\n }\n\n function setData(_data) {\n data = Object.assign({}, data, _data);\n return this;\n }\n\n return {\n setConfig: setConfig,\n setData: setData,\n getScales: getScales\n };\n}\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/charts/scale.js\n// module id = 9\n// module chunks = 0\n\n//# sourceURL=webpack:///./src/charts/scale.js?"); +eval("/* harmony export (immutable) */ __webpack_exports__[\"f\"] = getExtractFormatter;\n/* harmony export (immutable) */ __webpack_exports__[\"a\"] = autoFormat;\n/* harmony export (immutable) */ __webpack_exports__[\"g\"] = multiFormat;\n/* harmony export (immutable) */ __webpack_exports__[\"c\"] = formatOddDateBin;\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"b\", function() { return binTranslation; });\n/* harmony export (immutable) */ __webpack_exports__[\"e\"] = formatTooltipNumber;\n/* harmony export (immutable) */ __webpack_exports__[\"d\"] = formatPercentage;\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__d3_service__ = __webpack_require__(0);\n\n\nvar DAYS = [\"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\", \"Sun\"];\n\nvar MONTHS = [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"];\n\nvar QUARTERS = [\"Q1\", \"Q2\", \"Q3\", \"Q4\"];\n\nvar HOURS = [\"12AM\", \"1AM\", \"2AM\", \"3AM\", \"4AM\", \"5AM\", \"6AM\", \"7AM\", \"8AM\", \"9AM\", \"10AM\", \"11AM\", \"12PM\", \"1PM\", \"2PM\", \"3PM\", \"4PM\", \"5PM\", \"6PM\", \"7PM\", \"8PM\", \"9PM\", \"10PM\", \"11PM\"];\n\nfunction getExtractFormatter(extractType) {\n switch (extractType) {\n case \"isodow\":\n return function (d) {\n return DAYS[d - 1];\n };\n case \"month\":\n return function (d) {\n return MONTHS[d - 1];\n };\n case \"quarter\":\n return function (d) {\n return QUARTERS[d - 1];\n };\n case \"hour\":\n return function (d) {\n return HOURS[d];\n };\n case \"minute\":\n return function (d) {\n return d + 1;\n };\n default:\n return function (d) {\n return d;\n };\n }\n}\n\n// Copied from a more recent version of d3-format\n// Trims insignificant zeros, e.g., replaces 1.2000k with 1.2k.\n// https://github.com/d3/d3-format/blob/4d504d0252d94735bfb9a00c0c6900efb52ab9bc/src/formatTrim.js\nfunction trimSigFigs(s) {\n out: for (var n = s.length, i = 1, i0 = -1, i1; i < n; ++i) {\n switch (s[i]) {\n case \".\":\n i0 = i1 = i;break;\n case \"0\":\n if (i0 === 0) i0 = i;i1 = i;break;\n default:\n if (!+s[i]) break out;if (i0 > 0) i0 = 0;break;\n }\n }\n return i0 > 0 ? s.slice(0, i0) + s.slice(i1 + 1) : s;\n}\n\nfunction autoFormat(extent) {\n var max = extent[1];\n var min = extent[0];\n var formatter = function formatter(d) {\n return d;\n };\n // [FE-10936] investigate whether this `if` block can be replaced with\n // solution on line 86 / using trimSigFigs function\n if (Math.abs(max) < 1000) {\n if (max - min <= 0.02) {\n formatter = __WEBPACK_IMPORTED_MODULE_0__d3_service__[\"format\"](\".4f\");\n } else if (max - min <= 0.2) {\n formatter = __WEBPACK_IMPORTED_MODULE_0__d3_service__[\"format\"](\".3f\");\n } else if (max - min <= 1.1) {\n formatter = __WEBPACK_IMPORTED_MODULE_0__d3_service__[\"format\"](\".2f\");\n } else if (max - min < 100) {\n formatter = __WEBPACK_IMPORTED_MODULE_0__d3_service__[\"format\"](\".1f\");\n } else if (max - min < 1000) {\n formatter = __WEBPACK_IMPORTED_MODULE_0__d3_service__[\"format\"](\".0f\");\n }\n } else {\n formatter = function formatter(d) {\n return trimSigFigs(__WEBPACK_IMPORTED_MODULE_0__d3_service__[\"format\"](\"s\")(d));\n };\n }\n return formatter;\n}\n\n// slightly modified version of d3's default time-formatting to always use abbrev month names and in UTC\nvar formatMillisecond = __WEBPACK_IMPORTED_MODULE_0__d3_service__[\"utcFormat\"](\".%L\");\nvar formatSecond = __WEBPACK_IMPORTED_MODULE_0__d3_service__[\"utcFormat\"](\":%S\");\nvar formatMinute = __WEBPACK_IMPORTED_MODULE_0__d3_service__[\"utcFormat\"](\"%I:%M\");\nvar formatHour = __WEBPACK_IMPORTED_MODULE_0__d3_service__[\"utcFormat\"](\"%I %p\");\nvar formatDay = __WEBPACK_IMPORTED_MODULE_0__d3_service__[\"utcFormat\"](\"%a %d\");\nvar formatWeek = __WEBPACK_IMPORTED_MODULE_0__d3_service__[\"utcFormat\"](\"%b %d\");\nvar formatMonth = __WEBPACK_IMPORTED_MODULE_0__d3_service__[\"utcFormat\"](\"%b\");\nvar formatYear = __WEBPACK_IMPORTED_MODULE_0__d3_service__[\"utcFormat\"](\"%Y\");\n\n/**\n * auto formats a date obj to a string using d3-time-format\n * @param {Date} date object to format\n * @returns {string} date string\n*/\nfunction multiFormat(date) {\n /* eslint-disable no-nested-ternary */\n return (__WEBPACK_IMPORTED_MODULE_0__d3_service__[\"utcSecond\"](date) < date ? formatMillisecond : __WEBPACK_IMPORTED_MODULE_0__d3_service__[\"utcMinute\"](date) < date ? formatSecond : __WEBPACK_IMPORTED_MODULE_0__d3_service__[\"utcHour\"](date) < date ? formatMinute : __WEBPACK_IMPORTED_MODULE_0__d3_service__[\"utcDay\"](date) < date ? formatHour : __WEBPACK_IMPORTED_MODULE_0__d3_service__[\"utcMonth\"](date) < date ? __WEBPACK_IMPORTED_MODULE_0__d3_service__[\"utcWeek\"](date) < date ? formatDay : formatWeek : __WEBPACK_IMPORTED_MODULE_0__d3_service__[\"utcYear\"](date) < date ? formatMonth : formatYear)(date);\n /* eslint-enable no-nested-ternary */\n}\n\n/**\n * Format dates when binned by quarter, decade, century\n*/\nfunction formatOddDateBin(specifier, value) {\n switch (specifier) {\n // reproducing the old line chart behavior, even if it's wrong\n case \"1w\":\n return __WEBPACK_IMPORTED_MODULE_0__d3_service__[\"utcFormat\"](\"%b %d\")(value) + \" - \" + __WEBPACK_IMPORTED_MODULE_0__d3_service__[\"utcFormat\"](\"%b %d,\")(__WEBPACK_IMPORTED_MODULE_0__d3_service__[\"utcDay\"].offset(value, 6));\n case \"1c\":\n return __WEBPACK_IMPORTED_MODULE_0__d3_service__[\"utcFormat\"](\"%Y\")(value) + \" - \" + __WEBPACK_IMPORTED_MODULE_0__d3_service__[\"utcFormat\"](\"%Y\")(__WEBPACK_IMPORTED_MODULE_0__d3_service__[\"utcYear\"].offset(value, 99));\n case \"10y\":\n return __WEBPACK_IMPORTED_MODULE_0__d3_service__[\"utcFormat\"](\"%Y\")(value) + \" - \" + __WEBPACK_IMPORTED_MODULE_0__d3_service__[\"utcFormat\"](\"%Y\")(__WEBPACK_IMPORTED_MODULE_0__d3_service__[\"utcYear\"].offset(value, 9));\n case \"1q\":\n var monthNumber = __WEBPACK_IMPORTED_MODULE_0__d3_service__[\"utcFormat\"](\"%m\")(value); // convert to integer month (01 - 12)\n return \"Q\" + Math.floor((parseInt(monthNumber, 10) + 3) / 3) + \" \" + __WEBPACK_IMPORTED_MODULE_0__d3_service__[\"utcFormat\"](\"%Y\")(value);\n default:\n return value;\n }\n}\n\n// translate bin from human readable code to d3 time format specifier\nvar binTranslation = {\n \"1y\": \"%Y\",\n \"1mo\": \"%b %Y\",\n \"1ms\": \"%b %d, %Y %H:%M:%S.%L\",\n \"1s\": \"%b %d, %Y %H:%M:%S\",\n \"1m\": \"%b %d, %Y %H:%M\",\n \"1h\": \"%b %d, %Y %H:%M\",\n \"1d\": \"%b %d, %Y\"\n};\n\nfunction formatTooltipNumber(d) {\n if (d === null) {\n return \"null\";\n }\n // tooltip use en-us locale format\n return d.toLocaleString(\"en-us\");\n}\n\nfunction formatPercentage(format) {\n if (format === \"auto\") {\n return __WEBPACK_IMPORTED_MODULE_0__d3_service__[\"format\"](\".0%\");\n } else {\n return __WEBPACK_IMPORTED_MODULE_0__d3_service__[\"format\"](format);\n }\n}\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/charts/helpers/formatters.js\n// module id = 9\n// module chunks = 0\n\n//# sourceURL=webpack:///./src/charts/helpers/formatters.js?"); /***/ }), /* 10 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -eval("/* harmony export (immutable) */ __webpack_exports__[\"f\"] = getExtractFormatter;\n/* harmony export (immutable) */ __webpack_exports__[\"a\"] = autoFormat;\n/* harmony export (immutable) */ __webpack_exports__[\"g\"] = multiFormat;\n/* harmony export (immutable) */ __webpack_exports__[\"c\"] = formatOddDateBin;\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"b\", function() { return binTranslation; });\n/* harmony export (immutable) */ __webpack_exports__[\"e\"] = formatTooltipNumber;\n/* harmony export (immutable) */ __webpack_exports__[\"d\"] = formatPercentage;\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__d3_service__ = __webpack_require__(0);\n\n\nvar DAYS = [\"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\", \"Sun\"];\n\nvar MONTHS = [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"];\n\nvar QUARTERS = [\"Q1\", \"Q2\", \"Q3\", \"Q4\"];\n\nvar HOURS = [\"12AM\", \"1AM\", \"2AM\", \"3AM\", \"4AM\", \"5AM\", \"6AM\", \"7AM\", \"8AM\", \"9AM\", \"10AM\", \"11AM\", \"12PM\", \"1PM\", \"2PM\", \"3PM\", \"4PM\", \"5PM\", \"6PM\", \"7PM\", \"8PM\", \"9PM\", \"10PM\", \"11PM\"];\n\nfunction getExtractFormatter(extractType) {\n switch (extractType) {\n case \"isodow\":\n return function (d) {\n return DAYS[d - 1];\n };\n case \"month\":\n return function (d) {\n return MONTHS[d - 1];\n };\n case \"quarter\":\n return function (d) {\n return QUARTERS[d - 1];\n };\n case \"hour\":\n return function (d) {\n return HOURS[d];\n };\n case \"minute\":\n return function (d) {\n return d + 1;\n };\n default:\n return function (d) {\n return d;\n };\n }\n}\n\n// Copied from a more recent version of d3-format\n// Trims insignificant zeros, e.g., replaces 1.2000k with 1.2k.\n// https://github.com/d3/d3-format/blob/4d504d0252d94735bfb9a00c0c6900efb52ab9bc/src/formatTrim.js\nfunction trimSigFigs(s) {\n out: for (var n = s.length, i = 1, i0 = -1, i1; i < n; ++i) {\n switch (s[i]) {\n case \".\":\n i0 = i1 = i;break;\n case \"0\":\n if (i0 === 0) i0 = i;i1 = i;break;\n default:\n if (!+s[i]) break out;if (i0 > 0) i0 = 0;break;\n }\n }\n return i0 > 0 ? s.slice(0, i0) + s.slice(i1 + 1) : s;\n}\n\nfunction autoFormat(extent) {\n var max = extent[1];\n var min = extent[0];\n var formatter = function formatter(d) {\n return d;\n };\n if (Math.abs(max) < 1000) {\n if (max - min <= 0.02) {\n formatter = __WEBPACK_IMPORTED_MODULE_0__d3_service__[\"format\"](\".4f\");\n } else if (max - min <= 0.2) {\n formatter = __WEBPACK_IMPORTED_MODULE_0__d3_service__[\"format\"](\".3f\");\n } else if (max - min <= 1.1) {\n formatter = __WEBPACK_IMPORTED_MODULE_0__d3_service__[\"format\"](\".2f\");\n } else if (max - min < 100) {\n formatter = __WEBPACK_IMPORTED_MODULE_0__d3_service__[\"format\"](\".1f\");\n } else if (max - min < 1000) {\n formatter = __WEBPACK_IMPORTED_MODULE_0__d3_service__[\"format\"](\".0f\");\n }\n } else {\n formatter = function formatter(d) {\n return trimSigFigs(__WEBPACK_IMPORTED_MODULE_0__d3_service__[\"format\"](\"s\")(d));\n };\n }\n return formatter;\n}\n\n// slightly modified version of d3's default time-formatting to always use abbrev month names and in UTC\nvar formatMillisecond = __WEBPACK_IMPORTED_MODULE_0__d3_service__[\"utcFormat\"](\".%L\");\nvar formatSecond = __WEBPACK_IMPORTED_MODULE_0__d3_service__[\"utcFormat\"](\":%S\");\nvar formatMinute = __WEBPACK_IMPORTED_MODULE_0__d3_service__[\"utcFormat\"](\"%I:%M\");\nvar formatHour = __WEBPACK_IMPORTED_MODULE_0__d3_service__[\"utcFormat\"](\"%I %p\");\nvar formatDay = __WEBPACK_IMPORTED_MODULE_0__d3_service__[\"utcFormat\"](\"%a %d\");\nvar formatWeek = __WEBPACK_IMPORTED_MODULE_0__d3_service__[\"utcFormat\"](\"%b %d\");\nvar formatMonth = __WEBPACK_IMPORTED_MODULE_0__d3_service__[\"utcFormat\"](\"%b\");\nvar formatYear = __WEBPACK_IMPORTED_MODULE_0__d3_service__[\"utcFormat\"](\"%Y\");\n\n/**\n * auto formats a date obj to a string using d3-time-format\n * @param {Date} date object to format\n * @returns {string} date string\n*/\nfunction multiFormat(date) {\n /* eslint-disable no-nested-ternary */\n return (__WEBPACK_IMPORTED_MODULE_0__d3_service__[\"utcSecond\"](date) < date ? formatMillisecond : __WEBPACK_IMPORTED_MODULE_0__d3_service__[\"utcMinute\"](date) < date ? formatSecond : __WEBPACK_IMPORTED_MODULE_0__d3_service__[\"utcHour\"](date) < date ? formatMinute : __WEBPACK_IMPORTED_MODULE_0__d3_service__[\"utcDay\"](date) < date ? formatHour : __WEBPACK_IMPORTED_MODULE_0__d3_service__[\"utcMonth\"](date) < date ? __WEBPACK_IMPORTED_MODULE_0__d3_service__[\"utcWeek\"](date) < date ? formatDay : formatWeek : __WEBPACK_IMPORTED_MODULE_0__d3_service__[\"utcYear\"](date) < date ? formatMonth : formatYear)(date);\n /* eslint-enable no-nested-ternary */\n}\n\n/**\n * Format dates when binned by quarter, decade, century\n*/\nfunction formatOddDateBin(specifier, value) {\n switch (specifier) {\n // reproducing the old line chart behavior, even if it's wrong\n case \"1w\":\n return __WEBPACK_IMPORTED_MODULE_0__d3_service__[\"utcFormat\"](\"%b %d\")(value) + \" - \" + __WEBPACK_IMPORTED_MODULE_0__d3_service__[\"utcFormat\"](\"%b %d,\")(__WEBPACK_IMPORTED_MODULE_0__d3_service__[\"utcDay\"].offset(value, 6));\n case \"1c\":\n return __WEBPACK_IMPORTED_MODULE_0__d3_service__[\"utcFormat\"](\"%Y\")(value) + \" - \" + __WEBPACK_IMPORTED_MODULE_0__d3_service__[\"utcFormat\"](\"%Y\")(__WEBPACK_IMPORTED_MODULE_0__d3_service__[\"utcYear\"].offset(value, 99));\n case \"10y\":\n return __WEBPACK_IMPORTED_MODULE_0__d3_service__[\"utcFormat\"](\"%Y\")(value) + \" - \" + __WEBPACK_IMPORTED_MODULE_0__d3_service__[\"utcFormat\"](\"%Y\")(__WEBPACK_IMPORTED_MODULE_0__d3_service__[\"utcYear\"].offset(value, 9));\n case \"1q\":\n var monthNumber = __WEBPACK_IMPORTED_MODULE_0__d3_service__[\"utcFormat\"](\"%m\")(value); // convert to integer month (01 - 12)\n return \"Q\" + Math.floor((parseInt(monthNumber, 10) + 3) / 3) + \" \" + __WEBPACK_IMPORTED_MODULE_0__d3_service__[\"utcFormat\"](\"%Y\")(value);\n default:\n return value;\n }\n}\n\n// translate bin from human readable code to d3 time format specifier\nvar binTranslation = {\n \"1y\": \"%Y\",\n \"1mo\": \"%b %Y\",\n \"1ms\": \"%b %d, %Y %H:%M:%S.%L\",\n \"1s\": \"%b %d, %Y %H:%M:%S\",\n \"1m\": \"%b %d, %Y %H:%M\",\n \"1h\": \"%b %d, %Y %H:%M\",\n \"1d\": \"%b %d, %Y\"\n};\n\nfunction formatTooltipNumber(d) {\n if (d === null) {\n return \"null\";\n }\n // tooltip use en-us locale format\n return d.toLocaleString(\"en-us\");\n}\n\nfunction formatPercentage(format) {\n if (format === \"auto\") {\n return __WEBPACK_IMPORTED_MODULE_0__d3_service__[\"format\"](\".0%\");\n } else {\n return __WEBPACK_IMPORTED_MODULE_0__d3_service__[\"format\"](format);\n }\n}\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/charts/helpers/formatters.js\n// module id = 10\n// module chunks = 0\n\n//# sourceURL=webpack:///./src/charts/helpers/formatters.js?"); +eval("/* harmony export (immutable) */ __webpack_exports__[\"a\"] = Legend;\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tooltip__ = __webpack_require__(4);\n\n\nfunction Legend(_container) {\n var IS_LEGEND = true;\n var cache = {\n legendComponent: Object(__WEBPACK_IMPORTED_MODULE_0__tooltip__[\"a\" /* default */])(_container, IS_LEGEND)\n };\n\n function setConfig(_config) {\n cache.legendComponent.setConfig(_config).setConfig({ tooltipIsEnabled: _config.legendIsEnabled }).setTitle(_config.legendTitle).setXPosition(_config.legendXPosition).setYPosition(_config.legendYPosition);\n return this;\n }\n\n function setScales(_scales) {\n cache.legendComponent.setScales(_scales);\n return this;\n }\n\n function setData(_dataObject) {\n var legendContent = _dataObject.dataBySeries.map(function (d) {\n return {\n id: d.id,\n key: d.key,\n label: d.label\n };\n });\n\n cache.legendComponent.setContent(legendContent);\n return this;\n }\n\n return {\n setConfig: setConfig,\n setScales: setScales,\n setData: setData\n };\n}\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/charts/legend.js\n// module id = 10\n// module chunks = 0\n\n//# sourceURL=webpack:///./src/charts/legend.js?"); /***/ }), /* 11 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -eval("/* harmony export (immutable) */ __webpack_exports__[\"a\"] = Legend;\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tooltip__ = __webpack_require__(4);\n\n\nfunction Legend(_container) {\n var IS_LEGEND = true;\n var cache = {\n legendComponent: Object(__WEBPACK_IMPORTED_MODULE_0__tooltip__[\"a\" /* default */])(_container, IS_LEGEND)\n };\n\n function setConfig(_config) {\n cache.legendComponent.setConfig(_config).setConfig({ tooltipIsEnabled: _config.legendIsEnabled }).setTitle(_config.legendTitle).setXPosition(_config.legendXPosition).setYPosition(_config.legendYPosition);\n return this;\n }\n\n function setScales(_scales) {\n cache.legendComponent.setScales(_scales);\n return this;\n }\n\n function setData(_dataObject) {\n var legendContent = _dataObject.dataBySeries.map(function (d) {\n return {\n id: d.id,\n key: d.key,\n label: d.label\n };\n });\n\n cache.legendComponent.setContent(legendContent);\n return this;\n }\n\n return {\n setConfig: setConfig,\n setScales: setScales,\n setData: setData\n };\n}\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/charts/legend.js\n// module id = 11\n// module chunks = 0\n\n//# sourceURL=webpack:///./src/charts/legend.js?"); +eval("/* harmony export (immutable) */ __webpack_exports__[\"a\"] = Brush;\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__ = __webpack_require__(0);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__helpers_constants__ = __webpack_require__(2);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__helpers_common__ = __webpack_require__(1);\nvar _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"]) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); } }; }();\n\n\n\n\n\nfunction Brush(_container) {\n\n var config = {\n margin: {\n top: 60,\n right: 30,\n bottom: 40,\n left: 70\n },\n width: 800,\n height: 500,\n keyType: null,\n brushRangeMin: null,\n brushRangeMax: null,\n brushIsEnabled: true,\n binningResolution: \"1mo\",\n\n zoomRangeMin: null,\n zoomRangeMax: null,\n zoomIsEnabled: true,\n\n markPanelWidth: null,\n chartHeight: null,\n\n fullXDomain: null\n };\n\n var scales = {\n xScale: null\n };\n\n var cache = {\n container: _container,\n dateRange: [null, null],\n brush: null,\n chartBrush: null,\n handle: null\n };\n\n var data = {\n dataBySeries: null\n\n // events\n };var dispatcher = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"dispatch\"](\"brushStart\", \"brushMove\", \"brushEnd\", \"brushClear\", \"zoom\", \"zoomClear\");\n\n function buildSVG() {\n if (!cache.root) {\n cache.root = cache.container.append(\"g\").classed(\"brush-group\", true);\n\n cache.brush = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"brushX\"]().on(\"start\", handleBrushStart).on(\"brush\", handleBrushMove).on(\"end\", handleBrushEnd);\n\n /* okay, this is a little esoteric - in an ideal world, we'd probably have a separate \"Zoom\"\n component that would live alongside our \"Brush\" component here and handle the zooming. the\n problem is that d3.zoom swallows all mousemove events, which prevents us from brushing on the chart.\n (and you'll recall that we need to brush on the chart to set a filter, in addition to zooming in and out).\n So the solution is twofold - first of all, we do the zooming in here, and secondly we attach the zoom\n event to the tag brush container. d3.brush adds on a few elements that directly handle the interaction,\n so we let them absorb the mousemove events for the brushing and bubble up the wheel events to the zoom\n in the container tag.\n */\n cache.zoom = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"zoom\"]().on(\"zoom\", handleZoom);\n\n cache.root.call(cache.zoom);\n }\n }\n\n function buildBrush() {\n cache.brush.extent([[0, 0], [config.markPanelWidth, config.chartHeight]]);\n\n cache.chartBrush = cache.root.call(cache.brush);\n cache.root.call(cache.zoom);\n\n cache.chartBrush.selectAll(\".brush-rect\").attr(\"height\", config.chartHeight);\n\n setBrush();\n }\n\n function handleZoom() {\n\n // this is just an inherently complex (and yet self-contained!) function. Sorry.\n /* eslint complexity: [\"error\", 30] */\n\n // this is a little sloppy - we're always going to attach and consume the zoom events, but\n // this will govern if we actually do anything with them.\n if (!config.zoomIsEnabled) {\n return;\n }\n\n // ensure we ignore mousemoves.\n if (!__WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"event\"].sourceEvent || __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"event\"].sourceEvent && __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"event\"].sourceEvent.type === \"mousemove\") {\n return;\n }\n\n // the zoomScale maps the FULL X Domain (which is the min -> max across all VDF dimensions)\n // to the chart's coordinate range.\n var zoomScale = scales.xScale.copy();\n zoomScale.domain(config.fullXDomain);\n\n // we're gonna allow the user to zoom in/out with a scroll, or pan left/right with shift + scroll\n // This is _stupid_. We only want to pan with the shift key, but apparently some (but not all!)\n // mice will not pass through a shift+scroll event. Until we've got it figured out, we're gonna allow\n // holding down shift OR option to pan.\n var scrollAction = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"event\"].sourceEvent.shiftKey || __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"event\"].sourceEvent.altKey ? \"pan\" : \"zoom\";\n\n // a zoom action will assume that we have a change in y value - meaning we scrolled up\n // or down. If no scroll occurred (such as if the user scrolled left or right), we ignore\n // we step in the opposite direction of our scroll, since that's more standard.\n var unadjustedStep = -__WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"event\"].sourceEvent.deltaY;\n\n if (unadjustedStep === 0) {\n return;\n }\n\n // Look at the CURRENT min/max values of the chart. If we've got a pre-existing zoom min/max,\n // use those. Otherwise, use the min/max of the current chart.\n\n var _zoomScale$range = zoomScale.range(),\n _zoomScale$range2 = _slicedToArray(_zoomScale$range, 2),\n chartMin = _zoomScale$range2[0],\n chartMax = _zoomScale$range2[1];\n\n // because of re-scaling, it's possible that the zoom min/max are now outside the chart's bin extent\n // correct that to use the proper value so zoom doesn't go beyond the actual edges.\n\n\n var zmin = config.zoomRangeMin ? zoomScale(Math.max(config.zoomRangeMin, config.fullXDomain[0])) : chartMin;\n var zmax = config.zoomRangeMax ? zoomScale(Math.min(config.zoomRangeMax, config.fullXDomain[1])) : chartMax;\n\n /* okay, this is pretty epic. The actual pixel coordinates we moved by scrolling needs to be\n adjusted for the scale we're operating at. When we're fully zoomed out, a step on the wheel\n is 3-5px or so. But as we get zoomed in farther, the distance between the low and high bars\n on our zoom brush could be < 3-5px and as a result if we tried to zoom in that far we'd overzoom\n so our min > max and it'd fail and prevent it.\n Instead, we adjust our step value - it should be proportional to the ratio of our current zoomed\n range to the overall chart range. So if we moved the wheel by 2px and our chart range is 0->100,\n that's cool - adjust our step by 2px. If we've already zoomed in to a range of 0->1, then don't\n step by 2px at a time, only step by 0.02px (1 / 100).\n This has two effects -\n * we zoom in at a constant speed. Previously we'd zoom faster as we got closer in.\n * We can zoom into much finer resolutions than we previously could.\n */\n var stepAdjustment = (zmax - zmin) / (chartMax - chartMin);\n var step = unadjustedStep * stepAdjustment;\n\n // we should zoom in from the left and right at different speeds. If the user is positioned far to the edge,\n // they want to keep their zoomed view oriented in the same manner. So we figure out how far along the chart\n // we are and use that percentage to figure out how to distribute the step amount to the left and right sides.\n var xCoord = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"mouse\"](this)[0];\n // BUT...if we're panning left/right, we actually want to move both the left and right edges by the same amount,\n // so we cheat and claim that we're actually halfway.\n var coordPercentage = scrollAction === \"zoom\" ? (xCoord - chartMin) / (chartMax - chartMin) : 0.5;\n\n // This is the _assumed_ new min/max extent range on the chart after the zoom. It needs a few corrections.\n var newZmin = zmin + coordPercentage * step;\n // if it's a zoom action, then we're moving the edges closer/farther apart from each other.\n // but if it's a pan action, then they move in the same direction.\n // so flip how we change the max value based upon the scroll direction.\n var newZmax = zmax + (1 - coordPercentage) * step * (scrollAction === \"zoom\" ? -1 : 1);\n\n // if we're trying to zoom down to nothing so the min > max, then that's undefined. Bow out and do nothing.\n if (newZmin > newZmax) {\n return;\n }\n\n // scale the full domain of all the data to the current coords\n var binBounds = [zoomScale(config.fullXDomain[0]), zoomScale(config.fullXDomain[1])];\n\n // re-map our coordinates from numeric chart points to dates/bins/times/whatever.\n // if we're trying to map outside of the bin range, then force ourselves back into it.\n var coords = [Math.max(newZmin, binBounds[0]), Math.min(newZmax, binBounds[1])];\n\n // if we're attempting to pan...\n if (scrollAction === \"pan\") {\n // and our min coord is at the bin bounds AND was not previously at the bin bounds, then\n // don't move our max coord\n if (coords[0] === binBounds[0] && zmin <= binBounds[0]) {\n coords[1] = zmax;\n }\n\n // and our max coord is at the bin bounds AND was not previously at the bin bounds, then\n // don't move our min coord\n if (coords[1] === binBounds[1] && zmax >= binBounds[1]) {\n coords[0] = zmin;\n }\n }\n\n // there's no need to do -anything- if we haven't actually changed our zoom levels. Bow out.\n if (coords[0] === zmin && coords[1] === zmax) {\n return;\n }\n\n // map our correct coordinates back along the inverted scale.\n coords[0] = zoomScale.invert(coords[0]);\n coords[1] = zoomScale.invert(coords[1]);\n\n /* Yet another correction we need. After all of that, it's possible that we've managed\n to zoom down to a zero width area. That's an error and would prevent the user from\n zooming back out. BUT - the actual pixel coordinates on the chart may be different,\n but end up at the same place when the d3 scale is inverted. So map back to the domain\n and see if the difference is small enough. If it is, then we bow out and refuse to\n zoom in any farther.\n The magic number here is 1/10ms, which seemed like a good threshold.\n */\n if (coords[1] - coords[0] < 0.0001) {\n return;\n }\n\n // and finally, if our new zoom range is the literal min and max values of the entire chart, we've \"zoomed\" to the entire\n // data set, so we should actually just clear the zoom filter.\n if (newZmin <= binBounds[0] && newZmax >= binBounds[1]) {\n dispatcher.call(\"zoomClear\", this, config);\n } else {\n // otherwise, we've zoomed to some other range, so we just dispatch a zoom event.\n dispatcher.call(\"zoom\", this, coords, config);\n }\n }\n\n function clampExtentToDateBin(extent) {\n return extent.map(__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"d3TimeTranslation\"][config.binningResolution]);\n }\n\n function getDataExtentUnderBrush() {\n var selection = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"event\"].selection;\n if (Object(__WEBPACK_IMPORTED_MODULE_2__helpers_common__[\"extentIsValid\"])(selection)) {\n var extent = selection.map(function (d) {\n return Object(__WEBPACK_IMPORTED_MODULE_2__helpers_common__[\"invertScale\"])(scales.xScale, d, config.keyType);\n });\n if (config.keyType === \"time\") {\n var clampedExtent = clampExtentToDateBin(extent);\n // prevent clamping to a span of 0\n if (clampedExtent[0].getTime() !== clampedExtent[1].getTime()) {\n return clampedExtent;\n }\n }\n return extent;\n } else {\n return null;\n }\n }\n\n function setBrush() {\n var extent = [config.brushRangeMin, config.brushRangeMax];\n if (Object(__WEBPACK_IMPORTED_MODULE_2__helpers_common__[\"extentIsValid\"])(extent)) {\n if (config.keyType === \"time\") {\n extent = extent.map(function (d) {\n return new Date(d);\n });\n }\n cache.root.call(cache.brush.move, extent.map(function (d) {\n return scales.xScale(d);\n }));\n } else {\n cache.root.call(cache.brush.move, null);\n }\n return this;\n }\n\n function handleBrushStart() {\n if (!__WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"event\"].sourceEvent || __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"event\"].sourceEvent && __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"event\"].sourceEvent.type === \"brush\") {\n return;\n }\n\n dispatcher.call(\"brushStart\", this, getDataExtentUnderBrush(), config);\n }\n\n function handleBrushMove() {\n if (!__WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"event\"].sourceEvent || __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"event\"].sourceEvent && __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"event\"].sourceEvent.type === \"brush\") {\n return;\n }\n\n var extent = getDataExtentUnderBrush();\n\n if (Object(__WEBPACK_IMPORTED_MODULE_2__helpers_common__[\"extentIsValid\"])(extent)) {\n cache.root.call(__WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"event\"].target.move, extent.map(function (d) {\n return scales.xScale(d);\n }));\n dispatcher.call(\"brushMove\", this, extent, config);\n }\n }\n\n function handleBrushEnd() {\n // Skip programatic setting\n if (!__WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"event\"].sourceEvent || __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"event\"].sourceEvent && __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"event\"].sourceEvent.type === \"brush\") {\n return;\n }\n\n // dispatch empty selection\n if (!__WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"event\"].selection) {\n dispatcher.call(\"brushClear\", this, config);\n return;\n }\n\n dispatcher.call(\"brushEnd\", this, getDataExtentUnderBrush(), config);\n }\n\n function on() {\n dispatcher.on.apply(dispatcher, arguments);\n return this;\n }\n\n function setConfig(_config) {\n config = Object(__WEBPACK_IMPORTED_MODULE_2__helpers_common__[\"override\"])(config, _config);\n return this;\n }\n\n function setScales(_scales) {\n scales = Object(__WEBPACK_IMPORTED_MODULE_2__helpers_common__[\"override\"])(scales, _scales);\n return this;\n }\n\n function setData(_data) {\n data = Object.assign({}, data, _data);\n return this;\n }\n\n function render() {\n if (!config.brushIsEnabled) {\n destroy();\n }\n\n if (config.brushIsEnabled) {\n buildSVG();\n }\n\n if (config.brushIsEnabled && data.dataBySeries) {\n buildBrush();\n }\n\n return this;\n }\n\n function destroy() {\n if (cache.root) {\n cache.root.remove();\n cache.root = null;\n }\n return this;\n }\n\n return {\n on: on,\n setConfig: setConfig,\n setData: setData,\n setScales: setScales,\n render: render,\n destroy: destroy\n };\n}\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/charts/brush.js\n// module id = 11\n// module chunks = 0\n\n//# sourceURL=webpack:///./src/charts/brush.js?"); /***/ }), /* 12 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -eval("/* harmony export (immutable) */ __webpack_exports__[\"a\"] = Brush;\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__ = __webpack_require__(0);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__helpers_constants__ = __webpack_require__(2);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__helpers_common__ = __webpack_require__(1);\nvar _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"]) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); } }; }();\n\n\n\n\n\nfunction Brush(_container) {\n\n var config = {\n margin: {\n top: 60,\n right: 30,\n bottom: 40,\n left: 70\n },\n width: 800,\n height: 500,\n keyType: null,\n brushRangeMin: null,\n brushRangeMax: null,\n brushIsEnabled: true,\n binningResolution: \"1mo\",\n\n zoomRangeMin: null,\n zoomRangeMax: null,\n zoomIsEnabled: true,\n\n markPanelWidth: null,\n chartHeight: null,\n\n fullXDomain: null\n };\n\n var scales = {\n xScale: null\n };\n\n var cache = {\n container: _container,\n dateRange: [null, null],\n brush: null,\n chartBrush: null,\n handle: null\n };\n\n var data = {\n dataBySeries: null\n\n // events\n };var dispatcher = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"dispatch\"](\"brushStart\", \"brushMove\", \"brushEnd\", \"brushClear\", \"zoom\", \"zoomClear\");\n\n function buildSVG() {\n if (!cache.root) {\n cache.root = cache.container.append(\"g\").classed(\"brush-group\", true);\n\n cache.brush = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"brushX\"]().on(\"start\", handleBrushStart).on(\"brush\", handleBrushMove).on(\"end\", handleBrushEnd);\n\n /* okay, this is a little esoteric - in an ideal world, we'd probably have a separate \"Zoom\"\n component that would live alongside our \"Brush\" component here and handle the zooming. the\n problem is that d3.zoom swallows all mousemove events, which prevents us from brushing on the chart.\n (and you'll recall that we need to brush on the chart to set a filter, in addition to zooming in and out).\n So the solution is twofold - first of all, we do the zooming in here, and secondly we attach the zoom\n event to the tag brush container. d3.brush adds on a few elements that directly handle the interaction,\n so we let them absorb the mousemove events for the brushing and bubble up the wheel events to the zoom\n in the container tag.\n */\n cache.zoom = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"zoom\"]().on(\"zoom\", handleZoom);\n\n cache.root.call(cache.zoom);\n }\n }\n\n function buildBrush() {\n cache.brush.extent([[0, 0], [config.markPanelWidth, config.chartHeight]]);\n\n cache.chartBrush = cache.root.call(cache.brush);\n cache.root.call(cache.zoom);\n\n cache.chartBrush.selectAll(\".brush-rect\").attr(\"height\", config.chartHeight);\n\n setBrush();\n }\n\n function handleZoom() {\n\n // this is just an inherently complex (and yet self-contained!) function. Sorry.\n /* eslint complexity: [\"error\", 30] */\n\n // this is a little sloppy - we're always going to attach and consume the zoom events, but\n // this will govern if we actually do anything with them.\n if (!config.zoomIsEnabled) {\n return;\n }\n\n // ensure we ignore mousemoves.\n if (!__WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"event\"].sourceEvent || __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"event\"].sourceEvent && __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"event\"].sourceEvent.type === \"mousemove\") {\n return;\n }\n\n // the zoomScale maps the FULL X Domain (which is the min -> max across all VDF dimensions)\n // to the chart's coordinate range.\n var zoomScale = scales.xScale.copy();\n zoomScale.domain(config.fullXDomain);\n\n // we're gonna allow the user to zoom in/out with a scroll, or pan left/right with shift + scroll\n // This is _stupid_. We only want to pan with the shift key, but apparently some (but not all!)\n // mice will not pass through a shift+scroll event. Until we've got it figured out, we're gonna allow\n // holding down shift OR option to pan.\n var scrollAction = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"event\"].sourceEvent.shiftKey || __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"event\"].sourceEvent.altKey ? \"pan\" : \"zoom\";\n\n // a zoom action will assume that we have a change in y value - meaning we scrolled up\n // or down. If no scroll occurred (such as if the user scrolled left or right), we ignore\n // we step in the opposite direction of our scroll, since that's more standard.\n var unadjustedStep = -__WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"event\"].sourceEvent.deltaY;\n\n if (unadjustedStep === 0) {\n return;\n }\n\n // Look at the CURRENT min/max values of the chart. If we've got a pre-existing zoom min/max,\n // use those. Otherwise, use the min/max of the current chart.\n\n var _zoomScale$range = zoomScale.range(),\n _zoomScale$range2 = _slicedToArray(_zoomScale$range, 2),\n chartMin = _zoomScale$range2[0],\n chartMax = _zoomScale$range2[1];\n\n // because of re-scaling, it's possible that the zoom min/max are now outside the chart's bin extent\n // correct that to use the proper value so zoom doesn't go beyond the actual edges.\n\n\n var zmin = config.zoomRangeMin ? zoomScale(Math.max(config.zoomRangeMin, config.fullXDomain[0])) : chartMin;\n var zmax = config.zoomRangeMax ? zoomScale(Math.min(config.zoomRangeMax, config.fullXDomain[1])) : chartMax;\n\n /* okay, this is pretty epic. The actual pixel coordinates we moved by scrolling needs to be\n adjusted for the scale we're operating at. When we're fully zoomed out, a step on the wheel\n is 3-5px or so. But as we get zoomed in farther, the distance between the low and high bars\n on our zoom brush could be < 3-5px and as a result if we tried to zoom in that far we'd overzoom\n so our min > max and it'd fail and prevent it.\n Instead, we adjust our step value - it should be proportional to the ratio of our current zoomed\n range to the overall chart range. So if we moved the wheel by 2px and our chart range is 0->100,\n that's cool - adjust our step by 2px. If we've already zoomed in to a range of 0->1, then don't\n step by 2px at a time, only step by 0.02px (1 / 100).\n This has two effects -\n * we zoom in at a constant speed. Previously we'd zoom faster as we got closer in.\n * We can zoom into much finer resolutions than we previously could.\n */\n var stepAdjustment = (zmax - zmin) / (chartMax - chartMin);\n var step = unadjustedStep * stepAdjustment;\n\n // we should zoom in from the left and right at different speeds. If the user is positioned far to the edge,\n // they want to keep their zoomed view oriented in the same manner. So we figure out how far along the chart\n // we are and use that percentage to figure out how to distribute the step amount to the left and right sides.\n var xCoord = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"mouse\"](this)[0];\n // BUT...if we're panning left/right, we actually want to move both the left and right edges by the same amount,\n // so we cheat and claim that we're actually halfway.\n var coordPercentage = scrollAction === \"zoom\" ? (xCoord - chartMin) / (chartMax - chartMin) : 0.5;\n\n // This is the _assumed_ new min/max extent range on the chart after the zoom. It needs a few corrections.\n var newZmin = zmin + coordPercentage * step;\n // if it's a zoom action, then we're moving the edges closer/farther apart from each other.\n // but if it's a pan action, then they move in the same direction.\n // so flip how we change the max value based upon the scroll direction.\n var newZmax = zmax + (1 - coordPercentage) * step * (scrollAction === \"zoom\" ? -1 : 1);\n\n // if we're trying to zoom down to nothing so the min > max, then that's undefined. Bow out and do nothing.\n if (newZmin > newZmax) {\n return;\n }\n\n // scale the full domain of all the data to the current coords\n var binBounds = [zoomScale(config.fullXDomain[0]), zoomScale(config.fullXDomain[1])];\n\n // re-map our coordinates from numeric chart points to dates/bins/times/whatever.\n // if we're trying to map outside of the bin range, then force ourselves back into it.\n var coords = [Math.max(newZmin, binBounds[0]), Math.min(newZmax, binBounds[1])];\n\n // if we're attempting to pan...\n if (scrollAction === \"pan\") {\n // and our min coord is at the bin bounds AND was not previously at the bin bounds, then\n // don't move our max coord\n if (coords[0] === binBounds[0] && zmin <= binBounds[0]) {\n coords[1] = zmax;\n }\n\n // and our max coord is at the bin bounds AND was not previously at the bin bounds, then\n // don't move our min coord\n if (coords[1] === binBounds[1] && zmax >= binBounds[1]) {\n coords[0] = zmin;\n }\n }\n\n // there's no need to do -anything- if we haven't actually changed our zoom levels. Bow out.\n if (coords[0] === zmin && coords[1] === zmax) {\n return;\n }\n\n // map our correct coordinates back along the inverted scale.\n coords[0] = zoomScale.invert(coords[0]);\n coords[1] = zoomScale.invert(coords[1]);\n\n /* Yet another correction we need. After all of that, it's possible that we've managed\n to zoom down to a zero width area. That's an error and would prevent the user from\n zooming back out. BUT - the actual pixel coordinates on the chart may be different,\n but end up at the same place when the d3 scale is inverted. So map back to the domain\n and see if the difference is small enough. If it is, then we bow out and refuse to\n zoom in any farther.\n The magic number here is 1/10ms, which seemed like a good threshold.\n */\n if (coords[1] - coords[0] < 0.0001) {\n return;\n }\n\n // and finally, if our new zoom range is the literal min and max values of the entire chart, we've \"zoomed\" to the entire\n // data set, so we should actually just clear the zoom filter.\n if (newZmin <= binBounds[0] && newZmax >= binBounds[1]) {\n dispatcher.call(\"zoomClear\", this, config);\n } else {\n // otherwise, we've zoomed to some other range, so we just dispatch a zoom event.\n dispatcher.call(\"zoom\", this, coords, config);\n }\n }\n\n function clampExtentToDateBin(extent) {\n return extent.map(__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"d3TimeTranslation\"][config.binningResolution]);\n }\n\n function getDataExtentUnderBrush() {\n var selection = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"event\"].selection;\n if (Object(__WEBPACK_IMPORTED_MODULE_2__helpers_common__[\"extentIsValid\"])(selection)) {\n var extent = selection.map(function (d) {\n return Object(__WEBPACK_IMPORTED_MODULE_2__helpers_common__[\"invertScale\"])(scales.xScale, d, config.keyType);\n });\n if (config.keyType === \"time\") {\n var clampedExtent = clampExtentToDateBin(extent);\n // prevent clamping to a span of 0\n if (clampedExtent[0].getTime() !== clampedExtent[1].getTime()) {\n return clampedExtent;\n }\n }\n return extent;\n } else {\n return null;\n }\n }\n\n function setBrush() {\n var extent = [config.brushRangeMin, config.brushRangeMax];\n if (Object(__WEBPACK_IMPORTED_MODULE_2__helpers_common__[\"extentIsValid\"])(extent)) {\n if (config.keyType === \"time\") {\n extent = extent.map(function (d) {\n return new Date(d);\n });\n }\n cache.root.call(cache.brush.move, extent.map(function (d) {\n return scales.xScale(d);\n }));\n } else {\n cache.root.call(cache.brush.move, null);\n }\n return this;\n }\n\n function handleBrushStart() {\n if (!__WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"event\"].sourceEvent || __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"event\"].sourceEvent && __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"event\"].sourceEvent.type === \"brush\") {\n return;\n }\n\n dispatcher.call(\"brushStart\", this, getDataExtentUnderBrush(), config);\n }\n\n function handleBrushMove() {\n if (!__WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"event\"].sourceEvent || __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"event\"].sourceEvent && __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"event\"].sourceEvent.type === \"brush\") {\n return;\n }\n\n var extent = getDataExtentUnderBrush();\n\n if (Object(__WEBPACK_IMPORTED_MODULE_2__helpers_common__[\"extentIsValid\"])(extent)) {\n cache.root.call(__WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"event\"].target.move, extent.map(function (d) {\n return scales.xScale(d);\n }));\n dispatcher.call(\"brushMove\", this, extent, config);\n }\n }\n\n function handleBrushEnd() {\n // Skip programatic setting\n if (!__WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"event\"].sourceEvent || __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"event\"].sourceEvent && __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"event\"].sourceEvent.type === \"brush\") {\n return;\n }\n\n // dispatch empty selection\n if (!__WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"event\"].selection) {\n dispatcher.call(\"brushClear\", this, config);\n return;\n }\n\n dispatcher.call(\"brushEnd\", this, getDataExtentUnderBrush(), config);\n }\n\n function on() {\n dispatcher.on.apply(dispatcher, arguments);\n return this;\n }\n\n function setConfig(_config) {\n config = Object(__WEBPACK_IMPORTED_MODULE_2__helpers_common__[\"override\"])(config, _config);\n return this;\n }\n\n function setScales(_scales) {\n scales = Object(__WEBPACK_IMPORTED_MODULE_2__helpers_common__[\"override\"])(scales, _scales);\n return this;\n }\n\n function setData(_data) {\n data = Object.assign({}, data, _data);\n return this;\n }\n\n function render() {\n if (!config.brushIsEnabled) {\n destroy();\n }\n\n if (config.brushIsEnabled) {\n buildSVG();\n }\n\n if (config.brushIsEnabled && data.dataBySeries) {\n buildBrush();\n }\n\n return this;\n }\n\n function destroy() {\n if (cache.root) {\n cache.root.remove();\n cache.root = null;\n }\n return this;\n }\n\n return {\n on: on,\n setConfig: setConfig,\n setData: setData,\n setScales: setScales,\n render: render,\n destroy: destroy\n };\n}\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/charts/brush.js\n// module id = 12\n// module chunks = 0\n\n//# sourceURL=webpack:///./src/charts/brush.js?"); +eval("/* harmony export (immutable) */ __webpack_exports__[\"a\"] = Hover;\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__ = __webpack_require__(0);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__helpers_constants__ = __webpack_require__(2);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__helpers_common__ = __webpack_require__(1);\n\n\n\n\n\nfunction Hover(_container) {\n\n var config = {\n margin: {\n top: 60,\n right: 30,\n bottom: 40,\n left: 70\n },\n width: 800,\n height: 500,\n hoverDotRadius: null,\n chartType: null,\n\n chartWidth: null,\n chartHeight: null,\n stackOffset: __WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"stackOffset\"].NONE\n };\n\n var scales = {\n yScale: null,\n y2Scale: null,\n hasSecondAxis: null,\n colorScale: null\n };\n\n var cache = {\n container: _container,\n svg: null,\n dateRange: [null, null],\n brush: null,\n chartBrush: null,\n handle: null,\n data: null,\n isEnabled: true\n };\n\n var data = {\n stack: null,\n groupKeys: null\n\n // events\n };var dispatcher = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"dispatch\"](\"hover\");\n\n var getColor = function getColor(d) {\n return scales.colorScale(d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].ID]);\n };\n\n function build() {\n if (!cache.root) {\n cache.root = cache.container.append(\"g\").classed(\"hover-group\", true).style(\"pointer-events\", \"none\");\n }\n }\n\n function drawHover(_dataPoint, _dataPointXPosition) {\n build();\n\n if (!isNaN(_dataPointXPosition)) {\n moveVerticalMarker(_dataPointXPosition);\n drawVerticalMarker();\n if (config.chartType === \"stackedLine\" || config.chartType === \"stackedArea\" || config.chartType === \"stackedBar\") {\n highlightStackedDataPoints(_dataPoint);\n } else {\n highlightDataPoints(_dataPoint);\n }\n dispatcher.call(\"hover\", this, _dataPoint);\n }\n }\n\n function show() {\n if (!cache.root) {\n return null;\n }\n cache.root.style(\"display\", \"block\");\n return this;\n }\n\n function hide() {\n if (!cache.root) {\n return null;\n }\n cache.root.style(\"display\", \"none\");\n return this;\n }\n\n function highlightDataPoints(_dataPoint) {\n var dotsData = _dataPoint[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].SERIES];\n\n drawHighlightDataPoints(dotsData);\n }\n\n function drawHighlightDataPoints(_dotsData) {\n var dots = cache.root.selectAll(\".dot\").data(_dotsData);\n\n var yScale = scales.yScale;\n if (config.stackOffset === __WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"stackOffset\"].PERCENT) {\n var denormalizingYScale = scales.yScale.copy().domain([0, 1]);\n yScale = denormalizingYScale;\n }\n\n dots.enter().append(\"circle\").attr(\"class\", \"dot\").merge(dots).attr(\"cy\", function (d) {\n var value = d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].VALUE];\n if (parseInt(d.group, 10) === parseInt(__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"LEFT_AXIS_GROUP_INDEX\"], 10)) {\n return yScale(value);\n } else {\n return scales.y2Scale ? scales.y2Scale(value) : scales.yScale(value);\n }\n }).attr(\"r\", config.hoverDotRadius).style(\"fill\", getColor).classed(\"hidden\", function (d) {\n return d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].VALUE] === null;\n });\n\n dots.exit().remove();\n }\n\n function highlightStackedDataPoints(_dataPoint) {\n var stackedDataPoint = { key: _dataPoint[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].KEY] };\n _dataPoint.series.forEach(function (d) {\n var id = d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].ID];\n stackedDataPoint[id] = d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].VALUE];\n });\n\n var dotsStack = data.stack([stackedDataPoint]);\n var leftAxisGroup = data.groupKeys[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"LEFT_AXIS_GROUP_INDEX\"]];\n var dotsData = dotsStack.map(function (d) {\n var dot = {};\n dot[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].VALUE] = d[0][0] < 0 ? d[0][0] : d[0][1];\n dot.id = d.key;\n dot.group = leftAxisGroup[0]; // set to 1st left axis group as stacked is always single axis\n return dot;\n });\n\n drawHighlightDataPoints(dotsData);\n }\n\n function drawVerticalMarker() {\n var verticalMarkerLine = cache.root.selectAll(\"line\").data([0]);\n\n verticalMarkerLine.enter().append(\"line\").classed(\"vertical-marker\", true).merge(verticalMarkerLine).attr(\"y1\", 0).attr(\"y2\", config.chartHeight);\n\n verticalMarkerLine.exit().remove();\n }\n\n function moveVerticalMarker(_verticalMarkerXPosition) {\n cache.root.attr(\"transform\", \"translate(\" + [_verticalMarkerXPosition, 0] + \")\");\n }\n\n function bindEvents(_dispatcher) {\n _dispatcher.on(\"mouseOverPanel.hover\", show).on(\"mouseMovePanel.hover\", drawHover).on(\"mouseOutPanel.hover\", hide);\n return this;\n }\n\n function on() {\n dispatcher.on.apply(dispatcher, arguments);\n return this;\n }\n\n function setConfig(_config) {\n config = Object(__WEBPACK_IMPORTED_MODULE_2__helpers_common__[\"override\"])(config, _config);\n return this;\n }\n\n function setScales(_scales) {\n scales = Object(__WEBPACK_IMPORTED_MODULE_2__helpers_common__[\"override\"])(scales, _scales);\n return this;\n }\n\n function setData(_data) {\n data = Object.assign({}, data, _data);\n return this;\n }\n\n function destroy() {\n if (cache.root) {\n cache.root.remove();\n cache.root = null;\n }\n return this;\n }\n\n return {\n setConfig: setConfig,\n setScales: setScales,\n setData: setData,\n bindEvents: bindEvents,\n highlightDataPoints: highlightDataPoints,\n highlightStackedDataPoints: highlightStackedDataPoints,\n drawVerticalMarker: drawVerticalMarker,\n moveVerticalMarker: moveVerticalMarker,\n on: on,\n destroy: destroy\n };\n}\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/charts/hover.js\n// module id = 12\n// module chunks = 0\n\n//# sourceURL=webpack:///./src/charts/hover.js?"); /***/ }), /* 13 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -eval("/* harmony export (immutable) */ __webpack_exports__[\"a\"] = Hover;\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__ = __webpack_require__(0);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__helpers_constants__ = __webpack_require__(2);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__helpers_common__ = __webpack_require__(1);\n\n\n\n\n\nfunction Hover(_container) {\n\n var config = {\n margin: {\n top: 60,\n right: 30,\n bottom: 40,\n left: 70\n },\n width: 800,\n height: 500,\n hoverDotRadius: null,\n chartType: null,\n\n chartWidth: null,\n chartHeight: null,\n stackOffset: __WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"stackOffset\"].NONE\n };\n\n var scales = {\n yScale: null,\n y2Scale: null,\n hasSecondAxis: null,\n colorScale: null\n };\n\n var cache = {\n container: _container,\n svg: null,\n dateRange: [null, null],\n brush: null,\n chartBrush: null,\n handle: null,\n data: null,\n isEnabled: true\n };\n\n var data = {\n stack: null,\n groupKeys: null\n\n // events\n };var dispatcher = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"dispatch\"](\"hover\");\n\n var getColor = function getColor(d) {\n return scales.colorScale(d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].ID]);\n };\n\n function build() {\n if (!cache.root) {\n cache.root = cache.container.append(\"g\").classed(\"hover-group\", true).style(\"pointer-events\", \"none\");\n }\n }\n\n function drawHover(_dataPoint, _dataPointXPosition) {\n build();\n\n if (!isNaN(_dataPointXPosition)) {\n moveVerticalMarker(_dataPointXPosition);\n drawVerticalMarker();\n if (config.chartType === \"stackedLine\" || config.chartType === \"stackedArea\" || config.chartType === \"stackedBar\") {\n highlightStackedDataPoints(_dataPoint);\n } else {\n highlightDataPoints(_dataPoint);\n }\n dispatcher.call(\"hover\", this, _dataPoint);\n }\n }\n\n function show() {\n if (!cache.root) {\n return null;\n }\n cache.root.style(\"display\", \"block\");\n return this;\n }\n\n function hide() {\n if (!cache.root) {\n return null;\n }\n cache.root.style(\"display\", \"none\");\n return this;\n }\n\n function highlightDataPoints(_dataPoint) {\n var dotsData = _dataPoint[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].SERIES];\n\n drawHighlightDataPoints(dotsData);\n }\n\n function drawHighlightDataPoints(_dotsData) {\n var dots = cache.root.selectAll(\".dot\").data(_dotsData);\n\n var yScale = scales.yScale;\n if (config.stackOffset === __WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"stackOffset\"].PERCENT) {\n var denormalizingYScale = scales.yScale.copy().domain([0, 1]);\n yScale = denormalizingYScale;\n }\n\n dots.enter().append(\"circle\").attr(\"class\", \"dot\").merge(dots).attr(\"cy\", function (d) {\n var value = d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].VALUE];\n if (parseInt(d.group, 10) === parseInt(__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"LEFT_AXIS_GROUP_INDEX\"], 10)) {\n return yScale(value);\n } else {\n return scales.y2Scale ? scales.y2Scale(value) : scales.yScale(value);\n }\n }).attr(\"r\", config.hoverDotRadius).style(\"fill\", getColor).classed(\"hidden\", function (d) {\n return d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].VALUE] === null;\n });\n\n dots.exit().remove();\n }\n\n function highlightStackedDataPoints(_dataPoint) {\n var stackedDataPoint = { key: _dataPoint[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].KEY] };\n _dataPoint.series.forEach(function (d) {\n var id = d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].ID];\n stackedDataPoint[id] = d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].VALUE];\n });\n\n var dotsStack = data.stack([stackedDataPoint]);\n var leftAxisGroup = data.groupKeys[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"LEFT_AXIS_GROUP_INDEX\"]];\n var dotsData = dotsStack.map(function (d) {\n var dot = {};\n dot[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].VALUE] = d[0][0] < 0 ? d[0][0] : d[0][1];\n dot.id = d.key;\n dot.group = leftAxisGroup[0]; // set to 1st left axis group as stacked is always single axis\n return dot;\n });\n\n drawHighlightDataPoints(dotsData);\n }\n\n function drawVerticalMarker() {\n var verticalMarkerLine = cache.root.selectAll(\"line\").data([0]);\n\n verticalMarkerLine.enter().append(\"line\").classed(\"vertical-marker\", true).merge(verticalMarkerLine).attr(\"y1\", 0).attr(\"y2\", config.chartHeight);\n\n verticalMarkerLine.exit().remove();\n }\n\n function moveVerticalMarker(_verticalMarkerXPosition) {\n cache.root.attr(\"transform\", \"translate(\" + [_verticalMarkerXPosition, 0] + \")\");\n }\n\n function bindEvents(_dispatcher) {\n _dispatcher.on(\"mouseOverPanel.hover\", show).on(\"mouseMovePanel.hover\", drawHover).on(\"mouseOutPanel.hover\", hide);\n return this;\n }\n\n function on() {\n dispatcher.on.apply(dispatcher, arguments);\n return this;\n }\n\n function setConfig(_config) {\n config = Object(__WEBPACK_IMPORTED_MODULE_2__helpers_common__[\"override\"])(config, _config);\n return this;\n }\n\n function setScales(_scales) {\n scales = Object(__WEBPACK_IMPORTED_MODULE_2__helpers_common__[\"override\"])(scales, _scales);\n return this;\n }\n\n function setData(_data) {\n data = Object.assign({}, data, _data);\n return this;\n }\n\n function destroy() {\n if (cache.root) {\n cache.root.remove();\n cache.root = null;\n }\n return this;\n }\n\n return {\n setConfig: setConfig,\n setScales: setScales,\n setData: setData,\n bindEvents: bindEvents,\n highlightDataPoints: highlightDataPoints,\n highlightStackedDataPoints: highlightStackedDataPoints,\n drawVerticalMarker: drawVerticalMarker,\n moveVerticalMarker: moveVerticalMarker,\n on: on,\n destroy: destroy\n };\n}\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/charts/hover.js\n// module id = 13\n// module chunks = 0\n\n//# sourceURL=webpack:///./src/charts/hover.js?"); +eval("/* harmony export (immutable) */ __webpack_exports__[\"a\"] = Binning;\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__ = __webpack_require__(0);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__interactors__ = __webpack_require__(3);\n\n\n\n\nfunction Binning(_container) {\n\n var config = {\n margin: {\n top: 60,\n right: 30,\n bottom: 40,\n left: 70\n },\n autoLabel: \"auto\",\n binningToggles: [],\n label: \"BIN:\",\n binningIsAuto: false,\n binningResolution: \"1mo\",\n binningIsEnabled: true\n };\n\n var cache = {\n container: _container,\n root: null,\n autoItem: null,\n binningItems: null,\n isEnabled: true\n\n // events\n };var dispatcher = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"dispatch\"](\"change\");\n\n function build() {\n\n if (!cache.root) {\n cache.root = cache.container.append(\"div\").attr(\"class\", \"binning-group\").style(\"float\", \"left\").style(\"padding-top\", \"12px\").style(\"padding-left\", \"12px\");\n\n cache.label = cache.root.append(\"div\").attr(\"class\", \"bin-label\").text(config.label);\n\n cache.autoItem = cache.root.append(\"div\").attr(\"class\", \"item item-auto toggleOnOff\").on(\"click.select\", function click() {\n var isSelected = this.classList.contains(\"selected\");\n var toggled = !isSelected;\n dispatcher.call(\"change\", this, { name: config.autoLabel, isSelected: toggled });\n }).text(config.autoLabel);\n }\n\n setBinningToggles(config.binningToggles);\n\n var LINE_HEIGHT = 20;\n cache.root.style(\"top\", config.margin.top - LINE_HEIGHT + \"px\").style(\"left\", config.margin.left + \"px\");\n\n changeBinning(config.binningResolution);\n toggleAuto(config.binningIsAuto);\n }\n\n function setBinningToggles(_binningToggles) {\n cache.binningItems = cache.root.selectAll(\".toggleExclusive\").data(_binningToggles);\n\n cache.binningItems.enter().append(\"div\").on(\"click.select\", function click(d) {\n var isSelected = this.classList.contains(\"selected\");\n dispatcher.call(\"change\", this, { name: d, isSelected: isSelected });\n }).merge(cache.binningItems).attr(\"class\", function (d) {\n return \"item item-\" + d + \" toggleExclusive\";\n }).classed(\"selected\", function (d) {\n return config.binningResolution === d;\n }).text(function (d) {\n return d;\n });\n\n cache.binningItems.exit().remove();\n }\n\n function changeBinning(_selectedItemName) {\n if (_selectedItemName) {\n Object(__WEBPACK_IMPORTED_MODULE_1__interactors__[\"exclusiveToggle\"])(cache.binningItems, cache.root.select(\".item-\" + _selectedItemName));\n }\n }\n\n function toggleAuto(_shouldBeSelected) {\n cache.autoItem.classed(\"selected\", _shouldBeSelected).classed(\"dimmed\", !_shouldBeSelected);\n }\n\n function render() {\n if (config.binningIsEnabled) {\n build();\n } else {\n destroy();\n }\n return this;\n }\n\n function on() {\n dispatcher.on.apply(dispatcher, arguments);\n return this;\n }\n\n function setConfig(_config) {\n config = Object.assign({}, config, _config);\n return this;\n }\n\n function destroy() {\n if (cache.root) {\n cache.root.remove();\n cache.root = null;\n }\n return this;\n }\n\n return {\n on: on,\n setConfig: setConfig,\n render: render,\n destroy: destroy\n };\n}\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/charts/binning.js\n// module id = 13\n// module chunks = 0\n\n//# sourceURL=webpack:///./src/charts/binning.js?"); /***/ }), /* 14 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -eval("/* harmony export (immutable) */ __webpack_exports__[\"a\"] = Binning;\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__ = __webpack_require__(0);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__interactors__ = __webpack_require__(3);\n\n\n\n\nfunction Binning(_container) {\n\n var config = {\n margin: {\n top: 60,\n right: 30,\n bottom: 40,\n left: 70\n },\n autoLabel: \"auto\",\n binningToggles: [],\n label: \"BIN:\",\n binningIsAuto: false,\n binningResolution: \"1mo\",\n binningIsEnabled: true\n };\n\n var cache = {\n container: _container,\n root: null,\n autoItem: null,\n binningItems: null,\n isEnabled: true\n\n // events\n };var dispatcher = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"dispatch\"](\"change\");\n\n function build() {\n\n if (!cache.root) {\n cache.root = cache.container.append(\"div\").attr(\"class\", \"binning-group\").style(\"float\", \"left\").style(\"padding-top\", \"12px\").style(\"padding-left\", \"12px\");\n\n cache.label = cache.root.append(\"div\").attr(\"class\", \"bin-label\").text(config.label);\n\n cache.autoItem = cache.root.append(\"div\").attr(\"class\", \"item item-auto toggleOnOff\").on(\"click.select\", function click() {\n var isSelected = this.classList.contains(\"selected\");\n var toggled = !isSelected;\n dispatcher.call(\"change\", this, { name: config.autoLabel, isSelected: toggled });\n }).text(config.autoLabel);\n }\n\n setBinningToggles(config.binningToggles);\n\n var LINE_HEIGHT = 20;\n cache.root.style(\"top\", config.margin.top - LINE_HEIGHT + \"px\").style(\"left\", config.margin.left + \"px\");\n\n changeBinning(config.binningResolution);\n toggleAuto(config.binningIsAuto);\n }\n\n function setBinningToggles(_binningToggles) {\n cache.binningItems = cache.root.selectAll(\".toggleExclusive\").data(_binningToggles);\n\n cache.binningItems.enter().append(\"div\").on(\"click.select\", function click(d) {\n var isSelected = this.classList.contains(\"selected\");\n dispatcher.call(\"change\", this, { name: d, isSelected: isSelected });\n }).merge(cache.binningItems).attr(\"class\", function (d) {\n return \"item item-\" + d + \" toggleExclusive\";\n }).classed(\"selected\", function (d) {\n return config.binningResolution === d;\n }).text(function (d) {\n return d;\n });\n\n cache.binningItems.exit().remove();\n }\n\n function changeBinning(_selectedItemName) {\n if (_selectedItemName) {\n Object(__WEBPACK_IMPORTED_MODULE_1__interactors__[\"exclusiveToggle\"])(cache.binningItems, cache.root.select(\".item-\" + _selectedItemName));\n }\n }\n\n function toggleAuto(_shouldBeSelected) {\n cache.autoItem.classed(\"selected\", _shouldBeSelected).classed(\"dimmed\", !_shouldBeSelected);\n }\n\n function render() {\n if (config.binningIsEnabled) {\n build();\n } else {\n destroy();\n }\n return this;\n }\n\n function on() {\n dispatcher.on.apply(dispatcher, arguments);\n return this;\n }\n\n function setConfig(_config) {\n config = Object.assign({}, config, _config);\n return this;\n }\n\n function destroy() {\n if (cache.root) {\n cache.root.remove();\n cache.root = null;\n }\n return this;\n }\n\n return {\n on: on,\n setConfig: setConfig,\n render: render,\n destroy: destroy\n };\n}\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/charts/binning.js\n// module id = 14\n// module chunks = 0\n\n//# sourceURL=webpack:///./src/charts/binning.js?"); +eval("/* harmony export (immutable) */ __webpack_exports__[\"a\"] = DomainEditor;\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__ = __webpack_require__(0);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__helpers_common__ = __webpack_require__(1);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__interactors__ = __webpack_require__(3);\n\n\n\n\n\nfunction DomainEditor(_container) {\n\n var config = {\n margin: {\n top: 60,\n right: 30,\n bottom: 40,\n left: 70\n },\n width: 800,\n height: 500,\n keyType: null,\n inputDateFormat: \"%m-%d-%Y\",\n numberFormat: \".2f\",\n xDomain: \"auto\",\n yDomain: \"auto\",\n y2Domain: \"auto\",\n xLock: false,\n yLock: false,\n y2Lock: false,\n xDomainEditorIsEnabled: true,\n yDomainEditorIsEnabled: true,\n y2DomainEditorIsEnabled: true,\n\n chartWidth: null,\n chartHeight: null\n };\n\n var cache = {\n container: _container,\n root: null,\n xHitZone: null,\n yHitZone: null,\n y2HitZone: null,\n yMaxInput: null,\n yMinInput: null,\n yLockIcon: null,\n y2MaxInput: null,\n y2MinInput: null,\n y2LockIcon: null,\n xMinInput: null,\n xMaxInput: null,\n xLockIcon: null\n };\n\n var scales = {\n xScale: null,\n yScale: null,\n y2Scale: null,\n hasSecondAxis: null\n\n // events\n };var dispatcher = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"dispatch\"](\"domainChange\", \"domainLockToggle\");\n\n function build() {\n var xDomain = config.xDomain === \"auto\" ? scales.xScale.domain() : config.xDomain;\n var yDomain = config.yDomain === \"auto\" && scales.yScale ? scales.yScale.domain() : config.yDomain;\n var y2Domain = config.y2Domain === \"auto\" && scales.y2Scale ? scales.y2Scale.domain() : config.y2Domain;\n\n var yMinText = null;\n var yMaxText = null;\n var xMinText = null;\n var xMaxText = null;\n var y2MinText = null;\n var y2MaxText = null;\n\n var HOVER_ZONE_SIZE = 40;\n var LOCK_SIZE = 12;\n var INPUT_HEIGHT = 12;\n var PADDING = 4;\n\n var xFormatter = function xFormatter(d) {\n return d;\n };\n if (config.keyType === \"time\") {\n xFormatter = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"utcFormat\"](config.inputDateFormat);\n } else if (config.keyType === \"number\") {\n xFormatter = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"format\"](config.numberFormat);\n }\n\n var yFormatter = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"format\"](config.numberFormat);\n var y2Formatter = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"format\"](config.numberFormat);\n\n if (!cache.root) {\n cache.root = cache.container.append(\"div\").attr(\"class\", \"domain-input-group\");\n\n // hit zones\n cache.xHitZone = cache.root.append(\"div\").attr(\"class\", \"hit-zone x\").style(\"pointer-events\", \"all\").style(\"position\", \"absolute\");\n\n cache.yHitZone = cache.root.append(\"div\").attr(\"class\", \"hit-zone y\").style(\"pointer-events\", \"all\").style(\"position\", \"absolute\");\n\n cache.y2HitZone = cache.root.append(\"div\").attr(\"class\", \"hit-zone y2\").style(\"pointer-events\", \"all\").style(\"position\", \"absolute\");\n\n // y input group\n cache.yMaxInput = cache.yHitZone.append(\"div\").attr(\"class\", \"domain-input y max\").style(\"position\", \"absolute\").attr(\"contentEditable\", true).on(\"focus\", function focus() {\n yMaxText = this.innerText;\n }).on(\"blur\", function change() {\n var input = this.innerText;\n var domain = scales.yScale.domain();\n if (validateType(input, \"number\") && validateRange(input, domain, \"max\")) {\n yMaxText = input;\n dispatcher.call(\"domainChange\", this, { axis: \"y\", extent: [domain[0], Number(input)] });\n } else {\n this.innerText = yMaxText;\n }\n }).call(__WEBPACK_IMPORTED_MODULE_2__interactors__[\"blurOnEnter\"]);\n\n cache.yMinInput = cache.yHitZone.append(\"div\").attr(\"class\", \"domain-input y min\").style(\"position\", \"absolute\").attr(\"contentEditable\", true).on(\"focus\", function focus() {\n yMinText = this.innerText;\n }).on(\"blur\", function change() {\n var input = this.innerText;\n var domain = scales.yScale.domain();\n if (validateType(input, \"number\") && validateRange(input, domain, \"min\")) {\n yMinText = input;\n dispatcher.call(\"domainChange\", this, { axis: \"y\", extent: [Number(input), domain[1]] });\n } else {\n this.innerText = yMinText;\n }\n }).call(__WEBPACK_IMPORTED_MODULE_2__interactors__[\"blurOnEnter\"]);\n\n cache.yLockIcon = cache.yHitZone.append(\"div\").attr(\"class\", \"domain-lock y\").style(\"position\", \"absolute\").on(\"click\", function change() {\n var isLocked = this.classList.contains(\"locked\");\n this.classList.toggle(\"locked\", !isLocked);\n var domain = scales.yScale.domain();\n dispatcher.call(\"domainLockToggle\", this, { isLocked: !isLocked, axis: \"y\", extent: domain });\n });\n\n // y2 input group\n cache.y2MaxInput = cache.y2HitZone.append(\"div\").attr(\"class\", \"domain-input y2 max\").style(\"position\", \"absolute\").attr(\"contentEditable\", true).on(\"focus\", function focus() {\n y2MaxText = this.innerText;\n }).on(\"blur\", function change() {\n var input = this.innerText;\n var domain = scales.y2Scale.domain();\n if (validateType(input, \"number\") && validateRange(input, domain, \"max\")) {\n y2MaxText = input;\n dispatcher.call(\"domainChange\", this, { axis: \"y2\", extent: [domain[0], Number(input)] });\n } else {\n this.innerText = y2MaxText;\n }\n }).call(__WEBPACK_IMPORTED_MODULE_2__interactors__[\"blurOnEnter\"]);\n\n cache.y2MinInput = cache.y2HitZone.append(\"div\").attr(\"class\", \"domain-input y2 min\").style(\"position\", \"absolute\").attr(\"contentEditable\", true).on(\"focus\", function focus() {\n y2MinText = this.innerText;\n }).on(\"blur\", function change() {\n var input = this.innerText;\n var domain = scales.y2Scale.domain();\n if (validateType(input, \"number\") && validateRange(input, domain, \"min\")) {\n y2MinText = input;\n dispatcher.call(\"domainChange\", this, { axis: \"y2\", extent: [Number(input), domain[1]] });\n } else {\n this.innerText = y2MinText;\n }\n }).call(__WEBPACK_IMPORTED_MODULE_2__interactors__[\"blurOnEnter\"]);\n\n cache.y2LockIcon = cache.y2HitZone.append(\"div\").attr(\"class\", \"domain-lock y2\").style(\"position\", \"absolute\").on(\"click\", function change() {\n var isLocked = this.classList.contains(\"locked\");\n this.classList.toggle(\"locked\", !isLocked);\n var domain = scales.y2Scale.domain();\n dispatcher.call(\"domainLockToggle\", this, { isLocked: !isLocked, axis: \"y2\", extent: domain });\n });\n\n // x input group\n cache.xMinInput = cache.xHitZone.append(\"div\").attr(\"class\", \"domain-input x min\").style(\"position\", \"absolute\").attr(\"contentEditable\", true).on(\"focus\", function focus() {\n xMinText = this.innerText;\n }).on(\"blur\", function change() {\n var input = this.innerText;\n var domain = scales.xScale.domain();\n if (validateType(input, config.keyType) && validateRange(input, domain, \"min\", config.keyType)) {\n var min = Object(__WEBPACK_IMPORTED_MODULE_1__helpers_common__[\"stringToType\"])(input, config.keyType);\n xMinText = input;\n dispatcher.call(\"domainChange\", this, { axis: \"x\", extent: [min, domain[1]] });\n } else {\n this.innerText = xMinText;\n }\n }).call(__WEBPACK_IMPORTED_MODULE_2__interactors__[\"blurOnEnter\"]);\n\n cache.xMaxInput = cache.xHitZone.append(\"div\").attr(\"class\", \"domain-input x max\").style(\"position\", \"absolute\").attr(\"contentEditable\", true).on(\"focus\", function focus() {\n xMaxText = this.innerText;\n }).on(\"blur\", function change() {\n var input = this.innerText;\n var domain = scales.xScale.domain();\n if (validateType(input, config.keyType) && validateRange(input, domain, \"max\", config.keyType)) {\n var max = Object(__WEBPACK_IMPORTED_MODULE_1__helpers_common__[\"stringToType\"])(this.innerText, config.keyType);\n xMaxText = input;\n dispatcher.call(\"domainChange\", this, { axis: \"x\", extent: [domain[0], max] });\n } else {\n this.innerText = xMaxText;\n }\n }).call(__WEBPACK_IMPORTED_MODULE_2__interactors__[\"blurOnEnter\"]);\n\n cache.xLockIcon = cache.xHitZone.append(\"div\").attr(\"class\", \"domain-lock x\").style(\"position\", \"absolute\").on(\"click\", function change() {\n var isLocked = this.classList.contains(\"locked\");\n this.classList.toggle(\"locked\", !isLocked);\n var domain = scales.xScale.domain();\n dispatcher.call(\"domainLockToggle\", this, { isLocked: !isLocked, axis: \"x\", extent: domain });\n });\n }\n\n if (config.xDomainEditorIsEnabled) {\n cache.xHitZone.style(\"display\", \"block\");\n cache.xHitZone.style(\"width\", config.chartWidth + LOCK_SIZE + \"px\").style(\"height\", HOVER_ZONE_SIZE + \"px\").style(\"top\", config.margin.top + config.chartHeight + \"px\").style(\"left\", config.margin.left + \"px\").style(\"display\", \"block\");\n\n cache.xMinInput.style(\"top\", PADDING + \"px\").style(\"left\", \"0px\").text(xFormatter(xDomain[0]));\n\n cache.xMaxInput.style(\"top\", PADDING + \"px\").style(\"right\", LOCK_SIZE + \"px\").text(xFormatter(xDomain[1]));\n\n cache.xLockIcon.classed(\"locked\", config.xLock).style(\"width\", LOCK_SIZE + \"px\").style(\"height\", LOCK_SIZE + \"px\").style(\"right\", \"0px\");\n } else {\n cache.xHitZone.style(\"display\", \"none\");\n }\n\n if (config.yDomainEditorIsEnabled) {\n cache.yHitZone.style(\"display\", \"block\");\n cache.yHitZone.style(\"width\", HOVER_ZONE_SIZE + \"px\").style(\"height\", config.chartHeight + LOCK_SIZE + \"px\").style(\"top\", config.margin.top - LOCK_SIZE + \"px\").style(\"left\", config.margin.left - HOVER_ZONE_SIZE + \"px\").style(\"display\", \"block\");\n\n cache.yMaxInput.style(\"top\", LOCK_SIZE + \"px\").style(\"right\", \"0px\").text(yFormatter(yDomain[1]));\n\n cache.yMinInput.style(\"top\", config.chartHeight + LOCK_SIZE - INPUT_HEIGHT + \"px\").style(\"right\", \"0px\").text(yFormatter(yDomain[0]));\n\n cache.yLockIcon.classed(\"locked\", config.yLock).style(\"width\", LOCK_SIZE + \"px\").style(\"height\", LOCK_SIZE + \"px\").style(\"left\", HOVER_ZONE_SIZE - LOCK_SIZE + \"px\").style(\"top\", LOCK_SIZE - LOCK_SIZE + \"px\");\n } else {\n cache.yHitZone.style(\"display\", \"none\");\n }\n\n if (config.y2DomainEditorIsEnabled) {\n cache.y2HitZone.style(\"display\", \"block\");\n cache.y2HitZone.style(\"width\", HOVER_ZONE_SIZE + \"px\").style(\"height\", config.chartHeight + LOCK_SIZE + \"px\").style(\"top\", config.margin.top - LOCK_SIZE + \"px\").style(\"left\", config.margin.left + config.chartWidth + \"px\");\n\n cache.y2MaxInput.style(\"top\", LOCK_SIZE + \"px\").style(\"left\", PADDING + \"px\").text(y2Formatter(y2Domain[1]));\n\n cache.y2MinInput.style(\"top\", config.chartHeight + LOCK_SIZE - INPUT_HEIGHT + \"px\").style(\"left\", PADDING + \"px\").text(y2Formatter(y2Domain[0]));\n\n cache.y2LockIcon.classed(\"locked\", config.y2Lock).style(\"width\", LOCK_SIZE + \"px\").style(\"height\", LOCK_SIZE + \"px\").style(\"top\", LOCK_SIZE - LOCK_SIZE + \"px\");\n } else {\n cache.y2HitZone.style(\"display\", \"none\");\n }\n }\n\n function validateType(_input, _type) {\n if (_type === \"time\") {\n var date = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"utcParse\"](config.inputDateFormat)(_input);\n return Boolean(date);\n } else {\n return !isNaN(_input);\n }\n }\n\n function validateRange(_input, _domain, _minOrMax, _type) {\n // TO DO: range; ordinal\n var input = _input;\n if (_type === \"time\") {\n input = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"utcParse\"](config.inputDateFormat)(_input);\n }\n if (_minOrMax === \"min\") {\n return input <= _domain[1];\n } else {\n return input >= _domain[0];\n }\n }\n\n function on() {\n dispatcher.on.apply(dispatcher, arguments);\n return this;\n }\n\n function setScales(_scales) {\n scales = Object(__WEBPACK_IMPORTED_MODULE_1__helpers_common__[\"override\"])(scales, _scales);\n return this;\n }\n\n function setConfig(_config) {\n config = Object(__WEBPACK_IMPORTED_MODULE_1__helpers_common__[\"override\"])(config, _config);\n return this;\n }\n\n function render() {\n if (config.xDomainEditorIsEnabled || config.yDomainEditorIsEnabled || config.y2DomainEditorIsEnabled) {\n build();\n } else {\n destroy();\n }\n return this;\n }\n\n function destroy() {\n if (cache.root) {\n cache.root.remove();\n cache.root = null;\n }\n return this;\n }\n\n return {\n on: on,\n setScales: setScales,\n setConfig: setConfig,\n render: render,\n destroy: destroy\n };\n}\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/charts/domain-editor.js\n// module id = 14\n// module chunks = 0\n\n//# sourceURL=webpack:///./src/charts/domain-editor.js?"); /***/ }), /* 15 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -eval("/* harmony export (immutable) */ __webpack_exports__[\"a\"] = DomainEditor;\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__ = __webpack_require__(0);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__helpers_common__ = __webpack_require__(1);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__interactors__ = __webpack_require__(3);\n\n\n\n\n\nfunction DomainEditor(_container) {\n\n var config = {\n margin: {\n top: 60,\n right: 30,\n bottom: 40,\n left: 70\n },\n width: 800,\n height: 500,\n keyType: null,\n inputDateFormat: \"%m-%d-%Y\",\n numberFormat: \".2f\",\n xDomain: \"auto\",\n yDomain: \"auto\",\n y2Domain: \"auto\",\n xLock: false,\n yLock: false,\n y2Lock: false,\n xDomainEditorIsEnabled: true,\n yDomainEditorIsEnabled: true,\n y2DomainEditorIsEnabled: true,\n\n chartWidth: null,\n chartHeight: null\n };\n\n var cache = {\n container: _container,\n root: null,\n xHitZone: null,\n yHitZone: null,\n y2HitZone: null,\n yMaxInput: null,\n yMinInput: null,\n yLockIcon: null,\n y2MaxInput: null,\n y2MinInput: null,\n y2LockIcon: null,\n xMinInput: null,\n xMaxInput: null,\n xLockIcon: null\n };\n\n var scales = {\n xScale: null,\n yScale: null,\n y2Scale: null,\n hasSecondAxis: null\n\n // events\n };var dispatcher = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"dispatch\"](\"domainChange\", \"domainLockToggle\");\n\n function build() {\n var xDomain = config.xDomain === \"auto\" ? scales.xScale.domain() : config.xDomain;\n var yDomain = config.yDomain === \"auto\" && scales.yScale ? scales.yScale.domain() : config.yDomain;\n var y2Domain = config.y2Domain === \"auto\" && scales.y2Scale ? scales.y2Scale.domain() : config.y2Domain;\n\n var yMinText = null;\n var yMaxText = null;\n var xMinText = null;\n var xMaxText = null;\n var y2MinText = null;\n var y2MaxText = null;\n\n var HOVER_ZONE_SIZE = 40;\n var LOCK_SIZE = 12;\n var INPUT_HEIGHT = 12;\n var PADDING = 4;\n\n var xFormatter = function xFormatter(d) {\n return d;\n };\n if (config.keyType === \"time\") {\n xFormatter = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"utcFormat\"](config.inputDateFormat);\n } else if (config.keyType === \"number\") {\n xFormatter = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"format\"](config.numberFormat);\n }\n\n var yFormatter = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"format\"](config.numberFormat);\n var y2Formatter = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"format\"](config.numberFormat);\n\n if (!cache.root) {\n cache.root = cache.container.append(\"div\").attr(\"class\", \"domain-input-group\");\n\n // hit zones\n cache.xHitZone = cache.root.append(\"div\").attr(\"class\", \"hit-zone x\").style(\"pointer-events\", \"all\").style(\"position\", \"absolute\");\n\n cache.yHitZone = cache.root.append(\"div\").attr(\"class\", \"hit-zone y\").style(\"pointer-events\", \"all\").style(\"position\", \"absolute\");\n\n cache.y2HitZone = cache.root.append(\"div\").attr(\"class\", \"hit-zone y2\").style(\"pointer-events\", \"all\").style(\"position\", \"absolute\");\n\n // y input group\n cache.yMaxInput = cache.yHitZone.append(\"div\").attr(\"class\", \"domain-input y max\").style(\"position\", \"absolute\").attr(\"contentEditable\", true).on(\"focus\", function focus() {\n yMaxText = this.innerText;\n }).on(\"blur\", function change() {\n var input = this.innerText;\n var domain = scales.yScale.domain();\n if (validateType(input, \"number\") && validateRange(input, domain, \"max\")) {\n yMaxText = input;\n dispatcher.call(\"domainChange\", this, { axis: \"y\", extent: [domain[0], Number(input)] });\n } else {\n this.innerText = yMaxText;\n }\n }).call(__WEBPACK_IMPORTED_MODULE_2__interactors__[\"blurOnEnter\"]);\n\n cache.yMinInput = cache.yHitZone.append(\"div\").attr(\"class\", \"domain-input y min\").style(\"position\", \"absolute\").attr(\"contentEditable\", true).on(\"focus\", function focus() {\n yMinText = this.innerText;\n }).on(\"blur\", function change() {\n var input = this.innerText;\n var domain = scales.yScale.domain();\n if (validateType(input, \"number\") && validateRange(input, domain, \"min\")) {\n yMinText = input;\n dispatcher.call(\"domainChange\", this, { axis: \"y\", extent: [Number(input), domain[1]] });\n } else {\n this.innerText = yMinText;\n }\n }).call(__WEBPACK_IMPORTED_MODULE_2__interactors__[\"blurOnEnter\"]);\n\n cache.yLockIcon = cache.yHitZone.append(\"div\").attr(\"class\", \"domain-lock y\").style(\"position\", \"absolute\").on(\"click\", function change() {\n var isLocked = this.classList.contains(\"locked\");\n this.classList.toggle(\"locked\", !isLocked);\n var domain = scales.yScale.domain();\n dispatcher.call(\"domainLockToggle\", this, { isLocked: !isLocked, axis: \"y\", extent: domain });\n });\n\n // y2 input group\n cache.y2MaxInput = cache.y2HitZone.append(\"div\").attr(\"class\", \"domain-input y2 max\").style(\"position\", \"absolute\").attr(\"contentEditable\", true).on(\"focus\", function focus() {\n y2MaxText = this.innerText;\n }).on(\"blur\", function change() {\n var input = this.innerText;\n var domain = scales.y2Scale.domain();\n if (validateType(input, \"number\") && validateRange(input, domain, \"max\")) {\n y2MaxText = input;\n dispatcher.call(\"domainChange\", this, { axis: \"y2\", extent: [domain[0], Number(input)] });\n } else {\n this.innerText = y2MaxText;\n }\n }).call(__WEBPACK_IMPORTED_MODULE_2__interactors__[\"blurOnEnter\"]);\n\n cache.y2MinInput = cache.y2HitZone.append(\"div\").attr(\"class\", \"domain-input y2 min\").style(\"position\", \"absolute\").attr(\"contentEditable\", true).on(\"focus\", function focus() {\n y2MinText = this.innerText;\n }).on(\"blur\", function change() {\n var input = this.innerText;\n var domain = scales.y2Scale.domain();\n if (validateType(input, \"number\") && validateRange(input, domain, \"min\")) {\n y2MinText = input;\n dispatcher.call(\"domainChange\", this, { axis: \"y2\", extent: [Number(input), domain[1]] });\n } else {\n this.innerText = y2MinText;\n }\n }).call(__WEBPACK_IMPORTED_MODULE_2__interactors__[\"blurOnEnter\"]);\n\n cache.y2LockIcon = cache.y2HitZone.append(\"div\").attr(\"class\", \"domain-lock y2\").style(\"position\", \"absolute\").on(\"click\", function change() {\n var isLocked = this.classList.contains(\"locked\");\n this.classList.toggle(\"locked\", !isLocked);\n var domain = scales.y2Scale.domain();\n dispatcher.call(\"domainLockToggle\", this, { isLocked: !isLocked, axis: \"y2\", extent: domain });\n });\n\n // x input group\n cache.xMinInput = cache.xHitZone.append(\"div\").attr(\"class\", \"domain-input x min\").style(\"position\", \"absolute\").attr(\"contentEditable\", true).on(\"focus\", function focus() {\n xMinText = this.innerText;\n }).on(\"blur\", function change() {\n var input = this.innerText;\n var domain = scales.xScale.domain();\n if (validateType(input, config.keyType) && validateRange(input, domain, \"min\", config.keyType)) {\n var min = Object(__WEBPACK_IMPORTED_MODULE_1__helpers_common__[\"stringToType\"])(input, config.keyType);\n xMinText = input;\n dispatcher.call(\"domainChange\", this, { axis: \"x\", extent: [min, domain[1]] });\n } else {\n this.innerText = xMinText;\n }\n }).call(__WEBPACK_IMPORTED_MODULE_2__interactors__[\"blurOnEnter\"]);\n\n cache.xMaxInput = cache.xHitZone.append(\"div\").attr(\"class\", \"domain-input x max\").style(\"position\", \"absolute\").attr(\"contentEditable\", true).on(\"focus\", function focus() {\n xMaxText = this.innerText;\n }).on(\"blur\", function change() {\n var input = this.innerText;\n var domain = scales.xScale.domain();\n if (validateType(input, config.keyType) && validateRange(input, domain, \"max\", config.keyType)) {\n var max = Object(__WEBPACK_IMPORTED_MODULE_1__helpers_common__[\"stringToType\"])(this.innerText, config.keyType);\n xMaxText = input;\n dispatcher.call(\"domainChange\", this, { axis: \"x\", extent: [domain[0], max] });\n } else {\n this.innerText = xMaxText;\n }\n }).call(__WEBPACK_IMPORTED_MODULE_2__interactors__[\"blurOnEnter\"]);\n\n cache.xLockIcon = cache.xHitZone.append(\"div\").attr(\"class\", \"domain-lock x\").style(\"position\", \"absolute\").on(\"click\", function change() {\n var isLocked = this.classList.contains(\"locked\");\n this.classList.toggle(\"locked\", !isLocked);\n var domain = scales.xScale.domain();\n dispatcher.call(\"domainLockToggle\", this, { isLocked: !isLocked, axis: \"x\", extent: domain });\n });\n }\n\n if (config.xDomainEditorIsEnabled) {\n cache.xHitZone.style(\"display\", \"block\");\n cache.xHitZone.style(\"width\", config.chartWidth + LOCK_SIZE + \"px\").style(\"height\", HOVER_ZONE_SIZE + \"px\").style(\"top\", config.margin.top + config.chartHeight + \"px\").style(\"left\", config.margin.left + \"px\").style(\"display\", \"block\");\n\n cache.xMinInput.style(\"top\", PADDING + \"px\").style(\"left\", \"0px\").text(xFormatter(xDomain[0]));\n\n cache.xMaxInput.style(\"top\", PADDING + \"px\").style(\"right\", LOCK_SIZE + \"px\").text(xFormatter(xDomain[1]));\n\n cache.xLockIcon.classed(\"locked\", config.xLock).style(\"width\", LOCK_SIZE + \"px\").style(\"height\", LOCK_SIZE + \"px\").style(\"right\", \"0px\");\n } else {\n cache.xHitZone.style(\"display\", \"none\");\n }\n\n if (config.yDomainEditorIsEnabled) {\n cache.yHitZone.style(\"display\", \"block\");\n cache.yHitZone.style(\"width\", HOVER_ZONE_SIZE + \"px\").style(\"height\", config.chartHeight + LOCK_SIZE + \"px\").style(\"top\", config.margin.top - LOCK_SIZE + \"px\").style(\"left\", config.margin.left - HOVER_ZONE_SIZE + \"px\").style(\"display\", \"block\");\n\n cache.yMaxInput.style(\"top\", LOCK_SIZE + \"px\").style(\"right\", \"0px\").text(yFormatter(yDomain[1]));\n\n cache.yMinInput.style(\"top\", config.chartHeight + LOCK_SIZE - INPUT_HEIGHT + \"px\").style(\"right\", \"0px\").text(yFormatter(yDomain[0]));\n\n cache.yLockIcon.classed(\"locked\", config.yLock).style(\"width\", LOCK_SIZE + \"px\").style(\"height\", LOCK_SIZE + \"px\").style(\"left\", HOVER_ZONE_SIZE - LOCK_SIZE + \"px\").style(\"top\", LOCK_SIZE - LOCK_SIZE + \"px\");\n } else {\n cache.yHitZone.style(\"display\", \"none\");\n }\n\n if (config.y2DomainEditorIsEnabled) {\n cache.y2HitZone.style(\"display\", \"block\");\n cache.y2HitZone.style(\"width\", HOVER_ZONE_SIZE + \"px\").style(\"height\", config.chartHeight + LOCK_SIZE + \"px\").style(\"top\", config.margin.top - LOCK_SIZE + \"px\").style(\"left\", config.margin.left + config.chartWidth + \"px\");\n\n cache.y2MaxInput.style(\"top\", LOCK_SIZE + \"px\").style(\"left\", PADDING + \"px\").text(y2Formatter(y2Domain[1]));\n\n cache.y2MinInput.style(\"top\", config.chartHeight + LOCK_SIZE - INPUT_HEIGHT + \"px\").style(\"left\", PADDING + \"px\").text(y2Formatter(y2Domain[0]));\n\n cache.y2LockIcon.classed(\"locked\", config.y2Lock).style(\"width\", LOCK_SIZE + \"px\").style(\"height\", LOCK_SIZE + \"px\").style(\"top\", LOCK_SIZE - LOCK_SIZE + \"px\");\n } else {\n cache.y2HitZone.style(\"display\", \"none\");\n }\n }\n\n function validateType(_input, _type) {\n if (_type === \"time\") {\n var date = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"utcParse\"](config.inputDateFormat)(_input);\n return Boolean(date);\n } else {\n return !isNaN(_input);\n }\n }\n\n function validateRange(_input, _domain, _minOrMax, _type) {\n // TO DO: range; ordinal\n var input = _input;\n if (_type === \"time\") {\n input = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"utcParse\"](config.inputDateFormat)(_input);\n }\n if (_minOrMax === \"min\") {\n return input <= _domain[1];\n } else {\n return input >= _domain[0];\n }\n }\n\n function on() {\n dispatcher.on.apply(dispatcher, arguments);\n return this;\n }\n\n function setScales(_scales) {\n scales = Object(__WEBPACK_IMPORTED_MODULE_1__helpers_common__[\"override\"])(scales, _scales);\n return this;\n }\n\n function setConfig(_config) {\n config = Object(__WEBPACK_IMPORTED_MODULE_1__helpers_common__[\"override\"])(config, _config);\n return this;\n }\n\n function render() {\n if (config.xDomainEditorIsEnabled || config.yDomainEditorIsEnabled || config.y2DomainEditorIsEnabled) {\n build();\n } else {\n destroy();\n }\n return this;\n }\n\n function destroy() {\n if (cache.root) {\n cache.root.remove();\n cache.root = null;\n }\n return this;\n }\n\n return {\n on: on,\n setScales: setScales,\n setConfig: setConfig,\n render: render,\n destroy: destroy\n };\n}\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/charts/domain-editor.js\n// module id = 15\n// module chunks = 0\n\n//# sourceURL=webpack:///./src/charts/domain-editor.js?"); +eval("/* harmony export (immutable) */ __webpack_exports__[\"a\"] = BrushRangeEditor;\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__ = __webpack_require__(0);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__helpers_common__ = __webpack_require__(1);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__interactors__ = __webpack_require__(3);\n\n\n\n\n\nfunction BrushRangeEditor(_container) {\n\n var config = {\n keyType: \"time\",\n dateFormat: \"%b %d, %Y\",\n numberFormat: \".2f\",\n brushRangeIsEnabled: true,\n brushRangeMin: null,\n brushRangeMax: null\n };\n\n var cache = {\n container: _container,\n root: null,\n inputMin: null,\n inputMax: null\n };\n\n var scales = {\n xScale: null\n\n // events\n };var dispatcher = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"dispatch\"](\"rangeChange\");\n\n function handleFocus(selection) {\n return function () {\n var text = selection.text();\n var parsed = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"utcParse\"](config.dateFormat)(text);\n if (parsed instanceof Date) {\n text = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"utcFormat\"](\"%m-%d-%Y\")(parsed);\n selection.text(text);\n }\n };\n }\n\n function buildSVG() {\n if (!cache.root) {\n cache.root = cache.container.append(\"div\").attr(\"class\", \"brush-range-input-group\").style(\"top\", 0).style(\"padding-top\", \"12px\");\n\n cache.inputMax = cache.root.append(\"div\").attr(\"class\", \"brush-range-input max\").attr(\"contentEditable\", true);\n\n var handleMaxFocus = handleFocus(cache.inputMax);\n\n cache.inputMax.on(\"focus\", handleMaxFocus).on(\"blur\", function change() {\n var domain = scales.xScale.domain();\n var rangeMin = cache.rangeMin || domain[0];\n var oldValue = cache.rangeMax || domain[1];\n var newValue = Object(__WEBPACK_IMPORTED_MODULE_1__helpers_common__[\"stringToType\"])(cache.inputMax.text(), config.keyType);\n\n if (newValue !== cache.rangeMax) {\n if (newValue > rangeMin) {\n cache.rangeMax = newValue;\n dispatcher.call(\"rangeChange\", this, { extent: [rangeMin, cache.rangeMax] });\n } else {\n var text = oldValue instanceof Date ? __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"utcFormat\"](config.dateFormat)(oldValue) : oldValue;\n cache.inputMax.text(text);\n }\n }\n }).call(__WEBPACK_IMPORTED_MODULE_2__interactors__[\"blurOnEnter\"]).style(\"float\", \"right\");\n\n cache.root.append(\"div\").attr(\"class\", \"separator\").text(\"-\").style(\"float\", \"right\");\n\n cache.inputMin = cache.root.append(\"div\").attr(\"class\", \"brush-range-input min\").attr(\"contentEditable\", true);\n\n var handleMinFocus = handleFocus(cache.inputMin);\n\n cache.inputMin.on(\"focus\", handleMinFocus).on(\"blur\", function change() {\n var domain = scales.xScale.domain();\n var rangeMax = cache.rangeMax || domain[1];\n var oldValue = cache.rangeMin || domain[0];\n var newValue = Object(__WEBPACK_IMPORTED_MODULE_1__helpers_common__[\"stringToType\"])(cache.inputMin.text(), config.keyType);\n\n if (newValue !== cache.rangeMin) {\n if (newValue < rangeMax) {\n cache.rangeMin = newValue;\n dispatcher.call(\"rangeChange\", this, { extent: [cache.rangeMin, rangeMax] });\n } else {\n var text = oldValue instanceof Date ? __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"utcFormat\"](config.dateFormat)(oldValue) : oldValue;\n cache.inputMin.text(text);\n }\n }\n }).call(__WEBPACK_IMPORTED_MODULE_2__interactors__[\"blurOnEnter\"]).style(\"float\", \"right\");\n }\n\n var domain = scales.xScale.domain();\n\n if (Object(__WEBPACK_IMPORTED_MODULE_1__helpers_common__[\"extentIsValid\"])(domain)) {\n var rangeMin = config.brushRangeMin === null ? domain[0] : config.brushRangeMin;\n var rangeMax = config.brushRangeMax === null ? domain[1] : config.brushRangeMax;\n\n if (config.keyType === \"time\") {\n var format = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"utcFormat\"](config.dateFormat);\n cache.rangeMin = new Date(rangeMin);\n cache.rangeMax = new Date(rangeMax);\n rangeMin = format(new Date(rangeMin));\n rangeMax = format(new Date(rangeMax));\n } else {\n var _format = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"format\"](config.numberFormat);\n cache.rangeMin = rangeMin;\n cache.rangeMax = rangeMax;\n rangeMin = _format(rangeMin);\n rangeMax = _format(rangeMax);\n }\n\n cache.inputMin.text(rangeMin);\n cache.inputMax.text(rangeMax);\n } else {\n cache.inputMin.text(\"\");\n cache.inputMax.text(\"\");\n }\n }\n\n function on() {\n dispatcher.on.apply(dispatcher, arguments);\n return this;\n }\n\n function setConfig(_config) {\n config = Object(__WEBPACK_IMPORTED_MODULE_1__helpers_common__[\"override\"])(config, _config);\n return this;\n }\n\n function setScales(_scales) {\n scales = Object(__WEBPACK_IMPORTED_MODULE_1__helpers_common__[\"override\"])(scales, _scales);\n return this;\n }\n\n function render() {\n if (config.brushRangeIsEnabled) {\n buildSVG();\n } else {\n destroy();\n }\n return this;\n }\n\n function destroy() {\n if (cache.root) {\n cache.root.remove();\n cache.root = null;\n }\n return this;\n }\n\n return {\n on: on,\n setConfig: setConfig,\n render: render,\n setScales: setScales\n };\n}\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/charts/brush-range-editor.js\n// module id = 15\n// module chunks = 0\n\n//# sourceURL=webpack:///./src/charts/brush-range-editor.js?"); /***/ }), /* 16 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -eval("/* harmony export (immutable) */ __webpack_exports__[\"a\"] = BrushRangeEditor;\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__ = __webpack_require__(0);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__helpers_common__ = __webpack_require__(1);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__interactors__ = __webpack_require__(3);\n\n\n\n\n\nfunction BrushRangeEditor(_container) {\n\n var config = {\n keyType: \"time\",\n dateFormat: \"%b %d, %Y\",\n numberFormat: \".2f\",\n brushRangeIsEnabled: true,\n brushRangeMin: null,\n brushRangeMax: null\n };\n\n var cache = {\n container: _container,\n root: null,\n inputMin: null,\n inputMax: null\n };\n\n var scales = {\n xScale: null\n\n // events\n };var dispatcher = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"dispatch\"](\"rangeChange\");\n\n function handleFocus(selection) {\n return function () {\n var text = selection.text();\n var parsed = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"utcParse\"](config.dateFormat)(text);\n if (parsed instanceof Date) {\n text = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"utcFormat\"](\"%m-%d-%Y\")(parsed);\n selection.text(text);\n }\n };\n }\n\n function buildSVG() {\n if (!cache.root) {\n cache.root = cache.container.append(\"div\").attr(\"class\", \"brush-range-input-group\").style(\"top\", 0).style(\"padding-top\", \"12px\");\n\n cache.inputMax = cache.root.append(\"div\").attr(\"class\", \"brush-range-input max\").attr(\"contentEditable\", true);\n\n var handleMaxFocus = handleFocus(cache.inputMax);\n\n cache.inputMax.on(\"focus\", handleMaxFocus).on(\"blur\", function change() {\n var domain = scales.xScale.domain();\n var rangeMin = cache.rangeMin || domain[0];\n var oldValue = cache.rangeMax || domain[1];\n var newValue = Object(__WEBPACK_IMPORTED_MODULE_1__helpers_common__[\"stringToType\"])(cache.inputMax.text(), config.keyType);\n\n if (newValue !== cache.rangeMax) {\n if (newValue > rangeMin) {\n cache.rangeMax = newValue;\n dispatcher.call(\"rangeChange\", this, { extent: [rangeMin, cache.rangeMax] });\n } else {\n var text = oldValue instanceof Date ? __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"utcFormat\"](config.dateFormat)(oldValue) : oldValue;\n cache.inputMax.text(text);\n }\n }\n }).call(__WEBPACK_IMPORTED_MODULE_2__interactors__[\"blurOnEnter\"]).style(\"float\", \"right\");\n\n cache.root.append(\"div\").attr(\"class\", \"separator\").text(\"-\").style(\"float\", \"right\");\n\n cache.inputMin = cache.root.append(\"div\").attr(\"class\", \"brush-range-input min\").attr(\"contentEditable\", true);\n\n var handleMinFocus = handleFocus(cache.inputMin);\n\n cache.inputMin.on(\"focus\", handleMinFocus).on(\"blur\", function change() {\n var domain = scales.xScale.domain();\n var rangeMax = cache.rangeMax || domain[1];\n var oldValue = cache.rangeMin || domain[0];\n var newValue = Object(__WEBPACK_IMPORTED_MODULE_1__helpers_common__[\"stringToType\"])(cache.inputMin.text(), config.keyType);\n\n if (newValue !== cache.rangeMin) {\n if (newValue < rangeMax) {\n cache.rangeMin = newValue;\n dispatcher.call(\"rangeChange\", this, { extent: [cache.rangeMin, rangeMax] });\n } else {\n var text = oldValue instanceof Date ? __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"utcFormat\"](config.dateFormat)(oldValue) : oldValue;\n cache.inputMin.text(text);\n }\n }\n }).call(__WEBPACK_IMPORTED_MODULE_2__interactors__[\"blurOnEnter\"]).style(\"float\", \"right\");\n }\n\n var domain = scales.xScale.domain();\n\n if (Object(__WEBPACK_IMPORTED_MODULE_1__helpers_common__[\"extentIsValid\"])(domain)) {\n var rangeMin = config.brushRangeMin === null ? domain[0] : config.brushRangeMin;\n var rangeMax = config.brushRangeMax === null ? domain[1] : config.brushRangeMax;\n\n if (config.keyType === \"time\") {\n var format = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"utcFormat\"](config.dateFormat);\n cache.rangeMin = new Date(rangeMin);\n cache.rangeMax = new Date(rangeMax);\n rangeMin = format(new Date(rangeMin));\n rangeMax = format(new Date(rangeMax));\n } else {\n var _format = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"format\"](config.numberFormat);\n cache.rangeMin = rangeMin;\n cache.rangeMax = rangeMax;\n rangeMin = _format(rangeMin);\n rangeMax = _format(rangeMax);\n }\n\n cache.inputMin.text(rangeMin);\n cache.inputMax.text(rangeMax);\n } else {\n cache.inputMin.text(\"\");\n cache.inputMax.text(\"\");\n }\n }\n\n function on() {\n dispatcher.on.apply(dispatcher, arguments);\n return this;\n }\n\n function setConfig(_config) {\n config = Object(__WEBPACK_IMPORTED_MODULE_1__helpers_common__[\"override\"])(config, _config);\n return this;\n }\n\n function setScales(_scales) {\n scales = Object(__WEBPACK_IMPORTED_MODULE_1__helpers_common__[\"override\"])(scales, _scales);\n return this;\n }\n\n function render() {\n if (config.brushRangeIsEnabled) {\n buildSVG();\n } else {\n destroy();\n }\n return this;\n }\n\n function destroy() {\n if (cache.root) {\n cache.root.remove();\n cache.root = null;\n }\n return this;\n }\n\n return {\n on: on,\n setConfig: setConfig,\n render: render,\n setScales: setScales\n };\n}\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/charts/brush-range-editor.js\n// module id = 16\n// module chunks = 0\n\n//# sourceURL=webpack:///./src/charts/brush-range-editor.js?"); +eval("/* harmony export (immutable) */ __webpack_exports__[\"a\"] = Label;\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__ = __webpack_require__(0);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__helpers_common__ = __webpack_require__(1);\n\n\n\n\nfunction Label(_container) {\n\n var config = {\n margin: {\n top: 60,\n right: 30,\n bottom: 40,\n left: 70\n },\n width: 800,\n height: 500,\n xLabel: \"\",\n yLabel: \"\",\n y2Label: \"\",\n\n chartWidth: null,\n chartHeight: null\n };\n\n var cache = {\n container: _container,\n root: null,\n xAxisLabel: null,\n yAxisLabel: null,\n y2AxisLabel: null\n\n // events\n };var dispatcher = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"dispatch\"](\"axisLabelChange\");\n\n function build() {\n if (!cache.root) {\n cache.root = cache.container.append(\"div\").attr(\"class\", \"label-group\");\n\n cache.xAxisLabel = cache.root.append(\"div\").attr(\"class\", \"axis-label x\").attr(\"contentEditable\", true).on(\"blur\", function blur() {\n dispatcher.call(\"axisLabelChange\", this, { value: this.innerText, type: \"x\" });\n }).on(\"keypress\", function keypress() {\n if (__WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"event\"].key === \"Enter\") {\n this.blur();\n }\n });\n\n cache.yAxisLabel = cache.root.append(\"div\").attr(\"class\", \"axis-label y\").attr(\"contentEditable\", true).on(\"blur\", function blur() {\n dispatcher.call(\"axisLabelChange\", this, { value: this.innerText, type: \"y\" });\n }).on(\"keypress\", function keypress() {\n if (__WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"event\"].key === \"Enter\") {\n this.blur();\n }\n });\n\n cache.y2AxisLabel = cache.root.append(\"div\").attr(\"class\", \"axis-label y2\").attr(\"contentEditable\", true).on(\"blur\", function blur() {\n dispatcher.call(\"axisLabelChange\", this, { value: this.innerText, type: \"y2\" });\n }).on(\"keypress\", function keypress() {\n if (__WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"event\"].key === \"Enter\") {\n this.blur();\n }\n });\n }\n\n cache.xAxisLabel.text(config.xLabel).style(\"max-width\", config.chartWidth + \"px\").style(\"top\", function top() {\n var LABEL_PADDING = 18;\n var textHeight = this.getBoundingClientRect().height || LABEL_PADDING;\n return config.height - textHeight - LABEL_PADDING + \"px\";\n }).style(\"left\", config.margin.left + config.chartWidth / 2 + \"px\");\n\n cache.yAxisLabel.text(config.yLabel).style(\"max-width\", config.chartHeight + \"px\").style(\"top\", config.margin.top + config.chartHeight / 2 + \"px\").style(\"left\", function top() {\n var LABEL_PADDING = 4;\n var textWidth = this.getBoundingClientRect().width;\n return textWidth / 2 + LABEL_PADDING + \"px\";\n });\n\n cache.y2AxisLabel.text(config.y2Label).style(\"max-width\", config.chartHeight + \"px\").style(\"top\", config.margin.top + config.chartHeight / 2 + \"px\").style(\"left\", function top() {\n var LABEL_PADDING = 4;\n var textWidth = this.getBoundingClientRect().width;\n return config.width - textWidth / 2 - LABEL_PADDING + \"px\";\n });\n }\n\n function on() {\n dispatcher.on.apply(dispatcher, arguments);\n return this;\n }\n\n function setConfig(_config) {\n config = Object(__WEBPACK_IMPORTED_MODULE_1__helpers_common__[\"override\"])(config, _config);\n return this;\n }\n\n function render() {\n build();\n return this;\n }\n\n function destroy() {\n if (cache.root) {\n cache.root.remove();\n cache.root = null;\n }\n return this;\n }\n\n return {\n on: on,\n setConfig: setConfig,\n render: render,\n destroy: destroy\n };\n}\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/charts/label.js\n// module id = 16\n// module chunks = 0\n\n//# sourceURL=webpack:///./src/charts/label.js?"); /***/ }), /* 17 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -eval("/* harmony export (immutable) */ __webpack_exports__[\"a\"] = Label;\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__ = __webpack_require__(0);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__helpers_common__ = __webpack_require__(1);\n\n\n\n\nfunction Label(_container) {\n\n var config = {\n margin: {\n top: 60,\n right: 30,\n bottom: 40,\n left: 70\n },\n width: 800,\n height: 500,\n xLabel: \"\",\n yLabel: \"\",\n y2Label: \"\",\n\n chartWidth: null,\n chartHeight: null\n };\n\n var cache = {\n container: _container,\n root: null,\n xAxisLabel: null,\n yAxisLabel: null,\n y2AxisLabel: null\n\n // events\n };var dispatcher = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"dispatch\"](\"axisLabelChange\");\n\n function build() {\n if (!cache.root) {\n cache.root = cache.container.append(\"div\").attr(\"class\", \"label-group\");\n\n cache.xAxisLabel = cache.root.append(\"div\").attr(\"class\", \"axis-label x\").attr(\"contentEditable\", true).on(\"blur\", function blur() {\n dispatcher.call(\"axisLabelChange\", this, { value: this.innerText, type: \"x\" });\n }).on(\"keypress\", function keypress() {\n if (__WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"event\"].key === \"Enter\") {\n this.blur();\n }\n });\n\n cache.yAxisLabel = cache.root.append(\"div\").attr(\"class\", \"axis-label y\").attr(\"contentEditable\", true).on(\"blur\", function blur() {\n dispatcher.call(\"axisLabelChange\", this, { value: this.innerText, type: \"y\" });\n }).on(\"keypress\", function keypress() {\n if (__WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"event\"].key === \"Enter\") {\n this.blur();\n }\n });\n\n cache.y2AxisLabel = cache.root.append(\"div\").attr(\"class\", \"axis-label y2\").attr(\"contentEditable\", true).on(\"blur\", function blur() {\n dispatcher.call(\"axisLabelChange\", this, { value: this.innerText, type: \"y2\" });\n }).on(\"keypress\", function keypress() {\n if (__WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"event\"].key === \"Enter\") {\n this.blur();\n }\n });\n }\n\n cache.xAxisLabel.text(config.xLabel).style(\"max-width\", config.chartWidth + \"px\").style(\"top\", function top() {\n var LABEL_PADDING = 18;\n var textHeight = this.getBoundingClientRect().height || LABEL_PADDING;\n return config.height - textHeight - LABEL_PADDING + \"px\";\n }).style(\"left\", config.margin.left + config.chartWidth / 2 + \"px\");\n\n cache.yAxisLabel.text(config.yLabel).style(\"max-width\", config.chartHeight + \"px\").style(\"top\", config.margin.top + config.chartHeight / 2 + \"px\").style(\"left\", function top() {\n var LABEL_PADDING = 4;\n var textWidth = this.getBoundingClientRect().width;\n return textWidth / 2 + LABEL_PADDING + \"px\";\n });\n\n cache.y2AxisLabel.text(config.y2Label).style(\"max-width\", config.chartHeight + \"px\").style(\"top\", config.margin.top + config.chartHeight / 2 + \"px\").style(\"left\", function top() {\n var LABEL_PADDING = 4;\n var textWidth = this.getBoundingClientRect().width;\n return config.width - textWidth / 2 - LABEL_PADDING + \"px\";\n });\n }\n\n function on() {\n dispatcher.on.apply(dispatcher, arguments);\n return this;\n }\n\n function setConfig(_config) {\n config = Object(__WEBPACK_IMPORTED_MODULE_1__helpers_common__[\"override\"])(config, _config);\n return this;\n }\n\n function render() {\n build();\n return this;\n }\n\n function destroy() {\n if (cache.root) {\n cache.root.remove();\n cache.root = null;\n }\n return this;\n }\n\n return {\n on: on,\n setConfig: setConfig,\n render: render,\n destroy: destroy\n };\n}\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/charts/label.js\n// module id = 17\n// module chunks = 0\n\n//# sourceURL=webpack:///./src/charts/label.js?"); +eval("Object.defineProperty(__webpack_exports__, \"__esModule\", { value: true });\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__charts_helpers_d3_service__ = __webpack_require__(0);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__charts_chart_js__ = __webpack_require__(19);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__charts_tooltip_js__ = __webpack_require__(4);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__charts_legend_js__ = __webpack_require__(10);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__charts_data_manager_js__ = __webpack_require__(7);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__charts_observer_js__ = __webpack_require__(30);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__charts_binning_js__ = __webpack_require__(13);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__charts_domain_editor_js__ = __webpack_require__(14);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__charts_brush_range_editor_js__ = __webpack_require__(15);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__charts_label_js__ = __webpack_require__(16);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__charts_brush_js__ = __webpack_require__(11);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__charts_hover_js__ = __webpack_require__(12);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__charts_interactors_js__ = __webpack_require__(3);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__charts_helpers_colors_js__ = __webpack_require__(5);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_14__charts_helpers_auto_format_js__ = __webpack_require__(31);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_15__charts_helpers_constants__ = __webpack_require__(2);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_16__charts_helpers_common__ = __webpack_require__(1);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_17__charts_scale__ = __webpack_require__(8);\n/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, \"Chart\", function() { return __WEBPACK_IMPORTED_MODULE_1__charts_chart_js__[\"a\"]; });\n/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, \"Tooltip\", function() { return __WEBPACK_IMPORTED_MODULE_2__charts_tooltip_js__[\"a\"]; });\n/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, \"Legend\", function() { return __WEBPACK_IMPORTED_MODULE_3__charts_legend_js__[\"a\"]; });\n/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, \"DataGenerator\", function() { return __WEBPACK_IMPORTED_MODULE_4__charts_data_manager_js__[\"b\"]; });\n/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, \"Observer\", function() { return __WEBPACK_IMPORTED_MODULE_5__charts_observer_js__[\"a\"]; });\n/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, \"Binning\", function() { return __WEBPACK_IMPORTED_MODULE_6__charts_binning_js__[\"a\"]; });\n/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, \"DomainEditor\", function() { return __WEBPACK_IMPORTED_MODULE_7__charts_domain_editor_js__[\"a\"]; });\n/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, \"BrushRangeEditor\", function() { return __WEBPACK_IMPORTED_MODULE_8__charts_brush_range_editor_js__[\"a\"]; });\n/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, \"Label\", function() { return __WEBPACK_IMPORTED_MODULE_9__charts_label_js__[\"a\"]; });\n/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, \"Brush\", function() { return __WEBPACK_IMPORTED_MODULE_10__charts_brush_js__[\"a\"]; });\n/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, \"Hover\", function() { return __WEBPACK_IMPORTED_MODULE_11__charts_hover_js__[\"a\"]; });\n/* harmony reexport (module object) */ __webpack_require__.d(__webpack_exports__, \"Interactors\", function() { return __WEBPACK_IMPORTED_MODULE_12__charts_interactors_js__; });\n/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, \"colors\", function() { return __WEBPACK_IMPORTED_MODULE_13__charts_helpers_colors_js__[\"a\"]; });\n/* harmony reexport (module object) */ __webpack_require__.d(__webpack_exports__, \"d3\", function() { return __WEBPACK_IMPORTED_MODULE_0__charts_helpers_d3_service__; });\n/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, \"autoFormatter\", function() { return __WEBPACK_IMPORTED_MODULE_14__charts_helpers_auto_format_js__[\"a\"]; });\n/* harmony reexport (module object) */ __webpack_require__.d(__webpack_exports__, \"Constants\", function() { return __WEBPACK_IMPORTED_MODULE_15__charts_helpers_constants__; });\n/* harmony reexport (module object) */ __webpack_require__.d(__webpack_exports__, \"_Utils\", function() { return __WEBPACK_IMPORTED_MODULE_16__charts_helpers_common__; });\n/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, \"formatTooltipTitle\", function() { return __WEBPACK_IMPORTED_MODULE_2__charts_tooltip_js__[\"c\"]; });\n/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, \"formatDataPoint\", function() { return __WEBPACK_IMPORTED_MODULE_2__charts_tooltip_js__[\"b\"]; });\n/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, \"Scale\", function() { return __WEBPACK_IMPORTED_MODULE_17__charts_scale__[\"a\"]; });\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n__webpack_require__(32);\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/bundle.js\n// module id = 17\n// module chunks = 0\n\n//# sourceURL=webpack:///./src/bundle.js?"); /***/ }), /* 18 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { +/***/ (function(module, exports, __webpack_require__) { -"use strict"; -eval("Object.defineProperty(__webpack_exports__, \"__esModule\", { value: true });\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__charts_helpers_d3_service__ = __webpack_require__(0);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__charts_chart_js__ = __webpack_require__(20);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__charts_tooltip_js__ = __webpack_require__(4);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__charts_legend_js__ = __webpack_require__(11);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__charts_data_manager_js__ = __webpack_require__(8);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__charts_observer_js__ = __webpack_require__(30);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__charts_binning_js__ = __webpack_require__(14);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__charts_domain_editor_js__ = __webpack_require__(15);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__charts_brush_range_editor_js__ = __webpack_require__(16);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__charts_label_js__ = __webpack_require__(17);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__charts_brush_js__ = __webpack_require__(12);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__charts_hover_js__ = __webpack_require__(13);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__charts_interactors_js__ = __webpack_require__(3);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__charts_helpers_colors_js__ = __webpack_require__(5);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_14__charts_helpers_auto_format_js__ = __webpack_require__(31);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_15__charts_helpers_constants__ = __webpack_require__(2);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_16__charts_helpers_common__ = __webpack_require__(1);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_17__charts_scale__ = __webpack_require__(9);\n/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, \"Chart\", function() { return __WEBPACK_IMPORTED_MODULE_1__charts_chart_js__[\"a\"]; });\n/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, \"Tooltip\", function() { return __WEBPACK_IMPORTED_MODULE_2__charts_tooltip_js__[\"a\"]; });\n/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, \"Legend\", function() { return __WEBPACK_IMPORTED_MODULE_3__charts_legend_js__[\"a\"]; });\n/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, \"DataGenerator\", function() { return __WEBPACK_IMPORTED_MODULE_4__charts_data_manager_js__[\"b\"]; });\n/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, \"Observer\", function() { return __WEBPACK_IMPORTED_MODULE_5__charts_observer_js__[\"a\"]; });\n/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, \"Binning\", function() { return __WEBPACK_IMPORTED_MODULE_6__charts_binning_js__[\"a\"]; });\n/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, \"DomainEditor\", function() { return __WEBPACK_IMPORTED_MODULE_7__charts_domain_editor_js__[\"a\"]; });\n/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, \"BrushRangeEditor\", function() { return __WEBPACK_IMPORTED_MODULE_8__charts_brush_range_editor_js__[\"a\"]; });\n/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, \"Label\", function() { return __WEBPACK_IMPORTED_MODULE_9__charts_label_js__[\"a\"]; });\n/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, \"Brush\", function() { return __WEBPACK_IMPORTED_MODULE_10__charts_brush_js__[\"a\"]; });\n/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, \"Hover\", function() { return __WEBPACK_IMPORTED_MODULE_11__charts_hover_js__[\"a\"]; });\n/* harmony reexport (module object) */ __webpack_require__.d(__webpack_exports__, \"Interactors\", function() { return __WEBPACK_IMPORTED_MODULE_12__charts_interactors_js__; });\n/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, \"colors\", function() { return __WEBPACK_IMPORTED_MODULE_13__charts_helpers_colors_js__[\"a\"]; });\n/* harmony reexport (module object) */ __webpack_require__.d(__webpack_exports__, \"d3\", function() { return __WEBPACK_IMPORTED_MODULE_0__charts_helpers_d3_service__; });\n/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, \"autoFormatter\", function() { return __WEBPACK_IMPORTED_MODULE_14__charts_helpers_auto_format_js__[\"a\"]; });\n/* harmony reexport (module object) */ __webpack_require__.d(__webpack_exports__, \"Constants\", function() { return __WEBPACK_IMPORTED_MODULE_15__charts_helpers_constants__; });\n/* harmony reexport (module object) */ __webpack_require__.d(__webpack_exports__, \"_Utils\", function() { return __WEBPACK_IMPORTED_MODULE_16__charts_helpers_common__; });\n/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, \"formatTooltipTitle\", function() { return __WEBPACK_IMPORTED_MODULE_2__charts_tooltip_js__[\"c\"]; });\n/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, \"formatDataPoint\", function() { return __WEBPACK_IMPORTED_MODULE_2__charts_tooltip_js__[\"b\"]; });\n/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, \"Scale\", function() { return __WEBPACK_IMPORTED_MODULE_17__charts_scale__[\"a\"]; });\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n__webpack_require__(32);\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/bundle.js\n// module id = 18\n// module chunks = 0\n\n//# sourceURL=webpack:///./src/bundle.js?"); +eval("// https://d3js.org Version 4.11.0. Copyright 2017 Mike Bostock.\n(function (global, factory) {\n\t true ? factory(exports) :\n\ttypeof define === 'function' && define.amd ? define(['exports'], factory) :\n\t(factory((global.d3 = global.d3 || {})));\n}(this, (function (exports) { 'use strict';\n\nvar version = \"4.11.0\";\n\nvar ascending = function(a, b) {\n return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;\n};\n\nvar bisector = function(compare) {\n if (compare.length === 1) compare = ascendingComparator(compare);\n return {\n left: function(a, x, lo, hi) {\n if (lo == null) lo = 0;\n if (hi == null) hi = a.length;\n while (lo < hi) {\n var mid = lo + hi >>> 1;\n if (compare(a[mid], x) < 0) lo = mid + 1;\n else hi = mid;\n }\n return lo;\n },\n right: function(a, x, lo, hi) {\n if (lo == null) lo = 0;\n if (hi == null) hi = a.length;\n while (lo < hi) {\n var mid = lo + hi >>> 1;\n if (compare(a[mid], x) > 0) hi = mid;\n else lo = mid + 1;\n }\n return lo;\n }\n };\n};\n\nfunction ascendingComparator(f) {\n return function(d, x) {\n return ascending(f(d), x);\n };\n}\n\nvar ascendingBisect = bisector(ascending);\nvar bisectRight = ascendingBisect.right;\nvar bisectLeft = ascendingBisect.left;\n\nvar pairs = function(array, f) {\n if (f == null) f = pair;\n var i = 0, n = array.length - 1, p = array[0], pairs = new Array(n < 0 ? 0 : n);\n while (i < n) pairs[i] = f(p, p = array[++i]);\n return pairs;\n};\n\nfunction pair(a, b) {\n return [a, b];\n}\n\nvar cross = function(values0, values1, reduce) {\n var n0 = values0.length,\n n1 = values1.length,\n values = new Array(n0 * n1),\n i0,\n i1,\n i,\n value0;\n\n if (reduce == null) reduce = pair;\n\n for (i0 = i = 0; i0 < n0; ++i0) {\n for (value0 = values0[i0], i1 = 0; i1 < n1; ++i1, ++i) {\n values[i] = reduce(value0, values1[i1]);\n }\n }\n\n return values;\n};\n\nvar descending = function(a, b) {\n return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN;\n};\n\nvar number = function(x) {\n return x === null ? NaN : +x;\n};\n\nvar variance = function(values, valueof) {\n var n = values.length,\n m = 0,\n i = -1,\n mean = 0,\n value,\n delta,\n sum = 0;\n\n if (valueof == null) {\n while (++i < n) {\n if (!isNaN(value = number(values[i]))) {\n delta = value - mean;\n mean += delta / ++m;\n sum += delta * (value - mean);\n }\n }\n }\n\n else {\n while (++i < n) {\n if (!isNaN(value = number(valueof(values[i], i, values)))) {\n delta = value - mean;\n mean += delta / ++m;\n sum += delta * (value - mean);\n }\n }\n }\n\n if (m > 1) return sum / (m - 1);\n};\n\nvar deviation = function(array, f) {\n var v = variance(array, f);\n return v ? Math.sqrt(v) : v;\n};\n\nvar extent = function(values, valueof) {\n var n = values.length,\n i = -1,\n value,\n min,\n max;\n\n if (valueof == null) {\n while (++i < n) { // Find the first comparable value.\n if ((value = values[i]) != null && value >= value) {\n min = max = value;\n while (++i < n) { // Compare the remaining values.\n if ((value = values[i]) != null) {\n if (min > value) min = value;\n if (max < value) max = value;\n }\n }\n }\n }\n }\n\n else {\n while (++i < n) { // Find the first comparable value.\n if ((value = valueof(values[i], i, values)) != null && value >= value) {\n min = max = value;\n while (++i < n) { // Compare the remaining values.\n if ((value = valueof(values[i], i, values)) != null) {\n if (min > value) min = value;\n if (max < value) max = value;\n }\n }\n }\n }\n }\n\n return [min, max];\n};\n\nvar array = Array.prototype;\n\nvar slice = array.slice;\nvar map = array.map;\n\nvar constant = function(x) {\n return function() {\n return x;\n };\n};\n\nvar identity = function(x) {\n return x;\n};\n\nvar sequence = function(start, stop, step) {\n start = +start, stop = +stop, step = (n = arguments.length) < 2 ? (stop = start, start = 0, 1) : n < 3 ? 1 : +step;\n\n var i = -1,\n n = Math.max(0, Math.ceil((stop - start) / step)) | 0,\n range = new Array(n);\n\n while (++i < n) {\n range[i] = start + i * step;\n }\n\n return range;\n};\n\nvar e10 = Math.sqrt(50);\nvar e5 = Math.sqrt(10);\nvar e2 = Math.sqrt(2);\n\nvar ticks = function(start, stop, count) {\n var reverse,\n i = -1,\n n,\n ticks,\n step;\n\n stop = +stop, start = +start, count = +count;\n if (start === stop && count > 0) return [start];\n if (reverse = stop < start) n = start, start = stop, stop = n;\n if ((step = tickIncrement(start, stop, count)) === 0 || !isFinite(step)) return [];\n\n if (step > 0) {\n start = Math.ceil(start / step);\n stop = Math.floor(stop / step);\n ticks = new Array(n = Math.ceil(stop - start + 1));\n while (++i < n) ticks[i] = (start + i) * step;\n } else {\n start = Math.floor(start * step);\n stop = Math.ceil(stop * step);\n ticks = new Array(n = Math.ceil(start - stop + 1));\n while (++i < n) ticks[i] = (start - i) / step;\n }\n\n if (reverse) ticks.reverse();\n\n return ticks;\n};\n\nfunction tickIncrement(start, stop, count) {\n var step = (stop - start) / Math.max(0, count),\n power = Math.floor(Math.log(step) / Math.LN10),\n error = step / Math.pow(10, power);\n return power >= 0\n ? (error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1) * Math.pow(10, power)\n : -Math.pow(10, -power) / (error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1);\n}\n\nfunction tickStep(start, stop, count) {\n var step0 = Math.abs(stop - start) / Math.max(0, count),\n step1 = Math.pow(10, Math.floor(Math.log(step0) / Math.LN10)),\n error = step0 / step1;\n if (error >= e10) step1 *= 10;\n else if (error >= e5) step1 *= 5;\n else if (error >= e2) step1 *= 2;\n return stop < start ? -step1 : step1;\n}\n\nvar sturges = function(values) {\n return Math.ceil(Math.log(values.length) / Math.LN2) + 1;\n};\n\nvar histogram = function() {\n var value = identity,\n domain = extent,\n threshold = sturges;\n\n function histogram(data) {\n var i,\n n = data.length,\n x,\n values = new Array(n);\n\n for (i = 0; i < n; ++i) {\n values[i] = value(data[i], i, data);\n }\n\n var xz = domain(values),\n x0 = xz[0],\n x1 = xz[1],\n tz = threshold(values, x0, x1);\n\n // Convert number of thresholds into uniform thresholds.\n if (!Array.isArray(tz)) {\n tz = tickStep(x0, x1, tz);\n tz = sequence(Math.ceil(x0 / tz) * tz, Math.floor(x1 / tz) * tz, tz); // exclusive\n }\n\n // Remove any thresholds outside the domain.\n var m = tz.length;\n while (tz[0] <= x0) tz.shift(), --m;\n while (tz[m - 1] > x1) tz.pop(), --m;\n\n var bins = new Array(m + 1),\n bin;\n\n // Initialize bins.\n for (i = 0; i <= m; ++i) {\n bin = bins[i] = [];\n bin.x0 = i > 0 ? tz[i - 1] : x0;\n bin.x1 = i < m ? tz[i] : x1;\n }\n\n // Assign data to bins by value, ignoring any outside the domain.\n for (i = 0; i < n; ++i) {\n x = values[i];\n if (x0 <= x && x <= x1) {\n bins[bisectRight(tz, x, 0, m)].push(data[i]);\n }\n }\n\n return bins;\n }\n\n histogram.value = function(_) {\n return arguments.length ? (value = typeof _ === \"function\" ? _ : constant(_), histogram) : value;\n };\n\n histogram.domain = function(_) {\n return arguments.length ? (domain = typeof _ === \"function\" ? _ : constant([_[0], _[1]]), histogram) : domain;\n };\n\n histogram.thresholds = function(_) {\n return arguments.length ? (threshold = typeof _ === \"function\" ? _ : Array.isArray(_) ? constant(slice.call(_)) : constant(_), histogram) : threshold;\n };\n\n return histogram;\n};\n\nvar threshold = function(values, p, valueof) {\n if (valueof == null) valueof = number;\n if (!(n = values.length)) return;\n if ((p = +p) <= 0 || n < 2) return +valueof(values[0], 0, values);\n if (p >= 1) return +valueof(values[n - 1], n - 1, values);\n var n,\n i = (n - 1) * p,\n i0 = Math.floor(i),\n value0 = +valueof(values[i0], i0, values),\n value1 = +valueof(values[i0 + 1], i0 + 1, values);\n return value0 + (value1 - value0) * (i - i0);\n};\n\nvar freedmanDiaconis = function(values, min, max) {\n values = map.call(values, number).sort(ascending);\n return Math.ceil((max - min) / (2 * (threshold(values, 0.75) - threshold(values, 0.25)) * Math.pow(values.length, -1 / 3)));\n};\n\nvar scott = function(values, min, max) {\n return Math.ceil((max - min) / (3.5 * deviation(values) * Math.pow(values.length, -1 / 3)));\n};\n\nvar max = function(values, valueof) {\n var n = values.length,\n i = -1,\n value,\n max;\n\n if (valueof == null) {\n while (++i < n) { // Find the first comparable value.\n if ((value = values[i]) != null && value >= value) {\n max = value;\n while (++i < n) { // Compare the remaining values.\n if ((value = values[i]) != null && value > max) {\n max = value;\n }\n }\n }\n }\n }\n\n else {\n while (++i < n) { // Find the first comparable value.\n if ((value = valueof(values[i], i, values)) != null && value >= value) {\n max = value;\n while (++i < n) { // Compare the remaining values.\n if ((value = valueof(values[i], i, values)) != null && value > max) {\n max = value;\n }\n }\n }\n }\n }\n\n return max;\n};\n\nvar mean = function(values, valueof) {\n var n = values.length,\n m = n,\n i = -1,\n value,\n sum = 0;\n\n if (valueof == null) {\n while (++i < n) {\n if (!isNaN(value = number(values[i]))) sum += value;\n else --m;\n }\n }\n\n else {\n while (++i < n) {\n if (!isNaN(value = number(valueof(values[i], i, values)))) sum += value;\n else --m;\n }\n }\n\n if (m) return sum / m;\n};\n\nvar median = function(values, valueof) {\n var n = values.length,\n i = -1,\n value,\n numbers = [];\n\n if (valueof == null) {\n while (++i < n) {\n if (!isNaN(value = number(values[i]))) {\n numbers.push(value);\n }\n }\n }\n\n else {\n while (++i < n) {\n if (!isNaN(value = number(valueof(values[i], i, values)))) {\n numbers.push(value);\n }\n }\n }\n\n return threshold(numbers.sort(ascending), 0.5);\n};\n\nvar merge = function(arrays) {\n var n = arrays.length,\n m,\n i = -1,\n j = 0,\n merged,\n array;\n\n while (++i < n) j += arrays[i].length;\n merged = new Array(j);\n\n while (--n >= 0) {\n array = arrays[n];\n m = array.length;\n while (--m >= 0) {\n merged[--j] = array[m];\n }\n }\n\n return merged;\n};\n\nvar min = function(values, valueof) {\n var n = values.length,\n i = -1,\n value,\n min;\n\n if (valueof == null) {\n while (++i < n) { // Find the first comparable value.\n if ((value = values[i]) != null && value >= value) {\n min = value;\n while (++i < n) { // Compare the remaining values.\n if ((value = values[i]) != null && min > value) {\n min = value;\n }\n }\n }\n }\n }\n\n else {\n while (++i < n) { // Find the first comparable value.\n if ((value = valueof(values[i], i, values)) != null && value >= value) {\n min = value;\n while (++i < n) { // Compare the remaining values.\n if ((value = valueof(values[i], i, values)) != null && min > value) {\n min = value;\n }\n }\n }\n }\n }\n\n return min;\n};\n\nvar permute = function(array, indexes) {\n var i = indexes.length, permutes = new Array(i);\n while (i--) permutes[i] = array[indexes[i]];\n return permutes;\n};\n\nvar scan = function(values, compare) {\n if (!(n = values.length)) return;\n var n,\n i = 0,\n j = 0,\n xi,\n xj = values[j];\n\n if (compare == null) compare = ascending;\n\n while (++i < n) {\n if (compare(xi = values[i], xj) < 0 || compare(xj, xj) !== 0) {\n xj = xi, j = i;\n }\n }\n\n if (compare(xj, xj) === 0) return j;\n};\n\nvar shuffle = function(array, i0, i1) {\n var m = (i1 == null ? array.length : i1) - (i0 = i0 == null ? 0 : +i0),\n t,\n i;\n\n while (m) {\n i = Math.random() * m-- | 0;\n t = array[m + i0];\n array[m + i0] = array[i + i0];\n array[i + i0] = t;\n }\n\n return array;\n};\n\nvar sum = function(values, valueof) {\n var n = values.length,\n i = -1,\n value,\n sum = 0;\n\n if (valueof == null) {\n while (++i < n) {\n if (value = +values[i]) sum += value; // Note: zero and null are equivalent.\n }\n }\n\n else {\n while (++i < n) {\n if (value = +valueof(values[i], i, values)) sum += value;\n }\n }\n\n return sum;\n};\n\nvar transpose = function(matrix) {\n if (!(n = matrix.length)) return [];\n for (var i = -1, m = min(matrix, length), transpose = new Array(m); ++i < m;) {\n for (var j = -1, n, row = transpose[i] = new Array(n); ++j < n;) {\n row[j] = matrix[j][i];\n }\n }\n return transpose;\n};\n\nfunction length(d) {\n return d.length;\n}\n\nvar zip = function() {\n return transpose(arguments);\n};\n\nvar slice$1 = Array.prototype.slice;\n\nvar identity$1 = function(x) {\n return x;\n};\n\nvar top = 1;\nvar right = 2;\nvar bottom = 3;\nvar left = 4;\nvar epsilon = 1e-6;\n\nfunction translateX(x) {\n return \"translate(\" + (x + 0.5) + \",0)\";\n}\n\nfunction translateY(y) {\n return \"translate(0,\" + (y + 0.5) + \")\";\n}\n\nfunction number$1(scale) {\n return function(d) {\n return +scale(d);\n };\n}\n\nfunction center(scale) {\n var offset = Math.max(0, scale.bandwidth() - 1) / 2; // Adjust for 0.5px offset.\n if (scale.round()) offset = Math.round(offset);\n return function(d) {\n return +scale(d) + offset;\n };\n}\n\nfunction entering() {\n return !this.__axis;\n}\n\nfunction axis(orient, scale) {\n var tickArguments = [],\n tickValues = null,\n tickFormat = null,\n tickSizeInner = 6,\n tickSizeOuter = 6,\n tickPadding = 3,\n k = orient === top || orient === left ? -1 : 1,\n x = orient === left || orient === right ? \"x\" : \"y\",\n transform = orient === top || orient === bottom ? translateX : translateY;\n\n function axis(context) {\n var values = tickValues == null ? (scale.ticks ? scale.ticks.apply(scale, tickArguments) : scale.domain()) : tickValues,\n format = tickFormat == null ? (scale.tickFormat ? scale.tickFormat.apply(scale, tickArguments) : identity$1) : tickFormat,\n spacing = Math.max(tickSizeInner, 0) + tickPadding,\n range = scale.range(),\n range0 = +range[0] + 0.5,\n range1 = +range[range.length - 1] + 0.5,\n position = (scale.bandwidth ? center : number$1)(scale.copy()),\n selection = context.selection ? context.selection() : context,\n path = selection.selectAll(\".domain\").data([null]),\n tick = selection.selectAll(\".tick\").data(values, scale).order(),\n tickExit = tick.exit(),\n tickEnter = tick.enter().append(\"g\").attr(\"class\", \"tick\"),\n line = tick.select(\"line\"),\n text = tick.select(\"text\");\n\n path = path.merge(path.enter().insert(\"path\", \".tick\")\n .attr(\"class\", \"domain\")\n .attr(\"stroke\", \"#000\"));\n\n tick = tick.merge(tickEnter);\n\n line = line.merge(tickEnter.append(\"line\")\n .attr(\"stroke\", \"#000\")\n .attr(x + \"2\", k * tickSizeInner));\n\n text = text.merge(tickEnter.append(\"text\")\n .attr(\"fill\", \"#000\")\n .attr(x, k * spacing)\n .attr(\"dy\", orient === top ? \"0em\" : orient === bottom ? \"0.71em\" : \"0.32em\"));\n\n if (context !== selection) {\n path = path.transition(context);\n tick = tick.transition(context);\n line = line.transition(context);\n text = text.transition(context);\n\n tickExit = tickExit.transition(context)\n .attr(\"opacity\", epsilon)\n .attr(\"transform\", function(d) { return isFinite(d = position(d)) ? transform(d) : this.getAttribute(\"transform\"); });\n\n tickEnter\n .attr(\"opacity\", epsilon)\n .attr(\"transform\", function(d) { var p = this.parentNode.__axis; return transform(p && isFinite(p = p(d)) ? p : position(d)); });\n }\n\n tickExit.remove();\n\n path\n .attr(\"d\", orient === left || orient == right\n ? \"M\" + k * tickSizeOuter + \",\" + range0 + \"H0.5V\" + range1 + \"H\" + k * tickSizeOuter\n : \"M\" + range0 + \",\" + k * tickSizeOuter + \"V0.5H\" + range1 + \"V\" + k * tickSizeOuter);\n\n tick\n .attr(\"opacity\", 1)\n .attr(\"transform\", function(d) { return transform(position(d)); });\n\n line\n .attr(x + \"2\", k * tickSizeInner);\n\n text\n .attr(x, k * spacing)\n .text(format);\n\n selection.filter(entering)\n .attr(\"fill\", \"none\")\n .attr(\"font-size\", 10)\n .attr(\"font-family\", \"sans-serif\")\n .attr(\"text-anchor\", orient === right ? \"start\" : orient === left ? \"end\" : \"middle\");\n\n selection\n .each(function() { this.__axis = position; });\n }\n\n axis.scale = function(_) {\n return arguments.length ? (scale = _, axis) : scale;\n };\n\n axis.ticks = function() {\n return tickArguments = slice$1.call(arguments), axis;\n };\n\n axis.tickArguments = function(_) {\n return arguments.length ? (tickArguments = _ == null ? [] : slice$1.call(_), axis) : tickArguments.slice();\n };\n\n axis.tickValues = function(_) {\n return arguments.length ? (tickValues = _ == null ? null : slice$1.call(_), axis) : tickValues && tickValues.slice();\n };\n\n axis.tickFormat = function(_) {\n return arguments.length ? (tickFormat = _, axis) : tickFormat;\n };\n\n axis.tickSize = function(_) {\n return arguments.length ? (tickSizeInner = tickSizeOuter = +_, axis) : tickSizeInner;\n };\n\n axis.tickSizeInner = function(_) {\n return arguments.length ? (tickSizeInner = +_, axis) : tickSizeInner;\n };\n\n axis.tickSizeOuter = function(_) {\n return arguments.length ? (tickSizeOuter = +_, axis) : tickSizeOuter;\n };\n\n axis.tickPadding = function(_) {\n return arguments.length ? (tickPadding = +_, axis) : tickPadding;\n };\n\n return axis;\n}\n\nfunction axisTop(scale) {\n return axis(top, scale);\n}\n\nfunction axisRight(scale) {\n return axis(right, scale);\n}\n\nfunction axisBottom(scale) {\n return axis(bottom, scale);\n}\n\nfunction axisLeft(scale) {\n return axis(left, scale);\n}\n\nvar noop = {value: function() {}};\n\nfunction dispatch() {\n for (var i = 0, n = arguments.length, _ = {}, t; i < n; ++i) {\n if (!(t = arguments[i] + \"\") || (t in _)) throw new Error(\"illegal type: \" + t);\n _[t] = [];\n }\n return new Dispatch(_);\n}\n\nfunction Dispatch(_) {\n this._ = _;\n}\n\nfunction parseTypenames(typenames, types) {\n return typenames.trim().split(/^|\\s+/).map(function(t) {\n var name = \"\", i = t.indexOf(\".\");\n if (i >= 0) name = t.slice(i + 1), t = t.slice(0, i);\n if (t && !types.hasOwnProperty(t)) throw new Error(\"unknown type: \" + t);\n return {type: t, name: name};\n });\n}\n\nDispatch.prototype = dispatch.prototype = {\n constructor: Dispatch,\n on: function(typename, callback) {\n var _ = this._,\n T = parseTypenames(typename + \"\", _),\n t,\n i = -1,\n n = T.length;\n\n // If no callback was specified, return the callback of the given type and name.\n if (arguments.length < 2) {\n while (++i < n) if ((t = (typename = T[i]).type) && (t = get(_[t], typename.name))) return t;\n return;\n }\n\n // If a type was specified, set the callback for the given type and name.\n // Otherwise, if a null callback was specified, remove callbacks of the given name.\n if (callback != null && typeof callback !== \"function\") throw new Error(\"invalid callback: \" + callback);\n while (++i < n) {\n if (t = (typename = T[i]).type) _[t] = set(_[t], typename.name, callback);\n else if (callback == null) for (t in _) _[t] = set(_[t], typename.name, null);\n }\n\n return this;\n },\n copy: function() {\n var copy = {}, _ = this._;\n for (var t in _) copy[t] = _[t].slice();\n return new Dispatch(copy);\n },\n call: function(type, that) {\n if ((n = arguments.length - 2) > 0) for (var args = new Array(n), i = 0, n, t; i < n; ++i) args[i] = arguments[i + 2];\n if (!this._.hasOwnProperty(type)) throw new Error(\"unknown type: \" + type);\n for (t = this._[type], i = 0, n = t.length; i < n; ++i) t[i].value.apply(that, args);\n },\n apply: function(type, that, args) {\n if (!this._.hasOwnProperty(type)) throw new Error(\"unknown type: \" + type);\n for (var t = this._[type], i = 0, n = t.length; i < n; ++i) t[i].value.apply(that, args);\n }\n};\n\nfunction get(type, name) {\n for (var i = 0, n = type.length, c; i < n; ++i) {\n if ((c = type[i]).name === name) {\n return c.value;\n }\n }\n}\n\nfunction set(type, name, callback) {\n for (var i = 0, n = type.length; i < n; ++i) {\n if (type[i].name === name) {\n type[i] = noop, type = type.slice(0, i).concat(type.slice(i + 1));\n break;\n }\n }\n if (callback != null) type.push({name: name, value: callback});\n return type;\n}\n\nvar xhtml = \"http://www.w3.org/1999/xhtml\";\n\nvar namespaces = {\n svg: \"http://www.w3.org/2000/svg\",\n xhtml: xhtml,\n xlink: \"http://www.w3.org/1999/xlink\",\n xml: \"http://www.w3.org/XML/1998/namespace\",\n xmlns: \"http://www.w3.org/2000/xmlns/\"\n};\n\nvar namespace = function(name) {\n var prefix = name += \"\", i = prefix.indexOf(\":\");\n if (i >= 0 && (prefix = name.slice(0, i)) !== \"xmlns\") name = name.slice(i + 1);\n return namespaces.hasOwnProperty(prefix) ? {space: namespaces[prefix], local: name} : name;\n};\n\nfunction creatorInherit(name) {\n return function() {\n var document = this.ownerDocument,\n uri = this.namespaceURI;\n return uri === xhtml && document.documentElement.namespaceURI === xhtml\n ? document.createElement(name)\n : document.createElementNS(uri, name);\n };\n}\n\nfunction creatorFixed(fullname) {\n return function() {\n return this.ownerDocument.createElementNS(fullname.space, fullname.local);\n };\n}\n\nvar creator = function(name) {\n var fullname = namespace(name);\n return (fullname.local\n ? creatorFixed\n : creatorInherit)(fullname);\n};\n\nvar nextId = 0;\n\nfunction local$1() {\n return new Local;\n}\n\nfunction Local() {\n this._ = \"@\" + (++nextId).toString(36);\n}\n\nLocal.prototype = local$1.prototype = {\n constructor: Local,\n get: function(node) {\n var id = this._;\n while (!(id in node)) if (!(node = node.parentNode)) return;\n return node[id];\n },\n set: function(node, value) {\n return node[this._] = value;\n },\n remove: function(node) {\n return this._ in node && delete node[this._];\n },\n toString: function() {\n return this._;\n }\n};\n\nvar matcher = function(selector) {\n return function() {\n return this.matches(selector);\n };\n};\n\nif (typeof document !== \"undefined\") {\n var element = document.documentElement;\n if (!element.matches) {\n var vendorMatches = element.webkitMatchesSelector\n || element.msMatchesSelector\n || element.mozMatchesSelector\n || element.oMatchesSelector;\n matcher = function(selector) {\n return function() {\n return vendorMatches.call(this, selector);\n };\n };\n }\n}\n\nvar matcher$1 = matcher;\n\nvar filterEvents = {};\n\nexports.event = null;\n\nif (typeof document !== \"undefined\") {\n var element$1 = document.documentElement;\n if (!(\"onmouseenter\" in element$1)) {\n filterEvents = {mouseenter: \"mouseover\", mouseleave: \"mouseout\"};\n }\n}\n\nfunction filterContextListener(listener, index, group) {\n listener = contextListener(listener, index, group);\n return function(event) {\n var related = event.relatedTarget;\n if (!related || (related !== this && !(related.compareDocumentPosition(this) & 8))) {\n listener.call(this, event);\n }\n };\n}\n\nfunction contextListener(listener, index, group) {\n return function(event1) {\n var event0 = exports.event; // Events can be reentrant (e.g., focus).\n exports.event = event1;\n try {\n listener.call(this, this.__data__, index, group);\n } finally {\n exports.event = event0;\n }\n };\n}\n\nfunction parseTypenames$1(typenames) {\n return typenames.trim().split(/^|\\s+/).map(function(t) {\n var name = \"\", i = t.indexOf(\".\");\n if (i >= 0) name = t.slice(i + 1), t = t.slice(0, i);\n return {type: t, name: name};\n });\n}\n\nfunction onRemove(typename) {\n return function() {\n var on = this.__on;\n if (!on) return;\n for (var j = 0, i = -1, m = on.length, o; j < m; ++j) {\n if (o = on[j], (!typename.type || o.type === typename.type) && o.name === typename.name) {\n this.removeEventListener(o.type, o.listener, o.capture);\n } else {\n on[++i] = o;\n }\n }\n if (++i) on.length = i;\n else delete this.__on;\n };\n}\n\nfunction onAdd(typename, value, capture) {\n var wrap = filterEvents.hasOwnProperty(typename.type) ? filterContextListener : contextListener;\n return function(d, i, group) {\n var on = this.__on, o, listener = wrap(value, i, group);\n if (on) for (var j = 0, m = on.length; j < m; ++j) {\n if ((o = on[j]).type === typename.type && o.name === typename.name) {\n this.removeEventListener(o.type, o.listener, o.capture);\n this.addEventListener(o.type, o.listener = listener, o.capture = capture);\n o.value = value;\n return;\n }\n }\n this.addEventListener(typename.type, listener, capture);\n o = {type: typename.type, name: typename.name, value: value, listener: listener, capture: capture};\n if (!on) this.__on = [o];\n else on.push(o);\n };\n}\n\nvar selection_on = function(typename, value, capture) {\n var typenames = parseTypenames$1(typename + \"\"), i, n = typenames.length, t;\n\n if (arguments.length < 2) {\n var on = this.node().__on;\n if (on) for (var j = 0, m = on.length, o; j < m; ++j) {\n for (i = 0, o = on[j]; i < n; ++i) {\n if ((t = typenames[i]).type === o.type && t.name === o.name) {\n return o.value;\n }\n }\n }\n return;\n }\n\n on = value ? onAdd : onRemove;\n if (capture == null) capture = false;\n for (i = 0; i < n; ++i) this.each(on(typenames[i], value, capture));\n return this;\n};\n\nfunction customEvent(event1, listener, that, args) {\n var event0 = exports.event;\n event1.sourceEvent = exports.event;\n exports.event = event1;\n try {\n return listener.apply(that, args);\n } finally {\n exports.event = event0;\n }\n}\n\nvar sourceEvent = function() {\n var current = exports.event, source;\n while (source = current.sourceEvent) current = source;\n return current;\n};\n\nvar point = function(node, event) {\n var svg = node.ownerSVGElement || node;\n\n if (svg.createSVGPoint) {\n var point = svg.createSVGPoint();\n point.x = event.clientX, point.y = event.clientY;\n point = point.matrixTransform(node.getScreenCTM().inverse());\n return [point.x, point.y];\n }\n\n var rect = node.getBoundingClientRect();\n return [event.clientX - rect.left - node.clientLeft, event.clientY - rect.top - node.clientTop];\n};\n\nvar mouse = function(node) {\n var event = sourceEvent();\n if (event.changedTouches) event = event.changedTouches[0];\n return point(node, event);\n};\n\nfunction none() {}\n\nvar selector = function(selector) {\n return selector == null ? none : function() {\n return this.querySelector(selector);\n };\n};\n\nvar selection_select = function(select) {\n if (typeof select !== \"function\") select = selector(select);\n\n for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, subgroup = subgroups[j] = new Array(n), node, subnode, i = 0; i < n; ++i) {\n if ((node = group[i]) && (subnode = select.call(node, node.__data__, i, group))) {\n if (\"__data__\" in node) subnode.__data__ = node.__data__;\n subgroup[i] = subnode;\n }\n }\n }\n\n return new Selection(subgroups, this._parents);\n};\n\nfunction empty$1() {\n return [];\n}\n\nvar selectorAll = function(selector) {\n return selector == null ? empty$1 : function() {\n return this.querySelectorAll(selector);\n };\n};\n\nvar selection_selectAll = function(select) {\n if (typeof select !== \"function\") select = selectorAll(select);\n\n for (var groups = this._groups, m = groups.length, subgroups = [], parents = [], j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) {\n if (node = group[i]) {\n subgroups.push(select.call(node, node.__data__, i, group));\n parents.push(node);\n }\n }\n }\n\n return new Selection(subgroups, parents);\n};\n\nvar selection_filter = function(match) {\n if (typeof match !== \"function\") match = matcher$1(match);\n\n for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, subgroup = subgroups[j] = [], node, i = 0; i < n; ++i) {\n if ((node = group[i]) && match.call(node, node.__data__, i, group)) {\n subgroup.push(node);\n }\n }\n }\n\n return new Selection(subgroups, this._parents);\n};\n\nvar sparse = function(update) {\n return new Array(update.length);\n};\n\nvar selection_enter = function() {\n return new Selection(this._enter || this._groups.map(sparse), this._parents);\n};\n\nfunction EnterNode(parent, datum) {\n this.ownerDocument = parent.ownerDocument;\n this.namespaceURI = parent.namespaceURI;\n this._next = null;\n this._parent = parent;\n this.__data__ = datum;\n}\n\nEnterNode.prototype = {\n constructor: EnterNode,\n appendChild: function(child) { return this._parent.insertBefore(child, this._next); },\n insertBefore: function(child, next) { return this._parent.insertBefore(child, next); },\n querySelector: function(selector) { return this._parent.querySelector(selector); },\n querySelectorAll: function(selector) { return this._parent.querySelectorAll(selector); }\n};\n\nvar constant$1 = function(x) {\n return function() {\n return x;\n };\n};\n\nvar keyPrefix = \"$\"; // Protect against keys like “__proto__”.\n\nfunction bindIndex(parent, group, enter, update, exit, data) {\n var i = 0,\n node,\n groupLength = group.length,\n dataLength = data.length;\n\n // Put any non-null nodes that fit into update.\n // Put any null nodes into enter.\n // Put any remaining data into enter.\n for (; i < dataLength; ++i) {\n if (node = group[i]) {\n node.__data__ = data[i];\n update[i] = node;\n } else {\n enter[i] = new EnterNode(parent, data[i]);\n }\n }\n\n // Put any non-null nodes that don’t fit into exit.\n for (; i < groupLength; ++i) {\n if (node = group[i]) {\n exit[i] = node;\n }\n }\n}\n\nfunction bindKey(parent, group, enter, update, exit, data, key) {\n var i,\n node,\n nodeByKeyValue = {},\n groupLength = group.length,\n dataLength = data.length,\n keyValues = new Array(groupLength),\n keyValue;\n\n // Compute the key for each node.\n // If multiple nodes have the same key, the duplicates are added to exit.\n for (i = 0; i < groupLength; ++i) {\n if (node = group[i]) {\n keyValues[i] = keyValue = keyPrefix + key.call(node, node.__data__, i, group);\n if (keyValue in nodeByKeyValue) {\n exit[i] = node;\n } else {\n nodeByKeyValue[keyValue] = node;\n }\n }\n }\n\n // Compute the key for each datum.\n // If there a node associated with this key, join and add it to update.\n // If there is not (or the key is a duplicate), add it to enter.\n for (i = 0; i < dataLength; ++i) {\n keyValue = keyPrefix + key.call(parent, data[i], i, data);\n if (node = nodeByKeyValue[keyValue]) {\n update[i] = node;\n node.__data__ = data[i];\n nodeByKeyValue[keyValue] = null;\n } else {\n enter[i] = new EnterNode(parent, data[i]);\n }\n }\n\n // Add any remaining nodes that were not bound to data to exit.\n for (i = 0; i < groupLength; ++i) {\n if ((node = group[i]) && (nodeByKeyValue[keyValues[i]] === node)) {\n exit[i] = node;\n }\n }\n}\n\nvar selection_data = function(value, key) {\n if (!value) {\n data = new Array(this.size()), j = -1;\n this.each(function(d) { data[++j] = d; });\n return data;\n }\n\n var bind = key ? bindKey : bindIndex,\n parents = this._parents,\n groups = this._groups;\n\n if (typeof value !== \"function\") value = constant$1(value);\n\n for (var m = groups.length, update = new Array(m), enter = new Array(m), exit = new Array(m), j = 0; j < m; ++j) {\n var parent = parents[j],\n group = groups[j],\n groupLength = group.length,\n data = value.call(parent, parent && parent.__data__, j, parents),\n dataLength = data.length,\n enterGroup = enter[j] = new Array(dataLength),\n updateGroup = update[j] = new Array(dataLength),\n exitGroup = exit[j] = new Array(groupLength);\n\n bind(parent, group, enterGroup, updateGroup, exitGroup, data, key);\n\n // Now connect the enter nodes to their following update node, such that\n // appendChild can insert the materialized enter node before this node,\n // rather than at the end of the parent node.\n for (var i0 = 0, i1 = 0, previous, next; i0 < dataLength; ++i0) {\n if (previous = enterGroup[i0]) {\n if (i0 >= i1) i1 = i0 + 1;\n while (!(next = updateGroup[i1]) && ++i1 < dataLength);\n previous._next = next || null;\n }\n }\n }\n\n update = new Selection(update, parents);\n update._enter = enter;\n update._exit = exit;\n return update;\n};\n\nvar selection_exit = function() {\n return new Selection(this._exit || this._groups.map(sparse), this._parents);\n};\n\nvar selection_merge = function(selection$$1) {\n\n for (var groups0 = this._groups, groups1 = selection$$1._groups, m0 = groups0.length, m1 = groups1.length, m = Math.min(m0, m1), merges = new Array(m0), j = 0; j < m; ++j) {\n for (var group0 = groups0[j], group1 = groups1[j], n = group0.length, merge = merges[j] = new Array(n), node, i = 0; i < n; ++i) {\n if (node = group0[i] || group1[i]) {\n merge[i] = node;\n }\n }\n }\n\n for (; j < m0; ++j) {\n merges[j] = groups0[j];\n }\n\n return new Selection(merges, this._parents);\n};\n\nvar selection_order = function() {\n\n for (var groups = this._groups, j = -1, m = groups.length; ++j < m;) {\n for (var group = groups[j], i = group.length - 1, next = group[i], node; --i >= 0;) {\n if (node = group[i]) {\n if (next && next !== node.nextSibling) next.parentNode.insertBefore(node, next);\n next = node;\n }\n }\n }\n\n return this;\n};\n\nvar selection_sort = function(compare) {\n if (!compare) compare = ascending$1;\n\n function compareNode(a, b) {\n return a && b ? compare(a.__data__, b.__data__) : !a - !b;\n }\n\n for (var groups = this._groups, m = groups.length, sortgroups = new Array(m), j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, sortgroup = sortgroups[j] = new Array(n), node, i = 0; i < n; ++i) {\n if (node = group[i]) {\n sortgroup[i] = node;\n }\n }\n sortgroup.sort(compareNode);\n }\n\n return new Selection(sortgroups, this._parents).order();\n};\n\nfunction ascending$1(a, b) {\n return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;\n}\n\nvar selection_call = function() {\n var callback = arguments[0];\n arguments[0] = this;\n callback.apply(null, arguments);\n return this;\n};\n\nvar selection_nodes = function() {\n var nodes = new Array(this.size()), i = -1;\n this.each(function() { nodes[++i] = this; });\n return nodes;\n};\n\nvar selection_node = function() {\n\n for (var groups = this._groups, j = 0, m = groups.length; j < m; ++j) {\n for (var group = groups[j], i = 0, n = group.length; i < n; ++i) {\n var node = group[i];\n if (node) return node;\n }\n }\n\n return null;\n};\n\nvar selection_size = function() {\n var size = 0;\n this.each(function() { ++size; });\n return size;\n};\n\nvar selection_empty = function() {\n return !this.node();\n};\n\nvar selection_each = function(callback) {\n\n for (var groups = this._groups, j = 0, m = groups.length; j < m; ++j) {\n for (var group = groups[j], i = 0, n = group.length, node; i < n; ++i) {\n if (node = group[i]) callback.call(node, node.__data__, i, group);\n }\n }\n\n return this;\n};\n\nfunction attrRemove(name) {\n return function() {\n this.removeAttribute(name);\n };\n}\n\nfunction attrRemoveNS(fullname) {\n return function() {\n this.removeAttributeNS(fullname.space, fullname.local);\n };\n}\n\nfunction attrConstant(name, value) {\n return function() {\n this.setAttribute(name, value);\n };\n}\n\nfunction attrConstantNS(fullname, value) {\n return function() {\n this.setAttributeNS(fullname.space, fullname.local, value);\n };\n}\n\nfunction attrFunction(name, value) {\n return function() {\n var v = value.apply(this, arguments);\n if (v == null) this.removeAttribute(name);\n else this.setAttribute(name, v);\n };\n}\n\nfunction attrFunctionNS(fullname, value) {\n return function() {\n var v = value.apply(this, arguments);\n if (v == null) this.removeAttributeNS(fullname.space, fullname.local);\n else this.setAttributeNS(fullname.space, fullname.local, v);\n };\n}\n\nvar selection_attr = function(name, value) {\n var fullname = namespace(name);\n\n if (arguments.length < 2) {\n var node = this.node();\n return fullname.local\n ? node.getAttributeNS(fullname.space, fullname.local)\n : node.getAttribute(fullname);\n }\n\n return this.each((value == null\n ? (fullname.local ? attrRemoveNS : attrRemove) : (typeof value === \"function\"\n ? (fullname.local ? attrFunctionNS : attrFunction)\n : (fullname.local ? attrConstantNS : attrConstant)))(fullname, value));\n};\n\nvar defaultView = function(node) {\n return (node.ownerDocument && node.ownerDocument.defaultView) // node is a Node\n || (node.document && node) // node is a Window\n || node.defaultView; // node is a Document\n};\n\nfunction styleRemove(name) {\n return function() {\n this.style.removeProperty(name);\n };\n}\n\nfunction styleConstant(name, value, priority) {\n return function() {\n this.style.setProperty(name, value, priority);\n };\n}\n\nfunction styleFunction(name, value, priority) {\n return function() {\n var v = value.apply(this, arguments);\n if (v == null) this.style.removeProperty(name);\n else this.style.setProperty(name, v, priority);\n };\n}\n\nvar selection_style = function(name, value, priority) {\n return arguments.length > 1\n ? this.each((value == null\n ? styleRemove : typeof value === \"function\"\n ? styleFunction\n : styleConstant)(name, value, priority == null ? \"\" : priority))\n : styleValue(this.node(), name);\n};\n\nfunction styleValue(node, name) {\n return node.style.getPropertyValue(name)\n || defaultView(node).getComputedStyle(node, null).getPropertyValue(name);\n}\n\nfunction propertyRemove(name) {\n return function() {\n delete this[name];\n };\n}\n\nfunction propertyConstant(name, value) {\n return function() {\n this[name] = value;\n };\n}\n\nfunction propertyFunction(name, value) {\n return function() {\n var v = value.apply(this, arguments);\n if (v == null) delete this[name];\n else this[name] = v;\n };\n}\n\nvar selection_property = function(name, value) {\n return arguments.length > 1\n ? this.each((value == null\n ? propertyRemove : typeof value === \"function\"\n ? propertyFunction\n : propertyConstant)(name, value))\n : this.node()[name];\n};\n\nfunction classArray(string) {\n return string.trim().split(/^|\\s+/);\n}\n\nfunction classList(node) {\n return node.classList || new ClassList(node);\n}\n\nfunction ClassList(node) {\n this._node = node;\n this._names = classArray(node.getAttribute(\"class\") || \"\");\n}\n\nClassList.prototype = {\n add: function(name) {\n var i = this._names.indexOf(name);\n if (i < 0) {\n this._names.push(name);\n this._node.setAttribute(\"class\", this._names.join(\" \"));\n }\n },\n remove: function(name) {\n var i = this._names.indexOf(name);\n if (i >= 0) {\n this._names.splice(i, 1);\n this._node.setAttribute(\"class\", this._names.join(\" \"));\n }\n },\n contains: function(name) {\n return this._names.indexOf(name) >= 0;\n }\n};\n\nfunction classedAdd(node, names) {\n var list = classList(node), i = -1, n = names.length;\n while (++i < n) list.add(names[i]);\n}\n\nfunction classedRemove(node, names) {\n var list = classList(node), i = -1, n = names.length;\n while (++i < n) list.remove(names[i]);\n}\n\nfunction classedTrue(names) {\n return function() {\n classedAdd(this, names);\n };\n}\n\nfunction classedFalse(names) {\n return function() {\n classedRemove(this, names);\n };\n}\n\nfunction classedFunction(names, value) {\n return function() {\n (value.apply(this, arguments) ? classedAdd : classedRemove)(this, names);\n };\n}\n\nvar selection_classed = function(name, value) {\n var names = classArray(name + \"\");\n\n if (arguments.length < 2) {\n var list = classList(this.node()), i = -1, n = names.length;\n while (++i < n) if (!list.contains(names[i])) return false;\n return true;\n }\n\n return this.each((typeof value === \"function\"\n ? classedFunction : value\n ? classedTrue\n : classedFalse)(names, value));\n};\n\nfunction textRemove() {\n this.textContent = \"\";\n}\n\nfunction textConstant(value) {\n return function() {\n this.textContent = value;\n };\n}\n\nfunction textFunction(value) {\n return function() {\n var v = value.apply(this, arguments);\n this.textContent = v == null ? \"\" : v;\n };\n}\n\nvar selection_text = function(value) {\n return arguments.length\n ? this.each(value == null\n ? textRemove : (typeof value === \"function\"\n ? textFunction\n : textConstant)(value))\n : this.node().textContent;\n};\n\nfunction htmlRemove() {\n this.innerHTML = \"\";\n}\n\nfunction htmlConstant(value) {\n return function() {\n this.innerHTML = value;\n };\n}\n\nfunction htmlFunction(value) {\n return function() {\n var v = value.apply(this, arguments);\n this.innerHTML = v == null ? \"\" : v;\n };\n}\n\nvar selection_html = function(value) {\n return arguments.length\n ? this.each(value == null\n ? htmlRemove : (typeof value === \"function\"\n ? htmlFunction\n : htmlConstant)(value))\n : this.node().innerHTML;\n};\n\nfunction raise() {\n if (this.nextSibling) this.parentNode.appendChild(this);\n}\n\nvar selection_raise = function() {\n return this.each(raise);\n};\n\nfunction lower() {\n if (this.previousSibling) this.parentNode.insertBefore(this, this.parentNode.firstChild);\n}\n\nvar selection_lower = function() {\n return this.each(lower);\n};\n\nvar selection_append = function(name) {\n var create = typeof name === \"function\" ? name : creator(name);\n return this.select(function() {\n return this.appendChild(create.apply(this, arguments));\n });\n};\n\nfunction constantNull() {\n return null;\n}\n\nvar selection_insert = function(name, before) {\n var create = typeof name === \"function\" ? name : creator(name),\n select = before == null ? constantNull : typeof before === \"function\" ? before : selector(before);\n return this.select(function() {\n return this.insertBefore(create.apply(this, arguments), select.apply(this, arguments) || null);\n });\n};\n\nfunction remove() {\n var parent = this.parentNode;\n if (parent) parent.removeChild(this);\n}\n\nvar selection_remove = function() {\n return this.each(remove);\n};\n\nvar selection_datum = function(value) {\n return arguments.length\n ? this.property(\"__data__\", value)\n : this.node().__data__;\n};\n\nfunction dispatchEvent(node, type, params) {\n var window = defaultView(node),\n event = window.CustomEvent;\n\n if (typeof event === \"function\") {\n event = new event(type, params);\n } else {\n event = window.document.createEvent(\"Event\");\n if (params) event.initEvent(type, params.bubbles, params.cancelable), event.detail = params.detail;\n else event.initEvent(type, false, false);\n }\n\n node.dispatchEvent(event);\n}\n\nfunction dispatchConstant(type, params) {\n return function() {\n return dispatchEvent(this, type, params);\n };\n}\n\nfunction dispatchFunction(type, params) {\n return function() {\n return dispatchEvent(this, type, params.apply(this, arguments));\n };\n}\n\nvar selection_dispatch = function(type, params) {\n return this.each((typeof params === \"function\"\n ? dispatchFunction\n : dispatchConstant)(type, params));\n};\n\nvar root = [null];\n\nfunction Selection(groups, parents) {\n this._groups = groups;\n this._parents = parents;\n}\n\nfunction selection() {\n return new Selection([[document.documentElement]], root);\n}\n\nSelection.prototype = selection.prototype = {\n constructor: Selection,\n select: selection_select,\n selectAll: selection_selectAll,\n filter: selection_filter,\n data: selection_data,\n enter: selection_enter,\n exit: selection_exit,\n merge: selection_merge,\n order: selection_order,\n sort: selection_sort,\n call: selection_call,\n nodes: selection_nodes,\n node: selection_node,\n size: selection_size,\n empty: selection_empty,\n each: selection_each,\n attr: selection_attr,\n style: selection_style,\n property: selection_property,\n classed: selection_classed,\n text: selection_text,\n html: selection_html,\n raise: selection_raise,\n lower: selection_lower,\n append: selection_append,\n insert: selection_insert,\n remove: selection_remove,\n datum: selection_datum,\n on: selection_on,\n dispatch: selection_dispatch\n};\n\nvar select = function(selector) {\n return typeof selector === \"string\"\n ? new Selection([[document.querySelector(selector)]], [document.documentElement])\n : new Selection([[selector]], root);\n};\n\nvar selectAll = function(selector) {\n return typeof selector === \"string\"\n ? new Selection([document.querySelectorAll(selector)], [document.documentElement])\n : new Selection([selector == null ? [] : selector], root);\n};\n\nvar touch = function(node, touches, identifier) {\n if (arguments.length < 3) identifier = touches, touches = sourceEvent().changedTouches;\n\n for (var i = 0, n = touches ? touches.length : 0, touch; i < n; ++i) {\n if ((touch = touches[i]).identifier === identifier) {\n return point(node, touch);\n }\n }\n\n return null;\n};\n\nvar touches = function(node, touches) {\n if (touches == null) touches = sourceEvent().touches;\n\n for (var i = 0, n = touches ? touches.length : 0, points = new Array(n); i < n; ++i) {\n points[i] = point(node, touches[i]);\n }\n\n return points;\n};\n\nfunction nopropagation() {\n exports.event.stopImmediatePropagation();\n}\n\nvar noevent = function() {\n exports.event.preventDefault();\n exports.event.stopImmediatePropagation();\n};\n\nvar dragDisable = function(view) {\n var root = view.document.documentElement,\n selection = select(view).on(\"dragstart.drag\", noevent, true);\n if (\"onselectstart\" in root) {\n selection.on(\"selectstart.drag\", noevent, true);\n } else {\n root.__noselect = root.style.MozUserSelect;\n root.style.MozUserSelect = \"none\";\n }\n};\n\nfunction yesdrag(view, noclick) {\n var root = view.document.documentElement,\n selection = select(view).on(\"dragstart.drag\", null);\n if (noclick) {\n selection.on(\"click.drag\", noevent, true);\n setTimeout(function() { selection.on(\"click.drag\", null); }, 0);\n }\n if (\"onselectstart\" in root) {\n selection.on(\"selectstart.drag\", null);\n } else {\n root.style.MozUserSelect = root.__noselect;\n delete root.__noselect;\n }\n}\n\nvar constant$2 = function(x) {\n return function() {\n return x;\n };\n};\n\nfunction DragEvent(target, type, subject, id, active, x, y, dx, dy, dispatch) {\n this.target = target;\n this.type = type;\n this.subject = subject;\n this.identifier = id;\n this.active = active;\n this.x = x;\n this.y = y;\n this.dx = dx;\n this.dy = dy;\n this._ = dispatch;\n}\n\nDragEvent.prototype.on = function() {\n var value = this._.on.apply(this._, arguments);\n return value === this._ ? this : value;\n};\n\n// Ignore right-click, since that should open the context menu.\nfunction defaultFilter$1() {\n return !exports.event.button;\n}\n\nfunction defaultContainer() {\n return this.parentNode;\n}\n\nfunction defaultSubject(d) {\n return d == null ? {x: exports.event.x, y: exports.event.y} : d;\n}\n\nfunction defaultTouchable() {\n return \"ontouchstart\" in this;\n}\n\nvar drag = function() {\n var filter = defaultFilter$1,\n container = defaultContainer,\n subject = defaultSubject,\n touchable = defaultTouchable,\n gestures = {},\n listeners = dispatch(\"start\", \"drag\", \"end\"),\n active = 0,\n mousedownx,\n mousedowny,\n mousemoving,\n touchending,\n clickDistance2 = 0;\n\n function drag(selection) {\n selection\n .on(\"mousedown.drag\", mousedowned)\n .filter(touchable)\n .on(\"touchstart.drag\", touchstarted)\n .on(\"touchmove.drag\", touchmoved)\n .on(\"touchend.drag touchcancel.drag\", touchended)\n .style(\"touch-action\", \"none\")\n .style(\"-webkit-tap-highlight-color\", \"rgba(0,0,0,0)\");\n }\n\n function mousedowned() {\n if (touchending || !filter.apply(this, arguments)) return;\n var gesture = beforestart(\"mouse\", container.apply(this, arguments), mouse, this, arguments);\n if (!gesture) return;\n select(exports.event.view).on(\"mousemove.drag\", mousemoved, true).on(\"mouseup.drag\", mouseupped, true);\n dragDisable(exports.event.view);\n nopropagation();\n mousemoving = false;\n mousedownx = exports.event.clientX;\n mousedowny = exports.event.clientY;\n gesture(\"start\");\n }\n\n function mousemoved() {\n noevent();\n if (!mousemoving) {\n var dx = exports.event.clientX - mousedownx, dy = exports.event.clientY - mousedowny;\n mousemoving = dx * dx + dy * dy > clickDistance2;\n }\n gestures.mouse(\"drag\");\n }\n\n function mouseupped() {\n select(exports.event.view).on(\"mousemove.drag mouseup.drag\", null);\n yesdrag(exports.event.view, mousemoving);\n noevent();\n gestures.mouse(\"end\");\n }\n\n function touchstarted() {\n if (!filter.apply(this, arguments)) return;\n var touches = exports.event.changedTouches,\n c = container.apply(this, arguments),\n n = touches.length, i, gesture;\n\n for (i = 0; i < n; ++i) {\n if (gesture = beforestart(touches[i].identifier, c, touch, this, arguments)) {\n nopropagation();\n gesture(\"start\");\n }\n }\n }\n\n function touchmoved() {\n var touches = exports.event.changedTouches,\n n = touches.length, i, gesture;\n\n for (i = 0; i < n; ++i) {\n if (gesture = gestures[touches[i].identifier]) {\n noevent();\n gesture(\"drag\");\n }\n }\n }\n\n function touchended() {\n var touches = exports.event.changedTouches,\n n = touches.length, i, gesture;\n\n if (touchending) clearTimeout(touchending);\n touchending = setTimeout(function() { touchending = null; }, 500); // Ghost clicks are delayed!\n for (i = 0; i < n; ++i) {\n if (gesture = gestures[touches[i].identifier]) {\n nopropagation();\n gesture(\"end\");\n }\n }\n }\n\n function beforestart(id, container, point, that, args) {\n var p = point(container, id), s, dx, dy,\n sublisteners = listeners.copy();\n\n if (!customEvent(new DragEvent(drag, \"beforestart\", s, id, active, p[0], p[1], 0, 0, sublisteners), function() {\n if ((exports.event.subject = s = subject.apply(that, args)) == null) return false;\n dx = s.x - p[0] || 0;\n dy = s.y - p[1] || 0;\n return true;\n })) return;\n\n return function gesture(type) {\n var p0 = p, n;\n switch (type) {\n case \"start\": gestures[id] = gesture, n = active++; break;\n case \"end\": delete gestures[id], --active; // nobreak\n case \"drag\": p = point(container, id), n = active; break;\n }\n customEvent(new DragEvent(drag, type, s, id, n, p[0] + dx, p[1] + dy, p[0] - p0[0], p[1] - p0[1], sublisteners), sublisteners.apply, sublisteners, [type, that, args]);\n };\n }\n\n drag.filter = function(_) {\n return arguments.length ? (filter = typeof _ === \"function\" ? _ : constant$2(!!_), drag) : filter;\n };\n\n drag.container = function(_) {\n return arguments.length ? (container = typeof _ === \"function\" ? _ : constant$2(_), drag) : container;\n };\n\n drag.subject = function(_) {\n return arguments.length ? (subject = typeof _ === \"function\" ? _ : constant$2(_), drag) : subject;\n };\n\n drag.touchable = function(_) {\n return arguments.length ? (touchable = typeof _ === \"function\" ? _ : constant$2(!!_), drag) : touchable;\n };\n\n drag.on = function() {\n var value = listeners.on.apply(listeners, arguments);\n return value === listeners ? drag : value;\n };\n\n drag.clickDistance = function(_) {\n return arguments.length ? (clickDistance2 = (_ = +_) * _, drag) : Math.sqrt(clickDistance2);\n };\n\n return drag;\n};\n\nvar define = function(constructor, factory, prototype) {\n constructor.prototype = factory.prototype = prototype;\n prototype.constructor = constructor;\n};\n\nfunction extend(parent, definition) {\n var prototype = Object.create(parent.prototype);\n for (var key in definition) prototype[key] = definition[key];\n return prototype;\n}\n\nfunction Color() {}\n\nvar darker = 0.7;\nvar brighter = 1 / darker;\n\nvar reI = \"\\\\s*([+-]?\\\\d+)\\\\s*\";\nvar reN = \"\\\\s*([+-]?\\\\d*\\\\.?\\\\d+(?:[eE][+-]?\\\\d+)?)\\\\s*\";\nvar reP = \"\\\\s*([+-]?\\\\d*\\\\.?\\\\d+(?:[eE][+-]?\\\\d+)?)%\\\\s*\";\nvar reHex3 = /^#([0-9a-f]{3})$/;\nvar reHex6 = /^#([0-9a-f]{6})$/;\nvar reRgbInteger = new RegExp(\"^rgb\\\\(\" + [reI, reI, reI] + \"\\\\)$\");\nvar reRgbPercent = new RegExp(\"^rgb\\\\(\" + [reP, reP, reP] + \"\\\\)$\");\nvar reRgbaInteger = new RegExp(\"^rgba\\\\(\" + [reI, reI, reI, reN] + \"\\\\)$\");\nvar reRgbaPercent = new RegExp(\"^rgba\\\\(\" + [reP, reP, reP, reN] + \"\\\\)$\");\nvar reHslPercent = new RegExp(\"^hsl\\\\(\" + [reN, reP, reP] + \"\\\\)$\");\nvar reHslaPercent = new RegExp(\"^hsla\\\\(\" + [reN, reP, reP, reN] + \"\\\\)$\");\n\nvar named = {\n aliceblue: 0xf0f8ff,\n antiquewhite: 0xfaebd7,\n aqua: 0x00ffff,\n aquamarine: 0x7fffd4,\n azure: 0xf0ffff,\n beige: 0xf5f5dc,\n bisque: 0xffe4c4,\n black: 0x000000,\n blanchedalmond: 0xffebcd,\n blue: 0x0000ff,\n blueviolet: 0x8a2be2,\n brown: 0xa52a2a,\n burlywood: 0xdeb887,\n cadetblue: 0x5f9ea0,\n chartreuse: 0x7fff00,\n chocolate: 0xd2691e,\n coral: 0xff7f50,\n cornflowerblue: 0x6495ed,\n cornsilk: 0xfff8dc,\n crimson: 0xdc143c,\n cyan: 0x00ffff,\n darkblue: 0x00008b,\n darkcyan: 0x008b8b,\n darkgoldenrod: 0xb8860b,\n darkgray: 0xa9a9a9,\n darkgreen: 0x006400,\n darkgrey: 0xa9a9a9,\n darkkhaki: 0xbdb76b,\n darkmagenta: 0x8b008b,\n darkolivegreen: 0x556b2f,\n darkorange: 0xff8c00,\n darkorchid: 0x9932cc,\n darkred: 0x8b0000,\n darksalmon: 0xe9967a,\n darkseagreen: 0x8fbc8f,\n darkslateblue: 0x483d8b,\n darkslategray: 0x2f4f4f,\n darkslategrey: 0x2f4f4f,\n darkturquoise: 0x00ced1,\n darkviolet: 0x9400d3,\n deeppink: 0xff1493,\n deepskyblue: 0x00bfff,\n dimgray: 0x696969,\n dimgrey: 0x696969,\n dodgerblue: 0x1e90ff,\n firebrick: 0xb22222,\n floralwhite: 0xfffaf0,\n forestgreen: 0x228b22,\n fuchsia: 0xff00ff,\n gainsboro: 0xdcdcdc,\n ghostwhite: 0xf8f8ff,\n gold: 0xffd700,\n goldenrod: 0xdaa520,\n gray: 0x808080,\n green: 0x008000,\n greenyellow: 0xadff2f,\n grey: 0x808080,\n honeydew: 0xf0fff0,\n hotpink: 0xff69b4,\n indianred: 0xcd5c5c,\n indigo: 0x4b0082,\n ivory: 0xfffff0,\n khaki: 0xf0e68c,\n lavender: 0xe6e6fa,\n lavenderblush: 0xfff0f5,\n lawngreen: 0x7cfc00,\n lemonchiffon: 0xfffacd,\n lightblue: 0xadd8e6,\n lightcoral: 0xf08080,\n lightcyan: 0xe0ffff,\n lightgoldenrodyellow: 0xfafad2,\n lightgray: 0xd3d3d3,\n lightgreen: 0x90ee90,\n lightgrey: 0xd3d3d3,\n lightpink: 0xffb6c1,\n lightsalmon: 0xffa07a,\n lightseagreen: 0x20b2aa,\n lightskyblue: 0x87cefa,\n lightslategray: 0x778899,\n lightslategrey: 0x778899,\n lightsteelblue: 0xb0c4de,\n lightyellow: 0xffffe0,\n lime: 0x00ff00,\n limegreen: 0x32cd32,\n linen: 0xfaf0e6,\n magenta: 0xff00ff,\n maroon: 0x800000,\n mediumaquamarine: 0x66cdaa,\n mediumblue: 0x0000cd,\n mediumorchid: 0xba55d3,\n mediumpurple: 0x9370db,\n mediumseagreen: 0x3cb371,\n mediumslateblue: 0x7b68ee,\n mediumspringgreen: 0x00fa9a,\n mediumturquoise: 0x48d1cc,\n mediumvioletred: 0xc71585,\n midnightblue: 0x191970,\n mintcream: 0xf5fffa,\n mistyrose: 0xffe4e1,\n moccasin: 0xffe4b5,\n navajowhite: 0xffdead,\n navy: 0x000080,\n oldlace: 0xfdf5e6,\n olive: 0x808000,\n olivedrab: 0x6b8e23,\n orange: 0xffa500,\n orangered: 0xff4500,\n orchid: 0xda70d6,\n palegoldenrod: 0xeee8aa,\n palegreen: 0x98fb98,\n paleturquoise: 0xafeeee,\n palevioletred: 0xdb7093,\n papayawhip: 0xffefd5,\n peachpuff: 0xffdab9,\n peru: 0xcd853f,\n pink: 0xffc0cb,\n plum: 0xdda0dd,\n powderblue: 0xb0e0e6,\n purple: 0x800080,\n rebeccapurple: 0x663399,\n red: 0xff0000,\n rosybrown: 0xbc8f8f,\n royalblue: 0x4169e1,\n saddlebrown: 0x8b4513,\n salmon: 0xfa8072,\n sandybrown: 0xf4a460,\n seagreen: 0x2e8b57,\n seashell: 0xfff5ee,\n sienna: 0xa0522d,\n silver: 0xc0c0c0,\n skyblue: 0x87ceeb,\n slateblue: 0x6a5acd,\n slategray: 0x708090,\n slategrey: 0x708090,\n snow: 0xfffafa,\n springgreen: 0x00ff7f,\n steelblue: 0x4682b4,\n tan: 0xd2b48c,\n teal: 0x008080,\n thistle: 0xd8bfd8,\n tomato: 0xff6347,\n turquoise: 0x40e0d0,\n violet: 0xee82ee,\n wheat: 0xf5deb3,\n white: 0xffffff,\n whitesmoke: 0xf5f5f5,\n yellow: 0xffff00,\n yellowgreen: 0x9acd32\n};\n\ndefine(Color, color, {\n displayable: function() {\n return this.rgb().displayable();\n },\n toString: function() {\n return this.rgb() + \"\";\n }\n});\n\nfunction color(format) {\n var m;\n format = (format + \"\").trim().toLowerCase();\n return (m = reHex3.exec(format)) ? (m = parseInt(m[1], 16), new Rgb((m >> 8 & 0xf) | (m >> 4 & 0x0f0), (m >> 4 & 0xf) | (m & 0xf0), ((m & 0xf) << 4) | (m & 0xf), 1)) // #f00\n : (m = reHex6.exec(format)) ? rgbn(parseInt(m[1], 16)) // #ff0000\n : (m = reRgbInteger.exec(format)) ? new Rgb(m[1], m[2], m[3], 1) // rgb(255, 0, 0)\n : (m = reRgbPercent.exec(format)) ? new Rgb(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, 1) // rgb(100%, 0%, 0%)\n : (m = reRgbaInteger.exec(format)) ? rgba(m[1], m[2], m[3], m[4]) // rgba(255, 0, 0, 1)\n : (m = reRgbaPercent.exec(format)) ? rgba(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, m[4]) // rgb(100%, 0%, 0%, 1)\n : (m = reHslPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, 1) // hsl(120, 50%, 50%)\n : (m = reHslaPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, m[4]) // hsla(120, 50%, 50%, 1)\n : named.hasOwnProperty(format) ? rgbn(named[format])\n : format === \"transparent\" ? new Rgb(NaN, NaN, NaN, 0)\n : null;\n}\n\nfunction rgbn(n) {\n return new Rgb(n >> 16 & 0xff, n >> 8 & 0xff, n & 0xff, 1);\n}\n\nfunction rgba(r, g, b, a) {\n if (a <= 0) r = g = b = NaN;\n return new Rgb(r, g, b, a);\n}\n\nfunction rgbConvert(o) {\n if (!(o instanceof Color)) o = color(o);\n if (!o) return new Rgb;\n o = o.rgb();\n return new Rgb(o.r, o.g, o.b, o.opacity);\n}\n\nfunction rgb(r, g, b, opacity) {\n return arguments.length === 1 ? rgbConvert(r) : new Rgb(r, g, b, opacity == null ? 1 : opacity);\n}\n\nfunction Rgb(r, g, b, opacity) {\n this.r = +r;\n this.g = +g;\n this.b = +b;\n this.opacity = +opacity;\n}\n\ndefine(Rgb, rgb, extend(Color, {\n brighter: function(k) {\n k = k == null ? brighter : Math.pow(brighter, k);\n return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);\n },\n darker: function(k) {\n k = k == null ? darker : Math.pow(darker, k);\n return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);\n },\n rgb: function() {\n return this;\n },\n displayable: function() {\n return (0 <= this.r && this.r <= 255)\n && (0 <= this.g && this.g <= 255)\n && (0 <= this.b && this.b <= 255)\n && (0 <= this.opacity && this.opacity <= 1);\n },\n toString: function() {\n var a = this.opacity; a = isNaN(a) ? 1 : Math.max(0, Math.min(1, a));\n return (a === 1 ? \"rgb(\" : \"rgba(\")\n + Math.max(0, Math.min(255, Math.round(this.r) || 0)) + \", \"\n + Math.max(0, Math.min(255, Math.round(this.g) || 0)) + \", \"\n + Math.max(0, Math.min(255, Math.round(this.b) || 0))\n + (a === 1 ? \")\" : \", \" + a + \")\");\n }\n}));\n\nfunction hsla(h, s, l, a) {\n if (a <= 0) h = s = l = NaN;\n else if (l <= 0 || l >= 1) h = s = NaN;\n else if (s <= 0) h = NaN;\n return new Hsl(h, s, l, a);\n}\n\nfunction hslConvert(o) {\n if (o instanceof Hsl) return new Hsl(o.h, o.s, o.l, o.opacity);\n if (!(o instanceof Color)) o = color(o);\n if (!o) return new Hsl;\n if (o instanceof Hsl) return o;\n o = o.rgb();\n var r = o.r / 255,\n g = o.g / 255,\n b = o.b / 255,\n min = Math.min(r, g, b),\n max = Math.max(r, g, b),\n h = NaN,\n s = max - min,\n l = (max + min) / 2;\n if (s) {\n if (r === max) h = (g - b) / s + (g < b) * 6;\n else if (g === max) h = (b - r) / s + 2;\n else h = (r - g) / s + 4;\n s /= l < 0.5 ? max + min : 2 - max - min;\n h *= 60;\n } else {\n s = l > 0 && l < 1 ? 0 : h;\n }\n return new Hsl(h, s, l, o.opacity);\n}\n\nfunction hsl(h, s, l, opacity) {\n return arguments.length === 1 ? hslConvert(h) : new Hsl(h, s, l, opacity == null ? 1 : opacity);\n}\n\nfunction Hsl(h, s, l, opacity) {\n this.h = +h;\n this.s = +s;\n this.l = +l;\n this.opacity = +opacity;\n}\n\ndefine(Hsl, hsl, extend(Color, {\n brighter: function(k) {\n k = k == null ? brighter : Math.pow(brighter, k);\n return new Hsl(this.h, this.s, this.l * k, this.opacity);\n },\n darker: function(k) {\n k = k == null ? darker : Math.pow(darker, k);\n return new Hsl(this.h, this.s, this.l * k, this.opacity);\n },\n rgb: function() {\n var h = this.h % 360 + (this.h < 0) * 360,\n s = isNaN(h) || isNaN(this.s) ? 0 : this.s,\n l = this.l,\n m2 = l + (l < 0.5 ? l : 1 - l) * s,\n m1 = 2 * l - m2;\n return new Rgb(\n hsl2rgb(h >= 240 ? h - 240 : h + 120, m1, m2),\n hsl2rgb(h, m1, m2),\n hsl2rgb(h < 120 ? h + 240 : h - 120, m1, m2),\n this.opacity\n );\n },\n displayable: function() {\n return (0 <= this.s && this.s <= 1 || isNaN(this.s))\n && (0 <= this.l && this.l <= 1)\n && (0 <= this.opacity && this.opacity <= 1);\n }\n}));\n\n/* From FvD 13.37, CSS Color Module Level 3 */\nfunction hsl2rgb(h, m1, m2) {\n return (h < 60 ? m1 + (m2 - m1) * h / 60\n : h < 180 ? m2\n : h < 240 ? m1 + (m2 - m1) * (240 - h) / 60\n : m1) * 255;\n}\n\nvar deg2rad = Math.PI / 180;\nvar rad2deg = 180 / Math.PI;\n\nvar Kn = 18;\nvar Xn = 0.950470;\nvar Yn = 1;\nvar Zn = 1.088830;\nvar t0 = 4 / 29;\nvar t1 = 6 / 29;\nvar t2 = 3 * t1 * t1;\nvar t3 = t1 * t1 * t1;\n\nfunction labConvert(o) {\n if (o instanceof Lab) return new Lab(o.l, o.a, o.b, o.opacity);\n if (o instanceof Hcl) {\n var h = o.h * deg2rad;\n return new Lab(o.l, Math.cos(h) * o.c, Math.sin(h) * o.c, o.opacity);\n }\n if (!(o instanceof Rgb)) o = rgbConvert(o);\n var b = rgb2xyz(o.r),\n a = rgb2xyz(o.g),\n l = rgb2xyz(o.b),\n x = xyz2lab((0.4124564 * b + 0.3575761 * a + 0.1804375 * l) / Xn),\n y = xyz2lab((0.2126729 * b + 0.7151522 * a + 0.0721750 * l) / Yn),\n z = xyz2lab((0.0193339 * b + 0.1191920 * a + 0.9503041 * l) / Zn);\n return new Lab(116 * y - 16, 500 * (x - y), 200 * (y - z), o.opacity);\n}\n\nfunction lab(l, a, b, opacity) {\n return arguments.length === 1 ? labConvert(l) : new Lab(l, a, b, opacity == null ? 1 : opacity);\n}\n\nfunction Lab(l, a, b, opacity) {\n this.l = +l;\n this.a = +a;\n this.b = +b;\n this.opacity = +opacity;\n}\n\ndefine(Lab, lab, extend(Color, {\n brighter: function(k) {\n return new Lab(this.l + Kn * (k == null ? 1 : k), this.a, this.b, this.opacity);\n },\n darker: function(k) {\n return new Lab(this.l - Kn * (k == null ? 1 : k), this.a, this.b, this.opacity);\n },\n rgb: function() {\n var y = (this.l + 16) / 116,\n x = isNaN(this.a) ? y : y + this.a / 500,\n z = isNaN(this.b) ? y : y - this.b / 200;\n y = Yn * lab2xyz(y);\n x = Xn * lab2xyz(x);\n z = Zn * lab2xyz(z);\n return new Rgb(\n xyz2rgb( 3.2404542 * x - 1.5371385 * y - 0.4985314 * z), // D65 -> sRGB\n xyz2rgb(-0.9692660 * x + 1.8760108 * y + 0.0415560 * z),\n xyz2rgb( 0.0556434 * x - 0.2040259 * y + 1.0572252 * z),\n this.opacity\n );\n }\n}));\n\nfunction xyz2lab(t) {\n return t > t3 ? Math.pow(t, 1 / 3) : t / t2 + t0;\n}\n\nfunction lab2xyz(t) {\n return t > t1 ? t * t * t : t2 * (t - t0);\n}\n\nfunction xyz2rgb(x) {\n return 255 * (x <= 0.0031308 ? 12.92 * x : 1.055 * Math.pow(x, 1 / 2.4) - 0.055);\n}\n\nfunction rgb2xyz(x) {\n return (x /= 255) <= 0.04045 ? x / 12.92 : Math.pow((x + 0.055) / 1.055, 2.4);\n}\n\nfunction hclConvert(o) {\n if (o instanceof Hcl) return new Hcl(o.h, o.c, o.l, o.opacity);\n if (!(o instanceof Lab)) o = labConvert(o);\n var h = Math.atan2(o.b, o.a) * rad2deg;\n return new Hcl(h < 0 ? h + 360 : h, Math.sqrt(o.a * o.a + o.b * o.b), o.l, o.opacity);\n}\n\nfunction hcl(h, c, l, opacity) {\n return arguments.length === 1 ? hclConvert(h) : new Hcl(h, c, l, opacity == null ? 1 : opacity);\n}\n\nfunction Hcl(h, c, l, opacity) {\n this.h = +h;\n this.c = +c;\n this.l = +l;\n this.opacity = +opacity;\n}\n\ndefine(Hcl, hcl, extend(Color, {\n brighter: function(k) {\n return new Hcl(this.h, this.c, this.l + Kn * (k == null ? 1 : k), this.opacity);\n },\n darker: function(k) {\n return new Hcl(this.h, this.c, this.l - Kn * (k == null ? 1 : k), this.opacity);\n },\n rgb: function() {\n return labConvert(this).rgb();\n }\n}));\n\nvar A = -0.14861;\nvar B = +1.78277;\nvar C = -0.29227;\nvar D = -0.90649;\nvar E = +1.97294;\nvar ED = E * D;\nvar EB = E * B;\nvar BC_DA = B * C - D * A;\n\nfunction cubehelixConvert(o) {\n if (o instanceof Cubehelix) return new Cubehelix(o.h, o.s, o.l, o.opacity);\n if (!(o instanceof Rgb)) o = rgbConvert(o);\n var r = o.r / 255,\n g = o.g / 255,\n b = o.b / 255,\n l = (BC_DA * b + ED * r - EB * g) / (BC_DA + ED - EB),\n bl = b - l,\n k = (E * (g - l) - C * bl) / D,\n s = Math.sqrt(k * k + bl * bl) / (E * l * (1 - l)), // NaN if l=0 or l=1\n h = s ? Math.atan2(k, bl) * rad2deg - 120 : NaN;\n return new Cubehelix(h < 0 ? h + 360 : h, s, l, o.opacity);\n}\n\nfunction cubehelix(h, s, l, opacity) {\n return arguments.length === 1 ? cubehelixConvert(h) : new Cubehelix(h, s, l, opacity == null ? 1 : opacity);\n}\n\nfunction Cubehelix(h, s, l, opacity) {\n this.h = +h;\n this.s = +s;\n this.l = +l;\n this.opacity = +opacity;\n}\n\ndefine(Cubehelix, cubehelix, extend(Color, {\n brighter: function(k) {\n k = k == null ? brighter : Math.pow(brighter, k);\n return new Cubehelix(this.h, this.s, this.l * k, this.opacity);\n },\n darker: function(k) {\n k = k == null ? darker : Math.pow(darker, k);\n return new Cubehelix(this.h, this.s, this.l * k, this.opacity);\n },\n rgb: function() {\n var h = isNaN(this.h) ? 0 : (this.h + 120) * deg2rad,\n l = +this.l,\n a = isNaN(this.s) ? 0 : this.s * l * (1 - l),\n cosh = Math.cos(h),\n sinh = Math.sin(h);\n return new Rgb(\n 255 * (l + a * (A * cosh + B * sinh)),\n 255 * (l + a * (C * cosh + D * sinh)),\n 255 * (l + a * (E * cosh)),\n this.opacity\n );\n }\n}));\n\nfunction basis(t1, v0, v1, v2, v3) {\n var t2 = t1 * t1, t3 = t2 * t1;\n return ((1 - 3 * t1 + 3 * t2 - t3) * v0\n + (4 - 6 * t2 + 3 * t3) * v1\n + (1 + 3 * t1 + 3 * t2 - 3 * t3) * v2\n + t3 * v3) / 6;\n}\n\nvar basis$1 = function(values) {\n var n = values.length - 1;\n return function(t) {\n var i = t <= 0 ? (t = 0) : t >= 1 ? (t = 1, n - 1) : Math.floor(t * n),\n v1 = values[i],\n v2 = values[i + 1],\n v0 = i > 0 ? values[i - 1] : 2 * v1 - v2,\n v3 = i < n - 1 ? values[i + 2] : 2 * v2 - v1;\n return basis((t - i / n) * n, v0, v1, v2, v3);\n };\n};\n\nvar basisClosed = function(values) {\n var n = values.length;\n return function(t) {\n var i = Math.floor(((t %= 1) < 0 ? ++t : t) * n),\n v0 = values[(i + n - 1) % n],\n v1 = values[i % n],\n v2 = values[(i + 1) % n],\n v3 = values[(i + 2) % n];\n return basis((t - i / n) * n, v0, v1, v2, v3);\n };\n};\n\nvar constant$3 = function(x) {\n return function() {\n return x;\n };\n};\n\nfunction linear(a, d) {\n return function(t) {\n return a + t * d;\n };\n}\n\nfunction exponential(a, b, y) {\n return a = Math.pow(a, y), b = Math.pow(b, y) - a, y = 1 / y, function(t) {\n return Math.pow(a + t * b, y);\n };\n}\n\nfunction hue(a, b) {\n var d = b - a;\n return d ? linear(a, d > 180 || d < -180 ? d - 360 * Math.round(d / 360) : d) : constant$3(isNaN(a) ? b : a);\n}\n\nfunction gamma(y) {\n return (y = +y) === 1 ? nogamma : function(a, b) {\n return b - a ? exponential(a, b, y) : constant$3(isNaN(a) ? b : a);\n };\n}\n\nfunction nogamma(a, b) {\n var d = b - a;\n return d ? linear(a, d) : constant$3(isNaN(a) ? b : a);\n}\n\nvar interpolateRgb = (function rgbGamma(y) {\n var color$$1 = gamma(y);\n\n function rgb$$1(start, end) {\n var r = color$$1((start = rgb(start)).r, (end = rgb(end)).r),\n g = color$$1(start.g, end.g),\n b = color$$1(start.b, end.b),\n opacity = nogamma(start.opacity, end.opacity);\n return function(t) {\n start.r = r(t);\n start.g = g(t);\n start.b = b(t);\n start.opacity = opacity(t);\n return start + \"\";\n };\n }\n\n rgb$$1.gamma = rgbGamma;\n\n return rgb$$1;\n})(1);\n\nfunction rgbSpline(spline) {\n return function(colors) {\n var n = colors.length,\n r = new Array(n),\n g = new Array(n),\n b = new Array(n),\n i, color$$1;\n for (i = 0; i < n; ++i) {\n color$$1 = rgb(colors[i]);\n r[i] = color$$1.r || 0;\n g[i] = color$$1.g || 0;\n b[i] = color$$1.b || 0;\n }\n r = spline(r);\n g = spline(g);\n b = spline(b);\n color$$1.opacity = 1;\n return function(t) {\n color$$1.r = r(t);\n color$$1.g = g(t);\n color$$1.b = b(t);\n return color$$1 + \"\";\n };\n };\n}\n\nvar rgbBasis = rgbSpline(basis$1);\nvar rgbBasisClosed = rgbSpline(basisClosed);\n\nvar array$1 = function(a, b) {\n var nb = b ? b.length : 0,\n na = a ? Math.min(nb, a.length) : 0,\n x = new Array(nb),\n c = new Array(nb),\n i;\n\n for (i = 0; i < na; ++i) x[i] = interpolateValue(a[i], b[i]);\n for (; i < nb; ++i) c[i] = b[i];\n\n return function(t) {\n for (i = 0; i < na; ++i) c[i] = x[i](t);\n return c;\n };\n};\n\nvar date = function(a, b) {\n var d = new Date;\n return a = +a, b -= a, function(t) {\n return d.setTime(a + b * t), d;\n };\n};\n\nvar reinterpolate = function(a, b) {\n return a = +a, b -= a, function(t) {\n return a + b * t;\n };\n};\n\nvar object = function(a, b) {\n var i = {},\n c = {},\n k;\n\n if (a === null || typeof a !== \"object\") a = {};\n if (b === null || typeof b !== \"object\") b = {};\n\n for (k in b) {\n if (k in a) {\n i[k] = interpolateValue(a[k], b[k]);\n } else {\n c[k] = b[k];\n }\n }\n\n return function(t) {\n for (k in i) c[k] = i[k](t);\n return c;\n };\n};\n\nvar reA = /[-+]?(?:\\d+\\.?\\d*|\\.?\\d+)(?:[eE][-+]?\\d+)?/g;\nvar reB = new RegExp(reA.source, \"g\");\n\nfunction zero(b) {\n return function() {\n return b;\n };\n}\n\nfunction one(b) {\n return function(t) {\n return b(t) + \"\";\n };\n}\n\nvar interpolateString = function(a, b) {\n var bi = reA.lastIndex = reB.lastIndex = 0, // scan index for next number in b\n am, // current match in a\n bm, // current match in b\n bs, // string preceding current number in b, if any\n i = -1, // index in s\n s = [], // string constants and placeholders\n q = []; // number interpolators\n\n // Coerce inputs to strings.\n a = a + \"\", b = b + \"\";\n\n // Interpolate pairs of numbers in a & b.\n while ((am = reA.exec(a))\n && (bm = reB.exec(b))) {\n if ((bs = bm.index) > bi) { // a string precedes the next number in b\n bs = b.slice(bi, bs);\n if (s[i]) s[i] += bs; // coalesce with previous string\n else s[++i] = bs;\n }\n if ((am = am[0]) === (bm = bm[0])) { // numbers in a & b match\n if (s[i]) s[i] += bm; // coalesce with previous string\n else s[++i] = bm;\n } else { // interpolate non-matching numbers\n s[++i] = null;\n q.push({i: i, x: reinterpolate(am, bm)});\n }\n bi = reB.lastIndex;\n }\n\n // Add remains of b.\n if (bi < b.length) {\n bs = b.slice(bi);\n if (s[i]) s[i] += bs; // coalesce with previous string\n else s[++i] = bs;\n }\n\n // Special optimization for only a single match.\n // Otherwise, interpolate each of the numbers and rejoin the string.\n return s.length < 2 ? (q[0]\n ? one(q[0].x)\n : zero(b))\n : (b = q.length, function(t) {\n for (var i = 0, o; i < b; ++i) s[(o = q[i]).i] = o.x(t);\n return s.join(\"\");\n });\n};\n\nvar interpolateValue = function(a, b) {\n var t = typeof b, c;\n return b == null || t === \"boolean\" ? constant$3(b)\n : (t === \"number\" ? reinterpolate\n : t === \"string\" ? ((c = color(b)) ? (b = c, interpolateRgb) : interpolateString)\n : b instanceof color ? interpolateRgb\n : b instanceof Date ? date\n : Array.isArray(b) ? array$1\n : typeof b.valueOf !== \"function\" && typeof b.toString !== \"function\" || isNaN(b) ? object\n : reinterpolate)(a, b);\n};\n\nvar interpolateRound = function(a, b) {\n return a = +a, b -= a, function(t) {\n return Math.round(a + b * t);\n };\n};\n\nvar degrees = 180 / Math.PI;\n\nvar identity$2 = {\n translateX: 0,\n translateY: 0,\n rotate: 0,\n skewX: 0,\n scaleX: 1,\n scaleY: 1\n};\n\nvar decompose = function(a, b, c, d, e, f) {\n var scaleX, scaleY, skewX;\n if (scaleX = Math.sqrt(a * a + b * b)) a /= scaleX, b /= scaleX;\n if (skewX = a * c + b * d) c -= a * skewX, d -= b * skewX;\n if (scaleY = Math.sqrt(c * c + d * d)) c /= scaleY, d /= scaleY, skewX /= scaleY;\n if (a * d < b * c) a = -a, b = -b, skewX = -skewX, scaleX = -scaleX;\n return {\n translateX: e,\n translateY: f,\n rotate: Math.atan2(b, a) * degrees,\n skewX: Math.atan(skewX) * degrees,\n scaleX: scaleX,\n scaleY: scaleY\n };\n};\n\nvar cssNode;\nvar cssRoot;\nvar cssView;\nvar svgNode;\n\nfunction parseCss(value) {\n if (value === \"none\") return identity$2;\n if (!cssNode) cssNode = document.createElement(\"DIV\"), cssRoot = document.documentElement, cssView = document.defaultView;\n cssNode.style.transform = value;\n value = cssView.getComputedStyle(cssRoot.appendChild(cssNode), null).getPropertyValue(\"transform\");\n cssRoot.removeChild(cssNode);\n value = value.slice(7, -1).split(\",\");\n return decompose(+value[0], +value[1], +value[2], +value[3], +value[4], +value[5]);\n}\n\nfunction parseSvg(value) {\n if (value == null) return identity$2;\n if (!svgNode) svgNode = document.createElementNS(\"http://www.w3.org/2000/svg\", \"g\");\n svgNode.setAttribute(\"transform\", value);\n if (!(value = svgNode.transform.baseVal.consolidate())) return identity$2;\n value = value.matrix;\n return decompose(value.a, value.b, value.c, value.d, value.e, value.f);\n}\n\nfunction interpolateTransform(parse, pxComma, pxParen, degParen) {\n\n function pop(s) {\n return s.length ? s.pop() + \" \" : \"\";\n }\n\n function translate(xa, ya, xb, yb, s, q) {\n if (xa !== xb || ya !== yb) {\n var i = s.push(\"translate(\", null, pxComma, null, pxParen);\n q.push({i: i - 4, x: reinterpolate(xa, xb)}, {i: i - 2, x: reinterpolate(ya, yb)});\n } else if (xb || yb) {\n s.push(\"translate(\" + xb + pxComma + yb + pxParen);\n }\n }\n\n function rotate(a, b, s, q) {\n if (a !== b) {\n if (a - b > 180) b += 360; else if (b - a > 180) a += 360; // shortest path\n q.push({i: s.push(pop(s) + \"rotate(\", null, degParen) - 2, x: reinterpolate(a, b)});\n } else if (b) {\n s.push(pop(s) + \"rotate(\" + b + degParen);\n }\n }\n\n function skewX(a, b, s, q) {\n if (a !== b) {\n q.push({i: s.push(pop(s) + \"skewX(\", null, degParen) - 2, x: reinterpolate(a, b)});\n } else if (b) {\n s.push(pop(s) + \"skewX(\" + b + degParen);\n }\n }\n\n function scale(xa, ya, xb, yb, s, q) {\n if (xa !== xb || ya !== yb) {\n var i = s.push(pop(s) + \"scale(\", null, \",\", null, \")\");\n q.push({i: i - 4, x: reinterpolate(xa, xb)}, {i: i - 2, x: reinterpolate(ya, yb)});\n } else if (xb !== 1 || yb !== 1) {\n s.push(pop(s) + \"scale(\" + xb + \",\" + yb + \")\");\n }\n }\n\n return function(a, b) {\n var s = [], // string constants and placeholders\n q = []; // number interpolators\n a = parse(a), b = parse(b);\n translate(a.translateX, a.translateY, b.translateX, b.translateY, s, q);\n rotate(a.rotate, b.rotate, s, q);\n skewX(a.skewX, b.skewX, s, q);\n scale(a.scaleX, a.scaleY, b.scaleX, b.scaleY, s, q);\n a = b = null; // gc\n return function(t) {\n var i = -1, n = q.length, o;\n while (++i < n) s[(o = q[i]).i] = o.x(t);\n return s.join(\"\");\n };\n };\n}\n\nvar interpolateTransformCss = interpolateTransform(parseCss, \"px, \", \"px)\", \"deg)\");\nvar interpolateTransformSvg = interpolateTransform(parseSvg, \", \", \")\", \")\");\n\nvar rho = Math.SQRT2;\nvar rho2 = 2;\nvar rho4 = 4;\nvar epsilon2 = 1e-12;\n\nfunction cosh(x) {\n return ((x = Math.exp(x)) + 1 / x) / 2;\n}\n\nfunction sinh(x) {\n return ((x = Math.exp(x)) - 1 / x) / 2;\n}\n\nfunction tanh(x) {\n return ((x = Math.exp(2 * x)) - 1) / (x + 1);\n}\n\n// p0 = [ux0, uy0, w0]\n// p1 = [ux1, uy1, w1]\nvar interpolateZoom = function(p0, p1) {\n var ux0 = p0[0], uy0 = p0[1], w0 = p0[2],\n ux1 = p1[0], uy1 = p1[1], w1 = p1[2],\n dx = ux1 - ux0,\n dy = uy1 - uy0,\n d2 = dx * dx + dy * dy,\n i,\n S;\n\n // Special case for u0 ≅ u1.\n if (d2 < epsilon2) {\n S = Math.log(w1 / w0) / rho;\n i = function(t) {\n return [\n ux0 + t * dx,\n uy0 + t * dy,\n w0 * Math.exp(rho * t * S)\n ];\n };\n }\n\n // General case.\n else {\n var d1 = Math.sqrt(d2),\n b0 = (w1 * w1 - w0 * w0 + rho4 * d2) / (2 * w0 * rho2 * d1),\n b1 = (w1 * w1 - w0 * w0 - rho4 * d2) / (2 * w1 * rho2 * d1),\n r0 = Math.log(Math.sqrt(b0 * b0 + 1) - b0),\n r1 = Math.log(Math.sqrt(b1 * b1 + 1) - b1);\n S = (r1 - r0) / rho;\n i = function(t) {\n var s = t * S,\n coshr0 = cosh(r0),\n u = w0 / (rho2 * d1) * (coshr0 * tanh(rho * s + r0) - sinh(r0));\n return [\n ux0 + u * dx,\n uy0 + u * dy,\n w0 * coshr0 / cosh(rho * s + r0)\n ];\n };\n }\n\n i.duration = S * 1000;\n\n return i;\n};\n\nfunction hsl$1(hue$$1) {\n return function(start, end) {\n var h = hue$$1((start = hsl(start)).h, (end = hsl(end)).h),\n s = nogamma(start.s, end.s),\n l = nogamma(start.l, end.l),\n opacity = nogamma(start.opacity, end.opacity);\n return function(t) {\n start.h = h(t);\n start.s = s(t);\n start.l = l(t);\n start.opacity = opacity(t);\n return start + \"\";\n };\n }\n}\n\nvar hsl$2 = hsl$1(hue);\nvar hslLong = hsl$1(nogamma);\n\nfunction lab$1(start, end) {\n var l = nogamma((start = lab(start)).l, (end = lab(end)).l),\n a = nogamma(start.a, end.a),\n b = nogamma(start.b, end.b),\n opacity = nogamma(start.opacity, end.opacity);\n return function(t) {\n start.l = l(t);\n start.a = a(t);\n start.b = b(t);\n start.opacity = opacity(t);\n return start + \"\";\n };\n}\n\nfunction hcl$1(hue$$1) {\n return function(start, end) {\n var h = hue$$1((start = hcl(start)).h, (end = hcl(end)).h),\n c = nogamma(start.c, end.c),\n l = nogamma(start.l, end.l),\n opacity = nogamma(start.opacity, end.opacity);\n return function(t) {\n start.h = h(t);\n start.c = c(t);\n start.l = l(t);\n start.opacity = opacity(t);\n return start + \"\";\n };\n }\n}\n\nvar hcl$2 = hcl$1(hue);\nvar hclLong = hcl$1(nogamma);\n\nfunction cubehelix$1(hue$$1) {\n return (function cubehelixGamma(y) {\n y = +y;\n\n function cubehelix$$1(start, end) {\n var h = hue$$1((start = cubehelix(start)).h, (end = cubehelix(end)).h),\n s = nogamma(start.s, end.s),\n l = nogamma(start.l, end.l),\n opacity = nogamma(start.opacity, end.opacity);\n return function(t) {\n start.h = h(t);\n start.s = s(t);\n start.l = l(Math.pow(t, y));\n start.opacity = opacity(t);\n return start + \"\";\n };\n }\n\n cubehelix$$1.gamma = cubehelixGamma;\n\n return cubehelix$$1;\n })(1);\n}\n\nvar cubehelix$2 = cubehelix$1(hue);\nvar cubehelixLong = cubehelix$1(nogamma);\n\nvar quantize = function(interpolator, n) {\n var samples = new Array(n);\n for (var i = 0; i < n; ++i) samples[i] = interpolator(i / (n - 1));\n return samples;\n};\n\nvar frame = 0;\nvar timeout = 0;\nvar interval = 0;\nvar pokeDelay = 1000;\nvar taskHead;\nvar taskTail;\nvar clockLast = 0;\nvar clockNow = 0;\nvar clockSkew = 0;\nvar clock = typeof performance === \"object\" && performance.now ? performance : Date;\nvar setFrame = typeof window === \"object\" && window.requestAnimationFrame ? window.requestAnimationFrame.bind(window) : function(f) { setTimeout(f, 17); };\n\nfunction now() {\n return clockNow || (setFrame(clearNow), clockNow = clock.now() + clockSkew);\n}\n\nfunction clearNow() {\n clockNow = 0;\n}\n\nfunction Timer() {\n this._call =\n this._time =\n this._next = null;\n}\n\nTimer.prototype = timer.prototype = {\n constructor: Timer,\n restart: function(callback, delay, time) {\n if (typeof callback !== \"function\") throw new TypeError(\"callback is not a function\");\n time = (time == null ? now() : +time) + (delay == null ? 0 : +delay);\n if (!this._next && taskTail !== this) {\n if (taskTail) taskTail._next = this;\n else taskHead = this;\n taskTail = this;\n }\n this._call = callback;\n this._time = time;\n sleep();\n },\n stop: function() {\n if (this._call) {\n this._call = null;\n this._time = Infinity;\n sleep();\n }\n }\n};\n\nfunction timer(callback, delay, time) {\n var t = new Timer;\n t.restart(callback, delay, time);\n return t;\n}\n\nfunction timerFlush() {\n now(); // Get the current time, if not already set.\n ++frame; // Pretend we’ve set an alarm, if we haven’t already.\n var t = taskHead, e;\n while (t) {\n if ((e = clockNow - t._time) >= 0) t._call.call(null, e);\n t = t._next;\n }\n --frame;\n}\n\nfunction wake() {\n clockNow = (clockLast = clock.now()) + clockSkew;\n frame = timeout = 0;\n try {\n timerFlush();\n } finally {\n frame = 0;\n nap();\n clockNow = 0;\n }\n}\n\nfunction poke() {\n var now = clock.now(), delay = now - clockLast;\n if (delay > pokeDelay) clockSkew -= delay, clockLast = now;\n}\n\nfunction nap() {\n var t0, t1 = taskHead, t2, time = Infinity;\n while (t1) {\n if (t1._call) {\n if (time > t1._time) time = t1._time;\n t0 = t1, t1 = t1._next;\n } else {\n t2 = t1._next, t1._next = null;\n t1 = t0 ? t0._next = t2 : taskHead = t2;\n }\n }\n taskTail = t0;\n sleep(time);\n}\n\nfunction sleep(time) {\n if (frame) return; // Soonest alarm already set, or will be.\n if (timeout) timeout = clearTimeout(timeout);\n var delay = time - clockNow; // Strictly less than if we recomputed clockNow.\n if (delay > 24) {\n if (time < Infinity) timeout = setTimeout(wake, time - clock.now() - clockSkew);\n if (interval) interval = clearInterval(interval);\n } else {\n if (!interval) clockLast = clock.now(), interval = setInterval(poke, pokeDelay);\n frame = 1, setFrame(wake);\n }\n}\n\nvar timeout$1 = function(callback, delay, time) {\n var t = new Timer;\n delay = delay == null ? 0 : +delay;\n t.restart(function(elapsed) {\n t.stop();\n callback(elapsed + delay);\n }, delay, time);\n return t;\n};\n\nvar interval$1 = function(callback, delay, time) {\n var t = new Timer, total = delay;\n if (delay == null) return t.restart(callback, delay, time), t;\n delay = +delay, time = time == null ? now() : +time;\n t.restart(function tick(elapsed) {\n elapsed += total;\n t.restart(tick, total += delay, time);\n callback(elapsed);\n }, delay, time);\n return t;\n};\n\nvar emptyOn = dispatch(\"start\", \"end\", \"interrupt\");\nvar emptyTween = [];\n\nvar CREATED = 0;\nvar SCHEDULED = 1;\nvar STARTING = 2;\nvar STARTED = 3;\nvar RUNNING = 4;\nvar ENDING = 5;\nvar ENDED = 6;\n\nvar schedule = function(node, name, id, index, group, timing) {\n var schedules = node.__transition;\n if (!schedules) node.__transition = {};\n else if (id in schedules) return;\n create(node, id, {\n name: name,\n index: index, // For context during callback.\n group: group, // For context during callback.\n on: emptyOn,\n tween: emptyTween,\n time: timing.time,\n delay: timing.delay,\n duration: timing.duration,\n ease: timing.ease,\n timer: null,\n state: CREATED\n });\n};\n\nfunction init(node, id) {\n var schedule = node.__transition;\n if (!schedule || !(schedule = schedule[id]) || schedule.state > CREATED) throw new Error(\"too late\");\n return schedule;\n}\n\nfunction set$1(node, id) {\n var schedule = node.__transition;\n if (!schedule || !(schedule = schedule[id]) || schedule.state > STARTING) throw new Error(\"too late\");\n return schedule;\n}\n\nfunction get$1(node, id) {\n var schedule = node.__transition;\n if (!schedule || !(schedule = schedule[id])) throw new Error(\"too late\");\n return schedule;\n}\n\nfunction create(node, id, self) {\n var schedules = node.__transition,\n tween;\n\n // Initialize the self timer when the transition is created.\n // Note the actual delay is not known until the first callback!\n schedules[id] = self;\n self.timer = timer(schedule, 0, self.time);\n\n function schedule(elapsed) {\n self.state = SCHEDULED;\n self.timer.restart(start, self.delay, self.time);\n\n // If the elapsed delay is less than our first sleep, start immediately.\n if (self.delay <= elapsed) start(elapsed - self.delay);\n }\n\n function start(elapsed) {\n var i, j, n, o;\n\n // If the state is not SCHEDULED, then we previously errored on start.\n if (self.state !== SCHEDULED) return stop();\n\n for (i in schedules) {\n o = schedules[i];\n if (o.name !== self.name) continue;\n\n // While this element already has a starting transition during this frame,\n // defer starting an interrupting transition until that transition has a\n // chance to tick (and possibly end); see d3/d3-transition#54!\n if (o.state === STARTED) return timeout$1(start);\n\n // Interrupt the active transition, if any.\n // Dispatch the interrupt event.\n if (o.state === RUNNING) {\n o.state = ENDED;\n o.timer.stop();\n o.on.call(\"interrupt\", node, node.__data__, o.index, o.group);\n delete schedules[i];\n }\n\n // Cancel any pre-empted transitions. No interrupt event is dispatched\n // because the cancelled transitions never started. Note that this also\n // removes this transition from the pending list!\n else if (+i < id) {\n o.state = ENDED;\n o.timer.stop();\n delete schedules[i];\n }\n }\n\n // Defer the first tick to end of the current frame; see d3/d3#1576.\n // Note the transition may be canceled after start and before the first tick!\n // Note this must be scheduled before the start event; see d3/d3-transition#16!\n // Assuming this is successful, subsequent callbacks go straight to tick.\n timeout$1(function() {\n if (self.state === STARTED) {\n self.state = RUNNING;\n self.timer.restart(tick, self.delay, self.time);\n tick(elapsed);\n }\n });\n\n // Dispatch the start event.\n // Note this must be done before the tween are initialized.\n self.state = STARTING;\n self.on.call(\"start\", node, node.__data__, self.index, self.group);\n if (self.state !== STARTING) return; // interrupted\n self.state = STARTED;\n\n // Initialize the tween, deleting null tween.\n tween = new Array(n = self.tween.length);\n for (i = 0, j = -1; i < n; ++i) {\n if (o = self.tween[i].value.call(node, node.__data__, self.index, self.group)) {\n tween[++j] = o;\n }\n }\n tween.length = j + 1;\n }\n\n function tick(elapsed) {\n var t = elapsed < self.duration ? self.ease.call(null, elapsed / self.duration) : (self.timer.restart(stop), self.state = ENDING, 1),\n i = -1,\n n = tween.length;\n\n while (++i < n) {\n tween[i].call(null, t);\n }\n\n // Dispatch the end event.\n if (self.state === ENDING) {\n self.on.call(\"end\", node, node.__data__, self.index, self.group);\n stop();\n }\n }\n\n function stop() {\n self.state = ENDED;\n self.timer.stop();\n delete schedules[id];\n for (var i in schedules) return; // eslint-disable-line no-unused-vars\n delete node.__transition;\n }\n}\n\nvar interrupt = function(node, name) {\n var schedules = node.__transition,\n schedule$$1,\n active,\n empty = true,\n i;\n\n if (!schedules) return;\n\n name = name == null ? null : name + \"\";\n\n for (i in schedules) {\n if ((schedule$$1 = schedules[i]).name !== name) { empty = false; continue; }\n active = schedule$$1.state > STARTING && schedule$$1.state < ENDING;\n schedule$$1.state = ENDED;\n schedule$$1.timer.stop();\n if (active) schedule$$1.on.call(\"interrupt\", node, node.__data__, schedule$$1.index, schedule$$1.group);\n delete schedules[i];\n }\n\n if (empty) delete node.__transition;\n};\n\nvar selection_interrupt = function(name) {\n return this.each(function() {\n interrupt(this, name);\n });\n};\n\nfunction tweenRemove(id, name) {\n var tween0, tween1;\n return function() {\n var schedule$$1 = set$1(this, id),\n tween = schedule$$1.tween;\n\n // If this node shared tween with the previous node,\n // just assign the updated shared tween and we’re done!\n // Otherwise, copy-on-write.\n if (tween !== tween0) {\n tween1 = tween0 = tween;\n for (var i = 0, n = tween1.length; i < n; ++i) {\n if (tween1[i].name === name) {\n tween1 = tween1.slice();\n tween1.splice(i, 1);\n break;\n }\n }\n }\n\n schedule$$1.tween = tween1;\n };\n}\n\nfunction tweenFunction(id, name, value) {\n var tween0, tween1;\n if (typeof value !== \"function\") throw new Error;\n return function() {\n var schedule$$1 = set$1(this, id),\n tween = schedule$$1.tween;\n\n // If this node shared tween with the previous node,\n // just assign the updated shared tween and we’re done!\n // Otherwise, copy-on-write.\n if (tween !== tween0) {\n tween1 = (tween0 = tween).slice();\n for (var t = {name: name, value: value}, i = 0, n = tween1.length; i < n; ++i) {\n if (tween1[i].name === name) {\n tween1[i] = t;\n break;\n }\n }\n if (i === n) tween1.push(t);\n }\n\n schedule$$1.tween = tween1;\n };\n}\n\nvar transition_tween = function(name, value) {\n var id = this._id;\n\n name += \"\";\n\n if (arguments.length < 2) {\n var tween = get$1(this.node(), id).tween;\n for (var i = 0, n = tween.length, t; i < n; ++i) {\n if ((t = tween[i]).name === name) {\n return t.value;\n }\n }\n return null;\n }\n\n return this.each((value == null ? tweenRemove : tweenFunction)(id, name, value));\n};\n\nfunction tweenValue(transition, name, value) {\n var id = transition._id;\n\n transition.each(function() {\n var schedule$$1 = set$1(this, id);\n (schedule$$1.value || (schedule$$1.value = {}))[name] = value.apply(this, arguments);\n });\n\n return function(node) {\n return get$1(node, id).value[name];\n };\n}\n\nvar interpolate = function(a, b) {\n var c;\n return (typeof b === \"number\" ? reinterpolate\n : b instanceof color ? interpolateRgb\n : (c = color(b)) ? (b = c, interpolateRgb)\n : interpolateString)(a, b);\n};\n\nfunction attrRemove$1(name) {\n return function() {\n this.removeAttribute(name);\n };\n}\n\nfunction attrRemoveNS$1(fullname) {\n return function() {\n this.removeAttributeNS(fullname.space, fullname.local);\n };\n}\n\nfunction attrConstant$1(name, interpolate$$1, value1) {\n var value00,\n interpolate0;\n return function() {\n var value0 = this.getAttribute(name);\n return value0 === value1 ? null\n : value0 === value00 ? interpolate0\n : interpolate0 = interpolate$$1(value00 = value0, value1);\n };\n}\n\nfunction attrConstantNS$1(fullname, interpolate$$1, value1) {\n var value00,\n interpolate0;\n return function() {\n var value0 = this.getAttributeNS(fullname.space, fullname.local);\n return value0 === value1 ? null\n : value0 === value00 ? interpolate0\n : interpolate0 = interpolate$$1(value00 = value0, value1);\n };\n}\n\nfunction attrFunction$1(name, interpolate$$1, value) {\n var value00,\n value10,\n interpolate0;\n return function() {\n var value0, value1 = value(this);\n if (value1 == null) return void this.removeAttribute(name);\n value0 = this.getAttribute(name);\n return value0 === value1 ? null\n : value0 === value00 && value1 === value10 ? interpolate0\n : interpolate0 = interpolate$$1(value00 = value0, value10 = value1);\n };\n}\n\nfunction attrFunctionNS$1(fullname, interpolate$$1, value) {\n var value00,\n value10,\n interpolate0;\n return function() {\n var value0, value1 = value(this);\n if (value1 == null) return void this.removeAttributeNS(fullname.space, fullname.local);\n value0 = this.getAttributeNS(fullname.space, fullname.local);\n return value0 === value1 ? null\n : value0 === value00 && value1 === value10 ? interpolate0\n : interpolate0 = interpolate$$1(value00 = value0, value10 = value1);\n };\n}\n\nvar transition_attr = function(name, value) {\n var fullname = namespace(name), i = fullname === \"transform\" ? interpolateTransformSvg : interpolate;\n return this.attrTween(name, typeof value === \"function\"\n ? (fullname.local ? attrFunctionNS$1 : attrFunction$1)(fullname, i, tweenValue(this, \"attr.\" + name, value))\n : value == null ? (fullname.local ? attrRemoveNS$1 : attrRemove$1)(fullname)\n : (fullname.local ? attrConstantNS$1 : attrConstant$1)(fullname, i, value + \"\"));\n};\n\nfunction attrTweenNS(fullname, value) {\n function tween() {\n var node = this, i = value.apply(node, arguments);\n return i && function(t) {\n node.setAttributeNS(fullname.space, fullname.local, i(t));\n };\n }\n tween._value = value;\n return tween;\n}\n\nfunction attrTween(name, value) {\n function tween() {\n var node = this, i = value.apply(node, arguments);\n return i && function(t) {\n node.setAttribute(name, i(t));\n };\n }\n tween._value = value;\n return tween;\n}\n\nvar transition_attrTween = function(name, value) {\n var key = \"attr.\" + name;\n if (arguments.length < 2) return (key = this.tween(key)) && key._value;\n if (value == null) return this.tween(key, null);\n if (typeof value !== \"function\") throw new Error;\n var fullname = namespace(name);\n return this.tween(key, (fullname.local ? attrTweenNS : attrTween)(fullname, value));\n};\n\nfunction delayFunction(id, value) {\n return function() {\n init(this, id).delay = +value.apply(this, arguments);\n };\n}\n\nfunction delayConstant(id, value) {\n return value = +value, function() {\n init(this, id).delay = value;\n };\n}\n\nvar transition_delay = function(value) {\n var id = this._id;\n\n return arguments.length\n ? this.each((typeof value === \"function\"\n ? delayFunction\n : delayConstant)(id, value))\n : get$1(this.node(), id).delay;\n};\n\nfunction durationFunction(id, value) {\n return function() {\n set$1(this, id).duration = +value.apply(this, arguments);\n };\n}\n\nfunction durationConstant(id, value) {\n return value = +value, function() {\n set$1(this, id).duration = value;\n };\n}\n\nvar transition_duration = function(value) {\n var id = this._id;\n\n return arguments.length\n ? this.each((typeof value === \"function\"\n ? durationFunction\n : durationConstant)(id, value))\n : get$1(this.node(), id).duration;\n};\n\nfunction easeConstant(id, value) {\n if (typeof value !== \"function\") throw new Error;\n return function() {\n set$1(this, id).ease = value;\n };\n}\n\nvar transition_ease = function(value) {\n var id = this._id;\n\n return arguments.length\n ? this.each(easeConstant(id, value))\n : get$1(this.node(), id).ease;\n};\n\nvar transition_filter = function(match) {\n if (typeof match !== \"function\") match = matcher$1(match);\n\n for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, subgroup = subgroups[j] = [], node, i = 0; i < n; ++i) {\n if ((node = group[i]) && match.call(node, node.__data__, i, group)) {\n subgroup.push(node);\n }\n }\n }\n\n return new Transition(subgroups, this._parents, this._name, this._id);\n};\n\nvar transition_merge = function(transition$$1) {\n if (transition$$1._id !== this._id) throw new Error;\n\n for (var groups0 = this._groups, groups1 = transition$$1._groups, m0 = groups0.length, m1 = groups1.length, m = Math.min(m0, m1), merges = new Array(m0), j = 0; j < m; ++j) {\n for (var group0 = groups0[j], group1 = groups1[j], n = group0.length, merge = merges[j] = new Array(n), node, i = 0; i < n; ++i) {\n if (node = group0[i] || group1[i]) {\n merge[i] = node;\n }\n }\n }\n\n for (; j < m0; ++j) {\n merges[j] = groups0[j];\n }\n\n return new Transition(merges, this._parents, this._name, this._id);\n};\n\nfunction start(name) {\n return (name + \"\").trim().split(/^|\\s+/).every(function(t) {\n var i = t.indexOf(\".\");\n if (i >= 0) t = t.slice(0, i);\n return !t || t === \"start\";\n });\n}\n\nfunction onFunction(id, name, listener) {\n var on0, on1, sit = start(name) ? init : set$1;\n return function() {\n var schedule$$1 = sit(this, id),\n on = schedule$$1.on;\n\n // If this node shared a dispatch with the previous node,\n // just assign the updated shared dispatch and we’re done!\n // Otherwise, copy-on-write.\n if (on !== on0) (on1 = (on0 = on).copy()).on(name, listener);\n\n schedule$$1.on = on1;\n };\n}\n\nvar transition_on = function(name, listener) {\n var id = this._id;\n\n return arguments.length < 2\n ? get$1(this.node(), id).on.on(name)\n : this.each(onFunction(id, name, listener));\n};\n\nfunction removeFunction(id) {\n return function() {\n var parent = this.parentNode;\n for (var i in this.__transition) if (+i !== id) return;\n if (parent) parent.removeChild(this);\n };\n}\n\nvar transition_remove = function() {\n return this.on(\"end.remove\", removeFunction(this._id));\n};\n\nvar transition_select = function(select) {\n var name = this._name,\n id = this._id;\n\n if (typeof select !== \"function\") select = selector(select);\n\n for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, subgroup = subgroups[j] = new Array(n), node, subnode, i = 0; i < n; ++i) {\n if ((node = group[i]) && (subnode = select.call(node, node.__data__, i, group))) {\n if (\"__data__\" in node) subnode.__data__ = node.__data__;\n subgroup[i] = subnode;\n schedule(subgroup[i], name, id, i, subgroup, get$1(node, id));\n }\n }\n }\n\n return new Transition(subgroups, this._parents, name, id);\n};\n\nvar transition_selectAll = function(select) {\n var name = this._name,\n id = this._id;\n\n if (typeof select !== \"function\") select = selectorAll(select);\n\n for (var groups = this._groups, m = groups.length, subgroups = [], parents = [], j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) {\n if (node = group[i]) {\n for (var children = select.call(node, node.__data__, i, group), child, inherit = get$1(node, id), k = 0, l = children.length; k < l; ++k) {\n if (child = children[k]) {\n schedule(child, name, id, k, children, inherit);\n }\n }\n subgroups.push(children);\n parents.push(node);\n }\n }\n }\n\n return new Transition(subgroups, parents, name, id);\n};\n\nvar Selection$1 = selection.prototype.constructor;\n\nvar transition_selection = function() {\n return new Selection$1(this._groups, this._parents);\n};\n\nfunction styleRemove$1(name, interpolate$$1) {\n var value00,\n value10,\n interpolate0;\n return function() {\n var value0 = styleValue(this, name),\n value1 = (this.style.removeProperty(name), styleValue(this, name));\n return value0 === value1 ? null\n : value0 === value00 && value1 === value10 ? interpolate0\n : interpolate0 = interpolate$$1(value00 = value0, value10 = value1);\n };\n}\n\nfunction styleRemoveEnd(name) {\n return function() {\n this.style.removeProperty(name);\n };\n}\n\nfunction styleConstant$1(name, interpolate$$1, value1) {\n var value00,\n interpolate0;\n return function() {\n var value0 = styleValue(this, name);\n return value0 === value1 ? null\n : value0 === value00 ? interpolate0\n : interpolate0 = interpolate$$1(value00 = value0, value1);\n };\n}\n\nfunction styleFunction$1(name, interpolate$$1, value) {\n var value00,\n value10,\n interpolate0;\n return function() {\n var value0 = styleValue(this, name),\n value1 = value(this);\n if (value1 == null) value1 = (this.style.removeProperty(name), styleValue(this, name));\n return value0 === value1 ? null\n : value0 === value00 && value1 === value10 ? interpolate0\n : interpolate0 = interpolate$$1(value00 = value0, value10 = value1);\n };\n}\n\nvar transition_style = function(name, value, priority) {\n var i = (name += \"\") === \"transform\" ? interpolateTransformCss : interpolate;\n return value == null ? this\n .styleTween(name, styleRemove$1(name, i))\n .on(\"end.style.\" + name, styleRemoveEnd(name))\n : this.styleTween(name, typeof value === \"function\"\n ? styleFunction$1(name, i, tweenValue(this, \"style.\" + name, value))\n : styleConstant$1(name, i, value + \"\"), priority);\n};\n\nfunction styleTween(name, value, priority) {\n function tween() {\n var node = this, i = value.apply(node, arguments);\n return i && function(t) {\n node.style.setProperty(name, i(t), priority);\n };\n }\n tween._value = value;\n return tween;\n}\n\nvar transition_styleTween = function(name, value, priority) {\n var key = \"style.\" + (name += \"\");\n if (arguments.length < 2) return (key = this.tween(key)) && key._value;\n if (value == null) return this.tween(key, null);\n if (typeof value !== \"function\") throw new Error;\n return this.tween(key, styleTween(name, value, priority == null ? \"\" : priority));\n};\n\nfunction textConstant$1(value) {\n return function() {\n this.textContent = value;\n };\n}\n\nfunction textFunction$1(value) {\n return function() {\n var value1 = value(this);\n this.textContent = value1 == null ? \"\" : value1;\n };\n}\n\nvar transition_text = function(value) {\n return this.tween(\"text\", typeof value === \"function\"\n ? textFunction$1(tweenValue(this, \"text\", value))\n : textConstant$1(value == null ? \"\" : value + \"\"));\n};\n\nvar transition_transition = function() {\n var name = this._name,\n id0 = this._id,\n id1 = newId();\n\n for (var groups = this._groups, m = groups.length, j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) {\n if (node = group[i]) {\n var inherit = get$1(node, id0);\n schedule(node, name, id1, i, group, {\n time: inherit.time + inherit.delay + inherit.duration,\n delay: 0,\n duration: inherit.duration,\n ease: inherit.ease\n });\n }\n }\n }\n\n return new Transition(groups, this._parents, name, id1);\n};\n\nvar id = 0;\n\nfunction Transition(groups, parents, name, id) {\n this._groups = groups;\n this._parents = parents;\n this._name = name;\n this._id = id;\n}\n\nfunction transition(name) {\n return selection().transition(name);\n}\n\nfunction newId() {\n return ++id;\n}\n\nvar selection_prototype = selection.prototype;\n\nTransition.prototype = transition.prototype = {\n constructor: Transition,\n select: transition_select,\n selectAll: transition_selectAll,\n filter: transition_filter,\n merge: transition_merge,\n selection: transition_selection,\n transition: transition_transition,\n call: selection_prototype.call,\n nodes: selection_prototype.nodes,\n node: selection_prototype.node,\n size: selection_prototype.size,\n empty: selection_prototype.empty,\n each: selection_prototype.each,\n on: transition_on,\n attr: transition_attr,\n attrTween: transition_attrTween,\n style: transition_style,\n styleTween: transition_styleTween,\n text: transition_text,\n remove: transition_remove,\n tween: transition_tween,\n delay: transition_delay,\n duration: transition_duration,\n ease: transition_ease\n};\n\nfunction linear$1(t) {\n return +t;\n}\n\nfunction quadIn(t) {\n return t * t;\n}\n\nfunction quadOut(t) {\n return t * (2 - t);\n}\n\nfunction quadInOut(t) {\n return ((t *= 2) <= 1 ? t * t : --t * (2 - t) + 1) / 2;\n}\n\nfunction cubicIn(t) {\n return t * t * t;\n}\n\nfunction cubicOut(t) {\n return --t * t * t + 1;\n}\n\nfunction cubicInOut(t) {\n return ((t *= 2) <= 1 ? t * t * t : (t -= 2) * t * t + 2) / 2;\n}\n\nvar exponent = 3;\n\nvar polyIn = (function custom(e) {\n e = +e;\n\n function polyIn(t) {\n return Math.pow(t, e);\n }\n\n polyIn.exponent = custom;\n\n return polyIn;\n})(exponent);\n\nvar polyOut = (function custom(e) {\n e = +e;\n\n function polyOut(t) {\n return 1 - Math.pow(1 - t, e);\n }\n\n polyOut.exponent = custom;\n\n return polyOut;\n})(exponent);\n\nvar polyInOut = (function custom(e) {\n e = +e;\n\n function polyInOut(t) {\n return ((t *= 2) <= 1 ? Math.pow(t, e) : 2 - Math.pow(2 - t, e)) / 2;\n }\n\n polyInOut.exponent = custom;\n\n return polyInOut;\n})(exponent);\n\nvar pi = Math.PI;\nvar halfPi = pi / 2;\n\nfunction sinIn(t) {\n return 1 - Math.cos(t * halfPi);\n}\n\nfunction sinOut(t) {\n return Math.sin(t * halfPi);\n}\n\nfunction sinInOut(t) {\n return (1 - Math.cos(pi * t)) / 2;\n}\n\nfunction expIn(t) {\n return Math.pow(2, 10 * t - 10);\n}\n\nfunction expOut(t) {\n return 1 - Math.pow(2, -10 * t);\n}\n\nfunction expInOut(t) {\n return ((t *= 2) <= 1 ? Math.pow(2, 10 * t - 10) : 2 - Math.pow(2, 10 - 10 * t)) / 2;\n}\n\nfunction circleIn(t) {\n return 1 - Math.sqrt(1 - t * t);\n}\n\nfunction circleOut(t) {\n return Math.sqrt(1 - --t * t);\n}\n\nfunction circleInOut(t) {\n return ((t *= 2) <= 1 ? 1 - Math.sqrt(1 - t * t) : Math.sqrt(1 - (t -= 2) * t) + 1) / 2;\n}\n\nvar b1 = 4 / 11;\nvar b2 = 6 / 11;\nvar b3 = 8 / 11;\nvar b4 = 3 / 4;\nvar b5 = 9 / 11;\nvar b6 = 10 / 11;\nvar b7 = 15 / 16;\nvar b8 = 21 / 22;\nvar b9 = 63 / 64;\nvar b0 = 1 / b1 / b1;\n\nfunction bounceIn(t) {\n return 1 - bounceOut(1 - t);\n}\n\nfunction bounceOut(t) {\n return (t = +t) < b1 ? b0 * t * t : t < b3 ? b0 * (t -= b2) * t + b4 : t < b6 ? b0 * (t -= b5) * t + b7 : b0 * (t -= b8) * t + b9;\n}\n\nfunction bounceInOut(t) {\n return ((t *= 2) <= 1 ? 1 - bounceOut(1 - t) : bounceOut(t - 1) + 1) / 2;\n}\n\nvar overshoot = 1.70158;\n\nvar backIn = (function custom(s) {\n s = +s;\n\n function backIn(t) {\n return t * t * ((s + 1) * t - s);\n }\n\n backIn.overshoot = custom;\n\n return backIn;\n})(overshoot);\n\nvar backOut = (function custom(s) {\n s = +s;\n\n function backOut(t) {\n return --t * t * ((s + 1) * t + s) + 1;\n }\n\n backOut.overshoot = custom;\n\n return backOut;\n})(overshoot);\n\nvar backInOut = (function custom(s) {\n s = +s;\n\n function backInOut(t) {\n return ((t *= 2) < 1 ? t * t * ((s + 1) * t - s) : (t -= 2) * t * ((s + 1) * t + s) + 2) / 2;\n }\n\n backInOut.overshoot = custom;\n\n return backInOut;\n})(overshoot);\n\nvar tau = 2 * Math.PI;\nvar amplitude = 1;\nvar period = 0.3;\n\nvar elasticIn = (function custom(a, p) {\n var s = Math.asin(1 / (a = Math.max(1, a))) * (p /= tau);\n\n function elasticIn(t) {\n return a * Math.pow(2, 10 * --t) * Math.sin((s - t) / p);\n }\n\n elasticIn.amplitude = function(a) { return custom(a, p * tau); };\n elasticIn.period = function(p) { return custom(a, p); };\n\n return elasticIn;\n})(amplitude, period);\n\nvar elasticOut = (function custom(a, p) {\n var s = Math.asin(1 / (a = Math.max(1, a))) * (p /= tau);\n\n function elasticOut(t) {\n return 1 - a * Math.pow(2, -10 * (t = +t)) * Math.sin((t + s) / p);\n }\n\n elasticOut.amplitude = function(a) { return custom(a, p * tau); };\n elasticOut.period = function(p) { return custom(a, p); };\n\n return elasticOut;\n})(amplitude, period);\n\nvar elasticInOut = (function custom(a, p) {\n var s = Math.asin(1 / (a = Math.max(1, a))) * (p /= tau);\n\n function elasticInOut(t) {\n return ((t = t * 2 - 1) < 0\n ? a * Math.pow(2, 10 * t) * Math.sin((s - t) / p)\n : 2 - a * Math.pow(2, -10 * t) * Math.sin((s + t) / p)) / 2;\n }\n\n elasticInOut.amplitude = function(a) { return custom(a, p * tau); };\n elasticInOut.period = function(p) { return custom(a, p); };\n\n return elasticInOut;\n})(amplitude, period);\n\nvar defaultTiming = {\n time: null, // Set on use.\n delay: 0,\n duration: 250,\n ease: cubicInOut\n};\n\nfunction inherit(node, id) {\n var timing;\n while (!(timing = node.__transition) || !(timing = timing[id])) {\n if (!(node = node.parentNode)) {\n return defaultTiming.time = now(), defaultTiming;\n }\n }\n return timing;\n}\n\nvar selection_transition = function(name) {\n var id,\n timing;\n\n if (name instanceof Transition) {\n id = name._id, name = name._name;\n } else {\n id = newId(), (timing = defaultTiming).time = now(), name = name == null ? null : name + \"\";\n }\n\n for (var groups = this._groups, m = groups.length, j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) {\n if (node = group[i]) {\n schedule(node, name, id, i, group, timing || inherit(node, id));\n }\n }\n }\n\n return new Transition(groups, this._parents, name, id);\n};\n\nselection.prototype.interrupt = selection_interrupt;\nselection.prototype.transition = selection_transition;\n\nvar root$1 = [null];\n\nvar active = function(node, name) {\n var schedules = node.__transition,\n schedule$$1,\n i;\n\n if (schedules) {\n name = name == null ? null : name + \"\";\n for (i in schedules) {\n if ((schedule$$1 = schedules[i]).state > SCHEDULED && schedule$$1.name === name) {\n return new Transition([[node]], root$1, name, +i);\n }\n }\n }\n\n return null;\n};\n\nvar constant$4 = function(x) {\n return function() {\n return x;\n };\n};\n\nvar BrushEvent = function(target, type, selection) {\n this.target = target;\n this.type = type;\n this.selection = selection;\n};\n\nfunction nopropagation$1() {\n exports.event.stopImmediatePropagation();\n}\n\nvar noevent$1 = function() {\n exports.event.preventDefault();\n exports.event.stopImmediatePropagation();\n};\n\nvar MODE_DRAG = {name: \"drag\"};\nvar MODE_SPACE = {name: \"space\"};\nvar MODE_HANDLE = {name: \"handle\"};\nvar MODE_CENTER = {name: \"center\"};\n\nvar X = {\n name: \"x\",\n handles: [\"e\", \"w\"].map(type),\n input: function(x, e) { return x && [[x[0], e[0][1]], [x[1], e[1][1]]]; },\n output: function(xy) { return xy && [xy[0][0], xy[1][0]]; }\n};\n\nvar Y = {\n name: \"y\",\n handles: [\"n\", \"s\"].map(type),\n input: function(y, e) { return y && [[e[0][0], y[0]], [e[1][0], y[1]]]; },\n output: function(xy) { return xy && [xy[0][1], xy[1][1]]; }\n};\n\nvar XY = {\n name: \"xy\",\n handles: [\"n\", \"e\", \"s\", \"w\", \"nw\", \"ne\", \"se\", \"sw\"].map(type),\n input: function(xy) { return xy; },\n output: function(xy) { return xy; }\n};\n\nvar cursors = {\n overlay: \"crosshair\",\n selection: \"move\",\n n: \"ns-resize\",\n e: \"ew-resize\",\n s: \"ns-resize\",\n w: \"ew-resize\",\n nw: \"nwse-resize\",\n ne: \"nesw-resize\",\n se: \"nwse-resize\",\n sw: \"nesw-resize\"\n};\n\nvar flipX = {\n e: \"w\",\n w: \"e\",\n nw: \"ne\",\n ne: \"nw\",\n se: \"sw\",\n sw: \"se\"\n};\n\nvar flipY = {\n n: \"s\",\n s: \"n\",\n nw: \"sw\",\n ne: \"se\",\n se: \"ne\",\n sw: \"nw\"\n};\n\nvar signsX = {\n overlay: +1,\n selection: +1,\n n: null,\n e: +1,\n s: null,\n w: -1,\n nw: -1,\n ne: +1,\n se: +1,\n sw: -1\n};\n\nvar signsY = {\n overlay: +1,\n selection: +1,\n n: -1,\n e: null,\n s: +1,\n w: null,\n nw: -1,\n ne: -1,\n se: +1,\n sw: +1\n};\n\nfunction type(t) {\n return {type: t};\n}\n\n// Ignore right-click, since that should open the context menu.\nfunction defaultFilter() {\n return !exports.event.button;\n}\n\nfunction defaultExtent() {\n var svg = this.ownerSVGElement || this;\n return [[0, 0], [svg.width.baseVal.value, svg.height.baseVal.value]];\n}\n\n// Like d3.local, but with the name “__brush” rather than auto-generated.\nfunction local(node) {\n while (!node.__brush) if (!(node = node.parentNode)) return;\n return node.__brush;\n}\n\nfunction empty(extent) {\n return extent[0][0] === extent[1][0]\n || extent[0][1] === extent[1][1];\n}\n\nfunction brushSelection(node) {\n var state = node.__brush;\n return state ? state.dim.output(state.selection) : null;\n}\n\nfunction brushX() {\n return brush$1(X);\n}\n\nfunction brushY() {\n return brush$1(Y);\n}\n\nvar brush = function() {\n return brush$1(XY);\n};\n\nfunction brush$1(dim) {\n var extent = defaultExtent,\n filter = defaultFilter,\n listeners = dispatch(brush, \"start\", \"brush\", \"end\"),\n handleSize = 6,\n touchending;\n\n function brush(group) {\n var overlay = group\n .property(\"__brush\", initialize)\n .selectAll(\".overlay\")\n .data([type(\"overlay\")]);\n\n overlay.enter().append(\"rect\")\n .attr(\"class\", \"overlay\")\n .attr(\"pointer-events\", \"all\")\n .attr(\"cursor\", cursors.overlay)\n .merge(overlay)\n .each(function() {\n var extent = local(this).extent;\n select(this)\n .attr(\"x\", extent[0][0])\n .attr(\"y\", extent[0][1])\n .attr(\"width\", extent[1][0] - extent[0][0])\n .attr(\"height\", extent[1][1] - extent[0][1]);\n });\n\n group.selectAll(\".selection\")\n .data([type(\"selection\")])\n .enter().append(\"rect\")\n .attr(\"class\", \"selection\")\n .attr(\"cursor\", cursors.selection)\n .attr(\"fill\", \"#777\")\n .attr(\"fill-opacity\", 0.3)\n .attr(\"stroke\", \"#fff\")\n .attr(\"shape-rendering\", \"crispEdges\");\n\n var handle = group.selectAll(\".handle\")\n .data(dim.handles, function(d) { return d.type; });\n\n handle.exit().remove();\n\n handle.enter().append(\"rect\")\n .attr(\"class\", function(d) { return \"handle handle--\" + d.type; })\n .attr(\"cursor\", function(d) { return cursors[d.type]; });\n\n group\n .each(redraw)\n .attr(\"fill\", \"none\")\n .attr(\"pointer-events\", \"all\")\n .style(\"-webkit-tap-highlight-color\", \"rgba(0,0,0,0)\")\n .on(\"mousedown.brush touchstart.brush\", started);\n }\n\n brush.move = function(group, selection) {\n if (group.selection) {\n group\n .on(\"start.brush\", function() { emitter(this, arguments).beforestart().start(); })\n .on(\"interrupt.brush end.brush\", function() { emitter(this, arguments).end(); })\n .tween(\"brush\", function() {\n var that = this,\n state = that.__brush,\n emit = emitter(that, arguments),\n selection0 = state.selection,\n selection1 = dim.input(typeof selection === \"function\" ? selection.apply(this, arguments) : selection, state.extent),\n i = interpolateValue(selection0, selection1);\n\n function tween(t) {\n state.selection = t === 1 && empty(selection1) ? null : i(t);\n redraw.call(that);\n emit.brush();\n }\n\n return selection0 && selection1 ? tween : tween(1);\n });\n } else {\n group\n .each(function() {\n var that = this,\n args = arguments,\n state = that.__brush,\n selection1 = dim.input(typeof selection === \"function\" ? selection.apply(that, args) : selection, state.extent),\n emit = emitter(that, args).beforestart();\n\n interrupt(that);\n state.selection = selection1 == null || empty(selection1) ? null : selection1;\n redraw.call(that);\n emit.start().brush().end();\n });\n }\n };\n\n function redraw() {\n var group = select(this),\n selection = local(this).selection;\n\n if (selection) {\n group.selectAll(\".selection\")\n .style(\"display\", null)\n .attr(\"x\", selection[0][0])\n .attr(\"y\", selection[0][1])\n .attr(\"width\", selection[1][0] - selection[0][0])\n .attr(\"height\", selection[1][1] - selection[0][1]);\n\n group.selectAll(\".handle\")\n .style(\"display\", null)\n .attr(\"x\", function(d) { return d.type[d.type.length - 1] === \"e\" ? selection[1][0] - handleSize / 2 : selection[0][0] - handleSize / 2; })\n .attr(\"y\", function(d) { return d.type[0] === \"s\" ? selection[1][1] - handleSize / 2 : selection[0][1] - handleSize / 2; })\n .attr(\"width\", function(d) { return d.type === \"n\" || d.type === \"s\" ? selection[1][0] - selection[0][0] + handleSize : handleSize; })\n .attr(\"height\", function(d) { return d.type === \"e\" || d.type === \"w\" ? selection[1][1] - selection[0][1] + handleSize : handleSize; });\n }\n\n else {\n group.selectAll(\".selection,.handle\")\n .style(\"display\", \"none\")\n .attr(\"x\", null)\n .attr(\"y\", null)\n .attr(\"width\", null)\n .attr(\"height\", null);\n }\n }\n\n function emitter(that, args) {\n return that.__brush.emitter || new Emitter(that, args);\n }\n\n function Emitter(that, args) {\n this.that = that;\n this.args = args;\n this.state = that.__brush;\n this.active = 0;\n }\n\n Emitter.prototype = {\n beforestart: function() {\n if (++this.active === 1) this.state.emitter = this, this.starting = true;\n return this;\n },\n start: function() {\n if (this.starting) this.starting = false, this.emit(\"start\");\n return this;\n },\n brush: function() {\n this.emit(\"brush\");\n return this;\n },\n end: function() {\n if (--this.active === 0) delete this.state.emitter, this.emit(\"end\");\n return this;\n },\n emit: function(type) {\n customEvent(new BrushEvent(brush, type, dim.output(this.state.selection)), listeners.apply, listeners, [type, this.that, this.args]);\n }\n };\n\n function started() {\n if (exports.event.touches) { if (exports.event.changedTouches.length < exports.event.touches.length) return noevent$1(); }\n else if (touchending) return;\n if (!filter.apply(this, arguments)) return;\n\n var that = this,\n type = exports.event.target.__data__.type,\n mode = (exports.event.metaKey ? type = \"overlay\" : type) === \"selection\" ? MODE_DRAG : (exports.event.altKey ? MODE_CENTER : MODE_HANDLE),\n signX = dim === Y ? null : signsX[type],\n signY = dim === X ? null : signsY[type],\n state = local(that),\n extent = state.extent,\n selection = state.selection,\n W = extent[0][0], w0, w1,\n N = extent[0][1], n0, n1,\n E = extent[1][0], e0, e1,\n S = extent[1][1], s0, s1,\n dx,\n dy,\n moving,\n shifting = signX && signY && exports.event.shiftKey,\n lockX,\n lockY,\n point0 = mouse(that),\n point = point0,\n emit = emitter(that, arguments).beforestart();\n\n if (type === \"overlay\") {\n state.selection = selection = [\n [w0 = dim === Y ? W : point0[0], n0 = dim === X ? N : point0[1]],\n [e0 = dim === Y ? E : w0, s0 = dim === X ? S : n0]\n ];\n } else {\n w0 = selection[0][0];\n n0 = selection[0][1];\n e0 = selection[1][0];\n s0 = selection[1][1];\n }\n\n w1 = w0;\n n1 = n0;\n e1 = e0;\n s1 = s0;\n\n var group = select(that)\n .attr(\"pointer-events\", \"none\");\n\n var overlay = group.selectAll(\".overlay\")\n .attr(\"cursor\", cursors[type]);\n\n if (exports.event.touches) {\n group\n .on(\"touchmove.brush\", moved, true)\n .on(\"touchend.brush touchcancel.brush\", ended, true);\n } else {\n var view = select(exports.event.view)\n .on(\"keydown.brush\", keydowned, true)\n .on(\"keyup.brush\", keyupped, true)\n .on(\"mousemove.brush\", moved, true)\n .on(\"mouseup.brush\", ended, true);\n\n dragDisable(exports.event.view);\n }\n\n nopropagation$1();\n interrupt(that);\n redraw.call(that);\n emit.start();\n\n function moved() {\n var point1 = mouse(that);\n if (shifting && !lockX && !lockY) {\n if (Math.abs(point1[0] - point[0]) > Math.abs(point1[1] - point[1])) lockY = true;\n else lockX = true;\n }\n point = point1;\n moving = true;\n noevent$1();\n move();\n }\n\n function move() {\n var t;\n\n dx = point[0] - point0[0];\n dy = point[1] - point0[1];\n\n switch (mode) {\n case MODE_SPACE:\n case MODE_DRAG: {\n if (signX) dx = Math.max(W - w0, Math.min(E - e0, dx)), w1 = w0 + dx, e1 = e0 + dx;\n if (signY) dy = Math.max(N - n0, Math.min(S - s0, dy)), n1 = n0 + dy, s1 = s0 + dy;\n break;\n }\n case MODE_HANDLE: {\n if (signX < 0) dx = Math.max(W - w0, Math.min(E - w0, dx)), w1 = w0 + dx, e1 = e0;\n else if (signX > 0) dx = Math.max(W - e0, Math.min(E - e0, dx)), w1 = w0, e1 = e0 + dx;\n if (signY < 0) dy = Math.max(N - n0, Math.min(S - n0, dy)), n1 = n0 + dy, s1 = s0;\n else if (signY > 0) dy = Math.max(N - s0, Math.min(S - s0, dy)), n1 = n0, s1 = s0 + dy;\n break;\n }\n case MODE_CENTER: {\n if (signX) w1 = Math.max(W, Math.min(E, w0 - dx * signX)), e1 = Math.max(W, Math.min(E, e0 + dx * signX));\n if (signY) n1 = Math.max(N, Math.min(S, n0 - dy * signY)), s1 = Math.max(N, Math.min(S, s0 + dy * signY));\n break;\n }\n }\n\n if (e1 < w1) {\n signX *= -1;\n t = w0, w0 = e0, e0 = t;\n t = w1, w1 = e1, e1 = t;\n if (type in flipX) overlay.attr(\"cursor\", cursors[type = flipX[type]]);\n }\n\n if (s1 < n1) {\n signY *= -1;\n t = n0, n0 = s0, s0 = t;\n t = n1, n1 = s1, s1 = t;\n if (type in flipY) overlay.attr(\"cursor\", cursors[type = flipY[type]]);\n }\n\n if (state.selection) selection = state.selection; // May be set by brush.move!\n if (lockX) w1 = selection[0][0], e1 = selection[1][0];\n if (lockY) n1 = selection[0][1], s1 = selection[1][1];\n\n if (selection[0][0] !== w1\n || selection[0][1] !== n1\n || selection[1][0] !== e1\n || selection[1][1] !== s1) {\n state.selection = [[w1, n1], [e1, s1]];\n redraw.call(that);\n emit.brush();\n }\n }\n\n function ended() {\n nopropagation$1();\n if (exports.event.touches) {\n if (exports.event.touches.length) return;\n if (touchending) clearTimeout(touchending);\n touchending = setTimeout(function() { touchending = null; }, 500); // Ghost clicks are delayed!\n group.on(\"touchmove.brush touchend.brush touchcancel.brush\", null);\n } else {\n yesdrag(exports.event.view, moving);\n view.on(\"keydown.brush keyup.brush mousemove.brush mouseup.brush\", null);\n }\n group.attr(\"pointer-events\", \"all\");\n overlay.attr(\"cursor\", cursors.overlay);\n if (state.selection) selection = state.selection; // May be set by brush.move (on start)!\n if (empty(selection)) state.selection = null, redraw.call(that);\n emit.end();\n }\n\n function keydowned() {\n switch (exports.event.keyCode) {\n case 16: { // SHIFT\n shifting = signX && signY;\n break;\n }\n case 18: { // ALT\n if (mode === MODE_HANDLE) {\n if (signX) e0 = e1 - dx * signX, w0 = w1 + dx * signX;\n if (signY) s0 = s1 - dy * signY, n0 = n1 + dy * signY;\n mode = MODE_CENTER;\n move();\n }\n break;\n }\n case 32: { // SPACE; takes priority over ALT\n if (mode === MODE_HANDLE || mode === MODE_CENTER) {\n if (signX < 0) e0 = e1 - dx; else if (signX > 0) w0 = w1 - dx;\n if (signY < 0) s0 = s1 - dy; else if (signY > 0) n0 = n1 - dy;\n mode = MODE_SPACE;\n overlay.attr(\"cursor\", cursors.selection);\n move();\n }\n break;\n }\n default: return;\n }\n noevent$1();\n }\n\n function keyupped() {\n switch (exports.event.keyCode) {\n case 16: { // SHIFT\n if (shifting) {\n lockX = lockY = shifting = false;\n move();\n }\n break;\n }\n case 18: { // ALT\n if (mode === MODE_CENTER) {\n if (signX < 0) e0 = e1; else if (signX > 0) w0 = w1;\n if (signY < 0) s0 = s1; else if (signY > 0) n0 = n1;\n mode = MODE_HANDLE;\n move();\n }\n break;\n }\n case 32: { // SPACE\n if (mode === MODE_SPACE) {\n if (exports.event.altKey) {\n if (signX) e0 = e1 - dx * signX, w0 = w1 + dx * signX;\n if (signY) s0 = s1 - dy * signY, n0 = n1 + dy * signY;\n mode = MODE_CENTER;\n } else {\n if (signX < 0) e0 = e1; else if (signX > 0) w0 = w1;\n if (signY < 0) s0 = s1; else if (signY > 0) n0 = n1;\n mode = MODE_HANDLE;\n }\n overlay.attr(\"cursor\", cursors[type]);\n move();\n }\n break;\n }\n default: return;\n }\n noevent$1();\n }\n }\n\n function initialize() {\n var state = this.__brush || {selection: null};\n state.extent = extent.apply(this, arguments);\n state.dim = dim;\n return state;\n }\n\n brush.extent = function(_) {\n return arguments.length ? (extent = typeof _ === \"function\" ? _ : constant$4([[+_[0][0], +_[0][1]], [+_[1][0], +_[1][1]]]), brush) : extent;\n };\n\n brush.filter = function(_) {\n return arguments.length ? (filter = typeof _ === \"function\" ? _ : constant$4(!!_), brush) : filter;\n };\n\n brush.handleSize = function(_) {\n return arguments.length ? (handleSize = +_, brush) : handleSize;\n };\n\n brush.on = function() {\n var value = listeners.on.apply(listeners, arguments);\n return value === listeners ? brush : value;\n };\n\n return brush;\n}\n\nvar cos = Math.cos;\nvar sin = Math.sin;\nvar pi$1 = Math.PI;\nvar halfPi$1 = pi$1 / 2;\nvar tau$1 = pi$1 * 2;\nvar max$1 = Math.max;\n\nfunction compareValue(compare) {\n return function(a, b) {\n return compare(\n a.source.value + a.target.value,\n b.source.value + b.target.value\n );\n };\n}\n\nvar chord = function() {\n var padAngle = 0,\n sortGroups = null,\n sortSubgroups = null,\n sortChords = null;\n\n function chord(matrix) {\n var n = matrix.length,\n groupSums = [],\n groupIndex = sequence(n),\n subgroupIndex = [],\n chords = [],\n groups = chords.groups = new Array(n),\n subgroups = new Array(n * n),\n k,\n x,\n x0,\n dx,\n i,\n j;\n\n // Compute the sum.\n k = 0, i = -1; while (++i < n) {\n x = 0, j = -1; while (++j < n) {\n x += matrix[i][j];\n }\n groupSums.push(x);\n subgroupIndex.push(sequence(n));\n k += x;\n }\n\n // Sort groups…\n if (sortGroups) groupIndex.sort(function(a, b) {\n return sortGroups(groupSums[a], groupSums[b]);\n });\n\n // Sort subgroups…\n if (sortSubgroups) subgroupIndex.forEach(function(d, i) {\n d.sort(function(a, b) {\n return sortSubgroups(matrix[i][a], matrix[i][b]);\n });\n });\n\n // Convert the sum to scaling factor for [0, 2pi].\n // TODO Allow start and end angle to be specified?\n // TODO Allow padding to be specified as percentage?\n k = max$1(0, tau$1 - padAngle * n) / k;\n dx = k ? padAngle : tau$1 / n;\n\n // Compute the start and end angle for each group and subgroup.\n // Note: Opera has a bug reordering object literal properties!\n x = 0, i = -1; while (++i < n) {\n x0 = x, j = -1; while (++j < n) {\n var di = groupIndex[i],\n dj = subgroupIndex[di][j],\n v = matrix[di][dj],\n a0 = x,\n a1 = x += v * k;\n subgroups[dj * n + di] = {\n index: di,\n subindex: dj,\n startAngle: a0,\n endAngle: a1,\n value: v\n };\n }\n groups[di] = {\n index: di,\n startAngle: x0,\n endAngle: x,\n value: groupSums[di]\n };\n x += dx;\n }\n\n // Generate chords for each (non-empty) subgroup-subgroup link.\n i = -1; while (++i < n) {\n j = i - 1; while (++j < n) {\n var source = subgroups[j * n + i],\n target = subgroups[i * n + j];\n if (source.value || target.value) {\n chords.push(source.value < target.value\n ? {source: target, target: source}\n : {source: source, target: target});\n }\n }\n }\n\n return sortChords ? chords.sort(sortChords) : chords;\n }\n\n chord.padAngle = function(_) {\n return arguments.length ? (padAngle = max$1(0, _), chord) : padAngle;\n };\n\n chord.sortGroups = function(_) {\n return arguments.length ? (sortGroups = _, chord) : sortGroups;\n };\n\n chord.sortSubgroups = function(_) {\n return arguments.length ? (sortSubgroups = _, chord) : sortSubgroups;\n };\n\n chord.sortChords = function(_) {\n return arguments.length ? (_ == null ? sortChords = null : (sortChords = compareValue(_))._ = _, chord) : sortChords && sortChords._;\n };\n\n return chord;\n};\n\nvar slice$2 = Array.prototype.slice;\n\nvar constant$5 = function(x) {\n return function() {\n return x;\n };\n};\n\nvar pi$2 = Math.PI;\nvar tau$2 = 2 * pi$2;\nvar epsilon$1 = 1e-6;\nvar tauEpsilon = tau$2 - epsilon$1;\n\nfunction Path() {\n this._x0 = this._y0 = // start of current subpath\n this._x1 = this._y1 = null; // end of current subpath\n this._ = \"\";\n}\n\nfunction path() {\n return new Path;\n}\n\nPath.prototype = path.prototype = {\n constructor: Path,\n moveTo: function(x, y) {\n this._ += \"M\" + (this._x0 = this._x1 = +x) + \",\" + (this._y0 = this._y1 = +y);\n },\n closePath: function() {\n if (this._x1 !== null) {\n this._x1 = this._x0, this._y1 = this._y0;\n this._ += \"Z\";\n }\n },\n lineTo: function(x, y) {\n this._ += \"L\" + (this._x1 = +x) + \",\" + (this._y1 = +y);\n },\n quadraticCurveTo: function(x1, y1, x, y) {\n this._ += \"Q\" + (+x1) + \",\" + (+y1) + \",\" + (this._x1 = +x) + \",\" + (this._y1 = +y);\n },\n bezierCurveTo: function(x1, y1, x2, y2, x, y) {\n this._ += \"C\" + (+x1) + \",\" + (+y1) + \",\" + (+x2) + \",\" + (+y2) + \",\" + (this._x1 = +x) + \",\" + (this._y1 = +y);\n },\n arcTo: function(x1, y1, x2, y2, r) {\n x1 = +x1, y1 = +y1, x2 = +x2, y2 = +y2, r = +r;\n var x0 = this._x1,\n y0 = this._y1,\n x21 = x2 - x1,\n y21 = y2 - y1,\n x01 = x0 - x1,\n y01 = y0 - y1,\n l01_2 = x01 * x01 + y01 * y01;\n\n // Is the radius negative? Error.\n if (r < 0) throw new Error(\"negative radius: \" + r);\n\n // Is this path empty? Move to (x1,y1).\n if (this._x1 === null) {\n this._ += \"M\" + (this._x1 = x1) + \",\" + (this._y1 = y1);\n }\n\n // Or, is (x1,y1) coincident with (x0,y0)? Do nothing.\n else if (!(l01_2 > epsilon$1)) {}\n\n // Or, are (x0,y0), (x1,y1) and (x2,y2) collinear?\n // Equivalently, is (x1,y1) coincident with (x2,y2)?\n // Or, is the radius zero? Line to (x1,y1).\n else if (!(Math.abs(y01 * x21 - y21 * x01) > epsilon$1) || !r) {\n this._ += \"L\" + (this._x1 = x1) + \",\" + (this._y1 = y1);\n }\n\n // Otherwise, draw an arc!\n else {\n var x20 = x2 - x0,\n y20 = y2 - y0,\n l21_2 = x21 * x21 + y21 * y21,\n l20_2 = x20 * x20 + y20 * y20,\n l21 = Math.sqrt(l21_2),\n l01 = Math.sqrt(l01_2),\n l = r * Math.tan((pi$2 - Math.acos((l21_2 + l01_2 - l20_2) / (2 * l21 * l01))) / 2),\n t01 = l / l01,\n t21 = l / l21;\n\n // If the start tangent is not coincident with (x0,y0), line to.\n if (Math.abs(t01 - 1) > epsilon$1) {\n this._ += \"L\" + (x1 + t01 * x01) + \",\" + (y1 + t01 * y01);\n }\n\n this._ += \"A\" + r + \",\" + r + \",0,0,\" + (+(y01 * x20 > x01 * y20)) + \",\" + (this._x1 = x1 + t21 * x21) + \",\" + (this._y1 = y1 + t21 * y21);\n }\n },\n arc: function(x, y, r, a0, a1, ccw) {\n x = +x, y = +y, r = +r;\n var dx = r * Math.cos(a0),\n dy = r * Math.sin(a0),\n x0 = x + dx,\n y0 = y + dy,\n cw = 1 ^ ccw,\n da = ccw ? a0 - a1 : a1 - a0;\n\n // Is the radius negative? Error.\n if (r < 0) throw new Error(\"negative radius: \" + r);\n\n // Is this path empty? Move to (x0,y0).\n if (this._x1 === null) {\n this._ += \"M\" + x0 + \",\" + y0;\n }\n\n // Or, is (x0,y0) not coincident with the previous point? Line to (x0,y0).\n else if (Math.abs(this._x1 - x0) > epsilon$1 || Math.abs(this._y1 - y0) > epsilon$1) {\n this._ += \"L\" + x0 + \",\" + y0;\n }\n\n // Is this arc empty? We’re done.\n if (!r) return;\n\n // Does the angle go the wrong way? Flip the direction.\n if (da < 0) da = da % tau$2 + tau$2;\n\n // Is this a complete circle? Draw two arcs to complete the circle.\n if (da > tauEpsilon) {\n this._ += \"A\" + r + \",\" + r + \",0,1,\" + cw + \",\" + (x - dx) + \",\" + (y - dy) + \"A\" + r + \",\" + r + \",0,1,\" + cw + \",\" + (this._x1 = x0) + \",\" + (this._y1 = y0);\n }\n\n // Is this arc non-empty? Draw an arc!\n else if (da > epsilon$1) {\n this._ += \"A\" + r + \",\" + r + \",0,\" + (+(da >= pi$2)) + \",\" + cw + \",\" + (this._x1 = x + r * Math.cos(a1)) + \",\" + (this._y1 = y + r * Math.sin(a1));\n }\n },\n rect: function(x, y, w, h) {\n this._ += \"M\" + (this._x0 = this._x1 = +x) + \",\" + (this._y0 = this._y1 = +y) + \"h\" + (+w) + \"v\" + (+h) + \"h\" + (-w) + \"Z\";\n },\n toString: function() {\n return this._;\n }\n};\n\nfunction defaultSource(d) {\n return d.source;\n}\n\nfunction defaultTarget(d) {\n return d.target;\n}\n\nfunction defaultRadius(d) {\n return d.radius;\n}\n\nfunction defaultStartAngle(d) {\n return d.startAngle;\n}\n\nfunction defaultEndAngle(d) {\n return d.endAngle;\n}\n\nvar ribbon = function() {\n var source = defaultSource,\n target = defaultTarget,\n radius = defaultRadius,\n startAngle = defaultStartAngle,\n endAngle = defaultEndAngle,\n context = null;\n\n function ribbon() {\n var buffer,\n argv = slice$2.call(arguments),\n s = source.apply(this, argv),\n t = target.apply(this, argv),\n sr = +radius.apply(this, (argv[0] = s, argv)),\n sa0 = startAngle.apply(this, argv) - halfPi$1,\n sa1 = endAngle.apply(this, argv) - halfPi$1,\n sx0 = sr * cos(sa0),\n sy0 = sr * sin(sa0),\n tr = +radius.apply(this, (argv[0] = t, argv)),\n ta0 = startAngle.apply(this, argv) - halfPi$1,\n ta1 = endAngle.apply(this, argv) - halfPi$1;\n\n if (!context) context = buffer = path();\n\n context.moveTo(sx0, sy0);\n context.arc(0, 0, sr, sa0, sa1);\n if (sa0 !== ta0 || sa1 !== ta1) { // TODO sr !== tr?\n context.quadraticCurveTo(0, 0, tr * cos(ta0), tr * sin(ta0));\n context.arc(0, 0, tr, ta0, ta1);\n }\n context.quadraticCurveTo(0, 0, sx0, sy0);\n context.closePath();\n\n if (buffer) return context = null, buffer + \"\" || null;\n }\n\n ribbon.radius = function(_) {\n return arguments.length ? (radius = typeof _ === \"function\" ? _ : constant$5(+_), ribbon) : radius;\n };\n\n ribbon.startAngle = function(_) {\n return arguments.length ? (startAngle = typeof _ === \"function\" ? _ : constant$5(+_), ribbon) : startAngle;\n };\n\n ribbon.endAngle = function(_) {\n return arguments.length ? (endAngle = typeof _ === \"function\" ? _ : constant$5(+_), ribbon) : endAngle;\n };\n\n ribbon.source = function(_) {\n return arguments.length ? (source = _, ribbon) : source;\n };\n\n ribbon.target = function(_) {\n return arguments.length ? (target = _, ribbon) : target;\n };\n\n ribbon.context = function(_) {\n return arguments.length ? ((context = _ == null ? null : _), ribbon) : context;\n };\n\n return ribbon;\n};\n\nvar prefix = \"$\";\n\nfunction Map() {}\n\nMap.prototype = map$1.prototype = {\n constructor: Map,\n has: function(key) {\n return (prefix + key) in this;\n },\n get: function(key) {\n return this[prefix + key];\n },\n set: function(key, value) {\n this[prefix + key] = value;\n return this;\n },\n remove: function(key) {\n var property = prefix + key;\n return property in this && delete this[property];\n },\n clear: function() {\n for (var property in this) if (property[0] === prefix) delete this[property];\n },\n keys: function() {\n var keys = [];\n for (var property in this) if (property[0] === prefix) keys.push(property.slice(1));\n return keys;\n },\n values: function() {\n var values = [];\n for (var property in this) if (property[0] === prefix) values.push(this[property]);\n return values;\n },\n entries: function() {\n var entries = [];\n for (var property in this) if (property[0] === prefix) entries.push({key: property.slice(1), value: this[property]});\n return entries;\n },\n size: function() {\n var size = 0;\n for (var property in this) if (property[0] === prefix) ++size;\n return size;\n },\n empty: function() {\n for (var property in this) if (property[0] === prefix) return false;\n return true;\n },\n each: function(f) {\n for (var property in this) if (property[0] === prefix) f(this[property], property.slice(1), this);\n }\n};\n\nfunction map$1(object, f) {\n var map = new Map;\n\n // Copy constructor.\n if (object instanceof Map) object.each(function(value, key) { map.set(key, value); });\n\n // Index array by numeric index or specified key function.\n else if (Array.isArray(object)) {\n var i = -1,\n n = object.length,\n o;\n\n if (f == null) while (++i < n) map.set(i, object[i]);\n else while (++i < n) map.set(f(o = object[i], i, object), o);\n }\n\n // Convert object to map.\n else if (object) for (var key in object) map.set(key, object[key]);\n\n return map;\n}\n\nvar nest = function() {\n var keys = [],\n sortKeys = [],\n sortValues,\n rollup,\n nest;\n\n function apply(array, depth, createResult, setResult) {\n if (depth >= keys.length) {\n if (sortValues != null) array.sort(sortValues);\n return rollup != null ? rollup(array) : array;\n }\n\n var i = -1,\n n = array.length,\n key = keys[depth++],\n keyValue,\n value,\n valuesByKey = map$1(),\n values,\n result = createResult();\n\n while (++i < n) {\n if (values = valuesByKey.get(keyValue = key(value = array[i]) + \"\")) {\n values.push(value);\n } else {\n valuesByKey.set(keyValue, [value]);\n }\n }\n\n valuesByKey.each(function(values, key) {\n setResult(result, key, apply(values, depth, createResult, setResult));\n });\n\n return result;\n }\n\n function entries(map, depth) {\n if (++depth > keys.length) return map;\n var array, sortKey = sortKeys[depth - 1];\n if (rollup != null && depth >= keys.length) array = map.entries();\n else array = [], map.each(function(v, k) { array.push({key: k, values: entries(v, depth)}); });\n return sortKey != null ? array.sort(function(a, b) { return sortKey(a.key, b.key); }) : array;\n }\n\n return nest = {\n object: function(array) { return apply(array, 0, createObject, setObject); },\n map: function(array) { return apply(array, 0, createMap, setMap); },\n entries: function(array) { return entries(apply(array, 0, createMap, setMap), 0); },\n key: function(d) { keys.push(d); return nest; },\n sortKeys: function(order) { sortKeys[keys.length - 1] = order; return nest; },\n sortValues: function(order) { sortValues = order; return nest; },\n rollup: function(f) { rollup = f; return nest; }\n };\n};\n\nfunction createObject() {\n return {};\n}\n\nfunction setObject(object, key, value) {\n object[key] = value;\n}\n\nfunction createMap() {\n return map$1();\n}\n\nfunction setMap(map, key, value) {\n map.set(key, value);\n}\n\nfunction Set() {}\n\nvar proto = map$1.prototype;\n\nSet.prototype = set$2.prototype = {\n constructor: Set,\n has: proto.has,\n add: function(value) {\n value += \"\";\n this[prefix + value] = value;\n return this;\n },\n remove: proto.remove,\n clear: proto.clear,\n values: proto.keys,\n size: proto.size,\n empty: proto.empty,\n each: proto.each\n};\n\nfunction set$2(object, f) {\n var set = new Set;\n\n // Copy constructor.\n if (object instanceof Set) object.each(function(value) { set.add(value); });\n\n // Otherwise, assume it’s an array.\n else if (object) {\n var i = -1, n = object.length;\n if (f == null) while (++i < n) set.add(object[i]);\n else while (++i < n) set.add(f(object[i], i, object));\n }\n\n return set;\n}\n\nvar keys = function(map) {\n var keys = [];\n for (var key in map) keys.push(key);\n return keys;\n};\n\nvar values = function(map) {\n var values = [];\n for (var key in map) values.push(map[key]);\n return values;\n};\n\nvar entries = function(map) {\n var entries = [];\n for (var key in map) entries.push({key: key, value: map[key]});\n return entries;\n};\n\nvar EOL = {};\nvar EOF = {};\nvar QUOTE = 34;\nvar NEWLINE = 10;\nvar RETURN = 13;\n\nfunction objectConverter(columns) {\n return new Function(\"d\", \"return {\" + columns.map(function(name, i) {\n return JSON.stringify(name) + \": d[\" + i + \"]\";\n }).join(\",\") + \"}\");\n}\n\nfunction customConverter(columns, f) {\n var object = objectConverter(columns);\n return function(row, i) {\n return f(object(row), i, columns);\n };\n}\n\n// Compute unique columns in order of discovery.\nfunction inferColumns(rows) {\n var columnSet = Object.create(null),\n columns = [];\n\n rows.forEach(function(row) {\n for (var column in row) {\n if (!(column in columnSet)) {\n columns.push(columnSet[column] = column);\n }\n }\n });\n\n return columns;\n}\n\nvar dsv = function(delimiter) {\n var reFormat = new RegExp(\"[\\\"\" + delimiter + \"\\n\\r]\"),\n DELIMITER = delimiter.charCodeAt(0);\n\n function parse(text, f) {\n var convert, columns, rows = parseRows(text, function(row, i) {\n if (convert) return convert(row, i - 1);\n columns = row, convert = f ? customConverter(row, f) : objectConverter(row);\n });\n rows.columns = columns;\n return rows;\n }\n\n function parseRows(text, f) {\n var rows = [], // output rows\n N = text.length,\n I = 0, // current character index\n n = 0, // current line number\n t, // current token\n eof = N <= 0, // current token followed by EOF?\n eol = false; // current token followed by EOL?\n\n // Strip the trailing newline.\n if (text.charCodeAt(N - 1) === NEWLINE) --N;\n if (text.charCodeAt(N - 1) === RETURN) --N;\n\n function token() {\n if (eof) return EOF;\n if (eol) return eol = false, EOL;\n\n // Unescape quotes.\n var i, j = I, c;\n if (text.charCodeAt(j) === QUOTE) {\n while (I++ < N && text.charCodeAt(I) !== QUOTE || text.charCodeAt(++I) === QUOTE);\n if ((i = I) >= N) eof = true;\n else if ((c = text.charCodeAt(I++)) === NEWLINE) eol = true;\n else if (c === RETURN) { eol = true; if (text.charCodeAt(I) === NEWLINE) ++I; }\n return text.slice(j + 1, i - 1).replace(/\"\"/g, \"\\\"\");\n }\n\n // Find next delimiter or newline.\n while (I < N) {\n if ((c = text.charCodeAt(i = I++)) === NEWLINE) eol = true;\n else if (c === RETURN) { eol = true; if (text.charCodeAt(I) === NEWLINE) ++I; }\n else if (c !== DELIMITER) continue;\n return text.slice(j, i);\n }\n\n // Return last token before EOF.\n return eof = true, text.slice(j, N);\n }\n\n while ((t = token()) !== EOF) {\n var row = [];\n while (t !== EOL && t !== EOF) row.push(t), t = token();\n if (f && (row = f(row, n++)) == null) continue;\n rows.push(row);\n }\n\n return rows;\n }\n\n function format(rows, columns) {\n if (columns == null) columns = inferColumns(rows);\n return [columns.map(formatValue).join(delimiter)].concat(rows.map(function(row) {\n return columns.map(function(column) {\n return formatValue(row[column]);\n }).join(delimiter);\n })).join(\"\\n\");\n }\n\n function formatRows(rows) {\n return rows.map(formatRow).join(\"\\n\");\n }\n\n function formatRow(row) {\n return row.map(formatValue).join(delimiter);\n }\n\n function formatValue(text) {\n return text == null ? \"\"\n : reFormat.test(text += \"\") ? \"\\\"\" + text.replace(/\"/g, \"\\\"\\\"\") + \"\\\"\"\n : text;\n }\n\n return {\n parse: parse,\n parseRows: parseRows,\n format: format,\n formatRows: formatRows\n };\n};\n\nvar csv = dsv(\",\");\n\nvar csvParse = csv.parse;\nvar csvParseRows = csv.parseRows;\nvar csvFormat = csv.format;\nvar csvFormatRows = csv.formatRows;\n\nvar tsv = dsv(\"\\t\");\n\nvar tsvParse = tsv.parse;\nvar tsvParseRows = tsv.parseRows;\nvar tsvFormat = tsv.format;\nvar tsvFormatRows = tsv.formatRows;\n\nvar center$1 = function(x, y) {\n var nodes;\n\n if (x == null) x = 0;\n if (y == null) y = 0;\n\n function force() {\n var i,\n n = nodes.length,\n node,\n sx = 0,\n sy = 0;\n\n for (i = 0; i < n; ++i) {\n node = nodes[i], sx += node.x, sy += node.y;\n }\n\n for (sx = sx / n - x, sy = sy / n - y, i = 0; i < n; ++i) {\n node = nodes[i], node.x -= sx, node.y -= sy;\n }\n }\n\n force.initialize = function(_) {\n nodes = _;\n };\n\n force.x = function(_) {\n return arguments.length ? (x = +_, force) : x;\n };\n\n force.y = function(_) {\n return arguments.length ? (y = +_, force) : y;\n };\n\n return force;\n};\n\nvar constant$6 = function(x) {\n return function() {\n return x;\n };\n};\n\nvar jiggle = function() {\n return (Math.random() - 0.5) * 1e-6;\n};\n\nvar tree_add = function(d) {\n var x = +this._x.call(null, d),\n y = +this._y.call(null, d);\n return add(this.cover(x, y), x, y, d);\n};\n\nfunction add(tree, x, y, d) {\n if (isNaN(x) || isNaN(y)) return tree; // ignore invalid points\n\n var parent,\n node = tree._root,\n leaf = {data: d},\n x0 = tree._x0,\n y0 = tree._y0,\n x1 = tree._x1,\n y1 = tree._y1,\n xm,\n ym,\n xp,\n yp,\n right,\n bottom,\n i,\n j;\n\n // If the tree is empty, initialize the root as a leaf.\n if (!node) return tree._root = leaf, tree;\n\n // Find the existing leaf for the new point, or add it.\n while (node.length) {\n if (right = x >= (xm = (x0 + x1) / 2)) x0 = xm; else x1 = xm;\n if (bottom = y >= (ym = (y0 + y1) / 2)) y0 = ym; else y1 = ym;\n if (parent = node, !(node = node[i = bottom << 1 | right])) return parent[i] = leaf, tree;\n }\n\n // Is the new point is exactly coincident with the existing point?\n xp = +tree._x.call(null, node.data);\n yp = +tree._y.call(null, node.data);\n if (x === xp && y === yp) return leaf.next = node, parent ? parent[i] = leaf : tree._root = leaf, tree;\n\n // Otherwise, split the leaf node until the old and new point are separated.\n do {\n parent = parent ? parent[i] = new Array(4) : tree._root = new Array(4);\n if (right = x >= (xm = (x0 + x1) / 2)) x0 = xm; else x1 = xm;\n if (bottom = y >= (ym = (y0 + y1) / 2)) y0 = ym; else y1 = ym;\n } while ((i = bottom << 1 | right) === (j = (yp >= ym) << 1 | (xp >= xm)));\n return parent[j] = node, parent[i] = leaf, tree;\n}\n\nfunction addAll(data) {\n var d, i, n = data.length,\n x,\n y,\n xz = new Array(n),\n yz = new Array(n),\n x0 = Infinity,\n y0 = Infinity,\n x1 = -Infinity,\n y1 = -Infinity;\n\n // Compute the points and their extent.\n for (i = 0; i < n; ++i) {\n if (isNaN(x = +this._x.call(null, d = data[i])) || isNaN(y = +this._y.call(null, d))) continue;\n xz[i] = x;\n yz[i] = y;\n if (x < x0) x0 = x;\n if (x > x1) x1 = x;\n if (y < y0) y0 = y;\n if (y > y1) y1 = y;\n }\n\n // If there were no (valid) points, inherit the existing extent.\n if (x1 < x0) x0 = this._x0, x1 = this._x1;\n if (y1 < y0) y0 = this._y0, y1 = this._y1;\n\n // Expand the tree to cover the new points.\n this.cover(x0, y0).cover(x1, y1);\n\n // Add the new points.\n for (i = 0; i < n; ++i) {\n add(this, xz[i], yz[i], data[i]);\n }\n\n return this;\n}\n\nvar tree_cover = function(x, y) {\n if (isNaN(x = +x) || isNaN(y = +y)) return this; // ignore invalid points\n\n var x0 = this._x0,\n y0 = this._y0,\n x1 = this._x1,\n y1 = this._y1;\n\n // If the quadtree has no extent, initialize them.\n // Integer extent are necessary so that if we later double the extent,\n // the existing quadrant boundaries don’t change due to floating point error!\n if (isNaN(x0)) {\n x1 = (x0 = Math.floor(x)) + 1;\n y1 = (y0 = Math.floor(y)) + 1;\n }\n\n // Otherwise, double repeatedly to cover.\n else if (x0 > x || x > x1 || y0 > y || y > y1) {\n var z = x1 - x0,\n node = this._root,\n parent,\n i;\n\n switch (i = (y < (y0 + y1) / 2) << 1 | (x < (x0 + x1) / 2)) {\n case 0: {\n do parent = new Array(4), parent[i] = node, node = parent;\n while (z *= 2, x1 = x0 + z, y1 = y0 + z, x > x1 || y > y1);\n break;\n }\n case 1: {\n do parent = new Array(4), parent[i] = node, node = parent;\n while (z *= 2, x0 = x1 - z, y1 = y0 + z, x0 > x || y > y1);\n break;\n }\n case 2: {\n do parent = new Array(4), parent[i] = node, node = parent;\n while (z *= 2, x1 = x0 + z, y0 = y1 - z, x > x1 || y0 > y);\n break;\n }\n case 3: {\n do parent = new Array(4), parent[i] = node, node = parent;\n while (z *= 2, x0 = x1 - z, y0 = y1 - z, x0 > x || y0 > y);\n break;\n }\n }\n\n if (this._root && this._root.length) this._root = node;\n }\n\n // If the quadtree covers the point already, just return.\n else return this;\n\n this._x0 = x0;\n this._y0 = y0;\n this._x1 = x1;\n this._y1 = y1;\n return this;\n};\n\nvar tree_data = function() {\n var data = [];\n this.visit(function(node) {\n if (!node.length) do data.push(node.data); while (node = node.next)\n });\n return data;\n};\n\nvar tree_extent = function(_) {\n return arguments.length\n ? this.cover(+_[0][0], +_[0][1]).cover(+_[1][0], +_[1][1])\n : isNaN(this._x0) ? undefined : [[this._x0, this._y0], [this._x1, this._y1]];\n};\n\nvar Quad = function(node, x0, y0, x1, y1) {\n this.node = node;\n this.x0 = x0;\n this.y0 = y0;\n this.x1 = x1;\n this.y1 = y1;\n};\n\nvar tree_find = function(x, y, radius) {\n var data,\n x0 = this._x0,\n y0 = this._y0,\n x1,\n y1,\n x2,\n y2,\n x3 = this._x1,\n y3 = this._y1,\n quads = [],\n node = this._root,\n q,\n i;\n\n if (node) quads.push(new Quad(node, x0, y0, x3, y3));\n if (radius == null) radius = Infinity;\n else {\n x0 = x - radius, y0 = y - radius;\n x3 = x + radius, y3 = y + radius;\n radius *= radius;\n }\n\n while (q = quads.pop()) {\n\n // Stop searching if this quadrant can’t contain a closer node.\n if (!(node = q.node)\n || (x1 = q.x0) > x3\n || (y1 = q.y0) > y3\n || (x2 = q.x1) < x0\n || (y2 = q.y1) < y0) continue;\n\n // Bisect the current quadrant.\n if (node.length) {\n var xm = (x1 + x2) / 2,\n ym = (y1 + y2) / 2;\n\n quads.push(\n new Quad(node[3], xm, ym, x2, y2),\n new Quad(node[2], x1, ym, xm, y2),\n new Quad(node[1], xm, y1, x2, ym),\n new Quad(node[0], x1, y1, xm, ym)\n );\n\n // Visit the closest quadrant first.\n if (i = (y >= ym) << 1 | (x >= xm)) {\n q = quads[quads.length - 1];\n quads[quads.length - 1] = quads[quads.length - 1 - i];\n quads[quads.length - 1 - i] = q;\n }\n }\n\n // Visit this point. (Visiting coincident points isn’t necessary!)\n else {\n var dx = x - +this._x.call(null, node.data),\n dy = y - +this._y.call(null, node.data),\n d2 = dx * dx + dy * dy;\n if (d2 < radius) {\n var d = Math.sqrt(radius = d2);\n x0 = x - d, y0 = y - d;\n x3 = x + d, y3 = y + d;\n data = node.data;\n }\n }\n }\n\n return data;\n};\n\nvar tree_remove = function(d) {\n if (isNaN(x = +this._x.call(null, d)) || isNaN(y = +this._y.call(null, d))) return this; // ignore invalid points\n\n var parent,\n node = this._root,\n retainer,\n previous,\n next,\n x0 = this._x0,\n y0 = this._y0,\n x1 = this._x1,\n y1 = this._y1,\n x,\n y,\n xm,\n ym,\n right,\n bottom,\n i,\n j;\n\n // If the tree is empty, initialize the root as a leaf.\n if (!node) return this;\n\n // Find the leaf node for the point.\n // While descending, also retain the deepest parent with a non-removed sibling.\n if (node.length) while (true) {\n if (right = x >= (xm = (x0 + x1) / 2)) x0 = xm; else x1 = xm;\n if (bottom = y >= (ym = (y0 + y1) / 2)) y0 = ym; else y1 = ym;\n if (!(parent = node, node = node[i = bottom << 1 | right])) return this;\n if (!node.length) break;\n if (parent[(i + 1) & 3] || parent[(i + 2) & 3] || parent[(i + 3) & 3]) retainer = parent, j = i;\n }\n\n // Find the point to remove.\n while (node.data !== d) if (!(previous = node, node = node.next)) return this;\n if (next = node.next) delete node.next;\n\n // If there are multiple coincident points, remove just the point.\n if (previous) return (next ? previous.next = next : delete previous.next), this;\n\n // If this is the root point, remove it.\n if (!parent) return this._root = next, this;\n\n // Remove this leaf.\n next ? parent[i] = next : delete parent[i];\n\n // If the parent now contains exactly one leaf, collapse superfluous parents.\n if ((node = parent[0] || parent[1] || parent[2] || parent[3])\n && node === (parent[3] || parent[2] || parent[1] || parent[0])\n && !node.length) {\n if (retainer) retainer[j] = node;\n else this._root = node;\n }\n\n return this;\n};\n\nfunction removeAll(data) {\n for (var i = 0, n = data.length; i < n; ++i) this.remove(data[i]);\n return this;\n}\n\nvar tree_root = function() {\n return this._root;\n};\n\nvar tree_size = function() {\n var size = 0;\n this.visit(function(node) {\n if (!node.length) do ++size; while (node = node.next)\n });\n return size;\n};\n\nvar tree_visit = function(callback) {\n var quads = [], q, node = this._root, child, x0, y0, x1, y1;\n if (node) quads.push(new Quad(node, this._x0, this._y0, this._x1, this._y1));\n while (q = quads.pop()) {\n if (!callback(node = q.node, x0 = q.x0, y0 = q.y0, x1 = q.x1, y1 = q.y1) && node.length) {\n var xm = (x0 + x1) / 2, ym = (y0 + y1) / 2;\n if (child = node[3]) quads.push(new Quad(child, xm, ym, x1, y1));\n if (child = node[2]) quads.push(new Quad(child, x0, ym, xm, y1));\n if (child = node[1]) quads.push(new Quad(child, xm, y0, x1, ym));\n if (child = node[0]) quads.push(new Quad(child, x0, y0, xm, ym));\n }\n }\n return this;\n};\n\nvar tree_visitAfter = function(callback) {\n var quads = [], next = [], q;\n if (this._root) quads.push(new Quad(this._root, this._x0, this._y0, this._x1, this._y1));\n while (q = quads.pop()) {\n var node = q.node;\n if (node.length) {\n var child, x0 = q.x0, y0 = q.y0, x1 = q.x1, y1 = q.y1, xm = (x0 + x1) / 2, ym = (y0 + y1) / 2;\n if (child = node[0]) quads.push(new Quad(child, x0, y0, xm, ym));\n if (child = node[1]) quads.push(new Quad(child, xm, y0, x1, ym));\n if (child = node[2]) quads.push(new Quad(child, x0, ym, xm, y1));\n if (child = node[3]) quads.push(new Quad(child, xm, ym, x1, y1));\n }\n next.push(q);\n }\n while (q = next.pop()) {\n callback(q.node, q.x0, q.y0, q.x1, q.y1);\n }\n return this;\n};\n\nfunction defaultX(d) {\n return d[0];\n}\n\nvar tree_x = function(_) {\n return arguments.length ? (this._x = _, this) : this._x;\n};\n\nfunction defaultY(d) {\n return d[1];\n}\n\nvar tree_y = function(_) {\n return arguments.length ? (this._y = _, this) : this._y;\n};\n\nfunction quadtree(nodes, x, y) {\n var tree = new Quadtree(x == null ? defaultX : x, y == null ? defaultY : y, NaN, NaN, NaN, NaN);\n return nodes == null ? tree : tree.addAll(nodes);\n}\n\nfunction Quadtree(x, y, x0, y0, x1, y1) {\n this._x = x;\n this._y = y;\n this._x0 = x0;\n this._y0 = y0;\n this._x1 = x1;\n this._y1 = y1;\n this._root = undefined;\n}\n\nfunction leaf_copy(leaf) {\n var copy = {data: leaf.data}, next = copy;\n while (leaf = leaf.next) next = next.next = {data: leaf.data};\n return copy;\n}\n\nvar treeProto = quadtree.prototype = Quadtree.prototype;\n\ntreeProto.copy = function() {\n var copy = new Quadtree(this._x, this._y, this._x0, this._y0, this._x1, this._y1),\n node = this._root,\n nodes,\n child;\n\n if (!node) return copy;\n\n if (!node.length) return copy._root = leaf_copy(node), copy;\n\n nodes = [{source: node, target: copy._root = new Array(4)}];\n while (node = nodes.pop()) {\n for (var i = 0; i < 4; ++i) {\n if (child = node.source[i]) {\n if (child.length) nodes.push({source: child, target: node.target[i] = new Array(4)});\n else node.target[i] = leaf_copy(child);\n }\n }\n }\n\n return copy;\n};\n\ntreeProto.add = tree_add;\ntreeProto.addAll = addAll;\ntreeProto.cover = tree_cover;\ntreeProto.data = tree_data;\ntreeProto.extent = tree_extent;\ntreeProto.find = tree_find;\ntreeProto.remove = tree_remove;\ntreeProto.removeAll = removeAll;\ntreeProto.root = tree_root;\ntreeProto.size = tree_size;\ntreeProto.visit = tree_visit;\ntreeProto.visitAfter = tree_visitAfter;\ntreeProto.x = tree_x;\ntreeProto.y = tree_y;\n\nfunction x(d) {\n return d.x + d.vx;\n}\n\nfunction y(d) {\n return d.y + d.vy;\n}\n\nvar collide = function(radius) {\n var nodes,\n radii,\n strength = 1,\n iterations = 1;\n\n if (typeof radius !== \"function\") radius = constant$6(radius == null ? 1 : +radius);\n\n function force() {\n var i, n = nodes.length,\n tree,\n node,\n xi,\n yi,\n ri,\n ri2;\n\n for (var k = 0; k < iterations; ++k) {\n tree = quadtree(nodes, x, y).visitAfter(prepare);\n for (i = 0; i < n; ++i) {\n node = nodes[i];\n ri = radii[node.index], ri2 = ri * ri;\n xi = node.x + node.vx;\n yi = node.y + node.vy;\n tree.visit(apply);\n }\n }\n\n function apply(quad, x0, y0, x1, y1) {\n var data = quad.data, rj = quad.r, r = ri + rj;\n if (data) {\n if (data.index > node.index) {\n var x = xi - data.x - data.vx,\n y = yi - data.y - data.vy,\n l = x * x + y * y;\n if (l < r * r) {\n if (x === 0) x = jiggle(), l += x * x;\n if (y === 0) y = jiggle(), l += y * y;\n l = (r - (l = Math.sqrt(l))) / l * strength;\n node.vx += (x *= l) * (r = (rj *= rj) / (ri2 + rj));\n node.vy += (y *= l) * r;\n data.vx -= x * (r = 1 - r);\n data.vy -= y * r;\n }\n }\n return;\n }\n return x0 > xi + r || x1 < xi - r || y0 > yi + r || y1 < yi - r;\n }\n }\n\n function prepare(quad) {\n if (quad.data) return quad.r = radii[quad.data.index];\n for (var i = quad.r = 0; i < 4; ++i) {\n if (quad[i] && quad[i].r > quad.r) {\n quad.r = quad[i].r;\n }\n }\n }\n\n function initialize() {\n if (!nodes) return;\n var i, n = nodes.length, node;\n radii = new Array(n);\n for (i = 0; i < n; ++i) node = nodes[i], radii[node.index] = +radius(node, i, nodes);\n }\n\n force.initialize = function(_) {\n nodes = _;\n initialize();\n };\n\n force.iterations = function(_) {\n return arguments.length ? (iterations = +_, force) : iterations;\n };\n\n force.strength = function(_) {\n return arguments.length ? (strength = +_, force) : strength;\n };\n\n force.radius = function(_) {\n return arguments.length ? (radius = typeof _ === \"function\" ? _ : constant$6(+_), initialize(), force) : radius;\n };\n\n return force;\n};\n\nfunction index(d) {\n return d.index;\n}\n\nfunction find(nodeById, nodeId) {\n var node = nodeById.get(nodeId);\n if (!node) throw new Error(\"missing: \" + nodeId);\n return node;\n}\n\nvar link = function(links) {\n var id = index,\n strength = defaultStrength,\n strengths,\n distance = constant$6(30),\n distances,\n nodes,\n count,\n bias,\n iterations = 1;\n\n if (links == null) links = [];\n\n function defaultStrength(link) {\n return 1 / Math.min(count[link.source.index], count[link.target.index]);\n }\n\n function force(alpha) {\n for (var k = 0, n = links.length; k < iterations; ++k) {\n for (var i = 0, link, source, target, x, y, l, b; i < n; ++i) {\n link = links[i], source = link.source, target = link.target;\n x = target.x + target.vx - source.x - source.vx || jiggle();\n y = target.y + target.vy - source.y - source.vy || jiggle();\n l = Math.sqrt(x * x + y * y);\n l = (l - distances[i]) / l * alpha * strengths[i];\n x *= l, y *= l;\n target.vx -= x * (b = bias[i]);\n target.vy -= y * b;\n source.vx += x * (b = 1 - b);\n source.vy += y * b;\n }\n }\n }\n\n function initialize() {\n if (!nodes) return;\n\n var i,\n n = nodes.length,\n m = links.length,\n nodeById = map$1(nodes, id),\n link;\n\n for (i = 0, count = new Array(n); i < m; ++i) {\n link = links[i], link.index = i;\n if (typeof link.source !== \"object\") link.source = find(nodeById, link.source);\n if (typeof link.target !== \"object\") link.target = find(nodeById, link.target);\n count[link.source.index] = (count[link.source.index] || 0) + 1;\n count[link.target.index] = (count[link.target.index] || 0) + 1;\n }\n\n for (i = 0, bias = new Array(m); i < m; ++i) {\n link = links[i], bias[i] = count[link.source.index] / (count[link.source.index] + count[link.target.index]);\n }\n\n strengths = new Array(m), initializeStrength();\n distances = new Array(m), initializeDistance();\n }\n\n function initializeStrength() {\n if (!nodes) return;\n\n for (var i = 0, n = links.length; i < n; ++i) {\n strengths[i] = +strength(links[i], i, links);\n }\n }\n\n function initializeDistance() {\n if (!nodes) return;\n\n for (var i = 0, n = links.length; i < n; ++i) {\n distances[i] = +distance(links[i], i, links);\n }\n }\n\n force.initialize = function(_) {\n nodes = _;\n initialize();\n };\n\n force.links = function(_) {\n return arguments.length ? (links = _, initialize(), force) : links;\n };\n\n force.id = function(_) {\n return arguments.length ? (id = _, force) : id;\n };\n\n force.iterations = function(_) {\n return arguments.length ? (iterations = +_, force) : iterations;\n };\n\n force.strength = function(_) {\n return arguments.length ? (strength = typeof _ === \"function\" ? _ : constant$6(+_), initializeStrength(), force) : strength;\n };\n\n force.distance = function(_) {\n return arguments.length ? (distance = typeof _ === \"function\" ? _ : constant$6(+_), initializeDistance(), force) : distance;\n };\n\n return force;\n};\n\nfunction x$1(d) {\n return d.x;\n}\n\nfunction y$1(d) {\n return d.y;\n}\n\nvar initialRadius = 10;\nvar initialAngle = Math.PI * (3 - Math.sqrt(5));\n\nvar simulation = function(nodes) {\n var simulation,\n alpha = 1,\n alphaMin = 0.001,\n alphaDecay = 1 - Math.pow(alphaMin, 1 / 300),\n alphaTarget = 0,\n velocityDecay = 0.6,\n forces = map$1(),\n stepper = timer(step),\n event = dispatch(\"tick\", \"end\");\n\n if (nodes == null) nodes = [];\n\n function step() {\n tick();\n event.call(\"tick\", simulation);\n if (alpha < alphaMin) {\n stepper.stop();\n event.call(\"end\", simulation);\n }\n }\n\n function tick() {\n var i, n = nodes.length, node;\n\n alpha += (alphaTarget - alpha) * alphaDecay;\n\n forces.each(function(force) {\n force(alpha);\n });\n\n for (i = 0; i < n; ++i) {\n node = nodes[i];\n if (node.fx == null) node.x += node.vx *= velocityDecay;\n else node.x = node.fx, node.vx = 0;\n if (node.fy == null) node.y += node.vy *= velocityDecay;\n else node.y = node.fy, node.vy = 0;\n }\n }\n\n function initializeNodes() {\n for (var i = 0, n = nodes.length, node; i < n; ++i) {\n node = nodes[i], node.index = i;\n if (isNaN(node.x) || isNaN(node.y)) {\n var radius = initialRadius * Math.sqrt(i), angle = i * initialAngle;\n node.x = radius * Math.cos(angle);\n node.y = radius * Math.sin(angle);\n }\n if (isNaN(node.vx) || isNaN(node.vy)) {\n node.vx = node.vy = 0;\n }\n }\n }\n\n function initializeForce(force) {\n if (force.initialize) force.initialize(nodes);\n return force;\n }\n\n initializeNodes();\n\n return simulation = {\n tick: tick,\n\n restart: function() {\n return stepper.restart(step), simulation;\n },\n\n stop: function() {\n return stepper.stop(), simulation;\n },\n\n nodes: function(_) {\n return arguments.length ? (nodes = _, initializeNodes(), forces.each(initializeForce), simulation) : nodes;\n },\n\n alpha: function(_) {\n return arguments.length ? (alpha = +_, simulation) : alpha;\n },\n\n alphaMin: function(_) {\n return arguments.length ? (alphaMin = +_, simulation) : alphaMin;\n },\n\n alphaDecay: function(_) {\n return arguments.length ? (alphaDecay = +_, simulation) : +alphaDecay;\n },\n\n alphaTarget: function(_) {\n return arguments.length ? (alphaTarget = +_, simulation) : alphaTarget;\n },\n\n velocityDecay: function(_) {\n return arguments.length ? (velocityDecay = 1 - _, simulation) : 1 - velocityDecay;\n },\n\n force: function(name, _) {\n return arguments.length > 1 ? ((_ == null ? forces.remove(name) : forces.set(name, initializeForce(_))), simulation) : forces.get(name);\n },\n\n find: function(x, y, radius) {\n var i = 0,\n n = nodes.length,\n dx,\n dy,\n d2,\n node,\n closest;\n\n if (radius == null) radius = Infinity;\n else radius *= radius;\n\n for (i = 0; i < n; ++i) {\n node = nodes[i];\n dx = x - node.x;\n dy = y - node.y;\n d2 = dx * dx + dy * dy;\n if (d2 < radius) closest = node, radius = d2;\n }\n\n return closest;\n },\n\n on: function(name, _) {\n return arguments.length > 1 ? (event.on(name, _), simulation) : event.on(name);\n }\n };\n};\n\nvar manyBody = function() {\n var nodes,\n node,\n alpha,\n strength = constant$6(-30),\n strengths,\n distanceMin2 = 1,\n distanceMax2 = Infinity,\n theta2 = 0.81;\n\n function force(_) {\n var i, n = nodes.length, tree = quadtree(nodes, x$1, y$1).visitAfter(accumulate);\n for (alpha = _, i = 0; i < n; ++i) node = nodes[i], tree.visit(apply);\n }\n\n function initialize() {\n if (!nodes) return;\n var i, n = nodes.length, node;\n strengths = new Array(n);\n for (i = 0; i < n; ++i) node = nodes[i], strengths[node.index] = +strength(node, i, nodes);\n }\n\n function accumulate(quad) {\n var strength = 0, q, c, weight = 0, x, y, i;\n\n // For internal nodes, accumulate forces from child quadrants.\n if (quad.length) {\n for (x = y = i = 0; i < 4; ++i) {\n if ((q = quad[i]) && (c = Math.abs(q.value))) {\n strength += q.value, weight += c, x += c * q.x, y += c * q.y;\n }\n }\n quad.x = x / weight;\n quad.y = y / weight;\n }\n\n // For leaf nodes, accumulate forces from coincident quadrants.\n else {\n q = quad;\n q.x = q.data.x;\n q.y = q.data.y;\n do strength += strengths[q.data.index];\n while (q = q.next);\n }\n\n quad.value = strength;\n }\n\n function apply(quad, x1, _, x2) {\n if (!quad.value) return true;\n\n var x = quad.x - node.x,\n y = quad.y - node.y,\n w = x2 - x1,\n l = x * x + y * y;\n\n // Apply the Barnes-Hut approximation if possible.\n // Limit forces for very close nodes; randomize direction if coincident.\n if (w * w / theta2 < l) {\n if (l < distanceMax2) {\n if (x === 0) x = jiggle(), l += x * x;\n if (y === 0) y = jiggle(), l += y * y;\n if (l < distanceMin2) l = Math.sqrt(distanceMin2 * l);\n node.vx += x * quad.value * alpha / l;\n node.vy += y * quad.value * alpha / l;\n }\n return true;\n }\n\n // Otherwise, process points directly.\n else if (quad.length || l >= distanceMax2) return;\n\n // Limit forces for very close nodes; randomize direction if coincident.\n if (quad.data !== node || quad.next) {\n if (x === 0) x = jiggle(), l += x * x;\n if (y === 0) y = jiggle(), l += y * y;\n if (l < distanceMin2) l = Math.sqrt(distanceMin2 * l);\n }\n\n do if (quad.data !== node) {\n w = strengths[quad.data.index] * alpha / l;\n node.vx += x * w;\n node.vy += y * w;\n } while (quad = quad.next);\n }\n\n force.initialize = function(_) {\n nodes = _;\n initialize();\n };\n\n force.strength = function(_) {\n return arguments.length ? (strength = typeof _ === \"function\" ? _ : constant$6(+_), initialize(), force) : strength;\n };\n\n force.distanceMin = function(_) {\n return arguments.length ? (distanceMin2 = _ * _, force) : Math.sqrt(distanceMin2);\n };\n\n force.distanceMax = function(_) {\n return arguments.length ? (distanceMax2 = _ * _, force) : Math.sqrt(distanceMax2);\n };\n\n force.theta = function(_) {\n return arguments.length ? (theta2 = _ * _, force) : Math.sqrt(theta2);\n };\n\n return force;\n};\n\nvar radial = function(radius, x, y) {\n var nodes,\n strength = constant$6(0.1),\n strengths,\n radiuses;\n\n if (typeof radius !== \"function\") radius = constant$6(+radius);\n if (x == null) x = 0;\n if (y == null) y = 0;\n\n function force(alpha) {\n for (var i = 0, n = nodes.length; i < n; ++i) {\n var node = nodes[i],\n dx = node.x - x || 1e-6,\n dy = node.y - y || 1e-6,\n r = Math.sqrt(dx * dx + dy * dy),\n k = (radiuses[i] - r) * strengths[i] * alpha / r;\n node.vx += dx * k;\n node.vy += dy * k;\n }\n }\n\n function initialize() {\n if (!nodes) return;\n var i, n = nodes.length;\n strengths = new Array(n);\n radiuses = new Array(n);\n for (i = 0; i < n; ++i) {\n radiuses[i] = +radius(nodes[i], i, nodes);\n strengths[i] = isNaN(radiuses[i]) ? 0 : +strength(nodes[i], i, nodes);\n }\n }\n\n force.initialize = function(_) {\n nodes = _, initialize();\n };\n\n force.strength = function(_) {\n return arguments.length ? (strength = typeof _ === \"function\" ? _ : constant$6(+_), initialize(), force) : strength;\n };\n\n force.radius = function(_) {\n return arguments.length ? (radius = typeof _ === \"function\" ? _ : constant$6(+_), initialize(), force) : radius;\n };\n\n force.x = function(_) {\n return arguments.length ? (x = +_, force) : x;\n };\n\n force.y = function(_) {\n return arguments.length ? (y = +_, force) : y;\n };\n\n return force;\n};\n\nvar x$2 = function(x) {\n var strength = constant$6(0.1),\n nodes,\n strengths,\n xz;\n\n if (typeof x !== \"function\") x = constant$6(x == null ? 0 : +x);\n\n function force(alpha) {\n for (var i = 0, n = nodes.length, node; i < n; ++i) {\n node = nodes[i], node.vx += (xz[i] - node.x) * strengths[i] * alpha;\n }\n }\n\n function initialize() {\n if (!nodes) return;\n var i, n = nodes.length;\n strengths = new Array(n);\n xz = new Array(n);\n for (i = 0; i < n; ++i) {\n strengths[i] = isNaN(xz[i] = +x(nodes[i], i, nodes)) ? 0 : +strength(nodes[i], i, nodes);\n }\n }\n\n force.initialize = function(_) {\n nodes = _;\n initialize();\n };\n\n force.strength = function(_) {\n return arguments.length ? (strength = typeof _ === \"function\" ? _ : constant$6(+_), initialize(), force) : strength;\n };\n\n force.x = function(_) {\n return arguments.length ? (x = typeof _ === \"function\" ? _ : constant$6(+_), initialize(), force) : x;\n };\n\n return force;\n};\n\nvar y$2 = function(y) {\n var strength = constant$6(0.1),\n nodes,\n strengths,\n yz;\n\n if (typeof y !== \"function\") y = constant$6(y == null ? 0 : +y);\n\n function force(alpha) {\n for (var i = 0, n = nodes.length, node; i < n; ++i) {\n node = nodes[i], node.vy += (yz[i] - node.y) * strengths[i] * alpha;\n }\n }\n\n function initialize() {\n if (!nodes) return;\n var i, n = nodes.length;\n strengths = new Array(n);\n yz = new Array(n);\n for (i = 0; i < n; ++i) {\n strengths[i] = isNaN(yz[i] = +y(nodes[i], i, nodes)) ? 0 : +strength(nodes[i], i, nodes);\n }\n }\n\n force.initialize = function(_) {\n nodes = _;\n initialize();\n };\n\n force.strength = function(_) {\n return arguments.length ? (strength = typeof _ === \"function\" ? _ : constant$6(+_), initialize(), force) : strength;\n };\n\n force.y = function(_) {\n return arguments.length ? (y = typeof _ === \"function\" ? _ : constant$6(+_), initialize(), force) : y;\n };\n\n return force;\n};\n\n// Computes the decimal coefficient and exponent of the specified number x with\n// significant digits p, where x is positive and p is in [1, 21] or undefined.\n// For example, formatDecimal(1.23) returns [\"123\", 0].\nvar formatDecimal = function(x, p) {\n if ((i = (x = p ? x.toExponential(p - 1) : x.toExponential()).indexOf(\"e\")) < 0) return null; // NaN, ±Infinity\n var i, coefficient = x.slice(0, i);\n\n // The string returned by toExponential either has the form \\d\\.\\d+e[-+]\\d+\n // (e.g., 1.2e+3) or the form \\de[-+]\\d+ (e.g., 1e+3).\n return [\n coefficient.length > 1 ? coefficient[0] + coefficient.slice(2) : coefficient,\n +x.slice(i + 1)\n ];\n};\n\nvar exponent$1 = function(x) {\n return x = formatDecimal(Math.abs(x)), x ? x[1] : NaN;\n};\n\nvar formatGroup = function(grouping, thousands) {\n return function(value, width) {\n var i = value.length,\n t = [],\n j = 0,\n g = grouping[0],\n length = 0;\n\n while (i > 0 && g > 0) {\n if (length + g + 1 > width) g = Math.max(1, width - length);\n t.push(value.substring(i -= g, i + g));\n if ((length += g + 1) > width) break;\n g = grouping[j = (j + 1) % grouping.length];\n }\n\n return t.reverse().join(thousands);\n };\n};\n\nvar formatNumerals = function(numerals) {\n return function(value) {\n return value.replace(/[0-9]/g, function(i) {\n return numerals[+i];\n });\n };\n};\n\nvar formatDefault = function(x, p) {\n x = x.toPrecision(p);\n\n out: for (var n = x.length, i = 1, i0 = -1, i1; i < n; ++i) {\n switch (x[i]) {\n case \".\": i0 = i1 = i; break;\n case \"0\": if (i0 === 0) i0 = i; i1 = i; break;\n case \"e\": break out;\n default: if (i0 > 0) i0 = 0; break;\n }\n }\n\n return i0 > 0 ? x.slice(0, i0) + x.slice(i1 + 1) : x;\n};\n\nvar prefixExponent;\n\nvar formatPrefixAuto = function(x, p) {\n var d = formatDecimal(x, p);\n if (!d) return x + \"\";\n var coefficient = d[0],\n exponent = d[1],\n i = exponent - (prefixExponent = Math.max(-8, Math.min(8, Math.floor(exponent / 3))) * 3) + 1,\n n = coefficient.length;\n return i === n ? coefficient\n : i > n ? coefficient + new Array(i - n + 1).join(\"0\")\n : i > 0 ? coefficient.slice(0, i) + \".\" + coefficient.slice(i)\n : \"0.\" + new Array(1 - i).join(\"0\") + formatDecimal(x, Math.max(0, p + i - 1))[0]; // less than 1y!\n};\n\nvar formatRounded = function(x, p) {\n var d = formatDecimal(x, p);\n if (!d) return x + \"\";\n var coefficient = d[0],\n exponent = d[1];\n return exponent < 0 ? \"0.\" + new Array(-exponent).join(\"0\") + coefficient\n : coefficient.length > exponent + 1 ? coefficient.slice(0, exponent + 1) + \".\" + coefficient.slice(exponent + 1)\n : coefficient + new Array(exponent - coefficient.length + 2).join(\"0\");\n};\n\nvar formatTypes = {\n \"\": formatDefault,\n \"%\": function(x, p) { return (x * 100).toFixed(p); },\n \"b\": function(x) { return Math.round(x).toString(2); },\n \"c\": function(x) { return x + \"\"; },\n \"d\": function(x) { return Math.round(x).toString(10); },\n \"e\": function(x, p) { return x.toExponential(p); },\n \"f\": function(x, p) { return x.toFixed(p); },\n \"g\": function(x, p) { return x.toPrecision(p); },\n \"o\": function(x) { return Math.round(x).toString(8); },\n \"p\": function(x, p) { return formatRounded(x * 100, p); },\n \"r\": formatRounded,\n \"s\": formatPrefixAuto,\n \"X\": function(x) { return Math.round(x).toString(16).toUpperCase(); },\n \"x\": function(x) { return Math.round(x).toString(16); }\n};\n\n// [[fill]align][sign][symbol][0][width][,][.precision][type]\nvar re = /^(?:(.)?([<>=^]))?([+\\-\\( ])?([$#])?(0)?(\\d+)?(,)?(\\.\\d+)?([a-z%])?$/i;\n\nfunction formatSpecifier(specifier) {\n return new FormatSpecifier(specifier);\n}\n\nformatSpecifier.prototype = FormatSpecifier.prototype; // instanceof\n\nfunction FormatSpecifier(specifier) {\n if (!(match = re.exec(specifier))) throw new Error(\"invalid format: \" + specifier);\n\n var match,\n fill = match[1] || \" \",\n align = match[2] || \">\",\n sign = match[3] || \"-\",\n symbol = match[4] || \"\",\n zero = !!match[5],\n width = match[6] && +match[6],\n comma = !!match[7],\n precision = match[8] && +match[8].slice(1),\n type = match[9] || \"\";\n\n // The \"n\" type is an alias for \",g\".\n if (type === \"n\") comma = true, type = \"g\";\n\n // Map invalid types to the default format.\n else if (!formatTypes[type]) type = \"\";\n\n // If zero fill is specified, padding goes after sign and before digits.\n if (zero || (fill === \"0\" && align === \"=\")) zero = true, fill = \"0\", align = \"=\";\n\n this.fill = fill;\n this.align = align;\n this.sign = sign;\n this.symbol = symbol;\n this.zero = zero;\n this.width = width;\n this.comma = comma;\n this.precision = precision;\n this.type = type;\n}\n\nFormatSpecifier.prototype.toString = function() {\n return this.fill\n + this.align\n + this.sign\n + this.symbol\n + (this.zero ? \"0\" : \"\")\n + (this.width == null ? \"\" : Math.max(1, this.width | 0))\n + (this.comma ? \",\" : \"\")\n + (this.precision == null ? \"\" : \".\" + Math.max(0, this.precision | 0))\n + this.type;\n};\n\nvar identity$3 = function(x) {\n return x;\n};\n\nvar prefixes = [\"y\",\"z\",\"a\",\"f\",\"p\",\"n\",\"\\xB5\",\"m\",\"\",\"k\",\"M\",\"G\",\"T\",\"P\",\"E\",\"Z\",\"Y\"];\n\nvar formatLocale = function(locale) {\n var group = locale.grouping && locale.thousands ? formatGroup(locale.grouping, locale.thousands) : identity$3,\n currency = locale.currency,\n decimal = locale.decimal,\n numerals = locale.numerals ? formatNumerals(locale.numerals) : identity$3,\n percent = locale.percent || \"%\";\n\n function newFormat(specifier) {\n specifier = formatSpecifier(specifier);\n\n var fill = specifier.fill,\n align = specifier.align,\n sign = specifier.sign,\n symbol = specifier.symbol,\n zero = specifier.zero,\n width = specifier.width,\n comma = specifier.comma,\n precision = specifier.precision,\n type = specifier.type;\n\n // Compute the prefix and suffix.\n // For SI-prefix, the suffix is lazily computed.\n var prefix = symbol === \"$\" ? currency[0] : symbol === \"#\" && /[boxX]/.test(type) ? \"0\" + type.toLowerCase() : \"\",\n suffix = symbol === \"$\" ? currency[1] : /[%p]/.test(type) ? percent : \"\";\n\n // What format function should we use?\n // Is this an integer type?\n // Can this type generate exponential notation?\n var formatType = formatTypes[type],\n maybeSuffix = !type || /[defgprs%]/.test(type);\n\n // Set the default precision if not specified,\n // or clamp the specified precision to the supported range.\n // For significant precision, it must be in [1, 21].\n // For fixed precision, it must be in [0, 20].\n precision = precision == null ? (type ? 6 : 12)\n : /[gprs]/.test(type) ? Math.max(1, Math.min(21, precision))\n : Math.max(0, Math.min(20, precision));\n\n function format(value) {\n var valuePrefix = prefix,\n valueSuffix = suffix,\n i, n, c;\n\n if (type === \"c\") {\n valueSuffix = formatType(value) + valueSuffix;\n value = \"\";\n } else {\n value = +value;\n\n // Perform the initial formatting.\n var valueNegative = value < 0;\n value = formatType(Math.abs(value), precision);\n\n // If a negative value rounds to zero during formatting, treat as positive.\n if (valueNegative && +value === 0) valueNegative = false;\n\n // Compute the prefix and suffix.\n valuePrefix = (valueNegative ? (sign === \"(\" ? sign : \"-\") : sign === \"-\" || sign === \"(\" ? \"\" : sign) + valuePrefix;\n valueSuffix = valueSuffix + (type === \"s\" ? prefixes[8 + prefixExponent / 3] : \"\") + (valueNegative && sign === \"(\" ? \")\" : \"\");\n\n // Break the formatted value into the integer “value” part that can be\n // grouped, and fractional or exponential “suffix” part that is not.\n if (maybeSuffix) {\n i = -1, n = value.length;\n while (++i < n) {\n if (c = value.charCodeAt(i), 48 > c || c > 57) {\n valueSuffix = (c === 46 ? decimal + value.slice(i + 1) : value.slice(i)) + valueSuffix;\n value = value.slice(0, i);\n break;\n }\n }\n }\n }\n\n // If the fill character is not \"0\", grouping is applied before padding.\n if (comma && !zero) value = group(value, Infinity);\n\n // Compute the padding.\n var length = valuePrefix.length + value.length + valueSuffix.length,\n padding = length < width ? new Array(width - length + 1).join(fill) : \"\";\n\n // If the fill character is \"0\", grouping is applied after padding.\n if (comma && zero) value = group(padding + value, padding.length ? width - valueSuffix.length : Infinity), padding = \"\";\n\n // Reconstruct the final output based on the desired alignment.\n switch (align) {\n case \"<\": value = valuePrefix + value + valueSuffix + padding; break;\n case \"=\": value = valuePrefix + padding + value + valueSuffix; break;\n case \"^\": value = padding.slice(0, length = padding.length >> 1) + valuePrefix + value + valueSuffix + padding.slice(length); break;\n default: value = padding + valuePrefix + value + valueSuffix; break;\n }\n\n return numerals(value);\n }\n\n format.toString = function() {\n return specifier + \"\";\n };\n\n return format;\n }\n\n function formatPrefix(specifier, value) {\n var f = newFormat((specifier = formatSpecifier(specifier), specifier.type = \"f\", specifier)),\n e = Math.max(-8, Math.min(8, Math.floor(exponent$1(value) / 3))) * 3,\n k = Math.pow(10, -e),\n prefix = prefixes[8 + e / 3];\n return function(value) {\n return f(k * value) + prefix;\n };\n }\n\n return {\n format: newFormat,\n formatPrefix: formatPrefix\n };\n};\n\nvar locale;\n\n\n\ndefaultLocale({\n decimal: \".\",\n thousands: \",\",\n grouping: [3],\n currency: [\"$\", \"\"]\n});\n\nfunction defaultLocale(definition) {\n locale = formatLocale(definition);\n exports.format = locale.format;\n exports.formatPrefix = locale.formatPrefix;\n return locale;\n}\n\nvar precisionFixed = function(step) {\n return Math.max(0, -exponent$1(Math.abs(step)));\n};\n\nvar precisionPrefix = function(step, value) {\n return Math.max(0, Math.max(-8, Math.min(8, Math.floor(exponent$1(value) / 3))) * 3 - exponent$1(Math.abs(step)));\n};\n\nvar precisionRound = function(step, max) {\n step = Math.abs(step), max = Math.abs(max) - step;\n return Math.max(0, exponent$1(max) - exponent$1(step)) + 1;\n};\n\n// Adds floating point numbers with twice the normal precision.\n// Reference: J. R. Shewchuk, Adaptive Precision Floating-Point Arithmetic and\n// Fast Robust Geometric Predicates, Discrete & Computational Geometry 18(3)\n// 305–363 (1997).\n// Code adapted from GeographicLib by Charles F. F. Karney,\n// http://geographiclib.sourceforge.net/\n\nvar adder = function() {\n return new Adder;\n};\n\nfunction Adder() {\n this.reset();\n}\n\nAdder.prototype = {\n constructor: Adder,\n reset: function() {\n this.s = // rounded value\n this.t = 0; // exact error\n },\n add: function(y) {\n add$1(temp, y, this.t);\n add$1(this, temp.s, this.s);\n if (this.s) this.t += temp.t;\n else this.s = temp.t;\n },\n valueOf: function() {\n return this.s;\n }\n};\n\nvar temp = new Adder;\n\nfunction add$1(adder, a, b) {\n var x = adder.s = a + b,\n bv = x - a,\n av = x - bv;\n adder.t = (a - av) + (b - bv);\n}\n\nvar epsilon$2 = 1e-6;\nvar epsilon2$1 = 1e-12;\nvar pi$3 = Math.PI;\nvar halfPi$2 = pi$3 / 2;\nvar quarterPi = pi$3 / 4;\nvar tau$3 = pi$3 * 2;\n\nvar degrees$1 = 180 / pi$3;\nvar radians = pi$3 / 180;\n\nvar abs = Math.abs;\nvar atan = Math.atan;\nvar atan2 = Math.atan2;\nvar cos$1 = Math.cos;\nvar ceil = Math.ceil;\nvar exp = Math.exp;\n\nvar log = Math.log;\nvar pow = Math.pow;\nvar sin$1 = Math.sin;\nvar sign = Math.sign || function(x) { return x > 0 ? 1 : x < 0 ? -1 : 0; };\nvar sqrt = Math.sqrt;\nvar tan = Math.tan;\n\nfunction acos(x) {\n return x > 1 ? 0 : x < -1 ? pi$3 : Math.acos(x);\n}\n\nfunction asin(x) {\n return x > 1 ? halfPi$2 : x < -1 ? -halfPi$2 : Math.asin(x);\n}\n\nfunction haversin(x) {\n return (x = sin$1(x / 2)) * x;\n}\n\nfunction noop$1() {}\n\nfunction streamGeometry(geometry, stream) {\n if (geometry && streamGeometryType.hasOwnProperty(geometry.type)) {\n streamGeometryType[geometry.type](geometry, stream);\n }\n}\n\nvar streamObjectType = {\n Feature: function(object, stream) {\n streamGeometry(object.geometry, stream);\n },\n FeatureCollection: function(object, stream) {\n var features = object.features, i = -1, n = features.length;\n while (++i < n) streamGeometry(features[i].geometry, stream);\n }\n};\n\nvar streamGeometryType = {\n Sphere: function(object, stream) {\n stream.sphere();\n },\n Point: function(object, stream) {\n object = object.coordinates;\n stream.point(object[0], object[1], object[2]);\n },\n MultiPoint: function(object, stream) {\n var coordinates = object.coordinates, i = -1, n = coordinates.length;\n while (++i < n) object = coordinates[i], stream.point(object[0], object[1], object[2]);\n },\n LineString: function(object, stream) {\n streamLine(object.coordinates, stream, 0);\n },\n MultiLineString: function(object, stream) {\n var coordinates = object.coordinates, i = -1, n = coordinates.length;\n while (++i < n) streamLine(coordinates[i], stream, 0);\n },\n Polygon: function(object, stream) {\n streamPolygon(object.coordinates, stream);\n },\n MultiPolygon: function(object, stream) {\n var coordinates = object.coordinates, i = -1, n = coordinates.length;\n while (++i < n) streamPolygon(coordinates[i], stream);\n },\n GeometryCollection: function(object, stream) {\n var geometries = object.geometries, i = -1, n = geometries.length;\n while (++i < n) streamGeometry(geometries[i], stream);\n }\n};\n\nfunction streamLine(coordinates, stream, closed) {\n var i = -1, n = coordinates.length - closed, coordinate;\n stream.lineStart();\n while (++i < n) coordinate = coordinates[i], stream.point(coordinate[0], coordinate[1], coordinate[2]);\n stream.lineEnd();\n}\n\nfunction streamPolygon(coordinates, stream) {\n var i = -1, n = coordinates.length;\n stream.polygonStart();\n while (++i < n) streamLine(coordinates[i], stream, 1);\n stream.polygonEnd();\n}\n\nvar geoStream = function(object, stream) {\n if (object && streamObjectType.hasOwnProperty(object.type)) {\n streamObjectType[object.type](object, stream);\n } else {\n streamGeometry(object, stream);\n }\n};\n\nvar areaRingSum = adder();\n\nvar areaSum = adder();\nvar lambda00;\nvar phi00;\nvar lambda0;\nvar cosPhi0;\nvar sinPhi0;\n\nvar areaStream = {\n point: noop$1,\n lineStart: noop$1,\n lineEnd: noop$1,\n polygonStart: function() {\n areaRingSum.reset();\n areaStream.lineStart = areaRingStart;\n areaStream.lineEnd = areaRingEnd;\n },\n polygonEnd: function() {\n var areaRing = +areaRingSum;\n areaSum.add(areaRing < 0 ? tau$3 + areaRing : areaRing);\n this.lineStart = this.lineEnd = this.point = noop$1;\n },\n sphere: function() {\n areaSum.add(tau$3);\n }\n};\n\nfunction areaRingStart() {\n areaStream.point = areaPointFirst;\n}\n\nfunction areaRingEnd() {\n areaPoint(lambda00, phi00);\n}\n\nfunction areaPointFirst(lambda, phi) {\n areaStream.point = areaPoint;\n lambda00 = lambda, phi00 = phi;\n lambda *= radians, phi *= radians;\n lambda0 = lambda, cosPhi0 = cos$1(phi = phi / 2 + quarterPi), sinPhi0 = sin$1(phi);\n}\n\nfunction areaPoint(lambda, phi) {\n lambda *= radians, phi *= radians;\n phi = phi / 2 + quarterPi; // half the angular distance from south pole\n\n // Spherical excess E for a spherical triangle with vertices: south pole,\n // previous point, current point. Uses a formula derived from Cagnoli’s\n // theorem. See Todhunter, Spherical Trig. (1871), Sec. 103, Eq. (2).\n var dLambda = lambda - lambda0,\n sdLambda = dLambda >= 0 ? 1 : -1,\n adLambda = sdLambda * dLambda,\n cosPhi = cos$1(phi),\n sinPhi = sin$1(phi),\n k = sinPhi0 * sinPhi,\n u = cosPhi0 * cosPhi + k * cos$1(adLambda),\n v = k * sdLambda * sin$1(adLambda);\n areaRingSum.add(atan2(v, u));\n\n // Advance the previous points.\n lambda0 = lambda, cosPhi0 = cosPhi, sinPhi0 = sinPhi;\n}\n\nvar area = function(object) {\n areaSum.reset();\n geoStream(object, areaStream);\n return areaSum * 2;\n};\n\nfunction spherical(cartesian) {\n return [atan2(cartesian[1], cartesian[0]), asin(cartesian[2])];\n}\n\nfunction cartesian(spherical) {\n var lambda = spherical[0], phi = spherical[1], cosPhi = cos$1(phi);\n return [cosPhi * cos$1(lambda), cosPhi * sin$1(lambda), sin$1(phi)];\n}\n\nfunction cartesianDot(a, b) {\n return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];\n}\n\nfunction cartesianCross(a, b) {\n return [a[1] * b[2] - a[2] * b[1], a[2] * b[0] - a[0] * b[2], a[0] * b[1] - a[1] * b[0]];\n}\n\n// TODO return a\nfunction cartesianAddInPlace(a, b) {\n a[0] += b[0], a[1] += b[1], a[2] += b[2];\n}\n\nfunction cartesianScale(vector, k) {\n return [vector[0] * k, vector[1] * k, vector[2] * k];\n}\n\n// TODO return d\nfunction cartesianNormalizeInPlace(d) {\n var l = sqrt(d[0] * d[0] + d[1] * d[1] + d[2] * d[2]);\n d[0] /= l, d[1] /= l, d[2] /= l;\n}\n\nvar lambda0$1;\nvar phi0;\nvar lambda1;\nvar phi1;\nvar lambda2;\nvar lambda00$1;\nvar phi00$1;\nvar p0;\nvar deltaSum = adder();\nvar ranges;\nvar range;\n\nvar boundsStream = {\n point: boundsPoint,\n lineStart: boundsLineStart,\n lineEnd: boundsLineEnd,\n polygonStart: function() {\n boundsStream.point = boundsRingPoint;\n boundsStream.lineStart = boundsRingStart;\n boundsStream.lineEnd = boundsRingEnd;\n deltaSum.reset();\n areaStream.polygonStart();\n },\n polygonEnd: function() {\n areaStream.polygonEnd();\n boundsStream.point = boundsPoint;\n boundsStream.lineStart = boundsLineStart;\n boundsStream.lineEnd = boundsLineEnd;\n if (areaRingSum < 0) lambda0$1 = -(lambda1 = 180), phi0 = -(phi1 = 90);\n else if (deltaSum > epsilon$2) phi1 = 90;\n else if (deltaSum < -epsilon$2) phi0 = -90;\n range[0] = lambda0$1, range[1] = lambda1;\n }\n};\n\nfunction boundsPoint(lambda, phi) {\n ranges.push(range = [lambda0$1 = lambda, lambda1 = lambda]);\n if (phi < phi0) phi0 = phi;\n if (phi > phi1) phi1 = phi;\n}\n\nfunction linePoint(lambda, phi) {\n var p = cartesian([lambda * radians, phi * radians]);\n if (p0) {\n var normal = cartesianCross(p0, p),\n equatorial = [normal[1], -normal[0], 0],\n inflection = cartesianCross(equatorial, normal);\n cartesianNormalizeInPlace(inflection);\n inflection = spherical(inflection);\n var delta = lambda - lambda2,\n sign$$1 = delta > 0 ? 1 : -1,\n lambdai = inflection[0] * degrees$1 * sign$$1,\n phii,\n antimeridian = abs(delta) > 180;\n if (antimeridian ^ (sign$$1 * lambda2 < lambdai && lambdai < sign$$1 * lambda)) {\n phii = inflection[1] * degrees$1;\n if (phii > phi1) phi1 = phii;\n } else if (lambdai = (lambdai + 360) % 360 - 180, antimeridian ^ (sign$$1 * lambda2 < lambdai && lambdai < sign$$1 * lambda)) {\n phii = -inflection[1] * degrees$1;\n if (phii < phi0) phi0 = phii;\n } else {\n if (phi < phi0) phi0 = phi;\n if (phi > phi1) phi1 = phi;\n }\n if (antimeridian) {\n if (lambda < lambda2) {\n if (angle(lambda0$1, lambda) > angle(lambda0$1, lambda1)) lambda1 = lambda;\n } else {\n if (angle(lambda, lambda1) > angle(lambda0$1, lambda1)) lambda0$1 = lambda;\n }\n } else {\n if (lambda1 >= lambda0$1) {\n if (lambda < lambda0$1) lambda0$1 = lambda;\n if (lambda > lambda1) lambda1 = lambda;\n } else {\n if (lambda > lambda2) {\n if (angle(lambda0$1, lambda) > angle(lambda0$1, lambda1)) lambda1 = lambda;\n } else {\n if (angle(lambda, lambda1) > angle(lambda0$1, lambda1)) lambda0$1 = lambda;\n }\n }\n }\n } else {\n ranges.push(range = [lambda0$1 = lambda, lambda1 = lambda]);\n }\n if (phi < phi0) phi0 = phi;\n if (phi > phi1) phi1 = phi;\n p0 = p, lambda2 = lambda;\n}\n\nfunction boundsLineStart() {\n boundsStream.point = linePoint;\n}\n\nfunction boundsLineEnd() {\n range[0] = lambda0$1, range[1] = lambda1;\n boundsStream.point = boundsPoint;\n p0 = null;\n}\n\nfunction boundsRingPoint(lambda, phi) {\n if (p0) {\n var delta = lambda - lambda2;\n deltaSum.add(abs(delta) > 180 ? delta + (delta > 0 ? 360 : -360) : delta);\n } else {\n lambda00$1 = lambda, phi00$1 = phi;\n }\n areaStream.point(lambda, phi);\n linePoint(lambda, phi);\n}\n\nfunction boundsRingStart() {\n areaStream.lineStart();\n}\n\nfunction boundsRingEnd() {\n boundsRingPoint(lambda00$1, phi00$1);\n areaStream.lineEnd();\n if (abs(deltaSum) > epsilon$2) lambda0$1 = -(lambda1 = 180);\n range[0] = lambda0$1, range[1] = lambda1;\n p0 = null;\n}\n\n// Finds the left-right distance between two longitudes.\n// This is almost the same as (lambda1 - lambda0 + 360°) % 360°, except that we want\n// the distance between ±180° to be 360°.\nfunction angle(lambda0, lambda1) {\n return (lambda1 -= lambda0) < 0 ? lambda1 + 360 : lambda1;\n}\n\nfunction rangeCompare(a, b) {\n return a[0] - b[0];\n}\n\nfunction rangeContains(range, x) {\n return range[0] <= range[1] ? range[0] <= x && x <= range[1] : x < range[0] || range[1] < x;\n}\n\nvar bounds = function(feature) {\n var i, n, a, b, merged, deltaMax, delta;\n\n phi1 = lambda1 = -(lambda0$1 = phi0 = Infinity);\n ranges = [];\n geoStream(feature, boundsStream);\n\n // First, sort ranges by their minimum longitudes.\n if (n = ranges.length) {\n ranges.sort(rangeCompare);\n\n // Then, merge any ranges that overlap.\n for (i = 1, a = ranges[0], merged = [a]; i < n; ++i) {\n b = ranges[i];\n if (rangeContains(a, b[0]) || rangeContains(a, b[1])) {\n if (angle(a[0], b[1]) > angle(a[0], a[1])) a[1] = b[1];\n if (angle(b[0], a[1]) > angle(a[0], a[1])) a[0] = b[0];\n } else {\n merged.push(a = b);\n }\n }\n\n // Finally, find the largest gap between the merged ranges.\n // The final bounding box will be the inverse of this gap.\n for (deltaMax = -Infinity, n = merged.length - 1, i = 0, a = merged[n]; i <= n; a = b, ++i) {\n b = merged[i];\n if ((delta = angle(a[1], b[0])) > deltaMax) deltaMax = delta, lambda0$1 = b[0], lambda1 = a[1];\n }\n }\n\n ranges = range = null;\n\n return lambda0$1 === Infinity || phi0 === Infinity\n ? [[NaN, NaN], [NaN, NaN]]\n : [[lambda0$1, phi0], [lambda1, phi1]];\n};\n\nvar W0;\nvar W1;\nvar X0;\nvar Y0;\nvar Z0;\nvar X1;\nvar Y1;\nvar Z1;\nvar X2;\nvar Y2;\nvar Z2;\nvar lambda00$2;\nvar phi00$2;\nvar x0;\nvar y0;\nvar z0; // previous point\n\nvar centroidStream = {\n sphere: noop$1,\n point: centroidPoint,\n lineStart: centroidLineStart,\n lineEnd: centroidLineEnd,\n polygonStart: function() {\n centroidStream.lineStart = centroidRingStart;\n centroidStream.lineEnd = centroidRingEnd;\n },\n polygonEnd: function() {\n centroidStream.lineStart = centroidLineStart;\n centroidStream.lineEnd = centroidLineEnd;\n }\n};\n\n// Arithmetic mean of Cartesian vectors.\nfunction centroidPoint(lambda, phi) {\n lambda *= radians, phi *= radians;\n var cosPhi = cos$1(phi);\n centroidPointCartesian(cosPhi * cos$1(lambda), cosPhi * sin$1(lambda), sin$1(phi));\n}\n\nfunction centroidPointCartesian(x, y, z) {\n ++W0;\n X0 += (x - X0) / W0;\n Y0 += (y - Y0) / W0;\n Z0 += (z - Z0) / W0;\n}\n\nfunction centroidLineStart() {\n centroidStream.point = centroidLinePointFirst;\n}\n\nfunction centroidLinePointFirst(lambda, phi) {\n lambda *= radians, phi *= radians;\n var cosPhi = cos$1(phi);\n x0 = cosPhi * cos$1(lambda);\n y0 = cosPhi * sin$1(lambda);\n z0 = sin$1(phi);\n centroidStream.point = centroidLinePoint;\n centroidPointCartesian(x0, y0, z0);\n}\n\nfunction centroidLinePoint(lambda, phi) {\n lambda *= radians, phi *= radians;\n var cosPhi = cos$1(phi),\n x = cosPhi * cos$1(lambda),\n y = cosPhi * sin$1(lambda),\n z = sin$1(phi),\n w = atan2(sqrt((w = y0 * z - z0 * y) * w + (w = z0 * x - x0 * z) * w + (w = x0 * y - y0 * x) * w), x0 * x + y0 * y + z0 * z);\n W1 += w;\n X1 += w * (x0 + (x0 = x));\n Y1 += w * (y0 + (y0 = y));\n Z1 += w * (z0 + (z0 = z));\n centroidPointCartesian(x0, y0, z0);\n}\n\nfunction centroidLineEnd() {\n centroidStream.point = centroidPoint;\n}\n\n// See J. E. Brock, The Inertia Tensor for a Spherical Triangle,\n// J. Applied Mechanics 42, 239 (1975).\nfunction centroidRingStart() {\n centroidStream.point = centroidRingPointFirst;\n}\n\nfunction centroidRingEnd() {\n centroidRingPoint(lambda00$2, phi00$2);\n centroidStream.point = centroidPoint;\n}\n\nfunction centroidRingPointFirst(lambda, phi) {\n lambda00$2 = lambda, phi00$2 = phi;\n lambda *= radians, phi *= radians;\n centroidStream.point = centroidRingPoint;\n var cosPhi = cos$1(phi);\n x0 = cosPhi * cos$1(lambda);\n y0 = cosPhi * sin$1(lambda);\n z0 = sin$1(phi);\n centroidPointCartesian(x0, y0, z0);\n}\n\nfunction centroidRingPoint(lambda, phi) {\n lambda *= radians, phi *= radians;\n var cosPhi = cos$1(phi),\n x = cosPhi * cos$1(lambda),\n y = cosPhi * sin$1(lambda),\n z = sin$1(phi),\n cx = y0 * z - z0 * y,\n cy = z0 * x - x0 * z,\n cz = x0 * y - y0 * x,\n m = sqrt(cx * cx + cy * cy + cz * cz),\n w = asin(m), // line weight = angle\n v = m && -w / m; // area weight multiplier\n X2 += v * cx;\n Y2 += v * cy;\n Z2 += v * cz;\n W1 += w;\n X1 += w * (x0 + (x0 = x));\n Y1 += w * (y0 + (y0 = y));\n Z1 += w * (z0 + (z0 = z));\n centroidPointCartesian(x0, y0, z0);\n}\n\nvar centroid = function(object) {\n W0 = W1 =\n X0 = Y0 = Z0 =\n X1 = Y1 = Z1 =\n X2 = Y2 = Z2 = 0;\n geoStream(object, centroidStream);\n\n var x = X2,\n y = Y2,\n z = Z2,\n m = x * x + y * y + z * z;\n\n // If the area-weighted ccentroid is undefined, fall back to length-weighted ccentroid.\n if (m < epsilon2$1) {\n x = X1, y = Y1, z = Z1;\n // If the feature has zero length, fall back to arithmetic mean of point vectors.\n if (W1 < epsilon$2) x = X0, y = Y0, z = Z0;\n m = x * x + y * y + z * z;\n // If the feature still has an undefined ccentroid, then return.\n if (m < epsilon2$1) return [NaN, NaN];\n }\n\n return [atan2(y, x) * degrees$1, asin(z / sqrt(m)) * degrees$1];\n};\n\nvar constant$7 = function(x) {\n return function() {\n return x;\n };\n};\n\nvar compose = function(a, b) {\n\n function compose(x, y) {\n return x = a(x, y), b(x[0], x[1]);\n }\n\n if (a.invert && b.invert) compose.invert = function(x, y) {\n return x = b.invert(x, y), x && a.invert(x[0], x[1]);\n };\n\n return compose;\n};\n\nfunction rotationIdentity(lambda, phi) {\n return [lambda > pi$3 ? lambda - tau$3 : lambda < -pi$3 ? lambda + tau$3 : lambda, phi];\n}\n\nrotationIdentity.invert = rotationIdentity;\n\nfunction rotateRadians(deltaLambda, deltaPhi, deltaGamma) {\n return (deltaLambda %= tau$3) ? (deltaPhi || deltaGamma ? compose(rotationLambda(deltaLambda), rotationPhiGamma(deltaPhi, deltaGamma))\n : rotationLambda(deltaLambda))\n : (deltaPhi || deltaGamma ? rotationPhiGamma(deltaPhi, deltaGamma)\n : rotationIdentity);\n}\n\nfunction forwardRotationLambda(deltaLambda) {\n return function(lambda, phi) {\n return lambda += deltaLambda, [lambda > pi$3 ? lambda - tau$3 : lambda < -pi$3 ? lambda + tau$3 : lambda, phi];\n };\n}\n\nfunction rotationLambda(deltaLambda) {\n var rotation = forwardRotationLambda(deltaLambda);\n rotation.invert = forwardRotationLambda(-deltaLambda);\n return rotation;\n}\n\nfunction rotationPhiGamma(deltaPhi, deltaGamma) {\n var cosDeltaPhi = cos$1(deltaPhi),\n sinDeltaPhi = sin$1(deltaPhi),\n cosDeltaGamma = cos$1(deltaGamma),\n sinDeltaGamma = sin$1(deltaGamma);\n\n function rotation(lambda, phi) {\n var cosPhi = cos$1(phi),\n x = cos$1(lambda) * cosPhi,\n y = sin$1(lambda) * cosPhi,\n z = sin$1(phi),\n k = z * cosDeltaPhi + x * sinDeltaPhi;\n return [\n atan2(y * cosDeltaGamma - k * sinDeltaGamma, x * cosDeltaPhi - z * sinDeltaPhi),\n asin(k * cosDeltaGamma + y * sinDeltaGamma)\n ];\n }\n\n rotation.invert = function(lambda, phi) {\n var cosPhi = cos$1(phi),\n x = cos$1(lambda) * cosPhi,\n y = sin$1(lambda) * cosPhi,\n z = sin$1(phi),\n k = z * cosDeltaGamma - y * sinDeltaGamma;\n return [\n atan2(y * cosDeltaGamma + z * sinDeltaGamma, x * cosDeltaPhi + k * sinDeltaPhi),\n asin(k * cosDeltaPhi - x * sinDeltaPhi)\n ];\n };\n\n return rotation;\n}\n\nvar rotation = function(rotate) {\n rotate = rotateRadians(rotate[0] * radians, rotate[1] * radians, rotate.length > 2 ? rotate[2] * radians : 0);\n\n function forward(coordinates) {\n coordinates = rotate(coordinates[0] * radians, coordinates[1] * radians);\n return coordinates[0] *= degrees$1, coordinates[1] *= degrees$1, coordinates;\n }\n\n forward.invert = function(coordinates) {\n coordinates = rotate.invert(coordinates[0] * radians, coordinates[1] * radians);\n return coordinates[0] *= degrees$1, coordinates[1] *= degrees$1, coordinates;\n };\n\n return forward;\n};\n\n// Generates a circle centered at [0°, 0°], with a given radius and precision.\nfunction circleStream(stream, radius, delta, direction, t0, t1) {\n if (!delta) return;\n var cosRadius = cos$1(radius),\n sinRadius = sin$1(radius),\n step = direction * delta;\n if (t0 == null) {\n t0 = radius + direction * tau$3;\n t1 = radius - step / 2;\n } else {\n t0 = circleRadius(cosRadius, t0);\n t1 = circleRadius(cosRadius, t1);\n if (direction > 0 ? t0 < t1 : t0 > t1) t0 += direction * tau$3;\n }\n for (var point, t = t0; direction > 0 ? t > t1 : t < t1; t -= step) {\n point = spherical([cosRadius, -sinRadius * cos$1(t), -sinRadius * sin$1(t)]);\n stream.point(point[0], point[1]);\n }\n}\n\n// Returns the signed angle of a cartesian point relative to [cosRadius, 0, 0].\nfunction circleRadius(cosRadius, point) {\n point = cartesian(point), point[0] -= cosRadius;\n cartesianNormalizeInPlace(point);\n var radius = acos(-point[1]);\n return ((-point[2] < 0 ? -radius : radius) + tau$3 - epsilon$2) % tau$3;\n}\n\nvar circle = function() {\n var center = constant$7([0, 0]),\n radius = constant$7(90),\n precision = constant$7(6),\n ring,\n rotate,\n stream = {point: point};\n\n function point(x, y) {\n ring.push(x = rotate(x, y));\n x[0] *= degrees$1, x[1] *= degrees$1;\n }\n\n function circle() {\n var c = center.apply(this, arguments),\n r = radius.apply(this, arguments) * radians,\n p = precision.apply(this, arguments) * radians;\n ring = [];\n rotate = rotateRadians(-c[0] * radians, -c[1] * radians, 0).invert;\n circleStream(stream, r, p, 1);\n c = {type: \"Polygon\", coordinates: [ring]};\n ring = rotate = null;\n return c;\n }\n\n circle.center = function(_) {\n return arguments.length ? (center = typeof _ === \"function\" ? _ : constant$7([+_[0], +_[1]]), circle) : center;\n };\n\n circle.radius = function(_) {\n return arguments.length ? (radius = typeof _ === \"function\" ? _ : constant$7(+_), circle) : radius;\n };\n\n circle.precision = function(_) {\n return arguments.length ? (precision = typeof _ === \"function\" ? _ : constant$7(+_), circle) : precision;\n };\n\n return circle;\n};\n\nvar clipBuffer = function() {\n var lines = [],\n line;\n return {\n point: function(x, y) {\n line.push([x, y]);\n },\n lineStart: function() {\n lines.push(line = []);\n },\n lineEnd: noop$1,\n rejoin: function() {\n if (lines.length > 1) lines.push(lines.pop().concat(lines.shift()));\n },\n result: function() {\n var result = lines;\n lines = [];\n line = null;\n return result;\n }\n };\n};\n\nvar pointEqual = function(a, b) {\n return abs(a[0] - b[0]) < epsilon$2 && abs(a[1] - b[1]) < epsilon$2;\n};\n\nfunction Intersection(point, points, other, entry) {\n this.x = point;\n this.z = points;\n this.o = other; // another intersection\n this.e = entry; // is an entry?\n this.v = false; // visited\n this.n = this.p = null; // next & previous\n}\n\n// A generalized polygon clipping algorithm: given a polygon that has been cut\n// into its visible line segments, and rejoins the segments by interpolating\n// along the clip edge.\nvar clipRejoin = function(segments, compareIntersection, startInside, interpolate, stream) {\n var subject = [],\n clip = [],\n i,\n n;\n\n segments.forEach(function(segment) {\n if ((n = segment.length - 1) <= 0) return;\n var n, p0 = segment[0], p1 = segment[n], x;\n\n // If the first and last points of a segment are coincident, then treat as a\n // closed ring. TODO if all rings are closed, then the winding order of the\n // exterior ring should be checked.\n if (pointEqual(p0, p1)) {\n stream.lineStart();\n for (i = 0; i < n; ++i) stream.point((p0 = segment[i])[0], p0[1]);\n stream.lineEnd();\n return;\n }\n\n subject.push(x = new Intersection(p0, segment, null, true));\n clip.push(x.o = new Intersection(p0, null, x, false));\n subject.push(x = new Intersection(p1, segment, null, false));\n clip.push(x.o = new Intersection(p1, null, x, true));\n });\n\n if (!subject.length) return;\n\n clip.sort(compareIntersection);\n link$1(subject);\n link$1(clip);\n\n for (i = 0, n = clip.length; i < n; ++i) {\n clip[i].e = startInside = !startInside;\n }\n\n var start = subject[0],\n points,\n point;\n\n while (1) {\n // Find first unvisited intersection.\n var current = start,\n isSubject = true;\n while (current.v) if ((current = current.n) === start) return;\n points = current.z;\n stream.lineStart();\n do {\n current.v = current.o.v = true;\n if (current.e) {\n if (isSubject) {\n for (i = 0, n = points.length; i < n; ++i) stream.point((point = points[i])[0], point[1]);\n } else {\n interpolate(current.x, current.n.x, 1, stream);\n }\n current = current.n;\n } else {\n if (isSubject) {\n points = current.p.z;\n for (i = points.length - 1; i >= 0; --i) stream.point((point = points[i])[0], point[1]);\n } else {\n interpolate(current.x, current.p.x, -1, stream);\n }\n current = current.p;\n }\n current = current.o;\n points = current.z;\n isSubject = !isSubject;\n } while (!current.v);\n stream.lineEnd();\n }\n};\n\nfunction link$1(array) {\n if (!(n = array.length)) return;\n var n,\n i = 0,\n a = array[0],\n b;\n while (++i < n) {\n a.n = b = array[i];\n b.p = a;\n a = b;\n }\n a.n = b = array[0];\n b.p = a;\n}\n\nvar sum$1 = adder();\n\nvar polygonContains = function(polygon, point) {\n var lambda = point[0],\n phi = point[1],\n normal = [sin$1(lambda), -cos$1(lambda), 0],\n angle = 0,\n winding = 0;\n\n sum$1.reset();\n\n for (var i = 0, n = polygon.length; i < n; ++i) {\n if (!(m = (ring = polygon[i]).length)) continue;\n var ring,\n m,\n point0 = ring[m - 1],\n lambda0 = point0[0],\n phi0 = point0[1] / 2 + quarterPi,\n sinPhi0 = sin$1(phi0),\n cosPhi0 = cos$1(phi0);\n\n for (var j = 0; j < m; ++j, lambda0 = lambda1, sinPhi0 = sinPhi1, cosPhi0 = cosPhi1, point0 = point1) {\n var point1 = ring[j],\n lambda1 = point1[0],\n phi1 = point1[1] / 2 + quarterPi,\n sinPhi1 = sin$1(phi1),\n cosPhi1 = cos$1(phi1),\n delta = lambda1 - lambda0,\n sign$$1 = delta >= 0 ? 1 : -1,\n absDelta = sign$$1 * delta,\n antimeridian = absDelta > pi$3,\n k = sinPhi0 * sinPhi1;\n\n sum$1.add(atan2(k * sign$$1 * sin$1(absDelta), cosPhi0 * cosPhi1 + k * cos$1(absDelta)));\n angle += antimeridian ? delta + sign$$1 * tau$3 : delta;\n\n // Are the longitudes either side of the point’s meridian (lambda),\n // and are the latitudes smaller than the parallel (phi)?\n if (antimeridian ^ lambda0 >= lambda ^ lambda1 >= lambda) {\n var arc = cartesianCross(cartesian(point0), cartesian(point1));\n cartesianNormalizeInPlace(arc);\n var intersection = cartesianCross(normal, arc);\n cartesianNormalizeInPlace(intersection);\n var phiArc = (antimeridian ^ delta >= 0 ? -1 : 1) * asin(intersection[2]);\n if (phi > phiArc || phi === phiArc && (arc[0] || arc[1])) {\n winding += antimeridian ^ delta >= 0 ? 1 : -1;\n }\n }\n }\n }\n\n // First, determine whether the South pole is inside or outside:\n //\n // It is inside if:\n // * the polygon winds around it in a clockwise direction.\n // * the polygon does not (cumulatively) wind around it, but has a negative\n // (counter-clockwise) area.\n //\n // Second, count the (signed) number of times a segment crosses a lambda\n // from the point to the South pole. If it is zero, then the point is the\n // same side as the South pole.\n\n return (angle < -epsilon$2 || angle < epsilon$2 && sum$1 < -epsilon$2) ^ (winding & 1);\n};\n\nvar clip = function(pointVisible, clipLine, interpolate, start) {\n return function(sink) {\n var line = clipLine(sink),\n ringBuffer = clipBuffer(),\n ringSink = clipLine(ringBuffer),\n polygonStarted = false,\n polygon,\n segments,\n ring;\n\n var clip = {\n point: point,\n lineStart: lineStart,\n lineEnd: lineEnd,\n polygonStart: function() {\n clip.point = pointRing;\n clip.lineStart = ringStart;\n clip.lineEnd = ringEnd;\n segments = [];\n polygon = [];\n },\n polygonEnd: function() {\n clip.point = point;\n clip.lineStart = lineStart;\n clip.lineEnd = lineEnd;\n segments = merge(segments);\n var startInside = polygonContains(polygon, start);\n if (segments.length) {\n if (!polygonStarted) sink.polygonStart(), polygonStarted = true;\n clipRejoin(segments, compareIntersection, startInside, interpolate, sink);\n } else if (startInside) {\n if (!polygonStarted) sink.polygonStart(), polygonStarted = true;\n sink.lineStart();\n interpolate(null, null, 1, sink);\n sink.lineEnd();\n }\n if (polygonStarted) sink.polygonEnd(), polygonStarted = false;\n segments = polygon = null;\n },\n sphere: function() {\n sink.polygonStart();\n sink.lineStart();\n interpolate(null, null, 1, sink);\n sink.lineEnd();\n sink.polygonEnd();\n }\n };\n\n function point(lambda, phi) {\n if (pointVisible(lambda, phi)) sink.point(lambda, phi);\n }\n\n function pointLine(lambda, phi) {\n line.point(lambda, phi);\n }\n\n function lineStart() {\n clip.point = pointLine;\n line.lineStart();\n }\n\n function lineEnd() {\n clip.point = point;\n line.lineEnd();\n }\n\n function pointRing(lambda, phi) {\n ring.push([lambda, phi]);\n ringSink.point(lambda, phi);\n }\n\n function ringStart() {\n ringSink.lineStart();\n ring = [];\n }\n\n function ringEnd() {\n pointRing(ring[0][0], ring[0][1]);\n ringSink.lineEnd();\n\n var clean = ringSink.clean(),\n ringSegments = ringBuffer.result(),\n i, n = ringSegments.length, m,\n segment,\n point;\n\n ring.pop();\n polygon.push(ring);\n ring = null;\n\n if (!n) return;\n\n // No intersections.\n if (clean & 1) {\n segment = ringSegments[0];\n if ((m = segment.length - 1) > 0) {\n if (!polygonStarted) sink.polygonStart(), polygonStarted = true;\n sink.lineStart();\n for (i = 0; i < m; ++i) sink.point((point = segment[i])[0], point[1]);\n sink.lineEnd();\n }\n return;\n }\n\n // Rejoin connected segments.\n // TODO reuse ringBuffer.rejoin()?\n if (n > 1 && clean & 2) ringSegments.push(ringSegments.pop().concat(ringSegments.shift()));\n\n segments.push(ringSegments.filter(validSegment));\n }\n\n return clip;\n };\n};\n\nfunction validSegment(segment) {\n return segment.length > 1;\n}\n\n// Intersections are sorted along the clip edge. For both antimeridian cutting\n// and circle clipping, the same comparison is used.\nfunction compareIntersection(a, b) {\n return ((a = a.x)[0] < 0 ? a[1] - halfPi$2 - epsilon$2 : halfPi$2 - a[1])\n - ((b = b.x)[0] < 0 ? b[1] - halfPi$2 - epsilon$2 : halfPi$2 - b[1]);\n}\n\nvar clipAntimeridian = clip(\n function() { return true; },\n clipAntimeridianLine,\n clipAntimeridianInterpolate,\n [-pi$3, -halfPi$2]\n);\n\n// Takes a line and cuts into visible segments. Return values: 0 - there were\n// intersections or the line was empty; 1 - no intersections; 2 - there were\n// intersections, and the first and last segments should be rejoined.\nfunction clipAntimeridianLine(stream) {\n var lambda0 = NaN,\n phi0 = NaN,\n sign0 = NaN,\n clean; // no intersections\n\n return {\n lineStart: function() {\n stream.lineStart();\n clean = 1;\n },\n point: function(lambda1, phi1) {\n var sign1 = lambda1 > 0 ? pi$3 : -pi$3,\n delta = abs(lambda1 - lambda0);\n if (abs(delta - pi$3) < epsilon$2) { // line crosses a pole\n stream.point(lambda0, phi0 = (phi0 + phi1) / 2 > 0 ? halfPi$2 : -halfPi$2);\n stream.point(sign0, phi0);\n stream.lineEnd();\n stream.lineStart();\n stream.point(sign1, phi0);\n stream.point(lambda1, phi0);\n clean = 0;\n } else if (sign0 !== sign1 && delta >= pi$3) { // line crosses antimeridian\n if (abs(lambda0 - sign0) < epsilon$2) lambda0 -= sign0 * epsilon$2; // handle degeneracies\n if (abs(lambda1 - sign1) < epsilon$2) lambda1 -= sign1 * epsilon$2;\n phi0 = clipAntimeridianIntersect(lambda0, phi0, lambda1, phi1);\n stream.point(sign0, phi0);\n stream.lineEnd();\n stream.lineStart();\n stream.point(sign1, phi0);\n clean = 0;\n }\n stream.point(lambda0 = lambda1, phi0 = phi1);\n sign0 = sign1;\n },\n lineEnd: function() {\n stream.lineEnd();\n lambda0 = phi0 = NaN;\n },\n clean: function() {\n return 2 - clean; // if intersections, rejoin first and last segments\n }\n };\n}\n\nfunction clipAntimeridianIntersect(lambda0, phi0, lambda1, phi1) {\n var cosPhi0,\n cosPhi1,\n sinLambda0Lambda1 = sin$1(lambda0 - lambda1);\n return abs(sinLambda0Lambda1) > epsilon$2\n ? atan((sin$1(phi0) * (cosPhi1 = cos$1(phi1)) * sin$1(lambda1)\n - sin$1(phi1) * (cosPhi0 = cos$1(phi0)) * sin$1(lambda0))\n / (cosPhi0 * cosPhi1 * sinLambda0Lambda1))\n : (phi0 + phi1) / 2;\n}\n\nfunction clipAntimeridianInterpolate(from, to, direction, stream) {\n var phi;\n if (from == null) {\n phi = direction * halfPi$2;\n stream.point(-pi$3, phi);\n stream.point(0, phi);\n stream.point(pi$3, phi);\n stream.point(pi$3, 0);\n stream.point(pi$3, -phi);\n stream.point(0, -phi);\n stream.point(-pi$3, -phi);\n stream.point(-pi$3, 0);\n stream.point(-pi$3, phi);\n } else if (abs(from[0] - to[0]) > epsilon$2) {\n var lambda = from[0] < to[0] ? pi$3 : -pi$3;\n phi = direction * lambda / 2;\n stream.point(-lambda, phi);\n stream.point(0, phi);\n stream.point(lambda, phi);\n } else {\n stream.point(to[0], to[1]);\n }\n}\n\nvar clipCircle = function(radius) {\n var cr = cos$1(radius),\n delta = 6 * radians,\n smallRadius = cr > 0,\n notHemisphere = abs(cr) > epsilon$2; // TODO optimise for this common case\n\n function interpolate(from, to, direction, stream) {\n circleStream(stream, radius, delta, direction, from, to);\n }\n\n function visible(lambda, phi) {\n return cos$1(lambda) * cos$1(phi) > cr;\n }\n\n // Takes a line and cuts into visible segments. Return values used for polygon\n // clipping: 0 - there were intersections or the line was empty; 1 - no\n // intersections 2 - there were intersections, and the first and last segments\n // should be rejoined.\n function clipLine(stream) {\n var point0, // previous point\n c0, // code for previous point\n v0, // visibility of previous point\n v00, // visibility of first point\n clean; // no intersections\n return {\n lineStart: function() {\n v00 = v0 = false;\n clean = 1;\n },\n point: function(lambda, phi) {\n var point1 = [lambda, phi],\n point2,\n v = visible(lambda, phi),\n c = smallRadius\n ? v ? 0 : code(lambda, phi)\n : v ? code(lambda + (lambda < 0 ? pi$3 : -pi$3), phi) : 0;\n if (!point0 && (v00 = v0 = v)) stream.lineStart();\n // Handle degeneracies.\n // TODO ignore if not clipping polygons.\n if (v !== v0) {\n point2 = intersect(point0, point1);\n if (!point2 || pointEqual(point0, point2) || pointEqual(point1, point2)) {\n point1[0] += epsilon$2;\n point1[1] += epsilon$2;\n v = visible(point1[0], point1[1]);\n }\n }\n if (v !== v0) {\n clean = 0;\n if (v) {\n // outside going in\n stream.lineStart();\n point2 = intersect(point1, point0);\n stream.point(point2[0], point2[1]);\n } else {\n // inside going out\n point2 = intersect(point0, point1);\n stream.point(point2[0], point2[1]);\n stream.lineEnd();\n }\n point0 = point2;\n } else if (notHemisphere && point0 && smallRadius ^ v) {\n var t;\n // If the codes for two points are different, or are both zero,\n // and there this segment intersects with the small circle.\n if (!(c & c0) && (t = intersect(point1, point0, true))) {\n clean = 0;\n if (smallRadius) {\n stream.lineStart();\n stream.point(t[0][0], t[0][1]);\n stream.point(t[1][0], t[1][1]);\n stream.lineEnd();\n } else {\n stream.point(t[1][0], t[1][1]);\n stream.lineEnd();\n stream.lineStart();\n stream.point(t[0][0], t[0][1]);\n }\n }\n }\n if (v && (!point0 || !pointEqual(point0, point1))) {\n stream.point(point1[0], point1[1]);\n }\n point0 = point1, v0 = v, c0 = c;\n },\n lineEnd: function() {\n if (v0) stream.lineEnd();\n point0 = null;\n },\n // Rejoin first and last segments if there were intersections and the first\n // and last points were visible.\n clean: function() {\n return clean | ((v00 && v0) << 1);\n }\n };\n }\n\n // Intersects the great circle between a and b with the clip circle.\n function intersect(a, b, two) {\n var pa = cartesian(a),\n pb = cartesian(b);\n\n // We have two planes, n1.p = d1 and n2.p = d2.\n // Find intersection line p(t) = c1 n1 + c2 n2 + t (n1 ⨯ n2).\n var n1 = [1, 0, 0], // normal\n n2 = cartesianCross(pa, pb),\n n2n2 = cartesianDot(n2, n2),\n n1n2 = n2[0], // cartesianDot(n1, n2),\n determinant = n2n2 - n1n2 * n1n2;\n\n // Two polar points.\n if (!determinant) return !two && a;\n\n var c1 = cr * n2n2 / determinant,\n c2 = -cr * n1n2 / determinant,\n n1xn2 = cartesianCross(n1, n2),\n A = cartesianScale(n1, c1),\n B = cartesianScale(n2, c2);\n cartesianAddInPlace(A, B);\n\n // Solve |p(t)|^2 = 1.\n var u = n1xn2,\n w = cartesianDot(A, u),\n uu = cartesianDot(u, u),\n t2 = w * w - uu * (cartesianDot(A, A) - 1);\n\n if (t2 < 0) return;\n\n var t = sqrt(t2),\n q = cartesianScale(u, (-w - t) / uu);\n cartesianAddInPlace(q, A);\n q = spherical(q);\n\n if (!two) return q;\n\n // Two intersection points.\n var lambda0 = a[0],\n lambda1 = b[0],\n phi0 = a[1],\n phi1 = b[1],\n z;\n\n if (lambda1 < lambda0) z = lambda0, lambda0 = lambda1, lambda1 = z;\n\n var delta = lambda1 - lambda0,\n polar = abs(delta - pi$3) < epsilon$2,\n meridian = polar || delta < epsilon$2;\n\n if (!polar && phi1 < phi0) z = phi0, phi0 = phi1, phi1 = z;\n\n // Check that the first point is between a and b.\n if (meridian\n ? polar\n ? phi0 + phi1 > 0 ^ q[1] < (abs(q[0] - lambda0) < epsilon$2 ? phi0 : phi1)\n : phi0 <= q[1] && q[1] <= phi1\n : delta > pi$3 ^ (lambda0 <= q[0] && q[0] <= lambda1)) {\n var q1 = cartesianScale(u, (-w + t) / uu);\n cartesianAddInPlace(q1, A);\n return [q, spherical(q1)];\n }\n }\n\n // Generates a 4-bit vector representing the location of a point relative to\n // the small circle's bounding box.\n function code(lambda, phi) {\n var r = smallRadius ? radius : pi$3 - radius,\n code = 0;\n if (lambda < -r) code |= 1; // left\n else if (lambda > r) code |= 2; // right\n if (phi < -r) code |= 4; // below\n else if (phi > r) code |= 8; // above\n return code;\n }\n\n return clip(visible, clipLine, interpolate, smallRadius ? [0, -radius] : [-pi$3, radius - pi$3]);\n};\n\nvar clipLine = function(a, b, x0, y0, x1, y1) {\n var ax = a[0],\n ay = a[1],\n bx = b[0],\n by = b[1],\n t0 = 0,\n t1 = 1,\n dx = bx - ax,\n dy = by - ay,\n r;\n\n r = x0 - ax;\n if (!dx && r > 0) return;\n r /= dx;\n if (dx < 0) {\n if (r < t0) return;\n if (r < t1) t1 = r;\n } else if (dx > 0) {\n if (r > t1) return;\n if (r > t0) t0 = r;\n }\n\n r = x1 - ax;\n if (!dx && r < 0) return;\n r /= dx;\n if (dx < 0) {\n if (r > t1) return;\n if (r > t0) t0 = r;\n } else if (dx > 0) {\n if (r < t0) return;\n if (r < t1) t1 = r;\n }\n\n r = y0 - ay;\n if (!dy && r > 0) return;\n r /= dy;\n if (dy < 0) {\n if (r < t0) return;\n if (r < t1) t1 = r;\n } else if (dy > 0) {\n if (r > t1) return;\n if (r > t0) t0 = r;\n }\n\n r = y1 - ay;\n if (!dy && r < 0) return;\n r /= dy;\n if (dy < 0) {\n if (r > t1) return;\n if (r > t0) t0 = r;\n } else if (dy > 0) {\n if (r < t0) return;\n if (r < t1) t1 = r;\n }\n\n if (t0 > 0) a[0] = ax + t0 * dx, a[1] = ay + t0 * dy;\n if (t1 < 1) b[0] = ax + t1 * dx, b[1] = ay + t1 * dy;\n return true;\n};\n\nvar clipMax = 1e9;\nvar clipMin = -clipMax;\n\n// TODO Use d3-polygon’s polygonContains here for the ring check?\n// TODO Eliminate duplicate buffering in clipBuffer and polygon.push?\n\nfunction clipRectangle(x0, y0, x1, y1) {\n\n function visible(x, y) {\n return x0 <= x && x <= x1 && y0 <= y && y <= y1;\n }\n\n function interpolate(from, to, direction, stream) {\n var a = 0, a1 = 0;\n if (from == null\n || (a = corner(from, direction)) !== (a1 = corner(to, direction))\n || comparePoint(from, to) < 0 ^ direction > 0) {\n do stream.point(a === 0 || a === 3 ? x0 : x1, a > 1 ? y1 : y0);\n while ((a = (a + direction + 4) % 4) !== a1);\n } else {\n stream.point(to[0], to[1]);\n }\n }\n\n function corner(p, direction) {\n return abs(p[0] - x0) < epsilon$2 ? direction > 0 ? 0 : 3\n : abs(p[0] - x1) < epsilon$2 ? direction > 0 ? 2 : 1\n : abs(p[1] - y0) < epsilon$2 ? direction > 0 ? 1 : 0\n : direction > 0 ? 3 : 2; // abs(p[1] - y1) < epsilon\n }\n\n function compareIntersection(a, b) {\n return comparePoint(a.x, b.x);\n }\n\n function comparePoint(a, b) {\n var ca = corner(a, 1),\n cb = corner(b, 1);\n return ca !== cb ? ca - cb\n : ca === 0 ? b[1] - a[1]\n : ca === 1 ? a[0] - b[0]\n : ca === 2 ? a[1] - b[1]\n : b[0] - a[0];\n }\n\n return function(stream) {\n var activeStream = stream,\n bufferStream = clipBuffer(),\n segments,\n polygon,\n ring,\n x__, y__, v__, // first point\n x_, y_, v_, // previous point\n first,\n clean;\n\n var clipStream = {\n point: point,\n lineStart: lineStart,\n lineEnd: lineEnd,\n polygonStart: polygonStart,\n polygonEnd: polygonEnd\n };\n\n function point(x, y) {\n if (visible(x, y)) activeStream.point(x, y);\n }\n\n function polygonInside() {\n var winding = 0;\n\n for (var i = 0, n = polygon.length; i < n; ++i) {\n for (var ring = polygon[i], j = 1, m = ring.length, point = ring[0], a0, a1, b0 = point[0], b1 = point[1]; j < m; ++j) {\n a0 = b0, a1 = b1, point = ring[j], b0 = point[0], b1 = point[1];\n if (a1 <= y1) { if (b1 > y1 && (b0 - a0) * (y1 - a1) > (b1 - a1) * (x0 - a0)) ++winding; }\n else { if (b1 <= y1 && (b0 - a0) * (y1 - a1) < (b1 - a1) * (x0 - a0)) --winding; }\n }\n }\n\n return winding;\n }\n\n // Buffer geometry within a polygon and then clip it en masse.\n function polygonStart() {\n activeStream = bufferStream, segments = [], polygon = [], clean = true;\n }\n\n function polygonEnd() {\n var startInside = polygonInside(),\n cleanInside = clean && startInside,\n visible = (segments = merge(segments)).length;\n if (cleanInside || visible) {\n stream.polygonStart();\n if (cleanInside) {\n stream.lineStart();\n interpolate(null, null, 1, stream);\n stream.lineEnd();\n }\n if (visible) {\n clipRejoin(segments, compareIntersection, startInside, interpolate, stream);\n }\n stream.polygonEnd();\n }\n activeStream = stream, segments = polygon = ring = null;\n }\n\n function lineStart() {\n clipStream.point = linePoint;\n if (polygon) polygon.push(ring = []);\n first = true;\n v_ = false;\n x_ = y_ = NaN;\n }\n\n // TODO rather than special-case polygons, simply handle them separately.\n // Ideally, coincident intersection points should be jittered to avoid\n // clipping issues.\n function lineEnd() {\n if (segments) {\n linePoint(x__, y__);\n if (v__ && v_) bufferStream.rejoin();\n segments.push(bufferStream.result());\n }\n clipStream.point = point;\n if (v_) activeStream.lineEnd();\n }\n\n function linePoint(x, y) {\n var v = visible(x, y);\n if (polygon) ring.push([x, y]);\n if (first) {\n x__ = x, y__ = y, v__ = v;\n first = false;\n if (v) {\n activeStream.lineStart();\n activeStream.point(x, y);\n }\n } else {\n if (v && v_) activeStream.point(x, y);\n else {\n var a = [x_ = Math.max(clipMin, Math.min(clipMax, x_)), y_ = Math.max(clipMin, Math.min(clipMax, y_))],\n b = [x = Math.max(clipMin, Math.min(clipMax, x)), y = Math.max(clipMin, Math.min(clipMax, y))];\n if (clipLine(a, b, x0, y0, x1, y1)) {\n if (!v_) {\n activeStream.lineStart();\n activeStream.point(a[0], a[1]);\n }\n activeStream.point(b[0], b[1]);\n if (!v) activeStream.lineEnd();\n clean = false;\n } else if (v) {\n activeStream.lineStart();\n activeStream.point(x, y);\n clean = false;\n }\n }\n }\n x_ = x, y_ = y, v_ = v;\n }\n\n return clipStream;\n };\n}\n\nvar extent$1 = function() {\n var x0 = 0,\n y0 = 0,\n x1 = 960,\n y1 = 500,\n cache,\n cacheStream,\n clip;\n\n return clip = {\n stream: function(stream) {\n return cache && cacheStream === stream ? cache : cache = clipRectangle(x0, y0, x1, y1)(cacheStream = stream);\n },\n extent: function(_) {\n return arguments.length ? (x0 = +_[0][0], y0 = +_[0][1], x1 = +_[1][0], y1 = +_[1][1], cache = cacheStream = null, clip) : [[x0, y0], [x1, y1]];\n }\n };\n};\n\nvar lengthSum = adder();\nvar lambda0$2;\nvar sinPhi0$1;\nvar cosPhi0$1;\n\nvar lengthStream = {\n sphere: noop$1,\n point: noop$1,\n lineStart: lengthLineStart,\n lineEnd: noop$1,\n polygonStart: noop$1,\n polygonEnd: noop$1\n};\n\nfunction lengthLineStart() {\n lengthStream.point = lengthPointFirst;\n lengthStream.lineEnd = lengthLineEnd;\n}\n\nfunction lengthLineEnd() {\n lengthStream.point = lengthStream.lineEnd = noop$1;\n}\n\nfunction lengthPointFirst(lambda, phi) {\n lambda *= radians, phi *= radians;\n lambda0$2 = lambda, sinPhi0$1 = sin$1(phi), cosPhi0$1 = cos$1(phi);\n lengthStream.point = lengthPoint;\n}\n\nfunction lengthPoint(lambda, phi) {\n lambda *= radians, phi *= radians;\n var sinPhi = sin$1(phi),\n cosPhi = cos$1(phi),\n delta = abs(lambda - lambda0$2),\n cosDelta = cos$1(delta),\n sinDelta = sin$1(delta),\n x = cosPhi * sinDelta,\n y = cosPhi0$1 * sinPhi - sinPhi0$1 * cosPhi * cosDelta,\n z = sinPhi0$1 * sinPhi + cosPhi0$1 * cosPhi * cosDelta;\n lengthSum.add(atan2(sqrt(x * x + y * y), z));\n lambda0$2 = lambda, sinPhi0$1 = sinPhi, cosPhi0$1 = cosPhi;\n}\n\nvar length$1 = function(object) {\n lengthSum.reset();\n geoStream(object, lengthStream);\n return +lengthSum;\n};\n\nvar coordinates = [null, null];\nvar object$1 = {type: \"LineString\", coordinates: coordinates};\n\nvar distance = function(a, b) {\n coordinates[0] = a;\n coordinates[1] = b;\n return length$1(object$1);\n};\n\nvar containsObjectType = {\n Feature: function(object, point) {\n return containsGeometry(object.geometry, point);\n },\n FeatureCollection: function(object, point) {\n var features = object.features, i = -1, n = features.length;\n while (++i < n) if (containsGeometry(features[i].geometry, point)) return true;\n return false;\n }\n};\n\nvar containsGeometryType = {\n Sphere: function() {\n return true;\n },\n Point: function(object, point) {\n return containsPoint(object.coordinates, point);\n },\n MultiPoint: function(object, point) {\n var coordinates = object.coordinates, i = -1, n = coordinates.length;\n while (++i < n) if (containsPoint(coordinates[i], point)) return true;\n return false;\n },\n LineString: function(object, point) {\n return containsLine(object.coordinates, point);\n },\n MultiLineString: function(object, point) {\n var coordinates = object.coordinates, i = -1, n = coordinates.length;\n while (++i < n) if (containsLine(coordinates[i], point)) return true;\n return false;\n },\n Polygon: function(object, point) {\n return containsPolygon(object.coordinates, point);\n },\n MultiPolygon: function(object, point) {\n var coordinates = object.coordinates, i = -1, n = coordinates.length;\n while (++i < n) if (containsPolygon(coordinates[i], point)) return true;\n return false;\n },\n GeometryCollection: function(object, point) {\n var geometries = object.geometries, i = -1, n = geometries.length;\n while (++i < n) if (containsGeometry(geometries[i], point)) return true;\n return false;\n }\n};\n\nfunction containsGeometry(geometry, point) {\n return geometry && containsGeometryType.hasOwnProperty(geometry.type)\n ? containsGeometryType[geometry.type](geometry, point)\n : false;\n}\n\nfunction containsPoint(coordinates, point) {\n return distance(coordinates, point) === 0;\n}\n\nfunction containsLine(coordinates, point) {\n var ab = distance(coordinates[0], coordinates[1]),\n ao = distance(coordinates[0], point),\n ob = distance(point, coordinates[1]);\n return ao + ob <= ab + epsilon$2;\n}\n\nfunction containsPolygon(coordinates, point) {\n return !!polygonContains(coordinates.map(ringRadians), pointRadians(point));\n}\n\nfunction ringRadians(ring) {\n return ring = ring.map(pointRadians), ring.pop(), ring;\n}\n\nfunction pointRadians(point) {\n return [point[0] * radians, point[1] * radians];\n}\n\nvar contains = function(object, point) {\n return (object && containsObjectType.hasOwnProperty(object.type)\n ? containsObjectType[object.type]\n : containsGeometry)(object, point);\n};\n\nfunction graticuleX(y0, y1, dy) {\n var y = sequence(y0, y1 - epsilon$2, dy).concat(y1);\n return function(x) { return y.map(function(y) { return [x, y]; }); };\n}\n\nfunction graticuleY(x0, x1, dx) {\n var x = sequence(x0, x1 - epsilon$2, dx).concat(x1);\n return function(y) { return x.map(function(x) { return [x, y]; }); };\n}\n\nfunction graticule() {\n var x1, x0, X1, X0,\n y1, y0, Y1, Y0,\n dx = 10, dy = dx, DX = 90, DY = 360,\n x, y, X, Y,\n precision = 2.5;\n\n function graticule() {\n return {type: \"MultiLineString\", coordinates: lines()};\n }\n\n function lines() {\n return sequence(ceil(X0 / DX) * DX, X1, DX).map(X)\n .concat(sequence(ceil(Y0 / DY) * DY, Y1, DY).map(Y))\n .concat(sequence(ceil(x0 / dx) * dx, x1, dx).filter(function(x) { return abs(x % DX) > epsilon$2; }).map(x))\n .concat(sequence(ceil(y0 / dy) * dy, y1, dy).filter(function(y) { return abs(y % DY) > epsilon$2; }).map(y));\n }\n\n graticule.lines = function() {\n return lines().map(function(coordinates) { return {type: \"LineString\", coordinates: coordinates}; });\n };\n\n graticule.outline = function() {\n return {\n type: \"Polygon\",\n coordinates: [\n X(X0).concat(\n Y(Y1).slice(1),\n X(X1).reverse().slice(1),\n Y(Y0).reverse().slice(1))\n ]\n };\n };\n\n graticule.extent = function(_) {\n if (!arguments.length) return graticule.extentMinor();\n return graticule.extentMajor(_).extentMinor(_);\n };\n\n graticule.extentMajor = function(_) {\n if (!arguments.length) return [[X0, Y0], [X1, Y1]];\n X0 = +_[0][0], X1 = +_[1][0];\n Y0 = +_[0][1], Y1 = +_[1][1];\n if (X0 > X1) _ = X0, X0 = X1, X1 = _;\n if (Y0 > Y1) _ = Y0, Y0 = Y1, Y1 = _;\n return graticule.precision(precision);\n };\n\n graticule.extentMinor = function(_) {\n if (!arguments.length) return [[x0, y0], [x1, y1]];\n x0 = +_[0][0], x1 = +_[1][0];\n y0 = +_[0][1], y1 = +_[1][1];\n if (x0 > x1) _ = x0, x0 = x1, x1 = _;\n if (y0 > y1) _ = y0, y0 = y1, y1 = _;\n return graticule.precision(precision);\n };\n\n graticule.step = function(_) {\n if (!arguments.length) return graticule.stepMinor();\n return graticule.stepMajor(_).stepMinor(_);\n };\n\n graticule.stepMajor = function(_) {\n if (!arguments.length) return [DX, DY];\n DX = +_[0], DY = +_[1];\n return graticule;\n };\n\n graticule.stepMinor = function(_) {\n if (!arguments.length) return [dx, dy];\n dx = +_[0], dy = +_[1];\n return graticule;\n };\n\n graticule.precision = function(_) {\n if (!arguments.length) return precision;\n precision = +_;\n x = graticuleX(y0, y1, 90);\n y = graticuleY(x0, x1, precision);\n X = graticuleX(Y0, Y1, 90);\n Y = graticuleY(X0, X1, precision);\n return graticule;\n };\n\n return graticule\n .extentMajor([[-180, -90 + epsilon$2], [180, 90 - epsilon$2]])\n .extentMinor([[-180, -80 - epsilon$2], [180, 80 + epsilon$2]]);\n}\n\nfunction graticule10() {\n return graticule()();\n}\n\nvar interpolate$1 = function(a, b) {\n var x0 = a[0] * radians,\n y0 = a[1] * radians,\n x1 = b[0] * radians,\n y1 = b[1] * radians,\n cy0 = cos$1(y0),\n sy0 = sin$1(y0),\n cy1 = cos$1(y1),\n sy1 = sin$1(y1),\n kx0 = cy0 * cos$1(x0),\n ky0 = cy0 * sin$1(x0),\n kx1 = cy1 * cos$1(x1),\n ky1 = cy1 * sin$1(x1),\n d = 2 * asin(sqrt(haversin(y1 - y0) + cy0 * cy1 * haversin(x1 - x0))),\n k = sin$1(d);\n\n var interpolate = d ? function(t) {\n var B = sin$1(t *= d) / k,\n A = sin$1(d - t) / k,\n x = A * kx0 + B * kx1,\n y = A * ky0 + B * ky1,\n z = A * sy0 + B * sy1;\n return [\n atan2(y, x) * degrees$1,\n atan2(z, sqrt(x * x + y * y)) * degrees$1\n ];\n } : function() {\n return [x0 * degrees$1, y0 * degrees$1];\n };\n\n interpolate.distance = d;\n\n return interpolate;\n};\n\nvar identity$4 = function(x) {\n return x;\n};\n\nvar areaSum$1 = adder();\nvar areaRingSum$1 = adder();\nvar x00;\nvar y00;\nvar x0$1;\nvar y0$1;\n\nvar areaStream$1 = {\n point: noop$1,\n lineStart: noop$1,\n lineEnd: noop$1,\n polygonStart: function() {\n areaStream$1.lineStart = areaRingStart$1;\n areaStream$1.lineEnd = areaRingEnd$1;\n },\n polygonEnd: function() {\n areaStream$1.lineStart = areaStream$1.lineEnd = areaStream$1.point = noop$1;\n areaSum$1.add(abs(areaRingSum$1));\n areaRingSum$1.reset();\n },\n result: function() {\n var area = areaSum$1 / 2;\n areaSum$1.reset();\n return area;\n }\n};\n\nfunction areaRingStart$1() {\n areaStream$1.point = areaPointFirst$1;\n}\n\nfunction areaPointFirst$1(x, y) {\n areaStream$1.point = areaPoint$1;\n x00 = x0$1 = x, y00 = y0$1 = y;\n}\n\nfunction areaPoint$1(x, y) {\n areaRingSum$1.add(y0$1 * x - x0$1 * y);\n x0$1 = x, y0$1 = y;\n}\n\nfunction areaRingEnd$1() {\n areaPoint$1(x00, y00);\n}\n\nvar x0$2 = Infinity;\nvar y0$2 = x0$2;\nvar x1 = -x0$2;\nvar y1 = x1;\n\nvar boundsStream$1 = {\n point: boundsPoint$1,\n lineStart: noop$1,\n lineEnd: noop$1,\n polygonStart: noop$1,\n polygonEnd: noop$1,\n result: function() {\n var bounds = [[x0$2, y0$2], [x1, y1]];\n x1 = y1 = -(y0$2 = x0$2 = Infinity);\n return bounds;\n }\n};\n\nfunction boundsPoint$1(x, y) {\n if (x < x0$2) x0$2 = x;\n if (x > x1) x1 = x;\n if (y < y0$2) y0$2 = y;\n if (y > y1) y1 = y;\n}\n\n// TODO Enforce positive area for exterior, negative area for interior?\n\nvar X0$1 = 0;\nvar Y0$1 = 0;\nvar Z0$1 = 0;\nvar X1$1 = 0;\nvar Y1$1 = 0;\nvar Z1$1 = 0;\nvar X2$1 = 0;\nvar Y2$1 = 0;\nvar Z2$1 = 0;\nvar x00$1;\nvar y00$1;\nvar x0$3;\nvar y0$3;\n\nvar centroidStream$1 = {\n point: centroidPoint$1,\n lineStart: centroidLineStart$1,\n lineEnd: centroidLineEnd$1,\n polygonStart: function() {\n centroidStream$1.lineStart = centroidRingStart$1;\n centroidStream$1.lineEnd = centroidRingEnd$1;\n },\n polygonEnd: function() {\n centroidStream$1.point = centroidPoint$1;\n centroidStream$1.lineStart = centroidLineStart$1;\n centroidStream$1.lineEnd = centroidLineEnd$1;\n },\n result: function() {\n var centroid = Z2$1 ? [X2$1 / Z2$1, Y2$1 / Z2$1]\n : Z1$1 ? [X1$1 / Z1$1, Y1$1 / Z1$1]\n : Z0$1 ? [X0$1 / Z0$1, Y0$1 / Z0$1]\n : [NaN, NaN];\n X0$1 = Y0$1 = Z0$1 =\n X1$1 = Y1$1 = Z1$1 =\n X2$1 = Y2$1 = Z2$1 = 0;\n return centroid;\n }\n};\n\nfunction centroidPoint$1(x, y) {\n X0$1 += x;\n Y0$1 += y;\n ++Z0$1;\n}\n\nfunction centroidLineStart$1() {\n centroidStream$1.point = centroidPointFirstLine;\n}\n\nfunction centroidPointFirstLine(x, y) {\n centroidStream$1.point = centroidPointLine;\n centroidPoint$1(x0$3 = x, y0$3 = y);\n}\n\nfunction centroidPointLine(x, y) {\n var dx = x - x0$3, dy = y - y0$3, z = sqrt(dx * dx + dy * dy);\n X1$1 += z * (x0$3 + x) / 2;\n Y1$1 += z * (y0$3 + y) / 2;\n Z1$1 += z;\n centroidPoint$1(x0$3 = x, y0$3 = y);\n}\n\nfunction centroidLineEnd$1() {\n centroidStream$1.point = centroidPoint$1;\n}\n\nfunction centroidRingStart$1() {\n centroidStream$1.point = centroidPointFirstRing;\n}\n\nfunction centroidRingEnd$1() {\n centroidPointRing(x00$1, y00$1);\n}\n\nfunction centroidPointFirstRing(x, y) {\n centroidStream$1.point = centroidPointRing;\n centroidPoint$1(x00$1 = x0$3 = x, y00$1 = y0$3 = y);\n}\n\nfunction centroidPointRing(x, y) {\n var dx = x - x0$3,\n dy = y - y0$3,\n z = sqrt(dx * dx + dy * dy);\n\n X1$1 += z * (x0$3 + x) / 2;\n Y1$1 += z * (y0$3 + y) / 2;\n Z1$1 += z;\n\n z = y0$3 * x - x0$3 * y;\n X2$1 += z * (x0$3 + x);\n Y2$1 += z * (y0$3 + y);\n Z2$1 += z * 3;\n centroidPoint$1(x0$3 = x, y0$3 = y);\n}\n\nfunction PathContext(context) {\n this._context = context;\n}\n\nPathContext.prototype = {\n _radius: 4.5,\n pointRadius: function(_) {\n return this._radius = _, this;\n },\n polygonStart: function() {\n this._line = 0;\n },\n polygonEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._point = 0;\n },\n lineEnd: function() {\n if (this._line === 0) this._context.closePath();\n this._point = NaN;\n },\n point: function(x, y) {\n switch (this._point) {\n case 0: {\n this._context.moveTo(x, y);\n this._point = 1;\n break;\n }\n case 1: {\n this._context.lineTo(x, y);\n break;\n }\n default: {\n this._context.moveTo(x + this._radius, y);\n this._context.arc(x, y, this._radius, 0, tau$3);\n break;\n }\n }\n },\n result: noop$1\n};\n\nvar lengthSum$1 = adder();\nvar lengthRing;\nvar x00$2;\nvar y00$2;\nvar x0$4;\nvar y0$4;\n\nvar lengthStream$1 = {\n point: noop$1,\n lineStart: function() {\n lengthStream$1.point = lengthPointFirst$1;\n },\n lineEnd: function() {\n if (lengthRing) lengthPoint$1(x00$2, y00$2);\n lengthStream$1.point = noop$1;\n },\n polygonStart: function() {\n lengthRing = true;\n },\n polygonEnd: function() {\n lengthRing = null;\n },\n result: function() {\n var length = +lengthSum$1;\n lengthSum$1.reset();\n return length;\n }\n};\n\nfunction lengthPointFirst$1(x, y) {\n lengthStream$1.point = lengthPoint$1;\n x00$2 = x0$4 = x, y00$2 = y0$4 = y;\n}\n\nfunction lengthPoint$1(x, y) {\n x0$4 -= x, y0$4 -= y;\n lengthSum$1.add(sqrt(x0$4 * x0$4 + y0$4 * y0$4));\n x0$4 = x, y0$4 = y;\n}\n\nfunction PathString() {\n this._string = [];\n}\n\nPathString.prototype = {\n _radius: 4.5,\n _circle: circle$1(4.5),\n pointRadius: function(_) {\n if ((_ = +_) !== this._radius) this._radius = _, this._circle = null;\n return this;\n },\n polygonStart: function() {\n this._line = 0;\n },\n polygonEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._point = 0;\n },\n lineEnd: function() {\n if (this._line === 0) this._string.push(\"Z\");\n this._point = NaN;\n },\n point: function(x, y) {\n switch (this._point) {\n case 0: {\n this._string.push(\"M\", x, \",\", y);\n this._point = 1;\n break;\n }\n case 1: {\n this._string.push(\"L\", x, \",\", y);\n break;\n }\n default: {\n if (this._circle == null) this._circle = circle$1(this._radius);\n this._string.push(\"M\", x, \",\", y, this._circle);\n break;\n }\n }\n },\n result: function() {\n if (this._string.length) {\n var result = this._string.join(\"\");\n this._string = [];\n return result;\n } else {\n return null;\n }\n }\n};\n\nfunction circle$1(radius) {\n return \"m0,\" + radius\n + \"a\" + radius + \",\" + radius + \" 0 1,1 0,\" + -2 * radius\n + \"a\" + radius + \",\" + radius + \" 0 1,1 0,\" + 2 * radius\n + \"z\";\n}\n\nvar index$1 = function(projection, context) {\n var pointRadius = 4.5,\n projectionStream,\n contextStream;\n\n function path(object) {\n if (object) {\n if (typeof pointRadius === \"function\") contextStream.pointRadius(+pointRadius.apply(this, arguments));\n geoStream(object, projectionStream(contextStream));\n }\n return contextStream.result();\n }\n\n path.area = function(object) {\n geoStream(object, projectionStream(areaStream$1));\n return areaStream$1.result();\n };\n\n path.measure = function(object) {\n geoStream(object, projectionStream(lengthStream$1));\n return lengthStream$1.result();\n };\n\n path.bounds = function(object) {\n geoStream(object, projectionStream(boundsStream$1));\n return boundsStream$1.result();\n };\n\n path.centroid = function(object) {\n geoStream(object, projectionStream(centroidStream$1));\n return centroidStream$1.result();\n };\n\n path.projection = function(_) {\n return arguments.length ? (projectionStream = _ == null ? (projection = null, identity$4) : (projection = _).stream, path) : projection;\n };\n\n path.context = function(_) {\n if (!arguments.length) return context;\n contextStream = _ == null ? (context = null, new PathString) : new PathContext(context = _);\n if (typeof pointRadius !== \"function\") contextStream.pointRadius(pointRadius);\n return path;\n };\n\n path.pointRadius = function(_) {\n if (!arguments.length) return pointRadius;\n pointRadius = typeof _ === \"function\" ? _ : (contextStream.pointRadius(+_), +_);\n return path;\n };\n\n return path.projection(projection).context(context);\n};\n\nvar transform = function(methods) {\n return {\n stream: transformer(methods)\n };\n};\n\nfunction transformer(methods) {\n return function(stream) {\n var s = new TransformStream;\n for (var key in methods) s[key] = methods[key];\n s.stream = stream;\n return s;\n };\n}\n\nfunction TransformStream() {}\n\nTransformStream.prototype = {\n constructor: TransformStream,\n point: function(x, y) { this.stream.point(x, y); },\n sphere: function() { this.stream.sphere(); },\n lineStart: function() { this.stream.lineStart(); },\n lineEnd: function() { this.stream.lineEnd(); },\n polygonStart: function() { this.stream.polygonStart(); },\n polygonEnd: function() { this.stream.polygonEnd(); }\n};\n\nfunction fitExtent(projection, extent, object) {\n var w = extent[1][0] - extent[0][0],\n h = extent[1][1] - extent[0][1],\n clip = projection.clipExtent && projection.clipExtent();\n\n projection\n .scale(150)\n .translate([0, 0]);\n\n if (clip != null) projection.clipExtent(null);\n\n geoStream(object, projection.stream(boundsStream$1));\n\n var b = boundsStream$1.result(),\n k = Math.min(w / (b[1][0] - b[0][0]), h / (b[1][1] - b[0][1])),\n x = +extent[0][0] + (w - k * (b[1][0] + b[0][0])) / 2,\n y = +extent[0][1] + (h - k * (b[1][1] + b[0][1])) / 2;\n\n if (clip != null) projection.clipExtent(clip);\n\n return projection\n .scale(k * 150)\n .translate([x, y]);\n}\n\nfunction fitSize(projection, size, object) {\n return fitExtent(projection, [[0, 0], size], object);\n}\n\nvar maxDepth = 16;\nvar cosMinDistance = cos$1(30 * radians); // cos(minimum angular distance)\n\nvar resample = function(project, delta2) {\n return +delta2 ? resample$1(project, delta2) : resampleNone(project);\n};\n\nfunction resampleNone(project) {\n return transformer({\n point: function(x, y) {\n x = project(x, y);\n this.stream.point(x[0], x[1]);\n }\n });\n}\n\nfunction resample$1(project, delta2) {\n\n function resampleLineTo(x0, y0, lambda0, a0, b0, c0, x1, y1, lambda1, a1, b1, c1, depth, stream) {\n var dx = x1 - x0,\n dy = y1 - y0,\n d2 = dx * dx + dy * dy;\n if (d2 > 4 * delta2 && depth--) {\n var a = a0 + a1,\n b = b0 + b1,\n c = c0 + c1,\n m = sqrt(a * a + b * b + c * c),\n phi2 = asin(c /= m),\n lambda2 = abs(abs(c) - 1) < epsilon$2 || abs(lambda0 - lambda1) < epsilon$2 ? (lambda0 + lambda1) / 2 : atan2(b, a),\n p = project(lambda2, phi2),\n x2 = p[0],\n y2 = p[1],\n dx2 = x2 - x0,\n dy2 = y2 - y0,\n dz = dy * dx2 - dx * dy2;\n if (dz * dz / d2 > delta2 // perpendicular projected distance\n || abs((dx * dx2 + dy * dy2) / d2 - 0.5) > 0.3 // midpoint close to an end\n || a0 * a1 + b0 * b1 + c0 * c1 < cosMinDistance) { // angular distance\n resampleLineTo(x0, y0, lambda0, a0, b0, c0, x2, y2, lambda2, a /= m, b /= m, c, depth, stream);\n stream.point(x2, y2);\n resampleLineTo(x2, y2, lambda2, a, b, c, x1, y1, lambda1, a1, b1, c1, depth, stream);\n }\n }\n }\n return function(stream) {\n var lambda00, x00, y00, a00, b00, c00, // first point\n lambda0, x0, y0, a0, b0, c0; // previous point\n\n var resampleStream = {\n point: point,\n lineStart: lineStart,\n lineEnd: lineEnd,\n polygonStart: function() { stream.polygonStart(); resampleStream.lineStart = ringStart; },\n polygonEnd: function() { stream.polygonEnd(); resampleStream.lineStart = lineStart; }\n };\n\n function point(x, y) {\n x = project(x, y);\n stream.point(x[0], x[1]);\n }\n\n function lineStart() {\n x0 = NaN;\n resampleStream.point = linePoint;\n stream.lineStart();\n }\n\n function linePoint(lambda, phi) {\n var c = cartesian([lambda, phi]), p = project(lambda, phi);\n resampleLineTo(x0, y0, lambda0, a0, b0, c0, x0 = p[0], y0 = p[1], lambda0 = lambda, a0 = c[0], b0 = c[1], c0 = c[2], maxDepth, stream);\n stream.point(x0, y0);\n }\n\n function lineEnd() {\n resampleStream.point = point;\n stream.lineEnd();\n }\n\n function ringStart() {\n lineStart();\n resampleStream.point = ringPoint;\n resampleStream.lineEnd = ringEnd;\n }\n\n function ringPoint(lambda, phi) {\n linePoint(lambda00 = lambda, phi), x00 = x0, y00 = y0, a00 = a0, b00 = b0, c00 = c0;\n resampleStream.point = linePoint;\n }\n\n function ringEnd() {\n resampleLineTo(x0, y0, lambda0, a0, b0, c0, x00, y00, lambda00, a00, b00, c00, maxDepth, stream);\n resampleStream.lineEnd = lineEnd;\n lineEnd();\n }\n\n return resampleStream;\n };\n}\n\nvar transformRadians = transformer({\n point: function(x, y) {\n this.stream.point(x * radians, y * radians);\n }\n});\n\nfunction transformRotate(rotate) {\n return transformer({\n point: function(x, y) {\n var r = rotate(x, y);\n return this.stream.point(r[0], r[1]);\n }\n });\n}\n\nfunction projection(project) {\n return projectionMutator(function() { return project; })();\n}\n\nfunction projectionMutator(projectAt) {\n var project,\n k = 150, // scale\n x = 480, y = 250, // translate\n dx, dy, lambda = 0, phi = 0, // center\n deltaLambda = 0, deltaPhi = 0, deltaGamma = 0, rotate, projectRotate, // rotate\n theta = null, preclip = clipAntimeridian, // clip angle\n x0 = null, y0, x1, y1, postclip = identity$4, // clip extent\n delta2 = 0.5, projectResample = resample(projectTransform, delta2), // precision\n cache,\n cacheStream;\n\n function projection(point) {\n point = projectRotate(point[0] * radians, point[1] * radians);\n return [point[0] * k + dx, dy - point[1] * k];\n }\n\n function invert(point) {\n point = projectRotate.invert((point[0] - dx) / k, (dy - point[1]) / k);\n return point && [point[0] * degrees$1, point[1] * degrees$1];\n }\n\n function projectTransform(x, y) {\n return x = project(x, y), [x[0] * k + dx, dy - x[1] * k];\n }\n\n projection.stream = function(stream) {\n return cache && cacheStream === stream ? cache : cache = transformRadians(transformRotate(rotate)(preclip(projectResample(postclip(cacheStream = stream)))));\n };\n\n projection.preclip = function(_) {\n return arguments.length ? (preclip = _, theta = undefined, reset()) : preclip;\n };\n\n projection.postclip = function(_) {\n return arguments.length ? (postclip = _, x0 = y0 = x1 = y1 = null, reset()) : postclip;\n };\n\n projection.clipAngle = function(_) {\n return arguments.length ? (preclip = +_ ? clipCircle(theta = _ * radians) : (theta = null, clipAntimeridian), reset()) : theta * degrees$1;\n };\n\n projection.clipExtent = function(_) {\n return arguments.length ? (postclip = _ == null ? (x0 = y0 = x1 = y1 = null, identity$4) : clipRectangle(x0 = +_[0][0], y0 = +_[0][1], x1 = +_[1][0], y1 = +_[1][1]), reset()) : x0 == null ? null : [[x0, y0], [x1, y1]];\n };\n\n projection.scale = function(_) {\n return arguments.length ? (k = +_, recenter()) : k;\n };\n\n projection.translate = function(_) {\n return arguments.length ? (x = +_[0], y = +_[1], recenter()) : [x, y];\n };\n\n projection.center = function(_) {\n return arguments.length ? (lambda = _[0] % 360 * radians, phi = _[1] % 360 * radians, recenter()) : [lambda * degrees$1, phi * degrees$1];\n };\n\n projection.rotate = function(_) {\n return arguments.length ? (deltaLambda = _[0] % 360 * radians, deltaPhi = _[1] % 360 * radians, deltaGamma = _.length > 2 ? _[2] % 360 * radians : 0, recenter()) : [deltaLambda * degrees$1, deltaPhi * degrees$1, deltaGamma * degrees$1];\n };\n\n projection.precision = function(_) {\n return arguments.length ? (projectResample = resample(projectTransform, delta2 = _ * _), reset()) : sqrt(delta2);\n };\n\n projection.fitExtent = function(extent, object) {\n return fitExtent(projection, extent, object);\n };\n\n projection.fitSize = function(size, object) {\n return fitSize(projection, size, object);\n };\n\n function recenter() {\n projectRotate = compose(rotate = rotateRadians(deltaLambda, deltaPhi, deltaGamma), project);\n var center = project(lambda, phi);\n dx = x - center[0] * k;\n dy = y + center[1] * k;\n return reset();\n }\n\n function reset() {\n cache = cacheStream = null;\n return projection;\n }\n\n return function() {\n project = projectAt.apply(this, arguments);\n projection.invert = project.invert && invert;\n return recenter();\n };\n}\n\nfunction conicProjection(projectAt) {\n var phi0 = 0,\n phi1 = pi$3 / 3,\n m = projectionMutator(projectAt),\n p = m(phi0, phi1);\n\n p.parallels = function(_) {\n return arguments.length ? m(phi0 = _[0] * radians, phi1 = _[1] * radians) : [phi0 * degrees$1, phi1 * degrees$1];\n };\n\n return p;\n}\n\nfunction cylindricalEqualAreaRaw(phi0) {\n var cosPhi0 = cos$1(phi0);\n\n function forward(lambda, phi) {\n return [lambda * cosPhi0, sin$1(phi) / cosPhi0];\n }\n\n forward.invert = function(x, y) {\n return [x / cosPhi0, asin(y * cosPhi0)];\n };\n\n return forward;\n}\n\nfunction conicEqualAreaRaw(y0, y1) {\n var sy0 = sin$1(y0), n = (sy0 + sin$1(y1)) / 2;\n\n // Are the parallels symmetrical around the Equator?\n if (abs(n) < epsilon$2) return cylindricalEqualAreaRaw(y0);\n\n var c = 1 + sy0 * (2 * n - sy0), r0 = sqrt(c) / n;\n\n function project(x, y) {\n var r = sqrt(c - 2 * n * sin$1(y)) / n;\n return [r * sin$1(x *= n), r0 - r * cos$1(x)];\n }\n\n project.invert = function(x, y) {\n var r0y = r0 - y;\n return [atan2(x, abs(r0y)) / n * sign(r0y), asin((c - (x * x + r0y * r0y) * n * n) / (2 * n))];\n };\n\n return project;\n}\n\nvar conicEqualArea = function() {\n return conicProjection(conicEqualAreaRaw)\n .scale(155.424)\n .center([0, 33.6442]);\n};\n\nvar albers = function() {\n return conicEqualArea()\n .parallels([29.5, 45.5])\n .scale(1070)\n .translate([480, 250])\n .rotate([96, 0])\n .center([-0.6, 38.7]);\n};\n\n// The projections must have mutually exclusive clip regions on the sphere,\n// as this will avoid emitting interleaving lines and polygons.\nfunction multiplex(streams) {\n var n = streams.length;\n return {\n point: function(x, y) { var i = -1; while (++i < n) streams[i].point(x, y); },\n sphere: function() { var i = -1; while (++i < n) streams[i].sphere(); },\n lineStart: function() { var i = -1; while (++i < n) streams[i].lineStart(); },\n lineEnd: function() { var i = -1; while (++i < n) streams[i].lineEnd(); },\n polygonStart: function() { var i = -1; while (++i < n) streams[i].polygonStart(); },\n polygonEnd: function() { var i = -1; while (++i < n) streams[i].polygonEnd(); }\n };\n}\n\n// A composite projection for the United States, configured by default for\n// 960×500. The projection also works quite well at 960×600 if you change the\n// scale to 1285 and adjust the translate accordingly. The set of standard\n// parallels for each region comes from USGS, which is published here:\n// http://egsc.usgs.gov/isb/pubs/MapProjections/projections.html#albers\nvar albersUsa = function() {\n var cache,\n cacheStream,\n lower48 = albers(), lower48Point,\n alaska = conicEqualArea().rotate([154, 0]).center([-2, 58.5]).parallels([55, 65]), alaskaPoint, // EPSG:3338\n hawaii = conicEqualArea().rotate([157, 0]).center([-3, 19.9]).parallels([8, 18]), hawaiiPoint, // ESRI:102007\n point, pointStream = {point: function(x, y) { point = [x, y]; }};\n\n function albersUsa(coordinates) {\n var x = coordinates[0], y = coordinates[1];\n return point = null,\n (lower48Point.point(x, y), point)\n || (alaskaPoint.point(x, y), point)\n || (hawaiiPoint.point(x, y), point);\n }\n\n albersUsa.invert = function(coordinates) {\n var k = lower48.scale(),\n t = lower48.translate(),\n x = (coordinates[0] - t[0]) / k,\n y = (coordinates[1] - t[1]) / k;\n return (y >= 0.120 && y < 0.234 && x >= -0.425 && x < -0.214 ? alaska\n : y >= 0.166 && y < 0.234 && x >= -0.214 && x < -0.115 ? hawaii\n : lower48).invert(coordinates);\n };\n\n albersUsa.stream = function(stream) {\n return cache && cacheStream === stream ? cache : cache = multiplex([lower48.stream(cacheStream = stream), alaska.stream(stream), hawaii.stream(stream)]);\n };\n\n albersUsa.precision = function(_) {\n if (!arguments.length) return lower48.precision();\n lower48.precision(_), alaska.precision(_), hawaii.precision(_);\n return reset();\n };\n\n albersUsa.scale = function(_) {\n if (!arguments.length) return lower48.scale();\n lower48.scale(_), alaska.scale(_ * 0.35), hawaii.scale(_);\n return albersUsa.translate(lower48.translate());\n };\n\n albersUsa.translate = function(_) {\n if (!arguments.length) return lower48.translate();\n var k = lower48.scale(), x = +_[0], y = +_[1];\n\n lower48Point = lower48\n .translate(_)\n .clipExtent([[x - 0.455 * k, y - 0.238 * k], [x + 0.455 * k, y + 0.238 * k]])\n .stream(pointStream);\n\n alaskaPoint = alaska\n .translate([x - 0.307 * k, y + 0.201 * k])\n .clipExtent([[x - 0.425 * k + epsilon$2, y + 0.120 * k + epsilon$2], [x - 0.214 * k - epsilon$2, y + 0.234 * k - epsilon$2]])\n .stream(pointStream);\n\n hawaiiPoint = hawaii\n .translate([x - 0.205 * k, y + 0.212 * k])\n .clipExtent([[x - 0.214 * k + epsilon$2, y + 0.166 * k + epsilon$2], [x - 0.115 * k - epsilon$2, y + 0.234 * k - epsilon$2]])\n .stream(pointStream);\n\n return reset();\n };\n\n albersUsa.fitExtent = function(extent, object) {\n return fitExtent(albersUsa, extent, object);\n };\n\n albersUsa.fitSize = function(size, object) {\n return fitSize(albersUsa, size, object);\n };\n\n function reset() {\n cache = cacheStream = null;\n return albersUsa;\n }\n\n return albersUsa.scale(1070);\n};\n\nfunction azimuthalRaw(scale) {\n return function(x, y) {\n var cx = cos$1(x),\n cy = cos$1(y),\n k = scale(cx * cy);\n return [\n k * cy * sin$1(x),\n k * sin$1(y)\n ];\n }\n}\n\nfunction azimuthalInvert(angle) {\n return function(x, y) {\n var z = sqrt(x * x + y * y),\n c = angle(z),\n sc = sin$1(c),\n cc = cos$1(c);\n return [\n atan2(x * sc, z * cc),\n asin(z && y * sc / z)\n ];\n }\n}\n\nvar azimuthalEqualAreaRaw = azimuthalRaw(function(cxcy) {\n return sqrt(2 / (1 + cxcy));\n});\n\nazimuthalEqualAreaRaw.invert = azimuthalInvert(function(z) {\n return 2 * asin(z / 2);\n});\n\nvar azimuthalEqualArea = function() {\n return projection(azimuthalEqualAreaRaw)\n .scale(124.75)\n .clipAngle(180 - 1e-3);\n};\n\nvar azimuthalEquidistantRaw = azimuthalRaw(function(c) {\n return (c = acos(c)) && c / sin$1(c);\n});\n\nazimuthalEquidistantRaw.invert = azimuthalInvert(function(z) {\n return z;\n});\n\nvar azimuthalEquidistant = function() {\n return projection(azimuthalEquidistantRaw)\n .scale(79.4188)\n .clipAngle(180 - 1e-3);\n};\n\nfunction mercatorRaw(lambda, phi) {\n return [lambda, log(tan((halfPi$2 + phi) / 2))];\n}\n\nmercatorRaw.invert = function(x, y) {\n return [x, 2 * atan(exp(y)) - halfPi$2];\n};\n\nvar mercator = function() {\n return mercatorProjection(mercatorRaw)\n .scale(961 / tau$3);\n};\n\nfunction mercatorProjection(project) {\n var m = projection(project),\n center = m.center,\n scale = m.scale,\n translate = m.translate,\n clipExtent = m.clipExtent,\n x0 = null, y0, x1, y1; // clip extent\n\n m.scale = function(_) {\n return arguments.length ? (scale(_), reclip()) : scale();\n };\n\n m.translate = function(_) {\n return arguments.length ? (translate(_), reclip()) : translate();\n };\n\n m.center = function(_) {\n return arguments.length ? (center(_), reclip()) : center();\n };\n\n m.clipExtent = function(_) {\n return arguments.length ? ((_ == null ? x0 = y0 = x1 = y1 = null : (x0 = +_[0][0], y0 = +_[0][1], x1 = +_[1][0], y1 = +_[1][1])), reclip()) : x0 == null ? null : [[x0, y0], [x1, y1]];\n };\n\n function reclip() {\n var k = pi$3 * scale(),\n t = m(rotation(m.rotate()).invert([0, 0]));\n return clipExtent(x0 == null\n ? [[t[0] - k, t[1] - k], [t[0] + k, t[1] + k]] : project === mercatorRaw\n ? [[Math.max(t[0] - k, x0), y0], [Math.min(t[0] + k, x1), y1]]\n : [[x0, Math.max(t[1] - k, y0)], [x1, Math.min(t[1] + k, y1)]]);\n }\n\n return reclip();\n}\n\nfunction tany(y) {\n return tan((halfPi$2 + y) / 2);\n}\n\nfunction conicConformalRaw(y0, y1) {\n var cy0 = cos$1(y0),\n n = y0 === y1 ? sin$1(y0) : log(cy0 / cos$1(y1)) / log(tany(y1) / tany(y0)),\n f = cy0 * pow(tany(y0), n) / n;\n\n if (!n) return mercatorRaw;\n\n function project(x, y) {\n if (f > 0) { if (y < -halfPi$2 + epsilon$2) y = -halfPi$2 + epsilon$2; }\n else { if (y > halfPi$2 - epsilon$2) y = halfPi$2 - epsilon$2; }\n var r = f / pow(tany(y), n);\n return [r * sin$1(n * x), f - r * cos$1(n * x)];\n }\n\n project.invert = function(x, y) {\n var fy = f - y, r = sign(n) * sqrt(x * x + fy * fy);\n return [atan2(x, abs(fy)) / n * sign(fy), 2 * atan(pow(f / r, 1 / n)) - halfPi$2];\n };\n\n return project;\n}\n\nvar conicConformal = function() {\n return conicProjection(conicConformalRaw)\n .scale(109.5)\n .parallels([30, 30]);\n};\n\nfunction equirectangularRaw(lambda, phi) {\n return [lambda, phi];\n}\n\nequirectangularRaw.invert = equirectangularRaw;\n\nvar equirectangular = function() {\n return projection(equirectangularRaw)\n .scale(152.63);\n};\n\nfunction conicEquidistantRaw(y0, y1) {\n var cy0 = cos$1(y0),\n n = y0 === y1 ? sin$1(y0) : (cy0 - cos$1(y1)) / (y1 - y0),\n g = cy0 / n + y0;\n\n if (abs(n) < epsilon$2) return equirectangularRaw;\n\n function project(x, y) {\n var gy = g - y, nx = n * x;\n return [gy * sin$1(nx), g - gy * cos$1(nx)];\n }\n\n project.invert = function(x, y) {\n var gy = g - y;\n return [atan2(x, abs(gy)) / n * sign(gy), g - sign(n) * sqrt(x * x + gy * gy)];\n };\n\n return project;\n}\n\nvar conicEquidistant = function() {\n return conicProjection(conicEquidistantRaw)\n .scale(131.154)\n .center([0, 13.9389]);\n};\n\nfunction gnomonicRaw(x, y) {\n var cy = cos$1(y), k = cos$1(x) * cy;\n return [cy * sin$1(x) / k, sin$1(y) / k];\n}\n\ngnomonicRaw.invert = azimuthalInvert(atan);\n\nvar gnomonic = function() {\n return projection(gnomonicRaw)\n .scale(144.049)\n .clipAngle(60);\n};\n\nfunction scaleTranslate(kx, ky, tx, ty) {\n return kx === 1 && ky === 1 && tx === 0 && ty === 0 ? identity$4 : transformer({\n point: function(x, y) {\n this.stream.point(x * kx + tx, y * ky + ty);\n }\n });\n}\n\nvar identity$5 = function() {\n var k = 1, tx = 0, ty = 0, sx = 1, sy = 1, transform$$1 = identity$4, // scale, translate and reflect\n x0 = null, y0, x1, y1, // clip extent\n postclip = identity$4,\n cache,\n cacheStream,\n projection;\n\n function reset() {\n cache = cacheStream = null;\n return projection;\n }\n\n return projection = {\n stream: function(stream) {\n return cache && cacheStream === stream ? cache : cache = transform$$1(postclip(cacheStream = stream));\n },\n postclip: function(_) {\n return arguments.length ? (postclip = _, x0 = y0 = x1 = y1 = null, reset()) : postclip;\n },\n clipExtent: function(_) {\n return arguments.length ? (postclip = _ == null ? (x0 = y0 = x1 = y1 = null, identity$4) : clipRectangle(x0 = +_[0][0], y0 = +_[0][1], x1 = +_[1][0], y1 = +_[1][1]), reset()) : x0 == null ? null : [[x0, y0], [x1, y1]];\n },\n scale: function(_) {\n return arguments.length ? (transform$$1 = scaleTranslate((k = +_) * sx, k * sy, tx, ty), reset()) : k;\n },\n translate: function(_) {\n return arguments.length ? (transform$$1 = scaleTranslate(k * sx, k * sy, tx = +_[0], ty = +_[1]), reset()) : [tx, ty];\n },\n reflectX: function(_) {\n return arguments.length ? (transform$$1 = scaleTranslate(k * (sx = _ ? -1 : 1), k * sy, tx, ty), reset()) : sx < 0;\n },\n reflectY: function(_) {\n return arguments.length ? (transform$$1 = scaleTranslate(k * sx, k * (sy = _ ? -1 : 1), tx, ty), reset()) : sy < 0;\n },\n fitExtent: function(extent, object) {\n return fitExtent(projection, extent, object);\n },\n fitSize: function(size, object) {\n return fitSize(projection, size, object);\n }\n };\n};\n\nfunction naturalEarth1Raw(lambda, phi) {\n var phi2 = phi * phi, phi4 = phi2 * phi2;\n return [\n lambda * (0.8707 - 0.131979 * phi2 + phi4 * (-0.013791 + phi4 * (0.003971 * phi2 - 0.001529 * phi4))),\n phi * (1.007226 + phi2 * (0.015085 + phi4 * (-0.044475 + 0.028874 * phi2 - 0.005916 * phi4)))\n ];\n}\n\nnaturalEarth1Raw.invert = function(x, y) {\n var phi = y, i = 25, delta;\n do {\n var phi2 = phi * phi, phi4 = phi2 * phi2;\n phi -= delta = (phi * (1.007226 + phi2 * (0.015085 + phi4 * (-0.044475 + 0.028874 * phi2 - 0.005916 * phi4))) - y) /\n (1.007226 + phi2 * (0.015085 * 3 + phi4 * (-0.044475 * 7 + 0.028874 * 9 * phi2 - 0.005916 * 11 * phi4)));\n } while (abs(delta) > epsilon$2 && --i > 0);\n return [\n x / (0.8707 + (phi2 = phi * phi) * (-0.131979 + phi2 * (-0.013791 + phi2 * phi2 * phi2 * (0.003971 - 0.001529 * phi2)))),\n phi\n ];\n};\n\nvar naturalEarth1 = function() {\n return projection(naturalEarth1Raw)\n .scale(175.295);\n};\n\nfunction orthographicRaw(x, y) {\n return [cos$1(y) * sin$1(x), sin$1(y)];\n}\n\northographicRaw.invert = azimuthalInvert(asin);\n\nvar orthographic = function() {\n return projection(orthographicRaw)\n .scale(249.5)\n .clipAngle(90 + epsilon$2);\n};\n\nfunction stereographicRaw(x, y) {\n var cy = cos$1(y), k = 1 + cos$1(x) * cy;\n return [cy * sin$1(x) / k, sin$1(y) / k];\n}\n\nstereographicRaw.invert = azimuthalInvert(function(z) {\n return 2 * atan(z);\n});\n\nvar stereographic = function() {\n return projection(stereographicRaw)\n .scale(250)\n .clipAngle(142);\n};\n\nfunction transverseMercatorRaw(lambda, phi) {\n return [log(tan((halfPi$2 + phi) / 2)), -lambda];\n}\n\ntransverseMercatorRaw.invert = function(x, y) {\n return [-y, 2 * atan(exp(x)) - halfPi$2];\n};\n\nvar transverseMercator = function() {\n var m = mercatorProjection(transverseMercatorRaw),\n center = m.center,\n rotate = m.rotate;\n\n m.center = function(_) {\n return arguments.length ? center([-_[1], _[0]]) : (_ = center(), [_[1], -_[0]]);\n };\n\n m.rotate = function(_) {\n return arguments.length ? rotate([_[0], _[1], _.length > 2 ? _[2] + 90 : 90]) : (_ = rotate(), [_[0], _[1], _[2] - 90]);\n };\n\n return rotate([0, 0, 90])\n .scale(159.155);\n};\n\nfunction defaultSeparation(a, b) {\n return a.parent === b.parent ? 1 : 2;\n}\n\nfunction meanX(children) {\n return children.reduce(meanXReduce, 0) / children.length;\n}\n\nfunction meanXReduce(x, c) {\n return x + c.x;\n}\n\nfunction maxY(children) {\n return 1 + children.reduce(maxYReduce, 0);\n}\n\nfunction maxYReduce(y, c) {\n return Math.max(y, c.y);\n}\n\nfunction leafLeft(node) {\n var children;\n while (children = node.children) node = children[0];\n return node;\n}\n\nfunction leafRight(node) {\n var children;\n while (children = node.children) node = children[children.length - 1];\n return node;\n}\n\nvar cluster = function() {\n var separation = defaultSeparation,\n dx = 1,\n dy = 1,\n nodeSize = false;\n\n function cluster(root) {\n var previousNode,\n x = 0;\n\n // First walk, computing the initial x & y values.\n root.eachAfter(function(node) {\n var children = node.children;\n if (children) {\n node.x = meanX(children);\n node.y = maxY(children);\n } else {\n node.x = previousNode ? x += separation(node, previousNode) : 0;\n node.y = 0;\n previousNode = node;\n }\n });\n\n var left = leafLeft(root),\n right = leafRight(root),\n x0 = left.x - separation(left, right) / 2,\n x1 = right.x + separation(right, left) / 2;\n\n // Second walk, normalizing x & y to the desired size.\n return root.eachAfter(nodeSize ? function(node) {\n node.x = (node.x - root.x) * dx;\n node.y = (root.y - node.y) * dy;\n } : function(node) {\n node.x = (node.x - x0) / (x1 - x0) * dx;\n node.y = (1 - (root.y ? node.y / root.y : 1)) * dy;\n });\n }\n\n cluster.separation = function(x) {\n return arguments.length ? (separation = x, cluster) : separation;\n };\n\n cluster.size = function(x) {\n return arguments.length ? (nodeSize = false, dx = +x[0], dy = +x[1], cluster) : (nodeSize ? null : [dx, dy]);\n };\n\n cluster.nodeSize = function(x) {\n return arguments.length ? (nodeSize = true, dx = +x[0], dy = +x[1], cluster) : (nodeSize ? [dx, dy] : null);\n };\n\n return cluster;\n};\n\nfunction count(node) {\n var sum = 0,\n children = node.children,\n i = children && children.length;\n if (!i) sum = 1;\n else while (--i >= 0) sum += children[i].value;\n node.value = sum;\n}\n\nvar node_count = function() {\n return this.eachAfter(count);\n};\n\nvar node_each = function(callback) {\n var node = this, current, next = [node], children, i, n;\n do {\n current = next.reverse(), next = [];\n while (node = current.pop()) {\n callback(node), children = node.children;\n if (children) for (i = 0, n = children.length; i < n; ++i) {\n next.push(children[i]);\n }\n }\n } while (next.length);\n return this;\n};\n\nvar node_eachBefore = function(callback) {\n var node = this, nodes = [node], children, i;\n while (node = nodes.pop()) {\n callback(node), children = node.children;\n if (children) for (i = children.length - 1; i >= 0; --i) {\n nodes.push(children[i]);\n }\n }\n return this;\n};\n\nvar node_eachAfter = function(callback) {\n var node = this, nodes = [node], next = [], children, i, n;\n while (node = nodes.pop()) {\n next.push(node), children = node.children;\n if (children) for (i = 0, n = children.length; i < n; ++i) {\n nodes.push(children[i]);\n }\n }\n while (node = next.pop()) {\n callback(node);\n }\n return this;\n};\n\nvar node_sum = function(value) {\n return this.eachAfter(function(node) {\n var sum = +value(node.data) || 0,\n children = node.children,\n i = children && children.length;\n while (--i >= 0) sum += children[i].value;\n node.value = sum;\n });\n};\n\nvar node_sort = function(compare) {\n return this.eachBefore(function(node) {\n if (node.children) {\n node.children.sort(compare);\n }\n });\n};\n\nvar node_path = function(end) {\n var start = this,\n ancestor = leastCommonAncestor(start, end),\n nodes = [start];\n while (start !== ancestor) {\n start = start.parent;\n nodes.push(start);\n }\n var k = nodes.length;\n while (end !== ancestor) {\n nodes.splice(k, 0, end);\n end = end.parent;\n }\n return nodes;\n};\n\nfunction leastCommonAncestor(a, b) {\n if (a === b) return a;\n var aNodes = a.ancestors(),\n bNodes = b.ancestors(),\n c = null;\n a = aNodes.pop();\n b = bNodes.pop();\n while (a === b) {\n c = a;\n a = aNodes.pop();\n b = bNodes.pop();\n }\n return c;\n}\n\nvar node_ancestors = function() {\n var node = this, nodes = [node];\n while (node = node.parent) {\n nodes.push(node);\n }\n return nodes;\n};\n\nvar node_descendants = function() {\n var nodes = [];\n this.each(function(node) {\n nodes.push(node);\n });\n return nodes;\n};\n\nvar node_leaves = function() {\n var leaves = [];\n this.eachBefore(function(node) {\n if (!node.children) {\n leaves.push(node);\n }\n });\n return leaves;\n};\n\nvar node_links = function() {\n var root = this, links = [];\n root.each(function(node) {\n if (node !== root) { // Don’t include the root’s parent, if any.\n links.push({source: node.parent, target: node});\n }\n });\n return links;\n};\n\nfunction hierarchy(data, children) {\n var root = new Node(data),\n valued = +data.value && (root.value = data.value),\n node,\n nodes = [root],\n child,\n childs,\n i,\n n;\n\n if (children == null) children = defaultChildren;\n\n while (node = nodes.pop()) {\n if (valued) node.value = +node.data.value;\n if ((childs = children(node.data)) && (n = childs.length)) {\n node.children = new Array(n);\n for (i = n - 1; i >= 0; --i) {\n nodes.push(child = node.children[i] = new Node(childs[i]));\n child.parent = node;\n child.depth = node.depth + 1;\n }\n }\n }\n\n return root.eachBefore(computeHeight);\n}\n\nfunction node_copy() {\n return hierarchy(this).eachBefore(copyData);\n}\n\nfunction defaultChildren(d) {\n return d.children;\n}\n\nfunction copyData(node) {\n node.data = node.data.data;\n}\n\nfunction computeHeight(node) {\n var height = 0;\n do node.height = height;\n while ((node = node.parent) && (node.height < ++height));\n}\n\nfunction Node(data) {\n this.data = data;\n this.depth =\n this.height = 0;\n this.parent = null;\n}\n\nNode.prototype = hierarchy.prototype = {\n constructor: Node,\n count: node_count,\n each: node_each,\n eachAfter: node_eachAfter,\n eachBefore: node_eachBefore,\n sum: node_sum,\n sort: node_sort,\n path: node_path,\n ancestors: node_ancestors,\n descendants: node_descendants,\n leaves: node_leaves,\n links: node_links,\n copy: node_copy\n};\n\nvar slice$3 = Array.prototype.slice;\n\nfunction shuffle$1(array) {\n var m = array.length,\n t,\n i;\n\n while (m) {\n i = Math.random() * m-- | 0;\n t = array[m];\n array[m] = array[i];\n array[i] = t;\n }\n\n return array;\n}\n\nvar enclose = function(circles) {\n var i = 0, n = (circles = shuffle$1(slice$3.call(circles))).length, B = [], p, e;\n\n while (i < n) {\n p = circles[i];\n if (e && enclosesWeak(e, p)) ++i;\n else e = encloseBasis(B = extendBasis(B, p)), i = 0;\n }\n\n return e;\n};\n\nfunction extendBasis(B, p) {\n var i, j;\n\n if (enclosesWeakAll(p, B)) return [p];\n\n // If we get here then B must have at least one element.\n for (i = 0; i < B.length; ++i) {\n if (enclosesNot(p, B[i])\n && enclosesWeakAll(encloseBasis2(B[i], p), B)) {\n return [B[i], p];\n }\n }\n\n // If we get here then B must have at least two elements.\n for (i = 0; i < B.length - 1; ++i) {\n for (j = i + 1; j < B.length; ++j) {\n if (enclosesNot(encloseBasis2(B[i], B[j]), p)\n && enclosesNot(encloseBasis2(B[i], p), B[j])\n && enclosesNot(encloseBasis2(B[j], p), B[i])\n && enclosesWeakAll(encloseBasis3(B[i], B[j], p), B)) {\n return [B[i], B[j], p];\n }\n }\n }\n\n // If we get here then something is very wrong.\n throw new Error;\n}\n\nfunction enclosesNot(a, b) {\n var dr = a.r - b.r, dx = b.x - a.x, dy = b.y - a.y;\n return dr < 0 || dr * dr < dx * dx + dy * dy;\n}\n\nfunction enclosesWeak(a, b) {\n var dr = a.r - b.r + 1e-6, dx = b.x - a.x, dy = b.y - a.y;\n return dr > 0 && dr * dr > dx * dx + dy * dy;\n}\n\nfunction enclosesWeakAll(a, B) {\n for (var i = 0; i < B.length; ++i) {\n if (!enclosesWeak(a, B[i])) {\n return false;\n }\n }\n return true;\n}\n\nfunction encloseBasis(B) {\n switch (B.length) {\n case 1: return encloseBasis1(B[0]);\n case 2: return encloseBasis2(B[0], B[1]);\n case 3: return encloseBasis3(B[0], B[1], B[2]);\n }\n}\n\nfunction encloseBasis1(a) {\n return {\n x: a.x,\n y: a.y,\n r: a.r\n };\n}\n\nfunction encloseBasis2(a, b) {\n var x1 = a.x, y1 = a.y, r1 = a.r,\n x2 = b.x, y2 = b.y, r2 = b.r,\n x21 = x2 - x1, y21 = y2 - y1, r21 = r2 - r1,\n l = Math.sqrt(x21 * x21 + y21 * y21);\n return {\n x: (x1 + x2 + x21 / l * r21) / 2,\n y: (y1 + y2 + y21 / l * r21) / 2,\n r: (l + r1 + r2) / 2\n };\n}\n\nfunction encloseBasis3(a, b, c) {\n var x1 = a.x, y1 = a.y, r1 = a.r,\n x2 = b.x, y2 = b.y, r2 = b.r,\n x3 = c.x, y3 = c.y, r3 = c.r,\n a2 = x1 - x2,\n a3 = x1 - x3,\n b2 = y1 - y2,\n b3 = y1 - y3,\n c2 = r2 - r1,\n c3 = r3 - r1,\n d1 = x1 * x1 + y1 * y1 - r1 * r1,\n d2 = d1 - x2 * x2 - y2 * y2 + r2 * r2,\n d3 = d1 - x3 * x3 - y3 * y3 + r3 * r3,\n ab = a3 * b2 - a2 * b3,\n xa = (b2 * d3 - b3 * d2) / (ab * 2) - x1,\n xb = (b3 * c2 - b2 * c3) / ab,\n ya = (a3 * d2 - a2 * d3) / (ab * 2) - y1,\n yb = (a2 * c3 - a3 * c2) / ab,\n A = xb * xb + yb * yb - 1,\n B = 2 * (r1 + xa * xb + ya * yb),\n C = xa * xa + ya * ya - r1 * r1,\n r = -(A ? (B + Math.sqrt(B * B - 4 * A * C)) / (2 * A) : C / B);\n return {\n x: x1 + xa + xb * r,\n y: y1 + ya + yb * r,\n r: r\n };\n}\n\nfunction place(a, b, c) {\n var ax = a.x,\n ay = a.y,\n da = b.r + c.r,\n db = a.r + c.r,\n dx = b.x - ax,\n dy = b.y - ay,\n dc = dx * dx + dy * dy;\n if (dc) {\n var x = 0.5 + ((db *= db) - (da *= da)) / (2 * dc),\n y = Math.sqrt(Math.max(0, 2 * da * (db + dc) - (db -= dc) * db - da * da)) / (2 * dc);\n c.x = ax + x * dx + y * dy;\n c.y = ay + x * dy - y * dx;\n } else {\n c.x = ax + db;\n c.y = ay;\n }\n}\n\nfunction intersects(a, b) {\n var dx = b.x - a.x,\n dy = b.y - a.y,\n dr = a.r + b.r;\n return dr * dr - 1e-6 > dx * dx + dy * dy;\n}\n\nfunction score(node) {\n var a = node._,\n b = node.next._,\n ab = a.r + b.r,\n dx = (a.x * b.r + b.x * a.r) / ab,\n dy = (a.y * b.r + b.y * a.r) / ab;\n return dx * dx + dy * dy;\n}\n\nfunction Node$1(circle) {\n this._ = circle;\n this.next = null;\n this.previous = null;\n}\n\nfunction packEnclose(circles) {\n if (!(n = circles.length)) return 0;\n\n var a, b, c, n, aa, ca, i, j, k, sj, sk;\n\n // Place the first circle.\n a = circles[0], a.x = 0, a.y = 0;\n if (!(n > 1)) return a.r;\n\n // Place the second circle.\n b = circles[1], a.x = -b.r, b.x = a.r, b.y = 0;\n if (!(n > 2)) return a.r + b.r;\n\n // Place the third circle.\n place(b, a, c = circles[2]);\n\n // Initialize the front-chain using the first three circles a, b and c.\n a = new Node$1(a), b = new Node$1(b), c = new Node$1(c);\n a.next = c.previous = b;\n b.next = a.previous = c;\n c.next = b.previous = a;\n\n // Attempt to place each remaining circle…\n pack: for (i = 3; i < n; ++i) {\n place(a._, b._, c = circles[i]), c = new Node$1(c);\n\n // Find the closest intersecting circle on the front-chain, if any.\n // “Closeness” is determined by linear distance along the front-chain.\n // “Ahead” or “behind” is likewise determined by linear distance.\n j = b.next, k = a.previous, sj = b._.r, sk = a._.r;\n do {\n if (sj <= sk) {\n if (intersects(j._, c._)) {\n b = j, a.next = b, b.previous = a, --i;\n continue pack;\n }\n sj += j._.r, j = j.next;\n } else {\n if (intersects(k._, c._)) {\n a = k, a.next = b, b.previous = a, --i;\n continue pack;\n }\n sk += k._.r, k = k.previous;\n }\n } while (j !== k.next);\n\n // Success! Insert the new circle c between a and b.\n c.previous = a, c.next = b, a.next = b.previous = b = c;\n\n // Compute the new closest circle pair to the centroid.\n aa = score(a);\n while ((c = c.next) !== b) {\n if ((ca = score(c)) < aa) {\n a = c, aa = ca;\n }\n }\n b = a.next;\n }\n\n // Compute the enclosing circle of the front chain.\n a = [b._], c = b; while ((c = c.next) !== b) a.push(c._); c = enclose(a);\n\n // Translate the circles to put the enclosing circle around the origin.\n for (i = 0; i < n; ++i) a = circles[i], a.x -= c.x, a.y -= c.y;\n\n return c.r;\n}\n\nvar siblings = function(circles) {\n packEnclose(circles);\n return circles;\n};\n\nfunction optional(f) {\n return f == null ? null : required(f);\n}\n\nfunction required(f) {\n if (typeof f !== \"function\") throw new Error;\n return f;\n}\n\nfunction constantZero() {\n return 0;\n}\n\nvar constant$8 = function(x) {\n return function() {\n return x;\n };\n};\n\nfunction defaultRadius$1(d) {\n return Math.sqrt(d.value);\n}\n\nvar index$2 = function() {\n var radius = null,\n dx = 1,\n dy = 1,\n padding = constantZero;\n\n function pack(root) {\n root.x = dx / 2, root.y = dy / 2;\n if (radius) {\n root.eachBefore(radiusLeaf(radius))\n .eachAfter(packChildren(padding, 0.5))\n .eachBefore(translateChild(1));\n } else {\n root.eachBefore(radiusLeaf(defaultRadius$1))\n .eachAfter(packChildren(constantZero, 1))\n .eachAfter(packChildren(padding, root.r / Math.min(dx, dy)))\n .eachBefore(translateChild(Math.min(dx, dy) / (2 * root.r)));\n }\n return root;\n }\n\n pack.radius = function(x) {\n return arguments.length ? (radius = optional(x), pack) : radius;\n };\n\n pack.size = function(x) {\n return arguments.length ? (dx = +x[0], dy = +x[1], pack) : [dx, dy];\n };\n\n pack.padding = function(x) {\n return arguments.length ? (padding = typeof x === \"function\" ? x : constant$8(+x), pack) : padding;\n };\n\n return pack;\n};\n\nfunction radiusLeaf(radius) {\n return function(node) {\n if (!node.children) {\n node.r = Math.max(0, +radius(node) || 0);\n }\n };\n}\n\nfunction packChildren(padding, k) {\n return function(node) {\n if (children = node.children) {\n var children,\n i,\n n = children.length,\n r = padding(node) * k || 0,\n e;\n\n if (r) for (i = 0; i < n; ++i) children[i].r += r;\n e = packEnclose(children);\n if (r) for (i = 0; i < n; ++i) children[i].r -= r;\n node.r = e + r;\n }\n };\n}\n\nfunction translateChild(k) {\n return function(node) {\n var parent = node.parent;\n node.r *= k;\n if (parent) {\n node.x = parent.x + k * node.x;\n node.y = parent.y + k * node.y;\n }\n };\n}\n\nvar roundNode = function(node) {\n node.x0 = Math.round(node.x0);\n node.y0 = Math.round(node.y0);\n node.x1 = Math.round(node.x1);\n node.y1 = Math.round(node.y1);\n};\n\nvar treemapDice = function(parent, x0, y0, x1, y1) {\n var nodes = parent.children,\n node,\n i = -1,\n n = nodes.length,\n k = parent.value && (x1 - x0) / parent.value;\n\n while (++i < n) {\n node = nodes[i], node.y0 = y0, node.y1 = y1;\n node.x0 = x0, node.x1 = x0 += node.value * k;\n }\n};\n\nvar partition = function() {\n var dx = 1,\n dy = 1,\n padding = 0,\n round = false;\n\n function partition(root) {\n var n = root.height + 1;\n root.x0 =\n root.y0 = padding;\n root.x1 = dx;\n root.y1 = dy / n;\n root.eachBefore(positionNode(dy, n));\n if (round) root.eachBefore(roundNode);\n return root;\n }\n\n function positionNode(dy, n) {\n return function(node) {\n if (node.children) {\n treemapDice(node, node.x0, dy * (node.depth + 1) / n, node.x1, dy * (node.depth + 2) / n);\n }\n var x0 = node.x0,\n y0 = node.y0,\n x1 = node.x1 - padding,\n y1 = node.y1 - padding;\n if (x1 < x0) x0 = x1 = (x0 + x1) / 2;\n if (y1 < y0) y0 = y1 = (y0 + y1) / 2;\n node.x0 = x0;\n node.y0 = y0;\n node.x1 = x1;\n node.y1 = y1;\n };\n }\n\n partition.round = function(x) {\n return arguments.length ? (round = !!x, partition) : round;\n };\n\n partition.size = function(x) {\n return arguments.length ? (dx = +x[0], dy = +x[1], partition) : [dx, dy];\n };\n\n partition.padding = function(x) {\n return arguments.length ? (padding = +x, partition) : padding;\n };\n\n return partition;\n};\n\nvar keyPrefix$1 = \"$\";\nvar preroot = {depth: -1};\nvar ambiguous = {};\n\nfunction defaultId(d) {\n return d.id;\n}\n\nfunction defaultParentId(d) {\n return d.parentId;\n}\n\nvar stratify = function() {\n var id = defaultId,\n parentId = defaultParentId;\n\n function stratify(data) {\n var d,\n i,\n n = data.length,\n root,\n parent,\n node,\n nodes = new Array(n),\n nodeId,\n nodeKey,\n nodeByKey = {};\n\n for (i = 0; i < n; ++i) {\n d = data[i], node = nodes[i] = new Node(d);\n if ((nodeId = id(d, i, data)) != null && (nodeId += \"\")) {\n nodeKey = keyPrefix$1 + (node.id = nodeId);\n nodeByKey[nodeKey] = nodeKey in nodeByKey ? ambiguous : node;\n }\n }\n\n for (i = 0; i < n; ++i) {\n node = nodes[i], nodeId = parentId(data[i], i, data);\n if (nodeId == null || !(nodeId += \"\")) {\n if (root) throw new Error(\"multiple roots\");\n root = node;\n } else {\n parent = nodeByKey[keyPrefix$1 + nodeId];\n if (!parent) throw new Error(\"missing: \" + nodeId);\n if (parent === ambiguous) throw new Error(\"ambiguous: \" + nodeId);\n if (parent.children) parent.children.push(node);\n else parent.children = [node];\n node.parent = parent;\n }\n }\n\n if (!root) throw new Error(\"no root\");\n root.parent = preroot;\n root.eachBefore(function(node) { node.depth = node.parent.depth + 1; --n; }).eachBefore(computeHeight);\n root.parent = null;\n if (n > 0) throw new Error(\"cycle\");\n\n return root;\n }\n\n stratify.id = function(x) {\n return arguments.length ? (id = required(x), stratify) : id;\n };\n\n stratify.parentId = function(x) {\n return arguments.length ? (parentId = required(x), stratify) : parentId;\n };\n\n return stratify;\n};\n\nfunction defaultSeparation$1(a, b) {\n return a.parent === b.parent ? 1 : 2;\n}\n\n// function radialSeparation(a, b) {\n// return (a.parent === b.parent ? 1 : 2) / a.depth;\n// }\n\n// This function is used to traverse the left contour of a subtree (or\n// subforest). It returns the successor of v on this contour. This successor is\n// either given by the leftmost child of v or by the thread of v. The function\n// returns null if and only if v is on the highest level of its subtree.\nfunction nextLeft(v) {\n var children = v.children;\n return children ? children[0] : v.t;\n}\n\n// This function works analogously to nextLeft.\nfunction nextRight(v) {\n var children = v.children;\n return children ? children[children.length - 1] : v.t;\n}\n\n// Shifts the current subtree rooted at w+. This is done by increasing\n// prelim(w+) and mod(w+) by shift.\nfunction moveSubtree(wm, wp, shift) {\n var change = shift / (wp.i - wm.i);\n wp.c -= change;\n wp.s += shift;\n wm.c += change;\n wp.z += shift;\n wp.m += shift;\n}\n\n// All other shifts, applied to the smaller subtrees between w- and w+, are\n// performed by this function. To prepare the shifts, we have to adjust\n// change(w+), shift(w+), and change(w-).\nfunction executeShifts(v) {\n var shift = 0,\n change = 0,\n children = v.children,\n i = children.length,\n w;\n while (--i >= 0) {\n w = children[i];\n w.z += shift;\n w.m += shift;\n shift += w.s + (change += w.c);\n }\n}\n\n// If vi-’s ancestor is a sibling of v, returns vi-’s ancestor. Otherwise,\n// returns the specified (default) ancestor.\nfunction nextAncestor(vim, v, ancestor) {\n return vim.a.parent === v.parent ? vim.a : ancestor;\n}\n\nfunction TreeNode(node, i) {\n this._ = node;\n this.parent = null;\n this.children = null;\n this.A = null; // default ancestor\n this.a = this; // ancestor\n this.z = 0; // prelim\n this.m = 0; // mod\n this.c = 0; // change\n this.s = 0; // shift\n this.t = null; // thread\n this.i = i; // number\n}\n\nTreeNode.prototype = Object.create(Node.prototype);\n\nfunction treeRoot(root) {\n var tree = new TreeNode(root, 0),\n node,\n nodes = [tree],\n child,\n children,\n i,\n n;\n\n while (node = nodes.pop()) {\n if (children = node._.children) {\n node.children = new Array(n = children.length);\n for (i = n - 1; i >= 0; --i) {\n nodes.push(child = node.children[i] = new TreeNode(children[i], i));\n child.parent = node;\n }\n }\n }\n\n (tree.parent = new TreeNode(null, 0)).children = [tree];\n return tree;\n}\n\n// Node-link tree diagram using the Reingold-Tilford \"tidy\" algorithm\nvar tree = function() {\n var separation = defaultSeparation$1,\n dx = 1,\n dy = 1,\n nodeSize = null;\n\n function tree(root) {\n var t = treeRoot(root);\n\n // Compute the layout using Buchheim et al.’s algorithm.\n t.eachAfter(firstWalk), t.parent.m = -t.z;\n t.eachBefore(secondWalk);\n\n // If a fixed node size is specified, scale x and y.\n if (nodeSize) root.eachBefore(sizeNode);\n\n // If a fixed tree size is specified, scale x and y based on the extent.\n // Compute the left-most, right-most, and depth-most nodes for extents.\n else {\n var left = root,\n right = root,\n bottom = root;\n root.eachBefore(function(node) {\n if (node.x < left.x) left = node;\n if (node.x > right.x) right = node;\n if (node.depth > bottom.depth) bottom = node;\n });\n var s = left === right ? 1 : separation(left, right) / 2,\n tx = s - left.x,\n kx = dx / (right.x + s + tx),\n ky = dy / (bottom.depth || 1);\n root.eachBefore(function(node) {\n node.x = (node.x + tx) * kx;\n node.y = node.depth * ky;\n });\n }\n\n return root;\n }\n\n // Computes a preliminary x-coordinate for v. Before that, FIRST WALK is\n // applied recursively to the children of v, as well as the function\n // APPORTION. After spacing out the children by calling EXECUTE SHIFTS, the\n // node v is placed to the midpoint of its outermost children.\n function firstWalk(v) {\n var children = v.children,\n siblings = v.parent.children,\n w = v.i ? siblings[v.i - 1] : null;\n if (children) {\n executeShifts(v);\n var midpoint = (children[0].z + children[children.length - 1].z) / 2;\n if (w) {\n v.z = w.z + separation(v._, w._);\n v.m = v.z - midpoint;\n } else {\n v.z = midpoint;\n }\n } else if (w) {\n v.z = w.z + separation(v._, w._);\n }\n v.parent.A = apportion(v, w, v.parent.A || siblings[0]);\n }\n\n // Computes all real x-coordinates by summing up the modifiers recursively.\n function secondWalk(v) {\n v._.x = v.z + v.parent.m;\n v.m += v.parent.m;\n }\n\n // The core of the algorithm. Here, a new subtree is combined with the\n // previous subtrees. Threads are used to traverse the inside and outside\n // contours of the left and right subtree up to the highest common level. The\n // vertices used for the traversals are vi+, vi-, vo-, and vo+, where the\n // superscript o means outside and i means inside, the subscript - means left\n // subtree and + means right subtree. For summing up the modifiers along the\n // contour, we use respective variables si+, si-, so-, and so+. Whenever two\n // nodes of the inside contours conflict, we compute the left one of the\n // greatest uncommon ancestors using the function ANCESTOR and call MOVE\n // SUBTREE to shift the subtree and prepare the shifts of smaller subtrees.\n // Finally, we add a new thread (if necessary).\n function apportion(v, w, ancestor) {\n if (w) {\n var vip = v,\n vop = v,\n vim = w,\n vom = vip.parent.children[0],\n sip = vip.m,\n sop = vop.m,\n sim = vim.m,\n som = vom.m,\n shift;\n while (vim = nextRight(vim), vip = nextLeft(vip), vim && vip) {\n vom = nextLeft(vom);\n vop = nextRight(vop);\n vop.a = v;\n shift = vim.z + sim - vip.z - sip + separation(vim._, vip._);\n if (shift > 0) {\n moveSubtree(nextAncestor(vim, v, ancestor), v, shift);\n sip += shift;\n sop += shift;\n }\n sim += vim.m;\n sip += vip.m;\n som += vom.m;\n sop += vop.m;\n }\n if (vim && !nextRight(vop)) {\n vop.t = vim;\n vop.m += sim - sop;\n }\n if (vip && !nextLeft(vom)) {\n vom.t = vip;\n vom.m += sip - som;\n ancestor = v;\n }\n }\n return ancestor;\n }\n\n function sizeNode(node) {\n node.x *= dx;\n node.y = node.depth * dy;\n }\n\n tree.separation = function(x) {\n return arguments.length ? (separation = x, tree) : separation;\n };\n\n tree.size = function(x) {\n return arguments.length ? (nodeSize = false, dx = +x[0], dy = +x[1], tree) : (nodeSize ? null : [dx, dy]);\n };\n\n tree.nodeSize = function(x) {\n return arguments.length ? (nodeSize = true, dx = +x[0], dy = +x[1], tree) : (nodeSize ? [dx, dy] : null);\n };\n\n return tree;\n};\n\nvar treemapSlice = function(parent, x0, y0, x1, y1) {\n var nodes = parent.children,\n node,\n i = -1,\n n = nodes.length,\n k = parent.value && (y1 - y0) / parent.value;\n\n while (++i < n) {\n node = nodes[i], node.x0 = x0, node.x1 = x1;\n node.y0 = y0, node.y1 = y0 += node.value * k;\n }\n};\n\nvar phi = (1 + Math.sqrt(5)) / 2;\n\nfunction squarifyRatio(ratio, parent, x0, y0, x1, y1) {\n var rows = [],\n nodes = parent.children,\n row,\n nodeValue,\n i0 = 0,\n i1 = 0,\n n = nodes.length,\n dx, dy,\n value = parent.value,\n sumValue,\n minValue,\n maxValue,\n newRatio,\n minRatio,\n alpha,\n beta;\n\n while (i0 < n) {\n dx = x1 - x0, dy = y1 - y0;\n\n // Find the next non-empty node.\n do sumValue = nodes[i1++].value; while (!sumValue && i1 < n);\n minValue = maxValue = sumValue;\n alpha = Math.max(dy / dx, dx / dy) / (value * ratio);\n beta = sumValue * sumValue * alpha;\n minRatio = Math.max(maxValue / beta, beta / minValue);\n\n // Keep adding nodes while the aspect ratio maintains or improves.\n for (; i1 < n; ++i1) {\n sumValue += nodeValue = nodes[i1].value;\n if (nodeValue < minValue) minValue = nodeValue;\n if (nodeValue > maxValue) maxValue = nodeValue;\n beta = sumValue * sumValue * alpha;\n newRatio = Math.max(maxValue / beta, beta / minValue);\n if (newRatio > minRatio) { sumValue -= nodeValue; break; }\n minRatio = newRatio;\n }\n\n // Position and record the row orientation.\n rows.push(row = {value: sumValue, dice: dx < dy, children: nodes.slice(i0, i1)});\n if (row.dice) treemapDice(row, x0, y0, x1, value ? y0 += dy * sumValue / value : y1);\n else treemapSlice(row, x0, y0, value ? x0 += dx * sumValue / value : x1, y1);\n value -= sumValue, i0 = i1;\n }\n\n return rows;\n}\n\nvar squarify = (function custom(ratio) {\n\n function squarify(parent, x0, y0, x1, y1) {\n squarifyRatio(ratio, parent, x0, y0, x1, y1);\n }\n\n squarify.ratio = function(x) {\n return custom((x = +x) > 1 ? x : 1);\n };\n\n return squarify;\n})(phi);\n\nvar index$3 = function() {\n var tile = squarify,\n round = false,\n dx = 1,\n dy = 1,\n paddingStack = [0],\n paddingInner = constantZero,\n paddingTop = constantZero,\n paddingRight = constantZero,\n paddingBottom = constantZero,\n paddingLeft = constantZero;\n\n function treemap(root) {\n root.x0 =\n root.y0 = 0;\n root.x1 = dx;\n root.y1 = dy;\n root.eachBefore(positionNode);\n paddingStack = [0];\n if (round) root.eachBefore(roundNode);\n return root;\n }\n\n function positionNode(node) {\n var p = paddingStack[node.depth],\n x0 = node.x0 + p,\n y0 = node.y0 + p,\n x1 = node.x1 - p,\n y1 = node.y1 - p;\n if (x1 < x0) x0 = x1 = (x0 + x1) / 2;\n if (y1 < y0) y0 = y1 = (y0 + y1) / 2;\n node.x0 = x0;\n node.y0 = y0;\n node.x1 = x1;\n node.y1 = y1;\n if (node.children) {\n p = paddingStack[node.depth + 1] = paddingInner(node) / 2;\n x0 += paddingLeft(node) - p;\n y0 += paddingTop(node) - p;\n x1 -= paddingRight(node) - p;\n y1 -= paddingBottom(node) - p;\n if (x1 < x0) x0 = x1 = (x0 + x1) / 2;\n if (y1 < y0) y0 = y1 = (y0 + y1) / 2;\n tile(node, x0, y0, x1, y1);\n }\n }\n\n treemap.round = function(x) {\n return arguments.length ? (round = !!x, treemap) : round;\n };\n\n treemap.size = function(x) {\n return arguments.length ? (dx = +x[0], dy = +x[1], treemap) : [dx, dy];\n };\n\n treemap.tile = function(x) {\n return arguments.length ? (tile = required(x), treemap) : tile;\n };\n\n treemap.padding = function(x) {\n return arguments.length ? treemap.paddingInner(x).paddingOuter(x) : treemap.paddingInner();\n };\n\n treemap.paddingInner = function(x) {\n return arguments.length ? (paddingInner = typeof x === \"function\" ? x : constant$8(+x), treemap) : paddingInner;\n };\n\n treemap.paddingOuter = function(x) {\n return arguments.length ? treemap.paddingTop(x).paddingRight(x).paddingBottom(x).paddingLeft(x) : treemap.paddingTop();\n };\n\n treemap.paddingTop = function(x) {\n return arguments.length ? (paddingTop = typeof x === \"function\" ? x : constant$8(+x), treemap) : paddingTop;\n };\n\n treemap.paddingRight = function(x) {\n return arguments.length ? (paddingRight = typeof x === \"function\" ? x : constant$8(+x), treemap) : paddingRight;\n };\n\n treemap.paddingBottom = function(x) {\n return arguments.length ? (paddingBottom = typeof x === \"function\" ? x : constant$8(+x), treemap) : paddingBottom;\n };\n\n treemap.paddingLeft = function(x) {\n return arguments.length ? (paddingLeft = typeof x === \"function\" ? x : constant$8(+x), treemap) : paddingLeft;\n };\n\n return treemap;\n};\n\nvar binary = function(parent, x0, y0, x1, y1) {\n var nodes = parent.children,\n i, n = nodes.length,\n sum, sums = new Array(n + 1);\n\n for (sums[0] = sum = i = 0; i < n; ++i) {\n sums[i + 1] = sum += nodes[i].value;\n }\n\n partition(0, n, parent.value, x0, y0, x1, y1);\n\n function partition(i, j, value, x0, y0, x1, y1) {\n if (i >= j - 1) {\n var node = nodes[i];\n node.x0 = x0, node.y0 = y0;\n node.x1 = x1, node.y1 = y1;\n return;\n }\n\n var valueOffset = sums[i],\n valueTarget = (value / 2) + valueOffset,\n k = i + 1,\n hi = j - 1;\n\n while (k < hi) {\n var mid = k + hi >>> 1;\n if (sums[mid] < valueTarget) k = mid + 1;\n else hi = mid;\n }\n\n if ((valueTarget - sums[k - 1]) < (sums[k] - valueTarget) && i + 1 < k) --k;\n\n var valueLeft = sums[k] - valueOffset,\n valueRight = value - valueLeft;\n\n if ((x1 - x0) > (y1 - y0)) {\n var xk = (x0 * valueRight + x1 * valueLeft) / value;\n partition(i, k, valueLeft, x0, y0, xk, y1);\n partition(k, j, valueRight, xk, y0, x1, y1);\n } else {\n var yk = (y0 * valueRight + y1 * valueLeft) / value;\n partition(i, k, valueLeft, x0, y0, x1, yk);\n partition(k, j, valueRight, x0, yk, x1, y1);\n }\n }\n};\n\nvar sliceDice = function(parent, x0, y0, x1, y1) {\n (parent.depth & 1 ? treemapSlice : treemapDice)(parent, x0, y0, x1, y1);\n};\n\nvar resquarify = (function custom(ratio) {\n\n function resquarify(parent, x0, y0, x1, y1) {\n if ((rows = parent._squarify) && (rows.ratio === ratio)) {\n var rows,\n row,\n nodes,\n i,\n j = -1,\n n,\n m = rows.length,\n value = parent.value;\n\n while (++j < m) {\n row = rows[j], nodes = row.children;\n for (i = row.value = 0, n = nodes.length; i < n; ++i) row.value += nodes[i].value;\n if (row.dice) treemapDice(row, x0, y0, x1, y0 += (y1 - y0) * row.value / value);\n else treemapSlice(row, x0, y0, x0 += (x1 - x0) * row.value / value, y1);\n value -= row.value;\n }\n } else {\n parent._squarify = rows = squarifyRatio(ratio, parent, x0, y0, x1, y1);\n rows.ratio = ratio;\n }\n }\n\n resquarify.ratio = function(x) {\n return custom((x = +x) > 1 ? x : 1);\n };\n\n return resquarify;\n})(phi);\n\nvar area$1 = function(polygon) {\n var i = -1,\n n = polygon.length,\n a,\n b = polygon[n - 1],\n area = 0;\n\n while (++i < n) {\n a = b;\n b = polygon[i];\n area += a[1] * b[0] - a[0] * b[1];\n }\n\n return area / 2;\n};\n\nvar centroid$1 = function(polygon) {\n var i = -1,\n n = polygon.length,\n x = 0,\n y = 0,\n a,\n b = polygon[n - 1],\n c,\n k = 0;\n\n while (++i < n) {\n a = b;\n b = polygon[i];\n k += c = a[0] * b[1] - b[0] * a[1];\n x += (a[0] + b[0]) * c;\n y += (a[1] + b[1]) * c;\n }\n\n return k *= 3, [x / k, y / k];\n};\n\n// Returns the 2D cross product of AB and AC vectors, i.e., the z-component of\n// the 3D cross product in a quadrant I Cartesian coordinate system (+x is\n// right, +y is up). Returns a positive value if ABC is counter-clockwise,\n// negative if clockwise, and zero if the points are collinear.\nvar cross$1 = function(a, b, c) {\n return (b[0] - a[0]) * (c[1] - a[1]) - (b[1] - a[1]) * (c[0] - a[0]);\n};\n\nfunction lexicographicOrder(a, b) {\n return a[0] - b[0] || a[1] - b[1];\n}\n\n// Computes the upper convex hull per the monotone chain algorithm.\n// Assumes points.length >= 3, is sorted by x, unique in y.\n// Returns an array of indices into points in left-to-right order.\nfunction computeUpperHullIndexes(points) {\n var n = points.length,\n indexes = [0, 1],\n size = 2;\n\n for (var i = 2; i < n; ++i) {\n while (size > 1 && cross$1(points[indexes[size - 2]], points[indexes[size - 1]], points[i]) <= 0) --size;\n indexes[size++] = i;\n }\n\n return indexes.slice(0, size); // remove popped points\n}\n\nvar hull = function(points) {\n if ((n = points.length) < 3) return null;\n\n var i,\n n,\n sortedPoints = new Array(n),\n flippedPoints = new Array(n);\n\n for (i = 0; i < n; ++i) sortedPoints[i] = [+points[i][0], +points[i][1], i];\n sortedPoints.sort(lexicographicOrder);\n for (i = 0; i < n; ++i) flippedPoints[i] = [sortedPoints[i][0], -sortedPoints[i][1]];\n\n var upperIndexes = computeUpperHullIndexes(sortedPoints),\n lowerIndexes = computeUpperHullIndexes(flippedPoints);\n\n // Construct the hull polygon, removing possible duplicate endpoints.\n var skipLeft = lowerIndexes[0] === upperIndexes[0],\n skipRight = lowerIndexes[lowerIndexes.length - 1] === upperIndexes[upperIndexes.length - 1],\n hull = [];\n\n // Add upper hull in right-to-l order.\n // Then add lower hull in left-to-right order.\n for (i = upperIndexes.length - 1; i >= 0; --i) hull.push(points[sortedPoints[upperIndexes[i]][2]]);\n for (i = +skipLeft; i < lowerIndexes.length - skipRight; ++i) hull.push(points[sortedPoints[lowerIndexes[i]][2]]);\n\n return hull;\n};\n\nvar contains$1 = function(polygon, point) {\n var n = polygon.length,\n p = polygon[n - 1],\n x = point[0], y = point[1],\n x0 = p[0], y0 = p[1],\n x1, y1,\n inside = false;\n\n for (var i = 0; i < n; ++i) {\n p = polygon[i], x1 = p[0], y1 = p[1];\n if (((y1 > y) !== (y0 > y)) && (x < (x0 - x1) * (y - y1) / (y0 - y1) + x1)) inside = !inside;\n x0 = x1, y0 = y1;\n }\n\n return inside;\n};\n\nvar length$2 = function(polygon) {\n var i = -1,\n n = polygon.length,\n b = polygon[n - 1],\n xa,\n ya,\n xb = b[0],\n yb = b[1],\n perimeter = 0;\n\n while (++i < n) {\n xa = xb;\n ya = yb;\n b = polygon[i];\n xb = b[0];\n yb = b[1];\n xa -= xb;\n ya -= yb;\n perimeter += Math.sqrt(xa * xa + ya * ya);\n }\n\n return perimeter;\n};\n\nvar slice$4 = [].slice;\n\nvar noabort = {};\n\nfunction Queue(size) {\n this._size = size;\n this._call =\n this._error = null;\n this._tasks = [];\n this._data = [];\n this._waiting =\n this._active =\n this._ended =\n this._start = 0; // inside a synchronous task callback?\n}\n\nQueue.prototype = queue.prototype = {\n constructor: Queue,\n defer: function(callback) {\n if (typeof callback !== \"function\") throw new Error(\"invalid callback\");\n if (this._call) throw new Error(\"defer after await\");\n if (this._error != null) return this;\n var t = slice$4.call(arguments, 1);\n t.push(callback);\n ++this._waiting, this._tasks.push(t);\n poke$1(this);\n return this;\n },\n abort: function() {\n if (this._error == null) abort(this, new Error(\"abort\"));\n return this;\n },\n await: function(callback) {\n if (typeof callback !== \"function\") throw new Error(\"invalid callback\");\n if (this._call) throw new Error(\"multiple await\");\n this._call = function(error, results) { callback.apply(null, [error].concat(results)); };\n maybeNotify(this);\n return this;\n },\n awaitAll: function(callback) {\n if (typeof callback !== \"function\") throw new Error(\"invalid callback\");\n if (this._call) throw new Error(\"multiple await\");\n this._call = callback;\n maybeNotify(this);\n return this;\n }\n};\n\nfunction poke$1(q) {\n if (!q._start) {\n try { start$1(q); } // let the current task complete\n catch (e) {\n if (q._tasks[q._ended + q._active - 1]) abort(q, e); // task errored synchronously\n else if (!q._data) throw e; // await callback errored synchronously\n }\n }\n}\n\nfunction start$1(q) {\n while (q._start = q._waiting && q._active < q._size) {\n var i = q._ended + q._active,\n t = q._tasks[i],\n j = t.length - 1,\n c = t[j];\n t[j] = end(q, i);\n --q._waiting, ++q._active;\n t = c.apply(null, t);\n if (!q._tasks[i]) continue; // task finished synchronously\n q._tasks[i] = t || noabort;\n }\n}\n\nfunction end(q, i) {\n return function(e, r) {\n if (!q._tasks[i]) return; // ignore multiple callbacks\n --q._active, ++q._ended;\n q._tasks[i] = null;\n if (q._error != null) return; // ignore secondary errors\n if (e != null) {\n abort(q, e);\n } else {\n q._data[i] = r;\n if (q._waiting) poke$1(q);\n else maybeNotify(q);\n }\n };\n}\n\nfunction abort(q, e) {\n var i = q._tasks.length, t;\n q._error = e; // ignore active callbacks\n q._data = undefined; // allow gc\n q._waiting = NaN; // prevent starting\n\n while (--i >= 0) {\n if (t = q._tasks[i]) {\n q._tasks[i] = null;\n if (t.abort) {\n try { t.abort(); }\n catch (e) { /* ignore */ }\n }\n }\n }\n\n q._active = NaN; // allow notification\n maybeNotify(q);\n}\n\nfunction maybeNotify(q) {\n if (!q._active && q._call) {\n var d = q._data;\n q._data = undefined; // allow gc\n q._call(q._error, d);\n }\n}\n\nfunction queue(concurrency) {\n if (concurrency == null) concurrency = Infinity;\n else if (!((concurrency = +concurrency) >= 1)) throw new Error(\"invalid concurrency\");\n return new Queue(concurrency);\n}\n\nvar defaultSource$1 = function() {\n return Math.random();\n};\n\nvar uniform = (function sourceRandomUniform(source) {\n function randomUniform(min, max) {\n min = min == null ? 0 : +min;\n max = max == null ? 1 : +max;\n if (arguments.length === 1) max = min, min = 0;\n else max -= min;\n return function() {\n return source() * max + min;\n };\n }\n\n randomUniform.source = sourceRandomUniform;\n\n return randomUniform;\n})(defaultSource$1);\n\nvar normal = (function sourceRandomNormal(source) {\n function randomNormal(mu, sigma) {\n var x, r;\n mu = mu == null ? 0 : +mu;\n sigma = sigma == null ? 1 : +sigma;\n return function() {\n var y;\n\n // If available, use the second previously-generated uniform random.\n if (x != null) y = x, x = null;\n\n // Otherwise, generate a new x and y.\n else do {\n x = source() * 2 - 1;\n y = source() * 2 - 1;\n r = x * x + y * y;\n } while (!r || r > 1);\n\n return mu + sigma * y * Math.sqrt(-2 * Math.log(r) / r);\n };\n }\n\n randomNormal.source = sourceRandomNormal;\n\n return randomNormal;\n})(defaultSource$1);\n\nvar logNormal = (function sourceRandomLogNormal(source) {\n function randomLogNormal() {\n var randomNormal = normal.source(source).apply(this, arguments);\n return function() {\n return Math.exp(randomNormal());\n };\n }\n\n randomLogNormal.source = sourceRandomLogNormal;\n\n return randomLogNormal;\n})(defaultSource$1);\n\nvar irwinHall = (function sourceRandomIrwinHall(source) {\n function randomIrwinHall(n) {\n return function() {\n for (var sum = 0, i = 0; i < n; ++i) sum += source();\n return sum;\n };\n }\n\n randomIrwinHall.source = sourceRandomIrwinHall;\n\n return randomIrwinHall;\n})(defaultSource$1);\n\nvar bates = (function sourceRandomBates(source) {\n function randomBates(n) {\n var randomIrwinHall = irwinHall.source(source)(n);\n return function() {\n return randomIrwinHall() / n;\n };\n }\n\n randomBates.source = sourceRandomBates;\n\n return randomBates;\n})(defaultSource$1);\n\nvar exponential$1 = (function sourceRandomExponential(source) {\n function randomExponential(lambda) {\n return function() {\n return -Math.log(1 - source()) / lambda;\n };\n }\n\n randomExponential.source = sourceRandomExponential;\n\n return randomExponential;\n})(defaultSource$1);\n\nvar request = function(url, callback) {\n var request,\n event = dispatch(\"beforesend\", \"progress\", \"load\", \"error\"),\n mimeType,\n headers = map$1(),\n xhr = new XMLHttpRequest,\n user = null,\n password = null,\n response,\n responseType,\n timeout = 0;\n\n // If IE does not support CORS, use XDomainRequest.\n if (typeof XDomainRequest !== \"undefined\"\n && !(\"withCredentials\" in xhr)\n && /^(http(s)?:)?\\/\\//.test(url)) xhr = new XDomainRequest;\n\n \"onload\" in xhr\n ? xhr.onload = xhr.onerror = xhr.ontimeout = respond\n : xhr.onreadystatechange = function(o) { xhr.readyState > 3 && respond(o); };\n\n function respond(o) {\n var status = xhr.status, result;\n if (!status && hasResponse(xhr)\n || status >= 200 && status < 300\n || status === 304) {\n if (response) {\n try {\n result = response.call(request, xhr);\n } catch (e) {\n event.call(\"error\", request, e);\n return;\n }\n } else {\n result = xhr;\n }\n event.call(\"load\", request, result);\n } else {\n event.call(\"error\", request, o);\n }\n }\n\n xhr.onprogress = function(e) {\n event.call(\"progress\", request, e);\n };\n\n request = {\n header: function(name, value) {\n name = (name + \"\").toLowerCase();\n if (arguments.length < 2) return headers.get(name);\n if (value == null) headers.remove(name);\n else headers.set(name, value + \"\");\n return request;\n },\n\n // If mimeType is non-null and no Accept header is set, a default is used.\n mimeType: function(value) {\n if (!arguments.length) return mimeType;\n mimeType = value == null ? null : value + \"\";\n return request;\n },\n\n // Specifies what type the response value should take;\n // for instance, arraybuffer, blob, document, or text.\n responseType: function(value) {\n if (!arguments.length) return responseType;\n responseType = value;\n return request;\n },\n\n timeout: function(value) {\n if (!arguments.length) return timeout;\n timeout = +value;\n return request;\n },\n\n user: function(value) {\n return arguments.length < 1 ? user : (user = value == null ? null : value + \"\", request);\n },\n\n password: function(value) {\n return arguments.length < 1 ? password : (password = value == null ? null : value + \"\", request);\n },\n\n // Specify how to convert the response content to a specific type;\n // changes the callback value on \"load\" events.\n response: function(value) {\n response = value;\n return request;\n },\n\n // Alias for send(\"GET\", …).\n get: function(data, callback) {\n return request.send(\"GET\", data, callback);\n },\n\n // Alias for send(\"POST\", …).\n post: function(data, callback) {\n return request.send(\"POST\", data, callback);\n },\n\n // If callback is non-null, it will be used for error and load events.\n send: function(method, data, callback) {\n xhr.open(method, url, true, user, password);\n if (mimeType != null && !headers.has(\"accept\")) headers.set(\"accept\", mimeType + \",*/*\");\n if (xhr.setRequestHeader) headers.each(function(value, name) { xhr.setRequestHeader(name, value); });\n if (mimeType != null && xhr.overrideMimeType) xhr.overrideMimeType(mimeType);\n if (responseType != null) xhr.responseType = responseType;\n if (timeout > 0) xhr.timeout = timeout;\n if (callback == null && typeof data === \"function\") callback = data, data = null;\n if (callback != null && callback.length === 1) callback = fixCallback(callback);\n if (callback != null) request.on(\"error\", callback).on(\"load\", function(xhr) { callback(null, xhr); });\n event.call(\"beforesend\", request, xhr);\n xhr.send(data == null ? null : data);\n return request;\n },\n\n abort: function() {\n xhr.abort();\n return request;\n },\n\n on: function() {\n var value = event.on.apply(event, arguments);\n return value === event ? request : value;\n }\n };\n\n if (callback != null) {\n if (typeof callback !== \"function\") throw new Error(\"invalid callback: \" + callback);\n return request.get(callback);\n }\n\n return request;\n};\n\nfunction fixCallback(callback) {\n return function(error, xhr) {\n callback(error == null ? xhr : null);\n };\n}\n\nfunction hasResponse(xhr) {\n var type = xhr.responseType;\n return type && type !== \"text\"\n ? xhr.response // null on error\n : xhr.responseText; // \"\" on error\n}\n\nvar type$1 = function(defaultMimeType, response) {\n return function(url, callback) {\n var r = request(url).mimeType(defaultMimeType).response(response);\n if (callback != null) {\n if (typeof callback !== \"function\") throw new Error(\"invalid callback: \" + callback);\n return r.get(callback);\n }\n return r;\n };\n};\n\nvar html = type$1(\"text/html\", function(xhr) {\n return document.createRange().createContextualFragment(xhr.responseText);\n});\n\nvar json = type$1(\"application/json\", function(xhr) {\n return JSON.parse(xhr.responseText);\n});\n\nvar text = type$1(\"text/plain\", function(xhr) {\n return xhr.responseText;\n});\n\nvar xml = type$1(\"application/xml\", function(xhr) {\n var xml = xhr.responseXML;\n if (!xml) throw new Error(\"parse error\");\n return xml;\n});\n\nvar dsv$1 = function(defaultMimeType, parse) {\n return function(url, row, callback) {\n if (arguments.length < 3) callback = row, row = null;\n var r = request(url).mimeType(defaultMimeType);\n r.row = function(_) { return arguments.length ? r.response(responseOf(parse, row = _)) : row; };\n r.row(row);\n return callback ? r.get(callback) : r;\n };\n};\n\nfunction responseOf(parse, row) {\n return function(request$$1) {\n return parse(request$$1.responseText, row);\n };\n}\n\nvar csv$1 = dsv$1(\"text/csv\", csvParse);\n\nvar tsv$1 = dsv$1(\"text/tab-separated-values\", tsvParse);\n\nvar array$2 = Array.prototype;\n\nvar map$3 = array$2.map;\nvar slice$5 = array$2.slice;\n\nvar implicit = {name: \"implicit\"};\n\nfunction ordinal(range) {\n var index = map$1(),\n domain = [],\n unknown = implicit;\n\n range = range == null ? [] : slice$5.call(range);\n\n function scale(d) {\n var key = d + \"\", i = index.get(key);\n if (!i) {\n if (unknown !== implicit) return unknown;\n index.set(key, i = domain.push(d));\n }\n return range[(i - 1) % range.length];\n }\n\n scale.domain = function(_) {\n if (!arguments.length) return domain.slice();\n domain = [], index = map$1();\n var i = -1, n = _.length, d, key;\n while (++i < n) if (!index.has(key = (d = _[i]) + \"\")) index.set(key, domain.push(d));\n return scale;\n };\n\n scale.range = function(_) {\n return arguments.length ? (range = slice$5.call(_), scale) : range.slice();\n };\n\n scale.unknown = function(_) {\n return arguments.length ? (unknown = _, scale) : unknown;\n };\n\n scale.copy = function() {\n return ordinal()\n .domain(domain)\n .range(range)\n .unknown(unknown);\n };\n\n return scale;\n}\n\nfunction band() {\n var scale = ordinal().unknown(undefined),\n domain = scale.domain,\n ordinalRange = scale.range,\n range$$1 = [0, 1],\n step,\n bandwidth,\n round = false,\n paddingInner = 0,\n paddingOuter = 0,\n align = 0.5;\n\n delete scale.unknown;\n\n function rescale() {\n var n = domain().length,\n reverse = range$$1[1] < range$$1[0],\n start = range$$1[reverse - 0],\n stop = range$$1[1 - reverse];\n step = (stop - start) / Math.max(1, n - paddingInner + paddingOuter * 2);\n if (round) step = Math.floor(step);\n start += (stop - start - step * (n - paddingInner)) * align;\n bandwidth = step * (1 - paddingInner);\n if (round) start = Math.round(start), bandwidth = Math.round(bandwidth);\n var values = sequence(n).map(function(i) { return start + step * i; });\n return ordinalRange(reverse ? values.reverse() : values);\n }\n\n scale.domain = function(_) {\n return arguments.length ? (domain(_), rescale()) : domain();\n };\n\n scale.range = function(_) {\n return arguments.length ? (range$$1 = [+_[0], +_[1]], rescale()) : range$$1.slice();\n };\n\n scale.rangeRound = function(_) {\n return range$$1 = [+_[0], +_[1]], round = true, rescale();\n };\n\n scale.bandwidth = function() {\n return bandwidth;\n };\n\n scale.step = function() {\n return step;\n };\n\n scale.round = function(_) {\n return arguments.length ? (round = !!_, rescale()) : round;\n };\n\n scale.padding = function(_) {\n return arguments.length ? (paddingInner = paddingOuter = Math.max(0, Math.min(1, _)), rescale()) : paddingInner;\n };\n\n scale.paddingInner = function(_) {\n return arguments.length ? (paddingInner = Math.max(0, Math.min(1, _)), rescale()) : paddingInner;\n };\n\n scale.paddingOuter = function(_) {\n return arguments.length ? (paddingOuter = Math.max(0, Math.min(1, _)), rescale()) : paddingOuter;\n };\n\n scale.align = function(_) {\n return arguments.length ? (align = Math.max(0, Math.min(1, _)), rescale()) : align;\n };\n\n scale.copy = function() {\n return band()\n .domain(domain())\n .range(range$$1)\n .round(round)\n .paddingInner(paddingInner)\n .paddingOuter(paddingOuter)\n .align(align);\n };\n\n return rescale();\n}\n\nfunction pointish(scale) {\n var copy = scale.copy;\n\n scale.padding = scale.paddingOuter;\n delete scale.paddingInner;\n delete scale.paddingOuter;\n\n scale.copy = function() {\n return pointish(copy());\n };\n\n return scale;\n}\n\nfunction point$1() {\n return pointish(band().paddingInner(1));\n}\n\nvar constant$9 = function(x) {\n return function() {\n return x;\n };\n};\n\nvar number$2 = function(x) {\n return +x;\n};\n\nvar unit = [0, 1];\n\nfunction deinterpolateLinear(a, b) {\n return (b -= (a = +a))\n ? function(x) { return (x - a) / b; }\n : constant$9(b);\n}\n\nfunction deinterpolateClamp(deinterpolate) {\n return function(a, b) {\n var d = deinterpolate(a = +a, b = +b);\n return function(x) { return x <= a ? 0 : x >= b ? 1 : d(x); };\n };\n}\n\nfunction reinterpolateClamp(reinterpolate) {\n return function(a, b) {\n var r = reinterpolate(a = +a, b = +b);\n return function(t) { return t <= 0 ? a : t >= 1 ? b : r(t); };\n };\n}\n\nfunction bimap(domain, range, deinterpolate, reinterpolate) {\n var d0 = domain[0], d1 = domain[1], r0 = range[0], r1 = range[1];\n if (d1 < d0) d0 = deinterpolate(d1, d0), r0 = reinterpolate(r1, r0);\n else d0 = deinterpolate(d0, d1), r0 = reinterpolate(r0, r1);\n return function(x) { return r0(d0(x)); };\n}\n\nfunction polymap(domain, range, deinterpolate, reinterpolate) {\n var j = Math.min(domain.length, range.length) - 1,\n d = new Array(j),\n r = new Array(j),\n i = -1;\n\n // Reverse descending domains.\n if (domain[j] < domain[0]) {\n domain = domain.slice().reverse();\n range = range.slice().reverse();\n }\n\n while (++i < j) {\n d[i] = deinterpolate(domain[i], domain[i + 1]);\n r[i] = reinterpolate(range[i], range[i + 1]);\n }\n\n return function(x) {\n var i = bisectRight(domain, x, 1, j) - 1;\n return r[i](d[i](x));\n };\n}\n\nfunction copy(source, target) {\n return target\n .domain(source.domain())\n .range(source.range())\n .interpolate(source.interpolate())\n .clamp(source.clamp());\n}\n\n// deinterpolate(a, b)(x) takes a domain value x in [a,b] and returns the corresponding parameter t in [0,1].\n// reinterpolate(a, b)(t) takes a parameter t in [0,1] and returns the corresponding domain value x in [a,b].\nfunction continuous(deinterpolate, reinterpolate) {\n var domain = unit,\n range = unit,\n interpolate$$1 = interpolateValue,\n clamp = false,\n piecewise,\n output,\n input;\n\n function rescale() {\n piecewise = Math.min(domain.length, range.length) > 2 ? polymap : bimap;\n output = input = null;\n return scale;\n }\n\n function scale(x) {\n return (output || (output = piecewise(domain, range, clamp ? deinterpolateClamp(deinterpolate) : deinterpolate, interpolate$$1)))(+x);\n }\n\n scale.invert = function(y) {\n return (input || (input = piecewise(range, domain, deinterpolateLinear, clamp ? reinterpolateClamp(reinterpolate) : reinterpolate)))(+y);\n };\n\n scale.domain = function(_) {\n return arguments.length ? (domain = map$3.call(_, number$2), rescale()) : domain.slice();\n };\n\n scale.range = function(_) {\n return arguments.length ? (range = slice$5.call(_), rescale()) : range.slice();\n };\n\n scale.rangeRound = function(_) {\n return range = slice$5.call(_), interpolate$$1 = interpolateRound, rescale();\n };\n\n scale.clamp = function(_) {\n return arguments.length ? (clamp = !!_, rescale()) : clamp;\n };\n\n scale.interpolate = function(_) {\n return arguments.length ? (interpolate$$1 = _, rescale()) : interpolate$$1;\n };\n\n return rescale();\n}\n\nvar tickFormat = function(domain, count, specifier) {\n var start = domain[0],\n stop = domain[domain.length - 1],\n step = tickStep(start, stop, count == null ? 10 : count),\n precision;\n specifier = formatSpecifier(specifier == null ? \",f\" : specifier);\n switch (specifier.type) {\n case \"s\": {\n var value = Math.max(Math.abs(start), Math.abs(stop));\n if (specifier.precision == null && !isNaN(precision = precisionPrefix(step, value))) specifier.precision = precision;\n return exports.formatPrefix(specifier, value);\n }\n case \"\":\n case \"e\":\n case \"g\":\n case \"p\":\n case \"r\": {\n if (specifier.precision == null && !isNaN(precision = precisionRound(step, Math.max(Math.abs(start), Math.abs(stop))))) specifier.precision = precision - (specifier.type === \"e\");\n break;\n }\n case \"f\":\n case \"%\": {\n if (specifier.precision == null && !isNaN(precision = precisionFixed(step))) specifier.precision = precision - (specifier.type === \"%\") * 2;\n break;\n }\n }\n return exports.format(specifier);\n};\n\nfunction linearish(scale) {\n var domain = scale.domain;\n\n scale.ticks = function(count) {\n var d = domain();\n return ticks(d[0], d[d.length - 1], count == null ? 10 : count);\n };\n\n scale.tickFormat = function(count, specifier) {\n return tickFormat(domain(), count, specifier);\n };\n\n scale.nice = function(count) {\n if (count == null) count = 10;\n\n var d = domain(),\n i0 = 0,\n i1 = d.length - 1,\n start = d[i0],\n stop = d[i1],\n step;\n\n if (stop < start) {\n step = start, start = stop, stop = step;\n step = i0, i0 = i1, i1 = step;\n }\n\n step = tickIncrement(start, stop, count);\n\n if (step > 0) {\n start = Math.floor(start / step) * step;\n stop = Math.ceil(stop / step) * step;\n step = tickIncrement(start, stop, count);\n } else if (step < 0) {\n start = Math.ceil(start * step) / step;\n stop = Math.floor(stop * step) / step;\n step = tickIncrement(start, stop, count);\n }\n\n if (step > 0) {\n d[i0] = Math.floor(start / step) * step;\n d[i1] = Math.ceil(stop / step) * step;\n domain(d);\n } else if (step < 0) {\n d[i0] = Math.ceil(start * step) / step;\n d[i1] = Math.floor(stop * step) / step;\n domain(d);\n }\n\n return scale;\n };\n\n return scale;\n}\n\nfunction linear$2() {\n var scale = continuous(deinterpolateLinear, reinterpolate);\n\n scale.copy = function() {\n return copy(scale, linear$2());\n };\n\n return linearish(scale);\n}\n\nfunction identity$6() {\n var domain = [0, 1];\n\n function scale(x) {\n return +x;\n }\n\n scale.invert = scale;\n\n scale.domain = scale.range = function(_) {\n return arguments.length ? (domain = map$3.call(_, number$2), scale) : domain.slice();\n };\n\n scale.copy = function() {\n return identity$6().domain(domain);\n };\n\n return linearish(scale);\n}\n\nvar nice = function(domain, interval) {\n domain = domain.slice();\n\n var i0 = 0,\n i1 = domain.length - 1,\n x0 = domain[i0],\n x1 = domain[i1],\n t;\n\n if (x1 < x0) {\n t = i0, i0 = i1, i1 = t;\n t = x0, x0 = x1, x1 = t;\n }\n\n domain[i0] = interval.floor(x0);\n domain[i1] = interval.ceil(x1);\n return domain;\n};\n\nfunction deinterpolate(a, b) {\n return (b = Math.log(b / a))\n ? function(x) { return Math.log(x / a) / b; }\n : constant$9(b);\n}\n\nfunction reinterpolate$1(a, b) {\n return a < 0\n ? function(t) { return -Math.pow(-b, t) * Math.pow(-a, 1 - t); }\n : function(t) { return Math.pow(b, t) * Math.pow(a, 1 - t); };\n}\n\nfunction pow10(x) {\n return isFinite(x) ? +(\"1e\" + x) : x < 0 ? 0 : x;\n}\n\nfunction powp(base) {\n return base === 10 ? pow10\n : base === Math.E ? Math.exp\n : function(x) { return Math.pow(base, x); };\n}\n\nfunction logp(base) {\n return base === Math.E ? Math.log\n : base === 10 && Math.log10\n || base === 2 && Math.log2\n || (base = Math.log(base), function(x) { return Math.log(x) / base; });\n}\n\nfunction reflect(f) {\n return function(x) {\n return -f(-x);\n };\n}\n\nfunction log$1() {\n var scale = continuous(deinterpolate, reinterpolate$1).domain([1, 10]),\n domain = scale.domain,\n base = 10,\n logs = logp(10),\n pows = powp(10);\n\n function rescale() {\n logs = logp(base), pows = powp(base);\n if (domain()[0] < 0) logs = reflect(logs), pows = reflect(pows);\n return scale;\n }\n\n scale.base = function(_) {\n return arguments.length ? (base = +_, rescale()) : base;\n };\n\n scale.domain = function(_) {\n return arguments.length ? (domain(_), rescale()) : domain();\n };\n\n scale.ticks = function(count) {\n var d = domain(),\n u = d[0],\n v = d[d.length - 1],\n r;\n\n if (r = v < u) i = u, u = v, v = i;\n\n var i = logs(u),\n j = logs(v),\n p,\n k,\n t,\n n = count == null ? 10 : +count,\n z = [];\n\n if (!(base % 1) && j - i < n) {\n i = Math.round(i) - 1, j = Math.round(j) + 1;\n if (u > 0) for (; i < j; ++i) {\n for (k = 1, p = pows(i); k < base; ++k) {\n t = p * k;\n if (t < u) continue;\n if (t > v) break;\n z.push(t);\n }\n } else for (; i < j; ++i) {\n for (k = base - 1, p = pows(i); k >= 1; --k) {\n t = p * k;\n if (t < u) continue;\n if (t > v) break;\n z.push(t);\n }\n }\n } else {\n z = ticks(i, j, Math.min(j - i, n)).map(pows);\n }\n\n return r ? z.reverse() : z;\n };\n\n scale.tickFormat = function(count, specifier) {\n if (specifier == null) specifier = base === 10 ? \".0e\" : \",\";\n if (typeof specifier !== \"function\") specifier = exports.format(specifier);\n if (count === Infinity) return specifier;\n if (count == null) count = 10;\n var k = Math.max(1, base * count / scale.ticks().length); // TODO fast estimate?\n return function(d) {\n var i = d / pows(Math.round(logs(d)));\n if (i * base < base - 0.5) i *= base;\n return i <= k ? specifier(d) : \"\";\n };\n };\n\n scale.nice = function() {\n return domain(nice(domain(), {\n floor: function(x) { return pows(Math.floor(logs(x))); },\n ceil: function(x) { return pows(Math.ceil(logs(x))); }\n }));\n };\n\n scale.copy = function() {\n return copy(scale, log$1().base(base));\n };\n\n return scale;\n}\n\nfunction raise$1(x, exponent) {\n return x < 0 ? -Math.pow(-x, exponent) : Math.pow(x, exponent);\n}\n\nfunction pow$1() {\n var exponent = 1,\n scale = continuous(deinterpolate, reinterpolate),\n domain = scale.domain;\n\n function deinterpolate(a, b) {\n return (b = raise$1(b, exponent) - (a = raise$1(a, exponent)))\n ? function(x) { return (raise$1(x, exponent) - a) / b; }\n : constant$9(b);\n }\n\n function reinterpolate(a, b) {\n b = raise$1(b, exponent) - (a = raise$1(a, exponent));\n return function(t) { return raise$1(a + b * t, 1 / exponent); };\n }\n\n scale.exponent = function(_) {\n return arguments.length ? (exponent = +_, domain(domain())) : exponent;\n };\n\n scale.copy = function() {\n return copy(scale, pow$1().exponent(exponent));\n };\n\n return linearish(scale);\n}\n\nfunction sqrt$1() {\n return pow$1().exponent(0.5);\n}\n\nfunction quantile$$1() {\n var domain = [],\n range = [],\n thresholds = [];\n\n function rescale() {\n var i = 0, n = Math.max(1, range.length);\n thresholds = new Array(n - 1);\n while (++i < n) thresholds[i - 1] = threshold(domain, i / n);\n return scale;\n }\n\n function scale(x) {\n if (!isNaN(x = +x)) return range[bisectRight(thresholds, x)];\n }\n\n scale.invertExtent = function(y) {\n var i = range.indexOf(y);\n return i < 0 ? [NaN, NaN] : [\n i > 0 ? thresholds[i - 1] : domain[0],\n i < thresholds.length ? thresholds[i] : domain[domain.length - 1]\n ];\n };\n\n scale.domain = function(_) {\n if (!arguments.length) return domain.slice();\n domain = [];\n for (var i = 0, n = _.length, d; i < n; ++i) if (d = _[i], d != null && !isNaN(d = +d)) domain.push(d);\n domain.sort(ascending);\n return rescale();\n };\n\n scale.range = function(_) {\n return arguments.length ? (range = slice$5.call(_), rescale()) : range.slice();\n };\n\n scale.quantiles = function() {\n return thresholds.slice();\n };\n\n scale.copy = function() {\n return quantile$$1()\n .domain(domain)\n .range(range);\n };\n\n return scale;\n}\n\nfunction quantize$1() {\n var x0 = 0,\n x1 = 1,\n n = 1,\n domain = [0.5],\n range = [0, 1];\n\n function scale(x) {\n if (x <= x) return range[bisectRight(domain, x, 0, n)];\n }\n\n function rescale() {\n var i = -1;\n domain = new Array(n);\n while (++i < n) domain[i] = ((i + 1) * x1 - (i - n) * x0) / (n + 1);\n return scale;\n }\n\n scale.domain = function(_) {\n return arguments.length ? (x0 = +_[0], x1 = +_[1], rescale()) : [x0, x1];\n };\n\n scale.range = function(_) {\n return arguments.length ? (n = (range = slice$5.call(_)).length - 1, rescale()) : range.slice();\n };\n\n scale.invertExtent = function(y) {\n var i = range.indexOf(y);\n return i < 0 ? [NaN, NaN]\n : i < 1 ? [x0, domain[0]]\n : i >= n ? [domain[n - 1], x1]\n : [domain[i - 1], domain[i]];\n };\n\n scale.copy = function() {\n return quantize$1()\n .domain([x0, x1])\n .range(range);\n };\n\n return linearish(scale);\n}\n\nfunction threshold$1() {\n var domain = [0.5],\n range = [0, 1],\n n = 1;\n\n function scale(x) {\n if (x <= x) return range[bisectRight(domain, x, 0, n)];\n }\n\n scale.domain = function(_) {\n return arguments.length ? (domain = slice$5.call(_), n = Math.min(domain.length, range.length - 1), scale) : domain.slice();\n };\n\n scale.range = function(_) {\n return arguments.length ? (range = slice$5.call(_), n = Math.min(domain.length, range.length - 1), scale) : range.slice();\n };\n\n scale.invertExtent = function(y) {\n var i = range.indexOf(y);\n return [domain[i - 1], domain[i]];\n };\n\n scale.copy = function() {\n return threshold$1()\n .domain(domain)\n .range(range);\n };\n\n return scale;\n}\n\nvar t0$1 = new Date;\nvar t1$1 = new Date;\n\nfunction newInterval(floori, offseti, count, field) {\n\n function interval(date) {\n return floori(date = new Date(+date)), date;\n }\n\n interval.floor = interval;\n\n interval.ceil = function(date) {\n return floori(date = new Date(date - 1)), offseti(date, 1), floori(date), date;\n };\n\n interval.round = function(date) {\n var d0 = interval(date),\n d1 = interval.ceil(date);\n return date - d0 < d1 - date ? d0 : d1;\n };\n\n interval.offset = function(date, step) {\n return offseti(date = new Date(+date), step == null ? 1 : Math.floor(step)), date;\n };\n\n interval.range = function(start, stop, step) {\n var range = [];\n start = interval.ceil(start);\n step = step == null ? 1 : Math.floor(step);\n if (!(start < stop) || !(step > 0)) return range; // also handles Invalid Date\n do range.push(new Date(+start)); while (offseti(start, step), floori(start), start < stop)\n return range;\n };\n\n interval.filter = function(test) {\n return newInterval(function(date) {\n if (date >= date) while (floori(date), !test(date)) date.setTime(date - 1);\n }, function(date, step) {\n if (date >= date) {\n if (step < 0) while (++step <= 0) {\n while (offseti(date, -1), !test(date)) {} // eslint-disable-line no-empty\n } else while (--step >= 0) {\n while (offseti(date, +1), !test(date)) {} // eslint-disable-line no-empty\n }\n }\n });\n };\n\n if (count) {\n interval.count = function(start, end) {\n t0$1.setTime(+start), t1$1.setTime(+end);\n floori(t0$1), floori(t1$1);\n return Math.floor(count(t0$1, t1$1));\n };\n\n interval.every = function(step) {\n step = Math.floor(step);\n return !isFinite(step) || !(step > 0) ? null\n : !(step > 1) ? interval\n : interval.filter(field\n ? function(d) { return field(d) % step === 0; }\n : function(d) { return interval.count(0, d) % step === 0; });\n };\n }\n\n return interval;\n}\n\nvar millisecond = newInterval(function() {\n // noop\n}, function(date, step) {\n date.setTime(+date + step);\n}, function(start, end) {\n return end - start;\n});\n\n// An optimized implementation for this simple case.\nmillisecond.every = function(k) {\n k = Math.floor(k);\n if (!isFinite(k) || !(k > 0)) return null;\n if (!(k > 1)) return millisecond;\n return newInterval(function(date) {\n date.setTime(Math.floor(date / k) * k);\n }, function(date, step) {\n date.setTime(+date + step * k);\n }, function(start, end) {\n return (end - start) / k;\n });\n};\n\nvar milliseconds = millisecond.range;\n\nvar durationSecond$1 = 1e3;\nvar durationMinute$1 = 6e4;\nvar durationHour$1 = 36e5;\nvar durationDay$1 = 864e5;\nvar durationWeek$1 = 6048e5;\n\nvar second = newInterval(function(date) {\n date.setTime(Math.floor(date / durationSecond$1) * durationSecond$1);\n}, function(date, step) {\n date.setTime(+date + step * durationSecond$1);\n}, function(start, end) {\n return (end - start) / durationSecond$1;\n}, function(date) {\n return date.getUTCSeconds();\n});\n\nvar seconds = second.range;\n\nvar minute = newInterval(function(date) {\n date.setTime(Math.floor(date / durationMinute$1) * durationMinute$1);\n}, function(date, step) {\n date.setTime(+date + step * durationMinute$1);\n}, function(start, end) {\n return (end - start) / durationMinute$1;\n}, function(date) {\n return date.getMinutes();\n});\n\nvar minutes = minute.range;\n\nvar hour = newInterval(function(date) {\n var offset = date.getTimezoneOffset() * durationMinute$1 % durationHour$1;\n if (offset < 0) offset += durationHour$1;\n date.setTime(Math.floor((+date - offset) / durationHour$1) * durationHour$1 + offset);\n}, function(date, step) {\n date.setTime(+date + step * durationHour$1);\n}, function(start, end) {\n return (end - start) / durationHour$1;\n}, function(date) {\n return date.getHours();\n});\n\nvar hours = hour.range;\n\nvar day = newInterval(function(date) {\n date.setHours(0, 0, 0, 0);\n}, function(date, step) {\n date.setDate(date.getDate() + step);\n}, function(start, end) {\n return (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * durationMinute$1) / durationDay$1;\n}, function(date) {\n return date.getDate() - 1;\n});\n\nvar days = day.range;\n\nfunction weekday(i) {\n return newInterval(function(date) {\n date.setDate(date.getDate() - (date.getDay() + 7 - i) % 7);\n date.setHours(0, 0, 0, 0);\n }, function(date, step) {\n date.setDate(date.getDate() + step * 7);\n }, function(start, end) {\n return (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * durationMinute$1) / durationWeek$1;\n });\n}\n\nvar sunday = weekday(0);\nvar monday = weekday(1);\nvar tuesday = weekday(2);\nvar wednesday = weekday(3);\nvar thursday = weekday(4);\nvar friday = weekday(5);\nvar saturday = weekday(6);\n\nvar sundays = sunday.range;\nvar mondays = monday.range;\nvar tuesdays = tuesday.range;\nvar wednesdays = wednesday.range;\nvar thursdays = thursday.range;\nvar fridays = friday.range;\nvar saturdays = saturday.range;\n\nvar month = newInterval(function(date) {\n date.setDate(1);\n date.setHours(0, 0, 0, 0);\n}, function(date, step) {\n date.setMonth(date.getMonth() + step);\n}, function(start, end) {\n return end.getMonth() - start.getMonth() + (end.getFullYear() - start.getFullYear()) * 12;\n}, function(date) {\n return date.getMonth();\n});\n\nvar months = month.range;\n\nvar year = newInterval(function(date) {\n date.setMonth(0, 1);\n date.setHours(0, 0, 0, 0);\n}, function(date, step) {\n date.setFullYear(date.getFullYear() + step);\n}, function(start, end) {\n return end.getFullYear() - start.getFullYear();\n}, function(date) {\n return date.getFullYear();\n});\n\n// An optimized implementation for this simple case.\nyear.every = function(k) {\n return !isFinite(k = Math.floor(k)) || !(k > 0) ? null : newInterval(function(date) {\n date.setFullYear(Math.floor(date.getFullYear() / k) * k);\n date.setMonth(0, 1);\n date.setHours(0, 0, 0, 0);\n }, function(date, step) {\n date.setFullYear(date.getFullYear() + step * k);\n });\n};\n\nvar years = year.range;\n\nvar utcMinute = newInterval(function(date) {\n date.setUTCSeconds(0, 0);\n}, function(date, step) {\n date.setTime(+date + step * durationMinute$1);\n}, function(start, end) {\n return (end - start) / durationMinute$1;\n}, function(date) {\n return date.getUTCMinutes();\n});\n\nvar utcMinutes = utcMinute.range;\n\nvar utcHour = newInterval(function(date) {\n date.setUTCMinutes(0, 0, 0);\n}, function(date, step) {\n date.setTime(+date + step * durationHour$1);\n}, function(start, end) {\n return (end - start) / durationHour$1;\n}, function(date) {\n return date.getUTCHours();\n});\n\nvar utcHours = utcHour.range;\n\nvar utcDay = newInterval(function(date) {\n date.setUTCHours(0, 0, 0, 0);\n}, function(date, step) {\n date.setUTCDate(date.getUTCDate() + step);\n}, function(start, end) {\n return (end - start) / durationDay$1;\n}, function(date) {\n return date.getUTCDate() - 1;\n});\n\nvar utcDays = utcDay.range;\n\nfunction utcWeekday(i) {\n return newInterval(function(date) {\n date.setUTCDate(date.getUTCDate() - (date.getUTCDay() + 7 - i) % 7);\n date.setUTCHours(0, 0, 0, 0);\n }, function(date, step) {\n date.setUTCDate(date.getUTCDate() + step * 7);\n }, function(start, end) {\n return (end - start) / durationWeek$1;\n });\n}\n\nvar utcSunday = utcWeekday(0);\nvar utcMonday = utcWeekday(1);\nvar utcTuesday = utcWeekday(2);\nvar utcWednesday = utcWeekday(3);\nvar utcThursday = utcWeekday(4);\nvar utcFriday = utcWeekday(5);\nvar utcSaturday = utcWeekday(6);\n\nvar utcSundays = utcSunday.range;\nvar utcMondays = utcMonday.range;\nvar utcTuesdays = utcTuesday.range;\nvar utcWednesdays = utcWednesday.range;\nvar utcThursdays = utcThursday.range;\nvar utcFridays = utcFriday.range;\nvar utcSaturdays = utcSaturday.range;\n\nvar utcMonth = newInterval(function(date) {\n date.setUTCDate(1);\n date.setUTCHours(0, 0, 0, 0);\n}, function(date, step) {\n date.setUTCMonth(date.getUTCMonth() + step);\n}, function(start, end) {\n return end.getUTCMonth() - start.getUTCMonth() + (end.getUTCFullYear() - start.getUTCFullYear()) * 12;\n}, function(date) {\n return date.getUTCMonth();\n});\n\nvar utcMonths = utcMonth.range;\n\nvar utcYear = newInterval(function(date) {\n date.setUTCMonth(0, 1);\n date.setUTCHours(0, 0, 0, 0);\n}, function(date, step) {\n date.setUTCFullYear(date.getUTCFullYear() + step);\n}, function(start, end) {\n return end.getUTCFullYear() - start.getUTCFullYear();\n}, function(date) {\n return date.getUTCFullYear();\n});\n\n// An optimized implementation for this simple case.\nutcYear.every = function(k) {\n return !isFinite(k = Math.floor(k)) || !(k > 0) ? null : newInterval(function(date) {\n date.setUTCFullYear(Math.floor(date.getUTCFullYear() / k) * k);\n date.setUTCMonth(0, 1);\n date.setUTCHours(0, 0, 0, 0);\n }, function(date, step) {\n date.setUTCFullYear(date.getUTCFullYear() + step * k);\n });\n};\n\nvar utcYears = utcYear.range;\n\nfunction localDate(d) {\n if (0 <= d.y && d.y < 100) {\n var date = new Date(-1, d.m, d.d, d.H, d.M, d.S, d.L);\n date.setFullYear(d.y);\n return date;\n }\n return new Date(d.y, d.m, d.d, d.H, d.M, d.S, d.L);\n}\n\nfunction utcDate(d) {\n if (0 <= d.y && d.y < 100) {\n var date = new Date(Date.UTC(-1, d.m, d.d, d.H, d.M, d.S, d.L));\n date.setUTCFullYear(d.y);\n return date;\n }\n return new Date(Date.UTC(d.y, d.m, d.d, d.H, d.M, d.S, d.L));\n}\n\nfunction newYear(y) {\n return {y: y, m: 0, d: 1, H: 0, M: 0, S: 0, L: 0};\n}\n\nfunction formatLocale$1(locale) {\n var locale_dateTime = locale.dateTime,\n locale_date = locale.date,\n locale_time = locale.time,\n locale_periods = locale.periods,\n locale_weekdays = locale.days,\n locale_shortWeekdays = locale.shortDays,\n locale_months = locale.months,\n locale_shortMonths = locale.shortMonths;\n\n var periodRe = formatRe(locale_periods),\n periodLookup = formatLookup(locale_periods),\n weekdayRe = formatRe(locale_weekdays),\n weekdayLookup = formatLookup(locale_weekdays),\n shortWeekdayRe = formatRe(locale_shortWeekdays),\n shortWeekdayLookup = formatLookup(locale_shortWeekdays),\n monthRe = formatRe(locale_months),\n monthLookup = formatLookup(locale_months),\n shortMonthRe = formatRe(locale_shortMonths),\n shortMonthLookup = formatLookup(locale_shortMonths);\n\n var formats = {\n \"a\": formatShortWeekday,\n \"A\": formatWeekday,\n \"b\": formatShortMonth,\n \"B\": formatMonth,\n \"c\": null,\n \"d\": formatDayOfMonth,\n \"e\": formatDayOfMonth,\n \"H\": formatHour24,\n \"I\": formatHour12,\n \"j\": formatDayOfYear,\n \"L\": formatMilliseconds,\n \"m\": formatMonthNumber,\n \"M\": formatMinutes,\n \"p\": formatPeriod,\n \"S\": formatSeconds,\n \"U\": formatWeekNumberSunday,\n \"w\": formatWeekdayNumber,\n \"W\": formatWeekNumberMonday,\n \"x\": null,\n \"X\": null,\n \"y\": formatYear,\n \"Y\": formatFullYear,\n \"Z\": formatZone,\n \"%\": formatLiteralPercent\n };\n\n var utcFormats = {\n \"a\": formatUTCShortWeekday,\n \"A\": formatUTCWeekday,\n \"b\": formatUTCShortMonth,\n \"B\": formatUTCMonth,\n \"c\": null,\n \"d\": formatUTCDayOfMonth,\n \"e\": formatUTCDayOfMonth,\n \"H\": formatUTCHour24,\n \"I\": formatUTCHour12,\n \"j\": formatUTCDayOfYear,\n \"L\": formatUTCMilliseconds,\n \"m\": formatUTCMonthNumber,\n \"M\": formatUTCMinutes,\n \"p\": formatUTCPeriod,\n \"S\": formatUTCSeconds,\n \"U\": formatUTCWeekNumberSunday,\n \"w\": formatUTCWeekdayNumber,\n \"W\": formatUTCWeekNumberMonday,\n \"x\": null,\n \"X\": null,\n \"y\": formatUTCYear,\n \"Y\": formatUTCFullYear,\n \"Z\": formatUTCZone,\n \"%\": formatLiteralPercent\n };\n\n var parses = {\n \"a\": parseShortWeekday,\n \"A\": parseWeekday,\n \"b\": parseShortMonth,\n \"B\": parseMonth,\n \"c\": parseLocaleDateTime,\n \"d\": parseDayOfMonth,\n \"e\": parseDayOfMonth,\n \"H\": parseHour24,\n \"I\": parseHour24,\n \"j\": parseDayOfYear,\n \"L\": parseMilliseconds,\n \"m\": parseMonthNumber,\n \"M\": parseMinutes,\n \"p\": parsePeriod,\n \"S\": parseSeconds,\n \"U\": parseWeekNumberSunday,\n \"w\": parseWeekdayNumber,\n \"W\": parseWeekNumberMonday,\n \"x\": parseLocaleDate,\n \"X\": parseLocaleTime,\n \"y\": parseYear,\n \"Y\": parseFullYear,\n \"Z\": parseZone,\n \"%\": parseLiteralPercent\n };\n\n // These recursive directive definitions must be deferred.\n formats.x = newFormat(locale_date, formats);\n formats.X = newFormat(locale_time, formats);\n formats.c = newFormat(locale_dateTime, formats);\n utcFormats.x = newFormat(locale_date, utcFormats);\n utcFormats.X = newFormat(locale_time, utcFormats);\n utcFormats.c = newFormat(locale_dateTime, utcFormats);\n\n function newFormat(specifier, formats) {\n return function(date) {\n var string = [],\n i = -1,\n j = 0,\n n = specifier.length,\n c,\n pad,\n format;\n\n if (!(date instanceof Date)) date = new Date(+date);\n\n while (++i < n) {\n if (specifier.charCodeAt(i) === 37) {\n string.push(specifier.slice(j, i));\n if ((pad = pads[c = specifier.charAt(++i)]) != null) c = specifier.charAt(++i);\n else pad = c === \"e\" ? \" \" : \"0\";\n if (format = formats[c]) c = format(date, pad);\n string.push(c);\n j = i + 1;\n }\n }\n\n string.push(specifier.slice(j, i));\n return string.join(\"\");\n };\n }\n\n function newParse(specifier, newDate) {\n return function(string) {\n var d = newYear(1900),\n i = parseSpecifier(d, specifier, string += \"\", 0);\n if (i != string.length) return null;\n\n // The am-pm flag is 0 for AM, and 1 for PM.\n if (\"p\" in d) d.H = d.H % 12 + d.p * 12;\n\n // Convert day-of-week and week-of-year to day-of-year.\n if (\"W\" in d || \"U\" in d) {\n if (!(\"w\" in d)) d.w = \"W\" in d ? 1 : 0;\n var day$$1 = \"Z\" in d ? utcDate(newYear(d.y)).getUTCDay() : newDate(newYear(d.y)).getDay();\n d.m = 0;\n d.d = \"W\" in d ? (d.w + 6) % 7 + d.W * 7 - (day$$1 + 5) % 7 : d.w + d.U * 7 - (day$$1 + 6) % 7;\n }\n\n // If a time zone is specified, all fields are interpreted as UTC and then\n // offset according to the specified time zone.\n if (\"Z\" in d) {\n d.H += d.Z / 100 | 0;\n d.M += d.Z % 100;\n return utcDate(d);\n }\n\n // Otherwise, all fields are in local time.\n return newDate(d);\n };\n }\n\n function parseSpecifier(d, specifier, string, j) {\n var i = 0,\n n = specifier.length,\n m = string.length,\n c,\n parse;\n\n while (i < n) {\n if (j >= m) return -1;\n c = specifier.charCodeAt(i++);\n if (c === 37) {\n c = specifier.charAt(i++);\n parse = parses[c in pads ? specifier.charAt(i++) : c];\n if (!parse || ((j = parse(d, string, j)) < 0)) return -1;\n } else if (c != string.charCodeAt(j++)) {\n return -1;\n }\n }\n\n return j;\n }\n\n function parsePeriod(d, string, i) {\n var n = periodRe.exec(string.slice(i));\n return n ? (d.p = periodLookup[n[0].toLowerCase()], i + n[0].length) : -1;\n }\n\n function parseShortWeekday(d, string, i) {\n var n = shortWeekdayRe.exec(string.slice(i));\n return n ? (d.w = shortWeekdayLookup[n[0].toLowerCase()], i + n[0].length) : -1;\n }\n\n function parseWeekday(d, string, i) {\n var n = weekdayRe.exec(string.slice(i));\n return n ? (d.w = weekdayLookup[n[0].toLowerCase()], i + n[0].length) : -1;\n }\n\n function parseShortMonth(d, string, i) {\n var n = shortMonthRe.exec(string.slice(i));\n return n ? (d.m = shortMonthLookup[n[0].toLowerCase()], i + n[0].length) : -1;\n }\n\n function parseMonth(d, string, i) {\n var n = monthRe.exec(string.slice(i));\n return n ? (d.m = monthLookup[n[0].toLowerCase()], i + n[0].length) : -1;\n }\n\n function parseLocaleDateTime(d, string, i) {\n return parseSpecifier(d, locale_dateTime, string, i);\n }\n\n function parseLocaleDate(d, string, i) {\n return parseSpecifier(d, locale_date, string, i);\n }\n\n function parseLocaleTime(d, string, i) {\n return parseSpecifier(d, locale_time, string, i);\n }\n\n function formatShortWeekday(d) {\n return locale_shortWeekdays[d.getDay()];\n }\n\n function formatWeekday(d) {\n return locale_weekdays[d.getDay()];\n }\n\n function formatShortMonth(d) {\n return locale_shortMonths[d.getMonth()];\n }\n\n function formatMonth(d) {\n return locale_months[d.getMonth()];\n }\n\n function formatPeriod(d) {\n return locale_periods[+(d.getHours() >= 12)];\n }\n\n function formatUTCShortWeekday(d) {\n return locale_shortWeekdays[d.getUTCDay()];\n }\n\n function formatUTCWeekday(d) {\n return locale_weekdays[d.getUTCDay()];\n }\n\n function formatUTCShortMonth(d) {\n return locale_shortMonths[d.getUTCMonth()];\n }\n\n function formatUTCMonth(d) {\n return locale_months[d.getUTCMonth()];\n }\n\n function formatUTCPeriod(d) {\n return locale_periods[+(d.getUTCHours() >= 12)];\n }\n\n return {\n format: function(specifier) {\n var f = newFormat(specifier += \"\", formats);\n f.toString = function() { return specifier; };\n return f;\n },\n parse: function(specifier) {\n var p = newParse(specifier += \"\", localDate);\n p.toString = function() { return specifier; };\n return p;\n },\n utcFormat: function(specifier) {\n var f = newFormat(specifier += \"\", utcFormats);\n f.toString = function() { return specifier; };\n return f;\n },\n utcParse: function(specifier) {\n var p = newParse(specifier, utcDate);\n p.toString = function() { return specifier; };\n return p;\n }\n };\n}\n\nvar pads = {\"-\": \"\", \"_\": \" \", \"0\": \"0\"};\nvar numberRe = /^\\s*\\d+/;\nvar percentRe = /^%/;\nvar requoteRe = /[\\\\\\^\\$\\*\\+\\?\\|\\[\\]\\(\\)\\.\\{\\}]/g;\n\nfunction pad(value, fill, width) {\n var sign = value < 0 ? \"-\" : \"\",\n string = (sign ? -value : value) + \"\",\n length = string.length;\n return sign + (length < width ? new Array(width - length + 1).join(fill) + string : string);\n}\n\nfunction requote(s) {\n return s.replace(requoteRe, \"\\\\$&\");\n}\n\nfunction formatRe(names) {\n return new RegExp(\"^(?:\" + names.map(requote).join(\"|\") + \")\", \"i\");\n}\n\nfunction formatLookup(names) {\n var map = {}, i = -1, n = names.length;\n while (++i < n) map[names[i].toLowerCase()] = i;\n return map;\n}\n\nfunction parseWeekdayNumber(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 1));\n return n ? (d.w = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseWeekNumberSunday(d, string, i) {\n var n = numberRe.exec(string.slice(i));\n return n ? (d.U = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseWeekNumberMonday(d, string, i) {\n var n = numberRe.exec(string.slice(i));\n return n ? (d.W = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseFullYear(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 4));\n return n ? (d.y = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseYear(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.y = +n[0] + (+n[0] > 68 ? 1900 : 2000), i + n[0].length) : -1;\n}\n\nfunction parseZone(d, string, i) {\n var n = /^(Z)|([+-]\\d\\d)(?:\\:?(\\d\\d))?/.exec(string.slice(i, i + 6));\n return n ? (d.Z = n[1] ? 0 : -(n[2] + (n[3] || \"00\")), i + n[0].length) : -1;\n}\n\nfunction parseMonthNumber(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.m = n[0] - 1, i + n[0].length) : -1;\n}\n\nfunction parseDayOfMonth(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.d = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseDayOfYear(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 3));\n return n ? (d.m = 0, d.d = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseHour24(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.H = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseMinutes(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.M = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseSeconds(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.S = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseMilliseconds(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 3));\n return n ? (d.L = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseLiteralPercent(d, string, i) {\n var n = percentRe.exec(string.slice(i, i + 1));\n return n ? i + n[0].length : -1;\n}\n\nfunction formatDayOfMonth(d, p) {\n return pad(d.getDate(), p, 2);\n}\n\nfunction formatHour24(d, p) {\n return pad(d.getHours(), p, 2);\n}\n\nfunction formatHour12(d, p) {\n return pad(d.getHours() % 12 || 12, p, 2);\n}\n\nfunction formatDayOfYear(d, p) {\n return pad(1 + day.count(year(d), d), p, 3);\n}\n\nfunction formatMilliseconds(d, p) {\n return pad(d.getMilliseconds(), p, 3);\n}\n\nfunction formatMonthNumber(d, p) {\n return pad(d.getMonth() + 1, p, 2);\n}\n\nfunction formatMinutes(d, p) {\n return pad(d.getMinutes(), p, 2);\n}\n\nfunction formatSeconds(d, p) {\n return pad(d.getSeconds(), p, 2);\n}\n\nfunction formatWeekNumberSunday(d, p) {\n return pad(sunday.count(year(d), d), p, 2);\n}\n\nfunction formatWeekdayNumber(d) {\n return d.getDay();\n}\n\nfunction formatWeekNumberMonday(d, p) {\n return pad(monday.count(year(d), d), p, 2);\n}\n\nfunction formatYear(d, p) {\n return pad(d.getFullYear() % 100, p, 2);\n}\n\nfunction formatFullYear(d, p) {\n return pad(d.getFullYear() % 10000, p, 4);\n}\n\nfunction formatZone(d) {\n var z = d.getTimezoneOffset();\n return (z > 0 ? \"-\" : (z *= -1, \"+\"))\n + pad(z / 60 | 0, \"0\", 2)\n + pad(z % 60, \"0\", 2);\n}\n\nfunction formatUTCDayOfMonth(d, p) {\n return pad(d.getUTCDate(), p, 2);\n}\n\nfunction formatUTCHour24(d, p) {\n return pad(d.getUTCHours(), p, 2);\n}\n\nfunction formatUTCHour12(d, p) {\n return pad(d.getUTCHours() % 12 || 12, p, 2);\n}\n\nfunction formatUTCDayOfYear(d, p) {\n return pad(1 + utcDay.count(utcYear(d), d), p, 3);\n}\n\nfunction formatUTCMilliseconds(d, p) {\n return pad(d.getUTCMilliseconds(), p, 3);\n}\n\nfunction formatUTCMonthNumber(d, p) {\n return pad(d.getUTCMonth() + 1, p, 2);\n}\n\nfunction formatUTCMinutes(d, p) {\n return pad(d.getUTCMinutes(), p, 2);\n}\n\nfunction formatUTCSeconds(d, p) {\n return pad(d.getUTCSeconds(), p, 2);\n}\n\nfunction formatUTCWeekNumberSunday(d, p) {\n return pad(utcSunday.count(utcYear(d), d), p, 2);\n}\n\nfunction formatUTCWeekdayNumber(d) {\n return d.getUTCDay();\n}\n\nfunction formatUTCWeekNumberMonday(d, p) {\n return pad(utcMonday.count(utcYear(d), d), p, 2);\n}\n\nfunction formatUTCYear(d, p) {\n return pad(d.getUTCFullYear() % 100, p, 2);\n}\n\nfunction formatUTCFullYear(d, p) {\n return pad(d.getUTCFullYear() % 10000, p, 4);\n}\n\nfunction formatUTCZone() {\n return \"+0000\";\n}\n\nfunction formatLiteralPercent() {\n return \"%\";\n}\n\nvar locale$1;\n\n\n\n\n\ndefaultLocale$1({\n dateTime: \"%x, %X\",\n date: \"%-m/%-d/%Y\",\n time: \"%-I:%M:%S %p\",\n periods: [\"AM\", \"PM\"],\n days: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"],\n shortDays: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"],\n months: [\"January\", \"February\", \"March\", \"April\", \"May\", \"June\", \"July\", \"August\", \"September\", \"October\", \"November\", \"December\"],\n shortMonths: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"]\n});\n\nfunction defaultLocale$1(definition) {\n locale$1 = formatLocale$1(definition);\n exports.timeFormat = locale$1.format;\n exports.timeParse = locale$1.parse;\n exports.utcFormat = locale$1.utcFormat;\n exports.utcParse = locale$1.utcParse;\n return locale$1;\n}\n\nvar isoSpecifier = \"%Y-%m-%dT%H:%M:%S.%LZ\";\n\nfunction formatIsoNative(date) {\n return date.toISOString();\n}\n\nvar formatIso = Date.prototype.toISOString\n ? formatIsoNative\n : exports.utcFormat(isoSpecifier);\n\nfunction parseIsoNative(string) {\n var date = new Date(string);\n return isNaN(date) ? null : date;\n}\n\nvar parseIso = +new Date(\"2000-01-01T00:00:00.000Z\")\n ? parseIsoNative\n : exports.utcParse(isoSpecifier);\n\nvar durationSecond = 1000;\nvar durationMinute = durationSecond * 60;\nvar durationHour = durationMinute * 60;\nvar durationDay = durationHour * 24;\nvar durationWeek = durationDay * 7;\nvar durationMonth = durationDay * 30;\nvar durationYear = durationDay * 365;\n\nfunction date$1(t) {\n return new Date(t);\n}\n\nfunction number$3(t) {\n return t instanceof Date ? +t : +new Date(+t);\n}\n\nfunction calendar(year$$1, month$$1, week, day$$1, hour$$1, minute$$1, second$$1, millisecond$$1, format) {\n var scale = continuous(deinterpolateLinear, reinterpolate),\n invert = scale.invert,\n domain = scale.domain;\n\n var formatMillisecond = format(\".%L\"),\n formatSecond = format(\":%S\"),\n formatMinute = format(\"%I:%M\"),\n formatHour = format(\"%I %p\"),\n formatDay = format(\"%a %d\"),\n formatWeek = format(\"%b %d\"),\n formatMonth = format(\"%B\"),\n formatYear = format(\"%Y\");\n\n var tickIntervals = [\n [second$$1, 1, durationSecond],\n [second$$1, 5, 5 * durationSecond],\n [second$$1, 15, 15 * durationSecond],\n [second$$1, 30, 30 * durationSecond],\n [minute$$1, 1, durationMinute],\n [minute$$1, 5, 5 * durationMinute],\n [minute$$1, 15, 15 * durationMinute],\n [minute$$1, 30, 30 * durationMinute],\n [ hour$$1, 1, durationHour ],\n [ hour$$1, 3, 3 * durationHour ],\n [ hour$$1, 6, 6 * durationHour ],\n [ hour$$1, 12, 12 * durationHour ],\n [ day$$1, 1, durationDay ],\n [ day$$1, 2, 2 * durationDay ],\n [ week, 1, durationWeek ],\n [ month$$1, 1, durationMonth ],\n [ month$$1, 3, 3 * durationMonth ],\n [ year$$1, 1, durationYear ]\n ];\n\n function tickFormat(date) {\n return (second$$1(date) < date ? formatMillisecond\n : minute$$1(date) < date ? formatSecond\n : hour$$1(date) < date ? formatMinute\n : day$$1(date) < date ? formatHour\n : month$$1(date) < date ? (week(date) < date ? formatDay : formatWeek)\n : year$$1(date) < date ? formatMonth\n : formatYear)(date);\n }\n\n function tickInterval(interval, start, stop, step) {\n if (interval == null) interval = 10;\n\n // If a desired tick count is specified, pick a reasonable tick interval\n // based on the extent of the domain and a rough estimate of tick size.\n // Otherwise, assume interval is already a time interval and use it.\n if (typeof interval === \"number\") {\n var target = Math.abs(stop - start) / interval,\n i = bisector(function(i) { return i[2]; }).right(tickIntervals, target);\n if (i === tickIntervals.length) {\n step = tickStep(start / durationYear, stop / durationYear, interval);\n interval = year$$1;\n } else if (i) {\n i = tickIntervals[target / tickIntervals[i - 1][2] < tickIntervals[i][2] / target ? i - 1 : i];\n step = i[1];\n interval = i[0];\n } else {\n step = tickStep(start, stop, interval);\n interval = millisecond$$1;\n }\n }\n\n return step == null ? interval : interval.every(step);\n }\n\n scale.invert = function(y) {\n return new Date(invert(y));\n };\n\n scale.domain = function(_) {\n return arguments.length ? domain(map$3.call(_, number$3)) : domain().map(date$1);\n };\n\n scale.ticks = function(interval, step) {\n var d = domain(),\n t0 = d[0],\n t1 = d[d.length - 1],\n r = t1 < t0,\n t;\n if (r) t = t0, t0 = t1, t1 = t;\n t = tickInterval(interval, t0, t1, step);\n t = t ? t.range(t0, t1 + 1) : []; // inclusive stop\n return r ? t.reverse() : t;\n };\n\n scale.tickFormat = function(count, specifier) {\n return specifier == null ? tickFormat : format(specifier);\n };\n\n scale.nice = function(interval, step) {\n var d = domain();\n return (interval = tickInterval(interval, d[0], d[d.length - 1], step))\n ? domain(nice(d, interval))\n : scale;\n };\n\n scale.copy = function() {\n return copy(scale, calendar(year$$1, month$$1, week, day$$1, hour$$1, minute$$1, second$$1, millisecond$$1, format));\n };\n\n return scale;\n}\n\nvar time = function() {\n return calendar(year, month, sunday, day, hour, minute, second, millisecond, exports.timeFormat).domain([new Date(2000, 0, 1), new Date(2000, 0, 2)]);\n};\n\nvar utcTime = function() {\n return calendar(utcYear, utcMonth, utcSunday, utcDay, utcHour, utcMinute, second, millisecond, exports.utcFormat).domain([Date.UTC(2000, 0, 1), Date.UTC(2000, 0, 2)]);\n};\n\nvar colors = function(s) {\n return s.match(/.{6}/g).map(function(x) {\n return \"#\" + x;\n });\n};\n\nvar category10 = colors(\"1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf\");\n\nvar category20b = colors(\"393b795254a36b6ecf9c9ede6379398ca252b5cf6bcedb9c8c6d31bd9e39e7ba52e7cb94843c39ad494ad6616be7969c7b4173a55194ce6dbdde9ed6\");\n\nvar category20c = colors(\"3182bd6baed69ecae1c6dbefe6550dfd8d3cfdae6bfdd0a231a35474c476a1d99bc7e9c0756bb19e9ac8bcbddcdadaeb636363969696bdbdbdd9d9d9\");\n\nvar category20 = colors(\"1f77b4aec7e8ff7f0effbb782ca02c98df8ad62728ff98969467bdc5b0d58c564bc49c94e377c2f7b6d27f7f7fc7c7c7bcbd22dbdb8d17becf9edae5\");\n\nvar cubehelix$3 = cubehelixLong(cubehelix(300, 0.5, 0.0), cubehelix(-240, 0.5, 1.0));\n\nvar warm = cubehelixLong(cubehelix(-100, 0.75, 0.35), cubehelix(80, 1.50, 0.8));\n\nvar cool = cubehelixLong(cubehelix(260, 0.75, 0.35), cubehelix(80, 1.50, 0.8));\n\nvar rainbow = cubehelix();\n\nvar rainbow$1 = function(t) {\n if (t < 0 || t > 1) t -= Math.floor(t);\n var ts = Math.abs(t - 0.5);\n rainbow.h = 360 * t - 100;\n rainbow.s = 1.5 - 1.5 * ts;\n rainbow.l = 0.8 - 0.9 * ts;\n return rainbow + \"\";\n};\n\nfunction ramp(range) {\n var n = range.length;\n return function(t) {\n return range[Math.max(0, Math.min(n - 1, Math.floor(t * n)))];\n };\n}\n\nvar viridis = ramp(colors(\"44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725\"));\n\nvar magma = ramp(colors(\"00000401000501010601010802010902020b02020d03030f03031204041405041606051806051a07061c08071e0907200a08220b09240c09260d0a290e0b2b100b2d110c2f120d31130d34140e36150e38160f3b180f3d19103f1a10421c10441d11471e114920114b21114e22115024125325125527125829115a2a115c2c115f2d11612f116331116533106734106936106b38106c390f6e3b0f703d0f713f0f72400f74420f75440f764510774710784910784a10794c117a4e117b4f127b51127c52137c54137d56147d57157e59157e5a167e5c167f5d177f5f187f601880621980641a80651a80671b80681c816a1c816b1d816d1d816e1e81701f81721f817320817521817621817822817922827b23827c23827e24828025828125818326818426818627818827818928818b29818c29818e2a81902a81912b81932b80942c80962c80982d80992d809b2e7f9c2e7f9e2f7fa02f7fa1307ea3307ea5317ea6317da8327daa337dab337cad347cae347bb0357bb2357bb3367ab5367ab73779b83779ba3878bc3978bd3977bf3a77c03a76c23b75c43c75c53c74c73d73c83e73ca3e72cc3f71cd4071cf4070d0416fd2426fd3436ed5446dd6456cd8456cd9466bdb476adc4869de4968df4a68e04c67e24d66e34e65e44f64e55064e75263e85362e95462ea5661eb5760ec5860ed5a5fee5b5eef5d5ef05f5ef1605df2625df2645cf3655cf4675cf4695cf56b5cf66c5cf66e5cf7705cf7725cf8745cf8765cf9785df9795df97b5dfa7d5efa7f5efa815ffb835ffb8560fb8761fc8961fc8a62fc8c63fc8e64fc9065fd9266fd9467fd9668fd9869fd9a6afd9b6bfe9d6cfe9f6dfea16efea36ffea571fea772fea973feaa74feac76feae77feb078feb27afeb47bfeb67cfeb77efeb97ffebb81febd82febf84fec185fec287fec488fec68afec88cfeca8dfecc8ffecd90fecf92fed194fed395fed597fed799fed89afdda9cfddc9efddea0fde0a1fde2a3fde3a5fde5a7fde7a9fde9aafdebacfcecaefceeb0fcf0b2fcf2b4fcf4b6fcf6b8fcf7b9fcf9bbfcfbbdfcfdbf\"));\n\nvar inferno = ramp(colors(\"00000401000501010601010802010a02020c02020e03021004031204031405041706041907051b08051d09061f0a07220b07240c08260d08290e092b10092d110a30120a32140b34150b37160b39180c3c190c3e1b0c411c0c431e0c451f0c48210c4a230c4c240c4f260c51280b53290b552b0b572d0b592f0a5b310a5c320a5e340a5f3609613809623909633b09643d09653e0966400a67420a68440a68450a69470b6a490b6a4a0c6b4c0c6b4d0d6c4f0d6c510e6c520e6d540f6d550f6d57106e59106e5a116e5c126e5d126e5f136e61136e62146e64156e65156e67166e69166e6a176e6c186e6d186e6f196e71196e721a6e741a6e751b6e771c6d781c6d7a1d6d7c1d6d7d1e6d7f1e6c801f6c82206c84206b85216b87216b88226a8a226a8c23698d23698f24699025689225689326679526679727669827669a28659b29649d29649f2a63a02a63a22b62a32c61a52c60a62d60a82e5fa92e5eab2f5ead305dae305cb0315bb1325ab3325ab43359b63458b73557b93556ba3655bc3754bd3853bf3952c03a51c13a50c33b4fc43c4ec63d4dc73e4cc83f4bca404acb4149cc4248ce4347cf4446d04545d24644d34743d44842d54a41d74b3fd84c3ed94d3dda4e3cdb503bdd513ade5238df5337e05536e15635e25734e35933e45a31e55c30e65d2fe75e2ee8602de9612bea632aeb6429eb6628ec6726ed6925ee6a24ef6c23ef6e21f06f20f1711ff1731df2741cf3761bf37819f47918f57b17f57d15f67e14f68013f78212f78410f8850ff8870ef8890cf98b0bf98c0af98e09fa9008fa9207fa9407fb9606fb9706fb9906fb9b06fb9d07fc9f07fca108fca309fca50afca60cfca80dfcaa0ffcac11fcae12fcb014fcb216fcb418fbb61afbb81dfbba1ffbbc21fbbe23fac026fac228fac42afac62df9c72ff9c932f9cb35f8cd37f8cf3af7d13df7d340f6d543f6d746f5d949f5db4cf4dd4ff4df53f4e156f3e35af3e55df2e661f2e865f2ea69f1ec6df1ed71f1ef75f1f179f2f27df2f482f3f586f3f68af4f88ef5f992f6fa96f8fb9af9fc9dfafda1fcffa4\"));\n\nvar plasma = ramp(colors(\"0d088710078813078916078a19068c1b068d1d068e20068f2206902406912605912805922a05932c05942e05952f059631059733059735049837049938049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c02a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a66100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a87401a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a68707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a19814a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb6308bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6ada5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe4695ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983ef99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fdab33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2afebe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921\"));\n\nfunction sequential(interpolator) {\n var x0 = 0,\n x1 = 1,\n clamp = false;\n\n function scale(x) {\n var t = (x - x0) / (x1 - x0);\n return interpolator(clamp ? Math.max(0, Math.min(1, t)) : t);\n }\n\n scale.domain = function(_) {\n return arguments.length ? (x0 = +_[0], x1 = +_[1], scale) : [x0, x1];\n };\n\n scale.clamp = function(_) {\n return arguments.length ? (clamp = !!_, scale) : clamp;\n };\n\n scale.interpolator = function(_) {\n return arguments.length ? (interpolator = _, scale) : interpolator;\n };\n\n scale.copy = function() {\n return sequential(interpolator).domain([x0, x1]).clamp(clamp);\n };\n\n return linearish(scale);\n}\n\nvar constant$10 = function(x) {\n return function constant() {\n return x;\n };\n};\n\nvar abs$1 = Math.abs;\nvar atan2$1 = Math.atan2;\nvar cos$2 = Math.cos;\nvar max$2 = Math.max;\nvar min$1 = Math.min;\nvar sin$2 = Math.sin;\nvar sqrt$2 = Math.sqrt;\n\nvar epsilon$3 = 1e-12;\nvar pi$4 = Math.PI;\nvar halfPi$3 = pi$4 / 2;\nvar tau$4 = 2 * pi$4;\n\nfunction acos$1(x) {\n return x > 1 ? 0 : x < -1 ? pi$4 : Math.acos(x);\n}\n\nfunction asin$1(x) {\n return x >= 1 ? halfPi$3 : x <= -1 ? -halfPi$3 : Math.asin(x);\n}\n\nfunction arcInnerRadius(d) {\n return d.innerRadius;\n}\n\nfunction arcOuterRadius(d) {\n return d.outerRadius;\n}\n\nfunction arcStartAngle(d) {\n return d.startAngle;\n}\n\nfunction arcEndAngle(d) {\n return d.endAngle;\n}\n\nfunction arcPadAngle(d) {\n return d && d.padAngle; // Note: optional!\n}\n\nfunction intersect(x0, y0, x1, y1, x2, y2, x3, y3) {\n var x10 = x1 - x0, y10 = y1 - y0,\n x32 = x3 - x2, y32 = y3 - y2,\n t = (x32 * (y0 - y2) - y32 * (x0 - x2)) / (y32 * x10 - x32 * y10);\n return [x0 + t * x10, y0 + t * y10];\n}\n\n// Compute perpendicular offset line of length rc.\n// http://mathworld.wolfram.com/Circle-LineIntersection.html\nfunction cornerTangents(x0, y0, x1, y1, r1, rc, cw) {\n var x01 = x0 - x1,\n y01 = y0 - y1,\n lo = (cw ? rc : -rc) / sqrt$2(x01 * x01 + y01 * y01),\n ox = lo * y01,\n oy = -lo * x01,\n x11 = x0 + ox,\n y11 = y0 + oy,\n x10 = x1 + ox,\n y10 = y1 + oy,\n x00 = (x11 + x10) / 2,\n y00 = (y11 + y10) / 2,\n dx = x10 - x11,\n dy = y10 - y11,\n d2 = dx * dx + dy * dy,\n r = r1 - rc,\n D = x11 * y10 - x10 * y11,\n d = (dy < 0 ? -1 : 1) * sqrt$2(max$2(0, r * r * d2 - D * D)),\n cx0 = (D * dy - dx * d) / d2,\n cy0 = (-D * dx - dy * d) / d2,\n cx1 = (D * dy + dx * d) / d2,\n cy1 = (-D * dx + dy * d) / d2,\n dx0 = cx0 - x00,\n dy0 = cy0 - y00,\n dx1 = cx1 - x00,\n dy1 = cy1 - y00;\n\n // Pick the closer of the two intersection points.\n // TODO Is there a faster way to determine which intersection to use?\n if (dx0 * dx0 + dy0 * dy0 > dx1 * dx1 + dy1 * dy1) cx0 = cx1, cy0 = cy1;\n\n return {\n cx: cx0,\n cy: cy0,\n x01: -ox,\n y01: -oy,\n x11: cx0 * (r1 / r - 1),\n y11: cy0 * (r1 / r - 1)\n };\n}\n\nvar arc = function() {\n var innerRadius = arcInnerRadius,\n outerRadius = arcOuterRadius,\n cornerRadius = constant$10(0),\n padRadius = null,\n startAngle = arcStartAngle,\n endAngle = arcEndAngle,\n padAngle = arcPadAngle,\n context = null;\n\n function arc() {\n var buffer,\n r,\n r0 = +innerRadius.apply(this, arguments),\n r1 = +outerRadius.apply(this, arguments),\n a0 = startAngle.apply(this, arguments) - halfPi$3,\n a1 = endAngle.apply(this, arguments) - halfPi$3,\n da = abs$1(a1 - a0),\n cw = a1 > a0;\n\n if (!context) context = buffer = path();\n\n // Ensure that the outer radius is always larger than the inner radius.\n if (r1 < r0) r = r1, r1 = r0, r0 = r;\n\n // Is it a point?\n if (!(r1 > epsilon$3)) context.moveTo(0, 0);\n\n // Or is it a circle or annulus?\n else if (da > tau$4 - epsilon$3) {\n context.moveTo(r1 * cos$2(a0), r1 * sin$2(a0));\n context.arc(0, 0, r1, a0, a1, !cw);\n if (r0 > epsilon$3) {\n context.moveTo(r0 * cos$2(a1), r0 * sin$2(a1));\n context.arc(0, 0, r0, a1, a0, cw);\n }\n }\n\n // Or is it a circular or annular sector?\n else {\n var a01 = a0,\n a11 = a1,\n a00 = a0,\n a10 = a1,\n da0 = da,\n da1 = da,\n ap = padAngle.apply(this, arguments) / 2,\n rp = (ap > epsilon$3) && (padRadius ? +padRadius.apply(this, arguments) : sqrt$2(r0 * r0 + r1 * r1)),\n rc = min$1(abs$1(r1 - r0) / 2, +cornerRadius.apply(this, arguments)),\n rc0 = rc,\n rc1 = rc,\n t0,\n t1;\n\n // Apply padding? Note that since r1 ≥ r0, da1 ≥ da0.\n if (rp > epsilon$3) {\n var p0 = asin$1(rp / r0 * sin$2(ap)),\n p1 = asin$1(rp / r1 * sin$2(ap));\n if ((da0 -= p0 * 2) > epsilon$3) p0 *= (cw ? 1 : -1), a00 += p0, a10 -= p0;\n else da0 = 0, a00 = a10 = (a0 + a1) / 2;\n if ((da1 -= p1 * 2) > epsilon$3) p1 *= (cw ? 1 : -1), a01 += p1, a11 -= p1;\n else da1 = 0, a01 = a11 = (a0 + a1) / 2;\n }\n\n var x01 = r1 * cos$2(a01),\n y01 = r1 * sin$2(a01),\n x10 = r0 * cos$2(a10),\n y10 = r0 * sin$2(a10);\n\n // Apply rounded corners?\n if (rc > epsilon$3) {\n var x11 = r1 * cos$2(a11),\n y11 = r1 * sin$2(a11),\n x00 = r0 * cos$2(a00),\n y00 = r0 * sin$2(a00);\n\n // Restrict the corner radius according to the sector angle.\n if (da < pi$4) {\n var oc = da0 > epsilon$3 ? intersect(x01, y01, x00, y00, x11, y11, x10, y10) : [x10, y10],\n ax = x01 - oc[0],\n ay = y01 - oc[1],\n bx = x11 - oc[0],\n by = y11 - oc[1],\n kc = 1 / sin$2(acos$1((ax * bx + ay * by) / (sqrt$2(ax * ax + ay * ay) * sqrt$2(bx * bx + by * by))) / 2),\n lc = sqrt$2(oc[0] * oc[0] + oc[1] * oc[1]);\n rc0 = min$1(rc, (r0 - lc) / (kc - 1));\n rc1 = min$1(rc, (r1 - lc) / (kc + 1));\n }\n }\n\n // Is the sector collapsed to a line?\n if (!(da1 > epsilon$3)) context.moveTo(x01, y01);\n\n // Does the sector’s outer ring have rounded corners?\n else if (rc1 > epsilon$3) {\n t0 = cornerTangents(x00, y00, x01, y01, r1, rc1, cw);\n t1 = cornerTangents(x11, y11, x10, y10, r1, rc1, cw);\n\n context.moveTo(t0.cx + t0.x01, t0.cy + t0.y01);\n\n // Have the corners merged?\n if (rc1 < rc) context.arc(t0.cx, t0.cy, rc1, atan2$1(t0.y01, t0.x01), atan2$1(t1.y01, t1.x01), !cw);\n\n // Otherwise, draw the two corners and the ring.\n else {\n context.arc(t0.cx, t0.cy, rc1, atan2$1(t0.y01, t0.x01), atan2$1(t0.y11, t0.x11), !cw);\n context.arc(0, 0, r1, atan2$1(t0.cy + t0.y11, t0.cx + t0.x11), atan2$1(t1.cy + t1.y11, t1.cx + t1.x11), !cw);\n context.arc(t1.cx, t1.cy, rc1, atan2$1(t1.y11, t1.x11), atan2$1(t1.y01, t1.x01), !cw);\n }\n }\n\n // Or is the outer ring just a circular arc?\n else context.moveTo(x01, y01), context.arc(0, 0, r1, a01, a11, !cw);\n\n // Is there no inner ring, and it’s a circular sector?\n // Or perhaps it’s an annular sector collapsed due to padding?\n if (!(r0 > epsilon$3) || !(da0 > epsilon$3)) context.lineTo(x10, y10);\n\n // Does the sector’s inner ring (or point) have rounded corners?\n else if (rc0 > epsilon$3) {\n t0 = cornerTangents(x10, y10, x11, y11, r0, -rc0, cw);\n t1 = cornerTangents(x01, y01, x00, y00, r0, -rc0, cw);\n\n context.lineTo(t0.cx + t0.x01, t0.cy + t0.y01);\n\n // Have the corners merged?\n if (rc0 < rc) context.arc(t0.cx, t0.cy, rc0, atan2$1(t0.y01, t0.x01), atan2$1(t1.y01, t1.x01), !cw);\n\n // Otherwise, draw the two corners and the ring.\n else {\n context.arc(t0.cx, t0.cy, rc0, atan2$1(t0.y01, t0.x01), atan2$1(t0.y11, t0.x11), !cw);\n context.arc(0, 0, r0, atan2$1(t0.cy + t0.y11, t0.cx + t0.x11), atan2$1(t1.cy + t1.y11, t1.cx + t1.x11), cw);\n context.arc(t1.cx, t1.cy, rc0, atan2$1(t1.y11, t1.x11), atan2$1(t1.y01, t1.x01), !cw);\n }\n }\n\n // Or is the inner ring just a circular arc?\n else context.arc(0, 0, r0, a10, a00, cw);\n }\n\n context.closePath();\n\n if (buffer) return context = null, buffer + \"\" || null;\n }\n\n arc.centroid = function() {\n var r = (+innerRadius.apply(this, arguments) + +outerRadius.apply(this, arguments)) / 2,\n a = (+startAngle.apply(this, arguments) + +endAngle.apply(this, arguments)) / 2 - pi$4 / 2;\n return [cos$2(a) * r, sin$2(a) * r];\n };\n\n arc.innerRadius = function(_) {\n return arguments.length ? (innerRadius = typeof _ === \"function\" ? _ : constant$10(+_), arc) : innerRadius;\n };\n\n arc.outerRadius = function(_) {\n return arguments.length ? (outerRadius = typeof _ === \"function\" ? _ : constant$10(+_), arc) : outerRadius;\n };\n\n arc.cornerRadius = function(_) {\n return arguments.length ? (cornerRadius = typeof _ === \"function\" ? _ : constant$10(+_), arc) : cornerRadius;\n };\n\n arc.padRadius = function(_) {\n return arguments.length ? (padRadius = _ == null ? null : typeof _ === \"function\" ? _ : constant$10(+_), arc) : padRadius;\n };\n\n arc.startAngle = function(_) {\n return arguments.length ? (startAngle = typeof _ === \"function\" ? _ : constant$10(+_), arc) : startAngle;\n };\n\n arc.endAngle = function(_) {\n return arguments.length ? (endAngle = typeof _ === \"function\" ? _ : constant$10(+_), arc) : endAngle;\n };\n\n arc.padAngle = function(_) {\n return arguments.length ? (padAngle = typeof _ === \"function\" ? _ : constant$10(+_), arc) : padAngle;\n };\n\n arc.context = function(_) {\n return arguments.length ? ((context = _ == null ? null : _), arc) : context;\n };\n\n return arc;\n};\n\nfunction Linear(context) {\n this._context = context;\n}\n\nLinear.prototype = {\n areaStart: function() {\n this._line = 0;\n },\n areaEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._point = 0;\n },\n lineEnd: function() {\n if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();\n this._line = 1 - this._line;\n },\n point: function(x, y) {\n x = +x, y = +y;\n switch (this._point) {\n case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;\n case 1: this._point = 2; // proceed\n default: this._context.lineTo(x, y); break;\n }\n }\n};\n\nvar curveLinear = function(context) {\n return new Linear(context);\n};\n\nfunction x$3(p) {\n return p[0];\n}\n\nfunction y$3(p) {\n return p[1];\n}\n\nvar line = function() {\n var x$$1 = x$3,\n y$$1 = y$3,\n defined = constant$10(true),\n context = null,\n curve = curveLinear,\n output = null;\n\n function line(data) {\n var i,\n n = data.length,\n d,\n defined0 = false,\n buffer;\n\n if (context == null) output = curve(buffer = path());\n\n for (i = 0; i <= n; ++i) {\n if (!(i < n && defined(d = data[i], i, data)) === defined0) {\n if (defined0 = !defined0) output.lineStart();\n else output.lineEnd();\n }\n if (defined0) output.point(+x$$1(d, i, data), +y$$1(d, i, data));\n }\n\n if (buffer) return output = null, buffer + \"\" || null;\n }\n\n line.x = function(_) {\n return arguments.length ? (x$$1 = typeof _ === \"function\" ? _ : constant$10(+_), line) : x$$1;\n };\n\n line.y = function(_) {\n return arguments.length ? (y$$1 = typeof _ === \"function\" ? _ : constant$10(+_), line) : y$$1;\n };\n\n line.defined = function(_) {\n return arguments.length ? (defined = typeof _ === \"function\" ? _ : constant$10(!!_), line) : defined;\n };\n\n line.curve = function(_) {\n return arguments.length ? (curve = _, context != null && (output = curve(context)), line) : curve;\n };\n\n line.context = function(_) {\n return arguments.length ? (_ == null ? context = output = null : output = curve(context = _), line) : context;\n };\n\n return line;\n};\n\nvar area$2 = function() {\n var x0 = x$3,\n x1 = null,\n y0 = constant$10(0),\n y1 = y$3,\n defined = constant$10(true),\n context = null,\n curve = curveLinear,\n output = null;\n\n function area(data) {\n var i,\n j,\n k,\n n = data.length,\n d,\n defined0 = false,\n buffer,\n x0z = new Array(n),\n y0z = new Array(n);\n\n if (context == null) output = curve(buffer = path());\n\n for (i = 0; i <= n; ++i) {\n if (!(i < n && defined(d = data[i], i, data)) === defined0) {\n if (defined0 = !defined0) {\n j = i;\n output.areaStart();\n output.lineStart();\n } else {\n output.lineEnd();\n output.lineStart();\n for (k = i - 1; k >= j; --k) {\n output.point(x0z[k], y0z[k]);\n }\n output.lineEnd();\n output.areaEnd();\n }\n }\n if (defined0) {\n x0z[i] = +x0(d, i, data), y0z[i] = +y0(d, i, data);\n output.point(x1 ? +x1(d, i, data) : x0z[i], y1 ? +y1(d, i, data) : y0z[i]);\n }\n }\n\n if (buffer) return output = null, buffer + \"\" || null;\n }\n\n function arealine() {\n return line().defined(defined).curve(curve).context(context);\n }\n\n area.x = function(_) {\n return arguments.length ? (x0 = typeof _ === \"function\" ? _ : constant$10(+_), x1 = null, area) : x0;\n };\n\n area.x0 = function(_) {\n return arguments.length ? (x0 = typeof _ === \"function\" ? _ : constant$10(+_), area) : x0;\n };\n\n area.x1 = function(_) {\n return arguments.length ? (x1 = _ == null ? null : typeof _ === \"function\" ? _ : constant$10(+_), area) : x1;\n };\n\n area.y = function(_) {\n return arguments.length ? (y0 = typeof _ === \"function\" ? _ : constant$10(+_), y1 = null, area) : y0;\n };\n\n area.y0 = function(_) {\n return arguments.length ? (y0 = typeof _ === \"function\" ? _ : constant$10(+_), area) : y0;\n };\n\n area.y1 = function(_) {\n return arguments.length ? (y1 = _ == null ? null : typeof _ === \"function\" ? _ : constant$10(+_), area) : y1;\n };\n\n area.lineX0 =\n area.lineY0 = function() {\n return arealine().x(x0).y(y0);\n };\n\n area.lineY1 = function() {\n return arealine().x(x0).y(y1);\n };\n\n area.lineX1 = function() {\n return arealine().x(x1).y(y0);\n };\n\n area.defined = function(_) {\n return arguments.length ? (defined = typeof _ === \"function\" ? _ : constant$10(!!_), area) : defined;\n };\n\n area.curve = function(_) {\n return arguments.length ? (curve = _, context != null && (output = curve(context)), area) : curve;\n };\n\n area.context = function(_) {\n return arguments.length ? (_ == null ? context = output = null : output = curve(context = _), area) : context;\n };\n\n return area;\n};\n\nvar descending$1 = function(a, b) {\n return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN;\n};\n\nvar identity$7 = function(d) {\n return d;\n};\n\nvar pie = function() {\n var value = identity$7,\n sortValues = descending$1,\n sort = null,\n startAngle = constant$10(0),\n endAngle = constant$10(tau$4),\n padAngle = constant$10(0);\n\n function pie(data) {\n var i,\n n = data.length,\n j,\n k,\n sum = 0,\n index = new Array(n),\n arcs = new Array(n),\n a0 = +startAngle.apply(this, arguments),\n da = Math.min(tau$4, Math.max(-tau$4, endAngle.apply(this, arguments) - a0)),\n a1,\n p = Math.min(Math.abs(da) / n, padAngle.apply(this, arguments)),\n pa = p * (da < 0 ? -1 : 1),\n v;\n\n for (i = 0; i < n; ++i) {\n if ((v = arcs[index[i] = i] = +value(data[i], i, data)) > 0) {\n sum += v;\n }\n }\n\n // Optionally sort the arcs by previously-computed values or by data.\n if (sortValues != null) index.sort(function(i, j) { return sortValues(arcs[i], arcs[j]); });\n else if (sort != null) index.sort(function(i, j) { return sort(data[i], data[j]); });\n\n // Compute the arcs! They are stored in the original data's order.\n for (i = 0, k = sum ? (da - n * pa) / sum : 0; i < n; ++i, a0 = a1) {\n j = index[i], v = arcs[j], a1 = a0 + (v > 0 ? v * k : 0) + pa, arcs[j] = {\n data: data[j],\n index: i,\n value: v,\n startAngle: a0,\n endAngle: a1,\n padAngle: p\n };\n }\n\n return arcs;\n }\n\n pie.value = function(_) {\n return arguments.length ? (value = typeof _ === \"function\" ? _ : constant$10(+_), pie) : value;\n };\n\n pie.sortValues = function(_) {\n return arguments.length ? (sortValues = _, sort = null, pie) : sortValues;\n };\n\n pie.sort = function(_) {\n return arguments.length ? (sort = _, sortValues = null, pie) : sort;\n };\n\n pie.startAngle = function(_) {\n return arguments.length ? (startAngle = typeof _ === \"function\" ? _ : constant$10(+_), pie) : startAngle;\n };\n\n pie.endAngle = function(_) {\n return arguments.length ? (endAngle = typeof _ === \"function\" ? _ : constant$10(+_), pie) : endAngle;\n };\n\n pie.padAngle = function(_) {\n return arguments.length ? (padAngle = typeof _ === \"function\" ? _ : constant$10(+_), pie) : padAngle;\n };\n\n return pie;\n};\n\nvar curveRadialLinear = curveRadial(curveLinear);\n\nfunction Radial(curve) {\n this._curve = curve;\n}\n\nRadial.prototype = {\n areaStart: function() {\n this._curve.areaStart();\n },\n areaEnd: function() {\n this._curve.areaEnd();\n },\n lineStart: function() {\n this._curve.lineStart();\n },\n lineEnd: function() {\n this._curve.lineEnd();\n },\n point: function(a, r) {\n this._curve.point(r * Math.sin(a), r * -Math.cos(a));\n }\n};\n\nfunction curveRadial(curve) {\n\n function radial(context) {\n return new Radial(curve(context));\n }\n\n radial._curve = curve;\n\n return radial;\n}\n\nfunction lineRadial(l) {\n var c = l.curve;\n\n l.angle = l.x, delete l.x;\n l.radius = l.y, delete l.y;\n\n l.curve = function(_) {\n return arguments.length ? c(curveRadial(_)) : c()._curve;\n };\n\n return l;\n}\n\nvar lineRadial$1 = function() {\n return lineRadial(line().curve(curveRadialLinear));\n};\n\nvar areaRadial = function() {\n var a = area$2().curve(curveRadialLinear),\n c = a.curve,\n x0 = a.lineX0,\n x1 = a.lineX1,\n y0 = a.lineY0,\n y1 = a.lineY1;\n\n a.angle = a.x, delete a.x;\n a.startAngle = a.x0, delete a.x0;\n a.endAngle = a.x1, delete a.x1;\n a.radius = a.y, delete a.y;\n a.innerRadius = a.y0, delete a.y0;\n a.outerRadius = a.y1, delete a.y1;\n a.lineStartAngle = function() { return lineRadial(x0()); }, delete a.lineX0;\n a.lineEndAngle = function() { return lineRadial(x1()); }, delete a.lineX1;\n a.lineInnerRadius = function() { return lineRadial(y0()); }, delete a.lineY0;\n a.lineOuterRadius = function() { return lineRadial(y1()); }, delete a.lineY1;\n\n a.curve = function(_) {\n return arguments.length ? c(curveRadial(_)) : c()._curve;\n };\n\n return a;\n};\n\nvar pointRadial = function(x, y) {\n return [(y = +y) * Math.cos(x -= Math.PI / 2), y * Math.sin(x)];\n};\n\nvar slice$6 = Array.prototype.slice;\n\nfunction linkSource(d) {\n return d.source;\n}\n\nfunction linkTarget(d) {\n return d.target;\n}\n\nfunction link$2(curve) {\n var source = linkSource,\n target = linkTarget,\n x$$1 = x$3,\n y$$1 = y$3,\n context = null;\n\n function link() {\n var buffer, argv = slice$6.call(arguments), s = source.apply(this, argv), t = target.apply(this, argv);\n if (!context) context = buffer = path();\n curve(context, +x$$1.apply(this, (argv[0] = s, argv)), +y$$1.apply(this, argv), +x$$1.apply(this, (argv[0] = t, argv)), +y$$1.apply(this, argv));\n if (buffer) return context = null, buffer + \"\" || null;\n }\n\n link.source = function(_) {\n return arguments.length ? (source = _, link) : source;\n };\n\n link.target = function(_) {\n return arguments.length ? (target = _, link) : target;\n };\n\n link.x = function(_) {\n return arguments.length ? (x$$1 = typeof _ === \"function\" ? _ : constant$10(+_), link) : x$$1;\n };\n\n link.y = function(_) {\n return arguments.length ? (y$$1 = typeof _ === \"function\" ? _ : constant$10(+_), link) : y$$1;\n };\n\n link.context = function(_) {\n return arguments.length ? ((context = _ == null ? null : _), link) : context;\n };\n\n return link;\n}\n\nfunction curveHorizontal(context, x0, y0, x1, y1) {\n context.moveTo(x0, y0);\n context.bezierCurveTo(x0 = (x0 + x1) / 2, y0, x0, y1, x1, y1);\n}\n\nfunction curveVertical(context, x0, y0, x1, y1) {\n context.moveTo(x0, y0);\n context.bezierCurveTo(x0, y0 = (y0 + y1) / 2, x1, y0, x1, y1);\n}\n\nfunction curveRadial$1(context, x0, y0, x1, y1) {\n var p0 = pointRadial(x0, y0),\n p1 = pointRadial(x0, y0 = (y0 + y1) / 2),\n p2 = pointRadial(x1, y0),\n p3 = pointRadial(x1, y1);\n context.moveTo(p0[0], p0[1]);\n context.bezierCurveTo(p1[0], p1[1], p2[0], p2[1], p3[0], p3[1]);\n}\n\nfunction linkHorizontal() {\n return link$2(curveHorizontal);\n}\n\nfunction linkVertical() {\n return link$2(curveVertical);\n}\n\nfunction linkRadial() {\n var l = link$2(curveRadial$1);\n l.angle = l.x, delete l.x;\n l.radius = l.y, delete l.y;\n return l;\n}\n\nvar circle$2 = {\n draw: function(context, size) {\n var r = Math.sqrt(size / pi$4);\n context.moveTo(r, 0);\n context.arc(0, 0, r, 0, tau$4);\n }\n};\n\nvar cross$2 = {\n draw: function(context, size) {\n var r = Math.sqrt(size / 5) / 2;\n context.moveTo(-3 * r, -r);\n context.lineTo(-r, -r);\n context.lineTo(-r, -3 * r);\n context.lineTo(r, -3 * r);\n context.lineTo(r, -r);\n context.lineTo(3 * r, -r);\n context.lineTo(3 * r, r);\n context.lineTo(r, r);\n context.lineTo(r, 3 * r);\n context.lineTo(-r, 3 * r);\n context.lineTo(-r, r);\n context.lineTo(-3 * r, r);\n context.closePath();\n }\n};\n\nvar tan30 = Math.sqrt(1 / 3);\nvar tan30_2 = tan30 * 2;\n\nvar diamond = {\n draw: function(context, size) {\n var y = Math.sqrt(size / tan30_2),\n x = y * tan30;\n context.moveTo(0, -y);\n context.lineTo(x, 0);\n context.lineTo(0, y);\n context.lineTo(-x, 0);\n context.closePath();\n }\n};\n\nvar ka = 0.89081309152928522810;\nvar kr = Math.sin(pi$4 / 10) / Math.sin(7 * pi$4 / 10);\nvar kx = Math.sin(tau$4 / 10) * kr;\nvar ky = -Math.cos(tau$4 / 10) * kr;\n\nvar star = {\n draw: function(context, size) {\n var r = Math.sqrt(size * ka),\n x = kx * r,\n y = ky * r;\n context.moveTo(0, -r);\n context.lineTo(x, y);\n for (var i = 1; i < 5; ++i) {\n var a = tau$4 * i / 5,\n c = Math.cos(a),\n s = Math.sin(a);\n context.lineTo(s * r, -c * r);\n context.lineTo(c * x - s * y, s * x + c * y);\n }\n context.closePath();\n }\n};\n\nvar square = {\n draw: function(context, size) {\n var w = Math.sqrt(size),\n x = -w / 2;\n context.rect(x, x, w, w);\n }\n};\n\nvar sqrt3 = Math.sqrt(3);\n\nvar triangle = {\n draw: function(context, size) {\n var y = -Math.sqrt(size / (sqrt3 * 3));\n context.moveTo(0, y * 2);\n context.lineTo(-sqrt3 * y, -y);\n context.lineTo(sqrt3 * y, -y);\n context.closePath();\n }\n};\n\nvar c = -0.5;\nvar s = Math.sqrt(3) / 2;\nvar k = 1 / Math.sqrt(12);\nvar a = (k / 2 + 1) * 3;\n\nvar wye = {\n draw: function(context, size) {\n var r = Math.sqrt(size / a),\n x0 = r / 2,\n y0 = r * k,\n x1 = x0,\n y1 = r * k + r,\n x2 = -x1,\n y2 = y1;\n context.moveTo(x0, y0);\n context.lineTo(x1, y1);\n context.lineTo(x2, y2);\n context.lineTo(c * x0 - s * y0, s * x0 + c * y0);\n context.lineTo(c * x1 - s * y1, s * x1 + c * y1);\n context.lineTo(c * x2 - s * y2, s * x2 + c * y2);\n context.lineTo(c * x0 + s * y0, c * y0 - s * x0);\n context.lineTo(c * x1 + s * y1, c * y1 - s * x1);\n context.lineTo(c * x2 + s * y2, c * y2 - s * x2);\n context.closePath();\n }\n};\n\nvar symbols = [\n circle$2,\n cross$2,\n diamond,\n square,\n star,\n triangle,\n wye\n];\n\nvar symbol = function() {\n var type = constant$10(circle$2),\n size = constant$10(64),\n context = null;\n\n function symbol() {\n var buffer;\n if (!context) context = buffer = path();\n type.apply(this, arguments).draw(context, +size.apply(this, arguments));\n if (buffer) return context = null, buffer + \"\" || null;\n }\n\n symbol.type = function(_) {\n return arguments.length ? (type = typeof _ === \"function\" ? _ : constant$10(_), symbol) : type;\n };\n\n symbol.size = function(_) {\n return arguments.length ? (size = typeof _ === \"function\" ? _ : constant$10(+_), symbol) : size;\n };\n\n symbol.context = function(_) {\n return arguments.length ? (context = _ == null ? null : _, symbol) : context;\n };\n\n return symbol;\n};\n\nvar noop$2 = function() {};\n\nfunction point$2(that, x, y) {\n that._context.bezierCurveTo(\n (2 * that._x0 + that._x1) / 3,\n (2 * that._y0 + that._y1) / 3,\n (that._x0 + 2 * that._x1) / 3,\n (that._y0 + 2 * that._y1) / 3,\n (that._x0 + 4 * that._x1 + x) / 6,\n (that._y0 + 4 * that._y1 + y) / 6\n );\n}\n\nfunction Basis(context) {\n this._context = context;\n}\n\nBasis.prototype = {\n areaStart: function() {\n this._line = 0;\n },\n areaEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._x0 = this._x1 =\n this._y0 = this._y1 = NaN;\n this._point = 0;\n },\n lineEnd: function() {\n switch (this._point) {\n case 3: point$2(this, this._x1, this._y1); // proceed\n case 2: this._context.lineTo(this._x1, this._y1); break;\n }\n if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();\n this._line = 1 - this._line;\n },\n point: function(x, y) {\n x = +x, y = +y;\n switch (this._point) {\n case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;\n case 1: this._point = 2; break;\n case 2: this._point = 3; this._context.lineTo((5 * this._x0 + this._x1) / 6, (5 * this._y0 + this._y1) / 6); // proceed\n default: point$2(this, x, y); break;\n }\n this._x0 = this._x1, this._x1 = x;\n this._y0 = this._y1, this._y1 = y;\n }\n};\n\nvar basis$2 = function(context) {\n return new Basis(context);\n};\n\nfunction BasisClosed(context) {\n this._context = context;\n}\n\nBasisClosed.prototype = {\n areaStart: noop$2,\n areaEnd: noop$2,\n lineStart: function() {\n this._x0 = this._x1 = this._x2 = this._x3 = this._x4 =\n this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = NaN;\n this._point = 0;\n },\n lineEnd: function() {\n switch (this._point) {\n case 1: {\n this._context.moveTo(this._x2, this._y2);\n this._context.closePath();\n break;\n }\n case 2: {\n this._context.moveTo((this._x2 + 2 * this._x3) / 3, (this._y2 + 2 * this._y3) / 3);\n this._context.lineTo((this._x3 + 2 * this._x2) / 3, (this._y3 + 2 * this._y2) / 3);\n this._context.closePath();\n break;\n }\n case 3: {\n this.point(this._x2, this._y2);\n this.point(this._x3, this._y3);\n this.point(this._x4, this._y4);\n break;\n }\n }\n },\n point: function(x, y) {\n x = +x, y = +y;\n switch (this._point) {\n case 0: this._point = 1; this._x2 = x, this._y2 = y; break;\n case 1: this._point = 2; this._x3 = x, this._y3 = y; break;\n case 2: this._point = 3; this._x4 = x, this._y4 = y; this._context.moveTo((this._x0 + 4 * this._x1 + x) / 6, (this._y0 + 4 * this._y1 + y) / 6); break;\n default: point$2(this, x, y); break;\n }\n this._x0 = this._x1, this._x1 = x;\n this._y0 = this._y1, this._y1 = y;\n }\n};\n\nvar basisClosed$1 = function(context) {\n return new BasisClosed(context);\n};\n\nfunction BasisOpen(context) {\n this._context = context;\n}\n\nBasisOpen.prototype = {\n areaStart: function() {\n this._line = 0;\n },\n areaEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._x0 = this._x1 =\n this._y0 = this._y1 = NaN;\n this._point = 0;\n },\n lineEnd: function() {\n if (this._line || (this._line !== 0 && this._point === 3)) this._context.closePath();\n this._line = 1 - this._line;\n },\n point: function(x, y) {\n x = +x, y = +y;\n switch (this._point) {\n case 0: this._point = 1; break;\n case 1: this._point = 2; break;\n case 2: this._point = 3; var x0 = (this._x0 + 4 * this._x1 + x) / 6, y0 = (this._y0 + 4 * this._y1 + y) / 6; this._line ? this._context.lineTo(x0, y0) : this._context.moveTo(x0, y0); break;\n case 3: this._point = 4; // proceed\n default: point$2(this, x, y); break;\n }\n this._x0 = this._x1, this._x1 = x;\n this._y0 = this._y1, this._y1 = y;\n }\n};\n\nvar basisOpen = function(context) {\n return new BasisOpen(context);\n};\n\nfunction Bundle(context, beta) {\n this._basis = new Basis(context);\n this._beta = beta;\n}\n\nBundle.prototype = {\n lineStart: function() {\n this._x = [];\n this._y = [];\n this._basis.lineStart();\n },\n lineEnd: function() {\n var x = this._x,\n y = this._y,\n j = x.length - 1;\n\n if (j > 0) {\n var x0 = x[0],\n y0 = y[0],\n dx = x[j] - x0,\n dy = y[j] - y0,\n i = -1,\n t;\n\n while (++i <= j) {\n t = i / j;\n this._basis.point(\n this._beta * x[i] + (1 - this._beta) * (x0 + t * dx),\n this._beta * y[i] + (1 - this._beta) * (y0 + t * dy)\n );\n }\n }\n\n this._x = this._y = null;\n this._basis.lineEnd();\n },\n point: function(x, y) {\n this._x.push(+x);\n this._y.push(+y);\n }\n};\n\nvar bundle = (function custom(beta) {\n\n function bundle(context) {\n return beta === 1 ? new Basis(context) : new Bundle(context, beta);\n }\n\n bundle.beta = function(beta) {\n return custom(+beta);\n };\n\n return bundle;\n})(0.85);\n\nfunction point$3(that, x, y) {\n that._context.bezierCurveTo(\n that._x1 + that._k * (that._x2 - that._x0),\n that._y1 + that._k * (that._y2 - that._y0),\n that._x2 + that._k * (that._x1 - x),\n that._y2 + that._k * (that._y1 - y),\n that._x2,\n that._y2\n );\n}\n\nfunction Cardinal(context, tension) {\n this._context = context;\n this._k = (1 - tension) / 6;\n}\n\nCardinal.prototype = {\n areaStart: function() {\n this._line = 0;\n },\n areaEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._x0 = this._x1 = this._x2 =\n this._y0 = this._y1 = this._y2 = NaN;\n this._point = 0;\n },\n lineEnd: function() {\n switch (this._point) {\n case 2: this._context.lineTo(this._x2, this._y2); break;\n case 3: point$3(this, this._x1, this._y1); break;\n }\n if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();\n this._line = 1 - this._line;\n },\n point: function(x, y) {\n x = +x, y = +y;\n switch (this._point) {\n case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;\n case 1: this._point = 2; this._x1 = x, this._y1 = y; break;\n case 2: this._point = 3; // proceed\n default: point$3(this, x, y); break;\n }\n this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;\n this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;\n }\n};\n\nvar cardinal = (function custom(tension) {\n\n function cardinal(context) {\n return new Cardinal(context, tension);\n }\n\n cardinal.tension = function(tension) {\n return custom(+tension);\n };\n\n return cardinal;\n})(0);\n\nfunction CardinalClosed(context, tension) {\n this._context = context;\n this._k = (1 - tension) / 6;\n}\n\nCardinalClosed.prototype = {\n areaStart: noop$2,\n areaEnd: noop$2,\n lineStart: function() {\n this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._x5 =\n this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = this._y5 = NaN;\n this._point = 0;\n },\n lineEnd: function() {\n switch (this._point) {\n case 1: {\n this._context.moveTo(this._x3, this._y3);\n this._context.closePath();\n break;\n }\n case 2: {\n this._context.lineTo(this._x3, this._y3);\n this._context.closePath();\n break;\n }\n case 3: {\n this.point(this._x3, this._y3);\n this.point(this._x4, this._y4);\n this.point(this._x5, this._y5);\n break;\n }\n }\n },\n point: function(x, y) {\n x = +x, y = +y;\n switch (this._point) {\n case 0: this._point = 1; this._x3 = x, this._y3 = y; break;\n case 1: this._point = 2; this._context.moveTo(this._x4 = x, this._y4 = y); break;\n case 2: this._point = 3; this._x5 = x, this._y5 = y; break;\n default: point$3(this, x, y); break;\n }\n this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;\n this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;\n }\n};\n\nvar cardinalClosed = (function custom(tension) {\n\n function cardinal$$1(context) {\n return new CardinalClosed(context, tension);\n }\n\n cardinal$$1.tension = function(tension) {\n return custom(+tension);\n };\n\n return cardinal$$1;\n})(0);\n\nfunction CardinalOpen(context, tension) {\n this._context = context;\n this._k = (1 - tension) / 6;\n}\n\nCardinalOpen.prototype = {\n areaStart: function() {\n this._line = 0;\n },\n areaEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._x0 = this._x1 = this._x2 =\n this._y0 = this._y1 = this._y2 = NaN;\n this._point = 0;\n },\n lineEnd: function() {\n if (this._line || (this._line !== 0 && this._point === 3)) this._context.closePath();\n this._line = 1 - this._line;\n },\n point: function(x, y) {\n x = +x, y = +y;\n switch (this._point) {\n case 0: this._point = 1; break;\n case 1: this._point = 2; break;\n case 2: this._point = 3; this._line ? this._context.lineTo(this._x2, this._y2) : this._context.moveTo(this._x2, this._y2); break;\n case 3: this._point = 4; // proceed\n default: point$3(this, x, y); break;\n }\n this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;\n this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;\n }\n};\n\nvar cardinalOpen = (function custom(tension) {\n\n function cardinal$$1(context) {\n return new CardinalOpen(context, tension);\n }\n\n cardinal$$1.tension = function(tension) {\n return custom(+tension);\n };\n\n return cardinal$$1;\n})(0);\n\nfunction point$4(that, x, y) {\n var x1 = that._x1,\n y1 = that._y1,\n x2 = that._x2,\n y2 = that._y2;\n\n if (that._l01_a > epsilon$3) {\n var a = 2 * that._l01_2a + 3 * that._l01_a * that._l12_a + that._l12_2a,\n n = 3 * that._l01_a * (that._l01_a + that._l12_a);\n x1 = (x1 * a - that._x0 * that._l12_2a + that._x2 * that._l01_2a) / n;\n y1 = (y1 * a - that._y0 * that._l12_2a + that._y2 * that._l01_2a) / n;\n }\n\n if (that._l23_a > epsilon$3) {\n var b = 2 * that._l23_2a + 3 * that._l23_a * that._l12_a + that._l12_2a,\n m = 3 * that._l23_a * (that._l23_a + that._l12_a);\n x2 = (x2 * b + that._x1 * that._l23_2a - x * that._l12_2a) / m;\n y2 = (y2 * b + that._y1 * that._l23_2a - y * that._l12_2a) / m;\n }\n\n that._context.bezierCurveTo(x1, y1, x2, y2, that._x2, that._y2);\n}\n\nfunction CatmullRom(context, alpha) {\n this._context = context;\n this._alpha = alpha;\n}\n\nCatmullRom.prototype = {\n areaStart: function() {\n this._line = 0;\n },\n areaEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._x0 = this._x1 = this._x2 =\n this._y0 = this._y1 = this._y2 = NaN;\n this._l01_a = this._l12_a = this._l23_a =\n this._l01_2a = this._l12_2a = this._l23_2a =\n this._point = 0;\n },\n lineEnd: function() {\n switch (this._point) {\n case 2: this._context.lineTo(this._x2, this._y2); break;\n case 3: this.point(this._x2, this._y2); break;\n }\n if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();\n this._line = 1 - this._line;\n },\n point: function(x, y) {\n x = +x, y = +y;\n\n if (this._point) {\n var x23 = this._x2 - x,\n y23 = this._y2 - y;\n this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha));\n }\n\n switch (this._point) {\n case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;\n case 1: this._point = 2; break;\n case 2: this._point = 3; // proceed\n default: point$4(this, x, y); break;\n }\n\n this._l01_a = this._l12_a, this._l12_a = this._l23_a;\n this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a;\n this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;\n this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;\n }\n};\n\nvar catmullRom = (function custom(alpha) {\n\n function catmullRom(context) {\n return alpha ? new CatmullRom(context, alpha) : new Cardinal(context, 0);\n }\n\n catmullRom.alpha = function(alpha) {\n return custom(+alpha);\n };\n\n return catmullRom;\n})(0.5);\n\nfunction CatmullRomClosed(context, alpha) {\n this._context = context;\n this._alpha = alpha;\n}\n\nCatmullRomClosed.prototype = {\n areaStart: noop$2,\n areaEnd: noop$2,\n lineStart: function() {\n this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._x5 =\n this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = this._y5 = NaN;\n this._l01_a = this._l12_a = this._l23_a =\n this._l01_2a = this._l12_2a = this._l23_2a =\n this._point = 0;\n },\n lineEnd: function() {\n switch (this._point) {\n case 1: {\n this._context.moveTo(this._x3, this._y3);\n this._context.closePath();\n break;\n }\n case 2: {\n this._context.lineTo(this._x3, this._y3);\n this._context.closePath();\n break;\n }\n case 3: {\n this.point(this._x3, this._y3);\n this.point(this._x4, this._y4);\n this.point(this._x5, this._y5);\n break;\n }\n }\n },\n point: function(x, y) {\n x = +x, y = +y;\n\n if (this._point) {\n var x23 = this._x2 - x,\n y23 = this._y2 - y;\n this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha));\n }\n\n switch (this._point) {\n case 0: this._point = 1; this._x3 = x, this._y3 = y; break;\n case 1: this._point = 2; this._context.moveTo(this._x4 = x, this._y4 = y); break;\n case 2: this._point = 3; this._x5 = x, this._y5 = y; break;\n default: point$4(this, x, y); break;\n }\n\n this._l01_a = this._l12_a, this._l12_a = this._l23_a;\n this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a;\n this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;\n this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;\n }\n};\n\nvar catmullRomClosed = (function custom(alpha) {\n\n function catmullRom$$1(context) {\n return alpha ? new CatmullRomClosed(context, alpha) : new CardinalClosed(context, 0);\n }\n\n catmullRom$$1.alpha = function(alpha) {\n return custom(+alpha);\n };\n\n return catmullRom$$1;\n})(0.5);\n\nfunction CatmullRomOpen(context, alpha) {\n this._context = context;\n this._alpha = alpha;\n}\n\nCatmullRomOpen.prototype = {\n areaStart: function() {\n this._line = 0;\n },\n areaEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._x0 = this._x1 = this._x2 =\n this._y0 = this._y1 = this._y2 = NaN;\n this._l01_a = this._l12_a = this._l23_a =\n this._l01_2a = this._l12_2a = this._l23_2a =\n this._point = 0;\n },\n lineEnd: function() {\n if (this._line || (this._line !== 0 && this._point === 3)) this._context.closePath();\n this._line = 1 - this._line;\n },\n point: function(x, y) {\n x = +x, y = +y;\n\n if (this._point) {\n var x23 = this._x2 - x,\n y23 = this._y2 - y;\n this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha));\n }\n\n switch (this._point) {\n case 0: this._point = 1; break;\n case 1: this._point = 2; break;\n case 2: this._point = 3; this._line ? this._context.lineTo(this._x2, this._y2) : this._context.moveTo(this._x2, this._y2); break;\n case 3: this._point = 4; // proceed\n default: point$4(this, x, y); break;\n }\n\n this._l01_a = this._l12_a, this._l12_a = this._l23_a;\n this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a;\n this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;\n this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;\n }\n};\n\nvar catmullRomOpen = (function custom(alpha) {\n\n function catmullRom$$1(context) {\n return alpha ? new CatmullRomOpen(context, alpha) : new CardinalOpen(context, 0);\n }\n\n catmullRom$$1.alpha = function(alpha) {\n return custom(+alpha);\n };\n\n return catmullRom$$1;\n})(0.5);\n\nfunction LinearClosed(context) {\n this._context = context;\n}\n\nLinearClosed.prototype = {\n areaStart: noop$2,\n areaEnd: noop$2,\n lineStart: function() {\n this._point = 0;\n },\n lineEnd: function() {\n if (this._point) this._context.closePath();\n },\n point: function(x, y) {\n x = +x, y = +y;\n if (this._point) this._context.lineTo(x, y);\n else this._point = 1, this._context.moveTo(x, y);\n }\n};\n\nvar linearClosed = function(context) {\n return new LinearClosed(context);\n};\n\nfunction sign$1(x) {\n return x < 0 ? -1 : 1;\n}\n\n// Calculate the slopes of the tangents (Hermite-type interpolation) based on\n// the following paper: Steffen, M. 1990. A Simple Method for Monotonic\n// Interpolation in One Dimension. Astronomy and Astrophysics, Vol. 239, NO.\n// NOV(II), P. 443, 1990.\nfunction slope3(that, x2, y2) {\n var h0 = that._x1 - that._x0,\n h1 = x2 - that._x1,\n s0 = (that._y1 - that._y0) / (h0 || h1 < 0 && -0),\n s1 = (y2 - that._y1) / (h1 || h0 < 0 && -0),\n p = (s0 * h1 + s1 * h0) / (h0 + h1);\n return (sign$1(s0) + sign$1(s1)) * Math.min(Math.abs(s0), Math.abs(s1), 0.5 * Math.abs(p)) || 0;\n}\n\n// Calculate a one-sided slope.\nfunction slope2(that, t) {\n var h = that._x1 - that._x0;\n return h ? (3 * (that._y1 - that._y0) / h - t) / 2 : t;\n}\n\n// According to https://en.wikipedia.org/wiki/Cubic_Hermite_spline#Representations\n// \"you can express cubic Hermite interpolation in terms of cubic Bézier curves\n// with respect to the four values p0, p0 + m0 / 3, p1 - m1 / 3, p1\".\nfunction point$5(that, t0, t1) {\n var x0 = that._x0,\n y0 = that._y0,\n x1 = that._x1,\n y1 = that._y1,\n dx = (x1 - x0) / 3;\n that._context.bezierCurveTo(x0 + dx, y0 + dx * t0, x1 - dx, y1 - dx * t1, x1, y1);\n}\n\nfunction MonotoneX(context) {\n this._context = context;\n}\n\nMonotoneX.prototype = {\n areaStart: function() {\n this._line = 0;\n },\n areaEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._x0 = this._x1 =\n this._y0 = this._y1 =\n this._t0 = NaN;\n this._point = 0;\n },\n lineEnd: function() {\n switch (this._point) {\n case 2: this._context.lineTo(this._x1, this._y1); break;\n case 3: point$5(this, this._t0, slope2(this, this._t0)); break;\n }\n if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();\n this._line = 1 - this._line;\n },\n point: function(x, y) {\n var t1 = NaN;\n\n x = +x, y = +y;\n if (x === this._x1 && y === this._y1) return; // Ignore coincident points.\n switch (this._point) {\n case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;\n case 1: this._point = 2; break;\n case 2: this._point = 3; point$5(this, slope2(this, t1 = slope3(this, x, y)), t1); break;\n default: point$5(this, this._t0, t1 = slope3(this, x, y)); break;\n }\n\n this._x0 = this._x1, this._x1 = x;\n this._y0 = this._y1, this._y1 = y;\n this._t0 = t1;\n }\n};\n\nfunction MonotoneY(context) {\n this._context = new ReflectContext(context);\n}\n\n(MonotoneY.prototype = Object.create(MonotoneX.prototype)).point = function(x, y) {\n MonotoneX.prototype.point.call(this, y, x);\n};\n\nfunction ReflectContext(context) {\n this._context = context;\n}\n\nReflectContext.prototype = {\n moveTo: function(x, y) { this._context.moveTo(y, x); },\n closePath: function() { this._context.closePath(); },\n lineTo: function(x, y) { this._context.lineTo(y, x); },\n bezierCurveTo: function(x1, y1, x2, y2, x, y) { this._context.bezierCurveTo(y1, x1, y2, x2, y, x); }\n};\n\nfunction monotoneX(context) {\n return new MonotoneX(context);\n}\n\nfunction monotoneY(context) {\n return new MonotoneY(context);\n}\n\nfunction Natural(context) {\n this._context = context;\n}\n\nNatural.prototype = {\n areaStart: function() {\n this._line = 0;\n },\n areaEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._x = [];\n this._y = [];\n },\n lineEnd: function() {\n var x = this._x,\n y = this._y,\n n = x.length;\n\n if (n) {\n this._line ? this._context.lineTo(x[0], y[0]) : this._context.moveTo(x[0], y[0]);\n if (n === 2) {\n this._context.lineTo(x[1], y[1]);\n } else {\n var px = controlPoints(x),\n py = controlPoints(y);\n for (var i0 = 0, i1 = 1; i1 < n; ++i0, ++i1) {\n this._context.bezierCurveTo(px[0][i0], py[0][i0], px[1][i0], py[1][i0], x[i1], y[i1]);\n }\n }\n }\n\n if (this._line || (this._line !== 0 && n === 1)) this._context.closePath();\n this._line = 1 - this._line;\n this._x = this._y = null;\n },\n point: function(x, y) {\n this._x.push(+x);\n this._y.push(+y);\n }\n};\n\n// See https://www.particleincell.com/2012/bezier-splines/ for derivation.\nfunction controlPoints(x) {\n var i,\n n = x.length - 1,\n m,\n a = new Array(n),\n b = new Array(n),\n r = new Array(n);\n a[0] = 0, b[0] = 2, r[0] = x[0] + 2 * x[1];\n for (i = 1; i < n - 1; ++i) a[i] = 1, b[i] = 4, r[i] = 4 * x[i] + 2 * x[i + 1];\n a[n - 1] = 2, b[n - 1] = 7, r[n - 1] = 8 * x[n - 1] + x[n];\n for (i = 1; i < n; ++i) m = a[i] / b[i - 1], b[i] -= m, r[i] -= m * r[i - 1];\n a[n - 1] = r[n - 1] / b[n - 1];\n for (i = n - 2; i >= 0; --i) a[i] = (r[i] - a[i + 1]) / b[i];\n b[n - 1] = (x[n] + a[n - 1]) / 2;\n for (i = 0; i < n - 1; ++i) b[i] = 2 * x[i + 1] - a[i + 1];\n return [a, b];\n}\n\nvar natural = function(context) {\n return new Natural(context);\n};\n\nfunction Step(context, t) {\n this._context = context;\n this._t = t;\n}\n\nStep.prototype = {\n areaStart: function() {\n this._line = 0;\n },\n areaEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._x = this._y = NaN;\n this._point = 0;\n },\n lineEnd: function() {\n if (0 < this._t && this._t < 1 && this._point === 2) this._context.lineTo(this._x, this._y);\n if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();\n if (this._line >= 0) this._t = 1 - this._t, this._line = 1 - this._line;\n },\n point: function(x, y) {\n x = +x, y = +y;\n switch (this._point) {\n case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;\n case 1: this._point = 2; // proceed\n default: {\n if (this._t <= 0) {\n this._context.lineTo(this._x, y);\n this._context.lineTo(x, y);\n } else {\n var x1 = this._x * (1 - this._t) + x * this._t;\n this._context.lineTo(x1, this._y);\n this._context.lineTo(x1, y);\n }\n break;\n }\n }\n this._x = x, this._y = y;\n }\n};\n\nvar step = function(context) {\n return new Step(context, 0.5);\n};\n\nfunction stepBefore(context) {\n return new Step(context, 0);\n}\n\nfunction stepAfter(context) {\n return new Step(context, 1);\n}\n\nvar none$1 = function(series, order) {\n if (!((n = series.length) > 1)) return;\n for (var i = 1, j, s0, s1 = series[order[0]], n, m = s1.length; i < n; ++i) {\n s0 = s1, s1 = series[order[i]];\n for (j = 0; j < m; ++j) {\n s1[j][1] += s1[j][0] = isNaN(s0[j][1]) ? s0[j][0] : s0[j][1];\n }\n }\n};\n\nvar none$2 = function(series) {\n var n = series.length, o = new Array(n);\n while (--n >= 0) o[n] = n;\n return o;\n};\n\nfunction stackValue(d, key) {\n return d[key];\n}\n\nvar stack = function() {\n var keys = constant$10([]),\n order = none$2,\n offset = none$1,\n value = stackValue;\n\n function stack(data) {\n var kz = keys.apply(this, arguments),\n i,\n m = data.length,\n n = kz.length,\n sz = new Array(n),\n oz;\n\n for (i = 0; i < n; ++i) {\n for (var ki = kz[i], si = sz[i] = new Array(m), j = 0, sij; j < m; ++j) {\n si[j] = sij = [0, +value(data[j], ki, j, data)];\n sij.data = data[j];\n }\n si.key = ki;\n }\n\n for (i = 0, oz = order(sz); i < n; ++i) {\n sz[oz[i]].index = i;\n }\n\n offset(sz, oz);\n return sz;\n }\n\n stack.keys = function(_) {\n return arguments.length ? (keys = typeof _ === \"function\" ? _ : constant$10(slice$6.call(_)), stack) : keys;\n };\n\n stack.value = function(_) {\n return arguments.length ? (value = typeof _ === \"function\" ? _ : constant$10(+_), stack) : value;\n };\n\n stack.order = function(_) {\n return arguments.length ? (order = _ == null ? none$2 : typeof _ === \"function\" ? _ : constant$10(slice$6.call(_)), stack) : order;\n };\n\n stack.offset = function(_) {\n return arguments.length ? (offset = _ == null ? none$1 : _, stack) : offset;\n };\n\n return stack;\n};\n\nvar expand = function(series, order) {\n if (!((n = series.length) > 0)) return;\n for (var i, n, j = 0, m = series[0].length, y; j < m; ++j) {\n for (y = i = 0; i < n; ++i) y += series[i][j][1] || 0;\n if (y) for (i = 0; i < n; ++i) series[i][j][1] /= y;\n }\n none$1(series, order);\n};\n\nvar diverging = function(series, order) {\n if (!((n = series.length) > 1)) return;\n for (var i, j = 0, d, dy, yp, yn, n, m = series[order[0]].length; j < m; ++j) {\n for (yp = yn = 0, i = 0; i < n; ++i) {\n if ((dy = (d = series[order[i]][j])[1] - d[0]) >= 0) {\n d[0] = yp, d[1] = yp += dy;\n } else if (dy < 0) {\n d[1] = yn, d[0] = yn += dy;\n } else {\n d[0] = yp;\n }\n }\n }\n};\n\nvar silhouette = function(series, order) {\n if (!((n = series.length) > 0)) return;\n for (var j = 0, s0 = series[order[0]], n, m = s0.length; j < m; ++j) {\n for (var i = 0, y = 0; i < n; ++i) y += series[i][j][1] || 0;\n s0[j][1] += s0[j][0] = -y / 2;\n }\n none$1(series, order);\n};\n\nvar wiggle = function(series, order) {\n if (!((n = series.length) > 0) || !((m = (s0 = series[order[0]]).length) > 0)) return;\n for (var y = 0, j = 1, s0, m, n; j < m; ++j) {\n for (var i = 0, s1 = 0, s2 = 0; i < n; ++i) {\n var si = series[order[i]],\n sij0 = si[j][1] || 0,\n sij1 = si[j - 1][1] || 0,\n s3 = (sij0 - sij1) / 2;\n for (var k = 0; k < i; ++k) {\n var sk = series[order[k]],\n skj0 = sk[j][1] || 0,\n skj1 = sk[j - 1][1] || 0;\n s3 += skj0 - skj1;\n }\n s1 += sij0, s2 += s3 * sij0;\n }\n s0[j - 1][1] += s0[j - 1][0] = y;\n if (s1) y -= s2 / s1;\n }\n s0[j - 1][1] += s0[j - 1][0] = y;\n none$1(series, order);\n};\n\nvar ascending$2 = function(series) {\n var sums = series.map(sum$2);\n return none$2(series).sort(function(a, b) { return sums[a] - sums[b]; });\n};\n\nfunction sum$2(series) {\n var s = 0, i = -1, n = series.length, v;\n while (++i < n) if (v = +series[i][1]) s += v;\n return s;\n}\n\nvar descending$2 = function(series) {\n return ascending$2(series).reverse();\n};\n\nvar insideOut = function(series) {\n var n = series.length,\n i,\n j,\n sums = series.map(sum$2),\n order = none$2(series).sort(function(a, b) { return sums[b] - sums[a]; }),\n top = 0,\n bottom = 0,\n tops = [],\n bottoms = [];\n\n for (i = 0; i < n; ++i) {\n j = order[i];\n if (top < bottom) {\n top += sums[j];\n tops.push(j);\n } else {\n bottom += sums[j];\n bottoms.push(j);\n }\n }\n\n return bottoms.reverse().concat(tops);\n};\n\nvar reverse = function(series) {\n return none$2(series).reverse();\n};\n\nvar constant$11 = function(x) {\n return function() {\n return x;\n };\n};\n\nfunction x$4(d) {\n return d[0];\n}\n\nfunction y$4(d) {\n return d[1];\n}\n\nfunction RedBlackTree() {\n this._ = null; // root node\n}\n\nfunction RedBlackNode(node) {\n node.U = // parent node\n node.C = // color - true for red, false for black\n node.L = // left node\n node.R = // right node\n node.P = // previous node\n node.N = null; // next node\n}\n\nRedBlackTree.prototype = {\n constructor: RedBlackTree,\n\n insert: function(after, node) {\n var parent, grandpa, uncle;\n\n if (after) {\n node.P = after;\n node.N = after.N;\n if (after.N) after.N.P = node;\n after.N = node;\n if (after.R) {\n after = after.R;\n while (after.L) after = after.L;\n after.L = node;\n } else {\n after.R = node;\n }\n parent = after;\n } else if (this._) {\n after = RedBlackFirst(this._);\n node.P = null;\n node.N = after;\n after.P = after.L = node;\n parent = after;\n } else {\n node.P = node.N = null;\n this._ = node;\n parent = null;\n }\n node.L = node.R = null;\n node.U = parent;\n node.C = true;\n\n after = node;\n while (parent && parent.C) {\n grandpa = parent.U;\n if (parent === grandpa.L) {\n uncle = grandpa.R;\n if (uncle && uncle.C) {\n parent.C = uncle.C = false;\n grandpa.C = true;\n after = grandpa;\n } else {\n if (after === parent.R) {\n RedBlackRotateLeft(this, parent);\n after = parent;\n parent = after.U;\n }\n parent.C = false;\n grandpa.C = true;\n RedBlackRotateRight(this, grandpa);\n }\n } else {\n uncle = grandpa.L;\n if (uncle && uncle.C) {\n parent.C = uncle.C = false;\n grandpa.C = true;\n after = grandpa;\n } else {\n if (after === parent.L) {\n RedBlackRotateRight(this, parent);\n after = parent;\n parent = after.U;\n }\n parent.C = false;\n grandpa.C = true;\n RedBlackRotateLeft(this, grandpa);\n }\n }\n parent = after.U;\n }\n this._.C = false;\n },\n\n remove: function(node) {\n if (node.N) node.N.P = node.P;\n if (node.P) node.P.N = node.N;\n node.N = node.P = null;\n\n var parent = node.U,\n sibling,\n left = node.L,\n right = node.R,\n next,\n red;\n\n if (!left) next = right;\n else if (!right) next = left;\n else next = RedBlackFirst(right);\n\n if (parent) {\n if (parent.L === node) parent.L = next;\n else parent.R = next;\n } else {\n this._ = next;\n }\n\n if (left && right) {\n red = next.C;\n next.C = node.C;\n next.L = left;\n left.U = next;\n if (next !== right) {\n parent = next.U;\n next.U = node.U;\n node = next.R;\n parent.L = node;\n next.R = right;\n right.U = next;\n } else {\n next.U = parent;\n parent = next;\n node = next.R;\n }\n } else {\n red = node.C;\n node = next;\n }\n\n if (node) node.U = parent;\n if (red) return;\n if (node && node.C) { node.C = false; return; }\n\n do {\n if (node === this._) break;\n if (node === parent.L) {\n sibling = parent.R;\n if (sibling.C) {\n sibling.C = false;\n parent.C = true;\n RedBlackRotateLeft(this, parent);\n sibling = parent.R;\n }\n if ((sibling.L && sibling.L.C)\n || (sibling.R && sibling.R.C)) {\n if (!sibling.R || !sibling.R.C) {\n sibling.L.C = false;\n sibling.C = true;\n RedBlackRotateRight(this, sibling);\n sibling = parent.R;\n }\n sibling.C = parent.C;\n parent.C = sibling.R.C = false;\n RedBlackRotateLeft(this, parent);\n node = this._;\n break;\n }\n } else {\n sibling = parent.L;\n if (sibling.C) {\n sibling.C = false;\n parent.C = true;\n RedBlackRotateRight(this, parent);\n sibling = parent.L;\n }\n if ((sibling.L && sibling.L.C)\n || (sibling.R && sibling.R.C)) {\n if (!sibling.L || !sibling.L.C) {\n sibling.R.C = false;\n sibling.C = true;\n RedBlackRotateLeft(this, sibling);\n sibling = parent.L;\n }\n sibling.C = parent.C;\n parent.C = sibling.L.C = false;\n RedBlackRotateRight(this, parent);\n node = this._;\n break;\n }\n }\n sibling.C = true;\n node = parent;\n parent = parent.U;\n } while (!node.C);\n\n if (node) node.C = false;\n }\n};\n\nfunction RedBlackRotateLeft(tree, node) {\n var p = node,\n q = node.R,\n parent = p.U;\n\n if (parent) {\n if (parent.L === p) parent.L = q;\n else parent.R = q;\n } else {\n tree._ = q;\n }\n\n q.U = parent;\n p.U = q;\n p.R = q.L;\n if (p.R) p.R.U = p;\n q.L = p;\n}\n\nfunction RedBlackRotateRight(tree, node) {\n var p = node,\n q = node.L,\n parent = p.U;\n\n if (parent) {\n if (parent.L === p) parent.L = q;\n else parent.R = q;\n } else {\n tree._ = q;\n }\n\n q.U = parent;\n p.U = q;\n p.L = q.R;\n if (p.L) p.L.U = p;\n q.R = p;\n}\n\nfunction RedBlackFirst(node) {\n while (node.L) node = node.L;\n return node;\n}\n\nfunction createEdge(left, right, v0, v1) {\n var edge = [null, null],\n index = edges.push(edge) - 1;\n edge.left = left;\n edge.right = right;\n if (v0) setEdgeEnd(edge, left, right, v0);\n if (v1) setEdgeEnd(edge, right, left, v1);\n cells[left.index].halfedges.push(index);\n cells[right.index].halfedges.push(index);\n return edge;\n}\n\nfunction createBorderEdge(left, v0, v1) {\n var edge = [v0, v1];\n edge.left = left;\n return edge;\n}\n\nfunction setEdgeEnd(edge, left, right, vertex) {\n if (!edge[0] && !edge[1]) {\n edge[0] = vertex;\n edge.left = left;\n edge.right = right;\n } else if (edge.left === right) {\n edge[1] = vertex;\n } else {\n edge[0] = vertex;\n }\n}\n\n// Liang–Barsky line clipping.\nfunction clipEdge(edge, x0, y0, x1, y1) {\n var a = edge[0],\n b = edge[1],\n ax = a[0],\n ay = a[1],\n bx = b[0],\n by = b[1],\n t0 = 0,\n t1 = 1,\n dx = bx - ax,\n dy = by - ay,\n r;\n\n r = x0 - ax;\n if (!dx && r > 0) return;\n r /= dx;\n if (dx < 0) {\n if (r < t0) return;\n if (r < t1) t1 = r;\n } else if (dx > 0) {\n if (r > t1) return;\n if (r > t0) t0 = r;\n }\n\n r = x1 - ax;\n if (!dx && r < 0) return;\n r /= dx;\n if (dx < 0) {\n if (r > t1) return;\n if (r > t0) t0 = r;\n } else if (dx > 0) {\n if (r < t0) return;\n if (r < t1) t1 = r;\n }\n\n r = y0 - ay;\n if (!dy && r > 0) return;\n r /= dy;\n if (dy < 0) {\n if (r < t0) return;\n if (r < t1) t1 = r;\n } else if (dy > 0) {\n if (r > t1) return;\n if (r > t0) t0 = r;\n }\n\n r = y1 - ay;\n if (!dy && r < 0) return;\n r /= dy;\n if (dy < 0) {\n if (r > t1) return;\n if (r > t0) t0 = r;\n } else if (dy > 0) {\n if (r < t0) return;\n if (r < t1) t1 = r;\n }\n\n if (!(t0 > 0) && !(t1 < 1)) return true; // TODO Better check?\n\n if (t0 > 0) edge[0] = [ax + t0 * dx, ay + t0 * dy];\n if (t1 < 1) edge[1] = [ax + t1 * dx, ay + t1 * dy];\n return true;\n}\n\nfunction connectEdge(edge, x0, y0, x1, y1) {\n var v1 = edge[1];\n if (v1) return true;\n\n var v0 = edge[0],\n left = edge.left,\n right = edge.right,\n lx = left[0],\n ly = left[1],\n rx = right[0],\n ry = right[1],\n fx = (lx + rx) / 2,\n fy = (ly + ry) / 2,\n fm,\n fb;\n\n if (ry === ly) {\n if (fx < x0 || fx >= x1) return;\n if (lx > rx) {\n if (!v0) v0 = [fx, y0];\n else if (v0[1] >= y1) return;\n v1 = [fx, y1];\n } else {\n if (!v0) v0 = [fx, y1];\n else if (v0[1] < y0) return;\n v1 = [fx, y0];\n }\n } else {\n fm = (lx - rx) / (ry - ly);\n fb = fy - fm * fx;\n if (fm < -1 || fm > 1) {\n if (lx > rx) {\n if (!v0) v0 = [(y0 - fb) / fm, y0];\n else if (v0[1] >= y1) return;\n v1 = [(y1 - fb) / fm, y1];\n } else {\n if (!v0) v0 = [(y1 - fb) / fm, y1];\n else if (v0[1] < y0) return;\n v1 = [(y0 - fb) / fm, y0];\n }\n } else {\n if (ly < ry) {\n if (!v0) v0 = [x0, fm * x0 + fb];\n else if (v0[0] >= x1) return;\n v1 = [x1, fm * x1 + fb];\n } else {\n if (!v0) v0 = [x1, fm * x1 + fb];\n else if (v0[0] < x0) return;\n v1 = [x0, fm * x0 + fb];\n }\n }\n }\n\n edge[0] = v0;\n edge[1] = v1;\n return true;\n}\n\nfunction clipEdges(x0, y0, x1, y1) {\n var i = edges.length,\n edge;\n\n while (i--) {\n if (!connectEdge(edge = edges[i], x0, y0, x1, y1)\n || !clipEdge(edge, x0, y0, x1, y1)\n || !(Math.abs(edge[0][0] - edge[1][0]) > epsilon$4\n || Math.abs(edge[0][1] - edge[1][1]) > epsilon$4)) {\n delete edges[i];\n }\n }\n}\n\nfunction createCell(site) {\n return cells[site.index] = {\n site: site,\n halfedges: []\n };\n}\n\nfunction cellHalfedgeAngle(cell, edge) {\n var site = cell.site,\n va = edge.left,\n vb = edge.right;\n if (site === vb) vb = va, va = site;\n if (vb) return Math.atan2(vb[1] - va[1], vb[0] - va[0]);\n if (site === va) va = edge[1], vb = edge[0];\n else va = edge[0], vb = edge[1];\n return Math.atan2(va[0] - vb[0], vb[1] - va[1]);\n}\n\nfunction cellHalfedgeStart(cell, edge) {\n return edge[+(edge.left !== cell.site)];\n}\n\nfunction cellHalfedgeEnd(cell, edge) {\n return edge[+(edge.left === cell.site)];\n}\n\nfunction sortCellHalfedges() {\n for (var i = 0, n = cells.length, cell, halfedges, j, m; i < n; ++i) {\n if ((cell = cells[i]) && (m = (halfedges = cell.halfedges).length)) {\n var index = new Array(m),\n array = new Array(m);\n for (j = 0; j < m; ++j) index[j] = j, array[j] = cellHalfedgeAngle(cell, edges[halfedges[j]]);\n index.sort(function(i, j) { return array[j] - array[i]; });\n for (j = 0; j < m; ++j) array[j] = halfedges[index[j]];\n for (j = 0; j < m; ++j) halfedges[j] = array[j];\n }\n }\n}\n\nfunction clipCells(x0, y0, x1, y1) {\n var nCells = cells.length,\n iCell,\n cell,\n site,\n iHalfedge,\n halfedges,\n nHalfedges,\n start,\n startX,\n startY,\n end,\n endX,\n endY,\n cover = true;\n\n for (iCell = 0; iCell < nCells; ++iCell) {\n if (cell = cells[iCell]) {\n site = cell.site;\n halfedges = cell.halfedges;\n iHalfedge = halfedges.length;\n\n // Remove any dangling clipped edges.\n while (iHalfedge--) {\n if (!edges[halfedges[iHalfedge]]) {\n halfedges.splice(iHalfedge, 1);\n }\n }\n\n // Insert any border edges as necessary.\n iHalfedge = 0, nHalfedges = halfedges.length;\n while (iHalfedge < nHalfedges) {\n end = cellHalfedgeEnd(cell, edges[halfedges[iHalfedge]]), endX = end[0], endY = end[1];\n start = cellHalfedgeStart(cell, edges[halfedges[++iHalfedge % nHalfedges]]), startX = start[0], startY = start[1];\n if (Math.abs(endX - startX) > epsilon$4 || Math.abs(endY - startY) > epsilon$4) {\n halfedges.splice(iHalfedge, 0, edges.push(createBorderEdge(site, end,\n Math.abs(endX - x0) < epsilon$4 && y1 - endY > epsilon$4 ? [x0, Math.abs(startX - x0) < epsilon$4 ? startY : y1]\n : Math.abs(endY - y1) < epsilon$4 && x1 - endX > epsilon$4 ? [Math.abs(startY - y1) < epsilon$4 ? startX : x1, y1]\n : Math.abs(endX - x1) < epsilon$4 && endY - y0 > epsilon$4 ? [x1, Math.abs(startX - x1) < epsilon$4 ? startY : y0]\n : Math.abs(endY - y0) < epsilon$4 && endX - x0 > epsilon$4 ? [Math.abs(startY - y0) < epsilon$4 ? startX : x0, y0]\n : null)) - 1);\n ++nHalfedges;\n }\n }\n\n if (nHalfedges) cover = false;\n }\n }\n\n // If there weren’t any edges, have the closest site cover the extent.\n // It doesn’t matter which corner of the extent we measure!\n if (cover) {\n var dx, dy, d2, dc = Infinity;\n\n for (iCell = 0, cover = null; iCell < nCells; ++iCell) {\n if (cell = cells[iCell]) {\n site = cell.site;\n dx = site[0] - x0;\n dy = site[1] - y0;\n d2 = dx * dx + dy * dy;\n if (d2 < dc) dc = d2, cover = cell;\n }\n }\n\n if (cover) {\n var v00 = [x0, y0], v01 = [x0, y1], v11 = [x1, y1], v10 = [x1, y0];\n cover.halfedges.push(\n edges.push(createBorderEdge(site = cover.site, v00, v01)) - 1,\n edges.push(createBorderEdge(site, v01, v11)) - 1,\n edges.push(createBorderEdge(site, v11, v10)) - 1,\n edges.push(createBorderEdge(site, v10, v00)) - 1\n );\n }\n }\n\n // Lastly delete any cells with no edges; these were entirely clipped.\n for (iCell = 0; iCell < nCells; ++iCell) {\n if (cell = cells[iCell]) {\n if (!cell.halfedges.length) {\n delete cells[iCell];\n }\n }\n }\n}\n\nvar circlePool = [];\n\nvar firstCircle;\n\nfunction Circle() {\n RedBlackNode(this);\n this.x =\n this.y =\n this.arc =\n this.site =\n this.cy = null;\n}\n\nfunction attachCircle(arc) {\n var lArc = arc.P,\n rArc = arc.N;\n\n if (!lArc || !rArc) return;\n\n var lSite = lArc.site,\n cSite = arc.site,\n rSite = rArc.site;\n\n if (lSite === rSite) return;\n\n var bx = cSite[0],\n by = cSite[1],\n ax = lSite[0] - bx,\n ay = lSite[1] - by,\n cx = rSite[0] - bx,\n cy = rSite[1] - by;\n\n var d = 2 * (ax * cy - ay * cx);\n if (d >= -epsilon2$2) return;\n\n var ha = ax * ax + ay * ay,\n hc = cx * cx + cy * cy,\n x = (cy * ha - ay * hc) / d,\n y = (ax * hc - cx * ha) / d;\n\n var circle = circlePool.pop() || new Circle;\n circle.arc = arc;\n circle.site = cSite;\n circle.x = x + bx;\n circle.y = (circle.cy = y + by) + Math.sqrt(x * x + y * y); // y bottom\n\n arc.circle = circle;\n\n var before = null,\n node = circles._;\n\n while (node) {\n if (circle.y < node.y || (circle.y === node.y && circle.x <= node.x)) {\n if (node.L) node = node.L;\n else { before = node.P; break; }\n } else {\n if (node.R) node = node.R;\n else { before = node; break; }\n }\n }\n\n circles.insert(before, circle);\n if (!before) firstCircle = circle;\n}\n\nfunction detachCircle(arc) {\n var circle = arc.circle;\n if (circle) {\n if (!circle.P) firstCircle = circle.N;\n circles.remove(circle);\n circlePool.push(circle);\n RedBlackNode(circle);\n arc.circle = null;\n }\n}\n\nvar beachPool = [];\n\nfunction Beach() {\n RedBlackNode(this);\n this.edge =\n this.site =\n this.circle = null;\n}\n\nfunction createBeach(site) {\n var beach = beachPool.pop() || new Beach;\n beach.site = site;\n return beach;\n}\n\nfunction detachBeach(beach) {\n detachCircle(beach);\n beaches.remove(beach);\n beachPool.push(beach);\n RedBlackNode(beach);\n}\n\nfunction removeBeach(beach) {\n var circle = beach.circle,\n x = circle.x,\n y = circle.cy,\n vertex = [x, y],\n previous = beach.P,\n next = beach.N,\n disappearing = [beach];\n\n detachBeach(beach);\n\n var lArc = previous;\n while (lArc.circle\n && Math.abs(x - lArc.circle.x) < epsilon$4\n && Math.abs(y - lArc.circle.cy) < epsilon$4) {\n previous = lArc.P;\n disappearing.unshift(lArc);\n detachBeach(lArc);\n lArc = previous;\n }\n\n disappearing.unshift(lArc);\n detachCircle(lArc);\n\n var rArc = next;\n while (rArc.circle\n && Math.abs(x - rArc.circle.x) < epsilon$4\n && Math.abs(y - rArc.circle.cy) < epsilon$4) {\n next = rArc.N;\n disappearing.push(rArc);\n detachBeach(rArc);\n rArc = next;\n }\n\n disappearing.push(rArc);\n detachCircle(rArc);\n\n var nArcs = disappearing.length,\n iArc;\n for (iArc = 1; iArc < nArcs; ++iArc) {\n rArc = disappearing[iArc];\n lArc = disappearing[iArc - 1];\n setEdgeEnd(rArc.edge, lArc.site, rArc.site, vertex);\n }\n\n lArc = disappearing[0];\n rArc = disappearing[nArcs - 1];\n rArc.edge = createEdge(lArc.site, rArc.site, null, vertex);\n\n attachCircle(lArc);\n attachCircle(rArc);\n}\n\nfunction addBeach(site) {\n var x = site[0],\n directrix = site[1],\n lArc,\n rArc,\n dxl,\n dxr,\n node = beaches._;\n\n while (node) {\n dxl = leftBreakPoint(node, directrix) - x;\n if (dxl > epsilon$4) node = node.L; else {\n dxr = x - rightBreakPoint(node, directrix);\n if (dxr > epsilon$4) {\n if (!node.R) {\n lArc = node;\n break;\n }\n node = node.R;\n } else {\n if (dxl > -epsilon$4) {\n lArc = node.P;\n rArc = node;\n } else if (dxr > -epsilon$4) {\n lArc = node;\n rArc = node.N;\n } else {\n lArc = rArc = node;\n }\n break;\n }\n }\n }\n\n createCell(site);\n var newArc = createBeach(site);\n beaches.insert(lArc, newArc);\n\n if (!lArc && !rArc) return;\n\n if (lArc === rArc) {\n detachCircle(lArc);\n rArc = createBeach(lArc.site);\n beaches.insert(newArc, rArc);\n newArc.edge = rArc.edge = createEdge(lArc.site, newArc.site);\n attachCircle(lArc);\n attachCircle(rArc);\n return;\n }\n\n if (!rArc) { // && lArc\n newArc.edge = createEdge(lArc.site, newArc.site);\n return;\n }\n\n // else lArc !== rArc\n detachCircle(lArc);\n detachCircle(rArc);\n\n var lSite = lArc.site,\n ax = lSite[0],\n ay = lSite[1],\n bx = site[0] - ax,\n by = site[1] - ay,\n rSite = rArc.site,\n cx = rSite[0] - ax,\n cy = rSite[1] - ay,\n d = 2 * (bx * cy - by * cx),\n hb = bx * bx + by * by,\n hc = cx * cx + cy * cy,\n vertex = [(cy * hb - by * hc) / d + ax, (bx * hc - cx * hb) / d + ay];\n\n setEdgeEnd(rArc.edge, lSite, rSite, vertex);\n newArc.edge = createEdge(lSite, site, null, vertex);\n rArc.edge = createEdge(site, rSite, null, vertex);\n attachCircle(lArc);\n attachCircle(rArc);\n}\n\nfunction leftBreakPoint(arc, directrix) {\n var site = arc.site,\n rfocx = site[0],\n rfocy = site[1],\n pby2 = rfocy - directrix;\n\n if (!pby2) return rfocx;\n\n var lArc = arc.P;\n if (!lArc) return -Infinity;\n\n site = lArc.site;\n var lfocx = site[0],\n lfocy = site[1],\n plby2 = lfocy - directrix;\n\n if (!plby2) return lfocx;\n\n var hl = lfocx - rfocx,\n aby2 = 1 / pby2 - 1 / plby2,\n b = hl / plby2;\n\n if (aby2) return (-b + Math.sqrt(b * b - 2 * aby2 * (hl * hl / (-2 * plby2) - lfocy + plby2 / 2 + rfocy - pby2 / 2))) / aby2 + rfocx;\n\n return (rfocx + lfocx) / 2;\n}\n\nfunction rightBreakPoint(arc, directrix) {\n var rArc = arc.N;\n if (rArc) return leftBreakPoint(rArc, directrix);\n var site = arc.site;\n return site[1] === directrix ? site[0] : Infinity;\n}\n\nvar epsilon$4 = 1e-6;\nvar epsilon2$2 = 1e-12;\nvar beaches;\nvar cells;\nvar circles;\nvar edges;\n\nfunction triangleArea(a, b, c) {\n return (a[0] - c[0]) * (b[1] - a[1]) - (a[0] - b[0]) * (c[1] - a[1]);\n}\n\nfunction lexicographic(a, b) {\n return b[1] - a[1]\n || b[0] - a[0];\n}\n\nfunction Diagram(sites, extent) {\n var site = sites.sort(lexicographic).pop(),\n x,\n y,\n circle;\n\n edges = [];\n cells = new Array(sites.length);\n beaches = new RedBlackTree;\n circles = new RedBlackTree;\n\n while (true) {\n circle = firstCircle;\n if (site && (!circle || site[1] < circle.y || (site[1] === circle.y && site[0] < circle.x))) {\n if (site[0] !== x || site[1] !== y) {\n addBeach(site);\n x = site[0], y = site[1];\n }\n site = sites.pop();\n } else if (circle) {\n removeBeach(circle.arc);\n } else {\n break;\n }\n }\n\n sortCellHalfedges();\n\n if (extent) {\n var x0 = +extent[0][0],\n y0 = +extent[0][1],\n x1 = +extent[1][0],\n y1 = +extent[1][1];\n clipEdges(x0, y0, x1, y1);\n clipCells(x0, y0, x1, y1);\n }\n\n this.edges = edges;\n this.cells = cells;\n\n beaches =\n circles =\n edges =\n cells = null;\n}\n\nDiagram.prototype = {\n constructor: Diagram,\n\n polygons: function() {\n var edges = this.edges;\n\n return this.cells.map(function(cell) {\n var polygon = cell.halfedges.map(function(i) { return cellHalfedgeStart(cell, edges[i]); });\n polygon.data = cell.site.data;\n return polygon;\n });\n },\n\n triangles: function() {\n var triangles = [],\n edges = this.edges;\n\n this.cells.forEach(function(cell, i) {\n if (!(m = (halfedges = cell.halfedges).length)) return;\n var site = cell.site,\n halfedges,\n j = -1,\n m,\n s0,\n e1 = edges[halfedges[m - 1]],\n s1 = e1.left === site ? e1.right : e1.left;\n\n while (++j < m) {\n s0 = s1;\n e1 = edges[halfedges[j]];\n s1 = e1.left === site ? e1.right : e1.left;\n if (s0 && s1 && i < s0.index && i < s1.index && triangleArea(site, s0, s1) < 0) {\n triangles.push([site.data, s0.data, s1.data]);\n }\n }\n });\n\n return triangles;\n },\n\n links: function() {\n return this.edges.filter(function(edge) {\n return edge.right;\n }).map(function(edge) {\n return {\n source: edge.left.data,\n target: edge.right.data\n };\n });\n },\n\n find: function(x, y, radius) {\n var that = this, i0, i1 = that._found || 0, n = that.cells.length, cell;\n\n // Use the previously-found cell, or start with an arbitrary one.\n while (!(cell = that.cells[i1])) if (++i1 >= n) return null;\n var dx = x - cell.site[0], dy = y - cell.site[1], d2 = dx * dx + dy * dy;\n\n // Traverse the half-edges to find a closer cell, if any.\n do {\n cell = that.cells[i0 = i1], i1 = null;\n cell.halfedges.forEach(function(e) {\n var edge = that.edges[e], v = edge.left;\n if ((v === cell.site || !v) && !(v = edge.right)) return;\n var vx = x - v[0], vy = y - v[1], v2 = vx * vx + vy * vy;\n if (v2 < d2) d2 = v2, i1 = v.index;\n });\n } while (i1 !== null);\n\n that._found = i0;\n\n return radius == null || d2 <= radius * radius ? cell.site : null;\n }\n};\n\nvar voronoi = function() {\n var x$$1 = x$4,\n y$$1 = y$4,\n extent = null;\n\n function voronoi(data) {\n return new Diagram(data.map(function(d, i) {\n var s = [Math.round(x$$1(d, i, data) / epsilon$4) * epsilon$4, Math.round(y$$1(d, i, data) / epsilon$4) * epsilon$4];\n s.index = i;\n s.data = d;\n return s;\n }), extent);\n }\n\n voronoi.polygons = function(data) {\n return voronoi(data).polygons();\n };\n\n voronoi.links = function(data) {\n return voronoi(data).links();\n };\n\n voronoi.triangles = function(data) {\n return voronoi(data).triangles();\n };\n\n voronoi.x = function(_) {\n return arguments.length ? (x$$1 = typeof _ === \"function\" ? _ : constant$11(+_), voronoi) : x$$1;\n };\n\n voronoi.y = function(_) {\n return arguments.length ? (y$$1 = typeof _ === \"function\" ? _ : constant$11(+_), voronoi) : y$$1;\n };\n\n voronoi.extent = function(_) {\n return arguments.length ? (extent = _ == null ? null : [[+_[0][0], +_[0][1]], [+_[1][0], +_[1][1]]], voronoi) : extent && [[extent[0][0], extent[0][1]], [extent[1][0], extent[1][1]]];\n };\n\n voronoi.size = function(_) {\n return arguments.length ? (extent = _ == null ? null : [[0, 0], [+_[0], +_[1]]], voronoi) : extent && [extent[1][0] - extent[0][0], extent[1][1] - extent[0][1]];\n };\n\n return voronoi;\n};\n\nvar constant$12 = function(x) {\n return function() {\n return x;\n };\n};\n\nfunction ZoomEvent(target, type, transform) {\n this.target = target;\n this.type = type;\n this.transform = transform;\n}\n\nfunction Transform(k, x, y) {\n this.k = k;\n this.x = x;\n this.y = y;\n}\n\nTransform.prototype = {\n constructor: Transform,\n scale: function(k) {\n return k === 1 ? this : new Transform(this.k * k, this.x, this.y);\n },\n translate: function(x, y) {\n return x === 0 & y === 0 ? this : new Transform(this.k, this.x + this.k * x, this.y + this.k * y);\n },\n apply: function(point) {\n return [point[0] * this.k + this.x, point[1] * this.k + this.y];\n },\n applyX: function(x) {\n return x * this.k + this.x;\n },\n applyY: function(y) {\n return y * this.k + this.y;\n },\n invert: function(location) {\n return [(location[0] - this.x) / this.k, (location[1] - this.y) / this.k];\n },\n invertX: function(x) {\n return (x - this.x) / this.k;\n },\n invertY: function(y) {\n return (y - this.y) / this.k;\n },\n rescaleX: function(x) {\n return x.copy().domain(x.range().map(this.invertX, this).map(x.invert, x));\n },\n rescaleY: function(y) {\n return y.copy().domain(y.range().map(this.invertY, this).map(y.invert, y));\n },\n toString: function() {\n return \"translate(\" + this.x + \",\" + this.y + \") scale(\" + this.k + \")\";\n }\n};\n\nvar identity$8 = new Transform(1, 0, 0);\n\ntransform$1.prototype = Transform.prototype;\n\nfunction transform$1(node) {\n return node.__zoom || identity$8;\n}\n\nfunction nopropagation$2() {\n exports.event.stopImmediatePropagation();\n}\n\nvar noevent$2 = function() {\n exports.event.preventDefault();\n exports.event.stopImmediatePropagation();\n};\n\n// Ignore right-click, since that should open the context menu.\nfunction defaultFilter$2() {\n return !exports.event.button;\n}\n\nfunction defaultExtent$1() {\n var e = this, w, h;\n if (e instanceof SVGElement) {\n e = e.ownerSVGElement || e;\n w = e.width.baseVal.value;\n h = e.height.baseVal.value;\n } else {\n w = e.clientWidth;\n h = e.clientHeight;\n }\n return [[0, 0], [w, h]];\n}\n\nfunction defaultTransform() {\n return this.__zoom || identity$8;\n}\n\nfunction defaultWheelDelta() {\n return -exports.event.deltaY * (exports.event.deltaMode ? 120 : 1) / 500;\n}\n\nfunction defaultTouchable$1() {\n return \"ontouchstart\" in this;\n}\n\nvar zoom = function() {\n var filter = defaultFilter$2,\n extent = defaultExtent$1,\n wheelDelta = defaultWheelDelta,\n touchable = defaultTouchable$1,\n k0 = 0,\n k1 = Infinity,\n x0 = -k1,\n x1 = k1,\n y0 = x0,\n y1 = x1,\n duration = 250,\n interpolate = interpolateZoom,\n gestures = [],\n listeners = dispatch(\"start\", \"zoom\", \"end\"),\n touchstarting,\n touchending,\n touchDelay = 500,\n wheelDelay = 150,\n clickDistance2 = 0;\n\n function zoom(selection) {\n selection\n .property(\"__zoom\", defaultTransform)\n .on(\"wheel.zoom\", wheeled)\n .on(\"mousedown.zoom\", mousedowned)\n .on(\"dblclick.zoom\", dblclicked)\n .filter(touchable)\n .on(\"touchstart.zoom\", touchstarted)\n .on(\"touchmove.zoom\", touchmoved)\n .on(\"touchend.zoom touchcancel.zoom\", touchended)\n .style(\"touch-action\", \"none\")\n .style(\"-webkit-tap-highlight-color\", \"rgba(0,0,0,0)\");\n }\n\n zoom.transform = function(collection, transform$$1) {\n var selection = collection.selection ? collection.selection() : collection;\n selection.property(\"__zoom\", defaultTransform);\n if (collection !== selection) {\n schedule(collection, transform$$1);\n } else {\n selection.interrupt().each(function() {\n gesture(this, arguments)\n .start()\n .zoom(null, typeof transform$$1 === \"function\" ? transform$$1.apply(this, arguments) : transform$$1)\n .end();\n });\n }\n };\n\n zoom.scaleBy = function(selection, k) {\n zoom.scaleTo(selection, function() {\n var k0 = this.__zoom.k,\n k1 = typeof k === \"function\" ? k.apply(this, arguments) : k;\n return k0 * k1;\n });\n };\n\n zoom.scaleTo = function(selection, k) {\n zoom.transform(selection, function() {\n var e = extent.apply(this, arguments),\n t0 = this.__zoom,\n p0 = centroid(e),\n p1 = t0.invert(p0),\n k1 = typeof k === \"function\" ? k.apply(this, arguments) : k;\n return constrain(translate(scale(t0, k1), p0, p1), e);\n });\n };\n\n zoom.translateBy = function(selection, x, y) {\n zoom.transform(selection, function() {\n return constrain(this.__zoom.translate(\n typeof x === \"function\" ? x.apply(this, arguments) : x,\n typeof y === \"function\" ? y.apply(this, arguments) : y\n ), extent.apply(this, arguments));\n });\n };\n\n zoom.translateTo = function(selection, x, y) {\n zoom.transform(selection, function() {\n var e = extent.apply(this, arguments),\n t = this.__zoom,\n p = centroid(e);\n return constrain(identity$8.translate(p[0], p[1]).scale(t.k).translate(\n typeof x === \"function\" ? -x.apply(this, arguments) : -x,\n typeof y === \"function\" ? -y.apply(this, arguments) : -y\n ), e);\n });\n };\n\n function scale(transform$$1, k) {\n k = Math.max(k0, Math.min(k1, k));\n return k === transform$$1.k ? transform$$1 : new Transform(k, transform$$1.x, transform$$1.y);\n }\n\n function translate(transform$$1, p0, p1) {\n var x = p0[0] - p1[0] * transform$$1.k, y = p0[1] - p1[1] * transform$$1.k;\n return x === transform$$1.x && y === transform$$1.y ? transform$$1 : new Transform(transform$$1.k, x, y);\n }\n\n function constrain(transform$$1, extent) {\n var dx0 = transform$$1.invertX(extent[0][0]) - x0,\n dx1 = transform$$1.invertX(extent[1][0]) - x1,\n dy0 = transform$$1.invertY(extent[0][1]) - y0,\n dy1 = transform$$1.invertY(extent[1][1]) - y1;\n return transform$$1.translate(\n dx1 > dx0 ? (dx0 + dx1) / 2 : Math.min(0, dx0) || Math.max(0, dx1),\n dy1 > dy0 ? (dy0 + dy1) / 2 : Math.min(0, dy0) || Math.max(0, dy1)\n );\n }\n\n function centroid(extent) {\n return [(+extent[0][0] + +extent[1][0]) / 2, (+extent[0][1] + +extent[1][1]) / 2];\n }\n\n function schedule(transition, transform$$1, center) {\n transition\n .on(\"start.zoom\", function() { gesture(this, arguments).start(); })\n .on(\"interrupt.zoom end.zoom\", function() { gesture(this, arguments).end(); })\n .tween(\"zoom\", function() {\n var that = this,\n args = arguments,\n g = gesture(that, args),\n e = extent.apply(that, args),\n p = center || centroid(e),\n w = Math.max(e[1][0] - e[0][0], e[1][1] - e[0][1]),\n a = that.__zoom,\n b = typeof transform$$1 === \"function\" ? transform$$1.apply(that, args) : transform$$1,\n i = interpolate(a.invert(p).concat(w / a.k), b.invert(p).concat(w / b.k));\n return function(t) {\n if (t === 1) t = b; // Avoid rounding error on end.\n else { var l = i(t), k = w / l[2]; t = new Transform(k, p[0] - l[0] * k, p[1] - l[1] * k); }\n g.zoom(null, t);\n };\n });\n }\n\n function gesture(that, args) {\n for (var i = 0, n = gestures.length, g; i < n; ++i) {\n if ((g = gestures[i]).that === that) {\n return g;\n }\n }\n return new Gesture(that, args);\n }\n\n function Gesture(that, args) {\n this.that = that;\n this.args = args;\n this.index = -1;\n this.active = 0;\n this.extent = extent.apply(that, args);\n }\n\n Gesture.prototype = {\n start: function() {\n if (++this.active === 1) {\n this.index = gestures.push(this) - 1;\n this.emit(\"start\");\n }\n return this;\n },\n zoom: function(key, transform$$1) {\n if (this.mouse && key !== \"mouse\") this.mouse[1] = transform$$1.invert(this.mouse[0]);\n if (this.touch0 && key !== \"touch\") this.touch0[1] = transform$$1.invert(this.touch0[0]);\n if (this.touch1 && key !== \"touch\") this.touch1[1] = transform$$1.invert(this.touch1[0]);\n this.that.__zoom = transform$$1;\n this.emit(\"zoom\");\n return this;\n },\n end: function() {\n if (--this.active === 0) {\n gestures.splice(this.index, 1);\n this.index = -1;\n this.emit(\"end\");\n }\n return this;\n },\n emit: function(type) {\n customEvent(new ZoomEvent(zoom, type, this.that.__zoom), listeners.apply, listeners, [type, this.that, this.args]);\n }\n };\n\n function wheeled() {\n if (!filter.apply(this, arguments)) return;\n var g = gesture(this, arguments),\n t = this.__zoom,\n k = Math.max(k0, Math.min(k1, t.k * Math.pow(2, wheelDelta.apply(this, arguments)))),\n p = mouse(this);\n\n // If the mouse is in the same location as before, reuse it.\n // If there were recent wheel events, reset the wheel idle timeout.\n if (g.wheel) {\n if (g.mouse[0][0] !== p[0] || g.mouse[0][1] !== p[1]) {\n g.mouse[1] = t.invert(g.mouse[0] = p);\n }\n clearTimeout(g.wheel);\n }\n\n // If this wheel event won’t trigger a transform change, ignore it.\n else if (t.k === k) return;\n\n // Otherwise, capture the mouse point and location at the start.\n else {\n g.mouse = [p, t.invert(p)];\n interrupt(this);\n g.start();\n }\n\n noevent$2();\n g.wheel = setTimeout(wheelidled, wheelDelay);\n g.zoom(\"mouse\", constrain(translate(scale(t, k), g.mouse[0], g.mouse[1]), g.extent));\n\n function wheelidled() {\n g.wheel = null;\n g.end();\n }\n }\n\n function mousedowned() {\n if (touchending || !filter.apply(this, arguments)) return;\n var g = gesture(this, arguments),\n v = select(exports.event.view).on(\"mousemove.zoom\", mousemoved, true).on(\"mouseup.zoom\", mouseupped, true),\n p = mouse(this),\n x0 = exports.event.clientX,\n y0 = exports.event.clientY;\n\n dragDisable(exports.event.view);\n nopropagation$2();\n g.mouse = [p, this.__zoom.invert(p)];\n interrupt(this);\n g.start();\n\n function mousemoved() {\n noevent$2();\n if (!g.moved) {\n var dx = exports.event.clientX - x0, dy = exports.event.clientY - y0;\n g.moved = dx * dx + dy * dy > clickDistance2;\n }\n g.zoom(\"mouse\", constrain(translate(g.that.__zoom, g.mouse[0] = mouse(g.that), g.mouse[1]), g.extent));\n }\n\n function mouseupped() {\n v.on(\"mousemove.zoom mouseup.zoom\", null);\n yesdrag(exports.event.view, g.moved);\n noevent$2();\n g.end();\n }\n }\n\n function dblclicked() {\n if (!filter.apply(this, arguments)) return;\n var t0 = this.__zoom,\n p0 = mouse(this),\n p1 = t0.invert(p0),\n k1 = t0.k * (exports.event.shiftKey ? 0.5 : 2),\n t1 = constrain(translate(scale(t0, k1), p0, p1), extent.apply(this, arguments));\n\n noevent$2();\n if (duration > 0) select(this).transition().duration(duration).call(schedule, t1, p0);\n else select(this).call(zoom.transform, t1);\n }\n\n function touchstarted() {\n if (!filter.apply(this, arguments)) return;\n var g = gesture(this, arguments),\n touches = exports.event.changedTouches,\n started,\n n = touches.length, i, t, p;\n\n nopropagation$2();\n for (i = 0; i < n; ++i) {\n t = touches[i], p = touch(this, touches, t.identifier);\n p = [p, this.__zoom.invert(p), t.identifier];\n if (!g.touch0) g.touch0 = p, started = true;\n else if (!g.touch1) g.touch1 = p;\n }\n\n // If this is a dbltap, reroute to the (optional) dblclick.zoom handler.\n if (touchstarting) {\n touchstarting = clearTimeout(touchstarting);\n if (!g.touch1) {\n g.end();\n p = select(this).on(\"dblclick.zoom\");\n if (p) p.apply(this, arguments);\n return;\n }\n }\n\n if (started) {\n touchstarting = setTimeout(function() { touchstarting = null; }, touchDelay);\n interrupt(this);\n g.start();\n }\n }\n\n function touchmoved() {\n var g = gesture(this, arguments),\n touches = exports.event.changedTouches,\n n = touches.length, i, t, p, l;\n\n noevent$2();\n if (touchstarting) touchstarting = clearTimeout(touchstarting);\n for (i = 0; i < n; ++i) {\n t = touches[i], p = touch(this, touches, t.identifier);\n if (g.touch0 && g.touch0[2] === t.identifier) g.touch0[0] = p;\n else if (g.touch1 && g.touch1[2] === t.identifier) g.touch1[0] = p;\n }\n t = g.that.__zoom;\n if (g.touch1) {\n var p0 = g.touch0[0], l0 = g.touch0[1],\n p1 = g.touch1[0], l1 = g.touch1[1],\n dp = (dp = p1[0] - p0[0]) * dp + (dp = p1[1] - p0[1]) * dp,\n dl = (dl = l1[0] - l0[0]) * dl + (dl = l1[1] - l0[1]) * dl;\n t = scale(t, Math.sqrt(dp / dl));\n p = [(p0[0] + p1[0]) / 2, (p0[1] + p1[1]) / 2];\n l = [(l0[0] + l1[0]) / 2, (l0[1] + l1[1]) / 2];\n }\n else if (g.touch0) p = g.touch0[0], l = g.touch0[1];\n else return;\n g.zoom(\"touch\", constrain(translate(t, p, l), g.extent));\n }\n\n function touchended() {\n var g = gesture(this, arguments),\n touches = exports.event.changedTouches,\n n = touches.length, i, t;\n\n nopropagation$2();\n if (touchending) clearTimeout(touchending);\n touchending = setTimeout(function() { touchending = null; }, touchDelay);\n for (i = 0; i < n; ++i) {\n t = touches[i];\n if (g.touch0 && g.touch0[2] === t.identifier) delete g.touch0;\n else if (g.touch1 && g.touch1[2] === t.identifier) delete g.touch1;\n }\n if (g.touch1 && !g.touch0) g.touch0 = g.touch1, delete g.touch1;\n if (g.touch0) g.touch0[1] = this.__zoom.invert(g.touch0[0]);\n else g.end();\n }\n\n zoom.wheelDelta = function(_) {\n return arguments.length ? (wheelDelta = typeof _ === \"function\" ? _ : constant$12(+_), zoom) : wheelDelta;\n };\n\n zoom.filter = function(_) {\n return arguments.length ? (filter = typeof _ === \"function\" ? _ : constant$12(!!_), zoom) : filter;\n };\n\n zoom.touchable = function(_) {\n return arguments.length ? (touchable = typeof _ === \"function\" ? _ : constant$12(!!_), zoom) : touchable;\n };\n\n zoom.extent = function(_) {\n return arguments.length ? (extent = typeof _ === \"function\" ? _ : constant$12([[+_[0][0], +_[0][1]], [+_[1][0], +_[1][1]]]), zoom) : extent;\n };\n\n zoom.scaleExtent = function(_) {\n return arguments.length ? (k0 = +_[0], k1 = +_[1], zoom) : [k0, k1];\n };\n\n zoom.translateExtent = function(_) {\n return arguments.length ? (x0 = +_[0][0], x1 = +_[1][0], y0 = +_[0][1], y1 = +_[1][1], zoom) : [[x0, y0], [x1, y1]];\n };\n\n zoom.duration = function(_) {\n return arguments.length ? (duration = +_, zoom) : duration;\n };\n\n zoom.interpolate = function(_) {\n return arguments.length ? (interpolate = _, zoom) : interpolate;\n };\n\n zoom.on = function() {\n var value = listeners.on.apply(listeners, arguments);\n return value === listeners ? zoom : value;\n };\n\n zoom.clickDistance = function(_) {\n return arguments.length ? (clickDistance2 = (_ = +_) * _, zoom) : Math.sqrt(clickDistance2);\n };\n\n return zoom;\n};\n\nexports.version = version;\nexports.bisect = bisectRight;\nexports.bisectRight = bisectRight;\nexports.bisectLeft = bisectLeft;\nexports.ascending = ascending;\nexports.bisector = bisector;\nexports.cross = cross;\nexports.descending = descending;\nexports.deviation = deviation;\nexports.extent = extent;\nexports.histogram = histogram;\nexports.thresholdFreedmanDiaconis = freedmanDiaconis;\nexports.thresholdScott = scott;\nexports.thresholdSturges = sturges;\nexports.max = max;\nexports.mean = mean;\nexports.median = median;\nexports.merge = merge;\nexports.min = min;\nexports.pairs = pairs;\nexports.permute = permute;\nexports.quantile = threshold;\nexports.range = sequence;\nexports.scan = scan;\nexports.shuffle = shuffle;\nexports.sum = sum;\nexports.ticks = ticks;\nexports.tickIncrement = tickIncrement;\nexports.tickStep = tickStep;\nexports.transpose = transpose;\nexports.variance = variance;\nexports.zip = zip;\nexports.axisTop = axisTop;\nexports.axisRight = axisRight;\nexports.axisBottom = axisBottom;\nexports.axisLeft = axisLeft;\nexports.brush = brush;\nexports.brushX = brushX;\nexports.brushY = brushY;\nexports.brushSelection = brushSelection;\nexports.chord = chord;\nexports.ribbon = ribbon;\nexports.nest = nest;\nexports.set = set$2;\nexports.map = map$1;\nexports.keys = keys;\nexports.values = values;\nexports.entries = entries;\nexports.color = color;\nexports.rgb = rgb;\nexports.hsl = hsl;\nexports.lab = lab;\nexports.hcl = hcl;\nexports.cubehelix = cubehelix;\nexports.dispatch = dispatch;\nexports.drag = drag;\nexports.dragDisable = dragDisable;\nexports.dragEnable = yesdrag;\nexports.dsvFormat = dsv;\nexports.csvParse = csvParse;\nexports.csvParseRows = csvParseRows;\nexports.csvFormat = csvFormat;\nexports.csvFormatRows = csvFormatRows;\nexports.tsvParse = tsvParse;\nexports.tsvParseRows = tsvParseRows;\nexports.tsvFormat = tsvFormat;\nexports.tsvFormatRows = tsvFormatRows;\nexports.easeLinear = linear$1;\nexports.easeQuad = quadInOut;\nexports.easeQuadIn = quadIn;\nexports.easeQuadOut = quadOut;\nexports.easeQuadInOut = quadInOut;\nexports.easeCubic = cubicInOut;\nexports.easeCubicIn = cubicIn;\nexports.easeCubicOut = cubicOut;\nexports.easeCubicInOut = cubicInOut;\nexports.easePoly = polyInOut;\nexports.easePolyIn = polyIn;\nexports.easePolyOut = polyOut;\nexports.easePolyInOut = polyInOut;\nexports.easeSin = sinInOut;\nexports.easeSinIn = sinIn;\nexports.easeSinOut = sinOut;\nexports.easeSinInOut = sinInOut;\nexports.easeExp = expInOut;\nexports.easeExpIn = expIn;\nexports.easeExpOut = expOut;\nexports.easeExpInOut = expInOut;\nexports.easeCircle = circleInOut;\nexports.easeCircleIn = circleIn;\nexports.easeCircleOut = circleOut;\nexports.easeCircleInOut = circleInOut;\nexports.easeBounce = bounceOut;\nexports.easeBounceIn = bounceIn;\nexports.easeBounceOut = bounceOut;\nexports.easeBounceInOut = bounceInOut;\nexports.easeBack = backInOut;\nexports.easeBackIn = backIn;\nexports.easeBackOut = backOut;\nexports.easeBackInOut = backInOut;\nexports.easeElastic = elasticOut;\nexports.easeElasticIn = elasticIn;\nexports.easeElasticOut = elasticOut;\nexports.easeElasticInOut = elasticInOut;\nexports.forceCenter = center$1;\nexports.forceCollide = collide;\nexports.forceLink = link;\nexports.forceManyBody = manyBody;\nexports.forceRadial = radial;\nexports.forceSimulation = simulation;\nexports.forceX = x$2;\nexports.forceY = y$2;\nexports.formatDefaultLocale = defaultLocale;\nexports.formatLocale = formatLocale;\nexports.formatSpecifier = formatSpecifier;\nexports.precisionFixed = precisionFixed;\nexports.precisionPrefix = precisionPrefix;\nexports.precisionRound = precisionRound;\nexports.geoArea = area;\nexports.geoBounds = bounds;\nexports.geoCentroid = centroid;\nexports.geoCircle = circle;\nexports.geoClipAntimeridian = clipAntimeridian;\nexports.geoClipCircle = clipCircle;\nexports.geoClipExtent = extent$1;\nexports.geoClipRectangle = clipRectangle;\nexports.geoContains = contains;\nexports.geoDistance = distance;\nexports.geoGraticule = graticule;\nexports.geoGraticule10 = graticule10;\nexports.geoInterpolate = interpolate$1;\nexports.geoLength = length$1;\nexports.geoPath = index$1;\nexports.geoAlbers = albers;\nexports.geoAlbersUsa = albersUsa;\nexports.geoAzimuthalEqualArea = azimuthalEqualArea;\nexports.geoAzimuthalEqualAreaRaw = azimuthalEqualAreaRaw;\nexports.geoAzimuthalEquidistant = azimuthalEquidistant;\nexports.geoAzimuthalEquidistantRaw = azimuthalEquidistantRaw;\nexports.geoConicConformal = conicConformal;\nexports.geoConicConformalRaw = conicConformalRaw;\nexports.geoConicEqualArea = conicEqualArea;\nexports.geoConicEqualAreaRaw = conicEqualAreaRaw;\nexports.geoConicEquidistant = conicEquidistant;\nexports.geoConicEquidistantRaw = conicEquidistantRaw;\nexports.geoEquirectangular = equirectangular;\nexports.geoEquirectangularRaw = equirectangularRaw;\nexports.geoGnomonic = gnomonic;\nexports.geoGnomonicRaw = gnomonicRaw;\nexports.geoIdentity = identity$5;\nexports.geoProjection = projection;\nexports.geoProjectionMutator = projectionMutator;\nexports.geoMercator = mercator;\nexports.geoMercatorRaw = mercatorRaw;\nexports.geoNaturalEarth1 = naturalEarth1;\nexports.geoNaturalEarth1Raw = naturalEarth1Raw;\nexports.geoOrthographic = orthographic;\nexports.geoOrthographicRaw = orthographicRaw;\nexports.geoStereographic = stereographic;\nexports.geoStereographicRaw = stereographicRaw;\nexports.geoTransverseMercator = transverseMercator;\nexports.geoTransverseMercatorRaw = transverseMercatorRaw;\nexports.geoRotation = rotation;\nexports.geoStream = geoStream;\nexports.geoTransform = transform;\nexports.cluster = cluster;\nexports.hierarchy = hierarchy;\nexports.pack = index$2;\nexports.packSiblings = siblings;\nexports.packEnclose = enclose;\nexports.partition = partition;\nexports.stratify = stratify;\nexports.tree = tree;\nexports.treemap = index$3;\nexports.treemapBinary = binary;\nexports.treemapDice = treemapDice;\nexports.treemapSlice = treemapSlice;\nexports.treemapSliceDice = sliceDice;\nexports.treemapSquarify = squarify;\nexports.treemapResquarify = resquarify;\nexports.interpolate = interpolateValue;\nexports.interpolateArray = array$1;\nexports.interpolateBasis = basis$1;\nexports.interpolateBasisClosed = basisClosed;\nexports.interpolateDate = date;\nexports.interpolateNumber = reinterpolate;\nexports.interpolateObject = object;\nexports.interpolateRound = interpolateRound;\nexports.interpolateString = interpolateString;\nexports.interpolateTransformCss = interpolateTransformCss;\nexports.interpolateTransformSvg = interpolateTransformSvg;\nexports.interpolateZoom = interpolateZoom;\nexports.interpolateRgb = interpolateRgb;\nexports.interpolateRgbBasis = rgbBasis;\nexports.interpolateRgbBasisClosed = rgbBasisClosed;\nexports.interpolateHsl = hsl$2;\nexports.interpolateHslLong = hslLong;\nexports.interpolateLab = lab$1;\nexports.interpolateHcl = hcl$2;\nexports.interpolateHclLong = hclLong;\nexports.interpolateCubehelix = cubehelix$2;\nexports.interpolateCubehelixLong = cubehelixLong;\nexports.quantize = quantize;\nexports.path = path;\nexports.polygonArea = area$1;\nexports.polygonCentroid = centroid$1;\nexports.polygonHull = hull;\nexports.polygonContains = contains$1;\nexports.polygonLength = length$2;\nexports.quadtree = quadtree;\nexports.queue = queue;\nexports.randomUniform = uniform;\nexports.randomNormal = normal;\nexports.randomLogNormal = logNormal;\nexports.randomBates = bates;\nexports.randomIrwinHall = irwinHall;\nexports.randomExponential = exponential$1;\nexports.request = request;\nexports.html = html;\nexports.json = json;\nexports.text = text;\nexports.xml = xml;\nexports.csv = csv$1;\nexports.tsv = tsv$1;\nexports.scaleBand = band;\nexports.scalePoint = point$1;\nexports.scaleIdentity = identity$6;\nexports.scaleLinear = linear$2;\nexports.scaleLog = log$1;\nexports.scaleOrdinal = ordinal;\nexports.scaleImplicit = implicit;\nexports.scalePow = pow$1;\nexports.scaleSqrt = sqrt$1;\nexports.scaleQuantile = quantile$$1;\nexports.scaleQuantize = quantize$1;\nexports.scaleThreshold = threshold$1;\nexports.scaleTime = time;\nexports.scaleUtc = utcTime;\nexports.schemeCategory10 = category10;\nexports.schemeCategory20b = category20b;\nexports.schemeCategory20c = category20c;\nexports.schemeCategory20 = category20;\nexports.interpolateCubehelixDefault = cubehelix$3;\nexports.interpolateRainbow = rainbow$1;\nexports.interpolateWarm = warm;\nexports.interpolateCool = cool;\nexports.interpolateViridis = viridis;\nexports.interpolateMagma = magma;\nexports.interpolateInferno = inferno;\nexports.interpolatePlasma = plasma;\nexports.scaleSequential = sequential;\nexports.creator = creator;\nexports.local = local$1;\nexports.matcher = matcher$1;\nexports.mouse = mouse;\nexports.namespace = namespace;\nexports.namespaces = namespaces;\nexports.select = select;\nexports.selectAll = selectAll;\nexports.selection = selection;\nexports.selector = selector;\nexports.selectorAll = selectorAll;\nexports.style = styleValue;\nexports.touch = touch;\nexports.touches = touches;\nexports.window = defaultView;\nexports.customEvent = customEvent;\nexports.arc = arc;\nexports.area = area$2;\nexports.line = line;\nexports.pie = pie;\nexports.areaRadial = areaRadial;\nexports.radialArea = areaRadial;\nexports.lineRadial = lineRadial$1;\nexports.radialLine = lineRadial$1;\nexports.pointRadial = pointRadial;\nexports.linkHorizontal = linkHorizontal;\nexports.linkVertical = linkVertical;\nexports.linkRadial = linkRadial;\nexports.symbol = symbol;\nexports.symbols = symbols;\nexports.symbolCircle = circle$2;\nexports.symbolCross = cross$2;\nexports.symbolDiamond = diamond;\nexports.symbolSquare = square;\nexports.symbolStar = star;\nexports.symbolTriangle = triangle;\nexports.symbolWye = wye;\nexports.curveBasisClosed = basisClosed$1;\nexports.curveBasisOpen = basisOpen;\nexports.curveBasis = basis$2;\nexports.curveBundle = bundle;\nexports.curveCardinalClosed = cardinalClosed;\nexports.curveCardinalOpen = cardinalOpen;\nexports.curveCardinal = cardinal;\nexports.curveCatmullRomClosed = catmullRomClosed;\nexports.curveCatmullRomOpen = catmullRomOpen;\nexports.curveCatmullRom = catmullRom;\nexports.curveLinearClosed = linearClosed;\nexports.curveLinear = curveLinear;\nexports.curveMonotoneX = monotoneX;\nexports.curveMonotoneY = monotoneY;\nexports.curveNatural = natural;\nexports.curveStep = step;\nexports.curveStepAfter = stepAfter;\nexports.curveStepBefore = stepBefore;\nexports.stack = stack;\nexports.stackOffsetExpand = expand;\nexports.stackOffsetDiverging = diverging;\nexports.stackOffsetNone = none$1;\nexports.stackOffsetSilhouette = silhouette;\nexports.stackOffsetWiggle = wiggle;\nexports.stackOrderAscending = ascending$2;\nexports.stackOrderDescending = descending$2;\nexports.stackOrderInsideOut = insideOut;\nexports.stackOrderNone = none$2;\nexports.stackOrderReverse = reverse;\nexports.timeInterval = newInterval;\nexports.timeMillisecond = millisecond;\nexports.timeMilliseconds = milliseconds;\nexports.utcMillisecond = millisecond;\nexports.utcMilliseconds = milliseconds;\nexports.timeSecond = second;\nexports.timeSeconds = seconds;\nexports.utcSecond = second;\nexports.utcSeconds = seconds;\nexports.timeMinute = minute;\nexports.timeMinutes = minutes;\nexports.timeHour = hour;\nexports.timeHours = hours;\nexports.timeDay = day;\nexports.timeDays = days;\nexports.timeWeek = sunday;\nexports.timeWeeks = sundays;\nexports.timeSunday = sunday;\nexports.timeSundays = sundays;\nexports.timeMonday = monday;\nexports.timeMondays = mondays;\nexports.timeTuesday = tuesday;\nexports.timeTuesdays = tuesdays;\nexports.timeWednesday = wednesday;\nexports.timeWednesdays = wednesdays;\nexports.timeThursday = thursday;\nexports.timeThursdays = thursdays;\nexports.timeFriday = friday;\nexports.timeFridays = fridays;\nexports.timeSaturday = saturday;\nexports.timeSaturdays = saturdays;\nexports.timeMonth = month;\nexports.timeMonths = months;\nexports.timeYear = year;\nexports.timeYears = years;\nexports.utcMinute = utcMinute;\nexports.utcMinutes = utcMinutes;\nexports.utcHour = utcHour;\nexports.utcHours = utcHours;\nexports.utcDay = utcDay;\nexports.utcDays = utcDays;\nexports.utcWeek = utcSunday;\nexports.utcWeeks = utcSundays;\nexports.utcSunday = utcSunday;\nexports.utcSundays = utcSundays;\nexports.utcMonday = utcMonday;\nexports.utcMondays = utcMondays;\nexports.utcTuesday = utcTuesday;\nexports.utcTuesdays = utcTuesdays;\nexports.utcWednesday = utcWednesday;\nexports.utcWednesdays = utcWednesdays;\nexports.utcThursday = utcThursday;\nexports.utcThursdays = utcThursdays;\nexports.utcFriday = utcFriday;\nexports.utcFridays = utcFridays;\nexports.utcSaturday = utcSaturday;\nexports.utcSaturdays = utcSaturdays;\nexports.utcMonth = utcMonth;\nexports.utcMonths = utcMonths;\nexports.utcYear = utcYear;\nexports.utcYears = utcYears;\nexports.timeFormatDefaultLocale = defaultLocale$1;\nexports.timeFormatLocale = formatLocale$1;\nexports.isoFormat = formatIso;\nexports.isoParse = parseIso;\nexports.now = now;\nexports.timer = timer;\nexports.timerFlush = timerFlush;\nexports.timeout = timeout$1;\nexports.interval = interval$1;\nexports.transition = transition;\nexports.active = active;\nexports.interrupt = interrupt;\nexports.voronoi = voronoi;\nexports.zoom = zoom;\nexports.zoomTransform = transform$1;\nexports.zoomIdentity = identity$8;\n\nObject.defineProperty(exports, '__esModule', { value: true });\n\n})));\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/d3/build/d3.js\n// module id = 18\n// module chunks = 0\n\n//# sourceURL=webpack:///./node_modules/d3/build/d3.js?"); /***/ }), /* 19 */ -/***/ (function(module, exports, __webpack_require__) { +/***/ (function(module, __webpack_exports__, __webpack_require__) { -eval("// https://d3js.org Version 4.11.0. Copyright 2017 Mike Bostock.\n(function (global, factory) {\n\t true ? factory(exports) :\n\ttypeof define === 'function' && define.amd ? define(['exports'], factory) :\n\t(factory((global.d3 = global.d3 || {})));\n}(this, (function (exports) { 'use strict';\n\nvar version = \"4.11.0\";\n\nvar ascending = function(a, b) {\n return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;\n};\n\nvar bisector = function(compare) {\n if (compare.length === 1) compare = ascendingComparator(compare);\n return {\n left: function(a, x, lo, hi) {\n if (lo == null) lo = 0;\n if (hi == null) hi = a.length;\n while (lo < hi) {\n var mid = lo + hi >>> 1;\n if (compare(a[mid], x) < 0) lo = mid + 1;\n else hi = mid;\n }\n return lo;\n },\n right: function(a, x, lo, hi) {\n if (lo == null) lo = 0;\n if (hi == null) hi = a.length;\n while (lo < hi) {\n var mid = lo + hi >>> 1;\n if (compare(a[mid], x) > 0) hi = mid;\n else lo = mid + 1;\n }\n return lo;\n }\n };\n};\n\nfunction ascendingComparator(f) {\n return function(d, x) {\n return ascending(f(d), x);\n };\n}\n\nvar ascendingBisect = bisector(ascending);\nvar bisectRight = ascendingBisect.right;\nvar bisectLeft = ascendingBisect.left;\n\nvar pairs = function(array, f) {\n if (f == null) f = pair;\n var i = 0, n = array.length - 1, p = array[0], pairs = new Array(n < 0 ? 0 : n);\n while (i < n) pairs[i] = f(p, p = array[++i]);\n return pairs;\n};\n\nfunction pair(a, b) {\n return [a, b];\n}\n\nvar cross = function(values0, values1, reduce) {\n var n0 = values0.length,\n n1 = values1.length,\n values = new Array(n0 * n1),\n i0,\n i1,\n i,\n value0;\n\n if (reduce == null) reduce = pair;\n\n for (i0 = i = 0; i0 < n0; ++i0) {\n for (value0 = values0[i0], i1 = 0; i1 < n1; ++i1, ++i) {\n values[i] = reduce(value0, values1[i1]);\n }\n }\n\n return values;\n};\n\nvar descending = function(a, b) {\n return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN;\n};\n\nvar number = function(x) {\n return x === null ? NaN : +x;\n};\n\nvar variance = function(values, valueof) {\n var n = values.length,\n m = 0,\n i = -1,\n mean = 0,\n value,\n delta,\n sum = 0;\n\n if (valueof == null) {\n while (++i < n) {\n if (!isNaN(value = number(values[i]))) {\n delta = value - mean;\n mean += delta / ++m;\n sum += delta * (value - mean);\n }\n }\n }\n\n else {\n while (++i < n) {\n if (!isNaN(value = number(valueof(values[i], i, values)))) {\n delta = value - mean;\n mean += delta / ++m;\n sum += delta * (value - mean);\n }\n }\n }\n\n if (m > 1) return sum / (m - 1);\n};\n\nvar deviation = function(array, f) {\n var v = variance(array, f);\n return v ? Math.sqrt(v) : v;\n};\n\nvar extent = function(values, valueof) {\n var n = values.length,\n i = -1,\n value,\n min,\n max;\n\n if (valueof == null) {\n while (++i < n) { // Find the first comparable value.\n if ((value = values[i]) != null && value >= value) {\n min = max = value;\n while (++i < n) { // Compare the remaining values.\n if ((value = values[i]) != null) {\n if (min > value) min = value;\n if (max < value) max = value;\n }\n }\n }\n }\n }\n\n else {\n while (++i < n) { // Find the first comparable value.\n if ((value = valueof(values[i], i, values)) != null && value >= value) {\n min = max = value;\n while (++i < n) { // Compare the remaining values.\n if ((value = valueof(values[i], i, values)) != null) {\n if (min > value) min = value;\n if (max < value) max = value;\n }\n }\n }\n }\n }\n\n return [min, max];\n};\n\nvar array = Array.prototype;\n\nvar slice = array.slice;\nvar map = array.map;\n\nvar constant = function(x) {\n return function() {\n return x;\n };\n};\n\nvar identity = function(x) {\n return x;\n};\n\nvar sequence = function(start, stop, step) {\n start = +start, stop = +stop, step = (n = arguments.length) < 2 ? (stop = start, start = 0, 1) : n < 3 ? 1 : +step;\n\n var i = -1,\n n = Math.max(0, Math.ceil((stop - start) / step)) | 0,\n range = new Array(n);\n\n while (++i < n) {\n range[i] = start + i * step;\n }\n\n return range;\n};\n\nvar e10 = Math.sqrt(50);\nvar e5 = Math.sqrt(10);\nvar e2 = Math.sqrt(2);\n\nvar ticks = function(start, stop, count) {\n var reverse,\n i = -1,\n n,\n ticks,\n step;\n\n stop = +stop, start = +start, count = +count;\n if (start === stop && count > 0) return [start];\n if (reverse = stop < start) n = start, start = stop, stop = n;\n if ((step = tickIncrement(start, stop, count)) === 0 || !isFinite(step)) return [];\n\n if (step > 0) {\n start = Math.ceil(start / step);\n stop = Math.floor(stop / step);\n ticks = new Array(n = Math.ceil(stop - start + 1));\n while (++i < n) ticks[i] = (start + i) * step;\n } else {\n start = Math.floor(start * step);\n stop = Math.ceil(stop * step);\n ticks = new Array(n = Math.ceil(start - stop + 1));\n while (++i < n) ticks[i] = (start - i) / step;\n }\n\n if (reverse) ticks.reverse();\n\n return ticks;\n};\n\nfunction tickIncrement(start, stop, count) {\n var step = (stop - start) / Math.max(0, count),\n power = Math.floor(Math.log(step) / Math.LN10),\n error = step / Math.pow(10, power);\n return power >= 0\n ? (error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1) * Math.pow(10, power)\n : -Math.pow(10, -power) / (error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1);\n}\n\nfunction tickStep(start, stop, count) {\n var step0 = Math.abs(stop - start) / Math.max(0, count),\n step1 = Math.pow(10, Math.floor(Math.log(step0) / Math.LN10)),\n error = step0 / step1;\n if (error >= e10) step1 *= 10;\n else if (error >= e5) step1 *= 5;\n else if (error >= e2) step1 *= 2;\n return stop < start ? -step1 : step1;\n}\n\nvar sturges = function(values) {\n return Math.ceil(Math.log(values.length) / Math.LN2) + 1;\n};\n\nvar histogram = function() {\n var value = identity,\n domain = extent,\n threshold = sturges;\n\n function histogram(data) {\n var i,\n n = data.length,\n x,\n values = new Array(n);\n\n for (i = 0; i < n; ++i) {\n values[i] = value(data[i], i, data);\n }\n\n var xz = domain(values),\n x0 = xz[0],\n x1 = xz[1],\n tz = threshold(values, x0, x1);\n\n // Convert number of thresholds into uniform thresholds.\n if (!Array.isArray(tz)) {\n tz = tickStep(x0, x1, tz);\n tz = sequence(Math.ceil(x0 / tz) * tz, Math.floor(x1 / tz) * tz, tz); // exclusive\n }\n\n // Remove any thresholds outside the domain.\n var m = tz.length;\n while (tz[0] <= x0) tz.shift(), --m;\n while (tz[m - 1] > x1) tz.pop(), --m;\n\n var bins = new Array(m + 1),\n bin;\n\n // Initialize bins.\n for (i = 0; i <= m; ++i) {\n bin = bins[i] = [];\n bin.x0 = i > 0 ? tz[i - 1] : x0;\n bin.x1 = i < m ? tz[i] : x1;\n }\n\n // Assign data to bins by value, ignoring any outside the domain.\n for (i = 0; i < n; ++i) {\n x = values[i];\n if (x0 <= x && x <= x1) {\n bins[bisectRight(tz, x, 0, m)].push(data[i]);\n }\n }\n\n return bins;\n }\n\n histogram.value = function(_) {\n return arguments.length ? (value = typeof _ === \"function\" ? _ : constant(_), histogram) : value;\n };\n\n histogram.domain = function(_) {\n return arguments.length ? (domain = typeof _ === \"function\" ? _ : constant([_[0], _[1]]), histogram) : domain;\n };\n\n histogram.thresholds = function(_) {\n return arguments.length ? (threshold = typeof _ === \"function\" ? _ : Array.isArray(_) ? constant(slice.call(_)) : constant(_), histogram) : threshold;\n };\n\n return histogram;\n};\n\nvar threshold = function(values, p, valueof) {\n if (valueof == null) valueof = number;\n if (!(n = values.length)) return;\n if ((p = +p) <= 0 || n < 2) return +valueof(values[0], 0, values);\n if (p >= 1) return +valueof(values[n - 1], n - 1, values);\n var n,\n i = (n - 1) * p,\n i0 = Math.floor(i),\n value0 = +valueof(values[i0], i0, values),\n value1 = +valueof(values[i0 + 1], i0 + 1, values);\n return value0 + (value1 - value0) * (i - i0);\n};\n\nvar freedmanDiaconis = function(values, min, max) {\n values = map.call(values, number).sort(ascending);\n return Math.ceil((max - min) / (2 * (threshold(values, 0.75) - threshold(values, 0.25)) * Math.pow(values.length, -1 / 3)));\n};\n\nvar scott = function(values, min, max) {\n return Math.ceil((max - min) / (3.5 * deviation(values) * Math.pow(values.length, -1 / 3)));\n};\n\nvar max = function(values, valueof) {\n var n = values.length,\n i = -1,\n value,\n max;\n\n if (valueof == null) {\n while (++i < n) { // Find the first comparable value.\n if ((value = values[i]) != null && value >= value) {\n max = value;\n while (++i < n) { // Compare the remaining values.\n if ((value = values[i]) != null && value > max) {\n max = value;\n }\n }\n }\n }\n }\n\n else {\n while (++i < n) { // Find the first comparable value.\n if ((value = valueof(values[i], i, values)) != null && value >= value) {\n max = value;\n while (++i < n) { // Compare the remaining values.\n if ((value = valueof(values[i], i, values)) != null && value > max) {\n max = value;\n }\n }\n }\n }\n }\n\n return max;\n};\n\nvar mean = function(values, valueof) {\n var n = values.length,\n m = n,\n i = -1,\n value,\n sum = 0;\n\n if (valueof == null) {\n while (++i < n) {\n if (!isNaN(value = number(values[i]))) sum += value;\n else --m;\n }\n }\n\n else {\n while (++i < n) {\n if (!isNaN(value = number(valueof(values[i], i, values)))) sum += value;\n else --m;\n }\n }\n\n if (m) return sum / m;\n};\n\nvar median = function(values, valueof) {\n var n = values.length,\n i = -1,\n value,\n numbers = [];\n\n if (valueof == null) {\n while (++i < n) {\n if (!isNaN(value = number(values[i]))) {\n numbers.push(value);\n }\n }\n }\n\n else {\n while (++i < n) {\n if (!isNaN(value = number(valueof(values[i], i, values)))) {\n numbers.push(value);\n }\n }\n }\n\n return threshold(numbers.sort(ascending), 0.5);\n};\n\nvar merge = function(arrays) {\n var n = arrays.length,\n m,\n i = -1,\n j = 0,\n merged,\n array;\n\n while (++i < n) j += arrays[i].length;\n merged = new Array(j);\n\n while (--n >= 0) {\n array = arrays[n];\n m = array.length;\n while (--m >= 0) {\n merged[--j] = array[m];\n }\n }\n\n return merged;\n};\n\nvar min = function(values, valueof) {\n var n = values.length,\n i = -1,\n value,\n min;\n\n if (valueof == null) {\n while (++i < n) { // Find the first comparable value.\n if ((value = values[i]) != null && value >= value) {\n min = value;\n while (++i < n) { // Compare the remaining values.\n if ((value = values[i]) != null && min > value) {\n min = value;\n }\n }\n }\n }\n }\n\n else {\n while (++i < n) { // Find the first comparable value.\n if ((value = valueof(values[i], i, values)) != null && value >= value) {\n min = value;\n while (++i < n) { // Compare the remaining values.\n if ((value = valueof(values[i], i, values)) != null && min > value) {\n min = value;\n }\n }\n }\n }\n }\n\n return min;\n};\n\nvar permute = function(array, indexes) {\n var i = indexes.length, permutes = new Array(i);\n while (i--) permutes[i] = array[indexes[i]];\n return permutes;\n};\n\nvar scan = function(values, compare) {\n if (!(n = values.length)) return;\n var n,\n i = 0,\n j = 0,\n xi,\n xj = values[j];\n\n if (compare == null) compare = ascending;\n\n while (++i < n) {\n if (compare(xi = values[i], xj) < 0 || compare(xj, xj) !== 0) {\n xj = xi, j = i;\n }\n }\n\n if (compare(xj, xj) === 0) return j;\n};\n\nvar shuffle = function(array, i0, i1) {\n var m = (i1 == null ? array.length : i1) - (i0 = i0 == null ? 0 : +i0),\n t,\n i;\n\n while (m) {\n i = Math.random() * m-- | 0;\n t = array[m + i0];\n array[m + i0] = array[i + i0];\n array[i + i0] = t;\n }\n\n return array;\n};\n\nvar sum = function(values, valueof) {\n var n = values.length,\n i = -1,\n value,\n sum = 0;\n\n if (valueof == null) {\n while (++i < n) {\n if (value = +values[i]) sum += value; // Note: zero and null are equivalent.\n }\n }\n\n else {\n while (++i < n) {\n if (value = +valueof(values[i], i, values)) sum += value;\n }\n }\n\n return sum;\n};\n\nvar transpose = function(matrix) {\n if (!(n = matrix.length)) return [];\n for (var i = -1, m = min(matrix, length), transpose = new Array(m); ++i < m;) {\n for (var j = -1, n, row = transpose[i] = new Array(n); ++j < n;) {\n row[j] = matrix[j][i];\n }\n }\n return transpose;\n};\n\nfunction length(d) {\n return d.length;\n}\n\nvar zip = function() {\n return transpose(arguments);\n};\n\nvar slice$1 = Array.prototype.slice;\n\nvar identity$1 = function(x) {\n return x;\n};\n\nvar top = 1;\nvar right = 2;\nvar bottom = 3;\nvar left = 4;\nvar epsilon = 1e-6;\n\nfunction translateX(x) {\n return \"translate(\" + (x + 0.5) + \",0)\";\n}\n\nfunction translateY(y) {\n return \"translate(0,\" + (y + 0.5) + \")\";\n}\n\nfunction number$1(scale) {\n return function(d) {\n return +scale(d);\n };\n}\n\nfunction center(scale) {\n var offset = Math.max(0, scale.bandwidth() - 1) / 2; // Adjust for 0.5px offset.\n if (scale.round()) offset = Math.round(offset);\n return function(d) {\n return +scale(d) + offset;\n };\n}\n\nfunction entering() {\n return !this.__axis;\n}\n\nfunction axis(orient, scale) {\n var tickArguments = [],\n tickValues = null,\n tickFormat = null,\n tickSizeInner = 6,\n tickSizeOuter = 6,\n tickPadding = 3,\n k = orient === top || orient === left ? -1 : 1,\n x = orient === left || orient === right ? \"x\" : \"y\",\n transform = orient === top || orient === bottom ? translateX : translateY;\n\n function axis(context) {\n var values = tickValues == null ? (scale.ticks ? scale.ticks.apply(scale, tickArguments) : scale.domain()) : tickValues,\n format = tickFormat == null ? (scale.tickFormat ? scale.tickFormat.apply(scale, tickArguments) : identity$1) : tickFormat,\n spacing = Math.max(tickSizeInner, 0) + tickPadding,\n range = scale.range(),\n range0 = +range[0] + 0.5,\n range1 = +range[range.length - 1] + 0.5,\n position = (scale.bandwidth ? center : number$1)(scale.copy()),\n selection = context.selection ? context.selection() : context,\n path = selection.selectAll(\".domain\").data([null]),\n tick = selection.selectAll(\".tick\").data(values, scale).order(),\n tickExit = tick.exit(),\n tickEnter = tick.enter().append(\"g\").attr(\"class\", \"tick\"),\n line = tick.select(\"line\"),\n text = tick.select(\"text\");\n\n path = path.merge(path.enter().insert(\"path\", \".tick\")\n .attr(\"class\", \"domain\")\n .attr(\"stroke\", \"#000\"));\n\n tick = tick.merge(tickEnter);\n\n line = line.merge(tickEnter.append(\"line\")\n .attr(\"stroke\", \"#000\")\n .attr(x + \"2\", k * tickSizeInner));\n\n text = text.merge(tickEnter.append(\"text\")\n .attr(\"fill\", \"#000\")\n .attr(x, k * spacing)\n .attr(\"dy\", orient === top ? \"0em\" : orient === bottom ? \"0.71em\" : \"0.32em\"));\n\n if (context !== selection) {\n path = path.transition(context);\n tick = tick.transition(context);\n line = line.transition(context);\n text = text.transition(context);\n\n tickExit = tickExit.transition(context)\n .attr(\"opacity\", epsilon)\n .attr(\"transform\", function(d) { return isFinite(d = position(d)) ? transform(d) : this.getAttribute(\"transform\"); });\n\n tickEnter\n .attr(\"opacity\", epsilon)\n .attr(\"transform\", function(d) { var p = this.parentNode.__axis; return transform(p && isFinite(p = p(d)) ? p : position(d)); });\n }\n\n tickExit.remove();\n\n path\n .attr(\"d\", orient === left || orient == right\n ? \"M\" + k * tickSizeOuter + \",\" + range0 + \"H0.5V\" + range1 + \"H\" + k * tickSizeOuter\n : \"M\" + range0 + \",\" + k * tickSizeOuter + \"V0.5H\" + range1 + \"V\" + k * tickSizeOuter);\n\n tick\n .attr(\"opacity\", 1)\n .attr(\"transform\", function(d) { return transform(position(d)); });\n\n line\n .attr(x + \"2\", k * tickSizeInner);\n\n text\n .attr(x, k * spacing)\n .text(format);\n\n selection.filter(entering)\n .attr(\"fill\", \"none\")\n .attr(\"font-size\", 10)\n .attr(\"font-family\", \"sans-serif\")\n .attr(\"text-anchor\", orient === right ? \"start\" : orient === left ? \"end\" : \"middle\");\n\n selection\n .each(function() { this.__axis = position; });\n }\n\n axis.scale = function(_) {\n return arguments.length ? (scale = _, axis) : scale;\n };\n\n axis.ticks = function() {\n return tickArguments = slice$1.call(arguments), axis;\n };\n\n axis.tickArguments = function(_) {\n return arguments.length ? (tickArguments = _ == null ? [] : slice$1.call(_), axis) : tickArguments.slice();\n };\n\n axis.tickValues = function(_) {\n return arguments.length ? (tickValues = _ == null ? null : slice$1.call(_), axis) : tickValues && tickValues.slice();\n };\n\n axis.tickFormat = function(_) {\n return arguments.length ? (tickFormat = _, axis) : tickFormat;\n };\n\n axis.tickSize = function(_) {\n return arguments.length ? (tickSizeInner = tickSizeOuter = +_, axis) : tickSizeInner;\n };\n\n axis.tickSizeInner = function(_) {\n return arguments.length ? (tickSizeInner = +_, axis) : tickSizeInner;\n };\n\n axis.tickSizeOuter = function(_) {\n return arguments.length ? (tickSizeOuter = +_, axis) : tickSizeOuter;\n };\n\n axis.tickPadding = function(_) {\n return arguments.length ? (tickPadding = +_, axis) : tickPadding;\n };\n\n return axis;\n}\n\nfunction axisTop(scale) {\n return axis(top, scale);\n}\n\nfunction axisRight(scale) {\n return axis(right, scale);\n}\n\nfunction axisBottom(scale) {\n return axis(bottom, scale);\n}\n\nfunction axisLeft(scale) {\n return axis(left, scale);\n}\n\nvar noop = {value: function() {}};\n\nfunction dispatch() {\n for (var i = 0, n = arguments.length, _ = {}, t; i < n; ++i) {\n if (!(t = arguments[i] + \"\") || (t in _)) throw new Error(\"illegal type: \" + t);\n _[t] = [];\n }\n return new Dispatch(_);\n}\n\nfunction Dispatch(_) {\n this._ = _;\n}\n\nfunction parseTypenames(typenames, types) {\n return typenames.trim().split(/^|\\s+/).map(function(t) {\n var name = \"\", i = t.indexOf(\".\");\n if (i >= 0) name = t.slice(i + 1), t = t.slice(0, i);\n if (t && !types.hasOwnProperty(t)) throw new Error(\"unknown type: \" + t);\n return {type: t, name: name};\n });\n}\n\nDispatch.prototype = dispatch.prototype = {\n constructor: Dispatch,\n on: function(typename, callback) {\n var _ = this._,\n T = parseTypenames(typename + \"\", _),\n t,\n i = -1,\n n = T.length;\n\n // If no callback was specified, return the callback of the given type and name.\n if (arguments.length < 2) {\n while (++i < n) if ((t = (typename = T[i]).type) && (t = get(_[t], typename.name))) return t;\n return;\n }\n\n // If a type was specified, set the callback for the given type and name.\n // Otherwise, if a null callback was specified, remove callbacks of the given name.\n if (callback != null && typeof callback !== \"function\") throw new Error(\"invalid callback: \" + callback);\n while (++i < n) {\n if (t = (typename = T[i]).type) _[t] = set(_[t], typename.name, callback);\n else if (callback == null) for (t in _) _[t] = set(_[t], typename.name, null);\n }\n\n return this;\n },\n copy: function() {\n var copy = {}, _ = this._;\n for (var t in _) copy[t] = _[t].slice();\n return new Dispatch(copy);\n },\n call: function(type, that) {\n if ((n = arguments.length - 2) > 0) for (var args = new Array(n), i = 0, n, t; i < n; ++i) args[i] = arguments[i + 2];\n if (!this._.hasOwnProperty(type)) throw new Error(\"unknown type: \" + type);\n for (t = this._[type], i = 0, n = t.length; i < n; ++i) t[i].value.apply(that, args);\n },\n apply: function(type, that, args) {\n if (!this._.hasOwnProperty(type)) throw new Error(\"unknown type: \" + type);\n for (var t = this._[type], i = 0, n = t.length; i < n; ++i) t[i].value.apply(that, args);\n }\n};\n\nfunction get(type, name) {\n for (var i = 0, n = type.length, c; i < n; ++i) {\n if ((c = type[i]).name === name) {\n return c.value;\n }\n }\n}\n\nfunction set(type, name, callback) {\n for (var i = 0, n = type.length; i < n; ++i) {\n if (type[i].name === name) {\n type[i] = noop, type = type.slice(0, i).concat(type.slice(i + 1));\n break;\n }\n }\n if (callback != null) type.push({name: name, value: callback});\n return type;\n}\n\nvar xhtml = \"http://www.w3.org/1999/xhtml\";\n\nvar namespaces = {\n svg: \"http://www.w3.org/2000/svg\",\n xhtml: xhtml,\n xlink: \"http://www.w3.org/1999/xlink\",\n xml: \"http://www.w3.org/XML/1998/namespace\",\n xmlns: \"http://www.w3.org/2000/xmlns/\"\n};\n\nvar namespace = function(name) {\n var prefix = name += \"\", i = prefix.indexOf(\":\");\n if (i >= 0 && (prefix = name.slice(0, i)) !== \"xmlns\") name = name.slice(i + 1);\n return namespaces.hasOwnProperty(prefix) ? {space: namespaces[prefix], local: name} : name;\n};\n\nfunction creatorInherit(name) {\n return function() {\n var document = this.ownerDocument,\n uri = this.namespaceURI;\n return uri === xhtml && document.documentElement.namespaceURI === xhtml\n ? document.createElement(name)\n : document.createElementNS(uri, name);\n };\n}\n\nfunction creatorFixed(fullname) {\n return function() {\n return this.ownerDocument.createElementNS(fullname.space, fullname.local);\n };\n}\n\nvar creator = function(name) {\n var fullname = namespace(name);\n return (fullname.local\n ? creatorFixed\n : creatorInherit)(fullname);\n};\n\nvar nextId = 0;\n\nfunction local$1() {\n return new Local;\n}\n\nfunction Local() {\n this._ = \"@\" + (++nextId).toString(36);\n}\n\nLocal.prototype = local$1.prototype = {\n constructor: Local,\n get: function(node) {\n var id = this._;\n while (!(id in node)) if (!(node = node.parentNode)) return;\n return node[id];\n },\n set: function(node, value) {\n return node[this._] = value;\n },\n remove: function(node) {\n return this._ in node && delete node[this._];\n },\n toString: function() {\n return this._;\n }\n};\n\nvar matcher = function(selector) {\n return function() {\n return this.matches(selector);\n };\n};\n\nif (typeof document !== \"undefined\") {\n var element = document.documentElement;\n if (!element.matches) {\n var vendorMatches = element.webkitMatchesSelector\n || element.msMatchesSelector\n || element.mozMatchesSelector\n || element.oMatchesSelector;\n matcher = function(selector) {\n return function() {\n return vendorMatches.call(this, selector);\n };\n };\n }\n}\n\nvar matcher$1 = matcher;\n\nvar filterEvents = {};\n\nexports.event = null;\n\nif (typeof document !== \"undefined\") {\n var element$1 = document.documentElement;\n if (!(\"onmouseenter\" in element$1)) {\n filterEvents = {mouseenter: \"mouseover\", mouseleave: \"mouseout\"};\n }\n}\n\nfunction filterContextListener(listener, index, group) {\n listener = contextListener(listener, index, group);\n return function(event) {\n var related = event.relatedTarget;\n if (!related || (related !== this && !(related.compareDocumentPosition(this) & 8))) {\n listener.call(this, event);\n }\n };\n}\n\nfunction contextListener(listener, index, group) {\n return function(event1) {\n var event0 = exports.event; // Events can be reentrant (e.g., focus).\n exports.event = event1;\n try {\n listener.call(this, this.__data__, index, group);\n } finally {\n exports.event = event0;\n }\n };\n}\n\nfunction parseTypenames$1(typenames) {\n return typenames.trim().split(/^|\\s+/).map(function(t) {\n var name = \"\", i = t.indexOf(\".\");\n if (i >= 0) name = t.slice(i + 1), t = t.slice(0, i);\n return {type: t, name: name};\n });\n}\n\nfunction onRemove(typename) {\n return function() {\n var on = this.__on;\n if (!on) return;\n for (var j = 0, i = -1, m = on.length, o; j < m; ++j) {\n if (o = on[j], (!typename.type || o.type === typename.type) && o.name === typename.name) {\n this.removeEventListener(o.type, o.listener, o.capture);\n } else {\n on[++i] = o;\n }\n }\n if (++i) on.length = i;\n else delete this.__on;\n };\n}\n\nfunction onAdd(typename, value, capture) {\n var wrap = filterEvents.hasOwnProperty(typename.type) ? filterContextListener : contextListener;\n return function(d, i, group) {\n var on = this.__on, o, listener = wrap(value, i, group);\n if (on) for (var j = 0, m = on.length; j < m; ++j) {\n if ((o = on[j]).type === typename.type && o.name === typename.name) {\n this.removeEventListener(o.type, o.listener, o.capture);\n this.addEventListener(o.type, o.listener = listener, o.capture = capture);\n o.value = value;\n return;\n }\n }\n this.addEventListener(typename.type, listener, capture);\n o = {type: typename.type, name: typename.name, value: value, listener: listener, capture: capture};\n if (!on) this.__on = [o];\n else on.push(o);\n };\n}\n\nvar selection_on = function(typename, value, capture) {\n var typenames = parseTypenames$1(typename + \"\"), i, n = typenames.length, t;\n\n if (arguments.length < 2) {\n var on = this.node().__on;\n if (on) for (var j = 0, m = on.length, o; j < m; ++j) {\n for (i = 0, o = on[j]; i < n; ++i) {\n if ((t = typenames[i]).type === o.type && t.name === o.name) {\n return o.value;\n }\n }\n }\n return;\n }\n\n on = value ? onAdd : onRemove;\n if (capture == null) capture = false;\n for (i = 0; i < n; ++i) this.each(on(typenames[i], value, capture));\n return this;\n};\n\nfunction customEvent(event1, listener, that, args) {\n var event0 = exports.event;\n event1.sourceEvent = exports.event;\n exports.event = event1;\n try {\n return listener.apply(that, args);\n } finally {\n exports.event = event0;\n }\n}\n\nvar sourceEvent = function() {\n var current = exports.event, source;\n while (source = current.sourceEvent) current = source;\n return current;\n};\n\nvar point = function(node, event) {\n var svg = node.ownerSVGElement || node;\n\n if (svg.createSVGPoint) {\n var point = svg.createSVGPoint();\n point.x = event.clientX, point.y = event.clientY;\n point = point.matrixTransform(node.getScreenCTM().inverse());\n return [point.x, point.y];\n }\n\n var rect = node.getBoundingClientRect();\n return [event.clientX - rect.left - node.clientLeft, event.clientY - rect.top - node.clientTop];\n};\n\nvar mouse = function(node) {\n var event = sourceEvent();\n if (event.changedTouches) event = event.changedTouches[0];\n return point(node, event);\n};\n\nfunction none() {}\n\nvar selector = function(selector) {\n return selector == null ? none : function() {\n return this.querySelector(selector);\n };\n};\n\nvar selection_select = function(select) {\n if (typeof select !== \"function\") select = selector(select);\n\n for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, subgroup = subgroups[j] = new Array(n), node, subnode, i = 0; i < n; ++i) {\n if ((node = group[i]) && (subnode = select.call(node, node.__data__, i, group))) {\n if (\"__data__\" in node) subnode.__data__ = node.__data__;\n subgroup[i] = subnode;\n }\n }\n }\n\n return new Selection(subgroups, this._parents);\n};\n\nfunction empty$1() {\n return [];\n}\n\nvar selectorAll = function(selector) {\n return selector == null ? empty$1 : function() {\n return this.querySelectorAll(selector);\n };\n};\n\nvar selection_selectAll = function(select) {\n if (typeof select !== \"function\") select = selectorAll(select);\n\n for (var groups = this._groups, m = groups.length, subgroups = [], parents = [], j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) {\n if (node = group[i]) {\n subgroups.push(select.call(node, node.__data__, i, group));\n parents.push(node);\n }\n }\n }\n\n return new Selection(subgroups, parents);\n};\n\nvar selection_filter = function(match) {\n if (typeof match !== \"function\") match = matcher$1(match);\n\n for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, subgroup = subgroups[j] = [], node, i = 0; i < n; ++i) {\n if ((node = group[i]) && match.call(node, node.__data__, i, group)) {\n subgroup.push(node);\n }\n }\n }\n\n return new Selection(subgroups, this._parents);\n};\n\nvar sparse = function(update) {\n return new Array(update.length);\n};\n\nvar selection_enter = function() {\n return new Selection(this._enter || this._groups.map(sparse), this._parents);\n};\n\nfunction EnterNode(parent, datum) {\n this.ownerDocument = parent.ownerDocument;\n this.namespaceURI = parent.namespaceURI;\n this._next = null;\n this._parent = parent;\n this.__data__ = datum;\n}\n\nEnterNode.prototype = {\n constructor: EnterNode,\n appendChild: function(child) { return this._parent.insertBefore(child, this._next); },\n insertBefore: function(child, next) { return this._parent.insertBefore(child, next); },\n querySelector: function(selector) { return this._parent.querySelector(selector); },\n querySelectorAll: function(selector) { return this._parent.querySelectorAll(selector); }\n};\n\nvar constant$1 = function(x) {\n return function() {\n return x;\n };\n};\n\nvar keyPrefix = \"$\"; // Protect against keys like “__proto__”.\n\nfunction bindIndex(parent, group, enter, update, exit, data) {\n var i = 0,\n node,\n groupLength = group.length,\n dataLength = data.length;\n\n // Put any non-null nodes that fit into update.\n // Put any null nodes into enter.\n // Put any remaining data into enter.\n for (; i < dataLength; ++i) {\n if (node = group[i]) {\n node.__data__ = data[i];\n update[i] = node;\n } else {\n enter[i] = new EnterNode(parent, data[i]);\n }\n }\n\n // Put any non-null nodes that don’t fit into exit.\n for (; i < groupLength; ++i) {\n if (node = group[i]) {\n exit[i] = node;\n }\n }\n}\n\nfunction bindKey(parent, group, enter, update, exit, data, key) {\n var i,\n node,\n nodeByKeyValue = {},\n groupLength = group.length,\n dataLength = data.length,\n keyValues = new Array(groupLength),\n keyValue;\n\n // Compute the key for each node.\n // If multiple nodes have the same key, the duplicates are added to exit.\n for (i = 0; i < groupLength; ++i) {\n if (node = group[i]) {\n keyValues[i] = keyValue = keyPrefix + key.call(node, node.__data__, i, group);\n if (keyValue in nodeByKeyValue) {\n exit[i] = node;\n } else {\n nodeByKeyValue[keyValue] = node;\n }\n }\n }\n\n // Compute the key for each datum.\n // If there a node associated with this key, join and add it to update.\n // If there is not (or the key is a duplicate), add it to enter.\n for (i = 0; i < dataLength; ++i) {\n keyValue = keyPrefix + key.call(parent, data[i], i, data);\n if (node = nodeByKeyValue[keyValue]) {\n update[i] = node;\n node.__data__ = data[i];\n nodeByKeyValue[keyValue] = null;\n } else {\n enter[i] = new EnterNode(parent, data[i]);\n }\n }\n\n // Add any remaining nodes that were not bound to data to exit.\n for (i = 0; i < groupLength; ++i) {\n if ((node = group[i]) && (nodeByKeyValue[keyValues[i]] === node)) {\n exit[i] = node;\n }\n }\n}\n\nvar selection_data = function(value, key) {\n if (!value) {\n data = new Array(this.size()), j = -1;\n this.each(function(d) { data[++j] = d; });\n return data;\n }\n\n var bind = key ? bindKey : bindIndex,\n parents = this._parents,\n groups = this._groups;\n\n if (typeof value !== \"function\") value = constant$1(value);\n\n for (var m = groups.length, update = new Array(m), enter = new Array(m), exit = new Array(m), j = 0; j < m; ++j) {\n var parent = parents[j],\n group = groups[j],\n groupLength = group.length,\n data = value.call(parent, parent && parent.__data__, j, parents),\n dataLength = data.length,\n enterGroup = enter[j] = new Array(dataLength),\n updateGroup = update[j] = new Array(dataLength),\n exitGroup = exit[j] = new Array(groupLength);\n\n bind(parent, group, enterGroup, updateGroup, exitGroup, data, key);\n\n // Now connect the enter nodes to their following update node, such that\n // appendChild can insert the materialized enter node before this node,\n // rather than at the end of the parent node.\n for (var i0 = 0, i1 = 0, previous, next; i0 < dataLength; ++i0) {\n if (previous = enterGroup[i0]) {\n if (i0 >= i1) i1 = i0 + 1;\n while (!(next = updateGroup[i1]) && ++i1 < dataLength);\n previous._next = next || null;\n }\n }\n }\n\n update = new Selection(update, parents);\n update._enter = enter;\n update._exit = exit;\n return update;\n};\n\nvar selection_exit = function() {\n return new Selection(this._exit || this._groups.map(sparse), this._parents);\n};\n\nvar selection_merge = function(selection$$1) {\n\n for (var groups0 = this._groups, groups1 = selection$$1._groups, m0 = groups0.length, m1 = groups1.length, m = Math.min(m0, m1), merges = new Array(m0), j = 0; j < m; ++j) {\n for (var group0 = groups0[j], group1 = groups1[j], n = group0.length, merge = merges[j] = new Array(n), node, i = 0; i < n; ++i) {\n if (node = group0[i] || group1[i]) {\n merge[i] = node;\n }\n }\n }\n\n for (; j < m0; ++j) {\n merges[j] = groups0[j];\n }\n\n return new Selection(merges, this._parents);\n};\n\nvar selection_order = function() {\n\n for (var groups = this._groups, j = -1, m = groups.length; ++j < m;) {\n for (var group = groups[j], i = group.length - 1, next = group[i], node; --i >= 0;) {\n if (node = group[i]) {\n if (next && next !== node.nextSibling) next.parentNode.insertBefore(node, next);\n next = node;\n }\n }\n }\n\n return this;\n};\n\nvar selection_sort = function(compare) {\n if (!compare) compare = ascending$1;\n\n function compareNode(a, b) {\n return a && b ? compare(a.__data__, b.__data__) : !a - !b;\n }\n\n for (var groups = this._groups, m = groups.length, sortgroups = new Array(m), j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, sortgroup = sortgroups[j] = new Array(n), node, i = 0; i < n; ++i) {\n if (node = group[i]) {\n sortgroup[i] = node;\n }\n }\n sortgroup.sort(compareNode);\n }\n\n return new Selection(sortgroups, this._parents).order();\n};\n\nfunction ascending$1(a, b) {\n return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;\n}\n\nvar selection_call = function() {\n var callback = arguments[0];\n arguments[0] = this;\n callback.apply(null, arguments);\n return this;\n};\n\nvar selection_nodes = function() {\n var nodes = new Array(this.size()), i = -1;\n this.each(function() { nodes[++i] = this; });\n return nodes;\n};\n\nvar selection_node = function() {\n\n for (var groups = this._groups, j = 0, m = groups.length; j < m; ++j) {\n for (var group = groups[j], i = 0, n = group.length; i < n; ++i) {\n var node = group[i];\n if (node) return node;\n }\n }\n\n return null;\n};\n\nvar selection_size = function() {\n var size = 0;\n this.each(function() { ++size; });\n return size;\n};\n\nvar selection_empty = function() {\n return !this.node();\n};\n\nvar selection_each = function(callback) {\n\n for (var groups = this._groups, j = 0, m = groups.length; j < m; ++j) {\n for (var group = groups[j], i = 0, n = group.length, node; i < n; ++i) {\n if (node = group[i]) callback.call(node, node.__data__, i, group);\n }\n }\n\n return this;\n};\n\nfunction attrRemove(name) {\n return function() {\n this.removeAttribute(name);\n };\n}\n\nfunction attrRemoveNS(fullname) {\n return function() {\n this.removeAttributeNS(fullname.space, fullname.local);\n };\n}\n\nfunction attrConstant(name, value) {\n return function() {\n this.setAttribute(name, value);\n };\n}\n\nfunction attrConstantNS(fullname, value) {\n return function() {\n this.setAttributeNS(fullname.space, fullname.local, value);\n };\n}\n\nfunction attrFunction(name, value) {\n return function() {\n var v = value.apply(this, arguments);\n if (v == null) this.removeAttribute(name);\n else this.setAttribute(name, v);\n };\n}\n\nfunction attrFunctionNS(fullname, value) {\n return function() {\n var v = value.apply(this, arguments);\n if (v == null) this.removeAttributeNS(fullname.space, fullname.local);\n else this.setAttributeNS(fullname.space, fullname.local, v);\n };\n}\n\nvar selection_attr = function(name, value) {\n var fullname = namespace(name);\n\n if (arguments.length < 2) {\n var node = this.node();\n return fullname.local\n ? node.getAttributeNS(fullname.space, fullname.local)\n : node.getAttribute(fullname);\n }\n\n return this.each((value == null\n ? (fullname.local ? attrRemoveNS : attrRemove) : (typeof value === \"function\"\n ? (fullname.local ? attrFunctionNS : attrFunction)\n : (fullname.local ? attrConstantNS : attrConstant)))(fullname, value));\n};\n\nvar defaultView = function(node) {\n return (node.ownerDocument && node.ownerDocument.defaultView) // node is a Node\n || (node.document && node) // node is a Window\n || node.defaultView; // node is a Document\n};\n\nfunction styleRemove(name) {\n return function() {\n this.style.removeProperty(name);\n };\n}\n\nfunction styleConstant(name, value, priority) {\n return function() {\n this.style.setProperty(name, value, priority);\n };\n}\n\nfunction styleFunction(name, value, priority) {\n return function() {\n var v = value.apply(this, arguments);\n if (v == null) this.style.removeProperty(name);\n else this.style.setProperty(name, v, priority);\n };\n}\n\nvar selection_style = function(name, value, priority) {\n return arguments.length > 1\n ? this.each((value == null\n ? styleRemove : typeof value === \"function\"\n ? styleFunction\n : styleConstant)(name, value, priority == null ? \"\" : priority))\n : styleValue(this.node(), name);\n};\n\nfunction styleValue(node, name) {\n return node.style.getPropertyValue(name)\n || defaultView(node).getComputedStyle(node, null).getPropertyValue(name);\n}\n\nfunction propertyRemove(name) {\n return function() {\n delete this[name];\n };\n}\n\nfunction propertyConstant(name, value) {\n return function() {\n this[name] = value;\n };\n}\n\nfunction propertyFunction(name, value) {\n return function() {\n var v = value.apply(this, arguments);\n if (v == null) delete this[name];\n else this[name] = v;\n };\n}\n\nvar selection_property = function(name, value) {\n return arguments.length > 1\n ? this.each((value == null\n ? propertyRemove : typeof value === \"function\"\n ? propertyFunction\n : propertyConstant)(name, value))\n : this.node()[name];\n};\n\nfunction classArray(string) {\n return string.trim().split(/^|\\s+/);\n}\n\nfunction classList(node) {\n return node.classList || new ClassList(node);\n}\n\nfunction ClassList(node) {\n this._node = node;\n this._names = classArray(node.getAttribute(\"class\") || \"\");\n}\n\nClassList.prototype = {\n add: function(name) {\n var i = this._names.indexOf(name);\n if (i < 0) {\n this._names.push(name);\n this._node.setAttribute(\"class\", this._names.join(\" \"));\n }\n },\n remove: function(name) {\n var i = this._names.indexOf(name);\n if (i >= 0) {\n this._names.splice(i, 1);\n this._node.setAttribute(\"class\", this._names.join(\" \"));\n }\n },\n contains: function(name) {\n return this._names.indexOf(name) >= 0;\n }\n};\n\nfunction classedAdd(node, names) {\n var list = classList(node), i = -1, n = names.length;\n while (++i < n) list.add(names[i]);\n}\n\nfunction classedRemove(node, names) {\n var list = classList(node), i = -1, n = names.length;\n while (++i < n) list.remove(names[i]);\n}\n\nfunction classedTrue(names) {\n return function() {\n classedAdd(this, names);\n };\n}\n\nfunction classedFalse(names) {\n return function() {\n classedRemove(this, names);\n };\n}\n\nfunction classedFunction(names, value) {\n return function() {\n (value.apply(this, arguments) ? classedAdd : classedRemove)(this, names);\n };\n}\n\nvar selection_classed = function(name, value) {\n var names = classArray(name + \"\");\n\n if (arguments.length < 2) {\n var list = classList(this.node()), i = -1, n = names.length;\n while (++i < n) if (!list.contains(names[i])) return false;\n return true;\n }\n\n return this.each((typeof value === \"function\"\n ? classedFunction : value\n ? classedTrue\n : classedFalse)(names, value));\n};\n\nfunction textRemove() {\n this.textContent = \"\";\n}\n\nfunction textConstant(value) {\n return function() {\n this.textContent = value;\n };\n}\n\nfunction textFunction(value) {\n return function() {\n var v = value.apply(this, arguments);\n this.textContent = v == null ? \"\" : v;\n };\n}\n\nvar selection_text = function(value) {\n return arguments.length\n ? this.each(value == null\n ? textRemove : (typeof value === \"function\"\n ? textFunction\n : textConstant)(value))\n : this.node().textContent;\n};\n\nfunction htmlRemove() {\n this.innerHTML = \"\";\n}\n\nfunction htmlConstant(value) {\n return function() {\n this.innerHTML = value;\n };\n}\n\nfunction htmlFunction(value) {\n return function() {\n var v = value.apply(this, arguments);\n this.innerHTML = v == null ? \"\" : v;\n };\n}\n\nvar selection_html = function(value) {\n return arguments.length\n ? this.each(value == null\n ? htmlRemove : (typeof value === \"function\"\n ? htmlFunction\n : htmlConstant)(value))\n : this.node().innerHTML;\n};\n\nfunction raise() {\n if (this.nextSibling) this.parentNode.appendChild(this);\n}\n\nvar selection_raise = function() {\n return this.each(raise);\n};\n\nfunction lower() {\n if (this.previousSibling) this.parentNode.insertBefore(this, this.parentNode.firstChild);\n}\n\nvar selection_lower = function() {\n return this.each(lower);\n};\n\nvar selection_append = function(name) {\n var create = typeof name === \"function\" ? name : creator(name);\n return this.select(function() {\n return this.appendChild(create.apply(this, arguments));\n });\n};\n\nfunction constantNull() {\n return null;\n}\n\nvar selection_insert = function(name, before) {\n var create = typeof name === \"function\" ? name : creator(name),\n select = before == null ? constantNull : typeof before === \"function\" ? before : selector(before);\n return this.select(function() {\n return this.insertBefore(create.apply(this, arguments), select.apply(this, arguments) || null);\n });\n};\n\nfunction remove() {\n var parent = this.parentNode;\n if (parent) parent.removeChild(this);\n}\n\nvar selection_remove = function() {\n return this.each(remove);\n};\n\nvar selection_datum = function(value) {\n return arguments.length\n ? this.property(\"__data__\", value)\n : this.node().__data__;\n};\n\nfunction dispatchEvent(node, type, params) {\n var window = defaultView(node),\n event = window.CustomEvent;\n\n if (typeof event === \"function\") {\n event = new event(type, params);\n } else {\n event = window.document.createEvent(\"Event\");\n if (params) event.initEvent(type, params.bubbles, params.cancelable), event.detail = params.detail;\n else event.initEvent(type, false, false);\n }\n\n node.dispatchEvent(event);\n}\n\nfunction dispatchConstant(type, params) {\n return function() {\n return dispatchEvent(this, type, params);\n };\n}\n\nfunction dispatchFunction(type, params) {\n return function() {\n return dispatchEvent(this, type, params.apply(this, arguments));\n };\n}\n\nvar selection_dispatch = function(type, params) {\n return this.each((typeof params === \"function\"\n ? dispatchFunction\n : dispatchConstant)(type, params));\n};\n\nvar root = [null];\n\nfunction Selection(groups, parents) {\n this._groups = groups;\n this._parents = parents;\n}\n\nfunction selection() {\n return new Selection([[document.documentElement]], root);\n}\n\nSelection.prototype = selection.prototype = {\n constructor: Selection,\n select: selection_select,\n selectAll: selection_selectAll,\n filter: selection_filter,\n data: selection_data,\n enter: selection_enter,\n exit: selection_exit,\n merge: selection_merge,\n order: selection_order,\n sort: selection_sort,\n call: selection_call,\n nodes: selection_nodes,\n node: selection_node,\n size: selection_size,\n empty: selection_empty,\n each: selection_each,\n attr: selection_attr,\n style: selection_style,\n property: selection_property,\n classed: selection_classed,\n text: selection_text,\n html: selection_html,\n raise: selection_raise,\n lower: selection_lower,\n append: selection_append,\n insert: selection_insert,\n remove: selection_remove,\n datum: selection_datum,\n on: selection_on,\n dispatch: selection_dispatch\n};\n\nvar select = function(selector) {\n return typeof selector === \"string\"\n ? new Selection([[document.querySelector(selector)]], [document.documentElement])\n : new Selection([[selector]], root);\n};\n\nvar selectAll = function(selector) {\n return typeof selector === \"string\"\n ? new Selection([document.querySelectorAll(selector)], [document.documentElement])\n : new Selection([selector == null ? [] : selector], root);\n};\n\nvar touch = function(node, touches, identifier) {\n if (arguments.length < 3) identifier = touches, touches = sourceEvent().changedTouches;\n\n for (var i = 0, n = touches ? touches.length : 0, touch; i < n; ++i) {\n if ((touch = touches[i]).identifier === identifier) {\n return point(node, touch);\n }\n }\n\n return null;\n};\n\nvar touches = function(node, touches) {\n if (touches == null) touches = sourceEvent().touches;\n\n for (var i = 0, n = touches ? touches.length : 0, points = new Array(n); i < n; ++i) {\n points[i] = point(node, touches[i]);\n }\n\n return points;\n};\n\nfunction nopropagation() {\n exports.event.stopImmediatePropagation();\n}\n\nvar noevent = function() {\n exports.event.preventDefault();\n exports.event.stopImmediatePropagation();\n};\n\nvar dragDisable = function(view) {\n var root = view.document.documentElement,\n selection = select(view).on(\"dragstart.drag\", noevent, true);\n if (\"onselectstart\" in root) {\n selection.on(\"selectstart.drag\", noevent, true);\n } else {\n root.__noselect = root.style.MozUserSelect;\n root.style.MozUserSelect = \"none\";\n }\n};\n\nfunction yesdrag(view, noclick) {\n var root = view.document.documentElement,\n selection = select(view).on(\"dragstart.drag\", null);\n if (noclick) {\n selection.on(\"click.drag\", noevent, true);\n setTimeout(function() { selection.on(\"click.drag\", null); }, 0);\n }\n if (\"onselectstart\" in root) {\n selection.on(\"selectstart.drag\", null);\n } else {\n root.style.MozUserSelect = root.__noselect;\n delete root.__noselect;\n }\n}\n\nvar constant$2 = function(x) {\n return function() {\n return x;\n };\n};\n\nfunction DragEvent(target, type, subject, id, active, x, y, dx, dy, dispatch) {\n this.target = target;\n this.type = type;\n this.subject = subject;\n this.identifier = id;\n this.active = active;\n this.x = x;\n this.y = y;\n this.dx = dx;\n this.dy = dy;\n this._ = dispatch;\n}\n\nDragEvent.prototype.on = function() {\n var value = this._.on.apply(this._, arguments);\n return value === this._ ? this : value;\n};\n\n// Ignore right-click, since that should open the context menu.\nfunction defaultFilter$1() {\n return !exports.event.button;\n}\n\nfunction defaultContainer() {\n return this.parentNode;\n}\n\nfunction defaultSubject(d) {\n return d == null ? {x: exports.event.x, y: exports.event.y} : d;\n}\n\nfunction defaultTouchable() {\n return \"ontouchstart\" in this;\n}\n\nvar drag = function() {\n var filter = defaultFilter$1,\n container = defaultContainer,\n subject = defaultSubject,\n touchable = defaultTouchable,\n gestures = {},\n listeners = dispatch(\"start\", \"drag\", \"end\"),\n active = 0,\n mousedownx,\n mousedowny,\n mousemoving,\n touchending,\n clickDistance2 = 0;\n\n function drag(selection) {\n selection\n .on(\"mousedown.drag\", mousedowned)\n .filter(touchable)\n .on(\"touchstart.drag\", touchstarted)\n .on(\"touchmove.drag\", touchmoved)\n .on(\"touchend.drag touchcancel.drag\", touchended)\n .style(\"touch-action\", \"none\")\n .style(\"-webkit-tap-highlight-color\", \"rgba(0,0,0,0)\");\n }\n\n function mousedowned() {\n if (touchending || !filter.apply(this, arguments)) return;\n var gesture = beforestart(\"mouse\", container.apply(this, arguments), mouse, this, arguments);\n if (!gesture) return;\n select(exports.event.view).on(\"mousemove.drag\", mousemoved, true).on(\"mouseup.drag\", mouseupped, true);\n dragDisable(exports.event.view);\n nopropagation();\n mousemoving = false;\n mousedownx = exports.event.clientX;\n mousedowny = exports.event.clientY;\n gesture(\"start\");\n }\n\n function mousemoved() {\n noevent();\n if (!mousemoving) {\n var dx = exports.event.clientX - mousedownx, dy = exports.event.clientY - mousedowny;\n mousemoving = dx * dx + dy * dy > clickDistance2;\n }\n gestures.mouse(\"drag\");\n }\n\n function mouseupped() {\n select(exports.event.view).on(\"mousemove.drag mouseup.drag\", null);\n yesdrag(exports.event.view, mousemoving);\n noevent();\n gestures.mouse(\"end\");\n }\n\n function touchstarted() {\n if (!filter.apply(this, arguments)) return;\n var touches = exports.event.changedTouches,\n c = container.apply(this, arguments),\n n = touches.length, i, gesture;\n\n for (i = 0; i < n; ++i) {\n if (gesture = beforestart(touches[i].identifier, c, touch, this, arguments)) {\n nopropagation();\n gesture(\"start\");\n }\n }\n }\n\n function touchmoved() {\n var touches = exports.event.changedTouches,\n n = touches.length, i, gesture;\n\n for (i = 0; i < n; ++i) {\n if (gesture = gestures[touches[i].identifier]) {\n noevent();\n gesture(\"drag\");\n }\n }\n }\n\n function touchended() {\n var touches = exports.event.changedTouches,\n n = touches.length, i, gesture;\n\n if (touchending) clearTimeout(touchending);\n touchending = setTimeout(function() { touchending = null; }, 500); // Ghost clicks are delayed!\n for (i = 0; i < n; ++i) {\n if (gesture = gestures[touches[i].identifier]) {\n nopropagation();\n gesture(\"end\");\n }\n }\n }\n\n function beforestart(id, container, point, that, args) {\n var p = point(container, id), s, dx, dy,\n sublisteners = listeners.copy();\n\n if (!customEvent(new DragEvent(drag, \"beforestart\", s, id, active, p[0], p[1], 0, 0, sublisteners), function() {\n if ((exports.event.subject = s = subject.apply(that, args)) == null) return false;\n dx = s.x - p[0] || 0;\n dy = s.y - p[1] || 0;\n return true;\n })) return;\n\n return function gesture(type) {\n var p0 = p, n;\n switch (type) {\n case \"start\": gestures[id] = gesture, n = active++; break;\n case \"end\": delete gestures[id], --active; // nobreak\n case \"drag\": p = point(container, id), n = active; break;\n }\n customEvent(new DragEvent(drag, type, s, id, n, p[0] + dx, p[1] + dy, p[0] - p0[0], p[1] - p0[1], sublisteners), sublisteners.apply, sublisteners, [type, that, args]);\n };\n }\n\n drag.filter = function(_) {\n return arguments.length ? (filter = typeof _ === \"function\" ? _ : constant$2(!!_), drag) : filter;\n };\n\n drag.container = function(_) {\n return arguments.length ? (container = typeof _ === \"function\" ? _ : constant$2(_), drag) : container;\n };\n\n drag.subject = function(_) {\n return arguments.length ? (subject = typeof _ === \"function\" ? _ : constant$2(_), drag) : subject;\n };\n\n drag.touchable = function(_) {\n return arguments.length ? (touchable = typeof _ === \"function\" ? _ : constant$2(!!_), drag) : touchable;\n };\n\n drag.on = function() {\n var value = listeners.on.apply(listeners, arguments);\n return value === listeners ? drag : value;\n };\n\n drag.clickDistance = function(_) {\n return arguments.length ? (clickDistance2 = (_ = +_) * _, drag) : Math.sqrt(clickDistance2);\n };\n\n return drag;\n};\n\nvar define = function(constructor, factory, prototype) {\n constructor.prototype = factory.prototype = prototype;\n prototype.constructor = constructor;\n};\n\nfunction extend(parent, definition) {\n var prototype = Object.create(parent.prototype);\n for (var key in definition) prototype[key] = definition[key];\n return prototype;\n}\n\nfunction Color() {}\n\nvar darker = 0.7;\nvar brighter = 1 / darker;\n\nvar reI = \"\\\\s*([+-]?\\\\d+)\\\\s*\";\nvar reN = \"\\\\s*([+-]?\\\\d*\\\\.?\\\\d+(?:[eE][+-]?\\\\d+)?)\\\\s*\";\nvar reP = \"\\\\s*([+-]?\\\\d*\\\\.?\\\\d+(?:[eE][+-]?\\\\d+)?)%\\\\s*\";\nvar reHex3 = /^#([0-9a-f]{3})$/;\nvar reHex6 = /^#([0-9a-f]{6})$/;\nvar reRgbInteger = new RegExp(\"^rgb\\\\(\" + [reI, reI, reI] + \"\\\\)$\");\nvar reRgbPercent = new RegExp(\"^rgb\\\\(\" + [reP, reP, reP] + \"\\\\)$\");\nvar reRgbaInteger = new RegExp(\"^rgba\\\\(\" + [reI, reI, reI, reN] + \"\\\\)$\");\nvar reRgbaPercent = new RegExp(\"^rgba\\\\(\" + [reP, reP, reP, reN] + \"\\\\)$\");\nvar reHslPercent = new RegExp(\"^hsl\\\\(\" + [reN, reP, reP] + \"\\\\)$\");\nvar reHslaPercent = new RegExp(\"^hsla\\\\(\" + [reN, reP, reP, reN] + \"\\\\)$\");\n\nvar named = {\n aliceblue: 0xf0f8ff,\n antiquewhite: 0xfaebd7,\n aqua: 0x00ffff,\n aquamarine: 0x7fffd4,\n azure: 0xf0ffff,\n beige: 0xf5f5dc,\n bisque: 0xffe4c4,\n black: 0x000000,\n blanchedalmond: 0xffebcd,\n blue: 0x0000ff,\n blueviolet: 0x8a2be2,\n brown: 0xa52a2a,\n burlywood: 0xdeb887,\n cadetblue: 0x5f9ea0,\n chartreuse: 0x7fff00,\n chocolate: 0xd2691e,\n coral: 0xff7f50,\n cornflowerblue: 0x6495ed,\n cornsilk: 0xfff8dc,\n crimson: 0xdc143c,\n cyan: 0x00ffff,\n darkblue: 0x00008b,\n darkcyan: 0x008b8b,\n darkgoldenrod: 0xb8860b,\n darkgray: 0xa9a9a9,\n darkgreen: 0x006400,\n darkgrey: 0xa9a9a9,\n darkkhaki: 0xbdb76b,\n darkmagenta: 0x8b008b,\n darkolivegreen: 0x556b2f,\n darkorange: 0xff8c00,\n darkorchid: 0x9932cc,\n darkred: 0x8b0000,\n darksalmon: 0xe9967a,\n darkseagreen: 0x8fbc8f,\n darkslateblue: 0x483d8b,\n darkslategray: 0x2f4f4f,\n darkslategrey: 0x2f4f4f,\n darkturquoise: 0x00ced1,\n darkviolet: 0x9400d3,\n deeppink: 0xff1493,\n deepskyblue: 0x00bfff,\n dimgray: 0x696969,\n dimgrey: 0x696969,\n dodgerblue: 0x1e90ff,\n firebrick: 0xb22222,\n floralwhite: 0xfffaf0,\n forestgreen: 0x228b22,\n fuchsia: 0xff00ff,\n gainsboro: 0xdcdcdc,\n ghostwhite: 0xf8f8ff,\n gold: 0xffd700,\n goldenrod: 0xdaa520,\n gray: 0x808080,\n green: 0x008000,\n greenyellow: 0xadff2f,\n grey: 0x808080,\n honeydew: 0xf0fff0,\n hotpink: 0xff69b4,\n indianred: 0xcd5c5c,\n indigo: 0x4b0082,\n ivory: 0xfffff0,\n khaki: 0xf0e68c,\n lavender: 0xe6e6fa,\n lavenderblush: 0xfff0f5,\n lawngreen: 0x7cfc00,\n lemonchiffon: 0xfffacd,\n lightblue: 0xadd8e6,\n lightcoral: 0xf08080,\n lightcyan: 0xe0ffff,\n lightgoldenrodyellow: 0xfafad2,\n lightgray: 0xd3d3d3,\n lightgreen: 0x90ee90,\n lightgrey: 0xd3d3d3,\n lightpink: 0xffb6c1,\n lightsalmon: 0xffa07a,\n lightseagreen: 0x20b2aa,\n lightskyblue: 0x87cefa,\n lightslategray: 0x778899,\n lightslategrey: 0x778899,\n lightsteelblue: 0xb0c4de,\n lightyellow: 0xffffe0,\n lime: 0x00ff00,\n limegreen: 0x32cd32,\n linen: 0xfaf0e6,\n magenta: 0xff00ff,\n maroon: 0x800000,\n mediumaquamarine: 0x66cdaa,\n mediumblue: 0x0000cd,\n mediumorchid: 0xba55d3,\n mediumpurple: 0x9370db,\n mediumseagreen: 0x3cb371,\n mediumslateblue: 0x7b68ee,\n mediumspringgreen: 0x00fa9a,\n mediumturquoise: 0x48d1cc,\n mediumvioletred: 0xc71585,\n midnightblue: 0x191970,\n mintcream: 0xf5fffa,\n mistyrose: 0xffe4e1,\n moccasin: 0xffe4b5,\n navajowhite: 0xffdead,\n navy: 0x000080,\n oldlace: 0xfdf5e6,\n olive: 0x808000,\n olivedrab: 0x6b8e23,\n orange: 0xffa500,\n orangered: 0xff4500,\n orchid: 0xda70d6,\n palegoldenrod: 0xeee8aa,\n palegreen: 0x98fb98,\n paleturquoise: 0xafeeee,\n palevioletred: 0xdb7093,\n papayawhip: 0xffefd5,\n peachpuff: 0xffdab9,\n peru: 0xcd853f,\n pink: 0xffc0cb,\n plum: 0xdda0dd,\n powderblue: 0xb0e0e6,\n purple: 0x800080,\n rebeccapurple: 0x663399,\n red: 0xff0000,\n rosybrown: 0xbc8f8f,\n royalblue: 0x4169e1,\n saddlebrown: 0x8b4513,\n salmon: 0xfa8072,\n sandybrown: 0xf4a460,\n seagreen: 0x2e8b57,\n seashell: 0xfff5ee,\n sienna: 0xa0522d,\n silver: 0xc0c0c0,\n skyblue: 0x87ceeb,\n slateblue: 0x6a5acd,\n slategray: 0x708090,\n slategrey: 0x708090,\n snow: 0xfffafa,\n springgreen: 0x00ff7f,\n steelblue: 0x4682b4,\n tan: 0xd2b48c,\n teal: 0x008080,\n thistle: 0xd8bfd8,\n tomato: 0xff6347,\n turquoise: 0x40e0d0,\n violet: 0xee82ee,\n wheat: 0xf5deb3,\n white: 0xffffff,\n whitesmoke: 0xf5f5f5,\n yellow: 0xffff00,\n yellowgreen: 0x9acd32\n};\n\ndefine(Color, color, {\n displayable: function() {\n return this.rgb().displayable();\n },\n toString: function() {\n return this.rgb() + \"\";\n }\n});\n\nfunction color(format) {\n var m;\n format = (format + \"\").trim().toLowerCase();\n return (m = reHex3.exec(format)) ? (m = parseInt(m[1], 16), new Rgb((m >> 8 & 0xf) | (m >> 4 & 0x0f0), (m >> 4 & 0xf) | (m & 0xf0), ((m & 0xf) << 4) | (m & 0xf), 1)) // #f00\n : (m = reHex6.exec(format)) ? rgbn(parseInt(m[1], 16)) // #ff0000\n : (m = reRgbInteger.exec(format)) ? new Rgb(m[1], m[2], m[3], 1) // rgb(255, 0, 0)\n : (m = reRgbPercent.exec(format)) ? new Rgb(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, 1) // rgb(100%, 0%, 0%)\n : (m = reRgbaInteger.exec(format)) ? rgba(m[1], m[2], m[3], m[4]) // rgba(255, 0, 0, 1)\n : (m = reRgbaPercent.exec(format)) ? rgba(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, m[4]) // rgb(100%, 0%, 0%, 1)\n : (m = reHslPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, 1) // hsl(120, 50%, 50%)\n : (m = reHslaPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, m[4]) // hsla(120, 50%, 50%, 1)\n : named.hasOwnProperty(format) ? rgbn(named[format])\n : format === \"transparent\" ? new Rgb(NaN, NaN, NaN, 0)\n : null;\n}\n\nfunction rgbn(n) {\n return new Rgb(n >> 16 & 0xff, n >> 8 & 0xff, n & 0xff, 1);\n}\n\nfunction rgba(r, g, b, a) {\n if (a <= 0) r = g = b = NaN;\n return new Rgb(r, g, b, a);\n}\n\nfunction rgbConvert(o) {\n if (!(o instanceof Color)) o = color(o);\n if (!o) return new Rgb;\n o = o.rgb();\n return new Rgb(o.r, o.g, o.b, o.opacity);\n}\n\nfunction rgb(r, g, b, opacity) {\n return arguments.length === 1 ? rgbConvert(r) : new Rgb(r, g, b, opacity == null ? 1 : opacity);\n}\n\nfunction Rgb(r, g, b, opacity) {\n this.r = +r;\n this.g = +g;\n this.b = +b;\n this.opacity = +opacity;\n}\n\ndefine(Rgb, rgb, extend(Color, {\n brighter: function(k) {\n k = k == null ? brighter : Math.pow(brighter, k);\n return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);\n },\n darker: function(k) {\n k = k == null ? darker : Math.pow(darker, k);\n return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);\n },\n rgb: function() {\n return this;\n },\n displayable: function() {\n return (0 <= this.r && this.r <= 255)\n && (0 <= this.g && this.g <= 255)\n && (0 <= this.b && this.b <= 255)\n && (0 <= this.opacity && this.opacity <= 1);\n },\n toString: function() {\n var a = this.opacity; a = isNaN(a) ? 1 : Math.max(0, Math.min(1, a));\n return (a === 1 ? \"rgb(\" : \"rgba(\")\n + Math.max(0, Math.min(255, Math.round(this.r) || 0)) + \", \"\n + Math.max(0, Math.min(255, Math.round(this.g) || 0)) + \", \"\n + Math.max(0, Math.min(255, Math.round(this.b) || 0))\n + (a === 1 ? \")\" : \", \" + a + \")\");\n }\n}));\n\nfunction hsla(h, s, l, a) {\n if (a <= 0) h = s = l = NaN;\n else if (l <= 0 || l >= 1) h = s = NaN;\n else if (s <= 0) h = NaN;\n return new Hsl(h, s, l, a);\n}\n\nfunction hslConvert(o) {\n if (o instanceof Hsl) return new Hsl(o.h, o.s, o.l, o.opacity);\n if (!(o instanceof Color)) o = color(o);\n if (!o) return new Hsl;\n if (o instanceof Hsl) return o;\n o = o.rgb();\n var r = o.r / 255,\n g = o.g / 255,\n b = o.b / 255,\n min = Math.min(r, g, b),\n max = Math.max(r, g, b),\n h = NaN,\n s = max - min,\n l = (max + min) / 2;\n if (s) {\n if (r === max) h = (g - b) / s + (g < b) * 6;\n else if (g === max) h = (b - r) / s + 2;\n else h = (r - g) / s + 4;\n s /= l < 0.5 ? max + min : 2 - max - min;\n h *= 60;\n } else {\n s = l > 0 && l < 1 ? 0 : h;\n }\n return new Hsl(h, s, l, o.opacity);\n}\n\nfunction hsl(h, s, l, opacity) {\n return arguments.length === 1 ? hslConvert(h) : new Hsl(h, s, l, opacity == null ? 1 : opacity);\n}\n\nfunction Hsl(h, s, l, opacity) {\n this.h = +h;\n this.s = +s;\n this.l = +l;\n this.opacity = +opacity;\n}\n\ndefine(Hsl, hsl, extend(Color, {\n brighter: function(k) {\n k = k == null ? brighter : Math.pow(brighter, k);\n return new Hsl(this.h, this.s, this.l * k, this.opacity);\n },\n darker: function(k) {\n k = k == null ? darker : Math.pow(darker, k);\n return new Hsl(this.h, this.s, this.l * k, this.opacity);\n },\n rgb: function() {\n var h = this.h % 360 + (this.h < 0) * 360,\n s = isNaN(h) || isNaN(this.s) ? 0 : this.s,\n l = this.l,\n m2 = l + (l < 0.5 ? l : 1 - l) * s,\n m1 = 2 * l - m2;\n return new Rgb(\n hsl2rgb(h >= 240 ? h - 240 : h + 120, m1, m2),\n hsl2rgb(h, m1, m2),\n hsl2rgb(h < 120 ? h + 240 : h - 120, m1, m2),\n this.opacity\n );\n },\n displayable: function() {\n return (0 <= this.s && this.s <= 1 || isNaN(this.s))\n && (0 <= this.l && this.l <= 1)\n && (0 <= this.opacity && this.opacity <= 1);\n }\n}));\n\n/* From FvD 13.37, CSS Color Module Level 3 */\nfunction hsl2rgb(h, m1, m2) {\n return (h < 60 ? m1 + (m2 - m1) * h / 60\n : h < 180 ? m2\n : h < 240 ? m1 + (m2 - m1) * (240 - h) / 60\n : m1) * 255;\n}\n\nvar deg2rad = Math.PI / 180;\nvar rad2deg = 180 / Math.PI;\n\nvar Kn = 18;\nvar Xn = 0.950470;\nvar Yn = 1;\nvar Zn = 1.088830;\nvar t0 = 4 / 29;\nvar t1 = 6 / 29;\nvar t2 = 3 * t1 * t1;\nvar t3 = t1 * t1 * t1;\n\nfunction labConvert(o) {\n if (o instanceof Lab) return new Lab(o.l, o.a, o.b, o.opacity);\n if (o instanceof Hcl) {\n var h = o.h * deg2rad;\n return new Lab(o.l, Math.cos(h) * o.c, Math.sin(h) * o.c, o.opacity);\n }\n if (!(o instanceof Rgb)) o = rgbConvert(o);\n var b = rgb2xyz(o.r),\n a = rgb2xyz(o.g),\n l = rgb2xyz(o.b),\n x = xyz2lab((0.4124564 * b + 0.3575761 * a + 0.1804375 * l) / Xn),\n y = xyz2lab((0.2126729 * b + 0.7151522 * a + 0.0721750 * l) / Yn),\n z = xyz2lab((0.0193339 * b + 0.1191920 * a + 0.9503041 * l) / Zn);\n return new Lab(116 * y - 16, 500 * (x - y), 200 * (y - z), o.opacity);\n}\n\nfunction lab(l, a, b, opacity) {\n return arguments.length === 1 ? labConvert(l) : new Lab(l, a, b, opacity == null ? 1 : opacity);\n}\n\nfunction Lab(l, a, b, opacity) {\n this.l = +l;\n this.a = +a;\n this.b = +b;\n this.opacity = +opacity;\n}\n\ndefine(Lab, lab, extend(Color, {\n brighter: function(k) {\n return new Lab(this.l + Kn * (k == null ? 1 : k), this.a, this.b, this.opacity);\n },\n darker: function(k) {\n return new Lab(this.l - Kn * (k == null ? 1 : k), this.a, this.b, this.opacity);\n },\n rgb: function() {\n var y = (this.l + 16) / 116,\n x = isNaN(this.a) ? y : y + this.a / 500,\n z = isNaN(this.b) ? y : y - this.b / 200;\n y = Yn * lab2xyz(y);\n x = Xn * lab2xyz(x);\n z = Zn * lab2xyz(z);\n return new Rgb(\n xyz2rgb( 3.2404542 * x - 1.5371385 * y - 0.4985314 * z), // D65 -> sRGB\n xyz2rgb(-0.9692660 * x + 1.8760108 * y + 0.0415560 * z),\n xyz2rgb( 0.0556434 * x - 0.2040259 * y + 1.0572252 * z),\n this.opacity\n );\n }\n}));\n\nfunction xyz2lab(t) {\n return t > t3 ? Math.pow(t, 1 / 3) : t / t2 + t0;\n}\n\nfunction lab2xyz(t) {\n return t > t1 ? t * t * t : t2 * (t - t0);\n}\n\nfunction xyz2rgb(x) {\n return 255 * (x <= 0.0031308 ? 12.92 * x : 1.055 * Math.pow(x, 1 / 2.4) - 0.055);\n}\n\nfunction rgb2xyz(x) {\n return (x /= 255) <= 0.04045 ? x / 12.92 : Math.pow((x + 0.055) / 1.055, 2.4);\n}\n\nfunction hclConvert(o) {\n if (o instanceof Hcl) return new Hcl(o.h, o.c, o.l, o.opacity);\n if (!(o instanceof Lab)) o = labConvert(o);\n var h = Math.atan2(o.b, o.a) * rad2deg;\n return new Hcl(h < 0 ? h + 360 : h, Math.sqrt(o.a * o.a + o.b * o.b), o.l, o.opacity);\n}\n\nfunction hcl(h, c, l, opacity) {\n return arguments.length === 1 ? hclConvert(h) : new Hcl(h, c, l, opacity == null ? 1 : opacity);\n}\n\nfunction Hcl(h, c, l, opacity) {\n this.h = +h;\n this.c = +c;\n this.l = +l;\n this.opacity = +opacity;\n}\n\ndefine(Hcl, hcl, extend(Color, {\n brighter: function(k) {\n return new Hcl(this.h, this.c, this.l + Kn * (k == null ? 1 : k), this.opacity);\n },\n darker: function(k) {\n return new Hcl(this.h, this.c, this.l - Kn * (k == null ? 1 : k), this.opacity);\n },\n rgb: function() {\n return labConvert(this).rgb();\n }\n}));\n\nvar A = -0.14861;\nvar B = +1.78277;\nvar C = -0.29227;\nvar D = -0.90649;\nvar E = +1.97294;\nvar ED = E * D;\nvar EB = E * B;\nvar BC_DA = B * C - D * A;\n\nfunction cubehelixConvert(o) {\n if (o instanceof Cubehelix) return new Cubehelix(o.h, o.s, o.l, o.opacity);\n if (!(o instanceof Rgb)) o = rgbConvert(o);\n var r = o.r / 255,\n g = o.g / 255,\n b = o.b / 255,\n l = (BC_DA * b + ED * r - EB * g) / (BC_DA + ED - EB),\n bl = b - l,\n k = (E * (g - l) - C * bl) / D,\n s = Math.sqrt(k * k + bl * bl) / (E * l * (1 - l)), // NaN if l=0 or l=1\n h = s ? Math.atan2(k, bl) * rad2deg - 120 : NaN;\n return new Cubehelix(h < 0 ? h + 360 : h, s, l, o.opacity);\n}\n\nfunction cubehelix(h, s, l, opacity) {\n return arguments.length === 1 ? cubehelixConvert(h) : new Cubehelix(h, s, l, opacity == null ? 1 : opacity);\n}\n\nfunction Cubehelix(h, s, l, opacity) {\n this.h = +h;\n this.s = +s;\n this.l = +l;\n this.opacity = +opacity;\n}\n\ndefine(Cubehelix, cubehelix, extend(Color, {\n brighter: function(k) {\n k = k == null ? brighter : Math.pow(brighter, k);\n return new Cubehelix(this.h, this.s, this.l * k, this.opacity);\n },\n darker: function(k) {\n k = k == null ? darker : Math.pow(darker, k);\n return new Cubehelix(this.h, this.s, this.l * k, this.opacity);\n },\n rgb: function() {\n var h = isNaN(this.h) ? 0 : (this.h + 120) * deg2rad,\n l = +this.l,\n a = isNaN(this.s) ? 0 : this.s * l * (1 - l),\n cosh = Math.cos(h),\n sinh = Math.sin(h);\n return new Rgb(\n 255 * (l + a * (A * cosh + B * sinh)),\n 255 * (l + a * (C * cosh + D * sinh)),\n 255 * (l + a * (E * cosh)),\n this.opacity\n );\n }\n}));\n\nfunction basis(t1, v0, v1, v2, v3) {\n var t2 = t1 * t1, t3 = t2 * t1;\n return ((1 - 3 * t1 + 3 * t2 - t3) * v0\n + (4 - 6 * t2 + 3 * t3) * v1\n + (1 + 3 * t1 + 3 * t2 - 3 * t3) * v2\n + t3 * v3) / 6;\n}\n\nvar basis$1 = function(values) {\n var n = values.length - 1;\n return function(t) {\n var i = t <= 0 ? (t = 0) : t >= 1 ? (t = 1, n - 1) : Math.floor(t * n),\n v1 = values[i],\n v2 = values[i + 1],\n v0 = i > 0 ? values[i - 1] : 2 * v1 - v2,\n v3 = i < n - 1 ? values[i + 2] : 2 * v2 - v1;\n return basis((t - i / n) * n, v0, v1, v2, v3);\n };\n};\n\nvar basisClosed = function(values) {\n var n = values.length;\n return function(t) {\n var i = Math.floor(((t %= 1) < 0 ? ++t : t) * n),\n v0 = values[(i + n - 1) % n],\n v1 = values[i % n],\n v2 = values[(i + 1) % n],\n v3 = values[(i + 2) % n];\n return basis((t - i / n) * n, v0, v1, v2, v3);\n };\n};\n\nvar constant$3 = function(x) {\n return function() {\n return x;\n };\n};\n\nfunction linear(a, d) {\n return function(t) {\n return a + t * d;\n };\n}\n\nfunction exponential(a, b, y) {\n return a = Math.pow(a, y), b = Math.pow(b, y) - a, y = 1 / y, function(t) {\n return Math.pow(a + t * b, y);\n };\n}\n\nfunction hue(a, b) {\n var d = b - a;\n return d ? linear(a, d > 180 || d < -180 ? d - 360 * Math.round(d / 360) : d) : constant$3(isNaN(a) ? b : a);\n}\n\nfunction gamma(y) {\n return (y = +y) === 1 ? nogamma : function(a, b) {\n return b - a ? exponential(a, b, y) : constant$3(isNaN(a) ? b : a);\n };\n}\n\nfunction nogamma(a, b) {\n var d = b - a;\n return d ? linear(a, d) : constant$3(isNaN(a) ? b : a);\n}\n\nvar interpolateRgb = (function rgbGamma(y) {\n var color$$1 = gamma(y);\n\n function rgb$$1(start, end) {\n var r = color$$1((start = rgb(start)).r, (end = rgb(end)).r),\n g = color$$1(start.g, end.g),\n b = color$$1(start.b, end.b),\n opacity = nogamma(start.opacity, end.opacity);\n return function(t) {\n start.r = r(t);\n start.g = g(t);\n start.b = b(t);\n start.opacity = opacity(t);\n return start + \"\";\n };\n }\n\n rgb$$1.gamma = rgbGamma;\n\n return rgb$$1;\n})(1);\n\nfunction rgbSpline(spline) {\n return function(colors) {\n var n = colors.length,\n r = new Array(n),\n g = new Array(n),\n b = new Array(n),\n i, color$$1;\n for (i = 0; i < n; ++i) {\n color$$1 = rgb(colors[i]);\n r[i] = color$$1.r || 0;\n g[i] = color$$1.g || 0;\n b[i] = color$$1.b || 0;\n }\n r = spline(r);\n g = spline(g);\n b = spline(b);\n color$$1.opacity = 1;\n return function(t) {\n color$$1.r = r(t);\n color$$1.g = g(t);\n color$$1.b = b(t);\n return color$$1 + \"\";\n };\n };\n}\n\nvar rgbBasis = rgbSpline(basis$1);\nvar rgbBasisClosed = rgbSpline(basisClosed);\n\nvar array$1 = function(a, b) {\n var nb = b ? b.length : 0,\n na = a ? Math.min(nb, a.length) : 0,\n x = new Array(nb),\n c = new Array(nb),\n i;\n\n for (i = 0; i < na; ++i) x[i] = interpolateValue(a[i], b[i]);\n for (; i < nb; ++i) c[i] = b[i];\n\n return function(t) {\n for (i = 0; i < na; ++i) c[i] = x[i](t);\n return c;\n };\n};\n\nvar date = function(a, b) {\n var d = new Date;\n return a = +a, b -= a, function(t) {\n return d.setTime(a + b * t), d;\n };\n};\n\nvar reinterpolate = function(a, b) {\n return a = +a, b -= a, function(t) {\n return a + b * t;\n };\n};\n\nvar object = function(a, b) {\n var i = {},\n c = {},\n k;\n\n if (a === null || typeof a !== \"object\") a = {};\n if (b === null || typeof b !== \"object\") b = {};\n\n for (k in b) {\n if (k in a) {\n i[k] = interpolateValue(a[k], b[k]);\n } else {\n c[k] = b[k];\n }\n }\n\n return function(t) {\n for (k in i) c[k] = i[k](t);\n return c;\n };\n};\n\nvar reA = /[-+]?(?:\\d+\\.?\\d*|\\.?\\d+)(?:[eE][-+]?\\d+)?/g;\nvar reB = new RegExp(reA.source, \"g\");\n\nfunction zero(b) {\n return function() {\n return b;\n };\n}\n\nfunction one(b) {\n return function(t) {\n return b(t) + \"\";\n };\n}\n\nvar interpolateString = function(a, b) {\n var bi = reA.lastIndex = reB.lastIndex = 0, // scan index for next number in b\n am, // current match in a\n bm, // current match in b\n bs, // string preceding current number in b, if any\n i = -1, // index in s\n s = [], // string constants and placeholders\n q = []; // number interpolators\n\n // Coerce inputs to strings.\n a = a + \"\", b = b + \"\";\n\n // Interpolate pairs of numbers in a & b.\n while ((am = reA.exec(a))\n && (bm = reB.exec(b))) {\n if ((bs = bm.index) > bi) { // a string precedes the next number in b\n bs = b.slice(bi, bs);\n if (s[i]) s[i] += bs; // coalesce with previous string\n else s[++i] = bs;\n }\n if ((am = am[0]) === (bm = bm[0])) { // numbers in a & b match\n if (s[i]) s[i] += bm; // coalesce with previous string\n else s[++i] = bm;\n } else { // interpolate non-matching numbers\n s[++i] = null;\n q.push({i: i, x: reinterpolate(am, bm)});\n }\n bi = reB.lastIndex;\n }\n\n // Add remains of b.\n if (bi < b.length) {\n bs = b.slice(bi);\n if (s[i]) s[i] += bs; // coalesce with previous string\n else s[++i] = bs;\n }\n\n // Special optimization for only a single match.\n // Otherwise, interpolate each of the numbers and rejoin the string.\n return s.length < 2 ? (q[0]\n ? one(q[0].x)\n : zero(b))\n : (b = q.length, function(t) {\n for (var i = 0, o; i < b; ++i) s[(o = q[i]).i] = o.x(t);\n return s.join(\"\");\n });\n};\n\nvar interpolateValue = function(a, b) {\n var t = typeof b, c;\n return b == null || t === \"boolean\" ? constant$3(b)\n : (t === \"number\" ? reinterpolate\n : t === \"string\" ? ((c = color(b)) ? (b = c, interpolateRgb) : interpolateString)\n : b instanceof color ? interpolateRgb\n : b instanceof Date ? date\n : Array.isArray(b) ? array$1\n : typeof b.valueOf !== \"function\" && typeof b.toString !== \"function\" || isNaN(b) ? object\n : reinterpolate)(a, b);\n};\n\nvar interpolateRound = function(a, b) {\n return a = +a, b -= a, function(t) {\n return Math.round(a + b * t);\n };\n};\n\nvar degrees = 180 / Math.PI;\n\nvar identity$2 = {\n translateX: 0,\n translateY: 0,\n rotate: 0,\n skewX: 0,\n scaleX: 1,\n scaleY: 1\n};\n\nvar decompose = function(a, b, c, d, e, f) {\n var scaleX, scaleY, skewX;\n if (scaleX = Math.sqrt(a * a + b * b)) a /= scaleX, b /= scaleX;\n if (skewX = a * c + b * d) c -= a * skewX, d -= b * skewX;\n if (scaleY = Math.sqrt(c * c + d * d)) c /= scaleY, d /= scaleY, skewX /= scaleY;\n if (a * d < b * c) a = -a, b = -b, skewX = -skewX, scaleX = -scaleX;\n return {\n translateX: e,\n translateY: f,\n rotate: Math.atan2(b, a) * degrees,\n skewX: Math.atan(skewX) * degrees,\n scaleX: scaleX,\n scaleY: scaleY\n };\n};\n\nvar cssNode;\nvar cssRoot;\nvar cssView;\nvar svgNode;\n\nfunction parseCss(value) {\n if (value === \"none\") return identity$2;\n if (!cssNode) cssNode = document.createElement(\"DIV\"), cssRoot = document.documentElement, cssView = document.defaultView;\n cssNode.style.transform = value;\n value = cssView.getComputedStyle(cssRoot.appendChild(cssNode), null).getPropertyValue(\"transform\");\n cssRoot.removeChild(cssNode);\n value = value.slice(7, -1).split(\",\");\n return decompose(+value[0], +value[1], +value[2], +value[3], +value[4], +value[5]);\n}\n\nfunction parseSvg(value) {\n if (value == null) return identity$2;\n if (!svgNode) svgNode = document.createElementNS(\"http://www.w3.org/2000/svg\", \"g\");\n svgNode.setAttribute(\"transform\", value);\n if (!(value = svgNode.transform.baseVal.consolidate())) return identity$2;\n value = value.matrix;\n return decompose(value.a, value.b, value.c, value.d, value.e, value.f);\n}\n\nfunction interpolateTransform(parse, pxComma, pxParen, degParen) {\n\n function pop(s) {\n return s.length ? s.pop() + \" \" : \"\";\n }\n\n function translate(xa, ya, xb, yb, s, q) {\n if (xa !== xb || ya !== yb) {\n var i = s.push(\"translate(\", null, pxComma, null, pxParen);\n q.push({i: i - 4, x: reinterpolate(xa, xb)}, {i: i - 2, x: reinterpolate(ya, yb)});\n } else if (xb || yb) {\n s.push(\"translate(\" + xb + pxComma + yb + pxParen);\n }\n }\n\n function rotate(a, b, s, q) {\n if (a !== b) {\n if (a - b > 180) b += 360; else if (b - a > 180) a += 360; // shortest path\n q.push({i: s.push(pop(s) + \"rotate(\", null, degParen) - 2, x: reinterpolate(a, b)});\n } else if (b) {\n s.push(pop(s) + \"rotate(\" + b + degParen);\n }\n }\n\n function skewX(a, b, s, q) {\n if (a !== b) {\n q.push({i: s.push(pop(s) + \"skewX(\", null, degParen) - 2, x: reinterpolate(a, b)});\n } else if (b) {\n s.push(pop(s) + \"skewX(\" + b + degParen);\n }\n }\n\n function scale(xa, ya, xb, yb, s, q) {\n if (xa !== xb || ya !== yb) {\n var i = s.push(pop(s) + \"scale(\", null, \",\", null, \")\");\n q.push({i: i - 4, x: reinterpolate(xa, xb)}, {i: i - 2, x: reinterpolate(ya, yb)});\n } else if (xb !== 1 || yb !== 1) {\n s.push(pop(s) + \"scale(\" + xb + \",\" + yb + \")\");\n }\n }\n\n return function(a, b) {\n var s = [], // string constants and placeholders\n q = []; // number interpolators\n a = parse(a), b = parse(b);\n translate(a.translateX, a.translateY, b.translateX, b.translateY, s, q);\n rotate(a.rotate, b.rotate, s, q);\n skewX(a.skewX, b.skewX, s, q);\n scale(a.scaleX, a.scaleY, b.scaleX, b.scaleY, s, q);\n a = b = null; // gc\n return function(t) {\n var i = -1, n = q.length, o;\n while (++i < n) s[(o = q[i]).i] = o.x(t);\n return s.join(\"\");\n };\n };\n}\n\nvar interpolateTransformCss = interpolateTransform(parseCss, \"px, \", \"px)\", \"deg)\");\nvar interpolateTransformSvg = interpolateTransform(parseSvg, \", \", \")\", \")\");\n\nvar rho = Math.SQRT2;\nvar rho2 = 2;\nvar rho4 = 4;\nvar epsilon2 = 1e-12;\n\nfunction cosh(x) {\n return ((x = Math.exp(x)) + 1 / x) / 2;\n}\n\nfunction sinh(x) {\n return ((x = Math.exp(x)) - 1 / x) / 2;\n}\n\nfunction tanh(x) {\n return ((x = Math.exp(2 * x)) - 1) / (x + 1);\n}\n\n// p0 = [ux0, uy0, w0]\n// p1 = [ux1, uy1, w1]\nvar interpolateZoom = function(p0, p1) {\n var ux0 = p0[0], uy0 = p0[1], w0 = p0[2],\n ux1 = p1[0], uy1 = p1[1], w1 = p1[2],\n dx = ux1 - ux0,\n dy = uy1 - uy0,\n d2 = dx * dx + dy * dy,\n i,\n S;\n\n // Special case for u0 ≅ u1.\n if (d2 < epsilon2) {\n S = Math.log(w1 / w0) / rho;\n i = function(t) {\n return [\n ux0 + t * dx,\n uy0 + t * dy,\n w0 * Math.exp(rho * t * S)\n ];\n };\n }\n\n // General case.\n else {\n var d1 = Math.sqrt(d2),\n b0 = (w1 * w1 - w0 * w0 + rho4 * d2) / (2 * w0 * rho2 * d1),\n b1 = (w1 * w1 - w0 * w0 - rho4 * d2) / (2 * w1 * rho2 * d1),\n r0 = Math.log(Math.sqrt(b0 * b0 + 1) - b0),\n r1 = Math.log(Math.sqrt(b1 * b1 + 1) - b1);\n S = (r1 - r0) / rho;\n i = function(t) {\n var s = t * S,\n coshr0 = cosh(r0),\n u = w0 / (rho2 * d1) * (coshr0 * tanh(rho * s + r0) - sinh(r0));\n return [\n ux0 + u * dx,\n uy0 + u * dy,\n w0 * coshr0 / cosh(rho * s + r0)\n ];\n };\n }\n\n i.duration = S * 1000;\n\n return i;\n};\n\nfunction hsl$1(hue$$1) {\n return function(start, end) {\n var h = hue$$1((start = hsl(start)).h, (end = hsl(end)).h),\n s = nogamma(start.s, end.s),\n l = nogamma(start.l, end.l),\n opacity = nogamma(start.opacity, end.opacity);\n return function(t) {\n start.h = h(t);\n start.s = s(t);\n start.l = l(t);\n start.opacity = opacity(t);\n return start + \"\";\n };\n }\n}\n\nvar hsl$2 = hsl$1(hue);\nvar hslLong = hsl$1(nogamma);\n\nfunction lab$1(start, end) {\n var l = nogamma((start = lab(start)).l, (end = lab(end)).l),\n a = nogamma(start.a, end.a),\n b = nogamma(start.b, end.b),\n opacity = nogamma(start.opacity, end.opacity);\n return function(t) {\n start.l = l(t);\n start.a = a(t);\n start.b = b(t);\n start.opacity = opacity(t);\n return start + \"\";\n };\n}\n\nfunction hcl$1(hue$$1) {\n return function(start, end) {\n var h = hue$$1((start = hcl(start)).h, (end = hcl(end)).h),\n c = nogamma(start.c, end.c),\n l = nogamma(start.l, end.l),\n opacity = nogamma(start.opacity, end.opacity);\n return function(t) {\n start.h = h(t);\n start.c = c(t);\n start.l = l(t);\n start.opacity = opacity(t);\n return start + \"\";\n };\n }\n}\n\nvar hcl$2 = hcl$1(hue);\nvar hclLong = hcl$1(nogamma);\n\nfunction cubehelix$1(hue$$1) {\n return (function cubehelixGamma(y) {\n y = +y;\n\n function cubehelix$$1(start, end) {\n var h = hue$$1((start = cubehelix(start)).h, (end = cubehelix(end)).h),\n s = nogamma(start.s, end.s),\n l = nogamma(start.l, end.l),\n opacity = nogamma(start.opacity, end.opacity);\n return function(t) {\n start.h = h(t);\n start.s = s(t);\n start.l = l(Math.pow(t, y));\n start.opacity = opacity(t);\n return start + \"\";\n };\n }\n\n cubehelix$$1.gamma = cubehelixGamma;\n\n return cubehelix$$1;\n })(1);\n}\n\nvar cubehelix$2 = cubehelix$1(hue);\nvar cubehelixLong = cubehelix$1(nogamma);\n\nvar quantize = function(interpolator, n) {\n var samples = new Array(n);\n for (var i = 0; i < n; ++i) samples[i] = interpolator(i / (n - 1));\n return samples;\n};\n\nvar frame = 0;\nvar timeout = 0;\nvar interval = 0;\nvar pokeDelay = 1000;\nvar taskHead;\nvar taskTail;\nvar clockLast = 0;\nvar clockNow = 0;\nvar clockSkew = 0;\nvar clock = typeof performance === \"object\" && performance.now ? performance : Date;\nvar setFrame = typeof window === \"object\" && window.requestAnimationFrame ? window.requestAnimationFrame.bind(window) : function(f) { setTimeout(f, 17); };\n\nfunction now() {\n return clockNow || (setFrame(clearNow), clockNow = clock.now() + clockSkew);\n}\n\nfunction clearNow() {\n clockNow = 0;\n}\n\nfunction Timer() {\n this._call =\n this._time =\n this._next = null;\n}\n\nTimer.prototype = timer.prototype = {\n constructor: Timer,\n restart: function(callback, delay, time) {\n if (typeof callback !== \"function\") throw new TypeError(\"callback is not a function\");\n time = (time == null ? now() : +time) + (delay == null ? 0 : +delay);\n if (!this._next && taskTail !== this) {\n if (taskTail) taskTail._next = this;\n else taskHead = this;\n taskTail = this;\n }\n this._call = callback;\n this._time = time;\n sleep();\n },\n stop: function() {\n if (this._call) {\n this._call = null;\n this._time = Infinity;\n sleep();\n }\n }\n};\n\nfunction timer(callback, delay, time) {\n var t = new Timer;\n t.restart(callback, delay, time);\n return t;\n}\n\nfunction timerFlush() {\n now(); // Get the current time, if not already set.\n ++frame; // Pretend we’ve set an alarm, if we haven’t already.\n var t = taskHead, e;\n while (t) {\n if ((e = clockNow - t._time) >= 0) t._call.call(null, e);\n t = t._next;\n }\n --frame;\n}\n\nfunction wake() {\n clockNow = (clockLast = clock.now()) + clockSkew;\n frame = timeout = 0;\n try {\n timerFlush();\n } finally {\n frame = 0;\n nap();\n clockNow = 0;\n }\n}\n\nfunction poke() {\n var now = clock.now(), delay = now - clockLast;\n if (delay > pokeDelay) clockSkew -= delay, clockLast = now;\n}\n\nfunction nap() {\n var t0, t1 = taskHead, t2, time = Infinity;\n while (t1) {\n if (t1._call) {\n if (time > t1._time) time = t1._time;\n t0 = t1, t1 = t1._next;\n } else {\n t2 = t1._next, t1._next = null;\n t1 = t0 ? t0._next = t2 : taskHead = t2;\n }\n }\n taskTail = t0;\n sleep(time);\n}\n\nfunction sleep(time) {\n if (frame) return; // Soonest alarm already set, or will be.\n if (timeout) timeout = clearTimeout(timeout);\n var delay = time - clockNow; // Strictly less than if we recomputed clockNow.\n if (delay > 24) {\n if (time < Infinity) timeout = setTimeout(wake, time - clock.now() - clockSkew);\n if (interval) interval = clearInterval(interval);\n } else {\n if (!interval) clockLast = clock.now(), interval = setInterval(poke, pokeDelay);\n frame = 1, setFrame(wake);\n }\n}\n\nvar timeout$1 = function(callback, delay, time) {\n var t = new Timer;\n delay = delay == null ? 0 : +delay;\n t.restart(function(elapsed) {\n t.stop();\n callback(elapsed + delay);\n }, delay, time);\n return t;\n};\n\nvar interval$1 = function(callback, delay, time) {\n var t = new Timer, total = delay;\n if (delay == null) return t.restart(callback, delay, time), t;\n delay = +delay, time = time == null ? now() : +time;\n t.restart(function tick(elapsed) {\n elapsed += total;\n t.restart(tick, total += delay, time);\n callback(elapsed);\n }, delay, time);\n return t;\n};\n\nvar emptyOn = dispatch(\"start\", \"end\", \"interrupt\");\nvar emptyTween = [];\n\nvar CREATED = 0;\nvar SCHEDULED = 1;\nvar STARTING = 2;\nvar STARTED = 3;\nvar RUNNING = 4;\nvar ENDING = 5;\nvar ENDED = 6;\n\nvar schedule = function(node, name, id, index, group, timing) {\n var schedules = node.__transition;\n if (!schedules) node.__transition = {};\n else if (id in schedules) return;\n create(node, id, {\n name: name,\n index: index, // For context during callback.\n group: group, // For context during callback.\n on: emptyOn,\n tween: emptyTween,\n time: timing.time,\n delay: timing.delay,\n duration: timing.duration,\n ease: timing.ease,\n timer: null,\n state: CREATED\n });\n};\n\nfunction init(node, id) {\n var schedule = node.__transition;\n if (!schedule || !(schedule = schedule[id]) || schedule.state > CREATED) throw new Error(\"too late\");\n return schedule;\n}\n\nfunction set$1(node, id) {\n var schedule = node.__transition;\n if (!schedule || !(schedule = schedule[id]) || schedule.state > STARTING) throw new Error(\"too late\");\n return schedule;\n}\n\nfunction get$1(node, id) {\n var schedule = node.__transition;\n if (!schedule || !(schedule = schedule[id])) throw new Error(\"too late\");\n return schedule;\n}\n\nfunction create(node, id, self) {\n var schedules = node.__transition,\n tween;\n\n // Initialize the self timer when the transition is created.\n // Note the actual delay is not known until the first callback!\n schedules[id] = self;\n self.timer = timer(schedule, 0, self.time);\n\n function schedule(elapsed) {\n self.state = SCHEDULED;\n self.timer.restart(start, self.delay, self.time);\n\n // If the elapsed delay is less than our first sleep, start immediately.\n if (self.delay <= elapsed) start(elapsed - self.delay);\n }\n\n function start(elapsed) {\n var i, j, n, o;\n\n // If the state is not SCHEDULED, then we previously errored on start.\n if (self.state !== SCHEDULED) return stop();\n\n for (i in schedules) {\n o = schedules[i];\n if (o.name !== self.name) continue;\n\n // While this element already has a starting transition during this frame,\n // defer starting an interrupting transition until that transition has a\n // chance to tick (and possibly end); see d3/d3-transition#54!\n if (o.state === STARTED) return timeout$1(start);\n\n // Interrupt the active transition, if any.\n // Dispatch the interrupt event.\n if (o.state === RUNNING) {\n o.state = ENDED;\n o.timer.stop();\n o.on.call(\"interrupt\", node, node.__data__, o.index, o.group);\n delete schedules[i];\n }\n\n // Cancel any pre-empted transitions. No interrupt event is dispatched\n // because the cancelled transitions never started. Note that this also\n // removes this transition from the pending list!\n else if (+i < id) {\n o.state = ENDED;\n o.timer.stop();\n delete schedules[i];\n }\n }\n\n // Defer the first tick to end of the current frame; see d3/d3#1576.\n // Note the transition may be canceled after start and before the first tick!\n // Note this must be scheduled before the start event; see d3/d3-transition#16!\n // Assuming this is successful, subsequent callbacks go straight to tick.\n timeout$1(function() {\n if (self.state === STARTED) {\n self.state = RUNNING;\n self.timer.restart(tick, self.delay, self.time);\n tick(elapsed);\n }\n });\n\n // Dispatch the start event.\n // Note this must be done before the tween are initialized.\n self.state = STARTING;\n self.on.call(\"start\", node, node.__data__, self.index, self.group);\n if (self.state !== STARTING) return; // interrupted\n self.state = STARTED;\n\n // Initialize the tween, deleting null tween.\n tween = new Array(n = self.tween.length);\n for (i = 0, j = -1; i < n; ++i) {\n if (o = self.tween[i].value.call(node, node.__data__, self.index, self.group)) {\n tween[++j] = o;\n }\n }\n tween.length = j + 1;\n }\n\n function tick(elapsed) {\n var t = elapsed < self.duration ? self.ease.call(null, elapsed / self.duration) : (self.timer.restart(stop), self.state = ENDING, 1),\n i = -1,\n n = tween.length;\n\n while (++i < n) {\n tween[i].call(null, t);\n }\n\n // Dispatch the end event.\n if (self.state === ENDING) {\n self.on.call(\"end\", node, node.__data__, self.index, self.group);\n stop();\n }\n }\n\n function stop() {\n self.state = ENDED;\n self.timer.stop();\n delete schedules[id];\n for (var i in schedules) return; // eslint-disable-line no-unused-vars\n delete node.__transition;\n }\n}\n\nvar interrupt = function(node, name) {\n var schedules = node.__transition,\n schedule$$1,\n active,\n empty = true,\n i;\n\n if (!schedules) return;\n\n name = name == null ? null : name + \"\";\n\n for (i in schedules) {\n if ((schedule$$1 = schedules[i]).name !== name) { empty = false; continue; }\n active = schedule$$1.state > STARTING && schedule$$1.state < ENDING;\n schedule$$1.state = ENDED;\n schedule$$1.timer.stop();\n if (active) schedule$$1.on.call(\"interrupt\", node, node.__data__, schedule$$1.index, schedule$$1.group);\n delete schedules[i];\n }\n\n if (empty) delete node.__transition;\n};\n\nvar selection_interrupt = function(name) {\n return this.each(function() {\n interrupt(this, name);\n });\n};\n\nfunction tweenRemove(id, name) {\n var tween0, tween1;\n return function() {\n var schedule$$1 = set$1(this, id),\n tween = schedule$$1.tween;\n\n // If this node shared tween with the previous node,\n // just assign the updated shared tween and we’re done!\n // Otherwise, copy-on-write.\n if (tween !== tween0) {\n tween1 = tween0 = tween;\n for (var i = 0, n = tween1.length; i < n; ++i) {\n if (tween1[i].name === name) {\n tween1 = tween1.slice();\n tween1.splice(i, 1);\n break;\n }\n }\n }\n\n schedule$$1.tween = tween1;\n };\n}\n\nfunction tweenFunction(id, name, value) {\n var tween0, tween1;\n if (typeof value !== \"function\") throw new Error;\n return function() {\n var schedule$$1 = set$1(this, id),\n tween = schedule$$1.tween;\n\n // If this node shared tween with the previous node,\n // just assign the updated shared tween and we’re done!\n // Otherwise, copy-on-write.\n if (tween !== tween0) {\n tween1 = (tween0 = tween).slice();\n for (var t = {name: name, value: value}, i = 0, n = tween1.length; i < n; ++i) {\n if (tween1[i].name === name) {\n tween1[i] = t;\n break;\n }\n }\n if (i === n) tween1.push(t);\n }\n\n schedule$$1.tween = tween1;\n };\n}\n\nvar transition_tween = function(name, value) {\n var id = this._id;\n\n name += \"\";\n\n if (arguments.length < 2) {\n var tween = get$1(this.node(), id).tween;\n for (var i = 0, n = tween.length, t; i < n; ++i) {\n if ((t = tween[i]).name === name) {\n return t.value;\n }\n }\n return null;\n }\n\n return this.each((value == null ? tweenRemove : tweenFunction)(id, name, value));\n};\n\nfunction tweenValue(transition, name, value) {\n var id = transition._id;\n\n transition.each(function() {\n var schedule$$1 = set$1(this, id);\n (schedule$$1.value || (schedule$$1.value = {}))[name] = value.apply(this, arguments);\n });\n\n return function(node) {\n return get$1(node, id).value[name];\n };\n}\n\nvar interpolate = function(a, b) {\n var c;\n return (typeof b === \"number\" ? reinterpolate\n : b instanceof color ? interpolateRgb\n : (c = color(b)) ? (b = c, interpolateRgb)\n : interpolateString)(a, b);\n};\n\nfunction attrRemove$1(name) {\n return function() {\n this.removeAttribute(name);\n };\n}\n\nfunction attrRemoveNS$1(fullname) {\n return function() {\n this.removeAttributeNS(fullname.space, fullname.local);\n };\n}\n\nfunction attrConstant$1(name, interpolate$$1, value1) {\n var value00,\n interpolate0;\n return function() {\n var value0 = this.getAttribute(name);\n return value0 === value1 ? null\n : value0 === value00 ? interpolate0\n : interpolate0 = interpolate$$1(value00 = value0, value1);\n };\n}\n\nfunction attrConstantNS$1(fullname, interpolate$$1, value1) {\n var value00,\n interpolate0;\n return function() {\n var value0 = this.getAttributeNS(fullname.space, fullname.local);\n return value0 === value1 ? null\n : value0 === value00 ? interpolate0\n : interpolate0 = interpolate$$1(value00 = value0, value1);\n };\n}\n\nfunction attrFunction$1(name, interpolate$$1, value) {\n var value00,\n value10,\n interpolate0;\n return function() {\n var value0, value1 = value(this);\n if (value1 == null) return void this.removeAttribute(name);\n value0 = this.getAttribute(name);\n return value0 === value1 ? null\n : value0 === value00 && value1 === value10 ? interpolate0\n : interpolate0 = interpolate$$1(value00 = value0, value10 = value1);\n };\n}\n\nfunction attrFunctionNS$1(fullname, interpolate$$1, value) {\n var value00,\n value10,\n interpolate0;\n return function() {\n var value0, value1 = value(this);\n if (value1 == null) return void this.removeAttributeNS(fullname.space, fullname.local);\n value0 = this.getAttributeNS(fullname.space, fullname.local);\n return value0 === value1 ? null\n : value0 === value00 && value1 === value10 ? interpolate0\n : interpolate0 = interpolate$$1(value00 = value0, value10 = value1);\n };\n}\n\nvar transition_attr = function(name, value) {\n var fullname = namespace(name), i = fullname === \"transform\" ? interpolateTransformSvg : interpolate;\n return this.attrTween(name, typeof value === \"function\"\n ? (fullname.local ? attrFunctionNS$1 : attrFunction$1)(fullname, i, tweenValue(this, \"attr.\" + name, value))\n : value == null ? (fullname.local ? attrRemoveNS$1 : attrRemove$1)(fullname)\n : (fullname.local ? attrConstantNS$1 : attrConstant$1)(fullname, i, value + \"\"));\n};\n\nfunction attrTweenNS(fullname, value) {\n function tween() {\n var node = this, i = value.apply(node, arguments);\n return i && function(t) {\n node.setAttributeNS(fullname.space, fullname.local, i(t));\n };\n }\n tween._value = value;\n return tween;\n}\n\nfunction attrTween(name, value) {\n function tween() {\n var node = this, i = value.apply(node, arguments);\n return i && function(t) {\n node.setAttribute(name, i(t));\n };\n }\n tween._value = value;\n return tween;\n}\n\nvar transition_attrTween = function(name, value) {\n var key = \"attr.\" + name;\n if (arguments.length < 2) return (key = this.tween(key)) && key._value;\n if (value == null) return this.tween(key, null);\n if (typeof value !== \"function\") throw new Error;\n var fullname = namespace(name);\n return this.tween(key, (fullname.local ? attrTweenNS : attrTween)(fullname, value));\n};\n\nfunction delayFunction(id, value) {\n return function() {\n init(this, id).delay = +value.apply(this, arguments);\n };\n}\n\nfunction delayConstant(id, value) {\n return value = +value, function() {\n init(this, id).delay = value;\n };\n}\n\nvar transition_delay = function(value) {\n var id = this._id;\n\n return arguments.length\n ? this.each((typeof value === \"function\"\n ? delayFunction\n : delayConstant)(id, value))\n : get$1(this.node(), id).delay;\n};\n\nfunction durationFunction(id, value) {\n return function() {\n set$1(this, id).duration = +value.apply(this, arguments);\n };\n}\n\nfunction durationConstant(id, value) {\n return value = +value, function() {\n set$1(this, id).duration = value;\n };\n}\n\nvar transition_duration = function(value) {\n var id = this._id;\n\n return arguments.length\n ? this.each((typeof value === \"function\"\n ? durationFunction\n : durationConstant)(id, value))\n : get$1(this.node(), id).duration;\n};\n\nfunction easeConstant(id, value) {\n if (typeof value !== \"function\") throw new Error;\n return function() {\n set$1(this, id).ease = value;\n };\n}\n\nvar transition_ease = function(value) {\n var id = this._id;\n\n return arguments.length\n ? this.each(easeConstant(id, value))\n : get$1(this.node(), id).ease;\n};\n\nvar transition_filter = function(match) {\n if (typeof match !== \"function\") match = matcher$1(match);\n\n for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, subgroup = subgroups[j] = [], node, i = 0; i < n; ++i) {\n if ((node = group[i]) && match.call(node, node.__data__, i, group)) {\n subgroup.push(node);\n }\n }\n }\n\n return new Transition(subgroups, this._parents, this._name, this._id);\n};\n\nvar transition_merge = function(transition$$1) {\n if (transition$$1._id !== this._id) throw new Error;\n\n for (var groups0 = this._groups, groups1 = transition$$1._groups, m0 = groups0.length, m1 = groups1.length, m = Math.min(m0, m1), merges = new Array(m0), j = 0; j < m; ++j) {\n for (var group0 = groups0[j], group1 = groups1[j], n = group0.length, merge = merges[j] = new Array(n), node, i = 0; i < n; ++i) {\n if (node = group0[i] || group1[i]) {\n merge[i] = node;\n }\n }\n }\n\n for (; j < m0; ++j) {\n merges[j] = groups0[j];\n }\n\n return new Transition(merges, this._parents, this._name, this._id);\n};\n\nfunction start(name) {\n return (name + \"\").trim().split(/^|\\s+/).every(function(t) {\n var i = t.indexOf(\".\");\n if (i >= 0) t = t.slice(0, i);\n return !t || t === \"start\";\n });\n}\n\nfunction onFunction(id, name, listener) {\n var on0, on1, sit = start(name) ? init : set$1;\n return function() {\n var schedule$$1 = sit(this, id),\n on = schedule$$1.on;\n\n // If this node shared a dispatch with the previous node,\n // just assign the updated shared dispatch and we’re done!\n // Otherwise, copy-on-write.\n if (on !== on0) (on1 = (on0 = on).copy()).on(name, listener);\n\n schedule$$1.on = on1;\n };\n}\n\nvar transition_on = function(name, listener) {\n var id = this._id;\n\n return arguments.length < 2\n ? get$1(this.node(), id).on.on(name)\n : this.each(onFunction(id, name, listener));\n};\n\nfunction removeFunction(id) {\n return function() {\n var parent = this.parentNode;\n for (var i in this.__transition) if (+i !== id) return;\n if (parent) parent.removeChild(this);\n };\n}\n\nvar transition_remove = function() {\n return this.on(\"end.remove\", removeFunction(this._id));\n};\n\nvar transition_select = function(select) {\n var name = this._name,\n id = this._id;\n\n if (typeof select !== \"function\") select = selector(select);\n\n for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, subgroup = subgroups[j] = new Array(n), node, subnode, i = 0; i < n; ++i) {\n if ((node = group[i]) && (subnode = select.call(node, node.__data__, i, group))) {\n if (\"__data__\" in node) subnode.__data__ = node.__data__;\n subgroup[i] = subnode;\n schedule(subgroup[i], name, id, i, subgroup, get$1(node, id));\n }\n }\n }\n\n return new Transition(subgroups, this._parents, name, id);\n};\n\nvar transition_selectAll = function(select) {\n var name = this._name,\n id = this._id;\n\n if (typeof select !== \"function\") select = selectorAll(select);\n\n for (var groups = this._groups, m = groups.length, subgroups = [], parents = [], j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) {\n if (node = group[i]) {\n for (var children = select.call(node, node.__data__, i, group), child, inherit = get$1(node, id), k = 0, l = children.length; k < l; ++k) {\n if (child = children[k]) {\n schedule(child, name, id, k, children, inherit);\n }\n }\n subgroups.push(children);\n parents.push(node);\n }\n }\n }\n\n return new Transition(subgroups, parents, name, id);\n};\n\nvar Selection$1 = selection.prototype.constructor;\n\nvar transition_selection = function() {\n return new Selection$1(this._groups, this._parents);\n};\n\nfunction styleRemove$1(name, interpolate$$1) {\n var value00,\n value10,\n interpolate0;\n return function() {\n var value0 = styleValue(this, name),\n value1 = (this.style.removeProperty(name), styleValue(this, name));\n return value0 === value1 ? null\n : value0 === value00 && value1 === value10 ? interpolate0\n : interpolate0 = interpolate$$1(value00 = value0, value10 = value1);\n };\n}\n\nfunction styleRemoveEnd(name) {\n return function() {\n this.style.removeProperty(name);\n };\n}\n\nfunction styleConstant$1(name, interpolate$$1, value1) {\n var value00,\n interpolate0;\n return function() {\n var value0 = styleValue(this, name);\n return value0 === value1 ? null\n : value0 === value00 ? interpolate0\n : interpolate0 = interpolate$$1(value00 = value0, value1);\n };\n}\n\nfunction styleFunction$1(name, interpolate$$1, value) {\n var value00,\n value10,\n interpolate0;\n return function() {\n var value0 = styleValue(this, name),\n value1 = value(this);\n if (value1 == null) value1 = (this.style.removeProperty(name), styleValue(this, name));\n return value0 === value1 ? null\n : value0 === value00 && value1 === value10 ? interpolate0\n : interpolate0 = interpolate$$1(value00 = value0, value10 = value1);\n };\n}\n\nvar transition_style = function(name, value, priority) {\n var i = (name += \"\") === \"transform\" ? interpolateTransformCss : interpolate;\n return value == null ? this\n .styleTween(name, styleRemove$1(name, i))\n .on(\"end.style.\" + name, styleRemoveEnd(name))\n : this.styleTween(name, typeof value === \"function\"\n ? styleFunction$1(name, i, tweenValue(this, \"style.\" + name, value))\n : styleConstant$1(name, i, value + \"\"), priority);\n};\n\nfunction styleTween(name, value, priority) {\n function tween() {\n var node = this, i = value.apply(node, arguments);\n return i && function(t) {\n node.style.setProperty(name, i(t), priority);\n };\n }\n tween._value = value;\n return tween;\n}\n\nvar transition_styleTween = function(name, value, priority) {\n var key = \"style.\" + (name += \"\");\n if (arguments.length < 2) return (key = this.tween(key)) && key._value;\n if (value == null) return this.tween(key, null);\n if (typeof value !== \"function\") throw new Error;\n return this.tween(key, styleTween(name, value, priority == null ? \"\" : priority));\n};\n\nfunction textConstant$1(value) {\n return function() {\n this.textContent = value;\n };\n}\n\nfunction textFunction$1(value) {\n return function() {\n var value1 = value(this);\n this.textContent = value1 == null ? \"\" : value1;\n };\n}\n\nvar transition_text = function(value) {\n return this.tween(\"text\", typeof value === \"function\"\n ? textFunction$1(tweenValue(this, \"text\", value))\n : textConstant$1(value == null ? \"\" : value + \"\"));\n};\n\nvar transition_transition = function() {\n var name = this._name,\n id0 = this._id,\n id1 = newId();\n\n for (var groups = this._groups, m = groups.length, j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) {\n if (node = group[i]) {\n var inherit = get$1(node, id0);\n schedule(node, name, id1, i, group, {\n time: inherit.time + inherit.delay + inherit.duration,\n delay: 0,\n duration: inherit.duration,\n ease: inherit.ease\n });\n }\n }\n }\n\n return new Transition(groups, this._parents, name, id1);\n};\n\nvar id = 0;\n\nfunction Transition(groups, parents, name, id) {\n this._groups = groups;\n this._parents = parents;\n this._name = name;\n this._id = id;\n}\n\nfunction transition(name) {\n return selection().transition(name);\n}\n\nfunction newId() {\n return ++id;\n}\n\nvar selection_prototype = selection.prototype;\n\nTransition.prototype = transition.prototype = {\n constructor: Transition,\n select: transition_select,\n selectAll: transition_selectAll,\n filter: transition_filter,\n merge: transition_merge,\n selection: transition_selection,\n transition: transition_transition,\n call: selection_prototype.call,\n nodes: selection_prototype.nodes,\n node: selection_prototype.node,\n size: selection_prototype.size,\n empty: selection_prototype.empty,\n each: selection_prototype.each,\n on: transition_on,\n attr: transition_attr,\n attrTween: transition_attrTween,\n style: transition_style,\n styleTween: transition_styleTween,\n text: transition_text,\n remove: transition_remove,\n tween: transition_tween,\n delay: transition_delay,\n duration: transition_duration,\n ease: transition_ease\n};\n\nfunction linear$1(t) {\n return +t;\n}\n\nfunction quadIn(t) {\n return t * t;\n}\n\nfunction quadOut(t) {\n return t * (2 - t);\n}\n\nfunction quadInOut(t) {\n return ((t *= 2) <= 1 ? t * t : --t * (2 - t) + 1) / 2;\n}\n\nfunction cubicIn(t) {\n return t * t * t;\n}\n\nfunction cubicOut(t) {\n return --t * t * t + 1;\n}\n\nfunction cubicInOut(t) {\n return ((t *= 2) <= 1 ? t * t * t : (t -= 2) * t * t + 2) / 2;\n}\n\nvar exponent = 3;\n\nvar polyIn = (function custom(e) {\n e = +e;\n\n function polyIn(t) {\n return Math.pow(t, e);\n }\n\n polyIn.exponent = custom;\n\n return polyIn;\n})(exponent);\n\nvar polyOut = (function custom(e) {\n e = +e;\n\n function polyOut(t) {\n return 1 - Math.pow(1 - t, e);\n }\n\n polyOut.exponent = custom;\n\n return polyOut;\n})(exponent);\n\nvar polyInOut = (function custom(e) {\n e = +e;\n\n function polyInOut(t) {\n return ((t *= 2) <= 1 ? Math.pow(t, e) : 2 - Math.pow(2 - t, e)) / 2;\n }\n\n polyInOut.exponent = custom;\n\n return polyInOut;\n})(exponent);\n\nvar pi = Math.PI;\nvar halfPi = pi / 2;\n\nfunction sinIn(t) {\n return 1 - Math.cos(t * halfPi);\n}\n\nfunction sinOut(t) {\n return Math.sin(t * halfPi);\n}\n\nfunction sinInOut(t) {\n return (1 - Math.cos(pi * t)) / 2;\n}\n\nfunction expIn(t) {\n return Math.pow(2, 10 * t - 10);\n}\n\nfunction expOut(t) {\n return 1 - Math.pow(2, -10 * t);\n}\n\nfunction expInOut(t) {\n return ((t *= 2) <= 1 ? Math.pow(2, 10 * t - 10) : 2 - Math.pow(2, 10 - 10 * t)) / 2;\n}\n\nfunction circleIn(t) {\n return 1 - Math.sqrt(1 - t * t);\n}\n\nfunction circleOut(t) {\n return Math.sqrt(1 - --t * t);\n}\n\nfunction circleInOut(t) {\n return ((t *= 2) <= 1 ? 1 - Math.sqrt(1 - t * t) : Math.sqrt(1 - (t -= 2) * t) + 1) / 2;\n}\n\nvar b1 = 4 / 11;\nvar b2 = 6 / 11;\nvar b3 = 8 / 11;\nvar b4 = 3 / 4;\nvar b5 = 9 / 11;\nvar b6 = 10 / 11;\nvar b7 = 15 / 16;\nvar b8 = 21 / 22;\nvar b9 = 63 / 64;\nvar b0 = 1 / b1 / b1;\n\nfunction bounceIn(t) {\n return 1 - bounceOut(1 - t);\n}\n\nfunction bounceOut(t) {\n return (t = +t) < b1 ? b0 * t * t : t < b3 ? b0 * (t -= b2) * t + b4 : t < b6 ? b0 * (t -= b5) * t + b7 : b0 * (t -= b8) * t + b9;\n}\n\nfunction bounceInOut(t) {\n return ((t *= 2) <= 1 ? 1 - bounceOut(1 - t) : bounceOut(t - 1) + 1) / 2;\n}\n\nvar overshoot = 1.70158;\n\nvar backIn = (function custom(s) {\n s = +s;\n\n function backIn(t) {\n return t * t * ((s + 1) * t - s);\n }\n\n backIn.overshoot = custom;\n\n return backIn;\n})(overshoot);\n\nvar backOut = (function custom(s) {\n s = +s;\n\n function backOut(t) {\n return --t * t * ((s + 1) * t + s) + 1;\n }\n\n backOut.overshoot = custom;\n\n return backOut;\n})(overshoot);\n\nvar backInOut = (function custom(s) {\n s = +s;\n\n function backInOut(t) {\n return ((t *= 2) < 1 ? t * t * ((s + 1) * t - s) : (t -= 2) * t * ((s + 1) * t + s) + 2) / 2;\n }\n\n backInOut.overshoot = custom;\n\n return backInOut;\n})(overshoot);\n\nvar tau = 2 * Math.PI;\nvar amplitude = 1;\nvar period = 0.3;\n\nvar elasticIn = (function custom(a, p) {\n var s = Math.asin(1 / (a = Math.max(1, a))) * (p /= tau);\n\n function elasticIn(t) {\n return a * Math.pow(2, 10 * --t) * Math.sin((s - t) / p);\n }\n\n elasticIn.amplitude = function(a) { return custom(a, p * tau); };\n elasticIn.period = function(p) { return custom(a, p); };\n\n return elasticIn;\n})(amplitude, period);\n\nvar elasticOut = (function custom(a, p) {\n var s = Math.asin(1 / (a = Math.max(1, a))) * (p /= tau);\n\n function elasticOut(t) {\n return 1 - a * Math.pow(2, -10 * (t = +t)) * Math.sin((t + s) / p);\n }\n\n elasticOut.amplitude = function(a) { return custom(a, p * tau); };\n elasticOut.period = function(p) { return custom(a, p); };\n\n return elasticOut;\n})(amplitude, period);\n\nvar elasticInOut = (function custom(a, p) {\n var s = Math.asin(1 / (a = Math.max(1, a))) * (p /= tau);\n\n function elasticInOut(t) {\n return ((t = t * 2 - 1) < 0\n ? a * Math.pow(2, 10 * t) * Math.sin((s - t) / p)\n : 2 - a * Math.pow(2, -10 * t) * Math.sin((s + t) / p)) / 2;\n }\n\n elasticInOut.amplitude = function(a) { return custom(a, p * tau); };\n elasticInOut.period = function(p) { return custom(a, p); };\n\n return elasticInOut;\n})(amplitude, period);\n\nvar defaultTiming = {\n time: null, // Set on use.\n delay: 0,\n duration: 250,\n ease: cubicInOut\n};\n\nfunction inherit(node, id) {\n var timing;\n while (!(timing = node.__transition) || !(timing = timing[id])) {\n if (!(node = node.parentNode)) {\n return defaultTiming.time = now(), defaultTiming;\n }\n }\n return timing;\n}\n\nvar selection_transition = function(name) {\n var id,\n timing;\n\n if (name instanceof Transition) {\n id = name._id, name = name._name;\n } else {\n id = newId(), (timing = defaultTiming).time = now(), name = name == null ? null : name + \"\";\n }\n\n for (var groups = this._groups, m = groups.length, j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) {\n if (node = group[i]) {\n schedule(node, name, id, i, group, timing || inherit(node, id));\n }\n }\n }\n\n return new Transition(groups, this._parents, name, id);\n};\n\nselection.prototype.interrupt = selection_interrupt;\nselection.prototype.transition = selection_transition;\n\nvar root$1 = [null];\n\nvar active = function(node, name) {\n var schedules = node.__transition,\n schedule$$1,\n i;\n\n if (schedules) {\n name = name == null ? null : name + \"\";\n for (i in schedules) {\n if ((schedule$$1 = schedules[i]).state > SCHEDULED && schedule$$1.name === name) {\n return new Transition([[node]], root$1, name, +i);\n }\n }\n }\n\n return null;\n};\n\nvar constant$4 = function(x) {\n return function() {\n return x;\n };\n};\n\nvar BrushEvent = function(target, type, selection) {\n this.target = target;\n this.type = type;\n this.selection = selection;\n};\n\nfunction nopropagation$1() {\n exports.event.stopImmediatePropagation();\n}\n\nvar noevent$1 = function() {\n exports.event.preventDefault();\n exports.event.stopImmediatePropagation();\n};\n\nvar MODE_DRAG = {name: \"drag\"};\nvar MODE_SPACE = {name: \"space\"};\nvar MODE_HANDLE = {name: \"handle\"};\nvar MODE_CENTER = {name: \"center\"};\n\nvar X = {\n name: \"x\",\n handles: [\"e\", \"w\"].map(type),\n input: function(x, e) { return x && [[x[0], e[0][1]], [x[1], e[1][1]]]; },\n output: function(xy) { return xy && [xy[0][0], xy[1][0]]; }\n};\n\nvar Y = {\n name: \"y\",\n handles: [\"n\", \"s\"].map(type),\n input: function(y, e) { return y && [[e[0][0], y[0]], [e[1][0], y[1]]]; },\n output: function(xy) { return xy && [xy[0][1], xy[1][1]]; }\n};\n\nvar XY = {\n name: \"xy\",\n handles: [\"n\", \"e\", \"s\", \"w\", \"nw\", \"ne\", \"se\", \"sw\"].map(type),\n input: function(xy) { return xy; },\n output: function(xy) { return xy; }\n};\n\nvar cursors = {\n overlay: \"crosshair\",\n selection: \"move\",\n n: \"ns-resize\",\n e: \"ew-resize\",\n s: \"ns-resize\",\n w: \"ew-resize\",\n nw: \"nwse-resize\",\n ne: \"nesw-resize\",\n se: \"nwse-resize\",\n sw: \"nesw-resize\"\n};\n\nvar flipX = {\n e: \"w\",\n w: \"e\",\n nw: \"ne\",\n ne: \"nw\",\n se: \"sw\",\n sw: \"se\"\n};\n\nvar flipY = {\n n: \"s\",\n s: \"n\",\n nw: \"sw\",\n ne: \"se\",\n se: \"ne\",\n sw: \"nw\"\n};\n\nvar signsX = {\n overlay: +1,\n selection: +1,\n n: null,\n e: +1,\n s: null,\n w: -1,\n nw: -1,\n ne: +1,\n se: +1,\n sw: -1\n};\n\nvar signsY = {\n overlay: +1,\n selection: +1,\n n: -1,\n e: null,\n s: +1,\n w: null,\n nw: -1,\n ne: -1,\n se: +1,\n sw: +1\n};\n\nfunction type(t) {\n return {type: t};\n}\n\n// Ignore right-click, since that should open the context menu.\nfunction defaultFilter() {\n return !exports.event.button;\n}\n\nfunction defaultExtent() {\n var svg = this.ownerSVGElement || this;\n return [[0, 0], [svg.width.baseVal.value, svg.height.baseVal.value]];\n}\n\n// Like d3.local, but with the name “__brush” rather than auto-generated.\nfunction local(node) {\n while (!node.__brush) if (!(node = node.parentNode)) return;\n return node.__brush;\n}\n\nfunction empty(extent) {\n return extent[0][0] === extent[1][0]\n || extent[0][1] === extent[1][1];\n}\n\nfunction brushSelection(node) {\n var state = node.__brush;\n return state ? state.dim.output(state.selection) : null;\n}\n\nfunction brushX() {\n return brush$1(X);\n}\n\nfunction brushY() {\n return brush$1(Y);\n}\n\nvar brush = function() {\n return brush$1(XY);\n};\n\nfunction brush$1(dim) {\n var extent = defaultExtent,\n filter = defaultFilter,\n listeners = dispatch(brush, \"start\", \"brush\", \"end\"),\n handleSize = 6,\n touchending;\n\n function brush(group) {\n var overlay = group\n .property(\"__brush\", initialize)\n .selectAll(\".overlay\")\n .data([type(\"overlay\")]);\n\n overlay.enter().append(\"rect\")\n .attr(\"class\", \"overlay\")\n .attr(\"pointer-events\", \"all\")\n .attr(\"cursor\", cursors.overlay)\n .merge(overlay)\n .each(function() {\n var extent = local(this).extent;\n select(this)\n .attr(\"x\", extent[0][0])\n .attr(\"y\", extent[0][1])\n .attr(\"width\", extent[1][0] - extent[0][0])\n .attr(\"height\", extent[1][1] - extent[0][1]);\n });\n\n group.selectAll(\".selection\")\n .data([type(\"selection\")])\n .enter().append(\"rect\")\n .attr(\"class\", \"selection\")\n .attr(\"cursor\", cursors.selection)\n .attr(\"fill\", \"#777\")\n .attr(\"fill-opacity\", 0.3)\n .attr(\"stroke\", \"#fff\")\n .attr(\"shape-rendering\", \"crispEdges\");\n\n var handle = group.selectAll(\".handle\")\n .data(dim.handles, function(d) { return d.type; });\n\n handle.exit().remove();\n\n handle.enter().append(\"rect\")\n .attr(\"class\", function(d) { return \"handle handle--\" + d.type; })\n .attr(\"cursor\", function(d) { return cursors[d.type]; });\n\n group\n .each(redraw)\n .attr(\"fill\", \"none\")\n .attr(\"pointer-events\", \"all\")\n .style(\"-webkit-tap-highlight-color\", \"rgba(0,0,0,0)\")\n .on(\"mousedown.brush touchstart.brush\", started);\n }\n\n brush.move = function(group, selection) {\n if (group.selection) {\n group\n .on(\"start.brush\", function() { emitter(this, arguments).beforestart().start(); })\n .on(\"interrupt.brush end.brush\", function() { emitter(this, arguments).end(); })\n .tween(\"brush\", function() {\n var that = this,\n state = that.__brush,\n emit = emitter(that, arguments),\n selection0 = state.selection,\n selection1 = dim.input(typeof selection === \"function\" ? selection.apply(this, arguments) : selection, state.extent),\n i = interpolateValue(selection0, selection1);\n\n function tween(t) {\n state.selection = t === 1 && empty(selection1) ? null : i(t);\n redraw.call(that);\n emit.brush();\n }\n\n return selection0 && selection1 ? tween : tween(1);\n });\n } else {\n group\n .each(function() {\n var that = this,\n args = arguments,\n state = that.__brush,\n selection1 = dim.input(typeof selection === \"function\" ? selection.apply(that, args) : selection, state.extent),\n emit = emitter(that, args).beforestart();\n\n interrupt(that);\n state.selection = selection1 == null || empty(selection1) ? null : selection1;\n redraw.call(that);\n emit.start().brush().end();\n });\n }\n };\n\n function redraw() {\n var group = select(this),\n selection = local(this).selection;\n\n if (selection) {\n group.selectAll(\".selection\")\n .style(\"display\", null)\n .attr(\"x\", selection[0][0])\n .attr(\"y\", selection[0][1])\n .attr(\"width\", selection[1][0] - selection[0][0])\n .attr(\"height\", selection[1][1] - selection[0][1]);\n\n group.selectAll(\".handle\")\n .style(\"display\", null)\n .attr(\"x\", function(d) { return d.type[d.type.length - 1] === \"e\" ? selection[1][0] - handleSize / 2 : selection[0][0] - handleSize / 2; })\n .attr(\"y\", function(d) { return d.type[0] === \"s\" ? selection[1][1] - handleSize / 2 : selection[0][1] - handleSize / 2; })\n .attr(\"width\", function(d) { return d.type === \"n\" || d.type === \"s\" ? selection[1][0] - selection[0][0] + handleSize : handleSize; })\n .attr(\"height\", function(d) { return d.type === \"e\" || d.type === \"w\" ? selection[1][1] - selection[0][1] + handleSize : handleSize; });\n }\n\n else {\n group.selectAll(\".selection,.handle\")\n .style(\"display\", \"none\")\n .attr(\"x\", null)\n .attr(\"y\", null)\n .attr(\"width\", null)\n .attr(\"height\", null);\n }\n }\n\n function emitter(that, args) {\n return that.__brush.emitter || new Emitter(that, args);\n }\n\n function Emitter(that, args) {\n this.that = that;\n this.args = args;\n this.state = that.__brush;\n this.active = 0;\n }\n\n Emitter.prototype = {\n beforestart: function() {\n if (++this.active === 1) this.state.emitter = this, this.starting = true;\n return this;\n },\n start: function() {\n if (this.starting) this.starting = false, this.emit(\"start\");\n return this;\n },\n brush: function() {\n this.emit(\"brush\");\n return this;\n },\n end: function() {\n if (--this.active === 0) delete this.state.emitter, this.emit(\"end\");\n return this;\n },\n emit: function(type) {\n customEvent(new BrushEvent(brush, type, dim.output(this.state.selection)), listeners.apply, listeners, [type, this.that, this.args]);\n }\n };\n\n function started() {\n if (exports.event.touches) { if (exports.event.changedTouches.length < exports.event.touches.length) return noevent$1(); }\n else if (touchending) return;\n if (!filter.apply(this, arguments)) return;\n\n var that = this,\n type = exports.event.target.__data__.type,\n mode = (exports.event.metaKey ? type = \"overlay\" : type) === \"selection\" ? MODE_DRAG : (exports.event.altKey ? MODE_CENTER : MODE_HANDLE),\n signX = dim === Y ? null : signsX[type],\n signY = dim === X ? null : signsY[type],\n state = local(that),\n extent = state.extent,\n selection = state.selection,\n W = extent[0][0], w0, w1,\n N = extent[0][1], n0, n1,\n E = extent[1][0], e0, e1,\n S = extent[1][1], s0, s1,\n dx,\n dy,\n moving,\n shifting = signX && signY && exports.event.shiftKey,\n lockX,\n lockY,\n point0 = mouse(that),\n point = point0,\n emit = emitter(that, arguments).beforestart();\n\n if (type === \"overlay\") {\n state.selection = selection = [\n [w0 = dim === Y ? W : point0[0], n0 = dim === X ? N : point0[1]],\n [e0 = dim === Y ? E : w0, s0 = dim === X ? S : n0]\n ];\n } else {\n w0 = selection[0][0];\n n0 = selection[0][1];\n e0 = selection[1][0];\n s0 = selection[1][1];\n }\n\n w1 = w0;\n n1 = n0;\n e1 = e0;\n s1 = s0;\n\n var group = select(that)\n .attr(\"pointer-events\", \"none\");\n\n var overlay = group.selectAll(\".overlay\")\n .attr(\"cursor\", cursors[type]);\n\n if (exports.event.touches) {\n group\n .on(\"touchmove.brush\", moved, true)\n .on(\"touchend.brush touchcancel.brush\", ended, true);\n } else {\n var view = select(exports.event.view)\n .on(\"keydown.brush\", keydowned, true)\n .on(\"keyup.brush\", keyupped, true)\n .on(\"mousemove.brush\", moved, true)\n .on(\"mouseup.brush\", ended, true);\n\n dragDisable(exports.event.view);\n }\n\n nopropagation$1();\n interrupt(that);\n redraw.call(that);\n emit.start();\n\n function moved() {\n var point1 = mouse(that);\n if (shifting && !lockX && !lockY) {\n if (Math.abs(point1[0] - point[0]) > Math.abs(point1[1] - point[1])) lockY = true;\n else lockX = true;\n }\n point = point1;\n moving = true;\n noevent$1();\n move();\n }\n\n function move() {\n var t;\n\n dx = point[0] - point0[0];\n dy = point[1] - point0[1];\n\n switch (mode) {\n case MODE_SPACE:\n case MODE_DRAG: {\n if (signX) dx = Math.max(W - w0, Math.min(E - e0, dx)), w1 = w0 + dx, e1 = e0 + dx;\n if (signY) dy = Math.max(N - n0, Math.min(S - s0, dy)), n1 = n0 + dy, s1 = s0 + dy;\n break;\n }\n case MODE_HANDLE: {\n if (signX < 0) dx = Math.max(W - w0, Math.min(E - w0, dx)), w1 = w0 + dx, e1 = e0;\n else if (signX > 0) dx = Math.max(W - e0, Math.min(E - e0, dx)), w1 = w0, e1 = e0 + dx;\n if (signY < 0) dy = Math.max(N - n0, Math.min(S - n0, dy)), n1 = n0 + dy, s1 = s0;\n else if (signY > 0) dy = Math.max(N - s0, Math.min(S - s0, dy)), n1 = n0, s1 = s0 + dy;\n break;\n }\n case MODE_CENTER: {\n if (signX) w1 = Math.max(W, Math.min(E, w0 - dx * signX)), e1 = Math.max(W, Math.min(E, e0 + dx * signX));\n if (signY) n1 = Math.max(N, Math.min(S, n0 - dy * signY)), s1 = Math.max(N, Math.min(S, s0 + dy * signY));\n break;\n }\n }\n\n if (e1 < w1) {\n signX *= -1;\n t = w0, w0 = e0, e0 = t;\n t = w1, w1 = e1, e1 = t;\n if (type in flipX) overlay.attr(\"cursor\", cursors[type = flipX[type]]);\n }\n\n if (s1 < n1) {\n signY *= -1;\n t = n0, n0 = s0, s0 = t;\n t = n1, n1 = s1, s1 = t;\n if (type in flipY) overlay.attr(\"cursor\", cursors[type = flipY[type]]);\n }\n\n if (state.selection) selection = state.selection; // May be set by brush.move!\n if (lockX) w1 = selection[0][0], e1 = selection[1][0];\n if (lockY) n1 = selection[0][1], s1 = selection[1][1];\n\n if (selection[0][0] !== w1\n || selection[0][1] !== n1\n || selection[1][0] !== e1\n || selection[1][1] !== s1) {\n state.selection = [[w1, n1], [e1, s1]];\n redraw.call(that);\n emit.brush();\n }\n }\n\n function ended() {\n nopropagation$1();\n if (exports.event.touches) {\n if (exports.event.touches.length) return;\n if (touchending) clearTimeout(touchending);\n touchending = setTimeout(function() { touchending = null; }, 500); // Ghost clicks are delayed!\n group.on(\"touchmove.brush touchend.brush touchcancel.brush\", null);\n } else {\n yesdrag(exports.event.view, moving);\n view.on(\"keydown.brush keyup.brush mousemove.brush mouseup.brush\", null);\n }\n group.attr(\"pointer-events\", \"all\");\n overlay.attr(\"cursor\", cursors.overlay);\n if (state.selection) selection = state.selection; // May be set by brush.move (on start)!\n if (empty(selection)) state.selection = null, redraw.call(that);\n emit.end();\n }\n\n function keydowned() {\n switch (exports.event.keyCode) {\n case 16: { // SHIFT\n shifting = signX && signY;\n break;\n }\n case 18: { // ALT\n if (mode === MODE_HANDLE) {\n if (signX) e0 = e1 - dx * signX, w0 = w1 + dx * signX;\n if (signY) s0 = s1 - dy * signY, n0 = n1 + dy * signY;\n mode = MODE_CENTER;\n move();\n }\n break;\n }\n case 32: { // SPACE; takes priority over ALT\n if (mode === MODE_HANDLE || mode === MODE_CENTER) {\n if (signX < 0) e0 = e1 - dx; else if (signX > 0) w0 = w1 - dx;\n if (signY < 0) s0 = s1 - dy; else if (signY > 0) n0 = n1 - dy;\n mode = MODE_SPACE;\n overlay.attr(\"cursor\", cursors.selection);\n move();\n }\n break;\n }\n default: return;\n }\n noevent$1();\n }\n\n function keyupped() {\n switch (exports.event.keyCode) {\n case 16: { // SHIFT\n if (shifting) {\n lockX = lockY = shifting = false;\n move();\n }\n break;\n }\n case 18: { // ALT\n if (mode === MODE_CENTER) {\n if (signX < 0) e0 = e1; else if (signX > 0) w0 = w1;\n if (signY < 0) s0 = s1; else if (signY > 0) n0 = n1;\n mode = MODE_HANDLE;\n move();\n }\n break;\n }\n case 32: { // SPACE\n if (mode === MODE_SPACE) {\n if (exports.event.altKey) {\n if (signX) e0 = e1 - dx * signX, w0 = w1 + dx * signX;\n if (signY) s0 = s1 - dy * signY, n0 = n1 + dy * signY;\n mode = MODE_CENTER;\n } else {\n if (signX < 0) e0 = e1; else if (signX > 0) w0 = w1;\n if (signY < 0) s0 = s1; else if (signY > 0) n0 = n1;\n mode = MODE_HANDLE;\n }\n overlay.attr(\"cursor\", cursors[type]);\n move();\n }\n break;\n }\n default: return;\n }\n noevent$1();\n }\n }\n\n function initialize() {\n var state = this.__brush || {selection: null};\n state.extent = extent.apply(this, arguments);\n state.dim = dim;\n return state;\n }\n\n brush.extent = function(_) {\n return arguments.length ? (extent = typeof _ === \"function\" ? _ : constant$4([[+_[0][0], +_[0][1]], [+_[1][0], +_[1][1]]]), brush) : extent;\n };\n\n brush.filter = function(_) {\n return arguments.length ? (filter = typeof _ === \"function\" ? _ : constant$4(!!_), brush) : filter;\n };\n\n brush.handleSize = function(_) {\n return arguments.length ? (handleSize = +_, brush) : handleSize;\n };\n\n brush.on = function() {\n var value = listeners.on.apply(listeners, arguments);\n return value === listeners ? brush : value;\n };\n\n return brush;\n}\n\nvar cos = Math.cos;\nvar sin = Math.sin;\nvar pi$1 = Math.PI;\nvar halfPi$1 = pi$1 / 2;\nvar tau$1 = pi$1 * 2;\nvar max$1 = Math.max;\n\nfunction compareValue(compare) {\n return function(a, b) {\n return compare(\n a.source.value + a.target.value,\n b.source.value + b.target.value\n );\n };\n}\n\nvar chord = function() {\n var padAngle = 0,\n sortGroups = null,\n sortSubgroups = null,\n sortChords = null;\n\n function chord(matrix) {\n var n = matrix.length,\n groupSums = [],\n groupIndex = sequence(n),\n subgroupIndex = [],\n chords = [],\n groups = chords.groups = new Array(n),\n subgroups = new Array(n * n),\n k,\n x,\n x0,\n dx,\n i,\n j;\n\n // Compute the sum.\n k = 0, i = -1; while (++i < n) {\n x = 0, j = -1; while (++j < n) {\n x += matrix[i][j];\n }\n groupSums.push(x);\n subgroupIndex.push(sequence(n));\n k += x;\n }\n\n // Sort groups…\n if (sortGroups) groupIndex.sort(function(a, b) {\n return sortGroups(groupSums[a], groupSums[b]);\n });\n\n // Sort subgroups…\n if (sortSubgroups) subgroupIndex.forEach(function(d, i) {\n d.sort(function(a, b) {\n return sortSubgroups(matrix[i][a], matrix[i][b]);\n });\n });\n\n // Convert the sum to scaling factor for [0, 2pi].\n // TODO Allow start and end angle to be specified?\n // TODO Allow padding to be specified as percentage?\n k = max$1(0, tau$1 - padAngle * n) / k;\n dx = k ? padAngle : tau$1 / n;\n\n // Compute the start and end angle for each group and subgroup.\n // Note: Opera has a bug reordering object literal properties!\n x = 0, i = -1; while (++i < n) {\n x0 = x, j = -1; while (++j < n) {\n var di = groupIndex[i],\n dj = subgroupIndex[di][j],\n v = matrix[di][dj],\n a0 = x,\n a1 = x += v * k;\n subgroups[dj * n + di] = {\n index: di,\n subindex: dj,\n startAngle: a0,\n endAngle: a1,\n value: v\n };\n }\n groups[di] = {\n index: di,\n startAngle: x0,\n endAngle: x,\n value: groupSums[di]\n };\n x += dx;\n }\n\n // Generate chords for each (non-empty) subgroup-subgroup link.\n i = -1; while (++i < n) {\n j = i - 1; while (++j < n) {\n var source = subgroups[j * n + i],\n target = subgroups[i * n + j];\n if (source.value || target.value) {\n chords.push(source.value < target.value\n ? {source: target, target: source}\n : {source: source, target: target});\n }\n }\n }\n\n return sortChords ? chords.sort(sortChords) : chords;\n }\n\n chord.padAngle = function(_) {\n return arguments.length ? (padAngle = max$1(0, _), chord) : padAngle;\n };\n\n chord.sortGroups = function(_) {\n return arguments.length ? (sortGroups = _, chord) : sortGroups;\n };\n\n chord.sortSubgroups = function(_) {\n return arguments.length ? (sortSubgroups = _, chord) : sortSubgroups;\n };\n\n chord.sortChords = function(_) {\n return arguments.length ? (_ == null ? sortChords = null : (sortChords = compareValue(_))._ = _, chord) : sortChords && sortChords._;\n };\n\n return chord;\n};\n\nvar slice$2 = Array.prototype.slice;\n\nvar constant$5 = function(x) {\n return function() {\n return x;\n };\n};\n\nvar pi$2 = Math.PI;\nvar tau$2 = 2 * pi$2;\nvar epsilon$1 = 1e-6;\nvar tauEpsilon = tau$2 - epsilon$1;\n\nfunction Path() {\n this._x0 = this._y0 = // start of current subpath\n this._x1 = this._y1 = null; // end of current subpath\n this._ = \"\";\n}\n\nfunction path() {\n return new Path;\n}\n\nPath.prototype = path.prototype = {\n constructor: Path,\n moveTo: function(x, y) {\n this._ += \"M\" + (this._x0 = this._x1 = +x) + \",\" + (this._y0 = this._y1 = +y);\n },\n closePath: function() {\n if (this._x1 !== null) {\n this._x1 = this._x0, this._y1 = this._y0;\n this._ += \"Z\";\n }\n },\n lineTo: function(x, y) {\n this._ += \"L\" + (this._x1 = +x) + \",\" + (this._y1 = +y);\n },\n quadraticCurveTo: function(x1, y1, x, y) {\n this._ += \"Q\" + (+x1) + \",\" + (+y1) + \",\" + (this._x1 = +x) + \",\" + (this._y1 = +y);\n },\n bezierCurveTo: function(x1, y1, x2, y2, x, y) {\n this._ += \"C\" + (+x1) + \",\" + (+y1) + \",\" + (+x2) + \",\" + (+y2) + \",\" + (this._x1 = +x) + \",\" + (this._y1 = +y);\n },\n arcTo: function(x1, y1, x2, y2, r) {\n x1 = +x1, y1 = +y1, x2 = +x2, y2 = +y2, r = +r;\n var x0 = this._x1,\n y0 = this._y1,\n x21 = x2 - x1,\n y21 = y2 - y1,\n x01 = x0 - x1,\n y01 = y0 - y1,\n l01_2 = x01 * x01 + y01 * y01;\n\n // Is the radius negative? Error.\n if (r < 0) throw new Error(\"negative radius: \" + r);\n\n // Is this path empty? Move to (x1,y1).\n if (this._x1 === null) {\n this._ += \"M\" + (this._x1 = x1) + \",\" + (this._y1 = y1);\n }\n\n // Or, is (x1,y1) coincident with (x0,y0)? Do nothing.\n else if (!(l01_2 > epsilon$1)) {}\n\n // Or, are (x0,y0), (x1,y1) and (x2,y2) collinear?\n // Equivalently, is (x1,y1) coincident with (x2,y2)?\n // Or, is the radius zero? Line to (x1,y1).\n else if (!(Math.abs(y01 * x21 - y21 * x01) > epsilon$1) || !r) {\n this._ += \"L\" + (this._x1 = x1) + \",\" + (this._y1 = y1);\n }\n\n // Otherwise, draw an arc!\n else {\n var x20 = x2 - x0,\n y20 = y2 - y0,\n l21_2 = x21 * x21 + y21 * y21,\n l20_2 = x20 * x20 + y20 * y20,\n l21 = Math.sqrt(l21_2),\n l01 = Math.sqrt(l01_2),\n l = r * Math.tan((pi$2 - Math.acos((l21_2 + l01_2 - l20_2) / (2 * l21 * l01))) / 2),\n t01 = l / l01,\n t21 = l / l21;\n\n // If the start tangent is not coincident with (x0,y0), line to.\n if (Math.abs(t01 - 1) > epsilon$1) {\n this._ += \"L\" + (x1 + t01 * x01) + \",\" + (y1 + t01 * y01);\n }\n\n this._ += \"A\" + r + \",\" + r + \",0,0,\" + (+(y01 * x20 > x01 * y20)) + \",\" + (this._x1 = x1 + t21 * x21) + \",\" + (this._y1 = y1 + t21 * y21);\n }\n },\n arc: function(x, y, r, a0, a1, ccw) {\n x = +x, y = +y, r = +r;\n var dx = r * Math.cos(a0),\n dy = r * Math.sin(a0),\n x0 = x + dx,\n y0 = y + dy,\n cw = 1 ^ ccw,\n da = ccw ? a0 - a1 : a1 - a0;\n\n // Is the radius negative? Error.\n if (r < 0) throw new Error(\"negative radius: \" + r);\n\n // Is this path empty? Move to (x0,y0).\n if (this._x1 === null) {\n this._ += \"M\" + x0 + \",\" + y0;\n }\n\n // Or, is (x0,y0) not coincident with the previous point? Line to (x0,y0).\n else if (Math.abs(this._x1 - x0) > epsilon$1 || Math.abs(this._y1 - y0) > epsilon$1) {\n this._ += \"L\" + x0 + \",\" + y0;\n }\n\n // Is this arc empty? We’re done.\n if (!r) return;\n\n // Does the angle go the wrong way? Flip the direction.\n if (da < 0) da = da % tau$2 + tau$2;\n\n // Is this a complete circle? Draw two arcs to complete the circle.\n if (da > tauEpsilon) {\n this._ += \"A\" + r + \",\" + r + \",0,1,\" + cw + \",\" + (x - dx) + \",\" + (y - dy) + \"A\" + r + \",\" + r + \",0,1,\" + cw + \",\" + (this._x1 = x0) + \",\" + (this._y1 = y0);\n }\n\n // Is this arc non-empty? Draw an arc!\n else if (da > epsilon$1) {\n this._ += \"A\" + r + \",\" + r + \",0,\" + (+(da >= pi$2)) + \",\" + cw + \",\" + (this._x1 = x + r * Math.cos(a1)) + \",\" + (this._y1 = y + r * Math.sin(a1));\n }\n },\n rect: function(x, y, w, h) {\n this._ += \"M\" + (this._x0 = this._x1 = +x) + \",\" + (this._y0 = this._y1 = +y) + \"h\" + (+w) + \"v\" + (+h) + \"h\" + (-w) + \"Z\";\n },\n toString: function() {\n return this._;\n }\n};\n\nfunction defaultSource(d) {\n return d.source;\n}\n\nfunction defaultTarget(d) {\n return d.target;\n}\n\nfunction defaultRadius(d) {\n return d.radius;\n}\n\nfunction defaultStartAngle(d) {\n return d.startAngle;\n}\n\nfunction defaultEndAngle(d) {\n return d.endAngle;\n}\n\nvar ribbon = function() {\n var source = defaultSource,\n target = defaultTarget,\n radius = defaultRadius,\n startAngle = defaultStartAngle,\n endAngle = defaultEndAngle,\n context = null;\n\n function ribbon() {\n var buffer,\n argv = slice$2.call(arguments),\n s = source.apply(this, argv),\n t = target.apply(this, argv),\n sr = +radius.apply(this, (argv[0] = s, argv)),\n sa0 = startAngle.apply(this, argv) - halfPi$1,\n sa1 = endAngle.apply(this, argv) - halfPi$1,\n sx0 = sr * cos(sa0),\n sy0 = sr * sin(sa0),\n tr = +radius.apply(this, (argv[0] = t, argv)),\n ta0 = startAngle.apply(this, argv) - halfPi$1,\n ta1 = endAngle.apply(this, argv) - halfPi$1;\n\n if (!context) context = buffer = path();\n\n context.moveTo(sx0, sy0);\n context.arc(0, 0, sr, sa0, sa1);\n if (sa0 !== ta0 || sa1 !== ta1) { // TODO sr !== tr?\n context.quadraticCurveTo(0, 0, tr * cos(ta0), tr * sin(ta0));\n context.arc(0, 0, tr, ta0, ta1);\n }\n context.quadraticCurveTo(0, 0, sx0, sy0);\n context.closePath();\n\n if (buffer) return context = null, buffer + \"\" || null;\n }\n\n ribbon.radius = function(_) {\n return arguments.length ? (radius = typeof _ === \"function\" ? _ : constant$5(+_), ribbon) : radius;\n };\n\n ribbon.startAngle = function(_) {\n return arguments.length ? (startAngle = typeof _ === \"function\" ? _ : constant$5(+_), ribbon) : startAngle;\n };\n\n ribbon.endAngle = function(_) {\n return arguments.length ? (endAngle = typeof _ === \"function\" ? _ : constant$5(+_), ribbon) : endAngle;\n };\n\n ribbon.source = function(_) {\n return arguments.length ? (source = _, ribbon) : source;\n };\n\n ribbon.target = function(_) {\n return arguments.length ? (target = _, ribbon) : target;\n };\n\n ribbon.context = function(_) {\n return arguments.length ? ((context = _ == null ? null : _), ribbon) : context;\n };\n\n return ribbon;\n};\n\nvar prefix = \"$\";\n\nfunction Map() {}\n\nMap.prototype = map$1.prototype = {\n constructor: Map,\n has: function(key) {\n return (prefix + key) in this;\n },\n get: function(key) {\n return this[prefix + key];\n },\n set: function(key, value) {\n this[prefix + key] = value;\n return this;\n },\n remove: function(key) {\n var property = prefix + key;\n return property in this && delete this[property];\n },\n clear: function() {\n for (var property in this) if (property[0] === prefix) delete this[property];\n },\n keys: function() {\n var keys = [];\n for (var property in this) if (property[0] === prefix) keys.push(property.slice(1));\n return keys;\n },\n values: function() {\n var values = [];\n for (var property in this) if (property[0] === prefix) values.push(this[property]);\n return values;\n },\n entries: function() {\n var entries = [];\n for (var property in this) if (property[0] === prefix) entries.push({key: property.slice(1), value: this[property]});\n return entries;\n },\n size: function() {\n var size = 0;\n for (var property in this) if (property[0] === prefix) ++size;\n return size;\n },\n empty: function() {\n for (var property in this) if (property[0] === prefix) return false;\n return true;\n },\n each: function(f) {\n for (var property in this) if (property[0] === prefix) f(this[property], property.slice(1), this);\n }\n};\n\nfunction map$1(object, f) {\n var map = new Map;\n\n // Copy constructor.\n if (object instanceof Map) object.each(function(value, key) { map.set(key, value); });\n\n // Index array by numeric index or specified key function.\n else if (Array.isArray(object)) {\n var i = -1,\n n = object.length,\n o;\n\n if (f == null) while (++i < n) map.set(i, object[i]);\n else while (++i < n) map.set(f(o = object[i], i, object), o);\n }\n\n // Convert object to map.\n else if (object) for (var key in object) map.set(key, object[key]);\n\n return map;\n}\n\nvar nest = function() {\n var keys = [],\n sortKeys = [],\n sortValues,\n rollup,\n nest;\n\n function apply(array, depth, createResult, setResult) {\n if (depth >= keys.length) {\n if (sortValues != null) array.sort(sortValues);\n return rollup != null ? rollup(array) : array;\n }\n\n var i = -1,\n n = array.length,\n key = keys[depth++],\n keyValue,\n value,\n valuesByKey = map$1(),\n values,\n result = createResult();\n\n while (++i < n) {\n if (values = valuesByKey.get(keyValue = key(value = array[i]) + \"\")) {\n values.push(value);\n } else {\n valuesByKey.set(keyValue, [value]);\n }\n }\n\n valuesByKey.each(function(values, key) {\n setResult(result, key, apply(values, depth, createResult, setResult));\n });\n\n return result;\n }\n\n function entries(map, depth) {\n if (++depth > keys.length) return map;\n var array, sortKey = sortKeys[depth - 1];\n if (rollup != null && depth >= keys.length) array = map.entries();\n else array = [], map.each(function(v, k) { array.push({key: k, values: entries(v, depth)}); });\n return sortKey != null ? array.sort(function(a, b) { return sortKey(a.key, b.key); }) : array;\n }\n\n return nest = {\n object: function(array) { return apply(array, 0, createObject, setObject); },\n map: function(array) { return apply(array, 0, createMap, setMap); },\n entries: function(array) { return entries(apply(array, 0, createMap, setMap), 0); },\n key: function(d) { keys.push(d); return nest; },\n sortKeys: function(order) { sortKeys[keys.length - 1] = order; return nest; },\n sortValues: function(order) { sortValues = order; return nest; },\n rollup: function(f) { rollup = f; return nest; }\n };\n};\n\nfunction createObject() {\n return {};\n}\n\nfunction setObject(object, key, value) {\n object[key] = value;\n}\n\nfunction createMap() {\n return map$1();\n}\n\nfunction setMap(map, key, value) {\n map.set(key, value);\n}\n\nfunction Set() {}\n\nvar proto = map$1.prototype;\n\nSet.prototype = set$2.prototype = {\n constructor: Set,\n has: proto.has,\n add: function(value) {\n value += \"\";\n this[prefix + value] = value;\n return this;\n },\n remove: proto.remove,\n clear: proto.clear,\n values: proto.keys,\n size: proto.size,\n empty: proto.empty,\n each: proto.each\n};\n\nfunction set$2(object, f) {\n var set = new Set;\n\n // Copy constructor.\n if (object instanceof Set) object.each(function(value) { set.add(value); });\n\n // Otherwise, assume it’s an array.\n else if (object) {\n var i = -1, n = object.length;\n if (f == null) while (++i < n) set.add(object[i]);\n else while (++i < n) set.add(f(object[i], i, object));\n }\n\n return set;\n}\n\nvar keys = function(map) {\n var keys = [];\n for (var key in map) keys.push(key);\n return keys;\n};\n\nvar values = function(map) {\n var values = [];\n for (var key in map) values.push(map[key]);\n return values;\n};\n\nvar entries = function(map) {\n var entries = [];\n for (var key in map) entries.push({key: key, value: map[key]});\n return entries;\n};\n\nvar EOL = {};\nvar EOF = {};\nvar QUOTE = 34;\nvar NEWLINE = 10;\nvar RETURN = 13;\n\nfunction objectConverter(columns) {\n return new Function(\"d\", \"return {\" + columns.map(function(name, i) {\n return JSON.stringify(name) + \": d[\" + i + \"]\";\n }).join(\",\") + \"}\");\n}\n\nfunction customConverter(columns, f) {\n var object = objectConverter(columns);\n return function(row, i) {\n return f(object(row), i, columns);\n };\n}\n\n// Compute unique columns in order of discovery.\nfunction inferColumns(rows) {\n var columnSet = Object.create(null),\n columns = [];\n\n rows.forEach(function(row) {\n for (var column in row) {\n if (!(column in columnSet)) {\n columns.push(columnSet[column] = column);\n }\n }\n });\n\n return columns;\n}\n\nvar dsv = function(delimiter) {\n var reFormat = new RegExp(\"[\\\"\" + delimiter + \"\\n\\r]\"),\n DELIMITER = delimiter.charCodeAt(0);\n\n function parse(text, f) {\n var convert, columns, rows = parseRows(text, function(row, i) {\n if (convert) return convert(row, i - 1);\n columns = row, convert = f ? customConverter(row, f) : objectConverter(row);\n });\n rows.columns = columns;\n return rows;\n }\n\n function parseRows(text, f) {\n var rows = [], // output rows\n N = text.length,\n I = 0, // current character index\n n = 0, // current line number\n t, // current token\n eof = N <= 0, // current token followed by EOF?\n eol = false; // current token followed by EOL?\n\n // Strip the trailing newline.\n if (text.charCodeAt(N - 1) === NEWLINE) --N;\n if (text.charCodeAt(N - 1) === RETURN) --N;\n\n function token() {\n if (eof) return EOF;\n if (eol) return eol = false, EOL;\n\n // Unescape quotes.\n var i, j = I, c;\n if (text.charCodeAt(j) === QUOTE) {\n while (I++ < N && text.charCodeAt(I) !== QUOTE || text.charCodeAt(++I) === QUOTE);\n if ((i = I) >= N) eof = true;\n else if ((c = text.charCodeAt(I++)) === NEWLINE) eol = true;\n else if (c === RETURN) { eol = true; if (text.charCodeAt(I) === NEWLINE) ++I; }\n return text.slice(j + 1, i - 1).replace(/\"\"/g, \"\\\"\");\n }\n\n // Find next delimiter or newline.\n while (I < N) {\n if ((c = text.charCodeAt(i = I++)) === NEWLINE) eol = true;\n else if (c === RETURN) { eol = true; if (text.charCodeAt(I) === NEWLINE) ++I; }\n else if (c !== DELIMITER) continue;\n return text.slice(j, i);\n }\n\n // Return last token before EOF.\n return eof = true, text.slice(j, N);\n }\n\n while ((t = token()) !== EOF) {\n var row = [];\n while (t !== EOL && t !== EOF) row.push(t), t = token();\n if (f && (row = f(row, n++)) == null) continue;\n rows.push(row);\n }\n\n return rows;\n }\n\n function format(rows, columns) {\n if (columns == null) columns = inferColumns(rows);\n return [columns.map(formatValue).join(delimiter)].concat(rows.map(function(row) {\n return columns.map(function(column) {\n return formatValue(row[column]);\n }).join(delimiter);\n })).join(\"\\n\");\n }\n\n function formatRows(rows) {\n return rows.map(formatRow).join(\"\\n\");\n }\n\n function formatRow(row) {\n return row.map(formatValue).join(delimiter);\n }\n\n function formatValue(text) {\n return text == null ? \"\"\n : reFormat.test(text += \"\") ? \"\\\"\" + text.replace(/\"/g, \"\\\"\\\"\") + \"\\\"\"\n : text;\n }\n\n return {\n parse: parse,\n parseRows: parseRows,\n format: format,\n formatRows: formatRows\n };\n};\n\nvar csv = dsv(\",\");\n\nvar csvParse = csv.parse;\nvar csvParseRows = csv.parseRows;\nvar csvFormat = csv.format;\nvar csvFormatRows = csv.formatRows;\n\nvar tsv = dsv(\"\\t\");\n\nvar tsvParse = tsv.parse;\nvar tsvParseRows = tsv.parseRows;\nvar tsvFormat = tsv.format;\nvar tsvFormatRows = tsv.formatRows;\n\nvar center$1 = function(x, y) {\n var nodes;\n\n if (x == null) x = 0;\n if (y == null) y = 0;\n\n function force() {\n var i,\n n = nodes.length,\n node,\n sx = 0,\n sy = 0;\n\n for (i = 0; i < n; ++i) {\n node = nodes[i], sx += node.x, sy += node.y;\n }\n\n for (sx = sx / n - x, sy = sy / n - y, i = 0; i < n; ++i) {\n node = nodes[i], node.x -= sx, node.y -= sy;\n }\n }\n\n force.initialize = function(_) {\n nodes = _;\n };\n\n force.x = function(_) {\n return arguments.length ? (x = +_, force) : x;\n };\n\n force.y = function(_) {\n return arguments.length ? (y = +_, force) : y;\n };\n\n return force;\n};\n\nvar constant$6 = function(x) {\n return function() {\n return x;\n };\n};\n\nvar jiggle = function() {\n return (Math.random() - 0.5) * 1e-6;\n};\n\nvar tree_add = function(d) {\n var x = +this._x.call(null, d),\n y = +this._y.call(null, d);\n return add(this.cover(x, y), x, y, d);\n};\n\nfunction add(tree, x, y, d) {\n if (isNaN(x) || isNaN(y)) return tree; // ignore invalid points\n\n var parent,\n node = tree._root,\n leaf = {data: d},\n x0 = tree._x0,\n y0 = tree._y0,\n x1 = tree._x1,\n y1 = tree._y1,\n xm,\n ym,\n xp,\n yp,\n right,\n bottom,\n i,\n j;\n\n // If the tree is empty, initialize the root as a leaf.\n if (!node) return tree._root = leaf, tree;\n\n // Find the existing leaf for the new point, or add it.\n while (node.length) {\n if (right = x >= (xm = (x0 + x1) / 2)) x0 = xm; else x1 = xm;\n if (bottom = y >= (ym = (y0 + y1) / 2)) y0 = ym; else y1 = ym;\n if (parent = node, !(node = node[i = bottom << 1 | right])) return parent[i] = leaf, tree;\n }\n\n // Is the new point is exactly coincident with the existing point?\n xp = +tree._x.call(null, node.data);\n yp = +tree._y.call(null, node.data);\n if (x === xp && y === yp) return leaf.next = node, parent ? parent[i] = leaf : tree._root = leaf, tree;\n\n // Otherwise, split the leaf node until the old and new point are separated.\n do {\n parent = parent ? parent[i] = new Array(4) : tree._root = new Array(4);\n if (right = x >= (xm = (x0 + x1) / 2)) x0 = xm; else x1 = xm;\n if (bottom = y >= (ym = (y0 + y1) / 2)) y0 = ym; else y1 = ym;\n } while ((i = bottom << 1 | right) === (j = (yp >= ym) << 1 | (xp >= xm)));\n return parent[j] = node, parent[i] = leaf, tree;\n}\n\nfunction addAll(data) {\n var d, i, n = data.length,\n x,\n y,\n xz = new Array(n),\n yz = new Array(n),\n x0 = Infinity,\n y0 = Infinity,\n x1 = -Infinity,\n y1 = -Infinity;\n\n // Compute the points and their extent.\n for (i = 0; i < n; ++i) {\n if (isNaN(x = +this._x.call(null, d = data[i])) || isNaN(y = +this._y.call(null, d))) continue;\n xz[i] = x;\n yz[i] = y;\n if (x < x0) x0 = x;\n if (x > x1) x1 = x;\n if (y < y0) y0 = y;\n if (y > y1) y1 = y;\n }\n\n // If there were no (valid) points, inherit the existing extent.\n if (x1 < x0) x0 = this._x0, x1 = this._x1;\n if (y1 < y0) y0 = this._y0, y1 = this._y1;\n\n // Expand the tree to cover the new points.\n this.cover(x0, y0).cover(x1, y1);\n\n // Add the new points.\n for (i = 0; i < n; ++i) {\n add(this, xz[i], yz[i], data[i]);\n }\n\n return this;\n}\n\nvar tree_cover = function(x, y) {\n if (isNaN(x = +x) || isNaN(y = +y)) return this; // ignore invalid points\n\n var x0 = this._x0,\n y0 = this._y0,\n x1 = this._x1,\n y1 = this._y1;\n\n // If the quadtree has no extent, initialize them.\n // Integer extent are necessary so that if we later double the extent,\n // the existing quadrant boundaries don’t change due to floating point error!\n if (isNaN(x0)) {\n x1 = (x0 = Math.floor(x)) + 1;\n y1 = (y0 = Math.floor(y)) + 1;\n }\n\n // Otherwise, double repeatedly to cover.\n else if (x0 > x || x > x1 || y0 > y || y > y1) {\n var z = x1 - x0,\n node = this._root,\n parent,\n i;\n\n switch (i = (y < (y0 + y1) / 2) << 1 | (x < (x0 + x1) / 2)) {\n case 0: {\n do parent = new Array(4), parent[i] = node, node = parent;\n while (z *= 2, x1 = x0 + z, y1 = y0 + z, x > x1 || y > y1);\n break;\n }\n case 1: {\n do parent = new Array(4), parent[i] = node, node = parent;\n while (z *= 2, x0 = x1 - z, y1 = y0 + z, x0 > x || y > y1);\n break;\n }\n case 2: {\n do parent = new Array(4), parent[i] = node, node = parent;\n while (z *= 2, x1 = x0 + z, y0 = y1 - z, x > x1 || y0 > y);\n break;\n }\n case 3: {\n do parent = new Array(4), parent[i] = node, node = parent;\n while (z *= 2, x0 = x1 - z, y0 = y1 - z, x0 > x || y0 > y);\n break;\n }\n }\n\n if (this._root && this._root.length) this._root = node;\n }\n\n // If the quadtree covers the point already, just return.\n else return this;\n\n this._x0 = x0;\n this._y0 = y0;\n this._x1 = x1;\n this._y1 = y1;\n return this;\n};\n\nvar tree_data = function() {\n var data = [];\n this.visit(function(node) {\n if (!node.length) do data.push(node.data); while (node = node.next)\n });\n return data;\n};\n\nvar tree_extent = function(_) {\n return arguments.length\n ? this.cover(+_[0][0], +_[0][1]).cover(+_[1][0], +_[1][1])\n : isNaN(this._x0) ? undefined : [[this._x0, this._y0], [this._x1, this._y1]];\n};\n\nvar Quad = function(node, x0, y0, x1, y1) {\n this.node = node;\n this.x0 = x0;\n this.y0 = y0;\n this.x1 = x1;\n this.y1 = y1;\n};\n\nvar tree_find = function(x, y, radius) {\n var data,\n x0 = this._x0,\n y0 = this._y0,\n x1,\n y1,\n x2,\n y2,\n x3 = this._x1,\n y3 = this._y1,\n quads = [],\n node = this._root,\n q,\n i;\n\n if (node) quads.push(new Quad(node, x0, y0, x3, y3));\n if (radius == null) radius = Infinity;\n else {\n x0 = x - radius, y0 = y - radius;\n x3 = x + radius, y3 = y + radius;\n radius *= radius;\n }\n\n while (q = quads.pop()) {\n\n // Stop searching if this quadrant can’t contain a closer node.\n if (!(node = q.node)\n || (x1 = q.x0) > x3\n || (y1 = q.y0) > y3\n || (x2 = q.x1) < x0\n || (y2 = q.y1) < y0) continue;\n\n // Bisect the current quadrant.\n if (node.length) {\n var xm = (x1 + x2) / 2,\n ym = (y1 + y2) / 2;\n\n quads.push(\n new Quad(node[3], xm, ym, x2, y2),\n new Quad(node[2], x1, ym, xm, y2),\n new Quad(node[1], xm, y1, x2, ym),\n new Quad(node[0], x1, y1, xm, ym)\n );\n\n // Visit the closest quadrant first.\n if (i = (y >= ym) << 1 | (x >= xm)) {\n q = quads[quads.length - 1];\n quads[quads.length - 1] = quads[quads.length - 1 - i];\n quads[quads.length - 1 - i] = q;\n }\n }\n\n // Visit this point. (Visiting coincident points isn’t necessary!)\n else {\n var dx = x - +this._x.call(null, node.data),\n dy = y - +this._y.call(null, node.data),\n d2 = dx * dx + dy * dy;\n if (d2 < radius) {\n var d = Math.sqrt(radius = d2);\n x0 = x - d, y0 = y - d;\n x3 = x + d, y3 = y + d;\n data = node.data;\n }\n }\n }\n\n return data;\n};\n\nvar tree_remove = function(d) {\n if (isNaN(x = +this._x.call(null, d)) || isNaN(y = +this._y.call(null, d))) return this; // ignore invalid points\n\n var parent,\n node = this._root,\n retainer,\n previous,\n next,\n x0 = this._x0,\n y0 = this._y0,\n x1 = this._x1,\n y1 = this._y1,\n x,\n y,\n xm,\n ym,\n right,\n bottom,\n i,\n j;\n\n // If the tree is empty, initialize the root as a leaf.\n if (!node) return this;\n\n // Find the leaf node for the point.\n // While descending, also retain the deepest parent with a non-removed sibling.\n if (node.length) while (true) {\n if (right = x >= (xm = (x0 + x1) / 2)) x0 = xm; else x1 = xm;\n if (bottom = y >= (ym = (y0 + y1) / 2)) y0 = ym; else y1 = ym;\n if (!(parent = node, node = node[i = bottom << 1 | right])) return this;\n if (!node.length) break;\n if (parent[(i + 1) & 3] || parent[(i + 2) & 3] || parent[(i + 3) & 3]) retainer = parent, j = i;\n }\n\n // Find the point to remove.\n while (node.data !== d) if (!(previous = node, node = node.next)) return this;\n if (next = node.next) delete node.next;\n\n // If there are multiple coincident points, remove just the point.\n if (previous) return (next ? previous.next = next : delete previous.next), this;\n\n // If this is the root point, remove it.\n if (!parent) return this._root = next, this;\n\n // Remove this leaf.\n next ? parent[i] = next : delete parent[i];\n\n // If the parent now contains exactly one leaf, collapse superfluous parents.\n if ((node = parent[0] || parent[1] || parent[2] || parent[3])\n && node === (parent[3] || parent[2] || parent[1] || parent[0])\n && !node.length) {\n if (retainer) retainer[j] = node;\n else this._root = node;\n }\n\n return this;\n};\n\nfunction removeAll(data) {\n for (var i = 0, n = data.length; i < n; ++i) this.remove(data[i]);\n return this;\n}\n\nvar tree_root = function() {\n return this._root;\n};\n\nvar tree_size = function() {\n var size = 0;\n this.visit(function(node) {\n if (!node.length) do ++size; while (node = node.next)\n });\n return size;\n};\n\nvar tree_visit = function(callback) {\n var quads = [], q, node = this._root, child, x0, y0, x1, y1;\n if (node) quads.push(new Quad(node, this._x0, this._y0, this._x1, this._y1));\n while (q = quads.pop()) {\n if (!callback(node = q.node, x0 = q.x0, y0 = q.y0, x1 = q.x1, y1 = q.y1) && node.length) {\n var xm = (x0 + x1) / 2, ym = (y0 + y1) / 2;\n if (child = node[3]) quads.push(new Quad(child, xm, ym, x1, y1));\n if (child = node[2]) quads.push(new Quad(child, x0, ym, xm, y1));\n if (child = node[1]) quads.push(new Quad(child, xm, y0, x1, ym));\n if (child = node[0]) quads.push(new Quad(child, x0, y0, xm, ym));\n }\n }\n return this;\n};\n\nvar tree_visitAfter = function(callback) {\n var quads = [], next = [], q;\n if (this._root) quads.push(new Quad(this._root, this._x0, this._y0, this._x1, this._y1));\n while (q = quads.pop()) {\n var node = q.node;\n if (node.length) {\n var child, x0 = q.x0, y0 = q.y0, x1 = q.x1, y1 = q.y1, xm = (x0 + x1) / 2, ym = (y0 + y1) / 2;\n if (child = node[0]) quads.push(new Quad(child, x0, y0, xm, ym));\n if (child = node[1]) quads.push(new Quad(child, xm, y0, x1, ym));\n if (child = node[2]) quads.push(new Quad(child, x0, ym, xm, y1));\n if (child = node[3]) quads.push(new Quad(child, xm, ym, x1, y1));\n }\n next.push(q);\n }\n while (q = next.pop()) {\n callback(q.node, q.x0, q.y0, q.x1, q.y1);\n }\n return this;\n};\n\nfunction defaultX(d) {\n return d[0];\n}\n\nvar tree_x = function(_) {\n return arguments.length ? (this._x = _, this) : this._x;\n};\n\nfunction defaultY(d) {\n return d[1];\n}\n\nvar tree_y = function(_) {\n return arguments.length ? (this._y = _, this) : this._y;\n};\n\nfunction quadtree(nodes, x, y) {\n var tree = new Quadtree(x == null ? defaultX : x, y == null ? defaultY : y, NaN, NaN, NaN, NaN);\n return nodes == null ? tree : tree.addAll(nodes);\n}\n\nfunction Quadtree(x, y, x0, y0, x1, y1) {\n this._x = x;\n this._y = y;\n this._x0 = x0;\n this._y0 = y0;\n this._x1 = x1;\n this._y1 = y1;\n this._root = undefined;\n}\n\nfunction leaf_copy(leaf) {\n var copy = {data: leaf.data}, next = copy;\n while (leaf = leaf.next) next = next.next = {data: leaf.data};\n return copy;\n}\n\nvar treeProto = quadtree.prototype = Quadtree.prototype;\n\ntreeProto.copy = function() {\n var copy = new Quadtree(this._x, this._y, this._x0, this._y0, this._x1, this._y1),\n node = this._root,\n nodes,\n child;\n\n if (!node) return copy;\n\n if (!node.length) return copy._root = leaf_copy(node), copy;\n\n nodes = [{source: node, target: copy._root = new Array(4)}];\n while (node = nodes.pop()) {\n for (var i = 0; i < 4; ++i) {\n if (child = node.source[i]) {\n if (child.length) nodes.push({source: child, target: node.target[i] = new Array(4)});\n else node.target[i] = leaf_copy(child);\n }\n }\n }\n\n return copy;\n};\n\ntreeProto.add = tree_add;\ntreeProto.addAll = addAll;\ntreeProto.cover = tree_cover;\ntreeProto.data = tree_data;\ntreeProto.extent = tree_extent;\ntreeProto.find = tree_find;\ntreeProto.remove = tree_remove;\ntreeProto.removeAll = removeAll;\ntreeProto.root = tree_root;\ntreeProto.size = tree_size;\ntreeProto.visit = tree_visit;\ntreeProto.visitAfter = tree_visitAfter;\ntreeProto.x = tree_x;\ntreeProto.y = tree_y;\n\nfunction x(d) {\n return d.x + d.vx;\n}\n\nfunction y(d) {\n return d.y + d.vy;\n}\n\nvar collide = function(radius) {\n var nodes,\n radii,\n strength = 1,\n iterations = 1;\n\n if (typeof radius !== \"function\") radius = constant$6(radius == null ? 1 : +radius);\n\n function force() {\n var i, n = nodes.length,\n tree,\n node,\n xi,\n yi,\n ri,\n ri2;\n\n for (var k = 0; k < iterations; ++k) {\n tree = quadtree(nodes, x, y).visitAfter(prepare);\n for (i = 0; i < n; ++i) {\n node = nodes[i];\n ri = radii[node.index], ri2 = ri * ri;\n xi = node.x + node.vx;\n yi = node.y + node.vy;\n tree.visit(apply);\n }\n }\n\n function apply(quad, x0, y0, x1, y1) {\n var data = quad.data, rj = quad.r, r = ri + rj;\n if (data) {\n if (data.index > node.index) {\n var x = xi - data.x - data.vx,\n y = yi - data.y - data.vy,\n l = x * x + y * y;\n if (l < r * r) {\n if (x === 0) x = jiggle(), l += x * x;\n if (y === 0) y = jiggle(), l += y * y;\n l = (r - (l = Math.sqrt(l))) / l * strength;\n node.vx += (x *= l) * (r = (rj *= rj) / (ri2 + rj));\n node.vy += (y *= l) * r;\n data.vx -= x * (r = 1 - r);\n data.vy -= y * r;\n }\n }\n return;\n }\n return x0 > xi + r || x1 < xi - r || y0 > yi + r || y1 < yi - r;\n }\n }\n\n function prepare(quad) {\n if (quad.data) return quad.r = radii[quad.data.index];\n for (var i = quad.r = 0; i < 4; ++i) {\n if (quad[i] && quad[i].r > quad.r) {\n quad.r = quad[i].r;\n }\n }\n }\n\n function initialize() {\n if (!nodes) return;\n var i, n = nodes.length, node;\n radii = new Array(n);\n for (i = 0; i < n; ++i) node = nodes[i], radii[node.index] = +radius(node, i, nodes);\n }\n\n force.initialize = function(_) {\n nodes = _;\n initialize();\n };\n\n force.iterations = function(_) {\n return arguments.length ? (iterations = +_, force) : iterations;\n };\n\n force.strength = function(_) {\n return arguments.length ? (strength = +_, force) : strength;\n };\n\n force.radius = function(_) {\n return arguments.length ? (radius = typeof _ === \"function\" ? _ : constant$6(+_), initialize(), force) : radius;\n };\n\n return force;\n};\n\nfunction index(d) {\n return d.index;\n}\n\nfunction find(nodeById, nodeId) {\n var node = nodeById.get(nodeId);\n if (!node) throw new Error(\"missing: \" + nodeId);\n return node;\n}\n\nvar link = function(links) {\n var id = index,\n strength = defaultStrength,\n strengths,\n distance = constant$6(30),\n distances,\n nodes,\n count,\n bias,\n iterations = 1;\n\n if (links == null) links = [];\n\n function defaultStrength(link) {\n return 1 / Math.min(count[link.source.index], count[link.target.index]);\n }\n\n function force(alpha) {\n for (var k = 0, n = links.length; k < iterations; ++k) {\n for (var i = 0, link, source, target, x, y, l, b; i < n; ++i) {\n link = links[i], source = link.source, target = link.target;\n x = target.x + target.vx - source.x - source.vx || jiggle();\n y = target.y + target.vy - source.y - source.vy || jiggle();\n l = Math.sqrt(x * x + y * y);\n l = (l - distances[i]) / l * alpha * strengths[i];\n x *= l, y *= l;\n target.vx -= x * (b = bias[i]);\n target.vy -= y * b;\n source.vx += x * (b = 1 - b);\n source.vy += y * b;\n }\n }\n }\n\n function initialize() {\n if (!nodes) return;\n\n var i,\n n = nodes.length,\n m = links.length,\n nodeById = map$1(nodes, id),\n link;\n\n for (i = 0, count = new Array(n); i < m; ++i) {\n link = links[i], link.index = i;\n if (typeof link.source !== \"object\") link.source = find(nodeById, link.source);\n if (typeof link.target !== \"object\") link.target = find(nodeById, link.target);\n count[link.source.index] = (count[link.source.index] || 0) + 1;\n count[link.target.index] = (count[link.target.index] || 0) + 1;\n }\n\n for (i = 0, bias = new Array(m); i < m; ++i) {\n link = links[i], bias[i] = count[link.source.index] / (count[link.source.index] + count[link.target.index]);\n }\n\n strengths = new Array(m), initializeStrength();\n distances = new Array(m), initializeDistance();\n }\n\n function initializeStrength() {\n if (!nodes) return;\n\n for (var i = 0, n = links.length; i < n; ++i) {\n strengths[i] = +strength(links[i], i, links);\n }\n }\n\n function initializeDistance() {\n if (!nodes) return;\n\n for (var i = 0, n = links.length; i < n; ++i) {\n distances[i] = +distance(links[i], i, links);\n }\n }\n\n force.initialize = function(_) {\n nodes = _;\n initialize();\n };\n\n force.links = function(_) {\n return arguments.length ? (links = _, initialize(), force) : links;\n };\n\n force.id = function(_) {\n return arguments.length ? (id = _, force) : id;\n };\n\n force.iterations = function(_) {\n return arguments.length ? (iterations = +_, force) : iterations;\n };\n\n force.strength = function(_) {\n return arguments.length ? (strength = typeof _ === \"function\" ? _ : constant$6(+_), initializeStrength(), force) : strength;\n };\n\n force.distance = function(_) {\n return arguments.length ? (distance = typeof _ === \"function\" ? _ : constant$6(+_), initializeDistance(), force) : distance;\n };\n\n return force;\n};\n\nfunction x$1(d) {\n return d.x;\n}\n\nfunction y$1(d) {\n return d.y;\n}\n\nvar initialRadius = 10;\nvar initialAngle = Math.PI * (3 - Math.sqrt(5));\n\nvar simulation = function(nodes) {\n var simulation,\n alpha = 1,\n alphaMin = 0.001,\n alphaDecay = 1 - Math.pow(alphaMin, 1 / 300),\n alphaTarget = 0,\n velocityDecay = 0.6,\n forces = map$1(),\n stepper = timer(step),\n event = dispatch(\"tick\", \"end\");\n\n if (nodes == null) nodes = [];\n\n function step() {\n tick();\n event.call(\"tick\", simulation);\n if (alpha < alphaMin) {\n stepper.stop();\n event.call(\"end\", simulation);\n }\n }\n\n function tick() {\n var i, n = nodes.length, node;\n\n alpha += (alphaTarget - alpha) * alphaDecay;\n\n forces.each(function(force) {\n force(alpha);\n });\n\n for (i = 0; i < n; ++i) {\n node = nodes[i];\n if (node.fx == null) node.x += node.vx *= velocityDecay;\n else node.x = node.fx, node.vx = 0;\n if (node.fy == null) node.y += node.vy *= velocityDecay;\n else node.y = node.fy, node.vy = 0;\n }\n }\n\n function initializeNodes() {\n for (var i = 0, n = nodes.length, node; i < n; ++i) {\n node = nodes[i], node.index = i;\n if (isNaN(node.x) || isNaN(node.y)) {\n var radius = initialRadius * Math.sqrt(i), angle = i * initialAngle;\n node.x = radius * Math.cos(angle);\n node.y = radius * Math.sin(angle);\n }\n if (isNaN(node.vx) || isNaN(node.vy)) {\n node.vx = node.vy = 0;\n }\n }\n }\n\n function initializeForce(force) {\n if (force.initialize) force.initialize(nodes);\n return force;\n }\n\n initializeNodes();\n\n return simulation = {\n tick: tick,\n\n restart: function() {\n return stepper.restart(step), simulation;\n },\n\n stop: function() {\n return stepper.stop(), simulation;\n },\n\n nodes: function(_) {\n return arguments.length ? (nodes = _, initializeNodes(), forces.each(initializeForce), simulation) : nodes;\n },\n\n alpha: function(_) {\n return arguments.length ? (alpha = +_, simulation) : alpha;\n },\n\n alphaMin: function(_) {\n return arguments.length ? (alphaMin = +_, simulation) : alphaMin;\n },\n\n alphaDecay: function(_) {\n return arguments.length ? (alphaDecay = +_, simulation) : +alphaDecay;\n },\n\n alphaTarget: function(_) {\n return arguments.length ? (alphaTarget = +_, simulation) : alphaTarget;\n },\n\n velocityDecay: function(_) {\n return arguments.length ? (velocityDecay = 1 - _, simulation) : 1 - velocityDecay;\n },\n\n force: function(name, _) {\n return arguments.length > 1 ? ((_ == null ? forces.remove(name) : forces.set(name, initializeForce(_))), simulation) : forces.get(name);\n },\n\n find: function(x, y, radius) {\n var i = 0,\n n = nodes.length,\n dx,\n dy,\n d2,\n node,\n closest;\n\n if (radius == null) radius = Infinity;\n else radius *= radius;\n\n for (i = 0; i < n; ++i) {\n node = nodes[i];\n dx = x - node.x;\n dy = y - node.y;\n d2 = dx * dx + dy * dy;\n if (d2 < radius) closest = node, radius = d2;\n }\n\n return closest;\n },\n\n on: function(name, _) {\n return arguments.length > 1 ? (event.on(name, _), simulation) : event.on(name);\n }\n };\n};\n\nvar manyBody = function() {\n var nodes,\n node,\n alpha,\n strength = constant$6(-30),\n strengths,\n distanceMin2 = 1,\n distanceMax2 = Infinity,\n theta2 = 0.81;\n\n function force(_) {\n var i, n = nodes.length, tree = quadtree(nodes, x$1, y$1).visitAfter(accumulate);\n for (alpha = _, i = 0; i < n; ++i) node = nodes[i], tree.visit(apply);\n }\n\n function initialize() {\n if (!nodes) return;\n var i, n = nodes.length, node;\n strengths = new Array(n);\n for (i = 0; i < n; ++i) node = nodes[i], strengths[node.index] = +strength(node, i, nodes);\n }\n\n function accumulate(quad) {\n var strength = 0, q, c, weight = 0, x, y, i;\n\n // For internal nodes, accumulate forces from child quadrants.\n if (quad.length) {\n for (x = y = i = 0; i < 4; ++i) {\n if ((q = quad[i]) && (c = Math.abs(q.value))) {\n strength += q.value, weight += c, x += c * q.x, y += c * q.y;\n }\n }\n quad.x = x / weight;\n quad.y = y / weight;\n }\n\n // For leaf nodes, accumulate forces from coincident quadrants.\n else {\n q = quad;\n q.x = q.data.x;\n q.y = q.data.y;\n do strength += strengths[q.data.index];\n while (q = q.next);\n }\n\n quad.value = strength;\n }\n\n function apply(quad, x1, _, x2) {\n if (!quad.value) return true;\n\n var x = quad.x - node.x,\n y = quad.y - node.y,\n w = x2 - x1,\n l = x * x + y * y;\n\n // Apply the Barnes-Hut approximation if possible.\n // Limit forces for very close nodes; randomize direction if coincident.\n if (w * w / theta2 < l) {\n if (l < distanceMax2) {\n if (x === 0) x = jiggle(), l += x * x;\n if (y === 0) y = jiggle(), l += y * y;\n if (l < distanceMin2) l = Math.sqrt(distanceMin2 * l);\n node.vx += x * quad.value * alpha / l;\n node.vy += y * quad.value * alpha / l;\n }\n return true;\n }\n\n // Otherwise, process points directly.\n else if (quad.length || l >= distanceMax2) return;\n\n // Limit forces for very close nodes; randomize direction if coincident.\n if (quad.data !== node || quad.next) {\n if (x === 0) x = jiggle(), l += x * x;\n if (y === 0) y = jiggle(), l += y * y;\n if (l < distanceMin2) l = Math.sqrt(distanceMin2 * l);\n }\n\n do if (quad.data !== node) {\n w = strengths[quad.data.index] * alpha / l;\n node.vx += x * w;\n node.vy += y * w;\n } while (quad = quad.next);\n }\n\n force.initialize = function(_) {\n nodes = _;\n initialize();\n };\n\n force.strength = function(_) {\n return arguments.length ? (strength = typeof _ === \"function\" ? _ : constant$6(+_), initialize(), force) : strength;\n };\n\n force.distanceMin = function(_) {\n return arguments.length ? (distanceMin2 = _ * _, force) : Math.sqrt(distanceMin2);\n };\n\n force.distanceMax = function(_) {\n return arguments.length ? (distanceMax2 = _ * _, force) : Math.sqrt(distanceMax2);\n };\n\n force.theta = function(_) {\n return arguments.length ? (theta2 = _ * _, force) : Math.sqrt(theta2);\n };\n\n return force;\n};\n\nvar radial = function(radius, x, y) {\n var nodes,\n strength = constant$6(0.1),\n strengths,\n radiuses;\n\n if (typeof radius !== \"function\") radius = constant$6(+radius);\n if (x == null) x = 0;\n if (y == null) y = 0;\n\n function force(alpha) {\n for (var i = 0, n = nodes.length; i < n; ++i) {\n var node = nodes[i],\n dx = node.x - x || 1e-6,\n dy = node.y - y || 1e-6,\n r = Math.sqrt(dx * dx + dy * dy),\n k = (radiuses[i] - r) * strengths[i] * alpha / r;\n node.vx += dx * k;\n node.vy += dy * k;\n }\n }\n\n function initialize() {\n if (!nodes) return;\n var i, n = nodes.length;\n strengths = new Array(n);\n radiuses = new Array(n);\n for (i = 0; i < n; ++i) {\n radiuses[i] = +radius(nodes[i], i, nodes);\n strengths[i] = isNaN(radiuses[i]) ? 0 : +strength(nodes[i], i, nodes);\n }\n }\n\n force.initialize = function(_) {\n nodes = _, initialize();\n };\n\n force.strength = function(_) {\n return arguments.length ? (strength = typeof _ === \"function\" ? _ : constant$6(+_), initialize(), force) : strength;\n };\n\n force.radius = function(_) {\n return arguments.length ? (radius = typeof _ === \"function\" ? _ : constant$6(+_), initialize(), force) : radius;\n };\n\n force.x = function(_) {\n return arguments.length ? (x = +_, force) : x;\n };\n\n force.y = function(_) {\n return arguments.length ? (y = +_, force) : y;\n };\n\n return force;\n};\n\nvar x$2 = function(x) {\n var strength = constant$6(0.1),\n nodes,\n strengths,\n xz;\n\n if (typeof x !== \"function\") x = constant$6(x == null ? 0 : +x);\n\n function force(alpha) {\n for (var i = 0, n = nodes.length, node; i < n; ++i) {\n node = nodes[i], node.vx += (xz[i] - node.x) * strengths[i] * alpha;\n }\n }\n\n function initialize() {\n if (!nodes) return;\n var i, n = nodes.length;\n strengths = new Array(n);\n xz = new Array(n);\n for (i = 0; i < n; ++i) {\n strengths[i] = isNaN(xz[i] = +x(nodes[i], i, nodes)) ? 0 : +strength(nodes[i], i, nodes);\n }\n }\n\n force.initialize = function(_) {\n nodes = _;\n initialize();\n };\n\n force.strength = function(_) {\n return arguments.length ? (strength = typeof _ === \"function\" ? _ : constant$6(+_), initialize(), force) : strength;\n };\n\n force.x = function(_) {\n return arguments.length ? (x = typeof _ === \"function\" ? _ : constant$6(+_), initialize(), force) : x;\n };\n\n return force;\n};\n\nvar y$2 = function(y) {\n var strength = constant$6(0.1),\n nodes,\n strengths,\n yz;\n\n if (typeof y !== \"function\") y = constant$6(y == null ? 0 : +y);\n\n function force(alpha) {\n for (var i = 0, n = nodes.length, node; i < n; ++i) {\n node = nodes[i], node.vy += (yz[i] - node.y) * strengths[i] * alpha;\n }\n }\n\n function initialize() {\n if (!nodes) return;\n var i, n = nodes.length;\n strengths = new Array(n);\n yz = new Array(n);\n for (i = 0; i < n; ++i) {\n strengths[i] = isNaN(yz[i] = +y(nodes[i], i, nodes)) ? 0 : +strength(nodes[i], i, nodes);\n }\n }\n\n force.initialize = function(_) {\n nodes = _;\n initialize();\n };\n\n force.strength = function(_) {\n return arguments.length ? (strength = typeof _ === \"function\" ? _ : constant$6(+_), initialize(), force) : strength;\n };\n\n force.y = function(_) {\n return arguments.length ? (y = typeof _ === \"function\" ? _ : constant$6(+_), initialize(), force) : y;\n };\n\n return force;\n};\n\n// Computes the decimal coefficient and exponent of the specified number x with\n// significant digits p, where x is positive and p is in [1, 21] or undefined.\n// For example, formatDecimal(1.23) returns [\"123\", 0].\nvar formatDecimal = function(x, p) {\n if ((i = (x = p ? x.toExponential(p - 1) : x.toExponential()).indexOf(\"e\")) < 0) return null; // NaN, ±Infinity\n var i, coefficient = x.slice(0, i);\n\n // The string returned by toExponential either has the form \\d\\.\\d+e[-+]\\d+\n // (e.g., 1.2e+3) or the form \\de[-+]\\d+ (e.g., 1e+3).\n return [\n coefficient.length > 1 ? coefficient[0] + coefficient.slice(2) : coefficient,\n +x.slice(i + 1)\n ];\n};\n\nvar exponent$1 = function(x) {\n return x = formatDecimal(Math.abs(x)), x ? x[1] : NaN;\n};\n\nvar formatGroup = function(grouping, thousands) {\n return function(value, width) {\n var i = value.length,\n t = [],\n j = 0,\n g = grouping[0],\n length = 0;\n\n while (i > 0 && g > 0) {\n if (length + g + 1 > width) g = Math.max(1, width - length);\n t.push(value.substring(i -= g, i + g));\n if ((length += g + 1) > width) break;\n g = grouping[j = (j + 1) % grouping.length];\n }\n\n return t.reverse().join(thousands);\n };\n};\n\nvar formatNumerals = function(numerals) {\n return function(value) {\n return value.replace(/[0-9]/g, function(i) {\n return numerals[+i];\n });\n };\n};\n\nvar formatDefault = function(x, p) {\n x = x.toPrecision(p);\n\n out: for (var n = x.length, i = 1, i0 = -1, i1; i < n; ++i) {\n switch (x[i]) {\n case \".\": i0 = i1 = i; break;\n case \"0\": if (i0 === 0) i0 = i; i1 = i; break;\n case \"e\": break out;\n default: if (i0 > 0) i0 = 0; break;\n }\n }\n\n return i0 > 0 ? x.slice(0, i0) + x.slice(i1 + 1) : x;\n};\n\nvar prefixExponent;\n\nvar formatPrefixAuto = function(x, p) {\n var d = formatDecimal(x, p);\n if (!d) return x + \"\";\n var coefficient = d[0],\n exponent = d[1],\n i = exponent - (prefixExponent = Math.max(-8, Math.min(8, Math.floor(exponent / 3))) * 3) + 1,\n n = coefficient.length;\n return i === n ? coefficient\n : i > n ? coefficient + new Array(i - n + 1).join(\"0\")\n : i > 0 ? coefficient.slice(0, i) + \".\" + coefficient.slice(i)\n : \"0.\" + new Array(1 - i).join(\"0\") + formatDecimal(x, Math.max(0, p + i - 1))[0]; // less than 1y!\n};\n\nvar formatRounded = function(x, p) {\n var d = formatDecimal(x, p);\n if (!d) return x + \"\";\n var coefficient = d[0],\n exponent = d[1];\n return exponent < 0 ? \"0.\" + new Array(-exponent).join(\"0\") + coefficient\n : coefficient.length > exponent + 1 ? coefficient.slice(0, exponent + 1) + \".\" + coefficient.slice(exponent + 1)\n : coefficient + new Array(exponent - coefficient.length + 2).join(\"0\");\n};\n\nvar formatTypes = {\n \"\": formatDefault,\n \"%\": function(x, p) { return (x * 100).toFixed(p); },\n \"b\": function(x) { return Math.round(x).toString(2); },\n \"c\": function(x) { return x + \"\"; },\n \"d\": function(x) { return Math.round(x).toString(10); },\n \"e\": function(x, p) { return x.toExponential(p); },\n \"f\": function(x, p) { return x.toFixed(p); },\n \"g\": function(x, p) { return x.toPrecision(p); },\n \"o\": function(x) { return Math.round(x).toString(8); },\n \"p\": function(x, p) { return formatRounded(x * 100, p); },\n \"r\": formatRounded,\n \"s\": formatPrefixAuto,\n \"X\": function(x) { return Math.round(x).toString(16).toUpperCase(); },\n \"x\": function(x) { return Math.round(x).toString(16); }\n};\n\n// [[fill]align][sign][symbol][0][width][,][.precision][type]\nvar re = /^(?:(.)?([<>=^]))?([+\\-\\( ])?([$#])?(0)?(\\d+)?(,)?(\\.\\d+)?([a-z%])?$/i;\n\nfunction formatSpecifier(specifier) {\n return new FormatSpecifier(specifier);\n}\n\nformatSpecifier.prototype = FormatSpecifier.prototype; // instanceof\n\nfunction FormatSpecifier(specifier) {\n if (!(match = re.exec(specifier))) throw new Error(\"invalid format: \" + specifier);\n\n var match,\n fill = match[1] || \" \",\n align = match[2] || \">\",\n sign = match[3] || \"-\",\n symbol = match[4] || \"\",\n zero = !!match[5],\n width = match[6] && +match[6],\n comma = !!match[7],\n precision = match[8] && +match[8].slice(1),\n type = match[9] || \"\";\n\n // The \"n\" type is an alias for \",g\".\n if (type === \"n\") comma = true, type = \"g\";\n\n // Map invalid types to the default format.\n else if (!formatTypes[type]) type = \"\";\n\n // If zero fill is specified, padding goes after sign and before digits.\n if (zero || (fill === \"0\" && align === \"=\")) zero = true, fill = \"0\", align = \"=\";\n\n this.fill = fill;\n this.align = align;\n this.sign = sign;\n this.symbol = symbol;\n this.zero = zero;\n this.width = width;\n this.comma = comma;\n this.precision = precision;\n this.type = type;\n}\n\nFormatSpecifier.prototype.toString = function() {\n return this.fill\n + this.align\n + this.sign\n + this.symbol\n + (this.zero ? \"0\" : \"\")\n + (this.width == null ? \"\" : Math.max(1, this.width | 0))\n + (this.comma ? \",\" : \"\")\n + (this.precision == null ? \"\" : \".\" + Math.max(0, this.precision | 0))\n + this.type;\n};\n\nvar identity$3 = function(x) {\n return x;\n};\n\nvar prefixes = [\"y\",\"z\",\"a\",\"f\",\"p\",\"n\",\"\\xB5\",\"m\",\"\",\"k\",\"M\",\"G\",\"T\",\"P\",\"E\",\"Z\",\"Y\"];\n\nvar formatLocale = function(locale) {\n var group = locale.grouping && locale.thousands ? formatGroup(locale.grouping, locale.thousands) : identity$3,\n currency = locale.currency,\n decimal = locale.decimal,\n numerals = locale.numerals ? formatNumerals(locale.numerals) : identity$3,\n percent = locale.percent || \"%\";\n\n function newFormat(specifier) {\n specifier = formatSpecifier(specifier);\n\n var fill = specifier.fill,\n align = specifier.align,\n sign = specifier.sign,\n symbol = specifier.symbol,\n zero = specifier.zero,\n width = specifier.width,\n comma = specifier.comma,\n precision = specifier.precision,\n type = specifier.type;\n\n // Compute the prefix and suffix.\n // For SI-prefix, the suffix is lazily computed.\n var prefix = symbol === \"$\" ? currency[0] : symbol === \"#\" && /[boxX]/.test(type) ? \"0\" + type.toLowerCase() : \"\",\n suffix = symbol === \"$\" ? currency[1] : /[%p]/.test(type) ? percent : \"\";\n\n // What format function should we use?\n // Is this an integer type?\n // Can this type generate exponential notation?\n var formatType = formatTypes[type],\n maybeSuffix = !type || /[defgprs%]/.test(type);\n\n // Set the default precision if not specified,\n // or clamp the specified precision to the supported range.\n // For significant precision, it must be in [1, 21].\n // For fixed precision, it must be in [0, 20].\n precision = precision == null ? (type ? 6 : 12)\n : /[gprs]/.test(type) ? Math.max(1, Math.min(21, precision))\n : Math.max(0, Math.min(20, precision));\n\n function format(value) {\n var valuePrefix = prefix,\n valueSuffix = suffix,\n i, n, c;\n\n if (type === \"c\") {\n valueSuffix = formatType(value) + valueSuffix;\n value = \"\";\n } else {\n value = +value;\n\n // Perform the initial formatting.\n var valueNegative = value < 0;\n value = formatType(Math.abs(value), precision);\n\n // If a negative value rounds to zero during formatting, treat as positive.\n if (valueNegative && +value === 0) valueNegative = false;\n\n // Compute the prefix and suffix.\n valuePrefix = (valueNegative ? (sign === \"(\" ? sign : \"-\") : sign === \"-\" || sign === \"(\" ? \"\" : sign) + valuePrefix;\n valueSuffix = valueSuffix + (type === \"s\" ? prefixes[8 + prefixExponent / 3] : \"\") + (valueNegative && sign === \"(\" ? \")\" : \"\");\n\n // Break the formatted value into the integer “value” part that can be\n // grouped, and fractional or exponential “suffix” part that is not.\n if (maybeSuffix) {\n i = -1, n = value.length;\n while (++i < n) {\n if (c = value.charCodeAt(i), 48 > c || c > 57) {\n valueSuffix = (c === 46 ? decimal + value.slice(i + 1) : value.slice(i)) + valueSuffix;\n value = value.slice(0, i);\n break;\n }\n }\n }\n }\n\n // If the fill character is not \"0\", grouping is applied before padding.\n if (comma && !zero) value = group(value, Infinity);\n\n // Compute the padding.\n var length = valuePrefix.length + value.length + valueSuffix.length,\n padding = length < width ? new Array(width - length + 1).join(fill) : \"\";\n\n // If the fill character is \"0\", grouping is applied after padding.\n if (comma && zero) value = group(padding + value, padding.length ? width - valueSuffix.length : Infinity), padding = \"\";\n\n // Reconstruct the final output based on the desired alignment.\n switch (align) {\n case \"<\": value = valuePrefix + value + valueSuffix + padding; break;\n case \"=\": value = valuePrefix + padding + value + valueSuffix; break;\n case \"^\": value = padding.slice(0, length = padding.length >> 1) + valuePrefix + value + valueSuffix + padding.slice(length); break;\n default: value = padding + valuePrefix + value + valueSuffix; break;\n }\n\n return numerals(value);\n }\n\n format.toString = function() {\n return specifier + \"\";\n };\n\n return format;\n }\n\n function formatPrefix(specifier, value) {\n var f = newFormat((specifier = formatSpecifier(specifier), specifier.type = \"f\", specifier)),\n e = Math.max(-8, Math.min(8, Math.floor(exponent$1(value) / 3))) * 3,\n k = Math.pow(10, -e),\n prefix = prefixes[8 + e / 3];\n return function(value) {\n return f(k * value) + prefix;\n };\n }\n\n return {\n format: newFormat,\n formatPrefix: formatPrefix\n };\n};\n\nvar locale;\n\n\n\ndefaultLocale({\n decimal: \".\",\n thousands: \",\",\n grouping: [3],\n currency: [\"$\", \"\"]\n});\n\nfunction defaultLocale(definition) {\n locale = formatLocale(definition);\n exports.format = locale.format;\n exports.formatPrefix = locale.formatPrefix;\n return locale;\n}\n\nvar precisionFixed = function(step) {\n return Math.max(0, -exponent$1(Math.abs(step)));\n};\n\nvar precisionPrefix = function(step, value) {\n return Math.max(0, Math.max(-8, Math.min(8, Math.floor(exponent$1(value) / 3))) * 3 - exponent$1(Math.abs(step)));\n};\n\nvar precisionRound = function(step, max) {\n step = Math.abs(step), max = Math.abs(max) - step;\n return Math.max(0, exponent$1(max) - exponent$1(step)) + 1;\n};\n\n// Adds floating point numbers with twice the normal precision.\n// Reference: J. R. Shewchuk, Adaptive Precision Floating-Point Arithmetic and\n// Fast Robust Geometric Predicates, Discrete & Computational Geometry 18(3)\n// 305–363 (1997).\n// Code adapted from GeographicLib by Charles F. F. Karney,\n// http://geographiclib.sourceforge.net/\n\nvar adder = function() {\n return new Adder;\n};\n\nfunction Adder() {\n this.reset();\n}\n\nAdder.prototype = {\n constructor: Adder,\n reset: function() {\n this.s = // rounded value\n this.t = 0; // exact error\n },\n add: function(y) {\n add$1(temp, y, this.t);\n add$1(this, temp.s, this.s);\n if (this.s) this.t += temp.t;\n else this.s = temp.t;\n },\n valueOf: function() {\n return this.s;\n }\n};\n\nvar temp = new Adder;\n\nfunction add$1(adder, a, b) {\n var x = adder.s = a + b,\n bv = x - a,\n av = x - bv;\n adder.t = (a - av) + (b - bv);\n}\n\nvar epsilon$2 = 1e-6;\nvar epsilon2$1 = 1e-12;\nvar pi$3 = Math.PI;\nvar halfPi$2 = pi$3 / 2;\nvar quarterPi = pi$3 / 4;\nvar tau$3 = pi$3 * 2;\n\nvar degrees$1 = 180 / pi$3;\nvar radians = pi$3 / 180;\n\nvar abs = Math.abs;\nvar atan = Math.atan;\nvar atan2 = Math.atan2;\nvar cos$1 = Math.cos;\nvar ceil = Math.ceil;\nvar exp = Math.exp;\n\nvar log = Math.log;\nvar pow = Math.pow;\nvar sin$1 = Math.sin;\nvar sign = Math.sign || function(x) { return x > 0 ? 1 : x < 0 ? -1 : 0; };\nvar sqrt = Math.sqrt;\nvar tan = Math.tan;\n\nfunction acos(x) {\n return x > 1 ? 0 : x < -1 ? pi$3 : Math.acos(x);\n}\n\nfunction asin(x) {\n return x > 1 ? halfPi$2 : x < -1 ? -halfPi$2 : Math.asin(x);\n}\n\nfunction haversin(x) {\n return (x = sin$1(x / 2)) * x;\n}\n\nfunction noop$1() {}\n\nfunction streamGeometry(geometry, stream) {\n if (geometry && streamGeometryType.hasOwnProperty(geometry.type)) {\n streamGeometryType[geometry.type](geometry, stream);\n }\n}\n\nvar streamObjectType = {\n Feature: function(object, stream) {\n streamGeometry(object.geometry, stream);\n },\n FeatureCollection: function(object, stream) {\n var features = object.features, i = -1, n = features.length;\n while (++i < n) streamGeometry(features[i].geometry, stream);\n }\n};\n\nvar streamGeometryType = {\n Sphere: function(object, stream) {\n stream.sphere();\n },\n Point: function(object, stream) {\n object = object.coordinates;\n stream.point(object[0], object[1], object[2]);\n },\n MultiPoint: function(object, stream) {\n var coordinates = object.coordinates, i = -1, n = coordinates.length;\n while (++i < n) object = coordinates[i], stream.point(object[0], object[1], object[2]);\n },\n LineString: function(object, stream) {\n streamLine(object.coordinates, stream, 0);\n },\n MultiLineString: function(object, stream) {\n var coordinates = object.coordinates, i = -1, n = coordinates.length;\n while (++i < n) streamLine(coordinates[i], stream, 0);\n },\n Polygon: function(object, stream) {\n streamPolygon(object.coordinates, stream);\n },\n MultiPolygon: function(object, stream) {\n var coordinates = object.coordinates, i = -1, n = coordinates.length;\n while (++i < n) streamPolygon(coordinates[i], stream);\n },\n GeometryCollection: function(object, stream) {\n var geometries = object.geometries, i = -1, n = geometries.length;\n while (++i < n) streamGeometry(geometries[i], stream);\n }\n};\n\nfunction streamLine(coordinates, stream, closed) {\n var i = -1, n = coordinates.length - closed, coordinate;\n stream.lineStart();\n while (++i < n) coordinate = coordinates[i], stream.point(coordinate[0], coordinate[1], coordinate[2]);\n stream.lineEnd();\n}\n\nfunction streamPolygon(coordinates, stream) {\n var i = -1, n = coordinates.length;\n stream.polygonStart();\n while (++i < n) streamLine(coordinates[i], stream, 1);\n stream.polygonEnd();\n}\n\nvar geoStream = function(object, stream) {\n if (object && streamObjectType.hasOwnProperty(object.type)) {\n streamObjectType[object.type](object, stream);\n } else {\n streamGeometry(object, stream);\n }\n};\n\nvar areaRingSum = adder();\n\nvar areaSum = adder();\nvar lambda00;\nvar phi00;\nvar lambda0;\nvar cosPhi0;\nvar sinPhi0;\n\nvar areaStream = {\n point: noop$1,\n lineStart: noop$1,\n lineEnd: noop$1,\n polygonStart: function() {\n areaRingSum.reset();\n areaStream.lineStart = areaRingStart;\n areaStream.lineEnd = areaRingEnd;\n },\n polygonEnd: function() {\n var areaRing = +areaRingSum;\n areaSum.add(areaRing < 0 ? tau$3 + areaRing : areaRing);\n this.lineStart = this.lineEnd = this.point = noop$1;\n },\n sphere: function() {\n areaSum.add(tau$3);\n }\n};\n\nfunction areaRingStart() {\n areaStream.point = areaPointFirst;\n}\n\nfunction areaRingEnd() {\n areaPoint(lambda00, phi00);\n}\n\nfunction areaPointFirst(lambda, phi) {\n areaStream.point = areaPoint;\n lambda00 = lambda, phi00 = phi;\n lambda *= radians, phi *= radians;\n lambda0 = lambda, cosPhi0 = cos$1(phi = phi / 2 + quarterPi), sinPhi0 = sin$1(phi);\n}\n\nfunction areaPoint(lambda, phi) {\n lambda *= radians, phi *= radians;\n phi = phi / 2 + quarterPi; // half the angular distance from south pole\n\n // Spherical excess E for a spherical triangle with vertices: south pole,\n // previous point, current point. Uses a formula derived from Cagnoli’s\n // theorem. See Todhunter, Spherical Trig. (1871), Sec. 103, Eq. (2).\n var dLambda = lambda - lambda0,\n sdLambda = dLambda >= 0 ? 1 : -1,\n adLambda = sdLambda * dLambda,\n cosPhi = cos$1(phi),\n sinPhi = sin$1(phi),\n k = sinPhi0 * sinPhi,\n u = cosPhi0 * cosPhi + k * cos$1(adLambda),\n v = k * sdLambda * sin$1(adLambda);\n areaRingSum.add(atan2(v, u));\n\n // Advance the previous points.\n lambda0 = lambda, cosPhi0 = cosPhi, sinPhi0 = sinPhi;\n}\n\nvar area = function(object) {\n areaSum.reset();\n geoStream(object, areaStream);\n return areaSum * 2;\n};\n\nfunction spherical(cartesian) {\n return [atan2(cartesian[1], cartesian[0]), asin(cartesian[2])];\n}\n\nfunction cartesian(spherical) {\n var lambda = spherical[0], phi = spherical[1], cosPhi = cos$1(phi);\n return [cosPhi * cos$1(lambda), cosPhi * sin$1(lambda), sin$1(phi)];\n}\n\nfunction cartesianDot(a, b) {\n return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];\n}\n\nfunction cartesianCross(a, b) {\n return [a[1] * b[2] - a[2] * b[1], a[2] * b[0] - a[0] * b[2], a[0] * b[1] - a[1] * b[0]];\n}\n\n// TODO return a\nfunction cartesianAddInPlace(a, b) {\n a[0] += b[0], a[1] += b[1], a[2] += b[2];\n}\n\nfunction cartesianScale(vector, k) {\n return [vector[0] * k, vector[1] * k, vector[2] * k];\n}\n\n// TODO return d\nfunction cartesianNormalizeInPlace(d) {\n var l = sqrt(d[0] * d[0] + d[1] * d[1] + d[2] * d[2]);\n d[0] /= l, d[1] /= l, d[2] /= l;\n}\n\nvar lambda0$1;\nvar phi0;\nvar lambda1;\nvar phi1;\nvar lambda2;\nvar lambda00$1;\nvar phi00$1;\nvar p0;\nvar deltaSum = adder();\nvar ranges;\nvar range;\n\nvar boundsStream = {\n point: boundsPoint,\n lineStart: boundsLineStart,\n lineEnd: boundsLineEnd,\n polygonStart: function() {\n boundsStream.point = boundsRingPoint;\n boundsStream.lineStart = boundsRingStart;\n boundsStream.lineEnd = boundsRingEnd;\n deltaSum.reset();\n areaStream.polygonStart();\n },\n polygonEnd: function() {\n areaStream.polygonEnd();\n boundsStream.point = boundsPoint;\n boundsStream.lineStart = boundsLineStart;\n boundsStream.lineEnd = boundsLineEnd;\n if (areaRingSum < 0) lambda0$1 = -(lambda1 = 180), phi0 = -(phi1 = 90);\n else if (deltaSum > epsilon$2) phi1 = 90;\n else if (deltaSum < -epsilon$2) phi0 = -90;\n range[0] = lambda0$1, range[1] = lambda1;\n }\n};\n\nfunction boundsPoint(lambda, phi) {\n ranges.push(range = [lambda0$1 = lambda, lambda1 = lambda]);\n if (phi < phi0) phi0 = phi;\n if (phi > phi1) phi1 = phi;\n}\n\nfunction linePoint(lambda, phi) {\n var p = cartesian([lambda * radians, phi * radians]);\n if (p0) {\n var normal = cartesianCross(p0, p),\n equatorial = [normal[1], -normal[0], 0],\n inflection = cartesianCross(equatorial, normal);\n cartesianNormalizeInPlace(inflection);\n inflection = spherical(inflection);\n var delta = lambda - lambda2,\n sign$$1 = delta > 0 ? 1 : -1,\n lambdai = inflection[0] * degrees$1 * sign$$1,\n phii,\n antimeridian = abs(delta) > 180;\n if (antimeridian ^ (sign$$1 * lambda2 < lambdai && lambdai < sign$$1 * lambda)) {\n phii = inflection[1] * degrees$1;\n if (phii > phi1) phi1 = phii;\n } else if (lambdai = (lambdai + 360) % 360 - 180, antimeridian ^ (sign$$1 * lambda2 < lambdai && lambdai < sign$$1 * lambda)) {\n phii = -inflection[1] * degrees$1;\n if (phii < phi0) phi0 = phii;\n } else {\n if (phi < phi0) phi0 = phi;\n if (phi > phi1) phi1 = phi;\n }\n if (antimeridian) {\n if (lambda < lambda2) {\n if (angle(lambda0$1, lambda) > angle(lambda0$1, lambda1)) lambda1 = lambda;\n } else {\n if (angle(lambda, lambda1) > angle(lambda0$1, lambda1)) lambda0$1 = lambda;\n }\n } else {\n if (lambda1 >= lambda0$1) {\n if (lambda < lambda0$1) lambda0$1 = lambda;\n if (lambda > lambda1) lambda1 = lambda;\n } else {\n if (lambda > lambda2) {\n if (angle(lambda0$1, lambda) > angle(lambda0$1, lambda1)) lambda1 = lambda;\n } else {\n if (angle(lambda, lambda1) > angle(lambda0$1, lambda1)) lambda0$1 = lambda;\n }\n }\n }\n } else {\n ranges.push(range = [lambda0$1 = lambda, lambda1 = lambda]);\n }\n if (phi < phi0) phi0 = phi;\n if (phi > phi1) phi1 = phi;\n p0 = p, lambda2 = lambda;\n}\n\nfunction boundsLineStart() {\n boundsStream.point = linePoint;\n}\n\nfunction boundsLineEnd() {\n range[0] = lambda0$1, range[1] = lambda1;\n boundsStream.point = boundsPoint;\n p0 = null;\n}\n\nfunction boundsRingPoint(lambda, phi) {\n if (p0) {\n var delta = lambda - lambda2;\n deltaSum.add(abs(delta) > 180 ? delta + (delta > 0 ? 360 : -360) : delta);\n } else {\n lambda00$1 = lambda, phi00$1 = phi;\n }\n areaStream.point(lambda, phi);\n linePoint(lambda, phi);\n}\n\nfunction boundsRingStart() {\n areaStream.lineStart();\n}\n\nfunction boundsRingEnd() {\n boundsRingPoint(lambda00$1, phi00$1);\n areaStream.lineEnd();\n if (abs(deltaSum) > epsilon$2) lambda0$1 = -(lambda1 = 180);\n range[0] = lambda0$1, range[1] = lambda1;\n p0 = null;\n}\n\n// Finds the left-right distance between two longitudes.\n// This is almost the same as (lambda1 - lambda0 + 360°) % 360°, except that we want\n// the distance between ±180° to be 360°.\nfunction angle(lambda0, lambda1) {\n return (lambda1 -= lambda0) < 0 ? lambda1 + 360 : lambda1;\n}\n\nfunction rangeCompare(a, b) {\n return a[0] - b[0];\n}\n\nfunction rangeContains(range, x) {\n return range[0] <= range[1] ? range[0] <= x && x <= range[1] : x < range[0] || range[1] < x;\n}\n\nvar bounds = function(feature) {\n var i, n, a, b, merged, deltaMax, delta;\n\n phi1 = lambda1 = -(lambda0$1 = phi0 = Infinity);\n ranges = [];\n geoStream(feature, boundsStream);\n\n // First, sort ranges by their minimum longitudes.\n if (n = ranges.length) {\n ranges.sort(rangeCompare);\n\n // Then, merge any ranges that overlap.\n for (i = 1, a = ranges[0], merged = [a]; i < n; ++i) {\n b = ranges[i];\n if (rangeContains(a, b[0]) || rangeContains(a, b[1])) {\n if (angle(a[0], b[1]) > angle(a[0], a[1])) a[1] = b[1];\n if (angle(b[0], a[1]) > angle(a[0], a[1])) a[0] = b[0];\n } else {\n merged.push(a = b);\n }\n }\n\n // Finally, find the largest gap between the merged ranges.\n // The final bounding box will be the inverse of this gap.\n for (deltaMax = -Infinity, n = merged.length - 1, i = 0, a = merged[n]; i <= n; a = b, ++i) {\n b = merged[i];\n if ((delta = angle(a[1], b[0])) > deltaMax) deltaMax = delta, lambda0$1 = b[0], lambda1 = a[1];\n }\n }\n\n ranges = range = null;\n\n return lambda0$1 === Infinity || phi0 === Infinity\n ? [[NaN, NaN], [NaN, NaN]]\n : [[lambda0$1, phi0], [lambda1, phi1]];\n};\n\nvar W0;\nvar W1;\nvar X0;\nvar Y0;\nvar Z0;\nvar X1;\nvar Y1;\nvar Z1;\nvar X2;\nvar Y2;\nvar Z2;\nvar lambda00$2;\nvar phi00$2;\nvar x0;\nvar y0;\nvar z0; // previous point\n\nvar centroidStream = {\n sphere: noop$1,\n point: centroidPoint,\n lineStart: centroidLineStart,\n lineEnd: centroidLineEnd,\n polygonStart: function() {\n centroidStream.lineStart = centroidRingStart;\n centroidStream.lineEnd = centroidRingEnd;\n },\n polygonEnd: function() {\n centroidStream.lineStart = centroidLineStart;\n centroidStream.lineEnd = centroidLineEnd;\n }\n};\n\n// Arithmetic mean of Cartesian vectors.\nfunction centroidPoint(lambda, phi) {\n lambda *= radians, phi *= radians;\n var cosPhi = cos$1(phi);\n centroidPointCartesian(cosPhi * cos$1(lambda), cosPhi * sin$1(lambda), sin$1(phi));\n}\n\nfunction centroidPointCartesian(x, y, z) {\n ++W0;\n X0 += (x - X0) / W0;\n Y0 += (y - Y0) / W0;\n Z0 += (z - Z0) / W0;\n}\n\nfunction centroidLineStart() {\n centroidStream.point = centroidLinePointFirst;\n}\n\nfunction centroidLinePointFirst(lambda, phi) {\n lambda *= radians, phi *= radians;\n var cosPhi = cos$1(phi);\n x0 = cosPhi * cos$1(lambda);\n y0 = cosPhi * sin$1(lambda);\n z0 = sin$1(phi);\n centroidStream.point = centroidLinePoint;\n centroidPointCartesian(x0, y0, z0);\n}\n\nfunction centroidLinePoint(lambda, phi) {\n lambda *= radians, phi *= radians;\n var cosPhi = cos$1(phi),\n x = cosPhi * cos$1(lambda),\n y = cosPhi * sin$1(lambda),\n z = sin$1(phi),\n w = atan2(sqrt((w = y0 * z - z0 * y) * w + (w = z0 * x - x0 * z) * w + (w = x0 * y - y0 * x) * w), x0 * x + y0 * y + z0 * z);\n W1 += w;\n X1 += w * (x0 + (x0 = x));\n Y1 += w * (y0 + (y0 = y));\n Z1 += w * (z0 + (z0 = z));\n centroidPointCartesian(x0, y0, z0);\n}\n\nfunction centroidLineEnd() {\n centroidStream.point = centroidPoint;\n}\n\n// See J. E. Brock, The Inertia Tensor for a Spherical Triangle,\n// J. Applied Mechanics 42, 239 (1975).\nfunction centroidRingStart() {\n centroidStream.point = centroidRingPointFirst;\n}\n\nfunction centroidRingEnd() {\n centroidRingPoint(lambda00$2, phi00$2);\n centroidStream.point = centroidPoint;\n}\n\nfunction centroidRingPointFirst(lambda, phi) {\n lambda00$2 = lambda, phi00$2 = phi;\n lambda *= radians, phi *= radians;\n centroidStream.point = centroidRingPoint;\n var cosPhi = cos$1(phi);\n x0 = cosPhi * cos$1(lambda);\n y0 = cosPhi * sin$1(lambda);\n z0 = sin$1(phi);\n centroidPointCartesian(x0, y0, z0);\n}\n\nfunction centroidRingPoint(lambda, phi) {\n lambda *= radians, phi *= radians;\n var cosPhi = cos$1(phi),\n x = cosPhi * cos$1(lambda),\n y = cosPhi * sin$1(lambda),\n z = sin$1(phi),\n cx = y0 * z - z0 * y,\n cy = z0 * x - x0 * z,\n cz = x0 * y - y0 * x,\n m = sqrt(cx * cx + cy * cy + cz * cz),\n w = asin(m), // line weight = angle\n v = m && -w / m; // area weight multiplier\n X2 += v * cx;\n Y2 += v * cy;\n Z2 += v * cz;\n W1 += w;\n X1 += w * (x0 + (x0 = x));\n Y1 += w * (y0 + (y0 = y));\n Z1 += w * (z0 + (z0 = z));\n centroidPointCartesian(x0, y0, z0);\n}\n\nvar centroid = function(object) {\n W0 = W1 =\n X0 = Y0 = Z0 =\n X1 = Y1 = Z1 =\n X2 = Y2 = Z2 = 0;\n geoStream(object, centroidStream);\n\n var x = X2,\n y = Y2,\n z = Z2,\n m = x * x + y * y + z * z;\n\n // If the area-weighted ccentroid is undefined, fall back to length-weighted ccentroid.\n if (m < epsilon2$1) {\n x = X1, y = Y1, z = Z1;\n // If the feature has zero length, fall back to arithmetic mean of point vectors.\n if (W1 < epsilon$2) x = X0, y = Y0, z = Z0;\n m = x * x + y * y + z * z;\n // If the feature still has an undefined ccentroid, then return.\n if (m < epsilon2$1) return [NaN, NaN];\n }\n\n return [atan2(y, x) * degrees$1, asin(z / sqrt(m)) * degrees$1];\n};\n\nvar constant$7 = function(x) {\n return function() {\n return x;\n };\n};\n\nvar compose = function(a, b) {\n\n function compose(x, y) {\n return x = a(x, y), b(x[0], x[1]);\n }\n\n if (a.invert && b.invert) compose.invert = function(x, y) {\n return x = b.invert(x, y), x && a.invert(x[0], x[1]);\n };\n\n return compose;\n};\n\nfunction rotationIdentity(lambda, phi) {\n return [lambda > pi$3 ? lambda - tau$3 : lambda < -pi$3 ? lambda + tau$3 : lambda, phi];\n}\n\nrotationIdentity.invert = rotationIdentity;\n\nfunction rotateRadians(deltaLambda, deltaPhi, deltaGamma) {\n return (deltaLambda %= tau$3) ? (deltaPhi || deltaGamma ? compose(rotationLambda(deltaLambda), rotationPhiGamma(deltaPhi, deltaGamma))\n : rotationLambda(deltaLambda))\n : (deltaPhi || deltaGamma ? rotationPhiGamma(deltaPhi, deltaGamma)\n : rotationIdentity);\n}\n\nfunction forwardRotationLambda(deltaLambda) {\n return function(lambda, phi) {\n return lambda += deltaLambda, [lambda > pi$3 ? lambda - tau$3 : lambda < -pi$3 ? lambda + tau$3 : lambda, phi];\n };\n}\n\nfunction rotationLambda(deltaLambda) {\n var rotation = forwardRotationLambda(deltaLambda);\n rotation.invert = forwardRotationLambda(-deltaLambda);\n return rotation;\n}\n\nfunction rotationPhiGamma(deltaPhi, deltaGamma) {\n var cosDeltaPhi = cos$1(deltaPhi),\n sinDeltaPhi = sin$1(deltaPhi),\n cosDeltaGamma = cos$1(deltaGamma),\n sinDeltaGamma = sin$1(deltaGamma);\n\n function rotation(lambda, phi) {\n var cosPhi = cos$1(phi),\n x = cos$1(lambda) * cosPhi,\n y = sin$1(lambda) * cosPhi,\n z = sin$1(phi),\n k = z * cosDeltaPhi + x * sinDeltaPhi;\n return [\n atan2(y * cosDeltaGamma - k * sinDeltaGamma, x * cosDeltaPhi - z * sinDeltaPhi),\n asin(k * cosDeltaGamma + y * sinDeltaGamma)\n ];\n }\n\n rotation.invert = function(lambda, phi) {\n var cosPhi = cos$1(phi),\n x = cos$1(lambda) * cosPhi,\n y = sin$1(lambda) * cosPhi,\n z = sin$1(phi),\n k = z * cosDeltaGamma - y * sinDeltaGamma;\n return [\n atan2(y * cosDeltaGamma + z * sinDeltaGamma, x * cosDeltaPhi + k * sinDeltaPhi),\n asin(k * cosDeltaPhi - x * sinDeltaPhi)\n ];\n };\n\n return rotation;\n}\n\nvar rotation = function(rotate) {\n rotate = rotateRadians(rotate[0] * radians, rotate[1] * radians, rotate.length > 2 ? rotate[2] * radians : 0);\n\n function forward(coordinates) {\n coordinates = rotate(coordinates[0] * radians, coordinates[1] * radians);\n return coordinates[0] *= degrees$1, coordinates[1] *= degrees$1, coordinates;\n }\n\n forward.invert = function(coordinates) {\n coordinates = rotate.invert(coordinates[0] * radians, coordinates[1] * radians);\n return coordinates[0] *= degrees$1, coordinates[1] *= degrees$1, coordinates;\n };\n\n return forward;\n};\n\n// Generates a circle centered at [0°, 0°], with a given radius and precision.\nfunction circleStream(stream, radius, delta, direction, t0, t1) {\n if (!delta) return;\n var cosRadius = cos$1(radius),\n sinRadius = sin$1(radius),\n step = direction * delta;\n if (t0 == null) {\n t0 = radius + direction * tau$3;\n t1 = radius - step / 2;\n } else {\n t0 = circleRadius(cosRadius, t0);\n t1 = circleRadius(cosRadius, t1);\n if (direction > 0 ? t0 < t1 : t0 > t1) t0 += direction * tau$3;\n }\n for (var point, t = t0; direction > 0 ? t > t1 : t < t1; t -= step) {\n point = spherical([cosRadius, -sinRadius * cos$1(t), -sinRadius * sin$1(t)]);\n stream.point(point[0], point[1]);\n }\n}\n\n// Returns the signed angle of a cartesian point relative to [cosRadius, 0, 0].\nfunction circleRadius(cosRadius, point) {\n point = cartesian(point), point[0] -= cosRadius;\n cartesianNormalizeInPlace(point);\n var radius = acos(-point[1]);\n return ((-point[2] < 0 ? -radius : radius) + tau$3 - epsilon$2) % tau$3;\n}\n\nvar circle = function() {\n var center = constant$7([0, 0]),\n radius = constant$7(90),\n precision = constant$7(6),\n ring,\n rotate,\n stream = {point: point};\n\n function point(x, y) {\n ring.push(x = rotate(x, y));\n x[0] *= degrees$1, x[1] *= degrees$1;\n }\n\n function circle() {\n var c = center.apply(this, arguments),\n r = radius.apply(this, arguments) * radians,\n p = precision.apply(this, arguments) * radians;\n ring = [];\n rotate = rotateRadians(-c[0] * radians, -c[1] * radians, 0).invert;\n circleStream(stream, r, p, 1);\n c = {type: \"Polygon\", coordinates: [ring]};\n ring = rotate = null;\n return c;\n }\n\n circle.center = function(_) {\n return arguments.length ? (center = typeof _ === \"function\" ? _ : constant$7([+_[0], +_[1]]), circle) : center;\n };\n\n circle.radius = function(_) {\n return arguments.length ? (radius = typeof _ === \"function\" ? _ : constant$7(+_), circle) : radius;\n };\n\n circle.precision = function(_) {\n return arguments.length ? (precision = typeof _ === \"function\" ? _ : constant$7(+_), circle) : precision;\n };\n\n return circle;\n};\n\nvar clipBuffer = function() {\n var lines = [],\n line;\n return {\n point: function(x, y) {\n line.push([x, y]);\n },\n lineStart: function() {\n lines.push(line = []);\n },\n lineEnd: noop$1,\n rejoin: function() {\n if (lines.length > 1) lines.push(lines.pop().concat(lines.shift()));\n },\n result: function() {\n var result = lines;\n lines = [];\n line = null;\n return result;\n }\n };\n};\n\nvar pointEqual = function(a, b) {\n return abs(a[0] - b[0]) < epsilon$2 && abs(a[1] - b[1]) < epsilon$2;\n};\n\nfunction Intersection(point, points, other, entry) {\n this.x = point;\n this.z = points;\n this.o = other; // another intersection\n this.e = entry; // is an entry?\n this.v = false; // visited\n this.n = this.p = null; // next & previous\n}\n\n// A generalized polygon clipping algorithm: given a polygon that has been cut\n// into its visible line segments, and rejoins the segments by interpolating\n// along the clip edge.\nvar clipRejoin = function(segments, compareIntersection, startInside, interpolate, stream) {\n var subject = [],\n clip = [],\n i,\n n;\n\n segments.forEach(function(segment) {\n if ((n = segment.length - 1) <= 0) return;\n var n, p0 = segment[0], p1 = segment[n], x;\n\n // If the first and last points of a segment are coincident, then treat as a\n // closed ring. TODO if all rings are closed, then the winding order of the\n // exterior ring should be checked.\n if (pointEqual(p0, p1)) {\n stream.lineStart();\n for (i = 0; i < n; ++i) stream.point((p0 = segment[i])[0], p0[1]);\n stream.lineEnd();\n return;\n }\n\n subject.push(x = new Intersection(p0, segment, null, true));\n clip.push(x.o = new Intersection(p0, null, x, false));\n subject.push(x = new Intersection(p1, segment, null, false));\n clip.push(x.o = new Intersection(p1, null, x, true));\n });\n\n if (!subject.length) return;\n\n clip.sort(compareIntersection);\n link$1(subject);\n link$1(clip);\n\n for (i = 0, n = clip.length; i < n; ++i) {\n clip[i].e = startInside = !startInside;\n }\n\n var start = subject[0],\n points,\n point;\n\n while (1) {\n // Find first unvisited intersection.\n var current = start,\n isSubject = true;\n while (current.v) if ((current = current.n) === start) return;\n points = current.z;\n stream.lineStart();\n do {\n current.v = current.o.v = true;\n if (current.e) {\n if (isSubject) {\n for (i = 0, n = points.length; i < n; ++i) stream.point((point = points[i])[0], point[1]);\n } else {\n interpolate(current.x, current.n.x, 1, stream);\n }\n current = current.n;\n } else {\n if (isSubject) {\n points = current.p.z;\n for (i = points.length - 1; i >= 0; --i) stream.point((point = points[i])[0], point[1]);\n } else {\n interpolate(current.x, current.p.x, -1, stream);\n }\n current = current.p;\n }\n current = current.o;\n points = current.z;\n isSubject = !isSubject;\n } while (!current.v);\n stream.lineEnd();\n }\n};\n\nfunction link$1(array) {\n if (!(n = array.length)) return;\n var n,\n i = 0,\n a = array[0],\n b;\n while (++i < n) {\n a.n = b = array[i];\n b.p = a;\n a = b;\n }\n a.n = b = array[0];\n b.p = a;\n}\n\nvar sum$1 = adder();\n\nvar polygonContains = function(polygon, point) {\n var lambda = point[0],\n phi = point[1],\n normal = [sin$1(lambda), -cos$1(lambda), 0],\n angle = 0,\n winding = 0;\n\n sum$1.reset();\n\n for (var i = 0, n = polygon.length; i < n; ++i) {\n if (!(m = (ring = polygon[i]).length)) continue;\n var ring,\n m,\n point0 = ring[m - 1],\n lambda0 = point0[0],\n phi0 = point0[1] / 2 + quarterPi,\n sinPhi0 = sin$1(phi0),\n cosPhi0 = cos$1(phi0);\n\n for (var j = 0; j < m; ++j, lambda0 = lambda1, sinPhi0 = sinPhi1, cosPhi0 = cosPhi1, point0 = point1) {\n var point1 = ring[j],\n lambda1 = point1[0],\n phi1 = point1[1] / 2 + quarterPi,\n sinPhi1 = sin$1(phi1),\n cosPhi1 = cos$1(phi1),\n delta = lambda1 - lambda0,\n sign$$1 = delta >= 0 ? 1 : -1,\n absDelta = sign$$1 * delta,\n antimeridian = absDelta > pi$3,\n k = sinPhi0 * sinPhi1;\n\n sum$1.add(atan2(k * sign$$1 * sin$1(absDelta), cosPhi0 * cosPhi1 + k * cos$1(absDelta)));\n angle += antimeridian ? delta + sign$$1 * tau$3 : delta;\n\n // Are the longitudes either side of the point’s meridian (lambda),\n // and are the latitudes smaller than the parallel (phi)?\n if (antimeridian ^ lambda0 >= lambda ^ lambda1 >= lambda) {\n var arc = cartesianCross(cartesian(point0), cartesian(point1));\n cartesianNormalizeInPlace(arc);\n var intersection = cartesianCross(normal, arc);\n cartesianNormalizeInPlace(intersection);\n var phiArc = (antimeridian ^ delta >= 0 ? -1 : 1) * asin(intersection[2]);\n if (phi > phiArc || phi === phiArc && (arc[0] || arc[1])) {\n winding += antimeridian ^ delta >= 0 ? 1 : -1;\n }\n }\n }\n }\n\n // First, determine whether the South pole is inside or outside:\n //\n // It is inside if:\n // * the polygon winds around it in a clockwise direction.\n // * the polygon does not (cumulatively) wind around it, but has a negative\n // (counter-clockwise) area.\n //\n // Second, count the (signed) number of times a segment crosses a lambda\n // from the point to the South pole. If it is zero, then the point is the\n // same side as the South pole.\n\n return (angle < -epsilon$2 || angle < epsilon$2 && sum$1 < -epsilon$2) ^ (winding & 1);\n};\n\nvar clip = function(pointVisible, clipLine, interpolate, start) {\n return function(sink) {\n var line = clipLine(sink),\n ringBuffer = clipBuffer(),\n ringSink = clipLine(ringBuffer),\n polygonStarted = false,\n polygon,\n segments,\n ring;\n\n var clip = {\n point: point,\n lineStart: lineStart,\n lineEnd: lineEnd,\n polygonStart: function() {\n clip.point = pointRing;\n clip.lineStart = ringStart;\n clip.lineEnd = ringEnd;\n segments = [];\n polygon = [];\n },\n polygonEnd: function() {\n clip.point = point;\n clip.lineStart = lineStart;\n clip.lineEnd = lineEnd;\n segments = merge(segments);\n var startInside = polygonContains(polygon, start);\n if (segments.length) {\n if (!polygonStarted) sink.polygonStart(), polygonStarted = true;\n clipRejoin(segments, compareIntersection, startInside, interpolate, sink);\n } else if (startInside) {\n if (!polygonStarted) sink.polygonStart(), polygonStarted = true;\n sink.lineStart();\n interpolate(null, null, 1, sink);\n sink.lineEnd();\n }\n if (polygonStarted) sink.polygonEnd(), polygonStarted = false;\n segments = polygon = null;\n },\n sphere: function() {\n sink.polygonStart();\n sink.lineStart();\n interpolate(null, null, 1, sink);\n sink.lineEnd();\n sink.polygonEnd();\n }\n };\n\n function point(lambda, phi) {\n if (pointVisible(lambda, phi)) sink.point(lambda, phi);\n }\n\n function pointLine(lambda, phi) {\n line.point(lambda, phi);\n }\n\n function lineStart() {\n clip.point = pointLine;\n line.lineStart();\n }\n\n function lineEnd() {\n clip.point = point;\n line.lineEnd();\n }\n\n function pointRing(lambda, phi) {\n ring.push([lambda, phi]);\n ringSink.point(lambda, phi);\n }\n\n function ringStart() {\n ringSink.lineStart();\n ring = [];\n }\n\n function ringEnd() {\n pointRing(ring[0][0], ring[0][1]);\n ringSink.lineEnd();\n\n var clean = ringSink.clean(),\n ringSegments = ringBuffer.result(),\n i, n = ringSegments.length, m,\n segment,\n point;\n\n ring.pop();\n polygon.push(ring);\n ring = null;\n\n if (!n) return;\n\n // No intersections.\n if (clean & 1) {\n segment = ringSegments[0];\n if ((m = segment.length - 1) > 0) {\n if (!polygonStarted) sink.polygonStart(), polygonStarted = true;\n sink.lineStart();\n for (i = 0; i < m; ++i) sink.point((point = segment[i])[0], point[1]);\n sink.lineEnd();\n }\n return;\n }\n\n // Rejoin connected segments.\n // TODO reuse ringBuffer.rejoin()?\n if (n > 1 && clean & 2) ringSegments.push(ringSegments.pop().concat(ringSegments.shift()));\n\n segments.push(ringSegments.filter(validSegment));\n }\n\n return clip;\n };\n};\n\nfunction validSegment(segment) {\n return segment.length > 1;\n}\n\n// Intersections are sorted along the clip edge. For both antimeridian cutting\n// and circle clipping, the same comparison is used.\nfunction compareIntersection(a, b) {\n return ((a = a.x)[0] < 0 ? a[1] - halfPi$2 - epsilon$2 : halfPi$2 - a[1])\n - ((b = b.x)[0] < 0 ? b[1] - halfPi$2 - epsilon$2 : halfPi$2 - b[1]);\n}\n\nvar clipAntimeridian = clip(\n function() { return true; },\n clipAntimeridianLine,\n clipAntimeridianInterpolate,\n [-pi$3, -halfPi$2]\n);\n\n// Takes a line and cuts into visible segments. Return values: 0 - there were\n// intersections or the line was empty; 1 - no intersections; 2 - there were\n// intersections, and the first and last segments should be rejoined.\nfunction clipAntimeridianLine(stream) {\n var lambda0 = NaN,\n phi0 = NaN,\n sign0 = NaN,\n clean; // no intersections\n\n return {\n lineStart: function() {\n stream.lineStart();\n clean = 1;\n },\n point: function(lambda1, phi1) {\n var sign1 = lambda1 > 0 ? pi$3 : -pi$3,\n delta = abs(lambda1 - lambda0);\n if (abs(delta - pi$3) < epsilon$2) { // line crosses a pole\n stream.point(lambda0, phi0 = (phi0 + phi1) / 2 > 0 ? halfPi$2 : -halfPi$2);\n stream.point(sign0, phi0);\n stream.lineEnd();\n stream.lineStart();\n stream.point(sign1, phi0);\n stream.point(lambda1, phi0);\n clean = 0;\n } else if (sign0 !== sign1 && delta >= pi$3) { // line crosses antimeridian\n if (abs(lambda0 - sign0) < epsilon$2) lambda0 -= sign0 * epsilon$2; // handle degeneracies\n if (abs(lambda1 - sign1) < epsilon$2) lambda1 -= sign1 * epsilon$2;\n phi0 = clipAntimeridianIntersect(lambda0, phi0, lambda1, phi1);\n stream.point(sign0, phi0);\n stream.lineEnd();\n stream.lineStart();\n stream.point(sign1, phi0);\n clean = 0;\n }\n stream.point(lambda0 = lambda1, phi0 = phi1);\n sign0 = sign1;\n },\n lineEnd: function() {\n stream.lineEnd();\n lambda0 = phi0 = NaN;\n },\n clean: function() {\n return 2 - clean; // if intersections, rejoin first and last segments\n }\n };\n}\n\nfunction clipAntimeridianIntersect(lambda0, phi0, lambda1, phi1) {\n var cosPhi0,\n cosPhi1,\n sinLambda0Lambda1 = sin$1(lambda0 - lambda1);\n return abs(sinLambda0Lambda1) > epsilon$2\n ? atan((sin$1(phi0) * (cosPhi1 = cos$1(phi1)) * sin$1(lambda1)\n - sin$1(phi1) * (cosPhi0 = cos$1(phi0)) * sin$1(lambda0))\n / (cosPhi0 * cosPhi1 * sinLambda0Lambda1))\n : (phi0 + phi1) / 2;\n}\n\nfunction clipAntimeridianInterpolate(from, to, direction, stream) {\n var phi;\n if (from == null) {\n phi = direction * halfPi$2;\n stream.point(-pi$3, phi);\n stream.point(0, phi);\n stream.point(pi$3, phi);\n stream.point(pi$3, 0);\n stream.point(pi$3, -phi);\n stream.point(0, -phi);\n stream.point(-pi$3, -phi);\n stream.point(-pi$3, 0);\n stream.point(-pi$3, phi);\n } else if (abs(from[0] - to[0]) > epsilon$2) {\n var lambda = from[0] < to[0] ? pi$3 : -pi$3;\n phi = direction * lambda / 2;\n stream.point(-lambda, phi);\n stream.point(0, phi);\n stream.point(lambda, phi);\n } else {\n stream.point(to[0], to[1]);\n }\n}\n\nvar clipCircle = function(radius) {\n var cr = cos$1(radius),\n delta = 6 * radians,\n smallRadius = cr > 0,\n notHemisphere = abs(cr) > epsilon$2; // TODO optimise for this common case\n\n function interpolate(from, to, direction, stream) {\n circleStream(stream, radius, delta, direction, from, to);\n }\n\n function visible(lambda, phi) {\n return cos$1(lambda) * cos$1(phi) > cr;\n }\n\n // Takes a line and cuts into visible segments. Return values used for polygon\n // clipping: 0 - there were intersections or the line was empty; 1 - no\n // intersections 2 - there were intersections, and the first and last segments\n // should be rejoined.\n function clipLine(stream) {\n var point0, // previous point\n c0, // code for previous point\n v0, // visibility of previous point\n v00, // visibility of first point\n clean; // no intersections\n return {\n lineStart: function() {\n v00 = v0 = false;\n clean = 1;\n },\n point: function(lambda, phi) {\n var point1 = [lambda, phi],\n point2,\n v = visible(lambda, phi),\n c = smallRadius\n ? v ? 0 : code(lambda, phi)\n : v ? code(lambda + (lambda < 0 ? pi$3 : -pi$3), phi) : 0;\n if (!point0 && (v00 = v0 = v)) stream.lineStart();\n // Handle degeneracies.\n // TODO ignore if not clipping polygons.\n if (v !== v0) {\n point2 = intersect(point0, point1);\n if (!point2 || pointEqual(point0, point2) || pointEqual(point1, point2)) {\n point1[0] += epsilon$2;\n point1[1] += epsilon$2;\n v = visible(point1[0], point1[1]);\n }\n }\n if (v !== v0) {\n clean = 0;\n if (v) {\n // outside going in\n stream.lineStart();\n point2 = intersect(point1, point0);\n stream.point(point2[0], point2[1]);\n } else {\n // inside going out\n point2 = intersect(point0, point1);\n stream.point(point2[0], point2[1]);\n stream.lineEnd();\n }\n point0 = point2;\n } else if (notHemisphere && point0 && smallRadius ^ v) {\n var t;\n // If the codes for two points are different, or are both zero,\n // and there this segment intersects with the small circle.\n if (!(c & c0) && (t = intersect(point1, point0, true))) {\n clean = 0;\n if (smallRadius) {\n stream.lineStart();\n stream.point(t[0][0], t[0][1]);\n stream.point(t[1][0], t[1][1]);\n stream.lineEnd();\n } else {\n stream.point(t[1][0], t[1][1]);\n stream.lineEnd();\n stream.lineStart();\n stream.point(t[0][0], t[0][1]);\n }\n }\n }\n if (v && (!point0 || !pointEqual(point0, point1))) {\n stream.point(point1[0], point1[1]);\n }\n point0 = point1, v0 = v, c0 = c;\n },\n lineEnd: function() {\n if (v0) stream.lineEnd();\n point0 = null;\n },\n // Rejoin first and last segments if there were intersections and the first\n // and last points were visible.\n clean: function() {\n return clean | ((v00 && v0) << 1);\n }\n };\n }\n\n // Intersects the great circle between a and b with the clip circle.\n function intersect(a, b, two) {\n var pa = cartesian(a),\n pb = cartesian(b);\n\n // We have two planes, n1.p = d1 and n2.p = d2.\n // Find intersection line p(t) = c1 n1 + c2 n2 + t (n1 ⨯ n2).\n var n1 = [1, 0, 0], // normal\n n2 = cartesianCross(pa, pb),\n n2n2 = cartesianDot(n2, n2),\n n1n2 = n2[0], // cartesianDot(n1, n2),\n determinant = n2n2 - n1n2 * n1n2;\n\n // Two polar points.\n if (!determinant) return !two && a;\n\n var c1 = cr * n2n2 / determinant,\n c2 = -cr * n1n2 / determinant,\n n1xn2 = cartesianCross(n1, n2),\n A = cartesianScale(n1, c1),\n B = cartesianScale(n2, c2);\n cartesianAddInPlace(A, B);\n\n // Solve |p(t)|^2 = 1.\n var u = n1xn2,\n w = cartesianDot(A, u),\n uu = cartesianDot(u, u),\n t2 = w * w - uu * (cartesianDot(A, A) - 1);\n\n if (t2 < 0) return;\n\n var t = sqrt(t2),\n q = cartesianScale(u, (-w - t) / uu);\n cartesianAddInPlace(q, A);\n q = spherical(q);\n\n if (!two) return q;\n\n // Two intersection points.\n var lambda0 = a[0],\n lambda1 = b[0],\n phi0 = a[1],\n phi1 = b[1],\n z;\n\n if (lambda1 < lambda0) z = lambda0, lambda0 = lambda1, lambda1 = z;\n\n var delta = lambda1 - lambda0,\n polar = abs(delta - pi$3) < epsilon$2,\n meridian = polar || delta < epsilon$2;\n\n if (!polar && phi1 < phi0) z = phi0, phi0 = phi1, phi1 = z;\n\n // Check that the first point is between a and b.\n if (meridian\n ? polar\n ? phi0 + phi1 > 0 ^ q[1] < (abs(q[0] - lambda0) < epsilon$2 ? phi0 : phi1)\n : phi0 <= q[1] && q[1] <= phi1\n : delta > pi$3 ^ (lambda0 <= q[0] && q[0] <= lambda1)) {\n var q1 = cartesianScale(u, (-w + t) / uu);\n cartesianAddInPlace(q1, A);\n return [q, spherical(q1)];\n }\n }\n\n // Generates a 4-bit vector representing the location of a point relative to\n // the small circle's bounding box.\n function code(lambda, phi) {\n var r = smallRadius ? radius : pi$3 - radius,\n code = 0;\n if (lambda < -r) code |= 1; // left\n else if (lambda > r) code |= 2; // right\n if (phi < -r) code |= 4; // below\n else if (phi > r) code |= 8; // above\n return code;\n }\n\n return clip(visible, clipLine, interpolate, smallRadius ? [0, -radius] : [-pi$3, radius - pi$3]);\n};\n\nvar clipLine = function(a, b, x0, y0, x1, y1) {\n var ax = a[0],\n ay = a[1],\n bx = b[0],\n by = b[1],\n t0 = 0,\n t1 = 1,\n dx = bx - ax,\n dy = by - ay,\n r;\n\n r = x0 - ax;\n if (!dx && r > 0) return;\n r /= dx;\n if (dx < 0) {\n if (r < t0) return;\n if (r < t1) t1 = r;\n } else if (dx > 0) {\n if (r > t1) return;\n if (r > t0) t0 = r;\n }\n\n r = x1 - ax;\n if (!dx && r < 0) return;\n r /= dx;\n if (dx < 0) {\n if (r > t1) return;\n if (r > t0) t0 = r;\n } else if (dx > 0) {\n if (r < t0) return;\n if (r < t1) t1 = r;\n }\n\n r = y0 - ay;\n if (!dy && r > 0) return;\n r /= dy;\n if (dy < 0) {\n if (r < t0) return;\n if (r < t1) t1 = r;\n } else if (dy > 0) {\n if (r > t1) return;\n if (r > t0) t0 = r;\n }\n\n r = y1 - ay;\n if (!dy && r < 0) return;\n r /= dy;\n if (dy < 0) {\n if (r > t1) return;\n if (r > t0) t0 = r;\n } else if (dy > 0) {\n if (r < t0) return;\n if (r < t1) t1 = r;\n }\n\n if (t0 > 0) a[0] = ax + t0 * dx, a[1] = ay + t0 * dy;\n if (t1 < 1) b[0] = ax + t1 * dx, b[1] = ay + t1 * dy;\n return true;\n};\n\nvar clipMax = 1e9;\nvar clipMin = -clipMax;\n\n// TODO Use d3-polygon’s polygonContains here for the ring check?\n// TODO Eliminate duplicate buffering in clipBuffer and polygon.push?\n\nfunction clipRectangle(x0, y0, x1, y1) {\n\n function visible(x, y) {\n return x0 <= x && x <= x1 && y0 <= y && y <= y1;\n }\n\n function interpolate(from, to, direction, stream) {\n var a = 0, a1 = 0;\n if (from == null\n || (a = corner(from, direction)) !== (a1 = corner(to, direction))\n || comparePoint(from, to) < 0 ^ direction > 0) {\n do stream.point(a === 0 || a === 3 ? x0 : x1, a > 1 ? y1 : y0);\n while ((a = (a + direction + 4) % 4) !== a1);\n } else {\n stream.point(to[0], to[1]);\n }\n }\n\n function corner(p, direction) {\n return abs(p[0] - x0) < epsilon$2 ? direction > 0 ? 0 : 3\n : abs(p[0] - x1) < epsilon$2 ? direction > 0 ? 2 : 1\n : abs(p[1] - y0) < epsilon$2 ? direction > 0 ? 1 : 0\n : direction > 0 ? 3 : 2; // abs(p[1] - y1) < epsilon\n }\n\n function compareIntersection(a, b) {\n return comparePoint(a.x, b.x);\n }\n\n function comparePoint(a, b) {\n var ca = corner(a, 1),\n cb = corner(b, 1);\n return ca !== cb ? ca - cb\n : ca === 0 ? b[1] - a[1]\n : ca === 1 ? a[0] - b[0]\n : ca === 2 ? a[1] - b[1]\n : b[0] - a[0];\n }\n\n return function(stream) {\n var activeStream = stream,\n bufferStream = clipBuffer(),\n segments,\n polygon,\n ring,\n x__, y__, v__, // first point\n x_, y_, v_, // previous point\n first,\n clean;\n\n var clipStream = {\n point: point,\n lineStart: lineStart,\n lineEnd: lineEnd,\n polygonStart: polygonStart,\n polygonEnd: polygonEnd\n };\n\n function point(x, y) {\n if (visible(x, y)) activeStream.point(x, y);\n }\n\n function polygonInside() {\n var winding = 0;\n\n for (var i = 0, n = polygon.length; i < n; ++i) {\n for (var ring = polygon[i], j = 1, m = ring.length, point = ring[0], a0, a1, b0 = point[0], b1 = point[1]; j < m; ++j) {\n a0 = b0, a1 = b1, point = ring[j], b0 = point[0], b1 = point[1];\n if (a1 <= y1) { if (b1 > y1 && (b0 - a0) * (y1 - a1) > (b1 - a1) * (x0 - a0)) ++winding; }\n else { if (b1 <= y1 && (b0 - a0) * (y1 - a1) < (b1 - a1) * (x0 - a0)) --winding; }\n }\n }\n\n return winding;\n }\n\n // Buffer geometry within a polygon and then clip it en masse.\n function polygonStart() {\n activeStream = bufferStream, segments = [], polygon = [], clean = true;\n }\n\n function polygonEnd() {\n var startInside = polygonInside(),\n cleanInside = clean && startInside,\n visible = (segments = merge(segments)).length;\n if (cleanInside || visible) {\n stream.polygonStart();\n if (cleanInside) {\n stream.lineStart();\n interpolate(null, null, 1, stream);\n stream.lineEnd();\n }\n if (visible) {\n clipRejoin(segments, compareIntersection, startInside, interpolate, stream);\n }\n stream.polygonEnd();\n }\n activeStream = stream, segments = polygon = ring = null;\n }\n\n function lineStart() {\n clipStream.point = linePoint;\n if (polygon) polygon.push(ring = []);\n first = true;\n v_ = false;\n x_ = y_ = NaN;\n }\n\n // TODO rather than special-case polygons, simply handle them separately.\n // Ideally, coincident intersection points should be jittered to avoid\n // clipping issues.\n function lineEnd() {\n if (segments) {\n linePoint(x__, y__);\n if (v__ && v_) bufferStream.rejoin();\n segments.push(bufferStream.result());\n }\n clipStream.point = point;\n if (v_) activeStream.lineEnd();\n }\n\n function linePoint(x, y) {\n var v = visible(x, y);\n if (polygon) ring.push([x, y]);\n if (first) {\n x__ = x, y__ = y, v__ = v;\n first = false;\n if (v) {\n activeStream.lineStart();\n activeStream.point(x, y);\n }\n } else {\n if (v && v_) activeStream.point(x, y);\n else {\n var a = [x_ = Math.max(clipMin, Math.min(clipMax, x_)), y_ = Math.max(clipMin, Math.min(clipMax, y_))],\n b = [x = Math.max(clipMin, Math.min(clipMax, x)), y = Math.max(clipMin, Math.min(clipMax, y))];\n if (clipLine(a, b, x0, y0, x1, y1)) {\n if (!v_) {\n activeStream.lineStart();\n activeStream.point(a[0], a[1]);\n }\n activeStream.point(b[0], b[1]);\n if (!v) activeStream.lineEnd();\n clean = false;\n } else if (v) {\n activeStream.lineStart();\n activeStream.point(x, y);\n clean = false;\n }\n }\n }\n x_ = x, y_ = y, v_ = v;\n }\n\n return clipStream;\n };\n}\n\nvar extent$1 = function() {\n var x0 = 0,\n y0 = 0,\n x1 = 960,\n y1 = 500,\n cache,\n cacheStream,\n clip;\n\n return clip = {\n stream: function(stream) {\n return cache && cacheStream === stream ? cache : cache = clipRectangle(x0, y0, x1, y1)(cacheStream = stream);\n },\n extent: function(_) {\n return arguments.length ? (x0 = +_[0][0], y0 = +_[0][1], x1 = +_[1][0], y1 = +_[1][1], cache = cacheStream = null, clip) : [[x0, y0], [x1, y1]];\n }\n };\n};\n\nvar lengthSum = adder();\nvar lambda0$2;\nvar sinPhi0$1;\nvar cosPhi0$1;\n\nvar lengthStream = {\n sphere: noop$1,\n point: noop$1,\n lineStart: lengthLineStart,\n lineEnd: noop$1,\n polygonStart: noop$1,\n polygonEnd: noop$1\n};\n\nfunction lengthLineStart() {\n lengthStream.point = lengthPointFirst;\n lengthStream.lineEnd = lengthLineEnd;\n}\n\nfunction lengthLineEnd() {\n lengthStream.point = lengthStream.lineEnd = noop$1;\n}\n\nfunction lengthPointFirst(lambda, phi) {\n lambda *= radians, phi *= radians;\n lambda0$2 = lambda, sinPhi0$1 = sin$1(phi), cosPhi0$1 = cos$1(phi);\n lengthStream.point = lengthPoint;\n}\n\nfunction lengthPoint(lambda, phi) {\n lambda *= radians, phi *= radians;\n var sinPhi = sin$1(phi),\n cosPhi = cos$1(phi),\n delta = abs(lambda - lambda0$2),\n cosDelta = cos$1(delta),\n sinDelta = sin$1(delta),\n x = cosPhi * sinDelta,\n y = cosPhi0$1 * sinPhi - sinPhi0$1 * cosPhi * cosDelta,\n z = sinPhi0$1 * sinPhi + cosPhi0$1 * cosPhi * cosDelta;\n lengthSum.add(atan2(sqrt(x * x + y * y), z));\n lambda0$2 = lambda, sinPhi0$1 = sinPhi, cosPhi0$1 = cosPhi;\n}\n\nvar length$1 = function(object) {\n lengthSum.reset();\n geoStream(object, lengthStream);\n return +lengthSum;\n};\n\nvar coordinates = [null, null];\nvar object$1 = {type: \"LineString\", coordinates: coordinates};\n\nvar distance = function(a, b) {\n coordinates[0] = a;\n coordinates[1] = b;\n return length$1(object$1);\n};\n\nvar containsObjectType = {\n Feature: function(object, point) {\n return containsGeometry(object.geometry, point);\n },\n FeatureCollection: function(object, point) {\n var features = object.features, i = -1, n = features.length;\n while (++i < n) if (containsGeometry(features[i].geometry, point)) return true;\n return false;\n }\n};\n\nvar containsGeometryType = {\n Sphere: function() {\n return true;\n },\n Point: function(object, point) {\n return containsPoint(object.coordinates, point);\n },\n MultiPoint: function(object, point) {\n var coordinates = object.coordinates, i = -1, n = coordinates.length;\n while (++i < n) if (containsPoint(coordinates[i], point)) return true;\n return false;\n },\n LineString: function(object, point) {\n return containsLine(object.coordinates, point);\n },\n MultiLineString: function(object, point) {\n var coordinates = object.coordinates, i = -1, n = coordinates.length;\n while (++i < n) if (containsLine(coordinates[i], point)) return true;\n return false;\n },\n Polygon: function(object, point) {\n return containsPolygon(object.coordinates, point);\n },\n MultiPolygon: function(object, point) {\n var coordinates = object.coordinates, i = -1, n = coordinates.length;\n while (++i < n) if (containsPolygon(coordinates[i], point)) return true;\n return false;\n },\n GeometryCollection: function(object, point) {\n var geometries = object.geometries, i = -1, n = geometries.length;\n while (++i < n) if (containsGeometry(geometries[i], point)) return true;\n return false;\n }\n};\n\nfunction containsGeometry(geometry, point) {\n return geometry && containsGeometryType.hasOwnProperty(geometry.type)\n ? containsGeometryType[geometry.type](geometry, point)\n : false;\n}\n\nfunction containsPoint(coordinates, point) {\n return distance(coordinates, point) === 0;\n}\n\nfunction containsLine(coordinates, point) {\n var ab = distance(coordinates[0], coordinates[1]),\n ao = distance(coordinates[0], point),\n ob = distance(point, coordinates[1]);\n return ao + ob <= ab + epsilon$2;\n}\n\nfunction containsPolygon(coordinates, point) {\n return !!polygonContains(coordinates.map(ringRadians), pointRadians(point));\n}\n\nfunction ringRadians(ring) {\n return ring = ring.map(pointRadians), ring.pop(), ring;\n}\n\nfunction pointRadians(point) {\n return [point[0] * radians, point[1] * radians];\n}\n\nvar contains = function(object, point) {\n return (object && containsObjectType.hasOwnProperty(object.type)\n ? containsObjectType[object.type]\n : containsGeometry)(object, point);\n};\n\nfunction graticuleX(y0, y1, dy) {\n var y = sequence(y0, y1 - epsilon$2, dy).concat(y1);\n return function(x) { return y.map(function(y) { return [x, y]; }); };\n}\n\nfunction graticuleY(x0, x1, dx) {\n var x = sequence(x0, x1 - epsilon$2, dx).concat(x1);\n return function(y) { return x.map(function(x) { return [x, y]; }); };\n}\n\nfunction graticule() {\n var x1, x0, X1, X0,\n y1, y0, Y1, Y0,\n dx = 10, dy = dx, DX = 90, DY = 360,\n x, y, X, Y,\n precision = 2.5;\n\n function graticule() {\n return {type: \"MultiLineString\", coordinates: lines()};\n }\n\n function lines() {\n return sequence(ceil(X0 / DX) * DX, X1, DX).map(X)\n .concat(sequence(ceil(Y0 / DY) * DY, Y1, DY).map(Y))\n .concat(sequence(ceil(x0 / dx) * dx, x1, dx).filter(function(x) { return abs(x % DX) > epsilon$2; }).map(x))\n .concat(sequence(ceil(y0 / dy) * dy, y1, dy).filter(function(y) { return abs(y % DY) > epsilon$2; }).map(y));\n }\n\n graticule.lines = function() {\n return lines().map(function(coordinates) { return {type: \"LineString\", coordinates: coordinates}; });\n };\n\n graticule.outline = function() {\n return {\n type: \"Polygon\",\n coordinates: [\n X(X0).concat(\n Y(Y1).slice(1),\n X(X1).reverse().slice(1),\n Y(Y0).reverse().slice(1))\n ]\n };\n };\n\n graticule.extent = function(_) {\n if (!arguments.length) return graticule.extentMinor();\n return graticule.extentMajor(_).extentMinor(_);\n };\n\n graticule.extentMajor = function(_) {\n if (!arguments.length) return [[X0, Y0], [X1, Y1]];\n X0 = +_[0][0], X1 = +_[1][0];\n Y0 = +_[0][1], Y1 = +_[1][1];\n if (X0 > X1) _ = X0, X0 = X1, X1 = _;\n if (Y0 > Y1) _ = Y0, Y0 = Y1, Y1 = _;\n return graticule.precision(precision);\n };\n\n graticule.extentMinor = function(_) {\n if (!arguments.length) return [[x0, y0], [x1, y1]];\n x0 = +_[0][0], x1 = +_[1][0];\n y0 = +_[0][1], y1 = +_[1][1];\n if (x0 > x1) _ = x0, x0 = x1, x1 = _;\n if (y0 > y1) _ = y0, y0 = y1, y1 = _;\n return graticule.precision(precision);\n };\n\n graticule.step = function(_) {\n if (!arguments.length) return graticule.stepMinor();\n return graticule.stepMajor(_).stepMinor(_);\n };\n\n graticule.stepMajor = function(_) {\n if (!arguments.length) return [DX, DY];\n DX = +_[0], DY = +_[1];\n return graticule;\n };\n\n graticule.stepMinor = function(_) {\n if (!arguments.length) return [dx, dy];\n dx = +_[0], dy = +_[1];\n return graticule;\n };\n\n graticule.precision = function(_) {\n if (!arguments.length) return precision;\n precision = +_;\n x = graticuleX(y0, y1, 90);\n y = graticuleY(x0, x1, precision);\n X = graticuleX(Y0, Y1, 90);\n Y = graticuleY(X0, X1, precision);\n return graticule;\n };\n\n return graticule\n .extentMajor([[-180, -90 + epsilon$2], [180, 90 - epsilon$2]])\n .extentMinor([[-180, -80 - epsilon$2], [180, 80 + epsilon$2]]);\n}\n\nfunction graticule10() {\n return graticule()();\n}\n\nvar interpolate$1 = function(a, b) {\n var x0 = a[0] * radians,\n y0 = a[1] * radians,\n x1 = b[0] * radians,\n y1 = b[1] * radians,\n cy0 = cos$1(y0),\n sy0 = sin$1(y0),\n cy1 = cos$1(y1),\n sy1 = sin$1(y1),\n kx0 = cy0 * cos$1(x0),\n ky0 = cy0 * sin$1(x0),\n kx1 = cy1 * cos$1(x1),\n ky1 = cy1 * sin$1(x1),\n d = 2 * asin(sqrt(haversin(y1 - y0) + cy0 * cy1 * haversin(x1 - x0))),\n k = sin$1(d);\n\n var interpolate = d ? function(t) {\n var B = sin$1(t *= d) / k,\n A = sin$1(d - t) / k,\n x = A * kx0 + B * kx1,\n y = A * ky0 + B * ky1,\n z = A * sy0 + B * sy1;\n return [\n atan2(y, x) * degrees$1,\n atan2(z, sqrt(x * x + y * y)) * degrees$1\n ];\n } : function() {\n return [x0 * degrees$1, y0 * degrees$1];\n };\n\n interpolate.distance = d;\n\n return interpolate;\n};\n\nvar identity$4 = function(x) {\n return x;\n};\n\nvar areaSum$1 = adder();\nvar areaRingSum$1 = adder();\nvar x00;\nvar y00;\nvar x0$1;\nvar y0$1;\n\nvar areaStream$1 = {\n point: noop$1,\n lineStart: noop$1,\n lineEnd: noop$1,\n polygonStart: function() {\n areaStream$1.lineStart = areaRingStart$1;\n areaStream$1.lineEnd = areaRingEnd$1;\n },\n polygonEnd: function() {\n areaStream$1.lineStart = areaStream$1.lineEnd = areaStream$1.point = noop$1;\n areaSum$1.add(abs(areaRingSum$1));\n areaRingSum$1.reset();\n },\n result: function() {\n var area = areaSum$1 / 2;\n areaSum$1.reset();\n return area;\n }\n};\n\nfunction areaRingStart$1() {\n areaStream$1.point = areaPointFirst$1;\n}\n\nfunction areaPointFirst$1(x, y) {\n areaStream$1.point = areaPoint$1;\n x00 = x0$1 = x, y00 = y0$1 = y;\n}\n\nfunction areaPoint$1(x, y) {\n areaRingSum$1.add(y0$1 * x - x0$1 * y);\n x0$1 = x, y0$1 = y;\n}\n\nfunction areaRingEnd$1() {\n areaPoint$1(x00, y00);\n}\n\nvar x0$2 = Infinity;\nvar y0$2 = x0$2;\nvar x1 = -x0$2;\nvar y1 = x1;\n\nvar boundsStream$1 = {\n point: boundsPoint$1,\n lineStart: noop$1,\n lineEnd: noop$1,\n polygonStart: noop$1,\n polygonEnd: noop$1,\n result: function() {\n var bounds = [[x0$2, y0$2], [x1, y1]];\n x1 = y1 = -(y0$2 = x0$2 = Infinity);\n return bounds;\n }\n};\n\nfunction boundsPoint$1(x, y) {\n if (x < x0$2) x0$2 = x;\n if (x > x1) x1 = x;\n if (y < y0$2) y0$2 = y;\n if (y > y1) y1 = y;\n}\n\n// TODO Enforce positive area for exterior, negative area for interior?\n\nvar X0$1 = 0;\nvar Y0$1 = 0;\nvar Z0$1 = 0;\nvar X1$1 = 0;\nvar Y1$1 = 0;\nvar Z1$1 = 0;\nvar X2$1 = 0;\nvar Y2$1 = 0;\nvar Z2$1 = 0;\nvar x00$1;\nvar y00$1;\nvar x0$3;\nvar y0$3;\n\nvar centroidStream$1 = {\n point: centroidPoint$1,\n lineStart: centroidLineStart$1,\n lineEnd: centroidLineEnd$1,\n polygonStart: function() {\n centroidStream$1.lineStart = centroidRingStart$1;\n centroidStream$1.lineEnd = centroidRingEnd$1;\n },\n polygonEnd: function() {\n centroidStream$1.point = centroidPoint$1;\n centroidStream$1.lineStart = centroidLineStart$1;\n centroidStream$1.lineEnd = centroidLineEnd$1;\n },\n result: function() {\n var centroid = Z2$1 ? [X2$1 / Z2$1, Y2$1 / Z2$1]\n : Z1$1 ? [X1$1 / Z1$1, Y1$1 / Z1$1]\n : Z0$1 ? [X0$1 / Z0$1, Y0$1 / Z0$1]\n : [NaN, NaN];\n X0$1 = Y0$1 = Z0$1 =\n X1$1 = Y1$1 = Z1$1 =\n X2$1 = Y2$1 = Z2$1 = 0;\n return centroid;\n }\n};\n\nfunction centroidPoint$1(x, y) {\n X0$1 += x;\n Y0$1 += y;\n ++Z0$1;\n}\n\nfunction centroidLineStart$1() {\n centroidStream$1.point = centroidPointFirstLine;\n}\n\nfunction centroidPointFirstLine(x, y) {\n centroidStream$1.point = centroidPointLine;\n centroidPoint$1(x0$3 = x, y0$3 = y);\n}\n\nfunction centroidPointLine(x, y) {\n var dx = x - x0$3, dy = y - y0$3, z = sqrt(dx * dx + dy * dy);\n X1$1 += z * (x0$3 + x) / 2;\n Y1$1 += z * (y0$3 + y) / 2;\n Z1$1 += z;\n centroidPoint$1(x0$3 = x, y0$3 = y);\n}\n\nfunction centroidLineEnd$1() {\n centroidStream$1.point = centroidPoint$1;\n}\n\nfunction centroidRingStart$1() {\n centroidStream$1.point = centroidPointFirstRing;\n}\n\nfunction centroidRingEnd$1() {\n centroidPointRing(x00$1, y00$1);\n}\n\nfunction centroidPointFirstRing(x, y) {\n centroidStream$1.point = centroidPointRing;\n centroidPoint$1(x00$1 = x0$3 = x, y00$1 = y0$3 = y);\n}\n\nfunction centroidPointRing(x, y) {\n var dx = x - x0$3,\n dy = y - y0$3,\n z = sqrt(dx * dx + dy * dy);\n\n X1$1 += z * (x0$3 + x) / 2;\n Y1$1 += z * (y0$3 + y) / 2;\n Z1$1 += z;\n\n z = y0$3 * x - x0$3 * y;\n X2$1 += z * (x0$3 + x);\n Y2$1 += z * (y0$3 + y);\n Z2$1 += z * 3;\n centroidPoint$1(x0$3 = x, y0$3 = y);\n}\n\nfunction PathContext(context) {\n this._context = context;\n}\n\nPathContext.prototype = {\n _radius: 4.5,\n pointRadius: function(_) {\n return this._radius = _, this;\n },\n polygonStart: function() {\n this._line = 0;\n },\n polygonEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._point = 0;\n },\n lineEnd: function() {\n if (this._line === 0) this._context.closePath();\n this._point = NaN;\n },\n point: function(x, y) {\n switch (this._point) {\n case 0: {\n this._context.moveTo(x, y);\n this._point = 1;\n break;\n }\n case 1: {\n this._context.lineTo(x, y);\n break;\n }\n default: {\n this._context.moveTo(x + this._radius, y);\n this._context.arc(x, y, this._radius, 0, tau$3);\n break;\n }\n }\n },\n result: noop$1\n};\n\nvar lengthSum$1 = adder();\nvar lengthRing;\nvar x00$2;\nvar y00$2;\nvar x0$4;\nvar y0$4;\n\nvar lengthStream$1 = {\n point: noop$1,\n lineStart: function() {\n lengthStream$1.point = lengthPointFirst$1;\n },\n lineEnd: function() {\n if (lengthRing) lengthPoint$1(x00$2, y00$2);\n lengthStream$1.point = noop$1;\n },\n polygonStart: function() {\n lengthRing = true;\n },\n polygonEnd: function() {\n lengthRing = null;\n },\n result: function() {\n var length = +lengthSum$1;\n lengthSum$1.reset();\n return length;\n }\n};\n\nfunction lengthPointFirst$1(x, y) {\n lengthStream$1.point = lengthPoint$1;\n x00$2 = x0$4 = x, y00$2 = y0$4 = y;\n}\n\nfunction lengthPoint$1(x, y) {\n x0$4 -= x, y0$4 -= y;\n lengthSum$1.add(sqrt(x0$4 * x0$4 + y0$4 * y0$4));\n x0$4 = x, y0$4 = y;\n}\n\nfunction PathString() {\n this._string = [];\n}\n\nPathString.prototype = {\n _radius: 4.5,\n _circle: circle$1(4.5),\n pointRadius: function(_) {\n if ((_ = +_) !== this._radius) this._radius = _, this._circle = null;\n return this;\n },\n polygonStart: function() {\n this._line = 0;\n },\n polygonEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._point = 0;\n },\n lineEnd: function() {\n if (this._line === 0) this._string.push(\"Z\");\n this._point = NaN;\n },\n point: function(x, y) {\n switch (this._point) {\n case 0: {\n this._string.push(\"M\", x, \",\", y);\n this._point = 1;\n break;\n }\n case 1: {\n this._string.push(\"L\", x, \",\", y);\n break;\n }\n default: {\n if (this._circle == null) this._circle = circle$1(this._radius);\n this._string.push(\"M\", x, \",\", y, this._circle);\n break;\n }\n }\n },\n result: function() {\n if (this._string.length) {\n var result = this._string.join(\"\");\n this._string = [];\n return result;\n } else {\n return null;\n }\n }\n};\n\nfunction circle$1(radius) {\n return \"m0,\" + radius\n + \"a\" + radius + \",\" + radius + \" 0 1,1 0,\" + -2 * radius\n + \"a\" + radius + \",\" + radius + \" 0 1,1 0,\" + 2 * radius\n + \"z\";\n}\n\nvar index$1 = function(projection, context) {\n var pointRadius = 4.5,\n projectionStream,\n contextStream;\n\n function path(object) {\n if (object) {\n if (typeof pointRadius === \"function\") contextStream.pointRadius(+pointRadius.apply(this, arguments));\n geoStream(object, projectionStream(contextStream));\n }\n return contextStream.result();\n }\n\n path.area = function(object) {\n geoStream(object, projectionStream(areaStream$1));\n return areaStream$1.result();\n };\n\n path.measure = function(object) {\n geoStream(object, projectionStream(lengthStream$1));\n return lengthStream$1.result();\n };\n\n path.bounds = function(object) {\n geoStream(object, projectionStream(boundsStream$1));\n return boundsStream$1.result();\n };\n\n path.centroid = function(object) {\n geoStream(object, projectionStream(centroidStream$1));\n return centroidStream$1.result();\n };\n\n path.projection = function(_) {\n return arguments.length ? (projectionStream = _ == null ? (projection = null, identity$4) : (projection = _).stream, path) : projection;\n };\n\n path.context = function(_) {\n if (!arguments.length) return context;\n contextStream = _ == null ? (context = null, new PathString) : new PathContext(context = _);\n if (typeof pointRadius !== \"function\") contextStream.pointRadius(pointRadius);\n return path;\n };\n\n path.pointRadius = function(_) {\n if (!arguments.length) return pointRadius;\n pointRadius = typeof _ === \"function\" ? _ : (contextStream.pointRadius(+_), +_);\n return path;\n };\n\n return path.projection(projection).context(context);\n};\n\nvar transform = function(methods) {\n return {\n stream: transformer(methods)\n };\n};\n\nfunction transformer(methods) {\n return function(stream) {\n var s = new TransformStream;\n for (var key in methods) s[key] = methods[key];\n s.stream = stream;\n return s;\n };\n}\n\nfunction TransformStream() {}\n\nTransformStream.prototype = {\n constructor: TransformStream,\n point: function(x, y) { this.stream.point(x, y); },\n sphere: function() { this.stream.sphere(); },\n lineStart: function() { this.stream.lineStart(); },\n lineEnd: function() { this.stream.lineEnd(); },\n polygonStart: function() { this.stream.polygonStart(); },\n polygonEnd: function() { this.stream.polygonEnd(); }\n};\n\nfunction fitExtent(projection, extent, object) {\n var w = extent[1][0] - extent[0][0],\n h = extent[1][1] - extent[0][1],\n clip = projection.clipExtent && projection.clipExtent();\n\n projection\n .scale(150)\n .translate([0, 0]);\n\n if (clip != null) projection.clipExtent(null);\n\n geoStream(object, projection.stream(boundsStream$1));\n\n var b = boundsStream$1.result(),\n k = Math.min(w / (b[1][0] - b[0][0]), h / (b[1][1] - b[0][1])),\n x = +extent[0][0] + (w - k * (b[1][0] + b[0][0])) / 2,\n y = +extent[0][1] + (h - k * (b[1][1] + b[0][1])) / 2;\n\n if (clip != null) projection.clipExtent(clip);\n\n return projection\n .scale(k * 150)\n .translate([x, y]);\n}\n\nfunction fitSize(projection, size, object) {\n return fitExtent(projection, [[0, 0], size], object);\n}\n\nvar maxDepth = 16;\nvar cosMinDistance = cos$1(30 * radians); // cos(minimum angular distance)\n\nvar resample = function(project, delta2) {\n return +delta2 ? resample$1(project, delta2) : resampleNone(project);\n};\n\nfunction resampleNone(project) {\n return transformer({\n point: function(x, y) {\n x = project(x, y);\n this.stream.point(x[0], x[1]);\n }\n });\n}\n\nfunction resample$1(project, delta2) {\n\n function resampleLineTo(x0, y0, lambda0, a0, b0, c0, x1, y1, lambda1, a1, b1, c1, depth, stream) {\n var dx = x1 - x0,\n dy = y1 - y0,\n d2 = dx * dx + dy * dy;\n if (d2 > 4 * delta2 && depth--) {\n var a = a0 + a1,\n b = b0 + b1,\n c = c0 + c1,\n m = sqrt(a * a + b * b + c * c),\n phi2 = asin(c /= m),\n lambda2 = abs(abs(c) - 1) < epsilon$2 || abs(lambda0 - lambda1) < epsilon$2 ? (lambda0 + lambda1) / 2 : atan2(b, a),\n p = project(lambda2, phi2),\n x2 = p[0],\n y2 = p[1],\n dx2 = x2 - x0,\n dy2 = y2 - y0,\n dz = dy * dx2 - dx * dy2;\n if (dz * dz / d2 > delta2 // perpendicular projected distance\n || abs((dx * dx2 + dy * dy2) / d2 - 0.5) > 0.3 // midpoint close to an end\n || a0 * a1 + b0 * b1 + c0 * c1 < cosMinDistance) { // angular distance\n resampleLineTo(x0, y0, lambda0, a0, b0, c0, x2, y2, lambda2, a /= m, b /= m, c, depth, stream);\n stream.point(x2, y2);\n resampleLineTo(x2, y2, lambda2, a, b, c, x1, y1, lambda1, a1, b1, c1, depth, stream);\n }\n }\n }\n return function(stream) {\n var lambda00, x00, y00, a00, b00, c00, // first point\n lambda0, x0, y0, a0, b0, c0; // previous point\n\n var resampleStream = {\n point: point,\n lineStart: lineStart,\n lineEnd: lineEnd,\n polygonStart: function() { stream.polygonStart(); resampleStream.lineStart = ringStart; },\n polygonEnd: function() { stream.polygonEnd(); resampleStream.lineStart = lineStart; }\n };\n\n function point(x, y) {\n x = project(x, y);\n stream.point(x[0], x[1]);\n }\n\n function lineStart() {\n x0 = NaN;\n resampleStream.point = linePoint;\n stream.lineStart();\n }\n\n function linePoint(lambda, phi) {\n var c = cartesian([lambda, phi]), p = project(lambda, phi);\n resampleLineTo(x0, y0, lambda0, a0, b0, c0, x0 = p[0], y0 = p[1], lambda0 = lambda, a0 = c[0], b0 = c[1], c0 = c[2], maxDepth, stream);\n stream.point(x0, y0);\n }\n\n function lineEnd() {\n resampleStream.point = point;\n stream.lineEnd();\n }\n\n function ringStart() {\n lineStart();\n resampleStream.point = ringPoint;\n resampleStream.lineEnd = ringEnd;\n }\n\n function ringPoint(lambda, phi) {\n linePoint(lambda00 = lambda, phi), x00 = x0, y00 = y0, a00 = a0, b00 = b0, c00 = c0;\n resampleStream.point = linePoint;\n }\n\n function ringEnd() {\n resampleLineTo(x0, y0, lambda0, a0, b0, c0, x00, y00, lambda00, a00, b00, c00, maxDepth, stream);\n resampleStream.lineEnd = lineEnd;\n lineEnd();\n }\n\n return resampleStream;\n };\n}\n\nvar transformRadians = transformer({\n point: function(x, y) {\n this.stream.point(x * radians, y * radians);\n }\n});\n\nfunction transformRotate(rotate) {\n return transformer({\n point: function(x, y) {\n var r = rotate(x, y);\n return this.stream.point(r[0], r[1]);\n }\n });\n}\n\nfunction projection(project) {\n return projectionMutator(function() { return project; })();\n}\n\nfunction projectionMutator(projectAt) {\n var project,\n k = 150, // scale\n x = 480, y = 250, // translate\n dx, dy, lambda = 0, phi = 0, // center\n deltaLambda = 0, deltaPhi = 0, deltaGamma = 0, rotate, projectRotate, // rotate\n theta = null, preclip = clipAntimeridian, // clip angle\n x0 = null, y0, x1, y1, postclip = identity$4, // clip extent\n delta2 = 0.5, projectResample = resample(projectTransform, delta2), // precision\n cache,\n cacheStream;\n\n function projection(point) {\n point = projectRotate(point[0] * radians, point[1] * radians);\n return [point[0] * k + dx, dy - point[1] * k];\n }\n\n function invert(point) {\n point = projectRotate.invert((point[0] - dx) / k, (dy - point[1]) / k);\n return point && [point[0] * degrees$1, point[1] * degrees$1];\n }\n\n function projectTransform(x, y) {\n return x = project(x, y), [x[0] * k + dx, dy - x[1] * k];\n }\n\n projection.stream = function(stream) {\n return cache && cacheStream === stream ? cache : cache = transformRadians(transformRotate(rotate)(preclip(projectResample(postclip(cacheStream = stream)))));\n };\n\n projection.preclip = function(_) {\n return arguments.length ? (preclip = _, theta = undefined, reset()) : preclip;\n };\n\n projection.postclip = function(_) {\n return arguments.length ? (postclip = _, x0 = y0 = x1 = y1 = null, reset()) : postclip;\n };\n\n projection.clipAngle = function(_) {\n return arguments.length ? (preclip = +_ ? clipCircle(theta = _ * radians) : (theta = null, clipAntimeridian), reset()) : theta * degrees$1;\n };\n\n projection.clipExtent = function(_) {\n return arguments.length ? (postclip = _ == null ? (x0 = y0 = x1 = y1 = null, identity$4) : clipRectangle(x0 = +_[0][0], y0 = +_[0][1], x1 = +_[1][0], y1 = +_[1][1]), reset()) : x0 == null ? null : [[x0, y0], [x1, y1]];\n };\n\n projection.scale = function(_) {\n return arguments.length ? (k = +_, recenter()) : k;\n };\n\n projection.translate = function(_) {\n return arguments.length ? (x = +_[0], y = +_[1], recenter()) : [x, y];\n };\n\n projection.center = function(_) {\n return arguments.length ? (lambda = _[0] % 360 * radians, phi = _[1] % 360 * radians, recenter()) : [lambda * degrees$1, phi * degrees$1];\n };\n\n projection.rotate = function(_) {\n return arguments.length ? (deltaLambda = _[0] % 360 * radians, deltaPhi = _[1] % 360 * radians, deltaGamma = _.length > 2 ? _[2] % 360 * radians : 0, recenter()) : [deltaLambda * degrees$1, deltaPhi * degrees$1, deltaGamma * degrees$1];\n };\n\n projection.precision = function(_) {\n return arguments.length ? (projectResample = resample(projectTransform, delta2 = _ * _), reset()) : sqrt(delta2);\n };\n\n projection.fitExtent = function(extent, object) {\n return fitExtent(projection, extent, object);\n };\n\n projection.fitSize = function(size, object) {\n return fitSize(projection, size, object);\n };\n\n function recenter() {\n projectRotate = compose(rotate = rotateRadians(deltaLambda, deltaPhi, deltaGamma), project);\n var center = project(lambda, phi);\n dx = x - center[0] * k;\n dy = y + center[1] * k;\n return reset();\n }\n\n function reset() {\n cache = cacheStream = null;\n return projection;\n }\n\n return function() {\n project = projectAt.apply(this, arguments);\n projection.invert = project.invert && invert;\n return recenter();\n };\n}\n\nfunction conicProjection(projectAt) {\n var phi0 = 0,\n phi1 = pi$3 / 3,\n m = projectionMutator(projectAt),\n p = m(phi0, phi1);\n\n p.parallels = function(_) {\n return arguments.length ? m(phi0 = _[0] * radians, phi1 = _[1] * radians) : [phi0 * degrees$1, phi1 * degrees$1];\n };\n\n return p;\n}\n\nfunction cylindricalEqualAreaRaw(phi0) {\n var cosPhi0 = cos$1(phi0);\n\n function forward(lambda, phi) {\n return [lambda * cosPhi0, sin$1(phi) / cosPhi0];\n }\n\n forward.invert = function(x, y) {\n return [x / cosPhi0, asin(y * cosPhi0)];\n };\n\n return forward;\n}\n\nfunction conicEqualAreaRaw(y0, y1) {\n var sy0 = sin$1(y0), n = (sy0 + sin$1(y1)) / 2;\n\n // Are the parallels symmetrical around the Equator?\n if (abs(n) < epsilon$2) return cylindricalEqualAreaRaw(y0);\n\n var c = 1 + sy0 * (2 * n - sy0), r0 = sqrt(c) / n;\n\n function project(x, y) {\n var r = sqrt(c - 2 * n * sin$1(y)) / n;\n return [r * sin$1(x *= n), r0 - r * cos$1(x)];\n }\n\n project.invert = function(x, y) {\n var r0y = r0 - y;\n return [atan2(x, abs(r0y)) / n * sign(r0y), asin((c - (x * x + r0y * r0y) * n * n) / (2 * n))];\n };\n\n return project;\n}\n\nvar conicEqualArea = function() {\n return conicProjection(conicEqualAreaRaw)\n .scale(155.424)\n .center([0, 33.6442]);\n};\n\nvar albers = function() {\n return conicEqualArea()\n .parallels([29.5, 45.5])\n .scale(1070)\n .translate([480, 250])\n .rotate([96, 0])\n .center([-0.6, 38.7]);\n};\n\n// The projections must have mutually exclusive clip regions on the sphere,\n// as this will avoid emitting interleaving lines and polygons.\nfunction multiplex(streams) {\n var n = streams.length;\n return {\n point: function(x, y) { var i = -1; while (++i < n) streams[i].point(x, y); },\n sphere: function() { var i = -1; while (++i < n) streams[i].sphere(); },\n lineStart: function() { var i = -1; while (++i < n) streams[i].lineStart(); },\n lineEnd: function() { var i = -1; while (++i < n) streams[i].lineEnd(); },\n polygonStart: function() { var i = -1; while (++i < n) streams[i].polygonStart(); },\n polygonEnd: function() { var i = -1; while (++i < n) streams[i].polygonEnd(); }\n };\n}\n\n// A composite projection for the United States, configured by default for\n// 960×500. The projection also works quite well at 960×600 if you change the\n// scale to 1285 and adjust the translate accordingly. The set of standard\n// parallels for each region comes from USGS, which is published here:\n// http://egsc.usgs.gov/isb/pubs/MapProjections/projections.html#albers\nvar albersUsa = function() {\n var cache,\n cacheStream,\n lower48 = albers(), lower48Point,\n alaska = conicEqualArea().rotate([154, 0]).center([-2, 58.5]).parallels([55, 65]), alaskaPoint, // EPSG:3338\n hawaii = conicEqualArea().rotate([157, 0]).center([-3, 19.9]).parallels([8, 18]), hawaiiPoint, // ESRI:102007\n point, pointStream = {point: function(x, y) { point = [x, y]; }};\n\n function albersUsa(coordinates) {\n var x = coordinates[0], y = coordinates[1];\n return point = null,\n (lower48Point.point(x, y), point)\n || (alaskaPoint.point(x, y), point)\n || (hawaiiPoint.point(x, y), point);\n }\n\n albersUsa.invert = function(coordinates) {\n var k = lower48.scale(),\n t = lower48.translate(),\n x = (coordinates[0] - t[0]) / k,\n y = (coordinates[1] - t[1]) / k;\n return (y >= 0.120 && y < 0.234 && x >= -0.425 && x < -0.214 ? alaska\n : y >= 0.166 && y < 0.234 && x >= -0.214 && x < -0.115 ? hawaii\n : lower48).invert(coordinates);\n };\n\n albersUsa.stream = function(stream) {\n return cache && cacheStream === stream ? cache : cache = multiplex([lower48.stream(cacheStream = stream), alaska.stream(stream), hawaii.stream(stream)]);\n };\n\n albersUsa.precision = function(_) {\n if (!arguments.length) return lower48.precision();\n lower48.precision(_), alaska.precision(_), hawaii.precision(_);\n return reset();\n };\n\n albersUsa.scale = function(_) {\n if (!arguments.length) return lower48.scale();\n lower48.scale(_), alaska.scale(_ * 0.35), hawaii.scale(_);\n return albersUsa.translate(lower48.translate());\n };\n\n albersUsa.translate = function(_) {\n if (!arguments.length) return lower48.translate();\n var k = lower48.scale(), x = +_[0], y = +_[1];\n\n lower48Point = lower48\n .translate(_)\n .clipExtent([[x - 0.455 * k, y - 0.238 * k], [x + 0.455 * k, y + 0.238 * k]])\n .stream(pointStream);\n\n alaskaPoint = alaska\n .translate([x - 0.307 * k, y + 0.201 * k])\n .clipExtent([[x - 0.425 * k + epsilon$2, y + 0.120 * k + epsilon$2], [x - 0.214 * k - epsilon$2, y + 0.234 * k - epsilon$2]])\n .stream(pointStream);\n\n hawaiiPoint = hawaii\n .translate([x - 0.205 * k, y + 0.212 * k])\n .clipExtent([[x - 0.214 * k + epsilon$2, y + 0.166 * k + epsilon$2], [x - 0.115 * k - epsilon$2, y + 0.234 * k - epsilon$2]])\n .stream(pointStream);\n\n return reset();\n };\n\n albersUsa.fitExtent = function(extent, object) {\n return fitExtent(albersUsa, extent, object);\n };\n\n albersUsa.fitSize = function(size, object) {\n return fitSize(albersUsa, size, object);\n };\n\n function reset() {\n cache = cacheStream = null;\n return albersUsa;\n }\n\n return albersUsa.scale(1070);\n};\n\nfunction azimuthalRaw(scale) {\n return function(x, y) {\n var cx = cos$1(x),\n cy = cos$1(y),\n k = scale(cx * cy);\n return [\n k * cy * sin$1(x),\n k * sin$1(y)\n ];\n }\n}\n\nfunction azimuthalInvert(angle) {\n return function(x, y) {\n var z = sqrt(x * x + y * y),\n c = angle(z),\n sc = sin$1(c),\n cc = cos$1(c);\n return [\n atan2(x * sc, z * cc),\n asin(z && y * sc / z)\n ];\n }\n}\n\nvar azimuthalEqualAreaRaw = azimuthalRaw(function(cxcy) {\n return sqrt(2 / (1 + cxcy));\n});\n\nazimuthalEqualAreaRaw.invert = azimuthalInvert(function(z) {\n return 2 * asin(z / 2);\n});\n\nvar azimuthalEqualArea = function() {\n return projection(azimuthalEqualAreaRaw)\n .scale(124.75)\n .clipAngle(180 - 1e-3);\n};\n\nvar azimuthalEquidistantRaw = azimuthalRaw(function(c) {\n return (c = acos(c)) && c / sin$1(c);\n});\n\nazimuthalEquidistantRaw.invert = azimuthalInvert(function(z) {\n return z;\n});\n\nvar azimuthalEquidistant = function() {\n return projection(azimuthalEquidistantRaw)\n .scale(79.4188)\n .clipAngle(180 - 1e-3);\n};\n\nfunction mercatorRaw(lambda, phi) {\n return [lambda, log(tan((halfPi$2 + phi) / 2))];\n}\n\nmercatorRaw.invert = function(x, y) {\n return [x, 2 * atan(exp(y)) - halfPi$2];\n};\n\nvar mercator = function() {\n return mercatorProjection(mercatorRaw)\n .scale(961 / tau$3);\n};\n\nfunction mercatorProjection(project) {\n var m = projection(project),\n center = m.center,\n scale = m.scale,\n translate = m.translate,\n clipExtent = m.clipExtent,\n x0 = null, y0, x1, y1; // clip extent\n\n m.scale = function(_) {\n return arguments.length ? (scale(_), reclip()) : scale();\n };\n\n m.translate = function(_) {\n return arguments.length ? (translate(_), reclip()) : translate();\n };\n\n m.center = function(_) {\n return arguments.length ? (center(_), reclip()) : center();\n };\n\n m.clipExtent = function(_) {\n return arguments.length ? ((_ == null ? x0 = y0 = x1 = y1 = null : (x0 = +_[0][0], y0 = +_[0][1], x1 = +_[1][0], y1 = +_[1][1])), reclip()) : x0 == null ? null : [[x0, y0], [x1, y1]];\n };\n\n function reclip() {\n var k = pi$3 * scale(),\n t = m(rotation(m.rotate()).invert([0, 0]));\n return clipExtent(x0 == null\n ? [[t[0] - k, t[1] - k], [t[0] + k, t[1] + k]] : project === mercatorRaw\n ? [[Math.max(t[0] - k, x0), y0], [Math.min(t[0] + k, x1), y1]]\n : [[x0, Math.max(t[1] - k, y0)], [x1, Math.min(t[1] + k, y1)]]);\n }\n\n return reclip();\n}\n\nfunction tany(y) {\n return tan((halfPi$2 + y) / 2);\n}\n\nfunction conicConformalRaw(y0, y1) {\n var cy0 = cos$1(y0),\n n = y0 === y1 ? sin$1(y0) : log(cy0 / cos$1(y1)) / log(tany(y1) / tany(y0)),\n f = cy0 * pow(tany(y0), n) / n;\n\n if (!n) return mercatorRaw;\n\n function project(x, y) {\n if (f > 0) { if (y < -halfPi$2 + epsilon$2) y = -halfPi$2 + epsilon$2; }\n else { if (y > halfPi$2 - epsilon$2) y = halfPi$2 - epsilon$2; }\n var r = f / pow(tany(y), n);\n return [r * sin$1(n * x), f - r * cos$1(n * x)];\n }\n\n project.invert = function(x, y) {\n var fy = f - y, r = sign(n) * sqrt(x * x + fy * fy);\n return [atan2(x, abs(fy)) / n * sign(fy), 2 * atan(pow(f / r, 1 / n)) - halfPi$2];\n };\n\n return project;\n}\n\nvar conicConformal = function() {\n return conicProjection(conicConformalRaw)\n .scale(109.5)\n .parallels([30, 30]);\n};\n\nfunction equirectangularRaw(lambda, phi) {\n return [lambda, phi];\n}\n\nequirectangularRaw.invert = equirectangularRaw;\n\nvar equirectangular = function() {\n return projection(equirectangularRaw)\n .scale(152.63);\n};\n\nfunction conicEquidistantRaw(y0, y1) {\n var cy0 = cos$1(y0),\n n = y0 === y1 ? sin$1(y0) : (cy0 - cos$1(y1)) / (y1 - y0),\n g = cy0 / n + y0;\n\n if (abs(n) < epsilon$2) return equirectangularRaw;\n\n function project(x, y) {\n var gy = g - y, nx = n * x;\n return [gy * sin$1(nx), g - gy * cos$1(nx)];\n }\n\n project.invert = function(x, y) {\n var gy = g - y;\n return [atan2(x, abs(gy)) / n * sign(gy), g - sign(n) * sqrt(x * x + gy * gy)];\n };\n\n return project;\n}\n\nvar conicEquidistant = function() {\n return conicProjection(conicEquidistantRaw)\n .scale(131.154)\n .center([0, 13.9389]);\n};\n\nfunction gnomonicRaw(x, y) {\n var cy = cos$1(y), k = cos$1(x) * cy;\n return [cy * sin$1(x) / k, sin$1(y) / k];\n}\n\ngnomonicRaw.invert = azimuthalInvert(atan);\n\nvar gnomonic = function() {\n return projection(gnomonicRaw)\n .scale(144.049)\n .clipAngle(60);\n};\n\nfunction scaleTranslate(kx, ky, tx, ty) {\n return kx === 1 && ky === 1 && tx === 0 && ty === 0 ? identity$4 : transformer({\n point: function(x, y) {\n this.stream.point(x * kx + tx, y * ky + ty);\n }\n });\n}\n\nvar identity$5 = function() {\n var k = 1, tx = 0, ty = 0, sx = 1, sy = 1, transform$$1 = identity$4, // scale, translate and reflect\n x0 = null, y0, x1, y1, // clip extent\n postclip = identity$4,\n cache,\n cacheStream,\n projection;\n\n function reset() {\n cache = cacheStream = null;\n return projection;\n }\n\n return projection = {\n stream: function(stream) {\n return cache && cacheStream === stream ? cache : cache = transform$$1(postclip(cacheStream = stream));\n },\n postclip: function(_) {\n return arguments.length ? (postclip = _, x0 = y0 = x1 = y1 = null, reset()) : postclip;\n },\n clipExtent: function(_) {\n return arguments.length ? (postclip = _ == null ? (x0 = y0 = x1 = y1 = null, identity$4) : clipRectangle(x0 = +_[0][0], y0 = +_[0][1], x1 = +_[1][0], y1 = +_[1][1]), reset()) : x0 == null ? null : [[x0, y0], [x1, y1]];\n },\n scale: function(_) {\n return arguments.length ? (transform$$1 = scaleTranslate((k = +_) * sx, k * sy, tx, ty), reset()) : k;\n },\n translate: function(_) {\n return arguments.length ? (transform$$1 = scaleTranslate(k * sx, k * sy, tx = +_[0], ty = +_[1]), reset()) : [tx, ty];\n },\n reflectX: function(_) {\n return arguments.length ? (transform$$1 = scaleTranslate(k * (sx = _ ? -1 : 1), k * sy, tx, ty), reset()) : sx < 0;\n },\n reflectY: function(_) {\n return arguments.length ? (transform$$1 = scaleTranslate(k * sx, k * (sy = _ ? -1 : 1), tx, ty), reset()) : sy < 0;\n },\n fitExtent: function(extent, object) {\n return fitExtent(projection, extent, object);\n },\n fitSize: function(size, object) {\n return fitSize(projection, size, object);\n }\n };\n};\n\nfunction naturalEarth1Raw(lambda, phi) {\n var phi2 = phi * phi, phi4 = phi2 * phi2;\n return [\n lambda * (0.8707 - 0.131979 * phi2 + phi4 * (-0.013791 + phi4 * (0.003971 * phi2 - 0.001529 * phi4))),\n phi * (1.007226 + phi2 * (0.015085 + phi4 * (-0.044475 + 0.028874 * phi2 - 0.005916 * phi4)))\n ];\n}\n\nnaturalEarth1Raw.invert = function(x, y) {\n var phi = y, i = 25, delta;\n do {\n var phi2 = phi * phi, phi4 = phi2 * phi2;\n phi -= delta = (phi * (1.007226 + phi2 * (0.015085 + phi4 * (-0.044475 + 0.028874 * phi2 - 0.005916 * phi4))) - y) /\n (1.007226 + phi2 * (0.015085 * 3 + phi4 * (-0.044475 * 7 + 0.028874 * 9 * phi2 - 0.005916 * 11 * phi4)));\n } while (abs(delta) > epsilon$2 && --i > 0);\n return [\n x / (0.8707 + (phi2 = phi * phi) * (-0.131979 + phi2 * (-0.013791 + phi2 * phi2 * phi2 * (0.003971 - 0.001529 * phi2)))),\n phi\n ];\n};\n\nvar naturalEarth1 = function() {\n return projection(naturalEarth1Raw)\n .scale(175.295);\n};\n\nfunction orthographicRaw(x, y) {\n return [cos$1(y) * sin$1(x), sin$1(y)];\n}\n\northographicRaw.invert = azimuthalInvert(asin);\n\nvar orthographic = function() {\n return projection(orthographicRaw)\n .scale(249.5)\n .clipAngle(90 + epsilon$2);\n};\n\nfunction stereographicRaw(x, y) {\n var cy = cos$1(y), k = 1 + cos$1(x) * cy;\n return [cy * sin$1(x) / k, sin$1(y) / k];\n}\n\nstereographicRaw.invert = azimuthalInvert(function(z) {\n return 2 * atan(z);\n});\n\nvar stereographic = function() {\n return projection(stereographicRaw)\n .scale(250)\n .clipAngle(142);\n};\n\nfunction transverseMercatorRaw(lambda, phi) {\n return [log(tan((halfPi$2 + phi) / 2)), -lambda];\n}\n\ntransverseMercatorRaw.invert = function(x, y) {\n return [-y, 2 * atan(exp(x)) - halfPi$2];\n};\n\nvar transverseMercator = function() {\n var m = mercatorProjection(transverseMercatorRaw),\n center = m.center,\n rotate = m.rotate;\n\n m.center = function(_) {\n return arguments.length ? center([-_[1], _[0]]) : (_ = center(), [_[1], -_[0]]);\n };\n\n m.rotate = function(_) {\n return arguments.length ? rotate([_[0], _[1], _.length > 2 ? _[2] + 90 : 90]) : (_ = rotate(), [_[0], _[1], _[2] - 90]);\n };\n\n return rotate([0, 0, 90])\n .scale(159.155);\n};\n\nfunction defaultSeparation(a, b) {\n return a.parent === b.parent ? 1 : 2;\n}\n\nfunction meanX(children) {\n return children.reduce(meanXReduce, 0) / children.length;\n}\n\nfunction meanXReduce(x, c) {\n return x + c.x;\n}\n\nfunction maxY(children) {\n return 1 + children.reduce(maxYReduce, 0);\n}\n\nfunction maxYReduce(y, c) {\n return Math.max(y, c.y);\n}\n\nfunction leafLeft(node) {\n var children;\n while (children = node.children) node = children[0];\n return node;\n}\n\nfunction leafRight(node) {\n var children;\n while (children = node.children) node = children[children.length - 1];\n return node;\n}\n\nvar cluster = function() {\n var separation = defaultSeparation,\n dx = 1,\n dy = 1,\n nodeSize = false;\n\n function cluster(root) {\n var previousNode,\n x = 0;\n\n // First walk, computing the initial x & y values.\n root.eachAfter(function(node) {\n var children = node.children;\n if (children) {\n node.x = meanX(children);\n node.y = maxY(children);\n } else {\n node.x = previousNode ? x += separation(node, previousNode) : 0;\n node.y = 0;\n previousNode = node;\n }\n });\n\n var left = leafLeft(root),\n right = leafRight(root),\n x0 = left.x - separation(left, right) / 2,\n x1 = right.x + separation(right, left) / 2;\n\n // Second walk, normalizing x & y to the desired size.\n return root.eachAfter(nodeSize ? function(node) {\n node.x = (node.x - root.x) * dx;\n node.y = (root.y - node.y) * dy;\n } : function(node) {\n node.x = (node.x - x0) / (x1 - x0) * dx;\n node.y = (1 - (root.y ? node.y / root.y : 1)) * dy;\n });\n }\n\n cluster.separation = function(x) {\n return arguments.length ? (separation = x, cluster) : separation;\n };\n\n cluster.size = function(x) {\n return arguments.length ? (nodeSize = false, dx = +x[0], dy = +x[1], cluster) : (nodeSize ? null : [dx, dy]);\n };\n\n cluster.nodeSize = function(x) {\n return arguments.length ? (nodeSize = true, dx = +x[0], dy = +x[1], cluster) : (nodeSize ? [dx, dy] : null);\n };\n\n return cluster;\n};\n\nfunction count(node) {\n var sum = 0,\n children = node.children,\n i = children && children.length;\n if (!i) sum = 1;\n else while (--i >= 0) sum += children[i].value;\n node.value = sum;\n}\n\nvar node_count = function() {\n return this.eachAfter(count);\n};\n\nvar node_each = function(callback) {\n var node = this, current, next = [node], children, i, n;\n do {\n current = next.reverse(), next = [];\n while (node = current.pop()) {\n callback(node), children = node.children;\n if (children) for (i = 0, n = children.length; i < n; ++i) {\n next.push(children[i]);\n }\n }\n } while (next.length);\n return this;\n};\n\nvar node_eachBefore = function(callback) {\n var node = this, nodes = [node], children, i;\n while (node = nodes.pop()) {\n callback(node), children = node.children;\n if (children) for (i = children.length - 1; i >= 0; --i) {\n nodes.push(children[i]);\n }\n }\n return this;\n};\n\nvar node_eachAfter = function(callback) {\n var node = this, nodes = [node], next = [], children, i, n;\n while (node = nodes.pop()) {\n next.push(node), children = node.children;\n if (children) for (i = 0, n = children.length; i < n; ++i) {\n nodes.push(children[i]);\n }\n }\n while (node = next.pop()) {\n callback(node);\n }\n return this;\n};\n\nvar node_sum = function(value) {\n return this.eachAfter(function(node) {\n var sum = +value(node.data) || 0,\n children = node.children,\n i = children && children.length;\n while (--i >= 0) sum += children[i].value;\n node.value = sum;\n });\n};\n\nvar node_sort = function(compare) {\n return this.eachBefore(function(node) {\n if (node.children) {\n node.children.sort(compare);\n }\n });\n};\n\nvar node_path = function(end) {\n var start = this,\n ancestor = leastCommonAncestor(start, end),\n nodes = [start];\n while (start !== ancestor) {\n start = start.parent;\n nodes.push(start);\n }\n var k = nodes.length;\n while (end !== ancestor) {\n nodes.splice(k, 0, end);\n end = end.parent;\n }\n return nodes;\n};\n\nfunction leastCommonAncestor(a, b) {\n if (a === b) return a;\n var aNodes = a.ancestors(),\n bNodes = b.ancestors(),\n c = null;\n a = aNodes.pop();\n b = bNodes.pop();\n while (a === b) {\n c = a;\n a = aNodes.pop();\n b = bNodes.pop();\n }\n return c;\n}\n\nvar node_ancestors = function() {\n var node = this, nodes = [node];\n while (node = node.parent) {\n nodes.push(node);\n }\n return nodes;\n};\n\nvar node_descendants = function() {\n var nodes = [];\n this.each(function(node) {\n nodes.push(node);\n });\n return nodes;\n};\n\nvar node_leaves = function() {\n var leaves = [];\n this.eachBefore(function(node) {\n if (!node.children) {\n leaves.push(node);\n }\n });\n return leaves;\n};\n\nvar node_links = function() {\n var root = this, links = [];\n root.each(function(node) {\n if (node !== root) { // Don’t include the root’s parent, if any.\n links.push({source: node.parent, target: node});\n }\n });\n return links;\n};\n\nfunction hierarchy(data, children) {\n var root = new Node(data),\n valued = +data.value && (root.value = data.value),\n node,\n nodes = [root],\n child,\n childs,\n i,\n n;\n\n if (children == null) children = defaultChildren;\n\n while (node = nodes.pop()) {\n if (valued) node.value = +node.data.value;\n if ((childs = children(node.data)) && (n = childs.length)) {\n node.children = new Array(n);\n for (i = n - 1; i >= 0; --i) {\n nodes.push(child = node.children[i] = new Node(childs[i]));\n child.parent = node;\n child.depth = node.depth + 1;\n }\n }\n }\n\n return root.eachBefore(computeHeight);\n}\n\nfunction node_copy() {\n return hierarchy(this).eachBefore(copyData);\n}\n\nfunction defaultChildren(d) {\n return d.children;\n}\n\nfunction copyData(node) {\n node.data = node.data.data;\n}\n\nfunction computeHeight(node) {\n var height = 0;\n do node.height = height;\n while ((node = node.parent) && (node.height < ++height));\n}\n\nfunction Node(data) {\n this.data = data;\n this.depth =\n this.height = 0;\n this.parent = null;\n}\n\nNode.prototype = hierarchy.prototype = {\n constructor: Node,\n count: node_count,\n each: node_each,\n eachAfter: node_eachAfter,\n eachBefore: node_eachBefore,\n sum: node_sum,\n sort: node_sort,\n path: node_path,\n ancestors: node_ancestors,\n descendants: node_descendants,\n leaves: node_leaves,\n links: node_links,\n copy: node_copy\n};\n\nvar slice$3 = Array.prototype.slice;\n\nfunction shuffle$1(array) {\n var m = array.length,\n t,\n i;\n\n while (m) {\n i = Math.random() * m-- | 0;\n t = array[m];\n array[m] = array[i];\n array[i] = t;\n }\n\n return array;\n}\n\nvar enclose = function(circles) {\n var i = 0, n = (circles = shuffle$1(slice$3.call(circles))).length, B = [], p, e;\n\n while (i < n) {\n p = circles[i];\n if (e && enclosesWeak(e, p)) ++i;\n else e = encloseBasis(B = extendBasis(B, p)), i = 0;\n }\n\n return e;\n};\n\nfunction extendBasis(B, p) {\n var i, j;\n\n if (enclosesWeakAll(p, B)) return [p];\n\n // If we get here then B must have at least one element.\n for (i = 0; i < B.length; ++i) {\n if (enclosesNot(p, B[i])\n && enclosesWeakAll(encloseBasis2(B[i], p), B)) {\n return [B[i], p];\n }\n }\n\n // If we get here then B must have at least two elements.\n for (i = 0; i < B.length - 1; ++i) {\n for (j = i + 1; j < B.length; ++j) {\n if (enclosesNot(encloseBasis2(B[i], B[j]), p)\n && enclosesNot(encloseBasis2(B[i], p), B[j])\n && enclosesNot(encloseBasis2(B[j], p), B[i])\n && enclosesWeakAll(encloseBasis3(B[i], B[j], p), B)) {\n return [B[i], B[j], p];\n }\n }\n }\n\n // If we get here then something is very wrong.\n throw new Error;\n}\n\nfunction enclosesNot(a, b) {\n var dr = a.r - b.r, dx = b.x - a.x, dy = b.y - a.y;\n return dr < 0 || dr * dr < dx * dx + dy * dy;\n}\n\nfunction enclosesWeak(a, b) {\n var dr = a.r - b.r + 1e-6, dx = b.x - a.x, dy = b.y - a.y;\n return dr > 0 && dr * dr > dx * dx + dy * dy;\n}\n\nfunction enclosesWeakAll(a, B) {\n for (var i = 0; i < B.length; ++i) {\n if (!enclosesWeak(a, B[i])) {\n return false;\n }\n }\n return true;\n}\n\nfunction encloseBasis(B) {\n switch (B.length) {\n case 1: return encloseBasis1(B[0]);\n case 2: return encloseBasis2(B[0], B[1]);\n case 3: return encloseBasis3(B[0], B[1], B[2]);\n }\n}\n\nfunction encloseBasis1(a) {\n return {\n x: a.x,\n y: a.y,\n r: a.r\n };\n}\n\nfunction encloseBasis2(a, b) {\n var x1 = a.x, y1 = a.y, r1 = a.r,\n x2 = b.x, y2 = b.y, r2 = b.r,\n x21 = x2 - x1, y21 = y2 - y1, r21 = r2 - r1,\n l = Math.sqrt(x21 * x21 + y21 * y21);\n return {\n x: (x1 + x2 + x21 / l * r21) / 2,\n y: (y1 + y2 + y21 / l * r21) / 2,\n r: (l + r1 + r2) / 2\n };\n}\n\nfunction encloseBasis3(a, b, c) {\n var x1 = a.x, y1 = a.y, r1 = a.r,\n x2 = b.x, y2 = b.y, r2 = b.r,\n x3 = c.x, y3 = c.y, r3 = c.r,\n a2 = x1 - x2,\n a3 = x1 - x3,\n b2 = y1 - y2,\n b3 = y1 - y3,\n c2 = r2 - r1,\n c3 = r3 - r1,\n d1 = x1 * x1 + y1 * y1 - r1 * r1,\n d2 = d1 - x2 * x2 - y2 * y2 + r2 * r2,\n d3 = d1 - x3 * x3 - y3 * y3 + r3 * r3,\n ab = a3 * b2 - a2 * b3,\n xa = (b2 * d3 - b3 * d2) / (ab * 2) - x1,\n xb = (b3 * c2 - b2 * c3) / ab,\n ya = (a3 * d2 - a2 * d3) / (ab * 2) - y1,\n yb = (a2 * c3 - a3 * c2) / ab,\n A = xb * xb + yb * yb - 1,\n B = 2 * (r1 + xa * xb + ya * yb),\n C = xa * xa + ya * ya - r1 * r1,\n r = -(A ? (B + Math.sqrt(B * B - 4 * A * C)) / (2 * A) : C / B);\n return {\n x: x1 + xa + xb * r,\n y: y1 + ya + yb * r,\n r: r\n };\n}\n\nfunction place(a, b, c) {\n var ax = a.x,\n ay = a.y,\n da = b.r + c.r,\n db = a.r + c.r,\n dx = b.x - ax,\n dy = b.y - ay,\n dc = dx * dx + dy * dy;\n if (dc) {\n var x = 0.5 + ((db *= db) - (da *= da)) / (2 * dc),\n y = Math.sqrt(Math.max(0, 2 * da * (db + dc) - (db -= dc) * db - da * da)) / (2 * dc);\n c.x = ax + x * dx + y * dy;\n c.y = ay + x * dy - y * dx;\n } else {\n c.x = ax + db;\n c.y = ay;\n }\n}\n\nfunction intersects(a, b) {\n var dx = b.x - a.x,\n dy = b.y - a.y,\n dr = a.r + b.r;\n return dr * dr - 1e-6 > dx * dx + dy * dy;\n}\n\nfunction score(node) {\n var a = node._,\n b = node.next._,\n ab = a.r + b.r,\n dx = (a.x * b.r + b.x * a.r) / ab,\n dy = (a.y * b.r + b.y * a.r) / ab;\n return dx * dx + dy * dy;\n}\n\nfunction Node$1(circle) {\n this._ = circle;\n this.next = null;\n this.previous = null;\n}\n\nfunction packEnclose(circles) {\n if (!(n = circles.length)) return 0;\n\n var a, b, c, n, aa, ca, i, j, k, sj, sk;\n\n // Place the first circle.\n a = circles[0], a.x = 0, a.y = 0;\n if (!(n > 1)) return a.r;\n\n // Place the second circle.\n b = circles[1], a.x = -b.r, b.x = a.r, b.y = 0;\n if (!(n > 2)) return a.r + b.r;\n\n // Place the third circle.\n place(b, a, c = circles[2]);\n\n // Initialize the front-chain using the first three circles a, b and c.\n a = new Node$1(a), b = new Node$1(b), c = new Node$1(c);\n a.next = c.previous = b;\n b.next = a.previous = c;\n c.next = b.previous = a;\n\n // Attempt to place each remaining circle…\n pack: for (i = 3; i < n; ++i) {\n place(a._, b._, c = circles[i]), c = new Node$1(c);\n\n // Find the closest intersecting circle on the front-chain, if any.\n // “Closeness” is determined by linear distance along the front-chain.\n // “Ahead” or “behind” is likewise determined by linear distance.\n j = b.next, k = a.previous, sj = b._.r, sk = a._.r;\n do {\n if (sj <= sk) {\n if (intersects(j._, c._)) {\n b = j, a.next = b, b.previous = a, --i;\n continue pack;\n }\n sj += j._.r, j = j.next;\n } else {\n if (intersects(k._, c._)) {\n a = k, a.next = b, b.previous = a, --i;\n continue pack;\n }\n sk += k._.r, k = k.previous;\n }\n } while (j !== k.next);\n\n // Success! Insert the new circle c between a and b.\n c.previous = a, c.next = b, a.next = b.previous = b = c;\n\n // Compute the new closest circle pair to the centroid.\n aa = score(a);\n while ((c = c.next) !== b) {\n if ((ca = score(c)) < aa) {\n a = c, aa = ca;\n }\n }\n b = a.next;\n }\n\n // Compute the enclosing circle of the front chain.\n a = [b._], c = b; while ((c = c.next) !== b) a.push(c._); c = enclose(a);\n\n // Translate the circles to put the enclosing circle around the origin.\n for (i = 0; i < n; ++i) a = circles[i], a.x -= c.x, a.y -= c.y;\n\n return c.r;\n}\n\nvar siblings = function(circles) {\n packEnclose(circles);\n return circles;\n};\n\nfunction optional(f) {\n return f == null ? null : required(f);\n}\n\nfunction required(f) {\n if (typeof f !== \"function\") throw new Error;\n return f;\n}\n\nfunction constantZero() {\n return 0;\n}\n\nvar constant$8 = function(x) {\n return function() {\n return x;\n };\n};\n\nfunction defaultRadius$1(d) {\n return Math.sqrt(d.value);\n}\n\nvar index$2 = function() {\n var radius = null,\n dx = 1,\n dy = 1,\n padding = constantZero;\n\n function pack(root) {\n root.x = dx / 2, root.y = dy / 2;\n if (radius) {\n root.eachBefore(radiusLeaf(radius))\n .eachAfter(packChildren(padding, 0.5))\n .eachBefore(translateChild(1));\n } else {\n root.eachBefore(radiusLeaf(defaultRadius$1))\n .eachAfter(packChildren(constantZero, 1))\n .eachAfter(packChildren(padding, root.r / Math.min(dx, dy)))\n .eachBefore(translateChild(Math.min(dx, dy) / (2 * root.r)));\n }\n return root;\n }\n\n pack.radius = function(x) {\n return arguments.length ? (radius = optional(x), pack) : radius;\n };\n\n pack.size = function(x) {\n return arguments.length ? (dx = +x[0], dy = +x[1], pack) : [dx, dy];\n };\n\n pack.padding = function(x) {\n return arguments.length ? (padding = typeof x === \"function\" ? x : constant$8(+x), pack) : padding;\n };\n\n return pack;\n};\n\nfunction radiusLeaf(radius) {\n return function(node) {\n if (!node.children) {\n node.r = Math.max(0, +radius(node) || 0);\n }\n };\n}\n\nfunction packChildren(padding, k) {\n return function(node) {\n if (children = node.children) {\n var children,\n i,\n n = children.length,\n r = padding(node) * k || 0,\n e;\n\n if (r) for (i = 0; i < n; ++i) children[i].r += r;\n e = packEnclose(children);\n if (r) for (i = 0; i < n; ++i) children[i].r -= r;\n node.r = e + r;\n }\n };\n}\n\nfunction translateChild(k) {\n return function(node) {\n var parent = node.parent;\n node.r *= k;\n if (parent) {\n node.x = parent.x + k * node.x;\n node.y = parent.y + k * node.y;\n }\n };\n}\n\nvar roundNode = function(node) {\n node.x0 = Math.round(node.x0);\n node.y0 = Math.round(node.y0);\n node.x1 = Math.round(node.x1);\n node.y1 = Math.round(node.y1);\n};\n\nvar treemapDice = function(parent, x0, y0, x1, y1) {\n var nodes = parent.children,\n node,\n i = -1,\n n = nodes.length,\n k = parent.value && (x1 - x0) / parent.value;\n\n while (++i < n) {\n node = nodes[i], node.y0 = y0, node.y1 = y1;\n node.x0 = x0, node.x1 = x0 += node.value * k;\n }\n};\n\nvar partition = function() {\n var dx = 1,\n dy = 1,\n padding = 0,\n round = false;\n\n function partition(root) {\n var n = root.height + 1;\n root.x0 =\n root.y0 = padding;\n root.x1 = dx;\n root.y1 = dy / n;\n root.eachBefore(positionNode(dy, n));\n if (round) root.eachBefore(roundNode);\n return root;\n }\n\n function positionNode(dy, n) {\n return function(node) {\n if (node.children) {\n treemapDice(node, node.x0, dy * (node.depth + 1) / n, node.x1, dy * (node.depth + 2) / n);\n }\n var x0 = node.x0,\n y0 = node.y0,\n x1 = node.x1 - padding,\n y1 = node.y1 - padding;\n if (x1 < x0) x0 = x1 = (x0 + x1) / 2;\n if (y1 < y0) y0 = y1 = (y0 + y1) / 2;\n node.x0 = x0;\n node.y0 = y0;\n node.x1 = x1;\n node.y1 = y1;\n };\n }\n\n partition.round = function(x) {\n return arguments.length ? (round = !!x, partition) : round;\n };\n\n partition.size = function(x) {\n return arguments.length ? (dx = +x[0], dy = +x[1], partition) : [dx, dy];\n };\n\n partition.padding = function(x) {\n return arguments.length ? (padding = +x, partition) : padding;\n };\n\n return partition;\n};\n\nvar keyPrefix$1 = \"$\";\nvar preroot = {depth: -1};\nvar ambiguous = {};\n\nfunction defaultId(d) {\n return d.id;\n}\n\nfunction defaultParentId(d) {\n return d.parentId;\n}\n\nvar stratify = function() {\n var id = defaultId,\n parentId = defaultParentId;\n\n function stratify(data) {\n var d,\n i,\n n = data.length,\n root,\n parent,\n node,\n nodes = new Array(n),\n nodeId,\n nodeKey,\n nodeByKey = {};\n\n for (i = 0; i < n; ++i) {\n d = data[i], node = nodes[i] = new Node(d);\n if ((nodeId = id(d, i, data)) != null && (nodeId += \"\")) {\n nodeKey = keyPrefix$1 + (node.id = nodeId);\n nodeByKey[nodeKey] = nodeKey in nodeByKey ? ambiguous : node;\n }\n }\n\n for (i = 0; i < n; ++i) {\n node = nodes[i], nodeId = parentId(data[i], i, data);\n if (nodeId == null || !(nodeId += \"\")) {\n if (root) throw new Error(\"multiple roots\");\n root = node;\n } else {\n parent = nodeByKey[keyPrefix$1 + nodeId];\n if (!parent) throw new Error(\"missing: \" + nodeId);\n if (parent === ambiguous) throw new Error(\"ambiguous: \" + nodeId);\n if (parent.children) parent.children.push(node);\n else parent.children = [node];\n node.parent = parent;\n }\n }\n\n if (!root) throw new Error(\"no root\");\n root.parent = preroot;\n root.eachBefore(function(node) { node.depth = node.parent.depth + 1; --n; }).eachBefore(computeHeight);\n root.parent = null;\n if (n > 0) throw new Error(\"cycle\");\n\n return root;\n }\n\n stratify.id = function(x) {\n return arguments.length ? (id = required(x), stratify) : id;\n };\n\n stratify.parentId = function(x) {\n return arguments.length ? (parentId = required(x), stratify) : parentId;\n };\n\n return stratify;\n};\n\nfunction defaultSeparation$1(a, b) {\n return a.parent === b.parent ? 1 : 2;\n}\n\n// function radialSeparation(a, b) {\n// return (a.parent === b.parent ? 1 : 2) / a.depth;\n// }\n\n// This function is used to traverse the left contour of a subtree (or\n// subforest). It returns the successor of v on this contour. This successor is\n// either given by the leftmost child of v or by the thread of v. The function\n// returns null if and only if v is on the highest level of its subtree.\nfunction nextLeft(v) {\n var children = v.children;\n return children ? children[0] : v.t;\n}\n\n// This function works analogously to nextLeft.\nfunction nextRight(v) {\n var children = v.children;\n return children ? children[children.length - 1] : v.t;\n}\n\n// Shifts the current subtree rooted at w+. This is done by increasing\n// prelim(w+) and mod(w+) by shift.\nfunction moveSubtree(wm, wp, shift) {\n var change = shift / (wp.i - wm.i);\n wp.c -= change;\n wp.s += shift;\n wm.c += change;\n wp.z += shift;\n wp.m += shift;\n}\n\n// All other shifts, applied to the smaller subtrees between w- and w+, are\n// performed by this function. To prepare the shifts, we have to adjust\n// change(w+), shift(w+), and change(w-).\nfunction executeShifts(v) {\n var shift = 0,\n change = 0,\n children = v.children,\n i = children.length,\n w;\n while (--i >= 0) {\n w = children[i];\n w.z += shift;\n w.m += shift;\n shift += w.s + (change += w.c);\n }\n}\n\n// If vi-’s ancestor is a sibling of v, returns vi-’s ancestor. Otherwise,\n// returns the specified (default) ancestor.\nfunction nextAncestor(vim, v, ancestor) {\n return vim.a.parent === v.parent ? vim.a : ancestor;\n}\n\nfunction TreeNode(node, i) {\n this._ = node;\n this.parent = null;\n this.children = null;\n this.A = null; // default ancestor\n this.a = this; // ancestor\n this.z = 0; // prelim\n this.m = 0; // mod\n this.c = 0; // change\n this.s = 0; // shift\n this.t = null; // thread\n this.i = i; // number\n}\n\nTreeNode.prototype = Object.create(Node.prototype);\n\nfunction treeRoot(root) {\n var tree = new TreeNode(root, 0),\n node,\n nodes = [tree],\n child,\n children,\n i,\n n;\n\n while (node = nodes.pop()) {\n if (children = node._.children) {\n node.children = new Array(n = children.length);\n for (i = n - 1; i >= 0; --i) {\n nodes.push(child = node.children[i] = new TreeNode(children[i], i));\n child.parent = node;\n }\n }\n }\n\n (tree.parent = new TreeNode(null, 0)).children = [tree];\n return tree;\n}\n\n// Node-link tree diagram using the Reingold-Tilford \"tidy\" algorithm\nvar tree = function() {\n var separation = defaultSeparation$1,\n dx = 1,\n dy = 1,\n nodeSize = null;\n\n function tree(root) {\n var t = treeRoot(root);\n\n // Compute the layout using Buchheim et al.’s algorithm.\n t.eachAfter(firstWalk), t.parent.m = -t.z;\n t.eachBefore(secondWalk);\n\n // If a fixed node size is specified, scale x and y.\n if (nodeSize) root.eachBefore(sizeNode);\n\n // If a fixed tree size is specified, scale x and y based on the extent.\n // Compute the left-most, right-most, and depth-most nodes for extents.\n else {\n var left = root,\n right = root,\n bottom = root;\n root.eachBefore(function(node) {\n if (node.x < left.x) left = node;\n if (node.x > right.x) right = node;\n if (node.depth > bottom.depth) bottom = node;\n });\n var s = left === right ? 1 : separation(left, right) / 2,\n tx = s - left.x,\n kx = dx / (right.x + s + tx),\n ky = dy / (bottom.depth || 1);\n root.eachBefore(function(node) {\n node.x = (node.x + tx) * kx;\n node.y = node.depth * ky;\n });\n }\n\n return root;\n }\n\n // Computes a preliminary x-coordinate for v. Before that, FIRST WALK is\n // applied recursively to the children of v, as well as the function\n // APPORTION. After spacing out the children by calling EXECUTE SHIFTS, the\n // node v is placed to the midpoint of its outermost children.\n function firstWalk(v) {\n var children = v.children,\n siblings = v.parent.children,\n w = v.i ? siblings[v.i - 1] : null;\n if (children) {\n executeShifts(v);\n var midpoint = (children[0].z + children[children.length - 1].z) / 2;\n if (w) {\n v.z = w.z + separation(v._, w._);\n v.m = v.z - midpoint;\n } else {\n v.z = midpoint;\n }\n } else if (w) {\n v.z = w.z + separation(v._, w._);\n }\n v.parent.A = apportion(v, w, v.parent.A || siblings[0]);\n }\n\n // Computes all real x-coordinates by summing up the modifiers recursively.\n function secondWalk(v) {\n v._.x = v.z + v.parent.m;\n v.m += v.parent.m;\n }\n\n // The core of the algorithm. Here, a new subtree is combined with the\n // previous subtrees. Threads are used to traverse the inside and outside\n // contours of the left and right subtree up to the highest common level. The\n // vertices used for the traversals are vi+, vi-, vo-, and vo+, where the\n // superscript o means outside and i means inside, the subscript - means left\n // subtree and + means right subtree. For summing up the modifiers along the\n // contour, we use respective variables si+, si-, so-, and so+. Whenever two\n // nodes of the inside contours conflict, we compute the left one of the\n // greatest uncommon ancestors using the function ANCESTOR and call MOVE\n // SUBTREE to shift the subtree and prepare the shifts of smaller subtrees.\n // Finally, we add a new thread (if necessary).\n function apportion(v, w, ancestor) {\n if (w) {\n var vip = v,\n vop = v,\n vim = w,\n vom = vip.parent.children[0],\n sip = vip.m,\n sop = vop.m,\n sim = vim.m,\n som = vom.m,\n shift;\n while (vim = nextRight(vim), vip = nextLeft(vip), vim && vip) {\n vom = nextLeft(vom);\n vop = nextRight(vop);\n vop.a = v;\n shift = vim.z + sim - vip.z - sip + separation(vim._, vip._);\n if (shift > 0) {\n moveSubtree(nextAncestor(vim, v, ancestor), v, shift);\n sip += shift;\n sop += shift;\n }\n sim += vim.m;\n sip += vip.m;\n som += vom.m;\n sop += vop.m;\n }\n if (vim && !nextRight(vop)) {\n vop.t = vim;\n vop.m += sim - sop;\n }\n if (vip && !nextLeft(vom)) {\n vom.t = vip;\n vom.m += sip - som;\n ancestor = v;\n }\n }\n return ancestor;\n }\n\n function sizeNode(node) {\n node.x *= dx;\n node.y = node.depth * dy;\n }\n\n tree.separation = function(x) {\n return arguments.length ? (separation = x, tree) : separation;\n };\n\n tree.size = function(x) {\n return arguments.length ? (nodeSize = false, dx = +x[0], dy = +x[1], tree) : (nodeSize ? null : [dx, dy]);\n };\n\n tree.nodeSize = function(x) {\n return arguments.length ? (nodeSize = true, dx = +x[0], dy = +x[1], tree) : (nodeSize ? [dx, dy] : null);\n };\n\n return tree;\n};\n\nvar treemapSlice = function(parent, x0, y0, x1, y1) {\n var nodes = parent.children,\n node,\n i = -1,\n n = nodes.length,\n k = parent.value && (y1 - y0) / parent.value;\n\n while (++i < n) {\n node = nodes[i], node.x0 = x0, node.x1 = x1;\n node.y0 = y0, node.y1 = y0 += node.value * k;\n }\n};\n\nvar phi = (1 + Math.sqrt(5)) / 2;\n\nfunction squarifyRatio(ratio, parent, x0, y0, x1, y1) {\n var rows = [],\n nodes = parent.children,\n row,\n nodeValue,\n i0 = 0,\n i1 = 0,\n n = nodes.length,\n dx, dy,\n value = parent.value,\n sumValue,\n minValue,\n maxValue,\n newRatio,\n minRatio,\n alpha,\n beta;\n\n while (i0 < n) {\n dx = x1 - x0, dy = y1 - y0;\n\n // Find the next non-empty node.\n do sumValue = nodes[i1++].value; while (!sumValue && i1 < n);\n minValue = maxValue = sumValue;\n alpha = Math.max(dy / dx, dx / dy) / (value * ratio);\n beta = sumValue * sumValue * alpha;\n minRatio = Math.max(maxValue / beta, beta / minValue);\n\n // Keep adding nodes while the aspect ratio maintains or improves.\n for (; i1 < n; ++i1) {\n sumValue += nodeValue = nodes[i1].value;\n if (nodeValue < minValue) minValue = nodeValue;\n if (nodeValue > maxValue) maxValue = nodeValue;\n beta = sumValue * sumValue * alpha;\n newRatio = Math.max(maxValue / beta, beta / minValue);\n if (newRatio > minRatio) { sumValue -= nodeValue; break; }\n minRatio = newRatio;\n }\n\n // Position and record the row orientation.\n rows.push(row = {value: sumValue, dice: dx < dy, children: nodes.slice(i0, i1)});\n if (row.dice) treemapDice(row, x0, y0, x1, value ? y0 += dy * sumValue / value : y1);\n else treemapSlice(row, x0, y0, value ? x0 += dx * sumValue / value : x1, y1);\n value -= sumValue, i0 = i1;\n }\n\n return rows;\n}\n\nvar squarify = (function custom(ratio) {\n\n function squarify(parent, x0, y0, x1, y1) {\n squarifyRatio(ratio, parent, x0, y0, x1, y1);\n }\n\n squarify.ratio = function(x) {\n return custom((x = +x) > 1 ? x : 1);\n };\n\n return squarify;\n})(phi);\n\nvar index$3 = function() {\n var tile = squarify,\n round = false,\n dx = 1,\n dy = 1,\n paddingStack = [0],\n paddingInner = constantZero,\n paddingTop = constantZero,\n paddingRight = constantZero,\n paddingBottom = constantZero,\n paddingLeft = constantZero;\n\n function treemap(root) {\n root.x0 =\n root.y0 = 0;\n root.x1 = dx;\n root.y1 = dy;\n root.eachBefore(positionNode);\n paddingStack = [0];\n if (round) root.eachBefore(roundNode);\n return root;\n }\n\n function positionNode(node) {\n var p = paddingStack[node.depth],\n x0 = node.x0 + p,\n y0 = node.y0 + p,\n x1 = node.x1 - p,\n y1 = node.y1 - p;\n if (x1 < x0) x0 = x1 = (x0 + x1) / 2;\n if (y1 < y0) y0 = y1 = (y0 + y1) / 2;\n node.x0 = x0;\n node.y0 = y0;\n node.x1 = x1;\n node.y1 = y1;\n if (node.children) {\n p = paddingStack[node.depth + 1] = paddingInner(node) / 2;\n x0 += paddingLeft(node) - p;\n y0 += paddingTop(node) - p;\n x1 -= paddingRight(node) - p;\n y1 -= paddingBottom(node) - p;\n if (x1 < x0) x0 = x1 = (x0 + x1) / 2;\n if (y1 < y0) y0 = y1 = (y0 + y1) / 2;\n tile(node, x0, y0, x1, y1);\n }\n }\n\n treemap.round = function(x) {\n return arguments.length ? (round = !!x, treemap) : round;\n };\n\n treemap.size = function(x) {\n return arguments.length ? (dx = +x[0], dy = +x[1], treemap) : [dx, dy];\n };\n\n treemap.tile = function(x) {\n return arguments.length ? (tile = required(x), treemap) : tile;\n };\n\n treemap.padding = function(x) {\n return arguments.length ? treemap.paddingInner(x).paddingOuter(x) : treemap.paddingInner();\n };\n\n treemap.paddingInner = function(x) {\n return arguments.length ? (paddingInner = typeof x === \"function\" ? x : constant$8(+x), treemap) : paddingInner;\n };\n\n treemap.paddingOuter = function(x) {\n return arguments.length ? treemap.paddingTop(x).paddingRight(x).paddingBottom(x).paddingLeft(x) : treemap.paddingTop();\n };\n\n treemap.paddingTop = function(x) {\n return arguments.length ? (paddingTop = typeof x === \"function\" ? x : constant$8(+x), treemap) : paddingTop;\n };\n\n treemap.paddingRight = function(x) {\n return arguments.length ? (paddingRight = typeof x === \"function\" ? x : constant$8(+x), treemap) : paddingRight;\n };\n\n treemap.paddingBottom = function(x) {\n return arguments.length ? (paddingBottom = typeof x === \"function\" ? x : constant$8(+x), treemap) : paddingBottom;\n };\n\n treemap.paddingLeft = function(x) {\n return arguments.length ? (paddingLeft = typeof x === \"function\" ? x : constant$8(+x), treemap) : paddingLeft;\n };\n\n return treemap;\n};\n\nvar binary = function(parent, x0, y0, x1, y1) {\n var nodes = parent.children,\n i, n = nodes.length,\n sum, sums = new Array(n + 1);\n\n for (sums[0] = sum = i = 0; i < n; ++i) {\n sums[i + 1] = sum += nodes[i].value;\n }\n\n partition(0, n, parent.value, x0, y0, x1, y1);\n\n function partition(i, j, value, x0, y0, x1, y1) {\n if (i >= j - 1) {\n var node = nodes[i];\n node.x0 = x0, node.y0 = y0;\n node.x1 = x1, node.y1 = y1;\n return;\n }\n\n var valueOffset = sums[i],\n valueTarget = (value / 2) + valueOffset,\n k = i + 1,\n hi = j - 1;\n\n while (k < hi) {\n var mid = k + hi >>> 1;\n if (sums[mid] < valueTarget) k = mid + 1;\n else hi = mid;\n }\n\n if ((valueTarget - sums[k - 1]) < (sums[k] - valueTarget) && i + 1 < k) --k;\n\n var valueLeft = sums[k] - valueOffset,\n valueRight = value - valueLeft;\n\n if ((x1 - x0) > (y1 - y0)) {\n var xk = (x0 * valueRight + x1 * valueLeft) / value;\n partition(i, k, valueLeft, x0, y0, xk, y1);\n partition(k, j, valueRight, xk, y0, x1, y1);\n } else {\n var yk = (y0 * valueRight + y1 * valueLeft) / value;\n partition(i, k, valueLeft, x0, y0, x1, yk);\n partition(k, j, valueRight, x0, yk, x1, y1);\n }\n }\n};\n\nvar sliceDice = function(parent, x0, y0, x1, y1) {\n (parent.depth & 1 ? treemapSlice : treemapDice)(parent, x0, y0, x1, y1);\n};\n\nvar resquarify = (function custom(ratio) {\n\n function resquarify(parent, x0, y0, x1, y1) {\n if ((rows = parent._squarify) && (rows.ratio === ratio)) {\n var rows,\n row,\n nodes,\n i,\n j = -1,\n n,\n m = rows.length,\n value = parent.value;\n\n while (++j < m) {\n row = rows[j], nodes = row.children;\n for (i = row.value = 0, n = nodes.length; i < n; ++i) row.value += nodes[i].value;\n if (row.dice) treemapDice(row, x0, y0, x1, y0 += (y1 - y0) * row.value / value);\n else treemapSlice(row, x0, y0, x0 += (x1 - x0) * row.value / value, y1);\n value -= row.value;\n }\n } else {\n parent._squarify = rows = squarifyRatio(ratio, parent, x0, y0, x1, y1);\n rows.ratio = ratio;\n }\n }\n\n resquarify.ratio = function(x) {\n return custom((x = +x) > 1 ? x : 1);\n };\n\n return resquarify;\n})(phi);\n\nvar area$1 = function(polygon) {\n var i = -1,\n n = polygon.length,\n a,\n b = polygon[n - 1],\n area = 0;\n\n while (++i < n) {\n a = b;\n b = polygon[i];\n area += a[1] * b[0] - a[0] * b[1];\n }\n\n return area / 2;\n};\n\nvar centroid$1 = function(polygon) {\n var i = -1,\n n = polygon.length,\n x = 0,\n y = 0,\n a,\n b = polygon[n - 1],\n c,\n k = 0;\n\n while (++i < n) {\n a = b;\n b = polygon[i];\n k += c = a[0] * b[1] - b[0] * a[1];\n x += (a[0] + b[0]) * c;\n y += (a[1] + b[1]) * c;\n }\n\n return k *= 3, [x / k, y / k];\n};\n\n// Returns the 2D cross product of AB and AC vectors, i.e., the z-component of\n// the 3D cross product in a quadrant I Cartesian coordinate system (+x is\n// right, +y is up). Returns a positive value if ABC is counter-clockwise,\n// negative if clockwise, and zero if the points are collinear.\nvar cross$1 = function(a, b, c) {\n return (b[0] - a[0]) * (c[1] - a[1]) - (b[1] - a[1]) * (c[0] - a[0]);\n};\n\nfunction lexicographicOrder(a, b) {\n return a[0] - b[0] || a[1] - b[1];\n}\n\n// Computes the upper convex hull per the monotone chain algorithm.\n// Assumes points.length >= 3, is sorted by x, unique in y.\n// Returns an array of indices into points in left-to-right order.\nfunction computeUpperHullIndexes(points) {\n var n = points.length,\n indexes = [0, 1],\n size = 2;\n\n for (var i = 2; i < n; ++i) {\n while (size > 1 && cross$1(points[indexes[size - 2]], points[indexes[size - 1]], points[i]) <= 0) --size;\n indexes[size++] = i;\n }\n\n return indexes.slice(0, size); // remove popped points\n}\n\nvar hull = function(points) {\n if ((n = points.length) < 3) return null;\n\n var i,\n n,\n sortedPoints = new Array(n),\n flippedPoints = new Array(n);\n\n for (i = 0; i < n; ++i) sortedPoints[i] = [+points[i][0], +points[i][1], i];\n sortedPoints.sort(lexicographicOrder);\n for (i = 0; i < n; ++i) flippedPoints[i] = [sortedPoints[i][0], -sortedPoints[i][1]];\n\n var upperIndexes = computeUpperHullIndexes(sortedPoints),\n lowerIndexes = computeUpperHullIndexes(flippedPoints);\n\n // Construct the hull polygon, removing possible duplicate endpoints.\n var skipLeft = lowerIndexes[0] === upperIndexes[0],\n skipRight = lowerIndexes[lowerIndexes.length - 1] === upperIndexes[upperIndexes.length - 1],\n hull = [];\n\n // Add upper hull in right-to-l order.\n // Then add lower hull in left-to-right order.\n for (i = upperIndexes.length - 1; i >= 0; --i) hull.push(points[sortedPoints[upperIndexes[i]][2]]);\n for (i = +skipLeft; i < lowerIndexes.length - skipRight; ++i) hull.push(points[sortedPoints[lowerIndexes[i]][2]]);\n\n return hull;\n};\n\nvar contains$1 = function(polygon, point) {\n var n = polygon.length,\n p = polygon[n - 1],\n x = point[0], y = point[1],\n x0 = p[0], y0 = p[1],\n x1, y1,\n inside = false;\n\n for (var i = 0; i < n; ++i) {\n p = polygon[i], x1 = p[0], y1 = p[1];\n if (((y1 > y) !== (y0 > y)) && (x < (x0 - x1) * (y - y1) / (y0 - y1) + x1)) inside = !inside;\n x0 = x1, y0 = y1;\n }\n\n return inside;\n};\n\nvar length$2 = function(polygon) {\n var i = -1,\n n = polygon.length,\n b = polygon[n - 1],\n xa,\n ya,\n xb = b[0],\n yb = b[1],\n perimeter = 0;\n\n while (++i < n) {\n xa = xb;\n ya = yb;\n b = polygon[i];\n xb = b[0];\n yb = b[1];\n xa -= xb;\n ya -= yb;\n perimeter += Math.sqrt(xa * xa + ya * ya);\n }\n\n return perimeter;\n};\n\nvar slice$4 = [].slice;\n\nvar noabort = {};\n\nfunction Queue(size) {\n this._size = size;\n this._call =\n this._error = null;\n this._tasks = [];\n this._data = [];\n this._waiting =\n this._active =\n this._ended =\n this._start = 0; // inside a synchronous task callback?\n}\n\nQueue.prototype = queue.prototype = {\n constructor: Queue,\n defer: function(callback) {\n if (typeof callback !== \"function\") throw new Error(\"invalid callback\");\n if (this._call) throw new Error(\"defer after await\");\n if (this._error != null) return this;\n var t = slice$4.call(arguments, 1);\n t.push(callback);\n ++this._waiting, this._tasks.push(t);\n poke$1(this);\n return this;\n },\n abort: function() {\n if (this._error == null) abort(this, new Error(\"abort\"));\n return this;\n },\n await: function(callback) {\n if (typeof callback !== \"function\") throw new Error(\"invalid callback\");\n if (this._call) throw new Error(\"multiple await\");\n this._call = function(error, results) { callback.apply(null, [error].concat(results)); };\n maybeNotify(this);\n return this;\n },\n awaitAll: function(callback) {\n if (typeof callback !== \"function\") throw new Error(\"invalid callback\");\n if (this._call) throw new Error(\"multiple await\");\n this._call = callback;\n maybeNotify(this);\n return this;\n }\n};\n\nfunction poke$1(q) {\n if (!q._start) {\n try { start$1(q); } // let the current task complete\n catch (e) {\n if (q._tasks[q._ended + q._active - 1]) abort(q, e); // task errored synchronously\n else if (!q._data) throw e; // await callback errored synchronously\n }\n }\n}\n\nfunction start$1(q) {\n while (q._start = q._waiting && q._active < q._size) {\n var i = q._ended + q._active,\n t = q._tasks[i],\n j = t.length - 1,\n c = t[j];\n t[j] = end(q, i);\n --q._waiting, ++q._active;\n t = c.apply(null, t);\n if (!q._tasks[i]) continue; // task finished synchronously\n q._tasks[i] = t || noabort;\n }\n}\n\nfunction end(q, i) {\n return function(e, r) {\n if (!q._tasks[i]) return; // ignore multiple callbacks\n --q._active, ++q._ended;\n q._tasks[i] = null;\n if (q._error != null) return; // ignore secondary errors\n if (e != null) {\n abort(q, e);\n } else {\n q._data[i] = r;\n if (q._waiting) poke$1(q);\n else maybeNotify(q);\n }\n };\n}\n\nfunction abort(q, e) {\n var i = q._tasks.length, t;\n q._error = e; // ignore active callbacks\n q._data = undefined; // allow gc\n q._waiting = NaN; // prevent starting\n\n while (--i >= 0) {\n if (t = q._tasks[i]) {\n q._tasks[i] = null;\n if (t.abort) {\n try { t.abort(); }\n catch (e) { /* ignore */ }\n }\n }\n }\n\n q._active = NaN; // allow notification\n maybeNotify(q);\n}\n\nfunction maybeNotify(q) {\n if (!q._active && q._call) {\n var d = q._data;\n q._data = undefined; // allow gc\n q._call(q._error, d);\n }\n}\n\nfunction queue(concurrency) {\n if (concurrency == null) concurrency = Infinity;\n else if (!((concurrency = +concurrency) >= 1)) throw new Error(\"invalid concurrency\");\n return new Queue(concurrency);\n}\n\nvar defaultSource$1 = function() {\n return Math.random();\n};\n\nvar uniform = (function sourceRandomUniform(source) {\n function randomUniform(min, max) {\n min = min == null ? 0 : +min;\n max = max == null ? 1 : +max;\n if (arguments.length === 1) max = min, min = 0;\n else max -= min;\n return function() {\n return source() * max + min;\n };\n }\n\n randomUniform.source = sourceRandomUniform;\n\n return randomUniform;\n})(defaultSource$1);\n\nvar normal = (function sourceRandomNormal(source) {\n function randomNormal(mu, sigma) {\n var x, r;\n mu = mu == null ? 0 : +mu;\n sigma = sigma == null ? 1 : +sigma;\n return function() {\n var y;\n\n // If available, use the second previously-generated uniform random.\n if (x != null) y = x, x = null;\n\n // Otherwise, generate a new x and y.\n else do {\n x = source() * 2 - 1;\n y = source() * 2 - 1;\n r = x * x + y * y;\n } while (!r || r > 1);\n\n return mu + sigma * y * Math.sqrt(-2 * Math.log(r) / r);\n };\n }\n\n randomNormal.source = sourceRandomNormal;\n\n return randomNormal;\n})(defaultSource$1);\n\nvar logNormal = (function sourceRandomLogNormal(source) {\n function randomLogNormal() {\n var randomNormal = normal.source(source).apply(this, arguments);\n return function() {\n return Math.exp(randomNormal());\n };\n }\n\n randomLogNormal.source = sourceRandomLogNormal;\n\n return randomLogNormal;\n})(defaultSource$1);\n\nvar irwinHall = (function sourceRandomIrwinHall(source) {\n function randomIrwinHall(n) {\n return function() {\n for (var sum = 0, i = 0; i < n; ++i) sum += source();\n return sum;\n };\n }\n\n randomIrwinHall.source = sourceRandomIrwinHall;\n\n return randomIrwinHall;\n})(defaultSource$1);\n\nvar bates = (function sourceRandomBates(source) {\n function randomBates(n) {\n var randomIrwinHall = irwinHall.source(source)(n);\n return function() {\n return randomIrwinHall() / n;\n };\n }\n\n randomBates.source = sourceRandomBates;\n\n return randomBates;\n})(defaultSource$1);\n\nvar exponential$1 = (function sourceRandomExponential(source) {\n function randomExponential(lambda) {\n return function() {\n return -Math.log(1 - source()) / lambda;\n };\n }\n\n randomExponential.source = sourceRandomExponential;\n\n return randomExponential;\n})(defaultSource$1);\n\nvar request = function(url, callback) {\n var request,\n event = dispatch(\"beforesend\", \"progress\", \"load\", \"error\"),\n mimeType,\n headers = map$1(),\n xhr = new XMLHttpRequest,\n user = null,\n password = null,\n response,\n responseType,\n timeout = 0;\n\n // If IE does not support CORS, use XDomainRequest.\n if (typeof XDomainRequest !== \"undefined\"\n && !(\"withCredentials\" in xhr)\n && /^(http(s)?:)?\\/\\//.test(url)) xhr = new XDomainRequest;\n\n \"onload\" in xhr\n ? xhr.onload = xhr.onerror = xhr.ontimeout = respond\n : xhr.onreadystatechange = function(o) { xhr.readyState > 3 && respond(o); };\n\n function respond(o) {\n var status = xhr.status, result;\n if (!status && hasResponse(xhr)\n || status >= 200 && status < 300\n || status === 304) {\n if (response) {\n try {\n result = response.call(request, xhr);\n } catch (e) {\n event.call(\"error\", request, e);\n return;\n }\n } else {\n result = xhr;\n }\n event.call(\"load\", request, result);\n } else {\n event.call(\"error\", request, o);\n }\n }\n\n xhr.onprogress = function(e) {\n event.call(\"progress\", request, e);\n };\n\n request = {\n header: function(name, value) {\n name = (name + \"\").toLowerCase();\n if (arguments.length < 2) return headers.get(name);\n if (value == null) headers.remove(name);\n else headers.set(name, value + \"\");\n return request;\n },\n\n // If mimeType is non-null and no Accept header is set, a default is used.\n mimeType: function(value) {\n if (!arguments.length) return mimeType;\n mimeType = value == null ? null : value + \"\";\n return request;\n },\n\n // Specifies what type the response value should take;\n // for instance, arraybuffer, blob, document, or text.\n responseType: function(value) {\n if (!arguments.length) return responseType;\n responseType = value;\n return request;\n },\n\n timeout: function(value) {\n if (!arguments.length) return timeout;\n timeout = +value;\n return request;\n },\n\n user: function(value) {\n return arguments.length < 1 ? user : (user = value == null ? null : value + \"\", request);\n },\n\n password: function(value) {\n return arguments.length < 1 ? password : (password = value == null ? null : value + \"\", request);\n },\n\n // Specify how to convert the response content to a specific type;\n // changes the callback value on \"load\" events.\n response: function(value) {\n response = value;\n return request;\n },\n\n // Alias for send(\"GET\", …).\n get: function(data, callback) {\n return request.send(\"GET\", data, callback);\n },\n\n // Alias for send(\"POST\", …).\n post: function(data, callback) {\n return request.send(\"POST\", data, callback);\n },\n\n // If callback is non-null, it will be used for error and load events.\n send: function(method, data, callback) {\n xhr.open(method, url, true, user, password);\n if (mimeType != null && !headers.has(\"accept\")) headers.set(\"accept\", mimeType + \",*/*\");\n if (xhr.setRequestHeader) headers.each(function(value, name) { xhr.setRequestHeader(name, value); });\n if (mimeType != null && xhr.overrideMimeType) xhr.overrideMimeType(mimeType);\n if (responseType != null) xhr.responseType = responseType;\n if (timeout > 0) xhr.timeout = timeout;\n if (callback == null && typeof data === \"function\") callback = data, data = null;\n if (callback != null && callback.length === 1) callback = fixCallback(callback);\n if (callback != null) request.on(\"error\", callback).on(\"load\", function(xhr) { callback(null, xhr); });\n event.call(\"beforesend\", request, xhr);\n xhr.send(data == null ? null : data);\n return request;\n },\n\n abort: function() {\n xhr.abort();\n return request;\n },\n\n on: function() {\n var value = event.on.apply(event, arguments);\n return value === event ? request : value;\n }\n };\n\n if (callback != null) {\n if (typeof callback !== \"function\") throw new Error(\"invalid callback: \" + callback);\n return request.get(callback);\n }\n\n return request;\n};\n\nfunction fixCallback(callback) {\n return function(error, xhr) {\n callback(error == null ? xhr : null);\n };\n}\n\nfunction hasResponse(xhr) {\n var type = xhr.responseType;\n return type && type !== \"text\"\n ? xhr.response // null on error\n : xhr.responseText; // \"\" on error\n}\n\nvar type$1 = function(defaultMimeType, response) {\n return function(url, callback) {\n var r = request(url).mimeType(defaultMimeType).response(response);\n if (callback != null) {\n if (typeof callback !== \"function\") throw new Error(\"invalid callback: \" + callback);\n return r.get(callback);\n }\n return r;\n };\n};\n\nvar html = type$1(\"text/html\", function(xhr) {\n return document.createRange().createContextualFragment(xhr.responseText);\n});\n\nvar json = type$1(\"application/json\", function(xhr) {\n return JSON.parse(xhr.responseText);\n});\n\nvar text = type$1(\"text/plain\", function(xhr) {\n return xhr.responseText;\n});\n\nvar xml = type$1(\"application/xml\", function(xhr) {\n var xml = xhr.responseXML;\n if (!xml) throw new Error(\"parse error\");\n return xml;\n});\n\nvar dsv$1 = function(defaultMimeType, parse) {\n return function(url, row, callback) {\n if (arguments.length < 3) callback = row, row = null;\n var r = request(url).mimeType(defaultMimeType);\n r.row = function(_) { return arguments.length ? r.response(responseOf(parse, row = _)) : row; };\n r.row(row);\n return callback ? r.get(callback) : r;\n };\n};\n\nfunction responseOf(parse, row) {\n return function(request$$1) {\n return parse(request$$1.responseText, row);\n };\n}\n\nvar csv$1 = dsv$1(\"text/csv\", csvParse);\n\nvar tsv$1 = dsv$1(\"text/tab-separated-values\", tsvParse);\n\nvar array$2 = Array.prototype;\n\nvar map$3 = array$2.map;\nvar slice$5 = array$2.slice;\n\nvar implicit = {name: \"implicit\"};\n\nfunction ordinal(range) {\n var index = map$1(),\n domain = [],\n unknown = implicit;\n\n range = range == null ? [] : slice$5.call(range);\n\n function scale(d) {\n var key = d + \"\", i = index.get(key);\n if (!i) {\n if (unknown !== implicit) return unknown;\n index.set(key, i = domain.push(d));\n }\n return range[(i - 1) % range.length];\n }\n\n scale.domain = function(_) {\n if (!arguments.length) return domain.slice();\n domain = [], index = map$1();\n var i = -1, n = _.length, d, key;\n while (++i < n) if (!index.has(key = (d = _[i]) + \"\")) index.set(key, domain.push(d));\n return scale;\n };\n\n scale.range = function(_) {\n return arguments.length ? (range = slice$5.call(_), scale) : range.slice();\n };\n\n scale.unknown = function(_) {\n return arguments.length ? (unknown = _, scale) : unknown;\n };\n\n scale.copy = function() {\n return ordinal()\n .domain(domain)\n .range(range)\n .unknown(unknown);\n };\n\n return scale;\n}\n\nfunction band() {\n var scale = ordinal().unknown(undefined),\n domain = scale.domain,\n ordinalRange = scale.range,\n range$$1 = [0, 1],\n step,\n bandwidth,\n round = false,\n paddingInner = 0,\n paddingOuter = 0,\n align = 0.5;\n\n delete scale.unknown;\n\n function rescale() {\n var n = domain().length,\n reverse = range$$1[1] < range$$1[0],\n start = range$$1[reverse - 0],\n stop = range$$1[1 - reverse];\n step = (stop - start) / Math.max(1, n - paddingInner + paddingOuter * 2);\n if (round) step = Math.floor(step);\n start += (stop - start - step * (n - paddingInner)) * align;\n bandwidth = step * (1 - paddingInner);\n if (round) start = Math.round(start), bandwidth = Math.round(bandwidth);\n var values = sequence(n).map(function(i) { return start + step * i; });\n return ordinalRange(reverse ? values.reverse() : values);\n }\n\n scale.domain = function(_) {\n return arguments.length ? (domain(_), rescale()) : domain();\n };\n\n scale.range = function(_) {\n return arguments.length ? (range$$1 = [+_[0], +_[1]], rescale()) : range$$1.slice();\n };\n\n scale.rangeRound = function(_) {\n return range$$1 = [+_[0], +_[1]], round = true, rescale();\n };\n\n scale.bandwidth = function() {\n return bandwidth;\n };\n\n scale.step = function() {\n return step;\n };\n\n scale.round = function(_) {\n return arguments.length ? (round = !!_, rescale()) : round;\n };\n\n scale.padding = function(_) {\n return arguments.length ? (paddingInner = paddingOuter = Math.max(0, Math.min(1, _)), rescale()) : paddingInner;\n };\n\n scale.paddingInner = function(_) {\n return arguments.length ? (paddingInner = Math.max(0, Math.min(1, _)), rescale()) : paddingInner;\n };\n\n scale.paddingOuter = function(_) {\n return arguments.length ? (paddingOuter = Math.max(0, Math.min(1, _)), rescale()) : paddingOuter;\n };\n\n scale.align = function(_) {\n return arguments.length ? (align = Math.max(0, Math.min(1, _)), rescale()) : align;\n };\n\n scale.copy = function() {\n return band()\n .domain(domain())\n .range(range$$1)\n .round(round)\n .paddingInner(paddingInner)\n .paddingOuter(paddingOuter)\n .align(align);\n };\n\n return rescale();\n}\n\nfunction pointish(scale) {\n var copy = scale.copy;\n\n scale.padding = scale.paddingOuter;\n delete scale.paddingInner;\n delete scale.paddingOuter;\n\n scale.copy = function() {\n return pointish(copy());\n };\n\n return scale;\n}\n\nfunction point$1() {\n return pointish(band().paddingInner(1));\n}\n\nvar constant$9 = function(x) {\n return function() {\n return x;\n };\n};\n\nvar number$2 = function(x) {\n return +x;\n};\n\nvar unit = [0, 1];\n\nfunction deinterpolateLinear(a, b) {\n return (b -= (a = +a))\n ? function(x) { return (x - a) / b; }\n : constant$9(b);\n}\n\nfunction deinterpolateClamp(deinterpolate) {\n return function(a, b) {\n var d = deinterpolate(a = +a, b = +b);\n return function(x) { return x <= a ? 0 : x >= b ? 1 : d(x); };\n };\n}\n\nfunction reinterpolateClamp(reinterpolate) {\n return function(a, b) {\n var r = reinterpolate(a = +a, b = +b);\n return function(t) { return t <= 0 ? a : t >= 1 ? b : r(t); };\n };\n}\n\nfunction bimap(domain, range, deinterpolate, reinterpolate) {\n var d0 = domain[0], d1 = domain[1], r0 = range[0], r1 = range[1];\n if (d1 < d0) d0 = deinterpolate(d1, d0), r0 = reinterpolate(r1, r0);\n else d0 = deinterpolate(d0, d1), r0 = reinterpolate(r0, r1);\n return function(x) { return r0(d0(x)); };\n}\n\nfunction polymap(domain, range, deinterpolate, reinterpolate) {\n var j = Math.min(domain.length, range.length) - 1,\n d = new Array(j),\n r = new Array(j),\n i = -1;\n\n // Reverse descending domains.\n if (domain[j] < domain[0]) {\n domain = domain.slice().reverse();\n range = range.slice().reverse();\n }\n\n while (++i < j) {\n d[i] = deinterpolate(domain[i], domain[i + 1]);\n r[i] = reinterpolate(range[i], range[i + 1]);\n }\n\n return function(x) {\n var i = bisectRight(domain, x, 1, j) - 1;\n return r[i](d[i](x));\n };\n}\n\nfunction copy(source, target) {\n return target\n .domain(source.domain())\n .range(source.range())\n .interpolate(source.interpolate())\n .clamp(source.clamp());\n}\n\n// deinterpolate(a, b)(x) takes a domain value x in [a,b] and returns the corresponding parameter t in [0,1].\n// reinterpolate(a, b)(t) takes a parameter t in [0,1] and returns the corresponding domain value x in [a,b].\nfunction continuous(deinterpolate, reinterpolate) {\n var domain = unit,\n range = unit,\n interpolate$$1 = interpolateValue,\n clamp = false,\n piecewise,\n output,\n input;\n\n function rescale() {\n piecewise = Math.min(domain.length, range.length) > 2 ? polymap : bimap;\n output = input = null;\n return scale;\n }\n\n function scale(x) {\n return (output || (output = piecewise(domain, range, clamp ? deinterpolateClamp(deinterpolate) : deinterpolate, interpolate$$1)))(+x);\n }\n\n scale.invert = function(y) {\n return (input || (input = piecewise(range, domain, deinterpolateLinear, clamp ? reinterpolateClamp(reinterpolate) : reinterpolate)))(+y);\n };\n\n scale.domain = function(_) {\n return arguments.length ? (domain = map$3.call(_, number$2), rescale()) : domain.slice();\n };\n\n scale.range = function(_) {\n return arguments.length ? (range = slice$5.call(_), rescale()) : range.slice();\n };\n\n scale.rangeRound = function(_) {\n return range = slice$5.call(_), interpolate$$1 = interpolateRound, rescale();\n };\n\n scale.clamp = function(_) {\n return arguments.length ? (clamp = !!_, rescale()) : clamp;\n };\n\n scale.interpolate = function(_) {\n return arguments.length ? (interpolate$$1 = _, rescale()) : interpolate$$1;\n };\n\n return rescale();\n}\n\nvar tickFormat = function(domain, count, specifier) {\n var start = domain[0],\n stop = domain[domain.length - 1],\n step = tickStep(start, stop, count == null ? 10 : count),\n precision;\n specifier = formatSpecifier(specifier == null ? \",f\" : specifier);\n switch (specifier.type) {\n case \"s\": {\n var value = Math.max(Math.abs(start), Math.abs(stop));\n if (specifier.precision == null && !isNaN(precision = precisionPrefix(step, value))) specifier.precision = precision;\n return exports.formatPrefix(specifier, value);\n }\n case \"\":\n case \"e\":\n case \"g\":\n case \"p\":\n case \"r\": {\n if (specifier.precision == null && !isNaN(precision = precisionRound(step, Math.max(Math.abs(start), Math.abs(stop))))) specifier.precision = precision - (specifier.type === \"e\");\n break;\n }\n case \"f\":\n case \"%\": {\n if (specifier.precision == null && !isNaN(precision = precisionFixed(step))) specifier.precision = precision - (specifier.type === \"%\") * 2;\n break;\n }\n }\n return exports.format(specifier);\n};\n\nfunction linearish(scale) {\n var domain = scale.domain;\n\n scale.ticks = function(count) {\n var d = domain();\n return ticks(d[0], d[d.length - 1], count == null ? 10 : count);\n };\n\n scale.tickFormat = function(count, specifier) {\n return tickFormat(domain(), count, specifier);\n };\n\n scale.nice = function(count) {\n if (count == null) count = 10;\n\n var d = domain(),\n i0 = 0,\n i1 = d.length - 1,\n start = d[i0],\n stop = d[i1],\n step;\n\n if (stop < start) {\n step = start, start = stop, stop = step;\n step = i0, i0 = i1, i1 = step;\n }\n\n step = tickIncrement(start, stop, count);\n\n if (step > 0) {\n start = Math.floor(start / step) * step;\n stop = Math.ceil(stop / step) * step;\n step = tickIncrement(start, stop, count);\n } else if (step < 0) {\n start = Math.ceil(start * step) / step;\n stop = Math.floor(stop * step) / step;\n step = tickIncrement(start, stop, count);\n }\n\n if (step > 0) {\n d[i0] = Math.floor(start / step) * step;\n d[i1] = Math.ceil(stop / step) * step;\n domain(d);\n } else if (step < 0) {\n d[i0] = Math.ceil(start * step) / step;\n d[i1] = Math.floor(stop * step) / step;\n domain(d);\n }\n\n return scale;\n };\n\n return scale;\n}\n\nfunction linear$2() {\n var scale = continuous(deinterpolateLinear, reinterpolate);\n\n scale.copy = function() {\n return copy(scale, linear$2());\n };\n\n return linearish(scale);\n}\n\nfunction identity$6() {\n var domain = [0, 1];\n\n function scale(x) {\n return +x;\n }\n\n scale.invert = scale;\n\n scale.domain = scale.range = function(_) {\n return arguments.length ? (domain = map$3.call(_, number$2), scale) : domain.slice();\n };\n\n scale.copy = function() {\n return identity$6().domain(domain);\n };\n\n return linearish(scale);\n}\n\nvar nice = function(domain, interval) {\n domain = domain.slice();\n\n var i0 = 0,\n i1 = domain.length - 1,\n x0 = domain[i0],\n x1 = domain[i1],\n t;\n\n if (x1 < x0) {\n t = i0, i0 = i1, i1 = t;\n t = x0, x0 = x1, x1 = t;\n }\n\n domain[i0] = interval.floor(x0);\n domain[i1] = interval.ceil(x1);\n return domain;\n};\n\nfunction deinterpolate(a, b) {\n return (b = Math.log(b / a))\n ? function(x) { return Math.log(x / a) / b; }\n : constant$9(b);\n}\n\nfunction reinterpolate$1(a, b) {\n return a < 0\n ? function(t) { return -Math.pow(-b, t) * Math.pow(-a, 1 - t); }\n : function(t) { return Math.pow(b, t) * Math.pow(a, 1 - t); };\n}\n\nfunction pow10(x) {\n return isFinite(x) ? +(\"1e\" + x) : x < 0 ? 0 : x;\n}\n\nfunction powp(base) {\n return base === 10 ? pow10\n : base === Math.E ? Math.exp\n : function(x) { return Math.pow(base, x); };\n}\n\nfunction logp(base) {\n return base === Math.E ? Math.log\n : base === 10 && Math.log10\n || base === 2 && Math.log2\n || (base = Math.log(base), function(x) { return Math.log(x) / base; });\n}\n\nfunction reflect(f) {\n return function(x) {\n return -f(-x);\n };\n}\n\nfunction log$1() {\n var scale = continuous(deinterpolate, reinterpolate$1).domain([1, 10]),\n domain = scale.domain,\n base = 10,\n logs = logp(10),\n pows = powp(10);\n\n function rescale() {\n logs = logp(base), pows = powp(base);\n if (domain()[0] < 0) logs = reflect(logs), pows = reflect(pows);\n return scale;\n }\n\n scale.base = function(_) {\n return arguments.length ? (base = +_, rescale()) : base;\n };\n\n scale.domain = function(_) {\n return arguments.length ? (domain(_), rescale()) : domain();\n };\n\n scale.ticks = function(count) {\n var d = domain(),\n u = d[0],\n v = d[d.length - 1],\n r;\n\n if (r = v < u) i = u, u = v, v = i;\n\n var i = logs(u),\n j = logs(v),\n p,\n k,\n t,\n n = count == null ? 10 : +count,\n z = [];\n\n if (!(base % 1) && j - i < n) {\n i = Math.round(i) - 1, j = Math.round(j) + 1;\n if (u > 0) for (; i < j; ++i) {\n for (k = 1, p = pows(i); k < base; ++k) {\n t = p * k;\n if (t < u) continue;\n if (t > v) break;\n z.push(t);\n }\n } else for (; i < j; ++i) {\n for (k = base - 1, p = pows(i); k >= 1; --k) {\n t = p * k;\n if (t < u) continue;\n if (t > v) break;\n z.push(t);\n }\n }\n } else {\n z = ticks(i, j, Math.min(j - i, n)).map(pows);\n }\n\n return r ? z.reverse() : z;\n };\n\n scale.tickFormat = function(count, specifier) {\n if (specifier == null) specifier = base === 10 ? \".0e\" : \",\";\n if (typeof specifier !== \"function\") specifier = exports.format(specifier);\n if (count === Infinity) return specifier;\n if (count == null) count = 10;\n var k = Math.max(1, base * count / scale.ticks().length); // TODO fast estimate?\n return function(d) {\n var i = d / pows(Math.round(logs(d)));\n if (i * base < base - 0.5) i *= base;\n return i <= k ? specifier(d) : \"\";\n };\n };\n\n scale.nice = function() {\n return domain(nice(domain(), {\n floor: function(x) { return pows(Math.floor(logs(x))); },\n ceil: function(x) { return pows(Math.ceil(logs(x))); }\n }));\n };\n\n scale.copy = function() {\n return copy(scale, log$1().base(base));\n };\n\n return scale;\n}\n\nfunction raise$1(x, exponent) {\n return x < 0 ? -Math.pow(-x, exponent) : Math.pow(x, exponent);\n}\n\nfunction pow$1() {\n var exponent = 1,\n scale = continuous(deinterpolate, reinterpolate),\n domain = scale.domain;\n\n function deinterpolate(a, b) {\n return (b = raise$1(b, exponent) - (a = raise$1(a, exponent)))\n ? function(x) { return (raise$1(x, exponent) - a) / b; }\n : constant$9(b);\n }\n\n function reinterpolate(a, b) {\n b = raise$1(b, exponent) - (a = raise$1(a, exponent));\n return function(t) { return raise$1(a + b * t, 1 / exponent); };\n }\n\n scale.exponent = function(_) {\n return arguments.length ? (exponent = +_, domain(domain())) : exponent;\n };\n\n scale.copy = function() {\n return copy(scale, pow$1().exponent(exponent));\n };\n\n return linearish(scale);\n}\n\nfunction sqrt$1() {\n return pow$1().exponent(0.5);\n}\n\nfunction quantile$$1() {\n var domain = [],\n range = [],\n thresholds = [];\n\n function rescale() {\n var i = 0, n = Math.max(1, range.length);\n thresholds = new Array(n - 1);\n while (++i < n) thresholds[i - 1] = threshold(domain, i / n);\n return scale;\n }\n\n function scale(x) {\n if (!isNaN(x = +x)) return range[bisectRight(thresholds, x)];\n }\n\n scale.invertExtent = function(y) {\n var i = range.indexOf(y);\n return i < 0 ? [NaN, NaN] : [\n i > 0 ? thresholds[i - 1] : domain[0],\n i < thresholds.length ? thresholds[i] : domain[domain.length - 1]\n ];\n };\n\n scale.domain = function(_) {\n if (!arguments.length) return domain.slice();\n domain = [];\n for (var i = 0, n = _.length, d; i < n; ++i) if (d = _[i], d != null && !isNaN(d = +d)) domain.push(d);\n domain.sort(ascending);\n return rescale();\n };\n\n scale.range = function(_) {\n return arguments.length ? (range = slice$5.call(_), rescale()) : range.slice();\n };\n\n scale.quantiles = function() {\n return thresholds.slice();\n };\n\n scale.copy = function() {\n return quantile$$1()\n .domain(domain)\n .range(range);\n };\n\n return scale;\n}\n\nfunction quantize$1() {\n var x0 = 0,\n x1 = 1,\n n = 1,\n domain = [0.5],\n range = [0, 1];\n\n function scale(x) {\n if (x <= x) return range[bisectRight(domain, x, 0, n)];\n }\n\n function rescale() {\n var i = -1;\n domain = new Array(n);\n while (++i < n) domain[i] = ((i + 1) * x1 - (i - n) * x0) / (n + 1);\n return scale;\n }\n\n scale.domain = function(_) {\n return arguments.length ? (x0 = +_[0], x1 = +_[1], rescale()) : [x0, x1];\n };\n\n scale.range = function(_) {\n return arguments.length ? (n = (range = slice$5.call(_)).length - 1, rescale()) : range.slice();\n };\n\n scale.invertExtent = function(y) {\n var i = range.indexOf(y);\n return i < 0 ? [NaN, NaN]\n : i < 1 ? [x0, domain[0]]\n : i >= n ? [domain[n - 1], x1]\n : [domain[i - 1], domain[i]];\n };\n\n scale.copy = function() {\n return quantize$1()\n .domain([x0, x1])\n .range(range);\n };\n\n return linearish(scale);\n}\n\nfunction threshold$1() {\n var domain = [0.5],\n range = [0, 1],\n n = 1;\n\n function scale(x) {\n if (x <= x) return range[bisectRight(domain, x, 0, n)];\n }\n\n scale.domain = function(_) {\n return arguments.length ? (domain = slice$5.call(_), n = Math.min(domain.length, range.length - 1), scale) : domain.slice();\n };\n\n scale.range = function(_) {\n return arguments.length ? (range = slice$5.call(_), n = Math.min(domain.length, range.length - 1), scale) : range.slice();\n };\n\n scale.invertExtent = function(y) {\n var i = range.indexOf(y);\n return [domain[i - 1], domain[i]];\n };\n\n scale.copy = function() {\n return threshold$1()\n .domain(domain)\n .range(range);\n };\n\n return scale;\n}\n\nvar t0$1 = new Date;\nvar t1$1 = new Date;\n\nfunction newInterval(floori, offseti, count, field) {\n\n function interval(date) {\n return floori(date = new Date(+date)), date;\n }\n\n interval.floor = interval;\n\n interval.ceil = function(date) {\n return floori(date = new Date(date - 1)), offseti(date, 1), floori(date), date;\n };\n\n interval.round = function(date) {\n var d0 = interval(date),\n d1 = interval.ceil(date);\n return date - d0 < d1 - date ? d0 : d1;\n };\n\n interval.offset = function(date, step) {\n return offseti(date = new Date(+date), step == null ? 1 : Math.floor(step)), date;\n };\n\n interval.range = function(start, stop, step) {\n var range = [];\n start = interval.ceil(start);\n step = step == null ? 1 : Math.floor(step);\n if (!(start < stop) || !(step > 0)) return range; // also handles Invalid Date\n do range.push(new Date(+start)); while (offseti(start, step), floori(start), start < stop)\n return range;\n };\n\n interval.filter = function(test) {\n return newInterval(function(date) {\n if (date >= date) while (floori(date), !test(date)) date.setTime(date - 1);\n }, function(date, step) {\n if (date >= date) {\n if (step < 0) while (++step <= 0) {\n while (offseti(date, -1), !test(date)) {} // eslint-disable-line no-empty\n } else while (--step >= 0) {\n while (offseti(date, +1), !test(date)) {} // eslint-disable-line no-empty\n }\n }\n });\n };\n\n if (count) {\n interval.count = function(start, end) {\n t0$1.setTime(+start), t1$1.setTime(+end);\n floori(t0$1), floori(t1$1);\n return Math.floor(count(t0$1, t1$1));\n };\n\n interval.every = function(step) {\n step = Math.floor(step);\n return !isFinite(step) || !(step > 0) ? null\n : !(step > 1) ? interval\n : interval.filter(field\n ? function(d) { return field(d) % step === 0; }\n : function(d) { return interval.count(0, d) % step === 0; });\n };\n }\n\n return interval;\n}\n\nvar millisecond = newInterval(function() {\n // noop\n}, function(date, step) {\n date.setTime(+date + step);\n}, function(start, end) {\n return end - start;\n});\n\n// An optimized implementation for this simple case.\nmillisecond.every = function(k) {\n k = Math.floor(k);\n if (!isFinite(k) || !(k > 0)) return null;\n if (!(k > 1)) return millisecond;\n return newInterval(function(date) {\n date.setTime(Math.floor(date / k) * k);\n }, function(date, step) {\n date.setTime(+date + step * k);\n }, function(start, end) {\n return (end - start) / k;\n });\n};\n\nvar milliseconds = millisecond.range;\n\nvar durationSecond$1 = 1e3;\nvar durationMinute$1 = 6e4;\nvar durationHour$1 = 36e5;\nvar durationDay$1 = 864e5;\nvar durationWeek$1 = 6048e5;\n\nvar second = newInterval(function(date) {\n date.setTime(Math.floor(date / durationSecond$1) * durationSecond$1);\n}, function(date, step) {\n date.setTime(+date + step * durationSecond$1);\n}, function(start, end) {\n return (end - start) / durationSecond$1;\n}, function(date) {\n return date.getUTCSeconds();\n});\n\nvar seconds = second.range;\n\nvar minute = newInterval(function(date) {\n date.setTime(Math.floor(date / durationMinute$1) * durationMinute$1);\n}, function(date, step) {\n date.setTime(+date + step * durationMinute$1);\n}, function(start, end) {\n return (end - start) / durationMinute$1;\n}, function(date) {\n return date.getMinutes();\n});\n\nvar minutes = minute.range;\n\nvar hour = newInterval(function(date) {\n var offset = date.getTimezoneOffset() * durationMinute$1 % durationHour$1;\n if (offset < 0) offset += durationHour$1;\n date.setTime(Math.floor((+date - offset) / durationHour$1) * durationHour$1 + offset);\n}, function(date, step) {\n date.setTime(+date + step * durationHour$1);\n}, function(start, end) {\n return (end - start) / durationHour$1;\n}, function(date) {\n return date.getHours();\n});\n\nvar hours = hour.range;\n\nvar day = newInterval(function(date) {\n date.setHours(0, 0, 0, 0);\n}, function(date, step) {\n date.setDate(date.getDate() + step);\n}, function(start, end) {\n return (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * durationMinute$1) / durationDay$1;\n}, function(date) {\n return date.getDate() - 1;\n});\n\nvar days = day.range;\n\nfunction weekday(i) {\n return newInterval(function(date) {\n date.setDate(date.getDate() - (date.getDay() + 7 - i) % 7);\n date.setHours(0, 0, 0, 0);\n }, function(date, step) {\n date.setDate(date.getDate() + step * 7);\n }, function(start, end) {\n return (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * durationMinute$1) / durationWeek$1;\n });\n}\n\nvar sunday = weekday(0);\nvar monday = weekday(1);\nvar tuesday = weekday(2);\nvar wednesday = weekday(3);\nvar thursday = weekday(4);\nvar friday = weekday(5);\nvar saturday = weekday(6);\n\nvar sundays = sunday.range;\nvar mondays = monday.range;\nvar tuesdays = tuesday.range;\nvar wednesdays = wednesday.range;\nvar thursdays = thursday.range;\nvar fridays = friday.range;\nvar saturdays = saturday.range;\n\nvar month = newInterval(function(date) {\n date.setDate(1);\n date.setHours(0, 0, 0, 0);\n}, function(date, step) {\n date.setMonth(date.getMonth() + step);\n}, function(start, end) {\n return end.getMonth() - start.getMonth() + (end.getFullYear() - start.getFullYear()) * 12;\n}, function(date) {\n return date.getMonth();\n});\n\nvar months = month.range;\n\nvar year = newInterval(function(date) {\n date.setMonth(0, 1);\n date.setHours(0, 0, 0, 0);\n}, function(date, step) {\n date.setFullYear(date.getFullYear() + step);\n}, function(start, end) {\n return end.getFullYear() - start.getFullYear();\n}, function(date) {\n return date.getFullYear();\n});\n\n// An optimized implementation for this simple case.\nyear.every = function(k) {\n return !isFinite(k = Math.floor(k)) || !(k > 0) ? null : newInterval(function(date) {\n date.setFullYear(Math.floor(date.getFullYear() / k) * k);\n date.setMonth(0, 1);\n date.setHours(0, 0, 0, 0);\n }, function(date, step) {\n date.setFullYear(date.getFullYear() + step * k);\n });\n};\n\nvar years = year.range;\n\nvar utcMinute = newInterval(function(date) {\n date.setUTCSeconds(0, 0);\n}, function(date, step) {\n date.setTime(+date + step * durationMinute$1);\n}, function(start, end) {\n return (end - start) / durationMinute$1;\n}, function(date) {\n return date.getUTCMinutes();\n});\n\nvar utcMinutes = utcMinute.range;\n\nvar utcHour = newInterval(function(date) {\n date.setUTCMinutes(0, 0, 0);\n}, function(date, step) {\n date.setTime(+date + step * durationHour$1);\n}, function(start, end) {\n return (end - start) / durationHour$1;\n}, function(date) {\n return date.getUTCHours();\n});\n\nvar utcHours = utcHour.range;\n\nvar utcDay = newInterval(function(date) {\n date.setUTCHours(0, 0, 0, 0);\n}, function(date, step) {\n date.setUTCDate(date.getUTCDate() + step);\n}, function(start, end) {\n return (end - start) / durationDay$1;\n}, function(date) {\n return date.getUTCDate() - 1;\n});\n\nvar utcDays = utcDay.range;\n\nfunction utcWeekday(i) {\n return newInterval(function(date) {\n date.setUTCDate(date.getUTCDate() - (date.getUTCDay() + 7 - i) % 7);\n date.setUTCHours(0, 0, 0, 0);\n }, function(date, step) {\n date.setUTCDate(date.getUTCDate() + step * 7);\n }, function(start, end) {\n return (end - start) / durationWeek$1;\n });\n}\n\nvar utcSunday = utcWeekday(0);\nvar utcMonday = utcWeekday(1);\nvar utcTuesday = utcWeekday(2);\nvar utcWednesday = utcWeekday(3);\nvar utcThursday = utcWeekday(4);\nvar utcFriday = utcWeekday(5);\nvar utcSaturday = utcWeekday(6);\n\nvar utcSundays = utcSunday.range;\nvar utcMondays = utcMonday.range;\nvar utcTuesdays = utcTuesday.range;\nvar utcWednesdays = utcWednesday.range;\nvar utcThursdays = utcThursday.range;\nvar utcFridays = utcFriday.range;\nvar utcSaturdays = utcSaturday.range;\n\nvar utcMonth = newInterval(function(date) {\n date.setUTCDate(1);\n date.setUTCHours(0, 0, 0, 0);\n}, function(date, step) {\n date.setUTCMonth(date.getUTCMonth() + step);\n}, function(start, end) {\n return end.getUTCMonth() - start.getUTCMonth() + (end.getUTCFullYear() - start.getUTCFullYear()) * 12;\n}, function(date) {\n return date.getUTCMonth();\n});\n\nvar utcMonths = utcMonth.range;\n\nvar utcYear = newInterval(function(date) {\n date.setUTCMonth(0, 1);\n date.setUTCHours(0, 0, 0, 0);\n}, function(date, step) {\n date.setUTCFullYear(date.getUTCFullYear() + step);\n}, function(start, end) {\n return end.getUTCFullYear() - start.getUTCFullYear();\n}, function(date) {\n return date.getUTCFullYear();\n});\n\n// An optimized implementation for this simple case.\nutcYear.every = function(k) {\n return !isFinite(k = Math.floor(k)) || !(k > 0) ? null : newInterval(function(date) {\n date.setUTCFullYear(Math.floor(date.getUTCFullYear() / k) * k);\n date.setUTCMonth(0, 1);\n date.setUTCHours(0, 0, 0, 0);\n }, function(date, step) {\n date.setUTCFullYear(date.getUTCFullYear() + step * k);\n });\n};\n\nvar utcYears = utcYear.range;\n\nfunction localDate(d) {\n if (0 <= d.y && d.y < 100) {\n var date = new Date(-1, d.m, d.d, d.H, d.M, d.S, d.L);\n date.setFullYear(d.y);\n return date;\n }\n return new Date(d.y, d.m, d.d, d.H, d.M, d.S, d.L);\n}\n\nfunction utcDate(d) {\n if (0 <= d.y && d.y < 100) {\n var date = new Date(Date.UTC(-1, d.m, d.d, d.H, d.M, d.S, d.L));\n date.setUTCFullYear(d.y);\n return date;\n }\n return new Date(Date.UTC(d.y, d.m, d.d, d.H, d.M, d.S, d.L));\n}\n\nfunction newYear(y) {\n return {y: y, m: 0, d: 1, H: 0, M: 0, S: 0, L: 0};\n}\n\nfunction formatLocale$1(locale) {\n var locale_dateTime = locale.dateTime,\n locale_date = locale.date,\n locale_time = locale.time,\n locale_periods = locale.periods,\n locale_weekdays = locale.days,\n locale_shortWeekdays = locale.shortDays,\n locale_months = locale.months,\n locale_shortMonths = locale.shortMonths;\n\n var periodRe = formatRe(locale_periods),\n periodLookup = formatLookup(locale_periods),\n weekdayRe = formatRe(locale_weekdays),\n weekdayLookup = formatLookup(locale_weekdays),\n shortWeekdayRe = formatRe(locale_shortWeekdays),\n shortWeekdayLookup = formatLookup(locale_shortWeekdays),\n monthRe = formatRe(locale_months),\n monthLookup = formatLookup(locale_months),\n shortMonthRe = formatRe(locale_shortMonths),\n shortMonthLookup = formatLookup(locale_shortMonths);\n\n var formats = {\n \"a\": formatShortWeekday,\n \"A\": formatWeekday,\n \"b\": formatShortMonth,\n \"B\": formatMonth,\n \"c\": null,\n \"d\": formatDayOfMonth,\n \"e\": formatDayOfMonth,\n \"H\": formatHour24,\n \"I\": formatHour12,\n \"j\": formatDayOfYear,\n \"L\": formatMilliseconds,\n \"m\": formatMonthNumber,\n \"M\": formatMinutes,\n \"p\": formatPeriod,\n \"S\": formatSeconds,\n \"U\": formatWeekNumberSunday,\n \"w\": formatWeekdayNumber,\n \"W\": formatWeekNumberMonday,\n \"x\": null,\n \"X\": null,\n \"y\": formatYear,\n \"Y\": formatFullYear,\n \"Z\": formatZone,\n \"%\": formatLiteralPercent\n };\n\n var utcFormats = {\n \"a\": formatUTCShortWeekday,\n \"A\": formatUTCWeekday,\n \"b\": formatUTCShortMonth,\n \"B\": formatUTCMonth,\n \"c\": null,\n \"d\": formatUTCDayOfMonth,\n \"e\": formatUTCDayOfMonth,\n \"H\": formatUTCHour24,\n \"I\": formatUTCHour12,\n \"j\": formatUTCDayOfYear,\n \"L\": formatUTCMilliseconds,\n \"m\": formatUTCMonthNumber,\n \"M\": formatUTCMinutes,\n \"p\": formatUTCPeriod,\n \"S\": formatUTCSeconds,\n \"U\": formatUTCWeekNumberSunday,\n \"w\": formatUTCWeekdayNumber,\n \"W\": formatUTCWeekNumberMonday,\n \"x\": null,\n \"X\": null,\n \"y\": formatUTCYear,\n \"Y\": formatUTCFullYear,\n \"Z\": formatUTCZone,\n \"%\": formatLiteralPercent\n };\n\n var parses = {\n \"a\": parseShortWeekday,\n \"A\": parseWeekday,\n \"b\": parseShortMonth,\n \"B\": parseMonth,\n \"c\": parseLocaleDateTime,\n \"d\": parseDayOfMonth,\n \"e\": parseDayOfMonth,\n \"H\": parseHour24,\n \"I\": parseHour24,\n \"j\": parseDayOfYear,\n \"L\": parseMilliseconds,\n \"m\": parseMonthNumber,\n \"M\": parseMinutes,\n \"p\": parsePeriod,\n \"S\": parseSeconds,\n \"U\": parseWeekNumberSunday,\n \"w\": parseWeekdayNumber,\n \"W\": parseWeekNumberMonday,\n \"x\": parseLocaleDate,\n \"X\": parseLocaleTime,\n \"y\": parseYear,\n \"Y\": parseFullYear,\n \"Z\": parseZone,\n \"%\": parseLiteralPercent\n };\n\n // These recursive directive definitions must be deferred.\n formats.x = newFormat(locale_date, formats);\n formats.X = newFormat(locale_time, formats);\n formats.c = newFormat(locale_dateTime, formats);\n utcFormats.x = newFormat(locale_date, utcFormats);\n utcFormats.X = newFormat(locale_time, utcFormats);\n utcFormats.c = newFormat(locale_dateTime, utcFormats);\n\n function newFormat(specifier, formats) {\n return function(date) {\n var string = [],\n i = -1,\n j = 0,\n n = specifier.length,\n c,\n pad,\n format;\n\n if (!(date instanceof Date)) date = new Date(+date);\n\n while (++i < n) {\n if (specifier.charCodeAt(i) === 37) {\n string.push(specifier.slice(j, i));\n if ((pad = pads[c = specifier.charAt(++i)]) != null) c = specifier.charAt(++i);\n else pad = c === \"e\" ? \" \" : \"0\";\n if (format = formats[c]) c = format(date, pad);\n string.push(c);\n j = i + 1;\n }\n }\n\n string.push(specifier.slice(j, i));\n return string.join(\"\");\n };\n }\n\n function newParse(specifier, newDate) {\n return function(string) {\n var d = newYear(1900),\n i = parseSpecifier(d, specifier, string += \"\", 0);\n if (i != string.length) return null;\n\n // The am-pm flag is 0 for AM, and 1 for PM.\n if (\"p\" in d) d.H = d.H % 12 + d.p * 12;\n\n // Convert day-of-week and week-of-year to day-of-year.\n if (\"W\" in d || \"U\" in d) {\n if (!(\"w\" in d)) d.w = \"W\" in d ? 1 : 0;\n var day$$1 = \"Z\" in d ? utcDate(newYear(d.y)).getUTCDay() : newDate(newYear(d.y)).getDay();\n d.m = 0;\n d.d = \"W\" in d ? (d.w + 6) % 7 + d.W * 7 - (day$$1 + 5) % 7 : d.w + d.U * 7 - (day$$1 + 6) % 7;\n }\n\n // If a time zone is specified, all fields are interpreted as UTC and then\n // offset according to the specified time zone.\n if (\"Z\" in d) {\n d.H += d.Z / 100 | 0;\n d.M += d.Z % 100;\n return utcDate(d);\n }\n\n // Otherwise, all fields are in local time.\n return newDate(d);\n };\n }\n\n function parseSpecifier(d, specifier, string, j) {\n var i = 0,\n n = specifier.length,\n m = string.length,\n c,\n parse;\n\n while (i < n) {\n if (j >= m) return -1;\n c = specifier.charCodeAt(i++);\n if (c === 37) {\n c = specifier.charAt(i++);\n parse = parses[c in pads ? specifier.charAt(i++) : c];\n if (!parse || ((j = parse(d, string, j)) < 0)) return -1;\n } else if (c != string.charCodeAt(j++)) {\n return -1;\n }\n }\n\n return j;\n }\n\n function parsePeriod(d, string, i) {\n var n = periodRe.exec(string.slice(i));\n return n ? (d.p = periodLookup[n[0].toLowerCase()], i + n[0].length) : -1;\n }\n\n function parseShortWeekday(d, string, i) {\n var n = shortWeekdayRe.exec(string.slice(i));\n return n ? (d.w = shortWeekdayLookup[n[0].toLowerCase()], i + n[0].length) : -1;\n }\n\n function parseWeekday(d, string, i) {\n var n = weekdayRe.exec(string.slice(i));\n return n ? (d.w = weekdayLookup[n[0].toLowerCase()], i + n[0].length) : -1;\n }\n\n function parseShortMonth(d, string, i) {\n var n = shortMonthRe.exec(string.slice(i));\n return n ? (d.m = shortMonthLookup[n[0].toLowerCase()], i + n[0].length) : -1;\n }\n\n function parseMonth(d, string, i) {\n var n = monthRe.exec(string.slice(i));\n return n ? (d.m = monthLookup[n[0].toLowerCase()], i + n[0].length) : -1;\n }\n\n function parseLocaleDateTime(d, string, i) {\n return parseSpecifier(d, locale_dateTime, string, i);\n }\n\n function parseLocaleDate(d, string, i) {\n return parseSpecifier(d, locale_date, string, i);\n }\n\n function parseLocaleTime(d, string, i) {\n return parseSpecifier(d, locale_time, string, i);\n }\n\n function formatShortWeekday(d) {\n return locale_shortWeekdays[d.getDay()];\n }\n\n function formatWeekday(d) {\n return locale_weekdays[d.getDay()];\n }\n\n function formatShortMonth(d) {\n return locale_shortMonths[d.getMonth()];\n }\n\n function formatMonth(d) {\n return locale_months[d.getMonth()];\n }\n\n function formatPeriod(d) {\n return locale_periods[+(d.getHours() >= 12)];\n }\n\n function formatUTCShortWeekday(d) {\n return locale_shortWeekdays[d.getUTCDay()];\n }\n\n function formatUTCWeekday(d) {\n return locale_weekdays[d.getUTCDay()];\n }\n\n function formatUTCShortMonth(d) {\n return locale_shortMonths[d.getUTCMonth()];\n }\n\n function formatUTCMonth(d) {\n return locale_months[d.getUTCMonth()];\n }\n\n function formatUTCPeriod(d) {\n return locale_periods[+(d.getUTCHours() >= 12)];\n }\n\n return {\n format: function(specifier) {\n var f = newFormat(specifier += \"\", formats);\n f.toString = function() { return specifier; };\n return f;\n },\n parse: function(specifier) {\n var p = newParse(specifier += \"\", localDate);\n p.toString = function() { return specifier; };\n return p;\n },\n utcFormat: function(specifier) {\n var f = newFormat(specifier += \"\", utcFormats);\n f.toString = function() { return specifier; };\n return f;\n },\n utcParse: function(specifier) {\n var p = newParse(specifier, utcDate);\n p.toString = function() { return specifier; };\n return p;\n }\n };\n}\n\nvar pads = {\"-\": \"\", \"_\": \" \", \"0\": \"0\"};\nvar numberRe = /^\\s*\\d+/;\nvar percentRe = /^%/;\nvar requoteRe = /[\\\\\\^\\$\\*\\+\\?\\|\\[\\]\\(\\)\\.\\{\\}]/g;\n\nfunction pad(value, fill, width) {\n var sign = value < 0 ? \"-\" : \"\",\n string = (sign ? -value : value) + \"\",\n length = string.length;\n return sign + (length < width ? new Array(width - length + 1).join(fill) + string : string);\n}\n\nfunction requote(s) {\n return s.replace(requoteRe, \"\\\\$&\");\n}\n\nfunction formatRe(names) {\n return new RegExp(\"^(?:\" + names.map(requote).join(\"|\") + \")\", \"i\");\n}\n\nfunction formatLookup(names) {\n var map = {}, i = -1, n = names.length;\n while (++i < n) map[names[i].toLowerCase()] = i;\n return map;\n}\n\nfunction parseWeekdayNumber(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 1));\n return n ? (d.w = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseWeekNumberSunday(d, string, i) {\n var n = numberRe.exec(string.slice(i));\n return n ? (d.U = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseWeekNumberMonday(d, string, i) {\n var n = numberRe.exec(string.slice(i));\n return n ? (d.W = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseFullYear(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 4));\n return n ? (d.y = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseYear(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.y = +n[0] + (+n[0] > 68 ? 1900 : 2000), i + n[0].length) : -1;\n}\n\nfunction parseZone(d, string, i) {\n var n = /^(Z)|([+-]\\d\\d)(?:\\:?(\\d\\d))?/.exec(string.slice(i, i + 6));\n return n ? (d.Z = n[1] ? 0 : -(n[2] + (n[3] || \"00\")), i + n[0].length) : -1;\n}\n\nfunction parseMonthNumber(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.m = n[0] - 1, i + n[0].length) : -1;\n}\n\nfunction parseDayOfMonth(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.d = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseDayOfYear(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 3));\n return n ? (d.m = 0, d.d = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseHour24(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.H = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseMinutes(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.M = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseSeconds(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.S = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseMilliseconds(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 3));\n return n ? (d.L = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseLiteralPercent(d, string, i) {\n var n = percentRe.exec(string.slice(i, i + 1));\n return n ? i + n[0].length : -1;\n}\n\nfunction formatDayOfMonth(d, p) {\n return pad(d.getDate(), p, 2);\n}\n\nfunction formatHour24(d, p) {\n return pad(d.getHours(), p, 2);\n}\n\nfunction formatHour12(d, p) {\n return pad(d.getHours() % 12 || 12, p, 2);\n}\n\nfunction formatDayOfYear(d, p) {\n return pad(1 + day.count(year(d), d), p, 3);\n}\n\nfunction formatMilliseconds(d, p) {\n return pad(d.getMilliseconds(), p, 3);\n}\n\nfunction formatMonthNumber(d, p) {\n return pad(d.getMonth() + 1, p, 2);\n}\n\nfunction formatMinutes(d, p) {\n return pad(d.getMinutes(), p, 2);\n}\n\nfunction formatSeconds(d, p) {\n return pad(d.getSeconds(), p, 2);\n}\n\nfunction formatWeekNumberSunday(d, p) {\n return pad(sunday.count(year(d), d), p, 2);\n}\n\nfunction formatWeekdayNumber(d) {\n return d.getDay();\n}\n\nfunction formatWeekNumberMonday(d, p) {\n return pad(monday.count(year(d), d), p, 2);\n}\n\nfunction formatYear(d, p) {\n return pad(d.getFullYear() % 100, p, 2);\n}\n\nfunction formatFullYear(d, p) {\n return pad(d.getFullYear() % 10000, p, 4);\n}\n\nfunction formatZone(d) {\n var z = d.getTimezoneOffset();\n return (z > 0 ? \"-\" : (z *= -1, \"+\"))\n + pad(z / 60 | 0, \"0\", 2)\n + pad(z % 60, \"0\", 2);\n}\n\nfunction formatUTCDayOfMonth(d, p) {\n return pad(d.getUTCDate(), p, 2);\n}\n\nfunction formatUTCHour24(d, p) {\n return pad(d.getUTCHours(), p, 2);\n}\n\nfunction formatUTCHour12(d, p) {\n return pad(d.getUTCHours() % 12 || 12, p, 2);\n}\n\nfunction formatUTCDayOfYear(d, p) {\n return pad(1 + utcDay.count(utcYear(d), d), p, 3);\n}\n\nfunction formatUTCMilliseconds(d, p) {\n return pad(d.getUTCMilliseconds(), p, 3);\n}\n\nfunction formatUTCMonthNumber(d, p) {\n return pad(d.getUTCMonth() + 1, p, 2);\n}\n\nfunction formatUTCMinutes(d, p) {\n return pad(d.getUTCMinutes(), p, 2);\n}\n\nfunction formatUTCSeconds(d, p) {\n return pad(d.getUTCSeconds(), p, 2);\n}\n\nfunction formatUTCWeekNumberSunday(d, p) {\n return pad(utcSunday.count(utcYear(d), d), p, 2);\n}\n\nfunction formatUTCWeekdayNumber(d) {\n return d.getUTCDay();\n}\n\nfunction formatUTCWeekNumberMonday(d, p) {\n return pad(utcMonday.count(utcYear(d), d), p, 2);\n}\n\nfunction formatUTCYear(d, p) {\n return pad(d.getUTCFullYear() % 100, p, 2);\n}\n\nfunction formatUTCFullYear(d, p) {\n return pad(d.getUTCFullYear() % 10000, p, 4);\n}\n\nfunction formatUTCZone() {\n return \"+0000\";\n}\n\nfunction formatLiteralPercent() {\n return \"%\";\n}\n\nvar locale$1;\n\n\n\n\n\ndefaultLocale$1({\n dateTime: \"%x, %X\",\n date: \"%-m/%-d/%Y\",\n time: \"%-I:%M:%S %p\",\n periods: [\"AM\", \"PM\"],\n days: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"],\n shortDays: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"],\n months: [\"January\", \"February\", \"March\", \"April\", \"May\", \"June\", \"July\", \"August\", \"September\", \"October\", \"November\", \"December\"],\n shortMonths: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"]\n});\n\nfunction defaultLocale$1(definition) {\n locale$1 = formatLocale$1(definition);\n exports.timeFormat = locale$1.format;\n exports.timeParse = locale$1.parse;\n exports.utcFormat = locale$1.utcFormat;\n exports.utcParse = locale$1.utcParse;\n return locale$1;\n}\n\nvar isoSpecifier = \"%Y-%m-%dT%H:%M:%S.%LZ\";\n\nfunction formatIsoNative(date) {\n return date.toISOString();\n}\n\nvar formatIso = Date.prototype.toISOString\n ? formatIsoNative\n : exports.utcFormat(isoSpecifier);\n\nfunction parseIsoNative(string) {\n var date = new Date(string);\n return isNaN(date) ? null : date;\n}\n\nvar parseIso = +new Date(\"2000-01-01T00:00:00.000Z\")\n ? parseIsoNative\n : exports.utcParse(isoSpecifier);\n\nvar durationSecond = 1000;\nvar durationMinute = durationSecond * 60;\nvar durationHour = durationMinute * 60;\nvar durationDay = durationHour * 24;\nvar durationWeek = durationDay * 7;\nvar durationMonth = durationDay * 30;\nvar durationYear = durationDay * 365;\n\nfunction date$1(t) {\n return new Date(t);\n}\n\nfunction number$3(t) {\n return t instanceof Date ? +t : +new Date(+t);\n}\n\nfunction calendar(year$$1, month$$1, week, day$$1, hour$$1, minute$$1, second$$1, millisecond$$1, format) {\n var scale = continuous(deinterpolateLinear, reinterpolate),\n invert = scale.invert,\n domain = scale.domain;\n\n var formatMillisecond = format(\".%L\"),\n formatSecond = format(\":%S\"),\n formatMinute = format(\"%I:%M\"),\n formatHour = format(\"%I %p\"),\n formatDay = format(\"%a %d\"),\n formatWeek = format(\"%b %d\"),\n formatMonth = format(\"%B\"),\n formatYear = format(\"%Y\");\n\n var tickIntervals = [\n [second$$1, 1, durationSecond],\n [second$$1, 5, 5 * durationSecond],\n [second$$1, 15, 15 * durationSecond],\n [second$$1, 30, 30 * durationSecond],\n [minute$$1, 1, durationMinute],\n [minute$$1, 5, 5 * durationMinute],\n [minute$$1, 15, 15 * durationMinute],\n [minute$$1, 30, 30 * durationMinute],\n [ hour$$1, 1, durationHour ],\n [ hour$$1, 3, 3 * durationHour ],\n [ hour$$1, 6, 6 * durationHour ],\n [ hour$$1, 12, 12 * durationHour ],\n [ day$$1, 1, durationDay ],\n [ day$$1, 2, 2 * durationDay ],\n [ week, 1, durationWeek ],\n [ month$$1, 1, durationMonth ],\n [ month$$1, 3, 3 * durationMonth ],\n [ year$$1, 1, durationYear ]\n ];\n\n function tickFormat(date) {\n return (second$$1(date) < date ? formatMillisecond\n : minute$$1(date) < date ? formatSecond\n : hour$$1(date) < date ? formatMinute\n : day$$1(date) < date ? formatHour\n : month$$1(date) < date ? (week(date) < date ? formatDay : formatWeek)\n : year$$1(date) < date ? formatMonth\n : formatYear)(date);\n }\n\n function tickInterval(interval, start, stop, step) {\n if (interval == null) interval = 10;\n\n // If a desired tick count is specified, pick a reasonable tick interval\n // based on the extent of the domain and a rough estimate of tick size.\n // Otherwise, assume interval is already a time interval and use it.\n if (typeof interval === \"number\") {\n var target = Math.abs(stop - start) / interval,\n i = bisector(function(i) { return i[2]; }).right(tickIntervals, target);\n if (i === tickIntervals.length) {\n step = tickStep(start / durationYear, stop / durationYear, interval);\n interval = year$$1;\n } else if (i) {\n i = tickIntervals[target / tickIntervals[i - 1][2] < tickIntervals[i][2] / target ? i - 1 : i];\n step = i[1];\n interval = i[0];\n } else {\n step = tickStep(start, stop, interval);\n interval = millisecond$$1;\n }\n }\n\n return step == null ? interval : interval.every(step);\n }\n\n scale.invert = function(y) {\n return new Date(invert(y));\n };\n\n scale.domain = function(_) {\n return arguments.length ? domain(map$3.call(_, number$3)) : domain().map(date$1);\n };\n\n scale.ticks = function(interval, step) {\n var d = domain(),\n t0 = d[0],\n t1 = d[d.length - 1],\n r = t1 < t0,\n t;\n if (r) t = t0, t0 = t1, t1 = t;\n t = tickInterval(interval, t0, t1, step);\n t = t ? t.range(t0, t1 + 1) : []; // inclusive stop\n return r ? t.reverse() : t;\n };\n\n scale.tickFormat = function(count, specifier) {\n return specifier == null ? tickFormat : format(specifier);\n };\n\n scale.nice = function(interval, step) {\n var d = domain();\n return (interval = tickInterval(interval, d[0], d[d.length - 1], step))\n ? domain(nice(d, interval))\n : scale;\n };\n\n scale.copy = function() {\n return copy(scale, calendar(year$$1, month$$1, week, day$$1, hour$$1, minute$$1, second$$1, millisecond$$1, format));\n };\n\n return scale;\n}\n\nvar time = function() {\n return calendar(year, month, sunday, day, hour, minute, second, millisecond, exports.timeFormat).domain([new Date(2000, 0, 1), new Date(2000, 0, 2)]);\n};\n\nvar utcTime = function() {\n return calendar(utcYear, utcMonth, utcSunday, utcDay, utcHour, utcMinute, second, millisecond, exports.utcFormat).domain([Date.UTC(2000, 0, 1), Date.UTC(2000, 0, 2)]);\n};\n\nvar colors = function(s) {\n return s.match(/.{6}/g).map(function(x) {\n return \"#\" + x;\n });\n};\n\nvar category10 = colors(\"1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf\");\n\nvar category20b = colors(\"393b795254a36b6ecf9c9ede6379398ca252b5cf6bcedb9c8c6d31bd9e39e7ba52e7cb94843c39ad494ad6616be7969c7b4173a55194ce6dbdde9ed6\");\n\nvar category20c = colors(\"3182bd6baed69ecae1c6dbefe6550dfd8d3cfdae6bfdd0a231a35474c476a1d99bc7e9c0756bb19e9ac8bcbddcdadaeb636363969696bdbdbdd9d9d9\");\n\nvar category20 = colors(\"1f77b4aec7e8ff7f0effbb782ca02c98df8ad62728ff98969467bdc5b0d58c564bc49c94e377c2f7b6d27f7f7fc7c7c7bcbd22dbdb8d17becf9edae5\");\n\nvar cubehelix$3 = cubehelixLong(cubehelix(300, 0.5, 0.0), cubehelix(-240, 0.5, 1.0));\n\nvar warm = cubehelixLong(cubehelix(-100, 0.75, 0.35), cubehelix(80, 1.50, 0.8));\n\nvar cool = cubehelixLong(cubehelix(260, 0.75, 0.35), cubehelix(80, 1.50, 0.8));\n\nvar rainbow = cubehelix();\n\nvar rainbow$1 = function(t) {\n if (t < 0 || t > 1) t -= Math.floor(t);\n var ts = Math.abs(t - 0.5);\n rainbow.h = 360 * t - 100;\n rainbow.s = 1.5 - 1.5 * ts;\n rainbow.l = 0.8 - 0.9 * ts;\n return rainbow + \"\";\n};\n\nfunction ramp(range) {\n var n = range.length;\n return function(t) {\n return range[Math.max(0, Math.min(n - 1, Math.floor(t * n)))];\n };\n}\n\nvar viridis = ramp(colors(\"44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725\"));\n\nvar magma = ramp(colors(\"00000401000501010601010802010902020b02020d03030f03031204041405041606051806051a07061c08071e0907200a08220b09240c09260d0a290e0b2b100b2d110c2f120d31130d34140e36150e38160f3b180f3d19103f1a10421c10441d11471e114920114b21114e22115024125325125527125829115a2a115c2c115f2d11612f116331116533106734106936106b38106c390f6e3b0f703d0f713f0f72400f74420f75440f764510774710784910784a10794c117a4e117b4f127b51127c52137c54137d56147d57157e59157e5a167e5c167f5d177f5f187f601880621980641a80651a80671b80681c816a1c816b1d816d1d816e1e81701f81721f817320817521817621817822817922827b23827c23827e24828025828125818326818426818627818827818928818b29818c29818e2a81902a81912b81932b80942c80962c80982d80992d809b2e7f9c2e7f9e2f7fa02f7fa1307ea3307ea5317ea6317da8327daa337dab337cad347cae347bb0357bb2357bb3367ab5367ab73779b83779ba3878bc3978bd3977bf3a77c03a76c23b75c43c75c53c74c73d73c83e73ca3e72cc3f71cd4071cf4070d0416fd2426fd3436ed5446dd6456cd8456cd9466bdb476adc4869de4968df4a68e04c67e24d66e34e65e44f64e55064e75263e85362e95462ea5661eb5760ec5860ed5a5fee5b5eef5d5ef05f5ef1605df2625df2645cf3655cf4675cf4695cf56b5cf66c5cf66e5cf7705cf7725cf8745cf8765cf9785df9795df97b5dfa7d5efa7f5efa815ffb835ffb8560fb8761fc8961fc8a62fc8c63fc8e64fc9065fd9266fd9467fd9668fd9869fd9a6afd9b6bfe9d6cfe9f6dfea16efea36ffea571fea772fea973feaa74feac76feae77feb078feb27afeb47bfeb67cfeb77efeb97ffebb81febd82febf84fec185fec287fec488fec68afec88cfeca8dfecc8ffecd90fecf92fed194fed395fed597fed799fed89afdda9cfddc9efddea0fde0a1fde2a3fde3a5fde5a7fde7a9fde9aafdebacfcecaefceeb0fcf0b2fcf2b4fcf4b6fcf6b8fcf7b9fcf9bbfcfbbdfcfdbf\"));\n\nvar inferno = ramp(colors(\"00000401000501010601010802010a02020c02020e03021004031204031405041706041907051b08051d09061f0a07220b07240c08260d08290e092b10092d110a30120a32140b34150b37160b39180c3c190c3e1b0c411c0c431e0c451f0c48210c4a230c4c240c4f260c51280b53290b552b0b572d0b592f0a5b310a5c320a5e340a5f3609613809623909633b09643d09653e0966400a67420a68440a68450a69470b6a490b6a4a0c6b4c0c6b4d0d6c4f0d6c510e6c520e6d540f6d550f6d57106e59106e5a116e5c126e5d126e5f136e61136e62146e64156e65156e67166e69166e6a176e6c186e6d186e6f196e71196e721a6e741a6e751b6e771c6d781c6d7a1d6d7c1d6d7d1e6d7f1e6c801f6c82206c84206b85216b87216b88226a8a226a8c23698d23698f24699025689225689326679526679727669827669a28659b29649d29649f2a63a02a63a22b62a32c61a52c60a62d60a82e5fa92e5eab2f5ead305dae305cb0315bb1325ab3325ab43359b63458b73557b93556ba3655bc3754bd3853bf3952c03a51c13a50c33b4fc43c4ec63d4dc73e4cc83f4bca404acb4149cc4248ce4347cf4446d04545d24644d34743d44842d54a41d74b3fd84c3ed94d3dda4e3cdb503bdd513ade5238df5337e05536e15635e25734e35933e45a31e55c30e65d2fe75e2ee8602de9612bea632aeb6429eb6628ec6726ed6925ee6a24ef6c23ef6e21f06f20f1711ff1731df2741cf3761bf37819f47918f57b17f57d15f67e14f68013f78212f78410f8850ff8870ef8890cf98b0bf98c0af98e09fa9008fa9207fa9407fb9606fb9706fb9906fb9b06fb9d07fc9f07fca108fca309fca50afca60cfca80dfcaa0ffcac11fcae12fcb014fcb216fcb418fbb61afbb81dfbba1ffbbc21fbbe23fac026fac228fac42afac62df9c72ff9c932f9cb35f8cd37f8cf3af7d13df7d340f6d543f6d746f5d949f5db4cf4dd4ff4df53f4e156f3e35af3e55df2e661f2e865f2ea69f1ec6df1ed71f1ef75f1f179f2f27df2f482f3f586f3f68af4f88ef5f992f6fa96f8fb9af9fc9dfafda1fcffa4\"));\n\nvar plasma = ramp(colors(\"0d088710078813078916078a19068c1b068d1d068e20068f2206902406912605912805922a05932c05942e05952f059631059733059735049837049938049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c02a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a66100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a87401a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a68707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a19814a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb6308bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6ada5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe4695ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983ef99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fdab33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2afebe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921\"));\n\nfunction sequential(interpolator) {\n var x0 = 0,\n x1 = 1,\n clamp = false;\n\n function scale(x) {\n var t = (x - x0) / (x1 - x0);\n return interpolator(clamp ? Math.max(0, Math.min(1, t)) : t);\n }\n\n scale.domain = function(_) {\n return arguments.length ? (x0 = +_[0], x1 = +_[1], scale) : [x0, x1];\n };\n\n scale.clamp = function(_) {\n return arguments.length ? (clamp = !!_, scale) : clamp;\n };\n\n scale.interpolator = function(_) {\n return arguments.length ? (interpolator = _, scale) : interpolator;\n };\n\n scale.copy = function() {\n return sequential(interpolator).domain([x0, x1]).clamp(clamp);\n };\n\n return linearish(scale);\n}\n\nvar constant$10 = function(x) {\n return function constant() {\n return x;\n };\n};\n\nvar abs$1 = Math.abs;\nvar atan2$1 = Math.atan2;\nvar cos$2 = Math.cos;\nvar max$2 = Math.max;\nvar min$1 = Math.min;\nvar sin$2 = Math.sin;\nvar sqrt$2 = Math.sqrt;\n\nvar epsilon$3 = 1e-12;\nvar pi$4 = Math.PI;\nvar halfPi$3 = pi$4 / 2;\nvar tau$4 = 2 * pi$4;\n\nfunction acos$1(x) {\n return x > 1 ? 0 : x < -1 ? pi$4 : Math.acos(x);\n}\n\nfunction asin$1(x) {\n return x >= 1 ? halfPi$3 : x <= -1 ? -halfPi$3 : Math.asin(x);\n}\n\nfunction arcInnerRadius(d) {\n return d.innerRadius;\n}\n\nfunction arcOuterRadius(d) {\n return d.outerRadius;\n}\n\nfunction arcStartAngle(d) {\n return d.startAngle;\n}\n\nfunction arcEndAngle(d) {\n return d.endAngle;\n}\n\nfunction arcPadAngle(d) {\n return d && d.padAngle; // Note: optional!\n}\n\nfunction intersect(x0, y0, x1, y1, x2, y2, x3, y3) {\n var x10 = x1 - x0, y10 = y1 - y0,\n x32 = x3 - x2, y32 = y3 - y2,\n t = (x32 * (y0 - y2) - y32 * (x0 - x2)) / (y32 * x10 - x32 * y10);\n return [x0 + t * x10, y0 + t * y10];\n}\n\n// Compute perpendicular offset line of length rc.\n// http://mathworld.wolfram.com/Circle-LineIntersection.html\nfunction cornerTangents(x0, y0, x1, y1, r1, rc, cw) {\n var x01 = x0 - x1,\n y01 = y0 - y1,\n lo = (cw ? rc : -rc) / sqrt$2(x01 * x01 + y01 * y01),\n ox = lo * y01,\n oy = -lo * x01,\n x11 = x0 + ox,\n y11 = y0 + oy,\n x10 = x1 + ox,\n y10 = y1 + oy,\n x00 = (x11 + x10) / 2,\n y00 = (y11 + y10) / 2,\n dx = x10 - x11,\n dy = y10 - y11,\n d2 = dx * dx + dy * dy,\n r = r1 - rc,\n D = x11 * y10 - x10 * y11,\n d = (dy < 0 ? -1 : 1) * sqrt$2(max$2(0, r * r * d2 - D * D)),\n cx0 = (D * dy - dx * d) / d2,\n cy0 = (-D * dx - dy * d) / d2,\n cx1 = (D * dy + dx * d) / d2,\n cy1 = (-D * dx + dy * d) / d2,\n dx0 = cx0 - x00,\n dy0 = cy0 - y00,\n dx1 = cx1 - x00,\n dy1 = cy1 - y00;\n\n // Pick the closer of the two intersection points.\n // TODO Is there a faster way to determine which intersection to use?\n if (dx0 * dx0 + dy0 * dy0 > dx1 * dx1 + dy1 * dy1) cx0 = cx1, cy0 = cy1;\n\n return {\n cx: cx0,\n cy: cy0,\n x01: -ox,\n y01: -oy,\n x11: cx0 * (r1 / r - 1),\n y11: cy0 * (r1 / r - 1)\n };\n}\n\nvar arc = function() {\n var innerRadius = arcInnerRadius,\n outerRadius = arcOuterRadius,\n cornerRadius = constant$10(0),\n padRadius = null,\n startAngle = arcStartAngle,\n endAngle = arcEndAngle,\n padAngle = arcPadAngle,\n context = null;\n\n function arc() {\n var buffer,\n r,\n r0 = +innerRadius.apply(this, arguments),\n r1 = +outerRadius.apply(this, arguments),\n a0 = startAngle.apply(this, arguments) - halfPi$3,\n a1 = endAngle.apply(this, arguments) - halfPi$3,\n da = abs$1(a1 - a0),\n cw = a1 > a0;\n\n if (!context) context = buffer = path();\n\n // Ensure that the outer radius is always larger than the inner radius.\n if (r1 < r0) r = r1, r1 = r0, r0 = r;\n\n // Is it a point?\n if (!(r1 > epsilon$3)) context.moveTo(0, 0);\n\n // Or is it a circle or annulus?\n else if (da > tau$4 - epsilon$3) {\n context.moveTo(r1 * cos$2(a0), r1 * sin$2(a0));\n context.arc(0, 0, r1, a0, a1, !cw);\n if (r0 > epsilon$3) {\n context.moveTo(r0 * cos$2(a1), r0 * sin$2(a1));\n context.arc(0, 0, r0, a1, a0, cw);\n }\n }\n\n // Or is it a circular or annular sector?\n else {\n var a01 = a0,\n a11 = a1,\n a00 = a0,\n a10 = a1,\n da0 = da,\n da1 = da,\n ap = padAngle.apply(this, arguments) / 2,\n rp = (ap > epsilon$3) && (padRadius ? +padRadius.apply(this, arguments) : sqrt$2(r0 * r0 + r1 * r1)),\n rc = min$1(abs$1(r1 - r0) / 2, +cornerRadius.apply(this, arguments)),\n rc0 = rc,\n rc1 = rc,\n t0,\n t1;\n\n // Apply padding? Note that since r1 ≥ r0, da1 ≥ da0.\n if (rp > epsilon$3) {\n var p0 = asin$1(rp / r0 * sin$2(ap)),\n p1 = asin$1(rp / r1 * sin$2(ap));\n if ((da0 -= p0 * 2) > epsilon$3) p0 *= (cw ? 1 : -1), a00 += p0, a10 -= p0;\n else da0 = 0, a00 = a10 = (a0 + a1) / 2;\n if ((da1 -= p1 * 2) > epsilon$3) p1 *= (cw ? 1 : -1), a01 += p1, a11 -= p1;\n else da1 = 0, a01 = a11 = (a0 + a1) / 2;\n }\n\n var x01 = r1 * cos$2(a01),\n y01 = r1 * sin$2(a01),\n x10 = r0 * cos$2(a10),\n y10 = r0 * sin$2(a10);\n\n // Apply rounded corners?\n if (rc > epsilon$3) {\n var x11 = r1 * cos$2(a11),\n y11 = r1 * sin$2(a11),\n x00 = r0 * cos$2(a00),\n y00 = r0 * sin$2(a00);\n\n // Restrict the corner radius according to the sector angle.\n if (da < pi$4) {\n var oc = da0 > epsilon$3 ? intersect(x01, y01, x00, y00, x11, y11, x10, y10) : [x10, y10],\n ax = x01 - oc[0],\n ay = y01 - oc[1],\n bx = x11 - oc[0],\n by = y11 - oc[1],\n kc = 1 / sin$2(acos$1((ax * bx + ay * by) / (sqrt$2(ax * ax + ay * ay) * sqrt$2(bx * bx + by * by))) / 2),\n lc = sqrt$2(oc[0] * oc[0] + oc[1] * oc[1]);\n rc0 = min$1(rc, (r0 - lc) / (kc - 1));\n rc1 = min$1(rc, (r1 - lc) / (kc + 1));\n }\n }\n\n // Is the sector collapsed to a line?\n if (!(da1 > epsilon$3)) context.moveTo(x01, y01);\n\n // Does the sector’s outer ring have rounded corners?\n else if (rc1 > epsilon$3) {\n t0 = cornerTangents(x00, y00, x01, y01, r1, rc1, cw);\n t1 = cornerTangents(x11, y11, x10, y10, r1, rc1, cw);\n\n context.moveTo(t0.cx + t0.x01, t0.cy + t0.y01);\n\n // Have the corners merged?\n if (rc1 < rc) context.arc(t0.cx, t0.cy, rc1, atan2$1(t0.y01, t0.x01), atan2$1(t1.y01, t1.x01), !cw);\n\n // Otherwise, draw the two corners and the ring.\n else {\n context.arc(t0.cx, t0.cy, rc1, atan2$1(t0.y01, t0.x01), atan2$1(t0.y11, t0.x11), !cw);\n context.arc(0, 0, r1, atan2$1(t0.cy + t0.y11, t0.cx + t0.x11), atan2$1(t1.cy + t1.y11, t1.cx + t1.x11), !cw);\n context.arc(t1.cx, t1.cy, rc1, atan2$1(t1.y11, t1.x11), atan2$1(t1.y01, t1.x01), !cw);\n }\n }\n\n // Or is the outer ring just a circular arc?\n else context.moveTo(x01, y01), context.arc(0, 0, r1, a01, a11, !cw);\n\n // Is there no inner ring, and it’s a circular sector?\n // Or perhaps it’s an annular sector collapsed due to padding?\n if (!(r0 > epsilon$3) || !(da0 > epsilon$3)) context.lineTo(x10, y10);\n\n // Does the sector’s inner ring (or point) have rounded corners?\n else if (rc0 > epsilon$3) {\n t0 = cornerTangents(x10, y10, x11, y11, r0, -rc0, cw);\n t1 = cornerTangents(x01, y01, x00, y00, r0, -rc0, cw);\n\n context.lineTo(t0.cx + t0.x01, t0.cy + t0.y01);\n\n // Have the corners merged?\n if (rc0 < rc) context.arc(t0.cx, t0.cy, rc0, atan2$1(t0.y01, t0.x01), atan2$1(t1.y01, t1.x01), !cw);\n\n // Otherwise, draw the two corners and the ring.\n else {\n context.arc(t0.cx, t0.cy, rc0, atan2$1(t0.y01, t0.x01), atan2$1(t0.y11, t0.x11), !cw);\n context.arc(0, 0, r0, atan2$1(t0.cy + t0.y11, t0.cx + t0.x11), atan2$1(t1.cy + t1.y11, t1.cx + t1.x11), cw);\n context.arc(t1.cx, t1.cy, rc0, atan2$1(t1.y11, t1.x11), atan2$1(t1.y01, t1.x01), !cw);\n }\n }\n\n // Or is the inner ring just a circular arc?\n else context.arc(0, 0, r0, a10, a00, cw);\n }\n\n context.closePath();\n\n if (buffer) return context = null, buffer + \"\" || null;\n }\n\n arc.centroid = function() {\n var r = (+innerRadius.apply(this, arguments) + +outerRadius.apply(this, arguments)) / 2,\n a = (+startAngle.apply(this, arguments) + +endAngle.apply(this, arguments)) / 2 - pi$4 / 2;\n return [cos$2(a) * r, sin$2(a) * r];\n };\n\n arc.innerRadius = function(_) {\n return arguments.length ? (innerRadius = typeof _ === \"function\" ? _ : constant$10(+_), arc) : innerRadius;\n };\n\n arc.outerRadius = function(_) {\n return arguments.length ? (outerRadius = typeof _ === \"function\" ? _ : constant$10(+_), arc) : outerRadius;\n };\n\n arc.cornerRadius = function(_) {\n return arguments.length ? (cornerRadius = typeof _ === \"function\" ? _ : constant$10(+_), arc) : cornerRadius;\n };\n\n arc.padRadius = function(_) {\n return arguments.length ? (padRadius = _ == null ? null : typeof _ === \"function\" ? _ : constant$10(+_), arc) : padRadius;\n };\n\n arc.startAngle = function(_) {\n return arguments.length ? (startAngle = typeof _ === \"function\" ? _ : constant$10(+_), arc) : startAngle;\n };\n\n arc.endAngle = function(_) {\n return arguments.length ? (endAngle = typeof _ === \"function\" ? _ : constant$10(+_), arc) : endAngle;\n };\n\n arc.padAngle = function(_) {\n return arguments.length ? (padAngle = typeof _ === \"function\" ? _ : constant$10(+_), arc) : padAngle;\n };\n\n arc.context = function(_) {\n return arguments.length ? ((context = _ == null ? null : _), arc) : context;\n };\n\n return arc;\n};\n\nfunction Linear(context) {\n this._context = context;\n}\n\nLinear.prototype = {\n areaStart: function() {\n this._line = 0;\n },\n areaEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._point = 0;\n },\n lineEnd: function() {\n if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();\n this._line = 1 - this._line;\n },\n point: function(x, y) {\n x = +x, y = +y;\n switch (this._point) {\n case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;\n case 1: this._point = 2; // proceed\n default: this._context.lineTo(x, y); break;\n }\n }\n};\n\nvar curveLinear = function(context) {\n return new Linear(context);\n};\n\nfunction x$3(p) {\n return p[0];\n}\n\nfunction y$3(p) {\n return p[1];\n}\n\nvar line = function() {\n var x$$1 = x$3,\n y$$1 = y$3,\n defined = constant$10(true),\n context = null,\n curve = curveLinear,\n output = null;\n\n function line(data) {\n var i,\n n = data.length,\n d,\n defined0 = false,\n buffer;\n\n if (context == null) output = curve(buffer = path());\n\n for (i = 0; i <= n; ++i) {\n if (!(i < n && defined(d = data[i], i, data)) === defined0) {\n if (defined0 = !defined0) output.lineStart();\n else output.lineEnd();\n }\n if (defined0) output.point(+x$$1(d, i, data), +y$$1(d, i, data));\n }\n\n if (buffer) return output = null, buffer + \"\" || null;\n }\n\n line.x = function(_) {\n return arguments.length ? (x$$1 = typeof _ === \"function\" ? _ : constant$10(+_), line) : x$$1;\n };\n\n line.y = function(_) {\n return arguments.length ? (y$$1 = typeof _ === \"function\" ? _ : constant$10(+_), line) : y$$1;\n };\n\n line.defined = function(_) {\n return arguments.length ? (defined = typeof _ === \"function\" ? _ : constant$10(!!_), line) : defined;\n };\n\n line.curve = function(_) {\n return arguments.length ? (curve = _, context != null && (output = curve(context)), line) : curve;\n };\n\n line.context = function(_) {\n return arguments.length ? (_ == null ? context = output = null : output = curve(context = _), line) : context;\n };\n\n return line;\n};\n\nvar area$2 = function() {\n var x0 = x$3,\n x1 = null,\n y0 = constant$10(0),\n y1 = y$3,\n defined = constant$10(true),\n context = null,\n curve = curveLinear,\n output = null;\n\n function area(data) {\n var i,\n j,\n k,\n n = data.length,\n d,\n defined0 = false,\n buffer,\n x0z = new Array(n),\n y0z = new Array(n);\n\n if (context == null) output = curve(buffer = path());\n\n for (i = 0; i <= n; ++i) {\n if (!(i < n && defined(d = data[i], i, data)) === defined0) {\n if (defined0 = !defined0) {\n j = i;\n output.areaStart();\n output.lineStart();\n } else {\n output.lineEnd();\n output.lineStart();\n for (k = i - 1; k >= j; --k) {\n output.point(x0z[k], y0z[k]);\n }\n output.lineEnd();\n output.areaEnd();\n }\n }\n if (defined0) {\n x0z[i] = +x0(d, i, data), y0z[i] = +y0(d, i, data);\n output.point(x1 ? +x1(d, i, data) : x0z[i], y1 ? +y1(d, i, data) : y0z[i]);\n }\n }\n\n if (buffer) return output = null, buffer + \"\" || null;\n }\n\n function arealine() {\n return line().defined(defined).curve(curve).context(context);\n }\n\n area.x = function(_) {\n return arguments.length ? (x0 = typeof _ === \"function\" ? _ : constant$10(+_), x1 = null, area) : x0;\n };\n\n area.x0 = function(_) {\n return arguments.length ? (x0 = typeof _ === \"function\" ? _ : constant$10(+_), area) : x0;\n };\n\n area.x1 = function(_) {\n return arguments.length ? (x1 = _ == null ? null : typeof _ === \"function\" ? _ : constant$10(+_), area) : x1;\n };\n\n area.y = function(_) {\n return arguments.length ? (y0 = typeof _ === \"function\" ? _ : constant$10(+_), y1 = null, area) : y0;\n };\n\n area.y0 = function(_) {\n return arguments.length ? (y0 = typeof _ === \"function\" ? _ : constant$10(+_), area) : y0;\n };\n\n area.y1 = function(_) {\n return arguments.length ? (y1 = _ == null ? null : typeof _ === \"function\" ? _ : constant$10(+_), area) : y1;\n };\n\n area.lineX0 =\n area.lineY0 = function() {\n return arealine().x(x0).y(y0);\n };\n\n area.lineY1 = function() {\n return arealine().x(x0).y(y1);\n };\n\n area.lineX1 = function() {\n return arealine().x(x1).y(y0);\n };\n\n area.defined = function(_) {\n return arguments.length ? (defined = typeof _ === \"function\" ? _ : constant$10(!!_), area) : defined;\n };\n\n area.curve = function(_) {\n return arguments.length ? (curve = _, context != null && (output = curve(context)), area) : curve;\n };\n\n area.context = function(_) {\n return arguments.length ? (_ == null ? context = output = null : output = curve(context = _), area) : context;\n };\n\n return area;\n};\n\nvar descending$1 = function(a, b) {\n return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN;\n};\n\nvar identity$7 = function(d) {\n return d;\n};\n\nvar pie = function() {\n var value = identity$7,\n sortValues = descending$1,\n sort = null,\n startAngle = constant$10(0),\n endAngle = constant$10(tau$4),\n padAngle = constant$10(0);\n\n function pie(data) {\n var i,\n n = data.length,\n j,\n k,\n sum = 0,\n index = new Array(n),\n arcs = new Array(n),\n a0 = +startAngle.apply(this, arguments),\n da = Math.min(tau$4, Math.max(-tau$4, endAngle.apply(this, arguments) - a0)),\n a1,\n p = Math.min(Math.abs(da) / n, padAngle.apply(this, arguments)),\n pa = p * (da < 0 ? -1 : 1),\n v;\n\n for (i = 0; i < n; ++i) {\n if ((v = arcs[index[i] = i] = +value(data[i], i, data)) > 0) {\n sum += v;\n }\n }\n\n // Optionally sort the arcs by previously-computed values or by data.\n if (sortValues != null) index.sort(function(i, j) { return sortValues(arcs[i], arcs[j]); });\n else if (sort != null) index.sort(function(i, j) { return sort(data[i], data[j]); });\n\n // Compute the arcs! They are stored in the original data's order.\n for (i = 0, k = sum ? (da - n * pa) / sum : 0; i < n; ++i, a0 = a1) {\n j = index[i], v = arcs[j], a1 = a0 + (v > 0 ? v * k : 0) + pa, arcs[j] = {\n data: data[j],\n index: i,\n value: v,\n startAngle: a0,\n endAngle: a1,\n padAngle: p\n };\n }\n\n return arcs;\n }\n\n pie.value = function(_) {\n return arguments.length ? (value = typeof _ === \"function\" ? _ : constant$10(+_), pie) : value;\n };\n\n pie.sortValues = function(_) {\n return arguments.length ? (sortValues = _, sort = null, pie) : sortValues;\n };\n\n pie.sort = function(_) {\n return arguments.length ? (sort = _, sortValues = null, pie) : sort;\n };\n\n pie.startAngle = function(_) {\n return arguments.length ? (startAngle = typeof _ === \"function\" ? _ : constant$10(+_), pie) : startAngle;\n };\n\n pie.endAngle = function(_) {\n return arguments.length ? (endAngle = typeof _ === \"function\" ? _ : constant$10(+_), pie) : endAngle;\n };\n\n pie.padAngle = function(_) {\n return arguments.length ? (padAngle = typeof _ === \"function\" ? _ : constant$10(+_), pie) : padAngle;\n };\n\n return pie;\n};\n\nvar curveRadialLinear = curveRadial(curveLinear);\n\nfunction Radial(curve) {\n this._curve = curve;\n}\n\nRadial.prototype = {\n areaStart: function() {\n this._curve.areaStart();\n },\n areaEnd: function() {\n this._curve.areaEnd();\n },\n lineStart: function() {\n this._curve.lineStart();\n },\n lineEnd: function() {\n this._curve.lineEnd();\n },\n point: function(a, r) {\n this._curve.point(r * Math.sin(a), r * -Math.cos(a));\n }\n};\n\nfunction curveRadial(curve) {\n\n function radial(context) {\n return new Radial(curve(context));\n }\n\n radial._curve = curve;\n\n return radial;\n}\n\nfunction lineRadial(l) {\n var c = l.curve;\n\n l.angle = l.x, delete l.x;\n l.radius = l.y, delete l.y;\n\n l.curve = function(_) {\n return arguments.length ? c(curveRadial(_)) : c()._curve;\n };\n\n return l;\n}\n\nvar lineRadial$1 = function() {\n return lineRadial(line().curve(curveRadialLinear));\n};\n\nvar areaRadial = function() {\n var a = area$2().curve(curveRadialLinear),\n c = a.curve,\n x0 = a.lineX0,\n x1 = a.lineX1,\n y0 = a.lineY0,\n y1 = a.lineY1;\n\n a.angle = a.x, delete a.x;\n a.startAngle = a.x0, delete a.x0;\n a.endAngle = a.x1, delete a.x1;\n a.radius = a.y, delete a.y;\n a.innerRadius = a.y0, delete a.y0;\n a.outerRadius = a.y1, delete a.y1;\n a.lineStartAngle = function() { return lineRadial(x0()); }, delete a.lineX0;\n a.lineEndAngle = function() { return lineRadial(x1()); }, delete a.lineX1;\n a.lineInnerRadius = function() { return lineRadial(y0()); }, delete a.lineY0;\n a.lineOuterRadius = function() { return lineRadial(y1()); }, delete a.lineY1;\n\n a.curve = function(_) {\n return arguments.length ? c(curveRadial(_)) : c()._curve;\n };\n\n return a;\n};\n\nvar pointRadial = function(x, y) {\n return [(y = +y) * Math.cos(x -= Math.PI / 2), y * Math.sin(x)];\n};\n\nvar slice$6 = Array.prototype.slice;\n\nfunction linkSource(d) {\n return d.source;\n}\n\nfunction linkTarget(d) {\n return d.target;\n}\n\nfunction link$2(curve) {\n var source = linkSource,\n target = linkTarget,\n x$$1 = x$3,\n y$$1 = y$3,\n context = null;\n\n function link() {\n var buffer, argv = slice$6.call(arguments), s = source.apply(this, argv), t = target.apply(this, argv);\n if (!context) context = buffer = path();\n curve(context, +x$$1.apply(this, (argv[0] = s, argv)), +y$$1.apply(this, argv), +x$$1.apply(this, (argv[0] = t, argv)), +y$$1.apply(this, argv));\n if (buffer) return context = null, buffer + \"\" || null;\n }\n\n link.source = function(_) {\n return arguments.length ? (source = _, link) : source;\n };\n\n link.target = function(_) {\n return arguments.length ? (target = _, link) : target;\n };\n\n link.x = function(_) {\n return arguments.length ? (x$$1 = typeof _ === \"function\" ? _ : constant$10(+_), link) : x$$1;\n };\n\n link.y = function(_) {\n return arguments.length ? (y$$1 = typeof _ === \"function\" ? _ : constant$10(+_), link) : y$$1;\n };\n\n link.context = function(_) {\n return arguments.length ? ((context = _ == null ? null : _), link) : context;\n };\n\n return link;\n}\n\nfunction curveHorizontal(context, x0, y0, x1, y1) {\n context.moveTo(x0, y0);\n context.bezierCurveTo(x0 = (x0 + x1) / 2, y0, x0, y1, x1, y1);\n}\n\nfunction curveVertical(context, x0, y0, x1, y1) {\n context.moveTo(x0, y0);\n context.bezierCurveTo(x0, y0 = (y0 + y1) / 2, x1, y0, x1, y1);\n}\n\nfunction curveRadial$1(context, x0, y0, x1, y1) {\n var p0 = pointRadial(x0, y0),\n p1 = pointRadial(x0, y0 = (y0 + y1) / 2),\n p2 = pointRadial(x1, y0),\n p3 = pointRadial(x1, y1);\n context.moveTo(p0[0], p0[1]);\n context.bezierCurveTo(p1[0], p1[1], p2[0], p2[1], p3[0], p3[1]);\n}\n\nfunction linkHorizontal() {\n return link$2(curveHorizontal);\n}\n\nfunction linkVertical() {\n return link$2(curveVertical);\n}\n\nfunction linkRadial() {\n var l = link$2(curveRadial$1);\n l.angle = l.x, delete l.x;\n l.radius = l.y, delete l.y;\n return l;\n}\n\nvar circle$2 = {\n draw: function(context, size) {\n var r = Math.sqrt(size / pi$4);\n context.moveTo(r, 0);\n context.arc(0, 0, r, 0, tau$4);\n }\n};\n\nvar cross$2 = {\n draw: function(context, size) {\n var r = Math.sqrt(size / 5) / 2;\n context.moveTo(-3 * r, -r);\n context.lineTo(-r, -r);\n context.lineTo(-r, -3 * r);\n context.lineTo(r, -3 * r);\n context.lineTo(r, -r);\n context.lineTo(3 * r, -r);\n context.lineTo(3 * r, r);\n context.lineTo(r, r);\n context.lineTo(r, 3 * r);\n context.lineTo(-r, 3 * r);\n context.lineTo(-r, r);\n context.lineTo(-3 * r, r);\n context.closePath();\n }\n};\n\nvar tan30 = Math.sqrt(1 / 3);\nvar tan30_2 = tan30 * 2;\n\nvar diamond = {\n draw: function(context, size) {\n var y = Math.sqrt(size / tan30_2),\n x = y * tan30;\n context.moveTo(0, -y);\n context.lineTo(x, 0);\n context.lineTo(0, y);\n context.lineTo(-x, 0);\n context.closePath();\n }\n};\n\nvar ka = 0.89081309152928522810;\nvar kr = Math.sin(pi$4 / 10) / Math.sin(7 * pi$4 / 10);\nvar kx = Math.sin(tau$4 / 10) * kr;\nvar ky = -Math.cos(tau$4 / 10) * kr;\n\nvar star = {\n draw: function(context, size) {\n var r = Math.sqrt(size * ka),\n x = kx * r,\n y = ky * r;\n context.moveTo(0, -r);\n context.lineTo(x, y);\n for (var i = 1; i < 5; ++i) {\n var a = tau$4 * i / 5,\n c = Math.cos(a),\n s = Math.sin(a);\n context.lineTo(s * r, -c * r);\n context.lineTo(c * x - s * y, s * x + c * y);\n }\n context.closePath();\n }\n};\n\nvar square = {\n draw: function(context, size) {\n var w = Math.sqrt(size),\n x = -w / 2;\n context.rect(x, x, w, w);\n }\n};\n\nvar sqrt3 = Math.sqrt(3);\n\nvar triangle = {\n draw: function(context, size) {\n var y = -Math.sqrt(size / (sqrt3 * 3));\n context.moveTo(0, y * 2);\n context.lineTo(-sqrt3 * y, -y);\n context.lineTo(sqrt3 * y, -y);\n context.closePath();\n }\n};\n\nvar c = -0.5;\nvar s = Math.sqrt(3) / 2;\nvar k = 1 / Math.sqrt(12);\nvar a = (k / 2 + 1) * 3;\n\nvar wye = {\n draw: function(context, size) {\n var r = Math.sqrt(size / a),\n x0 = r / 2,\n y0 = r * k,\n x1 = x0,\n y1 = r * k + r,\n x2 = -x1,\n y2 = y1;\n context.moveTo(x0, y0);\n context.lineTo(x1, y1);\n context.lineTo(x2, y2);\n context.lineTo(c * x0 - s * y0, s * x0 + c * y0);\n context.lineTo(c * x1 - s * y1, s * x1 + c * y1);\n context.lineTo(c * x2 - s * y2, s * x2 + c * y2);\n context.lineTo(c * x0 + s * y0, c * y0 - s * x0);\n context.lineTo(c * x1 + s * y1, c * y1 - s * x1);\n context.lineTo(c * x2 + s * y2, c * y2 - s * x2);\n context.closePath();\n }\n};\n\nvar symbols = [\n circle$2,\n cross$2,\n diamond,\n square,\n star,\n triangle,\n wye\n];\n\nvar symbol = function() {\n var type = constant$10(circle$2),\n size = constant$10(64),\n context = null;\n\n function symbol() {\n var buffer;\n if (!context) context = buffer = path();\n type.apply(this, arguments).draw(context, +size.apply(this, arguments));\n if (buffer) return context = null, buffer + \"\" || null;\n }\n\n symbol.type = function(_) {\n return arguments.length ? (type = typeof _ === \"function\" ? _ : constant$10(_), symbol) : type;\n };\n\n symbol.size = function(_) {\n return arguments.length ? (size = typeof _ === \"function\" ? _ : constant$10(+_), symbol) : size;\n };\n\n symbol.context = function(_) {\n return arguments.length ? (context = _ == null ? null : _, symbol) : context;\n };\n\n return symbol;\n};\n\nvar noop$2 = function() {};\n\nfunction point$2(that, x, y) {\n that._context.bezierCurveTo(\n (2 * that._x0 + that._x1) / 3,\n (2 * that._y0 + that._y1) / 3,\n (that._x0 + 2 * that._x1) / 3,\n (that._y0 + 2 * that._y1) / 3,\n (that._x0 + 4 * that._x1 + x) / 6,\n (that._y0 + 4 * that._y1 + y) / 6\n );\n}\n\nfunction Basis(context) {\n this._context = context;\n}\n\nBasis.prototype = {\n areaStart: function() {\n this._line = 0;\n },\n areaEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._x0 = this._x1 =\n this._y0 = this._y1 = NaN;\n this._point = 0;\n },\n lineEnd: function() {\n switch (this._point) {\n case 3: point$2(this, this._x1, this._y1); // proceed\n case 2: this._context.lineTo(this._x1, this._y1); break;\n }\n if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();\n this._line = 1 - this._line;\n },\n point: function(x, y) {\n x = +x, y = +y;\n switch (this._point) {\n case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;\n case 1: this._point = 2; break;\n case 2: this._point = 3; this._context.lineTo((5 * this._x0 + this._x1) / 6, (5 * this._y0 + this._y1) / 6); // proceed\n default: point$2(this, x, y); break;\n }\n this._x0 = this._x1, this._x1 = x;\n this._y0 = this._y1, this._y1 = y;\n }\n};\n\nvar basis$2 = function(context) {\n return new Basis(context);\n};\n\nfunction BasisClosed(context) {\n this._context = context;\n}\n\nBasisClosed.prototype = {\n areaStart: noop$2,\n areaEnd: noop$2,\n lineStart: function() {\n this._x0 = this._x1 = this._x2 = this._x3 = this._x4 =\n this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = NaN;\n this._point = 0;\n },\n lineEnd: function() {\n switch (this._point) {\n case 1: {\n this._context.moveTo(this._x2, this._y2);\n this._context.closePath();\n break;\n }\n case 2: {\n this._context.moveTo((this._x2 + 2 * this._x3) / 3, (this._y2 + 2 * this._y3) / 3);\n this._context.lineTo((this._x3 + 2 * this._x2) / 3, (this._y3 + 2 * this._y2) / 3);\n this._context.closePath();\n break;\n }\n case 3: {\n this.point(this._x2, this._y2);\n this.point(this._x3, this._y3);\n this.point(this._x4, this._y4);\n break;\n }\n }\n },\n point: function(x, y) {\n x = +x, y = +y;\n switch (this._point) {\n case 0: this._point = 1; this._x2 = x, this._y2 = y; break;\n case 1: this._point = 2; this._x3 = x, this._y3 = y; break;\n case 2: this._point = 3; this._x4 = x, this._y4 = y; this._context.moveTo((this._x0 + 4 * this._x1 + x) / 6, (this._y0 + 4 * this._y1 + y) / 6); break;\n default: point$2(this, x, y); break;\n }\n this._x0 = this._x1, this._x1 = x;\n this._y0 = this._y1, this._y1 = y;\n }\n};\n\nvar basisClosed$1 = function(context) {\n return new BasisClosed(context);\n};\n\nfunction BasisOpen(context) {\n this._context = context;\n}\n\nBasisOpen.prototype = {\n areaStart: function() {\n this._line = 0;\n },\n areaEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._x0 = this._x1 =\n this._y0 = this._y1 = NaN;\n this._point = 0;\n },\n lineEnd: function() {\n if (this._line || (this._line !== 0 && this._point === 3)) this._context.closePath();\n this._line = 1 - this._line;\n },\n point: function(x, y) {\n x = +x, y = +y;\n switch (this._point) {\n case 0: this._point = 1; break;\n case 1: this._point = 2; break;\n case 2: this._point = 3; var x0 = (this._x0 + 4 * this._x1 + x) / 6, y0 = (this._y0 + 4 * this._y1 + y) / 6; this._line ? this._context.lineTo(x0, y0) : this._context.moveTo(x0, y0); break;\n case 3: this._point = 4; // proceed\n default: point$2(this, x, y); break;\n }\n this._x0 = this._x1, this._x1 = x;\n this._y0 = this._y1, this._y1 = y;\n }\n};\n\nvar basisOpen = function(context) {\n return new BasisOpen(context);\n};\n\nfunction Bundle(context, beta) {\n this._basis = new Basis(context);\n this._beta = beta;\n}\n\nBundle.prototype = {\n lineStart: function() {\n this._x = [];\n this._y = [];\n this._basis.lineStart();\n },\n lineEnd: function() {\n var x = this._x,\n y = this._y,\n j = x.length - 1;\n\n if (j > 0) {\n var x0 = x[0],\n y0 = y[0],\n dx = x[j] - x0,\n dy = y[j] - y0,\n i = -1,\n t;\n\n while (++i <= j) {\n t = i / j;\n this._basis.point(\n this._beta * x[i] + (1 - this._beta) * (x0 + t * dx),\n this._beta * y[i] + (1 - this._beta) * (y0 + t * dy)\n );\n }\n }\n\n this._x = this._y = null;\n this._basis.lineEnd();\n },\n point: function(x, y) {\n this._x.push(+x);\n this._y.push(+y);\n }\n};\n\nvar bundle = (function custom(beta) {\n\n function bundle(context) {\n return beta === 1 ? new Basis(context) : new Bundle(context, beta);\n }\n\n bundle.beta = function(beta) {\n return custom(+beta);\n };\n\n return bundle;\n})(0.85);\n\nfunction point$3(that, x, y) {\n that._context.bezierCurveTo(\n that._x1 + that._k * (that._x2 - that._x0),\n that._y1 + that._k * (that._y2 - that._y0),\n that._x2 + that._k * (that._x1 - x),\n that._y2 + that._k * (that._y1 - y),\n that._x2,\n that._y2\n );\n}\n\nfunction Cardinal(context, tension) {\n this._context = context;\n this._k = (1 - tension) / 6;\n}\n\nCardinal.prototype = {\n areaStart: function() {\n this._line = 0;\n },\n areaEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._x0 = this._x1 = this._x2 =\n this._y0 = this._y1 = this._y2 = NaN;\n this._point = 0;\n },\n lineEnd: function() {\n switch (this._point) {\n case 2: this._context.lineTo(this._x2, this._y2); break;\n case 3: point$3(this, this._x1, this._y1); break;\n }\n if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();\n this._line = 1 - this._line;\n },\n point: function(x, y) {\n x = +x, y = +y;\n switch (this._point) {\n case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;\n case 1: this._point = 2; this._x1 = x, this._y1 = y; break;\n case 2: this._point = 3; // proceed\n default: point$3(this, x, y); break;\n }\n this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;\n this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;\n }\n};\n\nvar cardinal = (function custom(tension) {\n\n function cardinal(context) {\n return new Cardinal(context, tension);\n }\n\n cardinal.tension = function(tension) {\n return custom(+tension);\n };\n\n return cardinal;\n})(0);\n\nfunction CardinalClosed(context, tension) {\n this._context = context;\n this._k = (1 - tension) / 6;\n}\n\nCardinalClosed.prototype = {\n areaStart: noop$2,\n areaEnd: noop$2,\n lineStart: function() {\n this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._x5 =\n this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = this._y5 = NaN;\n this._point = 0;\n },\n lineEnd: function() {\n switch (this._point) {\n case 1: {\n this._context.moveTo(this._x3, this._y3);\n this._context.closePath();\n break;\n }\n case 2: {\n this._context.lineTo(this._x3, this._y3);\n this._context.closePath();\n break;\n }\n case 3: {\n this.point(this._x3, this._y3);\n this.point(this._x4, this._y4);\n this.point(this._x5, this._y5);\n break;\n }\n }\n },\n point: function(x, y) {\n x = +x, y = +y;\n switch (this._point) {\n case 0: this._point = 1; this._x3 = x, this._y3 = y; break;\n case 1: this._point = 2; this._context.moveTo(this._x4 = x, this._y4 = y); break;\n case 2: this._point = 3; this._x5 = x, this._y5 = y; break;\n default: point$3(this, x, y); break;\n }\n this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;\n this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;\n }\n};\n\nvar cardinalClosed = (function custom(tension) {\n\n function cardinal$$1(context) {\n return new CardinalClosed(context, tension);\n }\n\n cardinal$$1.tension = function(tension) {\n return custom(+tension);\n };\n\n return cardinal$$1;\n})(0);\n\nfunction CardinalOpen(context, tension) {\n this._context = context;\n this._k = (1 - tension) / 6;\n}\n\nCardinalOpen.prototype = {\n areaStart: function() {\n this._line = 0;\n },\n areaEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._x0 = this._x1 = this._x2 =\n this._y0 = this._y1 = this._y2 = NaN;\n this._point = 0;\n },\n lineEnd: function() {\n if (this._line || (this._line !== 0 && this._point === 3)) this._context.closePath();\n this._line = 1 - this._line;\n },\n point: function(x, y) {\n x = +x, y = +y;\n switch (this._point) {\n case 0: this._point = 1; break;\n case 1: this._point = 2; break;\n case 2: this._point = 3; this._line ? this._context.lineTo(this._x2, this._y2) : this._context.moveTo(this._x2, this._y2); break;\n case 3: this._point = 4; // proceed\n default: point$3(this, x, y); break;\n }\n this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;\n this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;\n }\n};\n\nvar cardinalOpen = (function custom(tension) {\n\n function cardinal$$1(context) {\n return new CardinalOpen(context, tension);\n }\n\n cardinal$$1.tension = function(tension) {\n return custom(+tension);\n };\n\n return cardinal$$1;\n})(0);\n\nfunction point$4(that, x, y) {\n var x1 = that._x1,\n y1 = that._y1,\n x2 = that._x2,\n y2 = that._y2;\n\n if (that._l01_a > epsilon$3) {\n var a = 2 * that._l01_2a + 3 * that._l01_a * that._l12_a + that._l12_2a,\n n = 3 * that._l01_a * (that._l01_a + that._l12_a);\n x1 = (x1 * a - that._x0 * that._l12_2a + that._x2 * that._l01_2a) / n;\n y1 = (y1 * a - that._y0 * that._l12_2a + that._y2 * that._l01_2a) / n;\n }\n\n if (that._l23_a > epsilon$3) {\n var b = 2 * that._l23_2a + 3 * that._l23_a * that._l12_a + that._l12_2a,\n m = 3 * that._l23_a * (that._l23_a + that._l12_a);\n x2 = (x2 * b + that._x1 * that._l23_2a - x * that._l12_2a) / m;\n y2 = (y2 * b + that._y1 * that._l23_2a - y * that._l12_2a) / m;\n }\n\n that._context.bezierCurveTo(x1, y1, x2, y2, that._x2, that._y2);\n}\n\nfunction CatmullRom(context, alpha) {\n this._context = context;\n this._alpha = alpha;\n}\n\nCatmullRom.prototype = {\n areaStart: function() {\n this._line = 0;\n },\n areaEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._x0 = this._x1 = this._x2 =\n this._y0 = this._y1 = this._y2 = NaN;\n this._l01_a = this._l12_a = this._l23_a =\n this._l01_2a = this._l12_2a = this._l23_2a =\n this._point = 0;\n },\n lineEnd: function() {\n switch (this._point) {\n case 2: this._context.lineTo(this._x2, this._y2); break;\n case 3: this.point(this._x2, this._y2); break;\n }\n if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();\n this._line = 1 - this._line;\n },\n point: function(x, y) {\n x = +x, y = +y;\n\n if (this._point) {\n var x23 = this._x2 - x,\n y23 = this._y2 - y;\n this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha));\n }\n\n switch (this._point) {\n case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;\n case 1: this._point = 2; break;\n case 2: this._point = 3; // proceed\n default: point$4(this, x, y); break;\n }\n\n this._l01_a = this._l12_a, this._l12_a = this._l23_a;\n this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a;\n this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;\n this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;\n }\n};\n\nvar catmullRom = (function custom(alpha) {\n\n function catmullRom(context) {\n return alpha ? new CatmullRom(context, alpha) : new Cardinal(context, 0);\n }\n\n catmullRom.alpha = function(alpha) {\n return custom(+alpha);\n };\n\n return catmullRom;\n})(0.5);\n\nfunction CatmullRomClosed(context, alpha) {\n this._context = context;\n this._alpha = alpha;\n}\n\nCatmullRomClosed.prototype = {\n areaStart: noop$2,\n areaEnd: noop$2,\n lineStart: function() {\n this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._x5 =\n this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = this._y5 = NaN;\n this._l01_a = this._l12_a = this._l23_a =\n this._l01_2a = this._l12_2a = this._l23_2a =\n this._point = 0;\n },\n lineEnd: function() {\n switch (this._point) {\n case 1: {\n this._context.moveTo(this._x3, this._y3);\n this._context.closePath();\n break;\n }\n case 2: {\n this._context.lineTo(this._x3, this._y3);\n this._context.closePath();\n break;\n }\n case 3: {\n this.point(this._x3, this._y3);\n this.point(this._x4, this._y4);\n this.point(this._x5, this._y5);\n break;\n }\n }\n },\n point: function(x, y) {\n x = +x, y = +y;\n\n if (this._point) {\n var x23 = this._x2 - x,\n y23 = this._y2 - y;\n this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha));\n }\n\n switch (this._point) {\n case 0: this._point = 1; this._x3 = x, this._y3 = y; break;\n case 1: this._point = 2; this._context.moveTo(this._x4 = x, this._y4 = y); break;\n case 2: this._point = 3; this._x5 = x, this._y5 = y; break;\n default: point$4(this, x, y); break;\n }\n\n this._l01_a = this._l12_a, this._l12_a = this._l23_a;\n this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a;\n this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;\n this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;\n }\n};\n\nvar catmullRomClosed = (function custom(alpha) {\n\n function catmullRom$$1(context) {\n return alpha ? new CatmullRomClosed(context, alpha) : new CardinalClosed(context, 0);\n }\n\n catmullRom$$1.alpha = function(alpha) {\n return custom(+alpha);\n };\n\n return catmullRom$$1;\n})(0.5);\n\nfunction CatmullRomOpen(context, alpha) {\n this._context = context;\n this._alpha = alpha;\n}\n\nCatmullRomOpen.prototype = {\n areaStart: function() {\n this._line = 0;\n },\n areaEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._x0 = this._x1 = this._x2 =\n this._y0 = this._y1 = this._y2 = NaN;\n this._l01_a = this._l12_a = this._l23_a =\n this._l01_2a = this._l12_2a = this._l23_2a =\n this._point = 0;\n },\n lineEnd: function() {\n if (this._line || (this._line !== 0 && this._point === 3)) this._context.closePath();\n this._line = 1 - this._line;\n },\n point: function(x, y) {\n x = +x, y = +y;\n\n if (this._point) {\n var x23 = this._x2 - x,\n y23 = this._y2 - y;\n this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha));\n }\n\n switch (this._point) {\n case 0: this._point = 1; break;\n case 1: this._point = 2; break;\n case 2: this._point = 3; this._line ? this._context.lineTo(this._x2, this._y2) : this._context.moveTo(this._x2, this._y2); break;\n case 3: this._point = 4; // proceed\n default: point$4(this, x, y); break;\n }\n\n this._l01_a = this._l12_a, this._l12_a = this._l23_a;\n this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a;\n this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;\n this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;\n }\n};\n\nvar catmullRomOpen = (function custom(alpha) {\n\n function catmullRom$$1(context) {\n return alpha ? new CatmullRomOpen(context, alpha) : new CardinalOpen(context, 0);\n }\n\n catmullRom$$1.alpha = function(alpha) {\n return custom(+alpha);\n };\n\n return catmullRom$$1;\n})(0.5);\n\nfunction LinearClosed(context) {\n this._context = context;\n}\n\nLinearClosed.prototype = {\n areaStart: noop$2,\n areaEnd: noop$2,\n lineStart: function() {\n this._point = 0;\n },\n lineEnd: function() {\n if (this._point) this._context.closePath();\n },\n point: function(x, y) {\n x = +x, y = +y;\n if (this._point) this._context.lineTo(x, y);\n else this._point = 1, this._context.moveTo(x, y);\n }\n};\n\nvar linearClosed = function(context) {\n return new LinearClosed(context);\n};\n\nfunction sign$1(x) {\n return x < 0 ? -1 : 1;\n}\n\n// Calculate the slopes of the tangents (Hermite-type interpolation) based on\n// the following paper: Steffen, M. 1990. A Simple Method for Monotonic\n// Interpolation in One Dimension. Astronomy and Astrophysics, Vol. 239, NO.\n// NOV(II), P. 443, 1990.\nfunction slope3(that, x2, y2) {\n var h0 = that._x1 - that._x0,\n h1 = x2 - that._x1,\n s0 = (that._y1 - that._y0) / (h0 || h1 < 0 && -0),\n s1 = (y2 - that._y1) / (h1 || h0 < 0 && -0),\n p = (s0 * h1 + s1 * h0) / (h0 + h1);\n return (sign$1(s0) + sign$1(s1)) * Math.min(Math.abs(s0), Math.abs(s1), 0.5 * Math.abs(p)) || 0;\n}\n\n// Calculate a one-sided slope.\nfunction slope2(that, t) {\n var h = that._x1 - that._x0;\n return h ? (3 * (that._y1 - that._y0) / h - t) / 2 : t;\n}\n\n// According to https://en.wikipedia.org/wiki/Cubic_Hermite_spline#Representations\n// \"you can express cubic Hermite interpolation in terms of cubic Bézier curves\n// with respect to the four values p0, p0 + m0 / 3, p1 - m1 / 3, p1\".\nfunction point$5(that, t0, t1) {\n var x0 = that._x0,\n y0 = that._y0,\n x1 = that._x1,\n y1 = that._y1,\n dx = (x1 - x0) / 3;\n that._context.bezierCurveTo(x0 + dx, y0 + dx * t0, x1 - dx, y1 - dx * t1, x1, y1);\n}\n\nfunction MonotoneX(context) {\n this._context = context;\n}\n\nMonotoneX.prototype = {\n areaStart: function() {\n this._line = 0;\n },\n areaEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._x0 = this._x1 =\n this._y0 = this._y1 =\n this._t0 = NaN;\n this._point = 0;\n },\n lineEnd: function() {\n switch (this._point) {\n case 2: this._context.lineTo(this._x1, this._y1); break;\n case 3: point$5(this, this._t0, slope2(this, this._t0)); break;\n }\n if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();\n this._line = 1 - this._line;\n },\n point: function(x, y) {\n var t1 = NaN;\n\n x = +x, y = +y;\n if (x === this._x1 && y === this._y1) return; // Ignore coincident points.\n switch (this._point) {\n case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;\n case 1: this._point = 2; break;\n case 2: this._point = 3; point$5(this, slope2(this, t1 = slope3(this, x, y)), t1); break;\n default: point$5(this, this._t0, t1 = slope3(this, x, y)); break;\n }\n\n this._x0 = this._x1, this._x1 = x;\n this._y0 = this._y1, this._y1 = y;\n this._t0 = t1;\n }\n};\n\nfunction MonotoneY(context) {\n this._context = new ReflectContext(context);\n}\n\n(MonotoneY.prototype = Object.create(MonotoneX.prototype)).point = function(x, y) {\n MonotoneX.prototype.point.call(this, y, x);\n};\n\nfunction ReflectContext(context) {\n this._context = context;\n}\n\nReflectContext.prototype = {\n moveTo: function(x, y) { this._context.moveTo(y, x); },\n closePath: function() { this._context.closePath(); },\n lineTo: function(x, y) { this._context.lineTo(y, x); },\n bezierCurveTo: function(x1, y1, x2, y2, x, y) { this._context.bezierCurveTo(y1, x1, y2, x2, y, x); }\n};\n\nfunction monotoneX(context) {\n return new MonotoneX(context);\n}\n\nfunction monotoneY(context) {\n return new MonotoneY(context);\n}\n\nfunction Natural(context) {\n this._context = context;\n}\n\nNatural.prototype = {\n areaStart: function() {\n this._line = 0;\n },\n areaEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._x = [];\n this._y = [];\n },\n lineEnd: function() {\n var x = this._x,\n y = this._y,\n n = x.length;\n\n if (n) {\n this._line ? this._context.lineTo(x[0], y[0]) : this._context.moveTo(x[0], y[0]);\n if (n === 2) {\n this._context.lineTo(x[1], y[1]);\n } else {\n var px = controlPoints(x),\n py = controlPoints(y);\n for (var i0 = 0, i1 = 1; i1 < n; ++i0, ++i1) {\n this._context.bezierCurveTo(px[0][i0], py[0][i0], px[1][i0], py[1][i0], x[i1], y[i1]);\n }\n }\n }\n\n if (this._line || (this._line !== 0 && n === 1)) this._context.closePath();\n this._line = 1 - this._line;\n this._x = this._y = null;\n },\n point: function(x, y) {\n this._x.push(+x);\n this._y.push(+y);\n }\n};\n\n// See https://www.particleincell.com/2012/bezier-splines/ for derivation.\nfunction controlPoints(x) {\n var i,\n n = x.length - 1,\n m,\n a = new Array(n),\n b = new Array(n),\n r = new Array(n);\n a[0] = 0, b[0] = 2, r[0] = x[0] + 2 * x[1];\n for (i = 1; i < n - 1; ++i) a[i] = 1, b[i] = 4, r[i] = 4 * x[i] + 2 * x[i + 1];\n a[n - 1] = 2, b[n - 1] = 7, r[n - 1] = 8 * x[n - 1] + x[n];\n for (i = 1; i < n; ++i) m = a[i] / b[i - 1], b[i] -= m, r[i] -= m * r[i - 1];\n a[n - 1] = r[n - 1] / b[n - 1];\n for (i = n - 2; i >= 0; --i) a[i] = (r[i] - a[i + 1]) / b[i];\n b[n - 1] = (x[n] + a[n - 1]) / 2;\n for (i = 0; i < n - 1; ++i) b[i] = 2 * x[i + 1] - a[i + 1];\n return [a, b];\n}\n\nvar natural = function(context) {\n return new Natural(context);\n};\n\nfunction Step(context, t) {\n this._context = context;\n this._t = t;\n}\n\nStep.prototype = {\n areaStart: function() {\n this._line = 0;\n },\n areaEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._x = this._y = NaN;\n this._point = 0;\n },\n lineEnd: function() {\n if (0 < this._t && this._t < 1 && this._point === 2) this._context.lineTo(this._x, this._y);\n if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();\n if (this._line >= 0) this._t = 1 - this._t, this._line = 1 - this._line;\n },\n point: function(x, y) {\n x = +x, y = +y;\n switch (this._point) {\n case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;\n case 1: this._point = 2; // proceed\n default: {\n if (this._t <= 0) {\n this._context.lineTo(this._x, y);\n this._context.lineTo(x, y);\n } else {\n var x1 = this._x * (1 - this._t) + x * this._t;\n this._context.lineTo(x1, this._y);\n this._context.lineTo(x1, y);\n }\n break;\n }\n }\n this._x = x, this._y = y;\n }\n};\n\nvar step = function(context) {\n return new Step(context, 0.5);\n};\n\nfunction stepBefore(context) {\n return new Step(context, 0);\n}\n\nfunction stepAfter(context) {\n return new Step(context, 1);\n}\n\nvar none$1 = function(series, order) {\n if (!((n = series.length) > 1)) return;\n for (var i = 1, j, s0, s1 = series[order[0]], n, m = s1.length; i < n; ++i) {\n s0 = s1, s1 = series[order[i]];\n for (j = 0; j < m; ++j) {\n s1[j][1] += s1[j][0] = isNaN(s0[j][1]) ? s0[j][0] : s0[j][1];\n }\n }\n};\n\nvar none$2 = function(series) {\n var n = series.length, o = new Array(n);\n while (--n >= 0) o[n] = n;\n return o;\n};\n\nfunction stackValue(d, key) {\n return d[key];\n}\n\nvar stack = function() {\n var keys = constant$10([]),\n order = none$2,\n offset = none$1,\n value = stackValue;\n\n function stack(data) {\n var kz = keys.apply(this, arguments),\n i,\n m = data.length,\n n = kz.length,\n sz = new Array(n),\n oz;\n\n for (i = 0; i < n; ++i) {\n for (var ki = kz[i], si = sz[i] = new Array(m), j = 0, sij; j < m; ++j) {\n si[j] = sij = [0, +value(data[j], ki, j, data)];\n sij.data = data[j];\n }\n si.key = ki;\n }\n\n for (i = 0, oz = order(sz); i < n; ++i) {\n sz[oz[i]].index = i;\n }\n\n offset(sz, oz);\n return sz;\n }\n\n stack.keys = function(_) {\n return arguments.length ? (keys = typeof _ === \"function\" ? _ : constant$10(slice$6.call(_)), stack) : keys;\n };\n\n stack.value = function(_) {\n return arguments.length ? (value = typeof _ === \"function\" ? _ : constant$10(+_), stack) : value;\n };\n\n stack.order = function(_) {\n return arguments.length ? (order = _ == null ? none$2 : typeof _ === \"function\" ? _ : constant$10(slice$6.call(_)), stack) : order;\n };\n\n stack.offset = function(_) {\n return arguments.length ? (offset = _ == null ? none$1 : _, stack) : offset;\n };\n\n return stack;\n};\n\nvar expand = function(series, order) {\n if (!((n = series.length) > 0)) return;\n for (var i, n, j = 0, m = series[0].length, y; j < m; ++j) {\n for (y = i = 0; i < n; ++i) y += series[i][j][1] || 0;\n if (y) for (i = 0; i < n; ++i) series[i][j][1] /= y;\n }\n none$1(series, order);\n};\n\nvar diverging = function(series, order) {\n if (!((n = series.length) > 1)) return;\n for (var i, j = 0, d, dy, yp, yn, n, m = series[order[0]].length; j < m; ++j) {\n for (yp = yn = 0, i = 0; i < n; ++i) {\n if ((dy = (d = series[order[i]][j])[1] - d[0]) >= 0) {\n d[0] = yp, d[1] = yp += dy;\n } else if (dy < 0) {\n d[1] = yn, d[0] = yn += dy;\n } else {\n d[0] = yp;\n }\n }\n }\n};\n\nvar silhouette = function(series, order) {\n if (!((n = series.length) > 0)) return;\n for (var j = 0, s0 = series[order[0]], n, m = s0.length; j < m; ++j) {\n for (var i = 0, y = 0; i < n; ++i) y += series[i][j][1] || 0;\n s0[j][1] += s0[j][0] = -y / 2;\n }\n none$1(series, order);\n};\n\nvar wiggle = function(series, order) {\n if (!((n = series.length) > 0) || !((m = (s0 = series[order[0]]).length) > 0)) return;\n for (var y = 0, j = 1, s0, m, n; j < m; ++j) {\n for (var i = 0, s1 = 0, s2 = 0; i < n; ++i) {\n var si = series[order[i]],\n sij0 = si[j][1] || 0,\n sij1 = si[j - 1][1] || 0,\n s3 = (sij0 - sij1) / 2;\n for (var k = 0; k < i; ++k) {\n var sk = series[order[k]],\n skj0 = sk[j][1] || 0,\n skj1 = sk[j - 1][1] || 0;\n s3 += skj0 - skj1;\n }\n s1 += sij0, s2 += s3 * sij0;\n }\n s0[j - 1][1] += s0[j - 1][0] = y;\n if (s1) y -= s2 / s1;\n }\n s0[j - 1][1] += s0[j - 1][0] = y;\n none$1(series, order);\n};\n\nvar ascending$2 = function(series) {\n var sums = series.map(sum$2);\n return none$2(series).sort(function(a, b) { return sums[a] - sums[b]; });\n};\n\nfunction sum$2(series) {\n var s = 0, i = -1, n = series.length, v;\n while (++i < n) if (v = +series[i][1]) s += v;\n return s;\n}\n\nvar descending$2 = function(series) {\n return ascending$2(series).reverse();\n};\n\nvar insideOut = function(series) {\n var n = series.length,\n i,\n j,\n sums = series.map(sum$2),\n order = none$2(series).sort(function(a, b) { return sums[b] - sums[a]; }),\n top = 0,\n bottom = 0,\n tops = [],\n bottoms = [];\n\n for (i = 0; i < n; ++i) {\n j = order[i];\n if (top < bottom) {\n top += sums[j];\n tops.push(j);\n } else {\n bottom += sums[j];\n bottoms.push(j);\n }\n }\n\n return bottoms.reverse().concat(tops);\n};\n\nvar reverse = function(series) {\n return none$2(series).reverse();\n};\n\nvar constant$11 = function(x) {\n return function() {\n return x;\n };\n};\n\nfunction x$4(d) {\n return d[0];\n}\n\nfunction y$4(d) {\n return d[1];\n}\n\nfunction RedBlackTree() {\n this._ = null; // root node\n}\n\nfunction RedBlackNode(node) {\n node.U = // parent node\n node.C = // color - true for red, false for black\n node.L = // left node\n node.R = // right node\n node.P = // previous node\n node.N = null; // next node\n}\n\nRedBlackTree.prototype = {\n constructor: RedBlackTree,\n\n insert: function(after, node) {\n var parent, grandpa, uncle;\n\n if (after) {\n node.P = after;\n node.N = after.N;\n if (after.N) after.N.P = node;\n after.N = node;\n if (after.R) {\n after = after.R;\n while (after.L) after = after.L;\n after.L = node;\n } else {\n after.R = node;\n }\n parent = after;\n } else if (this._) {\n after = RedBlackFirst(this._);\n node.P = null;\n node.N = after;\n after.P = after.L = node;\n parent = after;\n } else {\n node.P = node.N = null;\n this._ = node;\n parent = null;\n }\n node.L = node.R = null;\n node.U = parent;\n node.C = true;\n\n after = node;\n while (parent && parent.C) {\n grandpa = parent.U;\n if (parent === grandpa.L) {\n uncle = grandpa.R;\n if (uncle && uncle.C) {\n parent.C = uncle.C = false;\n grandpa.C = true;\n after = grandpa;\n } else {\n if (after === parent.R) {\n RedBlackRotateLeft(this, parent);\n after = parent;\n parent = after.U;\n }\n parent.C = false;\n grandpa.C = true;\n RedBlackRotateRight(this, grandpa);\n }\n } else {\n uncle = grandpa.L;\n if (uncle && uncle.C) {\n parent.C = uncle.C = false;\n grandpa.C = true;\n after = grandpa;\n } else {\n if (after === parent.L) {\n RedBlackRotateRight(this, parent);\n after = parent;\n parent = after.U;\n }\n parent.C = false;\n grandpa.C = true;\n RedBlackRotateLeft(this, grandpa);\n }\n }\n parent = after.U;\n }\n this._.C = false;\n },\n\n remove: function(node) {\n if (node.N) node.N.P = node.P;\n if (node.P) node.P.N = node.N;\n node.N = node.P = null;\n\n var parent = node.U,\n sibling,\n left = node.L,\n right = node.R,\n next,\n red;\n\n if (!left) next = right;\n else if (!right) next = left;\n else next = RedBlackFirst(right);\n\n if (parent) {\n if (parent.L === node) parent.L = next;\n else parent.R = next;\n } else {\n this._ = next;\n }\n\n if (left && right) {\n red = next.C;\n next.C = node.C;\n next.L = left;\n left.U = next;\n if (next !== right) {\n parent = next.U;\n next.U = node.U;\n node = next.R;\n parent.L = node;\n next.R = right;\n right.U = next;\n } else {\n next.U = parent;\n parent = next;\n node = next.R;\n }\n } else {\n red = node.C;\n node = next;\n }\n\n if (node) node.U = parent;\n if (red) return;\n if (node && node.C) { node.C = false; return; }\n\n do {\n if (node === this._) break;\n if (node === parent.L) {\n sibling = parent.R;\n if (sibling.C) {\n sibling.C = false;\n parent.C = true;\n RedBlackRotateLeft(this, parent);\n sibling = parent.R;\n }\n if ((sibling.L && sibling.L.C)\n || (sibling.R && sibling.R.C)) {\n if (!sibling.R || !sibling.R.C) {\n sibling.L.C = false;\n sibling.C = true;\n RedBlackRotateRight(this, sibling);\n sibling = parent.R;\n }\n sibling.C = parent.C;\n parent.C = sibling.R.C = false;\n RedBlackRotateLeft(this, parent);\n node = this._;\n break;\n }\n } else {\n sibling = parent.L;\n if (sibling.C) {\n sibling.C = false;\n parent.C = true;\n RedBlackRotateRight(this, parent);\n sibling = parent.L;\n }\n if ((sibling.L && sibling.L.C)\n || (sibling.R && sibling.R.C)) {\n if (!sibling.L || !sibling.L.C) {\n sibling.R.C = false;\n sibling.C = true;\n RedBlackRotateLeft(this, sibling);\n sibling = parent.L;\n }\n sibling.C = parent.C;\n parent.C = sibling.L.C = false;\n RedBlackRotateRight(this, parent);\n node = this._;\n break;\n }\n }\n sibling.C = true;\n node = parent;\n parent = parent.U;\n } while (!node.C);\n\n if (node) node.C = false;\n }\n};\n\nfunction RedBlackRotateLeft(tree, node) {\n var p = node,\n q = node.R,\n parent = p.U;\n\n if (parent) {\n if (parent.L === p) parent.L = q;\n else parent.R = q;\n } else {\n tree._ = q;\n }\n\n q.U = parent;\n p.U = q;\n p.R = q.L;\n if (p.R) p.R.U = p;\n q.L = p;\n}\n\nfunction RedBlackRotateRight(tree, node) {\n var p = node,\n q = node.L,\n parent = p.U;\n\n if (parent) {\n if (parent.L === p) parent.L = q;\n else parent.R = q;\n } else {\n tree._ = q;\n }\n\n q.U = parent;\n p.U = q;\n p.L = q.R;\n if (p.L) p.L.U = p;\n q.R = p;\n}\n\nfunction RedBlackFirst(node) {\n while (node.L) node = node.L;\n return node;\n}\n\nfunction createEdge(left, right, v0, v1) {\n var edge = [null, null],\n index = edges.push(edge) - 1;\n edge.left = left;\n edge.right = right;\n if (v0) setEdgeEnd(edge, left, right, v0);\n if (v1) setEdgeEnd(edge, right, left, v1);\n cells[left.index].halfedges.push(index);\n cells[right.index].halfedges.push(index);\n return edge;\n}\n\nfunction createBorderEdge(left, v0, v1) {\n var edge = [v0, v1];\n edge.left = left;\n return edge;\n}\n\nfunction setEdgeEnd(edge, left, right, vertex) {\n if (!edge[0] && !edge[1]) {\n edge[0] = vertex;\n edge.left = left;\n edge.right = right;\n } else if (edge.left === right) {\n edge[1] = vertex;\n } else {\n edge[0] = vertex;\n }\n}\n\n// Liang–Barsky line clipping.\nfunction clipEdge(edge, x0, y0, x1, y1) {\n var a = edge[0],\n b = edge[1],\n ax = a[0],\n ay = a[1],\n bx = b[0],\n by = b[1],\n t0 = 0,\n t1 = 1,\n dx = bx - ax,\n dy = by - ay,\n r;\n\n r = x0 - ax;\n if (!dx && r > 0) return;\n r /= dx;\n if (dx < 0) {\n if (r < t0) return;\n if (r < t1) t1 = r;\n } else if (dx > 0) {\n if (r > t1) return;\n if (r > t0) t0 = r;\n }\n\n r = x1 - ax;\n if (!dx && r < 0) return;\n r /= dx;\n if (dx < 0) {\n if (r > t1) return;\n if (r > t0) t0 = r;\n } else if (dx > 0) {\n if (r < t0) return;\n if (r < t1) t1 = r;\n }\n\n r = y0 - ay;\n if (!dy && r > 0) return;\n r /= dy;\n if (dy < 0) {\n if (r < t0) return;\n if (r < t1) t1 = r;\n } else if (dy > 0) {\n if (r > t1) return;\n if (r > t0) t0 = r;\n }\n\n r = y1 - ay;\n if (!dy && r < 0) return;\n r /= dy;\n if (dy < 0) {\n if (r > t1) return;\n if (r > t0) t0 = r;\n } else if (dy > 0) {\n if (r < t0) return;\n if (r < t1) t1 = r;\n }\n\n if (!(t0 > 0) && !(t1 < 1)) return true; // TODO Better check?\n\n if (t0 > 0) edge[0] = [ax + t0 * dx, ay + t0 * dy];\n if (t1 < 1) edge[1] = [ax + t1 * dx, ay + t1 * dy];\n return true;\n}\n\nfunction connectEdge(edge, x0, y0, x1, y1) {\n var v1 = edge[1];\n if (v1) return true;\n\n var v0 = edge[0],\n left = edge.left,\n right = edge.right,\n lx = left[0],\n ly = left[1],\n rx = right[0],\n ry = right[1],\n fx = (lx + rx) / 2,\n fy = (ly + ry) / 2,\n fm,\n fb;\n\n if (ry === ly) {\n if (fx < x0 || fx >= x1) return;\n if (lx > rx) {\n if (!v0) v0 = [fx, y0];\n else if (v0[1] >= y1) return;\n v1 = [fx, y1];\n } else {\n if (!v0) v0 = [fx, y1];\n else if (v0[1] < y0) return;\n v1 = [fx, y0];\n }\n } else {\n fm = (lx - rx) / (ry - ly);\n fb = fy - fm * fx;\n if (fm < -1 || fm > 1) {\n if (lx > rx) {\n if (!v0) v0 = [(y0 - fb) / fm, y0];\n else if (v0[1] >= y1) return;\n v1 = [(y1 - fb) / fm, y1];\n } else {\n if (!v0) v0 = [(y1 - fb) / fm, y1];\n else if (v0[1] < y0) return;\n v1 = [(y0 - fb) / fm, y0];\n }\n } else {\n if (ly < ry) {\n if (!v0) v0 = [x0, fm * x0 + fb];\n else if (v0[0] >= x1) return;\n v1 = [x1, fm * x1 + fb];\n } else {\n if (!v0) v0 = [x1, fm * x1 + fb];\n else if (v0[0] < x0) return;\n v1 = [x0, fm * x0 + fb];\n }\n }\n }\n\n edge[0] = v0;\n edge[1] = v1;\n return true;\n}\n\nfunction clipEdges(x0, y0, x1, y1) {\n var i = edges.length,\n edge;\n\n while (i--) {\n if (!connectEdge(edge = edges[i], x0, y0, x1, y1)\n || !clipEdge(edge, x0, y0, x1, y1)\n || !(Math.abs(edge[0][0] - edge[1][0]) > epsilon$4\n || Math.abs(edge[0][1] - edge[1][1]) > epsilon$4)) {\n delete edges[i];\n }\n }\n}\n\nfunction createCell(site) {\n return cells[site.index] = {\n site: site,\n halfedges: []\n };\n}\n\nfunction cellHalfedgeAngle(cell, edge) {\n var site = cell.site,\n va = edge.left,\n vb = edge.right;\n if (site === vb) vb = va, va = site;\n if (vb) return Math.atan2(vb[1] - va[1], vb[0] - va[0]);\n if (site === va) va = edge[1], vb = edge[0];\n else va = edge[0], vb = edge[1];\n return Math.atan2(va[0] - vb[0], vb[1] - va[1]);\n}\n\nfunction cellHalfedgeStart(cell, edge) {\n return edge[+(edge.left !== cell.site)];\n}\n\nfunction cellHalfedgeEnd(cell, edge) {\n return edge[+(edge.left === cell.site)];\n}\n\nfunction sortCellHalfedges() {\n for (var i = 0, n = cells.length, cell, halfedges, j, m; i < n; ++i) {\n if ((cell = cells[i]) && (m = (halfedges = cell.halfedges).length)) {\n var index = new Array(m),\n array = new Array(m);\n for (j = 0; j < m; ++j) index[j] = j, array[j] = cellHalfedgeAngle(cell, edges[halfedges[j]]);\n index.sort(function(i, j) { return array[j] - array[i]; });\n for (j = 0; j < m; ++j) array[j] = halfedges[index[j]];\n for (j = 0; j < m; ++j) halfedges[j] = array[j];\n }\n }\n}\n\nfunction clipCells(x0, y0, x1, y1) {\n var nCells = cells.length,\n iCell,\n cell,\n site,\n iHalfedge,\n halfedges,\n nHalfedges,\n start,\n startX,\n startY,\n end,\n endX,\n endY,\n cover = true;\n\n for (iCell = 0; iCell < nCells; ++iCell) {\n if (cell = cells[iCell]) {\n site = cell.site;\n halfedges = cell.halfedges;\n iHalfedge = halfedges.length;\n\n // Remove any dangling clipped edges.\n while (iHalfedge--) {\n if (!edges[halfedges[iHalfedge]]) {\n halfedges.splice(iHalfedge, 1);\n }\n }\n\n // Insert any border edges as necessary.\n iHalfedge = 0, nHalfedges = halfedges.length;\n while (iHalfedge < nHalfedges) {\n end = cellHalfedgeEnd(cell, edges[halfedges[iHalfedge]]), endX = end[0], endY = end[1];\n start = cellHalfedgeStart(cell, edges[halfedges[++iHalfedge % nHalfedges]]), startX = start[0], startY = start[1];\n if (Math.abs(endX - startX) > epsilon$4 || Math.abs(endY - startY) > epsilon$4) {\n halfedges.splice(iHalfedge, 0, edges.push(createBorderEdge(site, end,\n Math.abs(endX - x0) < epsilon$4 && y1 - endY > epsilon$4 ? [x0, Math.abs(startX - x0) < epsilon$4 ? startY : y1]\n : Math.abs(endY - y1) < epsilon$4 && x1 - endX > epsilon$4 ? [Math.abs(startY - y1) < epsilon$4 ? startX : x1, y1]\n : Math.abs(endX - x1) < epsilon$4 && endY - y0 > epsilon$4 ? [x1, Math.abs(startX - x1) < epsilon$4 ? startY : y0]\n : Math.abs(endY - y0) < epsilon$4 && endX - x0 > epsilon$4 ? [Math.abs(startY - y0) < epsilon$4 ? startX : x0, y0]\n : null)) - 1);\n ++nHalfedges;\n }\n }\n\n if (nHalfedges) cover = false;\n }\n }\n\n // If there weren’t any edges, have the closest site cover the extent.\n // It doesn’t matter which corner of the extent we measure!\n if (cover) {\n var dx, dy, d2, dc = Infinity;\n\n for (iCell = 0, cover = null; iCell < nCells; ++iCell) {\n if (cell = cells[iCell]) {\n site = cell.site;\n dx = site[0] - x0;\n dy = site[1] - y0;\n d2 = dx * dx + dy * dy;\n if (d2 < dc) dc = d2, cover = cell;\n }\n }\n\n if (cover) {\n var v00 = [x0, y0], v01 = [x0, y1], v11 = [x1, y1], v10 = [x1, y0];\n cover.halfedges.push(\n edges.push(createBorderEdge(site = cover.site, v00, v01)) - 1,\n edges.push(createBorderEdge(site, v01, v11)) - 1,\n edges.push(createBorderEdge(site, v11, v10)) - 1,\n edges.push(createBorderEdge(site, v10, v00)) - 1\n );\n }\n }\n\n // Lastly delete any cells with no edges; these were entirely clipped.\n for (iCell = 0; iCell < nCells; ++iCell) {\n if (cell = cells[iCell]) {\n if (!cell.halfedges.length) {\n delete cells[iCell];\n }\n }\n }\n}\n\nvar circlePool = [];\n\nvar firstCircle;\n\nfunction Circle() {\n RedBlackNode(this);\n this.x =\n this.y =\n this.arc =\n this.site =\n this.cy = null;\n}\n\nfunction attachCircle(arc) {\n var lArc = arc.P,\n rArc = arc.N;\n\n if (!lArc || !rArc) return;\n\n var lSite = lArc.site,\n cSite = arc.site,\n rSite = rArc.site;\n\n if (lSite === rSite) return;\n\n var bx = cSite[0],\n by = cSite[1],\n ax = lSite[0] - bx,\n ay = lSite[1] - by,\n cx = rSite[0] - bx,\n cy = rSite[1] - by;\n\n var d = 2 * (ax * cy - ay * cx);\n if (d >= -epsilon2$2) return;\n\n var ha = ax * ax + ay * ay,\n hc = cx * cx + cy * cy,\n x = (cy * ha - ay * hc) / d,\n y = (ax * hc - cx * ha) / d;\n\n var circle = circlePool.pop() || new Circle;\n circle.arc = arc;\n circle.site = cSite;\n circle.x = x + bx;\n circle.y = (circle.cy = y + by) + Math.sqrt(x * x + y * y); // y bottom\n\n arc.circle = circle;\n\n var before = null,\n node = circles._;\n\n while (node) {\n if (circle.y < node.y || (circle.y === node.y && circle.x <= node.x)) {\n if (node.L) node = node.L;\n else { before = node.P; break; }\n } else {\n if (node.R) node = node.R;\n else { before = node; break; }\n }\n }\n\n circles.insert(before, circle);\n if (!before) firstCircle = circle;\n}\n\nfunction detachCircle(arc) {\n var circle = arc.circle;\n if (circle) {\n if (!circle.P) firstCircle = circle.N;\n circles.remove(circle);\n circlePool.push(circle);\n RedBlackNode(circle);\n arc.circle = null;\n }\n}\n\nvar beachPool = [];\n\nfunction Beach() {\n RedBlackNode(this);\n this.edge =\n this.site =\n this.circle = null;\n}\n\nfunction createBeach(site) {\n var beach = beachPool.pop() || new Beach;\n beach.site = site;\n return beach;\n}\n\nfunction detachBeach(beach) {\n detachCircle(beach);\n beaches.remove(beach);\n beachPool.push(beach);\n RedBlackNode(beach);\n}\n\nfunction removeBeach(beach) {\n var circle = beach.circle,\n x = circle.x,\n y = circle.cy,\n vertex = [x, y],\n previous = beach.P,\n next = beach.N,\n disappearing = [beach];\n\n detachBeach(beach);\n\n var lArc = previous;\n while (lArc.circle\n && Math.abs(x - lArc.circle.x) < epsilon$4\n && Math.abs(y - lArc.circle.cy) < epsilon$4) {\n previous = lArc.P;\n disappearing.unshift(lArc);\n detachBeach(lArc);\n lArc = previous;\n }\n\n disappearing.unshift(lArc);\n detachCircle(lArc);\n\n var rArc = next;\n while (rArc.circle\n && Math.abs(x - rArc.circle.x) < epsilon$4\n && Math.abs(y - rArc.circle.cy) < epsilon$4) {\n next = rArc.N;\n disappearing.push(rArc);\n detachBeach(rArc);\n rArc = next;\n }\n\n disappearing.push(rArc);\n detachCircle(rArc);\n\n var nArcs = disappearing.length,\n iArc;\n for (iArc = 1; iArc < nArcs; ++iArc) {\n rArc = disappearing[iArc];\n lArc = disappearing[iArc - 1];\n setEdgeEnd(rArc.edge, lArc.site, rArc.site, vertex);\n }\n\n lArc = disappearing[0];\n rArc = disappearing[nArcs - 1];\n rArc.edge = createEdge(lArc.site, rArc.site, null, vertex);\n\n attachCircle(lArc);\n attachCircle(rArc);\n}\n\nfunction addBeach(site) {\n var x = site[0],\n directrix = site[1],\n lArc,\n rArc,\n dxl,\n dxr,\n node = beaches._;\n\n while (node) {\n dxl = leftBreakPoint(node, directrix) - x;\n if (dxl > epsilon$4) node = node.L; else {\n dxr = x - rightBreakPoint(node, directrix);\n if (dxr > epsilon$4) {\n if (!node.R) {\n lArc = node;\n break;\n }\n node = node.R;\n } else {\n if (dxl > -epsilon$4) {\n lArc = node.P;\n rArc = node;\n } else if (dxr > -epsilon$4) {\n lArc = node;\n rArc = node.N;\n } else {\n lArc = rArc = node;\n }\n break;\n }\n }\n }\n\n createCell(site);\n var newArc = createBeach(site);\n beaches.insert(lArc, newArc);\n\n if (!lArc && !rArc) return;\n\n if (lArc === rArc) {\n detachCircle(lArc);\n rArc = createBeach(lArc.site);\n beaches.insert(newArc, rArc);\n newArc.edge = rArc.edge = createEdge(lArc.site, newArc.site);\n attachCircle(lArc);\n attachCircle(rArc);\n return;\n }\n\n if (!rArc) { // && lArc\n newArc.edge = createEdge(lArc.site, newArc.site);\n return;\n }\n\n // else lArc !== rArc\n detachCircle(lArc);\n detachCircle(rArc);\n\n var lSite = lArc.site,\n ax = lSite[0],\n ay = lSite[1],\n bx = site[0] - ax,\n by = site[1] - ay,\n rSite = rArc.site,\n cx = rSite[0] - ax,\n cy = rSite[1] - ay,\n d = 2 * (bx * cy - by * cx),\n hb = bx * bx + by * by,\n hc = cx * cx + cy * cy,\n vertex = [(cy * hb - by * hc) / d + ax, (bx * hc - cx * hb) / d + ay];\n\n setEdgeEnd(rArc.edge, lSite, rSite, vertex);\n newArc.edge = createEdge(lSite, site, null, vertex);\n rArc.edge = createEdge(site, rSite, null, vertex);\n attachCircle(lArc);\n attachCircle(rArc);\n}\n\nfunction leftBreakPoint(arc, directrix) {\n var site = arc.site,\n rfocx = site[0],\n rfocy = site[1],\n pby2 = rfocy - directrix;\n\n if (!pby2) return rfocx;\n\n var lArc = arc.P;\n if (!lArc) return -Infinity;\n\n site = lArc.site;\n var lfocx = site[0],\n lfocy = site[1],\n plby2 = lfocy - directrix;\n\n if (!plby2) return lfocx;\n\n var hl = lfocx - rfocx,\n aby2 = 1 / pby2 - 1 / plby2,\n b = hl / plby2;\n\n if (aby2) return (-b + Math.sqrt(b * b - 2 * aby2 * (hl * hl / (-2 * plby2) - lfocy + plby2 / 2 + rfocy - pby2 / 2))) / aby2 + rfocx;\n\n return (rfocx + lfocx) / 2;\n}\n\nfunction rightBreakPoint(arc, directrix) {\n var rArc = arc.N;\n if (rArc) return leftBreakPoint(rArc, directrix);\n var site = arc.site;\n return site[1] === directrix ? site[0] : Infinity;\n}\n\nvar epsilon$4 = 1e-6;\nvar epsilon2$2 = 1e-12;\nvar beaches;\nvar cells;\nvar circles;\nvar edges;\n\nfunction triangleArea(a, b, c) {\n return (a[0] - c[0]) * (b[1] - a[1]) - (a[0] - b[0]) * (c[1] - a[1]);\n}\n\nfunction lexicographic(a, b) {\n return b[1] - a[1]\n || b[0] - a[0];\n}\n\nfunction Diagram(sites, extent) {\n var site = sites.sort(lexicographic).pop(),\n x,\n y,\n circle;\n\n edges = [];\n cells = new Array(sites.length);\n beaches = new RedBlackTree;\n circles = new RedBlackTree;\n\n while (true) {\n circle = firstCircle;\n if (site && (!circle || site[1] < circle.y || (site[1] === circle.y && site[0] < circle.x))) {\n if (site[0] !== x || site[1] !== y) {\n addBeach(site);\n x = site[0], y = site[1];\n }\n site = sites.pop();\n } else if (circle) {\n removeBeach(circle.arc);\n } else {\n break;\n }\n }\n\n sortCellHalfedges();\n\n if (extent) {\n var x0 = +extent[0][0],\n y0 = +extent[0][1],\n x1 = +extent[1][0],\n y1 = +extent[1][1];\n clipEdges(x0, y0, x1, y1);\n clipCells(x0, y0, x1, y1);\n }\n\n this.edges = edges;\n this.cells = cells;\n\n beaches =\n circles =\n edges =\n cells = null;\n}\n\nDiagram.prototype = {\n constructor: Diagram,\n\n polygons: function() {\n var edges = this.edges;\n\n return this.cells.map(function(cell) {\n var polygon = cell.halfedges.map(function(i) { return cellHalfedgeStart(cell, edges[i]); });\n polygon.data = cell.site.data;\n return polygon;\n });\n },\n\n triangles: function() {\n var triangles = [],\n edges = this.edges;\n\n this.cells.forEach(function(cell, i) {\n if (!(m = (halfedges = cell.halfedges).length)) return;\n var site = cell.site,\n halfedges,\n j = -1,\n m,\n s0,\n e1 = edges[halfedges[m - 1]],\n s1 = e1.left === site ? e1.right : e1.left;\n\n while (++j < m) {\n s0 = s1;\n e1 = edges[halfedges[j]];\n s1 = e1.left === site ? e1.right : e1.left;\n if (s0 && s1 && i < s0.index && i < s1.index && triangleArea(site, s0, s1) < 0) {\n triangles.push([site.data, s0.data, s1.data]);\n }\n }\n });\n\n return triangles;\n },\n\n links: function() {\n return this.edges.filter(function(edge) {\n return edge.right;\n }).map(function(edge) {\n return {\n source: edge.left.data,\n target: edge.right.data\n };\n });\n },\n\n find: function(x, y, radius) {\n var that = this, i0, i1 = that._found || 0, n = that.cells.length, cell;\n\n // Use the previously-found cell, or start with an arbitrary one.\n while (!(cell = that.cells[i1])) if (++i1 >= n) return null;\n var dx = x - cell.site[0], dy = y - cell.site[1], d2 = dx * dx + dy * dy;\n\n // Traverse the half-edges to find a closer cell, if any.\n do {\n cell = that.cells[i0 = i1], i1 = null;\n cell.halfedges.forEach(function(e) {\n var edge = that.edges[e], v = edge.left;\n if ((v === cell.site || !v) && !(v = edge.right)) return;\n var vx = x - v[0], vy = y - v[1], v2 = vx * vx + vy * vy;\n if (v2 < d2) d2 = v2, i1 = v.index;\n });\n } while (i1 !== null);\n\n that._found = i0;\n\n return radius == null || d2 <= radius * radius ? cell.site : null;\n }\n};\n\nvar voronoi = function() {\n var x$$1 = x$4,\n y$$1 = y$4,\n extent = null;\n\n function voronoi(data) {\n return new Diagram(data.map(function(d, i) {\n var s = [Math.round(x$$1(d, i, data) / epsilon$4) * epsilon$4, Math.round(y$$1(d, i, data) / epsilon$4) * epsilon$4];\n s.index = i;\n s.data = d;\n return s;\n }), extent);\n }\n\n voronoi.polygons = function(data) {\n return voronoi(data).polygons();\n };\n\n voronoi.links = function(data) {\n return voronoi(data).links();\n };\n\n voronoi.triangles = function(data) {\n return voronoi(data).triangles();\n };\n\n voronoi.x = function(_) {\n return arguments.length ? (x$$1 = typeof _ === \"function\" ? _ : constant$11(+_), voronoi) : x$$1;\n };\n\n voronoi.y = function(_) {\n return arguments.length ? (y$$1 = typeof _ === \"function\" ? _ : constant$11(+_), voronoi) : y$$1;\n };\n\n voronoi.extent = function(_) {\n return arguments.length ? (extent = _ == null ? null : [[+_[0][0], +_[0][1]], [+_[1][0], +_[1][1]]], voronoi) : extent && [[extent[0][0], extent[0][1]], [extent[1][0], extent[1][1]]];\n };\n\n voronoi.size = function(_) {\n return arguments.length ? (extent = _ == null ? null : [[0, 0], [+_[0], +_[1]]], voronoi) : extent && [extent[1][0] - extent[0][0], extent[1][1] - extent[0][1]];\n };\n\n return voronoi;\n};\n\nvar constant$12 = function(x) {\n return function() {\n return x;\n };\n};\n\nfunction ZoomEvent(target, type, transform) {\n this.target = target;\n this.type = type;\n this.transform = transform;\n}\n\nfunction Transform(k, x, y) {\n this.k = k;\n this.x = x;\n this.y = y;\n}\n\nTransform.prototype = {\n constructor: Transform,\n scale: function(k) {\n return k === 1 ? this : new Transform(this.k * k, this.x, this.y);\n },\n translate: function(x, y) {\n return x === 0 & y === 0 ? this : new Transform(this.k, this.x + this.k * x, this.y + this.k * y);\n },\n apply: function(point) {\n return [point[0] * this.k + this.x, point[1] * this.k + this.y];\n },\n applyX: function(x) {\n return x * this.k + this.x;\n },\n applyY: function(y) {\n return y * this.k + this.y;\n },\n invert: function(location) {\n return [(location[0] - this.x) / this.k, (location[1] - this.y) / this.k];\n },\n invertX: function(x) {\n return (x - this.x) / this.k;\n },\n invertY: function(y) {\n return (y - this.y) / this.k;\n },\n rescaleX: function(x) {\n return x.copy().domain(x.range().map(this.invertX, this).map(x.invert, x));\n },\n rescaleY: function(y) {\n return y.copy().domain(y.range().map(this.invertY, this).map(y.invert, y));\n },\n toString: function() {\n return \"translate(\" + this.x + \",\" + this.y + \") scale(\" + this.k + \")\";\n }\n};\n\nvar identity$8 = new Transform(1, 0, 0);\n\ntransform$1.prototype = Transform.prototype;\n\nfunction transform$1(node) {\n return node.__zoom || identity$8;\n}\n\nfunction nopropagation$2() {\n exports.event.stopImmediatePropagation();\n}\n\nvar noevent$2 = function() {\n exports.event.preventDefault();\n exports.event.stopImmediatePropagation();\n};\n\n// Ignore right-click, since that should open the context menu.\nfunction defaultFilter$2() {\n return !exports.event.button;\n}\n\nfunction defaultExtent$1() {\n var e = this, w, h;\n if (e instanceof SVGElement) {\n e = e.ownerSVGElement || e;\n w = e.width.baseVal.value;\n h = e.height.baseVal.value;\n } else {\n w = e.clientWidth;\n h = e.clientHeight;\n }\n return [[0, 0], [w, h]];\n}\n\nfunction defaultTransform() {\n return this.__zoom || identity$8;\n}\n\nfunction defaultWheelDelta() {\n return -exports.event.deltaY * (exports.event.deltaMode ? 120 : 1) / 500;\n}\n\nfunction defaultTouchable$1() {\n return \"ontouchstart\" in this;\n}\n\nvar zoom = function() {\n var filter = defaultFilter$2,\n extent = defaultExtent$1,\n wheelDelta = defaultWheelDelta,\n touchable = defaultTouchable$1,\n k0 = 0,\n k1 = Infinity,\n x0 = -k1,\n x1 = k1,\n y0 = x0,\n y1 = x1,\n duration = 250,\n interpolate = interpolateZoom,\n gestures = [],\n listeners = dispatch(\"start\", \"zoom\", \"end\"),\n touchstarting,\n touchending,\n touchDelay = 500,\n wheelDelay = 150,\n clickDistance2 = 0;\n\n function zoom(selection) {\n selection\n .property(\"__zoom\", defaultTransform)\n .on(\"wheel.zoom\", wheeled)\n .on(\"mousedown.zoom\", mousedowned)\n .on(\"dblclick.zoom\", dblclicked)\n .filter(touchable)\n .on(\"touchstart.zoom\", touchstarted)\n .on(\"touchmove.zoom\", touchmoved)\n .on(\"touchend.zoom touchcancel.zoom\", touchended)\n .style(\"touch-action\", \"none\")\n .style(\"-webkit-tap-highlight-color\", \"rgba(0,0,0,0)\");\n }\n\n zoom.transform = function(collection, transform$$1) {\n var selection = collection.selection ? collection.selection() : collection;\n selection.property(\"__zoom\", defaultTransform);\n if (collection !== selection) {\n schedule(collection, transform$$1);\n } else {\n selection.interrupt().each(function() {\n gesture(this, arguments)\n .start()\n .zoom(null, typeof transform$$1 === \"function\" ? transform$$1.apply(this, arguments) : transform$$1)\n .end();\n });\n }\n };\n\n zoom.scaleBy = function(selection, k) {\n zoom.scaleTo(selection, function() {\n var k0 = this.__zoom.k,\n k1 = typeof k === \"function\" ? k.apply(this, arguments) : k;\n return k0 * k1;\n });\n };\n\n zoom.scaleTo = function(selection, k) {\n zoom.transform(selection, function() {\n var e = extent.apply(this, arguments),\n t0 = this.__zoom,\n p0 = centroid(e),\n p1 = t0.invert(p0),\n k1 = typeof k === \"function\" ? k.apply(this, arguments) : k;\n return constrain(translate(scale(t0, k1), p0, p1), e);\n });\n };\n\n zoom.translateBy = function(selection, x, y) {\n zoom.transform(selection, function() {\n return constrain(this.__zoom.translate(\n typeof x === \"function\" ? x.apply(this, arguments) : x,\n typeof y === \"function\" ? y.apply(this, arguments) : y\n ), extent.apply(this, arguments));\n });\n };\n\n zoom.translateTo = function(selection, x, y) {\n zoom.transform(selection, function() {\n var e = extent.apply(this, arguments),\n t = this.__zoom,\n p = centroid(e);\n return constrain(identity$8.translate(p[0], p[1]).scale(t.k).translate(\n typeof x === \"function\" ? -x.apply(this, arguments) : -x,\n typeof y === \"function\" ? -y.apply(this, arguments) : -y\n ), e);\n });\n };\n\n function scale(transform$$1, k) {\n k = Math.max(k0, Math.min(k1, k));\n return k === transform$$1.k ? transform$$1 : new Transform(k, transform$$1.x, transform$$1.y);\n }\n\n function translate(transform$$1, p0, p1) {\n var x = p0[0] - p1[0] * transform$$1.k, y = p0[1] - p1[1] * transform$$1.k;\n return x === transform$$1.x && y === transform$$1.y ? transform$$1 : new Transform(transform$$1.k, x, y);\n }\n\n function constrain(transform$$1, extent) {\n var dx0 = transform$$1.invertX(extent[0][0]) - x0,\n dx1 = transform$$1.invertX(extent[1][0]) - x1,\n dy0 = transform$$1.invertY(extent[0][1]) - y0,\n dy1 = transform$$1.invertY(extent[1][1]) - y1;\n return transform$$1.translate(\n dx1 > dx0 ? (dx0 + dx1) / 2 : Math.min(0, dx0) || Math.max(0, dx1),\n dy1 > dy0 ? (dy0 + dy1) / 2 : Math.min(0, dy0) || Math.max(0, dy1)\n );\n }\n\n function centroid(extent) {\n return [(+extent[0][0] + +extent[1][0]) / 2, (+extent[0][1] + +extent[1][1]) / 2];\n }\n\n function schedule(transition, transform$$1, center) {\n transition\n .on(\"start.zoom\", function() { gesture(this, arguments).start(); })\n .on(\"interrupt.zoom end.zoom\", function() { gesture(this, arguments).end(); })\n .tween(\"zoom\", function() {\n var that = this,\n args = arguments,\n g = gesture(that, args),\n e = extent.apply(that, args),\n p = center || centroid(e),\n w = Math.max(e[1][0] - e[0][0], e[1][1] - e[0][1]),\n a = that.__zoom,\n b = typeof transform$$1 === \"function\" ? transform$$1.apply(that, args) : transform$$1,\n i = interpolate(a.invert(p).concat(w / a.k), b.invert(p).concat(w / b.k));\n return function(t) {\n if (t === 1) t = b; // Avoid rounding error on end.\n else { var l = i(t), k = w / l[2]; t = new Transform(k, p[0] - l[0] * k, p[1] - l[1] * k); }\n g.zoom(null, t);\n };\n });\n }\n\n function gesture(that, args) {\n for (var i = 0, n = gestures.length, g; i < n; ++i) {\n if ((g = gestures[i]).that === that) {\n return g;\n }\n }\n return new Gesture(that, args);\n }\n\n function Gesture(that, args) {\n this.that = that;\n this.args = args;\n this.index = -1;\n this.active = 0;\n this.extent = extent.apply(that, args);\n }\n\n Gesture.prototype = {\n start: function() {\n if (++this.active === 1) {\n this.index = gestures.push(this) - 1;\n this.emit(\"start\");\n }\n return this;\n },\n zoom: function(key, transform$$1) {\n if (this.mouse && key !== \"mouse\") this.mouse[1] = transform$$1.invert(this.mouse[0]);\n if (this.touch0 && key !== \"touch\") this.touch0[1] = transform$$1.invert(this.touch0[0]);\n if (this.touch1 && key !== \"touch\") this.touch1[1] = transform$$1.invert(this.touch1[0]);\n this.that.__zoom = transform$$1;\n this.emit(\"zoom\");\n return this;\n },\n end: function() {\n if (--this.active === 0) {\n gestures.splice(this.index, 1);\n this.index = -1;\n this.emit(\"end\");\n }\n return this;\n },\n emit: function(type) {\n customEvent(new ZoomEvent(zoom, type, this.that.__zoom), listeners.apply, listeners, [type, this.that, this.args]);\n }\n };\n\n function wheeled() {\n if (!filter.apply(this, arguments)) return;\n var g = gesture(this, arguments),\n t = this.__zoom,\n k = Math.max(k0, Math.min(k1, t.k * Math.pow(2, wheelDelta.apply(this, arguments)))),\n p = mouse(this);\n\n // If the mouse is in the same location as before, reuse it.\n // If there were recent wheel events, reset the wheel idle timeout.\n if (g.wheel) {\n if (g.mouse[0][0] !== p[0] || g.mouse[0][1] !== p[1]) {\n g.mouse[1] = t.invert(g.mouse[0] = p);\n }\n clearTimeout(g.wheel);\n }\n\n // If this wheel event won’t trigger a transform change, ignore it.\n else if (t.k === k) return;\n\n // Otherwise, capture the mouse point and location at the start.\n else {\n g.mouse = [p, t.invert(p)];\n interrupt(this);\n g.start();\n }\n\n noevent$2();\n g.wheel = setTimeout(wheelidled, wheelDelay);\n g.zoom(\"mouse\", constrain(translate(scale(t, k), g.mouse[0], g.mouse[1]), g.extent));\n\n function wheelidled() {\n g.wheel = null;\n g.end();\n }\n }\n\n function mousedowned() {\n if (touchending || !filter.apply(this, arguments)) return;\n var g = gesture(this, arguments),\n v = select(exports.event.view).on(\"mousemove.zoom\", mousemoved, true).on(\"mouseup.zoom\", mouseupped, true),\n p = mouse(this),\n x0 = exports.event.clientX,\n y0 = exports.event.clientY;\n\n dragDisable(exports.event.view);\n nopropagation$2();\n g.mouse = [p, this.__zoom.invert(p)];\n interrupt(this);\n g.start();\n\n function mousemoved() {\n noevent$2();\n if (!g.moved) {\n var dx = exports.event.clientX - x0, dy = exports.event.clientY - y0;\n g.moved = dx * dx + dy * dy > clickDistance2;\n }\n g.zoom(\"mouse\", constrain(translate(g.that.__zoom, g.mouse[0] = mouse(g.that), g.mouse[1]), g.extent));\n }\n\n function mouseupped() {\n v.on(\"mousemove.zoom mouseup.zoom\", null);\n yesdrag(exports.event.view, g.moved);\n noevent$2();\n g.end();\n }\n }\n\n function dblclicked() {\n if (!filter.apply(this, arguments)) return;\n var t0 = this.__zoom,\n p0 = mouse(this),\n p1 = t0.invert(p0),\n k1 = t0.k * (exports.event.shiftKey ? 0.5 : 2),\n t1 = constrain(translate(scale(t0, k1), p0, p1), extent.apply(this, arguments));\n\n noevent$2();\n if (duration > 0) select(this).transition().duration(duration).call(schedule, t1, p0);\n else select(this).call(zoom.transform, t1);\n }\n\n function touchstarted() {\n if (!filter.apply(this, arguments)) return;\n var g = gesture(this, arguments),\n touches = exports.event.changedTouches,\n started,\n n = touches.length, i, t, p;\n\n nopropagation$2();\n for (i = 0; i < n; ++i) {\n t = touches[i], p = touch(this, touches, t.identifier);\n p = [p, this.__zoom.invert(p), t.identifier];\n if (!g.touch0) g.touch0 = p, started = true;\n else if (!g.touch1) g.touch1 = p;\n }\n\n // If this is a dbltap, reroute to the (optional) dblclick.zoom handler.\n if (touchstarting) {\n touchstarting = clearTimeout(touchstarting);\n if (!g.touch1) {\n g.end();\n p = select(this).on(\"dblclick.zoom\");\n if (p) p.apply(this, arguments);\n return;\n }\n }\n\n if (started) {\n touchstarting = setTimeout(function() { touchstarting = null; }, touchDelay);\n interrupt(this);\n g.start();\n }\n }\n\n function touchmoved() {\n var g = gesture(this, arguments),\n touches = exports.event.changedTouches,\n n = touches.length, i, t, p, l;\n\n noevent$2();\n if (touchstarting) touchstarting = clearTimeout(touchstarting);\n for (i = 0; i < n; ++i) {\n t = touches[i], p = touch(this, touches, t.identifier);\n if (g.touch0 && g.touch0[2] === t.identifier) g.touch0[0] = p;\n else if (g.touch1 && g.touch1[2] === t.identifier) g.touch1[0] = p;\n }\n t = g.that.__zoom;\n if (g.touch1) {\n var p0 = g.touch0[0], l0 = g.touch0[1],\n p1 = g.touch1[0], l1 = g.touch1[1],\n dp = (dp = p1[0] - p0[0]) * dp + (dp = p1[1] - p0[1]) * dp,\n dl = (dl = l1[0] - l0[0]) * dl + (dl = l1[1] - l0[1]) * dl;\n t = scale(t, Math.sqrt(dp / dl));\n p = [(p0[0] + p1[0]) / 2, (p0[1] + p1[1]) / 2];\n l = [(l0[0] + l1[0]) / 2, (l0[1] + l1[1]) / 2];\n }\n else if (g.touch0) p = g.touch0[0], l = g.touch0[1];\n else return;\n g.zoom(\"touch\", constrain(translate(t, p, l), g.extent));\n }\n\n function touchended() {\n var g = gesture(this, arguments),\n touches = exports.event.changedTouches,\n n = touches.length, i, t;\n\n nopropagation$2();\n if (touchending) clearTimeout(touchending);\n touchending = setTimeout(function() { touchending = null; }, touchDelay);\n for (i = 0; i < n; ++i) {\n t = touches[i];\n if (g.touch0 && g.touch0[2] === t.identifier) delete g.touch0;\n else if (g.touch1 && g.touch1[2] === t.identifier) delete g.touch1;\n }\n if (g.touch1 && !g.touch0) g.touch0 = g.touch1, delete g.touch1;\n if (g.touch0) g.touch0[1] = this.__zoom.invert(g.touch0[0]);\n else g.end();\n }\n\n zoom.wheelDelta = function(_) {\n return arguments.length ? (wheelDelta = typeof _ === \"function\" ? _ : constant$12(+_), zoom) : wheelDelta;\n };\n\n zoom.filter = function(_) {\n return arguments.length ? (filter = typeof _ === \"function\" ? _ : constant$12(!!_), zoom) : filter;\n };\n\n zoom.touchable = function(_) {\n return arguments.length ? (touchable = typeof _ === \"function\" ? _ : constant$12(!!_), zoom) : touchable;\n };\n\n zoom.extent = function(_) {\n return arguments.length ? (extent = typeof _ === \"function\" ? _ : constant$12([[+_[0][0], +_[0][1]], [+_[1][0], +_[1][1]]]), zoom) : extent;\n };\n\n zoom.scaleExtent = function(_) {\n return arguments.length ? (k0 = +_[0], k1 = +_[1], zoom) : [k0, k1];\n };\n\n zoom.translateExtent = function(_) {\n return arguments.length ? (x0 = +_[0][0], x1 = +_[1][0], y0 = +_[0][1], y1 = +_[1][1], zoom) : [[x0, y0], [x1, y1]];\n };\n\n zoom.duration = function(_) {\n return arguments.length ? (duration = +_, zoom) : duration;\n };\n\n zoom.interpolate = function(_) {\n return arguments.length ? (interpolate = _, zoom) : interpolate;\n };\n\n zoom.on = function() {\n var value = listeners.on.apply(listeners, arguments);\n return value === listeners ? zoom : value;\n };\n\n zoom.clickDistance = function(_) {\n return arguments.length ? (clickDistance2 = (_ = +_) * _, zoom) : Math.sqrt(clickDistance2);\n };\n\n return zoom;\n};\n\nexports.version = version;\nexports.bisect = bisectRight;\nexports.bisectRight = bisectRight;\nexports.bisectLeft = bisectLeft;\nexports.ascending = ascending;\nexports.bisector = bisector;\nexports.cross = cross;\nexports.descending = descending;\nexports.deviation = deviation;\nexports.extent = extent;\nexports.histogram = histogram;\nexports.thresholdFreedmanDiaconis = freedmanDiaconis;\nexports.thresholdScott = scott;\nexports.thresholdSturges = sturges;\nexports.max = max;\nexports.mean = mean;\nexports.median = median;\nexports.merge = merge;\nexports.min = min;\nexports.pairs = pairs;\nexports.permute = permute;\nexports.quantile = threshold;\nexports.range = sequence;\nexports.scan = scan;\nexports.shuffle = shuffle;\nexports.sum = sum;\nexports.ticks = ticks;\nexports.tickIncrement = tickIncrement;\nexports.tickStep = tickStep;\nexports.transpose = transpose;\nexports.variance = variance;\nexports.zip = zip;\nexports.axisTop = axisTop;\nexports.axisRight = axisRight;\nexports.axisBottom = axisBottom;\nexports.axisLeft = axisLeft;\nexports.brush = brush;\nexports.brushX = brushX;\nexports.brushY = brushY;\nexports.brushSelection = brushSelection;\nexports.chord = chord;\nexports.ribbon = ribbon;\nexports.nest = nest;\nexports.set = set$2;\nexports.map = map$1;\nexports.keys = keys;\nexports.values = values;\nexports.entries = entries;\nexports.color = color;\nexports.rgb = rgb;\nexports.hsl = hsl;\nexports.lab = lab;\nexports.hcl = hcl;\nexports.cubehelix = cubehelix;\nexports.dispatch = dispatch;\nexports.drag = drag;\nexports.dragDisable = dragDisable;\nexports.dragEnable = yesdrag;\nexports.dsvFormat = dsv;\nexports.csvParse = csvParse;\nexports.csvParseRows = csvParseRows;\nexports.csvFormat = csvFormat;\nexports.csvFormatRows = csvFormatRows;\nexports.tsvParse = tsvParse;\nexports.tsvParseRows = tsvParseRows;\nexports.tsvFormat = tsvFormat;\nexports.tsvFormatRows = tsvFormatRows;\nexports.easeLinear = linear$1;\nexports.easeQuad = quadInOut;\nexports.easeQuadIn = quadIn;\nexports.easeQuadOut = quadOut;\nexports.easeQuadInOut = quadInOut;\nexports.easeCubic = cubicInOut;\nexports.easeCubicIn = cubicIn;\nexports.easeCubicOut = cubicOut;\nexports.easeCubicInOut = cubicInOut;\nexports.easePoly = polyInOut;\nexports.easePolyIn = polyIn;\nexports.easePolyOut = polyOut;\nexports.easePolyInOut = polyInOut;\nexports.easeSin = sinInOut;\nexports.easeSinIn = sinIn;\nexports.easeSinOut = sinOut;\nexports.easeSinInOut = sinInOut;\nexports.easeExp = expInOut;\nexports.easeExpIn = expIn;\nexports.easeExpOut = expOut;\nexports.easeExpInOut = expInOut;\nexports.easeCircle = circleInOut;\nexports.easeCircleIn = circleIn;\nexports.easeCircleOut = circleOut;\nexports.easeCircleInOut = circleInOut;\nexports.easeBounce = bounceOut;\nexports.easeBounceIn = bounceIn;\nexports.easeBounceOut = bounceOut;\nexports.easeBounceInOut = bounceInOut;\nexports.easeBack = backInOut;\nexports.easeBackIn = backIn;\nexports.easeBackOut = backOut;\nexports.easeBackInOut = backInOut;\nexports.easeElastic = elasticOut;\nexports.easeElasticIn = elasticIn;\nexports.easeElasticOut = elasticOut;\nexports.easeElasticInOut = elasticInOut;\nexports.forceCenter = center$1;\nexports.forceCollide = collide;\nexports.forceLink = link;\nexports.forceManyBody = manyBody;\nexports.forceRadial = radial;\nexports.forceSimulation = simulation;\nexports.forceX = x$2;\nexports.forceY = y$2;\nexports.formatDefaultLocale = defaultLocale;\nexports.formatLocale = formatLocale;\nexports.formatSpecifier = formatSpecifier;\nexports.precisionFixed = precisionFixed;\nexports.precisionPrefix = precisionPrefix;\nexports.precisionRound = precisionRound;\nexports.geoArea = area;\nexports.geoBounds = bounds;\nexports.geoCentroid = centroid;\nexports.geoCircle = circle;\nexports.geoClipAntimeridian = clipAntimeridian;\nexports.geoClipCircle = clipCircle;\nexports.geoClipExtent = extent$1;\nexports.geoClipRectangle = clipRectangle;\nexports.geoContains = contains;\nexports.geoDistance = distance;\nexports.geoGraticule = graticule;\nexports.geoGraticule10 = graticule10;\nexports.geoInterpolate = interpolate$1;\nexports.geoLength = length$1;\nexports.geoPath = index$1;\nexports.geoAlbers = albers;\nexports.geoAlbersUsa = albersUsa;\nexports.geoAzimuthalEqualArea = azimuthalEqualArea;\nexports.geoAzimuthalEqualAreaRaw = azimuthalEqualAreaRaw;\nexports.geoAzimuthalEquidistant = azimuthalEquidistant;\nexports.geoAzimuthalEquidistantRaw = azimuthalEquidistantRaw;\nexports.geoConicConformal = conicConformal;\nexports.geoConicConformalRaw = conicConformalRaw;\nexports.geoConicEqualArea = conicEqualArea;\nexports.geoConicEqualAreaRaw = conicEqualAreaRaw;\nexports.geoConicEquidistant = conicEquidistant;\nexports.geoConicEquidistantRaw = conicEquidistantRaw;\nexports.geoEquirectangular = equirectangular;\nexports.geoEquirectangularRaw = equirectangularRaw;\nexports.geoGnomonic = gnomonic;\nexports.geoGnomonicRaw = gnomonicRaw;\nexports.geoIdentity = identity$5;\nexports.geoProjection = projection;\nexports.geoProjectionMutator = projectionMutator;\nexports.geoMercator = mercator;\nexports.geoMercatorRaw = mercatorRaw;\nexports.geoNaturalEarth1 = naturalEarth1;\nexports.geoNaturalEarth1Raw = naturalEarth1Raw;\nexports.geoOrthographic = orthographic;\nexports.geoOrthographicRaw = orthographicRaw;\nexports.geoStereographic = stereographic;\nexports.geoStereographicRaw = stereographicRaw;\nexports.geoTransverseMercator = transverseMercator;\nexports.geoTransverseMercatorRaw = transverseMercatorRaw;\nexports.geoRotation = rotation;\nexports.geoStream = geoStream;\nexports.geoTransform = transform;\nexports.cluster = cluster;\nexports.hierarchy = hierarchy;\nexports.pack = index$2;\nexports.packSiblings = siblings;\nexports.packEnclose = enclose;\nexports.partition = partition;\nexports.stratify = stratify;\nexports.tree = tree;\nexports.treemap = index$3;\nexports.treemapBinary = binary;\nexports.treemapDice = treemapDice;\nexports.treemapSlice = treemapSlice;\nexports.treemapSliceDice = sliceDice;\nexports.treemapSquarify = squarify;\nexports.treemapResquarify = resquarify;\nexports.interpolate = interpolateValue;\nexports.interpolateArray = array$1;\nexports.interpolateBasis = basis$1;\nexports.interpolateBasisClosed = basisClosed;\nexports.interpolateDate = date;\nexports.interpolateNumber = reinterpolate;\nexports.interpolateObject = object;\nexports.interpolateRound = interpolateRound;\nexports.interpolateString = interpolateString;\nexports.interpolateTransformCss = interpolateTransformCss;\nexports.interpolateTransformSvg = interpolateTransformSvg;\nexports.interpolateZoom = interpolateZoom;\nexports.interpolateRgb = interpolateRgb;\nexports.interpolateRgbBasis = rgbBasis;\nexports.interpolateRgbBasisClosed = rgbBasisClosed;\nexports.interpolateHsl = hsl$2;\nexports.interpolateHslLong = hslLong;\nexports.interpolateLab = lab$1;\nexports.interpolateHcl = hcl$2;\nexports.interpolateHclLong = hclLong;\nexports.interpolateCubehelix = cubehelix$2;\nexports.interpolateCubehelixLong = cubehelixLong;\nexports.quantize = quantize;\nexports.path = path;\nexports.polygonArea = area$1;\nexports.polygonCentroid = centroid$1;\nexports.polygonHull = hull;\nexports.polygonContains = contains$1;\nexports.polygonLength = length$2;\nexports.quadtree = quadtree;\nexports.queue = queue;\nexports.randomUniform = uniform;\nexports.randomNormal = normal;\nexports.randomLogNormal = logNormal;\nexports.randomBates = bates;\nexports.randomIrwinHall = irwinHall;\nexports.randomExponential = exponential$1;\nexports.request = request;\nexports.html = html;\nexports.json = json;\nexports.text = text;\nexports.xml = xml;\nexports.csv = csv$1;\nexports.tsv = tsv$1;\nexports.scaleBand = band;\nexports.scalePoint = point$1;\nexports.scaleIdentity = identity$6;\nexports.scaleLinear = linear$2;\nexports.scaleLog = log$1;\nexports.scaleOrdinal = ordinal;\nexports.scaleImplicit = implicit;\nexports.scalePow = pow$1;\nexports.scaleSqrt = sqrt$1;\nexports.scaleQuantile = quantile$$1;\nexports.scaleQuantize = quantize$1;\nexports.scaleThreshold = threshold$1;\nexports.scaleTime = time;\nexports.scaleUtc = utcTime;\nexports.schemeCategory10 = category10;\nexports.schemeCategory20b = category20b;\nexports.schemeCategory20c = category20c;\nexports.schemeCategory20 = category20;\nexports.interpolateCubehelixDefault = cubehelix$3;\nexports.interpolateRainbow = rainbow$1;\nexports.interpolateWarm = warm;\nexports.interpolateCool = cool;\nexports.interpolateViridis = viridis;\nexports.interpolateMagma = magma;\nexports.interpolateInferno = inferno;\nexports.interpolatePlasma = plasma;\nexports.scaleSequential = sequential;\nexports.creator = creator;\nexports.local = local$1;\nexports.matcher = matcher$1;\nexports.mouse = mouse;\nexports.namespace = namespace;\nexports.namespaces = namespaces;\nexports.select = select;\nexports.selectAll = selectAll;\nexports.selection = selection;\nexports.selector = selector;\nexports.selectorAll = selectorAll;\nexports.style = styleValue;\nexports.touch = touch;\nexports.touches = touches;\nexports.window = defaultView;\nexports.customEvent = customEvent;\nexports.arc = arc;\nexports.area = area$2;\nexports.line = line;\nexports.pie = pie;\nexports.areaRadial = areaRadial;\nexports.radialArea = areaRadial;\nexports.lineRadial = lineRadial$1;\nexports.radialLine = lineRadial$1;\nexports.pointRadial = pointRadial;\nexports.linkHorizontal = linkHorizontal;\nexports.linkVertical = linkVertical;\nexports.linkRadial = linkRadial;\nexports.symbol = symbol;\nexports.symbols = symbols;\nexports.symbolCircle = circle$2;\nexports.symbolCross = cross$2;\nexports.symbolDiamond = diamond;\nexports.symbolSquare = square;\nexports.symbolStar = star;\nexports.symbolTriangle = triangle;\nexports.symbolWye = wye;\nexports.curveBasisClosed = basisClosed$1;\nexports.curveBasisOpen = basisOpen;\nexports.curveBasis = basis$2;\nexports.curveBundle = bundle;\nexports.curveCardinalClosed = cardinalClosed;\nexports.curveCardinalOpen = cardinalOpen;\nexports.curveCardinal = cardinal;\nexports.curveCatmullRomClosed = catmullRomClosed;\nexports.curveCatmullRomOpen = catmullRomOpen;\nexports.curveCatmullRom = catmullRom;\nexports.curveLinearClosed = linearClosed;\nexports.curveLinear = curveLinear;\nexports.curveMonotoneX = monotoneX;\nexports.curveMonotoneY = monotoneY;\nexports.curveNatural = natural;\nexports.curveStep = step;\nexports.curveStepAfter = stepAfter;\nexports.curveStepBefore = stepBefore;\nexports.stack = stack;\nexports.stackOffsetExpand = expand;\nexports.stackOffsetDiverging = diverging;\nexports.stackOffsetNone = none$1;\nexports.stackOffsetSilhouette = silhouette;\nexports.stackOffsetWiggle = wiggle;\nexports.stackOrderAscending = ascending$2;\nexports.stackOrderDescending = descending$2;\nexports.stackOrderInsideOut = insideOut;\nexports.stackOrderNone = none$2;\nexports.stackOrderReverse = reverse;\nexports.timeInterval = newInterval;\nexports.timeMillisecond = millisecond;\nexports.timeMilliseconds = milliseconds;\nexports.utcMillisecond = millisecond;\nexports.utcMilliseconds = milliseconds;\nexports.timeSecond = second;\nexports.timeSeconds = seconds;\nexports.utcSecond = second;\nexports.utcSeconds = seconds;\nexports.timeMinute = minute;\nexports.timeMinutes = minutes;\nexports.timeHour = hour;\nexports.timeHours = hours;\nexports.timeDay = day;\nexports.timeDays = days;\nexports.timeWeek = sunday;\nexports.timeWeeks = sundays;\nexports.timeSunday = sunday;\nexports.timeSundays = sundays;\nexports.timeMonday = monday;\nexports.timeMondays = mondays;\nexports.timeTuesday = tuesday;\nexports.timeTuesdays = tuesdays;\nexports.timeWednesday = wednesday;\nexports.timeWednesdays = wednesdays;\nexports.timeThursday = thursday;\nexports.timeThursdays = thursdays;\nexports.timeFriday = friday;\nexports.timeFridays = fridays;\nexports.timeSaturday = saturday;\nexports.timeSaturdays = saturdays;\nexports.timeMonth = month;\nexports.timeMonths = months;\nexports.timeYear = year;\nexports.timeYears = years;\nexports.utcMinute = utcMinute;\nexports.utcMinutes = utcMinutes;\nexports.utcHour = utcHour;\nexports.utcHours = utcHours;\nexports.utcDay = utcDay;\nexports.utcDays = utcDays;\nexports.utcWeek = utcSunday;\nexports.utcWeeks = utcSundays;\nexports.utcSunday = utcSunday;\nexports.utcSundays = utcSundays;\nexports.utcMonday = utcMonday;\nexports.utcMondays = utcMondays;\nexports.utcTuesday = utcTuesday;\nexports.utcTuesdays = utcTuesdays;\nexports.utcWednesday = utcWednesday;\nexports.utcWednesdays = utcWednesdays;\nexports.utcThursday = utcThursday;\nexports.utcThursdays = utcThursdays;\nexports.utcFriday = utcFriday;\nexports.utcFridays = utcFridays;\nexports.utcSaturday = utcSaturday;\nexports.utcSaturdays = utcSaturdays;\nexports.utcMonth = utcMonth;\nexports.utcMonths = utcMonths;\nexports.utcYear = utcYear;\nexports.utcYears = utcYears;\nexports.timeFormatDefaultLocale = defaultLocale$1;\nexports.timeFormatLocale = formatLocale$1;\nexports.isoFormat = formatIso;\nexports.isoParse = parseIso;\nexports.now = now;\nexports.timer = timer;\nexports.timerFlush = timerFlush;\nexports.timeout = timeout$1;\nexports.interval = interval$1;\nexports.transition = transition;\nexports.active = active;\nexports.interrupt = interrupt;\nexports.voronoi = voronoi;\nexports.zoom = zoom;\nexports.zoomTransform = transform$1;\nexports.zoomIdentity = identity$8;\n\nObject.defineProperty(exports, '__esModule', { value: true });\n\n})));\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/d3/build/d3.js\n// module id = 19\n// module chunks = 0\n\n//# sourceURL=webpack:///./node_modules/d3/build/d3.js?"); +"use strict"; +eval("/* harmony export (immutable) */ __webpack_exports__[\"a\"] = Chart;\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__ = __webpack_require__(0);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__helpers_colors__ = __webpack_require__(5);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__helpers_constants__ = __webpack_require__(2);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__helpers_common__ = __webpack_require__(1);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_lodash_throttle__ = __webpack_require__(22);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_lodash_throttle___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_lodash_throttle__);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__helpers_auto_config__ = __webpack_require__(23);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__helpers_component_registry__ = __webpack_require__(24);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__helpers_filters__ = __webpack_require__(25);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__data_manager__ = __webpack_require__(7);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__scale__ = __webpack_require__(8);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__line__ = __webpack_require__(26);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__bar__ = __webpack_require__(27);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__axis__ = __webpack_require__(28);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__tooltip__ = __webpack_require__(4);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_14__legend__ = __webpack_require__(10);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_15__brush__ = __webpack_require__(11);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_16__hover__ = __webpack_require__(12);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_17__binning__ = __webpack_require__(13);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_18__domain_editor__ = __webpack_require__(14);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_19__brush_range_editor__ = __webpack_require__(15);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_20__label__ = __webpack_require__(16);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_21__clip_path__ = __webpack_require__(29);\nvar _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"]) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); } }; }();\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nfunction Chart(_container) {\n\n var defaultConfig = {\n annotationPoints: [],\n // common\n margin: {\n top: 48,\n right: 32,\n bottom: 48,\n left: 32\n },\n width: 800,\n height: 500,\n keyType: \"time\",\n chartId: Object(__WEBPACK_IMPORTED_MODULE_3__helpers_common__[\"uniqueId\"])(),\n chartType: \"line\", // line, area, stackedLine, stackedArea\n extractType: null, // isodow, month, quarter, hour, minute\n ease: __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"easeLinear\"],\n useScrolling: false,\n\n // intro animation\n isAnimated: false,\n animationDuration: 1500,\n\n // scale\n colorSchema: __WEBPACK_IMPORTED_MODULE_1__helpers_colors__[\"a\" /* colors */].mapdColors.map(function (d) {\n return { value: d };\n }),\n defaultColor: \"skyblue\",\n xDomain: \"auto\",\n yDomain: \"auto\",\n y2Domain: \"auto\",\n\n // axis\n tickPadding: 5,\n xAxisFormat: \"auto\",\n yAxisFormat: \".2f\",\n y2AxisFormat: \".2f\",\n yAxisPercentageFormat: null,\n tickSizes: 8,\n yTicks: \"auto\",\n y2Ticks: \"auto\",\n xTickSkip: 0,\n grid: null,\n axisTransitionDuration: 0,\n labelsAreRotated: \"auto\",\n maxXLabelCharCount: null,\n maxYLabelCharCount: null,\n\n // data\n sortBy: null,\n fillData: false,\n\n // hover\n lineDotRadius: 4,\n hoverDotRadius: 5,\n\n // tooltip\n tooltipFormat: \".2f\",\n tooltipTitleFormat: null,\n mouseChaseDuration: 0,\n tooltipEase: __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"easeQuadInOut\"],\n tooltipHeight: 48,\n tooltipWidth: 160,\n tooltipIsEnabled: true,\n tooltipTitle: null,\n\n // format\n dateFormat: \"%b %d, %Y\",\n inputDateFormat: \"%m-%d-%Y\",\n numberFormat: \".2f\",\n\n // legend\n legendXPosition: \"auto\",\n legendYPosition: \"auto\",\n legendTitle: \"\",\n legendIsEnabled: true,\n\n // binning\n binningResolution: \"1mo\",\n binningIsAuto: true,\n binningToggles: [\"10y\", \"1y\", \"1q\", \"1mo\"],\n binningIsEnabled: false,\n\n // domain\n xLock: false,\n yLock: false,\n y2Lock: false,\n xDomainEditorIsEnabled: false,\n yDomainEditorIsEnabled: false,\n y2DomainEditorIsEnabled: false,\n\n // brush range\n brushRangeMin: null,\n brushRangeMax: null,\n brushRangeIsEnabled: false,\n\n // brush\n brushIsEnabled: true,\n\n // zooming is controllec by the brush\n zoomRangeMin: null,\n zoomRangeMax: null,\n zoomIsEnabled: true,\n // the original range is used as bounds by the zoom\n fullXDomain: null,\n\n // label\n xLabel: \"\",\n yLabel: \"\",\n y2Label: \"\",\n\n // bar\n barSpacingPercent: 10,\n selectedKeys: [],\n forceGroupedBars: false,\n\n // line\n dotsToShow: \"none\",\n lineFx: null,\n\n // stacked\n stackOffset: __WEBPACK_IMPORTED_MODULE_2__helpers_constants__[\"stackOffset\"].NONE\n };\n\n var scales = {\n xScale: null,\n yScale: null,\n y2Scale: null,\n hasSecondAxis: null,\n colorScale: null\n };\n\n var cache = {\n originalData: null,\n originalConfig: defaultConfig,\n container: _container,\n svg: null,\n panel: null,\n margin: null,\n maskingRectangle: null,\n width: null, height: null,\n chartWidth: null, chartHeight: null,\n xAxis: null, yAxis: null, yAxis2: null\n };\n\n var config = {};\n\n var data = {};\n\n var dispatcher = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"dispatch\"](\"mouseOverPanel\", \"mouseOutPanel\", \"mouseMovePanel\", \"mouseClickPanel\");\n var scale = Object(__WEBPACK_IMPORTED_MODULE_9__scale__[\"a\" /* default */])();\n var componentRegistry = Object(__WEBPACK_IMPORTED_MODULE_6__helpers_component_registry__[\"a\" /* default */])();\n\n var createTemplate = function createTemplate(chartType) {\n var className = Object(__WEBPACK_IMPORTED_MODULE_3__helpers_common__[\"getChartClass\"])(chartType);\n return \"
\\n
\\n
\\n \\n \\n \\n
\\n
\\n \\n \\n \" + __WEBPACK_IMPORTED_MODULE_7__helpers_filters__[\"b\" /* underline */] + \"\\n \" + __WEBPACK_IMPORTED_MODULE_7__helpers_filters__[\"a\" /* shadow */] + \"\\n \\n \\n \\n \\n \\n \\n \\n
\\n
\\n \\n \\n \\n
\\n
\";\n };\n\n function buildChart() {\n if (!cache.root) {\n var base = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"select\"](cache.container).html(createTemplate(config.chartType));\n\n cache.root = base.select(\".mapd3-container\").style(\"position\", \"relative\");\n\n cache.svgWrapper = base.select(\".svg-wrapper\");\n cache.svg = base.select(\"svg.chart\");\n cache.headerGroup = base.select(\".header-group\").style(\"position\", \"absolute\");\n cache.panel = cache.svg.select(\".panel-group\");\n cache.chart = cache.svg.select(\".chart-group\");\n\n addEvents();\n\n componentRegistry.register({\n axis: Object(__WEBPACK_IMPORTED_MODULE_12__axis__[\"a\" /* default */])(cache.root),\n bar: Object(__WEBPACK_IMPORTED_MODULE_11__bar__[\"a\" /* default */])(cache.panel),\n line: Object(__WEBPACK_IMPORTED_MODULE_10__line__[\"a\" /* default */])(cache.panel),\n tooltip: Object(__WEBPACK_IMPORTED_MODULE_13__tooltip__[\"a\" /* default */])(cache.root),\n legend: Object(__WEBPACK_IMPORTED_MODULE_14__legend__[\"a\" /* default */])(cache.root),\n brush: Object(__WEBPACK_IMPORTED_MODULE_15__brush__[\"a\" /* default */])(cache.panel),\n hover: Object(__WEBPACK_IMPORTED_MODULE_16__hover__[\"a\" /* default */])(cache.panel),\n binning: Object(__WEBPACK_IMPORTED_MODULE_17__binning__[\"a\" /* default */])(cache.headerGroup),\n domainEditor: Object(__WEBPACK_IMPORTED_MODULE_18__domain_editor__[\"a\" /* default */])(cache.root),\n brushRangeEditor: Object(__WEBPACK_IMPORTED_MODULE_19__brush_range_editor__[\"a\" /* default */])(cache.headerGroup),\n label: Object(__WEBPACK_IMPORTED_MODULE_20__label__[\"a\" /* default */])(cache.root),\n clipPath: Object(__WEBPACK_IMPORTED_MODULE_21__clip_path__[\"a\" /* default */])(cache.svg)\n });\n }\n\n cache.svgWrapper.style(\"flex\", \"0 0 \" + config.chartWidth + \"px\").style(\"height\", config.height + \"px\").style(\"overflow-x\", config.useScrolling ? \"auto\" : \"hidden\");\n\n cache.svg.style(\"flex\", \"0 0 \" + config.markPanelWidth + \"px\").style(\"height\", \"\" + (config.chartHeight + config.margin.bottom)).style(\"top\", config.margin.top + \"px\");\n\n cache.headerGroup.style(\"width\", config.chartWidth + \"px\").style(\"left\", config.margin.left + \"px\");\n\n cache.panel.select(\".panel-background\").style(\"width\", config.markPanelWidth + \"px\").style(\"height\", config.chartHeight + \"px\").attr(\"fill\", \"transparent\");\n return this;\n }\n\n function build() {\n config = transformConfig(cache.originalConfig);\n buildChart();\n\n if (cache.originalData) {\n scales = computeScales(config, data);\n\n componentRegistry.render({\n config: config,\n scales: scales,\n data: data,\n dispatcher: dispatcher\n });\n }\n\n return this;\n }\n\n function addEvents() {\n var THROTTLE_DELAY = 20;\n var throttledDispatch = __WEBPACK_IMPORTED_MODULE_4_lodash_throttle___default()(function () {\n dispatcher.call.apply(dispatcher, arguments);\n }, THROTTLE_DELAY, {\n leading: true,\n trailing: false\n });\n\n cache.panel.on(\"mouseover.dispatch\", function () {\n dispatcher.call(\"mouseOverPanel\", null, __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"mouse\"](cache.panel.node()));\n }).on(\"mouseout.dispatch\", function () {\n dispatcher.call(\"mouseOutPanel\", null, __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"mouse\"](cache.panel.node()));\n }).on(\"mousemove.dispatch\", function () {\n var _d3$mouse = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"mouse\"](cache.panel.node()),\n _d3$mouse2 = _slicedToArray(_d3$mouse, 2),\n mouseX = _d3$mouse2[0],\n mouseY = _d3$mouse2[1];\n\n var _d3$mouse3 = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"mouse\"](cache.svgWrapper.node()),\n _d3$mouse4 = _slicedToArray(_d3$mouse3, 1),\n panelMouseX = _d3$mouse4[0];\n\n if (!cache.originalData) {\n return;\n }\n var xPosition = mouseX;\n var dataPoint = Object(__WEBPACK_IMPORTED_MODULE_8__data_manager__[\"c\" /* getNearestDataPoint */])(xPosition, data, scales, config.keyType);\n\n if (dataPoint) {\n var dataPointXPosition = scales.xScale(dataPoint[__WEBPACK_IMPORTED_MODULE_2__helpers_constants__[\"keys\"].KEY]);\n throttledDispatch(\"mouseMovePanel\", null, dataPoint, dataPointXPosition, mouseY, panelMouseX);\n }\n }).on(\"click.dispatch\", function () {\n var _d3$mouse5 = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"mouse\"](cache.panel.node()),\n _d3$mouse6 = _slicedToArray(_d3$mouse5, 1),\n mouseX = _d3$mouse6[0];\n\n if (!cache.originalData) {\n return;\n }\n var xPosition = mouseX;\n var dataPoint = Object(__WEBPACK_IMPORTED_MODULE_8__data_manager__[\"c\" /* getNearestDataPoint */])(xPosition, data, scales, config.keyType);\n\n if (dataPoint) {\n throttledDispatch(\"mouseClickPanel\", null, dataPoint);\n }\n });\n }\n\n function transformData(_data) {\n return Object(__WEBPACK_IMPORTED_MODULE_8__data_manager__[\"a\" /* augmentData */])(_data, config.keyType, config.sortBy, config.fillData, config.stackOffset, config.yAxisPercentageFormat);\n }\n\n function transformConfig(_config) {\n return Object(__WEBPACK_IMPORTED_MODULE_5__helpers_auto_config__[\"a\" /* augmentConfig */])(_config, cache, data);\n }\n\n function computeScales(_config, _data) {\n return scale.setConfig(_config).setData(_data).getScales();\n }\n\n function getEvents() {\n if (!cache.root) {\n render();\n }\n var events = componentRegistry.getEvents();\n events.onPanel = Object(__WEBPACK_IMPORTED_MODULE_3__helpers_common__[\"rebind\"])(dispatcher); // adding chart dispatcher\n return events;\n }\n\n function on() {\n dispatcher.on.apply(dispatcher, arguments);\n return this;\n }\n\n function setData(_data) {\n cache.originalData = _data;\n data = transformData(cache.originalData);\n render();\n return this;\n }\n\n function setConfig(_config) {\n cache.originalConfig = Object(__WEBPACK_IMPORTED_MODULE_3__helpers_common__[\"override\"])(cache.originalConfig, _config);\n config = transformConfig(cache.originalConfig);\n return this;\n }\n\n function render() {\n build();\n return this;\n }\n\n function destroy() {\n if (cache.root) {\n cache.root.on(\".\", null).remove();\n }\n }\n\n return {\n render: render,\n setConfig: setConfig,\n setData: setData,\n on: on,\n destroy: destroy,\n getEvents: getEvents\n };\n}\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/charts/chart.js\n// module id = 19\n// module chunks = 0\n\n//# sourceURL=webpack:///./src/charts/chart.js?"); /***/ }), /* 20 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { +/***/ (function(module, exports, __webpack_require__) { -"use strict"; -eval("/* harmony export (immutable) */ __webpack_exports__[\"a\"] = Chart;\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__ = __webpack_require__(0);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__helpers_colors__ = __webpack_require__(5);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__helpers_constants__ = __webpack_require__(2);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__helpers_common__ = __webpack_require__(1);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_lodash_throttle__ = __webpack_require__(22);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_lodash_throttle___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_lodash_throttle__);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__helpers_auto_config__ = __webpack_require__(23);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__helpers_component_registry__ = __webpack_require__(24);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__helpers_filters__ = __webpack_require__(25);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__data_manager__ = __webpack_require__(8);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__scale__ = __webpack_require__(9);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__line__ = __webpack_require__(26);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__bar__ = __webpack_require__(27);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__axis__ = __webpack_require__(28);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__tooltip__ = __webpack_require__(4);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_14__legend__ = __webpack_require__(11);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_15__brush__ = __webpack_require__(12);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_16__hover__ = __webpack_require__(13);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_17__binning__ = __webpack_require__(14);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_18__domain_editor__ = __webpack_require__(15);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_19__brush_range_editor__ = __webpack_require__(16);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_20__label__ = __webpack_require__(17);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_21__clip_path__ = __webpack_require__(29);\nvar _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"]) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); } }; }();\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nfunction Chart(_container) {\n\n var defaultConfig = {\n // common\n margin: {\n top: 48,\n right: 32,\n bottom: 48,\n left: 32\n },\n width: 800,\n height: 500,\n keyType: \"time\",\n chartId: Object(__WEBPACK_IMPORTED_MODULE_3__helpers_common__[\"uniqueId\"])(),\n chartType: \"line\", // line, area, stackedLine, stackedArea\n extractType: null, // isodow, month, quarter, hour, minute\n ease: __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"easeLinear\"],\n useScrolling: false,\n\n // intro animation\n isAnimated: false,\n animationDuration: 1500,\n\n // scale\n colorSchema: __WEBPACK_IMPORTED_MODULE_1__helpers_colors__[\"a\" /* colors */].mapdColors.map(function (d) {\n return { value: d };\n }),\n defaultColor: \"skyblue\",\n xDomain: \"auto\",\n yDomain: \"auto\",\n y2Domain: \"auto\",\n\n // axis\n tickPadding: 5,\n xAxisFormat: \"auto\",\n yAxisFormat: \".2f\",\n y2AxisFormat: \".2f\",\n yAxisPercentageFormat: null,\n tickSizes: 8,\n yTicks: \"auto\",\n y2Ticks: \"auto\",\n xTickSkip: 0,\n grid: null,\n axisTransitionDuration: 0,\n labelsAreRotated: \"auto\",\n maxXLabelCharCount: null,\n maxYLabelCharCount: null,\n\n // data\n sortBy: null,\n fillData: false,\n\n // hover\n lineDotRadius: 4,\n hoverDotRadius: 5,\n\n // tooltip\n tooltipFormat: \".2f\",\n tooltipTitleFormat: null,\n mouseChaseDuration: 0,\n tooltipEase: __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"easeQuadInOut\"],\n tooltipHeight: 48,\n tooltipWidth: 160,\n tooltipIsEnabled: true,\n tooltipTitle: null,\n\n // format\n dateFormat: \"%b %d, %Y\",\n inputDateFormat: \"%m-%d-%Y\",\n numberFormat: \".2f\",\n\n // legend\n legendXPosition: \"auto\",\n legendYPosition: \"auto\",\n legendTitle: \"\",\n legendIsEnabled: true,\n\n // binning\n binningResolution: \"1mo\",\n binningIsAuto: true,\n binningToggles: [\"10y\", \"1y\", \"1q\", \"1mo\"],\n binningIsEnabled: false,\n\n // domain\n xLock: false,\n yLock: false,\n y2Lock: false,\n xDomainEditorIsEnabled: false,\n yDomainEditorIsEnabled: false,\n y2DomainEditorIsEnabled: false,\n\n // brush range\n brushRangeMin: null,\n brushRangeMax: null,\n brushRangeIsEnabled: false,\n\n // brush\n brushIsEnabled: true,\n\n // zooming is controllec by the brush\n zoomRangeMin: null,\n zoomRangeMax: null,\n zoomIsEnabled: true,\n // the original range is used as bounds by the zoom\n fullXDomain: null,\n\n // label\n xLabel: \"\",\n yLabel: \"\",\n y2Label: \"\",\n\n // bar\n barSpacingPercent: 10,\n selectedKeys: [],\n forceGroupedBars: false,\n\n // line\n dotsToShow: \"none\",\n lineFx: null,\n\n // stacked\n stackOffset: __WEBPACK_IMPORTED_MODULE_2__helpers_constants__[\"stackOffset\"].NONE\n };\n\n var scales = {\n xScale: null,\n yScale: null,\n y2Scale: null,\n hasSecondAxis: null,\n colorScale: null\n };\n\n var cache = {\n originalData: null,\n originalConfig: defaultConfig,\n container: _container,\n svg: null,\n panel: null,\n margin: null,\n maskingRectangle: null,\n width: null, height: null,\n chartWidth: null, chartHeight: null,\n xAxis: null, yAxis: null, yAxis2: null\n };\n\n var config = {};\n\n var data = {};\n\n var dispatcher = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"dispatch\"](\"mouseOverPanel\", \"mouseOutPanel\", \"mouseMovePanel\", \"mouseClickPanel\");\n var scale = Object(__WEBPACK_IMPORTED_MODULE_9__scale__[\"a\" /* default */])();\n var componentRegistry = Object(__WEBPACK_IMPORTED_MODULE_6__helpers_component_registry__[\"a\" /* default */])();\n\n var createTemplate = function createTemplate(chartType) {\n var className = Object(__WEBPACK_IMPORTED_MODULE_3__helpers_common__[\"getChartClass\"])(chartType);\n return \"
\\n
\\n
\\n \\n \\n \\n
\\n
\\n \\n \\n \" + __WEBPACK_IMPORTED_MODULE_7__helpers_filters__[\"b\" /* underline */] + \"\\n \" + __WEBPACK_IMPORTED_MODULE_7__helpers_filters__[\"a\" /* shadow */] + \"\\n \\n \\n \\n \\n \\n \\n \\n
\\n
\\n \\n \\n \\n
\\n
\";\n };\n\n function buildChart() {\n if (!cache.root) {\n var base = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"select\"](cache.container).html(createTemplate(config.chartType));\n\n cache.root = base.select(\".mapd3-container\").style(\"position\", \"relative\");\n\n cache.svgWrapper = base.select(\".svg-wrapper\");\n cache.svg = base.select(\"svg.chart\");\n cache.headerGroup = base.select(\".header-group\").style(\"position\", \"absolute\");\n cache.panel = cache.svg.select(\".panel-group\");\n cache.chart = cache.svg.select(\".chart-group\");\n\n addEvents();\n\n componentRegistry.register({\n axis: Object(__WEBPACK_IMPORTED_MODULE_12__axis__[\"a\" /* default */])(cache.root),\n bar: Object(__WEBPACK_IMPORTED_MODULE_11__bar__[\"a\" /* default */])(cache.panel),\n line: Object(__WEBPACK_IMPORTED_MODULE_10__line__[\"a\" /* default */])(cache.panel),\n tooltip: Object(__WEBPACK_IMPORTED_MODULE_13__tooltip__[\"a\" /* default */])(cache.root),\n legend: Object(__WEBPACK_IMPORTED_MODULE_14__legend__[\"a\" /* default */])(cache.root),\n brush: Object(__WEBPACK_IMPORTED_MODULE_15__brush__[\"a\" /* default */])(cache.panel),\n hover: Object(__WEBPACK_IMPORTED_MODULE_16__hover__[\"a\" /* default */])(cache.panel),\n binning: Object(__WEBPACK_IMPORTED_MODULE_17__binning__[\"a\" /* default */])(cache.headerGroup),\n domainEditor: Object(__WEBPACK_IMPORTED_MODULE_18__domain_editor__[\"a\" /* default */])(cache.root),\n brushRangeEditor: Object(__WEBPACK_IMPORTED_MODULE_19__brush_range_editor__[\"a\" /* default */])(cache.headerGroup),\n label: Object(__WEBPACK_IMPORTED_MODULE_20__label__[\"a\" /* default */])(cache.root),\n clipPath: Object(__WEBPACK_IMPORTED_MODULE_21__clip_path__[\"a\" /* default */])(cache.svg)\n });\n }\n\n cache.svgWrapper.style(\"flex\", \"0 0 \" + config.chartWidth + \"px\").style(\"height\", config.height + \"px\").style(\"overflow-x\", config.useScrolling ? \"auto\" : \"hidden\");\n\n cache.svg.style(\"flex\", \"0 0 \" + config.markPanelWidth + \"px\").style(\"height\", \"\" + (config.chartHeight + config.margin.bottom)).style(\"top\", config.margin.top + \"px\");\n\n cache.headerGroup.style(\"width\", config.chartWidth + \"px\").style(\"left\", config.margin.left + \"px\");\n\n cache.panel.select(\".panel-background\").style(\"width\", config.markPanelWidth + \"px\").style(\"height\", config.chartHeight + \"px\").attr(\"fill\", \"transparent\");\n return this;\n }\n\n function build() {\n config = transformConfig(cache.originalConfig);\n buildChart();\n\n if (cache.originalData) {\n scales = computeScales(config, data);\n\n componentRegistry.render({\n config: config,\n scales: scales,\n data: data,\n dispatcher: dispatcher\n });\n }\n\n return this;\n }\n\n function addEvents() {\n var THROTTLE_DELAY = 20;\n var throttledDispatch = __WEBPACK_IMPORTED_MODULE_4_lodash_throttle___default()(function () {\n dispatcher.call.apply(dispatcher, arguments);\n }, THROTTLE_DELAY, {\n leading: true,\n trailing: false\n });\n\n cache.panel.on(\"mouseover.dispatch\", function () {\n dispatcher.call(\"mouseOverPanel\", null, __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"mouse\"](cache.panel.node()));\n }).on(\"mouseout.dispatch\", function () {\n dispatcher.call(\"mouseOutPanel\", null, __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"mouse\"](cache.panel.node()));\n }).on(\"mousemove.dispatch\", function () {\n var _d3$mouse = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"mouse\"](cache.panel.node()),\n _d3$mouse2 = _slicedToArray(_d3$mouse, 2),\n mouseX = _d3$mouse2[0],\n mouseY = _d3$mouse2[1];\n\n var _d3$mouse3 = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"mouse\"](cache.svgWrapper.node()),\n _d3$mouse4 = _slicedToArray(_d3$mouse3, 1),\n panelMouseX = _d3$mouse4[0];\n\n if (!cache.originalData) {\n return;\n }\n var xPosition = mouseX;\n var dataPoint = Object(__WEBPACK_IMPORTED_MODULE_8__data_manager__[\"c\" /* getNearestDataPoint */])(xPosition, data, scales, config.keyType);\n\n if (dataPoint) {\n var dataPointXPosition = scales.xScale(dataPoint[__WEBPACK_IMPORTED_MODULE_2__helpers_constants__[\"keys\"].KEY]);\n throttledDispatch(\"mouseMovePanel\", null, dataPoint, dataPointXPosition, mouseY, panelMouseX);\n }\n }).on(\"click.dispatch\", function () {\n var _d3$mouse5 = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"mouse\"](cache.panel.node()),\n _d3$mouse6 = _slicedToArray(_d3$mouse5, 1),\n mouseX = _d3$mouse6[0];\n\n if (!cache.originalData) {\n return;\n }\n var xPosition = mouseX;\n var dataPoint = Object(__WEBPACK_IMPORTED_MODULE_8__data_manager__[\"c\" /* getNearestDataPoint */])(xPosition, data, scales, config.keyType);\n\n if (dataPoint) {\n throttledDispatch(\"mouseClickPanel\", null, dataPoint);\n }\n });\n }\n\n function transformData(_data) {\n return Object(__WEBPACK_IMPORTED_MODULE_8__data_manager__[\"a\" /* augmentData */])(_data, config.keyType, config.sortBy, config.fillData, config.stackOffset, config.yAxisPercentageFormat);\n }\n\n function transformConfig(_config) {\n return Object(__WEBPACK_IMPORTED_MODULE_5__helpers_auto_config__[\"a\" /* augmentConfig */])(_config, cache, data);\n }\n\n function computeScales(_config, _data) {\n return scale.setConfig(_config).setData(_data).getScales();\n }\n\n function getEvents() {\n if (!cache.root) {\n render();\n }\n var events = componentRegistry.getEvents();\n events.onPanel = Object(__WEBPACK_IMPORTED_MODULE_3__helpers_common__[\"rebind\"])(dispatcher); // adding chart dispatcher\n return events;\n }\n\n function on() {\n dispatcher.on.apply(dispatcher, arguments);\n return this;\n }\n\n function setData(_data) {\n cache.originalData = _data;\n data = transformData(cache.originalData);\n render();\n return this;\n }\n\n function setConfig(_config) {\n cache.originalConfig = Object(__WEBPACK_IMPORTED_MODULE_3__helpers_common__[\"override\"])(cache.originalConfig, _config);\n config = transformConfig(cache.originalConfig);\n return this;\n }\n\n function render() {\n build();\n return this;\n }\n\n function destroy() {\n if (cache.root) {\n cache.root.on(\".\", null).remove();\n }\n }\n\n return {\n render: render,\n setConfig: setConfig,\n setData: setData,\n on: on,\n destroy: destroy,\n getEvents: getEvents\n };\n}\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/charts/chart.js\n// module id = 20\n// module chunks = 0\n\n//# sourceURL=webpack:///./src/charts/chart.js?"); +eval("/* WEBPACK VAR INJECTION */(function(global, module) {/**\n * lodash (Custom Build) \n * Build: `lodash modularize exports=\"npm\" -o ./`\n * Copyright jQuery Foundation and other contributors \n * Released under MIT license \n * Based on Underscore.js 1.8.3 \n * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n */\n\n/** Used as the size to enable large array optimizations. */\nvar LARGE_ARRAY_SIZE = 200;\n\n/** Used to stand-in for `undefined` hash values. */\nvar HASH_UNDEFINED = '__lodash_hash_undefined__';\n\n/** Used as references for various `Number` constants. */\nvar MAX_SAFE_INTEGER = 9007199254740991;\n\n/** `Object#toString` result references. */\nvar argsTag = '[object Arguments]',\n arrayTag = '[object Array]',\n boolTag = '[object Boolean]',\n dateTag = '[object Date]',\n errorTag = '[object Error]',\n funcTag = '[object Function]',\n genTag = '[object GeneratorFunction]',\n mapTag = '[object Map]',\n numberTag = '[object Number]',\n objectTag = '[object Object]',\n promiseTag = '[object Promise]',\n regexpTag = '[object RegExp]',\n setTag = '[object Set]',\n stringTag = '[object String]',\n symbolTag = '[object Symbol]',\n weakMapTag = '[object WeakMap]';\n\nvar arrayBufferTag = '[object ArrayBuffer]',\n dataViewTag = '[object DataView]',\n float32Tag = '[object Float32Array]',\n float64Tag = '[object Float64Array]',\n int8Tag = '[object Int8Array]',\n int16Tag = '[object Int16Array]',\n int32Tag = '[object Int32Array]',\n uint8Tag = '[object Uint8Array]',\n uint8ClampedTag = '[object Uint8ClampedArray]',\n uint16Tag = '[object Uint16Array]',\n uint32Tag = '[object Uint32Array]';\n\n/**\n * Used to match `RegExp`\n * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).\n */\nvar reRegExpChar = /[\\\\^$.*+?()[\\]{}|]/g;\n\n/** Used to match `RegExp` flags from their coerced string values. */\nvar reFlags = /\\w*$/;\n\n/** Used to detect host constructors (Safari). */\nvar reIsHostCtor = /^\\[object .+?Constructor\\]$/;\n\n/** Used to detect unsigned integer values. */\nvar reIsUint = /^(?:0|[1-9]\\d*)$/;\n\n/** Used to identify `toStringTag` values supported by `_.clone`. */\nvar cloneableTags = {};\ncloneableTags[argsTag] = cloneableTags[arrayTag] =\ncloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =\ncloneableTags[boolTag] = cloneableTags[dateTag] =\ncloneableTags[float32Tag] = cloneableTags[float64Tag] =\ncloneableTags[int8Tag] = cloneableTags[int16Tag] =\ncloneableTags[int32Tag] = cloneableTags[mapTag] =\ncloneableTags[numberTag] = cloneableTags[objectTag] =\ncloneableTags[regexpTag] = cloneableTags[setTag] =\ncloneableTags[stringTag] = cloneableTags[symbolTag] =\ncloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =\ncloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;\ncloneableTags[errorTag] = cloneableTags[funcTag] =\ncloneableTags[weakMapTag] = false;\n\n/** Detect free variable `global` from Node.js. */\nvar freeGlobal = typeof global == 'object' && global && global.Object === Object && global;\n\n/** Detect free variable `self`. */\nvar freeSelf = typeof self == 'object' && self && self.Object === Object && self;\n\n/** Used as a reference to the global object. */\nvar root = freeGlobal || freeSelf || Function('return this')();\n\n/** Detect free variable `exports`. */\nvar freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;\n\n/** Detect free variable `module`. */\nvar freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;\n\n/** Detect the popular CommonJS extension `module.exports`. */\nvar moduleExports = freeModule && freeModule.exports === freeExports;\n\n/**\n * Adds the key-value `pair` to `map`.\n *\n * @private\n * @param {Object} map The map to modify.\n * @param {Array} pair The key-value pair to add.\n * @returns {Object} Returns `map`.\n */\nfunction addMapEntry(map, pair) {\n // Don't return `map.set` because it's not chainable in IE 11.\n map.set(pair[0], pair[1]);\n return map;\n}\n\n/**\n * Adds `value` to `set`.\n *\n * @private\n * @param {Object} set The set to modify.\n * @param {*} value The value to add.\n * @returns {Object} Returns `set`.\n */\nfunction addSetEntry(set, value) {\n // Don't return `set.add` because it's not chainable in IE 11.\n set.add(value);\n return set;\n}\n\n/**\n * A specialized version of `_.forEach` for arrays without support for\n * iteratee shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns `array`.\n */\nfunction arrayEach(array, iteratee) {\n var index = -1,\n length = array ? array.length : 0;\n\n while (++index < length) {\n if (iteratee(array[index], index, array) === false) {\n break;\n }\n }\n return array;\n}\n\n/**\n * Appends the elements of `values` to `array`.\n *\n * @private\n * @param {Array} array The array to modify.\n * @param {Array} values The values to append.\n * @returns {Array} Returns `array`.\n */\nfunction arrayPush(array, values) {\n var index = -1,\n length = values.length,\n offset = array.length;\n\n while (++index < length) {\n array[offset + index] = values[index];\n }\n return array;\n}\n\n/**\n * A specialized version of `_.reduce` for arrays without support for\n * iteratee shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @param {*} [accumulator] The initial value.\n * @param {boolean} [initAccum] Specify using the first element of `array` as\n * the initial value.\n * @returns {*} Returns the accumulated value.\n */\nfunction arrayReduce(array, iteratee, accumulator, initAccum) {\n var index = -1,\n length = array ? array.length : 0;\n\n if (initAccum && length) {\n accumulator = array[++index];\n }\n while (++index < length) {\n accumulator = iteratee(accumulator, array[index], index, array);\n }\n return accumulator;\n}\n\n/**\n * The base implementation of `_.times` without support for iteratee shorthands\n * or max array length checks.\n *\n * @private\n * @param {number} n The number of times to invoke `iteratee`.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the array of results.\n */\nfunction baseTimes(n, iteratee) {\n var index = -1,\n result = Array(n);\n\n while (++index < n) {\n result[index] = iteratee(index);\n }\n return result;\n}\n\n/**\n * Gets the value at `key` of `object`.\n *\n * @private\n * @param {Object} [object] The object to query.\n * @param {string} key The key of the property to get.\n * @returns {*} Returns the property value.\n */\nfunction getValue(object, key) {\n return object == null ? undefined : object[key];\n}\n\n/**\n * Checks if `value` is a host object in IE < 9.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a host object, else `false`.\n */\nfunction isHostObject(value) {\n // Many host objects are `Object` objects that can coerce to strings\n // despite having improperly defined `toString` methods.\n var result = false;\n if (value != null && typeof value.toString != 'function') {\n try {\n result = !!(value + '');\n } catch (e) {}\n }\n return result;\n}\n\n/**\n * Converts `map` to its key-value pairs.\n *\n * @private\n * @param {Object} map The map to convert.\n * @returns {Array} Returns the key-value pairs.\n */\nfunction mapToArray(map) {\n var index = -1,\n result = Array(map.size);\n\n map.forEach(function(value, key) {\n result[++index] = [key, value];\n });\n return result;\n}\n\n/**\n * Creates a unary function that invokes `func` with its argument transformed.\n *\n * @private\n * @param {Function} func The function to wrap.\n * @param {Function} transform The argument transform.\n * @returns {Function} Returns the new function.\n */\nfunction overArg(func, transform) {\n return function(arg) {\n return func(transform(arg));\n };\n}\n\n/**\n * Converts `set` to an array of its values.\n *\n * @private\n * @param {Object} set The set to convert.\n * @returns {Array} Returns the values.\n */\nfunction setToArray(set) {\n var index = -1,\n result = Array(set.size);\n\n set.forEach(function(value) {\n result[++index] = value;\n });\n return result;\n}\n\n/** Used for built-in method references. */\nvar arrayProto = Array.prototype,\n funcProto = Function.prototype,\n objectProto = Object.prototype;\n\n/** Used to detect overreaching core-js shims. */\nvar coreJsData = root['__core-js_shared__'];\n\n/** Used to detect methods masquerading as native. */\nvar maskSrcKey = (function() {\n var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');\n return uid ? ('Symbol(src)_1.' + uid) : '';\n}());\n\n/** Used to resolve the decompiled source of functions. */\nvar funcToString = funcProto.toString;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar objectToString = objectProto.toString;\n\n/** Used to detect if a method is native. */\nvar reIsNative = RegExp('^' +\n funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\\\$&')\n .replace(/hasOwnProperty|(function).*?(?=\\\\\\()| for .+?(?=\\\\\\])/g, '$1.*?') + '$'\n);\n\n/** Built-in value references. */\nvar Buffer = moduleExports ? root.Buffer : undefined,\n Symbol = root.Symbol,\n Uint8Array = root.Uint8Array,\n getPrototype = overArg(Object.getPrototypeOf, Object),\n objectCreate = Object.create,\n propertyIsEnumerable = objectProto.propertyIsEnumerable,\n splice = arrayProto.splice;\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeGetSymbols = Object.getOwnPropertySymbols,\n nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,\n nativeKeys = overArg(Object.keys, Object);\n\n/* Built-in method references that are verified to be native. */\nvar DataView = getNative(root, 'DataView'),\n Map = getNative(root, 'Map'),\n Promise = getNative(root, 'Promise'),\n Set = getNative(root, 'Set'),\n WeakMap = getNative(root, 'WeakMap'),\n nativeCreate = getNative(Object, 'create');\n\n/** Used to detect maps, sets, and weakmaps. */\nvar dataViewCtorString = toSource(DataView),\n mapCtorString = toSource(Map),\n promiseCtorString = toSource(Promise),\n setCtorString = toSource(Set),\n weakMapCtorString = toSource(WeakMap);\n\n/** Used to convert symbols to primitives and strings. */\nvar symbolProto = Symbol ? Symbol.prototype : undefined,\n symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;\n\n/**\n * Creates a hash object.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction Hash(entries) {\n var index = -1,\n length = entries ? entries.length : 0;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n/**\n * Removes all key-value entries from the hash.\n *\n * @private\n * @name clear\n * @memberOf Hash\n */\nfunction hashClear() {\n this.__data__ = nativeCreate ? nativeCreate(null) : {};\n}\n\n/**\n * Removes `key` and its value from the hash.\n *\n * @private\n * @name delete\n * @memberOf Hash\n * @param {Object} hash The hash to modify.\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction hashDelete(key) {\n return this.has(key) && delete this.__data__[key];\n}\n\n/**\n * Gets the hash value for `key`.\n *\n * @private\n * @name get\n * @memberOf Hash\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction hashGet(key) {\n var data = this.__data__;\n if (nativeCreate) {\n var result = data[key];\n return result === HASH_UNDEFINED ? undefined : result;\n }\n return hasOwnProperty.call(data, key) ? data[key] : undefined;\n}\n\n/**\n * Checks if a hash value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf Hash\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction hashHas(key) {\n var data = this.__data__;\n return nativeCreate ? data[key] !== undefined : hasOwnProperty.call(data, key);\n}\n\n/**\n * Sets the hash `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf Hash\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the hash instance.\n */\nfunction hashSet(key, value) {\n var data = this.__data__;\n data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;\n return this;\n}\n\n// Add methods to `Hash`.\nHash.prototype.clear = hashClear;\nHash.prototype['delete'] = hashDelete;\nHash.prototype.get = hashGet;\nHash.prototype.has = hashHas;\nHash.prototype.set = hashSet;\n\n/**\n * Creates an list cache object.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction ListCache(entries) {\n var index = -1,\n length = entries ? entries.length : 0;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n/**\n * Removes all key-value entries from the list cache.\n *\n * @private\n * @name clear\n * @memberOf ListCache\n */\nfunction listCacheClear() {\n this.__data__ = [];\n}\n\n/**\n * Removes `key` and its value from the list cache.\n *\n * @private\n * @name delete\n * @memberOf ListCache\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction listCacheDelete(key) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n if (index < 0) {\n return false;\n }\n var lastIndex = data.length - 1;\n if (index == lastIndex) {\n data.pop();\n } else {\n splice.call(data, index, 1);\n }\n return true;\n}\n\n/**\n * Gets the list cache value for `key`.\n *\n * @private\n * @name get\n * @memberOf ListCache\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction listCacheGet(key) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n return index < 0 ? undefined : data[index][1];\n}\n\n/**\n * Checks if a list cache value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf ListCache\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction listCacheHas(key) {\n return assocIndexOf(this.__data__, key) > -1;\n}\n\n/**\n * Sets the list cache `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf ListCache\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the list cache instance.\n */\nfunction listCacheSet(key, value) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n if (index < 0) {\n data.push([key, value]);\n } else {\n data[index][1] = value;\n }\n return this;\n}\n\n// Add methods to `ListCache`.\nListCache.prototype.clear = listCacheClear;\nListCache.prototype['delete'] = listCacheDelete;\nListCache.prototype.get = listCacheGet;\nListCache.prototype.has = listCacheHas;\nListCache.prototype.set = listCacheSet;\n\n/**\n * Creates a map cache object to store key-value pairs.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction MapCache(entries) {\n var index = -1,\n length = entries ? entries.length : 0;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n/**\n * Removes all key-value entries from the map.\n *\n * @private\n * @name clear\n * @memberOf MapCache\n */\nfunction mapCacheClear() {\n this.__data__ = {\n 'hash': new Hash,\n 'map': new (Map || ListCache),\n 'string': new Hash\n };\n}\n\n/**\n * Removes `key` and its value from the map.\n *\n * @private\n * @name delete\n * @memberOf MapCache\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction mapCacheDelete(key) {\n return getMapData(this, key)['delete'](key);\n}\n\n/**\n * Gets the map value for `key`.\n *\n * @private\n * @name get\n * @memberOf MapCache\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction mapCacheGet(key) {\n return getMapData(this, key).get(key);\n}\n\n/**\n * Checks if a map value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf MapCache\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction mapCacheHas(key) {\n return getMapData(this, key).has(key);\n}\n\n/**\n * Sets the map `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf MapCache\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the map cache instance.\n */\nfunction mapCacheSet(key, value) {\n getMapData(this, key).set(key, value);\n return this;\n}\n\n// Add methods to `MapCache`.\nMapCache.prototype.clear = mapCacheClear;\nMapCache.prototype['delete'] = mapCacheDelete;\nMapCache.prototype.get = mapCacheGet;\nMapCache.prototype.has = mapCacheHas;\nMapCache.prototype.set = mapCacheSet;\n\n/**\n * Creates a stack cache object to store key-value pairs.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction Stack(entries) {\n this.__data__ = new ListCache(entries);\n}\n\n/**\n * Removes all key-value entries from the stack.\n *\n * @private\n * @name clear\n * @memberOf Stack\n */\nfunction stackClear() {\n this.__data__ = new ListCache;\n}\n\n/**\n * Removes `key` and its value from the stack.\n *\n * @private\n * @name delete\n * @memberOf Stack\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction stackDelete(key) {\n return this.__data__['delete'](key);\n}\n\n/**\n * Gets the stack value for `key`.\n *\n * @private\n * @name get\n * @memberOf Stack\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction stackGet(key) {\n return this.__data__.get(key);\n}\n\n/**\n * Checks if a stack value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf Stack\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction stackHas(key) {\n return this.__data__.has(key);\n}\n\n/**\n * Sets the stack `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf Stack\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the stack cache instance.\n */\nfunction stackSet(key, value) {\n var cache = this.__data__;\n if (cache instanceof ListCache) {\n var pairs = cache.__data__;\n if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {\n pairs.push([key, value]);\n return this;\n }\n cache = this.__data__ = new MapCache(pairs);\n }\n cache.set(key, value);\n return this;\n}\n\n// Add methods to `Stack`.\nStack.prototype.clear = stackClear;\nStack.prototype['delete'] = stackDelete;\nStack.prototype.get = stackGet;\nStack.prototype.has = stackHas;\nStack.prototype.set = stackSet;\n\n/**\n * Creates an array of the enumerable property names of the array-like `value`.\n *\n * @private\n * @param {*} value The value to query.\n * @param {boolean} inherited Specify returning inherited property names.\n * @returns {Array} Returns the array of property names.\n */\nfunction arrayLikeKeys(value, inherited) {\n // Safari 8.1 makes `arguments.callee` enumerable in strict mode.\n // Safari 9 makes `arguments.length` enumerable in strict mode.\n var result = (isArray(value) || isArguments(value))\n ? baseTimes(value.length, String)\n : [];\n\n var length = result.length,\n skipIndexes = !!length;\n\n for (var key in value) {\n if ((inherited || hasOwnProperty.call(value, key)) &&\n !(skipIndexes && (key == 'length' || isIndex(key, length)))) {\n result.push(key);\n }\n }\n return result;\n}\n\n/**\n * Assigns `value` to `key` of `object` if the existing value is not equivalent\n * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * for equality comparisons.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {string} key The key of the property to assign.\n * @param {*} value The value to assign.\n */\nfunction assignValue(object, key, value) {\n var objValue = object[key];\n if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||\n (value === undefined && !(key in object))) {\n object[key] = value;\n }\n}\n\n/**\n * Gets the index at which the `key` is found in `array` of key-value pairs.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {*} key The key to search for.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\nfunction assocIndexOf(array, key) {\n var length = array.length;\n while (length--) {\n if (eq(array[length][0], key)) {\n return length;\n }\n }\n return -1;\n}\n\n/**\n * The base implementation of `_.assign` without support for multiple sources\n * or `customizer` functions.\n *\n * @private\n * @param {Object} object The destination object.\n * @param {Object} source The source object.\n * @returns {Object} Returns `object`.\n */\nfunction baseAssign(object, source) {\n return object && copyObject(source, keys(source), object);\n}\n\n/**\n * The base implementation of `_.clone` and `_.cloneDeep` which tracks\n * traversed objects.\n *\n * @private\n * @param {*} value The value to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @param {boolean} [isFull] Specify a clone including symbols.\n * @param {Function} [customizer] The function to customize cloning.\n * @param {string} [key] The key of `value`.\n * @param {Object} [object] The parent object of `value`.\n * @param {Object} [stack] Tracks traversed objects and their clone counterparts.\n * @returns {*} Returns the cloned value.\n */\nfunction baseClone(value, isDeep, isFull, customizer, key, object, stack) {\n var result;\n if (customizer) {\n result = object ? customizer(value, key, object, stack) : customizer(value);\n }\n if (result !== undefined) {\n return result;\n }\n if (!isObject(value)) {\n return value;\n }\n var isArr = isArray(value);\n if (isArr) {\n result = initCloneArray(value);\n if (!isDeep) {\n return copyArray(value, result);\n }\n } else {\n var tag = getTag(value),\n isFunc = tag == funcTag || tag == genTag;\n\n if (isBuffer(value)) {\n return cloneBuffer(value, isDeep);\n }\n if (tag == objectTag || tag == argsTag || (isFunc && !object)) {\n if (isHostObject(value)) {\n return object ? value : {};\n }\n result = initCloneObject(isFunc ? {} : value);\n if (!isDeep) {\n return copySymbols(value, baseAssign(result, value));\n }\n } else {\n if (!cloneableTags[tag]) {\n return object ? value : {};\n }\n result = initCloneByTag(value, tag, baseClone, isDeep);\n }\n }\n // Check for circular references and return its corresponding clone.\n stack || (stack = new Stack);\n var stacked = stack.get(value);\n if (stacked) {\n return stacked;\n }\n stack.set(value, result);\n\n if (!isArr) {\n var props = isFull ? getAllKeys(value) : keys(value);\n }\n arrayEach(props || value, function(subValue, key) {\n if (props) {\n key = subValue;\n subValue = value[key];\n }\n // Recursively populate clone (susceptible to call stack limits).\n assignValue(result, key, baseClone(subValue, isDeep, isFull, customizer, key, value, stack));\n });\n return result;\n}\n\n/**\n * The base implementation of `_.create` without support for assigning\n * properties to the created object.\n *\n * @private\n * @param {Object} prototype The object to inherit from.\n * @returns {Object} Returns the new object.\n */\nfunction baseCreate(proto) {\n return isObject(proto) ? objectCreate(proto) : {};\n}\n\n/**\n * The base implementation of `getAllKeys` and `getAllKeysIn` which uses\n * `keysFunc` and `symbolsFunc` to get the enumerable property names and\n * symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Function} keysFunc The function to get the keys of `object`.\n * @param {Function} symbolsFunc The function to get the symbols of `object`.\n * @returns {Array} Returns the array of property names and symbols.\n */\nfunction baseGetAllKeys(object, keysFunc, symbolsFunc) {\n var result = keysFunc(object);\n return isArray(object) ? result : arrayPush(result, symbolsFunc(object));\n}\n\n/**\n * The base implementation of `getTag`.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n */\nfunction baseGetTag(value) {\n return objectToString.call(value);\n}\n\n/**\n * The base implementation of `_.isNative` without bad shim checks.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a native function,\n * else `false`.\n */\nfunction baseIsNative(value) {\n if (!isObject(value) || isMasked(value)) {\n return false;\n }\n var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor;\n return pattern.test(toSource(value));\n}\n\n/**\n * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\nfunction baseKeys(object) {\n if (!isPrototype(object)) {\n return nativeKeys(object);\n }\n var result = [];\n for (var key in Object(object)) {\n if (hasOwnProperty.call(object, key) && key != 'constructor') {\n result.push(key);\n }\n }\n return result;\n}\n\n/**\n * Creates a clone of `buffer`.\n *\n * @private\n * @param {Buffer} buffer The buffer to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Buffer} Returns the cloned buffer.\n */\nfunction cloneBuffer(buffer, isDeep) {\n if (isDeep) {\n return buffer.slice();\n }\n var result = new buffer.constructor(buffer.length);\n buffer.copy(result);\n return result;\n}\n\n/**\n * Creates a clone of `arrayBuffer`.\n *\n * @private\n * @param {ArrayBuffer} arrayBuffer The array buffer to clone.\n * @returns {ArrayBuffer} Returns the cloned array buffer.\n */\nfunction cloneArrayBuffer(arrayBuffer) {\n var result = new arrayBuffer.constructor(arrayBuffer.byteLength);\n new Uint8Array(result).set(new Uint8Array(arrayBuffer));\n return result;\n}\n\n/**\n * Creates a clone of `dataView`.\n *\n * @private\n * @param {Object} dataView The data view to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Object} Returns the cloned data view.\n */\nfunction cloneDataView(dataView, isDeep) {\n var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;\n return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);\n}\n\n/**\n * Creates a clone of `map`.\n *\n * @private\n * @param {Object} map The map to clone.\n * @param {Function} cloneFunc The function to clone values.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Object} Returns the cloned map.\n */\nfunction cloneMap(map, isDeep, cloneFunc) {\n var array = isDeep ? cloneFunc(mapToArray(map), true) : mapToArray(map);\n return arrayReduce(array, addMapEntry, new map.constructor);\n}\n\n/**\n * Creates a clone of `regexp`.\n *\n * @private\n * @param {Object} regexp The regexp to clone.\n * @returns {Object} Returns the cloned regexp.\n */\nfunction cloneRegExp(regexp) {\n var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));\n result.lastIndex = regexp.lastIndex;\n return result;\n}\n\n/**\n * Creates a clone of `set`.\n *\n * @private\n * @param {Object} set The set to clone.\n * @param {Function} cloneFunc The function to clone values.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Object} Returns the cloned set.\n */\nfunction cloneSet(set, isDeep, cloneFunc) {\n var array = isDeep ? cloneFunc(setToArray(set), true) : setToArray(set);\n return arrayReduce(array, addSetEntry, new set.constructor);\n}\n\n/**\n * Creates a clone of the `symbol` object.\n *\n * @private\n * @param {Object} symbol The symbol object to clone.\n * @returns {Object} Returns the cloned symbol object.\n */\nfunction cloneSymbol(symbol) {\n return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};\n}\n\n/**\n * Creates a clone of `typedArray`.\n *\n * @private\n * @param {Object} typedArray The typed array to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Object} Returns the cloned typed array.\n */\nfunction cloneTypedArray(typedArray, isDeep) {\n var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;\n return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);\n}\n\n/**\n * Copies the values of `source` to `array`.\n *\n * @private\n * @param {Array} source The array to copy values from.\n * @param {Array} [array=[]] The array to copy values to.\n * @returns {Array} Returns `array`.\n */\nfunction copyArray(source, array) {\n var index = -1,\n length = source.length;\n\n array || (array = Array(length));\n while (++index < length) {\n array[index] = source[index];\n }\n return array;\n}\n\n/**\n * Copies properties of `source` to `object`.\n *\n * @private\n * @param {Object} source The object to copy properties from.\n * @param {Array} props The property identifiers to copy.\n * @param {Object} [object={}] The object to copy properties to.\n * @param {Function} [customizer] The function to customize copied values.\n * @returns {Object} Returns `object`.\n */\nfunction copyObject(source, props, object, customizer) {\n object || (object = {});\n\n var index = -1,\n length = props.length;\n\n while (++index < length) {\n var key = props[index];\n\n var newValue = customizer\n ? customizer(object[key], source[key], key, object, source)\n : undefined;\n\n assignValue(object, key, newValue === undefined ? source[key] : newValue);\n }\n return object;\n}\n\n/**\n * Copies own symbol properties of `source` to `object`.\n *\n * @private\n * @param {Object} source The object to copy symbols from.\n * @param {Object} [object={}] The object to copy symbols to.\n * @returns {Object} Returns `object`.\n */\nfunction copySymbols(source, object) {\n return copyObject(source, getSymbols(source), object);\n}\n\n/**\n * Creates an array of own enumerable property names and symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names and symbols.\n */\nfunction getAllKeys(object) {\n return baseGetAllKeys(object, keys, getSymbols);\n}\n\n/**\n * Gets the data for `map`.\n *\n * @private\n * @param {Object} map The map to query.\n * @param {string} key The reference key.\n * @returns {*} Returns the map data.\n */\nfunction getMapData(map, key) {\n var data = map.__data__;\n return isKeyable(key)\n ? data[typeof key == 'string' ? 'string' : 'hash']\n : data.map;\n}\n\n/**\n * Gets the native function at `key` of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {string} key The key of the method to get.\n * @returns {*} Returns the function if it's native, else `undefined`.\n */\nfunction getNative(object, key) {\n var value = getValue(object, key);\n return baseIsNative(value) ? value : undefined;\n}\n\n/**\n * Creates an array of the own enumerable symbol properties of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of symbols.\n */\nvar getSymbols = nativeGetSymbols ? overArg(nativeGetSymbols, Object) : stubArray;\n\n/**\n * Gets the `toStringTag` of `value`.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n */\nvar getTag = baseGetTag;\n\n// Fallback for data views, maps, sets, and weak maps in IE 11,\n// for data views in Edge < 14, and promises in Node.js.\nif ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||\n (Map && getTag(new Map) != mapTag) ||\n (Promise && getTag(Promise.resolve()) != promiseTag) ||\n (Set && getTag(new Set) != setTag) ||\n (WeakMap && getTag(new WeakMap) != weakMapTag)) {\n getTag = function(value) {\n var result = objectToString.call(value),\n Ctor = result == objectTag ? value.constructor : undefined,\n ctorString = Ctor ? toSource(Ctor) : undefined;\n\n if (ctorString) {\n switch (ctorString) {\n case dataViewCtorString: return dataViewTag;\n case mapCtorString: return mapTag;\n case promiseCtorString: return promiseTag;\n case setCtorString: return setTag;\n case weakMapCtorString: return weakMapTag;\n }\n }\n return result;\n };\n}\n\n/**\n * Initializes an array clone.\n *\n * @private\n * @param {Array} array The array to clone.\n * @returns {Array} Returns the initialized clone.\n */\nfunction initCloneArray(array) {\n var length = array.length,\n result = array.constructor(length);\n\n // Add properties assigned by `RegExp#exec`.\n if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {\n result.index = array.index;\n result.input = array.input;\n }\n return result;\n}\n\n/**\n * Initializes an object clone.\n *\n * @private\n * @param {Object} object The object to clone.\n * @returns {Object} Returns the initialized clone.\n */\nfunction initCloneObject(object) {\n return (typeof object.constructor == 'function' && !isPrototype(object))\n ? baseCreate(getPrototype(object))\n : {};\n}\n\n/**\n * Initializes an object clone based on its `toStringTag`.\n *\n * **Note:** This function only supports cloning values with tags of\n * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.\n *\n * @private\n * @param {Object} object The object to clone.\n * @param {string} tag The `toStringTag` of the object to clone.\n * @param {Function} cloneFunc The function to clone values.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Object} Returns the initialized clone.\n */\nfunction initCloneByTag(object, tag, cloneFunc, isDeep) {\n var Ctor = object.constructor;\n switch (tag) {\n case arrayBufferTag:\n return cloneArrayBuffer(object);\n\n case boolTag:\n case dateTag:\n return new Ctor(+object);\n\n case dataViewTag:\n return cloneDataView(object, isDeep);\n\n case float32Tag: case float64Tag:\n case int8Tag: case int16Tag: case int32Tag:\n case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:\n return cloneTypedArray(object, isDeep);\n\n case mapTag:\n return cloneMap(object, isDeep, cloneFunc);\n\n case numberTag:\n case stringTag:\n return new Ctor(object);\n\n case regexpTag:\n return cloneRegExp(object);\n\n case setTag:\n return cloneSet(object, isDeep, cloneFunc);\n\n case symbolTag:\n return cloneSymbol(object);\n }\n}\n\n/**\n * Checks if `value` is a valid array-like index.\n *\n * @private\n * @param {*} value The value to check.\n * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.\n * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.\n */\nfunction isIndex(value, length) {\n length = length == null ? MAX_SAFE_INTEGER : length;\n return !!length &&\n (typeof value == 'number' || reIsUint.test(value)) &&\n (value > -1 && value % 1 == 0 && value < length);\n}\n\n/**\n * Checks if `value` is suitable for use as unique object key.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is suitable, else `false`.\n */\nfunction isKeyable(value) {\n var type = typeof value;\n return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')\n ? (value !== '__proto__')\n : (value === null);\n}\n\n/**\n * Checks if `func` has its source masked.\n *\n * @private\n * @param {Function} func The function to check.\n * @returns {boolean} Returns `true` if `func` is masked, else `false`.\n */\nfunction isMasked(func) {\n return !!maskSrcKey && (maskSrcKey in func);\n}\n\n/**\n * Checks if `value` is likely a prototype object.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.\n */\nfunction isPrototype(value) {\n var Ctor = value && value.constructor,\n proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;\n\n return value === proto;\n}\n\n/**\n * Converts `func` to its source code.\n *\n * @private\n * @param {Function} func The function to process.\n * @returns {string} Returns the source code.\n */\nfunction toSource(func) {\n if (func != null) {\n try {\n return funcToString.call(func);\n } catch (e) {}\n try {\n return (func + '');\n } catch (e) {}\n }\n return '';\n}\n\n/**\n * This method is like `_.clone` except that it recursively clones `value`.\n *\n * @static\n * @memberOf _\n * @since 1.0.0\n * @category Lang\n * @param {*} value The value to recursively clone.\n * @returns {*} Returns the deep cloned value.\n * @see _.clone\n * @example\n *\n * var objects = [{ 'a': 1 }, { 'b': 2 }];\n *\n * var deep = _.cloneDeep(objects);\n * console.log(deep[0] === objects[0]);\n * // => false\n */\nfunction cloneDeep(value) {\n return baseClone(value, true, true);\n}\n\n/**\n * Performs a\n * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * comparison between two values to determine if they are equivalent.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n * @example\n *\n * var object = { 'a': 1 };\n * var other = { 'a': 1 };\n *\n * _.eq(object, object);\n * // => true\n *\n * _.eq(object, other);\n * // => false\n *\n * _.eq('a', 'a');\n * // => true\n *\n * _.eq('a', Object('a'));\n * // => false\n *\n * _.eq(NaN, NaN);\n * // => true\n */\nfunction eq(value, other) {\n return value === other || (value !== value && other !== other);\n}\n\n/**\n * Checks if `value` is likely an `arguments` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an `arguments` object,\n * else `false`.\n * @example\n *\n * _.isArguments(function() { return arguments; }());\n * // => true\n *\n * _.isArguments([1, 2, 3]);\n * // => false\n */\nfunction isArguments(value) {\n // Safari 8.1 makes `arguments.callee` enumerable in strict mode.\n return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') &&\n (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag);\n}\n\n/**\n * Checks if `value` is classified as an `Array` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an array, else `false`.\n * @example\n *\n * _.isArray([1, 2, 3]);\n * // => true\n *\n * _.isArray(document.body.children);\n * // => false\n *\n * _.isArray('abc');\n * // => false\n *\n * _.isArray(_.noop);\n * // => false\n */\nvar isArray = Array.isArray;\n\n/**\n * Checks if `value` is array-like. A value is considered array-like if it's\n * not a function and has a `value.length` that's an integer greater than or\n * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is array-like, else `false`.\n * @example\n *\n * _.isArrayLike([1, 2, 3]);\n * // => true\n *\n * _.isArrayLike(document.body.children);\n * // => true\n *\n * _.isArrayLike('abc');\n * // => true\n *\n * _.isArrayLike(_.noop);\n * // => false\n */\nfunction isArrayLike(value) {\n return value != null && isLength(value.length) && !isFunction(value);\n}\n\n/**\n * This method is like `_.isArrayLike` except that it also checks if `value`\n * is an object.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an array-like object,\n * else `false`.\n * @example\n *\n * _.isArrayLikeObject([1, 2, 3]);\n * // => true\n *\n * _.isArrayLikeObject(document.body.children);\n * // => true\n *\n * _.isArrayLikeObject('abc');\n * // => false\n *\n * _.isArrayLikeObject(_.noop);\n * // => false\n */\nfunction isArrayLikeObject(value) {\n return isObjectLike(value) && isArrayLike(value);\n}\n\n/**\n * Checks if `value` is a buffer.\n *\n * @static\n * @memberOf _\n * @since 4.3.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.\n * @example\n *\n * _.isBuffer(new Buffer(2));\n * // => true\n *\n * _.isBuffer(new Uint8Array(2));\n * // => false\n */\nvar isBuffer = nativeIsBuffer || stubFalse;\n\n/**\n * Checks if `value` is classified as a `Function` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a function, else `false`.\n * @example\n *\n * _.isFunction(_);\n * // => true\n *\n * _.isFunction(/abc/);\n * // => false\n */\nfunction isFunction(value) {\n // The use of `Object#toString` avoids issues with the `typeof` operator\n // in Safari 8-9 which returns 'object' for typed array and other constructors.\n var tag = isObject(value) ? objectToString.call(value) : '';\n return tag == funcTag || tag == genTag;\n}\n\n/**\n * Checks if `value` is a valid array-like length.\n *\n * **Note:** This method is loosely based on\n * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.\n * @example\n *\n * _.isLength(3);\n * // => true\n *\n * _.isLength(Number.MIN_VALUE);\n * // => false\n *\n * _.isLength(Infinity);\n * // => false\n *\n * _.isLength('3');\n * // => false\n */\nfunction isLength(value) {\n return typeof value == 'number' &&\n value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;\n}\n\n/**\n * Checks if `value` is the\n * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)\n * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n var type = typeof value;\n return !!value && (type == 'object' || type == 'function');\n}\n\n/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n return !!value && typeof value == 'object';\n}\n\n/**\n * Creates an array of the own enumerable property names of `object`.\n *\n * **Note:** Non-object values are coerced to objects. See the\n * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)\n * for more details.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.keys(new Foo);\n * // => ['a', 'b'] (iteration order is not guaranteed)\n *\n * _.keys('hi');\n * // => ['0', '1']\n */\nfunction keys(object) {\n return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);\n}\n\n/**\n * This method returns a new empty array.\n *\n * @static\n * @memberOf _\n * @since 4.13.0\n * @category Util\n * @returns {Array} Returns the new empty array.\n * @example\n *\n * var arrays = _.times(2, _.stubArray);\n *\n * console.log(arrays);\n * // => [[], []]\n *\n * console.log(arrays[0] === arrays[1]);\n * // => false\n */\nfunction stubArray() {\n return [];\n}\n\n/**\n * This method returns `false`.\n *\n * @static\n * @memberOf _\n * @since 4.13.0\n * @category Util\n * @returns {boolean} Returns `false`.\n * @example\n *\n * _.times(2, _.stubFalse);\n * // => [false, false]\n */\nfunction stubFalse() {\n return false;\n}\n\nmodule.exports = cloneDeep;\n\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6), __webpack_require__(21)(module)))\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/lodash.clonedeep/index.js\n// module id = 20\n// module chunks = 0\n\n//# sourceURL=webpack:///./node_modules/lodash.clonedeep/index.js?"); /***/ }), /* 21 */ @@ -227,7 +227,7 @@ eval("module.exports = function(module) {\r\n\tif(!module.webpackPolyfill) {\r\n /* 22 */ /***/ (function(module, exports, __webpack_require__) { -eval("/* WEBPACK VAR INJECTION */(function(global) {/**\n * lodash (Custom Build) \n * Build: `lodash modularize exports=\"npm\" -o ./`\n * Copyright jQuery Foundation and other contributors \n * Released under MIT license \n * Based on Underscore.js 1.8.3 \n * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n */\n\n/** Used as the `TypeError` message for \"Functions\" methods. */\nvar FUNC_ERROR_TEXT = 'Expected a function';\n\n/** Used as references for various `Number` constants. */\nvar NAN = 0 / 0;\n\n/** `Object#toString` result references. */\nvar symbolTag = '[object Symbol]';\n\n/** Used to match leading and trailing whitespace. */\nvar reTrim = /^\\s+|\\s+$/g;\n\n/** Used to detect bad signed hexadecimal string values. */\nvar reIsBadHex = /^[-+]0x[0-9a-f]+$/i;\n\n/** Used to detect binary string values. */\nvar reIsBinary = /^0b[01]+$/i;\n\n/** Used to detect octal string values. */\nvar reIsOctal = /^0o[0-7]+$/i;\n\n/** Built-in method references without a dependency on `root`. */\nvar freeParseInt = parseInt;\n\n/** Detect free variable `global` from Node.js. */\nvar freeGlobal = typeof global == 'object' && global && global.Object === Object && global;\n\n/** Detect free variable `self`. */\nvar freeSelf = typeof self == 'object' && self && self.Object === Object && self;\n\n/** Used as a reference to the global object. */\nvar root = freeGlobal || freeSelf || Function('return this')();\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar objectToString = objectProto.toString;\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeMax = Math.max,\n nativeMin = Math.min;\n\n/**\n * Gets the timestamp of the number of milliseconds that have elapsed since\n * the Unix epoch (1 January 1970 00:00:00 UTC).\n *\n * @static\n * @memberOf _\n * @since 2.4.0\n * @category Date\n * @returns {number} Returns the timestamp.\n * @example\n *\n * _.defer(function(stamp) {\n * console.log(_.now() - stamp);\n * }, _.now());\n * // => Logs the number of milliseconds it took for the deferred invocation.\n */\nvar now = function() {\n return root.Date.now();\n};\n\n/**\n * Creates a debounced function that delays invoking `func` until after `wait`\n * milliseconds have elapsed since the last time the debounced function was\n * invoked. The debounced function comes with a `cancel` method to cancel\n * delayed `func` invocations and a `flush` method to immediately invoke them.\n * Provide `options` to indicate whether `func` should be invoked on the\n * leading and/or trailing edge of the `wait` timeout. The `func` is invoked\n * with the last arguments provided to the debounced function. Subsequent\n * calls to the debounced function return the result of the last `func`\n * invocation.\n *\n * **Note:** If `leading` and `trailing` options are `true`, `func` is\n * invoked on the trailing edge of the timeout only if the debounced function\n * is invoked more than once during the `wait` timeout.\n *\n * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred\n * until to the next tick, similar to `setTimeout` with a timeout of `0`.\n *\n * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)\n * for details over the differences between `_.debounce` and `_.throttle`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to debounce.\n * @param {number} [wait=0] The number of milliseconds to delay.\n * @param {Object} [options={}] The options object.\n * @param {boolean} [options.leading=false]\n * Specify invoking on the leading edge of the timeout.\n * @param {number} [options.maxWait]\n * The maximum time `func` is allowed to be delayed before it's invoked.\n * @param {boolean} [options.trailing=true]\n * Specify invoking on the trailing edge of the timeout.\n * @returns {Function} Returns the new debounced function.\n * @example\n *\n * // Avoid costly calculations while the window size is in flux.\n * jQuery(window).on('resize', _.debounce(calculateLayout, 150));\n *\n * // Invoke `sendMail` when clicked, debouncing subsequent calls.\n * jQuery(element).on('click', _.debounce(sendMail, 300, {\n * 'leading': true,\n * 'trailing': false\n * }));\n *\n * // Ensure `batchLog` is invoked once after 1 second of debounced calls.\n * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });\n * var source = new EventSource('/stream');\n * jQuery(source).on('message', debounced);\n *\n * // Cancel the trailing debounced invocation.\n * jQuery(window).on('popstate', debounced.cancel);\n */\nfunction debounce(func, wait, options) {\n var lastArgs,\n lastThis,\n maxWait,\n result,\n timerId,\n lastCallTime,\n lastInvokeTime = 0,\n leading = false,\n maxing = false,\n trailing = true;\n\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n wait = toNumber(wait) || 0;\n if (isObject(options)) {\n leading = !!options.leading;\n maxing = 'maxWait' in options;\n maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;\n trailing = 'trailing' in options ? !!options.trailing : trailing;\n }\n\n function invokeFunc(time) {\n var args = lastArgs,\n thisArg = lastThis;\n\n lastArgs = lastThis = undefined;\n lastInvokeTime = time;\n result = func.apply(thisArg, args);\n return result;\n }\n\n function leadingEdge(time) {\n // Reset any `maxWait` timer.\n lastInvokeTime = time;\n // Start the timer for the trailing edge.\n timerId = setTimeout(timerExpired, wait);\n // Invoke the leading edge.\n return leading ? invokeFunc(time) : result;\n }\n\n function remainingWait(time) {\n var timeSinceLastCall = time - lastCallTime,\n timeSinceLastInvoke = time - lastInvokeTime,\n result = wait - timeSinceLastCall;\n\n return maxing ? nativeMin(result, maxWait - timeSinceLastInvoke) : result;\n }\n\n function shouldInvoke(time) {\n var timeSinceLastCall = time - lastCallTime,\n timeSinceLastInvoke = time - lastInvokeTime;\n\n // Either this is the first call, activity has stopped and we're at the\n // trailing edge, the system time has gone backwards and we're treating\n // it as the trailing edge, or we've hit the `maxWait` limit.\n return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||\n (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));\n }\n\n function timerExpired() {\n var time = now();\n if (shouldInvoke(time)) {\n return trailingEdge(time);\n }\n // Restart the timer.\n timerId = setTimeout(timerExpired, remainingWait(time));\n }\n\n function trailingEdge(time) {\n timerId = undefined;\n\n // Only invoke if we have `lastArgs` which means `func` has been\n // debounced at least once.\n if (trailing && lastArgs) {\n return invokeFunc(time);\n }\n lastArgs = lastThis = undefined;\n return result;\n }\n\n function cancel() {\n if (timerId !== undefined) {\n clearTimeout(timerId);\n }\n lastInvokeTime = 0;\n lastArgs = lastCallTime = lastThis = timerId = undefined;\n }\n\n function flush() {\n return timerId === undefined ? result : trailingEdge(now());\n }\n\n function debounced() {\n var time = now(),\n isInvoking = shouldInvoke(time);\n\n lastArgs = arguments;\n lastThis = this;\n lastCallTime = time;\n\n if (isInvoking) {\n if (timerId === undefined) {\n return leadingEdge(lastCallTime);\n }\n if (maxing) {\n // Handle invocations in a tight loop.\n timerId = setTimeout(timerExpired, wait);\n return invokeFunc(lastCallTime);\n }\n }\n if (timerId === undefined) {\n timerId = setTimeout(timerExpired, wait);\n }\n return result;\n }\n debounced.cancel = cancel;\n debounced.flush = flush;\n return debounced;\n}\n\n/**\n * Creates a throttled function that only invokes `func` at most once per\n * every `wait` milliseconds. The throttled function comes with a `cancel`\n * method to cancel delayed `func` invocations and a `flush` method to\n * immediately invoke them. Provide `options` to indicate whether `func`\n * should be invoked on the leading and/or trailing edge of the `wait`\n * timeout. The `func` is invoked with the last arguments provided to the\n * throttled function. Subsequent calls to the throttled function return the\n * result of the last `func` invocation.\n *\n * **Note:** If `leading` and `trailing` options are `true`, `func` is\n * invoked on the trailing edge of the timeout only if the throttled function\n * is invoked more than once during the `wait` timeout.\n *\n * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred\n * until to the next tick, similar to `setTimeout` with a timeout of `0`.\n *\n * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)\n * for details over the differences between `_.throttle` and `_.debounce`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to throttle.\n * @param {number} [wait=0] The number of milliseconds to throttle invocations to.\n * @param {Object} [options={}] The options object.\n * @param {boolean} [options.leading=true]\n * Specify invoking on the leading edge of the timeout.\n * @param {boolean} [options.trailing=true]\n * Specify invoking on the trailing edge of the timeout.\n * @returns {Function} Returns the new throttled function.\n * @example\n *\n * // Avoid excessively updating the position while scrolling.\n * jQuery(window).on('scroll', _.throttle(updatePosition, 100));\n *\n * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.\n * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });\n * jQuery(element).on('click', throttled);\n *\n * // Cancel the trailing throttled invocation.\n * jQuery(window).on('popstate', throttled.cancel);\n */\nfunction throttle(func, wait, options) {\n var leading = true,\n trailing = true;\n\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n if (isObject(options)) {\n leading = 'leading' in options ? !!options.leading : leading;\n trailing = 'trailing' in options ? !!options.trailing : trailing;\n }\n return debounce(func, wait, {\n 'leading': leading,\n 'maxWait': wait,\n 'trailing': trailing\n });\n}\n\n/**\n * Checks if `value` is the\n * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)\n * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n var type = typeof value;\n return !!value && (type == 'object' || type == 'function');\n}\n\n/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n return !!value && typeof value == 'object';\n}\n\n/**\n * Checks if `value` is classified as a `Symbol` primitive or object.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.\n * @example\n *\n * _.isSymbol(Symbol.iterator);\n * // => true\n *\n * _.isSymbol('abc');\n * // => false\n */\nfunction isSymbol(value) {\n return typeof value == 'symbol' ||\n (isObjectLike(value) && objectToString.call(value) == symbolTag);\n}\n\n/**\n * Converts `value` to a number.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to process.\n * @returns {number} Returns the number.\n * @example\n *\n * _.toNumber(3.2);\n * // => 3.2\n *\n * _.toNumber(Number.MIN_VALUE);\n * // => 5e-324\n *\n * _.toNumber(Infinity);\n * // => Infinity\n *\n * _.toNumber('3.2');\n * // => 3.2\n */\nfunction toNumber(value) {\n if (typeof value == 'number') {\n return value;\n }\n if (isSymbol(value)) {\n return NAN;\n }\n if (isObject(value)) {\n var other = typeof value.valueOf == 'function' ? value.valueOf() : value;\n value = isObject(other) ? (other + '') : other;\n }\n if (typeof value != 'string') {\n return value === 0 ? value : +value;\n }\n value = value.replace(reTrim, '');\n var isBinary = reIsBinary.test(value);\n return (isBinary || reIsOctal.test(value))\n ? freeParseInt(value.slice(2), isBinary ? 2 : 8)\n : (reIsBadHex.test(value) ? NAN : +value);\n}\n\nmodule.exports = throttle;\n\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(7)))\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/lodash.throttle/index.js\n// module id = 22\n// module chunks = 0\n\n//# sourceURL=webpack:///./node_modules/lodash.throttle/index.js?"); +eval("/* WEBPACK VAR INJECTION */(function(global) {/**\n * lodash (Custom Build) \n * Build: `lodash modularize exports=\"npm\" -o ./`\n * Copyright jQuery Foundation and other contributors \n * Released under MIT license \n * Based on Underscore.js 1.8.3 \n * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n */\n\n/** Used as the `TypeError` message for \"Functions\" methods. */\nvar FUNC_ERROR_TEXT = 'Expected a function';\n\n/** Used as references for various `Number` constants. */\nvar NAN = 0 / 0;\n\n/** `Object#toString` result references. */\nvar symbolTag = '[object Symbol]';\n\n/** Used to match leading and trailing whitespace. */\nvar reTrim = /^\\s+|\\s+$/g;\n\n/** Used to detect bad signed hexadecimal string values. */\nvar reIsBadHex = /^[-+]0x[0-9a-f]+$/i;\n\n/** Used to detect binary string values. */\nvar reIsBinary = /^0b[01]+$/i;\n\n/** Used to detect octal string values. */\nvar reIsOctal = /^0o[0-7]+$/i;\n\n/** Built-in method references without a dependency on `root`. */\nvar freeParseInt = parseInt;\n\n/** Detect free variable `global` from Node.js. */\nvar freeGlobal = typeof global == 'object' && global && global.Object === Object && global;\n\n/** Detect free variable `self`. */\nvar freeSelf = typeof self == 'object' && self && self.Object === Object && self;\n\n/** Used as a reference to the global object. */\nvar root = freeGlobal || freeSelf || Function('return this')();\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar objectToString = objectProto.toString;\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeMax = Math.max,\n nativeMin = Math.min;\n\n/**\n * Gets the timestamp of the number of milliseconds that have elapsed since\n * the Unix epoch (1 January 1970 00:00:00 UTC).\n *\n * @static\n * @memberOf _\n * @since 2.4.0\n * @category Date\n * @returns {number} Returns the timestamp.\n * @example\n *\n * _.defer(function(stamp) {\n * console.log(_.now() - stamp);\n * }, _.now());\n * // => Logs the number of milliseconds it took for the deferred invocation.\n */\nvar now = function() {\n return root.Date.now();\n};\n\n/**\n * Creates a debounced function that delays invoking `func` until after `wait`\n * milliseconds have elapsed since the last time the debounced function was\n * invoked. The debounced function comes with a `cancel` method to cancel\n * delayed `func` invocations and a `flush` method to immediately invoke them.\n * Provide `options` to indicate whether `func` should be invoked on the\n * leading and/or trailing edge of the `wait` timeout. The `func` is invoked\n * with the last arguments provided to the debounced function. Subsequent\n * calls to the debounced function return the result of the last `func`\n * invocation.\n *\n * **Note:** If `leading` and `trailing` options are `true`, `func` is\n * invoked on the trailing edge of the timeout only if the debounced function\n * is invoked more than once during the `wait` timeout.\n *\n * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred\n * until to the next tick, similar to `setTimeout` with a timeout of `0`.\n *\n * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)\n * for details over the differences between `_.debounce` and `_.throttle`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to debounce.\n * @param {number} [wait=0] The number of milliseconds to delay.\n * @param {Object} [options={}] The options object.\n * @param {boolean} [options.leading=false]\n * Specify invoking on the leading edge of the timeout.\n * @param {number} [options.maxWait]\n * The maximum time `func` is allowed to be delayed before it's invoked.\n * @param {boolean} [options.trailing=true]\n * Specify invoking on the trailing edge of the timeout.\n * @returns {Function} Returns the new debounced function.\n * @example\n *\n * // Avoid costly calculations while the window size is in flux.\n * jQuery(window).on('resize', _.debounce(calculateLayout, 150));\n *\n * // Invoke `sendMail` when clicked, debouncing subsequent calls.\n * jQuery(element).on('click', _.debounce(sendMail, 300, {\n * 'leading': true,\n * 'trailing': false\n * }));\n *\n * // Ensure `batchLog` is invoked once after 1 second of debounced calls.\n * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });\n * var source = new EventSource('/stream');\n * jQuery(source).on('message', debounced);\n *\n * // Cancel the trailing debounced invocation.\n * jQuery(window).on('popstate', debounced.cancel);\n */\nfunction debounce(func, wait, options) {\n var lastArgs,\n lastThis,\n maxWait,\n result,\n timerId,\n lastCallTime,\n lastInvokeTime = 0,\n leading = false,\n maxing = false,\n trailing = true;\n\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n wait = toNumber(wait) || 0;\n if (isObject(options)) {\n leading = !!options.leading;\n maxing = 'maxWait' in options;\n maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;\n trailing = 'trailing' in options ? !!options.trailing : trailing;\n }\n\n function invokeFunc(time) {\n var args = lastArgs,\n thisArg = lastThis;\n\n lastArgs = lastThis = undefined;\n lastInvokeTime = time;\n result = func.apply(thisArg, args);\n return result;\n }\n\n function leadingEdge(time) {\n // Reset any `maxWait` timer.\n lastInvokeTime = time;\n // Start the timer for the trailing edge.\n timerId = setTimeout(timerExpired, wait);\n // Invoke the leading edge.\n return leading ? invokeFunc(time) : result;\n }\n\n function remainingWait(time) {\n var timeSinceLastCall = time - lastCallTime,\n timeSinceLastInvoke = time - lastInvokeTime,\n result = wait - timeSinceLastCall;\n\n return maxing ? nativeMin(result, maxWait - timeSinceLastInvoke) : result;\n }\n\n function shouldInvoke(time) {\n var timeSinceLastCall = time - lastCallTime,\n timeSinceLastInvoke = time - lastInvokeTime;\n\n // Either this is the first call, activity has stopped and we're at the\n // trailing edge, the system time has gone backwards and we're treating\n // it as the trailing edge, or we've hit the `maxWait` limit.\n return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||\n (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));\n }\n\n function timerExpired() {\n var time = now();\n if (shouldInvoke(time)) {\n return trailingEdge(time);\n }\n // Restart the timer.\n timerId = setTimeout(timerExpired, remainingWait(time));\n }\n\n function trailingEdge(time) {\n timerId = undefined;\n\n // Only invoke if we have `lastArgs` which means `func` has been\n // debounced at least once.\n if (trailing && lastArgs) {\n return invokeFunc(time);\n }\n lastArgs = lastThis = undefined;\n return result;\n }\n\n function cancel() {\n if (timerId !== undefined) {\n clearTimeout(timerId);\n }\n lastInvokeTime = 0;\n lastArgs = lastCallTime = lastThis = timerId = undefined;\n }\n\n function flush() {\n return timerId === undefined ? result : trailingEdge(now());\n }\n\n function debounced() {\n var time = now(),\n isInvoking = shouldInvoke(time);\n\n lastArgs = arguments;\n lastThis = this;\n lastCallTime = time;\n\n if (isInvoking) {\n if (timerId === undefined) {\n return leadingEdge(lastCallTime);\n }\n if (maxing) {\n // Handle invocations in a tight loop.\n timerId = setTimeout(timerExpired, wait);\n return invokeFunc(lastCallTime);\n }\n }\n if (timerId === undefined) {\n timerId = setTimeout(timerExpired, wait);\n }\n return result;\n }\n debounced.cancel = cancel;\n debounced.flush = flush;\n return debounced;\n}\n\n/**\n * Creates a throttled function that only invokes `func` at most once per\n * every `wait` milliseconds. The throttled function comes with a `cancel`\n * method to cancel delayed `func` invocations and a `flush` method to\n * immediately invoke them. Provide `options` to indicate whether `func`\n * should be invoked on the leading and/or trailing edge of the `wait`\n * timeout. The `func` is invoked with the last arguments provided to the\n * throttled function. Subsequent calls to the throttled function return the\n * result of the last `func` invocation.\n *\n * **Note:** If `leading` and `trailing` options are `true`, `func` is\n * invoked on the trailing edge of the timeout only if the throttled function\n * is invoked more than once during the `wait` timeout.\n *\n * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred\n * until to the next tick, similar to `setTimeout` with a timeout of `0`.\n *\n * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)\n * for details over the differences between `_.throttle` and `_.debounce`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to throttle.\n * @param {number} [wait=0] The number of milliseconds to throttle invocations to.\n * @param {Object} [options={}] The options object.\n * @param {boolean} [options.leading=true]\n * Specify invoking on the leading edge of the timeout.\n * @param {boolean} [options.trailing=true]\n * Specify invoking on the trailing edge of the timeout.\n * @returns {Function} Returns the new throttled function.\n * @example\n *\n * // Avoid excessively updating the position while scrolling.\n * jQuery(window).on('scroll', _.throttle(updatePosition, 100));\n *\n * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.\n * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });\n * jQuery(element).on('click', throttled);\n *\n * // Cancel the trailing throttled invocation.\n * jQuery(window).on('popstate', throttled.cancel);\n */\nfunction throttle(func, wait, options) {\n var leading = true,\n trailing = true;\n\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n if (isObject(options)) {\n leading = 'leading' in options ? !!options.leading : leading;\n trailing = 'trailing' in options ? !!options.trailing : trailing;\n }\n return debounce(func, wait, {\n 'leading': leading,\n 'maxWait': wait,\n 'trailing': trailing\n });\n}\n\n/**\n * Checks if `value` is the\n * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)\n * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n var type = typeof value;\n return !!value && (type == 'object' || type == 'function');\n}\n\n/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n return !!value && typeof value == 'object';\n}\n\n/**\n * Checks if `value` is classified as a `Symbol` primitive or object.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.\n * @example\n *\n * _.isSymbol(Symbol.iterator);\n * // => true\n *\n * _.isSymbol('abc');\n * // => false\n */\nfunction isSymbol(value) {\n return typeof value == 'symbol' ||\n (isObjectLike(value) && objectToString.call(value) == symbolTag);\n}\n\n/**\n * Converts `value` to a number.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to process.\n * @returns {number} Returns the number.\n * @example\n *\n * _.toNumber(3.2);\n * // => 3.2\n *\n * _.toNumber(Number.MIN_VALUE);\n * // => 5e-324\n *\n * _.toNumber(Infinity);\n * // => Infinity\n *\n * _.toNumber('3.2');\n * // => 3.2\n */\nfunction toNumber(value) {\n if (typeof value == 'number') {\n return value;\n }\n if (isSymbol(value)) {\n return NAN;\n }\n if (isObject(value)) {\n var other = typeof value.valueOf == 'function' ? value.valueOf() : value;\n value = isObject(other) ? (other + '') : other;\n }\n if (typeof value != 'string') {\n return value === 0 ? value : +value;\n }\n value = value.replace(reTrim, '');\n var isBinary = reIsBinary.test(value);\n return (isBinary || reIsOctal.test(value))\n ? freeParseInt(value.slice(2), isBinary ? 2 : 8)\n : (reIsBadHex.test(value) ? NAN : +value);\n}\n\nmodule.exports = throttle;\n\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6)))\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/lodash.throttle/index.js\n// module id = 22\n// module chunks = 0\n\n//# sourceURL=webpack:///./node_modules/lodash.throttle/index.js?"); /***/ }), /* 23 */ @@ -255,7 +255,7 @@ eval("/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -eval("/* harmony export (immutable) */ __webpack_exports__[\"a\"] = Line;\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__ = __webpack_require__(0);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__helpers_constants__ = __webpack_require__(2);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__helpers_common__ = __webpack_require__(1);\nvar _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };\n\n\n\n\n\n\nfunction Line(_container) {\n\n var config = {\n chartId: null,\n chartType: null,\n colorSchema: [\"skyblue\"],\n xDomain: \"auto\",\n dotsToShow: \"none\",\n lineDotRadius: 4,\n lineFx: null,\n\n chartHeight: null,\n stackOffset: __WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"stackOffset\"].NONE\n };\n\n var scales = {\n colorScale: null,\n styleScale: null,\n chartTypeScale: null,\n xScale: null,\n yScale: null,\n y2Scale: null,\n yDomainSign: \"++\",\n y2DomainSign: \"++\"\n };\n\n var cache = {\n container: _container,\n svg: null\n };\n\n var data = {\n dataBySeries: null,\n groupKeys: null,\n stack: null,\n stackData: null\n };\n\n var getColor = function getColor(d) {\n return scales.colorScale(d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].ID]);\n };\n\n function build() {\n if (!cache.root) {\n cache.root = cache.container.append(\"g\").classed(\"mark-group\", true);\n }\n }\n\n function isDefined(d) {\n return typeof d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].VALUE] !== \"undefined\" && d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].VALUE] !== null;\n }\n\n function isInDomain(d) {\n return d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].KEY] >= config.xDomain[0] && d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].KEY] <= config.xDomain[1];\n }\n\n function drawLines() {\n if (!Array.isArray(config.chartType) && config.chartType !== \"line\") {\n cache.root.selectAll(\".mark.line\").remove();\n return null;\n }\n\n var seriesLine = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"line\"]().x(function (d) {\n return scales.xScale(d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].KEY]);\n }).y(function (d) {\n return scales.yScale(d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].VALUE]);\n }).defined(isDefined);\n\n var seriesLine2 = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"line\"]().x(function (d) {\n return scales.xScale(d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].KEY]);\n }).y(function (d) {\n return scales.y2Scale(d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].VALUE]);\n }).defined(isDefined);\n\n if (Array.isArray(config.xDomain)) {\n seriesLine.defined(function (d) {\n return isDefined(d) || isInDomain(d);\n });\n seriesLine2.defined(function (d) {\n return isDefined(d) || isInDomain(d);\n });\n }\n\n var lineData = data.dataBySeries;\n if (Array.isArray(config.chartType)) {\n lineData = lineData.filter(function (d, i) {\n return config.chartType[i] === \"line\";\n });\n }\n var lines = cache.root.selectAll(\".mark.line\").data(lineData);\n\n lines.enter().append(\"path\").attr(\"filter\", config.lineFx ? \"url(#\" + config.lineFx + \")\" : null).merge(lines).attr(\"class\", \"mark line\").attr(\"clip-path\", \"url(#mark-clip-\" + config.chartId + \")\").classed(\"y2-line\", function (d) {\n return d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].GROUP] > 0;\n }).attr(\"d\", function (d) {\n if (d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].GROUP] === 0) {\n return seriesLine(d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].VALUES]);\n } else {\n return seriesLine2(d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].VALUES]);\n }\n }).style(\"stroke\", getColor).style(\"fill\", \"none\").attr(\"stroke-dasharray\", function (d) {\n var style = scales.styleScale(d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].ID]);\n return __WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"dashStylesTranslation\"][style];\n });\n\n lines.exit().remove();\n }\n\n function filterNulls(_data) {\n return _data.map(function (d) {\n return _extends({}, d, {\n values: d.values.filter(function (dB) {\n return dB.value !== null;\n })\n });\n });\n }\n\n function filterIsolated(_data) {\n return _data.map(function (d) {\n return _extends({}, d, {\n values: d.values.filter(function (dB, iB, pD) {\n var prevIndex = Math.max(iB - 1, 0);\n var nextIndex = Math.min(iB + 1, pD.length - 1);\n return dB.value !== null && pD[prevIndex].value === null && pD[nextIndex].value === null;\n })\n });\n });\n }\n\n function drawDots() {\n if (!Array.isArray(config.chartType) && config.chartType !== \"line\") {\n cache.root.selectAll(\".dot-group\").remove();\n return null;\n }\n\n var dotData = data.dataBySeries;\n var dotDataFiltered = dotData;\n if (Array.isArray(config.chartType)) {\n dotDataFiltered = dotData.filter(function (d, i) {\n return config.chartType[i] === \"line\";\n });\n }\n\n if (config.dotsToShow === __WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"dotsToShow\"].ALL) {\n dotDataFiltered = filterNulls(dotDataFiltered);\n } else if (config.dotsToShow === __WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"dotsToShow\"].ISOLATED) {\n dotDataFiltered = filterIsolated(dotDataFiltered);\n } else if (config.dotsToShow === __WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"dotsToShow\"].NONE) {\n cache.root.selectAll(\".dot-group\").remove();\n return null;\n }\n\n var dotGroups = cache.root.selectAll(\".dot-group\").data(dotDataFiltered);\n\n var dotGroupsSelection = dotGroups.enter().append(\"g\").merge(dotGroups).attr(\"class\", \"dot-group\").attr(\"clip-path\", \"url(#mark-clip-\" + config.chartId + \")\");\n\n dotGroups.exit().remove();\n\n var dots = dotGroupsSelection.selectAll(\".mark.dot\").data(function (d) {\n return d.values.map(function (dB) {\n return {\n value: dB[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].VALUE],\n group: d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].ID],\n key: dB[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].KEY],\n id: d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].ID]\n };\n });\n });\n\n dots.enter().append(\"circle\").merge(dots).attr(\"class\", \"mark dot\").attr(\"cx\", function (d) {\n return scales.xScale(d.key);\n }).attr(\"cy\", function (d) {\n var leftAxisGroup = data.groupKeys[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"LEFT_AXIS_GROUP_INDEX\"]];\n if (leftAxisGroup && leftAxisGroup.indexOf(d.group) > -1) {\n return scales.yScale(d.value);\n } else {\n return scales.y2Scale ? scales.y2Scale(d.value) : scales.yScale(d.value);\n }\n }).attr(\"r\", config.lineDotRadius).style(\"fill\", getColor);\n\n dots.exit().remove();\n\n return this;\n }\n\n function drawAreas() {\n if (config.chartType !== \"area\") {\n cache.root.selectAll(\".mark.area\").remove();\n return null;\n }\n\n var seriesArea = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"area\"]().x(function (d) {\n return scales.xScale(d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].KEY]);\n }).y0(function () {\n return scales.yDomainSign === \"+-\" ? 0 : config.chartHeight;\n }).y1(function (d) {\n return scales.yScale(d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].VALUE]);\n }).defined(isDefined);\n\n var areas = cache.root.selectAll(\".mark.area\").data(data.dataBySeries);\n\n areas.enter().append(\"path\").merge(areas).attr(\"class\", \"mark area\").attr(\"clip-path\", \"url(#mark-clip-\" + config.chartId + \")\").classed(\"y2-area\", function (d) {\n return d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].GROUP] > 0;\n }).attr(\"d\", function (d) {\n return seriesArea(d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].VALUES]);\n }).style(\"stroke\", getColor).style(\"fill\", getColor);\n\n areas.exit().remove();\n }\n\n function drawStackedAreas() {\n if (config.chartType !== \"stackedArea\") {\n cache.root.selectAll(\".mark.stacked-area\").remove();\n return null;\n }\n\n var yScale = scales.yScale;\n if (config.stackOffset === __WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"stackOffset\"].PERCENT) {\n var denormalizingYScale = scales.yScale.copy().domain([0, 1]);\n yScale = denormalizingYScale;\n }\n\n var seriesLine = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"area\"]().x(function (d) {\n return scales.xScale(d.data.key);\n }).y0(function (d) {\n return yScale(d[0]);\n }).y1(function (d) {\n return yScale(d[1]);\n });\n\n var areas = cache.root.selectAll(\".mark.stacked-area\").data(data.stack(data.stackData));\n\n areas.enter().append(\"path\").merge(areas).attr(\"class\", \"mark stacked-area\").attr(\"clip-path\", \"url(#mark-clip-\" + config.chartId + \")\").attr(\"d\", seriesLine).style(\"stroke\", \"none\").style(\"fill\", function (d) {\n return scales.colorScale(d.key);\n });\n\n areas.exit().remove();\n }\n\n function setConfig(_config) {\n config = Object(__WEBPACK_IMPORTED_MODULE_2__helpers_common__[\"override\"])(config, _config);\n return this;\n }\n\n function setScales(_scales) {\n scales = Object(__WEBPACK_IMPORTED_MODULE_2__helpers_common__[\"override\"])(scales, _scales);\n return this;\n }\n\n function setData(_data) {\n data = Object.assign({}, data, _data);\n return this;\n }\n\n function render() {\n build();\n drawAreas();\n drawStackedAreas();\n drawLines();\n drawDots();\n }\n\n function destroy() {\n if (cache.root) {\n cache.root.remove();\n cache.root = null;\n }\n return this;\n }\n\n return {\n setConfig: setConfig,\n setScales: setScales,\n setData: setData,\n render: render,\n destroy: destroy\n };\n}\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/charts/line.js\n// module id = 26\n// module chunks = 0\n\n//# sourceURL=webpack:///./src/charts/line.js?"); +eval("/* harmony export (immutable) */ __webpack_exports__[\"a\"] = Line;\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__ = __webpack_require__(0);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__helpers_constants__ = __webpack_require__(2);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__helpers_common__ = __webpack_require__(1);\nvar _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };\n\n\n\n\n\n\nfunction Line(_container) {\n\n var config = {\n annotationPoints: [],\n chartId: null,\n chartType: null,\n colorSchema: [\"skyblue\"],\n xDomain: \"auto\",\n dotsToShow: \"none\",\n lineDotRadius: 4,\n lineFx: null,\n\n chartHeight: null,\n stackOffset: __WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"stackOffset\"].NONE\n };\n\n var scales = {\n colorScale: null,\n styleScale: null,\n chartTypeScale: null,\n xScale: null,\n yScale: null,\n y2Scale: null,\n yDomainSign: \"++\",\n y2DomainSign: \"++\"\n };\n\n var cache = {\n container: _container,\n svg: null\n };\n\n var data = {\n dataBySeries: null,\n groupKeys: null,\n stack: null,\n stackData: null\n };\n\n var getColor = function getColor(d) {\n return scales.colorScale(d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].ID]);\n };\n\n function build() {\n if (!cache.root) {\n cache.root = cache.container.append(\"g\").classed(\"mark-group\", true);\n }\n }\n\n function isDefined(d) {\n return typeof d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].VALUE] !== \"undefined\" && d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].VALUE] !== null;\n }\n\n function isInDomain(d) {\n return d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].KEY] >= config.xDomain[0] && d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].KEY] <= config.xDomain[1];\n }\n\n function drawLines() {\n if (!Array.isArray(config.chartType) && config.chartType !== \"line\") {\n cache.root.selectAll(\".mark.line\").remove();\n return null;\n }\n\n var seriesLine = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"line\"]().x(function (d) {\n return scales.xScale(d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].KEY]);\n }).y(function (d) {\n return scales.yScale(d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].VALUE]);\n }).defined(isDefined);\n\n var seriesLine2 = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"line\"]().x(function (d) {\n return scales.xScale(d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].KEY]);\n }).y(function (d) {\n return scales.y2Scale(d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].VALUE]);\n }).defined(isDefined);\n\n if (Array.isArray(config.xDomain)) {\n seriesLine.defined(function (d) {\n return isDefined(d) || isInDomain(d);\n });\n seriesLine2.defined(function (d) {\n return isDefined(d) || isInDomain(d);\n });\n }\n\n var lineData = data.dataBySeries;\n if (Array.isArray(config.chartType)) {\n lineData = lineData.filter(function (d, i) {\n return config.chartType[i] === \"line\";\n });\n }\n var lines = cache.root.selectAll(\".mark.line\").data(lineData);\n\n lines.enter().append(\"path\").attr(\"filter\", config.lineFx ? \"url(#\" + config.lineFx + \")\" : null).merge(lines).attr(\"class\", \"mark line\").attr(\"clip-path\", \"url(#mark-clip-\" + config.chartId + \")\").classed(\"y2-line\", function (d) {\n return d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].GROUP] > 0;\n }).attr(\"d\", function (d) {\n if (d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].GROUP] === 0) {\n return seriesLine(d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].VALUES]);\n } else {\n return seriesLine2(d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].VALUES]);\n }\n }).style(\"stroke\", getColor).style(\"fill\", \"none\").attr(\"stroke-dasharray\", function (d) {\n var style = scales.styleScale(d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].ID]);\n return __WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"dashStylesTranslation\"][style];\n });\n\n lines.exit().remove();\n }\n\n function filterNulls(_data) {\n return _data.map(function (d) {\n return _extends({}, d, {\n values: d.values.filter(function (dB) {\n return dB.value !== null;\n })\n });\n });\n }\n\n function filterIsolated(_data) {\n return _data.map(function (d) {\n return _extends({}, d, {\n values: d.values.filter(function (dB, iB, pD) {\n var prevIndex = Math.max(iB - 1, 0);\n var nextIndex = Math.min(iB + 1, pD.length - 1);\n return dB.value !== null && pD[prevIndex].value === null && pD[nextIndex].value === null;\n })\n });\n });\n }\n\n function drawDots() {\n if (!Array.isArray(config.chartType) && config.chartType !== \"line\") {\n cache.root.selectAll(\".dot-group\").remove();\n return null;\n }\n\n var dotData = data.dataBySeries;\n var dotDataFiltered = dotData;\n if (Array.isArray(config.chartType)) {\n dotDataFiltered = dotData.filter(function (d, i) {\n return config.chartType[i] === \"line\";\n });\n }\n\n if (config.dotsToShow === __WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"dotsToShow\"].ALL) {\n dotDataFiltered = filterNulls(dotDataFiltered);\n } else if (config.dotsToShow === __WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"dotsToShow\"].ISOLATED) {\n dotDataFiltered = filterIsolated(dotDataFiltered);\n } else if (config.dotsToShow === __WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"dotsToShow\"].NONE) {\n cache.root.selectAll(\".dot-group\").remove();\n return null;\n }\n\n var dotGroups = cache.root.selectAll(\".dot-group\").data(dotDataFiltered);\n\n var dotGroupsSelection = dotGroups.enter().append(\"g\").merge(dotGroups).attr(\"class\", \"dot-group\").attr(\"clip-path\", \"url(#mark-clip-\" + config.chartId + \")\");\n\n dotGroups.exit().remove();\n\n var dots = dotGroupsSelection.selectAll(\".mark.dot\").data(function (d) {\n return d.values.map(function (dB) {\n return {\n value: dB[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].VALUE],\n group: d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].ID],\n key: dB[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].KEY],\n id: d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].ID]\n };\n });\n });\n\n dots.enter().append(\"circle\").merge(dots).attr(\"class\", \"mark dot\").attr(\"cx\", function (d) {\n return scales.xScale(d.key);\n }).attr(\"cy\", function (d) {\n var leftAxisGroup = data.groupKeys[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"LEFT_AXIS_GROUP_INDEX\"]];\n if (leftAxisGroup && leftAxisGroup.indexOf(d.group) > -1) {\n return scales.yScale(d.value);\n } else {\n return scales.y2Scale ? scales.y2Scale(d.value) : scales.yScale(d.value);\n }\n }).attr(\"r\", config.lineDotRadius).style(\"fill\", getColor);\n\n dots.exit().remove();\n\n return this;\n }\n\n function drawAnnotationPoints() {\n var dotGroups = cache.root.selectAll(\".annotation-group\").data([config.annotationPoints]);\n\n var dotGroupsSelection = dotGroups.enter().append(\"g\").merge(dotGroups).attr(\"class\", \"annotation-group\").attr(\"clip-path\", \"url(#mark-clip-\" + config.chartId + \")\");\n\n dotGroups.exit().remove();\n\n var dots = dotGroupsSelection.selectAll(\".annotation\").data(function (d) {\n return d;\n });\n\n dots.enter().append(\"circle\").merge(dots).attr(\"class\", \"annotation\").attr(\"cx\", function (d) {\n return scales.xScale(d.x);\n }).attr(\"cy\", function (d) {\n console.log(d);\n var leftAxisGroup = data.groupKeys[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"LEFT_AXIS_GROUP_INDEX\"]];\n if (leftAxisGroup && leftAxisGroup.indexOf(d.group) > -1) {\n return scales.yScale(d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].VALUE]);\n } else {\n return scales.y2Scale ? scales.y2Scale(d.y) : scales.yScale(d.y);\n }\n }).attr(\"r\", \"10\").style(\"fill\", \"red\");\n\n dots.exit().remove();\n\n return this;\n }\n\n function drawAreas() {\n if (config.chartType !== \"area\") {\n cache.root.selectAll(\".mark.area\").remove();\n return null;\n }\n\n var seriesArea = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"area\"]().x(function (d) {\n return scales.xScale(d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].KEY]);\n }).y0(function () {\n return scales.yDomainSign === \"+-\" ? 0 : config.chartHeight;\n }).y1(function (d) {\n return scales.yScale(d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].VALUE]);\n }).defined(isDefined);\n\n var areas = cache.root.selectAll(\".mark.area\").data(data.dataBySeries);\n\n areas.enter().append(\"path\").merge(areas).attr(\"class\", \"mark area\").attr(\"clip-path\", \"url(#mark-clip-\" + config.chartId + \")\").classed(\"y2-area\", function (d) {\n return d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].GROUP] > 0;\n }).attr(\"d\", function (d) {\n return seriesArea(d[__WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"keys\"].VALUES]);\n }).style(\"stroke\", getColor).style(\"fill\", getColor);\n\n areas.exit().remove();\n }\n\n function drawStackedAreas() {\n if (config.chartType !== \"stackedArea\") {\n cache.root.selectAll(\".mark.stacked-area\").remove();\n return null;\n }\n\n var yScale = scales.yScale;\n if (config.stackOffset === __WEBPACK_IMPORTED_MODULE_1__helpers_constants__[\"stackOffset\"].PERCENT) {\n var denormalizingYScale = scales.yScale.copy().domain([0, 1]);\n yScale = denormalizingYScale;\n }\n\n var seriesLine = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"area\"]().x(function (d) {\n return scales.xScale(d.data.key);\n }).y0(function (d) {\n return yScale(d[0]);\n }).y1(function (d) {\n return yScale(d[1]);\n });\n\n var areas = cache.root.selectAll(\".mark.stacked-area\").data(data.stack(data.stackData));\n\n areas.enter().append(\"path\").merge(areas).attr(\"class\", \"mark stacked-area\").attr(\"clip-path\", \"url(#mark-clip-\" + config.chartId + \")\").attr(\"d\", seriesLine).style(\"stroke\", \"none\").style(\"fill\", function (d) {\n return scales.colorScale(d.key);\n });\n\n areas.exit().remove();\n }\n\n function setConfig(_config) {\n config = Object(__WEBPACK_IMPORTED_MODULE_2__helpers_common__[\"override\"])(config, _config);\n return this;\n }\n\n function setScales(_scales) {\n scales = Object(__WEBPACK_IMPORTED_MODULE_2__helpers_common__[\"override\"])(scales, _scales);\n return this;\n }\n\n function setData(_data) {\n data = Object.assign({}, data, _data);\n return this;\n }\n\n function render() {\n build();\n drawAreas();\n drawStackedAreas();\n drawLines();\n drawDots();\n drawAnnotationPoints();\n }\n\n function destroy() {\n if (cache.root) {\n cache.root.remove();\n cache.root = null;\n }\n return this;\n }\n\n return {\n setConfig: setConfig,\n setScales: setScales,\n setData: setData,\n render: render,\n destroy: destroy\n };\n}\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/charts/line.js\n// module id = 26\n// module chunks = 0\n\n//# sourceURL=webpack:///./src/charts/line.js?"); /***/ }), /* 27 */ @@ -269,7 +269,7 @@ eval("/* harmony export (immutable) */ __webpack_exports__[\"a\"] = Bar;\n/* har /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -eval("/* harmony export (immutable) */ __webpack_exports__[\"a\"] = Axis;\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__ = __webpack_require__(0);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__helpers_common__ = __webpack_require__(1);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__helpers_formatters__ = __webpack_require__(10);\n\n\n\n\nfunction Axis(_container) {\n\n var config = {\n margin: {\n top: 60,\n right: 30,\n bottom: 40,\n left: 70\n },\n width: 800,\n height: 500,\n tickSizes: null,\n tickPadding: null,\n xAxisFormat: null,\n yAxisFormat: null,\n yAxisPercentageFormat: null,\n y2AxisFormat: null,\n keyType: null,\n yTicks: null,\n y2Ticks: null,\n xTickSkip: null,\n axisTransitionDuration: null,\n ease: null,\n grid: null,\n hoverZoneSize: 30,\n tickSpacing: 40,\n numberFormat: \".2f\",\n extractType: null,\n yDomain: \"auto\",\n y2Domain: \"auto\",\n labelsAreRotated: false,\n maxXLabelCharCount: null,\n maxYLabelCharCount: null,\n\n chartWidth: null,\n chartHeight: null,\n markPanelWidth: null\n };\n\n var scales = {\n xScale: null,\n yScale: null,\n y2Scale: null,\n hasSecondAxis: null,\n measureNameLookup: null\n };\n\n var cache = {\n container: _container,\n root: null,\n xAxisRoot: null,\n yAxisRoot: null,\n y2AxisRoot: null,\n background: null,\n xAxis: null,\n yAxis: null,\n y2Axis: null,\n horizontalGridLines: null,\n verticalGridLines: null,\n xLabelsShouldRotate: false\n };\n\n var APPROX_FONT_WIDTH = 5;\n var LABEL_SPACING = 2;\n\n var X_TICK_LABEL_SETTINGS = {\n DEFAULT_XPOS: 0,\n DEFAULT_YPOS: 11,\n DEFAULT_DY: \".71em\",\n DEFAULT_TRANSFORM: null,\n DEFAULT_ANCHOR: \"middle\",\n ROTATED_XPOS: -9,\n ROTATED_YPOS: 0,\n ROTATED_DY: \".35em\",\n ROTATED_TRANSFORM: \"rotate(-90)\",\n ROTATED_ANCHOR: \"end\"\n };\n\n function build() {\n if (!cache.root) {\n cache.root = cache.container.select(\"svg.chart > g.chart-group\");\n cache.xAxisRoot = cache.root.append(\"g\").classed(\"axis-group\", true).style(\"pointer-events\", \"none\");\n cache.xAxisRoot.append(\"g\").attr(\"class\", \"grid-lines-group\");\n cache.xAxisRoot.append(\"g\").attr(\"class\", \"axis x\");\n cache.yAxisRoot = cache.container.select(\".y-axis-container > svg\");\n cache.y2AxisRoot = cache.container.select(\".y2-axis-container > svg\");\n cache.yAxisRoot.select(\".axis-group\").append(\"g\").attr(\"class\", \"axis y\");\n cache.y2AxisRoot.select(\".axis-group\").append(\"g\").attr(\"class\", \"axis y2\");\n }\n\n cache.xLabelsShouldRotate = shouldXLabelsRotate();\n\n var DOMAIN_LINE_WIDTH = 1;\n cache.yAxisRoot.attr(\"width\", config.margin.left).attr(\"height\", config.chartHeight + config.margin.top + config.margin.bottom).select(\".axis-group\").attr(\"transform\", \"translate(\" + (config.margin.left - DOMAIN_LINE_WIDTH) + \", \" + config.margin.top + \")\");\n\n cache.y2AxisRoot.attr(\"width\", config.margin.left).attr(\"height\", config.chartHeight + config.margin.top + config.margin.bottom).select(\".axis-group\").attr(\"transform\", \"translate(0, \" + config.margin.top + \")\");\n }\n\n function formatXAxis() {\n if (typeof config.xAxisFormat === \"function\") {\n var dimensionName = scales.measureNameLookup(\"x\");\n var hasFormatterForDimension = config.xAxisFormat(null, dimensionName);\n if (hasFormatterForDimension) {\n cache.xAxis.tickFormat(function (d) {\n return config.xAxisFormat(d, dimensionName);\n });\n }\n } else if (config.keyType === \"time\") {\n if (config.xAxisFormat && config.xAxisFormat !== \"auto\") {\n var formatter = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"utcFormat\"](config.xAxisFormat);\n cache.xAxis.tickFormat(formatter);\n } else {\n cache.xAxis.tickFormat(__WEBPACK_IMPORTED_MODULE_2__helpers_formatters__[\"g\" /* multiFormat */]);\n }\n } else if (config.keyType === \"string\") {\n var xTickSkip = config.xTickSkip;\n if (config.xTickSkip === \"auto\") {\n xTickSkip = getNumberOfLabelsToSkip(scales.xScale.domain());\n }\n cache.xAxis.tickValues(scales.xScale.domain().filter(function (d, i) {\n return !(i % xTickSkip);\n }));\n } else if (config.keyType === \"number\") {\n if (config.extractType) {\n var _formatter = Object(__WEBPACK_IMPORTED_MODULE_2__helpers_formatters__[\"f\" /* getExtractFormatter */])(config.extractType);\n cache.xAxis.tickFormat(_formatter);\n } else if (config.xAxisFormat && config.xAxisFormat !== \"auto\") {\n var _formatter2 = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"format\"](config.xAxisFormat);\n cache.xAxis.tickFormat(_formatter2);\n }\n }\n }\n\n function getYAutoFormat() {\n var yExtent = config.yDomain === \"auto\" ? scales.yScale.domain() : config.yDomain;\n return Object(__WEBPACK_IMPORTED_MODULE_2__helpers_formatters__[\"a\" /* autoFormat */])(yExtent);\n }\n\n function formatYAxis(axis) {\n if (!scales.yScale) {\n return;\n }\n if (config.yAxisPercentageFormat) {\n axis.tickFormat(Object(__WEBPACK_IMPORTED_MODULE_2__helpers_formatters__[\"d\" /* formatPercentage */])(config.yAxisPercentageFormat));\n } else if (typeof config.yAxisFormat === \"function\") {\n var measureName = scales.measureNameLookup(\"y\");\n var hasFormatterForMeasure = config.yAxisFormat(null, measureName);\n if (hasFormatterForMeasure) {\n axis.tickFormat(function (d) {\n return config.yAxisFormat(d, measureName);\n });\n } else {\n axis.tickFormat(getYAutoFormat());\n }\n } else if (config.yAxisFormat === \"auto\") {\n axis.tickFormat(getYAutoFormat());\n } else if (typeof config.yAxisFormat === \"string\") {\n axis.tickFormat(__WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"format\"](config.yAxisFormat));\n } else if (Array.isArray(config.yAxisFormat)) {\n axis.tickFormat(__WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"format\"](config.yAxisFormat[0]));\n }\n }\n\n function getY2AutoFormat() {\n var y2Extent = config.y2Domain === \"auto\" ? scales.y2Scale.domain() : config.y2Domain;\n return Object(__WEBPACK_IMPORTED_MODULE_2__helpers_formatters__[\"a\" /* autoFormat */])(y2Extent);\n }\n\n function formatY2Axis(axis) {\n if (!scales.y2Scale) {\n return;\n }\n if (typeof config.y2AxisFormat === \"function\") {\n var measureName = scales.measureNameLookup(\"y2\");\n if (measureName) {\n var hasFormatterForMeasure = config.y2AxisFormat(null, measureName);\n if (hasFormatterForMeasure) {\n axis.tickFormat(function (d) {\n return config.y2AxisFormat(d, measureName);\n });\n } else {\n axis.tickFormat(getY2AutoFormat());\n }\n } else {\n axis.tickFormat(function (d) {\n return config.y2AxisFormat(d);\n });\n }\n } else if (config.y2AxisFormat === \"auto\") {\n axis.tickFormat(getY2AutoFormat());\n } else if (typeof config.y2AxisFormat === \"string\") {\n axis.tickFormat(__WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"format\"](config.y2AxisFormat));\n } else if (Array.isArray(config.y2AxisFormat)) {\n axis.tickFormat(__WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"format\"](config.y2AxisFormat[0]));\n }\n }\n\n function truncateTickText(axisSelection, maxCharCount) {\n if (!maxCharCount) {\n return;\n }\n axisSelection.selectAll(\".tick text\").each(function tick() {\n var text = this.textContent;\n if (text.length > maxCharCount) {\n this.textContent = text.slice(0, maxCharCount) + \"\\u2026\";\n }\n });\n }\n\n function buildAxis() {\n cache.xAxis = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"axisBottom\"](scales.xScale).tickSize(config.tickSizes, 0).tickPadding(config.tickPadding).tickSizeOuter(0);\n\n if (config.keyType !== \"string\") {\n var ticks = scales.xScale.ticks();\n var preferredTickCount = ticks.length / config.chartWidth * config.markPanelWidth;\n cache.xAxis.ticks(preferredTickCount);\n }\n\n formatXAxis();\n\n if (scales.yScale) {\n cache.yAxis = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"axisLeft\"](scales.yScale).tickSize([config.tickSizes]).tickPadding(config.tickPadding).tickSizeOuter(0);\n\n formatYAxis(cache.yAxis);\n\n if (Number.isInteger(config.yTicks)) {\n cache.yAxis.ticks(config.yTicks);\n } else {\n cache.yAxis.ticks(Math.ceil(config.chartHeight / config.tickSpacing));\n }\n }\n\n if (scales.hasSecondAxis) {\n cache.y2Axis = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"axisRight\"](scales.y2Scale).tickSize([config.tickSizes]).tickPadding(config.tickPadding).tickSizeOuter(0);\n\n formatY2Axis(cache.y2Axis);\n\n if (!isNaN(config.y2Ticks)) {\n cache.y2Axis.ticks(config.y2Ticks);\n }\n }\n }\n\n function shouldXLabelsRotate() {\n if (config.labelsAreRotated === \"auto\") {\n var width = config.markPanelWidth;\n var labels = scales.xScale.domain();\n var totalLabelsWidth = labels.reduce(function (total, d) {\n return total + d.length * APPROX_FONT_WIDTH + LABEL_SPACING * APPROX_FONT_WIDTH;\n }, 0);\n\n if (totalLabelsWidth >= width) {\n return true;\n }\n return false;\n } else {\n return config.labelsAreRotated;\n }\n }\n\n function rotateXLabels() {\n cache.xAxisRoot.select(\".axis.x\").selectAll(\"text\").attr(\"y\", X_TICK_LABEL_SETTINGS.ROTATED_YPOS).attr(\"x\", X_TICK_LABEL_SETTINGS.ROTATED_XPOS).attr(\"dy\", X_TICK_LABEL_SETTINGS.ROTATED_DY).attr(\"transform\", X_TICK_LABEL_SETTINGS.ROTATED_TRANSFORM).style(\"text-anchor\", X_TICK_LABEL_SETTINGS.ROTATED_ANCHOR);\n\n return this;\n }\n\n function unRotateXLabels() {\n cache.xAxisRoot.select(\".axis.x\").selectAll(\"text\").attr(\"x\", X_TICK_LABEL_SETTINGS.DEFAULT_XPOS).attr(\"y\", X_TICK_LABEL_SETTINGS.DEFAULT_YPOS).attr(\"dy\", X_TICK_LABEL_SETTINGS.DEFAULT_DY).attr(\"transform\", X_TICK_LABEL_SETTINGS.DEFAULT_TRANSFORM).style(\"text-anchor\", X_TICK_LABEL_SETTINGS.DEFAULT_ANCHOR);\n }\n\n function getNumberOfLabelsToSkip(labels) {\n var longestLabelApproxWidth = null;\n if (cache.xLabelsShouldRotate) {\n longestLabelApproxWidth = APPROX_FONT_WIDTH;\n } else {\n var longestLabel = labels.reduce(function (longest, d) {\n return d.length > longest.length ? d : longest;\n }, { length: 0 });\n longestLabelApproxWidth = longestLabel.length * APPROX_FONT_WIDTH;\n }\n return Math.ceil(longestLabelApproxWidth / (config.markPanelWidth / labels.length));\n }\n\n function skipXLabels() {\n if (!config.xTickSkip) {\n return;\n }\n var labels = cache.xAxisRoot.select(\".axis.x\").selectAll(\".tick text\");\n\n var xTickSkip = config.xTickSkip;\n if (config.xTickSkip === \"auto\") {\n var labelsText = labels.nodes().map(function (node) {\n return node.textContent;\n });\n xTickSkip = getNumberOfLabelsToSkip(labelsText);\n }\n labels.style(\"display\", function (d, i) {\n return i % xTickSkip ? \"none\" : \"block\";\n });\n }\n\n function drawAxis() {\n cache.xAxisRoot.select(\".axis.x\").attr(\"transform\", \"translate(0, \" + config.chartHeight + \")\").call(cache.xAxis);\n\n skipXLabels();\n\n if (cache.xLabelsShouldRotate) {\n rotateXLabels();\n } else {\n unRotateXLabels();\n }\n\n truncateTickText(cache.xAxisRoot, config.maxXLabelCharCount);\n\n if (scales.yScale) {\n cache.yAxisRoot.select(\".axis.y\").transition().duration(config.axisTransitionDuration).ease(config.ease).call(cache.yAxis).on(\"end\", function () {\n truncateTickText(cache.yAxisRoot, config.maxYLabelCharCount);\n });\n } else {\n cache.yAxisRoot.select(\".axis.y\").selectAll(\"*\").remove();\n }\n\n if (scales.y2Scale) {\n cache.y2AxisRoot.select(\".axis.y2\").transition().duration(config.axisTransitionDuration).ease(config.ease).call(cache.y2Axis).on(\"end\", function () {\n truncateTickText(cache.y2AxisRoot, config.maxYLabelCharCount);\n });\n } else {\n cache.y2AxisRoot.select(\".axis.y2\").selectAll(\"*\").remove();\n }\n\n return this;\n }\n\n function drawGridLines() {\n if (config.grid === \"horizontal\" || config.grid === \"full\") {\n var ticks = null;\n if (Number.isInteger(config.yTicks)) {\n ticks = config.yTicks;\n } else {\n ticks = Math.ceil(config.chartHeight / config.tickSpacing);\n }\n\n if (scales.yScale) {\n cache.horizontalGridLines = cache.xAxisRoot.select(\".grid-lines-group\").selectAll(\"line.horizontal-grid-line\").data(scales.yScale.ticks(ticks));\n\n cache.horizontalGridLines.enter().append(\"line\").attr(\"class\", \"horizontal-grid-line\").merge(cache.horizontalGridLines).transition().duration(config.axisTransitionDuration).attr(\"x2\", config.markPanelWidth).attr(\"y1\", scales.yScale).attr(\"y2\", scales.yScale);\n\n cache.horizontalGridLines.exit().remove();\n } else if (cache.horizontalGridLines) {\n cache.horizontalGridLines.selectAll(\"*\").remove();\n }\n }\n\n if (config.grid === \"vertical\" || config.grid === \"full\") {\n var _ticks = config.keyType === \"string\" ? scales.xScale.domain() : scales.xScale.ticks();\n cache.verticalGridLines = cache.xAxisRoot.select(\".grid-lines-group\").selectAll(\"line.vertical-grid-line\").data(_ticks);\n\n cache.verticalGridLines.enter().append(\"line\").attr(\"class\", \"vertical-grid-line\").merge(cache.verticalGridLines).transition().duration(config.axisTransitionDuration).attr(\"y1\", 0).attr(\"y2\", config.chartHeight).attr(\"x1\", scales.xScale).attr(\"x2\", scales.xScale);\n\n cache.verticalGridLines.exit().remove();\n }\n\n return this;\n }\n\n function setConfig(_config) {\n config = Object(__WEBPACK_IMPORTED_MODULE_1__helpers_common__[\"override\"])(config, _config);\n return this;\n }\n\n function setScales(_scales) {\n scales = Object(__WEBPACK_IMPORTED_MODULE_1__helpers_common__[\"override\"])(scales, _scales);\n return this;\n }\n\n function render() {\n build();\n buildAxis();\n drawAxis();\n drawGridLines();\n }\n\n function destroy() {\n if (cache.xAxisRoot) {\n cache.xAxisRoot.remove();\n cache.xAxisRoot = null;\n }\n if (cache.yAxisRoot) {\n cache.yAxisRoot.remove();\n cache.yAxisRoot = null;\n }\n if (cache.y2AxisRoot) {\n cache.y2AxisRoot.remove();\n cache.y2AxisRoot = null;\n }\n }\n\n return {\n setConfig: setConfig,\n setScales: setScales,\n render: render,\n destroy: destroy\n };\n}\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/charts/axis.js\n// module id = 28\n// module chunks = 0\n\n//# sourceURL=webpack:///./src/charts/axis.js?"); +eval("/* harmony export (immutable) */ __webpack_exports__[\"a\"] = Axis;\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__ = __webpack_require__(0);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__helpers_common__ = __webpack_require__(1);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__helpers_formatters__ = __webpack_require__(9);\n\n\n\n\nfunction Axis(_container) {\n\n var config = {\n margin: {\n top: 60,\n right: 30,\n bottom: 40,\n left: 70\n },\n width: 800,\n height: 500,\n tickSizes: null,\n tickPadding: null,\n xAxisFormat: null,\n yAxisFormat: null,\n yAxisPercentageFormat: null,\n y2AxisFormat: null,\n keyType: null,\n yTicks: null,\n y2Ticks: null,\n xTickSkip: null,\n axisTransitionDuration: null,\n ease: null,\n grid: null,\n hoverZoneSize: 30,\n tickSpacing: 40,\n numberFormat: \".2f\",\n extractType: null,\n yDomain: \"auto\",\n y2Domain: \"auto\",\n labelsAreRotated: false,\n maxXLabelCharCount: null,\n maxYLabelCharCount: null,\n\n chartWidth: null,\n chartHeight: null,\n markPanelWidth: null\n };\n\n var scales = {\n xScale: null,\n yScale: null,\n y2Scale: null,\n hasSecondAxis: null,\n measureNameLookup: null\n };\n\n var cache = {\n container: _container,\n root: null,\n xAxisRoot: null,\n yAxisRoot: null,\n y2AxisRoot: null,\n background: null,\n xAxis: null,\n yAxis: null,\n y2Axis: null,\n horizontalGridLines: null,\n verticalGridLines: null,\n xLabelsShouldRotate: false\n };\n\n var APPROX_FONT_WIDTH = 5;\n var LABEL_SPACING = 2;\n\n var X_TICK_LABEL_SETTINGS = {\n DEFAULT_XPOS: 0,\n DEFAULT_YPOS: 11,\n DEFAULT_DY: \".71em\",\n DEFAULT_TRANSFORM: null,\n DEFAULT_ANCHOR: \"middle\",\n ROTATED_XPOS: -9,\n ROTATED_YPOS: 0,\n ROTATED_DY: \".35em\",\n ROTATED_TRANSFORM: \"rotate(-90)\",\n ROTATED_ANCHOR: \"end\"\n };\n\n function build() {\n if (!cache.root) {\n cache.root = cache.container.select(\"svg.chart > g.chart-group\");\n cache.xAxisRoot = cache.root.append(\"g\").classed(\"axis-group\", true).style(\"pointer-events\", \"none\");\n cache.xAxisRoot.append(\"g\").attr(\"class\", \"grid-lines-group\");\n cache.xAxisRoot.append(\"g\").attr(\"class\", \"axis x\");\n cache.yAxisRoot = cache.container.select(\".y-axis-container > svg\");\n cache.y2AxisRoot = cache.container.select(\".y2-axis-container > svg\");\n cache.yAxisRoot.select(\".axis-group\").append(\"g\").attr(\"class\", \"axis y\");\n cache.y2AxisRoot.select(\".axis-group\").append(\"g\").attr(\"class\", \"axis y2\");\n }\n\n cache.xLabelsShouldRotate = shouldXLabelsRotate();\n\n var DOMAIN_LINE_WIDTH = 1;\n cache.yAxisRoot.attr(\"width\", config.margin.left).attr(\"height\", config.chartHeight + config.margin.top + config.margin.bottom).select(\".axis-group\").attr(\"transform\", \"translate(\" + (config.margin.left - DOMAIN_LINE_WIDTH) + \", \" + config.margin.top + \")\");\n\n cache.y2AxisRoot.attr(\"width\", config.margin.left).attr(\"height\", config.chartHeight + config.margin.top + config.margin.bottom).select(\".axis-group\").attr(\"transform\", \"translate(0, \" + config.margin.top + \")\");\n }\n\n function formatXAxis() {\n if (typeof config.xAxisFormat === \"function\") {\n var dimensionName = scales.measureNameLookup(\"x\");\n var hasFormatterForDimension = config.xAxisFormat(null, dimensionName);\n if (hasFormatterForDimension) {\n cache.xAxis.tickFormat(function (d) {\n return config.xAxisFormat(d, dimensionName);\n });\n }\n } else if (config.keyType === \"time\") {\n if (config.xAxisFormat && config.xAxisFormat !== \"auto\") {\n var formatter = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"utcFormat\"](config.xAxisFormat);\n cache.xAxis.tickFormat(formatter);\n } else {\n cache.xAxis.tickFormat(__WEBPACK_IMPORTED_MODULE_2__helpers_formatters__[\"g\" /* multiFormat */]);\n }\n } else if (config.keyType === \"string\") {\n var xTickSkip = config.xTickSkip;\n if (config.xTickSkip === \"auto\") {\n xTickSkip = getNumberOfLabelsToSkip(scales.xScale.domain());\n }\n cache.xAxis.tickValues(scales.xScale.domain().filter(function (d, i) {\n return !(i % xTickSkip);\n }));\n } else if (config.keyType === \"number\") {\n if (config.extractType) {\n var _formatter = Object(__WEBPACK_IMPORTED_MODULE_2__helpers_formatters__[\"f\" /* getExtractFormatter */])(config.extractType);\n cache.xAxis.tickFormat(_formatter);\n } else if (config.xAxisFormat && config.xAxisFormat !== \"auto\") {\n var _formatter2 = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"format\"](config.xAxisFormat);\n cache.xAxis.tickFormat(_formatter2);\n }\n }\n }\n\n function getYAutoFormat() {\n var yExtent = config.yDomain === \"auto\" ? scales.yScale.domain() : config.yDomain;\n return Object(__WEBPACK_IMPORTED_MODULE_2__helpers_formatters__[\"a\" /* autoFormat */])(yExtent);\n }\n\n function formatYAxis(axis) {\n if (!scales.yScale) {\n return;\n }\n if (config.yAxisPercentageFormat) {\n axis.tickFormat(Object(__WEBPACK_IMPORTED_MODULE_2__helpers_formatters__[\"d\" /* formatPercentage */])(config.yAxisPercentageFormat));\n } else if (typeof config.yAxisFormat === \"function\") {\n var measureName = scales.measureNameLookup(\"y\");\n var hasFormatterForMeasure = config.yAxisFormat(null, measureName);\n if (hasFormatterForMeasure) {\n axis.tickFormat(function (d) {\n return config.yAxisFormat(d, measureName);\n });\n } else {\n axis.tickFormat(getYAutoFormat());\n }\n } else if (config.yAxisFormat === \"auto\") {\n axis.tickFormat(getYAutoFormat());\n } else if (typeof config.yAxisFormat === \"string\") {\n axis.tickFormat(__WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"format\"](config.yAxisFormat));\n } else if (Array.isArray(config.yAxisFormat)) {\n axis.tickFormat(__WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"format\"](config.yAxisFormat[0]));\n }\n }\n\n function getY2AutoFormat() {\n var y2Extent = config.y2Domain === \"auto\" ? scales.y2Scale.domain() : config.y2Domain;\n return Object(__WEBPACK_IMPORTED_MODULE_2__helpers_formatters__[\"a\" /* autoFormat */])(y2Extent);\n }\n\n function formatY2Axis(axis) {\n if (!scales.y2Scale) {\n return;\n }\n if (typeof config.y2AxisFormat === \"function\") {\n var measureName = scales.measureNameLookup(\"y2\");\n if (measureName) {\n var hasFormatterForMeasure = config.y2AxisFormat(null, measureName);\n if (hasFormatterForMeasure) {\n axis.tickFormat(function (d) {\n return config.y2AxisFormat(d, measureName);\n });\n } else {\n axis.tickFormat(getY2AutoFormat());\n }\n } else {\n axis.tickFormat(function (d) {\n return config.y2AxisFormat(d);\n });\n }\n } else if (config.y2AxisFormat === \"auto\") {\n axis.tickFormat(getY2AutoFormat());\n } else if (typeof config.y2AxisFormat === \"string\") {\n axis.tickFormat(__WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"format\"](config.y2AxisFormat));\n } else if (Array.isArray(config.y2AxisFormat)) {\n axis.tickFormat(__WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"format\"](config.y2AxisFormat[0]));\n }\n }\n\n function truncateTickText(axisSelection, maxCharCount) {\n if (!maxCharCount) {\n return;\n }\n axisSelection.selectAll(\".tick text\").each(function tick() {\n var text = this.textContent;\n if (text.length > maxCharCount) {\n this.textContent = text.slice(0, maxCharCount) + \"\\u2026\";\n }\n });\n }\n\n function buildAxis() {\n cache.xAxis = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"axisBottom\"](scales.xScale).tickSize(config.tickSizes, 0).tickPadding(config.tickPadding).tickSizeOuter(0);\n\n if (config.keyType !== \"string\") {\n var ticks = scales.xScale.ticks();\n var preferredTickCount = ticks.length / config.chartWidth * config.markPanelWidth;\n cache.xAxis.ticks(preferredTickCount);\n }\n\n formatXAxis();\n\n if (scales.yScale) {\n cache.yAxis = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"axisLeft\"](scales.yScale).tickSize([config.tickSizes]).tickPadding(config.tickPadding).tickSizeOuter(0);\n\n formatYAxis(cache.yAxis);\n\n if (Number.isInteger(config.yTicks)) {\n cache.yAxis.ticks(config.yTicks);\n } else {\n cache.yAxis.ticks(Math.ceil(config.chartHeight / config.tickSpacing));\n }\n }\n\n if (scales.hasSecondAxis) {\n cache.y2Axis = __WEBPACK_IMPORTED_MODULE_0__helpers_d3_service__[\"axisRight\"](scales.y2Scale).tickSize([config.tickSizes]).tickPadding(config.tickPadding).tickSizeOuter(0);\n\n formatY2Axis(cache.y2Axis);\n\n if (!isNaN(config.y2Ticks)) {\n cache.y2Axis.ticks(config.y2Ticks);\n }\n }\n }\n\n function shouldXLabelsRotate() {\n if (config.labelsAreRotated === \"auto\") {\n var width = config.markPanelWidth;\n var labels = scales.xScale.domain();\n var totalLabelsWidth = labels.reduce(function (total, d) {\n return total + d.length * APPROX_FONT_WIDTH + LABEL_SPACING * APPROX_FONT_WIDTH;\n }, 0);\n\n if (totalLabelsWidth >= width) {\n return true;\n }\n return false;\n } else {\n return config.labelsAreRotated;\n }\n }\n\n function rotateXLabels() {\n cache.xAxisRoot.select(\".axis.x\").selectAll(\"text\").attr(\"y\", X_TICK_LABEL_SETTINGS.ROTATED_YPOS).attr(\"x\", X_TICK_LABEL_SETTINGS.ROTATED_XPOS).attr(\"dy\", X_TICK_LABEL_SETTINGS.ROTATED_DY).attr(\"transform\", X_TICK_LABEL_SETTINGS.ROTATED_TRANSFORM).style(\"text-anchor\", X_TICK_LABEL_SETTINGS.ROTATED_ANCHOR);\n\n return this;\n }\n\n function unRotateXLabels() {\n cache.xAxisRoot.select(\".axis.x\").selectAll(\"text\").attr(\"x\", X_TICK_LABEL_SETTINGS.DEFAULT_XPOS).attr(\"y\", X_TICK_LABEL_SETTINGS.DEFAULT_YPOS).attr(\"dy\", X_TICK_LABEL_SETTINGS.DEFAULT_DY).attr(\"transform\", X_TICK_LABEL_SETTINGS.DEFAULT_TRANSFORM).style(\"text-anchor\", X_TICK_LABEL_SETTINGS.DEFAULT_ANCHOR);\n }\n\n function getNumberOfLabelsToSkip(labels) {\n var longestLabelApproxWidth = null;\n if (cache.xLabelsShouldRotate) {\n longestLabelApproxWidth = APPROX_FONT_WIDTH;\n } else {\n var longestLabel = labels.reduce(function (longest, d) {\n return d.length > longest.length ? d : longest;\n }, { length: 0 });\n longestLabelApproxWidth = longestLabel.length * APPROX_FONT_WIDTH;\n }\n return Math.ceil(longestLabelApproxWidth / (config.markPanelWidth / labels.length));\n }\n\n function skipXLabels() {\n if (!config.xTickSkip) {\n return;\n }\n var labels = cache.xAxisRoot.select(\".axis.x\").selectAll(\".tick text\");\n\n var xTickSkip = config.xTickSkip;\n if (config.xTickSkip === \"auto\") {\n var labelsText = labels.nodes().map(function (node) {\n return node.textContent;\n });\n xTickSkip = getNumberOfLabelsToSkip(labelsText);\n }\n labels.style(\"display\", function (d, i) {\n return i % xTickSkip ? \"none\" : \"block\";\n });\n }\n\n function drawAxis() {\n cache.xAxisRoot.select(\".axis.x\").attr(\"transform\", \"translate(0, \" + config.chartHeight + \")\").call(cache.xAxis);\n\n skipXLabels();\n\n if (cache.xLabelsShouldRotate) {\n rotateXLabels();\n } else {\n unRotateXLabels();\n }\n\n truncateTickText(cache.xAxisRoot, config.maxXLabelCharCount);\n\n if (scales.yScale) {\n cache.yAxisRoot.select(\".axis.y\").transition().duration(config.axisTransitionDuration).ease(config.ease).call(cache.yAxis).on(\"end\", function () {\n truncateTickText(cache.yAxisRoot, config.maxYLabelCharCount);\n });\n } else {\n cache.yAxisRoot.select(\".axis.y\").selectAll(\"*\").remove();\n }\n\n if (scales.y2Scale) {\n cache.y2AxisRoot.select(\".axis.y2\").transition().duration(config.axisTransitionDuration).ease(config.ease).call(cache.y2Axis).on(\"end\", function () {\n truncateTickText(cache.y2AxisRoot, config.maxYLabelCharCount);\n });\n } else {\n cache.y2AxisRoot.select(\".axis.y2\").selectAll(\"*\").remove();\n }\n\n return this;\n }\n\n function drawGridLines() {\n if (config.grid === \"horizontal\" || config.grid === \"full\") {\n var ticks = null;\n if (Number.isInteger(config.yTicks)) {\n ticks = config.yTicks;\n } else {\n ticks = Math.ceil(config.chartHeight / config.tickSpacing);\n }\n\n if (scales.yScale) {\n cache.horizontalGridLines = cache.xAxisRoot.select(\".grid-lines-group\").selectAll(\"line.horizontal-grid-line\").data(scales.yScale.ticks(ticks));\n\n cache.horizontalGridLines.enter().append(\"line\").attr(\"class\", \"horizontal-grid-line\").merge(cache.horizontalGridLines).transition().duration(config.axisTransitionDuration).attr(\"x2\", config.markPanelWidth).attr(\"y1\", scales.yScale).attr(\"y2\", scales.yScale);\n\n cache.horizontalGridLines.exit().remove();\n } else if (cache.horizontalGridLines) {\n cache.horizontalGridLines.selectAll(\"*\").remove();\n }\n }\n\n if (config.grid === \"vertical\" || config.grid === \"full\") {\n var _ticks = config.keyType === \"string\" ? scales.xScale.domain() : scales.xScale.ticks();\n cache.verticalGridLines = cache.xAxisRoot.select(\".grid-lines-group\").selectAll(\"line.vertical-grid-line\").data(_ticks);\n\n cache.verticalGridLines.enter().append(\"line\").attr(\"class\", \"vertical-grid-line\").merge(cache.verticalGridLines).transition().duration(config.axisTransitionDuration).attr(\"y1\", 0).attr(\"y2\", config.chartHeight).attr(\"x1\", scales.xScale).attr(\"x2\", scales.xScale);\n\n cache.verticalGridLines.exit().remove();\n }\n\n return this;\n }\n\n function setConfig(_config) {\n config = Object(__WEBPACK_IMPORTED_MODULE_1__helpers_common__[\"override\"])(config, _config);\n return this;\n }\n\n function setScales(_scales) {\n scales = Object(__WEBPACK_IMPORTED_MODULE_1__helpers_common__[\"override\"])(scales, _scales);\n return this;\n }\n\n function render() {\n build();\n buildAxis();\n drawAxis();\n drawGridLines();\n }\n\n function destroy() {\n if (cache.xAxisRoot) {\n cache.xAxisRoot.remove();\n cache.xAxisRoot = null;\n }\n if (cache.yAxisRoot) {\n cache.yAxisRoot.remove();\n cache.yAxisRoot = null;\n }\n if (cache.y2AxisRoot) {\n cache.y2AxisRoot.remove();\n cache.y2AxisRoot = null;\n }\n }\n\n return {\n setConfig: setConfig,\n setScales: setScales,\n render: render,\n destroy: destroy\n };\n}\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/charts/axis.js\n// module id = 28\n// module chunks = 0\n\n//# sourceURL=webpack:///./src/charts/axis.js?"); /***/ }), /* 29 */ diff --git a/src/charts/chart.js b/src/charts/chart.js index 6d0f624..d899548 100644 --- a/src/charts/chart.js +++ b/src/charts/chart.js @@ -32,6 +32,7 @@ import ClipPath from "./clip-path" export default function Chart (_container) { const defaultConfig = { + annotationPoints: [], // common margin: { top: 48, diff --git a/src/charts/line.js b/src/charts/line.js index dca6033..35affa5 100644 --- a/src/charts/line.js +++ b/src/charts/line.js @@ -6,6 +6,7 @@ import {override} from "./helpers/common" export default function Line (_container) { let config = { + annotationPoints: [], chartId: null, chartType: null, colorSchema: ["skyblue"], @@ -191,6 +192,43 @@ export default function Line (_container) { return this } + function drawAnnotationPoints () { + const dotGroups = cache.root.selectAll(".annotation-group") + .data([config.annotationPoints]) + + const dotGroupsSelection = dotGroups.enter() + .append("g") + .merge(dotGroups) + .attr("class", "annotation-group") + .attr("clip-path", `url(#mark-clip-${config.chartId})`) + + dotGroups.exit().remove() + + const dots = dotGroupsSelection.selectAll(".annotation") + .data(d => d) + + dots.enter() + .append("circle") + .merge(dots) + .attr("class", "annotation") + .attr("cx", (d) => scales.xScale(d.x)) + .attr("cy", (d) => { + console.log(d) + const leftAxisGroup = data.groupKeys[LEFT_AXIS_GROUP_INDEX] + if (leftAxisGroup && leftAxisGroup.indexOf(d.group) > -1) { + return scales.yScale(d[keys.VALUE]) + } else { + return scales.y2Scale ? scales.y2Scale(d.y) : scales.yScale(d.y) + } + }) + .attr("r", "10") + .style("fill", "red") + + dots.exit().remove() + + return this + } + function drawAreas () { if (config.chartType !== "area") { cache.root.selectAll(".mark.area").remove() @@ -272,6 +310,7 @@ export default function Line (_container) { drawStackedAreas() drawLines() drawDots() + drawAnnotationPoints() } function destroy () {