mirror of https://github.com/logos-co/roadmap.git
6503 lines
214 KiB
JavaScript
6503 lines
214 KiB
JavaScript
(function () {// quartz/components/scripts/quartz/components/scripts/clipboard.inline.ts
|
|
var svgCopy = '<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true"><path fill-rule="evenodd" d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 010 1.5h-1.5a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-1.5a.75.75 0 011.5 0v1.5A1.75 1.75 0 019.25 16h-7.5A1.75 1.75 0 010 14.25v-7.5z"></path><path fill-rule="evenodd" d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0114.25 11h-7.5A1.75 1.75 0 015 9.25v-7.5zm1.75-.25a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-7.5a.25.25 0 00-.25-.25h-7.5z"></path></svg>';
|
|
var svgCheck = '<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true"><path fill-rule="evenodd" fill="rgb(63, 185, 80)" d="M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z"></path></svg>';
|
|
document.addEventListener("nav", () => {
|
|
const els = document.getElementsByTagName("pre");
|
|
for (let i = 0; i < els.length; i++) {
|
|
const codeBlock = els[i].getElementsByTagName("code")[0];
|
|
if (codeBlock) {
|
|
const source = codeBlock.innerText.replace(/\n\n/g, "\n");
|
|
const button = document.createElement("button");
|
|
button.className = "clipboard-button";
|
|
button.type = "button";
|
|
button.innerHTML = svgCopy;
|
|
button.ariaLabel = "Copy source";
|
|
button.addEventListener("click", () => {
|
|
navigator.clipboard.writeText(source).then(
|
|
() => {
|
|
button.blur();
|
|
button.innerHTML = svgCheck;
|
|
setTimeout(() => {
|
|
button.innerHTML = svgCopy;
|
|
button.style.borderColor = "";
|
|
}, 2e3);
|
|
},
|
|
(error) => console.error(error)
|
|
);
|
|
});
|
|
els[i].prepend(button);
|
|
}
|
|
}
|
|
});
|
|
})();
|
|
(function () {var __create = Object.create;
|
|
var __defProp = Object.defineProperty;
|
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
var __getProtoOf = Object.getPrototypeOf;
|
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
var __commonJS = (cb, mod) => function __require() {
|
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
};
|
|
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(
|
|
// If the importer is in node compatibility mode or this is not an ESM
|
|
// file that has been converted to a CommonJS file using a Babel-
|
|
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
mod
|
|
));
|
|
|
|
// node_modules/flexsearch/dist/flexsearch.bundle.js
|
|
var require_flexsearch_bundle = __commonJS({
|
|
"node_modules/flexsearch/dist/flexsearch.bundle.js"(exports, module) {
|
|
(function _f(self) {
|
|
"use strict";
|
|
try {
|
|
if (module)
|
|
self = module;
|
|
} catch (e) {
|
|
}
|
|
self._factory = _f;
|
|
var t;
|
|
function u(a2) {
|
|
return "undefined" !== typeof a2 ? a2 : true;
|
|
}
|
|
function aa(a2) {
|
|
const b2 = Array(a2);
|
|
for (let c2 = 0; c2 < a2; c2++)
|
|
b2[c2] = v();
|
|
return b2;
|
|
}
|
|
function v() {
|
|
return /* @__PURE__ */ Object.create(null);
|
|
}
|
|
function ba(a2, b2) {
|
|
return b2.length - a2.length;
|
|
}
|
|
function x(a2) {
|
|
return "string" === typeof a2;
|
|
}
|
|
function C(a2) {
|
|
return "object" === typeof a2;
|
|
}
|
|
function D(a2) {
|
|
return "function" === typeof a2;
|
|
}
|
|
;
|
|
function ca(a2, b2) {
|
|
var c2 = da;
|
|
if (a2 && (b2 && (a2 = E(a2, b2)), this.H && (a2 = E(a2, this.H)), this.J && 1 < a2.length && (a2 = E(a2, this.J)), c2 || "" === c2)) {
|
|
a2 = a2.split(c2);
|
|
if (this.filter) {
|
|
b2 = this.filter;
|
|
c2 = a2.length;
|
|
const d2 = [];
|
|
for (let e = 0, f = 0; e < c2; e++) {
|
|
const g = a2[e];
|
|
g && !b2[g] && (d2[f++] = g);
|
|
}
|
|
a2 = d2;
|
|
}
|
|
return a2;
|
|
}
|
|
return a2;
|
|
}
|
|
const da = /[\p{Z}\p{S}\p{P}\p{C}]+/u, ea = /[\u0300-\u036f]/g;
|
|
function fa(a2, b2) {
|
|
const c2 = Object.keys(a2), d2 = c2.length, e = [];
|
|
let f = "", g = 0;
|
|
for (let h = 0, k, m; h < d2; h++)
|
|
k = c2[h], (m = a2[k]) ? (e[g++] = F(b2 ? "(?!\\b)" + k + "(\\b|_)" : k), e[g++] = m) : f += (f ? "|" : "") + k;
|
|
f && (e[g++] = F(b2 ? "(?!\\b)(" + f + ")(\\b|_)" : "(" + f + ")"), e[g] = "");
|
|
return e;
|
|
}
|
|
function E(a2, b2) {
|
|
for (let c2 = 0, d2 = b2.length; c2 < d2 && (a2 = a2.replace(b2[c2], b2[c2 + 1]), a2); c2 += 2)
|
|
;
|
|
return a2;
|
|
}
|
|
function F(a2) {
|
|
return new RegExp(a2, "g");
|
|
}
|
|
function ha(a2) {
|
|
let b2 = "", c2 = "";
|
|
for (let d2 = 0, e = a2.length, f; d2 < e; d2++)
|
|
(f = a2[d2]) !== c2 && (b2 += c2 = f);
|
|
return b2;
|
|
}
|
|
;
|
|
var ja = { encode: ia, F: false, G: "" };
|
|
function ia(a2) {
|
|
return ca.call(this, ("" + a2).toLowerCase(), false);
|
|
}
|
|
;
|
|
const ka = {}, G = {};
|
|
function la(a2) {
|
|
I(a2, "add");
|
|
I(a2, "append");
|
|
I(a2, "search");
|
|
I(a2, "update");
|
|
I(a2, "remove");
|
|
}
|
|
function I(a2, b2) {
|
|
a2[b2 + "Async"] = function() {
|
|
const c2 = this, d2 = arguments;
|
|
var e = d2[d2.length - 1];
|
|
let f;
|
|
D(e) && (f = e, delete d2[d2.length - 1]);
|
|
e = new Promise(function(g) {
|
|
setTimeout(function() {
|
|
c2.async = true;
|
|
const h = c2[b2].apply(c2, d2);
|
|
c2.async = false;
|
|
g(h);
|
|
});
|
|
});
|
|
return f ? (e.then(f), this) : e;
|
|
};
|
|
}
|
|
;
|
|
function ma(a2, b2, c2, d2) {
|
|
const e = a2.length;
|
|
let f = [], g, h, k = 0;
|
|
d2 && (d2 = []);
|
|
for (let m = e - 1; 0 <= m; m--) {
|
|
const n = a2[m], w = n.length, q = v();
|
|
let r = !g;
|
|
for (let l = 0; l < w; l++) {
|
|
const p = n[l], z = p.length;
|
|
if (z)
|
|
for (let B = 0, A, y; B < z; B++)
|
|
if (y = p[B], g) {
|
|
if (g[y]) {
|
|
if (!m) {
|
|
if (c2)
|
|
c2--;
|
|
else if (f[k++] = y, k === b2)
|
|
return f;
|
|
}
|
|
if (m || d2)
|
|
q[y] = 1;
|
|
r = true;
|
|
}
|
|
if (d2 && (h[y] = (A = h[y]) ? ++A : A = 1, A < e)) {
|
|
const H = d2[A - 2] || (d2[A - 2] = []);
|
|
H[H.length] = y;
|
|
}
|
|
} else
|
|
q[y] = 1;
|
|
}
|
|
if (d2)
|
|
g || (h = q);
|
|
else if (!r)
|
|
return [];
|
|
g = q;
|
|
}
|
|
if (d2)
|
|
for (let m = d2.length - 1, n, w; 0 <= m; m--) {
|
|
n = d2[m];
|
|
w = n.length;
|
|
for (let q = 0, r; q < w; q++)
|
|
if (r = n[q], !g[r]) {
|
|
if (c2)
|
|
c2--;
|
|
else if (f[k++] = r, k === b2)
|
|
return f;
|
|
g[r] = 1;
|
|
}
|
|
}
|
|
return f;
|
|
}
|
|
function na(a2, b2) {
|
|
const c2 = v(), d2 = v(), e = [];
|
|
for (let f = 0; f < a2.length; f++)
|
|
c2[a2[f]] = 1;
|
|
for (let f = 0, g; f < b2.length; f++) {
|
|
g = b2[f];
|
|
for (let h = 0, k; h < g.length; h++)
|
|
k = g[h], c2[k] && !d2[k] && (d2[k] = 1, e[e.length] = k);
|
|
}
|
|
return e;
|
|
}
|
|
;
|
|
function J(a2) {
|
|
this.l = true !== a2 && a2;
|
|
this.cache = v();
|
|
this.h = [];
|
|
}
|
|
function oa(a2, b2, c2) {
|
|
C(a2) && (a2 = a2.query);
|
|
let d2 = this.cache.get(a2);
|
|
d2 || (d2 = this.search(a2, b2, c2), this.cache.set(a2, d2));
|
|
return d2;
|
|
}
|
|
J.prototype.set = function(a2, b2) {
|
|
if (!this.cache[a2]) {
|
|
var c2 = this.h.length;
|
|
c2 === this.l ? delete this.cache[this.h[c2 - 1]] : c2++;
|
|
for (--c2; 0 < c2; c2--)
|
|
this.h[c2] = this.h[c2 - 1];
|
|
this.h[0] = a2;
|
|
}
|
|
this.cache[a2] = b2;
|
|
};
|
|
J.prototype.get = function(a2) {
|
|
const b2 = this.cache[a2];
|
|
if (this.l && b2 && (a2 = this.h.indexOf(a2))) {
|
|
const c2 = this.h[a2 - 1];
|
|
this.h[a2 - 1] = this.h[a2];
|
|
this.h[a2] = c2;
|
|
}
|
|
return b2;
|
|
};
|
|
const qa = { memory: { charset: "latin:extra", D: 3, B: 4, m: false }, performance: { D: 3, B: 3, s: false, context: { depth: 2, D: 1 } }, match: { charset: "latin:extra", G: "reverse" }, score: { charset: "latin:advanced", D: 20, B: 3, context: { depth: 3, D: 9 } }, "default": {} };
|
|
function ra(a2, b2, c2, d2, e, f) {
|
|
setTimeout(function() {
|
|
const g = a2(c2, JSON.stringify(f));
|
|
g && g.then ? g.then(function() {
|
|
b2.export(a2, b2, c2, d2, e + 1);
|
|
}) : b2.export(a2, b2, c2, d2, e + 1);
|
|
});
|
|
}
|
|
;
|
|
function K(a2, b2) {
|
|
if (!(this instanceof K))
|
|
return new K(a2);
|
|
var c2;
|
|
if (a2) {
|
|
x(a2) ? a2 = qa[a2] : (c2 = a2.preset) && (a2 = Object.assign({}, c2[c2], a2));
|
|
c2 = a2.charset;
|
|
var d2 = a2.lang;
|
|
x(c2) && (-1 === c2.indexOf(":") && (c2 += ":default"), c2 = G[c2]);
|
|
x(d2) && (d2 = ka[d2]);
|
|
} else
|
|
a2 = {};
|
|
let e, f, g = a2.context || {};
|
|
this.encode = a2.encode || c2 && c2.encode || ia;
|
|
this.register = b2 || v();
|
|
this.D = e = a2.resolution || 9;
|
|
this.G = b2 = c2 && c2.G || a2.tokenize || "strict";
|
|
this.depth = "strict" === b2 && g.depth;
|
|
this.l = u(g.bidirectional);
|
|
this.s = f = u(a2.optimize);
|
|
this.m = u(a2.fastupdate);
|
|
this.B = a2.minlength || 1;
|
|
this.C = a2.boost;
|
|
this.map = f ? aa(e) : v();
|
|
this.A = e = g.resolution || 1;
|
|
this.h = f ? aa(e) : v();
|
|
this.F = c2 && c2.F || a2.rtl;
|
|
this.H = (b2 = a2.matcher || d2 && d2.H) && fa(b2, false);
|
|
this.J = (b2 = a2.stemmer || d2 && d2.J) && fa(b2, true);
|
|
if (c2 = b2 = a2.filter || d2 && d2.filter) {
|
|
c2 = b2;
|
|
d2 = v();
|
|
for (let h = 0, k = c2.length; h < k; h++)
|
|
d2[c2[h]] = 1;
|
|
c2 = d2;
|
|
}
|
|
this.filter = c2;
|
|
this.cache = (b2 = a2.cache) && new J(b2);
|
|
}
|
|
t = K.prototype;
|
|
t.append = function(a2, b2) {
|
|
return this.add(a2, b2, true);
|
|
};
|
|
t.add = function(a2, b2, c2, d2) {
|
|
if (b2 && (a2 || 0 === a2)) {
|
|
if (!d2 && !c2 && this.register[a2])
|
|
return this.update(a2, b2);
|
|
b2 = this.encode(b2);
|
|
if (d2 = b2.length) {
|
|
const m = v(), n = v(), w = this.depth, q = this.D;
|
|
for (let r = 0; r < d2; r++) {
|
|
let l = b2[this.F ? d2 - 1 - r : r];
|
|
var e = l.length;
|
|
if (l && e >= this.B && (w || !n[l])) {
|
|
var f = L(q, d2, r), g = "";
|
|
switch (this.G) {
|
|
case "full":
|
|
if (3 < e) {
|
|
for (f = 0; f < e; f++)
|
|
for (var h = e; h > f; h--)
|
|
if (h - f >= this.B) {
|
|
var k = L(q, d2, r, e, f);
|
|
g = l.substring(f, h);
|
|
M(this, n, g, k, a2, c2);
|
|
}
|
|
break;
|
|
}
|
|
case "reverse":
|
|
if (2 < e) {
|
|
for (h = e - 1; 0 < h; h--)
|
|
g = l[h] + g, g.length >= this.B && M(
|
|
this,
|
|
n,
|
|
g,
|
|
L(q, d2, r, e, h),
|
|
a2,
|
|
c2
|
|
);
|
|
g = "";
|
|
}
|
|
case "forward":
|
|
if (1 < e) {
|
|
for (h = 0; h < e; h++)
|
|
g += l[h], g.length >= this.B && M(this, n, g, f, a2, c2);
|
|
break;
|
|
}
|
|
default:
|
|
if (this.C && (f = Math.min(f / this.C(b2, l, r) | 0, q - 1)), M(this, n, l, f, a2, c2), w && 1 < d2 && r < d2 - 1) {
|
|
for (e = v(), g = this.A, f = l, h = Math.min(w + 1, d2 - r), e[f] = 1, k = 1; k < h; k++)
|
|
if ((l = b2[this.F ? d2 - 1 - r - k : r + k]) && l.length >= this.B && !e[l]) {
|
|
e[l] = 1;
|
|
const p = this.l && l > f;
|
|
M(this, m, p ? f : l, L(g + (d2 / 2 > g ? 0 : 1), d2, r, h - 1, k - 1), a2, c2, p ? l : f);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
this.m || (this.register[a2] = 1);
|
|
}
|
|
}
|
|
return this;
|
|
};
|
|
function L(a2, b2, c2, d2, e) {
|
|
return c2 && 1 < a2 ? b2 + (d2 || 0) <= a2 ? c2 + (e || 0) : (a2 - 1) / (b2 + (d2 || 0)) * (c2 + (e || 0)) + 1 | 0 : 0;
|
|
}
|
|
function M(a2, b2, c2, d2, e, f, g) {
|
|
let h = g ? a2.h : a2.map;
|
|
if (!b2[c2] || g && !b2[c2][g])
|
|
a2.s && (h = h[d2]), g ? (b2 = b2[c2] || (b2[c2] = v()), b2[g] = 1, h = h[g] || (h[g] = v())) : b2[c2] = 1, h = h[c2] || (h[c2] = []), a2.s || (h = h[d2] || (h[d2] = [])), f && -1 !== h.indexOf(e) || (h[h.length] = e, a2.m && (a2 = a2.register[e] || (a2.register[e] = []), a2[a2.length] = h));
|
|
}
|
|
t.search = function(a2, b2, c2) {
|
|
c2 || (!b2 && C(a2) ? (c2 = a2, a2 = c2.query) : C(b2) && (c2 = b2));
|
|
let d2 = [], e;
|
|
let f, g = 0;
|
|
if (c2) {
|
|
b2 = c2.limit;
|
|
g = c2.offset || 0;
|
|
var h = c2.context;
|
|
f = c2.suggest;
|
|
}
|
|
if (a2 && (a2 = this.encode(a2), e = a2.length, 1 < e)) {
|
|
c2 = v();
|
|
var k = [];
|
|
for (let n = 0, w = 0, q; n < e; n++)
|
|
if ((q = a2[n]) && q.length >= this.B && !c2[q])
|
|
if (this.s || f || this.map[q])
|
|
k[w++] = q, c2[q] = 1;
|
|
else
|
|
return d2;
|
|
a2 = k;
|
|
e = a2.length;
|
|
}
|
|
if (!e)
|
|
return d2;
|
|
b2 || (b2 = 100);
|
|
h = this.depth && 1 < e && false !== h;
|
|
c2 = 0;
|
|
let m;
|
|
h ? (m = a2[0], c2 = 1) : 1 < e && a2.sort(ba);
|
|
for (let n, w; c2 < e; c2++) {
|
|
w = a2[c2];
|
|
h ? (n = sa(this, d2, f, b2, g, 2 === e, w, m), f && false === n && d2.length || (m = w)) : n = sa(this, d2, f, b2, g, 1 === e, w);
|
|
if (n)
|
|
return n;
|
|
if (f && c2 === e - 1) {
|
|
k = d2.length;
|
|
if (!k) {
|
|
if (h) {
|
|
h = 0;
|
|
c2 = -1;
|
|
continue;
|
|
}
|
|
return d2;
|
|
}
|
|
if (1 === k)
|
|
return ta(d2[0], b2, g);
|
|
}
|
|
}
|
|
return ma(d2, b2, g, f);
|
|
};
|
|
function sa(a2, b2, c2, d2, e, f, g, h) {
|
|
let k = [], m = h ? a2.h : a2.map;
|
|
a2.s || (m = ua(m, g, h, a2.l));
|
|
if (m) {
|
|
let n = 0;
|
|
const w = Math.min(m.length, h ? a2.A : a2.D);
|
|
for (let q = 0, r = 0, l, p; q < w; q++)
|
|
if (l = m[q]) {
|
|
if (a2.s && (l = ua(l, g, h, a2.l)), e && l && f && (p = l.length, p <= e ? (e -= p, l = null) : (l = l.slice(e), e = 0)), l && (k[n++] = l, f && (r += l.length, r >= d2)))
|
|
break;
|
|
}
|
|
if (n) {
|
|
if (f)
|
|
return ta(k, d2, 0);
|
|
b2[b2.length] = k;
|
|
return;
|
|
}
|
|
}
|
|
return !c2 && k;
|
|
}
|
|
function ta(a2, b2, c2) {
|
|
a2 = 1 === a2.length ? a2[0] : [].concat.apply([], a2);
|
|
return c2 || a2.length > b2 ? a2.slice(c2, c2 + b2) : a2;
|
|
}
|
|
function ua(a2, b2, c2, d2) {
|
|
c2 ? (d2 = d2 && b2 > c2, a2 = (a2 = a2[d2 ? b2 : c2]) && a2[d2 ? c2 : b2]) : a2 = a2[b2];
|
|
return a2;
|
|
}
|
|
t.contain = function(a2) {
|
|
return !!this.register[a2];
|
|
};
|
|
t.update = function(a2, b2) {
|
|
return this.remove(a2).add(a2, b2);
|
|
};
|
|
t.remove = function(a2, b2) {
|
|
const c2 = this.register[a2];
|
|
if (c2) {
|
|
if (this.m)
|
|
for (let d2 = 0, e; d2 < c2.length; d2++)
|
|
e = c2[d2], e.splice(e.indexOf(a2), 1);
|
|
else
|
|
N(this.map, a2, this.D, this.s), this.depth && N(this.h, a2, this.A, this.s);
|
|
b2 || delete this.register[a2];
|
|
if (this.cache) {
|
|
b2 = this.cache;
|
|
for (let d2 = 0, e, f; d2 < b2.h.length; d2++)
|
|
f = b2.h[d2], e = b2.cache[f], -1 !== e.indexOf(a2) && (b2.h.splice(d2--, 1), delete b2.cache[f]);
|
|
}
|
|
}
|
|
return this;
|
|
};
|
|
function N(a2, b2, c2, d2, e) {
|
|
let f = 0;
|
|
if (a2.constructor === Array)
|
|
if (e)
|
|
b2 = a2.indexOf(b2), -1 !== b2 ? 1 < a2.length && (a2.splice(b2, 1), f++) : f++;
|
|
else {
|
|
e = Math.min(a2.length, c2);
|
|
for (let g = 0, h; g < e; g++)
|
|
if (h = a2[g])
|
|
f = N(h, b2, c2, d2, e), d2 || f || delete a2[g];
|
|
}
|
|
else
|
|
for (let g in a2)
|
|
(f = N(a2[g], b2, c2, d2, e)) || delete a2[g];
|
|
return f;
|
|
}
|
|
t.searchCache = oa;
|
|
t.export = function(a2, b2, c2, d2, e) {
|
|
let f, g;
|
|
switch (e || (e = 0)) {
|
|
case 0:
|
|
f = "reg";
|
|
if (this.m) {
|
|
g = v();
|
|
for (let h in this.register)
|
|
g[h] = 1;
|
|
} else
|
|
g = this.register;
|
|
break;
|
|
case 1:
|
|
f = "cfg";
|
|
g = { doc: 0, opt: this.s ? 1 : 0 };
|
|
break;
|
|
case 2:
|
|
f = "map";
|
|
g = this.map;
|
|
break;
|
|
case 3:
|
|
f = "ctx";
|
|
g = this.h;
|
|
break;
|
|
default:
|
|
return;
|
|
}
|
|
ra(a2, b2 || this, c2 ? c2 + "." + f : f, d2, e, g);
|
|
return true;
|
|
};
|
|
t.import = function(a2, b2) {
|
|
if (b2)
|
|
switch (x(b2) && (b2 = JSON.parse(b2)), a2) {
|
|
case "cfg":
|
|
this.s = !!b2.opt;
|
|
break;
|
|
case "reg":
|
|
this.m = false;
|
|
this.register = b2;
|
|
break;
|
|
case "map":
|
|
this.map = b2;
|
|
break;
|
|
case "ctx":
|
|
this.h = b2;
|
|
}
|
|
};
|
|
la(K.prototype);
|
|
function va(a2) {
|
|
a2 = a2.data;
|
|
var b2 = self._index;
|
|
const c2 = a2.args;
|
|
var d2 = a2.task;
|
|
switch (d2) {
|
|
case "init":
|
|
d2 = a2.options || {};
|
|
a2 = a2.factory;
|
|
b2 = d2.encode;
|
|
d2.cache = false;
|
|
b2 && 0 === b2.indexOf("function") && (d2.encode = Function("return " + b2)());
|
|
a2 ? (Function("return " + a2)()(self), self._index = new self.FlexSearch.Index(d2), delete self.FlexSearch) : self._index = new K(d2);
|
|
break;
|
|
default:
|
|
a2 = a2.id, b2 = b2[d2].apply(b2, c2), postMessage("search" === d2 ? { id: a2, msg: b2 } : { id: a2 });
|
|
}
|
|
}
|
|
;
|
|
let wa = 0;
|
|
function O(a2) {
|
|
if (!(this instanceof O))
|
|
return new O(a2);
|
|
var b2;
|
|
a2 ? D(b2 = a2.encode) && (a2.encode = b2.toString()) : a2 = {};
|
|
(b2 = (self || window)._factory) && (b2 = b2.toString());
|
|
const c2 = self.exports, d2 = this;
|
|
this.o = xa(b2, c2, a2.worker);
|
|
this.h = v();
|
|
if (this.o) {
|
|
if (c2)
|
|
this.o.on("message", function(e) {
|
|
d2.h[e.id](e.msg);
|
|
delete d2.h[e.id];
|
|
});
|
|
else
|
|
this.o.onmessage = function(e) {
|
|
e = e.data;
|
|
d2.h[e.id](e.msg);
|
|
delete d2.h[e.id];
|
|
};
|
|
this.o.postMessage({ task: "init", factory: b2, options: a2 });
|
|
}
|
|
}
|
|
P("add");
|
|
P("append");
|
|
P("search");
|
|
P("update");
|
|
P("remove");
|
|
function P(a2) {
|
|
O.prototype[a2] = O.prototype[a2 + "Async"] = function() {
|
|
const b2 = this, c2 = [].slice.call(arguments);
|
|
var d2 = c2[c2.length - 1];
|
|
let e;
|
|
D(d2) && (e = d2, c2.splice(c2.length - 1, 1));
|
|
d2 = new Promise(function(f) {
|
|
setTimeout(function() {
|
|
b2.h[++wa] = f;
|
|
b2.o.postMessage({ task: a2, id: wa, args: c2 });
|
|
});
|
|
});
|
|
return e ? (d2.then(e), this) : d2;
|
|
};
|
|
}
|
|
function xa(a, b, c) {
|
|
let d;
|
|
try {
|
|
d = b ? eval('new (require("worker_threads")["Worker"])("../dist/node/node.js")') : a ? new Worker(URL.createObjectURL(new Blob(["onmessage=" + va.toString()], { type: "text/javascript" }))) : new Worker(x(c) ? c : "worker/worker.js", { type: "module" });
|
|
} catch (e) {
|
|
}
|
|
return d;
|
|
}
|
|
;
|
|
function Q(a2) {
|
|
if (!(this instanceof Q))
|
|
return new Q(a2);
|
|
var b2 = a2.document || a2.doc || a2, c2;
|
|
this.K = [];
|
|
this.h = [];
|
|
this.A = [];
|
|
this.register = v();
|
|
this.key = (c2 = b2.key || b2.id) && S(c2, this.A) || "id";
|
|
this.m = u(a2.fastupdate);
|
|
this.C = (c2 = b2.store) && true !== c2 && [];
|
|
this.store = c2 && v();
|
|
this.I = (c2 = b2.tag) && S(c2, this.A);
|
|
this.l = c2 && v();
|
|
this.cache = (c2 = a2.cache) && new J(c2);
|
|
a2.cache = false;
|
|
this.o = a2.worker;
|
|
this.async = false;
|
|
c2 = v();
|
|
let d2 = b2.index || b2.field || b2;
|
|
x(d2) && (d2 = [d2]);
|
|
for (let e = 0, f, g; e < d2.length; e++)
|
|
f = d2[e], x(f) || (g = f, f = f.field), g = C(g) ? Object.assign({}, a2, g) : a2, this.o && (c2[f] = new O(g), c2[f].o || (this.o = false)), this.o || (c2[f] = new K(g, this.register)), this.K[e] = S(f, this.A), this.h[e] = f;
|
|
if (this.C)
|
|
for (a2 = b2.store, x(a2) && (a2 = [a2]), b2 = 0; b2 < a2.length; b2++)
|
|
this.C[b2] = S(a2[b2], this.A);
|
|
this.index = c2;
|
|
}
|
|
function S(a2, b2) {
|
|
const c2 = a2.split(":");
|
|
let d2 = 0;
|
|
for (let e = 0; e < c2.length; e++)
|
|
a2 = c2[e], 0 <= a2.indexOf("[]") && (a2 = a2.substring(0, a2.length - 2)) && (b2[d2] = true), a2 && (c2[d2++] = a2);
|
|
d2 < c2.length && (c2.length = d2);
|
|
return 1 < d2 ? c2 : c2[0];
|
|
}
|
|
function T(a2, b2) {
|
|
if (x(b2))
|
|
a2 = a2[b2];
|
|
else
|
|
for (let c2 = 0; a2 && c2 < b2.length; c2++)
|
|
a2 = a2[b2[c2]];
|
|
return a2;
|
|
}
|
|
function U(a2, b2, c2, d2, e) {
|
|
a2 = a2[e];
|
|
if (d2 === c2.length - 1)
|
|
b2[e] = a2;
|
|
else if (a2)
|
|
if (a2.constructor === Array)
|
|
for (b2 = b2[e] = Array(a2.length), e = 0; e < a2.length; e++)
|
|
U(a2, b2, c2, d2, e);
|
|
else
|
|
b2 = b2[e] || (b2[e] = v()), e = c2[++d2], U(a2, b2, c2, d2, e);
|
|
}
|
|
function V(a2, b2, c2, d2, e, f, g, h) {
|
|
if (a2 = a2[g])
|
|
if (d2 === b2.length - 1) {
|
|
if (a2.constructor === Array) {
|
|
if (c2[d2]) {
|
|
for (b2 = 0; b2 < a2.length; b2++)
|
|
e.add(f, a2[b2], true, true);
|
|
return;
|
|
}
|
|
a2 = a2.join(" ");
|
|
}
|
|
e.add(f, a2, h, true);
|
|
} else if (a2.constructor === Array)
|
|
for (g = 0; g < a2.length; g++)
|
|
V(a2, b2, c2, d2, e, f, g, h);
|
|
else
|
|
g = b2[++d2], V(a2, b2, c2, d2, e, f, g, h);
|
|
}
|
|
t = Q.prototype;
|
|
t.add = function(a2, b2, c2) {
|
|
C(a2) && (b2 = a2, a2 = T(b2, this.key));
|
|
if (b2 && (a2 || 0 === a2)) {
|
|
if (!c2 && this.register[a2])
|
|
return this.update(a2, b2);
|
|
for (let d2 = 0, e, f; d2 < this.h.length; d2++)
|
|
f = this.h[d2], e = this.K[d2], x(e) && (e = [e]), V(b2, e, this.A, 0, this.index[f], a2, e[0], c2);
|
|
if (this.I) {
|
|
let d2 = T(b2, this.I), e = v();
|
|
x(d2) && (d2 = [d2]);
|
|
for (let f = 0, g, h; f < d2.length; f++)
|
|
if (g = d2[f], !e[g] && (e[g] = 1, h = this.l[g] || (this.l[g] = []), !c2 || -1 === h.indexOf(a2))) {
|
|
if (h[h.length] = a2, this.m) {
|
|
const k = this.register[a2] || (this.register[a2] = []);
|
|
k[k.length] = h;
|
|
}
|
|
}
|
|
}
|
|
if (this.store && (!c2 || !this.store[a2])) {
|
|
let d2;
|
|
if (this.C) {
|
|
d2 = v();
|
|
for (let e = 0, f; e < this.C.length; e++)
|
|
f = this.C[e], x(f) ? d2[f] = b2[f] : U(b2, d2, f, 0, f[0]);
|
|
}
|
|
this.store[a2] = d2 || b2;
|
|
}
|
|
}
|
|
return this;
|
|
};
|
|
t.append = function(a2, b2) {
|
|
return this.add(a2, b2, true);
|
|
};
|
|
t.update = function(a2, b2) {
|
|
return this.remove(a2).add(a2, b2);
|
|
};
|
|
t.remove = function(a2) {
|
|
C(a2) && (a2 = T(a2, this.key));
|
|
if (this.register[a2]) {
|
|
for (var b2 = 0; b2 < this.h.length && (this.index[this.h[b2]].remove(a2, !this.o), !this.m); b2++)
|
|
;
|
|
if (this.I && !this.m)
|
|
for (let c2 in this.l) {
|
|
b2 = this.l[c2];
|
|
const d2 = b2.indexOf(a2);
|
|
-1 !== d2 && (1 < b2.length ? b2.splice(d2, 1) : delete this.l[c2]);
|
|
}
|
|
this.store && delete this.store[a2];
|
|
delete this.register[a2];
|
|
}
|
|
return this;
|
|
};
|
|
t.search = function(a2, b2, c2, d2) {
|
|
c2 || (!b2 && C(a2) ? (c2 = a2, a2 = c2.query) : C(b2) && (c2 = b2, b2 = 0));
|
|
let e = [], f = [], g, h, k, m, n, w, q = 0;
|
|
if (c2)
|
|
if (c2.constructor === Array)
|
|
k = c2, c2 = null;
|
|
else {
|
|
k = (g = c2.pluck) || c2.index || c2.field;
|
|
m = c2.tag;
|
|
h = this.store && c2.enrich;
|
|
n = "and" === c2.bool;
|
|
b2 = c2.limit || 100;
|
|
w = c2.offset || 0;
|
|
if (m && (x(m) && (m = [m]), !a2)) {
|
|
for (let l = 0, p; l < m.length; l++)
|
|
if (p = ya.call(this, m[l], b2, w, h))
|
|
e[e.length] = p, q++;
|
|
return q ? e : [];
|
|
}
|
|
x(k) && (k = [k]);
|
|
}
|
|
k || (k = this.h);
|
|
n = n && (1 < k.length || m && 1 < m.length);
|
|
const r = !d2 && (this.o || this.async) && [];
|
|
for (let l = 0, p, z, B; l < k.length; l++) {
|
|
let A;
|
|
z = k[l];
|
|
x(z) || (A = z, z = z.field);
|
|
if (r)
|
|
r[l] = this.index[z].searchAsync(a2, b2, A || c2);
|
|
else {
|
|
d2 ? p = d2[l] : p = this.index[z].search(a2, b2, A || c2);
|
|
B = p && p.length;
|
|
if (m && B) {
|
|
const y = [];
|
|
let H = 0;
|
|
n && (y[0] = [p]);
|
|
for (let X = 0, pa, R; X < m.length; X++)
|
|
if (pa = m[X], B = (R = this.l[pa]) && R.length)
|
|
H++, y[y.length] = n ? [R] : R;
|
|
H && (p = n ? ma(y, b2 || 100, w || 0) : na(p, y), B = p.length);
|
|
}
|
|
if (B)
|
|
f[q] = z, e[q++] = p;
|
|
else if (n)
|
|
return [];
|
|
}
|
|
}
|
|
if (r) {
|
|
const l = this;
|
|
return new Promise(function(p) {
|
|
Promise.all(r).then(function(z) {
|
|
p(l.search(a2, b2, c2, z));
|
|
});
|
|
});
|
|
}
|
|
if (!q)
|
|
return [];
|
|
if (g && (!h || !this.store))
|
|
return e[0];
|
|
for (let l = 0, p; l < f.length; l++) {
|
|
p = e[l];
|
|
p.length && h && (p = za.call(this, p));
|
|
if (g)
|
|
return p;
|
|
e[l] = { field: f[l], result: p };
|
|
}
|
|
return e;
|
|
};
|
|
function ya(a2, b2, c2, d2) {
|
|
let e = this.l[a2], f = e && e.length - c2;
|
|
if (f && 0 < f) {
|
|
if (f > b2 || c2)
|
|
e = e.slice(c2, c2 + b2);
|
|
d2 && (e = za.call(this, e));
|
|
return { tag: a2, result: e };
|
|
}
|
|
}
|
|
function za(a2) {
|
|
const b2 = Array(a2.length);
|
|
for (let c2 = 0, d2; c2 < a2.length; c2++)
|
|
d2 = a2[c2], b2[c2] = { id: d2, doc: this.store[d2] };
|
|
return b2;
|
|
}
|
|
t.contain = function(a2) {
|
|
return !!this.register[a2];
|
|
};
|
|
t.get = function(a2) {
|
|
return this.store[a2];
|
|
};
|
|
t.set = function(a2, b2) {
|
|
this.store[a2] = b2;
|
|
return this;
|
|
};
|
|
t.searchCache = oa;
|
|
t.export = function(a2, b2, c2, d2, e) {
|
|
e || (e = 0);
|
|
d2 || (d2 = 0);
|
|
if (d2 < this.h.length) {
|
|
const f = this.h[d2], g = this.index[f];
|
|
b2 = this;
|
|
setTimeout(function() {
|
|
g.export(a2, b2, e ? f.replace(":", "-") : "", d2, e++) || (d2++, e = 1, b2.export(a2, b2, f, d2, e));
|
|
});
|
|
} else {
|
|
let f;
|
|
switch (e) {
|
|
case 1:
|
|
c2 = "tag";
|
|
f = this.l;
|
|
break;
|
|
case 2:
|
|
c2 = "store";
|
|
f = this.store;
|
|
break;
|
|
default:
|
|
return;
|
|
}
|
|
ra(a2, this, c2, d2, e, f);
|
|
}
|
|
};
|
|
t.import = function(a2, b2) {
|
|
if (b2)
|
|
switch (x(b2) && (b2 = JSON.parse(b2)), a2) {
|
|
case "tag":
|
|
this.l = b2;
|
|
break;
|
|
case "reg":
|
|
this.m = false;
|
|
this.register = b2;
|
|
for (let d2 = 0, e; d2 < this.h.length; d2++)
|
|
e = this.index[this.h[d2]], e.register = b2, e.m = false;
|
|
break;
|
|
case "store":
|
|
this.store = b2;
|
|
break;
|
|
default:
|
|
a2 = a2.split(".");
|
|
const c2 = a2[0];
|
|
a2 = a2[1];
|
|
c2 && a2 && this.index[c2].import(a2, b2);
|
|
}
|
|
};
|
|
la(Q.prototype);
|
|
var Ba = { encode: Aa, F: false, G: "" };
|
|
const Ca = [F("[\xE0\xE1\xE2\xE3\xE4\xE5]"), "a", F("[\xE8\xE9\xEA\xEB]"), "e", F("[\xEC\xED\xEE\xEF]"), "i", F("[\xF2\xF3\xF4\xF5\xF6\u0151]"), "o", F("[\xF9\xFA\xFB\xFC\u0171]"), "u", F("[\xFD\u0177\xFF]"), "y", F("\xF1"), "n", F("[\xE7c]"), "k", F("\xDF"), "s", F(" & "), " and "];
|
|
function Aa(a2) {
|
|
var b2 = a2;
|
|
b2.normalize && (b2 = b2.normalize("NFD").replace(ea, ""));
|
|
return ca.call(this, b2.toLowerCase(), !a2.normalize && Ca);
|
|
}
|
|
;
|
|
var Ea = { encode: Da, F: false, G: "strict" };
|
|
const Fa = /[^a-z0-9]+/, Ga = { b: "p", v: "f", w: "f", z: "s", x: "s", "\xDF": "s", d: "t", n: "m", c: "k", g: "k", j: "k", q: "k", i: "e", y: "e", u: "o" };
|
|
function Da(a2) {
|
|
a2 = Aa.call(this, a2).join(" ");
|
|
const b2 = [];
|
|
if (a2) {
|
|
const c2 = a2.split(Fa), d2 = c2.length;
|
|
for (let e = 0, f, g = 0; e < d2; e++)
|
|
if ((a2 = c2[e]) && (!this.filter || !this.filter[a2])) {
|
|
f = a2[0];
|
|
let h = Ga[f] || f, k = h;
|
|
for (let m = 1; m < a2.length; m++) {
|
|
f = a2[m];
|
|
const n = Ga[f] || f;
|
|
n && n !== k && (h += n, k = n);
|
|
}
|
|
b2[g++] = h;
|
|
}
|
|
}
|
|
return b2;
|
|
}
|
|
;
|
|
var Ia = { encode: Ha, F: false, G: "" };
|
|
const Ja = [F("ae"), "a", F("oe"), "o", F("sh"), "s", F("th"), "t", F("ph"), "f", F("pf"), "f", F("(?![aeo])h(?![aeo])"), "", F("(?!^[aeo])h(?!^[aeo])"), ""];
|
|
function Ha(a2, b2) {
|
|
a2 && (a2 = Da.call(this, a2).join(" "), 2 < a2.length && (a2 = E(a2, Ja)), b2 || (1 < a2.length && (a2 = ha(a2)), a2 && (a2 = a2.split(" "))));
|
|
return a2;
|
|
}
|
|
;
|
|
var La = { encode: Ka, F: false, G: "" };
|
|
const Ma = F("(?!\\b)[aeo]");
|
|
function Ka(a2) {
|
|
a2 && (a2 = Ha.call(this, a2, true), 1 < a2.length && (a2 = a2.replace(Ma, "")), 1 < a2.length && (a2 = ha(a2)), a2 && (a2 = a2.split(" ")));
|
|
return a2;
|
|
}
|
|
;
|
|
G["latin:default"] = ja;
|
|
G["latin:simple"] = Ba;
|
|
G["latin:balance"] = Ea;
|
|
G["latin:advanced"] = Ia;
|
|
G["latin:extra"] = La;
|
|
const W = self;
|
|
let Y;
|
|
const Z = { Index: K, Document: Q, Worker: O, registerCharset: function(a2, b2) {
|
|
G[a2] = b2;
|
|
}, registerLanguage: function(a2, b2) {
|
|
ka[a2] = b2;
|
|
} };
|
|
(Y = W.define) && Y.amd ? Y([], function() {
|
|
return Z;
|
|
}) : W.exports ? W.exports = Z : W.FlexSearch = Z;
|
|
})(exports);
|
|
}
|
|
});
|
|
|
|
// quartz/components/scripts/quartz/components/scripts/search.inline.ts
|
|
var import_flexsearch = __toESM(require_flexsearch_bundle());
|
|
|
|
// quartz/components/scripts/util.ts
|
|
function registerEscapeHandler(outsideContainer, cb) {
|
|
if (!outsideContainer)
|
|
return;
|
|
function click(e) {
|
|
if (e.target !== this)
|
|
return;
|
|
e.preventDefault();
|
|
cb();
|
|
}
|
|
function esc(e) {
|
|
if (!e.key.startsWith("Esc"))
|
|
return;
|
|
e.preventDefault();
|
|
cb();
|
|
}
|
|
outsideContainer?.removeEventListener("click", click);
|
|
outsideContainer?.addEventListener("click", click);
|
|
document.removeEventListener("keydown", esc);
|
|
document.addEventListener("keydown", esc);
|
|
}
|
|
function removeAllChildren(node) {
|
|
while (node.firstChild) {
|
|
node.removeChild(node.firstChild);
|
|
}
|
|
}
|
|
|
|
// node_modules/github-slugger/index.js
|
|
var own = Object.hasOwnProperty;
|
|
|
|
// quartz/util/path.ts
|
|
function simplifySlug(fp) {
|
|
return _stripSlashes(_trimSuffix(fp, "index"), true);
|
|
}
|
|
function pathToRoot(slug2) {
|
|
let rootPath = slug2.split("/").filter((x2) => x2 !== "").slice(0, -1).map((_) => "..").join("/");
|
|
if (rootPath.length === 0) {
|
|
rootPath = ".";
|
|
}
|
|
return rootPath;
|
|
}
|
|
function resolveRelative(current, target) {
|
|
const res = joinSegments(pathToRoot(current), simplifySlug(target));
|
|
return res;
|
|
}
|
|
function joinSegments(...args) {
|
|
return args.filter((segment) => segment !== "").join("/").replace(/\/\/+/g, "/");
|
|
}
|
|
function _endsWith(s, suffix) {
|
|
return s === suffix || s.endsWith("/" + suffix);
|
|
}
|
|
function _trimSuffix(s, suffix) {
|
|
if (_endsWith(s, suffix)) {
|
|
s = s.slice(0, -suffix.length);
|
|
}
|
|
return s;
|
|
}
|
|
function _stripSlashes(s, onlyStripPrefix) {
|
|
if (s.startsWith("/")) {
|
|
s = s.substring(1);
|
|
}
|
|
if (!onlyStripPrefix && s.endsWith("/")) {
|
|
s = s.slice(0, -1);
|
|
}
|
|
return s;
|
|
}
|
|
|
|
// quartz/components/scripts/quartz/components/scripts/search.inline.ts
|
|
var index = void 0;
|
|
var searchType = "basic";
|
|
var contextWindowWords = 30;
|
|
var numSearchResults = 5;
|
|
var numTagResults = 3;
|
|
function highlight(searchTerm, text, trim) {
|
|
const tokenizedTerms = searchTerm.split(/\s+/).filter((t2) => t2 !== "").sort((a2, b2) => b2.length - a2.length);
|
|
let tokenizedText = text.split(/\s+/).filter((t2) => t2 !== "");
|
|
let startIndex = 0;
|
|
let endIndex = tokenizedText.length - 1;
|
|
if (trim) {
|
|
const includesCheck = (tok) => tokenizedTerms.some((term) => tok.toLowerCase().startsWith(term.toLowerCase()));
|
|
const occurencesIndices = tokenizedText.map(includesCheck);
|
|
let bestSum = 0;
|
|
let bestIndex = 0;
|
|
for (let i = 0; i < Math.max(tokenizedText.length - contextWindowWords, 0); i++) {
|
|
const window2 = occurencesIndices.slice(i, i + contextWindowWords);
|
|
const windowSum = window2.reduce((total, cur) => total + (cur ? 1 : 0), 0);
|
|
if (windowSum >= bestSum) {
|
|
bestSum = windowSum;
|
|
bestIndex = i;
|
|
}
|
|
}
|
|
startIndex = Math.max(bestIndex - contextWindowWords, 0);
|
|
endIndex = Math.min(startIndex + 2 * contextWindowWords, tokenizedText.length - 1);
|
|
tokenizedText = tokenizedText.slice(startIndex, endIndex);
|
|
}
|
|
const slice = tokenizedText.map((tok) => {
|
|
for (const searchTok of tokenizedTerms) {
|
|
if (tok.toLowerCase().includes(searchTok.toLowerCase())) {
|
|
const regex2 = new RegExp(searchTok.toLowerCase(), "gi");
|
|
return tok.replace(regex2, `<span class="highlight">$&</span>`);
|
|
}
|
|
}
|
|
return tok;
|
|
}).join(" ");
|
|
return `${startIndex === 0 ? "" : "..."}${slice}${endIndex === tokenizedText.length - 1 ? "" : "..."}`;
|
|
}
|
|
var encoder = (str) => str.toLowerCase().split(/([^a-z]|[^\x00-\x7F])/);
|
|
var prevShortcutHandler = void 0;
|
|
document.addEventListener("nav", async (e) => {
|
|
const currentSlug = e.detail.url;
|
|
const data = await fetchData;
|
|
const container = document.getElementById("search-container");
|
|
const sidebar = container?.closest(".sidebar");
|
|
const searchIcon = document.getElementById("search-icon");
|
|
const searchBar = document.getElementById("search-bar");
|
|
const results = document.getElementById("results-container");
|
|
const resultCards = document.getElementsByClassName("result-card");
|
|
const idDataMap = Object.keys(data);
|
|
function hideSearch() {
|
|
container?.classList.remove("active");
|
|
if (searchBar) {
|
|
searchBar.value = "";
|
|
}
|
|
if (sidebar) {
|
|
sidebar.style.zIndex = "unset";
|
|
}
|
|
if (results) {
|
|
removeAllChildren(results);
|
|
}
|
|
searchType = "basic";
|
|
}
|
|
function showSearch(searchTypeNew) {
|
|
searchType = searchTypeNew;
|
|
if (sidebar) {
|
|
sidebar.style.zIndex = "1";
|
|
}
|
|
container?.classList.add("active");
|
|
searchBar?.focus();
|
|
}
|
|
function shortcutHandler(e2) {
|
|
if (e2.key === "k" && (e2.ctrlKey || e2.metaKey) && !e2.shiftKey) {
|
|
e2.preventDefault();
|
|
const searchBarOpen = container?.classList.contains("active");
|
|
searchBarOpen ? hideSearch() : showSearch("basic");
|
|
} else if (e2.shiftKey && (e2.ctrlKey || e2.metaKey) && e2.key.toLowerCase() === "k") {
|
|
e2.preventDefault();
|
|
const searchBarOpen = container?.classList.contains("active");
|
|
searchBarOpen ? hideSearch() : showSearch("tags");
|
|
if (searchBar)
|
|
searchBar.value = "#";
|
|
} else if (e2.key === "Enter") {
|
|
if (results?.contains(document.activeElement)) {
|
|
const active = document.activeElement;
|
|
active.click();
|
|
} else {
|
|
const anchor = document.getElementsByClassName("result-card")[0];
|
|
anchor?.click();
|
|
}
|
|
} else if (e2.key === "ArrowDown") {
|
|
e2.preventDefault();
|
|
if (!results?.contains(document.activeElement)) {
|
|
const firstResult = resultCards[0];
|
|
firstResult?.focus();
|
|
} else {
|
|
const nextResult = document.activeElement?.nextElementSibling;
|
|
nextResult?.focus();
|
|
}
|
|
} else if (e2.key === "ArrowUp") {
|
|
e2.preventDefault();
|
|
if (results?.contains(document.activeElement)) {
|
|
const prevResult = document.activeElement?.previousElementSibling;
|
|
prevResult?.focus();
|
|
}
|
|
}
|
|
}
|
|
function trimContent(content) {
|
|
const sentences = content.replace(/\s+/g, " ").split(".");
|
|
let finalDesc = "";
|
|
let sentenceIdx = 0;
|
|
const len = contextWindowWords * 5;
|
|
while (finalDesc.length < len) {
|
|
const sentence = sentences[sentenceIdx];
|
|
if (!sentence)
|
|
break;
|
|
finalDesc += sentence + ".";
|
|
sentenceIdx++;
|
|
}
|
|
if (finalDesc.length < content.length) {
|
|
finalDesc += "..";
|
|
}
|
|
return finalDesc;
|
|
}
|
|
const formatForDisplay = (term, id) => {
|
|
const slug2 = idDataMap[id];
|
|
return {
|
|
id,
|
|
slug: slug2,
|
|
title: searchType === "tags" ? data[slug2].title : highlight(term, data[slug2].title ?? ""),
|
|
// if searchType is tag, display context from start of file and trim, otherwise use regular highlight
|
|
content: searchType === "tags" ? trimContent(data[slug2].content) : highlight(term, data[slug2].content ?? "", true),
|
|
tags: highlightTags(term, data[slug2].tags)
|
|
};
|
|
};
|
|
function highlightTags(term, tags) {
|
|
if (tags && searchType === "tags") {
|
|
const termLower = term.toLowerCase();
|
|
let matching = tags.filter((str) => str.includes(termLower));
|
|
if (matching.length > 0) {
|
|
let difference = tags.filter((x2) => !matching.includes(x2));
|
|
matching = matching.map((tag) => `<li><p class="match-tag">#${tag}</p></li>`);
|
|
difference = difference.map((tag) => `<li><p>#${tag}</p></li>`);
|
|
matching.push(...difference);
|
|
}
|
|
if (tags.length > numTagResults) {
|
|
matching.splice(numTagResults);
|
|
}
|
|
return matching;
|
|
} else {
|
|
return [];
|
|
}
|
|
}
|
|
const resultToHTML = ({ slug: slug2, title, content, tags }) => {
|
|
const htmlTags = tags.length > 0 ? `<ul>${tags.join("")}</ul>` : ``;
|
|
const button = document.createElement("button");
|
|
button.classList.add("result-card");
|
|
button.id = slug2;
|
|
button.innerHTML = `<h3>${title}</h3>${htmlTags}<p>${content}</p>`;
|
|
button.addEventListener("click", () => {
|
|
const targ = resolveRelative(currentSlug, slug2);
|
|
window.spaNavigate(new URL(targ, window.location.toString()));
|
|
hideSearch();
|
|
});
|
|
return button;
|
|
};
|
|
function displayResults(finalResults) {
|
|
if (!results)
|
|
return;
|
|
removeAllChildren(results);
|
|
if (finalResults.length === 0) {
|
|
results.innerHTML = `<button class="result-card">
|
|
<h3>No results.</h3>
|
|
<p>Try another search term?</p>
|
|
</button>`;
|
|
} else {
|
|
results.append(...finalResults.map(resultToHTML));
|
|
}
|
|
}
|
|
async function onType(e2) {
|
|
let term = e2.target.value;
|
|
let searchResults;
|
|
if (term.toLowerCase().startsWith("#")) {
|
|
searchType = "tags";
|
|
} else {
|
|
searchType = "basic";
|
|
}
|
|
switch (searchType) {
|
|
case "tags": {
|
|
term = term.substring(1);
|
|
searchResults = await index?.searchAsync({ query: term, limit: numSearchResults, index: ["tags"] }) ?? [];
|
|
break;
|
|
}
|
|
case "basic":
|
|
default: {
|
|
searchResults = await index?.searchAsync({
|
|
query: term,
|
|
limit: numSearchResults,
|
|
index: ["title", "content"]
|
|
}) ?? [];
|
|
}
|
|
}
|
|
const getByField = (field) => {
|
|
const results2 = searchResults.filter((x2) => x2.field === field);
|
|
return results2.length === 0 ? [] : [...results2[0].result];
|
|
};
|
|
const allIds = /* @__PURE__ */ new Set([
|
|
...getByField("title"),
|
|
...getByField("content"),
|
|
...getByField("tags")
|
|
]);
|
|
const finalResults = [...allIds].map((id) => formatForDisplay(term, id));
|
|
displayResults(finalResults);
|
|
}
|
|
if (prevShortcutHandler) {
|
|
document.removeEventListener("keydown", prevShortcutHandler);
|
|
}
|
|
document.addEventListener("keydown", shortcutHandler);
|
|
prevShortcutHandler = shortcutHandler;
|
|
searchIcon?.removeEventListener("click", () => showSearch("basic"));
|
|
searchIcon?.addEventListener("click", () => showSearch("basic"));
|
|
searchBar?.removeEventListener("input", onType);
|
|
searchBar?.addEventListener("input", onType);
|
|
if (!index) {
|
|
index = new import_flexsearch.Document({
|
|
charset: "latin:extra",
|
|
optimize: true,
|
|
encode: encoder,
|
|
document: {
|
|
id: "id",
|
|
index: [
|
|
{
|
|
field: "title",
|
|
tokenize: "reverse"
|
|
},
|
|
{
|
|
field: "content",
|
|
tokenize: "reverse"
|
|
},
|
|
{
|
|
field: "tags",
|
|
tokenize: "reverse"
|
|
}
|
|
]
|
|
}
|
|
});
|
|
fillDocument(index, data);
|
|
}
|
|
registerEscapeHandler(container, hideSearch);
|
|
});
|
|
async function fillDocument(index2, data) {
|
|
let id = 0;
|
|
for (const [slug2, fileData] of Object.entries(data)) {
|
|
await index2.addAsync(id, {
|
|
id,
|
|
slug: slug2,
|
|
title: fileData.title,
|
|
content: fileData.content,
|
|
tags: fileData.tags
|
|
});
|
|
id++;
|
|
}
|
|
}
|
|
})();
|
|
(function () {// quartz/components/scripts/quartz/components/scripts/explorer.inline.ts
|
|
var explorerState;
|
|
var observer = new IntersectionObserver((entries) => {
|
|
const explorer = document.getElementById("explorer-ul");
|
|
for (const entry of entries) {
|
|
if (entry.isIntersecting) {
|
|
explorer?.classList.add("no-background");
|
|
} else {
|
|
explorer?.classList.remove("no-background");
|
|
}
|
|
}
|
|
});
|
|
function toggleExplorer() {
|
|
this.classList.toggle("collapsed");
|
|
const content = this.nextElementSibling;
|
|
content.classList.toggle("collapsed");
|
|
content.style.maxHeight = content.style.maxHeight === "0px" ? content.scrollHeight + "px" : "0px";
|
|
}
|
|
function toggleFolder(evt) {
|
|
evt.stopPropagation();
|
|
const target = evt.target;
|
|
const isSvg = target.nodeName === "svg";
|
|
let childFolderContainer;
|
|
let currentFolderParent;
|
|
if (isSvg) {
|
|
childFolderContainer = target.parentElement?.nextSibling;
|
|
currentFolderParent = target.nextElementSibling;
|
|
childFolderContainer.classList.toggle("open");
|
|
} else {
|
|
childFolderContainer = target.parentElement?.parentElement?.nextElementSibling;
|
|
currentFolderParent = target.parentElement;
|
|
childFolderContainer.classList.toggle("open");
|
|
}
|
|
if (!childFolderContainer)
|
|
return;
|
|
const isCollapsed = childFolderContainer.classList.contains("open");
|
|
setFolderState(childFolderContainer, !isCollapsed);
|
|
const clickFolderPath = currentFolderParent.dataset.folderpath;
|
|
const fullFolderPath = clickFolderPath.substring(1);
|
|
toggleCollapsedByPath(explorerState, fullFolderPath);
|
|
const stringifiedFileTree = JSON.stringify(explorerState);
|
|
localStorage.setItem("fileTree", stringifiedFileTree);
|
|
}
|
|
function setupExplorer() {
|
|
const explorer = document.getElementById("explorer");
|
|
const storageTree = localStorage.getItem("fileTree");
|
|
const useSavedFolderState = explorer?.dataset.savestate === "true";
|
|
if (explorer) {
|
|
const collapseBehavior = explorer.dataset.behavior;
|
|
if (collapseBehavior === "collapse") {
|
|
Array.prototype.forEach.call(
|
|
document.getElementsByClassName("folder-button"),
|
|
function(item) {
|
|
item.removeEventListener("click", toggleFolder);
|
|
item.addEventListener("click", toggleFolder);
|
|
}
|
|
);
|
|
}
|
|
explorer.removeEventListener("click", toggleExplorer);
|
|
explorer.addEventListener("click", toggleExplorer);
|
|
}
|
|
Array.prototype.forEach.call(document.getElementsByClassName("folder-icon"), function(item) {
|
|
item.removeEventListener("click", toggleFolder);
|
|
item.addEventListener("click", toggleFolder);
|
|
});
|
|
if (storageTree && useSavedFolderState) {
|
|
explorerState = JSON.parse(storageTree);
|
|
explorerState.map((folderUl) => {
|
|
const folderLi = document.querySelector(
|
|
`[data-folderpath='/${folderUl.path}']`
|
|
);
|
|
if (folderLi) {
|
|
const folderUL = folderLi.parentElement?.nextElementSibling;
|
|
if (folderUL) {
|
|
setFolderState(folderUL, folderUl.collapsed);
|
|
}
|
|
}
|
|
});
|
|
} else {
|
|
explorerState = JSON.parse(explorer?.dataset.tree);
|
|
}
|
|
}
|
|
window.addEventListener("resize", setupExplorer);
|
|
document.addEventListener("nav", () => {
|
|
setupExplorer();
|
|
const explorerContent = document.getElementById("explorer-ul");
|
|
const lastItem = document.getElementById("explorer-end");
|
|
observer.disconnect();
|
|
observer.observe(lastItem);
|
|
});
|
|
function setFolderState(folderElement, collapsed) {
|
|
if (collapsed) {
|
|
folderElement?.classList.remove("open");
|
|
} else {
|
|
folderElement?.classList.add("open");
|
|
}
|
|
}
|
|
function toggleCollapsedByPath(array, path) {
|
|
const entry = array.find((item) => item.path === path);
|
|
if (entry) {
|
|
entry.collapsed = !entry.collapsed;
|
|
}
|
|
}
|
|
})();
|
|
(function () {// node_modules/d3-dispatch/src/dispatch.js
|
|
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 name = "", i = t.indexOf(".");
|
|
if (i >= 0)
|
|
name = t.slice(i + 1), t = t.slice(0, i);
|
|
if (t && !types.hasOwnProperty(t))
|
|
throw new Error("unknown type: " + t);
|
|
return { type: t, name };
|
|
});
|
|
}
|
|
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, name) {
|
|
for (var i = 0, n = type2.length, c2; i < n; ++i) {
|
|
if ((c2 = type2[i]).name === name) {
|
|
return c2.value;
|
|
}
|
|
}
|
|
}
|
|
function set(type2, name, callback) {
|
|
for (var i = 0, n = type2.length; i < n; ++i) {
|
|
if (type2[i].name === name) {
|
|
type2[i] = noop, type2 = type2.slice(0, i).concat(type2.slice(i + 1));
|
|
break;
|
|
}
|
|
}
|
|
if (callback != null)
|
|
type2.push({ name, value: callback });
|
|
return type2;
|
|
}
|
|
var dispatch_default = dispatch;
|
|
|
|
// node_modules/d3-selection/src/namespaces.js
|
|
var xhtml = "http://www.w3.org/1999/xhtml";
|
|
var namespaces_default = {
|
|
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/"
|
|
};
|
|
|
|
// node_modules/d3-selection/src/namespace.js
|
|
function namespace_default(name) {
|
|
var prefix = name += "", i = prefix.indexOf(":");
|
|
if (i >= 0 && (prefix = name.slice(0, i)) !== "xmlns")
|
|
name = name.slice(i + 1);
|
|
return namespaces_default.hasOwnProperty(prefix) ? { space: namespaces_default[prefix], local: name } : name;
|
|
}
|
|
|
|
// node_modules/d3-selection/src/creator.js
|
|
function creatorInherit(name) {
|
|
return function() {
|
|
var document2 = this.ownerDocument, uri = this.namespaceURI;
|
|
return uri === xhtml && document2.documentElement.namespaceURI === xhtml ? document2.createElement(name) : document2.createElementNS(uri, name);
|
|
};
|
|
}
|
|
function creatorFixed(fullname) {
|
|
return function() {
|
|
return this.ownerDocument.createElementNS(fullname.space, fullname.local);
|
|
};
|
|
}
|
|
function creator_default(name) {
|
|
var fullname = namespace_default(name);
|
|
return (fullname.local ? creatorFixed : creatorInherit)(fullname);
|
|
}
|
|
|
|
// node_modules/d3-selection/src/selector.js
|
|
function none() {
|
|
}
|
|
function selector_default(selector) {
|
|
return selector == null ? none : function() {
|
|
return this.querySelector(selector);
|
|
};
|
|
}
|
|
|
|
// node_modules/d3-selection/src/selection/select.js
|
|
function select_default(select) {
|
|
if (typeof select !== "function")
|
|
select = selector_default(select);
|
|
for (var groups = this._groups, m2 = groups.length, subgroups = new Array(m2), j = 0; j < m2; ++j) {
|
|
for (var group = groups[j], n = group.length, subgroup = subgroups[j] = new Array(n), node, subnode, i = 0; i < n; ++i) {
|
|
if ((node = group[i]) && (subnode = select.call(node, node.__data__, i, group))) {
|
|
if ("__data__" in node)
|
|
subnode.__data__ = node.__data__;
|
|
subgroup[i] = subnode;
|
|
}
|
|
}
|
|
}
|
|
return new Selection(subgroups, this._parents);
|
|
}
|
|
|
|
// node_modules/d3-selection/src/array.js
|
|
function array(x2) {
|
|
return x2 == null ? [] : Array.isArray(x2) ? x2 : Array.from(x2);
|
|
}
|
|
|
|
// node_modules/d3-selection/src/selectorAll.js
|
|
function empty() {
|
|
return [];
|
|
}
|
|
function selectorAll_default(selector) {
|
|
return selector == null ? empty : function() {
|
|
return this.querySelectorAll(selector);
|
|
};
|
|
}
|
|
|
|
// node_modules/d3-selection/src/selection/selectAll.js
|
|
function arrayAll(select) {
|
|
return function() {
|
|
return array(select.apply(this, arguments));
|
|
};
|
|
}
|
|
function selectAll_default(select) {
|
|
if (typeof select === "function")
|
|
select = arrayAll(select);
|
|
else
|
|
select = selectorAll_default(select);
|
|
for (var groups = this._groups, m2 = groups.length, subgroups = [], parents = [], j = 0; j < m2; ++j) {
|
|
for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) {
|
|
if (node = group[i]) {
|
|
subgroups.push(select.call(node, node.__data__, i, group));
|
|
parents.push(node);
|
|
}
|
|
}
|
|
}
|
|
return new Selection(subgroups, parents);
|
|
}
|
|
|
|
// node_modules/d3-selection/src/matcher.js
|
|
function matcher_default(selector) {
|
|
return function() {
|
|
return this.matches(selector);
|
|
};
|
|
}
|
|
function childMatcher(selector) {
|
|
return function(node) {
|
|
return node.matches(selector);
|
|
};
|
|
}
|
|
|
|
// node_modules/d3-selection/src/selection/selectChild.js
|
|
var find = Array.prototype.find;
|
|
function childFind(match) {
|
|
return function() {
|
|
return find.call(this.children, match);
|
|
};
|
|
}
|
|
function childFirst() {
|
|
return this.firstElementChild;
|
|
}
|
|
function selectChild_default(match) {
|
|
return this.select(match == null ? childFirst : childFind(typeof match === "function" ? match : childMatcher(match)));
|
|
}
|
|
|
|
// node_modules/d3-selection/src/selection/selectChildren.js
|
|
var filter = Array.prototype.filter;
|
|
function children() {
|
|
return Array.from(this.children);
|
|
}
|
|
function childrenFilter(match) {
|
|
return function() {
|
|
return filter.call(this.children, match);
|
|
};
|
|
}
|
|
function selectChildren_default(match) {
|
|
return this.selectAll(match == null ? children : childrenFilter(typeof match === "function" ? match : childMatcher(match)));
|
|
}
|
|
|
|
// node_modules/d3-selection/src/selection/filter.js
|
|
function filter_default(match) {
|
|
if (typeof match !== "function")
|
|
match = matcher_default(match);
|
|
for (var groups = this._groups, m2 = groups.length, subgroups = new Array(m2), j = 0; j < m2; ++j) {
|
|
for (var group = groups[j], n = group.length, subgroup = subgroups[j] = [], node, i = 0; i < n; ++i) {
|
|
if ((node = group[i]) && match.call(node, node.__data__, i, group)) {
|
|
subgroup.push(node);
|
|
}
|
|
}
|
|
}
|
|
return new Selection(subgroups, this._parents);
|
|
}
|
|
|
|
// node_modules/d3-selection/src/selection/sparse.js
|
|
function sparse_default(update) {
|
|
return new Array(update.length);
|
|
}
|
|
|
|
// node_modules/d3-selection/src/selection/enter.js
|
|
function enter_default() {
|
|
return new Selection(this._enter || this._groups.map(sparse_default), this._parents);
|
|
}
|
|
function EnterNode(parent, datum2) {
|
|
this.ownerDocument = parent.ownerDocument;
|
|
this.namespaceURI = parent.namespaceURI;
|
|
this._next = null;
|
|
this._parent = parent;
|
|
this.__data__ = datum2;
|
|
}
|
|
EnterNode.prototype = {
|
|
constructor: EnterNode,
|
|
appendChild: function(child) {
|
|
return this._parent.insertBefore(child, this._next);
|
|
},
|
|
insertBefore: function(child, next) {
|
|
return this._parent.insertBefore(child, next);
|
|
},
|
|
querySelector: function(selector) {
|
|
return this._parent.querySelector(selector);
|
|
},
|
|
querySelectorAll: function(selector) {
|
|
return this._parent.querySelectorAll(selector);
|
|
}
|
|
};
|
|
|
|
// node_modules/d3-selection/src/constant.js
|
|
function constant_default(x2) {
|
|
return function() {
|
|
return x2;
|
|
};
|
|
}
|
|
|
|
// node_modules/d3-selection/src/selection/data.js
|
|
function bindIndex(parent, group, enter, update, exit, data) {
|
|
var i = 0, node, groupLength = group.length, dataLength = data.length;
|
|
for (; i < dataLength; ++i) {
|
|
if (node = group[i]) {
|
|
node.__data__ = data[i];
|
|
update[i] = node;
|
|
} else {
|
|
enter[i] = new EnterNode(parent, data[i]);
|
|
}
|
|
}
|
|
for (; i < groupLength; ++i) {
|
|
if (node = group[i]) {
|
|
exit[i] = node;
|
|
}
|
|
}
|
|
}
|
|
function bindKey(parent, group, enter, update, exit, data, key) {
|
|
var i, node, nodeByKeyValue = /* @__PURE__ */ new Map(), groupLength = group.length, dataLength = data.length, keyValues = new Array(groupLength), keyValue;
|
|
for (i = 0; i < groupLength; ++i) {
|
|
if (node = group[i]) {
|
|
keyValues[i] = keyValue = key.call(node, node.__data__, i, group) + "";
|
|
if (nodeByKeyValue.has(keyValue)) {
|
|
exit[i] = node;
|
|
} else {
|
|
nodeByKeyValue.set(keyValue, node);
|
|
}
|
|
}
|
|
}
|
|
for (i = 0; i < dataLength; ++i) {
|
|
keyValue = key.call(parent, data[i], i, data) + "";
|
|
if (node = nodeByKeyValue.get(keyValue)) {
|
|
update[i] = node;
|
|
node.__data__ = data[i];
|
|
nodeByKeyValue.delete(keyValue);
|
|
} else {
|
|
enter[i] = new EnterNode(parent, data[i]);
|
|
}
|
|
}
|
|
for (i = 0; i < groupLength; ++i) {
|
|
if ((node = group[i]) && nodeByKeyValue.get(keyValues[i]) === node) {
|
|
exit[i] = node;
|
|
}
|
|
}
|
|
}
|
|
function datum(node) {
|
|
return node.__data__;
|
|
}
|
|
function data_default(value, key) {
|
|
if (!arguments.length)
|
|
return Array.from(this, datum);
|
|
var bind = key ? bindKey : bindIndex, parents = this._parents, groups = this._groups;
|
|
if (typeof value !== "function")
|
|
value = constant_default(value);
|
|
for (var m2 = groups.length, update = new Array(m2), enter = new Array(m2), exit = new Array(m2), j = 0; j < m2; ++j) {
|
|
var parent = parents[j], group = groups[j], groupLength = group.length, data = arraylike(value.call(parent, parent && parent.__data__, j, parents)), dataLength = data.length, enterGroup = enter[j] = new Array(dataLength), updateGroup = update[j] = new Array(dataLength), exitGroup = exit[j] = new Array(groupLength);
|
|
bind(parent, group, enterGroup, updateGroup, exitGroup, data, key);
|
|
for (var i0 = 0, i1 = 0, previous, next; i0 < dataLength; ++i0) {
|
|
if (previous = enterGroup[i0]) {
|
|
if (i0 >= i1)
|
|
i1 = i0 + 1;
|
|
while (!(next = updateGroup[i1]) && ++i1 < dataLength)
|
|
;
|
|
previous._next = next || null;
|
|
}
|
|
}
|
|
}
|
|
update = new Selection(update, parents);
|
|
update._enter = enter;
|
|
update._exit = exit;
|
|
return update;
|
|
}
|
|
function arraylike(data) {
|
|
return typeof data === "object" && "length" in data ? data : Array.from(data);
|
|
}
|
|
|
|
// node_modules/d3-selection/src/selection/exit.js
|
|
function exit_default() {
|
|
return new Selection(this._exit || this._groups.map(sparse_default), this._parents);
|
|
}
|
|
|
|
// node_modules/d3-selection/src/selection/join.js
|
|
function join_default(onenter, onupdate, onexit) {
|
|
var enter = this.enter(), update = this, exit = this.exit();
|
|
if (typeof onenter === "function") {
|
|
enter = onenter(enter);
|
|
if (enter)
|
|
enter = enter.selection();
|
|
} else {
|
|
enter = enter.append(onenter + "");
|
|
}
|
|
if (onupdate != null) {
|
|
update = onupdate(update);
|
|
if (update)
|
|
update = update.selection();
|
|
}
|
|
if (onexit == null)
|
|
exit.remove();
|
|
else
|
|
onexit(exit);
|
|
return enter && update ? enter.merge(update).order() : update;
|
|
}
|
|
|
|
// node_modules/d3-selection/src/selection/merge.js
|
|
function merge_default(context) {
|
|
var selection2 = context.selection ? context.selection() : context;
|
|
for (var groups0 = this._groups, groups1 = selection2._groups, m0 = groups0.length, m1 = groups1.length, m2 = Math.min(m0, m1), merges = new Array(m0), j = 0; j < m2; ++j) {
|
|
for (var group0 = groups0[j], group1 = groups1[j], n = group0.length, merge = merges[j] = new Array(n), node, i = 0; i < n; ++i) {
|
|
if (node = group0[i] || group1[i]) {
|
|
merge[i] = node;
|
|
}
|
|
}
|
|
}
|
|
for (; j < m0; ++j) {
|
|
merges[j] = groups0[j];
|
|
}
|
|
return new Selection(merges, this._parents);
|
|
}
|
|
|
|
// node_modules/d3-selection/src/selection/order.js
|
|
function order_default() {
|
|
for (var groups = this._groups, j = -1, m2 = groups.length; ++j < m2; ) {
|
|
for (var group = groups[j], i = group.length - 1, next = group[i], node; --i >= 0; ) {
|
|
if (node = group[i]) {
|
|
if (next && node.compareDocumentPosition(next) ^ 4)
|
|
next.parentNode.insertBefore(node, next);
|
|
next = node;
|
|
}
|
|
}
|
|
}
|
|
return this;
|
|
}
|
|
|
|
// node_modules/d3-selection/src/selection/sort.js
|
|
function sort_default(compare) {
|
|
if (!compare)
|
|
compare = ascending;
|
|
function compareNode(a2, b) {
|
|
return a2 && b ? compare(a2.__data__, b.__data__) : !a2 - !b;
|
|
}
|
|
for (var groups = this._groups, m2 = groups.length, sortgroups = new Array(m2), j = 0; j < m2; ++j) {
|
|
for (var group = groups[j], n = group.length, sortgroup = sortgroups[j] = new Array(n), node, i = 0; i < n; ++i) {
|
|
if (node = group[i]) {
|
|
sortgroup[i] = node;
|
|
}
|
|
}
|
|
sortgroup.sort(compareNode);
|
|
}
|
|
return new Selection(sortgroups, this._parents).order();
|
|
}
|
|
function ascending(a2, b) {
|
|
return a2 < b ? -1 : a2 > b ? 1 : a2 >= b ? 0 : NaN;
|
|
}
|
|
|
|
// node_modules/d3-selection/src/selection/call.js
|
|
function call_default() {
|
|
var callback = arguments[0];
|
|
arguments[0] = this;
|
|
callback.apply(null, arguments);
|
|
return this;
|
|
}
|
|
|
|
// node_modules/d3-selection/src/selection/nodes.js
|
|
function nodes_default() {
|
|
return Array.from(this);
|
|
}
|
|
|
|
// node_modules/d3-selection/src/selection/node.js
|
|
function node_default() {
|
|
for (var groups = this._groups, j = 0, m2 = groups.length; j < m2; ++j) {
|
|
for (var group = groups[j], i = 0, n = group.length; i < n; ++i) {
|
|
var node = group[i];
|
|
if (node)
|
|
return node;
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
|
|
// node_modules/d3-selection/src/selection/size.js
|
|
function size_default() {
|
|
let size = 0;
|
|
for (const node of this)
|
|
++size;
|
|
return size;
|
|
}
|
|
|
|
// node_modules/d3-selection/src/selection/empty.js
|
|
function empty_default() {
|
|
return !this.node();
|
|
}
|
|
|
|
// node_modules/d3-selection/src/selection/each.js
|
|
function each_default(callback) {
|
|
for (var groups = this._groups, j = 0, m2 = groups.length; j < m2; ++j) {
|
|
for (var group = groups[j], i = 0, n = group.length, node; i < n; ++i) {
|
|
if (node = group[i])
|
|
callback.call(node, node.__data__, i, group);
|
|
}
|
|
}
|
|
return this;
|
|
}
|
|
|
|
// node_modules/d3-selection/src/selection/attr.js
|
|
function attrRemove(name) {
|
|
return function() {
|
|
this.removeAttribute(name);
|
|
};
|
|
}
|
|
function attrRemoveNS(fullname) {
|
|
return function() {
|
|
this.removeAttributeNS(fullname.space, fullname.local);
|
|
};
|
|
}
|
|
function attrConstant(name, value) {
|
|
return function() {
|
|
this.setAttribute(name, value);
|
|
};
|
|
}
|
|
function attrConstantNS(fullname, value) {
|
|
return function() {
|
|
this.setAttributeNS(fullname.space, fullname.local, value);
|
|
};
|
|
}
|
|
function attrFunction(name, value) {
|
|
return function() {
|
|
var v = value.apply(this, arguments);
|
|
if (v == null)
|
|
this.removeAttribute(name);
|
|
else
|
|
this.setAttribute(name, v);
|
|
};
|
|
}
|
|
function attrFunctionNS(fullname, value) {
|
|
return function() {
|
|
var v = value.apply(this, arguments);
|
|
if (v == null)
|
|
this.removeAttributeNS(fullname.space, fullname.local);
|
|
else
|
|
this.setAttributeNS(fullname.space, fullname.local, v);
|
|
};
|
|
}
|
|
function attr_default(name, value) {
|
|
var fullname = namespace_default(name);
|
|
if (arguments.length < 2) {
|
|
var node = this.node();
|
|
return fullname.local ? node.getAttributeNS(fullname.space, fullname.local) : node.getAttribute(fullname);
|
|
}
|
|
return this.each((value == null ? fullname.local ? attrRemoveNS : attrRemove : typeof value === "function" ? fullname.local ? attrFunctionNS : attrFunction : fullname.local ? attrConstantNS : attrConstant)(fullname, value));
|
|
}
|
|
|
|
// node_modules/d3-selection/src/window.js
|
|
function window_default(node) {
|
|
return node.ownerDocument && node.ownerDocument.defaultView || node.document && node || node.defaultView;
|
|
}
|
|
|
|
// node_modules/d3-selection/src/selection/style.js
|
|
function styleRemove(name) {
|
|
return function() {
|
|
this.style.removeProperty(name);
|
|
};
|
|
}
|
|
function styleConstant(name, value, priority) {
|
|
return function() {
|
|
this.style.setProperty(name, value, priority);
|
|
};
|
|
}
|
|
function styleFunction(name, value, priority) {
|
|
return function() {
|
|
var v = value.apply(this, arguments);
|
|
if (v == null)
|
|
this.style.removeProperty(name);
|
|
else
|
|
this.style.setProperty(name, v, priority);
|
|
};
|
|
}
|
|
function style_default(name, value, priority) {
|
|
return arguments.length > 1 ? this.each((value == null ? styleRemove : typeof value === "function" ? styleFunction : styleConstant)(name, value, priority == null ? "" : priority)) : styleValue(this.node(), name);
|
|
}
|
|
function styleValue(node, name) {
|
|
return node.style.getPropertyValue(name) || window_default(node).getComputedStyle(node, null).getPropertyValue(name);
|
|
}
|
|
|
|
// node_modules/d3-selection/src/selection/property.js
|
|
function propertyRemove(name) {
|
|
return function() {
|
|
delete this[name];
|
|
};
|
|
}
|
|
function propertyConstant(name, value) {
|
|
return function() {
|
|
this[name] = value;
|
|
};
|
|
}
|
|
function propertyFunction(name, value) {
|
|
return function() {
|
|
var v = value.apply(this, arguments);
|
|
if (v == null)
|
|
delete this[name];
|
|
else
|
|
this[name] = v;
|
|
};
|
|
}
|
|
function property_default(name, value) {
|
|
return arguments.length > 1 ? this.each((value == null ? propertyRemove : typeof value === "function" ? propertyFunction : propertyConstant)(name, value)) : this.node()[name];
|
|
}
|
|
|
|
// node_modules/d3-selection/src/selection/classed.js
|
|
function classArray(string) {
|
|
return string.trim().split(/^|\s+/);
|
|
}
|
|
function classList(node) {
|
|
return node.classList || new ClassList(node);
|
|
}
|
|
function ClassList(node) {
|
|
this._node = node;
|
|
this._names = classArray(node.getAttribute("class") || "");
|
|
}
|
|
ClassList.prototype = {
|
|
add: function(name) {
|
|
var i = this._names.indexOf(name);
|
|
if (i < 0) {
|
|
this._names.push(name);
|
|
this._node.setAttribute("class", this._names.join(" "));
|
|
}
|
|
},
|
|
remove: function(name) {
|
|
var i = this._names.indexOf(name);
|
|
if (i >= 0) {
|
|
this._names.splice(i, 1);
|
|
this._node.setAttribute("class", this._names.join(" "));
|
|
}
|
|
},
|
|
contains: function(name) {
|
|
return this._names.indexOf(name) >= 0;
|
|
}
|
|
};
|
|
function classedAdd(node, names) {
|
|
var list = classList(node), i = -1, n = names.length;
|
|
while (++i < n)
|
|
list.add(names[i]);
|
|
}
|
|
function classedRemove(node, names) {
|
|
var list = classList(node), i = -1, n = names.length;
|
|
while (++i < n)
|
|
list.remove(names[i]);
|
|
}
|
|
function classedTrue(names) {
|
|
return function() {
|
|
classedAdd(this, names);
|
|
};
|
|
}
|
|
function classedFalse(names) {
|
|
return function() {
|
|
classedRemove(this, names);
|
|
};
|
|
}
|
|
function classedFunction(names, value) {
|
|
return function() {
|
|
(value.apply(this, arguments) ? classedAdd : classedRemove)(this, names);
|
|
};
|
|
}
|
|
function classed_default(name, value) {
|
|
var names = classArray(name + "");
|
|
if (arguments.length < 2) {
|
|
var list = classList(this.node()), i = -1, n = names.length;
|
|
while (++i < n)
|
|
if (!list.contains(names[i]))
|
|
return false;
|
|
return true;
|
|
}
|
|
return this.each((typeof value === "function" ? classedFunction : value ? classedTrue : classedFalse)(names, value));
|
|
}
|
|
|
|
// node_modules/d3-selection/src/selection/text.js
|
|
function textRemove() {
|
|
this.textContent = "";
|
|
}
|
|
function textConstant(value) {
|
|
return function() {
|
|
this.textContent = value;
|
|
};
|
|
}
|
|
function textFunction(value) {
|
|
return function() {
|
|
var v = value.apply(this, arguments);
|
|
this.textContent = v == null ? "" : v;
|
|
};
|
|
}
|
|
function text_default(value) {
|
|
return arguments.length ? this.each(value == null ? textRemove : (typeof value === "function" ? textFunction : textConstant)(value)) : this.node().textContent;
|
|
}
|
|
|
|
// node_modules/d3-selection/src/selection/html.js
|
|
function htmlRemove() {
|
|
this.innerHTML = "";
|
|
}
|
|
function htmlConstant(value) {
|
|
return function() {
|
|
this.innerHTML = value;
|
|
};
|
|
}
|
|
function htmlFunction(value) {
|
|
return function() {
|
|
var v = value.apply(this, arguments);
|
|
this.innerHTML = v == null ? "" : v;
|
|
};
|
|
}
|
|
function html_default(value) {
|
|
return arguments.length ? this.each(value == null ? htmlRemove : (typeof value === "function" ? htmlFunction : htmlConstant)(value)) : this.node().innerHTML;
|
|
}
|
|
|
|
// node_modules/d3-selection/src/selection/raise.js
|
|
function raise() {
|
|
if (this.nextSibling)
|
|
this.parentNode.appendChild(this);
|
|
}
|
|
function raise_default() {
|
|
return this.each(raise);
|
|
}
|
|
|
|
// node_modules/d3-selection/src/selection/lower.js
|
|
function lower() {
|
|
if (this.previousSibling)
|
|
this.parentNode.insertBefore(this, this.parentNode.firstChild);
|
|
}
|
|
function lower_default() {
|
|
return this.each(lower);
|
|
}
|
|
|
|
// node_modules/d3-selection/src/selection/append.js
|
|
function append_default(name) {
|
|
var create2 = typeof name === "function" ? name : creator_default(name);
|
|
return this.select(function() {
|
|
return this.appendChild(create2.apply(this, arguments));
|
|
});
|
|
}
|
|
|
|
// node_modules/d3-selection/src/selection/insert.js
|
|
function constantNull() {
|
|
return null;
|
|
}
|
|
function insert_default(name, before) {
|
|
var create2 = typeof name === "function" ? name : creator_default(name), select = before == null ? constantNull : typeof before === "function" ? before : selector_default(before);
|
|
return this.select(function() {
|
|
return this.insertBefore(create2.apply(this, arguments), select.apply(this, arguments) || null);
|
|
});
|
|
}
|
|
|
|
// node_modules/d3-selection/src/selection/remove.js
|
|
function remove() {
|
|
var parent = this.parentNode;
|
|
if (parent)
|
|
parent.removeChild(this);
|
|
}
|
|
function remove_default() {
|
|
return this.each(remove);
|
|
}
|
|
|
|
// node_modules/d3-selection/src/selection/clone.js
|
|
function selection_cloneShallow() {
|
|
var clone = this.cloneNode(false), parent = this.parentNode;
|
|
return parent ? parent.insertBefore(clone, this.nextSibling) : clone;
|
|
}
|
|
function selection_cloneDeep() {
|
|
var clone = this.cloneNode(true), parent = this.parentNode;
|
|
return parent ? parent.insertBefore(clone, this.nextSibling) : clone;
|
|
}
|
|
function clone_default(deep) {
|
|
return this.select(deep ? selection_cloneDeep : selection_cloneShallow);
|
|
}
|
|
|
|
// node_modules/d3-selection/src/selection/datum.js
|
|
function datum_default(value) {
|
|
return arguments.length ? this.property("__data__", value) : this.node().__data__;
|
|
}
|
|
|
|
// node_modules/d3-selection/src/selection/on.js
|
|
function contextListener(listener) {
|
|
return function(event) {
|
|
listener.call(this, event, this.__data__);
|
|
};
|
|
}
|
|
function parseTypenames2(typenames) {
|
|
return typenames.trim().split(/^|\s+/).map(function(t) {
|
|
var name = "", i = t.indexOf(".");
|
|
if (i >= 0)
|
|
name = t.slice(i + 1), t = t.slice(0, i);
|
|
return { type: t, name };
|
|
});
|
|
}
|
|
function onRemove(typename) {
|
|
return function() {
|
|
var on = this.__on;
|
|
if (!on)
|
|
return;
|
|
for (var j = 0, i = -1, m2 = on.length, o; j < m2; ++j) {
|
|
if (o = on[j], (!typename.type || o.type === typename.type) && o.name === typename.name) {
|
|
this.removeEventListener(o.type, o.listener, o.options);
|
|
} else {
|
|
on[++i] = o;
|
|
}
|
|
}
|
|
if (++i)
|
|
on.length = i;
|
|
else
|
|
delete this.__on;
|
|
};
|
|
}
|
|
function onAdd(typename, value, options) {
|
|
return function() {
|
|
var on = this.__on, o, listener = contextListener(value);
|
|
if (on)
|
|
for (var j = 0, m2 = on.length; j < m2; ++j) {
|
|
if ((o = on[j]).type === typename.type && o.name === typename.name) {
|
|
this.removeEventListener(o.type, o.listener, o.options);
|
|
this.addEventListener(o.type, o.listener = listener, o.options = options);
|
|
o.value = value;
|
|
return;
|
|
}
|
|
}
|
|
this.addEventListener(typename.type, listener, options);
|
|
o = { type: typename.type, name: typename.name, value, listener, options };
|
|
if (!on)
|
|
this.__on = [o];
|
|
else
|
|
on.push(o);
|
|
};
|
|
}
|
|
function on_default(typename, value, options) {
|
|
var typenames = parseTypenames2(typename + ""), i, n = typenames.length, t;
|
|
if (arguments.length < 2) {
|
|
var on = this.node().__on;
|
|
if (on)
|
|
for (var j = 0, m2 = on.length, o; j < m2; ++j) {
|
|
for (i = 0, o = on[j]; i < n; ++i) {
|
|
if ((t = typenames[i]).type === o.type && t.name === o.name) {
|
|
return o.value;
|
|
}
|
|
}
|
|
}
|
|
return;
|
|
}
|
|
on = value ? onAdd : onRemove;
|
|
for (i = 0; i < n; ++i)
|
|
this.each(on(typenames[i], value, options));
|
|
return this;
|
|
}
|
|
|
|
// node_modules/d3-selection/src/selection/dispatch.js
|
|
function dispatchEvent(node, type2, params) {
|
|
var window2 = window_default(node), event = window2.CustomEvent;
|
|
if (typeof event === "function") {
|
|
event = new event(type2, params);
|
|
} else {
|
|
event = window2.document.createEvent("Event");
|
|
if (params)
|
|
event.initEvent(type2, params.bubbles, params.cancelable), event.detail = params.detail;
|
|
else
|
|
event.initEvent(type2, false, false);
|
|
}
|
|
node.dispatchEvent(event);
|
|
}
|
|
function dispatchConstant(type2, params) {
|
|
return function() {
|
|
return dispatchEvent(this, type2, params);
|
|
};
|
|
}
|
|
function dispatchFunction(type2, params) {
|
|
return function() {
|
|
return dispatchEvent(this, type2, params.apply(this, arguments));
|
|
};
|
|
}
|
|
function dispatch_default2(type2, params) {
|
|
return this.each((typeof params === "function" ? dispatchFunction : dispatchConstant)(type2, params));
|
|
}
|
|
|
|
// node_modules/d3-selection/src/selection/iterator.js
|
|
function* iterator_default() {
|
|
for (var groups = this._groups, j = 0, m2 = groups.length; j < m2; ++j) {
|
|
for (var group = groups[j], i = 0, n = group.length, node; i < n; ++i) {
|
|
if (node = group[i])
|
|
yield node;
|
|
}
|
|
}
|
|
}
|
|
|
|
// node_modules/d3-selection/src/selection/index.js
|
|
var root = [null];
|
|
function Selection(groups, parents) {
|
|
this._groups = groups;
|
|
this._parents = parents;
|
|
}
|
|
function selection() {
|
|
return new Selection([[document.documentElement]], root);
|
|
}
|
|
function selection_selection() {
|
|
return this;
|
|
}
|
|
Selection.prototype = selection.prototype = {
|
|
constructor: Selection,
|
|
select: select_default,
|
|
selectAll: selectAll_default,
|
|
selectChild: selectChild_default,
|
|
selectChildren: selectChildren_default,
|
|
filter: filter_default,
|
|
data: data_default,
|
|
enter: enter_default,
|
|
exit: exit_default,
|
|
join: join_default,
|
|
merge: merge_default,
|
|
selection: selection_selection,
|
|
order: order_default,
|
|
sort: sort_default,
|
|
call: call_default,
|
|
nodes: nodes_default,
|
|
node: node_default,
|
|
size: size_default,
|
|
empty: empty_default,
|
|
each: each_default,
|
|
attr: attr_default,
|
|
style: style_default,
|
|
property: property_default,
|
|
classed: classed_default,
|
|
text: text_default,
|
|
html: html_default,
|
|
raise: raise_default,
|
|
lower: lower_default,
|
|
append: append_default,
|
|
insert: insert_default,
|
|
remove: remove_default,
|
|
clone: clone_default,
|
|
datum: datum_default,
|
|
on: on_default,
|
|
dispatch: dispatch_default2,
|
|
[Symbol.iterator]: iterator_default
|
|
};
|
|
var selection_default = selection;
|
|
|
|
// node_modules/d3-selection/src/select.js
|
|
function select_default2(selector) {
|
|
return typeof selector === "string" ? new Selection([[document.querySelector(selector)]], [document.documentElement]) : new Selection([[selector]], root);
|
|
}
|
|
|
|
// node_modules/d3-selection/src/sourceEvent.js
|
|
function sourceEvent_default(event) {
|
|
let sourceEvent;
|
|
while (sourceEvent = event.sourceEvent)
|
|
event = sourceEvent;
|
|
return event;
|
|
}
|
|
|
|
// node_modules/d3-selection/src/pointer.js
|
|
function pointer_default(event, node) {
|
|
event = sourceEvent_default(event);
|
|
if (node === void 0)
|
|
node = event.currentTarget;
|
|
if (node) {
|
|
var svg = node.ownerSVGElement || node;
|
|
if (svg.createSVGPoint) {
|
|
var point = svg.createSVGPoint();
|
|
point.x = event.clientX, point.y = event.clientY;
|
|
point = point.matrixTransform(node.getScreenCTM().inverse());
|
|
return [point.x, point.y];
|
|
}
|
|
if (node.getBoundingClientRect) {
|
|
var rect = node.getBoundingClientRect();
|
|
return [event.clientX - rect.left - node.clientLeft, event.clientY - rect.top - node.clientTop];
|
|
}
|
|
}
|
|
return [event.pageX, event.pageY];
|
|
}
|
|
|
|
// node_modules/d3-selection/src/selectAll.js
|
|
function selectAll_default2(selector) {
|
|
return typeof selector === "string" ? new Selection([document.querySelectorAll(selector)], [document.documentElement]) : new Selection([array(selector)], root);
|
|
}
|
|
|
|
// node_modules/d3-drag/src/noevent.js
|
|
var nonpassive = { passive: false };
|
|
var nonpassivecapture = { capture: true, passive: false };
|
|
function nopropagation(event) {
|
|
event.stopImmediatePropagation();
|
|
}
|
|
function noevent_default(event) {
|
|
event.preventDefault();
|
|
event.stopImmediatePropagation();
|
|
}
|
|
|
|
// node_modules/d3-drag/src/nodrag.js
|
|
function nodrag_default(view) {
|
|
var root2 = view.document.documentElement, selection2 = select_default2(view).on("dragstart.drag", noevent_default, nonpassivecapture);
|
|
if ("onselectstart" in root2) {
|
|
selection2.on("selectstart.drag", noevent_default, nonpassivecapture);
|
|
} else {
|
|
root2.__noselect = root2.style.MozUserSelect;
|
|
root2.style.MozUserSelect = "none";
|
|
}
|
|
}
|
|
function yesdrag(view, noclick) {
|
|
var root2 = view.document.documentElement, selection2 = select_default2(view).on("dragstart.drag", null);
|
|
if (noclick) {
|
|
selection2.on("click.drag", noevent_default, nonpassivecapture);
|
|
setTimeout(function() {
|
|
selection2.on("click.drag", null);
|
|
}, 0);
|
|
}
|
|
if ("onselectstart" in root2) {
|
|
selection2.on("selectstart.drag", null);
|
|
} else {
|
|
root2.style.MozUserSelect = root2.__noselect;
|
|
delete root2.__noselect;
|
|
}
|
|
}
|
|
|
|
// node_modules/d3-drag/src/constant.js
|
|
var constant_default2 = (x2) => () => x2;
|
|
|
|
// node_modules/d3-drag/src/event.js
|
|
function DragEvent(type2, {
|
|
sourceEvent,
|
|
subject,
|
|
target,
|
|
identifier,
|
|
active,
|
|
x: x2,
|
|
y: y2,
|
|
dx,
|
|
dy,
|
|
dispatch: dispatch2
|
|
}) {
|
|
Object.defineProperties(this, {
|
|
type: { value: type2, enumerable: true, configurable: true },
|
|
sourceEvent: { value: sourceEvent, enumerable: true, configurable: true },
|
|
subject: { value: subject, enumerable: true, configurable: true },
|
|
target: { value: target, enumerable: true, configurable: true },
|
|
identifier: { value: identifier, enumerable: true, configurable: true },
|
|
active: { value: active, enumerable: true, configurable: true },
|
|
x: { value: x2, enumerable: true, configurable: true },
|
|
y: { value: y2, enumerable: true, configurable: true },
|
|
dx: { value: dx, enumerable: true, configurable: true },
|
|
dy: { value: dy, enumerable: true, configurable: true },
|
|
_: { value: dispatch2 }
|
|
});
|
|
}
|
|
DragEvent.prototype.on = function() {
|
|
var value = this._.on.apply(this._, arguments);
|
|
return value === this._ ? this : value;
|
|
};
|
|
|
|
// node_modules/d3-drag/src/drag.js
|
|
function defaultFilter(event) {
|
|
return !event.ctrlKey && !event.button;
|
|
}
|
|
function defaultContainer() {
|
|
return this.parentNode;
|
|
}
|
|
function defaultSubject(event, d) {
|
|
return d == null ? { x: event.x, y: event.y } : d;
|
|
}
|
|
function defaultTouchable() {
|
|
return navigator.maxTouchPoints || "ontouchstart" in this;
|
|
}
|
|
function drag_default() {
|
|
var filter2 = defaultFilter, container = defaultContainer, subject = defaultSubject, touchable = defaultTouchable, gestures = {}, listeners = dispatch_default("start", "drag", "end"), active = 0, mousedownx, mousedowny, mousemoving, touchending, clickDistance2 = 0;
|
|
function drag(selection2) {
|
|
selection2.on("mousedown.drag", mousedowned).filter(touchable).on("touchstart.drag", touchstarted).on("touchmove.drag", touchmoved, nonpassive).on("touchend.drag touchcancel.drag", touchended).style("touch-action", "none").style("-webkit-tap-highlight-color", "rgba(0,0,0,0)");
|
|
}
|
|
function mousedowned(event, d) {
|
|
if (touchending || !filter2.call(this, event, d))
|
|
return;
|
|
var gesture = beforestart(this, container.call(this, event, d), event, d, "mouse");
|
|
if (!gesture)
|
|
return;
|
|
select_default2(event.view).on("mousemove.drag", mousemoved, nonpassivecapture).on("mouseup.drag", mouseupped, nonpassivecapture);
|
|
nodrag_default(event.view);
|
|
nopropagation(event);
|
|
mousemoving = false;
|
|
mousedownx = event.clientX;
|
|
mousedowny = event.clientY;
|
|
gesture("start", event);
|
|
}
|
|
function mousemoved(event) {
|
|
noevent_default(event);
|
|
if (!mousemoving) {
|
|
var dx = event.clientX - mousedownx, dy = event.clientY - mousedowny;
|
|
mousemoving = dx * dx + dy * dy > clickDistance2;
|
|
}
|
|
gestures.mouse("drag", event);
|
|
}
|
|
function mouseupped(event) {
|
|
select_default2(event.view).on("mousemove.drag mouseup.drag", null);
|
|
yesdrag(event.view, mousemoving);
|
|
noevent_default(event);
|
|
gestures.mouse("end", event);
|
|
}
|
|
function touchstarted(event, d) {
|
|
if (!filter2.call(this, event, d))
|
|
return;
|
|
var touches = event.changedTouches, c2 = container.call(this, event, d), n = touches.length, i, gesture;
|
|
for (i = 0; i < n; ++i) {
|
|
if (gesture = beforestart(this, c2, event, d, touches[i].identifier, touches[i])) {
|
|
nopropagation(event);
|
|
gesture("start", event, touches[i]);
|
|
}
|
|
}
|
|
}
|
|
function touchmoved(event) {
|
|
var touches = event.changedTouches, n = touches.length, i, gesture;
|
|
for (i = 0; i < n; ++i) {
|
|
if (gesture = gestures[touches[i].identifier]) {
|
|
noevent_default(event);
|
|
gesture("drag", event, touches[i]);
|
|
}
|
|
}
|
|
}
|
|
function touchended(event) {
|
|
var touches = event.changedTouches, n = touches.length, i, gesture;
|
|
if (touchending)
|
|
clearTimeout(touchending);
|
|
touchending = setTimeout(function() {
|
|
touchending = null;
|
|
}, 500);
|
|
for (i = 0; i < n; ++i) {
|
|
if (gesture = gestures[touches[i].identifier]) {
|
|
nopropagation(event);
|
|
gesture("end", event, touches[i]);
|
|
}
|
|
}
|
|
}
|
|
function beforestart(that, container2, event, d, identifier, touch) {
|
|
var dispatch2 = listeners.copy(), p = pointer_default(touch || event, container2), dx, dy, s;
|
|
if ((s = subject.call(that, new DragEvent("beforestart", {
|
|
sourceEvent: event,
|
|
target: drag,
|
|
identifier,
|
|
active,
|
|
x: p[0],
|
|
y: p[1],
|
|
dx: 0,
|
|
dy: 0,
|
|
dispatch: dispatch2
|
|
}), d)) == null)
|
|
return;
|
|
dx = s.x - p[0] || 0;
|
|
dy = s.y - p[1] || 0;
|
|
return function gesture(type2, event2, touch2) {
|
|
var p0 = p, n;
|
|
switch (type2) {
|
|
case "start":
|
|
gestures[identifier] = gesture, n = active++;
|
|
break;
|
|
case "end":
|
|
delete gestures[identifier], --active;
|
|
case "drag":
|
|
p = pointer_default(touch2 || event2, container2), n = active;
|
|
break;
|
|
}
|
|
dispatch2.call(
|
|
type2,
|
|
that,
|
|
new DragEvent(type2, {
|
|
sourceEvent: event2,
|
|
subject: s,
|
|
target: drag,
|
|
identifier,
|
|
active: n,
|
|
x: p[0] + dx,
|
|
y: p[1] + dy,
|
|
dx: p[0] - p0[0],
|
|
dy: p[1] - p0[1],
|
|
dispatch: dispatch2
|
|
}),
|
|
d
|
|
);
|
|
};
|
|
}
|
|
drag.filter = function(_) {
|
|
return arguments.length ? (filter2 = typeof _ === "function" ? _ : constant_default2(!!_), drag) : filter2;
|
|
};
|
|
drag.container = function(_) {
|
|
return arguments.length ? (container = typeof _ === "function" ? _ : constant_default2(_), drag) : container;
|
|
};
|
|
drag.subject = function(_) {
|
|
return arguments.length ? (subject = typeof _ === "function" ? _ : constant_default2(_), drag) : subject;
|
|
};
|
|
drag.touchable = function(_) {
|
|
return arguments.length ? (touchable = typeof _ === "function" ? _ : constant_default2(!!_), drag) : touchable;
|
|
};
|
|
drag.on = function() {
|
|
var value = listeners.on.apply(listeners, arguments);
|
|
return value === listeners ? drag : value;
|
|
};
|
|
drag.clickDistance = function(_) {
|
|
return arguments.length ? (clickDistance2 = (_ = +_) * _, drag) : Math.sqrt(clickDistance2);
|
|
};
|
|
return drag;
|
|
}
|
|
|
|
// node_modules/d3-color/src/define.js
|
|
function define_default(constructor, factory, prototype) {
|
|
constructor.prototype = factory.prototype = prototype;
|
|
prototype.constructor = constructor;
|
|
}
|
|
function extend(parent, definition) {
|
|
var prototype = Object.create(parent.prototype);
|
|
for (var key in definition)
|
|
prototype[key] = definition[key];
|
|
return prototype;
|
|
}
|
|
|
|
// node_modules/d3-color/src/color.js
|
|
function Color() {
|
|
}
|
|
var darker = 0.7;
|
|
var brighter = 1 / darker;
|
|
var reI = "\\s*([+-]?\\d+)\\s*";
|
|
var reN = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*";
|
|
var reP = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*";
|
|
var reHex = /^#([0-9a-f]{3,8})$/;
|
|
var reRgbInteger = new RegExp(`^rgb\\(${reI},${reI},${reI}\\)$`);
|
|
var reRgbPercent = new RegExp(`^rgb\\(${reP},${reP},${reP}\\)$`);
|
|
var reRgbaInteger = new RegExp(`^rgba\\(${reI},${reI},${reI},${reN}\\)$`);
|
|
var reRgbaPercent = new RegExp(`^rgba\\(${reP},${reP},${reP},${reN}\\)$`);
|
|
var reHslPercent = new RegExp(`^hsl\\(${reN},${reP},${reP}\\)$`);
|
|
var reHslaPercent = new RegExp(`^hsla\\(${reN},${reP},${reP},${reN}\\)$`);
|
|
var named = {
|
|
aliceblue: 15792383,
|
|
antiquewhite: 16444375,
|
|
aqua: 65535,
|
|
aquamarine: 8388564,
|
|
azure: 15794175,
|
|
beige: 16119260,
|
|
bisque: 16770244,
|
|
black: 0,
|
|
blanchedalmond: 16772045,
|
|
blue: 255,
|
|
blueviolet: 9055202,
|
|
brown: 10824234,
|
|
burlywood: 14596231,
|
|
cadetblue: 6266528,
|
|
chartreuse: 8388352,
|
|
chocolate: 13789470,
|
|
coral: 16744272,
|
|
cornflowerblue: 6591981,
|
|
cornsilk: 16775388,
|
|
crimson: 14423100,
|
|
cyan: 65535,
|
|
darkblue: 139,
|
|
darkcyan: 35723,
|
|
darkgoldenrod: 12092939,
|
|
darkgray: 11119017,
|
|
darkgreen: 25600,
|
|
darkgrey: 11119017,
|
|
darkkhaki: 12433259,
|
|
darkmagenta: 9109643,
|
|
darkolivegreen: 5597999,
|
|
darkorange: 16747520,
|
|
darkorchid: 10040012,
|
|
darkred: 9109504,
|
|
darksalmon: 15308410,
|
|
darkseagreen: 9419919,
|
|
darkslateblue: 4734347,
|
|
darkslategray: 3100495,
|
|
darkslategrey: 3100495,
|
|
darkturquoise: 52945,
|
|
darkviolet: 9699539,
|
|
deeppink: 16716947,
|
|
deepskyblue: 49151,
|
|
dimgray: 6908265,
|
|
dimgrey: 6908265,
|
|
dodgerblue: 2003199,
|
|
firebrick: 11674146,
|
|
floralwhite: 16775920,
|
|
forestgreen: 2263842,
|
|
fuchsia: 16711935,
|
|
gainsboro: 14474460,
|
|
ghostwhite: 16316671,
|
|
gold: 16766720,
|
|
goldenrod: 14329120,
|
|
gray: 8421504,
|
|
green: 32768,
|
|
greenyellow: 11403055,
|
|
grey: 8421504,
|
|
honeydew: 15794160,
|
|
hotpink: 16738740,
|
|
indianred: 13458524,
|
|
indigo: 4915330,
|
|
ivory: 16777200,
|
|
khaki: 15787660,
|
|
lavender: 15132410,
|
|
lavenderblush: 16773365,
|
|
lawngreen: 8190976,
|
|
lemonchiffon: 16775885,
|
|
lightblue: 11393254,
|
|
lightcoral: 15761536,
|
|
lightcyan: 14745599,
|
|
lightgoldenrodyellow: 16448210,
|
|
lightgray: 13882323,
|
|
lightgreen: 9498256,
|
|
lightgrey: 13882323,
|
|
lightpink: 16758465,
|
|
lightsalmon: 16752762,
|
|
lightseagreen: 2142890,
|
|
lightskyblue: 8900346,
|
|
lightslategray: 7833753,
|
|
lightslategrey: 7833753,
|
|
lightsteelblue: 11584734,
|
|
lightyellow: 16777184,
|
|
lime: 65280,
|
|
limegreen: 3329330,
|
|
linen: 16445670,
|
|
magenta: 16711935,
|
|
maroon: 8388608,
|
|
mediumaquamarine: 6737322,
|
|
mediumblue: 205,
|
|
mediumorchid: 12211667,
|
|
mediumpurple: 9662683,
|
|
mediumseagreen: 3978097,
|
|
mediumslateblue: 8087790,
|
|
mediumspringgreen: 64154,
|
|
mediumturquoise: 4772300,
|
|
mediumvioletred: 13047173,
|
|
midnightblue: 1644912,
|
|
mintcream: 16121850,
|
|
mistyrose: 16770273,
|
|
moccasin: 16770229,
|
|
navajowhite: 16768685,
|
|
navy: 128,
|
|
oldlace: 16643558,
|
|
olive: 8421376,
|
|
olivedrab: 7048739,
|
|
orange: 16753920,
|
|
orangered: 16729344,
|
|
orchid: 14315734,
|
|
palegoldenrod: 15657130,
|
|
palegreen: 10025880,
|
|
paleturquoise: 11529966,
|
|
palevioletred: 14381203,
|
|
papayawhip: 16773077,
|
|
peachpuff: 16767673,
|
|
peru: 13468991,
|
|
pink: 16761035,
|
|
plum: 14524637,
|
|
powderblue: 11591910,
|
|
purple: 8388736,
|
|
rebeccapurple: 6697881,
|
|
red: 16711680,
|
|
rosybrown: 12357519,
|
|
royalblue: 4286945,
|
|
saddlebrown: 9127187,
|
|
salmon: 16416882,
|
|
sandybrown: 16032864,
|
|
seagreen: 3050327,
|
|
seashell: 16774638,
|
|
sienna: 10506797,
|
|
silver: 12632256,
|
|
skyblue: 8900331,
|
|
slateblue: 6970061,
|
|
slategray: 7372944,
|
|
slategrey: 7372944,
|
|
snow: 16775930,
|
|
springgreen: 65407,
|
|
steelblue: 4620980,
|
|
tan: 13808780,
|
|
teal: 32896,
|
|
thistle: 14204888,
|
|
tomato: 16737095,
|
|
turquoise: 4251856,
|
|
violet: 15631086,
|
|
wheat: 16113331,
|
|
white: 16777215,
|
|
whitesmoke: 16119285,
|
|
yellow: 16776960,
|
|
yellowgreen: 10145074
|
|
};
|
|
define_default(Color, color, {
|
|
copy(channels) {
|
|
return Object.assign(new this.constructor(), this, channels);
|
|
},
|
|
displayable() {
|
|
return this.rgb().displayable();
|
|
},
|
|
hex: color_formatHex,
|
|
// Deprecated! Use color.formatHex.
|
|
formatHex: color_formatHex,
|
|
formatHex8: color_formatHex8,
|
|
formatHsl: color_formatHsl,
|
|
formatRgb: color_formatRgb,
|
|
toString: color_formatRgb
|
|
});
|
|
function color_formatHex() {
|
|
return this.rgb().formatHex();
|
|
}
|
|
function color_formatHex8() {
|
|
return this.rgb().formatHex8();
|
|
}
|
|
function color_formatHsl() {
|
|
return hslConvert(this).formatHsl();
|
|
}
|
|
function color_formatRgb() {
|
|
return this.rgb().formatRgb();
|
|
}
|
|
function color(format) {
|
|
var m2, l;
|
|
format = (format + "").trim().toLowerCase();
|
|
return (m2 = reHex.exec(format)) ? (l = m2[1].length, m2 = parseInt(m2[1], 16), l === 6 ? rgbn(m2) : l === 3 ? new Rgb(m2 >> 8 & 15 | m2 >> 4 & 240, m2 >> 4 & 15 | m2 & 240, (m2 & 15) << 4 | m2 & 15, 1) : l === 8 ? rgba(m2 >> 24 & 255, m2 >> 16 & 255, m2 >> 8 & 255, (m2 & 255) / 255) : l === 4 ? rgba(m2 >> 12 & 15 | m2 >> 8 & 240, m2 >> 8 & 15 | m2 >> 4 & 240, m2 >> 4 & 15 | m2 & 240, ((m2 & 15) << 4 | m2 & 15) / 255) : null) : (m2 = reRgbInteger.exec(format)) ? new Rgb(m2[1], m2[2], m2[3], 1) : (m2 = reRgbPercent.exec(format)) ? new Rgb(m2[1] * 255 / 100, m2[2] * 255 / 100, m2[3] * 255 / 100, 1) : (m2 = reRgbaInteger.exec(format)) ? rgba(m2[1], m2[2], m2[3], m2[4]) : (m2 = reRgbaPercent.exec(format)) ? rgba(m2[1] * 255 / 100, m2[2] * 255 / 100, m2[3] * 255 / 100, m2[4]) : (m2 = reHslPercent.exec(format)) ? hsla(m2[1], m2[2] / 100, m2[3] / 100, 1) : (m2 = reHslaPercent.exec(format)) ? hsla(m2[1], m2[2] / 100, m2[3] / 100, m2[4]) : named.hasOwnProperty(format) ? rgbn(named[format]) : format === "transparent" ? new Rgb(NaN, NaN, NaN, 0) : null;
|
|
}
|
|
function rgbn(n) {
|
|
return new Rgb(n >> 16 & 255, n >> 8 & 255, n & 255, 1);
|
|
}
|
|
function rgba(r, g, b, a2) {
|
|
if (a2 <= 0)
|
|
r = g = b = NaN;
|
|
return new Rgb(r, g, b, a2);
|
|
}
|
|
function rgbConvert(o) {
|
|
if (!(o instanceof Color))
|
|
o = color(o);
|
|
if (!o)
|
|
return new Rgb();
|
|
o = o.rgb();
|
|
return new Rgb(o.r, o.g, o.b, o.opacity);
|
|
}
|
|
function rgb(r, g, b, opacity) {
|
|
return arguments.length === 1 ? rgbConvert(r) : new Rgb(r, g, b, opacity == null ? 1 : opacity);
|
|
}
|
|
function Rgb(r, g, b, opacity) {
|
|
this.r = +r;
|
|
this.g = +g;
|
|
this.b = +b;
|
|
this.opacity = +opacity;
|
|
}
|
|
define_default(Rgb, rgb, extend(Color, {
|
|
brighter(k) {
|
|
k = k == null ? brighter : Math.pow(brighter, k);
|
|
return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
|
|
},
|
|
darker(k) {
|
|
k = k == null ? darker : Math.pow(darker, k);
|
|
return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
|
|
},
|
|
rgb() {
|
|
return this;
|
|
},
|
|
clamp() {
|
|
return new Rgb(clampi(this.r), clampi(this.g), clampi(this.b), clampa(this.opacity));
|
|
},
|
|
displayable() {
|
|
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);
|
|
},
|
|
hex: rgb_formatHex,
|
|
// Deprecated! Use color.formatHex.
|
|
formatHex: rgb_formatHex,
|
|
formatHex8: rgb_formatHex8,
|
|
formatRgb: rgb_formatRgb,
|
|
toString: rgb_formatRgb
|
|
}));
|
|
function rgb_formatHex() {
|
|
return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}`;
|
|
}
|
|
function rgb_formatHex8() {
|
|
return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}${hex((isNaN(this.opacity) ? 1 : this.opacity) * 255)}`;
|
|
}
|
|
function rgb_formatRgb() {
|
|
const a2 = clampa(this.opacity);
|
|
return `${a2 === 1 ? "rgb(" : "rgba("}${clampi(this.r)}, ${clampi(this.g)}, ${clampi(this.b)}${a2 === 1 ? ")" : `, ${a2})`}`;
|
|
}
|
|
function clampa(opacity) {
|
|
return isNaN(opacity) ? 1 : Math.max(0, Math.min(1, opacity));
|
|
}
|
|
function clampi(value) {
|
|
return Math.max(0, Math.min(255, Math.round(value) || 0));
|
|
}
|
|
function hex(value) {
|
|
value = clampi(value);
|
|
return (value < 16 ? "0" : "") + value.toString(16);
|
|
}
|
|
function hsla(h, s, l, a2) {
|
|
if (a2 <= 0)
|
|
h = s = l = NaN;
|
|
else if (l <= 0 || l >= 1)
|
|
h = s = NaN;
|
|
else if (s <= 0)
|
|
h = NaN;
|
|
return new Hsl(h, s, l, a2);
|
|
}
|
|
function hslConvert(o) {
|
|
if (o instanceof Hsl)
|
|
return new Hsl(o.h, o.s, o.l, o.opacity);
|
|
if (!(o instanceof Color))
|
|
o = color(o);
|
|
if (!o)
|
|
return new Hsl();
|
|
if (o instanceof Hsl)
|
|
return o;
|
|
o = o.rgb();
|
|
var r = o.r / 255, g = o.g / 255, b = o.b / 255, min2 = Math.min(r, g, b), max2 = Math.max(r, g, b), h = NaN, s = max2 - min2, l = (max2 + min2) / 2;
|
|
if (s) {
|
|
if (r === max2)
|
|
h = (g - b) / s + (g < b) * 6;
|
|
else if (g === max2)
|
|
h = (b - r) / s + 2;
|
|
else
|
|
h = (r - g) / s + 4;
|
|
s /= l < 0.5 ? max2 + min2 : 2 - max2 - min2;
|
|
h *= 60;
|
|
} else {
|
|
s = l > 0 && l < 1 ? 0 : h;
|
|
}
|
|
return new Hsl(h, s, l, o.opacity);
|
|
}
|
|
function hsl(h, s, l, opacity) {
|
|
return arguments.length === 1 ? hslConvert(h) : new Hsl(h, s, l, opacity == null ? 1 : opacity);
|
|
}
|
|
function Hsl(h, s, l, opacity) {
|
|
this.h = +h;
|
|
this.s = +s;
|
|
this.l = +l;
|
|
this.opacity = +opacity;
|
|
}
|
|
define_default(Hsl, hsl, extend(Color, {
|
|
brighter(k) {
|
|
k = k == null ? brighter : Math.pow(brighter, k);
|
|
return new Hsl(this.h, this.s, this.l * k, this.opacity);
|
|
},
|
|
darker(k) {
|
|
k = k == null ? darker : Math.pow(darker, k);
|
|
return new Hsl(this.h, this.s, this.l * k, this.opacity);
|
|
},
|
|
rgb() {
|
|
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;
|
|
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
|
|
);
|
|
},
|
|
clamp() {
|
|
return new Hsl(clamph(this.h), clampt(this.s), clampt(this.l), clampa(this.opacity));
|
|
},
|
|
displayable() {
|
|
return (0 <= this.s && this.s <= 1 || isNaN(this.s)) && (0 <= this.l && this.l <= 1) && (0 <= this.opacity && this.opacity <= 1);
|
|
},
|
|
formatHsl() {
|
|
const a2 = clampa(this.opacity);
|
|
return `${a2 === 1 ? "hsl(" : "hsla("}${clamph(this.h)}, ${clampt(this.s) * 100}%, ${clampt(this.l) * 100}%${a2 === 1 ? ")" : `, ${a2})`}`;
|
|
}
|
|
}));
|
|
function clamph(value) {
|
|
value = (value || 0) % 360;
|
|
return value < 0 ? value + 360 : value;
|
|
}
|
|
function clampt(value) {
|
|
return Math.max(0, Math.min(1, value || 0));
|
|
}
|
|
function hsl2rgb(h, m1, m2) {
|
|
return (h < 60 ? m1 + (m2 - m1) * h / 60 : h < 180 ? m2 : h < 240 ? m1 + (m2 - m1) * (240 - h) / 60 : m1) * 255;
|
|
}
|
|
|
|
// node_modules/d3-interpolate/src/basis.js
|
|
function basis(t1, v0, v1, v2, v3) {
|
|
var t2 = t1 * t1, t3 = t2 * t1;
|
|
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;
|
|
}
|
|
function basis_default(values) {
|
|
var n = values.length - 1;
|
|
return function(t) {
|
|
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;
|
|
return basis((t - i / n) * n, v0, v1, v2, v3);
|
|
};
|
|
}
|
|
|
|
// node_modules/d3-interpolate/src/basisClosed.js
|
|
function basisClosed_default(values) {
|
|
var n = values.length;
|
|
return function(t) {
|
|
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];
|
|
return basis((t - i / n) * n, v0, v1, v2, v3);
|
|
};
|
|
}
|
|
|
|
// node_modules/d3-interpolate/src/constant.js
|
|
var constant_default3 = (x2) => () => x2;
|
|
|
|
// node_modules/d3-interpolate/src/color.js
|
|
function linear(a2, d) {
|
|
return function(t) {
|
|
return a2 + t * d;
|
|
};
|
|
}
|
|
function exponential(a2, b, y2) {
|
|
return a2 = Math.pow(a2, y2), b = Math.pow(b, y2) - a2, y2 = 1 / y2, function(t) {
|
|
return Math.pow(a2 + t * b, y2);
|
|
};
|
|
}
|
|
function gamma(y2) {
|
|
return (y2 = +y2) === 1 ? nogamma : function(a2, b) {
|
|
return b - a2 ? exponential(a2, b, y2) : constant_default3(isNaN(a2) ? b : a2);
|
|
};
|
|
}
|
|
function nogamma(a2, b) {
|
|
var d = b - a2;
|
|
return d ? linear(a2, d) : constant_default3(isNaN(a2) ? b : a2);
|
|
}
|
|
|
|
// node_modules/d3-interpolate/src/rgb.js
|
|
var rgb_default = function rgbGamma(y2) {
|
|
var color2 = gamma(y2);
|
|
function rgb2(start2, end) {
|
|
var r = color2((start2 = rgb(start2)).r, (end = rgb(end)).r), g = color2(start2.g, end.g), b = color2(start2.b, end.b), opacity = nogamma(start2.opacity, end.opacity);
|
|
return function(t) {
|
|
start2.r = r(t);
|
|
start2.g = g(t);
|
|
start2.b = b(t);
|
|
start2.opacity = opacity(t);
|
|
return start2 + "";
|
|
};
|
|
}
|
|
rgb2.gamma = rgbGamma;
|
|
return rgb2;
|
|
}(1);
|
|
function rgbSpline(spline) {
|
|
return function(colors) {
|
|
var n = colors.length, r = new Array(n), g = new Array(n), b = new Array(n), i, color2;
|
|
for (i = 0; i < n; ++i) {
|
|
color2 = rgb(colors[i]);
|
|
r[i] = color2.r || 0;
|
|
g[i] = color2.g || 0;
|
|
b[i] = color2.b || 0;
|
|
}
|
|
r = spline(r);
|
|
g = spline(g);
|
|
b = spline(b);
|
|
color2.opacity = 1;
|
|
return function(t) {
|
|
color2.r = r(t);
|
|
color2.g = g(t);
|
|
color2.b = b(t);
|
|
return color2 + "";
|
|
};
|
|
};
|
|
}
|
|
var rgbBasis = rgbSpline(basis_default);
|
|
var rgbBasisClosed = rgbSpline(basisClosed_default);
|
|
|
|
// node_modules/d3-interpolate/src/number.js
|
|
function number_default(a2, b) {
|
|
return a2 = +a2, b = +b, function(t) {
|
|
return a2 * (1 - t) + b * t;
|
|
};
|
|
}
|
|
|
|
// node_modules/d3-interpolate/src/string.js
|
|
var reA = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g;
|
|
var reB = new RegExp(reA.source, "g");
|
|
function zero(b) {
|
|
return function() {
|
|
return b;
|
|
};
|
|
}
|
|
function one(b) {
|
|
return function(t) {
|
|
return b(t) + "";
|
|
};
|
|
}
|
|
function string_default(a2, b) {
|
|
var bi = reA.lastIndex = reB.lastIndex = 0, am, bm, bs, i = -1, s = [], q = [];
|
|
a2 = a2 + "", b = b + "";
|
|
while ((am = reA.exec(a2)) && (bm = reB.exec(b))) {
|
|
if ((bs = bm.index) > bi) {
|
|
bs = b.slice(bi, bs);
|
|
if (s[i])
|
|
s[i] += bs;
|
|
else
|
|
s[++i] = bs;
|
|
}
|
|
if ((am = am[0]) === (bm = bm[0])) {
|
|
if (s[i])
|
|
s[i] += bm;
|
|
else
|
|
s[++i] = bm;
|
|
} else {
|
|
s[++i] = null;
|
|
q.push({ i, x: number_default(am, bm) });
|
|
}
|
|
bi = reB.lastIndex;
|
|
}
|
|
if (bi < b.length) {
|
|
bs = b.slice(bi);
|
|
if (s[i])
|
|
s[i] += bs;
|
|
else
|
|
s[++i] = bs;
|
|
}
|
|
return s.length < 2 ? q[0] ? one(q[0].x) : zero(b) : (b = q.length, function(t) {
|
|
for (var i2 = 0, o; i2 < b; ++i2)
|
|
s[(o = q[i2]).i] = o.x(t);
|
|
return s.join("");
|
|
});
|
|
}
|
|
|
|
// node_modules/d3-interpolate/src/transform/decompose.js
|
|
var degrees = 180 / Math.PI;
|
|
var identity = {
|
|
translateX: 0,
|
|
translateY: 0,
|
|
rotate: 0,
|
|
skewX: 0,
|
|
scaleX: 1,
|
|
scaleY: 1
|
|
};
|
|
function decompose_default(a2, b, c2, d, e, f) {
|
|
var scaleX, scaleY, skewX;
|
|
if (scaleX = Math.sqrt(a2 * a2 + b * b))
|
|
a2 /= scaleX, b /= scaleX;
|
|
if (skewX = a2 * c2 + b * d)
|
|
c2 -= a2 * skewX, d -= b * skewX;
|
|
if (scaleY = Math.sqrt(c2 * c2 + d * d))
|
|
c2 /= scaleY, d /= scaleY, skewX /= scaleY;
|
|
if (a2 * d < b * c2)
|
|
a2 = -a2, b = -b, skewX = -skewX, scaleX = -scaleX;
|
|
return {
|
|
translateX: e,
|
|
translateY: f,
|
|
rotate: Math.atan2(b, a2) * degrees,
|
|
skewX: Math.atan(skewX) * degrees,
|
|
scaleX,
|
|
scaleY
|
|
};
|
|
}
|
|
|
|
// node_modules/d3-interpolate/src/transform/parse.js
|
|
var svgNode;
|
|
function parseCss(value) {
|
|
const m2 = new (typeof DOMMatrix === "function" ? DOMMatrix : WebKitCSSMatrix)(value + "");
|
|
return m2.isIdentity ? identity : decompose_default(m2.a, m2.b, m2.c, m2.d, m2.e, m2.f);
|
|
}
|
|
function parseSvg(value) {
|
|
if (value == null)
|
|
return identity;
|
|
if (!svgNode)
|
|
svgNode = document.createElementNS("http://www.w3.org/2000/svg", "g");
|
|
svgNode.setAttribute("transform", value);
|
|
if (!(value = svgNode.transform.baseVal.consolidate()))
|
|
return identity;
|
|
value = value.matrix;
|
|
return decompose_default(value.a, value.b, value.c, value.d, value.e, value.f);
|
|
}
|
|
|
|
// node_modules/d3-interpolate/src/transform/index.js
|
|
function interpolateTransform(parse, pxComma, pxParen, degParen) {
|
|
function pop(s) {
|
|
return s.length ? s.pop() + " " : "";
|
|
}
|
|
function translate(xa, ya, xb, yb, s, q) {
|
|
if (xa !== xb || ya !== yb) {
|
|
var i = s.push("translate(", null, pxComma, null, pxParen);
|
|
q.push({ i: i - 4, x: number_default(xa, xb) }, { i: i - 2, x: number_default(ya, yb) });
|
|
} else if (xb || yb) {
|
|
s.push("translate(" + xb + pxComma + yb + pxParen);
|
|
}
|
|
}
|
|
function rotate(a2, b, s, q) {
|
|
if (a2 !== b) {
|
|
if (a2 - b > 180)
|
|
b += 360;
|
|
else if (b - a2 > 180)
|
|
a2 += 360;
|
|
q.push({ i: s.push(pop(s) + "rotate(", null, degParen) - 2, x: number_default(a2, b) });
|
|
} else if (b) {
|
|
s.push(pop(s) + "rotate(" + b + degParen);
|
|
}
|
|
}
|
|
function skewX(a2, b, s, q) {
|
|
if (a2 !== b) {
|
|
q.push({ i: s.push(pop(s) + "skewX(", null, degParen) - 2, x: number_default(a2, b) });
|
|
} else if (b) {
|
|
s.push(pop(s) + "skewX(" + b + degParen);
|
|
}
|
|
}
|
|
function scale(xa, ya, xb, yb, s, q) {
|
|
if (xa !== xb || ya !== yb) {
|
|
var i = s.push(pop(s) + "scale(", null, ",", null, ")");
|
|
q.push({ i: i - 4, x: number_default(xa, xb) }, { i: i - 2, x: number_default(ya, yb) });
|
|
} else if (xb !== 1 || yb !== 1) {
|
|
s.push(pop(s) + "scale(" + xb + "," + yb + ")");
|
|
}
|
|
}
|
|
return function(a2, b) {
|
|
var s = [], q = [];
|
|
a2 = parse(a2), b = parse(b);
|
|
translate(a2.translateX, a2.translateY, b.translateX, b.translateY, s, q);
|
|
rotate(a2.rotate, b.rotate, s, q);
|
|
skewX(a2.skewX, b.skewX, s, q);
|
|
scale(a2.scaleX, a2.scaleY, b.scaleX, b.scaleY, s, q);
|
|
a2 = b = null;
|
|
return function(t) {
|
|
var i = -1, n = q.length, o;
|
|
while (++i < n)
|
|
s[(o = q[i]).i] = o.x(t);
|
|
return s.join("");
|
|
};
|
|
};
|
|
}
|
|
var interpolateTransformCss = interpolateTransform(parseCss, "px, ", "px)", "deg)");
|
|
var interpolateTransformSvg = interpolateTransform(parseSvg, ", ", ")", ")");
|
|
|
|
// node_modules/d3-interpolate/src/zoom.js
|
|
var epsilon2 = 1e-12;
|
|
function cosh(x2) {
|
|
return ((x2 = Math.exp(x2)) + 1 / x2) / 2;
|
|
}
|
|
function sinh(x2) {
|
|
return ((x2 = Math.exp(x2)) - 1 / x2) / 2;
|
|
}
|
|
function tanh(x2) {
|
|
return ((x2 = Math.exp(2 * x2)) - 1) / (x2 + 1);
|
|
}
|
|
var zoom_default = function zoomRho(rho, rho2, rho4) {
|
|
function zoom(p0, p1) {
|
|
var ux0 = p0[0], uy0 = p0[1], w0 = p0[2], ux1 = p1[0], uy1 = p1[1], w1 = p1[2], dx = ux1 - ux0, dy = uy1 - uy0, d2 = dx * dx + dy * dy, i, S;
|
|
if (d2 < epsilon2) {
|
|
S = Math.log(w1 / w0) / rho;
|
|
i = function(t) {
|
|
return [
|
|
ux0 + t * dx,
|
|
uy0 + t * dy,
|
|
w0 * Math.exp(rho * t * S)
|
|
];
|
|
};
|
|
} else {
|
|
var d1 = Math.sqrt(d2), b0 = (w1 * w1 - w0 * w0 + rho4 * d2) / (2 * w0 * rho2 * d1), b1 = (w1 * w1 - w0 * w0 - rho4 * d2) / (2 * w1 * rho2 * d1), r0 = Math.log(Math.sqrt(b0 * b0 + 1) - b0), r1 = Math.log(Math.sqrt(b1 * b1 + 1) - b1);
|
|
S = (r1 - r0) / rho;
|
|
i = function(t) {
|
|
var s = t * S, coshr0 = cosh(r0), u = w0 / (rho2 * d1) * (coshr0 * tanh(rho * s + r0) - sinh(r0));
|
|
return [
|
|
ux0 + u * dx,
|
|
uy0 + u * dy,
|
|
w0 * coshr0 / cosh(rho * s + r0)
|
|
];
|
|
};
|
|
}
|
|
i.duration = S * 1e3 * rho / Math.SQRT2;
|
|
return i;
|
|
}
|
|
zoom.rho = function(_) {
|
|
var _1 = Math.max(1e-3, +_), _2 = _1 * _1, _4 = _2 * _2;
|
|
return zoomRho(_1, _2, _4);
|
|
};
|
|
return zoom;
|
|
}(Math.SQRT2, 2, 4);
|
|
|
|
// node_modules/d3-timer/src/timer.js
|
|
var frame = 0;
|
|
var timeout = 0;
|
|
var interval = 0;
|
|
var pokeDelay = 1e3;
|
|
var taskHead;
|
|
var taskTail;
|
|
var clockLast = 0;
|
|
var clockNow = 0;
|
|
var clockSkew = 0;
|
|
var clock = typeof performance === "object" && performance.now ? performance : Date;
|
|
var setFrame = typeof window === "object" && window.requestAnimationFrame ? window.requestAnimationFrame.bind(window) : function(f) {
|
|
setTimeout(f, 17);
|
|
};
|
|
function now() {
|
|
return clockNow || (setFrame(clearNow), clockNow = clock.now() + clockSkew);
|
|
}
|
|
function clearNow() {
|
|
clockNow = 0;
|
|
}
|
|
function Timer() {
|
|
this._call = this._time = this._next = null;
|
|
}
|
|
Timer.prototype = timer.prototype = {
|
|
constructor: Timer,
|
|
restart: function(callback, delay, time) {
|
|
if (typeof callback !== "function")
|
|
throw new TypeError("callback is not a function");
|
|
time = (time == null ? now() : +time) + (delay == null ? 0 : +delay);
|
|
if (!this._next && taskTail !== this) {
|
|
if (taskTail)
|
|
taskTail._next = this;
|
|
else
|
|
taskHead = this;
|
|
taskTail = this;
|
|
}
|
|
this._call = callback;
|
|
this._time = time;
|
|
sleep();
|
|
},
|
|
stop: function() {
|
|
if (this._call) {
|
|
this._call = null;
|
|
this._time = Infinity;
|
|
sleep();
|
|
}
|
|
}
|
|
};
|
|
function timer(callback, delay, time) {
|
|
var t = new Timer();
|
|
t.restart(callback, delay, time);
|
|
return t;
|
|
}
|
|
function timerFlush() {
|
|
now();
|
|
++frame;
|
|
var t = taskHead, e;
|
|
while (t) {
|
|
if ((e = clockNow - t._time) >= 0)
|
|
t._call.call(void 0, e);
|
|
t = t._next;
|
|
}
|
|
--frame;
|
|
}
|
|
function wake() {
|
|
clockNow = (clockLast = clock.now()) + clockSkew;
|
|
frame = timeout = 0;
|
|
try {
|
|
timerFlush();
|
|
} finally {
|
|
frame = 0;
|
|
nap();
|
|
clockNow = 0;
|
|
}
|
|
}
|
|
function poke() {
|
|
var now2 = clock.now(), delay = now2 - clockLast;
|
|
if (delay > pokeDelay)
|
|
clockSkew -= delay, clockLast = now2;
|
|
}
|
|
function nap() {
|
|
var t0, t1 = taskHead, t2, time = Infinity;
|
|
while (t1) {
|
|
if (t1._call) {
|
|
if (time > t1._time)
|
|
time = t1._time;
|
|
t0 = t1, t1 = t1._next;
|
|
} else {
|
|
t2 = t1._next, t1._next = null;
|
|
t1 = t0 ? t0._next = t2 : taskHead = t2;
|
|
}
|
|
}
|
|
taskTail = t0;
|
|
sleep(time);
|
|
}
|
|
function sleep(time) {
|
|
if (frame)
|
|
return;
|
|
if (timeout)
|
|
timeout = clearTimeout(timeout);
|
|
var delay = time - clockNow;
|
|
if (delay > 24) {
|
|
if (time < Infinity)
|
|
timeout = setTimeout(wake, time - clock.now() - clockSkew);
|
|
if (interval)
|
|
interval = clearInterval(interval);
|
|
} else {
|
|
if (!interval)
|
|
clockLast = clock.now(), interval = setInterval(poke, pokeDelay);
|
|
frame = 1, setFrame(wake);
|
|
}
|
|
}
|
|
|
|
// node_modules/d3-timer/src/timeout.js
|
|
function timeout_default(callback, delay, time) {
|
|
var t = new Timer();
|
|
delay = delay == null ? 0 : +delay;
|
|
t.restart((elapsed) => {
|
|
t.stop();
|
|
callback(elapsed + delay);
|
|
}, delay, time);
|
|
return t;
|
|
}
|
|
|
|
// node_modules/d3-transition/src/transition/schedule.js
|
|
var emptyOn = dispatch_default("start", "end", "cancel", "interrupt");
|
|
var emptyTween = [];
|
|
var CREATED = 0;
|
|
var SCHEDULED = 1;
|
|
var STARTING = 2;
|
|
var STARTED = 3;
|
|
var RUNNING = 4;
|
|
var ENDING = 5;
|
|
var ENDED = 6;
|
|
function schedule_default(node, name, id2, index2, group, timing) {
|
|
var schedules = node.__transition;
|
|
if (!schedules)
|
|
node.__transition = {};
|
|
else if (id2 in schedules)
|
|
return;
|
|
create(node, id2, {
|
|
name,
|
|
index: index2,
|
|
// For context during callback.
|
|
group,
|
|
// For context during callback.
|
|
on: emptyOn,
|
|
tween: emptyTween,
|
|
time: timing.time,
|
|
delay: timing.delay,
|
|
duration: timing.duration,
|
|
ease: timing.ease,
|
|
timer: null,
|
|
state: CREATED
|
|
});
|
|
}
|
|
function init(node, id2) {
|
|
var schedule = get2(node, id2);
|
|
if (schedule.state > CREATED)
|
|
throw new Error("too late; already scheduled");
|
|
return schedule;
|
|
}
|
|
function set2(node, id2) {
|
|
var schedule = get2(node, id2);
|
|
if (schedule.state > STARTED)
|
|
throw new Error("too late; already running");
|
|
return schedule;
|
|
}
|
|
function get2(node, id2) {
|
|
var schedule = node.__transition;
|
|
if (!schedule || !(schedule = schedule[id2]))
|
|
throw new Error("transition not found");
|
|
return schedule;
|
|
}
|
|
function create(node, id2, self) {
|
|
var schedules = node.__transition, tween;
|
|
schedules[id2] = self;
|
|
self.timer = timer(schedule, 0, self.time);
|
|
function schedule(elapsed) {
|
|
self.state = SCHEDULED;
|
|
self.timer.restart(start2, self.delay, self.time);
|
|
if (self.delay <= elapsed)
|
|
start2(elapsed - self.delay);
|
|
}
|
|
function start2(elapsed) {
|
|
var i, j, n, o;
|
|
if (self.state !== SCHEDULED)
|
|
return stop();
|
|
for (i in schedules) {
|
|
o = schedules[i];
|
|
if (o.name !== self.name)
|
|
continue;
|
|
if (o.state === STARTED)
|
|
return timeout_default(start2);
|
|
if (o.state === RUNNING) {
|
|
o.state = ENDED;
|
|
o.timer.stop();
|
|
o.on.call("interrupt", node, node.__data__, o.index, o.group);
|
|
delete schedules[i];
|
|
} else if (+i < id2) {
|
|
o.state = ENDED;
|
|
o.timer.stop();
|
|
o.on.call("cancel", node, node.__data__, o.index, o.group);
|
|
delete schedules[i];
|
|
}
|
|
}
|
|
timeout_default(function() {
|
|
if (self.state === STARTED) {
|
|
self.state = RUNNING;
|
|
self.timer.restart(tick, self.delay, self.time);
|
|
tick(elapsed);
|
|
}
|
|
});
|
|
self.state = STARTING;
|
|
self.on.call("start", node, node.__data__, self.index, self.group);
|
|
if (self.state !== STARTING)
|
|
return;
|
|
self.state = STARTED;
|
|
tween = new Array(n = self.tween.length);
|
|
for (i = 0, j = -1; i < n; ++i) {
|
|
if (o = self.tween[i].value.call(node, node.__data__, self.index, self.group)) {
|
|
tween[++j] = o;
|
|
}
|
|
}
|
|
tween.length = j + 1;
|
|
}
|
|
function tick(elapsed) {
|
|
var t = elapsed < self.duration ? self.ease.call(null, elapsed / self.duration) : (self.timer.restart(stop), self.state = ENDING, 1), i = -1, n = tween.length;
|
|
while (++i < n) {
|
|
tween[i].call(node, t);
|
|
}
|
|
if (self.state === ENDING) {
|
|
self.on.call("end", node, node.__data__, self.index, self.group);
|
|
stop();
|
|
}
|
|
}
|
|
function stop() {
|
|
self.state = ENDED;
|
|
self.timer.stop();
|
|
delete schedules[id2];
|
|
for (var i in schedules)
|
|
return;
|
|
delete node.__transition;
|
|
}
|
|
}
|
|
|
|
// node_modules/d3-transition/src/interrupt.js
|
|
function interrupt_default(node, name) {
|
|
var schedules = node.__transition, schedule, active, empty2 = true, i;
|
|
if (!schedules)
|
|
return;
|
|
name = name == null ? null : name + "";
|
|
for (i in schedules) {
|
|
if ((schedule = schedules[i]).name !== name) {
|
|
empty2 = false;
|
|
continue;
|
|
}
|
|
active = schedule.state > STARTING && schedule.state < ENDING;
|
|
schedule.state = ENDED;
|
|
schedule.timer.stop();
|
|
schedule.on.call(active ? "interrupt" : "cancel", node, node.__data__, schedule.index, schedule.group);
|
|
delete schedules[i];
|
|
}
|
|
if (empty2)
|
|
delete node.__transition;
|
|
}
|
|
|
|
// node_modules/d3-transition/src/selection/interrupt.js
|
|
function interrupt_default2(name) {
|
|
return this.each(function() {
|
|
interrupt_default(this, name);
|
|
});
|
|
}
|
|
|
|
// node_modules/d3-transition/src/transition/tween.js
|
|
function tweenRemove(id2, name) {
|
|
var tween0, tween1;
|
|
return function() {
|
|
var schedule = set2(this, id2), tween = schedule.tween;
|
|
if (tween !== tween0) {
|
|
tween1 = tween0 = tween;
|
|
for (var i = 0, n = tween1.length; i < n; ++i) {
|
|
if (tween1[i].name === name) {
|
|
tween1 = tween1.slice();
|
|
tween1.splice(i, 1);
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
schedule.tween = tween1;
|
|
};
|
|
}
|
|
function tweenFunction(id2, name, value) {
|
|
var tween0, tween1;
|
|
if (typeof value !== "function")
|
|
throw new Error();
|
|
return function() {
|
|
var schedule = set2(this, id2), tween = schedule.tween;
|
|
if (tween !== tween0) {
|
|
tween1 = (tween0 = tween).slice();
|
|
for (var t = { name, value }, i = 0, n = tween1.length; i < n; ++i) {
|
|
if (tween1[i].name === name) {
|
|
tween1[i] = t;
|
|
break;
|
|
}
|
|
}
|
|
if (i === n)
|
|
tween1.push(t);
|
|
}
|
|
schedule.tween = tween1;
|
|
};
|
|
}
|
|
function tween_default(name, value) {
|
|
var id2 = this._id;
|
|
name += "";
|
|
if (arguments.length < 2) {
|
|
var tween = get2(this.node(), id2).tween;
|
|
for (var i = 0, n = tween.length, t; i < n; ++i) {
|
|
if ((t = tween[i]).name === name) {
|
|
return t.value;
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
return this.each((value == null ? tweenRemove : tweenFunction)(id2, name, value));
|
|
}
|
|
function tweenValue(transition2, name, value) {
|
|
var id2 = transition2._id;
|
|
transition2.each(function() {
|
|
var schedule = set2(this, id2);
|
|
(schedule.value || (schedule.value = {}))[name] = value.apply(this, arguments);
|
|
});
|
|
return function(node) {
|
|
return get2(node, id2).value[name];
|
|
};
|
|
}
|
|
|
|
// node_modules/d3-transition/src/transition/interpolate.js
|
|
function interpolate_default(a2, b) {
|
|
var c2;
|
|
return (typeof b === "number" ? number_default : b instanceof color ? rgb_default : (c2 = color(b)) ? (b = c2, rgb_default) : string_default)(a2, b);
|
|
}
|
|
|
|
// node_modules/d3-transition/src/transition/attr.js
|
|
function attrRemove2(name) {
|
|
return function() {
|
|
this.removeAttribute(name);
|
|
};
|
|
}
|
|
function attrRemoveNS2(fullname) {
|
|
return function() {
|
|
this.removeAttributeNS(fullname.space, fullname.local);
|
|
};
|
|
}
|
|
function attrConstant2(name, interpolate, value1) {
|
|
var string00, string1 = value1 + "", interpolate0;
|
|
return function() {
|
|
var string0 = this.getAttribute(name);
|
|
return string0 === string1 ? null : string0 === string00 ? interpolate0 : interpolate0 = interpolate(string00 = string0, value1);
|
|
};
|
|
}
|
|
function attrConstantNS2(fullname, interpolate, value1) {
|
|
var string00, string1 = value1 + "", interpolate0;
|
|
return function() {
|
|
var string0 = this.getAttributeNS(fullname.space, fullname.local);
|
|
return string0 === string1 ? null : string0 === string00 ? interpolate0 : interpolate0 = interpolate(string00 = string0, value1);
|
|
};
|
|
}
|
|
function attrFunction2(name, interpolate, value) {
|
|
var string00, string10, interpolate0;
|
|
return function() {
|
|
var string0, value1 = value(this), string1;
|
|
if (value1 == null)
|
|
return void this.removeAttribute(name);
|
|
string0 = this.getAttribute(name);
|
|
string1 = value1 + "";
|
|
return string0 === string1 ? null : string0 === string00 && string1 === string10 ? interpolate0 : (string10 = string1, interpolate0 = interpolate(string00 = string0, value1));
|
|
};
|
|
}
|
|
function attrFunctionNS2(fullname, interpolate, value) {
|
|
var string00, string10, interpolate0;
|
|
return function() {
|
|
var string0, value1 = value(this), string1;
|
|
if (value1 == null)
|
|
return void this.removeAttributeNS(fullname.space, fullname.local);
|
|
string0 = this.getAttributeNS(fullname.space, fullname.local);
|
|
string1 = value1 + "";
|
|
return string0 === string1 ? null : string0 === string00 && string1 === string10 ? interpolate0 : (string10 = string1, interpolate0 = interpolate(string00 = string0, value1));
|
|
};
|
|
}
|
|
function attr_default2(name, value) {
|
|
var fullname = namespace_default(name), i = fullname === "transform" ? interpolateTransformSvg : interpolate_default;
|
|
return this.attrTween(name, typeof value === "function" ? (fullname.local ? attrFunctionNS2 : attrFunction2)(fullname, i, tweenValue(this, "attr." + name, value)) : value == null ? (fullname.local ? attrRemoveNS2 : attrRemove2)(fullname) : (fullname.local ? attrConstantNS2 : attrConstant2)(fullname, i, value));
|
|
}
|
|
|
|
// node_modules/d3-transition/src/transition/attrTween.js
|
|
function attrInterpolate(name, i) {
|
|
return function(t) {
|
|
this.setAttribute(name, i.call(this, t));
|
|
};
|
|
}
|
|
function attrInterpolateNS(fullname, i) {
|
|
return function(t) {
|
|
this.setAttributeNS(fullname.space, fullname.local, i.call(this, t));
|
|
};
|
|
}
|
|
function attrTweenNS(fullname, value) {
|
|
var t0, i0;
|
|
function tween() {
|
|
var i = value.apply(this, arguments);
|
|
if (i !== i0)
|
|
t0 = (i0 = i) && attrInterpolateNS(fullname, i);
|
|
return t0;
|
|
}
|
|
tween._value = value;
|
|
return tween;
|
|
}
|
|
function attrTween(name, value) {
|
|
var t0, i0;
|
|
function tween() {
|
|
var i = value.apply(this, arguments);
|
|
if (i !== i0)
|
|
t0 = (i0 = i) && attrInterpolate(name, i);
|
|
return t0;
|
|
}
|
|
tween._value = value;
|
|
return tween;
|
|
}
|
|
function attrTween_default(name, value) {
|
|
var key = "attr." + name;
|
|
if (arguments.length < 2)
|
|
return (key = this.tween(key)) && key._value;
|
|
if (value == null)
|
|
return this.tween(key, null);
|
|
if (typeof value !== "function")
|
|
throw new Error();
|
|
var fullname = namespace_default(name);
|
|
return this.tween(key, (fullname.local ? attrTweenNS : attrTween)(fullname, value));
|
|
}
|
|
|
|
// node_modules/d3-transition/src/transition/delay.js
|
|
function delayFunction(id2, value) {
|
|
return function() {
|
|
init(this, id2).delay = +value.apply(this, arguments);
|
|
};
|
|
}
|
|
function delayConstant(id2, value) {
|
|
return value = +value, function() {
|
|
init(this, id2).delay = value;
|
|
};
|
|
}
|
|
function delay_default(value) {
|
|
var id2 = this._id;
|
|
return arguments.length ? this.each((typeof value === "function" ? delayFunction : delayConstant)(id2, value)) : get2(this.node(), id2).delay;
|
|
}
|
|
|
|
// node_modules/d3-transition/src/transition/duration.js
|
|
function durationFunction(id2, value) {
|
|
return function() {
|
|
set2(this, id2).duration = +value.apply(this, arguments);
|
|
};
|
|
}
|
|
function durationConstant(id2, value) {
|
|
return value = +value, function() {
|
|
set2(this, id2).duration = value;
|
|
};
|
|
}
|
|
function duration_default(value) {
|
|
var id2 = this._id;
|
|
return arguments.length ? this.each((typeof value === "function" ? durationFunction : durationConstant)(id2, value)) : get2(this.node(), id2).duration;
|
|
}
|
|
|
|
// node_modules/d3-transition/src/transition/ease.js
|
|
function easeConstant(id2, value) {
|
|
if (typeof value !== "function")
|
|
throw new Error();
|
|
return function() {
|
|
set2(this, id2).ease = value;
|
|
};
|
|
}
|
|
function ease_default(value) {
|
|
var id2 = this._id;
|
|
return arguments.length ? this.each(easeConstant(id2, value)) : get2(this.node(), id2).ease;
|
|
}
|
|
|
|
// node_modules/d3-transition/src/transition/easeVarying.js
|
|
function easeVarying(id2, value) {
|
|
return function() {
|
|
var v = value.apply(this, arguments);
|
|
if (typeof v !== "function")
|
|
throw new Error();
|
|
set2(this, id2).ease = v;
|
|
};
|
|
}
|
|
function easeVarying_default(value) {
|
|
if (typeof value !== "function")
|
|
throw new Error();
|
|
return this.each(easeVarying(this._id, value));
|
|
}
|
|
|
|
// node_modules/d3-transition/src/transition/filter.js
|
|
function filter_default2(match) {
|
|
if (typeof match !== "function")
|
|
match = matcher_default(match);
|
|
for (var groups = this._groups, m2 = groups.length, subgroups = new Array(m2), j = 0; j < m2; ++j) {
|
|
for (var group = groups[j], n = group.length, subgroup = subgroups[j] = [], node, i = 0; i < n; ++i) {
|
|
if ((node = group[i]) && match.call(node, node.__data__, i, group)) {
|
|
subgroup.push(node);
|
|
}
|
|
}
|
|
}
|
|
return new Transition(subgroups, this._parents, this._name, this._id);
|
|
}
|
|
|
|
// node_modules/d3-transition/src/transition/merge.js
|
|
function merge_default2(transition2) {
|
|
if (transition2._id !== this._id)
|
|
throw new Error();
|
|
for (var groups0 = this._groups, groups1 = transition2._groups, m0 = groups0.length, m1 = groups1.length, m2 = Math.min(m0, m1), merges = new Array(m0), j = 0; j < m2; ++j) {
|
|
for (var group0 = groups0[j], group1 = groups1[j], n = group0.length, merge = merges[j] = new Array(n), node, i = 0; i < n; ++i) {
|
|
if (node = group0[i] || group1[i]) {
|
|
merge[i] = node;
|
|
}
|
|
}
|
|
}
|
|
for (; j < m0; ++j) {
|
|
merges[j] = groups0[j];
|
|
}
|
|
return new Transition(merges, this._parents, this._name, this._id);
|
|
}
|
|
|
|
// node_modules/d3-transition/src/transition/on.js
|
|
function start(name) {
|
|
return (name + "").trim().split(/^|\s+/).every(function(t) {
|
|
var i = t.indexOf(".");
|
|
if (i >= 0)
|
|
t = t.slice(0, i);
|
|
return !t || t === "start";
|
|
});
|
|
}
|
|
function onFunction(id2, name, listener) {
|
|
var on0, on1, sit = start(name) ? init : set2;
|
|
return function() {
|
|
var schedule = sit(this, id2), on = schedule.on;
|
|
if (on !== on0)
|
|
(on1 = (on0 = on).copy()).on(name, listener);
|
|
schedule.on = on1;
|
|
};
|
|
}
|
|
function on_default2(name, listener) {
|
|
var id2 = this._id;
|
|
return arguments.length < 2 ? get2(this.node(), id2).on.on(name) : this.each(onFunction(id2, name, listener));
|
|
}
|
|
|
|
// node_modules/d3-transition/src/transition/remove.js
|
|
function removeFunction(id2) {
|
|
return function() {
|
|
var parent = this.parentNode;
|
|
for (var i in this.__transition)
|
|
if (+i !== id2)
|
|
return;
|
|
if (parent)
|
|
parent.removeChild(this);
|
|
};
|
|
}
|
|
function remove_default2() {
|
|
return this.on("end.remove", removeFunction(this._id));
|
|
}
|
|
|
|
// node_modules/d3-transition/src/transition/select.js
|
|
function select_default3(select) {
|
|
var name = this._name, id2 = this._id;
|
|
if (typeof select !== "function")
|
|
select = selector_default(select);
|
|
for (var groups = this._groups, m2 = groups.length, subgroups = new Array(m2), j = 0; j < m2; ++j) {
|
|
for (var group = groups[j], n = group.length, subgroup = subgroups[j] = new Array(n), node, subnode, i = 0; i < n; ++i) {
|
|
if ((node = group[i]) && (subnode = select.call(node, node.__data__, i, group))) {
|
|
if ("__data__" in node)
|
|
subnode.__data__ = node.__data__;
|
|
subgroup[i] = subnode;
|
|
schedule_default(subgroup[i], name, id2, i, subgroup, get2(node, id2));
|
|
}
|
|
}
|
|
}
|
|
return new Transition(subgroups, this._parents, name, id2);
|
|
}
|
|
|
|
// node_modules/d3-transition/src/transition/selectAll.js
|
|
function selectAll_default3(select) {
|
|
var name = this._name, id2 = this._id;
|
|
if (typeof select !== "function")
|
|
select = selectorAll_default(select);
|
|
for (var groups = this._groups, m2 = groups.length, subgroups = [], parents = [], j = 0; j < m2; ++j) {
|
|
for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) {
|
|
if (node = group[i]) {
|
|
for (var children2 = select.call(node, node.__data__, i, group), child, inherit2 = get2(node, id2), k = 0, l = children2.length; k < l; ++k) {
|
|
if (child = children2[k]) {
|
|
schedule_default(child, name, id2, k, children2, inherit2);
|
|
}
|
|
}
|
|
subgroups.push(children2);
|
|
parents.push(node);
|
|
}
|
|
}
|
|
}
|
|
return new Transition(subgroups, parents, name, id2);
|
|
}
|
|
|
|
// node_modules/d3-transition/src/transition/selection.js
|
|
var Selection2 = selection_default.prototype.constructor;
|
|
function selection_default2() {
|
|
return new Selection2(this._groups, this._parents);
|
|
}
|
|
|
|
// node_modules/d3-transition/src/transition/style.js
|
|
function styleNull(name, interpolate) {
|
|
var string00, string10, interpolate0;
|
|
return function() {
|
|
var string0 = styleValue(this, name), string1 = (this.style.removeProperty(name), styleValue(this, name));
|
|
return string0 === string1 ? null : string0 === string00 && string1 === string10 ? interpolate0 : interpolate0 = interpolate(string00 = string0, string10 = string1);
|
|
};
|
|
}
|
|
function styleRemove2(name) {
|
|
return function() {
|
|
this.style.removeProperty(name);
|
|
};
|
|
}
|
|
function styleConstant2(name, interpolate, value1) {
|
|
var string00, string1 = value1 + "", interpolate0;
|
|
return function() {
|
|
var string0 = styleValue(this, name);
|
|
return string0 === string1 ? null : string0 === string00 ? interpolate0 : interpolate0 = interpolate(string00 = string0, value1);
|
|
};
|
|
}
|
|
function styleFunction2(name, interpolate, value) {
|
|
var string00, string10, interpolate0;
|
|
return function() {
|
|
var string0 = styleValue(this, name), value1 = value(this), string1 = value1 + "";
|
|
if (value1 == null)
|
|
string1 = value1 = (this.style.removeProperty(name), styleValue(this, name));
|
|
return string0 === string1 ? null : string0 === string00 && string1 === string10 ? interpolate0 : (string10 = string1, interpolate0 = interpolate(string00 = string0, value1));
|
|
};
|
|
}
|
|
function styleMaybeRemove(id2, name) {
|
|
var on0, on1, listener0, key = "style." + name, event = "end." + key, remove2;
|
|
return function() {
|
|
var schedule = set2(this, id2), on = schedule.on, listener = schedule.value[key] == null ? remove2 || (remove2 = styleRemove2(name)) : void 0;
|
|
if (on !== on0 || listener0 !== listener)
|
|
(on1 = (on0 = on).copy()).on(event, listener0 = listener);
|
|
schedule.on = on1;
|
|
};
|
|
}
|
|
function style_default2(name, value, priority) {
|
|
var i = (name += "") === "transform" ? interpolateTransformCss : interpolate_default;
|
|
return value == null ? this.styleTween(name, styleNull(name, i)).on("end.style." + name, styleRemove2(name)) : typeof value === "function" ? this.styleTween(name, styleFunction2(name, i, tweenValue(this, "style." + name, value))).each(styleMaybeRemove(this._id, name)) : this.styleTween(name, styleConstant2(name, i, value), priority).on("end.style." + name, null);
|
|
}
|
|
|
|
// node_modules/d3-transition/src/transition/styleTween.js
|
|
function styleInterpolate(name, i, priority) {
|
|
return function(t) {
|
|
this.style.setProperty(name, i.call(this, t), priority);
|
|
};
|
|
}
|
|
function styleTween(name, value, priority) {
|
|
var t, i0;
|
|
function tween() {
|
|
var i = value.apply(this, arguments);
|
|
if (i !== i0)
|
|
t = (i0 = i) && styleInterpolate(name, i, priority);
|
|
return t;
|
|
}
|
|
tween._value = value;
|
|
return tween;
|
|
}
|
|
function styleTween_default(name, value, priority) {
|
|
var key = "style." + (name += "");
|
|
if (arguments.length < 2)
|
|
return (key = this.tween(key)) && key._value;
|
|
if (value == null)
|
|
return this.tween(key, null);
|
|
if (typeof value !== "function")
|
|
throw new Error();
|
|
return this.tween(key, styleTween(name, value, priority == null ? "" : priority));
|
|
}
|
|
|
|
// node_modules/d3-transition/src/transition/text.js
|
|
function textConstant2(value) {
|
|
return function() {
|
|
this.textContent = value;
|
|
};
|
|
}
|
|
function textFunction2(value) {
|
|
return function() {
|
|
var value1 = value(this);
|
|
this.textContent = value1 == null ? "" : value1;
|
|
};
|
|
}
|
|
function text_default2(value) {
|
|
return this.tween("text", typeof value === "function" ? textFunction2(tweenValue(this, "text", value)) : textConstant2(value == null ? "" : value + ""));
|
|
}
|
|
|
|
// node_modules/d3-transition/src/transition/textTween.js
|
|
function textInterpolate(i) {
|
|
return function(t) {
|
|
this.textContent = i.call(this, t);
|
|
};
|
|
}
|
|
function textTween(value) {
|
|
var t0, i0;
|
|
function tween() {
|
|
var i = value.apply(this, arguments);
|
|
if (i !== i0)
|
|
t0 = (i0 = i) && textInterpolate(i);
|
|
return t0;
|
|
}
|
|
tween._value = value;
|
|
return tween;
|
|
}
|
|
function textTween_default(value) {
|
|
var key = "text";
|
|
if (arguments.length < 1)
|
|
return (key = this.tween(key)) && key._value;
|
|
if (value == null)
|
|
return this.tween(key, null);
|
|
if (typeof value !== "function")
|
|
throw new Error();
|
|
return this.tween(key, textTween(value));
|
|
}
|
|
|
|
// node_modules/d3-transition/src/transition/transition.js
|
|
function transition_default() {
|
|
var name = this._name, id0 = this._id, id1 = newId();
|
|
for (var groups = this._groups, m2 = groups.length, j = 0; j < m2; ++j) {
|
|
for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) {
|
|
if (node = group[i]) {
|
|
var inherit2 = get2(node, id0);
|
|
schedule_default(node, name, id1, i, group, {
|
|
time: inherit2.time + inherit2.delay + inherit2.duration,
|
|
delay: 0,
|
|
duration: inherit2.duration,
|
|
ease: inherit2.ease
|
|
});
|
|
}
|
|
}
|
|
}
|
|
return new Transition(groups, this._parents, name, id1);
|
|
}
|
|
|
|
// node_modules/d3-transition/src/transition/end.js
|
|
function end_default() {
|
|
var on0, on1, that = this, id2 = that._id, size = that.size();
|
|
return new Promise(function(resolve, reject) {
|
|
var cancel = { value: reject }, end = { value: function() {
|
|
if (--size === 0)
|
|
resolve();
|
|
} };
|
|
that.each(function() {
|
|
var schedule = set2(this, id2), on = schedule.on;
|
|
if (on !== on0) {
|
|
on1 = (on0 = on).copy();
|
|
on1._.cancel.push(cancel);
|
|
on1._.interrupt.push(cancel);
|
|
on1._.end.push(end);
|
|
}
|
|
schedule.on = on1;
|
|
});
|
|
if (size === 0)
|
|
resolve();
|
|
});
|
|
}
|
|
|
|
// node_modules/d3-transition/src/transition/index.js
|
|
var id = 0;
|
|
function Transition(groups, parents, name, id2) {
|
|
this._groups = groups;
|
|
this._parents = parents;
|
|
this._name = name;
|
|
this._id = id2;
|
|
}
|
|
function transition(name) {
|
|
return selection_default().transition(name);
|
|
}
|
|
function newId() {
|
|
return ++id;
|
|
}
|
|
var selection_prototype = selection_default.prototype;
|
|
Transition.prototype = transition.prototype = {
|
|
constructor: Transition,
|
|
select: select_default3,
|
|
selectAll: selectAll_default3,
|
|
selectChild: selection_prototype.selectChild,
|
|
selectChildren: selection_prototype.selectChildren,
|
|
filter: filter_default2,
|
|
merge: merge_default2,
|
|
selection: selection_default2,
|
|
transition: transition_default,
|
|
call: selection_prototype.call,
|
|
nodes: selection_prototype.nodes,
|
|
node: selection_prototype.node,
|
|
size: selection_prototype.size,
|
|
empty: selection_prototype.empty,
|
|
each: selection_prototype.each,
|
|
on: on_default2,
|
|
attr: attr_default2,
|
|
attrTween: attrTween_default,
|
|
style: style_default2,
|
|
styleTween: styleTween_default,
|
|
text: text_default2,
|
|
textTween: textTween_default,
|
|
remove: remove_default2,
|
|
tween: tween_default,
|
|
delay: delay_default,
|
|
duration: duration_default,
|
|
ease: ease_default,
|
|
easeVarying: easeVarying_default,
|
|
end: end_default,
|
|
[Symbol.iterator]: selection_prototype[Symbol.iterator]
|
|
};
|
|
|
|
// node_modules/d3-ease/src/cubic.js
|
|
function cubicInOut(t) {
|
|
return ((t *= 2) <= 1 ? t * t * t : (t -= 2) * t * t + 2) / 2;
|
|
}
|
|
|
|
// node_modules/d3-transition/src/selection/transition.js
|
|
var defaultTiming = {
|
|
time: null,
|
|
// Set on use.
|
|
delay: 0,
|
|
duration: 250,
|
|
ease: cubicInOut
|
|
};
|
|
function inherit(node, id2) {
|
|
var timing;
|
|
while (!(timing = node.__transition) || !(timing = timing[id2])) {
|
|
if (!(node = node.parentNode)) {
|
|
throw new Error(`transition ${id2} not found`);
|
|
}
|
|
}
|
|
return timing;
|
|
}
|
|
function transition_default2(name) {
|
|
var id2, timing;
|
|
if (name instanceof Transition) {
|
|
id2 = name._id, name = name._name;
|
|
} else {
|
|
id2 = newId(), (timing = defaultTiming).time = now(), name = name == null ? null : name + "";
|
|
}
|
|
for (var groups = this._groups, m2 = groups.length, j = 0; j < m2; ++j) {
|
|
for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) {
|
|
if (node = group[i]) {
|
|
schedule_default(node, name, id2, i, group, timing || inherit(node, id2));
|
|
}
|
|
}
|
|
}
|
|
return new Transition(groups, this._parents, name, id2);
|
|
}
|
|
|
|
// node_modules/d3-transition/src/selection/index.js
|
|
selection_default.prototype.interrupt = interrupt_default2;
|
|
selection_default.prototype.transition = transition_default2;
|
|
|
|
// node_modules/d3-brush/src/brush.js
|
|
var { abs, max, min } = Math;
|
|
function number1(e) {
|
|
return [+e[0], +e[1]];
|
|
}
|
|
function number2(e) {
|
|
return [number1(e[0]), number1(e[1])];
|
|
}
|
|
var X = {
|
|
name: "x",
|
|
handles: ["w", "e"].map(type),
|
|
input: function(x2, e) {
|
|
return x2 == null ? null : [[+x2[0], e[0][1]], [+x2[1], e[1][1]]];
|
|
},
|
|
output: function(xy) {
|
|
return xy && [xy[0][0], xy[1][0]];
|
|
}
|
|
};
|
|
var Y = {
|
|
name: "y",
|
|
handles: ["n", "s"].map(type),
|
|
input: function(y2, e) {
|
|
return y2 == null ? null : [[e[0][0], +y2[0]], [e[1][0], +y2[1]]];
|
|
},
|
|
output: function(xy) {
|
|
return xy && [xy[0][1], xy[1][1]];
|
|
}
|
|
};
|
|
var XY = {
|
|
name: "xy",
|
|
handles: ["n", "w", "e", "s", "nw", "ne", "sw", "se"].map(type),
|
|
input: function(xy) {
|
|
return xy == null ? null : number2(xy);
|
|
},
|
|
output: function(xy) {
|
|
return xy;
|
|
}
|
|
};
|
|
function type(t) {
|
|
return { type: t };
|
|
}
|
|
|
|
// node_modules/d3-force/src/center.js
|
|
function center_default(x2, y2) {
|
|
var nodes, strength = 1;
|
|
if (x2 == null)
|
|
x2 = 0;
|
|
if (y2 == null)
|
|
y2 = 0;
|
|
function force() {
|
|
var i, n = nodes.length, node, sx = 0, sy = 0;
|
|
for (i = 0; i < n; ++i) {
|
|
node = nodes[i], sx += node.x, sy += node.y;
|
|
}
|
|
for (sx = (sx / n - x2) * strength, sy = (sy / n - y2) * strength, i = 0; i < n; ++i) {
|
|
node = nodes[i], node.x -= sx, node.y -= sy;
|
|
}
|
|
}
|
|
force.initialize = function(_) {
|
|
nodes = _;
|
|
};
|
|
force.x = function(_) {
|
|
return arguments.length ? (x2 = +_, force) : x2;
|
|
};
|
|
force.y = function(_) {
|
|
return arguments.length ? (y2 = +_, force) : y2;
|
|
};
|
|
force.strength = function(_) {
|
|
return arguments.length ? (strength = +_, force) : strength;
|
|
};
|
|
return force;
|
|
}
|
|
|
|
// node_modules/d3-quadtree/src/add.js
|
|
function add_default(d) {
|
|
const x2 = +this._x.call(null, d), y2 = +this._y.call(null, d);
|
|
return add(this.cover(x2, y2), x2, y2, d);
|
|
}
|
|
function add(tree, x2, y2, d) {
|
|
if (isNaN(x2) || isNaN(y2))
|
|
return tree;
|
|
var parent, node = tree._root, leaf = { data: d }, x0 = tree._x0, y0 = tree._y0, x1 = tree._x1, y1 = tree._y1, xm, ym, xp, yp, right, bottom, i, j;
|
|
if (!node)
|
|
return tree._root = leaf, tree;
|
|
while (node.length) {
|
|
if (right = x2 >= (xm = (x0 + x1) / 2))
|
|
x0 = xm;
|
|
else
|
|
x1 = xm;
|
|
if (bottom = y2 >= (ym = (y0 + y1) / 2))
|
|
y0 = ym;
|
|
else
|
|
y1 = ym;
|
|
if (parent = node, !(node = node[i = bottom << 1 | right]))
|
|
return parent[i] = leaf, tree;
|
|
}
|
|
xp = +tree._x.call(null, node.data);
|
|
yp = +tree._y.call(null, node.data);
|
|
if (x2 === xp && y2 === yp)
|
|
return leaf.next = node, parent ? parent[i] = leaf : tree._root = leaf, tree;
|
|
do {
|
|
parent = parent ? parent[i] = new Array(4) : tree._root = new Array(4);
|
|
if (right = x2 >= (xm = (x0 + x1) / 2))
|
|
x0 = xm;
|
|
else
|
|
x1 = xm;
|
|
if (bottom = y2 >= (ym = (y0 + y1) / 2))
|
|
y0 = ym;
|
|
else
|
|
y1 = ym;
|
|
} while ((i = bottom << 1 | right) === (j = (yp >= ym) << 1 | xp >= xm));
|
|
return parent[j] = node, parent[i] = leaf, tree;
|
|
}
|
|
function addAll(data) {
|
|
var d, i, n = data.length, x2, y2, xz = new Array(n), yz = new Array(n), x0 = Infinity, y0 = Infinity, x1 = -Infinity, y1 = -Infinity;
|
|
for (i = 0; i < n; ++i) {
|
|
if (isNaN(x2 = +this._x.call(null, d = data[i])) || isNaN(y2 = +this._y.call(null, d)))
|
|
continue;
|
|
xz[i] = x2;
|
|
yz[i] = y2;
|
|
if (x2 < x0)
|
|
x0 = x2;
|
|
if (x2 > x1)
|
|
x1 = x2;
|
|
if (y2 < y0)
|
|
y0 = y2;
|
|
if (y2 > y1)
|
|
y1 = y2;
|
|
}
|
|
if (x0 > x1 || y0 > y1)
|
|
return this;
|
|
this.cover(x0, y0).cover(x1, y1);
|
|
for (i = 0; i < n; ++i) {
|
|
add(this, xz[i], yz[i], data[i]);
|
|
}
|
|
return this;
|
|
}
|
|
|
|
// node_modules/d3-quadtree/src/cover.js
|
|
function cover_default(x2, y2) {
|
|
if (isNaN(x2 = +x2) || isNaN(y2 = +y2))
|
|
return this;
|
|
var x0 = this._x0, y0 = this._y0, x1 = this._x1, y1 = this._y1;
|
|
if (isNaN(x0)) {
|
|
x1 = (x0 = Math.floor(x2)) + 1;
|
|
y1 = (y0 = Math.floor(y2)) + 1;
|
|
} else {
|
|
var z = x1 - x0 || 1, node = this._root, parent, i;
|
|
while (x0 > x2 || x2 >= x1 || y0 > y2 || y2 >= y1) {
|
|
i = (y2 < y0) << 1 | x2 < x0;
|
|
parent = new Array(4), parent[i] = node, node = parent, z *= 2;
|
|
switch (i) {
|
|
case 0:
|
|
x1 = x0 + z, y1 = y0 + z;
|
|
break;
|
|
case 1:
|
|
x0 = x1 - z, y1 = y0 + z;
|
|
break;
|
|
case 2:
|
|
x1 = x0 + z, y0 = y1 - z;
|
|
break;
|
|
case 3:
|
|
x0 = x1 - z, y0 = y1 - z;
|
|
break;
|
|
}
|
|
}
|
|
if (this._root && this._root.length)
|
|
this._root = node;
|
|
}
|
|
this._x0 = x0;
|
|
this._y0 = y0;
|
|
this._x1 = x1;
|
|
this._y1 = y1;
|
|
return this;
|
|
}
|
|
|
|
// node_modules/d3-quadtree/src/data.js
|
|
function data_default2() {
|
|
var data = [];
|
|
this.visit(function(node) {
|
|
if (!node.length)
|
|
do
|
|
data.push(node.data);
|
|
while (node = node.next);
|
|
});
|
|
return data;
|
|
}
|
|
|
|
// node_modules/d3-quadtree/src/extent.js
|
|
function extent_default(_) {
|
|
return arguments.length ? this.cover(+_[0][0], +_[0][1]).cover(+_[1][0], +_[1][1]) : isNaN(this._x0) ? void 0 : [[this._x0, this._y0], [this._x1, this._y1]];
|
|
}
|
|
|
|
// node_modules/d3-quadtree/src/quad.js
|
|
function quad_default(node, x0, y0, x1, y1) {
|
|
this.node = node;
|
|
this.x0 = x0;
|
|
this.y0 = y0;
|
|
this.x1 = x1;
|
|
this.y1 = y1;
|
|
}
|
|
|
|
// node_modules/d3-quadtree/src/find.js
|
|
function find_default(x2, y2, radius) {
|
|
var data, x0 = this._x0, y0 = this._y0, x1, y1, x22, y22, x3 = this._x1, y3 = this._y1, quads = [], node = this._root, q, i;
|
|
if (node)
|
|
quads.push(new quad_default(node, x0, y0, x3, y3));
|
|
if (radius == null)
|
|
radius = Infinity;
|
|
else {
|
|
x0 = x2 - radius, y0 = y2 - radius;
|
|
x3 = x2 + radius, y3 = y2 + radius;
|
|
radius *= radius;
|
|
}
|
|
while (q = quads.pop()) {
|
|
if (!(node = q.node) || (x1 = q.x0) > x3 || (y1 = q.y0) > y3 || (x22 = q.x1) < x0 || (y22 = q.y1) < y0)
|
|
continue;
|
|
if (node.length) {
|
|
var xm = (x1 + x22) / 2, ym = (y1 + y22) / 2;
|
|
quads.push(
|
|
new quad_default(node[3], xm, ym, x22, y22),
|
|
new quad_default(node[2], x1, ym, xm, y22),
|
|
new quad_default(node[1], xm, y1, x22, ym),
|
|
new quad_default(node[0], x1, y1, xm, ym)
|
|
);
|
|
if (i = (y2 >= ym) << 1 | x2 >= xm) {
|
|
q = quads[quads.length - 1];
|
|
quads[quads.length - 1] = quads[quads.length - 1 - i];
|
|
quads[quads.length - 1 - i] = q;
|
|
}
|
|
} else {
|
|
var dx = x2 - +this._x.call(null, node.data), dy = y2 - +this._y.call(null, node.data), d2 = dx * dx + dy * dy;
|
|
if (d2 < radius) {
|
|
var d = Math.sqrt(radius = d2);
|
|
x0 = x2 - d, y0 = y2 - d;
|
|
x3 = x2 + d, y3 = y2 + d;
|
|
data = node.data;
|
|
}
|
|
}
|
|
}
|
|
return data;
|
|
}
|
|
|
|
// node_modules/d3-quadtree/src/remove.js
|
|
function remove_default3(d) {
|
|
if (isNaN(x2 = +this._x.call(null, d)) || isNaN(y2 = +this._y.call(null, d)))
|
|
return this;
|
|
var parent, node = this._root, retainer, previous, next, x0 = this._x0, y0 = this._y0, x1 = this._x1, y1 = this._y1, x2, y2, xm, ym, right, bottom, i, j;
|
|
if (!node)
|
|
return this;
|
|
if (node.length)
|
|
while (true) {
|
|
if (right = x2 >= (xm = (x0 + x1) / 2))
|
|
x0 = xm;
|
|
else
|
|
x1 = xm;
|
|
if (bottom = y2 >= (ym = (y0 + y1) / 2))
|
|
y0 = ym;
|
|
else
|
|
y1 = ym;
|
|
if (!(parent = node, node = node[i = bottom << 1 | right]))
|
|
return this;
|
|
if (!node.length)
|
|
break;
|
|
if (parent[i + 1 & 3] || parent[i + 2 & 3] || parent[i + 3 & 3])
|
|
retainer = parent, j = i;
|
|
}
|
|
while (node.data !== d)
|
|
if (!(previous = node, node = node.next))
|
|
return this;
|
|
if (next = node.next)
|
|
delete node.next;
|
|
if (previous)
|
|
return next ? previous.next = next : delete previous.next, this;
|
|
if (!parent)
|
|
return this._root = next, this;
|
|
next ? parent[i] = next : delete parent[i];
|
|
if ((node = parent[0] || parent[1] || parent[2] || parent[3]) && node === (parent[3] || parent[2] || parent[1] || parent[0]) && !node.length) {
|
|
if (retainer)
|
|
retainer[j] = node;
|
|
else
|
|
this._root = node;
|
|
}
|
|
return this;
|
|
}
|
|
function removeAll(data) {
|
|
for (var i = 0, n = data.length; i < n; ++i)
|
|
this.remove(data[i]);
|
|
return this;
|
|
}
|
|
|
|
// node_modules/d3-quadtree/src/root.js
|
|
function root_default() {
|
|
return this._root;
|
|
}
|
|
|
|
// node_modules/d3-quadtree/src/size.js
|
|
function size_default2() {
|
|
var size = 0;
|
|
this.visit(function(node) {
|
|
if (!node.length)
|
|
do
|
|
++size;
|
|
while (node = node.next);
|
|
});
|
|
return size;
|
|
}
|
|
|
|
// node_modules/d3-quadtree/src/visit.js
|
|
function visit_default(callback) {
|
|
var quads = [], q, node = this._root, child, x0, y0, x1, y1;
|
|
if (node)
|
|
quads.push(new quad_default(node, this._x0, this._y0, this._x1, this._y1));
|
|
while (q = quads.pop()) {
|
|
if (!callback(node = q.node, x0 = q.x0, y0 = q.y0, x1 = q.x1, y1 = q.y1) && node.length) {
|
|
var xm = (x0 + x1) / 2, ym = (y0 + y1) / 2;
|
|
if (child = node[3])
|
|
quads.push(new quad_default(child, xm, ym, x1, y1));
|
|
if (child = node[2])
|
|
quads.push(new quad_default(child, x0, ym, xm, y1));
|
|
if (child = node[1])
|
|
quads.push(new quad_default(child, xm, y0, x1, ym));
|
|
if (child = node[0])
|
|
quads.push(new quad_default(child, x0, y0, xm, ym));
|
|
}
|
|
}
|
|
return this;
|
|
}
|
|
|
|
// node_modules/d3-quadtree/src/visitAfter.js
|
|
function visitAfter_default(callback) {
|
|
var quads = [], next = [], q;
|
|
if (this._root)
|
|
quads.push(new quad_default(this._root, this._x0, this._y0, this._x1, this._y1));
|
|
while (q = quads.pop()) {
|
|
var node = q.node;
|
|
if (node.length) {
|
|
var child, x0 = q.x0, y0 = q.y0, x1 = q.x1, y1 = q.y1, xm = (x0 + x1) / 2, ym = (y0 + y1) / 2;
|
|
if (child = node[0])
|
|
quads.push(new quad_default(child, x0, y0, xm, ym));
|
|
if (child = node[1])
|
|
quads.push(new quad_default(child, xm, y0, x1, ym));
|
|
if (child = node[2])
|
|
quads.push(new quad_default(child, x0, ym, xm, y1));
|
|
if (child = node[3])
|
|
quads.push(new quad_default(child, xm, ym, x1, y1));
|
|
}
|
|
next.push(q);
|
|
}
|
|
while (q = next.pop()) {
|
|
callback(q.node, q.x0, q.y0, q.x1, q.y1);
|
|
}
|
|
return this;
|
|
}
|
|
|
|
// node_modules/d3-quadtree/src/x.js
|
|
function defaultX(d) {
|
|
return d[0];
|
|
}
|
|
function x_default(_) {
|
|
return arguments.length ? (this._x = _, this) : this._x;
|
|
}
|
|
|
|
// node_modules/d3-quadtree/src/y.js
|
|
function defaultY(d) {
|
|
return d[1];
|
|
}
|
|
function y_default(_) {
|
|
return arguments.length ? (this._y = _, this) : this._y;
|
|
}
|
|
|
|
// node_modules/d3-quadtree/src/quadtree.js
|
|
function quadtree(nodes, x2, y2) {
|
|
var tree = new Quadtree(x2 == null ? defaultX : x2, y2 == null ? defaultY : y2, NaN, NaN, NaN, NaN);
|
|
return nodes == null ? tree : tree.addAll(nodes);
|
|
}
|
|
function Quadtree(x2, y2, x0, y0, x1, y1) {
|
|
this._x = x2;
|
|
this._y = y2;
|
|
this._x0 = x0;
|
|
this._y0 = y0;
|
|
this._x1 = x1;
|
|
this._y1 = y1;
|
|
this._root = void 0;
|
|
}
|
|
function leaf_copy(leaf) {
|
|
var copy = { data: leaf.data }, next = copy;
|
|
while (leaf = leaf.next)
|
|
next = next.next = { data: leaf.data };
|
|
return copy;
|
|
}
|
|
var treeProto = quadtree.prototype = Quadtree.prototype;
|
|
treeProto.copy = function() {
|
|
var copy = new Quadtree(this._x, this._y, this._x0, this._y0, this._x1, this._y1), node = this._root, nodes, child;
|
|
if (!node)
|
|
return copy;
|
|
if (!node.length)
|
|
return copy._root = leaf_copy(node), copy;
|
|
nodes = [{ source: node, target: copy._root = new Array(4) }];
|
|
while (node = nodes.pop()) {
|
|
for (var i = 0; i < 4; ++i) {
|
|
if (child = node.source[i]) {
|
|
if (child.length)
|
|
nodes.push({ source: child, target: node.target[i] = new Array(4) });
|
|
else
|
|
node.target[i] = leaf_copy(child);
|
|
}
|
|
}
|
|
}
|
|
return copy;
|
|
};
|
|
treeProto.add = add_default;
|
|
treeProto.addAll = addAll;
|
|
treeProto.cover = cover_default;
|
|
treeProto.data = data_default2;
|
|
treeProto.extent = extent_default;
|
|
treeProto.find = find_default;
|
|
treeProto.remove = remove_default3;
|
|
treeProto.removeAll = removeAll;
|
|
treeProto.root = root_default;
|
|
treeProto.size = size_default2;
|
|
treeProto.visit = visit_default;
|
|
treeProto.visitAfter = visitAfter_default;
|
|
treeProto.x = x_default;
|
|
treeProto.y = y_default;
|
|
|
|
// node_modules/d3-force/src/constant.js
|
|
function constant_default5(x2) {
|
|
return function() {
|
|
return x2;
|
|
};
|
|
}
|
|
|
|
// node_modules/d3-force/src/jiggle.js
|
|
function jiggle_default(random) {
|
|
return (random() - 0.5) * 1e-6;
|
|
}
|
|
|
|
// node_modules/d3-force/src/link.js
|
|
function index(d) {
|
|
return d.index;
|
|
}
|
|
function find2(nodeById, nodeId) {
|
|
var node = nodeById.get(nodeId);
|
|
if (!node)
|
|
throw new Error("node not found: " + nodeId);
|
|
return node;
|
|
}
|
|
function link_default(links) {
|
|
var id2 = index, strength = defaultStrength, strengths, distance = constant_default5(30), distances, nodes, count, bias, random, iterations = 1;
|
|
if (links == null)
|
|
links = [];
|
|
function defaultStrength(link) {
|
|
return 1 / Math.min(count[link.source.index], count[link.target.index]);
|
|
}
|
|
function force(alpha) {
|
|
for (var k = 0, n = links.length; k < iterations; ++k) {
|
|
for (var i = 0, link, source, target, x2, y2, l, b; i < n; ++i) {
|
|
link = links[i], source = link.source, target = link.target;
|
|
x2 = target.x + target.vx - source.x - source.vx || jiggle_default(random);
|
|
y2 = target.y + target.vy - source.y - source.vy || jiggle_default(random);
|
|
l = Math.sqrt(x2 * x2 + y2 * y2);
|
|
l = (l - distances[i]) / l * alpha * strengths[i];
|
|
x2 *= l, y2 *= l;
|
|
target.vx -= x2 * (b = bias[i]);
|
|
target.vy -= y2 * b;
|
|
source.vx += x2 * (b = 1 - b);
|
|
source.vy += y2 * b;
|
|
}
|
|
}
|
|
}
|
|
function initialize() {
|
|
if (!nodes)
|
|
return;
|
|
var i, n = nodes.length, m2 = links.length, nodeById = new Map(nodes.map((d, i2) => [id2(d, i2, nodes), d])), link;
|
|
for (i = 0, count = new Array(n); i < m2; ++i) {
|
|
link = links[i], link.index = i;
|
|
if (typeof link.source !== "object")
|
|
link.source = find2(nodeById, link.source);
|
|
if (typeof link.target !== "object")
|
|
link.target = find2(nodeById, link.target);
|
|
count[link.source.index] = (count[link.source.index] || 0) + 1;
|
|
count[link.target.index] = (count[link.target.index] || 0) + 1;
|
|
}
|
|
for (i = 0, bias = new Array(m2); i < m2; ++i) {
|
|
link = links[i], bias[i] = count[link.source.index] / (count[link.source.index] + count[link.target.index]);
|
|
}
|
|
strengths = new Array(m2), initializeStrength();
|
|
distances = new Array(m2), initializeDistance();
|
|
}
|
|
function initializeStrength() {
|
|
if (!nodes)
|
|
return;
|
|
for (var i = 0, n = links.length; i < n; ++i) {
|
|
strengths[i] = +strength(links[i], i, links);
|
|
}
|
|
}
|
|
function initializeDistance() {
|
|
if (!nodes)
|
|
return;
|
|
for (var i = 0, n = links.length; i < n; ++i) {
|
|
distances[i] = +distance(links[i], i, links);
|
|
}
|
|
}
|
|
force.initialize = function(_nodes, _random) {
|
|
nodes = _nodes;
|
|
random = _random;
|
|
initialize();
|
|
};
|
|
force.links = function(_) {
|
|
return arguments.length ? (links = _, initialize(), force) : links;
|
|
};
|
|
force.id = function(_) {
|
|
return arguments.length ? (id2 = _, force) : id2;
|
|
};
|
|
force.iterations = function(_) {
|
|
return arguments.length ? (iterations = +_, force) : iterations;
|
|
};
|
|
force.strength = function(_) {
|
|
return arguments.length ? (strength = typeof _ === "function" ? _ : constant_default5(+_), initializeStrength(), force) : strength;
|
|
};
|
|
force.distance = function(_) {
|
|
return arguments.length ? (distance = typeof _ === "function" ? _ : constant_default5(+_), initializeDistance(), force) : distance;
|
|
};
|
|
return force;
|
|
}
|
|
|
|
// node_modules/d3-force/src/lcg.js
|
|
var a = 1664525;
|
|
var c = 1013904223;
|
|
var m = 4294967296;
|
|
function lcg_default() {
|
|
let s = 1;
|
|
return () => (s = (a * s + c) % m) / m;
|
|
}
|
|
|
|
// node_modules/d3-force/src/simulation.js
|
|
function x(d) {
|
|
return d.x;
|
|
}
|
|
function y(d) {
|
|
return d.y;
|
|
}
|
|
var initialRadius = 10;
|
|
var initialAngle = Math.PI * (3 - Math.sqrt(5));
|
|
function simulation_default(nodes) {
|
|
var simulation, alpha = 1, alphaMin = 1e-3, alphaDecay = 1 - Math.pow(alphaMin, 1 / 300), alphaTarget = 0, velocityDecay = 0.6, forces = /* @__PURE__ */ new Map(), stepper = timer(step), event = dispatch_default("tick", "end"), random = lcg_default();
|
|
if (nodes == null)
|
|
nodes = [];
|
|
function step() {
|
|
tick();
|
|
event.call("tick", simulation);
|
|
if (alpha < alphaMin) {
|
|
stepper.stop();
|
|
event.call("end", simulation);
|
|
}
|
|
}
|
|
function tick(iterations) {
|
|
var i, n = nodes.length, node;
|
|
if (iterations === void 0)
|
|
iterations = 1;
|
|
for (var k = 0; k < iterations; ++k) {
|
|
alpha += (alphaTarget - alpha) * alphaDecay;
|
|
forces.forEach(function(force) {
|
|
force(alpha);
|
|
});
|
|
for (i = 0; i < n; ++i) {
|
|
node = nodes[i];
|
|
if (node.fx == null)
|
|
node.x += node.vx *= velocityDecay;
|
|
else
|
|
node.x = node.fx, node.vx = 0;
|
|
if (node.fy == null)
|
|
node.y += node.vy *= velocityDecay;
|
|
else
|
|
node.y = node.fy, node.vy = 0;
|
|
}
|
|
}
|
|
return simulation;
|
|
}
|
|
function initializeNodes() {
|
|
for (var i = 0, n = nodes.length, node; i < n; ++i) {
|
|
node = nodes[i], node.index = i;
|
|
if (node.fx != null)
|
|
node.x = node.fx;
|
|
if (node.fy != null)
|
|
node.y = node.fy;
|
|
if (isNaN(node.x) || isNaN(node.y)) {
|
|
var radius = initialRadius * Math.sqrt(0.5 + i), angle = i * initialAngle;
|
|
node.x = radius * Math.cos(angle);
|
|
node.y = radius * Math.sin(angle);
|
|
}
|
|
if (isNaN(node.vx) || isNaN(node.vy)) {
|
|
node.vx = node.vy = 0;
|
|
}
|
|
}
|
|
}
|
|
function initializeForce(force) {
|
|
if (force.initialize)
|
|
force.initialize(nodes, random);
|
|
return force;
|
|
}
|
|
initializeNodes();
|
|
return simulation = {
|
|
tick,
|
|
restart: function() {
|
|
return stepper.restart(step), simulation;
|
|
},
|
|
stop: function() {
|
|
return stepper.stop(), simulation;
|
|
},
|
|
nodes: function(_) {
|
|
return arguments.length ? (nodes = _, initializeNodes(), forces.forEach(initializeForce), simulation) : nodes;
|
|
},
|
|
alpha: function(_) {
|
|
return arguments.length ? (alpha = +_, simulation) : alpha;
|
|
},
|
|
alphaMin: function(_) {
|
|
return arguments.length ? (alphaMin = +_, simulation) : alphaMin;
|
|
},
|
|
alphaDecay: function(_) {
|
|
return arguments.length ? (alphaDecay = +_, simulation) : +alphaDecay;
|
|
},
|
|
alphaTarget: function(_) {
|
|
return arguments.length ? (alphaTarget = +_, simulation) : alphaTarget;
|
|
},
|
|
velocityDecay: function(_) {
|
|
return arguments.length ? (velocityDecay = 1 - _, simulation) : 1 - velocityDecay;
|
|
},
|
|
randomSource: function(_) {
|
|
return arguments.length ? (random = _, forces.forEach(initializeForce), simulation) : random;
|
|
},
|
|
force: function(name, _) {
|
|
return arguments.length > 1 ? (_ == null ? forces.delete(name) : forces.set(name, initializeForce(_)), simulation) : forces.get(name);
|
|
},
|
|
find: function(x2, y2, radius) {
|
|
var i = 0, n = nodes.length, dx, dy, d2, node, closest;
|
|
if (radius == null)
|
|
radius = Infinity;
|
|
else
|
|
radius *= radius;
|
|
for (i = 0; i < n; ++i) {
|
|
node = nodes[i];
|
|
dx = x2 - node.x;
|
|
dy = y2 - node.y;
|
|
d2 = dx * dx + dy * dy;
|
|
if (d2 < radius)
|
|
closest = node, radius = d2;
|
|
}
|
|
return closest;
|
|
},
|
|
on: function(name, _) {
|
|
return arguments.length > 1 ? (event.on(name, _), simulation) : event.on(name);
|
|
}
|
|
};
|
|
}
|
|
|
|
// node_modules/d3-force/src/manyBody.js
|
|
function manyBody_default() {
|
|
var nodes, node, random, alpha, strength = constant_default5(-30), strengths, distanceMin2 = 1, distanceMax2 = Infinity, theta2 = 0.81;
|
|
function force(_) {
|
|
var i, n = nodes.length, tree = quadtree(nodes, x, y).visitAfter(accumulate);
|
|
for (alpha = _, i = 0; i < n; ++i)
|
|
node = nodes[i], tree.visit(apply);
|
|
}
|
|
function initialize() {
|
|
if (!nodes)
|
|
return;
|
|
var i, n = nodes.length, node2;
|
|
strengths = new Array(n);
|
|
for (i = 0; i < n; ++i)
|
|
node2 = nodes[i], strengths[node2.index] = +strength(node2, i, nodes);
|
|
}
|
|
function accumulate(quad) {
|
|
var strength2 = 0, q, c2, weight = 0, x2, y2, i;
|
|
if (quad.length) {
|
|
for (x2 = y2 = i = 0; i < 4; ++i) {
|
|
if ((q = quad[i]) && (c2 = Math.abs(q.value))) {
|
|
strength2 += q.value, weight += c2, x2 += c2 * q.x, y2 += c2 * q.y;
|
|
}
|
|
}
|
|
quad.x = x2 / weight;
|
|
quad.y = y2 / weight;
|
|
} else {
|
|
q = quad;
|
|
q.x = q.data.x;
|
|
q.y = q.data.y;
|
|
do
|
|
strength2 += strengths[q.data.index];
|
|
while (q = q.next);
|
|
}
|
|
quad.value = strength2;
|
|
}
|
|
function apply(quad, x1, _, x2) {
|
|
if (!quad.value)
|
|
return true;
|
|
var x3 = quad.x - node.x, y2 = quad.y - node.y, w = x2 - x1, l = x3 * x3 + y2 * y2;
|
|
if (w * w / theta2 < l) {
|
|
if (l < distanceMax2) {
|
|
if (x3 === 0)
|
|
x3 = jiggle_default(random), l += x3 * x3;
|
|
if (y2 === 0)
|
|
y2 = jiggle_default(random), l += y2 * y2;
|
|
if (l < distanceMin2)
|
|
l = Math.sqrt(distanceMin2 * l);
|
|
node.vx += x3 * quad.value * alpha / l;
|
|
node.vy += y2 * quad.value * alpha / l;
|
|
}
|
|
return true;
|
|
} else if (quad.length || l >= distanceMax2)
|
|
return;
|
|
if (quad.data !== node || quad.next) {
|
|
if (x3 === 0)
|
|
x3 = jiggle_default(random), l += x3 * x3;
|
|
if (y2 === 0)
|
|
y2 = jiggle_default(random), l += y2 * y2;
|
|
if (l < distanceMin2)
|
|
l = Math.sqrt(distanceMin2 * l);
|
|
}
|
|
do
|
|
if (quad.data !== node) {
|
|
w = strengths[quad.data.index] * alpha / l;
|
|
node.vx += x3 * w;
|
|
node.vy += y2 * w;
|
|
}
|
|
while (quad = quad.next);
|
|
}
|
|
force.initialize = function(_nodes, _random) {
|
|
nodes = _nodes;
|
|
random = _random;
|
|
initialize();
|
|
};
|
|
force.strength = function(_) {
|
|
return arguments.length ? (strength = typeof _ === "function" ? _ : constant_default5(+_), initialize(), force) : strength;
|
|
};
|
|
force.distanceMin = function(_) {
|
|
return arguments.length ? (distanceMin2 = _ * _, force) : Math.sqrt(distanceMin2);
|
|
};
|
|
force.distanceMax = function(_) {
|
|
return arguments.length ? (distanceMax2 = _ * _, force) : Math.sqrt(distanceMax2);
|
|
};
|
|
force.theta = function(_) {
|
|
return arguments.length ? (theta2 = _ * _, force) : Math.sqrt(theta2);
|
|
};
|
|
return force;
|
|
}
|
|
|
|
// node_modules/d3-zoom/src/constant.js
|
|
var constant_default6 = (x2) => () => x2;
|
|
|
|
// node_modules/d3-zoom/src/event.js
|
|
function ZoomEvent(type2, {
|
|
sourceEvent,
|
|
target,
|
|
transform: transform2,
|
|
dispatch: dispatch2
|
|
}) {
|
|
Object.defineProperties(this, {
|
|
type: { value: type2, enumerable: true, configurable: true },
|
|
sourceEvent: { value: sourceEvent, enumerable: true, configurable: true },
|
|
target: { value: target, enumerable: true, configurable: true },
|
|
transform: { value: transform2, enumerable: true, configurable: true },
|
|
_: { value: dispatch2 }
|
|
});
|
|
}
|
|
|
|
// node_modules/d3-zoom/src/transform.js
|
|
function Transform(k, x2, y2) {
|
|
this.k = k;
|
|
this.x = x2;
|
|
this.y = y2;
|
|
}
|
|
Transform.prototype = {
|
|
constructor: Transform,
|
|
scale: function(k) {
|
|
return k === 1 ? this : new Transform(this.k * k, this.x, this.y);
|
|
},
|
|
translate: function(x2, y2) {
|
|
return x2 === 0 & y2 === 0 ? this : new Transform(this.k, this.x + this.k * x2, this.y + this.k * y2);
|
|
},
|
|
apply: function(point) {
|
|
return [point[0] * this.k + this.x, point[1] * this.k + this.y];
|
|
},
|
|
applyX: function(x2) {
|
|
return x2 * this.k + this.x;
|
|
},
|
|
applyY: function(y2) {
|
|
return y2 * this.k + this.y;
|
|
},
|
|
invert: function(location) {
|
|
return [(location[0] - this.x) / this.k, (location[1] - this.y) / this.k];
|
|
},
|
|
invertX: function(x2) {
|
|
return (x2 - this.x) / this.k;
|
|
},
|
|
invertY: function(y2) {
|
|
return (y2 - this.y) / this.k;
|
|
},
|
|
rescaleX: function(x2) {
|
|
return x2.copy().domain(x2.range().map(this.invertX, this).map(x2.invert, x2));
|
|
},
|
|
rescaleY: function(y2) {
|
|
return y2.copy().domain(y2.range().map(this.invertY, this).map(y2.invert, y2));
|
|
},
|
|
toString: function() {
|
|
return "translate(" + this.x + "," + this.y + ") scale(" + this.k + ")";
|
|
}
|
|
};
|
|
var identity2 = new Transform(1, 0, 0);
|
|
transform.prototype = Transform.prototype;
|
|
function transform(node) {
|
|
while (!node.__zoom)
|
|
if (!(node = node.parentNode))
|
|
return identity2;
|
|
return node.__zoom;
|
|
}
|
|
|
|
// node_modules/d3-zoom/src/noevent.js
|
|
function nopropagation3(event) {
|
|
event.stopImmediatePropagation();
|
|
}
|
|
function noevent_default3(event) {
|
|
event.preventDefault();
|
|
event.stopImmediatePropagation();
|
|
}
|
|
|
|
// node_modules/d3-zoom/src/zoom.js
|
|
function defaultFilter2(event) {
|
|
return (!event.ctrlKey || event.type === "wheel") && !event.button;
|
|
}
|
|
function defaultExtent() {
|
|
var e = this;
|
|
if (e instanceof SVGElement) {
|
|
e = e.ownerSVGElement || e;
|
|
if (e.hasAttribute("viewBox")) {
|
|
e = e.viewBox.baseVal;
|
|
return [[e.x, e.y], [e.x + e.width, e.y + e.height]];
|
|
}
|
|
return [[0, 0], [e.width.baseVal.value, e.height.baseVal.value]];
|
|
}
|
|
return [[0, 0], [e.clientWidth, e.clientHeight]];
|
|
}
|
|
function defaultTransform() {
|
|
return this.__zoom || identity2;
|
|
}
|
|
function defaultWheelDelta(event) {
|
|
return -event.deltaY * (event.deltaMode === 1 ? 0.05 : event.deltaMode ? 1 : 2e-3) * (event.ctrlKey ? 10 : 1);
|
|
}
|
|
function defaultTouchable2() {
|
|
return navigator.maxTouchPoints || "ontouchstart" in this;
|
|
}
|
|
function defaultConstrain(transform2, extent, translateExtent) {
|
|
var dx0 = transform2.invertX(extent[0][0]) - translateExtent[0][0], dx1 = transform2.invertX(extent[1][0]) - translateExtent[1][0], dy0 = transform2.invertY(extent[0][1]) - translateExtent[0][1], dy1 = transform2.invertY(extent[1][1]) - translateExtent[1][1];
|
|
return transform2.translate(
|
|
dx1 > dx0 ? (dx0 + dx1) / 2 : Math.min(0, dx0) || Math.max(0, dx1),
|
|
dy1 > dy0 ? (dy0 + dy1) / 2 : Math.min(0, dy0) || Math.max(0, dy1)
|
|
);
|
|
}
|
|
function zoom_default2() {
|
|
var filter2 = defaultFilter2, extent = defaultExtent, constrain = defaultConstrain, wheelDelta = defaultWheelDelta, touchable = defaultTouchable2, scaleExtent = [0, Infinity], translateExtent = [[-Infinity, -Infinity], [Infinity, Infinity]], duration = 250, interpolate = zoom_default, listeners = dispatch_default("start", "zoom", "end"), touchstarting, touchfirst, touchending, touchDelay = 500, wheelDelay = 150, clickDistance2 = 0, tapDistance = 10;
|
|
function zoom(selection2) {
|
|
selection2.property("__zoom", defaultTransform).on("wheel.zoom", wheeled, { passive: false }).on("mousedown.zoom", mousedowned).on("dblclick.zoom", dblclicked).filter(touchable).on("touchstart.zoom", touchstarted).on("touchmove.zoom", touchmoved).on("touchend.zoom touchcancel.zoom", touchended).style("-webkit-tap-highlight-color", "rgba(0,0,0,0)");
|
|
}
|
|
zoom.transform = function(collection, transform2, point, event) {
|
|
var selection2 = collection.selection ? collection.selection() : collection;
|
|
selection2.property("__zoom", defaultTransform);
|
|
if (collection !== selection2) {
|
|
schedule(collection, transform2, point, event);
|
|
} else {
|
|
selection2.interrupt().each(function() {
|
|
gesture(this, arguments).event(event).start().zoom(null, typeof transform2 === "function" ? transform2.apply(this, arguments) : transform2).end();
|
|
});
|
|
}
|
|
};
|
|
zoom.scaleBy = function(selection2, k, p, event) {
|
|
zoom.scaleTo(selection2, function() {
|
|
var k0 = this.__zoom.k, k1 = typeof k === "function" ? k.apply(this, arguments) : k;
|
|
return k0 * k1;
|
|
}, p, event);
|
|
};
|
|
zoom.scaleTo = function(selection2, k, p, event) {
|
|
zoom.transform(selection2, function() {
|
|
var e = extent.apply(this, arguments), t0 = this.__zoom, p0 = p == null ? centroid(e) : typeof p === "function" ? p.apply(this, arguments) : p, p1 = t0.invert(p0), k1 = typeof k === "function" ? k.apply(this, arguments) : k;
|
|
return constrain(translate(scale(t0, k1), p0, p1), e, translateExtent);
|
|
}, p, event);
|
|
};
|
|
zoom.translateBy = function(selection2, x2, y2, event) {
|
|
zoom.transform(selection2, function() {
|
|
return constrain(this.__zoom.translate(
|
|
typeof x2 === "function" ? x2.apply(this, arguments) : x2,
|
|
typeof y2 === "function" ? y2.apply(this, arguments) : y2
|
|
), extent.apply(this, arguments), translateExtent);
|
|
}, null, event);
|
|
};
|
|
zoom.translateTo = function(selection2, x2, y2, p, event) {
|
|
zoom.transform(selection2, function() {
|
|
var e = extent.apply(this, arguments), t = this.__zoom, p0 = p == null ? centroid(e) : typeof p === "function" ? p.apply(this, arguments) : p;
|
|
return constrain(identity2.translate(p0[0], p0[1]).scale(t.k).translate(
|
|
typeof x2 === "function" ? -x2.apply(this, arguments) : -x2,
|
|
typeof y2 === "function" ? -y2.apply(this, arguments) : -y2
|
|
), e, translateExtent);
|
|
}, p, event);
|
|
};
|
|
function scale(transform2, k) {
|
|
k = Math.max(scaleExtent[0], Math.min(scaleExtent[1], k));
|
|
return k === transform2.k ? transform2 : new Transform(k, transform2.x, transform2.y);
|
|
}
|
|
function translate(transform2, p0, p1) {
|
|
var x2 = p0[0] - p1[0] * transform2.k, y2 = p0[1] - p1[1] * transform2.k;
|
|
return x2 === transform2.x && y2 === transform2.y ? transform2 : new Transform(transform2.k, x2, y2);
|
|
}
|
|
function centroid(extent2) {
|
|
return [(+extent2[0][0] + +extent2[1][0]) / 2, (+extent2[0][1] + +extent2[1][1]) / 2];
|
|
}
|
|
function schedule(transition2, transform2, point, event) {
|
|
transition2.on("start.zoom", function() {
|
|
gesture(this, arguments).event(event).start();
|
|
}).on("interrupt.zoom end.zoom", function() {
|
|
gesture(this, arguments).event(event).end();
|
|
}).tween("zoom", function() {
|
|
var that = this, args = arguments, g = gesture(that, args).event(event), e = extent.apply(that, args), p = point == null ? centroid(e) : typeof point === "function" ? point.apply(that, args) : point, w = Math.max(e[1][0] - e[0][0], e[1][1] - e[0][1]), a2 = that.__zoom, b = typeof transform2 === "function" ? transform2.apply(that, args) : transform2, i = interpolate(a2.invert(p).concat(w / a2.k), b.invert(p).concat(w / b.k));
|
|
return function(t) {
|
|
if (t === 1)
|
|
t = b;
|
|
else {
|
|
var l = i(t), k = w / l[2];
|
|
t = new Transform(k, p[0] - l[0] * k, p[1] - l[1] * k);
|
|
}
|
|
g.zoom(null, t);
|
|
};
|
|
});
|
|
}
|
|
function gesture(that, args, clean) {
|
|
return !clean && that.__zooming || new Gesture(that, args);
|
|
}
|
|
function Gesture(that, args) {
|
|
this.that = that;
|
|
this.args = args;
|
|
this.active = 0;
|
|
this.sourceEvent = null;
|
|
this.extent = extent.apply(that, args);
|
|
this.taps = 0;
|
|
}
|
|
Gesture.prototype = {
|
|
event: function(event) {
|
|
if (event)
|
|
this.sourceEvent = event;
|
|
return this;
|
|
},
|
|
start: function() {
|
|
if (++this.active === 1) {
|
|
this.that.__zooming = this;
|
|
this.emit("start");
|
|
}
|
|
return this;
|
|
},
|
|
zoom: function(key, transform2) {
|
|
if (this.mouse && key !== "mouse")
|
|
this.mouse[1] = transform2.invert(this.mouse[0]);
|
|
if (this.touch0 && key !== "touch")
|
|
this.touch0[1] = transform2.invert(this.touch0[0]);
|
|
if (this.touch1 && key !== "touch")
|
|
this.touch1[1] = transform2.invert(this.touch1[0]);
|
|
this.that.__zoom = transform2;
|
|
this.emit("zoom");
|
|
return this;
|
|
},
|
|
end: function() {
|
|
if (--this.active === 0) {
|
|
delete this.that.__zooming;
|
|
this.emit("end");
|
|
}
|
|
return this;
|
|
},
|
|
emit: function(type2) {
|
|
var d = select_default2(this.that).datum();
|
|
listeners.call(
|
|
type2,
|
|
this.that,
|
|
new ZoomEvent(type2, {
|
|
sourceEvent: this.sourceEvent,
|
|
target: zoom,
|
|
type: type2,
|
|
transform: this.that.__zoom,
|
|
dispatch: listeners
|
|
}),
|
|
d
|
|
);
|
|
}
|
|
};
|
|
function wheeled(event, ...args) {
|
|
if (!filter2.apply(this, arguments))
|
|
return;
|
|
var g = gesture(this, args).event(event), t = this.__zoom, k = Math.max(scaleExtent[0], Math.min(scaleExtent[1], t.k * Math.pow(2, wheelDelta.apply(this, arguments)))), p = pointer_default(event);
|
|
if (g.wheel) {
|
|
if (g.mouse[0][0] !== p[0] || g.mouse[0][1] !== p[1]) {
|
|
g.mouse[1] = t.invert(g.mouse[0] = p);
|
|
}
|
|
clearTimeout(g.wheel);
|
|
} else if (t.k === k)
|
|
return;
|
|
else {
|
|
g.mouse = [p, t.invert(p)];
|
|
interrupt_default(this);
|
|
g.start();
|
|
}
|
|
noevent_default3(event);
|
|
g.wheel = setTimeout(wheelidled, wheelDelay);
|
|
g.zoom("mouse", constrain(translate(scale(t, k), g.mouse[0], g.mouse[1]), g.extent, translateExtent));
|
|
function wheelidled() {
|
|
g.wheel = null;
|
|
g.end();
|
|
}
|
|
}
|
|
function mousedowned(event, ...args) {
|
|
if (touchending || !filter2.apply(this, arguments))
|
|
return;
|
|
var currentTarget = event.currentTarget, g = gesture(this, args, true).event(event), v = select_default2(event.view).on("mousemove.zoom", mousemoved, true).on("mouseup.zoom", mouseupped, true), p = pointer_default(event, currentTarget), x0 = event.clientX, y0 = event.clientY;
|
|
nodrag_default(event.view);
|
|
nopropagation3(event);
|
|
g.mouse = [p, this.__zoom.invert(p)];
|
|
interrupt_default(this);
|
|
g.start();
|
|
function mousemoved(event2) {
|
|
noevent_default3(event2);
|
|
if (!g.moved) {
|
|
var dx = event2.clientX - x0, dy = event2.clientY - y0;
|
|
g.moved = dx * dx + dy * dy > clickDistance2;
|
|
}
|
|
g.event(event2).zoom("mouse", constrain(translate(g.that.__zoom, g.mouse[0] = pointer_default(event2, currentTarget), g.mouse[1]), g.extent, translateExtent));
|
|
}
|
|
function mouseupped(event2) {
|
|
v.on("mousemove.zoom mouseup.zoom", null);
|
|
yesdrag(event2.view, g.moved);
|
|
noevent_default3(event2);
|
|
g.event(event2).end();
|
|
}
|
|
}
|
|
function dblclicked(event, ...args) {
|
|
if (!filter2.apply(this, arguments))
|
|
return;
|
|
var t0 = this.__zoom, p0 = pointer_default(event.changedTouches ? event.changedTouches[0] : event, this), p1 = t0.invert(p0), k1 = t0.k * (event.shiftKey ? 0.5 : 2), t1 = constrain(translate(scale(t0, k1), p0, p1), extent.apply(this, args), translateExtent);
|
|
noevent_default3(event);
|
|
if (duration > 0)
|
|
select_default2(this).transition().duration(duration).call(schedule, t1, p0, event);
|
|
else
|
|
select_default2(this).call(zoom.transform, t1, p0, event);
|
|
}
|
|
function touchstarted(event, ...args) {
|
|
if (!filter2.apply(this, arguments))
|
|
return;
|
|
var touches = event.touches, n = touches.length, g = gesture(this, args, event.changedTouches.length === n).event(event), started, i, t, p;
|
|
nopropagation3(event);
|
|
for (i = 0; i < n; ++i) {
|
|
t = touches[i], p = pointer_default(t, this);
|
|
p = [p, this.__zoom.invert(p), t.identifier];
|
|
if (!g.touch0)
|
|
g.touch0 = p, started = true, g.taps = 1 + !!touchstarting;
|
|
else if (!g.touch1 && g.touch0[2] !== p[2])
|
|
g.touch1 = p, g.taps = 0;
|
|
}
|
|
if (touchstarting)
|
|
touchstarting = clearTimeout(touchstarting);
|
|
if (started) {
|
|
if (g.taps < 2)
|
|
touchfirst = p[0], touchstarting = setTimeout(function() {
|
|
touchstarting = null;
|
|
}, touchDelay);
|
|
interrupt_default(this);
|
|
g.start();
|
|
}
|
|
}
|
|
function touchmoved(event, ...args) {
|
|
if (!this.__zooming)
|
|
return;
|
|
var g = gesture(this, args).event(event), touches = event.changedTouches, n = touches.length, i, t, p, l;
|
|
noevent_default3(event);
|
|
for (i = 0; i < n; ++i) {
|
|
t = touches[i], p = pointer_default(t, this);
|
|
if (g.touch0 && g.touch0[2] === t.identifier)
|
|
g.touch0[0] = p;
|
|
else if (g.touch1 && g.touch1[2] === t.identifier)
|
|
g.touch1[0] = p;
|
|
}
|
|
t = g.that.__zoom;
|
|
if (g.touch1) {
|
|
var p0 = g.touch0[0], l0 = g.touch0[1], p1 = g.touch1[0], l1 = g.touch1[1], dp = (dp = p1[0] - p0[0]) * dp + (dp = p1[1] - p0[1]) * dp, dl = (dl = l1[0] - l0[0]) * dl + (dl = l1[1] - l0[1]) * dl;
|
|
t = scale(t, Math.sqrt(dp / dl));
|
|
p = [(p0[0] + p1[0]) / 2, (p0[1] + p1[1]) / 2];
|
|
l = [(l0[0] + l1[0]) / 2, (l0[1] + l1[1]) / 2];
|
|
} else if (g.touch0)
|
|
p = g.touch0[0], l = g.touch0[1];
|
|
else
|
|
return;
|
|
g.zoom("touch", constrain(translate(t, p, l), g.extent, translateExtent));
|
|
}
|
|
function touchended(event, ...args) {
|
|
if (!this.__zooming)
|
|
return;
|
|
var g = gesture(this, args).event(event), touches = event.changedTouches, n = touches.length, i, t;
|
|
nopropagation3(event);
|
|
if (touchending)
|
|
clearTimeout(touchending);
|
|
touchending = setTimeout(function() {
|
|
touchending = null;
|
|
}, touchDelay);
|
|
for (i = 0; i < n; ++i) {
|
|
t = touches[i];
|
|
if (g.touch0 && g.touch0[2] === t.identifier)
|
|
delete g.touch0;
|
|
else if (g.touch1 && g.touch1[2] === t.identifier)
|
|
delete g.touch1;
|
|
}
|
|
if (g.touch1 && !g.touch0)
|
|
g.touch0 = g.touch1, delete g.touch1;
|
|
if (g.touch0)
|
|
g.touch0[1] = this.__zoom.invert(g.touch0[0]);
|
|
else {
|
|
g.end();
|
|
if (g.taps === 2) {
|
|
t = pointer_default(t, this);
|
|
if (Math.hypot(touchfirst[0] - t[0], touchfirst[1] - t[1]) < tapDistance) {
|
|
var p = select_default2(this).on("dblclick.zoom");
|
|
if (p)
|
|
p.apply(this, arguments);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
zoom.wheelDelta = function(_) {
|
|
return arguments.length ? (wheelDelta = typeof _ === "function" ? _ : constant_default6(+_), zoom) : wheelDelta;
|
|
};
|
|
zoom.filter = function(_) {
|
|
return arguments.length ? (filter2 = typeof _ === "function" ? _ : constant_default6(!!_), zoom) : filter2;
|
|
};
|
|
zoom.touchable = function(_) {
|
|
return arguments.length ? (touchable = typeof _ === "function" ? _ : constant_default6(!!_), zoom) : touchable;
|
|
};
|
|
zoom.extent = function(_) {
|
|
return arguments.length ? (extent = typeof _ === "function" ? _ : constant_default6([[+_[0][0], +_[0][1]], [+_[1][0], +_[1][1]]]), zoom) : extent;
|
|
};
|
|
zoom.scaleExtent = function(_) {
|
|
return arguments.length ? (scaleExtent[0] = +_[0], scaleExtent[1] = +_[1], zoom) : [scaleExtent[0], scaleExtent[1]];
|
|
};
|
|
zoom.translateExtent = function(_) {
|
|
return arguments.length ? (translateExtent[0][0] = +_[0][0], translateExtent[1][0] = +_[1][0], translateExtent[0][1] = +_[0][1], translateExtent[1][1] = +_[1][1], zoom) : [[translateExtent[0][0], translateExtent[0][1]], [translateExtent[1][0], translateExtent[1][1]]];
|
|
};
|
|
zoom.constrain = function(_) {
|
|
return arguments.length ? (constrain = _, zoom) : constrain;
|
|
};
|
|
zoom.duration = function(_) {
|
|
return arguments.length ? (duration = +_, zoom) : duration;
|
|
};
|
|
zoom.interpolate = function(_) {
|
|
return arguments.length ? (interpolate = _, zoom) : interpolate;
|
|
};
|
|
zoom.on = function() {
|
|
var value = listeners.on.apply(listeners, arguments);
|
|
return value === listeners ? zoom : value;
|
|
};
|
|
zoom.clickDistance = function(_) {
|
|
return arguments.length ? (clickDistance2 = (_ = +_) * _, zoom) : Math.sqrt(clickDistance2);
|
|
};
|
|
zoom.tapDistance = function(_) {
|
|
return arguments.length ? (tapDistance = +_, zoom) : tapDistance;
|
|
};
|
|
return zoom;
|
|
}
|
|
|
|
// quartz/components/scripts/util.ts
|
|
function registerEscapeHandler(outsideContainer, cb) {
|
|
if (!outsideContainer)
|
|
return;
|
|
function click(e) {
|
|
if (e.target !== this)
|
|
return;
|
|
e.preventDefault();
|
|
cb();
|
|
}
|
|
function esc(e) {
|
|
if (!e.key.startsWith("Esc"))
|
|
return;
|
|
e.preventDefault();
|
|
cb();
|
|
}
|
|
outsideContainer?.removeEventListener("click", click);
|
|
outsideContainer?.addEventListener("click", click);
|
|
document.removeEventListener("keydown", esc);
|
|
document.addEventListener("keydown", esc);
|
|
}
|
|
function removeAllChildren(node) {
|
|
while (node.firstChild) {
|
|
node.removeChild(node.firstChild);
|
|
}
|
|
}
|
|
|
|
// node_modules/github-slugger/index.js
|
|
var own = Object.hasOwnProperty;
|
|
|
|
// quartz/util/path.ts
|
|
function getFullSlug(window2) {
|
|
const res = window2.document.body.dataset.slug;
|
|
return res;
|
|
}
|
|
function simplifySlug(fp) {
|
|
return _stripSlashes(_trimSuffix(fp, "index"), true);
|
|
}
|
|
function pathToRoot(slug2) {
|
|
let rootPath = slug2.split("/").filter((x2) => x2 !== "").slice(0, -1).map((_) => "..").join("/");
|
|
if (rootPath.length === 0) {
|
|
rootPath = ".";
|
|
}
|
|
return rootPath;
|
|
}
|
|
function resolveRelative(current, target) {
|
|
const res = joinSegments(pathToRoot(current), simplifySlug(target));
|
|
return res;
|
|
}
|
|
function joinSegments(...args) {
|
|
return args.filter((segment) => segment !== "").join("/").replace(/\/\/+/g, "/");
|
|
}
|
|
function _endsWith(s, suffix) {
|
|
return s === suffix || s.endsWith("/" + suffix);
|
|
}
|
|
function _trimSuffix(s, suffix) {
|
|
if (_endsWith(s, suffix)) {
|
|
s = s.slice(0, -suffix.length);
|
|
}
|
|
return s;
|
|
}
|
|
function _stripSlashes(s, onlyStripPrefix) {
|
|
if (s.startsWith("/")) {
|
|
s = s.substring(1);
|
|
}
|
|
if (!onlyStripPrefix && s.endsWith("/")) {
|
|
s = s.slice(0, -1);
|
|
}
|
|
return s;
|
|
}
|
|
|
|
// quartz/components/scripts/quartz/components/scripts/graph.inline.ts
|
|
var localStorageKey = "graph-visited";
|
|
function getVisited() {
|
|
return new Set(JSON.parse(localStorage.getItem(localStorageKey) ?? "[]"));
|
|
}
|
|
function addToVisited(slug2) {
|
|
const visited = getVisited();
|
|
visited.add(slug2);
|
|
localStorage.setItem(localStorageKey, JSON.stringify([...visited]));
|
|
}
|
|
async function renderGraph(container, fullSlug) {
|
|
const slug2 = simplifySlug(fullSlug);
|
|
const visited = getVisited();
|
|
const graph = document.getElementById(container);
|
|
if (!graph)
|
|
return;
|
|
removeAllChildren(graph);
|
|
let {
|
|
drag: enableDrag,
|
|
zoom: enableZoom,
|
|
depth,
|
|
scale,
|
|
repelForce,
|
|
centerForce,
|
|
linkDistance,
|
|
fontSize,
|
|
opacityScale,
|
|
removeTags,
|
|
showTags
|
|
} = JSON.parse(graph.dataset["cfg"]);
|
|
const data = await fetchData;
|
|
const links = [];
|
|
const tags = [];
|
|
const validLinks = new Set(Object.keys(data).map((slug3) => simplifySlug(slug3)));
|
|
for (const [src, details] of Object.entries(data)) {
|
|
const source = simplifySlug(src);
|
|
const outgoing = details.links ?? [];
|
|
for (const dest of outgoing) {
|
|
if (validLinks.has(dest)) {
|
|
links.push({ source, target: dest });
|
|
}
|
|
}
|
|
if (showTags) {
|
|
const localTags = details.tags.filter((tag) => !removeTags.includes(tag)).map((tag) => simplifySlug("tags/" + tag));
|
|
tags.push(...localTags.filter((tag) => !tags.includes(tag)));
|
|
for (const tag of localTags) {
|
|
links.push({ source, target: tag });
|
|
}
|
|
}
|
|
}
|
|
const neighbourhood = /* @__PURE__ */ new Set();
|
|
const wl = [slug2, "__SENTINEL"];
|
|
if (depth >= 0) {
|
|
while (depth >= 0 && wl.length > 0) {
|
|
const cur = wl.shift();
|
|
if (cur === "__SENTINEL") {
|
|
depth--;
|
|
wl.push("__SENTINEL");
|
|
} else {
|
|
neighbourhood.add(cur);
|
|
const outgoing = links.filter((l) => l.source === cur);
|
|
const incoming = links.filter((l) => l.target === cur);
|
|
wl.push(...outgoing.map((l) => l.target), ...incoming.map((l) => l.source));
|
|
}
|
|
}
|
|
} else {
|
|
Object.keys(data).forEach((id2) => neighbourhood.add(simplifySlug(id2)));
|
|
if (showTags)
|
|
tags.forEach((tag) => neighbourhood.add(tag));
|
|
}
|
|
const graphData = {
|
|
nodes: [...neighbourhood].map((url) => {
|
|
const text = url.startsWith("tags/") ? "#" + url.substring(5) : data[url]?.title ?? url;
|
|
return {
|
|
id: url,
|
|
text,
|
|
tags: data[url]?.tags ?? []
|
|
};
|
|
}),
|
|
links: links.filter((l) => neighbourhood.has(l.source) && neighbourhood.has(l.target))
|
|
};
|
|
const simulation = simulation_default(graphData.nodes).force("charge", manyBody_default().strength(-100 * repelForce)).force(
|
|
"link",
|
|
link_default(graphData.links).id((d) => d.id).distance(linkDistance)
|
|
).force("center", center_default().strength(centerForce));
|
|
const height = Math.max(graph.offsetHeight, 250);
|
|
const width = graph.offsetWidth;
|
|
const svg = select_default2("#" + container).append("svg").attr("width", width).attr("height", height).attr("viewBox", [-width / 2 / scale, -height / 2 / scale, width / scale, height / scale]);
|
|
const link = svg.append("g").selectAll("line").data(graphData.links).join("line").attr("class", "link").attr("stroke", "var(--lightgray)").attr("stroke-width", 1);
|
|
const graphNode = svg.append("g").selectAll("g").data(graphData.nodes).enter().append("g");
|
|
const color2 = (d) => {
|
|
const isCurrent = d.id === slug2;
|
|
if (isCurrent) {
|
|
return "var(--secondary)";
|
|
} else if (visited.has(d.id) || d.id.startsWith("tags/")) {
|
|
return "var(--tertiary)";
|
|
} else {
|
|
return "var(--gray)";
|
|
}
|
|
};
|
|
const drag = (simulation2) => {
|
|
function dragstarted(event, d) {
|
|
if (!event.active)
|
|
simulation2.alphaTarget(1).restart();
|
|
d.fx = d.x;
|
|
d.fy = d.y;
|
|
}
|
|
function dragged(event, d) {
|
|
d.fx = event.x;
|
|
d.fy = event.y;
|
|
}
|
|
function dragended(event, d) {
|
|
if (!event.active)
|
|
simulation2.alphaTarget(0);
|
|
d.fx = null;
|
|
d.fy = null;
|
|
}
|
|
const noop2 = () => {
|
|
};
|
|
return drag_default().on("start", enableDrag ? dragstarted : noop2).on("drag", enableDrag ? dragged : noop2).on("end", enableDrag ? dragended : noop2);
|
|
};
|
|
function nodeRadius(d) {
|
|
const numLinks = links.filter((l) => l.source.id === d.id || l.target.id === d.id).length;
|
|
return 2 + Math.sqrt(numLinks);
|
|
}
|
|
const node = graphNode.append("circle").attr("class", "node").attr("id", (d) => d.id).attr("r", nodeRadius).attr("fill", color2).style("cursor", "pointer").on("click", (_, d) => {
|
|
const targ = resolveRelative(fullSlug, d.id);
|
|
window.spaNavigate(new URL(targ, window.location.toString()));
|
|
}).on("mouseover", function(_, d) {
|
|
const neighbours = data[fullSlug].links ?? [];
|
|
const neighbourNodes = selectAll_default2(".node").filter((d2) => neighbours.includes(d2.id));
|
|
const currentId = d.id;
|
|
const linkNodes = selectAll_default2(".link").filter((d2) => d2.source.id === currentId || d2.target.id === currentId);
|
|
neighbourNodes.transition().duration(200).attr("fill", color2);
|
|
linkNodes.transition().duration(200).attr("stroke", "var(--gray)").attr("stroke-width", 1);
|
|
const bigFont = fontSize * 1.5;
|
|
const parent = this.parentNode;
|
|
select_default2(parent).raise().select("text").transition().duration(200).attr("opacityOld", select_default2(parent).select("text").style("opacity")).style("opacity", 1).style("font-size", bigFont + "em");
|
|
}).on("mouseleave", function(_, d) {
|
|
const currentId = d.id;
|
|
const linkNodes = selectAll_default2(".link").filter((d2) => d2.source.id === currentId || d2.target.id === currentId);
|
|
linkNodes.transition().duration(200).attr("stroke", "var(--lightgray)");
|
|
const parent = this.parentNode;
|
|
select_default2(parent).select("text").transition().duration(200).style("opacity", select_default2(parent).select("text").attr("opacityOld")).style("font-size", fontSize + "em");
|
|
}).call(drag(simulation));
|
|
const labels = graphNode.append("text").attr("dx", 0).attr("dy", (d) => -nodeRadius(d) + "px").attr("text-anchor", "middle").text((d) => d.text).style("opacity", (opacityScale - 1) / 3.75).style("pointer-events", "none").style("font-size", fontSize + "em").raise().call(drag(simulation));
|
|
if (enableZoom) {
|
|
svg.call(
|
|
zoom_default2().extent([
|
|
[0, 0],
|
|
[width, height]
|
|
]).scaleExtent([0.25, 4]).on("zoom", ({ transform: transform2 }) => {
|
|
link.attr("transform", transform2);
|
|
node.attr("transform", transform2);
|
|
const scale2 = transform2.k * opacityScale;
|
|
const scaledOpacity = Math.max((scale2 - 1) / 3.75, 0);
|
|
labels.attr("transform", transform2).style("opacity", scaledOpacity);
|
|
})
|
|
);
|
|
}
|
|
simulation.on("tick", () => {
|
|
link.attr("x1", (d) => d.source.x).attr("y1", (d) => d.source.y).attr("x2", (d) => d.target.x).attr("y2", (d) => d.target.y);
|
|
node.attr("cx", (d) => d.x).attr("cy", (d) => d.y);
|
|
labels.attr("x", (d) => d.x).attr("y", (d) => d.y);
|
|
});
|
|
}
|
|
function renderGlobalGraph() {
|
|
const slug2 = getFullSlug(window);
|
|
const container = document.getElementById("global-graph-outer");
|
|
const sidebar = container?.closest(".sidebar");
|
|
container?.classList.add("active");
|
|
if (sidebar) {
|
|
sidebar.style.zIndex = "1";
|
|
}
|
|
renderGraph("global-graph-container", slug2);
|
|
function hideGlobalGraph() {
|
|
container?.classList.remove("active");
|
|
const graph = document.getElementById("global-graph-container");
|
|
if (sidebar) {
|
|
sidebar.style.zIndex = "unset";
|
|
}
|
|
if (!graph)
|
|
return;
|
|
removeAllChildren(graph);
|
|
}
|
|
registerEscapeHandler(container, hideGlobalGraph);
|
|
}
|
|
document.addEventListener("nav", async (e) => {
|
|
const slug2 = e.detail.url;
|
|
addToVisited(slug2);
|
|
await renderGraph("graph-container", slug2);
|
|
const containerIcon = document.getElementById("global-graph-icon");
|
|
containerIcon?.removeEventListener("click", renderGlobalGraph);
|
|
containerIcon?.addEventListener("click", renderGlobalGraph);
|
|
});
|
|
})();
|
|
(function () {// quartz/components/scripts/quartz/components/scripts/toc.inline.ts
|
|
var observer = new IntersectionObserver((entries) => {
|
|
for (const entry of entries) {
|
|
const slug = entry.target.id;
|
|
const tocEntryElement = document.querySelector(`a[data-for="${slug}"]`);
|
|
const windowHeight = entry.rootBounds?.height;
|
|
if (windowHeight && tocEntryElement) {
|
|
if (entry.boundingClientRect.y < windowHeight) {
|
|
tocEntryElement.classList.add("in-view");
|
|
} else {
|
|
tocEntryElement.classList.remove("in-view");
|
|
}
|
|
}
|
|
}
|
|
});
|
|
function toggleToc() {
|
|
this.classList.toggle("collapsed");
|
|
const content = this.nextElementSibling;
|
|
content.classList.toggle("collapsed");
|
|
content.style.maxHeight = content.style.maxHeight === "0px" ? content.scrollHeight + "px" : "0px";
|
|
}
|
|
function setupToc() {
|
|
const toc = document.getElementById("toc");
|
|
if (toc) {
|
|
const content = toc.nextElementSibling;
|
|
content.style.maxHeight = content.scrollHeight + "px";
|
|
toc.removeEventListener("click", toggleToc);
|
|
toc.addEventListener("click", toggleToc);
|
|
}
|
|
}
|
|
window.addEventListener("resize", setupToc);
|
|
document.addEventListener("nav", () => {
|
|
setupToc();
|
|
observer.disconnect();
|
|
const headers = document.querySelectorAll("h1[id], h2[id], h3[id], h4[id], h5[id], h6[id]");
|
|
headers.forEach((header) => observer.observe(header));
|
|
});
|
|
})();
|
|
(function () {// node_modules/@floating-ui/core/dist/floating-ui.core.browser.min.mjs
|
|
function t(t2) {
|
|
return t2.split("-")[1];
|
|
}
|
|
function e(t2) {
|
|
return "y" === t2 ? "height" : "width";
|
|
}
|
|
function n(t2) {
|
|
return t2.split("-")[0];
|
|
}
|
|
function o(t2) {
|
|
return ["top", "bottom"].includes(n(t2)) ? "x" : "y";
|
|
}
|
|
function i(i3, r3, a3) {
|
|
let { reference: l3, floating: s3 } = i3;
|
|
const c3 = l3.x + l3.width / 2 - s3.width / 2, f3 = l3.y + l3.height / 2 - s3.height / 2, m3 = o(r3), u3 = e(m3), g3 = l3[u3] / 2 - s3[u3] / 2, d3 = "x" === m3;
|
|
let p4;
|
|
switch (n(r3)) {
|
|
case "top":
|
|
p4 = { x: c3, y: l3.y - s3.height };
|
|
break;
|
|
case "bottom":
|
|
p4 = { x: c3, y: l3.y + l3.height };
|
|
break;
|
|
case "right":
|
|
p4 = { x: l3.x + l3.width, y: f3 };
|
|
break;
|
|
case "left":
|
|
p4 = { x: l3.x - s3.width, y: f3 };
|
|
break;
|
|
default:
|
|
p4 = { x: l3.x, y: l3.y };
|
|
}
|
|
switch (t(r3)) {
|
|
case "start":
|
|
p4[m3] -= g3 * (a3 && d3 ? -1 : 1);
|
|
break;
|
|
case "end":
|
|
p4[m3] += g3 * (a3 && d3 ? -1 : 1);
|
|
}
|
|
return p4;
|
|
}
|
|
var r = async (t2, e2, n3) => {
|
|
const { placement: o3 = "bottom", strategy: r3 = "absolute", middleware: a3 = [], platform: l3 } = n3, s3 = a3.filter(Boolean), c3 = await (null == l3.isRTL ? void 0 : l3.isRTL(e2));
|
|
let f3 = await l3.getElementRects({ reference: t2, floating: e2, strategy: r3 }), { x: m3, y: u3 } = i(f3, o3, c3), g3 = o3, d3 = {}, p4 = 0;
|
|
for (let n4 = 0; n4 < s3.length; n4++) {
|
|
const { name: a4, fn: h3 } = s3[n4], { x: y2, y: x3, data: w3, reset: v3 } = await h3({ x: m3, y: u3, initialPlacement: o3, placement: g3, strategy: r3, middlewareData: d3, rects: f3, platform: l3, elements: { reference: t2, floating: e2 } });
|
|
m3 = null != y2 ? y2 : m3, u3 = null != x3 ? x3 : u3, d3 = { ...d3, [a4]: { ...d3[a4], ...w3 } }, v3 && p4 <= 50 && (p4++, "object" == typeof v3 && (v3.placement && (g3 = v3.placement), v3.rects && (f3 = true === v3.rects ? await l3.getElementRects({ reference: t2, floating: e2, strategy: r3 }) : v3.rects), { x: m3, y: u3 } = i(f3, g3, c3)), n4 = -1);
|
|
}
|
|
return { x: m3, y: u3, placement: g3, strategy: r3, middlewareData: d3 };
|
|
};
|
|
function a(t2, e2) {
|
|
return "function" == typeof t2 ? t2(e2) : t2;
|
|
}
|
|
function l(t2) {
|
|
return "number" != typeof t2 ? function(t3) {
|
|
return { top: 0, right: 0, bottom: 0, left: 0, ...t3 };
|
|
}(t2) : { top: t2, right: t2, bottom: t2, left: t2 };
|
|
}
|
|
function s(t2) {
|
|
return { ...t2, top: t2.y, left: t2.x, right: t2.x + t2.width, bottom: t2.y + t2.height };
|
|
}
|
|
async function c(t2, e2) {
|
|
var n3;
|
|
void 0 === e2 && (e2 = {});
|
|
const { x: o3, y: i3, platform: r3, rects: c3, elements: f3, strategy: m3 } = t2, { boundary: u3 = "clippingAncestors", rootBoundary: g3 = "viewport", elementContext: d3 = "floating", altBoundary: p4 = false, padding: h3 = 0 } = a(e2, t2), y2 = l(h3), x3 = f3[p4 ? "floating" === d3 ? "reference" : "floating" : d3], w3 = s(await r3.getClippingRect({ element: null == (n3 = await (null == r3.isElement ? void 0 : r3.isElement(x3))) || n3 ? x3 : x3.contextElement || await (null == r3.getDocumentElement ? void 0 : r3.getDocumentElement(f3.floating)), boundary: u3, rootBoundary: g3, strategy: m3 })), v3 = "floating" === d3 ? { ...c3.floating, x: o3, y: i3 } : c3.reference, b3 = await (null == r3.getOffsetParent ? void 0 : r3.getOffsetParent(f3.floating)), A3 = await (null == r3.isElement ? void 0 : r3.isElement(b3)) && await (null == r3.getScale ? void 0 : r3.getScale(b3)) || { x: 1, y: 1 }, R2 = s(r3.convertOffsetParentRelativeRectToViewportRelativeRect ? await r3.convertOffsetParentRelativeRectToViewportRelativeRect({ rect: v3, offsetParent: b3, strategy: m3 }) : v3);
|
|
return { top: (w3.top - R2.top + y2.top) / A3.y, bottom: (R2.bottom - w3.bottom + y2.bottom) / A3.y, left: (w3.left - R2.left + y2.left) / A3.x, right: (R2.right - w3.right + y2.right) / A3.x };
|
|
}
|
|
var f = Math.min;
|
|
var m = Math.max;
|
|
function u(t2, e2, n3) {
|
|
return m(t2, f(e2, n3));
|
|
}
|
|
var d = ["top", "right", "bottom", "left"];
|
|
var p = d.reduce((t2, e2) => t2.concat(e2, e2 + "-start", e2 + "-end"), []);
|
|
var h = { left: "right", right: "left", bottom: "top", top: "bottom" };
|
|
function y(t2) {
|
|
return t2.replace(/left|right|bottom|top/g, (t3) => h[t3]);
|
|
}
|
|
function x(n3, i3, r3) {
|
|
void 0 === r3 && (r3 = false);
|
|
const a3 = t(n3), l3 = o(n3), s3 = e(l3);
|
|
let c3 = "x" === l3 ? a3 === (r3 ? "end" : "start") ? "right" : "left" : "start" === a3 ? "bottom" : "top";
|
|
return i3.reference[s3] > i3.floating[s3] && (c3 = y(c3)), { main: c3, cross: y(c3) };
|
|
}
|
|
var w = { start: "end", end: "start" };
|
|
function v(t2) {
|
|
return t2.replace(/start|end/g, (t3) => w[t3]);
|
|
}
|
|
var A = function(e2) {
|
|
return void 0 === e2 && (e2 = {}), { name: "flip", options: e2, async fn(o3) {
|
|
var i3;
|
|
const { placement: r3, middlewareData: l3, rects: s3, initialPlacement: f3, platform: m3, elements: u3 } = o3, { mainAxis: g3 = true, crossAxis: d3 = true, fallbackPlacements: p4, fallbackStrategy: h3 = "bestFit", fallbackAxisSideDirection: w3 = "none", flipAlignment: b3 = true, ...A3 } = a(e2, o3), R2 = n(r3), P2 = n(f3) === f3, E3 = await (null == m3.isRTL ? void 0 : m3.isRTL(u3.floating)), T3 = p4 || (P2 || !b3 ? [y(f3)] : function(t2) {
|
|
const e3 = y(t2);
|
|
return [v(t2), e3, v(e3)];
|
|
}(f3));
|
|
p4 || "none" === w3 || T3.push(...function(e3, o4, i4, r4) {
|
|
const a3 = t(e3);
|
|
let l4 = function(t2, e4, n3) {
|
|
const o5 = ["left", "right"], i5 = ["right", "left"], r5 = ["top", "bottom"], a4 = ["bottom", "top"];
|
|
switch (t2) {
|
|
case "top":
|
|
case "bottom":
|
|
return n3 ? e4 ? i5 : o5 : e4 ? o5 : i5;
|
|
case "left":
|
|
case "right":
|
|
return e4 ? r5 : a4;
|
|
default:
|
|
return [];
|
|
}
|
|
}(n(e3), "start" === i4, r4);
|
|
return a3 && (l4 = l4.map((t2) => t2 + "-" + a3), o4 && (l4 = l4.concat(l4.map(v)))), l4;
|
|
}(f3, b3, w3, E3));
|
|
const D3 = [f3, ...T3], L3 = await c(o3, A3), k2 = [];
|
|
let O3 = (null == (i3 = l3.flip) ? void 0 : i3.overflows) || [];
|
|
if (g3 && k2.push(L3[R2]), d3) {
|
|
const { main: t2, cross: e3 } = x(r3, s3, E3);
|
|
k2.push(L3[t2], L3[e3]);
|
|
}
|
|
if (O3 = [...O3, { placement: r3, overflows: k2 }], !k2.every((t2) => t2 <= 0)) {
|
|
var B3, C3;
|
|
const t2 = ((null == (B3 = l3.flip) ? void 0 : B3.index) || 0) + 1, e3 = D3[t2];
|
|
if (e3)
|
|
return { data: { index: t2, overflows: O3 }, reset: { placement: e3 } };
|
|
let n3 = null == (C3 = O3.filter((t3) => t3.overflows[0] <= 0).sort((t3, e4) => t3.overflows[1] - e4.overflows[1])[0]) ? void 0 : C3.placement;
|
|
if (!n3)
|
|
switch (h3) {
|
|
case "bestFit": {
|
|
var H2;
|
|
const t3 = null == (H2 = O3.map((t4) => [t4.placement, t4.overflows.filter((t5) => t5 > 0).reduce((t5, e4) => t5 + e4, 0)]).sort((t4, e4) => t4[1] - e4[1])[0]) ? void 0 : H2[0];
|
|
t3 && (n3 = t3);
|
|
break;
|
|
}
|
|
case "initialPlacement":
|
|
n3 = f3;
|
|
}
|
|
if (r3 !== n3)
|
|
return { reset: { placement: n3 } };
|
|
}
|
|
return {};
|
|
} };
|
|
};
|
|
function T(t2) {
|
|
const e2 = f(...t2.map((t3) => t3.left)), n3 = f(...t2.map((t3) => t3.top));
|
|
return { x: e2, y: n3, width: m(...t2.map((t3) => t3.right)) - e2, height: m(...t2.map((t3) => t3.bottom)) - n3 };
|
|
}
|
|
var D = function(t2) {
|
|
return void 0 === t2 && (t2 = {}), { name: "inline", options: t2, async fn(e2) {
|
|
const { placement: i3, elements: r3, rects: c3, platform: u3, strategy: g3 } = e2, { padding: d3 = 2, x: p4, y: h3 } = a(t2, e2), y2 = Array.from(await (null == u3.getClientRects ? void 0 : u3.getClientRects(r3.reference)) || []), x3 = function(t3) {
|
|
const e3 = t3.slice().sort((t4, e4) => t4.y - e4.y), n3 = [];
|
|
let o3 = null;
|
|
for (let t4 = 0; t4 < e3.length; t4++) {
|
|
const i4 = e3[t4];
|
|
!o3 || i4.y - o3.y > o3.height / 2 ? n3.push([i4]) : n3[n3.length - 1].push(i4), o3 = i4;
|
|
}
|
|
return n3.map((t4) => s(T(t4)));
|
|
}(y2), w3 = s(T(y2)), v3 = l(d3);
|
|
const b3 = await u3.getElementRects({ reference: { getBoundingClientRect: function() {
|
|
if (2 === x3.length && x3[0].left > x3[1].right && null != p4 && null != h3)
|
|
return x3.find((t3) => p4 > t3.left - v3.left && p4 < t3.right + v3.right && h3 > t3.top - v3.top && h3 < t3.bottom + v3.bottom) || w3;
|
|
if (x3.length >= 2) {
|
|
if ("x" === o(i3)) {
|
|
const t4 = x3[0], e4 = x3[x3.length - 1], o3 = "top" === n(i3), r5 = t4.top, a4 = e4.bottom, l4 = o3 ? t4.left : e4.left, s4 = o3 ? t4.right : e4.right;
|
|
return { top: r5, bottom: a4, left: l4, right: s4, width: s4 - l4, height: a4 - r5, x: l4, y: r5 };
|
|
}
|
|
const t3 = "left" === n(i3), e3 = m(...x3.map((t4) => t4.right)), r4 = f(...x3.map((t4) => t4.left)), a3 = x3.filter((n3) => t3 ? n3.left === r4 : n3.right === e3), l3 = a3[0].top, s3 = a3[a3.length - 1].bottom;
|
|
return { top: l3, bottom: s3, left: r4, right: e3, width: e3 - r4, height: s3 - l3, x: r4, y: l3 };
|
|
}
|
|
return w3;
|
|
} }, floating: r3.floating, strategy: g3 });
|
|
return c3.reference.x !== b3.reference.x || c3.reference.y !== b3.reference.y || c3.reference.width !== b3.reference.width || c3.reference.height !== b3.reference.height ? { reset: { rects: b3 } } : {};
|
|
} };
|
|
};
|
|
function k(t2) {
|
|
return "x" === t2 ? "y" : "x";
|
|
}
|
|
var O = function(t2) {
|
|
return void 0 === t2 && (t2 = {}), { name: "shift", options: t2, async fn(e2) {
|
|
const { x: i3, y: r3, placement: l3 } = e2, { mainAxis: s3 = true, crossAxis: f3 = false, limiter: m3 = { fn: (t3) => {
|
|
let { x: e3, y: n3 } = t3;
|
|
return { x: e3, y: n3 };
|
|
} }, ...g3 } = a(t2, e2), d3 = { x: i3, y: r3 }, p4 = await c(e2, g3), h3 = o(n(l3)), y2 = k(h3);
|
|
let x3 = d3[h3], w3 = d3[y2];
|
|
if (s3) {
|
|
const t3 = "y" === h3 ? "bottom" : "right";
|
|
x3 = u(x3 + p4["y" === h3 ? "top" : "left"], x3, x3 - p4[t3]);
|
|
}
|
|
if (f3) {
|
|
const t3 = "y" === y2 ? "bottom" : "right";
|
|
w3 = u(w3 + p4["y" === y2 ? "top" : "left"], w3, w3 - p4[t3]);
|
|
}
|
|
const v3 = m3.fn({ ...e2, [h3]: x3, [y2]: w3 });
|
|
return { ...v3, data: { x: v3.x - i3, y: v3.y - r3 } };
|
|
} };
|
|
};
|
|
|
|
// node_modules/@floating-ui/dom/dist/floating-ui.dom.browser.min.mjs
|
|
function n2(t2) {
|
|
var e2;
|
|
return (null == (e2 = t2.ownerDocument) ? void 0 : e2.defaultView) || window;
|
|
}
|
|
function o2(t2) {
|
|
return n2(t2).getComputedStyle(t2);
|
|
}
|
|
function i2(t2) {
|
|
return t2 instanceof n2(t2).Node;
|
|
}
|
|
function r2(t2) {
|
|
return i2(t2) ? (t2.nodeName || "").toLowerCase() : "#document";
|
|
}
|
|
function c2(t2) {
|
|
return t2 instanceof n2(t2).HTMLElement;
|
|
}
|
|
function l2(t2) {
|
|
return t2 instanceof n2(t2).Element;
|
|
}
|
|
function s2(t2) {
|
|
return "undefined" != typeof ShadowRoot && (t2 instanceof n2(t2).ShadowRoot || t2 instanceof ShadowRoot);
|
|
}
|
|
function f2(t2) {
|
|
const { overflow: e2, overflowX: n3, overflowY: i3, display: r3 } = o2(t2);
|
|
return /auto|scroll|overlay|hidden|clip/.test(e2 + i3 + n3) && !["inline", "contents"].includes(r3);
|
|
}
|
|
function u2(t2) {
|
|
return ["table", "td", "th"].includes(r2(t2));
|
|
}
|
|
function a2(t2) {
|
|
const e2 = d2(), n3 = o2(t2);
|
|
return "none" !== n3.transform || "none" !== n3.perspective || !!n3.containerType && "normal" !== n3.containerType || !e2 && !!n3.backdropFilter && "none" !== n3.backdropFilter || !e2 && !!n3.filter && "none" !== n3.filter || ["transform", "perspective", "filter"].some((t3) => (n3.willChange || "").includes(t3)) || ["paint", "layout", "strict", "content"].some((t3) => (n3.contain || "").includes(t3));
|
|
}
|
|
function d2() {
|
|
return !("undefined" == typeof CSS || !CSS.supports) && CSS.supports("-webkit-backdrop-filter", "none");
|
|
}
|
|
function h2(t2) {
|
|
return ["html", "body", "#document"].includes(r2(t2));
|
|
}
|
|
var p2 = Math.min;
|
|
var m2 = Math.max;
|
|
var g2 = Math.round;
|
|
var w2 = (t2) => ({ x: t2, y: t2 });
|
|
function x2(t2) {
|
|
const e2 = o2(t2);
|
|
let n3 = parseFloat(e2.width) || 0, i3 = parseFloat(e2.height) || 0;
|
|
const r3 = c2(t2), l3 = r3 ? t2.offsetWidth : n3, s3 = r3 ? t2.offsetHeight : i3, f3 = g2(n3) !== l3 || g2(i3) !== s3;
|
|
return f3 && (n3 = l3, i3 = s3), { width: n3, height: i3, $: f3 };
|
|
}
|
|
function v2(t2) {
|
|
return l2(t2) ? t2 : t2.contextElement;
|
|
}
|
|
function b2(t2) {
|
|
const e2 = v2(t2);
|
|
if (!c2(e2))
|
|
return w2(1);
|
|
const n3 = e2.getBoundingClientRect(), { width: o3, height: i3, $: r3 } = x2(e2);
|
|
let l3 = (r3 ? g2(n3.width) : n3.width) / o3, s3 = (r3 ? g2(n3.height) : n3.height) / i3;
|
|
return l3 && Number.isFinite(l3) || (l3 = 1), s3 && Number.isFinite(s3) || (s3 = 1), { x: l3, y: s3 };
|
|
}
|
|
var L2 = w2(0);
|
|
function T2(t2, e2, o3) {
|
|
var i3, r3;
|
|
if (void 0 === e2 && (e2 = true), !d2())
|
|
return L2;
|
|
const c3 = t2 ? n2(t2) : window;
|
|
return !o3 || e2 && o3 !== c3 ? L2 : { x: (null == (i3 = c3.visualViewport) ? void 0 : i3.offsetLeft) || 0, y: (null == (r3 = c3.visualViewport) ? void 0 : r3.offsetTop) || 0 };
|
|
}
|
|
function R(e2, o3, i3, r3) {
|
|
void 0 === o3 && (o3 = false), void 0 === i3 && (i3 = false);
|
|
const c3 = e2.getBoundingClientRect(), s3 = v2(e2);
|
|
let f3 = w2(1);
|
|
o3 && (r3 ? l2(r3) && (f3 = b2(r3)) : f3 = b2(e2));
|
|
const u3 = T2(s3, i3, r3);
|
|
let a3 = (c3.left + u3.x) / f3.x, d3 = (c3.top + u3.y) / f3.y, h3 = c3.width / f3.x, p4 = c3.height / f3.y;
|
|
if (s3) {
|
|
const t2 = n2(s3), e3 = r3 && l2(r3) ? n2(r3) : r3;
|
|
let o4 = t2.frameElement;
|
|
for (; o4 && r3 && e3 !== t2; ) {
|
|
const t3 = b2(o4), e4 = o4.getBoundingClientRect(), i4 = getComputedStyle(o4), r4 = e4.left + (o4.clientLeft + parseFloat(i4.paddingLeft)) * t3.x, c4 = e4.top + (o4.clientTop + parseFloat(i4.paddingTop)) * t3.y;
|
|
a3 *= t3.x, d3 *= t3.y, h3 *= t3.x, p4 *= t3.y, a3 += r4, d3 += c4, o4 = n2(o4).frameElement;
|
|
}
|
|
}
|
|
return s({ width: h3, height: p4, x: a3, y: d3 });
|
|
}
|
|
function S(t2) {
|
|
return ((i2(t2) ? t2.ownerDocument : t2.document) || window.document).documentElement;
|
|
}
|
|
function E2(t2) {
|
|
return l2(t2) ? { scrollLeft: t2.scrollLeft, scrollTop: t2.scrollTop } : { scrollLeft: t2.pageXOffset, scrollTop: t2.pageYOffset };
|
|
}
|
|
function C2(t2) {
|
|
return R(S(t2)).left + E2(t2).scrollLeft;
|
|
}
|
|
function F(t2) {
|
|
if ("html" === r2(t2))
|
|
return t2;
|
|
const e2 = t2.assignedSlot || t2.parentNode || s2(t2) && t2.host || S(t2);
|
|
return s2(e2) ? e2.host : e2;
|
|
}
|
|
function O2(t2) {
|
|
const e2 = F(t2);
|
|
return h2(e2) ? t2.ownerDocument ? t2.ownerDocument.body : t2.body : c2(e2) && f2(e2) ? e2 : O2(e2);
|
|
}
|
|
function D2(t2, e2) {
|
|
var o3;
|
|
void 0 === e2 && (e2 = []);
|
|
const i3 = O2(t2), r3 = i3 === (null == (o3 = t2.ownerDocument) ? void 0 : o3.body), c3 = n2(i3);
|
|
return r3 ? e2.concat(c3, c3.visualViewport || [], f2(i3) ? i3 : []) : e2.concat(i3, D2(i3));
|
|
}
|
|
function W(e2, i3, r3) {
|
|
let s3;
|
|
if ("viewport" === i3)
|
|
s3 = function(t2, e3) {
|
|
const o3 = n2(t2), i4 = S(t2), r4 = o3.visualViewport;
|
|
let c3 = i4.clientWidth, l3 = i4.clientHeight, s4 = 0, f3 = 0;
|
|
if (r4) {
|
|
c3 = r4.width, l3 = r4.height;
|
|
const t3 = d2();
|
|
(!t3 || t3 && "fixed" === e3) && (s4 = r4.offsetLeft, f3 = r4.offsetTop);
|
|
}
|
|
return { width: c3, height: l3, x: s4, y: f3 };
|
|
}(e2, r3);
|
|
else if ("document" === i3)
|
|
s3 = function(t2) {
|
|
const e3 = S(t2), n3 = E2(t2), i4 = t2.ownerDocument.body, r4 = m2(e3.scrollWidth, e3.clientWidth, i4.scrollWidth, i4.clientWidth), c3 = m2(e3.scrollHeight, e3.clientHeight, i4.scrollHeight, i4.clientHeight);
|
|
let l3 = -n3.scrollLeft + C2(t2);
|
|
const s4 = -n3.scrollTop;
|
|
return "rtl" === o2(i4).direction && (l3 += m2(e3.clientWidth, i4.clientWidth) - r4), { width: r4, height: c3, x: l3, y: s4 };
|
|
}(S(e2));
|
|
else if (l2(i3))
|
|
s3 = function(t2, e3) {
|
|
const n3 = R(t2, true, "fixed" === e3), o3 = n3.top + t2.clientTop, i4 = n3.left + t2.clientLeft, r4 = c2(t2) ? b2(t2) : w2(1);
|
|
return { width: t2.clientWidth * r4.x, height: t2.clientHeight * r4.y, x: i4 * r4.x, y: o3 * r4.y };
|
|
}(i3, r3);
|
|
else {
|
|
const t2 = T2(e2);
|
|
s3 = { ...i3, x: i3.x - t2.x, y: i3.y - t2.y };
|
|
}
|
|
return s(s3);
|
|
}
|
|
function H(t2, e2) {
|
|
const n3 = F(t2);
|
|
return !(n3 === e2 || !l2(n3) || h2(n3)) && ("fixed" === o2(n3).position || H(n3, e2));
|
|
}
|
|
function z(t2, e2) {
|
|
return c2(t2) && "fixed" !== o2(t2).position ? e2 ? e2(t2) : t2.offsetParent : null;
|
|
}
|
|
function M(t2, e2) {
|
|
const i3 = n2(t2);
|
|
if (!c2(t2))
|
|
return i3;
|
|
let l3 = z(t2, e2);
|
|
for (; l3 && u2(l3) && "static" === o2(l3).position; )
|
|
l3 = z(l3, e2);
|
|
return l3 && ("html" === r2(l3) || "body" === r2(l3) && "static" === o2(l3).position && !a2(l3)) ? i3 : l3 || function(t3) {
|
|
let e3 = F(t3);
|
|
for (; c2(e3) && !h2(e3); ) {
|
|
if (a2(e3))
|
|
return e3;
|
|
e3 = F(e3);
|
|
}
|
|
return null;
|
|
}(t2) || i3;
|
|
}
|
|
function P(t2, e2, n3) {
|
|
const o3 = c2(e2), i3 = S(e2), l3 = "fixed" === n3, s3 = R(t2, true, l3, e2);
|
|
let u3 = { scrollLeft: 0, scrollTop: 0 };
|
|
const a3 = w2(0);
|
|
if (o3 || !o3 && !l3)
|
|
if (("body" !== r2(e2) || f2(i3)) && (u3 = E2(e2)), c2(e2)) {
|
|
const t3 = R(e2, true, l3, e2);
|
|
a3.x = t3.x + e2.clientLeft, a3.y = t3.y + e2.clientTop;
|
|
} else
|
|
i3 && (a3.x = C2(i3));
|
|
return { x: s3.left + u3.scrollLeft - a3.x, y: s3.top + u3.scrollTop - a3.y, width: s3.width, height: s3.height };
|
|
}
|
|
var A2 = { getClippingRect: function(t2) {
|
|
let { element: e2, boundary: n3, rootBoundary: i3, strategy: c3 } = t2;
|
|
const s3 = "clippingAncestors" === n3 ? function(t3, e3) {
|
|
const n4 = e3.get(t3);
|
|
if (n4)
|
|
return n4;
|
|
let i4 = D2(t3).filter((t4) => l2(t4) && "body" !== r2(t4)), c4 = null;
|
|
const s4 = "fixed" === o2(t3).position;
|
|
let u4 = s4 ? F(t3) : t3;
|
|
for (; l2(u4) && !h2(u4); ) {
|
|
const e4 = o2(u4), n5 = a2(u4);
|
|
n5 || "fixed" !== e4.position || (c4 = null), (s4 ? !n5 && !c4 : !n5 && "static" === e4.position && c4 && ["absolute", "fixed"].includes(c4.position) || f2(u4) && !n5 && H(t3, u4)) ? i4 = i4.filter((t4) => t4 !== u4) : c4 = e4, u4 = F(u4);
|
|
}
|
|
return e3.set(t3, i4), i4;
|
|
}(e2, this._c) : [].concat(n3), u3 = [...s3, i3], d3 = u3[0], g3 = u3.reduce((t3, n4) => {
|
|
const o3 = W(e2, n4, c3);
|
|
return t3.top = m2(o3.top, t3.top), t3.right = p2(o3.right, t3.right), t3.bottom = p2(o3.bottom, t3.bottom), t3.left = m2(o3.left, t3.left), t3;
|
|
}, W(e2, d3, c3));
|
|
return { width: g3.right - g3.left, height: g3.bottom - g3.top, x: g3.left, y: g3.top };
|
|
}, convertOffsetParentRelativeRectToViewportRelativeRect: function(t2) {
|
|
let { rect: e2, offsetParent: n3, strategy: o3 } = t2;
|
|
const i3 = c2(n3), l3 = S(n3);
|
|
if (n3 === l3)
|
|
return e2;
|
|
let s3 = { scrollLeft: 0, scrollTop: 0 }, u3 = w2(1);
|
|
const a3 = w2(0);
|
|
if ((i3 || !i3 && "fixed" !== o3) && (("body" !== r2(n3) || f2(l3)) && (s3 = E2(n3)), c2(n3))) {
|
|
const t3 = R(n3);
|
|
u3 = b2(n3), a3.x = t3.x + n3.clientLeft, a3.y = t3.y + n3.clientTop;
|
|
}
|
|
return { width: e2.width * u3.x, height: e2.height * u3.y, x: e2.x * u3.x - s3.scrollLeft * u3.x + a3.x, y: e2.y * u3.y - s3.scrollTop * u3.y + a3.y };
|
|
}, isElement: l2, getDimensions: function(t2) {
|
|
return x2(t2);
|
|
}, getOffsetParent: M, getDocumentElement: S, getScale: b2, async getElementRects(t2) {
|
|
let { reference: e2, floating: n3, strategy: o3 } = t2;
|
|
const i3 = this.getOffsetParent || M, r3 = this.getDimensions;
|
|
return { reference: P(e2, await i3(n3), o3), floating: { x: 0, y: 0, ...await r3(n3) } };
|
|
}, getClientRects: (t2) => Array.from(t2.getClientRects()), isRTL: (t2) => "rtl" === o2(t2).direction };
|
|
var B2 = (t2, n3, o3) => {
|
|
const i3 = /* @__PURE__ */ new Map(), r3 = { platform: A2, ...o3 }, c3 = { ...r3.platform, _c: i3 };
|
|
return r(t2, n3, { ...r3, platform: c3 });
|
|
};
|
|
|
|
// quartz/components/scripts/quartz/components/scripts/popover.inline.ts
|
|
function normalizeRelativeURLs(el, base) {
|
|
const update = (el2, attr, base2) => {
|
|
el2.setAttribute(attr, new URL(el2.getAttribute(attr), base2).pathname);
|
|
};
|
|
el.querySelectorAll('[href^="./"], [href^="../"]').forEach((item) => update(item, "href", base));
|
|
el.querySelectorAll('[src^="./"], [src^="../"]').forEach((item) => update(item, "src", base));
|
|
}
|
|
var p3 = new DOMParser();
|
|
async function mouseEnterHandler({ clientX, clientY }) {
|
|
const link = this;
|
|
async function setPosition(popoverElement2) {
|
|
const { x: x3, y: y2 } = await B2(link, popoverElement2, {
|
|
middleware: [D({ x: clientX, y: clientY }), O(), A()]
|
|
});
|
|
Object.assign(popoverElement2.style, {
|
|
left: `${x3}px`,
|
|
top: `${y2}px`
|
|
});
|
|
}
|
|
if ([...link.children].some((child) => child.classList.contains("popover"))) {
|
|
return setPosition(link.lastChild);
|
|
}
|
|
const thisUrl = new URL(document.location.href);
|
|
thisUrl.hash = "";
|
|
thisUrl.search = "";
|
|
const targetUrl = new URL(link.href);
|
|
const hash = targetUrl.hash;
|
|
targetUrl.hash = "";
|
|
targetUrl.search = "";
|
|
if (thisUrl.toString() === targetUrl.toString())
|
|
return;
|
|
const contents = await fetch(`${targetUrl}`).then((res) => res.text()).catch((err) => {
|
|
console.error(err);
|
|
});
|
|
if (!contents)
|
|
return;
|
|
const html = p3.parseFromString(contents, "text/html");
|
|
normalizeRelativeURLs(html, targetUrl);
|
|
const elts = [...html.getElementsByClassName("popover-hint")];
|
|
if (elts.length === 0)
|
|
return;
|
|
const popoverElement = document.createElement("div");
|
|
popoverElement.classList.add("popover");
|
|
const popoverInner = document.createElement("div");
|
|
popoverInner.classList.add("popover-inner");
|
|
popoverElement.appendChild(popoverInner);
|
|
elts.forEach((elt) => popoverInner.appendChild(elt));
|
|
setPosition(popoverElement);
|
|
link.appendChild(popoverElement);
|
|
if (hash !== "") {
|
|
const heading = popoverInner.querySelector(hash);
|
|
if (heading) {
|
|
popoverInner.scroll({ top: heading.offsetTop - 12, behavior: "instant" });
|
|
}
|
|
}
|
|
}
|
|
document.addEventListener("nav", () => {
|
|
const links = [...document.getElementsByClassName("internal")];
|
|
for (const link of links) {
|
|
link.removeEventListener("mouseenter", mouseEnterHandler);
|
|
link.addEventListener("mouseenter", mouseEnterHandler);
|
|
}
|
|
});
|
|
})();
|
|
(function () {// node_modules/plausible-tracker/build/module/lib/request.js
|
|
function sendEvent(eventName, data, options) {
|
|
const isLocalhost = /^localhost$|^127(?:\.[0-9]+){0,2}\.[0-9]+$|^(?:0*:)*?:?0*1$/.test(location.hostname) || location.protocol === "file:";
|
|
if (!data.trackLocalhost && isLocalhost) {
|
|
return console.warn("[Plausible] Ignoring event because website is running locally");
|
|
}
|
|
try {
|
|
if (window.localStorage.plausible_ignore === "true") {
|
|
return console.warn('[Plausible] Ignoring event because "plausible_ignore" is set to "true" in localStorage');
|
|
}
|
|
} catch (e) {
|
|
null;
|
|
}
|
|
const payload = {
|
|
n: eventName,
|
|
u: data.url,
|
|
d: data.domain,
|
|
r: data.referrer,
|
|
w: data.deviceWidth,
|
|
h: data.hashMode ? 1 : 0,
|
|
p: options && options.props ? JSON.stringify(options.props) : void 0
|
|
};
|
|
const req = new XMLHttpRequest();
|
|
req.open("POST", `${data.apiHost}/api/event`, true);
|
|
req.setRequestHeader("Content-Type", "text/plain");
|
|
req.send(JSON.stringify(payload));
|
|
req.onreadystatechange = () => {
|
|
if (req.readyState !== 4)
|
|
return;
|
|
if (options && options.callback) {
|
|
options.callback();
|
|
}
|
|
};
|
|
}
|
|
|
|
// node_modules/plausible-tracker/build/module/lib/tracker.js
|
|
function Plausible(defaults) {
|
|
const getConfig = () => ({
|
|
hashMode: false,
|
|
trackLocalhost: false,
|
|
url: location.href,
|
|
domain: location.hostname,
|
|
referrer: document.referrer || null,
|
|
deviceWidth: window.innerWidth,
|
|
apiHost: "https://plausible.io",
|
|
...defaults
|
|
});
|
|
const trackEvent = (eventName, options, eventData) => {
|
|
sendEvent(eventName, { ...getConfig(), ...eventData }, options);
|
|
};
|
|
const trackPageview2 = (eventData, options) => {
|
|
trackEvent("pageview", options, eventData);
|
|
};
|
|
const enableAutoPageviews = () => {
|
|
const page = () => trackPageview2();
|
|
const originalPushState = history.pushState;
|
|
if (originalPushState) {
|
|
history.pushState = function(data, title, url) {
|
|
originalPushState.apply(this, [data, title, url]);
|
|
page();
|
|
};
|
|
addEventListener("popstate", page);
|
|
}
|
|
if (defaults && defaults.hashMode) {
|
|
addEventListener("hashchange", page);
|
|
}
|
|
trackPageview2();
|
|
return function cleanup() {
|
|
if (originalPushState) {
|
|
history.pushState = originalPushState;
|
|
removeEventListener("popstate", page);
|
|
}
|
|
if (defaults && defaults.hashMode) {
|
|
removeEventListener("hashchange", page);
|
|
}
|
|
};
|
|
};
|
|
const enableAutoOutboundTracking = (targetNode = document, observerInit = {
|
|
subtree: true,
|
|
childList: true,
|
|
attributes: true,
|
|
attributeFilter: ["href"]
|
|
}) => {
|
|
function trackClick(event) {
|
|
trackEvent("Outbound Link: Click", { props: { url: this.href } });
|
|
if (!(typeof process !== "undefined" && process && false)) {
|
|
setTimeout(() => {
|
|
location.href = this.href;
|
|
}, 150);
|
|
}
|
|
event.preventDefault();
|
|
}
|
|
const tracked = /* @__PURE__ */ new Set();
|
|
function addNode(node) {
|
|
if (node instanceof HTMLAnchorElement) {
|
|
if (node.host !== location.host) {
|
|
node.addEventListener("click", trackClick);
|
|
tracked.add(node);
|
|
}
|
|
} else if ("querySelectorAll" in node) {
|
|
node.querySelectorAll("a").forEach(addNode);
|
|
}
|
|
}
|
|
function removeNode(node) {
|
|
if (node instanceof HTMLAnchorElement) {
|
|
node.removeEventListener("click", trackClick);
|
|
tracked.delete(node);
|
|
} else if ("querySelectorAll" in node) {
|
|
node.querySelectorAll("a").forEach(removeNode);
|
|
}
|
|
}
|
|
const observer = new MutationObserver((mutations) => {
|
|
mutations.forEach((mutation) => {
|
|
if (mutation.type === "attributes") {
|
|
removeNode(mutation.target);
|
|
addNode(mutation.target);
|
|
} else if (mutation.type === "childList") {
|
|
mutation.addedNodes.forEach(addNode);
|
|
mutation.removedNodes.forEach(removeNode);
|
|
}
|
|
});
|
|
});
|
|
targetNode.querySelectorAll("a").forEach(addNode);
|
|
observer.observe(targetNode, observerInit);
|
|
return function cleanup() {
|
|
tracked.forEach((a) => {
|
|
a.removeEventListener("click", trackClick);
|
|
});
|
|
tracked.clear();
|
|
observer.disconnect();
|
|
};
|
|
};
|
|
return {
|
|
trackEvent,
|
|
trackPageview: trackPageview2,
|
|
enableAutoPageviews,
|
|
enableAutoOutboundTracking
|
|
};
|
|
}
|
|
|
|
// node_modules/plausible-tracker/build/module/index.js
|
|
var module_default = Plausible;
|
|
|
|
// quartz/components/scripts/quartz/components/scripts/plausible.inline.ts
|
|
var { trackPageview } = module_default();
|
|
document.addEventListener("nav", () => trackPageview());
|
|
})();
|
|
(function () {// node_modules/micromorph/dist/index.js
|
|
var T = (e) => (t, r) => t[`node${e}`] === r[`node${e}`];
|
|
var b = T("Name");
|
|
var C = T("Type");
|
|
var g = T("Value");
|
|
function M(e, t) {
|
|
if (e.attributes.length === 0 && t.attributes.length === 0)
|
|
return [];
|
|
let r = [], n = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map();
|
|
for (let s of e.attributes)
|
|
n.set(s.name, s.value);
|
|
for (let s of t.attributes) {
|
|
let a = n.get(s.name);
|
|
s.value === a ? n.delete(s.name) : (typeof a < "u" && n.delete(s.name), o.set(s.name, s.value));
|
|
}
|
|
for (let s of n.keys())
|
|
r.push({ type: 5, name: s });
|
|
for (let [s, a] of o.entries())
|
|
r.push({ type: 4, name: s, value: a });
|
|
return r;
|
|
}
|
|
function N(e, t = true) {
|
|
let r = `${e.localName}`;
|
|
for (let { name: n, value: o } of e.attributes)
|
|
t && n.startsWith("data-") || (r += `[${n}=${o}]`);
|
|
return r += e.innerHTML, r;
|
|
}
|
|
function h(e) {
|
|
switch (e.tagName) {
|
|
case "BASE":
|
|
case "TITLE":
|
|
return e.localName;
|
|
case "META": {
|
|
if (e.hasAttribute("name"))
|
|
return `meta[name="${e.getAttribute("name")}"]`;
|
|
if (e.hasAttribute("property"))
|
|
return `meta[name="${e.getAttribute("property")}"]`;
|
|
break;
|
|
}
|
|
case "LINK": {
|
|
if (e.hasAttribute("rel") && e.hasAttribute("href"))
|
|
return `link[rel="${e.getAttribute("rel")}"][href="${e.getAttribute("href")}"]`;
|
|
if (e.hasAttribute("href"))
|
|
return `link[href="${e.getAttribute("href")}"]`;
|
|
break;
|
|
}
|
|
}
|
|
return N(e);
|
|
}
|
|
function x(e) {
|
|
let [t, r = ""] = e.split("?");
|
|
return `${t}?t=${Date.now()}&${r.replace(/t=\d+/g, "")}`;
|
|
}
|
|
function c(e) {
|
|
if (e.nodeType === 1 && e.hasAttribute("data-persist"))
|
|
return e;
|
|
if (e.nodeType === 1 && e.localName === "script") {
|
|
let t = document.createElement("script");
|
|
for (let { name: r, value: n } of e.attributes)
|
|
r === "src" && (n = x(n)), t.setAttribute(r, n);
|
|
return t.innerHTML = e.innerHTML, t;
|
|
}
|
|
return e.cloneNode(true);
|
|
}
|
|
function R(e, t) {
|
|
if (e.children.length === 0 && t.children.length === 0)
|
|
return [];
|
|
let r = [], n = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map();
|
|
for (let a of e.children)
|
|
n.set(h(a), a);
|
|
for (let a of t.children) {
|
|
let i = h(a), u = n.get(i);
|
|
u ? N(a, false) !== N(u, false) && o.set(i, c(a)) : s.set(i, c(a)), n.delete(i);
|
|
}
|
|
for (let a of e.childNodes) {
|
|
if (a.nodeType === 1) {
|
|
let i = h(a);
|
|
if (n.has(i)) {
|
|
r.push({ type: 1 });
|
|
continue;
|
|
} else if (o.has(i)) {
|
|
let u = o.get(i);
|
|
r.push({ type: 3, attributes: M(a, u), children: I(a, u) });
|
|
continue;
|
|
}
|
|
}
|
|
r.push(void 0);
|
|
}
|
|
for (let a of s.values())
|
|
r.push({ type: 0, node: c(a) });
|
|
return r;
|
|
}
|
|
function I(e, t) {
|
|
let r = [], n = Math.max(e.childNodes.length, t.childNodes.length);
|
|
for (let o = 0; o < n; o++) {
|
|
let s = e.childNodes.item(o), a = t.childNodes.item(o);
|
|
r[o] = p(s, a);
|
|
}
|
|
return r;
|
|
}
|
|
function p(e, t) {
|
|
if (!e)
|
|
return { type: 0, node: c(t) };
|
|
if (!t)
|
|
return { type: 1 };
|
|
if (C(e, t)) {
|
|
if (e.nodeType === 3) {
|
|
let r = e.nodeValue, n = t.nodeValue;
|
|
if (r.trim().length === 0 && n.trim().length === 0)
|
|
return;
|
|
}
|
|
if (e.nodeType === 1) {
|
|
if (b(e, t)) {
|
|
let r = e.tagName === "HEAD" ? R : I;
|
|
return { type: 3, attributes: M(e, t), children: r(e, t) };
|
|
}
|
|
return { type: 2, node: c(t) };
|
|
} else
|
|
return e.nodeType === 9 ? p(e.documentElement, t.documentElement) : g(e, t) ? void 0 : { type: 2, value: t.nodeValue };
|
|
}
|
|
return { type: 2, node: c(t) };
|
|
}
|
|
function $(e, t) {
|
|
if (t.length !== 0)
|
|
for (let { type: r, name: n, value: o } of t)
|
|
r === 5 ? e.removeAttribute(n) : r === 4 && e.setAttribute(n, o);
|
|
}
|
|
async function O(e, t, r) {
|
|
if (!t)
|
|
return;
|
|
let n;
|
|
switch (e.nodeType === 9 ? (e = e.documentElement, n = e) : r ? n = r : n = e, t.type) {
|
|
case 0: {
|
|
let { node: o } = t;
|
|
e.appendChild(o);
|
|
return;
|
|
}
|
|
case 1: {
|
|
if (!n)
|
|
return;
|
|
e.removeChild(n);
|
|
return;
|
|
}
|
|
case 2: {
|
|
if (!n)
|
|
return;
|
|
let { node: o, value: s } = t;
|
|
if (typeof s == "string") {
|
|
n.nodeValue = s;
|
|
return;
|
|
}
|
|
n.replaceWith(o);
|
|
return;
|
|
}
|
|
case 3: {
|
|
if (!n)
|
|
return;
|
|
let { attributes: o, children: s } = t;
|
|
$(n, o);
|
|
let a = Array.from(n.childNodes);
|
|
await Promise.all(s.map((i, u) => O(n, i, a[u])));
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
function P(e, t) {
|
|
let r = p(e, t);
|
|
return O(e, r);
|
|
}
|
|
|
|
// node_modules/github-slugger/index.js
|
|
var own = Object.hasOwnProperty;
|
|
|
|
// quartz/util/path.ts
|
|
function getFullSlug(window2) {
|
|
const res = window2.document.body.dataset.slug;
|
|
return res;
|
|
}
|
|
|
|
// quartz/components/scripts/quartz/components/scripts/spa.inline.ts
|
|
var NODE_TYPE_ELEMENT = 1;
|
|
var announcer = document.createElement("route-announcer");
|
|
var isElement = (target) => target?.nodeType === NODE_TYPE_ELEMENT;
|
|
var isLocalUrl = (href) => {
|
|
try {
|
|
const url = new URL(href);
|
|
if (window.location.origin === url.origin) {
|
|
return true;
|
|
}
|
|
} catch (e) {
|
|
}
|
|
return false;
|
|
};
|
|
var getOpts = ({ target }) => {
|
|
if (!isElement(target))
|
|
return;
|
|
if (target.attributes.getNamedItem("target")?.value === "_blank")
|
|
return;
|
|
const a = target.closest("a");
|
|
if (!a)
|
|
return;
|
|
if ("routerIgnore" in a.dataset)
|
|
return;
|
|
const { href } = a;
|
|
if (!isLocalUrl(href))
|
|
return;
|
|
return { url: new URL(href), scroll: "routerNoscroll" in a.dataset ? false : void 0 };
|
|
};
|
|
function notifyNav(url) {
|
|
const event = new CustomEvent("nav", { detail: { url } });
|
|
document.dispatchEvent(event);
|
|
}
|
|
var p2;
|
|
async function navigate(url, isBack = false) {
|
|
p2 = p2 || new DOMParser();
|
|
const contents = await fetch(`${url}`).then((res) => res.text()).catch(() => {
|
|
window.location.assign(url);
|
|
});
|
|
if (!contents)
|
|
return;
|
|
const html = p2.parseFromString(contents, "text/html");
|
|
let title = html.querySelector("title")?.textContent;
|
|
if (title) {
|
|
document.title = title;
|
|
} else {
|
|
const h1 = document.querySelector("h1");
|
|
title = h1?.innerText ?? h1?.textContent ?? url.pathname;
|
|
}
|
|
if (announcer.textContent !== title) {
|
|
announcer.textContent = title;
|
|
}
|
|
announcer.dataset.persist = "";
|
|
html.body.appendChild(announcer);
|
|
P(document.body, html.body);
|
|
if (!isBack) {
|
|
if (url.hash) {
|
|
const el = document.getElementById(decodeURIComponent(url.hash.substring(1)));
|
|
el?.scrollIntoView();
|
|
} else {
|
|
window.scrollTo({ top: 0 });
|
|
}
|
|
}
|
|
const elementsToRemove = document.head.querySelectorAll(":not([spa-preserve])");
|
|
elementsToRemove.forEach((el) => el.remove());
|
|
const elementsToAdd = html.head.querySelectorAll(":not([spa-preserve])");
|
|
elementsToAdd.forEach((el) => document.head.appendChild(el));
|
|
if (!isBack) {
|
|
history.pushState({}, "", url);
|
|
}
|
|
notifyNav(getFullSlug(window));
|
|
delete announcer.dataset.persist;
|
|
}
|
|
window.spaNavigate = navigate;
|
|
function createRouter() {
|
|
if (typeof window !== "undefined") {
|
|
window.addEventListener("click", async (event) => {
|
|
const { url } = getOpts(event) ?? {};
|
|
if (!url || event.ctrlKey || event.metaKey)
|
|
return;
|
|
event.preventDefault();
|
|
try {
|
|
navigate(url, false);
|
|
} catch (e) {
|
|
window.location.assign(url);
|
|
}
|
|
});
|
|
window.addEventListener("popstate", (event) => {
|
|
const { url } = getOpts(event) ?? {};
|
|
if (window.location.hash && window.location.pathname === url?.pathname)
|
|
return;
|
|
try {
|
|
navigate(new URL(window.location.toString()), true);
|
|
} catch (e) {
|
|
window.location.reload();
|
|
}
|
|
return;
|
|
});
|
|
}
|
|
return new class Router {
|
|
go(pathname) {
|
|
const url = new URL(pathname, window.location.toString());
|
|
return navigate(url, false);
|
|
}
|
|
back() {
|
|
return window.history.back();
|
|
}
|
|
forward() {
|
|
return window.history.forward();
|
|
}
|
|
}();
|
|
}
|
|
createRouter();
|
|
notifyNav(getFullSlug(window));
|
|
if (!customElements.get("route-announcer")) {
|
|
const attrs = {
|
|
"aria-live": "assertive",
|
|
"aria-atomic": "true",
|
|
style: "position: absolute; left: 0; top: 0; clip: rect(0 0 0 0); clip-path: inset(50%); overflow: hidden; white-space: nowrap; width: 1px; height: 1px"
|
|
};
|
|
customElements.define(
|
|
"route-announcer",
|
|
class RouteAnnouncer extends HTMLElement {
|
|
constructor() {
|
|
super();
|
|
}
|
|
connectedCallback() {
|
|
for (const [key, value] of Object.entries(attrs)) {
|
|
this.setAttribute(key, value);
|
|
}
|
|
}
|
|
}
|
|
);
|
|
}
|
|
})(); |