local-operator-ui 0.12.7 → 0.13.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 (143) hide show
  1. package/out/main/index.jsc +0 -0
  2. package/out/preload/index.jsc +0 -0
  3. package/out/renderer/assets/_basePickBy-Dt8NA_1A.js +1 -0
  4. package/out/renderer/assets/_baseUniq-Dfn2rCfr.js +1 -0
  5. package/out/renderer/assets/agent-details-page-CJJgDqdX.js +6 -0
  6. package/out/renderer/assets/agent-hub-page-CznUZD2f.js +11 -0
  7. package/out/renderer/assets/agents-page-COdPTFYp.js +18 -0
  8. package/out/renderer/assets/arc-C1_J1TYO.js +1 -0
  9. package/out/renderer/assets/architectureDiagram-IEHRJDOE-p5UIRlv1.js +36 -0
  10. package/out/renderer/assets/asn1-EdZsLKOL.js +1 -0
  11. package/out/renderer/assets/band-CquvqAHh.js +1 -0
  12. package/out/renderer/assets/blockDiagram-JOT3LUYC-Dk6LFvtm.js +121 -0
  13. package/out/renderer/assets/c4Diagram-VJAJSXHY-C0Hp8OKf.js +10 -0
  14. package/out/renderer/assets/channel-BqUr4Qsu.js +1 -0
  15. package/out/renderer/assets/chunk-4BMEZGHF-CV1FNkGZ.js +1 -0
  16. package/out/renderer/assets/chunk-A2AXSNBT-Co_5OkmZ.js +164 -0
  17. package/out/renderer/assets/chunk-AEK57VVT-Bu3wjBen.js +220 -0
  18. package/out/renderer/assets/chunk-D6G4REZN-BvFphnUv.js +1 -0
  19. package/out/renderer/assets/chunk-RZ5BOZE2-DBIcRvVx.js +1 -0
  20. package/out/renderer/assets/chunk-XZIHB7SX-DjSBj758.js +1 -0
  21. package/out/renderer/assets/classDiagram-GIVACNV2-DyZfTBa4.js +1 -0
  22. package/out/renderer/assets/classDiagram-v2-COTLJTTW-DyZfTBa4.js +1 -0
  23. package/out/renderer/assets/clojure-BMjYHr_A.js +1 -0
  24. package/out/renderer/assets/clone-hR8g0-gq.js +1 -0
  25. package/out/renderer/assets/css-BnMrqG3P.js +1 -0
  26. package/out/renderer/assets/cytoscape.esm-DHvQc-Lm.js +331 -0
  27. package/out/renderer/assets/dagre-OKDRZEBW-DbOc711m.js +4 -0
  28. package/out/renderer/assets/diagram-SSKATNLV-YLnBMg9L.js +43 -0
  29. package/out/renderer/assets/diagram-VNBRO52H-DHzPX2Ws.js +24 -0
  30. package/out/renderer/assets/erDiagram-Q7BY3M3F-CxFuapOs.js +60 -0
  31. package/out/renderer/assets/flowDiagram-4HSFHLVR-D5vc3yns.js +161 -0
  32. package/out/renderer/assets/ganttDiagram-APWFNJXF-ejBZIm6I.js +257 -0
  33. package/out/renderer/assets/gitGraphDiagram-7IBYFJ6S-6m7tU_G2.js +65 -0
  34. package/out/renderer/assets/graph-DIHt6FPP.js +1 -0
  35. package/out/renderer/assets/icon-CTN1YQYZ.js +195 -0
  36. package/out/renderer/assets/icon-nCvgDdVX.css +1 -0
  37. package/out/renderer/assets/index-BpRBp6-j.js +7 -0
  38. package/out/renderer/assets/index-BweSWC55.js +1 -0
  39. package/out/renderer/assets/index-CLHdxmCS.js +1272 -0
  40. package/out/renderer/assets/index-DikLkf3S.css +1 -0
  41. package/out/renderer/assets/infoDiagram-PH2N3AL5-D1KBOewb.js +2 -0
  42. package/out/renderer/assets/init-Dmth1JHB.js +1 -0
  43. package/out/renderer/assets/installer-T4sGv29U.js +16 -0
  44. package/out/renderer/assets/javascript-qCveANmP.js +1 -0
  45. package/out/renderer/assets/journeyDiagram-U35MCT3I-DsqwRdF3.js +138 -0
  46. package/out/renderer/assets/kanban-definition-NDS4AKOZ-BQvBdP_9.js +88 -0
  47. package/out/renderer/assets/katex-BCx1q_2Y.css +1 -0
  48. package/out/renderer/assets/layout-C7qoUpVb.js +1 -0
  49. package/out/renderer/assets/linear-BfLTrHPc.js +1 -0
  50. package/out/renderer/assets/mermaid.core-CyfNZ-Rl.js +213 -0
  51. package/out/renderer/assets/mindmap-definition-ALO5MXBD-CTSdCgh1.js +95 -0
  52. package/out/renderer/assets/mllike-CXdrOF99.js +1 -0
  53. package/out/renderer/assets/ordinal-DILIJJjt.js +1 -0
  54. package/out/renderer/assets/page-header-CNXeqkJB.js +1 -0
  55. package/out/renderer/assets/parseISO-CyJpeshf.js +6 -0
  56. package/out/renderer/assets/pieDiagram-IB7DONF6-CeYuFnxD.js +30 -0
  57. package/out/renderer/assets/pug-DukmZTjD.js +1 -0
  58. package/out/renderer/assets/python-BuPzkPfP.js +1 -0
  59. package/out/renderer/assets/quadrantDiagram-7GDLP6J5-urCUNLvr.js +7 -0
  60. package/out/renderer/assets/radar-MK3ICKWK-D0m91kg2.js +128 -0
  61. package/out/renderer/assets/requirementDiagram-KVF5MWMF-7WDiFe7C.js +64 -0
  62. package/out/renderer/assets/rpm-CTu-6PCP.js +1 -0
  63. package/out/renderer/assets/sankeyDiagram-QLVOVGJD-BvCTETAk.js +10 -0
  64. package/out/renderer/assets/schedules-page-B2sb5H0L.js +115 -0
  65. package/out/renderer/assets/sequenceDiagram-X6HHIX6F-DGlKyLMu.js +122 -0
  66. package/out/renderer/assets/settings-page-DnOXVx9n.js +154 -0
  67. package/out/renderer/assets/settings-section-CBkMzMRA.js +6 -0
  68. package/out/renderer/assets/sql-D0XecflT.js +1 -0
  69. package/out/renderer/assets/square-pen-C9ah35lX.js +6 -0
  70. package/out/renderer/assets/stateDiagram-DGXRK772-BY_eMRWs.js +1 -0
  71. package/out/renderer/assets/stateDiagram-v2-YXO3MK2T-DecHc3j6.js +1 -0
  72. package/out/renderer/assets/step-DMJAOHzS.js +1 -0
  73. package/out/renderer/assets/time-BOTM2Tp0.js +1 -0
  74. package/out/renderer/assets/timeline-definition-BDJGKUSR-9Ezq9kKH.js +61 -0
  75. package/out/renderer/assets/ttcn-cfg-B9xdYoR4.js +1 -0
  76. package/out/renderer/assets/use-agent-like-mutation-BYo-fu7V.js +1 -0
  77. package/out/renderer/assets/xychartDiagram-VJFVF3MP-O2pD61nn.js +7 -0
  78. package/out/renderer/index.html +4 -4
  79. package/out/renderer/installer.html +3 -3
  80. package/package.json +50 -22
  81. package/out/renderer/assets/GeistMonoNerdFontMono-Black-CPyfXpD2.otf +0 -0
  82. package/out/renderer/assets/GeistMonoNerdFontMono-Light-CRgGhpeL.otf +0 -0
  83. package/out/renderer/assets/GeistMonoNerdFontMono-Medium-Dui3XGJy.otf +0 -0
  84. package/out/renderer/assets/GeistMonoNerdFontMono-Thin-D5jufbuH.otf +0 -0
  85. package/out/renderer/assets/GeistMonoNerdFontMono-UltraBlack-CChzVbOW.otf +0 -0
  86. package/out/renderer/assets/_basePickBy-Xni00Dlk.js +0 -195
  87. package/out/renderer/assets/_baseUniq-JxZZknyU.js +0 -835
  88. package/out/renderer/assets/arc-BPRFPuHz.js +0 -131
  89. package/out/renderer/assets/architectureDiagram-IEHRJDOE-iKnn0iSS.js +0 -8653
  90. package/out/renderer/assets/asn1-BnOEsgAm.js +0 -144
  91. package/out/renderer/assets/blockDiagram-JOT3LUYC-BW-Yo0Fe.js +0 -3585
  92. package/out/renderer/assets/c4Diagram-VJAJSXHY-cTGz3ymz.js +0 -2487
  93. package/out/renderer/assets/channel-CsQk5gsI.js +0 -7
  94. package/out/renderer/assets/chunk-4BMEZGHF-DjpLWrPj.js +0 -16
  95. package/out/renderer/assets/chunk-A2AXSNBT-Blza621e.js +0 -1827
  96. package/out/renderer/assets/chunk-AEK57VVT-ZmlsDCZe.js +0 -1953
  97. package/out/renderer/assets/chunk-D6G4REZN-C7msyVje.js +0 -108
  98. package/out/renderer/assets/chunk-RZ5BOZE2-CWvJQJJl.js +0 -34
  99. package/out/renderer/assets/chunk-XZIHB7SX-C-gdVJBt.js +0 -19
  100. package/out/renderer/assets/classDiagram-GIVACNV2-BcRnaMRd.js +0 -21
  101. package/out/renderer/assets/classDiagram-v2-COTLJTTW-BcRnaMRd.js +0 -21
  102. package/out/renderer/assets/clear-icon-with-text-Cu96UxOE.png +0 -0
  103. package/out/renderer/assets/clojure-BhXMqnxz.js +0 -849
  104. package/out/renderer/assets/clone-3XFGex6Y.js +0 -8
  105. package/out/renderer/assets/css-c-jst79C.js +0 -1783
  106. package/out/renderer/assets/cytoscape.esm-C0AOj4uS.js +0 -30062
  107. package/out/renderer/assets/dagre-OKDRZEBW-BMuSMCUF.js +0 -695
  108. package/out/renderer/assets/diagram-SSKATNLV-BCxxN7T6.js +0 -304
  109. package/out/renderer/assets/diagram-VNBRO52H-q41sVUvc.js +0 -193
  110. package/out/renderer/assets/erDiagram-Q7BY3M3F-BFd2rLsa.js +0 -1160
  111. package/out/renderer/assets/flowDiagram-4HSFHLVR-_Arrrk_3.js +0 -2324
  112. package/out/renderer/assets/fonts-CM-VN_uu.css +0 -64
  113. package/out/renderer/assets/fonts-DqkQ6BY5.js +0 -31168
  114. package/out/renderer/assets/ganttDiagram-APWFNJXF-Dzw68AV_.js +0 -2500
  115. package/out/renderer/assets/gitGraphDiagram-7IBYFJ6S-BlkO8Bzg.js +0 -1204
  116. package/out/renderer/assets/graph-DL-34vhw.js +0 -424
  117. package/out/renderer/assets/index-BDLsFoJv.js +0 -312
  118. package/out/renderer/assets/index-CiPFa_9B.css +0 -10
  119. package/out/renderer/assets/index-MaDq9HTX.js +0 -365078
  120. package/out/renderer/assets/index-vAasWWpO.js +0 -406
  121. package/out/renderer/assets/infoDiagram-PH2N3AL5-DO4pqvW_.js +0 -33
  122. package/out/renderer/assets/installer-Ct30gPA9.js +0 -511
  123. package/out/renderer/assets/javascript-C3MnDRiU.js +0 -994
  124. package/out/renderer/assets/journeyDiagram-U35MCT3I-BJQ-FRal.js +0 -1199
  125. package/out/renderer/assets/kanban-definition-NDS4AKOZ-B1zGbozL.js +0 -1046
  126. package/out/renderer/assets/layout-BrQGvDtH.js +0 -2060
  127. package/out/renderer/assets/mindmap-definition-ALO5MXBD-B5SNv6RZ.js +0 -5836
  128. package/out/renderer/assets/mllike-DHn7xckP.js +0 -334
  129. package/out/renderer/assets/pieDiagram-IB7DONF6-DKT0Bk2S.js +0 -239
  130. package/out/renderer/assets/pug-By0kVCfm.js +0 -405
  131. package/out/renderer/assets/python-CvWbmiX4.js +0 -427
  132. package/out/renderer/assets/quadrantDiagram-7GDLP6J5-CFMDiFFE.js +0 -1340
  133. package/out/renderer/assets/radar-MK3ICKWK-DwsnroMG.js +0 -16935
  134. package/out/renderer/assets/requirementDiagram-KVF5MWMF-DPTaldQZ.js +0 -1163
  135. package/out/renderer/assets/rpm-C-DLY-If.js +0 -109
  136. package/out/renderer/assets/sankeyDiagram-QLVOVGJD-DIFNjSQ_.js +0 -1201
  137. package/out/renderer/assets/sequenceDiagram-X6HHIX6F-Chi1Y6mU.js +0 -3415
  138. package/out/renderer/assets/sql-BSrOzCRI.js +0 -354
  139. package/out/renderer/assets/stateDiagram-DGXRK772-DcmhTUVK.js +0 -467
  140. package/out/renderer/assets/stateDiagram-v2-YXO3MK2T-Dy-oRm-T.js +0 -21
  141. package/out/renderer/assets/timeline-definition-BDJGKUSR-0y2wZWef.js +0 -1223
  142. package/out/renderer/assets/ttcn-cfg-Dc39-fIP.js +0 -133
  143. package/out/renderer/assets/xychartDiagram-VJFVF3MP-Bbr5uqsp.js +0 -1800
@@ -1,3415 +0,0 @@
1
- import { a as drawBackgroundRect, b as getTextObj, g as getNoteRect, d as drawRect, c as drawEmbeddedImage, e as drawImage } from "./chunk-D6G4REZN-C7msyVje.js";
2
- import { I as ImperativeState } from "./chunk-XZIHB7SX-C-gdVJBt.js";
3
- import { _ as __name, o as setConfig2, c as getConfig2, d as select, l as log, j as distExports, e as configureSvgSize, f as assignWithDepth_default, k as common_default, b as setAccTitle, s as setAccDescription, q as setDiagramTitle, a as getAccTitle, g as getAccDescription, t as getDiagramTitle, z as clear, i as sanitizeText, u as utils_default, a6 as hasKatex, a7 as calculateMathMLDimensions, a8 as parseFontSize, a9 as ZERO_WIDTH_SPACE, aa as renderKatex, G as getConfig } from "./index-MaDq9HTX.js";
4
- import "./fonts-DqkQ6BY5.js";
5
- var parser = function() {
6
- var o = /* @__PURE__ */ __name(function(k, v, o2, l) {
7
- for (o2 = o2 || {}, l = k.length; l--; o2[k[l]] = v) ;
8
- return o2;
9
- }, "o"), $V0 = [1, 2], $V1 = [1, 3], $V2 = [1, 4], $V3 = [2, 4], $V4 = [1, 9], $V5 = [1, 11], $V6 = [1, 13], $V7 = [1, 14], $V8 = [1, 16], $V9 = [1, 17], $Va = [1, 18], $Vb = [1, 24], $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, 41], $Vs = [1, 42], $Vt = [1, 43], $Vu = [1, 44], $Vv = [1, 45], $Vw = [1, 46], $Vx = [1, 4, 5, 13, 14, 16, 18, 21, 23, 29, 30, 31, 33, 35, 36, 37, 38, 39, 41, 43, 44, 46, 47, 48, 49, 50, 52, 53, 54, 59, 60, 61, 62, 70], $Vy = [4, 5, 16, 50, 52, 53], $Vz = [4, 5, 13, 14, 16, 18, 21, 23, 29, 30, 31, 33, 35, 36, 37, 38, 39, 41, 43, 44, 46, 50, 52, 53, 54, 59, 60, 61, 62, 70], $VA = [4, 5, 13, 14, 16, 18, 21, 23, 29, 30, 31, 33, 35, 36, 37, 38, 39, 41, 43, 44, 46, 49, 50, 52, 53, 54, 59, 60, 61, 62, 70], $VB = [4, 5, 13, 14, 16, 18, 21, 23, 29, 30, 31, 33, 35, 36, 37, 38, 39, 41, 43, 44, 46, 48, 50, 52, 53, 54, 59, 60, 61, 62, 70], $VC = [4, 5, 13, 14, 16, 18, 21, 23, 29, 30, 31, 33, 35, 36, 37, 38, 39, 41, 43, 44, 46, 47, 50, 52, 53, 54, 59, 60, 61, 62, 70], $VD = [68, 69, 70], $VE = [1, 122];
10
- var parser2 = {
11
- trace: /* @__PURE__ */ __name(function trace() {
12
- }, "trace"),
13
- yy: {},
14
- symbols_: { "error": 2, "start": 3, "SPACE": 4, "NEWLINE": 5, "SD": 6, "document": 7, "line": 8, "statement": 9, "box_section": 10, "box_line": 11, "participant_statement": 12, "create": 13, "box": 14, "restOfLine": 15, "end": 16, "signal": 17, "autonumber": 18, "NUM": 19, "off": 20, "activate": 21, "actor": 22, "deactivate": 23, "note_statement": 24, "links_statement": 25, "link_statement": 26, "properties_statement": 27, "details_statement": 28, "title": 29, "legacy_title": 30, "acc_title": 31, "acc_title_value": 32, "acc_descr": 33, "acc_descr_value": 34, "acc_descr_multiline_value": 35, "loop": 36, "rect": 37, "opt": 38, "alt": 39, "else_sections": 40, "par": 41, "par_sections": 42, "par_over": 43, "critical": 44, "option_sections": 45, "break": 46, "option": 47, "and": 48, "else": 49, "participant": 50, "AS": 51, "participant_actor": 52, "destroy": 53, "note": 54, "placement": 55, "text2": 56, "over": 57, "actor_pair": 58, "links": 59, "link": 60, "properties": 61, "details": 62, "spaceList": 63, ",": 64, "left_of": 65, "right_of": 66, "signaltype": 67, "+": 68, "-": 69, "ACTOR": 70, "SOLID_OPEN_ARROW": 71, "DOTTED_OPEN_ARROW": 72, "SOLID_ARROW": 73, "BIDIRECTIONAL_SOLID_ARROW": 74, "DOTTED_ARROW": 75, "BIDIRECTIONAL_DOTTED_ARROW": 76, "SOLID_CROSS": 77, "DOTTED_CROSS": 78, "SOLID_POINT": 79, "DOTTED_POINT": 80, "TXT": 81, "$accept": 0, "$end": 1 },
15
- terminals_: { 2: "error", 4: "SPACE", 5: "NEWLINE", 6: "SD", 13: "create", 14: "box", 15: "restOfLine", 16: "end", 18: "autonumber", 19: "NUM", 20: "off", 21: "activate", 23: "deactivate", 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", 41: "par", 43: "par_over", 44: "critical", 46: "break", 47: "option", 48: "and", 49: "else", 50: "participant", 51: "AS", 52: "participant_actor", 53: "destroy", 54: "note", 57: "over", 59: "links", 60: "link", 61: "properties", 62: "details", 64: ",", 65: "left_of", 66: "right_of", 68: "+", 69: "-", 70: "ACTOR", 71: "SOLID_OPEN_ARROW", 72: "DOTTED_OPEN_ARROW", 73: "SOLID_ARROW", 74: "BIDIRECTIONAL_SOLID_ARROW", 75: "DOTTED_ARROW", 76: "BIDIRECTIONAL_DOTTED_ARROW", 77: "SOLID_CROSS", 78: "DOTTED_CROSS", 79: "SOLID_POINT", 80: "DOTTED_POINT", 81: "TXT" },
16
- productions_: [0, [3, 2], [3, 2], [3, 2], [7, 0], [7, 2], [8, 2], [8, 1], [8, 1], [10, 0], [10, 2], [11, 2], [11, 1], [11, 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], [45, 1], [45, 4], [42, 1], [42, 4], [40, 1], [40, 4], [12, 5], [12, 3], [12, 5], [12, 3], [12, 3], [24, 4], [24, 4], [25, 3], [26, 3], [27, 3], [28, 3], [63, 2], [63, 1], [58, 3], [58, 1], [55, 1], [55, 1], [17, 5], [17, 5], [17, 4], [22, 1], [67, 1], [67, 1], [67, 1], [67, 1], [67, 1], [67, 1], [67, 1], [67, 1], [67, 1], [67, 1], [56, 1]],
17
- performAction: /* @__PURE__ */ __name(function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) {
18
- var $0 = $$.length - 1;
19
- switch (yystate) {
20
- case 3:
21
- yy.apply($$[$0]);
22
- return $$[$0];
23
- case 4:
24
- case 9:
25
- this.$ = [];
26
- break;
27
- case 5:
28
- case 10:
29
- $$[$0 - 1].push($$[$0]);
30
- this.$ = $$[$0 - 1];
31
- break;
32
- case 6:
33
- case 7:
34
- case 11:
35
- case 12:
36
- this.$ = $$[$0];
37
- break;
38
- case 8:
39
- case 13:
40
- this.$ = [];
41
- break;
42
- case 15:
43
- $$[$0].type = "createParticipant";
44
- this.$ = $$[$0];
45
- break;
46
- case 16:
47
- $$[$0 - 1].unshift({ type: "boxStart", boxData: yy.parseBoxData($$[$0 - 2]) });
48
- $$[$0 - 1].push({ type: "boxEnd", boxText: $$[$0 - 2] });
49
- this.$ = $$[$0 - 1];
50
- break;
51
- case 18:
52
- this.$ = { type: "sequenceIndex", sequenceIndex: Number($$[$0 - 2]), sequenceIndexStep: Number($$[$0 - 1]), sequenceVisible: true, signalType: yy.LINETYPE.AUTONUMBER };
53
- break;
54
- case 19:
55
- this.$ = { type: "sequenceIndex", sequenceIndex: Number($$[$0 - 1]), sequenceIndexStep: 1, sequenceVisible: true, signalType: yy.LINETYPE.AUTONUMBER };
56
- break;
57
- case 20:
58
- this.$ = { type: "sequenceIndex", sequenceVisible: false, signalType: yy.LINETYPE.AUTONUMBER };
59
- break;
60
- case 21:
61
- this.$ = { type: "sequenceIndex", sequenceVisible: true, signalType: yy.LINETYPE.AUTONUMBER };
62
- break;
63
- case 22:
64
- this.$ = { type: "activeStart", signalType: yy.LINETYPE.ACTIVE_START, actor: $$[$0 - 1].actor };
65
- break;
66
- case 23:
67
- this.$ = { type: "activeEnd", signalType: yy.LINETYPE.ACTIVE_END, actor: $$[$0 - 1].actor };
68
- break;
69
- case 29:
70
- yy.setDiagramTitle($$[$0].substring(6));
71
- this.$ = $$[$0].substring(6);
72
- break;
73
- case 30:
74
- yy.setDiagramTitle($$[$0].substring(7));
75
- this.$ = $$[$0].substring(7);
76
- break;
77
- case 31:
78
- this.$ = $$[$0].trim();
79
- yy.setAccTitle(this.$);
80
- break;
81
- case 32:
82
- case 33:
83
- this.$ = $$[$0].trim();
84
- yy.setAccDescription(this.$);
85
- break;
86
- case 34:
87
- $$[$0 - 1].unshift({ type: "loopStart", loopText: yy.parseMessage($$[$0 - 2]), signalType: yy.LINETYPE.LOOP_START });
88
- $$[$0 - 1].push({ type: "loopEnd", loopText: $$[$0 - 2], signalType: yy.LINETYPE.LOOP_END });
89
- this.$ = $$[$0 - 1];
90
- break;
91
- case 35:
92
- $$[$0 - 1].unshift({ type: "rectStart", color: yy.parseMessage($$[$0 - 2]), signalType: yy.LINETYPE.RECT_START });
93
- $$[$0 - 1].push({ type: "rectEnd", color: yy.parseMessage($$[$0 - 2]), signalType: yy.LINETYPE.RECT_END });
94
- this.$ = $$[$0 - 1];
95
- break;
96
- case 36:
97
- $$[$0 - 1].unshift({ type: "optStart", optText: yy.parseMessage($$[$0 - 2]), signalType: yy.LINETYPE.OPT_START });
98
- $$[$0 - 1].push({ type: "optEnd", optText: yy.parseMessage($$[$0 - 2]), signalType: yy.LINETYPE.OPT_END });
99
- this.$ = $$[$0 - 1];
100
- break;
101
- case 37:
102
- $$[$0 - 1].unshift({ type: "altStart", altText: yy.parseMessage($$[$0 - 2]), signalType: yy.LINETYPE.ALT_START });
103
- $$[$0 - 1].push({ type: "altEnd", signalType: yy.LINETYPE.ALT_END });
104
- this.$ = $$[$0 - 1];
105
- break;
106
- case 38:
107
- $$[$0 - 1].unshift({ type: "parStart", parText: yy.parseMessage($$[$0 - 2]), signalType: yy.LINETYPE.PAR_START });
108
- $$[$0 - 1].push({ type: "parEnd", signalType: yy.LINETYPE.PAR_END });
109
- this.$ = $$[$0 - 1];
110
- break;
111
- case 39:
112
- $$[$0 - 1].unshift({ type: "parStart", parText: yy.parseMessage($$[$0 - 2]), signalType: yy.LINETYPE.PAR_OVER_START });
113
- $$[$0 - 1].push({ type: "parEnd", signalType: yy.LINETYPE.PAR_END });
114
- this.$ = $$[$0 - 1];
115
- break;
116
- case 40:
117
- $$[$0 - 1].unshift({ type: "criticalStart", criticalText: yy.parseMessage($$[$0 - 2]), signalType: yy.LINETYPE.CRITICAL_START });
118
- $$[$0 - 1].push({ type: "criticalEnd", signalType: yy.LINETYPE.CRITICAL_END });
119
- this.$ = $$[$0 - 1];
120
- break;
121
- case 41:
122
- $$[$0 - 1].unshift({ type: "breakStart", breakText: yy.parseMessage($$[$0 - 2]), signalType: yy.LINETYPE.BREAK_START });
123
- $$[$0 - 1].push({ type: "breakEnd", optText: yy.parseMessage($$[$0 - 2]), signalType: yy.LINETYPE.BREAK_END });
124
- this.$ = $$[$0 - 1];
125
- break;
126
- case 43:
127
- this.$ = $$[$0 - 3].concat([{ type: "option", optionText: yy.parseMessage($$[$0 - 1]), signalType: yy.LINETYPE.CRITICAL_OPTION }, $$[$0]]);
128
- break;
129
- case 45:
130
- this.$ = $$[$0 - 3].concat([{ type: "and", parText: yy.parseMessage($$[$0 - 1]), signalType: yy.LINETYPE.PAR_AND }, $$[$0]]);
131
- break;
132
- case 47:
133
- this.$ = $$[$0 - 3].concat([{ type: "else", altText: yy.parseMessage($$[$0 - 1]), signalType: yy.LINETYPE.ALT_ELSE }, $$[$0]]);
134
- break;
135
- case 48:
136
- $$[$0 - 3].draw = "participant";
137
- $$[$0 - 3].type = "addParticipant";
138
- $$[$0 - 3].description = yy.parseMessage($$[$0 - 1]);
139
- this.$ = $$[$0 - 3];
140
- break;
141
- case 49:
142
- $$[$0 - 1].draw = "participant";
143
- $$[$0 - 1].type = "addParticipant";
144
- this.$ = $$[$0 - 1];
145
- break;
146
- case 50:
147
- $$[$0 - 3].draw = "actor";
148
- $$[$0 - 3].type = "addParticipant";
149
- $$[$0 - 3].description = yy.parseMessage($$[$0 - 1]);
150
- this.$ = $$[$0 - 3];
151
- break;
152
- case 51:
153
- $$[$0 - 1].draw = "actor";
154
- $$[$0 - 1].type = "addParticipant";
155
- this.$ = $$[$0 - 1];
156
- break;
157
- case 52:
158
- $$[$0 - 1].type = "destroyParticipant";
159
- this.$ = $$[$0 - 1];
160
- break;
161
- case 53:
162
- this.$ = [$$[$0 - 1], { type: "addNote", placement: $$[$0 - 2], actor: $$[$0 - 1].actor, text: $$[$0] }];
163
- break;
164
- case 54:
165
- $$[$0 - 2] = [].concat($$[$0 - 1], $$[$0 - 1]).slice(0, 2);
166
- $$[$0 - 2][0] = $$[$0 - 2][0].actor;
167
- $$[$0 - 2][1] = $$[$0 - 2][1].actor;
168
- this.$ = [$$[$0 - 1], { type: "addNote", placement: yy.PLACEMENT.OVER, actor: $$[$0 - 2].slice(0, 2), text: $$[$0] }];
169
- break;
170
- case 55:
171
- this.$ = [$$[$0 - 1], { type: "addLinks", actor: $$[$0 - 1].actor, text: $$[$0] }];
172
- break;
173
- case 56:
174
- this.$ = [$$[$0 - 1], { type: "addALink", actor: $$[$0 - 1].actor, text: $$[$0] }];
175
- break;
176
- case 57:
177
- this.$ = [$$[$0 - 1], { type: "addProperties", actor: $$[$0 - 1].actor, text: $$[$0] }];
178
- break;
179
- case 58:
180
- this.$ = [$$[$0 - 1], { type: "addDetails", actor: $$[$0 - 1].actor, text: $$[$0] }];
181
- break;
182
- case 61:
183
- this.$ = [$$[$0 - 2], $$[$0]];
184
- break;
185
- case 62:
186
- this.$ = $$[$0];
187
- break;
188
- case 63:
189
- this.$ = yy.PLACEMENT.LEFTOF;
190
- break;
191
- case 64:
192
- this.$ = yy.PLACEMENT.RIGHTOF;
193
- break;
194
- case 65:
195
- this.$ = [
196
- $$[$0 - 4],
197
- $$[$0 - 1],
198
- { type: "addMessage", from: $$[$0 - 4].actor, to: $$[$0 - 1].actor, signalType: $$[$0 - 3], msg: $$[$0], activate: true },
199
- { type: "activeStart", signalType: yy.LINETYPE.ACTIVE_START, actor: $$[$0 - 1].actor }
200
- ];
201
- break;
202
- case 66:
203
- this.$ = [
204
- $$[$0 - 4],
205
- $$[$0 - 1],
206
- { type: "addMessage", from: $$[$0 - 4].actor, to: $$[$0 - 1].actor, signalType: $$[$0 - 3], msg: $$[$0] },
207
- { type: "activeEnd", signalType: yy.LINETYPE.ACTIVE_END, actor: $$[$0 - 4].actor }
208
- ];
209
- break;
210
- case 67:
211
- this.$ = [$$[$0 - 3], $$[$0 - 1], { type: "addMessage", from: $$[$0 - 3].actor, to: $$[$0 - 1].actor, signalType: $$[$0 - 2], msg: $$[$0] }];
212
- break;
213
- case 68:
214
- this.$ = { type: "addParticipant", actor: $$[$0] };
215
- break;
216
- case 69:
217
- this.$ = yy.LINETYPE.SOLID_OPEN;
218
- break;
219
- case 70:
220
- this.$ = yy.LINETYPE.DOTTED_OPEN;
221
- break;
222
- case 71:
223
- this.$ = yy.LINETYPE.SOLID;
224
- break;
225
- case 72:
226
- this.$ = yy.LINETYPE.BIDIRECTIONAL_SOLID;
227
- break;
228
- case 73:
229
- this.$ = yy.LINETYPE.DOTTED;
230
- break;
231
- case 74:
232
- this.$ = yy.LINETYPE.BIDIRECTIONAL_DOTTED;
233
- break;
234
- case 75:
235
- this.$ = yy.LINETYPE.SOLID_CROSS;
236
- break;
237
- case 76:
238
- this.$ = yy.LINETYPE.DOTTED_CROSS;
239
- break;
240
- case 77:
241
- this.$ = yy.LINETYPE.SOLID_POINT;
242
- break;
243
- case 78:
244
- this.$ = yy.LINETYPE.DOTTED_POINT;
245
- break;
246
- case 79:
247
- this.$ = yy.parseMessage($$[$0].trim().substring(1));
248
- break;
249
- }
250
- }, "anonymous"),
251
- 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, 13, 14, 18, 21, 23, 29, 30, 31, 33, 35, 36, 37, 38, 39, 41, 43, 44, 46, 50, 52, 53, 54, 59, 60, 61, 62, 70], $V3, { 7: 7 }), { 1: [2, 1] }, { 1: [2, 2] }, { 1: [2, 3], 4: $V4, 5: $V5, 8: 8, 9: 10, 12: 12, 13: $V6, 14: $V7, 17: 15, 18: $V8, 21: $V9, 22: 40, 23: $Va, 24: 19, 25: 20, 26: 21, 27: 22, 28: 23, 29: $Vb, 30: $Vc, 31: $Vd, 33: $Ve, 35: $Vf, 36: $Vg, 37: $Vh, 38: $Vi, 39: $Vj, 41: $Vk, 43: $Vl, 44: $Vm, 46: $Vn, 50: $Vo, 52: $Vp, 53: $Vq, 54: $Vr, 59: $Vs, 60: $Vt, 61: $Vu, 62: $Vv, 70: $Vw }, o($Vx, [2, 5]), { 9: 47, 12: 12, 13: $V6, 14: $V7, 17: 15, 18: $V8, 21: $V9, 22: 40, 23: $Va, 24: 19, 25: 20, 26: 21, 27: 22, 28: 23, 29: $Vb, 30: $Vc, 31: $Vd, 33: $Ve, 35: $Vf, 36: $Vg, 37: $Vh, 38: $Vi, 39: $Vj, 41: $Vk, 43: $Vl, 44: $Vm, 46: $Vn, 50: $Vo, 52: $Vp, 53: $Vq, 54: $Vr, 59: $Vs, 60: $Vt, 61: $Vu, 62: $Vv, 70: $Vw }, o($Vx, [2, 7]), o($Vx, [2, 8]), o($Vx, [2, 14]), { 12: 48, 50: $Vo, 52: $Vp, 53: $Vq }, { 15: [1, 49] }, { 5: [1, 50] }, { 5: [1, 53], 19: [1, 51], 20: [1, 52] }, { 22: 54, 70: $Vw }, { 22: 55, 70: $Vw }, { 5: [1, 56] }, { 5: [1, 57] }, { 5: [1, 58] }, { 5: [1, 59] }, { 5: [1, 60] }, o($Vx, [2, 29]), o($Vx, [2, 30]), { 32: [1, 61] }, { 34: [1, 62] }, o($Vx, [2, 33]), { 15: [1, 63] }, { 15: [1, 64] }, { 15: [1, 65] }, { 15: [1, 66] }, { 15: [1, 67] }, { 15: [1, 68] }, { 15: [1, 69] }, { 15: [1, 70] }, { 22: 71, 70: $Vw }, { 22: 72, 70: $Vw }, { 22: 73, 70: $Vw }, { 67: 74, 71: [1, 75], 72: [1, 76], 73: [1, 77], 74: [1, 78], 75: [1, 79], 76: [1, 80], 77: [1, 81], 78: [1, 82], 79: [1, 83], 80: [1, 84] }, { 55: 85, 57: [1, 86], 65: [1, 87], 66: [1, 88] }, { 22: 89, 70: $Vw }, { 22: 90, 70: $Vw }, { 22: 91, 70: $Vw }, { 22: 92, 70: $Vw }, o([5, 51, 64, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81], [2, 68]), o($Vx, [2, 6]), o($Vx, [2, 15]), o($Vy, [2, 9], { 10: 93 }), o($Vx, [2, 17]), { 5: [1, 95], 19: [1, 94] }, { 5: [1, 96] }, o($Vx, [2, 21]), { 5: [1, 97] }, { 5: [1, 98] }, o($Vx, [2, 24]), o($Vx, [2, 25]), o($Vx, [2, 26]), o($Vx, [2, 27]), o($Vx, [2, 28]), o($Vx, [2, 31]), o($Vx, [2, 32]), o($Vz, $V3, { 7: 99 }), o($Vz, $V3, { 7: 100 }), o($Vz, $V3, { 7: 101 }), o($VA, $V3, { 40: 102, 7: 103 }), o($VB, $V3, { 42: 104, 7: 105 }), o($VB, $V3, { 7: 105, 42: 106 }), o($VC, $V3, { 45: 107, 7: 108 }), o($Vz, $V3, { 7: 109 }), { 5: [1, 111], 51: [1, 110] }, { 5: [1, 113], 51: [1, 112] }, { 5: [1, 114] }, { 22: 117, 68: [1, 115], 69: [1, 116], 70: $Vw }, o($VD, [2, 69]), o($VD, [2, 70]), o($VD, [2, 71]), o($VD, [2, 72]), o($VD, [2, 73]), o($VD, [2, 74]), o($VD, [2, 75]), o($VD, [2, 76]), o($VD, [2, 77]), o($VD, [2, 78]), { 22: 118, 70: $Vw }, { 22: 120, 58: 119, 70: $Vw }, { 70: [2, 63] }, { 70: [2, 64] }, { 56: 121, 81: $VE }, { 56: 123, 81: $VE }, { 56: 124, 81: $VE }, { 56: 125, 81: $VE }, { 4: [1, 128], 5: [1, 130], 11: 127, 12: 129, 16: [1, 126], 50: $Vo, 52: $Vp, 53: $Vq }, { 5: [1, 131] }, o($Vx, [2, 19]), o($Vx, [2, 20]), o($Vx, [2, 22]), o($Vx, [2, 23]), { 4: $V4, 5: $V5, 8: 8, 9: 10, 12: 12, 13: $V6, 14: $V7, 16: [1, 132], 17: 15, 18: $V8, 21: $V9, 22: 40, 23: $Va, 24: 19, 25: 20, 26: 21, 27: 22, 28: 23, 29: $Vb, 30: $Vc, 31: $Vd, 33: $Ve, 35: $Vf, 36: $Vg, 37: $Vh, 38: $Vi, 39: $Vj, 41: $Vk, 43: $Vl, 44: $Vm, 46: $Vn, 50: $Vo, 52: $Vp, 53: $Vq, 54: $Vr, 59: $Vs, 60: $Vt, 61: $Vu, 62: $Vv, 70: $Vw }, { 4: $V4, 5: $V5, 8: 8, 9: 10, 12: 12, 13: $V6, 14: $V7, 16: [1, 133], 17: 15, 18: $V8, 21: $V9, 22: 40, 23: $Va, 24: 19, 25: 20, 26: 21, 27: 22, 28: 23, 29: $Vb, 30: $Vc, 31: $Vd, 33: $Ve, 35: $Vf, 36: $Vg, 37: $Vh, 38: $Vi, 39: $Vj, 41: $Vk, 43: $Vl, 44: $Vm, 46: $Vn, 50: $Vo, 52: $Vp, 53: $Vq, 54: $Vr, 59: $Vs, 60: $Vt, 61: $Vu, 62: $Vv, 70: $Vw }, { 4: $V4, 5: $V5, 8: 8, 9: 10, 12: 12, 13: $V6, 14: $V7, 16: [1, 134], 17: 15, 18: $V8, 21: $V9, 22: 40, 23: $Va, 24: 19, 25: 20, 26: 21, 27: 22, 28: 23, 29: $Vb, 30: $Vc, 31: $Vd, 33: $Ve, 35: $Vf, 36: $Vg, 37: $Vh, 38: $Vi, 39: $Vj, 41: $Vk, 43: $Vl, 44: $Vm, 46: $Vn, 50: $Vo, 52: $Vp, 53: $Vq, 54: $Vr, 59: $Vs, 60: $Vt, 61: $Vu, 62: $Vv, 70: $Vw }, { 16: [1, 135] }, { 4: $V4, 5: $V5, 8: 8, 9: 10, 12: 12, 13: $V6, 14: $V7, 16: [2, 46], 17: 15, 18: $V8, 21: $V9, 22: 40, 23: $Va, 24: 19, 25: 20, 26: 21, 27: 22, 28: 23, 29: $Vb, 30: $Vc, 31: $Vd, 33: $Ve, 35: $Vf, 36: $Vg, 37: $Vh, 38: $Vi, 39: $Vj, 41: $Vk, 43: $Vl, 44: $Vm, 46: $Vn, 49: [1, 136], 50: $Vo, 52: $Vp, 53: $Vq, 54: $Vr, 59: $Vs, 60: $Vt, 61: $Vu, 62: $Vv, 70: $Vw }, { 16: [1, 137] }, { 4: $V4, 5: $V5, 8: 8, 9: 10, 12: 12, 13: $V6, 14: $V7, 16: [2, 44], 17: 15, 18: $V8, 21: $V9, 22: 40, 23: $Va, 24: 19, 25: 20, 26: 21, 27: 22, 28: 23, 29: $Vb, 30: $Vc, 31: $Vd, 33: $Ve, 35: $Vf, 36: $Vg, 37: $Vh, 38: $Vi, 39: $Vj, 41: $Vk, 43: $Vl, 44: $Vm, 46: $Vn, 48: [1, 138], 50: $Vo, 52: $Vp, 53: $Vq, 54: $Vr, 59: $Vs, 60: $Vt, 61: $Vu, 62: $Vv, 70: $Vw }, { 16: [1, 139] }, { 16: [1, 140] }, { 4: $V4, 5: $V5, 8: 8, 9: 10, 12: 12, 13: $V6, 14: $V7, 16: [2, 42], 17: 15, 18: $V8, 21: $V9, 22: 40, 23: $Va, 24: 19, 25: 20, 26: 21, 27: 22, 28: 23, 29: $Vb, 30: $Vc, 31: $Vd, 33: $Ve, 35: $Vf, 36: $Vg, 37: $Vh, 38: $Vi, 39: $Vj, 41: $Vk, 43: $Vl, 44: $Vm, 46: $Vn, 47: [1, 141], 50: $Vo, 52: $Vp, 53: $Vq, 54: $Vr, 59: $Vs, 60: $Vt, 61: $Vu, 62: $Vv, 70: $Vw }, { 4: $V4, 5: $V5, 8: 8, 9: 10, 12: 12, 13: $V6, 14: $V7, 16: [1, 142], 17: 15, 18: $V8, 21: $V9, 22: 40, 23: $Va, 24: 19, 25: 20, 26: 21, 27: 22, 28: 23, 29: $Vb, 30: $Vc, 31: $Vd, 33: $Ve, 35: $Vf, 36: $Vg, 37: $Vh, 38: $Vi, 39: $Vj, 41: $Vk, 43: $Vl, 44: $Vm, 46: $Vn, 50: $Vo, 52: $Vp, 53: $Vq, 54: $Vr, 59: $Vs, 60: $Vt, 61: $Vu, 62: $Vv, 70: $Vw }, { 15: [1, 143] }, o($Vx, [2, 49]), { 15: [1, 144] }, o($Vx, [2, 51]), o($Vx, [2, 52]), { 22: 145, 70: $Vw }, { 22: 146, 70: $Vw }, { 56: 147, 81: $VE }, { 56: 148, 81: $VE }, { 56: 149, 81: $VE }, { 64: [1, 150], 81: [2, 62] }, { 5: [2, 55] }, { 5: [2, 79] }, { 5: [2, 56] }, { 5: [2, 57] }, { 5: [2, 58] }, o($Vx, [2, 16]), o($Vy, [2, 10]), { 12: 151, 50: $Vo, 52: $Vp, 53: $Vq }, o($Vy, [2, 12]), o($Vy, [2, 13]), o($Vx, [2, 18]), o($Vx, [2, 34]), o($Vx, [2, 35]), o($Vx, [2, 36]), o($Vx, [2, 37]), { 15: [1, 152] }, o($Vx, [2, 38]), { 15: [1, 153] }, o($Vx, [2, 39]), o($Vx, [2, 40]), { 15: [1, 154] }, o($Vx, [2, 41]), { 5: [1, 155] }, { 5: [1, 156] }, { 56: 157, 81: $VE }, { 56: 158, 81: $VE }, { 5: [2, 67] }, { 5: [2, 53] }, { 5: [2, 54] }, { 22: 159, 70: $Vw }, o($Vy, [2, 11]), o($VA, $V3, { 7: 103, 40: 160 }), o($VB, $V3, { 7: 105, 42: 161 }), o($VC, $V3, { 7: 108, 45: 162 }), o($Vx, [2, 48]), o($Vx, [2, 50]), { 5: [2, 65] }, { 5: [2, 66] }, { 81: [2, 61] }, { 16: [2, 47] }, { 16: [2, 45] }, { 16: [2, 43] }],
252
- defaultActions: { 5: [2, 1], 6: [2, 2], 87: [2, 63], 88: [2, 64], 121: [2, 55], 122: [2, 79], 123: [2, 56], 124: [2, 57], 125: [2, 58], 147: [2, 67], 148: [2, 53], 149: [2, 54], 157: [2, 65], 158: [2, 66], 159: [2, 61], 160: [2, 47], 161: [2, 45], 162: [2, 43] },
253
- parseError: /* @__PURE__ */ __name(function parseError(str, hash) {
254
- if (hash.recoverable) {
255
- this.trace(str);
256
- } else {
257
- var error = new Error(str);
258
- error.hash = hash;
259
- throw error;
260
- }
261
- }, "parseError"),
262
- parse: /* @__PURE__ */ __name(function parse(input) {
263
- var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, TERROR = 2, EOF = 1;
264
- var args = lstack.slice.call(arguments, 1);
265
- var lexer2 = Object.create(this.lexer);
266
- var sharedState = { yy: {} };
267
- for (var k in this.yy) {
268
- if (Object.prototype.hasOwnProperty.call(this.yy, k)) {
269
- sharedState.yy[k] = this.yy[k];
270
- }
271
- }
272
- lexer2.setInput(input, sharedState.yy);
273
- sharedState.yy.lexer = lexer2;
274
- sharedState.yy.parser = this;
275
- if (typeof lexer2.yylloc == "undefined") {
276
- lexer2.yylloc = {};
277
- }
278
- var yyloc = lexer2.yylloc;
279
- lstack.push(yyloc);
280
- var ranges = lexer2.options && lexer2.options.ranges;
281
- if (typeof sharedState.yy.parseError === "function") {
282
- this.parseError = sharedState.yy.parseError;
283
- } else {
284
- this.parseError = Object.getPrototypeOf(this).parseError;
285
- }
286
- function popStack(n) {
287
- stack.length = stack.length - 2 * n;
288
- vstack.length = vstack.length - n;
289
- lstack.length = lstack.length - n;
290
- }
291
- __name(popStack, "popStack");
292
- function lex() {
293
- var token;
294
- token = tstack.pop() || lexer2.lex() || EOF;
295
- if (typeof token !== "number") {
296
- if (token instanceof Array) {
297
- tstack = token;
298
- token = tstack.pop();
299
- }
300
- token = self.symbols_[token] || token;
301
- }
302
- return token;
303
- }
304
- __name(lex, "lex");
305
- var symbol, state, action, r, yyval = {}, p, len, newState, expected;
306
- while (true) {
307
- state = stack[stack.length - 1];
308
- if (this.defaultActions[state]) {
309
- action = this.defaultActions[state];
310
- } else {
311
- if (symbol === null || typeof symbol == "undefined") {
312
- symbol = lex();
313
- }
314
- action = table[state] && table[state][symbol];
315
- }
316
- if (typeof action === "undefined" || !action.length || !action[0]) {
317
- var errStr = "";
318
- expected = [];
319
- for (p in table[state]) {
320
- if (this.terminals_[p] && p > TERROR) {
321
- expected.push("'" + this.terminals_[p] + "'");
322
- }
323
- }
324
- if (lexer2.showPosition) {
325
- errStr = "Parse error on line " + (yylineno + 1) + ":\n" + lexer2.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'";
326
- } else {
327
- errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == EOF ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'");
328
- }
329
- this.parseError(errStr, {
330
- text: lexer2.match,
331
- token: this.terminals_[symbol] || symbol,
332
- line: lexer2.yylineno,
333
- loc: yyloc,
334
- expected
335
- });
336
- }
337
- if (action[0] instanceof Array && action.length > 1) {
338
- throw new Error("Parse Error: multiple actions possible at state: " + state + ", token: " + symbol);
339
- }
340
- switch (action[0]) {
341
- case 1:
342
- stack.push(symbol);
343
- vstack.push(lexer2.yytext);
344
- lstack.push(lexer2.yylloc);
345
- stack.push(action[1]);
346
- symbol = null;
347
- {
348
- yyleng = lexer2.yyleng;
349
- yytext = lexer2.yytext;
350
- yylineno = lexer2.yylineno;
351
- yyloc = lexer2.yylloc;
352
- }
353
- break;
354
- case 2:
355
- len = this.productions_[action[1]][1];
356
- yyval.$ = vstack[vstack.length - len];
357
- yyval._$ = {
358
- first_line: lstack[lstack.length - (len || 1)].first_line,
359
- last_line: lstack[lstack.length - 1].last_line,
360
- first_column: lstack[lstack.length - (len || 1)].first_column,
361
- last_column: lstack[lstack.length - 1].last_column
362
- };
363
- if (ranges) {
364
- yyval._$.range = [
365
- lstack[lstack.length - (len || 1)].range[0],
366
- lstack[lstack.length - 1].range[1]
367
- ];
368
- }
369
- r = this.performAction.apply(yyval, [
370
- yytext,
371
- yyleng,
372
- yylineno,
373
- sharedState.yy,
374
- action[1],
375
- vstack,
376
- lstack
377
- ].concat(args));
378
- if (typeof r !== "undefined") {
379
- return r;
380
- }
381
- if (len) {
382
- stack = stack.slice(0, -1 * len * 2);
383
- vstack = vstack.slice(0, -1 * len);
384
- lstack = lstack.slice(0, -1 * len);
385
- }
386
- stack.push(this.productions_[action[1]][0]);
387
- vstack.push(yyval.$);
388
- lstack.push(yyval._$);
389
- newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
390
- stack.push(newState);
391
- break;
392
- case 3:
393
- return true;
394
- }
395
- }
396
- return true;
397
- }, "parse")
398
- };
399
- var lexer = /* @__PURE__ */ function() {
400
- var lexer2 = {
401
- EOF: 1,
402
- parseError: /* @__PURE__ */ __name(function parseError(str, hash) {
403
- if (this.yy.parser) {
404
- this.yy.parser.parseError(str, hash);
405
- } else {
406
- throw new Error(str);
407
- }
408
- }, "parseError"),
409
- // resets the lexer, sets new input
410
- setInput: /* @__PURE__ */ __name(function(input, yy) {
411
- this.yy = yy || this.yy || {};
412
- this._input = input;
413
- this._more = this._backtrack = this.done = false;
414
- this.yylineno = this.yyleng = 0;
415
- this.yytext = this.matched = this.match = "";
416
- this.conditionStack = ["INITIAL"];
417
- this.yylloc = {
418
- first_line: 1,
419
- first_column: 0,
420
- last_line: 1,
421
- last_column: 0
422
- };
423
- if (this.options.ranges) {
424
- this.yylloc.range = [0, 0];
425
- }
426
- this.offset = 0;
427
- return this;
428
- }, "setInput"),
429
- // consumes and returns one char from the input
430
- input: /* @__PURE__ */ __name(function() {
431
- var ch = this._input[0];
432
- this.yytext += ch;
433
- this.yyleng++;
434
- this.offset++;
435
- this.match += ch;
436
- this.matched += ch;
437
- var lines = ch.match(/(?:\r\n?|\n).*/g);
438
- if (lines) {
439
- this.yylineno++;
440
- this.yylloc.last_line++;
441
- } else {
442
- this.yylloc.last_column++;
443
- }
444
- if (this.options.ranges) {
445
- this.yylloc.range[1]++;
446
- }
447
- this._input = this._input.slice(1);
448
- return ch;
449
- }, "input"),
450
- // unshifts one char (or a string) into the input
451
- unput: /* @__PURE__ */ __name(function(ch) {
452
- var len = ch.length;
453
- var lines = ch.split(/(?:\r\n?|\n)/g);
454
- this._input = ch + this._input;
455
- this.yytext = this.yytext.substr(0, this.yytext.length - len);
456
- this.offset -= len;
457
- var oldLines = this.match.split(/(?:\r\n?|\n)/g);
458
- this.match = this.match.substr(0, this.match.length - 1);
459
- this.matched = this.matched.substr(0, this.matched.length - 1);
460
- if (lines.length - 1) {
461
- this.yylineno -= lines.length - 1;
462
- }
463
- var r = this.yylloc.range;
464
- this.yylloc = {
465
- first_line: this.yylloc.first_line,
466
- last_line: this.yylineno + 1,
467
- first_column: this.yylloc.first_column,
468
- 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
469
- };
470
- if (this.options.ranges) {
471
- this.yylloc.range = [r[0], r[0] + this.yyleng - len];
472
- }
473
- this.yyleng = this.yytext.length;
474
- return this;
475
- }, "unput"),
476
- // When called from action, caches matched text and appends it on next action
477
- more: /* @__PURE__ */ __name(function() {
478
- this._more = true;
479
- return this;
480
- }, "more"),
481
- // 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.
482
- reject: /* @__PURE__ */ __name(function() {
483
- if (this.options.backtrack_lexer) {
484
- this._backtrack = true;
485
- } else {
486
- 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(), {
487
- text: "",
488
- token: null,
489
- line: this.yylineno
490
- });
491
- }
492
- return this;
493
- }, "reject"),
494
- // retain first n characters of the match
495
- less: /* @__PURE__ */ __name(function(n) {
496
- this.unput(this.match.slice(n));
497
- }, "less"),
498
- // displays already matched input, i.e. for error messages
499
- pastInput: /* @__PURE__ */ __name(function() {
500
- var past = this.matched.substr(0, this.matched.length - this.match.length);
501
- return (past.length > 20 ? "..." : "") + past.substr(-20).replace(/\n/g, "");
502
- }, "pastInput"),
503
- // displays upcoming input, i.e. for error messages
504
- upcomingInput: /* @__PURE__ */ __name(function() {
505
- var next = this.match;
506
- if (next.length < 20) {
507
- next += this._input.substr(0, 20 - next.length);
508
- }
509
- return (next.substr(0, 20) + (next.length > 20 ? "..." : "")).replace(/\n/g, "");
510
- }, "upcomingInput"),
511
- // displays the character position where the lexing error occurred, i.e. for error messages
512
- showPosition: /* @__PURE__ */ __name(function() {
513
- var pre = this.pastInput();
514
- var c = new Array(pre.length + 1).join("-");
515
- return pre + this.upcomingInput() + "\n" + c + "^";
516
- }, "showPosition"),
517
- // test the lexed token: return FALSE when not a match, otherwise return token
518
- test_match: /* @__PURE__ */ __name(function(match, indexed_rule) {
519
- var token, lines, backup;
520
- if (this.options.backtrack_lexer) {
521
- backup = {
522
- yylineno: this.yylineno,
523
- yylloc: {
524
- first_line: this.yylloc.first_line,
525
- last_line: this.last_line,
526
- first_column: this.yylloc.first_column,
527
- last_column: this.yylloc.last_column
528
- },
529
- yytext: this.yytext,
530
- match: this.match,
531
- matches: this.matches,
532
- matched: this.matched,
533
- yyleng: this.yyleng,
534
- offset: this.offset,
535
- _more: this._more,
536
- _input: this._input,
537
- yy: this.yy,
538
- conditionStack: this.conditionStack.slice(0),
539
- done: this.done
540
- };
541
- if (this.options.ranges) {
542
- backup.yylloc.range = this.yylloc.range.slice(0);
543
- }
544
- }
545
- lines = match[0].match(/(?:\r\n?|\n).*/g);
546
- if (lines) {
547
- this.yylineno += lines.length;
548
- }
549
- this.yylloc = {
550
- first_line: this.yylloc.last_line,
551
- last_line: this.yylineno + 1,
552
- first_column: this.yylloc.last_column,
553
- last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length
554
- };
555
- this.yytext += match[0];
556
- this.match += match[0];
557
- this.matches = match;
558
- this.yyleng = this.yytext.length;
559
- if (this.options.ranges) {
560
- this.yylloc.range = [this.offset, this.offset += this.yyleng];
561
- }
562
- this._more = false;
563
- this._backtrack = false;
564
- this._input = this._input.slice(match[0].length);
565
- this.matched += match[0];
566
- token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
567
- if (this.done && this._input) {
568
- this.done = false;
569
- }
570
- if (token) {
571
- return token;
572
- } else if (this._backtrack) {
573
- for (var k in backup) {
574
- this[k] = backup[k];
575
- }
576
- return false;
577
- }
578
- return false;
579
- }, "test_match"),
580
- // return next match in input
581
- next: /* @__PURE__ */ __name(function() {
582
- if (this.done) {
583
- return this.EOF;
584
- }
585
- if (!this._input) {
586
- this.done = true;
587
- }
588
- var token, match, tempMatch, index;
589
- if (!this._more) {
590
- this.yytext = "";
591
- this.match = "";
592
- }
593
- var rules = this._currentRules();
594
- for (var i = 0; i < rules.length; i++) {
595
- tempMatch = this._input.match(this.rules[rules[i]]);
596
- if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
597
- match = tempMatch;
598
- index = i;
599
- if (this.options.backtrack_lexer) {
600
- token = this.test_match(tempMatch, rules[i]);
601
- if (token !== false) {
602
- return token;
603
- } else if (this._backtrack) {
604
- match = false;
605
- continue;
606
- } else {
607
- return false;
608
- }
609
- } else if (!this.options.flex) {
610
- break;
611
- }
612
- }
613
- }
614
- if (match) {
615
- token = this.test_match(match, rules[index]);
616
- if (token !== false) {
617
- return token;
618
- }
619
- return false;
620
- }
621
- if (this._input === "") {
622
- return this.EOF;
623
- } else {
624
- return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". Unrecognized text.\n" + this.showPosition(), {
625
- text: "",
626
- token: null,
627
- line: this.yylineno
628
- });
629
- }
630
- }, "next"),
631
- // return next match that has a token
632
- lex: /* @__PURE__ */ __name(function lex() {
633
- var r = this.next();
634
- if (r) {
635
- return r;
636
- } else {
637
- return this.lex();
638
- }
639
- }, "lex"),
640
- // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
641
- begin: /* @__PURE__ */ __name(function begin(condition) {
642
- this.conditionStack.push(condition);
643
- }, "begin"),
644
- // pop the previously active lexer condition state off the condition stack
645
- popState: /* @__PURE__ */ __name(function popState() {
646
- var n = this.conditionStack.length - 1;
647
- if (n > 0) {
648
- return this.conditionStack.pop();
649
- } else {
650
- return this.conditionStack[0];
651
- }
652
- }, "popState"),
653
- // produce the lexer rule set which is active for the currently active lexer condition state
654
- _currentRules: /* @__PURE__ */ __name(function _currentRules() {
655
- if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
656
- return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
657
- } else {
658
- return this.conditions["INITIAL"].rules;
659
- }
660
- }, "_currentRules"),
661
- // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
662
- topState: /* @__PURE__ */ __name(function topState(n) {
663
- n = this.conditionStack.length - 1 - Math.abs(n || 0);
664
- if (n >= 0) {
665
- return this.conditionStack[n];
666
- } else {
667
- return "INITIAL";
668
- }
669
- }, "topState"),
670
- // alias for begin(condition)
671
- pushState: /* @__PURE__ */ __name(function pushState(condition) {
672
- this.begin(condition);
673
- }, "pushState"),
674
- // return the number of states currently on the stack
675
- stateStackSize: /* @__PURE__ */ __name(function stateStackSize() {
676
- return this.conditionStack.length;
677
- }, "stateStackSize"),
678
- options: { "case-insensitive": true },
679
- performAction: /* @__PURE__ */ __name(function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) {
680
- switch ($avoiding_name_collisions) {
681
- case 0:
682
- return 5;
683
- case 1:
684
- break;
685
- case 2:
686
- break;
687
- case 3:
688
- break;
689
- case 4:
690
- break;
691
- case 5:
692
- break;
693
- case 6:
694
- return 19;
695
- case 7:
696
- this.begin("LINE");
697
- return 14;
698
- case 8:
699
- this.begin("ID");
700
- return 50;
701
- case 9:
702
- this.begin("ID");
703
- return 52;
704
- case 10:
705
- return 13;
706
- case 11:
707
- this.begin("ID");
708
- return 53;
709
- case 12:
710
- yy_.yytext = yy_.yytext.trim();
711
- this.begin("ALIAS");
712
- return 70;
713
- case 13:
714
- this.popState();
715
- this.popState();
716
- this.begin("LINE");
717
- return 51;
718
- case 14:
719
- this.popState();
720
- this.popState();
721
- return 5;
722
- case 15:
723
- this.begin("LINE");
724
- return 36;
725
- case 16:
726
- this.begin("LINE");
727
- return 37;
728
- case 17:
729
- this.begin("LINE");
730
- return 38;
731
- case 18:
732
- this.begin("LINE");
733
- return 39;
734
- case 19:
735
- this.begin("LINE");
736
- return 49;
737
- case 20:
738
- this.begin("LINE");
739
- return 41;
740
- case 21:
741
- this.begin("LINE");
742
- return 43;
743
- case 22:
744
- this.begin("LINE");
745
- return 48;
746
- case 23:
747
- this.begin("LINE");
748
- return 44;
749
- case 24:
750
- this.begin("LINE");
751
- return 47;
752
- case 25:
753
- this.begin("LINE");
754
- return 46;
755
- case 26:
756
- this.popState();
757
- return 15;
758
- case 27:
759
- return 16;
760
- case 28:
761
- return 65;
762
- case 29:
763
- return 66;
764
- case 30:
765
- return 59;
766
- case 31:
767
- return 60;
768
- case 32:
769
- return 61;
770
- case 33:
771
- return 62;
772
- case 34:
773
- return 57;
774
- case 35:
775
- return 54;
776
- case 36:
777
- this.begin("ID");
778
- return 21;
779
- case 37:
780
- this.begin("ID");
781
- return 23;
782
- case 38:
783
- return 29;
784
- case 39:
785
- return 30;
786
- case 40:
787
- this.begin("acc_title");
788
- return 31;
789
- case 41:
790
- this.popState();
791
- return "acc_title_value";
792
- case 42:
793
- this.begin("acc_descr");
794
- return 33;
795
- case 43:
796
- this.popState();
797
- return "acc_descr_value";
798
- case 44:
799
- this.begin("acc_descr_multiline");
800
- break;
801
- case 45:
802
- this.popState();
803
- break;
804
- case 46:
805
- return "acc_descr_multiline_value";
806
- case 47:
807
- return 6;
808
- case 48:
809
- return 18;
810
- case 49:
811
- return 20;
812
- case 50:
813
- return 64;
814
- case 51:
815
- return 5;
816
- case 52:
817
- yy_.yytext = yy_.yytext.trim();
818
- return 70;
819
- case 53:
820
- return 73;
821
- case 54:
822
- return 74;
823
- case 55:
824
- return 75;
825
- case 56:
826
- return 76;
827
- case 57:
828
- return 71;
829
- case 58:
830
- return 72;
831
- case 59:
832
- return 77;
833
- case 60:
834
- return 78;
835
- case 61:
836
- return 79;
837
- case 62:
838
- return 80;
839
- case 63:
840
- return 81;
841
- case 64:
842
- return 68;
843
- case 65:
844
- return 69;
845
- case 66:
846
- return 5;
847
- case 67:
848
- return "INVALID";
849
- }
850
- }, "anonymous"),
851
- rules: [/^(?:[\n]+)/i, /^(?:\s+)/i, /^(?:((?!\n)\s)+)/i, /^(?:#[^\n]*)/i, /^(?:%(?!\{)[^\n]*)/i, /^(?:[^\}]%%[^\n]*)/i, /^(?:[0-9]+(?=[ \n]+))/i, /^(?:box\b)/i, /^(?:participant\b)/i, /^(?:actor\b)/i, /^(?:create\b)/i, /^(?:destroy\b)/i, /^(?:[^\<->\->:\n,;]+?([\-]*[^\<->\->:\n,;]+?)*?(?=((?!\n)\s)+as(?!\n)\s|[#\n;]|$))/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, /^(?::(?:(?:no)?wrap)?[^#\n;]+)/i, /^(?:\+)/i, /^(?:-)/i, /^(?:$)/i, /^(?:.)/i],
852
- conditions: { "acc_descr_multiline": { "rules": [45, 46], "inclusive": false }, "acc_descr": { "rules": [43], "inclusive": false }, "acc_title": { "rules": [41], "inclusive": false }, "ID": { "rules": [2, 3, 12], "inclusive": false }, "ALIAS": { "rules": [2, 3, 13, 14], "inclusive": false }, "LINE": { "rules": [2, 3, 26], "inclusive": false }, "INITIAL": { "rules": [0, 1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 42, 44, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67], "inclusive": true } }
853
- };
854
- return lexer2;
855
- }();
856
- parser2.lexer = lexer;
857
- function Parser() {
858
- this.yy = {};
859
- }
860
- __name(Parser, "Parser");
861
- Parser.prototype = parser2;
862
- parser2.Parser = Parser;
863
- return new Parser();
864
- }();
865
- parser.parser = parser;
866
- var sequenceDiagram_default = parser;
867
- var LINETYPE = {
868
- SOLID: 0,
869
- DOTTED: 1,
870
- NOTE: 2,
871
- SOLID_CROSS: 3,
872
- DOTTED_CROSS: 4,
873
- SOLID_OPEN: 5,
874
- DOTTED_OPEN: 6,
875
- LOOP_START: 10,
876
- LOOP_END: 11,
877
- ALT_START: 12,
878
- ALT_ELSE: 13,
879
- ALT_END: 14,
880
- OPT_START: 15,
881
- OPT_END: 16,
882
- ACTIVE_START: 17,
883
- ACTIVE_END: 18,
884
- PAR_START: 19,
885
- PAR_AND: 20,
886
- PAR_END: 21,
887
- RECT_START: 22,
888
- RECT_END: 23,
889
- SOLID_POINT: 24,
890
- DOTTED_POINT: 25,
891
- AUTONUMBER: 26,
892
- CRITICAL_START: 27,
893
- CRITICAL_OPTION: 28,
894
- CRITICAL_END: 29,
895
- BREAK_START: 30,
896
- BREAK_END: 31,
897
- PAR_OVER_START: 32,
898
- BIDIRECTIONAL_SOLID: 33,
899
- BIDIRECTIONAL_DOTTED: 34
900
- };
901
- var ARROWTYPE = {
902
- FILLED: 0,
903
- OPEN: 1
904
- };
905
- var PLACEMENT = {
906
- LEFTOF: 0,
907
- RIGHTOF: 1,
908
- OVER: 2
909
- };
910
- var SequenceDB = class {
911
- constructor() {
912
- this.state = new ImperativeState(() => ({
913
- prevActor: void 0,
914
- actors: /* @__PURE__ */ new Map(),
915
- createdActors: /* @__PURE__ */ new Map(),
916
- destroyedActors: /* @__PURE__ */ new Map(),
917
- boxes: [],
918
- messages: [],
919
- notes: [],
920
- sequenceNumbersEnabled: false,
921
- wrapEnabled: void 0,
922
- currentBox: void 0,
923
- lastCreated: void 0,
924
- lastDestroyed: void 0
925
- }));
926
- this.setAccTitle = setAccTitle;
927
- this.setAccDescription = setAccDescription;
928
- this.setDiagramTitle = setDiagramTitle;
929
- this.getAccTitle = getAccTitle;
930
- this.getAccDescription = getAccDescription;
931
- this.getDiagramTitle = getDiagramTitle;
932
- this.apply = this.apply.bind(this);
933
- this.parseBoxData = this.parseBoxData.bind(this);
934
- this.parseMessage = this.parseMessage.bind(this);
935
- this.clear();
936
- this.setWrap(getConfig2().wrap);
937
- this.LINETYPE = LINETYPE;
938
- this.ARROWTYPE = ARROWTYPE;
939
- this.PLACEMENT = PLACEMENT;
940
- }
941
- static {
942
- __name(this, "SequenceDB");
943
- }
944
- addBox(data) {
945
- this.state.records.boxes.push({
946
- name: data.text,
947
- wrap: data.wrap ?? this.autoWrap(),
948
- fill: data.color,
949
- actorKeys: []
950
- });
951
- this.state.records.currentBox = this.state.records.boxes.slice(-1)[0];
952
- }
953
- addActor(id, name, description, type) {
954
- let assignedBox = this.state.records.currentBox;
955
- const old = this.state.records.actors.get(id);
956
- if (old) {
957
- if (this.state.records.currentBox && old.box && this.state.records.currentBox !== old.box) {
958
- throw new Error(
959
- `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.`
960
- );
961
- }
962
- assignedBox = old.box ? old.box : this.state.records.currentBox;
963
- old.box = assignedBox;
964
- if (old && name === old.name && description == null) {
965
- return;
966
- }
967
- }
968
- if (description?.text == null) {
969
- description = { text: name, type };
970
- }
971
- if (type == null || description.text == null) {
972
- description = { text: name, type };
973
- }
974
- this.state.records.actors.set(id, {
975
- box: assignedBox,
976
- name,
977
- description: description.text,
978
- wrap: description.wrap ?? this.autoWrap(),
979
- prevActor: this.state.records.prevActor,
980
- links: {},
981
- properties: {},
982
- actorCnt: null,
983
- rectData: null,
984
- type: type ?? "participant"
985
- });
986
- if (this.state.records.prevActor) {
987
- const prevActorInRecords = this.state.records.actors.get(this.state.records.prevActor);
988
- if (prevActorInRecords) {
989
- prevActorInRecords.nextActor = id;
990
- }
991
- }
992
- if (this.state.records.currentBox) {
993
- this.state.records.currentBox.actorKeys.push(id);
994
- }
995
- this.state.records.prevActor = id;
996
- }
997
- activationCount(part) {
998
- let i;
999
- let count = 0;
1000
- if (!part) {
1001
- return 0;
1002
- }
1003
- for (i = 0; i < this.state.records.messages.length; i++) {
1004
- if (this.state.records.messages[i].type === this.LINETYPE.ACTIVE_START && this.state.records.messages[i].from === part) {
1005
- count++;
1006
- }
1007
- if (this.state.records.messages[i].type === this.LINETYPE.ACTIVE_END && this.state.records.messages[i].from === part) {
1008
- count--;
1009
- }
1010
- }
1011
- return count;
1012
- }
1013
- addMessage(idFrom, idTo, message, answer) {
1014
- this.state.records.messages.push({
1015
- id: this.state.records.messages.length.toString(),
1016
- from: idFrom,
1017
- to: idTo,
1018
- message: message.text,
1019
- wrap: message.wrap ?? this.autoWrap(),
1020
- answer
1021
- });
1022
- }
1023
- addSignal(idFrom, idTo, message, messageType, activate = false) {
1024
- if (messageType === this.LINETYPE.ACTIVE_END) {
1025
- const cnt = this.activationCount(idFrom ?? "");
1026
- if (cnt < 1) {
1027
- const error = new Error("Trying to inactivate an inactive participant (" + idFrom + ")");
1028
- error.hash = {
1029
- text: "->>-",
1030
- token: "->>-",
1031
- line: "1",
1032
- loc: { first_line: 1, last_line: 1, first_column: 1, last_column: 1 },
1033
- expected: ["'ACTIVE_PARTICIPANT'"]
1034
- };
1035
- throw error;
1036
- }
1037
- }
1038
- this.state.records.messages.push({
1039
- id: this.state.records.messages.length.toString(),
1040
- from: idFrom,
1041
- to: idTo,
1042
- message: message?.text ?? "",
1043
- wrap: message?.wrap ?? this.autoWrap(),
1044
- type: messageType,
1045
- activate
1046
- });
1047
- return true;
1048
- }
1049
- hasAtLeastOneBox() {
1050
- return this.state.records.boxes.length > 0;
1051
- }
1052
- hasAtLeastOneBoxWithTitle() {
1053
- return this.state.records.boxes.some((b) => b.name);
1054
- }
1055
- getMessages() {
1056
- return this.state.records.messages;
1057
- }
1058
- getBoxes() {
1059
- return this.state.records.boxes;
1060
- }
1061
- getActors() {
1062
- return this.state.records.actors;
1063
- }
1064
- getCreatedActors() {
1065
- return this.state.records.createdActors;
1066
- }
1067
- getDestroyedActors() {
1068
- return this.state.records.destroyedActors;
1069
- }
1070
- getActor(id) {
1071
- return this.state.records.actors.get(id);
1072
- }
1073
- getActorKeys() {
1074
- return [...this.state.records.actors.keys()];
1075
- }
1076
- enableSequenceNumbers() {
1077
- this.state.records.sequenceNumbersEnabled = true;
1078
- }
1079
- disableSequenceNumbers() {
1080
- this.state.records.sequenceNumbersEnabled = false;
1081
- }
1082
- showSequenceNumbers() {
1083
- return this.state.records.sequenceNumbersEnabled;
1084
- }
1085
- setWrap(wrapSetting) {
1086
- this.state.records.wrapEnabled = wrapSetting;
1087
- }
1088
- extractWrap(text) {
1089
- if (text === void 0) {
1090
- return {};
1091
- }
1092
- text = text.trim();
1093
- const wrap = /^:?wrap:/.exec(text) !== null ? true : /^:?nowrap:/.exec(text) !== null ? false : void 0;
1094
- const cleanedText = (wrap === void 0 ? text : text.replace(/^:?(?:no)?wrap:/, "")).trim();
1095
- return { cleanedText, wrap };
1096
- }
1097
- autoWrap() {
1098
- if (this.state.records.wrapEnabled !== void 0) {
1099
- return this.state.records.wrapEnabled;
1100
- }
1101
- return getConfig2().sequence?.wrap ?? false;
1102
- }
1103
- clear() {
1104
- this.state.reset();
1105
- clear();
1106
- }
1107
- parseMessage(str) {
1108
- const trimmedStr = str.trim();
1109
- const { wrap, cleanedText } = this.extractWrap(trimmedStr);
1110
- const message = {
1111
- text: cleanedText,
1112
- wrap
1113
- };
1114
- log.debug(`parseMessage: ${JSON.stringify(message)}`);
1115
- return message;
1116
- }
1117
- // We expect the box statement to be color first then description
1118
- // 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
1119
- // We extract first segment as color, the rest of the line is considered as text
1120
- parseBoxData(str) {
1121
- const match = /^((?:rgba?|hsla?)\s*\(.*\)|\w*)(.*)$/.exec(str);
1122
- let color = match?.[1] ? match[1].trim() : "transparent";
1123
- let title = match?.[2] ? match[2].trim() : void 0;
1124
- if (window?.CSS) {
1125
- if (!window.CSS.supports("color", color)) {
1126
- color = "transparent";
1127
- title = str.trim();
1128
- }
1129
- } else {
1130
- const style = new Option().style;
1131
- style.color = color;
1132
- if (style.color !== color) {
1133
- color = "transparent";
1134
- title = str.trim();
1135
- }
1136
- }
1137
- const { wrap, cleanedText } = this.extractWrap(title);
1138
- return {
1139
- text: cleanedText ? sanitizeText(cleanedText, getConfig2()) : void 0,
1140
- color,
1141
- wrap
1142
- };
1143
- }
1144
- addNote(actor, placement, message) {
1145
- const note = {
1146
- actor,
1147
- placement,
1148
- message: message.text,
1149
- wrap: message.wrap ?? this.autoWrap()
1150
- };
1151
- const actors = [].concat(actor, actor);
1152
- this.state.records.notes.push(note);
1153
- this.state.records.messages.push({
1154
- id: this.state.records.messages.length.toString(),
1155
- from: actors[0],
1156
- to: actors[1],
1157
- message: message.text,
1158
- wrap: message.wrap ?? this.autoWrap(),
1159
- type: this.LINETYPE.NOTE,
1160
- placement
1161
- });
1162
- }
1163
- addLinks(actorId, text) {
1164
- const actor = this.getActor(actorId);
1165
- try {
1166
- let sanitizedText = sanitizeText(text.text, getConfig2());
1167
- sanitizedText = sanitizedText.replace(/&equals;/g, "=");
1168
- sanitizedText = sanitizedText.replace(/&amp;/g, "&");
1169
- const links = JSON.parse(sanitizedText);
1170
- this.insertLinks(actor, links);
1171
- } catch (e) {
1172
- log.error("error while parsing actor link text", e);
1173
- }
1174
- }
1175
- addALink(actorId, text) {
1176
- const actor = this.getActor(actorId);
1177
- try {
1178
- const links = {};
1179
- let sanitizedText = sanitizeText(text.text, getConfig2());
1180
- const sep = sanitizedText.indexOf("@");
1181
- sanitizedText = sanitizedText.replace(/&equals;/g, "=");
1182
- sanitizedText = sanitizedText.replace(/&amp;/g, "&");
1183
- const label = sanitizedText.slice(0, sep - 1).trim();
1184
- const link = sanitizedText.slice(sep + 1).trim();
1185
- links[label] = link;
1186
- this.insertLinks(actor, links);
1187
- } catch (e) {
1188
- log.error("error while parsing actor link text", e);
1189
- }
1190
- }
1191
- insertLinks(actor, links) {
1192
- if (actor.links == null) {
1193
- actor.links = links;
1194
- } else {
1195
- for (const key in links) {
1196
- actor.links[key] = links[key];
1197
- }
1198
- }
1199
- }
1200
- addProperties(actorId, text) {
1201
- const actor = this.getActor(actorId);
1202
- try {
1203
- const sanitizedText = sanitizeText(text.text, getConfig2());
1204
- const properties = JSON.parse(sanitizedText);
1205
- this.insertProperties(actor, properties);
1206
- } catch (e) {
1207
- log.error("error while parsing actor properties text", e);
1208
- }
1209
- }
1210
- insertProperties(actor, properties) {
1211
- if (actor.properties == null) {
1212
- actor.properties = properties;
1213
- } else {
1214
- for (const key in properties) {
1215
- actor.properties[key] = properties[key];
1216
- }
1217
- }
1218
- }
1219
- boxEnd() {
1220
- this.state.records.currentBox = void 0;
1221
- }
1222
- addDetails(actorId, text) {
1223
- const actor = this.getActor(actorId);
1224
- const elem = document.getElementById(text.text);
1225
- try {
1226
- const text2 = elem.innerHTML;
1227
- const details = JSON.parse(text2);
1228
- if (details.properties) {
1229
- this.insertProperties(actor, details.properties);
1230
- }
1231
- if (details.links) {
1232
- this.insertLinks(actor, details.links);
1233
- }
1234
- } catch (e) {
1235
- log.error("error while parsing actor details text", e);
1236
- }
1237
- }
1238
- getActorProperty(actor, key) {
1239
- if (actor?.properties !== void 0) {
1240
- return actor.properties[key];
1241
- }
1242
- return void 0;
1243
- }
1244
- // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-redundant-type-constituents
1245
- apply(param) {
1246
- if (Array.isArray(param)) {
1247
- param.forEach((item) => {
1248
- this.apply(item);
1249
- });
1250
- } else {
1251
- switch (param.type) {
1252
- case "sequenceIndex":
1253
- this.state.records.messages.push({
1254
- id: this.state.records.messages.length.toString(),
1255
- from: void 0,
1256
- to: void 0,
1257
- message: {
1258
- start: param.sequenceIndex,
1259
- step: param.sequenceIndexStep,
1260
- visible: param.sequenceVisible
1261
- },
1262
- wrap: false,
1263
- type: param.signalType
1264
- });
1265
- break;
1266
- case "addParticipant":
1267
- this.addActor(param.actor, param.actor, param.description, param.draw);
1268
- break;
1269
- case "createParticipant":
1270
- if (this.state.records.actors.has(param.actor)) {
1271
- throw new Error(
1272
- "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"
1273
- );
1274
- }
1275
- this.state.records.lastCreated = param.actor;
1276
- this.addActor(param.actor, param.actor, param.description, param.draw);
1277
- this.state.records.createdActors.set(param.actor, this.state.records.messages.length);
1278
- break;
1279
- case "destroyParticipant":
1280
- this.state.records.lastDestroyed = param.actor;
1281
- this.state.records.destroyedActors.set(param.actor, this.state.records.messages.length);
1282
- break;
1283
- case "activeStart":
1284
- this.addSignal(param.actor, void 0, void 0, param.signalType);
1285
- break;
1286
- case "activeEnd":
1287
- this.addSignal(param.actor, void 0, void 0, param.signalType);
1288
- break;
1289
- case "addNote":
1290
- this.addNote(param.actor, param.placement, param.text);
1291
- break;
1292
- case "addLinks":
1293
- this.addLinks(param.actor, param.text);
1294
- break;
1295
- case "addALink":
1296
- this.addALink(param.actor, param.text);
1297
- break;
1298
- case "addProperties":
1299
- this.addProperties(param.actor, param.text);
1300
- break;
1301
- case "addDetails":
1302
- this.addDetails(param.actor, param.text);
1303
- break;
1304
- case "addMessage":
1305
- if (this.state.records.lastCreated) {
1306
- if (param.to !== this.state.records.lastCreated) {
1307
- throw new Error(
1308
- "The created participant " + this.state.records.lastCreated.name + " does not have an associated creating message after its declaration. Please check the sequence diagram."
1309
- );
1310
- } else {
1311
- this.state.records.lastCreated = void 0;
1312
- }
1313
- } else if (this.state.records.lastDestroyed) {
1314
- if (param.to !== this.state.records.lastDestroyed && param.from !== this.state.records.lastDestroyed) {
1315
- throw new Error(
1316
- "The destroyed participant " + this.state.records.lastDestroyed.name + " does not have an associated destroying message after its declaration. Please check the sequence diagram."
1317
- );
1318
- } else {
1319
- this.state.records.lastDestroyed = void 0;
1320
- }
1321
- }
1322
- this.addSignal(param.from, param.to, param.msg, param.signalType, param.activate);
1323
- break;
1324
- case "boxStart":
1325
- this.addBox(param.boxData);
1326
- break;
1327
- case "boxEnd":
1328
- this.boxEnd();
1329
- break;
1330
- case "loopStart":
1331
- this.addSignal(void 0, void 0, param.loopText, param.signalType);
1332
- break;
1333
- case "loopEnd":
1334
- this.addSignal(void 0, void 0, void 0, param.signalType);
1335
- break;
1336
- case "rectStart":
1337
- this.addSignal(void 0, void 0, param.color, param.signalType);
1338
- break;
1339
- case "rectEnd":
1340
- this.addSignal(void 0, void 0, void 0, param.signalType);
1341
- break;
1342
- case "optStart":
1343
- this.addSignal(void 0, void 0, param.optText, param.signalType);
1344
- break;
1345
- case "optEnd":
1346
- this.addSignal(void 0, void 0, void 0, param.signalType);
1347
- break;
1348
- case "altStart":
1349
- this.addSignal(void 0, void 0, param.altText, param.signalType);
1350
- break;
1351
- case "else":
1352
- this.addSignal(void 0, void 0, param.altText, param.signalType);
1353
- break;
1354
- case "altEnd":
1355
- this.addSignal(void 0, void 0, void 0, param.signalType);
1356
- break;
1357
- case "setAccTitle":
1358
- setAccTitle(param.text);
1359
- break;
1360
- case "parStart":
1361
- this.addSignal(void 0, void 0, param.parText, param.signalType);
1362
- break;
1363
- case "and":
1364
- this.addSignal(void 0, void 0, param.parText, param.signalType);
1365
- break;
1366
- case "parEnd":
1367
- this.addSignal(void 0, void 0, void 0, param.signalType);
1368
- break;
1369
- case "criticalStart":
1370
- this.addSignal(void 0, void 0, param.criticalText, param.signalType);
1371
- break;
1372
- case "option":
1373
- this.addSignal(void 0, void 0, param.optionText, param.signalType);
1374
- break;
1375
- case "criticalEnd":
1376
- this.addSignal(void 0, void 0, void 0, param.signalType);
1377
- break;
1378
- case "breakStart":
1379
- this.addSignal(void 0, void 0, param.breakText, param.signalType);
1380
- break;
1381
- case "breakEnd":
1382
- this.addSignal(void 0, void 0, void 0, param.signalType);
1383
- break;
1384
- }
1385
- }
1386
- }
1387
- getConfig() {
1388
- return getConfig2().sequence;
1389
- }
1390
- };
1391
- var getStyles = /* @__PURE__ */ __name((options) => `.actor {
1392
- stroke: ${options.actorBorder};
1393
- fill: ${options.actorBkg};
1394
- }
1395
-
1396
- text.actor > tspan {
1397
- fill: ${options.actorTextColor};
1398
- stroke: none;
1399
- }
1400
-
1401
- .actor-line {
1402
- stroke: ${options.actorLineColor};
1403
- }
1404
-
1405
- .messageLine0 {
1406
- stroke-width: 1.5;
1407
- stroke-dasharray: none;
1408
- stroke: ${options.signalColor};
1409
- }
1410
-
1411
- .messageLine1 {
1412
- stroke-width: 1.5;
1413
- stroke-dasharray: 2, 2;
1414
- stroke: ${options.signalColor};
1415
- }
1416
-
1417
- #arrowhead path {
1418
- fill: ${options.signalColor};
1419
- stroke: ${options.signalColor};
1420
- }
1421
-
1422
- .sequenceNumber {
1423
- fill: ${options.sequenceNumberColor};
1424
- }
1425
-
1426
- #sequencenumber {
1427
- fill: ${options.signalColor};
1428
- }
1429
-
1430
- #crosshead path {
1431
- fill: ${options.signalColor};
1432
- stroke: ${options.signalColor};
1433
- }
1434
-
1435
- .messageText {
1436
- fill: ${options.signalTextColor};
1437
- stroke: none;
1438
- }
1439
-
1440
- .labelBox {
1441
- stroke: ${options.labelBoxBorderColor};
1442
- fill: ${options.labelBoxBkgColor};
1443
- }
1444
-
1445
- .labelText, .labelText > tspan {
1446
- fill: ${options.labelTextColor};
1447
- stroke: none;
1448
- }
1449
-
1450
- .loopText, .loopText > tspan {
1451
- fill: ${options.loopTextColor};
1452
- stroke: none;
1453
- }
1454
-
1455
- .loopLine {
1456
- stroke-width: 2px;
1457
- stroke-dasharray: 2, 2;
1458
- stroke: ${options.labelBoxBorderColor};
1459
- fill: ${options.labelBoxBorderColor};
1460
- }
1461
-
1462
- .note {
1463
- //stroke: #decc93;
1464
- stroke: ${options.noteBorderColor};
1465
- fill: ${options.noteBkgColor};
1466
- }
1467
-
1468
- .noteText, .noteText > tspan {
1469
- fill: ${options.noteTextColor};
1470
- stroke: none;
1471
- }
1472
-
1473
- .activation0 {
1474
- fill: ${options.activationBkgColor};
1475
- stroke: ${options.activationBorderColor};
1476
- }
1477
-
1478
- .activation1 {
1479
- fill: ${options.activationBkgColor};
1480
- stroke: ${options.activationBorderColor};
1481
- }
1482
-
1483
- .activation2 {
1484
- fill: ${options.activationBkgColor};
1485
- stroke: ${options.activationBorderColor};
1486
- }
1487
-
1488
- .actorPopupMenu {
1489
- position: absolute;
1490
- }
1491
-
1492
- .actorPopupMenuPanel {
1493
- position: absolute;
1494
- fill: ${options.actorBkg};
1495
- box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
1496
- filter: drop-shadow(3px 5px 2px rgb(0 0 0 / 0.4));
1497
- }
1498
- .actor-man line {
1499
- stroke: ${options.actorBorder};
1500
- fill: ${options.actorBkg};
1501
- }
1502
- .actor-man circle, line {
1503
- stroke: ${options.actorBorder};
1504
- fill: ${options.actorBkg};
1505
- stroke-width: 2px;
1506
- }
1507
- `, "getStyles");
1508
- var styles_default = getStyles;
1509
- var ACTOR_TYPE_WIDTH = 18 * 2;
1510
- var TOP_ACTOR_CLASS = "actor-top";
1511
- var BOTTOM_ACTOR_CLASS = "actor-bottom";
1512
- var ACTOR_BOX_CLASS = "actor-box";
1513
- var ACTOR_MAN_FIGURE_CLASS = "actor-man";
1514
- var drawRect2 = /* @__PURE__ */ __name(function(elem, rectData) {
1515
- return drawRect(elem, rectData);
1516
- }, "drawRect");
1517
- var drawPopup = /* @__PURE__ */ __name(function(elem, actor, minMenuWidth, textAttrs, forceMenus) {
1518
- if (actor.links === void 0 || actor.links === null || Object.keys(actor.links).length === 0) {
1519
- return { height: 0, width: 0 };
1520
- }
1521
- const links = actor.links;
1522
- const actorCnt2 = actor.actorCnt;
1523
- const rectData = actor.rectData;
1524
- var displayValue = "none";
1525
- if (forceMenus) {
1526
- displayValue = "block !important";
1527
- }
1528
- const g = elem.append("g");
1529
- g.attr("id", "actor" + actorCnt2 + "_popup");
1530
- g.attr("class", "actorPopupMenu");
1531
- g.attr("display", displayValue);
1532
- var actorClass = "";
1533
- if (rectData.class !== void 0) {
1534
- actorClass = " " + rectData.class;
1535
- }
1536
- let menuWidth = rectData.width > minMenuWidth ? rectData.width : minMenuWidth;
1537
- const rectElem = g.append("rect");
1538
- rectElem.attr("class", "actorPopupMenuPanel" + actorClass);
1539
- rectElem.attr("x", rectData.x);
1540
- rectElem.attr("y", rectData.height);
1541
- rectElem.attr("fill", rectData.fill);
1542
- rectElem.attr("stroke", rectData.stroke);
1543
- rectElem.attr("width", menuWidth);
1544
- rectElem.attr("height", rectData.height);
1545
- rectElem.attr("rx", rectData.rx);
1546
- rectElem.attr("ry", rectData.ry);
1547
- if (links != null) {
1548
- var linkY = 20;
1549
- for (let key in links) {
1550
- var linkElem = g.append("a");
1551
- var sanitizedLink = distExports.sanitizeUrl(links[key]);
1552
- linkElem.attr("xlink:href", sanitizedLink);
1553
- linkElem.attr("target", "_blank");
1554
- _drawMenuItemTextCandidateFunc(textAttrs)(
1555
- key,
1556
- linkElem,
1557
- rectData.x + 10,
1558
- rectData.height + linkY,
1559
- menuWidth,
1560
- 20,
1561
- { class: "actor" },
1562
- textAttrs
1563
- );
1564
- linkY += 30;
1565
- }
1566
- }
1567
- rectElem.attr("height", linkY);
1568
- return { height: rectData.height + linkY, width: menuWidth };
1569
- }, "drawPopup");
1570
- var popupMenuToggle = /* @__PURE__ */ __name(function(popId) {
1571
- return "var pu = document.getElementById('" + popId + "'); if (pu != null) { pu.style.display = pu.style.display == 'block' ? 'none' : 'block'; }";
1572
- }, "popupMenuToggle");
1573
- var drawKatex = /* @__PURE__ */ __name(async function(elem, textData, msgModel = null) {
1574
- let textElem = elem.append("foreignObject");
1575
- const lines = await renderKatex(textData.text, getConfig());
1576
- const divElem = textElem.append("xhtml:div").attr("style", "width: fit-content;").attr("xmlns", "http://www.w3.org/1999/xhtml").html(lines);
1577
- const dim = divElem.node().getBoundingClientRect();
1578
- textElem.attr("height", Math.round(dim.height)).attr("width", Math.round(dim.width));
1579
- if (textData.class === "noteText") {
1580
- const rectElem = elem.node().firstChild;
1581
- rectElem.setAttribute("height", dim.height + 2 * textData.textMargin);
1582
- const rectDim = rectElem.getBBox();
1583
- 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));
1584
- } else if (msgModel) {
1585
- let { startx, stopx, starty } = msgModel;
1586
- if (startx > stopx) {
1587
- const temp = startx;
1588
- startx = stopx;
1589
- stopx = temp;
1590
- }
1591
- textElem.attr("x", Math.round(startx + Math.abs(startx - stopx) / 2 - dim.width / 2));
1592
- if (textData.class === "loopText") {
1593
- textElem.attr("y", Math.round(starty));
1594
- } else {
1595
- textElem.attr("y", Math.round(starty - dim.height));
1596
- }
1597
- }
1598
- return [textElem];
1599
- }, "drawKatex");
1600
- var drawText = /* @__PURE__ */ __name(function(elem, textData) {
1601
- let prevTextHeight = 0;
1602
- let textHeight = 0;
1603
- const lines = textData.text.split(common_default.lineBreakRegex);
1604
- const [_textFontSize, _textFontSizePx] = parseFontSize(textData.fontSize);
1605
- let textElems = [];
1606
- let dy = 0;
1607
- let yfunc = /* @__PURE__ */ __name(() => textData.y, "yfunc");
1608
- if (textData.valign !== void 0 && textData.textMargin !== void 0 && textData.textMargin > 0) {
1609
- switch (textData.valign) {
1610
- case "top":
1611
- case "start":
1612
- yfunc = /* @__PURE__ */ __name(() => Math.round(textData.y + textData.textMargin), "yfunc");
1613
- break;
1614
- case "middle":
1615
- case "center":
1616
- yfunc = /* @__PURE__ */ __name(() => Math.round(textData.y + (prevTextHeight + textHeight + textData.textMargin) / 2), "yfunc");
1617
- break;
1618
- case "bottom":
1619
- case "end":
1620
- yfunc = /* @__PURE__ */ __name(() => Math.round(
1621
- textData.y + (prevTextHeight + textHeight + 2 * textData.textMargin) - textData.textMargin
1622
- ), "yfunc");
1623
- break;
1624
- }
1625
- }
1626
- if (textData.anchor !== void 0 && textData.textMargin !== void 0 && textData.width !== void 0) {
1627
- switch (textData.anchor) {
1628
- case "left":
1629
- case "start":
1630
- textData.x = Math.round(textData.x + textData.textMargin);
1631
- textData.anchor = "start";
1632
- textData.dominantBaseline = "middle";
1633
- textData.alignmentBaseline = "middle";
1634
- break;
1635
- case "middle":
1636
- case "center":
1637
- textData.x = Math.round(textData.x + textData.width / 2);
1638
- textData.anchor = "middle";
1639
- textData.dominantBaseline = "middle";
1640
- textData.alignmentBaseline = "middle";
1641
- break;
1642
- case "right":
1643
- case "end":
1644
- textData.x = Math.round(textData.x + textData.width - textData.textMargin);
1645
- textData.anchor = "end";
1646
- textData.dominantBaseline = "middle";
1647
- textData.alignmentBaseline = "middle";
1648
- break;
1649
- }
1650
- }
1651
- for (let [i, line] of lines.entries()) {
1652
- if (textData.textMargin !== void 0 && textData.textMargin === 0 && _textFontSize !== void 0) {
1653
- dy = i * _textFontSize;
1654
- }
1655
- const textElem = elem.append("text");
1656
- textElem.attr("x", textData.x);
1657
- textElem.attr("y", yfunc());
1658
- if (textData.anchor !== void 0) {
1659
- textElem.attr("text-anchor", textData.anchor).attr("dominant-baseline", textData.dominantBaseline).attr("alignment-baseline", textData.alignmentBaseline);
1660
- }
1661
- if (textData.fontFamily !== void 0) {
1662
- textElem.style("font-family", textData.fontFamily);
1663
- }
1664
- if (_textFontSizePx !== void 0) {
1665
- textElem.style("font-size", _textFontSizePx);
1666
- }
1667
- if (textData.fontWeight !== void 0) {
1668
- textElem.style("font-weight", textData.fontWeight);
1669
- }
1670
- if (textData.fill !== void 0) {
1671
- textElem.attr("fill", textData.fill);
1672
- }
1673
- if (textData.class !== void 0) {
1674
- textElem.attr("class", textData.class);
1675
- }
1676
- if (textData.dy !== void 0) {
1677
- textElem.attr("dy", textData.dy);
1678
- } else if (dy !== 0) {
1679
- textElem.attr("dy", dy);
1680
- }
1681
- const text = line || ZERO_WIDTH_SPACE;
1682
- if (textData.tspan) {
1683
- const span = textElem.append("tspan");
1684
- span.attr("x", textData.x);
1685
- if (textData.fill !== void 0) {
1686
- span.attr("fill", textData.fill);
1687
- }
1688
- span.text(text);
1689
- } else {
1690
- textElem.text(text);
1691
- }
1692
- if (textData.valign !== void 0 && textData.textMargin !== void 0 && textData.textMargin > 0) {
1693
- textHeight += (textElem._groups || textElem)[0][0].getBBox().height;
1694
- prevTextHeight = textHeight;
1695
- }
1696
- textElems.push(textElem);
1697
- }
1698
- return textElems;
1699
- }, "drawText");
1700
- var drawLabel = /* @__PURE__ */ __name(function(elem, txtObject) {
1701
- function genPoints(x, y, width, height, cut) {
1702
- return x + "," + y + " " + (x + width) + "," + y + " " + (x + width) + "," + (y + height - cut) + " " + (x + width - cut * 1.2) + "," + (y + height) + " " + x + "," + (y + height);
1703
- }
1704
- __name(genPoints, "genPoints");
1705
- const polygon = elem.append("polygon");
1706
- polygon.attr("points", genPoints(txtObject.x, txtObject.y, txtObject.width, txtObject.height, 7));
1707
- polygon.attr("class", "labelBox");
1708
- txtObject.y = txtObject.y + txtObject.height / 2;
1709
- drawText(elem, txtObject);
1710
- return polygon;
1711
- }, "drawLabel");
1712
- var actorCnt = -1;
1713
- var fixLifeLineHeights = /* @__PURE__ */ __name((diagram2, actors, actorKeys, conf2) => {
1714
- if (!diagram2.select) {
1715
- return;
1716
- }
1717
- actorKeys.forEach((actorKey) => {
1718
- const actor = actors.get(actorKey);
1719
- const actorDOM = diagram2.select("#actor" + actor.actorCnt);
1720
- if (!conf2.mirrorActors && actor.stopy) {
1721
- actorDOM.attr("y2", actor.stopy + actor.height / 2);
1722
- } else if (conf2.mirrorActors) {
1723
- actorDOM.attr("y2", actor.stopy);
1724
- }
1725
- });
1726
- }, "fixLifeLineHeights");
1727
- var drawActorTypeParticipant = /* @__PURE__ */ __name(function(elem, actor, conf2, isFooter) {
1728
- const actorY = isFooter ? actor.stopy : actor.starty;
1729
- const center = actor.x + actor.width / 2;
1730
- const centerY = actorY + actor.height;
1731
- const boxplusLineGroup = elem.append("g").lower();
1732
- var g = boxplusLineGroup;
1733
- if (!isFooter) {
1734
- actorCnt++;
1735
- if (Object.keys(actor.links || {}).length && !conf2.forceMenus) {
1736
- g.attr("onclick", popupMenuToggle(`actor${actorCnt}_popup`)).attr("cursor", "pointer");
1737
- }
1738
- 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);
1739
- g = boxplusLineGroup.append("g");
1740
- actor.actorCnt = actorCnt;
1741
- if (actor.links != null) {
1742
- g.attr("id", "root-" + actorCnt);
1743
- }
1744
- }
1745
- const rect = getNoteRect();
1746
- var cssclass = "actor";
1747
- if (actor.properties?.class) {
1748
- cssclass = actor.properties.class;
1749
- } else {
1750
- rect.fill = "#eaeaea";
1751
- }
1752
- if (isFooter) {
1753
- cssclass += ` ${BOTTOM_ACTOR_CLASS}`;
1754
- } else {
1755
- cssclass += ` ${TOP_ACTOR_CLASS}`;
1756
- }
1757
- rect.x = actor.x;
1758
- rect.y = actorY;
1759
- rect.width = actor.width;
1760
- rect.height = actor.height;
1761
- rect.class = cssclass;
1762
- rect.rx = 3;
1763
- rect.ry = 3;
1764
- rect.name = actor.name;
1765
- const rectElem = drawRect2(g, rect);
1766
- actor.rectData = rect;
1767
- if (actor.properties?.icon) {
1768
- const iconSrc = actor.properties.icon.trim();
1769
- if (iconSrc.charAt(0) === "@") {
1770
- drawEmbeddedImage(g, rect.x + rect.width - 20, rect.y + 10, iconSrc.substr(1));
1771
- } else {
1772
- drawImage(g, rect.x + rect.width - 20, rect.y + 10, iconSrc);
1773
- }
1774
- }
1775
- _drawTextCandidateFunc(conf2, hasKatex(actor.description))(
1776
- actor.description,
1777
- g,
1778
- rect.x,
1779
- rect.y,
1780
- rect.width,
1781
- rect.height,
1782
- { class: `actor ${ACTOR_BOX_CLASS}` },
1783
- conf2
1784
- );
1785
- let height = actor.height;
1786
- if (rectElem.node) {
1787
- const bounds2 = rectElem.node().getBBox();
1788
- actor.height = bounds2.height;
1789
- height = bounds2.height;
1790
- }
1791
- return height;
1792
- }, "drawActorTypeParticipant");
1793
- var drawActorTypeActor = /* @__PURE__ */ __name(function(elem, actor, conf2, isFooter) {
1794
- const actorY = isFooter ? actor.stopy : actor.starty;
1795
- const center = actor.x + actor.width / 2;
1796
- const centerY = actorY + 80;
1797
- const line = elem.append("g").lower();
1798
- if (!isFooter) {
1799
- actorCnt++;
1800
- 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);
1801
- actor.actorCnt = actorCnt;
1802
- }
1803
- const actElem = elem.append("g");
1804
- let cssClass = ACTOR_MAN_FIGURE_CLASS;
1805
- if (isFooter) {
1806
- cssClass += ` ${BOTTOM_ACTOR_CLASS}`;
1807
- } else {
1808
- cssClass += ` ${TOP_ACTOR_CLASS}`;
1809
- }
1810
- actElem.attr("class", cssClass);
1811
- actElem.attr("name", actor.name);
1812
- const rect = getNoteRect();
1813
- rect.x = actor.x;
1814
- rect.y = actorY;
1815
- rect.fill = "#eaeaea";
1816
- rect.width = actor.width;
1817
- rect.height = actor.height;
1818
- rect.class = "actor";
1819
- rect.rx = 3;
1820
- rect.ry = 3;
1821
- actElem.append("line").attr("id", "actor-man-torso" + actorCnt).attr("x1", center).attr("y1", actorY + 25).attr("x2", center).attr("y2", actorY + 45);
1822
- actElem.append("line").attr("id", "actor-man-arms" + actorCnt).attr("x1", center - ACTOR_TYPE_WIDTH / 2).attr("y1", actorY + 33).attr("x2", center + ACTOR_TYPE_WIDTH / 2).attr("y2", actorY + 33);
1823
- actElem.append("line").attr("x1", center - ACTOR_TYPE_WIDTH / 2).attr("y1", actorY + 60).attr("x2", center).attr("y2", actorY + 45);
1824
- actElem.append("line").attr("x1", center).attr("y1", actorY + 45).attr("x2", center + ACTOR_TYPE_WIDTH / 2 - 2).attr("y2", actorY + 60);
1825
- const circle = actElem.append("circle");
1826
- circle.attr("cx", actor.x + actor.width / 2);
1827
- circle.attr("cy", actorY + 10);
1828
- circle.attr("r", 15);
1829
- circle.attr("width", actor.width);
1830
- circle.attr("height", actor.height);
1831
- const bounds2 = actElem.node().getBBox();
1832
- actor.height = bounds2.height;
1833
- _drawTextCandidateFunc(conf2, hasKatex(actor.description))(
1834
- actor.description,
1835
- actElem,
1836
- rect.x,
1837
- rect.y + 35,
1838
- rect.width,
1839
- rect.height,
1840
- { class: `actor ${ACTOR_MAN_FIGURE_CLASS}` },
1841
- conf2
1842
- );
1843
- return actor.height;
1844
- }, "drawActorTypeActor");
1845
- var drawActor = /* @__PURE__ */ __name(async function(elem, actor, conf2, isFooter) {
1846
- switch (actor.type) {
1847
- case "actor":
1848
- return await drawActorTypeActor(elem, actor, conf2, isFooter);
1849
- case "participant":
1850
- return await drawActorTypeParticipant(elem, actor, conf2, isFooter);
1851
- }
1852
- }, "drawActor");
1853
- var drawBox = /* @__PURE__ */ __name(function(elem, box, conf2) {
1854
- const boxplusTextGroup = elem.append("g");
1855
- const g = boxplusTextGroup;
1856
- drawBackgroundRect2(g, box);
1857
- if (box.name) {
1858
- _drawTextCandidateFunc(conf2)(
1859
- box.name,
1860
- g,
1861
- box.x,
1862
- box.y + (box.textMaxHeight || 0) / 2,
1863
- box.width,
1864
- 0,
1865
- { class: "text" },
1866
- conf2
1867
- );
1868
- }
1869
- g.lower();
1870
- }, "drawBox");
1871
- var anchorElement = /* @__PURE__ */ __name(function(elem) {
1872
- return elem.append("g");
1873
- }, "anchorElement");
1874
- var drawActivation = /* @__PURE__ */ __name(function(elem, bounds2, verticalPos, conf2, actorActivations2) {
1875
- const rect = getNoteRect();
1876
- const g = bounds2.anchored;
1877
- rect.x = bounds2.startx;
1878
- rect.y = bounds2.starty;
1879
- rect.class = "activation" + actorActivations2 % 3;
1880
- rect.width = bounds2.stopx - bounds2.startx;
1881
- rect.height = verticalPos - bounds2.starty;
1882
- drawRect2(g, rect);
1883
- }, "drawActivation");
1884
- var drawLoop = /* @__PURE__ */ __name(async function(elem, loopModel, labelText, conf2) {
1885
- const {
1886
- boxMargin,
1887
- boxTextMargin,
1888
- labelBoxHeight,
1889
- labelBoxWidth,
1890
- messageFontFamily: fontFamily,
1891
- messageFontSize: fontSize,
1892
- messageFontWeight: fontWeight
1893
- } = conf2;
1894
- const g = elem.append("g");
1895
- const drawLoopLine = /* @__PURE__ */ __name(function(startx, starty, stopx, stopy) {
1896
- return g.append("line").attr("x1", startx).attr("y1", starty).attr("x2", stopx).attr("y2", stopy).attr("class", "loopLine");
1897
- }, "drawLoopLine");
1898
- drawLoopLine(loopModel.startx, loopModel.starty, loopModel.stopx, loopModel.starty);
1899
- drawLoopLine(loopModel.stopx, loopModel.starty, loopModel.stopx, loopModel.stopy);
1900
- drawLoopLine(loopModel.startx, loopModel.stopy, loopModel.stopx, loopModel.stopy);
1901
- drawLoopLine(loopModel.startx, loopModel.starty, loopModel.startx, loopModel.stopy);
1902
- if (loopModel.sections !== void 0) {
1903
- loopModel.sections.forEach(function(item) {
1904
- drawLoopLine(loopModel.startx, item.y, loopModel.stopx, item.y).style(
1905
- "stroke-dasharray",
1906
- "3, 3"
1907
- );
1908
- });
1909
- }
1910
- let txt = getTextObj();
1911
- txt.text = labelText;
1912
- txt.x = loopModel.startx;
1913
- txt.y = loopModel.starty;
1914
- txt.fontFamily = fontFamily;
1915
- txt.fontSize = fontSize;
1916
- txt.fontWeight = fontWeight;
1917
- txt.anchor = "middle";
1918
- txt.valign = "middle";
1919
- txt.tspan = false;
1920
- txt.width = labelBoxWidth || 50;
1921
- txt.height = labelBoxHeight || 20;
1922
- txt.textMargin = boxTextMargin;
1923
- txt.class = "labelText";
1924
- drawLabel(g, txt);
1925
- txt = getTextObj2();
1926
- txt.text = loopModel.title;
1927
- txt.x = loopModel.startx + labelBoxWidth / 2 + (loopModel.stopx - loopModel.startx) / 2;
1928
- txt.y = loopModel.starty + boxMargin + boxTextMargin;
1929
- txt.anchor = "middle";
1930
- txt.valign = "middle";
1931
- txt.textMargin = boxTextMargin;
1932
- txt.class = "loopText";
1933
- txt.fontFamily = fontFamily;
1934
- txt.fontSize = fontSize;
1935
- txt.fontWeight = fontWeight;
1936
- txt.wrap = true;
1937
- let textElem = hasKatex(txt.text) ? await drawKatex(g, txt, loopModel) : drawText(g, txt);
1938
- if (loopModel.sectionTitles !== void 0) {
1939
- for (const [idx, item] of Object.entries(loopModel.sectionTitles)) {
1940
- if (item.message) {
1941
- txt.text = item.message;
1942
- txt.x = loopModel.startx + (loopModel.stopx - loopModel.startx) / 2;
1943
- txt.y = loopModel.sections[idx].y + boxMargin + boxTextMargin;
1944
- txt.class = "loopText";
1945
- txt.anchor = "middle";
1946
- txt.valign = "middle";
1947
- txt.tspan = false;
1948
- txt.fontFamily = fontFamily;
1949
- txt.fontSize = fontSize;
1950
- txt.fontWeight = fontWeight;
1951
- txt.wrap = loopModel.wrap;
1952
- if (hasKatex(txt.text)) {
1953
- loopModel.starty = loopModel.sections[idx].y;
1954
- await drawKatex(g, txt, loopModel);
1955
- } else {
1956
- drawText(g, txt);
1957
- }
1958
- let sectionHeight = Math.round(
1959
- textElem.map((te) => (te._groups || te)[0][0].getBBox().height).reduce((acc, curr) => acc + curr)
1960
- );
1961
- loopModel.sections[idx].height += sectionHeight - (boxMargin + boxTextMargin);
1962
- }
1963
- }
1964
- }
1965
- loopModel.height = Math.round(loopModel.stopy - loopModel.starty);
1966
- return g;
1967
- }, "drawLoop");
1968
- var drawBackgroundRect2 = /* @__PURE__ */ __name(function(elem, bounds2) {
1969
- drawBackgroundRect(elem, bounds2);
1970
- }, "drawBackgroundRect");
1971
- var insertDatabaseIcon = /* @__PURE__ */ __name(function(elem) {
1972
- elem.append("defs").append("symbol").attr("id", "database").attr("fill-rule", "evenodd").attr("clip-rule", "evenodd").append("path").attr("transform", "scale(.5)").attr(
1973
- "d",
1974
- "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"
1975
- );
1976
- }, "insertDatabaseIcon");
1977
- var insertComputerIcon = /* @__PURE__ */ __name(function(elem) {
1978
- elem.append("defs").append("symbol").attr("id", "computer").attr("width", "24").attr("height", "24").append("path").attr("transform", "scale(.5)").attr(
1979
- "d",
1980
- "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"
1981
- );
1982
- }, "insertComputerIcon");
1983
- var insertClockIcon = /* @__PURE__ */ __name(function(elem) {
1984
- elem.append("defs").append("symbol").attr("id", "clock").attr("width", "24").attr("height", "24").append("path").attr("transform", "scale(.5)").attr(
1985
- "d",
1986
- "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"
1987
- );
1988
- }, "insertClockIcon");
1989
- var insertArrowHead = /* @__PURE__ */ __name(function(elem) {
1990
- elem.append("defs").append("marker").attr("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");
1991
- }, "insertArrowHead");
1992
- var insertArrowFilledHead = /* @__PURE__ */ __name(function(elem) {
1993
- elem.append("defs").append("marker").attr("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");
1994
- }, "insertArrowFilledHead");
1995
- var insertSequenceNumber = /* @__PURE__ */ __name(function(elem) {
1996
- elem.append("defs").append("marker").attr("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);
1997
- }, "insertSequenceNumber");
1998
- var insertArrowCrossHead = /* @__PURE__ */ __name(function(elem) {
1999
- const defs = elem.append("defs");
2000
- const marker = defs.append("marker").attr("id", "crosshead").attr("markerWidth", 15).attr("markerHeight", 8).attr("orient", "auto").attr("refX", 4).attr("refY", 4.5);
2001
- 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");
2002
- }, "insertArrowCrossHead");
2003
- var getTextObj2 = /* @__PURE__ */ __name(function() {
2004
- return {
2005
- x: 0,
2006
- y: 0,
2007
- fill: void 0,
2008
- anchor: void 0,
2009
- style: "#666",
2010
- width: void 0,
2011
- height: void 0,
2012
- textMargin: 0,
2013
- rx: 0,
2014
- ry: 0,
2015
- tspan: true,
2016
- valign: void 0
2017
- };
2018
- }, "getTextObj");
2019
- var getNoteRect2 = /* @__PURE__ */ __name(function() {
2020
- return {
2021
- x: 0,
2022
- y: 0,
2023
- fill: "#EDF2AE",
2024
- stroke: "#666",
2025
- width: 100,
2026
- anchor: "start",
2027
- height: 100,
2028
- rx: 0,
2029
- ry: 0
2030
- };
2031
- }, "getNoteRect");
2032
- var _drawTextCandidateFunc = /* @__PURE__ */ function() {
2033
- function byText(content, g, x, y, width, height, textAttrs) {
2034
- const text = g.append("text").attr("x", x + width / 2).attr("y", y + height / 2 + 5).style("text-anchor", "middle").text(content);
2035
- _setTextAttrs(text, textAttrs);
2036
- }
2037
- __name(byText, "byText");
2038
- function byTspan(content, g, x, y, width, height, textAttrs, conf2) {
2039
- const { actorFontSize, actorFontFamily, actorFontWeight } = conf2;
2040
- const [_actorFontSize, _actorFontSizePx] = parseFontSize(actorFontSize);
2041
- const lines = content.split(common_default.lineBreakRegex);
2042
- for (let i = 0; i < lines.length; i++) {
2043
- const dy = i * _actorFontSize - _actorFontSize * (lines.length - 1) / 2;
2044
- 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);
2045
- text.append("tspan").attr("x", x + width / 2).attr("dy", dy).text(lines[i]);
2046
- text.attr("y", y + height / 2).attr("dominant-baseline", "central").attr("alignment-baseline", "central");
2047
- _setTextAttrs(text, textAttrs);
2048
- }
2049
- }
2050
- __name(byTspan, "byTspan");
2051
- function byFo(content, g, x, y, width, height, textAttrs, conf2) {
2052
- const s = g.append("switch");
2053
- const f = s.append("foreignObject").attr("x", x).attr("y", y).attr("width", width).attr("height", height);
2054
- const text = f.append("xhtml:div").style("display", "table").style("height", "100%").style("width", "100%");
2055
- text.append("div").style("display", "table-cell").style("text-align", "center").style("vertical-align", "middle").text(content);
2056
- byTspan(content, s, x, y, width, height, textAttrs, conf2);
2057
- _setTextAttrs(text, textAttrs);
2058
- }
2059
- __name(byFo, "byFo");
2060
- async function byKatex(content, g, x, y, width, height, textAttrs, conf2) {
2061
- const dim = await calculateMathMLDimensions(content, getConfig());
2062
- const s = g.append("switch");
2063
- 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);
2064
- const text = f.append("xhtml:div").style("height", "100%").style("width", "100%");
2065
- text.append("div").style("text-align", "center").style("vertical-align", "middle").html(await renderKatex(content, getConfig()));
2066
- byTspan(content, s, x, y, width, height, textAttrs, conf2);
2067
- _setTextAttrs(text, textAttrs);
2068
- }
2069
- __name(byKatex, "byKatex");
2070
- function _setTextAttrs(toText, fromTextAttrsDict) {
2071
- for (const key in fromTextAttrsDict) {
2072
- if (fromTextAttrsDict.hasOwnProperty(key)) {
2073
- toText.attr(key, fromTextAttrsDict[key]);
2074
- }
2075
- }
2076
- }
2077
- __name(_setTextAttrs, "_setTextAttrs");
2078
- return function(conf2, hasKatex2 = false) {
2079
- if (hasKatex2) {
2080
- return byKatex;
2081
- }
2082
- return conf2.textPlacement === "fo" ? byFo : conf2.textPlacement === "old" ? byText : byTspan;
2083
- };
2084
- }();
2085
- var _drawMenuItemTextCandidateFunc = /* @__PURE__ */ function() {
2086
- function byText(content, g, x, y, width, height, textAttrs) {
2087
- const text = g.append("text").attr("x", x).attr("y", y).style("text-anchor", "start").text(content);
2088
- _setTextAttrs(text, textAttrs);
2089
- }
2090
- __name(byText, "byText");
2091
- function byTspan(content, g, x, y, width, height, textAttrs, conf2) {
2092
- const { actorFontSize, actorFontFamily, actorFontWeight } = conf2;
2093
- const lines = content.split(common_default.lineBreakRegex);
2094
- for (let i = 0; i < lines.length; i++) {
2095
- const dy = i * actorFontSize - actorFontSize * (lines.length - 1) / 2;
2096
- 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);
2097
- text.append("tspan").attr("x", x).attr("dy", dy).text(lines[i]);
2098
- text.attr("y", y + height / 2).attr("dominant-baseline", "central").attr("alignment-baseline", "central");
2099
- _setTextAttrs(text, textAttrs);
2100
- }
2101
- }
2102
- __name(byTspan, "byTspan");
2103
- function byFo(content, g, x, y, width, height, textAttrs, conf2) {
2104
- const s = g.append("switch");
2105
- const f = s.append("foreignObject").attr("x", x).attr("y", y).attr("width", width).attr("height", height);
2106
- const text = f.append("xhtml:div").style("display", "table").style("height", "100%").style("width", "100%");
2107
- text.append("div").style("display", "table-cell").style("text-align", "center").style("vertical-align", "middle").text(content);
2108
- byTspan(content, s, x, y, width, height, textAttrs, conf2);
2109
- _setTextAttrs(text, textAttrs);
2110
- }
2111
- __name(byFo, "byFo");
2112
- function _setTextAttrs(toText, fromTextAttrsDict) {
2113
- for (const key in fromTextAttrsDict) {
2114
- if (fromTextAttrsDict.hasOwnProperty(key)) {
2115
- toText.attr(key, fromTextAttrsDict[key]);
2116
- }
2117
- }
2118
- }
2119
- __name(_setTextAttrs, "_setTextAttrs");
2120
- return function(conf2) {
2121
- return conf2.textPlacement === "fo" ? byFo : conf2.textPlacement === "old" ? byText : byTspan;
2122
- };
2123
- }();
2124
- var svgDraw_default = {
2125
- drawRect: drawRect2,
2126
- drawText,
2127
- drawLabel,
2128
- drawActor,
2129
- drawBox,
2130
- drawPopup,
2131
- anchorElement,
2132
- drawActivation,
2133
- drawLoop,
2134
- drawBackgroundRect: drawBackgroundRect2,
2135
- insertArrowHead,
2136
- insertArrowFilledHead,
2137
- insertSequenceNumber,
2138
- insertArrowCrossHead,
2139
- insertDatabaseIcon,
2140
- insertComputerIcon,
2141
- insertClockIcon,
2142
- getTextObj: getTextObj2,
2143
- getNoteRect: getNoteRect2,
2144
- fixLifeLineHeights,
2145
- sanitizeUrl: distExports.sanitizeUrl
2146
- };
2147
- var conf = {};
2148
- var bounds = {
2149
- data: {
2150
- startx: void 0,
2151
- stopx: void 0,
2152
- starty: void 0,
2153
- stopy: void 0
2154
- },
2155
- verticalPos: 0,
2156
- sequenceItems: [],
2157
- activations: [],
2158
- models: {
2159
- getHeight: /* @__PURE__ */ __name(function() {
2160
- return Math.max.apply(
2161
- null,
2162
- this.actors.length === 0 ? [0] : this.actors.map((actor) => actor.height || 0)
2163
- ) + (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));
2164
- }, "getHeight"),
2165
- clear: /* @__PURE__ */ __name(function() {
2166
- this.actors = [];
2167
- this.boxes = [];
2168
- this.loops = [];
2169
- this.messages = [];
2170
- this.notes = [];
2171
- }, "clear"),
2172
- addBox: /* @__PURE__ */ __name(function(boxModel) {
2173
- this.boxes.push(boxModel);
2174
- }, "addBox"),
2175
- addActor: /* @__PURE__ */ __name(function(actorModel) {
2176
- this.actors.push(actorModel);
2177
- }, "addActor"),
2178
- addLoop: /* @__PURE__ */ __name(function(loopModel) {
2179
- this.loops.push(loopModel);
2180
- }, "addLoop"),
2181
- addMessage: /* @__PURE__ */ __name(function(msgModel) {
2182
- this.messages.push(msgModel);
2183
- }, "addMessage"),
2184
- addNote: /* @__PURE__ */ __name(function(noteModel) {
2185
- this.notes.push(noteModel);
2186
- }, "addNote"),
2187
- lastActor: /* @__PURE__ */ __name(function() {
2188
- return this.actors[this.actors.length - 1];
2189
- }, "lastActor"),
2190
- lastLoop: /* @__PURE__ */ __name(function() {
2191
- return this.loops[this.loops.length - 1];
2192
- }, "lastLoop"),
2193
- lastMessage: /* @__PURE__ */ __name(function() {
2194
- return this.messages[this.messages.length - 1];
2195
- }, "lastMessage"),
2196
- lastNote: /* @__PURE__ */ __name(function() {
2197
- return this.notes[this.notes.length - 1];
2198
- }, "lastNote"),
2199
- actors: [],
2200
- boxes: [],
2201
- loops: [],
2202
- messages: [],
2203
- notes: []
2204
- },
2205
- init: /* @__PURE__ */ __name(function() {
2206
- this.sequenceItems = [];
2207
- this.activations = [];
2208
- this.models.clear();
2209
- this.data = {
2210
- startx: void 0,
2211
- stopx: void 0,
2212
- starty: void 0,
2213
- stopy: void 0
2214
- };
2215
- this.verticalPos = 0;
2216
- setConf(getConfig2());
2217
- }, "init"),
2218
- updateVal: /* @__PURE__ */ __name(function(obj, key, val, fun) {
2219
- if (obj[key] === void 0) {
2220
- obj[key] = val;
2221
- } else {
2222
- obj[key] = fun(val, obj[key]);
2223
- }
2224
- }, "updateVal"),
2225
- updateBounds: /* @__PURE__ */ __name(function(startx, starty, stopx, stopy) {
2226
- const _self = this;
2227
- let cnt = 0;
2228
- function updateFn(type) {
2229
- return /* @__PURE__ */ __name(function updateItemBounds(item) {
2230
- cnt++;
2231
- const n = _self.sequenceItems.length - cnt + 1;
2232
- _self.updateVal(item, "starty", starty - n * conf.boxMargin, Math.min);
2233
- _self.updateVal(item, "stopy", stopy + n * conf.boxMargin, Math.max);
2234
- _self.updateVal(bounds.data, "startx", startx - n * conf.boxMargin, Math.min);
2235
- _self.updateVal(bounds.data, "stopx", stopx + n * conf.boxMargin, Math.max);
2236
- if (!(type === "activation")) {
2237
- _self.updateVal(item, "startx", startx - n * conf.boxMargin, Math.min);
2238
- _self.updateVal(item, "stopx", stopx + n * conf.boxMargin, Math.max);
2239
- _self.updateVal(bounds.data, "starty", starty - n * conf.boxMargin, Math.min);
2240
- _self.updateVal(bounds.data, "stopy", stopy + n * conf.boxMargin, Math.max);
2241
- }
2242
- }, "updateItemBounds");
2243
- }
2244
- __name(updateFn, "updateFn");
2245
- this.sequenceItems.forEach(updateFn());
2246
- this.activations.forEach(updateFn("activation"));
2247
- }, "updateBounds"),
2248
- insert: /* @__PURE__ */ __name(function(startx, starty, stopx, stopy) {
2249
- const _startx = common_default.getMin(startx, stopx);
2250
- const _stopx = common_default.getMax(startx, stopx);
2251
- const _starty = common_default.getMin(starty, stopy);
2252
- const _stopy = common_default.getMax(starty, stopy);
2253
- this.updateVal(bounds.data, "startx", _startx, Math.min);
2254
- this.updateVal(bounds.data, "starty", _starty, Math.min);
2255
- this.updateVal(bounds.data, "stopx", _stopx, Math.max);
2256
- this.updateVal(bounds.data, "stopy", _stopy, Math.max);
2257
- this.updateBounds(_startx, _starty, _stopx, _stopy);
2258
- }, "insert"),
2259
- newActivation: /* @__PURE__ */ __name(function(message, diagram2, actors) {
2260
- const actorRect = actors.get(message.from);
2261
- const stackedSize = actorActivations(message.from).length || 0;
2262
- const x = actorRect.x + actorRect.width / 2 + (stackedSize - 1) * conf.activationWidth / 2;
2263
- this.activations.push({
2264
- startx: x,
2265
- starty: this.verticalPos + 2,
2266
- stopx: x + conf.activationWidth,
2267
- stopy: void 0,
2268
- actor: message.from,
2269
- anchored: svgDraw_default.anchorElement(diagram2)
2270
- });
2271
- }, "newActivation"),
2272
- endActivation: /* @__PURE__ */ __name(function(message) {
2273
- const lastActorActivationIdx = this.activations.map(function(activation) {
2274
- return activation.actor;
2275
- }).lastIndexOf(message.from);
2276
- return this.activations.splice(lastActorActivationIdx, 1)[0];
2277
- }, "endActivation"),
2278
- createLoop: /* @__PURE__ */ __name(function(title = { message: void 0, wrap: false, width: void 0 }, fill) {
2279
- return {
2280
- startx: void 0,
2281
- starty: this.verticalPos,
2282
- stopx: void 0,
2283
- stopy: void 0,
2284
- title: title.message,
2285
- wrap: title.wrap,
2286
- width: title.width,
2287
- height: 0,
2288
- fill
2289
- };
2290
- }, "createLoop"),
2291
- newLoop: /* @__PURE__ */ __name(function(title = { message: void 0, wrap: false, width: void 0 }, fill) {
2292
- this.sequenceItems.push(this.createLoop(title, fill));
2293
- }, "newLoop"),
2294
- endLoop: /* @__PURE__ */ __name(function() {
2295
- return this.sequenceItems.pop();
2296
- }, "endLoop"),
2297
- isLoopOverlap: /* @__PURE__ */ __name(function() {
2298
- return this.sequenceItems.length ? this.sequenceItems[this.sequenceItems.length - 1].overlap : false;
2299
- }, "isLoopOverlap"),
2300
- addSectionToLoop: /* @__PURE__ */ __name(function(message) {
2301
- const loop = this.sequenceItems.pop();
2302
- loop.sections = loop.sections || [];
2303
- loop.sectionTitles = loop.sectionTitles || [];
2304
- loop.sections.push({ y: bounds.getVerticalPos(), height: 0 });
2305
- loop.sectionTitles.push(message);
2306
- this.sequenceItems.push(loop);
2307
- }, "addSectionToLoop"),
2308
- saveVerticalPos: /* @__PURE__ */ __name(function() {
2309
- if (this.isLoopOverlap()) {
2310
- this.savedVerticalPos = this.verticalPos;
2311
- }
2312
- }, "saveVerticalPos"),
2313
- resetVerticalPos: /* @__PURE__ */ __name(function() {
2314
- if (this.isLoopOverlap()) {
2315
- this.verticalPos = this.savedVerticalPos;
2316
- }
2317
- }, "resetVerticalPos"),
2318
- bumpVerticalPos: /* @__PURE__ */ __name(function(bump) {
2319
- this.verticalPos = this.verticalPos + bump;
2320
- this.data.stopy = common_default.getMax(this.data.stopy, this.verticalPos);
2321
- }, "bumpVerticalPos"),
2322
- getVerticalPos: /* @__PURE__ */ __name(function() {
2323
- return this.verticalPos;
2324
- }, "getVerticalPos"),
2325
- getBounds: /* @__PURE__ */ __name(function() {
2326
- return { bounds: this.data, models: this.models };
2327
- }, "getBounds")
2328
- };
2329
- var drawNote = /* @__PURE__ */ __name(async function(elem, noteModel) {
2330
- bounds.bumpVerticalPos(conf.boxMargin);
2331
- noteModel.height = conf.boxMargin;
2332
- noteModel.starty = bounds.getVerticalPos();
2333
- const rect = getNoteRect();
2334
- rect.x = noteModel.startx;
2335
- rect.y = noteModel.starty;
2336
- rect.width = noteModel.width || conf.width;
2337
- rect.class = "note";
2338
- const g = elem.append("g");
2339
- const rectElem = svgDraw_default.drawRect(g, rect);
2340
- const textObj = getTextObj();
2341
- textObj.x = noteModel.startx;
2342
- textObj.y = noteModel.starty;
2343
- textObj.width = rect.width;
2344
- textObj.dy = "1em";
2345
- textObj.text = noteModel.message;
2346
- textObj.class = "noteText";
2347
- textObj.fontFamily = conf.noteFontFamily;
2348
- textObj.fontSize = conf.noteFontSize;
2349
- textObj.fontWeight = conf.noteFontWeight;
2350
- textObj.anchor = conf.noteAlign;
2351
- textObj.textMargin = conf.noteMargin;
2352
- textObj.valign = "center";
2353
- const textElem = hasKatex(textObj.text) ? await drawKatex(g, textObj) : drawText(g, textObj);
2354
- const textHeight = Math.round(
2355
- textElem.map((te) => (te._groups || te)[0][0].getBBox().height).reduce((acc, curr) => acc + curr)
2356
- );
2357
- rectElem.attr("height", textHeight + 2 * conf.noteMargin);
2358
- noteModel.height += textHeight + 2 * conf.noteMargin;
2359
- bounds.bumpVerticalPos(textHeight + 2 * conf.noteMargin);
2360
- noteModel.stopy = noteModel.starty + textHeight + 2 * conf.noteMargin;
2361
- noteModel.stopx = noteModel.startx + rect.width;
2362
- bounds.insert(noteModel.startx, noteModel.starty, noteModel.stopx, noteModel.stopy);
2363
- bounds.models.addNote(noteModel);
2364
- }, "drawNote");
2365
- var messageFont = /* @__PURE__ */ __name((cnf) => {
2366
- return {
2367
- fontFamily: cnf.messageFontFamily,
2368
- fontSize: cnf.messageFontSize,
2369
- fontWeight: cnf.messageFontWeight
2370
- };
2371
- }, "messageFont");
2372
- var noteFont = /* @__PURE__ */ __name((cnf) => {
2373
- return {
2374
- fontFamily: cnf.noteFontFamily,
2375
- fontSize: cnf.noteFontSize,
2376
- fontWeight: cnf.noteFontWeight
2377
- };
2378
- }, "noteFont");
2379
- var actorFont = /* @__PURE__ */ __name((cnf) => {
2380
- return {
2381
- fontFamily: cnf.actorFontFamily,
2382
- fontSize: cnf.actorFontSize,
2383
- fontWeight: cnf.actorFontWeight
2384
- };
2385
- }, "actorFont");
2386
- async function boundMessage(_diagram, msgModel) {
2387
- bounds.bumpVerticalPos(10);
2388
- const { startx, stopx, message } = msgModel;
2389
- const lines = common_default.splitBreaks(message).length;
2390
- const isKatexMsg = hasKatex(message);
2391
- const textDims = isKatexMsg ? await calculateMathMLDimensions(message, getConfig2()) : utils_default.calculateTextDimensions(message, messageFont(conf));
2392
- if (!isKatexMsg) {
2393
- const lineHeight = textDims.height / lines;
2394
- msgModel.height += lineHeight;
2395
- bounds.bumpVerticalPos(lineHeight);
2396
- }
2397
- let lineStartY;
2398
- let totalOffset = textDims.height - 10;
2399
- const textWidth = textDims.width;
2400
- if (startx === stopx) {
2401
- lineStartY = bounds.getVerticalPos() + totalOffset;
2402
- if (!conf.rightAngles) {
2403
- totalOffset += conf.boxMargin;
2404
- lineStartY = bounds.getVerticalPos() + totalOffset;
2405
- }
2406
- totalOffset += 30;
2407
- const dx = common_default.getMax(textWidth / 2, conf.width / 2);
2408
- bounds.insert(
2409
- startx - dx,
2410
- bounds.getVerticalPos() - 10 + totalOffset,
2411
- stopx + dx,
2412
- bounds.getVerticalPos() + 30 + totalOffset
2413
- );
2414
- } else {
2415
- totalOffset += conf.boxMargin;
2416
- lineStartY = bounds.getVerticalPos() + totalOffset;
2417
- bounds.insert(startx, lineStartY - 10, stopx, lineStartY);
2418
- }
2419
- bounds.bumpVerticalPos(totalOffset);
2420
- msgModel.height += totalOffset;
2421
- msgModel.stopy = msgModel.starty + msgModel.height;
2422
- bounds.insert(msgModel.fromBounds, msgModel.starty, msgModel.toBounds, msgModel.stopy);
2423
- return lineStartY;
2424
- }
2425
- __name(boundMessage, "boundMessage");
2426
- var drawMessage = /* @__PURE__ */ __name(async function(diagram2, msgModel, lineStartY, diagObj) {
2427
- const { startx, stopx, starty, message, type, sequenceIndex, sequenceVisible } = msgModel;
2428
- const textDims = utils_default.calculateTextDimensions(message, messageFont(conf));
2429
- const textObj = getTextObj();
2430
- textObj.x = startx;
2431
- textObj.y = starty + 10;
2432
- textObj.width = stopx - startx;
2433
- textObj.class = "messageText";
2434
- textObj.dy = "1em";
2435
- textObj.text = message;
2436
- textObj.fontFamily = conf.messageFontFamily;
2437
- textObj.fontSize = conf.messageFontSize;
2438
- textObj.fontWeight = conf.messageFontWeight;
2439
- textObj.anchor = conf.messageAlign;
2440
- textObj.valign = "center";
2441
- textObj.textMargin = conf.wrapPadding;
2442
- textObj.tspan = false;
2443
- if (hasKatex(textObj.text)) {
2444
- await drawKatex(diagram2, textObj, { startx, stopx, starty: lineStartY });
2445
- } else {
2446
- drawText(diagram2, textObj);
2447
- }
2448
- const textWidth = textDims.width;
2449
- let line;
2450
- if (startx === stopx) {
2451
- if (conf.rightAngles) {
2452
- line = diagram2.append("path").attr(
2453
- "d",
2454
- `M ${startx},${lineStartY} H ${startx + common_default.getMax(conf.width / 2, textWidth / 2)} V ${lineStartY + 25} H ${startx}`
2455
- );
2456
- } else {
2457
- line = diagram2.append("path").attr(
2458
- "d",
2459
- "M " + startx + "," + lineStartY + " C " + (startx + 60) + "," + (lineStartY - 10) + " " + (startx + 60) + "," + (lineStartY + 30) + " " + startx + "," + (lineStartY + 20)
2460
- );
2461
- }
2462
- } else {
2463
- line = diagram2.append("line");
2464
- line.attr("x1", startx);
2465
- line.attr("y1", lineStartY);
2466
- line.attr("x2", stopx);
2467
- line.attr("y2", lineStartY);
2468
- }
2469
- 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) {
2470
- line.style("stroke-dasharray", "3, 3");
2471
- line.attr("class", "messageLine1");
2472
- } else {
2473
- line.attr("class", "messageLine0");
2474
- }
2475
- let url = "";
2476
- if (conf.arrowMarkerAbsolute) {
2477
- url = window.location.protocol + "//" + window.location.host + window.location.pathname + window.location.search;
2478
- url = url.replace(/\(/g, "\\(");
2479
- url = url.replace(/\)/g, "\\)");
2480
- }
2481
- line.attr("stroke-width", 2);
2482
- line.attr("stroke", "none");
2483
- line.style("fill", "none");
2484
- if (type === diagObj.db.LINETYPE.SOLID || type === diagObj.db.LINETYPE.DOTTED) {
2485
- line.attr("marker-end", "url(" + url + "#arrowhead)");
2486
- }
2487
- if (type === diagObj.db.LINETYPE.BIDIRECTIONAL_SOLID || type === diagObj.db.LINETYPE.BIDIRECTIONAL_DOTTED) {
2488
- line.attr("marker-start", "url(" + url + "#arrowhead)");
2489
- line.attr("marker-end", "url(" + url + "#arrowhead)");
2490
- }
2491
- if (type === diagObj.db.LINETYPE.SOLID_POINT || type === diagObj.db.LINETYPE.DOTTED_POINT) {
2492
- line.attr("marker-end", "url(" + url + "#filled-head)");
2493
- }
2494
- if (type === diagObj.db.LINETYPE.SOLID_CROSS || type === diagObj.db.LINETYPE.DOTTED_CROSS) {
2495
- line.attr("marker-end", "url(" + url + "#crosshead)");
2496
- }
2497
- if (sequenceVisible || conf.showSequenceNumbers) {
2498
- line.attr("marker-start", "url(" + url + "#sequencenumber)");
2499
- diagram2.append("text").attr("x", startx).attr("y", lineStartY + 4).attr("font-family", "sans-serif").attr("font-size", "12px").attr("text-anchor", "middle").attr("class", "sequenceNumber").text(sequenceIndex);
2500
- }
2501
- }, "drawMessage");
2502
- var addActorRenderingData = /* @__PURE__ */ __name(function(diagram2, actors, createdActors, actorKeys, verticalPos, messages, isFooter) {
2503
- let prevWidth = 0;
2504
- let prevMargin = 0;
2505
- let prevBox = void 0;
2506
- let maxHeight = 0;
2507
- for (const actorKey of actorKeys) {
2508
- const actor = actors.get(actorKey);
2509
- const box = actor.box;
2510
- if (prevBox && prevBox != box) {
2511
- if (!isFooter) {
2512
- bounds.models.addBox(prevBox);
2513
- }
2514
- prevMargin += conf.boxMargin + prevBox.margin;
2515
- }
2516
- if (box && box != prevBox) {
2517
- if (!isFooter) {
2518
- box.x = prevWidth + prevMargin;
2519
- box.y = verticalPos;
2520
- }
2521
- prevMargin += box.margin;
2522
- }
2523
- actor.width = actor.width || conf.width;
2524
- actor.height = common_default.getMax(actor.height || conf.height, conf.height);
2525
- actor.margin = actor.margin || conf.actorMargin;
2526
- maxHeight = common_default.getMax(maxHeight, actor.height);
2527
- if (createdActors.get(actor.name)) {
2528
- prevMargin += actor.width / 2;
2529
- }
2530
- actor.x = prevWidth + prevMargin;
2531
- actor.starty = bounds.getVerticalPos();
2532
- bounds.insert(actor.x, verticalPos, actor.x + actor.width, actor.height);
2533
- prevWidth += actor.width + prevMargin;
2534
- if (actor.box) {
2535
- actor.box.width = prevWidth + box.margin - actor.box.x;
2536
- }
2537
- prevMargin = actor.margin;
2538
- prevBox = actor.box;
2539
- bounds.models.addActor(actor);
2540
- }
2541
- if (prevBox && !isFooter) {
2542
- bounds.models.addBox(prevBox);
2543
- }
2544
- bounds.bumpVerticalPos(maxHeight);
2545
- }, "addActorRenderingData");
2546
- var drawActors = /* @__PURE__ */ __name(async function(diagram2, actors, actorKeys, isFooter) {
2547
- if (!isFooter) {
2548
- for (const actorKey of actorKeys) {
2549
- const actor = actors.get(actorKey);
2550
- await svgDraw_default.drawActor(diagram2, actor, conf, false);
2551
- }
2552
- } else {
2553
- let maxHeight = 0;
2554
- bounds.bumpVerticalPos(conf.boxMargin * 2);
2555
- for (const actorKey of actorKeys) {
2556
- const actor = actors.get(actorKey);
2557
- if (!actor.stopy) {
2558
- actor.stopy = bounds.getVerticalPos();
2559
- }
2560
- const height = await svgDraw_default.drawActor(diagram2, actor, conf, true);
2561
- maxHeight = common_default.getMax(maxHeight, height);
2562
- }
2563
- bounds.bumpVerticalPos(maxHeight + conf.boxMargin);
2564
- }
2565
- }, "drawActors");
2566
- var drawActorsPopup = /* @__PURE__ */ __name(function(diagram2, actors, actorKeys, doc) {
2567
- let maxHeight = 0;
2568
- let maxWidth = 0;
2569
- for (const actorKey of actorKeys) {
2570
- const actor = actors.get(actorKey);
2571
- const minMenuWidth = getRequiredPopupWidth(actor);
2572
- const menuDimensions = svgDraw_default.drawPopup(
2573
- diagram2,
2574
- actor,
2575
- minMenuWidth,
2576
- conf,
2577
- conf.forceMenus,
2578
- doc
2579
- );
2580
- if (menuDimensions.height > maxHeight) {
2581
- maxHeight = menuDimensions.height;
2582
- }
2583
- if (menuDimensions.width + actor.x > maxWidth) {
2584
- maxWidth = menuDimensions.width + actor.x;
2585
- }
2586
- }
2587
- return { maxHeight, maxWidth };
2588
- }, "drawActorsPopup");
2589
- var setConf = /* @__PURE__ */ __name(function(cnf) {
2590
- assignWithDepth_default(conf, cnf);
2591
- if (cnf.fontFamily) {
2592
- conf.actorFontFamily = conf.noteFontFamily = conf.messageFontFamily = cnf.fontFamily;
2593
- }
2594
- if (cnf.fontSize) {
2595
- conf.actorFontSize = conf.noteFontSize = conf.messageFontSize = cnf.fontSize;
2596
- }
2597
- if (cnf.fontWeight) {
2598
- conf.actorFontWeight = conf.noteFontWeight = conf.messageFontWeight = cnf.fontWeight;
2599
- }
2600
- }, "setConf");
2601
- var actorActivations = /* @__PURE__ */ __name(function(actor) {
2602
- return bounds.activations.filter(function(activation) {
2603
- return activation.actor === actor;
2604
- });
2605
- }, "actorActivations");
2606
- var activationBounds = /* @__PURE__ */ __name(function(actor, actors) {
2607
- const actorObj = actors.get(actor);
2608
- const activations = actorActivations(actor);
2609
- const left = activations.reduce(
2610
- function(acc, activation) {
2611
- return common_default.getMin(acc, activation.startx);
2612
- },
2613
- actorObj.x + actorObj.width / 2 - 1
2614
- );
2615
- const right = activations.reduce(
2616
- function(acc, activation) {
2617
- return common_default.getMax(acc, activation.stopx);
2618
- },
2619
- actorObj.x + actorObj.width / 2 + 1
2620
- );
2621
- return [left, right];
2622
- }, "activationBounds");
2623
- function adjustLoopHeightForWrap(loopWidths, msg, preMargin, postMargin, addLoopFn) {
2624
- bounds.bumpVerticalPos(preMargin);
2625
- let heightAdjust = postMargin;
2626
- if (msg.id && msg.message && loopWidths[msg.id]) {
2627
- const loopWidth = loopWidths[msg.id].width;
2628
- const textConf = messageFont(conf);
2629
- msg.message = utils_default.wrapLabel(`[${msg.message}]`, loopWidth - 2 * conf.wrapPadding, textConf);
2630
- msg.width = loopWidth;
2631
- msg.wrap = true;
2632
- const textDims = utils_default.calculateTextDimensions(msg.message, textConf);
2633
- const totalOffset = common_default.getMax(textDims.height, conf.labelBoxHeight);
2634
- heightAdjust = postMargin + totalOffset;
2635
- log.debug(`${totalOffset} - ${msg.message}`);
2636
- }
2637
- addLoopFn(msg);
2638
- bounds.bumpVerticalPos(heightAdjust);
2639
- }
2640
- __name(adjustLoopHeightForWrap, "adjustLoopHeightForWrap");
2641
- function adjustCreatedDestroyedData(msg, msgModel, lineStartY, index, actors, createdActors, destroyedActors) {
2642
- function receiverAdjustment(actor, adjustment) {
2643
- if (actor.x < actors.get(msg.from).x) {
2644
- bounds.insert(
2645
- msgModel.stopx - adjustment,
2646
- msgModel.starty,
2647
- msgModel.startx,
2648
- msgModel.stopy + actor.height / 2 + conf.noteMargin
2649
- );
2650
- msgModel.stopx = msgModel.stopx + adjustment;
2651
- } else {
2652
- bounds.insert(
2653
- msgModel.startx,
2654
- msgModel.starty,
2655
- msgModel.stopx + adjustment,
2656
- msgModel.stopy + actor.height / 2 + conf.noteMargin
2657
- );
2658
- msgModel.stopx = msgModel.stopx - adjustment;
2659
- }
2660
- }
2661
- __name(receiverAdjustment, "receiverAdjustment");
2662
- function senderAdjustment(actor, adjustment) {
2663
- if (actor.x < actors.get(msg.to).x) {
2664
- bounds.insert(
2665
- msgModel.startx - adjustment,
2666
- msgModel.starty,
2667
- msgModel.stopx,
2668
- msgModel.stopy + actor.height / 2 + conf.noteMargin
2669
- );
2670
- msgModel.startx = msgModel.startx + adjustment;
2671
- } else {
2672
- bounds.insert(
2673
- msgModel.stopx,
2674
- msgModel.starty,
2675
- msgModel.startx + adjustment,
2676
- msgModel.stopy + actor.height / 2 + conf.noteMargin
2677
- );
2678
- msgModel.startx = msgModel.startx - adjustment;
2679
- }
2680
- }
2681
- __name(senderAdjustment, "senderAdjustment");
2682
- if (createdActors.get(msg.to) == index) {
2683
- const actor = actors.get(msg.to);
2684
- const adjustment = actor.type == "actor" ? ACTOR_TYPE_WIDTH / 2 + 3 : actor.width / 2 + 3;
2685
- receiverAdjustment(actor, adjustment);
2686
- actor.starty = lineStartY - actor.height / 2;
2687
- bounds.bumpVerticalPos(actor.height / 2);
2688
- } else if (destroyedActors.get(msg.from) == index) {
2689
- const actor = actors.get(msg.from);
2690
- if (conf.mirrorActors) {
2691
- const adjustment = actor.type == "actor" ? ACTOR_TYPE_WIDTH / 2 : actor.width / 2;
2692
- senderAdjustment(actor, adjustment);
2693
- }
2694
- actor.stopy = lineStartY - actor.height / 2;
2695
- bounds.bumpVerticalPos(actor.height / 2);
2696
- } else if (destroyedActors.get(msg.to) == index) {
2697
- const actor = actors.get(msg.to);
2698
- if (conf.mirrorActors) {
2699
- const adjustment = actor.type == "actor" ? ACTOR_TYPE_WIDTH / 2 + 3 : actor.width / 2 + 3;
2700
- receiverAdjustment(actor, adjustment);
2701
- }
2702
- actor.stopy = lineStartY - actor.height / 2;
2703
- bounds.bumpVerticalPos(actor.height / 2);
2704
- }
2705
- }
2706
- __name(adjustCreatedDestroyedData, "adjustCreatedDestroyedData");
2707
- var draw = /* @__PURE__ */ __name(async function(_text, id, _version, diagObj) {
2708
- const { securityLevel, sequence } = getConfig2();
2709
- conf = sequence;
2710
- let sandboxElement;
2711
- if (securityLevel === "sandbox") {
2712
- sandboxElement = select("#i" + id);
2713
- }
2714
- const root = securityLevel === "sandbox" ? select(sandboxElement.nodes()[0].contentDocument.body) : select("body");
2715
- const doc = securityLevel === "sandbox" ? sandboxElement.nodes()[0].contentDocument : document;
2716
- bounds.init();
2717
- log.debug(diagObj.db);
2718
- const diagram2 = securityLevel === "sandbox" ? root.select(`[id="${id}"]`) : select(`[id="${id}"]`);
2719
- const actors = diagObj.db.getActors();
2720
- const createdActors = diagObj.db.getCreatedActors();
2721
- const destroyedActors = diagObj.db.getDestroyedActors();
2722
- const boxes = diagObj.db.getBoxes();
2723
- let actorKeys = diagObj.db.getActorKeys();
2724
- const messages = diagObj.db.getMessages();
2725
- const title = diagObj.db.getDiagramTitle();
2726
- const hasBoxes = diagObj.db.hasAtLeastOneBox();
2727
- const hasBoxTitles = diagObj.db.hasAtLeastOneBoxWithTitle();
2728
- const maxMessageWidthPerActor = await getMaxMessageWidthPerActor(actors, messages, diagObj);
2729
- conf.height = await calculateActorMargins(actors, maxMessageWidthPerActor, boxes);
2730
- svgDraw_default.insertComputerIcon(diagram2);
2731
- svgDraw_default.insertDatabaseIcon(diagram2);
2732
- svgDraw_default.insertClockIcon(diagram2);
2733
- if (hasBoxes) {
2734
- bounds.bumpVerticalPos(conf.boxMargin);
2735
- if (hasBoxTitles) {
2736
- bounds.bumpVerticalPos(boxes[0].textMaxHeight);
2737
- }
2738
- }
2739
- if (conf.hideUnusedParticipants === true) {
2740
- const newActors = /* @__PURE__ */ new Set();
2741
- messages.forEach((message) => {
2742
- newActors.add(message.from);
2743
- newActors.add(message.to);
2744
- });
2745
- actorKeys = actorKeys.filter((actorKey) => newActors.has(actorKey));
2746
- }
2747
- addActorRenderingData(diagram2, actors, createdActors, actorKeys, 0, messages, false);
2748
- const loopWidths = await calculateLoopBounds(messages, actors, maxMessageWidthPerActor, diagObj);
2749
- svgDraw_default.insertArrowHead(diagram2);
2750
- svgDraw_default.insertArrowCrossHead(diagram2);
2751
- svgDraw_default.insertArrowFilledHead(diagram2);
2752
- svgDraw_default.insertSequenceNumber(diagram2);
2753
- function activeEnd(msg, verticalPos) {
2754
- const activationData = bounds.endActivation(msg);
2755
- if (activationData.starty + 18 > verticalPos) {
2756
- activationData.starty = verticalPos - 6;
2757
- verticalPos += 12;
2758
- }
2759
- svgDraw_default.drawActivation(
2760
- diagram2,
2761
- activationData,
2762
- verticalPos,
2763
- conf,
2764
- actorActivations(msg.from).length
2765
- );
2766
- bounds.insert(activationData.startx, verticalPos - 10, activationData.stopx, verticalPos);
2767
- }
2768
- __name(activeEnd, "activeEnd");
2769
- let sequenceIndex = 1;
2770
- let sequenceIndexStep = 1;
2771
- const messagesToDraw = [];
2772
- const backgrounds = [];
2773
- let index = 0;
2774
- for (const msg of messages) {
2775
- let loopModel, noteModel, msgModel;
2776
- switch (msg.type) {
2777
- case diagObj.db.LINETYPE.NOTE:
2778
- bounds.resetVerticalPos();
2779
- noteModel = msg.noteModel;
2780
- await drawNote(diagram2, noteModel);
2781
- break;
2782
- case diagObj.db.LINETYPE.ACTIVE_START:
2783
- bounds.newActivation(msg, diagram2, actors);
2784
- break;
2785
- case diagObj.db.LINETYPE.ACTIVE_END:
2786
- activeEnd(msg, bounds.getVerticalPos());
2787
- break;
2788
- case diagObj.db.LINETYPE.LOOP_START:
2789
- adjustLoopHeightForWrap(
2790
- loopWidths,
2791
- msg,
2792
- conf.boxMargin,
2793
- conf.boxMargin + conf.boxTextMargin,
2794
- (message) => bounds.newLoop(message)
2795
- );
2796
- break;
2797
- case diagObj.db.LINETYPE.LOOP_END:
2798
- loopModel = bounds.endLoop();
2799
- await svgDraw_default.drawLoop(diagram2, loopModel, "loop", conf);
2800
- bounds.bumpVerticalPos(loopModel.stopy - bounds.getVerticalPos());
2801
- bounds.models.addLoop(loopModel);
2802
- break;
2803
- case diagObj.db.LINETYPE.RECT_START:
2804
- adjustLoopHeightForWrap(
2805
- loopWidths,
2806
- msg,
2807
- conf.boxMargin,
2808
- conf.boxMargin,
2809
- (message) => bounds.newLoop(void 0, message.message)
2810
- );
2811
- break;
2812
- case diagObj.db.LINETYPE.RECT_END:
2813
- loopModel = bounds.endLoop();
2814
- backgrounds.push(loopModel);
2815
- bounds.models.addLoop(loopModel);
2816
- bounds.bumpVerticalPos(loopModel.stopy - bounds.getVerticalPos());
2817
- break;
2818
- case diagObj.db.LINETYPE.OPT_START:
2819
- adjustLoopHeightForWrap(
2820
- loopWidths,
2821
- msg,
2822
- conf.boxMargin,
2823
- conf.boxMargin + conf.boxTextMargin,
2824
- (message) => bounds.newLoop(message)
2825
- );
2826
- break;
2827
- case diagObj.db.LINETYPE.OPT_END:
2828
- loopModel = bounds.endLoop();
2829
- await svgDraw_default.drawLoop(diagram2, loopModel, "opt", conf);
2830
- bounds.bumpVerticalPos(loopModel.stopy - bounds.getVerticalPos());
2831
- bounds.models.addLoop(loopModel);
2832
- break;
2833
- case diagObj.db.LINETYPE.ALT_START:
2834
- adjustLoopHeightForWrap(
2835
- loopWidths,
2836
- msg,
2837
- conf.boxMargin,
2838
- conf.boxMargin + conf.boxTextMargin,
2839
- (message) => bounds.newLoop(message)
2840
- );
2841
- break;
2842
- case diagObj.db.LINETYPE.ALT_ELSE:
2843
- adjustLoopHeightForWrap(
2844
- loopWidths,
2845
- msg,
2846
- conf.boxMargin + conf.boxTextMargin,
2847
- conf.boxMargin,
2848
- (message) => bounds.addSectionToLoop(message)
2849
- );
2850
- break;
2851
- case diagObj.db.LINETYPE.ALT_END:
2852
- loopModel = bounds.endLoop();
2853
- await svgDraw_default.drawLoop(diagram2, loopModel, "alt", conf);
2854
- bounds.bumpVerticalPos(loopModel.stopy - bounds.getVerticalPos());
2855
- bounds.models.addLoop(loopModel);
2856
- break;
2857
- case diagObj.db.LINETYPE.PAR_START:
2858
- case diagObj.db.LINETYPE.PAR_OVER_START:
2859
- adjustLoopHeightForWrap(
2860
- loopWidths,
2861
- msg,
2862
- conf.boxMargin,
2863
- conf.boxMargin + conf.boxTextMargin,
2864
- (message) => bounds.newLoop(message)
2865
- );
2866
- bounds.saveVerticalPos();
2867
- break;
2868
- case diagObj.db.LINETYPE.PAR_AND:
2869
- adjustLoopHeightForWrap(
2870
- loopWidths,
2871
- msg,
2872
- conf.boxMargin + conf.boxTextMargin,
2873
- conf.boxMargin,
2874
- (message) => bounds.addSectionToLoop(message)
2875
- );
2876
- break;
2877
- case diagObj.db.LINETYPE.PAR_END:
2878
- loopModel = bounds.endLoop();
2879
- await svgDraw_default.drawLoop(diagram2, loopModel, "par", conf);
2880
- bounds.bumpVerticalPos(loopModel.stopy - bounds.getVerticalPos());
2881
- bounds.models.addLoop(loopModel);
2882
- break;
2883
- case diagObj.db.LINETYPE.AUTONUMBER:
2884
- sequenceIndex = msg.message.start || sequenceIndex;
2885
- sequenceIndexStep = msg.message.step || sequenceIndexStep;
2886
- if (msg.message.visible) {
2887
- diagObj.db.enableSequenceNumbers();
2888
- } else {
2889
- diagObj.db.disableSequenceNumbers();
2890
- }
2891
- break;
2892
- case diagObj.db.LINETYPE.CRITICAL_START:
2893
- adjustLoopHeightForWrap(
2894
- loopWidths,
2895
- msg,
2896
- conf.boxMargin,
2897
- conf.boxMargin + conf.boxTextMargin,
2898
- (message) => bounds.newLoop(message)
2899
- );
2900
- break;
2901
- case diagObj.db.LINETYPE.CRITICAL_OPTION:
2902
- adjustLoopHeightForWrap(
2903
- loopWidths,
2904
- msg,
2905
- conf.boxMargin + conf.boxTextMargin,
2906
- conf.boxMargin,
2907
- (message) => bounds.addSectionToLoop(message)
2908
- );
2909
- break;
2910
- case diagObj.db.LINETYPE.CRITICAL_END:
2911
- loopModel = bounds.endLoop();
2912
- await svgDraw_default.drawLoop(diagram2, loopModel, "critical", conf);
2913
- bounds.bumpVerticalPos(loopModel.stopy - bounds.getVerticalPos());
2914
- bounds.models.addLoop(loopModel);
2915
- break;
2916
- case diagObj.db.LINETYPE.BREAK_START:
2917
- adjustLoopHeightForWrap(
2918
- loopWidths,
2919
- msg,
2920
- conf.boxMargin,
2921
- conf.boxMargin + conf.boxTextMargin,
2922
- (message) => bounds.newLoop(message)
2923
- );
2924
- break;
2925
- case diagObj.db.LINETYPE.BREAK_END:
2926
- loopModel = bounds.endLoop();
2927
- await svgDraw_default.drawLoop(diagram2, loopModel, "break", conf);
2928
- bounds.bumpVerticalPos(loopModel.stopy - bounds.getVerticalPos());
2929
- bounds.models.addLoop(loopModel);
2930
- break;
2931
- default:
2932
- try {
2933
- msgModel = msg.msgModel;
2934
- msgModel.starty = bounds.getVerticalPos();
2935
- msgModel.sequenceIndex = sequenceIndex;
2936
- msgModel.sequenceVisible = diagObj.db.showSequenceNumbers();
2937
- const lineStartY = await boundMessage(diagram2, msgModel);
2938
- adjustCreatedDestroyedData(
2939
- msg,
2940
- msgModel,
2941
- lineStartY,
2942
- index,
2943
- actors,
2944
- createdActors,
2945
- destroyedActors
2946
- );
2947
- messagesToDraw.push({ messageModel: msgModel, lineStartY });
2948
- bounds.models.addMessage(msgModel);
2949
- } catch (e) {
2950
- log.error("error while drawing message", e);
2951
- }
2952
- }
2953
- if ([
2954
- diagObj.db.LINETYPE.SOLID_OPEN,
2955
- diagObj.db.LINETYPE.DOTTED_OPEN,
2956
- diagObj.db.LINETYPE.SOLID,
2957
- diagObj.db.LINETYPE.DOTTED,
2958
- diagObj.db.LINETYPE.SOLID_CROSS,
2959
- diagObj.db.LINETYPE.DOTTED_CROSS,
2960
- diagObj.db.LINETYPE.SOLID_POINT,
2961
- diagObj.db.LINETYPE.DOTTED_POINT,
2962
- diagObj.db.LINETYPE.BIDIRECTIONAL_SOLID,
2963
- diagObj.db.LINETYPE.BIDIRECTIONAL_DOTTED
2964
- ].includes(msg.type)) {
2965
- sequenceIndex = sequenceIndex + sequenceIndexStep;
2966
- }
2967
- index++;
2968
- }
2969
- log.debug("createdActors", createdActors);
2970
- log.debug("destroyedActors", destroyedActors);
2971
- await drawActors(diagram2, actors, actorKeys, false);
2972
- for (const e of messagesToDraw) {
2973
- await drawMessage(diagram2, e.messageModel, e.lineStartY, diagObj);
2974
- }
2975
- if (conf.mirrorActors) {
2976
- await drawActors(diagram2, actors, actorKeys, true);
2977
- }
2978
- backgrounds.forEach((e) => svgDraw_default.drawBackgroundRect(diagram2, e));
2979
- fixLifeLineHeights(diagram2, actors, actorKeys, conf);
2980
- for (const box2 of bounds.models.boxes) {
2981
- box2.height = bounds.getVerticalPos() - box2.y;
2982
- bounds.insert(box2.x, box2.y, box2.x + box2.width, box2.height);
2983
- box2.startx = box2.x;
2984
- box2.starty = box2.y;
2985
- box2.stopx = box2.startx + box2.width;
2986
- box2.stopy = box2.starty + box2.height;
2987
- box2.stroke = "rgb(0,0,0, 0.5)";
2988
- svgDraw_default.drawBox(diagram2, box2, conf);
2989
- }
2990
- if (hasBoxes) {
2991
- bounds.bumpVerticalPos(conf.boxMargin);
2992
- }
2993
- const requiredBoxSize = drawActorsPopup(diagram2, actors, actorKeys, doc);
2994
- const { bounds: box } = bounds.getBounds();
2995
- if (box.startx === void 0) {
2996
- box.startx = 0;
2997
- }
2998
- if (box.starty === void 0) {
2999
- box.starty = 0;
3000
- }
3001
- if (box.stopx === void 0) {
3002
- box.stopx = 0;
3003
- }
3004
- if (box.stopy === void 0) {
3005
- box.stopy = 0;
3006
- }
3007
- let boxHeight = box.stopy - box.starty;
3008
- if (boxHeight < requiredBoxSize.maxHeight) {
3009
- boxHeight = requiredBoxSize.maxHeight;
3010
- }
3011
- let height = boxHeight + 2 * conf.diagramMarginY;
3012
- if (conf.mirrorActors) {
3013
- height = height - conf.boxMargin + conf.bottomMarginAdj;
3014
- }
3015
- let boxWidth = box.stopx - box.startx;
3016
- if (boxWidth < requiredBoxSize.maxWidth) {
3017
- boxWidth = requiredBoxSize.maxWidth;
3018
- }
3019
- const width = boxWidth + 2 * conf.diagramMarginX;
3020
- if (title) {
3021
- diagram2.append("text").text(title).attr("x", (box.stopx - box.startx) / 2 - 2 * conf.diagramMarginX).attr("y", -25);
3022
- }
3023
- configureSvgSize(diagram2, height, width, conf.useMaxWidth);
3024
- const extraVertForTitle = title ? 40 : 0;
3025
- diagram2.attr(
3026
- "viewBox",
3027
- box.startx - conf.diagramMarginX + " -" + (conf.diagramMarginY + extraVertForTitle) + " " + width + " " + (height + extraVertForTitle)
3028
- );
3029
- log.debug(`models:`, bounds.models);
3030
- }, "draw");
3031
- async function getMaxMessageWidthPerActor(actors, messages, diagObj) {
3032
- const maxMessageWidthPerActor = {};
3033
- for (const msg of messages) {
3034
- if (actors.get(msg.to) && actors.get(msg.from)) {
3035
- const actor = actors.get(msg.to);
3036
- if (msg.placement === diagObj.db.PLACEMENT.LEFTOF && !actor.prevActor) {
3037
- continue;
3038
- }
3039
- if (msg.placement === diagObj.db.PLACEMENT.RIGHTOF && !actor.nextActor) {
3040
- continue;
3041
- }
3042
- const isNote = msg.placement !== void 0;
3043
- const isMessage = !isNote;
3044
- const textFont = isNote ? noteFont(conf) : messageFont(conf);
3045
- const wrappedMessage = msg.wrap ? utils_default.wrapLabel(msg.message, conf.width - 2 * conf.wrapPadding, textFont) : msg.message;
3046
- const messageDimensions = hasKatex(wrappedMessage) ? await calculateMathMLDimensions(msg.message, getConfig2()) : utils_default.calculateTextDimensions(wrappedMessage, textFont);
3047
- const messageWidth = messageDimensions.width + 2 * conf.wrapPadding;
3048
- if (isMessage && msg.from === actor.nextActor) {
3049
- maxMessageWidthPerActor[msg.to] = common_default.getMax(
3050
- maxMessageWidthPerActor[msg.to] || 0,
3051
- messageWidth
3052
- );
3053
- } else if (isMessage && msg.from === actor.prevActor) {
3054
- maxMessageWidthPerActor[msg.from] = common_default.getMax(
3055
- maxMessageWidthPerActor[msg.from] || 0,
3056
- messageWidth
3057
- );
3058
- } else if (isMessage && msg.from === msg.to) {
3059
- maxMessageWidthPerActor[msg.from] = common_default.getMax(
3060
- maxMessageWidthPerActor[msg.from] || 0,
3061
- messageWidth / 2
3062
- );
3063
- maxMessageWidthPerActor[msg.to] = common_default.getMax(
3064
- maxMessageWidthPerActor[msg.to] || 0,
3065
- messageWidth / 2
3066
- );
3067
- } else if (msg.placement === diagObj.db.PLACEMENT.RIGHTOF) {
3068
- maxMessageWidthPerActor[msg.from] = common_default.getMax(
3069
- maxMessageWidthPerActor[msg.from] || 0,
3070
- messageWidth
3071
- );
3072
- } else if (msg.placement === diagObj.db.PLACEMENT.LEFTOF) {
3073
- maxMessageWidthPerActor[actor.prevActor] = common_default.getMax(
3074
- maxMessageWidthPerActor[actor.prevActor] || 0,
3075
- messageWidth
3076
- );
3077
- } else if (msg.placement === diagObj.db.PLACEMENT.OVER) {
3078
- if (actor.prevActor) {
3079
- maxMessageWidthPerActor[actor.prevActor] = common_default.getMax(
3080
- maxMessageWidthPerActor[actor.prevActor] || 0,
3081
- messageWidth / 2
3082
- );
3083
- }
3084
- if (actor.nextActor) {
3085
- maxMessageWidthPerActor[msg.from] = common_default.getMax(
3086
- maxMessageWidthPerActor[msg.from] || 0,
3087
- messageWidth / 2
3088
- );
3089
- }
3090
- }
3091
- }
3092
- }
3093
- log.debug("maxMessageWidthPerActor:", maxMessageWidthPerActor);
3094
- return maxMessageWidthPerActor;
3095
- }
3096
- __name(getMaxMessageWidthPerActor, "getMaxMessageWidthPerActor");
3097
- var getRequiredPopupWidth = /* @__PURE__ */ __name(function(actor) {
3098
- let requiredPopupWidth = 0;
3099
- const textFont = actorFont(conf);
3100
- for (const key in actor.links) {
3101
- const labelDimensions = utils_default.calculateTextDimensions(key, textFont);
3102
- const labelWidth = labelDimensions.width + 2 * conf.wrapPadding + 2 * conf.boxMargin;
3103
- if (requiredPopupWidth < labelWidth) {
3104
- requiredPopupWidth = labelWidth;
3105
- }
3106
- }
3107
- return requiredPopupWidth;
3108
- }, "getRequiredPopupWidth");
3109
- async function calculateActorMargins(actors, actorToMessageWidth, boxes) {
3110
- let maxHeight = 0;
3111
- for (const prop of actors.keys()) {
3112
- const actor = actors.get(prop);
3113
- if (actor.wrap) {
3114
- actor.description = utils_default.wrapLabel(
3115
- actor.description,
3116
- conf.width - 2 * conf.wrapPadding,
3117
- actorFont(conf)
3118
- );
3119
- }
3120
- const actDims = hasKatex(actor.description) ? await calculateMathMLDimensions(actor.description, getConfig2()) : utils_default.calculateTextDimensions(actor.description, actorFont(conf));
3121
- actor.width = actor.wrap ? conf.width : common_default.getMax(conf.width, actDims.width + 2 * conf.wrapPadding);
3122
- actor.height = actor.wrap ? common_default.getMax(actDims.height, conf.height) : conf.height;
3123
- maxHeight = common_default.getMax(maxHeight, actor.height);
3124
- }
3125
- for (const actorKey in actorToMessageWidth) {
3126
- const actor = actors.get(actorKey);
3127
- if (!actor) {
3128
- continue;
3129
- }
3130
- const nextActor = actors.get(actor.nextActor);
3131
- if (!nextActor) {
3132
- const messageWidth2 = actorToMessageWidth[actorKey];
3133
- const actorWidth2 = messageWidth2 + conf.actorMargin - actor.width / 2;
3134
- actor.margin = common_default.getMax(actorWidth2, conf.actorMargin);
3135
- continue;
3136
- }
3137
- const messageWidth = actorToMessageWidth[actorKey];
3138
- const actorWidth = messageWidth + conf.actorMargin - actor.width / 2 - nextActor.width / 2;
3139
- actor.margin = common_default.getMax(actorWidth, conf.actorMargin);
3140
- }
3141
- let maxBoxHeight = 0;
3142
- boxes.forEach((box) => {
3143
- const textFont = messageFont(conf);
3144
- let totalWidth = box.actorKeys.reduce((total, aKey) => {
3145
- return total += actors.get(aKey).width + (actors.get(aKey).margin || 0);
3146
- }, 0);
3147
- totalWidth -= 2 * conf.boxTextMargin;
3148
- if (box.wrap) {
3149
- box.name = utils_default.wrapLabel(box.name, totalWidth - 2 * conf.wrapPadding, textFont);
3150
- }
3151
- const boxMsgDimensions = utils_default.calculateTextDimensions(box.name, textFont);
3152
- maxBoxHeight = common_default.getMax(boxMsgDimensions.height, maxBoxHeight);
3153
- const minWidth = common_default.getMax(totalWidth, boxMsgDimensions.width + 2 * conf.wrapPadding);
3154
- box.margin = conf.boxTextMargin;
3155
- if (totalWidth < minWidth) {
3156
- const missing = (minWidth - totalWidth) / 2;
3157
- box.margin += missing;
3158
- }
3159
- });
3160
- boxes.forEach((box) => box.textMaxHeight = maxBoxHeight);
3161
- return common_default.getMax(maxHeight, conf.height);
3162
- }
3163
- __name(calculateActorMargins, "calculateActorMargins");
3164
- var buildNoteModel = /* @__PURE__ */ __name(async function(msg, actors, diagObj) {
3165
- const fromActor = actors.get(msg.from);
3166
- const toActor = actors.get(msg.to);
3167
- const startx = fromActor.x;
3168
- const stopx = toActor.x;
3169
- const shouldWrap = msg.wrap && msg.message;
3170
- let textDimensions = hasKatex(msg.message) ? await calculateMathMLDimensions(msg.message, getConfig2()) : utils_default.calculateTextDimensions(
3171
- shouldWrap ? utils_default.wrapLabel(msg.message, conf.width, noteFont(conf)) : msg.message,
3172
- noteFont(conf)
3173
- );
3174
- const noteModel = {
3175
- width: shouldWrap ? conf.width : common_default.getMax(conf.width, textDimensions.width + 2 * conf.noteMargin),
3176
- height: 0,
3177
- startx: fromActor.x,
3178
- stopx: 0,
3179
- starty: 0,
3180
- stopy: 0,
3181
- message: msg.message
3182
- };
3183
- if (msg.placement === diagObj.db.PLACEMENT.RIGHTOF) {
3184
- noteModel.width = shouldWrap ? common_default.getMax(conf.width, textDimensions.width) : common_default.getMax(
3185
- fromActor.width / 2 + toActor.width / 2,
3186
- textDimensions.width + 2 * conf.noteMargin
3187
- );
3188
- noteModel.startx = startx + (fromActor.width + conf.actorMargin) / 2;
3189
- } else if (msg.placement === diagObj.db.PLACEMENT.LEFTOF) {
3190
- noteModel.width = shouldWrap ? common_default.getMax(conf.width, textDimensions.width + 2 * conf.noteMargin) : common_default.getMax(
3191
- fromActor.width / 2 + toActor.width / 2,
3192
- textDimensions.width + 2 * conf.noteMargin
3193
- );
3194
- noteModel.startx = startx - noteModel.width + (fromActor.width - conf.actorMargin) / 2;
3195
- } else if (msg.to === msg.from) {
3196
- textDimensions = utils_default.calculateTextDimensions(
3197
- shouldWrap ? utils_default.wrapLabel(msg.message, common_default.getMax(conf.width, fromActor.width), noteFont(conf)) : msg.message,
3198
- noteFont(conf)
3199
- );
3200
- noteModel.width = shouldWrap ? common_default.getMax(conf.width, fromActor.width) : common_default.getMax(fromActor.width, conf.width, textDimensions.width + 2 * conf.noteMargin);
3201
- noteModel.startx = startx + (fromActor.width - noteModel.width) / 2;
3202
- } else {
3203
- noteModel.width = Math.abs(startx + fromActor.width / 2 - (stopx + toActor.width / 2)) + conf.actorMargin;
3204
- noteModel.startx = startx < stopx ? startx + fromActor.width / 2 - conf.actorMargin / 2 : stopx + toActor.width / 2 - conf.actorMargin / 2;
3205
- }
3206
- if (shouldWrap) {
3207
- noteModel.message = utils_default.wrapLabel(
3208
- msg.message,
3209
- noteModel.width - 2 * conf.wrapPadding,
3210
- noteFont(conf)
3211
- );
3212
- }
3213
- log.debug(
3214
- `NM:[${noteModel.startx},${noteModel.stopx},${noteModel.starty},${noteModel.stopy}:${noteModel.width},${noteModel.height}=${msg.message}]`
3215
- );
3216
- return noteModel;
3217
- }, "buildNoteModel");
3218
- var buildMessageModel = /* @__PURE__ */ __name(function(msg, actors, diagObj) {
3219
- if (![
3220
- diagObj.db.LINETYPE.SOLID_OPEN,
3221
- diagObj.db.LINETYPE.DOTTED_OPEN,
3222
- diagObj.db.LINETYPE.SOLID,
3223
- diagObj.db.LINETYPE.DOTTED,
3224
- diagObj.db.LINETYPE.SOLID_CROSS,
3225
- diagObj.db.LINETYPE.DOTTED_CROSS,
3226
- diagObj.db.LINETYPE.SOLID_POINT,
3227
- diagObj.db.LINETYPE.DOTTED_POINT,
3228
- diagObj.db.LINETYPE.BIDIRECTIONAL_SOLID,
3229
- diagObj.db.LINETYPE.BIDIRECTIONAL_DOTTED
3230
- ].includes(msg.type)) {
3231
- return {};
3232
- }
3233
- const [fromLeft, fromRight] = activationBounds(msg.from, actors);
3234
- const [toLeft, toRight] = activationBounds(msg.to, actors);
3235
- const isArrowToRight = fromLeft <= toLeft;
3236
- let startx = isArrowToRight ? fromRight : fromLeft;
3237
- let stopx = isArrowToRight ? toLeft : toRight;
3238
- const isArrowToActivation = Math.abs(toLeft - toRight) > 2;
3239
- const adjustValue = /* @__PURE__ */ __name((value) => {
3240
- return isArrowToRight ? -value : value;
3241
- }, "adjustValue");
3242
- if (msg.from === msg.to) {
3243
- stopx = startx;
3244
- } else {
3245
- if (msg.activate && !isArrowToActivation) {
3246
- stopx += adjustValue(conf.activationWidth / 2 - 1);
3247
- }
3248
- if (![diagObj.db.LINETYPE.SOLID_OPEN, diagObj.db.LINETYPE.DOTTED_OPEN].includes(msg.type)) {
3249
- stopx += adjustValue(3);
3250
- }
3251
- if ([diagObj.db.LINETYPE.BIDIRECTIONAL_SOLID, diagObj.db.LINETYPE.BIDIRECTIONAL_DOTTED].includes(
3252
- msg.type
3253
- )) {
3254
- startx -= adjustValue(3);
3255
- }
3256
- }
3257
- const allBounds = [fromLeft, fromRight, toLeft, toRight];
3258
- const boundedWidth = Math.abs(startx - stopx);
3259
- if (msg.wrap && msg.message) {
3260
- msg.message = utils_default.wrapLabel(
3261
- msg.message,
3262
- common_default.getMax(boundedWidth + 2 * conf.wrapPadding, conf.width),
3263
- messageFont(conf)
3264
- );
3265
- }
3266
- const msgDims = utils_default.calculateTextDimensions(msg.message, messageFont(conf));
3267
- return {
3268
- width: common_default.getMax(
3269
- msg.wrap ? 0 : msgDims.width + 2 * conf.wrapPadding,
3270
- boundedWidth + 2 * conf.wrapPadding,
3271
- conf.width
3272
- ),
3273
- height: 0,
3274
- startx,
3275
- stopx,
3276
- starty: 0,
3277
- stopy: 0,
3278
- message: msg.message,
3279
- type: msg.type,
3280
- wrap: msg.wrap,
3281
- fromBounds: Math.min.apply(null, allBounds),
3282
- toBounds: Math.max.apply(null, allBounds)
3283
- };
3284
- }, "buildMessageModel");
3285
- var calculateLoopBounds = /* @__PURE__ */ __name(async function(messages, actors, _maxWidthPerActor, diagObj) {
3286
- const loops = {};
3287
- const stack = [];
3288
- let current, noteModel, msgModel;
3289
- for (const msg of messages) {
3290
- switch (msg.type) {
3291
- case diagObj.db.LINETYPE.LOOP_START:
3292
- case diagObj.db.LINETYPE.ALT_START:
3293
- case diagObj.db.LINETYPE.OPT_START:
3294
- case diagObj.db.LINETYPE.PAR_START:
3295
- case diagObj.db.LINETYPE.PAR_OVER_START:
3296
- case diagObj.db.LINETYPE.CRITICAL_START:
3297
- case diagObj.db.LINETYPE.BREAK_START:
3298
- stack.push({
3299
- id: msg.id,
3300
- msg: msg.message,
3301
- from: Number.MAX_SAFE_INTEGER,
3302
- to: Number.MIN_SAFE_INTEGER,
3303
- width: 0
3304
- });
3305
- break;
3306
- case diagObj.db.LINETYPE.ALT_ELSE:
3307
- case diagObj.db.LINETYPE.PAR_AND:
3308
- case diagObj.db.LINETYPE.CRITICAL_OPTION:
3309
- if (msg.message) {
3310
- current = stack.pop();
3311
- loops[current.id] = current;
3312
- loops[msg.id] = current;
3313
- stack.push(current);
3314
- }
3315
- break;
3316
- case diagObj.db.LINETYPE.LOOP_END:
3317
- case diagObj.db.LINETYPE.ALT_END:
3318
- case diagObj.db.LINETYPE.OPT_END:
3319
- case diagObj.db.LINETYPE.PAR_END:
3320
- case diagObj.db.LINETYPE.CRITICAL_END:
3321
- case diagObj.db.LINETYPE.BREAK_END:
3322
- current = stack.pop();
3323
- loops[current.id] = current;
3324
- break;
3325
- case diagObj.db.LINETYPE.ACTIVE_START:
3326
- {
3327
- const actorRect = actors.get(msg.from ? msg.from : msg.to.actor);
3328
- const stackedSize = actorActivations(msg.from ? msg.from : msg.to.actor).length;
3329
- const x = actorRect.x + actorRect.width / 2 + (stackedSize - 1) * conf.activationWidth / 2;
3330
- const toAdd = {
3331
- startx: x,
3332
- stopx: x + conf.activationWidth,
3333
- actor: msg.from,
3334
- enabled: true
3335
- };
3336
- bounds.activations.push(toAdd);
3337
- }
3338
- break;
3339
- case diagObj.db.LINETYPE.ACTIVE_END:
3340
- {
3341
- const lastActorActivationIdx = bounds.activations.map((a) => a.actor).lastIndexOf(msg.from);
3342
- bounds.activations.splice(lastActorActivationIdx, 1).splice(0, 1);
3343
- }
3344
- break;
3345
- }
3346
- const isNote = msg.placement !== void 0;
3347
- if (isNote) {
3348
- noteModel = await buildNoteModel(msg, actors, diagObj);
3349
- msg.noteModel = noteModel;
3350
- stack.forEach((stk) => {
3351
- current = stk;
3352
- current.from = common_default.getMin(current.from, noteModel.startx);
3353
- current.to = common_default.getMax(current.to, noteModel.startx + noteModel.width);
3354
- current.width = common_default.getMax(current.width, Math.abs(current.from - current.to)) - conf.labelBoxWidth;
3355
- });
3356
- } else {
3357
- msgModel = buildMessageModel(msg, actors, diagObj);
3358
- msg.msgModel = msgModel;
3359
- if (msgModel.startx && msgModel.stopx && stack.length > 0) {
3360
- stack.forEach((stk) => {
3361
- current = stk;
3362
- if (msgModel.startx === msgModel.stopx) {
3363
- const from = actors.get(msg.from);
3364
- const to = actors.get(msg.to);
3365
- current.from = common_default.getMin(
3366
- from.x - msgModel.width / 2,
3367
- from.x - from.width / 2,
3368
- current.from
3369
- );
3370
- current.to = common_default.getMax(
3371
- to.x + msgModel.width / 2,
3372
- to.x + from.width / 2,
3373
- current.to
3374
- );
3375
- current.width = common_default.getMax(current.width, Math.abs(current.to - current.from)) - conf.labelBoxWidth;
3376
- } else {
3377
- current.from = common_default.getMin(msgModel.startx, current.from);
3378
- current.to = common_default.getMax(msgModel.stopx, current.to);
3379
- current.width = common_default.getMax(current.width, msgModel.width) - conf.labelBoxWidth;
3380
- }
3381
- });
3382
- }
3383
- }
3384
- }
3385
- bounds.activations = [];
3386
- log.debug("Loop type widths:", loops);
3387
- return loops;
3388
- }, "calculateLoopBounds");
3389
- var sequenceRenderer_default = {
3390
- bounds,
3391
- drawActors,
3392
- drawActorsPopup,
3393
- setConf,
3394
- draw
3395
- };
3396
- var diagram = {
3397
- parser: sequenceDiagram_default,
3398
- get db() {
3399
- return new SequenceDB();
3400
- },
3401
- renderer: sequenceRenderer_default,
3402
- styles: styles_default,
3403
- init: /* @__PURE__ */ __name((cnf) => {
3404
- if (!cnf.sequence) {
3405
- cnf.sequence = {};
3406
- }
3407
- if (cnf.wrap) {
3408
- cnf.sequence.wrap = cnf.wrap;
3409
- setConfig2({ sequence: { wrap: cnf.wrap } });
3410
- }
3411
- }, "init")
3412
- };
3413
- export {
3414
- diagram
3415
- };