@ucap-llm/ai-ui 1.1.6 → 1.1.7

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 (55) hide show
  1. package/_basePickBy-7d00d05e.mjs +153 -0
  2. package/_baseUniq-1876be04.mjs +440 -0
  3. package/ai-ui.es.js +11 -78207
  4. package/ai-ui.umd.js +2701 -143
  5. package/arc-bb1e7b28.mjs +85 -0
  6. package/architecture-4AB2E3PP-26f07d27.mjs +10 -0
  7. package/architectureDiagram-IEHRJDOE-535e4958.mjs +4640 -0
  8. package/blockDiagram-JOT3LUYC-e5536854.mjs +2251 -0
  9. package/c4Diagram-VJAJSXHY-311741c3.mjs +1583 -0
  10. package/channel-5d097975.mjs +5 -0
  11. package/chunk-4BMEZGHF-55420838.mjs +9 -0
  12. package/chunk-A2AXSNBT-5f9de039.mjs +1373 -0
  13. package/chunk-AEK57VVT-bd6e836f.mjs +1416 -0
  14. package/chunk-D6G4REZN-69cf348a.mjs +64 -0
  15. package/chunk-RZ5BOZE2-ebe3985e.mjs +24 -0
  16. package/chunk-XZIHB7SX-ed9a9d65.mjs +15 -0
  17. package/classDiagram-GIVACNV2-4d61f06d.mjs +18 -0
  18. package/classDiagram-v2-COTLJTTW-4d61f06d.mjs +18 -0
  19. package/clone-44064c55.mjs +8 -0
  20. package/cytoscape.esm-bb479f88.mjs +18232 -0
  21. package/dagre-OKDRZEBW-0574359b.mjs +448 -0
  22. package/diagram-SSKATNLV-f4dd04b2.mjs +225 -0
  23. package/diagram-VNBRO52H-f77f925a.mjs +130 -0
  24. package/erDiagram-Q7BY3M3F-8213684f.mjs +843 -0
  25. package/flowDiagram-4HSFHLVR-1decdff6.mjs +1624 -0
  26. package/ganttDiagram-APWFNJXF-461381a5.mjs +2521 -0
  27. package/gitGraph-O2Q2CXLX-d961db16.mjs +10 -0
  28. package/gitGraphDiagram-7IBYFJ6S-be6c39c3.mjs +716 -0
  29. package/graph-7ba79f74.mjs +249 -0
  30. package/index-f5aac161.mjs +93487 -0
  31. package/info-4N47QTOZ-615527c9.mjs +10 -0
  32. package/infoDiagram-PH2N3AL5-064df479.mjs +26 -0
  33. package/init-f9637058.mjs +16 -0
  34. package/journeyDiagram-U35MCT3I-94c54b39.mjs +811 -0
  35. package/kanban-definition-NDS4AKOZ-58a05db1.mjs +720 -0
  36. package/katex-2e45926a.mjs +11700 -0
  37. package/layout-c953b0e7.mjs +1344 -0
  38. package/linear-3c81794f.mjs +447 -0
  39. package/mermaid-parser.core-7afd2b2f.mjs +12845 -0
  40. package/mindmap-definition-ALO5MXBD-60e68e28.mjs +3222 -0
  41. package/ordinal-980380c7.mjs +65 -0
  42. package/package.json +1 -1
  43. package/packet-KVYON367-4b5a305e.mjs +10 -0
  44. package/pie-R6RNRRYF-0f27d16d.mjs +10 -0
  45. package/pieDiagram-IB7DONF6-66cebf11.mjs +167 -0
  46. package/quadrantDiagram-7GDLP6J5-f2cbfc79.mjs +1027 -0
  47. package/radar-MK3ICKWK-9e1913d7.mjs +10 -0
  48. package/requirementDiagram-KVF5MWMF-36d316c2.mjs +853 -0
  49. package/sankeyDiagram-QLVOVGJD-76245efb.mjs +826 -0
  50. package/sequenceDiagram-X6HHIX6F-a0ec0021.mjs +2283 -0
  51. package/stateDiagram-DGXRK772-e6387816.mjs +274 -0
  52. package/stateDiagram-v2-YXO3MK2T-f011ada4.mjs +18 -0
  53. package/style.css +1 -1
  54. package/timeline-definition-BDJGKUSR-a62514a7.mjs +806 -0
  55. package/xychartDiagram-VJFVF3MP-1b807048.mjs +1306 -0
@@ -0,0 +1,2251 @@
1
+ import { _ as d, d as z, l as L, j as R, ah as de, E as at, ai as Z, aj as Yt, ak as ge, u as tt, al as ue, Q as pe, k as fe, t as xe, A as ye, R as be, am as we, an as xt, e as me, i as Tt } from "./index-f5aac161.mjs";
2
+ import { c as Le } from "./clone-44064c55.mjs";
3
+ import { G as Se } from "./graph-7ba79f74.mjs";
4
+ import { c as ve } from "./channel-5d097975.mjs";
5
+ import "vue";
6
+ import "./_baseUniq-1876be04.mjs";
7
+ var yt = function() {
8
+ var e = /* @__PURE__ */ d(function(N, x, g, u) {
9
+ for (g = g || {}, u = N.length; u--; g[N[u]] = x)
10
+ ;
11
+ return g;
12
+ }, "o"), t = [1, 7], r = [1, 13], n = [1, 14], i = [1, 15], a = [1, 19], s = [1, 16], l = [1, 17], o = [1, 18], f = [8, 30], h = [8, 21, 28, 29, 30, 31, 32, 40, 44, 47], y = [1, 23], b = [1, 24], m = [8, 15, 16, 21, 28, 29, 30, 31, 32, 40, 44, 47], E = [8, 15, 16, 21, 27, 28, 29, 30, 31, 32, 40, 44, 47], D = [1, 49], v = {
13
+ trace: /* @__PURE__ */ d(function() {
14
+ }, "trace"),
15
+ yy: {},
16
+ 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 },
17
+ 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" },
18
+ 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]],
19
+ performAction: /* @__PURE__ */ d(function(x, g, u, w, S, c, _) {
20
+ var p = c.length - 1;
21
+ switch (S) {
22
+ case 4:
23
+ w.getLogger().debug("Rule: separator (NL) ");
24
+ break;
25
+ case 5:
26
+ w.getLogger().debug("Rule: separator (Space) ");
27
+ break;
28
+ case 6:
29
+ w.getLogger().debug("Rule: separator (EOF) ");
30
+ break;
31
+ case 7:
32
+ w.getLogger().debug("Rule: hierarchy: ", c[p - 1]), w.setHierarchy(c[p - 1]);
33
+ break;
34
+ case 8:
35
+ w.getLogger().debug("Stop NL ");
36
+ break;
37
+ case 9:
38
+ w.getLogger().debug("Stop EOF ");
39
+ break;
40
+ case 10:
41
+ w.getLogger().debug("Stop NL2 ");
42
+ break;
43
+ case 11:
44
+ w.getLogger().debug("Stop EOF2 ");
45
+ break;
46
+ case 12:
47
+ w.getLogger().debug("Rule: statement: ", c[p]), typeof c[p].length == "number" ? this.$ = c[p] : this.$ = [c[p]];
48
+ break;
49
+ case 13:
50
+ w.getLogger().debug("Rule: statement #2: ", c[p - 1]), this.$ = [c[p - 1]].concat(c[p]);
51
+ break;
52
+ case 14:
53
+ w.getLogger().debug("Rule: link: ", c[p], x), this.$ = { edgeTypeStr: c[p], label: "" };
54
+ break;
55
+ case 15:
56
+ w.getLogger().debug("Rule: LABEL link: ", c[p - 3], c[p - 1], c[p]), this.$ = { edgeTypeStr: c[p], label: c[p - 1] };
57
+ break;
58
+ case 18:
59
+ const A = parseInt(c[p]), O = w.generateId();
60
+ this.$ = { id: O, type: "space", label: "", width: A, children: [] };
61
+ break;
62
+ case 23:
63
+ w.getLogger().debug("Rule: (nodeStatement link node) ", c[p - 2], c[p - 1], c[p], " typestr: ", c[p - 1].edgeTypeStr);
64
+ const X = w.edgeStrToEdgeData(c[p - 1].edgeTypeStr);
65
+ this.$ = [
66
+ { id: c[p - 2].id, label: c[p - 2].label, type: c[p - 2].type, directions: c[p - 2].directions },
67
+ { id: c[p - 2].id + "-" + c[p].id, start: c[p - 2].id, end: c[p].id, label: c[p - 1].label, type: "edge", directions: c[p].directions, arrowTypeEnd: X, arrowTypeStart: "arrow_open" },
68
+ { id: c[p].id, label: c[p].label, type: w.typeStr2Type(c[p].typeStr), directions: c[p].directions }
69
+ ];
70
+ break;
71
+ case 24:
72
+ w.getLogger().debug("Rule: nodeStatement (abc88 node size) ", c[p - 1], c[p]), this.$ = { id: c[p - 1].id, label: c[p - 1].label, type: w.typeStr2Type(c[p - 1].typeStr), directions: c[p - 1].directions, widthInColumns: parseInt(c[p], 10) };
73
+ break;
74
+ case 25:
75
+ w.getLogger().debug("Rule: nodeStatement (node) ", c[p]), this.$ = { id: c[p].id, label: c[p].label, type: w.typeStr2Type(c[p].typeStr), directions: c[p].directions, widthInColumns: 1 };
76
+ break;
77
+ case 26:
78
+ w.getLogger().debug("APA123", this ? this : "na"), w.getLogger().debug("COLUMNS: ", c[p]), this.$ = { type: "column-setting", columns: c[p] === "auto" ? -1 : parseInt(c[p]) };
79
+ break;
80
+ case 27:
81
+ w.getLogger().debug("Rule: id-block statement : ", c[p - 2], c[p - 1]), w.generateId(), this.$ = { ...c[p - 2], type: "composite", children: c[p - 1] };
82
+ break;
83
+ case 28:
84
+ w.getLogger().debug("Rule: blockStatement : ", c[p - 2], c[p - 1], c[p]);
85
+ const W = w.generateId();
86
+ this.$ = { id: W, type: "composite", label: "", children: c[p - 1] };
87
+ break;
88
+ case 29:
89
+ w.getLogger().debug("Rule: node (NODE_ID separator): ", c[p]), this.$ = { id: c[p] };
90
+ break;
91
+ case 30:
92
+ w.getLogger().debug("Rule: node (NODE_ID nodeShapeNLabel separator): ", c[p - 1], c[p]), this.$ = { id: c[p - 1], label: c[p].label, typeStr: c[p].typeStr, directions: c[p].directions };
93
+ break;
94
+ case 31:
95
+ w.getLogger().debug("Rule: dirList: ", c[p]), this.$ = [c[p]];
96
+ break;
97
+ case 32:
98
+ w.getLogger().debug("Rule: dirList: ", c[p - 1], c[p]), this.$ = [c[p - 1]].concat(c[p]);
99
+ break;
100
+ case 33:
101
+ w.getLogger().debug("Rule: nodeShapeNLabel: ", c[p - 2], c[p - 1], c[p]), this.$ = { typeStr: c[p - 2] + c[p], label: c[p - 1] };
102
+ break;
103
+ case 34:
104
+ w.getLogger().debug("Rule: BLOCK_ARROW nodeShapeNLabel: ", c[p - 3], c[p - 2], " #3:", c[p - 1], c[p]), this.$ = { typeStr: c[p - 3] + c[p], label: c[p - 2], directions: c[p - 1] };
105
+ break;
106
+ case 35:
107
+ case 36:
108
+ this.$ = { type: "classDef", id: c[p - 1].trim(), css: c[p].trim() };
109
+ break;
110
+ case 37:
111
+ this.$ = { type: "applyClass", id: c[p - 1].trim(), styleClass: c[p].trim() };
112
+ break;
113
+ case 38:
114
+ this.$ = { type: "applyStyles", id: c[p - 1].trim(), stylesStr: c[p].trim() };
115
+ break;
116
+ }
117
+ }, "anonymous"),
118
+ table: [{ 9: 1, 10: [1, 2] }, { 1: [3] }, { 11: 3, 13: 4, 19: 5, 20: 6, 21: t, 22: 8, 23: 9, 24: 10, 25: 11, 26: 12, 28: r, 29: n, 31: i, 32: a, 40: s, 44: l, 47: o }, { 8: [1, 20] }, e(f, [2, 12], { 13: 4, 19: 5, 20: 6, 22: 8, 23: 9, 24: 10, 25: 11, 26: 12, 11: 21, 21: t, 28: r, 29: n, 31: i, 32: a, 40: s, 44: l, 47: o }), e(h, [2, 16], { 14: 22, 15: y, 16: b }), e(h, [2, 17]), e(h, [2, 18]), e(h, [2, 19]), e(h, [2, 20]), e(h, [2, 21]), e(h, [2, 22]), e(m, [2, 25], { 27: [1, 25] }), e(h, [2, 26]), { 19: 26, 26: 12, 32: a }, { 11: 27, 13: 4, 19: 5, 20: 6, 21: t, 22: 8, 23: 9, 24: 10, 25: 11, 26: 12, 28: r, 29: n, 31: i, 32: a, 40: s, 44: l, 47: o }, { 41: [1, 28], 43: [1, 29] }, { 45: [1, 30] }, { 48: [1, 31] }, e(E, [2, 29], { 33: 32, 36: [1, 33], 38: [1, 34] }), { 1: [2, 7] }, e(f, [2, 13]), { 26: 35, 32: a }, { 32: [2, 14] }, { 17: [1, 36] }, e(m, [2, 24]), { 11: 37, 13: 4, 14: 22, 15: y, 16: b, 19: 5, 20: 6, 21: t, 22: 8, 23: 9, 24: 10, 25: 11, 26: 12, 28: r, 29: n, 31: i, 32: a, 40: s, 44: l, 47: o }, { 30: [1, 38] }, { 42: [1, 39] }, { 42: [1, 40] }, { 46: [1, 41] }, { 49: [1, 42] }, e(E, [2, 30]), { 18: [1, 43] }, { 18: [1, 44] }, e(m, [2, 23]), { 18: [1, 45] }, { 30: [1, 46] }, e(h, [2, 28]), e(h, [2, 35]), e(h, [2, 36]), e(h, [2, 37]), e(h, [2, 38]), { 37: [1, 47] }, { 34: 48, 35: D }, { 15: [1, 50] }, e(h, [2, 27]), e(E, [2, 33]), { 39: [1, 51] }, { 34: 52, 35: D, 39: [2, 31] }, { 32: [2, 15] }, e(E, [2, 34]), { 39: [2, 32] }],
119
+ defaultActions: { 20: [2, 7], 23: [2, 14], 50: [2, 15], 52: [2, 32] },
120
+ parseError: /* @__PURE__ */ d(function(x, g) {
121
+ if (g.recoverable)
122
+ this.trace(x);
123
+ else {
124
+ var u = new Error(x);
125
+ throw u.hash = g, u;
126
+ }
127
+ }, "parseError"),
128
+ parse: /* @__PURE__ */ d(function(x) {
129
+ var g = this, u = [0], w = [], S = [null], c = [], _ = this.table, p = "", A = 0, O = 0, X = 2, W = 1, ce = c.slice.call(arguments, 1), M = Object.create(this.lexer), J = { yy: {} };
130
+ for (var gt in this.yy)
131
+ Object.prototype.hasOwnProperty.call(this.yy, gt) && (J.yy[gt] = this.yy[gt]);
132
+ M.setInput(x, J.yy), J.yy.lexer = M, J.yy.parser = this, typeof M.yylloc > "u" && (M.yylloc = {});
133
+ var ut = M.yylloc;
134
+ c.push(ut);
135
+ var oe = M.options && M.options.ranges;
136
+ typeof J.yy.parseError == "function" ? this.parseError = J.yy.parseError : this.parseError = Object.getPrototypeOf(this).parseError;
137
+ function he(H) {
138
+ u.length = u.length - 2 * H, S.length = S.length - H, c.length = c.length - H;
139
+ }
140
+ d(he, "popStack");
141
+ function Dt() {
142
+ var H;
143
+ return H = w.pop() || M.lex() || W, typeof H != "number" && (H instanceof Array && (w = H, H = w.pop()), H = g.symbols_[H] || H), H;
144
+ }
145
+ d(Dt, "lex");
146
+ for (var Y, Q, U, pt, $ = {}, st, q, Nt, it; ; ) {
147
+ if (Q = u[u.length - 1], this.defaultActions[Q] ? U = this.defaultActions[Q] : ((Y === null || typeof Y > "u") && (Y = Dt()), U = _[Q] && _[Q][Y]), typeof U > "u" || !U.length || !U[0]) {
148
+ var ft = "";
149
+ it = [];
150
+ for (st in _[Q])
151
+ this.terminals_[st] && st > X && it.push("'" + this.terminals_[st] + "'");
152
+ M.showPosition ? ft = "Parse error on line " + (A + 1) + `:
153
+ ` + M.showPosition() + `
154
+ Expecting ` + it.join(", ") + ", got '" + (this.terminals_[Y] || Y) + "'" : ft = "Parse error on line " + (A + 1) + ": Unexpected " + (Y == W ? "end of input" : "'" + (this.terminals_[Y] || Y) + "'"), this.parseError(ft, {
155
+ text: M.match,
156
+ token: this.terminals_[Y] || Y,
157
+ line: M.yylineno,
158
+ loc: ut,
159
+ expected: it
160
+ });
161
+ }
162
+ if (U[0] instanceof Array && U.length > 1)
163
+ throw new Error("Parse Error: multiple actions possible at state: " + Q + ", token: " + Y);
164
+ switch (U[0]) {
165
+ case 1:
166
+ u.push(Y), S.push(M.yytext), c.push(M.yylloc), u.push(U[1]), Y = null, O = M.yyleng, p = M.yytext, A = M.yylineno, ut = M.yylloc;
167
+ break;
168
+ case 2:
169
+ if (q = this.productions_[U[1]][1], $.$ = S[S.length - q], $._$ = {
170
+ first_line: c[c.length - (q || 1)].first_line,
171
+ last_line: c[c.length - 1].last_line,
172
+ first_column: c[c.length - (q || 1)].first_column,
173
+ last_column: c[c.length - 1].last_column
174
+ }, oe && ($._$.range = [
175
+ c[c.length - (q || 1)].range[0],
176
+ c[c.length - 1].range[1]
177
+ ]), pt = this.performAction.apply($, [
178
+ p,
179
+ O,
180
+ A,
181
+ J.yy,
182
+ U[1],
183
+ S,
184
+ c
185
+ ].concat(ce)), typeof pt < "u")
186
+ return pt;
187
+ q && (u = u.slice(0, -1 * q * 2), S = S.slice(0, -1 * q), c = c.slice(0, -1 * q)), u.push(this.productions_[U[1]][0]), S.push($.$), c.push($._$), Nt = _[u[u.length - 2]][u[u.length - 1]], u.push(Nt);
188
+ break;
189
+ case 3:
190
+ return !0;
191
+ }
192
+ }
193
+ return !0;
194
+ }, "parse")
195
+ }, T = /* @__PURE__ */ function() {
196
+ var N = {
197
+ EOF: 1,
198
+ parseError: /* @__PURE__ */ d(function(g, u) {
199
+ if (this.yy.parser)
200
+ this.yy.parser.parseError(g, u);
201
+ else
202
+ throw new Error(g);
203
+ }, "parseError"),
204
+ // resets the lexer, sets new input
205
+ setInput: /* @__PURE__ */ d(function(x, g) {
206
+ return this.yy = g || this.yy || {}, this._input = x, this._more = this._backtrack = this.done = !1, this.yylineno = this.yyleng = 0, this.yytext = this.matched = this.match = "", this.conditionStack = ["INITIAL"], this.yylloc = {
207
+ first_line: 1,
208
+ first_column: 0,
209
+ last_line: 1,
210
+ last_column: 0
211
+ }, this.options.ranges && (this.yylloc.range = [0, 0]), this.offset = 0, this;
212
+ }, "setInput"),
213
+ // consumes and returns one char from the input
214
+ input: /* @__PURE__ */ d(function() {
215
+ var x = this._input[0];
216
+ this.yytext += x, this.yyleng++, this.offset++, this.match += x, this.matched += x;
217
+ var g = x.match(/(?:\r\n?|\n).*/g);
218
+ return g ? (this.yylineno++, this.yylloc.last_line++) : this.yylloc.last_column++, this.options.ranges && this.yylloc.range[1]++, this._input = this._input.slice(1), x;
219
+ }, "input"),
220
+ // unshifts one char (or a string) into the input
221
+ unput: /* @__PURE__ */ d(function(x) {
222
+ var g = x.length, u = x.split(/(?:\r\n?|\n)/g);
223
+ this._input = x + this._input, this.yytext = this.yytext.substr(0, this.yytext.length - g), this.offset -= g;
224
+ var w = this.match.split(/(?:\r\n?|\n)/g);
225
+ this.match = this.match.substr(0, this.match.length - 1), this.matched = this.matched.substr(0, this.matched.length - 1), u.length - 1 && (this.yylineno -= u.length - 1);
226
+ var S = this.yylloc.range;
227
+ return this.yylloc = {
228
+ first_line: this.yylloc.first_line,
229
+ last_line: this.yylineno + 1,
230
+ first_column: this.yylloc.first_column,
231
+ last_column: u ? (u.length === w.length ? this.yylloc.first_column : 0) + w[w.length - u.length].length - u[0].length : this.yylloc.first_column - g
232
+ }, this.options.ranges && (this.yylloc.range = [S[0], S[0] + this.yyleng - g]), this.yyleng = this.yytext.length, this;
233
+ }, "unput"),
234
+ // When called from action, caches matched text and appends it on next action
235
+ more: /* @__PURE__ */ d(function() {
236
+ return this._more = !0, this;
237
+ }, "more"),
238
+ // 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.
239
+ reject: /* @__PURE__ */ d(function() {
240
+ if (this.options.backtrack_lexer)
241
+ this._backtrack = !0;
242
+ else
243
+ 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).
244
+ ` + this.showPosition(), {
245
+ text: "",
246
+ token: null,
247
+ line: this.yylineno
248
+ });
249
+ return this;
250
+ }, "reject"),
251
+ // retain first n characters of the match
252
+ less: /* @__PURE__ */ d(function(x) {
253
+ this.unput(this.match.slice(x));
254
+ }, "less"),
255
+ // displays already matched input, i.e. for error messages
256
+ pastInput: /* @__PURE__ */ d(function() {
257
+ var x = this.matched.substr(0, this.matched.length - this.match.length);
258
+ return (x.length > 20 ? "..." : "") + x.substr(-20).replace(/\n/g, "");
259
+ }, "pastInput"),
260
+ // displays upcoming input, i.e. for error messages
261
+ upcomingInput: /* @__PURE__ */ d(function() {
262
+ var x = this.match;
263
+ return x.length < 20 && (x += this._input.substr(0, 20 - x.length)), (x.substr(0, 20) + (x.length > 20 ? "..." : "")).replace(/\n/g, "");
264
+ }, "upcomingInput"),
265
+ // displays the character position where the lexing error occurred, i.e. for error messages
266
+ showPosition: /* @__PURE__ */ d(function() {
267
+ var x = this.pastInput(), g = new Array(x.length + 1).join("-");
268
+ return x + this.upcomingInput() + `
269
+ ` + g + "^";
270
+ }, "showPosition"),
271
+ // test the lexed token: return FALSE when not a match, otherwise return token
272
+ test_match: /* @__PURE__ */ d(function(x, g) {
273
+ var u, w, S;
274
+ if (this.options.backtrack_lexer && (S = {
275
+ yylineno: this.yylineno,
276
+ yylloc: {
277
+ first_line: this.yylloc.first_line,
278
+ last_line: this.last_line,
279
+ first_column: this.yylloc.first_column,
280
+ last_column: this.yylloc.last_column
281
+ },
282
+ yytext: this.yytext,
283
+ match: this.match,
284
+ matches: this.matches,
285
+ matched: this.matched,
286
+ yyleng: this.yyleng,
287
+ offset: this.offset,
288
+ _more: this._more,
289
+ _input: this._input,
290
+ yy: this.yy,
291
+ conditionStack: this.conditionStack.slice(0),
292
+ done: this.done
293
+ }, this.options.ranges && (S.yylloc.range = this.yylloc.range.slice(0))), w = x[0].match(/(?:\r\n?|\n).*/g), w && (this.yylineno += w.length), this.yylloc = {
294
+ first_line: this.yylloc.last_line,
295
+ last_line: this.yylineno + 1,
296
+ first_column: this.yylloc.last_column,
297
+ last_column: w ? w[w.length - 1].length - w[w.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + x[0].length
298
+ }, this.yytext += x[0], this.match += x[0], this.matches = x, 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(x[0].length), this.matched += x[0], u = this.performAction.call(this, this.yy, this, g, this.conditionStack[this.conditionStack.length - 1]), this.done && this._input && (this.done = !1), u)
299
+ return u;
300
+ if (this._backtrack) {
301
+ for (var c in S)
302
+ this[c] = S[c];
303
+ return !1;
304
+ }
305
+ return !1;
306
+ }, "test_match"),
307
+ // return next match in input
308
+ next: /* @__PURE__ */ d(function() {
309
+ if (this.done)
310
+ return this.EOF;
311
+ this._input || (this.done = !0);
312
+ var x, g, u, w;
313
+ this._more || (this.yytext = "", this.match = "");
314
+ for (var S = this._currentRules(), c = 0; c < S.length; c++)
315
+ if (u = this._input.match(this.rules[S[c]]), u && (!g || u[0].length > g[0].length)) {
316
+ if (g = u, w = c, this.options.backtrack_lexer) {
317
+ if (x = this.test_match(u, S[c]), x !== !1)
318
+ return x;
319
+ if (this._backtrack) {
320
+ g = !1;
321
+ continue;
322
+ } else
323
+ return !1;
324
+ } else if (!this.options.flex)
325
+ break;
326
+ }
327
+ return g ? (x = this.test_match(g, S[w]), x !== !1 ? x : !1) : this._input === "" ? this.EOF : this.parseError("Lexical error on line " + (this.yylineno + 1) + `. Unrecognized text.
328
+ ` + this.showPosition(), {
329
+ text: "",
330
+ token: null,
331
+ line: this.yylineno
332
+ });
333
+ }, "next"),
334
+ // return next match that has a token
335
+ lex: /* @__PURE__ */ d(function() {
336
+ var g = this.next();
337
+ return g || this.lex();
338
+ }, "lex"),
339
+ // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
340
+ begin: /* @__PURE__ */ d(function(g) {
341
+ this.conditionStack.push(g);
342
+ }, "begin"),
343
+ // pop the previously active lexer condition state off the condition stack
344
+ popState: /* @__PURE__ */ d(function() {
345
+ var g = this.conditionStack.length - 1;
346
+ return g > 0 ? this.conditionStack.pop() : this.conditionStack[0];
347
+ }, "popState"),
348
+ // produce the lexer rule set which is active for the currently active lexer condition state
349
+ _currentRules: /* @__PURE__ */ d(function() {
350
+ return this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1] ? this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules : this.conditions.INITIAL.rules;
351
+ }, "_currentRules"),
352
+ // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
353
+ topState: /* @__PURE__ */ d(function(g) {
354
+ return g = this.conditionStack.length - 1 - Math.abs(g || 0), g >= 0 ? this.conditionStack[g] : "INITIAL";
355
+ }, "topState"),
356
+ // alias for begin(condition)
357
+ pushState: /* @__PURE__ */ d(function(g) {
358
+ this.begin(g);
359
+ }, "pushState"),
360
+ // return the number of states currently on the stack
361
+ stateStackSize: /* @__PURE__ */ d(function() {
362
+ return this.conditionStack.length;
363
+ }, "stateStackSize"),
364
+ options: {},
365
+ performAction: /* @__PURE__ */ d(function(g, u, w, S) {
366
+ switch (w) {
367
+ case 0:
368
+ return 10;
369
+ case 1:
370
+ return g.getLogger().debug("Found space-block"), 31;
371
+ case 2:
372
+ return g.getLogger().debug("Found nl-block"), 31;
373
+ case 3:
374
+ return g.getLogger().debug("Found space-block"), 29;
375
+ case 4:
376
+ g.getLogger().debug(".", u.yytext);
377
+ break;
378
+ case 5:
379
+ g.getLogger().debug("_", u.yytext);
380
+ break;
381
+ case 6:
382
+ return 5;
383
+ case 7:
384
+ return u.yytext = -1, 28;
385
+ case 8:
386
+ return u.yytext = u.yytext.replace(/columns\s+/, ""), g.getLogger().debug("COLUMNS (LEX)", u.yytext), 28;
387
+ case 9:
388
+ this.pushState("md_string");
389
+ break;
390
+ case 10:
391
+ return "MD_STR";
392
+ case 11:
393
+ this.popState();
394
+ break;
395
+ case 12:
396
+ this.pushState("string");
397
+ break;
398
+ case 13:
399
+ g.getLogger().debug("LEX: POPPING STR:", u.yytext), this.popState();
400
+ break;
401
+ case 14:
402
+ return g.getLogger().debug("LEX: STR end:", u.yytext), "STR";
403
+ case 15:
404
+ return u.yytext = u.yytext.replace(/space\:/, ""), g.getLogger().debug("SPACE NUM (LEX)", u.yytext), 21;
405
+ case 16:
406
+ return u.yytext = "1", g.getLogger().debug("COLUMNS (LEX)", u.yytext), 21;
407
+ case 17:
408
+ return 43;
409
+ case 18:
410
+ return "LINKSTYLE";
411
+ case 19:
412
+ return "INTERPOLATE";
413
+ case 20:
414
+ return this.pushState("CLASSDEF"), 40;
415
+ case 21:
416
+ return this.popState(), this.pushState("CLASSDEFID"), "DEFAULT_CLASSDEF_ID";
417
+ case 22:
418
+ return this.popState(), this.pushState("CLASSDEFID"), 41;
419
+ case 23:
420
+ return this.popState(), 42;
421
+ case 24:
422
+ return this.pushState("CLASS"), 44;
423
+ case 25:
424
+ return this.popState(), this.pushState("CLASS_STYLE"), 45;
425
+ case 26:
426
+ return this.popState(), 46;
427
+ case 27:
428
+ return this.pushState("STYLE_STMNT"), 47;
429
+ case 28:
430
+ return this.popState(), this.pushState("STYLE_DEFINITION"), 48;
431
+ case 29:
432
+ return this.popState(), 49;
433
+ case 30:
434
+ return this.pushState("acc_title"), "acc_title";
435
+ case 31:
436
+ return this.popState(), "acc_title_value";
437
+ case 32:
438
+ return this.pushState("acc_descr"), "acc_descr";
439
+ case 33:
440
+ return this.popState(), "acc_descr_value";
441
+ case 34:
442
+ this.pushState("acc_descr_multiline");
443
+ break;
444
+ case 35:
445
+ this.popState();
446
+ break;
447
+ case 36:
448
+ return "acc_descr_multiline_value";
449
+ case 37:
450
+ return 30;
451
+ case 38:
452
+ return this.popState(), g.getLogger().debug("Lex: (("), "NODE_DEND";
453
+ case 39:
454
+ return this.popState(), g.getLogger().debug("Lex: (("), "NODE_DEND";
455
+ case 40:
456
+ return this.popState(), g.getLogger().debug("Lex: ))"), "NODE_DEND";
457
+ case 41:
458
+ return this.popState(), g.getLogger().debug("Lex: (("), "NODE_DEND";
459
+ case 42:
460
+ return this.popState(), g.getLogger().debug("Lex: (("), "NODE_DEND";
461
+ case 43:
462
+ return this.popState(), g.getLogger().debug("Lex: (-"), "NODE_DEND";
463
+ case 44:
464
+ return this.popState(), g.getLogger().debug("Lex: -)"), "NODE_DEND";
465
+ case 45:
466
+ return this.popState(), g.getLogger().debug("Lex: (("), "NODE_DEND";
467
+ case 46:
468
+ return this.popState(), g.getLogger().debug("Lex: ]]"), "NODE_DEND";
469
+ case 47:
470
+ return this.popState(), g.getLogger().debug("Lex: ("), "NODE_DEND";
471
+ case 48:
472
+ return this.popState(), g.getLogger().debug("Lex: ])"), "NODE_DEND";
473
+ case 49:
474
+ return this.popState(), g.getLogger().debug("Lex: /]"), "NODE_DEND";
475
+ case 50:
476
+ return this.popState(), g.getLogger().debug("Lex: /]"), "NODE_DEND";
477
+ case 51:
478
+ return this.popState(), g.getLogger().debug("Lex: )]"), "NODE_DEND";
479
+ case 52:
480
+ return this.popState(), g.getLogger().debug("Lex: )"), "NODE_DEND";
481
+ case 53:
482
+ return this.popState(), g.getLogger().debug("Lex: ]>"), "NODE_DEND";
483
+ case 54:
484
+ return this.popState(), g.getLogger().debug("Lex: ]"), "NODE_DEND";
485
+ case 55:
486
+ return g.getLogger().debug("Lexa: -)"), this.pushState("NODE"), 36;
487
+ case 56:
488
+ return g.getLogger().debug("Lexa: (-"), this.pushState("NODE"), 36;
489
+ case 57:
490
+ return g.getLogger().debug("Lexa: ))"), this.pushState("NODE"), 36;
491
+ case 58:
492
+ return g.getLogger().debug("Lexa: )"), this.pushState("NODE"), 36;
493
+ case 59:
494
+ return g.getLogger().debug("Lex: ((("), this.pushState("NODE"), 36;
495
+ case 60:
496
+ return g.getLogger().debug("Lexa: )"), this.pushState("NODE"), 36;
497
+ case 61:
498
+ return g.getLogger().debug("Lexa: )"), this.pushState("NODE"), 36;
499
+ case 62:
500
+ return g.getLogger().debug("Lexa: )"), this.pushState("NODE"), 36;
501
+ case 63:
502
+ return g.getLogger().debug("Lexc: >"), this.pushState("NODE"), 36;
503
+ case 64:
504
+ return g.getLogger().debug("Lexa: (["), this.pushState("NODE"), 36;
505
+ case 65:
506
+ return g.getLogger().debug("Lexa: )"), this.pushState("NODE"), 36;
507
+ case 66:
508
+ return this.pushState("NODE"), 36;
509
+ case 67:
510
+ return this.pushState("NODE"), 36;
511
+ case 68:
512
+ return this.pushState("NODE"), 36;
513
+ case 69:
514
+ return this.pushState("NODE"), 36;
515
+ case 70:
516
+ return this.pushState("NODE"), 36;
517
+ case 71:
518
+ return this.pushState("NODE"), 36;
519
+ case 72:
520
+ return this.pushState("NODE"), 36;
521
+ case 73:
522
+ return g.getLogger().debug("Lexa: ["), this.pushState("NODE"), 36;
523
+ case 74:
524
+ return this.pushState("BLOCK_ARROW"), g.getLogger().debug("LEX ARR START"), 38;
525
+ case 75:
526
+ return g.getLogger().debug("Lex: NODE_ID", u.yytext), 32;
527
+ case 76:
528
+ return g.getLogger().debug("Lex: EOF", u.yytext), 8;
529
+ case 77:
530
+ this.pushState("md_string");
531
+ break;
532
+ case 78:
533
+ this.pushState("md_string");
534
+ break;
535
+ case 79:
536
+ return "NODE_DESCR";
537
+ case 80:
538
+ this.popState();
539
+ break;
540
+ case 81:
541
+ g.getLogger().debug("Lex: Starting string"), this.pushState("string");
542
+ break;
543
+ case 82:
544
+ g.getLogger().debug("LEX ARR: Starting string"), this.pushState("string");
545
+ break;
546
+ case 83:
547
+ return g.getLogger().debug("LEX: NODE_DESCR:", u.yytext), "NODE_DESCR";
548
+ case 84:
549
+ g.getLogger().debug("LEX POPPING"), this.popState();
550
+ break;
551
+ case 85:
552
+ g.getLogger().debug("Lex: =>BAE"), this.pushState("ARROW_DIR");
553
+ break;
554
+ case 86:
555
+ return u.yytext = u.yytext.replace(/^,\s*/, ""), g.getLogger().debug("Lex (right): dir:", u.yytext), "DIR";
556
+ case 87:
557
+ return u.yytext = u.yytext.replace(/^,\s*/, ""), g.getLogger().debug("Lex (left):", u.yytext), "DIR";
558
+ case 88:
559
+ return u.yytext = u.yytext.replace(/^,\s*/, ""), g.getLogger().debug("Lex (x):", u.yytext), "DIR";
560
+ case 89:
561
+ return u.yytext = u.yytext.replace(/^,\s*/, ""), g.getLogger().debug("Lex (y):", u.yytext), "DIR";
562
+ case 90:
563
+ return u.yytext = u.yytext.replace(/^,\s*/, ""), g.getLogger().debug("Lex (up):", u.yytext), "DIR";
564
+ case 91:
565
+ return u.yytext = u.yytext.replace(/^,\s*/, ""), g.getLogger().debug("Lex (down):", u.yytext), "DIR";
566
+ case 92:
567
+ return u.yytext = "]>", g.getLogger().debug("Lex (ARROW_DIR end):", u.yytext), this.popState(), this.popState(), "BLOCK_ARROW_END";
568
+ case 93:
569
+ return g.getLogger().debug("Lex: LINK", "#" + u.yytext + "#"), 15;
570
+ case 94:
571
+ return g.getLogger().debug("Lex: LINK", u.yytext), 15;
572
+ case 95:
573
+ return g.getLogger().debug("Lex: LINK", u.yytext), 15;
574
+ case 96:
575
+ return g.getLogger().debug("Lex: LINK", u.yytext), 15;
576
+ case 97:
577
+ return g.getLogger().debug("Lex: START_LINK", u.yytext), this.pushState("LLABEL"), 16;
578
+ case 98:
579
+ return g.getLogger().debug("Lex: START_LINK", u.yytext), this.pushState("LLABEL"), 16;
580
+ case 99:
581
+ return g.getLogger().debug("Lex: START_LINK", u.yytext), this.pushState("LLABEL"), 16;
582
+ case 100:
583
+ this.pushState("md_string");
584
+ break;
585
+ case 101:
586
+ return g.getLogger().debug("Lex: Starting string"), this.pushState("string"), "LINK_LABEL";
587
+ case 102:
588
+ return this.popState(), g.getLogger().debug("Lex: LINK", "#" + u.yytext + "#"), 15;
589
+ case 103:
590
+ return this.popState(), g.getLogger().debug("Lex: LINK", u.yytext), 15;
591
+ case 104:
592
+ return this.popState(), g.getLogger().debug("Lex: LINK", u.yytext), 15;
593
+ case 105:
594
+ return g.getLogger().debug("Lex: COLON", u.yytext), u.yytext = u.yytext.slice(1), 27;
595
+ }
596
+ }, "anonymous"),
597
+ 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+)/],
598
+ 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 } }
599
+ };
600
+ return N;
601
+ }();
602
+ v.lexer = T;
603
+ function k() {
604
+ this.yy = {};
605
+ }
606
+ return d(k, "Parser"), k.prototype = v, v.Parser = k, new k();
607
+ }();
608
+ yt.parser = yt;
609
+ var Ee = yt, V = /* @__PURE__ */ new Map(), St = [], bt = /* @__PURE__ */ new Map(), Ct = "color", Bt = "fill", _e = "bgFill", Ht = ",", ke = z(), ct = /* @__PURE__ */ new Map(), De = /* @__PURE__ */ d((e) => me.sanitizeText(e, ke), "sanitizeText"), Ne = /* @__PURE__ */ d(function(e, t = "") {
610
+ let r = ct.get(e);
611
+ r || (r = { id: e, styles: [], textStyles: [] }, ct.set(e, r)), t != null && t.split(Ht).forEach((n) => {
612
+ const i = n.replace(/([^;]*);/, "$1").trim();
613
+ if (RegExp(Ct).exec(n)) {
614
+ const s = i.replace(Bt, _e).replace(Ct, Bt);
615
+ r.textStyles.push(s);
616
+ }
617
+ r.styles.push(i);
618
+ });
619
+ }, "addStyleClass"), Te = /* @__PURE__ */ d(function(e, t = "") {
620
+ const r = V.get(e);
621
+ t != null && (r.styles = t.split(Ht));
622
+ }, "addStyle2Node"), Ce = /* @__PURE__ */ d(function(e, t) {
623
+ e.split(",").forEach(function(r) {
624
+ let n = V.get(r);
625
+ if (n === void 0) {
626
+ const i = r.trim();
627
+ n = { id: i, type: "na", children: [] }, V.set(i, n);
628
+ }
629
+ n.classes || (n.classes = []), n.classes.push(t);
630
+ });
631
+ }, "setCssClass"), Kt = /* @__PURE__ */ d((e, t) => {
632
+ const r = e.flat(), n = [];
633
+ for (const i of r) {
634
+ if (i.label && (i.label = De(i.label)), i.type === "classDef") {
635
+ Ne(i.id, i.css);
636
+ continue;
637
+ }
638
+ if (i.type === "applyClass") {
639
+ Ce(i.id, (i == null ? void 0 : i.styleClass) ?? "");
640
+ continue;
641
+ }
642
+ if (i.type === "applyStyles") {
643
+ i != null && i.stylesStr && Te(i.id, i == null ? void 0 : i.stylesStr);
644
+ continue;
645
+ }
646
+ if (i.type === "column-setting")
647
+ t.columns = i.columns ?? -1;
648
+ else if (i.type === "edge") {
649
+ const a = (bt.get(i.id) ?? 0) + 1;
650
+ bt.set(i.id, a), i.id = a + "-" + i.id, St.push(i);
651
+ } else {
652
+ i.label || (i.type === "composite" ? i.label = "" : i.label = i.id);
653
+ const a = V.get(i.id);
654
+ if (a === void 0 ? V.set(i.id, i) : (i.type !== "na" && (a.type = i.type), i.label !== i.id && (a.label = i.label)), i.children && Kt(i.children, i), i.type === "space") {
655
+ const s = i.width ?? 1;
656
+ for (let l = 0; l < s; l++) {
657
+ const o = Le(i);
658
+ o.id = o.id + "-" + l, V.set(o.id, o), n.push(o);
659
+ }
660
+ } else
661
+ a === void 0 && n.push(i);
662
+ }
663
+ }
664
+ t.children = n;
665
+ }, "populateBlockDatabase"), vt = [], rt = { id: "root", type: "composite", children: [], columns: -1 }, Be = /* @__PURE__ */ d(() => {
666
+ L.debug("Clear called"), xe(), rt = { id: "root", type: "composite", children: [], columns: -1 }, V = /* @__PURE__ */ new Map([["root", rt]]), vt = [], ct = /* @__PURE__ */ new Map(), St = [], bt = /* @__PURE__ */ new Map();
667
+ }, "clear");
668
+ function Xt(e) {
669
+ switch (L.debug("typeStr2Type", e), e) {
670
+ case "[]":
671
+ return "square";
672
+ case "()":
673
+ return L.debug("we have a round"), "round";
674
+ case "(())":
675
+ return "circle";
676
+ case ">]":
677
+ return "rect_left_inv_arrow";
678
+ case "{}":
679
+ return "diamond";
680
+ case "{{}}":
681
+ return "hexagon";
682
+ case "([])":
683
+ return "stadium";
684
+ case "[[]]":
685
+ return "subroutine";
686
+ case "[()]":
687
+ return "cylinder";
688
+ case "((()))":
689
+ return "doublecircle";
690
+ case "[//]":
691
+ return "lean_right";
692
+ case "[\\\\]":
693
+ return "lean_left";
694
+ case "[/\\]":
695
+ return "trapezoid";
696
+ case "[\\/]":
697
+ return "inv_trapezoid";
698
+ case "<[]>":
699
+ return "block_arrow";
700
+ default:
701
+ return "na";
702
+ }
703
+ }
704
+ d(Xt, "typeStr2Type");
705
+ function Ut(e) {
706
+ switch (L.debug("typeStr2Type", e), e) {
707
+ case "==":
708
+ return "thick";
709
+ default:
710
+ return "normal";
711
+ }
712
+ }
713
+ d(Ut, "edgeTypeStr2Type");
714
+ function jt(e) {
715
+ switch (e.trim()) {
716
+ case "--x":
717
+ return "arrow_cross";
718
+ case "--o":
719
+ return "arrow_circle";
720
+ default:
721
+ return "arrow_point";
722
+ }
723
+ }
724
+ d(jt, "edgeStrToEdgeData");
725
+ var It = 0, Ie = /* @__PURE__ */ d(() => (It++, "id-" + Math.random().toString(36).substr(2, 12) + "-" + It), "generateId"), Oe = /* @__PURE__ */ d((e) => {
726
+ rt.children = e, Kt(e, rt), vt = rt.children;
727
+ }, "setHierarchy"), Re = /* @__PURE__ */ d((e) => {
728
+ const t = V.get(e);
729
+ return t ? t.columns ? t.columns : t.children ? t.children.length : -1 : -1;
730
+ }, "getColumns"), ze = /* @__PURE__ */ d(() => [...V.values()], "getBlocksFlat"), Ae = /* @__PURE__ */ d(() => vt || [], "getBlocks"), Me = /* @__PURE__ */ d(() => St, "getEdges"), Fe = /* @__PURE__ */ d((e) => V.get(e), "getBlock"), We = /* @__PURE__ */ d((e) => {
731
+ V.set(e.id, e);
732
+ }, "setBlock"), Pe = /* @__PURE__ */ d(() => console, "getLogger"), Ye = /* @__PURE__ */ d(function() {
733
+ return ct;
734
+ }, "getClasses"), He = {
735
+ getConfig: /* @__PURE__ */ d(() => at().block, "getConfig"),
736
+ typeStr2Type: Xt,
737
+ edgeTypeStr2Type: Ut,
738
+ edgeStrToEdgeData: jt,
739
+ getLogger: Pe,
740
+ getBlocksFlat: ze,
741
+ getBlocks: Ae,
742
+ getEdges: Me,
743
+ setHierarchy: Oe,
744
+ getBlock: Fe,
745
+ setBlock: We,
746
+ getColumns: Re,
747
+ getClasses: Ye,
748
+ clear: Be,
749
+ generateId: Ie
750
+ }, Ke = He, nt = /* @__PURE__ */ d((e, t) => {
751
+ const r = ve, n = r(e, "r"), i = r(e, "g"), a = r(e, "b");
752
+ return ye(n, i, a, t);
753
+ }, "fade"), Xe = /* @__PURE__ */ d((e) => `.label {
754
+ font-family: ${e.fontFamily};
755
+ color: ${e.nodeTextColor || e.textColor};
756
+ }
757
+ .cluster-label text {
758
+ fill: ${e.titleColor};
759
+ }
760
+ .cluster-label span,p {
761
+ color: ${e.titleColor};
762
+ }
763
+
764
+
765
+
766
+ .label text,span,p {
767
+ fill: ${e.nodeTextColor || e.textColor};
768
+ color: ${e.nodeTextColor || e.textColor};
769
+ }
770
+
771
+ .node rect,
772
+ .node circle,
773
+ .node ellipse,
774
+ .node polygon,
775
+ .node path {
776
+ fill: ${e.mainBkg};
777
+ stroke: ${e.nodeBorder};
778
+ stroke-width: 1px;
779
+ }
780
+ .flowchart-label text {
781
+ text-anchor: middle;
782
+ }
783
+ // .flowchart-label .text-outer-tspan {
784
+ // text-anchor: middle;
785
+ // }
786
+ // .flowchart-label .text-inner-tspan {
787
+ // text-anchor: start;
788
+ // }
789
+
790
+ .node .label {
791
+ text-align: center;
792
+ }
793
+ .node.clickable {
794
+ cursor: pointer;
795
+ }
796
+
797
+ .arrowheadPath {
798
+ fill: ${e.arrowheadColor};
799
+ }
800
+
801
+ .edgePath .path {
802
+ stroke: ${e.lineColor};
803
+ stroke-width: 2.0px;
804
+ }
805
+
806
+ .flowchart-link {
807
+ stroke: ${e.lineColor};
808
+ fill: none;
809
+ }
810
+
811
+ .edgeLabel {
812
+ background-color: ${e.edgeLabelBackground};
813
+ rect {
814
+ opacity: 0.5;
815
+ background-color: ${e.edgeLabelBackground};
816
+ fill: ${e.edgeLabelBackground};
817
+ }
818
+ text-align: center;
819
+ }
820
+
821
+ /* For html labels only */
822
+ .labelBkg {
823
+ background-color: ${nt(e.edgeLabelBackground, 0.5)};
824
+ // background-color:
825
+ }
826
+
827
+ .node .cluster {
828
+ // fill: ${nt(e.mainBkg, 0.5)};
829
+ fill: ${nt(e.clusterBkg, 0.5)};
830
+ stroke: ${nt(e.clusterBorder, 0.2)};
831
+ box-shadow: rgba(50, 50, 93, 0.25) 0px 13px 27px -5px, rgba(0, 0, 0, 0.3) 0px 8px 16px -8px;
832
+ stroke-width: 1px;
833
+ }
834
+
835
+ .cluster text {
836
+ fill: ${e.titleColor};
837
+ }
838
+
839
+ .cluster span,p {
840
+ color: ${e.titleColor};
841
+ }
842
+ /* .cluster div {
843
+ color: ${e.titleColor};
844
+ } */
845
+
846
+ div.mermaidTooltip {
847
+ position: absolute;
848
+ text-align: center;
849
+ max-width: 200px;
850
+ padding: 2px;
851
+ font-family: ${e.fontFamily};
852
+ font-size: 12px;
853
+ background: ${e.tertiaryColor};
854
+ border: 1px solid ${e.border2};
855
+ border-radius: 2px;
856
+ pointer-events: none;
857
+ z-index: 100;
858
+ }
859
+
860
+ .flowchartTitleText {
861
+ text-anchor: middle;
862
+ font-size: 18px;
863
+ fill: ${e.textColor};
864
+ }
865
+ `, "getStyles"), Ue = Xe, je = /* @__PURE__ */ d((e, t, r, n) => {
866
+ t.forEach((i) => {
867
+ rr[i](e, r, n);
868
+ });
869
+ }, "insertMarkers"), Ve = /* @__PURE__ */ d((e, t, r) => {
870
+ L.trace("Making markers for ", r), e.append("defs").append("marker").attr("id", r + "_" + t + "-extensionStart").attr("class", "marker extension " + t).attr("refX", 18).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 1,7 L18,13 V 1 Z"), e.append("defs").append("marker").attr("id", r + "_" + t + "-extensionEnd").attr("class", "marker extension " + t).attr("refX", 1).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 1,1 V 13 L18,7 Z");
871
+ }, "extension"), Ge = /* @__PURE__ */ d((e, t, r) => {
872
+ e.append("defs").append("marker").attr("id", r + "_" + t + "-compositionStart").attr("class", "marker composition " + t).attr("refX", 18).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z"), e.append("defs").append("marker").attr("id", r + "_" + t + "-compositionEnd").attr("class", "marker composition " + t).attr("refX", 1).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z");
873
+ }, "composition"), Ze = /* @__PURE__ */ d((e, t, r) => {
874
+ e.append("defs").append("marker").attr("id", r + "_" + t + "-aggregationStart").attr("class", "marker aggregation " + t).attr("refX", 18).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z"), e.append("defs").append("marker").attr("id", r + "_" + t + "-aggregationEnd").attr("class", "marker aggregation " + t).attr("refX", 1).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z");
875
+ }, "aggregation"), qe = /* @__PURE__ */ d((e, t, r) => {
876
+ e.append("defs").append("marker").attr("id", r + "_" + t + "-dependencyStart").attr("class", "marker dependency " + t).attr("refX", 6).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 5,7 L9,13 L1,7 L9,1 Z"), e.append("defs").append("marker").attr("id", r + "_" + t + "-dependencyEnd").attr("class", "marker dependency " + t).attr("refX", 13).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L14,7 L9,1 Z");
877
+ }, "dependency"), Je = /* @__PURE__ */ d((e, t, r) => {
878
+ e.append("defs").append("marker").attr("id", r + "_" + t + "-lollipopStart").attr("class", "marker lollipop " + t).attr("refX", 13).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("circle").attr("stroke", "black").attr("fill", "transparent").attr("cx", 7).attr("cy", 7).attr("r", 6), e.append("defs").append("marker").attr("id", r + "_" + t + "-lollipopEnd").attr("class", "marker lollipop " + t).attr("refX", 1).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("circle").attr("stroke", "black").attr("fill", "transparent").attr("cx", 7).attr("cy", 7).attr("r", 6);
879
+ }, "lollipop"), Qe = /* @__PURE__ */ d((e, t, r) => {
880
+ e.append("marker").attr("id", r + "_" + t + "-pointEnd").attr("class", "marker " + t).attr("viewBox", "0 0 10 10").attr("refX", 6).attr("refY", 5).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 12).attr("markerHeight", 12).attr("orient", "auto").append("path").attr("d", "M 0 0 L 10 5 L 0 10 z").attr("class", "arrowMarkerPath").style("stroke-width", 1).style("stroke-dasharray", "1,0"), e.append("marker").attr("id", r + "_" + t + "-pointStart").attr("class", "marker " + t).attr("viewBox", "0 0 10 10").attr("refX", 4.5).attr("refY", 5).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 12).attr("markerHeight", 12).attr("orient", "auto").append("path").attr("d", "M 0 5 L 10 10 L 10 0 z").attr("class", "arrowMarkerPath").style("stroke-width", 1).style("stroke-dasharray", "1,0");
881
+ }, "point"), $e = /* @__PURE__ */ d((e, t, r) => {
882
+ e.append("marker").attr("id", r + "_" + t + "-circleEnd").attr("class", "marker " + t).attr("viewBox", "0 0 10 10").attr("refX", 11).attr("refY", 5).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 11).attr("markerHeight", 11).attr("orient", "auto").append("circle").attr("cx", "5").attr("cy", "5").attr("r", "5").attr("class", "arrowMarkerPath").style("stroke-width", 1).style("stroke-dasharray", "1,0"), e.append("marker").attr("id", r + "_" + t + "-circleStart").attr("class", "marker " + t).attr("viewBox", "0 0 10 10").attr("refX", -1).attr("refY", 5).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 11).attr("markerHeight", 11).attr("orient", "auto").append("circle").attr("cx", "5").attr("cy", "5").attr("r", "5").attr("class", "arrowMarkerPath").style("stroke-width", 1).style("stroke-dasharray", "1,0");
883
+ }, "circle"), tr = /* @__PURE__ */ d((e, t, r) => {
884
+ e.append("marker").attr("id", r + "_" + t + "-crossEnd").attr("class", "marker cross " + t).attr("viewBox", "0 0 11 11").attr("refX", 12).attr("refY", 5.2).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 11).attr("markerHeight", 11).attr("orient", "auto").append("path").attr("d", "M 1,1 l 9,9 M 10,1 l -9,9").attr("class", "arrowMarkerPath").style("stroke-width", 2).style("stroke-dasharray", "1,0"), e.append("marker").attr("id", r + "_" + t + "-crossStart").attr("class", "marker cross " + t).attr("viewBox", "0 0 11 11").attr("refX", -1).attr("refY", 5.2).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 11).attr("markerHeight", 11).attr("orient", "auto").append("path").attr("d", "M 1,1 l 9,9 M 10,1 l -9,9").attr("class", "arrowMarkerPath").style("stroke-width", 2).style("stroke-dasharray", "1,0");
885
+ }, "cross"), er = /* @__PURE__ */ d((e, t, r) => {
886
+ e.append("defs").append("marker").attr("id", r + "_" + t + "-barbEnd").attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 14).attr("markerUnits", "strokeWidth").attr("orient", "auto").append("path").attr("d", "M 19,7 L9,13 L14,7 L9,1 Z");
887
+ }, "barb"), rr = {
888
+ extension: Ve,
889
+ composition: Ge,
890
+ aggregation: Ze,
891
+ dependency: qe,
892
+ lollipop: Je,
893
+ point: Qe,
894
+ circle: $e,
895
+ cross: tr,
896
+ barb: er
897
+ }, ar = je, Wt, Pt, I = ((Pt = (Wt = z()) == null ? void 0 : Wt.block) == null ? void 0 : Pt.padding) ?? 8;
898
+ function Vt(e, t) {
899
+ if (e === 0 || !Number.isInteger(e))
900
+ throw new Error("Columns must be an integer !== 0.");
901
+ if (t < 0 || !Number.isInteger(t))
902
+ throw new Error("Position must be a non-negative integer." + t);
903
+ if (e < 0)
904
+ return { px: t, py: 0 };
905
+ if (e === 1)
906
+ return { px: 0, py: t };
907
+ const r = t % e, n = Math.floor(t / e);
908
+ return { px: r, py: n };
909
+ }
910
+ d(Vt, "calculateBlockPosition");
911
+ var sr = /* @__PURE__ */ d((e) => {
912
+ let t = 0, r = 0;
913
+ for (const n of e.children) {
914
+ const { width: i, height: a, x: s, y: l } = n.size ?? { width: 0, height: 0, x: 0, y: 0 };
915
+ L.debug(
916
+ "getMaxChildSize abc95 child:",
917
+ n.id,
918
+ "width:",
919
+ i,
920
+ "height:",
921
+ a,
922
+ "x:",
923
+ s,
924
+ "y:",
925
+ l,
926
+ n.type
927
+ ), n.type !== "space" && (i > t && (t = i / (e.widthInColumns ?? 1)), a > r && (r = a));
928
+ }
929
+ return { width: t, height: r };
930
+ }, "getMaxChildSize");
931
+ function ot(e, t, r = 0, n = 0) {
932
+ var s, l, o, f, h, y, b, m, E, D, v;
933
+ L.debug(
934
+ "setBlockSizes abc95 (start)",
935
+ e.id,
936
+ (s = e == null ? void 0 : e.size) == null ? void 0 : s.x,
937
+ "block width =",
938
+ e == null ? void 0 : e.size,
939
+ "sieblingWidth",
940
+ r
941
+ ), (l = e == null ? void 0 : e.size) != null && l.width || (e.size = {
942
+ width: r,
943
+ height: n,
944
+ x: 0,
945
+ y: 0
946
+ });
947
+ let i = 0, a = 0;
948
+ if (((o = e.children) == null ? void 0 : o.length) > 0) {
949
+ for (const S of e.children)
950
+ ot(S, t);
951
+ const T = sr(e);
952
+ i = T.width, a = T.height, L.debug("setBlockSizes abc95 maxWidth of", e.id, ":s children is ", i, a);
953
+ for (const S of e.children)
954
+ S.size && (L.debug(
955
+ `abc95 Setting size of children of ${e.id} id=${S.id} ${i} ${a} ${JSON.stringify(S.size)}`
956
+ ), S.size.width = i * (S.widthInColumns ?? 1) + I * ((S.widthInColumns ?? 1) - 1), S.size.height = a, S.size.x = 0, S.size.y = 0, L.debug(
957
+ `abc95 updating size of ${e.id} children child:${S.id} maxWidth:${i} maxHeight:${a}`
958
+ ));
959
+ for (const S of e.children)
960
+ ot(S, t, i, a);
961
+ const k = e.columns ?? -1;
962
+ let N = 0;
963
+ for (const S of e.children)
964
+ N += S.widthInColumns ?? 1;
965
+ let x = e.children.length;
966
+ k > 0 && k < N && (x = k);
967
+ const g = Math.ceil(N / x);
968
+ let u = x * (i + I) + I, w = g * (a + I) + I;
969
+ if (u < r) {
970
+ L.debug(
971
+ `Detected to small siebling: abc95 ${e.id} sieblingWidth ${r} sieblingHeight ${n} width ${u}`
972
+ ), u = r, w = n;
973
+ const S = (r - x * I - I) / x, c = (n - g * I - I) / g;
974
+ L.debug("Size indata abc88", e.id, "childWidth", S, "maxWidth", i), L.debug("Size indata abc88", e.id, "childHeight", c, "maxHeight", a), L.debug("Size indata abc88 xSize", x, "padding", I);
975
+ for (const _ of e.children)
976
+ _.size && (_.size.width = S, _.size.height = c, _.size.x = 0, _.size.y = 0);
977
+ }
978
+ if (L.debug(
979
+ `abc95 (finale calc) ${e.id} xSize ${x} ySize ${g} columns ${k}${e.children.length} width=${Math.max(u, ((f = e.size) == null ? void 0 : f.width) || 0)}`
980
+ ), u < (((h = e == null ? void 0 : e.size) == null ? void 0 : h.width) || 0)) {
981
+ u = ((y = e == null ? void 0 : e.size) == null ? void 0 : y.width) || 0;
982
+ const S = k > 0 ? Math.min(e.children.length, k) : e.children.length;
983
+ if (S > 0) {
984
+ const c = (u - S * I - I) / S;
985
+ L.debug("abc95 (growing to fit) width", e.id, u, (b = e.size) == null ? void 0 : b.width, c);
986
+ for (const _ of e.children)
987
+ _.size && (_.size.width = c);
988
+ }
989
+ }
990
+ e.size = {
991
+ width: u,
992
+ height: w,
993
+ x: 0,
994
+ y: 0
995
+ };
996
+ }
997
+ L.debug(
998
+ "setBlockSizes abc94 (done)",
999
+ e.id,
1000
+ (m = e == null ? void 0 : e.size) == null ? void 0 : m.x,
1001
+ (E = e == null ? void 0 : e.size) == null ? void 0 : E.width,
1002
+ (D = e == null ? void 0 : e.size) == null ? void 0 : D.y,
1003
+ (v = e == null ? void 0 : e.size) == null ? void 0 : v.height
1004
+ );
1005
+ }
1006
+ d(ot, "setBlockSizes");
1007
+ function Et(e, t) {
1008
+ var n, i, a, s, l, o, f, h, y, b, m, E, D, v, T, k, N;
1009
+ L.debug(
1010
+ `abc85 layout blocks (=>layoutBlocks) ${e.id} x: ${(n = e == null ? void 0 : e.size) == null ? void 0 : n.x} y: ${(i = e == null ? void 0 : e.size) == null ? void 0 : i.y} width: ${(a = e == null ? void 0 : e.size) == null ? void 0 : a.width}`
1011
+ );
1012
+ const r = e.columns ?? -1;
1013
+ if (L.debug("layoutBlocks columns abc95", e.id, "=>", r, e), e.children && // find max width of children
1014
+ e.children.length > 0) {
1015
+ const x = ((l = (s = e == null ? void 0 : e.children[0]) == null ? void 0 : s.size) == null ? void 0 : l.width) ?? 0, g = e.children.length * x + (e.children.length - 1) * I;
1016
+ L.debug("widthOfChildren 88", g, "posX");
1017
+ let u = 0;
1018
+ L.debug("abc91 block?.size?.x", e.id, (o = e == null ? void 0 : e.size) == null ? void 0 : o.x);
1019
+ let w = (f = e == null ? void 0 : e.size) != null && f.x ? ((h = e == null ? void 0 : e.size) == null ? void 0 : h.x) + (-((y = e == null ? void 0 : e.size) == null ? void 0 : y.width) / 2 || 0) : -I, S = 0;
1020
+ for (const c of e.children) {
1021
+ const _ = e;
1022
+ if (!c.size)
1023
+ continue;
1024
+ const { width: p, height: A } = c.size, { px: O, py: X } = Vt(r, u);
1025
+ if (X != S && (S = X, w = (b = e == null ? void 0 : e.size) != null && b.x ? ((m = e == null ? void 0 : e.size) == null ? void 0 : m.x) + (-((E = e == null ? void 0 : e.size) == null ? void 0 : E.width) / 2 || 0) : -I, L.debug("New row in layout for block", e.id, " and child ", c.id, S)), L.debug(
1026
+ `abc89 layout blocks (child) id: ${c.id} Pos: ${u} (px, py) ${O},${X} (${(D = _ == null ? void 0 : _.size) == null ? void 0 : D.x},${(v = _ == null ? void 0 : _.size) == null ? void 0 : v.y}) parent: ${_.id} width: ${p}${I}`
1027
+ ), _.size) {
1028
+ const W = p / 2;
1029
+ c.size.x = w + I + W, L.debug(
1030
+ `abc91 layout blocks (calc) px, pyid:${c.id} startingPos=X${w} new startingPosX${c.size.x} ${W} padding=${I} width=${p} halfWidth=${W} => x:${c.size.x} y:${c.size.y} ${c.widthInColumns} (width * (child?.w || 1)) / 2 ${p * ((c == null ? void 0 : c.widthInColumns) ?? 1) / 2}`
1031
+ ), w = c.size.x + W, c.size.y = _.size.y - _.size.height / 2 + X * (A + I) + A / 2 + I, L.debug(
1032
+ `abc88 layout blocks (calc) px, pyid:${c.id}startingPosX${w}${I}${W}=>x:${c.size.x}y:${c.size.y}${c.widthInColumns}(width * (child?.w || 1)) / 2${p * ((c == null ? void 0 : c.widthInColumns) ?? 1) / 2}`
1033
+ );
1034
+ }
1035
+ c.children && Et(c), u += (c == null ? void 0 : c.widthInColumns) ?? 1, L.debug("abc88 columnsPos", c, u);
1036
+ }
1037
+ }
1038
+ L.debug(
1039
+ `layout blocks (<==layoutBlocks) ${e.id} x: ${(T = e == null ? void 0 : e.size) == null ? void 0 : T.x} y: ${(k = e == null ? void 0 : e.size) == null ? void 0 : k.y} width: ${(N = e == null ? void 0 : e.size) == null ? void 0 : N.width}`
1040
+ );
1041
+ }
1042
+ d(Et, "layoutBlocks");
1043
+ function _t(e, { minX: t, minY: r, maxX: n, maxY: i } = { minX: 0, minY: 0, maxX: 0, maxY: 0 }) {
1044
+ if (e.size && e.id !== "root") {
1045
+ const { x: a, y: s, width: l, height: o } = e.size;
1046
+ a - l / 2 < t && (t = a - l / 2), s - o / 2 < r && (r = s - o / 2), a + l / 2 > n && (n = a + l / 2), s + o / 2 > i && (i = s + o / 2);
1047
+ }
1048
+ if (e.children)
1049
+ for (const a of e.children)
1050
+ ({ minX: t, minY: r, maxX: n, maxY: i } = _t(a, { minX: t, minY: r, maxX: n, maxY: i }));
1051
+ return { minX: t, minY: r, maxX: n, maxY: i };
1052
+ }
1053
+ d(_t, "findBounds");
1054
+ function Gt(e) {
1055
+ const t = e.getBlock("root");
1056
+ if (!t)
1057
+ return;
1058
+ ot(t, e, 0, 0), Et(t), L.debug("getBlocks", JSON.stringify(t, null, 2));
1059
+ const { minX: r, minY: n, maxX: i, maxY: a } = _t(t), s = a - n, l = i - r;
1060
+ return { x: r, y: n, width: l, height: s };
1061
+ }
1062
+ d(Gt, "layout");
1063
+ function wt(e, t) {
1064
+ t && e.attr("style", t);
1065
+ }
1066
+ d(wt, "applyStyle");
1067
+ function Zt(e) {
1068
+ const t = R(document.createElementNS("http://www.w3.org/2000/svg", "foreignObject")), r = t.append("xhtml:div"), n = e.label, i = e.isNode ? "nodeLabel" : "edgeLabel", a = r.append("span");
1069
+ return a.html(n), wt(a, e.labelStyle), a.attr("class", i), wt(r, e.labelStyle), r.style("display", "inline-block"), r.style("white-space", "nowrap"), r.attr("xmlns", "http://www.w3.org/1999/xhtml"), t.node();
1070
+ }
1071
+ d(Zt, "addHtmlLabel");
1072
+ var ir = /* @__PURE__ */ d((e, t, r, n) => {
1073
+ let i = e || "";
1074
+ if (typeof i == "object" && (i = i[0]), Z(z().flowchart.htmlLabels)) {
1075
+ i = i.replace(/\\n|\n/g, "<br />"), L.debug("vertexText" + i);
1076
+ const a = {
1077
+ isNode: n,
1078
+ label: we(xt(i)),
1079
+ labelStyle: t.replace("fill:", "color:")
1080
+ };
1081
+ return Zt(a);
1082
+ } else {
1083
+ const a = document.createElementNS("http://www.w3.org/2000/svg", "text");
1084
+ a.setAttribute("style", t.replace("color:", "fill:"));
1085
+ let s = [];
1086
+ typeof i == "string" ? s = i.split(/\\n|\n|<br\s*\/?>/gi) : Array.isArray(i) ? s = i : s = [];
1087
+ for (const l of s) {
1088
+ const o = document.createElementNS("http://www.w3.org/2000/svg", "tspan");
1089
+ o.setAttributeNS("http://www.w3.org/XML/1998/namespace", "xml:space", "preserve"), o.setAttribute("dy", "1em"), o.setAttribute("x", "0"), r ? o.setAttribute("class", "title-row") : o.setAttribute("class", "row"), o.textContent = l.trim(), a.appendChild(o);
1090
+ }
1091
+ return a;
1092
+ }
1093
+ }, "createLabel"), j = ir, nr = /* @__PURE__ */ d((e, t, r, n, i) => {
1094
+ t.arrowTypeStart && Ot(e, "start", t.arrowTypeStart, r, n, i), t.arrowTypeEnd && Ot(e, "end", t.arrowTypeEnd, r, n, i);
1095
+ }, "addEdgeMarkers"), lr = {
1096
+ arrow_cross: "cross",
1097
+ arrow_point: "point",
1098
+ arrow_barb: "barb",
1099
+ arrow_circle: "circle",
1100
+ aggregation: "aggregation",
1101
+ extension: "extension",
1102
+ composition: "composition",
1103
+ dependency: "dependency",
1104
+ lollipop: "lollipop"
1105
+ }, Ot = /* @__PURE__ */ d((e, t, r, n, i, a) => {
1106
+ const s = lr[r];
1107
+ if (!s) {
1108
+ L.warn(`Unknown arrow type: ${r}`);
1109
+ return;
1110
+ }
1111
+ const l = t === "start" ? "Start" : "End";
1112
+ e.attr(`marker-${t}`, `url(${n}#${i}_${a}-${s}${l})`);
1113
+ }, "addEdgeMarker"), mt = {}, P = {}, cr = /* @__PURE__ */ d((e, t) => {
1114
+ const r = z(), n = Z(r.flowchart.htmlLabels), i = t.labelType === "markdown" ? Yt(
1115
+ e,
1116
+ t.label,
1117
+ {
1118
+ style: t.labelStyle,
1119
+ useHtmlLabels: n,
1120
+ addSvgBackground: !0
1121
+ },
1122
+ r
1123
+ ) : j(t.label, t.labelStyle), a = e.insert("g").attr("class", "edgeLabel"), s = a.insert("g").attr("class", "label");
1124
+ s.node().appendChild(i);
1125
+ let l = i.getBBox();
1126
+ if (n) {
1127
+ const f = i.children[0], h = R(i);
1128
+ l = f.getBoundingClientRect(), h.attr("width", l.width), h.attr("height", l.height);
1129
+ }
1130
+ s.attr("transform", "translate(" + -l.width / 2 + ", " + -l.height / 2 + ")"), mt[t.id] = a, t.width = l.width, t.height = l.height;
1131
+ let o;
1132
+ if (t.startLabelLeft) {
1133
+ const f = j(t.startLabelLeft, t.labelStyle), h = e.insert("g").attr("class", "edgeTerminals"), y = h.insert("g").attr("class", "inner");
1134
+ o = y.node().appendChild(f);
1135
+ const b = f.getBBox();
1136
+ y.attr("transform", "translate(" + -b.width / 2 + ", " + -b.height / 2 + ")"), P[t.id] || (P[t.id] = {}), P[t.id].startLeft = h, et(o, t.startLabelLeft);
1137
+ }
1138
+ if (t.startLabelRight) {
1139
+ const f = j(t.startLabelRight, t.labelStyle), h = e.insert("g").attr("class", "edgeTerminals"), y = h.insert("g").attr("class", "inner");
1140
+ o = h.node().appendChild(f), y.node().appendChild(f);
1141
+ const b = f.getBBox();
1142
+ y.attr("transform", "translate(" + -b.width / 2 + ", " + -b.height / 2 + ")"), P[t.id] || (P[t.id] = {}), P[t.id].startRight = h, et(o, t.startLabelRight);
1143
+ }
1144
+ if (t.endLabelLeft) {
1145
+ const f = j(t.endLabelLeft, t.labelStyle), h = e.insert("g").attr("class", "edgeTerminals"), y = h.insert("g").attr("class", "inner");
1146
+ o = y.node().appendChild(f);
1147
+ const b = f.getBBox();
1148
+ y.attr("transform", "translate(" + -b.width / 2 + ", " + -b.height / 2 + ")"), h.node().appendChild(f), P[t.id] || (P[t.id] = {}), P[t.id].endLeft = h, et(o, t.endLabelLeft);
1149
+ }
1150
+ if (t.endLabelRight) {
1151
+ const f = j(t.endLabelRight, t.labelStyle), h = e.insert("g").attr("class", "edgeTerminals"), y = h.insert("g").attr("class", "inner");
1152
+ o = y.node().appendChild(f);
1153
+ const b = f.getBBox();
1154
+ y.attr("transform", "translate(" + -b.width / 2 + ", " + -b.height / 2 + ")"), h.node().appendChild(f), P[t.id] || (P[t.id] = {}), P[t.id].endRight = h, et(o, t.endLabelRight);
1155
+ }
1156
+ return i;
1157
+ }, "insertEdgeLabel");
1158
+ function et(e, t) {
1159
+ z().flowchart.htmlLabels && e && (e.style.width = t.length * 9 + "px", e.style.height = "12px");
1160
+ }
1161
+ d(et, "setTerminalWidth");
1162
+ var or = /* @__PURE__ */ d((e, t) => {
1163
+ L.debug("Moving label abc88 ", e.id, e.label, mt[e.id], t);
1164
+ let r = t.updatedPath ? t.updatedPath : t.originalPath;
1165
+ const n = z(), { subGraphTitleTotalMargin: i } = ge(n);
1166
+ if (e.label) {
1167
+ const a = mt[e.id];
1168
+ let s = e.x, l = e.y;
1169
+ if (r) {
1170
+ const o = tt.calcLabelPosition(r);
1171
+ L.debug(
1172
+ "Moving label " + e.label + " from (",
1173
+ s,
1174
+ ",",
1175
+ l,
1176
+ ") to (",
1177
+ o.x,
1178
+ ",",
1179
+ o.y,
1180
+ ") abc88"
1181
+ ), t.updatedPath && (s = o.x, l = o.y);
1182
+ }
1183
+ a.attr("transform", `translate(${s}, ${l + i / 2})`);
1184
+ }
1185
+ if (e.startLabelLeft) {
1186
+ const a = P[e.id].startLeft;
1187
+ let s = e.x, l = e.y;
1188
+ if (r) {
1189
+ const o = tt.calcTerminalLabelPosition(e.arrowTypeStart ? 10 : 0, "start_left", r);
1190
+ s = o.x, l = o.y;
1191
+ }
1192
+ a.attr("transform", `translate(${s}, ${l})`);
1193
+ }
1194
+ if (e.startLabelRight) {
1195
+ const a = P[e.id].startRight;
1196
+ let s = e.x, l = e.y;
1197
+ if (r) {
1198
+ const o = tt.calcTerminalLabelPosition(
1199
+ e.arrowTypeStart ? 10 : 0,
1200
+ "start_right",
1201
+ r
1202
+ );
1203
+ s = o.x, l = o.y;
1204
+ }
1205
+ a.attr("transform", `translate(${s}, ${l})`);
1206
+ }
1207
+ if (e.endLabelLeft) {
1208
+ const a = P[e.id].endLeft;
1209
+ let s = e.x, l = e.y;
1210
+ if (r) {
1211
+ const o = tt.calcTerminalLabelPosition(e.arrowTypeEnd ? 10 : 0, "end_left", r);
1212
+ s = o.x, l = o.y;
1213
+ }
1214
+ a.attr("transform", `translate(${s}, ${l})`);
1215
+ }
1216
+ if (e.endLabelRight) {
1217
+ const a = P[e.id].endRight;
1218
+ let s = e.x, l = e.y;
1219
+ if (r) {
1220
+ const o = tt.calcTerminalLabelPosition(e.arrowTypeEnd ? 10 : 0, "end_right", r);
1221
+ s = o.x, l = o.y;
1222
+ }
1223
+ a.attr("transform", `translate(${s}, ${l})`);
1224
+ }
1225
+ }, "positionEdgeLabel"), hr = /* @__PURE__ */ d((e, t) => {
1226
+ const r = e.x, n = e.y, i = Math.abs(t.x - r), a = Math.abs(t.y - n), s = e.width / 2, l = e.height / 2;
1227
+ return i >= s || a >= l;
1228
+ }, "outsideNode"), dr = /* @__PURE__ */ d((e, t, r) => {
1229
+ L.debug(`intersection calc abc89:
1230
+ outsidePoint: ${JSON.stringify(t)}
1231
+ insidePoint : ${JSON.stringify(r)}
1232
+ node : x:${e.x} y:${e.y} w:${e.width} h:${e.height}`);
1233
+ const n = e.x, i = e.y, a = Math.abs(n - r.x), s = e.width / 2;
1234
+ let l = r.x < t.x ? s - a : s + a;
1235
+ const o = e.height / 2, f = Math.abs(t.y - r.y), h = Math.abs(t.x - r.x);
1236
+ if (Math.abs(i - t.y) * s > Math.abs(n - t.x) * o) {
1237
+ let y = r.y < t.y ? t.y - o - i : i - o - t.y;
1238
+ l = h * y / f;
1239
+ const b = {
1240
+ x: r.x < t.x ? r.x + l : r.x - h + l,
1241
+ y: r.y < t.y ? r.y + f - y : r.y - f + y
1242
+ };
1243
+ return l === 0 && (b.x = t.x, b.y = t.y), h === 0 && (b.x = t.x), f === 0 && (b.y = t.y), L.debug(`abc89 topp/bott calc, Q ${f}, q ${y}, R ${h}, r ${l}`, b), b;
1244
+ } else {
1245
+ r.x < t.x ? l = t.x - s - n : l = n - s - t.x;
1246
+ let y = f * l / h, b = r.x < t.x ? r.x + h - l : r.x - h + l, m = r.y < t.y ? r.y + y : r.y - y;
1247
+ return L.debug(`sides calc abc89, Q ${f}, q ${y}, R ${h}, r ${l}`, { _x: b, _y: m }), l === 0 && (b = t.x, m = t.y), h === 0 && (b = t.x), f === 0 && (m = t.y), { x: b, y: m };
1248
+ }
1249
+ }, "intersection"), Rt = /* @__PURE__ */ d((e, t) => {
1250
+ L.debug("abc88 cutPathAtIntersect", e, t);
1251
+ let r = [], n = e[0], i = !1;
1252
+ return e.forEach((a) => {
1253
+ if (!hr(t, a) && !i) {
1254
+ const s = dr(t, n, a);
1255
+ let l = !1;
1256
+ r.forEach((o) => {
1257
+ l = l || o.x === s.x && o.y === s.y;
1258
+ }), r.some((o) => o.x === s.x && o.y === s.y) || r.push(s), i = !0;
1259
+ } else
1260
+ n = a, i || r.push(a);
1261
+ }), r;
1262
+ }, "cutPathAtIntersect"), gr = /* @__PURE__ */ d(function(e, t, r, n, i, a, s) {
1263
+ let l = r.points;
1264
+ L.debug("abc88 InsertEdge: edge=", r, "e=", t);
1265
+ let o = !1;
1266
+ const f = a.node(t.v);
1267
+ var h = a.node(t.w);
1268
+ h != null && h.intersect && (f != null && f.intersect) && (l = l.slice(1, r.points.length - 1), l.unshift(f.intersect(l[0])), l.push(h.intersect(l[l.length - 1]))), r.toCluster && (L.debug("to cluster abc88", n[r.toCluster]), l = Rt(r.points, n[r.toCluster].node), o = !0), r.fromCluster && (L.debug("from cluster abc88", n[r.fromCluster]), l = Rt(l.reverse(), n[r.fromCluster].node).reverse(), o = !0);
1269
+ const y = l.filter((x) => !Number.isNaN(x.y));
1270
+ let b = be;
1271
+ r.curve && (i === "graph" || i === "flowchart") && (b = r.curve);
1272
+ const { x: m, y: E } = ue(r), D = pe().x(m).y(E).curve(b);
1273
+ let v;
1274
+ switch (r.thickness) {
1275
+ case "normal":
1276
+ v = "edge-thickness-normal";
1277
+ break;
1278
+ case "thick":
1279
+ v = "edge-thickness-thick";
1280
+ break;
1281
+ case "invisible":
1282
+ v = "edge-thickness-thick";
1283
+ break;
1284
+ default:
1285
+ v = "";
1286
+ }
1287
+ switch (r.pattern) {
1288
+ case "solid":
1289
+ v += " edge-pattern-solid";
1290
+ break;
1291
+ case "dotted":
1292
+ v += " edge-pattern-dotted";
1293
+ break;
1294
+ case "dashed":
1295
+ v += " edge-pattern-dashed";
1296
+ break;
1297
+ }
1298
+ const T = e.append("path").attr("d", D(y)).attr("id", r.id).attr("class", " " + v + (r.classes ? " " + r.classes : "")).attr("style", r.style);
1299
+ let k = "";
1300
+ (z().flowchart.arrowMarkerAbsolute || z().state.arrowMarkerAbsolute) && (k = window.location.protocol + "//" + window.location.host + window.location.pathname + window.location.search, k = k.replace(/\(/g, "\\("), k = k.replace(/\)/g, "\\)")), nr(T, r, k, s, i);
1301
+ let N = {};
1302
+ return o && (N.updatedPath = l), N.originalPath = r.points, N;
1303
+ }, "insertEdge"), ur = /* @__PURE__ */ d((e) => {
1304
+ const t = /* @__PURE__ */ new Set();
1305
+ for (const r of e)
1306
+ switch (r) {
1307
+ case "x":
1308
+ t.add("right"), t.add("left");
1309
+ break;
1310
+ case "y":
1311
+ t.add("up"), t.add("down");
1312
+ break;
1313
+ default:
1314
+ t.add(r);
1315
+ break;
1316
+ }
1317
+ return t;
1318
+ }, "expandAndDeduplicateDirections"), pr = /* @__PURE__ */ d((e, t, r) => {
1319
+ const n = ur(e), i = 2, a = t.height + 2 * r.padding, s = a / i, l = t.width + 2 * s + r.padding, o = r.padding / 2;
1320
+ return n.has("right") && n.has("left") && n.has("up") && n.has("down") ? [
1321
+ // Bottom
1322
+ { x: 0, y: 0 },
1323
+ { x: s, y: 0 },
1324
+ { x: l / 2, y: 2 * o },
1325
+ { x: l - s, y: 0 },
1326
+ { x: l, y: 0 },
1327
+ // Right
1328
+ { x: l, y: -a / 3 },
1329
+ { x: l + 2 * o, y: -a / 2 },
1330
+ { x: l, y: -2 * a / 3 },
1331
+ { x: l, y: -a },
1332
+ // Top
1333
+ { x: l - s, y: -a },
1334
+ { x: l / 2, y: -a - 2 * o },
1335
+ { x: s, y: -a },
1336
+ // Left
1337
+ { x: 0, y: -a },
1338
+ { x: 0, y: -2 * a / 3 },
1339
+ { x: -2 * o, y: -a / 2 },
1340
+ { x: 0, y: -a / 3 }
1341
+ ] : n.has("right") && n.has("left") && n.has("up") ? [
1342
+ { x: s, y: 0 },
1343
+ { x: l - s, y: 0 },
1344
+ { x: l, y: -a / 2 },
1345
+ { x: l - s, y: -a },
1346
+ { x: s, y: -a },
1347
+ { x: 0, y: -a / 2 }
1348
+ ] : n.has("right") && n.has("left") && n.has("down") ? [
1349
+ { x: 0, y: 0 },
1350
+ { x: s, y: -a },
1351
+ { x: l - s, y: -a },
1352
+ { x: l, y: 0 }
1353
+ ] : n.has("right") && n.has("up") && n.has("down") ? [
1354
+ { x: 0, y: 0 },
1355
+ { x: l, y: -s },
1356
+ { x: l, y: -a + s },
1357
+ { x: 0, y: -a }
1358
+ ] : n.has("left") && n.has("up") && n.has("down") ? [
1359
+ { x: l, y: 0 },
1360
+ { x: 0, y: -s },
1361
+ { x: 0, y: -a + s },
1362
+ { x: l, y: -a }
1363
+ ] : n.has("right") && n.has("left") ? [
1364
+ { x: s, y: 0 },
1365
+ { x: s, y: -o },
1366
+ { x: l - s, y: -o },
1367
+ { x: l - s, y: 0 },
1368
+ { x: l, y: -a / 2 },
1369
+ { x: l - s, y: -a },
1370
+ { x: l - s, y: -a + o },
1371
+ { x: s, y: -a + o },
1372
+ { x: s, y: -a },
1373
+ { x: 0, y: -a / 2 }
1374
+ ] : n.has("up") && n.has("down") ? [
1375
+ // Bottom center
1376
+ { x: l / 2, y: 0 },
1377
+ // Left pont of bottom arrow
1378
+ { x: 0, y: -o },
1379
+ { x: s, y: -o },
1380
+ // Left top over vertical section
1381
+ { x: s, y: -a + o },
1382
+ { x: 0, y: -a + o },
1383
+ // Top of arrow
1384
+ { x: l / 2, y: -a },
1385
+ { x: l, y: -a + o },
1386
+ // Top of right vertical bar
1387
+ { x: l - s, y: -a + o },
1388
+ { x: l - s, y: -o },
1389
+ { x: l, y: -o }
1390
+ ] : n.has("right") && n.has("up") ? [
1391
+ { x: 0, y: 0 },
1392
+ { x: l, y: -s },
1393
+ { x: 0, y: -a }
1394
+ ] : n.has("right") && n.has("down") ? [
1395
+ { x: 0, y: 0 },
1396
+ { x: l, y: 0 },
1397
+ { x: 0, y: -a }
1398
+ ] : n.has("left") && n.has("up") ? [
1399
+ { x: l, y: 0 },
1400
+ { x: 0, y: -s },
1401
+ { x: l, y: -a }
1402
+ ] : n.has("left") && n.has("down") ? [
1403
+ { x: l, y: 0 },
1404
+ { x: 0, y: 0 },
1405
+ { x: l, y: -a }
1406
+ ] : n.has("right") ? [
1407
+ { x: s, y: -o },
1408
+ { x: s, y: -o },
1409
+ { x: l - s, y: -o },
1410
+ { x: l - s, y: 0 },
1411
+ { x: l, y: -a / 2 },
1412
+ { x: l - s, y: -a },
1413
+ { x: l - s, y: -a + o },
1414
+ // top left corner of arrow
1415
+ { x: s, y: -a + o },
1416
+ { x: s, y: -a + o }
1417
+ ] : n.has("left") ? [
1418
+ { x: s, y: 0 },
1419
+ { x: s, y: -o },
1420
+ // Two points, the right corners
1421
+ { x: l - s, y: -o },
1422
+ { x: l - s, y: -a + o },
1423
+ { x: s, y: -a + o },
1424
+ { x: s, y: -a },
1425
+ { x: 0, y: -a / 2 }
1426
+ ] : n.has("up") ? [
1427
+ // Bottom center
1428
+ { x: s, y: -o },
1429
+ // Left top over vertical section
1430
+ { x: s, y: -a + o },
1431
+ { x: 0, y: -a + o },
1432
+ // Top of arrow
1433
+ { x: l / 2, y: -a },
1434
+ { x: l, y: -a + o },
1435
+ // Top of right vertical bar
1436
+ { x: l - s, y: -a + o },
1437
+ { x: l - s, y: -o }
1438
+ ] : n.has("down") ? [
1439
+ // Bottom center
1440
+ { x: l / 2, y: 0 },
1441
+ // Left pont of bottom arrow
1442
+ { x: 0, y: -o },
1443
+ { x: s, y: -o },
1444
+ // Left top over vertical section
1445
+ { x: s, y: -a + o },
1446
+ { x: l - s, y: -a + o },
1447
+ { x: l - s, y: -o },
1448
+ { x: l, y: -o }
1449
+ ] : [{ x: 0, y: 0 }];
1450
+ }, "getArrowPoints");
1451
+ function qt(e, t) {
1452
+ return e.intersect(t);
1453
+ }
1454
+ d(qt, "intersectNode");
1455
+ var fr = qt;
1456
+ function Jt(e, t, r, n) {
1457
+ var i = e.x, a = e.y, s = i - n.x, l = a - n.y, o = Math.sqrt(t * t * l * l + r * r * s * s), f = Math.abs(t * r * s / o);
1458
+ n.x < i && (f = -f);
1459
+ var h = Math.abs(t * r * l / o);
1460
+ return n.y < a && (h = -h), { x: i + f, y: a + h };
1461
+ }
1462
+ d(Jt, "intersectEllipse");
1463
+ var Qt = Jt;
1464
+ function $t(e, t, r) {
1465
+ return Qt(e, t, t, r);
1466
+ }
1467
+ d($t, "intersectCircle");
1468
+ var xr = $t;
1469
+ function te(e, t, r, n) {
1470
+ var i, a, s, l, o, f, h, y, b, m, E, D, v, T, k;
1471
+ if (i = t.y - e.y, s = e.x - t.x, o = t.x * e.y - e.x * t.y, b = i * r.x + s * r.y + o, m = i * n.x + s * n.y + o, !(b !== 0 && m !== 0 && Lt(b, m)) && (a = n.y - r.y, l = r.x - n.x, f = n.x * r.y - r.x * n.y, h = a * e.x + l * e.y + f, y = a * t.x + l * t.y + f, !(h !== 0 && y !== 0 && Lt(h, y)) && (E = i * l - a * s, E !== 0)))
1472
+ return D = Math.abs(E / 2), v = s * f - l * o, T = v < 0 ? (v - D) / E : (v + D) / E, v = a * o - i * f, k = v < 0 ? (v - D) / E : (v + D) / E, { x: T, y: k };
1473
+ }
1474
+ d(te, "intersectLine");
1475
+ function Lt(e, t) {
1476
+ return e * t > 0;
1477
+ }
1478
+ d(Lt, "sameSign");
1479
+ var yr = te, br = ee;
1480
+ function ee(e, t, r) {
1481
+ var n = e.x, i = e.y, a = [], s = Number.POSITIVE_INFINITY, l = Number.POSITIVE_INFINITY;
1482
+ typeof t.forEach == "function" ? t.forEach(function(E) {
1483
+ s = Math.min(s, E.x), l = Math.min(l, E.y);
1484
+ }) : (s = Math.min(s, t.x), l = Math.min(l, t.y));
1485
+ for (var o = n - e.width / 2 - s, f = i - e.height / 2 - l, h = 0; h < t.length; h++) {
1486
+ var y = t[h], b = t[h < t.length - 1 ? h + 1 : 0], m = yr(
1487
+ e,
1488
+ r,
1489
+ { x: o + y.x, y: f + y.y },
1490
+ { x: o + b.x, y: f + b.y }
1491
+ );
1492
+ m && a.push(m);
1493
+ }
1494
+ return a.length ? (a.length > 1 && a.sort(function(E, D) {
1495
+ var v = E.x - r.x, T = E.y - r.y, k = Math.sqrt(v * v + T * T), N = D.x - r.x, x = D.y - r.y, g = Math.sqrt(N * N + x * x);
1496
+ return k < g ? -1 : k === g ? 0 : 1;
1497
+ }), a[0]) : e;
1498
+ }
1499
+ d(ee, "intersectPolygon");
1500
+ var wr = /* @__PURE__ */ d((e, t) => {
1501
+ var r = e.x, n = e.y, i = t.x - r, a = t.y - n, s = e.width / 2, l = e.height / 2, o, f;
1502
+ return Math.abs(a) * s > Math.abs(i) * l ? (a < 0 && (l = -l), o = a === 0 ? 0 : l * i / a, f = l) : (i < 0 && (s = -s), o = s, f = i === 0 ? 0 : s * a / i), { x: r + o, y: n + f };
1503
+ }, "intersectRect"), mr = wr, C = {
1504
+ node: fr,
1505
+ circle: xr,
1506
+ ellipse: Qt,
1507
+ polygon: br,
1508
+ rect: mr
1509
+ }, F = /* @__PURE__ */ d(async (e, t, r, n) => {
1510
+ const i = z();
1511
+ let a;
1512
+ const s = t.useHtmlLabels || Z(i.flowchart.htmlLabels);
1513
+ r ? a = r : a = "node default";
1514
+ const l = e.insert("g").attr("class", a).attr("id", t.domId || t.id), o = l.insert("g").attr("class", "label").attr("style", t.labelStyle);
1515
+ let f;
1516
+ t.labelText === void 0 ? f = "" : f = typeof t.labelText == "string" ? t.labelText : t.labelText[0];
1517
+ const h = o.node();
1518
+ let y;
1519
+ t.labelType === "markdown" ? y = Yt(
1520
+ o,
1521
+ Tt(xt(f), i),
1522
+ {
1523
+ useHtmlLabels: s,
1524
+ width: t.width || i.flowchart.wrappingWidth,
1525
+ classes: "markdown-node-label"
1526
+ },
1527
+ i
1528
+ ) : y = h.appendChild(
1529
+ j(Tt(xt(f), i), t.labelStyle, !1, n)
1530
+ );
1531
+ let b = y.getBBox();
1532
+ const m = t.padding / 2;
1533
+ if (Z(i.flowchart.htmlLabels)) {
1534
+ const E = y.children[0], D = R(y), v = E.getElementsByTagName("img");
1535
+ if (v) {
1536
+ const T = f.replace(/<img[^>]*>/g, "").trim() === "";
1537
+ await Promise.all(
1538
+ [...v].map(
1539
+ (k) => new Promise((N) => {
1540
+ function x() {
1541
+ if (k.style.display = "flex", k.style.flexDirection = "column", T) {
1542
+ const g = i.fontSize ? i.fontSize : window.getComputedStyle(document.body).fontSize, u = 5, w = parseInt(g, 10) * u + "px";
1543
+ k.style.minWidth = w, k.style.maxWidth = w;
1544
+ } else
1545
+ k.style.width = "100%";
1546
+ N(k);
1547
+ }
1548
+ d(x, "setupImage"), setTimeout(() => {
1549
+ k.complete && x();
1550
+ }), k.addEventListener("error", x), k.addEventListener("load", x);
1551
+ })
1552
+ )
1553
+ );
1554
+ }
1555
+ b = E.getBoundingClientRect(), D.attr("width", b.width), D.attr("height", b.height);
1556
+ }
1557
+ return s ? o.attr("transform", "translate(" + -b.width / 2 + ", " + -b.height / 2 + ")") : o.attr("transform", "translate(0, " + -b.height / 2 + ")"), t.centerLabel && o.attr("transform", "translate(" + -b.width / 2 + ", " + -b.height / 2 + ")"), o.insert("rect", ":first-child"), { shapeSvg: l, bbox: b, halfPadding: m, label: o };
1558
+ }, "labelHelper"), B = /* @__PURE__ */ d((e, t) => {
1559
+ const r = t.node().getBBox();
1560
+ e.width = r.width, e.height = r.height;
1561
+ }, "updateNodeBounds");
1562
+ function G(e, t, r, n) {
1563
+ return e.insert("polygon", ":first-child").attr(
1564
+ "points",
1565
+ n.map(function(i) {
1566
+ return i.x + "," + i.y;
1567
+ }).join(" ")
1568
+ ).attr("class", "label-container").attr("transform", "translate(" + -t / 2 + "," + r / 2 + ")");
1569
+ }
1570
+ d(G, "insertPolygonShape");
1571
+ var Lr = /* @__PURE__ */ d(async (e, t) => {
1572
+ t.useHtmlLabels || z().flowchart.htmlLabels || (t.centerLabel = !0);
1573
+ const { shapeSvg: n, bbox: i, halfPadding: a } = await F(
1574
+ e,
1575
+ t,
1576
+ "node " + t.classes,
1577
+ !0
1578
+ );
1579
+ L.info("Classes = ", t.classes);
1580
+ const s = n.insert("rect", ":first-child");
1581
+ return s.attr("rx", t.rx).attr("ry", t.ry).attr("x", -i.width / 2 - a).attr("y", -i.height / 2 - a).attr("width", i.width + t.padding).attr("height", i.height + t.padding), B(t, s), t.intersect = function(l) {
1582
+ return C.rect(t, l);
1583
+ }, n;
1584
+ }, "note"), Sr = Lr, zt = /* @__PURE__ */ d((e) => e ? " " + e : "", "formatClass"), K = /* @__PURE__ */ d((e, t) => `${t || "node default"}${zt(e.classes)} ${zt(
1585
+ e.class
1586
+ )}`, "getClassesFromNode"), At = /* @__PURE__ */ d(async (e, t) => {
1587
+ const { shapeSvg: r, bbox: n } = await F(
1588
+ e,
1589
+ t,
1590
+ K(t, void 0),
1591
+ !0
1592
+ ), i = n.width + t.padding, a = n.height + t.padding, s = i + a, l = [
1593
+ { x: s / 2, y: 0 },
1594
+ { x: s, y: -s / 2 },
1595
+ { x: s / 2, y: -s },
1596
+ { x: 0, y: -s / 2 }
1597
+ ];
1598
+ L.info("Question main (Circle)");
1599
+ const o = G(r, s, s, l);
1600
+ return o.attr("style", t.style), B(t, o), t.intersect = function(f) {
1601
+ return L.warn("Intersect called"), C.polygon(t, l, f);
1602
+ }, r;
1603
+ }, "question"), vr = /* @__PURE__ */ d((e, t) => {
1604
+ const r = e.insert("g").attr("class", "node default").attr("id", t.domId || t.id), n = 28, i = [
1605
+ { x: 0, y: n / 2 },
1606
+ { x: n / 2, y: 0 },
1607
+ { x: 0, y: -n / 2 },
1608
+ { x: -n / 2, y: 0 }
1609
+ ];
1610
+ return r.insert("polygon", ":first-child").attr(
1611
+ "points",
1612
+ i.map(function(s) {
1613
+ return s.x + "," + s.y;
1614
+ }).join(" ")
1615
+ ).attr("class", "state-start").attr("r", 7).attr("width", 28).attr("height", 28), t.width = 28, t.height = 28, t.intersect = function(s) {
1616
+ return C.circle(t, 14, s);
1617
+ }, r;
1618
+ }, "choice"), Er = /* @__PURE__ */ d(async (e, t) => {
1619
+ const { shapeSvg: r, bbox: n } = await F(
1620
+ e,
1621
+ t,
1622
+ K(t, void 0),
1623
+ !0
1624
+ ), i = 4, a = n.height + t.padding, s = a / i, l = n.width + 2 * s + t.padding, o = [
1625
+ { x: s, y: 0 },
1626
+ { x: l - s, y: 0 },
1627
+ { x: l, y: -a / 2 },
1628
+ { x: l - s, y: -a },
1629
+ { x: s, y: -a },
1630
+ { x: 0, y: -a / 2 }
1631
+ ], f = G(r, l, a, o);
1632
+ return f.attr("style", t.style), B(t, f), t.intersect = function(h) {
1633
+ return C.polygon(t, o, h);
1634
+ }, r;
1635
+ }, "hexagon"), _r = /* @__PURE__ */ d(async (e, t) => {
1636
+ const { shapeSvg: r, bbox: n } = await F(e, t, void 0, !0), i = 2, a = n.height + 2 * t.padding, s = a / i, l = n.width + 2 * s + t.padding, o = pr(t.directions, n, t), f = G(r, l, a, o);
1637
+ return f.attr("style", t.style), B(t, f), t.intersect = function(h) {
1638
+ return C.polygon(t, o, h);
1639
+ }, r;
1640
+ }, "block_arrow"), kr = /* @__PURE__ */ d(async (e, t) => {
1641
+ const { shapeSvg: r, bbox: n } = await F(
1642
+ e,
1643
+ t,
1644
+ K(t, void 0),
1645
+ !0
1646
+ ), i = n.width + t.padding, a = n.height + t.padding, s = [
1647
+ { x: -a / 2, y: 0 },
1648
+ { x: i, y: 0 },
1649
+ { x: i, y: -a },
1650
+ { x: -a / 2, y: -a },
1651
+ { x: 0, y: -a / 2 }
1652
+ ];
1653
+ return G(r, i, a, s).attr("style", t.style), t.width = i + a, t.height = a, t.intersect = function(o) {
1654
+ return C.polygon(t, s, o);
1655
+ }, r;
1656
+ }, "rect_left_inv_arrow"), Dr = /* @__PURE__ */ d(async (e, t) => {
1657
+ const { shapeSvg: r, bbox: n } = await F(e, t, K(t), !0), i = n.width + t.padding, a = n.height + t.padding, s = [
1658
+ { x: -2 * a / 6, y: 0 },
1659
+ { x: i - a / 6, y: 0 },
1660
+ { x: i + 2 * a / 6, y: -a },
1661
+ { x: a / 6, y: -a }
1662
+ ], l = G(r, i, a, s);
1663
+ return l.attr("style", t.style), B(t, l), t.intersect = function(o) {
1664
+ return C.polygon(t, s, o);
1665
+ }, r;
1666
+ }, "lean_right"), Nr = /* @__PURE__ */ d(async (e, t) => {
1667
+ const { shapeSvg: r, bbox: n } = await F(
1668
+ e,
1669
+ t,
1670
+ K(t, void 0),
1671
+ !0
1672
+ ), i = n.width + t.padding, a = n.height + t.padding, s = [
1673
+ { x: 2 * a / 6, y: 0 },
1674
+ { x: i + a / 6, y: 0 },
1675
+ { x: i - 2 * a / 6, y: -a },
1676
+ { x: -a / 6, y: -a }
1677
+ ], l = G(r, i, a, s);
1678
+ return l.attr("style", t.style), B(t, l), t.intersect = function(o) {
1679
+ return C.polygon(t, s, o);
1680
+ }, r;
1681
+ }, "lean_left"), Tr = /* @__PURE__ */ d(async (e, t) => {
1682
+ const { shapeSvg: r, bbox: n } = await F(
1683
+ e,
1684
+ t,
1685
+ K(t, void 0),
1686
+ !0
1687
+ ), i = n.width + t.padding, a = n.height + t.padding, s = [
1688
+ { x: -2 * a / 6, y: 0 },
1689
+ { x: i + 2 * a / 6, y: 0 },
1690
+ { x: i - a / 6, y: -a },
1691
+ { x: a / 6, y: -a }
1692
+ ], l = G(r, i, a, s);
1693
+ return l.attr("style", t.style), B(t, l), t.intersect = function(o) {
1694
+ return C.polygon(t, s, o);
1695
+ }, r;
1696
+ }, "trapezoid"), Cr = /* @__PURE__ */ d(async (e, t) => {
1697
+ const { shapeSvg: r, bbox: n } = await F(
1698
+ e,
1699
+ t,
1700
+ K(t, void 0),
1701
+ !0
1702
+ ), i = n.width + t.padding, a = n.height + t.padding, s = [
1703
+ { x: a / 6, y: 0 },
1704
+ { x: i - a / 6, y: 0 },
1705
+ { x: i + 2 * a / 6, y: -a },
1706
+ { x: -2 * a / 6, y: -a }
1707
+ ], l = G(r, i, a, s);
1708
+ return l.attr("style", t.style), B(t, l), t.intersect = function(o) {
1709
+ return C.polygon(t, s, o);
1710
+ }, r;
1711
+ }, "inv_trapezoid"), Br = /* @__PURE__ */ d(async (e, t) => {
1712
+ const { shapeSvg: r, bbox: n } = await F(
1713
+ e,
1714
+ t,
1715
+ K(t, void 0),
1716
+ !0
1717
+ ), i = n.width + t.padding, a = n.height + t.padding, s = [
1718
+ { x: 0, y: 0 },
1719
+ { x: i + a / 2, y: 0 },
1720
+ { x: i, y: -a / 2 },
1721
+ { x: i + a / 2, y: -a },
1722
+ { x: 0, y: -a }
1723
+ ], l = G(r, i, a, s);
1724
+ return l.attr("style", t.style), B(t, l), t.intersect = function(o) {
1725
+ return C.polygon(t, s, o);
1726
+ }, r;
1727
+ }, "rect_right_inv_arrow"), Ir = /* @__PURE__ */ d(async (e, t) => {
1728
+ const { shapeSvg: r, bbox: n } = await F(
1729
+ e,
1730
+ t,
1731
+ K(t, void 0),
1732
+ !0
1733
+ ), i = n.width + t.padding, a = i / 2, s = a / (2.5 + i / 50), l = n.height + s + t.padding, o = "M 0," + s + " a " + a + "," + s + " 0,0,0 " + i + " 0 a " + a + "," + s + " 0,0,0 " + -i + " 0 l 0," + l + " a " + a + "," + s + " 0,0,0 " + i + " 0 l 0," + -l, f = r.attr("label-offset-y", s).insert("path", ":first-child").attr("style", t.style).attr("d", o).attr("transform", "translate(" + -i / 2 + "," + -(l / 2 + s) + ")");
1734
+ return B(t, f), t.intersect = function(h) {
1735
+ const y = C.rect(t, h), b = y.x - t.x;
1736
+ if (a != 0 && (Math.abs(b) < t.width / 2 || Math.abs(b) == t.width / 2 && Math.abs(y.y - t.y) > t.height / 2 - s)) {
1737
+ let m = s * s * (1 - b * b / (a * a));
1738
+ m != 0 && (m = Math.sqrt(m)), m = s - m, h.y - t.y > 0 && (m = -m), y.y += m;
1739
+ }
1740
+ return y;
1741
+ }, r;
1742
+ }, "cylinder"), Or = /* @__PURE__ */ d(async (e, t) => {
1743
+ const { shapeSvg: r, bbox: n, halfPadding: i } = await F(
1744
+ e,
1745
+ t,
1746
+ "node " + t.classes + " " + t.class,
1747
+ !0
1748
+ ), a = r.insert("rect", ":first-child"), s = t.positioned ? t.width : n.width + t.padding, l = t.positioned ? t.height : n.height + t.padding, o = t.positioned ? -s / 2 : -n.width / 2 - i, f = t.positioned ? -l / 2 : -n.height / 2 - i;
1749
+ if (a.attr("class", "basic label-container").attr("style", t.style).attr("rx", t.rx).attr("ry", t.ry).attr("x", o).attr("y", f).attr("width", s).attr("height", l), t.props) {
1750
+ const h = new Set(Object.keys(t.props));
1751
+ t.props.borders && (ht(a, t.props.borders, s, l), h.delete("borders")), h.forEach((y) => {
1752
+ L.warn(`Unknown node property ${y}`);
1753
+ });
1754
+ }
1755
+ return B(t, a), t.intersect = function(h) {
1756
+ return C.rect(t, h);
1757
+ }, r;
1758
+ }, "rect"), Rr = /* @__PURE__ */ d(async (e, t) => {
1759
+ const { shapeSvg: r, bbox: n, halfPadding: i } = await F(
1760
+ e,
1761
+ t,
1762
+ "node " + t.classes,
1763
+ !0
1764
+ ), a = r.insert("rect", ":first-child"), s = t.positioned ? t.width : n.width + t.padding, l = t.positioned ? t.height : n.height + t.padding, o = t.positioned ? -s / 2 : -n.width / 2 - i, f = t.positioned ? -l / 2 : -n.height / 2 - i;
1765
+ if (a.attr("class", "basic cluster composite label-container").attr("style", t.style).attr("rx", t.rx).attr("ry", t.ry).attr("x", o).attr("y", f).attr("width", s).attr("height", l), t.props) {
1766
+ const h = new Set(Object.keys(t.props));
1767
+ t.props.borders && (ht(a, t.props.borders, s, l), h.delete("borders")), h.forEach((y) => {
1768
+ L.warn(`Unknown node property ${y}`);
1769
+ });
1770
+ }
1771
+ return B(t, a), t.intersect = function(h) {
1772
+ return C.rect(t, h);
1773
+ }, r;
1774
+ }, "composite"), zr = /* @__PURE__ */ d(async (e, t) => {
1775
+ const { shapeSvg: r } = await F(e, t, "label", !0);
1776
+ L.trace("Classes = ", t.class);
1777
+ const n = r.insert("rect", ":first-child"), i = 0, a = 0;
1778
+ if (n.attr("width", i).attr("height", a), r.attr("class", "label edgeLabel"), t.props) {
1779
+ const s = new Set(Object.keys(t.props));
1780
+ t.props.borders && (ht(n, t.props.borders, i, a), s.delete("borders")), s.forEach((l) => {
1781
+ L.warn(`Unknown node property ${l}`);
1782
+ });
1783
+ }
1784
+ return B(t, n), t.intersect = function(s) {
1785
+ return C.rect(t, s);
1786
+ }, r;
1787
+ }, "labelRect");
1788
+ function ht(e, t, r, n) {
1789
+ const i = [], a = /* @__PURE__ */ d((l) => {
1790
+ i.push(l, 0);
1791
+ }, "addBorder"), s = /* @__PURE__ */ d((l) => {
1792
+ i.push(0, l);
1793
+ }, "skipBorder");
1794
+ t.includes("t") ? (L.debug("add top border"), a(r)) : s(r), t.includes("r") ? (L.debug("add right border"), a(n)) : s(n), t.includes("b") ? (L.debug("add bottom border"), a(r)) : s(r), t.includes("l") ? (L.debug("add left border"), a(n)) : s(n), e.attr("stroke-dasharray", i.join(" "));
1795
+ }
1796
+ d(ht, "applyNodePropertyBorders");
1797
+ var Ar = /* @__PURE__ */ d((e, t) => {
1798
+ let r;
1799
+ t.classes ? r = "node " + t.classes : r = "node default";
1800
+ const n = e.insert("g").attr("class", r).attr("id", t.domId || t.id), i = n.insert("rect", ":first-child"), a = n.insert("line"), s = n.insert("g").attr("class", "label"), l = t.labelText.flat ? t.labelText.flat() : t.labelText;
1801
+ let o = "";
1802
+ typeof l == "object" ? o = l[0] : o = l, L.info("Label text abc79", o, l, typeof l == "object");
1803
+ const f = s.node().appendChild(j(o, t.labelStyle, !0, !0));
1804
+ let h = { width: 0, height: 0 };
1805
+ if (Z(z().flowchart.htmlLabels)) {
1806
+ const D = f.children[0], v = R(f);
1807
+ h = D.getBoundingClientRect(), v.attr("width", h.width), v.attr("height", h.height);
1808
+ }
1809
+ L.info("Text 2", l);
1810
+ const y = l.slice(1, l.length);
1811
+ let b = f.getBBox();
1812
+ const m = s.node().appendChild(
1813
+ j(y.join ? y.join("<br/>") : y, t.labelStyle, !0, !0)
1814
+ );
1815
+ if (Z(z().flowchart.htmlLabels)) {
1816
+ const D = m.children[0], v = R(m);
1817
+ h = D.getBoundingClientRect(), v.attr("width", h.width), v.attr("height", h.height);
1818
+ }
1819
+ const E = t.padding / 2;
1820
+ return R(m).attr(
1821
+ "transform",
1822
+ "translate( " + // (titleBox.width - bbox.width) / 2 +
1823
+ (h.width > b.width ? 0 : (b.width - h.width) / 2) + ", " + (b.height + E + 5) + ")"
1824
+ ), R(f).attr(
1825
+ "transform",
1826
+ "translate( " + // (titleBox.width - bbox.width) / 2 +
1827
+ (h.width < b.width ? 0 : -(b.width - h.width) / 2) + ", 0)"
1828
+ ), h = s.node().getBBox(), s.attr(
1829
+ "transform",
1830
+ "translate(" + -h.width / 2 + ", " + (-h.height / 2 - E + 3) + ")"
1831
+ ), i.attr("class", "outer title-state").attr("x", -h.width / 2 - E).attr("y", -h.height / 2 - E).attr("width", h.width + t.padding).attr("height", h.height + t.padding), a.attr("class", "divider").attr("x1", -h.width / 2 - E).attr("x2", h.width / 2 + E).attr("y1", -h.height / 2 - E + b.height + E).attr("y2", -h.height / 2 - E + b.height + E), B(t, i), t.intersect = function(D) {
1832
+ return C.rect(t, D);
1833
+ }, n;
1834
+ }, "rectWithTitle"), Mr = /* @__PURE__ */ d(async (e, t) => {
1835
+ const { shapeSvg: r, bbox: n } = await F(
1836
+ e,
1837
+ t,
1838
+ K(t, void 0),
1839
+ !0
1840
+ ), i = n.height + t.padding, a = n.width + i / 4 + t.padding, s = r.insert("rect", ":first-child").attr("style", t.style).attr("rx", i / 2).attr("ry", i / 2).attr("x", -a / 2).attr("y", -i / 2).attr("width", a).attr("height", i);
1841
+ return B(t, s), t.intersect = function(l) {
1842
+ return C.rect(t, l);
1843
+ }, r;
1844
+ }, "stadium"), Fr = /* @__PURE__ */ d(async (e, t) => {
1845
+ const { shapeSvg: r, bbox: n, halfPadding: i } = await F(
1846
+ e,
1847
+ t,
1848
+ K(t, void 0),
1849
+ !0
1850
+ ), a = r.insert("circle", ":first-child");
1851
+ return a.attr("style", t.style).attr("rx", t.rx).attr("ry", t.ry).attr("r", n.width / 2 + i).attr("width", n.width + t.padding).attr("height", n.height + t.padding), L.info("Circle main"), B(t, a), t.intersect = function(s) {
1852
+ return L.info("Circle intersect", t, n.width / 2 + i, s), C.circle(t, n.width / 2 + i, s);
1853
+ }, r;
1854
+ }, "circle"), Wr = /* @__PURE__ */ d(async (e, t) => {
1855
+ const { shapeSvg: r, bbox: n, halfPadding: i } = await F(
1856
+ e,
1857
+ t,
1858
+ K(t, void 0),
1859
+ !0
1860
+ ), a = 5, s = r.insert("g", ":first-child"), l = s.insert("circle"), o = s.insert("circle");
1861
+ return s.attr("class", t.class), l.attr("style", t.style).attr("rx", t.rx).attr("ry", t.ry).attr("r", n.width / 2 + i + a).attr("width", n.width + t.padding + a * 2).attr("height", n.height + t.padding + a * 2), o.attr("style", t.style).attr("rx", t.rx).attr("ry", t.ry).attr("r", n.width / 2 + i).attr("width", n.width + t.padding).attr("height", n.height + t.padding), L.info("DoubleCircle main"), B(t, l), t.intersect = function(f) {
1862
+ return L.info("DoubleCircle intersect", t, n.width / 2 + i + a, f), C.circle(t, n.width / 2 + i + a, f);
1863
+ }, r;
1864
+ }, "doublecircle"), Pr = /* @__PURE__ */ d(async (e, t) => {
1865
+ const { shapeSvg: r, bbox: n } = await F(
1866
+ e,
1867
+ t,
1868
+ K(t, void 0),
1869
+ !0
1870
+ ), i = n.width + t.padding, a = n.height + t.padding, s = [
1871
+ { x: 0, y: 0 },
1872
+ { x: i, y: 0 },
1873
+ { x: i, y: -a },
1874
+ { x: 0, y: -a },
1875
+ { x: 0, y: 0 },
1876
+ { x: -8, y: 0 },
1877
+ { x: i + 8, y: 0 },
1878
+ { x: i + 8, y: -a },
1879
+ { x: -8, y: -a },
1880
+ { x: -8, y: 0 }
1881
+ ], l = G(r, i, a, s);
1882
+ return l.attr("style", t.style), B(t, l), t.intersect = function(o) {
1883
+ return C.polygon(t, s, o);
1884
+ }, r;
1885
+ }, "subroutine"), Yr = /* @__PURE__ */ d((e, t) => {
1886
+ const r = e.insert("g").attr("class", "node default").attr("id", t.domId || t.id), n = r.insert("circle", ":first-child");
1887
+ return n.attr("class", "state-start").attr("r", 7).attr("width", 14).attr("height", 14), B(t, n), t.intersect = function(i) {
1888
+ return C.circle(t, 7, i);
1889
+ }, r;
1890
+ }, "start"), Mt = /* @__PURE__ */ d((e, t, r) => {
1891
+ const n = e.insert("g").attr("class", "node default").attr("id", t.domId || t.id);
1892
+ let i = 70, a = 10;
1893
+ r === "LR" && (i = 10, a = 70);
1894
+ const s = n.append("rect").attr("x", -1 * i / 2).attr("y", -1 * a / 2).attr("width", i).attr("height", a).attr("class", "fork-join");
1895
+ return B(t, s), t.height = t.height + t.padding / 2, t.width = t.width + t.padding / 2, t.intersect = function(l) {
1896
+ return C.rect(t, l);
1897
+ }, n;
1898
+ }, "forkJoin"), Hr = /* @__PURE__ */ d((e, t) => {
1899
+ const r = e.insert("g").attr("class", "node default").attr("id", t.domId || t.id), n = r.insert("circle", ":first-child"), i = r.insert("circle", ":first-child");
1900
+ return i.attr("class", "state-start").attr("r", 7).attr("width", 14).attr("height", 14), n.attr("class", "state-end").attr("r", 5).attr("width", 10).attr("height", 10), B(t, i), t.intersect = function(a) {
1901
+ return C.circle(t, 7, a);
1902
+ }, r;
1903
+ }, "end"), Kr = /* @__PURE__ */ d((e, t) => {
1904
+ var S;
1905
+ const r = t.padding / 2, n = 4, i = 8;
1906
+ let a;
1907
+ t.classes ? a = "node " + t.classes : a = "node default";
1908
+ const s = e.insert("g").attr("class", a).attr("id", t.domId || t.id), l = s.insert("rect", ":first-child"), o = s.insert("line"), f = s.insert("line");
1909
+ let h = 0, y = n;
1910
+ const b = s.insert("g").attr("class", "label");
1911
+ let m = 0;
1912
+ const E = (S = t.classData.annotations) == null ? void 0 : S[0], D = t.classData.annotations[0] ? "\xAB" + t.classData.annotations[0] + "\xBB" : "", v = b.node().appendChild(j(D, t.labelStyle, !0, !0));
1913
+ let T = v.getBBox();
1914
+ if (Z(z().flowchart.htmlLabels)) {
1915
+ const c = v.children[0], _ = R(v);
1916
+ T = c.getBoundingClientRect(), _.attr("width", T.width), _.attr("height", T.height);
1917
+ }
1918
+ t.classData.annotations[0] && (y += T.height + n, h += T.width);
1919
+ let k = t.classData.label;
1920
+ t.classData.type !== void 0 && t.classData.type !== "" && (z().flowchart.htmlLabels ? k += "&lt;" + t.classData.type + "&gt;" : k += "<" + t.classData.type + ">");
1921
+ const N = b.node().appendChild(j(k, t.labelStyle, !0, !0));
1922
+ R(N).attr("class", "classTitle");
1923
+ let x = N.getBBox();
1924
+ if (Z(z().flowchart.htmlLabels)) {
1925
+ const c = N.children[0], _ = R(N);
1926
+ x = c.getBoundingClientRect(), _.attr("width", x.width), _.attr("height", x.height);
1927
+ }
1928
+ y += x.height + n, x.width > h && (h = x.width);
1929
+ const g = [];
1930
+ t.classData.members.forEach((c) => {
1931
+ const _ = c.getDisplayDetails();
1932
+ let p = _.displayText;
1933
+ z().flowchart.htmlLabels && (p = p.replace(/</g, "&lt;").replace(/>/g, "&gt;"));
1934
+ const A = b.node().appendChild(
1935
+ j(
1936
+ p,
1937
+ _.cssStyle ? _.cssStyle : t.labelStyle,
1938
+ !0,
1939
+ !0
1940
+ )
1941
+ );
1942
+ let O = A.getBBox();
1943
+ if (Z(z().flowchart.htmlLabels)) {
1944
+ const X = A.children[0], W = R(A);
1945
+ O = X.getBoundingClientRect(), W.attr("width", O.width), W.attr("height", O.height);
1946
+ }
1947
+ O.width > h && (h = O.width), y += O.height + n, g.push(A);
1948
+ }), y += i;
1949
+ const u = [];
1950
+ if (t.classData.methods.forEach((c) => {
1951
+ const _ = c.getDisplayDetails();
1952
+ let p = _.displayText;
1953
+ z().flowchart.htmlLabels && (p = p.replace(/</g, "&lt;").replace(/>/g, "&gt;"));
1954
+ const A = b.node().appendChild(
1955
+ j(
1956
+ p,
1957
+ _.cssStyle ? _.cssStyle : t.labelStyle,
1958
+ !0,
1959
+ !0
1960
+ )
1961
+ );
1962
+ let O = A.getBBox();
1963
+ if (Z(z().flowchart.htmlLabels)) {
1964
+ const X = A.children[0], W = R(A);
1965
+ O = X.getBoundingClientRect(), W.attr("width", O.width), W.attr("height", O.height);
1966
+ }
1967
+ O.width > h && (h = O.width), y += O.height + n, u.push(A);
1968
+ }), y += i, E) {
1969
+ let c = (h - T.width) / 2;
1970
+ R(v).attr(
1971
+ "transform",
1972
+ "translate( " + (-1 * h / 2 + c) + ", " + -1 * y / 2 + ")"
1973
+ ), m = T.height + n;
1974
+ }
1975
+ let w = (h - x.width) / 2;
1976
+ return R(N).attr(
1977
+ "transform",
1978
+ "translate( " + (-1 * h / 2 + w) + ", " + (-1 * y / 2 + m) + ")"
1979
+ ), m += x.height + n, o.attr("class", "divider").attr("x1", -h / 2 - r).attr("x2", h / 2 + r).attr("y1", -y / 2 - r + i + m).attr("y2", -y / 2 - r + i + m), m += i, g.forEach((c) => {
1980
+ R(c).attr(
1981
+ "transform",
1982
+ "translate( " + -h / 2 + ", " + (-1 * y / 2 + m + i / 2) + ")"
1983
+ );
1984
+ const _ = c == null ? void 0 : c.getBBox();
1985
+ m += ((_ == null ? void 0 : _.height) ?? 0) + n;
1986
+ }), m += i, f.attr("class", "divider").attr("x1", -h / 2 - r).attr("x2", h / 2 + r).attr("y1", -y / 2 - r + i + m).attr("y2", -y / 2 - r + i + m), m += i, u.forEach((c) => {
1987
+ R(c).attr(
1988
+ "transform",
1989
+ "translate( " + -h / 2 + ", " + (-1 * y / 2 + m) + ")"
1990
+ );
1991
+ const _ = c == null ? void 0 : c.getBBox();
1992
+ m += ((_ == null ? void 0 : _.height) ?? 0) + n;
1993
+ }), l.attr("style", t.style).attr("class", "outer title-state").attr("x", -h / 2 - r).attr("y", -(y / 2) - r).attr("width", h + t.padding).attr("height", y + t.padding), B(t, l), t.intersect = function(c) {
1994
+ return C.rect(t, c);
1995
+ }, s;
1996
+ }, "class_box"), Ft = {
1997
+ rhombus: At,
1998
+ composite: Rr,
1999
+ question: At,
2000
+ rect: Or,
2001
+ labelRect: zr,
2002
+ rectWithTitle: Ar,
2003
+ choice: vr,
2004
+ circle: Fr,
2005
+ doublecircle: Wr,
2006
+ stadium: Mr,
2007
+ hexagon: Er,
2008
+ block_arrow: _r,
2009
+ rect_left_inv_arrow: kr,
2010
+ lean_right: Dr,
2011
+ lean_left: Nr,
2012
+ trapezoid: Tr,
2013
+ inv_trapezoid: Cr,
2014
+ rect_right_inv_arrow: Br,
2015
+ cylinder: Ir,
2016
+ start: Yr,
2017
+ end: Hr,
2018
+ note: Sr,
2019
+ subroutine: Pr,
2020
+ fork: Mt,
2021
+ join: Mt,
2022
+ class_box: Kr
2023
+ }, lt = {}, re = /* @__PURE__ */ d(async (e, t, r) => {
2024
+ let n, i;
2025
+ if (t.link) {
2026
+ let a;
2027
+ z().securityLevel === "sandbox" ? a = "_top" : t.linkTarget && (a = t.linkTarget || "_blank"), n = e.insert("svg:a").attr("xlink:href", t.link).attr("target", a), i = await Ft[t.shape](n, t, r);
2028
+ } else
2029
+ i = await Ft[t.shape](e, t, r), n = i;
2030
+ return t.tooltip && i.attr("title", t.tooltip), t.class && i.attr("class", "node default " + t.class), lt[t.id] = n, t.haveCallback && lt[t.id].attr("class", lt[t.id].attr("class") + " clickable"), n;
2031
+ }, "insertNode"), Xr = /* @__PURE__ */ d((e) => {
2032
+ const t = lt[e.id];
2033
+ L.trace(
2034
+ "Transforming node",
2035
+ e.diff,
2036
+ e,
2037
+ "translate(" + (e.x - e.width / 2 - 5) + ", " + e.width / 2 + ")"
2038
+ );
2039
+ const r = 8, n = e.diff || 0;
2040
+ return e.clusterNode ? t.attr(
2041
+ "transform",
2042
+ "translate(" + (e.x + n - e.width / 2) + ", " + (e.y - e.height / 2 - r) + ")"
2043
+ ) : t.attr("transform", "translate(" + e.x + ", " + e.y + ")"), n;
2044
+ }, "positionNode");
2045
+ function kt(e, t, r = !1) {
2046
+ var b, m, E;
2047
+ const n = e;
2048
+ let i = "default";
2049
+ (((b = n == null ? void 0 : n.classes) == null ? void 0 : b.length) || 0) > 0 && (i = ((n == null ? void 0 : n.classes) ?? []).join(" ")), i = i + " flowchart-label";
2050
+ let a = 0, s = "", l;
2051
+ switch (n.type) {
2052
+ case "round":
2053
+ a = 5, s = "rect";
2054
+ break;
2055
+ case "composite":
2056
+ a = 0, s = "composite", l = 0;
2057
+ break;
2058
+ case "square":
2059
+ s = "rect";
2060
+ break;
2061
+ case "diamond":
2062
+ s = "question";
2063
+ break;
2064
+ case "hexagon":
2065
+ s = "hexagon";
2066
+ break;
2067
+ case "block_arrow":
2068
+ s = "block_arrow";
2069
+ break;
2070
+ case "odd":
2071
+ s = "rect_left_inv_arrow";
2072
+ break;
2073
+ case "lean_right":
2074
+ s = "lean_right";
2075
+ break;
2076
+ case "lean_left":
2077
+ s = "lean_left";
2078
+ break;
2079
+ case "trapezoid":
2080
+ s = "trapezoid";
2081
+ break;
2082
+ case "inv_trapezoid":
2083
+ s = "inv_trapezoid";
2084
+ break;
2085
+ case "rect_left_inv_arrow":
2086
+ s = "rect_left_inv_arrow";
2087
+ break;
2088
+ case "circle":
2089
+ s = "circle";
2090
+ break;
2091
+ case "ellipse":
2092
+ s = "ellipse";
2093
+ break;
2094
+ case "stadium":
2095
+ s = "stadium";
2096
+ break;
2097
+ case "subroutine":
2098
+ s = "subroutine";
2099
+ break;
2100
+ case "cylinder":
2101
+ s = "cylinder";
2102
+ break;
2103
+ case "group":
2104
+ s = "rect";
2105
+ break;
2106
+ case "doublecircle":
2107
+ s = "doublecircle";
2108
+ break;
2109
+ default:
2110
+ s = "rect";
2111
+ }
2112
+ const o = de((n == null ? void 0 : n.styles) ?? []), f = n.label, h = n.size ?? { width: 0, height: 0, x: 0, y: 0 };
2113
+ return {
2114
+ labelStyle: o.labelStyle,
2115
+ shape: s,
2116
+ labelText: f,
2117
+ rx: a,
2118
+ ry: a,
2119
+ class: i,
2120
+ style: o.style,
2121
+ id: n.id,
2122
+ directions: n.directions,
2123
+ width: h.width,
2124
+ height: h.height,
2125
+ x: h.x,
2126
+ y: h.y,
2127
+ positioned: r,
2128
+ intersect: void 0,
2129
+ type: n.type,
2130
+ padding: l ?? ((E = (m = at()) == null ? void 0 : m.block) == null ? void 0 : E.padding) ?? 0
2131
+ };
2132
+ }
2133
+ d(kt, "getNodeFromBlock");
2134
+ async function ae(e, t, r) {
2135
+ const n = kt(t, r, !1);
2136
+ if (n.type === "group")
2137
+ return;
2138
+ const i = at(), a = await re(e, n, { config: i }), s = a.node().getBBox(), l = r.getBlock(n.id);
2139
+ l.size = { width: s.width, height: s.height, x: 0, y: 0, node: a }, r.setBlock(l), a.remove();
2140
+ }
2141
+ d(ae, "calculateBlockSize");
2142
+ async function se(e, t, r) {
2143
+ const n = kt(t, r, !0);
2144
+ if (r.getBlock(n.id).type !== "space") {
2145
+ const a = at();
2146
+ await re(e, n, { config: a }), t.intersect = n == null ? void 0 : n.intersect, Xr(n);
2147
+ }
2148
+ }
2149
+ d(se, "insertBlockPositioned");
2150
+ async function dt(e, t, r, n) {
2151
+ for (const i of t)
2152
+ await n(e, i, r), i.children && await dt(e, i.children, r, n);
2153
+ }
2154
+ d(dt, "performOperations");
2155
+ async function ie(e, t, r) {
2156
+ await dt(e, t, r, ae);
2157
+ }
2158
+ d(ie, "calculateBlockSizes");
2159
+ async function ne(e, t, r) {
2160
+ await dt(e, t, r, se);
2161
+ }
2162
+ d(ne, "insertBlocks");
2163
+ async function le(e, t, r, n, i) {
2164
+ const a = new Se({
2165
+ multigraph: !0,
2166
+ compound: !0
2167
+ });
2168
+ a.setGraph({
2169
+ rankdir: "TB",
2170
+ nodesep: 10,
2171
+ ranksep: 10,
2172
+ marginx: 8,
2173
+ marginy: 8
2174
+ });
2175
+ for (const s of r)
2176
+ s.size && a.setNode(s.id, {
2177
+ width: s.size.width,
2178
+ height: s.size.height,
2179
+ intersect: s.intersect
2180
+ });
2181
+ for (const s of t)
2182
+ if (s.start && s.end) {
2183
+ const l = n.getBlock(s.start), o = n.getBlock(s.end);
2184
+ if (l != null && l.size && (o != null && o.size)) {
2185
+ const f = l.size, h = o.size, y = [
2186
+ { x: f.x, y: f.y },
2187
+ { x: f.x + (h.x - f.x) / 2, y: f.y + (h.y - f.y) / 2 },
2188
+ { x: h.x, y: h.y }
2189
+ ];
2190
+ gr(
2191
+ e,
2192
+ { v: s.start, w: s.end, name: s.id },
2193
+ {
2194
+ ...s,
2195
+ arrowTypeEnd: s.arrowTypeEnd,
2196
+ arrowTypeStart: s.arrowTypeStart,
2197
+ points: y,
2198
+ classes: "edge-thickness-normal edge-pattern-solid flowchart-link LS-a1 LE-b1"
2199
+ },
2200
+ void 0,
2201
+ "block",
2202
+ a,
2203
+ i
2204
+ ), s.label && (await cr(e, {
2205
+ ...s,
2206
+ label: s.label,
2207
+ labelStyle: "stroke: #333; stroke-width: 1.5px;fill:none;",
2208
+ arrowTypeEnd: s.arrowTypeEnd,
2209
+ arrowTypeStart: s.arrowTypeStart,
2210
+ points: y,
2211
+ classes: "edge-thickness-normal edge-pattern-solid flowchart-link LS-a1 LE-b1"
2212
+ }), or(
2213
+ { ...s, x: y[1].x, y: y[1].y },
2214
+ {
2215
+ originalPath: y
2216
+ }
2217
+ ));
2218
+ }
2219
+ }
2220
+ }
2221
+ d(le, "insertEdges");
2222
+ var Ur = /* @__PURE__ */ d(function(e, t) {
2223
+ return t.db.getClasses();
2224
+ }, "getClasses"), jr = /* @__PURE__ */ d(async function(e, t, r, n) {
2225
+ const { securityLevel: i, block: a } = at(), s = n.db;
2226
+ let l;
2227
+ i === "sandbox" && (l = R("#i" + t));
2228
+ const o = i === "sandbox" ? R(l.nodes()[0].contentDocument.body) : R("body"), f = i === "sandbox" ? o.select(`[id="${t}"]`) : R(`[id="${t}"]`);
2229
+ ar(f, ["point", "circle", "cross"], n.type, t);
2230
+ const y = s.getBlocks(), b = s.getBlocksFlat(), m = s.getEdges(), E = f.insert("g").attr("class", "block");
2231
+ await ie(E, y, s);
2232
+ const D = Gt(s);
2233
+ if (await ne(E, y, s), await le(E, m, b, s, t), D) {
2234
+ const v = D, T = Math.max(1, Math.round(0.125 * (v.width / v.height))), k = v.height + T + 10, N = v.width + 10, { useMaxWidth: x } = a;
2235
+ fe(f, k, N, !!x), L.debug("Here Bounds", D, v), f.attr(
2236
+ "viewBox",
2237
+ `${v.x - 5} ${v.y - 5} ${v.width + 10} ${v.height + 10}`
2238
+ );
2239
+ }
2240
+ }, "draw"), Vr = {
2241
+ draw: jr,
2242
+ getClasses: Ur
2243
+ }, ta = {
2244
+ parser: Ee,
2245
+ db: Ke,
2246
+ renderer: Vr,
2247
+ styles: Ue
2248
+ };
2249
+ export {
2250
+ ta as diagram
2251
+ };