UNPKG

musicvis-lib

Version:

Music analysis and visualization library

1,360 lines (1,356 loc) 1 MB
var __create = Object.create; var __defProp = Object.defineProperty; var __defProps = Object.defineProperties; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropDescs = Object.getOwnPropertyDescriptors; var __getOwnPropNames = Object.getOwnPropertyNames; var __getOwnPropSymbols = Object.getOwnPropertySymbols; var __getProtoOf = Object.getPrototypeOf; var __hasOwnProp = Object.prototype.hasOwnProperty; var __propIsEnum = Object.prototype.propertyIsEnumerable; var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; var __spreadValues = (a, b) => { for (var prop in b || (b = {})) if (__hasOwnProp.call(b, prop)) __defNormalProp(a, prop, b[prop]); if (__getOwnPropSymbols) for (var prop of __getOwnPropSymbols(b)) { if (__propIsEnum.call(b, prop)) __defNormalProp(a, prop, b[prop]); } return a; }; var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b)); var __commonJS = (cb, mod) => function __require() { return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; }; var __export = (target, all) => { for (var name2 in all) __defProp(target, name2, { get: all[name2], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod)); var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); // node_modules/.pnpm/d3-array@2.12.1/node_modules/d3-array/dist/d3-array.js var require_d3_array = __commonJS({ "node_modules/.pnpm/d3-array@2.12.1/node_modules/d3-array/dist/d3-array.js"(exports2, module3) { (function(global2, factory) { typeof exports2 === "object" && typeof module3 !== "undefined" ? factory(exports2) : typeof define === "function" && define.amd ? define(["exports"], factory) : (global2 = typeof globalThis !== "undefined" ? globalThis : global2 || self, factory(global2.d3 = global2.d3 || {})); })(exports2, function(exports3) { "use strict"; function ascending(a, b) { return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN; } function bisector(f) { let delta = f; let compare = f; if (f.length === 1) { delta = (d, x) => f(d) - x; compare = ascendingComparator(f); } function left(a, x, lo, hi) { if (lo == null) lo = 0; if (hi == null) hi = a.length; while (lo < hi) { const mid = lo + hi >>> 1; if (compare(a[mid], x) < 0) lo = mid + 1; else hi = mid; } return lo; } function right(a, x, lo, hi) { if (lo == null) lo = 0; if (hi == null) hi = a.length; while (lo < hi) { const mid = lo + hi >>> 1; if (compare(a[mid], x) > 0) hi = mid; else lo = mid + 1; } return lo; } function center(a, x, lo, hi) { if (lo == null) lo = 0; if (hi == null) hi = a.length; const i = left(a, x, lo, hi - 1); return i > lo && delta(a[i - 1], x) > -delta(a[i], x) ? i - 1 : i; } return { left, center, right }; } function ascendingComparator(f) { return (d, x) => ascending(f(d), x); } function number(x) { return x === null ? NaN : +x; } function* numbers(values, valueof) { if (valueof === void 0) { for (let value of values) { if (value != null && (value = +value) >= value) { yield value; } } } else { let index2 = -1; for (let value of values) { if ((value = valueof(value, ++index2, values)) != null && (value = +value) >= value) { yield value; } } } } const ascendingBisect = bisector(ascending); const bisectRight = ascendingBisect.right; const bisectLeft = ascendingBisect.left; const bisectCenter = bisector(number).center; function count2(values, valueof) { let count3 = 0; if (valueof === void 0) { for (let value of values) { if (value != null && (value = +value) >= value) { ++count3; } } } else { let index2 = -1; for (let value of values) { if ((value = valueof(value, ++index2, values)) != null && (value = +value) >= value) { ++count3; } } } return count3; } function length$1(array2) { return array2.length | 0; } function empty(length2) { return !(length2 > 0); } function arrayify(values) { return typeof values !== "object" || "length" in values ? values : Array.from(values); } function reducer(reduce2) { return (values) => reduce2(...values); } function cross(...values) { const reduce2 = typeof values[values.length - 1] === "function" && reducer(values.pop()); values = values.map(arrayify); const lengths = values.map(length$1); const j = values.length - 1; const index2 = new Array(j + 1).fill(0); const product = []; if (j < 0 || lengths.some(empty)) return product; while (true) { product.push(index2.map((j2, i2) => values[i2][j2])); let i = j; while (++index2[i] === lengths[i]) { if (i === 0) return reduce2 ? product.map(reduce2) : product; index2[i--] = 0; } } } function cumsum(values, valueof) { var sum2 = 0, index2 = 0; return Float64Array.from(values, valueof === void 0 ? (v) => sum2 += +v || 0 : (v) => sum2 += +valueof(v, index2++, values) || 0); } function descending(a, b) { return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN; } function variance(values, valueof) { let count3 = 0; let delta; let mean3 = 0; let sum2 = 0; if (valueof === void 0) { for (let value of values) { if (value != null && (value = +value) >= value) { delta = value - mean3; mean3 += delta / ++count3; sum2 += delta * (value - mean3); } } } else { let index2 = -1; for (let value of values) { if ((value = valueof(value, ++index2, values)) != null && (value = +value) >= value) { delta = value - mean3; mean3 += delta / ++count3; sum2 += delta * (value - mean3); } } } if (count3 > 1) return sum2 / (count3 - 1); } function deviation2(values, valueof) { const v = variance(values, valueof); return v ? Math.sqrt(v) : v; } function extent6(values, valueof) { let min4; let max9; if (valueof === void 0) { for (const value of values) { if (value != null) { if (min4 === void 0) { if (value >= value) min4 = max9 = value; } else { if (min4 > value) min4 = value; if (max9 < value) max9 = value; } } } } else { let index2 = -1; for (let value of values) { if ((value = valueof(value, ++index2, values)) != null) { if (min4 === void 0) { if (value >= value) min4 = max9 = value; } else { if (min4 > value) min4 = value; if (max9 < value) max9 = value; } } } } return [min4, max9]; } class Adder { constructor() { this._partials = new Float64Array(32); this._n = 0; } add(x) { const p = this._partials; let i = 0; for (let j = 0; j < this._n && j < 32; j++) { const y = p[j], hi = x + y, lo = Math.abs(x) < Math.abs(y) ? x - (hi - y) : y - (hi - x); if (lo) p[i++] = lo; x = hi; } p[i] = x; this._n = i + 1; return this; } valueOf() { const p = this._partials; let n = this._n, x, y, lo, hi = 0; if (n > 0) { hi = p[--n]; while (n > 0) { x = hi; y = p[--n]; hi = x + y; lo = y - (hi - x); if (lo) break; } if (n > 0 && (lo < 0 && p[n - 1] < 0 || lo > 0 && p[n - 1] > 0)) { y = lo * 2; x = hi + y; if (y == x - hi) hi = x; } } return hi; } } function fsum(values, valueof) { const adder = new Adder(); if (valueof === void 0) { for (let value of values) { if (value = +value) { adder.add(value); } } } else { let index2 = -1; for (let value of values) { if (value = +valueof(value, ++index2, values)) { adder.add(value); } } } return +adder; } function fcumsum(values, valueof) { const adder = new Adder(); let index2 = -1; return Float64Array.from(values, valueof === void 0 ? (v) => adder.add(+v || 0) : (v) => adder.add(+valueof(v, ++index2, values) || 0)); } class InternMap extends Map { constructor(entries, key = keyof) { super(); Object.defineProperties(this, { _intern: { value: /* @__PURE__ */ new Map() }, _key: { value: key } }); if (entries != null) for (const [key2, value] of entries) this.set(key2, value); } get(key) { return super.get(intern_get(this, key)); } has(key) { return super.has(intern_get(this, key)); } set(key, value) { return super.set(intern_set(this, key), value); } delete(key) { return super.delete(intern_delete(this, key)); } } class InternSet extends Set { constructor(values, key = keyof) { super(); Object.defineProperties(this, { _intern: { value: /* @__PURE__ */ new Map() }, _key: { value: key } }); if (values != null) for (const value of values) this.add(value); } has(value) { return super.has(intern_get(this, value)); } add(value) { return super.add(intern_set(this, value)); } delete(value) { return super.delete(intern_delete(this, value)); } } function intern_get({ _intern, _key }, value) { const key = _key(value); return _intern.has(key) ? _intern.get(key) : value; } function intern_set({ _intern, _key }, value) { const key = _key(value); if (_intern.has(key)) return _intern.get(key); _intern.set(key, value); return value; } function intern_delete({ _intern, _key }, value) { const key = _key(value); if (_intern.has(key)) { value = _intern.get(value); _intern.delete(key); } return value; } function keyof(value) { return value !== null && typeof value === "object" ? value.valueOf() : value; } function identity(x) { return x; } function group8(values, ...keys) { return nest(values, identity, identity, keys); } function groups(values, ...keys) { return nest(values, Array.from, identity, keys); } function rollup(values, reduce2, ...keys) { return nest(values, identity, reduce2, keys); } function rollups(values, reduce2, ...keys) { return nest(values, Array.from, reduce2, keys); } function index(values, ...keys) { return nest(values, identity, unique, keys); } function indexes(values, ...keys) { return nest(values, Array.from, unique, keys); } function unique(values) { if (values.length !== 1) throw new Error("duplicate key"); return values[0]; } function nest(values, map2, reduce2, keys) { return function regroup(values2, i) { if (i >= keys.length) return reduce2(values2); const groups2 = new InternMap(); const keyof2 = keys[i++]; let index2 = -1; for (const value of values2) { const key = keyof2(value, ++index2, values2); const group9 = groups2.get(key); if (group9) group9.push(value); else groups2.set(key, [value]); } for (const [key, values3] of groups2) { groups2.set(key, regroup(values3, i)); } return map2(groups2); }(values, 0); } function permute(source, keys) { return Array.from(keys, (key) => source[key]); } function sort(values, ...F) { if (typeof values[Symbol.iterator] !== "function") throw new TypeError("values is not iterable"); values = Array.from(values); let [f = ascending] = F; if (f.length === 1 || F.length > 1) { const index2 = Uint32Array.from(values, (d, i) => i); if (F.length > 1) { F = F.map((f2) => values.map(f2)); index2.sort((i, j) => { for (const f2 of F) { const c = ascending(f2[i], f2[j]); if (c) return c; } }); } else { f = values.map(f); index2.sort((i, j) => ascending(f[i], f[j])); } return permute(values, index2); } return values.sort(f); } function groupSort(values, reduce2, key) { return (reduce2.length === 1 ? sort(rollup(values, reduce2, key), ([ak, av], [bk, bv]) => ascending(av, bv) || ascending(ak, bk)) : sort(group8(values, key), ([ak, av], [bk, bv]) => reduce2(av, bv) || ascending(ak, bk))).map(([key2]) => key2); } var array = Array.prototype; var slice = array.slice; function constant(x) { return function() { return x; }; } var e10 = Math.sqrt(50), e5 = Math.sqrt(10), e2 = Math.sqrt(2); function ticks(start, stop, count3) { var reverse2, i = -1, n, ticks2, step; stop = +stop, start = +start, count3 = +count3; if (start === stop && count3 > 0) return [start]; if (reverse2 = stop < start) n = start, start = stop, stop = n; if ((step = tickIncrement(start, stop, count3)) === 0 || !isFinite(step)) return []; if (step > 0) { let r0 = Math.round(start / step), r1 = Math.round(stop / step); if (r0 * step < start) ++r0; if (r1 * step > stop) --r1; ticks2 = new Array(n = r1 - r0 + 1); while (++i < n) ticks2[i] = (r0 + i) * step; } else { step = -step; let r0 = Math.round(start * step), r1 = Math.round(stop * step); if (r0 / step < start) ++r0; if (r1 / step > stop) --r1; ticks2 = new Array(n = r1 - r0 + 1); while (++i < n) ticks2[i] = (r0 + i) / step; } if (reverse2) ticks2.reverse(); return ticks2; } function tickIncrement(start, stop, count3) { var step = (stop - start) / Math.max(0, count3), power = Math.floor(Math.log(step) / Math.LN10), error = step / Math.pow(10, power); return power >= 0 ? (error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1) * Math.pow(10, power) : -Math.pow(10, -power) / (error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1); } function tickStep(start, stop, count3) { var step0 = Math.abs(stop - start) / Math.max(0, count3), step1 = Math.pow(10, Math.floor(Math.log(step0) / Math.LN10)), error = step0 / step1; if (error >= e10) step1 *= 10; else if (error >= e5) step1 *= 5; else if (error >= e2) step1 *= 2; return stop < start ? -step1 : step1; } function nice(start, stop, count3) { let prestep; while (true) { const step = tickIncrement(start, stop, count3); if (step === prestep || step === 0 || !isFinite(step)) { return [start, stop]; } else if (step > 0) { start = Math.floor(start / step) * step; stop = Math.ceil(stop / step) * step; } else if (step < 0) { start = Math.ceil(start * step) / step; stop = Math.floor(stop * step) / step; } prestep = step; } } function sturges(values) { return Math.ceil(Math.log(count2(values)) / Math.LN2) + 1; } function bin() { var value = identity, domain = extent6, threshold = sturges; function histogram(data) { if (!Array.isArray(data)) data = Array.from(data); var i, n = data.length, x, values = new Array(n); for (i = 0; i < n; ++i) { values[i] = value(data[i], i, data); } var xz = domain(values), x0 = xz[0], x1 = xz[1], tz = threshold(values, x0, x1); if (!Array.isArray(tz)) { const max9 = x1, tn = +tz; if (domain === extent6) [x0, x1] = nice(x0, x1, tn); tz = ticks(x0, x1, tn); if (tz[tz.length - 1] >= x1) { if (max9 >= x1 && domain === extent6) { const step = tickIncrement(x0, x1, tn); if (isFinite(step)) { if (step > 0) { x1 = (Math.floor(x1 / step) + 1) * step; } else if (step < 0) { x1 = (Math.ceil(x1 * -step) + 1) / -step; } } } else { tz.pop(); } } } var m = tz.length; while (tz[0] <= x0) tz.shift(), --m; while (tz[m - 1] > x1) tz.pop(), --m; var bins = new Array(m + 1), bin2; for (i = 0; i <= m; ++i) { bin2 = bins[i] = []; bin2.x0 = i > 0 ? tz[i - 1] : x0; bin2.x1 = i < m ? tz[i] : x1; } for (i = 0; i < n; ++i) { x = values[i]; if (x0 <= x && x <= x1) { bins[bisectRight(tz, x, 0, m)].push(data[i]); } } return bins; } histogram.value = function(_) { return arguments.length ? (value = typeof _ === "function" ? _ : constant(_), histogram) : value; }; histogram.domain = function(_) { return arguments.length ? (domain = typeof _ === "function" ? _ : constant([_[0], _[1]]), histogram) : domain; }; histogram.thresholds = function(_) { return arguments.length ? (threshold = typeof _ === "function" ? _ : Array.isArray(_) ? constant(slice.call(_)) : constant(_), histogram) : threshold; }; return histogram; } function max8(values, valueof) { let max9; if (valueof === void 0) { for (const value of values) { if (value != null && (max9 < value || max9 === void 0 && value >= value)) { max9 = value; } } } else { let index2 = -1; for (let value of values) { if ((value = valueof(value, ++index2, values)) != null && (max9 < value || max9 === void 0 && value >= value)) { max9 = value; } } } return max9; } function min3(values, valueof) { let min4; if (valueof === void 0) { for (const value of values) { if (value != null && (min4 > value || min4 === void 0 && value >= value)) { min4 = value; } } } else { let index2 = -1; for (let value of values) { if ((value = valueof(value, ++index2, values)) != null && (min4 > value || min4 === void 0 && value >= value)) { min4 = value; } } } return min4; } function quickselect(array2, k, left = 0, right = array2.length - 1, compare = ascending) { while (right > left) { if (right - left > 600) { const n = right - left + 1; const m = k - left + 1; const z = Math.log(n); const s = 0.5 * Math.exp(2 * z / 3); const sd = 0.5 * Math.sqrt(z * s * (n - s) / n) * (m - n / 2 < 0 ? -1 : 1); const newLeft = Math.max(left, Math.floor(k - m * s / n + sd)); const newRight = Math.min(right, Math.floor(k + (n - m) * s / n + sd)); quickselect(array2, k, newLeft, newRight, compare); } const t = array2[k]; let i = left; let j = right; swap(array2, left, k); if (compare(array2[right], t) > 0) swap(array2, left, right); while (i < j) { swap(array2, i, j), ++i, --j; while (compare(array2[i], t) < 0) ++i; while (compare(array2[j], t) > 0) --j; } if (compare(array2[left], t) === 0) swap(array2, left, j); else ++j, swap(array2, j, right); if (j <= k) left = j + 1; if (k <= j) right = j - 1; } return array2; } function swap(array2, i, j) { const t = array2[i]; array2[i] = array2[j]; array2[j] = t; } function quantile2(values, p, valueof) { values = Float64Array.from(numbers(values, valueof)); if (!(n = values.length)) return; if ((p = +p) <= 0 || n < 2) return min3(values); if (p >= 1) return max8(values); var n, i = (n - 1) * p, i0 = Math.floor(i), value0 = max8(quickselect(values, i0).subarray(0, i0 + 1)), value1 = min3(values.subarray(i0 + 1)); return value0 + (value1 - value0) * (i - i0); } function quantileSorted(values, p, valueof = number) { if (!(n = values.length)) return; if ((p = +p) <= 0 || n < 2) return +valueof(values[0], 0, values); if (p >= 1) return +valueof(values[n - 1], n - 1, values); var n, i = (n - 1) * p, i0 = Math.floor(i), value0 = +valueof(values[i0], i0, values), value1 = +valueof(values[i0 + 1], i0 + 1, values); return value0 + (value1 - value0) * (i - i0); } function freedmanDiaconis(values, min4, max9) { return Math.ceil((max9 - min4) / (2 * (quantile2(values, 0.75) - quantile2(values, 0.25)) * Math.pow(count2(values), -1 / 3))); } function scott(values, min4, max9) { return Math.ceil((max9 - min4) / (3.5 * deviation2(values) * Math.pow(count2(values), -1 / 3))); } function maxIndex(values, valueof) { let max9; let maxIndex2 = -1; let index2 = -1; if (valueof === void 0) { for (const value of values) { ++index2; if (value != null && (max9 < value || max9 === void 0 && value >= value)) { max9 = value, maxIndex2 = index2; } } } else { for (let value of values) { if ((value = valueof(value, ++index2, values)) != null && (max9 < value || max9 === void 0 && value >= value)) { max9 = value, maxIndex2 = index2; } } } return maxIndex2; } function mean2(values, valueof) { let count3 = 0; let sum2 = 0; if (valueof === void 0) { for (let value of values) { if (value != null && (value = +value) >= value) { ++count3, sum2 += value; } } } else { let index2 = -1; for (let value of values) { if ((value = valueof(value, ++index2, values)) != null && (value = +value) >= value) { ++count3, sum2 += value; } } } if (count3) return sum2 / count3; } function median2(values, valueof) { return quantile2(values, 0.5, valueof); } function* flatten(arrays) { for (const array2 of arrays) { yield* array2; } } function merge(arrays) { return Array.from(flatten(arrays)); } function minIndex2(values, valueof) { let min4; let minIndex3 = -1; let index2 = -1; if (valueof === void 0) { for (const value of values) { ++index2; if (value != null && (min4 > value || min4 === void 0 && value >= value)) { min4 = value, minIndex3 = index2; } } } else { for (let value of values) { if ((value = valueof(value, ++index2, values)) != null && (min4 > value || min4 === void 0 && value >= value)) { min4 = value, minIndex3 = index2; } } } return minIndex3; } function pairs(values, pairof = pair) { const pairs2 = []; let previous; let first = false; for (const value of values) { if (first) pairs2.push(pairof(previous, value)); previous = value; first = true; } return pairs2; } function pair(a, b) { return [a, b]; } function range(start, stop, step) { start = +start, stop = +stop, step = (n = arguments.length) < 2 ? (stop = start, start = 0, 1) : n < 3 ? 1 : +step; var i = -1, n = Math.max(0, Math.ceil((stop - start) / step)) | 0, range2 = new Array(n); while (++i < n) { range2[i] = start + i * step; } return range2; } function least(values, compare = ascending) { let min4; let defined = false; if (compare.length === 1) { let minValue; for (const element of values) { const value = compare(element); if (defined ? ascending(value, minValue) < 0 : ascending(value, value) === 0) { min4 = element; minValue = value; defined = true; } } } else { for (const value of values) { if (defined ? compare(value, min4) < 0 : compare(value, value) === 0) { min4 = value; defined = true; } } } return min4; } function leastIndex(values, compare = ascending) { if (compare.length === 1) return minIndex2(values, compare); let minValue; let min4 = -1; let index2 = -1; for (const value of values) { ++index2; if (min4 < 0 ? compare(value, value) === 0 : compare(value, minValue) < 0) { minValue = value; min4 = index2; } } return min4; } function greatest(values, compare = ascending) { let max9; let defined = false; if (compare.length === 1) { let maxValue; for (const element of values) { const value = compare(element); if (defined ? ascending(value, maxValue) > 0 : ascending(value, value) === 0) { max9 = element; maxValue = value; defined = true; } } } else { for (const value of values) { if (defined ? compare(value, max9) > 0 : compare(value, value) === 0) { max9 = value; defined = true; } } } return max9; } function greatestIndex(values, compare = ascending) { if (compare.length === 1) return maxIndex(values, compare); let maxValue; let max9 = -1; let index2 = -1; for (const value of values) { ++index2; if (max9 < 0 ? compare(value, value) === 0 : compare(value, maxValue) > 0) { maxValue = value; max9 = index2; } } return max9; } function scan(values, compare) { const index2 = leastIndex(values, compare); return index2 < 0 ? void 0 : index2; } var shuffle = shuffler(Math.random); function shuffler(random) { return function shuffle2(array2, i0 = 0, i1 = array2.length) { let m = i1 - (i0 = +i0); while (m) { const i = random() * m-- | 0, t = array2[m + i0]; array2[m + i0] = array2[i + i0]; array2[i + i0] = t; } return array2; }; } function sum(values, valueof) { let sum2 = 0; if (valueof === void 0) { for (let value of values) { if (value = +value) { sum2 += value; } } } else { let index2 = -1; for (let value of values) { if (value = +valueof(value, ++index2, values)) { sum2 += value; } } } return sum2; } function transpose(matrix) { if (!(n = matrix.length)) return []; for (var i = -1, m = min3(matrix, length), transpose2 = new Array(m); ++i < m; ) { for (var j = -1, n, row = transpose2[i] = new Array(n); ++j < n; ) { row[j] = matrix[j][i]; } } return transpose2; } function length(d) { return d.length; } function zip() { return transpose(arguments); } function every(values, test) { if (typeof test !== "function") throw new TypeError("test is not a function"); let index2 = -1; for (const value of values) { if (!test(value, ++index2, values)) { return false; } } return true; } function some(values, test) { if (typeof test !== "function") throw new TypeError("test is not a function"); let index2 = -1; for (const value of values) { if (test(value, ++index2, values)) { return true; } } return false; } function filter(values, test) { if (typeof test !== "function") throw new TypeError("test is not a function"); const array2 = []; let index2 = -1; for (const value of values) { if (test(value, ++index2, values)) { array2.push(value); } } return array2; } function map(values, mapper) { if (typeof values[Symbol.iterator] !== "function") throw new TypeError("values is not iterable"); if (typeof mapper !== "function") throw new TypeError("mapper is not a function"); return Array.from(values, (value, index2) => mapper(value, index2, values)); } function reduce(values, reducer2, value) { if (typeof reducer2 !== "function") throw new TypeError("reducer is not a function"); const iterator = values[Symbol.iterator](); let done, next, index2 = -1; if (arguments.length < 3) { ({ done, value } = iterator.next()); if (done) return; ++index2; } while ({ done, value: next } = iterator.next(), !done) { value = reducer2(value, next, ++index2, values); } return value; } function reverse(values) { if (typeof values[Symbol.iterator] !== "function") throw new TypeError("values is not iterable"); return Array.from(values).reverse(); } function difference2(values, ...others) { values = new Set(values); for (const other of others) { for (const value of other) { values.delete(value); } } return values; } function disjoint(values, other) { const iterator = other[Symbol.iterator](), set2 = /* @__PURE__ */ new Set(); for (const v of values) { if (set2.has(v)) return false; let value, done; while ({ value, done } = iterator.next()) { if (done) break; if (Object.is(v, value)) return false; set2.add(value); } } return true; } function set(values) { return values instanceof Set ? values : new Set(values); } function intersection3(values, ...others) { values = new Set(values); others = others.map(set); out: for (const value of values) { for (const other of others) { if (!other.has(value)) { values.delete(value); continue out; } } } return values; } function superset(values, other) { const iterator = values[Symbol.iterator](), set2 = /* @__PURE__ */ new Set(); for (const o of other) { if (set2.has(o)) continue; let value, done; while ({ value, done } = iterator.next()) { if (done) return false; set2.add(value); if (Object.is(o, value)) break; } } return true; } function subset(values, other) { return superset(other, values); } function union2(...others) { const set2 = /* @__PURE__ */ new Set(); for (const other of others) { for (const o of other) { set2.add(o); } } return set2; } exports3.Adder = Adder; exports3.InternMap = InternMap; exports3.InternSet = InternSet; exports3.ascending = ascending; exports3.bin = bin; exports3.bisect = bisectRight; exports3.bisectCenter = bisectCenter; exports3.bisectLeft = bisectLeft; exports3.bisectRight = bisectRight; exports3.bisector = bisector; exports3.count = count2; exports3.cross = cross; exports3.cumsum = cumsum; exports3.descending = descending; exports3.deviation = deviation2; exports3.difference = difference2; exports3.disjoint = disjoint; exports3.every = every; exports3.extent = extent6; exports3.fcumsum = fcumsum; exports3.filter = filter; exports3.fsum = fsum; exports3.greatest = greatest; exports3.greatestIndex = greatestIndex; exports3.group = group8; exports3.groupSort = groupSort; exports3.groups = groups; exports3.histogram = bin; exports3.index = index; exports3.indexes = indexes; exports3.intersection = intersection3; exports3.least = least; exports3.leastIndex = leastIndex; exports3.map = map; exports3.max = max8; exports3.maxIndex = maxIndex; exports3.mean = mean2; exports3.median = median2; exports3.merge = merge; exports3.min = min3; exports3.minIndex = minIndex2; exports3.nice = nice; exports3.pairs = pairs; exports3.permute = permute; exports3.quantile = quantile2; exports3.quantileSorted = quantileSorted; exports3.quickselect = quickselect; exports3.range = range; exports3.reduce = reduce; exports3.reverse = reverse; exports3.rollup = rollup; exports3.rollups = rollups; exports3.scan = scan; exports3.shuffle = shuffle; exports3.shuffler = shuffler; exports3.some = some; exports3.sort = sort; exports3.subset = subset; exports3.sum = sum; exports3.superset = superset; exports3.thresholdFreedmanDiaconis = freedmanDiaconis; exports3.thresholdScott = scott; exports3.thresholdSturges = sturges; exports3.tickIncrement = tickIncrement; exports3.tickStep = tickStep; exports3.ticks = ticks; exports3.transpose = transpose; exports3.union = union2; exports3.variance = variance; exports3.zip = zip; Object.defineProperty(exports3, "__esModule", { value: true }); }); } }); // node_modules/.pnpm/d3-axis@2.1.0/node_modules/d3-axis/dist/d3-axis.js var require_d3_axis = __commonJS({ "node_modules/.pnpm/d3-axis@2.1.0/node_modules/d3-axis/dist/d3-axis.js"(exports2, module3) { (function(global2, factory) { typeof exports2 === "object" && typeof module3 !== "undefined" ? factory(exports2) : typeof define === "function" && define.amd ? define(["exports"], factory) : (global2 = typeof globalThis !== "undefined" ? globalThis : global2 || self, factory(global2.d3 = global2.d3 || {})); })(exports2, function(exports3) { "use strict"; var slice = Array.prototype.slice; function identity(x) { return x; } var top = 1, right = 2, bottom = 3, left = 4, epsilon = 1e-6; function translateX(x) { return "translate(" + x + ",0)"; } function translateY(y) { return "translate(0," + y + ")"; } function number(scale) { return (d) => +scale(d); } function center(scale, offset) { offset = Math.max(0, scale.bandwidth() - offset * 2) / 2; if (scale.round()) offset = Math.round(offset); return (d) => +scale(d) + offset; } function entering() { return !this.__axis; } function axis(orient, scale) { var tickArguments = [], tickValues = null, tickFormat = null, tickSizeInner = 6, tickSizeOuter = 6, tickPadding = 3, offset = typeof window !== "undefined" && window.devicePixelRatio > 1 ? 0 : 0.5, k = orient === top || orient === left ? -1 : 1, x = orient === left || orient === right ? "x" : "y", transform = orient === top || orient === bottom ? translateX : translateY; function axis2(context) { var values = tickValues == null ? scale.ticks ? scale.ticks.apply(scale, tickArguments) : scale.domain() : tickValues, format = tickFormat == null ? scale.tickFormat ? scale.tickFormat.apply(scale, tickArguments) : identity : tickFormat, spacing = Math.max(tickSizeInner, 0) + tickPadding, range = scale.range(), range0 = +range[0] + offset, range1 = +range[range.length - 1] + offset, position = (scale.bandwidth ? center : number)(scale.copy(), offset), selection = context.selection ? context.selection() : context, path = selection.selectAll(".domain").data([null]), tick = selection.selectAll(".tick").data(values, scale).order(), tickExit = tick.exit(), tickEnter = tick.enter().append("g").attr("class", "tick"), line = tick.select("line"), text = tick.select("text"); path = path.merge(path.enter().insert("path", ".tick").attr("class", "domain").attr("stroke", "currentColor")); tick = tick.merge(tickEnter); line = line.merge(tickEnter.append("line").attr("stroke", "currentColor").attr(x + "2", k * tickSizeInner)); text = text.merge(tickEnter.append("text").attr("fill", "currentColor").attr(x, k * spacing).attr("dy", orient === top ? "0em" : orient === bottom ? "0.71em" : "0.32em")); if (context !== selection) { path = path.transition(context); tick = tick.transition(context); line = line.transition(context); text = text.transition(context); tickExit = tickExit.transition(context).attr("opacity", epsilon).attr("transform", function(d) { return isFinite(d = position(d)) ? transform(d + offset) : this.getAttribute("transform"); }); tickEnter.attr("opacity", epsilon).attr("transform", function(d) { var p = this.parentNode.__axis; return transform((p && isFinite(p = p(d)) ? p : position(d)) + offset); }); } tickExit.remove(); path.attr("d", orient === left || orient === right ? tickSizeOuter ? "M" + k * tickSizeOuter + "," + range0 + "H" + offset + "V" + range1 + "H" + k * tickSizeOuter : "M" + offset + "," + range0 + "V" + range1 : tickSizeOuter ? "M" + range0 + "," + k * tickSizeOuter + "V" + offset + "H" + range1 + "V" + k * tickSizeOuter : "M" + range0 + "," + offset + "H" + range1); tick.attr("opacity", 1).attr("transform", function(d) { return transform(position(d) + offset); }); line.attr(x + "2", k * tickSizeInner); text.attr(x, k * spacing).text(format); selection.filter(entering).attr("fill", "none").attr("font-size", 10).attr("font-family", "sans-serif").attr("text-anchor", orient === right ? "start" : orient === left ? "end" : "middle"); selection.each(function() { this.__axis = position; }); } axis2.scale = function(_) { return arguments.length ? (scale = _, axis2) : scale; }; axis2.ticks = function() { return tickArguments = slice.call(arguments), axis2; }; axis2.tickArguments = function(_) { return arguments.length ? (tickArguments = _ == null ? [] : slice.call(_), axis2) : tickArguments.slice(); }; axis2.tickValues = function(_) { return arguments.length ? (tickValues = _ == null ? null : slice.call(_), axis2) : tickValues && tickValues.slice(); }; axis2.tickFormat = function(_) { return arguments.length ? (tickFormat = _, axis2) : tickFormat; }; axis2.tickSize = function(_) { return arguments.length ? (tickSizeInner = tickSizeOuter = +_, axis2) : tickSizeInner; }; axis2.tickSizeInner = function(_) { return arguments.length ? (tickSizeInner = +_, axis2) : tickSizeInner; }; axis2.tickSizeOuter = function(_) { return arguments.length ? (tickSizeOuter = +_, axis2) : tickSizeOuter; }; axis2.tickPadding = function(_) { return arguments.length ? (tickPadding = +_, axis2) : tickPadding; }; axis2.offset = function(_) { return arguments.length ? (offset = +_, axis2) : offset; }; return axis2; } function axisTop(scale) { return axis(top, scale); } function axisRight(scale) { return axis(right, scale); } function axisBottom(scale) { return axis(bottom, scale); } function axisLeft(scale) { return axis(left, scale); } exports3.axisBottom = axisBottom; exports3.axisLeft = axisLeft; exports3.axisRight = axisRight; exports3.axisTop = axisTop; Object.defineProperty(exports3, "__esModule", { value: true }); }); } }); // node_modules/.pnpm/d3-dispatch@2.0.0/node_modules/d3-dispatch/dist/d3-dispatch.js var require_d3_dispatch = __commonJS({ "node_modules/.pnpm/d3-dispatch@2.0.0/node_modules/d3-dispatch/dist/d3-dispatch.js"(exports2, module3) { (function(global2, factory) { typeof exports2 === "object" && typeof module3 !== "undefined" ? factory(exports2) : typeof define === "function" && define.amd ? define(["exports"], factory) : (global2 = global2 || self, factory(global2.d3 = global2.d3 || {})); })(exports2, function(exports3) { "use strict"; var noop = { value: () => { } }; function dispatch() { for (var i = 0, n = arguments.length, _ = {}, t; i < n; ++i) { if (!(t = arguments[i] + "") || t in _ || /[\s.]/.test(t)) throw new Error("illegal type: " + t); _[t] = []; } return new Dispatch(_); } function Dispatch(_) { this._ = _; } function parseTypenames(typenames, types) { return typenames.trim().split(/^|\s+/).map(function(t) { var name2 = "", i = t.indexOf("."); if (i >= 0) name2 = t.slice(i + 1), t = t.slice(0, i); if (t && !types.hasOwnProperty(t)) throw new Error("unknown type: " + t); return { type: t, name: name2 }; }); } Dispatch.prototype = dispatch.prototype = { constructor: Dispatch, on: function(typename, callback) { var _ = this._, T = parseTypenames(typename + "", _), t, i = -1, n = T.length; if (arguments.length < 2) { while (++i < n) if ((t = (typename = T[i]).type) && (t = get(_[t], typename.name))) return t; return; } if (callback != null && typeof callback !== "function") throw new Error("invalid callback: " + callback); while (++i < n) { if (t = (typename = T[i]).type) _[t] = set(_[t], typename.name, callback); else if (callback == null) for (t in _) _[t] = set(_[t], typename.name, null); } return this; }, copy: function() { var copy = {}, _ = this._; for (var t in _) copy[t] = _[t].slice(); return new Dispatch(copy); }, call: function(type2, that) { if ((n = arguments.length - 2) > 0) for (var args = new Array(n), i = 0, n, t; i < n; ++i) args[i] = arguments[i + 2]; if (!this._.hasOwnProperty(type2)) throw new Error("unknown type: " + type2); for (t = this._[type2], i = 0, n = t.length; i < n; ++i) t[i].value.apply(that, args); }, apply: function(type2, that, args) { if (!this._.hasOwnProperty(type2)) throw new Error("unknown type: " + type2); for (var t = this._[type2], i = 0, n = t.length; i < n; ++i) t[i].value.apply(that, args); } }; function get(type2, name2) { for (var i = 0, n = type2.length, c; i < n; ++i) { if ((c = type2[i]).name === name2) { return c.value; } } } function set(type2, name2, callback) { for (var i = 0, n = type2.length; i < n; ++i) { if (type2[i].name === name2) { type2[i] = noop, type2 = type2.slice(0, i).concat(type2.slice(i + 1)); break; } } if (callback != null) type2.push({ name: name2, value: callback }); return type2; } exports3.dispatch = dispatch; Object.defineProperty(exports3, "__esModule", { value: true }); }); } }); // node_modules/.pnpm/d3-selection@2.0.0/node_modules/d3-selection/dist/d3-selection.js var require_d3_selection = __commonJS({ "node_modules/.pnpm/d3-selection@2.0.0/node_modules/d3-selection/dist/d3-selection.js"(exports2, module3) { (function(global2, factory) { typeof exports2 === "object" && typeof module3 !== "undefined" ? factory(exports2) : typeof define === "function" && define.amd ? define(["exports"], factory) : (global2 = global2 || self, factory(global2.d3 = global2.d3 || {})); })(exports2, function(exports3) { "use strict"; var xhtml = "http://www.w3.org/1999/xhtml"; var namespaces = { svg: "http://www.w3.org/2000/svg", xhtml, xlink: "http://www.w3.org/1999/xlink", xml: "http://www.w3.org/XML/1998/namespace", xmlns: "http://www.w3.org/2000/xmlns/" }; function namespace(name2) { var prefix = name2 += "", i = prefix.indexOf(":"); if (i >= 0 && (prefix = name2.slice(0, i)) !== "xmlns") name2 = name2.slice(i + 1); return namespaces.hasOwnProperty(prefix) ? { space: namespaces[prefix], local: name2 } : name2; } function creatorInherit(name2) { return function() { var document2 = this.ownerDocument, uri = this.namespaceURI; return uri === xhtml && document2.documentElement.namespaceURI === xhtml ? document2.createElement(name2) : document2.createElementNS(uri, name2); }; } function creatorFixed(fullname) { return function() { return this.ownerDocument.createElementNS(fullname.space, fullname.local); }; } function creator(name2) { var fullname = namespace(name2); return (fullname.local ? creatorFixed : creatorInherit)(fullname); } function