@zjlab-frontier/markdown 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/README.md +148 -0
  2. package/dist/Tableau10-D7jGxypv.mjs +8 -0
  3. package/dist/arc-BkFOiLi7.mjs +84 -0
  4. package/dist/array-CqVTtuYm.mjs +6 -0
  5. package/dist/blockDiagram-c4efeb88-CngVNufX.mjs +1221 -0
  6. package/dist/c4Diagram-c83219d4-CvSWXhSV.mjs +1579 -0
  7. package/dist/channel-BCTzeqLo.mjs +5 -0
  8. package/dist/classDiagram-beda092f-8UkpWDgI.mjs +218 -0
  9. package/dist/classDiagram-v2-2358418a-D3LsBhTm.mjs +200 -0
  10. package/dist/clone-DZgGXtyK.mjs +8 -0
  11. package/dist/createText-1719965b-DMv-Bu7A.mjs +155 -0
  12. package/dist/edges-96097737-BeVwLt3S.mjs +1088 -0
  13. package/dist/erDiagram-0228fc6a-GXXkRZ8r.mjs +929 -0
  14. package/dist/flowDb-c6c81e3f-CrOg5i55.mjs +1126 -0
  15. package/dist/flowDiagram-50d868cf-sXe_oFAW.mjs +788 -0
  16. package/dist/flowDiagram-v2-4f6560a1-CoKYvZkH.mjs +17 -0
  17. package/dist/flowchart-elk-definition-6af322e1-SuvGsuBl.mjs +48146 -0
  18. package/dist/ganttDiagram-a2739b55-BbWq9bqY.mjs +2477 -0
  19. package/dist/gitGraphDiagram-82fe8481-C6-e4UmK.mjs +1264 -0
  20. package/dist/graph-CoIGCRFf.mjs +847 -0
  21. package/dist/index-5325376f-BENBY8aO.mjs +373 -0
  22. package/dist/index-5_ujiRGo.mjs +46276 -0
  23. package/dist/index.css +1 -0
  24. package/dist/index.d.ts +2 -0
  25. package/dist/index.mjs +8 -0
  26. package/dist/index.umd.js +2421 -0
  27. package/dist/infoDiagram-8eee0895-BEAb2pCD.mjs +319 -0
  28. package/dist/init-DjUOC4st.mjs +16 -0
  29. package/dist/journeyDiagram-c64418c1-CERjyYnA.mjs +801 -0
  30. package/dist/layout-aCAVHR2T.mjs +1472 -0
  31. package/dist/line-BGunMwE-.mjs +33 -0
  32. package/dist/linear-DciWi0hE.mjs +423 -0
  33. package/dist/markdown.d.ts +25 -0
  34. package/dist/mindmap-definition-8da855dc-Cc8_U7zD.mjs +21936 -0
  35. package/dist/ordinal-C0oynhte.mjs +61 -0
  36. package/dist/path-DLwuMfdd.mjs +84 -0
  37. package/dist/pieDiagram-a8764435-B00hy7Ez.mjs +500 -0
  38. package/dist/quadrantDiagram-1e28029f-DR7IGAoM.mjs +903 -0
  39. package/dist/requirementDiagram-08caed73-o6N3X3-m.mjs +767 -0
  40. package/dist/sankeyDiagram-a04cb91d-CYF9Ro1W.mjs +802 -0
  41. package/dist/sequenceDiagram-c5b8d532-vz_R7xBU.mjs +2234 -0
  42. package/dist/stateDiagram-1ecb1508-B0YUHnuE.mjs +266 -0
  43. package/dist/stateDiagram-v2-c2b004d7-CDTm1Jfb.mjs +184 -0
  44. package/dist/styles/highlight.scss +115 -0
  45. package/dist/styles/markdown.scss +1163 -0
  46. package/dist/styles-b4e223ce-C_-huVuQ.mjs +1089 -0
  47. package/dist/styles-ca3715f6-soe07Bnw.mjs +960 -0
  48. package/dist/styles-d45a18b0-0ZXwJp5P.mjs +436 -0
  49. package/dist/svgDrawCommon-b86b1483-UCLksviB.mjs +64 -0
  50. package/dist/timeline-definition-faaaa080-Dt5unv7p.mjs +792 -0
  51. package/dist/vite.config.d.ts +2 -0
  52. package/dist/xychartDiagram-f5964ef8-BZWS0E_9.mjs +1282 -0
  53. package/package.json +66 -0
@@ -0,0 +1,1221 @@
1
+ import { Z as se, A as ye, d as H, e as Ee, l as S, E as we, k as De, g as he, p as ve } from "./index-5_ujiRGo.mjs";
2
+ import { c as Ne } from "./clone-DZgGXtyK.mjs";
3
+ import { i as ke, c as Ie, b as Oe, d as Te, a as ge, p as ze } from "./edges-96097737-BeVwLt3S.mjs";
4
+ import { G as Ce } from "./graph-CoIGCRFf.mjs";
5
+ import { c as Ae } from "./channel-BCTzeqLo.mjs";
6
+ import { o as Re } from "./ordinal-C0oynhte.mjs";
7
+ import { s as Be } from "./Tableau10-D7jGxypv.mjs";
8
+ var le, oe, ee = (function() {
9
+ var e = function(D, o, s, i) {
10
+ for (s = s || {}, i = D.length; i--; s[D[i]] = o)
11
+ ;
12
+ return s;
13
+ }, a = [1, 7], d = [1, 13], c = [1, 14], n = [1, 15], g = [1, 19], l = [1, 16], f = [1, 17], b = [1, 18], p = [8, 30], x = [8, 21, 28, 29, 30, 31, 32, 40, 44, 47], y = [1, 23], T = [1, 24], v = [8, 15, 16, 21, 28, 29, 30, 31, 32, 40, 44, 47], N = [8, 15, 16, 21, 27, 28, 29, 30, 31, 32, 40, 44, 47], E = [1, 49], L = {
14
+ trace: function() {
15
+ },
16
+ yy: {},
17
+ symbols_: { error: 2, spaceLines: 3, SPACELINE: 4, NL: 5, separator: 6, SPACE: 7, EOF: 8, start: 9, BLOCK_DIAGRAM_KEY: 10, document: 11, stop: 12, statement: 13, link: 14, LINK: 15, START_LINK: 16, LINK_LABEL: 17, STR: 18, nodeStatement: 19, columnsStatement: 20, SPACE_BLOCK: 21, blockStatement: 22, classDefStatement: 23, cssClassStatement: 24, styleStatement: 25, node: 26, SIZE: 27, COLUMNS: 28, "id-block": 29, end: 30, block: 31, NODE_ID: 32, nodeShapeNLabel: 33, dirList: 34, DIR: 35, NODE_DSTART: 36, NODE_DEND: 37, BLOCK_ARROW_START: 38, BLOCK_ARROW_END: 39, classDef: 40, CLASSDEF_ID: 41, CLASSDEF_STYLEOPTS: 42, DEFAULT: 43, class: 44, CLASSENTITY_IDS: 45, STYLECLASS: 46, style: 47, STYLE_ENTITY_IDS: 48, STYLE_DEFINITION_DATA: 49, $accept: 0, $end: 1 },
18
+ terminals_: { 2: "error", 4: "SPACELINE", 5: "NL", 7: "SPACE", 8: "EOF", 10: "BLOCK_DIAGRAM_KEY", 15: "LINK", 16: "START_LINK", 17: "LINK_LABEL", 18: "STR", 21: "SPACE_BLOCK", 27: "SIZE", 28: "COLUMNS", 29: "id-block", 30: "end", 31: "block", 32: "NODE_ID", 35: "DIR", 36: "NODE_DSTART", 37: "NODE_DEND", 38: "BLOCK_ARROW_START", 39: "BLOCK_ARROW_END", 40: "classDef", 41: "CLASSDEF_ID", 42: "CLASSDEF_STYLEOPTS", 43: "DEFAULT", 44: "class", 45: "CLASSENTITY_IDS", 46: "STYLECLASS", 47: "style", 48: "STYLE_ENTITY_IDS", 49: "STYLE_DEFINITION_DATA" },
19
+ productions_: [0, [3, 1], [3, 2], [3, 2], [6, 1], [6, 1], [6, 1], [9, 3], [12, 1], [12, 1], [12, 2], [12, 2], [11, 1], [11, 2], [14, 1], [14, 4], [13, 1], [13, 1], [13, 1], [13, 1], [13, 1], [13, 1], [13, 1], [19, 3], [19, 2], [19, 1], [20, 1], [22, 4], [22, 3], [26, 1], [26, 2], [34, 1], [34, 2], [33, 3], [33, 4], [23, 3], [23, 3], [24, 3], [25, 3]],
20
+ performAction: function(o, s, i, u, h, t, m) {
21
+ var r = t.length - 1;
22
+ switch (h) {
23
+ case 4:
24
+ u.getLogger().debug("Rule: separator (NL) ");
25
+ break;
26
+ case 5:
27
+ u.getLogger().debug("Rule: separator (Space) ");
28
+ break;
29
+ case 6:
30
+ u.getLogger().debug("Rule: separator (EOF) ");
31
+ break;
32
+ case 7:
33
+ u.getLogger().debug("Rule: hierarchy: ", t[r - 1]), u.setHierarchy(t[r - 1]);
34
+ break;
35
+ case 8:
36
+ u.getLogger().debug("Stop NL ");
37
+ break;
38
+ case 9:
39
+ u.getLogger().debug("Stop EOF ");
40
+ break;
41
+ case 10:
42
+ u.getLogger().debug("Stop NL2 ");
43
+ break;
44
+ case 11:
45
+ u.getLogger().debug("Stop EOF2 ");
46
+ break;
47
+ case 12:
48
+ u.getLogger().debug("Rule: statement: ", t[r]), typeof t[r].length == "number" ? this.$ = t[r] : this.$ = [t[r]];
49
+ break;
50
+ case 13:
51
+ u.getLogger().debug("Rule: statement #2: ", t[r - 1]), this.$ = [t[r - 1]].concat(t[r]);
52
+ break;
53
+ case 14:
54
+ u.getLogger().debug("Rule: link: ", t[r], o), this.$ = { edgeTypeStr: t[r], label: "" };
55
+ break;
56
+ case 15:
57
+ u.getLogger().debug("Rule: LABEL link: ", t[r - 3], t[r - 1], t[r]), this.$ = { edgeTypeStr: t[r], label: t[r - 1] };
58
+ break;
59
+ case 18:
60
+ const R = parseInt(t[r]), Y = u.generateId();
61
+ this.$ = { id: Y, type: "space", label: "", width: R, children: [] };
62
+ break;
63
+ case 23:
64
+ u.getLogger().debug("Rule: (nodeStatement link node) ", t[r - 2], t[r - 1], t[r], " typestr: ", t[r - 1].edgeTypeStr);
65
+ const F = u.edgeStrToEdgeData(t[r - 1].edgeTypeStr);
66
+ this.$ = [
67
+ { id: t[r - 2].id, label: t[r - 2].label, type: t[r - 2].type, directions: t[r - 2].directions },
68
+ { id: t[r - 2].id + "-" + t[r].id, start: t[r - 2].id, end: t[r].id, label: t[r - 1].label, type: "edge", directions: t[r].directions, arrowTypeEnd: F, arrowTypeStart: "arrow_open" },
69
+ { id: t[r].id, label: t[r].label, type: u.typeStr2Type(t[r].typeStr), directions: t[r].directions }
70
+ ];
71
+ break;
72
+ case 24:
73
+ u.getLogger().debug("Rule: nodeStatement (abc88 node size) ", t[r - 1], t[r]), this.$ = { id: t[r - 1].id, label: t[r - 1].label, type: u.typeStr2Type(t[r - 1].typeStr), directions: t[r - 1].directions, widthInColumns: parseInt(t[r], 10) };
74
+ break;
75
+ case 25:
76
+ u.getLogger().debug("Rule: nodeStatement (node) ", t[r]), this.$ = { id: t[r].id, label: t[r].label, type: u.typeStr2Type(t[r].typeStr), directions: t[r].directions, widthInColumns: 1 };
77
+ break;
78
+ case 26:
79
+ u.getLogger().debug("APA123", this ? this : "na"), u.getLogger().debug("COLUMNS: ", t[r]), this.$ = { type: "column-setting", columns: t[r] === "auto" ? -1 : parseInt(t[r]) };
80
+ break;
81
+ case 27:
82
+ u.getLogger().debug("Rule: id-block statement : ", t[r - 2], t[r - 1]), u.generateId(), this.$ = { ...t[r - 2], type: "composite", children: t[r - 1] };
83
+ break;
84
+ case 28:
85
+ u.getLogger().debug("Rule: blockStatement : ", t[r - 2], t[r - 1], t[r]);
86
+ const C = u.generateId();
87
+ this.$ = { id: C, type: "composite", label: "", children: t[r - 1] };
88
+ break;
89
+ case 29:
90
+ u.getLogger().debug("Rule: node (NODE_ID separator): ", t[r]), this.$ = { id: t[r] };
91
+ break;
92
+ case 30:
93
+ u.getLogger().debug("Rule: node (NODE_ID nodeShapeNLabel separator): ", t[r - 1], t[r]), this.$ = { id: t[r - 1], label: t[r].label, typeStr: t[r].typeStr, directions: t[r].directions };
94
+ break;
95
+ case 31:
96
+ u.getLogger().debug("Rule: dirList: ", t[r]), this.$ = [t[r]];
97
+ break;
98
+ case 32:
99
+ u.getLogger().debug("Rule: dirList: ", t[r - 1], t[r]), this.$ = [t[r - 1]].concat(t[r]);
100
+ break;
101
+ case 33:
102
+ u.getLogger().debug("Rule: nodeShapeNLabel: ", t[r - 2], t[r - 1], t[r]), this.$ = { typeStr: t[r - 2] + t[r], label: t[r - 1] };
103
+ break;
104
+ case 34:
105
+ u.getLogger().debug("Rule: BLOCK_ARROW nodeShapeNLabel: ", t[r - 3], t[r - 2], " #3:", t[r - 1], t[r]), this.$ = { typeStr: t[r - 3] + t[r], label: t[r - 2], directions: t[r - 1] };
106
+ break;
107
+ case 35:
108
+ case 36:
109
+ this.$ = { type: "classDef", id: t[r - 1].trim(), css: t[r].trim() };
110
+ break;
111
+ case 37:
112
+ this.$ = { type: "applyClass", id: t[r - 1].trim(), styleClass: t[r].trim() };
113
+ break;
114
+ case 38:
115
+ this.$ = { type: "applyStyles", id: t[r - 1].trim(), stylesStr: t[r].trim() };
116
+ break;
117
+ }
118
+ },
119
+ table: [{ 9: 1, 10: [1, 2] }, { 1: [3] }, { 11: 3, 13: 4, 19: 5, 20: 6, 21: a, 22: 8, 23: 9, 24: 10, 25: 11, 26: 12, 28: d, 29: c, 31: n, 32: g, 40: l, 44: f, 47: b }, { 8: [1, 20] }, e(p, [2, 12], { 13: 4, 19: 5, 20: 6, 22: 8, 23: 9, 24: 10, 25: 11, 26: 12, 11: 21, 21: a, 28: d, 29: c, 31: n, 32: g, 40: l, 44: f, 47: b }), e(x, [2, 16], { 14: 22, 15: y, 16: T }), e(x, [2, 17]), e(x, [2, 18]), e(x, [2, 19]), e(x, [2, 20]), e(x, [2, 21]), e(x, [2, 22]), e(v, [2, 25], { 27: [1, 25] }), e(x, [2, 26]), { 19: 26, 26: 12, 32: g }, { 11: 27, 13: 4, 19: 5, 20: 6, 21: a, 22: 8, 23: 9, 24: 10, 25: 11, 26: 12, 28: d, 29: c, 31: n, 32: g, 40: l, 44: f, 47: b }, { 41: [1, 28], 43: [1, 29] }, { 45: [1, 30] }, { 48: [1, 31] }, e(N, [2, 29], { 33: 32, 36: [1, 33], 38: [1, 34] }), { 1: [2, 7] }, e(p, [2, 13]), { 26: 35, 32: g }, { 32: [2, 14] }, { 17: [1, 36] }, e(v, [2, 24]), { 11: 37, 13: 4, 14: 22, 15: y, 16: T, 19: 5, 20: 6, 21: a, 22: 8, 23: 9, 24: 10, 25: 11, 26: 12, 28: d, 29: c, 31: n, 32: g, 40: l, 44: f, 47: b }, { 30: [1, 38] }, { 42: [1, 39] }, { 42: [1, 40] }, { 46: [1, 41] }, { 49: [1, 42] }, e(N, [2, 30]), { 18: [1, 43] }, { 18: [1, 44] }, e(v, [2, 23]), { 18: [1, 45] }, { 30: [1, 46] }, e(x, [2, 28]), e(x, [2, 35]), e(x, [2, 36]), e(x, [2, 37]), e(x, [2, 38]), { 37: [1, 47] }, { 34: 48, 35: E }, { 15: [1, 50] }, e(x, [2, 27]), e(N, [2, 33]), { 39: [1, 51] }, { 34: 52, 35: E, 39: [2, 31] }, { 32: [2, 15] }, e(N, [2, 34]), { 39: [2, 32] }],
120
+ defaultActions: { 20: [2, 7], 23: [2, 14], 50: [2, 15], 52: [2, 32] },
121
+ parseError: function(o, s) {
122
+ if (s.recoverable)
123
+ this.trace(o);
124
+ else {
125
+ var i = new Error(o);
126
+ throw i.hash = s, i;
127
+ }
128
+ },
129
+ parse: function(o) {
130
+ var s = this, i = [0], u = [], h = [null], t = [], m = this.table, r = "", R = 0, Y = 0, F = 2, C = 1, Le = t.slice.call(arguments, 1), w = Object.create(this.lexer), K = { yy: {} };
131
+ for (var Z in this.yy)
132
+ Object.prototype.hasOwnProperty.call(this.yy, Z) && (K.yy[Z] = this.yy[Z]);
133
+ w.setInput(o, K.yy), K.yy.lexer = w, K.yy.parser = this, typeof w.yylloc > "u" && (w.yylloc = {});
134
+ var J = w.yylloc;
135
+ t.push(J);
136
+ var me = w.options && w.options.ranges;
137
+ typeof K.yy.parseError == "function" ? this.parseError = K.yy.parseError : this.parseError = Object.getPrototypeOf(this).parseError;
138
+ function _e() {
139
+ var P;
140
+ return P = u.pop() || w.lex() || C, typeof P != "number" && (P instanceof Array && (u = P, P = u.pop()), P = s.symbols_[P] || P), P;
141
+ }
142
+ for (var I, M, z, Q, W = {}, X, B, ae, G; ; ) {
143
+ if (M = i[i.length - 1], this.defaultActions[M] ? z = this.defaultActions[M] : ((I === null || typeof I > "u") && (I = _e()), z = m[M] && m[M][I]), typeof z > "u" || !z.length || !z[0]) {
144
+ var $ = "";
145
+ G = [];
146
+ for (X in m[M])
147
+ this.terminals_[X] && X > F && G.push("'" + this.terminals_[X] + "'");
148
+ w.showPosition ? $ = "Parse error on line " + (R + 1) + `:
149
+ ` + w.showPosition() + `
150
+ Expecting ` + G.join(", ") + ", got '" + (this.terminals_[I] || I) + "'" : $ = "Parse error on line " + (R + 1) + ": Unexpected " + (I == C ? "end of input" : "'" + (this.terminals_[I] || I) + "'"), this.parseError($, {
151
+ text: w.match,
152
+ token: this.terminals_[I] || I,
153
+ line: w.yylineno,
154
+ loc: J,
155
+ expected: G
156
+ });
157
+ }
158
+ if (z[0] instanceof Array && z.length > 1)
159
+ throw new Error("Parse Error: multiple actions possible at state: " + M + ", token: " + I);
160
+ switch (z[0]) {
161
+ case 1:
162
+ i.push(I), h.push(w.yytext), t.push(w.yylloc), i.push(z[1]), I = null, Y = w.yyleng, r = w.yytext, R = w.yylineno, J = w.yylloc;
163
+ break;
164
+ case 2:
165
+ if (B = this.productions_[z[1]][1], W.$ = h[h.length - B], W._$ = {
166
+ first_line: t[t.length - (B || 1)].first_line,
167
+ last_line: t[t.length - 1].last_line,
168
+ first_column: t[t.length - (B || 1)].first_column,
169
+ last_column: t[t.length - 1].last_column
170
+ }, me && (W._$.range = [
171
+ t[t.length - (B || 1)].range[0],
172
+ t[t.length - 1].range[1]
173
+ ]), Q = this.performAction.apply(W, [
174
+ r,
175
+ Y,
176
+ R,
177
+ K.yy,
178
+ z[1],
179
+ h,
180
+ t
181
+ ].concat(Le)), typeof Q < "u")
182
+ return Q;
183
+ B && (i = i.slice(0, -1 * B * 2), h = h.slice(0, -1 * B), t = t.slice(0, -1 * B)), i.push(this.productions_[z[1]][0]), h.push(W.$), t.push(W._$), ae = m[i[i.length - 2]][i[i.length - 1]], i.push(ae);
184
+ break;
185
+ case 3:
186
+ return !0;
187
+ }
188
+ }
189
+ return !0;
190
+ }
191
+ }, A = /* @__PURE__ */ (function() {
192
+ var D = {
193
+ EOF: 1,
194
+ parseError: function(s, i) {
195
+ if (this.yy.parser)
196
+ this.yy.parser.parseError(s, i);
197
+ else
198
+ throw new Error(s);
199
+ },
200
+ // resets the lexer, sets new input
201
+ setInput: function(o, s) {
202
+ return this.yy = s || this.yy || {}, this._input = o, this._more = this._backtrack = this.done = !1, this.yylineno = this.yyleng = 0, this.yytext = this.matched = this.match = "", this.conditionStack = ["INITIAL"], this.yylloc = {
203
+ first_line: 1,
204
+ first_column: 0,
205
+ last_line: 1,
206
+ last_column: 0
207
+ }, this.options.ranges && (this.yylloc.range = [0, 0]), this.offset = 0, this;
208
+ },
209
+ // consumes and returns one char from the input
210
+ input: function() {
211
+ var o = this._input[0];
212
+ this.yytext += o, this.yyleng++, this.offset++, this.match += o, this.matched += o;
213
+ var s = o.match(/(?:\r\n?|\n).*/g);
214
+ return s ? (this.yylineno++, this.yylloc.last_line++) : this.yylloc.last_column++, this.options.ranges && this.yylloc.range[1]++, this._input = this._input.slice(1), o;
215
+ },
216
+ // unshifts one char (or a string) into the input
217
+ unput: function(o) {
218
+ var s = o.length, i = o.split(/(?:\r\n?|\n)/g);
219
+ this._input = o + this._input, this.yytext = this.yytext.substr(0, this.yytext.length - s), this.offset -= s;
220
+ var u = this.match.split(/(?:\r\n?|\n)/g);
221
+ this.match = this.match.substr(0, this.match.length - 1), this.matched = this.matched.substr(0, this.matched.length - 1), i.length - 1 && (this.yylineno -= i.length - 1);
222
+ var h = this.yylloc.range;
223
+ return this.yylloc = {
224
+ first_line: this.yylloc.first_line,
225
+ last_line: this.yylineno + 1,
226
+ first_column: this.yylloc.first_column,
227
+ last_column: i ? (i.length === u.length ? this.yylloc.first_column : 0) + u[u.length - i.length].length - i[0].length : this.yylloc.first_column - s
228
+ }, this.options.ranges && (this.yylloc.range = [h[0], h[0] + this.yyleng - s]), this.yyleng = this.yytext.length, this;
229
+ },
230
+ // When called from action, caches matched text and appends it on next action
231
+ more: function() {
232
+ return this._more = !0, this;
233
+ },
234
+ // 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.
235
+ reject: function() {
236
+ if (this.options.backtrack_lexer)
237
+ this._backtrack = !0;
238
+ else
239
+ 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).
240
+ ` + this.showPosition(), {
241
+ text: "",
242
+ token: null,
243
+ line: this.yylineno
244
+ });
245
+ return this;
246
+ },
247
+ // retain first n characters of the match
248
+ less: function(o) {
249
+ this.unput(this.match.slice(o));
250
+ },
251
+ // displays already matched input, i.e. for error messages
252
+ pastInput: function() {
253
+ var o = this.matched.substr(0, this.matched.length - this.match.length);
254
+ return (o.length > 20 ? "..." : "") + o.substr(-20).replace(/\n/g, "");
255
+ },
256
+ // displays upcoming input, i.e. for error messages
257
+ upcomingInput: function() {
258
+ var o = this.match;
259
+ return o.length < 20 && (o += this._input.substr(0, 20 - o.length)), (o.substr(0, 20) + (o.length > 20 ? "..." : "")).replace(/\n/g, "");
260
+ },
261
+ // displays the character position where the lexing error occurred, i.e. for error messages
262
+ showPosition: function() {
263
+ var o = this.pastInput(), s = new Array(o.length + 1).join("-");
264
+ return o + this.upcomingInput() + `
265
+ ` + s + "^";
266
+ },
267
+ // test the lexed token: return FALSE when not a match, otherwise return token
268
+ test_match: function(o, s) {
269
+ var i, u, h;
270
+ if (this.options.backtrack_lexer && (h = {
271
+ yylineno: this.yylineno,
272
+ yylloc: {
273
+ first_line: this.yylloc.first_line,
274
+ last_line: this.last_line,
275
+ first_column: this.yylloc.first_column,
276
+ last_column: this.yylloc.last_column
277
+ },
278
+ yytext: this.yytext,
279
+ match: this.match,
280
+ matches: this.matches,
281
+ matched: this.matched,
282
+ yyleng: this.yyleng,
283
+ offset: this.offset,
284
+ _more: this._more,
285
+ _input: this._input,
286
+ yy: this.yy,
287
+ conditionStack: this.conditionStack.slice(0),
288
+ done: this.done
289
+ }, this.options.ranges && (h.yylloc.range = this.yylloc.range.slice(0))), u = o[0].match(/(?:\r\n?|\n).*/g), u && (this.yylineno += u.length), this.yylloc = {
290
+ first_line: this.yylloc.last_line,
291
+ last_line: this.yylineno + 1,
292
+ first_column: this.yylloc.last_column,
293
+ last_column: u ? u[u.length - 1].length - u[u.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + o[0].length
294
+ }, this.yytext += o[0], this.match += o[0], this.matches = o, this.yyleng = this.yytext.length, this.options.ranges && (this.yylloc.range = [this.offset, this.offset += this.yyleng]), this._more = !1, this._backtrack = !1, this._input = this._input.slice(o[0].length), this.matched += o[0], i = this.performAction.call(this, this.yy, this, s, this.conditionStack[this.conditionStack.length - 1]), this.done && this._input && (this.done = !1), i)
295
+ return i;
296
+ if (this._backtrack) {
297
+ for (var t in h)
298
+ this[t] = h[t];
299
+ return !1;
300
+ }
301
+ return !1;
302
+ },
303
+ // return next match in input
304
+ next: function() {
305
+ if (this.done)
306
+ return this.EOF;
307
+ this._input || (this.done = !0);
308
+ var o, s, i, u;
309
+ this._more || (this.yytext = "", this.match = "");
310
+ for (var h = this._currentRules(), t = 0; t < h.length; t++)
311
+ if (i = this._input.match(this.rules[h[t]]), i && (!s || i[0].length > s[0].length)) {
312
+ if (s = i, u = t, this.options.backtrack_lexer) {
313
+ if (o = this.test_match(i, h[t]), o !== !1)
314
+ return o;
315
+ if (this._backtrack) {
316
+ s = !1;
317
+ continue;
318
+ } else
319
+ return !1;
320
+ } else if (!this.options.flex)
321
+ break;
322
+ }
323
+ return s ? (o = this.test_match(s, h[u]), o !== !1 ? o : !1) : this._input === "" ? this.EOF : this.parseError("Lexical error on line " + (this.yylineno + 1) + `. Unrecognized text.
324
+ ` + this.showPosition(), {
325
+ text: "",
326
+ token: null,
327
+ line: this.yylineno
328
+ });
329
+ },
330
+ // return next match that has a token
331
+ lex: function() {
332
+ var s = this.next();
333
+ return s || this.lex();
334
+ },
335
+ // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
336
+ begin: function(s) {
337
+ this.conditionStack.push(s);
338
+ },
339
+ // pop the previously active lexer condition state off the condition stack
340
+ popState: function() {
341
+ var s = this.conditionStack.length - 1;
342
+ return s > 0 ? this.conditionStack.pop() : this.conditionStack[0];
343
+ },
344
+ // produce the lexer rule set which is active for the currently active lexer condition state
345
+ _currentRules: function() {
346
+ return this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1] ? this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules : this.conditions.INITIAL.rules;
347
+ },
348
+ // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
349
+ topState: function(s) {
350
+ return s = this.conditionStack.length - 1 - Math.abs(s || 0), s >= 0 ? this.conditionStack[s] : "INITIAL";
351
+ },
352
+ // alias for begin(condition)
353
+ pushState: function(s) {
354
+ this.begin(s);
355
+ },
356
+ // return the number of states currently on the stack
357
+ stateStackSize: function() {
358
+ return this.conditionStack.length;
359
+ },
360
+ options: {},
361
+ performAction: function(s, i, u, h) {
362
+ switch (u) {
363
+ case 0:
364
+ return 10;
365
+ case 1:
366
+ return s.getLogger().debug("Found space-block"), 31;
367
+ case 2:
368
+ return s.getLogger().debug("Found nl-block"), 31;
369
+ case 3:
370
+ return s.getLogger().debug("Found space-block"), 29;
371
+ case 4:
372
+ s.getLogger().debug(".", i.yytext);
373
+ break;
374
+ case 5:
375
+ s.getLogger().debug("_", i.yytext);
376
+ break;
377
+ case 6:
378
+ return 5;
379
+ case 7:
380
+ return i.yytext = -1, 28;
381
+ case 8:
382
+ return i.yytext = i.yytext.replace(/columns\s+/, ""), s.getLogger().debug("COLUMNS (LEX)", i.yytext), 28;
383
+ case 9:
384
+ this.pushState("md_string");
385
+ break;
386
+ case 10:
387
+ return "MD_STR";
388
+ case 11:
389
+ this.popState();
390
+ break;
391
+ case 12:
392
+ this.pushState("string");
393
+ break;
394
+ case 13:
395
+ s.getLogger().debug("LEX: POPPING STR:", i.yytext), this.popState();
396
+ break;
397
+ case 14:
398
+ return s.getLogger().debug("LEX: STR end:", i.yytext), "STR";
399
+ case 15:
400
+ return i.yytext = i.yytext.replace(/space\:/, ""), s.getLogger().debug("SPACE NUM (LEX)", i.yytext), 21;
401
+ case 16:
402
+ return i.yytext = "1", s.getLogger().debug("COLUMNS (LEX)", i.yytext), 21;
403
+ case 17:
404
+ return 43;
405
+ case 18:
406
+ return "LINKSTYLE";
407
+ case 19:
408
+ return "INTERPOLATE";
409
+ case 20:
410
+ return this.pushState("CLASSDEF"), 40;
411
+ case 21:
412
+ return this.popState(), this.pushState("CLASSDEFID"), "DEFAULT_CLASSDEF_ID";
413
+ case 22:
414
+ return this.popState(), this.pushState("CLASSDEFID"), 41;
415
+ case 23:
416
+ return this.popState(), 42;
417
+ case 24:
418
+ return this.pushState("CLASS"), 44;
419
+ case 25:
420
+ return this.popState(), this.pushState("CLASS_STYLE"), 45;
421
+ case 26:
422
+ return this.popState(), 46;
423
+ case 27:
424
+ return this.pushState("STYLE_STMNT"), 47;
425
+ case 28:
426
+ return this.popState(), this.pushState("STYLE_DEFINITION"), 48;
427
+ case 29:
428
+ return this.popState(), 49;
429
+ case 30:
430
+ return this.pushState("acc_title"), "acc_title";
431
+ case 31:
432
+ return this.popState(), "acc_title_value";
433
+ case 32:
434
+ return this.pushState("acc_descr"), "acc_descr";
435
+ case 33:
436
+ return this.popState(), "acc_descr_value";
437
+ case 34:
438
+ this.pushState("acc_descr_multiline");
439
+ break;
440
+ case 35:
441
+ this.popState();
442
+ break;
443
+ case 36:
444
+ return "acc_descr_multiline_value";
445
+ case 37:
446
+ return 30;
447
+ case 38:
448
+ return this.popState(), s.getLogger().debug("Lex: (("), "NODE_DEND";
449
+ case 39:
450
+ return this.popState(), s.getLogger().debug("Lex: (("), "NODE_DEND";
451
+ case 40:
452
+ return this.popState(), s.getLogger().debug("Lex: ))"), "NODE_DEND";
453
+ case 41:
454
+ return this.popState(), s.getLogger().debug("Lex: (("), "NODE_DEND";
455
+ case 42:
456
+ return this.popState(), s.getLogger().debug("Lex: (("), "NODE_DEND";
457
+ case 43:
458
+ return this.popState(), s.getLogger().debug("Lex: (-"), "NODE_DEND";
459
+ case 44:
460
+ return this.popState(), s.getLogger().debug("Lex: -)"), "NODE_DEND";
461
+ case 45:
462
+ return this.popState(), s.getLogger().debug("Lex: (("), "NODE_DEND";
463
+ case 46:
464
+ return this.popState(), s.getLogger().debug("Lex: ]]"), "NODE_DEND";
465
+ case 47:
466
+ return this.popState(), s.getLogger().debug("Lex: ("), "NODE_DEND";
467
+ case 48:
468
+ return this.popState(), s.getLogger().debug("Lex: ])"), "NODE_DEND";
469
+ case 49:
470
+ return this.popState(), s.getLogger().debug("Lex: /]"), "NODE_DEND";
471
+ case 50:
472
+ return this.popState(), s.getLogger().debug("Lex: /]"), "NODE_DEND";
473
+ case 51:
474
+ return this.popState(), s.getLogger().debug("Lex: )]"), "NODE_DEND";
475
+ case 52:
476
+ return this.popState(), s.getLogger().debug("Lex: )"), "NODE_DEND";
477
+ case 53:
478
+ return this.popState(), s.getLogger().debug("Lex: ]>"), "NODE_DEND";
479
+ case 54:
480
+ return this.popState(), s.getLogger().debug("Lex: ]"), "NODE_DEND";
481
+ case 55:
482
+ return s.getLogger().debug("Lexa: -)"), this.pushState("NODE"), 36;
483
+ case 56:
484
+ return s.getLogger().debug("Lexa: (-"), this.pushState("NODE"), 36;
485
+ case 57:
486
+ return s.getLogger().debug("Lexa: ))"), this.pushState("NODE"), 36;
487
+ case 58:
488
+ return s.getLogger().debug("Lexa: )"), this.pushState("NODE"), 36;
489
+ case 59:
490
+ return s.getLogger().debug("Lex: ((("), this.pushState("NODE"), 36;
491
+ case 60:
492
+ return s.getLogger().debug("Lexa: )"), this.pushState("NODE"), 36;
493
+ case 61:
494
+ return s.getLogger().debug("Lexa: )"), this.pushState("NODE"), 36;
495
+ case 62:
496
+ return s.getLogger().debug("Lexa: )"), this.pushState("NODE"), 36;
497
+ case 63:
498
+ return s.getLogger().debug("Lexc: >"), this.pushState("NODE"), 36;
499
+ case 64:
500
+ return s.getLogger().debug("Lexa: (["), this.pushState("NODE"), 36;
501
+ case 65:
502
+ return s.getLogger().debug("Lexa: )"), this.pushState("NODE"), 36;
503
+ case 66:
504
+ return this.pushState("NODE"), 36;
505
+ case 67:
506
+ return this.pushState("NODE"), 36;
507
+ case 68:
508
+ return this.pushState("NODE"), 36;
509
+ case 69:
510
+ return this.pushState("NODE"), 36;
511
+ case 70:
512
+ return this.pushState("NODE"), 36;
513
+ case 71:
514
+ return this.pushState("NODE"), 36;
515
+ case 72:
516
+ return this.pushState("NODE"), 36;
517
+ case 73:
518
+ return s.getLogger().debug("Lexa: ["), this.pushState("NODE"), 36;
519
+ case 74:
520
+ return this.pushState("BLOCK_ARROW"), s.getLogger().debug("LEX ARR START"), 38;
521
+ case 75:
522
+ return s.getLogger().debug("Lex: NODE_ID", i.yytext), 32;
523
+ case 76:
524
+ return s.getLogger().debug("Lex: EOF", i.yytext), 8;
525
+ case 77:
526
+ this.pushState("md_string");
527
+ break;
528
+ case 78:
529
+ this.pushState("md_string");
530
+ break;
531
+ case 79:
532
+ return "NODE_DESCR";
533
+ case 80:
534
+ this.popState();
535
+ break;
536
+ case 81:
537
+ s.getLogger().debug("Lex: Starting string"), this.pushState("string");
538
+ break;
539
+ case 82:
540
+ s.getLogger().debug("LEX ARR: Starting string"), this.pushState("string");
541
+ break;
542
+ case 83:
543
+ return s.getLogger().debug("LEX: NODE_DESCR:", i.yytext), "NODE_DESCR";
544
+ case 84:
545
+ s.getLogger().debug("LEX POPPING"), this.popState();
546
+ break;
547
+ case 85:
548
+ s.getLogger().debug("Lex: =>BAE"), this.pushState("ARROW_DIR");
549
+ break;
550
+ case 86:
551
+ return i.yytext = i.yytext.replace(/^,\s*/, ""), s.getLogger().debug("Lex (right): dir:", i.yytext), "DIR";
552
+ case 87:
553
+ return i.yytext = i.yytext.replace(/^,\s*/, ""), s.getLogger().debug("Lex (left):", i.yytext), "DIR";
554
+ case 88:
555
+ return i.yytext = i.yytext.replace(/^,\s*/, ""), s.getLogger().debug("Lex (x):", i.yytext), "DIR";
556
+ case 89:
557
+ return i.yytext = i.yytext.replace(/^,\s*/, ""), s.getLogger().debug("Lex (y):", i.yytext), "DIR";
558
+ case 90:
559
+ return i.yytext = i.yytext.replace(/^,\s*/, ""), s.getLogger().debug("Lex (up):", i.yytext), "DIR";
560
+ case 91:
561
+ return i.yytext = i.yytext.replace(/^,\s*/, ""), s.getLogger().debug("Lex (down):", i.yytext), "DIR";
562
+ case 92:
563
+ return i.yytext = "]>", s.getLogger().debug("Lex (ARROW_DIR end):", i.yytext), this.popState(), this.popState(), "BLOCK_ARROW_END";
564
+ case 93:
565
+ return s.getLogger().debug("Lex: LINK", "#" + i.yytext + "#"), 15;
566
+ case 94:
567
+ return s.getLogger().debug("Lex: LINK", i.yytext), 15;
568
+ case 95:
569
+ return s.getLogger().debug("Lex: LINK", i.yytext), 15;
570
+ case 96:
571
+ return s.getLogger().debug("Lex: LINK", i.yytext), 15;
572
+ case 97:
573
+ return s.getLogger().debug("Lex: START_LINK", i.yytext), this.pushState("LLABEL"), 16;
574
+ case 98:
575
+ return s.getLogger().debug("Lex: START_LINK", i.yytext), this.pushState("LLABEL"), 16;
576
+ case 99:
577
+ return s.getLogger().debug("Lex: START_LINK", i.yytext), this.pushState("LLABEL"), 16;
578
+ case 100:
579
+ this.pushState("md_string");
580
+ break;
581
+ case 101:
582
+ return s.getLogger().debug("Lex: Starting string"), this.pushState("string"), "LINK_LABEL";
583
+ case 102:
584
+ return this.popState(), s.getLogger().debug("Lex: LINK", "#" + i.yytext + "#"), 15;
585
+ case 103:
586
+ return this.popState(), s.getLogger().debug("Lex: LINK", i.yytext), 15;
587
+ case 104:
588
+ return this.popState(), s.getLogger().debug("Lex: LINK", i.yytext), 15;
589
+ case 105:
590
+ return s.getLogger().debug("Lex: COLON", i.yytext), i.yytext = i.yytext.slice(1), 27;
591
+ }
592
+ },
593
+ rules: [/^(?:block-beta\b)/, /^(?:block\s+)/, /^(?:block\n+)/, /^(?:block:)/, /^(?:[\s]+)/, /^(?:[\n]+)/, /^(?:((\u000D\u000A)|(\u000A)))/, /^(?:columns\s+auto\b)/, /^(?:columns\s+[\d]+)/, /^(?:["][`])/, /^(?:[^`"]+)/, /^(?:[`]["])/, /^(?:["])/, /^(?:["])/, /^(?:[^"]*)/, /^(?:space[:]\d+)/, /^(?:space\b)/, /^(?:default\b)/, /^(?:linkStyle\b)/, /^(?:interpolate\b)/, /^(?:classDef\s+)/, /^(?:DEFAULT\s+)/, /^(?:\w+\s+)/, /^(?:[^\n]*)/, /^(?:class\s+)/, /^(?:(\w+)+((,\s*\w+)*))/, /^(?:[^\n]*)/, /^(?:style\s+)/, /^(?:(\w+)+((,\s*\w+)*))/, /^(?:[^\n]*)/, /^(?:accTitle\s*:\s*)/, /^(?:(?!\n||)*[^\n]*)/, /^(?:accDescr\s*:\s*)/, /^(?:(?!\n||)*[^\n]*)/, /^(?:accDescr\s*\{\s*)/, /^(?:[\}])/, /^(?:[^\}]*)/, /^(?:end\b\s*)/, /^(?:\(\(\()/, /^(?:\)\)\))/, /^(?:[\)]\))/, /^(?:\}\})/, /^(?:\})/, /^(?:\(-)/, /^(?:-\))/, /^(?:\(\()/, /^(?:\]\])/, /^(?:\()/, /^(?:\]\))/, /^(?:\\\])/, /^(?:\/\])/, /^(?:\)\])/, /^(?:[\)])/, /^(?:\]>)/, /^(?:[\]])/, /^(?:-\))/, /^(?:\(-)/, /^(?:\)\))/, /^(?:\))/, /^(?:\(\(\()/, /^(?:\(\()/, /^(?:\{\{)/, /^(?:\{)/, /^(?:>)/, /^(?:\(\[)/, /^(?:\()/, /^(?:\[\[)/, /^(?:\[\|)/, /^(?:\[\()/, /^(?:\)\)\))/, /^(?:\[\\)/, /^(?:\[\/)/, /^(?:\[\\)/, /^(?:\[)/, /^(?:<\[)/, /^(?:[^\(\[\n\-\)\{\}\s\<\>:]+)/, /^(?:$)/, /^(?:["][`])/, /^(?:["][`])/, /^(?:[^`"]+)/, /^(?:[`]["])/, /^(?:["])/, /^(?:["])/, /^(?:[^"]+)/, /^(?:["])/, /^(?:\]>\s*\()/, /^(?:,?\s*right\s*)/, /^(?:,?\s*left\s*)/, /^(?:,?\s*x\s*)/, /^(?:,?\s*y\s*)/, /^(?:,?\s*up\s*)/, /^(?:,?\s*down\s*)/, /^(?:\)\s*)/, /^(?:\s*[xo<]?--+[-xo>]\s*)/, /^(?:\s*[xo<]?==+[=xo>]\s*)/, /^(?:\s*[xo<]?-?\.+-[xo>]?\s*)/, /^(?:\s*~~[\~]+\s*)/, /^(?:\s*[xo<]?--\s*)/, /^(?:\s*[xo<]?==\s*)/, /^(?:\s*[xo<]?-\.\s*)/, /^(?:["][`])/, /^(?:["])/, /^(?:\s*[xo<]?--+[-xo>]\s*)/, /^(?:\s*[xo<]?==+[=xo>]\s*)/, /^(?:\s*[xo<]?-?\.+-[xo>]?\s*)/, /^(?::\d+)/],
594
+ conditions: { STYLE_DEFINITION: { rules: [29], inclusive: !1 }, STYLE_STMNT: { rules: [28], inclusive: !1 }, CLASSDEFID: { rules: [23], inclusive: !1 }, CLASSDEF: { rules: [21, 22], inclusive: !1 }, CLASS_STYLE: { rules: [26], inclusive: !1 }, CLASS: { rules: [25], inclusive: !1 }, LLABEL: { rules: [100, 101, 102, 103, 104], inclusive: !1 }, ARROW_DIR: { rules: [86, 87, 88, 89, 90, 91, 92], inclusive: !1 }, BLOCK_ARROW: { rules: [77, 82, 85], inclusive: !1 }, NODE: { rules: [38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 78, 81], inclusive: !1 }, md_string: { rules: [10, 11, 79, 80], inclusive: !1 }, space: { rules: [], inclusive: !1 }, string: { rules: [13, 14, 83, 84], inclusive: !1 }, acc_descr_multiline: { rules: [35, 36], inclusive: !1 }, acc_descr: { rules: [33], inclusive: !1 }, acc_title: { rules: [31], inclusive: !1 }, INITIAL: { rules: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 12, 15, 16, 17, 18, 19, 20, 24, 27, 30, 32, 34, 37, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 93, 94, 95, 96, 97, 98, 99, 105], inclusive: !0 } }
595
+ };
596
+ return D;
597
+ })();
598
+ L.lexer = A;
599
+ function k() {
600
+ this.yy = {};
601
+ }
602
+ return k.prototype = L, L.Parser = k, new k();
603
+ })();
604
+ ee.parser = ee;
605
+ const Pe = ee;
606
+ let O = {}, ie = [], V = {};
607
+ const ce = "color", ue = "fill", Fe = "bgFill", pe = ",", Ke = he();
608
+ let j = {};
609
+ const Me = (e) => De.sanitizeText(e, Ke), Ye = function(e, a = "") {
610
+ j[e] === void 0 && (j[e] = { id: e, styles: [], textStyles: [] });
611
+ const d = j[e];
612
+ a?.split(pe).forEach((c) => {
613
+ const n = c.replace(/([^;]*);/, "$1").trim();
614
+ if (c.match(ce)) {
615
+ const l = n.replace(ue, Fe).replace(ce, ue);
616
+ d.textStyles.push(l);
617
+ }
618
+ d.styles.push(n);
619
+ });
620
+ }, We = function(e, a = "") {
621
+ const d = O[e];
622
+ a != null && (d.styles = a.split(pe));
623
+ }, Ve = function(e, a) {
624
+ e.split(",").forEach(function(d) {
625
+ let c = O[d];
626
+ if (c === void 0) {
627
+ const n = d.trim();
628
+ O[n] = { id: n, type: "na", children: [] }, c = O[n];
629
+ }
630
+ c.classes || (c.classes = []), c.classes.push(a);
631
+ });
632
+ }, fe = (e, a) => {
633
+ const d = e.flat(), c = [];
634
+ for (const n of d) {
635
+ if (n.label && (n.label = Me(n.label)), n.type === "classDef") {
636
+ Ye(n.id, n.css);
637
+ continue;
638
+ }
639
+ if (n.type === "applyClass") {
640
+ Ve(n.id, n?.styleClass || "");
641
+ continue;
642
+ }
643
+ if (n.type === "applyStyles") {
644
+ n?.stylesStr && We(n.id, n?.stylesStr);
645
+ continue;
646
+ }
647
+ if (n.type === "column-setting")
648
+ a.columns = n.columns || -1;
649
+ else if (n.type === "edge")
650
+ V[n.id] ? V[n.id]++ : V[n.id] = 1, n.id = V[n.id] + "-" + n.id, ie.push(n);
651
+ else {
652
+ n.label || (n.type === "composite" ? n.label = "" : n.label = n.id);
653
+ const g = !O[n.id];
654
+ if (g ? O[n.id] = n : (n.type !== "na" && (O[n.id].type = n.type), n.label !== n.id && (O[n.id].label = n.label)), n.children && fe(n.children, n), n.type === "space") {
655
+ const l = n.width || 1;
656
+ for (let f = 0; f < l; f++) {
657
+ const b = Ne(n);
658
+ b.id = b.id + "-" + f, O[b.id] = b, c.push(b);
659
+ }
660
+ } else g && c.push(n);
661
+ }
662
+ }
663
+ a.children = c;
664
+ };
665
+ let re = [], U = { id: "root", type: "composite", children: [], columns: -1 };
666
+ const je = () => {
667
+ S.debug("Clear called"), we(), U = { id: "root", type: "composite", children: [], columns: -1 }, O = { root: U }, re = [], j = {}, ie = [], V = {};
668
+ };
669
+ function Ue(e) {
670
+ switch (S.debug("typeStr2Type", e), e) {
671
+ case "[]":
672
+ return "square";
673
+ case "()":
674
+ return S.debug("we have a round"), "round";
675
+ case "(())":
676
+ return "circle";
677
+ case ">]":
678
+ return "rect_left_inv_arrow";
679
+ case "{}":
680
+ return "diamond";
681
+ case "{{}}":
682
+ return "hexagon";
683
+ case "([])":
684
+ return "stadium";
685
+ case "[[]]":
686
+ return "subroutine";
687
+ case "[()]":
688
+ return "cylinder";
689
+ case "((()))":
690
+ return "doublecircle";
691
+ case "[//]":
692
+ return "lean_right";
693
+ case "[\\\\]":
694
+ return "lean_left";
695
+ case "[/\\]":
696
+ return "trapezoid";
697
+ case "[\\/]":
698
+ return "inv_trapezoid";
699
+ case "<[]>":
700
+ return "block_arrow";
701
+ default:
702
+ return "na";
703
+ }
704
+ }
705
+ function Xe(e) {
706
+ switch (S.debug("typeStr2Type", e), e) {
707
+ case "==":
708
+ return "thick";
709
+ default:
710
+ return "normal";
711
+ }
712
+ }
713
+ function Ge(e) {
714
+ switch (e.trim()) {
715
+ case "--x":
716
+ return "arrow_cross";
717
+ case "--o":
718
+ return "arrow_circle";
719
+ default:
720
+ return "arrow_point";
721
+ }
722
+ }
723
+ let de = 0;
724
+ const He = () => (de++, "id-" + Math.random().toString(36).substr(2, 12) + "-" + de), qe = (e) => {
725
+ U.children = e, fe(e, U), re = U.children;
726
+ }, Ze = (e) => {
727
+ const a = O[e];
728
+ return a ? a.columns ? a.columns : a.children ? a.children.length : -1 : -1;
729
+ }, Je = () => [...Object.values(O)], Qe = () => re || [], $e = () => ie, et = (e) => O[e], tt = (e) => {
730
+ O[e.id] = e;
731
+ }, st = () => console, it = function() {
732
+ return j;
733
+ }, rt = {
734
+ getConfig: () => se().block,
735
+ typeStr2Type: Ue,
736
+ edgeTypeStr2Type: Xe,
737
+ edgeStrToEdgeData: Ge,
738
+ getLogger: st,
739
+ getBlocksFlat: Je,
740
+ getBlocks: Qe,
741
+ getEdges: $e,
742
+ setHierarchy: qe,
743
+ getBlock: et,
744
+ setBlock: tt,
745
+ getColumns: Ze,
746
+ getClasses: it,
747
+ clear: je,
748
+ generateId: He
749
+ }, nt = rt, q = (e, a) => {
750
+ const d = Ae, c = d(e, "r"), n = d(e, "g"), g = d(e, "b");
751
+ return ye(c, n, g, a);
752
+ }, at = (e) => `.label {
753
+ font-family: ${e.fontFamily};
754
+ color: ${e.nodeTextColor || e.textColor};
755
+ }
756
+ .cluster-label text {
757
+ fill: ${e.titleColor};
758
+ }
759
+ .cluster-label span,p {
760
+ color: ${e.titleColor};
761
+ }
762
+
763
+
764
+
765
+ .label text,span,p {
766
+ fill: ${e.nodeTextColor || e.textColor};
767
+ color: ${e.nodeTextColor || e.textColor};
768
+ }
769
+
770
+ .node rect,
771
+ .node circle,
772
+ .node ellipse,
773
+ .node polygon,
774
+ .node path {
775
+ fill: ${e.mainBkg};
776
+ stroke: ${e.nodeBorder};
777
+ stroke-width: 1px;
778
+ }
779
+ .flowchart-label text {
780
+ text-anchor: middle;
781
+ }
782
+ // .flowchart-label .text-outer-tspan {
783
+ // text-anchor: middle;
784
+ // }
785
+ // .flowchart-label .text-inner-tspan {
786
+ // text-anchor: start;
787
+ // }
788
+
789
+ .node .label {
790
+ text-align: center;
791
+ }
792
+ .node.clickable {
793
+ cursor: pointer;
794
+ }
795
+
796
+ .arrowheadPath {
797
+ fill: ${e.arrowheadColor};
798
+ }
799
+
800
+ .edgePath .path {
801
+ stroke: ${e.lineColor};
802
+ stroke-width: 2.0px;
803
+ }
804
+
805
+ .flowchart-link {
806
+ stroke: ${e.lineColor};
807
+ fill: none;
808
+ }
809
+
810
+ .edgeLabel {
811
+ background-color: ${e.edgeLabelBackground};
812
+ rect {
813
+ opacity: 0.5;
814
+ background-color: ${e.edgeLabelBackground};
815
+ fill: ${e.edgeLabelBackground};
816
+ }
817
+ text-align: center;
818
+ }
819
+
820
+ /* For html labels only */
821
+ .labelBkg {
822
+ background-color: ${q(e.edgeLabelBackground, 0.5)};
823
+ // background-color:
824
+ }
825
+
826
+ .node .cluster {
827
+ // fill: ${q(e.mainBkg, 0.5)};
828
+ fill: ${q(e.clusterBkg, 0.5)};
829
+ stroke: ${q(e.clusterBorder, 0.2)};
830
+ box-shadow: rgba(50, 50, 93, 0.25) 0px 13px 27px -5px, rgba(0, 0, 0, 0.3) 0px 8px 16px -8px;
831
+ stroke-width: 1px;
832
+ }
833
+
834
+ .cluster text {
835
+ fill: ${e.titleColor};
836
+ }
837
+
838
+ .cluster span,p {
839
+ color: ${e.titleColor};
840
+ }
841
+ /* .cluster div {
842
+ color: ${e.titleColor};
843
+ } */
844
+
845
+ div.mermaidTooltip {
846
+ position: absolute;
847
+ text-align: center;
848
+ max-width: 200px;
849
+ padding: 2px;
850
+ font-family: ${e.fontFamily};
851
+ font-size: 12px;
852
+ background: ${e.tertiaryColor};
853
+ border: 1px solid ${e.border2};
854
+ border-radius: 2px;
855
+ pointer-events: none;
856
+ z-index: 100;
857
+ }
858
+
859
+ .flowchartTitleText {
860
+ text-anchor: middle;
861
+ font-size: 18px;
862
+ fill: ${e.textColor};
863
+ }
864
+ `, lt = at;
865
+ function be(e, a, d = !1) {
866
+ var c, n, g;
867
+ const l = e;
868
+ let f = "default";
869
+ (((c = l?.classes) == null ? void 0 : c.length) || 0) > 0 && (f = (l?.classes || []).join(" ")), f = f + " flowchart-label";
870
+ let b = 0, p = "", x;
871
+ switch (l.type) {
872
+ case "round":
873
+ b = 5, p = "rect";
874
+ break;
875
+ case "composite":
876
+ b = 0, p = "composite", x = 0;
877
+ break;
878
+ case "square":
879
+ p = "rect";
880
+ break;
881
+ case "diamond":
882
+ p = "question";
883
+ break;
884
+ case "hexagon":
885
+ p = "hexagon";
886
+ break;
887
+ case "block_arrow":
888
+ p = "block_arrow";
889
+ break;
890
+ case "odd":
891
+ p = "rect_left_inv_arrow";
892
+ break;
893
+ case "lean_right":
894
+ p = "lean_right";
895
+ break;
896
+ case "lean_left":
897
+ p = "lean_left";
898
+ break;
899
+ case "trapezoid":
900
+ p = "trapezoid";
901
+ break;
902
+ case "inv_trapezoid":
903
+ p = "inv_trapezoid";
904
+ break;
905
+ case "rect_left_inv_arrow":
906
+ p = "rect_left_inv_arrow";
907
+ break;
908
+ case "circle":
909
+ p = "circle";
910
+ break;
911
+ case "ellipse":
912
+ p = "ellipse";
913
+ break;
914
+ case "stadium":
915
+ p = "stadium";
916
+ break;
917
+ case "subroutine":
918
+ p = "subroutine";
919
+ break;
920
+ case "cylinder":
921
+ p = "cylinder";
922
+ break;
923
+ case "group":
924
+ p = "rect";
925
+ break;
926
+ case "doublecircle":
927
+ p = "doublecircle";
928
+ break;
929
+ default:
930
+ p = "rect";
931
+ }
932
+ const y = ve(l?.styles || []), T = l.label, v = l.size || { width: 0, height: 0, x: 0, y: 0 };
933
+ return {
934
+ labelStyle: y.labelStyle,
935
+ shape: p,
936
+ labelText: T,
937
+ rx: b,
938
+ ry: b,
939
+ class: f,
940
+ style: y.style,
941
+ id: l.id,
942
+ directions: l.directions,
943
+ width: v.width,
944
+ height: v.height,
945
+ x: v.x,
946
+ y: v.y,
947
+ positioned: d,
948
+ intersect: void 0,
949
+ type: l.type,
950
+ padding: x ?? (((g = (n = se()) == null ? void 0 : n.block) == null ? void 0 : g.padding) || 0)
951
+ };
952
+ }
953
+ async function ot(e, a, d) {
954
+ const c = be(a, d, !1);
955
+ if (c.type === "group")
956
+ return;
957
+ const n = await ge(e, c), g = n.node().getBBox(), l = d.getBlock(c.id);
958
+ l.size = { width: g.width, height: g.height, x: 0, y: 0, node: n }, d.setBlock(l), n.remove();
959
+ }
960
+ async function ct(e, a, d) {
961
+ const c = be(a, d, !0);
962
+ d.getBlock(c.id).type !== "space" && (await ge(e, c), a.intersect = c?.intersect, ze(c));
963
+ }
964
+ async function ne(e, a, d, c) {
965
+ for (const n of a)
966
+ await c(e, n, d), n.children && await ne(e, n.children, d, c);
967
+ }
968
+ async function ut(e, a, d) {
969
+ await ne(e, a, d, ot);
970
+ }
971
+ async function dt(e, a, d) {
972
+ await ne(e, a, d, ct);
973
+ }
974
+ async function ht(e, a, d, c, n) {
975
+ const g = new Ce({
976
+ multigraph: !0,
977
+ compound: !0
978
+ });
979
+ g.setGraph({
980
+ rankdir: "TB",
981
+ nodesep: 10,
982
+ ranksep: 10,
983
+ marginx: 8,
984
+ marginy: 8
985
+ });
986
+ for (const l of d)
987
+ l.size && g.setNode(l.id, {
988
+ width: l.size.width,
989
+ height: l.size.height,
990
+ intersect: l.intersect
991
+ });
992
+ for (const l of a)
993
+ if (l.start && l.end) {
994
+ const f = c.getBlock(l.start), b = c.getBlock(l.end);
995
+ if (f?.size && b?.size) {
996
+ const p = f.size, x = b.size, y = [
997
+ { x: p.x, y: p.y },
998
+ { x: p.x + (x.x - p.x) / 2, y: p.y + (x.y - p.y) / 2 },
999
+ { x: x.x, y: x.y }
1000
+ ];
1001
+ await Ie(
1002
+ e,
1003
+ { v: l.start, w: l.end, name: l.id },
1004
+ {
1005
+ ...l,
1006
+ arrowTypeEnd: l.arrowTypeEnd,
1007
+ arrowTypeStart: l.arrowTypeStart,
1008
+ points: y,
1009
+ classes: "edge-thickness-normal edge-pattern-solid flowchart-link LS-a1 LE-b1"
1010
+ },
1011
+ void 0,
1012
+ "block",
1013
+ g,
1014
+ n
1015
+ ), l.label && (await Oe(e, {
1016
+ ...l,
1017
+ label: l.label,
1018
+ labelStyle: "stroke: #333; stroke-width: 1.5px;fill:none;",
1019
+ arrowTypeEnd: l.arrowTypeEnd,
1020
+ arrowTypeStart: l.arrowTypeStart
1021
+ }), await Te(
1022
+ { ...l, x: y[1].x, y: y[1].y },
1023
+ {
1024
+ originalPath: y
1025
+ }
1026
+ ));
1027
+ }
1028
+ }
1029
+ }
1030
+ const _ = ((oe = (le = he()) == null ? void 0 : le.block) == null ? void 0 : oe.padding) || 8;
1031
+ function gt(e, a) {
1032
+ if (e === 0 || !Number.isInteger(e))
1033
+ throw new Error("Columns must be an integer !== 0.");
1034
+ if (a < 0 || !Number.isInteger(a))
1035
+ throw new Error("Position must be a non-negative integer." + a);
1036
+ if (e < 0)
1037
+ return { px: a, py: 0 };
1038
+ if (e === 1)
1039
+ return { px: 0, py: a };
1040
+ const d = a % e, c = Math.floor(a / e);
1041
+ return { px: d, py: c };
1042
+ }
1043
+ const pt = (e) => {
1044
+ let a = 0, d = 0;
1045
+ for (const c of e.children) {
1046
+ const { width: n, height: g, x: l, y: f } = c.size || { width: 0, height: 0, x: 0, y: 0 };
1047
+ S.debug(
1048
+ "getMaxChildSize abc95 child:",
1049
+ c.id,
1050
+ "width:",
1051
+ n,
1052
+ "height:",
1053
+ g,
1054
+ "x:",
1055
+ l,
1056
+ "y:",
1057
+ f,
1058
+ c.type
1059
+ ), c.type !== "space" && (n > a && (a = n / (e.widthInColumns || 1)), g > d && (d = g));
1060
+ }
1061
+ return { width: a, height: d };
1062
+ };
1063
+ function te(e, a, d = 0, c = 0) {
1064
+ var n, g, l, f, b, p, x, y, T, v, N;
1065
+ S.debug(
1066
+ "setBlockSizes abc95 (start)",
1067
+ e.id,
1068
+ (n = e?.size) == null ? void 0 : n.x,
1069
+ "block width =",
1070
+ e?.size,
1071
+ "sieblingWidth",
1072
+ d
1073
+ ), (g = e?.size) != null && g.width || (e.size = {
1074
+ width: d,
1075
+ height: c,
1076
+ x: 0,
1077
+ y: 0
1078
+ });
1079
+ let E = 0, L = 0;
1080
+ if (((l = e.children) == null ? void 0 : l.length) > 0) {
1081
+ for (const h of e.children)
1082
+ te(h, a);
1083
+ const A = pt(e);
1084
+ E = A.width, L = A.height, S.debug("setBlockSizes abc95 maxWidth of", e.id, ":s children is ", E, L);
1085
+ for (const h of e.children)
1086
+ h.size && (S.debug(
1087
+ `abc95 Setting size of children of ${e.id} id=${h.id} ${E} ${L} ${h.size}`
1088
+ ), h.size.width = E * (h.widthInColumns || 1) + _ * ((h.widthInColumns || 1) - 1), h.size.height = L, h.size.x = 0, h.size.y = 0, S.debug(
1089
+ `abc95 updating size of ${e.id} children child:${h.id} maxWidth:${E} maxHeight:${L}`
1090
+ ));
1091
+ for (const h of e.children)
1092
+ te(h, a, E, L);
1093
+ const k = e.columns || -1;
1094
+ let D = 0;
1095
+ for (const h of e.children)
1096
+ D += h.widthInColumns || 1;
1097
+ let o = e.children.length;
1098
+ k > 0 && k < D && (o = k), e.widthInColumns;
1099
+ const s = Math.ceil(D / o);
1100
+ let i = o * (E + _) + _, u = s * (L + _) + _;
1101
+ if (i < d) {
1102
+ S.debug(
1103
+ `Detected to small siebling: abc95 ${e.id} sieblingWidth ${d} sieblingHeight ${c} width ${i}`
1104
+ ), i = d, u = c;
1105
+ const h = (d - o * _ - _) / o, t = (c - s * _ - _) / s;
1106
+ S.debug("Size indata abc88", e.id, "childWidth", h, "maxWidth", E), S.debug("Size indata abc88", e.id, "childHeight", t, "maxHeight", L), S.debug("Size indata abc88 xSize", o, "padding", _);
1107
+ for (const m of e.children)
1108
+ m.size && (m.size.width = h, m.size.height = t, m.size.x = 0, m.size.y = 0);
1109
+ }
1110
+ if (S.debug(
1111
+ `abc95 (finale calc) ${e.id} xSize ${o} ySize ${s} columns ${k}${e.children.length} width=${Math.max(i, ((f = e.size) == null ? void 0 : f.width) || 0)}`
1112
+ ), i < (((b = e?.size) == null ? void 0 : b.width) || 0)) {
1113
+ i = ((p = e?.size) == null ? void 0 : p.width) || 0;
1114
+ const h = k > 0 ? Math.min(e.children.length, k) : e.children.length;
1115
+ if (h > 0) {
1116
+ const t = (i - h * _ - _) / h;
1117
+ S.debug("abc95 (growing to fit) width", e.id, i, (x = e.size) == null ? void 0 : x.width, t);
1118
+ for (const m of e.children)
1119
+ m.size && (m.size.width = t);
1120
+ }
1121
+ }
1122
+ e.size = {
1123
+ width: i,
1124
+ height: u,
1125
+ x: 0,
1126
+ y: 0
1127
+ };
1128
+ }
1129
+ S.debug(
1130
+ "setBlockSizes abc94 (done)",
1131
+ e.id,
1132
+ (y = e?.size) == null ? void 0 : y.x,
1133
+ (T = e?.size) == null ? void 0 : T.width,
1134
+ (v = e?.size) == null ? void 0 : v.y,
1135
+ (N = e?.size) == null ? void 0 : N.height
1136
+ );
1137
+ }
1138
+ function xe(e, a) {
1139
+ var d, c, n, g, l, f, b, p, x, y, T, v, N, E, L, A, k;
1140
+ S.debug(
1141
+ `abc85 layout blocks (=>layoutBlocks) ${e.id} x: ${(d = e?.size) == null ? void 0 : d.x} y: ${(c = e?.size) == null ? void 0 : c.y} width: ${(n = e?.size) == null ? void 0 : n.width}`
1142
+ );
1143
+ const D = e.columns || -1;
1144
+ if (S.debug("layoutBlocks columns abc95", e.id, "=>", D, e), e.children && // find max width of children
1145
+ e.children.length > 0) {
1146
+ const o = ((l = (g = e?.children[0]) == null ? void 0 : g.size) == null ? void 0 : l.width) || 0, s = e.children.length * o + (e.children.length - 1) * _;
1147
+ S.debug("widthOfChildren 88", s, "posX");
1148
+ let i = 0;
1149
+ S.debug("abc91 block?.size?.x", e.id, (f = e?.size) == null ? void 0 : f.x);
1150
+ let u = (b = e?.size) != null && b.x ? ((p = e?.size) == null ? void 0 : p.x) + (-((x = e?.size) == null ? void 0 : x.width) / 2 || 0) : -_, h = 0;
1151
+ for (const t of e.children) {
1152
+ const m = e;
1153
+ if (!t.size)
1154
+ continue;
1155
+ const { width: r, height: R } = t.size, { px: Y, py: F } = gt(D, i);
1156
+ if (F != h && (h = F, u = (y = e?.size) != null && y.x ? ((T = e?.size) == null ? void 0 : T.x) + (-((v = e?.size) == null ? void 0 : v.width) / 2 || 0) : -_, S.debug("New row in layout for block", e.id, " and child ", t.id, h)), S.debug(
1157
+ `abc89 layout blocks (child) id: ${t.id} Pos: ${i} (px, py) ${Y},${F} (${(N = m?.size) == null ? void 0 : N.x},${(E = m?.size) == null ? void 0 : E.y}) parent: ${m.id} width: ${r}${_}`
1158
+ ), m.size) {
1159
+ const C = r / 2;
1160
+ t.size.x = u + _ + C, S.debug(
1161
+ `abc91 layout blocks (calc) px, pyid:${t.id} startingPos=X${u} new startingPosX${t.size.x} ${C} padding=${_} width=${r} halfWidth=${C} => x:${t.size.x} y:${t.size.y} ${t.widthInColumns} (width * (child?.w || 1)) / 2 ${r * (t?.widthInColumns || 1) / 2}`
1162
+ ), u = t.size.x + C, t.size.y = m.size.y - m.size.height / 2 + F * (R + _) + R / 2 + _, S.debug(
1163
+ `abc88 layout blocks (calc) px, pyid:${t.id}startingPosX${u}${_}${C}=>x:${t.size.x}y:${t.size.y}${t.widthInColumns}(width * (child?.w || 1)) / 2${r * (t?.widthInColumns || 1) / 2}`
1164
+ );
1165
+ }
1166
+ t.children && xe(t), i += t?.widthInColumns || 1, S.debug("abc88 columnsPos", t, i);
1167
+ }
1168
+ }
1169
+ S.debug(
1170
+ `layout blocks (<==layoutBlocks) ${e.id} x: ${(L = e?.size) == null ? void 0 : L.x} y: ${(A = e?.size) == null ? void 0 : A.y} width: ${(k = e?.size) == null ? void 0 : k.width}`
1171
+ );
1172
+ }
1173
+ function Se(e, { minX: a, minY: d, maxX: c, maxY: n } = { minX: 0, minY: 0, maxX: 0, maxY: 0 }) {
1174
+ if (e.size && e.id !== "root") {
1175
+ const { x: g, y: l, width: f, height: b } = e.size;
1176
+ g - f / 2 < a && (a = g - f / 2), l - b / 2 < d && (d = l - b / 2), g + f / 2 > c && (c = g + f / 2), l + b / 2 > n && (n = l + b / 2);
1177
+ }
1178
+ if (e.children)
1179
+ for (const g of e.children)
1180
+ ({ minX: a, minY: d, maxX: c, maxY: n } = Se(g, { minX: a, minY: d, maxX: c, maxY: n }));
1181
+ return { minX: a, minY: d, maxX: c, maxY: n };
1182
+ }
1183
+ function ft(e) {
1184
+ const a = e.getBlock("root");
1185
+ if (!a)
1186
+ return;
1187
+ te(a, e, 0, 0), xe(a), S.debug("getBlocks", JSON.stringify(a, null, 2));
1188
+ const { minX: d, minY: c, maxX: n, maxY: g } = Se(a), l = g - c, f = n - d;
1189
+ return { x: d, y: c, width: f, height: l };
1190
+ }
1191
+ const bt = function(e, a) {
1192
+ return a.db.getClasses();
1193
+ }, xt = async function(e, a, d, c) {
1194
+ const { securityLevel: n, block: g } = se(), l = c.db;
1195
+ let f;
1196
+ n === "sandbox" && (f = H("#i" + a));
1197
+ const b = n === "sandbox" ? H(f.nodes()[0].contentDocument.body) : H("body"), p = n === "sandbox" ? b.select(`[id="${a}"]`) : H(`[id="${a}"]`);
1198
+ ke(p, ["point", "circle", "cross"], c.type, a);
1199
+ const y = l.getBlocks(), T = l.getBlocksFlat(), v = l.getEdges(), N = p.insert("g").attr("class", "block");
1200
+ await ut(N, y, l);
1201
+ const E = ft(l);
1202
+ if (await dt(N, y, l), await ht(N, v, T, l, a), E) {
1203
+ const L = E, A = Math.max(1, Math.round(0.125 * (L.width / L.height))), k = L.height + A + 10, D = L.width + 10, { useMaxWidth: o } = g;
1204
+ Ee(p, k, D, !!o), S.debug("Here Bounds", E, L), p.attr(
1205
+ "viewBox",
1206
+ `${L.x - 5} ${L.y - 5} ${L.width + 10} ${L.height + 10}`
1207
+ );
1208
+ }
1209
+ Re(Be);
1210
+ }, St = {
1211
+ draw: xt,
1212
+ getClasses: bt
1213
+ }, vt = {
1214
+ parser: Pe,
1215
+ db: nt,
1216
+ renderer: St,
1217
+ styles: lt
1218
+ };
1219
+ export {
1220
+ vt as diagram
1221
+ };