@data_wise/hyper-markdown 1.0.0

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