@plotdb/chart 0.0.3 → 2.0.0

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.
Files changed (194) hide show
  1. package/CHANGELOG.md +34 -1
  2. package/README.md +3 -3
  3. package/{dist/data → data}/index.js +0 -0
  4. package/{dist/chart.css → index.css} +0 -0
  5. package/{dist/chart.js → index.js} +3 -1
  6. package/{dist/chart.min.css → index.min.css} +0 -0
  7. package/index.min.js +1 -0
  8. package/package.json +1 -89
  9. package/{dist/utils → utils}/axis.js +6 -0
  10. package/utils/axis.min.js +1 -0
  11. package/{dist/utils → utils}/config.js +0 -0
  12. package/utils/config.min.js +1 -0
  13. package/{dist/utils → utils}/data.js +0 -0
  14. package/utils/data.min.js +1 -0
  15. package/{dist/utils → utils}/format.js +0 -0
  16. package/utils/format.min.js +1 -0
  17. package/{dist/utils → utils}/legend.css +0 -0
  18. package/{dist/utils → utils}/legend.js +0 -0
  19. package/{dist/utils → utils}/legend.min.css +0 -0
  20. package/utils/legend.min.js +1 -0
  21. package/{dist/utils → utils}/tint.js +0 -0
  22. package/utils/tint.min.js +1 -0
  23. package/{dist/utils → utils}/tip.js +0 -0
  24. package/utils/tip.min.js +1 -0
  25. package/build +0 -39
  26. package/dist/chart.min.js +0 -1
  27. package/dist/utils/axis.min.js +0 -1
  28. package/dist/utils/config.min.js +0 -1
  29. package/dist/utils/data.min.js +0 -1
  30. package/dist/utils/format.min.js +0 -1
  31. package/dist/utils/legend.min.js +0 -1
  32. package/dist/utils/tint.min.js +0 -1
  33. package/dist/utils/tip.min.js +0 -1
  34. package/doc/charts.md +0 -58
  35. package/doc/config.md +0 -44
  36. package/doc/draft/chart.md +0 -146
  37. package/doc/draft/data.md +0 -8
  38. package/doc/draft/definition.md +0 -0
  39. package/doc/draft/events.md +0 -0
  40. package/doc/draft/filter.md +0 -0
  41. package/doc/draft/lifecycle.md +0 -89
  42. package/doc/spec.md +0 -89
  43. package/doc/todo.md +0 -27
  44. package/doc/utils/tip.md +0 -84
  45. package/src/chart.ls +0 -323
  46. package/src/chart.styl +0 -6
  47. package/src/data/en-US/category +0 -20
  48. package/src/data/en-US/fruit +0 -39
  49. package/src/data/en-US/movie +0 -125
  50. package/src/data/en-US/name +0 -58
  51. package/src/data/index.ls +0 -34
  52. package/src/data/zh-TW/category +0 -20
  53. package/src/data/zh-TW/fruits +0 -38
  54. package/src/data/zh-TW/movie +0 -125
  55. package/src/data/zh-TW/names +0 -105
  56. package/src/utils/axis.ls +0 -229
  57. package/src/utils/config.ls +0 -11
  58. package/src/utils/data.ls +0 -104
  59. package/src/utils/format.ls +0 -30
  60. package/src/utils/legend.ls +0 -134
  61. package/src/utils/legend.styl +0 -37
  62. package/src/utils/tint.ls +0 -66
  63. package/src/utils/tip.ls +0 -97
  64. package/web/src/pug/base.pug +0 -20
  65. package/web/src/pug/block/axis/0.0.1/index.ls +0 -38
  66. package/web/src/pug/block/axis/0.0.1/index.pug +0 -1
  67. package/web/src/pug/block/axis-bubble/0.0.1/index.ls +0 -141
  68. package/web/src/pug/block/axis-bubble/0.0.1/index.pug +0 -1
  69. package/web/src/pug/block/bar/0.0.1/index.ls +0 -274
  70. package/web/src/pug/block/bar/0.0.1/index.pug +0 -35
  71. package/web/src/pug/block/bar-list/0.0.1/index.ls +0 -85
  72. package/web/src/pug/block/bar-list/0.0.1/index.pug +0 -30
  73. package/web/src/pug/block/bar-race/0.0.1/index.ls +0 -83
  74. package/web/src/pug/block/bar-race/0.0.1/index.pug +0 -21
  75. package/web/src/pug/block/base/0.0.1/index.ls +0 -67
  76. package/web/src/pug/block/base/0.0.1/index.pug +0 -5
  77. package/web/src/pug/block/blank/0.0.1/index.ls +0 -25
  78. package/web/src/pug/block/blank/0.0.1/index.pug +0 -1
  79. package/web/src/pug/block/bubble/0.0.1/index.ls +0 -220
  80. package/web/src/pug/block/bubble/0.0.1/index.pug +0 -28
  81. package/web/src/pug/block/curve-bar/0.0.1/index.ls +0 -89
  82. package/web/src/pug/block/curve-bar/0.0.1/index.pug +0 -16
  83. package/web/src/pug/block/curve-bar/0.0.1/sample.js +0 -338
  84. package/web/src/pug/block/dumbbell/0.0.1/index.ls +0 -90
  85. package/web/src/pug/block/dumbbell/0.0.1/index.pug +0 -1
  86. package/web/src/pug/block/empty/0.0.1/index.ls +0 -27
  87. package/web/src/pug/block/empty/0.0.1/index.pug +0 -2
  88. package/web/src/pug/block/gauge/0.0.1/index.ls +0 -100
  89. package/web/src/pug/block/gauge/0.0.1/index.pug +0 -31
  90. package/web/src/pug/block/gauge/0.0.1/sample.js +0 -338
  91. package/web/src/pug/block/line/0.0.1/index.ls +0 -302
  92. package/web/src/pug/block/line/0.0.1/index.pug +0 -33
  93. package/web/src/pug/block/number/0.0.1/index.ls +0 -69
  94. package/web/src/pug/block/number/0.0.1/index.pug +0 -20
  95. package/web/src/pug/block/percent-list/0.0.1/index.ls +0 -167
  96. package/web/src/pug/block/percent-list/0.0.1/index.pug +0 -34
  97. package/web/src/pug/block/pie/0.0.1/index.ls +0 -125
  98. package/web/src/pug/block/pie/0.0.1/index.pug +0 -19
  99. package/web/src/pug/block/pie/0.0.1/sample.js +0 -338
  100. package/web/src/pug/block/pie-bubble/0.0.1/index.ls +0 -185
  101. package/web/src/pug/block/pie-bubble/0.0.1/index.pug +0 -40
  102. package/web/src/pug/block/radar/0.0.1/index.ls +0 -113
  103. package/web/src/pug/block/radar/0.0.1/index.pug +0 -1
  104. package/web/src/pug/block/radar/0.0.1/xx +0 -285
  105. package/web/src/pug/block/scatter/0.0.1/index.ls +0 -128
  106. package/web/src/pug/block/scatter/0.0.1/index.pug +0 -30
  107. package/web/src/pug/block/sheet/0.0.1/index.ls +0 -38
  108. package/web/src/pug/block/sheet/0.0.1/index.pug +0 -5
  109. package/web/src/pug/block/table/0.0.1/index.ls +0 -40
  110. package/web/src/pug/block/table/0.0.1/index.pug +0 -3
  111. package/web/src/pug/block/taiwancounty/0.0.1/index.ls +0 -74
  112. package/web/src/pug/block/taiwancounty/0.0.1/index.pug +0 -64
  113. package/web/src/pug/block/taiwantown/0.0.1/index.ls +0 -48
  114. package/web/src/pug/block/taiwantown/0.0.1/index.pug +0 -52
  115. package/web/src/pug/block/taiwanvillage/0.0.1/index.ls +0 -53
  116. package/web/src/pug/block/taiwanvillage/0.0.1/index.pug +0 -52
  117. package/web/src/pug/block/treemap/0.0.1/index.ls +0 -172
  118. package/web/src/pug/block/treemap/0.0.1/index.pug +0 -42
  119. package/web/src/pug/block/voronoi-treemap/0.0.1/index.ls +0 -174
  120. package/web/src/pug/block/voronoi-treemap/0.0.1/index.pug +0 -17
  121. package/web/src/pug/block/voronoi-treemap/0.0.1/sample.js +0 -241
  122. package/web/src/pug/block/wordcloud/0.0.1/index.ls +0 -61
  123. package/web/src/pug/block/wordcloud/0.0.1/index.pug +0 -1
  124. package/web/src/pug/block/worldmap/0.0.1/index.ls +0 -81
  125. package/web/src/pug/block/worldmap/0.0.1/index.pug +0 -12
  126. package/web/src/pug/index.ls +0 -72
  127. package/web/src/pug/index.pug +0 -51
  128. package/web/src/styl/index.styl +0 -0
  129. package/web/static/assets/block/cache.js +0 -4
  130. package/web/static/assets/custom-lib/d3/d3-array.v2.js +0 -1182
  131. package/web/static/assets/custom-lib/d3/d3-array.v2.min.js +0 -2
  132. package/web/static/assets/custom-lib/d3/d3-array.v3.js +0 -1273
  133. package/web/static/assets/custom-lib/d3/d3-array.v3.min.js +0 -1273
  134. package/web/static/assets/custom-lib/d3/d3-axis.v2.min.js +0 -2
  135. package/web/static/assets/custom-lib/d3/d3-brush.v2.min.js +0 -2
  136. package/web/static/assets/custom-lib/d3/d3-color.v2.min.js +0 -2
  137. package/web/static/assets/custom-lib/d3/d3-dispatch.v2.min.js +0 -2
  138. package/web/static/assets/custom-lib/d3/d3-drag.v2.min.js +0 -2
  139. package/web/static/assets/custom-lib/d3/d3-ease.v2.min.js +0 -2
  140. package/web/static/assets/custom-lib/d3/d3-force-boundary.v0.0.1.min.js +0 -2
  141. package/web/static/assets/custom-lib/d3/d3-force.v2.min.js +0 -2
  142. package/web/static/assets/custom-lib/d3/d3-format.v2.min.js +0 -2
  143. package/web/static/assets/custom-lib/d3/d3-geo.v2.js +0 -3127
  144. package/web/static/assets/custom-lib/d3/d3-geo.v2.min.js +0 -2
  145. package/web/static/assets/custom-lib/d3/d3-hierarchy.v2.min.js +0 -2
  146. package/web/static/assets/custom-lib/d3/d3-interpolate.v2.min.js +0 -2
  147. package/web/static/assets/custom-lib/d3/d3-path.v2.min.js +0 -2
  148. package/web/static/assets/custom-lib/d3/d3-quadtree.v2.min.js +0 -2
  149. package/web/static/assets/custom-lib/d3/d3-random.v2.min.js +0 -2
  150. package/web/static/assets/custom-lib/d3/d3-scale-chromatic.v1.min.js +0 -2
  151. package/web/static/assets/custom-lib/d3/d3-selection.v2.min.js +0 -2
  152. package/web/static/assets/custom-lib/d3/d3-shape.v2.min.js +0 -2
  153. package/web/static/assets/custom-lib/d3/d3-timer.v2.min.js +0 -2
  154. package/web/static/assets/custom-lib/d3/d3-transition.v2.min.js +0 -2
  155. package/web/static/assets/custom-lib/d3/d3.v4.js +0 -17178
  156. package/web/static/assets/custom-lib/d3/d3.v4.min.js +0 -2
  157. package/web/static/assets/custom-lib/d3/d3.v6.js +0 -19708
  158. package/web/static/assets/data/countrycode.json +0 -1
  159. package/web/static/assets/data/world-110m.json +0 -1
  160. package/web/static/assets/data/zh-to-alpha2.json +0 -1
  161. package/web/static/assets/img/fluid.svg +0 -16
  162. package/web/static/block/axis/0.0.1/index.html +0 -79
  163. package/web/static/block/axis-bubble/0.0.1/index.html +0 -222
  164. package/web/static/block/bar/0.0.1/index.html +0 -581
  165. package/web/static/block/bar-list/0.0.1/index.html +0 -231
  166. package/web/static/block/bar-race/0.0.1/index.html +0 -184
  167. package/web/static/block/base/0.0.1/index.html +0 -197
  168. package/web/static/block/blank/0.0.1/index.html +0 -42
  169. package/web/static/block/bubble/0.0.1/index.html +0 -402
  170. package/web/static/block/bubble/0.0.1/test.html +0 -0
  171. package/web/static/block/curve-bar/0.0.1/index.html +0 -148
  172. package/web/static/block/dumbbell/0.0.1/index.html +0 -178
  173. package/web/static/block/empty/0.0.1/index.html +0 -76
  174. package/web/static/block/gauge/0.0.1/index.html +0 -150
  175. package/web/static/block/line/0.0.1/index.html +0 -571
  176. package/web/static/block/number/0.0.1/index.html +0 -152
  177. package/web/static/block/percent-list/0.0.1/index.html +0 -316
  178. package/web/static/block/pie/0.0.1/index.html +0 -281
  179. package/web/static/block/pie-bubble/0.0.1/index.html +0 -358
  180. package/web/static/block/radar/0.0.1/index.html +0 -149
  181. package/web/static/block/scatter/0.0.1/index.html +0 -251
  182. package/web/static/block/sheet/0.0.1/index.html +0 -103
  183. package/web/static/block/table/0.0.1/index.html +0 -73
  184. package/web/static/block/taiwancounty/0.0.1/index.html +0 -202
  185. package/web/static/block/taiwantown/0.0.1/index.html +0 -210
  186. package/web/static/block/taiwanvillage/0.0.1/index.html +0 -220
  187. package/web/static/block/treemap/0.0.1/index.html +0 -360
  188. package/web/static/block/voronoi-treemap/0.0.1/index.html +0 -350
  189. package/web/static/block/wordcloud/0.0.1/index.html +0 -92
  190. package/web/static/block/worldmap/0.0.1/index.html +0 -207
  191. package/web/static/css/index.css +0 -0
  192. package/web/static/css/index.min.css +0 -0
  193. package/web/static/favicon.ico +0 -0
  194. package/web/static/index.html +0 -153
@@ -1,1273 +0,0 @@
1
- // https://d3js.org/d3-array/ v3.1.1 Copyright 2010-2021 Mike Bostock
2
- (function (global, factory) {
3
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
4
- typeof define === 'function' && define.amd ? define(['exports'], factory) :
5
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.d3 = global.d3 || {}));
6
- })(this, (function (exports) { 'use strict';
7
-
8
- function ascending(a, b) {
9
- return a == null || b == null ? NaN : a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;
10
- }
11
-
12
- function bisector(f) {
13
- let delta = f;
14
- let compare1 = f;
15
- let compare2 = f;
16
-
17
- if (f.length !== 2) {
18
- delta = (d, x) => f(d) - x;
19
- compare1 = ascending;
20
- compare2 = (d, x) => ascending(f(d), x);
21
- }
22
-
23
- function left(a, x, lo = 0, hi = a.length) {
24
- if (lo < hi) {
25
- if (compare1(x, x) !== 0) return hi;
26
- do {
27
- const mid = (lo + hi) >>> 1;
28
- if (compare2(a[mid], x) < 0) lo = mid + 1;
29
- else hi = mid;
30
- } while (lo < hi);
31
- }
32
- return lo;
33
- }
34
-
35
- function right(a, x, lo = 0, hi = a.length) {
36
- if (lo < hi) {
37
- if (compare1(x, x) !== 0) return hi;
38
- do {
39
- const mid = (lo + hi) >>> 1;
40
- if (compare2(a[mid], x) <= 0) lo = mid + 1;
41
- else hi = mid;
42
- } while (lo < hi);
43
- }
44
- return lo;
45
- }
46
-
47
- function center(a, x, lo = 0, hi = a.length) {
48
- const i = left(a, x, lo, hi - 1);
49
- return i > lo && delta(a[i - 1], x) > -delta(a[i], x) ? i - 1 : i;
50
- }
51
-
52
- return {left, center, right};
53
- }
54
-
55
- function number(x) {
56
- return x === null ? NaN : +x;
57
- }
58
-
59
- function* numbers(values, valueof) {
60
- if (valueof === undefined) {
61
- for (let value of values) {
62
- if (value != null && (value = +value) >= value) {
63
- yield value;
64
- }
65
- }
66
- } else {
67
- let index = -1;
68
- for (let value of values) {
69
- if ((value = valueof(value, ++index, values)) != null && (value = +value) >= value) {
70
- yield value;
71
- }
72
- }
73
- }
74
- }
75
-
76
- const ascendingBisect = bisector(ascending);
77
- const bisectRight = ascendingBisect.right;
78
- const bisectLeft = ascendingBisect.left;
79
- const bisectCenter = bisector(number).center;
80
- var bisect = bisectRight;
81
-
82
- function count(values, valueof) {
83
- let count = 0;
84
- if (valueof === undefined) {
85
- for (let value of values) {
86
- if (value != null && (value = +value) >= value) {
87
- ++count;
88
- }
89
- }
90
- } else {
91
- let index = -1;
92
- for (let value of values) {
93
- if ((value = valueof(value, ++index, values)) != null && (value = +value) >= value) {
94
- ++count;
95
- }
96
- }
97
- }
98
- return count;
99
- }
100
-
101
- function length$1(array) {
102
- return array.length | 0;
103
- }
104
-
105
- function empty(length) {
106
- return !(length > 0);
107
- }
108
-
109
- function arrayify(values) {
110
- return typeof values !== "object" || "length" in values ? values : Array.from(values);
111
- }
112
-
113
- function reducer(reduce) {
114
- return values => reduce(...values);
115
- }
116
-
117
- function cross(...values) {
118
- const reduce = typeof values[values.length - 1] === "function" && reducer(values.pop());
119
- values = values.map(arrayify);
120
- const lengths = values.map(length$1);
121
- const j = values.length - 1;
122
- const index = new Array(j + 1).fill(0);
123
- const product = [];
124
- if (j < 0 || lengths.some(empty)) return product;
125
- while (true) {
126
- product.push(index.map((j, i) => values[i][j]));
127
- let i = j;
128
- while (++index[i] === lengths[i]) {
129
- if (i === 0) return reduce ? product.map(reduce) : product;
130
- index[i--] = 0;
131
- }
132
- }
133
- }
134
-
135
- function cumsum(values, valueof) {
136
- var sum = 0, index = 0;
137
- return Float64Array.from(values, valueof === undefined
138
- ? v => (sum += +v || 0)
139
- : v => (sum += +valueof(v, index++, values) || 0));
140
- }
141
-
142
- function descending(a, b) {
143
- return a == null || b == null ? NaN
144
- : b < a ? -1
145
- : b > a ? 1
146
- : b >= a ? 0
147
- : NaN;
148
- }
149
-
150
- function variance(values, valueof) {
151
- let count = 0;
152
- let delta;
153
- let mean = 0;
154
- let sum = 0;
155
- if (valueof === undefined) {
156
- for (let value of values) {
157
- if (value != null && (value = +value) >= value) {
158
- delta = value - mean;
159
- mean += delta / ++count;
160
- sum += delta * (value - mean);
161
- }
162
- }
163
- } else {
164
- let index = -1;
165
- for (let value of values) {
166
- if ((value = valueof(value, ++index, values)) != null && (value = +value) >= value) {
167
- delta = value - mean;
168
- mean += delta / ++count;
169
- sum += delta * (value - mean);
170
- }
171
- }
172
- }
173
- if (count > 1) return sum / (count - 1);
174
- }
175
-
176
- function deviation(values, valueof) {
177
- const v = variance(values, valueof);
178
- return v ? Math.sqrt(v) : v;
179
- }
180
-
181
- function extent(values, valueof) {
182
- let min;
183
- let max;
184
- if (valueof === undefined) {
185
- for (const value of values) {
186
- if (value != null) {
187
- if (min === undefined) {
188
- if (value >= value) min = max = value;
189
- } else {
190
- if (min > value) min = value;
191
- if (max < value) max = value;
192
- }
193
- }
194
- }
195
- } else {
196
- let index = -1;
197
- for (let value of values) {
198
- if ((value = valueof(value, ++index, values)) != null) {
199
- if (min === undefined) {
200
- if (value >= value) min = max = value;
201
- } else {
202
- if (min > value) min = value;
203
- if (max < value) max = value;
204
- }
205
- }
206
- }
207
- }
208
- return [min, max];
209
- }
210
-
211
- // https://github.com/python/cpython/blob/a74eea238f5baba15797e2e8b570d153bc8690a7/Modules/mathmodule.c#L1423
212
- class Adder {
213
- constructor() {
214
- this._partials = new Float64Array(32);
215
- this._n = 0;
216
- }
217
- add(x) {
218
- const p = this._partials;
219
- let i = 0;
220
- for (let j = 0; j < this._n && j < 32; j++) {
221
- const y = p[j],
222
- hi = x + y,
223
- lo = Math.abs(x) < Math.abs(y) ? x - (hi - y) : y - (hi - x);
224
- if (lo) p[i++] = lo;
225
- x = hi;
226
- }
227
- p[i] = x;
228
- this._n = i + 1;
229
- return this;
230
- }
231
- valueOf() {
232
- const p = this._partials;
233
- let n = this._n, x, y, lo, hi = 0;
234
- if (n > 0) {
235
- hi = p[--n];
236
- while (n > 0) {
237
- x = hi;
238
- y = p[--n];
239
- hi = x + y;
240
- lo = y - (hi - x);
241
- if (lo) break;
242
- }
243
- if (n > 0 && ((lo < 0 && p[n - 1] < 0) || (lo > 0 && p[n - 1] > 0))) {
244
- y = lo * 2;
245
- x = hi + y;
246
- if (y == x - hi) hi = x;
247
- }
248
- }
249
- return hi;
250
- }
251
- }
252
-
253
- function fsum(values, valueof) {
254
- const adder = new Adder();
255
- if (valueof === undefined) {
256
- for (let value of values) {
257
- if (value = +value) {
258
- adder.add(value);
259
- }
260
- }
261
- } else {
262
- let index = -1;
263
- for (let value of values) {
264
- if (value = +valueof(value, ++index, values)) {
265
- adder.add(value);
266
- }
267
- }
268
- }
269
- return +adder;
270
- }
271
-
272
- function fcumsum(values, valueof) {
273
- const adder = new Adder();
274
- let index = -1;
275
- return Float64Array.from(values, valueof === undefined
276
- ? v => adder.add(+v || 0)
277
- : v => adder.add(+valueof(v, ++index, values) || 0)
278
- );
279
- }
280
-
281
- class InternMap extends Map {
282
- constructor(entries, key = keyof) {
283
- super();
284
- Object.defineProperties(this, {_intern: {value: new Map()}, _key: {value: key}});
285
- if (entries != null) for (const [key, value] of entries) this.set(key, value);
286
- }
287
- get(key) {
288
- return super.get(intern_get(this, key));
289
- }
290
- has(key) {
291
- return super.has(intern_get(this, key));
292
- }
293
- set(key, value) {
294
- return super.set(intern_set(this, key), value);
295
- }
296
- delete(key) {
297
- return super.delete(intern_delete(this, key));
298
- }
299
- }
300
-
301
- class InternSet extends Set {
302
- constructor(values, key = keyof) {
303
- super();
304
- Object.defineProperties(this, {_intern: {value: new Map()}, _key: {value: key}});
305
- if (values != null) for (const value of values) this.add(value);
306
- }
307
- has(value) {
308
- return super.has(intern_get(this, value));
309
- }
310
- add(value) {
311
- return super.add(intern_set(this, value));
312
- }
313
- delete(value) {
314
- return super.delete(intern_delete(this, value));
315
- }
316
- }
317
-
318
- function intern_get({_intern, _key}, value) {
319
- const key = _key(value);
320
- return _intern.has(key) ? _intern.get(key) : value;
321
- }
322
-
323
- function intern_set({_intern, _key}, value) {
324
- const key = _key(value);
325
- if (_intern.has(key)) return _intern.get(key);
326
- _intern.set(key, value);
327
- return value;
328
- }
329
-
330
- function intern_delete({_intern, _key}, value) {
331
- const key = _key(value);
332
- if (_intern.has(key)) {
333
- value = _intern.get(key);
334
- _intern.delete(key);
335
- }
336
- return value;
337
- }
338
-
339
- function keyof(value) {
340
- return value !== null && typeof value === "object" ? value.valueOf() : value;
341
- }
342
-
343
- function identity(x) {
344
- return x;
345
- }
346
-
347
- function group(values, ...keys) {
348
- return nest(values, identity, identity, keys);
349
- }
350
-
351
- function groups(values, ...keys) {
352
- return nest(values, Array.from, identity, keys);
353
- }
354
-
355
- function flatten$1(groups, keys) {
356
- for (let i = 1, n = keys.length; i < n; ++i) {
357
- groups = groups.flatMap(g => g.pop().map(([key, value]) => [...g, key, value]));
358
- }
359
- return groups;
360
- }
361
-
362
- function flatGroup(values, ...keys) {
363
- return flatten$1(groups(values, ...keys), keys);
364
- }
365
-
366
- function flatRollup(values, reduce, ...keys) {
367
- return flatten$1(rollups(values, reduce, ...keys), keys);
368
- }
369
-
370
- function rollup(values, reduce, ...keys) {
371
- return nest(values, identity, reduce, keys);
372
- }
373
-
374
- function rollups(values, reduce, ...keys) {
375
- return nest(values, Array.from, reduce, keys);
376
- }
377
-
378
- function index(values, ...keys) {
379
- return nest(values, identity, unique, keys);
380
- }
381
-
382
- function indexes(values, ...keys) {
383
- return nest(values, Array.from, unique, keys);
384
- }
385
-
386
- function unique(values) {
387
- if (values.length !== 1) throw new Error("duplicate key");
388
- return values[0];
389
- }
390
-
391
- function nest(values, map, reduce, keys) {
392
- return (function regroup(values, i) {
393
- if (i >= keys.length) return reduce(values);
394
- const groups = new InternMap();
395
- const keyof = keys[i++];
396
- let index = -1;
397
- for (const value of values) {
398
- const key = keyof(value, ++index, values);
399
- const group = groups.get(key);
400
- if (group) group.push(value);
401
- else groups.set(key, [value]);
402
- }
403
- for (const [key, values] of groups) {
404
- groups.set(key, regroup(values, i));
405
- }
406
- return map(groups);
407
- })(values, 0);
408
- }
409
-
410
- function permute(source, keys) {
411
- return Array.from(keys, key => source[key]);
412
- }
413
-
414
- function sort(values, ...F) {
415
- if (typeof values[Symbol.iterator] !== "function") throw new TypeError("values is not iterable");
416
- values = Array.from(values);
417
- let [f] = F;
418
- if ((f && f.length !== 2) || F.length > 1) {
419
- const index = Uint32Array.from(values, (d, i) => i);
420
- if (F.length > 1) {
421
- F = F.map(f => values.map(f));
422
- index.sort((i, j) => {
423
- for (const f of F) {
424
- const c = ascendingDefined(f[i], f[j]);
425
- if (c) return c;
426
- }
427
- });
428
- } else {
429
- f = values.map(f);
430
- index.sort((i, j) => ascendingDefined(f[i], f[j]));
431
- }
432
- return permute(values, index);
433
- }
434
- return values.sort(compareDefined(f));
435
- }
436
-
437
- function compareDefined(compare = ascending) {
438
- if (compare === ascending) return ascendingDefined;
439
- if (typeof compare !== "function") throw new TypeError("compare is not a function");
440
- return (a, b) => {
441
- const x = compare(a, b);
442
- if (x || x === 0) return x;
443
- return (compare(b, b) === 0) - (compare(a, a) === 0);
444
- };
445
- }
446
-
447
- function ascendingDefined(a, b) {
448
- return (a == null || !(a >= a)) - (b == null || !(b >= b)) || (a < b ? -1 : a > b ? 1 : 0);
449
- }
450
-
451
- function groupSort(values, reduce, key) {
452
- return (reduce.length !== 2
453
- ? sort(rollup(values, reduce, key), (([ak, av], [bk, bv]) => ascending(av, bv) || ascending(ak, bk)))
454
- : sort(group(values, key), (([ak, av], [bk, bv]) => reduce(av, bv) || ascending(ak, bk))))
455
- .map(([key]) => key);
456
- }
457
-
458
- var array = Array.prototype;
459
-
460
- var slice = array.slice;
461
-
462
- function constant(x) {
463
- return () => x;
464
- }
465
-
466
- var e10 = Math.sqrt(50),
467
- e5 = Math.sqrt(10),
468
- e2 = Math.sqrt(2);
469
-
470
- function ticks(start, stop, count) {
471
- var reverse,
472
- i = -1,
473
- n,
474
- ticks,
475
- step;
476
-
477
- stop = +stop, start = +start, count = +count;
478
- if (start === stop && count > 0) return [start];
479
- if (reverse = stop < start) n = start, start = stop, stop = n;
480
- if ((step = tickIncrement(start, stop, count)) === 0 || !isFinite(step)) return [];
481
-
482
- if (step > 0) {
483
- let r0 = Math.round(start / step), r1 = Math.round(stop / step);
484
- if (r0 * step < start) ++r0;
485
- if (r1 * step > stop) --r1;
486
- ticks = new Array(n = r1 - r0 + 1);
487
- while (++i < n) ticks[i] = (r0 + i) * step;
488
- } else {
489
- step = -step;
490
- let r0 = Math.round(start * step), r1 = Math.round(stop * step);
491
- if (r0 / step < start) ++r0;
492
- if (r1 / step > stop) --r1;
493
- ticks = new Array(n = r1 - r0 + 1);
494
- while (++i < n) ticks[i] = (r0 + i) / step;
495
- }
496
-
497
- if (reverse) ticks.reverse();
498
-
499
- return ticks;
500
- }
501
-
502
- function tickIncrement(start, stop, count) {
503
- var step = (stop - start) / Math.max(0, count),
504
- power = Math.floor(Math.log(step) / Math.LN10),
505
- error = step / Math.pow(10, power);
506
- return power >= 0
507
- ? (error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1) * Math.pow(10, power)
508
- : -Math.pow(10, -power) / (error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1);
509
- }
510
-
511
- function tickStep(start, stop, count) {
512
- var step0 = Math.abs(stop - start) / Math.max(0, count),
513
- step1 = Math.pow(10, Math.floor(Math.log(step0) / Math.LN10)),
514
- error = step0 / step1;
515
- if (error >= e10) step1 *= 10;
516
- else if (error >= e5) step1 *= 5;
517
- else if (error >= e2) step1 *= 2;
518
- return stop < start ? -step1 : step1;
519
- }
520
-
521
- function nice(start, stop, count) {
522
- let prestep;
523
- while (true) {
524
- const step = tickIncrement(start, stop, count);
525
- if (step === prestep || step === 0 || !isFinite(step)) {
526
- return [start, stop];
527
- } else if (step > 0) {
528
- start = Math.floor(start / step) * step;
529
- stop = Math.ceil(stop / step) * step;
530
- } else if (step < 0) {
531
- start = Math.ceil(start * step) / step;
532
- stop = Math.floor(stop * step) / step;
533
- }
534
- prestep = step;
535
- }
536
- }
537
-
538
- function thresholdSturges(values) {
539
- return Math.ceil(Math.log(count(values)) / Math.LN2) + 1;
540
- }
541
-
542
- function bin() {
543
- var value = identity,
544
- domain = extent,
545
- threshold = thresholdSturges;
546
-
547
- function histogram(data) {
548
- if (!Array.isArray(data)) data = Array.from(data);
549
-
550
- var i,
551
- n = data.length,
552
- x,
553
- values = new Array(n);
554
-
555
- for (i = 0; i < n; ++i) {
556
- values[i] = value(data[i], i, data);
557
- }
558
-
559
- var xz = domain(values),
560
- x0 = xz[0],
561
- x1 = xz[1],
562
- tz = threshold(values, x0, x1);
563
-
564
- // Convert number of thresholds into uniform thresholds, and nice the
565
- // default domain accordingly.
566
- if (!Array.isArray(tz)) {
567
- const max = x1, tn = +tz;
568
- if (domain === extent) [x0, x1] = nice(x0, x1, tn);
569
- tz = ticks(x0, x1, tn);
570
-
571
- // If the last threshold is coincident with the domain’s upper bound, the
572
- // last bin will be zero-width. If the default domain is used, and this
573
- // last threshold is coincident with the maximum input value, we can
574
- // extend the niced upper bound by one tick to ensure uniform bin widths;
575
- // otherwise, we simply remove the last threshold. Note that we don’t
576
- // coerce values or the domain to numbers, and thus must be careful to
577
- // compare order (>=) rather than strict equality (===)!
578
- if (tz[tz.length - 1] >= x1) {
579
- if (max >= x1 && domain === extent) {
580
- const step = tickIncrement(x0, x1, tn);
581
- if (isFinite(step)) {
582
- if (step > 0) {
583
- x1 = (Math.floor(x1 / step) + 1) * step;
584
- } else if (step < 0) {
585
- x1 = (Math.ceil(x1 * -step) + 1) / -step;
586
- }
587
- }
588
- } else {
589
- tz.pop();
590
- }
591
- }
592
- }
593
-
594
- // Remove any thresholds outside the domain.
595
- var m = tz.length;
596
- while (tz[0] <= x0) tz.shift(), --m;
597
- while (tz[m - 1] > x1) tz.pop(), --m;
598
-
599
- var bins = new Array(m + 1),
600
- bin;
601
-
602
- // Initialize bins.
603
- for (i = 0; i <= m; ++i) {
604
- bin = bins[i] = [];
605
- bin.x0 = i > 0 ? tz[i - 1] : x0;
606
- bin.x1 = i < m ? tz[i] : x1;
607
- }
608
-
609
- // Assign data to bins by value, ignoring any outside the domain.
610
- for (i = 0; i < n; ++i) {
611
- x = values[i];
612
- if (x != null && x0 <= x && x <= x1) {
613
- bins[bisect(tz, x, 0, m)].push(data[i]);
614
- }
615
- }
616
-
617
- return bins;
618
- }
619
-
620
- histogram.value = function(_) {
621
- return arguments.length ? (value = typeof _ === "function" ? _ : constant(_), histogram) : value;
622
- };
623
-
624
- histogram.domain = function(_) {
625
- return arguments.length ? (domain = typeof _ === "function" ? _ : constant([_[0], _[1]]), histogram) : domain;
626
- };
627
-
628
- histogram.thresholds = function(_) {
629
- return arguments.length ? (threshold = typeof _ === "function" ? _ : Array.isArray(_) ? constant(slice.call(_)) : constant(_), histogram) : threshold;
630
- };
631
-
632
- return histogram;
633
- }
634
-
635
- function max(values, valueof) {
636
- let max;
637
- if (valueof === undefined) {
638
- for (const value of values) {
639
- if (value != null
640
- && (max < value || (max === undefined && value >= value))) {
641
- max = value;
642
- }
643
- }
644
- } else {
645
- let index = -1;
646
- for (let value of values) {
647
- if ((value = valueof(value, ++index, values)) != null
648
- && (max < value || (max === undefined && value >= value))) {
649
- max = value;
650
- }
651
- }
652
- }
653
- return max;
654
- }
655
-
656
- function min(values, valueof) {
657
- let min;
658
- if (valueof === undefined) {
659
- for (const value of values) {
660
- if (value != null
661
- && (min > value || (min === undefined && value >= value))) {
662
- min = value;
663
- }
664
- }
665
- } else {
666
- let index = -1;
667
- for (let value of values) {
668
- if ((value = valueof(value, ++index, values)) != null
669
- && (min > value || (min === undefined && value >= value))) {
670
- min = value;
671
- }
672
- }
673
- }
674
- return min;
675
- }
676
-
677
- // Based on https://github.com/mourner/quickselect
678
- // ISC license, Copyright 2018 Vladimir Agafonkin.
679
- function quickselect(array, k, left = 0, right = array.length - 1, compare) {
680
- compare = compare === undefined ? ascendingDefined : compareDefined(compare);
681
-
682
- while (right > left) {
683
- if (right - left > 600) {
684
- const n = right - left + 1;
685
- const m = k - left + 1;
686
- const z = Math.log(n);
687
- const s = 0.5 * Math.exp(2 * z / 3);
688
- const sd = 0.5 * Math.sqrt(z * s * (n - s) / n) * (m - n / 2 < 0 ? -1 : 1);
689
- const newLeft = Math.max(left, Math.floor(k - m * s / n + sd));
690
- const newRight = Math.min(right, Math.floor(k + (n - m) * s / n + sd));
691
- quickselect(array, k, newLeft, newRight, compare);
692
- }
693
-
694
- const t = array[k];
695
- let i = left;
696
- let j = right;
697
-
698
- swap(array, left, k);
699
- if (compare(array[right], t) > 0) swap(array, left, right);
700
-
701
- while (i < j) {
702
- swap(array, i, j), ++i, --j;
703
- while (compare(array[i], t) < 0) ++i;
704
- while (compare(array[j], t) > 0) --j;
705
- }
706
-
707
- if (compare(array[left], t) === 0) swap(array, left, j);
708
- else ++j, swap(array, j, right);
709
-
710
- if (j <= k) left = j + 1;
711
- if (k <= j) right = j - 1;
712
- }
713
- return array;
714
- }
715
-
716
- function swap(array, i, j) {
717
- const t = array[i];
718
- array[i] = array[j];
719
- array[j] = t;
720
- }
721
-
722
- function quantile(values, p, valueof) {
723
- values = Float64Array.from(numbers(values, valueof));
724
- if (!(n = values.length)) return;
725
- if ((p = +p) <= 0 || n < 2) return min(values);
726
- if (p >= 1) return max(values);
727
- var n,
728
- i = (n - 1) * p,
729
- i0 = Math.floor(i),
730
- value0 = max(quickselect(values, i0).subarray(0, i0 + 1)),
731
- value1 = min(values.subarray(i0 + 1));
732
- return value0 + (value1 - value0) * (i - i0);
733
- }
734
-
735
- function quantileSorted(values, p, valueof = number) {
736
- if (!(n = values.length)) return;
737
- if ((p = +p) <= 0 || n < 2) return +valueof(values[0], 0, values);
738
- if (p >= 1) return +valueof(values[n - 1], n - 1, values);
739
- var n,
740
- i = (n - 1) * p,
741
- i0 = Math.floor(i),
742
- value0 = +valueof(values[i0], i0, values),
743
- value1 = +valueof(values[i0 + 1], i0 + 1, values);
744
- return value0 + (value1 - value0) * (i - i0);
745
- }
746
-
747
- function thresholdFreedmanDiaconis(values, min, max) {
748
- return Math.ceil((max - min) / (2 * (quantile(values, 0.75) - quantile(values, 0.25)) * Math.pow(count(values), -1 / 3)));
749
- }
750
-
751
- function thresholdScott(values, min, max) {
752
- return Math.ceil((max - min) / (3.5 * deviation(values) * Math.pow(count(values), -1 / 3)));
753
- }
754
-
755
- function maxIndex(values, valueof) {
756
- let max;
757
- let maxIndex = -1;
758
- let index = -1;
759
- if (valueof === undefined) {
760
- for (const value of values) {
761
- ++index;
762
- if (value != null
763
- && (max < value || (max === undefined && value >= value))) {
764
- max = value, maxIndex = index;
765
- }
766
- }
767
- } else {
768
- for (let value of values) {
769
- if ((value = valueof(value, ++index, values)) != null
770
- && (max < value || (max === undefined && value >= value))) {
771
- max = value, maxIndex = index;
772
- }
773
- }
774
- }
775
- return maxIndex;
776
- }
777
-
778
- function mean(values, valueof) {
779
- let count = 0;
780
- let sum = 0;
781
- if (valueof === undefined) {
782
- for (let value of values) {
783
- if (value != null && (value = +value) >= value) {
784
- ++count, sum += value;
785
- }
786
- }
787
- } else {
788
- let index = -1;
789
- for (let value of values) {
790
- if ((value = valueof(value, ++index, values)) != null && (value = +value) >= value) {
791
- ++count, sum += value;
792
- }
793
- }
794
- }
795
- if (count) return sum / count;
796
- }
797
-
798
- function median(values, valueof) {
799
- return quantile(values, 0.5, valueof);
800
- }
801
-
802
- function* flatten(arrays) {
803
- for (const array of arrays) {
804
- yield* array;
805
- }
806
- }
807
-
808
- function merge(arrays) {
809
- return Array.from(flatten(arrays));
810
- }
811
-
812
- function minIndex(values, valueof) {
813
- let min;
814
- let minIndex = -1;
815
- let index = -1;
816
- if (valueof === undefined) {
817
- for (const value of values) {
818
- ++index;
819
- if (value != null
820
- && (min > value || (min === undefined && value >= value))) {
821
- min = value, minIndex = index;
822
- }
823
- }
824
- } else {
825
- for (let value of values) {
826
- if ((value = valueof(value, ++index, values)) != null
827
- && (min > value || (min === undefined && value >= value))) {
828
- min = value, minIndex = index;
829
- }
830
- }
831
- }
832
- return minIndex;
833
- }
834
-
835
- function mode(values, valueof) {
836
- const counts = new InternMap();
837
- if (valueof === undefined) {
838
- for (let value of values) {
839
- if (value != null && value >= value) {
840
- counts.set(value, (counts.get(value) || 0) + 1);
841
- }
842
- }
843
- } else {
844
- let index = -1;
845
- for (let value of values) {
846
- if ((value = valueof(value, ++index, values)) != null && value >= value) {
847
- counts.set(value, (counts.get(value) || 0) + 1);
848
- }
849
- }
850
- }
851
- let modeValue;
852
- let modeCount = 0;
853
- for (const [value, count] of counts) {
854
- if (count > modeCount) {
855
- modeCount = count;
856
- modeValue = value;
857
- }
858
- }
859
- return modeValue;
860
- }
861
-
862
- function pairs(values, pairof = pair) {
863
- const pairs = [];
864
- let previous;
865
- let first = false;
866
- for (const value of values) {
867
- if (first) pairs.push(pairof(previous, value));
868
- previous = value;
869
- first = true;
870
- }
871
- return pairs;
872
- }
873
-
874
- function pair(a, b) {
875
- return [a, b];
876
- }
877
-
878
- function range(start, stop, step) {
879
- start = +start, stop = +stop, step = (n = arguments.length) < 2 ? (stop = start, start = 0, 1) : n < 3 ? 1 : +step;
880
-
881
- var i = -1,
882
- n = Math.max(0, Math.ceil((stop - start) / step)) | 0,
883
- range = new Array(n);
884
-
885
- while (++i < n) {
886
- range[i] = start + i * step;
887
- }
888
-
889
- return range;
890
- }
891
-
892
- function rank(values, valueof = ascending) {
893
- if (typeof values[Symbol.iterator] !== "function") throw new TypeError("values is not iterable");
894
- let V = Array.from(values);
895
- const R = new Float64Array(V.length);
896
- if (valueof.length !== 2) V = V.map(valueof), valueof = ascending;
897
- const compareIndex = (i, j) => valueof(V[i], V[j]);
898
- let k, r;
899
- Uint32Array
900
- .from(V, (_, i) => i)
901
- .sort(valueof === ascending ? (i, j) => ascendingDefined(V[i], V[j]) : compareDefined(compareIndex))
902
- .forEach((j, i) => {
903
- const c = compareIndex(j, k === undefined ? j : k);
904
- if (c >= 0) {
905
- if (k === undefined || c > 0) k = j, r = i;
906
- R[j] = r;
907
- } else {
908
- R[j] = NaN;
909
- }
910
- });
911
- return R;
912
- }
913
-
914
- function least(values, compare = ascending) {
915
- let min;
916
- let defined = false;
917
- if (compare.length === 1) {
918
- let minValue;
919
- for (const element of values) {
920
- const value = compare(element);
921
- if (defined
922
- ? ascending(value, minValue) < 0
923
- : ascending(value, value) === 0) {
924
- min = element;
925
- minValue = value;
926
- defined = true;
927
- }
928
- }
929
- } else {
930
- for (const value of values) {
931
- if (defined
932
- ? compare(value, min) < 0
933
- : compare(value, value) === 0) {
934
- min = value;
935
- defined = true;
936
- }
937
- }
938
- }
939
- return min;
940
- }
941
-
942
- function leastIndex(values, compare = ascending) {
943
- if (compare.length === 1) return minIndex(values, compare);
944
- let minValue;
945
- let min = -1;
946
- let index = -1;
947
- for (const value of values) {
948
- ++index;
949
- if (min < 0
950
- ? compare(value, value) === 0
951
- : compare(value, minValue) < 0) {
952
- minValue = value;
953
- min = index;
954
- }
955
- }
956
- return min;
957
- }
958
-
959
- function greatest(values, compare = ascending) {
960
- let max;
961
- let defined = false;
962
- if (compare.length === 1) {
963
- let maxValue;
964
- for (const element of values) {
965
- const value = compare(element);
966
- if (defined
967
- ? ascending(value, maxValue) > 0
968
- : ascending(value, value) === 0) {
969
- max = element;
970
- maxValue = value;
971
- defined = true;
972
- }
973
- }
974
- } else {
975
- for (const value of values) {
976
- if (defined
977
- ? compare(value, max) > 0
978
- : compare(value, value) === 0) {
979
- max = value;
980
- defined = true;
981
- }
982
- }
983
- }
984
- return max;
985
- }
986
-
987
- function greatestIndex(values, compare = ascending) {
988
- if (compare.length === 1) return maxIndex(values, compare);
989
- let maxValue;
990
- let max = -1;
991
- let index = -1;
992
- for (const value of values) {
993
- ++index;
994
- if (max < 0
995
- ? compare(value, value) === 0
996
- : compare(value, maxValue) > 0) {
997
- maxValue = value;
998
- max = index;
999
- }
1000
- }
1001
- return max;
1002
- }
1003
-
1004
- function scan(values, compare) {
1005
- const index = leastIndex(values, compare);
1006
- return index < 0 ? undefined : index;
1007
- }
1008
-
1009
- var shuffle = shuffler(Math.random);
1010
-
1011
- function shuffler(random) {
1012
- return function shuffle(array, i0 = 0, i1 = array.length) {
1013
- let m = i1 - (i0 = +i0);
1014
- while (m) {
1015
- const i = random() * m-- | 0, t = array[m + i0];
1016
- array[m + i0] = array[i + i0];
1017
- array[i + i0] = t;
1018
- }
1019
- return array;
1020
- };
1021
- }
1022
-
1023
- function sum(values, valueof) {
1024
- let sum = 0;
1025
- if (valueof === undefined) {
1026
- for (let value of values) {
1027
- if (value = +value) {
1028
- sum += value;
1029
- }
1030
- }
1031
- } else {
1032
- let index = -1;
1033
- for (let value of values) {
1034
- if (value = +valueof(value, ++index, values)) {
1035
- sum += value;
1036
- }
1037
- }
1038
- }
1039
- return sum;
1040
- }
1041
-
1042
- function transpose(matrix) {
1043
- if (!(n = matrix.length)) return [];
1044
- for (var i = -1, m = min(matrix, length), transpose = new Array(m); ++i < m;) {
1045
- for (var j = -1, n, row = transpose[i] = new Array(n); ++j < n;) {
1046
- row[j] = matrix[j][i];
1047
- }
1048
- }
1049
- return transpose;
1050
- }
1051
-
1052
- function length(d) {
1053
- return d.length;
1054
- }
1055
-
1056
- function zip() {
1057
- return transpose(arguments);
1058
- }
1059
-
1060
- function every(values, test) {
1061
- if (typeof test !== "function") throw new TypeError("test is not a function");
1062
- let index = -1;
1063
- for (const value of values) {
1064
- if (!test(value, ++index, values)) {
1065
- return false;
1066
- }
1067
- }
1068
- return true;
1069
- }
1070
-
1071
- function some(values, test) {
1072
- if (typeof test !== "function") throw new TypeError("test is not a function");
1073
- let index = -1;
1074
- for (const value of values) {
1075
- if (test(value, ++index, values)) {
1076
- return true;
1077
- }
1078
- }
1079
- return false;
1080
- }
1081
-
1082
- function filter(values, test) {
1083
- if (typeof test !== "function") throw new TypeError("test is not a function");
1084
- const array = [];
1085
- let index = -1;
1086
- for (const value of values) {
1087
- if (test(value, ++index, values)) {
1088
- array.push(value);
1089
- }
1090
- }
1091
- return array;
1092
- }
1093
-
1094
- function map(values, mapper) {
1095
- if (typeof values[Symbol.iterator] !== "function") throw new TypeError("values is not iterable");
1096
- if (typeof mapper !== "function") throw new TypeError("mapper is not a function");
1097
- return Array.from(values, (value, index) => mapper(value, index, values));
1098
- }
1099
-
1100
- function reduce(values, reducer, value) {
1101
- if (typeof reducer !== "function") throw new TypeError("reducer is not a function");
1102
- const iterator = values[Symbol.iterator]();
1103
- let done, next, index = -1;
1104
- if (arguments.length < 3) {
1105
- ({done, value} = iterator.next());
1106
- if (done) return;
1107
- ++index;
1108
- }
1109
- while (({done, value: next} = iterator.next()), !done) {
1110
- value = reducer(value, next, ++index, values);
1111
- }
1112
- return value;
1113
- }
1114
-
1115
- function reverse(values) {
1116
- if (typeof values[Symbol.iterator] !== "function") throw new TypeError("values is not iterable");
1117
- return Array.from(values).reverse();
1118
- }
1119
-
1120
- function difference(values, ...others) {
1121
- values = new InternSet(values);
1122
- for (const other of others) {
1123
- for (const value of other) {
1124
- values.delete(value);
1125
- }
1126
- }
1127
- return values;
1128
- }
1129
-
1130
- function disjoint(values, other) {
1131
- const iterator = other[Symbol.iterator](), set = new InternSet();
1132
- for (const v of values) {
1133
- if (set.has(v)) return false;
1134
- let value, done;
1135
- while (({value, done} = iterator.next())) {
1136
- if (done) break;
1137
- if (Object.is(v, value)) return false;
1138
- set.add(value);
1139
- }
1140
- }
1141
- return true;
1142
- }
1143
-
1144
- function intersection(values, ...others) {
1145
- values = new InternSet(values);
1146
- others = others.map(set);
1147
- out: for (const value of values) {
1148
- for (const other of others) {
1149
- if (!other.has(value)) {
1150
- values.delete(value);
1151
- continue out;
1152
- }
1153
- }
1154
- }
1155
- return values;
1156
- }
1157
-
1158
- function set(values) {
1159
- return values instanceof InternSet ? values : new InternSet(values);
1160
- }
1161
-
1162
- function superset(values, other) {
1163
- const iterator = values[Symbol.iterator](), set = new Set();
1164
- for (const o of other) {
1165
- const io = intern(o);
1166
- if (set.has(io)) continue;
1167
- let value, done;
1168
- while (({value, done} = iterator.next())) {
1169
- if (done) return false;
1170
- const ivalue = intern(value);
1171
- set.add(ivalue);
1172
- if (Object.is(io, ivalue)) break;
1173
- }
1174
- }
1175
- return true;
1176
- }
1177
-
1178
- function intern(value) {
1179
- return value !== null && typeof value === "object" ? value.valueOf() : value;
1180
- }
1181
-
1182
- function subset(values, other) {
1183
- return superset(other, values);
1184
- }
1185
-
1186
- function union(...others) {
1187
- const set = new InternSet();
1188
- for (const other of others) {
1189
- for (const o of other) {
1190
- set.add(o);
1191
- }
1192
- }
1193
- return set;
1194
- }
1195
-
1196
- exports.Adder = Adder;
1197
- exports.InternMap = InternMap;
1198
- exports.InternSet = InternSet;
1199
- exports.ascending = ascending;
1200
- exports.bin = bin;
1201
- exports.bisect = bisect;
1202
- exports.bisectCenter = bisectCenter;
1203
- exports.bisectLeft = bisectLeft;
1204
- exports.bisectRight = bisectRight;
1205
- exports.bisector = bisector;
1206
- exports.count = count;
1207
- exports.cross = cross;
1208
- exports.cumsum = cumsum;
1209
- exports.descending = descending;
1210
- exports.deviation = deviation;
1211
- exports.difference = difference;
1212
- exports.disjoint = disjoint;
1213
- exports.every = every;
1214
- exports.extent = extent;
1215
- exports.fcumsum = fcumsum;
1216
- exports.filter = filter;
1217
- exports.flatGroup = flatGroup;
1218
- exports.flatRollup = flatRollup;
1219
- exports.fsum = fsum;
1220
- exports.greatest = greatest;
1221
- exports.greatestIndex = greatestIndex;
1222
- exports.group = group;
1223
- exports.groupSort = groupSort;
1224
- exports.groups = groups;
1225
- exports.histogram = bin;
1226
- exports.index = index;
1227
- exports.indexes = indexes;
1228
- exports.intersection = intersection;
1229
- exports.least = least;
1230
- exports.leastIndex = leastIndex;
1231
- exports.map = map;
1232
- exports.max = max;
1233
- exports.maxIndex = maxIndex;
1234
- exports.mean = mean;
1235
- exports.median = median;
1236
- exports.merge = merge;
1237
- exports.min = min;
1238
- exports.minIndex = minIndex;
1239
- exports.mode = mode;
1240
- exports.nice = nice;
1241
- exports.pairs = pairs;
1242
- exports.permute = permute;
1243
- exports.quantile = quantile;
1244
- exports.quantileSorted = quantileSorted;
1245
- exports.quickselect = quickselect;
1246
- exports.range = range;
1247
- exports.rank = rank;
1248
- exports.reduce = reduce;
1249
- exports.reverse = reverse;
1250
- exports.rollup = rollup;
1251
- exports.rollups = rollups;
1252
- exports.scan = scan;
1253
- exports.shuffle = shuffle;
1254
- exports.shuffler = shuffler;
1255
- exports.some = some;
1256
- exports.sort = sort;
1257
- exports.subset = subset;
1258
- exports.sum = sum;
1259
- exports.superset = superset;
1260
- exports.thresholdFreedmanDiaconis = thresholdFreedmanDiaconis;
1261
- exports.thresholdScott = thresholdScott;
1262
- exports.thresholdSturges = thresholdSturges;
1263
- exports.tickIncrement = tickIncrement;
1264
- exports.tickStep = tickStep;
1265
- exports.ticks = ticks;
1266
- exports.transpose = transpose;
1267
- exports.union = union;
1268
- exports.variance = variance;
1269
- exports.zip = zip;
1270
-
1271
- Object.defineProperty(exports, '__esModule', { value: true });
1272
-
1273
- }));