@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
@@ -0,0 +1,691 @@
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-ICPOFSXX.js";
4
+ import select_default from "../../../../d3-selection/src/select.js";
5
+ import "../../../../d3/src/index.js";
6
+ import { selectSvgElement } from "./chunk-426QAEUC.js";
7
+ import { cleanAndMerge, getEdgeId } from "./chunk-5PVQY5BW.js";
8
+ import { createText, getIconSVG, registerIconPacks, unknownIcon } from "./chunk-U2HBQHQK.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((e) => `${e},${e / 2} 0,${e} 0,0`, "L"),
20
+ R: /* @__PURE__ */ __name((e) => `0,${e / 2} ${e},0 ${e},${e}`, "R"),
21
+ T: /* @__PURE__ */ __name((e) => `0,0 ${e},0 ${e / 2},${e}`, "T"),
22
+ B: /* @__PURE__ */ __name((e) => `${e / 2},0 ${e},${e} 0,${e}`, "B")
23
+ }, ArchitectureDirectionArrowShift = {
24
+ L: /* @__PURE__ */ __name((e, A) => e - A + 2, "L"),
25
+ R: /* @__PURE__ */ __name((e, A) => e - 2, "R"),
26
+ T: /* @__PURE__ */ __name((e, A) => e - A + 2, "T"),
27
+ B: /* @__PURE__ */ __name((e, A) => e - 2, "B")
28
+ }, getOppositeArchitectureDirection = /* @__PURE__ */ __name(function(e) {
29
+ return isArchitectureDirectionX(e) ? e === "L" ? "R" : "L" : e === "T" ? "B" : "T";
30
+ }, "getOppositeArchitectureDirection"), isArchitectureDirection = /* @__PURE__ */ __name(function(e) {
31
+ let A = e;
32
+ return A === "L" || A === "R" || A === "T" || A === "B";
33
+ }, "isArchitectureDirection"), isArchitectureDirectionX = /* @__PURE__ */ __name(function(e) {
34
+ let A = e;
35
+ return A === "L" || A === "R";
36
+ }, "isArchitectureDirectionX"), isArchitectureDirectionY = /* @__PURE__ */ __name(function(e) {
37
+ let A = e;
38
+ return A === "T" || A === "B";
39
+ }, "isArchitectureDirectionY"), isArchitectureDirectionXY = /* @__PURE__ */ __name(function(e, A) {
40
+ let j = isArchitectureDirectionX(e) && isArchitectureDirectionY(A), M = isArchitectureDirectionY(e) && isArchitectureDirectionX(A);
41
+ return j || M;
42
+ }, "isArchitectureDirectionXY"), isArchitecturePairXY = /* @__PURE__ */ __name(function(e) {
43
+ let A = e[0], j = e[1], M = isArchitectureDirectionX(A) && isArchitectureDirectionY(j), N = isArchitectureDirectionY(A) && isArchitectureDirectionX(j);
44
+ return M || N;
45
+ }, "isArchitecturePairXY"), isValidArchitectureDirectionPair = /* @__PURE__ */ __name(function(e) {
46
+ return e !== "LL" && e !== "RR" && e !== "TT" && e !== "BB";
47
+ }, "isValidArchitectureDirectionPair"), getArchitectureDirectionPair = /* @__PURE__ */ __name(function(e, A) {
48
+ let j = `${e}${A}`;
49
+ return isValidArchitectureDirectionPair(j) ? j : void 0;
50
+ }, "getArchitectureDirectionPair"), shiftPositionByArchitectureDirectionPair = /* @__PURE__ */ __name(function([e, A], j) {
51
+ let M = j[0], N = j[1];
52
+ return isArchitectureDirectionX(M) ? isArchitectureDirectionY(N) ? [e + (M === "L" ? -1 : 1), A + (N === "T" ? 1 : -1)] : [e + (M === "L" ? -1 : 1), A] : isArchitectureDirectionX(N) ? [e + (N === "L" ? 1 : -1), A + (M === "T" ? 1 : -1)] : [e, A + (M === "T" ? 1 : -1)];
53
+ }, "shiftPositionByArchitectureDirectionPair"), getArchitectureDirectionXYFactors = /* @__PURE__ */ __name(function(e) {
54
+ return e === "LT" || e === "TL" ? [1, 1] : e === "BL" || e === "LB" ? [1, -1] : e === "BR" || e === "RB" ? [-1, -1] : [-1, 1];
55
+ }, "getArchitectureDirectionXYFactors"), getArchitectureDirectionAlignment = /* @__PURE__ */ __name(function(e, A) {
56
+ return isArchitectureDirectionXY(e, A) ? "bend" : isArchitectureDirectionX(e) ? "horizontal" : "vertical";
57
+ }, "getArchitectureDirectionAlignment"), isArchitectureService = /* @__PURE__ */ __name(function(e) {
58
+ return e.type === "service";
59
+ }, "isArchitectureService"), isArchitectureJunction = /* @__PURE__ */ __name(function(e) {
60
+ return e.type === "junction";
61
+ }, "isArchitectureJunction"), edgeData = /* @__PURE__ */ __name((e) => e.data(), "edgeData"), nodeData = /* @__PURE__ */ __name((e) => e.data(), "nodeData"), DEFAULT_ARCHITECTURE_CONFIG = defaultConfig_default.architecture, ArchitectureDB = class {
62
+ constructor() {
63
+ this.nodes = {}, this.groups = {}, this.edges = [], this.registeredIds = {}, this.elements = {}, this.diagramId = "", 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
+ setDiagramId(e) {
67
+ this.diagramId = e;
68
+ }
69
+ getDiagramId() {
70
+ return this.diagramId;
71
+ }
72
+ clear() {
73
+ this.nodes = {}, this.groups = {}, this.edges = [], this.registeredIds = {}, this.dataStructures = void 0, this.elements = {}, this.diagramId = "", clear();
74
+ }
75
+ addService({ id: e, icon: A, in: j, title: M, iconText: N }) {
76
+ if (this.registeredIds[e] !== void 0) throw Error(`The service id [${e}] is already in use by another ${this.registeredIds[e]}`);
77
+ if (j !== void 0) {
78
+ if (e === j) throw Error(`The service [${e}] cannot be placed within itself`);
79
+ if (this.registeredIds[j] === void 0) throw Error(`The service [${e}]'s parent does not exist. Please make sure the parent is created before this service`);
80
+ if (this.registeredIds[j] === "node") throw Error(`The service [${e}]'s parent is not a group`);
81
+ }
82
+ this.registeredIds[e] = "node", this.nodes[e] = {
83
+ id: e,
84
+ type: "service",
85
+ icon: A,
86
+ iconText: N,
87
+ title: M,
88
+ edges: [],
89
+ in: j
90
+ };
91
+ }
92
+ getServices() {
93
+ return Object.values(this.nodes).filter(isArchitectureService);
94
+ }
95
+ addJunction({ id: e, in: A }) {
96
+ if (this.registeredIds[e] !== void 0) throw Error(`The junction id [${e}] is already in use by another ${this.registeredIds[e]}`);
97
+ if (A !== void 0) {
98
+ if (e === A) throw Error(`The junction [${e}] cannot be placed within itself`);
99
+ if (this.registeredIds[A] === void 0) throw Error(`The junction [${e}]'s parent does not exist. Please make sure the parent is created before this junction`);
100
+ if (this.registeredIds[A] === "node") throw Error(`The junction [${e}]'s parent is not a group`);
101
+ }
102
+ this.registeredIds[e] = "node", this.nodes[e] = {
103
+ id: e,
104
+ type: "junction",
105
+ edges: [],
106
+ in: A
107
+ };
108
+ }
109
+ getJunctions() {
110
+ return Object.values(this.nodes).filter(isArchitectureJunction);
111
+ }
112
+ getNodes() {
113
+ return Object.values(this.nodes);
114
+ }
115
+ getNode(e) {
116
+ return this.nodes[e] ?? null;
117
+ }
118
+ addGroup({ id: e, icon: A, in: j, title: M }) {
119
+ if (this.registeredIds?.[e] !== void 0) throw Error(`The group id [${e}] is already in use by another ${this.registeredIds[e]}`);
120
+ if (j !== void 0) {
121
+ if (e === j) throw Error(`The group [${e}] cannot be placed within itself`);
122
+ if (this.registeredIds?.[j] === void 0) throw Error(`The group [${e}]'s parent does not exist. Please make sure the parent is created before this group`);
123
+ if (this.registeredIds?.[j] === "node") throw Error(`The group [${e}]'s parent is not a group`);
124
+ }
125
+ this.registeredIds[e] = "group", this.groups[e] = {
126
+ id: e,
127
+ icon: A,
128
+ title: M,
129
+ in: j
130
+ };
131
+ }
132
+ getGroups() {
133
+ return Object.values(this.groups);
134
+ }
135
+ addEdge({ lhsId: e, rhsId: A, lhsDir: j, rhsDir: M, lhsInto: N, rhsInto: P, lhsGroup: F, rhsGroup: I, title: L }) {
136
+ if (!isArchitectureDirection(j)) throw Error(`Invalid direction given for left hand side of edge ${e}--${A}. Expected (L,R,T,B) got ${String(j)}`);
137
+ if (!isArchitectureDirection(M)) throw Error(`Invalid direction given for right hand side of edge ${e}--${A}. Expected (L,R,T,B) got ${String(M)}`);
138
+ if (this.nodes[e] === void 0 && this.groups[e] === void 0) throw Error(`The left-hand id [${e}] does not yet exist. Please create the service/group before declaring an edge to it.`);
139
+ if (this.nodes[A] === void 0 && this.groups[A] === void 0) throw Error(`The right-hand id [${A}] does not yet exist. Please create the service/group before declaring an edge to it.`);
140
+ let R = this.nodes[e].in, z = this.nodes[A].in;
141
+ if (F && R && z && R == z) throw Error(`The left-hand id [${e}] is modified to traverse the group boundary, but the edge does not pass through two groups.`);
142
+ if (I && R && z && R == z) throw Error(`The right-hand id [${A}] is modified to traverse the group boundary, but the edge does not pass through two groups.`);
143
+ let B = {
144
+ lhsId: e,
145
+ lhsDir: j,
146
+ lhsInto: N,
147
+ lhsGroup: F,
148
+ rhsId: A,
149
+ rhsDir: M,
150
+ rhsInto: P,
151
+ rhsGroup: I,
152
+ title: L
153
+ };
154
+ this.edges.push(B), this.nodes[e] && this.nodes[A] && (this.nodes[e].edges.push(this.edges[this.edges.length - 1]), this.nodes[A].edges.push(this.edges[this.edges.length - 1]));
155
+ }
156
+ getEdges() {
157
+ return this.edges;
158
+ }
159
+ getDataStructures() {
160
+ if (this.dataStructures === void 0) {
161
+ let e = {}, j = Object.entries(this.nodes).reduce((A, [j, M]) => (A[j] = M.edges.reduce((A, M) => {
162
+ let N = this.getNode(M.lhsId)?.in, P = this.getNode(M.rhsId)?.in;
163
+ if (N && P && N !== P) {
164
+ let A = getArchitectureDirectionAlignment(M.lhsDir, M.rhsDir);
165
+ A !== "bend" && (e[N] ??= {}, e[N][P] = A, e[P] ??= {}, e[P][N] = A);
166
+ }
167
+ if (M.lhsId === j) {
168
+ let e = getArchitectureDirectionPair(M.lhsDir, M.rhsDir);
169
+ e && (A[e] = M.rhsId);
170
+ } else {
171
+ let e = getArchitectureDirectionPair(M.rhsDir, M.lhsDir);
172
+ e && (A[e] = M.lhsId);
173
+ }
174
+ return A;
175
+ }, {}), A), {}), M = Object.keys(j)[0], N = { [M]: 1 }, P = Object.keys(j).reduce((e, A) => A === M ? e : {
176
+ ...e,
177
+ [A]: 1
178
+ }, {}), F = /* @__PURE__ */ __name((e) => {
179
+ let A = { [e]: [0, 0] }, M = [e];
180
+ for (; M.length > 0;) {
181
+ let e = M.shift();
182
+ if (e) {
183
+ N[e] = 1, delete P[e];
184
+ let F = j[e], [I, L] = A[e];
185
+ Object.entries(F).forEach(([e, j]) => {
186
+ N[j] || (A[j] = shiftPositionByArchitectureDirectionPair([I, L], e), M.push(j));
187
+ });
188
+ }
189
+ }
190
+ return A;
191
+ }, "BFS"), I = [F(M)];
192
+ for (; Object.keys(P).length > 0;) I.push(F(Object.keys(P)[0]));
193
+ this.dataStructures = {
194
+ adjList: j,
195
+ spatialMaps: I,
196
+ groupAlignments: e
197
+ };
198
+ }
199
+ return this.dataStructures;
200
+ }
201
+ setElementForId(e, A) {
202
+ this.elements[e] = A;
203
+ }
204
+ getElementById(e) {
205
+ return this.elements[e];
206
+ }
207
+ getConfig() {
208
+ return cleanAndMerge({
209
+ ...DEFAULT_ARCHITECTURE_CONFIG,
210
+ ...getConfig().architecture
211
+ });
212
+ }
213
+ getConfigField(e) {
214
+ return this.getConfig()[e];
215
+ }
216
+ }, populateDb = /* @__PURE__ */ __name((e, A) => {
217
+ populateCommonDb(e, A), e.groups.map((e) => A.addGroup(e)), e.services.map((e) => A.addService({
218
+ ...e,
219
+ type: "service"
220
+ })), e.junctions.map((e) => A.addJunction({
221
+ ...e,
222
+ type: "junction"
223
+ })), e.edges.map((e) => A.addEdge(e));
224
+ }, "populateDb"), parser = {
225
+ parser: { yy: void 0 },
226
+ parse: /* @__PURE__ */ __name(async (e) => {
227
+ let A = await parse("architecture", e);
228
+ log.debug(A);
229
+ let M = parser.parser?.yy;
230
+ if (!(M 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.");
231
+ populateDb(A, M);
232
+ }, "parse")
233
+ }, architectureStyles_default = /* @__PURE__ */ __name((e) => `
234
+ .edge {
235
+ stroke-width: ${e.archEdgeWidth};
236
+ stroke: ${e.archEdgeColor};
237
+ fill: none;
238
+ }
239
+
240
+ .arrow {
241
+ fill: ${e.archEdgeArrowColor};
242
+ }
243
+
244
+ .node-bkg {
245
+ fill: none;
246
+ stroke: ${e.archGroupBorderColor};
247
+ stroke-width: ${e.archGroupBorderWidth};
248
+ stroke-dasharray: 8;
249
+ }
250
+ .node-icon-text {
251
+ display: flex;
252
+ align-items: center;
253
+ }
254
+
255
+ .node-icon-text > div {
256
+ color: #fff;
257
+ margin: 1px;
258
+ height: fit-content;
259
+ text-align: center;
260
+ overflow: hidden;
261
+ display: -webkit-box;
262
+ -webkit-box-orient: vertical;
263
+ }
264
+ `, "getStyles"), wrapIcon = /* @__PURE__ */ __name((e) => `<g><rect width="80" height="80" style="fill: #087ebf; stroke-width: 0px;"/>${e}</g>`, "wrapIcon"), architectureIcons = {
265
+ prefix: "mermaid-architecture",
266
+ height: 80,
267
+ width: 80,
268
+ icons: {
269
+ 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;\"/>") },
270
+ 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>") },
271
+ 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;\"/>") },
272
+ 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;\"/>") },
273
+ 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;\"/>") },
274
+ unknown: unknownIcon,
275
+ blank: { body: wrapIcon("") }
276
+ }
277
+ }, drawEdges = /* @__PURE__ */ __name(async function(e, A, j, M) {
278
+ let N = j.getConfigField("padding"), P = j.getConfigField("iconSize"), F = P / 2, I = P / 6, R = I / 2;
279
+ await Promise.all(A.edges().map(async (A) => {
280
+ let { source: P, sourceDir: z, sourceArrow: B, sourceGroup: V, target: H, targetDir: U, targetArrow: W, targetGroup: G, label: K } = edgeData(A), { x: q, y: J } = A[0].sourceEndpoint(), { x: Y, y: X } = A[0].midpoint(), { x: Z, y: Q } = A[0].targetEndpoint(), $ = N + 4;
281
+ if (V && (isArchitectureDirectionX(z) ? q += z === "L" ? -$ : $ : J += z === "T" ? -$ : $ + 18), G && (isArchitectureDirectionX(U) ? Z += U === "L" ? -$ : $ : Q += U === "T" ? -$ : $ + 18), !V && j.getNode(P)?.type === "junction" && (isArchitectureDirectionX(z) ? q += z === "L" ? F : -F : J += z === "T" ? F : -F), !G && j.getNode(H)?.type === "junction" && (isArchitectureDirectionX(U) ? Z += U === "L" ? F : -F : Q += U === "T" ? F : -F), A[0]._private.rscratch) {
282
+ let A = e.insert("g");
283
+ if (A.insert("path").attr("d", `M ${q},${J} L ${Y},${X} L${Z},${Q} `).attr("class", "edge").attr("id", `${M}-${getEdgeId(P, H, { prefix: "L" })}`), B) {
284
+ let e = isArchitectureDirectionX(z) ? ArchitectureDirectionArrowShift[z](q, I) : q - R, j = isArchitectureDirectionY(z) ? ArchitectureDirectionArrowShift[z](J, I) : J - R;
285
+ A.insert("polygon").attr("points", ArchitectureDirectionArrow[z](I)).attr("transform", `translate(${e},${j})`).attr("class", "arrow");
286
+ }
287
+ if (W) {
288
+ let e = isArchitectureDirectionX(U) ? ArchitectureDirectionArrowShift[U](Z, I) : Z - R, j = isArchitectureDirectionY(U) ? ArchitectureDirectionArrowShift[U](Q, I) : Q - R;
289
+ A.insert("polygon").attr("points", ArchitectureDirectionArrow[U](I)).attr("transform", `translate(${e},${j})`).attr("class", "arrow");
290
+ }
291
+ if (K) {
292
+ let e = isArchitectureDirectionXY(z, U) ? "XY" : isArchitectureDirectionX(z) ? "X" : "Y", j = 0;
293
+ j = e === "X" ? Math.abs(q - Z) : e === "Y" ? Math.abs(J - Q) / 1.5 : Math.abs(q - Z) / 2;
294
+ let M = A.append("g");
295
+ if (await createText(M, K, {
296
+ useHtmlLabels: !1,
297
+ width: j,
298
+ classes: "architecture-service-label"
299
+ }, getConfig2()), M.attr("dy", "1em").attr("alignment-baseline", "middle").attr("dominant-baseline", "middle").attr("text-anchor", "middle"), e === "X") M.attr("transform", "translate(" + Y + ", " + X + ")");
300
+ else if (e === "Y") M.attr("transform", "translate(" + Y + ", " + X + ") rotate(-90)");
301
+ else if (e === "XY") {
302
+ let e = getArchitectureDirectionPair(z, U);
303
+ if (e && isArchitecturePairXY(e)) {
304
+ let A = M.node().getBoundingClientRect(), [j, N] = getArchitectureDirectionXYFactors(e);
305
+ M.attr("dominant-baseline", "auto").attr("transform", `rotate(${-1 * j * N * 45})`);
306
+ let P = M.node().getBoundingClientRect();
307
+ M.attr("transform", `
308
+ translate(${Y}, ${X - A.height / 2})
309
+ translate(${j * P.width / 2}, ${N * P.height / 2})
310
+ rotate(${-1 * j * N * 45}, 0, ${A.height / 2})
311
+ `);
312
+ }
313
+ }
314
+ }
315
+ }
316
+ }));
317
+ }, "drawEdges"), drawGroups = /* @__PURE__ */ __name(async function(e, A, j, M) {
318
+ let N = j.getConfigField("padding") * .75, P = j.getConfigField("fontSize"), F = j.getConfigField("iconSize") / 2;
319
+ await Promise.all(A.nodes().map(async (A) => {
320
+ let I = nodeData(A);
321
+ if (I.type === "group") {
322
+ let { h: R, w: z, x1: B, y1: V } = A.boundingBox(), H = e.append("rect");
323
+ H.attr("id", `${M}-group-${I.id}`).attr("x", B + F).attr("y", V + F).attr("width", z).attr("height", R).attr("class", "node-bkg");
324
+ let U = e.append("g"), W = B, G = V;
325
+ if (I.icon) {
326
+ let e = U.append("g");
327
+ e.html(`<g>${await getIconSVG(I.icon, {
328
+ height: N,
329
+ width: N,
330
+ fallbackPrefix: architectureIcons.prefix
331
+ })}</g>`), e.attr("transform", "translate(" + (W + F + 1) + ", " + (G + F + 1) + ")"), W += N, G += P / 2 - 1 - 2;
332
+ }
333
+ if (I.label) {
334
+ let e = U.append("g");
335
+ await createText(e, I.label, {
336
+ useHtmlLabels: !1,
337
+ width: z,
338
+ classes: "architecture-service-label"
339
+ }, getConfig2()), e.attr("dy", "1em").attr("alignment-baseline", "middle").attr("dominant-baseline", "start").attr("text-anchor", "start"), e.attr("transform", "translate(" + (W + F + 4) + ", " + (G + F + 2) + ")");
340
+ }
341
+ j.setElementForId(I.id, H);
342
+ }
343
+ }));
344
+ }, "drawGroups"), drawServices = /* @__PURE__ */ __name(async function(e, A, j, M) {
345
+ let N = getConfig2();
346
+ for (let P of j) {
347
+ let j = A.append("g"), F = e.getConfigField("iconSize");
348
+ if (P.title) {
349
+ let e = j.append("g");
350
+ await createText(e, P.title, {
351
+ useHtmlLabels: !1,
352
+ width: F * 1.5,
353
+ classes: "architecture-service-label"
354
+ }, N), e.attr("dy", "1em").attr("alignment-baseline", "middle").attr("dominant-baseline", "middle").attr("text-anchor", "middle"), e.attr("transform", "translate(" + F / 2 + ", " + F + ")");
355
+ }
356
+ let I = j.append("g");
357
+ if (P.icon) I.html(`<g>${await getIconSVG(P.icon, {
358
+ height: F,
359
+ width: F,
360
+ fallbackPrefix: architectureIcons.prefix
361
+ })}</g>`);
362
+ else if (P.iconText) {
363
+ I.html(`<g>${await getIconSVG("blank", {
364
+ height: F,
365
+ width: F,
366
+ fallbackPrefix: architectureIcons.prefix
367
+ })}</g>`);
368
+ let e = 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)), A = parseInt(window.getComputedStyle(e.node(), null).getPropertyValue("font-size").replace(/\D/g, "")) ?? 16;
369
+ e.attr("style", `-webkit-line-clamp: ${Math.floor((F - 2) / A)};`);
370
+ } else I.append("path").attr("class", "node-bkg").attr("id", `${M}-node-${P.id}`).attr("d", `M0,${F} V5 Q0,0 5,0 H${F - 5} Q${F},0 ${F},5 V${F} Z`);
371
+ j.attr("id", `${M}-service-${P.id}`).attr("class", "architecture-service");
372
+ let { width: L, height: R } = j.node().getBBox();
373
+ P.width = L, P.height = R, e.setElementForId(P.id, j);
374
+ }
375
+ return 0;
376
+ }, "drawServices"), drawJunctions = /* @__PURE__ */ __name(function(e, A, j, M) {
377
+ j.forEach((j) => {
378
+ let N = A.append("g"), P = e.getConfigField("iconSize");
379
+ N.append("g").append("rect").attr("id", `${M}-node-${j.id}`).attr("fill-opacity", "0").attr("width", P).attr("height", P), N.attr("class", "architecture-junction");
380
+ let { width: F, height: I } = N._groups[0][0].getBBox();
381
+ N.width = F, N.height = I, e.setElementForId(j.id, N);
382
+ });
383
+ }, "drawJunctions");
384
+ registerIconPacks([{
385
+ name: architectureIcons.prefix,
386
+ icons: architectureIcons
387
+ }]), cytoscape.use(import_cytoscape_fcose.default);
388
+ function addServices(e, A, j) {
389
+ e.forEach((e) => {
390
+ A.add({
391
+ group: "nodes",
392
+ data: {
393
+ type: "service",
394
+ id: e.id,
395
+ icon: e.icon,
396
+ label: e.title,
397
+ parent: e.in,
398
+ width: j.getConfigField("iconSize"),
399
+ height: j.getConfigField("iconSize")
400
+ },
401
+ classes: "node-service"
402
+ });
403
+ });
404
+ }
405
+ __name(addServices, "addServices");
406
+ function addJunctions(e, A, j) {
407
+ e.forEach((e) => {
408
+ A.add({
409
+ group: "nodes",
410
+ data: {
411
+ type: "junction",
412
+ id: e.id,
413
+ parent: e.in,
414
+ width: j.getConfigField("iconSize"),
415
+ height: j.getConfigField("iconSize")
416
+ },
417
+ classes: "node-junction"
418
+ });
419
+ });
420
+ }
421
+ __name(addJunctions, "addJunctions");
422
+ function positionNodes(e, A) {
423
+ A.nodes().map((A) => {
424
+ let j = nodeData(A);
425
+ j.type !== "group" && (j.x = A.position().x, j.y = A.position().y, e.getElementById(j.id).attr("transform", "translate(" + (j.x || 0) + "," + (j.y || 0) + ")"));
426
+ });
427
+ }
428
+ __name(positionNodes, "positionNodes");
429
+ function addGroups(e, A) {
430
+ e.forEach((e) => {
431
+ A.add({
432
+ group: "nodes",
433
+ data: {
434
+ type: "group",
435
+ id: e.id,
436
+ icon: e.icon,
437
+ label: e.title,
438
+ parent: e.in
439
+ },
440
+ classes: "node-group"
441
+ });
442
+ });
443
+ }
444
+ __name(addGroups, "addGroups");
445
+ function addEdges(e, A) {
446
+ e.forEach((e) => {
447
+ let { lhsId: j, rhsId: M, lhsInto: N, lhsGroup: P, rhsInto: F, lhsDir: I, rhsDir: L, rhsGroup: R, title: z } = e, B = isArchitectureDirectionXY(e.lhsDir, e.rhsDir) ? "segments" : "straight", V = {
448
+ id: `${j}-${M}`,
449
+ label: z,
450
+ source: j,
451
+ sourceDir: I,
452
+ sourceArrow: N,
453
+ sourceGroup: P,
454
+ sourceEndpoint: I === "L" ? "0 50%" : I === "R" ? "100% 50%" : I === "T" ? "50% 0" : "50% 100%",
455
+ target: M,
456
+ targetDir: L,
457
+ targetArrow: F,
458
+ targetGroup: R,
459
+ targetEndpoint: L === "L" ? "0 50%" : L === "R" ? "100% 50%" : L === "T" ? "50% 0" : "50% 100%"
460
+ };
461
+ A.add({
462
+ group: "edges",
463
+ data: V,
464
+ classes: B
465
+ });
466
+ });
467
+ }
468
+ __name(addEdges, "addEdges");
469
+ function getAlignments(e, j, M) {
470
+ let N = /* @__PURE__ */ __name((e, A) => Object.entries(e).reduce((e, [j, N]) => {
471
+ let P = 0, F = Object.entries(N);
472
+ if (F.length === 1) return e[j] = F[0][1], e;
473
+ for (let N = 0; N < F.length - 1; N++) for (let I = N + 1; I < F.length; I++) {
474
+ let [L, R] = F[N], [z, B] = F[I];
475
+ if (M[L]?.[z] === A) e[j] ??= [], e[j] = [
476
+ ...e[j],
477
+ ...R,
478
+ ...B
479
+ ];
480
+ else if (L === "default" || z === "default") e[j] ??= [], e[j] = [
481
+ ...e[j],
482
+ ...R,
483
+ ...B
484
+ ];
485
+ else {
486
+ let A = `${j}-${P++}`;
487
+ e[A] = R;
488
+ let M = `${j}-${P++}`;
489
+ e[M] = B;
490
+ }
491
+ }
492
+ return e;
493
+ }, {}), "flattenAlignments"), [P, F] = j.map((A) => {
494
+ let j = {}, M = {};
495
+ return Object.entries(A).forEach(([A, [N, P]]) => {
496
+ let F = e.getNode(A)?.in ?? "default";
497
+ j[P] ??= {}, j[P][F] ??= [], j[P][F].push(A), M[N] ??= {}, M[N][F] ??= [], M[N][F].push(A);
498
+ }), {
499
+ horiz: Object.values(N(j, "horizontal")).filter((e) => e.length > 1),
500
+ vert: Object.values(N(M, "vertical")).filter((e) => e.length > 1)
501
+ };
502
+ }).reduce(([e, A], { horiz: j, vert: M }) => [[...e, ...j], [...A, ...M]], [[], []]);
503
+ return {
504
+ horizontal: P,
505
+ vertical: F
506
+ };
507
+ }
508
+ __name(getAlignments, "getAlignments");
509
+ function getRelativeConstraints(e, j) {
510
+ let M = [], N = /* @__PURE__ */ __name((e) => `${e[0]},${e[1]}`, "posToStr"), P = /* @__PURE__ */ __name((e) => e.split(",").map((e) => parseInt(e)), "strToPos");
511
+ return e.forEach((e) => {
512
+ let A = Object.fromEntries(Object.entries(e).map(([e, A]) => [N(A), e])), F = [N([0, 0])], I = {}, L = {
513
+ L: [-1, 0],
514
+ R: [1, 0],
515
+ T: [0, 1],
516
+ B: [0, -1]
517
+ };
518
+ for (; F.length > 0;) {
519
+ let e = F.shift();
520
+ if (e) {
521
+ I[e] = 1;
522
+ let R = A[e];
523
+ if (R) {
524
+ let z = P(e);
525
+ Object.entries(L).forEach(([e, P]) => {
526
+ let L = N([z[0] + P[0], z[1] + P[1]]), B = A[L];
527
+ B && !I[L] && (F.push(L), M.push({
528
+ [ArchitectureDirectionName[e]]: B,
529
+ [ArchitectureDirectionName[getOppositeArchitectureDirection(e)]]: R,
530
+ gap: 1.5 * j.getConfigField("iconSize")
531
+ }));
532
+ });
533
+ }
534
+ }
535
+ }
536
+ }), M;
537
+ }
538
+ __name(getRelativeConstraints, "getRelativeConstraints");
539
+ function layoutArchitecture(e, M, N, P, F, { spatialMaps: I, groupAlignments: L }) {
540
+ return new Promise((R) => {
541
+ let z = select_default("body").append("div").attr("id", "cy").attr("style", "display:none"), B = cytoscape({
542
+ container: document.getElementById("cy"),
543
+ style: [
544
+ {
545
+ selector: "edge",
546
+ style: {
547
+ "curve-style": "straight",
548
+ "source-endpoint": "data(sourceEndpoint)",
549
+ "target-endpoint": "data(targetEndpoint)"
550
+ }
551
+ },
552
+ {
553
+ selector: "edge[label]",
554
+ style: { label: "data(label)" }
555
+ },
556
+ {
557
+ selector: "edge.segments",
558
+ style: {
559
+ "curve-style": "segments",
560
+ "segment-weights": "0",
561
+ "segment-distances": [.5],
562
+ "edge-distances": "endpoints",
563
+ "source-endpoint": "data(sourceEndpoint)",
564
+ "target-endpoint": "data(targetEndpoint)"
565
+ }
566
+ },
567
+ {
568
+ selector: "node",
569
+ style: { "compound-sizing-wrt-labels": "include" }
570
+ },
571
+ {
572
+ selector: "node[label]",
573
+ style: {
574
+ "text-valign": "bottom",
575
+ "text-halign": "center",
576
+ "font-size": `${F.getConfigField("fontSize")}px`
577
+ }
578
+ },
579
+ {
580
+ selector: ".node-service",
581
+ style: {
582
+ label: "data(label)",
583
+ width: "data(width)",
584
+ height: "data(height)"
585
+ }
586
+ },
587
+ {
588
+ selector: ".node-junction",
589
+ style: {
590
+ width: "data(width)",
591
+ height: "data(height)"
592
+ }
593
+ },
594
+ {
595
+ selector: ".node-group",
596
+ style: { padding: `${F.getConfigField("padding")}px` }
597
+ }
598
+ ],
599
+ layout: {
600
+ name: "grid",
601
+ boundingBox: {
602
+ x1: 0,
603
+ x2: 100,
604
+ y1: 0,
605
+ y2: 100
606
+ }
607
+ }
608
+ });
609
+ z.remove(), addGroups(N, B), addServices(e, B, F), addJunctions(M, B, F), addEdges(P, B);
610
+ let V = getAlignments(F, I, L), H = getRelativeConstraints(I, F), U = B.layout({
611
+ name: "fcose",
612
+ quality: "proof",
613
+ randomize: F.getConfigField("randomize"),
614
+ styleEnabled: !1,
615
+ animate: !1,
616
+ nodeDimensionsIncludeLabels: !1,
617
+ idealEdgeLength(e) {
618
+ let [A, j] = e.connectedNodes(), { parent: M } = nodeData(A), { parent: N } = nodeData(j);
619
+ return M === N ? 1.5 * F.getConfigField("iconSize") : .5 * F.getConfigField("iconSize");
620
+ },
621
+ edgeElasticity(e) {
622
+ let [A, j] = e.connectedNodes(), { parent: M } = nodeData(A), { parent: N } = nodeData(j);
623
+ return M === N ? .45 : .001;
624
+ },
625
+ alignmentConstraint: V,
626
+ relativePlacementConstraint: H
627
+ });
628
+ U.one("layoutstop", () => {
629
+ function e(e, A, j, M) {
630
+ let N, P, { x: F, y: I } = e, { x: L, y: R } = A;
631
+ P = (M - I + (F - j) * (I - R) / (F - L)) / Math.sqrt(1 + ((I - R) / (F - L)) ** 2), N = Math.sqrt((M - I) ** 2 + (j - F) ** 2 - P ** 2);
632
+ let z = Math.sqrt((L - F) ** 2 + (R - I) ** 2);
633
+ N /= z;
634
+ let B = (L - F) * (M - I) - (R - I) * (j - F);
635
+ switch (!0) {
636
+ case B >= 0:
637
+ B = 1;
638
+ break;
639
+ case B < 0:
640
+ B = -1;
641
+ break;
642
+ }
643
+ let V = (L - F) * (j - F) + (R - I) * (M - I);
644
+ switch (!0) {
645
+ case V >= 0:
646
+ V = 1;
647
+ break;
648
+ case V < 0:
649
+ V = -1;
650
+ break;
651
+ }
652
+ return P = Math.abs(P) * B, N *= V, {
653
+ distances: P,
654
+ weights: N
655
+ };
656
+ }
657
+ __name(e, "getSegmentWeights"), B.startBatch();
658
+ for (let A of Object.values(B.edges())) if (A.data?.()) {
659
+ let { x: j, y: M } = A.source().position(), { x: N, y: P } = A.target().position();
660
+ if (j !== N && M !== P) {
661
+ let j = A.sourceEndpoint(), M = A.targetEndpoint(), { sourceDir: N } = edgeData(A), [P, F] = isArchitectureDirectionY(N) ? [j.x, M.y] : [M.x, j.y], { weights: I, distances: L } = e(j, M, P, F);
662
+ A.style("segment-distances", L), A.style("segment-weights", I);
663
+ }
664
+ }
665
+ B.endBatch(), U.run();
666
+ }), U.run(), B.ready((e) => {
667
+ log.info("Ready", e), R(B);
668
+ });
669
+ });
670
+ }
671
+ __name(layoutArchitecture, "layoutArchitecture");
672
+ var diagram = {
673
+ parser,
674
+ get db() {
675
+ return new ArchitectureDB();
676
+ },
677
+ renderer: { draw: /* @__PURE__ */ __name(async (e, A, j, M) => {
678
+ let N = M.db;
679
+ N.setDiagramId(A);
680
+ let P = N.getServices(), F = N.getJunctions(), I = N.getGroups(), L = N.getEdges(), R = N.getDataStructures(), z = selectSvgElement(A), B = z.append("g");
681
+ B.attr("class", "architecture-edges");
682
+ let V = z.append("g");
683
+ V.attr("class", "architecture-services");
684
+ let H = z.append("g");
685
+ H.attr("class", "architecture-groups"), await drawServices(N, V, P, A), drawJunctions(N, V, F, A);
686
+ let W = await layoutArchitecture(P, F, I, L, N, R);
687
+ await drawEdges(B, W, N, A), await drawGroups(H, W, N, A), positionNodes(N, W), setupGraphViewbox(void 0, z, N.getConfigField("padding"), N.getConfigField("useMaxWidth"));
688
+ }, "draw") },
689
+ styles: architectureStyles_default
690
+ };
691
+ export { diagram };