force-graph 1.42.13 → 1.42.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- // Version 1.42.13 force-graph - https://github.com/vasturiano/force-graph
1
+ // Version 1.42.15 force-graph - https://github.com/vasturiano/force-graph
2
2
  (function (global, factory) {
3
3
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
4
4
  typeof define === 'function' && define.amd ? define(factory) :
@@ -32,22 +32,19 @@
32
32
  }
33
33
  }
34
34
 
35
- var css_248z = ".force-graph-container canvas {\n display: block;\n user-select: none;\n outline: none;\n -webkit-tap-highlight-color: transparent;\n}\n\n.force-graph-container .graph-tooltip {\n position: absolute;\n top: 0;\n transform: translate(-50%, 25px);\n font-family: sans-serif;\n font-size: 16px;\n padding: 4px;\n border-radius: 3px;\n color: #eee;\n background: rgba(0,0,0,0.65);\n visibility: hidden; /* by default */\n}\n\n.force-graph-container .clickable {\n cursor: pointer;\n}\n\n.force-graph-container .grabbable {\n cursor: move;\n cursor: grab;\n cursor: -moz-grab;\n cursor: -webkit-grab;\n}\n\n.force-graph-container .grabbable:active {\n cursor: grabbing;\n cursor: -moz-grabbing;\n cursor: -webkit-grabbing;\n}\n";
35
+ var css_248z = ".force-graph-container canvas {\n display: block;\n user-select: none;\n outline: none;\n -webkit-tap-highlight-color: transparent;\n}\n\n.force-graph-container .graph-tooltip {\n position: absolute;\n top: 0;\n font-family: sans-serif;\n font-size: 16px;\n padding: 4px;\n border-radius: 3px;\n color: #eee;\n background: rgba(0,0,0,0.65);\n visibility: hidden; /* by default */\n}\n\n.force-graph-container .clickable {\n cursor: pointer;\n}\n\n.force-graph-container .grabbable {\n cursor: move;\n cursor: grab;\n cursor: -moz-grab;\n cursor: -webkit-grab;\n}\n\n.force-graph-container .grabbable:active {\n cursor: grabbing;\n cursor: -moz-grabbing;\n cursor: -webkit-grabbing;\n}\n";
36
36
  styleInject(css_248z);
37
37
 
38
38
  function ownKeys(object, enumerableOnly) {
39
39
  var keys = Object.keys(object);
40
-
41
40
  if (Object.getOwnPropertySymbols) {
42
41
  var symbols = Object.getOwnPropertySymbols(object);
43
42
  enumerableOnly && (symbols = symbols.filter(function (sym) {
44
43
  return Object.getOwnPropertyDescriptor(object, sym).enumerable;
45
44
  })), keys.push.apply(keys, symbols);
46
45
  }
47
-
48
46
  return keys;
49
47
  }
50
-
51
48
  function _objectSpread2(target) {
52
49
  for (var i = 1; i < arguments.length; i++) {
53
50
  var source = null != arguments[i] ? arguments[i] : {};
@@ -57,10 +54,8 @@
57
54
  Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
58
55
  });
59
56
  }
60
-
61
57
  return target;
62
58
  }
63
-
64
59
  function _typeof(obj) {
65
60
  "@babel/helpers - typeof";
66
61
 
@@ -70,7 +65,6 @@
70
65
  return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
71
66
  }, _typeof(obj);
72
67
  }
73
-
74
68
  function _defineProperty(obj, key, value) {
75
69
  if (key in obj) {
76
70
  Object.defineProperty(obj, key, {
@@ -82,10 +76,8 @@
82
76
  } else {
83
77
  obj[key] = value;
84
78
  }
85
-
86
79
  return obj;
87
80
  }
88
-
89
81
  function _setPrototypeOf(o, p) {
90
82
  _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
91
83
  o.__proto__ = p;
@@ -93,12 +85,10 @@
93
85
  };
94
86
  return _setPrototypeOf(o, p);
95
87
  }
96
-
97
88
  function _isNativeReflectConstruct() {
98
89
  if (typeof Reflect === "undefined" || !Reflect.construct) return false;
99
90
  if (Reflect.construct.sham) return false;
100
91
  if (typeof Proxy === "function") return true;
101
-
102
92
  try {
103
93
  Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
104
94
  return true;
@@ -106,7 +96,6 @@
106
96
  return false;
107
97
  }
108
98
  }
109
-
110
99
  function _construct(Parent, args, Class) {
111
100
  if (_isNativeReflectConstruct()) {
112
101
  _construct = Reflect.construct.bind();
@@ -120,44 +109,33 @@
120
109
  return instance;
121
110
  };
122
111
  }
123
-
124
112
  return _construct.apply(null, arguments);
125
113
  }
126
-
127
114
  function _slicedToArray$2(arr, i) {
128
115
  return _arrayWithHoles$2(arr) || _iterableToArrayLimit$2(arr, i) || _unsupportedIterableToArray$3(arr, i) || _nonIterableRest$2();
129
116
  }
130
-
131
117
  function _toConsumableArray$2(arr) {
132
118
  return _arrayWithoutHoles$2(arr) || _iterableToArray$2(arr) || _unsupportedIterableToArray$3(arr) || _nonIterableSpread$2();
133
119
  }
134
-
135
120
  function _arrayWithoutHoles$2(arr) {
136
121
  if (Array.isArray(arr)) return _arrayLikeToArray$3(arr);
137
122
  }
138
-
139
123
  function _arrayWithHoles$2(arr) {
140
124
  if (Array.isArray(arr)) return arr;
141
125
  }
142
-
143
126
  function _iterableToArray$2(iter) {
144
127
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
145
128
  }
146
-
147
129
  function _iterableToArrayLimit$2(arr, i) {
148
130
  var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
149
-
150
131
  if (_i == null) return;
151
132
  var _arr = [];
152
133
  var _n = true;
153
134
  var _d = false;
154
-
155
135
  var _s, _e;
156
-
157
136
  try {
158
137
  for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
159
138
  _arr.push(_s.value);
160
-
161
139
  if (i && _arr.length === i) break;
162
140
  }
163
141
  } catch (err) {
@@ -170,10 +148,8 @@
170
148
  if (_d) throw _e;
171
149
  }
172
150
  }
173
-
174
151
  return _arr;
175
152
  }
176
-
177
153
  function _unsupportedIterableToArray$3(o, minLen) {
178
154
  if (!o) return;
179
155
  if (typeof o === "string") return _arrayLikeToArray$3(o, minLen);
@@ -182,19 +158,14 @@
182
158
  if (n === "Map" || n === "Set") return Array.from(o);
183
159
  if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$3(o, minLen);
184
160
  }
185
-
186
161
  function _arrayLikeToArray$3(arr, len) {
187
162
  if (len == null || len > arr.length) len = arr.length;
188
-
189
163
  for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
190
-
191
164
  return arr2;
192
165
  }
193
-
194
166
  function _nonIterableSpread$2() {
195
167
  throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
196
168
  }
197
-
198
169
  function _nonIterableRest$2() {
199
170
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
200
171
  }
@@ -571,7 +542,7 @@
571
542
  }
572
543
 
573
544
  function selection_sort(compare) {
574
- if (!compare) compare = ascending$1;
545
+ if (!compare) compare = ascending;
575
546
 
576
547
  function compareNode(a, b) {
577
548
  return a && b ? compare(a.__data__, b.__data__) : !a - !b;
@@ -589,7 +560,7 @@
589
560
  return new Selection$1(sortgroups, this._parents).order();
590
561
  }
591
562
 
592
- function ascending$1(a, b) {
563
+ function ascending(a, b) {
593
564
  return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;
594
565
  }
595
566
 
@@ -1123,30 +1094,6 @@
1123
1094
  : new Selection$1([[selector]], root$1);
1124
1095
  }
1125
1096
 
1126
- var nextId$1 = 0;
1127
-
1128
- function Local() {
1129
- this._ = "@" + (++nextId$1).toString(36);
1130
- }
1131
-
1132
- Local.prototype = {
1133
- constructor: Local,
1134
- get: function(node) {
1135
- var id = this._;
1136
- while (!(id in node)) if (!(node = node.parentNode)) return;
1137
- return node[id];
1138
- },
1139
- set: function(node, value) {
1140
- return node[this._] = value;
1141
- },
1142
- remove: function(node) {
1143
- return this._ in node && delete node[this._];
1144
- },
1145
- toString: function() {
1146
- return this._;
1147
- }
1148
- };
1149
-
1150
1097
  function sourceEvent(event) {
1151
1098
  let sourceEvent;
1152
1099
  while (sourceEvent = event.sourceEvent) event = sourceEvent;
@@ -1920,199 +1867,6 @@
1920
1867
  : m1) * 255;
1921
1868
  }
1922
1869
 
1923
- const radians = Math.PI / 180;
1924
- const degrees$1 = 180 / Math.PI;
1925
-
1926
- // https://observablehq.com/@mbostock/lab-and-rgb
1927
- const K = 18,
1928
- Xn = 0.96422,
1929
- Yn = 1,
1930
- Zn = 0.82521,
1931
- t0$1 = 4 / 29,
1932
- t1$1 = 6 / 29,
1933
- t2 = 3 * t1$1 * t1$1,
1934
- t3 = t1$1 * t1$1 * t1$1;
1935
-
1936
- function labConvert(o) {
1937
- if (o instanceof Lab) return new Lab(o.l, o.a, o.b, o.opacity);
1938
- if (o instanceof Hcl) return hcl2lab(o);
1939
- if (!(o instanceof Rgb)) o = rgbConvert(o);
1940
- var r = rgb2lrgb(o.r),
1941
- g = rgb2lrgb(o.g),
1942
- b = rgb2lrgb(o.b),
1943
- y = xyz2lab((0.2225045 * r + 0.7168786 * g + 0.0606169 * b) / Yn), x, z;
1944
- if (r === g && g === b) x = z = y; else {
1945
- x = xyz2lab((0.4360747 * r + 0.3850649 * g + 0.1430804 * b) / Xn);
1946
- z = xyz2lab((0.0139322 * r + 0.0971045 * g + 0.7141733 * b) / Zn);
1947
- }
1948
- return new Lab(116 * y - 16, 500 * (x - y), 200 * (y - z), o.opacity);
1949
- }
1950
-
1951
- function lab(l, a, b, opacity) {
1952
- return arguments.length === 1 ? labConvert(l) : new Lab(l, a, b, opacity == null ? 1 : opacity);
1953
- }
1954
-
1955
- function Lab(l, a, b, opacity) {
1956
- this.l = +l;
1957
- this.a = +a;
1958
- this.b = +b;
1959
- this.opacity = +opacity;
1960
- }
1961
-
1962
- define(Lab, lab, extend(Color, {
1963
- brighter(k) {
1964
- return new Lab(this.l + K * (k == null ? 1 : k), this.a, this.b, this.opacity);
1965
- },
1966
- darker(k) {
1967
- return new Lab(this.l - K * (k == null ? 1 : k), this.a, this.b, this.opacity);
1968
- },
1969
- rgb() {
1970
- var y = (this.l + 16) / 116,
1971
- x = isNaN(this.a) ? y : y + this.a / 500,
1972
- z = isNaN(this.b) ? y : y - this.b / 200;
1973
- x = Xn * lab2xyz(x);
1974
- y = Yn * lab2xyz(y);
1975
- z = Zn * lab2xyz(z);
1976
- return new Rgb(
1977
- lrgb2rgb( 3.1338561 * x - 1.6168667 * y - 0.4906146 * z),
1978
- lrgb2rgb(-0.9787684 * x + 1.9161415 * y + 0.0334540 * z),
1979
- lrgb2rgb( 0.0719453 * x - 0.2289914 * y + 1.4052427 * z),
1980
- this.opacity
1981
- );
1982
- }
1983
- }));
1984
-
1985
- function xyz2lab(t) {
1986
- return t > t3 ? Math.pow(t, 1 / 3) : t / t2 + t0$1;
1987
- }
1988
-
1989
- function lab2xyz(t) {
1990
- return t > t1$1 ? t * t * t : t2 * (t - t0$1);
1991
- }
1992
-
1993
- function lrgb2rgb(x) {
1994
- return 255 * (x <= 0.0031308 ? 12.92 * x : 1.055 * Math.pow(x, 1 / 2.4) - 0.055);
1995
- }
1996
-
1997
- function rgb2lrgb(x) {
1998
- return (x /= 255) <= 0.04045 ? x / 12.92 : Math.pow((x + 0.055) / 1.055, 2.4);
1999
- }
2000
-
2001
- function hclConvert(o) {
2002
- if (o instanceof Hcl) return new Hcl(o.h, o.c, o.l, o.opacity);
2003
- if (!(o instanceof Lab)) o = labConvert(o);
2004
- if (o.a === 0 && o.b === 0) return new Hcl(NaN, 0 < o.l && o.l < 100 ? 0 : NaN, o.l, o.opacity);
2005
- var h = Math.atan2(o.b, o.a) * degrees$1;
2006
- return new Hcl(h < 0 ? h + 360 : h, Math.sqrt(o.a * o.a + o.b * o.b), o.l, o.opacity);
2007
- }
2008
-
2009
- function hcl(h, c, l, opacity) {
2010
- return arguments.length === 1 ? hclConvert(h) : new Hcl(h, c, l, opacity == null ? 1 : opacity);
2011
- }
2012
-
2013
- function Hcl(h, c, l, opacity) {
2014
- this.h = +h;
2015
- this.c = +c;
2016
- this.l = +l;
2017
- this.opacity = +opacity;
2018
- }
2019
-
2020
- function hcl2lab(o) {
2021
- if (isNaN(o.h)) return new Lab(o.l, 0, 0, o.opacity);
2022
- var h = o.h * radians;
2023
- return new Lab(o.l, Math.cos(h) * o.c, Math.sin(h) * o.c, o.opacity);
2024
- }
2025
-
2026
- define(Hcl, hcl, extend(Color, {
2027
- brighter(k) {
2028
- return new Hcl(this.h, this.c, this.l + K * (k == null ? 1 : k), this.opacity);
2029
- },
2030
- darker(k) {
2031
- return new Hcl(this.h, this.c, this.l - K * (k == null ? 1 : k), this.opacity);
2032
- },
2033
- rgb() {
2034
- return hcl2lab(this).rgb();
2035
- }
2036
- }));
2037
-
2038
- var A = -0.14861,
2039
- B = +1.78277,
2040
- C = -0.29227,
2041
- D = -0.90649,
2042
- E = +1.97294,
2043
- ED = E * D,
2044
- EB = E * B,
2045
- BC_DA = B * C - D * A;
2046
-
2047
- function cubehelixConvert(o) {
2048
- if (o instanceof Cubehelix) return new Cubehelix(o.h, o.s, o.l, o.opacity);
2049
- if (!(o instanceof Rgb)) o = rgbConvert(o);
2050
- var r = o.r / 255,
2051
- g = o.g / 255,
2052
- b = o.b / 255,
2053
- l = (BC_DA * b + ED * r - EB * g) / (BC_DA + ED - EB),
2054
- bl = b - l,
2055
- k = (E * (g - l) - C * bl) / D,
2056
- s = Math.sqrt(k * k + bl * bl) / (E * l * (1 - l)), // NaN if l=0 or l=1
2057
- h = s ? Math.atan2(k, bl) * degrees$1 - 120 : NaN;
2058
- return new Cubehelix(h < 0 ? h + 360 : h, s, l, o.opacity);
2059
- }
2060
-
2061
- function cubehelix$1(h, s, l, opacity) {
2062
- return arguments.length === 1 ? cubehelixConvert(h) : new Cubehelix(h, s, l, opacity == null ? 1 : opacity);
2063
- }
2064
-
2065
- function Cubehelix(h, s, l, opacity) {
2066
- this.h = +h;
2067
- this.s = +s;
2068
- this.l = +l;
2069
- this.opacity = +opacity;
2070
- }
2071
-
2072
- define(Cubehelix, cubehelix$1, extend(Color, {
2073
- brighter(k) {
2074
- k = k == null ? brighter : Math.pow(brighter, k);
2075
- return new Cubehelix(this.h, this.s, this.l * k, this.opacity);
2076
- },
2077
- darker(k) {
2078
- k = k == null ? darker : Math.pow(darker, k);
2079
- return new Cubehelix(this.h, this.s, this.l * k, this.opacity);
2080
- },
2081
- rgb() {
2082
- var h = isNaN(this.h) ? 0 : (this.h + 120) * radians,
2083
- l = +this.l,
2084
- a = isNaN(this.s) ? 0 : this.s * l * (1 - l),
2085
- cosh = Math.cos(h),
2086
- sinh = Math.sin(h);
2087
- return new Rgb(
2088
- 255 * (l + a * (A * cosh + B * sinh)),
2089
- 255 * (l + a * (C * cosh + D * sinh)),
2090
- 255 * (l + a * (E * cosh)),
2091
- this.opacity
2092
- );
2093
- }
2094
- }));
2095
-
2096
- function basis(t1, v0, v1, v2, v3) {
2097
- var t2 = t1 * t1, t3 = t2 * t1;
2098
- return ((1 - 3 * t1 + 3 * t2 - t3) * v0
2099
- + (4 - 6 * t2 + 3 * t3) * v1
2100
- + (1 + 3 * t1 + 3 * t2 - 3 * t3) * v2
2101
- + t3 * v3) / 6;
2102
- }
2103
-
2104
- function basis$1(values) {
2105
- var n = values.length - 1;
2106
- return function(t) {
2107
- var i = t <= 0 ? (t = 0) : t >= 1 ? (t = 1, n - 1) : Math.floor(t * n),
2108
- v1 = values[i],
2109
- v2 = values[i + 1],
2110
- v0 = i > 0 ? values[i - 1] : 2 * v1 - v2,
2111
- v3 = i < n - 1 ? values[i + 2] : 2 * v2 - v1;
2112
- return basis((t - i / n) * n, v0, v1, v2, v3);
2113
- };
2114
- }
2115
-
2116
1870
  var constant$2 = x => () => x;
2117
1871
 
2118
1872
  function linear(a, d) {
@@ -2127,11 +1881,6 @@
2127
1881
  };
2128
1882
  }
2129
1883
 
2130
- function hue(a, b) {
2131
- var d = b - a;
2132
- return d ? linear(a, d > 180 || d < -180 ? d - 360 * Math.round(d / 360) : d) : constant$2(isNaN(a) ? b : a);
2133
- }
2134
-
2135
1884
  function gamma(y) {
2136
1885
  return (y = +y) === 1 ? nogamma : function(a, b) {
2137
1886
  return b - a ? exponential(a, b, y) : constant$2(isNaN(a) ? b : a);
@@ -2165,34 +1914,6 @@
2165
1914
  return rgb$1;
2166
1915
  })(1);
2167
1916
 
2168
- function rgbSpline(spline) {
2169
- return function(colors) {
2170
- var n = colors.length,
2171
- r = new Array(n),
2172
- g = new Array(n),
2173
- b = new Array(n),
2174
- i, color;
2175
- for (i = 0; i < n; ++i) {
2176
- color = rgb(colors[i]);
2177
- r[i] = color.r || 0;
2178
- g[i] = color.g || 0;
2179
- b[i] = color.b || 0;
2180
- }
2181
- r = spline(r);
2182
- g = spline(g);
2183
- b = spline(b);
2184
- color.opacity = 1;
2185
- return function(t) {
2186
- color.r = r(t);
2187
- color.g = g(t);
2188
- color.b = b(t);
2189
- return color + "";
2190
- };
2191
- };
2192
- }
2193
-
2194
- var rgbBasis = rgbSpline(basis$1);
2195
-
2196
1917
  function interpolateNumber(a, b) {
2197
1918
  return a = +a, b = +b, function(t) {
2198
1919
  return a * (1 - t) + b * t;
@@ -2202,7 +1923,7 @@
2202
1923
  var reA = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,
2203
1924
  reB = new RegExp(reA.source, "g");
2204
1925
 
2205
- function zero$1(b) {
1926
+ function zero(b) {
2206
1927
  return function() {
2207
1928
  return b;
2208
1929
  };
@@ -2255,7 +1976,7 @@
2255
1976
  // Otherwise, interpolate each of the numbers and rejoin the string.
2256
1977
  return s.length < 2 ? (q[0]
2257
1978
  ? one(q[0].x)
2258
- : zero$1(b))
1979
+ : zero(b))
2259
1980
  : (b = q.length, function(t) {
2260
1981
  for (var i = 0, o; i < b; ++i) s[(o = q[i]).i] = o.x(t);
2261
1982
  return s.join("");
@@ -2264,7 +1985,7 @@
2264
1985
 
2265
1986
  var degrees = 180 / Math.PI;
2266
1987
 
2267
- var identity$2 = {
1988
+ var identity$1 = {
2268
1989
  translateX: 0,
2269
1990
  translateY: 0,
2270
1991
  rotate: 0,
@@ -2294,14 +2015,14 @@
2294
2015
  /* eslint-disable no-undef */
2295
2016
  function parseCss(value) {
2296
2017
  const m = new (typeof DOMMatrix === "function" ? DOMMatrix : WebKitCSSMatrix)(value + "");
2297
- return m.isIdentity ? identity$2 : decompose(m.a, m.b, m.c, m.d, m.e, m.f);
2018
+ return m.isIdentity ? identity$1 : decompose(m.a, m.b, m.c, m.d, m.e, m.f);
2298
2019
  }
2299
2020
 
2300
2021
  function parseSvg(value) {
2301
- if (value == null) return identity$2;
2022
+ if (value == null) return identity$1;
2302
2023
  if (!svgNode) svgNode = document.createElementNS("http://www.w3.org/2000/svg", "g");
2303
2024
  svgNode.setAttribute("transform", value);
2304
- if (!(value = svgNode.transform.baseVal.consolidate())) return identity$2;
2025
+ if (!(value = svgNode.transform.baseVal.consolidate())) return identity$1;
2305
2026
  value = value.matrix;
2306
2027
  return decompose(value.a, value.b, value.c, value.d, value.e, value.f);
2307
2028
  }
@@ -2439,33 +2160,6 @@
2439
2160
  return zoom;
2440
2161
  })(Math.SQRT2, 2, 4);
2441
2162
 
2442
- function cubehelix(hue) {
2443
- return (function cubehelixGamma(y) {
2444
- y = +y;
2445
-
2446
- function cubehelix(start, end) {
2447
- var h = hue((start = cubehelix$1(start)).h, (end = cubehelix$1(end)).h),
2448
- s = nogamma(start.s, end.s),
2449
- l = nogamma(start.l, end.l),
2450
- opacity = nogamma(start.opacity, end.opacity);
2451
- return function(t) {
2452
- start.h = h(t);
2453
- start.s = s(t);
2454
- start.l = l(Math.pow(t, y));
2455
- start.opacity = opacity(t);
2456
- return start + "";
2457
- };
2458
- }
2459
-
2460
- cubehelix.gamma = cubehelixGamma;
2461
-
2462
- return cubehelix;
2463
- })(1);
2464
- }
2465
-
2466
- cubehelix(hue);
2467
- var cubehelixLong = cubehelix(nogamma);
2468
-
2469
2163
  var frame = 0, // is an animation frame pending?
2470
2164
  timeout$1 = 0, // is a timeout pending?
2471
2165
  interval = 0, // are any timers active?
@@ -3413,132 +3107,6 @@
3413
3107
  return ((t *= 2) <= 1 ? t * t * t : (t -= 2) * t * t + 2) / 2;
3414
3108
  }
3415
3109
 
3416
- var exponent$1 = 3;
3417
-
3418
- ((function custom(e) {
3419
- e = +e;
3420
-
3421
- function polyIn(t) {
3422
- return Math.pow(t, e);
3423
- }
3424
-
3425
- polyIn.exponent = custom;
3426
-
3427
- return polyIn;
3428
- }))(exponent$1);
3429
-
3430
- ((function custom(e) {
3431
- e = +e;
3432
-
3433
- function polyOut(t) {
3434
- return 1 - Math.pow(1 - t, e);
3435
- }
3436
-
3437
- polyOut.exponent = custom;
3438
-
3439
- return polyOut;
3440
- }))(exponent$1);
3441
-
3442
- ((function custom(e) {
3443
- e = +e;
3444
-
3445
- function polyInOut(t) {
3446
- return ((t *= 2) <= 1 ? Math.pow(t, e) : 2 - Math.pow(2 - t, e)) / 2;
3447
- }
3448
-
3449
- polyInOut.exponent = custom;
3450
-
3451
- return polyInOut;
3452
- }))(exponent$1);
3453
-
3454
- // tpmt is two power minus ten times t scaled to [0,1]
3455
- function tpmt(x) {
3456
- return (Math.pow(2, -10 * x) - 0.0009765625) * 1.0009775171065494;
3457
- }
3458
-
3459
- var overshoot = 1.70158;
3460
-
3461
- ((function custom(s) {
3462
- s = +s;
3463
-
3464
- function backIn(t) {
3465
- return (t = +t) * t * (s * (t - 1) + t);
3466
- }
3467
-
3468
- backIn.overshoot = custom;
3469
-
3470
- return backIn;
3471
- }))(overshoot);
3472
-
3473
- ((function custom(s) {
3474
- s = +s;
3475
-
3476
- function backOut(t) {
3477
- return --t * t * ((t + 1) * s + t) + 1;
3478
- }
3479
-
3480
- backOut.overshoot = custom;
3481
-
3482
- return backOut;
3483
- }))(overshoot);
3484
-
3485
- ((function custom(s) {
3486
- s = +s;
3487
-
3488
- function backInOut(t) {
3489
- return ((t *= 2) < 1 ? t * t * ((s + 1) * t - s) : (t -= 2) * t * ((s + 1) * t + s) + 2) / 2;
3490
- }
3491
-
3492
- backInOut.overshoot = custom;
3493
-
3494
- return backInOut;
3495
- }))(overshoot);
3496
-
3497
- var tau$1 = 2 * Math.PI,
3498
- amplitude = 1,
3499
- period = 0.3;
3500
-
3501
- ((function custom(a, p) {
3502
- var s = Math.asin(1 / (a = Math.max(1, a))) * (p /= tau$1);
3503
-
3504
- function elasticIn(t) {
3505
- return a * tpmt(-(--t)) * Math.sin((s - t) / p);
3506
- }
3507
-
3508
- elasticIn.amplitude = function(a) { return custom(a, p * tau$1); };
3509
- elasticIn.period = function(p) { return custom(a, p); };
3510
-
3511
- return elasticIn;
3512
- }))(amplitude, period);
3513
-
3514
- ((function custom(a, p) {
3515
- var s = Math.asin(1 / (a = Math.max(1, a))) * (p /= tau$1);
3516
-
3517
- function elasticOut(t) {
3518
- return 1 - a * tpmt(t = +t) * Math.sin((t + s) / p);
3519
- }
3520
-
3521
- elasticOut.amplitude = function(a) { return custom(a, p * tau$1); };
3522
- elasticOut.period = function(p) { return custom(a, p); };
3523
-
3524
- return elasticOut;
3525
- }))(amplitude, period);
3526
-
3527
- ((function custom(a, p) {
3528
- var s = Math.asin(1 / (a = Math.max(1, a))) * (p /= tau$1);
3529
-
3530
- function elasticInOut(t) {
3531
- return ((t = t * 2 - 1) < 0
3532
- ? a * tpmt(-t) * Math.sin((s - t) / p)
3533
- : 2 - a * tpmt(t) * Math.sin((s + t) / p)) / 2;
3534
- }
3535
-
3536
- elasticInOut.amplitude = function(a) { return custom(a, p * tau$1); };
3537
- elasticInOut.period = function(p) { return custom(a, p); };
3538
-
3539
- return elasticInOut;
3540
- }))(amplitude, period);
3541
-
3542
3110
  var defaultTiming = {
3543
3111
  time: null, // Set on use.
3544
3112
  delay: 0,
@@ -3640,12 +3208,12 @@
3640
3208
  }
3641
3209
  };
3642
3210
 
3643
- var identity$1 = new Transform(1, 0, 0);
3211
+ var identity = new Transform(1, 0, 0);
3644
3212
 
3645
3213
  transform.prototype = Transform.prototype;
3646
3214
 
3647
3215
  function transform(node) {
3648
- while (!node.__zoom) if (!(node = node.parentNode)) return identity$1;
3216
+ while (!node.__zoom) if (!(node = node.parentNode)) return identity;
3649
3217
  return node.__zoom;
3650
3218
  }
3651
3219
 
@@ -3678,7 +3246,7 @@
3678
3246
  }
3679
3247
 
3680
3248
  function defaultTransform() {
3681
- return this.__zoom || identity$1;
3249
+ return this.__zoom || identity;
3682
3250
  }
3683
3251
 
3684
3252
  function defaultWheelDelta(event) {
@@ -3781,7 +3349,7 @@
3781
3349
  var e = extent.apply(this, arguments),
3782
3350
  t = this.__zoom,
3783
3351
  p0 = p == null ? centroid(e) : typeof p === "function" ? p.apply(this, arguments) : p;
3784
- return constrain(identity$1.translate(p0[0], p0[1]).scale(t.k).translate(
3352
+ return constrain(identity.translate(p0[0], p0[1]).scale(t.k).translate(
3785
3353
  typeof x === "function" ? -x.apply(this, arguments) : -x,
3786
3354
  typeof y === "function" ? -y.apply(this, arguments) : -y
3787
3355
  ), e, translateExtent);
@@ -4096,79 +3664,6 @@
4096
3664
  return zoom;
4097
3665
  }
4098
3666
 
4099
- function ascending(a, b) {
4100
- return a == null || b == null ? NaN : a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;
4101
- }
4102
-
4103
- function descending(a, b) {
4104
- return a == null || b == null ? NaN
4105
- : b < a ? -1
4106
- : b > a ? 1
4107
- : b >= a ? 0
4108
- : NaN;
4109
- }
4110
-
4111
- function bisector(f) {
4112
- let compare1, compare2, delta;
4113
-
4114
- // If an accessor is specified, promote it to a comparator. In this case we
4115
- // can test whether the search value is (self-) comparable. We can’t do this
4116
- // for a comparator (except for specific, known comparators) because we can’t
4117
- // tell if the comparator is symmetric, and an asymmetric comparator can’t be
4118
- // used to test whether a single value is comparable.
4119
- if (f.length !== 2) {
4120
- compare1 = ascending;
4121
- compare2 = (d, x) => ascending(f(d), x);
4122
- delta = (d, x) => f(d) - x;
4123
- } else {
4124
- compare1 = f === ascending || f === descending ? f : zero;
4125
- compare2 = f;
4126
- delta = f;
4127
- }
4128
-
4129
- function left(a, x, lo = 0, hi = a.length) {
4130
- if (lo < hi) {
4131
- if (compare1(x, x) !== 0) return hi;
4132
- do {
4133
- const mid = (lo + hi) >>> 1;
4134
- if (compare2(a[mid], x) < 0) lo = mid + 1;
4135
- else hi = mid;
4136
- } while (lo < hi);
4137
- }
4138
- return lo;
4139
- }
4140
-
4141
- function right(a, x, lo = 0, hi = a.length) {
4142
- if (lo < hi) {
4143
- if (compare1(x, x) !== 0) return hi;
4144
- do {
4145
- const mid = (lo + hi) >>> 1;
4146
- if (compare2(a[mid], x) <= 0) lo = mid + 1;
4147
- else hi = mid;
4148
- } while (lo < hi);
4149
- }
4150
- return lo;
4151
- }
4152
-
4153
- function center(a, x, lo = 0, hi = a.length) {
4154
- const i = left(a, x, lo, hi - 1);
4155
- return i > lo && delta(a[i - 1], x) > -delta(a[i], x) ? i - 1 : i;
4156
- }
4157
-
4158
- return {left, center, right};
4159
- }
4160
-
4161
- function zero() {
4162
- return 0;
4163
- }
4164
-
4165
- function number(x) {
4166
- return x === null ? NaN : +x;
4167
- }
4168
-
4169
- bisector(ascending);
4170
- bisector(number).center;
4171
-
4172
3667
  class InternMap extends Map {
4173
3668
  constructor(entries, key = keyof) {
4174
3669
  super();
@@ -4698,6 +4193,8 @@
4698
4193
 
4699
4194
  var lodash_throttle = throttle;
4700
4195
 
4196
+ var throttle$1 = lodash_throttle;
4197
+
4701
4198
  /**
4702
4199
  * The Ease class provides a collection of easing functions for use with tween.js.
4703
4200
  */
@@ -5499,6 +4996,8 @@
5499
4996
  update: update,
5500
4997
  };
5501
4998
 
4999
+ var TWEEN$1 = exports$1;
5000
+
5502
5001
  /**
5503
5002
  * Returns a function, that, as long as it continues to be invoked, will not
5504
5003
  * be triggered. The function will be called after it stops being called for
@@ -5799,6 +5298,8 @@
5799
5298
  };
5800
5299
  }); // constant
5801
5300
 
5301
+ var accessorFn = index$2;
5302
+
5802
5303
  var tinycolor = {exports: {}};
5803
5304
 
5804
5305
  (function (module) {
@@ -11200,1766 +10701,40 @@
11200
10701
  return scale;
11201
10702
  }
11202
10703
 
11203
- function formatDecimal(x) {
11204
- return Math.abs(x = Math.round(x)) >= 1e21
11205
- ? x.toLocaleString("en").replace(/,/g, "")
11206
- : x.toString(10);
11207
- }
11208
-
11209
- // Computes the decimal coefficient and exponent of the specified number x with
11210
- // significant digits p, where x is positive and p is in [1, 21] or undefined.
11211
- // For example, formatDecimalParts(1.23) returns ["123", 0].
11212
- function formatDecimalParts(x, p) {
11213
- if ((i = (x = p ? x.toExponential(p - 1) : x.toExponential()).indexOf("e")) < 0) return null; // NaN, ±Infinity
11214
- var i, coefficient = x.slice(0, i);
11215
-
11216
- // The string returned by toExponential either has the form \d\.\d+e[-+]\d+
11217
- // (e.g., 1.2e+3) or the form \de[-+]\d+ (e.g., 1e+3).
11218
- return [
11219
- coefficient.length > 1 ? coefficient[0] + coefficient.slice(2) : coefficient,
11220
- +x.slice(i + 1)
11221
- ];
11222
- }
11223
-
11224
- function exponent(x) {
11225
- return x = formatDecimalParts(Math.abs(x)), x ? x[1] : NaN;
10704
+ function colors(specifier) {
10705
+ var n = specifier.length / 6 | 0, colors = new Array(n), i = 0;
10706
+ while (i < n) colors[i] = "#" + specifier.slice(i * 6, ++i * 6);
10707
+ return colors;
11226
10708
  }
11227
10709
 
11228
- function formatGroup(grouping, thousands) {
11229
- return function(value, width) {
11230
- var i = value.length,
11231
- t = [],
11232
- j = 0,
11233
- g = grouping[0],
11234
- length = 0;
11235
-
11236
- while (i > 0 && g > 0) {
11237
- if (length + g + 1 > width) g = Math.max(1, width - length);
11238
- t.push(value.substring(i -= g, i + g));
11239
- if ((length += g + 1) > width) break;
11240
- g = grouping[j = (j + 1) % grouping.length];
11241
- }
11242
-
11243
- return t.reverse().join(thousands);
11244
- };
11245
- }
10710
+ var schemePaired = colors("a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928");
11246
10711
 
11247
- function formatNumerals(numerals) {
11248
- return function(value) {
11249
- return value.replace(/[0-9]/g, function(i) {
11250
- return numerals[+i];
11251
- });
11252
- };
11253
- }
10712
+ var autoColorScale = ordinal(schemePaired);
11254
10713
 
11255
- // [[fill]align][sign][symbol][0][width][,][.precision][~][type]
11256
- var re = /^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;
11257
-
11258
- function formatSpecifier(specifier) {
11259
- if (!(match = re.exec(specifier))) throw new Error("invalid format: " + specifier);
11260
- var match;
11261
- return new FormatSpecifier({
11262
- fill: match[1],
11263
- align: match[2],
11264
- sign: match[3],
11265
- symbol: match[4],
11266
- zero: match[5],
11267
- width: match[6],
11268
- comma: match[7],
11269
- precision: match[8] && match[8].slice(1),
11270
- trim: match[9],
11271
- type: match[10]
11272
- });
11273
- }
11274
-
11275
- formatSpecifier.prototype = FormatSpecifier.prototype; // instanceof
11276
-
11277
- function FormatSpecifier(specifier) {
11278
- this.fill = specifier.fill === undefined ? " " : specifier.fill + "";
11279
- this.align = specifier.align === undefined ? ">" : specifier.align + "";
11280
- this.sign = specifier.sign === undefined ? "-" : specifier.sign + "";
11281
- this.symbol = specifier.symbol === undefined ? "" : specifier.symbol + "";
11282
- this.zero = !!specifier.zero;
11283
- this.width = specifier.width === undefined ? undefined : +specifier.width;
11284
- this.comma = !!specifier.comma;
11285
- this.precision = specifier.precision === undefined ? undefined : +specifier.precision;
11286
- this.trim = !!specifier.trim;
11287
- this.type = specifier.type === undefined ? "" : specifier.type + "";
11288
- }
11289
-
11290
- FormatSpecifier.prototype.toString = function() {
11291
- return this.fill
11292
- + this.align
11293
- + this.sign
11294
- + this.symbol
11295
- + (this.zero ? "0" : "")
11296
- + (this.width === undefined ? "" : Math.max(1, this.width | 0))
11297
- + (this.comma ? "," : "")
11298
- + (this.precision === undefined ? "" : "." + Math.max(0, this.precision | 0))
11299
- + (this.trim ? "~" : "")
11300
- + this.type;
11301
- };
11302
-
11303
- // Trims insignificant zeros, e.g., replaces 1.2000k with 1.2k.
11304
- function formatTrim(s) {
11305
- out: for (var n = s.length, i = 1, i0 = -1, i1; i < n; ++i) {
11306
- switch (s[i]) {
11307
- case ".": i0 = i1 = i; break;
11308
- case "0": if (i0 === 0) i0 = i; i1 = i; break;
11309
- default: if (!+s[i]) break out; if (i0 > 0) i0 = 0; break;
11310
- }
11311
- }
11312
- return i0 > 0 ? s.slice(0, i0) + s.slice(i1 + 1) : s;
11313
- }
11314
-
11315
- var prefixExponent;
11316
-
11317
- function formatPrefixAuto(x, p) {
11318
- var d = formatDecimalParts(x, p);
11319
- if (!d) return x + "";
11320
- var coefficient = d[0],
11321
- exponent = d[1],
11322
- i = exponent - (prefixExponent = Math.max(-8, Math.min(8, Math.floor(exponent / 3))) * 3) + 1,
11323
- n = coefficient.length;
11324
- return i === n ? coefficient
11325
- : i > n ? coefficient + new Array(i - n + 1).join("0")
11326
- : i > 0 ? coefficient.slice(0, i) + "." + coefficient.slice(i)
11327
- : "0." + new Array(1 - i).join("0") + formatDecimalParts(x, Math.max(0, p + i - 1))[0]; // less than 1y!
11328
- }
11329
-
11330
- function formatRounded(x, p) {
11331
- var d = formatDecimalParts(x, p);
11332
- if (!d) return x + "";
11333
- var coefficient = d[0],
11334
- exponent = d[1];
11335
- return exponent < 0 ? "0." + new Array(-exponent).join("0") + coefficient
11336
- : coefficient.length > exponent + 1 ? coefficient.slice(0, exponent + 1) + "." + coefficient.slice(exponent + 1)
11337
- : coefficient + new Array(exponent - coefficient.length + 2).join("0");
11338
- }
11339
-
11340
- var formatTypes = {
11341
- "%": (x, p) => (x * 100).toFixed(p),
11342
- "b": (x) => Math.round(x).toString(2),
11343
- "c": (x) => x + "",
11344
- "d": formatDecimal,
11345
- "e": (x, p) => x.toExponential(p),
11346
- "f": (x, p) => x.toFixed(p),
11347
- "g": (x, p) => x.toPrecision(p),
11348
- "o": (x) => Math.round(x).toString(8),
11349
- "p": (x, p) => formatRounded(x * 100, p),
11350
- "r": formatRounded,
11351
- "s": formatPrefixAuto,
11352
- "X": (x) => Math.round(x).toString(16).toUpperCase(),
11353
- "x": (x) => Math.round(x).toString(16)
11354
- };
11355
-
11356
- function identity(x) {
11357
- return x;
11358
- }
11359
-
11360
- var map = Array.prototype.map,
11361
- prefixes = ["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];
11362
-
11363
- function formatLocale$1(locale) {
11364
- var group = locale.grouping === undefined || locale.thousands === undefined ? identity : formatGroup(map.call(locale.grouping, Number), locale.thousands + ""),
11365
- currencyPrefix = locale.currency === undefined ? "" : locale.currency[0] + "",
11366
- currencySuffix = locale.currency === undefined ? "" : locale.currency[1] + "",
11367
- decimal = locale.decimal === undefined ? "." : locale.decimal + "",
11368
- numerals = locale.numerals === undefined ? identity : formatNumerals(map.call(locale.numerals, String)),
11369
- percent = locale.percent === undefined ? "%" : locale.percent + "",
11370
- minus = locale.minus === undefined ? "−" : locale.minus + "",
11371
- nan = locale.nan === undefined ? "NaN" : locale.nan + "";
11372
-
11373
- function newFormat(specifier) {
11374
- specifier = formatSpecifier(specifier);
11375
-
11376
- var fill = specifier.fill,
11377
- align = specifier.align,
11378
- sign = specifier.sign,
11379
- symbol = specifier.symbol,
11380
- zero = specifier.zero,
11381
- width = specifier.width,
11382
- comma = specifier.comma,
11383
- precision = specifier.precision,
11384
- trim = specifier.trim,
11385
- type = specifier.type;
11386
-
11387
- // The "n" type is an alias for ",g".
11388
- if (type === "n") comma = true, type = "g";
11389
-
11390
- // The "" type, and any invalid type, is an alias for ".12~g".
11391
- else if (!formatTypes[type]) precision === undefined && (precision = 12), trim = true, type = "g";
11392
-
11393
- // If zero fill is specified, padding goes after sign and before digits.
11394
- if (zero || (fill === "0" && align === "=")) zero = true, fill = "0", align = "=";
11395
-
11396
- // Compute the prefix and suffix.
11397
- // For SI-prefix, the suffix is lazily computed.
11398
- var prefix = symbol === "$" ? currencyPrefix : symbol === "#" && /[boxX]/.test(type) ? "0" + type.toLowerCase() : "",
11399
- suffix = symbol === "$" ? currencySuffix : /[%p]/.test(type) ? percent : "";
11400
-
11401
- // What format function should we use?
11402
- // Is this an integer type?
11403
- // Can this type generate exponential notation?
11404
- var formatType = formatTypes[type],
11405
- maybeSuffix = /[defgprs%]/.test(type);
11406
-
11407
- // Set the default precision if not specified,
11408
- // or clamp the specified precision to the supported range.
11409
- // For significant precision, it must be in [1, 21].
11410
- // For fixed precision, it must be in [0, 20].
11411
- precision = precision === undefined ? 6
11412
- : /[gprs]/.test(type) ? Math.max(1, Math.min(21, precision))
11413
- : Math.max(0, Math.min(20, precision));
11414
-
11415
- function format(value) {
11416
- var valuePrefix = prefix,
11417
- valueSuffix = suffix,
11418
- i, n, c;
11419
-
11420
- if (type === "c") {
11421
- valueSuffix = formatType(value) + valueSuffix;
11422
- value = "";
11423
- } else {
11424
- value = +value;
11425
-
11426
- // Determine the sign. -0 is not less than 0, but 1 / -0 is!
11427
- var valueNegative = value < 0 || 1 / value < 0;
11428
-
11429
- // Perform the initial formatting.
11430
- value = isNaN(value) ? nan : formatType(Math.abs(value), precision);
11431
-
11432
- // Trim insignificant zeros.
11433
- if (trim) value = formatTrim(value);
11434
-
11435
- // If a negative value rounds to zero after formatting, and no explicit positive sign is requested, hide the sign.
11436
- if (valueNegative && +value === 0 && sign !== "+") valueNegative = false;
11437
-
11438
- // Compute the prefix and suffix.
11439
- valuePrefix = (valueNegative ? (sign === "(" ? sign : minus) : sign === "-" || sign === "(" ? "" : sign) + valuePrefix;
11440
- valueSuffix = (type === "s" ? prefixes[8 + prefixExponent / 3] : "") + valueSuffix + (valueNegative && sign === "(" ? ")" : "");
11441
-
11442
- // Break the formatted value into the integer “value” part that can be
11443
- // grouped, and fractional or exponential “suffix” part that is not.
11444
- if (maybeSuffix) {
11445
- i = -1, n = value.length;
11446
- while (++i < n) {
11447
- if (c = value.charCodeAt(i), 48 > c || c > 57) {
11448
- valueSuffix = (c === 46 ? decimal + value.slice(i + 1) : value.slice(i)) + valueSuffix;
11449
- value = value.slice(0, i);
11450
- break;
11451
- }
11452
- }
11453
- }
11454
- }
11455
-
11456
- // If the fill character is not "0", grouping is applied before padding.
11457
- if (comma && !zero) value = group(value, Infinity);
11458
-
11459
- // Compute the padding.
11460
- var length = valuePrefix.length + value.length + valueSuffix.length,
11461
- padding = length < width ? new Array(width - length + 1).join(fill) : "";
11462
-
11463
- // If the fill character is "0", grouping is applied after padding.
11464
- if (comma && zero) value = group(padding + value, padding.length ? width - valueSuffix.length : Infinity), padding = "";
11465
-
11466
- // Reconstruct the final output based on the desired alignment.
11467
- switch (align) {
11468
- case "<": value = valuePrefix + value + valueSuffix + padding; break;
11469
- case "=": value = valuePrefix + padding + value + valueSuffix; break;
11470
- case "^": value = padding.slice(0, length = padding.length >> 1) + valuePrefix + value + valueSuffix + padding.slice(length); break;
11471
- default: value = padding + valuePrefix + value + valueSuffix; break;
11472
- }
11473
-
11474
- return numerals(value);
11475
- }
11476
-
11477
- format.toString = function() {
11478
- return specifier + "";
11479
- };
11480
-
11481
- return format;
11482
- }
11483
-
11484
- function formatPrefix(specifier, value) {
11485
- var f = newFormat((specifier = formatSpecifier(specifier), specifier.type = "f", specifier)),
11486
- e = Math.max(-8, Math.min(8, Math.floor(exponent(value) / 3))) * 3,
11487
- k = Math.pow(10, -e),
11488
- prefix = prefixes[8 + e / 3];
11489
- return function(value) {
11490
- return f(k * value) + prefix;
11491
- };
11492
- }
11493
-
11494
- return {
11495
- format: newFormat,
11496
- formatPrefix: formatPrefix
11497
- };
11498
- }
11499
-
11500
- var locale$1;
11501
-
11502
- defaultLocale$1({
11503
- thousands: ",",
11504
- grouping: [3],
11505
- currency: ["$", ""]
11506
- });
11507
-
11508
- function defaultLocale$1(definition) {
11509
- locale$1 = formatLocale$1(definition);
11510
- locale$1.format;
11511
- locale$1.formatPrefix;
11512
- return locale$1;
11513
- }
11514
-
11515
- var t0 = new Date,
11516
- t1 = new Date;
11517
-
11518
- function newInterval(floori, offseti, count, field) {
11519
-
11520
- function interval(date) {
11521
- return floori(date = arguments.length === 0 ? new Date : new Date(+date)), date;
11522
- }
11523
-
11524
- interval.floor = function(date) {
11525
- return floori(date = new Date(+date)), date;
11526
- };
11527
-
11528
- interval.ceil = function(date) {
11529
- return floori(date = new Date(date - 1)), offseti(date, 1), floori(date), date;
11530
- };
11531
-
11532
- interval.round = function(date) {
11533
- var d0 = interval(date),
11534
- d1 = interval.ceil(date);
11535
- return date - d0 < d1 - date ? d0 : d1;
11536
- };
11537
-
11538
- interval.offset = function(date, step) {
11539
- return offseti(date = new Date(+date), step == null ? 1 : Math.floor(step)), date;
11540
- };
11541
-
11542
- interval.range = function(start, stop, step) {
11543
- var range = [], previous;
11544
- start = interval.ceil(start);
11545
- step = step == null ? 1 : Math.floor(step);
11546
- if (!(start < stop) || !(step > 0)) return range; // also handles Invalid Date
11547
- do range.push(previous = new Date(+start)), offseti(start, step), floori(start);
11548
- while (previous < start && start < stop);
11549
- return range;
11550
- };
11551
-
11552
- interval.filter = function(test) {
11553
- return newInterval(function(date) {
11554
- if (date >= date) while (floori(date), !test(date)) date.setTime(date - 1);
11555
- }, function(date, step) {
11556
- if (date >= date) {
11557
- if (step < 0) while (++step <= 0) {
11558
- while (offseti(date, -1), !test(date)) {} // eslint-disable-line no-empty
11559
- } else while (--step >= 0) {
11560
- while (offseti(date, +1), !test(date)) {} // eslint-disable-line no-empty
11561
- }
11562
- }
11563
- });
11564
- };
11565
-
11566
- if (count) {
11567
- interval.count = function(start, end) {
11568
- t0.setTime(+start), t1.setTime(+end);
11569
- floori(t0), floori(t1);
11570
- return Math.floor(count(t0, t1));
11571
- };
11572
-
11573
- interval.every = function(step) {
11574
- step = Math.floor(step);
11575
- return !isFinite(step) || !(step > 0) ? null
11576
- : !(step > 1) ? interval
11577
- : interval.filter(field
11578
- ? function(d) { return field(d) % step === 0; }
11579
- : function(d) { return interval.count(0, d) % step === 0; });
11580
- };
11581
- }
11582
-
11583
- return interval;
11584
- }
11585
-
11586
- var millisecond = newInterval(function() {
11587
- // noop
11588
- }, function(date, step) {
11589
- date.setTime(+date + step);
11590
- }, function(start, end) {
11591
- return end - start;
11592
- });
11593
-
11594
- // An optimized implementation for this simple case.
11595
- millisecond.every = function(k) {
11596
- k = Math.floor(k);
11597
- if (!isFinite(k) || !(k > 0)) return null;
11598
- if (!(k > 1)) return millisecond;
11599
- return newInterval(function(date) {
11600
- date.setTime(Math.floor(date / k) * k);
11601
- }, function(date, step) {
11602
- date.setTime(+date + step * k);
11603
- }, function(start, end) {
11604
- return (end - start) / k;
11605
- });
11606
- };
11607
- millisecond.range;
11608
-
11609
- const durationSecond = 1000;
11610
- const durationMinute = durationSecond * 60;
11611
- const durationHour = durationMinute * 60;
11612
- const durationDay = durationHour * 24;
11613
- const durationWeek = durationDay * 7;
11614
-
11615
- var second = newInterval(function(date) {
11616
- date.setTime(date - date.getMilliseconds());
11617
- }, function(date, step) {
11618
- date.setTime(+date + step * durationSecond);
11619
- }, function(start, end) {
11620
- return (end - start) / durationSecond;
11621
- }, function(date) {
11622
- return date.getUTCSeconds();
11623
- });
11624
- second.range;
11625
-
11626
- var minute = newInterval(function(date) {
11627
- date.setTime(date - date.getMilliseconds() - date.getSeconds() * durationSecond);
11628
- }, function(date, step) {
11629
- date.setTime(+date + step * durationMinute);
11630
- }, function(start, end) {
11631
- return (end - start) / durationMinute;
11632
- }, function(date) {
11633
- return date.getMinutes();
11634
- });
11635
- minute.range;
11636
-
11637
- var hour = newInterval(function(date) {
11638
- date.setTime(date - date.getMilliseconds() - date.getSeconds() * durationSecond - date.getMinutes() * durationMinute);
11639
- }, function(date, step) {
11640
- date.setTime(+date + step * durationHour);
11641
- }, function(start, end) {
11642
- return (end - start) / durationHour;
11643
- }, function(date) {
11644
- return date.getHours();
11645
- });
11646
- hour.range;
11647
-
11648
- var day = newInterval(
11649
- date => date.setHours(0, 0, 0, 0),
11650
- (date, step) => date.setDate(date.getDate() + step),
11651
- (start, end) => (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * durationMinute) / durationDay,
11652
- date => date.getDate() - 1
11653
- );
11654
- day.range;
11655
-
11656
- function weekday(i) {
11657
- return newInterval(function(date) {
11658
- date.setDate(date.getDate() - (date.getDay() + 7 - i) % 7);
11659
- date.setHours(0, 0, 0, 0);
11660
- }, function(date, step) {
11661
- date.setDate(date.getDate() + step * 7);
11662
- }, function(start, end) {
11663
- return (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * durationMinute) / durationWeek;
11664
- });
11665
- }
11666
-
11667
- var sunday = weekday(0);
11668
- var monday = weekday(1);
11669
- var tuesday = weekday(2);
11670
- var wednesday = weekday(3);
11671
- var thursday = weekday(4);
11672
- var friday = weekday(5);
11673
- var saturday = weekday(6);
11674
-
11675
- sunday.range;
11676
- monday.range;
11677
- tuesday.range;
11678
- wednesday.range;
11679
- thursday.range;
11680
- friday.range;
11681
- saturday.range;
11682
-
11683
- var month = newInterval(function(date) {
11684
- date.setDate(1);
11685
- date.setHours(0, 0, 0, 0);
11686
- }, function(date, step) {
11687
- date.setMonth(date.getMonth() + step);
11688
- }, function(start, end) {
11689
- return end.getMonth() - start.getMonth() + (end.getFullYear() - start.getFullYear()) * 12;
11690
- }, function(date) {
11691
- return date.getMonth();
11692
- });
11693
- month.range;
11694
-
11695
- var year = newInterval(function(date) {
11696
- date.setMonth(0, 1);
11697
- date.setHours(0, 0, 0, 0);
11698
- }, function(date, step) {
11699
- date.setFullYear(date.getFullYear() + step);
11700
- }, function(start, end) {
11701
- return end.getFullYear() - start.getFullYear();
11702
- }, function(date) {
11703
- return date.getFullYear();
11704
- });
11705
-
11706
- // An optimized implementation for this simple case.
11707
- year.every = function(k) {
11708
- return !isFinite(k = Math.floor(k)) || !(k > 0) ? null : newInterval(function(date) {
11709
- date.setFullYear(Math.floor(date.getFullYear() / k) * k);
11710
- date.setMonth(0, 1);
11711
- date.setHours(0, 0, 0, 0);
11712
- }, function(date, step) {
11713
- date.setFullYear(date.getFullYear() + step * k);
11714
- });
11715
- };
11716
- year.range;
11717
-
11718
- var utcMinute = newInterval(function(date) {
11719
- date.setUTCSeconds(0, 0);
11720
- }, function(date, step) {
11721
- date.setTime(+date + step * durationMinute);
11722
- }, function(start, end) {
11723
- return (end - start) / durationMinute;
11724
- }, function(date) {
11725
- return date.getUTCMinutes();
11726
- });
11727
- utcMinute.range;
11728
-
11729
- var utcHour = newInterval(function(date) {
11730
- date.setUTCMinutes(0, 0, 0);
11731
- }, function(date, step) {
11732
- date.setTime(+date + step * durationHour);
11733
- }, function(start, end) {
11734
- return (end - start) / durationHour;
11735
- }, function(date) {
11736
- return date.getUTCHours();
11737
- });
11738
- utcHour.range;
11739
-
11740
- var utcDay = newInterval(function(date) {
11741
- date.setUTCHours(0, 0, 0, 0);
11742
- }, function(date, step) {
11743
- date.setUTCDate(date.getUTCDate() + step);
11744
- }, function(start, end) {
11745
- return (end - start) / durationDay;
11746
- }, function(date) {
11747
- return date.getUTCDate() - 1;
11748
- });
11749
- utcDay.range;
11750
-
11751
- function utcWeekday(i) {
11752
- return newInterval(function(date) {
11753
- date.setUTCDate(date.getUTCDate() - (date.getUTCDay() + 7 - i) % 7);
11754
- date.setUTCHours(0, 0, 0, 0);
11755
- }, function(date, step) {
11756
- date.setUTCDate(date.getUTCDate() + step * 7);
11757
- }, function(start, end) {
11758
- return (end - start) / durationWeek;
11759
- });
11760
- }
11761
-
11762
- var utcSunday = utcWeekday(0);
11763
- var utcMonday = utcWeekday(1);
11764
- var utcTuesday = utcWeekday(2);
11765
- var utcWednesday = utcWeekday(3);
11766
- var utcThursday = utcWeekday(4);
11767
- var utcFriday = utcWeekday(5);
11768
- var utcSaturday = utcWeekday(6);
11769
-
11770
- utcSunday.range;
11771
- utcMonday.range;
11772
- utcTuesday.range;
11773
- utcWednesday.range;
11774
- utcThursday.range;
11775
- utcFriday.range;
11776
- utcSaturday.range;
11777
-
11778
- var utcMonth = newInterval(function(date) {
11779
- date.setUTCDate(1);
11780
- date.setUTCHours(0, 0, 0, 0);
11781
- }, function(date, step) {
11782
- date.setUTCMonth(date.getUTCMonth() + step);
11783
- }, function(start, end) {
11784
- return end.getUTCMonth() - start.getUTCMonth() + (end.getUTCFullYear() - start.getUTCFullYear()) * 12;
11785
- }, function(date) {
11786
- return date.getUTCMonth();
11787
- });
11788
- utcMonth.range;
11789
-
11790
- var utcYear = newInterval(function(date) {
11791
- date.setUTCMonth(0, 1);
11792
- date.setUTCHours(0, 0, 0, 0);
11793
- }, function(date, step) {
11794
- date.setUTCFullYear(date.getUTCFullYear() + step);
11795
- }, function(start, end) {
11796
- return end.getUTCFullYear() - start.getUTCFullYear();
11797
- }, function(date) {
11798
- return date.getUTCFullYear();
11799
- });
11800
-
11801
- // An optimized implementation for this simple case.
11802
- utcYear.every = function(k) {
11803
- return !isFinite(k = Math.floor(k)) || !(k > 0) ? null : newInterval(function(date) {
11804
- date.setUTCFullYear(Math.floor(date.getUTCFullYear() / k) * k);
11805
- date.setUTCMonth(0, 1);
11806
- date.setUTCHours(0, 0, 0, 0);
11807
- }, function(date, step) {
11808
- date.setUTCFullYear(date.getUTCFullYear() + step * k);
11809
- });
11810
- };
11811
- utcYear.range;
11812
-
11813
- function localDate(d) {
11814
- if (0 <= d.y && d.y < 100) {
11815
- var date = new Date(-1, d.m, d.d, d.H, d.M, d.S, d.L);
11816
- date.setFullYear(d.y);
11817
- return date;
11818
- }
11819
- return new Date(d.y, d.m, d.d, d.H, d.M, d.S, d.L);
11820
- }
11821
-
11822
- function utcDate(d) {
11823
- if (0 <= d.y && d.y < 100) {
11824
- var date = new Date(Date.UTC(-1, d.m, d.d, d.H, d.M, d.S, d.L));
11825
- date.setUTCFullYear(d.y);
11826
- return date;
11827
- }
11828
- return new Date(Date.UTC(d.y, d.m, d.d, d.H, d.M, d.S, d.L));
11829
- }
11830
-
11831
- function newDate(y, m, d) {
11832
- return {y: y, m: m, d: d, H: 0, M: 0, S: 0, L: 0};
11833
- }
11834
-
11835
- function formatLocale(locale) {
11836
- var locale_dateTime = locale.dateTime,
11837
- locale_date = locale.date,
11838
- locale_time = locale.time,
11839
- locale_periods = locale.periods,
11840
- locale_weekdays = locale.days,
11841
- locale_shortWeekdays = locale.shortDays,
11842
- locale_months = locale.months,
11843
- locale_shortMonths = locale.shortMonths;
11844
-
11845
- var periodRe = formatRe(locale_periods),
11846
- periodLookup = formatLookup(locale_periods),
11847
- weekdayRe = formatRe(locale_weekdays),
11848
- weekdayLookup = formatLookup(locale_weekdays),
11849
- shortWeekdayRe = formatRe(locale_shortWeekdays),
11850
- shortWeekdayLookup = formatLookup(locale_shortWeekdays),
11851
- monthRe = formatRe(locale_months),
11852
- monthLookup = formatLookup(locale_months),
11853
- shortMonthRe = formatRe(locale_shortMonths),
11854
- shortMonthLookup = formatLookup(locale_shortMonths);
11855
-
11856
- var formats = {
11857
- "a": formatShortWeekday,
11858
- "A": formatWeekday,
11859
- "b": formatShortMonth,
11860
- "B": formatMonth,
11861
- "c": null,
11862
- "d": formatDayOfMonth,
11863
- "e": formatDayOfMonth,
11864
- "f": formatMicroseconds,
11865
- "g": formatYearISO,
11866
- "G": formatFullYearISO,
11867
- "H": formatHour24,
11868
- "I": formatHour12,
11869
- "j": formatDayOfYear,
11870
- "L": formatMilliseconds,
11871
- "m": formatMonthNumber,
11872
- "M": formatMinutes,
11873
- "p": formatPeriod,
11874
- "q": formatQuarter,
11875
- "Q": formatUnixTimestamp,
11876
- "s": formatUnixTimestampSeconds,
11877
- "S": formatSeconds,
11878
- "u": formatWeekdayNumberMonday,
11879
- "U": formatWeekNumberSunday,
11880
- "V": formatWeekNumberISO,
11881
- "w": formatWeekdayNumberSunday,
11882
- "W": formatWeekNumberMonday,
11883
- "x": null,
11884
- "X": null,
11885
- "y": formatYear,
11886
- "Y": formatFullYear,
11887
- "Z": formatZone,
11888
- "%": formatLiteralPercent
11889
- };
11890
-
11891
- var utcFormats = {
11892
- "a": formatUTCShortWeekday,
11893
- "A": formatUTCWeekday,
11894
- "b": formatUTCShortMonth,
11895
- "B": formatUTCMonth,
11896
- "c": null,
11897
- "d": formatUTCDayOfMonth,
11898
- "e": formatUTCDayOfMonth,
11899
- "f": formatUTCMicroseconds,
11900
- "g": formatUTCYearISO,
11901
- "G": formatUTCFullYearISO,
11902
- "H": formatUTCHour24,
11903
- "I": formatUTCHour12,
11904
- "j": formatUTCDayOfYear,
11905
- "L": formatUTCMilliseconds,
11906
- "m": formatUTCMonthNumber,
11907
- "M": formatUTCMinutes,
11908
- "p": formatUTCPeriod,
11909
- "q": formatUTCQuarter,
11910
- "Q": formatUnixTimestamp,
11911
- "s": formatUnixTimestampSeconds,
11912
- "S": formatUTCSeconds,
11913
- "u": formatUTCWeekdayNumberMonday,
11914
- "U": formatUTCWeekNumberSunday,
11915
- "V": formatUTCWeekNumberISO,
11916
- "w": formatUTCWeekdayNumberSunday,
11917
- "W": formatUTCWeekNumberMonday,
11918
- "x": null,
11919
- "X": null,
11920
- "y": formatUTCYear,
11921
- "Y": formatUTCFullYear,
11922
- "Z": formatUTCZone,
11923
- "%": formatLiteralPercent
11924
- };
11925
-
11926
- var parses = {
11927
- "a": parseShortWeekday,
11928
- "A": parseWeekday,
11929
- "b": parseShortMonth,
11930
- "B": parseMonth,
11931
- "c": parseLocaleDateTime,
11932
- "d": parseDayOfMonth,
11933
- "e": parseDayOfMonth,
11934
- "f": parseMicroseconds,
11935
- "g": parseYear,
11936
- "G": parseFullYear,
11937
- "H": parseHour24,
11938
- "I": parseHour24,
11939
- "j": parseDayOfYear,
11940
- "L": parseMilliseconds,
11941
- "m": parseMonthNumber,
11942
- "M": parseMinutes,
11943
- "p": parsePeriod,
11944
- "q": parseQuarter,
11945
- "Q": parseUnixTimestamp,
11946
- "s": parseUnixTimestampSeconds,
11947
- "S": parseSeconds,
11948
- "u": parseWeekdayNumberMonday,
11949
- "U": parseWeekNumberSunday,
11950
- "V": parseWeekNumberISO,
11951
- "w": parseWeekdayNumberSunday,
11952
- "W": parseWeekNumberMonday,
11953
- "x": parseLocaleDate,
11954
- "X": parseLocaleTime,
11955
- "y": parseYear,
11956
- "Y": parseFullYear,
11957
- "Z": parseZone,
11958
- "%": parseLiteralPercent
11959
- };
11960
-
11961
- // These recursive directive definitions must be deferred.
11962
- formats.x = newFormat(locale_date, formats);
11963
- formats.X = newFormat(locale_time, formats);
11964
- formats.c = newFormat(locale_dateTime, formats);
11965
- utcFormats.x = newFormat(locale_date, utcFormats);
11966
- utcFormats.X = newFormat(locale_time, utcFormats);
11967
- utcFormats.c = newFormat(locale_dateTime, utcFormats);
11968
-
11969
- function newFormat(specifier, formats) {
11970
- return function(date) {
11971
- var string = [],
11972
- i = -1,
11973
- j = 0,
11974
- n = specifier.length,
11975
- c,
11976
- pad,
11977
- format;
11978
-
11979
- if (!(date instanceof Date)) date = new Date(+date);
11980
-
11981
- while (++i < n) {
11982
- if (specifier.charCodeAt(i) === 37) {
11983
- string.push(specifier.slice(j, i));
11984
- if ((pad = pads[c = specifier.charAt(++i)]) != null) c = specifier.charAt(++i);
11985
- else pad = c === "e" ? " " : "0";
11986
- if (format = formats[c]) c = format(date, pad);
11987
- string.push(c);
11988
- j = i + 1;
11989
- }
11990
- }
11991
-
11992
- string.push(specifier.slice(j, i));
11993
- return string.join("");
11994
- };
11995
- }
11996
-
11997
- function newParse(specifier, Z) {
11998
- return function(string) {
11999
- var d = newDate(1900, undefined, 1),
12000
- i = parseSpecifier(d, specifier, string += "", 0),
12001
- week, day$1;
12002
- if (i != string.length) return null;
12003
-
12004
- // If a UNIX timestamp is specified, return it.
12005
- if ("Q" in d) return new Date(d.Q);
12006
- if ("s" in d) return new Date(d.s * 1000 + ("L" in d ? d.L : 0));
12007
-
12008
- // If this is utcParse, never use the local timezone.
12009
- if (Z && !("Z" in d)) d.Z = 0;
12010
-
12011
- // The am-pm flag is 0 for AM, and 1 for PM.
12012
- if ("p" in d) d.H = d.H % 12 + d.p * 12;
12013
-
12014
- // If the month was not specified, inherit from the quarter.
12015
- if (d.m === undefined) d.m = "q" in d ? d.q : 0;
12016
-
12017
- // Convert day-of-week and week-of-year to day-of-year.
12018
- if ("V" in d) {
12019
- if (d.V < 1 || d.V > 53) return null;
12020
- if (!("w" in d)) d.w = 1;
12021
- if ("Z" in d) {
12022
- week = utcDate(newDate(d.y, 0, 1)), day$1 = week.getUTCDay();
12023
- week = day$1 > 4 || day$1 === 0 ? utcMonday.ceil(week) : utcMonday(week);
12024
- week = utcDay.offset(week, (d.V - 1) * 7);
12025
- d.y = week.getUTCFullYear();
12026
- d.m = week.getUTCMonth();
12027
- d.d = week.getUTCDate() + (d.w + 6) % 7;
12028
- } else {
12029
- week = localDate(newDate(d.y, 0, 1)), day$1 = week.getDay();
12030
- week = day$1 > 4 || day$1 === 0 ? monday.ceil(week) : monday(week);
12031
- week = day.offset(week, (d.V - 1) * 7);
12032
- d.y = week.getFullYear();
12033
- d.m = week.getMonth();
12034
- d.d = week.getDate() + (d.w + 6) % 7;
12035
- }
12036
- } else if ("W" in d || "U" in d) {
12037
- if (!("w" in d)) d.w = "u" in d ? d.u % 7 : "W" in d ? 1 : 0;
12038
- day$1 = "Z" in d ? utcDate(newDate(d.y, 0, 1)).getUTCDay() : localDate(newDate(d.y, 0, 1)).getDay();
12039
- d.m = 0;
12040
- 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;
12041
- }
12042
-
12043
- // If a time zone is specified, all fields are interpreted as UTC and then
12044
- // offset according to the specified time zone.
12045
- if ("Z" in d) {
12046
- d.H += d.Z / 100 | 0;
12047
- d.M += d.Z % 100;
12048
- return utcDate(d);
12049
- }
12050
-
12051
- // Otherwise, all fields are in local time.
12052
- return localDate(d);
12053
- };
12054
- }
12055
-
12056
- function parseSpecifier(d, specifier, string, j) {
12057
- var i = 0,
12058
- n = specifier.length,
12059
- m = string.length,
12060
- c,
12061
- parse;
12062
-
12063
- while (i < n) {
12064
- if (j >= m) return -1;
12065
- c = specifier.charCodeAt(i++);
12066
- if (c === 37) {
12067
- c = specifier.charAt(i++);
12068
- parse = parses[c in pads ? specifier.charAt(i++) : c];
12069
- if (!parse || ((j = parse(d, string, j)) < 0)) return -1;
12070
- } else if (c != string.charCodeAt(j++)) {
12071
- return -1;
12072
- }
12073
- }
12074
-
12075
- return j;
12076
- }
12077
-
12078
- function parsePeriod(d, string, i) {
12079
- var n = periodRe.exec(string.slice(i));
12080
- return n ? (d.p = periodLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;
12081
- }
12082
-
12083
- function parseShortWeekday(d, string, i) {
12084
- var n = shortWeekdayRe.exec(string.slice(i));
12085
- return n ? (d.w = shortWeekdayLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;
12086
- }
12087
-
12088
- function parseWeekday(d, string, i) {
12089
- var n = weekdayRe.exec(string.slice(i));
12090
- return n ? (d.w = weekdayLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;
12091
- }
12092
-
12093
- function parseShortMonth(d, string, i) {
12094
- var n = shortMonthRe.exec(string.slice(i));
12095
- return n ? (d.m = shortMonthLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;
12096
- }
12097
-
12098
- function parseMonth(d, string, i) {
12099
- var n = monthRe.exec(string.slice(i));
12100
- return n ? (d.m = monthLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;
12101
- }
12102
-
12103
- function parseLocaleDateTime(d, string, i) {
12104
- return parseSpecifier(d, locale_dateTime, string, i);
12105
- }
12106
-
12107
- function parseLocaleDate(d, string, i) {
12108
- return parseSpecifier(d, locale_date, string, i);
12109
- }
12110
-
12111
- function parseLocaleTime(d, string, i) {
12112
- return parseSpecifier(d, locale_time, string, i);
12113
- }
12114
-
12115
- function formatShortWeekday(d) {
12116
- return locale_shortWeekdays[d.getDay()];
12117
- }
12118
-
12119
- function formatWeekday(d) {
12120
- return locale_weekdays[d.getDay()];
12121
- }
12122
-
12123
- function formatShortMonth(d) {
12124
- return locale_shortMonths[d.getMonth()];
12125
- }
12126
-
12127
- function formatMonth(d) {
12128
- return locale_months[d.getMonth()];
12129
- }
12130
-
12131
- function formatPeriod(d) {
12132
- return locale_periods[+(d.getHours() >= 12)];
12133
- }
12134
-
12135
- function formatQuarter(d) {
12136
- return 1 + ~~(d.getMonth() / 3);
12137
- }
12138
-
12139
- function formatUTCShortWeekday(d) {
12140
- return locale_shortWeekdays[d.getUTCDay()];
12141
- }
12142
-
12143
- function formatUTCWeekday(d) {
12144
- return locale_weekdays[d.getUTCDay()];
12145
- }
12146
-
12147
- function formatUTCShortMonth(d) {
12148
- return locale_shortMonths[d.getUTCMonth()];
12149
- }
12150
-
12151
- function formatUTCMonth(d) {
12152
- return locale_months[d.getUTCMonth()];
12153
- }
12154
-
12155
- function formatUTCPeriod(d) {
12156
- return locale_periods[+(d.getUTCHours() >= 12)];
12157
- }
12158
-
12159
- function formatUTCQuarter(d) {
12160
- return 1 + ~~(d.getUTCMonth() / 3);
12161
- }
12162
-
12163
- return {
12164
- format: function(specifier) {
12165
- var f = newFormat(specifier += "", formats);
12166
- f.toString = function() { return specifier; };
12167
- return f;
12168
- },
12169
- parse: function(specifier) {
12170
- var p = newParse(specifier += "", false);
12171
- p.toString = function() { return specifier; };
12172
- return p;
12173
- },
12174
- utcFormat: function(specifier) {
12175
- var f = newFormat(specifier += "", utcFormats);
12176
- f.toString = function() { return specifier; };
12177
- return f;
12178
- },
12179
- utcParse: function(specifier) {
12180
- var p = newParse(specifier += "", true);
12181
- p.toString = function() { return specifier; };
12182
- return p;
12183
- }
12184
- };
12185
- }
12186
-
12187
- var pads = {"-": "", "_": " ", "0": "0"},
12188
- numberRe = /^\s*\d+/, // note: ignores next directive
12189
- percentRe = /^%/,
12190
- requoteRe = /[\\^$*+?|[\]().{}]/g;
12191
-
12192
- function pad(value, fill, width) {
12193
- var sign = value < 0 ? "-" : "",
12194
- string = (sign ? -value : value) + "",
12195
- length = string.length;
12196
- return sign + (length < width ? new Array(width - length + 1).join(fill) + string : string);
12197
- }
12198
-
12199
- function requote(s) {
12200
- return s.replace(requoteRe, "\\$&");
12201
- }
12202
-
12203
- function formatRe(names) {
12204
- return new RegExp("^(?:" + names.map(requote).join("|") + ")", "i");
12205
- }
12206
-
12207
- function formatLookup(names) {
12208
- return new Map(names.map((name, i) => [name.toLowerCase(), i]));
12209
- }
12210
-
12211
- function parseWeekdayNumberSunday(d, string, i) {
12212
- var n = numberRe.exec(string.slice(i, i + 1));
12213
- return n ? (d.w = +n[0], i + n[0].length) : -1;
12214
- }
12215
-
12216
- function parseWeekdayNumberMonday(d, string, i) {
12217
- var n = numberRe.exec(string.slice(i, i + 1));
12218
- return n ? (d.u = +n[0], i + n[0].length) : -1;
12219
- }
12220
-
12221
- function parseWeekNumberSunday(d, string, i) {
12222
- var n = numberRe.exec(string.slice(i, i + 2));
12223
- return n ? (d.U = +n[0], i + n[0].length) : -1;
12224
- }
12225
-
12226
- function parseWeekNumberISO(d, string, i) {
12227
- var n = numberRe.exec(string.slice(i, i + 2));
12228
- return n ? (d.V = +n[0], i + n[0].length) : -1;
12229
- }
12230
-
12231
- function parseWeekNumberMonday(d, string, i) {
12232
- var n = numberRe.exec(string.slice(i, i + 2));
12233
- return n ? (d.W = +n[0], i + n[0].length) : -1;
12234
- }
12235
-
12236
- function parseFullYear(d, string, i) {
12237
- var n = numberRe.exec(string.slice(i, i + 4));
12238
- return n ? (d.y = +n[0], i + n[0].length) : -1;
12239
- }
12240
-
12241
- function parseYear(d, string, i) {
12242
- var n = numberRe.exec(string.slice(i, i + 2));
12243
- return n ? (d.y = +n[0] + (+n[0] > 68 ? 1900 : 2000), i + n[0].length) : -1;
12244
- }
12245
-
12246
- function parseZone(d, string, i) {
12247
- var n = /^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(string.slice(i, i + 6));
12248
- return n ? (d.Z = n[1] ? 0 : -(n[2] + (n[3] || "00")), i + n[0].length) : -1;
12249
- }
12250
-
12251
- function parseQuarter(d, string, i) {
12252
- var n = numberRe.exec(string.slice(i, i + 1));
12253
- return n ? (d.q = n[0] * 3 - 3, i + n[0].length) : -1;
12254
- }
12255
-
12256
- function parseMonthNumber(d, string, i) {
12257
- var n = numberRe.exec(string.slice(i, i + 2));
12258
- return n ? (d.m = n[0] - 1, i + n[0].length) : -1;
12259
- }
12260
-
12261
- function parseDayOfMonth(d, string, i) {
12262
- var n = numberRe.exec(string.slice(i, i + 2));
12263
- return n ? (d.d = +n[0], i + n[0].length) : -1;
12264
- }
12265
-
12266
- function parseDayOfYear(d, string, i) {
12267
- var n = numberRe.exec(string.slice(i, i + 3));
12268
- return n ? (d.m = 0, d.d = +n[0], i + n[0].length) : -1;
12269
- }
12270
-
12271
- function parseHour24(d, string, i) {
12272
- var n = numberRe.exec(string.slice(i, i + 2));
12273
- return n ? (d.H = +n[0], i + n[0].length) : -1;
12274
- }
12275
-
12276
- function parseMinutes(d, string, i) {
12277
- var n = numberRe.exec(string.slice(i, i + 2));
12278
- return n ? (d.M = +n[0], i + n[0].length) : -1;
12279
- }
12280
-
12281
- function parseSeconds(d, string, i) {
12282
- var n = numberRe.exec(string.slice(i, i + 2));
12283
- return n ? (d.S = +n[0], i + n[0].length) : -1;
12284
- }
12285
-
12286
- function parseMilliseconds(d, string, i) {
12287
- var n = numberRe.exec(string.slice(i, i + 3));
12288
- return n ? (d.L = +n[0], i + n[0].length) : -1;
12289
- }
12290
-
12291
- function parseMicroseconds(d, string, i) {
12292
- var n = numberRe.exec(string.slice(i, i + 6));
12293
- return n ? (d.L = Math.floor(n[0] / 1000), i + n[0].length) : -1;
12294
- }
12295
-
12296
- function parseLiteralPercent(d, string, i) {
12297
- var n = percentRe.exec(string.slice(i, i + 1));
12298
- return n ? i + n[0].length : -1;
12299
- }
12300
-
12301
- function parseUnixTimestamp(d, string, i) {
12302
- var n = numberRe.exec(string.slice(i));
12303
- return n ? (d.Q = +n[0], i + n[0].length) : -1;
12304
- }
12305
-
12306
- function parseUnixTimestampSeconds(d, string, i) {
12307
- var n = numberRe.exec(string.slice(i));
12308
- return n ? (d.s = +n[0], i + n[0].length) : -1;
12309
- }
12310
-
12311
- function formatDayOfMonth(d, p) {
12312
- return pad(d.getDate(), p, 2);
12313
- }
12314
-
12315
- function formatHour24(d, p) {
12316
- return pad(d.getHours(), p, 2);
12317
- }
12318
-
12319
- function formatHour12(d, p) {
12320
- return pad(d.getHours() % 12 || 12, p, 2);
12321
- }
12322
-
12323
- function formatDayOfYear(d, p) {
12324
- return pad(1 + day.count(year(d), d), p, 3);
12325
- }
12326
-
12327
- function formatMilliseconds(d, p) {
12328
- return pad(d.getMilliseconds(), p, 3);
12329
- }
12330
-
12331
- function formatMicroseconds(d, p) {
12332
- return formatMilliseconds(d, p) + "000";
12333
- }
12334
-
12335
- function formatMonthNumber(d, p) {
12336
- return pad(d.getMonth() + 1, p, 2);
12337
- }
12338
-
12339
- function formatMinutes(d, p) {
12340
- return pad(d.getMinutes(), p, 2);
12341
- }
12342
-
12343
- function formatSeconds(d, p) {
12344
- return pad(d.getSeconds(), p, 2);
12345
- }
12346
-
12347
- function formatWeekdayNumberMonday(d) {
12348
- var day = d.getDay();
12349
- return day === 0 ? 7 : day;
12350
- }
12351
-
12352
- function formatWeekNumberSunday(d, p) {
12353
- return pad(sunday.count(year(d) - 1, d), p, 2);
12354
- }
12355
-
12356
- function dISO(d) {
12357
- var day = d.getDay();
12358
- return (day >= 4 || day === 0) ? thursday(d) : thursday.ceil(d);
12359
- }
12360
-
12361
- function formatWeekNumberISO(d, p) {
12362
- d = dISO(d);
12363
- return pad(thursday.count(year(d), d) + (year(d).getDay() === 4), p, 2);
12364
- }
12365
-
12366
- function formatWeekdayNumberSunday(d) {
12367
- return d.getDay();
12368
- }
12369
-
12370
- function formatWeekNumberMonday(d, p) {
12371
- return pad(monday.count(year(d) - 1, d), p, 2);
12372
- }
12373
-
12374
- function formatYear(d, p) {
12375
- return pad(d.getFullYear() % 100, p, 2);
12376
- }
12377
-
12378
- function formatYearISO(d, p) {
12379
- d = dISO(d);
12380
- return pad(d.getFullYear() % 100, p, 2);
12381
- }
12382
-
12383
- function formatFullYear(d, p) {
12384
- return pad(d.getFullYear() % 10000, p, 4);
12385
- }
12386
-
12387
- function formatFullYearISO(d, p) {
12388
- var day = d.getDay();
12389
- d = (day >= 4 || day === 0) ? thursday(d) : thursday.ceil(d);
12390
- return pad(d.getFullYear() % 10000, p, 4);
12391
- }
12392
-
12393
- function formatZone(d) {
12394
- var z = d.getTimezoneOffset();
12395
- return (z > 0 ? "-" : (z *= -1, "+"))
12396
- + pad(z / 60 | 0, "0", 2)
12397
- + pad(z % 60, "0", 2);
12398
- }
12399
-
12400
- function formatUTCDayOfMonth(d, p) {
12401
- return pad(d.getUTCDate(), p, 2);
12402
- }
12403
-
12404
- function formatUTCHour24(d, p) {
12405
- return pad(d.getUTCHours(), p, 2);
12406
- }
12407
-
12408
- function formatUTCHour12(d, p) {
12409
- return pad(d.getUTCHours() % 12 || 12, p, 2);
12410
- }
12411
-
12412
- function formatUTCDayOfYear(d, p) {
12413
- return pad(1 + utcDay.count(utcYear(d), d), p, 3);
12414
- }
12415
-
12416
- function formatUTCMilliseconds(d, p) {
12417
- return pad(d.getUTCMilliseconds(), p, 3);
12418
- }
12419
-
12420
- function formatUTCMicroseconds(d, p) {
12421
- return formatUTCMilliseconds(d, p) + "000";
12422
- }
12423
-
12424
- function formatUTCMonthNumber(d, p) {
12425
- return pad(d.getUTCMonth() + 1, p, 2);
12426
- }
12427
-
12428
- function formatUTCMinutes(d, p) {
12429
- return pad(d.getUTCMinutes(), p, 2);
12430
- }
12431
-
12432
- function formatUTCSeconds(d, p) {
12433
- return pad(d.getUTCSeconds(), p, 2);
12434
- }
12435
-
12436
- function formatUTCWeekdayNumberMonday(d) {
12437
- var dow = d.getUTCDay();
12438
- return dow === 0 ? 7 : dow;
12439
- }
12440
-
12441
- function formatUTCWeekNumberSunday(d, p) {
12442
- return pad(utcSunday.count(utcYear(d) - 1, d), p, 2);
12443
- }
12444
-
12445
- function UTCdISO(d) {
12446
- var day = d.getUTCDay();
12447
- return (day >= 4 || day === 0) ? utcThursday(d) : utcThursday.ceil(d);
12448
- }
12449
-
12450
- function formatUTCWeekNumberISO(d, p) {
12451
- d = UTCdISO(d);
12452
- return pad(utcThursday.count(utcYear(d), d) + (utcYear(d).getUTCDay() === 4), p, 2);
12453
- }
12454
-
12455
- function formatUTCWeekdayNumberSunday(d) {
12456
- return d.getUTCDay();
12457
- }
12458
-
12459
- function formatUTCWeekNumberMonday(d, p) {
12460
- return pad(utcMonday.count(utcYear(d) - 1, d), p, 2);
12461
- }
12462
-
12463
- function formatUTCYear(d, p) {
12464
- return pad(d.getUTCFullYear() % 100, p, 2);
12465
- }
12466
-
12467
- function formatUTCYearISO(d, p) {
12468
- d = UTCdISO(d);
12469
- return pad(d.getUTCFullYear() % 100, p, 2);
12470
- }
12471
-
12472
- function formatUTCFullYear(d, p) {
12473
- return pad(d.getUTCFullYear() % 10000, p, 4);
12474
- }
12475
-
12476
- function formatUTCFullYearISO(d, p) {
12477
- var day = d.getUTCDay();
12478
- d = (day >= 4 || day === 0) ? utcThursday(d) : utcThursday.ceil(d);
12479
- return pad(d.getUTCFullYear() % 10000, p, 4);
12480
- }
12481
-
12482
- function formatUTCZone() {
12483
- return "+0000";
12484
- }
12485
-
12486
- function formatLiteralPercent() {
12487
- return "%";
12488
- }
12489
-
12490
- function formatUnixTimestamp(d) {
12491
- return +d;
12492
- }
12493
-
12494
- function formatUnixTimestampSeconds(d) {
12495
- return Math.floor(+d / 1000);
12496
- }
12497
-
12498
- var locale;
12499
- var utcFormat;
12500
- var utcParse;
12501
-
12502
- defaultLocale({
12503
- dateTime: "%x, %X",
12504
- date: "%-m/%-d/%Y",
12505
- time: "%-I:%M:%S %p",
12506
- periods: ["AM", "PM"],
12507
- days: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
12508
- shortDays: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
12509
- months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
12510
- shortMonths: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
12511
- });
12512
-
12513
- function defaultLocale(definition) {
12514
- locale = formatLocale(definition);
12515
- locale.format;
12516
- locale.parse;
12517
- utcFormat = locale.utcFormat;
12518
- utcParse = locale.utcParse;
12519
- return locale;
12520
- }
12521
-
12522
- var isoSpecifier = "%Y-%m-%dT%H:%M:%S.%LZ";
12523
-
12524
- function formatIsoNative(date) {
12525
- return date.toISOString();
12526
- }
12527
-
12528
- Date.prototype.toISOString
12529
- ? formatIsoNative
12530
- : utcFormat(isoSpecifier);
12531
-
12532
- function parseIsoNative(string) {
12533
- var date = new Date(string);
12534
- return isNaN(date) ? null : date;
12535
- }
12536
-
12537
- +new Date("2000-01-01T00:00:00.000Z")
12538
- ? parseIsoNative
12539
- : utcParse(isoSpecifier);
12540
-
12541
- function colors(specifier) {
12542
- var n = specifier.length / 6 | 0, colors = new Array(n), i = 0;
12543
- while (i < n) colors[i] = "#" + specifier.slice(i * 6, ++i * 6);
12544
- return colors;
12545
- }
12546
-
12547
- colors("1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf");
12548
-
12549
- colors("7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666");
12550
-
12551
- colors("1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666");
12552
-
12553
- var schemePaired = colors("a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928");
12554
-
12555
- colors("fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2");
12556
-
12557
- colors("b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc");
12558
-
12559
- colors("e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999");
12560
-
12561
- colors("66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3");
12562
-
12563
- colors("8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f");
12564
-
12565
- colors("4e79a7f28e2ce1575976b7b259a14fedc949af7aa1ff9da79c755fbab0ab");
12566
-
12567
- var ramp$1 = scheme => rgbBasis(scheme[scheme.length - 1]);
12568
-
12569
- var scheme$q = new Array(3).concat(
12570
- "d8b365f5f5f55ab4ac",
12571
- "a6611adfc27d80cdc1018571",
12572
- "a6611adfc27df5f5f580cdc1018571",
12573
- "8c510ad8b365f6e8c3c7eae55ab4ac01665e",
12574
- "8c510ad8b365f6e8c3f5f5f5c7eae55ab4ac01665e",
12575
- "8c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e",
12576
- "8c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e",
12577
- "5430058c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e003c30",
12578
- "5430058c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e003c30"
12579
- ).map(colors);
12580
-
12581
- ramp$1(scheme$q);
12582
-
12583
- var scheme$p = new Array(3).concat(
12584
- "af8dc3f7f7f77fbf7b",
12585
- "7b3294c2a5cfa6dba0008837",
12586
- "7b3294c2a5cff7f7f7a6dba0008837",
12587
- "762a83af8dc3e7d4e8d9f0d37fbf7b1b7837",
12588
- "762a83af8dc3e7d4e8f7f7f7d9f0d37fbf7b1b7837",
12589
- "762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b7837",
12590
- "762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b7837",
12591
- "40004b762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b783700441b",
12592
- "40004b762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b783700441b"
12593
- ).map(colors);
12594
-
12595
- ramp$1(scheme$p);
12596
-
12597
- var scheme$o = new Array(3).concat(
12598
- "e9a3c9f7f7f7a1d76a",
12599
- "d01c8bf1b6dab8e1864dac26",
12600
- "d01c8bf1b6daf7f7f7b8e1864dac26",
12601
- "c51b7de9a3c9fde0efe6f5d0a1d76a4d9221",
12602
- "c51b7de9a3c9fde0eff7f7f7e6f5d0a1d76a4d9221",
12603
- "c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221",
12604
- "c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221",
12605
- "8e0152c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221276419",
12606
- "8e0152c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221276419"
12607
- ).map(colors);
12608
-
12609
- ramp$1(scheme$o);
12610
-
12611
- var scheme$n = new Array(3).concat(
12612
- "998ec3f7f7f7f1a340",
12613
- "5e3c99b2abd2fdb863e66101",
12614
- "5e3c99b2abd2f7f7f7fdb863e66101",
12615
- "542788998ec3d8daebfee0b6f1a340b35806",
12616
- "542788998ec3d8daebf7f7f7fee0b6f1a340b35806",
12617
- "5427888073acb2abd2d8daebfee0b6fdb863e08214b35806",
12618
- "5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b35806",
12619
- "2d004b5427888073acb2abd2d8daebfee0b6fdb863e08214b358067f3b08",
12620
- "2d004b5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b358067f3b08"
12621
- ).map(colors);
12622
-
12623
- ramp$1(scheme$n);
12624
-
12625
- var scheme$m = new Array(3).concat(
12626
- "ef8a62f7f7f767a9cf",
12627
- "ca0020f4a58292c5de0571b0",
12628
- "ca0020f4a582f7f7f792c5de0571b0",
12629
- "b2182bef8a62fddbc7d1e5f067a9cf2166ac",
12630
- "b2182bef8a62fddbc7f7f7f7d1e5f067a9cf2166ac",
12631
- "b2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac",
12632
- "b2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac",
12633
- "67001fb2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac053061",
12634
- "67001fb2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac053061"
12635
- ).map(colors);
12636
-
12637
- ramp$1(scheme$m);
12638
-
12639
- var scheme$l = new Array(3).concat(
12640
- "ef8a62ffffff999999",
12641
- "ca0020f4a582bababa404040",
12642
- "ca0020f4a582ffffffbababa404040",
12643
- "b2182bef8a62fddbc7e0e0e09999994d4d4d",
12644
- "b2182bef8a62fddbc7ffffffe0e0e09999994d4d4d",
12645
- "b2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d",
12646
- "b2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d",
12647
- "67001fb2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d1a1a1a",
12648
- "67001fb2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d1a1a1a"
12649
- ).map(colors);
12650
-
12651
- ramp$1(scheme$l);
12652
-
12653
- var scheme$k = new Array(3).concat(
12654
- "fc8d59ffffbf91bfdb",
12655
- "d7191cfdae61abd9e92c7bb6",
12656
- "d7191cfdae61ffffbfabd9e92c7bb6",
12657
- "d73027fc8d59fee090e0f3f891bfdb4575b4",
12658
- "d73027fc8d59fee090ffffbfe0f3f891bfdb4575b4",
12659
- "d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4",
12660
- "d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4",
12661
- "a50026d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4313695",
12662
- "a50026d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4313695"
12663
- ).map(colors);
12664
-
12665
- ramp$1(scheme$k);
12666
-
12667
- var scheme$j = new Array(3).concat(
12668
- "fc8d59ffffbf91cf60",
12669
- "d7191cfdae61a6d96a1a9641",
12670
- "d7191cfdae61ffffbfa6d96a1a9641",
12671
- "d73027fc8d59fee08bd9ef8b91cf601a9850",
12672
- "d73027fc8d59fee08bffffbfd9ef8b91cf601a9850",
12673
- "d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850",
12674
- "d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850",
12675
- "a50026d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850006837",
12676
- "a50026d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850006837"
12677
- ).map(colors);
12678
-
12679
- ramp$1(scheme$j);
12680
-
12681
- var scheme$i = new Array(3).concat(
12682
- "fc8d59ffffbf99d594",
12683
- "d7191cfdae61abdda42b83ba",
12684
- "d7191cfdae61ffffbfabdda42b83ba",
12685
- "d53e4ffc8d59fee08be6f59899d5943288bd",
12686
- "d53e4ffc8d59fee08bffffbfe6f59899d5943288bd",
12687
- "d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd",
12688
- "d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd",
12689
- "9e0142d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd5e4fa2",
12690
- "9e0142d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd5e4fa2"
12691
- ).map(colors);
12692
-
12693
- ramp$1(scheme$i);
12694
-
12695
- var scheme$h = new Array(3).concat(
12696
- "e5f5f999d8c92ca25f",
12697
- "edf8fbb2e2e266c2a4238b45",
12698
- "edf8fbb2e2e266c2a42ca25f006d2c",
12699
- "edf8fbccece699d8c966c2a42ca25f006d2c",
12700
- "edf8fbccece699d8c966c2a441ae76238b45005824",
12701
- "f7fcfde5f5f9ccece699d8c966c2a441ae76238b45005824",
12702
- "f7fcfde5f5f9ccece699d8c966c2a441ae76238b45006d2c00441b"
12703
- ).map(colors);
12704
-
12705
- ramp$1(scheme$h);
12706
-
12707
- var scheme$g = new Array(3).concat(
12708
- "e0ecf49ebcda8856a7",
12709
- "edf8fbb3cde38c96c688419d",
12710
- "edf8fbb3cde38c96c68856a7810f7c",
12711
- "edf8fbbfd3e69ebcda8c96c68856a7810f7c",
12712
- "edf8fbbfd3e69ebcda8c96c68c6bb188419d6e016b",
12713
- "f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d6e016b",
12714
- "f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d810f7c4d004b"
12715
- ).map(colors);
12716
-
12717
- ramp$1(scheme$g);
12718
-
12719
- var scheme$f = new Array(3).concat(
12720
- "e0f3dba8ddb543a2ca",
12721
- "f0f9e8bae4bc7bccc42b8cbe",
12722
- "f0f9e8bae4bc7bccc443a2ca0868ac",
12723
- "f0f9e8ccebc5a8ddb57bccc443a2ca0868ac",
12724
- "f0f9e8ccebc5a8ddb57bccc44eb3d32b8cbe08589e",
12725
- "f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe08589e",
12726
- "f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe0868ac084081"
12727
- ).map(colors);
12728
-
12729
- ramp$1(scheme$f);
12730
-
12731
- var scheme$e = new Array(3).concat(
12732
- "fee8c8fdbb84e34a33",
12733
- "fef0d9fdcc8afc8d59d7301f",
12734
- "fef0d9fdcc8afc8d59e34a33b30000",
12735
- "fef0d9fdd49efdbb84fc8d59e34a33b30000",
12736
- "fef0d9fdd49efdbb84fc8d59ef6548d7301f990000",
12737
- "fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301f990000",
12738
- "fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301fb300007f0000"
12739
- ).map(colors);
12740
-
12741
- ramp$1(scheme$e);
12742
-
12743
- var scheme$d = new Array(3).concat(
12744
- "ece2f0a6bddb1c9099",
12745
- "f6eff7bdc9e167a9cf02818a",
12746
- "f6eff7bdc9e167a9cf1c9099016c59",
12747
- "f6eff7d0d1e6a6bddb67a9cf1c9099016c59",
12748
- "f6eff7d0d1e6a6bddb67a9cf3690c002818a016450",
12749
- "fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016450",
12750
- "fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016c59014636"
12751
- ).map(colors);
12752
-
12753
- ramp$1(scheme$d);
12754
-
12755
- var scheme$c = new Array(3).concat(
12756
- "ece7f2a6bddb2b8cbe",
12757
- "f1eef6bdc9e174a9cf0570b0",
12758
- "f1eef6bdc9e174a9cf2b8cbe045a8d",
12759
- "f1eef6d0d1e6a6bddb74a9cf2b8cbe045a8d",
12760
- "f1eef6d0d1e6a6bddb74a9cf3690c00570b0034e7b",
12761
- "fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0034e7b",
12762
- "fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0045a8d023858"
12763
- ).map(colors);
12764
-
12765
- ramp$1(scheme$c);
12766
-
12767
- var scheme$b = new Array(3).concat(
12768
- "e7e1efc994c7dd1c77",
12769
- "f1eef6d7b5d8df65b0ce1256",
12770
- "f1eef6d7b5d8df65b0dd1c77980043",
12771
- "f1eef6d4b9dac994c7df65b0dd1c77980043",
12772
- "f1eef6d4b9dac994c7df65b0e7298ace125691003f",
12773
- "f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125691003f",
12774
- "f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125698004367001f"
12775
- ).map(colors);
12776
-
12777
- ramp$1(scheme$b);
12778
-
12779
- var scheme$a = new Array(3).concat(
12780
- "fde0ddfa9fb5c51b8a",
12781
- "feebe2fbb4b9f768a1ae017e",
12782
- "feebe2fbb4b9f768a1c51b8a7a0177",
12783
- "feebe2fcc5c0fa9fb5f768a1c51b8a7a0177",
12784
- "feebe2fcc5c0fa9fb5f768a1dd3497ae017e7a0177",
12785
- "fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a0177",
12786
- "fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a017749006a"
12787
- ).map(colors);
12788
-
12789
- ramp$1(scheme$a);
12790
-
12791
- var scheme$9 = new Array(3).concat(
12792
- "edf8b17fcdbb2c7fb8",
12793
- "ffffcca1dab441b6c4225ea8",
12794
- "ffffcca1dab441b6c42c7fb8253494",
12795
- "ffffccc7e9b47fcdbb41b6c42c7fb8253494",
12796
- "ffffccc7e9b47fcdbb41b6c41d91c0225ea80c2c84",
12797
- "ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea80c2c84",
12798
- "ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea8253494081d58"
12799
- ).map(colors);
12800
-
12801
- ramp$1(scheme$9);
12802
-
12803
- var scheme$8 = new Array(3).concat(
12804
- "f7fcb9addd8e31a354",
12805
- "ffffccc2e69978c679238443",
12806
- "ffffccc2e69978c67931a354006837",
12807
- "ffffccd9f0a3addd8e78c67931a354006837",
12808
- "ffffccd9f0a3addd8e78c67941ab5d238443005a32",
12809
- "ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443005a32",
12810
- "ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443006837004529"
12811
- ).map(colors);
12812
-
12813
- ramp$1(scheme$8);
12814
-
12815
- var scheme$7 = new Array(3).concat(
12816
- "fff7bcfec44fd95f0e",
12817
- "ffffd4fed98efe9929cc4c02",
12818
- "ffffd4fed98efe9929d95f0e993404",
12819
- "ffffd4fee391fec44ffe9929d95f0e993404",
12820
- "ffffd4fee391fec44ffe9929ec7014cc4c028c2d04",
12821
- "ffffe5fff7bcfee391fec44ffe9929ec7014cc4c028c2d04",
12822
- "ffffe5fff7bcfee391fec44ffe9929ec7014cc4c02993404662506"
12823
- ).map(colors);
12824
-
12825
- ramp$1(scheme$7);
12826
-
12827
- var scheme$6 = new Array(3).concat(
12828
- "ffeda0feb24cf03b20",
12829
- "ffffb2fecc5cfd8d3ce31a1c",
12830
- "ffffb2fecc5cfd8d3cf03b20bd0026",
12831
- "ffffb2fed976feb24cfd8d3cf03b20bd0026",
12832
- "ffffb2fed976feb24cfd8d3cfc4e2ae31a1cb10026",
12833
- "ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cb10026",
12834
- "ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cbd0026800026"
12835
- ).map(colors);
12836
-
12837
- ramp$1(scheme$6);
12838
-
12839
- var scheme$5 = new Array(3).concat(
12840
- "deebf79ecae13182bd",
12841
- "eff3ffbdd7e76baed62171b5",
12842
- "eff3ffbdd7e76baed63182bd08519c",
12843
- "eff3ffc6dbef9ecae16baed63182bd08519c",
12844
- "eff3ffc6dbef9ecae16baed64292c62171b5084594",
12845
- "f7fbffdeebf7c6dbef9ecae16baed64292c62171b5084594",
12846
- "f7fbffdeebf7c6dbef9ecae16baed64292c62171b508519c08306b"
12847
- ).map(colors);
12848
-
12849
- ramp$1(scheme$5);
12850
-
12851
- var scheme$4 = new Array(3).concat(
12852
- "e5f5e0a1d99b31a354",
12853
- "edf8e9bae4b374c476238b45",
12854
- "edf8e9bae4b374c47631a354006d2c",
12855
- "edf8e9c7e9c0a1d99b74c47631a354006d2c",
12856
- "edf8e9c7e9c0a1d99b74c47641ab5d238b45005a32",
12857
- "f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45005a32",
12858
- "f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45006d2c00441b"
12859
- ).map(colors);
12860
-
12861
- ramp$1(scheme$4);
12862
-
12863
- var scheme$3 = new Array(3).concat(
12864
- "f0f0f0bdbdbd636363",
12865
- "f7f7f7cccccc969696525252",
12866
- "f7f7f7cccccc969696636363252525",
12867
- "f7f7f7d9d9d9bdbdbd969696636363252525",
12868
- "f7f7f7d9d9d9bdbdbd969696737373525252252525",
12869
- "fffffff0f0f0d9d9d9bdbdbd969696737373525252252525",
12870
- "fffffff0f0f0d9d9d9bdbdbd969696737373525252252525000000"
12871
- ).map(colors);
12872
-
12873
- ramp$1(scheme$3);
12874
-
12875
- var scheme$2 = new Array(3).concat(
12876
- "efedf5bcbddc756bb1",
12877
- "f2f0f7cbc9e29e9ac86a51a3",
12878
- "f2f0f7cbc9e29e9ac8756bb154278f",
12879
- "f2f0f7dadaebbcbddc9e9ac8756bb154278f",
12880
- "f2f0f7dadaebbcbddc9e9ac8807dba6a51a34a1486",
12881
- "fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a34a1486",
12882
- "fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a354278f3f007d"
12883
- ).map(colors);
12884
-
12885
- ramp$1(scheme$2);
12886
-
12887
- var scheme$1 = new Array(3).concat(
12888
- "fee0d2fc9272de2d26",
12889
- "fee5d9fcae91fb6a4acb181d",
12890
- "fee5d9fcae91fb6a4ade2d26a50f15",
12891
- "fee5d9fcbba1fc9272fb6a4ade2d26a50f15",
12892
- "fee5d9fcbba1fc9272fb6a4aef3b2ccb181d99000d",
12893
- "fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181d99000d",
12894
- "fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181da50f1567000d"
12895
- ).map(colors);
12896
-
12897
- ramp$1(scheme$1);
12898
-
12899
- var scheme = new Array(3).concat(
12900
- "fee6cefdae6be6550d",
12901
- "feeddefdbe85fd8d3cd94701",
12902
- "feeddefdbe85fd8d3ce6550da63603",
12903
- "feeddefdd0a2fdae6bfd8d3ce6550da63603",
12904
- "feeddefdd0a2fdae6bfd8d3cf16913d948018c2d04",
12905
- "fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d948018c2d04",
12906
- "fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d94801a636037f2704"
12907
- ).map(colors);
12908
-
12909
- ramp$1(scheme);
12910
-
12911
- cubehelixLong(cubehelix$1(300, 0.5, 0.0), cubehelix$1(-240, 0.5, 1.0));
12912
-
12913
- cubehelixLong(cubehelix$1(-100, 0.75, 0.35), cubehelix$1(80, 1.50, 0.8));
12914
-
12915
- cubehelixLong(cubehelix$1(260, 0.75, 0.35), cubehelix$1(80, 1.50, 0.8));
12916
-
12917
- cubehelix$1();
12918
-
12919
- rgb();
12920
-
12921
- function ramp(range) {
12922
- var n = range.length;
12923
- return function(t) {
12924
- return range[Math.max(0, Math.min(n - 1, Math.floor(t * n)))];
12925
- };
12926
- }
12927
-
12928
- ramp(colors("44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725"));
12929
-
12930
- ramp(colors("00000401000501010601010802010902020b02020d03030f03031204041405041606051806051a07061c08071e0907200a08220b09240c09260d0a290e0b2b100b2d110c2f120d31130d34140e36150e38160f3b180f3d19103f1a10421c10441d11471e114920114b21114e22115024125325125527125829115a2a115c2c115f2d11612f116331116533106734106936106b38106c390f6e3b0f703d0f713f0f72400f74420f75440f764510774710784910784a10794c117a4e117b4f127b51127c52137c54137d56147d57157e59157e5a167e5c167f5d177f5f187f601880621980641a80651a80671b80681c816a1c816b1d816d1d816e1e81701f81721f817320817521817621817822817922827b23827c23827e24828025828125818326818426818627818827818928818b29818c29818e2a81902a81912b81932b80942c80962c80982d80992d809b2e7f9c2e7f9e2f7fa02f7fa1307ea3307ea5317ea6317da8327daa337dab337cad347cae347bb0357bb2357bb3367ab5367ab73779b83779ba3878bc3978bd3977bf3a77c03a76c23b75c43c75c53c74c73d73c83e73ca3e72cc3f71cd4071cf4070d0416fd2426fd3436ed5446dd6456cd8456cd9466bdb476adc4869de4968df4a68e04c67e24d66e34e65e44f64e55064e75263e85362e95462ea5661eb5760ec5860ed5a5fee5b5eef5d5ef05f5ef1605df2625df2645cf3655cf4675cf4695cf56b5cf66c5cf66e5cf7705cf7725cf8745cf8765cf9785df9795df97b5dfa7d5efa7f5efa815ffb835ffb8560fb8761fc8961fc8a62fc8c63fc8e64fc9065fd9266fd9467fd9668fd9869fd9a6afd9b6bfe9d6cfe9f6dfea16efea36ffea571fea772fea973feaa74feac76feae77feb078feb27afeb47bfeb67cfeb77efeb97ffebb81febd82febf84fec185fec287fec488fec68afec88cfeca8dfecc8ffecd90fecf92fed194fed395fed597fed799fed89afdda9cfddc9efddea0fde0a1fde2a3fde3a5fde5a7fde7a9fde9aafdebacfcecaefceeb0fcf0b2fcf2b4fcf4b6fcf6b8fcf7b9fcf9bbfcfbbdfcfdbf"));
12931
-
12932
- ramp(colors("00000401000501010601010802010a02020c02020e03021004031204031405041706041907051b08051d09061f0a07220b07240c08260d08290e092b10092d110a30120a32140b34150b37160b39180c3c190c3e1b0c411c0c431e0c451f0c48210c4a230c4c240c4f260c51280b53290b552b0b572d0b592f0a5b310a5c320a5e340a5f3609613809623909633b09643d09653e0966400a67420a68440a68450a69470b6a490b6a4a0c6b4c0c6b4d0d6c4f0d6c510e6c520e6d540f6d550f6d57106e59106e5a116e5c126e5d126e5f136e61136e62146e64156e65156e67166e69166e6a176e6c186e6d186e6f196e71196e721a6e741a6e751b6e771c6d781c6d7a1d6d7c1d6d7d1e6d7f1e6c801f6c82206c84206b85216b87216b88226a8a226a8c23698d23698f24699025689225689326679526679727669827669a28659b29649d29649f2a63a02a63a22b62a32c61a52c60a62d60a82e5fa92e5eab2f5ead305dae305cb0315bb1325ab3325ab43359b63458b73557b93556ba3655bc3754bd3853bf3952c03a51c13a50c33b4fc43c4ec63d4dc73e4cc83f4bca404acb4149cc4248ce4347cf4446d04545d24644d34743d44842d54a41d74b3fd84c3ed94d3dda4e3cdb503bdd513ade5238df5337e05536e15635e25734e35933e45a31e55c30e65d2fe75e2ee8602de9612bea632aeb6429eb6628ec6726ed6925ee6a24ef6c23ef6e21f06f20f1711ff1731df2741cf3761bf37819f47918f57b17f57d15f67e14f68013f78212f78410f8850ff8870ef8890cf98b0bf98c0af98e09fa9008fa9207fa9407fb9606fb9706fb9906fb9b06fb9d07fc9f07fca108fca309fca50afca60cfca80dfcaa0ffcac11fcae12fcb014fcb216fcb418fbb61afbb81dfbba1ffbbc21fbbe23fac026fac228fac42afac62df9c72ff9c932f9cb35f8cd37f8cf3af7d13df7d340f6d543f6d746f5d949f5db4cf4dd4ff4df53f4e156f3e35af3e55df2e661f2e865f2ea69f1ec6df1ed71f1ef75f1f179f2f27df2f482f3f586f3f68af4f88ef5f992f6fa96f8fb9af9fc9dfafda1fcffa4"));
12933
-
12934
- ramp(colors("0d088710078813078916078a19068c1b068d1d068e20068f2206902406912605912805922a05932c05942e05952f059631059733059735049837049938049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c02a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a66100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a87401a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a68707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a19814a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb6308bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6ada5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe4695ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983ef99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fdab33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2afebe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921"));
12935
-
12936
- var autoColorScale = ordinal(schemePaired); // Autoset attribute colorField by colorByAccessor property
12937
- // If an object has already a color, don't set it
12938
- // Objects can be nodes or links
12939
-
12940
- function autoColorObjects(objects, colorByAccessor, colorField) {
12941
- if (!colorByAccessor || typeof colorField !== 'string') return;
12942
- objects.filter(function (obj) {
12943
- return !obj[colorField];
12944
- }).forEach(function (obj) {
12945
- obj[colorField] = autoColorScale(colorByAccessor(obj));
10714
+ // Autoset attribute colorField by colorByAccessor property
10715
+ // If an object has already a color, don't set it
10716
+ // Objects can be nodes or links
10717
+ function autoColorObjects(objects, colorByAccessor, colorField) {
10718
+ if (!colorByAccessor || typeof colorField !== 'string') return;
10719
+ objects.filter(function (obj) {
10720
+ return !obj[colorField];
10721
+ }).forEach(function (obj) {
10722
+ obj[colorField] = autoColorScale(colorByAccessor(obj));
12946
10723
  });
12947
10724
  }
12948
10725
 
12949
10726
  function getDagDepths (_ref, idAccessor) {
12950
10727
  var nodes = _ref.nodes,
12951
- links = _ref.links;
12952
-
10728
+ links = _ref.links;
12953
10729
  var _ref2 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
12954
- _ref2$nodeFilter = _ref2.nodeFilter,
12955
- nodeFilter = _ref2$nodeFilter === void 0 ? function () {
12956
- return true;
12957
- } : _ref2$nodeFilter,
12958
- _ref2$onLoopError = _ref2.onLoopError,
12959
- onLoopError = _ref2$onLoopError === void 0 ? function (loopIds) {
12960
- throw "Invalid DAG structure! Found cycle in node path: ".concat(loopIds.join(' -> '), ".");
12961
- } : _ref2$onLoopError;
12962
-
10730
+ _ref2$nodeFilter = _ref2.nodeFilter,
10731
+ nodeFilter = _ref2$nodeFilter === void 0 ? function () {
10732
+ return true;
10733
+ } : _ref2$nodeFilter,
10734
+ _ref2$onLoopError = _ref2.onLoopError,
10735
+ onLoopError = _ref2$onLoopError === void 0 ? function (loopIds) {
10736
+ throw "Invalid DAG structure! Found cycle in node path: ".concat(loopIds.join(' -> '), ".");
10737
+ } : _ref2$onLoopError;
12963
10738
  // linked graph
12964
10739
  var graph = {};
12965
10740
  nodes.forEach(function (node) {
@@ -12972,7 +10747,7 @@
12972
10747
  });
12973
10748
  links.forEach(function (_ref3) {
12974
10749
  var source = _ref3.source,
12975
- target = _ref3.target;
10750
+ target = _ref3.target;
12976
10751
  var sourceId = getNodeId(source);
12977
10752
  var targetId = getNodeId(target);
12978
10753
  if (!graph.hasOwnProperty(sourceId)) throw "Missing source node with id: ".concat(sourceId);
@@ -12980,7 +10755,6 @@
12980
10755
  var sourceNode = graph[sourceId];
12981
10756
  var targetNode = graph[targetId];
12982
10757
  sourceNode.out.push(targetNode);
12983
-
12984
10758
  function getNodeId(node) {
12985
10759
  return _typeof(node) === 'object' ? idAccessor(node) : node;
12986
10760
  }
@@ -12989,31 +10763,25 @@
12989
10763
  traverse(Object.values(graph));
12990
10764
  var nodeDepths = Object.assign.apply(Object, [{}].concat(_toConsumableArray$2(Object.entries(graph).filter(function (_ref4) {
12991
10765
  var _ref5 = _slicedToArray$2(_ref4, 2),
12992
- node = _ref5[1];
12993
-
10766
+ node = _ref5[1];
12994
10767
  return !node.skip;
12995
10768
  }).map(function (_ref6) {
12996
10769
  var _ref7 = _slicedToArray$2(_ref6, 2),
12997
- id = _ref7[0],
12998
- node = _ref7[1];
12999
-
10770
+ id = _ref7[0],
10771
+ node = _ref7[1];
13000
10772
  return _defineProperty({}, id, node.depth);
13001
10773
  }))));
13002
10774
  return nodeDepths;
13003
-
13004
10775
  function traverse(nodes) {
13005
10776
  var nodeStack = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
13006
10777
  var currentDepth = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
13007
-
13008
10778
  for (var i = 0, l = nodes.length; i < l; i++) {
13009
10779
  var node = nodes[i];
13010
-
13011
10780
  if (nodeStack.indexOf(node) !== -1) {
13012
10781
  var _ret = function () {
13013
10782
  var loop = [].concat(_toConsumableArray$2(nodeStack.slice(nodeStack.indexOf(node))), [node]).map(function (d) {
13014
10783
  return idAccessor(d.data);
13015
10784
  });
13016
-
13017
10785
  if (!foundLoops.some(function (foundLoop) {
13018
10786
  return foundLoop.length === loop.length && foundLoop.every(function (id, idx) {
13019
10787
  return id === loop[idx];
@@ -13022,13 +10790,10 @@
13022
10790
  foundLoops.push(loop);
13023
10791
  onLoopError(loop);
13024
10792
  }
13025
-
13026
10793
  return "continue";
13027
10794
  }();
13028
-
13029
10795
  if (_ret === "continue") continue;
13030
10796
  }
13031
-
13032
10797
  if (currentDepth > node.depth) {
13033
10798
  // Don't unnecessarily revisit chunks of the graph
13034
10799
  node.depth = currentDepth;
@@ -13038,12 +10803,14 @@
13038
10803
  }
13039
10804
  }
13040
10805
 
13041
- var DAG_LEVEL_NODE_RATIO = 2; // whenever styling props are changed that require a canvas redraw
10806
+ //
10807
+
10808
+ var DAG_LEVEL_NODE_RATIO = 2;
13042
10809
 
10810
+ // whenever styling props are changed that require a canvas redraw
13043
10811
  var notifyRedraw = function notifyRedraw(_, state) {
13044
10812
  return state.onNeedsRedraw && state.onNeedsRedraw();
13045
10813
  };
13046
-
13047
10814
  var CanvasForceGraph = index$3({
13048
10815
  props: {
13049
10816
  graphData: {
@@ -13054,7 +10821,6 @@
13054
10821
  onChange: function onChange(_, state) {
13055
10822
  state.engineRunning = false;
13056
10823
  } // Pause simulation
13057
-
13058
10824
  },
13059
10825
  dagMode: {
13060
10826
  onChange: function onChange(dagMode, state) {
@@ -13064,6 +10830,7 @@
13064
10830
  }); // unfix nodes when disabling dag mode
13065
10831
  }
13066
10832
  },
10833
+
13067
10834
  dagLevelDistance: {},
13068
10835
  dagNodeFilter: {
13069
10836
  "default": function _default(node) {
@@ -13257,7 +11024,6 @@
13257
11024
  }
13258
11025
 
13259
11026
  state.forceLayout.force(forceName, forceFn); // Force setter
13260
-
13261
11027
  return this;
13262
11028
  },
13263
11029
  d3ReheatSimulation: function d3ReheatSimulation(state) {
@@ -13281,52 +11047,49 @@
13281
11047
  !state.isShadow && paintArrows();
13282
11048
  !state.isShadow && paintPhotons();
13283
11049
  paintNodes();
13284
- return this; //
11050
+ return this;
11051
+
11052
+ //
13285
11053
 
13286
11054
  function layoutTick() {
13287
11055
  if (state.engineRunning) {
13288
11056
  if (++state.cntTicks > state.cooldownTicks || new Date() - state.startTickTime > state.cooldownTime || state.d3AlphaMin > 0 && state.forceLayout.alpha() < state.d3AlphaMin) {
13289
11057
  state.engineRunning = false; // Stop ticking graph
13290
-
13291
11058
  state.onEngineStop();
13292
11059
  } else {
13293
11060
  state.forceLayout.tick(); // Tick it
13294
-
13295
11061
  state.onEngineTick();
13296
11062
  }
13297
11063
  }
13298
11064
  }
13299
-
13300
11065
  function paintNodes() {
13301
- var getVisibility = index$2(state.nodeVisibility);
13302
- var getVal = index$2(state.nodeVal);
13303
- var getColor = index$2(state.nodeColor);
13304
- var getNodeCanvasObjectMode = index$2(state.nodeCanvasObjectMode);
13305
- var ctx = state.ctx; // Draw wider nodes by 1px on shadow canvas for more precise hovering (due to boundary anti-aliasing)
11066
+ var getVisibility = accessorFn(state.nodeVisibility);
11067
+ var getVal = accessorFn(state.nodeVal);
11068
+ var getColor = accessorFn(state.nodeColor);
11069
+ var getNodeCanvasObjectMode = accessorFn(state.nodeCanvasObjectMode);
11070
+ var ctx = state.ctx;
13306
11071
 
11072
+ // Draw wider nodes by 1px on shadow canvas for more precise hovering (due to boundary anti-aliasing)
13307
11073
  var padAmount = state.isShadow / state.globalScale;
13308
11074
  var visibleNodes = state.graphData.nodes.filter(getVisibility);
13309
11075
  ctx.save();
13310
11076
  visibleNodes.forEach(function (node) {
13311
11077
  var nodeCanvasObjectMode = getNodeCanvasObjectMode(node);
13312
-
13313
11078
  if (state.nodeCanvasObject && (nodeCanvasObjectMode === 'before' || nodeCanvasObjectMode === 'replace')) {
13314
11079
  // Custom node before/replace paint
13315
11080
  state.nodeCanvasObject(node, ctx, state.globalScale);
13316
-
13317
11081
  if (nodeCanvasObjectMode === 'replace') {
13318
11082
  ctx.restore();
13319
11083
  return;
13320
11084
  }
13321
- } // Draw wider nodes by 1px on shadow canvas for more precise hovering (due to boundary anti-aliasing)
13322
-
11085
+ }
13323
11086
 
11087
+ // Draw wider nodes by 1px on shadow canvas for more precise hovering (due to boundary anti-aliasing)
13324
11088
  var r = Math.sqrt(Math.max(0, getVal(node) || 1)) * state.nodeRelSize + padAmount;
13325
11089
  ctx.beginPath();
13326
11090
  ctx.arc(node.x, node.y, r, 0, 2 * Math.PI, false);
13327
11091
  ctx.fillStyle = getColor(node) || 'rgba(31, 120, 180, 0.92)';
13328
11092
  ctx.fill();
13329
-
13330
11093
  if (state.nodeCanvasObject && nodeCanvasObjectMode === 'after') {
13331
11094
  // Custom node after paint
13332
11095
  state.nodeCanvasObject(node, state.ctx, state.globalScale);
@@ -13334,27 +11097,26 @@
13334
11097
  });
13335
11098
  ctx.restore();
13336
11099
  }
13337
-
13338
11100
  function paintLinks() {
13339
- var getVisibility = index$2(state.linkVisibility);
13340
- var getColor = index$2(state.linkColor);
13341
- var getWidth = index$2(state.linkWidth);
13342
- var getLineDash = index$2(state.linkLineDash);
13343
- var getCurvature = index$2(state.linkCurvature);
13344
- var getLinkCanvasObjectMode = index$2(state.linkCanvasObjectMode);
13345
- var ctx = state.ctx; // Draw wider lines by 2px on shadow canvas for more precise hovering (due to boundary anti-aliasing)
11101
+ var getVisibility = accessorFn(state.linkVisibility);
11102
+ var getColor = accessorFn(state.linkColor);
11103
+ var getWidth = accessorFn(state.linkWidth);
11104
+ var getLineDash = accessorFn(state.linkLineDash);
11105
+ var getCurvature = accessorFn(state.linkCurvature);
11106
+ var getLinkCanvasObjectMode = accessorFn(state.linkCanvasObjectMode);
11107
+ var ctx = state.ctx;
13346
11108
 
11109
+ // Draw wider lines by 2px on shadow canvas for more precise hovering (due to boundary anti-aliasing)
13347
11110
  var padAmount = state.isShadow * 2;
13348
11111
  var visibleLinks = state.graphData.links.filter(getVisibility);
13349
11112
  visibleLinks.forEach(calcLinkControlPoints); // calculate curvature control points for all visible links
13350
11113
 
13351
11114
  var beforeCustomLinks = [],
13352
- afterCustomLinks = [],
13353
- defaultPaintLinks = visibleLinks;
13354
-
11115
+ afterCustomLinks = [],
11116
+ defaultPaintLinks = visibleLinks;
13355
11117
  if (state.linkCanvasObject) {
13356
11118
  var replaceCustomLinks = [],
13357
- otherCustomLinks = [];
11119
+ otherCustomLinks = [];
13358
11120
  visibleLinks.forEach(function (d) {
13359
11121
  return ({
13360
11122
  before: beforeCustomLinks,
@@ -13364,34 +11126,32 @@
13364
11126
  });
13365
11127
  defaultPaintLinks = [].concat(_toConsumableArray$2(beforeCustomLinks), afterCustomLinks, otherCustomLinks);
13366
11128
  beforeCustomLinks = beforeCustomLinks.concat(replaceCustomLinks);
13367
- } // Custom link before paints
13368
-
11129
+ }
13369
11130
 
11131
+ // Custom link before paints
13370
11132
  ctx.save();
13371
11133
  beforeCustomLinks.forEach(function (link) {
13372
11134
  return state.linkCanvasObject(link, ctx, state.globalScale);
13373
11135
  });
13374
- ctx.restore(); // Bundle strokes per unique color/width/dash for performance optimization
11136
+ ctx.restore();
13375
11137
 
11138
+ // Bundle strokes per unique color/width/dash for performance optimization
13376
11139
  var linksPerColor = index(defaultPaintLinks, [getColor, getWidth, getLineDash]);
13377
11140
  ctx.save();
13378
11141
  Object.entries(linksPerColor).forEach(function (_ref) {
13379
11142
  var _ref2 = _slicedToArray$2(_ref, 2),
13380
- color = _ref2[0],
13381
- linksPerWidth = _ref2[1];
13382
-
11143
+ color = _ref2[0],
11144
+ linksPerWidth = _ref2[1];
13383
11145
  var lineColor = !color || color === 'undefined' ? 'rgba(0,0,0,0.15)' : color;
13384
11146
  Object.entries(linksPerWidth).forEach(function (_ref3) {
13385
11147
  var _ref4 = _slicedToArray$2(_ref3, 2),
13386
- width = _ref4[0],
13387
- linesPerLineDash = _ref4[1];
13388
-
11148
+ width = _ref4[0],
11149
+ linesPerLineDash = _ref4[1];
13389
11150
  var lineWidth = (width || 1) / state.globalScale + padAmount;
13390
11151
  Object.entries(linesPerLineDash).forEach(function (_ref5) {
13391
11152
  var _ref6 = _slicedToArray$2(_ref5, 2);
13392
- _ref6[0];
13393
- var links = _ref6[1];
13394
-
11153
+ _ref6[0];
11154
+ var links = _ref6[1];
13395
11155
  var lineDashSegments = getLineDash(links[0]);
13396
11156
  ctx.beginPath();
13397
11157
  links.forEach(function (link) {
@@ -13401,7 +11161,6 @@
13401
11161
 
13402
11162
  ctx.moveTo(start.x, start.y);
13403
11163
  var controlPoints = link.__controlPoints;
13404
-
13405
11164
  if (!controlPoints) {
13406
11165
  // Straight line
13407
11166
  ctx.lineTo(end.x, end.y);
@@ -13417,23 +11176,24 @@
13417
11176
  });
13418
11177
  });
13419
11178
  });
13420
- ctx.restore(); // Custom link after paints
11179
+ ctx.restore();
13421
11180
 
11181
+ // Custom link after paints
13422
11182
  ctx.save();
13423
11183
  afterCustomLinks.forEach(function (link) {
13424
11184
  return state.linkCanvasObject(link, ctx, state.globalScale);
13425
11185
  });
13426
- ctx.restore(); //
11186
+ ctx.restore();
11187
+
11188
+ //
13427
11189
 
13428
11190
  function calcLinkControlPoints(link) {
13429
11191
  var curvature = getCurvature(link);
13430
-
13431
11192
  if (!curvature) {
13432
11193
  // straight line
13433
11194
  link.__controlPoints = null;
13434
11195
  return;
13435
11196
  }
13436
-
13437
11197
  var start = link.source;
13438
11198
  var end = link.target;
13439
11199
  if (!start || !end || !start.hasOwnProperty('x') || !end.hasOwnProperty('x')) return; // skip invalid link
@@ -13442,7 +11202,6 @@
13442
11202
 
13443
11203
  if (l > 0) {
13444
11204
  var a = Math.atan2(end.y - start.y, end.x - start.x); // line angle
13445
-
13446
11205
  var d = l * curvature; // control point distance
13447
11206
 
13448
11207
  var cp = {
@@ -13454,20 +11213,18 @@
13454
11213
  } else {
13455
11214
  // Same point, draw a loop
13456
11215
  var _d = curvature * 70;
13457
-
13458
11216
  link.__controlPoints = [end.x, end.y - _d, end.x + _d, end.y];
13459
11217
  }
13460
11218
  }
13461
11219
  }
13462
-
13463
11220
  function paintArrows() {
13464
11221
  var ARROW_WH_RATIO = 1.6;
13465
11222
  var ARROW_VLEN_RATIO = 0.2;
13466
- var getLength = index$2(state.linkDirectionalArrowLength);
13467
- var getRelPos = index$2(state.linkDirectionalArrowRelPos);
13468
- var getVisibility = index$2(state.linkVisibility);
13469
- var getColor = index$2(state.linkDirectionalArrowColor || state.linkColor);
13470
- var getNodeVal = index$2(state.nodeVal);
11223
+ var getLength = accessorFn(state.linkDirectionalArrowLength);
11224
+ var getRelPos = accessorFn(state.linkDirectionalArrowRelPos);
11225
+ var getVisibility = accessorFn(state.linkVisibility);
11226
+ var getColor = accessorFn(state.linkDirectionalArrowColor || state.linkColor);
11227
+ var getNodeVal = accessorFn(state.nodeVal);
13471
11228
  var ctx = state.ctx;
13472
11229
  ctx.save();
13473
11230
  state.graphData.links.filter(getVisibility).forEach(function (link) {
@@ -13481,10 +11238,10 @@
13481
11238
  var endR = Math.sqrt(Math.max(0, getNodeVal(end) || 1)) * state.nodeRelSize;
13482
11239
  var arrowRelPos = Math.min(1, Math.max(0, getRelPos(link)));
13483
11240
  var arrowColor = getColor(link) || 'rgba(0,0,0,0.28)';
13484
- var arrowHalfWidth = arrowLength / ARROW_WH_RATIO / 2; // Construct bezier for curved lines
11241
+ var arrowHalfWidth = arrowLength / ARROW_WH_RATIO / 2;
13485
11242
 
11243
+ // Construct bezier for curved lines
13486
11244
  var bzLine = link.__controlPoints && _construct(Bezier, [start.x, start.y].concat(_toConsumableArray$2(link.__controlPoints), [end.x, end.y]));
13487
-
13488
11245
  var getCoordsAlongLine = bzLine ? function (t) {
13489
11246
  return bzLine.get(t);
13490
11247
  } // get position along bezier line
@@ -13511,13 +11268,12 @@
13511
11268
  });
13512
11269
  ctx.restore();
13513
11270
  }
13514
-
13515
11271
  function paintPhotons() {
13516
- var getNumPhotons = index$2(state.linkDirectionalParticles);
13517
- var getSpeed = index$2(state.linkDirectionalParticleSpeed);
13518
- var getDiameter = index$2(state.linkDirectionalParticleWidth);
13519
- var getVisibility = index$2(state.linkVisibility);
13520
- var getColor = index$2(state.linkDirectionalParticleColor || state.linkColor);
11272
+ var getNumPhotons = accessorFn(state.linkDirectionalParticles);
11273
+ var getSpeed = accessorFn(state.linkDirectionalParticleSpeed);
11274
+ var getDiameter = accessorFn(state.linkDirectionalParticleWidth);
11275
+ var getVisibility = accessorFn(state.linkVisibility);
11276
+ var getColor = accessorFn(state.linkDirectionalParticleColor || state.linkColor);
13521
11277
  var ctx = state.ctx;
13522
11278
  ctx.save();
13523
11279
  state.graphData.links.filter(getVisibility).forEach(function (link) {
@@ -13531,23 +11287,20 @@
13531
11287
  var photons = link.__photons || [];
13532
11288
  var photonR = Math.max(0, getDiameter(link) / 2) / Math.sqrt(state.globalScale);
13533
11289
  var photonColor = getColor(link) || 'rgba(0,0,0,0.28)';
13534
- ctx.fillStyle = photonColor; // Construct bezier for curved lines
11290
+ ctx.fillStyle = photonColor;
13535
11291
 
11292
+ // Construct bezier for curved lines
13536
11293
  var bzLine = link.__controlPoints ? _construct(Bezier, [start.x, start.y].concat(_toConsumableArray$2(link.__controlPoints), [end.x, end.y])) : null;
13537
11294
  var cyclePhotonIdx = 0;
13538
11295
  var needsCleanup = false; // whether some photons need to be removed from list
13539
-
13540
11296
  photons.forEach(function (photon) {
13541
11297
  var singleHop = !!photon.__singleHop;
13542
-
13543
11298
  if (!photon.hasOwnProperty('__progressRatio')) {
13544
11299
  photon.__progressRatio = singleHop ? 0 : cyclePhotonIdx / numCyclePhotons;
13545
11300
  }
13546
-
13547
11301
  !singleHop && cyclePhotonIdx++; // increase regular photon index
13548
11302
 
13549
11303
  photon.__progressRatio += particleSpeed;
13550
-
13551
11304
  if (photon.__progressRatio >= 1) {
13552
11305
  if (!singleHop) {
13553
11306
  photon.__progressRatio = photon.__progressRatio % 1;
@@ -13556,7 +11309,6 @@
13556
11309
  return;
13557
11310
  }
13558
11311
  }
13559
-
13560
11312
  var photonPosRatio = photon.__progressRatio;
13561
11313
  var coords = bzLine ? bzLine.get(photonPosRatio) // get position along bezier line
13562
11314
  : {
@@ -13568,7 +11320,6 @@
13568
11320
  ctx.arc(coords.x, coords.y, photonR, 0, 2 * Math.PI, false);
13569
11321
  ctx.fill();
13570
11322
  });
13571
-
13572
11323
  if (needsCleanup) {
13573
11324
  // remove expired single hop photons
13574
11325
  link.__photons = link.__photons.filter(function (photon) {
@@ -13582,11 +11333,9 @@
13582
11333
  emitParticle: function emitParticle(state, link) {
13583
11334
  if (link) {
13584
11335
  !link.__photons && (link.__photons = []);
13585
-
13586
11336
  link.__photons.push({
13587
11337
  __singleHop: true
13588
11338
  }); // add a single hop particle
13589
-
13590
11339
  }
13591
11340
 
13592
11341
  return this;
@@ -13604,31 +11353,26 @@
13604
11353
  },
13605
11354
  update: function update(state) {
13606
11355
  state.engineRunning = false; // Pause simulation
13607
-
13608
11356
  state.onUpdate();
13609
-
13610
11357
  if (state.nodeAutoColorBy !== null) {
13611
11358
  // Auto add color to uncolored nodes
13612
- autoColorObjects(state.graphData.nodes, index$2(state.nodeAutoColorBy), state.nodeColor);
11359
+ autoColorObjects(state.graphData.nodes, accessorFn(state.nodeAutoColorBy), state.nodeColor);
13613
11360
  }
13614
-
13615
11361
  if (state.linkAutoColorBy !== null) {
13616
11362
  // Auto add color to uncolored links
13617
- autoColorObjects(state.graphData.links, index$2(state.linkAutoColorBy), state.linkColor);
13618
- } // parse links
13619
-
11363
+ autoColorObjects(state.graphData.links, accessorFn(state.linkAutoColorBy), state.linkColor);
11364
+ }
13620
11365
 
11366
+ // parse links
13621
11367
  state.graphData.links.forEach(function (link) {
13622
11368
  link.source = link[state.linkSource];
13623
11369
  link.target = link[state.linkTarget];
13624
11370
  });
13625
-
13626
11371
  if (!state.isShadow) {
13627
11372
  // Add photon particles
13628
- var linkParticlesAccessor = index$2(state.linkDirectionalParticles);
11373
+ var linkParticlesAccessor = accessorFn(state.linkDirectionalParticles);
13629
11374
  state.graphData.links.forEach(function (link) {
13630
11375
  var numPhotons = Math.round(Math.abs(linkParticlesAccessor(link)));
13631
-
13632
11376
  if (numPhotons) {
13633
11377
  link.__photons = _toConsumableArray$2(Array(numPhotons)).map(function () {
13634
11378
  return {};
@@ -13637,21 +11381,21 @@
13637
11381
  delete link.__photons;
13638
11382
  }
13639
11383
  });
13640
- } // Feed data to force-directed layout
13641
-
11384
+ }
13642
11385
 
11386
+ // Feed data to force-directed layout
13643
11387
  state.forceLayout.stop().alpha(1) // re-heat the simulation
13644
- .nodes(state.graphData.nodes); // add links (if link force is still active)
11388
+ .nodes(state.graphData.nodes);
13645
11389
 
11390
+ // add links (if link force is still active)
13646
11391
  var linkForce = state.forceLayout.force('link');
13647
-
13648
11392
  if (linkForce) {
13649
11393
  linkForce.id(function (d) {
13650
11394
  return d[state.nodeId];
13651
11395
  }).links(state.graphData.links);
13652
- } // setup dag force constraints
13653
-
11396
+ }
13654
11397
 
11398
+ // setup dag force constraints
13655
11399
  var nodeDepths = state.dagMode && getDagDepths(state.graphData, function (node) {
13656
11400
  return node[state.nodeId];
13657
11401
  }, {
@@ -13659,36 +11403,34 @@
13659
11403
  onLoopError: state.onDagError || undefined
13660
11404
  });
13661
11405
  var maxDepth = Math.max.apply(Math, _toConsumableArray$2(Object.values(nodeDepths || [])));
13662
- var dagLevelDistance = state.dagLevelDistance || state.graphData.nodes.length / (maxDepth || 1) * DAG_LEVEL_NODE_RATIO * (['radialin', 'radialout'].indexOf(state.dagMode) !== -1 ? 0.7 : 1); // Fix nodes to x,y for dag mode
11406
+ var dagLevelDistance = state.dagLevelDistance || state.graphData.nodes.length / (maxDepth || 1) * DAG_LEVEL_NODE_RATIO * (['radialin', 'radialout'].indexOf(state.dagMode) !== -1 ? 0.7 : 1);
13663
11407
 
11408
+ // Fix nodes to x,y for dag mode
13664
11409
  if (state.dagMode) {
13665
11410
  var getFFn = function getFFn(fix, invert) {
13666
11411
  return function (node) {
13667
11412
  return !fix ? undefined : (nodeDepths[node[state.nodeId]] - maxDepth / 2) * dagLevelDistance * (invert ? -1 : 1);
13668
11413
  };
13669
11414
  };
13670
-
13671
11415
  var fxFn = getFFn(['lr', 'rl'].indexOf(state.dagMode) !== -1, state.dagMode === 'rl');
13672
11416
  var fyFn = getFFn(['td', 'bu'].indexOf(state.dagMode) !== -1, state.dagMode === 'bu');
13673
11417
  state.graphData.nodes.filter(state.dagNodeFilter).forEach(function (node) {
13674
11418
  node.fx = fxFn(node);
13675
11419
  node.fy = fyFn(node);
13676
11420
  });
13677
- } // Use radial force for radial dags
13678
-
11421
+ }
13679
11422
 
11423
+ // Use radial force for radial dags
13680
11424
  state.forceLayout.force('dagRadial', ['radialin', 'radialout'].indexOf(state.dagMode) !== -1 ? d3ForceRadial(function (node) {
13681
11425
  var nodeDepth = nodeDepths[node[state.nodeId]] || -1;
13682
11426
  return (state.dagMode === 'radialin' ? maxDepth - nodeDepth : nodeDepth) * dagLevelDistance;
13683
11427
  }).strength(function (node) {
13684
11428
  return state.dagNodeFilter(node) ? 1 : 0;
13685
11429
  }) : null);
13686
-
13687
11430
  for (var i = 0; i < state.warmupTicks && !(state.d3AlphaMin > 0 && state.forceLayout.alpha() < state.d3AlphaMin); i++) {
13688
11431
  state.forceLayout.tick();
13689
11432
  } // Initial ticks before starting to render
13690
11433
 
13691
-
13692
11434
  this.resetCountdown();
13693
11435
  state.onFinishUpdate();
13694
11436
  }
@@ -13717,12 +11459,10 @@
13717
11459
  for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
13718
11460
  args[_key - 1] = arguments[_key];
13719
11461
  }
13720
-
13721
11462
  var returnVals = [];
13722
11463
  propNames.forEach(function (propName) {
13723
11464
  var kapsuleInstance = state[propName];
13724
11465
  var returnVal = kapsuleInstance[method].apply(kapsuleInstance, args);
13725
-
13726
11466
  if (returnVal !== kapsuleInstance) {
13727
11467
  returnVals.push(returnVal);
13728
11468
  }
@@ -13734,9 +11474,9 @@
13734
11474
  }
13735
11475
 
13736
11476
  var HOVER_CANVAS_THROTTLE_DELAY = 800; // ms to throttle shadow canvas updates for perf improvement
11477
+ var ZOOM2NODES_FACTOR = 4;
13737
11478
 
13738
- var ZOOM2NODES_FACTOR = 4; // Expose config from forceGraph
13739
-
11479
+ // Expose config from forceGraph
13740
11480
  var bindFG = linkKapsule('forceGraph', CanvasForceGraph);
13741
11481
  var bindBoth = linkKapsule(['forceGraph', 'shadowGraph'], CanvasForceGraph);
13742
11482
  var linkedProps = Object.assign.apply(Object, _toConsumableArray$2(['nodeColor', 'nodeAutoColorBy', 'nodeCanvasObject', 'nodeCanvasObjectMode', 'linkColor', 'linkAutoColorBy', 'linkLineDash', 'linkWidth', 'linkCanvasObject', 'linkCanvasObjectMode', 'linkDirectionalArrowLength', 'linkDirectionalArrowColor', 'linkDirectionalArrowRelPos', 'linkDirectionalParticles', 'linkDirectionalParticleSpeed', 'linkDirectionalParticleWidth', 'linkDirectionalParticleColor', 'dagMode', 'dagLevelDistance', 'dagNodeFilter', 'onDagError', 'd3AlphaMin', 'd3AlphaDecay', 'd3VelocityDecay', 'warmupTicks', 'cooldownTicks', 'cooldownTime', 'onEngineTick', 'onEngineStop'].map(function (p) {
@@ -13747,54 +11487,52 @@
13747
11487
  var linkedMethods = Object.assign.apply(Object, _toConsumableArray$2(['d3Force', 'd3ReheatSimulation', 'emitParticle'].map(function (p) {
13748
11488
  return _defineProperty({}, p, bindFG.linkMethod(p));
13749
11489
  })));
13750
-
13751
11490
  function adjustCanvasSize(state) {
13752
11491
  if (state.canvas) {
13753
11492
  var curWidth = state.canvas.width;
13754
11493
  var curHeight = state.canvas.height;
13755
-
13756
11494
  if (curWidth === 300 && curHeight === 150) {
13757
11495
  // Default canvas dimensions
13758
11496
  curWidth = curHeight = 0;
13759
11497
  }
13760
-
13761
11498
  var pxScale = window.devicePixelRatio; // 2 on retina displays
13762
-
13763
11499
  curWidth /= pxScale;
13764
- curHeight /= pxScale; // Resize canvases
11500
+ curHeight /= pxScale;
13765
11501
 
11502
+ // Resize canvases
13766
11503
  [state.canvas, state.shadowCanvas].forEach(function (canvas) {
13767
11504
  // Element size
13768
11505
  canvas.style.width = "".concat(state.width, "px");
13769
- canvas.style.height = "".concat(state.height, "px"); // Memory size (scaled to avoid blurriness)
11506
+ canvas.style.height = "".concat(state.height, "px");
13770
11507
 
11508
+ // Memory size (scaled to avoid blurriness)
13771
11509
  canvas.width = state.width * pxScale;
13772
- canvas.height = state.height * pxScale; // Normalize coordinate system to use css pixels (on init only)
11510
+ canvas.height = state.height * pxScale;
13773
11511
 
11512
+ // Normalize coordinate system to use css pixels (on init only)
13774
11513
  if (!curWidth && !curHeight) {
13775
11514
  canvas.getContext('2d').scale(pxScale, pxScale);
13776
11515
  }
13777
- }); // Relative center panning based on 0,0
11516
+ });
13778
11517
 
11518
+ // Relative center panning based on 0,0
13779
11519
  var k = transform(state.canvas).k;
13780
11520
  state.zoom.translateBy(state.zoom.__baseElem, (state.width - curWidth) / 2 / k, (state.height - curHeight) / 2 / k);
13781
11521
  state.needsRedraw = true;
13782
11522
  }
13783
11523
  }
13784
-
13785
11524
  function resetTransform(ctx) {
13786
11525
  var pxRatio = window.devicePixelRatio;
13787
11526
  ctx.setTransform(pxRatio, 0, 0, pxRatio, 0, 0);
13788
11527
  }
13789
-
13790
11528
  function clearCanvas(ctx, width, height) {
13791
11529
  ctx.save();
13792
11530
  resetTransform(ctx); // reset transform
13793
-
13794
11531
  ctx.clearRect(0, 0, width, height);
13795
11532
  ctx.restore(); //restore transforms
13796
- } //
11533
+ }
13797
11534
 
11535
+ //
13798
11536
 
13799
11537
  var forceGraph = index$3({
13800
11538
  props: _objectSpread2({
@@ -13827,10 +11565,9 @@
13827
11565
  }].forEach(hexIndex);
13828
11566
  state.forceGraph.graphData(d);
13829
11567
  state.shadowGraph.graphData(d);
13830
-
13831
11568
  function hexIndex(_ref4) {
13832
11569
  var type = _ref4.type,
13833
- objs = _ref4.objs;
11570
+ objs = _ref4.objs;
13834
11571
  objs.filter(function (d) {
13835
11572
  if (!d.hasOwnProperty('__indexColor')) return true;
13836
11573
  var cur = state.colorTracker.lookup(d.__indexColor);
@@ -13990,27 +11727,27 @@
13990
11727
  },
13991
11728
  centerAt: function centerAt(state, x, y, transitionDuration) {
13992
11729
  if (!state.canvas) return null; // no canvas yet
13993
- // setter
13994
11730
 
11731
+ // setter
13995
11732
  if (x !== undefined || y !== undefined) {
13996
11733
  var finalPos = Object.assign({}, x !== undefined ? {
13997
11734
  x: x
13998
11735
  } : {}, y !== undefined ? {
13999
11736
  y: y
14000
11737
  } : {});
14001
-
14002
11738
  if (!transitionDuration) {
14003
11739
  // no animation
14004
11740
  setCenter(finalPos);
14005
11741
  } else {
14006
- new exports$1.Tween(getCenter()).to(finalPos, transitionDuration).easing(exports$1.Easing.Quadratic.Out).onUpdate(setCenter).start();
11742
+ new TWEEN$1.Tween(getCenter()).to(finalPos, transitionDuration).easing(TWEEN$1.Easing.Quadratic.Out).onUpdate(setCenter).start();
14007
11743
  }
14008
-
14009
11744
  return this;
14010
- } // getter
11745
+ }
14011
11746
 
11747
+ // getter
11748
+ return getCenter();
14012
11749
 
14013
- return getCenter(); //
11750
+ //
14014
11751
 
14015
11752
  function getCenter() {
14016
11753
  var t = transform(state.canvas);
@@ -14019,43 +11756,42 @@
14019
11756
  y: (state.height / 2 - t.y) / t.k
14020
11757
  };
14021
11758
  }
14022
-
14023
11759
  function setCenter(_ref5) {
14024
11760
  var x = _ref5.x,
14025
- y = _ref5.y;
11761
+ y = _ref5.y;
14026
11762
  state.zoom.translateTo(state.zoom.__baseElem, x === undefined ? getCenter().x : x, y === undefined ? getCenter().y : y);
14027
11763
  state.needsRedraw = true;
14028
11764
  }
14029
11765
  },
14030
11766
  zoom: function zoom(state, k, transitionDuration) {
14031
11767
  if (!state.canvas) return null; // no canvas yet
14032
- // setter
14033
11768
 
11769
+ // setter
14034
11770
  if (k !== undefined) {
14035
11771
  if (!transitionDuration) {
14036
11772
  // no animation
14037
11773
  setZoom(k);
14038
11774
  } else {
14039
- new exports$1.Tween({
11775
+ new TWEEN$1.Tween({
14040
11776
  k: getZoom()
14041
11777
  }).to({
14042
11778
  k: k
14043
- }, transitionDuration).easing(exports$1.Easing.Quadratic.Out).onUpdate(function (_ref6) {
11779
+ }, transitionDuration).easing(TWEEN$1.Easing.Quadratic.Out).onUpdate(function (_ref6) {
14044
11780
  var k = _ref6.k;
14045
11781
  return setZoom(k);
14046
11782
  }).start();
14047
11783
  }
14048
-
14049
11784
  return this;
14050
- } // getter
11785
+ }
14051
11786
 
11787
+ // getter
11788
+ return getZoom();
14052
11789
 
14053
- return getZoom(); //
11790
+ //
14054
11791
 
14055
11792
  function getZoom() {
14056
11793
  return transform(state.canvas).k;
14057
11794
  }
14058
-
14059
11795
  function setZoom(k) {
14060
11796
  state.zoom.scaleTo(state.zoom.__baseElem, k);
14061
11797
  state.needsRedraw = true;
@@ -14064,13 +11800,10 @@
14064
11800
  zoomToFit: function zoomToFit(state) {
14065
11801
  var transitionDuration = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
14066
11802
  var padding = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 10;
14067
-
14068
11803
  for (var _len = arguments.length, bboxArgs = new Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) {
14069
11804
  bboxArgs[_key - 3] = arguments[_key];
14070
11805
  }
14071
-
14072
11806
  var bbox = this.getGraphBbox.apply(this, bboxArgs);
14073
-
14074
11807
  if (bbox) {
14075
11808
  var center = {
14076
11809
  x: (bbox.x[0] + bbox.x[1]) / 2,
@@ -14080,19 +11813,16 @@
14080
11813
  this.centerAt(center.x, center.y, transitionDuration);
14081
11814
  this.zoom(zoomK, transitionDuration);
14082
11815
  }
14083
-
14084
11816
  return this;
14085
11817
  },
14086
11818
  getGraphBbox: function getGraphBbox(state) {
14087
11819
  var nodeFilter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function () {
14088
11820
  return true;
14089
11821
  };
14090
- var getVal = index$2(state.nodeVal);
14091
-
11822
+ var getVal = accessorFn(state.nodeVal);
14092
11823
  var getR = function getR(node) {
14093
11824
  return Math.sqrt(Math.max(0, getVal(node) || 1)) * state.nodeRelSize;
14094
11825
  };
14095
-
14096
11826
  var nodesPos = state.graphData.nodes.filter(nodeFilter).map(function (node) {
14097
11827
  return {
14098
11828
  x: node.x,
@@ -14118,14 +11848,12 @@
14118
11848
  cancelAnimationFrame(state.animationFrameRequestId);
14119
11849
  state.animationFrameRequestId = null;
14120
11850
  }
14121
-
14122
11851
  return this;
14123
11852
  },
14124
11853
  resumeAnimation: function resumeAnimation(state) {
14125
11854
  if (!state.animationFrameRequestId) {
14126
11855
  this._animationCycle();
14127
11856
  }
14128
-
14129
11857
  return this;
14130
11858
  },
14131
11859
  _destructor: function _destructor() {
@@ -14143,15 +11871,15 @@
14143
11871
  forceGraph: new CanvasForceGraph(),
14144
11872
  shadowGraph: new CanvasForceGraph().cooldownTicks(0).nodeColor('__indexColor').linkColor('__indexColor').isShadow(true),
14145
11873
  colorTracker: new _default() // indexed objects for rgb lookup
14146
-
14147
11874
  };
14148
11875
  },
11876
+
14149
11877
  init: function init(domNode, state) {
14150
11878
  var _this = this;
14151
-
14152
11879
  // Wipe DOM
14153
- domNode.innerHTML = ''; // Container anchor for canvas and tooltip
11880
+ domNode.innerHTML = '';
14154
11881
 
11882
+ // Container anchor for canvas and tooltip
14155
11883
  var container = document.createElement('div');
14156
11884
  container.classList.add('force-graph-container');
14157
11885
  container.style.position = 'relative';
@@ -14159,7 +11887,9 @@
14159
11887
  state.canvas = document.createElement('canvas');
14160
11888
  if (state.backgroundColor) state.canvas.style.background = state.backgroundColor;
14161
11889
  container.appendChild(state.canvas);
14162
- state.shadowCanvas = document.createElement('canvas'); // Show shadow canvas
11890
+ state.shadowCanvas = document.createElement('canvas');
11891
+
11892
+ // Show shadow canvas
14163
11893
  //state.shadowCanvas.style.position = 'absolute';
14164
11894
  //state.shadowCanvas.style.top = '0';
14165
11895
  //state.shadowCanvas.style.left = '0';
@@ -14171,22 +11901,20 @@
14171
11901
  x: -1e12,
14172
11902
  y: -1e12
14173
11903
  };
14174
-
14175
11904
  var getObjUnderPointer = function getObjUnderPointer() {
14176
11905
  var obj = null;
14177
11906
  var pxScale = window.devicePixelRatio;
14178
- var px = pointerPos.x > 0 && pointerPos.y > 0 ? shadowCtx.getImageData(pointerPos.x * pxScale, pointerPos.y * pxScale, 1, 1) : null; // Lookup object per pixel color
14179
-
11907
+ var px = pointerPos.x > 0 && pointerPos.y > 0 ? shadowCtx.getImageData(pointerPos.x * pxScale, pointerPos.y * pxScale, 1, 1) : null;
11908
+ // Lookup object per pixel color
14180
11909
  px && (obj = state.colorTracker.lookup(px.data));
14181
11910
  return obj;
14182
- }; // Setup node drag interaction
14183
-
11911
+ };
14184
11912
 
11913
+ // Setup node drag interaction
14185
11914
  d3Select(state.canvas).call(d3Drag().subject(function () {
14186
11915
  if (!state.enableNodeDrag) {
14187
11916
  return null;
14188
11917
  }
14189
-
14190
11918
  var obj = getObjUnderPointer();
14191
11919
  return obj && obj.type === 'Node' ? obj.d : null; // Only drag nodes
14192
11920
  }).on('start', function (ev) {
@@ -14196,14 +11924,15 @@
14196
11924
  y: obj.y,
14197
11925
  fx: obj.fx,
14198
11926
  fy: obj.fy
14199
- }; // keep engine running at low intensity throughout drag
11927
+ };
14200
11928
 
11929
+ // keep engine running at low intensity throughout drag
14201
11930
  if (!ev.active) {
14202
11931
  obj.fx = obj.x;
14203
11932
  obj.fy = obj.y; // Fix points
14204
- } // drag cursor
14205
-
11933
+ }
14206
11934
 
11935
+ // drag cursor
14207
11936
  state.canvas.classList.add('grabbable');
14208
11937
  }).on('drag', function (ev) {
14209
11938
  var obj = ev.subject;
@@ -14213,12 +11942,14 @@
14213
11942
  var translate = {
14214
11943
  x: initPos.x + (dragPos.x - initPos.x) / k - obj.x,
14215
11944
  y: initPos.y + (dragPos.y - initPos.y) / k - obj.y
14216
- }; // Move fx/fy (and x/y) of nodes based on the scaled drag distance since the drag start
11945
+ };
14217
11946
 
11947
+ // Move fx/fy (and x/y) of nodes based on the scaled drag distance since the drag start
14218
11948
  ['x', 'y'].forEach(function (c) {
14219
11949
  return obj["f".concat(c)] = obj[c] = initPos[c] + (dragPos[c] - initPos[c]) / k;
14220
- }); // prevent freeze while dragging
11950
+ });
14221
11951
 
11952
+ // prevent freeze while dragging
14222
11953
  state.forceGraph.d3AlphaTarget(0.3) // keep engine running at low intensity throughout drag
14223
11954
  .resetCountdown(); // prevent freeze while dragging
14224
11955
 
@@ -14232,39 +11963,35 @@
14232
11963
  x: obj.x - initPos.x,
14233
11964
  y: obj.y - initPos.y
14234
11965
  };
14235
-
14236
11966
  if (initPos.fx === undefined) {
14237
11967
  obj.fx = undefined;
14238
11968
  }
14239
-
14240
11969
  if (initPos.fy === undefined) {
14241
11970
  obj.fy = undefined;
14242
11971
  }
14243
-
14244
11972
  delete obj.__initialDragPos;
14245
-
14246
11973
  if (state.forceGraph.d3AlphaTarget()) {
14247
11974
  state.forceGraph.d3AlphaTarget(0) // release engine low intensity
14248
11975
  .resetCountdown(); // let the engine readjust after releasing fixed nodes
14249
- } // drag cursor
14250
-
11976
+ }
14251
11977
 
11978
+ // drag cursor
14252
11979
  state.canvas.classList.remove('grabbable');
14253
11980
  state.isPointerDragging = false;
14254
-
14255
11981
  if (obj.__dragged) {
14256
11982
  delete obj.__dragged;
14257
11983
  state.onNodeDragEnd(obj, translate);
14258
11984
  }
14259
- })); // Setup zoom / pan interaction
11985
+ }));
14260
11986
 
11987
+ // Setup zoom / pan interaction
14261
11988
  state.zoom(state.zoom.__baseElem = d3Select(state.canvas)); // Attach controlling elem for easy access
14262
11989
 
14263
11990
  state.zoom.__baseElem.on('dblclick.zoom', null); // Disable double-click to zoom
14264
11991
 
14265
-
14266
11992
  state.zoom.filter(function (ev) {
14267
- return (// disable zoom interaction
11993
+ return (
11994
+ // disable zoom interaction
14268
11995
  !ev.button && state.enableZoomPanInteraction && (state.enableZoomInteraction || ev.type !== 'wheel') && (state.enablePanInteraction || ev.type === 'wheel')
14269
11996
  );
14270
11997
  }).on('zoom', function (ev) {
@@ -14275,7 +12002,6 @@
14275
12002
  c.scale(t.k, t.k);
14276
12003
  });
14277
12004
  state.onZoom && state.onZoom(_objectSpread2(_objectSpread2({}, t), _this.centerAt())); // report x,y coordinates relative to canvas center
14278
-
14279
12005
  state.needsRedraw = true;
14280
12006
  }).on('end', function (ev) {
14281
12007
  return state.onZoomEnd && state.onZoomEnd(_objectSpread2(_objectSpread2({}, ev.transform), _this.centerAt()));
@@ -14289,39 +12015,49 @@
14289
12015
  state.zoom.scaleTo(state.zoom.__baseElem, state.lastSetZoom = ZOOM2NODES_FACTOR / Math.cbrt(state.graphData.nodes.length));
14290
12016
  state.needsRedraw = true;
14291
12017
  }
14292
- }); // Setup tooltip
12018
+ });
14293
12019
 
12020
+ // Setup tooltip
14294
12021
  var toolTipElem = document.createElement('div');
14295
12022
  toolTipElem.classList.add('graph-tooltip');
14296
- container.appendChild(toolTipElem); // Capture pointer coords on move or touchstart
12023
+ container.appendChild(toolTipElem);
14297
12024
 
12025
+ // Capture pointer coords on move or touchstart
14298
12026
  ['pointermove', 'pointerdown'].forEach(function (evType) {
14299
12027
  return container.addEventListener(evType, function (ev) {
14300
12028
  if (evType === 'pointerdown') {
14301
12029
  state.isPointerPressed = true; // track click state
14302
-
14303
12030
  state.pointerDownEvent = ev;
14304
- } // detect pointer drag on canvas pan
14305
-
12031
+ }
14306
12032
 
12033
+ // detect pointer drag on canvas pan
14307
12034
  !state.isPointerDragging && ev.type === 'pointermove' && state.onBackgroundClick // only bother detecting drags this way if background clicks are enabled (so they don't trigger accidentally on canvas panning)
14308
12035
  && (ev.pressure > 0 || state.isPointerPressed) // ev.pressure always 0 on Safari, so we use the isPointerPressed tracker
14309
12036
  && (ev.pointerType !== 'touch' || ev.movementX === undefined || [ev.movementX, ev.movementY].some(function (m) {
14310
12037
  return Math.abs(m) > 1;
14311
12038
  })) // relax drag trigger sensitivity on touch events
14312
- && (state.isPointerDragging = true); // update the pointer pos
12039
+ && (state.isPointerDragging = true);
14313
12040
 
12041
+ // update the pointer pos
14314
12042
  var offset = getOffset(container);
14315
12043
  pointerPos.x = ev.pageX - offset.left;
14316
- pointerPos.y = ev.pageY - offset.top; // Move tooltip
12044
+ pointerPos.y = ev.pageY - offset.top;
14317
12045
 
12046
+ // Move tooltip
14318
12047
  toolTipElem.style.top = "".concat(pointerPos.y, "px");
14319
- toolTipElem.style.left = "".concat(pointerPos.x, "px"); //
12048
+ toolTipElem.style.left = "".concat(pointerPos.x, "px");
12049
+
12050
+ // adjust horizontal position to not exceed canvas boundaries
12051
+ toolTipElem.style.transform = "translate(-".concat(pointerPos.x / state.width * 100, "%, ").concat(
12052
+ // flip to above if near bottom
12053
+ state.height - pointerPos.y < 100 ? 'calc(-100% - 8px)' : '21px', ")");
12054
+
12055
+ //
14320
12056
 
14321
12057
  function getOffset(el) {
14322
12058
  var rect = el.getBoundingClientRect(),
14323
- scrollLeft = window.pageXOffset || document.documentElement.scrollLeft,
14324
- scrollTop = window.pageYOffset || document.documentElement.scrollTop;
12059
+ scrollLeft = window.pageXOffset || document.documentElement.scrollLeft,
12060
+ scrollTop = window.pageYOffset || document.documentElement.scrollTop;
14325
12061
  return {
14326
12062
  top: rect.top + scrollTop,
14327
12063
  left: rect.left + scrollLeft
@@ -14330,11 +12066,11 @@
14330
12066
  }, {
14331
12067
  passive: true
14332
12068
  });
14333
- }); // Handle click/touch events on nodes/links
12069
+ });
14334
12070
 
12071
+ // Handle click/touch events on nodes/links
14335
12072
  container.addEventListener('pointerup', function (ev) {
14336
12073
  state.isPointerPressed = false;
14337
-
14338
12074
  if (state.isPointerDragging) {
14339
12075
  state.isPointerDragging = false;
14340
12076
  return; // don't trigger click events after pointer drag (pan / node drag functionality)
@@ -14352,7 +12088,6 @@
14352
12088
  state.onBackgroundClick && state.onBackgroundClick.apply(state, cbEvents);
14353
12089
  }
14354
12090
  }
14355
-
14356
12091
  if (ev.button === 2) {
14357
12092
  // mouse right-click
14358
12093
  if (state.hoverObj) {
@@ -14368,77 +12103,74 @@
14368
12103
  });
14369
12104
  container.addEventListener('contextmenu', function (ev) {
14370
12105
  if (!state.onBackgroundRightClick && !state.onNodeRightClick && !state.onLinkRightClick) return true; // default contextmenu behavior
14371
-
14372
12106
  ev.preventDefault();
14373
12107
  return false;
14374
12108
  });
14375
12109
  state.forceGraph(ctx);
14376
- state.shadowGraph(shadowCtx); //
12110
+ state.shadowGraph(shadowCtx);
12111
+
12112
+ //
14377
12113
 
14378
- var refreshShadowCanvas = lodash_throttle(function () {
12114
+ var refreshShadowCanvas = throttle$1(function () {
14379
12115
  // wipe canvas
14380
- clearCanvas(shadowCtx, state.width, state.height); // Adjust link hover area
12116
+ clearCanvas(shadowCtx, state.width, state.height);
14381
12117
 
12118
+ // Adjust link hover area
14382
12119
  state.shadowGraph.linkWidth(function (l) {
14383
- return index$2(state.linkWidth)(l) + state.linkHoverPrecision;
14384
- }); // redraw
12120
+ return accessorFn(state.linkWidth)(l) + state.linkHoverPrecision;
12121
+ });
14385
12122
 
12123
+ // redraw
14386
12124
  var t = transform(state.canvas);
14387
12125
  state.shadowGraph.globalScale(t.k).tickFrame();
14388
12126
  }, HOVER_CANVAS_THROTTLE_DELAY);
14389
12127
  state.flushShadowCanvas = refreshShadowCanvas.flush; // hook to immediately invoke shadow canvas paint
14390
- // Kick-off renderer
14391
12128
 
12129
+ // Kick-off renderer
14392
12130
  (this._animationCycle = function animate() {
14393
12131
  // IIFE
14394
12132
  var doRedraw = !state.autoPauseRedraw || !!state.needsRedraw || state.forceGraph.isEngineRunning() || state.graphData.links.some(function (d) {
14395
12133
  return d.__photons && d.__photons.length;
14396
12134
  });
14397
12135
  state.needsRedraw = false;
14398
-
14399
12136
  if (state.enablePointerInteraction) {
14400
12137
  // Update tooltip and trigger onHover events
14401
12138
  var obj = !state.isPointerDragging ? getObjUnderPointer() : null; // don't hover during drag
14402
-
14403
12139
  if (obj !== state.hoverObj) {
14404
12140
  var prevObj = state.hoverObj;
14405
12141
  var prevObjType = prevObj ? prevObj.type : null;
14406
12142
  var objType = obj ? obj.type : null;
14407
-
14408
12143
  if (prevObjType && prevObjType !== objType) {
14409
12144
  // Hover out
14410
12145
  var fn = state["on".concat(prevObjType, "Hover")];
14411
12146
  fn && fn(null, prevObj.d);
14412
12147
  }
14413
-
14414
12148
  if (objType) {
14415
12149
  // Hover in
14416
12150
  var _fn2 = state["on".concat(objType, "Hover")];
14417
12151
  _fn2 && _fn2(obj.d, prevObjType === objType ? prevObj.d : null);
14418
12152
  }
14419
-
14420
- var tooltipContent = obj ? index$2(state["".concat(obj.type.toLowerCase(), "Label")])(obj.d) || '' : '';
12153
+ var tooltipContent = obj ? accessorFn(state["".concat(obj.type.toLowerCase(), "Label")])(obj.d) || '' : '';
14421
12154
  toolTipElem.style.visibility = tooltipContent ? 'visible' : 'hidden';
14422
- toolTipElem.innerHTML = tooltipContent; // set pointer if hovered object is clickable
12155
+ toolTipElem.innerHTML = tooltipContent;
14423
12156
 
12157
+ // set pointer if hovered object is clickable
14424
12158
  state.canvas.classList[obj && state["on".concat(objType, "Click")] || !obj && state.onBackgroundClick ? 'add' : 'remove']('clickable');
14425
12159
  state.hoverObj = obj;
14426
12160
  }
14427
-
14428
12161
  doRedraw && refreshShadowCanvas();
14429
12162
  }
14430
-
14431
12163
  if (doRedraw) {
14432
12164
  // Wipe canvas
14433
- clearCanvas(ctx, state.width, state.height); // Frame cycle
12165
+ clearCanvas(ctx, state.width, state.height);
14434
12166
 
12167
+ // Frame cycle
14435
12168
  var globalScale = transform(state.canvas).k;
14436
12169
  state.onRenderFramePre && state.onRenderFramePre(ctx, globalScale);
14437
12170
  state.forceGraph.globalScale(globalScale).tickFrame();
14438
12171
  state.onRenderFramePost && state.onRenderFramePost(ctx, globalScale);
14439
12172
  }
14440
-
14441
- exports$1.update(); // update canvas animation tweens
12173
+ TWEEN$1.update(); // update canvas animation tweens
14442
12174
 
14443
12175
  state.animationFrameRequestId = requestAnimationFrame(animate);
14444
12176
  })();