@sinm/kai 1.8.5

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