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