@barefootjs/chart 0.1.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.
- package/dist/chart-container.d.ts +10 -0
- package/dist/chart-container.d.ts.map +1 -0
- package/dist/context.d.ts +10 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2254 -0
- package/dist/types.d.ts +235 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/utils/arcs.d.ts +44 -0
- package/dist/utils/arcs.d.ts.map +1 -0
- package/dist/utils/areas.d.ts +23 -0
- package/dist/utils/areas.d.ts.map +1 -0
- package/dist/utils/classes.d.ts +24 -0
- package/dist/utils/classes.d.ts.map +1 -0
- package/dist/utils/lines.d.ts +18 -0
- package/dist/utils/lines.d.ts.map +1 -0
- package/dist/utils/radar.d.ts +25 -0
- package/dist/utils/radar.d.ts.map +1 -0
- package/dist/utils/scales.d.ts +12 -0
- package/dist/utils/scales.d.ts.map +1 -0
- package/package.json +55 -0
- package/src/chart-container.ts +17 -0
- package/src/context.ts +14 -0
- package/src/index.ts +75 -0
- package/src/types.ts +270 -0
- package/src/utils/arcs.ts +149 -0
- package/src/utils/areas.ts +69 -0
- package/src/utils/classes.ts +24 -0
- package/src/utils/lines.ts +61 -0
- package/src/utils/radar.ts +53 -0
- package/src/utils/scales.ts +64 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,2254 @@
|
|
|
1
|
+
// ../client/src/reactive.ts
|
|
2
|
+
var PendingEffects = new Set;
|
|
3
|
+
|
|
4
|
+
// ../client/dist/runtime/index.js
|
|
5
|
+
var BF_PARENT_SCOPE_PLACEHOLDER = "__BF_PARENT_SCOPE__";
|
|
6
|
+
function createContext(defaultValue) {
|
|
7
|
+
return {
|
|
8
|
+
id: Symbol(),
|
|
9
|
+
defaultValue,
|
|
10
|
+
Provider: () => {
|
|
11
|
+
throw new Error("Context.Provider should be compiled away");
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
var contextStore = new Map;
|
|
16
|
+
var templateRegistry = new Map;
|
|
17
|
+
var hydratedScopes = new WeakSet;
|
|
18
|
+
var commentScopeRegistry = new WeakMap;
|
|
19
|
+
var cssEscape = typeof CSS !== "undefined" && CSS.escape ? (s) => CSS.escape(s) : (s) => s.replace(/"/g, "\\\"");
|
|
20
|
+
var initializedComments = new WeakSet;
|
|
21
|
+
var componentRegistry = new Map;
|
|
22
|
+
var pendingChildInits = new Map;
|
|
23
|
+
var registeredDefs = new Map;
|
|
24
|
+
var propsUpdateMap = new WeakMap;
|
|
25
|
+
var propsMap = new WeakMap;
|
|
26
|
+
var PLACEHOLDER_ATTR_PATTERN = new RegExp(`\\s+bf-s="${BF_PARENT_SCOPE_PLACEHOLDER}"`, "g");
|
|
27
|
+
var SVG_CAMEL_CASE_ATTRS = new Set([
|
|
28
|
+
"allowReorder",
|
|
29
|
+
"attributeName",
|
|
30
|
+
"attributeType",
|
|
31
|
+
"autoReverse",
|
|
32
|
+
"baseFrequency",
|
|
33
|
+
"baseProfile",
|
|
34
|
+
"calcMode",
|
|
35
|
+
"clipPathUnits",
|
|
36
|
+
"contentScriptType",
|
|
37
|
+
"contentStyleType",
|
|
38
|
+
"diffuseConstant",
|
|
39
|
+
"edgeMode",
|
|
40
|
+
"externalResourcesRequired",
|
|
41
|
+
"filterRes",
|
|
42
|
+
"filterUnits",
|
|
43
|
+
"glyphRef",
|
|
44
|
+
"gradientTransform",
|
|
45
|
+
"gradientUnits",
|
|
46
|
+
"kernelMatrix",
|
|
47
|
+
"kernelUnitLength",
|
|
48
|
+
"keyPoints",
|
|
49
|
+
"keySplines",
|
|
50
|
+
"keyTimes",
|
|
51
|
+
"lengthAdjust",
|
|
52
|
+
"limitingConeAngle",
|
|
53
|
+
"markerHeight",
|
|
54
|
+
"markerUnits",
|
|
55
|
+
"markerWidth",
|
|
56
|
+
"maskContentUnits",
|
|
57
|
+
"maskUnits",
|
|
58
|
+
"numOctaves",
|
|
59
|
+
"pathLength",
|
|
60
|
+
"patternContentUnits",
|
|
61
|
+
"patternTransform",
|
|
62
|
+
"patternUnits",
|
|
63
|
+
"pointsAtX",
|
|
64
|
+
"pointsAtY",
|
|
65
|
+
"pointsAtZ",
|
|
66
|
+
"preserveAlpha",
|
|
67
|
+
"preserveAspectRatio",
|
|
68
|
+
"primitiveUnits",
|
|
69
|
+
"refX",
|
|
70
|
+
"refY",
|
|
71
|
+
"repeatCount",
|
|
72
|
+
"repeatDur",
|
|
73
|
+
"requiredExtensions",
|
|
74
|
+
"requiredFeatures",
|
|
75
|
+
"specularConstant",
|
|
76
|
+
"specularExponent",
|
|
77
|
+
"spreadMethod",
|
|
78
|
+
"startOffset",
|
|
79
|
+
"stdDeviation",
|
|
80
|
+
"stitchTiles",
|
|
81
|
+
"surfaceScale",
|
|
82
|
+
"systemLanguage",
|
|
83
|
+
"tableValues",
|
|
84
|
+
"targetX",
|
|
85
|
+
"targetY",
|
|
86
|
+
"textLength",
|
|
87
|
+
"viewBox",
|
|
88
|
+
"viewTarget",
|
|
89
|
+
"xChannelSelector",
|
|
90
|
+
"yChannelSelector",
|
|
91
|
+
"zoomAndPan"
|
|
92
|
+
]);
|
|
93
|
+
|
|
94
|
+
// src/context.ts
|
|
95
|
+
var BarChartContext = createContext();
|
|
96
|
+
var RadialChartContext = createContext();
|
|
97
|
+
var RadarChartContext = createContext();
|
|
98
|
+
var PieChartContext = createContext();
|
|
99
|
+
var AreaChartContext = createContext();
|
|
100
|
+
var ChartConfigContext = createContext();
|
|
101
|
+
// ../../node_modules/.bun/d3-array@3.2.4/node_modules/d3-array/src/ascending.js
|
|
102
|
+
function ascending(a, b) {
|
|
103
|
+
return a == null || b == null ? NaN : a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// ../../node_modules/.bun/d3-array@3.2.4/node_modules/d3-array/src/descending.js
|
|
107
|
+
function descending(a, b) {
|
|
108
|
+
return a == null || b == null ? NaN : b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// ../../node_modules/.bun/d3-array@3.2.4/node_modules/d3-array/src/bisector.js
|
|
112
|
+
function bisector(f) {
|
|
113
|
+
let compare1, compare2, delta;
|
|
114
|
+
if (f.length !== 2) {
|
|
115
|
+
compare1 = ascending;
|
|
116
|
+
compare2 = (d, x) => ascending(f(d), x);
|
|
117
|
+
delta = (d, x) => f(d) - x;
|
|
118
|
+
} else {
|
|
119
|
+
compare1 = f === ascending || f === descending ? f : zero;
|
|
120
|
+
compare2 = f;
|
|
121
|
+
delta = f;
|
|
122
|
+
}
|
|
123
|
+
function left(a, x, lo = 0, hi = a.length) {
|
|
124
|
+
if (lo < hi) {
|
|
125
|
+
if (compare1(x, x) !== 0)
|
|
126
|
+
return hi;
|
|
127
|
+
do {
|
|
128
|
+
const mid = lo + hi >>> 1;
|
|
129
|
+
if (compare2(a[mid], x) < 0)
|
|
130
|
+
lo = mid + 1;
|
|
131
|
+
else
|
|
132
|
+
hi = mid;
|
|
133
|
+
} while (lo < hi);
|
|
134
|
+
}
|
|
135
|
+
return lo;
|
|
136
|
+
}
|
|
137
|
+
function right(a, x, lo = 0, hi = a.length) {
|
|
138
|
+
if (lo < hi) {
|
|
139
|
+
if (compare1(x, x) !== 0)
|
|
140
|
+
return hi;
|
|
141
|
+
do {
|
|
142
|
+
const mid = lo + hi >>> 1;
|
|
143
|
+
if (compare2(a[mid], x) <= 0)
|
|
144
|
+
lo = mid + 1;
|
|
145
|
+
else
|
|
146
|
+
hi = mid;
|
|
147
|
+
} while (lo < hi);
|
|
148
|
+
}
|
|
149
|
+
return lo;
|
|
150
|
+
}
|
|
151
|
+
function center(a, x, lo = 0, hi = a.length) {
|
|
152
|
+
const i = left(a, x, lo, hi - 1);
|
|
153
|
+
return i > lo && delta(a[i - 1], x) > -delta(a[i], x) ? i - 1 : i;
|
|
154
|
+
}
|
|
155
|
+
return { left, center, right };
|
|
156
|
+
}
|
|
157
|
+
function zero() {
|
|
158
|
+
return 0;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
// ../../node_modules/.bun/d3-array@3.2.4/node_modules/d3-array/src/number.js
|
|
162
|
+
function number(x) {
|
|
163
|
+
return x === null ? NaN : +x;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
// ../../node_modules/.bun/d3-array@3.2.4/node_modules/d3-array/src/bisect.js
|
|
167
|
+
var ascendingBisect = bisector(ascending);
|
|
168
|
+
var bisectRight = ascendingBisect.right;
|
|
169
|
+
var bisectLeft = ascendingBisect.left;
|
|
170
|
+
var bisectCenter = bisector(number).center;
|
|
171
|
+
var bisect_default = bisectRight;
|
|
172
|
+
// ../../node_modules/.bun/internmap@2.0.3/node_modules/internmap/src/index.js
|
|
173
|
+
class InternMap extends Map {
|
|
174
|
+
constructor(entries, key = keyof) {
|
|
175
|
+
super();
|
|
176
|
+
Object.defineProperties(this, { _intern: { value: new Map }, _key: { value: key } });
|
|
177
|
+
if (entries != null)
|
|
178
|
+
for (const [key2, value] of entries)
|
|
179
|
+
this.set(key2, value);
|
|
180
|
+
}
|
|
181
|
+
get(key) {
|
|
182
|
+
return super.get(intern_get(this, key));
|
|
183
|
+
}
|
|
184
|
+
has(key) {
|
|
185
|
+
return super.has(intern_get(this, key));
|
|
186
|
+
}
|
|
187
|
+
set(key, value) {
|
|
188
|
+
return super.set(intern_set(this, key), value);
|
|
189
|
+
}
|
|
190
|
+
delete(key) {
|
|
191
|
+
return super.delete(intern_delete(this, key));
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
function intern_get({ _intern, _key }, value) {
|
|
195
|
+
const key = _key(value);
|
|
196
|
+
return _intern.has(key) ? _intern.get(key) : value;
|
|
197
|
+
}
|
|
198
|
+
function intern_set({ _intern, _key }, value) {
|
|
199
|
+
const key = _key(value);
|
|
200
|
+
if (_intern.has(key))
|
|
201
|
+
return _intern.get(key);
|
|
202
|
+
_intern.set(key, value);
|
|
203
|
+
return value;
|
|
204
|
+
}
|
|
205
|
+
function intern_delete({ _intern, _key }, value) {
|
|
206
|
+
const key = _key(value);
|
|
207
|
+
if (_intern.has(key)) {
|
|
208
|
+
value = _intern.get(key);
|
|
209
|
+
_intern.delete(key);
|
|
210
|
+
}
|
|
211
|
+
return value;
|
|
212
|
+
}
|
|
213
|
+
function keyof(value) {
|
|
214
|
+
return value !== null && typeof value === "object" ? value.valueOf() : value;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
// ../../node_modules/.bun/d3-array@3.2.4/node_modules/d3-array/src/ticks.js
|
|
218
|
+
var e10 = Math.sqrt(50);
|
|
219
|
+
var e5 = Math.sqrt(10);
|
|
220
|
+
var e2 = Math.sqrt(2);
|
|
221
|
+
function tickSpec(start, stop, count) {
|
|
222
|
+
const step = (stop - start) / Math.max(0, count), power = Math.floor(Math.log10(step)), error = step / Math.pow(10, power), factor = error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1;
|
|
223
|
+
let i1, i2, inc;
|
|
224
|
+
if (power < 0) {
|
|
225
|
+
inc = Math.pow(10, -power) / factor;
|
|
226
|
+
i1 = Math.round(start * inc);
|
|
227
|
+
i2 = Math.round(stop * inc);
|
|
228
|
+
if (i1 / inc < start)
|
|
229
|
+
++i1;
|
|
230
|
+
if (i2 / inc > stop)
|
|
231
|
+
--i2;
|
|
232
|
+
inc = -inc;
|
|
233
|
+
} else {
|
|
234
|
+
inc = Math.pow(10, power) * factor;
|
|
235
|
+
i1 = Math.round(start / inc);
|
|
236
|
+
i2 = Math.round(stop / inc);
|
|
237
|
+
if (i1 * inc < start)
|
|
238
|
+
++i1;
|
|
239
|
+
if (i2 * inc > stop)
|
|
240
|
+
--i2;
|
|
241
|
+
}
|
|
242
|
+
if (i2 < i1 && 0.5 <= count && count < 2)
|
|
243
|
+
return tickSpec(start, stop, count * 2);
|
|
244
|
+
return [i1, i2, inc];
|
|
245
|
+
}
|
|
246
|
+
function ticks(start, stop, count) {
|
|
247
|
+
stop = +stop, start = +start, count = +count;
|
|
248
|
+
if (!(count > 0))
|
|
249
|
+
return [];
|
|
250
|
+
if (start === stop)
|
|
251
|
+
return [start];
|
|
252
|
+
const reverse = stop < start, [i1, i2, inc] = reverse ? tickSpec(stop, start, count) : tickSpec(start, stop, count);
|
|
253
|
+
if (!(i2 >= i1))
|
|
254
|
+
return [];
|
|
255
|
+
const n = i2 - i1 + 1, ticks2 = new Array(n);
|
|
256
|
+
if (reverse) {
|
|
257
|
+
if (inc < 0)
|
|
258
|
+
for (let i = 0;i < n; ++i)
|
|
259
|
+
ticks2[i] = (i2 - i) / -inc;
|
|
260
|
+
else
|
|
261
|
+
for (let i = 0;i < n; ++i)
|
|
262
|
+
ticks2[i] = (i2 - i) * inc;
|
|
263
|
+
} else {
|
|
264
|
+
if (inc < 0)
|
|
265
|
+
for (let i = 0;i < n; ++i)
|
|
266
|
+
ticks2[i] = (i1 + i) / -inc;
|
|
267
|
+
else
|
|
268
|
+
for (let i = 0;i < n; ++i)
|
|
269
|
+
ticks2[i] = (i1 + i) * inc;
|
|
270
|
+
}
|
|
271
|
+
return ticks2;
|
|
272
|
+
}
|
|
273
|
+
function tickIncrement(start, stop, count) {
|
|
274
|
+
stop = +stop, start = +start, count = +count;
|
|
275
|
+
return tickSpec(start, stop, count)[2];
|
|
276
|
+
}
|
|
277
|
+
function tickStep(start, stop, count) {
|
|
278
|
+
stop = +stop, start = +start, count = +count;
|
|
279
|
+
const reverse = stop < start, inc = reverse ? tickIncrement(stop, start, count) : tickIncrement(start, stop, count);
|
|
280
|
+
return (reverse ? -1 : 1) * (inc < 0 ? 1 / -inc : inc);
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
// ../../node_modules/.bun/d3-array@3.2.4/node_modules/d3-array/src/max.js
|
|
284
|
+
function max(values, valueof) {
|
|
285
|
+
let max2;
|
|
286
|
+
if (valueof === undefined) {
|
|
287
|
+
for (const value of values) {
|
|
288
|
+
if (value != null && (max2 < value || max2 === undefined && value >= value)) {
|
|
289
|
+
max2 = value;
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
} else {
|
|
293
|
+
let index = -1;
|
|
294
|
+
for (let value of values) {
|
|
295
|
+
if ((value = valueof(value, ++index, values)) != null && (max2 < value || max2 === undefined && value >= value)) {
|
|
296
|
+
max2 = value;
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
return max2;
|
|
301
|
+
}
|
|
302
|
+
// ../../node_modules/.bun/d3-array@3.2.4/node_modules/d3-array/src/range.js
|
|
303
|
+
function range(start, stop, step) {
|
|
304
|
+
start = +start, stop = +stop, step = (n = arguments.length) < 2 ? (stop = start, start = 0, 1) : n < 3 ? 1 : +step;
|
|
305
|
+
var i = -1, n = Math.max(0, Math.ceil((stop - start) / step)) | 0, range2 = new Array(n);
|
|
306
|
+
while (++i < n) {
|
|
307
|
+
range2[i] = start + i * step;
|
|
308
|
+
}
|
|
309
|
+
return range2;
|
|
310
|
+
}
|
|
311
|
+
// ../../node_modules/.bun/d3-scale@4.0.2/node_modules/d3-scale/src/init.js
|
|
312
|
+
function initRange(domain, range2) {
|
|
313
|
+
switch (arguments.length) {
|
|
314
|
+
case 0:
|
|
315
|
+
break;
|
|
316
|
+
case 1:
|
|
317
|
+
this.range(domain);
|
|
318
|
+
break;
|
|
319
|
+
default:
|
|
320
|
+
this.range(range2).domain(domain);
|
|
321
|
+
break;
|
|
322
|
+
}
|
|
323
|
+
return this;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
// ../../node_modules/.bun/d3-scale@4.0.2/node_modules/d3-scale/src/ordinal.js
|
|
327
|
+
var implicit = Symbol("implicit");
|
|
328
|
+
function ordinal() {
|
|
329
|
+
var index = new InternMap, domain = [], range2 = [], unknown = implicit;
|
|
330
|
+
function scale(d) {
|
|
331
|
+
let i = index.get(d);
|
|
332
|
+
if (i === undefined) {
|
|
333
|
+
if (unknown !== implicit)
|
|
334
|
+
return unknown;
|
|
335
|
+
index.set(d, i = domain.push(d) - 1);
|
|
336
|
+
}
|
|
337
|
+
return range2[i % range2.length];
|
|
338
|
+
}
|
|
339
|
+
scale.domain = function(_) {
|
|
340
|
+
if (!arguments.length)
|
|
341
|
+
return domain.slice();
|
|
342
|
+
domain = [], index = new InternMap;
|
|
343
|
+
for (const value of _) {
|
|
344
|
+
if (index.has(value))
|
|
345
|
+
continue;
|
|
346
|
+
index.set(value, domain.push(value) - 1);
|
|
347
|
+
}
|
|
348
|
+
return scale;
|
|
349
|
+
};
|
|
350
|
+
scale.range = function(_) {
|
|
351
|
+
return arguments.length ? (range2 = Array.from(_), scale) : range2.slice();
|
|
352
|
+
};
|
|
353
|
+
scale.unknown = function(_) {
|
|
354
|
+
return arguments.length ? (unknown = _, scale) : unknown;
|
|
355
|
+
};
|
|
356
|
+
scale.copy = function() {
|
|
357
|
+
return ordinal(domain, range2).unknown(unknown);
|
|
358
|
+
};
|
|
359
|
+
initRange.apply(scale, arguments);
|
|
360
|
+
return scale;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
// ../../node_modules/.bun/d3-scale@4.0.2/node_modules/d3-scale/src/band.js
|
|
364
|
+
function band() {
|
|
365
|
+
var scale = ordinal().unknown(undefined), domain = scale.domain, ordinalRange = scale.range, r0 = 0, r1 = 1, step, bandwidth, round = false, paddingInner = 0, paddingOuter = 0, align = 0.5;
|
|
366
|
+
delete scale.unknown;
|
|
367
|
+
function rescale() {
|
|
368
|
+
var n = domain().length, reverse = r1 < r0, start = reverse ? r1 : r0, stop = reverse ? r0 : r1;
|
|
369
|
+
step = (stop - start) / Math.max(1, n - paddingInner + paddingOuter * 2);
|
|
370
|
+
if (round)
|
|
371
|
+
step = Math.floor(step);
|
|
372
|
+
start += (stop - start - step * (n - paddingInner)) * align;
|
|
373
|
+
bandwidth = step * (1 - paddingInner);
|
|
374
|
+
if (round)
|
|
375
|
+
start = Math.round(start), bandwidth = Math.round(bandwidth);
|
|
376
|
+
var values = range(n).map(function(i) {
|
|
377
|
+
return start + step * i;
|
|
378
|
+
});
|
|
379
|
+
return ordinalRange(reverse ? values.reverse() : values);
|
|
380
|
+
}
|
|
381
|
+
scale.domain = function(_) {
|
|
382
|
+
return arguments.length ? (domain(_), rescale()) : domain();
|
|
383
|
+
};
|
|
384
|
+
scale.range = function(_) {
|
|
385
|
+
return arguments.length ? ([r0, r1] = _, r0 = +r0, r1 = +r1, rescale()) : [r0, r1];
|
|
386
|
+
};
|
|
387
|
+
scale.rangeRound = function(_) {
|
|
388
|
+
return [r0, r1] = _, r0 = +r0, r1 = +r1, round = true, rescale();
|
|
389
|
+
};
|
|
390
|
+
scale.bandwidth = function() {
|
|
391
|
+
return bandwidth;
|
|
392
|
+
};
|
|
393
|
+
scale.step = function() {
|
|
394
|
+
return step;
|
|
395
|
+
};
|
|
396
|
+
scale.round = function(_) {
|
|
397
|
+
return arguments.length ? (round = !!_, rescale()) : round;
|
|
398
|
+
};
|
|
399
|
+
scale.padding = function(_) {
|
|
400
|
+
return arguments.length ? (paddingInner = Math.min(1, paddingOuter = +_), rescale()) : paddingInner;
|
|
401
|
+
};
|
|
402
|
+
scale.paddingInner = function(_) {
|
|
403
|
+
return arguments.length ? (paddingInner = Math.min(1, _), rescale()) : paddingInner;
|
|
404
|
+
};
|
|
405
|
+
scale.paddingOuter = function(_) {
|
|
406
|
+
return arguments.length ? (paddingOuter = +_, rescale()) : paddingOuter;
|
|
407
|
+
};
|
|
408
|
+
scale.align = function(_) {
|
|
409
|
+
return arguments.length ? (align = Math.max(0, Math.min(1, _)), rescale()) : align;
|
|
410
|
+
};
|
|
411
|
+
scale.copy = function() {
|
|
412
|
+
return band(domain(), [r0, r1]).round(round).paddingInner(paddingInner).paddingOuter(paddingOuter).align(align);
|
|
413
|
+
};
|
|
414
|
+
return initRange.apply(rescale(), arguments);
|
|
415
|
+
}
|
|
416
|
+
function pointish(scale) {
|
|
417
|
+
var copy = scale.copy;
|
|
418
|
+
scale.padding = scale.paddingOuter;
|
|
419
|
+
delete scale.paddingInner;
|
|
420
|
+
delete scale.paddingOuter;
|
|
421
|
+
scale.copy = function() {
|
|
422
|
+
return pointish(copy());
|
|
423
|
+
};
|
|
424
|
+
return scale;
|
|
425
|
+
}
|
|
426
|
+
function point() {
|
|
427
|
+
return pointish(band.apply(null, arguments).paddingInner(1));
|
|
428
|
+
}
|
|
429
|
+
// ../../node_modules/.bun/d3-color@3.1.0/node_modules/d3-color/src/define.js
|
|
430
|
+
function define_default(constructor, factory, prototype) {
|
|
431
|
+
constructor.prototype = factory.prototype = prototype;
|
|
432
|
+
prototype.constructor = constructor;
|
|
433
|
+
}
|
|
434
|
+
function extend(parent, definition) {
|
|
435
|
+
var prototype = Object.create(parent.prototype);
|
|
436
|
+
for (var key in definition)
|
|
437
|
+
prototype[key] = definition[key];
|
|
438
|
+
return prototype;
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
// ../../node_modules/.bun/d3-color@3.1.0/node_modules/d3-color/src/color.js
|
|
442
|
+
function Color() {}
|
|
443
|
+
var darker = 0.7;
|
|
444
|
+
var brighter = 1 / darker;
|
|
445
|
+
var reI = "\\s*([+-]?\\d+)\\s*";
|
|
446
|
+
var reN = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*";
|
|
447
|
+
var reP = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*";
|
|
448
|
+
var reHex = /^#([0-9a-f]{3,8})$/;
|
|
449
|
+
var reRgbInteger = new RegExp(`^rgb\\(${reI},${reI},${reI}\\)$`);
|
|
450
|
+
var reRgbPercent = new RegExp(`^rgb\\(${reP},${reP},${reP}\\)$`);
|
|
451
|
+
var reRgbaInteger = new RegExp(`^rgba\\(${reI},${reI},${reI},${reN}\\)$`);
|
|
452
|
+
var reRgbaPercent = new RegExp(`^rgba\\(${reP},${reP},${reP},${reN}\\)$`);
|
|
453
|
+
var reHslPercent = new RegExp(`^hsl\\(${reN},${reP},${reP}\\)$`);
|
|
454
|
+
var reHslaPercent = new RegExp(`^hsla\\(${reN},${reP},${reP},${reN}\\)$`);
|
|
455
|
+
var named = {
|
|
456
|
+
aliceblue: 15792383,
|
|
457
|
+
antiquewhite: 16444375,
|
|
458
|
+
aqua: 65535,
|
|
459
|
+
aquamarine: 8388564,
|
|
460
|
+
azure: 15794175,
|
|
461
|
+
beige: 16119260,
|
|
462
|
+
bisque: 16770244,
|
|
463
|
+
black: 0,
|
|
464
|
+
blanchedalmond: 16772045,
|
|
465
|
+
blue: 255,
|
|
466
|
+
blueviolet: 9055202,
|
|
467
|
+
brown: 10824234,
|
|
468
|
+
burlywood: 14596231,
|
|
469
|
+
cadetblue: 6266528,
|
|
470
|
+
chartreuse: 8388352,
|
|
471
|
+
chocolate: 13789470,
|
|
472
|
+
coral: 16744272,
|
|
473
|
+
cornflowerblue: 6591981,
|
|
474
|
+
cornsilk: 16775388,
|
|
475
|
+
crimson: 14423100,
|
|
476
|
+
cyan: 65535,
|
|
477
|
+
darkblue: 139,
|
|
478
|
+
darkcyan: 35723,
|
|
479
|
+
darkgoldenrod: 12092939,
|
|
480
|
+
darkgray: 11119017,
|
|
481
|
+
darkgreen: 25600,
|
|
482
|
+
darkgrey: 11119017,
|
|
483
|
+
darkkhaki: 12433259,
|
|
484
|
+
darkmagenta: 9109643,
|
|
485
|
+
darkolivegreen: 5597999,
|
|
486
|
+
darkorange: 16747520,
|
|
487
|
+
darkorchid: 10040012,
|
|
488
|
+
darkred: 9109504,
|
|
489
|
+
darksalmon: 15308410,
|
|
490
|
+
darkseagreen: 9419919,
|
|
491
|
+
darkslateblue: 4734347,
|
|
492
|
+
darkslategray: 3100495,
|
|
493
|
+
darkslategrey: 3100495,
|
|
494
|
+
darkturquoise: 52945,
|
|
495
|
+
darkviolet: 9699539,
|
|
496
|
+
deeppink: 16716947,
|
|
497
|
+
deepskyblue: 49151,
|
|
498
|
+
dimgray: 6908265,
|
|
499
|
+
dimgrey: 6908265,
|
|
500
|
+
dodgerblue: 2003199,
|
|
501
|
+
firebrick: 11674146,
|
|
502
|
+
floralwhite: 16775920,
|
|
503
|
+
forestgreen: 2263842,
|
|
504
|
+
fuchsia: 16711935,
|
|
505
|
+
gainsboro: 14474460,
|
|
506
|
+
ghostwhite: 16316671,
|
|
507
|
+
gold: 16766720,
|
|
508
|
+
goldenrod: 14329120,
|
|
509
|
+
gray: 8421504,
|
|
510
|
+
green: 32768,
|
|
511
|
+
greenyellow: 11403055,
|
|
512
|
+
grey: 8421504,
|
|
513
|
+
honeydew: 15794160,
|
|
514
|
+
hotpink: 16738740,
|
|
515
|
+
indianred: 13458524,
|
|
516
|
+
indigo: 4915330,
|
|
517
|
+
ivory: 16777200,
|
|
518
|
+
khaki: 15787660,
|
|
519
|
+
lavender: 15132410,
|
|
520
|
+
lavenderblush: 16773365,
|
|
521
|
+
lawngreen: 8190976,
|
|
522
|
+
lemonchiffon: 16775885,
|
|
523
|
+
lightblue: 11393254,
|
|
524
|
+
lightcoral: 15761536,
|
|
525
|
+
lightcyan: 14745599,
|
|
526
|
+
lightgoldenrodyellow: 16448210,
|
|
527
|
+
lightgray: 13882323,
|
|
528
|
+
lightgreen: 9498256,
|
|
529
|
+
lightgrey: 13882323,
|
|
530
|
+
lightpink: 16758465,
|
|
531
|
+
lightsalmon: 16752762,
|
|
532
|
+
lightseagreen: 2142890,
|
|
533
|
+
lightskyblue: 8900346,
|
|
534
|
+
lightslategray: 7833753,
|
|
535
|
+
lightslategrey: 7833753,
|
|
536
|
+
lightsteelblue: 11584734,
|
|
537
|
+
lightyellow: 16777184,
|
|
538
|
+
lime: 65280,
|
|
539
|
+
limegreen: 3329330,
|
|
540
|
+
linen: 16445670,
|
|
541
|
+
magenta: 16711935,
|
|
542
|
+
maroon: 8388608,
|
|
543
|
+
mediumaquamarine: 6737322,
|
|
544
|
+
mediumblue: 205,
|
|
545
|
+
mediumorchid: 12211667,
|
|
546
|
+
mediumpurple: 9662683,
|
|
547
|
+
mediumseagreen: 3978097,
|
|
548
|
+
mediumslateblue: 8087790,
|
|
549
|
+
mediumspringgreen: 64154,
|
|
550
|
+
mediumturquoise: 4772300,
|
|
551
|
+
mediumvioletred: 13047173,
|
|
552
|
+
midnightblue: 1644912,
|
|
553
|
+
mintcream: 16121850,
|
|
554
|
+
mistyrose: 16770273,
|
|
555
|
+
moccasin: 16770229,
|
|
556
|
+
navajowhite: 16768685,
|
|
557
|
+
navy: 128,
|
|
558
|
+
oldlace: 16643558,
|
|
559
|
+
olive: 8421376,
|
|
560
|
+
olivedrab: 7048739,
|
|
561
|
+
orange: 16753920,
|
|
562
|
+
orangered: 16729344,
|
|
563
|
+
orchid: 14315734,
|
|
564
|
+
palegoldenrod: 15657130,
|
|
565
|
+
palegreen: 10025880,
|
|
566
|
+
paleturquoise: 11529966,
|
|
567
|
+
palevioletred: 14381203,
|
|
568
|
+
papayawhip: 16773077,
|
|
569
|
+
peachpuff: 16767673,
|
|
570
|
+
peru: 13468991,
|
|
571
|
+
pink: 16761035,
|
|
572
|
+
plum: 14524637,
|
|
573
|
+
powderblue: 11591910,
|
|
574
|
+
purple: 8388736,
|
|
575
|
+
rebeccapurple: 6697881,
|
|
576
|
+
red: 16711680,
|
|
577
|
+
rosybrown: 12357519,
|
|
578
|
+
royalblue: 4286945,
|
|
579
|
+
saddlebrown: 9127187,
|
|
580
|
+
salmon: 16416882,
|
|
581
|
+
sandybrown: 16032864,
|
|
582
|
+
seagreen: 3050327,
|
|
583
|
+
seashell: 16774638,
|
|
584
|
+
sienna: 10506797,
|
|
585
|
+
silver: 12632256,
|
|
586
|
+
skyblue: 8900331,
|
|
587
|
+
slateblue: 6970061,
|
|
588
|
+
slategray: 7372944,
|
|
589
|
+
slategrey: 7372944,
|
|
590
|
+
snow: 16775930,
|
|
591
|
+
springgreen: 65407,
|
|
592
|
+
steelblue: 4620980,
|
|
593
|
+
tan: 13808780,
|
|
594
|
+
teal: 32896,
|
|
595
|
+
thistle: 14204888,
|
|
596
|
+
tomato: 16737095,
|
|
597
|
+
turquoise: 4251856,
|
|
598
|
+
violet: 15631086,
|
|
599
|
+
wheat: 16113331,
|
|
600
|
+
white: 16777215,
|
|
601
|
+
whitesmoke: 16119285,
|
|
602
|
+
yellow: 16776960,
|
|
603
|
+
yellowgreen: 10145074
|
|
604
|
+
};
|
|
605
|
+
define_default(Color, color, {
|
|
606
|
+
copy(channels) {
|
|
607
|
+
return Object.assign(new this.constructor, this, channels);
|
|
608
|
+
},
|
|
609
|
+
displayable() {
|
|
610
|
+
return this.rgb().displayable();
|
|
611
|
+
},
|
|
612
|
+
hex: color_formatHex,
|
|
613
|
+
formatHex: color_formatHex,
|
|
614
|
+
formatHex8: color_formatHex8,
|
|
615
|
+
formatHsl: color_formatHsl,
|
|
616
|
+
formatRgb: color_formatRgb,
|
|
617
|
+
toString: color_formatRgb
|
|
618
|
+
});
|
|
619
|
+
function color_formatHex() {
|
|
620
|
+
return this.rgb().formatHex();
|
|
621
|
+
}
|
|
622
|
+
function color_formatHex8() {
|
|
623
|
+
return this.rgb().formatHex8();
|
|
624
|
+
}
|
|
625
|
+
function color_formatHsl() {
|
|
626
|
+
return hslConvert(this).formatHsl();
|
|
627
|
+
}
|
|
628
|
+
function color_formatRgb() {
|
|
629
|
+
return this.rgb().formatRgb();
|
|
630
|
+
}
|
|
631
|
+
function color(format) {
|
|
632
|
+
var m, l;
|
|
633
|
+
format = (format + "").trim().toLowerCase();
|
|
634
|
+
return (m = reHex.exec(format)) ? (l = m[1].length, m = parseInt(m[1], 16), l === 6 ? rgbn(m) : l === 3 ? new Rgb(m >> 8 & 15 | m >> 4 & 240, m >> 4 & 15 | m & 240, (m & 15) << 4 | m & 15, 1) : l === 8 ? rgba(m >> 24 & 255, m >> 16 & 255, m >> 8 & 255, (m & 255) / 255) : l === 4 ? rgba(m >> 12 & 15 | m >> 8 & 240, m >> 8 & 15 | m >> 4 & 240, m >> 4 & 15 | m & 240, ((m & 15) << 4 | m & 15) / 255) : null) : (m = reRgbInteger.exec(format)) ? new Rgb(m[1], m[2], m[3], 1) : (m = reRgbPercent.exec(format)) ? new Rgb(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, 1) : (m = reRgbaInteger.exec(format)) ? rgba(m[1], m[2], m[3], m[4]) : (m = reRgbaPercent.exec(format)) ? rgba(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, m[4]) : (m = reHslPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, 1) : (m = reHslaPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, m[4]) : named.hasOwnProperty(format) ? rgbn(named[format]) : format === "transparent" ? new Rgb(NaN, NaN, NaN, 0) : null;
|
|
635
|
+
}
|
|
636
|
+
function rgbn(n) {
|
|
637
|
+
return new Rgb(n >> 16 & 255, n >> 8 & 255, n & 255, 1);
|
|
638
|
+
}
|
|
639
|
+
function rgba(r, g, b, a) {
|
|
640
|
+
if (a <= 0)
|
|
641
|
+
r = g = b = NaN;
|
|
642
|
+
return new Rgb(r, g, b, a);
|
|
643
|
+
}
|
|
644
|
+
function rgbConvert(o) {
|
|
645
|
+
if (!(o instanceof Color))
|
|
646
|
+
o = color(o);
|
|
647
|
+
if (!o)
|
|
648
|
+
return new Rgb;
|
|
649
|
+
o = o.rgb();
|
|
650
|
+
return new Rgb(o.r, o.g, o.b, o.opacity);
|
|
651
|
+
}
|
|
652
|
+
function rgb(r, g, b, opacity) {
|
|
653
|
+
return arguments.length === 1 ? rgbConvert(r) : new Rgb(r, g, b, opacity == null ? 1 : opacity);
|
|
654
|
+
}
|
|
655
|
+
function Rgb(r, g, b, opacity) {
|
|
656
|
+
this.r = +r;
|
|
657
|
+
this.g = +g;
|
|
658
|
+
this.b = +b;
|
|
659
|
+
this.opacity = +opacity;
|
|
660
|
+
}
|
|
661
|
+
define_default(Rgb, rgb, extend(Color, {
|
|
662
|
+
brighter(k) {
|
|
663
|
+
k = k == null ? brighter : Math.pow(brighter, k);
|
|
664
|
+
return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
|
|
665
|
+
},
|
|
666
|
+
darker(k) {
|
|
667
|
+
k = k == null ? darker : Math.pow(darker, k);
|
|
668
|
+
return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
|
|
669
|
+
},
|
|
670
|
+
rgb() {
|
|
671
|
+
return this;
|
|
672
|
+
},
|
|
673
|
+
clamp() {
|
|
674
|
+
return new Rgb(clampi(this.r), clampi(this.g), clampi(this.b), clampa(this.opacity));
|
|
675
|
+
},
|
|
676
|
+
displayable() {
|
|
677
|
+
return -0.5 <= this.r && this.r < 255.5 && (-0.5 <= this.g && this.g < 255.5) && (-0.5 <= this.b && this.b < 255.5) && (0 <= this.opacity && this.opacity <= 1);
|
|
678
|
+
},
|
|
679
|
+
hex: rgb_formatHex,
|
|
680
|
+
formatHex: rgb_formatHex,
|
|
681
|
+
formatHex8: rgb_formatHex8,
|
|
682
|
+
formatRgb: rgb_formatRgb,
|
|
683
|
+
toString: rgb_formatRgb
|
|
684
|
+
}));
|
|
685
|
+
function rgb_formatHex() {
|
|
686
|
+
return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}`;
|
|
687
|
+
}
|
|
688
|
+
function rgb_formatHex8() {
|
|
689
|
+
return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}${hex((isNaN(this.opacity) ? 1 : this.opacity) * 255)}`;
|
|
690
|
+
}
|
|
691
|
+
function rgb_formatRgb() {
|
|
692
|
+
const a = clampa(this.opacity);
|
|
693
|
+
return `${a === 1 ? "rgb(" : "rgba("}${clampi(this.r)}, ${clampi(this.g)}, ${clampi(this.b)}${a === 1 ? ")" : `, ${a})`}`;
|
|
694
|
+
}
|
|
695
|
+
function clampa(opacity) {
|
|
696
|
+
return isNaN(opacity) ? 1 : Math.max(0, Math.min(1, opacity));
|
|
697
|
+
}
|
|
698
|
+
function clampi(value) {
|
|
699
|
+
return Math.max(0, Math.min(255, Math.round(value) || 0));
|
|
700
|
+
}
|
|
701
|
+
function hex(value) {
|
|
702
|
+
value = clampi(value);
|
|
703
|
+
return (value < 16 ? "0" : "") + value.toString(16);
|
|
704
|
+
}
|
|
705
|
+
function hsla(h, s, l, a) {
|
|
706
|
+
if (a <= 0)
|
|
707
|
+
h = s = l = NaN;
|
|
708
|
+
else if (l <= 0 || l >= 1)
|
|
709
|
+
h = s = NaN;
|
|
710
|
+
else if (s <= 0)
|
|
711
|
+
h = NaN;
|
|
712
|
+
return new Hsl(h, s, l, a);
|
|
713
|
+
}
|
|
714
|
+
function hslConvert(o) {
|
|
715
|
+
if (o instanceof Hsl)
|
|
716
|
+
return new Hsl(o.h, o.s, o.l, o.opacity);
|
|
717
|
+
if (!(o instanceof Color))
|
|
718
|
+
o = color(o);
|
|
719
|
+
if (!o)
|
|
720
|
+
return new Hsl;
|
|
721
|
+
if (o instanceof Hsl)
|
|
722
|
+
return o;
|
|
723
|
+
o = o.rgb();
|
|
724
|
+
var r = o.r / 255, g = o.g / 255, b = o.b / 255, min = Math.min(r, g, b), max2 = Math.max(r, g, b), h = NaN, s = max2 - min, l = (max2 + min) / 2;
|
|
725
|
+
if (s) {
|
|
726
|
+
if (r === max2)
|
|
727
|
+
h = (g - b) / s + (g < b) * 6;
|
|
728
|
+
else if (g === max2)
|
|
729
|
+
h = (b - r) / s + 2;
|
|
730
|
+
else
|
|
731
|
+
h = (r - g) / s + 4;
|
|
732
|
+
s /= l < 0.5 ? max2 + min : 2 - max2 - min;
|
|
733
|
+
h *= 60;
|
|
734
|
+
} else {
|
|
735
|
+
s = l > 0 && l < 1 ? 0 : h;
|
|
736
|
+
}
|
|
737
|
+
return new Hsl(h, s, l, o.opacity);
|
|
738
|
+
}
|
|
739
|
+
function hsl(h, s, l, opacity) {
|
|
740
|
+
return arguments.length === 1 ? hslConvert(h) : new Hsl(h, s, l, opacity == null ? 1 : opacity);
|
|
741
|
+
}
|
|
742
|
+
function Hsl(h, s, l, opacity) {
|
|
743
|
+
this.h = +h;
|
|
744
|
+
this.s = +s;
|
|
745
|
+
this.l = +l;
|
|
746
|
+
this.opacity = +opacity;
|
|
747
|
+
}
|
|
748
|
+
define_default(Hsl, hsl, extend(Color, {
|
|
749
|
+
brighter(k) {
|
|
750
|
+
k = k == null ? brighter : Math.pow(brighter, k);
|
|
751
|
+
return new Hsl(this.h, this.s, this.l * k, this.opacity);
|
|
752
|
+
},
|
|
753
|
+
darker(k) {
|
|
754
|
+
k = k == null ? darker : Math.pow(darker, k);
|
|
755
|
+
return new Hsl(this.h, this.s, this.l * k, this.opacity);
|
|
756
|
+
},
|
|
757
|
+
rgb() {
|
|
758
|
+
var h = this.h % 360 + (this.h < 0) * 360, s = isNaN(h) || isNaN(this.s) ? 0 : this.s, l = this.l, m2 = l + (l < 0.5 ? l : 1 - l) * s, m1 = 2 * l - m2;
|
|
759
|
+
return new Rgb(hsl2rgb(h >= 240 ? h - 240 : h + 120, m1, m2), hsl2rgb(h, m1, m2), hsl2rgb(h < 120 ? h + 240 : h - 120, m1, m2), this.opacity);
|
|
760
|
+
},
|
|
761
|
+
clamp() {
|
|
762
|
+
return new Hsl(clamph(this.h), clampt(this.s), clampt(this.l), clampa(this.opacity));
|
|
763
|
+
},
|
|
764
|
+
displayable() {
|
|
765
|
+
return (0 <= this.s && this.s <= 1 || isNaN(this.s)) && (0 <= this.l && this.l <= 1) && (0 <= this.opacity && this.opacity <= 1);
|
|
766
|
+
},
|
|
767
|
+
formatHsl() {
|
|
768
|
+
const a = clampa(this.opacity);
|
|
769
|
+
return `${a === 1 ? "hsl(" : "hsla("}${clamph(this.h)}, ${clampt(this.s) * 100}%, ${clampt(this.l) * 100}%${a === 1 ? ")" : `, ${a})`}`;
|
|
770
|
+
}
|
|
771
|
+
}));
|
|
772
|
+
function clamph(value) {
|
|
773
|
+
value = (value || 0) % 360;
|
|
774
|
+
return value < 0 ? value + 360 : value;
|
|
775
|
+
}
|
|
776
|
+
function clampt(value) {
|
|
777
|
+
return Math.max(0, Math.min(1, value || 0));
|
|
778
|
+
}
|
|
779
|
+
function hsl2rgb(h, m1, m2) {
|
|
780
|
+
return (h < 60 ? m1 + (m2 - m1) * h / 60 : h < 180 ? m2 : h < 240 ? m1 + (m2 - m1) * (240 - h) / 60 : m1) * 255;
|
|
781
|
+
}
|
|
782
|
+
// ../../node_modules/.bun/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/basis.js
|
|
783
|
+
function basis(t1, v0, v1, v2, v3) {
|
|
784
|
+
var t2 = t1 * t1, t3 = t2 * t1;
|
|
785
|
+
return ((1 - 3 * t1 + 3 * t2 - t3) * v0 + (4 - 6 * t2 + 3 * t3) * v1 + (1 + 3 * t1 + 3 * t2 - 3 * t3) * v2 + t3 * v3) / 6;
|
|
786
|
+
}
|
|
787
|
+
function basis_default(values) {
|
|
788
|
+
var n = values.length - 1;
|
|
789
|
+
return function(t) {
|
|
790
|
+
var i = t <= 0 ? t = 0 : t >= 1 ? (t = 1, n - 1) : Math.floor(t * n), v1 = values[i], v2 = values[i + 1], v0 = i > 0 ? values[i - 1] : 2 * v1 - v2, v3 = i < n - 1 ? values[i + 2] : 2 * v2 - v1;
|
|
791
|
+
return basis((t - i / n) * n, v0, v1, v2, v3);
|
|
792
|
+
};
|
|
793
|
+
}
|
|
794
|
+
|
|
795
|
+
// ../../node_modules/.bun/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/basisClosed.js
|
|
796
|
+
function basisClosed_default(values) {
|
|
797
|
+
var n = values.length;
|
|
798
|
+
return function(t) {
|
|
799
|
+
var i = Math.floor(((t %= 1) < 0 ? ++t : t) * n), v0 = values[(i + n - 1) % n], v1 = values[i % n], v2 = values[(i + 1) % n], v3 = values[(i + 2) % n];
|
|
800
|
+
return basis((t - i / n) * n, v0, v1, v2, v3);
|
|
801
|
+
};
|
|
802
|
+
}
|
|
803
|
+
|
|
804
|
+
// ../../node_modules/.bun/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/constant.js
|
|
805
|
+
var constant_default = (x) => () => x;
|
|
806
|
+
|
|
807
|
+
// ../../node_modules/.bun/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/color.js
|
|
808
|
+
function linear(a, d) {
|
|
809
|
+
return function(t) {
|
|
810
|
+
return a + t * d;
|
|
811
|
+
};
|
|
812
|
+
}
|
|
813
|
+
function exponential(a, b, y) {
|
|
814
|
+
return a = Math.pow(a, y), b = Math.pow(b, y) - a, y = 1 / y, function(t) {
|
|
815
|
+
return Math.pow(a + t * b, y);
|
|
816
|
+
};
|
|
817
|
+
}
|
|
818
|
+
function gamma(y) {
|
|
819
|
+
return (y = +y) === 1 ? nogamma : function(a, b) {
|
|
820
|
+
return b - a ? exponential(a, b, y) : constant_default(isNaN(a) ? b : a);
|
|
821
|
+
};
|
|
822
|
+
}
|
|
823
|
+
function nogamma(a, b) {
|
|
824
|
+
var d = b - a;
|
|
825
|
+
return d ? linear(a, d) : constant_default(isNaN(a) ? b : a);
|
|
826
|
+
}
|
|
827
|
+
|
|
828
|
+
// ../../node_modules/.bun/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/rgb.js
|
|
829
|
+
var rgb_default = function rgbGamma(y) {
|
|
830
|
+
var color2 = gamma(y);
|
|
831
|
+
function rgb2(start, end) {
|
|
832
|
+
var r = color2((start = rgb(start)).r, (end = rgb(end)).r), g = color2(start.g, end.g), b = color2(start.b, end.b), opacity = nogamma(start.opacity, end.opacity);
|
|
833
|
+
return function(t) {
|
|
834
|
+
start.r = r(t);
|
|
835
|
+
start.g = g(t);
|
|
836
|
+
start.b = b(t);
|
|
837
|
+
start.opacity = opacity(t);
|
|
838
|
+
return start + "";
|
|
839
|
+
};
|
|
840
|
+
}
|
|
841
|
+
rgb2.gamma = rgbGamma;
|
|
842
|
+
return rgb2;
|
|
843
|
+
}(1);
|
|
844
|
+
function rgbSpline(spline) {
|
|
845
|
+
return function(colors) {
|
|
846
|
+
var n = colors.length, r = new Array(n), g = new Array(n), b = new Array(n), i, color2;
|
|
847
|
+
for (i = 0;i < n; ++i) {
|
|
848
|
+
color2 = rgb(colors[i]);
|
|
849
|
+
r[i] = color2.r || 0;
|
|
850
|
+
g[i] = color2.g || 0;
|
|
851
|
+
b[i] = color2.b || 0;
|
|
852
|
+
}
|
|
853
|
+
r = spline(r);
|
|
854
|
+
g = spline(g);
|
|
855
|
+
b = spline(b);
|
|
856
|
+
color2.opacity = 1;
|
|
857
|
+
return function(t) {
|
|
858
|
+
color2.r = r(t);
|
|
859
|
+
color2.g = g(t);
|
|
860
|
+
color2.b = b(t);
|
|
861
|
+
return color2 + "";
|
|
862
|
+
};
|
|
863
|
+
};
|
|
864
|
+
}
|
|
865
|
+
var rgbBasis = rgbSpline(basis_default);
|
|
866
|
+
var rgbBasisClosed = rgbSpline(basisClosed_default);
|
|
867
|
+
|
|
868
|
+
// ../../node_modules/.bun/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/numberArray.js
|
|
869
|
+
function numberArray_default(a, b) {
|
|
870
|
+
if (!b)
|
|
871
|
+
b = [];
|
|
872
|
+
var n = a ? Math.min(b.length, a.length) : 0, c = b.slice(), i;
|
|
873
|
+
return function(t) {
|
|
874
|
+
for (i = 0;i < n; ++i)
|
|
875
|
+
c[i] = a[i] * (1 - t) + b[i] * t;
|
|
876
|
+
return c;
|
|
877
|
+
};
|
|
878
|
+
}
|
|
879
|
+
function isNumberArray(x) {
|
|
880
|
+
return ArrayBuffer.isView(x) && !(x instanceof DataView);
|
|
881
|
+
}
|
|
882
|
+
|
|
883
|
+
// ../../node_modules/.bun/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/array.js
|
|
884
|
+
function genericArray(a, b) {
|
|
885
|
+
var nb = b ? b.length : 0, na = a ? Math.min(nb, a.length) : 0, x = new Array(na), c = new Array(nb), i;
|
|
886
|
+
for (i = 0;i < na; ++i)
|
|
887
|
+
x[i] = value_default(a[i], b[i]);
|
|
888
|
+
for (;i < nb; ++i)
|
|
889
|
+
c[i] = b[i];
|
|
890
|
+
return function(t) {
|
|
891
|
+
for (i = 0;i < na; ++i)
|
|
892
|
+
c[i] = x[i](t);
|
|
893
|
+
return c;
|
|
894
|
+
};
|
|
895
|
+
}
|
|
896
|
+
|
|
897
|
+
// ../../node_modules/.bun/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/date.js
|
|
898
|
+
function date_default(a, b) {
|
|
899
|
+
var d = new Date;
|
|
900
|
+
return a = +a, b = +b, function(t) {
|
|
901
|
+
return d.setTime(a * (1 - t) + b * t), d;
|
|
902
|
+
};
|
|
903
|
+
}
|
|
904
|
+
|
|
905
|
+
// ../../node_modules/.bun/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/number.js
|
|
906
|
+
function number_default(a, b) {
|
|
907
|
+
return a = +a, b = +b, function(t) {
|
|
908
|
+
return a * (1 - t) + b * t;
|
|
909
|
+
};
|
|
910
|
+
}
|
|
911
|
+
|
|
912
|
+
// ../../node_modules/.bun/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/object.js
|
|
913
|
+
function object_default(a, b) {
|
|
914
|
+
var i = {}, c = {}, k;
|
|
915
|
+
if (a === null || typeof a !== "object")
|
|
916
|
+
a = {};
|
|
917
|
+
if (b === null || typeof b !== "object")
|
|
918
|
+
b = {};
|
|
919
|
+
for (k in b) {
|
|
920
|
+
if (k in a) {
|
|
921
|
+
i[k] = value_default(a[k], b[k]);
|
|
922
|
+
} else {
|
|
923
|
+
c[k] = b[k];
|
|
924
|
+
}
|
|
925
|
+
}
|
|
926
|
+
return function(t) {
|
|
927
|
+
for (k in i)
|
|
928
|
+
c[k] = i[k](t);
|
|
929
|
+
return c;
|
|
930
|
+
};
|
|
931
|
+
}
|
|
932
|
+
|
|
933
|
+
// ../../node_modules/.bun/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/string.js
|
|
934
|
+
var reA = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g;
|
|
935
|
+
var reB = new RegExp(reA.source, "g");
|
|
936
|
+
function zero2(b) {
|
|
937
|
+
return function() {
|
|
938
|
+
return b;
|
|
939
|
+
};
|
|
940
|
+
}
|
|
941
|
+
function one(b) {
|
|
942
|
+
return function(t) {
|
|
943
|
+
return b(t) + "";
|
|
944
|
+
};
|
|
945
|
+
}
|
|
946
|
+
function string_default(a, b) {
|
|
947
|
+
var bi = reA.lastIndex = reB.lastIndex = 0, am, bm, bs, i = -1, s = [], q = [];
|
|
948
|
+
a = a + "", b = b + "";
|
|
949
|
+
while ((am = reA.exec(a)) && (bm = reB.exec(b))) {
|
|
950
|
+
if ((bs = bm.index) > bi) {
|
|
951
|
+
bs = b.slice(bi, bs);
|
|
952
|
+
if (s[i])
|
|
953
|
+
s[i] += bs;
|
|
954
|
+
else
|
|
955
|
+
s[++i] = bs;
|
|
956
|
+
}
|
|
957
|
+
if ((am = am[0]) === (bm = bm[0])) {
|
|
958
|
+
if (s[i])
|
|
959
|
+
s[i] += bm;
|
|
960
|
+
else
|
|
961
|
+
s[++i] = bm;
|
|
962
|
+
} else {
|
|
963
|
+
s[++i] = null;
|
|
964
|
+
q.push({ i, x: number_default(am, bm) });
|
|
965
|
+
}
|
|
966
|
+
bi = reB.lastIndex;
|
|
967
|
+
}
|
|
968
|
+
if (bi < b.length) {
|
|
969
|
+
bs = b.slice(bi);
|
|
970
|
+
if (s[i])
|
|
971
|
+
s[i] += bs;
|
|
972
|
+
else
|
|
973
|
+
s[++i] = bs;
|
|
974
|
+
}
|
|
975
|
+
return s.length < 2 ? q[0] ? one(q[0].x) : zero2(b) : (b = q.length, function(t) {
|
|
976
|
+
for (var i2 = 0, o;i2 < b; ++i2)
|
|
977
|
+
s[(o = q[i2]).i] = o.x(t);
|
|
978
|
+
return s.join("");
|
|
979
|
+
});
|
|
980
|
+
}
|
|
981
|
+
|
|
982
|
+
// ../../node_modules/.bun/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/value.js
|
|
983
|
+
function value_default(a, b) {
|
|
984
|
+
var t = typeof b, c;
|
|
985
|
+
return b == null || t === "boolean" ? constant_default(b) : (t === "number" ? number_default : t === "string" ? (c = color(b)) ? (b = c, rgb_default) : string_default : b instanceof color ? rgb_default : b instanceof Date ? date_default : isNumberArray(b) ? numberArray_default : Array.isArray(b) ? genericArray : typeof b.valueOf !== "function" && typeof b.toString !== "function" || isNaN(b) ? object_default : number_default)(a, b);
|
|
986
|
+
}
|
|
987
|
+
// ../../node_modules/.bun/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/round.js
|
|
988
|
+
function round_default(a, b) {
|
|
989
|
+
return a = +a, b = +b, function(t) {
|
|
990
|
+
return Math.round(a * (1 - t) + b * t);
|
|
991
|
+
};
|
|
992
|
+
}
|
|
993
|
+
// ../../node_modules/.bun/d3-scale@4.0.2/node_modules/d3-scale/src/constant.js
|
|
994
|
+
function constants(x) {
|
|
995
|
+
return function() {
|
|
996
|
+
return x;
|
|
997
|
+
};
|
|
998
|
+
}
|
|
999
|
+
|
|
1000
|
+
// ../../node_modules/.bun/d3-scale@4.0.2/node_modules/d3-scale/src/number.js
|
|
1001
|
+
function number2(x) {
|
|
1002
|
+
return +x;
|
|
1003
|
+
}
|
|
1004
|
+
|
|
1005
|
+
// ../../node_modules/.bun/d3-scale@4.0.2/node_modules/d3-scale/src/continuous.js
|
|
1006
|
+
var unit = [0, 1];
|
|
1007
|
+
function identity(x) {
|
|
1008
|
+
return x;
|
|
1009
|
+
}
|
|
1010
|
+
function normalize(a, b) {
|
|
1011
|
+
return (b -= a = +a) ? function(x) {
|
|
1012
|
+
return (x - a) / b;
|
|
1013
|
+
} : constants(isNaN(b) ? NaN : 0.5);
|
|
1014
|
+
}
|
|
1015
|
+
function clamper(a, b) {
|
|
1016
|
+
var t;
|
|
1017
|
+
if (a > b)
|
|
1018
|
+
t = a, a = b, b = t;
|
|
1019
|
+
return function(x) {
|
|
1020
|
+
return Math.max(a, Math.min(b, x));
|
|
1021
|
+
};
|
|
1022
|
+
}
|
|
1023
|
+
function bimap(domain, range2, interpolate) {
|
|
1024
|
+
var d0 = domain[0], d1 = domain[1], r0 = range2[0], r1 = range2[1];
|
|
1025
|
+
if (d1 < d0)
|
|
1026
|
+
d0 = normalize(d1, d0), r0 = interpolate(r1, r0);
|
|
1027
|
+
else
|
|
1028
|
+
d0 = normalize(d0, d1), r0 = interpolate(r0, r1);
|
|
1029
|
+
return function(x) {
|
|
1030
|
+
return r0(d0(x));
|
|
1031
|
+
};
|
|
1032
|
+
}
|
|
1033
|
+
function polymap(domain, range2, interpolate) {
|
|
1034
|
+
var j = Math.min(domain.length, range2.length) - 1, d = new Array(j), r = new Array(j), i = -1;
|
|
1035
|
+
if (domain[j] < domain[0]) {
|
|
1036
|
+
domain = domain.slice().reverse();
|
|
1037
|
+
range2 = range2.slice().reverse();
|
|
1038
|
+
}
|
|
1039
|
+
while (++i < j) {
|
|
1040
|
+
d[i] = normalize(domain[i], domain[i + 1]);
|
|
1041
|
+
r[i] = interpolate(range2[i], range2[i + 1]);
|
|
1042
|
+
}
|
|
1043
|
+
return function(x) {
|
|
1044
|
+
var i2 = bisect_default(domain, x, 1, j) - 1;
|
|
1045
|
+
return r[i2](d[i2](x));
|
|
1046
|
+
};
|
|
1047
|
+
}
|
|
1048
|
+
function copy(source, target) {
|
|
1049
|
+
return target.domain(source.domain()).range(source.range()).interpolate(source.interpolate()).clamp(source.clamp()).unknown(source.unknown());
|
|
1050
|
+
}
|
|
1051
|
+
function transformer() {
|
|
1052
|
+
var domain = unit, range2 = unit, interpolate = value_default, transform, untransform, unknown, clamp = identity, piecewise, output, input;
|
|
1053
|
+
function rescale() {
|
|
1054
|
+
var n = Math.min(domain.length, range2.length);
|
|
1055
|
+
if (clamp !== identity)
|
|
1056
|
+
clamp = clamper(domain[0], domain[n - 1]);
|
|
1057
|
+
piecewise = n > 2 ? polymap : bimap;
|
|
1058
|
+
output = input = null;
|
|
1059
|
+
return scale;
|
|
1060
|
+
}
|
|
1061
|
+
function scale(x) {
|
|
1062
|
+
return x == null || isNaN(x = +x) ? unknown : (output || (output = piecewise(domain.map(transform), range2, interpolate)))(transform(clamp(x)));
|
|
1063
|
+
}
|
|
1064
|
+
scale.invert = function(y) {
|
|
1065
|
+
return clamp(untransform((input || (input = piecewise(range2, domain.map(transform), number_default)))(y)));
|
|
1066
|
+
};
|
|
1067
|
+
scale.domain = function(_) {
|
|
1068
|
+
return arguments.length ? (domain = Array.from(_, number2), rescale()) : domain.slice();
|
|
1069
|
+
};
|
|
1070
|
+
scale.range = function(_) {
|
|
1071
|
+
return arguments.length ? (range2 = Array.from(_), rescale()) : range2.slice();
|
|
1072
|
+
};
|
|
1073
|
+
scale.rangeRound = function(_) {
|
|
1074
|
+
return range2 = Array.from(_), interpolate = round_default, rescale();
|
|
1075
|
+
};
|
|
1076
|
+
scale.clamp = function(_) {
|
|
1077
|
+
return arguments.length ? (clamp = _ ? true : identity, rescale()) : clamp !== identity;
|
|
1078
|
+
};
|
|
1079
|
+
scale.interpolate = function(_) {
|
|
1080
|
+
return arguments.length ? (interpolate = _, rescale()) : interpolate;
|
|
1081
|
+
};
|
|
1082
|
+
scale.unknown = function(_) {
|
|
1083
|
+
return arguments.length ? (unknown = _, scale) : unknown;
|
|
1084
|
+
};
|
|
1085
|
+
return function(t, u) {
|
|
1086
|
+
transform = t, untransform = u;
|
|
1087
|
+
return rescale();
|
|
1088
|
+
};
|
|
1089
|
+
}
|
|
1090
|
+
function continuous() {
|
|
1091
|
+
return transformer()(identity, identity);
|
|
1092
|
+
}
|
|
1093
|
+
|
|
1094
|
+
// ../../node_modules/.bun/d3-format@3.1.2/node_modules/d3-format/src/formatDecimal.js
|
|
1095
|
+
function formatDecimal_default(x) {
|
|
1096
|
+
return Math.abs(x = Math.round(x)) >= 1000000000000000000000 ? x.toLocaleString("en").replace(/,/g, "") : x.toString(10);
|
|
1097
|
+
}
|
|
1098
|
+
function formatDecimalParts(x, p) {
|
|
1099
|
+
if (!isFinite(x) || x === 0)
|
|
1100
|
+
return null;
|
|
1101
|
+
var i = (x = p ? x.toExponential(p - 1) : x.toExponential()).indexOf("e"), coefficient = x.slice(0, i);
|
|
1102
|
+
return [
|
|
1103
|
+
coefficient.length > 1 ? coefficient[0] + coefficient.slice(2) : coefficient,
|
|
1104
|
+
+x.slice(i + 1)
|
|
1105
|
+
];
|
|
1106
|
+
}
|
|
1107
|
+
|
|
1108
|
+
// ../../node_modules/.bun/d3-format@3.1.2/node_modules/d3-format/src/exponent.js
|
|
1109
|
+
function exponent_default(x) {
|
|
1110
|
+
return x = formatDecimalParts(Math.abs(x)), x ? x[1] : NaN;
|
|
1111
|
+
}
|
|
1112
|
+
|
|
1113
|
+
// ../../node_modules/.bun/d3-format@3.1.2/node_modules/d3-format/src/formatGroup.js
|
|
1114
|
+
function formatGroup_default(grouping, thousands) {
|
|
1115
|
+
return function(value, width) {
|
|
1116
|
+
var i = value.length, t = [], j = 0, g = grouping[0], length = 0;
|
|
1117
|
+
while (i > 0 && g > 0) {
|
|
1118
|
+
if (length + g + 1 > width)
|
|
1119
|
+
g = Math.max(1, width - length);
|
|
1120
|
+
t.push(value.substring(i -= g, i + g));
|
|
1121
|
+
if ((length += g + 1) > width)
|
|
1122
|
+
break;
|
|
1123
|
+
g = grouping[j = (j + 1) % grouping.length];
|
|
1124
|
+
}
|
|
1125
|
+
return t.reverse().join(thousands);
|
|
1126
|
+
};
|
|
1127
|
+
}
|
|
1128
|
+
|
|
1129
|
+
// ../../node_modules/.bun/d3-format@3.1.2/node_modules/d3-format/src/formatNumerals.js
|
|
1130
|
+
function formatNumerals_default(numerals) {
|
|
1131
|
+
return function(value) {
|
|
1132
|
+
return value.replace(/[0-9]/g, function(i) {
|
|
1133
|
+
return numerals[+i];
|
|
1134
|
+
});
|
|
1135
|
+
};
|
|
1136
|
+
}
|
|
1137
|
+
|
|
1138
|
+
// ../../node_modules/.bun/d3-format@3.1.2/node_modules/d3-format/src/formatSpecifier.js
|
|
1139
|
+
var re = /^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;
|
|
1140
|
+
function formatSpecifier(specifier) {
|
|
1141
|
+
if (!(match = re.exec(specifier)))
|
|
1142
|
+
throw new Error("invalid format: " + specifier);
|
|
1143
|
+
var match;
|
|
1144
|
+
return new FormatSpecifier({
|
|
1145
|
+
fill: match[1],
|
|
1146
|
+
align: match[2],
|
|
1147
|
+
sign: match[3],
|
|
1148
|
+
symbol: match[4],
|
|
1149
|
+
zero: match[5],
|
|
1150
|
+
width: match[6],
|
|
1151
|
+
comma: match[7],
|
|
1152
|
+
precision: match[8] && match[8].slice(1),
|
|
1153
|
+
trim: match[9],
|
|
1154
|
+
type: match[10]
|
|
1155
|
+
});
|
|
1156
|
+
}
|
|
1157
|
+
formatSpecifier.prototype = FormatSpecifier.prototype;
|
|
1158
|
+
function FormatSpecifier(specifier) {
|
|
1159
|
+
this.fill = specifier.fill === undefined ? " " : specifier.fill + "";
|
|
1160
|
+
this.align = specifier.align === undefined ? ">" : specifier.align + "";
|
|
1161
|
+
this.sign = specifier.sign === undefined ? "-" : specifier.sign + "";
|
|
1162
|
+
this.symbol = specifier.symbol === undefined ? "" : specifier.symbol + "";
|
|
1163
|
+
this.zero = !!specifier.zero;
|
|
1164
|
+
this.width = specifier.width === undefined ? undefined : +specifier.width;
|
|
1165
|
+
this.comma = !!specifier.comma;
|
|
1166
|
+
this.precision = specifier.precision === undefined ? undefined : +specifier.precision;
|
|
1167
|
+
this.trim = !!specifier.trim;
|
|
1168
|
+
this.type = specifier.type === undefined ? "" : specifier.type + "";
|
|
1169
|
+
}
|
|
1170
|
+
FormatSpecifier.prototype.toString = function() {
|
|
1171
|
+
return this.fill + this.align + this.sign + this.symbol + (this.zero ? "0" : "") + (this.width === undefined ? "" : Math.max(1, this.width | 0)) + (this.comma ? "," : "") + (this.precision === undefined ? "" : "." + Math.max(0, this.precision | 0)) + (this.trim ? "~" : "") + this.type;
|
|
1172
|
+
};
|
|
1173
|
+
|
|
1174
|
+
// ../../node_modules/.bun/d3-format@3.1.2/node_modules/d3-format/src/formatTrim.js
|
|
1175
|
+
function formatTrim_default(s) {
|
|
1176
|
+
out:
|
|
1177
|
+
for (var n = s.length, i = 1, i0 = -1, i1;i < n; ++i) {
|
|
1178
|
+
switch (s[i]) {
|
|
1179
|
+
case ".":
|
|
1180
|
+
i0 = i1 = i;
|
|
1181
|
+
break;
|
|
1182
|
+
case "0":
|
|
1183
|
+
if (i0 === 0)
|
|
1184
|
+
i0 = i;
|
|
1185
|
+
i1 = i;
|
|
1186
|
+
break;
|
|
1187
|
+
default:
|
|
1188
|
+
if (!+s[i])
|
|
1189
|
+
break out;
|
|
1190
|
+
if (i0 > 0)
|
|
1191
|
+
i0 = 0;
|
|
1192
|
+
break;
|
|
1193
|
+
}
|
|
1194
|
+
}
|
|
1195
|
+
return i0 > 0 ? s.slice(0, i0) + s.slice(i1 + 1) : s;
|
|
1196
|
+
}
|
|
1197
|
+
|
|
1198
|
+
// ../../node_modules/.bun/d3-format@3.1.2/node_modules/d3-format/src/formatPrefixAuto.js
|
|
1199
|
+
var prefixExponent;
|
|
1200
|
+
function formatPrefixAuto_default(x, p) {
|
|
1201
|
+
var d = formatDecimalParts(x, p);
|
|
1202
|
+
if (!d)
|
|
1203
|
+
return prefixExponent = undefined, x.toPrecision(p);
|
|
1204
|
+
var coefficient = d[0], exponent = d[1], i = exponent - (prefixExponent = Math.max(-8, Math.min(8, Math.floor(exponent / 3))) * 3) + 1, n = coefficient.length;
|
|
1205
|
+
return i === n ? coefficient : i > n ? coefficient + new Array(i - n + 1).join("0") : i > 0 ? coefficient.slice(0, i) + "." + coefficient.slice(i) : "0." + new Array(1 - i).join("0") + formatDecimalParts(x, Math.max(0, p + i - 1))[0];
|
|
1206
|
+
}
|
|
1207
|
+
|
|
1208
|
+
// ../../node_modules/.bun/d3-format@3.1.2/node_modules/d3-format/src/formatRounded.js
|
|
1209
|
+
function formatRounded_default(x, p) {
|
|
1210
|
+
var d = formatDecimalParts(x, p);
|
|
1211
|
+
if (!d)
|
|
1212
|
+
return x + "";
|
|
1213
|
+
var coefficient = d[0], exponent = d[1];
|
|
1214
|
+
return exponent < 0 ? "0." + new Array(-exponent).join("0") + coefficient : coefficient.length > exponent + 1 ? coefficient.slice(0, exponent + 1) + "." + coefficient.slice(exponent + 1) : coefficient + new Array(exponent - coefficient.length + 2).join("0");
|
|
1215
|
+
}
|
|
1216
|
+
|
|
1217
|
+
// ../../node_modules/.bun/d3-format@3.1.2/node_modules/d3-format/src/formatTypes.js
|
|
1218
|
+
var formatTypes_default = {
|
|
1219
|
+
"%": (x, p) => (x * 100).toFixed(p),
|
|
1220
|
+
b: (x) => Math.round(x).toString(2),
|
|
1221
|
+
c: (x) => x + "",
|
|
1222
|
+
d: formatDecimal_default,
|
|
1223
|
+
e: (x, p) => x.toExponential(p),
|
|
1224
|
+
f: (x, p) => x.toFixed(p),
|
|
1225
|
+
g: (x, p) => x.toPrecision(p),
|
|
1226
|
+
o: (x) => Math.round(x).toString(8),
|
|
1227
|
+
p: (x, p) => formatRounded_default(x * 100, p),
|
|
1228
|
+
r: formatRounded_default,
|
|
1229
|
+
s: formatPrefixAuto_default,
|
|
1230
|
+
X: (x) => Math.round(x).toString(16).toUpperCase(),
|
|
1231
|
+
x: (x) => Math.round(x).toString(16)
|
|
1232
|
+
};
|
|
1233
|
+
|
|
1234
|
+
// ../../node_modules/.bun/d3-format@3.1.2/node_modules/d3-format/src/identity.js
|
|
1235
|
+
function identity_default(x) {
|
|
1236
|
+
return x;
|
|
1237
|
+
}
|
|
1238
|
+
|
|
1239
|
+
// ../../node_modules/.bun/d3-format@3.1.2/node_modules/d3-format/src/locale.js
|
|
1240
|
+
var map = Array.prototype.map;
|
|
1241
|
+
var prefixes = ["y", "z", "a", "f", "p", "n", "µ", "m", "", "k", "M", "G", "T", "P", "E", "Z", "Y"];
|
|
1242
|
+
function locale_default(locale) {
|
|
1243
|
+
var group = locale.grouping === undefined || locale.thousands === undefined ? identity_default : formatGroup_default(map.call(locale.grouping, Number), locale.thousands + ""), currencyPrefix = locale.currency === undefined ? "" : locale.currency[0] + "", currencySuffix = locale.currency === undefined ? "" : locale.currency[1] + "", decimal = locale.decimal === undefined ? "." : locale.decimal + "", numerals = locale.numerals === undefined ? identity_default : formatNumerals_default(map.call(locale.numerals, String)), percent = locale.percent === undefined ? "%" : locale.percent + "", minus = locale.minus === undefined ? "−" : locale.minus + "", nan = locale.nan === undefined ? "NaN" : locale.nan + "";
|
|
1244
|
+
function newFormat(specifier, options) {
|
|
1245
|
+
specifier = formatSpecifier(specifier);
|
|
1246
|
+
var { fill, align, sign, symbol, zero: zero3, width, comma, precision, trim, type } = specifier;
|
|
1247
|
+
if (type === "n")
|
|
1248
|
+
comma = true, type = "g";
|
|
1249
|
+
else if (!formatTypes_default[type])
|
|
1250
|
+
precision === undefined && (precision = 12), trim = true, type = "g";
|
|
1251
|
+
if (zero3 || fill === "0" && align === "=")
|
|
1252
|
+
zero3 = true, fill = "0", align = "=";
|
|
1253
|
+
var prefix = (options && options.prefix !== undefined ? options.prefix : "") + (symbol === "$" ? currencyPrefix : symbol === "#" && /[boxX]/.test(type) ? "0" + type.toLowerCase() : ""), suffix = (symbol === "$" ? currencySuffix : /[%p]/.test(type) ? percent : "") + (options && options.suffix !== undefined ? options.suffix : "");
|
|
1254
|
+
var formatType = formatTypes_default[type], maybeSuffix = /[defgprs%]/.test(type);
|
|
1255
|
+
precision = precision === undefined ? 6 : /[gprs]/.test(type) ? Math.max(1, Math.min(21, precision)) : Math.max(0, Math.min(20, precision));
|
|
1256
|
+
function format(value) {
|
|
1257
|
+
var valuePrefix = prefix, valueSuffix = suffix, i, n, c;
|
|
1258
|
+
if (type === "c") {
|
|
1259
|
+
valueSuffix = formatType(value) + valueSuffix;
|
|
1260
|
+
value = "";
|
|
1261
|
+
} else {
|
|
1262
|
+
value = +value;
|
|
1263
|
+
var valueNegative = value < 0 || 1 / value < 0;
|
|
1264
|
+
value = isNaN(value) ? nan : formatType(Math.abs(value), precision);
|
|
1265
|
+
if (trim)
|
|
1266
|
+
value = formatTrim_default(value);
|
|
1267
|
+
if (valueNegative && +value === 0 && sign !== "+")
|
|
1268
|
+
valueNegative = false;
|
|
1269
|
+
valuePrefix = (valueNegative ? sign === "(" ? sign : minus : sign === "-" || sign === "(" ? "" : sign) + valuePrefix;
|
|
1270
|
+
valueSuffix = (type === "s" && !isNaN(value) && prefixExponent !== undefined ? prefixes[8 + prefixExponent / 3] : "") + valueSuffix + (valueNegative && sign === "(" ? ")" : "");
|
|
1271
|
+
if (maybeSuffix) {
|
|
1272
|
+
i = -1, n = value.length;
|
|
1273
|
+
while (++i < n) {
|
|
1274
|
+
if (c = value.charCodeAt(i), 48 > c || c > 57) {
|
|
1275
|
+
valueSuffix = (c === 46 ? decimal + value.slice(i + 1) : value.slice(i)) + valueSuffix;
|
|
1276
|
+
value = value.slice(0, i);
|
|
1277
|
+
break;
|
|
1278
|
+
}
|
|
1279
|
+
}
|
|
1280
|
+
}
|
|
1281
|
+
}
|
|
1282
|
+
if (comma && !zero3)
|
|
1283
|
+
value = group(value, Infinity);
|
|
1284
|
+
var length = valuePrefix.length + value.length + valueSuffix.length, padding = length < width ? new Array(width - length + 1).join(fill) : "";
|
|
1285
|
+
if (comma && zero3)
|
|
1286
|
+
value = group(padding + value, padding.length ? width - valueSuffix.length : Infinity), padding = "";
|
|
1287
|
+
switch (align) {
|
|
1288
|
+
case "<":
|
|
1289
|
+
value = valuePrefix + value + valueSuffix + padding;
|
|
1290
|
+
break;
|
|
1291
|
+
case "=":
|
|
1292
|
+
value = valuePrefix + padding + value + valueSuffix;
|
|
1293
|
+
break;
|
|
1294
|
+
case "^":
|
|
1295
|
+
value = padding.slice(0, length = padding.length >> 1) + valuePrefix + value + valueSuffix + padding.slice(length);
|
|
1296
|
+
break;
|
|
1297
|
+
default:
|
|
1298
|
+
value = padding + valuePrefix + value + valueSuffix;
|
|
1299
|
+
break;
|
|
1300
|
+
}
|
|
1301
|
+
return numerals(value);
|
|
1302
|
+
}
|
|
1303
|
+
format.toString = function() {
|
|
1304
|
+
return specifier + "";
|
|
1305
|
+
};
|
|
1306
|
+
return format;
|
|
1307
|
+
}
|
|
1308
|
+
function formatPrefix(specifier, value) {
|
|
1309
|
+
var e = Math.max(-8, Math.min(8, Math.floor(exponent_default(value) / 3))) * 3, k = Math.pow(10, -e), f = newFormat((specifier = formatSpecifier(specifier), specifier.type = "f", specifier), { suffix: prefixes[8 + e / 3] });
|
|
1310
|
+
return function(value2) {
|
|
1311
|
+
return f(k * value2);
|
|
1312
|
+
};
|
|
1313
|
+
}
|
|
1314
|
+
return {
|
|
1315
|
+
format: newFormat,
|
|
1316
|
+
formatPrefix
|
|
1317
|
+
};
|
|
1318
|
+
}
|
|
1319
|
+
|
|
1320
|
+
// ../../node_modules/.bun/d3-format@3.1.2/node_modules/d3-format/src/defaultLocale.js
|
|
1321
|
+
var locale;
|
|
1322
|
+
var format;
|
|
1323
|
+
var formatPrefix;
|
|
1324
|
+
defaultLocale({
|
|
1325
|
+
thousands: ",",
|
|
1326
|
+
grouping: [3],
|
|
1327
|
+
currency: ["$", ""]
|
|
1328
|
+
});
|
|
1329
|
+
function defaultLocale(definition) {
|
|
1330
|
+
locale = locale_default(definition);
|
|
1331
|
+
format = locale.format;
|
|
1332
|
+
formatPrefix = locale.formatPrefix;
|
|
1333
|
+
return locale;
|
|
1334
|
+
}
|
|
1335
|
+
// ../../node_modules/.bun/d3-format@3.1.2/node_modules/d3-format/src/precisionFixed.js
|
|
1336
|
+
function precisionFixed_default(step) {
|
|
1337
|
+
return Math.max(0, -exponent_default(Math.abs(step)));
|
|
1338
|
+
}
|
|
1339
|
+
// ../../node_modules/.bun/d3-format@3.1.2/node_modules/d3-format/src/precisionPrefix.js
|
|
1340
|
+
function precisionPrefix_default(step, value) {
|
|
1341
|
+
return Math.max(0, Math.max(-8, Math.min(8, Math.floor(exponent_default(value) / 3))) * 3 - exponent_default(Math.abs(step)));
|
|
1342
|
+
}
|
|
1343
|
+
// ../../node_modules/.bun/d3-format@3.1.2/node_modules/d3-format/src/precisionRound.js
|
|
1344
|
+
function precisionRound_default(step, max2) {
|
|
1345
|
+
step = Math.abs(step), max2 = Math.abs(max2) - step;
|
|
1346
|
+
return Math.max(0, exponent_default(max2) - exponent_default(step)) + 1;
|
|
1347
|
+
}
|
|
1348
|
+
// ../../node_modules/.bun/d3-scale@4.0.2/node_modules/d3-scale/src/tickFormat.js
|
|
1349
|
+
function tickFormat(start, stop, count, specifier) {
|
|
1350
|
+
var step = tickStep(start, stop, count), precision;
|
|
1351
|
+
specifier = formatSpecifier(specifier == null ? ",f" : specifier);
|
|
1352
|
+
switch (specifier.type) {
|
|
1353
|
+
case "s": {
|
|
1354
|
+
var value = Math.max(Math.abs(start), Math.abs(stop));
|
|
1355
|
+
if (specifier.precision == null && !isNaN(precision = precisionPrefix_default(step, value)))
|
|
1356
|
+
specifier.precision = precision;
|
|
1357
|
+
return formatPrefix(specifier, value);
|
|
1358
|
+
}
|
|
1359
|
+
case "":
|
|
1360
|
+
case "e":
|
|
1361
|
+
case "g":
|
|
1362
|
+
case "p":
|
|
1363
|
+
case "r": {
|
|
1364
|
+
if (specifier.precision == null && !isNaN(precision = precisionRound_default(step, Math.max(Math.abs(start), Math.abs(stop)))))
|
|
1365
|
+
specifier.precision = precision - (specifier.type === "e");
|
|
1366
|
+
break;
|
|
1367
|
+
}
|
|
1368
|
+
case "f":
|
|
1369
|
+
case "%": {
|
|
1370
|
+
if (specifier.precision == null && !isNaN(precision = precisionFixed_default(step)))
|
|
1371
|
+
specifier.precision = precision - (specifier.type === "%") * 2;
|
|
1372
|
+
break;
|
|
1373
|
+
}
|
|
1374
|
+
}
|
|
1375
|
+
return format(specifier);
|
|
1376
|
+
}
|
|
1377
|
+
|
|
1378
|
+
// ../../node_modules/.bun/d3-scale@4.0.2/node_modules/d3-scale/src/linear.js
|
|
1379
|
+
function linearish(scale) {
|
|
1380
|
+
var domain = scale.domain;
|
|
1381
|
+
scale.ticks = function(count) {
|
|
1382
|
+
var d = domain();
|
|
1383
|
+
return ticks(d[0], d[d.length - 1], count == null ? 10 : count);
|
|
1384
|
+
};
|
|
1385
|
+
scale.tickFormat = function(count, specifier) {
|
|
1386
|
+
var d = domain();
|
|
1387
|
+
return tickFormat(d[0], d[d.length - 1], count == null ? 10 : count, specifier);
|
|
1388
|
+
};
|
|
1389
|
+
scale.nice = function(count) {
|
|
1390
|
+
if (count == null)
|
|
1391
|
+
count = 10;
|
|
1392
|
+
var d = domain();
|
|
1393
|
+
var i0 = 0;
|
|
1394
|
+
var i1 = d.length - 1;
|
|
1395
|
+
var start = d[i0];
|
|
1396
|
+
var stop = d[i1];
|
|
1397
|
+
var prestep;
|
|
1398
|
+
var step;
|
|
1399
|
+
var maxIter = 10;
|
|
1400
|
+
if (stop < start) {
|
|
1401
|
+
step = start, start = stop, stop = step;
|
|
1402
|
+
step = i0, i0 = i1, i1 = step;
|
|
1403
|
+
}
|
|
1404
|
+
while (maxIter-- > 0) {
|
|
1405
|
+
step = tickIncrement(start, stop, count);
|
|
1406
|
+
if (step === prestep) {
|
|
1407
|
+
d[i0] = start;
|
|
1408
|
+
d[i1] = stop;
|
|
1409
|
+
return domain(d);
|
|
1410
|
+
} else if (step > 0) {
|
|
1411
|
+
start = Math.floor(start / step) * step;
|
|
1412
|
+
stop = Math.ceil(stop / step) * step;
|
|
1413
|
+
} else if (step < 0) {
|
|
1414
|
+
start = Math.ceil(start * step) / step;
|
|
1415
|
+
stop = Math.floor(stop * step) / step;
|
|
1416
|
+
} else {
|
|
1417
|
+
break;
|
|
1418
|
+
}
|
|
1419
|
+
prestep = step;
|
|
1420
|
+
}
|
|
1421
|
+
return scale;
|
|
1422
|
+
};
|
|
1423
|
+
return scale;
|
|
1424
|
+
}
|
|
1425
|
+
function linear2() {
|
|
1426
|
+
var scale = continuous();
|
|
1427
|
+
scale.copy = function() {
|
|
1428
|
+
return copy(scale, linear2());
|
|
1429
|
+
};
|
|
1430
|
+
initRange.apply(scale, arguments);
|
|
1431
|
+
return linearish(scale);
|
|
1432
|
+
}
|
|
1433
|
+
// src/utils/scales.ts
|
|
1434
|
+
function createBandScale(data, dataKey, width) {
|
|
1435
|
+
return band().domain(data.map((d) => String(d[dataKey]))).range([0, width]).padding(0.2);
|
|
1436
|
+
}
|
|
1437
|
+
function createLinearScale(data, dataKeys, height) {
|
|
1438
|
+
const maxValue = max(data, (d) => max(dataKeys, (key) => {
|
|
1439
|
+
const v = d[key];
|
|
1440
|
+
return typeof v === "number" ? v : 0;
|
|
1441
|
+
})) ?? 0;
|
|
1442
|
+
return linear2().domain([0, maxValue]).nice().range([height, 0]);
|
|
1443
|
+
}
|
|
1444
|
+
function createPointScale(data, dataKey, width) {
|
|
1445
|
+
return point().domain(data.map((d) => String(d[dataKey]))).range([0, width]).padding(0.5);
|
|
1446
|
+
}
|
|
1447
|
+
function createRadarRadialScale(data, dataKeys, radius) {
|
|
1448
|
+
if (dataKeys.length === 0)
|
|
1449
|
+
return null;
|
|
1450
|
+
const maxValue = max(data, (d) => max(dataKeys, (key) => {
|
|
1451
|
+
const v = d[key];
|
|
1452
|
+
return typeof v === "number" ? v : 0;
|
|
1453
|
+
})) ?? 0;
|
|
1454
|
+
return linear2().domain([0, maxValue]).nice().range([0, radius]);
|
|
1455
|
+
}
|
|
1456
|
+
// ../../node_modules/.bun/d3-shape@3.2.0/node_modules/d3-shape/src/constant.js
|
|
1457
|
+
function constant_default2(x) {
|
|
1458
|
+
return function constant() {
|
|
1459
|
+
return x;
|
|
1460
|
+
};
|
|
1461
|
+
}
|
|
1462
|
+
|
|
1463
|
+
// ../../node_modules/.bun/d3-shape@3.2.0/node_modules/d3-shape/src/math.js
|
|
1464
|
+
var abs = Math.abs;
|
|
1465
|
+
var atan2 = Math.atan2;
|
|
1466
|
+
var cos = Math.cos;
|
|
1467
|
+
var max2 = Math.max;
|
|
1468
|
+
var min = Math.min;
|
|
1469
|
+
var sin = Math.sin;
|
|
1470
|
+
var sqrt = Math.sqrt;
|
|
1471
|
+
var epsilon = 0.000000000001;
|
|
1472
|
+
var pi = Math.PI;
|
|
1473
|
+
var halfPi = pi / 2;
|
|
1474
|
+
var tau = 2 * pi;
|
|
1475
|
+
function acos(x) {
|
|
1476
|
+
return x > 1 ? 0 : x < -1 ? pi : Math.acos(x);
|
|
1477
|
+
}
|
|
1478
|
+
function asin(x) {
|
|
1479
|
+
return x >= 1 ? halfPi : x <= -1 ? -halfPi : Math.asin(x);
|
|
1480
|
+
}
|
|
1481
|
+
|
|
1482
|
+
// ../../node_modules/.bun/d3-path@3.1.0/node_modules/d3-path/src/path.js
|
|
1483
|
+
var pi2 = Math.PI;
|
|
1484
|
+
var tau2 = 2 * pi2;
|
|
1485
|
+
var epsilon2 = 0.000001;
|
|
1486
|
+
var tauEpsilon = tau2 - epsilon2;
|
|
1487
|
+
function append(strings) {
|
|
1488
|
+
this._ += strings[0];
|
|
1489
|
+
for (let i = 1, n = strings.length;i < n; ++i) {
|
|
1490
|
+
this._ += arguments[i] + strings[i];
|
|
1491
|
+
}
|
|
1492
|
+
}
|
|
1493
|
+
function appendRound(digits) {
|
|
1494
|
+
let d = Math.floor(digits);
|
|
1495
|
+
if (!(d >= 0))
|
|
1496
|
+
throw new Error(`invalid digits: ${digits}`);
|
|
1497
|
+
if (d > 15)
|
|
1498
|
+
return append;
|
|
1499
|
+
const k = 10 ** d;
|
|
1500
|
+
return function(strings) {
|
|
1501
|
+
this._ += strings[0];
|
|
1502
|
+
for (let i = 1, n = strings.length;i < n; ++i) {
|
|
1503
|
+
this._ += Math.round(arguments[i] * k) / k + strings[i];
|
|
1504
|
+
}
|
|
1505
|
+
};
|
|
1506
|
+
}
|
|
1507
|
+
|
|
1508
|
+
class Path {
|
|
1509
|
+
constructor(digits) {
|
|
1510
|
+
this._x0 = this._y0 = this._x1 = this._y1 = null;
|
|
1511
|
+
this._ = "";
|
|
1512
|
+
this._append = digits == null ? append : appendRound(digits);
|
|
1513
|
+
}
|
|
1514
|
+
moveTo(x, y) {
|
|
1515
|
+
this._append`M${this._x0 = this._x1 = +x},${this._y0 = this._y1 = +y}`;
|
|
1516
|
+
}
|
|
1517
|
+
closePath() {
|
|
1518
|
+
if (this._x1 !== null) {
|
|
1519
|
+
this._x1 = this._x0, this._y1 = this._y0;
|
|
1520
|
+
this._append`Z`;
|
|
1521
|
+
}
|
|
1522
|
+
}
|
|
1523
|
+
lineTo(x, y) {
|
|
1524
|
+
this._append`L${this._x1 = +x},${this._y1 = +y}`;
|
|
1525
|
+
}
|
|
1526
|
+
quadraticCurveTo(x1, y1, x, y) {
|
|
1527
|
+
this._append`Q${+x1},${+y1},${this._x1 = +x},${this._y1 = +y}`;
|
|
1528
|
+
}
|
|
1529
|
+
bezierCurveTo(x1, y1, x2, y2, x, y) {
|
|
1530
|
+
this._append`C${+x1},${+y1},${+x2},${+y2},${this._x1 = +x},${this._y1 = +y}`;
|
|
1531
|
+
}
|
|
1532
|
+
arcTo(x1, y1, x2, y2, r) {
|
|
1533
|
+
x1 = +x1, y1 = +y1, x2 = +x2, y2 = +y2, r = +r;
|
|
1534
|
+
if (r < 0)
|
|
1535
|
+
throw new Error(`negative radius: ${r}`);
|
|
1536
|
+
let x0 = this._x1, y0 = this._y1, x21 = x2 - x1, y21 = y2 - y1, x01 = x0 - x1, y01 = y0 - y1, l01_2 = x01 * x01 + y01 * y01;
|
|
1537
|
+
if (this._x1 === null) {
|
|
1538
|
+
this._append`M${this._x1 = x1},${this._y1 = y1}`;
|
|
1539
|
+
} else if (!(l01_2 > epsilon2))
|
|
1540
|
+
;
|
|
1541
|
+
else if (!(Math.abs(y01 * x21 - y21 * x01) > epsilon2) || !r) {
|
|
1542
|
+
this._append`L${this._x1 = x1},${this._y1 = y1}`;
|
|
1543
|
+
} else {
|
|
1544
|
+
let x20 = x2 - x0, y20 = y2 - y0, l21_2 = x21 * x21 + y21 * y21, l20_2 = x20 * x20 + y20 * y20, l21 = Math.sqrt(l21_2), l01 = Math.sqrt(l01_2), l = r * Math.tan((pi2 - Math.acos((l21_2 + l01_2 - l20_2) / (2 * l21 * l01))) / 2), t01 = l / l01, t21 = l / l21;
|
|
1545
|
+
if (Math.abs(t01 - 1) > epsilon2) {
|
|
1546
|
+
this._append`L${x1 + t01 * x01},${y1 + t01 * y01}`;
|
|
1547
|
+
}
|
|
1548
|
+
this._append`A${r},${r},0,0,${+(y01 * x20 > x01 * y20)},${this._x1 = x1 + t21 * x21},${this._y1 = y1 + t21 * y21}`;
|
|
1549
|
+
}
|
|
1550
|
+
}
|
|
1551
|
+
arc(x, y, r, a0, a1, ccw) {
|
|
1552
|
+
x = +x, y = +y, r = +r, ccw = !!ccw;
|
|
1553
|
+
if (r < 0)
|
|
1554
|
+
throw new Error(`negative radius: ${r}`);
|
|
1555
|
+
let dx = r * Math.cos(a0), dy = r * Math.sin(a0), x0 = x + dx, y0 = y + dy, cw = 1 ^ ccw, da = ccw ? a0 - a1 : a1 - a0;
|
|
1556
|
+
if (this._x1 === null) {
|
|
1557
|
+
this._append`M${x0},${y0}`;
|
|
1558
|
+
} else if (Math.abs(this._x1 - x0) > epsilon2 || Math.abs(this._y1 - y0) > epsilon2) {
|
|
1559
|
+
this._append`L${x0},${y0}`;
|
|
1560
|
+
}
|
|
1561
|
+
if (!r)
|
|
1562
|
+
return;
|
|
1563
|
+
if (da < 0)
|
|
1564
|
+
da = da % tau2 + tau2;
|
|
1565
|
+
if (da > tauEpsilon) {
|
|
1566
|
+
this._append`A${r},${r},0,1,${cw},${x - dx},${y - dy}A${r},${r},0,1,${cw},${this._x1 = x0},${this._y1 = y0}`;
|
|
1567
|
+
} else if (da > epsilon2) {
|
|
1568
|
+
this._append`A${r},${r},0,${+(da >= pi2)},${cw},${this._x1 = x + r * Math.cos(a1)},${this._y1 = y + r * Math.sin(a1)}`;
|
|
1569
|
+
}
|
|
1570
|
+
}
|
|
1571
|
+
rect(x, y, w, h) {
|
|
1572
|
+
this._append`M${this._x0 = this._x1 = +x},${this._y0 = this._y1 = +y}h${w = +w}v${+h}h${-w}Z`;
|
|
1573
|
+
}
|
|
1574
|
+
toString() {
|
|
1575
|
+
return this._;
|
|
1576
|
+
}
|
|
1577
|
+
}
|
|
1578
|
+
function path() {
|
|
1579
|
+
return new Path;
|
|
1580
|
+
}
|
|
1581
|
+
path.prototype = Path.prototype;
|
|
1582
|
+
// ../../node_modules/.bun/d3-shape@3.2.0/node_modules/d3-shape/src/path.js
|
|
1583
|
+
function withPath(shape) {
|
|
1584
|
+
let digits = 3;
|
|
1585
|
+
shape.digits = function(_) {
|
|
1586
|
+
if (!arguments.length)
|
|
1587
|
+
return digits;
|
|
1588
|
+
if (_ == null) {
|
|
1589
|
+
digits = null;
|
|
1590
|
+
} else {
|
|
1591
|
+
const d = Math.floor(_);
|
|
1592
|
+
if (!(d >= 0))
|
|
1593
|
+
throw new RangeError(`invalid digits: ${_}`);
|
|
1594
|
+
digits = d;
|
|
1595
|
+
}
|
|
1596
|
+
return shape;
|
|
1597
|
+
};
|
|
1598
|
+
return () => new Path(digits);
|
|
1599
|
+
}
|
|
1600
|
+
|
|
1601
|
+
// ../../node_modules/.bun/d3-shape@3.2.0/node_modules/d3-shape/src/arc.js
|
|
1602
|
+
function arcInnerRadius(d) {
|
|
1603
|
+
return d.innerRadius;
|
|
1604
|
+
}
|
|
1605
|
+
function arcOuterRadius(d) {
|
|
1606
|
+
return d.outerRadius;
|
|
1607
|
+
}
|
|
1608
|
+
function arcStartAngle(d) {
|
|
1609
|
+
return d.startAngle;
|
|
1610
|
+
}
|
|
1611
|
+
function arcEndAngle(d) {
|
|
1612
|
+
return d.endAngle;
|
|
1613
|
+
}
|
|
1614
|
+
function arcPadAngle(d) {
|
|
1615
|
+
return d && d.padAngle;
|
|
1616
|
+
}
|
|
1617
|
+
function intersect(x0, y0, x1, y1, x2, y2, x3, y3) {
|
|
1618
|
+
var x10 = x1 - x0, y10 = y1 - y0, x32 = x3 - x2, y32 = y3 - y2, t = y32 * x10 - x32 * y10;
|
|
1619
|
+
if (t * t < epsilon)
|
|
1620
|
+
return;
|
|
1621
|
+
t = (x32 * (y0 - y2) - y32 * (x0 - x2)) / t;
|
|
1622
|
+
return [x0 + t * x10, y0 + t * y10];
|
|
1623
|
+
}
|
|
1624
|
+
function cornerTangents(x0, y0, x1, y1, r1, rc, cw) {
|
|
1625
|
+
var x01 = x0 - x1, y01 = y0 - y1, lo = (cw ? rc : -rc) / sqrt(x01 * x01 + y01 * y01), ox = lo * y01, oy = -lo * x01, x11 = x0 + ox, y11 = y0 + oy, x10 = x1 + ox, y10 = y1 + oy, x00 = (x11 + x10) / 2, y00 = (y11 + y10) / 2, dx = x10 - x11, dy = y10 - y11, d2 = dx * dx + dy * dy, r = r1 - rc, D = x11 * y10 - x10 * y11, d = (dy < 0 ? -1 : 1) * sqrt(max2(0, r * r * d2 - D * D)), cx0 = (D * dy - dx * d) / d2, cy0 = (-D * dx - dy * d) / d2, cx1 = (D * dy + dx * d) / d2, cy1 = (-D * dx + dy * d) / d2, dx0 = cx0 - x00, dy0 = cy0 - y00, dx1 = cx1 - x00, dy1 = cy1 - y00;
|
|
1626
|
+
if (dx0 * dx0 + dy0 * dy0 > dx1 * dx1 + dy1 * dy1)
|
|
1627
|
+
cx0 = cx1, cy0 = cy1;
|
|
1628
|
+
return {
|
|
1629
|
+
cx: cx0,
|
|
1630
|
+
cy: cy0,
|
|
1631
|
+
x01: -ox,
|
|
1632
|
+
y01: -oy,
|
|
1633
|
+
x11: cx0 * (r1 / r - 1),
|
|
1634
|
+
y11: cy0 * (r1 / r - 1)
|
|
1635
|
+
};
|
|
1636
|
+
}
|
|
1637
|
+
function arc_default() {
|
|
1638
|
+
var innerRadius = arcInnerRadius, outerRadius = arcOuterRadius, cornerRadius = constant_default2(0), padRadius = null, startAngle = arcStartAngle, endAngle = arcEndAngle, padAngle = arcPadAngle, context = null, path2 = withPath(arc);
|
|
1639
|
+
function arc() {
|
|
1640
|
+
var buffer, r, r0 = +innerRadius.apply(this, arguments), r1 = +outerRadius.apply(this, arguments), a0 = startAngle.apply(this, arguments) - halfPi, a1 = endAngle.apply(this, arguments) - halfPi, da = abs(a1 - a0), cw = a1 > a0;
|
|
1641
|
+
if (!context)
|
|
1642
|
+
context = buffer = path2();
|
|
1643
|
+
if (r1 < r0)
|
|
1644
|
+
r = r1, r1 = r0, r0 = r;
|
|
1645
|
+
if (!(r1 > epsilon))
|
|
1646
|
+
context.moveTo(0, 0);
|
|
1647
|
+
else if (da > tau - epsilon) {
|
|
1648
|
+
context.moveTo(r1 * cos(a0), r1 * sin(a0));
|
|
1649
|
+
context.arc(0, 0, r1, a0, a1, !cw);
|
|
1650
|
+
if (r0 > epsilon) {
|
|
1651
|
+
context.moveTo(r0 * cos(a1), r0 * sin(a1));
|
|
1652
|
+
context.arc(0, 0, r0, a1, a0, cw);
|
|
1653
|
+
}
|
|
1654
|
+
} else {
|
|
1655
|
+
var a01 = a0, a11 = a1, a00 = a0, a10 = a1, da0 = da, da1 = da, ap = padAngle.apply(this, arguments) / 2, rp = ap > epsilon && (padRadius ? +padRadius.apply(this, arguments) : sqrt(r0 * r0 + r1 * r1)), rc = min(abs(r1 - r0) / 2, +cornerRadius.apply(this, arguments)), rc0 = rc, rc1 = rc, t0, t1;
|
|
1656
|
+
if (rp > epsilon) {
|
|
1657
|
+
var p0 = asin(rp / r0 * sin(ap)), p1 = asin(rp / r1 * sin(ap));
|
|
1658
|
+
if ((da0 -= p0 * 2) > epsilon)
|
|
1659
|
+
p0 *= cw ? 1 : -1, a00 += p0, a10 -= p0;
|
|
1660
|
+
else
|
|
1661
|
+
da0 = 0, a00 = a10 = (a0 + a1) / 2;
|
|
1662
|
+
if ((da1 -= p1 * 2) > epsilon)
|
|
1663
|
+
p1 *= cw ? 1 : -1, a01 += p1, a11 -= p1;
|
|
1664
|
+
else
|
|
1665
|
+
da1 = 0, a01 = a11 = (a0 + a1) / 2;
|
|
1666
|
+
}
|
|
1667
|
+
var x01 = r1 * cos(a01), y01 = r1 * sin(a01), x10 = r0 * cos(a10), y10 = r0 * sin(a10);
|
|
1668
|
+
if (rc > epsilon) {
|
|
1669
|
+
var x11 = r1 * cos(a11), y11 = r1 * sin(a11), x00 = r0 * cos(a00), y00 = r0 * sin(a00), oc;
|
|
1670
|
+
if (da < pi) {
|
|
1671
|
+
if (oc = intersect(x01, y01, x00, y00, x11, y11, x10, y10)) {
|
|
1672
|
+
var ax = x01 - oc[0], ay = y01 - oc[1], bx = x11 - oc[0], by = y11 - oc[1], kc = 1 / sin(acos((ax * bx + ay * by) / (sqrt(ax * ax + ay * ay) * sqrt(bx * bx + by * by))) / 2), lc = sqrt(oc[0] * oc[0] + oc[1] * oc[1]);
|
|
1673
|
+
rc0 = min(rc, (r0 - lc) / (kc - 1));
|
|
1674
|
+
rc1 = min(rc, (r1 - lc) / (kc + 1));
|
|
1675
|
+
} else {
|
|
1676
|
+
rc0 = rc1 = 0;
|
|
1677
|
+
}
|
|
1678
|
+
}
|
|
1679
|
+
}
|
|
1680
|
+
if (!(da1 > epsilon))
|
|
1681
|
+
context.moveTo(x01, y01);
|
|
1682
|
+
else if (rc1 > epsilon) {
|
|
1683
|
+
t0 = cornerTangents(x00, y00, x01, y01, r1, rc1, cw);
|
|
1684
|
+
t1 = cornerTangents(x11, y11, x10, y10, r1, rc1, cw);
|
|
1685
|
+
context.moveTo(t0.cx + t0.x01, t0.cy + t0.y01);
|
|
1686
|
+
if (rc1 < rc)
|
|
1687
|
+
context.arc(t0.cx, t0.cy, rc1, atan2(t0.y01, t0.x01), atan2(t1.y01, t1.x01), !cw);
|
|
1688
|
+
else {
|
|
1689
|
+
context.arc(t0.cx, t0.cy, rc1, atan2(t0.y01, t0.x01), atan2(t0.y11, t0.x11), !cw);
|
|
1690
|
+
context.arc(0, 0, r1, atan2(t0.cy + t0.y11, t0.cx + t0.x11), atan2(t1.cy + t1.y11, t1.cx + t1.x11), !cw);
|
|
1691
|
+
context.arc(t1.cx, t1.cy, rc1, atan2(t1.y11, t1.x11), atan2(t1.y01, t1.x01), !cw);
|
|
1692
|
+
}
|
|
1693
|
+
} else
|
|
1694
|
+
context.moveTo(x01, y01), context.arc(0, 0, r1, a01, a11, !cw);
|
|
1695
|
+
if (!(r0 > epsilon) || !(da0 > epsilon))
|
|
1696
|
+
context.lineTo(x10, y10);
|
|
1697
|
+
else if (rc0 > epsilon) {
|
|
1698
|
+
t0 = cornerTangents(x10, y10, x11, y11, r0, -rc0, cw);
|
|
1699
|
+
t1 = cornerTangents(x01, y01, x00, y00, r0, -rc0, cw);
|
|
1700
|
+
context.lineTo(t0.cx + t0.x01, t0.cy + t0.y01);
|
|
1701
|
+
if (rc0 < rc)
|
|
1702
|
+
context.arc(t0.cx, t0.cy, rc0, atan2(t0.y01, t0.x01), atan2(t1.y01, t1.x01), !cw);
|
|
1703
|
+
else {
|
|
1704
|
+
context.arc(t0.cx, t0.cy, rc0, atan2(t0.y01, t0.x01), atan2(t0.y11, t0.x11), !cw);
|
|
1705
|
+
context.arc(0, 0, r0, atan2(t0.cy + t0.y11, t0.cx + t0.x11), atan2(t1.cy + t1.y11, t1.cx + t1.x11), cw);
|
|
1706
|
+
context.arc(t1.cx, t1.cy, rc0, atan2(t1.y11, t1.x11), atan2(t1.y01, t1.x01), !cw);
|
|
1707
|
+
}
|
|
1708
|
+
} else
|
|
1709
|
+
context.arc(0, 0, r0, a10, a00, cw);
|
|
1710
|
+
}
|
|
1711
|
+
context.closePath();
|
|
1712
|
+
if (buffer)
|
|
1713
|
+
return context = null, buffer + "" || null;
|
|
1714
|
+
}
|
|
1715
|
+
arc.centroid = function() {
|
|
1716
|
+
var r = (+innerRadius.apply(this, arguments) + +outerRadius.apply(this, arguments)) / 2, a = (+startAngle.apply(this, arguments) + +endAngle.apply(this, arguments)) / 2 - pi / 2;
|
|
1717
|
+
return [cos(a) * r, sin(a) * r];
|
|
1718
|
+
};
|
|
1719
|
+
arc.innerRadius = function(_) {
|
|
1720
|
+
return arguments.length ? (innerRadius = typeof _ === "function" ? _ : constant_default2(+_), arc) : innerRadius;
|
|
1721
|
+
};
|
|
1722
|
+
arc.outerRadius = function(_) {
|
|
1723
|
+
return arguments.length ? (outerRadius = typeof _ === "function" ? _ : constant_default2(+_), arc) : outerRadius;
|
|
1724
|
+
};
|
|
1725
|
+
arc.cornerRadius = function(_) {
|
|
1726
|
+
return arguments.length ? (cornerRadius = typeof _ === "function" ? _ : constant_default2(+_), arc) : cornerRadius;
|
|
1727
|
+
};
|
|
1728
|
+
arc.padRadius = function(_) {
|
|
1729
|
+
return arguments.length ? (padRadius = _ == null ? null : typeof _ === "function" ? _ : constant_default2(+_), arc) : padRadius;
|
|
1730
|
+
};
|
|
1731
|
+
arc.startAngle = function(_) {
|
|
1732
|
+
return arguments.length ? (startAngle = typeof _ === "function" ? _ : constant_default2(+_), arc) : startAngle;
|
|
1733
|
+
};
|
|
1734
|
+
arc.endAngle = function(_) {
|
|
1735
|
+
return arguments.length ? (endAngle = typeof _ === "function" ? _ : constant_default2(+_), arc) : endAngle;
|
|
1736
|
+
};
|
|
1737
|
+
arc.padAngle = function(_) {
|
|
1738
|
+
return arguments.length ? (padAngle = typeof _ === "function" ? _ : constant_default2(+_), arc) : padAngle;
|
|
1739
|
+
};
|
|
1740
|
+
arc.context = function(_) {
|
|
1741
|
+
return arguments.length ? (context = _ == null ? null : _, arc) : context;
|
|
1742
|
+
};
|
|
1743
|
+
return arc;
|
|
1744
|
+
}
|
|
1745
|
+
// ../../node_modules/.bun/d3-shape@3.2.0/node_modules/d3-shape/src/array.js
|
|
1746
|
+
var slice = Array.prototype.slice;
|
|
1747
|
+
function array_default(x) {
|
|
1748
|
+
return typeof x === "object" && "length" in x ? x : Array.from(x);
|
|
1749
|
+
}
|
|
1750
|
+
|
|
1751
|
+
// ../../node_modules/.bun/d3-shape@3.2.0/node_modules/d3-shape/src/curve/linear.js
|
|
1752
|
+
function Linear(context) {
|
|
1753
|
+
this._context = context;
|
|
1754
|
+
}
|
|
1755
|
+
Linear.prototype = {
|
|
1756
|
+
areaStart: function() {
|
|
1757
|
+
this._line = 0;
|
|
1758
|
+
},
|
|
1759
|
+
areaEnd: function() {
|
|
1760
|
+
this._line = NaN;
|
|
1761
|
+
},
|
|
1762
|
+
lineStart: function() {
|
|
1763
|
+
this._point = 0;
|
|
1764
|
+
},
|
|
1765
|
+
lineEnd: function() {
|
|
1766
|
+
if (this._line || this._line !== 0 && this._point === 1)
|
|
1767
|
+
this._context.closePath();
|
|
1768
|
+
this._line = 1 - this._line;
|
|
1769
|
+
},
|
|
1770
|
+
point: function(x, y) {
|
|
1771
|
+
x = +x, y = +y;
|
|
1772
|
+
switch (this._point) {
|
|
1773
|
+
case 0:
|
|
1774
|
+
this._point = 1;
|
|
1775
|
+
this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y);
|
|
1776
|
+
break;
|
|
1777
|
+
case 1:
|
|
1778
|
+
this._point = 2;
|
|
1779
|
+
default:
|
|
1780
|
+
this._context.lineTo(x, y);
|
|
1781
|
+
break;
|
|
1782
|
+
}
|
|
1783
|
+
}
|
|
1784
|
+
};
|
|
1785
|
+
function linear_default(context) {
|
|
1786
|
+
return new Linear(context);
|
|
1787
|
+
}
|
|
1788
|
+
|
|
1789
|
+
// ../../node_modules/.bun/d3-shape@3.2.0/node_modules/d3-shape/src/point.js
|
|
1790
|
+
function x(p) {
|
|
1791
|
+
return p[0];
|
|
1792
|
+
}
|
|
1793
|
+
function y(p) {
|
|
1794
|
+
return p[1];
|
|
1795
|
+
}
|
|
1796
|
+
|
|
1797
|
+
// ../../node_modules/.bun/d3-shape@3.2.0/node_modules/d3-shape/src/line.js
|
|
1798
|
+
function line_default(x2, y2) {
|
|
1799
|
+
var defined = constant_default2(true), context = null, curve = linear_default, output = null, path2 = withPath(line);
|
|
1800
|
+
x2 = typeof x2 === "function" ? x2 : x2 === undefined ? x : constant_default2(x2);
|
|
1801
|
+
y2 = typeof y2 === "function" ? y2 : y2 === undefined ? y : constant_default2(y2);
|
|
1802
|
+
function line(data) {
|
|
1803
|
+
var i, n = (data = array_default(data)).length, d, defined0 = false, buffer;
|
|
1804
|
+
if (context == null)
|
|
1805
|
+
output = curve(buffer = path2());
|
|
1806
|
+
for (i = 0;i <= n; ++i) {
|
|
1807
|
+
if (!(i < n && defined(d = data[i], i, data)) === defined0) {
|
|
1808
|
+
if (defined0 = !defined0)
|
|
1809
|
+
output.lineStart();
|
|
1810
|
+
else
|
|
1811
|
+
output.lineEnd();
|
|
1812
|
+
}
|
|
1813
|
+
if (defined0)
|
|
1814
|
+
output.point(+x2(d, i, data), +y2(d, i, data));
|
|
1815
|
+
}
|
|
1816
|
+
if (buffer)
|
|
1817
|
+
return output = null, buffer + "" || null;
|
|
1818
|
+
}
|
|
1819
|
+
line.x = function(_) {
|
|
1820
|
+
return arguments.length ? (x2 = typeof _ === "function" ? _ : constant_default2(+_), line) : x2;
|
|
1821
|
+
};
|
|
1822
|
+
line.y = function(_) {
|
|
1823
|
+
return arguments.length ? (y2 = typeof _ === "function" ? _ : constant_default2(+_), line) : y2;
|
|
1824
|
+
};
|
|
1825
|
+
line.defined = function(_) {
|
|
1826
|
+
return arguments.length ? (defined = typeof _ === "function" ? _ : constant_default2(!!_), line) : defined;
|
|
1827
|
+
};
|
|
1828
|
+
line.curve = function(_) {
|
|
1829
|
+
return arguments.length ? (curve = _, context != null && (output = curve(context)), line) : curve;
|
|
1830
|
+
};
|
|
1831
|
+
line.context = function(_) {
|
|
1832
|
+
return arguments.length ? (_ == null ? context = output = null : output = curve(context = _), line) : context;
|
|
1833
|
+
};
|
|
1834
|
+
return line;
|
|
1835
|
+
}
|
|
1836
|
+
|
|
1837
|
+
// ../../node_modules/.bun/d3-shape@3.2.0/node_modules/d3-shape/src/area.js
|
|
1838
|
+
function area_default(x0, y0, y1) {
|
|
1839
|
+
var x1 = null, defined = constant_default2(true), context = null, curve = linear_default, output = null, path2 = withPath(area);
|
|
1840
|
+
x0 = typeof x0 === "function" ? x0 : x0 === undefined ? x : constant_default2(+x0);
|
|
1841
|
+
y0 = typeof y0 === "function" ? y0 : y0 === undefined ? constant_default2(0) : constant_default2(+y0);
|
|
1842
|
+
y1 = typeof y1 === "function" ? y1 : y1 === undefined ? y : constant_default2(+y1);
|
|
1843
|
+
function area(data) {
|
|
1844
|
+
var i, j, k, n = (data = array_default(data)).length, d, defined0 = false, buffer, x0z = new Array(n), y0z = new Array(n);
|
|
1845
|
+
if (context == null)
|
|
1846
|
+
output = curve(buffer = path2());
|
|
1847
|
+
for (i = 0;i <= n; ++i) {
|
|
1848
|
+
if (!(i < n && defined(d = data[i], i, data)) === defined0) {
|
|
1849
|
+
if (defined0 = !defined0) {
|
|
1850
|
+
j = i;
|
|
1851
|
+
output.areaStart();
|
|
1852
|
+
output.lineStart();
|
|
1853
|
+
} else {
|
|
1854
|
+
output.lineEnd();
|
|
1855
|
+
output.lineStart();
|
|
1856
|
+
for (k = i - 1;k >= j; --k) {
|
|
1857
|
+
output.point(x0z[k], y0z[k]);
|
|
1858
|
+
}
|
|
1859
|
+
output.lineEnd();
|
|
1860
|
+
output.areaEnd();
|
|
1861
|
+
}
|
|
1862
|
+
}
|
|
1863
|
+
if (defined0) {
|
|
1864
|
+
x0z[i] = +x0(d, i, data), y0z[i] = +y0(d, i, data);
|
|
1865
|
+
output.point(x1 ? +x1(d, i, data) : x0z[i], y1 ? +y1(d, i, data) : y0z[i]);
|
|
1866
|
+
}
|
|
1867
|
+
}
|
|
1868
|
+
if (buffer)
|
|
1869
|
+
return output = null, buffer + "" || null;
|
|
1870
|
+
}
|
|
1871
|
+
function arealine() {
|
|
1872
|
+
return line_default().defined(defined).curve(curve).context(context);
|
|
1873
|
+
}
|
|
1874
|
+
area.x = function(_) {
|
|
1875
|
+
return arguments.length ? (x0 = typeof _ === "function" ? _ : constant_default2(+_), x1 = null, area) : x0;
|
|
1876
|
+
};
|
|
1877
|
+
area.x0 = function(_) {
|
|
1878
|
+
return arguments.length ? (x0 = typeof _ === "function" ? _ : constant_default2(+_), area) : x0;
|
|
1879
|
+
};
|
|
1880
|
+
area.x1 = function(_) {
|
|
1881
|
+
return arguments.length ? (x1 = _ == null ? null : typeof _ === "function" ? _ : constant_default2(+_), area) : x1;
|
|
1882
|
+
};
|
|
1883
|
+
area.y = function(_) {
|
|
1884
|
+
return arguments.length ? (y0 = typeof _ === "function" ? _ : constant_default2(+_), y1 = null, area) : y0;
|
|
1885
|
+
};
|
|
1886
|
+
area.y0 = function(_) {
|
|
1887
|
+
return arguments.length ? (y0 = typeof _ === "function" ? _ : constant_default2(+_), area) : y0;
|
|
1888
|
+
};
|
|
1889
|
+
area.y1 = function(_) {
|
|
1890
|
+
return arguments.length ? (y1 = _ == null ? null : typeof _ === "function" ? _ : constant_default2(+_), area) : y1;
|
|
1891
|
+
};
|
|
1892
|
+
area.lineX0 = area.lineY0 = function() {
|
|
1893
|
+
return arealine().x(x0).y(y0);
|
|
1894
|
+
};
|
|
1895
|
+
area.lineY1 = function() {
|
|
1896
|
+
return arealine().x(x0).y(y1);
|
|
1897
|
+
};
|
|
1898
|
+
area.lineX1 = function() {
|
|
1899
|
+
return arealine().x(x1).y(y0);
|
|
1900
|
+
};
|
|
1901
|
+
area.defined = function(_) {
|
|
1902
|
+
return arguments.length ? (defined = typeof _ === "function" ? _ : constant_default2(!!_), area) : defined;
|
|
1903
|
+
};
|
|
1904
|
+
area.curve = function(_) {
|
|
1905
|
+
return arguments.length ? (curve = _, context != null && (output = curve(context)), area) : curve;
|
|
1906
|
+
};
|
|
1907
|
+
area.context = function(_) {
|
|
1908
|
+
return arguments.length ? (_ == null ? context = output = null : output = curve(context = _), area) : context;
|
|
1909
|
+
};
|
|
1910
|
+
return area;
|
|
1911
|
+
}
|
|
1912
|
+
// ../../node_modules/.bun/d3-shape@3.2.0/node_modules/d3-shape/src/descending.js
|
|
1913
|
+
function descending_default(a, b) {
|
|
1914
|
+
return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN;
|
|
1915
|
+
}
|
|
1916
|
+
|
|
1917
|
+
// ../../node_modules/.bun/d3-shape@3.2.0/node_modules/d3-shape/src/identity.js
|
|
1918
|
+
function identity_default2(d) {
|
|
1919
|
+
return d;
|
|
1920
|
+
}
|
|
1921
|
+
|
|
1922
|
+
// ../../node_modules/.bun/d3-shape@3.2.0/node_modules/d3-shape/src/pie.js
|
|
1923
|
+
function pie_default() {
|
|
1924
|
+
var value = identity_default2, sortValues = descending_default, sort = null, startAngle = constant_default2(0), endAngle = constant_default2(tau), padAngle = constant_default2(0);
|
|
1925
|
+
function pie(data) {
|
|
1926
|
+
var i, n = (data = array_default(data)).length, j, k, sum = 0, index = new Array(n), arcs = new Array(n), a0 = +startAngle.apply(this, arguments), da = Math.min(tau, Math.max(-tau, endAngle.apply(this, arguments) - a0)), a1, p = Math.min(Math.abs(da) / n, padAngle.apply(this, arguments)), pa = p * (da < 0 ? -1 : 1), v;
|
|
1927
|
+
for (i = 0;i < n; ++i) {
|
|
1928
|
+
if ((v = arcs[index[i] = i] = +value(data[i], i, data)) > 0) {
|
|
1929
|
+
sum += v;
|
|
1930
|
+
}
|
|
1931
|
+
}
|
|
1932
|
+
if (sortValues != null)
|
|
1933
|
+
index.sort(function(i2, j2) {
|
|
1934
|
+
return sortValues(arcs[i2], arcs[j2]);
|
|
1935
|
+
});
|
|
1936
|
+
else if (sort != null)
|
|
1937
|
+
index.sort(function(i2, j2) {
|
|
1938
|
+
return sort(data[i2], data[j2]);
|
|
1939
|
+
});
|
|
1940
|
+
for (i = 0, k = sum ? (da - n * pa) / sum : 0;i < n; ++i, a0 = a1) {
|
|
1941
|
+
j = index[i], v = arcs[j], a1 = a0 + (v > 0 ? v * k : 0) + pa, arcs[j] = {
|
|
1942
|
+
data: data[j],
|
|
1943
|
+
index: i,
|
|
1944
|
+
value: v,
|
|
1945
|
+
startAngle: a0,
|
|
1946
|
+
endAngle: a1,
|
|
1947
|
+
padAngle: p
|
|
1948
|
+
};
|
|
1949
|
+
}
|
|
1950
|
+
return arcs;
|
|
1951
|
+
}
|
|
1952
|
+
pie.value = function(_) {
|
|
1953
|
+
return arguments.length ? (value = typeof _ === "function" ? _ : constant_default2(+_), pie) : value;
|
|
1954
|
+
};
|
|
1955
|
+
pie.sortValues = function(_) {
|
|
1956
|
+
return arguments.length ? (sortValues = _, sort = null, pie) : sortValues;
|
|
1957
|
+
};
|
|
1958
|
+
pie.sort = function(_) {
|
|
1959
|
+
return arguments.length ? (sort = _, sortValues = null, pie) : sort;
|
|
1960
|
+
};
|
|
1961
|
+
pie.startAngle = function(_) {
|
|
1962
|
+
return arguments.length ? (startAngle = typeof _ === "function" ? _ : constant_default2(+_), pie) : startAngle;
|
|
1963
|
+
};
|
|
1964
|
+
pie.endAngle = function(_) {
|
|
1965
|
+
return arguments.length ? (endAngle = typeof _ === "function" ? _ : constant_default2(+_), pie) : endAngle;
|
|
1966
|
+
};
|
|
1967
|
+
pie.padAngle = function(_) {
|
|
1968
|
+
return arguments.length ? (padAngle = typeof _ === "function" ? _ : constant_default2(+_), pie) : padAngle;
|
|
1969
|
+
};
|
|
1970
|
+
return pie;
|
|
1971
|
+
}
|
|
1972
|
+
// ../../node_modules/.bun/d3-shape@3.2.0/node_modules/d3-shape/src/curve/monotone.js
|
|
1973
|
+
function sign(x2) {
|
|
1974
|
+
return x2 < 0 ? -1 : 1;
|
|
1975
|
+
}
|
|
1976
|
+
function slope3(that, x2, y2) {
|
|
1977
|
+
var h0 = that._x1 - that._x0, h1 = x2 - that._x1, s0 = (that._y1 - that._y0) / (h0 || h1 < 0 && -0), s1 = (y2 - that._y1) / (h1 || h0 < 0 && -0), p = (s0 * h1 + s1 * h0) / (h0 + h1);
|
|
1978
|
+
return (sign(s0) + sign(s1)) * Math.min(Math.abs(s0), Math.abs(s1), 0.5 * Math.abs(p)) || 0;
|
|
1979
|
+
}
|
|
1980
|
+
function slope2(that, t) {
|
|
1981
|
+
var h = that._x1 - that._x0;
|
|
1982
|
+
return h ? (3 * (that._y1 - that._y0) / h - t) / 2 : t;
|
|
1983
|
+
}
|
|
1984
|
+
function point2(that, t0, t1) {
|
|
1985
|
+
var { _x0: x0, _y0: y0, _x1: x1, _y1: y1 } = that, dx = (x1 - x0) / 3;
|
|
1986
|
+
that._context.bezierCurveTo(x0 + dx, y0 + dx * t0, x1 - dx, y1 - dx * t1, x1, y1);
|
|
1987
|
+
}
|
|
1988
|
+
function MonotoneX(context) {
|
|
1989
|
+
this._context = context;
|
|
1990
|
+
}
|
|
1991
|
+
MonotoneX.prototype = {
|
|
1992
|
+
areaStart: function() {
|
|
1993
|
+
this._line = 0;
|
|
1994
|
+
},
|
|
1995
|
+
areaEnd: function() {
|
|
1996
|
+
this._line = NaN;
|
|
1997
|
+
},
|
|
1998
|
+
lineStart: function() {
|
|
1999
|
+
this._x0 = this._x1 = this._y0 = this._y1 = this._t0 = NaN;
|
|
2000
|
+
this._point = 0;
|
|
2001
|
+
},
|
|
2002
|
+
lineEnd: function() {
|
|
2003
|
+
switch (this._point) {
|
|
2004
|
+
case 2:
|
|
2005
|
+
this._context.lineTo(this._x1, this._y1);
|
|
2006
|
+
break;
|
|
2007
|
+
case 3:
|
|
2008
|
+
point2(this, this._t0, slope2(this, this._t0));
|
|
2009
|
+
break;
|
|
2010
|
+
}
|
|
2011
|
+
if (this._line || this._line !== 0 && this._point === 1)
|
|
2012
|
+
this._context.closePath();
|
|
2013
|
+
this._line = 1 - this._line;
|
|
2014
|
+
},
|
|
2015
|
+
point: function(x2, y2) {
|
|
2016
|
+
var t1 = NaN;
|
|
2017
|
+
x2 = +x2, y2 = +y2;
|
|
2018
|
+
if (x2 === this._x1 && y2 === this._y1)
|
|
2019
|
+
return;
|
|
2020
|
+
switch (this._point) {
|
|
2021
|
+
case 0:
|
|
2022
|
+
this._point = 1;
|
|
2023
|
+
this._line ? this._context.lineTo(x2, y2) : this._context.moveTo(x2, y2);
|
|
2024
|
+
break;
|
|
2025
|
+
case 1:
|
|
2026
|
+
this._point = 2;
|
|
2027
|
+
break;
|
|
2028
|
+
case 2:
|
|
2029
|
+
this._point = 3;
|
|
2030
|
+
point2(this, slope2(this, t1 = slope3(this, x2, y2)), t1);
|
|
2031
|
+
break;
|
|
2032
|
+
default:
|
|
2033
|
+
point2(this, this._t0, t1 = slope3(this, x2, y2));
|
|
2034
|
+
break;
|
|
2035
|
+
}
|
|
2036
|
+
this._x0 = this._x1, this._x1 = x2;
|
|
2037
|
+
this._y0 = this._y1, this._y1 = y2;
|
|
2038
|
+
this._t0 = t1;
|
|
2039
|
+
}
|
|
2040
|
+
};
|
|
2041
|
+
function MonotoneY(context) {
|
|
2042
|
+
this._context = new ReflectContext(context);
|
|
2043
|
+
}
|
|
2044
|
+
(MonotoneY.prototype = Object.create(MonotoneX.prototype)).point = function(x2, y2) {
|
|
2045
|
+
MonotoneX.prototype.point.call(this, y2, x2);
|
|
2046
|
+
};
|
|
2047
|
+
function ReflectContext(context) {
|
|
2048
|
+
this._context = context;
|
|
2049
|
+
}
|
|
2050
|
+
ReflectContext.prototype = {
|
|
2051
|
+
moveTo: function(x2, y2) {
|
|
2052
|
+
this._context.moveTo(y2, x2);
|
|
2053
|
+
},
|
|
2054
|
+
closePath: function() {
|
|
2055
|
+
this._context.closePath();
|
|
2056
|
+
},
|
|
2057
|
+
lineTo: function(x2, y2) {
|
|
2058
|
+
this._context.lineTo(y2, x2);
|
|
2059
|
+
},
|
|
2060
|
+
bezierCurveTo: function(x1, y1, x2, y2, x3, y3) {
|
|
2061
|
+
this._context.bezierCurveTo(y1, x1, y2, x2, y3, x3);
|
|
2062
|
+
}
|
|
2063
|
+
};
|
|
2064
|
+
function monotoneX(context) {
|
|
2065
|
+
return new MonotoneX(context);
|
|
2066
|
+
}
|
|
2067
|
+
// src/utils/arcs.ts
|
|
2068
|
+
function buildRadialBarArcs(data, dataKey, innerR, outerR, startDeg, endDeg) {
|
|
2069
|
+
if (data.length === 0)
|
|
2070
|
+
return [];
|
|
2071
|
+
const startRad = (startDeg - 90) * (Math.PI / 180);
|
|
2072
|
+
const endRad = (endDeg - 90) * (Math.PI / 180);
|
|
2073
|
+
const maxValue = max(data, (d) => {
|
|
2074
|
+
const v = d[dataKey];
|
|
2075
|
+
return typeof v === "number" ? v : 0;
|
|
2076
|
+
}) ?? 1;
|
|
2077
|
+
const angleScale = linear2().domain([0, maxValue]).range([startRad, endRad]);
|
|
2078
|
+
const ringCount = data.length;
|
|
2079
|
+
const ringThickness = (outerR - innerR) / ringCount;
|
|
2080
|
+
const ringPadding = Math.max(1, ringThickness * 0.1);
|
|
2081
|
+
const arcGenerator = arc_default().innerRadius((d) => d.innerR).outerRadius((d) => d.outerR).startAngle((d) => d.startAngle).endAngle((d) => d.endAngle).cornerRadius(4);
|
|
2082
|
+
return data.map((datum, i) => {
|
|
2083
|
+
const value = Number(datum[dataKey]) || 0;
|
|
2084
|
+
const rInner = innerR + i * ringThickness + ringPadding / 2;
|
|
2085
|
+
const rOuter = innerR + (i + 1) * ringThickness - ringPadding / 2;
|
|
2086
|
+
const itemFill = datum.fill;
|
|
2087
|
+
return {
|
|
2088
|
+
trackD: arcGenerator({
|
|
2089
|
+
innerR: rInner,
|
|
2090
|
+
outerR: rOuter,
|
|
2091
|
+
startAngle: startRad,
|
|
2092
|
+
endAngle: endRad
|
|
2093
|
+
}),
|
|
2094
|
+
arcD: arcGenerator({
|
|
2095
|
+
innerR: rInner,
|
|
2096
|
+
outerR: rOuter,
|
|
2097
|
+
startAngle: startRad,
|
|
2098
|
+
endAngle: angleScale(value)
|
|
2099
|
+
}),
|
|
2100
|
+
value,
|
|
2101
|
+
itemFill,
|
|
2102
|
+
index: i
|
|
2103
|
+
};
|
|
2104
|
+
});
|
|
2105
|
+
}
|
|
2106
|
+
function buildPieSlices(data, dataKey, nameKey, config, width, height, innerRadiusRatio, outerRadiusRatio, paddingAngleDeg) {
|
|
2107
|
+
if (data.length === 0)
|
|
2108
|
+
return [];
|
|
2109
|
+
const radius = Math.min(width, height) / 2;
|
|
2110
|
+
const pieData = data.map((d) => {
|
|
2111
|
+
const name = String(d[nameKey] ?? "");
|
|
2112
|
+
const value = Number(d[dataKey]) || 0;
|
|
2113
|
+
const configEntry = config[name];
|
|
2114
|
+
const fill = configEntry?.color ?? "currentColor";
|
|
2115
|
+
return { name, value, fill };
|
|
2116
|
+
});
|
|
2117
|
+
const pieLayout = pie_default().value((d) => d.value).padAngle(paddingAngleDeg * Math.PI / 180).sort(null);
|
|
2118
|
+
const arcGenerator = arc_default().innerRadius(radius * innerRadiusRatio).outerRadius(radius * outerRadiusRatio);
|
|
2119
|
+
return pieLayout(pieData).map((arcDatum) => ({
|
|
2120
|
+
d: arcGenerator(arcDatum) ?? "",
|
|
2121
|
+
fill: arcDatum.data.fill,
|
|
2122
|
+
name: arcDatum.data.name,
|
|
2123
|
+
value: arcDatum.data.value
|
|
2124
|
+
}));
|
|
2125
|
+
}
|
|
2126
|
+
// src/utils/lines.ts
|
|
2127
|
+
function buildLinePath(data, xKey, yKey, xs, ys, type) {
|
|
2128
|
+
const bandwidth = xs.bandwidth();
|
|
2129
|
+
const points = data.map((datum) => {
|
|
2130
|
+
const xValue = String(datum[xKey]);
|
|
2131
|
+
const yValue = Number(datum[yKey]) || 0;
|
|
2132
|
+
return [(xs(xValue) ?? 0) + bandwidth / 2, ys(yValue)];
|
|
2133
|
+
});
|
|
2134
|
+
const generator = line_default().x((d) => d[0]).y((d) => d[1]);
|
|
2135
|
+
generator.curve(type === "monotone" ? monotoneX : linear_default);
|
|
2136
|
+
return generator(points) ?? "";
|
|
2137
|
+
}
|
|
2138
|
+
function buildLinePoints(data, xKey, yKey, xs, ys) {
|
|
2139
|
+
const bandwidth = xs.bandwidth();
|
|
2140
|
+
return data.map((datum) => {
|
|
2141
|
+
const xValue = String(datum[xKey]);
|
|
2142
|
+
const yValue = Number(datum[yKey]) || 0;
|
|
2143
|
+
return {
|
|
2144
|
+
key: `${yKey}-${xValue}`,
|
|
2145
|
+
cx: (xs(xValue) ?? 0) + bandwidth / 2,
|
|
2146
|
+
cy: ys(yValue),
|
|
2147
|
+
xValue,
|
|
2148
|
+
yValue
|
|
2149
|
+
};
|
|
2150
|
+
});
|
|
2151
|
+
}
|
|
2152
|
+
// src/utils/areas.ts
|
|
2153
|
+
function buildAreaPaths(data, xKey, yKey, xs, ys, innerHeight) {
|
|
2154
|
+
const fillGen = area_default().x((d) => xs(String(d[xKey])) ?? 0).y0(innerHeight).y1((d) => ys(Number(d[yKey]) || 0)).curve(linear_default);
|
|
2155
|
+
const lineGen = area_default().x((d) => xs(String(d[xKey])) ?? 0).y0((d) => ys(Number(d[yKey]) || 0)).y1((d) => ys(Number(d[yKey]) || 0)).curve(linear_default);
|
|
2156
|
+
return {
|
|
2157
|
+
area: fillGen(data) ?? "",
|
|
2158
|
+
line: lineGen(data) ?? ""
|
|
2159
|
+
};
|
|
2160
|
+
}
|
|
2161
|
+
function buildAreaDots(data, xKey, yKey, xs, ys) {
|
|
2162
|
+
return data.map((datum) => {
|
|
2163
|
+
const xValue = String(datum[xKey]);
|
|
2164
|
+
const yValue = Number(datum[yKey]) || 0;
|
|
2165
|
+
return {
|
|
2166
|
+
key: `${yKey}-${xValue}`,
|
|
2167
|
+
cx: xs(xValue) ?? 0,
|
|
2168
|
+
cy: ys(yValue),
|
|
2169
|
+
xValue,
|
|
2170
|
+
yValue
|
|
2171
|
+
};
|
|
2172
|
+
});
|
|
2173
|
+
}
|
|
2174
|
+
// src/utils/radar.ts
|
|
2175
|
+
function buildRadarVertices(data, dataKey, axisKey, radialScale) {
|
|
2176
|
+
const n = data.length;
|
|
2177
|
+
if (n === 0)
|
|
2178
|
+
return [];
|
|
2179
|
+
const angleStep = 2 * Math.PI / n;
|
|
2180
|
+
return data.map((datum, i) => {
|
|
2181
|
+
const value = Number(datum[dataKey]) || 0;
|
|
2182
|
+
const label = String(datum[axisKey]);
|
|
2183
|
+
const angle = angleStep * i - Math.PI / 2;
|
|
2184
|
+
const r = radialScale(value);
|
|
2185
|
+
return {
|
|
2186
|
+
key: `${i}-${label}`,
|
|
2187
|
+
angle,
|
|
2188
|
+
r,
|
|
2189
|
+
x: r * Math.cos(angle),
|
|
2190
|
+
y: r * Math.sin(angle),
|
|
2191
|
+
label,
|
|
2192
|
+
value
|
|
2193
|
+
};
|
|
2194
|
+
});
|
|
2195
|
+
}
|
|
2196
|
+
function buildRadarPolygonPoints(vertices) {
|
|
2197
|
+
return vertices.map((v) => `${v.x},${v.y}`).join(" ");
|
|
2198
|
+
}
|
|
2199
|
+
// src/utils/classes.ts
|
|
2200
|
+
var CHART_CLASS_GRID = "chart-grid";
|
|
2201
|
+
var CHART_CLASS_X_AXIS = "chart-x-axis";
|
|
2202
|
+
var CHART_CLASS_Y_AXIS = "chart-y-axis";
|
|
2203
|
+
var CHART_CLASS_POLAR_GRID = "chart-polar-grid";
|
|
2204
|
+
var CHART_CLASS_POLAR_ANGLE_AXIS = "chart-polar-angle-axis";
|
|
2205
|
+
var CHART_CLASS_RADIAL_BAR = "chart-radial-bar";
|
|
2206
|
+
var CHART_CLASS_RADIAL_LABEL = "chart-radial-label";
|
|
2207
|
+
var CHART_CLASS_BAR = "chart-bar";
|
|
2208
|
+
var CHART_CLASS_LINE = "chart-line";
|
|
2209
|
+
var CHART_CLASS_AREA = "chart-area";
|
|
2210
|
+
var CHART_CLASS_AREA_DOT = "chart-area-dot";
|
|
2211
|
+
var CHART_CLASS_RADAR = "chart-radar";
|
|
2212
|
+
var CHART_CLASS_PIE = "chart-pie";
|
|
2213
|
+
var CHART_CLASS_TOOLTIP = "chart-tooltip";
|
|
2214
|
+
// src/chart-container.ts
|
|
2215
|
+
function applyChartCSSVariables(container, config) {
|
|
2216
|
+
for (const [key, value] of Object.entries(config)) {
|
|
2217
|
+
container.style.setProperty(`--color-${key}`, value.color);
|
|
2218
|
+
}
|
|
2219
|
+
}
|
|
2220
|
+
export {
|
|
2221
|
+
createRadarRadialScale,
|
|
2222
|
+
createPointScale,
|
|
2223
|
+
createLinearScale,
|
|
2224
|
+
createBandScale,
|
|
2225
|
+
buildRadialBarArcs,
|
|
2226
|
+
buildRadarVertices,
|
|
2227
|
+
buildRadarPolygonPoints,
|
|
2228
|
+
buildPieSlices,
|
|
2229
|
+
buildLinePoints,
|
|
2230
|
+
buildLinePath,
|
|
2231
|
+
buildAreaPaths,
|
|
2232
|
+
buildAreaDots,
|
|
2233
|
+
applyChartCSSVariables,
|
|
2234
|
+
RadialChartContext,
|
|
2235
|
+
RadarChartContext,
|
|
2236
|
+
PieChartContext,
|
|
2237
|
+
ChartConfigContext,
|
|
2238
|
+
CHART_CLASS_Y_AXIS,
|
|
2239
|
+
CHART_CLASS_X_AXIS,
|
|
2240
|
+
CHART_CLASS_TOOLTIP,
|
|
2241
|
+
CHART_CLASS_RADIAL_LABEL,
|
|
2242
|
+
CHART_CLASS_RADIAL_BAR,
|
|
2243
|
+
CHART_CLASS_RADAR,
|
|
2244
|
+
CHART_CLASS_POLAR_GRID,
|
|
2245
|
+
CHART_CLASS_POLAR_ANGLE_AXIS,
|
|
2246
|
+
CHART_CLASS_PIE,
|
|
2247
|
+
CHART_CLASS_LINE,
|
|
2248
|
+
CHART_CLASS_GRID,
|
|
2249
|
+
CHART_CLASS_BAR,
|
|
2250
|
+
CHART_CLASS_AREA_DOT,
|
|
2251
|
+
CHART_CLASS_AREA,
|
|
2252
|
+
BarChartContext,
|
|
2253
|
+
AreaChartContext
|
|
2254
|
+
};
|