@gk8/mermaid
Version:
Markdown-ish syntax for generating flowcharts, sequence diagrams, class diagrams, gantt charts and git graphs.
1,293 lines • 375 kB
JavaScript
(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() {
"use strict";
function dedent(templ) {
var values = [];
for (var _i = 1; _i < arguments.length; _i++) {
values[_i - 1] = arguments[_i];
}
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 _a, _b;
return (_b = (_a = match.match(/[\t ]/g)) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 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 string = strings[0];
values.forEach(function(value, i2) {
var endentations = string.match(/(?:^|\n)( *)$/);
var endentation = endentations ? endentations[1] : "";
var indentedValue = value;
if (typeof value === "string" && value.includes("\n")) {
indentedValue = String(value).split("\n").map(function(str2, i3) {
return i3 === 0 ? str2 : "" + endentation + str2;
}).join("\n");
}
string += indentedValue + strings[i2 + 1];
});
return string;
}
var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
function getDefaultExportFromCjs(x) {
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
}
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", f = "month", h = "quarter", c = "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+)?$/, y = /\[([^\]]+)]|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(t2) {
var e2 = ["th", "st", "nd", "rd"], n2 = t2 % 100;
return "[" + t2 + (e2[(n2 - 20) % 10] || e2[n2] || e2[0]) + "]";
} }, m = function(t2, e2, n2) {
var r2 = String(t2);
return !r2 || r2.length >= e2 ? t2 : "" + Array(e2 + 1 - r2.length).join(n2) + t2;
}, v = { s: m, z: function(t2) {
var e2 = -t2.utcOffset(), n2 = Math.abs(e2), r2 = Math.floor(n2 / 60), i3 = n2 % 60;
return (e2 <= 0 ? "+" : "-") + m(r2, 2, "0") + ":" + m(i3, 2, "0");
}, m: function t2(e2, n2) {
if (e2.date() < n2.date())
return -t2(n2, e2);
var r2 = 12 * (n2.year() - e2.year()) + (n2.month() - e2.month()), i3 = e2.clone().add(r2, f), s2 = n2 - i3 < 0, u2 = e2.clone().add(r2 + (s2 ? -1 : 1), f);
return +(-(r2 + (n2 - i3) / (s2 ? i3 - u2 : u2 - i3)) || 0);
}, a: function(t2) {
return t2 < 0 ? Math.ceil(t2) || 0 : Math.floor(t2);
}, p: function(t2) {
return { M: f, y: c, w: o, d: a, D: d, h: u, m: s, s: i2, ms: r, Q: h }[t2] || String(t2 || "").toLowerCase().replace(/s$/, "");
}, u: function(t2) {
return void 0 === t2;
} }, g = "en", D = {};
D[g] = M;
var p = function(t2) {
return t2 instanceof _2;
}, S = function t2(e2, n2, r2) {
var i3;
if (!e2)
return g;
if ("string" == typeof e2) {
var s2 = e2.toLowerCase();
D[s2] && (i3 = s2), n2 && (D[s2] = n2, i3 = s2);
var u2 = e2.split("-");
if (!i3 && u2.length > 1)
return t2(u2[0]);
} else {
var a2 = e2.name;
D[a2] = e2, i3 = a2;
}
return !r2 && i3 && (g = i3), i3 || !r2 && g;
}, w = function(t2, e2) {
if (p(t2))
return t2.clone();
var n2 = "object" == typeof e2 ? e2 : {};
return n2.date = t2, n2.args = arguments, new _2(n2);
}, O = v;
O.l = S, O.i = p, O.w = function(t2, e2) {
return w(t2, { locale: e2.$L, utc: e2.$u, x: e2.$x, $offset: e2.$offset });
};
var _2 = function() {
function M2(t2) {
this.$L = S(t2.locale, null, true), this.parse(t2);
}
var m2 = M2.prototype;
return m2.parse = function(t2) {
this.$d = function(t3) {
var e2 = t3.date, n2 = t3.utc;
if (null === e2)
return /* @__PURE__ */ new Date(NaN);
if (O.u(e2))
return /* @__PURE__ */ new Date();
if (e2 instanceof Date)
return new Date(e2);
if ("string" == typeof e2 && !/Z$/i.test(e2)) {
var r2 = e2.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(e2);
}(t2), this.$x = t2.x || {}, this.init();
}, m2.init = function() {
var t2 = this.$d;
this.$y = t2.getFullYear(), this.$M = t2.getMonth(), this.$D = t2.getDate(), this.$W = t2.getDay(), this.$H = t2.getHours(), this.$m = t2.getMinutes(), this.$s = t2.getSeconds(), this.$ms = t2.getMilliseconds();
}, m2.$utils = function() {
return O;
}, m2.isValid = function() {
return !(this.$d.toString() === l);
}, m2.isSame = function(t2, e2) {
var n2 = w(t2);
return this.startOf(e2) <= n2 && n2 <= this.endOf(e2);
}, m2.isAfter = function(t2, e2) {
return w(t2) < this.startOf(e2);
}, m2.isBefore = function(t2, e2) {
return this.endOf(e2) < w(t2);
}, m2.$g = function(t2, e2, n2) {
return O.u(t2) ? this[e2] : this.set(n2, t2);
}, m2.unix = function() {
return Math.floor(this.valueOf() / 1e3);
}, m2.valueOf = function() {
return this.$d.getTime();
}, m2.startOf = function(t2, e2) {
var n2 = this, r2 = !!O.u(e2) || e2, h2 = O.p(t2), l2 = function(t3, e3) {
var i3 = O.w(n2.$u ? Date.UTC(n2.$y, e3, t3) : new Date(n2.$y, e3, t3), n2);
return r2 ? i3 : i3.endOf(a);
}, $2 = function(t3, e3) {
return O.w(n2.toDate()[t3].apply(n2.toDate("s"), (r2 ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(e3)), n2);
}, y2 = this.$W, M3 = this.$M, m3 = this.$D, v2 = "set" + (this.$u ? "UTC" : "");
switch (h2) {
case c:
return r2 ? l2(1, 0) : l2(31, 11);
case f:
return r2 ? l2(1, M3) : l2(0, M3 + 1);
case o:
var g2 = this.$locale().weekStart || 0, D2 = (y2 < g2 ? y2 + 7 : y2) - 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 i2:
return $2(v2 + "Milliseconds", 3);
default:
return this.clone();
}
}, m2.endOf = function(t2) {
return this.startOf(t2, false);
}, m2.$set = function(t2, e2) {
var n2, o2 = O.p(t2), h2 = "set" + (this.$u ? "UTC" : ""), l2 = (n2 = {}, n2[a] = h2 + "Date", n2[d] = h2 + "Date", n2[f] = h2 + "Month", n2[c] = h2 + "FullYear", n2[u] = h2 + "Hours", n2[s] = h2 + "Minutes", n2[i2] = h2 + "Seconds", n2[r] = h2 + "Milliseconds", n2)[o2], $2 = o2 === a ? this.$D + (e2 - this.$W) : e2;
if (o2 === f || o2 === c) {
var y2 = this.clone().set(d, 1);
y2.$d[l2]($2), y2.init(), this.$d = y2.set(d, Math.min(this.$D, y2.daysInMonth())).$d;
} else
l2 && this.$d[l2]($2);
return this.init(), this;
}, m2.set = function(t2, e2) {
return this.clone().$set(t2, e2);
}, m2.get = function(t2) {
return this[O.p(t2)]();
}, m2.add = function(r2, h2) {
var d2, l2 = this;
r2 = Number(r2);
var $2 = O.p(h2), y2 = function(t2) {
var e2 = w(l2);
return O.w(e2.date(e2.date() + Math.round(t2 * r2)), l2);
};
if ($2 === f)
return this.set(f, this.$M + r2);
if ($2 === c)
return this.set(c, this.$y + r2);
if ($2 === a)
return y2(1);
if ($2 === o)
return y2(7);
var M3 = (d2 = {}, d2[s] = e, d2[u] = n, d2[i2] = t, d2)[$2] || 1, m3 = this.$d.getTime() + r2 * M3;
return O.w(m3, this);
}, m2.subtract = function(t2, e2) {
return this.add(-1 * t2, e2);
}, m2.format = function(t2) {
var e2 = this, n2 = this.$locale();
if (!this.isValid())
return n2.invalidDate || l;
var r2 = t2 || "YYYY-MM-DDTHH:mm:ssZ", i3 = O.z(this), s2 = this.$H, u2 = this.$m, a2 = this.$M, o2 = n2.weekdays, f2 = n2.months, h2 = function(t3, n3, i4, s3) {
return t3 && (t3[n3] || t3(e2, r2)) || i4[n3].slice(0, s3);
}, c2 = function(t3) {
return O.s(s2 % 12 || 12, t3, "0");
}, d2 = n2.meridiem || function(t3, e3, n3) {
var r3 = t3 < 12 ? "AM" : "PM";
return n3 ? r3.toLowerCase() : r3;
}, $2 = { YY: String(this.$y).slice(-2), YYYY: this.$y, M: a2 + 1, MM: O.s(a2 + 1, 2, "0"), MMM: h2(n2.monthsShort, a2, f2, 3), MMMM: h2(f2, a2), D: this.$D, DD: O.s(this.$D, 2, "0"), d: String(this.$W), dd: h2(n2.weekdaysMin, this.$W, o2, 2), ddd: h2(n2.weekdaysShort, this.$W, o2, 3), dddd: o2[this.$W], H: String(s2), HH: O.s(s2, 2, "0"), h: c2(1), hh: c2(2), a: d2(s2, u2, true), A: d2(s2, u2, false), m: String(u2), mm: O.s(u2, 2, "0"), s: String(this.$s), ss: O.s(this.$s, 2, "0"), SSS: O.s(this.$ms, 3, "0"), Z: i3 };
return r2.replace(y, function(t3, e3) {
return e3 || $2[t3] || i3.replace(":", "");
});
}, m2.utcOffset = function() {
return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
}, m2.diff = function(r2, d2, l2) {
var $2, y2 = O.p(d2), M3 = w(r2), m3 = (M3.utcOffset() - this.utcOffset()) * e, v2 = this - M3, g2 = O.m(this, M3);
return g2 = ($2 = {}, $2[c] = g2 / 12, $2[f] = g2, $2[h] = g2 / 3, $2[o] = (v2 - m3) / 6048e5, $2[a] = (v2 - m3) / 864e5, $2[u] = v2 / n, $2[s] = v2 / e, $2[i2] = v2 / t, $2)[y2] || v2, l2 ? g2 : O.a(g2);
}, m2.daysInMonth = function() {
return this.endOf(f).$D;
}, m2.$locale = function() {
return D[this.$L];
}, m2.locale = function(t2, e2) {
if (!t2)
return this.$L;
var n2 = this.clone(), r2 = S(t2, e2, true);
return r2 && (n2.$L = r2), n2;
}, m2.clone = function() {
return O.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;
}(), T = _2.prototype;
return w.prototype = T, [["$ms", r], ["$s", i2], ["$m", s], ["$H", u], ["$W", a], ["$M", f], ["$y", c], ["$D", d]].forEach(function(t2) {
T[t2[1]] = function(e2) {
return this.$g(e2, t2[0], t2[1]);
};
}), w.extend = function(t2, e2) {
return t2.$i || (t2(e2, _2, w), t2.$i = true), w;
}, w.locale = S, w.isDayjs = p, w.unix = function(t2) {
return w(1e3 * t2);
}, w.en = D[g], w.Ls = D, w.p = {}, w;
});
})(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$2 = {
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$2.trace = () => {
};
log$2.debug = () => {
};
log$2.info = () => {
};
log$2.warn = () => {
};
log$2.error = () => {
};
log$2.fatal = () => {
};
if (numericLevel <= LEVELS.fatal) {
log$2.fatal = console.error ? console.error.bind(console, format("FATAL"), "color: orange") : console.log.bind(console, "\x1B[35m", format("FATAL"));
}
if (numericLevel <= LEVELS.error) {
log$2.error = console.error ? console.error.bind(console, format("ERROR"), "color: orange") : console.log.bind(console, "\x1B[31m", format("ERROR"));
}
if (numericLevel <= LEVELS.warn) {
log$2.warn = console.warn ? console.warn.bind(console, format("WARN"), "color: orange") : console.log.bind(console, `\x1B[33m`, format("WARN"));
}
if (numericLevel <= LEVELS.info) {
log$2.info = console.info ? console.info.bind(console, format("INFO"), "color: lightblue") : console.log.bind(console, "\x1B[34m", format("INFO"));
}
if (numericLevel <= LEVELS.debug) {
log$2.debug = console.debug ? console.debug.bind(console, format("DEBUG"), "color: lightgreen") : console.log.bind(console, "\x1B[32m", format("DEBUG"));
}
if (numericLevel <= LEVELS.trace) {
log$2.trace = console.debug ? console.debug.bind(console, format("TRACE"), "color: lightgreen") : console.log.bind(console, "\x1B[32m", format("TRACE"));
}
};
const format = (level) => {
const time = dayjs().format("ss.SSS");
return `%c${time} : ${level} : `;
};
var dist = {};
Object.defineProperty(dist, "__esModule", { value: true });
var sanitizeUrl_1 = dist.sanitizeUrl = void 0;
var invalidProtocolRegex = /^([^\w]*)(javascript|data|vbscript)/im;
var htmlEntitiesRegex = /&#(\w+)(^\w|;)?/g;
var htmlTabEntityRegex = /&tab;/gi;
var ctrlCharactersRegex = /[\u0000-\u001F\u007F-\u009F\u2000-\u200D\uFEFF]/gim;
var urlSchemeRegex = /^.+(:|:)/gim;
var relativeFirstCharacters = [".", "/"];
function isRelativeUrlWithoutProtocol(url) {
return relativeFirstCharacters.indexOf(url[0]) > -1;
}
function decodeHtmlCharacters(str2) {
str2 = str2.replace(htmlTabEntityRegex, "	");
return str2.replace(htmlEntitiesRegex, function(match, dec) {
return String.fromCharCode(dec);
});
}
function sanitizeUrl(url) {
var sanitizedUrl = decodeHtmlCharacters(url || "").replace(ctrlCharactersRegex, "").trim();
if (!sanitizedUrl) {
return "about:blank";
}
if (isRelativeUrlWithoutProtocol(sanitizedUrl)) {
return sanitizedUrl;
}
var urlSchemeParseResults = sanitizedUrl.match(urlSchemeRegex);
if (!urlSchemeParseResults) {
return sanitizedUrl;
}
var urlScheme = urlSchemeParseResults[0];
if (invalidProtocolRegex.test(urlScheme)) {
return "about:blank";
}
return sanitizedUrl;
}
sanitizeUrl_1 = dist.sanitizeUrl = sanitizeUrl;
const DOMPurify$1 = { sanitize: (txt, opts) => txt };
const lineBreakRegex$1 = /<br\s*\/?>/gi;
const getRows$1 = (s) => {
if (!s) {
return [""];
}
const str2 = breakToPlaceholder$1(s).replace(/\\n/g, "#br#");
return str2.split("#br#");
};
const removeScript$1 = (txt) => {
return DOMPurify$1.sanitize(txt);
};
const sanitizeMore$1 = (text, config2) => {
var _a;
if (((_a = config2.flowchart) == null ? void 0 : _a.htmlLabels) !== false) {
const level = config2.securityLevel;
if (level === "antiscript" || level === "strict") {
text = removeScript$1(text);
} else if (level !== "loose") {
text = breakToPlaceholder$1(text);
text = text.replace(/</g, "<").replace(/>/g, ">");
text = text.replace(/=/g, "=");
text = placeholderToBreak$1(text);
}
}
return text;
};
const sanitizeText$5 = (text, config2) => {
if (!text) {
return text;
}
if (config2.dompurifyConfig) {
text = DOMPurify$1.sanitize(sanitizeMore$1(text, config2), config2.dompurifyConfig).toString();
} else {
text = DOMPurify$1.sanitize(sanitizeMore$1(text, config2), {
FORBID_TAGS: ["style"]
}).toString();
}
return text;
};
const sanitizeTextOrArray$1 = (a, config2) => {
if (typeof a === "string") {
return sanitizeText$5(a, config2);
}
return a.flat().map((x) => sanitizeText$5(x, config2));
};
const hasBreaks$1 = (text) => {
return lineBreakRegex$1.test(text);
};
const splitBreaks$1 = (text) => {
return text.split(lineBreakRegex$1);
};
const placeholderToBreak$1 = (s) => {
return s.replace(/#br#/g, "<br/>");
};
const breakToPlaceholder$1 = (s) => {
return s.replace(lineBreakRegex$1, "#br#");
};
const getUrl$1 = (useAbsolute) => {
let url = "";
if (useAbsolute) {
url = window.location.protocol + "//" + window.location.host + window.location.pathname + window.location.search;
url = url.replaceAll(/\(/g, "\\(");
url = url.replaceAll(/\)/g, "\\)");
}
return url;
};
const evaluate$1 = (val) => val === false || ["false", "null", "0"].includes(String(val).trim().toLowerCase()) ? false : true;
const getMax$1 = function(...values) {
const newValues = values.filter((value) => {
return !isNaN(value);
});
return Math.max(...newValues);
};
const getMin$1 = function(...values) {
const newValues = values.filter((value) => {
return !isNaN(value);
});
return Math.min(...newValues);
};
const common$2 = {
getRows: getRows$1,
sanitizeText: sanitizeText$5,
sanitizeTextOrArray: sanitizeTextOrArray$1,
hasBreaks: hasBreaks$1,
splitBreaks: splitBreaks$1,
lineBreakRegex: lineBreakRegex$1,
removeScript: removeScript$1,
getUrl: getUrl$1,
evaluate: evaluate$1,
getMax: getMax$1,
getMin: getMin$1
};
const 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: (r) => r >= 255 ? 255 : r < 0 ? 0 : r,
g: (g) => g >= 255 ? 255 : g < 0 ? 0 : g,
b: (b) => b >= 255 ? 255 : b < 0 ? 0 : b,
h: (h) => h % 360,
s: (s) => s >= 100 ? 100 : s < 0 ? 0 : s,
l: (l) => l >= 100 ? 100 : l < 0 ? 0 : l,
a: (a) => a >= 1 ? 1 : a < 0 ? 0 : a
},
/* CONVERSION */
//SOURCE: https://planetcalc.com/7779
toLinear: (c) => {
const n = c / 255;
return c > 0.03928 ? Math.pow((n + 0.055) / 1.055, 2.4) : n / 12.92;
},
//SOURCE: https://gist.github.com/mjackson/5311256
hue2rgb: (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;
},
hsl2rgb: ({ 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;
}
},
rgb2hsl: ({ r, g, b }, channel2) => {
r /= 255;
g /= 255;
b /= 255;
const max = Math.max(r, g, b);
const min = Math.min(r, g, b);
const l = (max + min) / 2;
if (channel2 === "l")
return l * 100;
if (max === min)
return 0;
const d = max - min;
const s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
if (channel2 === "s")
return s * 100;
switch (max) {
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;
}
}
};
const channel$2 = Channel;
const Lang = {
/* API */
clamp: (number, lower, upper) => {
if (lower > upper)
return Math.min(lower, Math.max(upper, number));
return Math.min(upper, Math.max(lower, number));
},
round: (number) => {
return Math.round(number * 1e10) / 1e10;
}
};
const lang = Lang;
const Unit = {
/* API */
dec2hex: (dec) => {
const hex = Math.round(dec).toString(16);
return hex.length > 1 ? hex : `0${hex}`;
}
};
const unit = Unit;
const Utils = {
channel: channel$2,
lang,
unit
};
const _ = Utils;
const DEC2HEX = {};
for (let i2 = 0; i2 <= 255; i2++)
DEC2HEX[i2] = _.unit.dec2hex(i2);
const TYPE = {
ALL: 0,
RGB: 1,
HSL: 2
};
class 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;
}
}
const Type$2 = Type;
class Channels {
/* CONSTRUCTOR */
constructor(data, color) {
this.color = color;
this.changed = false;
this.data = data;
this.type = new Type$2();
}
/* API */
set(data, color) {
this.color = color;
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 = _.channel.rgb2hsl(data, "h");
if (s === void 0)
data.s = _.channel.rgb2hsl(data, "s");
if (l === void 0)
data.l = _.channel.rgb2hsl(data, "l");
}
_ensureRGB() {
const data = this.data;
const { r, g, b } = data;
if (r === void 0)
data.r = _.channel.hsl2rgb(data, "r");
if (g === void 0)
data.g = _.channel.hsl2rgb(data, "g");
if (b === void 0)
data.b = _.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 _.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 _.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 _.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 _.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 _.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 _.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;
}
}
const Channels$1 = Channels;
const channels = new Channels$1({ r: 0, g: 0, b: 0, a: 0 }, "transparent");
const ChannelsReusable = channels;
const Hex = {
/* VARIABLES */
re: /^#((?:[a-f0-9]{2}){2,4}|[a-f0-9]{3})$/i,
/* API */
parse: (color) => {
if (color.charCodeAt(0) !== 35)
return;
const match = color.match(Hex.re);
if (!match)
return;
const hex = match[1];
const dec = parseInt(hex, 16);
const length = hex.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 ChannelsReusable.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
}, color);
},
stringify: (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)]}`;
}
}
};
const Hex$1 = Hex;
const 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: (hue) => {
const match = hue.match(HSL.hueRe);
if (match) {
const [, number, unit2] = match;
switch (unit2) {
case "grad":
return _.channel.clamp.h(parseFloat(number) * 0.9);
case "rad":
return _.channel.clamp.h(parseFloat(number) * 180 / Math.PI);
case "turn":
return _.channel.clamp.h(parseFloat(number) * 360);
}
}
return _.channel.clamp.h(parseFloat(hue));
},
/* API */
parse: (color) => {
const charCode = color.charCodeAt(0);
if (charCode !== 104 && charCode !== 72)
return;
const match = color.match(HSL.re);
if (!match)
return;
const [, h, s, l, a, isAlphaPercentage] = match;
return ChannelsReusable.set({
h: HSL._hue2deg(h),
s: _.channel.clamp.s(parseFloat(s)),
l: _.channel.clamp.l(parseFloat(l)),
a: a ? _.channel.clamp.a(isAlphaPercentage ? parseFloat(a) / 100 : parseFloat(a)) : 1
}, color);
},
stringify: (channels2) => {
const { h, s, l, a } = channels2;
if (a < 1) {
return `hsla(${_.lang.round(h)}, ${_.lang.round(s)}%, ${_.lang.round(l)}%, ${a})`;
} else {
return `hsl(${_.lang.round(h)}, ${_.lang.round(s)}%, ${_.lang.round(l)}%)`;
}
}
};
const HSL$1 = HSL;
const 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: (color) => {
color = color.toLowerCase();
const hex = Keyword.colors[color];
if (!hex)
return;
return Hex$1.parse(hex);
},
stringify: (channels2) => {
const hex = Hex$1.stringify(channels2);
for (const name in Keyword.colors) {
if (Keyword.colors[name] === hex)
return name;
}
return;
}
};
const Keyword$1 = Keyword;
const 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: (color) => {
const charCode = color.charCodeAt(0);
if (charCode !== 114 && charCode !== 82)
return;
const match = color.match(RGB.re);
if (!match)
return;
const [, r, isRedPercentage, g, isGreenPercentage, b, isBluePercentage, a, isAlphaPercentage] = match;
return ChannelsReusable.set({
r: _.channel.clamp.r(isRedPercentage ? parseFloat(r) * 2.55 : parseFloat(r)),
g: _.channel.clamp.g(isGreenPercentage ? parseFloat(g) * 2.55 : parseFloat(g)),
b: _.channel.clamp.b(isBluePercentage ? parseFloat(b) * 2.55 : parseFloat(b)),
a: a ? _.channel.clamp.a(isAlphaPercentage ? parseFloat(a) / 100 : parseFloat(a)) : 1
}, color);
},
stringify: (channels2) => {
const { r, g, b, a } = channels2;
if (a < 1) {
return `rgba(${_.lang.round(r)}, ${_.lang.round(g)}, ${_.lang.round(b)}, ${_.lang.round(a)})`;
} else {
return `rgb(${_.lang.round(r)}, ${_.lang.round(g)}, ${_.lang.round(b)})`;
}
}
};
const RGB$1 = RGB;
const Color = {
/* VARIABLES */
format: {
keyword: Keyword$1,
hex: Hex$1,
rgb: RGB$1,
rgba: RGB$1,
hsl: HSL$1,
hsla: HSL$1
},
/* API */
parse: (color) => {
if (typeof color !== "string")
return color;
const channels2 = Hex$1.parse(color) || RGB$1.parse(color) || HSL$1.parse(color) || Keyword$1.parse(color);
if (channels2)
return channels2;
throw new Error(`Unsupported color format: "${color}"`);
},
stringify: (channels2) => {
if (!channels2.changed && channels2.color)
return channels2.color;
if (channels2.type.is(TYPE.HSL) || channels2.data.r === void 0) {
return HSL$1.stringify(channels2);
} else if (channels2.a < 1 || !Number.isInteger(channels2.r) || !Number.isInteger(channels2.g) || !Number.isInteger(channels2.b)) {
return RGB$1.stringify(channels2);
} else {
return Hex$1.stringify(channels2);
}
}
};
const Color$1 = Color;
const change = (color, channels2) => {
const ch = Color$1.parse(color);
for (const c in channels2) {
ch[c] = _.channel.clamp[c](channels2[c]);
}
return Color$1.stringify(ch);
};
const change$1 = change;
const rgba = (r, g, b = 0, a = 1) => {
if (typeof r !== "number")
return change$1(r, { a: g });
const channels2 = ChannelsReusable.set({
r: _.channel.clamp.r(r),
g: _.channel.clamp.g(g),
b: _.channel.clamp.b(b),
a: _.channel.clamp.a(a)
});
return Color$1.stringify(channels2);
};
const rgba$1 = rgba;
const channel = (color, channel2) => {
return _.lang.round(Color$1.parse(color)[channel2]);
};
const channel$1 = channel;
const luminance = (color) => {
const { r, g, b } = Color$1.parse(color);
const luminance2 = 0.2126 * _.channel.toLinear(r) + 0.7152 * _.channel.toLinear(g) + 0.0722 * _.channel.toLinear(b);
return _.lang.round(luminance2);
};
const luminance$1 = luminance;
const isLight = (color) => {
return luminance$1(color) >= 0.5;
};
const isLight$1 = isLight;
const isDark = (color) => {
return !isLight$1(color);
};
const isDark$1 = isDark;
const adjustChannel = (color, channel2, amount) => {
const channels2 = Color$1.parse(color);
const amountCurrent = channels2[channel2];
const amountNext = _.channel.clamp[channel2](amountCurrent + amount);
if (amountCurrent !== amountNext)
channels2[channel2] = amountNext;
return Color$1.stringify(channels2);
};
const adjustChannel$1 = adjustChannel;
const lighten = (color, amount) => {
return adjustChannel$1(color, "l", amount);
};
const lighten$1 = lighten;
const darken = (color, amount) => {
return adjustChannel$1(color, "l", -amount);
};
const darken$1 = darken;
const adjust = (color, channels2) => {
const ch = Color$1.parse(color);
const changes = {};
for (const c in channels2) {
if (!channels2[c])
continue;
changes[c] = ch[c] + channels2[c];
}
return change$1(color, changes);
};
const adjust$1 = adjust;
const mix = (color1, color2, weight = 50) => {
const { r: r1, g: g1, b: b1, a: a1 } = Color$1.parse(color1);
const { r: r2, g: g2, b: b2, a: a2 } = Color$1.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$1(r, g, b, a);
};
const mix$1 = mix;
const invert = (color, weight = 100) => {
const inverse = Color$1.parse(color);
inverse.r = 255 - inverse.r;
inverse.g = 255 - inverse.g;
inverse.b = 255 - inverse.b;
return mix$1(inverse, color, weight);
};
const invert$1 = invert;
const mkBorder = (col, darkMode) => darkMode ? adjust$1(col, { s: -40, l: 10 }) : adjust$1(col, { s: -40, l: -10 });
const oldAttributeBackgroundColorOdd = "#ffffff";
const oldAttributeBackgroundColorEven = "#f2f2f2";
let Theme$4 = class 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$1(this.primaryColor, { h: -120 });
this.tertiaryColor = this.tertiaryColor || adjust$1(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$1(this.secondaryColor);
this.tertiaryTextColor = this.tertiaryTextColor || invert$1(this.tertiaryColor);
this.lineColor = this.lineColor || invert$1(this.background);
this.arrowheadColor = this.arrowheadColor || invert$1(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$1(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 || "grey";
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$1(this.secondaryColor, 10);
this.activationBkgColor = this.activationBkgColor || this.secondaryColor;
this.sequenceNumberColor = this.sequenceNumberColor || invert$1(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$1(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.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;
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$1(this.primaryColor, { h: 30 });
this.cScale4 = this.cScale4 || adjust$1(this.primaryColor, { h: 60 });
this.cScale5 = this.cScale5 || adjust$1(this.primaryColor, { h: 90 });
this.cScale6 = this.cScale6 || adjust$1(this.primaryColor, { h: 120 });
this.cScale7 = this.cScale7 || adjust$1(this.primaryColor, { h: 150 });
this.cScale8 = this.cScale8 || adjust$1(this.primaryColor, { h: 210, l: 150 });
this.cScale9 = this.cScale9 || adjust$1(this.primaryColor, { h: 270 });
this.cScale10 = this.cScale10 || adjust$1(this.primaryColor, { h: 300 });
this.cScale11 = this.cScale11 || adjust$1(this.primaryColor, { h: 330 });
if (this.darkMode) {
for (let i2 = 0; i2 < this.THEME_COLOR_LIMIT; i2++) {
this["cScale" + i2] = darken$1(this["cScale" + i2], 75);
}
} else {
for (let i2 = 0; i2 < this.THEME_COLOR_LIMIT; i2++) {
this["cScale" + i2] = darken$1(this["cScale" + i2], 25);
}
}
for (let i2 = 0; i2 < this.THEME_COLOR_LIMIT; i2++) {
this["cScaleInv" + i2] = this["cScaleInv" + i2] || invert$1(this["cScale" + i2]);
}
for (let i2 = 0; i2 < this.THEME_COLOR_LIMIT; i2++) {
if (this.darkMode) {
this["cScalePeer" + i2] = this["cScalePeer" + i2] || lighten$1(this["cScale" + i2], 10);
} else {
this["cScalePeer" + i2] = this["cScalePeer" + i2] || darken$1(this["cScale" + i2], 10);
}
}
this.scaleLabelColor = this.scaleLabelColor || this.labelTextColor;
for (let i2 = 0; i2 < this.THEME_COLOR_LIMIT; i2++) {
this["cScaleLabel" + i2] = this["cScaleLabel" + i2] || this.scaleLabelColor;
}
const multiplier = this.darkMode ? -4 : -1;
for (let i2 = 0; i2 < 5; i2++) {
this["surface" + i2] = this["surface" + i2] || adjust$1(this.mainBkg, { h: 180, s: -15, l: multiplier * (5 + i2 * 3) });
this["surfacePeer" + i2] = this["surfacePeer" + i2] || adjust$1(this.mainBkg, { h: 180, s: -15, l: multiplier * (8 + i2 * 3) });
}
this.classText = this.classText || this.textColor;
this.fillType0 = this.fillType0 || this.primaryColor;
this.fillType1 = this.fillType1 || this.secondaryColor;
this.fillType2 = this.fillType2 || adjust$1(this.primaryColor, { h: 64 });
this.fillType3 = this.fillType3 || adjust$1(this.secondaryColor, { h: 64 });
this.fillType4 = this.fillType4 || adjust$1(this.primaryColor, { h: -64 });
this.fillType5 = this.fillType5 || adjust$1(this.secondaryColor, { h: -64 });
this.fillType6 = this.fillType6 || adjust$1(this.primaryColor, { h: 128 });
this.fillType7 = this.fillType7 || adjust$1(this.secondaryColor, { h: 128 });
this.pie1 = this.pie1 || this.primaryColor;
this.pie2 = this.pie2 || this.secondaryColor;
this.pie3 = this.pie3 || this.tertiaryColor;
this.pie4 = this.pie4 || adjust$1(this.primaryColor, { l: -10 });
this.pie5 = this.pie5 || adjust$1(this.secondaryColor, { l: -10 });
this.pie6 = this.pie6 || adjust$1(this.tertiaryColor, { l: -10 });
this.pie7 = this.pie7 || adjust$1(this.primaryColor, { h: 60, l: -10 });
this.pie8 = this.pie8 || adjust$1(this.primaryColor, { h: -60, l: -10 });
this.pie9 = this.pie9 || adjust$1(this.primaryColor, { h: 120, l: 0 });
this.pie10 = this.pie10 || adjust$1(this.primaryColor, { h: 60, l: -20 });
this.pie11 = this.pie11 || adjust$1(this.primaryColor, { h: -60, l: -20 });
this.pie12 = this.pie12 || adjust$1(this.primaryColor, { h: 120, l: -10 });
this.pieTitleTextSize = this.pieTitleTextSize || "25px";
this.pieTitleTextColor = this.pieTitleTextColor || this.taskTextDarkColor;
this.pieSectionTextSize = this.pieSectionTextSize || "17px";
this.pieSectionTextColor = this.pieSectionTextColor || this.textColor;
this.pieLegendTextSize = this.pieLegendTextSize || "17px";
this.pieLegendTextColor = this.pieLegendTextColor || this.taskTextDarkColor;
this.pieStrokeColor = this.pieStrokeColor || "black";
this.pieStrokeWidth = this.pieStrokeWidth || "2px";
this.pieOuterStrokeWidth = this.pieOuterStrokeWidth || "2px";
this.pieOuterStrokeColor = this.pieOuterStrokeColor || "black";
this.pieOpacity = this.pieOpacity || "0.7";
this.quadrant1Fill = this.quadrant1Fill || this.primaryColor;
this.quadrant2Fill = this.quadrant2Fill || adjust$1(this.primaryCo