@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,2413 @@
1
+ import {
2
+ drawRect,
3
+ getNoteRect
4
+ } from "./markdown-hjp6sj8t.js";
5
+ import {
6
+ calculateTextHeight,
7
+ calculateTextWidth,
8
+ wrapLabel
9
+ } from "./markdown-ff5wvb43.js";
10
+ import {
11
+ require_dist
12
+ } from "./markdown-pzgd8z3s.js";
13
+ import {
14
+ assignWithDepth_default,
15
+ common_default,
16
+ configureSvgSize,
17
+ getAccDescription,
18
+ getAccTitle,
19
+ getConfig2,
20
+ sanitizeText,
21
+ setAccDescription,
22
+ setAccTitle
23
+ } from "./markdown-92n37gd4.js";
24
+ import {
25
+ log,
26
+ select_default
27
+ } from "./markdown-xw8dsk8b.js";
28
+ import {
29
+ __name
30
+ } from "./markdown-1s5vwkf2.js";
31
+ import"./markdown-dy5sgjhc.js";
32
+ import {
33
+ __toESM
34
+ } from "./markdown-809k7q41.js";
35
+
36
+ // node_modules/mermaid/dist/chunks/mermaid.core/c4Diagram-5PPSVZJV.mjs
37
+ var import_sanitize_url = __toESM(require_dist(), 1);
38
+ var parser = function() {
39
+ var o = /* @__PURE__ */ __name(function(k, v, o2, l) {
40
+ for (o2 = o2 || {}, l = k.length;l--; o2[k[l]] = v)
41
+ ;
42
+ return o2;
43
+ }, "o"), $V0 = [1, 24], $V1 = [1, 25], $V2 = [1, 26], $V3 = [1, 27], $V4 = [1, 28], $V5 = [1, 63], $V6 = [1, 64], $V7 = [1, 65], $V8 = [1, 66], $V9 = [1, 67], $Va = [1, 68], $Vb = [1, 69], $Vc = [1, 29], $Vd = [1, 30], $Ve = [1, 31], $Vf = [1, 32], $Vg = [1, 33], $Vh = [1, 34], $Vi = [1, 35], $Vj = [1, 36], $Vk = [1, 37], $Vl = [1, 38], $Vm = [1, 39], $Vn = [1, 40], $Vo = [1, 41], $Vp = [1, 42], $Vq = [1, 43], $Vr = [1, 44], $Vs = [1, 45], $Vt = [1, 46], $Vu = [1, 47], $Vv = [1, 48], $Vw = [1, 50], $Vx = [1, 51], $Vy = [1, 52], $Vz = [1, 53], $VA = [1, 54], $VB = [1, 55], $VC = [1, 56], $VD = [1, 57], $VE = [1, 58], $VF = [1, 59], $VG = [1, 60], $VH = [14, 42], $VI = [14, 34, 36, 37, 38, 39, 40, 41, 42, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74], $VJ = [12, 14, 34, 36, 37, 38, 39, 40, 41, 42, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74], $VK = [1, 82], $VL = [1, 83], $VM = [1, 84], $VN = [1, 85], $VO = [12, 14, 42], $VP = [12, 14, 33, 42], $VQ = [12, 14, 33, 42, 76, 77, 79, 80], $VR = [12, 33], $VS = [34, 36, 37, 38, 39, 40, 41, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74];
44
+ var parser2 = {
45
+ trace: /* @__PURE__ */ __name(function trace() {}, "trace"),
46
+ yy: {},
47
+ symbols_: { error: 2, start: 3, mermaidDoc: 4, direction: 5, direction_tb: 6, direction_bt: 7, direction_rl: 8, direction_lr: 9, graphConfig: 10, C4_CONTEXT: 11, NEWLINE: 12, statements: 13, EOF: 14, C4_CONTAINER: 15, C4_COMPONENT: 16, C4_DYNAMIC: 17, C4_DEPLOYMENT: 18, otherStatements: 19, diagramStatements: 20, otherStatement: 21, title: 22, accDescription: 23, acc_title: 24, acc_title_value: 25, acc_descr: 26, acc_descr_value: 27, acc_descr_multiline_value: 28, boundaryStatement: 29, boundaryStartStatement: 30, boundaryStopStatement: 31, boundaryStart: 32, LBRACE: 33, ENTERPRISE_BOUNDARY: 34, attributes: 35, SYSTEM_BOUNDARY: 36, BOUNDARY: 37, CONTAINER_BOUNDARY: 38, NODE: 39, NODE_L: 40, NODE_R: 41, RBRACE: 42, diagramStatement: 43, PERSON: 44, PERSON_EXT: 45, SYSTEM: 46, SYSTEM_DB: 47, SYSTEM_QUEUE: 48, SYSTEM_EXT: 49, SYSTEM_EXT_DB: 50, SYSTEM_EXT_QUEUE: 51, CONTAINER: 52, CONTAINER_DB: 53, CONTAINER_QUEUE: 54, CONTAINER_EXT: 55, CONTAINER_EXT_DB: 56, CONTAINER_EXT_QUEUE: 57, COMPONENT: 58, COMPONENT_DB: 59, COMPONENT_QUEUE: 60, COMPONENT_EXT: 61, COMPONENT_EXT_DB: 62, COMPONENT_EXT_QUEUE: 63, REL: 64, BIREL: 65, REL_U: 66, REL_D: 67, REL_L: 68, REL_R: 69, REL_B: 70, REL_INDEX: 71, UPDATE_EL_STYLE: 72, UPDATE_REL_STYLE: 73, UPDATE_LAYOUT_CONFIG: 74, attribute: 75, STR: 76, STR_KEY: 77, STR_VALUE: 78, ATTRIBUTE: 79, ATTRIBUTE_EMPTY: 80, $accept: 0, $end: 1 },
48
+ terminals_: { 2: "error", 6: "direction_tb", 7: "direction_bt", 8: "direction_rl", 9: "direction_lr", 11: "C4_CONTEXT", 12: "NEWLINE", 14: "EOF", 15: "C4_CONTAINER", 16: "C4_COMPONENT", 17: "C4_DYNAMIC", 18: "C4_DEPLOYMENT", 22: "title", 23: "accDescription", 24: "acc_title", 25: "acc_title_value", 26: "acc_descr", 27: "acc_descr_value", 28: "acc_descr_multiline_value", 33: "LBRACE", 34: "ENTERPRISE_BOUNDARY", 36: "SYSTEM_BOUNDARY", 37: "BOUNDARY", 38: "CONTAINER_BOUNDARY", 39: "NODE", 40: "NODE_L", 41: "NODE_R", 42: "RBRACE", 44: "PERSON", 45: "PERSON_EXT", 46: "SYSTEM", 47: "SYSTEM_DB", 48: "SYSTEM_QUEUE", 49: "SYSTEM_EXT", 50: "SYSTEM_EXT_DB", 51: "SYSTEM_EXT_QUEUE", 52: "CONTAINER", 53: "CONTAINER_DB", 54: "CONTAINER_QUEUE", 55: "CONTAINER_EXT", 56: "CONTAINER_EXT_DB", 57: "CONTAINER_EXT_QUEUE", 58: "COMPONENT", 59: "COMPONENT_DB", 60: "COMPONENT_QUEUE", 61: "COMPONENT_EXT", 62: "COMPONENT_EXT_DB", 63: "COMPONENT_EXT_QUEUE", 64: "REL", 65: "BIREL", 66: "REL_U", 67: "REL_D", 68: "REL_L", 69: "REL_R", 70: "REL_B", 71: "REL_INDEX", 72: "UPDATE_EL_STYLE", 73: "UPDATE_REL_STYLE", 74: "UPDATE_LAYOUT_CONFIG", 76: "STR", 77: "STR_KEY", 78: "STR_VALUE", 79: "ATTRIBUTE", 80: "ATTRIBUTE_EMPTY" },
49
+ productions_: [0, [3, 1], [3, 1], [5, 1], [5, 1], [5, 1], [5, 1], [4, 1], [10, 4], [10, 4], [10, 4], [10, 4], [10, 4], [13, 1], [13, 1], [13, 2], [19, 1], [19, 2], [19, 3], [21, 1], [21, 1], [21, 2], [21, 2], [21, 1], [29, 3], [30, 3], [30, 3], [30, 4], [32, 2], [32, 2], [32, 2], [32, 2], [32, 2], [32, 2], [32, 2], [31, 1], [20, 1], [20, 2], [20, 3], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 1], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [35, 1], [35, 2], [75, 1], [75, 2], [75, 1], [75, 1]],
50
+ performAction: /* @__PURE__ */ __name(function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) {
51
+ var $0 = $$.length - 1;
52
+ switch (yystate) {
53
+ case 3:
54
+ yy.setDirection("TB");
55
+ break;
56
+ case 4:
57
+ yy.setDirection("BT");
58
+ break;
59
+ case 5:
60
+ yy.setDirection("RL");
61
+ break;
62
+ case 6:
63
+ yy.setDirection("LR");
64
+ break;
65
+ case 8:
66
+ case 9:
67
+ case 10:
68
+ case 11:
69
+ case 12:
70
+ yy.setC4Type($$[$0 - 3]);
71
+ break;
72
+ case 19:
73
+ yy.setTitle($$[$0].substring(6));
74
+ this.$ = $$[$0].substring(6);
75
+ break;
76
+ case 20:
77
+ yy.setAccDescription($$[$0].substring(15));
78
+ this.$ = $$[$0].substring(15);
79
+ break;
80
+ case 21:
81
+ this.$ = $$[$0].trim();
82
+ yy.setTitle(this.$);
83
+ break;
84
+ case 22:
85
+ case 23:
86
+ this.$ = $$[$0].trim();
87
+ yy.setAccDescription(this.$);
88
+ break;
89
+ case 28:
90
+ $$[$0].splice(2, 0, "ENTERPRISE");
91
+ yy.addPersonOrSystemBoundary(...$$[$0]);
92
+ this.$ = $$[$0];
93
+ break;
94
+ case 29:
95
+ $$[$0].splice(2, 0, "SYSTEM");
96
+ yy.addPersonOrSystemBoundary(...$$[$0]);
97
+ this.$ = $$[$0];
98
+ break;
99
+ case 30:
100
+ yy.addPersonOrSystemBoundary(...$$[$0]);
101
+ this.$ = $$[$0];
102
+ break;
103
+ case 31:
104
+ $$[$0].splice(2, 0, "CONTAINER");
105
+ yy.addContainerBoundary(...$$[$0]);
106
+ this.$ = $$[$0];
107
+ break;
108
+ case 32:
109
+ yy.addDeploymentNode("node", ...$$[$0]);
110
+ this.$ = $$[$0];
111
+ break;
112
+ case 33:
113
+ yy.addDeploymentNode("nodeL", ...$$[$0]);
114
+ this.$ = $$[$0];
115
+ break;
116
+ case 34:
117
+ yy.addDeploymentNode("nodeR", ...$$[$0]);
118
+ this.$ = $$[$0];
119
+ break;
120
+ case 35:
121
+ yy.popBoundaryParseStack();
122
+ break;
123
+ case 39:
124
+ yy.addPersonOrSystem("person", ...$$[$0]);
125
+ this.$ = $$[$0];
126
+ break;
127
+ case 40:
128
+ yy.addPersonOrSystem("external_person", ...$$[$0]);
129
+ this.$ = $$[$0];
130
+ break;
131
+ case 41:
132
+ yy.addPersonOrSystem("system", ...$$[$0]);
133
+ this.$ = $$[$0];
134
+ break;
135
+ case 42:
136
+ yy.addPersonOrSystem("system_db", ...$$[$0]);
137
+ this.$ = $$[$0];
138
+ break;
139
+ case 43:
140
+ yy.addPersonOrSystem("system_queue", ...$$[$0]);
141
+ this.$ = $$[$0];
142
+ break;
143
+ case 44:
144
+ yy.addPersonOrSystem("external_system", ...$$[$0]);
145
+ this.$ = $$[$0];
146
+ break;
147
+ case 45:
148
+ yy.addPersonOrSystem("external_system_db", ...$$[$0]);
149
+ this.$ = $$[$0];
150
+ break;
151
+ case 46:
152
+ yy.addPersonOrSystem("external_system_queue", ...$$[$0]);
153
+ this.$ = $$[$0];
154
+ break;
155
+ case 47:
156
+ yy.addContainer("container", ...$$[$0]);
157
+ this.$ = $$[$0];
158
+ break;
159
+ case 48:
160
+ yy.addContainer("container_db", ...$$[$0]);
161
+ this.$ = $$[$0];
162
+ break;
163
+ case 49:
164
+ yy.addContainer("container_queue", ...$$[$0]);
165
+ this.$ = $$[$0];
166
+ break;
167
+ case 50:
168
+ yy.addContainer("external_container", ...$$[$0]);
169
+ this.$ = $$[$0];
170
+ break;
171
+ case 51:
172
+ yy.addContainer("external_container_db", ...$$[$0]);
173
+ this.$ = $$[$0];
174
+ break;
175
+ case 52:
176
+ yy.addContainer("external_container_queue", ...$$[$0]);
177
+ this.$ = $$[$0];
178
+ break;
179
+ case 53:
180
+ yy.addComponent("component", ...$$[$0]);
181
+ this.$ = $$[$0];
182
+ break;
183
+ case 54:
184
+ yy.addComponent("component_db", ...$$[$0]);
185
+ this.$ = $$[$0];
186
+ break;
187
+ case 55:
188
+ yy.addComponent("component_queue", ...$$[$0]);
189
+ this.$ = $$[$0];
190
+ break;
191
+ case 56:
192
+ yy.addComponent("external_component", ...$$[$0]);
193
+ this.$ = $$[$0];
194
+ break;
195
+ case 57:
196
+ yy.addComponent("external_component_db", ...$$[$0]);
197
+ this.$ = $$[$0];
198
+ break;
199
+ case 58:
200
+ yy.addComponent("external_component_queue", ...$$[$0]);
201
+ this.$ = $$[$0];
202
+ break;
203
+ case 60:
204
+ yy.addRel("rel", ...$$[$0]);
205
+ this.$ = $$[$0];
206
+ break;
207
+ case 61:
208
+ yy.addRel("birel", ...$$[$0]);
209
+ this.$ = $$[$0];
210
+ break;
211
+ case 62:
212
+ yy.addRel("rel_u", ...$$[$0]);
213
+ this.$ = $$[$0];
214
+ break;
215
+ case 63:
216
+ yy.addRel("rel_d", ...$$[$0]);
217
+ this.$ = $$[$0];
218
+ break;
219
+ case 64:
220
+ yy.addRel("rel_l", ...$$[$0]);
221
+ this.$ = $$[$0];
222
+ break;
223
+ case 65:
224
+ yy.addRel("rel_r", ...$$[$0]);
225
+ this.$ = $$[$0];
226
+ break;
227
+ case 66:
228
+ yy.addRel("rel_b", ...$$[$0]);
229
+ this.$ = $$[$0];
230
+ break;
231
+ case 67:
232
+ $$[$0].splice(0, 1);
233
+ yy.addRel("rel", ...$$[$0]);
234
+ this.$ = $$[$0];
235
+ break;
236
+ case 68:
237
+ yy.updateElStyle("update_el_style", ...$$[$0]);
238
+ this.$ = $$[$0];
239
+ break;
240
+ case 69:
241
+ yy.updateRelStyle("update_rel_style", ...$$[$0]);
242
+ this.$ = $$[$0];
243
+ break;
244
+ case 70:
245
+ yy.updateLayoutConfig("update_layout_config", ...$$[$0]);
246
+ this.$ = $$[$0];
247
+ break;
248
+ case 71:
249
+ this.$ = [$$[$0]];
250
+ break;
251
+ case 72:
252
+ $$[$0].unshift($$[$0 - 1]);
253
+ this.$ = $$[$0];
254
+ break;
255
+ case 73:
256
+ case 75:
257
+ this.$ = $$[$0].trim();
258
+ break;
259
+ case 74:
260
+ let kv = {};
261
+ kv[$$[$0 - 1].trim()] = $$[$0].trim();
262
+ this.$ = kv;
263
+ break;
264
+ case 76:
265
+ this.$ = "";
266
+ break;
267
+ }
268
+ }, "anonymous"),
269
+ table: [{ 3: 1, 4: 2, 5: 3, 6: [1, 5], 7: [1, 6], 8: [1, 7], 9: [1, 8], 10: 4, 11: [1, 9], 15: [1, 10], 16: [1, 11], 17: [1, 12], 18: [1, 13] }, { 1: [3] }, { 1: [2, 1] }, { 1: [2, 2] }, { 1: [2, 7] }, { 1: [2, 3] }, { 1: [2, 4] }, { 1: [2, 5] }, { 1: [2, 6] }, { 12: [1, 14] }, { 12: [1, 15] }, { 12: [1, 16] }, { 12: [1, 17] }, { 12: [1, 18] }, { 13: 19, 19: 20, 20: 21, 21: 22, 22: $V0, 23: $V1, 24: $V2, 26: $V3, 28: $V4, 29: 49, 30: 61, 32: 62, 34: $V5, 36: $V6, 37: $V7, 38: $V8, 39: $V9, 40: $Va, 41: $Vb, 43: 23, 44: $Vc, 45: $Vd, 46: $Ve, 47: $Vf, 48: $Vg, 49: $Vh, 50: $Vi, 51: $Vj, 52: $Vk, 53: $Vl, 54: $Vm, 55: $Vn, 56: $Vo, 57: $Vp, 58: $Vq, 59: $Vr, 60: $Vs, 61: $Vt, 62: $Vu, 63: $Vv, 64: $Vw, 65: $Vx, 66: $Vy, 67: $Vz, 68: $VA, 69: $VB, 70: $VC, 71: $VD, 72: $VE, 73: $VF, 74: $VG }, { 13: 70, 19: 20, 20: 21, 21: 22, 22: $V0, 23: $V1, 24: $V2, 26: $V3, 28: $V4, 29: 49, 30: 61, 32: 62, 34: $V5, 36: $V6, 37: $V7, 38: $V8, 39: $V9, 40: $Va, 41: $Vb, 43: 23, 44: $Vc, 45: $Vd, 46: $Ve, 47: $Vf, 48: $Vg, 49: $Vh, 50: $Vi, 51: $Vj, 52: $Vk, 53: $Vl, 54: $Vm, 55: $Vn, 56: $Vo, 57: $Vp, 58: $Vq, 59: $Vr, 60: $Vs, 61: $Vt, 62: $Vu, 63: $Vv, 64: $Vw, 65: $Vx, 66: $Vy, 67: $Vz, 68: $VA, 69: $VB, 70: $VC, 71: $VD, 72: $VE, 73: $VF, 74: $VG }, { 13: 71, 19: 20, 20: 21, 21: 22, 22: $V0, 23: $V1, 24: $V2, 26: $V3, 28: $V4, 29: 49, 30: 61, 32: 62, 34: $V5, 36: $V6, 37: $V7, 38: $V8, 39: $V9, 40: $Va, 41: $Vb, 43: 23, 44: $Vc, 45: $Vd, 46: $Ve, 47: $Vf, 48: $Vg, 49: $Vh, 50: $Vi, 51: $Vj, 52: $Vk, 53: $Vl, 54: $Vm, 55: $Vn, 56: $Vo, 57: $Vp, 58: $Vq, 59: $Vr, 60: $Vs, 61: $Vt, 62: $Vu, 63: $Vv, 64: $Vw, 65: $Vx, 66: $Vy, 67: $Vz, 68: $VA, 69: $VB, 70: $VC, 71: $VD, 72: $VE, 73: $VF, 74: $VG }, { 13: 72, 19: 20, 20: 21, 21: 22, 22: $V0, 23: $V1, 24: $V2, 26: $V3, 28: $V4, 29: 49, 30: 61, 32: 62, 34: $V5, 36: $V6, 37: $V7, 38: $V8, 39: $V9, 40: $Va, 41: $Vb, 43: 23, 44: $Vc, 45: $Vd, 46: $Ve, 47: $Vf, 48: $Vg, 49: $Vh, 50: $Vi, 51: $Vj, 52: $Vk, 53: $Vl, 54: $Vm, 55: $Vn, 56: $Vo, 57: $Vp, 58: $Vq, 59: $Vr, 60: $Vs, 61: $Vt, 62: $Vu, 63: $Vv, 64: $Vw, 65: $Vx, 66: $Vy, 67: $Vz, 68: $VA, 69: $VB, 70: $VC, 71: $VD, 72: $VE, 73: $VF, 74: $VG }, { 13: 73, 19: 20, 20: 21, 21: 22, 22: $V0, 23: $V1, 24: $V2, 26: $V3, 28: $V4, 29: 49, 30: 61, 32: 62, 34: $V5, 36: $V6, 37: $V7, 38: $V8, 39: $V9, 40: $Va, 41: $Vb, 43: 23, 44: $Vc, 45: $Vd, 46: $Ve, 47: $Vf, 48: $Vg, 49: $Vh, 50: $Vi, 51: $Vj, 52: $Vk, 53: $Vl, 54: $Vm, 55: $Vn, 56: $Vo, 57: $Vp, 58: $Vq, 59: $Vr, 60: $Vs, 61: $Vt, 62: $Vu, 63: $Vv, 64: $Vw, 65: $Vx, 66: $Vy, 67: $Vz, 68: $VA, 69: $VB, 70: $VC, 71: $VD, 72: $VE, 73: $VF, 74: $VG }, { 14: [1, 74] }, o($VH, [2, 13], { 43: 23, 29: 49, 30: 61, 32: 62, 20: 75, 34: $V5, 36: $V6, 37: $V7, 38: $V8, 39: $V9, 40: $Va, 41: $Vb, 44: $Vc, 45: $Vd, 46: $Ve, 47: $Vf, 48: $Vg, 49: $Vh, 50: $Vi, 51: $Vj, 52: $Vk, 53: $Vl, 54: $Vm, 55: $Vn, 56: $Vo, 57: $Vp, 58: $Vq, 59: $Vr, 60: $Vs, 61: $Vt, 62: $Vu, 63: $Vv, 64: $Vw, 65: $Vx, 66: $Vy, 67: $Vz, 68: $VA, 69: $VB, 70: $VC, 71: $VD, 72: $VE, 73: $VF, 74: $VG }), o($VH, [2, 14]), o($VI, [2, 16], { 12: [1, 76] }), o($VH, [2, 36], { 12: [1, 77] }), o($VJ, [2, 19]), o($VJ, [2, 20]), { 25: [1, 78] }, { 27: [1, 79] }, o($VJ, [2, 23]), { 35: 80, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 86, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 87, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 88, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 89, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 90, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 91, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 92, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 93, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 94, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 95, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 96, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 97, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 98, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 99, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 100, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 101, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 102, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 103, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 104, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, o($VO, [2, 59]), { 35: 105, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 106, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 107, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 108, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 109, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 110, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 111, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 112, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 113, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 114, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 115, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 20: 116, 29: 49, 30: 61, 32: 62, 34: $V5, 36: $V6, 37: $V7, 38: $V8, 39: $V9, 40: $Va, 41: $Vb, 43: 23, 44: $Vc, 45: $Vd, 46: $Ve, 47: $Vf, 48: $Vg, 49: $Vh, 50: $Vi, 51: $Vj, 52: $Vk, 53: $Vl, 54: $Vm, 55: $Vn, 56: $Vo, 57: $Vp, 58: $Vq, 59: $Vr, 60: $Vs, 61: $Vt, 62: $Vu, 63: $Vv, 64: $Vw, 65: $Vx, 66: $Vy, 67: $Vz, 68: $VA, 69: $VB, 70: $VC, 71: $VD, 72: $VE, 73: $VF, 74: $VG }, { 12: [1, 118], 33: [1, 117] }, { 35: 119, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 120, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 121, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 122, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 123, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 124, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 125, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 14: [1, 126] }, { 14: [1, 127] }, { 14: [1, 128] }, { 14: [1, 129] }, { 1: [2, 8] }, o($VH, [2, 15]), o($VI, [2, 17], { 21: 22, 19: 130, 22: $V0, 23: $V1, 24: $V2, 26: $V3, 28: $V4 }), o($VH, [2, 37], { 19: 20, 20: 21, 21: 22, 43: 23, 29: 49, 30: 61, 32: 62, 13: 131, 22: $V0, 23: $V1, 24: $V2, 26: $V3, 28: $V4, 34: $V5, 36: $V6, 37: $V7, 38: $V8, 39: $V9, 40: $Va, 41: $Vb, 44: $Vc, 45: $Vd, 46: $Ve, 47: $Vf, 48: $Vg, 49: $Vh, 50: $Vi, 51: $Vj, 52: $Vk, 53: $Vl, 54: $Vm, 55: $Vn, 56: $Vo, 57: $Vp, 58: $Vq, 59: $Vr, 60: $Vs, 61: $Vt, 62: $Vu, 63: $Vv, 64: $Vw, 65: $Vx, 66: $Vy, 67: $Vz, 68: $VA, 69: $VB, 70: $VC, 71: $VD, 72: $VE, 73: $VF, 74: $VG }), o($VJ, [2, 21]), o($VJ, [2, 22]), o($VO, [2, 39]), o($VP, [2, 71], { 75: 81, 35: 132, 76: $VK, 77: $VL, 79: $VM, 80: $VN }), o($VQ, [2, 73]), { 78: [1, 133] }, o($VQ, [2, 75]), o($VQ, [2, 76]), o($VO, [2, 40]), o($VO, [2, 41]), o($VO, [2, 42]), o($VO, [2, 43]), o($VO, [2, 44]), o($VO, [2, 45]), o($VO, [2, 46]), o($VO, [2, 47]), o($VO, [2, 48]), o($VO, [2, 49]), o($VO, [2, 50]), o($VO, [2, 51]), o($VO, [2, 52]), o($VO, [2, 53]), o($VO, [2, 54]), o($VO, [2, 55]), o($VO, [2, 56]), o($VO, [2, 57]), o($VO, [2, 58]), o($VO, [2, 60]), o($VO, [2, 61]), o($VO, [2, 62]), o($VO, [2, 63]), o($VO, [2, 64]), o($VO, [2, 65]), o($VO, [2, 66]), o($VO, [2, 67]), o($VO, [2, 68]), o($VO, [2, 69]), o($VO, [2, 70]), { 31: 134, 42: [1, 135] }, { 12: [1, 136] }, { 33: [1, 137] }, o($VR, [2, 28]), o($VR, [2, 29]), o($VR, [2, 30]), o($VR, [2, 31]), o($VR, [2, 32]), o($VR, [2, 33]), o($VR, [2, 34]), { 1: [2, 9] }, { 1: [2, 10] }, { 1: [2, 11] }, { 1: [2, 12] }, o($VI, [2, 18]), o($VH, [2, 38]), o($VP, [2, 72]), o($VQ, [2, 74]), o($VO, [2, 24]), o($VO, [2, 35]), o($VS, [2, 25]), o($VS, [2, 26], { 12: [1, 138] }), o($VS, [2, 27])],
270
+ defaultActions: { 2: [2, 1], 3: [2, 2], 4: [2, 7], 5: [2, 3], 6: [2, 4], 7: [2, 5], 8: [2, 6], 74: [2, 8], 126: [2, 9], 127: [2, 10], 128: [2, 11], 129: [2, 12] },
271
+ parseError: /* @__PURE__ */ __name(function parseError(str, hash) {
272
+ if (hash.recoverable) {
273
+ this.trace(str);
274
+ } else {
275
+ var error = new Error(str);
276
+ error.hash = hash;
277
+ throw error;
278
+ }
279
+ }, "parseError"),
280
+ parse: /* @__PURE__ */ __name(function parse(input) {
281
+ var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;
282
+ var args = lstack.slice.call(arguments, 1);
283
+ var lexer2 = Object.create(this.lexer);
284
+ var sharedState = { yy: {} };
285
+ for (var k in this.yy) {
286
+ if (Object.prototype.hasOwnProperty.call(this.yy, k)) {
287
+ sharedState.yy[k] = this.yy[k];
288
+ }
289
+ }
290
+ lexer2.setInput(input, sharedState.yy);
291
+ sharedState.yy.lexer = lexer2;
292
+ sharedState.yy.parser = this;
293
+ if (typeof lexer2.yylloc == "undefined") {
294
+ lexer2.yylloc = {};
295
+ }
296
+ var yyloc = lexer2.yylloc;
297
+ lstack.push(yyloc);
298
+ var ranges = lexer2.options && lexer2.options.ranges;
299
+ if (typeof sharedState.yy.parseError === "function") {
300
+ this.parseError = sharedState.yy.parseError;
301
+ } else {
302
+ this.parseError = Object.getPrototypeOf(this).parseError;
303
+ }
304
+ function popStack(n) {
305
+ stack.length = stack.length - 2 * n;
306
+ vstack.length = vstack.length - n;
307
+ lstack.length = lstack.length - n;
308
+ }
309
+ __name(popStack, "popStack");
310
+ function lex() {
311
+ var token;
312
+ token = tstack.pop() || lexer2.lex() || EOF;
313
+ if (typeof token !== "number") {
314
+ if (token instanceof Array) {
315
+ tstack = token;
316
+ token = tstack.pop();
317
+ }
318
+ token = self.symbols_[token] || token;
319
+ }
320
+ return token;
321
+ }
322
+ __name(lex, "lex");
323
+ var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected;
324
+ while (true) {
325
+ state = stack[stack.length - 1];
326
+ if (this.defaultActions[state]) {
327
+ action = this.defaultActions[state];
328
+ } else {
329
+ if (symbol === null || typeof symbol == "undefined") {
330
+ symbol = lex();
331
+ }
332
+ action = table[state] && table[state][symbol];
333
+ }
334
+ if (typeof action === "undefined" || !action.length || !action[0]) {
335
+ var errStr = "";
336
+ expected = [];
337
+ for (p in table[state]) {
338
+ if (this.terminals_[p] && p > TERROR) {
339
+ expected.push("'" + this.terminals_[p] + "'");
340
+ }
341
+ }
342
+ if (lexer2.showPosition) {
343
+ errStr = "Parse error on line " + (yylineno + 1) + `:
344
+ ` + lexer2.showPosition() + `
345
+ Expecting ` + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'";
346
+ } else {
347
+ errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == EOF ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'");
348
+ }
349
+ this.parseError(errStr, {
350
+ text: lexer2.match,
351
+ token: this.terminals_[symbol] || symbol,
352
+ line: lexer2.yylineno,
353
+ loc: yyloc,
354
+ expected
355
+ });
356
+ }
357
+ if (action[0] instanceof Array && action.length > 1) {
358
+ throw new Error("Parse Error: multiple actions possible at state: " + state + ", token: " + symbol);
359
+ }
360
+ switch (action[0]) {
361
+ case 1:
362
+ stack.push(symbol);
363
+ vstack.push(lexer2.yytext);
364
+ lstack.push(lexer2.yylloc);
365
+ stack.push(action[1]);
366
+ symbol = null;
367
+ if (!preErrorSymbol) {
368
+ yyleng = lexer2.yyleng;
369
+ yytext = lexer2.yytext;
370
+ yylineno = lexer2.yylineno;
371
+ yyloc = lexer2.yylloc;
372
+ if (recovering > 0) {
373
+ recovering--;
374
+ }
375
+ } else {
376
+ symbol = preErrorSymbol;
377
+ preErrorSymbol = null;
378
+ }
379
+ break;
380
+ case 2:
381
+ len = this.productions_[action[1]][1];
382
+ yyval.$ = vstack[vstack.length - len];
383
+ yyval._$ = {
384
+ first_line: lstack[lstack.length - (len || 1)].first_line,
385
+ last_line: lstack[lstack.length - 1].last_line,
386
+ first_column: lstack[lstack.length - (len || 1)].first_column,
387
+ last_column: lstack[lstack.length - 1].last_column
388
+ };
389
+ if (ranges) {
390
+ yyval._$.range = [
391
+ lstack[lstack.length - (len || 1)].range[0],
392
+ lstack[lstack.length - 1].range[1]
393
+ ];
394
+ }
395
+ r = this.performAction.apply(yyval, [
396
+ yytext,
397
+ yyleng,
398
+ yylineno,
399
+ sharedState.yy,
400
+ action[1],
401
+ vstack,
402
+ lstack
403
+ ].concat(args));
404
+ if (typeof r !== "undefined") {
405
+ return r;
406
+ }
407
+ if (len) {
408
+ stack = stack.slice(0, -1 * len * 2);
409
+ vstack = vstack.slice(0, -1 * len);
410
+ lstack = lstack.slice(0, -1 * len);
411
+ }
412
+ stack.push(this.productions_[action[1]][0]);
413
+ vstack.push(yyval.$);
414
+ lstack.push(yyval._$);
415
+ newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
416
+ stack.push(newState);
417
+ break;
418
+ case 3:
419
+ return true;
420
+ }
421
+ }
422
+ return true;
423
+ }, "parse")
424
+ };
425
+ var lexer = /* @__PURE__ */ function() {
426
+ var lexer2 = {
427
+ EOF: 1,
428
+ parseError: /* @__PURE__ */ __name(function parseError(str, hash) {
429
+ if (this.yy.parser) {
430
+ this.yy.parser.parseError(str, hash);
431
+ } else {
432
+ throw new Error(str);
433
+ }
434
+ }, "parseError"),
435
+ setInput: /* @__PURE__ */ __name(function(input, yy) {
436
+ this.yy = yy || this.yy || {};
437
+ this._input = input;
438
+ this._more = this._backtrack = this.done = false;
439
+ this.yylineno = this.yyleng = 0;
440
+ this.yytext = this.matched = this.match = "";
441
+ this.conditionStack = ["INITIAL"];
442
+ this.yylloc = {
443
+ first_line: 1,
444
+ first_column: 0,
445
+ last_line: 1,
446
+ last_column: 0
447
+ };
448
+ if (this.options.ranges) {
449
+ this.yylloc.range = [0, 0];
450
+ }
451
+ this.offset = 0;
452
+ return this;
453
+ }, "setInput"),
454
+ input: /* @__PURE__ */ __name(function() {
455
+ var ch = this._input[0];
456
+ this.yytext += ch;
457
+ this.yyleng++;
458
+ this.offset++;
459
+ this.match += ch;
460
+ this.matched += ch;
461
+ var lines = ch.match(/(?:\r\n?|\n).*/g);
462
+ if (lines) {
463
+ this.yylineno++;
464
+ this.yylloc.last_line++;
465
+ } else {
466
+ this.yylloc.last_column++;
467
+ }
468
+ if (this.options.ranges) {
469
+ this.yylloc.range[1]++;
470
+ }
471
+ this._input = this._input.slice(1);
472
+ return ch;
473
+ }, "input"),
474
+ unput: /* @__PURE__ */ __name(function(ch) {
475
+ var len = ch.length;
476
+ var lines = ch.split(/(?:\r\n?|\n)/g);
477
+ this._input = ch + this._input;
478
+ this.yytext = this.yytext.substr(0, this.yytext.length - len);
479
+ this.offset -= len;
480
+ var oldLines = this.match.split(/(?:\r\n?|\n)/g);
481
+ this.match = this.match.substr(0, this.match.length - 1);
482
+ this.matched = this.matched.substr(0, this.matched.length - 1);
483
+ if (lines.length - 1) {
484
+ this.yylineno -= lines.length - 1;
485
+ }
486
+ var r = this.yylloc.range;
487
+ this.yylloc = {
488
+ first_line: this.yylloc.first_line,
489
+ last_line: this.yylineno + 1,
490
+ first_column: this.yylloc.first_column,
491
+ 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
492
+ };
493
+ if (this.options.ranges) {
494
+ this.yylloc.range = [r[0], r[0] + this.yyleng - len];
495
+ }
496
+ this.yyleng = this.yytext.length;
497
+ return this;
498
+ }, "unput"),
499
+ more: /* @__PURE__ */ __name(function() {
500
+ this._more = true;
501
+ return this;
502
+ }, "more"),
503
+ reject: /* @__PURE__ */ __name(function() {
504
+ if (this.options.backtrack_lexer) {
505
+ this._backtrack = true;
506
+ } else {
507
+ 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).
508
+ ` + this.showPosition(), {
509
+ text: "",
510
+ token: null,
511
+ line: this.yylineno
512
+ });
513
+ }
514
+ return this;
515
+ }, "reject"),
516
+ less: /* @__PURE__ */ __name(function(n) {
517
+ this.unput(this.match.slice(n));
518
+ }, "less"),
519
+ pastInput: /* @__PURE__ */ __name(function() {
520
+ var past = this.matched.substr(0, this.matched.length - this.match.length);
521
+ return (past.length > 20 ? "..." : "") + past.substr(-20).replace(/\n/g, "");
522
+ }, "pastInput"),
523
+ upcomingInput: /* @__PURE__ */ __name(function() {
524
+ var next = this.match;
525
+ if (next.length < 20) {
526
+ next += this._input.substr(0, 20 - next.length);
527
+ }
528
+ return (next.substr(0, 20) + (next.length > 20 ? "..." : "")).replace(/\n/g, "");
529
+ }, "upcomingInput"),
530
+ showPosition: /* @__PURE__ */ __name(function() {
531
+ var pre = this.pastInput();
532
+ var c2 = new Array(pre.length + 1).join("-");
533
+ return pre + this.upcomingInput() + `
534
+ ` + c2 + "^";
535
+ }, "showPosition"),
536
+ test_match: /* @__PURE__ */ __name(function(match, indexed_rule) {
537
+ var token, lines, backup;
538
+ if (this.options.backtrack_lexer) {
539
+ backup = {
540
+ yylineno: this.yylineno,
541
+ yylloc: {
542
+ first_line: this.yylloc.first_line,
543
+ last_line: this.last_line,
544
+ first_column: this.yylloc.first_column,
545
+ last_column: this.yylloc.last_column
546
+ },
547
+ yytext: this.yytext,
548
+ match: this.match,
549
+ matches: this.matches,
550
+ matched: this.matched,
551
+ yyleng: this.yyleng,
552
+ offset: this.offset,
553
+ _more: this._more,
554
+ _input: this._input,
555
+ yy: this.yy,
556
+ conditionStack: this.conditionStack.slice(0),
557
+ done: this.done
558
+ };
559
+ if (this.options.ranges) {
560
+ backup.yylloc.range = this.yylloc.range.slice(0);
561
+ }
562
+ }
563
+ lines = match[0].match(/(?:\r\n?|\n).*/g);
564
+ if (lines) {
565
+ this.yylineno += lines.length;
566
+ }
567
+ this.yylloc = {
568
+ first_line: this.yylloc.last_line,
569
+ last_line: this.yylineno + 1,
570
+ first_column: this.yylloc.last_column,
571
+ last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length
572
+ };
573
+ this.yytext += match[0];
574
+ this.match += match[0];
575
+ this.matches = match;
576
+ this.yyleng = this.yytext.length;
577
+ if (this.options.ranges) {
578
+ this.yylloc.range = [this.offset, this.offset += this.yyleng];
579
+ }
580
+ this._more = false;
581
+ this._backtrack = false;
582
+ this._input = this._input.slice(match[0].length);
583
+ this.matched += match[0];
584
+ token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
585
+ if (this.done && this._input) {
586
+ this.done = false;
587
+ }
588
+ if (token) {
589
+ return token;
590
+ } else if (this._backtrack) {
591
+ for (var k in backup) {
592
+ this[k] = backup[k];
593
+ }
594
+ return false;
595
+ }
596
+ return false;
597
+ }, "test_match"),
598
+ next: /* @__PURE__ */ __name(function() {
599
+ if (this.done) {
600
+ return this.EOF;
601
+ }
602
+ if (!this._input) {
603
+ this.done = true;
604
+ }
605
+ var token, match, tempMatch, index;
606
+ if (!this._more) {
607
+ this.yytext = "";
608
+ this.match = "";
609
+ }
610
+ var rules = this._currentRules();
611
+ for (var i = 0;i < rules.length; i++) {
612
+ tempMatch = this._input.match(this.rules[rules[i]]);
613
+ if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
614
+ match = tempMatch;
615
+ index = i;
616
+ if (this.options.backtrack_lexer) {
617
+ token = this.test_match(tempMatch, rules[i]);
618
+ if (token !== false) {
619
+ return token;
620
+ } else if (this._backtrack) {
621
+ match = false;
622
+ continue;
623
+ } else {
624
+ return false;
625
+ }
626
+ } else if (!this.options.flex) {
627
+ break;
628
+ }
629
+ }
630
+ }
631
+ if (match) {
632
+ token = this.test_match(match, rules[index]);
633
+ if (token !== false) {
634
+ return token;
635
+ }
636
+ return false;
637
+ }
638
+ if (this._input === "") {
639
+ return this.EOF;
640
+ } else {
641
+ return this.parseError("Lexical error on line " + (this.yylineno + 1) + `. Unrecognized text.
642
+ ` + this.showPosition(), {
643
+ text: "",
644
+ token: null,
645
+ line: this.yylineno
646
+ });
647
+ }
648
+ }, "next"),
649
+ lex: /* @__PURE__ */ __name(function lex() {
650
+ var r = this.next();
651
+ if (r) {
652
+ return r;
653
+ } else {
654
+ return this.lex();
655
+ }
656
+ }, "lex"),
657
+ begin: /* @__PURE__ */ __name(function begin(condition) {
658
+ this.conditionStack.push(condition);
659
+ }, "begin"),
660
+ popState: /* @__PURE__ */ __name(function popState() {
661
+ var n = this.conditionStack.length - 1;
662
+ if (n > 0) {
663
+ return this.conditionStack.pop();
664
+ } else {
665
+ return this.conditionStack[0];
666
+ }
667
+ }, "popState"),
668
+ _currentRules: /* @__PURE__ */ __name(function _currentRules() {
669
+ if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
670
+ return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
671
+ } else {
672
+ return this.conditions["INITIAL"].rules;
673
+ }
674
+ }, "_currentRules"),
675
+ topState: /* @__PURE__ */ __name(function topState(n) {
676
+ n = this.conditionStack.length - 1 - Math.abs(n || 0);
677
+ if (n >= 0) {
678
+ return this.conditionStack[n];
679
+ } else {
680
+ return "INITIAL";
681
+ }
682
+ }, "topState"),
683
+ pushState: /* @__PURE__ */ __name(function pushState(condition) {
684
+ this.begin(condition);
685
+ }, "pushState"),
686
+ stateStackSize: /* @__PURE__ */ __name(function stateStackSize() {
687
+ return this.conditionStack.length;
688
+ }, "stateStackSize"),
689
+ options: {},
690
+ performAction: /* @__PURE__ */ __name(function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) {
691
+ var YYSTATE = YY_START;
692
+ switch ($avoiding_name_collisions) {
693
+ case 0:
694
+ return 6;
695
+ break;
696
+ case 1:
697
+ return 7;
698
+ break;
699
+ case 2:
700
+ return 8;
701
+ break;
702
+ case 3:
703
+ return 9;
704
+ break;
705
+ case 4:
706
+ return 22;
707
+ break;
708
+ case 5:
709
+ return 23;
710
+ break;
711
+ case 6:
712
+ this.begin("acc_title");
713
+ return 24;
714
+ break;
715
+ case 7:
716
+ this.popState();
717
+ return "acc_title_value";
718
+ break;
719
+ case 8:
720
+ this.begin("acc_descr");
721
+ return 26;
722
+ break;
723
+ case 9:
724
+ this.popState();
725
+ return "acc_descr_value";
726
+ break;
727
+ case 10:
728
+ this.begin("acc_descr_multiline");
729
+ break;
730
+ case 11:
731
+ this.popState();
732
+ break;
733
+ case 12:
734
+ return "acc_descr_multiline_value";
735
+ break;
736
+ case 13:
737
+ break;
738
+ case 14:
739
+ c;
740
+ break;
741
+ case 15:
742
+ return 12;
743
+ break;
744
+ case 16:
745
+ break;
746
+ case 17:
747
+ return 11;
748
+ break;
749
+ case 18:
750
+ return 15;
751
+ break;
752
+ case 19:
753
+ return 16;
754
+ break;
755
+ case 20:
756
+ return 17;
757
+ break;
758
+ case 21:
759
+ return 18;
760
+ break;
761
+ case 22:
762
+ this.begin("person_ext");
763
+ return 45;
764
+ break;
765
+ case 23:
766
+ this.begin("person");
767
+ return 44;
768
+ break;
769
+ case 24:
770
+ this.begin("system_ext_queue");
771
+ return 51;
772
+ break;
773
+ case 25:
774
+ this.begin("system_ext_db");
775
+ return 50;
776
+ break;
777
+ case 26:
778
+ this.begin("system_ext");
779
+ return 49;
780
+ break;
781
+ case 27:
782
+ this.begin("system_queue");
783
+ return 48;
784
+ break;
785
+ case 28:
786
+ this.begin("system_db");
787
+ return 47;
788
+ break;
789
+ case 29:
790
+ this.begin("system");
791
+ return 46;
792
+ break;
793
+ case 30:
794
+ this.begin("boundary");
795
+ return 37;
796
+ break;
797
+ case 31:
798
+ this.begin("enterprise_boundary");
799
+ return 34;
800
+ break;
801
+ case 32:
802
+ this.begin("system_boundary");
803
+ return 36;
804
+ break;
805
+ case 33:
806
+ this.begin("container_ext_queue");
807
+ return 57;
808
+ break;
809
+ case 34:
810
+ this.begin("container_ext_db");
811
+ return 56;
812
+ break;
813
+ case 35:
814
+ this.begin("container_ext");
815
+ return 55;
816
+ break;
817
+ case 36:
818
+ this.begin("container_queue");
819
+ return 54;
820
+ break;
821
+ case 37:
822
+ this.begin("container_db");
823
+ return 53;
824
+ break;
825
+ case 38:
826
+ this.begin("container");
827
+ return 52;
828
+ break;
829
+ case 39:
830
+ this.begin("container_boundary");
831
+ return 38;
832
+ break;
833
+ case 40:
834
+ this.begin("component_ext_queue");
835
+ return 63;
836
+ break;
837
+ case 41:
838
+ this.begin("component_ext_db");
839
+ return 62;
840
+ break;
841
+ case 42:
842
+ this.begin("component_ext");
843
+ return 61;
844
+ break;
845
+ case 43:
846
+ this.begin("component_queue");
847
+ return 60;
848
+ break;
849
+ case 44:
850
+ this.begin("component_db");
851
+ return 59;
852
+ break;
853
+ case 45:
854
+ this.begin("component");
855
+ return 58;
856
+ break;
857
+ case 46:
858
+ this.begin("node");
859
+ return 39;
860
+ break;
861
+ case 47:
862
+ this.begin("node");
863
+ return 39;
864
+ break;
865
+ case 48:
866
+ this.begin("node_l");
867
+ return 40;
868
+ break;
869
+ case 49:
870
+ this.begin("node_r");
871
+ return 41;
872
+ break;
873
+ case 50:
874
+ this.begin("rel");
875
+ return 64;
876
+ break;
877
+ case 51:
878
+ this.begin("birel");
879
+ return 65;
880
+ break;
881
+ case 52:
882
+ this.begin("rel_u");
883
+ return 66;
884
+ break;
885
+ case 53:
886
+ this.begin("rel_u");
887
+ return 66;
888
+ break;
889
+ case 54:
890
+ this.begin("rel_d");
891
+ return 67;
892
+ break;
893
+ case 55:
894
+ this.begin("rel_d");
895
+ return 67;
896
+ break;
897
+ case 56:
898
+ this.begin("rel_l");
899
+ return 68;
900
+ break;
901
+ case 57:
902
+ this.begin("rel_l");
903
+ return 68;
904
+ break;
905
+ case 58:
906
+ this.begin("rel_r");
907
+ return 69;
908
+ break;
909
+ case 59:
910
+ this.begin("rel_r");
911
+ return 69;
912
+ break;
913
+ case 60:
914
+ this.begin("rel_b");
915
+ return 70;
916
+ break;
917
+ case 61:
918
+ this.begin("rel_index");
919
+ return 71;
920
+ break;
921
+ case 62:
922
+ this.begin("update_el_style");
923
+ return 72;
924
+ break;
925
+ case 63:
926
+ this.begin("update_rel_style");
927
+ return 73;
928
+ break;
929
+ case 64:
930
+ this.begin("update_layout_config");
931
+ return 74;
932
+ break;
933
+ case 65:
934
+ return "EOF_IN_STRUCT";
935
+ break;
936
+ case 66:
937
+ this.begin("attribute");
938
+ return "ATTRIBUTE_EMPTY";
939
+ break;
940
+ case 67:
941
+ this.begin("attribute");
942
+ break;
943
+ case 68:
944
+ this.popState();
945
+ this.popState();
946
+ break;
947
+ case 69:
948
+ return 80;
949
+ break;
950
+ case 70:
951
+ break;
952
+ case 71:
953
+ return 80;
954
+ break;
955
+ case 72:
956
+ this.begin("string");
957
+ break;
958
+ case 73:
959
+ this.popState();
960
+ break;
961
+ case 74:
962
+ return "STR";
963
+ break;
964
+ case 75:
965
+ this.begin("string_kv");
966
+ break;
967
+ case 76:
968
+ this.begin("string_kv_key");
969
+ return "STR_KEY";
970
+ break;
971
+ case 77:
972
+ this.popState();
973
+ this.begin("string_kv_value");
974
+ break;
975
+ case 78:
976
+ return "STR_VALUE";
977
+ break;
978
+ case 79:
979
+ this.popState();
980
+ this.popState();
981
+ break;
982
+ case 80:
983
+ return "STR";
984
+ break;
985
+ case 81:
986
+ return "LBRACE";
987
+ break;
988
+ case 82:
989
+ return "RBRACE";
990
+ break;
991
+ case 83:
992
+ return "SPACE";
993
+ break;
994
+ case 84:
995
+ return "EOL";
996
+ break;
997
+ case 85:
998
+ return 14;
999
+ break;
1000
+ }
1001
+ }, "anonymous"),
1002
+ rules: [/^(?:.*direction\s+TB[^\n]*)/, /^(?:.*direction\s+BT[^\n]*)/, /^(?:.*direction\s+RL[^\n]*)/, /^(?:.*direction\s+LR[^\n]*)/, /^(?:title\s[^#\n;]+)/, /^(?:accDescription\s[^#\n;]+)/, /^(?:accTitle\s*:\s*)/, /^(?:(?!\n||)*[^\n]*)/, /^(?:accDescr\s*:\s*)/, /^(?:(?!\n||)*[^\n]*)/, /^(?:accDescr\s*\{\s*)/, /^(?:[\}])/, /^(?:[^\}]*)/, /^(?:%%(?!\{)*[^\n]*(\r?\n?)+)/, /^(?:%%[^\n]*(\r?\n)*)/, /^(?:\s*(\r?\n)+)/, /^(?:\s+)/, /^(?:C4Context\b)/, /^(?:C4Container\b)/, /^(?:C4Component\b)/, /^(?:C4Dynamic\b)/, /^(?:C4Deployment\b)/, /^(?:Person_Ext\b)/, /^(?:Person\b)/, /^(?:SystemQueue_Ext\b)/, /^(?:SystemDb_Ext\b)/, /^(?:System_Ext\b)/, /^(?:SystemQueue\b)/, /^(?:SystemDb\b)/, /^(?:System\b)/, /^(?:Boundary\b)/, /^(?:Enterprise_Boundary\b)/, /^(?:System_Boundary\b)/, /^(?:ContainerQueue_Ext\b)/, /^(?:ContainerDb_Ext\b)/, /^(?:Container_Ext\b)/, /^(?:ContainerQueue\b)/, /^(?:ContainerDb\b)/, /^(?:Container\b)/, /^(?:Container_Boundary\b)/, /^(?:ComponentQueue_Ext\b)/, /^(?:ComponentDb_Ext\b)/, /^(?:Component_Ext\b)/, /^(?:ComponentQueue\b)/, /^(?:ComponentDb\b)/, /^(?:Component\b)/, /^(?:Deployment_Node\b)/, /^(?:Node\b)/, /^(?:Node_L\b)/, /^(?:Node_R\b)/, /^(?:Rel\b)/, /^(?:BiRel\b)/, /^(?:Rel_Up\b)/, /^(?:Rel_U\b)/, /^(?:Rel_Down\b)/, /^(?:Rel_D\b)/, /^(?:Rel_Left\b)/, /^(?:Rel_L\b)/, /^(?:Rel_Right\b)/, /^(?:Rel_R\b)/, /^(?:Rel_Back\b)/, /^(?:RelIndex\b)/, /^(?:UpdateElementStyle\b)/, /^(?:UpdateRelStyle\b)/, /^(?:UpdateLayoutConfig\b)/, /^(?:$)/, /^(?:[(][ ]*[,])/, /^(?:[(])/, /^(?:[)])/, /^(?:,,)/, /^(?:,)/, /^(?:[ ]*["]["])/, /^(?:[ ]*["])/, /^(?:["])/, /^(?:[^"]*)/, /^(?:[ ]*[\$])/, /^(?:[^=]*)/, /^(?:[=][ ]*["])/, /^(?:[^"]+)/, /^(?:["])/, /^(?:[^,]+)/, /^(?:\{)/, /^(?:\})/, /^(?:[\s]+)/, /^(?:[\n\r]+)/, /^(?:$)/],
1003
+ conditions: { acc_descr_multiline: { rules: [11, 12], inclusive: false }, acc_descr: { rules: [9], inclusive: false }, acc_title: { rules: [7], inclusive: false }, string_kv_value: { rules: [78, 79], inclusive: false }, string_kv_key: { rules: [77], inclusive: false }, string_kv: { rules: [76], inclusive: false }, string: { rules: [73, 74], inclusive: false }, attribute: { rules: [68, 69, 70, 71, 72, 75, 80], inclusive: false }, update_layout_config: { rules: [65, 66, 67, 68], inclusive: false }, update_rel_style: { rules: [65, 66, 67, 68], inclusive: false }, update_el_style: { rules: [65, 66, 67, 68], inclusive: false }, rel_b: { rules: [65, 66, 67, 68], inclusive: false }, rel_r: { rules: [65, 66, 67, 68], inclusive: false }, rel_l: { rules: [65, 66, 67, 68], inclusive: false }, rel_d: { rules: [65, 66, 67, 68], inclusive: false }, rel_u: { rules: [65, 66, 67, 68], inclusive: false }, rel_bi: { rules: [], inclusive: false }, rel: { rules: [65, 66, 67, 68], inclusive: false }, node_r: { rules: [65, 66, 67, 68], inclusive: false }, node_l: { rules: [65, 66, 67, 68], inclusive: false }, node: { rules: [65, 66, 67, 68], inclusive: false }, index: { rules: [], inclusive: false }, rel_index: { rules: [65, 66, 67, 68], inclusive: false }, component_ext_queue: { rules: [65, 66, 67, 68], inclusive: false }, component_ext_db: { rules: [65, 66, 67, 68], inclusive: false }, component_ext: { rules: [65, 66, 67, 68], inclusive: false }, component_queue: { rules: [65, 66, 67, 68], inclusive: false }, component_db: { rules: [65, 66, 67, 68], inclusive: false }, component: { rules: [65, 66, 67, 68], inclusive: false }, container_boundary: { rules: [65, 66, 67, 68], inclusive: false }, container_ext_queue: { rules: [65, 66, 67, 68], inclusive: false }, container_ext_db: { rules: [65, 66, 67, 68], inclusive: false }, container_ext: { rules: [65, 66, 67, 68], inclusive: false }, container_queue: { rules: [65, 66, 67, 68], inclusive: false }, container_db: { rules: [65, 66, 67, 68], inclusive: false }, container: { rules: [65, 66, 67, 68], inclusive: false }, birel: { rules: [65, 66, 67, 68], inclusive: false }, system_boundary: { rules: [65, 66, 67, 68], inclusive: false }, enterprise_boundary: { rules: [65, 66, 67, 68], inclusive: false }, boundary: { rules: [65, 66, 67, 68], inclusive: false }, system_ext_queue: { rules: [65, 66, 67, 68], inclusive: false }, system_ext_db: { rules: [65, 66, 67, 68], inclusive: false }, system_ext: { rules: [65, 66, 67, 68], inclusive: false }, system_queue: { rules: [65, 66, 67, 68], inclusive: false }, system_db: { rules: [65, 66, 67, 68], inclusive: false }, system: { rules: [65, 66, 67, 68], inclusive: false }, person_ext: { rules: [65, 66, 67, 68], inclusive: false }, person: { rules: [65, 66, 67, 68], inclusive: false }, INITIAL: { rules: [0, 1, 2, 3, 4, 5, 6, 8, 10, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 81, 82, 83, 84, 85], inclusive: true } }
1004
+ };
1005
+ return lexer2;
1006
+ }();
1007
+ parser2.lexer = lexer;
1008
+ function Parser() {
1009
+ this.yy = {};
1010
+ }
1011
+ __name(Parser, "Parser");
1012
+ Parser.prototype = parser2;
1013
+ parser2.Parser = Parser;
1014
+ return new Parser;
1015
+ }();
1016
+ parser.parser = parser;
1017
+ var c4Diagram_default = parser;
1018
+ var c4ShapeArray = [];
1019
+ var boundaryParseStack = [""];
1020
+ var currentBoundaryParse = "global";
1021
+ var parentBoundaryParse = "";
1022
+ var boundaries = [
1023
+ {
1024
+ alias: "global",
1025
+ label: { text: "global" },
1026
+ type: { text: "global" },
1027
+ tags: null,
1028
+ link: null,
1029
+ parentBoundary: ""
1030
+ }
1031
+ ];
1032
+ var rels = [];
1033
+ var title = "";
1034
+ var wrapEnabled = false;
1035
+ var c4ShapeInRow = 4;
1036
+ var c4BoundaryInRow = 2;
1037
+ var c4Type;
1038
+ var getC4Type = /* @__PURE__ */ __name(function() {
1039
+ return c4Type;
1040
+ }, "getC4Type");
1041
+ var setC4Type = /* @__PURE__ */ __name(function(c4TypeParam) {
1042
+ let sanitizedText = sanitizeText(c4TypeParam, getConfig2());
1043
+ c4Type = sanitizedText;
1044
+ }, "setC4Type");
1045
+ var addRel = /* @__PURE__ */ __name(function(type, from, to, label, techn, descr, sprite, tags, link) {
1046
+ if (type === undefined || type === null || from === undefined || from === null || to === undefined || to === null || label === undefined || label === null) {
1047
+ return;
1048
+ }
1049
+ let rel = {};
1050
+ const old = rels.find((rel2) => rel2.from === from && rel2.to === to);
1051
+ if (old) {
1052
+ rel = old;
1053
+ } else {
1054
+ rels.push(rel);
1055
+ }
1056
+ rel.type = type;
1057
+ rel.from = from;
1058
+ rel.to = to;
1059
+ rel.label = { text: label };
1060
+ if (techn === undefined || techn === null) {
1061
+ rel.techn = { text: "" };
1062
+ } else {
1063
+ if (typeof techn === "object") {
1064
+ let [key, value] = Object.entries(techn)[0];
1065
+ rel[key] = { text: value };
1066
+ } else {
1067
+ rel.techn = { text: techn };
1068
+ }
1069
+ }
1070
+ if (descr === undefined || descr === null) {
1071
+ rel.descr = { text: "" };
1072
+ } else {
1073
+ if (typeof descr === "object") {
1074
+ let [key, value] = Object.entries(descr)[0];
1075
+ rel[key] = { text: value };
1076
+ } else {
1077
+ rel.descr = { text: descr };
1078
+ }
1079
+ }
1080
+ if (typeof sprite === "object") {
1081
+ let [key, value] = Object.entries(sprite)[0];
1082
+ rel[key] = value;
1083
+ } else {
1084
+ rel.sprite = sprite;
1085
+ }
1086
+ if (typeof tags === "object") {
1087
+ let [key, value] = Object.entries(tags)[0];
1088
+ rel[key] = value;
1089
+ } else {
1090
+ rel.tags = tags;
1091
+ }
1092
+ if (typeof link === "object") {
1093
+ let [key, value] = Object.entries(link)[0];
1094
+ rel[key] = value;
1095
+ } else {
1096
+ rel.link = link;
1097
+ }
1098
+ rel.wrap = autoWrap();
1099
+ }, "addRel");
1100
+ var addPersonOrSystem = /* @__PURE__ */ __name(function(typeC4Shape, alias, label, descr, sprite, tags, link) {
1101
+ if (alias === null || label === null) {
1102
+ return;
1103
+ }
1104
+ let personOrSystem = {};
1105
+ const old = c4ShapeArray.find((personOrSystem2) => personOrSystem2.alias === alias);
1106
+ if (old && alias === old.alias) {
1107
+ personOrSystem = old;
1108
+ } else {
1109
+ personOrSystem.alias = alias;
1110
+ c4ShapeArray.push(personOrSystem);
1111
+ }
1112
+ if (label === undefined || label === null) {
1113
+ personOrSystem.label = { text: "" };
1114
+ } else {
1115
+ personOrSystem.label = { text: label };
1116
+ }
1117
+ if (descr === undefined || descr === null) {
1118
+ personOrSystem.descr = { text: "" };
1119
+ } else {
1120
+ if (typeof descr === "object") {
1121
+ let [key, value] = Object.entries(descr)[0];
1122
+ personOrSystem[key] = { text: value };
1123
+ } else {
1124
+ personOrSystem.descr = { text: descr };
1125
+ }
1126
+ }
1127
+ if (typeof sprite === "object") {
1128
+ let [key, value] = Object.entries(sprite)[0];
1129
+ personOrSystem[key] = value;
1130
+ } else {
1131
+ personOrSystem.sprite = sprite;
1132
+ }
1133
+ if (typeof tags === "object") {
1134
+ let [key, value] = Object.entries(tags)[0];
1135
+ personOrSystem[key] = value;
1136
+ } else {
1137
+ personOrSystem.tags = tags;
1138
+ }
1139
+ if (typeof link === "object") {
1140
+ let [key, value] = Object.entries(link)[0];
1141
+ personOrSystem[key] = value;
1142
+ } else {
1143
+ personOrSystem.link = link;
1144
+ }
1145
+ personOrSystem.typeC4Shape = { text: typeC4Shape };
1146
+ personOrSystem.parentBoundary = currentBoundaryParse;
1147
+ personOrSystem.wrap = autoWrap();
1148
+ }, "addPersonOrSystem");
1149
+ var addContainer = /* @__PURE__ */ __name(function(typeC4Shape, alias, label, techn, descr, sprite, tags, link) {
1150
+ if (alias === null || label === null) {
1151
+ return;
1152
+ }
1153
+ let container = {};
1154
+ const old = c4ShapeArray.find((container2) => container2.alias === alias);
1155
+ if (old && alias === old.alias) {
1156
+ container = old;
1157
+ } else {
1158
+ container.alias = alias;
1159
+ c4ShapeArray.push(container);
1160
+ }
1161
+ if (label === undefined || label === null) {
1162
+ container.label = { text: "" };
1163
+ } else {
1164
+ container.label = { text: label };
1165
+ }
1166
+ if (techn === undefined || techn === null) {
1167
+ container.techn = { text: "" };
1168
+ } else {
1169
+ if (typeof techn === "object") {
1170
+ let [key, value] = Object.entries(techn)[0];
1171
+ container[key] = { text: value };
1172
+ } else {
1173
+ container.techn = { text: techn };
1174
+ }
1175
+ }
1176
+ if (descr === undefined || descr === null) {
1177
+ container.descr = { text: "" };
1178
+ } else {
1179
+ if (typeof descr === "object") {
1180
+ let [key, value] = Object.entries(descr)[0];
1181
+ container[key] = { text: value };
1182
+ } else {
1183
+ container.descr = { text: descr };
1184
+ }
1185
+ }
1186
+ if (typeof sprite === "object") {
1187
+ let [key, value] = Object.entries(sprite)[0];
1188
+ container[key] = value;
1189
+ } else {
1190
+ container.sprite = sprite;
1191
+ }
1192
+ if (typeof tags === "object") {
1193
+ let [key, value] = Object.entries(tags)[0];
1194
+ container[key] = value;
1195
+ } else {
1196
+ container.tags = tags;
1197
+ }
1198
+ if (typeof link === "object") {
1199
+ let [key, value] = Object.entries(link)[0];
1200
+ container[key] = value;
1201
+ } else {
1202
+ container.link = link;
1203
+ }
1204
+ container.wrap = autoWrap();
1205
+ container.typeC4Shape = { text: typeC4Shape };
1206
+ container.parentBoundary = currentBoundaryParse;
1207
+ }, "addContainer");
1208
+ var addComponent = /* @__PURE__ */ __name(function(typeC4Shape, alias, label, techn, descr, sprite, tags, link) {
1209
+ if (alias === null || label === null) {
1210
+ return;
1211
+ }
1212
+ let component = {};
1213
+ const old = c4ShapeArray.find((component2) => component2.alias === alias);
1214
+ if (old && alias === old.alias) {
1215
+ component = old;
1216
+ } else {
1217
+ component.alias = alias;
1218
+ c4ShapeArray.push(component);
1219
+ }
1220
+ if (label === undefined || label === null) {
1221
+ component.label = { text: "" };
1222
+ } else {
1223
+ component.label = { text: label };
1224
+ }
1225
+ if (techn === undefined || techn === null) {
1226
+ component.techn = { text: "" };
1227
+ } else {
1228
+ if (typeof techn === "object") {
1229
+ let [key, value] = Object.entries(techn)[0];
1230
+ component[key] = { text: value };
1231
+ } else {
1232
+ component.techn = { text: techn };
1233
+ }
1234
+ }
1235
+ if (descr === undefined || descr === null) {
1236
+ component.descr = { text: "" };
1237
+ } else {
1238
+ if (typeof descr === "object") {
1239
+ let [key, value] = Object.entries(descr)[0];
1240
+ component[key] = { text: value };
1241
+ } else {
1242
+ component.descr = { text: descr };
1243
+ }
1244
+ }
1245
+ if (typeof sprite === "object") {
1246
+ let [key, value] = Object.entries(sprite)[0];
1247
+ component[key] = value;
1248
+ } else {
1249
+ component.sprite = sprite;
1250
+ }
1251
+ if (typeof tags === "object") {
1252
+ let [key, value] = Object.entries(tags)[0];
1253
+ component[key] = value;
1254
+ } else {
1255
+ component.tags = tags;
1256
+ }
1257
+ if (typeof link === "object") {
1258
+ let [key, value] = Object.entries(link)[0];
1259
+ component[key] = value;
1260
+ } else {
1261
+ component.link = link;
1262
+ }
1263
+ component.wrap = autoWrap();
1264
+ component.typeC4Shape = { text: typeC4Shape };
1265
+ component.parentBoundary = currentBoundaryParse;
1266
+ }, "addComponent");
1267
+ var addPersonOrSystemBoundary = /* @__PURE__ */ __name(function(alias, label, type, tags, link) {
1268
+ if (alias === null || label === null) {
1269
+ return;
1270
+ }
1271
+ let boundary = {};
1272
+ const old = boundaries.find((boundary2) => boundary2.alias === alias);
1273
+ if (old && alias === old.alias) {
1274
+ boundary = old;
1275
+ } else {
1276
+ boundary.alias = alias;
1277
+ boundaries.push(boundary);
1278
+ }
1279
+ if (label === undefined || label === null) {
1280
+ boundary.label = { text: "" };
1281
+ } else {
1282
+ boundary.label = { text: label };
1283
+ }
1284
+ if (type === undefined || type === null) {
1285
+ boundary.type = { text: "system" };
1286
+ } else {
1287
+ if (typeof type === "object") {
1288
+ let [key, value] = Object.entries(type)[0];
1289
+ boundary[key] = { text: value };
1290
+ } else {
1291
+ boundary.type = { text: type };
1292
+ }
1293
+ }
1294
+ if (typeof tags === "object") {
1295
+ let [key, value] = Object.entries(tags)[0];
1296
+ boundary[key] = value;
1297
+ } else {
1298
+ boundary.tags = tags;
1299
+ }
1300
+ if (typeof link === "object") {
1301
+ let [key, value] = Object.entries(link)[0];
1302
+ boundary[key] = value;
1303
+ } else {
1304
+ boundary.link = link;
1305
+ }
1306
+ boundary.parentBoundary = currentBoundaryParse;
1307
+ boundary.wrap = autoWrap();
1308
+ parentBoundaryParse = currentBoundaryParse;
1309
+ currentBoundaryParse = alias;
1310
+ boundaryParseStack.push(parentBoundaryParse);
1311
+ }, "addPersonOrSystemBoundary");
1312
+ var addContainerBoundary = /* @__PURE__ */ __name(function(alias, label, type, tags, link) {
1313
+ if (alias === null || label === null) {
1314
+ return;
1315
+ }
1316
+ let boundary = {};
1317
+ const old = boundaries.find((boundary2) => boundary2.alias === alias);
1318
+ if (old && alias === old.alias) {
1319
+ boundary = old;
1320
+ } else {
1321
+ boundary.alias = alias;
1322
+ boundaries.push(boundary);
1323
+ }
1324
+ if (label === undefined || label === null) {
1325
+ boundary.label = { text: "" };
1326
+ } else {
1327
+ boundary.label = { text: label };
1328
+ }
1329
+ if (type === undefined || type === null) {
1330
+ boundary.type = { text: "container" };
1331
+ } else {
1332
+ if (typeof type === "object") {
1333
+ let [key, value] = Object.entries(type)[0];
1334
+ boundary[key] = { text: value };
1335
+ } else {
1336
+ boundary.type = { text: type };
1337
+ }
1338
+ }
1339
+ if (typeof tags === "object") {
1340
+ let [key, value] = Object.entries(tags)[0];
1341
+ boundary[key] = value;
1342
+ } else {
1343
+ boundary.tags = tags;
1344
+ }
1345
+ if (typeof link === "object") {
1346
+ let [key, value] = Object.entries(link)[0];
1347
+ boundary[key] = value;
1348
+ } else {
1349
+ boundary.link = link;
1350
+ }
1351
+ boundary.parentBoundary = currentBoundaryParse;
1352
+ boundary.wrap = autoWrap();
1353
+ parentBoundaryParse = currentBoundaryParse;
1354
+ currentBoundaryParse = alias;
1355
+ boundaryParseStack.push(parentBoundaryParse);
1356
+ }, "addContainerBoundary");
1357
+ var addDeploymentNode = /* @__PURE__ */ __name(function(nodeType, alias, label, type, descr, sprite, tags, link) {
1358
+ if (alias === null || label === null) {
1359
+ return;
1360
+ }
1361
+ let boundary = {};
1362
+ const old = boundaries.find((boundary2) => boundary2.alias === alias);
1363
+ if (old && alias === old.alias) {
1364
+ boundary = old;
1365
+ } else {
1366
+ boundary.alias = alias;
1367
+ boundaries.push(boundary);
1368
+ }
1369
+ if (label === undefined || label === null) {
1370
+ boundary.label = { text: "" };
1371
+ } else {
1372
+ boundary.label = { text: label };
1373
+ }
1374
+ if (type === undefined || type === null) {
1375
+ boundary.type = { text: "node" };
1376
+ } else {
1377
+ if (typeof type === "object") {
1378
+ let [key, value] = Object.entries(type)[0];
1379
+ boundary[key] = { text: value };
1380
+ } else {
1381
+ boundary.type = { text: type };
1382
+ }
1383
+ }
1384
+ if (descr === undefined || descr === null) {
1385
+ boundary.descr = { text: "" };
1386
+ } else {
1387
+ if (typeof descr === "object") {
1388
+ let [key, value] = Object.entries(descr)[0];
1389
+ boundary[key] = { text: value };
1390
+ } else {
1391
+ boundary.descr = { text: descr };
1392
+ }
1393
+ }
1394
+ if (typeof tags === "object") {
1395
+ let [key, value] = Object.entries(tags)[0];
1396
+ boundary[key] = value;
1397
+ } else {
1398
+ boundary.tags = tags;
1399
+ }
1400
+ if (typeof link === "object") {
1401
+ let [key, value] = Object.entries(link)[0];
1402
+ boundary[key] = value;
1403
+ } else {
1404
+ boundary.link = link;
1405
+ }
1406
+ boundary.nodeType = nodeType;
1407
+ boundary.parentBoundary = currentBoundaryParse;
1408
+ boundary.wrap = autoWrap();
1409
+ parentBoundaryParse = currentBoundaryParse;
1410
+ currentBoundaryParse = alias;
1411
+ boundaryParseStack.push(parentBoundaryParse);
1412
+ }, "addDeploymentNode");
1413
+ var popBoundaryParseStack = /* @__PURE__ */ __name(function() {
1414
+ currentBoundaryParse = parentBoundaryParse;
1415
+ boundaryParseStack.pop();
1416
+ parentBoundaryParse = boundaryParseStack.pop();
1417
+ boundaryParseStack.push(parentBoundaryParse);
1418
+ }, "popBoundaryParseStack");
1419
+ var updateElStyle = /* @__PURE__ */ __name(function(typeC4Shape, elementName, bgColor, fontColor, borderColor, shadowing, shape, sprite, techn, legendText, legendSprite) {
1420
+ let old = c4ShapeArray.find((element) => element.alias === elementName);
1421
+ if (old === undefined) {
1422
+ old = boundaries.find((element) => element.alias === elementName);
1423
+ if (old === undefined) {
1424
+ return;
1425
+ }
1426
+ }
1427
+ if (bgColor !== undefined && bgColor !== null) {
1428
+ if (typeof bgColor === "object") {
1429
+ let [key, value] = Object.entries(bgColor)[0];
1430
+ old[key] = value;
1431
+ } else {
1432
+ old.bgColor = bgColor;
1433
+ }
1434
+ }
1435
+ if (fontColor !== undefined && fontColor !== null) {
1436
+ if (typeof fontColor === "object") {
1437
+ let [key, value] = Object.entries(fontColor)[0];
1438
+ old[key] = value;
1439
+ } else {
1440
+ old.fontColor = fontColor;
1441
+ }
1442
+ }
1443
+ if (borderColor !== undefined && borderColor !== null) {
1444
+ if (typeof borderColor === "object") {
1445
+ let [key, value] = Object.entries(borderColor)[0];
1446
+ old[key] = value;
1447
+ } else {
1448
+ old.borderColor = borderColor;
1449
+ }
1450
+ }
1451
+ if (shadowing !== undefined && shadowing !== null) {
1452
+ if (typeof shadowing === "object") {
1453
+ let [key, value] = Object.entries(shadowing)[0];
1454
+ old[key] = value;
1455
+ } else {
1456
+ old.shadowing = shadowing;
1457
+ }
1458
+ }
1459
+ if (shape !== undefined && shape !== null) {
1460
+ if (typeof shape === "object") {
1461
+ let [key, value] = Object.entries(shape)[0];
1462
+ old[key] = value;
1463
+ } else {
1464
+ old.shape = shape;
1465
+ }
1466
+ }
1467
+ if (sprite !== undefined && sprite !== null) {
1468
+ if (typeof sprite === "object") {
1469
+ let [key, value] = Object.entries(sprite)[0];
1470
+ old[key] = value;
1471
+ } else {
1472
+ old.sprite = sprite;
1473
+ }
1474
+ }
1475
+ if (techn !== undefined && techn !== null) {
1476
+ if (typeof techn === "object") {
1477
+ let [key, value] = Object.entries(techn)[0];
1478
+ old[key] = value;
1479
+ } else {
1480
+ old.techn = techn;
1481
+ }
1482
+ }
1483
+ if (legendText !== undefined && legendText !== null) {
1484
+ if (typeof legendText === "object") {
1485
+ let [key, value] = Object.entries(legendText)[0];
1486
+ old[key] = value;
1487
+ } else {
1488
+ old.legendText = legendText;
1489
+ }
1490
+ }
1491
+ if (legendSprite !== undefined && legendSprite !== null) {
1492
+ if (typeof legendSprite === "object") {
1493
+ let [key, value] = Object.entries(legendSprite)[0];
1494
+ old[key] = value;
1495
+ } else {
1496
+ old.legendSprite = legendSprite;
1497
+ }
1498
+ }
1499
+ }, "updateElStyle");
1500
+ var updateRelStyle = /* @__PURE__ */ __name(function(typeC4Shape, from, to, textColor, lineColor, offsetX, offsetY) {
1501
+ const old = rels.find((rel) => rel.from === from && rel.to === to);
1502
+ if (old === undefined) {
1503
+ return;
1504
+ }
1505
+ if (textColor !== undefined && textColor !== null) {
1506
+ if (typeof textColor === "object") {
1507
+ let [key, value] = Object.entries(textColor)[0];
1508
+ old[key] = value;
1509
+ } else {
1510
+ old.textColor = textColor;
1511
+ }
1512
+ }
1513
+ if (lineColor !== undefined && lineColor !== null) {
1514
+ if (typeof lineColor === "object") {
1515
+ let [key, value] = Object.entries(lineColor)[0];
1516
+ old[key] = value;
1517
+ } else {
1518
+ old.lineColor = lineColor;
1519
+ }
1520
+ }
1521
+ if (offsetX !== undefined && offsetX !== null) {
1522
+ if (typeof offsetX === "object") {
1523
+ let [key, value] = Object.entries(offsetX)[0];
1524
+ old[key] = parseInt(value);
1525
+ } else {
1526
+ old.offsetX = parseInt(offsetX);
1527
+ }
1528
+ }
1529
+ if (offsetY !== undefined && offsetY !== null) {
1530
+ if (typeof offsetY === "object") {
1531
+ let [key, value] = Object.entries(offsetY)[0];
1532
+ old[key] = parseInt(value);
1533
+ } else {
1534
+ old.offsetY = parseInt(offsetY);
1535
+ }
1536
+ }
1537
+ }, "updateRelStyle");
1538
+ var updateLayoutConfig = /* @__PURE__ */ __name(function(typeC4Shape, c4ShapeInRowParam, c4BoundaryInRowParam) {
1539
+ let c4ShapeInRowValue = c4ShapeInRow;
1540
+ let c4BoundaryInRowValue = c4BoundaryInRow;
1541
+ if (typeof c4ShapeInRowParam === "object") {
1542
+ const value = Object.values(c4ShapeInRowParam)[0];
1543
+ c4ShapeInRowValue = parseInt(value);
1544
+ } else {
1545
+ c4ShapeInRowValue = parseInt(c4ShapeInRowParam);
1546
+ }
1547
+ if (typeof c4BoundaryInRowParam === "object") {
1548
+ const value = Object.values(c4BoundaryInRowParam)[0];
1549
+ c4BoundaryInRowValue = parseInt(value);
1550
+ } else {
1551
+ c4BoundaryInRowValue = parseInt(c4BoundaryInRowParam);
1552
+ }
1553
+ if (c4ShapeInRowValue >= 1) {
1554
+ c4ShapeInRow = c4ShapeInRowValue;
1555
+ }
1556
+ if (c4BoundaryInRowValue >= 1) {
1557
+ c4BoundaryInRow = c4BoundaryInRowValue;
1558
+ }
1559
+ }, "updateLayoutConfig");
1560
+ var getC4ShapeInRow = /* @__PURE__ */ __name(function() {
1561
+ return c4ShapeInRow;
1562
+ }, "getC4ShapeInRow");
1563
+ var getC4BoundaryInRow = /* @__PURE__ */ __name(function() {
1564
+ return c4BoundaryInRow;
1565
+ }, "getC4BoundaryInRow");
1566
+ var getCurrentBoundaryParse = /* @__PURE__ */ __name(function() {
1567
+ return currentBoundaryParse;
1568
+ }, "getCurrentBoundaryParse");
1569
+ var getParentBoundaryParse = /* @__PURE__ */ __name(function() {
1570
+ return parentBoundaryParse;
1571
+ }, "getParentBoundaryParse");
1572
+ var getC4ShapeArray = /* @__PURE__ */ __name(function(parentBoundary) {
1573
+ if (parentBoundary === undefined || parentBoundary === null) {
1574
+ return c4ShapeArray;
1575
+ } else {
1576
+ return c4ShapeArray.filter((personOrSystem) => {
1577
+ return personOrSystem.parentBoundary === parentBoundary;
1578
+ });
1579
+ }
1580
+ }, "getC4ShapeArray");
1581
+ var getC4Shape = /* @__PURE__ */ __name(function(alias) {
1582
+ return c4ShapeArray.find((personOrSystem) => personOrSystem.alias === alias);
1583
+ }, "getC4Shape");
1584
+ var getC4ShapeKeys = /* @__PURE__ */ __name(function(parentBoundary) {
1585
+ return Object.keys(getC4ShapeArray(parentBoundary));
1586
+ }, "getC4ShapeKeys");
1587
+ var getBoundaries = /* @__PURE__ */ __name(function(parentBoundary) {
1588
+ if (parentBoundary === undefined || parentBoundary === null) {
1589
+ return boundaries;
1590
+ } else {
1591
+ return boundaries.filter((boundary) => boundary.parentBoundary === parentBoundary);
1592
+ }
1593
+ }, "getBoundaries");
1594
+ var getBoundarys = getBoundaries;
1595
+ var getRels = /* @__PURE__ */ __name(function() {
1596
+ return rels;
1597
+ }, "getRels");
1598
+ var getTitle = /* @__PURE__ */ __name(function() {
1599
+ return title;
1600
+ }, "getTitle");
1601
+ var setWrap = /* @__PURE__ */ __name(function(wrapSetting) {
1602
+ wrapEnabled = wrapSetting;
1603
+ }, "setWrap");
1604
+ var autoWrap = /* @__PURE__ */ __name(function() {
1605
+ return wrapEnabled;
1606
+ }, "autoWrap");
1607
+ var clear = /* @__PURE__ */ __name(function() {
1608
+ c4ShapeArray = [];
1609
+ boundaries = [
1610
+ {
1611
+ alias: "global",
1612
+ label: { text: "global" },
1613
+ type: { text: "global" },
1614
+ tags: null,
1615
+ link: null,
1616
+ parentBoundary: ""
1617
+ }
1618
+ ];
1619
+ parentBoundaryParse = "";
1620
+ currentBoundaryParse = "global";
1621
+ boundaryParseStack = [""];
1622
+ rels = [];
1623
+ boundaryParseStack = [""];
1624
+ title = "";
1625
+ wrapEnabled = false;
1626
+ c4ShapeInRow = 4;
1627
+ c4BoundaryInRow = 2;
1628
+ }, "clear");
1629
+ var LINETYPE = {
1630
+ SOLID: 0,
1631
+ DOTTED: 1,
1632
+ NOTE: 2,
1633
+ SOLID_CROSS: 3,
1634
+ DOTTED_CROSS: 4,
1635
+ SOLID_OPEN: 5,
1636
+ DOTTED_OPEN: 6,
1637
+ LOOP_START: 10,
1638
+ LOOP_END: 11,
1639
+ ALT_START: 12,
1640
+ ALT_ELSE: 13,
1641
+ ALT_END: 14,
1642
+ OPT_START: 15,
1643
+ OPT_END: 16,
1644
+ ACTIVE_START: 17,
1645
+ ACTIVE_END: 18,
1646
+ PAR_START: 19,
1647
+ PAR_AND: 20,
1648
+ PAR_END: 21,
1649
+ RECT_START: 22,
1650
+ RECT_END: 23,
1651
+ SOLID_POINT: 24,
1652
+ DOTTED_POINT: 25
1653
+ };
1654
+ var ARROWTYPE = {
1655
+ FILLED: 0,
1656
+ OPEN: 1
1657
+ };
1658
+ var PLACEMENT = {
1659
+ LEFTOF: 0,
1660
+ RIGHTOF: 1,
1661
+ OVER: 2
1662
+ };
1663
+ var setTitle = /* @__PURE__ */ __name(function(txt) {
1664
+ let sanitizedText = sanitizeText(txt, getConfig2());
1665
+ title = sanitizedText;
1666
+ }, "setTitle");
1667
+ var c4Db_default = {
1668
+ addPersonOrSystem,
1669
+ addPersonOrSystemBoundary,
1670
+ addContainer,
1671
+ addContainerBoundary,
1672
+ addComponent,
1673
+ addDeploymentNode,
1674
+ popBoundaryParseStack,
1675
+ addRel,
1676
+ updateElStyle,
1677
+ updateRelStyle,
1678
+ updateLayoutConfig,
1679
+ autoWrap,
1680
+ setWrap,
1681
+ getC4ShapeArray,
1682
+ getC4Shape,
1683
+ getC4ShapeKeys,
1684
+ getBoundaries,
1685
+ getBoundarys,
1686
+ getCurrentBoundaryParse,
1687
+ getParentBoundaryParse,
1688
+ getRels,
1689
+ getTitle,
1690
+ getC4Type,
1691
+ getC4ShapeInRow,
1692
+ getC4BoundaryInRow,
1693
+ setAccTitle,
1694
+ getAccTitle,
1695
+ getAccDescription,
1696
+ setAccDescription,
1697
+ getConfig: /* @__PURE__ */ __name(() => getConfig2().c4, "getConfig"),
1698
+ clear,
1699
+ LINETYPE,
1700
+ ARROWTYPE,
1701
+ PLACEMENT,
1702
+ setTitle,
1703
+ setC4Type
1704
+ };
1705
+ var drawRect2 = /* @__PURE__ */ __name(function(elem, rectData) {
1706
+ return drawRect(elem, rectData);
1707
+ }, "drawRect");
1708
+ var drawImage = /* @__PURE__ */ __name(function(elem, width, height, x, y, link) {
1709
+ const imageElem = elem.append("image");
1710
+ imageElem.attr("width", width);
1711
+ imageElem.attr("height", height);
1712
+ imageElem.attr("x", x);
1713
+ imageElem.attr("y", y);
1714
+ let sanitizedLink = link.startsWith("data:image/png;base64") ? link : import_sanitize_url.sanitizeUrl(link);
1715
+ imageElem.attr("xlink:href", sanitizedLink);
1716
+ }, "drawImage");
1717
+ var drawRels = /* @__PURE__ */ __name((elem, rels2, conf2, diagramId) => {
1718
+ const relsElem = elem.append("g");
1719
+ let i = 0;
1720
+ for (let rel of rels2) {
1721
+ let textColor = rel.textColor ? rel.textColor : "#444444";
1722
+ let strokeColor = rel.lineColor ? rel.lineColor : "#444444";
1723
+ let offsetX = rel.offsetX ? parseInt(rel.offsetX) : 0;
1724
+ let offsetY = rel.offsetY ? parseInt(rel.offsetY) : 0;
1725
+ let url = "";
1726
+ if (i === 0) {
1727
+ let line = relsElem.append("line");
1728
+ line.attr("x1", rel.startPoint.x);
1729
+ line.attr("y1", rel.startPoint.y);
1730
+ line.attr("x2", rel.endPoint.x);
1731
+ line.attr("y2", rel.endPoint.y);
1732
+ line.attr("stroke-width", "1");
1733
+ line.attr("stroke", strokeColor);
1734
+ line.style("fill", "none");
1735
+ if (rel.type !== "rel_b") {
1736
+ line.attr("marker-end", "url(" + url + "#" + diagramId + "-arrowhead)");
1737
+ }
1738
+ if (rel.type === "birel" || rel.type === "rel_b") {
1739
+ line.attr("marker-start", "url(" + url + "#" + diagramId + "-arrowend)");
1740
+ }
1741
+ i = -1;
1742
+ } else {
1743
+ let line = relsElem.append("path");
1744
+ line.attr("fill", "none").attr("stroke-width", "1").attr("stroke", strokeColor).attr("d", "Mstartx,starty Qcontrolx,controly stopx,stopy ".replaceAll("startx", rel.startPoint.x).replaceAll("starty", rel.startPoint.y).replaceAll("controlx", rel.startPoint.x + (rel.endPoint.x - rel.startPoint.x) / 2 - (rel.endPoint.x - rel.startPoint.x) / 4).replaceAll("controly", rel.startPoint.y + (rel.endPoint.y - rel.startPoint.y) / 2).replaceAll("stopx", rel.endPoint.x).replaceAll("stopy", rel.endPoint.y));
1745
+ if (rel.type !== "rel_b") {
1746
+ line.attr("marker-end", "url(" + url + "#" + diagramId + "-arrowhead)");
1747
+ }
1748
+ if (rel.type === "birel" || rel.type === "rel_b") {
1749
+ line.attr("marker-start", "url(" + url + "#" + diagramId + "-arrowend)");
1750
+ }
1751
+ }
1752
+ let messageConf = conf2.messageFont();
1753
+ _drawTextCandidateFunc(conf2)(rel.label.text, relsElem, Math.min(rel.startPoint.x, rel.endPoint.x) + Math.abs(rel.endPoint.x - rel.startPoint.x) / 2 + offsetX, Math.min(rel.startPoint.y, rel.endPoint.y) + Math.abs(rel.endPoint.y - rel.startPoint.y) / 2 + offsetY, rel.label.width, rel.label.height, { fill: textColor }, messageConf);
1754
+ if (rel.techn && rel.techn.text !== "") {
1755
+ messageConf = conf2.messageFont();
1756
+ _drawTextCandidateFunc(conf2)("[" + rel.techn.text + "]", relsElem, Math.min(rel.startPoint.x, rel.endPoint.x) + Math.abs(rel.endPoint.x - rel.startPoint.x) / 2 + offsetX, Math.min(rel.startPoint.y, rel.endPoint.y) + Math.abs(rel.endPoint.y - rel.startPoint.y) / 2 + conf2.messageFontSize + 5 + offsetY, Math.max(rel.label.width, rel.techn.width), rel.techn.height, { fill: textColor, "font-style": "italic" }, messageConf);
1757
+ }
1758
+ }
1759
+ }, "drawRels");
1760
+ var drawBoundary = /* @__PURE__ */ __name(function(elem, boundary, conf2) {
1761
+ const boundaryElem = elem.append("g");
1762
+ let fillColor = boundary.bgColor ? boundary.bgColor : "none";
1763
+ let strokeColor = boundary.borderColor ? boundary.borderColor : "#444444";
1764
+ let fontColor = boundary.fontColor ? boundary.fontColor : "black";
1765
+ let attrsValue = { "stroke-width": 1, "stroke-dasharray": "7.0,7.0" };
1766
+ if (boundary.nodeType) {
1767
+ attrsValue = { "stroke-width": 1 };
1768
+ }
1769
+ let rectData = {
1770
+ x: boundary.x,
1771
+ y: boundary.y,
1772
+ fill: fillColor,
1773
+ stroke: strokeColor,
1774
+ width: boundary.width,
1775
+ height: boundary.height,
1776
+ rx: 2.5,
1777
+ ry: 2.5,
1778
+ attrs: attrsValue
1779
+ };
1780
+ drawRect2(boundaryElem, rectData);
1781
+ let boundaryConf = conf2.boundaryFont();
1782
+ boundaryConf.fontWeight = "bold";
1783
+ boundaryConf.fontSize = boundaryConf.fontSize + 2;
1784
+ boundaryConf.fontColor = fontColor;
1785
+ _drawTextCandidateFunc(conf2)(boundary.label.text, boundaryElem, boundary.x, boundary.y + boundary.label.Y, boundary.width, boundary.height, { fill: "#444444" }, boundaryConf);
1786
+ if (boundary.type && boundary.type.text !== "") {
1787
+ boundaryConf = conf2.boundaryFont();
1788
+ boundaryConf.fontColor = fontColor;
1789
+ _drawTextCandidateFunc(conf2)(boundary.type.text, boundaryElem, boundary.x, boundary.y + boundary.type.Y, boundary.width, boundary.height, { fill: "#444444" }, boundaryConf);
1790
+ }
1791
+ if (boundary.descr && boundary.descr.text !== "") {
1792
+ boundaryConf = conf2.boundaryFont();
1793
+ boundaryConf.fontSize = boundaryConf.fontSize - 2;
1794
+ boundaryConf.fontColor = fontColor;
1795
+ _drawTextCandidateFunc(conf2)(boundary.descr.text, boundaryElem, boundary.x, boundary.y + boundary.descr.Y, boundary.width, boundary.height, { fill: "#444444" }, boundaryConf);
1796
+ }
1797
+ }, "drawBoundary");
1798
+ var drawC4Shape = /* @__PURE__ */ __name(function(elem, c4Shape, conf2) {
1799
+ let fillColor = c4Shape.bgColor ? c4Shape.bgColor : conf2[c4Shape.typeC4Shape.text + "_bg_color"];
1800
+ let strokeColor = c4Shape.borderColor ? c4Shape.borderColor : conf2[c4Shape.typeC4Shape.text + "_border_color"];
1801
+ let fontColor = c4Shape.fontColor ? c4Shape.fontColor : "#FFFFFF";
1802
+ let personImg = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAIAAADYYG7QAAACD0lEQVR4Xu2YoU4EMRCGT+4j8Ai8AhaH4QHgAUjQuFMECUgMIUgwJAgMhgQsAYUiJCiQIBBY+EITsjfTdme6V24v4c8vyGbb+ZjOtN0bNcvjQXmkH83WvYBWto6PLm6v7p7uH1/w2fXD+PBycX1Pv2l3IdDm/vn7x+dXQiAubRzoURa7gRZWd0iGRIiJbOnhnfYBQZNJjNbuyY2eJG8fkDE3bbG4ep6MHUAsgYxmE3nVs6VsBWJSGccsOlFPmLIViMzLOB7pCVO2AtHJMohH7Fh6zqitQK7m0rJvAVYgGcEpe//PLdDz65sM4pF9N7ICcXDKIB5Nv6j7tD0NoSdM2QrU9Gg0ewE1LqBhHR3BBdvj2vapnidjHxD/q6vd7Pvhr31AwcY8eXMTXAKECZZJFXuEq27aLgQK5uLMohCenGGuGewOxSjBvYBqeG6B+Nqiblggdjnc+ZXDy+FNFpFzw76O3UBAROuXh6FoiAcf5g9eTvUgzy0nWg6I8cXHRUpg5bOVBCo+KDpFajOf23GgPme7RSQ+lacIENUgJ6gg1k6HjgOlqnLqip4tEuhv0hNEMXUD0clyXE3p6pZA0S2nnvTlXwLJEZWlb7cTQH1+USgTN4VhAenm/wea1OCAOmqo6fE1WCb9WSKBah+rbUWPWAmE2Rvk0ApiB45eOyNAzU8xcTvj8KvkKEoOaIYeHNA3ZuygAvFMUO0AAAAASUVORK5CYII=";
1803
+ switch (c4Shape.typeC4Shape.text) {
1804
+ case "person":
1805
+ personImg = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAIAAADYYG7QAAACD0lEQVR4Xu2YoU4EMRCGT+4j8Ai8AhaH4QHgAUjQuFMECUgMIUgwJAgMhgQsAYUiJCiQIBBY+EITsjfTdme6V24v4c8vyGbb+ZjOtN0bNcvjQXmkH83WvYBWto6PLm6v7p7uH1/w2fXD+PBycX1Pv2l3IdDm/vn7x+dXQiAubRzoURa7gRZWd0iGRIiJbOnhnfYBQZNJjNbuyY2eJG8fkDE3bbG4ep6MHUAsgYxmE3nVs6VsBWJSGccsOlFPmLIViMzLOB7pCVO2AtHJMohH7Fh6zqitQK7m0rJvAVYgGcEpe//PLdDz65sM4pF9N7ICcXDKIB5Nv6j7tD0NoSdM2QrU9Gg0ewE1LqBhHR3BBdvj2vapnidjHxD/q6vd7Pvhr31AwcY8eXMTXAKECZZJFXuEq27aLgQK5uLMohCenGGuGewOxSjBvYBqeG6B+Nqiblggdjnc+ZXDy+FNFpFzw76O3UBAROuXh6FoiAcf5g9eTvUgzy0nWg6I8cXHRUpg5bOVBCo+KDpFajOf23GgPme7RSQ+lacIENUgJ6gg1k6HjgOlqnLqip4tEuhv0hNEMXUD0clyXE3p6pZA0S2nnvTlXwLJEZWlb7cTQH1+USgTN4VhAenm/wea1OCAOmqo6fE1WCb9WSKBah+rbUWPWAmE2Rvk0ApiB45eOyNAzU8xcTvj8KvkKEoOaIYeHNA3ZuygAvFMUO0AAAAASUVORK5CYII=";
1806
+ break;
1807
+ case "external_person":
1808
+ personImg = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAIAAADYYG7QAAAB6ElEQVR4Xu2YLY+EMBCG9+dWr0aj0Wg0Go1Go0+j8Xdv2uTCvv1gpt0ebHKPuhDaeW4605Z9mJvx4AdXUyTUdd08z+u6flmWZRnHsWkafk9DptAwDPu+f0eAYtu2PEaGWuj5fCIZrBAC2eLBAnRCsEkkxmeaJp7iDJ2QMDdHsLg8SxKFEJaAo8lAXnmuOFIhTMpxxKATebo4UiFknuNo4OniSIXQyRxEA3YsnjGCVEjVXD7yLUAqxBGUyPv/Y4W2beMgGuS7kVQIBycH0fD+oi5pezQETxdHKmQKGk1eQEYldK+jw5GxPfZ9z7Mk0Qnhf1W1m3w//EUn5BDmSZsbR44QQLBEqrBHqOrmSKaQAxdnLArCrxZcM7A7ZKs4ioRq8LFC+NpC3WCBJsvpVw5edm9iEXFuyNfxXAgSwfrFQ1c0iNda8AdejvUgnktOtJQQxmcfFzGglc5WVCj7oDgFqU18boeFSs52CUh8LE8BIVQDT1ABrB0HtgSEYlX5doJnCwv9TXocKCaKbnwhdDKPq4lf3SwU3HLq4V/+WYhHVMa/3b4IlfyikAduCkcBc7mQ3/z/Qq/cTuikhkzB12Ae/mcJC9U+Vo8Ej1gWAtgbeGgFsAMHr50BIWOLCbezvhpBFUdY6EJuJ/QDW0XoMX60zZ0AAAAASUVORK5CYII=";
1809
+ break;
1810
+ }
1811
+ const c4ShapeElem = elem.append("g");
1812
+ c4ShapeElem.attr("class", "person-man");
1813
+ const rect = getNoteRect();
1814
+ switch (c4Shape.typeC4Shape.text) {
1815
+ case "person":
1816
+ case "external_person":
1817
+ case "system":
1818
+ case "external_system":
1819
+ case "container":
1820
+ case "external_container":
1821
+ case "component":
1822
+ case "external_component":
1823
+ rect.x = c4Shape.x;
1824
+ rect.y = c4Shape.y;
1825
+ rect.fill = fillColor;
1826
+ rect.width = c4Shape.width;
1827
+ rect.height = c4Shape.height;
1828
+ rect.stroke = strokeColor;
1829
+ rect.rx = 2.5;
1830
+ rect.ry = 2.5;
1831
+ rect.attrs = { "stroke-width": 0.5 };
1832
+ drawRect2(c4ShapeElem, rect);
1833
+ break;
1834
+ case "system_db":
1835
+ case "external_system_db":
1836
+ case "container_db":
1837
+ case "external_container_db":
1838
+ case "component_db":
1839
+ case "external_component_db":
1840
+ c4ShapeElem.append("path").attr("fill", fillColor).attr("stroke-width", "0.5").attr("stroke", strokeColor).attr("d", "Mstartx,startyc0,-10 half,-10 half,-10c0,0 half,0 half,10l0,heightc0,10 -half,10 -half,10c0,0 -half,0 -half,-10l0,-height".replaceAll("startx", c4Shape.x).replaceAll("starty", c4Shape.y).replaceAll("half", c4Shape.width / 2).replaceAll("height", c4Shape.height));
1841
+ c4ShapeElem.append("path").attr("fill", "none").attr("stroke-width", "0.5").attr("stroke", strokeColor).attr("d", "Mstartx,startyc0,10 half,10 half,10c0,0 half,0 half,-10".replaceAll("startx", c4Shape.x).replaceAll("starty", c4Shape.y).replaceAll("half", c4Shape.width / 2));
1842
+ break;
1843
+ case "system_queue":
1844
+ case "external_system_queue":
1845
+ case "container_queue":
1846
+ case "external_container_queue":
1847
+ case "component_queue":
1848
+ case "external_component_queue":
1849
+ c4ShapeElem.append("path").attr("fill", fillColor).attr("stroke-width", "0.5").attr("stroke", strokeColor).attr("d", "Mstartx,startylwidth,0c5,0 5,half 5,halfc0,0 0,half -5,halfl-width,0c-5,0 -5,-half -5,-halfc0,0 0,-half 5,-half".replaceAll("startx", c4Shape.x).replaceAll("starty", c4Shape.y).replaceAll("width", c4Shape.width).replaceAll("half", c4Shape.height / 2));
1850
+ c4ShapeElem.append("path").attr("fill", "none").attr("stroke-width", "0.5").attr("stroke", strokeColor).attr("d", "Mstartx,startyc-5,0 -5,half -5,halfc0,half 5,half 5,half".replaceAll("startx", c4Shape.x + c4Shape.width).replaceAll("starty", c4Shape.y).replaceAll("half", c4Shape.height / 2));
1851
+ break;
1852
+ }
1853
+ let c4ShapeFontConf = getC4ShapeFont(conf2, c4Shape.typeC4Shape.text);
1854
+ c4ShapeElem.append("text").attr("fill", fontColor).attr("font-family", c4ShapeFontConf.fontFamily).attr("font-size", c4ShapeFontConf.fontSize - 2).attr("font-style", "italic").attr("lengthAdjust", "spacing").attr("textLength", c4Shape.typeC4Shape.width).attr("x", c4Shape.x + c4Shape.width / 2 - c4Shape.typeC4Shape.width / 2).attr("y", c4Shape.y + c4Shape.typeC4Shape.Y).text("<<" + c4Shape.typeC4Shape.text + ">>");
1855
+ switch (c4Shape.typeC4Shape.text) {
1856
+ case "person":
1857
+ case "external_person":
1858
+ drawImage(c4ShapeElem, 48, 48, c4Shape.x + c4Shape.width / 2 - 24, c4Shape.y + c4Shape.image.Y, personImg);
1859
+ break;
1860
+ }
1861
+ let textFontConf = conf2[c4Shape.typeC4Shape.text + "Font"]();
1862
+ textFontConf.fontWeight = "bold";
1863
+ textFontConf.fontSize = textFontConf.fontSize + 2;
1864
+ textFontConf.fontColor = fontColor;
1865
+ _drawTextCandidateFunc(conf2)(c4Shape.label.text, c4ShapeElem, c4Shape.x, c4Shape.y + c4Shape.label.Y, c4Shape.width, c4Shape.height, { fill: fontColor }, textFontConf);
1866
+ textFontConf = conf2[c4Shape.typeC4Shape.text + "Font"]();
1867
+ textFontConf.fontColor = fontColor;
1868
+ if (c4Shape.techn && c4Shape.techn?.text !== "") {
1869
+ _drawTextCandidateFunc(conf2)(c4Shape.techn.text, c4ShapeElem, c4Shape.x, c4Shape.y + c4Shape.techn.Y, c4Shape.width, c4Shape.height, { fill: fontColor, "font-style": "italic" }, textFontConf);
1870
+ } else if (c4Shape.type && c4Shape.type.text !== "") {
1871
+ _drawTextCandidateFunc(conf2)(c4Shape.type.text, c4ShapeElem, c4Shape.x, c4Shape.y + c4Shape.type.Y, c4Shape.width, c4Shape.height, { fill: fontColor, "font-style": "italic" }, textFontConf);
1872
+ }
1873
+ if (c4Shape.descr && c4Shape.descr.text !== "") {
1874
+ textFontConf = conf2.personFont();
1875
+ textFontConf.fontColor = fontColor;
1876
+ _drawTextCandidateFunc(conf2)(c4Shape.descr.text, c4ShapeElem, c4Shape.x, c4Shape.y + c4Shape.descr.Y, c4Shape.width, c4Shape.height, { fill: fontColor }, textFontConf);
1877
+ }
1878
+ return c4Shape.height;
1879
+ }, "drawC4Shape");
1880
+ var insertDatabaseIcon = /* @__PURE__ */ __name(function(elem, id) {
1881
+ 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");
1882
+ }, "insertDatabaseIcon");
1883
+ var insertComputerIcon = /* @__PURE__ */ __name(function(elem, id) {
1884
+ 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");
1885
+ }, "insertComputerIcon");
1886
+ var insertClockIcon = /* @__PURE__ */ __name(function(elem, id) {
1887
+ 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");
1888
+ }, "insertClockIcon");
1889
+ var insertArrowHead = /* @__PURE__ */ __name(function(elem, id) {
1890
+ elem.append("defs").append("marker").attr("id", id + "-arrowhead").attr("refX", 9).attr("refY", 5).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 12).attr("markerHeight", 12).attr("orient", "auto").append("path").attr("d", "M 0 0 L 10 5 L 0 10 z");
1891
+ }, "insertArrowHead");
1892
+ var insertArrowEnd = /* @__PURE__ */ __name(function(elem, id) {
1893
+ elem.append("defs").append("marker").attr("id", id + "-arrowend").attr("refX", 1).attr("refY", 5).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 12).attr("markerHeight", 12).attr("orient", "auto").append("path").attr("d", "M 10 0 L 0 5 L 10 10 z");
1894
+ }, "insertArrowEnd");
1895
+ var insertArrowFilledHead = /* @__PURE__ */ __name(function(elem, id) {
1896
+ elem.append("defs").append("marker").attr("id", id + "-filled-head").attr("refX", 18).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");
1897
+ }, "insertArrowFilledHead");
1898
+ var insertArrowCrossHead = /* @__PURE__ */ __name(function(elem, id) {
1899
+ const defs = elem.append("defs");
1900
+ const marker = defs.append("marker").attr("id", id + "-crosshead").attr("markerWidth", 15).attr("markerHeight", 8).attr("orient", "auto").attr("refX", 16).attr("refY", 4);
1901
+ marker.append("path").attr("fill", "black").attr("stroke", "#000000").style("stroke-dasharray", "0, 0").attr("stroke-width", "1px").attr("d", "M 9,2 V 6 L16,4 Z");
1902
+ marker.append("path").attr("fill", "none").attr("stroke", "#000000").style("stroke-dasharray", "0, 0").attr("stroke-width", "1px").attr("d", "M 0,1 L 6,7 M 6,1 L 0,7");
1903
+ }, "insertArrowCrossHead");
1904
+ var getC4ShapeFont = /* @__PURE__ */ __name((cnf, typeC4Shape) => {
1905
+ return {
1906
+ fontFamily: cnf[typeC4Shape + "FontFamily"],
1907
+ fontSize: cnf[typeC4Shape + "FontSize"],
1908
+ fontWeight: cnf[typeC4Shape + "FontWeight"]
1909
+ };
1910
+ }, "getC4ShapeFont");
1911
+ var _drawTextCandidateFunc = /* @__PURE__ */ function() {
1912
+ function byText(content, g, x, y, width, height, textAttrs) {
1913
+ const text = g.append("text").attr("x", x + width / 2).attr("y", y + height / 2 + 5).style("text-anchor", "middle").text(content);
1914
+ _setTextAttrs(text, textAttrs);
1915
+ }
1916
+ __name(byText, "byText");
1917
+ function byTspan(content, g, x, y, width, height, textAttrs, conf2) {
1918
+ const { fontSize, fontFamily, fontWeight } = conf2;
1919
+ const lines = content.split(common_default.lineBreakRegex);
1920
+ for (let i = 0;i < lines.length; i++) {
1921
+ const dy = i * fontSize - fontSize * (lines.length - 1) / 2;
1922
+ const text = g.append("text").attr("x", x + width / 2).attr("y", y).style("text-anchor", "middle").attr("dominant-baseline", "middle").style("font-size", fontSize).style("font-weight", fontWeight).style("font-family", fontFamily);
1923
+ text.append("tspan").attr("dy", dy).text(lines[i]).attr("alignment-baseline", "mathematical");
1924
+ _setTextAttrs(text, textAttrs);
1925
+ }
1926
+ }
1927
+ __name(byTspan, "byTspan");
1928
+ function byFo(content, g, x, y, width, height, textAttrs, conf2) {
1929
+ const s = g.append("switch");
1930
+ const f = s.append("foreignObject").attr("x", x).attr("y", y).attr("width", width).attr("height", height);
1931
+ const text = f.append("xhtml:div").style("display", "table").style("height", "100%").style("width", "100%");
1932
+ text.append("div").style("display", "table-cell").style("text-align", "center").style("vertical-align", "middle").text(content);
1933
+ byTspan(content, s, x, y, width, height, textAttrs, conf2);
1934
+ _setTextAttrs(text, textAttrs);
1935
+ }
1936
+ __name(byFo, "byFo");
1937
+ function _setTextAttrs(toText, fromTextAttrsDict) {
1938
+ for (const key in fromTextAttrsDict) {
1939
+ if (fromTextAttrsDict.hasOwnProperty(key)) {
1940
+ toText.attr(key, fromTextAttrsDict[key]);
1941
+ }
1942
+ }
1943
+ }
1944
+ __name(_setTextAttrs, "_setTextAttrs");
1945
+ return function(conf2) {
1946
+ return conf2.textPlacement === "fo" ? byFo : conf2.textPlacement === "old" ? byText : byTspan;
1947
+ };
1948
+ }();
1949
+ var svgDraw_default = {
1950
+ drawRect: drawRect2,
1951
+ drawBoundary,
1952
+ drawC4Shape,
1953
+ drawRels,
1954
+ drawImage,
1955
+ insertArrowHead,
1956
+ insertArrowEnd,
1957
+ insertArrowFilledHead,
1958
+ insertArrowCrossHead,
1959
+ insertDatabaseIcon,
1960
+ insertComputerIcon,
1961
+ insertClockIcon
1962
+ };
1963
+ var globalBoundaryMaxX = 0;
1964
+ var globalBoundaryMaxY = 0;
1965
+ var c4ShapeInRow2 = 4;
1966
+ var c4BoundaryInRow2 = 2;
1967
+ parser.yy = c4Db_default;
1968
+ var conf = {};
1969
+ var Bounds = class {
1970
+ static {
1971
+ __name(this, "Bounds");
1972
+ }
1973
+ constructor(diagObj) {
1974
+ this.name = "";
1975
+ this.data = {};
1976
+ this.data.startx = undefined;
1977
+ this.data.stopx = undefined;
1978
+ this.data.starty = undefined;
1979
+ this.data.stopy = undefined;
1980
+ this.data.widthLimit = undefined;
1981
+ this.nextData = {};
1982
+ this.nextData.startx = undefined;
1983
+ this.nextData.stopx = undefined;
1984
+ this.nextData.starty = undefined;
1985
+ this.nextData.stopy = undefined;
1986
+ this.nextData.cnt = 0;
1987
+ setConf(diagObj.db.getConfig());
1988
+ }
1989
+ setData(startx, stopx, starty, stopy) {
1990
+ this.nextData.startx = this.data.startx = startx;
1991
+ this.nextData.stopx = this.data.stopx = stopx;
1992
+ this.nextData.starty = this.data.starty = starty;
1993
+ this.nextData.stopy = this.data.stopy = stopy;
1994
+ }
1995
+ updateVal(obj, key, val, fun) {
1996
+ if (obj[key] === undefined) {
1997
+ obj[key] = val;
1998
+ } else {
1999
+ obj[key] = fun(val, obj[key]);
2000
+ }
2001
+ }
2002
+ insert(c4Shape) {
2003
+ this.nextData.cnt = this.nextData.cnt + 1;
2004
+ let _startx = this.nextData.startx === this.nextData.stopx ? this.nextData.stopx + c4Shape.margin : this.nextData.stopx + c4Shape.margin * 2;
2005
+ let _stopx = _startx + c4Shape.width;
2006
+ let _starty = this.nextData.starty + c4Shape.margin * 2;
2007
+ let _stopy = _starty + c4Shape.height;
2008
+ if (_startx >= this.data.widthLimit || _stopx >= this.data.widthLimit || this.nextData.cnt > c4ShapeInRow2) {
2009
+ _startx = this.nextData.startx + c4Shape.margin + conf.nextLinePaddingX;
2010
+ _starty = this.nextData.stopy + c4Shape.margin * 2;
2011
+ this.nextData.stopx = _stopx = _startx + c4Shape.width;
2012
+ this.nextData.starty = this.nextData.stopy;
2013
+ this.nextData.stopy = _stopy = _starty + c4Shape.height;
2014
+ this.nextData.cnt = 1;
2015
+ }
2016
+ c4Shape.x = _startx;
2017
+ c4Shape.y = _starty;
2018
+ this.updateVal(this.data, "startx", _startx, Math.min);
2019
+ this.updateVal(this.data, "starty", _starty, Math.min);
2020
+ this.updateVal(this.data, "stopx", _stopx, Math.max);
2021
+ this.updateVal(this.data, "stopy", _stopy, Math.max);
2022
+ this.updateVal(this.nextData, "startx", _startx, Math.min);
2023
+ this.updateVal(this.nextData, "starty", _starty, Math.min);
2024
+ this.updateVal(this.nextData, "stopx", _stopx, Math.max);
2025
+ this.updateVal(this.nextData, "stopy", _stopy, Math.max);
2026
+ }
2027
+ init(diagObj) {
2028
+ this.name = "";
2029
+ this.data = {
2030
+ startx: undefined,
2031
+ stopx: undefined,
2032
+ starty: undefined,
2033
+ stopy: undefined,
2034
+ widthLimit: undefined
2035
+ };
2036
+ this.nextData = {
2037
+ startx: undefined,
2038
+ stopx: undefined,
2039
+ starty: undefined,
2040
+ stopy: undefined,
2041
+ cnt: 0
2042
+ };
2043
+ setConf(diagObj.db.getConfig());
2044
+ }
2045
+ bumpLastMargin(margin) {
2046
+ this.data.stopx += margin;
2047
+ this.data.stopy += margin;
2048
+ }
2049
+ };
2050
+ var setConf = /* @__PURE__ */ __name(function(cnf) {
2051
+ assignWithDepth_default(conf, cnf);
2052
+ if (cnf.fontFamily) {
2053
+ conf.personFontFamily = conf.systemFontFamily = conf.messageFontFamily = cnf.fontFamily;
2054
+ }
2055
+ if (cnf.fontSize) {
2056
+ conf.personFontSize = conf.systemFontSize = conf.messageFontSize = cnf.fontSize;
2057
+ }
2058
+ if (cnf.fontWeight) {
2059
+ conf.personFontWeight = conf.systemFontWeight = conf.messageFontWeight = cnf.fontWeight;
2060
+ }
2061
+ }, "setConf");
2062
+ var c4ShapeFont = /* @__PURE__ */ __name((cnf, typeC4Shape) => {
2063
+ return {
2064
+ fontFamily: cnf[typeC4Shape + "FontFamily"],
2065
+ fontSize: cnf[typeC4Shape + "FontSize"],
2066
+ fontWeight: cnf[typeC4Shape + "FontWeight"]
2067
+ };
2068
+ }, "c4ShapeFont");
2069
+ var boundaryFont = /* @__PURE__ */ __name((cnf) => {
2070
+ return {
2071
+ fontFamily: cnf.boundaryFontFamily,
2072
+ fontSize: cnf.boundaryFontSize,
2073
+ fontWeight: cnf.boundaryFontWeight
2074
+ };
2075
+ }, "boundaryFont");
2076
+ var messageFont = /* @__PURE__ */ __name((cnf) => {
2077
+ return {
2078
+ fontFamily: cnf.messageFontFamily,
2079
+ fontSize: cnf.messageFontSize,
2080
+ fontWeight: cnf.messageFontWeight
2081
+ };
2082
+ }, "messageFont");
2083
+ function calcC4ShapeTextWH(textType, c4Shape, c4ShapeTextWrap, textConf, textLimitWidth) {
2084
+ if (!c4Shape[textType].width) {
2085
+ if (c4ShapeTextWrap) {
2086
+ c4Shape[textType].text = wrapLabel(c4Shape[textType].text, textLimitWidth, textConf);
2087
+ c4Shape[textType].textLines = c4Shape[textType].text.split(common_default.lineBreakRegex).length;
2088
+ c4Shape[textType].width = textLimitWidth;
2089
+ c4Shape[textType].height = calculateTextHeight(c4Shape[textType].text, textConf);
2090
+ } else {
2091
+ let lines = c4Shape[textType].text.split(common_default.lineBreakRegex);
2092
+ c4Shape[textType].textLines = lines.length;
2093
+ let lineHeight = 0;
2094
+ c4Shape[textType].height = 0;
2095
+ c4Shape[textType].width = 0;
2096
+ for (const line of lines) {
2097
+ c4Shape[textType].width = Math.max(calculateTextWidth(line, textConf), c4Shape[textType].width);
2098
+ lineHeight = calculateTextHeight(line, textConf);
2099
+ c4Shape[textType].height = c4Shape[textType].height + lineHeight;
2100
+ }
2101
+ }
2102
+ }
2103
+ }
2104
+ __name(calcC4ShapeTextWH, "calcC4ShapeTextWH");
2105
+ var drawBoundary2 = /* @__PURE__ */ __name(function(diagram2, boundary, bounds) {
2106
+ boundary.x = bounds.data.startx;
2107
+ boundary.y = bounds.data.starty;
2108
+ boundary.width = bounds.data.stopx - bounds.data.startx;
2109
+ boundary.height = bounds.data.stopy - bounds.data.starty;
2110
+ boundary.label.y = conf.c4ShapeMargin - 35;
2111
+ let boundaryTextWrap = boundary.wrap && conf.wrap;
2112
+ let boundaryLabelConf = boundaryFont(conf);
2113
+ boundaryLabelConf.fontSize = boundaryLabelConf.fontSize + 2;
2114
+ boundaryLabelConf.fontWeight = "bold";
2115
+ let textLimitWidth = calculateTextWidth(boundary.label.text, boundaryLabelConf);
2116
+ calcC4ShapeTextWH("label", boundary, boundaryTextWrap, boundaryLabelConf, textLimitWidth);
2117
+ svgDraw_default.drawBoundary(diagram2, boundary, conf);
2118
+ }, "drawBoundary");
2119
+ var drawC4ShapeArray = /* @__PURE__ */ __name(function(currentBounds, diagram2, c4ShapeArray2, c4ShapeKeys) {
2120
+ let Y = 0;
2121
+ for (const c4ShapeKey of c4ShapeKeys) {
2122
+ Y = 0;
2123
+ const c4Shape = c4ShapeArray2[c4ShapeKey];
2124
+ let c4ShapeTypeConf = c4ShapeFont(conf, c4Shape.typeC4Shape.text);
2125
+ c4ShapeTypeConf.fontSize = c4ShapeTypeConf.fontSize - 2;
2126
+ c4Shape.typeC4Shape.width = calculateTextWidth("«" + c4Shape.typeC4Shape.text + "»", c4ShapeTypeConf);
2127
+ c4Shape.typeC4Shape.height = c4ShapeTypeConf.fontSize + 2;
2128
+ c4Shape.typeC4Shape.Y = conf.c4ShapePadding;
2129
+ Y = c4Shape.typeC4Shape.Y + c4Shape.typeC4Shape.height - 4;
2130
+ c4Shape.image = { width: 0, height: 0, Y: 0 };
2131
+ switch (c4Shape.typeC4Shape.text) {
2132
+ case "person":
2133
+ case "external_person":
2134
+ c4Shape.image.width = 48;
2135
+ c4Shape.image.height = 48;
2136
+ c4Shape.image.Y = Y;
2137
+ Y = c4Shape.image.Y + c4Shape.image.height;
2138
+ break;
2139
+ }
2140
+ if (c4Shape.sprite) {
2141
+ c4Shape.image.width = 48;
2142
+ c4Shape.image.height = 48;
2143
+ c4Shape.image.Y = Y;
2144
+ Y = c4Shape.image.Y + c4Shape.image.height;
2145
+ }
2146
+ let c4ShapeTextWrap = c4Shape.wrap && conf.wrap;
2147
+ let textLimitWidth = conf.width - conf.c4ShapePadding * 2;
2148
+ let c4ShapeLabelConf = c4ShapeFont(conf, c4Shape.typeC4Shape.text);
2149
+ c4ShapeLabelConf.fontSize = c4ShapeLabelConf.fontSize + 2;
2150
+ c4ShapeLabelConf.fontWeight = "bold";
2151
+ calcC4ShapeTextWH("label", c4Shape, c4ShapeTextWrap, c4ShapeLabelConf, textLimitWidth);
2152
+ c4Shape.label.Y = Y + 8;
2153
+ Y = c4Shape.label.Y + c4Shape.label.height;
2154
+ if (c4Shape.type && c4Shape.type.text !== "") {
2155
+ c4Shape.type.text = "[" + c4Shape.type.text + "]";
2156
+ let c4ShapeTypeConf2 = c4ShapeFont(conf, c4Shape.typeC4Shape.text);
2157
+ calcC4ShapeTextWH("type", c4Shape, c4ShapeTextWrap, c4ShapeTypeConf2, textLimitWidth);
2158
+ c4Shape.type.Y = Y + 5;
2159
+ Y = c4Shape.type.Y + c4Shape.type.height;
2160
+ } else if (c4Shape.techn && c4Shape.techn.text !== "") {
2161
+ c4Shape.techn.text = "[" + c4Shape.techn.text + "]";
2162
+ let c4ShapeTechnConf = c4ShapeFont(conf, c4Shape.techn.text);
2163
+ calcC4ShapeTextWH("techn", c4Shape, c4ShapeTextWrap, c4ShapeTechnConf, textLimitWidth);
2164
+ c4Shape.techn.Y = Y + 5;
2165
+ Y = c4Shape.techn.Y + c4Shape.techn.height;
2166
+ }
2167
+ let rectHeight = Y;
2168
+ let rectWidth = c4Shape.label.width;
2169
+ if (c4Shape.descr && c4Shape.descr.text !== "") {
2170
+ let c4ShapeDescrConf = c4ShapeFont(conf, c4Shape.typeC4Shape.text);
2171
+ calcC4ShapeTextWH("descr", c4Shape, c4ShapeTextWrap, c4ShapeDescrConf, textLimitWidth);
2172
+ c4Shape.descr.Y = Y + 20;
2173
+ Y = c4Shape.descr.Y + c4Shape.descr.height;
2174
+ rectWidth = Math.max(c4Shape.label.width, c4Shape.descr.width);
2175
+ rectHeight = Y - c4Shape.descr.textLines * 5;
2176
+ }
2177
+ rectWidth = rectWidth + conf.c4ShapePadding;
2178
+ c4Shape.width = Math.max(c4Shape.width || conf.width, rectWidth, conf.width);
2179
+ c4Shape.height = Math.max(c4Shape.height || conf.height, rectHeight, conf.height);
2180
+ c4Shape.margin = c4Shape.margin || conf.c4ShapeMargin;
2181
+ currentBounds.insert(c4Shape);
2182
+ svgDraw_default.drawC4Shape(diagram2, c4Shape, conf);
2183
+ }
2184
+ currentBounds.bumpLastMargin(conf.c4ShapeMargin);
2185
+ }, "drawC4ShapeArray");
2186
+ var Point = class {
2187
+ static {
2188
+ __name(this, "Point");
2189
+ }
2190
+ constructor(x, y) {
2191
+ this.x = x;
2192
+ this.y = y;
2193
+ }
2194
+ };
2195
+ var getIntersectPoint = /* @__PURE__ */ __name(function(fromNode, endPoint) {
2196
+ let x1 = fromNode.x;
2197
+ let y1 = fromNode.y;
2198
+ let x2 = endPoint.x;
2199
+ let y2 = endPoint.y;
2200
+ let fromCenterX = x1 + fromNode.width / 2;
2201
+ let fromCenterY = y1 + fromNode.height / 2;
2202
+ let dx = Math.abs(x1 - x2);
2203
+ let dy = Math.abs(y1 - y2);
2204
+ let tanDYX = dy / dx;
2205
+ let fromDYX = fromNode.height / fromNode.width;
2206
+ let returnPoint = null;
2207
+ if (y1 == y2 && x1 < x2) {
2208
+ returnPoint = new Point(x1 + fromNode.width, fromCenterY);
2209
+ } else if (y1 == y2 && x1 > x2) {
2210
+ returnPoint = new Point(x1, fromCenterY);
2211
+ } else if (x1 == x2 && y1 < y2) {
2212
+ returnPoint = new Point(fromCenterX, y1 + fromNode.height);
2213
+ } else if (x1 == x2 && y1 > y2) {
2214
+ returnPoint = new Point(fromCenterX, y1);
2215
+ }
2216
+ if (x1 > x2 && y1 < y2) {
2217
+ if (fromDYX >= tanDYX) {
2218
+ returnPoint = new Point(x1, fromCenterY + tanDYX * fromNode.width / 2);
2219
+ } else {
2220
+ returnPoint = new Point(fromCenterX - dx / dy * fromNode.height / 2, y1 + fromNode.height);
2221
+ }
2222
+ } else if (x1 < x2 && y1 < y2) {
2223
+ if (fromDYX >= tanDYX) {
2224
+ returnPoint = new Point(x1 + fromNode.width, fromCenterY + tanDYX * fromNode.width / 2);
2225
+ } else {
2226
+ returnPoint = new Point(fromCenterX + dx / dy * fromNode.height / 2, y1 + fromNode.height);
2227
+ }
2228
+ } else if (x1 < x2 && y1 > y2) {
2229
+ if (fromDYX >= tanDYX) {
2230
+ returnPoint = new Point(x1 + fromNode.width, fromCenterY - tanDYX * fromNode.width / 2);
2231
+ } else {
2232
+ returnPoint = new Point(fromCenterX + fromNode.height / 2 * dx / dy, y1);
2233
+ }
2234
+ } else if (x1 > x2 && y1 > y2) {
2235
+ if (fromDYX >= tanDYX) {
2236
+ returnPoint = new Point(x1, fromCenterY - fromNode.width / 2 * tanDYX);
2237
+ } else {
2238
+ returnPoint = new Point(fromCenterX - fromNode.height / 2 * dx / dy, y1);
2239
+ }
2240
+ }
2241
+ return returnPoint;
2242
+ }, "getIntersectPoint");
2243
+ var getIntersectPoints = /* @__PURE__ */ __name(function(fromNode, endNode) {
2244
+ let endIntersectPoint = { x: 0, y: 0 };
2245
+ endIntersectPoint.x = endNode.x + endNode.width / 2;
2246
+ endIntersectPoint.y = endNode.y + endNode.height / 2;
2247
+ let startPoint = getIntersectPoint(fromNode, endIntersectPoint);
2248
+ endIntersectPoint.x = fromNode.x + fromNode.width / 2;
2249
+ endIntersectPoint.y = fromNode.y + fromNode.height / 2;
2250
+ let endPoint = getIntersectPoint(endNode, endIntersectPoint);
2251
+ return { startPoint, endPoint };
2252
+ }, "getIntersectPoints");
2253
+ var drawRels2 = /* @__PURE__ */ __name(function(diagram2, rels2, getC4ShapeObj, diagObj, diagramId) {
2254
+ let i = 0;
2255
+ for (let rel of rels2) {
2256
+ i = i + 1;
2257
+ let relTextWrap = rel.wrap && conf.wrap;
2258
+ let relConf = messageFont(conf);
2259
+ let diagramType = diagObj.db.getC4Type();
2260
+ if (diagramType === "C4Dynamic") {
2261
+ rel.label.text = i + ": " + rel.label.text;
2262
+ }
2263
+ let textLimitWidth = calculateTextWidth(rel.label.text, relConf);
2264
+ calcC4ShapeTextWH("label", rel, relTextWrap, relConf, textLimitWidth);
2265
+ if (rel.techn && rel.techn.text !== "") {
2266
+ textLimitWidth = calculateTextWidth(rel.techn.text, relConf);
2267
+ calcC4ShapeTextWH("techn", rel, relTextWrap, relConf, textLimitWidth);
2268
+ }
2269
+ if (rel.descr && rel.descr.text !== "") {
2270
+ textLimitWidth = calculateTextWidth(rel.descr.text, relConf);
2271
+ calcC4ShapeTextWH("descr", rel, relTextWrap, relConf, textLimitWidth);
2272
+ }
2273
+ let fromNode = getC4ShapeObj(rel.from);
2274
+ let endNode = getC4ShapeObj(rel.to);
2275
+ let points = getIntersectPoints(fromNode, endNode);
2276
+ rel.startPoint = points.startPoint;
2277
+ rel.endPoint = points.endPoint;
2278
+ }
2279
+ svgDraw_default.drawRels(diagram2, rels2, conf, diagramId);
2280
+ }, "drawRels");
2281
+ function drawInsideBoundary(diagram2, parentBoundaryAlias, parentBounds, currentBoundaries, diagObj) {
2282
+ let currentBounds = new Bounds(diagObj);
2283
+ currentBounds.data.widthLimit = parentBounds.data.widthLimit / Math.min(c4BoundaryInRow2, currentBoundaries.length);
2284
+ for (let [i, currentBoundary] of currentBoundaries.entries()) {
2285
+ let Y = 0;
2286
+ currentBoundary.image = { width: 0, height: 0, Y: 0 };
2287
+ if (currentBoundary.sprite) {
2288
+ currentBoundary.image.width = 48;
2289
+ currentBoundary.image.height = 48;
2290
+ currentBoundary.image.Y = Y;
2291
+ Y = currentBoundary.image.Y + currentBoundary.image.height;
2292
+ }
2293
+ let currentBoundaryTextWrap = currentBoundary.wrap && conf.wrap;
2294
+ let currentBoundaryLabelConf = boundaryFont(conf);
2295
+ currentBoundaryLabelConf.fontSize = currentBoundaryLabelConf.fontSize + 2;
2296
+ currentBoundaryLabelConf.fontWeight = "bold";
2297
+ calcC4ShapeTextWH("label", currentBoundary, currentBoundaryTextWrap, currentBoundaryLabelConf, currentBounds.data.widthLimit);
2298
+ currentBoundary.label.Y = Y + 8;
2299
+ Y = currentBoundary.label.Y + currentBoundary.label.height;
2300
+ if (currentBoundary.type && currentBoundary.type.text !== "") {
2301
+ currentBoundary.type.text = "[" + currentBoundary.type.text + "]";
2302
+ let currentBoundaryTypeConf = boundaryFont(conf);
2303
+ calcC4ShapeTextWH("type", currentBoundary, currentBoundaryTextWrap, currentBoundaryTypeConf, currentBounds.data.widthLimit);
2304
+ currentBoundary.type.Y = Y + 5;
2305
+ Y = currentBoundary.type.Y + currentBoundary.type.height;
2306
+ }
2307
+ if (currentBoundary.descr && currentBoundary.descr.text !== "") {
2308
+ let currentBoundaryDescrConf = boundaryFont(conf);
2309
+ currentBoundaryDescrConf.fontSize = currentBoundaryDescrConf.fontSize - 2;
2310
+ calcC4ShapeTextWH("descr", currentBoundary, currentBoundaryTextWrap, currentBoundaryDescrConf, currentBounds.data.widthLimit);
2311
+ currentBoundary.descr.Y = Y + 20;
2312
+ Y = currentBoundary.descr.Y + currentBoundary.descr.height;
2313
+ }
2314
+ if (i == 0 || i % c4BoundaryInRow2 === 0) {
2315
+ let _x = parentBounds.data.startx + conf.diagramMarginX;
2316
+ let _y = parentBounds.data.stopy + conf.diagramMarginY + Y;
2317
+ currentBounds.setData(_x, _x, _y, _y);
2318
+ } else {
2319
+ let _x = currentBounds.data.stopx !== currentBounds.data.startx ? currentBounds.data.stopx + conf.diagramMarginX : currentBounds.data.startx;
2320
+ let _y = currentBounds.data.starty;
2321
+ currentBounds.setData(_x, _x, _y, _y);
2322
+ }
2323
+ currentBounds.name = currentBoundary.alias;
2324
+ let currentPersonOrSystemArray = diagObj.db.getC4ShapeArray(currentBoundary.alias);
2325
+ let currentPersonOrSystemKeys = diagObj.db.getC4ShapeKeys(currentBoundary.alias);
2326
+ if (currentPersonOrSystemKeys.length > 0) {
2327
+ drawC4ShapeArray(currentBounds, diagram2, currentPersonOrSystemArray, currentPersonOrSystemKeys);
2328
+ }
2329
+ parentBoundaryAlias = currentBoundary.alias;
2330
+ let nextCurrentBoundaries = diagObj.db.getBoundaries(parentBoundaryAlias);
2331
+ if (nextCurrentBoundaries.length > 0) {
2332
+ drawInsideBoundary(diagram2, parentBoundaryAlias, currentBounds, nextCurrentBoundaries, diagObj);
2333
+ }
2334
+ if (currentBoundary.alias !== "global") {
2335
+ drawBoundary2(diagram2, currentBoundary, currentBounds);
2336
+ }
2337
+ parentBounds.data.stopy = Math.max(currentBounds.data.stopy + conf.c4ShapeMargin, parentBounds.data.stopy);
2338
+ parentBounds.data.stopx = Math.max(currentBounds.data.stopx + conf.c4ShapeMargin, parentBounds.data.stopx);
2339
+ globalBoundaryMaxX = Math.max(globalBoundaryMaxX, parentBounds.data.stopx);
2340
+ globalBoundaryMaxY = Math.max(globalBoundaryMaxY, parentBounds.data.stopy);
2341
+ }
2342
+ }
2343
+ __name(drawInsideBoundary, "drawInsideBoundary");
2344
+ var draw = /* @__PURE__ */ __name(function(_text, id, _version, diagObj) {
2345
+ conf = getConfig2().c4;
2346
+ const securityLevel = getConfig2().securityLevel;
2347
+ let sandboxElement;
2348
+ if (securityLevel === "sandbox") {
2349
+ sandboxElement = select_default("#i" + id);
2350
+ }
2351
+ const root = securityLevel === "sandbox" ? select_default(sandboxElement.nodes()[0].contentDocument.body) : select_default("body");
2352
+ let db = diagObj.db;
2353
+ diagObj.db.setWrap(conf.wrap);
2354
+ c4ShapeInRow2 = db.getC4ShapeInRow();
2355
+ c4BoundaryInRow2 = db.getC4BoundaryInRow();
2356
+ log.debug(`C:${JSON.stringify(conf, null, 2)}`);
2357
+ const diagram2 = securityLevel === "sandbox" ? root.select(`[id="${id}"]`) : select_default(`[id="${id}"]`);
2358
+ svgDraw_default.insertComputerIcon(diagram2, id);
2359
+ svgDraw_default.insertDatabaseIcon(diagram2, id);
2360
+ svgDraw_default.insertClockIcon(diagram2, id);
2361
+ let screenBounds = new Bounds(diagObj);
2362
+ screenBounds.setData(conf.diagramMarginX, conf.diagramMarginX, conf.diagramMarginY, conf.diagramMarginY);
2363
+ screenBounds.data.widthLimit = screen.availWidth;
2364
+ globalBoundaryMaxX = conf.diagramMarginX;
2365
+ globalBoundaryMaxY = conf.diagramMarginY;
2366
+ const title2 = diagObj.db.getTitle();
2367
+ let currentBoundaries = diagObj.db.getBoundaries("");
2368
+ drawInsideBoundary(diagram2, "", screenBounds, currentBoundaries, diagObj);
2369
+ svgDraw_default.insertArrowHead(diagram2, id);
2370
+ svgDraw_default.insertArrowEnd(diagram2, id);
2371
+ svgDraw_default.insertArrowCrossHead(diagram2, id);
2372
+ svgDraw_default.insertArrowFilledHead(diagram2, id);
2373
+ drawRels2(diagram2, diagObj.db.getRels(), diagObj.db.getC4Shape, diagObj, id);
2374
+ screenBounds.data.stopx = globalBoundaryMaxX;
2375
+ screenBounds.data.stopy = globalBoundaryMaxY;
2376
+ const box = screenBounds.data;
2377
+ let boxHeight = box.stopy - box.starty;
2378
+ let height = boxHeight + 2 * conf.diagramMarginY;
2379
+ let boxWidth = box.stopx - box.startx;
2380
+ const width = boxWidth + 2 * conf.diagramMarginX;
2381
+ if (title2) {
2382
+ diagram2.append("text").text(title2).attr("x", (box.stopx - box.startx) / 2 - 4 * conf.diagramMarginX).attr("y", box.starty + conf.diagramMarginY);
2383
+ }
2384
+ configureSvgSize(diagram2, height, width, conf.useMaxWidth);
2385
+ const extraVertForTitle = title2 ? 60 : 0;
2386
+ diagram2.attr("viewBox", box.startx - conf.diagramMarginX + " -" + (conf.diagramMarginY + extraVertForTitle) + " " + width + " " + (height + extraVertForTitle));
2387
+ log.debug(`models:`, box);
2388
+ }, "draw");
2389
+ var c4Renderer_default = {
2390
+ drawPersonOrSystemArray: drawC4ShapeArray,
2391
+ drawBoundary: drawBoundary2,
2392
+ setConf,
2393
+ draw
2394
+ };
2395
+ var getStyles = /* @__PURE__ */ __name((options) => `.person {
2396
+ stroke: ${options.personBorder};
2397
+ fill: ${options.personBkg};
2398
+ }
2399
+ `, "getStyles");
2400
+ var styles_default = getStyles;
2401
+ var diagram = {
2402
+ parser: c4Diagram_default,
2403
+ db: c4Db_default,
2404
+ renderer: c4Renderer_default,
2405
+ styles: styles_default,
2406
+ init: /* @__PURE__ */ __name(({ c4, wrap }) => {
2407
+ c4Renderer_default.setConf(c4);
2408
+ c4Db_default.setWrap(wrap);
2409
+ }, "init")
2410
+ };
2411
+ export {
2412
+ diagram
2413
+ };