bg-editor 0.0.1

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