@copilotkitnext/react 0.0.22-alpha.7 → 0.0.22-alpha.8

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