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