@infinilabs/ai-chat 0.0.1 → 0.0.3

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