UNPKG

mermaid

Version:

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

1,283 lines (1,278 loc) 83.5 kB
import { utils_default } from "./chunk-BF2ETNBY.mjs"; import { require_dist } from "./chunk-GKOISANM.mjs"; import { axisBottom, axisTop, clear, common_default, configureSvgSize, getAccDescription, getAccTitle, getConfig2 as getConfig, getDiagramTitle, hcl_default, linear, log, max, millisecond, min, require_dayjs_min, second, select_default, setAccDescription, setAccTitle, setDiagramTitle, time, timeDay, timeFormat, timeFriday, timeHour, timeMinute, timeMonday, timeMonth, timeSaturday, timeSunday, timeThursday, timeTuesday, timeWednesday } from "./chunk-SSVL3WCV.mjs"; import "./chunk-HD3LK5B5.mjs"; import { __commonJS, __name, __toESM } from "./chunk-DLQEHMXD.mjs"; // ../../node_modules/.pnpm/dayjs@1.11.13/node_modules/dayjs/plugin/isoWeek.js var require_isoWeek = __commonJS({ "../../node_modules/.pnpm/dayjs@1.11.13/node_modules/dayjs/plugin/isoWeek.js"(exports, module) { "use strict"; !function(e, t) { "object" == typeof exports && "undefined" != typeof module ? module.exports = t() : "function" == typeof define && define.amd ? define(t) : (e = "undefined" != typeof globalThis ? globalThis : e || self).dayjs_plugin_isoWeek = t(); }(exports, function() { "use strict"; var e = "day"; return function(t, i, s) { var a = /* @__PURE__ */ __name(function(t2) { return t2.add(4 - t2.isoWeekday(), e); }, "a"), d = i.prototype; d.isoWeekYear = function() { return a(this).year(); }, d.isoWeek = function(t2) { if (!this.$utils().u(t2)) return this.add(7 * (t2 - this.isoWeek()), e); var i2, d2, n2, o, r = a(this), u = (i2 = this.isoWeekYear(), d2 = this.$u, n2 = (d2 ? s.utc : s)().year(i2).startOf("year"), o = 4 - n2.isoWeekday(), n2.isoWeekday() > 4 && (o += 7), n2.add(o, e)); return r.diff(u, "week") + 1; }, d.isoWeekday = function(e2) { return this.$utils().u(e2) ? this.day() || 7 : this.day(this.day() % 7 ? e2 : e2 - 7); }; var n = d.startOf; d.startOf = function(e2, t2) { var i2 = this.$utils(), s2 = !!i2.u(t2) || t2; return "isoweek" === i2.p(e2) ? s2 ? this.date(this.date() - (this.isoWeekday() - 1)).startOf("day") : this.date(this.date() - 1 - (this.isoWeekday() - 1) + 7).endOf("day") : n.bind(this)(e2, t2); }; }; }); } }); // ../../node_modules/.pnpm/dayjs@1.11.13/node_modules/dayjs/plugin/customParseFormat.js var require_customParseFormat = __commonJS({ "../../node_modules/.pnpm/dayjs@1.11.13/node_modules/dayjs/plugin/customParseFormat.js"(exports, module) { "use strict"; !function(e, t) { "object" == typeof exports && "undefined" != typeof module ? module.exports = t() : "function" == typeof define && define.amd ? define(t) : (e = "undefined" != typeof globalThis ? globalThis : e || self).dayjs_plugin_customParseFormat = t(); }(exports, function() { "use strict"; var e = { LTS: "h:mm:ss A", LT: "h:mm A", L: "MM/DD/YYYY", LL: "MMMM D, YYYY", LLL: "MMMM D, YYYY h:mm A", LLLL: "dddd, MMMM D, YYYY h:mm A" }, t = /(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g, n = /\d/, r = /\d\d/, i = /\d\d?/, o = /\d*[^-_:/,()\s\d]+/, s = {}, a = /* @__PURE__ */ __name(function(e2) { return (e2 = +e2) + (e2 > 68 ? 1900 : 2e3); }, "a"); var f = /* @__PURE__ */ __name(function(e2) { return function(t2) { this[e2] = +t2; }; }, "f"), h = [/[+-]\d\d:?(\d\d)?|Z/, function(e2) { (this.zone || (this.zone = {})).offset = function(e3) { if (!e3) return 0; if ("Z" === e3) return 0; var t2 = e3.match(/([+-]|\d\d)/g), n2 = 60 * t2[1] + (+t2[2] || 0); return 0 === n2 ? 0 : "+" === t2[0] ? -n2 : n2; }(e2); }], u = /* @__PURE__ */ __name(function(e2) { var t2 = s[e2]; return t2 && (t2.indexOf ? t2 : t2.s.concat(t2.f)); }, "u"), d = /* @__PURE__ */ __name(function(e2, t2) { var n2, r2 = s.meridiem; if (r2) { for (var i2 = 1; i2 <= 24; i2 += 1) if (e2.indexOf(r2(i2, 0, t2)) > -1) { n2 = i2 > 12; break; } } else n2 = e2 === (t2 ? "pm" : "PM"); return n2; }, "d"), c = { A: [o, function(e2) { this.afternoon = d(e2, false); }], a: [o, function(e2) { this.afternoon = d(e2, true); }], Q: [n, function(e2) { this.month = 3 * (e2 - 1) + 1; }], S: [n, function(e2) { this.milliseconds = 100 * +e2; }], SS: [r, function(e2) { this.milliseconds = 10 * +e2; }], SSS: [/\d{3}/, function(e2) { this.milliseconds = +e2; }], s: [i, f("seconds")], ss: [i, f("seconds")], m: [i, f("minutes")], mm: [i, f("minutes")], H: [i, f("hours")], h: [i, f("hours")], HH: [i, f("hours")], hh: [i, f("hours")], D: [i, f("day")], DD: [r, f("day")], Do: [o, function(e2) { var t2 = s.ordinal, n2 = e2.match(/\d+/); if (this.day = n2[0], t2) for (var r2 = 1; r2 <= 31; r2 += 1) t2(r2).replace(/\[|\]/g, "") === e2 && (this.day = r2); }], w: [i, f("week")], ww: [r, f("week")], M: [i, f("month")], MM: [r, f("month")], MMM: [o, function(e2) { var t2 = u("months"), n2 = (u("monthsShort") || t2.map(function(e3) { return e3.slice(0, 3); })).indexOf(e2) + 1; if (n2 < 1) throw new Error(); this.month = n2 % 12 || n2; }], MMMM: [o, function(e2) { var t2 = u("months").indexOf(e2) + 1; if (t2 < 1) throw new Error(); this.month = t2 % 12 || t2; }], Y: [/[+-]?\d+/, f("year")], YY: [r, function(e2) { this.year = a(e2); }], YYYY: [/\d{4}/, f("year")], Z: h, ZZ: h }; function l(n2) { var r2, i2; r2 = n2, i2 = s && s.formats; for (var o2 = (n2 = r2.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g, function(t2, n3, r3) { var o3 = r3 && r3.toUpperCase(); return n3 || i2[r3] || e[r3] || i2[o3].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, function(e2, t3, n4) { return t3 || n4.slice(1); }); })).match(t), a2 = o2.length, f2 = 0; f2 < a2; f2 += 1) { var h2 = o2[f2], u2 = c[h2], d2 = u2 && u2[0], l2 = u2 && u2[1]; o2[f2] = l2 ? { regex: d2, parser: l2 } : h2.replace(/^\[|\]$/g, ""); } return function(e2) { for (var t2 = {}, n3 = 0, r3 = 0; n3 < a2; n3 += 1) { var i3 = o2[n3]; if ("string" == typeof i3) r3 += i3.length; else { var s2 = i3.regex, f3 = i3.parser, h3 = e2.slice(r3), u3 = s2.exec(h3)[0]; f3.call(t2, u3), e2 = e2.replace(u3, ""); } } return function(e3) { var t3 = e3.afternoon; if (void 0 !== t3) { var n4 = e3.hours; t3 ? n4 < 12 && (e3.hours += 12) : 12 === n4 && (e3.hours = 0), delete e3.afternoon; } }(t2), t2; }; } __name(l, "l"); return function(e2, t2, n2) { n2.p.customParseFormat = true, e2 && e2.parseTwoDigitYear && (a = e2.parseTwoDigitYear); var r2 = t2.prototype, i2 = r2.parse; r2.parse = function(e3) { var t3 = e3.date, r3 = e3.utc, o2 = e3.args; this.$u = r3; var a2 = o2[1]; if ("string" == typeof a2) { var f2 = true === o2[2], h2 = true === o2[3], u2 = f2 || h2, d2 = o2[2]; h2 && (d2 = o2[2]), s = this.$locale(), !f2 && d2 && (s = n2.Ls[d2]), this.$d = function(e4, t4, n3, r4) { try { if (["x", "X"].indexOf(t4) > -1) return new Date(("X" === t4 ? 1e3 : 1) * e4); var i3 = l(t4)(e4), o3 = i3.year, s2 = i3.month, a3 = i3.day, f3 = i3.hours, h3 = i3.minutes, u3 = i3.seconds, d3 = i3.milliseconds, c3 = i3.zone, m2 = i3.week, M2 = /* @__PURE__ */ new Date(), Y = a3 || (o3 || s2 ? 1 : M2.getDate()), p = o3 || M2.getFullYear(), v = 0; o3 && !s2 || (v = s2 > 0 ? s2 - 1 : M2.getMonth()); var D, w2 = f3 || 0, g = h3 || 0, y = u3 || 0, L = d3 || 0; return c3 ? new Date(Date.UTC(p, v, Y, w2, g, y, L + 60 * c3.offset * 1e3)) : n3 ? new Date(Date.UTC(p, v, Y, w2, g, y, L)) : (D = new Date(p, v, Y, w2, g, y, L), m2 && (D = r4(D).week(m2).toDate()), D); } catch (e5) { return /* @__PURE__ */ new Date(""); } }(t3, a2, r3, n2), this.init(), d2 && true !== d2 && (this.$L = this.locale(d2).$L), u2 && t3 != this.format(a2) && (this.$d = /* @__PURE__ */ new Date("")), s = {}; } else if (a2 instanceof Array) for (var c2 = a2.length, m = 1; m <= c2; m += 1) { o2[1] = a2[m - 1]; var M = n2.apply(this, o2); if (M.isValid()) { this.$d = M.$d, this.$L = M.$L, this.init(); break; } m === c2 && (this.$d = /* @__PURE__ */ new Date("")); } else i2.call(this, e3); }; }; }); } }); // ../../node_modules/.pnpm/dayjs@1.11.13/node_modules/dayjs/plugin/advancedFormat.js var require_advancedFormat = __commonJS({ "../../node_modules/.pnpm/dayjs@1.11.13/node_modules/dayjs/plugin/advancedFormat.js"(exports, module) { "use strict"; !function(e, t) { "object" == typeof exports && "undefined" != typeof module ? module.exports = t() : "function" == typeof define && define.amd ? define(t) : (e = "undefined" != typeof globalThis ? globalThis : e || self).dayjs_plugin_advancedFormat = t(); }(exports, function() { "use strict"; return function(e, t) { var r = t.prototype, n = r.format; r.format = function(e2) { var t2 = this, r2 = this.$locale(); if (!this.isValid()) return n.bind(this)(e2); var s = this.$utils(), a = (e2 || "YYYY-MM-DDTHH:mm:ssZ").replace(/\[([^\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g, function(e3) { switch (e3) { case "Q": return Math.ceil((t2.$M + 1) / 3); case "Do": return r2.ordinal(t2.$D); case "gggg": return t2.weekYear(); case "GGGG": return t2.isoWeekYear(); case "wo": return r2.ordinal(t2.week(), "W"); case "w": case "ww": return s.s(t2.week(), "w" === e3 ? 1 : 2, "0"); case "W": case "WW": return s.s(t2.isoWeek(), "W" === e3 ? 1 : 2, "0"); case "k": case "kk": return s.s(String(0 === t2.$H ? 24 : t2.$H), "k" === e3 ? 1 : 2, "0"); case "X": return Math.floor(t2.$d.getTime() / 1e3); case "x": return t2.$d.getTime(); case "z": return "[" + t2.offsetName() + "]"; case "zzz": return "[" + t2.offsetName("long") + "]"; default: return e3; } }); return n.bind(this)(a); }; }; }); } }); // src/diagrams/gantt/parser/gantt.jison var parser = function() { var o = /* @__PURE__ */ __name(function(k, v, o2, l) { for (o2 = o2 || {}, l = k.length; l--; o2[k[l]] = v) ; return o2; }, "o"), $V0 = [6, 8, 10, 12, 13, 14, 15, 16, 17, 18, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 33, 35, 36, 38, 40], $V1 = [1, 26], $V2 = [1, 27], $V3 = [1, 28], $V4 = [1, 29], $V5 = [1, 30], $V6 = [1, 31], $V7 = [1, 32], $V8 = [1, 33], $V9 = [1, 34], $Va = [1, 9], $Vb = [1, 10], $Vc = [1, 11], $Vd = [1, 12], $Ve = [1, 13], $Vf = [1, 14], $Vg = [1, 15], $Vh = [1, 16], $Vi = [1, 19], $Vj = [1, 20], $Vk = [1, 21], $Vl = [1, 22], $Vm = [1, 23], $Vn = [1, 25], $Vo = [1, 35]; var parser2 = { trace: /* @__PURE__ */ __name(function trace() { }, "trace"), yy: {}, symbols_: { "error": 2, "start": 3, "gantt": 4, "document": 5, "EOF": 6, "line": 7, "SPACE": 8, "statement": 9, "NL": 10, "weekday": 11, "weekday_monday": 12, "weekday_tuesday": 13, "weekday_wednesday": 14, "weekday_thursday": 15, "weekday_friday": 16, "weekday_saturday": 17, "weekday_sunday": 18, "weekend": 19, "weekend_friday": 20, "weekend_saturday": 21, "dateFormat": 22, "inclusiveEndDates": 23, "topAxis": 24, "axisFormat": 25, "tickInterval": 26, "excludes": 27, "includes": 28, "todayMarker": 29, "title": 30, "acc_title": 31, "acc_title_value": 32, "acc_descr": 33, "acc_descr_value": 34, "acc_descr_multiline_value": 35, "section": 36, "clickStatement": 37, "taskTxt": 38, "taskData": 39, "click": 40, "callbackname": 41, "callbackargs": 42, "href": 43, "clickStatementDebug": 44, "$accept": 0, "$end": 1 }, terminals_: { 2: "error", 4: "gantt", 6: "EOF", 8: "SPACE", 10: "NL", 12: "weekday_monday", 13: "weekday_tuesday", 14: "weekday_wednesday", 15: "weekday_thursday", 16: "weekday_friday", 17: "weekday_saturday", 18: "weekday_sunday", 20: "weekend_friday", 21: "weekend_saturday", 22: "dateFormat", 23: "inclusiveEndDates", 24: "topAxis", 25: "axisFormat", 26: "tickInterval", 27: "excludes", 28: "includes", 29: "todayMarker", 30: "title", 31: "acc_title", 32: "acc_title_value", 33: "acc_descr", 34: "acc_descr_value", 35: "acc_descr_multiline_value", 36: "section", 38: "taskTxt", 39: "taskData", 40: "click", 41: "callbackname", 42: "callbackargs", 43: "href" }, productions_: [0, [3, 3], [5, 0], [5, 2], [7, 2], [7, 1], [7, 1], [7, 1], [11, 1], [11, 1], [11, 1], [11, 1], [11, 1], [11, 1], [11, 1], [19, 1], [19, 1], [9, 1], [9, 1], [9, 1], [9, 1], [9, 1], [9, 1], [9, 1], [9, 1], [9, 1], [9, 1], [9, 1], [9, 2], [9, 2], [9, 1], [9, 1], [9, 1], [9, 2], [37, 2], [37, 3], [37, 3], [37, 4], [37, 3], [37, 4], [37, 2], [44, 2], [44, 3], [44, 3], [44, 4], [44, 3], [44, 4], [44, 2]], performAction: /* @__PURE__ */ __name(function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) { var $0 = $$.length - 1; switch (yystate) { case 1: return $$[$0 - 1]; break; case 2: this.$ = []; break; case 3: $$[$0 - 1].push($$[$0]); this.$ = $$[$0 - 1]; break; case 4: case 5: this.$ = $$[$0]; break; case 6: case 7: this.$ = []; break; case 8: yy.setWeekday("monday"); break; case 9: yy.setWeekday("tuesday"); break; case 10: yy.setWeekday("wednesday"); break; case 11: yy.setWeekday("thursday"); break; case 12: yy.setWeekday("friday"); break; case 13: yy.setWeekday("saturday"); break; case 14: yy.setWeekday("sunday"); break; case 15: yy.setWeekend("friday"); break; case 16: yy.setWeekend("saturday"); break; case 17: yy.setDateFormat($$[$0].substr(11)); this.$ = $$[$0].substr(11); break; case 18: yy.enableInclusiveEndDates(); this.$ = $$[$0].substr(18); break; case 19: yy.TopAxis(); this.$ = $$[$0].substr(8); break; case 20: yy.setAxisFormat($$[$0].substr(11)); this.$ = $$[$0].substr(11); break; case 21: yy.setTickInterval($$[$0].substr(13)); this.$ = $$[$0].substr(13); break; case 22: yy.setExcludes($$[$0].substr(9)); this.$ = $$[$0].substr(9); break; case 23: yy.setIncludes($$[$0].substr(9)); this.$ = $$[$0].substr(9); break; case 24: yy.setTodayMarker($$[$0].substr(12)); this.$ = $$[$0].substr(12); break; case 27: yy.setDiagramTitle($$[$0].substr(6)); this.$ = $$[$0].substr(6); break; case 28: this.$ = $$[$0].trim(); yy.setAccTitle(this.$); break; case 29: case 30: this.$ = $$[$0].trim(); yy.setAccDescription(this.$); break; case 31: yy.addSection($$[$0].substr(8)); this.$ = $$[$0].substr(8); break; case 33: yy.addTask($$[$0 - 1], $$[$0]); this.$ = "task"; break; case 34: this.$ = $$[$0 - 1]; yy.setClickEvent($$[$0 - 1], $$[$0], null); break; case 35: this.$ = $$[$0 - 2]; yy.setClickEvent($$[$0 - 2], $$[$0 - 1], $$[$0]); break; case 36: this.$ = $$[$0 - 2]; yy.setClickEvent($$[$0 - 2], $$[$0 - 1], null); yy.setLink($$[$0 - 2], $$[$0]); break; case 37: this.$ = $$[$0 - 3]; yy.setClickEvent($$[$0 - 3], $$[$0 - 2], $$[$0 - 1]); yy.setLink($$[$0 - 3], $$[$0]); break; case 38: this.$ = $$[$0 - 2]; yy.setClickEvent($$[$0 - 2], $$[$0], null); yy.setLink($$[$0 - 2], $$[$0 - 1]); break; case 39: this.$ = $$[$0 - 3]; yy.setClickEvent($$[$0 - 3], $$[$0 - 1], $$[$0]); yy.setLink($$[$0 - 3], $$[$0 - 2]); break; case 40: this.$ = $$[$0 - 1]; yy.setLink($$[$0 - 1], $$[$0]); break; case 41: case 47: this.$ = $$[$0 - 1] + " " + $$[$0]; break; case 42: case 43: case 45: this.$ = $$[$0 - 2] + " " + $$[$0 - 1] + " " + $$[$0]; break; case 44: case 46: this.$ = $$[$0 - 3] + " " + $$[$0 - 2] + " " + $$[$0 - 1] + " " + $$[$0]; break; } }, "anonymous"), table: [{ 3: 1, 4: [1, 2] }, { 1: [3] }, o($V0, [2, 2], { 5: 3 }), { 6: [1, 4], 7: 5, 8: [1, 6], 9: 7, 10: [1, 8], 11: 17, 12: $V1, 13: $V2, 14: $V3, 15: $V4, 16: $V5, 17: $V6, 18: $V7, 19: 18, 20: $V8, 21: $V9, 22: $Va, 23: $Vb, 24: $Vc, 25: $Vd, 26: $Ve, 27: $Vf, 28: $Vg, 29: $Vh, 30: $Vi, 31: $Vj, 33: $Vk, 35: $Vl, 36: $Vm, 37: 24, 38: $Vn, 40: $Vo }, o($V0, [2, 7], { 1: [2, 1] }), o($V0, [2, 3]), { 9: 36, 11: 17, 12: $V1, 13: $V2, 14: $V3, 15: $V4, 16: $V5, 17: $V6, 18: $V7, 19: 18, 20: $V8, 21: $V9, 22: $Va, 23: $Vb, 24: $Vc, 25: $Vd, 26: $Ve, 27: $Vf, 28: $Vg, 29: $Vh, 30: $Vi, 31: $Vj, 33: $Vk, 35: $Vl, 36: $Vm, 37: 24, 38: $Vn, 40: $Vo }, o($V0, [2, 5]), o($V0, [2, 6]), o($V0, [2, 17]), o($V0, [2, 18]), o($V0, [2, 19]), o($V0, [2, 20]), o($V0, [2, 21]), o($V0, [2, 22]), o($V0, [2, 23]), o($V0, [2, 24]), o($V0, [2, 25]), o($V0, [2, 26]), o($V0, [2, 27]), { 32: [1, 37] }, { 34: [1, 38] }, o($V0, [2, 30]), o($V0, [2, 31]), o($V0, [2, 32]), { 39: [1, 39] }, o($V0, [2, 8]), o($V0, [2, 9]), o($V0, [2, 10]), o($V0, [2, 11]), o($V0, [2, 12]), o($V0, [2, 13]), o($V0, [2, 14]), o($V0, [2, 15]), o($V0, [2, 16]), { 41: [1, 40], 43: [1, 41] }, o($V0, [2, 4]), o($V0, [2, 28]), o($V0, [2, 29]), o($V0, [2, 33]), o($V0, [2, 34], { 42: [1, 42], 43: [1, 43] }), o($V0, [2, 40], { 41: [1, 44] }), o($V0, [2, 35], { 43: [1, 45] }), o($V0, [2, 36]), o($V0, [2, 38], { 42: [1, 46] }), o($V0, [2, 37]), o($V0, [2, 39])], defaultActions: {}, parseError: /* @__PURE__ */ __name(function parseError(str, hash) { if (hash.recoverable) { this.trace(str); } else { var error = new Error(str); error.hash = hash; throw error; } }, "parseError"), parse: /* @__PURE__ */ __name(function parse(input) { var self2 = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1; var args = lstack.slice.call(arguments, 1); var lexer2 = Object.create(this.lexer); var sharedState = { yy: {} }; for (var k in this.yy) { if (Object.prototype.hasOwnProperty.call(this.yy, k)) { sharedState.yy[k] = this.yy[k]; } } lexer2.setInput(input, sharedState.yy); sharedState.yy.lexer = lexer2; sharedState.yy.parser = this; if (typeof lexer2.yylloc == "undefined") { lexer2.yylloc = {}; } var yyloc = lexer2.yylloc; lstack.push(yyloc); var ranges = lexer2.options && lexer2.options.ranges; if (typeof sharedState.yy.parseError === "function") { this.parseError = sharedState.yy.parseError; } else { this.parseError = Object.getPrototypeOf(this).parseError; } function popStack(n) { stack.length = stack.length - 2 * n; vstack.length = vstack.length - n; lstack.length = lstack.length - n; } __name(popStack, "popStack"); function lex() { var token; token = tstack.pop() || lexer2.lex() || EOF; if (typeof token !== "number") { if (token instanceof Array) { tstack = token; token = tstack.pop(); } token = self2.symbols_[token] || token; } return token; } __name(lex, "lex"); var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected; while (true) { state = stack[stack.length - 1]; if (this.defaultActions[state]) { action = this.defaultActions[state]; } else { if (symbol === null || typeof symbol == "undefined") { symbol = lex(); } action = table[state] && table[state][symbol]; } if (typeof action === "undefined" || !action.length || !action[0]) { var errStr = ""; expected = []; for (p in table[state]) { if (this.terminals_[p] && p > TERROR) { expected.push("'" + this.terminals_[p] + "'"); } } if (lexer2.showPosition) { errStr = "Parse error on line " + (yylineno + 1) + ":\n" + lexer2.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'"; } else { errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == EOF ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'"); } this.parseError(errStr, { text: lexer2.match, token: this.terminals_[symbol] || symbol, line: lexer2.yylineno, loc: yyloc, expected }); } if (action[0] instanceof Array && action.length > 1) { throw new Error("Parse Error: multiple actions possible at state: " + state + ", token: " + symbol); } switch (action[0]) { case 1: stack.push(symbol); vstack.push(lexer2.yytext); lstack.push(lexer2.yylloc); stack.push(action[1]); symbol = null; if (!preErrorSymbol) { yyleng = lexer2.yyleng; yytext = lexer2.yytext; yylineno = lexer2.yylineno; yyloc = lexer2.yylloc; if (recovering > 0) { recovering--; } } else { symbol = preErrorSymbol; preErrorSymbol = null; } break; case 2: len = this.productions_[action[1]][1]; yyval.$ = vstack[vstack.length - len]; yyval._$ = { first_line: lstack[lstack.length - (len || 1)].first_line, last_line: lstack[lstack.length - 1].last_line, first_column: lstack[lstack.length - (len || 1)].first_column, last_column: lstack[lstack.length - 1].last_column }; if (ranges) { yyval._$.range = [ lstack[lstack.length - (len || 1)].range[0], lstack[lstack.length - 1].range[1] ]; } r = this.performAction.apply(yyval, [ yytext, yyleng, yylineno, sharedState.yy, action[1], vstack, lstack ].concat(args)); if (typeof r !== "undefined") { return r; } if (len) { stack = stack.slice(0, -1 * len * 2); vstack = vstack.slice(0, -1 * len); lstack = lstack.slice(0, -1 * len); } stack.push(this.productions_[action[1]][0]); vstack.push(yyval.$); lstack.push(yyval._$); newState = table[stack[stack.length - 2]][stack[stack.length - 1]]; stack.push(newState); break; case 3: return true; } } return true; }, "parse") }; var lexer = /* @__PURE__ */ function() { var lexer2 = { EOF: 1, parseError: /* @__PURE__ */ __name(function parseError(str, hash) { if (this.yy.parser) { this.yy.parser.parseError(str, hash); } else { throw new Error(str); } }, "parseError"), // resets the lexer, sets new input setInput: /* @__PURE__ */ __name(function(input, yy) { this.yy = yy || this.yy || {}; this._input = input; this._more = this._backtrack = this.done = false; this.yylineno = this.yyleng = 0; this.yytext = this.matched = this.match = ""; this.conditionStack = ["INITIAL"]; this.yylloc = { first_line: 1, first_column: 0, last_line: 1, last_column: 0 }; if (this.options.ranges) { this.yylloc.range = [0, 0]; } this.offset = 0; return this; }, "setInput"), // consumes and returns one char from the input input: /* @__PURE__ */ __name(function() { var ch = this._input[0]; this.yytext += ch; this.yyleng++; this.offset++; this.match += ch; this.matched += ch; var lines = ch.match(/(?:\r\n?|\n).*/g); if (lines) { this.yylineno++; this.yylloc.last_line++; } else { this.yylloc.last_column++; } if (this.options.ranges) { this.yylloc.range[1]++; } this._input = this._input.slice(1); return ch; }, "input"), // unshifts one char (or a string) into the input unput: /* @__PURE__ */ __name(function(ch) { var len = ch.length; var lines = ch.split(/(?:\r\n?|\n)/g); this._input = ch + this._input; this.yytext = this.yytext.substr(0, this.yytext.length - len); this.offset -= len; var oldLines = this.match.split(/(?:\r\n?|\n)/g); this.match = this.match.substr(0, this.match.length - 1); this.matched = this.matched.substr(0, this.matched.length - 1); if (lines.length - 1) { this.yylineno -= lines.length - 1; } var r = this.yylloc.range; this.yylloc = { first_line: this.yylloc.first_line, last_line: this.yylineno + 1, first_column: this.yylloc.first_column, last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length : this.yylloc.first_column - len }; if (this.options.ranges) { this.yylloc.range = [r[0], r[0] + this.yyleng - len]; } this.yyleng = this.yytext.length; return this; }, "unput"), // When called from action, caches matched text and appends it on next action more: /* @__PURE__ */ __name(function() { this._more = true; return this; }, "more"), // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead. reject: /* @__PURE__ */ __name(function() { if (this.options.backtrack_lexer) { this._backtrack = true; } else { return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n" + this.showPosition(), { text: "", token: null, line: this.yylineno }); } return this; }, "reject"), // retain first n characters of the match less: /* @__PURE__ */ __name(function(n) { this.unput(this.match.slice(n)); }, "less"), // displays already matched input, i.e. for error messages pastInput: /* @__PURE__ */ __name(function() { var past = this.matched.substr(0, this.matched.length - this.match.length); return (past.length > 20 ? "..." : "") + past.substr(-20).replace(/\n/g, ""); }, "pastInput"), // displays upcoming input, i.e. for error messages upcomingInput: /* @__PURE__ */ __name(function() { var next = this.match; if (next.length < 20) { next += this._input.substr(0, 20 - next.length); } return (next.substr(0, 20) + (next.length > 20 ? "..." : "")).replace(/\n/g, ""); }, "upcomingInput"), // displays the character position where the lexing error occurred, i.e. for error messages showPosition: /* @__PURE__ */ __name(function() { var pre = this.pastInput(); var c = new Array(pre.length + 1).join("-"); return pre + this.upcomingInput() + "\n" + c + "^"; }, "showPosition"), // test the lexed token: return FALSE when not a match, otherwise return token test_match: /* @__PURE__ */ __name(function(match, indexed_rule) { var token, lines, backup; if (this.options.backtrack_lexer) { backup = { yylineno: this.yylineno, yylloc: { first_line: this.yylloc.first_line, last_line: this.last_line, first_column: this.yylloc.first_column, last_column: this.yylloc.last_column }, yytext: this.yytext, match: this.match, matches: this.matches, matched: this.matched, yyleng: this.yyleng, offset: this.offset, _more: this._more, _input: this._input, yy: this.yy, conditionStack: this.conditionStack.slice(0), done: this.done }; if (this.options.ranges) { backup.yylloc.range = this.yylloc.range.slice(0); } } lines = match[0].match(/(?:\r\n?|\n).*/g); if (lines) { this.yylineno += lines.length; } this.yylloc = { first_line: this.yylloc.last_line, last_line: this.yylineno + 1, first_column: this.yylloc.last_column, last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length }; this.yytext += match[0]; this.match += match[0]; this.matches = match; this.yyleng = this.yytext.length; if (this.options.ranges) { this.yylloc.range = [this.offset, this.offset += this.yyleng]; } this._more = false; this._backtrack = false; this._input = this._input.slice(match[0].length); this.matched += match[0]; token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]); if (this.done && this._input) { this.done = false; } if (token) { return token; } else if (this._backtrack) { for (var k in backup) { this[k] = backup[k]; } return false; } return false; }, "test_match"), // return next match in input next: /* @__PURE__ */ __name(function() { if (this.done) { return this.EOF; } if (!this._input) { this.done = true; } var token, match, tempMatch, index; if (!this._more) { this.yytext = ""; this.match = ""; } var rules = this._currentRules(); for (var i = 0; i < rules.length; i++) { tempMatch = this._input.match(this.rules[rules[i]]); if (tempMatch && (!match || tempMatch[0].length > match[0].length)) { match = tempMatch; index = i; if (this.options.backtrack_lexer) { token = this.test_match(tempMatch, rules[i]); if (token !== false) { return token; } else if (this._backtrack) { match = false; continue; } else { return false; } } else if (!this.options.flex) { break; } } } if (match) { token = this.test_match(match, rules[index]); if (token !== false) { return token; } return false; } if (this._input === "") { return this.EOF; } else { return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". Unrecognized text.\n" + this.showPosition(), { text: "", token: null, line: this.yylineno }); } }, "next"), // return next match that has a token lex: /* @__PURE__ */ __name(function lex() { var r = this.next(); if (r) { return r; } else { return this.lex(); } }, "lex"), // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack) begin: /* @__PURE__ */ __name(function begin(condition) { this.conditionStack.push(condition); }, "begin"), // pop the previously active lexer condition state off the condition stack popState: /* @__PURE__ */ __name(function popState() { var n = this.conditionStack.length - 1; if (n > 0) { return this.conditionStack.pop(); } else { return this.conditionStack[0]; } }, "popState"), // produce the lexer rule set which is active for the currently active lexer condition state _currentRules: /* @__PURE__ */ __name(function _currentRules() { if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) { return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules; } else { return this.conditions["INITIAL"].rules; } }, "_currentRules"), // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available topState: /* @__PURE__ */ __name(function topState(n) { n = this.conditionStack.length - 1 - Math.abs(n || 0); if (n >= 0) { return this.conditionStack[n]; } else { return "INITIAL"; } }, "topState"), // alias for begin(condition) pushState: /* @__PURE__ */ __name(function pushState(condition) { this.begin(condition); }, "pushState"), // return the number of states currently on the stack stateStackSize: /* @__PURE__ */ __name(function stateStackSize() { return this.conditionStack.length; }, "stateStackSize"), options: { "case-insensitive": true }, performAction: /* @__PURE__ */ __name(function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) { var YYSTATE = YY_START; switch ($avoiding_name_collisions) { case 0: this.begin("open_directive"); return "open_directive"; break; case 1: this.begin("acc_title"); return 31; break; case 2: this.popState(); return "acc_title_value"; break; case 3: this.begin("acc_descr"); return 33; break; case 4: this.popState(); return "acc_descr_value"; break; case 5: this.begin("acc_descr_multiline"); break; case 6: this.popState(); break; case 7: return "acc_descr_multiline_value"; break; case 8: break; case 9: break; case 10: break; case 11: return 10; break; case 12: break; case 13: break; case 14: this.begin("href"); break; case 15: this.popState(); break; case 16: return 43; break; case 17: this.begin("callbackname"); break; case 18: this.popState(); break; case 19: this.popState(); this.begin("callbackargs"); break; case 20: return 41; break; case 21: this.popState(); break; case 22: return 42; break; case 23: this.begin("click"); break; case 24: this.popState(); break; case 25: return 40; break; case 26: return 4; break; case 27: return 22; break; case 28: return 23; break; case 29: return 24; break; case 30: return 25; break; case 31: return 26; break; case 32: return 28; break; case 33: return 27; break; case 34: return 29; break; case 35: return 12; break; case 36: return 13; break; case 37: return 14; break; case 38: return 15; break; case 39: return 16; break; case 40: return 17; break; case 41: return 18; break; case 42: return 20; break; case 43: return 21; break; case 44: return "date"; break; case 45: return 30; break; case 46: return "accDescription"; break; case 47: return 36; break; case 48: return 38; break; case 49: return 39; break; case 50: return ":"; break; case 51: return 6; break; case 52: return "INVALID"; break; } }, "anonymous"), rules: [/^(?:%%\{)/i, /^(?:accTitle\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*\{\s*)/i, /^(?:[\}])/i, /^(?:[^\}]*)/i, /^(?:%%(?!\{)*[^\n]*)/i, /^(?:[^\}]%%*[^\n]*)/i, /^(?:%%*[^\n]*[\n]*)/i, /^(?:[\n]+)/i, /^(?:\s+)/i, /^(?:%[^\n]*)/i, /^(?:href[\s]+["])/i, /^(?:["])/i, /^(?:[^"]*)/i, /^(?:call[\s]+)/i, /^(?:\([\s]*\))/i, /^(?:\()/i, /^(?:[^(]*)/i, /^(?:\))/i, /^(?:[^)]*)/i, /^(?:click[\s]+)/i, /^(?:[\s\n])/i, /^(?:[^\s\n]*)/i, /^(?:gantt\b)/i, /^(?:dateFormat\s[^#\n;]+)/i, /^(?:inclusiveEndDates\b)/i, /^(?:topAxis\b)/i, /^(?:axisFormat\s[^#\n;]+)/i, /^(?:tickInterval\s[^#\n;]+)/i, /^(?:includes\s[^#\n;]+)/i, /^(?:excludes\s[^#\n;]+)/i, /^(?:todayMarker\s[^\n;]+)/i, /^(?:weekday\s+monday\b)/i, /^(?:weekday\s+tuesday\b)/i, /^(?:weekday\s+wednesday\b)/i, /^(?:weekday\s+thursday\b)/i, /^(?:weekday\s+friday\b)/i, /^(?:weekday\s+saturday\b)/i, /^(?:weekday\s+sunday\b)/i, /^(?:weekend\s+friday\b)/i, /^(?:weekend\s+saturday\b)/i, /^(?:\d\d\d\d-\d\d-\d\d\b)/i, /^(?:title\s[^\n]+)/i, /^(?:accDescription\s[^#\n;]+)/i, /^(?:section\s[^\n]+)/i, /^(?:[^:\n]+)/i, /^(?::[^#\n;]+)/i, /^(?::)/i, /^(?:$)/i, /^(?:.)/i], conditions: { "acc_descr_multiline": { "rules": [6, 7], "inclusive": false }, "acc_descr": { "rules": [4], "inclusive": false }, "acc_title": { "rules": [2], "inclusive": false }, "callbackargs": { "rules": [21, 22], "inclusive": false }, "callbackname": { "rules": [18, 19, 20], "inclusive": false }, "href": { "rules": [15, 16], "inclusive": false }, "click": { "rules": [24, 25], "inclusive": false }, "INITIAL": { "rules": [0, 1, 3, 5, 8, 9, 10, 11, 12, 13, 14, 17, 23, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52], "inclusive": true } } }; return lexer2; }(); parser2.lexer = lexer; function Parser() { this.yy = {}; } __name(Parser, "Parser"); Parser.prototype = parser2; parser2.Parser = Parser; return new Parser(); }(); parser.parser = parser; var gantt_default = parser; // src/diagrams/gantt/ganttDb.js var import_sanitize_url = __toESM(require_dist(), 1); var import_dayjs = __toESM(require_dayjs_min(), 1); var import_isoWeek = __toESM(require_isoWeek(), 1); var import_customParseFormat = __toESM(require_customParseFormat(), 1); var import_advancedFormat = __toESM(require_advancedFormat(), 1); import_dayjs.default.extend(import_isoWeek.default); import_dayjs.default.extend(import_customParseFormat.default); import_dayjs.default.extend(import_advancedFormat.default); var WEEKEND_START_DAY = { friday: 5, saturday: 6 }; var dateFormat = ""; var axisFormat = ""; var tickInterval = void 0; var todayMarker = ""; var includes = []; var excludes = []; var links = /* @__PURE__ */ new Map(); var sections = []; var tasks = []; var currentSection = ""; var displayMode = ""; var tags = ["active", "done", "crit", "milestone", "vert"]; var funs = []; var inclusiveEndDates = false; var topAxis = false; var weekday = "sunday"; var weekend = "saturday"; var lastOrder = 0; var clear2 = /* @__PURE__ */ __name(function() { sections = []; tasks = []; currentSection = ""; funs = []; taskCnt = 0; lastTask = void 0; lastTaskID = void 0; rawTasks = []; dateFormat = ""; axisFormat = ""; displayMode = ""; tickInterval = void 0; todayMarker = ""; includes = []; excludes = []; inclusiveEndDates = false; topAxis = false; lastOrder = 0; links = /* @__PURE__ */ new Map(); clear(); weekday = "sunday"; weekend = "saturday"; }, "clear"); var setAxisFormat = /* @__PURE__ */ __name(function(txt) { axisFormat = txt; }, "setAxisFormat"); var getAxisFormat = /* @__PURE__ */ __name(function() { return axisFormat; }, "getAxisFormat"); var setTickInterval = /* @__PURE__ */ __name(function(txt) { tickInterval = txt; }, "setTickInterval"); var getTickInterval = /* @__PURE__ */ __name(function() { return tickInterval; }, "getTickInterval"); var setTodayMarker = /* @__PURE__ */ __name(function(txt) { todayMarker = txt; }, "setTodayMarker"); var getTodayMarker = /* @__PURE__ */ __name(function() { return todayMarker; }, "getTodayMarker"); var setDateFormat = /* @__PURE__ */ __name(function(txt) { dateFormat = txt; }, "setDateFormat"); var enableInclusiveEndDates = /* @__PURE__ */ __name(function() { inclusiveEndDates = true; }, "enableInclusiveEndDates"); var endDatesAreInclusive = /* @__PURE__ */ __name(function() { return inclusiveEndDates; }, "endDatesAreInclusive"); var enableTopAxis = /* @__PURE__ */ __name(function() { topAxis = true; }, "enableTopAxis"); var topAxisEnabled = /* @__PURE__ */ __name(function() { return topAxis; }, "topAxisEnabled"); var setDisplayMode = /* @__PURE__ */ __name(function(txt) { displayMode = txt; }, "setDisplayMode"); var getDisplayMode = /* @__PURE__ */ __name(function() { return displayMode; }, "getDisplayMode"); var getDateFormat = /* @__PURE__ */ __name(function() { return dateFormat; }, "getDateFormat"); var setIncludes = /* @__PURE__ */ __name(function(txt) { includes = txt.toLowerCase().split(/[\s,]+/); }, "setIncludes"); var getIncludes = /* @__PURE__ */ __name(function() { return includes; }, "getIncludes"); var setExcludes = /* @__PURE__ */ __name(function(txt) { excludes = txt.toLowerCase().split(/[\s,]+/); }, "setExcludes"); var getExcludes = /* @__PURE__ */ __name(function() { return excludes; }, "getExcludes"); var getLinks = /* @__PURE__ */ __name(function() { return links; }, "getLinks"); var addSection = /* @__PURE__ */ __name(function(txt) { currentSection = txt; sections.push(txt); }, "addSection"); var getSections = /* @__PURE__ */ __name(function() { return sections; }, "getSections"); var getTasks = /* @__PURE__ */ __name(function() { let allItemsProcessed = compileTasks(); const maxDepth = 10; let iterationCount = 0; while (!allItemsProcessed && iterationCount < maxDepth) { allItemsProcessed = compileTasks(); iterationCount++; } tasks = rawTasks; return tasks; }, "getTasks"); var isInvalidDate = /* @__PURE__ */ __name(function(date, dateFormat2, excludes2, includes2) { if (includes2.includes(date.format(dateFormat2.trim()))) { return false; } if (excludes2.includes("weekends") && (date.isoWeekday() === WEEKEND_START_DAY[weekend] || date.isoWeekday() === WEEKEND_START_DAY[weekend] + 1)) { return true; } if (excludes2.includes(date.format("dddd").toLowerCase())) { return true; } return excludes2.includes(date.format(dateFormat2.trim())); }, "isInvalidDate"); var setWeekday = /* @__PURE__ */ __name(function(txt) { weekday = txt; }, "setWeekday"); var getWeekday = /* @__PURE__ */ __name(function() { return weekday; }, "getWeekday"); var setWeekend = /* @__PURE__ */ __name(function(startDay) { weekend = startDay; }, "setWeekend"); var checkTaskDates = /* @__PURE__ */ __name(function(task, dateFormat2, excludes2, includes2) { if (!excludes2.length || task.manualEndTime) { return; } let startTime; if (task.startTime instanceof Date) { startTime = (0, import_dayjs.default)(task.startTime); } else { startTime = (0, import_dayjs.default)(task.startTime, dateFormat2, true); } startTime = startTime.add(1, "d"); let originalEndTime; if (task.endTime instanceof Date) { originalEndTime = (0, import_dayjs.default)(task.endTime); } else { originalEndTime = (0, import_dayjs.default)(task.endTime, dateFormat2, true); } const [fixedEndTime, renderEndTime] = fixTaskDates( startTime, originalEndTime, dateFormat2, excludes2, includes2 ); task.endTime = fixedEndTime.toDate(); task.renderEndTime = renderEndTime; }, "checkTaskDates"); var fixTaskDates = /* @__PURE__ */ __name(function(startTime, endTime, dateFormat2, excludes2, includes2) { let invalid = false; let renderEndTime = null; while (startTime <= endTime) { if (!invalid) { renderEndTime = endTime.toDate(); } invalid = isInvalidDate(startTime, dateFormat2, excludes2, includes2); if (invalid) { endTime = endTime.add(1, "d"); } startTime = startTime.add(1, "d"); } return [endTime, renderEndTime]; }, "fixTaskDates"); var getStartDate = /* @__PURE__ */ __name(function(prevTime, dateFormat2, str) { str = str.trim(); const afterRePattern = /^after\s+(?<ids>[\d\w- ]+)/; const afterStatement = afterRePattern.exec(str); if (afterStatement !== null) { let latestTask = null; for (const id of afterStatement.groups.ids.split(" ")) { let task = findTaskById(id); if (task !== void 0 && (!latestTask || task.endTime > latestTask.endTime)) { latestTask = task; } } if (latestTask) { return latestTask.endTime; } const today = /* @__PURE__ */ new Date(); today.setHours(0, 0, 0, 0); return today; } let mDate = (0, import_dayjs.default)(str, dateFormat2.trim(), true); if (mDate.isValid()) { return mDate.toDate(); } else { log.debug("Invalid date:" + str); log.debug("With date format:" + dateFormat2.trim()); const d = new Date(str); if (d === void 0 || isNaN(d.getTime()) || // WebKit browsers can mis-parse invalid dates to be ridiculously // huge numbers, e.g. new Date('202304') gets parsed as January 1, 202304. // This can cause virtually infinite loops while rendering, so for the // purposes of Gantt charts we'll just treat any date beyond 10,000 AD/BC as // invalid. d.getFullYear() < -1e4 || d.getFullYear() > 1e4) { throw new Error("Invalid date:" + str); } return d; } }, "getStartDate"); var parseDuration = /* @__PURE__ */ __name(function(str) { const statement = /^(\d+(?:\.\d+)?)([Mdhmswy]|ms)$/.exec(str.trim()); if (statement !== null) { return [Number.parseFloat(statement[1]), statement[2]]; } return [NaN, "ms"]; }, "parseDuration"); var getEndDate = /* @__PURE__ */ __name(function(prevTime, dateFormat2, str, inclusive = false) { str = str.trim(); const untilRePattern = /^until\s+(?<ids>[\d\w- ]+)/; const untilStatement = untilRePattern.exec(str); if (untilStatement !== null) { let earliestTask = null; for (const id of untilStatement.groups.ids.split(" ")) { let task = findTaskById(id); if (tas