@loopstack/loopstack-studio 0.25.0 → 0.25.2

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 (196) hide show
  1. package/dist/components/ai-elements/message.js +2 -2
  2. package/dist/components/ai-elements/reasoning.js +9 -9
  3. package/dist/loopstack-studio.css +1 -1
  4. package/dist/node_modules/@chevrotain/gast/lib/src/helpers.js +2 -5
  5. package/dist/node_modules/@chevrotain/gast/lib/src/model.js +69 -72
  6. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/{architecture-7HQA4BMR.js → architecture-YZFGNWBL.js} +2 -2
  7. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/{chunk-TQ3KTPDO.js → chunk-2KRD3SAO.js} +1 -1
  8. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/{chunk-4F5CHEZ2.js → chunk-67CJDMHE.js} +1 -1
  9. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/{chunk-UMXZTB3W.js → chunk-7N4EOEYR.js} +5 -2
  10. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/{chunk-PL6DKKU2.js → chunk-AA7GKIK3.js} +1 -1
  11. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/chunk-CIAEETIT.js +23 -0
  12. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/{chunk-SJTYNZTY.js → chunk-FOC6F5B3.js} +1 -1
  13. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/chunk-K5T4RW27.js +1197 -0
  14. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/{chunk-FRFDVMJY.js → chunk-KGLVRYIC.js} +1 -1
  15. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/{chunk-B2363JML.js → chunk-LIHQZDEY.js} +1 -1
  16. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/chunk-ORNJ4GCN.js +29 -0
  17. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/{gitGraph-G5XIXVHT.js → gitGraph-7Q5UKJZL.js} +2 -2
  18. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/info-OMHHGYJF.js +3 -0
  19. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/packet-4T2RLAQJ.js +3 -0
  20. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/pie-ZZUOXDRM.js +3 -0
  21. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/radar-PYXPWWZC.js +3 -0
  22. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/treeView-SZITEDCU.js +3 -0
  23. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/treemap-W4RFUUIX.js +3 -0
  24. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/wardley-RL74JXVD.js +3 -0
  25. package/dist/node_modules/@mermaid-js/parser/dist/mermaid-parser.core.js +27 -17
  26. package/dist/node_modules/@upsetjs/venn.js/build/venn.esm.js +903 -0
  27. package/dist/node_modules/@xyflow/react/dist/esm/index.js +76 -75
  28. package/dist/node_modules/@xyflow/system/dist/esm/index.js +30 -28
  29. package/dist/node_modules/chevrotain/lib/src/parse/cst/cst_visitor.js +31 -40
  30. package/dist/node_modules/chevrotain/lib/src/parse/errors_public.js +23 -26
  31. package/dist/node_modules/chevrotain/lib/src/parse/exceptions_public.js +12 -13
  32. package/dist/node_modules/chevrotain/lib/src/parse/grammar/checks.js +181 -205
  33. package/dist/node_modules/chevrotain/lib/src/parse/grammar/first.js +11 -13
  34. package/dist/node_modules/chevrotain/lib/src/parse/grammar/follow.js +12 -13
  35. package/dist/node_modules/chevrotain/lib/src/parse/grammar/gast/gast_resolver_public.js +8 -9
  36. package/dist/node_modules/chevrotain/lib/src/parse/grammar/interpreter.js +176 -183
  37. package/dist/node_modules/chevrotain/lib/src/parse/grammar/llk_lookahead.js +17 -19
  38. package/dist/node_modules/chevrotain/lib/src/parse/grammar/lookahead.js +153 -160
  39. package/dist/node_modules/chevrotain/lib/src/parse/grammar/resolver.js +10 -12
  40. package/dist/node_modules/chevrotain/lib/src/parse/grammar/rest.js +36 -38
  41. package/dist/node_modules/chevrotain/lib/src/parse/parser/parser.js +37 -45
  42. package/dist/node_modules/chevrotain/lib/src/parse/parser/traits/error_handler.js +12 -14
  43. package/dist/node_modules/chevrotain/lib/src/parse/parser/traits/gast_recorder.js +80 -86
  44. package/dist/node_modules/chevrotain/lib/src/parse/parser/traits/lexer_adapter.js +6 -2
  45. package/dist/node_modules/chevrotain/lib/src/parse/parser/traits/looksahead.js +39 -41
  46. package/dist/node_modules/chevrotain/lib/src/parse/parser/traits/perf_tracer.js +7 -8
  47. package/dist/node_modules/chevrotain/lib/src/parse/parser/traits/recognizer_api.js +69 -70
  48. package/dist/node_modules/chevrotain/lib/src/parse/parser/traits/recognizer_engine.js +215 -205
  49. package/dist/node_modules/chevrotain/lib/src/parse/parser/traits/recoverable.js +76 -76
  50. package/dist/node_modules/chevrotain/lib/src/parse/parser/traits/tree_builder.js +29 -39
  51. package/dist/node_modules/chevrotain/lib/src/scan/lexer.js +252 -274
  52. package/dist/node_modules/chevrotain/lib/src/scan/lexer_public.js +93 -106
  53. package/dist/node_modules/chevrotain/lib/src/scan/reg_exp.js +61 -61
  54. package/dist/node_modules/chevrotain/lib/src/scan/tokens.js +31 -41
  55. package/dist/node_modules/chevrotain/lib/src/scan/tokens_public.js +15 -18
  56. package/dist/node_modules/chevrotain-allstar/lib/all-star-lookahead.js +226 -226
  57. package/dist/node_modules/chevrotain-allstar/lib/atn.js +17 -17
  58. package/dist/node_modules/cytoscape/dist/cytoscape.esm.js +17 -14
  59. package/dist/node_modules/dagre-d3-es/src/dagre/greedy-fas.js +19 -19
  60. package/dist/node_modules/dagre-d3-es/src/dagre/layout.js +48 -48
  61. package/dist/node_modules/dagre-d3-es/src/dagre/nesting-graph.js +9 -9
  62. package/dist/node_modules/dagre-d3-es/src/dagre/order/cross-count.js +3 -3
  63. package/dist/node_modules/dagre-d3-es/src/dagre/order/index.js +11 -11
  64. package/dist/node_modules/dagre-d3-es/src/dagre/order/init-order.js +4 -4
  65. package/dist/node_modules/dagre-d3-es/src/dagre/order/resolve-conflicts.js +4 -4
  66. package/dist/node_modules/dagre-d3-es/src/dagre/order/sort-subgraph.js +8 -8
  67. package/dist/node_modules/dagre-d3-es/src/dagre/order/sort.js +5 -5
  68. package/dist/node_modules/dagre-d3-es/src/dagre/position/bk.js +61 -61
  69. package/dist/node_modules/dagre-d3-es/src/dagre/position/index.js +1 -1
  70. package/dist/node_modules/dagre-d3-es/src/dagre/rank/network-simplex.js +25 -25
  71. package/dist/node_modules/dagre-d3-es/src/dagre/rank/util.js +8 -8
  72. package/dist/node_modules/dagre-d3-es/src/dagre/util.js +48 -48
  73. package/dist/node_modules/dagre-d3-es/src/graphlib/graph.js +109 -109
  74. package/dist/node_modules/dagre-d3-es/src/graphlib/json.js +17 -17
  75. package/dist/node_modules/dompurify/dist/purify.es.js +67 -67
  76. package/dist/node_modules/katex/dist/katex.js +1256 -1209
  77. package/dist/node_modules/khroma/dist/methods/transparentize.js +3 -0
  78. package/dist/node_modules/lodash-es/_baseClone.js +2 -2
  79. package/dist/node_modules/lodash-es/_baseMatchesProperty.js +6 -6
  80. package/dist/node_modules/lodash-es/_baseToString.js +1 -1
  81. package/dist/node_modules/lodash-es/_baseUniq.js +1 -1
  82. package/dist/node_modules/lodash-es/_createSet.js +1 -1
  83. package/dist/node_modules/lodash-es/_getAllKeys.js +2 -2
  84. package/dist/node_modules/lodash-es/_getAllKeysIn.js +1 -1
  85. package/dist/node_modules/lodash-es/findIndex.js +2 -2
  86. package/dist/node_modules/lodash-es/flatMap.js +1 -1
  87. package/dist/node_modules/lodash-es/forEach.js +1 -1
  88. package/dist/node_modules/lodash-es/max.js +1 -1
  89. package/dist/node_modules/lodash-es/min.js +1 -1
  90. package/dist/node_modules/lodash-es/minBy.js +1 -1
  91. package/dist/node_modules/lodash-es/reduce.js +1 -1
  92. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/architectureDiagram-Q4EWVU46.js +691 -0
  93. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{blockDiagram-VD42YOAC.js → blockDiagram-DXYQGD6D.js} +183 -157
  94. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{c4Diagram-YG6GDRKO.js → c4Diagram-AHTNJAMY.js} +65 -63
  95. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-336JU56O.js +47 -0
  96. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{chunk-EXTU4WIE.js → chunk-426QAEUC.js} +1 -1
  97. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{chunk-B4BG7PRW.js → chunk-4TB4RGXK.js} +533 -393
  98. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-5FUZZQ4R.js +3638 -0
  99. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{chunk-S3R3BYOJ.js → chunk-5PVQY5BW.js} +1 -1
  100. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{chunk-HN2XXSSU.js → chunk-BSJP7CBP.js} +20 -14
  101. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{chunk-QN33PNHL.js → chunk-EDXVE4YY.js} +1 -1
  102. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-ENJZ2VHE.js +568 -0
  103. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-ICPOFSXX.js +2320 -0
  104. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{chunk-DI55MBZ5.js → chunk-OYMX7WX6.js} +35 -21
  105. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-U2HBQHQK.js +272 -0
  106. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{chunk-ATLVNIR6.js → chunk-X2U36JSP.js} +1 -1
  107. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{chunk-MI3HLSF2.js → chunk-XPW4576I.js} +11 -7
  108. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-YZCP3GAM.js +60 -0
  109. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-ZZ45TVLE.js +30 -0
  110. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{classDiagram-2ON5EDUG.js → classDiagram-6PBFFD2Q.js} +12 -11
  111. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{classDiagram-v2-WZHVMYZB.js → classDiagram-v2-HSJHXN6E.js} +12 -11
  112. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{dagre-6UL2VRFP.js → dagre-KV5264BT.js} +8 -8
  113. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/diagram-5BDNPKRD.js +99 -0
  114. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{diagram-PSM6KHXK.js → diagram-G4DWMVQ6.js} +20 -23
  115. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/diagram-MMDJMWI5.js +211 -0
  116. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{diagram-S2PKOQOG.js → diagram-TYMM5635.js} +4 -4
  117. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{erDiagram-Q2GNP2WA.js → erDiagram-SMLLAGMA.js} +486 -386
  118. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{flowDiagram-NV44I4VS.js → flowDiagram-DWJPFMVM.js} +915 -898
  119. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{ganttDiagram-JELNMOA3.js → ganttDiagram-T4ZO3ILL.js} +59 -29
  120. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/gitGraphDiagram-UUTBAWPF.js +728 -0
  121. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/infoDiagram-42DDH7IO.js +17 -0
  122. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/ishikawaDiagram-UXIWVN3A.js +714 -0
  123. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{journeyDiagram-XKPGCS4Q.js → journeyDiagram-VCZTEJTY.js} +32 -32
  124. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{kanban-definition-3W4ZIXB7.js → kanban-definition-6JOO6SKY.js} +13 -9
  125. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{mindmap-definition-VGOIOE7T.js → mindmap-definition-QFDTVHPH.js} +105 -59
  126. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/pieDiagram-DEJITSTG.js +117 -0
  127. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{quadrantDiagram-AYHSOK5B.js → quadrantDiagram-34T5L4WZ.js} +1 -1
  128. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{requirementDiagram-UZGBJVZJ.js → requirementDiagram-MS252O5E.js} +49 -19
  129. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{sankeyDiagram-TZEHDZUN.js → sankeyDiagram-XADWPNL6.js} +1 -1
  130. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/sequenceDiagram-FGHM5R23.js +4155 -0
  131. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{stateDiagram-FKZM4ZOC.js → stateDiagram-FHFEXIEX.js} +12 -12
  132. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{stateDiagram-v2-4FDKWEC3.js → stateDiagram-v2-QKLJ7IA2.js} +11 -11
  133. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/timeline-definition-GMOUNBTQ.js +1071 -0
  134. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/vennDiagram-DHZGUBPP.js +959 -0
  135. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/wardleyDiagram-NUSXRM2D.js +574 -0
  136. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{xychartDiagram-PRI3JC2R.js → xychartDiagram-5P7HB3ND.js} +38 -35
  137. package/dist/node_modules/mermaid/dist/mermaid.core.js +235 -192
  138. package/dist/node_modules/nanoid/url-alphabet/index.js +1 -1
  139. package/dist/node_modules/remend/dist/index.js +333 -264
  140. package/dist/node_modules/streamdown/dist/chunk-BO2N2NFS.js +2498 -0
  141. package/dist/node_modules/streamdown/dist/highlighted-body-OFNGDK62.js +35 -0
  142. package/dist/node_modules/streamdown/dist/index.js +1 -1
  143. package/dist/node_modules/streamdown/dist/mermaid-GHXKKRXX.js +3 -0
  144. package/dist/node_modules/streamdown/node_modules/marked/lib/marked.esm.js +672 -667
  145. package/dist/pages/DashboardPage.js +3 -3
  146. package/package.json +2 -2
  147. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/chunk-TCCFYFTB.js +0 -787
  148. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/info-VBDWY6EO.js +0 -3
  149. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/packet-DYOGHKS2.js +0 -3
  150. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/pie-VRWISCQL.js +0 -3
  151. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/radar-ZZBFDIW7.js +0 -3
  152. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/treemap-GDKQZRPO.js +0 -3
  153. package/dist/node_modules/chevrotain/lib/src/parse/parser/traits/context_assist.js +0 -16
  154. package/dist/node_modules/lodash-es/_arrayAggregator.js +0 -9
  155. package/dist/node_modules/lodash-es/_arrayEvery.js +0 -6
  156. package/dist/node_modules/lodash-es/_baseAggregator.js +0 -8
  157. package/dist/node_modules/lodash-es/_baseDifference.js +0 -22
  158. package/dist/node_modules/lodash-es/_baseEvery.js +0 -9
  159. package/dist/node_modules/lodash-es/_baseIsRegExp.js +0 -8
  160. package/dist/node_modules/lodash-es/_baseSlice.js +0 -8
  161. package/dist/node_modules/lodash-es/_baseSome.js +0 -9
  162. package/dist/node_modules/lodash-es/_createAggregator.js +0 -12
  163. package/dist/node_modules/lodash-es/assign.js +0 -14
  164. package/dist/node_modules/lodash-es/compact.js +0 -9
  165. package/dist/node_modules/lodash-es/difference.js +0 -8
  166. package/dist/node_modules/lodash-es/drop.js +0 -8
  167. package/dist/node_modules/lodash-es/dropRight.js +0 -8
  168. package/dist/node_modules/lodash-es/every.js +0 -11
  169. package/dist/node_modules/lodash-es/groupBy.js +0 -6
  170. package/dist/node_modules/lodash-es/head.js +0 -5
  171. package/dist/node_modules/lodash-es/includes.js +0 -13
  172. package/dist/node_modules/lodash-es/indexOf.js +0 -11
  173. package/dist/node_modules/lodash-es/isRegExp.js +0 -5
  174. package/dist/node_modules/lodash-es/negate.js +0 -16
  175. package/dist/node_modules/lodash-es/pickBy.js +0 -15
  176. package/dist/node_modules/lodash-es/reject.js +0 -10
  177. package/dist/node_modules/lodash-es/some.js +0 -11
  178. package/dist/node_modules/lodash-es/uniq.js +0 -6
  179. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/architectureDiagram-VXUJARFQ.js +0 -673
  180. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-ABZYJK2D.js +0 -1547
  181. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-CVBHYZKI.js +0 -10
  182. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-DR5Q36YT.js +0 -135
  183. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-JA3XYJ7Z.js +0 -247
  184. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-JZLCHNYA.js +0 -3516
  185. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-N4CR4FBY.js +0 -39
  186. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-QXUST7PY.js +0 -497
  187. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-TZMSLE5B.js +0 -55
  188. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/diagram-QEK2KX5R.js +0 -211
  189. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/gitGraphDiagram-V2S2FVAM.js +0 -621
  190. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/infoDiagram-HS3SLOUP.js +0 -18
  191. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/pieDiagram-ADFJNKIX.js +0 -117
  192. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/sequenceDiagram-WL72ISMW.js +0 -3560
  193. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/timeline-definition-IT6M3QCI.js +0 -833
  194. package/dist/node_modules/streamdown/dist/chunk-RLXIAIE6.js +0 -2189
  195. package/dist/node_modules/streamdown/dist/highlighted-body-B3W2YXNL.js +0 -33
  196. package/dist/node_modules/streamdown/dist/mermaid-3ZIDBTTL.js +0 -3
@@ -1,673 +0,0 @@
1
- import { __toESM } from "../../../../../_virtual/rolldown_runtime.js";
2
- import { __name, log } from "./chunk-AGHRB4JF.js";
3
- import { clear, defaultConfig_default, getAccDescription, getAccTitle, getConfig, getConfig2, getDiagramTitle, sanitizeText, setAccDescription, setAccTitle, setDiagramTitle, setupGraphViewbox } from "./chunk-ABZYJK2D.js";
4
- import select_default from "../../../../d3-selection/src/select.js";
5
- import "../../../../d3/src/index.js";
6
- import { selectSvgElement } from "./chunk-EXTU4WIE.js";
7
- import { cleanAndMerge, getEdgeId } from "./chunk-S3R3BYOJ.js";
8
- import { createText, getIconSVG, registerIconPacks, unknownIcon } from "./chunk-JA3XYJ7Z.js";
9
- import { populateCommonDb } from "./chunk-4BX2VUAB.js";
10
- import { parse } from "../../../../@mermaid-js/parser/dist/mermaid-parser.core.js";
11
- import { cytoscape } from "../../../../cytoscape/dist/cytoscape.esm.js";
12
- import { require_cytoscape_fcose } from "../../../../cytoscape-fcose/cytoscape-fcose.js";
13
- var import_cytoscape_fcose = /* @__PURE__ */ __toESM(require_cytoscape_fcose(), 1), ArchitectureDirectionName = {
14
- L: "left",
15
- R: "right",
16
- T: "top",
17
- B: "bottom"
18
- }, ArchitectureDirectionArrow = {
19
- L: /* @__PURE__ */ __name((n) => `${n},${n / 2} 0,${n} 0,0`, "L"),
20
- R: /* @__PURE__ */ __name((n) => `0,${n / 2} ${n},0 ${n},${n}`, "R"),
21
- T: /* @__PURE__ */ __name((n) => `0,0 ${n},0 ${n / 2},${n}`, "T"),
22
- B: /* @__PURE__ */ __name((n) => `${n / 2},0 ${n},${n} 0,${n}`, "B")
23
- }, ArchitectureDirectionArrowShift = {
24
- L: /* @__PURE__ */ __name((n, j) => n - j + 2, "L"),
25
- R: /* @__PURE__ */ __name((n, j) => n - 2, "R"),
26
- T: /* @__PURE__ */ __name((n, j) => n - j + 2, "T"),
27
- B: /* @__PURE__ */ __name((n, j) => n - 2, "B")
28
- }, getOppositeArchitectureDirection = /* @__PURE__ */ __name(function(n) {
29
- return isArchitectureDirectionX(n) ? n === "L" ? "R" : "L" : n === "T" ? "B" : "T";
30
- }, "getOppositeArchitectureDirection"), isArchitectureDirection = /* @__PURE__ */ __name(function(n) {
31
- let j = n;
32
- return j === "L" || j === "R" || j === "T" || j === "B";
33
- }, "isArchitectureDirection"), isArchitectureDirectionX = /* @__PURE__ */ __name(function(n) {
34
- let j = n;
35
- return j === "L" || j === "R";
36
- }, "isArchitectureDirectionX"), isArchitectureDirectionY = /* @__PURE__ */ __name(function(n) {
37
- let j = n;
38
- return j === "T" || j === "B";
39
- }, "isArchitectureDirectionY"), isArchitectureDirectionXY = /* @__PURE__ */ __name(function(n, j) {
40
- let M = isArchitectureDirectionX(n) && isArchitectureDirectionY(j), N = isArchitectureDirectionY(n) && isArchitectureDirectionX(j);
41
- return M || N;
42
- }, "isArchitectureDirectionXY"), isArchitecturePairXY = /* @__PURE__ */ __name(function(n) {
43
- let j = n[0], M = n[1], N = isArchitectureDirectionX(j) && isArchitectureDirectionY(M), P = isArchitectureDirectionY(j) && isArchitectureDirectionX(M);
44
- return N || P;
45
- }, "isArchitecturePairXY"), isValidArchitectureDirectionPair = /* @__PURE__ */ __name(function(n) {
46
- return n !== "LL" && n !== "RR" && n !== "TT" && n !== "BB";
47
- }, "isValidArchitectureDirectionPair"), getArchitectureDirectionPair = /* @__PURE__ */ __name(function(n, j) {
48
- let M = `${n}${j}`;
49
- return isValidArchitectureDirectionPair(M) ? M : void 0;
50
- }, "getArchitectureDirectionPair"), shiftPositionByArchitectureDirectionPair = /* @__PURE__ */ __name(function([n, j], M) {
51
- let N = M[0], P = M[1];
52
- return isArchitectureDirectionX(N) ? isArchitectureDirectionY(P) ? [n + (N === "L" ? -1 : 1), j + (P === "T" ? 1 : -1)] : [n + (N === "L" ? -1 : 1), j] : isArchitectureDirectionX(P) ? [n + (P === "L" ? 1 : -1), j + (N === "T" ? 1 : -1)] : [n, j + (N === "T" ? 1 : -1)];
53
- }, "shiftPositionByArchitectureDirectionPair"), getArchitectureDirectionXYFactors = /* @__PURE__ */ __name(function(n) {
54
- return n === "LT" || n === "TL" ? [1, 1] : n === "BL" || n === "LB" ? [1, -1] : n === "BR" || n === "RB" ? [-1, -1] : [-1, 1];
55
- }, "getArchitectureDirectionXYFactors"), getArchitectureDirectionAlignment = /* @__PURE__ */ __name(function(n, j) {
56
- return isArchitectureDirectionXY(n, j) ? "bend" : isArchitectureDirectionX(n) ? "horizontal" : "vertical";
57
- }, "getArchitectureDirectionAlignment"), isArchitectureService = /* @__PURE__ */ __name(function(n) {
58
- return n.type === "service";
59
- }, "isArchitectureService"), isArchitectureJunction = /* @__PURE__ */ __name(function(n) {
60
- return n.type === "junction";
61
- }, "isArchitectureJunction"), edgeData = /* @__PURE__ */ __name((n) => n.data(), "edgeData"), nodeData = /* @__PURE__ */ __name((n) => n.data(), "nodeData"), DEFAULT_ARCHITECTURE_CONFIG = defaultConfig_default.architecture, ArchitectureDB = class {
62
- constructor() {
63
- this.nodes = {}, this.groups = {}, this.edges = [], this.registeredIds = {}, this.elements = {}, this.setAccTitle = setAccTitle, this.getAccTitle = getAccTitle, this.setDiagramTitle = setDiagramTitle, this.getDiagramTitle = getDiagramTitle, this.getAccDescription = getAccDescription, this.setAccDescription = setAccDescription, this.clear();
64
- }
65
- static #e = __name(this, "ArchitectureDB");
66
- clear() {
67
- this.nodes = {}, this.groups = {}, this.edges = [], this.registeredIds = {}, this.dataStructures = void 0, this.elements = {}, clear();
68
- }
69
- addService({ id: n, icon: j, in: M, title: N, iconText: P }) {
70
- if (this.registeredIds[n] !== void 0) throw Error(`The service id [${n}] is already in use by another ${this.registeredIds[n]}`);
71
- if (M !== void 0) {
72
- if (n === M) throw Error(`The service [${n}] cannot be placed within itself`);
73
- if (this.registeredIds[M] === void 0) throw Error(`The service [${n}]'s parent does not exist. Please make sure the parent is created before this service`);
74
- if (this.registeredIds[M] === "node") throw Error(`The service [${n}]'s parent is not a group`);
75
- }
76
- this.registeredIds[n] = "node", this.nodes[n] = {
77
- id: n,
78
- type: "service",
79
- icon: j,
80
- iconText: P,
81
- title: N,
82
- edges: [],
83
- in: M
84
- };
85
- }
86
- getServices() {
87
- return Object.values(this.nodes).filter(isArchitectureService);
88
- }
89
- addJunction({ id: n, in: j }) {
90
- this.registeredIds[n] = "node", this.nodes[n] = {
91
- id: n,
92
- type: "junction",
93
- edges: [],
94
- in: j
95
- };
96
- }
97
- getJunctions() {
98
- return Object.values(this.nodes).filter(isArchitectureJunction);
99
- }
100
- getNodes() {
101
- return Object.values(this.nodes);
102
- }
103
- getNode(n) {
104
- return this.nodes[n] ?? null;
105
- }
106
- addGroup({ id: n, icon: j, in: M, title: N }) {
107
- if (this.registeredIds?.[n] !== void 0) throw Error(`The group id [${n}] is already in use by another ${this.registeredIds[n]}`);
108
- if (M !== void 0) {
109
- if (n === M) throw Error(`The group [${n}] cannot be placed within itself`);
110
- if (this.registeredIds?.[M] === void 0) throw Error(`The group [${n}]'s parent does not exist. Please make sure the parent is created before this group`);
111
- if (this.registeredIds?.[M] === "node") throw Error(`The group [${n}]'s parent is not a group`);
112
- }
113
- this.registeredIds[n] = "group", this.groups[n] = {
114
- id: n,
115
- icon: j,
116
- title: N,
117
- in: M
118
- };
119
- }
120
- getGroups() {
121
- return Object.values(this.groups);
122
- }
123
- addEdge({ lhsId: n, rhsId: j, lhsDir: M, rhsDir: N, lhsInto: P, rhsInto: F, lhsGroup: I, rhsGroup: L, title: R }) {
124
- if (!isArchitectureDirection(M)) throw Error(`Invalid direction given for left hand side of edge ${n}--${j}. Expected (L,R,T,B) got ${String(M)}`);
125
- if (!isArchitectureDirection(N)) throw Error(`Invalid direction given for right hand side of edge ${n}--${j}. Expected (L,R,T,B) got ${String(N)}`);
126
- if (this.nodes[n] === void 0 && this.groups[n] === void 0) throw Error(`The left-hand id [${n}] does not yet exist. Please create the service/group before declaring an edge to it.`);
127
- if (this.nodes[j] === void 0 && this.groups[j] === void 0) throw Error(`The right-hand id [${j}] does not yet exist. Please create the service/group before declaring an edge to it.`);
128
- let z = this.nodes[n].in, B = this.nodes[j].in;
129
- if (I && z && B && z == B) throw Error(`The left-hand id [${n}] is modified to traverse the group boundary, but the edge does not pass through two groups.`);
130
- if (L && z && B && z == B) throw Error(`The right-hand id [${j}] is modified to traverse the group boundary, but the edge does not pass through two groups.`);
131
- let V = {
132
- lhsId: n,
133
- lhsDir: M,
134
- lhsInto: P,
135
- lhsGroup: I,
136
- rhsId: j,
137
- rhsDir: N,
138
- rhsInto: F,
139
- rhsGroup: L,
140
- title: R
141
- };
142
- this.edges.push(V), this.nodes[n] && this.nodes[j] && (this.nodes[n].edges.push(this.edges[this.edges.length - 1]), this.nodes[j].edges.push(this.edges[this.edges.length - 1]));
143
- }
144
- getEdges() {
145
- return this.edges;
146
- }
147
- getDataStructures() {
148
- if (this.dataStructures === void 0) {
149
- let n = {}, M = Object.entries(this.nodes).reduce((j, [M, N]) => (j[M] = N.edges.reduce((j, N) => {
150
- let P = this.getNode(N.lhsId)?.in, F = this.getNode(N.rhsId)?.in;
151
- if (P && F && P !== F) {
152
- let j = getArchitectureDirectionAlignment(N.lhsDir, N.rhsDir);
153
- j !== "bend" && (n[P] ??= {}, n[P][F] = j, n[F] ??= {}, n[F][P] = j);
154
- }
155
- if (N.lhsId === M) {
156
- let n = getArchitectureDirectionPair(N.lhsDir, N.rhsDir);
157
- n && (j[n] = N.rhsId);
158
- } else {
159
- let n = getArchitectureDirectionPair(N.rhsDir, N.lhsDir);
160
- n && (j[n] = N.lhsId);
161
- }
162
- return j;
163
- }, {}), j), {}), N = Object.keys(M)[0], P = { [N]: 1 }, F = Object.keys(M).reduce((n, j) => j === N ? n : {
164
- ...n,
165
- [j]: 1
166
- }, {}), I = /* @__PURE__ */ __name((n) => {
167
- let j = { [n]: [0, 0] }, N = [n];
168
- for (; N.length > 0;) {
169
- let n = N.shift();
170
- if (n) {
171
- P[n] = 1, delete F[n];
172
- let I = M[n], [L, R] = j[n];
173
- Object.entries(I).forEach(([n, M]) => {
174
- P[M] || (j[M] = shiftPositionByArchitectureDirectionPair([L, R], n), N.push(M));
175
- });
176
- }
177
- }
178
- return j;
179
- }, "BFS"), L = [I(N)];
180
- for (; Object.keys(F).length > 0;) L.push(I(Object.keys(F)[0]));
181
- this.dataStructures = {
182
- adjList: M,
183
- spatialMaps: L,
184
- groupAlignments: n
185
- };
186
- }
187
- return this.dataStructures;
188
- }
189
- setElementForId(n, j) {
190
- this.elements[n] = j;
191
- }
192
- getElementById(n) {
193
- return this.elements[n];
194
- }
195
- getConfig() {
196
- return cleanAndMerge({
197
- ...DEFAULT_ARCHITECTURE_CONFIG,
198
- ...getConfig().architecture
199
- });
200
- }
201
- getConfigField(n) {
202
- return this.getConfig()[n];
203
- }
204
- }, populateDb = /* @__PURE__ */ __name((n, j) => {
205
- populateCommonDb(n, j), n.groups.map((n) => j.addGroup(n)), n.services.map((n) => j.addService({
206
- ...n,
207
- type: "service"
208
- })), n.junctions.map((n) => j.addJunction({
209
- ...n,
210
- type: "junction"
211
- })), n.edges.map((n) => j.addEdge(n));
212
- }, "populateDb"), parser = {
213
- parser: { yy: void 0 },
214
- parse: /* @__PURE__ */ __name(async (n) => {
215
- let j = await parse("architecture", n);
216
- log.debug(j);
217
- let N = parser.parser?.yy;
218
- if (!(N instanceof ArchitectureDB)) throw Error("parser.parser?.yy was not a ArchitectureDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");
219
- populateDb(j, N);
220
- }, "parse")
221
- }, architectureStyles_default = /* @__PURE__ */ __name((n) => `
222
- .edge {
223
- stroke-width: ${n.archEdgeWidth};
224
- stroke: ${n.archEdgeColor};
225
- fill: none;
226
- }
227
-
228
- .arrow {
229
- fill: ${n.archEdgeArrowColor};
230
- }
231
-
232
- .node-bkg {
233
- fill: none;
234
- stroke: ${n.archGroupBorderColor};
235
- stroke-width: ${n.archGroupBorderWidth};
236
- stroke-dasharray: 8;
237
- }
238
- .node-icon-text {
239
- display: flex;
240
- align-items: center;
241
- }
242
-
243
- .node-icon-text > div {
244
- color: #fff;
245
- margin: 1px;
246
- height: fit-content;
247
- text-align: center;
248
- overflow: hidden;
249
- display: -webkit-box;
250
- -webkit-box-orient: vertical;
251
- }
252
- `, "getStyles"), wrapIcon = /* @__PURE__ */ __name((n) => `<g><rect width="80" height="80" style="fill: #087ebf; stroke-width: 0px;"/>${n}</g>`, "wrapIcon"), architectureIcons = {
253
- prefix: "mermaid-architecture",
254
- height: 80,
255
- width: 80,
256
- icons: {
257
- database: { body: wrapIcon("<path id=\"b\" data-name=\"4\" d=\"m20,57.86c0,3.94,8.95,7.14,20,7.14s20-3.2,20-7.14\" style=\"fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;\"/><path id=\"c\" data-name=\"3\" d=\"m20,45.95c0,3.94,8.95,7.14,20,7.14s20-3.2,20-7.14\" style=\"fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;\"/><path id=\"d\" data-name=\"2\" d=\"m20,34.05c0,3.94,8.95,7.14,20,7.14s20-3.2,20-7.14\" style=\"fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;\"/><ellipse id=\"e\" data-name=\"1\" cx=\"40\" cy=\"22.14\" rx=\"20\" ry=\"7.14\" style=\"fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;\"/><line x1=\"20\" y1=\"57.86\" x2=\"20\" y2=\"22.14\" style=\"fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;\"/><line x1=\"60\" y1=\"57.86\" x2=\"60\" y2=\"22.14\" style=\"fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;\"/>") },
258
- server: { body: wrapIcon("<rect x=\"17.5\" y=\"17.5\" width=\"45\" height=\"45\" rx=\"2\" ry=\"2\" style=\"fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;\"/><line x1=\"17.5\" y1=\"32.5\" x2=\"62.5\" y2=\"32.5\" style=\"fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;\"/><line x1=\"17.5\" y1=\"47.5\" x2=\"62.5\" y2=\"47.5\" style=\"fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;\"/><g><path d=\"m56.25,25c0,.27-.45.5-1,.5h-10.5c-.55,0-1-.23-1-.5s.45-.5,1-.5h10.5c.55,0,1,.23,1,.5Z\" style=\"fill: #fff; stroke-width: 0px;\"/><path d=\"m56.25,25c0,.27-.45.5-1,.5h-10.5c-.55,0-1-.23-1-.5s.45-.5,1-.5h10.5c.55,0,1,.23,1,.5Z\" style=\"fill: none; stroke: #fff; stroke-miterlimit: 10;\"/></g><g><path d=\"m56.25,40c0,.27-.45.5-1,.5h-10.5c-.55,0-1-.23-1-.5s.45-.5,1-.5h10.5c.55,0,1,.23,1,.5Z\" style=\"fill: #fff; stroke-width: 0px;\"/><path d=\"m56.25,40c0,.27-.45.5-1,.5h-10.5c-.55,0-1-.23-1-.5s.45-.5,1-.5h10.5c.55,0,1,.23,1,.5Z\" style=\"fill: none; stroke: #fff; stroke-miterlimit: 10;\"/></g><g><path d=\"m56.25,55c0,.27-.45.5-1,.5h-10.5c-.55,0-1-.23-1-.5s.45-.5,1-.5h10.5c.55,0,1,.23,1,.5Z\" style=\"fill: #fff; stroke-width: 0px;\"/><path d=\"m56.25,55c0,.27-.45.5-1,.5h-10.5c-.55,0-1-.23-1-.5s.45-.5,1-.5h10.5c.55,0,1,.23,1,.5Z\" style=\"fill: none; stroke: #fff; stroke-miterlimit: 10;\"/></g><g><circle cx=\"32.5\" cy=\"25\" r=\".75\" style=\"fill: #fff; stroke: #fff; stroke-miterlimit: 10;\"/><circle cx=\"27.5\" cy=\"25\" r=\".75\" style=\"fill: #fff; stroke: #fff; stroke-miterlimit: 10;\"/><circle cx=\"22.5\" cy=\"25\" r=\".75\" style=\"fill: #fff; stroke: #fff; stroke-miterlimit: 10;\"/></g><g><circle cx=\"32.5\" cy=\"40\" r=\".75\" style=\"fill: #fff; stroke: #fff; stroke-miterlimit: 10;\"/><circle cx=\"27.5\" cy=\"40\" r=\".75\" style=\"fill: #fff; stroke: #fff; stroke-miterlimit: 10;\"/><circle cx=\"22.5\" cy=\"40\" r=\".75\" style=\"fill: #fff; stroke: #fff; stroke-miterlimit: 10;\"/></g><g><circle cx=\"32.5\" cy=\"55\" r=\".75\" style=\"fill: #fff; stroke: #fff; stroke-miterlimit: 10;\"/><circle cx=\"27.5\" cy=\"55\" r=\".75\" style=\"fill: #fff; stroke: #fff; stroke-miterlimit: 10;\"/><circle cx=\"22.5\" cy=\"55\" r=\".75\" style=\"fill: #fff; stroke: #fff; stroke-miterlimit: 10;\"/></g>") },
259
- disk: { body: wrapIcon("<rect x=\"20\" y=\"15\" width=\"40\" height=\"50\" rx=\"1\" ry=\"1\" style=\"fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;\"/><ellipse cx=\"24\" cy=\"19.17\" rx=\".8\" ry=\".83\" style=\"fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;\"/><ellipse cx=\"56\" cy=\"19.17\" rx=\".8\" ry=\".83\" style=\"fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;\"/><ellipse cx=\"24\" cy=\"60.83\" rx=\".8\" ry=\".83\" style=\"fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;\"/><ellipse cx=\"56\" cy=\"60.83\" rx=\".8\" ry=\".83\" style=\"fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;\"/><ellipse cx=\"40\" cy=\"33.75\" rx=\"14\" ry=\"14.58\" style=\"fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;\"/><ellipse cx=\"40\" cy=\"33.75\" rx=\"4\" ry=\"4.17\" style=\"fill: #fff; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;\"/><path d=\"m37.51,42.52l-4.83,13.22c-.26.71-1.1,1.02-1.76.64l-4.18-2.42c-.66-.38-.81-1.26-.33-1.84l9.01-10.8c.88-1.05,2.56-.08,2.09,1.2Z\" style=\"fill: #fff; stroke-width: 0px;\"/>") },
260
- internet: { body: wrapIcon("<circle cx=\"40\" cy=\"40\" r=\"22.5\" style=\"fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;\"/><line x1=\"40\" y1=\"17.5\" x2=\"40\" y2=\"62.5\" style=\"fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;\"/><line x1=\"17.5\" y1=\"40\" x2=\"62.5\" y2=\"40\" style=\"fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;\"/><path d=\"m39.99,17.51c-15.28,11.1-15.28,33.88,0,44.98\" style=\"fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;\"/><path d=\"m40.01,17.51c15.28,11.1,15.28,33.88,0,44.98\" style=\"fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;\"/><line x1=\"19.75\" y1=\"30.1\" x2=\"60.25\" y2=\"30.1\" style=\"fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;\"/><line x1=\"19.75\" y1=\"49.9\" x2=\"60.25\" y2=\"49.9\" style=\"fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;\"/>") },
261
- cloud: { body: wrapIcon("<path d=\"m65,47.5c0,2.76-2.24,5-5,5H20c-2.76,0-5-2.24-5-5,0-1.87,1.03-3.51,2.56-4.36-.04-.21-.06-.42-.06-.64,0-2.6,2.48-4.74,5.65-4.97,1.65-4.51,6.34-7.76,11.85-7.76.86,0,1.69.08,2.5.23,2.09-1.57,4.69-2.5,7.5-2.5,6.1,0,11.19,4.38,12.28,10.17,2.14.56,3.72,2.51,3.72,4.83,0,.03,0,.07-.01.1,2.29.46,4.01,2.48,4.01,4.9Z\" style=\"fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;\"/>") },
262
- unknown: unknownIcon,
263
- blank: { body: wrapIcon("") }
264
- }
265
- }, drawEdges = /* @__PURE__ */ __name(async function(n, j, M) {
266
- let N = M.getConfigField("padding"), P = M.getConfigField("iconSize"), F = P / 2, I = P / 6, L = I / 2;
267
- await Promise.all(j.edges().map(async (j) => {
268
- let { source: P, sourceDir: z, sourceArrow: B, sourceGroup: V, target: H, targetDir: U, targetArrow: W, targetGroup: G, label: K } = edgeData(j), { x: q, y: J } = j[0].sourceEndpoint(), { x: Y, y: X } = j[0].midpoint(), { x: Z, y: Q } = j[0].targetEndpoint(), $ = N + 4;
269
- if (V && (isArchitectureDirectionX(z) ? q += z === "L" ? -$ : $ : J += z === "T" ? -$ : $ + 18), G && (isArchitectureDirectionX(U) ? Z += U === "L" ? -$ : $ : Q += U === "T" ? -$ : $ + 18), !V && M.getNode(P)?.type === "junction" && (isArchitectureDirectionX(z) ? q += z === "L" ? F : -F : J += z === "T" ? F : -F), !G && M.getNode(H)?.type === "junction" && (isArchitectureDirectionX(U) ? Z += U === "L" ? F : -F : Q += U === "T" ? F : -F), j[0]._private.rscratch) {
270
- let j = n.insert("g");
271
- if (j.insert("path").attr("d", `M ${q},${J} L ${Y},${X} L${Z},${Q} `).attr("class", "edge").attr("id", getEdgeId(P, H, { prefix: "L" })), B) {
272
- let n = isArchitectureDirectionX(z) ? ArchitectureDirectionArrowShift[z](q, I) : q - L, M = isArchitectureDirectionY(z) ? ArchitectureDirectionArrowShift[z](J, I) : J - L;
273
- j.insert("polygon").attr("points", ArchitectureDirectionArrow[z](I)).attr("transform", `translate(${n},${M})`).attr("class", "arrow");
274
- }
275
- if (W) {
276
- let n = isArchitectureDirectionX(U) ? ArchitectureDirectionArrowShift[U](Z, I) : Z - L, M = isArchitectureDirectionY(U) ? ArchitectureDirectionArrowShift[U](Q, I) : Q - L;
277
- j.insert("polygon").attr("points", ArchitectureDirectionArrow[U](I)).attr("transform", `translate(${n},${M})`).attr("class", "arrow");
278
- }
279
- if (K) {
280
- let n = isArchitectureDirectionXY(z, U) ? "XY" : isArchitectureDirectionX(z) ? "X" : "Y", M = 0;
281
- M = n === "X" ? Math.abs(q - Z) : n === "Y" ? Math.abs(J - Q) / 1.5 : Math.abs(q - Z) / 2;
282
- let N = j.append("g");
283
- if (await createText(N, K, {
284
- useHtmlLabels: !1,
285
- width: M,
286
- classes: "architecture-service-label"
287
- }, getConfig2()), N.attr("dy", "1em").attr("alignment-baseline", "middle").attr("dominant-baseline", "middle").attr("text-anchor", "middle"), n === "X") N.attr("transform", "translate(" + Y + ", " + X + ")");
288
- else if (n === "Y") N.attr("transform", "translate(" + Y + ", " + X + ") rotate(-90)");
289
- else if (n === "XY") {
290
- let n = getArchitectureDirectionPair(z, U);
291
- if (n && isArchitecturePairXY(n)) {
292
- let j = N.node().getBoundingClientRect(), [M, P] = getArchitectureDirectionXYFactors(n);
293
- N.attr("dominant-baseline", "auto").attr("transform", `rotate(${-1 * M * P * 45})`);
294
- let F = N.node().getBoundingClientRect();
295
- N.attr("transform", `
296
- translate(${Y}, ${X - j.height / 2})
297
- translate(${M * F.width / 2}, ${P * F.height / 2})
298
- rotate(${-1 * M * P * 45}, 0, ${j.height / 2})
299
- `);
300
- }
301
- }
302
- }
303
- }
304
- }));
305
- }, "drawEdges"), drawGroups = /* @__PURE__ */ __name(async function(n, j, M) {
306
- let N = M.getConfigField("padding") * .75, P = M.getConfigField("fontSize"), F = M.getConfigField("iconSize") / 2;
307
- await Promise.all(j.nodes().map(async (j) => {
308
- let I = nodeData(j);
309
- if (I.type === "group") {
310
- let { h: L, w: z, x1: B, y1: V } = j.boundingBox(), H = n.append("rect");
311
- H.attr("id", `group-${I.id}`).attr("x", B + F).attr("y", V + F).attr("width", z).attr("height", L).attr("class", "node-bkg");
312
- let U = n.append("g"), W = B, G = V;
313
- if (I.icon) {
314
- let n = U.append("g");
315
- n.html(`<g>${await getIconSVG(I.icon, {
316
- height: N,
317
- width: N,
318
- fallbackPrefix: architectureIcons.prefix
319
- })}</g>`), n.attr("transform", "translate(" + (W + F + 1) + ", " + (G + F + 1) + ")"), W += N, G += P / 2 - 1 - 2;
320
- }
321
- if (I.label) {
322
- let n = U.append("g");
323
- await createText(n, I.label, {
324
- useHtmlLabels: !1,
325
- width: z,
326
- classes: "architecture-service-label"
327
- }, getConfig2()), n.attr("dy", "1em").attr("alignment-baseline", "middle").attr("dominant-baseline", "start").attr("text-anchor", "start"), n.attr("transform", "translate(" + (W + F + 4) + ", " + (G + F + 2) + ")");
328
- }
329
- M.setElementForId(I.id, H);
330
- }
331
- }));
332
- }, "drawGroups"), drawServices = /* @__PURE__ */ __name(async function(n, j, M) {
333
- let N = getConfig2();
334
- for (let P of M) {
335
- let M = j.append("g"), F = n.getConfigField("iconSize");
336
- if (P.title) {
337
- let n = M.append("g");
338
- await createText(n, P.title, {
339
- useHtmlLabels: !1,
340
- width: F * 1.5,
341
- classes: "architecture-service-label"
342
- }, N), n.attr("dy", "1em").attr("alignment-baseline", "middle").attr("dominant-baseline", "middle").attr("text-anchor", "middle"), n.attr("transform", "translate(" + F / 2 + ", " + F + ")");
343
- }
344
- let I = M.append("g");
345
- if (P.icon) I.html(`<g>${await getIconSVG(P.icon, {
346
- height: F,
347
- width: F,
348
- fallbackPrefix: architectureIcons.prefix
349
- })}</g>`);
350
- else if (P.iconText) {
351
- I.html(`<g>${await getIconSVG("blank", {
352
- height: F,
353
- width: F,
354
- fallbackPrefix: architectureIcons.prefix
355
- })}</g>`);
356
- let n = I.append("g").append("foreignObject").attr("width", F).attr("height", F).append("div").attr("class", "node-icon-text").attr("style", `height: ${F}px;`).append("div").html(sanitizeText(P.iconText, N)), j = parseInt(window.getComputedStyle(n.node(), null).getPropertyValue("font-size").replace(/\D/g, "")) ?? 16;
357
- n.attr("style", `-webkit-line-clamp: ${Math.floor((F - 2) / j)};`);
358
- } else I.append("path").attr("class", "node-bkg").attr("id", "node-" + P.id).attr("d", `M0 ${F} v${-F} q0,-5 5,-5 h${F} q5,0 5,5 v${F} H0 Z`);
359
- M.attr("id", `service-${P.id}`).attr("class", "architecture-service");
360
- let { width: L, height: R } = M.node().getBBox();
361
- P.width = L, P.height = R, n.setElementForId(P.id, M);
362
- }
363
- return 0;
364
- }, "drawServices"), drawJunctions = /* @__PURE__ */ __name(function(n, j, M) {
365
- M.forEach((M) => {
366
- let N = j.append("g"), P = n.getConfigField("iconSize");
367
- N.append("g").append("rect").attr("id", "node-" + M.id).attr("fill-opacity", "0").attr("width", P).attr("height", P), N.attr("class", "architecture-junction");
368
- let { width: F, height: I } = N._groups[0][0].getBBox();
369
- N.width = F, N.height = I, n.setElementForId(M.id, N);
370
- });
371
- }, "drawJunctions");
372
- registerIconPacks([{
373
- name: architectureIcons.prefix,
374
- icons: architectureIcons
375
- }]), cytoscape.use(import_cytoscape_fcose.default);
376
- function addServices(n, j, M) {
377
- n.forEach((n) => {
378
- j.add({
379
- group: "nodes",
380
- data: {
381
- type: "service",
382
- id: n.id,
383
- icon: n.icon,
384
- label: n.title,
385
- parent: n.in,
386
- width: M.getConfigField("iconSize"),
387
- height: M.getConfigField("iconSize")
388
- },
389
- classes: "node-service"
390
- });
391
- });
392
- }
393
- __name(addServices, "addServices");
394
- function addJunctions(n, j, M) {
395
- n.forEach((n) => {
396
- j.add({
397
- group: "nodes",
398
- data: {
399
- type: "junction",
400
- id: n.id,
401
- parent: n.in,
402
- width: M.getConfigField("iconSize"),
403
- height: M.getConfigField("iconSize")
404
- },
405
- classes: "node-junction"
406
- });
407
- });
408
- }
409
- __name(addJunctions, "addJunctions");
410
- function positionNodes(n, j) {
411
- j.nodes().map((j) => {
412
- let M = nodeData(j);
413
- M.type !== "group" && (M.x = j.position().x, M.y = j.position().y, n.getElementById(M.id).attr("transform", "translate(" + (M.x || 0) + "," + (M.y || 0) + ")"));
414
- });
415
- }
416
- __name(positionNodes, "positionNodes");
417
- function addGroups(n, j) {
418
- n.forEach((n) => {
419
- j.add({
420
- group: "nodes",
421
- data: {
422
- type: "group",
423
- id: n.id,
424
- icon: n.icon,
425
- label: n.title,
426
- parent: n.in
427
- },
428
- classes: "node-group"
429
- });
430
- });
431
- }
432
- __name(addGroups, "addGroups");
433
- function addEdges(n, j) {
434
- n.forEach((n) => {
435
- let { lhsId: M, rhsId: N, lhsInto: P, lhsGroup: F, rhsInto: I, lhsDir: L, rhsDir: R, rhsGroup: z, title: B } = n, V = isArchitectureDirectionXY(n.lhsDir, n.rhsDir) ? "segments" : "straight", H = {
436
- id: `${M}-${N}`,
437
- label: B,
438
- source: M,
439
- sourceDir: L,
440
- sourceArrow: P,
441
- sourceGroup: F,
442
- sourceEndpoint: L === "L" ? "0 50%" : L === "R" ? "100% 50%" : L === "T" ? "50% 0" : "50% 100%",
443
- target: N,
444
- targetDir: R,
445
- targetArrow: I,
446
- targetGroup: z,
447
- targetEndpoint: R === "L" ? "0 50%" : R === "R" ? "100% 50%" : R === "T" ? "50% 0" : "50% 100%"
448
- };
449
- j.add({
450
- group: "edges",
451
- data: H,
452
- classes: V
453
- });
454
- });
455
- }
456
- __name(addEdges, "addEdges");
457
- function getAlignments(n, M, N) {
458
- let P = /* @__PURE__ */ __name((n, j) => Object.entries(n).reduce((n, [M, P]) => {
459
- let F = 0, I = Object.entries(P);
460
- if (I.length === 1) return n[M] = I[0][1], n;
461
- for (let P = 0; P < I.length - 1; P++) for (let L = P + 1; L < I.length; L++) {
462
- let [R, z] = I[P], [B, V] = I[L];
463
- if (N[R]?.[B] === j) n[M] ??= [], n[M] = [
464
- ...n[M],
465
- ...z,
466
- ...V
467
- ];
468
- else if (R === "default" || B === "default") n[M] ??= [], n[M] = [
469
- ...n[M],
470
- ...z,
471
- ...V
472
- ];
473
- else {
474
- let j = `${M}-${F++}`;
475
- n[j] = z;
476
- let N = `${M}-${F++}`;
477
- n[N] = V;
478
- }
479
- }
480
- return n;
481
- }, {}), "flattenAlignments"), [F, I] = M.map((j) => {
482
- let M = {}, N = {};
483
- return Object.entries(j).forEach(([j, [P, F]]) => {
484
- let I = n.getNode(j)?.in ?? "default";
485
- M[F] ??= {}, M[F][I] ??= [], M[F][I].push(j), N[P] ??= {}, N[P][I] ??= [], N[P][I].push(j);
486
- }), {
487
- horiz: Object.values(P(M, "horizontal")).filter((n) => n.length > 1),
488
- vert: Object.values(P(N, "vertical")).filter((n) => n.length > 1)
489
- };
490
- }).reduce(([n, j], { horiz: M, vert: N }) => [[...n, ...M], [...j, ...N]], [[], []]);
491
- return {
492
- horizontal: F,
493
- vertical: I
494
- };
495
- }
496
- __name(getAlignments, "getAlignments");
497
- function getRelativeConstraints(n, M) {
498
- let N = [], P = /* @__PURE__ */ __name((n) => `${n[0]},${n[1]}`, "posToStr"), F = /* @__PURE__ */ __name((n) => n.split(",").map((n) => parseInt(n)), "strToPos");
499
- return n.forEach((n) => {
500
- let j = Object.fromEntries(Object.entries(n).map(([n, j]) => [P(j), n])), I = [P([0, 0])], L = {}, R = {
501
- L: [-1, 0],
502
- R: [1, 0],
503
- T: [0, 1],
504
- B: [0, -1]
505
- };
506
- for (; I.length > 0;) {
507
- let n = I.shift();
508
- if (n) {
509
- L[n] = 1;
510
- let z = j[n];
511
- if (z) {
512
- let B = F(n);
513
- Object.entries(R).forEach(([n, F]) => {
514
- let R = P([B[0] + F[0], B[1] + F[1]]), V = j[R];
515
- V && !L[R] && (I.push(R), N.push({
516
- [ArchitectureDirectionName[n]]: V,
517
- [ArchitectureDirectionName[getOppositeArchitectureDirection(n)]]: z,
518
- gap: 1.5 * M.getConfigField("iconSize")
519
- }));
520
- });
521
- }
522
- }
523
- }
524
- }), N;
525
- }
526
- __name(getRelativeConstraints, "getRelativeConstraints");
527
- function layoutArchitecture(n, N, P, F, I, { spatialMaps: L, groupAlignments: R }) {
528
- return new Promise((z) => {
529
- let B = select_default("body").append("div").attr("id", "cy").attr("style", "display:none"), V = cytoscape({
530
- container: document.getElementById("cy"),
531
- style: [
532
- {
533
- selector: "edge",
534
- style: {
535
- "curve-style": "straight",
536
- label: "data(label)",
537
- "source-endpoint": "data(sourceEndpoint)",
538
- "target-endpoint": "data(targetEndpoint)"
539
- }
540
- },
541
- {
542
- selector: "edge.segments",
543
- style: {
544
- "curve-style": "segments",
545
- "segment-weights": "0",
546
- "segment-distances": [.5],
547
- "edge-distances": "endpoints",
548
- "source-endpoint": "data(sourceEndpoint)",
549
- "target-endpoint": "data(targetEndpoint)"
550
- }
551
- },
552
- {
553
- selector: "node",
554
- style: { "compound-sizing-wrt-labels": "include" }
555
- },
556
- {
557
- selector: "node[label]",
558
- style: {
559
- "text-valign": "bottom",
560
- "text-halign": "center",
561
- "font-size": `${I.getConfigField("fontSize")}px`
562
- }
563
- },
564
- {
565
- selector: ".node-service",
566
- style: {
567
- label: "data(label)",
568
- width: "data(width)",
569
- height: "data(height)"
570
- }
571
- },
572
- {
573
- selector: ".node-junction",
574
- style: {
575
- width: "data(width)",
576
- height: "data(height)"
577
- }
578
- },
579
- {
580
- selector: ".node-group",
581
- style: { padding: `${I.getConfigField("padding")}px` }
582
- }
583
- ],
584
- layout: {
585
- name: "grid",
586
- boundingBox: {
587
- x1: 0,
588
- x2: 100,
589
- y1: 0,
590
- y2: 100
591
- }
592
- }
593
- });
594
- B.remove(), addGroups(P, V), addServices(n, V, I), addJunctions(N, V, I), addEdges(F, V);
595
- let H = getAlignments(I, L, R), U = getRelativeConstraints(L, I), W = V.layout({
596
- name: "fcose",
597
- quality: "proof",
598
- styleEnabled: !1,
599
- animate: !1,
600
- nodeDimensionsIncludeLabels: !1,
601
- idealEdgeLength(n) {
602
- let [j, M] = n.connectedNodes(), { parent: N } = nodeData(j), { parent: P } = nodeData(M);
603
- return N === P ? 1.5 * I.getConfigField("iconSize") : .5 * I.getConfigField("iconSize");
604
- },
605
- edgeElasticity(n) {
606
- let [j, M] = n.connectedNodes(), { parent: N } = nodeData(j), { parent: P } = nodeData(M);
607
- return N === P ? .45 : .001;
608
- },
609
- alignmentConstraint: H,
610
- relativePlacementConstraint: U
611
- });
612
- W.one("layoutstop", () => {
613
- function n(n, j, M, N) {
614
- let P, F, { x: I, y: L } = n, { x: R, y: z } = j;
615
- F = (N - L + (I - M) * (L - z) / (I - R)) / Math.sqrt(1 + ((L - z) / (I - R)) ** 2), P = Math.sqrt((N - L) ** 2 + (M - I) ** 2 - F ** 2);
616
- let B = Math.sqrt((R - I) ** 2 + (z - L) ** 2);
617
- P /= B;
618
- let V = (R - I) * (N - L) - (z - L) * (M - I);
619
- switch (!0) {
620
- case V >= 0:
621
- V = 1;
622
- break;
623
- case V < 0:
624
- V = -1;
625
- break;
626
- }
627
- let H = (R - I) * (M - I) + (z - L) * (N - L);
628
- switch (!0) {
629
- case H >= 0:
630
- H = 1;
631
- break;
632
- case H < 0:
633
- H = -1;
634
- break;
635
- }
636
- return F = Math.abs(F) * V, P *= H, {
637
- distances: F,
638
- weights: P
639
- };
640
- }
641
- __name(n, "getSegmentWeights"), V.startBatch();
642
- for (let j of Object.values(V.edges())) if (j.data?.()) {
643
- let { x: M, y: N } = j.source().position(), { x: P, y: F } = j.target().position();
644
- if (M !== P && N !== F) {
645
- let M = j.sourceEndpoint(), N = j.targetEndpoint(), { sourceDir: P } = edgeData(j), [F, I] = isArchitectureDirectionY(P) ? [M.x, N.y] : [N.x, M.y], { weights: L, distances: R } = n(M, N, F, I);
646
- j.style("segment-distances", R), j.style("segment-weights", L);
647
- }
648
- }
649
- V.endBatch(), W.run();
650
- }), W.run(), V.ready((n) => {
651
- log.info("Ready", n), z(V);
652
- });
653
- });
654
- }
655
- __name(layoutArchitecture, "layoutArchitecture");
656
- var diagram = {
657
- parser,
658
- get db() {
659
- return new ArchitectureDB();
660
- },
661
- renderer: { draw: /* @__PURE__ */ __name(async (n, j, M, N) => {
662
- let P = N.db, F = P.getServices(), I = P.getJunctions(), L = P.getGroups(), R = P.getEdges(), z = P.getDataStructures(), B = selectSvgElement(j), V = B.append("g");
663
- V.attr("class", "architecture-edges");
664
- let H = B.append("g");
665
- H.attr("class", "architecture-services");
666
- let U = B.append("g");
667
- U.attr("class", "architecture-groups"), await drawServices(P, H, F), drawJunctions(P, H, I);
668
- let G = await layoutArchitecture(F, I, L, R, P, z);
669
- await drawEdges(V, G, P), await drawGroups(U, G, P), positionNodes(P, G), setupGraphViewbox(void 0, B, P.getConfigField("padding"), P.getConfigField("useMaxWidth"));
670
- }, "draw") },
671
- styles: architectureStyles_default
672
- };
673
- export { diagram };