@zettelgeist/cli 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (189) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +64 -0
  3. package/dist/bin.js +2211 -0
  4. package/dist/bin.js.map +7 -0
  5. package/dist/templates/export.html +27 -0
  6. package/dist/templates/skill/SKILL.md +220 -0
  7. package/dist/viewer-bundle/architecture-YZFGNWBL-W2K3EQOM.js +14 -0
  8. package/dist/viewer-bundle/architecture-YZFGNWBL-W2K3EQOM.js.map +7 -0
  9. package/dist/viewer-bundle/architectureDiagram-Q4EWVU46-LCGRUEWT.js +8884 -0
  10. package/dist/viewer-bundle/architectureDiagram-Q4EWVU46-LCGRUEWT.js.map +7 -0
  11. package/dist/viewer-bundle/base.css +248 -0
  12. package/dist/viewer-bundle/blockDiagram-DXYQGD6D-KAM7BOAP.js +3777 -0
  13. package/dist/viewer-bundle/blockDiagram-DXYQGD6D-KAM7BOAP.js.map +7 -0
  14. package/dist/viewer-bundle/board.css +370 -0
  15. package/dist/viewer-bundle/c4Diagram-AHTNJAMY-C3FIQYXA.js +2596 -0
  16. package/dist/viewer-bundle/c4Diagram-AHTNJAMY-C3FIQYXA.js.map +7 -0
  17. package/dist/viewer-bundle/chunk-2QXGXAO5.js +68 -0
  18. package/dist/viewer-bundle/chunk-2QXGXAO5.js.map +7 -0
  19. package/dist/viewer-bundle/chunk-5PZT7VUU.js +67 -0
  20. package/dist/viewer-bundle/chunk-5PZT7VUU.js.map +7 -0
  21. package/dist/viewer-bundle/chunk-5YJCJF2C.js +112 -0
  22. package/dist/viewer-bundle/chunk-5YJCJF2C.js.map +7 -0
  23. package/dist/viewer-bundle/chunk-6LYV7PBV.js +1011 -0
  24. package/dist/viewer-bundle/chunk-6LYV7PBV.js.map +7 -0
  25. package/dist/viewer-bundle/chunk-6VW7D5WX.js +48 -0
  26. package/dist/viewer-bundle/chunk-6VW7D5WX.js.map +7 -0
  27. package/dist/viewer-bundle/chunk-76C5OSD4.js +2048 -0
  28. package/dist/viewer-bundle/chunk-76C5OSD4.js.map +7 -0
  29. package/dist/viewer-bundle/chunk-7NZMPQDX.js +6957 -0
  30. package/dist/viewer-bundle/chunk-7NZMPQDX.js.map +7 -0
  31. package/dist/viewer-bundle/chunk-A634GTZN.js +122 -0
  32. package/dist/viewer-bundle/chunk-A634GTZN.js.map +7 -0
  33. package/dist/viewer-bundle/chunk-AJQJUKMU.js +133 -0
  34. package/dist/viewer-bundle/chunk-AJQJUKMU.js.map +7 -0
  35. package/dist/viewer-bundle/chunk-BM2KPNFW.js +5556 -0
  36. package/dist/viewer-bundle/chunk-BM2KPNFW.js.map +7 -0
  37. package/dist/viewer-bundle/chunk-CIDUOCCG.js +25 -0
  38. package/dist/viewer-bundle/chunk-CIDUOCCG.js.map +7 -0
  39. package/dist/viewer-bundle/chunk-CZHJHAOR.js +6397 -0
  40. package/dist/viewer-bundle/chunk-CZHJHAOR.js.map +7 -0
  41. package/dist/viewer-bundle/chunk-D5RLIWY4.js +125 -0
  42. package/dist/viewer-bundle/chunk-D5RLIWY4.js.map +7 -0
  43. package/dist/viewer-bundle/chunk-DI52DQAC.js +44 -0
  44. package/dist/viewer-bundle/chunk-DI52DQAC.js.map +7 -0
  45. package/dist/viewer-bundle/chunk-EXJQLTIV.js +51 -0
  46. package/dist/viewer-bundle/chunk-EXJQLTIV.js.map +7 -0
  47. package/dist/viewer-bundle/chunk-G3PPZWPW.js +96 -0
  48. package/dist/viewer-bundle/chunk-G3PPZWPW.js.map +7 -0
  49. package/dist/viewer-bundle/chunk-GTW4IDD4.js +30297 -0
  50. package/dist/viewer-bundle/chunk-GTW4IDD4.js.map +7 -0
  51. package/dist/viewer-bundle/chunk-GVE7OA3Z.js +59 -0
  52. package/dist/viewer-bundle/chunk-GVE7OA3Z.js.map +7 -0
  53. package/dist/viewer-bundle/chunk-JBUVKVPY.js +2042 -0
  54. package/dist/viewer-bundle/chunk-JBUVKVPY.js.map +7 -0
  55. package/dist/viewer-bundle/chunk-JQLVOAQB.js +20 -0
  56. package/dist/viewer-bundle/chunk-JQLVOAQB.js.map +7 -0
  57. package/dist/viewer-bundle/chunk-LQMQSYLO.js +101 -0
  58. package/dist/viewer-bundle/chunk-LQMQSYLO.js.map +7 -0
  59. package/dist/viewer-bundle/chunk-MBFAQ3IK.js +34 -0
  60. package/dist/viewer-bundle/chunk-MBFAQ3IK.js.map +7 -0
  61. package/dist/viewer-bundle/chunk-N7G7IIKG.js +25 -0
  62. package/dist/viewer-bundle/chunk-N7G7IIKG.js.map +7 -0
  63. package/dist/viewer-bundle/chunk-NW4YG3NS.js +171 -0
  64. package/dist/viewer-bundle/chunk-NW4YG3NS.js.map +7 -0
  65. package/dist/viewer-bundle/chunk-ODEP5TKB.js +61 -0
  66. package/dist/viewer-bundle/chunk-ODEP5TKB.js.map +7 -0
  67. package/dist/viewer-bundle/chunk-OGKINV23.js +1050 -0
  68. package/dist/viewer-bundle/chunk-OGKINV23.js.map +7 -0
  69. package/dist/viewer-bundle/chunk-OGMSNDVH.js +1994 -0
  70. package/dist/viewer-bundle/chunk-OGMSNDVH.js.map +7 -0
  71. package/dist/viewer-bundle/chunk-QJVSDNAW.js +25 -0
  72. package/dist/viewer-bundle/chunk-QJVSDNAW.js.map +7 -0
  73. package/dist/viewer-bundle/chunk-RBTT26R4.js +2721 -0
  74. package/dist/viewer-bundle/chunk-RBTT26R4.js.map +7 -0
  75. package/dist/viewer-bundle/chunk-RQIPIIE2.js +48 -0
  76. package/dist/viewer-bundle/chunk-RQIPIIE2.js.map +7 -0
  77. package/dist/viewer-bundle/chunk-SRTYTXTX.js +22 -0
  78. package/dist/viewer-bundle/chunk-SRTYTXTX.js.map +7 -0
  79. package/dist/viewer-bundle/chunk-TRL7YIZG.js +1663 -0
  80. package/dist/viewer-bundle/chunk-TRL7YIZG.js.map +7 -0
  81. package/dist/viewer-bundle/chunk-U5T7X4BV.js +172 -0
  82. package/dist/viewer-bundle/chunk-U5T7X4BV.js.map +7 -0
  83. package/dist/viewer-bundle/chunk-UCAW6C6C.js +48 -0
  84. package/dist/viewer-bundle/chunk-UCAW6C6C.js.map +7 -0
  85. package/dist/viewer-bundle/chunk-UEAG4BJQ.js +93 -0
  86. package/dist/viewer-bundle/chunk-UEAG4BJQ.js.map +7 -0
  87. package/dist/viewer-bundle/chunk-UVRE3R6A.js +1039 -0
  88. package/dist/viewer-bundle/chunk-UVRE3R6A.js.map +7 -0
  89. package/dist/viewer-bundle/chunk-VODO7SV4.js +25029 -0
  90. package/dist/viewer-bundle/chunk-VODO7SV4.js.map +7 -0
  91. package/dist/viewer-bundle/chunk-YEU62MVS.js +682 -0
  92. package/dist/viewer-bundle/chunk-YEU62MVS.js.map +7 -0
  93. package/dist/viewer-bundle/chunk-YFQT7PPW.js +987 -0
  94. package/dist/viewer-bundle/chunk-YFQT7PPW.js.map +7 -0
  95. package/dist/viewer-bundle/chunk-Z4G7FG27.js +48 -0
  96. package/dist/viewer-bundle/chunk-Z4G7FG27.js.map +7 -0
  97. package/dist/viewer-bundle/chunk-ZW4Y7DIF.js +2044 -0
  98. package/dist/viewer-bundle/chunk-ZW4Y7DIF.js.map +7 -0
  99. package/dist/viewer-bundle/classDiagram-6PBFFD2Q-7VKYXLUX.js +46 -0
  100. package/dist/viewer-bundle/classDiagram-6PBFFD2Q-7VKYXLUX.js.map +7 -0
  101. package/dist/viewer-bundle/classDiagram-v2-HSJHXN6E-ACCNN7EN.js +46 -0
  102. package/dist/viewer-bundle/classDiagram-v2-HSJHXN6E-ACCNN7EN.js.map +7 -0
  103. package/dist/viewer-bundle/cose-bilkent-S5V4N54A-MUJHAA34.js +5009 -0
  104. package/dist/viewer-bundle/cose-bilkent-S5V4N54A-MUJHAA34.js.map +7 -0
  105. package/dist/viewer-bundle/dagre-KV5264BT-YC5VV3WF.js +739 -0
  106. package/dist/viewer-bundle/dagre-KV5264BT-YC5VV3WF.js.map +7 -0
  107. package/dist/viewer-bundle/dark.css +13 -0
  108. package/dist/viewer-bundle/detail.css +539 -0
  109. package/dist/viewer-bundle/diagram-5BDNPKRD-RXFPVFYK.js +214 -0
  110. package/dist/viewer-bundle/diagram-5BDNPKRD-RXFPVFYK.js.map +7 -0
  111. package/dist/viewer-bundle/diagram-G4DWMVQ6-KN7CBNBQ.js +578 -0
  112. package/dist/viewer-bundle/diagram-G4DWMVQ6-KN7CBNBQ.js.map +7 -0
  113. package/dist/viewer-bundle/diagram-MMDJMWI5-ZN6TQ7ZC.js +345 -0
  114. package/dist/viewer-bundle/diagram-MMDJMWI5-ZN6TQ7ZC.js.map +7 -0
  115. package/dist/viewer-bundle/diagram-TYMM5635-MMTUJ4KA.js +255 -0
  116. package/dist/viewer-bundle/diagram-TYMM5635-MMTUJ4KA.js.map +7 -0
  117. package/dist/viewer-bundle/docs.css +88 -0
  118. package/dist/viewer-bundle/edit-modal-BEGC2AO6.js +176 -0
  119. package/dist/viewer-bundle/edit-modal-BEGC2AO6.js.map +7 -0
  120. package/dist/viewer-bundle/erDiagram-SMLLAGMA-TBHMLD2E.js +1349 -0
  121. package/dist/viewer-bundle/erDiagram-SMLLAGMA-TBHMLD2E.js.map +7 -0
  122. package/dist/viewer-bundle/flowDiagram-DWJPFMVM-BZHLK6QB.js +2501 -0
  123. package/dist/viewer-bundle/flowDiagram-DWJPFMVM-BZHLK6QB.js.map +7 -0
  124. package/dist/viewer-bundle/ganttDiagram-T4ZO3ILL-YBARPTQR.js +2654 -0
  125. package/dist/viewer-bundle/ganttDiagram-T4ZO3ILL-YBARPTQR.js.map +7 -0
  126. package/dist/viewer-bundle/gitGraph-7Q5UKJZL-HENKIQDX.js +14 -0
  127. package/dist/viewer-bundle/gitGraph-7Q5UKJZL-HENKIQDX.js.map +7 -0
  128. package/dist/viewer-bundle/gitGraphDiagram-UUTBAWPF-M4VV3YVA.js +1946 -0
  129. package/dist/viewer-bundle/gitGraphDiagram-UUTBAWPF-M4VV3YVA.js.map +7 -0
  130. package/dist/viewer-bundle/index.html +28 -0
  131. package/dist/viewer-bundle/info-OMHHGYJF-E773USRS.js +14 -0
  132. package/dist/viewer-bundle/info-OMHHGYJF-E773USRS.js.map +7 -0
  133. package/dist/viewer-bundle/infoDiagram-42DDH7IO-C7JGUXKK.js +59 -0
  134. package/dist/viewer-bundle/infoDiagram-42DDH7IO-C7JGUXKK.js.map +7 -0
  135. package/dist/viewer-bundle/ishikawaDiagram-UXIWVN3A-YBC4X4VB.js +1012 -0
  136. package/dist/viewer-bundle/ishikawaDiagram-UXIWVN3A-YBC4X4VB.js.map +7 -0
  137. package/dist/viewer-bundle/journeyDiagram-VCZTEJTY-6WKVEOOO.js +1303 -0
  138. package/dist/viewer-bundle/journeyDiagram-VCZTEJTY-6WKVEOOO.js.map +7 -0
  139. package/dist/viewer-bundle/kanban-definition-6JOO6SKY-URTTHHO4.js +1131 -0
  140. package/dist/viewer-bundle/kanban-definition-6JOO6SKY-URTTHHO4.js.map +7 -0
  141. package/dist/viewer-bundle/katex-QN5266ZE.js +14318 -0
  142. package/dist/viewer-bundle/katex-QN5266ZE.js.map +7 -0
  143. package/dist/viewer-bundle/light.css +15 -0
  144. package/dist/viewer-bundle/main.js +4816 -0
  145. package/dist/viewer-bundle/main.js.map +7 -0
  146. package/dist/viewer-bundle/mermaid.core-AEBXU2JK.js +1708 -0
  147. package/dist/viewer-bundle/mermaid.core-AEBXU2JK.js.map +7 -0
  148. package/dist/viewer-bundle/mindmap-definition-QFDTVHPH-KUMAMRSF.js +1277 -0
  149. package/dist/viewer-bundle/mindmap-definition-QFDTVHPH-KUMAMRSF.js.map +7 -0
  150. package/dist/viewer-bundle/packet-4T2RLAQJ-IRYWWA66.js +14 -0
  151. package/dist/viewer-bundle/packet-4T2RLAQJ-IRYWWA66.js.map +7 -0
  152. package/dist/viewer-bundle/pico.classless.min.css +4 -0
  153. package/dist/viewer-bundle/pie-ZZUOXDRM-JYO4VL5N.js +14 -0
  154. package/dist/viewer-bundle/pie-ZZUOXDRM-JYO4VL5N.js.map +7 -0
  155. package/dist/viewer-bundle/pieDiagram-DEJITSTG-QOEHQN3N.js +238 -0
  156. package/dist/viewer-bundle/pieDiagram-DEJITSTG-QOEHQN3N.js.map +7 -0
  157. package/dist/viewer-bundle/prompt-modal-C4LHI7BS.js +12 -0
  158. package/dist/viewer-bundle/prompt-modal-C4LHI7BS.js.map +7 -0
  159. package/dist/viewer-bundle/quadrantDiagram-34T5L4WZ-SJNPUU5N.js +1409 -0
  160. package/dist/viewer-bundle/quadrantDiagram-34T5L4WZ-SJNPUU5N.js.map +7 -0
  161. package/dist/viewer-bundle/radar-PYXPWWZC-45BRYQSB.js +14 -0
  162. package/dist/viewer-bundle/radar-PYXPWWZC-45BRYQSB.js.map +7 -0
  163. package/dist/viewer-bundle/reason-modal-MK34MQ73.js +68 -0
  164. package/dist/viewer-bundle/reason-modal-MK34MQ73.js.map +7 -0
  165. package/dist/viewer-bundle/requirementDiagram-MS252O5E-UOMT3FCC.js +1311 -0
  166. package/dist/viewer-bundle/requirementDiagram-MS252O5E-UOMT3FCC.js.map +7 -0
  167. package/dist/viewer-bundle/sankeyDiagram-XADWPNL6-LAVJ5C6A.js +1263 -0
  168. package/dist/viewer-bundle/sankeyDiagram-XADWPNL6-LAVJ5C6A.js.map +7 -0
  169. package/dist/viewer-bundle/sequenceDiagram-FGHM5R23-3IWTOUNQ.js +4655 -0
  170. package/dist/viewer-bundle/sequenceDiagram-FGHM5R23-3IWTOUNQ.js.map +7 -0
  171. package/dist/viewer-bundle/stateDiagram-FHFEXIEX-S2OVQQON.js +495 -0
  172. package/dist/viewer-bundle/stateDiagram-FHFEXIEX-S2OVQQON.js.map +7 -0
  173. package/dist/viewer-bundle/stateDiagram-v2-QKLJ7IA2-XNZ3XXSV.js +44 -0
  174. package/dist/viewer-bundle/stateDiagram-v2-QKLJ7IA2-XNZ3XXSV.js.map +7 -0
  175. package/dist/viewer-bundle/timeline-definition-GMOUNBTQ-FHVZ7MHE.js +1646 -0
  176. package/dist/viewer-bundle/timeline-definition-GMOUNBTQ-FHVZ7MHE.js.map +7 -0
  177. package/dist/viewer-bundle/treeView-SZITEDCU-RXZXNYAM.js +14 -0
  178. package/dist/viewer-bundle/treeView-SZITEDCU-RXZXNYAM.js.map +7 -0
  179. package/dist/viewer-bundle/treemap-W4RFUUIX-2IGOFSJM.js +14 -0
  180. package/dist/viewer-bundle/treemap-W4RFUUIX-2IGOFSJM.js.map +7 -0
  181. package/dist/viewer-bundle/vennDiagram-DHZGUBPP-HEAOEXEZ.js +2544 -0
  182. package/dist/viewer-bundle/vennDiagram-DHZGUBPP-HEAOEXEZ.js.map +7 -0
  183. package/dist/viewer-bundle/wardley-RL74JXVD-VSPCLOX2.js +14 -0
  184. package/dist/viewer-bundle/wardley-RL74JXVD-VSPCLOX2.js.map +7 -0
  185. package/dist/viewer-bundle/wardleyDiagram-NUSXRM2D-EBY4FG3X.js +938 -0
  186. package/dist/viewer-bundle/wardleyDiagram-NUSXRM2D-EBY4FG3X.js.map +7 -0
  187. package/dist/viewer-bundle/xychartDiagram-5P7HB3ND-SSMUQEXK.js +1952 -0
  188. package/dist/viewer-bundle/xychartDiagram-5P7HB3ND-SSMUQEXK.js.map +7 -0
  189. package/package.json +51 -0
@@ -0,0 +1,2042 @@
1
+ import {
2
+ getDiagramElement
3
+ } from "./chunk-JQLVOAQB.js";
4
+ import {
5
+ setupViewPortForSVG
6
+ } from "./chunk-MBFAQ3IK.js";
7
+ import {
8
+ render
9
+ } from "./chunk-LQMQSYLO.js";
10
+ import {
11
+ generateId,
12
+ utils_default
13
+ } from "./chunk-UVRE3R6A.js";
14
+ import {
15
+ clear,
16
+ common_default,
17
+ getAccDescription,
18
+ getAccTitle,
19
+ getConfig2,
20
+ getDiagramTitle,
21
+ setAccDescription,
22
+ setAccTitle,
23
+ setDiagramTitle
24
+ } from "./chunk-7NZMPQDX.js";
25
+ import {
26
+ __name,
27
+ log
28
+ } from "./chunk-CZHJHAOR.js";
29
+
30
+ // ../../node_modules/.pnpm/mermaid@11.14.0/node_modules/mermaid/dist/chunks/mermaid.core/chunk-OYMX7WX6.mjs
31
+ var parser = function() {
32
+ var o = /* @__PURE__ */ __name(function(k, v, o2, l) {
33
+ for (o2 = o2 || {}, l = k.length; l--; o2[k[l]] = v) ;
34
+ return o2;
35
+ }, "o"), $V0 = [1, 2], $V1 = [1, 3], $V2 = [1, 4], $V3 = [2, 4], $V4 = [1, 9], $V5 = [1, 11], $V6 = [1, 16], $V7 = [1, 17], $V8 = [1, 18], $V9 = [1, 19], $Va = [1, 33], $Vb = [1, 20], $Vc = [1, 21], $Vd = [1, 22], $Ve = [1, 23], $Vf = [1, 24], $Vg = [1, 26], $Vh = [1, 27], $Vi = [1, 28], $Vj = [1, 29], $Vk = [1, 30], $Vl = [1, 31], $Vm = [1, 32], $Vn = [1, 35], $Vo = [1, 36], $Vp = [1, 37], $Vq = [1, 38], $Vr = [1, 34], $Vs = [1, 4, 5, 16, 17, 19, 21, 22, 24, 25, 26, 27, 28, 29, 33, 35, 37, 38, 41, 45, 48, 51, 52, 53, 54, 57], $Vt = [1, 4, 5, 14, 15, 16, 17, 19, 21, 22, 24, 25, 26, 27, 28, 29, 33, 35, 37, 38, 39, 40, 41, 45, 48, 51, 52, 53, 54, 57], $Vu = [4, 5, 16, 17, 19, 21, 22, 24, 25, 26, 27, 28, 29, 33, 35, 37, 38, 41, 45, 48, 51, 52, 53, 54, 57];
36
+ var parser2 = {
37
+ trace: /* @__PURE__ */ __name(function trace() {
38
+ }, "trace"),
39
+ yy: {},
40
+ symbols_: { "error": 2, "start": 3, "SPACE": 4, "NL": 5, "SD": 6, "document": 7, "line": 8, "statement": 9, "classDefStatement": 10, "styleStatement": 11, "cssClassStatement": 12, "idStatement": 13, "DESCR": 14, "-->": 15, "HIDE_EMPTY": 16, "scale": 17, "WIDTH": 18, "COMPOSIT_STATE": 19, "STRUCT_START": 20, "STRUCT_STOP": 21, "STATE_DESCR": 22, "AS": 23, "ID": 24, "FORK": 25, "JOIN": 26, "CHOICE": 27, "CONCURRENT": 28, "note": 29, "notePosition": 30, "NOTE_TEXT": 31, "direction": 32, "acc_title": 33, "acc_title_value": 34, "acc_descr": 35, "acc_descr_value": 36, "acc_descr_multiline_value": 37, "CLICK": 38, "STRING": 39, "HREF": 40, "classDef": 41, "CLASSDEF_ID": 42, "CLASSDEF_STYLEOPTS": 43, "DEFAULT": 44, "style": 45, "STYLE_IDS": 46, "STYLEDEF_STYLEOPTS": 47, "class": 48, "CLASSENTITY_IDS": 49, "STYLECLASS": 50, "direction_tb": 51, "direction_bt": 52, "direction_rl": 53, "direction_lr": 54, "eol": 55, ";": 56, "EDGE_STATE": 57, "STYLE_SEPARATOR": 58, "left_of": 59, "right_of": 60, "$accept": 0, "$end": 1 },
41
+ terminals_: { 2: "error", 4: "SPACE", 5: "NL", 6: "SD", 14: "DESCR", 15: "-->", 16: "HIDE_EMPTY", 17: "scale", 18: "WIDTH", 19: "COMPOSIT_STATE", 20: "STRUCT_START", 21: "STRUCT_STOP", 22: "STATE_DESCR", 23: "AS", 24: "ID", 25: "FORK", 26: "JOIN", 27: "CHOICE", 28: "CONCURRENT", 29: "note", 31: "NOTE_TEXT", 33: "acc_title", 34: "acc_title_value", 35: "acc_descr", 36: "acc_descr_value", 37: "acc_descr_multiline_value", 38: "CLICK", 39: "STRING", 40: "HREF", 41: "classDef", 42: "CLASSDEF_ID", 43: "CLASSDEF_STYLEOPTS", 44: "DEFAULT", 45: "style", 46: "STYLE_IDS", 47: "STYLEDEF_STYLEOPTS", 48: "class", 49: "CLASSENTITY_IDS", 50: "STYLECLASS", 51: "direction_tb", 52: "direction_bt", 53: "direction_rl", 54: "direction_lr", 56: ";", 57: "EDGE_STATE", 58: "STYLE_SEPARATOR", 59: "left_of", 60: "right_of" },
42
+ productions_: [0, [3, 2], [3, 2], [3, 2], [7, 0], [7, 2], [8, 2], [8, 1], [8, 1], [9, 1], [9, 1], [9, 1], [9, 1], [9, 2], [9, 3], [9, 4], [9, 1], [9, 2], [9, 1], [9, 4], [9, 3], [9, 6], [9, 1], [9, 1], [9, 1], [9, 1], [9, 4], [9, 4], [9, 1], [9, 2], [9, 2], [9, 1], [9, 5], [9, 5], [10, 3], [10, 3], [11, 3], [12, 3], [32, 1], [32, 1], [32, 1], [32, 1], [55, 1], [55, 1], [13, 1], [13, 1], [13, 3], [13, 3], [30, 1], [30, 1]],
43
+ performAction: /* @__PURE__ */ __name(function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) {
44
+ var $0 = $$.length - 1;
45
+ switch (yystate) {
46
+ case 3:
47
+ yy.setRootDoc($$[$0]);
48
+ return $$[$0];
49
+ break;
50
+ case 4:
51
+ this.$ = [];
52
+ break;
53
+ case 5:
54
+ if ($$[$0] != "nl") {
55
+ $$[$0 - 1].push($$[$0]);
56
+ this.$ = $$[$0 - 1];
57
+ }
58
+ break;
59
+ case 6:
60
+ case 7:
61
+ this.$ = $$[$0];
62
+ break;
63
+ case 8:
64
+ this.$ = "nl";
65
+ break;
66
+ case 12:
67
+ this.$ = $$[$0];
68
+ break;
69
+ case 13:
70
+ const stateStmt = $$[$0 - 1];
71
+ stateStmt.description = yy.trimColon($$[$0]);
72
+ this.$ = stateStmt;
73
+ break;
74
+ case 14:
75
+ this.$ = { stmt: "relation", state1: $$[$0 - 2], state2: $$[$0] };
76
+ break;
77
+ case 15:
78
+ const relDescription = yy.trimColon($$[$0]);
79
+ this.$ = { stmt: "relation", state1: $$[$0 - 3], state2: $$[$0 - 1], description: relDescription };
80
+ break;
81
+ case 19:
82
+ this.$ = { stmt: "state", id: $$[$0 - 3], type: "default", description: "", doc: $$[$0 - 1] };
83
+ break;
84
+ case 20:
85
+ var id = $$[$0];
86
+ var description = $$[$0 - 2].trim();
87
+ if ($$[$0].match(":")) {
88
+ var parts = $$[$0].split(":");
89
+ id = parts[0];
90
+ description = [description, parts[1]];
91
+ }
92
+ this.$ = { stmt: "state", id, type: "default", description };
93
+ break;
94
+ case 21:
95
+ this.$ = { stmt: "state", id: $$[$0 - 3], type: "default", description: $$[$0 - 5], doc: $$[$0 - 1] };
96
+ break;
97
+ case 22:
98
+ this.$ = { stmt: "state", id: $$[$0], type: "fork" };
99
+ break;
100
+ case 23:
101
+ this.$ = { stmt: "state", id: $$[$0], type: "join" };
102
+ break;
103
+ case 24:
104
+ this.$ = { stmt: "state", id: $$[$0], type: "choice" };
105
+ break;
106
+ case 25:
107
+ this.$ = { stmt: "state", id: yy.getDividerId(), type: "divider" };
108
+ break;
109
+ case 26:
110
+ this.$ = { stmt: "state", id: $$[$0 - 1].trim(), note: { position: $$[$0 - 2].trim(), text: $$[$0].trim() } };
111
+ break;
112
+ case 29:
113
+ this.$ = $$[$0].trim();
114
+ yy.setAccTitle(this.$);
115
+ break;
116
+ case 30:
117
+ case 31:
118
+ this.$ = $$[$0].trim();
119
+ yy.setAccDescription(this.$);
120
+ break;
121
+ case 32:
122
+ this.$ = {
123
+ stmt: "click",
124
+ id: $$[$0 - 3],
125
+ url: $$[$0 - 2],
126
+ tooltip: $$[$0 - 1]
127
+ };
128
+ break;
129
+ case 33:
130
+ this.$ = {
131
+ stmt: "click",
132
+ id: $$[$0 - 3],
133
+ url: $$[$0 - 1],
134
+ tooltip: ""
135
+ };
136
+ break;
137
+ case 34:
138
+ case 35:
139
+ this.$ = { stmt: "classDef", id: $$[$0 - 1].trim(), classes: $$[$0].trim() };
140
+ break;
141
+ case 36:
142
+ this.$ = { stmt: "style", id: $$[$0 - 1].trim(), styleClass: $$[$0].trim() };
143
+ break;
144
+ case 37:
145
+ this.$ = { stmt: "applyClass", id: $$[$0 - 1].trim(), styleClass: $$[$0].trim() };
146
+ break;
147
+ case 38:
148
+ yy.setDirection("TB");
149
+ this.$ = { stmt: "dir", value: "TB" };
150
+ break;
151
+ case 39:
152
+ yy.setDirection("BT");
153
+ this.$ = { stmt: "dir", value: "BT" };
154
+ break;
155
+ case 40:
156
+ yy.setDirection("RL");
157
+ this.$ = { stmt: "dir", value: "RL" };
158
+ break;
159
+ case 41:
160
+ yy.setDirection("LR");
161
+ this.$ = { stmt: "dir", value: "LR" };
162
+ break;
163
+ case 44:
164
+ case 45:
165
+ this.$ = { stmt: "state", id: $$[$0].trim(), type: "default", description: "" };
166
+ break;
167
+ case 46:
168
+ this.$ = { stmt: "state", id: $$[$0 - 2].trim(), classes: [$$[$0].trim()], type: "default", description: "" };
169
+ break;
170
+ case 47:
171
+ this.$ = { stmt: "state", id: $$[$0 - 2].trim(), classes: [$$[$0].trim()], type: "default", description: "" };
172
+ break;
173
+ }
174
+ }, "anonymous"),
175
+ table: [{ 3: 1, 4: $V0, 5: $V1, 6: $V2 }, { 1: [3] }, { 3: 5, 4: $V0, 5: $V1, 6: $V2 }, { 3: 6, 4: $V0, 5: $V1, 6: $V2 }, o([1, 4, 5, 16, 17, 19, 22, 24, 25, 26, 27, 28, 29, 33, 35, 37, 38, 41, 45, 48, 51, 52, 53, 54, 57], $V3, { 7: 7 }), { 1: [2, 1] }, { 1: [2, 2] }, { 1: [2, 3], 4: $V4, 5: $V5, 8: 8, 9: 10, 10: 12, 11: 13, 12: 14, 13: 15, 16: $V6, 17: $V7, 19: $V8, 22: $V9, 24: $Va, 25: $Vb, 26: $Vc, 27: $Vd, 28: $Ve, 29: $Vf, 32: 25, 33: $Vg, 35: $Vh, 37: $Vi, 38: $Vj, 41: $Vk, 45: $Vl, 48: $Vm, 51: $Vn, 52: $Vo, 53: $Vp, 54: $Vq, 57: $Vr }, o($Vs, [2, 5]), { 9: 39, 10: 12, 11: 13, 12: 14, 13: 15, 16: $V6, 17: $V7, 19: $V8, 22: $V9, 24: $Va, 25: $Vb, 26: $Vc, 27: $Vd, 28: $Ve, 29: $Vf, 32: 25, 33: $Vg, 35: $Vh, 37: $Vi, 38: $Vj, 41: $Vk, 45: $Vl, 48: $Vm, 51: $Vn, 52: $Vo, 53: $Vp, 54: $Vq, 57: $Vr }, o($Vs, [2, 7]), o($Vs, [2, 8]), o($Vs, [2, 9]), o($Vs, [2, 10]), o($Vs, [2, 11]), o($Vs, [2, 12], { 14: [1, 40], 15: [1, 41] }), o($Vs, [2, 16]), { 18: [1, 42] }, o($Vs, [2, 18], { 20: [1, 43] }), { 23: [1, 44] }, o($Vs, [2, 22]), o($Vs, [2, 23]), o($Vs, [2, 24]), o($Vs, [2, 25]), { 30: 45, 31: [1, 46], 59: [1, 47], 60: [1, 48] }, o($Vs, [2, 28]), { 34: [1, 49] }, { 36: [1, 50] }, o($Vs, [2, 31]), { 13: 51, 24: $Va, 57: $Vr }, { 42: [1, 52], 44: [1, 53] }, { 46: [1, 54] }, { 49: [1, 55] }, o($Vt, [2, 44], { 58: [1, 56] }), o($Vt, [2, 45], { 58: [1, 57] }), o($Vs, [2, 38]), o($Vs, [2, 39]), o($Vs, [2, 40]), o($Vs, [2, 41]), o($Vs, [2, 6]), o($Vs, [2, 13]), { 13: 58, 24: $Va, 57: $Vr }, o($Vs, [2, 17]), o($Vu, $V3, { 7: 59 }), { 24: [1, 60] }, { 24: [1, 61] }, { 23: [1, 62] }, { 24: [2, 48] }, { 24: [2, 49] }, o($Vs, [2, 29]), o($Vs, [2, 30]), { 39: [1, 63], 40: [1, 64] }, { 43: [1, 65] }, { 43: [1, 66] }, { 47: [1, 67] }, { 50: [1, 68] }, { 24: [1, 69] }, { 24: [1, 70] }, o($Vs, [2, 14], { 14: [1, 71] }), { 4: $V4, 5: $V5, 8: 8, 9: 10, 10: 12, 11: 13, 12: 14, 13: 15, 16: $V6, 17: $V7, 19: $V8, 21: [1, 72], 22: $V9, 24: $Va, 25: $Vb, 26: $Vc, 27: $Vd, 28: $Ve, 29: $Vf, 32: 25, 33: $Vg, 35: $Vh, 37: $Vi, 38: $Vj, 41: $Vk, 45: $Vl, 48: $Vm, 51: $Vn, 52: $Vo, 53: $Vp, 54: $Vq, 57: $Vr }, o($Vs, [2, 20], { 20: [1, 73] }), { 31: [1, 74] }, { 24: [1, 75] }, { 39: [1, 76] }, { 39: [1, 77] }, o($Vs, [2, 34]), o($Vs, [2, 35]), o($Vs, [2, 36]), o($Vs, [2, 37]), o($Vt, [2, 46]), o($Vt, [2, 47]), o($Vs, [2, 15]), o($Vs, [2, 19]), o($Vu, $V3, { 7: 78 }), o($Vs, [2, 26]), o($Vs, [2, 27]), { 5: [1, 79] }, { 5: [1, 80] }, { 4: $V4, 5: $V5, 8: 8, 9: 10, 10: 12, 11: 13, 12: 14, 13: 15, 16: $V6, 17: $V7, 19: $V8, 21: [1, 81], 22: $V9, 24: $Va, 25: $Vb, 26: $Vc, 27: $Vd, 28: $Ve, 29: $Vf, 32: 25, 33: $Vg, 35: $Vh, 37: $Vi, 38: $Vj, 41: $Vk, 45: $Vl, 48: $Vm, 51: $Vn, 52: $Vo, 53: $Vp, 54: $Vq, 57: $Vr }, o($Vs, [2, 32]), o($Vs, [2, 33]), o($Vs, [2, 21])],
176
+ defaultActions: { 5: [2, 1], 6: [2, 2], 47: [2, 48], 48: [2, 49] },
177
+ parseError: /* @__PURE__ */ __name(function parseError(str, hash) {
178
+ if (hash.recoverable) {
179
+ this.trace(str);
180
+ } else {
181
+ var error = new Error(str);
182
+ error.hash = hash;
183
+ throw error;
184
+ }
185
+ }, "parseError"),
186
+ parse: /* @__PURE__ */ __name(function parse(input) {
187
+ var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;
188
+ var args = lstack.slice.call(arguments, 1);
189
+ var lexer2 = Object.create(this.lexer);
190
+ var sharedState = { yy: {} };
191
+ for (var k in this.yy) {
192
+ if (Object.prototype.hasOwnProperty.call(this.yy, k)) {
193
+ sharedState.yy[k] = this.yy[k];
194
+ }
195
+ }
196
+ lexer2.setInput(input, sharedState.yy);
197
+ sharedState.yy.lexer = lexer2;
198
+ sharedState.yy.parser = this;
199
+ if (typeof lexer2.yylloc == "undefined") {
200
+ lexer2.yylloc = {};
201
+ }
202
+ var yyloc = lexer2.yylloc;
203
+ lstack.push(yyloc);
204
+ var ranges = lexer2.options && lexer2.options.ranges;
205
+ if (typeof sharedState.yy.parseError === "function") {
206
+ this.parseError = sharedState.yy.parseError;
207
+ } else {
208
+ this.parseError = Object.getPrototypeOf(this).parseError;
209
+ }
210
+ function popStack(n) {
211
+ stack.length = stack.length - 2 * n;
212
+ vstack.length = vstack.length - n;
213
+ lstack.length = lstack.length - n;
214
+ }
215
+ __name(popStack, "popStack");
216
+ function lex() {
217
+ var token;
218
+ token = tstack.pop() || lexer2.lex() || EOF;
219
+ if (typeof token !== "number") {
220
+ if (token instanceof Array) {
221
+ tstack = token;
222
+ token = tstack.pop();
223
+ }
224
+ token = self.symbols_[token] || token;
225
+ }
226
+ return token;
227
+ }
228
+ __name(lex, "lex");
229
+ var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected;
230
+ while (true) {
231
+ state = stack[stack.length - 1];
232
+ if (this.defaultActions[state]) {
233
+ action = this.defaultActions[state];
234
+ } else {
235
+ if (symbol === null || typeof symbol == "undefined") {
236
+ symbol = lex();
237
+ }
238
+ action = table[state] && table[state][symbol];
239
+ }
240
+ if (typeof action === "undefined" || !action.length || !action[0]) {
241
+ var errStr = "";
242
+ expected = [];
243
+ for (p in table[state]) {
244
+ if (this.terminals_[p] && p > TERROR) {
245
+ expected.push("'" + this.terminals_[p] + "'");
246
+ }
247
+ }
248
+ if (lexer2.showPosition) {
249
+ errStr = "Parse error on line " + (yylineno + 1) + ":\n" + lexer2.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'";
250
+ } else {
251
+ errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == EOF ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'");
252
+ }
253
+ this.parseError(errStr, {
254
+ text: lexer2.match,
255
+ token: this.terminals_[symbol] || symbol,
256
+ line: lexer2.yylineno,
257
+ loc: yyloc,
258
+ expected
259
+ });
260
+ }
261
+ if (action[0] instanceof Array && action.length > 1) {
262
+ throw new Error("Parse Error: multiple actions possible at state: " + state + ", token: " + symbol);
263
+ }
264
+ switch (action[0]) {
265
+ case 1:
266
+ stack.push(symbol);
267
+ vstack.push(lexer2.yytext);
268
+ lstack.push(lexer2.yylloc);
269
+ stack.push(action[1]);
270
+ symbol = null;
271
+ if (!preErrorSymbol) {
272
+ yyleng = lexer2.yyleng;
273
+ yytext = lexer2.yytext;
274
+ yylineno = lexer2.yylineno;
275
+ yyloc = lexer2.yylloc;
276
+ if (recovering > 0) {
277
+ recovering--;
278
+ }
279
+ } else {
280
+ symbol = preErrorSymbol;
281
+ preErrorSymbol = null;
282
+ }
283
+ break;
284
+ case 2:
285
+ len = this.productions_[action[1]][1];
286
+ yyval.$ = vstack[vstack.length - len];
287
+ yyval._$ = {
288
+ first_line: lstack[lstack.length - (len || 1)].first_line,
289
+ last_line: lstack[lstack.length - 1].last_line,
290
+ first_column: lstack[lstack.length - (len || 1)].first_column,
291
+ last_column: lstack[lstack.length - 1].last_column
292
+ };
293
+ if (ranges) {
294
+ yyval._$.range = [
295
+ lstack[lstack.length - (len || 1)].range[0],
296
+ lstack[lstack.length - 1].range[1]
297
+ ];
298
+ }
299
+ r = this.performAction.apply(yyval, [
300
+ yytext,
301
+ yyleng,
302
+ yylineno,
303
+ sharedState.yy,
304
+ action[1],
305
+ vstack,
306
+ lstack
307
+ ].concat(args));
308
+ if (typeof r !== "undefined") {
309
+ return r;
310
+ }
311
+ if (len) {
312
+ stack = stack.slice(0, -1 * len * 2);
313
+ vstack = vstack.slice(0, -1 * len);
314
+ lstack = lstack.slice(0, -1 * len);
315
+ }
316
+ stack.push(this.productions_[action[1]][0]);
317
+ vstack.push(yyval.$);
318
+ lstack.push(yyval._$);
319
+ newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
320
+ stack.push(newState);
321
+ break;
322
+ case 3:
323
+ return true;
324
+ }
325
+ }
326
+ return true;
327
+ }, "parse")
328
+ };
329
+ var lexer = /* @__PURE__ */ function() {
330
+ var lexer2 = {
331
+ EOF: 1,
332
+ parseError: /* @__PURE__ */ __name(function parseError(str, hash) {
333
+ if (this.yy.parser) {
334
+ this.yy.parser.parseError(str, hash);
335
+ } else {
336
+ throw new Error(str);
337
+ }
338
+ }, "parseError"),
339
+ // resets the lexer, sets new input
340
+ setInput: /* @__PURE__ */ __name(function(input, yy) {
341
+ this.yy = yy || this.yy || {};
342
+ this._input = input;
343
+ this._more = this._backtrack = this.done = false;
344
+ this.yylineno = this.yyleng = 0;
345
+ this.yytext = this.matched = this.match = "";
346
+ this.conditionStack = ["INITIAL"];
347
+ this.yylloc = {
348
+ first_line: 1,
349
+ first_column: 0,
350
+ last_line: 1,
351
+ last_column: 0
352
+ };
353
+ if (this.options.ranges) {
354
+ this.yylloc.range = [0, 0];
355
+ }
356
+ this.offset = 0;
357
+ return this;
358
+ }, "setInput"),
359
+ // consumes and returns one char from the input
360
+ input: /* @__PURE__ */ __name(function() {
361
+ var ch = this._input[0];
362
+ this.yytext += ch;
363
+ this.yyleng++;
364
+ this.offset++;
365
+ this.match += ch;
366
+ this.matched += ch;
367
+ var lines = ch.match(/(?:\r\n?|\n).*/g);
368
+ if (lines) {
369
+ this.yylineno++;
370
+ this.yylloc.last_line++;
371
+ } else {
372
+ this.yylloc.last_column++;
373
+ }
374
+ if (this.options.ranges) {
375
+ this.yylloc.range[1]++;
376
+ }
377
+ this._input = this._input.slice(1);
378
+ return ch;
379
+ }, "input"),
380
+ // unshifts one char (or a string) into the input
381
+ unput: /* @__PURE__ */ __name(function(ch) {
382
+ var len = ch.length;
383
+ var lines = ch.split(/(?:\r\n?|\n)/g);
384
+ this._input = ch + this._input;
385
+ this.yytext = this.yytext.substr(0, this.yytext.length - len);
386
+ this.offset -= len;
387
+ var oldLines = this.match.split(/(?:\r\n?|\n)/g);
388
+ this.match = this.match.substr(0, this.match.length - 1);
389
+ this.matched = this.matched.substr(0, this.matched.length - 1);
390
+ if (lines.length - 1) {
391
+ this.yylineno -= lines.length - 1;
392
+ }
393
+ var r = this.yylloc.range;
394
+ this.yylloc = {
395
+ first_line: this.yylloc.first_line,
396
+ last_line: this.yylineno + 1,
397
+ first_column: this.yylloc.first_column,
398
+ 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
399
+ };
400
+ if (this.options.ranges) {
401
+ this.yylloc.range = [r[0], r[0] + this.yyleng - len];
402
+ }
403
+ this.yyleng = this.yytext.length;
404
+ return this;
405
+ }, "unput"),
406
+ // When called from action, caches matched text and appends it on next action
407
+ more: /* @__PURE__ */ __name(function() {
408
+ this._more = true;
409
+ return this;
410
+ }, "more"),
411
+ // 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.
412
+ reject: /* @__PURE__ */ __name(function() {
413
+ if (this.options.backtrack_lexer) {
414
+ this._backtrack = true;
415
+ } else {
416
+ 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(), {
417
+ text: "",
418
+ token: null,
419
+ line: this.yylineno
420
+ });
421
+ }
422
+ return this;
423
+ }, "reject"),
424
+ // retain first n characters of the match
425
+ less: /* @__PURE__ */ __name(function(n) {
426
+ this.unput(this.match.slice(n));
427
+ }, "less"),
428
+ // displays already matched input, i.e. for error messages
429
+ pastInput: /* @__PURE__ */ __name(function() {
430
+ var past = this.matched.substr(0, this.matched.length - this.match.length);
431
+ return (past.length > 20 ? "..." : "") + past.substr(-20).replace(/\n/g, "");
432
+ }, "pastInput"),
433
+ // displays upcoming input, i.e. for error messages
434
+ upcomingInput: /* @__PURE__ */ __name(function() {
435
+ var next = this.match;
436
+ if (next.length < 20) {
437
+ next += this._input.substr(0, 20 - next.length);
438
+ }
439
+ return (next.substr(0, 20) + (next.length > 20 ? "..." : "")).replace(/\n/g, "");
440
+ }, "upcomingInput"),
441
+ // displays the character position where the lexing error occurred, i.e. for error messages
442
+ showPosition: /* @__PURE__ */ __name(function() {
443
+ var pre = this.pastInput();
444
+ var c = new Array(pre.length + 1).join("-");
445
+ return pre + this.upcomingInput() + "\n" + c + "^";
446
+ }, "showPosition"),
447
+ // test the lexed token: return FALSE when not a match, otherwise return token
448
+ test_match: /* @__PURE__ */ __name(function(match, indexed_rule) {
449
+ var token, lines, backup;
450
+ if (this.options.backtrack_lexer) {
451
+ backup = {
452
+ yylineno: this.yylineno,
453
+ yylloc: {
454
+ first_line: this.yylloc.first_line,
455
+ last_line: this.last_line,
456
+ first_column: this.yylloc.first_column,
457
+ last_column: this.yylloc.last_column
458
+ },
459
+ yytext: this.yytext,
460
+ match: this.match,
461
+ matches: this.matches,
462
+ matched: this.matched,
463
+ yyleng: this.yyleng,
464
+ offset: this.offset,
465
+ _more: this._more,
466
+ _input: this._input,
467
+ yy: this.yy,
468
+ conditionStack: this.conditionStack.slice(0),
469
+ done: this.done
470
+ };
471
+ if (this.options.ranges) {
472
+ backup.yylloc.range = this.yylloc.range.slice(0);
473
+ }
474
+ }
475
+ lines = match[0].match(/(?:\r\n?|\n).*/g);
476
+ if (lines) {
477
+ this.yylineno += lines.length;
478
+ }
479
+ this.yylloc = {
480
+ first_line: this.yylloc.last_line,
481
+ last_line: this.yylineno + 1,
482
+ first_column: this.yylloc.last_column,
483
+ last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length
484
+ };
485
+ this.yytext += match[0];
486
+ this.match += match[0];
487
+ this.matches = match;
488
+ this.yyleng = this.yytext.length;
489
+ if (this.options.ranges) {
490
+ this.yylloc.range = [this.offset, this.offset += this.yyleng];
491
+ }
492
+ this._more = false;
493
+ this._backtrack = false;
494
+ this._input = this._input.slice(match[0].length);
495
+ this.matched += match[0];
496
+ token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
497
+ if (this.done && this._input) {
498
+ this.done = false;
499
+ }
500
+ if (token) {
501
+ return token;
502
+ } else if (this._backtrack) {
503
+ for (var k in backup) {
504
+ this[k] = backup[k];
505
+ }
506
+ return false;
507
+ }
508
+ return false;
509
+ }, "test_match"),
510
+ // return next match in input
511
+ next: /* @__PURE__ */ __name(function() {
512
+ if (this.done) {
513
+ return this.EOF;
514
+ }
515
+ if (!this._input) {
516
+ this.done = true;
517
+ }
518
+ var token, match, tempMatch, index;
519
+ if (!this._more) {
520
+ this.yytext = "";
521
+ this.match = "";
522
+ }
523
+ var rules = this._currentRules();
524
+ for (var i = 0; i < rules.length; i++) {
525
+ tempMatch = this._input.match(this.rules[rules[i]]);
526
+ if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
527
+ match = tempMatch;
528
+ index = i;
529
+ if (this.options.backtrack_lexer) {
530
+ token = this.test_match(tempMatch, rules[i]);
531
+ if (token !== false) {
532
+ return token;
533
+ } else if (this._backtrack) {
534
+ match = false;
535
+ continue;
536
+ } else {
537
+ return false;
538
+ }
539
+ } else if (!this.options.flex) {
540
+ break;
541
+ }
542
+ }
543
+ }
544
+ if (match) {
545
+ token = this.test_match(match, rules[index]);
546
+ if (token !== false) {
547
+ return token;
548
+ }
549
+ return false;
550
+ }
551
+ if (this._input === "") {
552
+ return this.EOF;
553
+ } else {
554
+ return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". Unrecognized text.\n" + this.showPosition(), {
555
+ text: "",
556
+ token: null,
557
+ line: this.yylineno
558
+ });
559
+ }
560
+ }, "next"),
561
+ // return next match that has a token
562
+ lex: /* @__PURE__ */ __name(function lex() {
563
+ var r = this.next();
564
+ if (r) {
565
+ return r;
566
+ } else {
567
+ return this.lex();
568
+ }
569
+ }, "lex"),
570
+ // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
571
+ begin: /* @__PURE__ */ __name(function begin(condition) {
572
+ this.conditionStack.push(condition);
573
+ }, "begin"),
574
+ // pop the previously active lexer condition state off the condition stack
575
+ popState: /* @__PURE__ */ __name(function popState() {
576
+ var n = this.conditionStack.length - 1;
577
+ if (n > 0) {
578
+ return this.conditionStack.pop();
579
+ } else {
580
+ return this.conditionStack[0];
581
+ }
582
+ }, "popState"),
583
+ // produce the lexer rule set which is active for the currently active lexer condition state
584
+ _currentRules: /* @__PURE__ */ __name(function _currentRules() {
585
+ if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
586
+ return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
587
+ } else {
588
+ return this.conditions["INITIAL"].rules;
589
+ }
590
+ }, "_currentRules"),
591
+ // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
592
+ topState: /* @__PURE__ */ __name(function topState(n) {
593
+ n = this.conditionStack.length - 1 - Math.abs(n || 0);
594
+ if (n >= 0) {
595
+ return this.conditionStack[n];
596
+ } else {
597
+ return "INITIAL";
598
+ }
599
+ }, "topState"),
600
+ // alias for begin(condition)
601
+ pushState: /* @__PURE__ */ __name(function pushState(condition) {
602
+ this.begin(condition);
603
+ }, "pushState"),
604
+ // return the number of states currently on the stack
605
+ stateStackSize: /* @__PURE__ */ __name(function stateStackSize() {
606
+ return this.conditionStack.length;
607
+ }, "stateStackSize"),
608
+ options: { "case-insensitive": true },
609
+ performAction: /* @__PURE__ */ __name(function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) {
610
+ var YYSTATE = YY_START;
611
+ switch ($avoiding_name_collisions) {
612
+ case 0:
613
+ return 38;
614
+ break;
615
+ case 1:
616
+ return 40;
617
+ break;
618
+ case 2:
619
+ return 39;
620
+ break;
621
+ case 3:
622
+ return 44;
623
+ break;
624
+ case 4:
625
+ return 51;
626
+ break;
627
+ case 5:
628
+ return 52;
629
+ break;
630
+ case 6:
631
+ return 53;
632
+ break;
633
+ case 7:
634
+ return 54;
635
+ break;
636
+ case 8:
637
+ break;
638
+ case 9:
639
+ {
640
+ }
641
+ break;
642
+ case 10:
643
+ return 5;
644
+ break;
645
+ case 11:
646
+ break;
647
+ case 12:
648
+ break;
649
+ case 13:
650
+ break;
651
+ case 14:
652
+ break;
653
+ case 15:
654
+ this.pushState("SCALE");
655
+ return 17;
656
+ break;
657
+ case 16:
658
+ return 18;
659
+ break;
660
+ case 17:
661
+ this.popState();
662
+ break;
663
+ case 18:
664
+ this.begin("acc_title");
665
+ return 33;
666
+ break;
667
+ case 19:
668
+ this.popState();
669
+ return "acc_title_value";
670
+ break;
671
+ case 20:
672
+ this.begin("acc_descr");
673
+ return 35;
674
+ break;
675
+ case 21:
676
+ this.popState();
677
+ return "acc_descr_value";
678
+ break;
679
+ case 22:
680
+ this.begin("acc_descr_multiline");
681
+ break;
682
+ case 23:
683
+ this.popState();
684
+ break;
685
+ case 24:
686
+ return "acc_descr_multiline_value";
687
+ break;
688
+ case 25:
689
+ this.pushState("CLASSDEF");
690
+ return 41;
691
+ break;
692
+ case 26:
693
+ this.popState();
694
+ this.pushState("CLASSDEFID");
695
+ return "DEFAULT_CLASSDEF_ID";
696
+ break;
697
+ case 27:
698
+ this.popState();
699
+ this.pushState("CLASSDEFID");
700
+ return 42;
701
+ break;
702
+ case 28:
703
+ this.popState();
704
+ return 43;
705
+ break;
706
+ case 29:
707
+ this.pushState("CLASS");
708
+ return 48;
709
+ break;
710
+ case 30:
711
+ this.popState();
712
+ this.pushState("CLASS_STYLE");
713
+ return 49;
714
+ break;
715
+ case 31:
716
+ this.popState();
717
+ return 50;
718
+ break;
719
+ case 32:
720
+ this.pushState("STYLE");
721
+ return 45;
722
+ break;
723
+ case 33:
724
+ this.popState();
725
+ this.pushState("STYLEDEF_STYLES");
726
+ return 46;
727
+ break;
728
+ case 34:
729
+ this.popState();
730
+ return 47;
731
+ break;
732
+ case 35:
733
+ this.pushState("SCALE");
734
+ return 17;
735
+ break;
736
+ case 36:
737
+ return 18;
738
+ break;
739
+ case 37:
740
+ this.popState();
741
+ break;
742
+ case 38:
743
+ this.pushState("STATE");
744
+ break;
745
+ case 39:
746
+ this.popState();
747
+ yy_.yytext = yy_.yytext.slice(0, -8).trim();
748
+ return 25;
749
+ break;
750
+ case 40:
751
+ this.popState();
752
+ yy_.yytext = yy_.yytext.slice(0, -8).trim();
753
+ return 26;
754
+ break;
755
+ case 41:
756
+ this.popState();
757
+ yy_.yytext = yy_.yytext.slice(0, -10).trim();
758
+ return 27;
759
+ break;
760
+ case 42:
761
+ this.popState();
762
+ yy_.yytext = yy_.yytext.slice(0, -8).trim();
763
+ return 25;
764
+ break;
765
+ case 43:
766
+ this.popState();
767
+ yy_.yytext = yy_.yytext.slice(0, -8).trim();
768
+ return 26;
769
+ break;
770
+ case 44:
771
+ this.popState();
772
+ yy_.yytext = yy_.yytext.slice(0, -10).trim();
773
+ return 27;
774
+ break;
775
+ case 45:
776
+ return 51;
777
+ break;
778
+ case 46:
779
+ return 52;
780
+ break;
781
+ case 47:
782
+ return 53;
783
+ break;
784
+ case 48:
785
+ return 54;
786
+ break;
787
+ case 49:
788
+ this.pushState("STATE_STRING");
789
+ break;
790
+ case 50:
791
+ this.pushState("STATE_ID");
792
+ return "AS";
793
+ break;
794
+ case 51:
795
+ this.popState();
796
+ return "ID";
797
+ break;
798
+ case 52:
799
+ this.popState();
800
+ break;
801
+ case 53:
802
+ return "STATE_DESCR";
803
+ break;
804
+ case 54:
805
+ return 19;
806
+ break;
807
+ case 55:
808
+ this.popState();
809
+ break;
810
+ case 56:
811
+ this.popState();
812
+ this.pushState("struct");
813
+ return 20;
814
+ break;
815
+ case 57:
816
+ break;
817
+ case 58:
818
+ this.popState();
819
+ return 21;
820
+ break;
821
+ case 59:
822
+ break;
823
+ case 60:
824
+ this.begin("NOTE");
825
+ return 29;
826
+ break;
827
+ case 61:
828
+ this.popState();
829
+ this.pushState("NOTE_ID");
830
+ return 59;
831
+ break;
832
+ case 62:
833
+ this.popState();
834
+ this.pushState("NOTE_ID");
835
+ return 60;
836
+ break;
837
+ case 63:
838
+ this.popState();
839
+ this.pushState("FLOATING_NOTE");
840
+ break;
841
+ case 64:
842
+ this.popState();
843
+ this.pushState("FLOATING_NOTE_ID");
844
+ return "AS";
845
+ break;
846
+ case 65:
847
+ break;
848
+ case 66:
849
+ return "NOTE_TEXT";
850
+ break;
851
+ case 67:
852
+ this.popState();
853
+ return "ID";
854
+ break;
855
+ case 68:
856
+ this.popState();
857
+ this.pushState("NOTE_TEXT");
858
+ return 24;
859
+ break;
860
+ case 69:
861
+ this.popState();
862
+ yy_.yytext = yy_.yytext.substr(2).trim();
863
+ return 31;
864
+ break;
865
+ case 70:
866
+ this.popState();
867
+ yy_.yytext = yy_.yytext.slice(0, -8).trim();
868
+ return 31;
869
+ break;
870
+ case 71:
871
+ return 6;
872
+ break;
873
+ case 72:
874
+ return 6;
875
+ break;
876
+ case 73:
877
+ return 16;
878
+ break;
879
+ case 74:
880
+ return 57;
881
+ break;
882
+ case 75:
883
+ return 24;
884
+ break;
885
+ case 76:
886
+ yy_.yytext = yy_.yytext.trim();
887
+ return 14;
888
+ break;
889
+ case 77:
890
+ return 15;
891
+ break;
892
+ case 78:
893
+ return 28;
894
+ break;
895
+ case 79:
896
+ return 58;
897
+ break;
898
+ case 80:
899
+ return 5;
900
+ break;
901
+ case 81:
902
+ return "INVALID";
903
+ break;
904
+ }
905
+ }, "anonymous"),
906
+ rules: [/^(?:click\b)/i, /^(?:href\b)/i, /^(?:"[^"]*")/i, /^(?:default\b)/i, /^(?:.*direction\s+TB[^\n]*)/i, /^(?:.*direction\s+BT[^\n]*)/i, /^(?:.*direction\s+RL[^\n]*)/i, /^(?:.*direction\s+LR[^\n]*)/i, /^(?:%%(?!\{)[^\n]*)/i, /^(?:[^\}]%%[^\n]*)/i, /^(?:[\n]+)/i, /^(?:[\s]+)/i, /^(?:((?!\n)\s)+)/i, /^(?:#[^\n]*)/i, /^(?:%[^\n]*)/i, /^(?:scale\s+)/i, /^(?:\d+)/i, /^(?:\s+width\b)/i, /^(?:accTitle\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*\{\s*)/i, /^(?:[\}])/i, /^(?:[^\}]*)/i, /^(?:classDef\s+)/i, /^(?:DEFAULT\s+)/i, /^(?:\w+\s+)/i, /^(?:[^\n]*)/i, /^(?:class\s+)/i, /^(?:(\w+)+((,\s*\w+)*))/i, /^(?:[^\n]*)/i, /^(?:style\s+)/i, /^(?:[\w,]+\s+)/i, /^(?:[^\n]*)/i, /^(?:scale\s+)/i, /^(?:\d+)/i, /^(?:\s+width\b)/i, /^(?:state\s+)/i, /^(?:.*<<fork>>)/i, /^(?:.*<<join>>)/i, /^(?:.*<<choice>>)/i, /^(?:.*\[\[fork\]\])/i, /^(?:.*\[\[join\]\])/i, /^(?:.*\[\[choice\]\])/i, /^(?:.*direction\s+TB[^\n]*)/i, /^(?:.*direction\s+BT[^\n]*)/i, /^(?:.*direction\s+RL[^\n]*)/i, /^(?:.*direction\s+LR[^\n]*)/i, /^(?:["])/i, /^(?:\s*as\s+)/i, /^(?:[^\n\{]*)/i, /^(?:["])/i, /^(?:[^"]*)/i, /^(?:[^\n\s\{]+)/i, /^(?:\n)/i, /^(?:\{)/i, /^(?:%%(?!\{)[^\n]*)/i, /^(?:\})/i, /^(?:[\n])/i, /^(?:note\s+)/i, /^(?:left of\b)/i, /^(?:right of\b)/i, /^(?:")/i, /^(?:\s*as\s*)/i, /^(?:["])/i, /^(?:[^"]*)/i, /^(?:[^\n]*)/i, /^(?:\s*[^:\n\s\-]+)/i, /^(?:\s*:[^:\n;]+)/i, /^(?:[\s\S]*?end note\b)/i, /^(?:stateDiagram\s+)/i, /^(?:stateDiagram-v2\s+)/i, /^(?:hide empty description\b)/i, /^(?:\[\*\])/i, /^(?:[^:\n\s\-\{]+)/i, /^(?:\s*:(?:[^:\n;]|:[^:\n;])+)/i, /^(?:-->)/i, /^(?:--)/i, /^(?::::)/i, /^(?:$)/i, /^(?:.)/i],
907
+ conditions: { "LINE": { "rules": [12, 13], "inclusive": false }, "struct": { "rules": [12, 13, 25, 29, 32, 38, 45, 46, 47, 48, 57, 58, 59, 60, 74, 75, 76, 77, 78, 79], "inclusive": false }, "FLOATING_NOTE_ID": { "rules": [67], "inclusive": false }, "FLOATING_NOTE": { "rules": [64, 65, 66], "inclusive": false }, "NOTE_TEXT": { "rules": [69, 70], "inclusive": false }, "NOTE_ID": { "rules": [68], "inclusive": false }, "NOTE": { "rules": [61, 62, 63], "inclusive": false }, "STYLEDEF_STYLEOPTS": { "rules": [], "inclusive": false }, "STYLEDEF_STYLES": { "rules": [34], "inclusive": false }, "STYLE_IDS": { "rules": [], "inclusive": false }, "STYLE": { "rules": [33], "inclusive": false }, "CLASS_STYLE": { "rules": [31], "inclusive": false }, "CLASS": { "rules": [30], "inclusive": false }, "CLASSDEFID": { "rules": [28], "inclusive": false }, "CLASSDEF": { "rules": [26, 27], "inclusive": false }, "acc_descr_multiline": { "rules": [23, 24], "inclusive": false }, "acc_descr": { "rules": [21], "inclusive": false }, "acc_title": { "rules": [19], "inclusive": false }, "SCALE": { "rules": [16, 17, 36, 37], "inclusive": false }, "ALIAS": { "rules": [], "inclusive": false }, "STATE_ID": { "rules": [51], "inclusive": false }, "STATE_STRING": { "rules": [52, 53], "inclusive": false }, "FORK_STATE": { "rules": [], "inclusive": false }, "STATE": { "rules": [12, 13, 39, 40, 41, 42, 43, 44, 49, 50, 54, 55, 56], "inclusive": false }, "ID": { "rules": [12, 13], "inclusive": false }, "INITIAL": { "rules": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 14, 15, 18, 20, 22, 25, 29, 32, 35, 38, 56, 60, 71, 72, 73, 74, 75, 76, 77, 79, 80, 81], "inclusive": true } }
908
+ };
909
+ return lexer2;
910
+ }();
911
+ parser2.lexer = lexer;
912
+ function Parser() {
913
+ this.yy = {};
914
+ }
915
+ __name(Parser, "Parser");
916
+ Parser.prototype = parser2;
917
+ parser2.Parser = Parser;
918
+ return new Parser();
919
+ }();
920
+ parser.parser = parser;
921
+ var stateDiagram_default = parser;
922
+ var DEFAULT_DIAGRAM_DIRECTION = "TB";
923
+ var DEFAULT_NESTED_DOC_DIR = "TB";
924
+ var STMT_DIRECTION = "dir";
925
+ var STMT_STATE = "state";
926
+ var STMT_ROOT = "root";
927
+ var STMT_RELATION = "relation";
928
+ var STMT_CLASSDEF = "classDef";
929
+ var STMT_STYLEDEF = "style";
930
+ var STMT_APPLYCLASS = "applyClass";
931
+ var DEFAULT_STATE_TYPE = "default";
932
+ var DIVIDER_TYPE = "divider";
933
+ var G_EDGE_STYLE = "fill:none";
934
+ var G_EDGE_ARROWHEADSTYLE = "fill: #333";
935
+ var G_EDGE_LABELPOS = "c";
936
+ var G_EDGE_LABELTYPE = "markdown";
937
+ var G_EDGE_THICKNESS = "normal";
938
+ var SHAPE_STATE = "rect";
939
+ var SHAPE_STATE_WITH_DESC = "rectWithTitle";
940
+ var SHAPE_START = "stateStart";
941
+ var SHAPE_END = "stateEnd";
942
+ var SHAPE_DIVIDER = "divider";
943
+ var SHAPE_GROUP = "roundedWithTitle";
944
+ var SHAPE_NOTE = "note";
945
+ var SHAPE_NOTEGROUP = "noteGroup";
946
+ var CSS_DIAGRAM = "statediagram";
947
+ var CSS_STATE = "state";
948
+ var CSS_DIAGRAM_STATE = `${CSS_DIAGRAM}-${CSS_STATE}`;
949
+ var CSS_EDGE = "transition";
950
+ var CSS_NOTE = "note";
951
+ var CSS_NOTE_EDGE = "note-edge";
952
+ var CSS_EDGE_NOTE_EDGE = `${CSS_EDGE} ${CSS_NOTE_EDGE}`;
953
+ var CSS_DIAGRAM_NOTE = `${CSS_DIAGRAM}-${CSS_NOTE}`;
954
+ var CSS_CLUSTER = "cluster";
955
+ var CSS_DIAGRAM_CLUSTER = `${CSS_DIAGRAM}-${CSS_CLUSTER}`;
956
+ var CSS_CLUSTER_ALT = "cluster-alt";
957
+ var CSS_DIAGRAM_CLUSTER_ALT = `${CSS_DIAGRAM}-${CSS_CLUSTER_ALT}`;
958
+ var PARENT = "parent";
959
+ var NOTE = "note";
960
+ var DOMID_STATE = "state";
961
+ var DOMID_TYPE_SPACER = "----";
962
+ var NOTE_ID = `${DOMID_TYPE_SPACER}${NOTE}`;
963
+ var PARENT_ID = `${DOMID_TYPE_SPACER}${PARENT}`;
964
+ var getDir = /* @__PURE__ */ __name((parsedItem, defaultDir = DEFAULT_NESTED_DOC_DIR) => {
965
+ if (!parsedItem.doc) {
966
+ return defaultDir;
967
+ }
968
+ let dir = defaultDir;
969
+ for (const parsedItemDoc of parsedItem.doc) {
970
+ if (parsedItemDoc.stmt === "dir") {
971
+ dir = parsedItemDoc.value;
972
+ }
973
+ }
974
+ return dir;
975
+ }, "getDir");
976
+ var getClasses = /* @__PURE__ */ __name(function(text, diagramObj) {
977
+ return diagramObj.db.getClasses();
978
+ }, "getClasses");
979
+ var draw = /* @__PURE__ */ __name(async function(text, id, _version, diag) {
980
+ log.info("REF0:");
981
+ log.info("Drawing state diagram (v2)", id);
982
+ const { securityLevel, state: conf, layout } = getConfig2();
983
+ diag.db.extract(diag.db.getRootDocV2());
984
+ const data4Layout = diag.db.getData();
985
+ const svg = getDiagramElement(id, securityLevel);
986
+ data4Layout.type = diag.type;
987
+ data4Layout.layoutAlgorithm = layout;
988
+ data4Layout.nodeSpacing = conf?.nodeSpacing || 50;
989
+ data4Layout.rankSpacing = conf?.rankSpacing || 50;
990
+ const config = getConfig2();
991
+ if (config.look === "neo") {
992
+ data4Layout.markers = ["barbNeo"];
993
+ } else {
994
+ data4Layout.markers = ["barb"];
995
+ }
996
+ data4Layout.diagramId = id;
997
+ await render(data4Layout, svg);
998
+ const padding = 8;
999
+ try {
1000
+ const links = typeof diag.db.getLinks === "function" ? diag.db.getLinks() : /* @__PURE__ */ new Map();
1001
+ links.forEach((linkInfo, key) => {
1002
+ const stateId = typeof key === "string" ? key : typeof key?.id === "string" ? key.id : "";
1003
+ if (!stateId) {
1004
+ log.warn("\u26A0\uFE0F Invalid or missing stateId from key:", JSON.stringify(key));
1005
+ return;
1006
+ }
1007
+ const allNodes = svg.node()?.querySelectorAll("g");
1008
+ let matchedElem;
1009
+ allNodes?.forEach((g) => {
1010
+ const text2 = g.textContent?.trim();
1011
+ if (text2 === stateId) {
1012
+ matchedElem = g;
1013
+ }
1014
+ });
1015
+ if (!matchedElem) {
1016
+ log.warn("\u26A0\uFE0F Could not find node matching text:", stateId);
1017
+ return;
1018
+ }
1019
+ const parent = matchedElem.parentNode;
1020
+ if (!parent) {
1021
+ log.warn("\u26A0\uFE0F Node has no parent, cannot wrap:", stateId);
1022
+ return;
1023
+ }
1024
+ const a = document.createElementNS("http://www.w3.org/2000/svg", "a");
1025
+ const cleanedUrl = linkInfo.url.replace(/^"+|"+$/g, "");
1026
+ a.setAttributeNS("http://www.w3.org/1999/xlink", "xlink:href", cleanedUrl);
1027
+ a.setAttribute("target", "_blank");
1028
+ if (linkInfo.tooltip) {
1029
+ const tooltip = linkInfo.tooltip.replace(/^"+|"+$/g, "");
1030
+ a.setAttribute("title", tooltip);
1031
+ }
1032
+ parent.replaceChild(a, matchedElem);
1033
+ a.appendChild(matchedElem);
1034
+ log.info("\u{1F517} Wrapped node in <a> tag for:", stateId, linkInfo.url);
1035
+ });
1036
+ } catch (err) {
1037
+ log.error("\u274C Error injecting clickable links:", err);
1038
+ }
1039
+ utils_default.insertTitle(
1040
+ svg,
1041
+ "statediagramTitleText",
1042
+ conf?.titleTopMargin ?? 25,
1043
+ diag.db.getDiagramTitle()
1044
+ );
1045
+ setupViewPortForSVG(svg, padding, CSS_DIAGRAM, conf?.useMaxWidth ?? true);
1046
+ }, "draw");
1047
+ var stateRenderer_v3_unified_default = {
1048
+ getClasses,
1049
+ draw,
1050
+ getDir
1051
+ };
1052
+ var nodeDb = /* @__PURE__ */ new Map();
1053
+ var graphItemCount = 0;
1054
+ function stateDomId(itemId = "", counter = 0, type = "", typeSpacer = DOMID_TYPE_SPACER) {
1055
+ const typeStr = type !== null && type.length > 0 ? `${typeSpacer}${type}` : "";
1056
+ return `${DOMID_STATE}-${itemId}${typeStr}-${counter}`;
1057
+ }
1058
+ __name(stateDomId, "stateDomId");
1059
+ var setupDoc = /* @__PURE__ */ __name((parentParsedItem, doc, diagramStates, nodes, edges, altFlag, look, classes) => {
1060
+ log.trace("items", doc);
1061
+ doc.forEach((item) => {
1062
+ switch (item.stmt) {
1063
+ case STMT_STATE:
1064
+ dataFetcher(parentParsedItem, item, diagramStates, nodes, edges, altFlag, look, classes);
1065
+ break;
1066
+ case DEFAULT_STATE_TYPE:
1067
+ dataFetcher(parentParsedItem, item, diagramStates, nodes, edges, altFlag, look, classes);
1068
+ break;
1069
+ case STMT_RELATION:
1070
+ {
1071
+ dataFetcher(
1072
+ parentParsedItem,
1073
+ item.state1,
1074
+ diagramStates,
1075
+ nodes,
1076
+ edges,
1077
+ altFlag,
1078
+ look,
1079
+ classes
1080
+ );
1081
+ dataFetcher(
1082
+ parentParsedItem,
1083
+ item.state2,
1084
+ diagramStates,
1085
+ nodes,
1086
+ edges,
1087
+ altFlag,
1088
+ look,
1089
+ classes
1090
+ );
1091
+ const isNeo = look === "neo";
1092
+ const edgeData = {
1093
+ id: "edge" + graphItemCount,
1094
+ start: item.state1.id,
1095
+ end: item.state2.id,
1096
+ arrowhead: "normal",
1097
+ arrowTypeEnd: isNeo ? "arrow_barb_neo" : "arrow_barb",
1098
+ style: G_EDGE_STYLE,
1099
+ labelStyle: "",
1100
+ label: common_default.sanitizeText(item.description ?? "", getConfig2()),
1101
+ arrowheadStyle: G_EDGE_ARROWHEADSTYLE,
1102
+ labelpos: G_EDGE_LABELPOS,
1103
+ labelType: G_EDGE_LABELTYPE,
1104
+ thickness: G_EDGE_THICKNESS,
1105
+ classes: CSS_EDGE,
1106
+ look
1107
+ };
1108
+ edges.push(edgeData);
1109
+ graphItemCount++;
1110
+ }
1111
+ break;
1112
+ }
1113
+ });
1114
+ }, "setupDoc");
1115
+ var getDir2 = /* @__PURE__ */ __name((parsedItem, defaultDir = DEFAULT_NESTED_DOC_DIR) => {
1116
+ let dir = defaultDir;
1117
+ if (parsedItem.doc) {
1118
+ for (const parsedItemDoc of parsedItem.doc) {
1119
+ if (parsedItemDoc.stmt === "dir") {
1120
+ dir = parsedItemDoc.value;
1121
+ }
1122
+ }
1123
+ }
1124
+ return dir;
1125
+ }, "getDir");
1126
+ function insertOrUpdateNode(nodes, nodeData, classes) {
1127
+ if (!nodeData.id || nodeData.id === "</join></fork>" || nodeData.id === "</choice>") {
1128
+ return;
1129
+ }
1130
+ if (nodeData.cssClasses) {
1131
+ if (!Array.isArray(nodeData.cssCompiledStyles)) {
1132
+ nodeData.cssCompiledStyles = [];
1133
+ }
1134
+ nodeData.cssClasses.split(" ").forEach((cssClass) => {
1135
+ const classDef = classes.get(cssClass);
1136
+ if (classDef) {
1137
+ nodeData.cssCompiledStyles = [...nodeData.cssCompiledStyles ?? [], ...classDef.styles];
1138
+ }
1139
+ });
1140
+ }
1141
+ const existingNodeData = nodes.find((node) => node.id === nodeData.id);
1142
+ if (existingNodeData) {
1143
+ Object.assign(existingNodeData, nodeData);
1144
+ } else {
1145
+ nodes.push(nodeData);
1146
+ }
1147
+ }
1148
+ __name(insertOrUpdateNode, "insertOrUpdateNode");
1149
+ function getClassesFromDbInfo(dbInfoItem) {
1150
+ return dbInfoItem?.classes?.join(" ") ?? "";
1151
+ }
1152
+ __name(getClassesFromDbInfo, "getClassesFromDbInfo");
1153
+ function getStylesFromDbInfo(dbInfoItem) {
1154
+ return dbInfoItem?.styles ?? [];
1155
+ }
1156
+ __name(getStylesFromDbInfo, "getStylesFromDbInfo");
1157
+ var dataFetcher = /* @__PURE__ */ __name((parent, parsedItem, diagramStates, nodes, edges, altFlag, look, classes) => {
1158
+ const itemId = parsedItem.id;
1159
+ const dbState = diagramStates.get(itemId);
1160
+ const classStr = getClassesFromDbInfo(dbState);
1161
+ const style = getStylesFromDbInfo(dbState);
1162
+ const config = getConfig2();
1163
+ log.info("dataFetcher parsedItem", parsedItem, dbState, style);
1164
+ if (itemId !== "root") {
1165
+ let shape = SHAPE_STATE;
1166
+ if (parsedItem.start === true) {
1167
+ shape = SHAPE_START;
1168
+ } else if (parsedItem.start === false) {
1169
+ shape = SHAPE_END;
1170
+ }
1171
+ if (parsedItem.type !== DEFAULT_STATE_TYPE) {
1172
+ shape = parsedItem.type;
1173
+ }
1174
+ if (!nodeDb.get(itemId)) {
1175
+ nodeDb.set(itemId, {
1176
+ id: itemId,
1177
+ shape,
1178
+ description: common_default.sanitizeText(itemId, config),
1179
+ cssClasses: `${classStr} ${CSS_DIAGRAM_STATE}`,
1180
+ cssStyles: style
1181
+ });
1182
+ }
1183
+ const newNode = nodeDb.get(itemId);
1184
+ if (parsedItem.description) {
1185
+ if (Array.isArray(newNode.description)) {
1186
+ newNode.shape = SHAPE_STATE_WITH_DESC;
1187
+ newNode.description.push(parsedItem.description);
1188
+ } else {
1189
+ if (newNode.description?.length && newNode.description.length > 0) {
1190
+ newNode.shape = SHAPE_STATE_WITH_DESC;
1191
+ if (newNode.description === itemId) {
1192
+ newNode.description = [parsedItem.description];
1193
+ } else {
1194
+ newNode.description = [newNode.description, parsedItem.description];
1195
+ }
1196
+ } else {
1197
+ newNode.shape = SHAPE_STATE;
1198
+ newNode.description = parsedItem.description;
1199
+ }
1200
+ }
1201
+ newNode.description = common_default.sanitizeTextOrArray(newNode.description, config);
1202
+ }
1203
+ if (newNode.description?.length === 1 && newNode.shape === SHAPE_STATE_WITH_DESC) {
1204
+ if (newNode.type === "group") {
1205
+ newNode.shape = SHAPE_GROUP;
1206
+ } else {
1207
+ newNode.shape = SHAPE_STATE;
1208
+ }
1209
+ }
1210
+ if (!newNode.type && parsedItem.doc) {
1211
+ log.info("Setting cluster for XCX", itemId, getDir2(parsedItem));
1212
+ newNode.type = "group";
1213
+ newNode.isGroup = true;
1214
+ newNode.dir = getDir2(parsedItem);
1215
+ newNode.shape = parsedItem.type === DIVIDER_TYPE ? SHAPE_DIVIDER : SHAPE_GROUP;
1216
+ newNode.cssClasses = `${newNode.cssClasses} ${CSS_DIAGRAM_CLUSTER} ${altFlag ? CSS_DIAGRAM_CLUSTER_ALT : ""}`;
1217
+ }
1218
+ const nodeData = {
1219
+ labelStyle: "",
1220
+ shape: newNode.shape,
1221
+ label: newNode.description,
1222
+ cssClasses: newNode.cssClasses,
1223
+ cssCompiledStyles: [],
1224
+ cssStyles: newNode.cssStyles,
1225
+ id: itemId,
1226
+ dir: newNode.dir,
1227
+ domId: stateDomId(itemId, graphItemCount),
1228
+ type: newNode.type,
1229
+ isGroup: newNode.type === "group",
1230
+ padding: 8,
1231
+ rx: 10,
1232
+ ry: 10,
1233
+ look,
1234
+ labelType: "markdown"
1235
+ };
1236
+ if (nodeData.shape === SHAPE_DIVIDER) {
1237
+ nodeData.label = "";
1238
+ }
1239
+ if (parent && parent.id !== "root") {
1240
+ log.trace("Setting node ", itemId, " to be child of its parent ", parent.id);
1241
+ nodeData.parentId = parent.id;
1242
+ }
1243
+ nodeData.centerLabel = true;
1244
+ if (parsedItem.note) {
1245
+ const noteData = {
1246
+ labelStyle: "",
1247
+ shape: SHAPE_NOTE,
1248
+ label: parsedItem.note.text,
1249
+ labelType: "markdown",
1250
+ cssClasses: CSS_DIAGRAM_NOTE,
1251
+ // useHtmlLabels: false,
1252
+ cssStyles: [],
1253
+ cssCompiledStyles: [],
1254
+ id: itemId + NOTE_ID + "-" + graphItemCount,
1255
+ domId: stateDomId(itemId, graphItemCount, NOTE),
1256
+ type: newNode.type,
1257
+ isGroup: newNode.type === "group",
1258
+ padding: config.flowchart?.padding,
1259
+ look,
1260
+ position: parsedItem.note.position
1261
+ };
1262
+ const parentNodeId = itemId + PARENT_ID;
1263
+ const groupData = {
1264
+ labelStyle: "",
1265
+ shape: SHAPE_NOTEGROUP,
1266
+ label: parsedItem.note.text,
1267
+ cssClasses: newNode.cssClasses,
1268
+ cssStyles: [],
1269
+ id: itemId + PARENT_ID,
1270
+ domId: stateDomId(itemId, graphItemCount, PARENT),
1271
+ type: "group",
1272
+ isGroup: true,
1273
+ padding: 16,
1274
+ //getConfig().flowchart.padding
1275
+ look,
1276
+ position: parsedItem.note.position
1277
+ };
1278
+ graphItemCount++;
1279
+ groupData.id = parentNodeId;
1280
+ noteData.parentId = parentNodeId;
1281
+ insertOrUpdateNode(nodes, groupData, classes);
1282
+ insertOrUpdateNode(nodes, noteData, classes);
1283
+ insertOrUpdateNode(nodes, nodeData, classes);
1284
+ let from = itemId;
1285
+ let to = noteData.id;
1286
+ if (parsedItem.note.position === "left of") {
1287
+ from = noteData.id;
1288
+ to = itemId;
1289
+ }
1290
+ edges.push({
1291
+ id: from + "-" + to,
1292
+ start: from,
1293
+ end: to,
1294
+ arrowhead: "none",
1295
+ arrowTypeEnd: "",
1296
+ style: G_EDGE_STYLE,
1297
+ labelStyle: "",
1298
+ classes: CSS_EDGE_NOTE_EDGE,
1299
+ arrowheadStyle: G_EDGE_ARROWHEADSTYLE,
1300
+ labelpos: G_EDGE_LABELPOS,
1301
+ labelType: G_EDGE_LABELTYPE,
1302
+ thickness: G_EDGE_THICKNESS,
1303
+ look
1304
+ });
1305
+ } else {
1306
+ insertOrUpdateNode(nodes, nodeData, classes);
1307
+ }
1308
+ }
1309
+ if (parsedItem.doc) {
1310
+ log.trace("Adding nodes children ");
1311
+ setupDoc(parsedItem, parsedItem.doc, diagramStates, nodes, edges, !altFlag, look, classes);
1312
+ }
1313
+ }, "dataFetcher");
1314
+ var reset = /* @__PURE__ */ __name(() => {
1315
+ nodeDb.clear();
1316
+ graphItemCount = 0;
1317
+ }, "reset");
1318
+ var CONSTANTS = {
1319
+ START_NODE: "[*]",
1320
+ START_TYPE: "start",
1321
+ END_NODE: "[*]",
1322
+ END_TYPE: "end",
1323
+ COLOR_KEYWORD: "color",
1324
+ FILL_KEYWORD: "fill",
1325
+ BG_FILL: "bgFill",
1326
+ STYLECLASS_SEP: ","
1327
+ };
1328
+ var newClassesList = /* @__PURE__ */ __name(() => /* @__PURE__ */ new Map(), "newClassesList");
1329
+ var newDoc = /* @__PURE__ */ __name(() => ({
1330
+ relations: [],
1331
+ states: /* @__PURE__ */ new Map(),
1332
+ documents: {}
1333
+ }), "newDoc");
1334
+ var clone = /* @__PURE__ */ __name((o) => JSON.parse(JSON.stringify(o)), "clone");
1335
+ var StateDB = class {
1336
+ constructor(version) {
1337
+ this.version = version;
1338
+ this.nodes = [];
1339
+ this.edges = [];
1340
+ this.rootDoc = [];
1341
+ this.classes = newClassesList();
1342
+ this.documents = { root: newDoc() };
1343
+ this.currentDocument = this.documents.root;
1344
+ this.startEndCount = 0;
1345
+ this.dividerCnt = 0;
1346
+ this.links = /* @__PURE__ */ new Map();
1347
+ this.getAccTitle = getAccTitle;
1348
+ this.setAccTitle = setAccTitle;
1349
+ this.getAccDescription = getAccDescription;
1350
+ this.setAccDescription = setAccDescription;
1351
+ this.setDiagramTitle = setDiagramTitle;
1352
+ this.getDiagramTitle = getDiagramTitle;
1353
+ this.clear();
1354
+ this.setRootDoc = this.setRootDoc.bind(this);
1355
+ this.getDividerId = this.getDividerId.bind(this);
1356
+ this.setDirection = this.setDirection.bind(this);
1357
+ this.trimColon = this.trimColon.bind(this);
1358
+ }
1359
+ static {
1360
+ __name(this, "StateDB");
1361
+ }
1362
+ static {
1363
+ this.relationType = {
1364
+ AGGREGATION: 0,
1365
+ EXTENSION: 1,
1366
+ COMPOSITION: 2,
1367
+ DEPENDENCY: 3
1368
+ };
1369
+ }
1370
+ /**
1371
+ * Convert all of the statements (stmts) that were parsed into states and relationships.
1372
+ * This is done because a state diagram may have nested sections,
1373
+ * where each section is a 'document' and has its own set of statements.
1374
+ * Ex: the section within a fork has its own statements, and incoming and outgoing statements
1375
+ * refer to the fork as a whole (document).
1376
+ * See the parser grammar: the definition of a document is a document then a 'line', where a line can be a statement.
1377
+ * This will push the statement into the list of statements for the current document.
1378
+ */
1379
+ extract(statements) {
1380
+ this.clear(true);
1381
+ for (const item of Array.isArray(statements) ? statements : statements.doc) {
1382
+ switch (item.stmt) {
1383
+ case STMT_STATE:
1384
+ this.addState(item.id.trim(), item.type, item.doc, item.description, item.note);
1385
+ break;
1386
+ case STMT_RELATION:
1387
+ this.addRelation(item.state1, item.state2, item.description);
1388
+ break;
1389
+ case STMT_CLASSDEF:
1390
+ this.addStyleClass(item.id.trim(), item.classes);
1391
+ break;
1392
+ case STMT_STYLEDEF:
1393
+ this.handleStyleDef(item);
1394
+ break;
1395
+ case STMT_APPLYCLASS:
1396
+ this.setCssClass(item.id.trim(), item.styleClass);
1397
+ break;
1398
+ case "click":
1399
+ this.addLink(item.id, item.url, item.tooltip);
1400
+ break;
1401
+ }
1402
+ }
1403
+ const diagramStates = this.getStates();
1404
+ const config = getConfig2();
1405
+ reset();
1406
+ dataFetcher(
1407
+ void 0,
1408
+ this.getRootDocV2(),
1409
+ diagramStates,
1410
+ this.nodes,
1411
+ this.edges,
1412
+ true,
1413
+ config.look,
1414
+ this.classes
1415
+ );
1416
+ for (const node of this.nodes) {
1417
+ if (!Array.isArray(node.label)) {
1418
+ continue;
1419
+ }
1420
+ node.description = node.label.slice(1);
1421
+ if (node.isGroup && node.description.length > 0) {
1422
+ throw new Error(
1423
+ `Group nodes can only have label. Remove the additional description for node [${node.id}]`
1424
+ );
1425
+ }
1426
+ node.label = node.label[0];
1427
+ }
1428
+ }
1429
+ handleStyleDef(item) {
1430
+ const ids = item.id.trim().split(",");
1431
+ const styles = item.styleClass.split(",");
1432
+ for (const id of ids) {
1433
+ let state = this.getState(id);
1434
+ if (!state) {
1435
+ const trimmedId = id.trim();
1436
+ this.addState(trimmedId);
1437
+ state = this.getState(trimmedId);
1438
+ }
1439
+ if (state) {
1440
+ state.styles = styles.map((s) => s.replace(/;/g, "")?.trim());
1441
+ }
1442
+ }
1443
+ }
1444
+ setRootDoc(o) {
1445
+ log.info("Setting root doc", o);
1446
+ this.rootDoc = o;
1447
+ if (this.version === 1) {
1448
+ this.extract(o);
1449
+ } else {
1450
+ this.extract(this.getRootDocV2());
1451
+ }
1452
+ }
1453
+ docTranslator(parent, node, first) {
1454
+ if (node.stmt === STMT_RELATION) {
1455
+ this.docTranslator(parent, node.state1, true);
1456
+ this.docTranslator(parent, node.state2, false);
1457
+ return;
1458
+ }
1459
+ if (node.stmt === STMT_STATE) {
1460
+ if (node.id === CONSTANTS.START_NODE) {
1461
+ node.id = parent.id + (first ? "_start" : "_end");
1462
+ node.start = first;
1463
+ } else {
1464
+ node.id = node.id.trim();
1465
+ }
1466
+ }
1467
+ if (node.stmt !== STMT_ROOT && node.stmt !== STMT_STATE || !node.doc) {
1468
+ return;
1469
+ }
1470
+ const doc = [];
1471
+ let currentDoc = [];
1472
+ for (const stmt of node.doc) {
1473
+ if (stmt.type === DIVIDER_TYPE) {
1474
+ const newNode = clone(stmt);
1475
+ newNode.doc = clone(currentDoc);
1476
+ doc.push(newNode);
1477
+ currentDoc = [];
1478
+ } else {
1479
+ currentDoc.push(stmt);
1480
+ }
1481
+ }
1482
+ if (doc.length > 0 && currentDoc.length > 0) {
1483
+ const newNode = {
1484
+ stmt: STMT_STATE,
1485
+ id: generateId(),
1486
+ type: "divider",
1487
+ doc: clone(currentDoc)
1488
+ };
1489
+ doc.push(clone(newNode));
1490
+ node.doc = doc;
1491
+ }
1492
+ node.doc.forEach((docNode) => this.docTranslator(node, docNode, true));
1493
+ }
1494
+ getRootDocV2() {
1495
+ this.docTranslator(
1496
+ { id: STMT_ROOT, stmt: STMT_ROOT },
1497
+ { id: STMT_ROOT, stmt: STMT_ROOT, doc: this.rootDoc },
1498
+ true
1499
+ );
1500
+ return { id: STMT_ROOT, doc: this.rootDoc };
1501
+ }
1502
+ /**
1503
+ * Function called by parser when a node definition has been found.
1504
+ *
1505
+ * @param descr - description for the state. Can be a string or a list or strings
1506
+ * @param classes - class styles to apply to this state. Can be a string (1 style) or an array of styles. If it's just 1 class, convert it to an array of that 1 class.
1507
+ * @param styles - styles to apply to this state. Can be a string (1 style) or an array of styles. If it's just 1 style, convert it to an array of that 1 style.
1508
+ * @param textStyles - text styles to apply to this state. Can be a string (1 text test) or an array of text styles. If it's just 1 text style, convert it to an array of that 1 text style.
1509
+ */
1510
+ addState(id, type = DEFAULT_STATE_TYPE, doc = void 0, descr = void 0, note = void 0, classes = void 0, styles = void 0, textStyles = void 0) {
1511
+ const trimmedId = id?.trim();
1512
+ if (!this.currentDocument.states.has(trimmedId)) {
1513
+ log.info("Adding state ", trimmedId, descr);
1514
+ this.currentDocument.states.set(trimmedId, {
1515
+ stmt: STMT_STATE,
1516
+ id: trimmedId,
1517
+ descriptions: [],
1518
+ type,
1519
+ doc,
1520
+ note,
1521
+ classes: [],
1522
+ styles: [],
1523
+ textStyles: []
1524
+ });
1525
+ } else {
1526
+ const state = this.currentDocument.states.get(trimmedId);
1527
+ if (!state) {
1528
+ throw new Error(`State not found: ${trimmedId}`);
1529
+ }
1530
+ if (!state.doc) {
1531
+ state.doc = doc;
1532
+ }
1533
+ if (!state.type) {
1534
+ state.type = type;
1535
+ }
1536
+ }
1537
+ if (descr) {
1538
+ log.info("Setting state description", trimmedId, descr);
1539
+ const descriptions = Array.isArray(descr) ? descr : [descr];
1540
+ descriptions.forEach((des) => this.addDescription(trimmedId, des.trim()));
1541
+ }
1542
+ if (note) {
1543
+ const doc2 = this.currentDocument.states.get(trimmedId);
1544
+ if (!doc2) {
1545
+ throw new Error(`State not found: ${trimmedId}`);
1546
+ }
1547
+ doc2.note = note;
1548
+ doc2.note.text = common_default.sanitizeText(doc2.note.text, getConfig2());
1549
+ }
1550
+ if (classes) {
1551
+ log.info("Setting state classes", trimmedId, classes);
1552
+ const classesList = Array.isArray(classes) ? classes : [classes];
1553
+ classesList.forEach((cssClass) => this.setCssClass(trimmedId, cssClass.trim()));
1554
+ }
1555
+ if (styles) {
1556
+ log.info("Setting state styles", trimmedId, styles);
1557
+ const stylesList = Array.isArray(styles) ? styles : [styles];
1558
+ stylesList.forEach((style) => this.setStyle(trimmedId, style.trim()));
1559
+ }
1560
+ if (textStyles) {
1561
+ log.info("Setting state styles", trimmedId, styles);
1562
+ const textStylesList = Array.isArray(textStyles) ? textStyles : [textStyles];
1563
+ textStylesList.forEach((textStyle) => this.setTextStyle(trimmedId, textStyle.trim()));
1564
+ }
1565
+ }
1566
+ clear(saveCommon) {
1567
+ this.nodes = [];
1568
+ this.edges = [];
1569
+ this.documents = { root: newDoc() };
1570
+ this.currentDocument = this.documents.root;
1571
+ this.startEndCount = 0;
1572
+ this.classes = newClassesList();
1573
+ if (!saveCommon) {
1574
+ this.links = /* @__PURE__ */ new Map();
1575
+ clear();
1576
+ }
1577
+ }
1578
+ getState(id) {
1579
+ return this.currentDocument.states.get(id);
1580
+ }
1581
+ getStates() {
1582
+ return this.currentDocument.states;
1583
+ }
1584
+ logDocuments() {
1585
+ log.info("Documents = ", this.documents);
1586
+ }
1587
+ getRelations() {
1588
+ return this.currentDocument.relations;
1589
+ }
1590
+ /**
1591
+ * Adds a clickable link to a state.
1592
+ */
1593
+ addLink(stateId, url, tooltip) {
1594
+ this.links.set(stateId, { url, tooltip });
1595
+ log.warn("Adding link", stateId, url, tooltip);
1596
+ }
1597
+ /**
1598
+ * Get all registered links.
1599
+ */
1600
+ getLinks() {
1601
+ return this.links;
1602
+ }
1603
+ /**
1604
+ * If the id is a start node ( [*] ), then return a new id constructed from
1605
+ * the start node name and the current start node count.
1606
+ * else return the given id
1607
+ */
1608
+ startIdIfNeeded(id = "") {
1609
+ if (id === CONSTANTS.START_NODE) {
1610
+ this.startEndCount++;
1611
+ return `${CONSTANTS.START_TYPE}${this.startEndCount}`;
1612
+ }
1613
+ return id;
1614
+ }
1615
+ /**
1616
+ * If the id is a start node ( [*] ), then return the start type ('start')
1617
+ * else return the given type
1618
+ */
1619
+ startTypeIfNeeded(id = "", type = DEFAULT_STATE_TYPE) {
1620
+ return id === CONSTANTS.START_NODE ? CONSTANTS.START_TYPE : type;
1621
+ }
1622
+ /**
1623
+ * If the id is an end node ( [*] ), then return a new id constructed from
1624
+ * the end node name and the current start_end node count.
1625
+ * else return the given id
1626
+ */
1627
+ endIdIfNeeded(id = "") {
1628
+ if (id === CONSTANTS.END_NODE) {
1629
+ this.startEndCount++;
1630
+ return `${CONSTANTS.END_TYPE}${this.startEndCount}`;
1631
+ }
1632
+ return id;
1633
+ }
1634
+ /**
1635
+ * If the id is an end node ( [*] ), then return the end type
1636
+ * else return the given type
1637
+ *
1638
+ */
1639
+ endTypeIfNeeded(id = "", type = DEFAULT_STATE_TYPE) {
1640
+ return id === CONSTANTS.END_NODE ? CONSTANTS.END_TYPE : type;
1641
+ }
1642
+ addRelationObjs(item1, item2, relationTitle = "") {
1643
+ const id1 = this.startIdIfNeeded(item1.id.trim());
1644
+ const type1 = this.startTypeIfNeeded(item1.id.trim(), item1.type);
1645
+ const id2 = this.startIdIfNeeded(item2.id.trim());
1646
+ const type2 = this.startTypeIfNeeded(item2.id.trim(), item2.type);
1647
+ this.addState(
1648
+ id1,
1649
+ type1,
1650
+ item1.doc,
1651
+ item1.description,
1652
+ item1.note,
1653
+ item1.classes,
1654
+ item1.styles,
1655
+ item1.textStyles
1656
+ );
1657
+ this.addState(
1658
+ id2,
1659
+ type2,
1660
+ item2.doc,
1661
+ item2.description,
1662
+ item2.note,
1663
+ item2.classes,
1664
+ item2.styles,
1665
+ item2.textStyles
1666
+ );
1667
+ this.currentDocument.relations.push({
1668
+ id1,
1669
+ id2,
1670
+ relationTitle: common_default.sanitizeText(relationTitle, getConfig2())
1671
+ });
1672
+ }
1673
+ /**
1674
+ * Add a relation between two items. The items may be full objects or just the string id of a state.
1675
+ */
1676
+ addRelation(item1, item2, title) {
1677
+ if (typeof item1 === "object" && typeof item2 === "object") {
1678
+ this.addRelationObjs(item1, item2, title);
1679
+ } else if (typeof item1 === "string" && typeof item2 === "string") {
1680
+ const id1 = this.startIdIfNeeded(item1.trim());
1681
+ const type1 = this.startTypeIfNeeded(item1);
1682
+ const id2 = this.endIdIfNeeded(item2.trim());
1683
+ const type2 = this.endTypeIfNeeded(item2);
1684
+ this.addState(id1, type1);
1685
+ this.addState(id2, type2);
1686
+ this.currentDocument.relations.push({
1687
+ id1,
1688
+ id2,
1689
+ relationTitle: title ? common_default.sanitizeText(title, getConfig2()) : void 0
1690
+ });
1691
+ }
1692
+ }
1693
+ addDescription(id, descr) {
1694
+ const theState = this.currentDocument.states.get(id);
1695
+ const _descr = descr.startsWith(":") ? descr.replace(":", "").trim() : descr;
1696
+ theState?.descriptions?.push(common_default.sanitizeText(_descr, getConfig2()));
1697
+ }
1698
+ cleanupLabel(label) {
1699
+ return label.startsWith(":") ? label.slice(2).trim() : label.trim();
1700
+ }
1701
+ getDividerId() {
1702
+ this.dividerCnt++;
1703
+ return `divider-id-${this.dividerCnt}`;
1704
+ }
1705
+ /**
1706
+ * Called when the parser comes across a (style) class definition
1707
+ * @example classDef my-style fill:#f96;
1708
+ *
1709
+ * @param id - the id of this (style) class
1710
+ * @param styleAttributes - the string with 1 or more style attributes (each separated by a comma)
1711
+ */
1712
+ addStyleClass(id, styleAttributes = "") {
1713
+ if (!this.classes.has(id)) {
1714
+ this.classes.set(id, { id, styles: [], textStyles: [] });
1715
+ }
1716
+ const foundClass = this.classes.get(id);
1717
+ if (styleAttributes && foundClass) {
1718
+ styleAttributes.split(CONSTANTS.STYLECLASS_SEP).forEach((attrib) => {
1719
+ const fixedAttrib = attrib.replace(/([^;]*);/, "$1").trim();
1720
+ if (RegExp(CONSTANTS.COLOR_KEYWORD).exec(attrib)) {
1721
+ const newStyle1 = fixedAttrib.replace(CONSTANTS.FILL_KEYWORD, CONSTANTS.BG_FILL);
1722
+ const newStyle2 = newStyle1.replace(CONSTANTS.COLOR_KEYWORD, CONSTANTS.FILL_KEYWORD);
1723
+ foundClass.textStyles.push(newStyle2);
1724
+ }
1725
+ foundClass.styles.push(fixedAttrib);
1726
+ });
1727
+ }
1728
+ }
1729
+ getClasses() {
1730
+ return this.classes;
1731
+ }
1732
+ /**
1733
+ * Add a (style) class or css class to a state with the given id.
1734
+ * If the state isn't already in the list of known states, add it.
1735
+ * Might be called by parser when a style class or CSS class should be applied to a state
1736
+ *
1737
+ * @param itemIds - The id or a list of ids of the item(s) to apply the css class to
1738
+ * @param cssClassName - CSS class name
1739
+ */
1740
+ setCssClass(itemIds, cssClassName) {
1741
+ itemIds.split(",").forEach((id) => {
1742
+ let foundState = this.getState(id);
1743
+ if (!foundState) {
1744
+ const trimmedId = id.trim();
1745
+ this.addState(trimmedId);
1746
+ foundState = this.getState(trimmedId);
1747
+ }
1748
+ foundState?.classes?.push(cssClassName);
1749
+ });
1750
+ }
1751
+ /**
1752
+ * Add a style to a state with the given id.
1753
+ * @example style stateId fill:#f9f,stroke:#333,stroke-width:4px
1754
+ * where 'style' is the keyword
1755
+ * stateId is the id of a state
1756
+ * the rest of the string is the styleText (all of the attributes to be applied to the state)
1757
+ *
1758
+ * @param itemId - The id of item to apply the style to
1759
+ * @param styleText - the text of the attributes for the style
1760
+ */
1761
+ setStyle(itemId, styleText) {
1762
+ this.getState(itemId)?.styles?.push(styleText);
1763
+ }
1764
+ /**
1765
+ * Add a text style to a state with the given id
1766
+ *
1767
+ * @param itemId - The id of item to apply the css class to
1768
+ * @param cssClassName - CSS class name
1769
+ */
1770
+ setTextStyle(itemId, cssClassName) {
1771
+ this.getState(itemId)?.textStyles?.push(cssClassName);
1772
+ }
1773
+ /**
1774
+ * Finds the direction statement in the root document.
1775
+ * @returns the direction statement if present
1776
+ */
1777
+ getDirectionStatement() {
1778
+ return this.rootDoc.find((doc) => doc.stmt === STMT_DIRECTION);
1779
+ }
1780
+ getDirection() {
1781
+ return this.getDirectionStatement()?.value ?? DEFAULT_DIAGRAM_DIRECTION;
1782
+ }
1783
+ setDirection(dir) {
1784
+ const doc = this.getDirectionStatement();
1785
+ if (doc) {
1786
+ doc.value = dir;
1787
+ } else {
1788
+ this.rootDoc.unshift({ stmt: STMT_DIRECTION, value: dir });
1789
+ }
1790
+ }
1791
+ trimColon(str) {
1792
+ return str.startsWith(":") ? str.slice(1).trim() : str.trim();
1793
+ }
1794
+ getData() {
1795
+ const config = getConfig2();
1796
+ return {
1797
+ nodes: this.nodes,
1798
+ edges: this.edges,
1799
+ other: {},
1800
+ config,
1801
+ direction: getDir(this.getRootDocV2())
1802
+ };
1803
+ }
1804
+ getConfig() {
1805
+ return getConfig2().state;
1806
+ }
1807
+ };
1808
+ var getStyles = /* @__PURE__ */ __name((options) => `
1809
+ defs [id$="-barbEnd"] {
1810
+ fill: ${options.transitionColor};
1811
+ stroke: ${options.transitionColor};
1812
+ }
1813
+ g.stateGroup text {
1814
+ fill: ${options.nodeBorder};
1815
+ stroke: none;
1816
+ font-size: 10px;
1817
+ }
1818
+ g.stateGroup text {
1819
+ fill: ${options.textColor};
1820
+ stroke: none;
1821
+ font-size: 10px;
1822
+
1823
+ }
1824
+ g.stateGroup .state-title {
1825
+ font-weight: bolder;
1826
+ fill: ${options.stateLabelColor};
1827
+ }
1828
+
1829
+ g.stateGroup rect {
1830
+ fill: ${options.mainBkg};
1831
+ stroke: ${options.nodeBorder};
1832
+ }
1833
+
1834
+ g.stateGroup line {
1835
+ stroke: ${options.lineColor};
1836
+ stroke-width: ${options.strokeWidth || 1};
1837
+ }
1838
+
1839
+ .transition {
1840
+ stroke: ${options.transitionColor};
1841
+ stroke-width: ${options.strokeWidth || 1};
1842
+ fill: none;
1843
+ }
1844
+
1845
+ .stateGroup .composit {
1846
+ fill: ${options.background};
1847
+ border-bottom: 1px
1848
+ }
1849
+
1850
+ .stateGroup .alt-composit {
1851
+ fill: #e0e0e0;
1852
+ border-bottom: 1px
1853
+ }
1854
+
1855
+ .state-note {
1856
+ stroke: ${options.noteBorderColor};
1857
+ fill: ${options.noteBkgColor};
1858
+
1859
+ text {
1860
+ fill: ${options.noteTextColor};
1861
+ stroke: none;
1862
+ font-size: 10px;
1863
+ }
1864
+ }
1865
+
1866
+ .stateLabel .box {
1867
+ stroke: none;
1868
+ stroke-width: 0;
1869
+ fill: ${options.mainBkg};
1870
+ opacity: 0.5;
1871
+ }
1872
+
1873
+ .edgeLabel .label rect {
1874
+ fill: ${options.labelBackgroundColor};
1875
+ opacity: 0.5;
1876
+ }
1877
+ .edgeLabel {
1878
+ background-color: ${options.edgeLabelBackground};
1879
+ p {
1880
+ background-color: ${options.edgeLabelBackground};
1881
+ }
1882
+ rect {
1883
+ opacity: 0.5;
1884
+ background-color: ${options.edgeLabelBackground};
1885
+ fill: ${options.edgeLabelBackground};
1886
+ }
1887
+ text-align: center;
1888
+ }
1889
+ .edgeLabel .label text {
1890
+ fill: ${options.transitionLabelColor || options.tertiaryTextColor};
1891
+ }
1892
+ .label div .edgeLabel {
1893
+ color: ${options.transitionLabelColor || options.tertiaryTextColor};
1894
+ }
1895
+
1896
+ .stateLabel text {
1897
+ fill: ${options.stateLabelColor};
1898
+ font-size: 10px;
1899
+ font-weight: bold;
1900
+ }
1901
+
1902
+ .node circle.state-start {
1903
+ fill: ${options.specialStateColor};
1904
+ stroke: ${options.specialStateColor};
1905
+ }
1906
+
1907
+ .node .fork-join {
1908
+ fill: ${options.specialStateColor};
1909
+ stroke: ${options.specialStateColor};
1910
+ }
1911
+
1912
+ .node circle.state-end {
1913
+ fill: ${options.innerEndBackground};
1914
+ stroke: ${options.background};
1915
+ stroke-width: 1.5
1916
+ }
1917
+ .end-state-inner {
1918
+ fill: ${options.compositeBackground || options.background};
1919
+ // stroke: ${options.background};
1920
+ stroke-width: 1.5
1921
+ }
1922
+
1923
+ .node rect {
1924
+ fill: ${options.stateBkg || options.mainBkg};
1925
+ stroke: ${options.stateBorder || options.nodeBorder};
1926
+ stroke-width: ${options.strokeWidth || 1}px;
1927
+ }
1928
+ .node polygon {
1929
+ fill: ${options.mainBkg};
1930
+ stroke: ${options.stateBorder || options.nodeBorder};;
1931
+ stroke-width: ${options.strokeWidth || 1}px;
1932
+ }
1933
+ [id$="-barbEnd"] {
1934
+ fill: ${options.lineColor};
1935
+ }
1936
+
1937
+ .statediagram-cluster rect {
1938
+ fill: ${options.compositeTitleBackground};
1939
+ stroke: ${options.stateBorder || options.nodeBorder};
1940
+ stroke-width: ${options.strokeWidth || 1}px;
1941
+ }
1942
+
1943
+ .cluster-label, .nodeLabel {
1944
+ color: ${options.stateLabelColor};
1945
+ // line-height: 1;
1946
+ }
1947
+
1948
+ .statediagram-cluster rect.outer {
1949
+ rx: 5px;
1950
+ ry: 5px;
1951
+ }
1952
+ .statediagram-state .divider {
1953
+ stroke: ${options.stateBorder || options.nodeBorder};
1954
+ }
1955
+
1956
+ .statediagram-state .title-state {
1957
+ rx: 5px;
1958
+ ry: 5px;
1959
+ }
1960
+ .statediagram-cluster.statediagram-cluster .inner {
1961
+ fill: ${options.compositeBackground || options.background};
1962
+ }
1963
+ .statediagram-cluster.statediagram-cluster-alt .inner {
1964
+ fill: ${options.altBackground ? options.altBackground : "#efefef"};
1965
+ }
1966
+
1967
+ .statediagram-cluster .inner {
1968
+ rx:0;
1969
+ ry:0;
1970
+ }
1971
+
1972
+ .statediagram-state rect.basic {
1973
+ rx: 5px;
1974
+ ry: 5px;
1975
+ }
1976
+ .statediagram-state rect.divider {
1977
+ stroke-dasharray: 10,10;
1978
+ fill: ${options.altBackground ? options.altBackground : "#efefef"};
1979
+ }
1980
+
1981
+ .note-edge {
1982
+ stroke-dasharray: 5;
1983
+ }
1984
+
1985
+ .statediagram-note rect {
1986
+ fill: ${options.noteBkgColor};
1987
+ stroke: ${options.noteBorderColor};
1988
+ stroke-width: 1px;
1989
+ rx: 0;
1990
+ ry: 0;
1991
+ }
1992
+ .statediagram-note rect {
1993
+ fill: ${options.noteBkgColor};
1994
+ stroke: ${options.noteBorderColor};
1995
+ stroke-width: 1px;
1996
+ rx: 0;
1997
+ ry: 0;
1998
+ }
1999
+
2000
+ .statediagram-note text {
2001
+ fill: ${options.noteTextColor};
2002
+ }
2003
+
2004
+ .statediagram-note .nodeLabel {
2005
+ color: ${options.noteTextColor};
2006
+ }
2007
+ .statediagram .edgeLabel {
2008
+ color: red; // ${options.noteTextColor};
2009
+ }
2010
+
2011
+ [id$="-dependencyStart"], [id$="-dependencyEnd"] {
2012
+ fill: ${options.lineColor};
2013
+ stroke: ${options.lineColor};
2014
+ stroke-width: ${options.strokeWidth || 1};
2015
+ }
2016
+
2017
+ .statediagramTitleText {
2018
+ text-anchor: middle;
2019
+ font-size: 18px;
2020
+ fill: ${options.textColor};
2021
+ }
2022
+
2023
+ [data-look="neo"].statediagram-cluster rect {
2024
+ fill: ${options.mainBkg};
2025
+ stroke: ${options.useGradient ? "url(" + options.svgId + "-gradient)" : options.stateBorder || options.nodeBorder};
2026
+ stroke-width: ${options.strokeWidth ?? 1};
2027
+ }
2028
+ [data-look="neo"].statediagram-cluster rect.outer {
2029
+ rx: ${options.radius}px;
2030
+ ry: ${options.radius}px;
2031
+ filter: ${options.dropShadow ? options.dropShadow.replace("url(#drop-shadow)", `url(${options.svgId}-drop-shadow)`) : "none"}
2032
+ }
2033
+ `, "getStyles");
2034
+ var styles_default = getStyles;
2035
+
2036
+ export {
2037
+ stateDiagram_default,
2038
+ stateRenderer_v3_unified_default,
2039
+ StateDB,
2040
+ styles_default
2041
+ };
2042
+ //# sourceMappingURL=chunk-JBUVKVPY.js.map