@oxide/design-system 1.7.7--canary.fc65d31.0 → 1.7.7--canary.5c25e1b.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (130) hide show
  1. package/components/dist/index.d.ts +2 -5
  2. package/components/dist/index.js +126 -1729
  3. package/components/dist/index.js.map +1 -1
  4. package/package.json +1 -2
  5. package/components/dist/architecture-I3QFYML2-YZWO3N3B.js +0 -14
  6. package/components/dist/architecture-I3QFYML2-YZWO3N3B.js.map +0 -1
  7. package/components/dist/architectureDiagram-UYN6MBPD-HXPGIDN7.js +0 -8846
  8. package/components/dist/architectureDiagram-UYN6MBPD-HXPGIDN7.js.map +0 -1
  9. package/components/dist/blockDiagram-ZHA2E4KO-OAYYKCLF.js +0 -3721
  10. package/components/dist/blockDiagram-ZHA2E4KO-OAYYKCLF.js.map +0 -1
  11. package/components/dist/c4Diagram-6F5ED5ID-TBHFK2XY.js +0 -2599
  12. package/components/dist/c4Diagram-6F5ED5ID-TBHFK2XY.js.map +0 -1
  13. package/components/dist/chunk-2DDKDUUO.js +0 -439
  14. package/components/dist/chunk-2DDKDUUO.js.map +0 -1
  15. package/components/dist/chunk-2NHDMTP7.js +0 -26905
  16. package/components/dist/chunk-2NHDMTP7.js.map +0 -1
  17. package/components/dist/chunk-4IJS44L3.js +0 -22
  18. package/components/dist/chunk-4IJS44L3.js.map +0 -1
  19. package/components/dist/chunk-562WOS3Z.js +0 -1109
  20. package/components/dist/chunk-562WOS3Z.js.map +0 -1
  21. package/components/dist/chunk-6UD2HOKB.js +0 -17082
  22. package/components/dist/chunk-6UD2HOKB.js.map +0 -1
  23. package/components/dist/chunk-76BOQ7BT.js +0 -63
  24. package/components/dist/chunk-76BOQ7BT.js.map +0 -1
  25. package/components/dist/chunk-7I5DT373.js +0 -97
  26. package/components/dist/chunk-7I5DT373.js.map +0 -1
  27. package/components/dist/chunk-BPREMNVP.js +0 -1875
  28. package/components/dist/chunk-BPREMNVP.js.map +0 -1
  29. package/components/dist/chunk-BVYAEHG3.js +0 -122
  30. package/components/dist/chunk-BVYAEHG3.js.map +0 -1
  31. package/components/dist/chunk-BW7DFBOS.js +0 -152
  32. package/components/dist/chunk-BW7DFBOS.js.map +0 -1
  33. package/components/dist/chunk-EZG2MNHW.js +0 -59
  34. package/components/dist/chunk-EZG2MNHW.js.map +0 -1
  35. package/components/dist/chunk-G6QWNAHJ.js +0 -43
  36. package/components/dist/chunk-G6QWNAHJ.js.map +0 -1
  37. package/components/dist/chunk-H72D3HRR.js +0 -1244
  38. package/components/dist/chunk-H72D3HRR.js.map +0 -1
  39. package/components/dist/chunk-K532NZMW.js +0 -46
  40. package/components/dist/chunk-K532NZMW.js.map +0 -1
  41. package/components/dist/chunk-LC3BX2KL.js +0 -25
  42. package/components/dist/chunk-LC3BX2KL.js.map +0 -1
  43. package/components/dist/chunk-LQ2ABR7F.js +0 -5665
  44. package/components/dist/chunk-LQ2ABR7F.js.map +0 -1
  45. package/components/dist/chunk-M6L3MM6K.js +0 -22
  46. package/components/dist/chunk-M6L3MM6K.js.map +0 -1
  47. package/components/dist/chunk-MWA4PRRW.js +0 -122
  48. package/components/dist/chunk-MWA4PRRW.js.map +0 -1
  49. package/components/dist/chunk-ND3FLKHU.js +0 -570
  50. package/components/dist/chunk-ND3FLKHU.js.map +0 -1
  51. package/components/dist/chunk-NIVHLOPB.js +0 -2621
  52. package/components/dist/chunk-NIVHLOPB.js.map +0 -1
  53. package/components/dist/chunk-R6F6FFK7.js +0 -65
  54. package/components/dist/chunk-R6F6FFK7.js.map +0 -1
  55. package/components/dist/chunk-RN5R3L7O.js +0 -2041
  56. package/components/dist/chunk-RN5R3L7O.js.map +0 -1
  57. package/components/dist/chunk-RWDBBMDN.js +0 -10910
  58. package/components/dist/chunk-RWDBBMDN.js.map +0 -1
  59. package/components/dist/chunk-T7HPDS4Z.js +0 -573
  60. package/components/dist/chunk-T7HPDS4Z.js.map +0 -1
  61. package/components/dist/chunk-TG4YEU4Q.js +0 -23
  62. package/components/dist/chunk-TG4YEU4Q.js.map +0 -1
  63. package/components/dist/chunk-U5WCXBW2.js +0 -48
  64. package/components/dist/chunk-U5WCXBW2.js.map +0 -1
  65. package/components/dist/chunk-V6PWN6OH.js +0 -1875
  66. package/components/dist/chunk-V6PWN6OH.js.map +0 -1
  67. package/components/dist/chunk-VLTHNCSD.js +0 -48
  68. package/components/dist/chunk-VLTHNCSD.js.map +0 -1
  69. package/components/dist/chunk-WDK4G4UR.js +0 -2791
  70. package/components/dist/chunk-WDK4G4UR.js.map +0 -1
  71. package/components/dist/chunk-WLVQWTC6.js +0 -77
  72. package/components/dist/chunk-WLVQWTC6.js.map +0 -1
  73. package/components/dist/chunk-YDLS5R4M.js +0 -48
  74. package/components/dist/chunk-YDLS5R4M.js.map +0 -1
  75. package/components/dist/chunk-YGFBWU2Q.js +0 -7
  76. package/components/dist/chunk-YGFBWU2Q.js.map +0 -1
  77. package/components/dist/chunk-ZBL4CWCH.js +0 -2120
  78. package/components/dist/chunk-ZBL4CWCH.js.map +0 -1
  79. package/components/dist/classDiagram-LNE6IOMH-VRQHEQWM.js +0 -40
  80. package/components/dist/classDiagram-LNE6IOMH-VRQHEQWM.js.map +0 -1
  81. package/components/dist/classDiagram-v2-MQ7JQ4JX-5GB4NXXM.js +0 -40
  82. package/components/dist/classDiagram-v2-MQ7JQ4JX-5GB4NXXM.js.map +0 -1
  83. package/components/dist/dagre-4EVJKHTY-XW45LMKR.js +0 -734
  84. package/components/dist/dagre-4EVJKHTY-XW45LMKR.js.map +0 -1
  85. package/components/dist/diagram-QW4FP2JN-J2YMUPB5.js +0 -226
  86. package/components/dist/diagram-QW4FP2JN-J2YMUPB5.js.map +0 -1
  87. package/components/dist/erDiagram-6RL3IURR-HQULDVJI.js +0 -1381
  88. package/components/dist/erDiagram-6RL3IURR-HQULDVJI.js.map +0 -1
  89. package/components/dist/flowDiagram-7ASYPVHJ-2542732I.js +0 -2349
  90. package/components/dist/flowDiagram-7ASYPVHJ-2542732I.js.map +0 -1
  91. package/components/dist/ganttDiagram-NTVNEXSI-V66YQQB3.js +0 -2413
  92. package/components/dist/ganttDiagram-NTVNEXSI-V66YQQB3.js.map +0 -1
  93. package/components/dist/gitGraph-YCYPL57B-AAXPWQN7.js +0 -14
  94. package/components/dist/gitGraph-YCYPL57B-AAXPWQN7.js.map +0 -1
  95. package/components/dist/gitGraphDiagram-NRZ2UAAF-5DU6QMYZ.js +0 -1763
  96. package/components/dist/gitGraphDiagram-NRZ2UAAF-5DU6QMYZ.js.map +0 -1
  97. package/components/dist/info-46DW6VJ7-43TTIEYF.js +0 -14
  98. package/components/dist/info-46DW6VJ7-43TTIEYF.js.map +0 -1
  99. package/components/dist/infoDiagram-A4XQUW5V-UZERSQDI.js +0 -54
  100. package/components/dist/infoDiagram-A4XQUW5V-UZERSQDI.js.map +0 -1
  101. package/components/dist/journeyDiagram-G5WM74LC-RVKMRGRW.js +0 -1244
  102. package/components/dist/journeyDiagram-G5WM74LC-RVKMRGRW.js.map +0 -1
  103. package/components/dist/kanban-definition-QRCXZQQD-NWU5I3TK.js +0 -1119
  104. package/components/dist/kanban-definition-QRCXZQQD-NWU5I3TK.js.map +0 -1
  105. package/components/dist/katex-WNZY3CE5.js +0 -14484
  106. package/components/dist/katex-WNZY3CE5.js.map +0 -1
  107. package/components/dist/mindmap-definition-GWI6TPTV-MISEH6LG.js +0 -6013
  108. package/components/dist/mindmap-definition-GWI6TPTV-MISEH6LG.js.map +0 -1
  109. package/components/dist/packet-W2GHVCYJ-FBZCFIPR.js +0 -14
  110. package/components/dist/packet-W2GHVCYJ-FBZCFIPR.js.map +0 -1
  111. package/components/dist/pie-BEWT4RHE-UFFBBCXM.js +0 -14
  112. package/components/dist/pie-BEWT4RHE-UFFBBCXM.js.map +0 -1
  113. package/components/dist/pieDiagram-YF2LJOPJ-IXEVHPCM.js +0 -223
  114. package/components/dist/pieDiagram-YF2LJOPJ-IXEVHPCM.js.map +0 -1
  115. package/components/dist/quadrantDiagram-OS5C2QUG-MW26UCZV.js +0 -1408
  116. package/components/dist/quadrantDiagram-OS5C2QUG-MW26UCZV.js.map +0 -1
  117. package/components/dist/requirementDiagram-MIRIMTAZ-BX24AAHL.js +0 -1175
  118. package/components/dist/requirementDiagram-MIRIMTAZ-BX24AAHL.js.map +0 -1
  119. package/components/dist/sankeyDiagram-Y46BX6SQ-5RKUGG63.js +0 -1278
  120. package/components/dist/sankeyDiagram-Y46BX6SQ-5RKUGG63.js.map +0 -1
  121. package/components/dist/sequenceDiagram-G6AWOVSC-2T3JBUZ2.js +0 -3529
  122. package/components/dist/sequenceDiagram-G6AWOVSC-2T3JBUZ2.js.map +0 -1
  123. package/components/dist/stateDiagram-MAYHULR4-HZ5EGLPA.js +0 -505
  124. package/components/dist/stateDiagram-MAYHULR4-HZ5EGLPA.js.map +0 -1
  125. package/components/dist/stateDiagram-v2-4JROLMXI-DN2FEZV3.js +0 -40
  126. package/components/dist/stateDiagram-v2-4JROLMXI-DN2FEZV3.js.map +0 -1
  127. package/components/dist/timeline-definition-U7ZMHBDA-GB6AKKW4.js +0 -1260
  128. package/components/dist/timeline-definition-U7ZMHBDA-GB6AKKW4.js.map +0 -1
  129. package/components/dist/xychartDiagram-6QU3TZC5-BFFLEHUP.js +0 -1877
  130. package/components/dist/xychartDiagram-6QU3TZC5-BFFLEHUP.js.map +0 -1
@@ -1,3721 +0,0 @@
1
- import {
2
- getLineFunctionsWithOffset
3
- } from "./chunk-BW7DFBOS.js";
4
- import {
5
- getSubGraphTitleMargins
6
- } from "./chunk-M6L3MM6K.js";
7
- import {
8
- createText,
9
- replaceIconSubstring
10
- } from "./chunk-NIVHLOPB.js";
11
- import {
12
- Graph
13
- } from "./chunk-2DDKDUUO.js";
14
- import {
15
- decodeEntities,
16
- getStylesFromArray,
17
- utils_default
18
- } from "./chunk-T7HPDS4Z.js";
19
- import "./chunk-7I5DT373.js";
20
- import {
21
- __name,
22
- basis_default,
23
- channel_default,
24
- clear,
25
- common_default,
26
- configureSvgSize,
27
- evaluate,
28
- getConfig,
29
- getConfig2,
30
- line_default,
31
- log,
32
- rgba_default,
33
- sanitizeText,
34
- select_default
35
- } from "./chunk-RWDBBMDN.js";
36
- import {
37
- clone_default
38
- } from "./chunk-ZBL4CWCH.js";
39
- import "./chunk-BVYAEHG3.js";
40
- import "./chunk-562WOS3Z.js";
41
- import "./chunk-K532NZMW.js";
42
-
43
- // node_modules/mermaid/dist/chunks/mermaid.core/blockDiagram-ZHA2E4KO.mjs
44
- var parser = function() {
45
- var o = /* @__PURE__ */ __name(function(k, v, o2, l) {
46
- for (o2 = o2 || {}, l = k.length; l--; o2[k[l]] = v)
47
- ;
48
- return o2;
49
- }, "o"), $V0 = [1, 7], $V1 = [1, 13], $V2 = [1, 14], $V3 = [1, 15], $V4 = [1, 19], $V5 = [1, 16], $V6 = [1, 17], $V7 = [1, 18], $V8 = [8, 30], $V9 = [8, 21, 28, 29, 30, 31, 32, 40, 44, 47], $Va = [1, 23], $Vb = [1, 24], $Vc = [8, 15, 16, 21, 28, 29, 30, 31, 32, 40, 44, 47], $Vd = [8, 15, 16, 21, 27, 28, 29, 30, 31, 32, 40, 44, 47], $Ve = [1, 49];
50
- var parser2 = {
51
- trace: /* @__PURE__ */ __name(function trace() {
52
- }, "trace"),
53
- yy: {},
54
- symbols_: { "error": 2, "spaceLines": 3, "SPACELINE": 4, "NL": 5, "separator": 6, "SPACE": 7, "EOF": 8, "start": 9, "BLOCK_DIAGRAM_KEY": 10, "document": 11, "stop": 12, "statement": 13, "link": 14, "LINK": 15, "START_LINK": 16, "LINK_LABEL": 17, "STR": 18, "nodeStatement": 19, "columnsStatement": 20, "SPACE_BLOCK": 21, "blockStatement": 22, "classDefStatement": 23, "cssClassStatement": 24, "styleStatement": 25, "node": 26, "SIZE": 27, "COLUMNS": 28, "id-block": 29, "end": 30, "block": 31, "NODE_ID": 32, "nodeShapeNLabel": 33, "dirList": 34, "DIR": 35, "NODE_DSTART": 36, "NODE_DEND": 37, "BLOCK_ARROW_START": 38, "BLOCK_ARROW_END": 39, "classDef": 40, "CLASSDEF_ID": 41, "CLASSDEF_STYLEOPTS": 42, "DEFAULT": 43, "class": 44, "CLASSENTITY_IDS": 45, "STYLECLASS": 46, "style": 47, "STYLE_ENTITY_IDS": 48, "STYLE_DEFINITION_DATA": 49, "$accept": 0, "$end": 1 },
55
- terminals_: { 2: "error", 4: "SPACELINE", 5: "NL", 7: "SPACE", 8: "EOF", 10: "BLOCK_DIAGRAM_KEY", 15: "LINK", 16: "START_LINK", 17: "LINK_LABEL", 18: "STR", 21: "SPACE_BLOCK", 27: "SIZE", 28: "COLUMNS", 29: "id-block", 30: "end", 31: "block", 32: "NODE_ID", 35: "DIR", 36: "NODE_DSTART", 37: "NODE_DEND", 38: "BLOCK_ARROW_START", 39: "BLOCK_ARROW_END", 40: "classDef", 41: "CLASSDEF_ID", 42: "CLASSDEF_STYLEOPTS", 43: "DEFAULT", 44: "class", 45: "CLASSENTITY_IDS", 46: "STYLECLASS", 47: "style", 48: "STYLE_ENTITY_IDS", 49: "STYLE_DEFINITION_DATA" },
56
- productions_: [0, [3, 1], [3, 2], [3, 2], [6, 1], [6, 1], [6, 1], [9, 3], [12, 1], [12, 1], [12, 2], [12, 2], [11, 1], [11, 2], [14, 1], [14, 4], [13, 1], [13, 1], [13, 1], [13, 1], [13, 1], [13, 1], [13, 1], [19, 3], [19, 2], [19, 1], [20, 1], [22, 4], [22, 3], [26, 1], [26, 2], [34, 1], [34, 2], [33, 3], [33, 4], [23, 3], [23, 3], [24, 3], [25, 3]],
57
- performAction: /* @__PURE__ */ __name(function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) {
58
- var $0 = $$.length - 1;
59
- switch (yystate) {
60
- case 4:
61
- yy.getLogger().debug("Rule: separator (NL) ");
62
- break;
63
- case 5:
64
- yy.getLogger().debug("Rule: separator (Space) ");
65
- break;
66
- case 6:
67
- yy.getLogger().debug("Rule: separator (EOF) ");
68
- break;
69
- case 7:
70
- yy.getLogger().debug("Rule: hierarchy: ", $$[$0 - 1]);
71
- yy.setHierarchy($$[$0 - 1]);
72
- break;
73
- case 8:
74
- yy.getLogger().debug("Stop NL ");
75
- break;
76
- case 9:
77
- yy.getLogger().debug("Stop EOF ");
78
- break;
79
- case 10:
80
- yy.getLogger().debug("Stop NL2 ");
81
- break;
82
- case 11:
83
- yy.getLogger().debug("Stop EOF2 ");
84
- break;
85
- case 12:
86
- yy.getLogger().debug("Rule: statement: ", $$[$0]);
87
- typeof $$[$0].length === "number" ? this.$ = $$[$0] : this.$ = [$$[$0]];
88
- break;
89
- case 13:
90
- yy.getLogger().debug("Rule: statement #2: ", $$[$0 - 1]);
91
- this.$ = [$$[$0 - 1]].concat($$[$0]);
92
- break;
93
- case 14:
94
- yy.getLogger().debug("Rule: link: ", $$[$0], yytext);
95
- this.$ = { edgeTypeStr: $$[$0], label: "" };
96
- break;
97
- case 15:
98
- yy.getLogger().debug("Rule: LABEL link: ", $$[$0 - 3], $$[$0 - 1], $$[$0]);
99
- this.$ = { edgeTypeStr: $$[$0], label: $$[$0 - 1] };
100
- break;
101
- case 18:
102
- const num = parseInt($$[$0]);
103
- const spaceId = yy.generateId();
104
- this.$ = { id: spaceId, type: "space", label: "", width: num, children: [] };
105
- break;
106
- case 23:
107
- yy.getLogger().debug("Rule: (nodeStatement link node) ", $$[$0 - 2], $$[$0 - 1], $$[$0], " typestr: ", $$[$0 - 1].edgeTypeStr);
108
- const edgeData = yy.edgeStrToEdgeData($$[$0 - 1].edgeTypeStr);
109
- this.$ = [
110
- { id: $$[$0 - 2].id, label: $$[$0 - 2].label, type: $$[$0 - 2].type, directions: $$[$0 - 2].directions },
111
- { id: $$[$0 - 2].id + "-" + $$[$0].id, start: $$[$0 - 2].id, end: $$[$0].id, label: $$[$0 - 1].label, type: "edge", directions: $$[$0].directions, arrowTypeEnd: edgeData, arrowTypeStart: "arrow_open" },
112
- { id: $$[$0].id, label: $$[$0].label, type: yy.typeStr2Type($$[$0].typeStr), directions: $$[$0].directions }
113
- ];
114
- break;
115
- case 24:
116
- yy.getLogger().debug("Rule: nodeStatement (abc88 node size) ", $$[$0 - 1], $$[$0]);
117
- this.$ = { id: $$[$0 - 1].id, label: $$[$0 - 1].label, type: yy.typeStr2Type($$[$0 - 1].typeStr), directions: $$[$0 - 1].directions, widthInColumns: parseInt($$[$0], 10) };
118
- break;
119
- case 25:
120
- yy.getLogger().debug("Rule: nodeStatement (node) ", $$[$0]);
121
- this.$ = { id: $$[$0].id, label: $$[$0].label, type: yy.typeStr2Type($$[$0].typeStr), directions: $$[$0].directions, widthInColumns: 1 };
122
- break;
123
- case 26:
124
- yy.getLogger().debug("APA123", this ? this : "na");
125
- yy.getLogger().debug("COLUMNS: ", $$[$0]);
126
- this.$ = { type: "column-setting", columns: $$[$0] === "auto" ? -1 : parseInt($$[$0]) };
127
- break;
128
- case 27:
129
- yy.getLogger().debug("Rule: id-block statement : ", $$[$0 - 2], $$[$0 - 1]);
130
- const id2 = yy.generateId();
131
- this.$ = { ...$$[$0 - 2], type: "composite", children: $$[$0 - 1] };
132
- break;
133
- case 28:
134
- yy.getLogger().debug("Rule: blockStatement : ", $$[$0 - 2], $$[$0 - 1], $$[$0]);
135
- const id = yy.generateId();
136
- this.$ = { id, type: "composite", label: "", children: $$[$0 - 1] };
137
- break;
138
- case 29:
139
- yy.getLogger().debug("Rule: node (NODE_ID separator): ", $$[$0]);
140
- this.$ = { id: $$[$0] };
141
- break;
142
- case 30:
143
- yy.getLogger().debug("Rule: node (NODE_ID nodeShapeNLabel separator): ", $$[$0 - 1], $$[$0]);
144
- this.$ = { id: $$[$0 - 1], label: $$[$0].label, typeStr: $$[$0].typeStr, directions: $$[$0].directions };
145
- break;
146
- case 31:
147
- yy.getLogger().debug("Rule: dirList: ", $$[$0]);
148
- this.$ = [$$[$0]];
149
- break;
150
- case 32:
151
- yy.getLogger().debug("Rule: dirList: ", $$[$0 - 1], $$[$0]);
152
- this.$ = [$$[$0 - 1]].concat($$[$0]);
153
- break;
154
- case 33:
155
- yy.getLogger().debug("Rule: nodeShapeNLabel: ", $$[$0 - 2], $$[$0 - 1], $$[$0]);
156
- this.$ = { typeStr: $$[$0 - 2] + $$[$0], label: $$[$0 - 1] };
157
- break;
158
- case 34:
159
- yy.getLogger().debug("Rule: BLOCK_ARROW nodeShapeNLabel: ", $$[$0 - 3], $$[$0 - 2], " #3:", $$[$0 - 1], $$[$0]);
160
- this.$ = { typeStr: $$[$0 - 3] + $$[$0], label: $$[$0 - 2], directions: $$[$0 - 1] };
161
- break;
162
- case 35:
163
- case 36:
164
- this.$ = { type: "classDef", id: $$[$0 - 1].trim(), css: $$[$0].trim() };
165
- break;
166
- case 37:
167
- this.$ = { type: "applyClass", id: $$[$0 - 1].trim(), styleClass: $$[$0].trim() };
168
- break;
169
- case 38:
170
- this.$ = { type: "applyStyles", id: $$[$0 - 1].trim(), stylesStr: $$[$0].trim() };
171
- break;
172
- }
173
- }, "anonymous"),
174
- table: [{ 9: 1, 10: [1, 2] }, { 1: [3] }, { 11: 3, 13: 4, 19: 5, 20: 6, 21: $V0, 22: 8, 23: 9, 24: 10, 25: 11, 26: 12, 28: $V1, 29: $V2, 31: $V3, 32: $V4, 40: $V5, 44: $V6, 47: $V7 }, { 8: [1, 20] }, o($V8, [2, 12], { 13: 4, 19: 5, 20: 6, 22: 8, 23: 9, 24: 10, 25: 11, 26: 12, 11: 21, 21: $V0, 28: $V1, 29: $V2, 31: $V3, 32: $V4, 40: $V5, 44: $V6, 47: $V7 }), o($V9, [2, 16], { 14: 22, 15: $Va, 16: $Vb }), o($V9, [2, 17]), o($V9, [2, 18]), o($V9, [2, 19]), o($V9, [2, 20]), o($V9, [2, 21]), o($V9, [2, 22]), o($Vc, [2, 25], { 27: [1, 25] }), o($V9, [2, 26]), { 19: 26, 26: 12, 32: $V4 }, { 11: 27, 13: 4, 19: 5, 20: 6, 21: $V0, 22: 8, 23: 9, 24: 10, 25: 11, 26: 12, 28: $V1, 29: $V2, 31: $V3, 32: $V4, 40: $V5, 44: $V6, 47: $V7 }, { 41: [1, 28], 43: [1, 29] }, { 45: [1, 30] }, { 48: [1, 31] }, o($Vd, [2, 29], { 33: 32, 36: [1, 33], 38: [1, 34] }), { 1: [2, 7] }, o($V8, [2, 13]), { 26: 35, 32: $V4 }, { 32: [2, 14] }, { 17: [1, 36] }, o($Vc, [2, 24]), { 11: 37, 13: 4, 14: 22, 15: $Va, 16: $Vb, 19: 5, 20: 6, 21: $V0, 22: 8, 23: 9, 24: 10, 25: 11, 26: 12, 28: $V1, 29: $V2, 31: $V3, 32: $V4, 40: $V5, 44: $V6, 47: $V7 }, { 30: [1, 38] }, { 42: [1, 39] }, { 42: [1, 40] }, { 46: [1, 41] }, { 49: [1, 42] }, o($Vd, [2, 30]), { 18: [1, 43] }, { 18: [1, 44] }, o($Vc, [2, 23]), { 18: [1, 45] }, { 30: [1, 46] }, o($V9, [2, 28]), o($V9, [2, 35]), o($V9, [2, 36]), o($V9, [2, 37]), o($V9, [2, 38]), { 37: [1, 47] }, { 34: 48, 35: $Ve }, { 15: [1, 50] }, o($V9, [2, 27]), o($Vd, [2, 33]), { 39: [1, 51] }, { 34: 52, 35: $Ve, 39: [2, 31] }, { 32: [2, 15] }, o($Vd, [2, 34]), { 39: [2, 32] }],
175
- defaultActions: { 20: [2, 7], 23: [2, 14], 50: [2, 15], 52: [2, 32] },
176
- parseError: /* @__PURE__ */ __name(function parseError(str, hash) {
177
- if (hash.recoverable) {
178
- this.trace(str);
179
- } else {
180
- var error = new Error(str);
181
- error.hash = hash;
182
- throw error;
183
- }
184
- }, "parseError"),
185
- parse: /* @__PURE__ */ __name(function parse(input) {
186
- var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;
187
- var args = lstack.slice.call(arguments, 1);
188
- var lexer2 = Object.create(this.lexer);
189
- var sharedState = { yy: {} };
190
- for (var k in this.yy) {
191
- if (Object.prototype.hasOwnProperty.call(this.yy, k)) {
192
- sharedState.yy[k] = this.yy[k];
193
- }
194
- }
195
- lexer2.setInput(input, sharedState.yy);
196
- sharedState.yy.lexer = lexer2;
197
- sharedState.yy.parser = this;
198
- if (typeof lexer2.yylloc == "undefined") {
199
- lexer2.yylloc = {};
200
- }
201
- var yyloc = lexer2.yylloc;
202
- lstack.push(yyloc);
203
- var ranges = lexer2.options && lexer2.options.ranges;
204
- if (typeof sharedState.yy.parseError === "function") {
205
- this.parseError = sharedState.yy.parseError;
206
- } else {
207
- this.parseError = Object.getPrototypeOf(this).parseError;
208
- }
209
- function popStack(n) {
210
- stack.length = stack.length - 2 * n;
211
- vstack.length = vstack.length - n;
212
- lstack.length = lstack.length - n;
213
- }
214
- __name(popStack, "popStack");
215
- function lex() {
216
- var token;
217
- token = tstack.pop() || lexer2.lex() || EOF;
218
- if (typeof token !== "number") {
219
- if (token instanceof Array) {
220
- tstack = token;
221
- token = tstack.pop();
222
- }
223
- token = self.symbols_[token] || token;
224
- }
225
- return token;
226
- }
227
- __name(lex, "lex");
228
- var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected;
229
- while (true) {
230
- state = stack[stack.length - 1];
231
- if (this.defaultActions[state]) {
232
- action = this.defaultActions[state];
233
- } else {
234
- if (symbol === null || typeof symbol == "undefined") {
235
- symbol = lex();
236
- }
237
- action = table[state] && table[state][symbol];
238
- }
239
- if (typeof action === "undefined" || !action.length || !action[0]) {
240
- var errStr = "";
241
- expected = [];
242
- for (p in table[state]) {
243
- if (this.terminals_[p] && p > TERROR) {
244
- expected.push("'" + this.terminals_[p] + "'");
245
- }
246
- }
247
- if (lexer2.showPosition) {
248
- errStr = "Parse error on line " + (yylineno + 1) + ":\n" + lexer2.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'";
249
- } else {
250
- errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == EOF ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'");
251
- }
252
- this.parseError(errStr, {
253
- text: lexer2.match,
254
- token: this.terminals_[symbol] || symbol,
255
- line: lexer2.yylineno,
256
- loc: yyloc,
257
- expected
258
- });
259
- }
260
- if (action[0] instanceof Array && action.length > 1) {
261
- throw new Error("Parse Error: multiple actions possible at state: " + state + ", token: " + symbol);
262
- }
263
- switch (action[0]) {
264
- case 1:
265
- stack.push(symbol);
266
- vstack.push(lexer2.yytext);
267
- lstack.push(lexer2.yylloc);
268
- stack.push(action[1]);
269
- symbol = null;
270
- if (!preErrorSymbol) {
271
- yyleng = lexer2.yyleng;
272
- yytext = lexer2.yytext;
273
- yylineno = lexer2.yylineno;
274
- yyloc = lexer2.yylloc;
275
- if (recovering > 0) {
276
- recovering--;
277
- }
278
- } else {
279
- symbol = preErrorSymbol;
280
- preErrorSymbol = null;
281
- }
282
- break;
283
- case 2:
284
- len = this.productions_[action[1]][1];
285
- yyval.$ = vstack[vstack.length - len];
286
- yyval._$ = {
287
- first_line: lstack[lstack.length - (len || 1)].first_line,
288
- last_line: lstack[lstack.length - 1].last_line,
289
- first_column: lstack[lstack.length - (len || 1)].first_column,
290
- last_column: lstack[lstack.length - 1].last_column
291
- };
292
- if (ranges) {
293
- yyval._$.range = [
294
- lstack[lstack.length - (len || 1)].range[0],
295
- lstack[lstack.length - 1].range[1]
296
- ];
297
- }
298
- r = this.performAction.apply(yyval, [
299
- yytext,
300
- yyleng,
301
- yylineno,
302
- sharedState.yy,
303
- action[1],
304
- vstack,
305
- lstack
306
- ].concat(args));
307
- if (typeof r !== "undefined") {
308
- return r;
309
- }
310
- if (len) {
311
- stack = stack.slice(0, -1 * len * 2);
312
- vstack = vstack.slice(0, -1 * len);
313
- lstack = lstack.slice(0, -1 * len);
314
- }
315
- stack.push(this.productions_[action[1]][0]);
316
- vstack.push(yyval.$);
317
- lstack.push(yyval._$);
318
- newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
319
- stack.push(newState);
320
- break;
321
- case 3:
322
- return true;
323
- }
324
- }
325
- return true;
326
- }, "parse")
327
- };
328
- var lexer = /* @__PURE__ */ function() {
329
- var lexer2 = {
330
- EOF: 1,
331
- parseError: /* @__PURE__ */ __name(function parseError(str, hash) {
332
- if (this.yy.parser) {
333
- this.yy.parser.parseError(str, hash);
334
- } else {
335
- throw new Error(str);
336
- }
337
- }, "parseError"),
338
- // resets the lexer, sets new input
339
- setInput: /* @__PURE__ */ __name(function(input, yy) {
340
- this.yy = yy || this.yy || {};
341
- this._input = input;
342
- this._more = this._backtrack = this.done = false;
343
- this.yylineno = this.yyleng = 0;
344
- this.yytext = this.matched = this.match = "";
345
- this.conditionStack = ["INITIAL"];
346
- this.yylloc = {
347
- first_line: 1,
348
- first_column: 0,
349
- last_line: 1,
350
- last_column: 0
351
- };
352
- if (this.options.ranges) {
353
- this.yylloc.range = [0, 0];
354
- }
355
- this.offset = 0;
356
- return this;
357
- }, "setInput"),
358
- // consumes and returns one char from the input
359
- input: /* @__PURE__ */ __name(function() {
360
- var ch = this._input[0];
361
- this.yytext += ch;
362
- this.yyleng++;
363
- this.offset++;
364
- this.match += ch;
365
- this.matched += ch;
366
- var lines = ch.match(/(?:\r\n?|\n).*/g);
367
- if (lines) {
368
- this.yylineno++;
369
- this.yylloc.last_line++;
370
- } else {
371
- this.yylloc.last_column++;
372
- }
373
- if (this.options.ranges) {
374
- this.yylloc.range[1]++;
375
- }
376
- this._input = this._input.slice(1);
377
- return ch;
378
- }, "input"),
379
- // unshifts one char (or a string) into the input
380
- unput: /* @__PURE__ */ __name(function(ch) {
381
- var len = ch.length;
382
- var lines = ch.split(/(?:\r\n?|\n)/g);
383
- this._input = ch + this._input;
384
- this.yytext = this.yytext.substr(0, this.yytext.length - len);
385
- this.offset -= len;
386
- var oldLines = this.match.split(/(?:\r\n?|\n)/g);
387
- this.match = this.match.substr(0, this.match.length - 1);
388
- this.matched = this.matched.substr(0, this.matched.length - 1);
389
- if (lines.length - 1) {
390
- this.yylineno -= lines.length - 1;
391
- }
392
- var r = this.yylloc.range;
393
- this.yylloc = {
394
- first_line: this.yylloc.first_line,
395
- last_line: this.yylineno + 1,
396
- first_column: this.yylloc.first_column,
397
- last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length : this.yylloc.first_column - len
398
- };
399
- if (this.options.ranges) {
400
- this.yylloc.range = [r[0], r[0] + this.yyleng - len];
401
- }
402
- this.yyleng = this.yytext.length;
403
- return this;
404
- }, "unput"),
405
- // When called from action, caches matched text and appends it on next action
406
- more: /* @__PURE__ */ __name(function() {
407
- this._more = true;
408
- return this;
409
- }, "more"),
410
- // 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.
411
- reject: /* @__PURE__ */ __name(function() {
412
- if (this.options.backtrack_lexer) {
413
- this._backtrack = true;
414
- } else {
415
- return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n" + this.showPosition(), {
416
- text: "",
417
- token: null,
418
- line: this.yylineno
419
- });
420
- }
421
- return this;
422
- }, "reject"),
423
- // retain first n characters of the match
424
- less: /* @__PURE__ */ __name(function(n) {
425
- this.unput(this.match.slice(n));
426
- }, "less"),
427
- // displays already matched input, i.e. for error messages
428
- pastInput: /* @__PURE__ */ __name(function() {
429
- var past = this.matched.substr(0, this.matched.length - this.match.length);
430
- return (past.length > 20 ? "..." : "") + past.substr(-20).replace(/\n/g, "");
431
- }, "pastInput"),
432
- // displays upcoming input, i.e. for error messages
433
- upcomingInput: /* @__PURE__ */ __name(function() {
434
- var next = this.match;
435
- if (next.length < 20) {
436
- next += this._input.substr(0, 20 - next.length);
437
- }
438
- return (next.substr(0, 20) + (next.length > 20 ? "..." : "")).replace(/\n/g, "");
439
- }, "upcomingInput"),
440
- // displays the character position where the lexing error occurred, i.e. for error messages
441
- showPosition: /* @__PURE__ */ __name(function() {
442
- var pre = this.pastInput();
443
- var c = new Array(pre.length + 1).join("-");
444
- return pre + this.upcomingInput() + "\n" + c + "^";
445
- }, "showPosition"),
446
- // test the lexed token: return FALSE when not a match, otherwise return token
447
- test_match: /* @__PURE__ */ __name(function(match, indexed_rule) {
448
- var token, lines, backup;
449
- if (this.options.backtrack_lexer) {
450
- backup = {
451
- yylineno: this.yylineno,
452
- yylloc: {
453
- first_line: this.yylloc.first_line,
454
- last_line: this.last_line,
455
- first_column: this.yylloc.first_column,
456
- last_column: this.yylloc.last_column
457
- },
458
- yytext: this.yytext,
459
- match: this.match,
460
- matches: this.matches,
461
- matched: this.matched,
462
- yyleng: this.yyleng,
463
- offset: this.offset,
464
- _more: this._more,
465
- _input: this._input,
466
- yy: this.yy,
467
- conditionStack: this.conditionStack.slice(0),
468
- done: this.done
469
- };
470
- if (this.options.ranges) {
471
- backup.yylloc.range = this.yylloc.range.slice(0);
472
- }
473
- }
474
- lines = match[0].match(/(?:\r\n?|\n).*/g);
475
- if (lines) {
476
- this.yylineno += lines.length;
477
- }
478
- this.yylloc = {
479
- first_line: this.yylloc.last_line,
480
- last_line: this.yylineno + 1,
481
- first_column: this.yylloc.last_column,
482
- last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length
483
- };
484
- this.yytext += match[0];
485
- this.match += match[0];
486
- this.matches = match;
487
- this.yyleng = this.yytext.length;
488
- if (this.options.ranges) {
489
- this.yylloc.range = [this.offset, this.offset += this.yyleng];
490
- }
491
- this._more = false;
492
- this._backtrack = false;
493
- this._input = this._input.slice(match[0].length);
494
- this.matched += match[0];
495
- token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
496
- if (this.done && this._input) {
497
- this.done = false;
498
- }
499
- if (token) {
500
- return token;
501
- } else if (this._backtrack) {
502
- for (var k in backup) {
503
- this[k] = backup[k];
504
- }
505
- return false;
506
- }
507
- return false;
508
- }, "test_match"),
509
- // return next match in input
510
- next: /* @__PURE__ */ __name(function() {
511
- if (this.done) {
512
- return this.EOF;
513
- }
514
- if (!this._input) {
515
- this.done = true;
516
- }
517
- var token, match, tempMatch, index;
518
- if (!this._more) {
519
- this.yytext = "";
520
- this.match = "";
521
- }
522
- var rules = this._currentRules();
523
- for (var i = 0; i < rules.length; i++) {
524
- tempMatch = this._input.match(this.rules[rules[i]]);
525
- if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
526
- match = tempMatch;
527
- index = i;
528
- if (this.options.backtrack_lexer) {
529
- token = this.test_match(tempMatch, rules[i]);
530
- if (token !== false) {
531
- return token;
532
- } else if (this._backtrack) {
533
- match = false;
534
- continue;
535
- } else {
536
- return false;
537
- }
538
- } else if (!this.options.flex) {
539
- break;
540
- }
541
- }
542
- }
543
- if (match) {
544
- token = this.test_match(match, rules[index]);
545
- if (token !== false) {
546
- return token;
547
- }
548
- return false;
549
- }
550
- if (this._input === "") {
551
- return this.EOF;
552
- } else {
553
- return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". Unrecognized text.\n" + this.showPosition(), {
554
- text: "",
555
- token: null,
556
- line: this.yylineno
557
- });
558
- }
559
- }, "next"),
560
- // return next match that has a token
561
- lex: /* @__PURE__ */ __name(function lex() {
562
- var r = this.next();
563
- if (r) {
564
- return r;
565
- } else {
566
- return this.lex();
567
- }
568
- }, "lex"),
569
- // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
570
- begin: /* @__PURE__ */ __name(function begin(condition) {
571
- this.conditionStack.push(condition);
572
- }, "begin"),
573
- // pop the previously active lexer condition state off the condition stack
574
- popState: /* @__PURE__ */ __name(function popState() {
575
- var n = this.conditionStack.length - 1;
576
- if (n > 0) {
577
- return this.conditionStack.pop();
578
- } else {
579
- return this.conditionStack[0];
580
- }
581
- }, "popState"),
582
- // produce the lexer rule set which is active for the currently active lexer condition state
583
- _currentRules: /* @__PURE__ */ __name(function _currentRules() {
584
- if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
585
- return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
586
- } else {
587
- return this.conditions["INITIAL"].rules;
588
- }
589
- }, "_currentRules"),
590
- // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
591
- topState: /* @__PURE__ */ __name(function topState(n) {
592
- n = this.conditionStack.length - 1 - Math.abs(n || 0);
593
- if (n >= 0) {
594
- return this.conditionStack[n];
595
- } else {
596
- return "INITIAL";
597
- }
598
- }, "topState"),
599
- // alias for begin(condition)
600
- pushState: /* @__PURE__ */ __name(function pushState(condition) {
601
- this.begin(condition);
602
- }, "pushState"),
603
- // return the number of states currently on the stack
604
- stateStackSize: /* @__PURE__ */ __name(function stateStackSize() {
605
- return this.conditionStack.length;
606
- }, "stateStackSize"),
607
- options: {},
608
- performAction: /* @__PURE__ */ __name(function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) {
609
- var YYSTATE = YY_START;
610
- switch ($avoiding_name_collisions) {
611
- case 0:
612
- return 10;
613
- break;
614
- case 1:
615
- yy.getLogger().debug("Found space-block");
616
- return 31;
617
- break;
618
- case 2:
619
- yy.getLogger().debug("Found nl-block");
620
- return 31;
621
- break;
622
- case 3:
623
- yy.getLogger().debug("Found space-block");
624
- return 29;
625
- break;
626
- case 4:
627
- yy.getLogger().debug(".", yy_.yytext);
628
- break;
629
- case 5:
630
- yy.getLogger().debug("_", yy_.yytext);
631
- break;
632
- case 6:
633
- return 5;
634
- break;
635
- case 7:
636
- yy_.yytext = -1;
637
- return 28;
638
- break;
639
- case 8:
640
- yy_.yytext = yy_.yytext.replace(/columns\s+/, "");
641
- yy.getLogger().debug("COLUMNS (LEX)", yy_.yytext);
642
- return 28;
643
- break;
644
- case 9:
645
- this.pushState("md_string");
646
- break;
647
- case 10:
648
- return "MD_STR";
649
- break;
650
- case 11:
651
- this.popState();
652
- break;
653
- case 12:
654
- this.pushState("string");
655
- break;
656
- case 13:
657
- yy.getLogger().debug("LEX: POPPING STR:", yy_.yytext);
658
- this.popState();
659
- break;
660
- case 14:
661
- yy.getLogger().debug("LEX: STR end:", yy_.yytext);
662
- return "STR";
663
- break;
664
- case 15:
665
- yy_.yytext = yy_.yytext.replace(/space\:/, "");
666
- yy.getLogger().debug("SPACE NUM (LEX)", yy_.yytext);
667
- return 21;
668
- break;
669
- case 16:
670
- yy_.yytext = "1";
671
- yy.getLogger().debug("COLUMNS (LEX)", yy_.yytext);
672
- return 21;
673
- break;
674
- case 17:
675
- return 43;
676
- break;
677
- case 18:
678
- return "LINKSTYLE";
679
- break;
680
- case 19:
681
- return "INTERPOLATE";
682
- break;
683
- case 20:
684
- this.pushState("CLASSDEF");
685
- return 40;
686
- break;
687
- case 21:
688
- this.popState();
689
- this.pushState("CLASSDEFID");
690
- return "DEFAULT_CLASSDEF_ID";
691
- break;
692
- case 22:
693
- this.popState();
694
- this.pushState("CLASSDEFID");
695
- return 41;
696
- break;
697
- case 23:
698
- this.popState();
699
- return 42;
700
- break;
701
- case 24:
702
- this.pushState("CLASS");
703
- return 44;
704
- break;
705
- case 25:
706
- this.popState();
707
- this.pushState("CLASS_STYLE");
708
- return 45;
709
- break;
710
- case 26:
711
- this.popState();
712
- return 46;
713
- break;
714
- case 27:
715
- this.pushState("STYLE_STMNT");
716
- return 47;
717
- break;
718
- case 28:
719
- this.popState();
720
- this.pushState("STYLE_DEFINITION");
721
- return 48;
722
- break;
723
- case 29:
724
- this.popState();
725
- return 49;
726
- break;
727
- case 30:
728
- this.pushState("acc_title");
729
- return "acc_title";
730
- break;
731
- case 31:
732
- this.popState();
733
- return "acc_title_value";
734
- break;
735
- case 32:
736
- this.pushState("acc_descr");
737
- return "acc_descr";
738
- break;
739
- case 33:
740
- this.popState();
741
- return "acc_descr_value";
742
- break;
743
- case 34:
744
- this.pushState("acc_descr_multiline");
745
- break;
746
- case 35:
747
- this.popState();
748
- break;
749
- case 36:
750
- return "acc_descr_multiline_value";
751
- break;
752
- case 37:
753
- return 30;
754
- break;
755
- case 38:
756
- this.popState();
757
- yy.getLogger().debug("Lex: ((");
758
- return "NODE_DEND";
759
- break;
760
- case 39:
761
- this.popState();
762
- yy.getLogger().debug("Lex: ((");
763
- return "NODE_DEND";
764
- break;
765
- case 40:
766
- this.popState();
767
- yy.getLogger().debug("Lex: ))");
768
- return "NODE_DEND";
769
- break;
770
- case 41:
771
- this.popState();
772
- yy.getLogger().debug("Lex: ((");
773
- return "NODE_DEND";
774
- break;
775
- case 42:
776
- this.popState();
777
- yy.getLogger().debug("Lex: ((");
778
- return "NODE_DEND";
779
- break;
780
- case 43:
781
- this.popState();
782
- yy.getLogger().debug("Lex: (-");
783
- return "NODE_DEND";
784
- break;
785
- case 44:
786
- this.popState();
787
- yy.getLogger().debug("Lex: -)");
788
- return "NODE_DEND";
789
- break;
790
- case 45:
791
- this.popState();
792
- yy.getLogger().debug("Lex: ((");
793
- return "NODE_DEND";
794
- break;
795
- case 46:
796
- this.popState();
797
- yy.getLogger().debug("Lex: ]]");
798
- return "NODE_DEND";
799
- break;
800
- case 47:
801
- this.popState();
802
- yy.getLogger().debug("Lex: (");
803
- return "NODE_DEND";
804
- break;
805
- case 48:
806
- this.popState();
807
- yy.getLogger().debug("Lex: ])");
808
- return "NODE_DEND";
809
- break;
810
- case 49:
811
- this.popState();
812
- yy.getLogger().debug("Lex: /]");
813
- return "NODE_DEND";
814
- break;
815
- case 50:
816
- this.popState();
817
- yy.getLogger().debug("Lex: /]");
818
- return "NODE_DEND";
819
- break;
820
- case 51:
821
- this.popState();
822
- yy.getLogger().debug("Lex: )]");
823
- return "NODE_DEND";
824
- break;
825
- case 52:
826
- this.popState();
827
- yy.getLogger().debug("Lex: )");
828
- return "NODE_DEND";
829
- break;
830
- case 53:
831
- this.popState();
832
- yy.getLogger().debug("Lex: ]>");
833
- return "NODE_DEND";
834
- break;
835
- case 54:
836
- this.popState();
837
- yy.getLogger().debug("Lex: ]");
838
- return "NODE_DEND";
839
- break;
840
- case 55:
841
- yy.getLogger().debug("Lexa: -)");
842
- this.pushState("NODE");
843
- return 36;
844
- break;
845
- case 56:
846
- yy.getLogger().debug("Lexa: (-");
847
- this.pushState("NODE");
848
- return 36;
849
- break;
850
- case 57:
851
- yy.getLogger().debug("Lexa: ))");
852
- this.pushState("NODE");
853
- return 36;
854
- break;
855
- case 58:
856
- yy.getLogger().debug("Lexa: )");
857
- this.pushState("NODE");
858
- return 36;
859
- break;
860
- case 59:
861
- yy.getLogger().debug("Lex: (((");
862
- this.pushState("NODE");
863
- return 36;
864
- break;
865
- case 60:
866
- yy.getLogger().debug("Lexa: )");
867
- this.pushState("NODE");
868
- return 36;
869
- break;
870
- case 61:
871
- yy.getLogger().debug("Lexa: )");
872
- this.pushState("NODE");
873
- return 36;
874
- break;
875
- case 62:
876
- yy.getLogger().debug("Lexa: )");
877
- this.pushState("NODE");
878
- return 36;
879
- break;
880
- case 63:
881
- yy.getLogger().debug("Lexc: >");
882
- this.pushState("NODE");
883
- return 36;
884
- break;
885
- case 64:
886
- yy.getLogger().debug("Lexa: ([");
887
- this.pushState("NODE");
888
- return 36;
889
- break;
890
- case 65:
891
- yy.getLogger().debug("Lexa: )");
892
- this.pushState("NODE");
893
- return 36;
894
- break;
895
- case 66:
896
- this.pushState("NODE");
897
- return 36;
898
- break;
899
- case 67:
900
- this.pushState("NODE");
901
- return 36;
902
- break;
903
- case 68:
904
- this.pushState("NODE");
905
- return 36;
906
- break;
907
- case 69:
908
- this.pushState("NODE");
909
- return 36;
910
- break;
911
- case 70:
912
- this.pushState("NODE");
913
- return 36;
914
- break;
915
- case 71:
916
- this.pushState("NODE");
917
- return 36;
918
- break;
919
- case 72:
920
- this.pushState("NODE");
921
- return 36;
922
- break;
923
- case 73:
924
- yy.getLogger().debug("Lexa: [");
925
- this.pushState("NODE");
926
- return 36;
927
- break;
928
- case 74:
929
- this.pushState("BLOCK_ARROW");
930
- yy.getLogger().debug("LEX ARR START");
931
- return 38;
932
- break;
933
- case 75:
934
- yy.getLogger().debug("Lex: NODE_ID", yy_.yytext);
935
- return 32;
936
- break;
937
- case 76:
938
- yy.getLogger().debug("Lex: EOF", yy_.yytext);
939
- return 8;
940
- break;
941
- case 77:
942
- this.pushState("md_string");
943
- break;
944
- case 78:
945
- this.pushState("md_string");
946
- break;
947
- case 79:
948
- return "NODE_DESCR";
949
- break;
950
- case 80:
951
- this.popState();
952
- break;
953
- case 81:
954
- yy.getLogger().debug("Lex: Starting string");
955
- this.pushState("string");
956
- break;
957
- case 82:
958
- yy.getLogger().debug("LEX ARR: Starting string");
959
- this.pushState("string");
960
- break;
961
- case 83:
962
- yy.getLogger().debug("LEX: NODE_DESCR:", yy_.yytext);
963
- return "NODE_DESCR";
964
- break;
965
- case 84:
966
- yy.getLogger().debug("LEX POPPING");
967
- this.popState();
968
- break;
969
- case 85:
970
- yy.getLogger().debug("Lex: =>BAE");
971
- this.pushState("ARROW_DIR");
972
- break;
973
- case 86:
974
- yy_.yytext = yy_.yytext.replace(/^,\s*/, "");
975
- yy.getLogger().debug("Lex (right): dir:", yy_.yytext);
976
- return "DIR";
977
- break;
978
- case 87:
979
- yy_.yytext = yy_.yytext.replace(/^,\s*/, "");
980
- yy.getLogger().debug("Lex (left):", yy_.yytext);
981
- return "DIR";
982
- break;
983
- case 88:
984
- yy_.yytext = yy_.yytext.replace(/^,\s*/, "");
985
- yy.getLogger().debug("Lex (x):", yy_.yytext);
986
- return "DIR";
987
- break;
988
- case 89:
989
- yy_.yytext = yy_.yytext.replace(/^,\s*/, "");
990
- yy.getLogger().debug("Lex (y):", yy_.yytext);
991
- return "DIR";
992
- break;
993
- case 90:
994
- yy_.yytext = yy_.yytext.replace(/^,\s*/, "");
995
- yy.getLogger().debug("Lex (up):", yy_.yytext);
996
- return "DIR";
997
- break;
998
- case 91:
999
- yy_.yytext = yy_.yytext.replace(/^,\s*/, "");
1000
- yy.getLogger().debug("Lex (down):", yy_.yytext);
1001
- return "DIR";
1002
- break;
1003
- case 92:
1004
- yy_.yytext = "]>";
1005
- yy.getLogger().debug("Lex (ARROW_DIR end):", yy_.yytext);
1006
- this.popState();
1007
- this.popState();
1008
- return "BLOCK_ARROW_END";
1009
- break;
1010
- case 93:
1011
- yy.getLogger().debug("Lex: LINK", "#" + yy_.yytext + "#");
1012
- return 15;
1013
- break;
1014
- case 94:
1015
- yy.getLogger().debug("Lex: LINK", yy_.yytext);
1016
- return 15;
1017
- break;
1018
- case 95:
1019
- yy.getLogger().debug("Lex: LINK", yy_.yytext);
1020
- return 15;
1021
- break;
1022
- case 96:
1023
- yy.getLogger().debug("Lex: LINK", yy_.yytext);
1024
- return 15;
1025
- break;
1026
- case 97:
1027
- yy.getLogger().debug("Lex: START_LINK", yy_.yytext);
1028
- this.pushState("LLABEL");
1029
- return 16;
1030
- break;
1031
- case 98:
1032
- yy.getLogger().debug("Lex: START_LINK", yy_.yytext);
1033
- this.pushState("LLABEL");
1034
- return 16;
1035
- break;
1036
- case 99:
1037
- yy.getLogger().debug("Lex: START_LINK", yy_.yytext);
1038
- this.pushState("LLABEL");
1039
- return 16;
1040
- break;
1041
- case 100:
1042
- this.pushState("md_string");
1043
- break;
1044
- case 101:
1045
- yy.getLogger().debug("Lex: Starting string");
1046
- this.pushState("string");
1047
- return "LINK_LABEL";
1048
- break;
1049
- case 102:
1050
- this.popState();
1051
- yy.getLogger().debug("Lex: LINK", "#" + yy_.yytext + "#");
1052
- return 15;
1053
- break;
1054
- case 103:
1055
- this.popState();
1056
- yy.getLogger().debug("Lex: LINK", yy_.yytext);
1057
- return 15;
1058
- break;
1059
- case 104:
1060
- this.popState();
1061
- yy.getLogger().debug("Lex: LINK", yy_.yytext);
1062
- return 15;
1063
- break;
1064
- case 105:
1065
- yy.getLogger().debug("Lex: COLON", yy_.yytext);
1066
- yy_.yytext = yy_.yytext.slice(1);
1067
- return 27;
1068
- break;
1069
- }
1070
- }, "anonymous"),
1071
- rules: [/^(?:block-beta\b)/, /^(?:block\s+)/, /^(?:block\n+)/, /^(?:block:)/, /^(?:[\s]+)/, /^(?:[\n]+)/, /^(?:((\u000D\u000A)|(\u000A)))/, /^(?:columns\s+auto\b)/, /^(?:columns\s+[\d]+)/, /^(?:["][`])/, /^(?:[^`"]+)/, /^(?:[`]["])/, /^(?:["])/, /^(?:["])/, /^(?:[^"]*)/, /^(?:space[:]\d+)/, /^(?:space\b)/, /^(?:default\b)/, /^(?:linkStyle\b)/, /^(?:interpolate\b)/, /^(?:classDef\s+)/, /^(?:DEFAULT\s+)/, /^(?:\w+\s+)/, /^(?:[^\n]*)/, /^(?:class\s+)/, /^(?:(\w+)+((,\s*\w+)*))/, /^(?:[^\n]*)/, /^(?:style\s+)/, /^(?:(\w+)+((,\s*\w+)*))/, /^(?:[^\n]*)/, /^(?:accTitle\s*:\s*)/, /^(?:(?!\n||)*[^\n]*)/, /^(?:accDescr\s*:\s*)/, /^(?:(?!\n||)*[^\n]*)/, /^(?:accDescr\s*\{\s*)/, /^(?:[\}])/, /^(?:[^\}]*)/, /^(?:end\b\s*)/, /^(?:\(\(\()/, /^(?:\)\)\))/, /^(?:[\)]\))/, /^(?:\}\})/, /^(?:\})/, /^(?:\(-)/, /^(?:-\))/, /^(?:\(\()/, /^(?:\]\])/, /^(?:\()/, /^(?:\]\))/, /^(?:\\\])/, /^(?:\/\])/, /^(?:\)\])/, /^(?:[\)])/, /^(?:\]>)/, /^(?:[\]])/, /^(?:-\))/, /^(?:\(-)/, /^(?:\)\))/, /^(?:\))/, /^(?:\(\(\()/, /^(?:\(\()/, /^(?:\{\{)/, /^(?:\{)/, /^(?:>)/, /^(?:\(\[)/, /^(?:\()/, /^(?:\[\[)/, /^(?:\[\|)/, /^(?:\[\()/, /^(?:\)\)\))/, /^(?:\[\\)/, /^(?:\[\/)/, /^(?:\[\\)/, /^(?:\[)/, /^(?:<\[)/, /^(?:[^\(\[\n\-\)\{\}\s\<\>:]+)/, /^(?:$)/, /^(?:["][`])/, /^(?:["][`])/, /^(?:[^`"]+)/, /^(?:[`]["])/, /^(?:["])/, /^(?:["])/, /^(?:[^"]+)/, /^(?:["])/, /^(?:\]>\s*\()/, /^(?:,?\s*right\s*)/, /^(?:,?\s*left\s*)/, /^(?:,?\s*x\s*)/, /^(?:,?\s*y\s*)/, /^(?:,?\s*up\s*)/, /^(?:,?\s*down\s*)/, /^(?:\)\s*)/, /^(?:\s*[xo<]?--+[-xo>]\s*)/, /^(?:\s*[xo<]?==+[=xo>]\s*)/, /^(?:\s*[xo<]?-?\.+-[xo>]?\s*)/, /^(?:\s*~~[\~]+\s*)/, /^(?:\s*[xo<]?--\s*)/, /^(?:\s*[xo<]?==\s*)/, /^(?:\s*[xo<]?-\.\s*)/, /^(?:["][`])/, /^(?:["])/, /^(?:\s*[xo<]?--+[-xo>]\s*)/, /^(?:\s*[xo<]?==+[=xo>]\s*)/, /^(?:\s*[xo<]?-?\.+-[xo>]?\s*)/, /^(?::\d+)/],
1072
- conditions: { "STYLE_DEFINITION": { "rules": [29], "inclusive": false }, "STYLE_STMNT": { "rules": [28], "inclusive": false }, "CLASSDEFID": { "rules": [23], "inclusive": false }, "CLASSDEF": { "rules": [21, 22], "inclusive": false }, "CLASS_STYLE": { "rules": [26], "inclusive": false }, "CLASS": { "rules": [25], "inclusive": false }, "LLABEL": { "rules": [100, 101, 102, 103, 104], "inclusive": false }, "ARROW_DIR": { "rules": [86, 87, 88, 89, 90, 91, 92], "inclusive": false }, "BLOCK_ARROW": { "rules": [77, 82, 85], "inclusive": false }, "NODE": { "rules": [38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 78, 81], "inclusive": false }, "md_string": { "rules": [10, 11, 79, 80], "inclusive": false }, "space": { "rules": [], "inclusive": false }, "string": { "rules": [13, 14, 83, 84], "inclusive": false }, "acc_descr_multiline": { "rules": [35, 36], "inclusive": false }, "acc_descr": { "rules": [33], "inclusive": false }, "acc_title": { "rules": [31], "inclusive": false }, "INITIAL": { "rules": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 12, 15, 16, 17, 18, 19, 20, 24, 27, 30, 32, 34, 37, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 93, 94, 95, 96, 97, 98, 99, 105], "inclusive": true } }
1073
- };
1074
- return lexer2;
1075
- }();
1076
- parser2.lexer = lexer;
1077
- function Parser() {
1078
- this.yy = {};
1079
- }
1080
- __name(Parser, "Parser");
1081
- Parser.prototype = parser2;
1082
- parser2.Parser = Parser;
1083
- return new Parser();
1084
- }();
1085
- parser.parser = parser;
1086
- var block_default = parser;
1087
- var blockDatabase = /* @__PURE__ */ new Map();
1088
- var edgeList = [];
1089
- var edgeCount = /* @__PURE__ */ new Map();
1090
- var COLOR_KEYWORD = "color";
1091
- var FILL_KEYWORD = "fill";
1092
- var BG_FILL = "bgFill";
1093
- var STYLECLASS_SEP = ",";
1094
- var config = getConfig2();
1095
- var classes = /* @__PURE__ */ new Map();
1096
- var sanitizeText2 = /* @__PURE__ */ __name((txt) => common_default.sanitizeText(txt, config), "sanitizeText");
1097
- var addStyleClass = /* @__PURE__ */ __name(function(id, styleAttributes = "") {
1098
- let foundClass = classes.get(id);
1099
- if (!foundClass) {
1100
- foundClass = { id, styles: [], textStyles: [] };
1101
- classes.set(id, foundClass);
1102
- }
1103
- if (styleAttributes !== void 0 && styleAttributes !== null) {
1104
- styleAttributes.split(STYLECLASS_SEP).forEach((attrib) => {
1105
- const fixedAttrib = attrib.replace(/([^;]*);/, "$1").trim();
1106
- if (RegExp(COLOR_KEYWORD).exec(attrib)) {
1107
- const newStyle1 = fixedAttrib.replace(FILL_KEYWORD, BG_FILL);
1108
- const newStyle2 = newStyle1.replace(COLOR_KEYWORD, FILL_KEYWORD);
1109
- foundClass.textStyles.push(newStyle2);
1110
- }
1111
- foundClass.styles.push(fixedAttrib);
1112
- });
1113
- }
1114
- }, "addStyleClass");
1115
- var addStyle2Node = /* @__PURE__ */ __name(function(id, styles = "") {
1116
- const foundBlock = blockDatabase.get(id);
1117
- if (styles !== void 0 && styles !== null) {
1118
- foundBlock.styles = styles.split(STYLECLASS_SEP);
1119
- }
1120
- }, "addStyle2Node");
1121
- var setCssClass = /* @__PURE__ */ __name(function(itemIds, cssClassName) {
1122
- itemIds.split(",").forEach(function(id) {
1123
- let foundBlock = blockDatabase.get(id);
1124
- if (foundBlock === void 0) {
1125
- const trimmedId = id.trim();
1126
- foundBlock = { id: trimmedId, type: "na", children: [] };
1127
- blockDatabase.set(trimmedId, foundBlock);
1128
- }
1129
- if (!foundBlock.classes) {
1130
- foundBlock.classes = [];
1131
- }
1132
- foundBlock.classes.push(cssClassName);
1133
- });
1134
- }, "setCssClass");
1135
- var populateBlockDatabase = /* @__PURE__ */ __name((_blockList, parent) => {
1136
- const blockList = _blockList.flat();
1137
- const children = [];
1138
- for (const block of blockList) {
1139
- if (block.label) {
1140
- block.label = sanitizeText2(block.label);
1141
- }
1142
- if (block.type === "classDef") {
1143
- addStyleClass(block.id, block.css);
1144
- continue;
1145
- }
1146
- if (block.type === "applyClass") {
1147
- setCssClass(block.id, block?.styleClass ?? "");
1148
- continue;
1149
- }
1150
- if (block.type === "applyStyles") {
1151
- if (block?.stylesStr) {
1152
- addStyle2Node(block.id, block?.stylesStr);
1153
- }
1154
- continue;
1155
- }
1156
- if (block.type === "column-setting") {
1157
- parent.columns = block.columns ?? -1;
1158
- } else if (block.type === "edge") {
1159
- const count = (edgeCount.get(block.id) ?? 0) + 1;
1160
- edgeCount.set(block.id, count);
1161
- block.id = count + "-" + block.id;
1162
- edgeList.push(block);
1163
- } else {
1164
- if (!block.label) {
1165
- if (block.type === "composite") {
1166
- block.label = "";
1167
- } else {
1168
- block.label = block.id;
1169
- }
1170
- }
1171
- const existingBlock = blockDatabase.get(block.id);
1172
- if (existingBlock === void 0) {
1173
- blockDatabase.set(block.id, block);
1174
- } else {
1175
- if (block.type !== "na") {
1176
- existingBlock.type = block.type;
1177
- }
1178
- if (block.label !== block.id) {
1179
- existingBlock.label = block.label;
1180
- }
1181
- }
1182
- if (block.children) {
1183
- populateBlockDatabase(block.children, block);
1184
- }
1185
- if (block.type === "space") {
1186
- const w = block.width ?? 1;
1187
- for (let j = 0; j < w; j++) {
1188
- const newBlock = clone_default(block);
1189
- newBlock.id = newBlock.id + "-" + j;
1190
- blockDatabase.set(newBlock.id, newBlock);
1191
- children.push(newBlock);
1192
- }
1193
- } else if (existingBlock === void 0) {
1194
- children.push(block);
1195
- }
1196
- }
1197
- }
1198
- parent.children = children;
1199
- }, "populateBlockDatabase");
1200
- var blocks = [];
1201
- var rootBlock = { id: "root", type: "composite", children: [], columns: -1 };
1202
- var clear2 = /* @__PURE__ */ __name(() => {
1203
- log.debug("Clear called");
1204
- clear();
1205
- rootBlock = { id: "root", type: "composite", children: [], columns: -1 };
1206
- blockDatabase = /* @__PURE__ */ new Map([["root", rootBlock]]);
1207
- blocks = [];
1208
- classes = /* @__PURE__ */ new Map();
1209
- edgeList = [];
1210
- edgeCount = /* @__PURE__ */ new Map();
1211
- }, "clear");
1212
- function typeStr2Type(typeStr) {
1213
- log.debug("typeStr2Type", typeStr);
1214
- switch (typeStr) {
1215
- case "[]":
1216
- return "square";
1217
- case "()":
1218
- log.debug("we have a round");
1219
- return "round";
1220
- case "(())":
1221
- return "circle";
1222
- case ">]":
1223
- return "rect_left_inv_arrow";
1224
- case "{}":
1225
- return "diamond";
1226
- case "{{}}":
1227
- return "hexagon";
1228
- case "([])":
1229
- return "stadium";
1230
- case "[[]]":
1231
- return "subroutine";
1232
- case "[()]":
1233
- return "cylinder";
1234
- case "((()))":
1235
- return "doublecircle";
1236
- case "[//]":
1237
- return "lean_right";
1238
- case "[\\\\]":
1239
- return "lean_left";
1240
- case "[/\\]":
1241
- return "trapezoid";
1242
- case "[\\/]":
1243
- return "inv_trapezoid";
1244
- case "<[]>":
1245
- return "block_arrow";
1246
- default:
1247
- return "na";
1248
- }
1249
- }
1250
- __name(typeStr2Type, "typeStr2Type");
1251
- function edgeTypeStr2Type(typeStr) {
1252
- log.debug("typeStr2Type", typeStr);
1253
- switch (typeStr) {
1254
- case "==":
1255
- return "thick";
1256
- default:
1257
- return "normal";
1258
- }
1259
- }
1260
- __name(edgeTypeStr2Type, "edgeTypeStr2Type");
1261
- function edgeStrToEdgeData(typeStr) {
1262
- switch (typeStr.trim()) {
1263
- case "--x":
1264
- return "arrow_cross";
1265
- case "--o":
1266
- return "arrow_circle";
1267
- default:
1268
- return "arrow_point";
1269
- }
1270
- }
1271
- __name(edgeStrToEdgeData, "edgeStrToEdgeData");
1272
- var cnt = 0;
1273
- var generateId = /* @__PURE__ */ __name(() => {
1274
- cnt++;
1275
- return "id-" + Math.random().toString(36).substr(2, 12) + "-" + cnt;
1276
- }, "generateId");
1277
- var setHierarchy = /* @__PURE__ */ __name((block) => {
1278
- rootBlock.children = block;
1279
- populateBlockDatabase(block, rootBlock);
1280
- blocks = rootBlock.children;
1281
- }, "setHierarchy");
1282
- var getColumns = /* @__PURE__ */ __name((blockId) => {
1283
- const block = blockDatabase.get(blockId);
1284
- if (!block) {
1285
- return -1;
1286
- }
1287
- if (block.columns) {
1288
- return block.columns;
1289
- }
1290
- if (!block.children) {
1291
- return -1;
1292
- }
1293
- return block.children.length;
1294
- }, "getColumns");
1295
- var getBlocksFlat = /* @__PURE__ */ __name(() => {
1296
- return [...blockDatabase.values()];
1297
- }, "getBlocksFlat");
1298
- var getBlocks = /* @__PURE__ */ __name(() => {
1299
- return blocks || [];
1300
- }, "getBlocks");
1301
- var getEdges = /* @__PURE__ */ __name(() => {
1302
- return edgeList;
1303
- }, "getEdges");
1304
- var getBlock = /* @__PURE__ */ __name((id) => {
1305
- return blockDatabase.get(id);
1306
- }, "getBlock");
1307
- var setBlock = /* @__PURE__ */ __name((block) => {
1308
- blockDatabase.set(block.id, block);
1309
- }, "setBlock");
1310
- var getLogger = /* @__PURE__ */ __name(() => console, "getLogger");
1311
- var getClasses = /* @__PURE__ */ __name(function() {
1312
- return classes;
1313
- }, "getClasses");
1314
- var db = {
1315
- getConfig: /* @__PURE__ */ __name(() => getConfig().block, "getConfig"),
1316
- typeStr2Type,
1317
- edgeTypeStr2Type,
1318
- edgeStrToEdgeData,
1319
- getLogger,
1320
- getBlocksFlat,
1321
- getBlocks,
1322
- getEdges,
1323
- setHierarchy,
1324
- getBlock,
1325
- setBlock,
1326
- getColumns,
1327
- getClasses,
1328
- clear: clear2,
1329
- generateId
1330
- };
1331
- var blockDB_default = db;
1332
- var fade = /* @__PURE__ */ __name((color, opacity) => {
1333
- const channel2 = channel_default;
1334
- const r = channel2(color, "r");
1335
- const g = channel2(color, "g");
1336
- const b = channel2(color, "b");
1337
- return rgba_default(r, g, b, opacity);
1338
- }, "fade");
1339
- var getStyles = /* @__PURE__ */ __name((options) => `.label {
1340
- font-family: ${options.fontFamily};
1341
- color: ${options.nodeTextColor || options.textColor};
1342
- }
1343
- .cluster-label text {
1344
- fill: ${options.titleColor};
1345
- }
1346
- .cluster-label span,p {
1347
- color: ${options.titleColor};
1348
- }
1349
-
1350
-
1351
-
1352
- .label text,span,p {
1353
- fill: ${options.nodeTextColor || options.textColor};
1354
- color: ${options.nodeTextColor || options.textColor};
1355
- }
1356
-
1357
- .node rect,
1358
- .node circle,
1359
- .node ellipse,
1360
- .node polygon,
1361
- .node path {
1362
- fill: ${options.mainBkg};
1363
- stroke: ${options.nodeBorder};
1364
- stroke-width: 1px;
1365
- }
1366
- .flowchart-label text {
1367
- text-anchor: middle;
1368
- }
1369
- // .flowchart-label .text-outer-tspan {
1370
- // text-anchor: middle;
1371
- // }
1372
- // .flowchart-label .text-inner-tspan {
1373
- // text-anchor: start;
1374
- // }
1375
-
1376
- .node .label {
1377
- text-align: center;
1378
- }
1379
- .node.clickable {
1380
- cursor: pointer;
1381
- }
1382
-
1383
- .arrowheadPath {
1384
- fill: ${options.arrowheadColor};
1385
- }
1386
-
1387
- .edgePath .path {
1388
- stroke: ${options.lineColor};
1389
- stroke-width: 2.0px;
1390
- }
1391
-
1392
- .flowchart-link {
1393
- stroke: ${options.lineColor};
1394
- fill: none;
1395
- }
1396
-
1397
- .edgeLabel {
1398
- background-color: ${options.edgeLabelBackground};
1399
- rect {
1400
- opacity: 0.5;
1401
- background-color: ${options.edgeLabelBackground};
1402
- fill: ${options.edgeLabelBackground};
1403
- }
1404
- text-align: center;
1405
- }
1406
-
1407
- /* For html labels only */
1408
- .labelBkg {
1409
- background-color: ${fade(options.edgeLabelBackground, 0.5)};
1410
- // background-color:
1411
- }
1412
-
1413
- .node .cluster {
1414
- // fill: ${fade(options.mainBkg, 0.5)};
1415
- fill: ${fade(options.clusterBkg, 0.5)};
1416
- stroke: ${fade(options.clusterBorder, 0.2)};
1417
- box-shadow: rgba(50, 50, 93, 0.25) 0px 13px 27px -5px, rgba(0, 0, 0, 0.3) 0px 8px 16px -8px;
1418
- stroke-width: 1px;
1419
- }
1420
-
1421
- .cluster text {
1422
- fill: ${options.titleColor};
1423
- }
1424
-
1425
- .cluster span,p {
1426
- color: ${options.titleColor};
1427
- }
1428
- /* .cluster div {
1429
- color: ${options.titleColor};
1430
- } */
1431
-
1432
- div.mermaidTooltip {
1433
- position: absolute;
1434
- text-align: center;
1435
- max-width: 200px;
1436
- padding: 2px;
1437
- font-family: ${options.fontFamily};
1438
- font-size: 12px;
1439
- background: ${options.tertiaryColor};
1440
- border: 1px solid ${options.border2};
1441
- border-radius: 2px;
1442
- pointer-events: none;
1443
- z-index: 100;
1444
- }
1445
-
1446
- .flowchartTitleText {
1447
- text-anchor: middle;
1448
- font-size: 18px;
1449
- fill: ${options.textColor};
1450
- }
1451
- `, "getStyles");
1452
- var styles_default = getStyles;
1453
- var insertMarkers = /* @__PURE__ */ __name((elem, markerArray, type, id) => {
1454
- markerArray.forEach((markerName) => {
1455
- markers[markerName](elem, type, id);
1456
- });
1457
- }, "insertMarkers");
1458
- var extension = /* @__PURE__ */ __name((elem, type, id) => {
1459
- log.trace("Making markers for ", id);
1460
- elem.append("defs").append("marker").attr("id", id + "_" + type + "-extensionStart").attr("class", "marker extension " + type).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");
1461
- elem.append("defs").append("marker").attr("id", id + "_" + type + "-extensionEnd").attr("class", "marker extension " + type).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");
1462
- }, "extension");
1463
- var composition = /* @__PURE__ */ __name((elem, type, id) => {
1464
- elem.append("defs").append("marker").attr("id", id + "_" + type + "-compositionStart").attr("class", "marker composition " + type).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");
1465
- elem.append("defs").append("marker").attr("id", id + "_" + type + "-compositionEnd").attr("class", "marker composition " + type).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");
1466
- }, "composition");
1467
- var aggregation = /* @__PURE__ */ __name((elem, type, id) => {
1468
- elem.append("defs").append("marker").attr("id", id + "_" + type + "-aggregationStart").attr("class", "marker aggregation " + type).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");
1469
- elem.append("defs").append("marker").attr("id", id + "_" + type + "-aggregationEnd").attr("class", "marker aggregation " + type).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");
1470
- }, "aggregation");
1471
- var dependency = /* @__PURE__ */ __name((elem, type, id) => {
1472
- elem.append("defs").append("marker").attr("id", id + "_" + type + "-dependencyStart").attr("class", "marker dependency " + type).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");
1473
- elem.append("defs").append("marker").attr("id", id + "_" + type + "-dependencyEnd").attr("class", "marker dependency " + type).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");
1474
- }, "dependency");
1475
- var lollipop = /* @__PURE__ */ __name((elem, type, id) => {
1476
- elem.append("defs").append("marker").attr("id", id + "_" + type + "-lollipopStart").attr("class", "marker lollipop " + type).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);
1477
- elem.append("defs").append("marker").attr("id", id + "_" + type + "-lollipopEnd").attr("class", "marker lollipop " + type).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);
1478
- }, "lollipop");
1479
- var point = /* @__PURE__ */ __name((elem, type, id) => {
1480
- elem.append("marker").attr("id", id + "_" + type + "-pointEnd").attr("class", "marker " + type).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");
1481
- elem.append("marker").attr("id", id + "_" + type + "-pointStart").attr("class", "marker " + type).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");
1482
- }, "point");
1483
- var circle = /* @__PURE__ */ __name((elem, type, id) => {
1484
- elem.append("marker").attr("id", id + "_" + type + "-circleEnd").attr("class", "marker " + type).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");
1485
- elem.append("marker").attr("id", id + "_" + type + "-circleStart").attr("class", "marker " + type).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");
1486
- }, "circle");
1487
- var cross = /* @__PURE__ */ __name((elem, type, id) => {
1488
- elem.append("marker").attr("id", id + "_" + type + "-crossEnd").attr("class", "marker cross " + type).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");
1489
- elem.append("marker").attr("id", id + "_" + type + "-crossStart").attr("class", "marker cross " + type).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");
1490
- }, "cross");
1491
- var barb = /* @__PURE__ */ __name((elem, type, id) => {
1492
- elem.append("defs").append("marker").attr("id", id + "_" + type + "-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");
1493
- }, "barb");
1494
- var markers = {
1495
- extension,
1496
- composition,
1497
- aggregation,
1498
- dependency,
1499
- lollipop,
1500
- point,
1501
- circle,
1502
- cross,
1503
- barb
1504
- };
1505
- var markers_default = insertMarkers;
1506
- var padding = getConfig2()?.block?.padding ?? 8;
1507
- function calculateBlockPosition(columns, position) {
1508
- if (columns === 0 || !Number.isInteger(columns)) {
1509
- throw new Error("Columns must be an integer !== 0.");
1510
- }
1511
- if (position < 0 || !Number.isInteger(position)) {
1512
- throw new Error("Position must be a non-negative integer." + position);
1513
- }
1514
- if (columns < 0) {
1515
- return { px: position, py: 0 };
1516
- }
1517
- if (columns === 1) {
1518
- return { px: 0, py: position };
1519
- }
1520
- const px = position % columns;
1521
- const py = Math.floor(position / columns);
1522
- return { px, py };
1523
- }
1524
- __name(calculateBlockPosition, "calculateBlockPosition");
1525
- var getMaxChildSize = /* @__PURE__ */ __name((block) => {
1526
- let maxWidth = 0;
1527
- let maxHeight = 0;
1528
- for (const child of block.children) {
1529
- const { width, height, x, y } = child.size ?? { width: 0, height: 0, x: 0, y: 0 };
1530
- log.debug(
1531
- "getMaxChildSize abc95 child:",
1532
- child.id,
1533
- "width:",
1534
- width,
1535
- "height:",
1536
- height,
1537
- "x:",
1538
- x,
1539
- "y:",
1540
- y,
1541
- child.type
1542
- );
1543
- if (child.type === "space") {
1544
- continue;
1545
- }
1546
- if (width > maxWidth) {
1547
- maxWidth = width / (block.widthInColumns ?? 1);
1548
- }
1549
- if (height > maxHeight) {
1550
- maxHeight = height;
1551
- }
1552
- }
1553
- return { width: maxWidth, height: maxHeight };
1554
- }, "getMaxChildSize");
1555
- function setBlockSizes(block, db2, siblingWidth = 0, siblingHeight = 0) {
1556
- log.debug(
1557
- "setBlockSizes abc95 (start)",
1558
- block.id,
1559
- block?.size?.x,
1560
- "block width =",
1561
- block?.size,
1562
- "sieblingWidth",
1563
- siblingWidth
1564
- );
1565
- if (!block?.size?.width) {
1566
- block.size = {
1567
- width: siblingWidth,
1568
- height: siblingHeight,
1569
- x: 0,
1570
- y: 0
1571
- };
1572
- }
1573
- let maxWidth = 0;
1574
- let maxHeight = 0;
1575
- if (block.children?.length > 0) {
1576
- for (const child of block.children) {
1577
- setBlockSizes(child, db2);
1578
- }
1579
- const childSize = getMaxChildSize(block);
1580
- maxWidth = childSize.width;
1581
- maxHeight = childSize.height;
1582
- log.debug("setBlockSizes abc95 maxWidth of", block.id, ":s children is ", maxWidth, maxHeight);
1583
- for (const child of block.children) {
1584
- if (child.size) {
1585
- log.debug(
1586
- `abc95 Setting size of children of ${block.id} id=${child.id} ${maxWidth} ${maxHeight} ${JSON.stringify(child.size)}`
1587
- );
1588
- child.size.width = maxWidth * (child.widthInColumns ?? 1) + padding * ((child.widthInColumns ?? 1) - 1);
1589
- child.size.height = maxHeight;
1590
- child.size.x = 0;
1591
- child.size.y = 0;
1592
- log.debug(
1593
- `abc95 updating size of ${block.id} children child:${child.id} maxWidth:${maxWidth} maxHeight:${maxHeight}`
1594
- );
1595
- }
1596
- }
1597
- for (const child of block.children) {
1598
- setBlockSizes(child, db2, maxWidth, maxHeight);
1599
- }
1600
- const columns = block.columns ?? -1;
1601
- let numItems = 0;
1602
- for (const child of block.children) {
1603
- numItems += child.widthInColumns ?? 1;
1604
- }
1605
- let xSize = block.children.length;
1606
- if (columns > 0 && columns < numItems) {
1607
- xSize = columns;
1608
- }
1609
- const ySize = Math.ceil(numItems / xSize);
1610
- let width = xSize * (maxWidth + padding) + padding;
1611
- let height = ySize * (maxHeight + padding) + padding;
1612
- if (width < siblingWidth) {
1613
- log.debug(
1614
- `Detected to small siebling: abc95 ${block.id} sieblingWidth ${siblingWidth} sieblingHeight ${siblingHeight} width ${width}`
1615
- );
1616
- width = siblingWidth;
1617
- height = siblingHeight;
1618
- const childWidth = (siblingWidth - xSize * padding - padding) / xSize;
1619
- const childHeight = (siblingHeight - ySize * padding - padding) / ySize;
1620
- log.debug("Size indata abc88", block.id, "childWidth", childWidth, "maxWidth", maxWidth);
1621
- log.debug("Size indata abc88", block.id, "childHeight", childHeight, "maxHeight", maxHeight);
1622
- log.debug("Size indata abc88 xSize", xSize, "padding", padding);
1623
- for (const child of block.children) {
1624
- if (child.size) {
1625
- child.size.width = childWidth;
1626
- child.size.height = childHeight;
1627
- child.size.x = 0;
1628
- child.size.y = 0;
1629
- }
1630
- }
1631
- }
1632
- log.debug(
1633
- `abc95 (finale calc) ${block.id} xSize ${xSize} ySize ${ySize} columns ${columns}${block.children.length} width=${Math.max(width, block.size?.width || 0)}`
1634
- );
1635
- if (width < (block?.size?.width || 0)) {
1636
- width = block?.size?.width || 0;
1637
- const num = columns > 0 ? Math.min(block.children.length, columns) : block.children.length;
1638
- if (num > 0) {
1639
- const childWidth = (width - num * padding - padding) / num;
1640
- log.debug("abc95 (growing to fit) width", block.id, width, block.size?.width, childWidth);
1641
- for (const child of block.children) {
1642
- if (child.size) {
1643
- child.size.width = childWidth;
1644
- }
1645
- }
1646
- }
1647
- }
1648
- block.size = {
1649
- width,
1650
- height,
1651
- x: 0,
1652
- y: 0
1653
- };
1654
- }
1655
- log.debug(
1656
- "setBlockSizes abc94 (done)",
1657
- block.id,
1658
- block?.size?.x,
1659
- block?.size?.width,
1660
- block?.size?.y,
1661
- block?.size?.height
1662
- );
1663
- }
1664
- __name(setBlockSizes, "setBlockSizes");
1665
- function layoutBlocks(block, db2) {
1666
- log.debug(
1667
- `abc85 layout blocks (=>layoutBlocks) ${block.id} x: ${block?.size?.x} y: ${block?.size?.y} width: ${block?.size?.width}`
1668
- );
1669
- const columns = block.columns ?? -1;
1670
- log.debug("layoutBlocks columns abc95", block.id, "=>", columns, block);
1671
- if (block.children && // find max width of children
1672
- block.children.length > 0) {
1673
- const width = block?.children[0]?.size?.width ?? 0;
1674
- const widthOfChildren = block.children.length * width + (block.children.length - 1) * padding;
1675
- log.debug("widthOfChildren 88", widthOfChildren, "posX");
1676
- let columnPos = 0;
1677
- log.debug("abc91 block?.size?.x", block.id, block?.size?.x);
1678
- let startingPosX = block?.size?.x ? block?.size?.x + (-block?.size?.width / 2 || 0) : -padding;
1679
- let rowPos = 0;
1680
- for (const child of block.children) {
1681
- const parent = block;
1682
- if (!child.size) {
1683
- continue;
1684
- }
1685
- const { width: width2, height } = child.size;
1686
- const { px, py } = calculateBlockPosition(columns, columnPos);
1687
- if (py != rowPos) {
1688
- rowPos = py;
1689
- startingPosX = block?.size?.x ? block?.size?.x + (-block?.size?.width / 2 || 0) : -padding;
1690
- log.debug("New row in layout for block", block.id, " and child ", child.id, rowPos);
1691
- }
1692
- log.debug(
1693
- `abc89 layout blocks (child) id: ${child.id} Pos: ${columnPos} (px, py) ${px},${py} (${parent?.size?.x},${parent?.size?.y}) parent: ${parent.id} width: ${width2}${padding}`
1694
- );
1695
- if (parent.size) {
1696
- const halfWidth = width2 / 2;
1697
- child.size.x = startingPosX + padding + halfWidth;
1698
- log.debug(
1699
- `abc91 layout blocks (calc) px, pyid:${child.id} startingPos=X${startingPosX} new startingPosX${child.size.x} ${halfWidth} padding=${padding} width=${width2} halfWidth=${halfWidth} => x:${child.size.x} y:${child.size.y} ${child.widthInColumns} (width * (child?.w || 1)) / 2 ${width2 * (child?.widthInColumns ?? 1) / 2}`
1700
- );
1701
- startingPosX = child.size.x + halfWidth;
1702
- child.size.y = parent.size.y - parent.size.height / 2 + py * (height + padding) + height / 2 + padding;
1703
- log.debug(
1704
- `abc88 layout blocks (calc) px, pyid:${child.id}startingPosX${startingPosX}${padding}${halfWidth}=>x:${child.size.x}y:${child.size.y}${child.widthInColumns}(width * (child?.w || 1)) / 2${width2 * (child?.widthInColumns ?? 1) / 2}`
1705
- );
1706
- }
1707
- if (child.children) {
1708
- layoutBlocks(child, db2);
1709
- }
1710
- columnPos += child?.widthInColumns ?? 1;
1711
- log.debug("abc88 columnsPos", child, columnPos);
1712
- }
1713
- }
1714
- log.debug(
1715
- `layout blocks (<==layoutBlocks) ${block.id} x: ${block?.size?.x} y: ${block?.size?.y} width: ${block?.size?.width}`
1716
- );
1717
- }
1718
- __name(layoutBlocks, "layoutBlocks");
1719
- function findBounds(block, { minX, minY, maxX, maxY } = { minX: 0, minY: 0, maxX: 0, maxY: 0 }) {
1720
- if (block.size && block.id !== "root") {
1721
- const { x, y, width, height } = block.size;
1722
- if (x - width / 2 < minX) {
1723
- minX = x - width / 2;
1724
- }
1725
- if (y - height / 2 < minY) {
1726
- minY = y - height / 2;
1727
- }
1728
- if (x + width / 2 > maxX) {
1729
- maxX = x + width / 2;
1730
- }
1731
- if (y + height / 2 > maxY) {
1732
- maxY = y + height / 2;
1733
- }
1734
- }
1735
- if (block.children) {
1736
- for (const child of block.children) {
1737
- ({ minX, minY, maxX, maxY } = findBounds(child, { minX, minY, maxX, maxY }));
1738
- }
1739
- }
1740
- return { minX, minY, maxX, maxY };
1741
- }
1742
- __name(findBounds, "findBounds");
1743
- function layout(db2) {
1744
- const root = db2.getBlock("root");
1745
- if (!root) {
1746
- return;
1747
- }
1748
- setBlockSizes(root, db2, 0, 0);
1749
- layoutBlocks(root, db2);
1750
- log.debug("getBlocks", JSON.stringify(root, null, 2));
1751
- const { minX, minY, maxX, maxY } = findBounds(root);
1752
- const height = maxY - minY;
1753
- const width = maxX - minX;
1754
- return { x: minX, y: minY, width, height };
1755
- }
1756
- __name(layout, "layout");
1757
- function applyStyle(dom, styleFn) {
1758
- if (styleFn) {
1759
- dom.attr("style", styleFn);
1760
- }
1761
- }
1762
- __name(applyStyle, "applyStyle");
1763
- function addHtmlLabel(node) {
1764
- const fo = select_default(document.createElementNS("http://www.w3.org/2000/svg", "foreignObject"));
1765
- const div = fo.append("xhtml:div");
1766
- const label = node.label;
1767
- const labelClass = node.isNode ? "nodeLabel" : "edgeLabel";
1768
- const span = div.append("span");
1769
- span.html(label);
1770
- applyStyle(span, node.labelStyle);
1771
- span.attr("class", labelClass);
1772
- applyStyle(div, node.labelStyle);
1773
- div.style("display", "inline-block");
1774
- div.style("white-space", "nowrap");
1775
- div.attr("xmlns", "http://www.w3.org/1999/xhtml");
1776
- return fo.node();
1777
- }
1778
- __name(addHtmlLabel, "addHtmlLabel");
1779
- var createLabel = /* @__PURE__ */ __name((_vertexText, style, isTitle, isNode) => {
1780
- let vertexText = _vertexText || "";
1781
- if (typeof vertexText === "object") {
1782
- vertexText = vertexText[0];
1783
- }
1784
- if (evaluate(getConfig2().flowchart.htmlLabels)) {
1785
- vertexText = vertexText.replace(/\\n|\n/g, "<br />");
1786
- log.debug("vertexText" + vertexText);
1787
- const node = {
1788
- isNode,
1789
- label: replaceIconSubstring(decodeEntities(vertexText)),
1790
- labelStyle: style.replace("fill:", "color:")
1791
- };
1792
- let vertexNode = addHtmlLabel(node);
1793
- return vertexNode;
1794
- } else {
1795
- const svgLabel = document.createElementNS("http://www.w3.org/2000/svg", "text");
1796
- svgLabel.setAttribute("style", style.replace("color:", "fill:"));
1797
- let rows = [];
1798
- if (typeof vertexText === "string") {
1799
- rows = vertexText.split(/\\n|\n|<br\s*\/?>/gi);
1800
- } else if (Array.isArray(vertexText)) {
1801
- rows = vertexText;
1802
- } else {
1803
- rows = [];
1804
- }
1805
- for (const row of rows) {
1806
- const tspan = document.createElementNS("http://www.w3.org/2000/svg", "tspan");
1807
- tspan.setAttributeNS("http://www.w3.org/XML/1998/namespace", "xml:space", "preserve");
1808
- tspan.setAttribute("dy", "1em");
1809
- tspan.setAttribute("x", "0");
1810
- if (isTitle) {
1811
- tspan.setAttribute("class", "title-row");
1812
- } else {
1813
- tspan.setAttribute("class", "row");
1814
- }
1815
- tspan.textContent = row.trim();
1816
- svgLabel.appendChild(tspan);
1817
- }
1818
- return svgLabel;
1819
- }
1820
- }, "createLabel");
1821
- var createLabel_default = createLabel;
1822
- var addEdgeMarkers = /* @__PURE__ */ __name((svgPath, edge, url, id, diagramType) => {
1823
- if (edge.arrowTypeStart) {
1824
- addEdgeMarker(svgPath, "start", edge.arrowTypeStart, url, id, diagramType);
1825
- }
1826
- if (edge.arrowTypeEnd) {
1827
- addEdgeMarker(svgPath, "end", edge.arrowTypeEnd, url, id, diagramType);
1828
- }
1829
- }, "addEdgeMarkers");
1830
- var arrowTypesMap = {
1831
- arrow_cross: "cross",
1832
- arrow_point: "point",
1833
- arrow_barb: "barb",
1834
- arrow_circle: "circle",
1835
- aggregation: "aggregation",
1836
- extension: "extension",
1837
- composition: "composition",
1838
- dependency: "dependency",
1839
- lollipop: "lollipop"
1840
- };
1841
- var addEdgeMarker = /* @__PURE__ */ __name((svgPath, position, arrowType, url, id, diagramType) => {
1842
- const endMarkerType = arrowTypesMap[arrowType];
1843
- if (!endMarkerType) {
1844
- log.warn(`Unknown arrow type: ${arrowType}`);
1845
- return;
1846
- }
1847
- const suffix = position === "start" ? "Start" : "End";
1848
- svgPath.attr(`marker-${position}`, `url(${url}#${id}_${diagramType}-${endMarkerType}${suffix})`);
1849
- }, "addEdgeMarker");
1850
- var edgeLabels = {};
1851
- var terminalLabels = {};
1852
- var insertEdgeLabel = /* @__PURE__ */ __name((elem, edge) => {
1853
- const config2 = getConfig2();
1854
- const useHtmlLabels = evaluate(config2.flowchart.htmlLabels);
1855
- const labelElement = edge.labelType === "markdown" ? createText(
1856
- elem,
1857
- edge.label,
1858
- {
1859
- style: edge.labelStyle,
1860
- useHtmlLabels,
1861
- addSvgBackground: true
1862
- },
1863
- config2
1864
- ) : createLabel_default(edge.label, edge.labelStyle);
1865
- const edgeLabel = elem.insert("g").attr("class", "edgeLabel");
1866
- const label = edgeLabel.insert("g").attr("class", "label");
1867
- label.node().appendChild(labelElement);
1868
- let bbox = labelElement.getBBox();
1869
- if (useHtmlLabels) {
1870
- const div = labelElement.children[0];
1871
- const dv = select_default(labelElement);
1872
- bbox = div.getBoundingClientRect();
1873
- dv.attr("width", bbox.width);
1874
- dv.attr("height", bbox.height);
1875
- }
1876
- label.attr("transform", "translate(" + -bbox.width / 2 + ", " + -bbox.height / 2 + ")");
1877
- edgeLabels[edge.id] = edgeLabel;
1878
- edge.width = bbox.width;
1879
- edge.height = bbox.height;
1880
- let fo;
1881
- if (edge.startLabelLeft) {
1882
- const startLabelElement = createLabel_default(edge.startLabelLeft, edge.labelStyle);
1883
- const startEdgeLabelLeft = elem.insert("g").attr("class", "edgeTerminals");
1884
- const inner = startEdgeLabelLeft.insert("g").attr("class", "inner");
1885
- fo = inner.node().appendChild(startLabelElement);
1886
- const slBox = startLabelElement.getBBox();
1887
- inner.attr("transform", "translate(" + -slBox.width / 2 + ", " + -slBox.height / 2 + ")");
1888
- if (!terminalLabels[edge.id]) {
1889
- terminalLabels[edge.id] = {};
1890
- }
1891
- terminalLabels[edge.id].startLeft = startEdgeLabelLeft;
1892
- setTerminalWidth(fo, edge.startLabelLeft);
1893
- }
1894
- if (edge.startLabelRight) {
1895
- const startLabelElement = createLabel_default(edge.startLabelRight, edge.labelStyle);
1896
- const startEdgeLabelRight = elem.insert("g").attr("class", "edgeTerminals");
1897
- const inner = startEdgeLabelRight.insert("g").attr("class", "inner");
1898
- fo = startEdgeLabelRight.node().appendChild(startLabelElement);
1899
- inner.node().appendChild(startLabelElement);
1900
- const slBox = startLabelElement.getBBox();
1901
- inner.attr("transform", "translate(" + -slBox.width / 2 + ", " + -slBox.height / 2 + ")");
1902
- if (!terminalLabels[edge.id]) {
1903
- terminalLabels[edge.id] = {};
1904
- }
1905
- terminalLabels[edge.id].startRight = startEdgeLabelRight;
1906
- setTerminalWidth(fo, edge.startLabelRight);
1907
- }
1908
- if (edge.endLabelLeft) {
1909
- const endLabelElement = createLabel_default(edge.endLabelLeft, edge.labelStyle);
1910
- const endEdgeLabelLeft = elem.insert("g").attr("class", "edgeTerminals");
1911
- const inner = endEdgeLabelLeft.insert("g").attr("class", "inner");
1912
- fo = inner.node().appendChild(endLabelElement);
1913
- const slBox = endLabelElement.getBBox();
1914
- inner.attr("transform", "translate(" + -slBox.width / 2 + ", " + -slBox.height / 2 + ")");
1915
- endEdgeLabelLeft.node().appendChild(endLabelElement);
1916
- if (!terminalLabels[edge.id]) {
1917
- terminalLabels[edge.id] = {};
1918
- }
1919
- terminalLabels[edge.id].endLeft = endEdgeLabelLeft;
1920
- setTerminalWidth(fo, edge.endLabelLeft);
1921
- }
1922
- if (edge.endLabelRight) {
1923
- const endLabelElement = createLabel_default(edge.endLabelRight, edge.labelStyle);
1924
- const endEdgeLabelRight = elem.insert("g").attr("class", "edgeTerminals");
1925
- const inner = endEdgeLabelRight.insert("g").attr("class", "inner");
1926
- fo = inner.node().appendChild(endLabelElement);
1927
- const slBox = endLabelElement.getBBox();
1928
- inner.attr("transform", "translate(" + -slBox.width / 2 + ", " + -slBox.height / 2 + ")");
1929
- endEdgeLabelRight.node().appendChild(endLabelElement);
1930
- if (!terminalLabels[edge.id]) {
1931
- terminalLabels[edge.id] = {};
1932
- }
1933
- terminalLabels[edge.id].endRight = endEdgeLabelRight;
1934
- setTerminalWidth(fo, edge.endLabelRight);
1935
- }
1936
- return labelElement;
1937
- }, "insertEdgeLabel");
1938
- function setTerminalWidth(fo, value) {
1939
- if (getConfig2().flowchart.htmlLabels && fo) {
1940
- fo.style.width = value.length * 9 + "px";
1941
- fo.style.height = "12px";
1942
- }
1943
- }
1944
- __name(setTerminalWidth, "setTerminalWidth");
1945
- var positionEdgeLabel = /* @__PURE__ */ __name((edge, paths) => {
1946
- log.debug("Moving label abc88 ", edge.id, edge.label, edgeLabels[edge.id], paths);
1947
- let path = paths.updatedPath ? paths.updatedPath : paths.originalPath;
1948
- const siteConfig = getConfig2();
1949
- const { subGraphTitleTotalMargin } = getSubGraphTitleMargins(siteConfig);
1950
- if (edge.label) {
1951
- const el = edgeLabels[edge.id];
1952
- let x = edge.x;
1953
- let y = edge.y;
1954
- if (path) {
1955
- const pos = utils_default.calcLabelPosition(path);
1956
- log.debug(
1957
- "Moving label " + edge.label + " from (",
1958
- x,
1959
- ",",
1960
- y,
1961
- ") to (",
1962
- pos.x,
1963
- ",",
1964
- pos.y,
1965
- ") abc88"
1966
- );
1967
- if (paths.updatedPath) {
1968
- x = pos.x;
1969
- y = pos.y;
1970
- }
1971
- }
1972
- el.attr("transform", `translate(${x}, ${y + subGraphTitleTotalMargin / 2})`);
1973
- }
1974
- if (edge.startLabelLeft) {
1975
- const el = terminalLabels[edge.id].startLeft;
1976
- let x = edge.x;
1977
- let y = edge.y;
1978
- if (path) {
1979
- const pos = utils_default.calcTerminalLabelPosition(edge.arrowTypeStart ? 10 : 0, "start_left", path);
1980
- x = pos.x;
1981
- y = pos.y;
1982
- }
1983
- el.attr("transform", `translate(${x}, ${y})`);
1984
- }
1985
- if (edge.startLabelRight) {
1986
- const el = terminalLabels[edge.id].startRight;
1987
- let x = edge.x;
1988
- let y = edge.y;
1989
- if (path) {
1990
- const pos = utils_default.calcTerminalLabelPosition(
1991
- edge.arrowTypeStart ? 10 : 0,
1992
- "start_right",
1993
- path
1994
- );
1995
- x = pos.x;
1996
- y = pos.y;
1997
- }
1998
- el.attr("transform", `translate(${x}, ${y})`);
1999
- }
2000
- if (edge.endLabelLeft) {
2001
- const el = terminalLabels[edge.id].endLeft;
2002
- let x = edge.x;
2003
- let y = edge.y;
2004
- if (path) {
2005
- const pos = utils_default.calcTerminalLabelPosition(edge.arrowTypeEnd ? 10 : 0, "end_left", path);
2006
- x = pos.x;
2007
- y = pos.y;
2008
- }
2009
- el.attr("transform", `translate(${x}, ${y})`);
2010
- }
2011
- if (edge.endLabelRight) {
2012
- const el = terminalLabels[edge.id].endRight;
2013
- let x = edge.x;
2014
- let y = edge.y;
2015
- if (path) {
2016
- const pos = utils_default.calcTerminalLabelPosition(edge.arrowTypeEnd ? 10 : 0, "end_right", path);
2017
- x = pos.x;
2018
- y = pos.y;
2019
- }
2020
- el.attr("transform", `translate(${x}, ${y})`);
2021
- }
2022
- }, "positionEdgeLabel");
2023
- var outsideNode = /* @__PURE__ */ __name((node, point2) => {
2024
- const x = node.x;
2025
- const y = node.y;
2026
- const dx = Math.abs(point2.x - x);
2027
- const dy = Math.abs(point2.y - y);
2028
- const w = node.width / 2;
2029
- const h = node.height / 2;
2030
- if (dx >= w || dy >= h) {
2031
- return true;
2032
- }
2033
- return false;
2034
- }, "outsideNode");
2035
- var intersection = /* @__PURE__ */ __name((node, outsidePoint, insidePoint) => {
2036
- log.debug(`intersection calc abc89:
2037
- outsidePoint: ${JSON.stringify(outsidePoint)}
2038
- insidePoint : ${JSON.stringify(insidePoint)}
2039
- node : x:${node.x} y:${node.y} w:${node.width} h:${node.height}`);
2040
- const x = node.x;
2041
- const y = node.y;
2042
- const dx = Math.abs(x - insidePoint.x);
2043
- const w = node.width / 2;
2044
- let r = insidePoint.x < outsidePoint.x ? w - dx : w + dx;
2045
- const h = node.height / 2;
2046
- const Q = Math.abs(outsidePoint.y - insidePoint.y);
2047
- const R = Math.abs(outsidePoint.x - insidePoint.x);
2048
- if (Math.abs(y - outsidePoint.y) * w > Math.abs(x - outsidePoint.x) * h) {
2049
- let q = insidePoint.y < outsidePoint.y ? outsidePoint.y - h - y : y - h - outsidePoint.y;
2050
- r = R * q / Q;
2051
- const res = {
2052
- x: insidePoint.x < outsidePoint.x ? insidePoint.x + r : insidePoint.x - R + r,
2053
- y: insidePoint.y < outsidePoint.y ? insidePoint.y + Q - q : insidePoint.y - Q + q
2054
- };
2055
- if (r === 0) {
2056
- res.x = outsidePoint.x;
2057
- res.y = outsidePoint.y;
2058
- }
2059
- if (R === 0) {
2060
- res.x = outsidePoint.x;
2061
- }
2062
- if (Q === 0) {
2063
- res.y = outsidePoint.y;
2064
- }
2065
- log.debug(`abc89 topp/bott calc, Q ${Q}, q ${q}, R ${R}, r ${r}`, res);
2066
- return res;
2067
- } else {
2068
- if (insidePoint.x < outsidePoint.x) {
2069
- r = outsidePoint.x - w - x;
2070
- } else {
2071
- r = x - w - outsidePoint.x;
2072
- }
2073
- let q = Q * r / R;
2074
- let _x = insidePoint.x < outsidePoint.x ? insidePoint.x + R - r : insidePoint.x - R + r;
2075
- let _y = insidePoint.y < outsidePoint.y ? insidePoint.y + q : insidePoint.y - q;
2076
- log.debug(`sides calc abc89, Q ${Q}, q ${q}, R ${R}, r ${r}`, { _x, _y });
2077
- if (r === 0) {
2078
- _x = outsidePoint.x;
2079
- _y = outsidePoint.y;
2080
- }
2081
- if (R === 0) {
2082
- _x = outsidePoint.x;
2083
- }
2084
- if (Q === 0) {
2085
- _y = outsidePoint.y;
2086
- }
2087
- return { x: _x, y: _y };
2088
- }
2089
- }, "intersection");
2090
- var cutPathAtIntersect = /* @__PURE__ */ __name((_points, boundaryNode) => {
2091
- log.debug("abc88 cutPathAtIntersect", _points, boundaryNode);
2092
- let points = [];
2093
- let lastPointOutside = _points[0];
2094
- let isInside = false;
2095
- _points.forEach((point2) => {
2096
- if (!outsideNode(boundaryNode, point2) && !isInside) {
2097
- const inter = intersection(boundaryNode, lastPointOutside, point2);
2098
- let pointPresent = false;
2099
- points.forEach((p) => {
2100
- pointPresent = pointPresent || p.x === inter.x && p.y === inter.y;
2101
- });
2102
- if (!points.some((e) => e.x === inter.x && e.y === inter.y)) {
2103
- points.push(inter);
2104
- }
2105
- isInside = true;
2106
- } else {
2107
- lastPointOutside = point2;
2108
- if (!isInside) {
2109
- points.push(point2);
2110
- }
2111
- }
2112
- });
2113
- return points;
2114
- }, "cutPathAtIntersect");
2115
- var insertEdge = /* @__PURE__ */ __name(function(elem, e, edge, clusterDb, diagramType, graph, id) {
2116
- let points = edge.points;
2117
- log.debug("abc88 InsertEdge: edge=", edge, "e=", e);
2118
- let pointsHasChanged = false;
2119
- const tail = graph.node(e.v);
2120
- var head = graph.node(e.w);
2121
- if (head?.intersect && tail?.intersect) {
2122
- points = points.slice(1, edge.points.length - 1);
2123
- points.unshift(tail.intersect(points[0]));
2124
- points.push(head.intersect(points[points.length - 1]));
2125
- }
2126
- if (edge.toCluster) {
2127
- log.debug("to cluster abc88", clusterDb[edge.toCluster]);
2128
- points = cutPathAtIntersect(edge.points, clusterDb[edge.toCluster].node);
2129
- pointsHasChanged = true;
2130
- }
2131
- if (edge.fromCluster) {
2132
- log.debug("from cluster abc88", clusterDb[edge.fromCluster]);
2133
- points = cutPathAtIntersect(points.reverse(), clusterDb[edge.fromCluster].node).reverse();
2134
- pointsHasChanged = true;
2135
- }
2136
- const lineData = points.filter((p) => !Number.isNaN(p.y));
2137
- let curve = basis_default;
2138
- if (edge.curve && (diagramType === "graph" || diagramType === "flowchart")) {
2139
- curve = edge.curve;
2140
- }
2141
- const { x, y } = getLineFunctionsWithOffset(edge);
2142
- const lineFunction = line_default().x(x).y(y).curve(curve);
2143
- let strokeClasses;
2144
- switch (edge.thickness) {
2145
- case "normal":
2146
- strokeClasses = "edge-thickness-normal";
2147
- break;
2148
- case "thick":
2149
- strokeClasses = "edge-thickness-thick";
2150
- break;
2151
- case "invisible":
2152
- strokeClasses = "edge-thickness-thick";
2153
- break;
2154
- default:
2155
- strokeClasses = "";
2156
- }
2157
- switch (edge.pattern) {
2158
- case "solid":
2159
- strokeClasses += " edge-pattern-solid";
2160
- break;
2161
- case "dotted":
2162
- strokeClasses += " edge-pattern-dotted";
2163
- break;
2164
- case "dashed":
2165
- strokeClasses += " edge-pattern-dashed";
2166
- break;
2167
- }
2168
- const svgPath = elem.append("path").attr("d", lineFunction(lineData)).attr("id", edge.id).attr("class", " " + strokeClasses + (edge.classes ? " " + edge.classes : "")).attr("style", edge.style);
2169
- let url = "";
2170
- if (getConfig2().flowchart.arrowMarkerAbsolute || getConfig2().state.arrowMarkerAbsolute) {
2171
- url = window.location.protocol + "//" + window.location.host + window.location.pathname + window.location.search;
2172
- url = url.replace(/\(/g, "\\(");
2173
- url = url.replace(/\)/g, "\\)");
2174
- }
2175
- addEdgeMarkers(svgPath, edge, url, id, diagramType);
2176
- let paths = {};
2177
- if (pointsHasChanged) {
2178
- paths.updatedPath = points;
2179
- }
2180
- paths.originalPath = edge.points;
2181
- return paths;
2182
- }, "insertEdge");
2183
- var expandAndDeduplicateDirections = /* @__PURE__ */ __name((directions) => {
2184
- const uniqueDirections = /* @__PURE__ */ new Set();
2185
- for (const direction of directions) {
2186
- switch (direction) {
2187
- case "x":
2188
- uniqueDirections.add("right");
2189
- uniqueDirections.add("left");
2190
- break;
2191
- case "y":
2192
- uniqueDirections.add("up");
2193
- uniqueDirections.add("down");
2194
- break;
2195
- default:
2196
- uniqueDirections.add(direction);
2197
- break;
2198
- }
2199
- }
2200
- return uniqueDirections;
2201
- }, "expandAndDeduplicateDirections");
2202
- var getArrowPoints = /* @__PURE__ */ __name((duplicatedDirections, bbox, node) => {
2203
- const directions = expandAndDeduplicateDirections(duplicatedDirections);
2204
- const f = 2;
2205
- const height = bbox.height + 2 * node.padding;
2206
- const midpoint = height / f;
2207
- const width = bbox.width + 2 * midpoint + node.padding;
2208
- const padding2 = node.padding / 2;
2209
- if (directions.has("right") && directions.has("left") && directions.has("up") && directions.has("down")) {
2210
- return [
2211
- // Bottom
2212
- { x: 0, y: 0 },
2213
- { x: midpoint, y: 0 },
2214
- { x: width / 2, y: 2 * padding2 },
2215
- { x: width - midpoint, y: 0 },
2216
- { x: width, y: 0 },
2217
- // Right
2218
- { x: width, y: -height / 3 },
2219
- { x: width + 2 * padding2, y: -height / 2 },
2220
- { x: width, y: -2 * height / 3 },
2221
- { x: width, y: -height },
2222
- // Top
2223
- { x: width - midpoint, y: -height },
2224
- { x: width / 2, y: -height - 2 * padding2 },
2225
- { x: midpoint, y: -height },
2226
- // Left
2227
- { x: 0, y: -height },
2228
- { x: 0, y: -2 * height / 3 },
2229
- { x: -2 * padding2, y: -height / 2 },
2230
- { x: 0, y: -height / 3 }
2231
- ];
2232
- }
2233
- if (directions.has("right") && directions.has("left") && directions.has("up")) {
2234
- return [
2235
- { x: midpoint, y: 0 },
2236
- { x: width - midpoint, y: 0 },
2237
- { x: width, y: -height / 2 },
2238
- { x: width - midpoint, y: -height },
2239
- { x: midpoint, y: -height },
2240
- { x: 0, y: -height / 2 }
2241
- ];
2242
- }
2243
- if (directions.has("right") && directions.has("left") && directions.has("down")) {
2244
- return [
2245
- { x: 0, y: 0 },
2246
- { x: midpoint, y: -height },
2247
- { x: width - midpoint, y: -height },
2248
- { x: width, y: 0 }
2249
- ];
2250
- }
2251
- if (directions.has("right") && directions.has("up") && directions.has("down")) {
2252
- return [
2253
- { x: 0, y: 0 },
2254
- { x: width, y: -midpoint },
2255
- { x: width, y: -height + midpoint },
2256
- { x: 0, y: -height }
2257
- ];
2258
- }
2259
- if (directions.has("left") && directions.has("up") && directions.has("down")) {
2260
- return [
2261
- { x: width, y: 0 },
2262
- { x: 0, y: -midpoint },
2263
- { x: 0, y: -height + midpoint },
2264
- { x: width, y: -height }
2265
- ];
2266
- }
2267
- if (directions.has("right") && directions.has("left")) {
2268
- return [
2269
- { x: midpoint, y: 0 },
2270
- { x: midpoint, y: -padding2 },
2271
- { x: width - midpoint, y: -padding2 },
2272
- { x: width - midpoint, y: 0 },
2273
- { x: width, y: -height / 2 },
2274
- { x: width - midpoint, y: -height },
2275
- { x: width - midpoint, y: -height + padding2 },
2276
- { x: midpoint, y: -height + padding2 },
2277
- { x: midpoint, y: -height },
2278
- { x: 0, y: -height / 2 }
2279
- ];
2280
- }
2281
- if (directions.has("up") && directions.has("down")) {
2282
- return [
2283
- // Bottom center
2284
- { x: width / 2, y: 0 },
2285
- // Left pont of bottom arrow
2286
- { x: 0, y: -padding2 },
2287
- { x: midpoint, y: -padding2 },
2288
- // Left top over vertical section
2289
- { x: midpoint, y: -height + padding2 },
2290
- { x: 0, y: -height + padding2 },
2291
- // Top of arrow
2292
- { x: width / 2, y: -height },
2293
- { x: width, y: -height + padding2 },
2294
- // Top of right vertical bar
2295
- { x: width - midpoint, y: -height + padding2 },
2296
- { x: width - midpoint, y: -padding2 },
2297
- { x: width, y: -padding2 }
2298
- ];
2299
- }
2300
- if (directions.has("right") && directions.has("up")) {
2301
- return [
2302
- { x: 0, y: 0 },
2303
- { x: width, y: -midpoint },
2304
- { x: 0, y: -height }
2305
- ];
2306
- }
2307
- if (directions.has("right") && directions.has("down")) {
2308
- return [
2309
- { x: 0, y: 0 },
2310
- { x: width, y: 0 },
2311
- { x: 0, y: -height }
2312
- ];
2313
- }
2314
- if (directions.has("left") && directions.has("up")) {
2315
- return [
2316
- { x: width, y: 0 },
2317
- { x: 0, y: -midpoint },
2318
- { x: width, y: -height }
2319
- ];
2320
- }
2321
- if (directions.has("left") && directions.has("down")) {
2322
- return [
2323
- { x: width, y: 0 },
2324
- { x: 0, y: 0 },
2325
- { x: width, y: -height }
2326
- ];
2327
- }
2328
- if (directions.has("right")) {
2329
- return [
2330
- { x: midpoint, y: -padding2 },
2331
- { x: midpoint, y: -padding2 },
2332
- { x: width - midpoint, y: -padding2 },
2333
- { x: width - midpoint, y: 0 },
2334
- { x: width, y: -height / 2 },
2335
- { x: width - midpoint, y: -height },
2336
- { x: width - midpoint, y: -height + padding2 },
2337
- // top left corner of arrow
2338
- { x: midpoint, y: -height + padding2 },
2339
- { x: midpoint, y: -height + padding2 }
2340
- ];
2341
- }
2342
- if (directions.has("left")) {
2343
- return [
2344
- { x: midpoint, y: 0 },
2345
- { x: midpoint, y: -padding2 },
2346
- // Two points, the right corners
2347
- { x: width - midpoint, y: -padding2 },
2348
- { x: width - midpoint, y: -height + padding2 },
2349
- { x: midpoint, y: -height + padding2 },
2350
- { x: midpoint, y: -height },
2351
- { x: 0, y: -height / 2 }
2352
- ];
2353
- }
2354
- if (directions.has("up")) {
2355
- return [
2356
- // Bottom center
2357
- { x: midpoint, y: -padding2 },
2358
- // Left top over vertical section
2359
- { x: midpoint, y: -height + padding2 },
2360
- { x: 0, y: -height + padding2 },
2361
- // Top of arrow
2362
- { x: width / 2, y: -height },
2363
- { x: width, y: -height + padding2 },
2364
- // Top of right vertical bar
2365
- { x: width - midpoint, y: -height + padding2 },
2366
- { x: width - midpoint, y: -padding2 }
2367
- ];
2368
- }
2369
- if (directions.has("down")) {
2370
- return [
2371
- // Bottom center
2372
- { x: width / 2, y: 0 },
2373
- // Left pont of bottom arrow
2374
- { x: 0, y: -padding2 },
2375
- { x: midpoint, y: -padding2 },
2376
- // Left top over vertical section
2377
- { x: midpoint, y: -height + padding2 },
2378
- { x: width - midpoint, y: -height + padding2 },
2379
- { x: width - midpoint, y: -padding2 },
2380
- { x: width, y: -padding2 }
2381
- ];
2382
- }
2383
- return [{ x: 0, y: 0 }];
2384
- }, "getArrowPoints");
2385
- function intersectNode(node, point2) {
2386
- return node.intersect(point2);
2387
- }
2388
- __name(intersectNode, "intersectNode");
2389
- var intersect_node_default = intersectNode;
2390
- function intersectEllipse(node, rx, ry, point2) {
2391
- var cx = node.x;
2392
- var cy = node.y;
2393
- var px = cx - point2.x;
2394
- var py = cy - point2.y;
2395
- var det = Math.sqrt(rx * rx * py * py + ry * ry * px * px);
2396
- var dx = Math.abs(rx * ry * px / det);
2397
- if (point2.x < cx) {
2398
- dx = -dx;
2399
- }
2400
- var dy = Math.abs(rx * ry * py / det);
2401
- if (point2.y < cy) {
2402
- dy = -dy;
2403
- }
2404
- return { x: cx + dx, y: cy + dy };
2405
- }
2406
- __name(intersectEllipse, "intersectEllipse");
2407
- var intersect_ellipse_default = intersectEllipse;
2408
- function intersectCircle(node, rx, point2) {
2409
- return intersect_ellipse_default(node, rx, rx, point2);
2410
- }
2411
- __name(intersectCircle, "intersectCircle");
2412
- var intersect_circle_default = intersectCircle;
2413
- function intersectLine(p1, p2, q1, q2) {
2414
- var a1, a2, b1, b2, c1, c2;
2415
- var r1, r2, r3, r4;
2416
- var denom, offset, num;
2417
- var x, y;
2418
- a1 = p2.y - p1.y;
2419
- b1 = p1.x - p2.x;
2420
- c1 = p2.x * p1.y - p1.x * p2.y;
2421
- r3 = a1 * q1.x + b1 * q1.y + c1;
2422
- r4 = a1 * q2.x + b1 * q2.y + c1;
2423
- if (r3 !== 0 && r4 !== 0 && sameSign(r3, r4)) {
2424
- return;
2425
- }
2426
- a2 = q2.y - q1.y;
2427
- b2 = q1.x - q2.x;
2428
- c2 = q2.x * q1.y - q1.x * q2.y;
2429
- r1 = a2 * p1.x + b2 * p1.y + c2;
2430
- r2 = a2 * p2.x + b2 * p2.y + c2;
2431
- if (r1 !== 0 && r2 !== 0 && sameSign(r1, r2)) {
2432
- return;
2433
- }
2434
- denom = a1 * b2 - a2 * b1;
2435
- if (denom === 0) {
2436
- return;
2437
- }
2438
- offset = Math.abs(denom / 2);
2439
- num = b1 * c2 - b2 * c1;
2440
- x = num < 0 ? (num - offset) / denom : (num + offset) / denom;
2441
- num = a2 * c1 - a1 * c2;
2442
- y = num < 0 ? (num - offset) / denom : (num + offset) / denom;
2443
- return { x, y };
2444
- }
2445
- __name(intersectLine, "intersectLine");
2446
- function sameSign(r1, r2) {
2447
- return r1 * r2 > 0;
2448
- }
2449
- __name(sameSign, "sameSign");
2450
- var intersect_line_default = intersectLine;
2451
- var intersect_polygon_default = intersectPolygon;
2452
- function intersectPolygon(node, polyPoints, point2) {
2453
- var x1 = node.x;
2454
- var y1 = node.y;
2455
- var intersections = [];
2456
- var minX = Number.POSITIVE_INFINITY;
2457
- var minY = Number.POSITIVE_INFINITY;
2458
- if (typeof polyPoints.forEach === "function") {
2459
- polyPoints.forEach(function(entry) {
2460
- minX = Math.min(minX, entry.x);
2461
- minY = Math.min(minY, entry.y);
2462
- });
2463
- } else {
2464
- minX = Math.min(minX, polyPoints.x);
2465
- minY = Math.min(minY, polyPoints.y);
2466
- }
2467
- var left = x1 - node.width / 2 - minX;
2468
- var top = y1 - node.height / 2 - minY;
2469
- for (var i = 0; i < polyPoints.length; i++) {
2470
- var p1 = polyPoints[i];
2471
- var p2 = polyPoints[i < polyPoints.length - 1 ? i + 1 : 0];
2472
- var intersect = intersect_line_default(
2473
- node,
2474
- point2,
2475
- { x: left + p1.x, y: top + p1.y },
2476
- { x: left + p2.x, y: top + p2.y }
2477
- );
2478
- if (intersect) {
2479
- intersections.push(intersect);
2480
- }
2481
- }
2482
- if (!intersections.length) {
2483
- return node;
2484
- }
2485
- if (intersections.length > 1) {
2486
- intersections.sort(function(p, q) {
2487
- var pdx = p.x - point2.x;
2488
- var pdy = p.y - point2.y;
2489
- var distp = Math.sqrt(pdx * pdx + pdy * pdy);
2490
- var qdx = q.x - point2.x;
2491
- var qdy = q.y - point2.y;
2492
- var distq = Math.sqrt(qdx * qdx + qdy * qdy);
2493
- return distp < distq ? -1 : distp === distq ? 0 : 1;
2494
- });
2495
- }
2496
- return intersections[0];
2497
- }
2498
- __name(intersectPolygon, "intersectPolygon");
2499
- var intersectRect = /* @__PURE__ */ __name((node, point2) => {
2500
- var x = node.x;
2501
- var y = node.y;
2502
- var dx = point2.x - x;
2503
- var dy = point2.y - y;
2504
- var w = node.width / 2;
2505
- var h = node.height / 2;
2506
- var sx, sy;
2507
- if (Math.abs(dy) * w > Math.abs(dx) * h) {
2508
- if (dy < 0) {
2509
- h = -h;
2510
- }
2511
- sx = dy === 0 ? 0 : h * dx / dy;
2512
- sy = h;
2513
- } else {
2514
- if (dx < 0) {
2515
- w = -w;
2516
- }
2517
- sx = w;
2518
- sy = dx === 0 ? 0 : w * dy / dx;
2519
- }
2520
- return { x: x + sx, y: y + sy };
2521
- }, "intersectRect");
2522
- var intersect_rect_default = intersectRect;
2523
- var intersect_default = {
2524
- node: intersect_node_default,
2525
- circle: intersect_circle_default,
2526
- ellipse: intersect_ellipse_default,
2527
- polygon: intersect_polygon_default,
2528
- rect: intersect_rect_default
2529
- };
2530
- var labelHelper = /* @__PURE__ */ __name(async (parent, node, _classes, isNode) => {
2531
- const config2 = getConfig2();
2532
- let classes2;
2533
- const useHtmlLabels = node.useHtmlLabels || evaluate(config2.flowchart.htmlLabels);
2534
- if (!_classes) {
2535
- classes2 = "node default";
2536
- } else {
2537
- classes2 = _classes;
2538
- }
2539
- const shapeSvg = parent.insert("g").attr("class", classes2).attr("id", node.domId || node.id);
2540
- const label = shapeSvg.insert("g").attr("class", "label").attr("style", node.labelStyle);
2541
- let labelText;
2542
- if (node.labelText === void 0) {
2543
- labelText = "";
2544
- } else {
2545
- labelText = typeof node.labelText === "string" ? node.labelText : node.labelText[0];
2546
- }
2547
- const textNode = label.node();
2548
- let text;
2549
- if (node.labelType === "markdown") {
2550
- text = createText(
2551
- label,
2552
- sanitizeText(decodeEntities(labelText), config2),
2553
- {
2554
- useHtmlLabels,
2555
- width: node.width || config2.flowchart.wrappingWidth,
2556
- classes: "markdown-node-label"
2557
- },
2558
- config2
2559
- );
2560
- } else {
2561
- text = textNode.appendChild(
2562
- createLabel_default(sanitizeText(decodeEntities(labelText), config2), node.labelStyle, false, isNode)
2563
- );
2564
- }
2565
- let bbox = text.getBBox();
2566
- const halfPadding = node.padding / 2;
2567
- if (evaluate(config2.flowchart.htmlLabels)) {
2568
- const div = text.children[0];
2569
- const dv = select_default(text);
2570
- const images = div.getElementsByTagName("img");
2571
- if (images) {
2572
- const noImgText = labelText.replace(/<img[^>]*>/g, "").trim() === "";
2573
- await Promise.all(
2574
- [...images].map(
2575
- (img) => new Promise((res) => {
2576
- function setupImage() {
2577
- img.style.display = "flex";
2578
- img.style.flexDirection = "column";
2579
- if (noImgText) {
2580
- const bodyFontSize = config2.fontSize ? config2.fontSize : window.getComputedStyle(document.body).fontSize;
2581
- const enlargingFactor = 5;
2582
- const width = parseInt(bodyFontSize, 10) * enlargingFactor + "px";
2583
- img.style.minWidth = width;
2584
- img.style.maxWidth = width;
2585
- } else {
2586
- img.style.width = "100%";
2587
- }
2588
- res(img);
2589
- }
2590
- __name(setupImage, "setupImage");
2591
- setTimeout(() => {
2592
- if (img.complete) {
2593
- setupImage();
2594
- }
2595
- });
2596
- img.addEventListener("error", setupImage);
2597
- img.addEventListener("load", setupImage);
2598
- })
2599
- )
2600
- );
2601
- }
2602
- bbox = div.getBoundingClientRect();
2603
- dv.attr("width", bbox.width);
2604
- dv.attr("height", bbox.height);
2605
- }
2606
- if (useHtmlLabels) {
2607
- label.attr("transform", "translate(" + -bbox.width / 2 + ", " + -bbox.height / 2 + ")");
2608
- } else {
2609
- label.attr("transform", "translate(0, " + -bbox.height / 2 + ")");
2610
- }
2611
- if (node.centerLabel) {
2612
- label.attr("transform", "translate(" + -bbox.width / 2 + ", " + -bbox.height / 2 + ")");
2613
- }
2614
- label.insert("rect", ":first-child");
2615
- return { shapeSvg, bbox, halfPadding, label };
2616
- }, "labelHelper");
2617
- var updateNodeBounds = /* @__PURE__ */ __name((node, element) => {
2618
- const bbox = element.node().getBBox();
2619
- node.width = bbox.width;
2620
- node.height = bbox.height;
2621
- }, "updateNodeBounds");
2622
- function insertPolygonShape(parent, w, h, points) {
2623
- return parent.insert("polygon", ":first-child").attr(
2624
- "points",
2625
- points.map(function(d) {
2626
- return d.x + "," + d.y;
2627
- }).join(" ")
2628
- ).attr("class", "label-container").attr("transform", "translate(" + -w / 2 + "," + h / 2 + ")");
2629
- }
2630
- __name(insertPolygonShape, "insertPolygonShape");
2631
- var note = /* @__PURE__ */ __name(async (parent, node) => {
2632
- const useHtmlLabels = node.useHtmlLabels || getConfig2().flowchart.htmlLabels;
2633
- if (!useHtmlLabels) {
2634
- node.centerLabel = true;
2635
- }
2636
- const { shapeSvg, bbox, halfPadding } = await labelHelper(
2637
- parent,
2638
- node,
2639
- "node " + node.classes,
2640
- true
2641
- );
2642
- log.info("Classes = ", node.classes);
2643
- const rect2 = shapeSvg.insert("rect", ":first-child");
2644
- rect2.attr("rx", node.rx).attr("ry", node.ry).attr("x", -bbox.width / 2 - halfPadding).attr("y", -bbox.height / 2 - halfPadding).attr("width", bbox.width + node.padding).attr("height", bbox.height + node.padding);
2645
- updateNodeBounds(node, rect2);
2646
- node.intersect = function(point2) {
2647
- return intersect_default.rect(node, point2);
2648
- };
2649
- return shapeSvg;
2650
- }, "note");
2651
- var note_default = note;
2652
- var formatClass = /* @__PURE__ */ __name((str) => {
2653
- if (str) {
2654
- return " " + str;
2655
- }
2656
- return "";
2657
- }, "formatClass");
2658
- var getClassesFromNode = /* @__PURE__ */ __name((node, otherClasses) => {
2659
- return `${otherClasses ? otherClasses : "node default"}${formatClass(node.classes)} ${formatClass(
2660
- node.class
2661
- )}`;
2662
- }, "getClassesFromNode");
2663
- var question = /* @__PURE__ */ __name(async (parent, node) => {
2664
- const { shapeSvg, bbox } = await labelHelper(
2665
- parent,
2666
- node,
2667
- getClassesFromNode(node, void 0),
2668
- true
2669
- );
2670
- const w = bbox.width + node.padding;
2671
- const h = bbox.height + node.padding;
2672
- const s = w + h;
2673
- const points = [
2674
- { x: s / 2, y: 0 },
2675
- { x: s, y: -s / 2 },
2676
- { x: s / 2, y: -s },
2677
- { x: 0, y: -s / 2 }
2678
- ];
2679
- log.info("Question main (Circle)");
2680
- const questionElem = insertPolygonShape(shapeSvg, s, s, points);
2681
- questionElem.attr("style", node.style);
2682
- updateNodeBounds(node, questionElem);
2683
- node.intersect = function(point2) {
2684
- log.warn("Intersect called");
2685
- return intersect_default.polygon(node, points, point2);
2686
- };
2687
- return shapeSvg;
2688
- }, "question");
2689
- var choice = /* @__PURE__ */ __name((parent, node) => {
2690
- const shapeSvg = parent.insert("g").attr("class", "node default").attr("id", node.domId || node.id);
2691
- const s = 28;
2692
- const points = [
2693
- { x: 0, y: s / 2 },
2694
- { x: s / 2, y: 0 },
2695
- { x: 0, y: -s / 2 },
2696
- { x: -s / 2, y: 0 }
2697
- ];
2698
- const choice2 = shapeSvg.insert("polygon", ":first-child").attr(
2699
- "points",
2700
- points.map(function(d) {
2701
- return d.x + "," + d.y;
2702
- }).join(" ")
2703
- );
2704
- choice2.attr("class", "state-start").attr("r", 7).attr("width", 28).attr("height", 28);
2705
- node.width = 28;
2706
- node.height = 28;
2707
- node.intersect = function(point2) {
2708
- return intersect_default.circle(node, 14, point2);
2709
- };
2710
- return shapeSvg;
2711
- }, "choice");
2712
- var hexagon = /* @__PURE__ */ __name(async (parent, node) => {
2713
- const { shapeSvg, bbox } = await labelHelper(
2714
- parent,
2715
- node,
2716
- getClassesFromNode(node, void 0),
2717
- true
2718
- );
2719
- const f = 4;
2720
- const h = bbox.height + node.padding;
2721
- const m = h / f;
2722
- const w = bbox.width + 2 * m + node.padding;
2723
- const points = [
2724
- { x: m, y: 0 },
2725
- { x: w - m, y: 0 },
2726
- { x: w, y: -h / 2 },
2727
- { x: w - m, y: -h },
2728
- { x: m, y: -h },
2729
- { x: 0, y: -h / 2 }
2730
- ];
2731
- const hex = insertPolygonShape(shapeSvg, w, h, points);
2732
- hex.attr("style", node.style);
2733
- updateNodeBounds(node, hex);
2734
- node.intersect = function(point2) {
2735
- return intersect_default.polygon(node, points, point2);
2736
- };
2737
- return shapeSvg;
2738
- }, "hexagon");
2739
- var block_arrow = /* @__PURE__ */ __name(async (parent, node) => {
2740
- const { shapeSvg, bbox } = await labelHelper(parent, node, void 0, true);
2741
- const f = 2;
2742
- const h = bbox.height + 2 * node.padding;
2743
- const m = h / f;
2744
- const w = bbox.width + 2 * m + node.padding;
2745
- const points = getArrowPoints(node.directions, bbox, node);
2746
- const blockArrow = insertPolygonShape(shapeSvg, w, h, points);
2747
- blockArrow.attr("style", node.style);
2748
- updateNodeBounds(node, blockArrow);
2749
- node.intersect = function(point2) {
2750
- return intersect_default.polygon(node, points, point2);
2751
- };
2752
- return shapeSvg;
2753
- }, "block_arrow");
2754
- var rect_left_inv_arrow = /* @__PURE__ */ __name(async (parent, node) => {
2755
- const { shapeSvg, bbox } = await labelHelper(
2756
- parent,
2757
- node,
2758
- getClassesFromNode(node, void 0),
2759
- true
2760
- );
2761
- const w = bbox.width + node.padding;
2762
- const h = bbox.height + node.padding;
2763
- const points = [
2764
- { x: -h / 2, y: 0 },
2765
- { x: w, y: 0 },
2766
- { x: w, y: -h },
2767
- { x: -h / 2, y: -h },
2768
- { x: 0, y: -h / 2 }
2769
- ];
2770
- const el = insertPolygonShape(shapeSvg, w, h, points);
2771
- el.attr("style", node.style);
2772
- node.width = w + h;
2773
- node.height = h;
2774
- node.intersect = function(point2) {
2775
- return intersect_default.polygon(node, points, point2);
2776
- };
2777
- return shapeSvg;
2778
- }, "rect_left_inv_arrow");
2779
- var lean_right = /* @__PURE__ */ __name(async (parent, node) => {
2780
- const { shapeSvg, bbox } = await labelHelper(parent, node, getClassesFromNode(node), true);
2781
- const w = bbox.width + node.padding;
2782
- const h = bbox.height + node.padding;
2783
- const points = [
2784
- { x: -2 * h / 6, y: 0 },
2785
- { x: w - h / 6, y: 0 },
2786
- { x: w + 2 * h / 6, y: -h },
2787
- { x: h / 6, y: -h }
2788
- ];
2789
- const el = insertPolygonShape(shapeSvg, w, h, points);
2790
- el.attr("style", node.style);
2791
- updateNodeBounds(node, el);
2792
- node.intersect = function(point2) {
2793
- return intersect_default.polygon(node, points, point2);
2794
- };
2795
- return shapeSvg;
2796
- }, "lean_right");
2797
- var lean_left = /* @__PURE__ */ __name(async (parent, node) => {
2798
- const { shapeSvg, bbox } = await labelHelper(
2799
- parent,
2800
- node,
2801
- getClassesFromNode(node, void 0),
2802
- true
2803
- );
2804
- const w = bbox.width + node.padding;
2805
- const h = bbox.height + node.padding;
2806
- const points = [
2807
- { x: 2 * h / 6, y: 0 },
2808
- { x: w + h / 6, y: 0 },
2809
- { x: w - 2 * h / 6, y: -h },
2810
- { x: -h / 6, y: -h }
2811
- ];
2812
- const el = insertPolygonShape(shapeSvg, w, h, points);
2813
- el.attr("style", node.style);
2814
- updateNodeBounds(node, el);
2815
- node.intersect = function(point2) {
2816
- return intersect_default.polygon(node, points, point2);
2817
- };
2818
- return shapeSvg;
2819
- }, "lean_left");
2820
- var trapezoid = /* @__PURE__ */ __name(async (parent, node) => {
2821
- const { shapeSvg, bbox } = await labelHelper(
2822
- parent,
2823
- node,
2824
- getClassesFromNode(node, void 0),
2825
- true
2826
- );
2827
- const w = bbox.width + node.padding;
2828
- const h = bbox.height + node.padding;
2829
- const points = [
2830
- { x: -2 * h / 6, y: 0 },
2831
- { x: w + 2 * h / 6, y: 0 },
2832
- { x: w - h / 6, y: -h },
2833
- { x: h / 6, y: -h }
2834
- ];
2835
- const el = insertPolygonShape(shapeSvg, w, h, points);
2836
- el.attr("style", node.style);
2837
- updateNodeBounds(node, el);
2838
- node.intersect = function(point2) {
2839
- return intersect_default.polygon(node, points, point2);
2840
- };
2841
- return shapeSvg;
2842
- }, "trapezoid");
2843
- var inv_trapezoid = /* @__PURE__ */ __name(async (parent, node) => {
2844
- const { shapeSvg, bbox } = await labelHelper(
2845
- parent,
2846
- node,
2847
- getClassesFromNode(node, void 0),
2848
- true
2849
- );
2850
- const w = bbox.width + node.padding;
2851
- const h = bbox.height + node.padding;
2852
- const points = [
2853
- { x: h / 6, y: 0 },
2854
- { x: w - h / 6, y: 0 },
2855
- { x: w + 2 * h / 6, y: -h },
2856
- { x: -2 * h / 6, y: -h }
2857
- ];
2858
- const el = insertPolygonShape(shapeSvg, w, h, points);
2859
- el.attr("style", node.style);
2860
- updateNodeBounds(node, el);
2861
- node.intersect = function(point2) {
2862
- return intersect_default.polygon(node, points, point2);
2863
- };
2864
- return shapeSvg;
2865
- }, "inv_trapezoid");
2866
- var rect_right_inv_arrow = /* @__PURE__ */ __name(async (parent, node) => {
2867
- const { shapeSvg, bbox } = await labelHelper(
2868
- parent,
2869
- node,
2870
- getClassesFromNode(node, void 0),
2871
- true
2872
- );
2873
- const w = bbox.width + node.padding;
2874
- const h = bbox.height + node.padding;
2875
- const points = [
2876
- { x: 0, y: 0 },
2877
- { x: w + h / 2, y: 0 },
2878
- { x: w, y: -h / 2 },
2879
- { x: w + h / 2, y: -h },
2880
- { x: 0, y: -h }
2881
- ];
2882
- const el = insertPolygonShape(shapeSvg, w, h, points);
2883
- el.attr("style", node.style);
2884
- updateNodeBounds(node, el);
2885
- node.intersect = function(point2) {
2886
- return intersect_default.polygon(node, points, point2);
2887
- };
2888
- return shapeSvg;
2889
- }, "rect_right_inv_arrow");
2890
- var cylinder = /* @__PURE__ */ __name(async (parent, node) => {
2891
- const { shapeSvg, bbox } = await labelHelper(
2892
- parent,
2893
- node,
2894
- getClassesFromNode(node, void 0),
2895
- true
2896
- );
2897
- const w = bbox.width + node.padding;
2898
- const rx = w / 2;
2899
- const ry = rx / (2.5 + w / 50);
2900
- const h = bbox.height + ry + node.padding;
2901
- const shape = "M 0," + ry + " a " + rx + "," + ry + " 0,0,0 " + w + " 0 a " + rx + "," + ry + " 0,0,0 " + -w + " 0 l 0," + h + " a " + rx + "," + ry + " 0,0,0 " + w + " 0 l 0," + -h;
2902
- const el = shapeSvg.attr("label-offset-y", ry).insert("path", ":first-child").attr("style", node.style).attr("d", shape).attr("transform", "translate(" + -w / 2 + "," + -(h / 2 + ry) + ")");
2903
- updateNodeBounds(node, el);
2904
- node.intersect = function(point2) {
2905
- const pos = intersect_default.rect(node, point2);
2906
- const x = pos.x - node.x;
2907
- if (rx != 0 && (Math.abs(x) < node.width / 2 || Math.abs(x) == node.width / 2 && Math.abs(pos.y - node.y) > node.height / 2 - ry)) {
2908
- let y = ry * ry * (1 - x * x / (rx * rx));
2909
- if (y != 0) {
2910
- y = Math.sqrt(y);
2911
- }
2912
- y = ry - y;
2913
- if (point2.y - node.y > 0) {
2914
- y = -y;
2915
- }
2916
- pos.y += y;
2917
- }
2918
- return pos;
2919
- };
2920
- return shapeSvg;
2921
- }, "cylinder");
2922
- var rect = /* @__PURE__ */ __name(async (parent, node) => {
2923
- const { shapeSvg, bbox, halfPadding } = await labelHelper(
2924
- parent,
2925
- node,
2926
- "node " + node.classes + " " + node.class,
2927
- true
2928
- );
2929
- const rect2 = shapeSvg.insert("rect", ":first-child");
2930
- const totalWidth = node.positioned ? node.width : bbox.width + node.padding;
2931
- const totalHeight = node.positioned ? node.height : bbox.height + node.padding;
2932
- const x = node.positioned ? -totalWidth / 2 : -bbox.width / 2 - halfPadding;
2933
- const y = node.positioned ? -totalHeight / 2 : -bbox.height / 2 - halfPadding;
2934
- rect2.attr("class", "basic label-container").attr("style", node.style).attr("rx", node.rx).attr("ry", node.ry).attr("x", x).attr("y", y).attr("width", totalWidth).attr("height", totalHeight);
2935
- if (node.props) {
2936
- const propKeys = new Set(Object.keys(node.props));
2937
- if (node.props.borders) {
2938
- applyNodePropertyBorders(rect2, node.props.borders, totalWidth, totalHeight);
2939
- propKeys.delete("borders");
2940
- }
2941
- propKeys.forEach((propKey) => {
2942
- log.warn(`Unknown node property ${propKey}`);
2943
- });
2944
- }
2945
- updateNodeBounds(node, rect2);
2946
- node.intersect = function(point2) {
2947
- return intersect_default.rect(node, point2);
2948
- };
2949
- return shapeSvg;
2950
- }, "rect");
2951
- var composite = /* @__PURE__ */ __name(async (parent, node) => {
2952
- const { shapeSvg, bbox, halfPadding } = await labelHelper(
2953
- parent,
2954
- node,
2955
- "node " + node.classes,
2956
- true
2957
- );
2958
- const rect2 = shapeSvg.insert("rect", ":first-child");
2959
- const totalWidth = node.positioned ? node.width : bbox.width + node.padding;
2960
- const totalHeight = node.positioned ? node.height : bbox.height + node.padding;
2961
- const x = node.positioned ? -totalWidth / 2 : -bbox.width / 2 - halfPadding;
2962
- const y = node.positioned ? -totalHeight / 2 : -bbox.height / 2 - halfPadding;
2963
- rect2.attr("class", "basic cluster composite label-container").attr("style", node.style).attr("rx", node.rx).attr("ry", node.ry).attr("x", x).attr("y", y).attr("width", totalWidth).attr("height", totalHeight);
2964
- if (node.props) {
2965
- const propKeys = new Set(Object.keys(node.props));
2966
- if (node.props.borders) {
2967
- applyNodePropertyBorders(rect2, node.props.borders, totalWidth, totalHeight);
2968
- propKeys.delete("borders");
2969
- }
2970
- propKeys.forEach((propKey) => {
2971
- log.warn(`Unknown node property ${propKey}`);
2972
- });
2973
- }
2974
- updateNodeBounds(node, rect2);
2975
- node.intersect = function(point2) {
2976
- return intersect_default.rect(node, point2);
2977
- };
2978
- return shapeSvg;
2979
- }, "composite");
2980
- var labelRect = /* @__PURE__ */ __name(async (parent, node) => {
2981
- const { shapeSvg } = await labelHelper(parent, node, "label", true);
2982
- log.trace("Classes = ", node.class);
2983
- const rect2 = shapeSvg.insert("rect", ":first-child");
2984
- const totalWidth = 0;
2985
- const totalHeight = 0;
2986
- rect2.attr("width", totalWidth).attr("height", totalHeight);
2987
- shapeSvg.attr("class", "label edgeLabel");
2988
- if (node.props) {
2989
- const propKeys = new Set(Object.keys(node.props));
2990
- if (node.props.borders) {
2991
- applyNodePropertyBorders(rect2, node.props.borders, totalWidth, totalHeight);
2992
- propKeys.delete("borders");
2993
- }
2994
- propKeys.forEach((propKey) => {
2995
- log.warn(`Unknown node property ${propKey}`);
2996
- });
2997
- }
2998
- updateNodeBounds(node, rect2);
2999
- node.intersect = function(point2) {
3000
- return intersect_default.rect(node, point2);
3001
- };
3002
- return shapeSvg;
3003
- }, "labelRect");
3004
- function applyNodePropertyBorders(rect2, borders, totalWidth, totalHeight) {
3005
- const strokeDashArray = [];
3006
- const addBorder = /* @__PURE__ */ __name((length) => {
3007
- strokeDashArray.push(length, 0);
3008
- }, "addBorder");
3009
- const skipBorder = /* @__PURE__ */ __name((length) => {
3010
- strokeDashArray.push(0, length);
3011
- }, "skipBorder");
3012
- if (borders.includes("t")) {
3013
- log.debug("add top border");
3014
- addBorder(totalWidth);
3015
- } else {
3016
- skipBorder(totalWidth);
3017
- }
3018
- if (borders.includes("r")) {
3019
- log.debug("add right border");
3020
- addBorder(totalHeight);
3021
- } else {
3022
- skipBorder(totalHeight);
3023
- }
3024
- if (borders.includes("b")) {
3025
- log.debug("add bottom border");
3026
- addBorder(totalWidth);
3027
- } else {
3028
- skipBorder(totalWidth);
3029
- }
3030
- if (borders.includes("l")) {
3031
- log.debug("add left border");
3032
- addBorder(totalHeight);
3033
- } else {
3034
- skipBorder(totalHeight);
3035
- }
3036
- rect2.attr("stroke-dasharray", strokeDashArray.join(" "));
3037
- }
3038
- __name(applyNodePropertyBorders, "applyNodePropertyBorders");
3039
- var rectWithTitle = /* @__PURE__ */ __name((parent, node) => {
3040
- let classes2;
3041
- if (!node.classes) {
3042
- classes2 = "node default";
3043
- } else {
3044
- classes2 = "node " + node.classes;
3045
- }
3046
- const shapeSvg = parent.insert("g").attr("class", classes2).attr("id", node.domId || node.id);
3047
- const rect2 = shapeSvg.insert("rect", ":first-child");
3048
- const innerLine = shapeSvg.insert("line");
3049
- const label = shapeSvg.insert("g").attr("class", "label");
3050
- const text2 = node.labelText.flat ? node.labelText.flat() : node.labelText;
3051
- let title = "";
3052
- if (typeof text2 === "object") {
3053
- title = text2[0];
3054
- } else {
3055
- title = text2;
3056
- }
3057
- log.info("Label text abc79", title, text2, typeof text2 === "object");
3058
- const text = label.node().appendChild(createLabel_default(title, node.labelStyle, true, true));
3059
- let bbox = { width: 0, height: 0 };
3060
- if (evaluate(getConfig2().flowchart.htmlLabels)) {
3061
- const div = text.children[0];
3062
- const dv = select_default(text);
3063
- bbox = div.getBoundingClientRect();
3064
- dv.attr("width", bbox.width);
3065
- dv.attr("height", bbox.height);
3066
- }
3067
- log.info("Text 2", text2);
3068
- const textRows = text2.slice(1, text2.length);
3069
- let titleBox = text.getBBox();
3070
- const descr = label.node().appendChild(
3071
- createLabel_default(textRows.join ? textRows.join("<br/>") : textRows, node.labelStyle, true, true)
3072
- );
3073
- if (evaluate(getConfig2().flowchart.htmlLabels)) {
3074
- const div = descr.children[0];
3075
- const dv = select_default(descr);
3076
- bbox = div.getBoundingClientRect();
3077
- dv.attr("width", bbox.width);
3078
- dv.attr("height", bbox.height);
3079
- }
3080
- const halfPadding = node.padding / 2;
3081
- select_default(descr).attr(
3082
- "transform",
3083
- "translate( " + // (titleBox.width - bbox.width) / 2 +
3084
- (bbox.width > titleBox.width ? 0 : (titleBox.width - bbox.width) / 2) + ", " + (titleBox.height + halfPadding + 5) + ")"
3085
- );
3086
- select_default(text).attr(
3087
- "transform",
3088
- "translate( " + // (titleBox.width - bbox.width) / 2 +
3089
- (bbox.width < titleBox.width ? 0 : -(titleBox.width - bbox.width) / 2) + ", 0)"
3090
- );
3091
- bbox = label.node().getBBox();
3092
- label.attr(
3093
- "transform",
3094
- "translate(" + -bbox.width / 2 + ", " + (-bbox.height / 2 - halfPadding + 3) + ")"
3095
- );
3096
- rect2.attr("class", "outer title-state").attr("x", -bbox.width / 2 - halfPadding).attr("y", -bbox.height / 2 - halfPadding).attr("width", bbox.width + node.padding).attr("height", bbox.height + node.padding);
3097
- innerLine.attr("class", "divider").attr("x1", -bbox.width / 2 - halfPadding).attr("x2", bbox.width / 2 + halfPadding).attr("y1", -bbox.height / 2 - halfPadding + titleBox.height + halfPadding).attr("y2", -bbox.height / 2 - halfPadding + titleBox.height + halfPadding);
3098
- updateNodeBounds(node, rect2);
3099
- node.intersect = function(point2) {
3100
- return intersect_default.rect(node, point2);
3101
- };
3102
- return shapeSvg;
3103
- }, "rectWithTitle");
3104
- var stadium = /* @__PURE__ */ __name(async (parent, node) => {
3105
- const { shapeSvg, bbox } = await labelHelper(
3106
- parent,
3107
- node,
3108
- getClassesFromNode(node, void 0),
3109
- true
3110
- );
3111
- const h = bbox.height + node.padding;
3112
- const w = bbox.width + h / 4 + node.padding;
3113
- const rect2 = shapeSvg.insert("rect", ":first-child").attr("style", node.style).attr("rx", h / 2).attr("ry", h / 2).attr("x", -w / 2).attr("y", -h / 2).attr("width", w).attr("height", h);
3114
- updateNodeBounds(node, rect2);
3115
- node.intersect = function(point2) {
3116
- return intersect_default.rect(node, point2);
3117
- };
3118
- return shapeSvg;
3119
- }, "stadium");
3120
- var circle2 = /* @__PURE__ */ __name(async (parent, node) => {
3121
- const { shapeSvg, bbox, halfPadding } = await labelHelper(
3122
- parent,
3123
- node,
3124
- getClassesFromNode(node, void 0),
3125
- true
3126
- );
3127
- const circle3 = shapeSvg.insert("circle", ":first-child");
3128
- circle3.attr("style", node.style).attr("rx", node.rx).attr("ry", node.ry).attr("r", bbox.width / 2 + halfPadding).attr("width", bbox.width + node.padding).attr("height", bbox.height + node.padding);
3129
- log.info("Circle main");
3130
- updateNodeBounds(node, circle3);
3131
- node.intersect = function(point2) {
3132
- log.info("Circle intersect", node, bbox.width / 2 + halfPadding, point2);
3133
- return intersect_default.circle(node, bbox.width / 2 + halfPadding, point2);
3134
- };
3135
- return shapeSvg;
3136
- }, "circle");
3137
- var doublecircle = /* @__PURE__ */ __name(async (parent, node) => {
3138
- const { shapeSvg, bbox, halfPadding } = await labelHelper(
3139
- parent,
3140
- node,
3141
- getClassesFromNode(node, void 0),
3142
- true
3143
- );
3144
- const gap = 5;
3145
- const circleGroup = shapeSvg.insert("g", ":first-child");
3146
- const outerCircle = circleGroup.insert("circle");
3147
- const innerCircle = circleGroup.insert("circle");
3148
- circleGroup.attr("class", node.class);
3149
- outerCircle.attr("style", node.style).attr("rx", node.rx).attr("ry", node.ry).attr("r", bbox.width / 2 + halfPadding + gap).attr("width", bbox.width + node.padding + gap * 2).attr("height", bbox.height + node.padding + gap * 2);
3150
- innerCircle.attr("style", node.style).attr("rx", node.rx).attr("ry", node.ry).attr("r", bbox.width / 2 + halfPadding).attr("width", bbox.width + node.padding).attr("height", bbox.height + node.padding);
3151
- log.info("DoubleCircle main");
3152
- updateNodeBounds(node, outerCircle);
3153
- node.intersect = function(point2) {
3154
- log.info("DoubleCircle intersect", node, bbox.width / 2 + halfPadding + gap, point2);
3155
- return intersect_default.circle(node, bbox.width / 2 + halfPadding + gap, point2);
3156
- };
3157
- return shapeSvg;
3158
- }, "doublecircle");
3159
- var subroutine = /* @__PURE__ */ __name(async (parent, node) => {
3160
- const { shapeSvg, bbox } = await labelHelper(
3161
- parent,
3162
- node,
3163
- getClassesFromNode(node, void 0),
3164
- true
3165
- );
3166
- const w = bbox.width + node.padding;
3167
- const h = bbox.height + node.padding;
3168
- const points = [
3169
- { x: 0, y: 0 },
3170
- { x: w, y: 0 },
3171
- { x: w, y: -h },
3172
- { x: 0, y: -h },
3173
- { x: 0, y: 0 },
3174
- { x: -8, y: 0 },
3175
- { x: w + 8, y: 0 },
3176
- { x: w + 8, y: -h },
3177
- { x: -8, y: -h },
3178
- { x: -8, y: 0 }
3179
- ];
3180
- const el = insertPolygonShape(shapeSvg, w, h, points);
3181
- el.attr("style", node.style);
3182
- updateNodeBounds(node, el);
3183
- node.intersect = function(point2) {
3184
- return intersect_default.polygon(node, points, point2);
3185
- };
3186
- return shapeSvg;
3187
- }, "subroutine");
3188
- var start = /* @__PURE__ */ __name((parent, node) => {
3189
- const shapeSvg = parent.insert("g").attr("class", "node default").attr("id", node.domId || node.id);
3190
- const circle3 = shapeSvg.insert("circle", ":first-child");
3191
- circle3.attr("class", "state-start").attr("r", 7).attr("width", 14).attr("height", 14);
3192
- updateNodeBounds(node, circle3);
3193
- node.intersect = function(point2) {
3194
- return intersect_default.circle(node, 7, point2);
3195
- };
3196
- return shapeSvg;
3197
- }, "start");
3198
- var forkJoin = /* @__PURE__ */ __name((parent, node, dir) => {
3199
- const shapeSvg = parent.insert("g").attr("class", "node default").attr("id", node.domId || node.id);
3200
- let width = 70;
3201
- let height = 10;
3202
- if (dir === "LR") {
3203
- width = 10;
3204
- height = 70;
3205
- }
3206
- const shape = shapeSvg.append("rect").attr("x", -1 * width / 2).attr("y", -1 * height / 2).attr("width", width).attr("height", height).attr("class", "fork-join");
3207
- updateNodeBounds(node, shape);
3208
- node.height = node.height + node.padding / 2;
3209
- node.width = node.width + node.padding / 2;
3210
- node.intersect = function(point2) {
3211
- return intersect_default.rect(node, point2);
3212
- };
3213
- return shapeSvg;
3214
- }, "forkJoin");
3215
- var end = /* @__PURE__ */ __name((parent, node) => {
3216
- const shapeSvg = parent.insert("g").attr("class", "node default").attr("id", node.domId || node.id);
3217
- const innerCircle = shapeSvg.insert("circle", ":first-child");
3218
- const circle3 = shapeSvg.insert("circle", ":first-child");
3219
- circle3.attr("class", "state-start").attr("r", 7).attr("width", 14).attr("height", 14);
3220
- innerCircle.attr("class", "state-end").attr("r", 5).attr("width", 10).attr("height", 10);
3221
- updateNodeBounds(node, circle3);
3222
- node.intersect = function(point2) {
3223
- return intersect_default.circle(node, 7, point2);
3224
- };
3225
- return shapeSvg;
3226
- }, "end");
3227
- var class_box = /* @__PURE__ */ __name((parent, node) => {
3228
- const halfPadding = node.padding / 2;
3229
- const rowPadding = 4;
3230
- const lineHeight = 8;
3231
- let classes2;
3232
- if (!node.classes) {
3233
- classes2 = "node default";
3234
- } else {
3235
- classes2 = "node " + node.classes;
3236
- }
3237
- const shapeSvg = parent.insert("g").attr("class", classes2).attr("id", node.domId || node.id);
3238
- const rect2 = shapeSvg.insert("rect", ":first-child");
3239
- const topLine = shapeSvg.insert("line");
3240
- const bottomLine = shapeSvg.insert("line");
3241
- let maxWidth = 0;
3242
- let maxHeight = rowPadding;
3243
- const labelContainer = shapeSvg.insert("g").attr("class", "label");
3244
- let verticalPos = 0;
3245
- const hasInterface = node.classData.annotations?.[0];
3246
- const interfaceLabelText = node.classData.annotations[0] ? "\xAB" + node.classData.annotations[0] + "\xBB" : "";
3247
- const interfaceLabel = labelContainer.node().appendChild(createLabel_default(interfaceLabelText, node.labelStyle, true, true));
3248
- let interfaceBBox = interfaceLabel.getBBox();
3249
- if (evaluate(getConfig2().flowchart.htmlLabels)) {
3250
- const div = interfaceLabel.children[0];
3251
- const dv = select_default(interfaceLabel);
3252
- interfaceBBox = div.getBoundingClientRect();
3253
- dv.attr("width", interfaceBBox.width);
3254
- dv.attr("height", interfaceBBox.height);
3255
- }
3256
- if (node.classData.annotations[0]) {
3257
- maxHeight += interfaceBBox.height + rowPadding;
3258
- maxWidth += interfaceBBox.width;
3259
- }
3260
- let classTitleString = node.classData.label;
3261
- if (node.classData.type !== void 0 && node.classData.type !== "") {
3262
- if (getConfig2().flowchart.htmlLabels) {
3263
- classTitleString += "&lt;" + node.classData.type + "&gt;";
3264
- } else {
3265
- classTitleString += "<" + node.classData.type + ">";
3266
- }
3267
- }
3268
- const classTitleLabel = labelContainer.node().appendChild(createLabel_default(classTitleString, node.labelStyle, true, true));
3269
- select_default(classTitleLabel).attr("class", "classTitle");
3270
- let classTitleBBox = classTitleLabel.getBBox();
3271
- if (evaluate(getConfig2().flowchart.htmlLabels)) {
3272
- const div = classTitleLabel.children[0];
3273
- const dv = select_default(classTitleLabel);
3274
- classTitleBBox = div.getBoundingClientRect();
3275
- dv.attr("width", classTitleBBox.width);
3276
- dv.attr("height", classTitleBBox.height);
3277
- }
3278
- maxHeight += classTitleBBox.height + rowPadding;
3279
- if (classTitleBBox.width > maxWidth) {
3280
- maxWidth = classTitleBBox.width;
3281
- }
3282
- const classAttributes = [];
3283
- node.classData.members.forEach((member) => {
3284
- const parsedInfo = member.getDisplayDetails();
3285
- let parsedText = parsedInfo.displayText;
3286
- if (getConfig2().flowchart.htmlLabels) {
3287
- parsedText = parsedText.replace(/</g, "&lt;").replace(/>/g, "&gt;");
3288
- }
3289
- const lbl = labelContainer.node().appendChild(
3290
- createLabel_default(
3291
- parsedText,
3292
- parsedInfo.cssStyle ? parsedInfo.cssStyle : node.labelStyle,
3293
- true,
3294
- true
3295
- )
3296
- );
3297
- let bbox = lbl.getBBox();
3298
- if (evaluate(getConfig2().flowchart.htmlLabels)) {
3299
- const div = lbl.children[0];
3300
- const dv = select_default(lbl);
3301
- bbox = div.getBoundingClientRect();
3302
- dv.attr("width", bbox.width);
3303
- dv.attr("height", bbox.height);
3304
- }
3305
- if (bbox.width > maxWidth) {
3306
- maxWidth = bbox.width;
3307
- }
3308
- maxHeight += bbox.height + rowPadding;
3309
- classAttributes.push(lbl);
3310
- });
3311
- maxHeight += lineHeight;
3312
- const classMethods = [];
3313
- node.classData.methods.forEach((member) => {
3314
- const parsedInfo = member.getDisplayDetails();
3315
- let displayText = parsedInfo.displayText;
3316
- if (getConfig2().flowchart.htmlLabels) {
3317
- displayText = displayText.replace(/</g, "&lt;").replace(/>/g, "&gt;");
3318
- }
3319
- const lbl = labelContainer.node().appendChild(
3320
- createLabel_default(
3321
- displayText,
3322
- parsedInfo.cssStyle ? parsedInfo.cssStyle : node.labelStyle,
3323
- true,
3324
- true
3325
- )
3326
- );
3327
- let bbox = lbl.getBBox();
3328
- if (evaluate(getConfig2().flowchart.htmlLabels)) {
3329
- const div = lbl.children[0];
3330
- const dv = select_default(lbl);
3331
- bbox = div.getBoundingClientRect();
3332
- dv.attr("width", bbox.width);
3333
- dv.attr("height", bbox.height);
3334
- }
3335
- if (bbox.width > maxWidth) {
3336
- maxWidth = bbox.width;
3337
- }
3338
- maxHeight += bbox.height + rowPadding;
3339
- classMethods.push(lbl);
3340
- });
3341
- maxHeight += lineHeight;
3342
- if (hasInterface) {
3343
- let diffX2 = (maxWidth - interfaceBBox.width) / 2;
3344
- select_default(interfaceLabel).attr(
3345
- "transform",
3346
- "translate( " + (-1 * maxWidth / 2 + diffX2) + ", " + -1 * maxHeight / 2 + ")"
3347
- );
3348
- verticalPos = interfaceBBox.height + rowPadding;
3349
- }
3350
- let diffX = (maxWidth - classTitleBBox.width) / 2;
3351
- select_default(classTitleLabel).attr(
3352
- "transform",
3353
- "translate( " + (-1 * maxWidth / 2 + diffX) + ", " + (-1 * maxHeight / 2 + verticalPos) + ")"
3354
- );
3355
- verticalPos += classTitleBBox.height + rowPadding;
3356
- topLine.attr("class", "divider").attr("x1", -maxWidth / 2 - halfPadding).attr("x2", maxWidth / 2 + halfPadding).attr("y1", -maxHeight / 2 - halfPadding + lineHeight + verticalPos).attr("y2", -maxHeight / 2 - halfPadding + lineHeight + verticalPos);
3357
- verticalPos += lineHeight;
3358
- classAttributes.forEach((lbl) => {
3359
- select_default(lbl).attr(
3360
- "transform",
3361
- "translate( " + -maxWidth / 2 + ", " + (-1 * maxHeight / 2 + verticalPos + lineHeight / 2) + ")"
3362
- );
3363
- const memberBBox = lbl?.getBBox();
3364
- verticalPos += (memberBBox?.height ?? 0) + rowPadding;
3365
- });
3366
- verticalPos += lineHeight;
3367
- bottomLine.attr("class", "divider").attr("x1", -maxWidth / 2 - halfPadding).attr("x2", maxWidth / 2 + halfPadding).attr("y1", -maxHeight / 2 - halfPadding + lineHeight + verticalPos).attr("y2", -maxHeight / 2 - halfPadding + lineHeight + verticalPos);
3368
- verticalPos += lineHeight;
3369
- classMethods.forEach((lbl) => {
3370
- select_default(lbl).attr(
3371
- "transform",
3372
- "translate( " + -maxWidth / 2 + ", " + (-1 * maxHeight / 2 + verticalPos) + ")"
3373
- );
3374
- const memberBBox = lbl?.getBBox();
3375
- verticalPos += (memberBBox?.height ?? 0) + rowPadding;
3376
- });
3377
- rect2.attr("style", node.style).attr("class", "outer title-state").attr("x", -maxWidth / 2 - halfPadding).attr("y", -(maxHeight / 2) - halfPadding).attr("width", maxWidth + node.padding).attr("height", maxHeight + node.padding);
3378
- updateNodeBounds(node, rect2);
3379
- node.intersect = function(point2) {
3380
- return intersect_default.rect(node, point2);
3381
- };
3382
- return shapeSvg;
3383
- }, "class_box");
3384
- var shapes = {
3385
- rhombus: question,
3386
- composite,
3387
- question,
3388
- rect,
3389
- labelRect,
3390
- rectWithTitle,
3391
- choice,
3392
- circle: circle2,
3393
- doublecircle,
3394
- stadium,
3395
- hexagon,
3396
- block_arrow,
3397
- rect_left_inv_arrow,
3398
- lean_right,
3399
- lean_left,
3400
- trapezoid,
3401
- inv_trapezoid,
3402
- rect_right_inv_arrow,
3403
- cylinder,
3404
- start,
3405
- end,
3406
- note: note_default,
3407
- subroutine,
3408
- fork: forkJoin,
3409
- join: forkJoin,
3410
- class_box
3411
- };
3412
- var nodeElems = {};
3413
- var insertNode = /* @__PURE__ */ __name(async (elem, node, renderOptions) => {
3414
- let newEl;
3415
- let el;
3416
- if (node.link) {
3417
- let target;
3418
- if (getConfig2().securityLevel === "sandbox") {
3419
- target = "_top";
3420
- } else if (node.linkTarget) {
3421
- target = node.linkTarget || "_blank";
3422
- }
3423
- newEl = elem.insert("svg:a").attr("xlink:href", node.link).attr("target", target);
3424
- el = await shapes[node.shape](newEl, node, renderOptions);
3425
- } else {
3426
- el = await shapes[node.shape](elem, node, renderOptions);
3427
- newEl = el;
3428
- }
3429
- if (node.tooltip) {
3430
- el.attr("title", node.tooltip);
3431
- }
3432
- if (node.class) {
3433
- el.attr("class", "node default " + node.class);
3434
- }
3435
- nodeElems[node.id] = newEl;
3436
- if (node.haveCallback) {
3437
- nodeElems[node.id].attr("class", nodeElems[node.id].attr("class") + " clickable");
3438
- }
3439
- return newEl;
3440
- }, "insertNode");
3441
- var positionNode = /* @__PURE__ */ __name((node) => {
3442
- const el = nodeElems[node.id];
3443
- log.trace(
3444
- "Transforming node",
3445
- node.diff,
3446
- node,
3447
- "translate(" + (node.x - node.width / 2 - 5) + ", " + node.width / 2 + ")"
3448
- );
3449
- const padding2 = 8;
3450
- const diff = node.diff || 0;
3451
- if (node.clusterNode) {
3452
- el.attr(
3453
- "transform",
3454
- "translate(" + (node.x + diff - node.width / 2) + ", " + (node.y - node.height / 2 - padding2) + ")"
3455
- );
3456
- } else {
3457
- el.attr("transform", "translate(" + node.x + ", " + node.y + ")");
3458
- }
3459
- return diff;
3460
- }, "positionNode");
3461
- function getNodeFromBlock(block, db2, positioned = false) {
3462
- const vertex = block;
3463
- let classStr = "default";
3464
- if ((vertex?.classes?.length || 0) > 0) {
3465
- classStr = (vertex?.classes ?? []).join(" ");
3466
- }
3467
- classStr = classStr + " flowchart-label";
3468
- let radius = 0;
3469
- let shape = "";
3470
- let padding2;
3471
- switch (vertex.type) {
3472
- case "round":
3473
- radius = 5;
3474
- shape = "rect";
3475
- break;
3476
- case "composite":
3477
- radius = 0;
3478
- shape = "composite";
3479
- padding2 = 0;
3480
- break;
3481
- case "square":
3482
- shape = "rect";
3483
- break;
3484
- case "diamond":
3485
- shape = "question";
3486
- break;
3487
- case "hexagon":
3488
- shape = "hexagon";
3489
- break;
3490
- case "block_arrow":
3491
- shape = "block_arrow";
3492
- break;
3493
- case "odd":
3494
- shape = "rect_left_inv_arrow";
3495
- break;
3496
- case "lean_right":
3497
- shape = "lean_right";
3498
- break;
3499
- case "lean_left":
3500
- shape = "lean_left";
3501
- break;
3502
- case "trapezoid":
3503
- shape = "trapezoid";
3504
- break;
3505
- case "inv_trapezoid":
3506
- shape = "inv_trapezoid";
3507
- break;
3508
- case "rect_left_inv_arrow":
3509
- shape = "rect_left_inv_arrow";
3510
- break;
3511
- case "circle":
3512
- shape = "circle";
3513
- break;
3514
- case "ellipse":
3515
- shape = "ellipse";
3516
- break;
3517
- case "stadium":
3518
- shape = "stadium";
3519
- break;
3520
- case "subroutine":
3521
- shape = "subroutine";
3522
- break;
3523
- case "cylinder":
3524
- shape = "cylinder";
3525
- break;
3526
- case "group":
3527
- shape = "rect";
3528
- break;
3529
- case "doublecircle":
3530
- shape = "doublecircle";
3531
- break;
3532
- default:
3533
- shape = "rect";
3534
- }
3535
- const styles = getStylesFromArray(vertex?.styles ?? []);
3536
- const vertexText = vertex.label;
3537
- const bounds = vertex.size ?? { width: 0, height: 0, x: 0, y: 0 };
3538
- const node = {
3539
- labelStyle: styles.labelStyle,
3540
- shape,
3541
- labelText: vertexText,
3542
- rx: radius,
3543
- ry: radius,
3544
- class: classStr,
3545
- style: styles.style,
3546
- id: vertex.id,
3547
- directions: vertex.directions,
3548
- width: bounds.width,
3549
- height: bounds.height,
3550
- x: bounds.x,
3551
- y: bounds.y,
3552
- positioned,
3553
- intersect: void 0,
3554
- type: vertex.type,
3555
- padding: padding2 ?? getConfig()?.block?.padding ?? 0
3556
- };
3557
- return node;
3558
- }
3559
- __name(getNodeFromBlock, "getNodeFromBlock");
3560
- async function calculateBlockSize(elem, block, db2) {
3561
- const node = getNodeFromBlock(block, db2, false);
3562
- if (node.type === "group") {
3563
- return;
3564
- }
3565
- const config2 = getConfig();
3566
- const nodeEl = await insertNode(elem, node, { config: config2 });
3567
- const boundingBox = nodeEl.node().getBBox();
3568
- const obj = db2.getBlock(node.id);
3569
- obj.size = { width: boundingBox.width, height: boundingBox.height, x: 0, y: 0, node: nodeEl };
3570
- db2.setBlock(obj);
3571
- nodeEl.remove();
3572
- }
3573
- __name(calculateBlockSize, "calculateBlockSize");
3574
- async function insertBlockPositioned(elem, block, db2) {
3575
- const node = getNodeFromBlock(block, db2, true);
3576
- const obj = db2.getBlock(node.id);
3577
- if (obj.type !== "space") {
3578
- const config2 = getConfig();
3579
- await insertNode(elem, node, { config: config2 });
3580
- block.intersect = node?.intersect;
3581
- positionNode(node);
3582
- }
3583
- }
3584
- __name(insertBlockPositioned, "insertBlockPositioned");
3585
- async function performOperations(elem, blocks2, db2, operation) {
3586
- for (const block of blocks2) {
3587
- await operation(elem, block, db2);
3588
- if (block.children) {
3589
- await performOperations(elem, block.children, db2, operation);
3590
- }
3591
- }
3592
- }
3593
- __name(performOperations, "performOperations");
3594
- async function calculateBlockSizes(elem, blocks2, db2) {
3595
- await performOperations(elem, blocks2, db2, calculateBlockSize);
3596
- }
3597
- __name(calculateBlockSizes, "calculateBlockSizes");
3598
- async function insertBlocks(elem, blocks2, db2) {
3599
- await performOperations(elem, blocks2, db2, insertBlockPositioned);
3600
- }
3601
- __name(insertBlocks, "insertBlocks");
3602
- async function insertEdges(elem, edges, blocks2, db2, id) {
3603
- const g = new Graph({
3604
- multigraph: true,
3605
- compound: true
3606
- });
3607
- g.setGraph({
3608
- rankdir: "TB",
3609
- nodesep: 10,
3610
- ranksep: 10,
3611
- marginx: 8,
3612
- marginy: 8
3613
- });
3614
- for (const block of blocks2) {
3615
- if (block.size) {
3616
- g.setNode(block.id, {
3617
- width: block.size.width,
3618
- height: block.size.height,
3619
- intersect: block.intersect
3620
- });
3621
- }
3622
- }
3623
- for (const edge of edges) {
3624
- if (edge.start && edge.end) {
3625
- const startBlock = db2.getBlock(edge.start);
3626
- const endBlock = db2.getBlock(edge.end);
3627
- if (startBlock?.size && endBlock?.size) {
3628
- const start2 = startBlock.size;
3629
- const end2 = endBlock.size;
3630
- const points = [
3631
- { x: start2.x, y: start2.y },
3632
- { x: start2.x + (end2.x - start2.x) / 2, y: start2.y + (end2.y - start2.y) / 2 },
3633
- { x: end2.x, y: end2.y }
3634
- ];
3635
- insertEdge(
3636
- elem,
3637
- { v: edge.start, w: edge.end, name: edge.id },
3638
- {
3639
- ...edge,
3640
- arrowTypeEnd: edge.arrowTypeEnd,
3641
- arrowTypeStart: edge.arrowTypeStart,
3642
- points,
3643
- classes: "edge-thickness-normal edge-pattern-solid flowchart-link LS-a1 LE-b1"
3644
- },
3645
- void 0,
3646
- "block",
3647
- g,
3648
- id
3649
- );
3650
- if (edge.label) {
3651
- await insertEdgeLabel(elem, {
3652
- ...edge,
3653
- label: edge.label,
3654
- labelStyle: "stroke: #333; stroke-width: 1.5px;fill:none;",
3655
- arrowTypeEnd: edge.arrowTypeEnd,
3656
- arrowTypeStart: edge.arrowTypeStart,
3657
- points,
3658
- classes: "edge-thickness-normal edge-pattern-solid flowchart-link LS-a1 LE-b1"
3659
- });
3660
- positionEdgeLabel(
3661
- { ...edge, x: points[1].x, y: points[1].y },
3662
- {
3663
- originalPath: points
3664
- }
3665
- );
3666
- }
3667
- }
3668
- }
3669
- }
3670
- }
3671
- __name(insertEdges, "insertEdges");
3672
- var getClasses2 = /* @__PURE__ */ __name(function(text, diagObj) {
3673
- return diagObj.db.getClasses();
3674
- }, "getClasses");
3675
- var draw = /* @__PURE__ */ __name(async function(text, id, _version, diagObj) {
3676
- const { securityLevel, block: conf } = getConfig();
3677
- const db2 = diagObj.db;
3678
- let sandboxElement;
3679
- if (securityLevel === "sandbox") {
3680
- sandboxElement = select_default("#i" + id);
3681
- }
3682
- const root = securityLevel === "sandbox" ? select_default(sandboxElement.nodes()[0].contentDocument.body) : select_default("body");
3683
- const svg = securityLevel === "sandbox" ? root.select(`[id="${id}"]`) : select_default(`[id="${id}"]`);
3684
- const markers2 = ["point", "circle", "cross"];
3685
- markers_default(svg, markers2, diagObj.type, id);
3686
- const bl = db2.getBlocks();
3687
- const blArr = db2.getBlocksFlat();
3688
- const edges = db2.getEdges();
3689
- const nodes = svg.insert("g").attr("class", "block");
3690
- await calculateBlockSizes(nodes, bl, db2);
3691
- const bounds = layout(db2);
3692
- await insertBlocks(nodes, bl, db2);
3693
- await insertEdges(nodes, edges, blArr, db2, id);
3694
- if (bounds) {
3695
- const bounds2 = bounds;
3696
- const magicFactor = Math.max(1, Math.round(0.125 * (bounds2.width / bounds2.height)));
3697
- const height = bounds2.height + magicFactor + 10;
3698
- const width = bounds2.width + 10;
3699
- const { useMaxWidth } = conf;
3700
- configureSvgSize(svg, height, width, !!useMaxWidth);
3701
- log.debug("Here Bounds", bounds, bounds2);
3702
- svg.attr(
3703
- "viewBox",
3704
- `${bounds2.x - 5} ${bounds2.y - 5} ${bounds2.width + 10} ${bounds2.height + 10}`
3705
- );
3706
- }
3707
- }, "draw");
3708
- var blockRenderer_default = {
3709
- draw,
3710
- getClasses: getClasses2
3711
- };
3712
- var diagram = {
3713
- parser: block_default,
3714
- db: blockDB_default,
3715
- renderer: blockRenderer_default,
3716
- styles: styles_default
3717
- };
3718
- export {
3719
- diagram
3720
- };
3721
- //# sourceMappingURL=blockDiagram-ZHA2E4KO-OAYYKCLF.js.map