@yorz/cli 0.1.0

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