UNPKG

mermaid

Version:

Markdown-ish syntax for generating flowcharts, sequence diagrams, class diagrams, gantt charts and git graphs.

1,327 lines 7.23 MB
(function(global2, factory) { typeof exports === "object" && typeof module !== "undefined" ? module.exports = factory() : typeof define === "function" && define.amd ? define(factory) : (global2 = typeof globalThis !== "undefined" ? globalThis : global2 || self, global2.mermaid = factory()); })(this, function() { var _a, _b; "use strict"; function dedent(templ) { var values2 = []; for (var _i6 = 1; _i6 < arguments.length; _i6++) { values2[_i6 - 1] = arguments[_i6]; } var strings = Array.from(typeof templ === "string" ? [templ] : templ); strings[strings.length - 1] = strings[strings.length - 1].replace(/\r?\n([\t ]*)$/, ""); var indentLengths = strings.reduce(function(arr, str2) { var matches = str2.match(/\n([\t ]+|(?!\s).)/g); if (matches) { return arr.concat(matches.map(function(match) { var _a2, _b2; return (_b2 = (_a2 = match.match(/[\t ]/g)) === null || _a2 === void 0 ? void 0 : _a2.length) !== null && _b2 !== void 0 ? _b2 : 0; })); } return arr; }, []); if (indentLengths.length) { var pattern_1 = new RegExp("\n[ ]{" + Math.min.apply(Math, indentLengths) + "}", "g"); strings = strings.map(function(str2) { return str2.replace(pattern_1, "\n"); }); } strings[0] = strings[0].replace(/^\r?\n/, ""); var string2 = strings[0]; values2.forEach(function(value2, i2) { var endentations = string2.match(/(?:^|\n)( *)$/); var endentation = endentations ? endentations[1] : ""; var indentedValue = value2; if (typeof value2 === "string" && value2.includes("\n")) { indentedValue = String(value2).split("\n").map(function(str2, i3) { return i3 === 0 ? str2 : "" + endentation + str2; }).join("\n"); } string2 += indentedValue + strings[i2 + 1]; }); return string2; } var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {}; function getDefaultExportFromCjs(x2) { return x2 && x2.__esModule && Object.prototype.hasOwnProperty.call(x2, "default") ? x2["default"] : x2; } var dayjs_min = { exports: {} }; (function(module2, exports2) { !function(t, e) { module2.exports = e(); }(commonjsGlobal, function() { var t = 1e3, e = 6e4, n = 36e5, r = "millisecond", i2 = "second", s = "minute", u = "hour", a = "day", o = "week", c2 = "month", f2 = "quarter", h = "year", d = "date", l = "Invalid Date", $ = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, y2 = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, M = { name: "en", weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), ordinal: function(t4) { var e3 = ["th", "st", "nd", "rd"], n2 = t4 % 100; return "[" + t4 + (e3[(n2 - 20) % 10] || e3[n2] || e3[0]) + "]"; } }, m = function(t4, e3, n2) { var r2 = String(t4); return !r2 || r2.length >= e3 ? t4 : "" + Array(e3 + 1 - r2.length).join(n2) + t4; }, v = { s: m, z: function(t4) { var e3 = -t4.utcOffset(), n2 = Math.abs(e3), r2 = Math.floor(n2 / 60), i3 = n2 % 60; return (e3 <= 0 ? "+" : "-") + m(r2, 2, "0") + ":" + m(i3, 2, "0"); }, m: function t4(e3, n2) { if (e3.date() < n2.date()) return -t4(n2, e3); var r2 = 12 * (n2.year() - e3.year()) + (n2.month() - e3.month()), i3 = e3.clone().add(r2, c2), s2 = n2 - i3 < 0, u2 = e3.clone().add(r2 + (s2 ? -1 : 1), c2); return +(-(r2 + (n2 - i3) / (s2 ? i3 - u2 : u2 - i3)) || 0); }, a: function(t4) { return t4 < 0 ? Math.ceil(t4) || 0 : Math.floor(t4); }, p: function(t4) { return { M: c2, y: h, w: o, d: a, D: d, h: u, m: s, s: i2, ms: r, Q: f2 }[t4] || String(t4 || "").toLowerCase().replace(/s$/, ""); }, u: function(t4) { return void 0 === t4; } }, g = "en", D2 = {}; D2[g] = M; var p = "$isDayjsObject", S2 = function(t4) { return t4 instanceof _2 || !(!t4 || !t4[p]); }, w2 = function t4(e3, n2, r2) { var i3; if (!e3) return g; if ("string" == typeof e3) { var s2 = e3.toLowerCase(); D2[s2] && (i3 = s2), n2 && (D2[s2] = n2, i3 = s2); var u2 = e3.split("-"); if (!i3 && u2.length > 1) return t4(u2[0]); } else { var a2 = e3.name; D2[a2] = e3, i3 = a2; } return !r2 && i3 && (g = i3), i3 || !r2 && g; }, O = function(t4, e3) { if (S2(t4)) return t4.clone(); var n2 = "object" == typeof e3 ? e3 : {}; return n2.date = t4, n2.args = arguments, new _2(n2); }, b = v; b.l = w2, b.i = S2, b.w = function(t4, e3) { return O(t4, { locale: e3.$L, utc: e3.$u, x: e3.$x, $offset: e3.$offset }); }; var _2 = function() { function M2(t4) { this.$L = w2(t4.locale, null, true), this.parse(t4), this.$x = this.$x || t4.x || {}, this[p] = true; } var m2 = M2.prototype; return m2.parse = function(t4) { this.$d = function(t5) { var e3 = t5.date, n2 = t5.utc; if (null === e3) return /* @__PURE__ */ new Date(NaN); if (b.u(e3)) return /* @__PURE__ */ new Date(); if (e3 instanceof Date) return new Date(e3); if ("string" == typeof e3 && !/Z$/i.test(e3)) { var r2 = e3.match($); if (r2) { var i3 = r2[2] - 1 || 0, s2 = (r2[7] || "0").substring(0, 3); return n2 ? new Date(Date.UTC(r2[1], i3, r2[3] || 1, r2[4] || 0, r2[5] || 0, r2[6] || 0, s2)) : new Date(r2[1], i3, r2[3] || 1, r2[4] || 0, r2[5] || 0, r2[6] || 0, s2); } } return new Date(e3); }(t4), this.init(); }, m2.init = function() { var t4 = this.$d; this.$y = t4.getFullYear(), this.$M = t4.getMonth(), this.$D = t4.getDate(), this.$W = t4.getDay(), this.$H = t4.getHours(), this.$m = t4.getMinutes(), this.$s = t4.getSeconds(), this.$ms = t4.getMilliseconds(); }, m2.$utils = function() { return b; }, m2.isValid = function() { return !(this.$d.toString() === l); }, m2.isSame = function(t4, e3) { var n2 = O(t4); return this.startOf(e3) <= n2 && n2 <= this.endOf(e3); }, m2.isAfter = function(t4, e3) { return O(t4) < this.startOf(e3); }, m2.isBefore = function(t4, e3) { return this.endOf(e3) < O(t4); }, m2.$g = function(t4, e3, n2) { return b.u(t4) ? this[e3] : this.set(n2, t4); }, m2.unix = function() { return Math.floor(this.valueOf() / 1e3); }, m2.valueOf = function() { return this.$d.getTime(); }, m2.startOf = function(t4, e3) { var n2 = this, r2 = !!b.u(e3) || e3, f3 = b.p(t4), l2 = function(t5, e4) { var i3 = b.w(n2.$u ? Date.UTC(n2.$y, e4, t5) : new Date(n2.$y, e4, t5), n2); return r2 ? i3 : i3.endOf(a); }, $2 = function(t5, e4) { return b.w(n2.toDate()[t5].apply(n2.toDate("s"), (r2 ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(e4)), n2); }, y3 = this.$W, M3 = this.$M, m3 = this.$D, v2 = "set" + (this.$u ? "UTC" : ""); switch (f3) { case h: return r2 ? l2(1, 0) : l2(31, 11); case c2: return r2 ? l2(1, M3) : l2(0, M3 + 1); case o: var g2 = this.$locale().weekStart || 0, D3 = (y3 < g2 ? y3 + 7 : y3) - g2; return l2(r2 ? m3 - D3 : m3 + (6 - D3), M3); case a: case d: return $2(v2 + "Hours", 0); case u: return $2(v2 + "Minutes", 1); case s: return $2(v2 + "Seconds", 2); case i2: return $2(v2 + "Milliseconds", 3); default: return this.clone(); } }, m2.endOf = function(t4) { return this.startOf(t4, false); }, m2.$set = function(t4, e3) { var n2, o2 = b.p(t4), f3 = "set" + (this.$u ? "UTC" : ""), l2 = (n2 = {}, n2[a] = f3 + "Date", n2[d] = f3 + "Date", n2[c2] = f3 + "Month", n2[h] = f3 + "FullYear", n2[u] = f3 + "Hours", n2[s] = f3 + "Minutes", n2[i2] = f3 + "Seconds", n2[r] = f3 + "Milliseconds", n2)[o2], $2 = o2 === a ? this.$D + (e3 - this.$W) : e3; if (o2 === c2 || o2 === h) { var y3 = this.clone().set(d, 1); y3.$d[l2]($2), y3.init(), this.$d = y3.set(d, Math.min(this.$D, y3.daysInMonth())).$d; } else l2 && this.$d[l2]($2); return this.init(), this; }, m2.set = function(t4, e3) { return this.clone().$set(t4, e3); }, m2.get = function(t4) { return this[b.p(t4)](); }, m2.add = function(r2, f3) { var d2, l2 = this; r2 = Number(r2); var $2 = b.p(f3), y3 = function(t4) { var e3 = O(l2); return b.w(e3.date(e3.date() + Math.round(t4 * r2)), l2); }; if ($2 === c2) return this.set(c2, this.$M + r2); if ($2 === h) return this.set(h, this.$y + r2); if ($2 === a) return y3(1); if ($2 === o) return y3(7); var M3 = (d2 = {}, d2[s] = e, d2[u] = n, d2[i2] = t, d2)[$2] || 1, m3 = this.$d.getTime() + r2 * M3; return b.w(m3, this); }, m2.subtract = function(t4, e3) { return this.add(-1 * t4, e3); }, m2.format = function(t4) { var e3 = this, n2 = this.$locale(); if (!this.isValid()) return n2.invalidDate || l; var r2 = t4 || "YYYY-MM-DDTHH:mm:ssZ", i3 = b.z(this), s2 = this.$H, u2 = this.$m, a2 = this.$M, o2 = n2.weekdays, c3 = n2.months, f3 = n2.meridiem, h2 = function(t5, n3, i4, s3) { return t5 && (t5[n3] || t5(e3, r2)) || i4[n3].slice(0, s3); }, d2 = function(t5) { return b.s(s2 % 12 || 12, t5, "0"); }, $2 = f3 || function(t5, e4, n3) { var r3 = t5 < 12 ? "AM" : "PM"; return n3 ? r3.toLowerCase() : r3; }; return r2.replace(y2, function(t5, r3) { return r3 || function(t6) { switch (t6) { case "YY": return String(e3.$y).slice(-2); case "YYYY": return b.s(e3.$y, 4, "0"); case "M": return a2 + 1; case "MM": return b.s(a2 + 1, 2, "0"); case "MMM": return h2(n2.monthsShort, a2, c3, 3); case "MMMM": return h2(c3, a2); case "D": return e3.$D; case "DD": return b.s(e3.$D, 2, "0"); case "d": return String(e3.$W); case "dd": return h2(n2.weekdaysMin, e3.$W, o2, 2); case "ddd": return h2(n2.weekdaysShort, e3.$W, o2, 3); case "dddd": return o2[e3.$W]; case "H": return String(s2); case "HH": return b.s(s2, 2, "0"); case "h": return d2(1); case "hh": return d2(2); case "a": return $2(s2, u2, true); case "A": return $2(s2, u2, false); case "m": return String(u2); case "mm": return b.s(u2, 2, "0"); case "s": return String(e3.$s); case "ss": return b.s(e3.$s, 2, "0"); case "SSS": return b.s(e3.$ms, 3, "0"); case "Z": return i3; } return null; }(t5) || i3.replace(":", ""); }); }, m2.utcOffset = function() { return 15 * -Math.round(this.$d.getTimezoneOffset() / 15); }, m2.diff = function(r2, d2, l2) { var $2, y3 = this, M3 = b.p(d2), m3 = O(r2), v2 = (m3.utcOffset() - this.utcOffset()) * e, g2 = this - m3, D3 = function() { return b.m(y3, m3); }; switch (M3) { case h: $2 = D3() / 12; break; case c2: $2 = D3(); break; case f2: $2 = D3() / 3; break; case o: $2 = (g2 - v2) / 6048e5; break; case a: $2 = (g2 - v2) / 864e5; break; case u: $2 = g2 / n; break; case s: $2 = g2 / e; break; case i2: $2 = g2 / t; break; default: $2 = g2; } return l2 ? $2 : b.a($2); }, m2.daysInMonth = function() { return this.endOf(c2).$D; }, m2.$locale = function() { return D2[this.$L]; }, m2.locale = function(t4, e3) { if (!t4) return this.$L; var n2 = this.clone(), r2 = w2(t4, e3, true); return r2 && (n2.$L = r2), n2; }, m2.clone = function() { return b.w(this.$d, this); }, m2.toDate = function() { return new Date(this.valueOf()); }, m2.toJSON = function() { return this.isValid() ? this.toISOString() : null; }, m2.toISOString = function() { return this.$d.toISOString(); }, m2.toString = function() { return this.$d.toUTCString(); }, M2; }(), k = _2.prototype; return O.prototype = k, [["$ms", r], ["$s", i2], ["$m", s], ["$H", u], ["$W", a], ["$M", c2], ["$y", h], ["$D", d]].forEach(function(t4) { k[t4[1]] = function(e3) { return this.$g(e3, t4[0], t4[1]); }; }), O.extend = function(t4, e3) { return t4.$i || (t4(e3, _2, O), t4.$i = true), O; }, O.locale = w2, O.isDayjs = S2, O.unix = function(t4) { return O(1e3 * t4); }, O.en = D2[g], O.Ls = D2, O.p = {}, O; }); })(dayjs_min); var dayjs_minExports = dayjs_min.exports; const dayjs = /* @__PURE__ */ getDefaultExportFromCjs(dayjs_minExports); const LEVELS = { trace: 0, debug: 1, info: 2, warn: 3, error: 4, fatal: 5 }; const log$1 = { trace: (..._args) => { }, debug: (..._args) => { }, info: (..._args) => { }, warn: (..._args) => { }, error: (..._args) => { }, fatal: (..._args) => { } }; const setLogLevel$1 = function(level = "fatal") { let numericLevel = LEVELS.fatal; if (typeof level === "string") { level = level.toLowerCase(); if (level in LEVELS) { numericLevel = LEVELS[level]; } } else if (typeof level === "number") { numericLevel = level; } log$1.trace = () => { }; log$1.debug = () => { }; log$1.info = () => { }; log$1.warn = () => { }; log$1.error = () => { }; log$1.fatal = () => { }; if (numericLevel <= LEVELS.fatal) { log$1.fatal = console.error ? console.error.bind(console, format$1("FATAL"), "color: orange") : console.log.bind(console, "\x1B[35m", format$1("FATAL")); } if (numericLevel <= LEVELS.error) { log$1.error = console.error ? console.error.bind(console, format$1("ERROR"), "color: orange") : console.log.bind(console, "\x1B[31m", format$1("ERROR")); } if (numericLevel <= LEVELS.warn) { log$1.warn = console.warn ? console.warn.bind(console, format$1("WARN"), "color: orange") : console.log.bind(console, `\x1B[33m`, format$1("WARN")); } if (numericLevel <= LEVELS.info) { log$1.info = console.info ? console.info.bind(console, format$1("INFO"), "color: lightblue") : console.log.bind(console, "\x1B[34m", format$1("INFO")); } if (numericLevel <= LEVELS.debug) { log$1.debug = console.debug ? console.debug.bind(console, format$1("DEBUG"), "color: lightgreen") : console.log.bind(console, "\x1B[32m", format$1("DEBUG")); } if (numericLevel <= LEVELS.trace) { log$1.trace = console.debug ? console.debug.bind(console, format$1("TRACE"), "color: lightgreen") : console.log.bind(console, "\x1B[32m", format$1("TRACE")); } }; const format$1 = (level) => { const time2 = dayjs().format("ss.SSS"); return `%c${time2} : ${level} : `; }; var dist = {}; (function(exports2) { Object.defineProperty(exports2, "__esModule", { value: true }); exports2.sanitizeUrl = exports2.BLANK_URL = void 0; var invalidProtocolRegex = /^([^\w]*)(javascript|data|vbscript)/im; var htmlEntitiesRegex = /&#(\w+)(^\w|;)?/g; var htmlCtrlEntityRegex = /&(newline|tab);/gi; var ctrlCharactersRegex = /[\u0000-\u001F\u007F-\u009F\u2000-\u200D\uFEFF]/gim; var urlSchemeRegex = /^.+(:|&colon;)/gim; var relativeFirstCharacters = [".", "/"]; exports2.BLANK_URL = "about:blank"; function isRelativeUrlWithoutProtocol(url) { return relativeFirstCharacters.indexOf(url[0]) > -1; } function decodeHtmlCharacters(str2) { var removedNullByte = str2.replace(ctrlCharactersRegex, ""); return removedNullByte.replace(htmlEntitiesRegex, function(match, dec) { return String.fromCharCode(dec); }); } function sanitizeUrl(url) { if (!url) { return exports2.BLANK_URL; } var sanitizedUrl = decodeHtmlCharacters(url).replace(htmlCtrlEntityRegex, "").replace(ctrlCharactersRegex, "").trim(); if (!sanitizedUrl) { return exports2.BLANK_URL; } if (isRelativeUrlWithoutProtocol(sanitizedUrl)) { return sanitizedUrl; } var urlSchemeParseResults = sanitizedUrl.match(urlSchemeRegex); if (!urlSchemeParseResults) { return sanitizedUrl; } var urlScheme = urlSchemeParseResults[0]; if (invalidProtocolRegex.test(urlScheme)) { return exports2.BLANK_URL; } return sanitizedUrl; } exports2.sanitizeUrl = sanitizeUrl; })(dist); function ascending$1(a, b) { return a == null || b == null ? NaN : a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN; } function descending$1(a, b) { return a == null || b == null ? NaN : b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN; } function bisector(f2) { let compare1, compare2, delta; if (f2.length !== 2) { compare1 = ascending$1; compare2 = (d, x2) => ascending$1(f2(d), x2); delta = (d, x2) => f2(d) - x2; } else { compare1 = f2 === ascending$1 || f2 === descending$1 ? f2 : zero$1; compare2 = f2; delta = f2; } function left2(a, x2, lo = 0, hi = a.length) { if (lo < hi) { if (compare1(x2, x2) !== 0) return hi; do { const mid = lo + hi >>> 1; if (compare2(a[mid], x2) < 0) lo = mid + 1; else hi = mid; } while (lo < hi); } return lo; } function right2(a, x2, lo = 0, hi = a.length) { if (lo < hi) { if (compare1(x2, x2) !== 0) return hi; do { const mid = lo + hi >>> 1; if (compare2(a[mid], x2) <= 0) lo = mid + 1; else hi = mid; } while (lo < hi); } return lo; } function center2(a, x2, lo = 0, hi = a.length) { const i2 = left2(a, x2, lo, hi - 1); return i2 > lo && delta(a[i2 - 1], x2) > -delta(a[i2], x2) ? i2 - 1 : i2; } return { left: left2, center: center2, right: right2 }; } function zero$1() { return 0; } function number$3(x2) { return x2 === null ? NaN : +x2; } const ascendingBisect = bisector(ascending$1); const bisectRight = ascendingBisect.right; bisector(number$3).center; const bisect = bisectRight; class InternMap extends Map { constructor(entries2, key = keyof) { super(); Object.defineProperties(this, { _intern: { value: /* @__PURE__ */ new Map() }, _key: { value: key } }); if (entries2 != null) for (const [key2, value2] of entries2) this.set(key2, value2); } get(key) { return super.get(intern_get(this, key)); } has(key) { return super.has(intern_get(this, key)); } set(key, value2) { return super.set(intern_set(this, key), value2); } delete(key) { return super.delete(intern_delete(this, key)); } } function intern_get({ _intern, _key }, value2) { const key = _key(value2); return _intern.has(key) ? _intern.get(key) : value2; } function intern_set({ _intern, _key }, value2) { const key = _key(value2); if (_intern.has(key)) return _intern.get(key); _intern.set(key, value2); return value2; } function intern_delete({ _intern, _key }, value2) { const key = _key(value2); if (_intern.has(key)) { value2 = _intern.get(key); _intern.delete(key); } return value2; } function keyof(value2) { return value2 !== null && typeof value2 === "object" ? value2.valueOf() : value2; } const e10 = Math.sqrt(50), e5 = Math.sqrt(10), e2 = Math.sqrt(2); function tickSpec(start2, stop, count) { const step = (stop - start2) / Math.max(0, count), power = Math.floor(Math.log10(step)), error = step / Math.pow(10, power), factor = error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1; let i1, i2, inc; if (power < 0) { inc = Math.pow(10, -power) / factor; i1 = Math.round(start2 * inc); i2 = Math.round(stop * inc); if (i1 / inc < start2) ++i1; if (i2 / inc > stop) --i2; inc = -inc; } else { inc = Math.pow(10, power) * factor; i1 = Math.round(start2 / inc); i2 = Math.round(stop / inc); if (i1 * inc < start2) ++i1; if (i2 * inc > stop) --i2; } if (i2 < i1 && 0.5 <= count && count < 2) return tickSpec(start2, stop, count * 2); return [i1, i2, inc]; } function ticks(start2, stop, count) { stop = +stop, start2 = +start2, count = +count; if (!(count > 0)) return []; if (start2 === stop) return [start2]; const reverse = stop < start2, [i1, i2, inc] = reverse ? tickSpec(stop, start2, count) : tickSpec(start2, stop, count); if (!(i2 >= i1)) return []; const n = i2 - i1 + 1, ticks2 = new Array(n); if (reverse) { if (inc < 0) for (let i3 = 0; i3 < n; ++i3) ticks2[i3] = (i2 - i3) / -inc; else for (let i3 = 0; i3 < n; ++i3) ticks2[i3] = (i2 - i3) * inc; } else { if (inc < 0) for (let i3 = 0; i3 < n; ++i3) ticks2[i3] = (i1 + i3) / -inc; else for (let i3 = 0; i3 < n; ++i3) ticks2[i3] = (i1 + i3) * inc; } return ticks2; } function tickIncrement(start2, stop, count) { stop = +stop, start2 = +start2, count = +count; return tickSpec(start2, stop, count)[2]; } function tickStep(start2, stop, count) { stop = +stop, start2 = +start2, count = +count; const reverse = stop < start2, inc = reverse ? tickIncrement(stop, start2, count) : tickIncrement(start2, stop, count); return (reverse ? -1 : 1) * (inc < 0 ? 1 / -inc : inc); } function max$3(values2, valueof) { let max2; if (valueof === void 0) { for (const value2 of values2) { if (value2 != null && (max2 < value2 || max2 === void 0 && value2 >= value2)) { max2 = value2; } } } else { let index2 = -1; for (let value2 of values2) { if ((value2 = valueof(value2, ++index2, values2)) != null && (max2 < value2 || max2 === void 0 && value2 >= value2)) { max2 = value2; } } } return max2; } function min$3(values2, valueof) { let min2; if (valueof === void 0) { for (const value2 of values2) { if (value2 != null && (min2 > value2 || min2 === void 0 && value2 >= value2)) { min2 = value2; } } } else { let index2 = -1; for (let value2 of values2) { if ((value2 = valueof(value2, ++index2, values2)) != null && (min2 > value2 || min2 === void 0 && value2 >= value2)) { min2 = value2; } } } return min2; } function range$2(start2, stop, step) { start2 = +start2, stop = +stop, step = (n = arguments.length) < 2 ? (stop = start2, start2 = 0, 1) : n < 3 ? 1 : +step; var i2 = -1, n = Math.max(0, Math.ceil((stop - start2) / step)) | 0, range2 = new Array(n); while (++i2 < n) { range2[i2] = start2 + i2 * step; } return range2; } function identity$5(x2) { return x2; } var top = 1, right$1 = 2, bottom = 3, left$1 = 4, epsilon$3 = 1e-6; function translateX(x2) { return "translate(" + x2 + ",0)"; } function translateY(y2) { return "translate(0," + y2 + ")"; } function number$2(scale) { return (d) => +scale(d); } function center$1(scale, offset) { offset = Math.max(0, scale.bandwidth() - offset * 2) / 2; if (scale.round()) offset = Math.round(offset); return (d) => +scale(d) + offset; } function entering() { return !this.__axis; } function axis(orient, scale) { var tickArguments = [], tickValues = null, tickFormat2 = null, tickSizeInner = 6, tickSizeOuter = 6, tickPadding = 3, offset = typeof window !== "undefined" && window.devicePixelRatio > 1 ? 0 : 0.5, k = orient === top || orient === left$1 ? -1 : 1, x2 = orient === left$1 || orient === right$1 ? "x" : "y", transform = orient === top || orient === bottom ? translateX : translateY; function axis2(context) { var values2 = tickValues == null ? scale.ticks ? scale.ticks.apply(scale, tickArguments) : scale.domain() : tickValues, format2 = tickFormat2 == null ? scale.tickFormat ? scale.tickFormat.apply(scale, tickArguments) : identity$5 : tickFormat2, spacing2 = Math.max(tickSizeInner, 0) + tickPadding, range2 = scale.range(), range0 = +range2[0] + offset, range1 = +range2[range2.length - 1] + offset, position2 = (scale.bandwidth ? center$1 : number$2)(scale.copy(), offset), selection2 = context.selection ? context.selection() : context, path2 = selection2.selectAll(".domain").data([null]), tick = selection2.selectAll(".tick").data(values2, scale).order(), tickExit = tick.exit(), tickEnter = tick.enter().append("g").attr("class", "tick"), line2 = tick.select("line"), text2 = tick.select("text"); path2 = path2.merge(path2.enter().insert("path", ".tick").attr("class", "domain").attr("stroke", "currentColor")); tick = tick.merge(tickEnter); line2 = line2.merge(tickEnter.append("line").attr("stroke", "currentColor").attr(x2 + "2", k * tickSizeInner)); text2 = text2.merge(tickEnter.append("text").attr("fill", "currentColor").attr(x2, k * spacing2).attr("dy", orient === top ? "0em" : orient === bottom ? "0.71em" : "0.32em")); if (context !== selection2) { path2 = path2.transition(context); tick = tick.transition(context); line2 = line2.transition(context); text2 = text2.transition(context); tickExit = tickExit.transition(context).attr("opacity", epsilon$3).attr("transform", function(d) { return isFinite(d = position2(d)) ? transform(d + offset) : this.getAttribute("transform"); }); tickEnter.attr("opacity", epsilon$3).attr("transform", function(d) { var p = this.parentNode.__axis; return transform((p && isFinite(p = p(d)) ? p : position2(d)) + offset); }); } tickExit.remove(); path2.attr("d", orient === left$1 || orient === right$1 ? tickSizeOuter ? "M" + k * tickSizeOuter + "," + range0 + "H" + offset + "V" + range1 + "H" + k * tickSizeOuter : "M" + offset + "," + range0 + "V" + range1 : tickSizeOuter ? "M" + range0 + "," + k * tickSizeOuter + "V" + offset + "H" + range1 + "V" + k * tickSizeOuter : "M" + range0 + "," + offset + "H" + range1); tick.attr("opacity", 1).attr("transform", function(d) { return transform(position2(d) + offset); }); line2.attr(x2 + "2", k * tickSizeInner); text2.attr(x2, k * spacing2).text(format2); selection2.filter(entering).attr("fill", "none").attr("font-size", 10).attr("font-family", "sans-serif").attr("text-anchor", orient === right$1 ? "start" : orient === left$1 ? "end" : "middle"); selection2.each(function() { this.__axis = position2; }); } axis2.scale = function(_2) { return arguments.length ? (scale = _2, axis2) : scale; }; axis2.ticks = function() { return tickArguments = Array.from(arguments), axis2; }; axis2.tickArguments = function(_2) { return arguments.length ? (tickArguments = _2 == null ? [] : Array.from(_2), axis2) : tickArguments.slice(); }; axis2.tickValues = function(_2) { return arguments.length ? (tickValues = _2 == null ? null : Array.from(_2), axis2) : tickValues && tickValues.slice(); }; axis2.tickFormat = function(_2) { return arguments.length ? (tickFormat2 = _2, axis2) : tickFormat2; }; axis2.tickSize = function(_2) { return arguments.length ? (tickSizeInner = tickSizeOuter = +_2, axis2) : tickSizeInner; }; axis2.tickSizeInner = function(_2) { return arguments.length ? (tickSizeInner = +_2, axis2) : tickSizeInner; }; axis2.tickSizeOuter = function(_2) { return arguments.length ? (tickSizeOuter = +_2, axis2) : tickSizeOuter; }; axis2.tickPadding = function(_2) { return arguments.length ? (tickPadding = +_2, axis2) : tickPadding; }; axis2.offset = function(_2) { return arguments.length ? (offset = +_2, axis2) : offset; }; return axis2; } function axisTop(scale) { return axis(top, scale); } function axisBottom(scale) { return axis(bottom, scale); } var noop$2 = { value: () => { } }; function dispatch() { for (var i2 = 0, n = arguments.length, _2 = {}, t; i2 < n; ++i2) { if (!(t = arguments[i2] + "") || t in _2 || /[\s.]/.test(t)) throw new Error("illegal type: " + t); _2[t] = []; } return new Dispatch(_2); } function Dispatch(_2) { this._ = _2; } function parseTypenames$1(typenames, types) { return typenames.trim().split(/^|\s+/).map(function(t) { var name = "", i2 = t.indexOf("."); if (i2 >= 0) name = t.slice(i2 + 1), t = t.slice(0, i2); 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 _2 = this._, T2 = parseTypenames$1(typename + "", _2), t, i2 = -1, n = T2.length; if (arguments.length < 2) { while (++i2 < n) if ((t = (typename = T2[i2]).type) && (t = get$3(_2[t], typename.name))) return t; return; } if (callback != null && typeof callback !== "function") throw new Error("invalid callback: " + callback); while (++i2 < n) { if (t = (typename = T2[i2]).type) _2[t] = set$3(_2[t], typename.name, callback); else if (callback == null) for (t in _2) _2[t] = set$3(_2[t], typename.name, null); } return this; }, copy: function() { var copy2 = {}, _2 = this._; for (var t in _2) copy2[t] = _2[t].slice(); return new Dispatch(copy2); }, call: function(type2, that) { if ((n = arguments.length - 2) > 0) for (var args = new Array(n), i2 = 0, n, t; i2 < n; ++i2) args[i2] = arguments[i2 + 2]; if (!this._.hasOwnProperty(type2)) throw new Error("unknown type: " + type2); for (t = this._[type2], i2 = 0, n = t.length; i2 < n; ++i2) t[i2].value.apply(that, args); }, apply: function(type2, that, args) { if (!this._.hasOwnProperty(type2)) throw new Error("unknown type: " + type2); for (var t = this._[type2], i2 = 0, n = t.length; i2 < n; ++i2) t[i2].value.apply(that, args); } }; function get$3(type2, name) { for (var i2 = 0, n = type2.length, c2; i2 < n; ++i2) { if ((c2 = type2[i2]).name === name) { return c2.value; } } } function set$3(type2, name, callback) { for (var i2 = 0, n = type2.length; i2 < n; ++i2) { if (type2[i2].name === name) { type2[i2] = noop$2, type2 = type2.slice(0, i2).concat(type2.slice(i2 + 1)); break; } } if (callback != null) type2.push({ name, value: callback }); return type2; } var xhtml = "http://www.w3.org/1999/xhtml"; const namespaces$1 = { svg: "http://www.w3.org/2000/svg", xhtml, xlink: "http://www.w3.org/1999/xlink", xml: "http://www.w3.org/XML/1998/namespace", xmlns: "http://www.w3.org/2000/xmlns/" }; function namespace(name) { var prefix = name += "", i2 = prefix.indexOf(":"); if (i2 >= 0 && (prefix = name.slice(0, i2)) !== "xmlns") name = name.slice(i2 + 1); return namespaces$1.hasOwnProperty(prefix) ? { space: namespaces$1[prefix], local: name } : name; } 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(name) { var fullname = namespace(name); return (fullname.local ? creatorFixed : creatorInherit)(fullname); } function none() { } function selector(selector2) { return selector2 == null ? none : function() { return this.querySelector(selector2); }; } function selection_select(select) { if (typeof select !== "function") select = selector(select); for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) { for (var group = groups[j], n = group.length, subgroup = subgroups[j] = new Array(n), node2, subnode, i2 = 0; i2 < n; ++i2) { if ((node2 = group[i2]) && (subnode = select.call(node2, node2.__data__, i2, group))) { if ("__data__" in node2) subnode.__data__ = node2.__data__; subgroup[i2] = subnode; } } } return new Selection$1(subgroups, this._parents); } function array$1(x2) { return x2 == null ? [] : Array.isArray(x2) ? x2 : Array.from(x2); } function empty() { return []; } function selectorAll(selector2) { return selector2 == null ? empty : function() { return this.querySelectorAll(selector2); }; } function arrayAll(select) { return function() { return array$1(select.apply(this, arguments)); }; } function selection_selectAll(select) { if (typeof select === "function") select = arrayAll(select); else select = selectorAll(select); for (var groups = this._groups, m = groups.length, subgroups = [], parents2 = [], j = 0; j < m; ++j) { for (var group = groups[j], n = group.length, node2, i2 = 0; i2 < n; ++i2) { if (node2 = group[i2]) { subgroups.push(select.call(node2, node2.__data__, i2, group)); parents2.push(node2); } } } return new Selection$1(subgroups, parents2); } function matcher(selector2) { return function() { return this.matches(selector2); }; } function childMatcher(selector2) { return function(node2) { return node2.matches(selector2); }; } var find$3 = Array.prototype.find; function childFind(match) { return function() { return find$3.call(this.children, match); }; } function childFirst() { return this.firstElementChild; } function selection_selectChild(match) { return this.select(match == null ? childFirst : childFind(typeof match === "function" ? match : childMatcher(match))); } var filter$1 = Array.prototype.filter; function children() { return Array.from(this.children); } function childrenFilter(match) { return function() { return filter$1.call(this.children, match); }; } function selection_selectChildren(match) { return this.selectAll(match == null ? children : childrenFilter(typeof match === "function" ? match : childMatcher(match))); } function selection_filter(match) { if (typeof match !== "function") match = matcher(match); for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) { for (var group = groups[j], n = group.length, subgroup = subgroups[j] = [], node2, i2 = 0; i2 < n; ++i2) { if ((node2 = group[i2]) && match.call(node2, node2.__data__, i2, group)) { subgroup.push(node2); } } } return new Selection$1(subgroups, this._parents); } function sparse(update2) { return new Array(update2.length); } function selection_enter() { return new Selection$1(this._enter || this._groups.map(sparse), 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, next2) { return this._parent.insertBefore(child, next2); }, querySelector: function(selector2) { return this._parent.querySelector(selector2); }, querySelectorAll: function(selector2) { return this._parent.querySelectorAll(selector2); } }; function constant$5(x2) { return function() { return x2; }; } function bindIndex(parent, group, enter2, update2, exit2, data) { var i2 = 0, node2, groupLength2 = group.length, dataLength = data.length; for (; i2 < dataLength; ++i2) { if (node2 = group[i2]) { node2.__data__ = data[i2]; update2[i2] = node2; } else { enter2[i2] = new EnterNode(parent, data[i2]); } } for (; i2 < groupLength2; ++i2) { if (node2 = group[i2]) { exit2[i2] = node2; } } } function bindKey(parent, group, enter2, update2, exit2, data, key) { var i2, node2, nodeByKeyValue = /* @__PURE__ */ new Map(), groupLength2 = group.length, dataLength = data.length, keyValues = new Array(groupLength2), keyValue; for (i2 = 0; i2 < groupLength2; ++i2) { if (node2 = group[i2]) { keyValues[i2] = keyValue = key.call(node2, node2.__data__, i2, group) + ""; if (nodeByKeyValue.has(keyValue)) { exit2[i2] = node2; } else { nodeByKeyValue.set(keyValue, node2); } } } for (i2 = 0; i2 < dataLength; ++i2) { keyValue = key.call(parent, data[i2], i2, data) + ""; if (node2 = nodeByKeyValue.get(keyValue)) { update2[i2] = node2; node2.__data__ = data[i2]; nodeByKeyValue.delete(keyValue); } else { enter2[i2] = new EnterNode(parent, data[i2]); } } for (i2 = 0; i2 < groupLength2; ++i2) { if ((node2 = group[i2]) && nodeByKeyValue.get(keyValues[i2]) === node2) { exit2[i2] = node2; } } } function datum(node2) { return node2.__data__; } function selection_data(value2, key) { if (!arguments.length) return Array.from(this, datum); var bind = key ? bindKey : bindIndex, parents2 = this._parents, groups = this._groups; if (typeof value2 !== "function") value2 = constant$5(value2); for (var m = groups.length, update2 = new Array(m), enter2 = new Array(m), exit2 = new Array(m), j = 0; j < m; ++j) { var parent = parents2[j], group = groups[j], groupLength2 = group.length, data = arraylike(value2.call(parent, parent && parent.__data__, j, parents2)), dataLength = data.length, enterGroup = enter2[j] = new Array(dataLength), updateGroup = update2[j] = new Array(dataLength), exitGroup = exit2[j] = new Array(groupLength2); bind(parent, group, enterGroup, updateGroup, exitGroup, data, key); for (var i0 = 0, i1 = 0, previous2, next2; i0 < dataLength; ++i0) { if (previous2 = enterGroup[i0]) { if (i0 >= i1) i1 = i0 + 1; while (!(next2 = updateGroup[i1]) && ++i1 < dataLength) ; previous2._next = next2 || null; } } } update2 = new Selection$1(update2, parents2); update2._enter = enter2; update2._exit = exit2; return update2; } function arraylike(data) { return typeof data === "object" && "length" in data ? data : Array.from(data); } function selection_exit() { return new Selection$1(this._exit || this._groups.map(sparse), this._parents); } function selection_join(onenter, onupdate, onexit) { var enter2 = this.enter(), update2 = this, exit2 = this.exit(); if (typeof onenter === "function") { enter2 = onenter(enter2); if (enter2) enter2 = enter2.selection(); } else { enter2 = enter2.append(onenter + ""); } if (onupdate != null) { update2 = onupdate(update2); if (update2) update2 = update2.selection(); } if (onexit == null) exit2.remove(); else onexit(exit2); return enter2 && update2 ? enter2.merge(update2).order() : update2; } function selection_merge(context) { var selection2 = context.selection ? context.selection() : context; for (var groups0 = this._groups, groups1 = selection2._groups, m0 = groups0.length, m1 = groups1.length, m = Math.min(m0, m1), merges = new Array(m0), j = 0; j < m; ++j) { for (var group0 = groups0[j], group1 = groups1[j], n = group0.length, merge2 = merges[j] = new Array(n), node2, i2 = 0; i2 < n; ++i2) { if (node2 = group0[i2] || group1[i2]) { merge2[i2] = node2; } } } for (; j < m0; ++j) { merges[j] = groups0[j]; } return new Selection$1(merges, this._parents); } function selection_order() { for (var groups = this._groups, j = -1, m = groups.length; ++j < m; ) { for (var group = groups[j], i2 = group.length - 1, next2 = group[i2], node2; --i2 >= 0; ) { if (node2 = group[i2]) { if (next2 && node2.compareDocumentPosition(next2) ^ 4) next2.parentNode.insertBefore(node2, next2); next2 = node2; } } } return this; } function selection_sort(compare) { if (!compare) compare = ascending; function compareNode(a, b) { return a && b ? compare(a.__data__, b.__data__) : !a - !b; } for (var groups = this._groups, m = groups.length, sortgroups = new Array(m), j = 0; j < m; ++j) { for (var group = groups[j], n = group.length, sortgroup = sortgroups[j] = new Array(n), node2, i2 = 0; i2 < n; ++i2) { if (node2 = group[i2]) { sortgroup[i2] = node2; } } sortgroup.sort(compareNode); } return new Selection$1(sortgroups, this._parents).order(); } function ascending(a, b) { return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN; } function selection_call() { var callback = arguments[0]; arguments[0] = this; callback.apply(null, arguments); return this; } function selection_nodes() { return Array.from(this); } function selection_node() { for (var groups = this._groups, j = 0, m = groups.length; j < m; ++j) { for (var group = groups[j], i2 = 0, n = group.length; i2 < n; ++i2) { var node2 = group[i2]; if (node2) return node2; } } return null; } function selection_size() { let size2 = 0; for (const node2 of this) ++size2; return size2; } function selection_empty() { return !this.node(); } function selection_each(callback) { for (var groups = this._groups, j = 0, m = groups.length; j < m; ++j) { for (var group = groups[j], i2 = 0, n = group.length, node2; i2 < n; ++i2) { if (node2 = group[i2]) callback.call(node2, node2.__data__, i2, group); } } return this; } function attrRemove$1(name) { return function() { this.removeAttribute(name); }; } function attrRemoveNS$1(fullname) { return function() { this.removeAttributeNS(fullname.space, fullname.local); }; } function attrConstant$1(name, value2) { return function() { this.setAttribute(name, value2); }; } function attrConstantNS$1(fullname, value2) { return function() { this.setAttributeNS(fullname.space, fullname.local, value2); }; } function attrFunction$1(name, value2) { return function() { var v = value2.apply(this, arguments); if (v == null) this.removeAttribute(name); else this.setAttribute(name, v); }; } function attrFunctionNS$1(fullname, value2) { return function() { var v = value2.apply(this, arguments); if (v == null) this.removeAttributeNS(fullname.space, fullname.local); else this.setAttributeNS(fullname.space, fullname.local, v); }; } function selection_attr(name, value2) { var fullname = namespace(name); if (arguments.length < 2) { var node2 = this.node(); return fullname.local ? node2.getAttributeNS(fullname.space, fullname.local) : node2.getAttribute(fullname); } return this.each((value2 == null ? fullname.local ? attrRemoveNS$1 : attrRemove$1 : typeof value2 === "function" ? fullname.local ? attrFunctionNS$1 : attrFunction$1 : fullname.local ? attrConstantNS$1 : attrConstant$1)(fullname, value2)); } function defaultView(node2) { return node2.ownerDocument && node2.ownerDocument.defaultView || node2.document && node2 || node2.defaultView; } function styleRemove$1(name) { return function() { this.style.removeProperty(name); }; } function styleConstant$1(name, value2, priority) { return function() { this.style.setProperty(name, value2, priority); }; } function styleFunction$1(name, value2, priority) { return function() { var v = value2.apply(this, arguments); if (v == null) this.style.removeProperty(name); else this.style.setProperty(name, v, priority); }; } function selection_style(name, value2, priority) { return arguments.length > 1 ? this.each((value2 == null ? styleRemove$1 : typeof value2 === "function" ? styleFunction$1 : styleConstant$1)(name, value2, priority == null ? "" : priority)) : styleValue(this.node(), name); } function styleValue(node2, name) { return node2.style.getPropertyValue(name) || defaultView(node2).getComputedStyle(node2, null).getPropertyValue(name); } function propertyRemove(name) { return function() { delete this[name]; }; } function propertyConstant(name, value2) { return function() { this[name] = value2; }; } function propertyFunction(name, value2) { return function() { var v = value2.apply(this, arguments); if (v == null) delete this[name]; else this[name] = v; }; } function selection_property(name, value2) { return arguments.length > 1 ? this.each((value2 == null ? propertyRemove : typeof value2 === "function" ? propertyFunction : propertyConstant)(name, value2)) : this.node()[name]; } function classArray(string2) { return string2.trim().split(/^|\s+/); } function classList(node2) { return node2.classList || new ClassList(node2); } function ClassList(node2) { this._node = node2; this._names = classArray(node2.getAttribute("class") || ""); } ClassList.prototype = { add: function(name) { var i2 = this._names.indexOf(name); if (i2 < 0) { this._names.push(name); this._node.setAttribute("class", this._names.join(" ")); } }, remove: function(name) { var i2 = this._names.indexOf(name); if (i2 >= 0) { this._names.splice(i2, 1); this._node.setAttribute("class", this._names.join(" ")); } }, contains: function(name) { return this._names.indexOf(name) >= 0; } }; function classedAdd(node2, names) { var list2 = classList(node2), i2 = -1, n = names.length; while (++i2 < n) list2.add(names[i2]); } function classedRemove(node2, names) { var list2 = classList(node2), i2 = -1, n = names.length; while (++i2 < n) list2.remove(names[i2]); } function classedTrue(names) { return function() { classedAdd(this, names); }; } function classedFalse(names) { return function() { classedRemove(this, names); }; } function classedFunction(names, value2) { return function() { (value2.apply(this, arguments) ? classedAdd : classedRemove)(this, names); }; } function selection_classed(name, value2) { var names = classArray(name + ""