@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,4655 @@
1
+ import {
2
+ ImperativeState
3
+ } from "./chunk-QJVSDNAW.js";
4
+ import {
5
+ JSON_SCHEMA,
6
+ load
7
+ } from "./chunk-RBTT26R4.js";
8
+ import {
9
+ drawBackgroundRect,
10
+ drawEmbeddedImage,
11
+ drawImage,
12
+ drawRect,
13
+ getNoteRect,
14
+ getTextObj
15
+ } from "./chunk-AJQJUKMU.js";
16
+ import {
17
+ ZERO_WIDTH_SPACE,
18
+ parseFontSize,
19
+ utils_default
20
+ } from "./chunk-UVRE3R6A.js";
21
+ import {
22
+ require_dist
23
+ } from "./chunk-G3PPZWPW.js";
24
+ import {
25
+ assignWithDepth_default,
26
+ calculateMathMLDimensions,
27
+ clear,
28
+ common_default,
29
+ configureSvgSize,
30
+ getAccDescription,
31
+ getAccTitle,
32
+ getConfig,
33
+ getConfig2,
34
+ getDiagramTitle,
35
+ getUrl,
36
+ hasKatex,
37
+ renderKatexSanitized,
38
+ sanitizeText,
39
+ setAccDescription,
40
+ setAccTitle,
41
+ setConfig2,
42
+ setDiagramTitle
43
+ } from "./chunk-7NZMPQDX.js";
44
+ import "./chunk-YEU62MVS.js";
45
+ import {
46
+ __name,
47
+ log,
48
+ select_default
49
+ } from "./chunk-CZHJHAOR.js";
50
+ import {
51
+ __toESM
52
+ } from "./chunk-DI52DQAC.js";
53
+
54
+ // ../../node_modules/.pnpm/mermaid@11.14.0/node_modules/mermaid/dist/chunks/mermaid.core/sequenceDiagram-FGHM5R23.mjs
55
+ var import_sanitize_url = __toESM(require_dist(), 1);
56
+ var parser = function() {
57
+ var o = /* @__PURE__ */ __name(function(k, v, o2, l) {
58
+ for (o2 = o2 || {}, l = k.length; l--; o2[k[l]] = v) ;
59
+ return o2;
60
+ }, "o"), $V0 = [1, 2], $V1 = [1, 3], $V2 = [1, 4], $V3 = [2, 4], $V4 = [1, 9], $V5 = [1, 11], $V6 = [1, 12], $V7 = [1, 14], $V8 = [1, 15], $V9 = [1, 17], $Va = [1, 18], $Vb = [1, 19], $Vc = [1, 25], $Vd = [1, 26], $Ve = [1, 27], $Vf = [1, 28], $Vg = [1, 29], $Vh = [1, 30], $Vi = [1, 31], $Vj = [1, 32], $Vk = [1, 33], $Vl = [1, 34], $Vm = [1, 35], $Vn = [1, 36], $Vo = [1, 37], $Vp = [1, 38], $Vq = [1, 39], $Vr = [1, 40], $Vs = [1, 42], $Vt = [1, 43], $Vu = [1, 44], $Vv = [1, 45], $Vw = [1, 46], $Vx = [1, 47], $Vy = [1, 4, 5, 10, 14, 15, 17, 19, 22, 24, 30, 31, 32, 34, 36, 37, 38, 39, 40, 42, 44, 45, 47, 48, 49, 50, 51, 53, 54, 56, 61, 62, 63, 64, 73], $Vz = [1, 74], $VA = [1, 80], $VB = [1, 81], $VC = [1, 82], $VD = [1, 83], $VE = [1, 84], $VF = [1, 85], $VG = [1, 86], $VH = [1, 87], $VI = [1, 88], $VJ = [1, 89], $VK = [1, 90], $VL = [1, 91], $VM = [1, 92], $VN = [1, 93], $VO = [1, 94], $VP = [1, 95], $VQ = [1, 96], $VR = [1, 97], $VS = [1, 98], $VT = [1, 99], $VU = [1, 100], $VV = [1, 101], $VW = [1, 102], $VX = [1, 103], $VY = [1, 104], $VZ = [1, 105], $V_ = [2, 78], $V$ = [4, 5, 17, 51, 53, 54], $V01 = [4, 5, 10, 14, 15, 17, 19, 22, 24, 30, 31, 32, 34, 36, 37, 38, 39, 40, 42, 44, 45, 47, 51, 53, 54, 56, 61, 62, 63, 64, 73], $V11 = [4, 5, 10, 14, 15, 17, 19, 22, 24, 30, 31, 32, 34, 36, 37, 38, 39, 40, 42, 44, 45, 47, 50, 51, 53, 54, 56, 61, 62, 63, 64, 73], $V21 = [4, 5, 10, 14, 15, 17, 19, 22, 24, 30, 31, 32, 34, 36, 37, 38, 39, 40, 42, 44, 45, 47, 49, 51, 53, 54, 56, 61, 62, 63, 64, 73], $V31 = [4, 5, 10, 14, 15, 17, 19, 22, 24, 30, 31, 32, 34, 36, 37, 38, 39, 40, 42, 44, 45, 47, 48, 51, 53, 54, 56, 61, 62, 63, 64, 73], $V41 = [5, 52], $V51 = [70, 71, 72, 73], $V61 = [1, 151];
61
+ var parser2 = {
62
+ trace: /* @__PURE__ */ __name(function trace() {
63
+ }, "trace"),
64
+ yy: {},
65
+ symbols_: { "error": 2, "start": 3, "SPACE": 4, "NEWLINE": 5, "SD": 6, "document": 7, "line": 8, "statement": 9, "INVALID": 10, "box_section": 11, "box_line": 12, "participant_statement": 13, "create": 14, "box": 15, "restOfLine": 16, "end": 17, "signal": 18, "autonumber": 19, "NUM": 20, "off": 21, "activate": 22, "actor": 23, "deactivate": 24, "note_statement": 25, "links_statement": 26, "link_statement": 27, "properties_statement": 28, "details_statement": 29, "title": 30, "legacy_title": 31, "acc_title": 32, "acc_title_value": 33, "acc_descr": 34, "acc_descr_value": 35, "acc_descr_multiline_value": 36, "loop": 37, "rect": 38, "opt": 39, "alt": 40, "else_sections": 41, "par": 42, "par_sections": 43, "par_over": 44, "critical": 45, "option_sections": 46, "break": 47, "option": 48, "and": 49, "else": 50, "participant": 51, "AS": 52, "participant_actor": 53, "destroy": 54, "actor_with_config": 55, "note": 56, "placement": 57, "text2": 58, "over": 59, "actor_pair": 60, "links": 61, "link": 62, "properties": 63, "details": 64, "spaceList": 65, ",": 66, "left_of": 67, "right_of": 68, "signaltype": 69, "+": 70, "-": 71, "()": 72, "ACTOR": 73, "config_object": 74, "CONFIG_START": 75, "CONFIG_CONTENT": 76, "CONFIG_END": 77, "SOLID_OPEN_ARROW": 78, "DOTTED_OPEN_ARROW": 79, "SOLID_ARROW": 80, "SOLID_ARROW_TOP": 81, "SOLID_ARROW_BOTTOM": 82, "STICK_ARROW_TOP": 83, "STICK_ARROW_BOTTOM": 84, "SOLID_ARROW_TOP_DOTTED": 85, "SOLID_ARROW_BOTTOM_DOTTED": 86, "STICK_ARROW_TOP_DOTTED": 87, "STICK_ARROW_BOTTOM_DOTTED": 88, "SOLID_ARROW_TOP_REVERSE": 89, "SOLID_ARROW_BOTTOM_REVERSE": 90, "STICK_ARROW_TOP_REVERSE": 91, "STICK_ARROW_BOTTOM_REVERSE": 92, "SOLID_ARROW_TOP_REVERSE_DOTTED": 93, "SOLID_ARROW_BOTTOM_REVERSE_DOTTED": 94, "STICK_ARROW_TOP_REVERSE_DOTTED": 95, "STICK_ARROW_BOTTOM_REVERSE_DOTTED": 96, "BIDIRECTIONAL_SOLID_ARROW": 97, "DOTTED_ARROW": 98, "BIDIRECTIONAL_DOTTED_ARROW": 99, "SOLID_CROSS": 100, "DOTTED_CROSS": 101, "SOLID_POINT": 102, "DOTTED_POINT": 103, "TXT": 104, "$accept": 0, "$end": 1 },
66
+ terminals_: { 2: "error", 4: "SPACE", 5: "NEWLINE", 6: "SD", 10: "INVALID", 14: "create", 15: "box", 16: "restOfLine", 17: "end", 19: "autonumber", 20: "NUM", 21: "off", 22: "activate", 24: "deactivate", 30: "title", 31: "legacy_title", 32: "acc_title", 33: "acc_title_value", 34: "acc_descr", 35: "acc_descr_value", 36: "acc_descr_multiline_value", 37: "loop", 38: "rect", 39: "opt", 40: "alt", 42: "par", 44: "par_over", 45: "critical", 47: "break", 48: "option", 49: "and", 50: "else", 51: "participant", 52: "AS", 53: "participant_actor", 54: "destroy", 56: "note", 59: "over", 61: "links", 62: "link", 63: "properties", 64: "details", 66: ",", 67: "left_of", 68: "right_of", 70: "+", 71: "-", 72: "()", 73: "ACTOR", 75: "CONFIG_START", 76: "CONFIG_CONTENT", 77: "CONFIG_END", 78: "SOLID_OPEN_ARROW", 79: "DOTTED_OPEN_ARROW", 80: "SOLID_ARROW", 81: "SOLID_ARROW_TOP", 82: "SOLID_ARROW_BOTTOM", 83: "STICK_ARROW_TOP", 84: "STICK_ARROW_BOTTOM", 85: "SOLID_ARROW_TOP_DOTTED", 86: "SOLID_ARROW_BOTTOM_DOTTED", 87: "STICK_ARROW_TOP_DOTTED", 88: "STICK_ARROW_BOTTOM_DOTTED", 89: "SOLID_ARROW_TOP_REVERSE", 90: "SOLID_ARROW_BOTTOM_REVERSE", 91: "STICK_ARROW_TOP_REVERSE", 92: "STICK_ARROW_BOTTOM_REVERSE", 93: "SOLID_ARROW_TOP_REVERSE_DOTTED", 94: "SOLID_ARROW_BOTTOM_REVERSE_DOTTED", 95: "STICK_ARROW_TOP_REVERSE_DOTTED", 96: "STICK_ARROW_BOTTOM_REVERSE_DOTTED", 97: "BIDIRECTIONAL_SOLID_ARROW", 98: "DOTTED_ARROW", 99: "BIDIRECTIONAL_DOTTED_ARROW", 100: "SOLID_CROSS", 101: "DOTTED_CROSS", 102: "SOLID_POINT", 103: "DOTTED_POINT", 104: "TXT" },
67
+ productions_: [0, [3, 2], [3, 2], [3, 2], [7, 0], [7, 2], [8, 2], [8, 1], [8, 1], [8, 1], [11, 0], [11, 2], [12, 2], [12, 1], [12, 1], [9, 1], [9, 2], [9, 4], [9, 2], [9, 4], [9, 3], [9, 3], [9, 2], [9, 3], [9, 3], [9, 2], [9, 2], [9, 2], [9, 2], [9, 2], [9, 1], [9, 1], [9, 2], [9, 2], [9, 1], [9, 4], [9, 4], [9, 4], [9, 4], [9, 4], [9, 4], [9, 4], [9, 4], [46, 1], [46, 4], [43, 1], [43, 4], [41, 1], [41, 4], [13, 5], [13, 3], [13, 5], [13, 3], [13, 3], [13, 5], [13, 3], [13, 5], [13, 3], [25, 4], [25, 4], [26, 3], [27, 3], [28, 3], [29, 3], [65, 2], [65, 1], [60, 3], [60, 1], [57, 1], [57, 1], [18, 5], [18, 5], [18, 5], [18, 5], [18, 6], [18, 4], [55, 2], [74, 3], [23, 1], [69, 1], [69, 1], [69, 1], [69, 1], [69, 1], [69, 1], [69, 1], [69, 1], [69, 1], [69, 1], [69, 1], [69, 1], [69, 1], [69, 1], [69, 1], [69, 1], [69, 1], [69, 1], [69, 1], [69, 1], [69, 1], [69, 1], [69, 1], [69, 1], [69, 1], [69, 1], [58, 1]],
68
+ performAction: /* @__PURE__ */ __name(function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) {
69
+ var $0 = $$.length - 1;
70
+ switch (yystate) {
71
+ case 3:
72
+ yy.apply($$[$0]);
73
+ return $$[$0];
74
+ break;
75
+ case 4:
76
+ case 10:
77
+ this.$ = [];
78
+ break;
79
+ case 5:
80
+ case 11:
81
+ $$[$0 - 1].push($$[$0]);
82
+ this.$ = $$[$0 - 1];
83
+ break;
84
+ case 6:
85
+ case 7:
86
+ case 12:
87
+ case 13:
88
+ this.$ = $$[$0];
89
+ break;
90
+ case 8:
91
+ case 9:
92
+ case 14:
93
+ this.$ = [];
94
+ break;
95
+ case 16:
96
+ $$[$0].type = "createParticipant";
97
+ this.$ = $$[$0];
98
+ break;
99
+ case 17:
100
+ $$[$0 - 1].unshift({ type: "boxStart", boxData: yy.parseBoxData($$[$0 - 2]) });
101
+ $$[$0 - 1].push({ type: "boxEnd", boxText: $$[$0 - 2] });
102
+ this.$ = $$[$0 - 1];
103
+ break;
104
+ case 19:
105
+ this.$ = { type: "sequenceIndex", sequenceIndex: Number($$[$0 - 2]), sequenceIndexStep: Number($$[$0 - 1]), sequenceVisible: true, signalType: yy.LINETYPE.AUTONUMBER };
106
+ break;
107
+ case 20:
108
+ this.$ = { type: "sequenceIndex", sequenceIndex: Number($$[$0 - 1]), sequenceIndexStep: 1, sequenceVisible: true, signalType: yy.LINETYPE.AUTONUMBER };
109
+ break;
110
+ case 21:
111
+ this.$ = { type: "sequenceIndex", sequenceVisible: false, signalType: yy.LINETYPE.AUTONUMBER };
112
+ break;
113
+ case 22:
114
+ this.$ = { type: "sequenceIndex", sequenceVisible: true, signalType: yy.LINETYPE.AUTONUMBER };
115
+ break;
116
+ case 23:
117
+ this.$ = { type: "activeStart", signalType: yy.LINETYPE.ACTIVE_START, actor: $$[$0 - 1].actor };
118
+ break;
119
+ case 24:
120
+ this.$ = { type: "activeEnd", signalType: yy.LINETYPE.ACTIVE_END, actor: $$[$0 - 1].actor };
121
+ break;
122
+ case 30:
123
+ yy.setDiagramTitle($$[$0].substring(6));
124
+ this.$ = $$[$0].substring(6);
125
+ break;
126
+ case 31:
127
+ yy.setDiagramTitle($$[$0].substring(7));
128
+ this.$ = $$[$0].substring(7);
129
+ break;
130
+ case 32:
131
+ this.$ = $$[$0].trim();
132
+ yy.setAccTitle(this.$);
133
+ break;
134
+ case 33:
135
+ case 34:
136
+ this.$ = $$[$0].trim();
137
+ yy.setAccDescription(this.$);
138
+ break;
139
+ case 35:
140
+ $$[$0 - 1].unshift({ type: "loopStart", loopText: yy.parseMessage($$[$0 - 2]), signalType: yy.LINETYPE.LOOP_START });
141
+ $$[$0 - 1].push({ type: "loopEnd", loopText: $$[$0 - 2], signalType: yy.LINETYPE.LOOP_END });
142
+ this.$ = $$[$0 - 1];
143
+ break;
144
+ case 36:
145
+ $$[$0 - 1].unshift({ type: "rectStart", color: yy.parseMessage($$[$0 - 2]), signalType: yy.LINETYPE.RECT_START });
146
+ $$[$0 - 1].push({ type: "rectEnd", color: yy.parseMessage($$[$0 - 2]), signalType: yy.LINETYPE.RECT_END });
147
+ this.$ = $$[$0 - 1];
148
+ break;
149
+ case 37:
150
+ $$[$0 - 1].unshift({ type: "optStart", optText: yy.parseMessage($$[$0 - 2]), signalType: yy.LINETYPE.OPT_START });
151
+ $$[$0 - 1].push({ type: "optEnd", optText: yy.parseMessage($$[$0 - 2]), signalType: yy.LINETYPE.OPT_END });
152
+ this.$ = $$[$0 - 1];
153
+ break;
154
+ case 38:
155
+ $$[$0 - 1].unshift({ type: "altStart", altText: yy.parseMessage($$[$0 - 2]), signalType: yy.LINETYPE.ALT_START });
156
+ $$[$0 - 1].push({ type: "altEnd", signalType: yy.LINETYPE.ALT_END });
157
+ this.$ = $$[$0 - 1];
158
+ break;
159
+ case 39:
160
+ $$[$0 - 1].unshift({ type: "parStart", parText: yy.parseMessage($$[$0 - 2]), signalType: yy.LINETYPE.PAR_START });
161
+ $$[$0 - 1].push({ type: "parEnd", signalType: yy.LINETYPE.PAR_END });
162
+ this.$ = $$[$0 - 1];
163
+ break;
164
+ case 40:
165
+ $$[$0 - 1].unshift({ type: "parStart", parText: yy.parseMessage($$[$0 - 2]), signalType: yy.LINETYPE.PAR_OVER_START });
166
+ $$[$0 - 1].push({ type: "parEnd", signalType: yy.LINETYPE.PAR_END });
167
+ this.$ = $$[$0 - 1];
168
+ break;
169
+ case 41:
170
+ $$[$0 - 1].unshift({ type: "criticalStart", criticalText: yy.parseMessage($$[$0 - 2]), signalType: yy.LINETYPE.CRITICAL_START });
171
+ $$[$0 - 1].push({ type: "criticalEnd", signalType: yy.LINETYPE.CRITICAL_END });
172
+ this.$ = $$[$0 - 1];
173
+ break;
174
+ case 42:
175
+ $$[$0 - 1].unshift({ type: "breakStart", breakText: yy.parseMessage($$[$0 - 2]), signalType: yy.LINETYPE.BREAK_START });
176
+ $$[$0 - 1].push({ type: "breakEnd", optText: yy.parseMessage($$[$0 - 2]), signalType: yy.LINETYPE.BREAK_END });
177
+ this.$ = $$[$0 - 1];
178
+ break;
179
+ case 44:
180
+ this.$ = $$[$0 - 3].concat([{ type: "option", optionText: yy.parseMessage($$[$0 - 1]), signalType: yy.LINETYPE.CRITICAL_OPTION }, $$[$0]]);
181
+ break;
182
+ case 46:
183
+ this.$ = $$[$0 - 3].concat([{ type: "and", parText: yy.parseMessage($$[$0 - 1]), signalType: yy.LINETYPE.PAR_AND }, $$[$0]]);
184
+ break;
185
+ case 48:
186
+ this.$ = $$[$0 - 3].concat([{ type: "else", altText: yy.parseMessage($$[$0 - 1]), signalType: yy.LINETYPE.ALT_ELSE }, $$[$0]]);
187
+ break;
188
+ case 49:
189
+ $$[$0 - 3].draw = "participant";
190
+ $$[$0 - 3].type = "addParticipant";
191
+ $$[$0 - 3].description = yy.parseMessage($$[$0 - 1]);
192
+ this.$ = $$[$0 - 3];
193
+ break;
194
+ case 50:
195
+ $$[$0 - 1].draw = "participant";
196
+ $$[$0 - 1].type = "addParticipant";
197
+ this.$ = $$[$0 - 1];
198
+ break;
199
+ case 51:
200
+ $$[$0 - 3].draw = "actor";
201
+ $$[$0 - 3].type = "addParticipant";
202
+ $$[$0 - 3].description = yy.parseMessage($$[$0 - 1]);
203
+ this.$ = $$[$0 - 3];
204
+ break;
205
+ case 52:
206
+ case 57:
207
+ $$[$0 - 1].draw = "actor";
208
+ $$[$0 - 1].type = "addParticipant";
209
+ this.$ = $$[$0 - 1];
210
+ break;
211
+ case 53:
212
+ $$[$0 - 1].type = "destroyParticipant";
213
+ this.$ = $$[$0 - 1];
214
+ break;
215
+ case 54:
216
+ $$[$0 - 3].draw = "participant";
217
+ $$[$0 - 3].type = "addParticipant";
218
+ $$[$0 - 3].description = yy.parseMessage($$[$0 - 1]);
219
+ this.$ = $$[$0 - 3];
220
+ break;
221
+ case 55:
222
+ $$[$0 - 1].draw = "participant";
223
+ $$[$0 - 1].type = "addParticipant";
224
+ this.$ = $$[$0 - 1];
225
+ break;
226
+ case 56:
227
+ $$[$0 - 3].draw = "actor";
228
+ $$[$0 - 3].type = "addParticipant";
229
+ $$[$0 - 3].description = yy.parseMessage($$[$0 - 1]);
230
+ this.$ = $$[$0 - 3];
231
+ break;
232
+ case 58:
233
+ this.$ = [$$[$0 - 1], { type: "addNote", placement: $$[$0 - 2], actor: $$[$0 - 1].actor, text: $$[$0] }];
234
+ break;
235
+ case 59:
236
+ $$[$0 - 2] = [].concat($$[$0 - 1], $$[$0 - 1]).slice(0, 2);
237
+ $$[$0 - 2][0] = $$[$0 - 2][0].actor;
238
+ $$[$0 - 2][1] = $$[$0 - 2][1].actor;
239
+ this.$ = [$$[$0 - 1], { type: "addNote", placement: yy.PLACEMENT.OVER, actor: $$[$0 - 2].slice(0, 2), text: $$[$0] }];
240
+ break;
241
+ case 60:
242
+ this.$ = [$$[$0 - 1], { type: "addLinks", actor: $$[$0 - 1].actor, text: $$[$0] }];
243
+ break;
244
+ case 61:
245
+ this.$ = [$$[$0 - 1], { type: "addALink", actor: $$[$0 - 1].actor, text: $$[$0] }];
246
+ break;
247
+ case 62:
248
+ this.$ = [$$[$0 - 1], { type: "addProperties", actor: $$[$0 - 1].actor, text: $$[$0] }];
249
+ break;
250
+ case 63:
251
+ this.$ = [$$[$0 - 1], { type: "addDetails", actor: $$[$0 - 1].actor, text: $$[$0] }];
252
+ break;
253
+ case 66:
254
+ this.$ = [$$[$0 - 2], $$[$0]];
255
+ break;
256
+ case 67:
257
+ this.$ = $$[$0];
258
+ break;
259
+ case 68:
260
+ this.$ = yy.PLACEMENT.LEFTOF;
261
+ break;
262
+ case 69:
263
+ this.$ = yy.PLACEMENT.RIGHTOF;
264
+ break;
265
+ case 70:
266
+ this.$ = [
267
+ $$[$0 - 4],
268
+ $$[$0 - 1],
269
+ { type: "addMessage", from: $$[$0 - 4].actor, to: $$[$0 - 1].actor, signalType: $$[$0 - 3], msg: $$[$0], activate: true },
270
+ { type: "activeStart", signalType: yy.LINETYPE.ACTIVE_START, actor: $$[$0 - 1].actor }
271
+ ];
272
+ break;
273
+ case 71:
274
+ this.$ = [
275
+ $$[$0 - 4],
276
+ $$[$0 - 1],
277
+ { type: "addMessage", from: $$[$0 - 4].actor, to: $$[$0 - 1].actor, signalType: $$[$0 - 3], msg: $$[$0] },
278
+ { type: "activeEnd", signalType: yy.LINETYPE.ACTIVE_END, actor: $$[$0 - 4].actor }
279
+ ];
280
+ break;
281
+ case 72:
282
+ this.$ = [
283
+ $$[$0 - 4],
284
+ $$[$0 - 1],
285
+ { type: "addMessage", from: $$[$0 - 4].actor, to: $$[$0 - 1].actor, signalType: $$[$0 - 3], msg: $$[$0], activate: true, centralConnection: yy.LINETYPE.CENTRAL_CONNECTION },
286
+ { type: "centralConnection", signalType: yy.LINETYPE.CENTRAL_CONNECTION, actor: $$[$0 - 1].actor }
287
+ ];
288
+ break;
289
+ case 73:
290
+ this.$ = [
291
+ $$[$0 - 4],
292
+ $$[$0 - 1],
293
+ { type: "addMessage", from: $$[$0 - 4].actor, to: $$[$0 - 1].actor, signalType: $$[$0 - 2], msg: $$[$0], activate: false, centralConnection: yy.LINETYPE.CENTRAL_CONNECTION_REVERSE },
294
+ { type: "centralConnectionReverse", signalType: yy.LINETYPE.CENTRAL_CONNECTION_REVERSE, actor: $$[$0 - 4].actor }
295
+ ];
296
+ break;
297
+ case 74:
298
+ this.$ = [
299
+ $$[$0 - 5],
300
+ $$[$0 - 1],
301
+ { type: "addMessage", from: $$[$0 - 5].actor, to: $$[$0 - 1].actor, signalType: $$[$0 - 3], msg: $$[$0], activate: true, centralConnection: yy.LINETYPE.CENTRAL_CONNECTION_DUAL },
302
+ { type: "centralConnection", signalType: yy.LINETYPE.CENTRAL_CONNECTION, actor: $$[$0 - 1].actor },
303
+ { type: "centralConnectionReverse", signalType: yy.LINETYPE.CENTRAL_CONNECTION_REVERSE, actor: $$[$0 - 5].actor }
304
+ ];
305
+ break;
306
+ case 75:
307
+ this.$ = [$$[$0 - 3], $$[$0 - 1], { type: "addMessage", from: $$[$0 - 3].actor, to: $$[$0 - 1].actor, signalType: $$[$0 - 2], msg: $$[$0] }];
308
+ break;
309
+ case 76:
310
+ this.$ = {
311
+ type: "addParticipant",
312
+ actor: $$[$0 - 1],
313
+ config: $$[$0]
314
+ };
315
+ break;
316
+ case 77:
317
+ this.$ = $$[$0 - 1].trim();
318
+ break;
319
+ case 78:
320
+ this.$ = { type: "addParticipant", actor: $$[$0] };
321
+ break;
322
+ case 79:
323
+ this.$ = yy.LINETYPE.SOLID_OPEN;
324
+ break;
325
+ case 80:
326
+ this.$ = yy.LINETYPE.DOTTED_OPEN;
327
+ break;
328
+ case 81:
329
+ this.$ = yy.LINETYPE.SOLID;
330
+ break;
331
+ case 82:
332
+ this.$ = yy.LINETYPE.SOLID_TOP;
333
+ break;
334
+ case 83:
335
+ this.$ = yy.LINETYPE.SOLID_BOTTOM;
336
+ break;
337
+ case 84:
338
+ this.$ = yy.LINETYPE.STICK_TOP;
339
+ break;
340
+ case 85:
341
+ this.$ = yy.LINETYPE.STICK_BOTTOM;
342
+ break;
343
+ case 86:
344
+ this.$ = yy.LINETYPE.SOLID_TOP_DOTTED;
345
+ break;
346
+ case 87:
347
+ this.$ = yy.LINETYPE.SOLID_BOTTOM_DOTTED;
348
+ break;
349
+ case 88:
350
+ this.$ = yy.LINETYPE.STICK_TOP_DOTTED;
351
+ break;
352
+ case 89:
353
+ this.$ = yy.LINETYPE.STICK_BOTTOM_DOTTED;
354
+ break;
355
+ case 90:
356
+ this.$ = yy.LINETYPE.SOLID_ARROW_TOP_REVERSE;
357
+ break;
358
+ case 91:
359
+ this.$ = yy.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE;
360
+ break;
361
+ case 92:
362
+ this.$ = yy.LINETYPE.STICK_ARROW_TOP_REVERSE;
363
+ break;
364
+ case 93:
365
+ this.$ = yy.LINETYPE.STICK_ARROW_BOTTOM_REVERSE;
366
+ break;
367
+ case 94:
368
+ this.$ = yy.LINETYPE.SOLID_ARROW_TOP_REVERSE_DOTTED;
369
+ break;
370
+ case 95:
371
+ this.$ = yy.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE_DOTTED;
372
+ break;
373
+ case 96:
374
+ this.$ = yy.LINETYPE.STICK_ARROW_TOP_REVERSE_DOTTED;
375
+ break;
376
+ case 97:
377
+ this.$ = yy.LINETYPE.STICK_ARROW_BOTTOM_REVERSE_DOTTED;
378
+ break;
379
+ case 98:
380
+ this.$ = yy.LINETYPE.BIDIRECTIONAL_SOLID;
381
+ break;
382
+ case 99:
383
+ this.$ = yy.LINETYPE.DOTTED;
384
+ break;
385
+ case 100:
386
+ this.$ = yy.LINETYPE.BIDIRECTIONAL_DOTTED;
387
+ break;
388
+ case 101:
389
+ this.$ = yy.LINETYPE.SOLID_CROSS;
390
+ break;
391
+ case 102:
392
+ this.$ = yy.LINETYPE.DOTTED_CROSS;
393
+ break;
394
+ case 103:
395
+ this.$ = yy.LINETYPE.SOLID_POINT;
396
+ break;
397
+ case 104:
398
+ this.$ = yy.LINETYPE.DOTTED_POINT;
399
+ break;
400
+ case 105:
401
+ this.$ = yy.parseMessage($$[$0].trim().substring(1));
402
+ break;
403
+ }
404
+ }, "anonymous"),
405
+ 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, 10, 14, 15, 19, 22, 24, 30, 31, 32, 34, 36, 37, 38, 39, 40, 42, 44, 45, 47, 51, 53, 54, 56, 61, 62, 63, 64, 73], $V3, { 7: 7 }), { 1: [2, 1] }, { 1: [2, 2] }, { 1: [2, 3], 4: $V4, 5: $V5, 8: 8, 9: 10, 10: $V6, 13: 13, 14: $V7, 15: $V8, 18: 16, 19: $V9, 22: $Va, 23: 41, 24: $Vb, 25: 20, 26: 21, 27: 22, 28: 23, 29: 24, 30: $Vc, 31: $Vd, 32: $Ve, 34: $Vf, 36: $Vg, 37: $Vh, 38: $Vi, 39: $Vj, 40: $Vk, 42: $Vl, 44: $Vm, 45: $Vn, 47: $Vo, 51: $Vp, 53: $Vq, 54: $Vr, 56: $Vs, 61: $Vt, 62: $Vu, 63: $Vv, 64: $Vw, 73: $Vx }, o($Vy, [2, 5]), { 9: 48, 13: 13, 14: $V7, 15: $V8, 18: 16, 19: $V9, 22: $Va, 23: 41, 24: $Vb, 25: 20, 26: 21, 27: 22, 28: 23, 29: 24, 30: $Vc, 31: $Vd, 32: $Ve, 34: $Vf, 36: $Vg, 37: $Vh, 38: $Vi, 39: $Vj, 40: $Vk, 42: $Vl, 44: $Vm, 45: $Vn, 47: $Vo, 51: $Vp, 53: $Vq, 54: $Vr, 56: $Vs, 61: $Vt, 62: $Vu, 63: $Vv, 64: $Vw, 73: $Vx }, o($Vy, [2, 7]), o($Vy, [2, 8]), o($Vy, [2, 9]), o($Vy, [2, 15]), { 13: 49, 51: $Vp, 53: $Vq, 54: $Vr }, { 16: [1, 50] }, { 5: [1, 51] }, { 5: [1, 54], 20: [1, 52], 21: [1, 53] }, { 23: 55, 73: $Vx }, { 23: 56, 73: $Vx }, { 5: [1, 57] }, { 5: [1, 58] }, { 5: [1, 59] }, { 5: [1, 60] }, { 5: [1, 61] }, o($Vy, [2, 30]), o($Vy, [2, 31]), { 33: [1, 62] }, { 35: [1, 63] }, o($Vy, [2, 34]), { 16: [1, 64] }, { 16: [1, 65] }, { 16: [1, 66] }, { 16: [1, 67] }, { 16: [1, 68] }, { 16: [1, 69] }, { 16: [1, 70] }, { 16: [1, 71] }, { 23: 72, 55: 73, 73: $Vz }, { 23: 75, 55: 76, 73: $Vz }, { 23: 77, 73: $Vx }, { 69: 78, 72: [1, 79], 78: $VA, 79: $VB, 80: $VC, 81: $VD, 82: $VE, 83: $VF, 84: $VG, 85: $VH, 86: $VI, 87: $VJ, 88: $VK, 89: $VL, 90: $VM, 91: $VN, 92: $VO, 93: $VP, 94: $VQ, 95: $VR, 96: $VS, 97: $VT, 98: $VU, 99: $VV, 100: $VW, 101: $VX, 102: $VY, 103: $VZ }, { 57: 106, 59: [1, 107], 67: [1, 108], 68: [1, 109] }, { 23: 110, 73: $Vx }, { 23: 111, 73: $Vx }, { 23: 112, 73: $Vx }, { 23: 113, 73: $Vx }, o([5, 66, 72, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104], $V_), o($Vy, [2, 6]), o($Vy, [2, 16]), o($V$, [2, 10], { 11: 114 }), o($Vy, [2, 18]), { 5: [1, 116], 20: [1, 115] }, { 5: [1, 117] }, o($Vy, [2, 22]), { 5: [1, 118] }, { 5: [1, 119] }, o($Vy, [2, 25]), o($Vy, [2, 26]), o($Vy, [2, 27]), o($Vy, [2, 28]), o($Vy, [2, 29]), o($Vy, [2, 32]), o($Vy, [2, 33]), o($V01, $V3, { 7: 120 }), o($V01, $V3, { 7: 121 }), o($V01, $V3, { 7: 122 }), o($V11, $V3, { 41: 123, 7: 124 }), o($V21, $V3, { 43: 125, 7: 126 }), o($V21, $V3, { 7: 126, 43: 127 }), o($V31, $V3, { 46: 128, 7: 129 }), o($V01, $V3, { 7: 130 }), { 5: [1, 132], 52: [1, 131] }, { 5: [1, 134], 52: [1, 133] }, o($V41, $V_, { 74: 135, 75: [1, 136] }), { 5: [1, 138], 52: [1, 137] }, { 5: [1, 140], 52: [1, 139] }, { 5: [1, 141] }, { 23: 145, 70: [1, 142], 71: [1, 143], 72: [1, 144], 73: $Vx }, { 69: 146, 78: $VA, 79: $VB, 80: $VC, 81: $VD, 82: $VE, 83: $VF, 84: $VG, 85: $VH, 86: $VI, 87: $VJ, 88: $VK, 89: $VL, 90: $VM, 91: $VN, 92: $VO, 93: $VP, 94: $VQ, 95: $VR, 96: $VS, 97: $VT, 98: $VU, 99: $VV, 100: $VW, 101: $VX, 102: $VY, 103: $VZ }, o($V51, [2, 79]), o($V51, [2, 80]), o($V51, [2, 81]), o($V51, [2, 82]), o($V51, [2, 83]), o($V51, [2, 84]), o($V51, [2, 85]), o($V51, [2, 86]), o($V51, [2, 87]), o($V51, [2, 88]), o($V51, [2, 89]), o($V51, [2, 90]), o($V51, [2, 91]), o($V51, [2, 92]), o($V51, [2, 93]), o($V51, [2, 94]), o($V51, [2, 95]), o($V51, [2, 96]), o($V51, [2, 97]), o($V51, [2, 98]), o($V51, [2, 99]), o($V51, [2, 100]), o($V51, [2, 101]), o($V51, [2, 102]), o($V51, [2, 103]), o($V51, [2, 104]), { 23: 147, 73: $Vx }, { 23: 149, 60: 148, 73: $Vx }, { 73: [2, 68] }, { 73: [2, 69] }, { 58: 150, 104: $V61 }, { 58: 152, 104: $V61 }, { 58: 153, 104: $V61 }, { 58: 154, 104: $V61 }, { 4: [1, 157], 5: [1, 159], 12: 156, 13: 158, 17: [1, 155], 51: $Vp, 53: $Vq, 54: $Vr }, { 5: [1, 160] }, o($Vy, [2, 20]), o($Vy, [2, 21]), o($Vy, [2, 23]), o($Vy, [2, 24]), { 4: $V4, 5: $V5, 8: 8, 9: 10, 10: $V6, 13: 13, 14: $V7, 15: $V8, 17: [1, 161], 18: 16, 19: $V9, 22: $Va, 23: 41, 24: $Vb, 25: 20, 26: 21, 27: 22, 28: 23, 29: 24, 30: $Vc, 31: $Vd, 32: $Ve, 34: $Vf, 36: $Vg, 37: $Vh, 38: $Vi, 39: $Vj, 40: $Vk, 42: $Vl, 44: $Vm, 45: $Vn, 47: $Vo, 51: $Vp, 53: $Vq, 54: $Vr, 56: $Vs, 61: $Vt, 62: $Vu, 63: $Vv, 64: $Vw, 73: $Vx }, { 4: $V4, 5: $V5, 8: 8, 9: 10, 10: $V6, 13: 13, 14: $V7, 15: $V8, 17: [1, 162], 18: 16, 19: $V9, 22: $Va, 23: 41, 24: $Vb, 25: 20, 26: 21, 27: 22, 28: 23, 29: 24, 30: $Vc, 31: $Vd, 32: $Ve, 34: $Vf, 36: $Vg, 37: $Vh, 38: $Vi, 39: $Vj, 40: $Vk, 42: $Vl, 44: $Vm, 45: $Vn, 47: $Vo, 51: $Vp, 53: $Vq, 54: $Vr, 56: $Vs, 61: $Vt, 62: $Vu, 63: $Vv, 64: $Vw, 73: $Vx }, { 4: $V4, 5: $V5, 8: 8, 9: 10, 10: $V6, 13: 13, 14: $V7, 15: $V8, 17: [1, 163], 18: 16, 19: $V9, 22: $Va, 23: 41, 24: $Vb, 25: 20, 26: 21, 27: 22, 28: 23, 29: 24, 30: $Vc, 31: $Vd, 32: $Ve, 34: $Vf, 36: $Vg, 37: $Vh, 38: $Vi, 39: $Vj, 40: $Vk, 42: $Vl, 44: $Vm, 45: $Vn, 47: $Vo, 51: $Vp, 53: $Vq, 54: $Vr, 56: $Vs, 61: $Vt, 62: $Vu, 63: $Vv, 64: $Vw, 73: $Vx }, { 17: [1, 164] }, { 4: $V4, 5: $V5, 8: 8, 9: 10, 10: $V6, 13: 13, 14: $V7, 15: $V8, 17: [2, 47], 18: 16, 19: $V9, 22: $Va, 23: 41, 24: $Vb, 25: 20, 26: 21, 27: 22, 28: 23, 29: 24, 30: $Vc, 31: $Vd, 32: $Ve, 34: $Vf, 36: $Vg, 37: $Vh, 38: $Vi, 39: $Vj, 40: $Vk, 42: $Vl, 44: $Vm, 45: $Vn, 47: $Vo, 50: [1, 165], 51: $Vp, 53: $Vq, 54: $Vr, 56: $Vs, 61: $Vt, 62: $Vu, 63: $Vv, 64: $Vw, 73: $Vx }, { 17: [1, 166] }, { 4: $V4, 5: $V5, 8: 8, 9: 10, 10: $V6, 13: 13, 14: $V7, 15: $V8, 17: [2, 45], 18: 16, 19: $V9, 22: $Va, 23: 41, 24: $Vb, 25: 20, 26: 21, 27: 22, 28: 23, 29: 24, 30: $Vc, 31: $Vd, 32: $Ve, 34: $Vf, 36: $Vg, 37: $Vh, 38: $Vi, 39: $Vj, 40: $Vk, 42: $Vl, 44: $Vm, 45: $Vn, 47: $Vo, 49: [1, 167], 51: $Vp, 53: $Vq, 54: $Vr, 56: $Vs, 61: $Vt, 62: $Vu, 63: $Vv, 64: $Vw, 73: $Vx }, { 17: [1, 168] }, { 17: [1, 169] }, { 4: $V4, 5: $V5, 8: 8, 9: 10, 10: $V6, 13: 13, 14: $V7, 15: $V8, 17: [2, 43], 18: 16, 19: $V9, 22: $Va, 23: 41, 24: $Vb, 25: 20, 26: 21, 27: 22, 28: 23, 29: 24, 30: $Vc, 31: $Vd, 32: $Ve, 34: $Vf, 36: $Vg, 37: $Vh, 38: $Vi, 39: $Vj, 40: $Vk, 42: $Vl, 44: $Vm, 45: $Vn, 47: $Vo, 48: [1, 170], 51: $Vp, 53: $Vq, 54: $Vr, 56: $Vs, 61: $Vt, 62: $Vu, 63: $Vv, 64: $Vw, 73: $Vx }, { 4: $V4, 5: $V5, 8: 8, 9: 10, 10: $V6, 13: 13, 14: $V7, 15: $V8, 17: [1, 171], 18: 16, 19: $V9, 22: $Va, 23: 41, 24: $Vb, 25: 20, 26: 21, 27: 22, 28: 23, 29: 24, 30: $Vc, 31: $Vd, 32: $Ve, 34: $Vf, 36: $Vg, 37: $Vh, 38: $Vi, 39: $Vj, 40: $Vk, 42: $Vl, 44: $Vm, 45: $Vn, 47: $Vo, 51: $Vp, 53: $Vq, 54: $Vr, 56: $Vs, 61: $Vt, 62: $Vu, 63: $Vv, 64: $Vw, 73: $Vx }, { 16: [1, 172] }, o($Vy, [2, 50]), { 16: [1, 173] }, o($Vy, [2, 55]), o($V41, [2, 76]), { 76: [1, 174] }, { 16: [1, 175] }, o($Vy, [2, 52]), { 16: [1, 176] }, o($Vy, [2, 57]), o($Vy, [2, 53]), { 23: 177, 73: $Vx }, { 23: 178, 73: $Vx }, { 23: 179, 73: $Vx }, { 58: 180, 104: $V61 }, { 23: 181, 72: [1, 182], 73: $Vx }, { 58: 183, 104: $V61 }, { 58: 184, 104: $V61 }, { 66: [1, 185], 104: [2, 67] }, { 5: [2, 60] }, { 5: [2, 105] }, { 5: [2, 61] }, { 5: [2, 62] }, { 5: [2, 63] }, o($Vy, [2, 17]), o($V$, [2, 11]), { 13: 186, 51: $Vp, 53: $Vq, 54: $Vr }, o($V$, [2, 13]), o($V$, [2, 14]), o($Vy, [2, 19]), o($Vy, [2, 35]), o($Vy, [2, 36]), o($Vy, [2, 37]), o($Vy, [2, 38]), { 16: [1, 187] }, o($Vy, [2, 39]), { 16: [1, 188] }, o($Vy, [2, 40]), o($Vy, [2, 41]), { 16: [1, 189] }, o($Vy, [2, 42]), { 5: [1, 190] }, { 5: [1, 191] }, { 77: [1, 192] }, { 5: [1, 193] }, { 5: [1, 194] }, { 58: 195, 104: $V61 }, { 58: 196, 104: $V61 }, { 58: 197, 104: $V61 }, { 5: [2, 75] }, { 58: 198, 104: $V61 }, { 23: 199, 73: $Vx }, { 5: [2, 58] }, { 5: [2, 59] }, { 23: 200, 73: $Vx }, o($V$, [2, 12]), o($V11, $V3, { 7: 124, 41: 201 }), o($V21, $V3, { 7: 126, 43: 202 }), o($V31, $V3, { 7: 129, 46: 203 }), o($Vy, [2, 49]), o($Vy, [2, 54]), o($V41, [2, 77]), o($Vy, [2, 51]), o($Vy, [2, 56]), { 5: [2, 70] }, { 5: [2, 71] }, { 5: [2, 72] }, { 5: [2, 73] }, { 58: 204, 104: $V61 }, { 104: [2, 66] }, { 17: [2, 48] }, { 17: [2, 46] }, { 17: [2, 44] }, { 5: [2, 74] }],
406
+ defaultActions: { 5: [2, 1], 6: [2, 2], 108: [2, 68], 109: [2, 69], 150: [2, 60], 151: [2, 105], 152: [2, 61], 153: [2, 62], 154: [2, 63], 180: [2, 75], 183: [2, 58], 184: [2, 59], 195: [2, 70], 196: [2, 71], 197: [2, 72], 198: [2, 73], 200: [2, 66], 201: [2, 48], 202: [2, 46], 203: [2, 44], 204: [2, 74] },
407
+ parseError: /* @__PURE__ */ __name(function parseError(str, hash) {
408
+ if (hash.recoverable) {
409
+ this.trace(str);
410
+ } else {
411
+ var error = new Error(str);
412
+ error.hash = hash;
413
+ throw error;
414
+ }
415
+ }, "parseError"),
416
+ parse: /* @__PURE__ */ __name(function parse(input) {
417
+ var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;
418
+ var args = lstack.slice.call(arguments, 1);
419
+ var lexer2 = Object.create(this.lexer);
420
+ var sharedState = { yy: {} };
421
+ for (var k in this.yy) {
422
+ if (Object.prototype.hasOwnProperty.call(this.yy, k)) {
423
+ sharedState.yy[k] = this.yy[k];
424
+ }
425
+ }
426
+ lexer2.setInput(input, sharedState.yy);
427
+ sharedState.yy.lexer = lexer2;
428
+ sharedState.yy.parser = this;
429
+ if (typeof lexer2.yylloc == "undefined") {
430
+ lexer2.yylloc = {};
431
+ }
432
+ var yyloc = lexer2.yylloc;
433
+ lstack.push(yyloc);
434
+ var ranges = lexer2.options && lexer2.options.ranges;
435
+ if (typeof sharedState.yy.parseError === "function") {
436
+ this.parseError = sharedState.yy.parseError;
437
+ } else {
438
+ this.parseError = Object.getPrototypeOf(this).parseError;
439
+ }
440
+ function popStack(n) {
441
+ stack.length = stack.length - 2 * n;
442
+ vstack.length = vstack.length - n;
443
+ lstack.length = lstack.length - n;
444
+ }
445
+ __name(popStack, "popStack");
446
+ function lex() {
447
+ var token;
448
+ token = tstack.pop() || lexer2.lex() || EOF;
449
+ if (typeof token !== "number") {
450
+ if (token instanceof Array) {
451
+ tstack = token;
452
+ token = tstack.pop();
453
+ }
454
+ token = self.symbols_[token] || token;
455
+ }
456
+ return token;
457
+ }
458
+ __name(lex, "lex");
459
+ var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected;
460
+ while (true) {
461
+ state = stack[stack.length - 1];
462
+ if (this.defaultActions[state]) {
463
+ action = this.defaultActions[state];
464
+ } else {
465
+ if (symbol === null || typeof symbol == "undefined") {
466
+ symbol = lex();
467
+ }
468
+ action = table[state] && table[state][symbol];
469
+ }
470
+ if (typeof action === "undefined" || !action.length || !action[0]) {
471
+ var errStr = "";
472
+ expected = [];
473
+ for (p in table[state]) {
474
+ if (this.terminals_[p] && p > TERROR) {
475
+ expected.push("'" + this.terminals_[p] + "'");
476
+ }
477
+ }
478
+ if (lexer2.showPosition) {
479
+ errStr = "Parse error on line " + (yylineno + 1) + ":\n" + lexer2.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'";
480
+ } else {
481
+ errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == EOF ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'");
482
+ }
483
+ this.parseError(errStr, {
484
+ text: lexer2.match,
485
+ token: this.terminals_[symbol] || symbol,
486
+ line: lexer2.yylineno,
487
+ loc: yyloc,
488
+ expected
489
+ });
490
+ }
491
+ if (action[0] instanceof Array && action.length > 1) {
492
+ throw new Error("Parse Error: multiple actions possible at state: " + state + ", token: " + symbol);
493
+ }
494
+ switch (action[0]) {
495
+ case 1:
496
+ stack.push(symbol);
497
+ vstack.push(lexer2.yytext);
498
+ lstack.push(lexer2.yylloc);
499
+ stack.push(action[1]);
500
+ symbol = null;
501
+ if (!preErrorSymbol) {
502
+ yyleng = lexer2.yyleng;
503
+ yytext = lexer2.yytext;
504
+ yylineno = lexer2.yylineno;
505
+ yyloc = lexer2.yylloc;
506
+ if (recovering > 0) {
507
+ recovering--;
508
+ }
509
+ } else {
510
+ symbol = preErrorSymbol;
511
+ preErrorSymbol = null;
512
+ }
513
+ break;
514
+ case 2:
515
+ len = this.productions_[action[1]][1];
516
+ yyval.$ = vstack[vstack.length - len];
517
+ yyval._$ = {
518
+ first_line: lstack[lstack.length - (len || 1)].first_line,
519
+ last_line: lstack[lstack.length - 1].last_line,
520
+ first_column: lstack[lstack.length - (len || 1)].first_column,
521
+ last_column: lstack[lstack.length - 1].last_column
522
+ };
523
+ if (ranges) {
524
+ yyval._$.range = [
525
+ lstack[lstack.length - (len || 1)].range[0],
526
+ lstack[lstack.length - 1].range[1]
527
+ ];
528
+ }
529
+ r = this.performAction.apply(yyval, [
530
+ yytext,
531
+ yyleng,
532
+ yylineno,
533
+ sharedState.yy,
534
+ action[1],
535
+ vstack,
536
+ lstack
537
+ ].concat(args));
538
+ if (typeof r !== "undefined") {
539
+ return r;
540
+ }
541
+ if (len) {
542
+ stack = stack.slice(0, -1 * len * 2);
543
+ vstack = vstack.slice(0, -1 * len);
544
+ lstack = lstack.slice(0, -1 * len);
545
+ }
546
+ stack.push(this.productions_[action[1]][0]);
547
+ vstack.push(yyval.$);
548
+ lstack.push(yyval._$);
549
+ newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
550
+ stack.push(newState);
551
+ break;
552
+ case 3:
553
+ return true;
554
+ }
555
+ }
556
+ return true;
557
+ }, "parse")
558
+ };
559
+ var lexer = /* @__PURE__ */ function() {
560
+ var lexer2 = {
561
+ EOF: 1,
562
+ parseError: /* @__PURE__ */ __name(function parseError(str, hash) {
563
+ if (this.yy.parser) {
564
+ this.yy.parser.parseError(str, hash);
565
+ } else {
566
+ throw new Error(str);
567
+ }
568
+ }, "parseError"),
569
+ // resets the lexer, sets new input
570
+ setInput: /* @__PURE__ */ __name(function(input, yy) {
571
+ this.yy = yy || this.yy || {};
572
+ this._input = input;
573
+ this._more = this._backtrack = this.done = false;
574
+ this.yylineno = this.yyleng = 0;
575
+ this.yytext = this.matched = this.match = "";
576
+ this.conditionStack = ["INITIAL"];
577
+ this.yylloc = {
578
+ first_line: 1,
579
+ first_column: 0,
580
+ last_line: 1,
581
+ last_column: 0
582
+ };
583
+ if (this.options.ranges) {
584
+ this.yylloc.range = [0, 0];
585
+ }
586
+ this.offset = 0;
587
+ return this;
588
+ }, "setInput"),
589
+ // consumes and returns one char from the input
590
+ input: /* @__PURE__ */ __name(function() {
591
+ var ch = this._input[0];
592
+ this.yytext += ch;
593
+ this.yyleng++;
594
+ this.offset++;
595
+ this.match += ch;
596
+ this.matched += ch;
597
+ var lines = ch.match(/(?:\r\n?|\n).*/g);
598
+ if (lines) {
599
+ this.yylineno++;
600
+ this.yylloc.last_line++;
601
+ } else {
602
+ this.yylloc.last_column++;
603
+ }
604
+ if (this.options.ranges) {
605
+ this.yylloc.range[1]++;
606
+ }
607
+ this._input = this._input.slice(1);
608
+ return ch;
609
+ }, "input"),
610
+ // unshifts one char (or a string) into the input
611
+ unput: /* @__PURE__ */ __name(function(ch) {
612
+ var len = ch.length;
613
+ var lines = ch.split(/(?:\r\n?|\n)/g);
614
+ this._input = ch + this._input;
615
+ this.yytext = this.yytext.substr(0, this.yytext.length - len);
616
+ this.offset -= len;
617
+ var oldLines = this.match.split(/(?:\r\n?|\n)/g);
618
+ this.match = this.match.substr(0, this.match.length - 1);
619
+ this.matched = this.matched.substr(0, this.matched.length - 1);
620
+ if (lines.length - 1) {
621
+ this.yylineno -= lines.length - 1;
622
+ }
623
+ var r = this.yylloc.range;
624
+ this.yylloc = {
625
+ first_line: this.yylloc.first_line,
626
+ last_line: this.yylineno + 1,
627
+ first_column: this.yylloc.first_column,
628
+ 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
629
+ };
630
+ if (this.options.ranges) {
631
+ this.yylloc.range = [r[0], r[0] + this.yyleng - len];
632
+ }
633
+ this.yyleng = this.yytext.length;
634
+ return this;
635
+ }, "unput"),
636
+ // When called from action, caches matched text and appends it on next action
637
+ more: /* @__PURE__ */ __name(function() {
638
+ this._more = true;
639
+ return this;
640
+ }, "more"),
641
+ // 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.
642
+ reject: /* @__PURE__ */ __name(function() {
643
+ if (this.options.backtrack_lexer) {
644
+ this._backtrack = true;
645
+ } else {
646
+ 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(), {
647
+ text: "",
648
+ token: null,
649
+ line: this.yylineno
650
+ });
651
+ }
652
+ return this;
653
+ }, "reject"),
654
+ // retain first n characters of the match
655
+ less: /* @__PURE__ */ __name(function(n) {
656
+ this.unput(this.match.slice(n));
657
+ }, "less"),
658
+ // displays already matched input, i.e. for error messages
659
+ pastInput: /* @__PURE__ */ __name(function() {
660
+ var past = this.matched.substr(0, this.matched.length - this.match.length);
661
+ return (past.length > 20 ? "..." : "") + past.substr(-20).replace(/\n/g, "");
662
+ }, "pastInput"),
663
+ // displays upcoming input, i.e. for error messages
664
+ upcomingInput: /* @__PURE__ */ __name(function() {
665
+ var next = this.match;
666
+ if (next.length < 20) {
667
+ next += this._input.substr(0, 20 - next.length);
668
+ }
669
+ return (next.substr(0, 20) + (next.length > 20 ? "..." : "")).replace(/\n/g, "");
670
+ }, "upcomingInput"),
671
+ // displays the character position where the lexing error occurred, i.e. for error messages
672
+ showPosition: /* @__PURE__ */ __name(function() {
673
+ var pre = this.pastInput();
674
+ var c = new Array(pre.length + 1).join("-");
675
+ return pre + this.upcomingInput() + "\n" + c + "^";
676
+ }, "showPosition"),
677
+ // test the lexed token: return FALSE when not a match, otherwise return token
678
+ test_match: /* @__PURE__ */ __name(function(match, indexed_rule) {
679
+ var token, lines, backup;
680
+ if (this.options.backtrack_lexer) {
681
+ backup = {
682
+ yylineno: this.yylineno,
683
+ yylloc: {
684
+ first_line: this.yylloc.first_line,
685
+ last_line: this.last_line,
686
+ first_column: this.yylloc.first_column,
687
+ last_column: this.yylloc.last_column
688
+ },
689
+ yytext: this.yytext,
690
+ match: this.match,
691
+ matches: this.matches,
692
+ matched: this.matched,
693
+ yyleng: this.yyleng,
694
+ offset: this.offset,
695
+ _more: this._more,
696
+ _input: this._input,
697
+ yy: this.yy,
698
+ conditionStack: this.conditionStack.slice(0),
699
+ done: this.done
700
+ };
701
+ if (this.options.ranges) {
702
+ backup.yylloc.range = this.yylloc.range.slice(0);
703
+ }
704
+ }
705
+ lines = match[0].match(/(?:\r\n?|\n).*/g);
706
+ if (lines) {
707
+ this.yylineno += lines.length;
708
+ }
709
+ this.yylloc = {
710
+ first_line: this.yylloc.last_line,
711
+ last_line: this.yylineno + 1,
712
+ first_column: this.yylloc.last_column,
713
+ last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length
714
+ };
715
+ this.yytext += match[0];
716
+ this.match += match[0];
717
+ this.matches = match;
718
+ this.yyleng = this.yytext.length;
719
+ if (this.options.ranges) {
720
+ this.yylloc.range = [this.offset, this.offset += this.yyleng];
721
+ }
722
+ this._more = false;
723
+ this._backtrack = false;
724
+ this._input = this._input.slice(match[0].length);
725
+ this.matched += match[0];
726
+ token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
727
+ if (this.done && this._input) {
728
+ this.done = false;
729
+ }
730
+ if (token) {
731
+ return token;
732
+ } else if (this._backtrack) {
733
+ for (var k in backup) {
734
+ this[k] = backup[k];
735
+ }
736
+ return false;
737
+ }
738
+ return false;
739
+ }, "test_match"),
740
+ // return next match in input
741
+ next: /* @__PURE__ */ __name(function() {
742
+ if (this.done) {
743
+ return this.EOF;
744
+ }
745
+ if (!this._input) {
746
+ this.done = true;
747
+ }
748
+ var token, match, tempMatch, index;
749
+ if (!this._more) {
750
+ this.yytext = "";
751
+ this.match = "";
752
+ }
753
+ var rules = this._currentRules();
754
+ for (var i = 0; i < rules.length; i++) {
755
+ tempMatch = this._input.match(this.rules[rules[i]]);
756
+ if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
757
+ match = tempMatch;
758
+ index = i;
759
+ if (this.options.backtrack_lexer) {
760
+ token = this.test_match(tempMatch, rules[i]);
761
+ if (token !== false) {
762
+ return token;
763
+ } else if (this._backtrack) {
764
+ match = false;
765
+ continue;
766
+ } else {
767
+ return false;
768
+ }
769
+ } else if (!this.options.flex) {
770
+ break;
771
+ }
772
+ }
773
+ }
774
+ if (match) {
775
+ token = this.test_match(match, rules[index]);
776
+ if (token !== false) {
777
+ return token;
778
+ }
779
+ return false;
780
+ }
781
+ if (this._input === "") {
782
+ return this.EOF;
783
+ } else {
784
+ return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". Unrecognized text.\n" + this.showPosition(), {
785
+ text: "",
786
+ token: null,
787
+ line: this.yylineno
788
+ });
789
+ }
790
+ }, "next"),
791
+ // return next match that has a token
792
+ lex: /* @__PURE__ */ __name(function lex() {
793
+ var r = this.next();
794
+ if (r) {
795
+ return r;
796
+ } else {
797
+ return this.lex();
798
+ }
799
+ }, "lex"),
800
+ // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
801
+ begin: /* @__PURE__ */ __name(function begin(condition) {
802
+ this.conditionStack.push(condition);
803
+ }, "begin"),
804
+ // pop the previously active lexer condition state off the condition stack
805
+ popState: /* @__PURE__ */ __name(function popState() {
806
+ var n = this.conditionStack.length - 1;
807
+ if (n > 0) {
808
+ return this.conditionStack.pop();
809
+ } else {
810
+ return this.conditionStack[0];
811
+ }
812
+ }, "popState"),
813
+ // produce the lexer rule set which is active for the currently active lexer condition state
814
+ _currentRules: /* @__PURE__ */ __name(function _currentRules() {
815
+ if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
816
+ return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
817
+ } else {
818
+ return this.conditions["INITIAL"].rules;
819
+ }
820
+ }, "_currentRules"),
821
+ // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
822
+ topState: /* @__PURE__ */ __name(function topState(n) {
823
+ n = this.conditionStack.length - 1 - Math.abs(n || 0);
824
+ if (n >= 0) {
825
+ return this.conditionStack[n];
826
+ } else {
827
+ return "INITIAL";
828
+ }
829
+ }, "topState"),
830
+ // alias for begin(condition)
831
+ pushState: /* @__PURE__ */ __name(function pushState(condition) {
832
+ this.begin(condition);
833
+ }, "pushState"),
834
+ // return the number of states currently on the stack
835
+ stateStackSize: /* @__PURE__ */ __name(function stateStackSize() {
836
+ return this.conditionStack.length;
837
+ }, "stateStackSize"),
838
+ options: { "case-insensitive": true },
839
+ performAction: /* @__PURE__ */ __name(function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) {
840
+ var YYSTATE = YY_START;
841
+ switch ($avoiding_name_collisions) {
842
+ case 0:
843
+ return 5;
844
+ break;
845
+ case 1:
846
+ break;
847
+ case 2:
848
+ break;
849
+ case 3:
850
+ break;
851
+ case 4:
852
+ break;
853
+ case 5:
854
+ break;
855
+ case 6:
856
+ return 20;
857
+ break;
858
+ case 7:
859
+ this.begin("CONFIG");
860
+ return 75;
861
+ break;
862
+ case 8:
863
+ return 76;
864
+ break;
865
+ case 9:
866
+ this.popState();
867
+ this.begin("ALIAS");
868
+ return 77;
869
+ break;
870
+ case 10:
871
+ this.popState();
872
+ this.popState();
873
+ return 77;
874
+ break;
875
+ case 11:
876
+ yy_.yytext = yy_.yytext.trim();
877
+ return 73;
878
+ break;
879
+ case 12:
880
+ yy_.yytext = yy_.yytext.trim();
881
+ this.begin("ALIAS");
882
+ return 73;
883
+ break;
884
+ case 13:
885
+ yy_.yytext = yy_.yytext.trim();
886
+ this.popState();
887
+ return 73;
888
+ break;
889
+ case 14:
890
+ this.popState();
891
+ return 10;
892
+ break;
893
+ case 15:
894
+ yy_.yytext = yy_.yytext.trim();
895
+ this.popState();
896
+ return 10;
897
+ break;
898
+ case 16:
899
+ this.begin("LINE");
900
+ return 15;
901
+ break;
902
+ case 17:
903
+ this.begin("ID");
904
+ return 51;
905
+ break;
906
+ case 18:
907
+ this.begin("ID");
908
+ return 53;
909
+ break;
910
+ case 19:
911
+ return 14;
912
+ break;
913
+ case 20:
914
+ this.begin("ID");
915
+ return 54;
916
+ break;
917
+ case 21:
918
+ this.popState();
919
+ this.popState();
920
+ this.begin("LINE");
921
+ return 52;
922
+ break;
923
+ case 22:
924
+ this.popState();
925
+ this.popState();
926
+ return 5;
927
+ break;
928
+ case 23:
929
+ this.begin("LINE");
930
+ return 37;
931
+ break;
932
+ case 24:
933
+ this.begin("LINE");
934
+ return 38;
935
+ break;
936
+ case 25:
937
+ this.begin("LINE");
938
+ return 39;
939
+ break;
940
+ case 26:
941
+ this.begin("LINE");
942
+ return 40;
943
+ break;
944
+ case 27:
945
+ this.begin("LINE");
946
+ return 50;
947
+ break;
948
+ case 28:
949
+ this.begin("LINE");
950
+ return 42;
951
+ break;
952
+ case 29:
953
+ this.begin("LINE");
954
+ return 44;
955
+ break;
956
+ case 30:
957
+ this.begin("LINE");
958
+ return 49;
959
+ break;
960
+ case 31:
961
+ this.begin("LINE");
962
+ return 45;
963
+ break;
964
+ case 32:
965
+ this.begin("LINE");
966
+ return 48;
967
+ break;
968
+ case 33:
969
+ this.begin("LINE");
970
+ return 47;
971
+ break;
972
+ case 34:
973
+ this.popState();
974
+ return 16;
975
+ break;
976
+ case 35:
977
+ return 17;
978
+ break;
979
+ case 36:
980
+ return 67;
981
+ break;
982
+ case 37:
983
+ return 68;
984
+ break;
985
+ case 38:
986
+ return 61;
987
+ break;
988
+ case 39:
989
+ return 62;
990
+ break;
991
+ case 40:
992
+ return 63;
993
+ break;
994
+ case 41:
995
+ return 64;
996
+ break;
997
+ case 42:
998
+ return 59;
999
+ break;
1000
+ case 43:
1001
+ return 56;
1002
+ break;
1003
+ case 44:
1004
+ this.begin("ID");
1005
+ return 22;
1006
+ break;
1007
+ case 45:
1008
+ this.begin("ID");
1009
+ return 24;
1010
+ break;
1011
+ case 46:
1012
+ return 30;
1013
+ break;
1014
+ case 47:
1015
+ return 31;
1016
+ break;
1017
+ case 48:
1018
+ this.begin("acc_title");
1019
+ return 32;
1020
+ break;
1021
+ case 49:
1022
+ this.popState();
1023
+ return "acc_title_value";
1024
+ break;
1025
+ case 50:
1026
+ this.begin("acc_descr");
1027
+ return 34;
1028
+ break;
1029
+ case 51:
1030
+ this.popState();
1031
+ return "acc_descr_value";
1032
+ break;
1033
+ case 52:
1034
+ this.begin("acc_descr_multiline");
1035
+ break;
1036
+ case 53:
1037
+ this.popState();
1038
+ break;
1039
+ case 54:
1040
+ return "acc_descr_multiline_value";
1041
+ break;
1042
+ case 55:
1043
+ return 6;
1044
+ break;
1045
+ case 56:
1046
+ return 19;
1047
+ break;
1048
+ case 57:
1049
+ return 21;
1050
+ break;
1051
+ case 58:
1052
+ return 66;
1053
+ break;
1054
+ case 59:
1055
+ return 5;
1056
+ break;
1057
+ case 60:
1058
+ yy_.yytext = yy_.yytext.trim();
1059
+ return 73;
1060
+ break;
1061
+ case 61:
1062
+ return 80;
1063
+ break;
1064
+ case 62:
1065
+ return 97;
1066
+ break;
1067
+ case 63:
1068
+ return 98;
1069
+ break;
1070
+ case 64:
1071
+ return 99;
1072
+ break;
1073
+ case 65:
1074
+ return 78;
1075
+ break;
1076
+ case 66:
1077
+ return 79;
1078
+ break;
1079
+ case 67:
1080
+ return 100;
1081
+ break;
1082
+ case 68:
1083
+ return 101;
1084
+ break;
1085
+ case 69:
1086
+ return 102;
1087
+ break;
1088
+ case 70:
1089
+ return 103;
1090
+ break;
1091
+ case 71:
1092
+ return 85;
1093
+ break;
1094
+ case 72:
1095
+ return 86;
1096
+ break;
1097
+ case 73:
1098
+ return 87;
1099
+ break;
1100
+ case 74:
1101
+ return 88;
1102
+ break;
1103
+ case 75:
1104
+ return 93;
1105
+ break;
1106
+ case 76:
1107
+ return 94;
1108
+ break;
1109
+ case 77:
1110
+ return 95;
1111
+ break;
1112
+ case 78:
1113
+ return 96;
1114
+ break;
1115
+ case 79:
1116
+ return 81;
1117
+ break;
1118
+ case 80:
1119
+ return 82;
1120
+ break;
1121
+ case 81:
1122
+ return 83;
1123
+ break;
1124
+ case 82:
1125
+ return 84;
1126
+ break;
1127
+ case 83:
1128
+ return 89;
1129
+ break;
1130
+ case 84:
1131
+ return 90;
1132
+ break;
1133
+ case 85:
1134
+ return 91;
1135
+ break;
1136
+ case 86:
1137
+ return 92;
1138
+ break;
1139
+ case 87:
1140
+ return 104;
1141
+ break;
1142
+ case 88:
1143
+ return 104;
1144
+ break;
1145
+ case 89:
1146
+ return 70;
1147
+ break;
1148
+ case 90:
1149
+ return 71;
1150
+ break;
1151
+ case 91:
1152
+ return 72;
1153
+ break;
1154
+ case 92:
1155
+ return 5;
1156
+ break;
1157
+ case 93:
1158
+ return 10;
1159
+ break;
1160
+ }
1161
+ }, "anonymous"),
1162
+ rules: [/^(?:[\n]+)/i, /^(?:\s+)/i, /^(?:((?!\n)\s)+)/i, /^(?:#[^\n]*)/i, /^(?:%(?!\{)[^\n]*)/i, /^(?:[^\}]%%[^\n]*)/i, /^(?:[0-9]+(?=[ \n]+))/i, /^(?:@\{)/i, /^(?:[^\}]+)/i, /^(?:\}(?=\s+as\s))/i, /^(?:\})/i, /^(?:[^\<->\->:\n,;@\s]+(?=@\{))/i, /^(?:[^<>:\n,;@\s]+(?=\s+as\s))/i, /^(?:[^<>:\n,;@]+(?=\s*[\n;#]|$))/i, /^(?:[^<>:\n,;@]*<[^\n]*)/i, /^(?:[^\n]+)/i, /^(?:box\b)/i, /^(?:participant\b)/i, /^(?:actor\b)/i, /^(?:create\b)/i, /^(?:destroy\b)/i, /^(?:as\b)/i, /^(?:(?:))/i, /^(?:loop\b)/i, /^(?:rect\b)/i, /^(?:opt\b)/i, /^(?:alt\b)/i, /^(?:else\b)/i, /^(?:par\b)/i, /^(?:par_over\b)/i, /^(?:and\b)/i, /^(?:critical\b)/i, /^(?:option\b)/i, /^(?:break\b)/i, /^(?:(?:[:]?(?:no)?wrap)?[^#\n;]*)/i, /^(?:end\b)/i, /^(?:left of\b)/i, /^(?:right of\b)/i, /^(?:links\b)/i, /^(?:link\b)/i, /^(?:properties\b)/i, /^(?:details\b)/i, /^(?:over\b)/i, /^(?:note\b)/i, /^(?:activate\b)/i, /^(?:deactivate\b)/i, /^(?:title\s[^#\n;]+)/i, /^(?:title:\s[^#\n;]+)/i, /^(?:accTitle\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*\{\s*)/i, /^(?:[\}])/i, /^(?:[^\}]*)/i, /^(?:sequenceDiagram\b)/i, /^(?:autonumber\b)/i, /^(?:off\b)/i, /^(?:,)/i, /^(?:;)/i, /^(?:[^\/\\\+\()\+<\->\->:\n,;]+((?!(-x|--x|-\)|--\)|-\|\\|-\\|-\/|-\/\/|-\|\/|\/\|-|\\\|-|\/\/-|\\\\-|\/\|-|--\|\\|--|\(\)))[\-]*[^\+<\->\->:\n,;]+)*)/i, /^(?:->>)/i, /^(?:<<->>)/i, /^(?:-->>)/i, /^(?:<<-->>)/i, /^(?:->)/i, /^(?:-->)/i, /^(?:-[x])/i, /^(?:--[x])/i, /^(?:-[\)])/i, /^(?:--[\)])/i, /^(?:--\|\\)/i, /^(?:--\|\/)/i, /^(?:--\\\\)/i, /^(?:--\/\/)/i, /^(?:\/\|--)/i, /^(?:\\\|--)/i, /^(?:\/\/--)/i, /^(?:\\\\--)/i, /^(?:-\|\\)/i, /^(?:-\|\/)/i, /^(?:-\\\\)/i, /^(?:-\/\/)/i, /^(?:\/\|-)/i, /^(?:\\\|-)/i, /^(?:\/\/-)/i, /^(?:\\\\-)/i, /^(?::(?:(?:no)?wrap)?[^#\n;]*)/i, /^(?::)/i, /^(?:\+)/i, /^(?:-)/i, /^(?:\(\))/i, /^(?:$)/i, /^(?:.)/i],
1163
+ conditions: { "acc_descr_multiline": { "rules": [53, 54], "inclusive": false }, "acc_descr": { "rules": [51], "inclusive": false }, "acc_title": { "rules": [49], "inclusive": false }, "ID": { "rules": [2, 3, 7, 11, 12, 13, 14, 15], "inclusive": false }, "ALIAS": { "rules": [2, 3, 21, 22], "inclusive": false }, "LINE": { "rules": [2, 3, 34], "inclusive": false }, "CONFIG": { "rules": [8, 9, 10], "inclusive": false }, "CONFIG_DATA": { "rules": [], "inclusive": false }, "INITIAL": { "rules": [0, 1, 3, 4, 5, 6, 16, 17, 18, 19, 20, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 50, 52, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93], "inclusive": true } }
1164
+ };
1165
+ return lexer2;
1166
+ }();
1167
+ parser2.lexer = lexer;
1168
+ function Parser() {
1169
+ this.yy = {};
1170
+ }
1171
+ __name(Parser, "Parser");
1172
+ Parser.prototype = parser2;
1173
+ parser2.Parser = Parser;
1174
+ return new Parser();
1175
+ }();
1176
+ parser.parser = parser;
1177
+ var sequenceDiagram_default = parser;
1178
+ var LINETYPE = {
1179
+ SOLID: 0,
1180
+ DOTTED: 1,
1181
+ NOTE: 2,
1182
+ SOLID_CROSS: 3,
1183
+ DOTTED_CROSS: 4,
1184
+ SOLID_OPEN: 5,
1185
+ DOTTED_OPEN: 6,
1186
+ LOOP_START: 10,
1187
+ LOOP_END: 11,
1188
+ ALT_START: 12,
1189
+ ALT_ELSE: 13,
1190
+ ALT_END: 14,
1191
+ OPT_START: 15,
1192
+ OPT_END: 16,
1193
+ ACTIVE_START: 17,
1194
+ ACTIVE_END: 18,
1195
+ PAR_START: 19,
1196
+ PAR_AND: 20,
1197
+ PAR_END: 21,
1198
+ RECT_START: 22,
1199
+ RECT_END: 23,
1200
+ SOLID_POINT: 24,
1201
+ DOTTED_POINT: 25,
1202
+ AUTONUMBER: 26,
1203
+ CRITICAL_START: 27,
1204
+ CRITICAL_OPTION: 28,
1205
+ CRITICAL_END: 29,
1206
+ BREAK_START: 30,
1207
+ BREAK_END: 31,
1208
+ PAR_OVER_START: 32,
1209
+ BIDIRECTIONAL_SOLID: 33,
1210
+ BIDIRECTIONAL_DOTTED: 34,
1211
+ SOLID_TOP: 41,
1212
+ SOLID_BOTTOM: 42,
1213
+ STICK_TOP: 43,
1214
+ STICK_BOTTOM: 44,
1215
+ SOLID_ARROW_TOP_REVERSE: 45,
1216
+ SOLID_ARROW_BOTTOM_REVERSE: 46,
1217
+ STICK_ARROW_TOP_REVERSE: 47,
1218
+ STICK_ARROW_BOTTOM_REVERSE: 48,
1219
+ SOLID_TOP_DOTTED: 51,
1220
+ SOLID_BOTTOM_DOTTED: 52,
1221
+ STICK_TOP_DOTTED: 53,
1222
+ STICK_BOTTOM_DOTTED: 54,
1223
+ SOLID_ARROW_TOP_REVERSE_DOTTED: 55,
1224
+ SOLID_ARROW_BOTTOM_REVERSE_DOTTED: 56,
1225
+ STICK_ARROW_TOP_REVERSE_DOTTED: 57,
1226
+ STICK_ARROW_BOTTOM_REVERSE_DOTTED: 58,
1227
+ CENTRAL_CONNECTION: 59,
1228
+ CENTRAL_CONNECTION_REVERSE: 60,
1229
+ CENTRAL_CONNECTION_DUAL: 61
1230
+ };
1231
+ var ARROWTYPE = {
1232
+ FILLED: 0,
1233
+ OPEN: 1
1234
+ };
1235
+ var PLACEMENT = {
1236
+ LEFTOF: 0,
1237
+ RIGHTOF: 1,
1238
+ OVER: 2
1239
+ };
1240
+ var PARTICIPANT_TYPE = {
1241
+ ACTOR: "actor",
1242
+ BOUNDARY: "boundary",
1243
+ COLLECTIONS: "collections",
1244
+ CONTROL: "control",
1245
+ DATABASE: "database",
1246
+ ENTITY: "entity",
1247
+ PARTICIPANT: "participant",
1248
+ QUEUE: "queue"
1249
+ };
1250
+ var SequenceDB = class {
1251
+ constructor() {
1252
+ this.state = new ImperativeState(() => ({
1253
+ prevActor: void 0,
1254
+ actors: /* @__PURE__ */ new Map(),
1255
+ createdActors: /* @__PURE__ */ new Map(),
1256
+ destroyedActors: /* @__PURE__ */ new Map(),
1257
+ boxes: [],
1258
+ messages: [],
1259
+ notes: [],
1260
+ sequenceNumbersEnabled: false,
1261
+ wrapEnabled: void 0,
1262
+ currentBox: void 0,
1263
+ lastCreated: void 0,
1264
+ lastDestroyed: void 0
1265
+ }));
1266
+ this.setAccTitle = setAccTitle;
1267
+ this.setAccDescription = setAccDescription;
1268
+ this.setDiagramTitle = setDiagramTitle;
1269
+ this.getAccTitle = getAccTitle;
1270
+ this.getAccDescription = getAccDescription;
1271
+ this.getDiagramTitle = getDiagramTitle;
1272
+ this.apply = this.apply.bind(this);
1273
+ this.parseBoxData = this.parseBoxData.bind(this);
1274
+ this.parseMessage = this.parseMessage.bind(this);
1275
+ this.clear();
1276
+ this.setWrap(getConfig2().wrap);
1277
+ this.LINETYPE = LINETYPE;
1278
+ this.ARROWTYPE = ARROWTYPE;
1279
+ this.PLACEMENT = PLACEMENT;
1280
+ }
1281
+ static {
1282
+ __name(this, "SequenceDB");
1283
+ }
1284
+ addBox(data) {
1285
+ this.state.records.boxes.push({
1286
+ name: data.text,
1287
+ wrap: data.wrap ?? this.autoWrap(),
1288
+ fill: data.color,
1289
+ actorKeys: []
1290
+ });
1291
+ this.state.records.currentBox = this.state.records.boxes.slice(-1)[0];
1292
+ }
1293
+ addActor(id, name, description, type, metadata) {
1294
+ let assignedBox = this.state.records.currentBox;
1295
+ let doc;
1296
+ if (metadata !== void 0) {
1297
+ let yamlData;
1298
+ if (!metadata.includes("\n")) {
1299
+ yamlData = "{\n" + metadata + "\n}";
1300
+ } else {
1301
+ yamlData = metadata + "\n";
1302
+ }
1303
+ doc = load(yamlData, { schema: JSON_SCHEMA });
1304
+ }
1305
+ type = doc?.type ?? type;
1306
+ if (doc?.alias && (!description || description.text === name)) {
1307
+ description = { text: doc.alias, wrap: description?.wrap, type };
1308
+ }
1309
+ const old = this.state.records.actors.get(id);
1310
+ if (old) {
1311
+ if (this.state.records.currentBox && old.box && this.state.records.currentBox !== old.box) {
1312
+ throw new Error(
1313
+ `A same participant should only be defined in one Box: ${old.name} can't be in '${old.box.name}' and in '${this.state.records.currentBox.name}' at the same time.`
1314
+ );
1315
+ }
1316
+ assignedBox = old.box ? old.box : this.state.records.currentBox;
1317
+ old.box = assignedBox;
1318
+ if (old && name === old.name && description == null) {
1319
+ return;
1320
+ }
1321
+ }
1322
+ if (description?.text == null) {
1323
+ description = { text: name, type };
1324
+ }
1325
+ if (type == null || description.text == null) {
1326
+ description = { text: name, type };
1327
+ }
1328
+ this.state.records.actors.set(id, {
1329
+ box: assignedBox,
1330
+ name,
1331
+ description: description.text,
1332
+ wrap: description.wrap ?? this.autoWrap(),
1333
+ prevActor: this.state.records.prevActor,
1334
+ links: {},
1335
+ properties: {},
1336
+ actorCnt: null,
1337
+ rectData: null,
1338
+ type: type ?? "participant"
1339
+ });
1340
+ if (this.state.records.prevActor) {
1341
+ const prevActorInRecords = this.state.records.actors.get(this.state.records.prevActor);
1342
+ if (prevActorInRecords) {
1343
+ prevActorInRecords.nextActor = id;
1344
+ }
1345
+ }
1346
+ if (this.state.records.currentBox) {
1347
+ this.state.records.currentBox.actorKeys.push(id);
1348
+ }
1349
+ this.state.records.prevActor = id;
1350
+ }
1351
+ activationCount(part) {
1352
+ let i;
1353
+ let count = 0;
1354
+ if (!part) {
1355
+ return 0;
1356
+ }
1357
+ for (i = 0; i < this.state.records.messages.length; i++) {
1358
+ if (this.state.records.messages[i].type === this.LINETYPE.ACTIVE_START && this.state.records.messages[i].from === part) {
1359
+ count++;
1360
+ }
1361
+ if (this.state.records.messages[i].type === this.LINETYPE.ACTIVE_END && this.state.records.messages[i].from === part) {
1362
+ count--;
1363
+ }
1364
+ }
1365
+ return count;
1366
+ }
1367
+ addMessage(idFrom, idTo, message, answer) {
1368
+ this.state.records.messages.push({
1369
+ id: this.state.records.messages.length.toString(),
1370
+ from: idFrom,
1371
+ to: idTo,
1372
+ message: message.text,
1373
+ wrap: message.wrap ?? this.autoWrap(),
1374
+ answer
1375
+ });
1376
+ }
1377
+ addSignal(idFrom, idTo, message, messageType, activate = false, centralConnection) {
1378
+ if (messageType === this.LINETYPE.ACTIVE_END) {
1379
+ const cnt = this.activationCount(idFrom ?? "");
1380
+ if (cnt < 1) {
1381
+ const error = new Error("Trying to inactivate an inactive participant (" + idFrom + ")");
1382
+ error.hash = {
1383
+ text: "->>-",
1384
+ token: "->>-",
1385
+ line: "1",
1386
+ loc: { first_line: 1, last_line: 1, first_column: 1, last_column: 1 },
1387
+ expected: ["'ACTIVE_PARTICIPANT'"]
1388
+ };
1389
+ throw error;
1390
+ }
1391
+ }
1392
+ this.state.records.messages.push({
1393
+ id: this.state.records.messages.length.toString(),
1394
+ from: idFrom,
1395
+ to: idTo,
1396
+ message: message?.text ?? "",
1397
+ wrap: message?.wrap ?? this.autoWrap(),
1398
+ type: messageType,
1399
+ activate,
1400
+ centralConnection: centralConnection ?? 0
1401
+ });
1402
+ return true;
1403
+ }
1404
+ hasAtLeastOneBox() {
1405
+ return this.state.records.boxes.length > 0;
1406
+ }
1407
+ hasAtLeastOneBoxWithTitle() {
1408
+ return this.state.records.boxes.some((b) => b.name);
1409
+ }
1410
+ getMessages() {
1411
+ return this.state.records.messages;
1412
+ }
1413
+ getBoxes() {
1414
+ return this.state.records.boxes;
1415
+ }
1416
+ getActors() {
1417
+ return this.state.records.actors;
1418
+ }
1419
+ getCreatedActors() {
1420
+ return this.state.records.createdActors;
1421
+ }
1422
+ getDestroyedActors() {
1423
+ return this.state.records.destroyedActors;
1424
+ }
1425
+ getActor(id) {
1426
+ return this.state.records.actors.get(id);
1427
+ }
1428
+ getActorKeys() {
1429
+ return [...this.state.records.actors.keys()];
1430
+ }
1431
+ enableSequenceNumbers() {
1432
+ this.state.records.sequenceNumbersEnabled = true;
1433
+ }
1434
+ disableSequenceNumbers() {
1435
+ this.state.records.sequenceNumbersEnabled = false;
1436
+ }
1437
+ showSequenceNumbers() {
1438
+ return this.state.records.sequenceNumbersEnabled;
1439
+ }
1440
+ setWrap(wrapSetting) {
1441
+ this.state.records.wrapEnabled = wrapSetting;
1442
+ }
1443
+ extractWrap(text) {
1444
+ if (text === void 0) {
1445
+ return {};
1446
+ }
1447
+ text = text.trim();
1448
+ const wrap = /^:?wrap:/.exec(text) !== null ? true : /^:?nowrap:/.exec(text) !== null ? false : void 0;
1449
+ const cleanedText = (wrap === void 0 ? text : text.replace(/^:?(?:no)?wrap:/, "")).trim();
1450
+ return { cleanedText, wrap };
1451
+ }
1452
+ autoWrap() {
1453
+ if (this.state.records.wrapEnabled !== void 0) {
1454
+ return this.state.records.wrapEnabled;
1455
+ }
1456
+ return getConfig2().sequence?.wrap ?? false;
1457
+ }
1458
+ clear() {
1459
+ this.state.reset();
1460
+ clear();
1461
+ }
1462
+ parseMessage(str) {
1463
+ const trimmedStr = str.trim();
1464
+ const { wrap, cleanedText } = this.extractWrap(trimmedStr);
1465
+ const message = {
1466
+ text: cleanedText,
1467
+ wrap
1468
+ };
1469
+ log.debug(`parseMessage: ${JSON.stringify(message)}`);
1470
+ return message;
1471
+ }
1472
+ // We expect the box statement to be color first then description
1473
+ // The color can be rgb,rgba,hsl,hsla, or css code names #hex codes are not supported for now because of the way the char # is handled
1474
+ // We extract first segment as color, the rest of the line is considered as text
1475
+ parseBoxData(str) {
1476
+ const match = /^((?:rgba?|hsla?)\s*\(.*\)|\w*)(.*)$/.exec(str);
1477
+ let color = match?.[1] ? match[1].trim() : "transparent";
1478
+ let title = match?.[2] ? match[2].trim() : void 0;
1479
+ if (window?.CSS) {
1480
+ if (!window.CSS.supports("color", color)) {
1481
+ color = "transparent";
1482
+ title = str.trim();
1483
+ }
1484
+ } else {
1485
+ const style = new Option().style;
1486
+ style.color = color;
1487
+ if (style.color !== color) {
1488
+ color = "transparent";
1489
+ title = str.trim();
1490
+ }
1491
+ }
1492
+ const { wrap, cleanedText } = this.extractWrap(title);
1493
+ return {
1494
+ text: cleanedText ? sanitizeText(cleanedText, getConfig2()) : void 0,
1495
+ color,
1496
+ wrap
1497
+ };
1498
+ }
1499
+ addNote(actor, placement, message) {
1500
+ const note = {
1501
+ actor,
1502
+ placement,
1503
+ message: message.text,
1504
+ wrap: message.wrap ?? this.autoWrap()
1505
+ };
1506
+ const actors = [].concat(actor, actor);
1507
+ this.state.records.notes.push(note);
1508
+ this.state.records.messages.push({
1509
+ id: this.state.records.messages.length.toString(),
1510
+ from: actors[0],
1511
+ to: actors[1],
1512
+ message: message.text,
1513
+ wrap: message.wrap ?? this.autoWrap(),
1514
+ type: this.LINETYPE.NOTE,
1515
+ placement
1516
+ });
1517
+ }
1518
+ addLinks(actorId, text) {
1519
+ const actor = this.getActor(actorId);
1520
+ try {
1521
+ let sanitizedText = sanitizeText(text.text, getConfig2());
1522
+ sanitizedText = sanitizedText.replace(/&equals;/g, "=");
1523
+ sanitizedText = sanitizedText.replace(/&amp;/g, "&");
1524
+ const links = JSON.parse(sanitizedText);
1525
+ this.insertLinks(actor, links);
1526
+ } catch (e) {
1527
+ log.error("error while parsing actor link text", e);
1528
+ }
1529
+ }
1530
+ addALink(actorId, text) {
1531
+ const actor = this.getActor(actorId);
1532
+ try {
1533
+ const links = {};
1534
+ let sanitizedText = sanitizeText(text.text, getConfig2());
1535
+ const sep = sanitizedText.indexOf("@");
1536
+ sanitizedText = sanitizedText.replace(/&equals;/g, "=");
1537
+ sanitizedText = sanitizedText.replace(/&amp;/g, "&");
1538
+ const label = sanitizedText.slice(0, sep - 1).trim();
1539
+ const link = sanitizedText.slice(sep + 1).trim();
1540
+ links[label] = link;
1541
+ this.insertLinks(actor, links);
1542
+ } catch (e) {
1543
+ log.error("error while parsing actor link text", e);
1544
+ }
1545
+ }
1546
+ insertLinks(actor, links) {
1547
+ if (actor.links == null) {
1548
+ actor.links = links;
1549
+ } else {
1550
+ for (const key in links) {
1551
+ actor.links[key] = links[key];
1552
+ }
1553
+ }
1554
+ }
1555
+ addProperties(actorId, text) {
1556
+ const actor = this.getActor(actorId);
1557
+ try {
1558
+ const sanitizedText = sanitizeText(text.text, getConfig2());
1559
+ const properties = JSON.parse(sanitizedText);
1560
+ this.insertProperties(actor, properties);
1561
+ } catch (e) {
1562
+ log.error("error while parsing actor properties text", e);
1563
+ }
1564
+ }
1565
+ insertProperties(actor, properties) {
1566
+ if (actor.properties == null) {
1567
+ actor.properties = properties;
1568
+ } else {
1569
+ for (const key in properties) {
1570
+ actor.properties[key] = properties[key];
1571
+ }
1572
+ }
1573
+ }
1574
+ boxEnd() {
1575
+ this.state.records.currentBox = void 0;
1576
+ }
1577
+ addDetails(actorId, text) {
1578
+ const actor = this.getActor(actorId);
1579
+ const elem = document.getElementById(text.text);
1580
+ try {
1581
+ const text2 = elem.innerHTML;
1582
+ const details = JSON.parse(text2);
1583
+ if (details.properties) {
1584
+ this.insertProperties(actor, details.properties);
1585
+ }
1586
+ if (details.links) {
1587
+ this.insertLinks(actor, details.links);
1588
+ }
1589
+ } catch (e) {
1590
+ log.error("error while parsing actor details text", e);
1591
+ }
1592
+ }
1593
+ getActorProperty(actor, key) {
1594
+ if (actor?.properties !== void 0) {
1595
+ return actor.properties[key];
1596
+ }
1597
+ return void 0;
1598
+ }
1599
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-redundant-type-constituents
1600
+ apply(param) {
1601
+ if (Array.isArray(param)) {
1602
+ param.forEach((item) => {
1603
+ this.apply(item);
1604
+ });
1605
+ } else {
1606
+ switch (param.type) {
1607
+ case "sequenceIndex":
1608
+ this.state.records.messages.push({
1609
+ id: this.state.records.messages.length.toString(),
1610
+ from: void 0,
1611
+ to: void 0,
1612
+ message: {
1613
+ start: param.sequenceIndex,
1614
+ step: param.sequenceIndexStep,
1615
+ visible: param.sequenceVisible
1616
+ },
1617
+ wrap: false,
1618
+ type: param.signalType
1619
+ });
1620
+ break;
1621
+ case "addParticipant":
1622
+ this.addActor(param.actor, param.actor, param.description, param.draw, param.config);
1623
+ break;
1624
+ case "createParticipant":
1625
+ if (this.state.records.actors.has(param.actor)) {
1626
+ throw new Error(
1627
+ "It is not possible to have actors with the same id, even if one is destroyed before the next is created. Use 'AS' aliases to simulate the behavior"
1628
+ );
1629
+ }
1630
+ this.state.records.lastCreated = param.actor;
1631
+ this.addActor(param.actor, param.actor, param.description, param.draw, param.config);
1632
+ this.state.records.createdActors.set(param.actor, this.state.records.messages.length);
1633
+ break;
1634
+ case "destroyParticipant":
1635
+ this.state.records.lastDestroyed = param.actor;
1636
+ this.state.records.destroyedActors.set(param.actor, this.state.records.messages.length);
1637
+ break;
1638
+ case "activeStart":
1639
+ this.addSignal(param.actor, void 0, void 0, param.signalType);
1640
+ break;
1641
+ case "centralConnection":
1642
+ this.addSignal(param.actor, void 0, void 0, param.signalType);
1643
+ break;
1644
+ case "centralConnectionReverse":
1645
+ this.addSignal(param.actor, void 0, void 0, param.signalType);
1646
+ break;
1647
+ case "activeEnd":
1648
+ this.addSignal(param.actor, void 0, void 0, param.signalType);
1649
+ break;
1650
+ case "addNote":
1651
+ this.addNote(param.actor, param.placement, param.text);
1652
+ break;
1653
+ case "addLinks":
1654
+ this.addLinks(param.actor, param.text);
1655
+ break;
1656
+ case "addALink":
1657
+ this.addALink(param.actor, param.text);
1658
+ break;
1659
+ case "addProperties":
1660
+ this.addProperties(param.actor, param.text);
1661
+ break;
1662
+ case "addDetails":
1663
+ this.addDetails(param.actor, param.text);
1664
+ break;
1665
+ case "addMessage":
1666
+ if (this.state.records.lastCreated) {
1667
+ if (param.to !== this.state.records.lastCreated) {
1668
+ throw new Error(
1669
+ "The created participant " + this.state.records.lastCreated.name + " does not have an associated creating message after its declaration. Please check the sequence diagram."
1670
+ );
1671
+ } else {
1672
+ this.state.records.lastCreated = void 0;
1673
+ }
1674
+ } else if (this.state.records.lastDestroyed) {
1675
+ if (param.to !== this.state.records.lastDestroyed && param.from !== this.state.records.lastDestroyed) {
1676
+ throw new Error(
1677
+ "The destroyed participant " + this.state.records.lastDestroyed.name + " does not have an associated destroying message after its declaration. Please check the sequence diagram."
1678
+ );
1679
+ } else {
1680
+ this.state.records.lastDestroyed = void 0;
1681
+ }
1682
+ }
1683
+ this.addSignal(
1684
+ param.from,
1685
+ param.to,
1686
+ param.msg,
1687
+ param.signalType,
1688
+ param.activate,
1689
+ param.centralConnection
1690
+ );
1691
+ break;
1692
+ case "boxStart":
1693
+ this.addBox(param.boxData);
1694
+ break;
1695
+ case "boxEnd":
1696
+ this.boxEnd();
1697
+ break;
1698
+ case "loopStart":
1699
+ this.addSignal(void 0, void 0, param.loopText, param.signalType);
1700
+ break;
1701
+ case "loopEnd":
1702
+ this.addSignal(void 0, void 0, void 0, param.signalType);
1703
+ break;
1704
+ case "rectStart":
1705
+ this.addSignal(void 0, void 0, param.color, param.signalType);
1706
+ break;
1707
+ case "rectEnd":
1708
+ this.addSignal(void 0, void 0, void 0, param.signalType);
1709
+ break;
1710
+ case "optStart":
1711
+ this.addSignal(void 0, void 0, param.optText, param.signalType);
1712
+ break;
1713
+ case "optEnd":
1714
+ this.addSignal(void 0, void 0, void 0, param.signalType);
1715
+ break;
1716
+ case "altStart":
1717
+ this.addSignal(void 0, void 0, param.altText, param.signalType);
1718
+ break;
1719
+ case "else":
1720
+ this.addSignal(void 0, void 0, param.altText, param.signalType);
1721
+ break;
1722
+ case "altEnd":
1723
+ this.addSignal(void 0, void 0, void 0, param.signalType);
1724
+ break;
1725
+ case "setAccTitle":
1726
+ setAccTitle(param.text);
1727
+ break;
1728
+ case "parStart":
1729
+ this.addSignal(void 0, void 0, param.parText, param.signalType);
1730
+ break;
1731
+ case "and":
1732
+ this.addSignal(void 0, void 0, param.parText, param.signalType);
1733
+ break;
1734
+ case "parEnd":
1735
+ this.addSignal(void 0, void 0, void 0, param.signalType);
1736
+ break;
1737
+ case "criticalStart":
1738
+ this.addSignal(void 0, void 0, param.criticalText, param.signalType);
1739
+ break;
1740
+ case "option":
1741
+ this.addSignal(void 0, void 0, param.optionText, param.signalType);
1742
+ break;
1743
+ case "criticalEnd":
1744
+ this.addSignal(void 0, void 0, void 0, param.signalType);
1745
+ break;
1746
+ case "breakStart":
1747
+ this.addSignal(void 0, void 0, param.breakText, param.signalType);
1748
+ break;
1749
+ case "breakEnd":
1750
+ this.addSignal(void 0, void 0, void 0, param.signalType);
1751
+ break;
1752
+ }
1753
+ }
1754
+ }
1755
+ getConfig() {
1756
+ return getConfig2().sequence;
1757
+ }
1758
+ };
1759
+ var getStyles = /* @__PURE__ */ __name((options) => {
1760
+ const dropShadow = options.dropShadow ?? "none";
1761
+ const { look } = getConfig2();
1762
+ return `.actor {
1763
+ stroke: ${options.actorBorder};
1764
+ fill: ${options.actorBkg};
1765
+ stroke-width: ${options.strokeWidth ?? 1};
1766
+ }
1767
+
1768
+ rect.actor.outer-path[data-look="neo"] {
1769
+ filter: ${dropShadow};
1770
+ }
1771
+
1772
+ rect.note[data-look="neo"] {
1773
+ stroke:${options.noteBorderColor};
1774
+ fill:${options.noteBkgColor};
1775
+ filter: ${dropShadow};
1776
+ }
1777
+
1778
+ text.actor > tspan {
1779
+ fill: ${options.actorTextColor};
1780
+ stroke: none;
1781
+ }
1782
+
1783
+ .actor-line {
1784
+ stroke: ${options.actorLineColor};
1785
+ }
1786
+
1787
+ .innerArc {
1788
+ stroke-width: 1.5;
1789
+ stroke-dasharray: none;
1790
+ }
1791
+
1792
+ .messageLine0 {
1793
+ stroke-width: 1.5;
1794
+ stroke-dasharray: none;
1795
+ stroke: ${options.signalColor};
1796
+ }
1797
+
1798
+ .messageLine1 {
1799
+ stroke-width: 1.5;
1800
+ stroke-dasharray: 2, 2;
1801
+ stroke: ${options.signalColor};
1802
+ }
1803
+
1804
+ [id$="-arrowhead"] path {
1805
+ fill: ${options.signalColor};
1806
+ stroke: ${options.signalColor};
1807
+ }
1808
+
1809
+ .sequenceNumber {
1810
+ fill: ${options.sequenceNumberColor};
1811
+ }
1812
+
1813
+ [id$="-sequencenumber"] {
1814
+ fill: ${options.signalColor};
1815
+ }
1816
+
1817
+ [id$="-crosshead"] path {
1818
+ fill: ${options.signalColor};
1819
+ stroke: ${options.signalColor};
1820
+ }
1821
+
1822
+ .messageText {
1823
+ fill: ${options.signalTextColor};
1824
+ stroke: none;
1825
+ }
1826
+
1827
+ .labelBox {
1828
+ stroke: ${options.labelBoxBorderColor};
1829
+ fill: ${options.labelBoxBkgColor};
1830
+ filter: ${look === "neo" ? dropShadow : "none"};
1831
+ }
1832
+
1833
+ .labelText, .labelText > tspan {
1834
+ fill: ${options.labelTextColor};
1835
+ stroke: none;
1836
+ }
1837
+
1838
+ .loopText, .loopText > tspan {
1839
+ fill: ${options.loopTextColor};
1840
+ stroke: none;
1841
+ }
1842
+
1843
+ .loopLine {
1844
+ stroke-width: 2px;
1845
+ stroke-dasharray: 2, 2;
1846
+ stroke: ${options.labelBoxBorderColor};
1847
+ fill: ${options.labelBoxBorderColor};
1848
+ }
1849
+
1850
+ .note {
1851
+ //stroke: #decc93;
1852
+ stroke: ${options.noteBorderColor};
1853
+ fill: ${options.noteBkgColor};
1854
+ }
1855
+
1856
+ .noteText, .noteText > tspan {
1857
+ fill: ${options.noteTextColor};
1858
+ stroke: none;
1859
+ ${options.noteFontWeight ? `font-weight: ${options.noteFontWeight};` : ""}
1860
+ }
1861
+
1862
+ .activation0 {
1863
+ fill: ${options.activationBkgColor};
1864
+ stroke: ${options.activationBorderColor};
1865
+ }
1866
+
1867
+ .activation1 {
1868
+ fill: ${options.activationBkgColor};
1869
+ stroke: ${options.activationBorderColor};
1870
+ }
1871
+
1872
+ .activation2 {
1873
+ fill: ${options.activationBkgColor};
1874
+ stroke: ${options.activationBorderColor};
1875
+ }
1876
+
1877
+ .actorPopupMenu {
1878
+ position: absolute;
1879
+ }
1880
+
1881
+ .actorPopupMenuPanel {
1882
+ position: absolute;
1883
+ fill: ${options.actorBkg};
1884
+ box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
1885
+ filter: drop-shadow(3px 5px 2px rgb(0 0 0 / 0.4));
1886
+ }
1887
+ .actor-man circle, line {
1888
+ fill: ${options.actorBkg};
1889
+ stroke-width: 2px;
1890
+ }
1891
+
1892
+ g rect.rect {
1893
+ filter: ${dropShadow};
1894
+ stroke: ${options.nodeBorder};
1895
+ }
1896
+ `;
1897
+ }, "getStyles");
1898
+ var styles_default = getStyles;
1899
+ var ACTOR_TYPE_WIDTH = 18 * 2;
1900
+ var TOP_ACTOR_CLASS = "actor-top";
1901
+ var BOTTOM_ACTOR_CLASS = "actor-bottom";
1902
+ var ACTOR_BOX_CLASS = "actor-box";
1903
+ var ACTOR_MAN_FIGURE_CLASS = "actor-man";
1904
+ var COLOR_THEMES = /* @__PURE__ */ new Set(["redux-color", "redux-dark-color"]);
1905
+ var drawRect2 = /* @__PURE__ */ __name(function(elem, rectData) {
1906
+ const rectElement = drawRect(elem, rectData);
1907
+ if (getConfig().look === "neo") {
1908
+ rectElement.attr("data-look", "neo");
1909
+ }
1910
+ return rectElement;
1911
+ }, "drawRect");
1912
+ var drawPopup = /* @__PURE__ */ __name(function(elem, actor, minMenuWidth, textAttrs, forceMenus) {
1913
+ if (actor.links === void 0 || actor.links === null || Object.keys(actor.links).length === 0) {
1914
+ return { height: 0, width: 0 };
1915
+ }
1916
+ const links = actor.links;
1917
+ const actorCnt2 = actor.actorCnt;
1918
+ const rectData = actor.rectData;
1919
+ var displayValue = "none";
1920
+ if (forceMenus) {
1921
+ displayValue = "block !important";
1922
+ }
1923
+ const g = elem.append("g");
1924
+ g.attr("id", "actor" + actorCnt2 + "_popup");
1925
+ g.attr("class", "actorPopupMenu");
1926
+ g.attr("display", displayValue);
1927
+ var actorClass = "";
1928
+ if (rectData.class !== void 0) {
1929
+ actorClass = " " + rectData.class;
1930
+ }
1931
+ let menuWidth = rectData.width > minMenuWidth ? rectData.width : minMenuWidth;
1932
+ const rectElem = g.append("rect");
1933
+ rectElem.attr("class", "actorPopupMenuPanel" + actorClass);
1934
+ rectElem.attr("x", rectData.x);
1935
+ rectElem.attr("y", rectData.height);
1936
+ rectElem.attr("fill", rectData.fill);
1937
+ rectElem.attr("stroke", rectData.stroke);
1938
+ rectElem.attr("width", menuWidth);
1939
+ rectElem.attr("height", rectData.height);
1940
+ rectElem.attr("rx", rectData.rx);
1941
+ rectElem.attr("ry", rectData.ry);
1942
+ if (links != null) {
1943
+ var linkY = 20;
1944
+ for (let key in links) {
1945
+ var linkElem = g.append("a");
1946
+ var sanitizedLink = (0, import_sanitize_url.sanitizeUrl)(links[key]);
1947
+ linkElem.attr("xlink:href", sanitizedLink);
1948
+ linkElem.attr("target", "_blank");
1949
+ _drawMenuItemTextCandidateFunc(textAttrs)(
1950
+ key,
1951
+ linkElem,
1952
+ rectData.x + 10,
1953
+ rectData.height + linkY,
1954
+ menuWidth,
1955
+ 20,
1956
+ { class: "actor" },
1957
+ textAttrs
1958
+ );
1959
+ linkY += 30;
1960
+ }
1961
+ }
1962
+ rectElem.attr("height", linkY);
1963
+ return { height: rectData.height + linkY, width: menuWidth };
1964
+ }, "drawPopup");
1965
+ var popupMenuToggle = /* @__PURE__ */ __name(function(popId) {
1966
+ return "var pu = document.getElementById('" + popId + "'); if (pu != null) { pu.style.display = pu.style.display == 'block' ? 'none' : 'block'; }";
1967
+ }, "popupMenuToggle");
1968
+ var drawKatex = /* @__PURE__ */ __name(async function(elem, textData, msgModel = null) {
1969
+ let textElem = elem.append("foreignObject");
1970
+ const linesSanitized = await renderKatexSanitized(textData.text, getConfig());
1971
+ const divElem = textElem.append("xhtml:div").attr("style", "width: fit-content;").attr("xmlns", "http://www.w3.org/1999/xhtml").html(linesSanitized);
1972
+ const dim = divElem.node().getBoundingClientRect();
1973
+ textElem.attr("height", Math.round(dim.height)).attr("width", Math.round(dim.width));
1974
+ if (textData.class === "noteText") {
1975
+ const rectElem = elem.node().firstChild;
1976
+ rectElem.setAttribute("height", dim.height + 2 * textData.textMargin);
1977
+ const rectDim = rectElem.getBBox();
1978
+ textElem.attr("x", Math.round(rectDim.x + rectDim.width / 2 - dim.width / 2)).attr("y", Math.round(rectDim.y + rectDim.height / 2 - dim.height / 2));
1979
+ } else if (msgModel) {
1980
+ let { startx, stopx, starty } = msgModel;
1981
+ if (startx > stopx) {
1982
+ const temp = startx;
1983
+ startx = stopx;
1984
+ stopx = temp;
1985
+ }
1986
+ textElem.attr("x", Math.round(startx + Math.abs(startx - stopx) / 2 - dim.width / 2));
1987
+ if (textData.class === "loopText") {
1988
+ textElem.attr("y", Math.round(starty));
1989
+ } else {
1990
+ textElem.attr("y", Math.round(starty - dim.height));
1991
+ }
1992
+ }
1993
+ return [textElem];
1994
+ }, "drawKatex");
1995
+ var drawText = /* @__PURE__ */ __name(function(elem, textData) {
1996
+ let prevTextHeight = 0;
1997
+ let textHeight = 0;
1998
+ const lines = textData.text.split(common_default.lineBreakRegex);
1999
+ const [_textFontSize, _textFontSizePx] = parseFontSize(textData.fontSize);
2000
+ let textElems = [];
2001
+ let dy = 0;
2002
+ let yfunc = /* @__PURE__ */ __name(() => textData.y, "yfunc");
2003
+ if (textData.valign !== void 0 && textData.textMargin !== void 0 && textData.textMargin > 0) {
2004
+ switch (textData.valign) {
2005
+ case "top":
2006
+ case "start":
2007
+ yfunc = /* @__PURE__ */ __name(() => Math.round(textData.y + textData.textMargin), "yfunc");
2008
+ break;
2009
+ case "middle":
2010
+ case "center":
2011
+ yfunc = /* @__PURE__ */ __name(() => Math.round(textData.y + (prevTextHeight + textHeight + textData.textMargin) / 2), "yfunc");
2012
+ break;
2013
+ case "bottom":
2014
+ case "end":
2015
+ yfunc = /* @__PURE__ */ __name(() => Math.round(
2016
+ textData.y + (prevTextHeight + textHeight + 2 * textData.textMargin) - textData.textMargin
2017
+ ), "yfunc");
2018
+ break;
2019
+ }
2020
+ }
2021
+ if (textData.anchor !== void 0 && textData.textMargin !== void 0 && textData.width !== void 0) {
2022
+ switch (textData.anchor) {
2023
+ case "left":
2024
+ case "start":
2025
+ textData.x = Math.round(textData.x + textData.textMargin);
2026
+ textData.anchor = "start";
2027
+ textData.dominantBaseline = "middle";
2028
+ textData.alignmentBaseline = "middle";
2029
+ break;
2030
+ case "middle":
2031
+ case "center":
2032
+ textData.x = Math.round(textData.x + textData.width / 2);
2033
+ textData.anchor = "middle";
2034
+ textData.dominantBaseline = "middle";
2035
+ textData.alignmentBaseline = "middle";
2036
+ break;
2037
+ case "right":
2038
+ case "end":
2039
+ textData.x = Math.round(textData.x + textData.width - textData.textMargin);
2040
+ textData.anchor = "end";
2041
+ textData.dominantBaseline = "middle";
2042
+ textData.alignmentBaseline = "middle";
2043
+ break;
2044
+ }
2045
+ }
2046
+ for (let [i, line] of lines.entries()) {
2047
+ if (textData.textMargin !== void 0 && textData.textMargin === 0 && _textFontSize !== void 0) {
2048
+ dy = i * _textFontSize;
2049
+ }
2050
+ const textElem = elem.append("text");
2051
+ textElem.attr("x", textData.x);
2052
+ textElem.attr("y", yfunc());
2053
+ if (textData.anchor !== void 0) {
2054
+ textElem.attr("text-anchor", textData.anchor).attr("dominant-baseline", textData.dominantBaseline).attr("alignment-baseline", textData.alignmentBaseline);
2055
+ }
2056
+ if (textData.fontFamily !== void 0) {
2057
+ textElem.style("font-family", textData.fontFamily);
2058
+ }
2059
+ if (_textFontSizePx !== void 0) {
2060
+ textElem.style("font-size", _textFontSizePx);
2061
+ }
2062
+ if (textData.fontWeight !== void 0) {
2063
+ textElem.style("font-weight", textData.fontWeight);
2064
+ }
2065
+ if (textData.fill !== void 0) {
2066
+ textElem.attr("fill", textData.fill);
2067
+ }
2068
+ if (textData.class !== void 0) {
2069
+ textElem.attr("class", textData.class);
2070
+ }
2071
+ if (textData.dy !== void 0) {
2072
+ textElem.attr("dy", textData.dy);
2073
+ } else if (dy !== 0) {
2074
+ textElem.attr("dy", dy);
2075
+ }
2076
+ const text = line || ZERO_WIDTH_SPACE;
2077
+ if (textData.tspan) {
2078
+ const span = textElem.append("tspan");
2079
+ span.attr("x", textData.x);
2080
+ if (textData.fill !== void 0) {
2081
+ span.attr("fill", textData.fill);
2082
+ }
2083
+ span.text(text);
2084
+ } else {
2085
+ textElem.text(text);
2086
+ }
2087
+ if (textData.valign !== void 0 && textData.textMargin !== void 0 && textData.textMargin > 0) {
2088
+ textHeight += (textElem._groups || textElem)[0][0].getBBox().height;
2089
+ prevTextHeight = textHeight;
2090
+ }
2091
+ textElems.push(textElem);
2092
+ }
2093
+ return textElems;
2094
+ }, "drawText");
2095
+ var drawLabel = /* @__PURE__ */ __name(function(elem, txtObject) {
2096
+ function genPoints(x, y, width, height, cut) {
2097
+ return x + "," + y + " " + (x + width) + "," + y + " " + (x + width) + "," + (y + height - cut) + " " + (x + width - cut * 1.2) + "," + (y + height) + " " + x + "," + (y + height);
2098
+ }
2099
+ __name(genPoints, "genPoints");
2100
+ const polygon = elem.append("polygon");
2101
+ polygon.attr("points", genPoints(txtObject.x, txtObject.y, txtObject.width, txtObject.height, 7));
2102
+ polygon.attr("class", "labelBox");
2103
+ txtObject.y = txtObject.y + txtObject.height / 2;
2104
+ drawText(elem, txtObject);
2105
+ return polygon;
2106
+ }, "drawLabel");
2107
+ var actorCnt = -1;
2108
+ var fixLifeLineHeights = /* @__PURE__ */ __name((diagram2, actors, actorKeys, conf2) => {
2109
+ if (!diagram2.select) {
2110
+ return;
2111
+ }
2112
+ actorKeys.forEach((actorKey) => {
2113
+ const actor = actors.get(actorKey);
2114
+ const actorDOM = diagram2.select("#actor" + actor.actorCnt);
2115
+ if (!conf2.mirrorActors && actor.stopy) {
2116
+ actorDOM.attr("y2", actor.stopy + actor.height / 2);
2117
+ } else if (conf2.mirrorActors) {
2118
+ actorDOM.attr("y2", actor.stopy);
2119
+ }
2120
+ });
2121
+ }, "fixLifeLineHeights");
2122
+ var drawActorTypeParticipant = /* @__PURE__ */ __name(function(elem, actor, conf2, isFooter, actorIndexMap) {
2123
+ const actorY = isFooter ? actor.stopy : actor.starty;
2124
+ const center = actor.x + actor.width / 2;
2125
+ const centerY = actorY + actor.height;
2126
+ const { look, theme, themeVariables } = conf2;
2127
+ const { bkgColorArray, borderColorArray } = themeVariables;
2128
+ const boxplusLineGroup = elem.append("g").lower();
2129
+ var g = boxplusLineGroup;
2130
+ if (!isFooter) {
2131
+ actorCnt++;
2132
+ if (Object.keys(actor.links || {}).length && !conf2.forceMenus) {
2133
+ g.attr("onclick", popupMenuToggle(`actor${actorCnt}_popup`)).attr("cursor", "pointer");
2134
+ }
2135
+ g.append("line").attr("id", "actor" + actorCnt).attr("x1", center).attr("y1", centerY).attr("x2", center).attr("y2", 2e3).attr("class", "actor-line 200").attr("stroke-width", "0.5px").attr("stroke", "#999").attr("name", actor.name).attr("data-et", "life-line").attr("data-id", actor.name);
2136
+ g = boxplusLineGroup.append("g");
2137
+ actor.actorCnt = actorCnt;
2138
+ if (actor.links != null) {
2139
+ g.attr("id", "root-" + actorCnt);
2140
+ }
2141
+ if (look === "neo") {
2142
+ g.attr("data-look", "neo");
2143
+ }
2144
+ }
2145
+ const rect = getNoteRect();
2146
+ var cssclass = "actor";
2147
+ if (actor.properties?.class) {
2148
+ cssclass = actor.properties.class;
2149
+ } else {
2150
+ rect.fill = "#eaeaea";
2151
+ }
2152
+ if (isFooter) {
2153
+ cssclass += ` ${BOTTOM_ACTOR_CLASS}`;
2154
+ } else {
2155
+ cssclass += ` ${TOP_ACTOR_CLASS}`;
2156
+ }
2157
+ rect.x = actor.x;
2158
+ rect.y = actorY;
2159
+ rect.width = actor.width;
2160
+ rect.height = actor.height;
2161
+ rect.class = cssclass;
2162
+ rect.rx = 3;
2163
+ rect.ry = 3;
2164
+ rect.name = actor.name;
2165
+ if (look === "neo") {
2166
+ rect.rx = 6;
2167
+ rect.ry = 6;
2168
+ }
2169
+ const rectElem = drawRect2(g, rect);
2170
+ const actorCount = actorIndexMap.get(actor.name) ?? 0;
2171
+ if (COLOR_THEMES.has(theme)) {
2172
+ rectElem.style("stroke", borderColorArray[actorCount % borderColorArray.length]);
2173
+ rectElem.style("fill", bkgColorArray[actorCount % borderColorArray.length]);
2174
+ }
2175
+ if (look === "neo") {
2176
+ rectElem.attr("filter", "url(#drop-shadow)");
2177
+ }
2178
+ actor.rectData = rect;
2179
+ if (actor.properties?.icon) {
2180
+ const iconSrc = actor.properties.icon.trim();
2181
+ if (iconSrc.charAt(0) === "@") {
2182
+ drawEmbeddedImage(g, rect.x + rect.width - 20, rect.y + 10, iconSrc.substr(1));
2183
+ } else {
2184
+ drawImage(g, rect.x + rect.width - 20, rect.y + 10, iconSrc);
2185
+ }
2186
+ }
2187
+ if (!isFooter) {
2188
+ g.attr("data-et", "participant");
2189
+ g.attr("data-type", "participant");
2190
+ g.attr("data-id", actor.name);
2191
+ }
2192
+ _drawTextCandidateFunc(conf2, hasKatex(actor.description))(
2193
+ actor.description,
2194
+ g,
2195
+ rect.x,
2196
+ rect.y,
2197
+ rect.width,
2198
+ rect.height,
2199
+ { class: `actor ${ACTOR_BOX_CLASS}` },
2200
+ conf2
2201
+ );
2202
+ let height = actor.height;
2203
+ if (rectElem.node) {
2204
+ const bounds2 = rectElem.node().getBBox();
2205
+ actor.height = bounds2.height;
2206
+ height = bounds2.height;
2207
+ }
2208
+ return height;
2209
+ }, "drawActorTypeParticipant");
2210
+ var drawActorTypeCollections = /* @__PURE__ */ __name(function(elem, actor, conf2, isFooter, actorIndexMap) {
2211
+ const actorY = isFooter ? actor.stopy : actor.starty;
2212
+ const center = actor.x + actor.width / 2;
2213
+ const centerY = actorY + actor.height;
2214
+ const { look, theme, themeVariables } = conf2;
2215
+ const { bkgColorArray, borderColorArray } = themeVariables;
2216
+ const boxplusLineGroup = elem.append("g").lower();
2217
+ var g = boxplusLineGroup;
2218
+ if (!isFooter) {
2219
+ actorCnt++;
2220
+ if (Object.keys(actor.links || {}).length && !conf2.forceMenus) {
2221
+ g.attr("onclick", popupMenuToggle(`actor${actorCnt}_popup`)).attr("cursor", "pointer");
2222
+ }
2223
+ g.append("line").attr("id", "actor" + actorCnt).attr("x1", center).attr("y1", centerY).attr("x2", center).attr("y2", 2e3).attr("class", "actor-line 200").attr("stroke-width", "0.5px").attr("stroke", "#999").attr("name", actor.name).attr("data-et", "life-line").attr("data-id", actor.name);
2224
+ g = boxplusLineGroup.append("g");
2225
+ actor.actorCnt = actorCnt;
2226
+ if (actor.links != null) {
2227
+ g.attr("id", "root-" + actorCnt);
2228
+ }
2229
+ if (look === "neo") {
2230
+ g.attr("data-look", "neo");
2231
+ }
2232
+ }
2233
+ const rect = getNoteRect();
2234
+ var cssclass = "actor";
2235
+ if (actor.properties?.class) {
2236
+ cssclass = actor.properties.class;
2237
+ } else {
2238
+ rect.fill = "#eaeaea";
2239
+ }
2240
+ if (isFooter) {
2241
+ cssclass += ` ${BOTTOM_ACTOR_CLASS}`;
2242
+ } else {
2243
+ cssclass += ` ${TOP_ACTOR_CLASS}`;
2244
+ }
2245
+ rect.x = actor.x;
2246
+ rect.y = actorY;
2247
+ rect.width = actor.width;
2248
+ rect.height = actor.height;
2249
+ rect.class = cssclass;
2250
+ rect.name = actor.name;
2251
+ const offset = 6;
2252
+ const shadowRect = {
2253
+ ...rect,
2254
+ x: rect.x + (isFooter ? -offset : -offset),
2255
+ y: rect.y + (isFooter ? +offset : +offset),
2256
+ class: "actor"
2257
+ };
2258
+ const rectElem = drawRect2(g, rect);
2259
+ const stackedRect = drawRect2(g, shadowRect);
2260
+ actor.rectData = rect;
2261
+ if (look === "neo") {
2262
+ g.attr("filter", "url(#drop-shadow)");
2263
+ }
2264
+ const actorCount = actorIndexMap.get(actor.name) ?? 0;
2265
+ if (COLOR_THEMES.has(theme)) {
2266
+ rectElem.style("stroke", borderColorArray[actorCount % borderColorArray.length]);
2267
+ rectElem.style("fill", bkgColorArray[actorCount % borderColorArray.length]);
2268
+ stackedRect.style("stroke", borderColorArray[actorCount % borderColorArray.length]);
2269
+ stackedRect.style("fill", bkgColorArray[actorCount % borderColorArray.length]);
2270
+ }
2271
+ if (actor.properties?.icon) {
2272
+ const iconSrc = actor.properties.icon.trim();
2273
+ if (iconSrc.charAt(0) === "@") {
2274
+ drawEmbeddedImage(g, rect.x + rect.width - 20, rect.y + 10, iconSrc.substr(1));
2275
+ } else {
2276
+ drawImage(g, rect.x + rect.width - 20, rect.y + 10, iconSrc);
2277
+ }
2278
+ }
2279
+ _drawTextCandidateFunc(conf2, hasKatex(actor.description))(
2280
+ actor.description,
2281
+ g,
2282
+ rect.x - offset,
2283
+ rect.y + offset,
2284
+ rect.width,
2285
+ rect.height,
2286
+ { class: `actor ${ACTOR_BOX_CLASS}` },
2287
+ conf2
2288
+ );
2289
+ let height = actor.height;
2290
+ if (rectElem.node) {
2291
+ const bounds2 = rectElem.node().getBBox();
2292
+ actor.height = bounds2.height;
2293
+ height = bounds2.height;
2294
+ }
2295
+ if (!isFooter) {
2296
+ g.attr("data-et", "participant");
2297
+ g.attr("data-type", "collections");
2298
+ g.attr("data-id", actor.name);
2299
+ }
2300
+ return height;
2301
+ }, "drawActorTypeCollections");
2302
+ var drawActorTypeQueue = /* @__PURE__ */ __name(function(elem, actor, conf2, isFooter, actorIndexMap) {
2303
+ const actorY = isFooter ? actor.stopy : actor.starty;
2304
+ const center = actor.x + actor.width / 2;
2305
+ const centerY = actorY + actor.height;
2306
+ const { look, theme, themeVariables } = conf2;
2307
+ const { bkgColorArray, borderColorArray } = themeVariables;
2308
+ const boxplusLineGroup = elem.append("g").lower();
2309
+ let g = boxplusLineGroup;
2310
+ if (!isFooter) {
2311
+ actorCnt++;
2312
+ if (Object.keys(actor.links || {}).length && !conf2.forceMenus) {
2313
+ g.attr("onclick", popupMenuToggle(`actor${actorCnt}_popup`)).attr("cursor", "pointer");
2314
+ }
2315
+ g.append("line").attr("id", "actor" + actorCnt).attr("x1", center).attr("y1", centerY).attr("x2", center).attr("y2", 2e3).attr("class", "actor-line 200").attr("stroke-width", "0.5px").attr("stroke", "#999").attr("name", actor.name).attr("data-et", "life-line").attr("data-id", actor.name);
2316
+ g = boxplusLineGroup.append("g");
2317
+ actor.actorCnt = actorCnt;
2318
+ if (actor.links != null) {
2319
+ g.attr("id", "root-" + actorCnt);
2320
+ }
2321
+ if (look === "neo") {
2322
+ g.attr("data-look", "neo");
2323
+ }
2324
+ }
2325
+ const rect = getNoteRect();
2326
+ let cssclass = "actor";
2327
+ if (actor.properties?.class) {
2328
+ cssclass = actor.properties.class;
2329
+ } else {
2330
+ rect.fill = "#eaeaea";
2331
+ }
2332
+ if (isFooter) {
2333
+ cssclass += ` ${BOTTOM_ACTOR_CLASS}`;
2334
+ } else {
2335
+ cssclass += ` ${TOP_ACTOR_CLASS}`;
2336
+ }
2337
+ g.attr("class", cssclass);
2338
+ rect.x = actor.x;
2339
+ rect.y = actorY;
2340
+ rect.width = actor.width;
2341
+ rect.height = actor.height;
2342
+ rect.name = actor.name;
2343
+ const ry = rect.height / 2;
2344
+ const rx = ry / (2.5 + rect.height / 50);
2345
+ const cylinderGroup = g.append("g");
2346
+ const cylinderArc = g.append("g");
2347
+ const cylinderPath = `M ${rect.x},${rect.y + ry}
2348
+ a ${rx},${ry} 0 0 0 0,${rect.height}
2349
+ h ${rect.width - 2 * rx}
2350
+ a ${rx},${ry} 0 0 0 0,-${rect.height}
2351
+ Z
2352
+ `;
2353
+ cylinderGroup.append("path").attr("d", cylinderPath);
2354
+ cylinderArc.append("path").attr(
2355
+ "d",
2356
+ `M ${rect.x},${rect.y + ry}
2357
+ a ${rx},${ry} 0 0 0 0,${rect.height}`
2358
+ );
2359
+ cylinderGroup.attr("transform", `translate(${rx}, ${-(rect.height / 2)})`);
2360
+ cylinderArc.attr("transform", `translate(${rect.width - rx}, ${-rect.height / 2})`);
2361
+ actor.rectData = rect;
2362
+ if (look === "neo") {
2363
+ cylinderGroup.attr("filter", "url(#drop-shadow)");
2364
+ }
2365
+ const actorCount = actorIndexMap.get(actor.name) ?? 0;
2366
+ if (COLOR_THEMES.has(theme)) {
2367
+ cylinderGroup.style("stroke", borderColorArray[actorCount % borderColorArray.length]);
2368
+ cylinderGroup.style("fill", bkgColorArray[actorCount % borderColorArray.length]);
2369
+ cylinderArc.style("stroke", borderColorArray[actorCount % borderColorArray.length]);
2370
+ cylinderArc.style("fill", bkgColorArray[actorCount % borderColorArray.length]);
2371
+ }
2372
+ if (actor.properties?.icon) {
2373
+ const iconSrc = actor.properties.icon.trim();
2374
+ const iconX = rect.x + rect.width - 20;
2375
+ const iconY = rect.y + 10;
2376
+ if (iconSrc.charAt(0) === "@") {
2377
+ drawEmbeddedImage(g, iconX, iconY, iconSrc.substr(1));
2378
+ } else {
2379
+ drawImage(g, iconX, iconY, iconSrc);
2380
+ }
2381
+ }
2382
+ _drawTextCandidateFunc(conf2, hasKatex(actor.description))(
2383
+ actor.description,
2384
+ g,
2385
+ rect.x,
2386
+ rect.y,
2387
+ rect.width,
2388
+ rect.height,
2389
+ { class: `actor ${ACTOR_BOX_CLASS}` },
2390
+ conf2
2391
+ );
2392
+ let height = actor.height;
2393
+ const lastPath = cylinderGroup.select("path:last-child");
2394
+ if (lastPath.node()) {
2395
+ const bounds2 = lastPath.node().getBBox();
2396
+ actor.height = bounds2.height;
2397
+ height = bounds2.height;
2398
+ }
2399
+ if (!isFooter) {
2400
+ g.attr("data-et", "participant");
2401
+ g.attr("data-type", "queue");
2402
+ g.attr("data-id", actor.name);
2403
+ }
2404
+ return height;
2405
+ }, "drawActorTypeQueue");
2406
+ var drawActorTypeControl = /* @__PURE__ */ __name(function(elem, actor, conf2, isFooter, diagramId, actorIndexMap) {
2407
+ const actorY = isFooter ? actor.stopy : actor.starty;
2408
+ const center = actor.x + actor.width / 2;
2409
+ const centerY = actorY + 75;
2410
+ const { look, theme, themeVariables } = conf2;
2411
+ const { bkgColorArray, borderColorArray, actorBorder, actorBkg } = themeVariables;
2412
+ const line = elem.append("g").lower();
2413
+ if (!isFooter) {
2414
+ actorCnt++;
2415
+ line.append("line").attr("id", "actor" + actorCnt).attr("x1", center).attr("y1", centerY).attr("x2", center).attr("y2", 2e3).attr("class", "actor-line 200").attr("stroke-width", "0.5px").attr("stroke", "#999").attr("name", actor.name).attr("data-et", "life-line").attr("data-id", actor.name);
2416
+ actor.actorCnt = actorCnt;
2417
+ }
2418
+ const actElem = elem.append("g");
2419
+ let cssClass = ACTOR_MAN_FIGURE_CLASS;
2420
+ if (isFooter) {
2421
+ cssClass += ` ${BOTTOM_ACTOR_CLASS}`;
2422
+ } else {
2423
+ cssClass += ` ${TOP_ACTOR_CLASS}`;
2424
+ }
2425
+ actElem.attr("class", cssClass);
2426
+ actElem.attr("name", actor.name);
2427
+ const rect = getNoteRect();
2428
+ rect.x = actor.x;
2429
+ rect.y = actorY;
2430
+ rect.fill = "#eaeaea";
2431
+ rect.width = actor.width;
2432
+ rect.height = actor.height;
2433
+ rect.class = "actor";
2434
+ const cx = actor.x + actor.width / 2;
2435
+ const cy = actorY + 32;
2436
+ const r = 22;
2437
+ actElem.append("defs").append("marker").attr("id", diagramId + "-filled-head-control").attr("refX", 11).attr("refY", 5.8).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "172.5").attr("stroke-width", 1.2).append("path").attr("d", "M 14.4 5.6 L 7.2 10.4 L 8.8 5.6 L 7.2 0.8 Z");
2438
+ actElem.append("circle").attr("cx", cx).attr("cy", cy).attr("r", r).attr("filter", `${look === "neo" ? "url(#drop-shadow)" : ""}`);
2439
+ actElem.append("line").attr("marker-end", "url(#" + diagramId + "-filled-head-control)").attr("transform", `translate(${cx}, ${cy - r})`);
2440
+ const actorCount = actorIndexMap.get(actor.name) ?? 0;
2441
+ if (COLOR_THEMES.has(theme)) {
2442
+ actElem.style("stroke", borderColorArray[actorCount % borderColorArray.length]);
2443
+ actElem.style("fill", bkgColorArray[actorCount % borderColorArray.length]);
2444
+ } else {
2445
+ actElem.style("stroke", actorBorder);
2446
+ actElem.style("fill", actorBkg);
2447
+ }
2448
+ const bounds2 = actElem.node().getBBox();
2449
+ actor.height = bounds2.height + 2 * (conf2?.sequence?.labelBoxHeight ?? 0);
2450
+ _drawTextCandidateFunc(conf2, hasKatex(actor.description))(
2451
+ actor.description,
2452
+ actElem,
2453
+ rect.x,
2454
+ rect.y + r + (!isFooter ? 12 : 5),
2455
+ rect.width,
2456
+ rect.height,
2457
+ { class: `actor ${ACTOR_MAN_FIGURE_CLASS}` },
2458
+ conf2
2459
+ );
2460
+ if (!isFooter) {
2461
+ actElem.attr("data-et", "participant");
2462
+ actElem.attr("data-type", "control");
2463
+ actElem.attr("data-id", actor.name);
2464
+ }
2465
+ return actor.height;
2466
+ }, "drawActorTypeControl");
2467
+ var drawActorTypeEntity = /* @__PURE__ */ __name(function(elem, actor, conf2, isFooter, actorIndexMap) {
2468
+ const actorY = isFooter ? actor.stopy : actor.starty;
2469
+ const center = actor.x + actor.width / 2;
2470
+ const centerY = actorY + 75;
2471
+ const { look, theme, themeVariables } = conf2;
2472
+ const { bkgColorArray, borderColorArray } = themeVariables;
2473
+ const line = elem.append("g").lower();
2474
+ const actElem = elem.append("g");
2475
+ let cssClass = "actor";
2476
+ if (isFooter) {
2477
+ cssClass += ` ${BOTTOM_ACTOR_CLASS}`;
2478
+ } else {
2479
+ cssClass += ` ${TOP_ACTOR_CLASS}`;
2480
+ }
2481
+ actElem.attr("class", cssClass);
2482
+ actElem.attr("name", actor.name);
2483
+ const rect = getNoteRect();
2484
+ rect.x = actor.x;
2485
+ rect.y = actorY;
2486
+ rect.fill = "#eaeaea";
2487
+ rect.width = actor.width;
2488
+ rect.height = actor.height;
2489
+ rect.class = "actor";
2490
+ const cx = actor.x + actor.width / 2;
2491
+ const cy = actorY + (!isFooter ? 25 : 10);
2492
+ const r = 22;
2493
+ actElem.append("circle").attr("cx", cx).attr("cy", cy).attr("r", r).attr("width", actor.width).attr("height", actor.height);
2494
+ actElem.append("line").attr("x1", cx - r).attr("x2", cx + r).attr("y1", cy + r).attr("y2", cy + r).attr("stroke-width", 2);
2495
+ if (look === "neo") {
2496
+ actElem.attr("filter", "url(#drop-shadow)");
2497
+ }
2498
+ const actorCount = actorIndexMap.get(actor.name) ?? 0;
2499
+ if (COLOR_THEMES.has(theme)) {
2500
+ actElem.style("stroke", borderColorArray[actorCount % borderColorArray.length]);
2501
+ actElem.style("fill", bkgColorArray[actorCount % borderColorArray.length]);
2502
+ }
2503
+ const bounds2 = actElem.node().getBBox();
2504
+ actor.height = bounds2.height + (conf2?.sequence?.labelBoxHeight ?? 0);
2505
+ if (!isFooter) {
2506
+ actorCnt++;
2507
+ line.append("line").attr("id", "actor" + actorCnt).attr("x1", center).attr("y1", centerY).attr("x2", center).attr("y2", 2e3).attr("class", "actor-line 200").attr("stroke-width", "0.5px").attr("stroke", "#999").attr("name", actor.name).attr("data-et", "life-line").attr("data-id", actor.name);
2508
+ actor.actorCnt = actorCnt;
2509
+ }
2510
+ _drawTextCandidateFunc(conf2, hasKatex(actor.description))(
2511
+ actor.description,
2512
+ actElem,
2513
+ rect.x,
2514
+ rect.y + (!isFooter ? 30 : 15),
2515
+ rect.width,
2516
+ rect.height,
2517
+ { class: `actor ${ACTOR_MAN_FIGURE_CLASS}` },
2518
+ conf2
2519
+ );
2520
+ if (!isFooter) {
2521
+ actElem.attr("transform", `translate(${0}, ${r / 2 - 5})`);
2522
+ actElem.attr("data-et", "participant");
2523
+ actElem.attr("data-type", "entity");
2524
+ actElem.attr("data-id", actor.name);
2525
+ } else {
2526
+ actElem.attr("transform", `translate(${0}, ${r})`);
2527
+ }
2528
+ return actor.height;
2529
+ }, "drawActorTypeEntity");
2530
+ var drawActorTypeDatabase = /* @__PURE__ */ __name(function(elem, actor, conf2, isFooter, actorIndexMap) {
2531
+ const actorY = isFooter ? actor.stopy : actor.starty;
2532
+ const center = actor.x + actor.width / 2;
2533
+ const centerY = actorY + actor.height + 2 * conf2.boxTextMargin;
2534
+ const { theme, themeVariables, look } = conf2;
2535
+ const { bkgColorArray, borderColorArray, actorBorder } = themeVariables;
2536
+ const boxplusLineGroup = elem.append("g").lower();
2537
+ let g = boxplusLineGroup;
2538
+ if (!isFooter) {
2539
+ actorCnt++;
2540
+ if (Object.keys(actor.links || {}).length && !conf2.forceMenus) {
2541
+ g.attr("onclick", popupMenuToggle(`actor${actorCnt}_popup`)).attr("cursor", "pointer");
2542
+ }
2543
+ g.append("line").attr("id", "actor" + actorCnt).attr("x1", center).attr("y1", centerY).attr("x2", center).attr("y2", 2e3).attr("class", "actor-line 200").attr("stroke-width", "0.5px").attr("stroke", "#999").attr("name", actor.name).attr("data-et", "life-line").attr("data-id", actor.name);
2544
+ g = boxplusLineGroup.append("g");
2545
+ actor.actorCnt = actorCnt;
2546
+ if (actor.links != null) {
2547
+ g.attr("id", "root-" + actorCnt);
2548
+ }
2549
+ if (look === "neo") {
2550
+ g.attr("data-look", "neo");
2551
+ }
2552
+ }
2553
+ const rect = getNoteRect();
2554
+ let cssclass = "actor";
2555
+ if (actor.properties?.class) {
2556
+ cssclass = actor.properties.class;
2557
+ } else {
2558
+ rect.fill = "#eaeaea";
2559
+ }
2560
+ if (isFooter) {
2561
+ cssclass += ` ${BOTTOM_ACTOR_CLASS}`;
2562
+ } else {
2563
+ cssclass += ` ${TOP_ACTOR_CLASS}`;
2564
+ }
2565
+ rect.x = actor.x;
2566
+ rect.y = actorY;
2567
+ rect.width = actor.width;
2568
+ rect.height = actor.height;
2569
+ rect.class = cssclass;
2570
+ rect.name = actor.name;
2571
+ rect.x = actor.x;
2572
+ rect.y = actorY;
2573
+ const w = rect.width / 3;
2574
+ const h = rect.width / 3;
2575
+ const rx = w / 2;
2576
+ const ry = rx / (2.5 + w / 50);
2577
+ const cylinderGroup = g.append("g");
2578
+ cylinderGroup.attr("class", cssclass);
2579
+ const d = `
2580
+ M ${rect.x},${rect.y + ry}
2581
+ a ${rx},${ry} 0 0 0 ${w},0
2582
+ a ${rx},${ry} 0 0 0 -${w},0
2583
+ l 0,${h - 2 * ry}
2584
+ a ${rx},${ry} 0 0 0 ${w},0
2585
+ l 0,-${h - 2 * ry}
2586
+ `;
2587
+ cylinderGroup.append("path").attr("d", d);
2588
+ if (look === "neo") {
2589
+ cylinderGroup.attr("filter", "url(#drop-shadow)");
2590
+ }
2591
+ const actorCount = actorIndexMap.get(actor.name) ?? 0;
2592
+ if (COLOR_THEMES.has(theme)) {
2593
+ cylinderGroup.style("stroke", borderColorArray[actorCount % borderColorArray.length]);
2594
+ cylinderGroup.style("fill", bkgColorArray[actorCount % borderColorArray.length]);
2595
+ } else {
2596
+ cylinderGroup.style("stroke", actorBorder);
2597
+ }
2598
+ cylinderGroup.attr("transform", `translate(${w}, ${ry})`);
2599
+ actor.rectData = rect;
2600
+ _drawTextCandidateFunc(conf2, hasKatex(actor.description))(
2601
+ actor.description,
2602
+ g,
2603
+ rect.x,
2604
+ rect.y + 35,
2605
+ rect.width,
2606
+ rect.height,
2607
+ { class: `actor ${ACTOR_BOX_CLASS}` },
2608
+ conf2
2609
+ );
2610
+ const lastPath = cylinderGroup.select("path:last-child");
2611
+ if (lastPath.node()) {
2612
+ const bounds2 = lastPath.node().getBBox();
2613
+ actor.height = bounds2.height + (conf2.sequence.labelBoxHeight ?? 0);
2614
+ }
2615
+ if (!isFooter) {
2616
+ g.attr("data-et", "participant");
2617
+ g.attr("data-type", "database");
2618
+ g.attr("data-id", actor.name);
2619
+ }
2620
+ return actor.height;
2621
+ }, "drawActorTypeDatabase");
2622
+ var drawActorTypeBoundary = /* @__PURE__ */ __name(function(elem, actor, conf2, isFooter, actorIndexMap) {
2623
+ const actorY = isFooter ? actor.stopy : actor.starty;
2624
+ const center = actor.x + actor.width / 2;
2625
+ const centerY = actorY + 80;
2626
+ const radius = 22;
2627
+ const line = elem.append("g").lower();
2628
+ const { look, theme, themeVariables } = conf2;
2629
+ const { bkgColorArray, borderColorArray, actorBorder } = themeVariables;
2630
+ if (!isFooter) {
2631
+ actorCnt++;
2632
+ line.append("line").attr("id", "actor" + actorCnt).attr("x1", center).attr("y1", centerY).attr("x2", center).attr("y2", 2e3).attr("class", "actor-line 200").attr("stroke-width", "0.5px").attr("stroke", "#999").attr("name", actor.name).attr("data-et", "life-line").attr("data-id", actor.name);
2633
+ actor.actorCnt = actorCnt;
2634
+ }
2635
+ const actElem = elem.append("g");
2636
+ let cssClass = ACTOR_MAN_FIGURE_CLASS;
2637
+ if (isFooter) {
2638
+ cssClass += ` ${BOTTOM_ACTOR_CLASS}`;
2639
+ } else {
2640
+ cssClass += ` ${TOP_ACTOR_CLASS}`;
2641
+ }
2642
+ actElem.attr("class", cssClass);
2643
+ actElem.attr("name", actor.name);
2644
+ const rect = getNoteRect();
2645
+ rect.x = actor.x;
2646
+ rect.y = actorY;
2647
+ rect.fill = "#eaeaea";
2648
+ rect.width = actor.width;
2649
+ rect.height = actor.height;
2650
+ rect.class = "actor";
2651
+ actElem.append("line").attr("id", "actor-man-torso" + actorCnt).attr("x1", actor.x + actor.width / 2 - radius * 2.5).attr("y1", actorY + 12).attr("x2", actor.x + actor.width / 2 - 15).attr("y2", actorY + 12);
2652
+ actElem.append("line").attr("id", "actor-man-arms" + actorCnt).attr("x1", actor.x + actor.width / 2 - radius * 2.5).attr("y1", actorY + 2).attr("x2", actor.x + actor.width / 2 - radius * 2.5).attr("y2", actorY + 22);
2653
+ actElem.append("circle").attr("cx", actor.x + actor.width / 2).attr("cy", actorY + 12).attr("r", radius);
2654
+ if (look === "neo") {
2655
+ actElem.attr("filter", "url(#drop-shadow)");
2656
+ }
2657
+ const actorCount = actorIndexMap.get(actor.name) ?? 0;
2658
+ if (COLOR_THEMES.has(theme)) {
2659
+ actElem.style("stroke", borderColorArray[actorCount % borderColorArray.length]);
2660
+ actElem.style("fill", bkgColorArray[actorCount % borderColorArray.length]);
2661
+ } else {
2662
+ actElem.style("stroke", actorBorder);
2663
+ }
2664
+ const bounds2 = actElem.node().getBBox();
2665
+ actor.height = bounds2.height + (conf2.sequence.labelBoxHeight ?? 0);
2666
+ _drawTextCandidateFunc(conf2, hasKatex(actor.description))(
2667
+ actor.description,
2668
+ actElem,
2669
+ rect.x,
2670
+ rect.y + 15,
2671
+ rect.width,
2672
+ rect.height,
2673
+ { class: `actor ${ACTOR_MAN_FIGURE_CLASS}` },
2674
+ conf2
2675
+ );
2676
+ actElem.attr("transform", `translate(0,${radius / 2 + 10})`);
2677
+ if (!isFooter) {
2678
+ actElem.attr("data-et", "participant");
2679
+ actElem.attr("data-type", "boundary");
2680
+ actElem.attr("data-id", actor.name);
2681
+ }
2682
+ return actor.height;
2683
+ }, "drawActorTypeBoundary");
2684
+ var drawActorTypeActor = /* @__PURE__ */ __name(function(elem, actor, conf2, isFooter, actorIndexMap) {
2685
+ const actorY = isFooter ? actor.stopy : actor.starty;
2686
+ const center = actor.x + actor.width / 2;
2687
+ const centerY = actorY + 80;
2688
+ const { look, theme, themeVariables } = conf2;
2689
+ const { bkgColorArray, borderColorArray, actorBorder } = themeVariables;
2690
+ const line = elem.append("g").lower();
2691
+ if (!isFooter) {
2692
+ actorCnt++;
2693
+ line.append("line").attr("id", "actor" + actorCnt).attr("x1", center).attr("y1", centerY).attr("x2", center).attr("y2", 2e3).attr("class", "actor-line 200").attr("stroke-width", "0.5px").attr("stroke", "#999").attr("name", actor.name).attr("data-et", "life-line").attr("data-id", actor.name);
2694
+ actor.actorCnt = actorCnt;
2695
+ }
2696
+ const actElem = elem.append("g");
2697
+ let cssClass = ACTOR_MAN_FIGURE_CLASS;
2698
+ if (isFooter) {
2699
+ cssClass += ` ${BOTTOM_ACTOR_CLASS}`;
2700
+ } else {
2701
+ cssClass += ` ${TOP_ACTOR_CLASS}`;
2702
+ }
2703
+ actElem.attr("class", cssClass);
2704
+ actElem.attr("name", actor.name);
2705
+ if (!isFooter) {
2706
+ actElem.attr("data-et", "participant").attr("data-type", "actor").attr("data-id", actor.name);
2707
+ }
2708
+ const scale = look === "neo" ? 0.5 : 1;
2709
+ const adjustedActorY = look === "neo" ? actorY + (1 - scale) * 30 : actorY;
2710
+ actElem.append("line").attr("id", "actor-man-torso" + actorCnt).attr("x1", center).attr("y1", adjustedActorY + 25 * scale).attr("x2", center).attr("y2", adjustedActorY + 45 * scale);
2711
+ actElem.append("line").attr("id", "actor-man-arms" + actorCnt).attr("x1", center - ACTOR_TYPE_WIDTH / 2 * scale).attr("y1", adjustedActorY + 33 * scale).attr("x2", center + ACTOR_TYPE_WIDTH / 2 * scale).attr("y2", adjustedActorY + 33 * scale);
2712
+ actElem.append("line").attr("x1", center - ACTOR_TYPE_WIDTH / 2 * scale).attr("y1", adjustedActorY + 60 * scale).attr("x2", center).attr("y2", adjustedActorY + 45 * scale);
2713
+ actElem.append("line").attr("x1", center).attr("y1", adjustedActorY + 45 * scale).attr("x2", center + (ACTOR_TYPE_WIDTH / 2 - 2) * scale).attr("y2", adjustedActorY + 60 * scale);
2714
+ const circle = actElem.append("circle");
2715
+ circle.attr("cx", actor.x + actor.width / 2);
2716
+ circle.attr("cy", adjustedActorY + 10 * scale);
2717
+ circle.attr("r", 15 * scale);
2718
+ circle.attr("width", actor.width * scale);
2719
+ circle.attr("height", actor.height * scale);
2720
+ const bounds2 = actElem.node().getBBox();
2721
+ actor.height = bounds2.height;
2722
+ const rect = getNoteRect();
2723
+ rect.x = actor.x;
2724
+ rect.y = adjustedActorY;
2725
+ rect.fill = "#eaeaea";
2726
+ rect.width = actor.width;
2727
+ rect.height = actor.height / scale;
2728
+ rect.class = "actor";
2729
+ rect.rx = 3;
2730
+ rect.ry = 3;
2731
+ const actorCount = actorIndexMap.get(actor.name) ?? 0;
2732
+ if (COLOR_THEMES.has(theme)) {
2733
+ actElem.style("stroke", borderColorArray[actorCount % borderColorArray.length]);
2734
+ actElem.style("fill", bkgColorArray[actorCount % borderColorArray.length]);
2735
+ } else {
2736
+ actElem.style("stroke", actorBorder);
2737
+ }
2738
+ _drawTextCandidateFunc(conf2, hasKatex(actor.description))(
2739
+ actor.description,
2740
+ actElem,
2741
+ rect.x,
2742
+ adjustedActorY + 35 * scale - (look === "neo" ? 10 : 0),
2743
+ rect.width,
2744
+ rect.height,
2745
+ { class: `actor ${ACTOR_MAN_FIGURE_CLASS}` },
2746
+ conf2
2747
+ );
2748
+ return actor.height;
2749
+ }, "drawActorTypeActor");
2750
+ var drawActor = /* @__PURE__ */ __name(async function(elem, actor, conf2, isFooter, diagramId, diagObj, actorIndexMap) {
2751
+ const resolvedActorIndexMap = actorIndexMap ?? new Map(
2752
+ [...diagObj.db.getActors().values()].map((participant, index) => [participant.name, index])
2753
+ );
2754
+ switch (actor.type) {
2755
+ case "actor":
2756
+ return await drawActorTypeActor(elem, actor, conf2, isFooter, resolvedActorIndexMap);
2757
+ case "participant":
2758
+ return await drawActorTypeParticipant(elem, actor, conf2, isFooter, resolvedActorIndexMap);
2759
+ case "boundary":
2760
+ return await drawActorTypeBoundary(elem, actor, conf2, isFooter, resolvedActorIndexMap);
2761
+ case "control":
2762
+ return await drawActorTypeControl(
2763
+ elem,
2764
+ actor,
2765
+ conf2,
2766
+ isFooter,
2767
+ diagramId,
2768
+ resolvedActorIndexMap
2769
+ );
2770
+ case "entity":
2771
+ return await drawActorTypeEntity(elem, actor, conf2, isFooter, resolvedActorIndexMap);
2772
+ case "database":
2773
+ return await drawActorTypeDatabase(elem, actor, conf2, isFooter, resolvedActorIndexMap);
2774
+ case "collections":
2775
+ return await drawActorTypeCollections(elem, actor, conf2, isFooter, resolvedActorIndexMap);
2776
+ case "queue":
2777
+ return await drawActorTypeQueue(elem, actor, conf2, isFooter, resolvedActorIndexMap);
2778
+ }
2779
+ }, "drawActor");
2780
+ var drawBox = /* @__PURE__ */ __name(function(elem, box, conf2) {
2781
+ const boxplusTextGroup = elem.append("g");
2782
+ const g = boxplusTextGroup;
2783
+ drawBackgroundRect2(g, box);
2784
+ if (box.name) {
2785
+ _drawTextCandidateFunc(conf2)(
2786
+ box.name,
2787
+ g,
2788
+ box.x,
2789
+ box.y + conf2.boxTextMargin + (box.textMaxHeight || 0) / 2,
2790
+ box.width,
2791
+ 0,
2792
+ { class: "text" },
2793
+ conf2
2794
+ );
2795
+ }
2796
+ g.lower();
2797
+ }, "drawBox");
2798
+ var anchorElement = /* @__PURE__ */ __name(function(elem) {
2799
+ return elem.append("g");
2800
+ }, "anchorElement");
2801
+ var drawActivation = /* @__PURE__ */ __name(function(_elem, bounds2, verticalPos, conf2, actorActivations2, diagObj, actorIndexMap) {
2802
+ const { theme, themeVariables } = conf2;
2803
+ const { bkgColorArray, borderColorArray, mainBkg } = themeVariables;
2804
+ const rect = getNoteRect();
2805
+ const g = bounds2.anchored;
2806
+ const actor = bounds2.actor;
2807
+ rect.x = bounds2.startx;
2808
+ rect.y = bounds2.starty;
2809
+ rect.class = "activation" + actorActivations2 % 3;
2810
+ rect.width = bounds2.stopx - bounds2.startx;
2811
+ rect.height = verticalPos - bounds2.starty;
2812
+ const rectElem = drawRect2(g, rect);
2813
+ const resolvedActorIndexMap = actorIndexMap ?? new Map(
2814
+ [...diagObj.db.getActors().values()].map((participant, index) => [participant.name, index])
2815
+ );
2816
+ const actorCount = resolvedActorIndexMap.get(actor) ?? 0;
2817
+ if (COLOR_THEMES.has(theme)) {
2818
+ rectElem.style("stroke", borderColorArray[actorCount % borderColorArray.length]);
2819
+ rectElem.style("fill", bkgColorArray[actorCount % borderColorArray.length] ?? mainBkg);
2820
+ }
2821
+ }, "drawActivation");
2822
+ var drawLoop = /* @__PURE__ */ __name(async function(elem, loopModel, labelText, conf2, msg) {
2823
+ const {
2824
+ boxMargin,
2825
+ boxTextMargin,
2826
+ labelBoxHeight,
2827
+ labelBoxWidth,
2828
+ messageFontFamily: fontFamily,
2829
+ messageFontSize: fontSize,
2830
+ messageFontWeight: fontWeight
2831
+ } = conf2;
2832
+ const g = elem.append("g").attr("data-et", "control-structure").attr("data-id", "i" + msg.id);
2833
+ const drawLoopLine = /* @__PURE__ */ __name(function(startx, starty, stopx, stopy) {
2834
+ return g.append("line").attr("x1", startx).attr("y1", starty).attr("x2", stopx).attr("y2", stopy).attr("class", "loopLine");
2835
+ }, "drawLoopLine");
2836
+ drawLoopLine(loopModel.startx, loopModel.starty, loopModel.stopx, loopModel.starty);
2837
+ drawLoopLine(loopModel.stopx, loopModel.starty, loopModel.stopx, loopModel.stopy);
2838
+ drawLoopLine(loopModel.startx, loopModel.stopy, loopModel.stopx, loopModel.stopy);
2839
+ drawLoopLine(loopModel.startx, loopModel.starty, loopModel.startx, loopModel.stopy);
2840
+ if (loopModel.sections !== void 0) {
2841
+ loopModel.sections.forEach(function(item) {
2842
+ drawLoopLine(loopModel.startx, item.y, loopModel.stopx, item.y).style(
2843
+ "stroke-dasharray",
2844
+ "3, 3"
2845
+ );
2846
+ });
2847
+ }
2848
+ let txt = getTextObj();
2849
+ txt.text = labelText;
2850
+ txt.x = loopModel.startx;
2851
+ txt.y = loopModel.starty;
2852
+ txt.fontFamily = fontFamily;
2853
+ txt.fontSize = fontSize;
2854
+ txt.fontWeight = fontWeight;
2855
+ txt.anchor = "middle";
2856
+ txt.valign = "middle";
2857
+ txt.tspan = false;
2858
+ txt.width = Math.max(labelBoxWidth ?? 0, 50);
2859
+ txt.height = labelBoxHeight + (conf2.look === "neo" ? 15 : 0) || 20;
2860
+ txt.textMargin = boxTextMargin;
2861
+ txt.class = "labelText";
2862
+ drawLabel(g, txt);
2863
+ txt = getTextObj2();
2864
+ txt.text = loopModel.title;
2865
+ txt.x = loopModel.startx + labelBoxWidth / 2 + (loopModel.stopx - loopModel.startx) / 2;
2866
+ txt.y = loopModel.starty + boxMargin + boxTextMargin;
2867
+ txt.anchor = "middle";
2868
+ txt.valign = "middle";
2869
+ txt.textMargin = boxTextMargin;
2870
+ txt.class = "loopText";
2871
+ txt.fontFamily = fontFamily;
2872
+ txt.fontSize = fontSize;
2873
+ txt.fontWeight = fontWeight;
2874
+ txt.wrap = true;
2875
+ let textElem = hasKatex(txt.text) ? await drawKatex(g, txt, loopModel) : drawText(g, txt);
2876
+ if (loopModel.sectionTitles !== void 0) {
2877
+ for (const [idx, item] of Object.entries(loopModel.sectionTitles)) {
2878
+ if (item.message) {
2879
+ txt.text = item.message;
2880
+ txt.x = loopModel.startx + (loopModel.stopx - loopModel.startx) / 2;
2881
+ txt.y = loopModel.sections[idx].y + boxMargin + boxTextMargin;
2882
+ txt.class = "loopText";
2883
+ txt.anchor = "middle";
2884
+ txt.valign = "middle";
2885
+ txt.tspan = false;
2886
+ txt.fontFamily = fontFamily;
2887
+ txt.fontSize = fontSize;
2888
+ txt.fontWeight = fontWeight;
2889
+ txt.wrap = loopModel.wrap;
2890
+ if (hasKatex(txt.text)) {
2891
+ loopModel.starty = loopModel.sections[idx].y;
2892
+ await drawKatex(g, txt, loopModel);
2893
+ } else {
2894
+ drawText(g, txt);
2895
+ }
2896
+ let sectionHeight = Math.round(
2897
+ textElem.map((te) => (te._groups || te)[0][0].getBBox().height).reduce((acc, curr) => acc + curr)
2898
+ );
2899
+ loopModel.sections[idx].height += sectionHeight - (boxMargin + boxTextMargin);
2900
+ }
2901
+ }
2902
+ }
2903
+ loopModel.height = Math.round(loopModel.stopy - loopModel.starty);
2904
+ return g;
2905
+ }, "drawLoop");
2906
+ var drawBackgroundRect2 = /* @__PURE__ */ __name(function(elem, bounds2) {
2907
+ drawBackgroundRect(elem, bounds2);
2908
+ }, "drawBackgroundRect");
2909
+ var insertDatabaseIcon = /* @__PURE__ */ __name(function(elem, id) {
2910
+ elem.append("defs").append("symbol").attr("id", id + "-database").attr("fill-rule", "evenodd").attr("clip-rule", "evenodd").append("path").attr("transform", "scale(.5)").attr(
2911
+ "d",
2912
+ "M12.258.001l.256.004.255.005.253.008.251.01.249.012.247.015.246.016.242.019.241.02.239.023.236.024.233.027.231.028.229.031.225.032.223.034.22.036.217.038.214.04.211.041.208.043.205.045.201.046.198.048.194.05.191.051.187.053.183.054.18.056.175.057.172.059.168.06.163.061.16.063.155.064.15.066.074.033.073.033.071.034.07.034.069.035.068.035.067.035.066.035.064.036.064.036.062.036.06.036.06.037.058.037.058.037.055.038.055.038.053.038.052.038.051.039.05.039.048.039.047.039.045.04.044.04.043.04.041.04.04.041.039.041.037.041.036.041.034.041.033.042.032.042.03.042.029.042.027.042.026.043.024.043.023.043.021.043.02.043.018.044.017.043.015.044.013.044.012.044.011.045.009.044.007.045.006.045.004.045.002.045.001.045v17l-.001.045-.002.045-.004.045-.006.045-.007.045-.009.044-.011.045-.012.044-.013.044-.015.044-.017.043-.018.044-.02.043-.021.043-.023.043-.024.043-.026.043-.027.042-.029.042-.03.042-.032.042-.033.042-.034.041-.036.041-.037.041-.039.041-.04.041-.041.04-.043.04-.044.04-.045.04-.047.039-.048.039-.05.039-.051.039-.052.038-.053.038-.055.038-.055.038-.058.037-.058.037-.06.037-.06.036-.062.036-.064.036-.064.036-.066.035-.067.035-.068.035-.069.035-.07.034-.071.034-.073.033-.074.033-.15.066-.155.064-.16.063-.163.061-.168.06-.172.059-.175.057-.18.056-.183.054-.187.053-.191.051-.194.05-.198.048-.201.046-.205.045-.208.043-.211.041-.214.04-.217.038-.22.036-.223.034-.225.032-.229.031-.231.028-.233.027-.236.024-.239.023-.241.02-.242.019-.246.016-.247.015-.249.012-.251.01-.253.008-.255.005-.256.004-.258.001-.258-.001-.256-.004-.255-.005-.253-.008-.251-.01-.249-.012-.247-.015-.245-.016-.243-.019-.241-.02-.238-.023-.236-.024-.234-.027-.231-.028-.228-.031-.226-.032-.223-.034-.22-.036-.217-.038-.214-.04-.211-.041-.208-.043-.204-.045-.201-.046-.198-.048-.195-.05-.19-.051-.187-.053-.184-.054-.179-.056-.176-.057-.172-.059-.167-.06-.164-.061-.159-.063-.155-.064-.151-.066-.074-.033-.072-.033-.072-.034-.07-.034-.069-.035-.068-.035-.067-.035-.066-.035-.064-.036-.063-.036-.062-.036-.061-.036-.06-.037-.058-.037-.057-.037-.056-.038-.055-.038-.053-.038-.052-.038-.051-.039-.049-.039-.049-.039-.046-.039-.046-.04-.044-.04-.043-.04-.041-.04-.04-.041-.039-.041-.037-.041-.036-.041-.034-.041-.033-.042-.032-.042-.03-.042-.029-.042-.027-.042-.026-.043-.024-.043-.023-.043-.021-.043-.02-.043-.018-.044-.017-.043-.015-.044-.013-.044-.012-.044-.011-.045-.009-.044-.007-.045-.006-.045-.004-.045-.002-.045-.001-.045v-17l.001-.045.002-.045.004-.045.006-.045.007-.045.009-.044.011-.045.012-.044.013-.044.015-.044.017-.043.018-.044.02-.043.021-.043.023-.043.024-.043.026-.043.027-.042.029-.042.03-.042.032-.042.033-.042.034-.041.036-.041.037-.041.039-.041.04-.041.041-.04.043-.04.044-.04.046-.04.046-.039.049-.039.049-.039.051-.039.052-.038.053-.038.055-.038.056-.038.057-.037.058-.037.06-.037.061-.036.062-.036.063-.036.064-.036.066-.035.067-.035.068-.035.069-.035.07-.034.072-.034.072-.033.074-.033.151-.066.155-.064.159-.063.164-.061.167-.06.172-.059.176-.057.179-.056.184-.054.187-.053.19-.051.195-.05.198-.048.201-.046.204-.045.208-.043.211-.041.214-.04.217-.038.22-.036.223-.034.226-.032.228-.031.231-.028.234-.027.236-.024.238-.023.241-.02.243-.019.245-.016.247-.015.249-.012.251-.01.253-.008.255-.005.256-.004.258-.001.258.001zm-9.258 20.499v.01l.001.021.003.021.004.022.005.021.006.022.007.022.009.023.01.022.011.023.012.023.013.023.015.023.016.024.017.023.018.024.019.024.021.024.022.025.023.024.024.025.052.049.056.05.061.051.066.051.07.051.075.051.079.052.084.052.088.052.092.052.097.052.102.051.105.052.11.052.114.051.119.051.123.051.127.05.131.05.135.05.139.048.144.049.147.047.152.047.155.047.16.045.163.045.167.043.171.043.176.041.178.041.183.039.187.039.19.037.194.035.197.035.202.033.204.031.209.03.212.029.216.027.219.025.222.024.226.021.23.02.233.018.236.016.24.015.243.012.246.01.249.008.253.005.256.004.259.001.26-.001.257-.004.254-.005.25-.008.247-.011.244-.012.241-.014.237-.016.233-.018.231-.021.226-.021.224-.024.22-.026.216-.027.212-.028.21-.031.205-.031.202-.034.198-.034.194-.036.191-.037.187-.039.183-.04.179-.04.175-.042.172-.043.168-.044.163-.045.16-.046.155-.046.152-.047.148-.048.143-.049.139-.049.136-.05.131-.05.126-.05.123-.051.118-.052.114-.051.11-.052.106-.052.101-.052.096-.052.092-.052.088-.053.083-.051.079-.052.074-.052.07-.051.065-.051.06-.051.056-.05.051-.05.023-.024.023-.025.021-.024.02-.024.019-.024.018-.024.017-.024.015-.023.014-.024.013-.023.012-.023.01-.023.01-.022.008-.022.006-.022.006-.022.004-.022.004-.021.001-.021.001-.021v-4.127l-.077.055-.08.053-.083.054-.085.053-.087.052-.09.052-.093.051-.095.05-.097.05-.1.049-.102.049-.105.048-.106.047-.109.047-.111.046-.114.045-.115.045-.118.044-.12.043-.122.042-.124.042-.126.041-.128.04-.13.04-.132.038-.134.038-.135.037-.138.037-.139.035-.142.035-.143.034-.144.033-.147.032-.148.031-.15.03-.151.03-.153.029-.154.027-.156.027-.158.026-.159.025-.161.024-.162.023-.163.022-.165.021-.166.02-.167.019-.169.018-.169.017-.171.016-.173.015-.173.014-.175.013-.175.012-.177.011-.178.01-.179.008-.179.008-.181.006-.182.005-.182.004-.184.003-.184.002h-.37l-.184-.002-.184-.003-.182-.004-.182-.005-.181-.006-.179-.008-.179-.008-.178-.01-.176-.011-.176-.012-.175-.013-.173-.014-.172-.015-.171-.016-.17-.017-.169-.018-.167-.019-.166-.02-.165-.021-.163-.022-.162-.023-.161-.024-.159-.025-.157-.026-.156-.027-.155-.027-.153-.029-.151-.03-.15-.03-.148-.031-.146-.032-.145-.033-.143-.034-.141-.035-.14-.035-.137-.037-.136-.037-.134-.038-.132-.038-.13-.04-.128-.04-.126-.041-.124-.042-.122-.042-.12-.044-.117-.043-.116-.045-.113-.045-.112-.046-.109-.047-.106-.047-.105-.048-.102-.049-.1-.049-.097-.05-.095-.05-.093-.052-.09-.051-.087-.052-.085-.053-.083-.054-.08-.054-.077-.054v4.127zm0-5.654v.011l.001.021.003.021.004.021.005.022.006.022.007.022.009.022.01.022.011.023.012.023.013.023.015.024.016.023.017.024.018.024.019.024.021.024.022.024.023.025.024.024.052.05.056.05.061.05.066.051.07.051.075.052.079.051.084.052.088.052.092.052.097.052.102.052.105.052.11.051.114.051.119.052.123.05.127.051.131.05.135.049.139.049.144.048.147.048.152.047.155.046.16.045.163.045.167.044.171.042.176.042.178.04.183.04.187.038.19.037.194.036.197.034.202.033.204.032.209.03.212.028.216.027.219.025.222.024.226.022.23.02.233.018.236.016.24.014.243.012.246.01.249.008.253.006.256.003.259.001.26-.001.257-.003.254-.006.25-.008.247-.01.244-.012.241-.015.237-.016.233-.018.231-.02.226-.022.224-.024.22-.025.216-.027.212-.029.21-.03.205-.032.202-.033.198-.035.194-.036.191-.037.187-.039.183-.039.179-.041.175-.042.172-.043.168-.044.163-.045.16-.045.155-.047.152-.047.148-.048.143-.048.139-.05.136-.049.131-.05.126-.051.123-.051.118-.051.114-.052.11-.052.106-.052.101-.052.096-.052.092-.052.088-.052.083-.052.079-.052.074-.051.07-.052.065-.051.06-.05.056-.051.051-.049.023-.025.023-.024.021-.025.02-.024.019-.024.018-.024.017-.024.015-.023.014-.023.013-.024.012-.022.01-.023.01-.023.008-.022.006-.022.006-.022.004-.021.004-.022.001-.021.001-.021v-4.139l-.077.054-.08.054-.083.054-.085.052-.087.053-.09.051-.093.051-.095.051-.097.05-.1.049-.102.049-.105.048-.106.047-.109.047-.111.046-.114.045-.115.044-.118.044-.12.044-.122.042-.124.042-.126.041-.128.04-.13.039-.132.039-.134.038-.135.037-.138.036-.139.036-.142.035-.143.033-.144.033-.147.033-.148.031-.15.03-.151.03-.153.028-.154.028-.156.027-.158.026-.159.025-.161.024-.162.023-.163.022-.165.021-.166.02-.167.019-.169.018-.169.017-.171.016-.173.015-.173.014-.175.013-.175.012-.177.011-.178.009-.179.009-.179.007-.181.007-.182.005-.182.004-.184.003-.184.002h-.37l-.184-.002-.184-.003-.182-.004-.182-.005-.181-.007-.179-.007-.179-.009-.178-.009-.176-.011-.176-.012-.175-.013-.173-.014-.172-.015-.171-.016-.17-.017-.169-.018-.167-.019-.166-.02-.165-.021-.163-.022-.162-.023-.161-.024-.159-.025-.157-.026-.156-.027-.155-.028-.153-.028-.151-.03-.15-.03-.148-.031-.146-.033-.145-.033-.143-.033-.141-.035-.14-.036-.137-.036-.136-.037-.134-.038-.132-.039-.13-.039-.128-.04-.126-.041-.124-.042-.122-.043-.12-.043-.117-.044-.116-.044-.113-.046-.112-.046-.109-.046-.106-.047-.105-.048-.102-.049-.1-.049-.097-.05-.095-.051-.093-.051-.09-.051-.087-.053-.085-.052-.083-.054-.08-.054-.077-.054v4.139zm0-5.666v.011l.001.02.003.022.004.021.005.022.006.021.007.022.009.023.01.022.011.023.012.023.013.023.015.023.016.024.017.024.018.023.019.024.021.025.022.024.023.024.024.025.052.05.056.05.061.05.066.051.07.051.075.052.079.051.084.052.088.052.092.052.097.052.102.052.105.051.11.052.114.051.119.051.123.051.127.05.131.05.135.05.139.049.144.048.147.048.152.047.155.046.16.045.163.045.167.043.171.043.176.042.178.04.183.04.187.038.19.037.194.036.197.034.202.033.204.032.209.03.212.028.216.027.219.025.222.024.226.021.23.02.233.018.236.017.24.014.243.012.246.01.249.008.253.006.256.003.259.001.26-.001.257-.003.254-.006.25-.008.247-.01.244-.013.241-.014.237-.016.233-.018.231-.02.226-.022.224-.024.22-.025.216-.027.212-.029.21-.03.205-.032.202-.033.198-.035.194-.036.191-.037.187-.039.183-.039.179-.041.175-.042.172-.043.168-.044.163-.045.16-.045.155-.047.152-.047.148-.048.143-.049.139-.049.136-.049.131-.051.126-.05.123-.051.118-.052.114-.051.11-.052.106-.052.101-.052.096-.052.092-.052.088-.052.083-.052.079-.052.074-.052.07-.051.065-.051.06-.051.056-.05.051-.049.023-.025.023-.025.021-.024.02-.024.019-.024.018-.024.017-.024.015-.023.014-.024.013-.023.012-.023.01-.022.01-.023.008-.022.006-.022.006-.022.004-.022.004-.021.001-.021.001-.021v-4.153l-.077.054-.08.054-.083.053-.085.053-.087.053-.09.051-.093.051-.095.051-.097.05-.1.049-.102.048-.105.048-.106.048-.109.046-.111.046-.114.046-.115.044-.118.044-.12.043-.122.043-.124.042-.126.041-.128.04-.13.039-.132.039-.134.038-.135.037-.138.036-.139.036-.142.034-.143.034-.144.033-.147.032-.148.032-.15.03-.151.03-.153.028-.154.028-.156.027-.158.026-.159.024-.161.024-.162.023-.163.023-.165.021-.166.02-.167.019-.169.018-.169.017-.171.016-.173.015-.173.014-.175.013-.175.012-.177.01-.178.01-.179.009-.179.007-.181.006-.182.006-.182.004-.184.003-.184.001-.185.001-.185-.001-.184-.001-.184-.003-.182-.004-.182-.006-.181-.006-.179-.007-.179-.009-.178-.01-.176-.01-.176-.012-.175-.013-.173-.014-.172-.015-.171-.016-.17-.017-.169-.018-.167-.019-.166-.02-.165-.021-.163-.023-.162-.023-.161-.024-.159-.024-.157-.026-.156-.027-.155-.028-.153-.028-.151-.03-.15-.03-.148-.032-.146-.032-.145-.033-.143-.034-.141-.034-.14-.036-.137-.036-.136-.037-.134-.038-.132-.039-.13-.039-.128-.041-.126-.041-.124-.041-.122-.043-.12-.043-.117-.044-.116-.044-.113-.046-.112-.046-.109-.046-.106-.048-.105-.048-.102-.048-.1-.05-.097-.049-.095-.051-.093-.051-.09-.052-.087-.052-.085-.053-.083-.053-.08-.054-.077-.054v4.153zm8.74-8.179l-.257.004-.254.005-.25.008-.247.011-.244.012-.241.014-.237.016-.233.018-.231.021-.226.022-.224.023-.22.026-.216.027-.212.028-.21.031-.205.032-.202.033-.198.034-.194.036-.191.038-.187.038-.183.04-.179.041-.175.042-.172.043-.168.043-.163.045-.16.046-.155.046-.152.048-.148.048-.143.048-.139.049-.136.05-.131.05-.126.051-.123.051-.118.051-.114.052-.11.052-.106.052-.101.052-.096.052-.092.052-.088.052-.083.052-.079.052-.074.051-.07.052-.065.051-.06.05-.056.05-.051.05-.023.025-.023.024-.021.024-.02.025-.019.024-.018.024-.017.023-.015.024-.014.023-.013.023-.012.023-.01.023-.01.022-.008.022-.006.023-.006.021-.004.022-.004.021-.001.021-.001.021.001.021.001.021.004.021.004.022.006.021.006.023.008.022.01.022.01.023.012.023.013.023.014.023.015.024.017.023.018.024.019.024.02.025.021.024.023.024.023.025.051.05.056.05.06.05.065.051.07.052.074.051.079.052.083.052.088.052.092.052.096.052.101.052.106.052.11.052.114.052.118.051.123.051.126.051.131.05.136.05.139.049.143.048.148.048.152.048.155.046.16.046.163.045.168.043.172.043.175.042.179.041.183.04.187.038.191.038.194.036.198.034.202.033.205.032.21.031.212.028.216.027.22.026.224.023.226.022.231.021.233.018.237.016.241.014.244.012.247.011.25.008.254.005.257.004.26.001.26-.001.257-.004.254-.005.25-.008.247-.011.244-.012.241-.014.237-.016.233-.018.231-.021.226-.022.224-.023.22-.026.216-.027.212-.028.21-.031.205-.032.202-.033.198-.034.194-.036.191-.038.187-.038.183-.04.179-.041.175-.042.172-.043.168-.043.163-.045.16-.046.155-.046.152-.048.148-.048.143-.048.139-.049.136-.05.131-.05.126-.051.123-.051.118-.051.114-.052.11-.052.106-.052.101-.052.096-.052.092-.052.088-.052.083-.052.079-.052.074-.051.07-.052.065-.051.06-.05.056-.05.051-.05.023-.025.023-.024.021-.024.02-.025.019-.024.018-.024.017-.023.015-.024.014-.023.013-.023.012-.023.01-.023.01-.022.008-.022.006-.023.006-.021.004-.022.004-.021.001-.021.001-.021-.001-.021-.001-.021-.004-.021-.004-.022-.006-.021-.006-.023-.008-.022-.01-.022-.01-.023-.012-.023-.013-.023-.014-.023-.015-.024-.017-.023-.018-.024-.019-.024-.02-.025-.021-.024-.023-.024-.023-.025-.051-.05-.056-.05-.06-.05-.065-.051-.07-.052-.074-.051-.079-.052-.083-.052-.088-.052-.092-.052-.096-.052-.101-.052-.106-.052-.11-.052-.114-.052-.118-.051-.123-.051-.126-.051-.131-.05-.136-.05-.139-.049-.143-.048-.148-.048-.152-.048-.155-.046-.16-.046-.163-.045-.168-.043-.172-.043-.175-.042-.179-.041-.183-.04-.187-.038-.191-.038-.194-.036-.198-.034-.202-.033-.205-.032-.21-.031-.212-.028-.216-.027-.22-.026-.224-.023-.226-.022-.231-.021-.233-.018-.237-.016-.241-.014-.244-.012-.247-.011-.25-.008-.254-.005-.257-.004-.26-.001-.26.001z"
2913
+ );
2914
+ }, "insertDatabaseIcon");
2915
+ var insertComputerIcon = /* @__PURE__ */ __name(function(elem, id) {
2916
+ elem.append("defs").append("symbol").attr("id", id + "-computer").attr("width", "24").attr("height", "24").append("path").attr("transform", "scale(.5)").attr(
2917
+ "d",
2918
+ "M2 2v13h20v-13h-20zm18 11h-16v-9h16v9zm-10.228 6l.466-1h3.524l.467 1h-4.457zm14.228 3h-24l2-6h2.104l-1.33 4h18.45l-1.297-4h2.073l2 6zm-5-10h-14v-7h14v7z"
2919
+ );
2920
+ }, "insertComputerIcon");
2921
+ var insertClockIcon = /* @__PURE__ */ __name(function(elem, id) {
2922
+ elem.append("defs").append("symbol").attr("id", id + "-clock").attr("width", "24").attr("height", "24").append("path").attr("transform", "scale(.5)").attr(
2923
+ "d",
2924
+ "M12 2c5.514 0 10 4.486 10 10s-4.486 10-10 10-10-4.486-10-10 4.486-10 10-10zm0-2c-6.627 0-12 5.373-12 12s5.373 12 12 12 12-5.373 12-12-5.373-12-12-12zm5.848 12.459c.202.038.202.333.001.372-1.907.361-6.045 1.111-6.547 1.111-.719 0-1.301-.582-1.301-1.301 0-.512.77-5.447 1.125-7.445.034-.192.312-.181.343.014l.985 6.238 5.394 1.011z"
2925
+ );
2926
+ }, "insertClockIcon");
2927
+ var insertArrowHead = /* @__PURE__ */ __name(function(elem, id) {
2928
+ elem.append("defs").append("marker").attr("id", id + "-arrowhead").attr("refX", 7.9).attr("refY", 5).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 12).attr("markerHeight", 12).attr("orient", "auto-start-reverse").append("path").attr("d", "M -1 0 L 10 5 L 0 10 z");
2929
+ }, "insertArrowHead");
2930
+ var insertArrowFilledHead = /* @__PURE__ */ __name(function(elem, id) {
2931
+ elem.append("defs").append("marker").attr("id", id + "-filled-head").attr("refX", 15.5).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");
2932
+ }, "insertArrowFilledHead");
2933
+ var insertSequenceNumber = /* @__PURE__ */ __name(function(elem, id) {
2934
+ elem.append("defs").append("marker").attr("id", id + "-sequencenumber").attr("refX", 15).attr("refY", 15).attr("markerWidth", 60).attr("markerHeight", 40).attr("orient", "auto").append("circle").attr("cx", 15).attr("cy", 15).attr("r", 6);
2935
+ }, "insertSequenceNumber");
2936
+ var insertArrowCrossHead = /* @__PURE__ */ __name(function(elem, id) {
2937
+ const defs = elem.append("defs");
2938
+ const marker = defs.append("marker").attr("id", id + "-crosshead").attr("markerWidth", 15).attr("markerHeight", 8).attr("orient", "auto").attr("refX", 4).attr("refY", 4.5);
2939
+ marker.append("path").attr("fill", "none").attr("stroke", "#000000").style("stroke-dasharray", "0, 0").attr("stroke-width", "1pt").attr("d", "M 1,2 L 6,7 M 6,2 L 1,7");
2940
+ }, "insertArrowCrossHead");
2941
+ var insertDropShadow = /* @__PURE__ */ __name(function(elem, conf2) {
2942
+ const { theme } = conf2;
2943
+ elem.append("defs").append("filter").attr("id", "drop-shadow").attr("height", "130%").attr("width", "130%").append("feDropShadow").attr("dx", "4").attr("dy", "4").attr("stdDeviation", 0).attr("flood-opacity", "0.06").attr("flood-color", `${theme === "redux" || theme === "redux-color" ? "#000000" : "#FFFFFF"}`);
2944
+ }, "insertDropShadow");
2945
+ var getTextObj2 = /* @__PURE__ */ __name(function() {
2946
+ return {
2947
+ x: 0,
2948
+ y: 0,
2949
+ fill: void 0,
2950
+ anchor: void 0,
2951
+ style: "#666",
2952
+ width: void 0,
2953
+ height: void 0,
2954
+ textMargin: 0,
2955
+ rx: 0,
2956
+ ry: 0,
2957
+ tspan: true,
2958
+ valign: void 0
2959
+ };
2960
+ }, "getTextObj");
2961
+ var getNoteRect2 = /* @__PURE__ */ __name(function() {
2962
+ return {
2963
+ x: 0,
2964
+ y: 0,
2965
+ fill: "#EDF2AE",
2966
+ stroke: "#666",
2967
+ width: 100,
2968
+ anchor: "start",
2969
+ height: 100,
2970
+ rx: 0,
2971
+ ry: 0
2972
+ };
2973
+ }, "getNoteRect");
2974
+ var _drawTextCandidateFunc = /* @__PURE__ */ function() {
2975
+ function byText(content, g, x, y, width, height, textAttrs) {
2976
+ const text = g.append("text").attr("x", x + width / 2).attr("y", y + height / 2 + 5).style("text-anchor", "middle").text(content);
2977
+ _setTextAttrs(text, textAttrs);
2978
+ }
2979
+ __name(byText, "byText");
2980
+ function byTspan(content, g, x, y, width, height, textAttrs, conf2) {
2981
+ const { actorFontSize, actorFontFamily, actorFontWeight } = conf2;
2982
+ const [_actorFontSize, _actorFontSizePx] = parseFontSize(actorFontSize);
2983
+ const lines = content.split(common_default.lineBreakRegex);
2984
+ for (let i = 0; i < lines.length; i++) {
2985
+ const dy = i * _actorFontSize - _actorFontSize * (lines.length - 1) / 2;
2986
+ const text = g.append("text").attr("x", x + width / 2).attr("y", y).style("text-anchor", "middle").style("font-size", _actorFontSizePx).style("font-weight", actorFontWeight).style("font-family", actorFontFamily);
2987
+ text.append("tspan").attr("x", x + width / 2).attr("dy", dy).text(lines[i]);
2988
+ text.attr("y", y + height / 2).attr("dominant-baseline", "central").attr("alignment-baseline", "central");
2989
+ _setTextAttrs(text, textAttrs);
2990
+ }
2991
+ }
2992
+ __name(byTspan, "byTspan");
2993
+ function byFo(content, g, x, y, width, height, textAttrs, conf2) {
2994
+ const s = g.append("switch");
2995
+ const f = s.append("foreignObject").attr("x", x).attr("y", y).attr("width", width).attr("height", height);
2996
+ const text = f.append("xhtml:div").style("display", "table").style("height", "100%").style("width", "100%");
2997
+ text.append("div").style("display", "table-cell").style("text-align", "center").style("vertical-align", "middle").text(content);
2998
+ byTspan(content, s, x, y, width, height, textAttrs, conf2);
2999
+ _setTextAttrs(text, textAttrs);
3000
+ }
3001
+ __name(byFo, "byFo");
3002
+ async function byKatex(content, g, x, y, width, height, textAttrs, conf2) {
3003
+ const dim = await calculateMathMLDimensions(content, getConfig());
3004
+ const s = g.append("switch");
3005
+ const f = s.append("foreignObject").attr("x", x + width / 2 - dim.width / 2).attr("y", y + height / 2 - dim.height / 2).attr("width", dim.width).attr("height", dim.height);
3006
+ const text = f.append("xhtml:div").style("height", "100%").style("width", "100%");
3007
+ text.append("div").style("text-align", "center").style("vertical-align", "middle").html(await renderKatexSanitized(content, getConfig()));
3008
+ byTspan(content, s, x, y, width, height, textAttrs, conf2);
3009
+ _setTextAttrs(text, textAttrs);
3010
+ }
3011
+ __name(byKatex, "byKatex");
3012
+ function _setTextAttrs(toText, fromTextAttrsDict) {
3013
+ for (const key in fromTextAttrsDict) {
3014
+ if (fromTextAttrsDict.hasOwnProperty(key)) {
3015
+ toText.attr(key, fromTextAttrsDict[key]);
3016
+ }
3017
+ }
3018
+ }
3019
+ __name(_setTextAttrs, "_setTextAttrs");
3020
+ return function(conf2, hasKatex2 = false) {
3021
+ if (hasKatex2) {
3022
+ return byKatex;
3023
+ }
3024
+ return conf2.textPlacement === "fo" ? byFo : conf2.textPlacement === "old" ? byText : byTspan;
3025
+ };
3026
+ }();
3027
+ var _drawMenuItemTextCandidateFunc = /* @__PURE__ */ function() {
3028
+ function byText(content, g, x, y, width, height, textAttrs) {
3029
+ const text = g.append("text").attr("x", x).attr("y", y).style("text-anchor", "start").text(content);
3030
+ _setTextAttrs(text, textAttrs);
3031
+ }
3032
+ __name(byText, "byText");
3033
+ function byTspan(content, g, x, y, width, height, textAttrs, conf2) {
3034
+ const { actorFontSize, actorFontFamily, actorFontWeight } = conf2;
3035
+ const lines = content.split(common_default.lineBreakRegex);
3036
+ for (let i = 0; i < lines.length; i++) {
3037
+ const dy = i * actorFontSize - actorFontSize * (lines.length - 1) / 2;
3038
+ const text = g.append("text").attr("x", x).attr("y", y).style("text-anchor", "start").style("font-size", actorFontSize).style("font-weight", actorFontWeight).style("font-family", actorFontFamily);
3039
+ text.append("tspan").attr("x", x).attr("dy", dy).text(lines[i]);
3040
+ text.attr("y", y + height / 2).attr("dominant-baseline", "central").attr("alignment-baseline", "central");
3041
+ _setTextAttrs(text, textAttrs);
3042
+ }
3043
+ }
3044
+ __name(byTspan, "byTspan");
3045
+ function byFo(content, g, x, y, width, height, textAttrs, conf2) {
3046
+ const s = g.append("switch");
3047
+ const f = s.append("foreignObject").attr("x", x).attr("y", y).attr("width", width).attr("height", height);
3048
+ const text = f.append("xhtml:div").style("display", "table").style("height", "100%").style("width", "100%");
3049
+ text.append("div").style("display", "table-cell").style("text-align", "center").style("vertical-align", "middle").text(content);
3050
+ byTspan(content, s, x, y, width, height, textAttrs, conf2);
3051
+ _setTextAttrs(text, textAttrs);
3052
+ }
3053
+ __name(byFo, "byFo");
3054
+ function _setTextAttrs(toText, fromTextAttrsDict) {
3055
+ for (const key in fromTextAttrsDict) {
3056
+ if (fromTextAttrsDict.hasOwnProperty(key)) {
3057
+ toText.attr(key, fromTextAttrsDict[key]);
3058
+ }
3059
+ }
3060
+ }
3061
+ __name(_setTextAttrs, "_setTextAttrs");
3062
+ return function(conf2) {
3063
+ return conf2.textPlacement === "fo" ? byFo : conf2.textPlacement === "old" ? byText : byTspan;
3064
+ };
3065
+ }();
3066
+ var insertSolidTopArrowHead = /* @__PURE__ */ __name(function(elem, id) {
3067
+ elem.append("defs").append("marker").attr("id", id + "-solidTopArrowHead").attr("refX", 7.9).attr("refY", 7.25).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 12).attr("markerHeight", 12).attr("orient", "auto-start-reverse").append("path").attr("d", "M 0 0 L 10 8 L 0 8 z");
3068
+ }, "insertSolidTopArrowHead");
3069
+ var insertSolidBottomArrowHead = /* @__PURE__ */ __name(function(elem, id) {
3070
+ elem.append("defs").append("marker").attr("id", id + "-solidBottomArrowHead").attr("refX", 7.9).attr("refY", 0.75).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 12).attr("markerHeight", 12).attr("orient", "auto-start-reverse").append("path").attr("d", "M 0 0 L 10 0 L 0 8 z");
3071
+ }, "insertSolidBottomArrowHead");
3072
+ var insertStickTopArrowHead = /* @__PURE__ */ __name(function(elem, id) {
3073
+ elem.append("defs").append("marker").attr("id", id + "-stickTopArrowHead").attr("refX", 7.5).attr("refY", 7).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 12).attr("markerHeight", 12).attr("orient", "auto-start-reverse").append("path").attr("d", "M 0 0 L 7 7").attr("stroke", "black").attr("stroke-width", 1.5).attr("fill", "none");
3074
+ }, "insertStickTopArrowHead");
3075
+ var insertStickBottomArrowHead = /* @__PURE__ */ __name(function(elem, id) {
3076
+ elem.append("defs").append("marker").attr("id", id + "-stickBottomArrowHead").attr("refX", 7.5).attr("refY", 0).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 12).attr("markerHeight", 12).attr("orient", "auto-start-reverse").append("path").attr("d", "M 0 7 L 7 0").attr("stroke", "black").attr("stroke-width", 1.5).attr("fill", "none");
3077
+ }, "insertStickBottomArrowHead");
3078
+ var svgDraw_default = {
3079
+ drawRect: drawRect2,
3080
+ drawText,
3081
+ drawLabel,
3082
+ drawActor,
3083
+ drawBox,
3084
+ drawPopup,
3085
+ anchorElement,
3086
+ drawActivation,
3087
+ drawLoop,
3088
+ drawBackgroundRect: drawBackgroundRect2,
3089
+ insertArrowHead,
3090
+ insertArrowFilledHead,
3091
+ insertSequenceNumber,
3092
+ insertArrowCrossHead,
3093
+ insertDatabaseIcon,
3094
+ insertComputerIcon,
3095
+ insertClockIcon,
3096
+ getTextObj: getTextObj2,
3097
+ getNoteRect: getNoteRect2,
3098
+ fixLifeLineHeights,
3099
+ sanitizeUrl: import_sanitize_url.sanitizeUrl,
3100
+ insertDropShadow,
3101
+ insertSolidTopArrowHead,
3102
+ insertSolidBottomArrowHead,
3103
+ insertStickTopArrowHead,
3104
+ insertStickBottomArrowHead
3105
+ };
3106
+ var conf = {};
3107
+ var bounds = {
3108
+ data: {
3109
+ startx: void 0,
3110
+ stopx: void 0,
3111
+ starty: void 0,
3112
+ stopy: void 0
3113
+ },
3114
+ verticalPos: 0,
3115
+ sequenceItems: [],
3116
+ activations: [],
3117
+ models: {
3118
+ getHeight: /* @__PURE__ */ __name(function() {
3119
+ return Math.max.apply(
3120
+ null,
3121
+ this.actors.length === 0 ? [0] : this.actors.map((actor) => actor.height || 0)
3122
+ ) + (this.loops.length === 0 ? 0 : this.loops.map((it) => it.height || 0).reduce((acc, h) => acc + h)) + (this.messages.length === 0 ? 0 : this.messages.map((it) => it.height || 0).reduce((acc, h) => acc + h)) + (this.notes.length === 0 ? 0 : this.notes.map((it) => it.height || 0).reduce((acc, h) => acc + h));
3123
+ }, "getHeight"),
3124
+ clear: /* @__PURE__ */ __name(function() {
3125
+ this.actors = [];
3126
+ this.boxes = [];
3127
+ this.loops = [];
3128
+ this.messages = [];
3129
+ this.notes = [];
3130
+ }, "clear"),
3131
+ addBox: /* @__PURE__ */ __name(function(boxModel) {
3132
+ this.boxes.push(boxModel);
3133
+ }, "addBox"),
3134
+ addActor: /* @__PURE__ */ __name(function(actorModel) {
3135
+ this.actors.push(actorModel);
3136
+ }, "addActor"),
3137
+ addLoop: /* @__PURE__ */ __name(function(loopModel) {
3138
+ this.loops.push(loopModel);
3139
+ }, "addLoop"),
3140
+ addMessage: /* @__PURE__ */ __name(function(msgModel) {
3141
+ this.messages.push(msgModel);
3142
+ }, "addMessage"),
3143
+ addNote: /* @__PURE__ */ __name(function(noteModel) {
3144
+ this.notes.push(noteModel);
3145
+ }, "addNote"),
3146
+ lastActor: /* @__PURE__ */ __name(function() {
3147
+ return this.actors[this.actors.length - 1];
3148
+ }, "lastActor"),
3149
+ lastLoop: /* @__PURE__ */ __name(function() {
3150
+ return this.loops[this.loops.length - 1];
3151
+ }, "lastLoop"),
3152
+ lastMessage: /* @__PURE__ */ __name(function() {
3153
+ return this.messages[this.messages.length - 1];
3154
+ }, "lastMessage"),
3155
+ lastNote: /* @__PURE__ */ __name(function() {
3156
+ return this.notes[this.notes.length - 1];
3157
+ }, "lastNote"),
3158
+ actors: [],
3159
+ boxes: [],
3160
+ loops: [],
3161
+ messages: [],
3162
+ notes: []
3163
+ },
3164
+ init: /* @__PURE__ */ __name(function() {
3165
+ this.sequenceItems = [];
3166
+ this.activations = [];
3167
+ this.models.clear();
3168
+ this.data = {
3169
+ startx: void 0,
3170
+ stopx: void 0,
3171
+ starty: void 0,
3172
+ stopy: void 0
3173
+ };
3174
+ this.verticalPos = 0;
3175
+ setConf(getConfig2());
3176
+ }, "init"),
3177
+ updateVal: /* @__PURE__ */ __name(function(obj, key, val, fun) {
3178
+ if (obj[key] === void 0) {
3179
+ obj[key] = val;
3180
+ } else {
3181
+ obj[key] = fun(val, obj[key]);
3182
+ }
3183
+ }, "updateVal"),
3184
+ updateBounds: /* @__PURE__ */ __name(function(startx, starty, stopx, stopy) {
3185
+ const _self = this;
3186
+ let cnt = 0;
3187
+ function updateFn(type) {
3188
+ return /* @__PURE__ */ __name(function updateItemBounds(item) {
3189
+ cnt++;
3190
+ const n = _self.sequenceItems.length - cnt + 1;
3191
+ _self.updateVal(item, "starty", starty - n * conf.boxMargin, Math.min);
3192
+ _self.updateVal(item, "stopy", stopy + n * conf.boxMargin, Math.max);
3193
+ _self.updateVal(bounds.data, "startx", startx - n * conf.boxMargin, Math.min);
3194
+ _self.updateVal(bounds.data, "stopx", stopx + n * conf.boxMargin, Math.max);
3195
+ if (!(type === "activation")) {
3196
+ _self.updateVal(item, "startx", startx - n * conf.boxMargin, Math.min);
3197
+ _self.updateVal(item, "stopx", stopx + n * conf.boxMargin, Math.max);
3198
+ _self.updateVal(bounds.data, "starty", starty - n * conf.boxMargin, Math.min);
3199
+ _self.updateVal(bounds.data, "stopy", stopy + n * conf.boxMargin, Math.max);
3200
+ }
3201
+ }, "updateItemBounds");
3202
+ }
3203
+ __name(updateFn, "updateFn");
3204
+ this.sequenceItems.forEach(updateFn());
3205
+ this.activations.forEach(updateFn("activation"));
3206
+ }, "updateBounds"),
3207
+ insert: /* @__PURE__ */ __name(function(startx, starty, stopx, stopy) {
3208
+ const _startx = common_default.getMin(startx, stopx);
3209
+ const _stopx = common_default.getMax(startx, stopx);
3210
+ const _starty = common_default.getMin(starty, stopy);
3211
+ const _stopy = common_default.getMax(starty, stopy);
3212
+ this.updateVal(bounds.data, "startx", _startx, Math.min);
3213
+ this.updateVal(bounds.data, "starty", _starty, Math.min);
3214
+ this.updateVal(bounds.data, "stopx", _stopx, Math.max);
3215
+ this.updateVal(bounds.data, "stopy", _stopy, Math.max);
3216
+ this.updateBounds(_startx, _starty, _stopx, _stopy);
3217
+ }, "insert"),
3218
+ newActivation: /* @__PURE__ */ __name(function(message, diagram2, actors) {
3219
+ const actorRect = actors.get(message.from);
3220
+ const stackedSize = actorActivations(message.from).length || 0;
3221
+ const x = actorRect.x + actorRect.width / 2 + (stackedSize - 1) * conf.activationWidth / 2;
3222
+ this.activations.push({
3223
+ startx: x,
3224
+ starty: this.verticalPos + 2,
3225
+ stopx: x + conf.activationWidth,
3226
+ stopy: void 0,
3227
+ actor: message.from,
3228
+ anchored: svgDraw_default.anchorElement(diagram2)
3229
+ });
3230
+ }, "newActivation"),
3231
+ endActivation: /* @__PURE__ */ __name(function(message) {
3232
+ const lastActorActivationIdx = this.activations.map(function(activation) {
3233
+ return activation.actor;
3234
+ }).lastIndexOf(message.from);
3235
+ return this.activations.splice(lastActorActivationIdx, 1)[0];
3236
+ }, "endActivation"),
3237
+ createLoop: /* @__PURE__ */ __name(function(title = { message: void 0, wrap: false, width: void 0 }, fill) {
3238
+ return {
3239
+ startx: void 0,
3240
+ starty: this.verticalPos,
3241
+ stopx: void 0,
3242
+ stopy: void 0,
3243
+ title: title.message,
3244
+ wrap: title.wrap,
3245
+ width: title.width,
3246
+ height: 0,
3247
+ fill
3248
+ };
3249
+ }, "createLoop"),
3250
+ newLoop: /* @__PURE__ */ __name(function(title = { message: void 0, wrap: false, width: void 0 }, fill) {
3251
+ this.sequenceItems.push(this.createLoop(title, fill));
3252
+ }, "newLoop"),
3253
+ endLoop: /* @__PURE__ */ __name(function() {
3254
+ return this.sequenceItems.pop();
3255
+ }, "endLoop"),
3256
+ isLoopOverlap: /* @__PURE__ */ __name(function() {
3257
+ return this.sequenceItems.length ? this.sequenceItems[this.sequenceItems.length - 1].overlap : false;
3258
+ }, "isLoopOverlap"),
3259
+ addSectionToLoop: /* @__PURE__ */ __name(function(message) {
3260
+ const loop = this.sequenceItems.pop();
3261
+ loop.sections = loop.sections || [];
3262
+ loop.sectionTitles = loop.sectionTitles || [];
3263
+ loop.sections.push({ y: bounds.getVerticalPos(), height: 0 });
3264
+ loop.sectionTitles.push(message);
3265
+ this.sequenceItems.push(loop);
3266
+ }, "addSectionToLoop"),
3267
+ saveVerticalPos: /* @__PURE__ */ __name(function() {
3268
+ if (this.isLoopOverlap()) {
3269
+ this.savedVerticalPos = this.verticalPos;
3270
+ }
3271
+ }, "saveVerticalPos"),
3272
+ resetVerticalPos: /* @__PURE__ */ __name(function() {
3273
+ if (this.isLoopOverlap()) {
3274
+ this.verticalPos = this.savedVerticalPos;
3275
+ }
3276
+ }, "resetVerticalPos"),
3277
+ bumpVerticalPos: /* @__PURE__ */ __name(function(bump) {
3278
+ this.verticalPos = this.verticalPos + bump;
3279
+ this.data.stopy = common_default.getMax(this.data.stopy, this.verticalPos);
3280
+ }, "bumpVerticalPos"),
3281
+ getVerticalPos: /* @__PURE__ */ __name(function() {
3282
+ return this.verticalPos;
3283
+ }, "getVerticalPos"),
3284
+ getBounds: /* @__PURE__ */ __name(function() {
3285
+ return { bounds: this.data, models: this.models };
3286
+ }, "getBounds")
3287
+ };
3288
+ var drawNote = /* @__PURE__ */ __name(async function(elem, noteModel, id) {
3289
+ bounds.bumpVerticalPos(conf.boxMargin);
3290
+ noteModel.height = conf.boxMargin;
3291
+ noteModel.starty = bounds.getVerticalPos();
3292
+ const rect = getNoteRect();
3293
+ rect.x = noteModel.startx;
3294
+ rect.y = noteModel.starty;
3295
+ rect.width = noteModel.width || conf.width;
3296
+ rect.class = "note";
3297
+ const g = elem.append("g");
3298
+ g.attr("data-et", "note");
3299
+ g.attr("data-id", "i" + id);
3300
+ const rectElem = svgDraw_default.drawRect(g, rect);
3301
+ const textObj = getTextObj();
3302
+ textObj.x = noteModel.startx;
3303
+ textObj.y = noteModel.starty;
3304
+ textObj.width = rect.width;
3305
+ textObj.dy = "1em";
3306
+ textObj.text = noteModel.message;
3307
+ textObj.class = "noteText";
3308
+ textObj.fontFamily = conf.noteFontFamily;
3309
+ textObj.fontSize = conf.noteFontSize;
3310
+ textObj.fontWeight = conf.noteFontWeight;
3311
+ textObj.anchor = conf.noteAlign;
3312
+ textObj.textMargin = conf.noteMargin;
3313
+ textObj.valign = "center";
3314
+ const textElem = hasKatex(textObj.text) ? await drawKatex(g, textObj) : drawText(g, textObj);
3315
+ const textHeight = Math.round(
3316
+ textElem.map((te) => (te._groups || te)[0][0].getBBox().height).reduce((acc, curr) => acc + curr)
3317
+ );
3318
+ rectElem.attr("height", textHeight + 2 * conf.noteMargin);
3319
+ noteModel.height += textHeight + 2 * conf.noteMargin;
3320
+ bounds.bumpVerticalPos(textHeight + 2 * conf.noteMargin);
3321
+ noteModel.stopy = noteModel.starty + textHeight + 2 * conf.noteMargin;
3322
+ noteModel.stopx = noteModel.startx + rect.width;
3323
+ bounds.insert(noteModel.startx, noteModel.starty, noteModel.stopx, noteModel.stopy);
3324
+ bounds.models.addNote(noteModel);
3325
+ }, "drawNote");
3326
+ var drawCentralConnection = /* @__PURE__ */ __name(function(elem, msg, msgModel, diagObj, startx, stopx, lineStartY) {
3327
+ const actors = diagObj.db.getActors();
3328
+ const fromActor = actors.get(msg.from);
3329
+ const toActor = actors.get(msg.to);
3330
+ const isAutoNumberOn = msgModel.sequenceVisible;
3331
+ let fromCenter = fromActor.x + fromActor.width / 2;
3332
+ let toCenter = toActor.x + toActor.width / 2;
3333
+ const isLeftToRight = fromCenter <= toCenter;
3334
+ const isReverse = isReverseArrowType(msg, diagObj);
3335
+ const g = elem.append("g");
3336
+ const CENTRAL_CONNECTION_CIRCLE_OFFSET = 16.5;
3337
+ const getCircleOffset = /* @__PURE__ */ __name((isLeftToRight2, isReverse2) => {
3338
+ const baseOffset = isLeftToRight2 ? CENTRAL_CONNECTION_CIRCLE_OFFSET : -CENTRAL_CONNECTION_CIRCLE_OFFSET;
3339
+ return isReverse2 ? -baseOffset : baseOffset;
3340
+ }, "getCircleOffset");
3341
+ const drawCircle = /* @__PURE__ */ __name((cx) => {
3342
+ g.append("circle").attr("cx", cx).attr("cy", lineStartY).attr("r", 5).attr("width", 10).attr("height", 10);
3343
+ }, "drawCircle");
3344
+ const { CENTRAL_CONNECTION, CENTRAL_CONNECTION_REVERSE, CENTRAL_CONNECTION_DUAL } = diagObj.db.LINETYPE;
3345
+ if (isAutoNumberOn) {
3346
+ switch (msg.centralConnection) {
3347
+ case CENTRAL_CONNECTION:
3348
+ if (isReverse) {
3349
+ toCenter += getCircleOffset(isLeftToRight, true);
3350
+ }
3351
+ break;
3352
+ case CENTRAL_CONNECTION_REVERSE:
3353
+ if (!isReverse) {
3354
+ fromCenter += getCircleOffset(isLeftToRight, false);
3355
+ }
3356
+ break;
3357
+ case CENTRAL_CONNECTION_DUAL:
3358
+ if (isReverse) {
3359
+ toCenter += getCircleOffset(isLeftToRight, true);
3360
+ } else {
3361
+ fromCenter += getCircleOffset(isLeftToRight, false);
3362
+ }
3363
+ break;
3364
+ }
3365
+ }
3366
+ switch (msg.centralConnection) {
3367
+ case CENTRAL_CONNECTION:
3368
+ drawCircle(toCenter);
3369
+ break;
3370
+ case CENTRAL_CONNECTION_REVERSE:
3371
+ drawCircle(fromCenter);
3372
+ break;
3373
+ case CENTRAL_CONNECTION_DUAL:
3374
+ drawCircle(fromCenter);
3375
+ drawCircle(toCenter);
3376
+ break;
3377
+ }
3378
+ }, "drawCentralConnection");
3379
+ var messageFont = /* @__PURE__ */ __name((cnf) => {
3380
+ return {
3381
+ fontFamily: cnf.messageFontFamily,
3382
+ fontSize: cnf.messageFontSize,
3383
+ fontWeight: cnf.messageFontWeight
3384
+ };
3385
+ }, "messageFont");
3386
+ var noteFont = /* @__PURE__ */ __name((cnf) => {
3387
+ return {
3388
+ fontFamily: cnf.noteFontFamily,
3389
+ fontSize: cnf.noteFontSize,
3390
+ fontWeight: cnf.noteFontWeight
3391
+ };
3392
+ }, "noteFont");
3393
+ var actorFont = /* @__PURE__ */ __name((cnf) => {
3394
+ return {
3395
+ fontFamily: cnf.actorFontFamily,
3396
+ fontSize: cnf.actorFontSize,
3397
+ fontWeight: cnf.actorFontWeight
3398
+ };
3399
+ }, "actorFont");
3400
+ async function boundMessage(_diagram, msgModel) {
3401
+ bounds.bumpVerticalPos(10);
3402
+ const { startx, stopx, message } = msgModel;
3403
+ const lines = common_default.splitBreaks(message).length;
3404
+ const isKatexMsg = hasKatex(message);
3405
+ const textDims = isKatexMsg ? await calculateMathMLDimensions(message, getConfig2()) : utils_default.calculateTextDimensions(message, messageFont(conf));
3406
+ if (!isKatexMsg) {
3407
+ const lineHeight = textDims.height / lines;
3408
+ msgModel.height += lineHeight;
3409
+ bounds.bumpVerticalPos(lineHeight);
3410
+ }
3411
+ let lineStartY;
3412
+ let totalOffset = textDims.height - 10;
3413
+ const textWidth = textDims.width;
3414
+ if (startx === stopx) {
3415
+ lineStartY = bounds.getVerticalPos() + totalOffset;
3416
+ if (!conf.rightAngles) {
3417
+ totalOffset += conf.boxMargin;
3418
+ lineStartY = bounds.getVerticalPos() + totalOffset;
3419
+ }
3420
+ totalOffset += 30;
3421
+ const dx = common_default.getMax(textWidth / 2, conf.width / 2);
3422
+ bounds.insert(
3423
+ startx - dx,
3424
+ bounds.getVerticalPos() - 10 + totalOffset,
3425
+ stopx + dx,
3426
+ bounds.getVerticalPos() + 30 + totalOffset
3427
+ );
3428
+ } else {
3429
+ totalOffset += conf.boxMargin;
3430
+ lineStartY = bounds.getVerticalPos() + totalOffset;
3431
+ bounds.insert(startx, lineStartY - 10, stopx, lineStartY);
3432
+ }
3433
+ bounds.bumpVerticalPos(totalOffset);
3434
+ msgModel.height += totalOffset;
3435
+ msgModel.stopy = msgModel.starty + msgModel.height;
3436
+ bounds.insert(msgModel.fromBounds, msgModel.starty, msgModel.toBounds, msgModel.stopy);
3437
+ return lineStartY;
3438
+ }
3439
+ __name(boundMessage, "boundMessage");
3440
+ var drawMessage = /* @__PURE__ */ __name(async function(diagram2, msgModel, lineStartY, diagObj, msg, diagramId) {
3441
+ const { startx, stopx, starty, message, type, sequenceIndex, sequenceVisible } = msgModel;
3442
+ const textDims = utils_default.calculateTextDimensions(message, messageFont(conf));
3443
+ const textObj = getTextObj();
3444
+ textObj.x = startx;
3445
+ textObj.y = starty + 10;
3446
+ textObj.width = stopx - startx;
3447
+ textObj.class = "messageText";
3448
+ textObj.dy = "1em";
3449
+ textObj.text = message;
3450
+ textObj.fontFamily = conf.messageFontFamily;
3451
+ textObj.fontSize = conf.messageFontSize;
3452
+ textObj.fontWeight = conf.messageFontWeight;
3453
+ textObj.anchor = conf.messageAlign;
3454
+ textObj.valign = "center";
3455
+ textObj.textMargin = conf.wrapPadding;
3456
+ textObj.tspan = false;
3457
+ if (hasKatex(textObj.text)) {
3458
+ await drawKatex(diagram2, textObj, { startx, stopx, starty: lineStartY });
3459
+ } else {
3460
+ drawText(diagram2, textObj);
3461
+ }
3462
+ const textWidth = textDims.width;
3463
+ let line;
3464
+ if (startx === stopx) {
3465
+ const isAutoNumberOn = sequenceVisible || conf.showSequenceNumbers;
3466
+ const isReverse = isReverseArrowType(msg, diagObj);
3467
+ const isBidirectional = isBidirectionalArrowType(msg, diagObj);
3468
+ const lineStartX = startx + (isAutoNumberOn && (isReverse || isBidirectional) ? 10 : 0);
3469
+ if (conf.rightAngles) {
3470
+ line = diagram2.append("path").attr(
3471
+ "d",
3472
+ `M ${lineStartX},${lineStartY} H ${startx + common_default.getMax(conf.width / 2, textWidth / 2)} V ${lineStartY + 25} H ${startx}`
3473
+ );
3474
+ } else {
3475
+ line = diagram2.append("path").attr(
3476
+ "d",
3477
+ "M " + lineStartX + "," + lineStartY + " C " + (lineStartX + 60) + "," + (lineStartY - 10) + " " + (startx + 60) + "," + (lineStartY + 30) + " " + startx + "," + (lineStartY + 20)
3478
+ );
3479
+ }
3480
+ if (hasCentralConnection(msg, diagObj)) {
3481
+ drawCentralConnection(diagram2, msg, msgModel, diagObj, startx, stopx, lineStartY);
3482
+ }
3483
+ } else {
3484
+ line = diagram2.append("line");
3485
+ line.attr("x1", startx);
3486
+ line.attr("y1", lineStartY);
3487
+ line.attr("x2", stopx);
3488
+ line.attr("y2", lineStartY);
3489
+ if (hasCentralConnection(msg, diagObj)) {
3490
+ drawCentralConnection(diagram2, msg, msgModel, diagObj, startx, stopx, lineStartY);
3491
+ }
3492
+ }
3493
+ if (type === diagObj.db.LINETYPE.DOTTED || type === diagObj.db.LINETYPE.DOTTED_CROSS || type === diagObj.db.LINETYPE.DOTTED_POINT || type === diagObj.db.LINETYPE.DOTTED_OPEN || type === diagObj.db.LINETYPE.BIDIRECTIONAL_DOTTED || type === diagObj.db.LINETYPE.SOLID_TOP_DOTTED || type === diagObj.db.LINETYPE.SOLID_BOTTOM_DOTTED || type === diagObj.db.LINETYPE.STICK_TOP_DOTTED || type === diagObj.db.LINETYPE.STICK_BOTTOM_DOTTED || type === diagObj.db.LINETYPE.SOLID_ARROW_TOP_REVERSE_DOTTED || type === diagObj.db.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE_DOTTED || type === diagObj.db.LINETYPE.STICK_ARROW_TOP_REVERSE_DOTTED || type === diagObj.db.LINETYPE.STICK_ARROW_BOTTOM_REVERSE_DOTTED) {
3494
+ line.style("stroke-dasharray", "3, 3");
3495
+ line.attr("class", "messageLine1");
3496
+ } else {
3497
+ line.attr("class", "messageLine0");
3498
+ }
3499
+ line.attr("data-et", "message");
3500
+ line.attr("data-id", "i" + msgModel.id);
3501
+ line.attr("data-from", msgModel.from);
3502
+ line.attr("data-to", msgModel.to);
3503
+ let url = "";
3504
+ if (conf.arrowMarkerAbsolute) {
3505
+ url = getUrl(true);
3506
+ }
3507
+ line.attr("stroke-width", 2);
3508
+ line.attr("stroke", "none");
3509
+ line.style("fill", "none");
3510
+ if (type === diagObj.db.LINETYPE.SOLID_TOP || type === diagObj.db.LINETYPE.SOLID_TOP_DOTTED) {
3511
+ line.attr("marker-end", "url(" + url + "#" + diagramId + "-solidTopArrowHead)");
3512
+ }
3513
+ if (type === diagObj.db.LINETYPE.SOLID_BOTTOM || type === diagObj.db.LINETYPE.SOLID_BOTTOM_DOTTED) {
3514
+ line.attr("marker-end", "url(" + url + "#" + diagramId + "-solidBottomArrowHead)");
3515
+ }
3516
+ if (type === diagObj.db.LINETYPE.STICK_TOP || type === diagObj.db.LINETYPE.STICK_TOP_DOTTED) {
3517
+ line.attr("marker-end", "url(" + url + "#" + diagramId + "-stickTopArrowHead)");
3518
+ }
3519
+ if (type === diagObj.db.LINETYPE.STICK_BOTTOM || type === diagObj.db.LINETYPE.STICK_BOTTOM_DOTTED) {
3520
+ line.attr("marker-end", "url(" + url + "#" + diagramId + "-stickBottomArrowHead)");
3521
+ }
3522
+ if (type === diagObj.db.LINETYPE.SOLID_ARROW_TOP_REVERSE || type === diagObj.db.LINETYPE.SOLID_ARROW_TOP_REVERSE_DOTTED) {
3523
+ line.attr("marker-start", "url(" + url + "#" + diagramId + "-solidBottomArrowHead)");
3524
+ }
3525
+ if (type === diagObj.db.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE || type === diagObj.db.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE_DOTTED) {
3526
+ line.attr("marker-start", "url(" + url + "#" + diagramId + "-solidTopArrowHead)");
3527
+ }
3528
+ if (type === diagObj.db.LINETYPE.STICK_ARROW_TOP_REVERSE || type === diagObj.db.LINETYPE.STICK_ARROW_TOP_REVERSE_DOTTED) {
3529
+ line.attr("marker-start", "url(" + url + "#" + diagramId + "-stickBottomArrowHead)");
3530
+ }
3531
+ if (type === diagObj.db.LINETYPE.STICK_ARROW_BOTTOM_REVERSE || type === diagObj.db.LINETYPE.STICK_ARROW_BOTTOM_REVERSE_DOTTED) {
3532
+ line.attr("marker-start", "url(" + url + "#" + diagramId + "-stickTopArrowHead)");
3533
+ }
3534
+ if (type === diagObj.db.LINETYPE.SOLID || type === diagObj.db.LINETYPE.DOTTED) {
3535
+ line.attr("marker-end", "url(" + url + "#" + diagramId + "-arrowhead)");
3536
+ }
3537
+ if (type === diagObj.db.LINETYPE.BIDIRECTIONAL_SOLID || type === diagObj.db.LINETYPE.BIDIRECTIONAL_DOTTED) {
3538
+ line.attr("marker-start", "url(" + url + "#" + diagramId + "-arrowhead)");
3539
+ line.attr("marker-end", "url(" + url + "#" + diagramId + "-arrowhead)");
3540
+ }
3541
+ if (type === diagObj.db.LINETYPE.SOLID_POINT || type === diagObj.db.LINETYPE.DOTTED_POINT) {
3542
+ line.attr("marker-end", "url(" + url + "#" + diagramId + "-filled-head)");
3543
+ }
3544
+ if (type === diagObj.db.LINETYPE.SOLID_CROSS || type === diagObj.db.LINETYPE.DOTTED_CROSS) {
3545
+ line.attr("marker-end", "url(" + url + "#" + diagramId + "-crosshead)");
3546
+ }
3547
+ if (sequenceVisible || conf.showSequenceNumbers) {
3548
+ const isBidirectional = type === diagObj.db.LINETYPE.BIDIRECTIONAL_SOLID || type === diagObj.db.LINETYPE.BIDIRECTIONAL_DOTTED;
3549
+ const isReverseArrowType2 = type === diagObj.db.LINETYPE.SOLID_ARROW_TOP_REVERSE || type === diagObj.db.LINETYPE.SOLID_ARROW_TOP_REVERSE_DOTTED || type === diagObj.db.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE || type === diagObj.db.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE_DOTTED || type === diagObj.db.LINETYPE.STICK_ARROW_TOP_REVERSE || type === diagObj.db.LINETYPE.STICK_ARROW_TOP_REVERSE_DOTTED || type === diagObj.db.LINETYPE.STICK_ARROW_BOTTOM_REVERSE || type === diagObj.db.LINETYPE.STICK_ARROW_BOTTOM_REVERSE_DOTTED;
3550
+ const SEQUENCE_NUMBER_RADIUS = 6;
3551
+ const hasCentralConn = hasCentralConnection(msg, diagObj);
3552
+ let lineStartX = startx;
3553
+ let lineStopX = stopx;
3554
+ if (isBidirectional) {
3555
+ if (startx < stopx) {
3556
+ lineStartX = startx + SEQUENCE_NUMBER_RADIUS * 2;
3557
+ } else {
3558
+ lineStartX = startx - SEQUENCE_NUMBER_RADIUS + (hasCentralConn ? -5 : 0);
3559
+ lineStartX += msg?.centralConnection === diagObj.db.LINETYPE.CENTRAL_CONNECTION_DUAL || msg?.centralConnection === diagObj.db.LINETYPE.CENTRAL_CONNECTION_REVERSE ? -7.5 : 0;
3560
+ }
3561
+ line.attr("x1", lineStartX);
3562
+ } else if (isReverseArrowType2) {
3563
+ if (stopx > startx) {
3564
+ lineStopX = stopx - 2 * SEQUENCE_NUMBER_RADIUS;
3565
+ } else {
3566
+ lineStopX = stopx - SEQUENCE_NUMBER_RADIUS;
3567
+ lineStartX += msg?.centralConnection === diagObj.db.LINETYPE.CENTRAL_CONNECTION_DUAL || msg?.centralConnection === diagObj.db.LINETYPE.CENTRAL_CONNECTION_REVERSE ? -7.5 : 0;
3568
+ }
3569
+ lineStopX += hasCentralConn ? 15 : 0;
3570
+ line.attr("x2", lineStopX);
3571
+ line.attr("x1", lineStartX);
3572
+ } else {
3573
+ line.attr("x1", startx + SEQUENCE_NUMBER_RADIUS);
3574
+ }
3575
+ let autonumberX = 0;
3576
+ const isSelfMessage = startx === stopx;
3577
+ const isLeftToRight = startx <= stopx;
3578
+ if (isSelfMessage) {
3579
+ autonumberX = msgModel.fromBounds + 1;
3580
+ } else if (isReverseArrowType2) {
3581
+ autonumberX = isLeftToRight ? msgModel.toBounds - 1 : msgModel.fromBounds + 1;
3582
+ } else {
3583
+ autonumberX = isLeftToRight ? msgModel.fromBounds + 1 : msgModel.toBounds - 1;
3584
+ }
3585
+ diagram2.append("line").attr("x1", autonumberX).attr("y1", lineStartY).attr("x2", autonumberX).attr("y2", lineStartY).attr("stroke-width", 0).attr("marker-start", "url(" + url + "#" + diagramId + "-sequencenumber)");
3586
+ diagram2.append("text").attr("x", autonumberX).attr("y", lineStartY + 4).attr("font-family", "sans-serif").attr("font-size", "12px").attr("text-anchor", "middle").attr("class", "sequenceNumber").text(sequenceIndex);
3587
+ }
3588
+ }, "drawMessage");
3589
+ var addActorRenderingData = /* @__PURE__ */ __name(function(diagram2, actors, createdActors, actorKeys, verticalPos, messages, isFooter) {
3590
+ let prevWidth = 0;
3591
+ let prevMargin = 0;
3592
+ let prevBox = void 0;
3593
+ let maxHeight = 0;
3594
+ for (const actorKey of actorKeys) {
3595
+ const actor = actors.get(actorKey);
3596
+ const box = actor.box;
3597
+ if (prevBox && prevBox != box) {
3598
+ if (!isFooter) {
3599
+ bounds.models.addBox(prevBox);
3600
+ }
3601
+ prevMargin += conf.boxMargin + prevBox.margin;
3602
+ }
3603
+ if (box && box != prevBox) {
3604
+ if (!isFooter) {
3605
+ box.x = prevWidth + prevMargin;
3606
+ box.y = verticalPos;
3607
+ }
3608
+ prevMargin += box.margin;
3609
+ }
3610
+ actor.width = common_default.getMax(actor.width || conf.width, conf.width);
3611
+ actor.height = common_default.getMax(actor.height || conf.height, conf.height);
3612
+ actor.margin = actor.margin || conf.actorMargin;
3613
+ maxHeight = common_default.getMax(maxHeight, actor.height);
3614
+ if (createdActors.get(actor.name)) {
3615
+ prevMargin += actor.width / 2;
3616
+ }
3617
+ actor.x = prevWidth + prevMargin;
3618
+ actor.starty = bounds.getVerticalPos();
3619
+ bounds.insert(actor.x, verticalPos, actor.x + actor.width, actor.height);
3620
+ prevWidth += actor.width + prevMargin;
3621
+ if (actor.box) {
3622
+ actor.box.width = prevWidth + box.margin - actor.box.x;
3623
+ }
3624
+ prevMargin = actor.margin;
3625
+ prevBox = actor.box;
3626
+ bounds.models.addActor(actor);
3627
+ }
3628
+ if (prevBox && !isFooter) {
3629
+ bounds.models.addBox(prevBox);
3630
+ }
3631
+ bounds.bumpVerticalPos(maxHeight);
3632
+ }, "addActorRenderingData");
3633
+ var drawActors = /* @__PURE__ */ __name(async function(diagram2, actors, actorKeys, isFooter, diagramId, diagObj, actorIndexMap) {
3634
+ if (!isFooter) {
3635
+ for (const actorKey of actorKeys) {
3636
+ const actor = actors.get(actorKey);
3637
+ await svgDraw_default.drawActor(diagram2, actor, conf, false, diagramId, diagObj, actorIndexMap);
3638
+ }
3639
+ } else {
3640
+ let maxHeight = 0;
3641
+ bounds.bumpVerticalPos(conf.boxMargin * 2);
3642
+ for (const actorKey of actorKeys) {
3643
+ const actor = actors.get(actorKey);
3644
+ if (!actor.stopy) {
3645
+ actor.stopy = bounds.getVerticalPos();
3646
+ }
3647
+ const height = await svgDraw_default.drawActor(
3648
+ diagram2,
3649
+ actor,
3650
+ conf,
3651
+ true,
3652
+ diagramId,
3653
+ diagObj,
3654
+ actorIndexMap
3655
+ );
3656
+ maxHeight = common_default.getMax(maxHeight, height);
3657
+ }
3658
+ bounds.bumpVerticalPos(maxHeight + conf.boxMargin);
3659
+ }
3660
+ }, "drawActors");
3661
+ var drawActorsPopup = /* @__PURE__ */ __name(function(diagram2, actors, actorKeys, doc) {
3662
+ let maxHeight = 0;
3663
+ let maxWidth = 0;
3664
+ for (const actorKey of actorKeys) {
3665
+ const actor = actors.get(actorKey);
3666
+ const minMenuWidth = getRequiredPopupWidth(actor);
3667
+ const menuDimensions = svgDraw_default.drawPopup(
3668
+ diagram2,
3669
+ actor,
3670
+ minMenuWidth,
3671
+ conf,
3672
+ conf.forceMenus,
3673
+ doc
3674
+ );
3675
+ if (menuDimensions.height > maxHeight) {
3676
+ maxHeight = menuDimensions.height;
3677
+ }
3678
+ if (menuDimensions.width + actor.x > maxWidth) {
3679
+ maxWidth = menuDimensions.width + actor.x;
3680
+ }
3681
+ }
3682
+ return { maxHeight, maxWidth };
3683
+ }, "drawActorsPopup");
3684
+ var setConf = /* @__PURE__ */ __name(function(cnf) {
3685
+ assignWithDepth_default(conf, cnf);
3686
+ if (cnf.fontFamily) {
3687
+ conf.actorFontFamily = conf.noteFontFamily = conf.messageFontFamily = cnf.fontFamily;
3688
+ }
3689
+ if (cnf.fontSize) {
3690
+ conf.actorFontSize = conf.noteFontSize = conf.messageFontSize = cnf.fontSize;
3691
+ }
3692
+ if (cnf.fontWeight) {
3693
+ conf.actorFontWeight = conf.noteFontWeight = conf.messageFontWeight = cnf.fontWeight;
3694
+ }
3695
+ }, "setConf");
3696
+ var actorActivations = /* @__PURE__ */ __name(function(actor) {
3697
+ return bounds.activations.filter(function(activation) {
3698
+ return activation.actor === actor;
3699
+ });
3700
+ }, "actorActivations");
3701
+ var activationBounds = /* @__PURE__ */ __name(function(actor, actors) {
3702
+ const actorObj = actors.get(actor);
3703
+ const activations = actorActivations(actor);
3704
+ const left = activations.reduce(
3705
+ function(acc, activation) {
3706
+ return common_default.getMin(acc, activation.startx);
3707
+ },
3708
+ actorObj.x + actorObj.width / 2 - 1
3709
+ );
3710
+ const right = activations.reduce(
3711
+ function(acc, activation) {
3712
+ return common_default.getMax(acc, activation.stopx);
3713
+ },
3714
+ actorObj.x + actorObj.width / 2 + 1
3715
+ );
3716
+ return [left, right];
3717
+ }, "activationBounds");
3718
+ function adjustLoopHeightForWrap(loopWidths, msg, preMargin, postMargin, addLoopFn) {
3719
+ bounds.bumpVerticalPos(preMargin);
3720
+ let heightAdjust = postMargin;
3721
+ if (msg.id && msg.message && loopWidths[msg.id]) {
3722
+ const loopWidth = loopWidths[msg.id].width;
3723
+ const textConf = messageFont(conf);
3724
+ msg.message = utils_default.wrapLabel(`[${msg.message}]`, loopWidth - 2 * conf.wrapPadding, textConf);
3725
+ msg.width = loopWidth;
3726
+ msg.wrap = true;
3727
+ const textDims = utils_default.calculateTextDimensions(msg.message, textConf);
3728
+ const totalOffset = common_default.getMax(textDims.height, conf.labelBoxHeight);
3729
+ heightAdjust = postMargin + totalOffset;
3730
+ log.debug(`${totalOffset} - ${msg.message}`);
3731
+ }
3732
+ addLoopFn(msg);
3733
+ bounds.bumpVerticalPos(heightAdjust);
3734
+ }
3735
+ __name(adjustLoopHeightForWrap, "adjustLoopHeightForWrap");
3736
+ function adjustCreatedDestroyedData(msg, msgModel, lineStartY, index, actors, createdActors, destroyedActors) {
3737
+ function receiverAdjustment(actor, adjustment) {
3738
+ if (actor.x < actors.get(msg.from).x) {
3739
+ bounds.insert(
3740
+ msgModel.stopx - adjustment,
3741
+ msgModel.starty,
3742
+ msgModel.startx,
3743
+ msgModel.stopy + actor.height / 2 + conf.noteMargin
3744
+ );
3745
+ msgModel.stopx = msgModel.stopx + adjustment;
3746
+ } else {
3747
+ bounds.insert(
3748
+ msgModel.startx,
3749
+ msgModel.starty,
3750
+ msgModel.stopx + adjustment,
3751
+ msgModel.stopy + actor.height / 2 + conf.noteMargin
3752
+ );
3753
+ msgModel.stopx = msgModel.stopx - adjustment;
3754
+ }
3755
+ }
3756
+ __name(receiverAdjustment, "receiverAdjustment");
3757
+ function senderAdjustment(actor, adjustment) {
3758
+ if (actor.x < actors.get(msg.to).x) {
3759
+ bounds.insert(
3760
+ msgModel.startx - adjustment,
3761
+ msgModel.starty,
3762
+ msgModel.stopx,
3763
+ msgModel.stopy + actor.height / 2 + conf.noteMargin
3764
+ );
3765
+ msgModel.startx = msgModel.startx + adjustment;
3766
+ } else {
3767
+ bounds.insert(
3768
+ msgModel.stopx,
3769
+ msgModel.starty,
3770
+ msgModel.startx + adjustment,
3771
+ msgModel.stopy + actor.height / 2 + conf.noteMargin
3772
+ );
3773
+ msgModel.startx = msgModel.startx - adjustment;
3774
+ }
3775
+ }
3776
+ __name(senderAdjustment, "senderAdjustment");
3777
+ const actorArray = [
3778
+ PARTICIPANT_TYPE.ACTOR,
3779
+ PARTICIPANT_TYPE.CONTROL,
3780
+ PARTICIPANT_TYPE.ENTITY,
3781
+ PARTICIPANT_TYPE.DATABASE
3782
+ ];
3783
+ if (createdActors.get(msg.to) == index) {
3784
+ const actor = actors.get(msg.to);
3785
+ const adjustment = actorArray.includes(actor.type) ? ACTOR_TYPE_WIDTH / 2 + 3 : actor.width / 2 + 3;
3786
+ receiverAdjustment(actor, adjustment);
3787
+ actor.starty = lineStartY - actor.height / 2;
3788
+ bounds.bumpVerticalPos(actor.height / 2);
3789
+ } else if (destroyedActors.get(msg.from) == index) {
3790
+ const actor = actors.get(msg.from);
3791
+ if (conf.mirrorActors) {
3792
+ const adjustment = actorArray.includes(actor.type) ? ACTOR_TYPE_WIDTH / 2 : actor.width / 2;
3793
+ senderAdjustment(actor, adjustment);
3794
+ }
3795
+ actor.stopy = lineStartY - actor.height / 2;
3796
+ bounds.bumpVerticalPos(actor.height / 2);
3797
+ } else if (destroyedActors.get(msg.to) == index) {
3798
+ const actor = actors.get(msg.to);
3799
+ if (conf.mirrorActors) {
3800
+ const adjustment = actorArray.includes(actor.type) ? ACTOR_TYPE_WIDTH / 2 + 3 : actor.width / 2 + 3;
3801
+ receiverAdjustment(actor, adjustment);
3802
+ }
3803
+ actor.stopy = lineStartY - actor.height / 2;
3804
+ bounds.bumpVerticalPos(actor.height / 2);
3805
+ }
3806
+ }
3807
+ __name(adjustCreatedDestroyedData, "adjustCreatedDestroyedData");
3808
+ var draw = /* @__PURE__ */ __name(async function(_text, id, _version, diagObj) {
3809
+ const { securityLevel, sequence, look } = getConfig2();
3810
+ conf = sequence;
3811
+ let sandboxElement;
3812
+ if (securityLevel === "sandbox") {
3813
+ sandboxElement = select_default("#i" + id);
3814
+ }
3815
+ const root = securityLevel === "sandbox" ? select_default(sandboxElement.nodes()[0].contentDocument.body) : select_default("body");
3816
+ const doc = securityLevel === "sandbox" ? sandboxElement.nodes()[0].contentDocument : document;
3817
+ bounds.init();
3818
+ log.debug(diagObj.db);
3819
+ const diagram2 = securityLevel === "sandbox" ? root.select(`[id="${id}"]`) : select_default(`[id="${id}"]`);
3820
+ const actors = diagObj.db.getActors();
3821
+ const createdActors = diagObj.db.getCreatedActors();
3822
+ const destroyedActors = diagObj.db.getDestroyedActors();
3823
+ const boxes = diagObj.db.getBoxes();
3824
+ let actorKeys = diagObj.db.getActorKeys();
3825
+ const messages = diagObj.db.getMessages();
3826
+ const title = diagObj.db.getDiagramTitle();
3827
+ const hasBoxes = diagObj.db.hasAtLeastOneBox();
3828
+ const hasBoxTitles = diagObj.db.hasAtLeastOneBoxWithTitle();
3829
+ const maxMessageWidthPerActor = await getMaxMessageWidthPerActor(actors, messages, diagObj);
3830
+ conf.height = await calculateActorMargins(actors, maxMessageWidthPerActor, boxes);
3831
+ svgDraw_default.insertComputerIcon(diagram2, id);
3832
+ svgDraw_default.insertDatabaseIcon(diagram2, id);
3833
+ svgDraw_default.insertClockIcon(diagram2, id);
3834
+ if (hasBoxes) {
3835
+ bounds.bumpVerticalPos(conf.boxMargin);
3836
+ if (hasBoxTitles) {
3837
+ bounds.bumpVerticalPos(boxes[0].textMaxHeight);
3838
+ }
3839
+ }
3840
+ if (conf.hideUnusedParticipants === true) {
3841
+ const newActors = /* @__PURE__ */ new Set();
3842
+ messages.forEach((message) => {
3843
+ newActors.add(message.from);
3844
+ newActors.add(message.to);
3845
+ });
3846
+ actorKeys = actorKeys.filter((actorKey) => newActors.has(actorKey));
3847
+ }
3848
+ const actorIndexMap = new Map(
3849
+ actorKeys.map((actorKey, index2) => [actors.get(actorKey)?.name ?? actorKey, index2])
3850
+ );
3851
+ addActorRenderingData(diagram2, actors, createdActors, actorKeys, 0, messages, false);
3852
+ const loopWidths = await calculateLoopBounds(messages, actors, maxMessageWidthPerActor, diagObj);
3853
+ svgDraw_default.insertArrowHead(diagram2, id);
3854
+ svgDraw_default.insertArrowCrossHead(diagram2, id);
3855
+ svgDraw_default.insertArrowFilledHead(diagram2, id);
3856
+ svgDraw_default.insertSequenceNumber(diagram2, id);
3857
+ svgDraw_default.insertSolidTopArrowHead(diagram2, id);
3858
+ svgDraw_default.insertSolidBottomArrowHead(diagram2, id);
3859
+ svgDraw_default.insertStickTopArrowHead(diagram2, id);
3860
+ svgDraw_default.insertStickBottomArrowHead(diagram2, id);
3861
+ if (look === "neo") {
3862
+ svgDraw_default.insertDropShadow(diagram2, conf);
3863
+ }
3864
+ function activeEnd(msg, verticalPos) {
3865
+ const activationData = bounds.endActivation(msg);
3866
+ if (activationData.starty + 18 > verticalPos) {
3867
+ activationData.starty = verticalPos - 6;
3868
+ verticalPos += 12;
3869
+ }
3870
+ svgDraw_default.drawActivation(
3871
+ diagram2,
3872
+ activationData,
3873
+ verticalPos,
3874
+ conf,
3875
+ actorActivations(msg.from).length,
3876
+ diagObj,
3877
+ actorIndexMap
3878
+ );
3879
+ bounds.insert(activationData.startx, verticalPos - 10, activationData.stopx, verticalPos);
3880
+ }
3881
+ __name(activeEnd, "activeEnd");
3882
+ let sequenceIndex = 1;
3883
+ let sequenceIndexStep = 1;
3884
+ const messagesToDraw = [];
3885
+ const backgrounds = [];
3886
+ let index = 0;
3887
+ for (const msg of messages) {
3888
+ let loopModel, noteModel, msgModel;
3889
+ switch (msg.type) {
3890
+ case diagObj.db.LINETYPE.NOTE:
3891
+ bounds.resetVerticalPos();
3892
+ noteModel = msg.noteModel;
3893
+ await drawNote(diagram2, noteModel, msg.id);
3894
+ break;
3895
+ case diagObj.db.LINETYPE.ACTIVE_START:
3896
+ bounds.newActivation(msg, diagram2, actors);
3897
+ break;
3898
+ case diagObj.db.LINETYPE.CENTRAL_CONNECTION:
3899
+ bounds.newActivation(msg, diagram2, actors);
3900
+ break;
3901
+ case diagObj.db.LINETYPE.CENTRAL_CONNECTION_REVERSE:
3902
+ bounds.newActivation(msg, diagram2, actors);
3903
+ break;
3904
+ case diagObj.db.LINETYPE.ACTIVE_END:
3905
+ activeEnd(msg, bounds.getVerticalPos());
3906
+ break;
3907
+ case diagObj.db.LINETYPE.LOOP_START:
3908
+ adjustLoopHeightForWrap(
3909
+ loopWidths,
3910
+ msg,
3911
+ conf.boxMargin,
3912
+ conf.boxMargin + conf.boxTextMargin,
3913
+ (message) => bounds.newLoop(message)
3914
+ );
3915
+ break;
3916
+ case diagObj.db.LINETYPE.LOOP_END:
3917
+ loopModel = bounds.endLoop();
3918
+ await svgDraw_default.drawLoop(diagram2, loopModel, "loop", conf, msg);
3919
+ bounds.bumpVerticalPos(loopModel.stopy - bounds.getVerticalPos());
3920
+ bounds.models.addLoop(loopModel);
3921
+ break;
3922
+ case diagObj.db.LINETYPE.RECT_START:
3923
+ adjustLoopHeightForWrap(
3924
+ loopWidths,
3925
+ msg,
3926
+ conf.boxMargin,
3927
+ conf.boxMargin,
3928
+ (message) => bounds.newLoop(void 0, message.message)
3929
+ );
3930
+ break;
3931
+ case diagObj.db.LINETYPE.RECT_END:
3932
+ loopModel = bounds.endLoop();
3933
+ backgrounds.push(loopModel);
3934
+ bounds.models.addLoop(loopModel);
3935
+ bounds.bumpVerticalPos(loopModel.stopy - bounds.getVerticalPos());
3936
+ break;
3937
+ case diagObj.db.LINETYPE.OPT_START:
3938
+ adjustLoopHeightForWrap(
3939
+ loopWidths,
3940
+ msg,
3941
+ conf.boxMargin,
3942
+ conf.boxMargin + conf.boxTextMargin,
3943
+ (message) => bounds.newLoop(message)
3944
+ );
3945
+ break;
3946
+ case diagObj.db.LINETYPE.OPT_END:
3947
+ loopModel = bounds.endLoop();
3948
+ await svgDraw_default.drawLoop(diagram2, loopModel, "opt", conf, msg);
3949
+ bounds.bumpVerticalPos(loopModel.stopy - bounds.getVerticalPos());
3950
+ bounds.models.addLoop(loopModel);
3951
+ break;
3952
+ case diagObj.db.LINETYPE.ALT_START:
3953
+ adjustLoopHeightForWrap(
3954
+ loopWidths,
3955
+ msg,
3956
+ conf.boxMargin,
3957
+ conf.boxMargin + conf.boxTextMargin,
3958
+ (message) => bounds.newLoop(message)
3959
+ );
3960
+ break;
3961
+ case diagObj.db.LINETYPE.ALT_ELSE:
3962
+ adjustLoopHeightForWrap(
3963
+ loopWidths,
3964
+ msg,
3965
+ conf.boxMargin + conf.boxTextMargin,
3966
+ conf.boxMargin,
3967
+ (message) => bounds.addSectionToLoop(message)
3968
+ );
3969
+ break;
3970
+ case diagObj.db.LINETYPE.ALT_END:
3971
+ loopModel = bounds.endLoop();
3972
+ await svgDraw_default.drawLoop(diagram2, loopModel, "alt", conf, msg);
3973
+ bounds.bumpVerticalPos(loopModel.stopy - bounds.getVerticalPos());
3974
+ bounds.models.addLoop(loopModel);
3975
+ break;
3976
+ case diagObj.db.LINETYPE.PAR_START:
3977
+ case diagObj.db.LINETYPE.PAR_OVER_START:
3978
+ adjustLoopHeightForWrap(
3979
+ loopWidths,
3980
+ msg,
3981
+ conf.boxMargin,
3982
+ conf.boxMargin + conf.boxTextMargin,
3983
+ (message) => bounds.newLoop(message)
3984
+ );
3985
+ bounds.saveVerticalPos();
3986
+ break;
3987
+ case diagObj.db.LINETYPE.PAR_AND:
3988
+ adjustLoopHeightForWrap(
3989
+ loopWidths,
3990
+ msg,
3991
+ conf.boxMargin + conf.boxTextMargin,
3992
+ conf.boxMargin,
3993
+ (message) => bounds.addSectionToLoop(message)
3994
+ );
3995
+ break;
3996
+ case diagObj.db.LINETYPE.PAR_END:
3997
+ loopModel = bounds.endLoop();
3998
+ await svgDraw_default.drawLoop(diagram2, loopModel, "par", conf, msg);
3999
+ bounds.bumpVerticalPos(loopModel.stopy - bounds.getVerticalPos());
4000
+ bounds.models.addLoop(loopModel);
4001
+ break;
4002
+ case diagObj.db.LINETYPE.AUTONUMBER:
4003
+ sequenceIndex = msg.message.start || sequenceIndex;
4004
+ sequenceIndexStep = msg.message.step || sequenceIndexStep;
4005
+ if (msg.message.visible) {
4006
+ diagObj.db.enableSequenceNumbers();
4007
+ } else {
4008
+ diagObj.db.disableSequenceNumbers();
4009
+ }
4010
+ break;
4011
+ case diagObj.db.LINETYPE.CRITICAL_START:
4012
+ adjustLoopHeightForWrap(
4013
+ loopWidths,
4014
+ msg,
4015
+ conf.boxMargin,
4016
+ conf.boxMargin + conf.boxTextMargin,
4017
+ (message) => bounds.newLoop(message)
4018
+ );
4019
+ break;
4020
+ case diagObj.db.LINETYPE.CRITICAL_OPTION:
4021
+ adjustLoopHeightForWrap(
4022
+ loopWidths,
4023
+ msg,
4024
+ conf.boxMargin + conf.boxTextMargin,
4025
+ conf.boxMargin,
4026
+ (message) => bounds.addSectionToLoop(message)
4027
+ );
4028
+ break;
4029
+ case diagObj.db.LINETYPE.CRITICAL_END:
4030
+ loopModel = bounds.endLoop();
4031
+ await svgDraw_default.drawLoop(diagram2, loopModel, "critical", conf, msg);
4032
+ bounds.bumpVerticalPos(loopModel.stopy - bounds.getVerticalPos());
4033
+ bounds.models.addLoop(loopModel);
4034
+ break;
4035
+ case diagObj.db.LINETYPE.BREAK_START:
4036
+ adjustLoopHeightForWrap(
4037
+ loopWidths,
4038
+ msg,
4039
+ conf.boxMargin,
4040
+ conf.boxMargin + conf.boxTextMargin,
4041
+ (message) => bounds.newLoop(message)
4042
+ );
4043
+ break;
4044
+ case diagObj.db.LINETYPE.BREAK_END:
4045
+ loopModel = bounds.endLoop();
4046
+ await svgDraw_default.drawLoop(diagram2, loopModel, "break", conf, msg);
4047
+ bounds.bumpVerticalPos(loopModel.stopy - bounds.getVerticalPos());
4048
+ bounds.models.addLoop(loopModel);
4049
+ break;
4050
+ default:
4051
+ try {
4052
+ msgModel = msg.msgModel;
4053
+ msgModel.starty = bounds.getVerticalPos();
4054
+ msgModel.sequenceIndex = sequenceIndex;
4055
+ msgModel.sequenceVisible = diagObj.db.showSequenceNumbers();
4056
+ msgModel.id = msg.id;
4057
+ msgModel.from = msg.from;
4058
+ msgModel.to = msg.to;
4059
+ const lineStartY = await boundMessage(diagram2, msgModel);
4060
+ adjustCreatedDestroyedData(
4061
+ msg,
4062
+ msgModel,
4063
+ lineStartY,
4064
+ index,
4065
+ actors,
4066
+ createdActors,
4067
+ destroyedActors
4068
+ );
4069
+ messagesToDraw.push({ messageModel: msgModel, lineStartY, msg });
4070
+ bounds.models.addMessage(msgModel);
4071
+ } catch (e) {
4072
+ log.error("error while drawing message", e);
4073
+ }
4074
+ }
4075
+ if ([
4076
+ diagObj.db.LINETYPE.SOLID_OPEN,
4077
+ diagObj.db.LINETYPE.DOTTED_OPEN,
4078
+ diagObj.db.LINETYPE.SOLID,
4079
+ diagObj.db.LINETYPE.SOLID_TOP,
4080
+ diagObj.db.LINETYPE.SOLID_BOTTOM,
4081
+ diagObj.db.LINETYPE.STICK_TOP,
4082
+ diagObj.db.LINETYPE.STICK_BOTTOM,
4083
+ diagObj.db.LINETYPE.SOLID_TOP_DOTTED,
4084
+ diagObj.db.LINETYPE.SOLID_BOTTOM_DOTTED,
4085
+ diagObj.db.LINETYPE.STICK_TOP_DOTTED,
4086
+ diagObj.db.LINETYPE.STICK_BOTTOM_DOTTED,
4087
+ diagObj.db.LINETYPE.SOLID_ARROW_TOP_REVERSE,
4088
+ diagObj.db.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE,
4089
+ diagObj.db.LINETYPE.STICK_ARROW_TOP_REVERSE,
4090
+ diagObj.db.LINETYPE.STICK_ARROW_BOTTOM_REVERSE,
4091
+ diagObj.db.LINETYPE.SOLID_ARROW_TOP_REVERSE_DOTTED,
4092
+ diagObj.db.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE_DOTTED,
4093
+ diagObj.db.LINETYPE.STICK_ARROW_TOP_REVERSE_DOTTED,
4094
+ diagObj.db.LINETYPE.STICK_ARROW_BOTTOM_REVERSE_DOTTED,
4095
+ diagObj.db.LINETYPE.DOTTED,
4096
+ diagObj.db.LINETYPE.SOLID_CROSS,
4097
+ diagObj.db.LINETYPE.DOTTED_CROSS,
4098
+ diagObj.db.LINETYPE.SOLID_POINT,
4099
+ diagObj.db.LINETYPE.DOTTED_POINT,
4100
+ diagObj.db.LINETYPE.BIDIRECTIONAL_SOLID,
4101
+ diagObj.db.LINETYPE.BIDIRECTIONAL_DOTTED
4102
+ ].includes(msg.type)) {
4103
+ sequenceIndex = sequenceIndex + sequenceIndexStep;
4104
+ }
4105
+ index++;
4106
+ }
4107
+ log.debug("createdActors", createdActors);
4108
+ log.debug("destroyedActors", destroyedActors);
4109
+ await drawActors(diagram2, actors, actorKeys, false, id, diagObj, actorIndexMap);
4110
+ for (const e of messagesToDraw) {
4111
+ await drawMessage(diagram2, e.messageModel, e.lineStartY, diagObj, e.msg, id);
4112
+ }
4113
+ if (conf.mirrorActors) {
4114
+ await drawActors(diagram2, actors, actorKeys, true, id, diagObj, actorIndexMap);
4115
+ }
4116
+ backgrounds.forEach((e) => svgDraw_default.drawBackgroundRect(diagram2, e));
4117
+ fixLifeLineHeights(diagram2, actors, actorKeys, conf);
4118
+ for (const box2 of bounds.models.boxes) {
4119
+ box2.height = bounds.getVerticalPos() - box2.y;
4120
+ bounds.insert(box2.x, box2.y, box2.x + box2.width, box2.height);
4121
+ const boxPadding = conf.boxMargin * 2;
4122
+ box2.startx = box2.x - boxPadding;
4123
+ box2.starty = box2.y - boxPadding * 0.25;
4124
+ box2.stopx = box2.startx + box2.width + 2 * boxPadding;
4125
+ box2.stopy = box2.starty + box2.height + boxPadding * 0.75;
4126
+ box2.stroke = "rgb(0,0,0, 0.5)";
4127
+ svgDraw_default.drawBox(diagram2, box2, conf);
4128
+ }
4129
+ if (hasBoxes) {
4130
+ bounds.bumpVerticalPos(conf.boxMargin);
4131
+ }
4132
+ const requiredBoxSize = drawActorsPopup(diagram2, actors, actorKeys, doc);
4133
+ const { bounds: box } = bounds.getBounds();
4134
+ if (box.startx === void 0) {
4135
+ box.startx = 0;
4136
+ }
4137
+ if (box.starty === void 0) {
4138
+ box.starty = 0;
4139
+ }
4140
+ if (box.stopx === void 0) {
4141
+ box.stopx = 0;
4142
+ }
4143
+ if (box.stopy === void 0) {
4144
+ box.stopy = 0;
4145
+ }
4146
+ let boxHeight = box.stopy - box.starty;
4147
+ if (boxHeight < requiredBoxSize.maxHeight) {
4148
+ boxHeight = requiredBoxSize.maxHeight;
4149
+ }
4150
+ let height = boxHeight + 2 * conf.diagramMarginY;
4151
+ if (conf.mirrorActors) {
4152
+ height = height - conf.boxMargin + conf.bottomMarginAdj;
4153
+ }
4154
+ let boxWidth = box.stopx - box.startx;
4155
+ if (boxWidth < requiredBoxSize.maxWidth) {
4156
+ boxWidth = requiredBoxSize.maxWidth;
4157
+ }
4158
+ const width = boxWidth + 2 * conf.diagramMarginX;
4159
+ if (title) {
4160
+ diagram2.append("text").text(title).attr("x", (box.stopx - box.startx) / 2 - 2 * conf.diagramMarginX).attr("y", -25);
4161
+ }
4162
+ configureSvgSize(diagram2, height, width, conf.useMaxWidth);
4163
+ const extraVertForTitle = title ? 40 : 0;
4164
+ const extraHeightForNeoActors = actors.size && look === "neo" ? 30 : 0;
4165
+ diagram2.attr(
4166
+ "viewBox",
4167
+ box.startx - conf.diagramMarginX + " -" + (conf.diagramMarginY + extraVertForTitle) + " " + width + " " + (height + extraVertForTitle + extraHeightForNeoActors)
4168
+ );
4169
+ log.debug(`models:`, bounds.models);
4170
+ }, "draw");
4171
+ async function getMaxMessageWidthPerActor(actors, messages, diagObj) {
4172
+ const maxMessageWidthPerActor = {};
4173
+ for (const msg of messages) {
4174
+ if (actors.get(msg.to) && actors.get(msg.from)) {
4175
+ const actor = actors.get(msg.to);
4176
+ if (msg.placement === diagObj.db.PLACEMENT.LEFTOF && !actor.prevActor) {
4177
+ continue;
4178
+ }
4179
+ if (msg.placement === diagObj.db.PLACEMENT.RIGHTOF && !actor.nextActor) {
4180
+ continue;
4181
+ }
4182
+ const isNote = msg.placement !== void 0;
4183
+ const isMessage = !isNote;
4184
+ const textFont = isNote ? noteFont(conf) : messageFont(conf);
4185
+ const wrappedMessage = msg.wrap ? utils_default.wrapLabel(msg.message, conf.width - 2 * conf.wrapPadding, textFont) : msg.message;
4186
+ const messageDimensions = hasKatex(wrappedMessage) ? await calculateMathMLDimensions(msg.message, getConfig2()) : utils_default.calculateTextDimensions(wrappedMessage, textFont);
4187
+ const messageWidth = messageDimensions.width + 2 * conf.wrapPadding;
4188
+ if (isMessage && msg.from === actor.nextActor) {
4189
+ maxMessageWidthPerActor[msg.to] = common_default.getMax(
4190
+ maxMessageWidthPerActor[msg.to] || 0,
4191
+ messageWidth
4192
+ );
4193
+ } else if (isMessage && msg.from === actor.prevActor) {
4194
+ maxMessageWidthPerActor[msg.from] = common_default.getMax(
4195
+ maxMessageWidthPerActor[msg.from] || 0,
4196
+ messageWidth
4197
+ );
4198
+ } else if (isMessage && msg.from === msg.to) {
4199
+ maxMessageWidthPerActor[msg.from] = common_default.getMax(
4200
+ maxMessageWidthPerActor[msg.from] || 0,
4201
+ messageWidth / 2
4202
+ );
4203
+ maxMessageWidthPerActor[msg.to] = common_default.getMax(
4204
+ maxMessageWidthPerActor[msg.to] || 0,
4205
+ messageWidth / 2
4206
+ );
4207
+ } else if (msg.placement === diagObj.db.PLACEMENT.RIGHTOF) {
4208
+ maxMessageWidthPerActor[msg.from] = common_default.getMax(
4209
+ maxMessageWidthPerActor[msg.from] || 0,
4210
+ messageWidth
4211
+ );
4212
+ } else if (msg.placement === diagObj.db.PLACEMENT.LEFTOF) {
4213
+ maxMessageWidthPerActor[actor.prevActor] = common_default.getMax(
4214
+ maxMessageWidthPerActor[actor.prevActor] || 0,
4215
+ messageWidth
4216
+ );
4217
+ } else if (msg.placement === diagObj.db.PLACEMENT.OVER) {
4218
+ if (actor.prevActor) {
4219
+ maxMessageWidthPerActor[actor.prevActor] = common_default.getMax(
4220
+ maxMessageWidthPerActor[actor.prevActor] || 0,
4221
+ messageWidth / 2
4222
+ );
4223
+ }
4224
+ if (actor.nextActor) {
4225
+ maxMessageWidthPerActor[msg.from] = common_default.getMax(
4226
+ maxMessageWidthPerActor[msg.from] || 0,
4227
+ messageWidth / 2
4228
+ );
4229
+ }
4230
+ }
4231
+ }
4232
+ }
4233
+ log.debug("maxMessageWidthPerActor:", maxMessageWidthPerActor);
4234
+ return maxMessageWidthPerActor;
4235
+ }
4236
+ __name(getMaxMessageWidthPerActor, "getMaxMessageWidthPerActor");
4237
+ var getRequiredPopupWidth = /* @__PURE__ */ __name(function(actor) {
4238
+ let requiredPopupWidth = 0;
4239
+ const textFont = actorFont(conf);
4240
+ for (const key in actor.links) {
4241
+ const labelDimensions = utils_default.calculateTextDimensions(key, textFont);
4242
+ const labelWidth = labelDimensions.width + 2 * conf.wrapPadding + 2 * conf.boxMargin;
4243
+ if (requiredPopupWidth < labelWidth) {
4244
+ requiredPopupWidth = labelWidth;
4245
+ }
4246
+ }
4247
+ return requiredPopupWidth;
4248
+ }, "getRequiredPopupWidth");
4249
+ async function calculateActorMargins(actors, actorToMessageWidth, boxes) {
4250
+ let maxHeight = 0;
4251
+ for (const prop of actors.keys()) {
4252
+ const actor = actors.get(prop);
4253
+ if (actor.wrap) {
4254
+ actor.description = utils_default.wrapLabel(
4255
+ actor.description,
4256
+ conf.width - 2 * conf.wrapPadding,
4257
+ actorFont(conf)
4258
+ );
4259
+ }
4260
+ const actDims = hasKatex(actor.description) ? await calculateMathMLDimensions(actor.description, getConfig2()) : utils_default.calculateTextDimensions(actor.description, actorFont(conf));
4261
+ actor.width = actor.wrap ? conf.width : common_default.getMax(conf.width, actDims.width + 2 * conf.wrapPadding);
4262
+ actor.height = actor.wrap ? common_default.getMax(actDims.height, conf.height) : conf.height;
4263
+ maxHeight = common_default.getMax(maxHeight, actor.height);
4264
+ }
4265
+ for (const actorKey in actorToMessageWidth) {
4266
+ const actor = actors.get(actorKey);
4267
+ if (!actor) {
4268
+ continue;
4269
+ }
4270
+ const nextActor = actors.get(actor.nextActor);
4271
+ if (!nextActor) {
4272
+ const messageWidth2 = actorToMessageWidth[actorKey];
4273
+ const actorWidth2 = messageWidth2 + conf.actorMargin - actor.width / 2;
4274
+ actor.margin = common_default.getMax(actorWidth2, conf.actorMargin);
4275
+ continue;
4276
+ }
4277
+ const messageWidth = actorToMessageWidth[actorKey];
4278
+ const actorWidth = messageWidth + conf.actorMargin - actor.width / 2 - nextActor.width / 2;
4279
+ actor.margin = common_default.getMax(actorWidth, conf.actorMargin);
4280
+ }
4281
+ let maxBoxHeight = 0;
4282
+ boxes.forEach((box) => {
4283
+ const textFont = messageFont(conf);
4284
+ let totalWidth = box.actorKeys.reduce((total, aKey) => {
4285
+ return total += actors.get(aKey).width + (actors.get(aKey).margin || 0);
4286
+ }, 0);
4287
+ const standardBoxPadding = conf.boxMargin * 8;
4288
+ totalWidth += standardBoxPadding;
4289
+ totalWidth -= 2 * conf.boxTextMargin;
4290
+ if (box.wrap) {
4291
+ box.name = utils_default.wrapLabel(box.name, totalWidth - 2 * conf.wrapPadding, textFont);
4292
+ }
4293
+ const boxMsgDimensions = utils_default.calculateTextDimensions(box.name, textFont);
4294
+ maxBoxHeight = common_default.getMax(boxMsgDimensions.height, maxBoxHeight);
4295
+ const minWidth = common_default.getMax(totalWidth, boxMsgDimensions.width + 2 * conf.wrapPadding);
4296
+ box.margin = conf.boxTextMargin;
4297
+ if (totalWidth < minWidth) {
4298
+ const missing = (minWidth - totalWidth) / 2;
4299
+ box.margin += missing;
4300
+ }
4301
+ });
4302
+ boxes.forEach((box) => box.textMaxHeight = maxBoxHeight);
4303
+ return common_default.getMax(maxHeight, conf.height);
4304
+ }
4305
+ __name(calculateActorMargins, "calculateActorMargins");
4306
+ var buildNoteModel = /* @__PURE__ */ __name(async function(msg, actors, diagObj) {
4307
+ const fromActor = actors.get(msg.from);
4308
+ const toActor = actors.get(msg.to);
4309
+ const startx = fromActor.x;
4310
+ const stopx = toActor.x;
4311
+ const shouldWrap = msg.wrap && msg.message;
4312
+ let textDimensions = hasKatex(msg.message) ? await calculateMathMLDimensions(msg.message, getConfig2()) : utils_default.calculateTextDimensions(
4313
+ shouldWrap ? utils_default.wrapLabel(msg.message, conf.width, noteFont(conf)) : msg.message,
4314
+ noteFont(conf)
4315
+ );
4316
+ const noteModel = {
4317
+ width: shouldWrap ? conf.width : common_default.getMax(conf.width, textDimensions.width + 2 * conf.noteMargin),
4318
+ height: 0,
4319
+ startx: fromActor.x,
4320
+ stopx: 0,
4321
+ starty: 0,
4322
+ stopy: 0,
4323
+ message: msg.message
4324
+ };
4325
+ if (msg.placement === diagObj.db.PLACEMENT.RIGHTOF) {
4326
+ noteModel.width = shouldWrap ? common_default.getMax(conf.width, textDimensions.width) : common_default.getMax(
4327
+ fromActor.width / 2 + toActor.width / 2,
4328
+ textDimensions.width + 2 * conf.noteMargin
4329
+ );
4330
+ noteModel.startx = startx + (fromActor.width + conf.actorMargin) / 2;
4331
+ } else if (msg.placement === diagObj.db.PLACEMENT.LEFTOF) {
4332
+ noteModel.width = shouldWrap ? common_default.getMax(conf.width, textDimensions.width + 2 * conf.noteMargin) : common_default.getMax(
4333
+ fromActor.width / 2 + toActor.width / 2,
4334
+ textDimensions.width + 2 * conf.noteMargin
4335
+ );
4336
+ noteModel.startx = startx - noteModel.width + (fromActor.width - conf.actorMargin) / 2;
4337
+ } else if (msg.to === msg.from) {
4338
+ textDimensions = utils_default.calculateTextDimensions(
4339
+ shouldWrap ? utils_default.wrapLabel(msg.message, common_default.getMax(conf.width, fromActor.width), noteFont(conf)) : msg.message,
4340
+ noteFont(conf)
4341
+ );
4342
+ noteModel.width = shouldWrap ? common_default.getMax(conf.width, fromActor.width) : common_default.getMax(fromActor.width, conf.width, textDimensions.width + 2 * conf.noteMargin);
4343
+ noteModel.startx = startx + (fromActor.width - noteModel.width) / 2;
4344
+ } else {
4345
+ noteModel.width = Math.abs(startx + fromActor.width / 2 - (stopx + toActor.width / 2)) + conf.actorMargin;
4346
+ noteModel.startx = startx < stopx ? startx + fromActor.width / 2 - conf.actorMargin / 2 : stopx + toActor.width / 2 - conf.actorMargin / 2;
4347
+ }
4348
+ if (shouldWrap) {
4349
+ noteModel.message = utils_default.wrapLabel(
4350
+ msg.message,
4351
+ noteModel.width - 2 * conf.wrapPadding,
4352
+ noteFont(conf)
4353
+ );
4354
+ }
4355
+ log.debug(
4356
+ `NM:[${noteModel.startx},${noteModel.stopx},${noteModel.starty},${noteModel.stopy}:${noteModel.width},${noteModel.height}=${msg.message}]`
4357
+ );
4358
+ return noteModel;
4359
+ }, "buildNoteModel");
4360
+ var CENTRAL_CONNECTION_BASE_OFFSET = 4;
4361
+ var CENTRAL_CONNECTION_BIDIRECTIONAL_OFFSET = 6;
4362
+ var hasCentralConnection = /* @__PURE__ */ __name(function(msg, diagObj) {
4363
+ const { CENTRAL_CONNECTION, CENTRAL_CONNECTION_REVERSE, CENTRAL_CONNECTION_DUAL } = diagObj.db.LINETYPE;
4364
+ return [CENTRAL_CONNECTION, CENTRAL_CONNECTION_REVERSE, CENTRAL_CONNECTION_DUAL].includes(
4365
+ msg.centralConnection
4366
+ );
4367
+ }, "hasCentralConnection");
4368
+ var calculateCentralConnectionOffset = /* @__PURE__ */ __name(function(msg, diagObj, isArrowToRight) {
4369
+ const {
4370
+ CENTRAL_CONNECTION_REVERSE,
4371
+ CENTRAL_CONNECTION_DUAL,
4372
+ BIDIRECTIONAL_SOLID,
4373
+ BIDIRECTIONAL_DOTTED
4374
+ } = diagObj.db.LINETYPE;
4375
+ let offset = 0;
4376
+ if (msg.centralConnection === CENTRAL_CONNECTION_REVERSE || msg.centralConnection === CENTRAL_CONNECTION_DUAL) {
4377
+ offset += CENTRAL_CONNECTION_BASE_OFFSET;
4378
+ }
4379
+ if ((msg.centralConnection === CENTRAL_CONNECTION_REVERSE || msg.centralConnection === CENTRAL_CONNECTION_DUAL) && (msg.type === BIDIRECTIONAL_SOLID || msg.type === BIDIRECTIONAL_DOTTED)) {
4380
+ offset += isArrowToRight ? 0 : -CENTRAL_CONNECTION_BIDIRECTIONAL_OFFSET;
4381
+ }
4382
+ return offset;
4383
+ }, "calculateCentralConnectionOffset");
4384
+ var isReverseArrowType = /* @__PURE__ */ __name(function(msg, diagObj) {
4385
+ const {
4386
+ SOLID_ARROW_TOP_REVERSE,
4387
+ SOLID_ARROW_TOP_REVERSE_DOTTED,
4388
+ SOLID_ARROW_BOTTOM_REVERSE,
4389
+ SOLID_ARROW_BOTTOM_REVERSE_DOTTED,
4390
+ STICK_ARROW_TOP_REVERSE,
4391
+ STICK_ARROW_TOP_REVERSE_DOTTED,
4392
+ STICK_ARROW_BOTTOM_REVERSE,
4393
+ STICK_ARROW_BOTTOM_REVERSE_DOTTED
4394
+ } = diagObj.db.LINETYPE;
4395
+ return [
4396
+ SOLID_ARROW_TOP_REVERSE,
4397
+ SOLID_ARROW_TOP_REVERSE_DOTTED,
4398
+ SOLID_ARROW_BOTTOM_REVERSE,
4399
+ SOLID_ARROW_BOTTOM_REVERSE_DOTTED,
4400
+ STICK_ARROW_TOP_REVERSE,
4401
+ STICK_ARROW_TOP_REVERSE_DOTTED,
4402
+ STICK_ARROW_BOTTOM_REVERSE,
4403
+ STICK_ARROW_BOTTOM_REVERSE_DOTTED
4404
+ ].includes(msg.type);
4405
+ }, "isReverseArrowType");
4406
+ var isBidirectionalArrowType = /* @__PURE__ */ __name(function(msg, diagObj) {
4407
+ const { BIDIRECTIONAL_SOLID, BIDIRECTIONAL_DOTTED } = diagObj.db.LINETYPE;
4408
+ return [BIDIRECTIONAL_SOLID, BIDIRECTIONAL_DOTTED].includes(msg.type);
4409
+ }, "isBidirectionalArrowType");
4410
+ var buildMessageModel = /* @__PURE__ */ __name(function(msg, actors, diagObj) {
4411
+ const { look } = getConfig2();
4412
+ if (![
4413
+ diagObj.db.LINETYPE.SOLID_OPEN,
4414
+ diagObj.db.LINETYPE.DOTTED_OPEN,
4415
+ diagObj.db.LINETYPE.SOLID,
4416
+ diagObj.db.LINETYPE.SOLID_TOP,
4417
+ diagObj.db.LINETYPE.SOLID_BOTTOM,
4418
+ diagObj.db.LINETYPE.STICK_TOP,
4419
+ diagObj.db.LINETYPE.STICK_BOTTOM,
4420
+ diagObj.db.LINETYPE.SOLID_TOP_DOTTED,
4421
+ diagObj.db.LINETYPE.SOLID_BOTTOM_DOTTED,
4422
+ diagObj.db.LINETYPE.STICK_TOP_DOTTED,
4423
+ diagObj.db.LINETYPE.STICK_BOTTOM_DOTTED,
4424
+ diagObj.db.LINETYPE.SOLID_ARROW_TOP_REVERSE,
4425
+ diagObj.db.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE,
4426
+ diagObj.db.LINETYPE.STICK_ARROW_TOP_REVERSE,
4427
+ diagObj.db.LINETYPE.STICK_ARROW_BOTTOM_REVERSE,
4428
+ diagObj.db.LINETYPE.SOLID_ARROW_TOP_REVERSE_DOTTED,
4429
+ diagObj.db.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE_DOTTED,
4430
+ diagObj.db.LINETYPE.STICK_ARROW_TOP_REVERSE_DOTTED,
4431
+ diagObj.db.LINETYPE.STICK_ARROW_BOTTOM_REVERSE_DOTTED,
4432
+ diagObj.db.LINETYPE.DOTTED,
4433
+ diagObj.db.LINETYPE.SOLID_CROSS,
4434
+ diagObj.db.LINETYPE.DOTTED_CROSS,
4435
+ diagObj.db.LINETYPE.SOLID_POINT,
4436
+ diagObj.db.LINETYPE.DOTTED_POINT,
4437
+ diagObj.db.LINETYPE.BIDIRECTIONAL_SOLID,
4438
+ diagObj.db.LINETYPE.BIDIRECTIONAL_DOTTED
4439
+ ].includes(msg.type)) {
4440
+ return {};
4441
+ }
4442
+ const [fromLeft, fromRight] = activationBounds(msg.from, actors);
4443
+ const [toLeft, toRight] = activationBounds(msg.to, actors);
4444
+ const isArrowToRight = fromLeft <= toLeft;
4445
+ let startx = isArrowToRight ? fromRight : fromLeft;
4446
+ let stopx = isArrowToRight ? toLeft : toRight;
4447
+ if (look === "neo") {
4448
+ const offset = 3;
4449
+ if (msg.type !== diagObj.db.LINETYPE.SOLID_OPEN) {
4450
+ stopx += isArrowToRight ? -offset : offset;
4451
+ }
4452
+ if (msg.type === diagObj.db.LINETYPE.BIDIRECTIONAL_SOLID || msg.type === diagObj.db.LINETYPE.BIDIRECTIONAL_DOTTED) {
4453
+ startx += isArrowToRight ? offset : -offset;
4454
+ }
4455
+ }
4456
+ startx += calculateCentralConnectionOffset(msg, diagObj, isArrowToRight);
4457
+ const isArrowToActivation = Math.abs(toLeft - toRight) > 2;
4458
+ const adjustValue = /* @__PURE__ */ __name((value) => {
4459
+ return isArrowToRight ? -value : value;
4460
+ }, "adjustValue");
4461
+ if (msg.from === msg.to) {
4462
+ stopx = startx;
4463
+ } else {
4464
+ if (msg.activate && !isArrowToActivation) {
4465
+ stopx += adjustValue(conf.activationWidth / 2 - 1);
4466
+ }
4467
+ if (![
4468
+ diagObj.db.LINETYPE.SOLID_OPEN,
4469
+ diagObj.db.LINETYPE.DOTTED_OPEN,
4470
+ diagObj.db.LINETYPE.STICK_TOP,
4471
+ diagObj.db.LINETYPE.STICK_BOTTOM,
4472
+ diagObj.db.LINETYPE.STICK_TOP_DOTTED,
4473
+ diagObj.db.LINETYPE.STICK_BOTTOM_DOTTED,
4474
+ diagObj.db.LINETYPE.SOLID_ARROW_TOP_REVERSE_DOTTED,
4475
+ diagObj.db.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE_DOTTED,
4476
+ diagObj.db.LINETYPE.STICK_ARROW_TOP_REVERSE,
4477
+ diagObj.db.LINETYPE.STICK_ARROW_BOTTOM_REVERSE,
4478
+ diagObj.db.LINETYPE.STICK_ARROW_TOP_REVERSE_DOTTED,
4479
+ diagObj.db.LINETYPE.STICK_ARROW_BOTTOM_REVERSE_DOTTED,
4480
+ diagObj.db.LINETYPE.SOLID_ARROW_TOP_REVERSE,
4481
+ diagObj.db.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE
4482
+ ].includes(msg.type)) {
4483
+ stopx += adjustValue(3);
4484
+ }
4485
+ if ([
4486
+ diagObj.db.LINETYPE.BIDIRECTIONAL_SOLID,
4487
+ diagObj.db.LINETYPE.BIDIRECTIONAL_DOTTED,
4488
+ diagObj.db.LINETYPE.SOLID_ARROW_TOP_REVERSE_DOTTED,
4489
+ diagObj.db.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE_DOTTED,
4490
+ diagObj.db.LINETYPE.SOLID_ARROW_TOP_REVERSE,
4491
+ diagObj.db.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE
4492
+ ].includes(msg.type)) {
4493
+ startx -= adjustValue(3);
4494
+ }
4495
+ }
4496
+ const allBounds = [fromLeft, fromRight, toLeft, toRight];
4497
+ const boundedWidth = Math.abs(startx - stopx);
4498
+ if (msg.wrap && msg.message) {
4499
+ msg.message = utils_default.wrapLabel(
4500
+ msg.message,
4501
+ common_default.getMax(boundedWidth + 2 * conf.wrapPadding, conf.width),
4502
+ messageFont(conf)
4503
+ );
4504
+ }
4505
+ const msgDims = utils_default.calculateTextDimensions(msg.message, messageFont(conf));
4506
+ return {
4507
+ width: common_default.getMax(
4508
+ msg.wrap ? 0 : msgDims.width + 2 * conf.wrapPadding,
4509
+ boundedWidth + 2 * conf.wrapPadding,
4510
+ conf.width
4511
+ ),
4512
+ height: 0,
4513
+ startx,
4514
+ stopx,
4515
+ starty: 0,
4516
+ stopy: 0,
4517
+ message: msg.message,
4518
+ type: msg.type,
4519
+ wrap: msg.wrap,
4520
+ fromBounds: Math.min.apply(null, allBounds),
4521
+ toBounds: Math.max.apply(null, allBounds)
4522
+ };
4523
+ }, "buildMessageModel");
4524
+ var calculateLoopBounds = /* @__PURE__ */ __name(async function(messages, actors, _maxWidthPerActor, diagObj) {
4525
+ const loops = {};
4526
+ const stack = [];
4527
+ let current, noteModel, msgModel;
4528
+ for (const msg of messages) {
4529
+ switch (msg.type) {
4530
+ case diagObj.db.LINETYPE.LOOP_START:
4531
+ case diagObj.db.LINETYPE.ALT_START:
4532
+ case diagObj.db.LINETYPE.OPT_START:
4533
+ case diagObj.db.LINETYPE.PAR_START:
4534
+ case diagObj.db.LINETYPE.PAR_OVER_START:
4535
+ case diagObj.db.LINETYPE.CRITICAL_START:
4536
+ case diagObj.db.LINETYPE.BREAK_START:
4537
+ stack.push({
4538
+ id: msg.id,
4539
+ msg: msg.message,
4540
+ from: Number.MAX_SAFE_INTEGER,
4541
+ to: Number.MIN_SAFE_INTEGER,
4542
+ width: 0
4543
+ });
4544
+ break;
4545
+ case diagObj.db.LINETYPE.ALT_ELSE:
4546
+ case diagObj.db.LINETYPE.PAR_AND:
4547
+ case diagObj.db.LINETYPE.CRITICAL_OPTION:
4548
+ if (msg.message) {
4549
+ current = stack.pop();
4550
+ loops[current.id] = current;
4551
+ loops[msg.id] = current;
4552
+ stack.push(current);
4553
+ }
4554
+ break;
4555
+ case diagObj.db.LINETYPE.LOOP_END:
4556
+ case diagObj.db.LINETYPE.ALT_END:
4557
+ case diagObj.db.LINETYPE.OPT_END:
4558
+ case diagObj.db.LINETYPE.PAR_END:
4559
+ case diagObj.db.LINETYPE.CRITICAL_END:
4560
+ case diagObj.db.LINETYPE.BREAK_END:
4561
+ current = stack.pop();
4562
+ loops[current.id] = current;
4563
+ break;
4564
+ case diagObj.db.LINETYPE.ACTIVE_START:
4565
+ {
4566
+ const actorRect = actors.get(msg.from ? msg.from : msg.to.actor);
4567
+ const stackedSize = actorActivations(msg.from ? msg.from : msg.to.actor).length;
4568
+ const x = actorRect.x + actorRect.width / 2 + (stackedSize - 1) * conf.activationWidth / 2;
4569
+ const toAdd = {
4570
+ startx: x,
4571
+ stopx: x + conf.activationWidth,
4572
+ actor: msg.from,
4573
+ enabled: true
4574
+ };
4575
+ bounds.activations.push(toAdd);
4576
+ }
4577
+ break;
4578
+ case diagObj.db.LINETYPE.ACTIVE_END:
4579
+ {
4580
+ const lastActorActivationIdx = bounds.activations.map((a) => a.actor).lastIndexOf(msg.from);
4581
+ bounds.activations.splice(lastActorActivationIdx, 1).splice(0, 1);
4582
+ }
4583
+ break;
4584
+ }
4585
+ const isNote = msg.placement !== void 0;
4586
+ if (isNote) {
4587
+ noteModel = await buildNoteModel(msg, actors, diagObj);
4588
+ msg.noteModel = noteModel;
4589
+ stack.forEach((stk) => {
4590
+ current = stk;
4591
+ current.from = common_default.getMin(current.from, noteModel.startx);
4592
+ current.to = common_default.getMax(current.to, noteModel.startx + noteModel.width);
4593
+ current.width = common_default.getMax(current.width, Math.abs(current.from - current.to)) - conf.labelBoxWidth;
4594
+ });
4595
+ } else {
4596
+ msgModel = buildMessageModel(msg, actors, diagObj);
4597
+ msg.msgModel = msgModel;
4598
+ if (msgModel.startx && msgModel.stopx && stack.length > 0) {
4599
+ stack.forEach((stk) => {
4600
+ current = stk;
4601
+ if (msgModel.startx === msgModel.stopx) {
4602
+ const from = actors.get(msg.from);
4603
+ const to = actors.get(msg.to);
4604
+ current.from = common_default.getMin(
4605
+ from.x - msgModel.width / 2,
4606
+ from.x - from.width / 2,
4607
+ current.from
4608
+ );
4609
+ current.to = common_default.getMax(
4610
+ to.x + msgModel.width / 2,
4611
+ to.x + from.width / 2,
4612
+ current.to
4613
+ );
4614
+ current.width = common_default.getMax(current.width, Math.abs(current.to - current.from)) - conf.labelBoxWidth;
4615
+ } else {
4616
+ current.from = common_default.getMin(msgModel.startx, current.from);
4617
+ current.to = common_default.getMax(msgModel.stopx, current.to);
4618
+ current.width = common_default.getMax(current.width, msgModel.width) - conf.labelBoxWidth;
4619
+ }
4620
+ });
4621
+ }
4622
+ }
4623
+ }
4624
+ bounds.activations = [];
4625
+ log.debug("Loop type widths:", loops);
4626
+ return loops;
4627
+ }, "calculateLoopBounds");
4628
+ var sequenceRenderer_default = {
4629
+ bounds,
4630
+ drawActors,
4631
+ drawActorsPopup,
4632
+ setConf,
4633
+ draw
4634
+ };
4635
+ var diagram = {
4636
+ parser: sequenceDiagram_default,
4637
+ get db() {
4638
+ return new SequenceDB();
4639
+ },
4640
+ renderer: sequenceRenderer_default,
4641
+ styles: styles_default,
4642
+ init: /* @__PURE__ */ __name((cnf) => {
4643
+ if (!cnf.sequence) {
4644
+ cnf.sequence = {};
4645
+ }
4646
+ if (cnf.wrap) {
4647
+ cnf.sequence.wrap = cnf.wrap;
4648
+ setConfig2({ sequence: { wrap: cnf.wrap } });
4649
+ }
4650
+ }, "init")
4651
+ };
4652
+ export {
4653
+ diagram
4654
+ };
4655
+ //# sourceMappingURL=sequenceDiagram-FGHM5R23-3IWTOUNQ.js.map