mermaid
Version:
Markdown-ish syntax for generating flowcharts, mindmaps, sequence diagrams, class diagrams, gantt charts, git graphs and more.
1,318 lines (1,284 loc) • 433 kB
JavaScript
import {
__commonJS,
__export,
__name,
__toESM
} from "./chunk-DLQEHMXD.mjs";
// ../../node_modules/.pnpm/dayjs@1.11.13/node_modules/dayjs/dayjs.min.js
var require_dayjs_min = __commonJS({
"../../node_modules/.pnpm/dayjs@1.11.13/node_modules/dayjs/dayjs.min.js"(exports, module) {
"use strict";
!function(t, e) {
"object" == typeof exports && "undefined" != typeof module ? module.exports = e() : "function" == typeof define && define.amd ? define(e) : (t = "undefined" != typeof globalThis ? globalThis : t || self).dayjs = e();
}(exports, function() {
"use strict";
var t = 1e3, e = 6e4, n = 36e5, r = "millisecond", i = "second", s = "minute", u = "hour", a = "day", o = "week", c = "month", f = "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: /* @__PURE__ */ __name(function(t4) {
var e3 = ["th", "st", "nd", "rd"], n2 = t4 % 100;
return "[" + t4 + (e3[(n2 - 20) % 10] || e3[n2] || e3[0]) + "]";
}, "ordinal") }, m = /* @__PURE__ */ __name(function(t4, e3, n2) {
var r2 = String(t4);
return !r2 || r2.length >= e3 ? t4 : "" + Array(e3 + 1 - r2.length).join(n2) + t4;
}, "m"), v = { s: m, z: /* @__PURE__ */ __name(function(t4) {
var e3 = -t4.utcOffset(), n2 = Math.abs(e3), r2 = Math.floor(n2 / 60), i2 = n2 % 60;
return (e3 <= 0 ? "+" : "-") + m(r2, 2, "0") + ":" + m(i2, 2, "0");
}, "z"), m: /* @__PURE__ */ __name(function t4(e3, n2) {
if (e3.date() < n2.date()) return -t4(n2, e3);
var r2 = 12 * (n2.year() - e3.year()) + (n2.month() - e3.month()), i2 = e3.clone().add(r2, c), s2 = n2 - i2 < 0, u2 = e3.clone().add(r2 + (s2 ? -1 : 1), c);
return +(-(r2 + (n2 - i2) / (s2 ? i2 - u2 : u2 - i2)) || 0);
}, "t"), a: /* @__PURE__ */ __name(function(t4) {
return t4 < 0 ? Math.ceil(t4) || 0 : Math.floor(t4);
}, "a"), p: /* @__PURE__ */ __name(function(t4) {
return { M: c, y: h, w: o, d: a, D: d, h: u, m: s, s: i, ms: r, Q: f }[t4] || String(t4 || "").toLowerCase().replace(/s$/, "");
}, "p"), u: /* @__PURE__ */ __name(function(t4) {
return void 0 === t4;
}, "u") }, g = "en", D = {};
D[g] = M;
var p = "$isDayjsObject", S = /* @__PURE__ */ __name(function(t4) {
return t4 instanceof _ || !(!t4 || !t4[p]);
}, "S"), w = /* @__PURE__ */ __name(function t4(e3, n2, r2) {
var i2;
if (!e3) return g;
if ("string" == typeof e3) {
var s2 = e3.toLowerCase();
D[s2] && (i2 = s2), n2 && (D[s2] = n2, i2 = s2);
var u2 = e3.split("-");
if (!i2 && u2.length > 1) return t4(u2[0]);
} else {
var a2 = e3.name;
D[a2] = e3, i2 = a2;
}
return !r2 && i2 && (g = i2), i2 || !r2 && g;
}, "t"), O = /* @__PURE__ */ __name(function(t4, e3) {
if (S(t4)) return t4.clone();
var n2 = "object" == typeof e3 ? e3 : {};
return n2.date = t4, n2.args = arguments, new _(n2);
}, "O"), b = v;
b.l = w, b.i = S, b.w = function(t4, e3) {
return O(t4, { locale: e3.$L, utc: e3.$u, x: e3.$x, $offset: e3.$offset });
};
var _ = function() {
function M2(t4) {
this.$L = w(t4.locale, null, true), this.parse(t4), this.$x = this.$x || t4.x || {}, this[p] = true;
}
__name(M2, "M");
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 i2 = r2[2] - 1 || 0, s2 = (r2[7] || "0").substring(0, 3);
return n2 ? new Date(Date.UTC(r2[1], i2, r2[3] || 1, r2[4] || 0, r2[5] || 0, r2[6] || 0, s2)) : new Date(r2[1], i2, 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, f2 = b.p(t4), l2 = /* @__PURE__ */ __name(function(t5, e4) {
var i2 = b.w(n2.$u ? Date.UTC(n2.$y, e4, t5) : new Date(n2.$y, e4, t5), n2);
return r2 ? i2 : i2.endOf(a);
}, "l"), $2 = /* @__PURE__ */ __name(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 (f2) {
case h:
return r2 ? l2(1, 0) : l2(31, 11);
case c:
return r2 ? l2(1, M3) : l2(0, M3 + 1);
case o:
var g2 = this.$locale().weekStart || 0, D2 = (y3 < g2 ? y3 + 7 : y3) - g2;
return l2(r2 ? m3 - D2 : m3 + (6 - D2), 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 i:
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), f2 = "set" + (this.$u ? "UTC" : ""), l2 = (n2 = {}, n2[a] = f2 + "Date", n2[d] = f2 + "Date", n2[c] = f2 + "Month", n2[h] = f2 + "FullYear", n2[u] = f2 + "Hours", n2[s] = f2 + "Minutes", n2[i] = f2 + "Seconds", n2[r] = f2 + "Milliseconds", n2)[o2], $2 = o2 === a ? this.$D + (e3 - this.$W) : e3;
if (o2 === c || 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, f2) {
var d2, l2 = this;
r2 = Number(r2);
var $2 = b.p(f2), y3 = /* @__PURE__ */ __name(function(t4) {
var e3 = O(l2);
return b.w(e3.date(e3.date() + Math.round(t4 * r2)), l2);
}, "y");
if ($2 === c) return this.set(c, 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[i] = 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", i2 = b.z(this), s2 = this.$H, u2 = this.$m, a2 = this.$M, o2 = n2.weekdays, c2 = n2.months, f2 = n2.meridiem, h2 = /* @__PURE__ */ __name(function(t5, n3, i3, s3) {
return t5 && (t5[n3] || t5(e3, r2)) || i3[n3].slice(0, s3);
}, "h"), d2 = /* @__PURE__ */ __name(function(t5) {
return b.s(s2 % 12 || 12, t5, "0");
}, "d"), $2 = f2 || 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, c2, 3);
case "MMMM":
return h2(c2, 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 i2;
}
return null;
}(t5) || i2.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, D2 = /* @__PURE__ */ __name(function() {
return b.m(y3, m3);
}, "D");
switch (M3) {
case h:
$2 = D2() / 12;
break;
case c:
$2 = D2();
break;
case f:
$2 = D2() / 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 i:
$2 = g2 / t;
break;
default:
$2 = g2;
}
return l2 ? $2 : b.a($2);
}, m2.daysInMonth = function() {
return this.endOf(c).$D;
}, m2.$locale = function() {
return D[this.$L];
}, m2.locale = function(t4, e3) {
if (!t4) return this.$L;
var n2 = this.clone(), r2 = w(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 = _.prototype;
return O.prototype = k, [["$ms", r], ["$s", i], ["$m", s], ["$H", u], ["$W", a], ["$M", c], ["$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, _, O), t4.$i = true), O;
}, O.locale = w, O.isDayjs = S, O.unix = function(t4) {
return O(1e3 * t4);
}, O.en = D[g], O.Ls = D, O.p = {}, O;
});
}
});
// src/logger.ts
var import_dayjs = __toESM(require_dayjs_min(), 1);
var LEVELS = {
trace: 0,
debug: 1,
info: 2,
warn: 3,
error: 4,
fatal: 5
};
var log = {
trace: /* @__PURE__ */ __name((..._args) => {
}, "trace"),
debug: /* @__PURE__ */ __name((..._args) => {
}, "debug"),
info: /* @__PURE__ */ __name((..._args) => {
}, "info"),
warn: /* @__PURE__ */ __name((..._args) => {
}, "warn"),
error: /* @__PURE__ */ __name((..._args) => {
}, "error"),
fatal: /* @__PURE__ */ __name((..._args) => {
}, "fatal")
};
var setLogLevel = /* @__PURE__ */ __name(function(level = "fatal") {
let numericLevel = LEVELS.fatal;
if (typeof level === "string") {
if (level.toLowerCase() in LEVELS) {
numericLevel = LEVELS[level];
}
} else if (typeof level === "number") {
numericLevel = level;
}
log.trace = () => {
};
log.debug = () => {
};
log.info = () => {
};
log.warn = () => {
};
log.error = () => {
};
log.fatal = () => {
};
if (numericLevel <= LEVELS.fatal) {
log.fatal = console.error ? console.error.bind(console, format("FATAL"), "color: orange") : console.log.bind(console, "\x1B[35m", format("FATAL"));
}
if (numericLevel <= LEVELS.error) {
log.error = console.error ? console.error.bind(console, format("ERROR"), "color: orange") : console.log.bind(console, "\x1B[31m", format("ERROR"));
}
if (numericLevel <= LEVELS.warn) {
log.warn = console.warn ? console.warn.bind(console, format("WARN"), "color: orange") : console.log.bind(console, `\x1B[33m`, format("WARN"));
}
if (numericLevel <= LEVELS.info) {
log.info = console.info ? console.info.bind(console, format("INFO"), "color: lightblue") : console.log.bind(console, "\x1B[34m", format("INFO"));
}
if (numericLevel <= LEVELS.debug) {
log.debug = console.debug ? console.debug.bind(console, format("DEBUG"), "color: lightgreen") : console.log.bind(console, "\x1B[32m", format("DEBUG"));
}
if (numericLevel <= LEVELS.trace) {
log.trace = console.debug ? console.debug.bind(console, format("TRACE"), "color: lightgreen") : console.log.bind(console, "\x1B[32m", format("TRACE"));
}
}, "setLogLevel");
var format = /* @__PURE__ */ __name((level) => {
const time2 = (0, import_dayjs.default)().format("ss.SSS");
return `%c${time2} : ${level} : `;
}, "format");
// src/diagram-api/regexes.ts
var frontMatterRegex = /^-{3}\s*[\n\r](.*?)[\n\r]-{3}\s*[\n\r]+/s;
var directiveRegex = /%{2}{\s*(?:(\w+)\s*:|(\w+))\s*(?:(\w+)|((?:(?!}%{2}).|\r?\n)*))?\s*(?:}%{2})?/gi;
var anyCommentRegex = /\s*%%.*\n/gm;
// src/errors.ts
var UnknownDiagramError = class extends Error {
static {
__name(this, "UnknownDiagramError");
}
constructor(message) {
super(message);
this.name = "UnknownDiagramError";
}
};
// src/diagram-api/detectType.ts
var detectors = {};
var detectType = /* @__PURE__ */ __name(function(text2, config2) {
text2 = text2.replace(frontMatterRegex, "").replace(directiveRegex, "").replace(anyCommentRegex, "\n");
for (const [key, { detector }] of Object.entries(detectors)) {
const diagram = detector(text2, config2);
if (diagram) {
return key;
}
}
throw new UnknownDiagramError(
`No diagram type detected matching given configuration for text: ${text2}`
);
}, "detectType");
var registerLazyLoadedDiagrams = /* @__PURE__ */ __name((...diagrams2) => {
for (const { id: id2, detector, loader } of diagrams2) {
addDetector(id2, detector, loader);
}
}, "registerLazyLoadedDiagrams");
var addDetector = /* @__PURE__ */ __name((key, detector, loader) => {
if (detectors[key]) {
log.warn(`Detector with key ${key} already exists. Overwriting.`);
}
detectors[key] = { detector, loader };
log.debug(`Detector with key ${key} added${loader ? " with loader" : ""}`);
}, "addDetector");
var getDiagramLoader = /* @__PURE__ */ __name((key) => {
return detectors[key].loader;
}, "getDiagramLoader");
// src/assignWithDepth.ts
var assignWithDepth = /* @__PURE__ */ __name((dst, src, { depth = 2, clobber = false } = {}) => {
const config2 = { depth, clobber };
if (Array.isArray(src) && !Array.isArray(dst)) {
src.forEach((s) => assignWithDepth(dst, s, config2));
return dst;
} else if (Array.isArray(src) && Array.isArray(dst)) {
src.forEach((s) => {
if (!dst.includes(s)) {
dst.push(s);
}
});
return dst;
}
if (dst === void 0 || depth <= 0) {
if (dst !== void 0 && dst !== null && typeof dst === "object" && typeof src === "object") {
return Object.assign(dst, src);
} else {
return src;
}
}
if (src !== void 0 && typeof dst === "object" && typeof src === "object") {
Object.keys(src).forEach((key) => {
if (typeof src[key] === "object" && (dst[key] === void 0 || typeof dst[key] === "object")) {
if (dst[key] === void 0) {
dst[key] = Array.isArray(src[key]) ? [] : {};
}
dst[key] = assignWithDepth(dst[key], src[key], { depth: depth - 1, clobber });
} else if (clobber || typeof dst[key] !== "object" && typeof src[key] !== "object") {
dst[key] = src[key];
}
});
}
return dst;
}, "assignWithDepth");
var assignWithDepth_default = assignWithDepth;
// ../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/utils/channel.js
var Channel = {
/* CLAMP */
min: {
r: 0,
g: 0,
b: 0,
s: 0,
l: 0,
a: 0
},
max: {
r: 255,
g: 255,
b: 255,
h: 360,
s: 100,
l: 100,
a: 1
},
clamp: {
r: /* @__PURE__ */ __name((r) => r >= 255 ? 255 : r < 0 ? 0 : r, "r"),
g: /* @__PURE__ */ __name((g) => g >= 255 ? 255 : g < 0 ? 0 : g, "g"),
b: /* @__PURE__ */ __name((b) => b >= 255 ? 255 : b < 0 ? 0 : b, "b"),
h: /* @__PURE__ */ __name((h) => h % 360, "h"),
s: /* @__PURE__ */ __name((s) => s >= 100 ? 100 : s < 0 ? 0 : s, "s"),
l: /* @__PURE__ */ __name((l) => l >= 100 ? 100 : l < 0 ? 0 : l, "l"),
a: /* @__PURE__ */ __name((a) => a >= 1 ? 1 : a < 0 ? 0 : a, "a")
},
/* CONVERSION */
//SOURCE: https://planetcalc.com/7779
toLinear: /* @__PURE__ */ __name((c) => {
const n = c / 255;
return c > 0.03928 ? Math.pow((n + 0.055) / 1.055, 2.4) : n / 12.92;
}, "toLinear"),
//SOURCE: https://gist.github.com/mjackson/5311256
hue2rgb: /* @__PURE__ */ __name((p, q, t) => {
if (t < 0)
t += 1;
if (t > 1)
t -= 1;
if (t < 1 / 6)
return p + (q - p) * 6 * t;
if (t < 1 / 2)
return q;
if (t < 2 / 3)
return p + (q - p) * (2 / 3 - t) * 6;
return p;
}, "hue2rgb"),
hsl2rgb: /* @__PURE__ */ __name(({ h, s, l }, channel2) => {
if (!s)
return l * 2.55;
h /= 360;
s /= 100;
l /= 100;
const q = l < 0.5 ? l * (1 + s) : l + s - l * s;
const p = 2 * l - q;
switch (channel2) {
case "r":
return Channel.hue2rgb(p, q, h + 1 / 3) * 255;
case "g":
return Channel.hue2rgb(p, q, h) * 255;
case "b":
return Channel.hue2rgb(p, q, h - 1 / 3) * 255;
}
}, "hsl2rgb"),
rgb2hsl: /* @__PURE__ */ __name(({ r, g, b }, channel2) => {
r /= 255;
g /= 255;
b /= 255;
const max4 = Math.max(r, g, b);
const min4 = Math.min(r, g, b);
const l = (max4 + min4) / 2;
if (channel2 === "l")
return l * 100;
if (max4 === min4)
return 0;
const d = max4 - min4;
const s = l > 0.5 ? d / (2 - max4 - min4) : d / (max4 + min4);
if (channel2 === "s")
return s * 100;
switch (max4) {
case r:
return ((g - b) / d + (g < b ? 6 : 0)) * 60;
case g:
return ((b - r) / d + 2) * 60;
case b:
return ((r - g) / d + 4) * 60;
default:
return -1;
}
}, "rgb2hsl")
};
var channel_default = Channel;
// ../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/utils/lang.js
var Lang = {
/* API */
clamp: /* @__PURE__ */ __name((number5, lower2, upper) => {
if (lower2 > upper)
return Math.min(lower2, Math.max(upper, number5));
return Math.min(upper, Math.max(lower2, number5));
}, "clamp"),
round: /* @__PURE__ */ __name((number5) => {
return Math.round(number5 * 1e10) / 1e10;
}, "round")
};
var lang_default = Lang;
// ../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/utils/unit.js
var Unit = {
/* API */
dec2hex: /* @__PURE__ */ __name((dec) => {
const hex2 = Math.round(dec).toString(16);
return hex2.length > 1 ? hex2 : `0${hex2}`;
}, "dec2hex")
};
var unit_default = Unit;
// ../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/utils/index.js
var Utils = {
channel: channel_default,
lang: lang_default,
unit: unit_default
};
var utils_default = Utils;
// ../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/constants.js
var DEC2HEX = {};
for (let i = 0; i <= 255; i++)
DEC2HEX[i] = utils_default.unit.dec2hex(i);
var TYPE = {
ALL: 0,
RGB: 1,
HSL: 2
};
// ../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/channels/type.js
var Type = class {
static {
__name(this, "Type");
}
constructor() {
this.type = TYPE.ALL;
}
/* API */
get() {
return this.type;
}
set(type2) {
if (this.type && this.type !== type2)
throw new Error("Cannot change both RGB and HSL channels at the same time");
this.type = type2;
}
reset() {
this.type = TYPE.ALL;
}
is(type2) {
return this.type === type2;
}
};
var type_default = Type;
// ../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/channels/index.js
var Channels = class {
static {
__name(this, "Channels");
}
/* CONSTRUCTOR */
constructor(data, color2) {
this.color = color2;
this.changed = false;
this.data = data;
this.type = new type_default();
}
/* API */
set(data, color2) {
this.color = color2;
this.changed = false;
this.data = data;
this.type.type = TYPE.ALL;
return this;
}
/* HELPERS */
_ensureHSL() {
const data = this.data;
const { h, s, l } = data;
if (h === void 0)
data.h = utils_default.channel.rgb2hsl(data, "h");
if (s === void 0)
data.s = utils_default.channel.rgb2hsl(data, "s");
if (l === void 0)
data.l = utils_default.channel.rgb2hsl(data, "l");
}
_ensureRGB() {
const data = this.data;
const { r, g, b } = data;
if (r === void 0)
data.r = utils_default.channel.hsl2rgb(data, "r");
if (g === void 0)
data.g = utils_default.channel.hsl2rgb(data, "g");
if (b === void 0)
data.b = utils_default.channel.hsl2rgb(data, "b");
}
/* GETTERS */
get r() {
const data = this.data;
const r = data.r;
if (!this.type.is(TYPE.HSL) && r !== void 0)
return r;
this._ensureHSL();
return utils_default.channel.hsl2rgb(data, "r");
}
get g() {
const data = this.data;
const g = data.g;
if (!this.type.is(TYPE.HSL) && g !== void 0)
return g;
this._ensureHSL();
return utils_default.channel.hsl2rgb(data, "g");
}
get b() {
const data = this.data;
const b = data.b;
if (!this.type.is(TYPE.HSL) && b !== void 0)
return b;
this._ensureHSL();
return utils_default.channel.hsl2rgb(data, "b");
}
get h() {
const data = this.data;
const h = data.h;
if (!this.type.is(TYPE.RGB) && h !== void 0)
return h;
this._ensureRGB();
return utils_default.channel.rgb2hsl(data, "h");
}
get s() {
const data = this.data;
const s = data.s;
if (!this.type.is(TYPE.RGB) && s !== void 0)
return s;
this._ensureRGB();
return utils_default.channel.rgb2hsl(data, "s");
}
get l() {
const data = this.data;
const l = data.l;
if (!this.type.is(TYPE.RGB) && l !== void 0)
return l;
this._ensureRGB();
return utils_default.channel.rgb2hsl(data, "l");
}
get a() {
return this.data.a;
}
/* SETTERS */
set r(r) {
this.type.set(TYPE.RGB);
this.changed = true;
this.data.r = r;
}
set g(g) {
this.type.set(TYPE.RGB);
this.changed = true;
this.data.g = g;
}
set b(b) {
this.type.set(TYPE.RGB);
this.changed = true;
this.data.b = b;
}
set h(h) {
this.type.set(TYPE.HSL);
this.changed = true;
this.data.h = h;
}
set s(s) {
this.type.set(TYPE.HSL);
this.changed = true;
this.data.s = s;
}
set l(l) {
this.type.set(TYPE.HSL);
this.changed = true;
this.data.l = l;
}
set a(a) {
this.changed = true;
this.data.a = a;
}
};
var channels_default = Channels;
// ../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/channels/reusable.js
var channels = new channels_default({ r: 0, g: 0, b: 0, a: 0 }, "transparent");
var reusable_default = channels;
// ../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/color/hex.js
var Hex = {
/* VARIABLES */
re: /^#((?:[a-f0-9]{2}){2,4}|[a-f0-9]{3})$/i,
/* API */
parse: /* @__PURE__ */ __name((color2) => {
if (color2.charCodeAt(0) !== 35)
return;
const match = color2.match(Hex.re);
if (!match)
return;
const hex2 = match[1];
const dec = parseInt(hex2, 16);
const length = hex2.length;
const hasAlpha = length % 4 === 0;
const isFullLength = length > 4;
const multiplier = isFullLength ? 1 : 17;
const bits = isFullLength ? 8 : 4;
const bitsOffset = hasAlpha ? 0 : -1;
const mask = isFullLength ? 255 : 15;
return reusable_default.set({
r: (dec >> bits * (bitsOffset + 3) & mask) * multiplier,
g: (dec >> bits * (bitsOffset + 2) & mask) * multiplier,
b: (dec >> bits * (bitsOffset + 1) & mask) * multiplier,
a: hasAlpha ? (dec & mask) * multiplier / 255 : 1
}, color2);
}, "parse"),
stringify: /* @__PURE__ */ __name((channels2) => {
const { r, g, b, a } = channels2;
if (a < 1) {
return `#${DEC2HEX[Math.round(r)]}${DEC2HEX[Math.round(g)]}${DEC2HEX[Math.round(b)]}${DEC2HEX[Math.round(a * 255)]}`;
} else {
return `#${DEC2HEX[Math.round(r)]}${DEC2HEX[Math.round(g)]}${DEC2HEX[Math.round(b)]}`;
}
}, "stringify")
};
var hex_default = Hex;
// ../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/color/hsl.js
var HSL = {
/* VARIABLES */
re: /^hsla?\(\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?(?:deg|grad|rad|turn)?)\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?%)\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?%)(?:\s*?(?:,|\/)\s*?\+?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?(%)?))?\s*?\)$/i,
hueRe: /^(.+?)(deg|grad|rad|turn)$/i,
/* HELPERS */
_hue2deg: /* @__PURE__ */ __name((hue2) => {
const match = hue2.match(HSL.hueRe);
if (match) {
const [, number5, unit2] = match;
switch (unit2) {
case "grad":
return utils_default.channel.clamp.h(parseFloat(number5) * 0.9);
case "rad":
return utils_default.channel.clamp.h(parseFloat(number5) * 180 / Math.PI);
case "turn":
return utils_default.channel.clamp.h(parseFloat(number5) * 360);
}
}
return utils_default.channel.clamp.h(parseFloat(hue2));
}, "_hue2deg"),
/* API */
parse: /* @__PURE__ */ __name((color2) => {
const charCode = color2.charCodeAt(0);
if (charCode !== 104 && charCode !== 72)
return;
const match = color2.match(HSL.re);
if (!match)
return;
const [, h, s, l, a, isAlphaPercentage] = match;
return reusable_default.set({
h: HSL._hue2deg(h),
s: utils_default.channel.clamp.s(parseFloat(s)),
l: utils_default.channel.clamp.l(parseFloat(l)),
a: a ? utils_default.channel.clamp.a(isAlphaPercentage ? parseFloat(a) / 100 : parseFloat(a)) : 1
}, color2);
}, "parse"),
stringify: /* @__PURE__ */ __name((channels2) => {
const { h, s, l, a } = channels2;
if (a < 1) {
return `hsla(${utils_default.lang.round(h)}, ${utils_default.lang.round(s)}%, ${utils_default.lang.round(l)}%, ${a})`;
} else {
return `hsl(${utils_default.lang.round(h)}, ${utils_default.lang.round(s)}%, ${utils_default.lang.round(l)}%)`;
}
}, "stringify")
};
var hsl_default = HSL;
// ../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/color/keyword.js
var Keyword = {
/* VARIABLES */
colors: {
aliceblue: "#f0f8ff",
antiquewhite: "#faebd7",
aqua: "#00ffff",
aquamarine: "#7fffd4",
azure: "#f0ffff",
beige: "#f5f5dc",
bisque: "#ffe4c4",
black: "#000000",
blanchedalmond: "#ffebcd",
blue: "#0000ff",
blueviolet: "#8a2be2",
brown: "#a52a2a",
burlywood: "#deb887",
cadetblue: "#5f9ea0",
chartreuse: "#7fff00",
chocolate: "#d2691e",
coral: "#ff7f50",
cornflowerblue: "#6495ed",
cornsilk: "#fff8dc",
crimson: "#dc143c",
cyanaqua: "#00ffff",
darkblue: "#00008b",
darkcyan: "#008b8b",
darkgoldenrod: "#b8860b",
darkgray: "#a9a9a9",
darkgreen: "#006400",
darkgrey: "#a9a9a9",
darkkhaki: "#bdb76b",
darkmagenta: "#8b008b",
darkolivegreen: "#556b2f",
darkorange: "#ff8c00",
darkorchid: "#9932cc",
darkred: "#8b0000",
darksalmon: "#e9967a",
darkseagreen: "#8fbc8f",
darkslateblue: "#483d8b",
darkslategray: "#2f4f4f",
darkslategrey: "#2f4f4f",
darkturquoise: "#00ced1",
darkviolet: "#9400d3",
deeppink: "#ff1493",
deepskyblue: "#00bfff",
dimgray: "#696969",
dimgrey: "#696969",
dodgerblue: "#1e90ff",
firebrick: "#b22222",
floralwhite: "#fffaf0",
forestgreen: "#228b22",
fuchsia: "#ff00ff",
gainsboro: "#dcdcdc",
ghostwhite: "#f8f8ff",
gold: "#ffd700",
goldenrod: "#daa520",
gray: "#808080",
green: "#008000",
greenyellow: "#adff2f",
grey: "#808080",
honeydew: "#f0fff0",
hotpink: "#ff69b4",
indianred: "#cd5c5c",
indigo: "#4b0082",
ivory: "#fffff0",
khaki: "#f0e68c",
lavender: "#e6e6fa",
lavenderblush: "#fff0f5",
lawngreen: "#7cfc00",
lemonchiffon: "#fffacd",
lightblue: "#add8e6",
lightcoral: "#f08080",
lightcyan: "#e0ffff",
lightgoldenrodyellow: "#fafad2",
lightgray: "#d3d3d3",
lightgreen: "#90ee90",
lightgrey: "#d3d3d3",
lightpink: "#ffb6c1",
lightsalmon: "#ffa07a",
lightseagreen: "#20b2aa",
lightskyblue: "#87cefa",
lightslategray: "#778899",
lightslategrey: "#778899",
lightsteelblue: "#b0c4de",
lightyellow: "#ffffe0",
lime: "#00ff00",
limegreen: "#32cd32",
linen: "#faf0e6",
magenta: "#ff00ff",
maroon: "#800000",
mediumaquamarine: "#66cdaa",
mediumblue: "#0000cd",
mediumorchid: "#ba55d3",
mediumpurple: "#9370db",
mediumseagreen: "#3cb371",
mediumslateblue: "#7b68ee",
mediumspringgreen: "#00fa9a",
mediumturquoise: "#48d1cc",
mediumvioletred: "#c71585",
midnightblue: "#191970",
mintcream: "#f5fffa",
mistyrose: "#ffe4e1",
moccasin: "#ffe4b5",
navajowhite: "#ffdead",
navy: "#000080",
oldlace: "#fdf5e6",
olive: "#808000",
olivedrab: "#6b8e23",
orange: "#ffa500",
orangered: "#ff4500",
orchid: "#da70d6",
palegoldenrod: "#eee8aa",
palegreen: "#98fb98",
paleturquoise: "#afeeee",
palevioletred: "#db7093",
papayawhip: "#ffefd5",
peachpuff: "#ffdab9",
peru: "#cd853f",
pink: "#ffc0cb",
plum: "#dda0dd",
powderblue: "#b0e0e6",
purple: "#800080",
rebeccapurple: "#663399",
red: "#ff0000",
rosybrown: "#bc8f8f",
royalblue: "#4169e1",
saddlebrown: "#8b4513",
salmon: "#fa8072",
sandybrown: "#f4a460",
seagreen: "#2e8b57",
seashell: "#fff5ee",
sienna: "#a0522d",
silver: "#c0c0c0",
skyblue: "#87ceeb",
slateblue: "#6a5acd",
slategray: "#708090",
slategrey: "#708090",
snow: "#fffafa",
springgreen: "#00ff7f",
tan: "#d2b48c",
teal: "#008080",
thistle: "#d8bfd8",
transparent: "#00000000",
turquoise: "#40e0d0",
violet: "#ee82ee",
wheat: "#f5deb3",
white: "#ffffff",
whitesmoke: "#f5f5f5",
yellow: "#ffff00",
yellowgreen: "#9acd32"
},
/* API */
parse: /* @__PURE__ */ __name((color2) => {
color2 = color2.toLowerCase();
const hex2 = Keyword.colors[color2];
if (!hex2)
return;
return hex_default.parse(hex2);
}, "parse"),
stringify: /* @__PURE__ */ __name((channels2) => {
const hex2 = hex_default.stringify(channels2);
for (const name in Keyword.colors) {
if (Keyword.colors[name] === hex2)
return name;
}
return;
}, "stringify")
};
var keyword_default = Keyword;
// ../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/color/rgb.js
var RGB = {
/* VARIABLES */
re: /^rgba?\(\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))(?:\s*?(?:,|\/)\s*?\+?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?)))?\s*?\)$/i,
/* API */
parse: /* @__PURE__ */ __name((color2) => {
const charCode = color2.charCodeAt(0);
if (charCode !== 114 && charCode !== 82)
return;
const match = color2.match(RGB.re);
if (!match)
return;
const [, r, isRedPercentage, g, isGreenPercentage, b, isBluePercentage, a, isAlphaPercentage] = match;
return reusable_default.set({
r: utils_default.channel.clamp.r(isRedPercentage ? parseFloat(r) * 2.55 : parseFloat(r)),
g: utils_default.channel.clamp.g(isGreenPercentage ? parseFloat(g) * 2.55 : parseFloat(g)),
b: utils_default.channel.clamp.b(isBluePercentage ? parseFloat(b) * 2.55 : parseFloat(b)),
a: a ? utils_default.channel.clamp.a(isAlphaPercentage ? parseFloat(a) / 100 : parseFloat(a)) : 1
}, color2);
}, "parse"),
stringify: /* @__PURE__ */ __name((channels2) => {
const { r, g, b, a } = channels2;
if (a < 1) {
return `rgba(${utils_default.lang.round(r)}, ${utils_default.lang.round(g)}, ${utils_default.lang.round(b)}, ${utils_default.lang.round(a)})`;
} else {
return `rgb(${utils_default.lang.round(r)}, ${utils_default.lang.round(g)}, ${utils_default.lang.round(b)})`;
}
}, "stringify")
};
var rgb_default = RGB;
// ../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/color/index.js
var Color = {
/* VARIABLES */
format: {
keyword: keyword_default,
hex: hex_default,
rgb: rgb_default,
rgba: rgb_default,
hsl: hsl_default,
hsla: hsl_default
},
/* API */
parse: /* @__PURE__ */ __name((color2) => {
if (typeof color2 !== "string")
return color2;
const channels2 = hex_default.parse(color2) || rgb_default.parse(color2) || hsl_default.parse(color2) || keyword_default.parse(color2);
if (channels2)
return channels2;
throw new Error(`Unsupported color format: "${color2}"`);
}, "parse"),
stringify: /* @__PURE__ */ __name((channels2) => {
if (!channels2.changed && channels2.color)
return channels2.color;
if (channels2.type.is(TYPE.HSL) || channels2.data.r === void 0) {
return hsl_default.stringify(channels2);
} else if (channels2.a < 1 || !Number.isInteger(channels2.r) || !Number.isInteger(channels2.g) || !Number.isInteger(channels2.b)) {
return rgb_default.stringify(channels2);
} else {
return hex_default.stringify(channels2);
}
}, "stringify")
};
var color_default = Color;
// ../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/methods/change.js
var change = /* @__PURE__ */ __name((color2, channels2) => {
const ch = color_default.parse(color2);
for (const c in channels2) {
ch[c] = utils_default.channel.clamp[c](channels2[c]);
}
return color_default.stringify(ch);
}, "change");
var change_default = change;
// ../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/methods/rgba.js
var rgba = /* @__PURE__ */ __name((r, g, b = 0, a = 1) => {
if (typeof r !== "number")
return change_default(r, { a: g });
const channels2 = reusable_default.set({
r: utils_default.channel.clamp.r(r),
g: utils_default.channel.clamp.g(g),
b: utils_default.channel.clamp.b(b),
a: utils_default.channel.clamp.a(a)
});
return color_default.stringify(channels2);
}, "rgba");
var rgba_default = rgba;
// ../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/methods/channel.js
var channel = /* @__PURE__ */ __name((color2, channel2) => {
return utils_default.lang.round(color_default.parse(color2)[channel2]);
}, "channel");
var channel_default2 = channel;
// ../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/methods/luminance.js
var luminance = /* @__PURE__ */ __name((color2) => {
const { r, g, b } = color_default.parse(color2);
const luminance2 = 0.2126 * utils_default.channel.toLinear(r) + 0.7152 * utils_default.channel.toLinear(g) + 0.0722 * utils_default.channel.toLinear(b);
return utils_default.lang.round(luminance2);
}, "luminance");
var luminance_default = luminance;
// ../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/methods/is_light.js
var isLight = /* @__PURE__ */ __name((color2) => {
return luminance_default(color2) >= 0.5;
}, "isLight");
var is_light_default = isLight;
// ../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/methods/is_dark.js
var isDark = /* @__PURE__ */ __name((color2) => {
return !is_light_default(color2);
}, "isDark");
var is_dark_default = isDark;
// ../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/methods/adjust_channel.js
var adjustChannel = /* @__PURE__ */ __name((color2, channel2, amount) => {
const channels2 = color_default.parse(color2);
const amountCurrent = channels2[channel2];
const amountNext = utils_default.channel.clamp[channel2](amountCurrent + amount);
if (amountCurrent !== amountNext)
channels2[channel2] = amountNext;
return color_default.stringify(channels2);
}, "adjustChannel");
var adjust_channel_default = adjustChannel;
// ../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/methods/lighten.js
var lighten = /* @__PURE__ */ __name((color2, amount) => {
return adjust_channel_default(color2, "l", amount);
}, "lighten");
var lighten_default = lighten;
// ../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/methods/darken.js
var darken = /* @__PURE__ */ __name((color2, amount) => {
return adjust_channel_default(color2, "l", -amount);
}, "darken");
var darken_default = darken;
// ../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/methods/adjust.js
var adjust = /* @__PURE__ */ __name((color2, channels2) => {
const ch = color_default.parse(color2);
const changes = {};
for (const c in channels2) {
if (!channels2[c])
continue;
changes[c] = ch[c] + channels2[c];
}
return change_default(color2, changes);
}, "adjust");
var adjust_default = adjust;
// ../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/methods/mix.js
var mix = /* @__PURE__ */ __name((color1, color2, weight = 50) => {
const { r: r1, g: g1, b: b1, a: a1 } = color_default.parse(color1);
const { r: r2, g: g2, b: b2, a: a2 } = color_default.parse(color2);
const weightScale = weight / 100;
const weightNormalized = weightScale * 2 - 1;
const alphaDelta = a1 - a2;
const weight1combined = weightNormalized * alphaDelta === -1 ? weightNormalized : (weightNormalized + alphaDelta) / (1 + weightNormalized * alphaDelta);
const weight1 = (weight1combined + 1) / 2;
const weight2 = 1 - weight1;
const r = r1 * weight1 + r2 * weight2;
const g = g1 * weight1 + g2 * weight2;
const b = b1 * weight1 + b2 * weight2;
const a = a1 * weightScale + a2 * (1 - weightScale);
return rgba_default(r, g, b, a);
}, "mix");
var mix_default = mix;
// ../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/methods/invert.js
var invert = /* @__PURE__ */ __name((color2, weight = 100) => {
const inverse = color_default.parse(color2);
inverse.r = 255 - inverse.r;
inverse.g = 255 - inverse.g;
inverse.b = 255 - inverse.b;
return mix_default(inverse, color2, weight);
}, "invert");
var invert_default = invert;
// src/themes/erDiagram-oldHardcodedValues.ts
var oldAttributeBackgroundColorOdd = "#ffffff";
var oldAttributeBackgroundColorEven = "#f2f2f2";
// src/themes/theme-helpers.js
var mkBorder = /* @__PURE__ */ __name((col, darkMode) => darkMode ? adjust_default(col, { s: -40, l: 10 }) : adjust_default(col, { s: -40, l: -10 }), "mkBorder");
// src/themes/theme-base.js
var Theme = class {
static {
__name(this, "Theme");
}
constructor() {
this.background = "#f4f4f4";
this.primaryColor = "#fff4dd";
this.noteBkgColor = "#fff5ad";
this.noteTextColor = "#333";
this.THEME_COLOR_LIMIT = 12;
this.fontFamily = '"trebuchet ms", verdana, arial, sans-serif';
this.fontSize = "16px";
}
updateColors() {
this.primaryTextColor = this.primaryTextColor || (this.darkMode ? "#eee" : "#333");
this.secondaryColor = this.secondaryColor || adjust_default(this.primaryColor, { h: -120 });
this.tertiaryColor = this.tertiaryColor || adjust_default(this.primaryColor, { h: 180, l: 5 });
this.primaryBorderColor = this.primaryBorderColor || mkBorder(this.primaryColor, this.darkMode);
this.secondaryBorderColor = this.secondaryBorderColor || mkBorder(this.secondaryColor, this.darkMode);
this.tertiaryBorderColor = this.tertiaryBorderColor || mkBorder(this.tertiaryColor, this.darkMode);
this.noteBorderColor = this.noteBorderColor || mkBorder(this.noteBkgColor, this.darkMode);
this.noteBkgColor = this.noteBkgColor || "#fff5ad";
this.noteTextColor = this.noteTextColor || "#333";
this.secondaryTextColor = this.secondaryTextColor || invert_default(this.secondaryColor);
this.tertiaryTextColor = this.tertiaryTextColor || invert_default(this.tertiaryColor);
this.lineColor = this.lineColor || invert_default(this.background);
this.arrowheadColor = this.arrowheadColor || invert_default(this.background);
this.textColor = this.textColor || this.primaryTextColor;
this.border2 = this.border2 || this.tertiaryBorderColor;
this.nodeBkg = this.nodeBkg || this.primaryColor;
this.mainBkg = this.mainBkg || this.primaryColor;
this.nodeBorder = this.nodeBorder || this.primaryBorderColor;
this.clusterBkg = this.clusterBkg || this.tertiaryColor;
this.clusterBorder = this.clusterBorder || this.tertiaryBorderColor;
this.defaultLinkColor = this.defaultLinkColor || this.lineColor;
this.titleColor = this.titleColor || this.tertiaryTextColor;
this.edgeLabelBackground = this.edgeLabelBackground || (this.darkMode ? darken_default(this.secondaryColor, 30) : this.secondaryColor);
this.nodeTextColor = this.nodeTextColor || this.primaryTextColor;
this.actorBorder = this.actorBorder || this.primaryBorderColor;
this.actorBkg = this.actorBkg || this.mainBkg;
this.actorTextColor = this.actorTextColor || this.primaryTextColor;
this.actorLineColor = this.actorLineColor || this.actorBorder;
this.labelBoxBkgColor = this.labelBoxBkgColor || this.actorBkg;
this.signalColor = this.signalColor || this.textColor;
this.signalTextColor = this.signalTextColor || this.textColor;
this.labelBoxBorderColor = this.labelBoxBorderColor || this.actorBorder;
this.labelTextColor = this.labelTextColor || this.actorTextColor;
this.loopTextColor = this.loopTextColor || this.actorTextColor;
this.activationBorderColor = this.activationBorderColor || darken_default(this.secondaryColor, 10);
this.activationBkgColor = this.activationBkgColor || this.secondaryColor;
this.sequenceNumberColor = this.sequenceNumberColor || invert_default(this.lineColor);
this.sectionBkgColor = this.sectionBkgColor || this.tertiaryColor;
this.altSectionBkgColor = this.altSectionBkgColor || "white";
this.sectionBkgColor = this.sectionBkgColor || this.secondaryColor;
this.sectionBkgColor2 = this.sectionBkgColor2 || this.primaryColor;
this.excludeBkgColor = this.excludeBkgColor || "#eeeeee";
this.taskBorderColor = this.taskBorderColor || this.primaryBorderColor;
this.taskBkgColor = this.taskBkgColor || this.primaryColor;
this.activeTaskBorderColor = this.activeTaskBorderColor || this.primaryColor;
this.activeTaskBkgColor = this.activeTaskBkgColor || lighten_default(this.primaryColor, 23);
this.gridColor = this.gridColor || "lightgrey";
this.doneTaskBkgColor = this.doneTaskBkgColor || "lightgrey";
this.doneTaskBorderColor = this.doneTaskBorderColor || "grey";
this.critBorderColor = this.critBorderColor || "#ff8888";
this.critBkgColor = this.critBkgColor || "red";
this.todayLineColor = this.todayLineColor || "red";
this.vertLineColor = this.vertLineColor || "navy";
this.taskTextColor = this.taskTextColor || this.textColor;
this.taskTextOutsideColor = this.taskTextOutsideColor || this.textColor;
this.taskTextLightColor = this.taskTextLightColor || this.textColor;
this.taskTextColor = this.taskTextColor || this.primaryTextColor;
this.taskTextDarkColor = this.taskTextDarkColor || this.textColor;
this.taskTextClickableColor = this.taskTextClickableColor || "#003163";
this.personBorder = this.personBorder || this.primaryBorderColor;
this.personBkg = this.personBkg || this.mainBkg;
if (this.darkMode) {
this.rowOdd = this.rowOdd || darken_default(this.mainBkg, 5) || "#ffffff";
this.rowEven = this.rowEven || darken_default(this.mainBkg, 10);
} else {
this.rowOdd = this.rowOdd || lighten_default(this.mainBkg, 75) || "#ffffff";
this.rowEven = this.rowEven || lighten_default(this.mainBkg, 5);
}
this.transitionColor = this.transitionColor || this.lineColor;
this.transitionLabelColor = this.transitionLabelColor || this.textColor;
this.stateLabelColor = this.stateLabelColor || this.stateBkg || this.primaryTextColor;
this.stateBkg = this.stateBkg || this.mainBkg;
this.labelBackgroundColor = this.labelBackgroundColor || this.stateBkg;
this.compositeBackground = this.compositeBackground || this.background || this.tertiaryColor;
this.altBackground = this.altBackground || this.tertiaryColor;
this.compositeTitleBackground = this.compositeTitleBackground || this.mainBkg;
this.compositeBorder = this.compositeBorder || this.nodeBorder;
this.innerEndBackground = this.nodeBorder;
this.errorBkgColor = this.errorBkgColor || this.tertiaryColor;
this.errorTextColor = this.errorTextColor || this.tertiaryTextColor;
this.transitionColor = this.transitionColor || this.lineColor;
this.specialStateColor = this.lineColor;
this.cScale0 = this.cScale0 || this.primaryColor;
this.cScale1 = this.cScale1 || this.secondaryColor;
this.cScale2 = this.cScale2 || this.tertiaryColor;
this.cScale3 = this.cScale3 || adjust_default(this.primaryColor, { h: 30 });
this.cScale4 = this.cScale4 || adjust_default(this.primaryColor, { h: 60 });
this.cScale5 = this.cScale5 || adjust_default(this.primaryColor, { h: 90 });
this.cScale6 = this.cScale6 || adjust_default(this.primaryColor, { h: 120 });
this.cScale7 = this.cScale7 || adjust_default(this.primaryColor, { h: 150 });
this.cScale8 = this.cScale8 || adjust_default(this.primaryColor, { h: 210, l: 150 });
this.cScale9 = this.cScale9 || adjust_default(this.primaryColor, { h: 270 });
this.cScale10 = this.cScale10 || adjust_default(this.primaryColor, { h: 300 });
this.cScale11 = this.cScale11 || adjust_default(this.primaryColor, { h: 330 });
if (this.darkMode) {
for (let i = 0; i < this.THEME_COLOR_LIMIT; i++) {
this["cScale" + i] = darken_default(this["cScale" + i], 75);
}
} else {
for (let i = 0; i < this.THEME_COLOR_LIMIT; i++) {
this["cScale" + i] = darken_default(this["cScale" + i], 25);
}
}
for (let i = 0; i < this.THEME_COLOR_LIMIT; i++) {
this["cScaleInv" + i] = this["cScaleInv" + i] || invert_default(this["cScale" + i]);
}
for (let i = 0; i < this.THEME_COLOR_LIMIT; i++) {
if (this.darkMode) {
this["cScalePeer" + i] = this["cScalePeer" + i] || lighten_default(this["cScale" + i], 10);
} else {
this["cScalePeer" + i] = this["cScalePeer" + i] || darken_default(this["cScale" + i], 10);
}
}
this.scaleLabelColor = this.scaleLabelColor || this.labelTextColor;
for (let i = 0; i < this.THEME_COLOR_LIMIT; i++) {
this["cScaleLabel" + i] = this["cScaleLabel" + i] || this.scaleLabelColor;
}
const multiplier = this.darkMode ? -4 : -1;
for (let i = 0; i < 5; i++) {
this["surface" + i] = this["surface" + i] || adjust_default(this.mainBkg, { h: 180, s: -15, l: multiplier * (5 + i * 3) });
th