docmedown 0.1.7 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (304) hide show
  1. package/LICENSE +201 -21
  2. package/README.md +86 -37
  3. package/dist/architecture-7GRP2DOG-B8Xs9IfY.mjs +2 -0
  4. package/dist/architecture-7GRP2DOG-Vdsw7WC7.js +1 -0
  5. package/dist/cli.js +672 -1294
  6. package/dist/cynefin-OW5HDTMX-DU6kwwck.js +1 -0
  7. package/dist/cynefin-OW5HDTMX-F0P2M_lQ.mjs +2 -0
  8. package/dist/docmedown-compiler.js +228 -0
  9. package/dist/docmedown-mermaid.js +3588 -0
  10. package/dist/docmedown.cjs +7264 -80
  11. package/dist/docmedown.iife.js +7624 -424
  12. package/dist/docmedown.mjs +15531 -15009
  13. package/dist/docmedown.web.js +7628 -0
  14. package/dist/eventmodeling-NTZA5JFV-D58ICByZ.js +1 -0
  15. package/dist/eventmodeling-NTZA5JFV-SxxTo5cJ.mjs +2 -0
  16. package/dist/gitGraph-4MIJSDKK-C_R2a4aQ.mjs +2 -0
  17. package/dist/gitGraph-4MIJSDKK-CdMj8HJ8.js +1 -0
  18. package/dist/info-A6RAGUB7-CG4UBCfn.js +1 -0
  19. package/dist/info-A6RAGUB7-DmjQlHTj.mjs +2 -0
  20. package/dist/mermaid-BvOI3ZSW.js +3334 -0
  21. package/dist/mermaid-Cx9uSfoz.mjs +116948 -0
  22. package/dist/packet-AYTQ26CC-CMuoEJn0.js +1 -0
  23. package/dist/packet-AYTQ26CC-tdMo_iPL.mjs +2 -0
  24. package/dist/pie-WAS4IAKB-C1hjX8y0.js +1 -0
  25. package/dist/pie-WAS4IAKB-DG2Bio1G.mjs +2 -0
  26. package/dist/prism-CeBRmKvl.js +2 -0
  27. package/dist/prism-CummdiZX.mjs +1588 -0
  28. package/dist/radar-RG4KPBEZ-DHxYOB0f.mjs +2 -0
  29. package/dist/radar-RG4KPBEZ-Dvyo3gdA.js +1 -0
  30. package/dist/railroad-74A4TZTK-1sb9Z_QQ.js +1 -0
  31. package/dist/railroad-74A4TZTK-CwztrSkE.mjs +2 -0
  32. package/dist/railroad-abnf-HS5TGJTU-4264fZjH.js +1 -0
  33. package/dist/railroad-abnf-HS5TGJTU-BKCsR9iC.mjs +2 -0
  34. package/dist/railroad-ebnf-LZEXJU2U-BXErl5kO.js +1 -0
  35. package/dist/railroad-ebnf-LZEXJU2U-DzDOfuxK.mjs +2 -0
  36. package/dist/railroad-peg-WCYAUIDC-B6gNHamV.mjs +2 -0
  37. package/dist/railroad-peg-WCYAUIDC-D7pSwRGa.js +1 -0
  38. package/dist/rolldown-runtime-B0aSnxlc.mjs +20 -0
  39. package/dist/rolldown-runtime-DF3sbh8G.js +1 -0
  40. package/dist/svelte-compiler-loader-Deqbdbvf.js +1 -0
  41. package/dist/svelte-compiler-loader-DtYQgEKV.mjs +50 -0
  42. package/dist/svelte-runtime-Brc440dp.js +5 -0
  43. package/dist/svelte-runtime-CgCk_bw1.mjs +40 -0
  44. package/dist/treeView-Q6P3EWNA-DArM8kFH.mjs +2 -0
  45. package/dist/treeView-Q6P3EWNA-JstiGzov.js +1 -0
  46. package/dist/treemap-WGGIJYW6-CMIcmEVN.mjs +2 -0
  47. package/dist/treemap-WGGIJYW6-Dq6fFckz.js +1 -0
  48. package/dist/ts-compiler-BMDmcNn5.mjs +93 -0
  49. package/dist/ts-compiler-U7pTMJjY.js +3 -0
  50. package/dist/types/runtime/bridges/dynamic-component.d.ts +43 -0
  51. package/dist/types/runtime/bridges/element-bridge.d.ts +24 -0
  52. package/dist/types/runtime/bridges/index.d.ts +3 -0
  53. package/dist/types/runtime/bridges/react-bridge.d.ts +35 -0
  54. package/dist/types/runtime/compiler-cache.d.ts +18 -0
  55. package/dist/types/runtime/config-schema.d.ts +2 -0
  56. package/dist/types/runtime/favicons.d.ts +28 -0
  57. package/dist/types/runtime/loader/local-loader.d.ts +13 -0
  58. package/dist/types/runtime/markdown/component-body.d.ts +7 -0
  59. package/dist/types/runtime/markdown/escape.d.ts +1 -0
  60. package/dist/types/runtime/markdown/highlighter.d.ts +32 -6
  61. package/dist/types/runtime/markdown/katex.d.ts +5 -0
  62. package/dist/types/runtime/markdown/mermaid-engine.d.ts +1 -0
  63. package/dist/types/runtime/markdown/mermaid-loader.d.ts +19 -0
  64. package/dist/types/runtime/markdown/mermaid.d.ts +6 -0
  65. package/dist/types/runtime/markdown/tables.d.ts +68 -0
  66. package/dist/types/runtime/media.d.ts +30 -0
  67. package/dist/types/runtime/motion.d.ts +134 -0
  68. package/dist/types/runtime/offline-export.d.ts +9 -2
  69. package/dist/types/runtime/router.d.ts +40 -2
  70. package/dist/types/runtime/splash.d.ts +90 -0
  71. package/dist/types/runtime/svelte-compiler-engine.d.ts +1 -0
  72. package/dist/types/runtime/svelte-compiler-loader.d.ts +14 -0
  73. package/dist/types/runtime/svelte-runtime.d.ts +29 -0
  74. package/dist/types/runtime/svelte-tag.d.ts +7 -0
  75. package/dist/types/runtime/ts-compiler.d.ts +24 -0
  76. package/dist/types/runtime/types.d.ts +1 -0
  77. package/dist/types/ui/doc-context.svelte.d.ts +198 -0
  78. package/dist/types/ui/index.d.ts +33 -0
  79. package/dist/types/ui/registry.d.ts +52 -0
  80. package/dist/types/ui/theme.svelte.d.ts +32 -0
  81. package/dist/wardley-WFR3VGLG-BK9BA6h6.mjs +2 -0
  82. package/dist/wardley-WFR3VGLG-Cbs7W-dU.js +1 -0
  83. package/package.json +61 -48
  84. package/schemas/docs.schema.json +186 -181
  85. package/templates/.dmd/CounterWidget.svelte +29 -0
  86. package/templates/README.md +2 -2
  87. package/templates/favicon.svg +12 -0
  88. package/templates/favicons/favicon-book.svg +11 -0
  89. package/templates/favicons/favicon-markdown.svg +11 -0
  90. package/templates/favicons/favicon-minimal.svg +15 -0
  91. package/templates/favicons/favicon-terminal.svg +14 -0
  92. package/templates/favicons/favicon.svg +12 -0
  93. package/templates/guides/custom-components.md +82 -22
  94. package/templates/index.html +6 -3
  95. package/dist/abnfDiagram-VCTEODGH-CtQBp0Qv.mjs +0 -89
  96. package/dist/abnfDiagram-VCTEODGH-mccrzlD_.js +0 -1
  97. package/dist/arc-DgPKXEdT.mjs +0 -82
  98. package/dist/arc-n7TW7Bis.js +0 -1
  99. package/dist/architecture-7GRP2DOG-B7myQ46f.js +0 -1
  100. package/dist/architecture-7GRP2DOG-Cxj1ussQ.mjs +0 -3
  101. package/dist/architectureDiagram-5GKGNRK7-BdTCu5T3.js +0 -36
  102. package/dist/architectureDiagram-5GKGNRK7-CkgZa-G1.mjs +0 -4154
  103. package/dist/array-CApNbSU9.mjs +0 -6
  104. package/dist/array-DZSRzHA_.js +0 -1
  105. package/dist/blockDiagram-I7D4REHJ-CSYvpxQw.js +0 -129
  106. package/dist/blockDiagram-I7D4REHJ-CYngfPD9.mjs +0 -1922
  107. package/dist/c4Diagram-7LVT6UL2-B-sz5MUK.js +0 -38
  108. package/dist/c4Diagram-7LVT6UL2-DEzxFf2b.mjs +0 -3010
  109. package/dist/channel-LgHproiI.mjs +0 -5
  110. package/dist/channel-yqu0m4cl.js +0 -1
  111. package/dist/chunk-2E4U76K2-BOyeRQsI.js +0 -1
  112. package/dist/chunk-2E4U76K2-CoTrgtfg.mjs +0 -348
  113. package/dist/chunk-2Q5K7J3B-D4EgYPOq.mjs +0 -15
  114. package/dist/chunk-2Q5K7J3B-DhjCNjaM.js +0 -1
  115. package/dist/chunk-4HAMMTFA-GFyfmcSO.js +0 -62
  116. package/dist/chunk-4HAMMTFA-VgWPe1ng.mjs +0 -4188
  117. package/dist/chunk-5VM5RSS4-GINalzIv.js +0 -15
  118. package/dist/chunk-5VM5RSS4-TqxtqrwE.mjs +0 -5
  119. package/dist/chunk-75Z2AOVW-DYouz5MZ.js +0 -2
  120. package/dist/chunk-75Z2AOVW-Dz0Sko9Y.mjs +0 -1330
  121. package/dist/chunk-CLGD4ZFX-C5J-e2io.js +0 -1
  122. package/dist/chunk-CLGD4ZFX-DBkwyMMv.mjs +0 -14
  123. package/dist/chunk-DU6HZSFF-BEQZSmUu.mjs +0 -3836
  124. package/dist/chunk-DU6HZSFF-CWc5ewtb.js +0 -127
  125. package/dist/chunk-F27PBJKO-8jvY_jJK.js +0 -1
  126. package/dist/chunk-F27PBJKO-DFH3sRZG.mjs +0 -61
  127. package/dist/chunk-FOHPRMQF-LRqOLsSw.mjs +0 -21456
  128. package/dist/chunk-FOHPRMQF-tmTlwTeH.js +0 -161
  129. package/dist/chunk-GMAD6QVW-BZeZ4fdb.mjs +0 -1863
  130. package/dist/chunk-GMAD6QVW-DEQiTa0c.js +0 -72
  131. package/dist/chunk-GVQU2GXP-B1D3J05J.mjs +0 -37
  132. package/dist/chunk-GVQU2GXP-CdJIWN41.js +0 -1
  133. package/dist/chunk-IMKFNOWR-BmZb9U1f.mjs +0 -2042
  134. package/dist/chunk-IMKFNOWR-CPJsszGN.js +0 -231
  135. package/dist/chunk-JWPE2WC7-DIKiF5cm.mjs +0 -8
  136. package/dist/chunk-JWPE2WC7-p1fYVdYc.js +0 -1
  137. package/dist/chunk-L3NEJ4N5-TzDiVs78.js +0 -1
  138. package/dist/chunk-L3NEJ4N5-lal8wUID.mjs +0 -245
  139. package/dist/chunk-LNGE3PJU-BQX75wkM.js +0 -34
  140. package/dist/chunk-LNGE3PJU-DJ9JuXV6.mjs +0 -1521
  141. package/dist/chunk-OSK3NFVY-9AWK88m1.mjs +0 -672
  142. package/dist/chunk-OSK3NFVY-CHzvVe8m.js +0 -10
  143. package/dist/chunk-P2QGCYS3-6q3AXPt5.mjs +0 -67
  144. package/dist/chunk-P2QGCYS3-DKZzpRQW.js +0 -1
  145. package/dist/chunk-POPQ4Y6H-Dd7J9tx3.mjs +0 -26
  146. package/dist/chunk-POPQ4Y6H-T5C7wpjf.js +0 -1
  147. package/dist/chunk-PWAF6VOD-BYG76tEe.mjs +0 -275
  148. package/dist/chunk-PWAF6VOD-DxZLuCEw.js +0 -1
  149. package/dist/chunk-SHT3W25Y-B2Wes8jn.mjs +0 -4183
  150. package/dist/chunk-SHT3W25Y-BQjHSn5K.js +0 -168
  151. package/dist/chunk-SVP7TREG-BFMd615E.js +0 -88
  152. package/dist/chunk-SVP7TREG-CynckzeF.mjs +0 -490
  153. package/dist/chunk-TICWLB2K-BfCuoR1V.mjs +0 -3357
  154. package/dist/chunk-TICWLB2K-agcyBfUp.js +0 -206
  155. package/dist/chunk-TLUHSLCS-CUrWaKDG.mjs +0 -59
  156. package/dist/chunk-TLUHSLCS-Drx_a7am.js +0 -1
  157. package/dist/chunk-XXDRQBXY-AAk1-Cyg.js +0 -1
  158. package/dist/chunk-XXDRQBXY-DpR8eYzz.mjs +0 -9
  159. package/dist/chunk-Y2CYZVJY-CnmLqFtv.js +0 -1
  160. package/dist/chunk-Y2CYZVJY-i11wjrBe.mjs +0 -12
  161. package/dist/classDiagram-ZZMXUADV-B7IN9zcX.js +0 -1
  162. package/dist/classDiagram-ZZMXUADV-tcy6gxSB.mjs +0 -30
  163. package/dist/classDiagram-v2-VYDZK3BY-B7IN9zcX.js +0 -1
  164. package/dist/classDiagram-v2-VYDZK3BY-D5wM6Acp.mjs +0 -30
  165. package/dist/cose-bilkent-JH36ORCC-DBUPO3qJ.js +0 -1
  166. package/dist/cose-bilkent-JH36ORCC-Slpx4WIt.mjs +0 -2253
  167. package/dist/cynefin-OW5HDTMX--QVnfGi1.mjs +0 -3
  168. package/dist/cynefin-OW5HDTMX-lNKysi7S.js +0 -1
  169. package/dist/cynefinDiagram-5FMLGOSQ-CsFONYqx.js +0 -62
  170. package/dist/cynefinDiagram-5FMLGOSQ-DsrxYBcg.mjs +0 -355
  171. package/dist/cytoscape.esm-C5TvPYYm.mjs +0 -18148
  172. package/dist/cytoscape.esm-CBmWJr5M.js +0 -321
  173. package/dist/dagre-CZ6P9L_h.js +0 -1
  174. package/dist/dagre-GXQ25YYZ-CQszk-7P.js +0 -4
  175. package/dist/dagre-GXQ25YYZ-ecYByRSn.mjs +0 -425
  176. package/dist/dagre-J_1oH0eY.mjs +0 -1934
  177. package/dist/defaultLocale-N-0uLSyg.mjs +0 -198
  178. package/dist/defaultLocale-ybN1Vtvg.js +0 -1
  179. package/dist/diagram-S7CK7UJ4-CTMvxX__.js +0 -30
  180. package/dist/diagram-S7CK7UJ4-DxCghfa-.mjs +0 -301
  181. package/dist/diagram-UQ7AKVKN-1viEkqlG.js +0 -41
  182. package/dist/diagram-UQ7AKVKN-BA7Z_oB7.mjs +0 -214
  183. package/dist/diagram-VSXAHHWV-DgVT19mq.js +0 -3
  184. package/dist/diagram-VSXAHHWV-Dtqo03M5.mjs +0 -432
  185. package/dist/diagram-VX7I27RA-CNw0pOX_.js +0 -24
  186. package/dist/diagram-VX7I27RA-GMPRt8Zh.mjs +0 -527
  187. package/dist/diagram-Z3DM3KII-C6XdQK_Q.mjs +0 -134
  188. package/dist/diagram-Z3DM3KII-CPkBr3FT.js +0 -24
  189. package/dist/dist-CXWJafG_.js +0 -1
  190. package/dist/dist-DNdLIC8h.mjs +0 -59
  191. package/dist/ebnfDiagram-PWID7BFC-CseVsyL3.js +0 -1
  192. package/dist/ebnfDiagram-PWID7BFC-D_dBDXWC.mjs +0 -100
  193. package/dist/erDiagram-RLTQ6QDP-DFwfQTRS.js +0 -99
  194. package/dist/erDiagram-RLTQ6QDP-DP7ddGMH.mjs +0 -1966
  195. package/dist/eventmodeling-NTZA5JFV-CzxVg0l5.js +0 -1
  196. package/dist/eventmodeling-NTZA5JFV-Djsy__5n.mjs +0 -3
  197. package/dist/flowDiagram-HODETNUW-7hSJfI3W.js +0 -1
  198. package/dist/flowDiagram-HODETNUW-Dqu5Lr19.mjs +0 -17
  199. package/dist/ganttDiagram-EL5Y4UJY-KNL3tzTD.mjs +0 -3072
  200. package/dist/ganttDiagram-EL5Y4UJY-aiLqNWgi.js +0 -292
  201. package/dist/gitGraph-4MIJSDKK-DnElfqX7.js +0 -1
  202. package/dist/gitGraph-4MIJSDKK-xuKJBT2e.mjs +0 -3
  203. package/dist/gitGraphDiagram-WWUBYQGX-D4gSo_-e.js +0 -106
  204. package/dist/gitGraphDiagram-WWUBYQGX-Dooss5fG.mjs +0 -733
  205. package/dist/graphlib-BaETKKSa.js +0 -1
  206. package/dist/graphlib-XW-Jr8pF.mjs +0 -1267
  207. package/dist/info-A6RAGUB7-ClYskpn6.mjs +0 -3
  208. package/dist/info-A6RAGUB7-DDvvt-fW.js +0 -1
  209. package/dist/infoDiagram-27XIBGKW-B2-y2mdQ.mjs +0 -20
  210. package/dist/infoDiagram-27XIBGKW-DYQ9NzfL.js +0 -2
  211. package/dist/init-BJdqMO10.js +0 -1
  212. package/dist/init-CsQUQz36.mjs +0 -13
  213. package/dist/ishikawaDiagram-5VMMS53U-ULIhoYO5.js +0 -70
  214. package/dist/ishikawaDiagram-5VMMS53U-xAArNh-1.mjs +0 -719
  215. package/dist/journeyDiagram-3NMN7TZE-BBMYNZRL.js +0 -139
  216. package/dist/journeyDiagram-3NMN7TZE-BH-uKqP7.mjs +0 -884
  217. package/dist/kanban-definition-UXKFOSKX-Be49llXr.mjs +0 -976
  218. package/dist/kanban-definition-UXKFOSKX-CDL5yJkq.js +0 -89
  219. package/dist/line-BEwhHSLl.js +0 -1
  220. package/dist/line-CiXRog8O.mjs +0 -34
  221. package/dist/linear-75tfjrny.js +0 -1
  222. package/dist/linear-Ncx_RuON.mjs +0 -288
  223. package/dist/mermaid-parser.core-BBApyu_y.js +0 -6
  224. package/dist/mermaid-parser.core-BRHibdUE.mjs +0 -638
  225. package/dist/mindmap-definition-YA3MSWOX-Chy7XP_5.mjs +0 -1006
  226. package/dist/mindmap-definition-YA3MSWOX-DOda-fkL.js +0 -96
  227. package/dist/ordinal-B1BNQwUR.mjs +0 -65
  228. package/dist/ordinal-B9aFWmF9.js +0 -1
  229. package/dist/packet-AYTQ26CC-CorIy9Ul.js +0 -1
  230. package/dist/packet-AYTQ26CC-DWH8gXJK.mjs +0 -3
  231. package/dist/path-CnWkkRiY.mjs +0 -84
  232. package/dist/path-DIS6ck99.js +0 -1
  233. package/dist/pegDiagram-XKGWAZYB-Cdw6MeON.js +0 -1
  234. package/dist/pegDiagram-XKGWAZYB-uNfxRaq1.mjs +0 -94
  235. package/dist/pie-WAS4IAKB-Cn5eK-5P.mjs +0 -3
  236. package/dist/pie-WAS4IAKB-D84xrSoY.js +0 -1
  237. package/dist/pieDiagram-E7YTZNPT-Bd6mvpJw.js +0 -39
  238. package/dist/pieDiagram-E7YTZNPT-Cczo96a2.mjs +0 -203
  239. package/dist/quadrantDiagram-AXDQQJYC-BPfgvMsS.js +0 -7
  240. package/dist/quadrantDiagram-AXDQQJYC-eqRNtVRl.mjs +0 -2001
  241. package/dist/radar-RG4KPBEZ-DvkxGdO6.mjs +0 -3
  242. package/dist/radar-RG4KPBEZ-R2sQOLL9.js +0 -1
  243. package/dist/railroad-74A4TZTK-BOZIf6ts.js +0 -1
  244. package/dist/railroad-74A4TZTK-CrQzn8Nm.mjs +0 -3
  245. package/dist/railroad-abnf-HS5TGJTU-BZYetxLz.mjs +0 -3
  246. package/dist/railroad-abnf-HS5TGJTU-CXU1aC4B.js +0 -1
  247. package/dist/railroad-ebnf-LZEXJU2U-D29kI3YW.js +0 -1
  248. package/dist/railroad-ebnf-LZEXJU2U-qgzTOmN6.mjs +0 -3
  249. package/dist/railroad-peg-WCYAUIDC-Bjs9Ws3P.mjs +0 -3
  250. package/dist/railroad-peg-WCYAUIDC-CXviP0hz.js +0 -1
  251. package/dist/railroadDiagram-O6MQD6OU-58kvwt7H.mjs +0 -76
  252. package/dist/railroadDiagram-O6MQD6OU-CKY3uzTc.js +0 -1
  253. package/dist/requirementDiagram-BXWQKSXE-0hZ04Q6h.js +0 -84
  254. package/dist/requirementDiagram-BXWQKSXE-CS673B5n.mjs +0 -2224
  255. package/dist/rough.esm-ChRLLRha.js +0 -1
  256. package/dist/rough.esm-DXYGHN3m.mjs +0 -1361
  257. package/dist/sankeyDiagram-P5KCCOFB-D1D6HfAM.mjs +0 -972
  258. package/dist/sankeyDiagram-P5KCCOFB-ciJb9Zr8.js +0 -40
  259. package/dist/sequenceDiagram-WJ2MYXX4-BXEznuI6.js +0 -162
  260. package/dist/sequenceDiagram-WJ2MYXX4-CI1VT8AG.mjs +0 -4156
  261. package/dist/sizeCapture-INFHLROL-BihkCH-7.js +0 -1
  262. package/dist/sizeCapture-INFHLROL-BmxqyOLj.mjs +0 -46
  263. package/dist/src-B4mN2BMl.js +0 -1
  264. package/dist/src-D_hsMyeP.mjs +0 -2154
  265. package/dist/stateDiagram-D77RDMKH-BQrSs72W.mjs +0 -220
  266. package/dist/stateDiagram-D77RDMKH-D2PtkW2U.js +0 -1
  267. package/dist/stateDiagram-v2-MP3YSRHH-CCbvNfk-.mjs +0 -30
  268. package/dist/stateDiagram-v2-MP3YSRHH-Dq1QuPeN.js +0 -1
  269. package/dist/swimlanes-42K2YHIH-CA316NPm.mjs +0 -4979
  270. package/dist/swimlanes-42K2YHIH-DlggBCTy.js +0 -1
  271. package/dist/swimlanesDiagram-VR7AAH4N-BV9PEIoG.js +0 -8
  272. package/dist/swimlanesDiagram-VR7AAH4N-BfrOCfdf.mjs +0 -31
  273. package/dist/timeline-definition-24CTP7MA-Bkd8rWNJ.js +0 -120
  274. package/dist/timeline-definition-24CTP7MA-BvkqNYt1.mjs +0 -1069
  275. package/dist/treeView-Q6P3EWNA-Aof3Cp1M.mjs +0 -3
  276. package/dist/treeView-Q6P3EWNA-BTzvdwbb.js +0 -1
  277. package/dist/treemap-WGGIJYW6-BNXGg99p.mjs +0 -3
  278. package/dist/treemap-WGGIJYW6-DfR4P2Hh.js +0 -1
  279. package/dist/types/runtime/app.d.ts +0 -9
  280. package/dist/types/runtime/components/AppearanceMenu.d.ts +0 -2
  281. package/dist/types/runtime/components/Builtins.d.ts +0 -44
  282. package/dist/types/runtime/components/Content.d.ts +0 -2
  283. package/dist/types/runtime/components/DmdRegistry.d.ts +0 -19
  284. package/dist/types/runtime/components/Layout.d.ts +0 -2
  285. package/dist/types/runtime/components/MermaidDiagram.d.ts +0 -16
  286. package/dist/types/runtime/components/Navbar.d.ts +0 -2
  287. package/dist/types/runtime/components/OfflineDownloadButton.d.ts +0 -2
  288. package/dist/types/runtime/components/OfflineNotice.d.ts +0 -6
  289. package/dist/types/runtime/components/Sidebar.d.ts +0 -2
  290. package/dist/types/runtime/components/TableOfContents.d.ts +0 -8
  291. package/dist/types/runtime/index.d.ts +0 -8
  292. package/dist/types/runtime/markdown/renderer.d.ts +0 -7
  293. package/dist/types/runtime/provider/DocProvider.d.ts +0 -40
  294. package/dist/types/runtime/provider/ThemeProvider.d.ts +0 -25
  295. package/dist/types/runtime/search/SearchModal.d.ts +0 -11
  296. package/dist/vennDiagram-4TSXK5OY-BOUFXjso.js +0 -34
  297. package/dist/vennDiagram-4TSXK5OY-CeOg3-hU.mjs +0 -1880
  298. package/dist/wardley-WFR3VGLG-BOYcSLd1.mjs +0 -3
  299. package/dist/wardley-WFR3VGLG-DWDqJSgm.js +0 -1
  300. package/dist/wardleyDiagram-VM6X3IG4-BhWgMjFr.js +0 -78
  301. package/dist/wardleyDiagram-VM6X3IG4-C31KoRmF.mjs +0 -645
  302. package/dist/xychartDiagram-S5SC5T6Z-1yU8zz6I.js +0 -7
  303. package/dist/xychartDiagram-S5SC5T6Z-BK7upFom.mjs +0 -2210
  304. package/templates/.dmd/components.js +0 -25
@@ -1,4154 +0,0 @@
1
- import { _ as e, m as t, p as n, y as r } from "./src-D_hsMyeP.mjs";
2
- import { n as i } from "./chunk-Y2CYZVJY-i11wjrBe.mjs";
3
- import { H as a, J as o, K as s, U as c, a as l, b as u, f as d, v as f, w as p, x as m, y as h, z as g } from "./chunk-DU6HZSFF-BEQZSmUu.mjs";
4
- import { c as _, i as v } from "./chunk-75Z2AOVW-Dz0Sko9Y.mjs";
5
- import { t as y } from "./chunk-CLGD4ZFX-DBkwyMMv.mjs";
6
- import { i as b, r as x, t as S } from "./chunk-PWAF6VOD-BYG76tEe.mjs";
7
- import { n as C } from "./chunk-GMAD6QVW-BZeZ4fdb.mjs";
8
- import { n as w } from "./mermaid-parser.core-BRHibdUE.mjs";
9
- import { t as T } from "./chunk-JWPE2WC7-DIKiF5cm.mjs";
10
- import { t as E } from "./cytoscape.esm-C5TvPYYm.mjs";
11
- //#region node_modules/cytoscape-fcose/node_modules/layout-base/layout-base.js
12
- var D = /* @__PURE__ */ e(((e, t) => {
13
- (function(n, r) {
14
- typeof e == "object" && typeof t == "object" ? t.exports = r() : typeof define == "function" && define.amd ? define([], r) : typeof e == "object" ? e.layoutBase = r() : n.layoutBase = r();
15
- })(e, function() {
16
- return (function(e) {
17
- var t = {};
18
- function n(r) {
19
- if (t[r]) return t[r].exports;
20
- var i = t[r] = {
21
- i: r,
22
- l: !1,
23
- exports: {}
24
- };
25
- return e[r].call(i.exports, i, i.exports, n), i.l = !0, i.exports;
26
- }
27
- return n.m = e, n.c = t, n.i = function(e) {
28
- return e;
29
- }, n.d = function(e, t, r) {
30
- n.o(e, t) || Object.defineProperty(e, t, {
31
- configurable: !1,
32
- enumerable: !0,
33
- get: r
34
- });
35
- }, n.n = function(e) {
36
- var t = e && e.__esModule ? function() {
37
- return e.default;
38
- } : function() {
39
- return e;
40
- };
41
- return n.d(t, "a", t), t;
42
- }, n.o = function(e, t) {
43
- return Object.prototype.hasOwnProperty.call(e, t);
44
- }, n.p = "", n(n.s = 28);
45
- })([
46
- (function(e, t, n) {
47
- function r() {}
48
- r.QUALITY = 1, r.DEFAULT_CREATE_BENDS_AS_NEEDED = !1, r.DEFAULT_INCREMENTAL = !1, r.DEFAULT_ANIMATION_ON_LAYOUT = !0, r.DEFAULT_ANIMATION_DURING_LAYOUT = !1, r.DEFAULT_ANIMATION_PERIOD = 50, r.DEFAULT_UNIFORM_LEAF_NODE_SIZES = !1, r.DEFAULT_GRAPH_MARGIN = 15, r.NODE_DIMENSIONS_INCLUDE_LABELS = !1, r.SIMPLE_NODE_SIZE = 40, r.SIMPLE_NODE_HALF_SIZE = r.SIMPLE_NODE_SIZE / 2, r.EMPTY_COMPOUND_NODE_SIZE = 40, r.MIN_EDGE_LENGTH = 1, r.WORLD_BOUNDARY = 1e6, r.INITIAL_WORLD_BOUNDARY = r.WORLD_BOUNDARY / 1e3, r.WORLD_CENTER_X = 1200, r.WORLD_CENTER_Y = 900, e.exports = r;
49
- }),
50
- (function(e, t, n) {
51
- var r = n(2), i = n(8), a = n(9);
52
- function o(e, t, n) {
53
- r.call(this, n), this.isOverlapingSourceAndTarget = !1, this.vGraphObject = n, this.bendpoints = [], this.source = e, this.target = t;
54
- }
55
- for (var s in o.prototype = Object.create(r.prototype), r) o[s] = r[s];
56
- o.prototype.getSource = function() {
57
- return this.source;
58
- }, o.prototype.getTarget = function() {
59
- return this.target;
60
- }, o.prototype.isInterGraph = function() {
61
- return this.isInterGraph;
62
- }, o.prototype.getLength = function() {
63
- return this.length;
64
- }, o.prototype.isOverlapingSourceAndTarget = function() {
65
- return this.isOverlapingSourceAndTarget;
66
- }, o.prototype.getBendpoints = function() {
67
- return this.bendpoints;
68
- }, o.prototype.getLca = function() {
69
- return this.lca;
70
- }, o.prototype.getSourceInLca = function() {
71
- return this.sourceInLca;
72
- }, o.prototype.getTargetInLca = function() {
73
- return this.targetInLca;
74
- }, o.prototype.getOtherEnd = function(e) {
75
- if (this.source === e) return this.target;
76
- if (this.target === e) return this.source;
77
- throw "Node is not incident with this edge";
78
- }, o.prototype.getOtherEndInGraph = function(e, t) {
79
- for (var n = this.getOtherEnd(e), r = t.getGraphManager().getRoot();;) {
80
- if (n.getOwner() == t) return n;
81
- if (n.getOwner() == r) break;
82
- n = n.getOwner().getParent();
83
- }
84
- return null;
85
- }, o.prototype.updateLength = function() {
86
- var e = [
87
- ,
88
- ,
89
- ,
90
- ,
91
- ];
92
- this.isOverlapingSourceAndTarget = i.getIntersection(this.target.getRect(), this.source.getRect(), e), this.isOverlapingSourceAndTarget || (this.lengthX = e[0] - e[2], this.lengthY = e[1] - e[3], Math.abs(this.lengthX) < 1 && (this.lengthX = a.sign(this.lengthX)), Math.abs(this.lengthY) < 1 && (this.lengthY = a.sign(this.lengthY)), this.length = Math.sqrt(this.lengthX * this.lengthX + this.lengthY * this.lengthY));
93
- }, o.prototype.updateLengthSimple = function() {
94
- this.lengthX = this.target.getCenterX() - this.source.getCenterX(), this.lengthY = this.target.getCenterY() - this.source.getCenterY(), Math.abs(this.lengthX) < 1 && (this.lengthX = a.sign(this.lengthX)), Math.abs(this.lengthY) < 1 && (this.lengthY = a.sign(this.lengthY)), this.length = Math.sqrt(this.lengthX * this.lengthX + this.lengthY * this.lengthY);
95
- }, e.exports = o;
96
- }),
97
- (function(e, t, n) {
98
- function r(e) {
99
- this.vGraphObject = e;
100
- }
101
- e.exports = r;
102
- }),
103
- (function(e, t, n) {
104
- var r = n(2), i = n(10), a = n(13), o = n(0), s = n(16), c = n(5);
105
- function l(e, t, n, o) {
106
- n == null && o == null && (o = t), r.call(this, o), e.graphManager != null && (e = e.graphManager), this.estimatedSize = i.MIN_VALUE, this.inclusionTreeDepth = i.MAX_VALUE, this.vGraphObject = o, this.edges = [], this.graphManager = e, this.rect = n != null && t != null ? new a(t.x, t.y, n.width, n.height) : new a();
107
- }
108
- for (var u in l.prototype = Object.create(r.prototype), r) l[u] = r[u];
109
- l.prototype.getEdges = function() {
110
- return this.edges;
111
- }, l.prototype.getChild = function() {
112
- return this.child;
113
- }, l.prototype.getOwner = function() {
114
- return this.owner;
115
- }, l.prototype.getWidth = function() {
116
- return this.rect.width;
117
- }, l.prototype.setWidth = function(e) {
118
- this.rect.width = e;
119
- }, l.prototype.getHeight = function() {
120
- return this.rect.height;
121
- }, l.prototype.setHeight = function(e) {
122
- this.rect.height = e;
123
- }, l.prototype.getCenterX = function() {
124
- return this.rect.x + this.rect.width / 2;
125
- }, l.prototype.getCenterY = function() {
126
- return this.rect.y + this.rect.height / 2;
127
- }, l.prototype.getCenter = function() {
128
- return new c(this.rect.x + this.rect.width / 2, this.rect.y + this.rect.height / 2);
129
- }, l.prototype.getLocation = function() {
130
- return new c(this.rect.x, this.rect.y);
131
- }, l.prototype.getRect = function() {
132
- return this.rect;
133
- }, l.prototype.getDiagonal = function() {
134
- return Math.sqrt(this.rect.width * this.rect.width + this.rect.height * this.rect.height);
135
- }, l.prototype.getHalfTheDiagonal = function() {
136
- return Math.sqrt(this.rect.height * this.rect.height + this.rect.width * this.rect.width) / 2;
137
- }, l.prototype.setRect = function(e, t) {
138
- this.rect.x = e.x, this.rect.y = e.y, this.rect.width = t.width, this.rect.height = t.height;
139
- }, l.prototype.setCenter = function(e, t) {
140
- this.rect.x = e - this.rect.width / 2, this.rect.y = t - this.rect.height / 2;
141
- }, l.prototype.setLocation = function(e, t) {
142
- this.rect.x = e, this.rect.y = t;
143
- }, l.prototype.moveBy = function(e, t) {
144
- this.rect.x += e, this.rect.y += t;
145
- }, l.prototype.getEdgeListToNode = function(e) {
146
- var t = [], n = this;
147
- return n.edges.forEach(function(r) {
148
- if (r.target == e) {
149
- if (r.source != n) throw "Incorrect edge source!";
150
- t.push(r);
151
- }
152
- }), t;
153
- }, l.prototype.getEdgesBetween = function(e) {
154
- var t = [], n = this;
155
- return n.edges.forEach(function(r) {
156
- if (r.source != n && r.target != n) throw "Incorrect edge source and/or target";
157
- (r.target == e || r.source == e) && t.push(r);
158
- }), t;
159
- }, l.prototype.getNeighborsList = function() {
160
- var e = /* @__PURE__ */ new Set(), t = this;
161
- return t.edges.forEach(function(n) {
162
- if (n.source == t) e.add(n.target);
163
- else {
164
- if (n.target != t) throw "Incorrect incidency!";
165
- e.add(n.source);
166
- }
167
- }), e;
168
- }, l.prototype.withChildren = function() {
169
- var e = /* @__PURE__ */ new Set(), t, n;
170
- if (e.add(this), this.child != null) for (var r = this.child.getNodes(), i = 0; i < r.length; i++) t = r[i], n = t.withChildren(), n.forEach(function(t) {
171
- e.add(t);
172
- });
173
- return e;
174
- }, l.prototype.getNoOfChildren = function() {
175
- var e = 0, t;
176
- if (this.child == null) e = 1;
177
- else for (var n = this.child.getNodes(), r = 0; r < n.length; r++) t = n[r], e += t.getNoOfChildren();
178
- return e == 0 && (e = 1), e;
179
- }, l.prototype.getEstimatedSize = function() {
180
- if (this.estimatedSize == i.MIN_VALUE) throw "assert failed";
181
- return this.estimatedSize;
182
- }, l.prototype.calcEstimatedSize = function() {
183
- return this.child == null ? this.estimatedSize = (this.rect.width + this.rect.height) / 2 : (this.estimatedSize = this.child.calcEstimatedSize(), this.rect.width = this.estimatedSize, this.rect.height = this.estimatedSize, this.estimatedSize);
184
- }, l.prototype.scatter = function() {
185
- var e, t, n = -o.INITIAL_WORLD_BOUNDARY, r = o.INITIAL_WORLD_BOUNDARY;
186
- e = o.WORLD_CENTER_X + s.nextDouble() * (r - n) + n;
187
- var i = -o.INITIAL_WORLD_BOUNDARY, a = o.INITIAL_WORLD_BOUNDARY;
188
- t = o.WORLD_CENTER_Y + s.nextDouble() * (a - i) + i, this.rect.x = e, this.rect.y = t;
189
- }, l.prototype.updateBounds = function() {
190
- if (this.getChild() == null) throw "assert failed";
191
- if (this.getChild().getNodes().length != 0) {
192
- var e = this.getChild();
193
- if (e.updateBounds(!0), this.rect.x = e.getLeft(), this.rect.y = e.getTop(), this.setWidth(e.getRight() - e.getLeft()), this.setHeight(e.getBottom() - e.getTop()), o.NODE_DIMENSIONS_INCLUDE_LABELS) {
194
- var t = e.getRight() - e.getLeft(), n = e.getBottom() - e.getTop();
195
- this.labelWidth && (this.labelPosHorizontal == "left" ? (this.rect.x -= this.labelWidth, this.setWidth(t + this.labelWidth)) : this.labelPosHorizontal == "center" && this.labelWidth > t ? (this.rect.x -= (this.labelWidth - t) / 2, this.setWidth(this.labelWidth)) : this.labelPosHorizontal == "right" && this.setWidth(t + this.labelWidth)), this.labelHeight && (this.labelPosVertical == "top" ? (this.rect.y -= this.labelHeight, this.setHeight(n + this.labelHeight)) : this.labelPosVertical == "center" && this.labelHeight > n ? (this.rect.y -= (this.labelHeight - n) / 2, this.setHeight(this.labelHeight)) : this.labelPosVertical == "bottom" && this.setHeight(n + this.labelHeight));
196
- }
197
- }
198
- }, l.prototype.getInclusionTreeDepth = function() {
199
- if (this.inclusionTreeDepth == i.MAX_VALUE) throw "assert failed";
200
- return this.inclusionTreeDepth;
201
- }, l.prototype.transform = function(e) {
202
- var t = this.rect.x;
203
- t > o.WORLD_BOUNDARY ? t = o.WORLD_BOUNDARY : t < -o.WORLD_BOUNDARY && (t = -o.WORLD_BOUNDARY);
204
- var n = this.rect.y;
205
- n > o.WORLD_BOUNDARY ? n = o.WORLD_BOUNDARY : n < -o.WORLD_BOUNDARY && (n = -o.WORLD_BOUNDARY);
206
- var r = new c(t, n), i = e.inverseTransformPoint(r);
207
- this.setLocation(i.x, i.y);
208
- }, l.prototype.getLeft = function() {
209
- return this.rect.x;
210
- }, l.prototype.getRight = function() {
211
- return this.rect.x + this.rect.width;
212
- }, l.prototype.getTop = function() {
213
- return this.rect.y;
214
- }, l.prototype.getBottom = function() {
215
- return this.rect.y + this.rect.height;
216
- }, l.prototype.getParent = function() {
217
- return this.owner == null ? null : this.owner.getParent();
218
- }, e.exports = l;
219
- }),
220
- (function(e, t, n) {
221
- var r = n(0);
222
- function i() {}
223
- for (var a in r) i[a] = r[a];
224
- i.MAX_ITERATIONS = 2500, i.DEFAULT_EDGE_LENGTH = 50, i.DEFAULT_SPRING_STRENGTH = .45, i.DEFAULT_REPULSION_STRENGTH = 4500, i.DEFAULT_GRAVITY_STRENGTH = .4, i.DEFAULT_COMPOUND_GRAVITY_STRENGTH = 1, i.DEFAULT_GRAVITY_RANGE_FACTOR = 3.8, i.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR = 1.5, i.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION = !0, i.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION = !0, i.DEFAULT_COOLING_FACTOR_INCREMENTAL = .3, i.COOLING_ADAPTATION_FACTOR = .33, i.ADAPTATION_LOWER_NODE_LIMIT = 1e3, i.ADAPTATION_UPPER_NODE_LIMIT = 5e3, i.MAX_NODE_DISPLACEMENT_INCREMENTAL = 100, i.MAX_NODE_DISPLACEMENT = i.MAX_NODE_DISPLACEMENT_INCREMENTAL * 3, i.MIN_REPULSION_DIST = i.DEFAULT_EDGE_LENGTH / 10, i.CONVERGENCE_CHECK_PERIOD = 100, i.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR = .1, i.MIN_EDGE_LENGTH = 1, i.GRID_CALCULATION_CHECK_PERIOD = 10, e.exports = i;
225
- }),
226
- (function(e, t, n) {
227
- function r(e, t) {
228
- e == null && t == null ? (this.x = 0, this.y = 0) : (this.x = e, this.y = t);
229
- }
230
- r.prototype.getX = function() {
231
- return this.x;
232
- }, r.prototype.getY = function() {
233
- return this.y;
234
- }, r.prototype.setX = function(e) {
235
- this.x = e;
236
- }, r.prototype.setY = function(e) {
237
- this.y = e;
238
- }, r.prototype.getDifference = function(e) {
239
- return new DimensionD(this.x - e.x, this.y - e.y);
240
- }, r.prototype.getCopy = function() {
241
- return new r(this.x, this.y);
242
- }, r.prototype.translate = function(e) {
243
- return this.x += e.width, this.y += e.height, this;
244
- }, e.exports = r;
245
- }),
246
- (function(e, t, n) {
247
- var r = n(2), i = n(10), a = n(0), o = n(7), s = n(3), c = n(1), l = n(13), u = n(12), d = n(11);
248
- function f(e, t, n) {
249
- r.call(this, n), this.estimatedSize = i.MIN_VALUE, this.margin = a.DEFAULT_GRAPH_MARGIN, this.edges = [], this.nodes = [], this.isConnected = !1, this.parent = e, t != null && t instanceof o ? this.graphManager = t : t != null && t instanceof Layout && (this.graphManager = t.graphManager);
250
- }
251
- for (var p in f.prototype = Object.create(r.prototype), r) f[p] = r[p];
252
- f.prototype.getNodes = function() {
253
- return this.nodes;
254
- }, f.prototype.getEdges = function() {
255
- return this.edges;
256
- }, f.prototype.getGraphManager = function() {
257
- return this.graphManager;
258
- }, f.prototype.getParent = function() {
259
- return this.parent;
260
- }, f.prototype.getLeft = function() {
261
- return this.left;
262
- }, f.prototype.getRight = function() {
263
- return this.right;
264
- }, f.prototype.getTop = function() {
265
- return this.top;
266
- }, f.prototype.getBottom = function() {
267
- return this.bottom;
268
- }, f.prototype.isConnected = function() {
269
- return this.isConnected;
270
- }, f.prototype.add = function(e, t, n) {
271
- if (t == null && n == null) {
272
- var r = e;
273
- if (this.graphManager == null) throw "Graph has no graph mgr!";
274
- if (this.getNodes().indexOf(r) > -1) throw "Node already in graph!";
275
- return r.owner = this, this.getNodes().push(r), r;
276
- }
277
- var i = e;
278
- if (!(this.getNodes().indexOf(t) > -1 && this.getNodes().indexOf(n) > -1)) throw "Source or target not in graph!";
279
- if (t.owner != n.owner || t.owner != this) throw "Both owners must be this graph!";
280
- return t.owner == n.owner ? (i.source = t, i.target = n, i.isInterGraph = !1, this.getEdges().push(i), t.edges.push(i), n != t && n.edges.push(i), i) : null;
281
- }, f.prototype.remove = function(e) {
282
- var t = e;
283
- if (e instanceof s) {
284
- if (t == null) throw "Node is null!";
285
- if (t.owner == null || t.owner != this) throw "Owner graph is invalid!";
286
- if (this.graphManager == null) throw "Owner graph manager is invalid!";
287
- for (var n = t.edges.slice(), r, i = n.length, a = 0; a < i; a++) r = n[a], r.isInterGraph ? this.graphManager.remove(r) : r.source.owner.remove(r);
288
- var o = this.nodes.indexOf(t);
289
- if (o == -1) throw "Node not in owner node list!";
290
- this.nodes.splice(o, 1);
291
- } else if (e instanceof c) {
292
- var r = e;
293
- if (r == null) throw "Edge is null!";
294
- if (r.source == null || r.target == null) throw "Source and/or target is null!";
295
- if (r.source.owner == null || r.target.owner == null || r.source.owner != this || r.target.owner != this) throw "Source and/or target owner is invalid!";
296
- var l = r.source.edges.indexOf(r), u = r.target.edges.indexOf(r);
297
- if (!(l > -1 && u > -1)) throw "Source and/or target doesn't know this edge!";
298
- r.source.edges.splice(l, 1), r.target != r.source && r.target.edges.splice(u, 1);
299
- var o = r.source.owner.getEdges().indexOf(r);
300
- if (o == -1) throw "Not in owner's edge list!";
301
- r.source.owner.getEdges().splice(o, 1);
302
- }
303
- }, f.prototype.updateLeftTop = function() {
304
- for (var e = i.MAX_VALUE, t = i.MAX_VALUE, n, r, a, o = this.getNodes(), s = o.length, c = 0; c < s; c++) {
305
- var l = o[c];
306
- n = l.getTop(), r = l.getLeft(), e > n && (e = n), t > r && (t = r);
307
- }
308
- return e == i.MAX_VALUE ? null : (a = o[0].getParent().paddingLeft == null ? this.margin : o[0].getParent().paddingLeft, this.left = t - a, this.top = e - a, new u(this.left, this.top));
309
- }, f.prototype.updateBounds = function(e) {
310
- for (var t = i.MAX_VALUE, n = -i.MAX_VALUE, r = i.MAX_VALUE, a = -i.MAX_VALUE, o, s, c, u, d, f = this.nodes, p = f.length, m = 0; m < p; m++) {
311
- var h = f[m];
312
- e && h.child != null && h.updateBounds(), o = h.getLeft(), s = h.getRight(), c = h.getTop(), u = h.getBottom(), t > o && (t = o), n < s && (n = s), r > c && (r = c), a < u && (a = u);
313
- }
314
- var g = new l(t, r, n - t, a - r);
315
- t == i.MAX_VALUE && (this.left = this.parent.getLeft(), this.right = this.parent.getRight(), this.top = this.parent.getTop(), this.bottom = this.parent.getBottom()), d = f[0].getParent().paddingLeft == null ? this.margin : f[0].getParent().paddingLeft, this.left = g.x - d, this.right = g.x + g.width + d, this.top = g.y - d, this.bottom = g.y + g.height + d;
316
- }, f.calculateBounds = function(e) {
317
- for (var t = i.MAX_VALUE, n = -i.MAX_VALUE, r = i.MAX_VALUE, a = -i.MAX_VALUE, o, s, c, u, d = e.length, f = 0; f < d; f++) {
318
- var p = e[f];
319
- o = p.getLeft(), s = p.getRight(), c = p.getTop(), u = p.getBottom(), t > o && (t = o), n < s && (n = s), r > c && (r = c), a < u && (a = u);
320
- }
321
- return new l(t, r, n - t, a - r);
322
- }, f.prototype.getInclusionTreeDepth = function() {
323
- return this == this.graphManager.getRoot() ? 1 : this.parent.getInclusionTreeDepth();
324
- }, f.prototype.getEstimatedSize = function() {
325
- if (this.estimatedSize == i.MIN_VALUE) throw "assert failed";
326
- return this.estimatedSize;
327
- }, f.prototype.calcEstimatedSize = function() {
328
- for (var e = 0, t = this.nodes, n = t.length, r = 0; r < n; r++) {
329
- var i = t[r];
330
- e += i.calcEstimatedSize();
331
- }
332
- return this.estimatedSize = e == 0 ? a.EMPTY_COMPOUND_NODE_SIZE : e / Math.sqrt(this.nodes.length), this.estimatedSize;
333
- }, f.prototype.updateConnected = function() {
334
- var e = this;
335
- if (this.nodes.length == 0) {
336
- this.isConnected = !0;
337
- return;
338
- }
339
- var t = new d(), n = /* @__PURE__ */ new Set(), r = this.nodes[0], i, a;
340
- for (r.withChildren().forEach(function(e) {
341
- t.push(e), n.add(e);
342
- }); t.length !== 0;) {
343
- r = t.shift(), i = r.getEdges();
344
- for (var o = i.length, s = 0; s < o; s++) a = i[s].getOtherEndInGraph(r, this), a != null && !n.has(a) && a.withChildren().forEach(function(e) {
345
- t.push(e), n.add(e);
346
- });
347
- }
348
- if (this.isConnected = !1, n.size >= this.nodes.length) {
349
- var c = 0;
350
- n.forEach(function(t) {
351
- t.owner == e && c++;
352
- }), c == this.nodes.length && (this.isConnected = !0);
353
- }
354
- }, e.exports = f;
355
- }),
356
- (function(e, t, n) {
357
- var r, i = n(1);
358
- function a(e) {
359
- r = n(6), this.layout = e, this.graphs = [], this.edges = [];
360
- }
361
- a.prototype.addRoot = function() {
362
- var e = this.layout.newGraph(), t = this.layout.newNode(null), n = this.add(e, t);
363
- return this.setRootGraph(n), this.rootGraph;
364
- }, a.prototype.add = function(e, t, n, r, i) {
365
- if (n == null && r == null && i == null) {
366
- if (e == null) throw "Graph is null!";
367
- if (t == null) throw "Parent node is null!";
368
- if (this.graphs.indexOf(e) > -1) throw "Graph already in this graph mgr!";
369
- if (this.graphs.push(e), e.parent != null) throw "Already has a parent!";
370
- if (t.child != null) throw "Already has a child!";
371
- return e.parent = t, t.child = e, e;
372
- }
373
- i = n, r = t, n = e;
374
- var a = r.getOwner(), o = i.getOwner();
375
- if (a == null || a.getGraphManager() != this) throw "Source not in this graph mgr!";
376
- if (o == null || o.getGraphManager() != this) throw "Target not in this graph mgr!";
377
- if (a == o) return n.isInterGraph = !1, a.add(n, r, i);
378
- if (n.isInterGraph = !0, n.source = r, n.target = i, this.edges.indexOf(n) > -1) throw "Edge already in inter-graph edge list!";
379
- if (this.edges.push(n), n.source == null || n.target == null) throw "Edge source and/or target is null!";
380
- if (n.source.edges.indexOf(n) != -1 || n.target.edges.indexOf(n) != -1) throw "Edge already in source and/or target incidency list!";
381
- return n.source.edges.push(n), n.target.edges.push(n), n;
382
- }, a.prototype.remove = function(e) {
383
- if (e instanceof r) {
384
- var t = e;
385
- if (t.getGraphManager() != this) throw "Graph not in this graph mgr";
386
- if (!(t == this.rootGraph || t.parent != null && t.parent.graphManager == this)) throw "Invalid parent node!";
387
- var n = [];
388
- n = n.concat(t.getEdges());
389
- for (var a, o = n.length, s = 0; s < o; s++) a = n[s], t.remove(a);
390
- var c = [];
391
- c = c.concat(t.getNodes());
392
- var l;
393
- o = c.length;
394
- for (var s = 0; s < o; s++) l = c[s], t.remove(l);
395
- t == this.rootGraph && this.setRootGraph(null);
396
- var u = this.graphs.indexOf(t);
397
- this.graphs.splice(u, 1), t.parent = null;
398
- } else if (e instanceof i) {
399
- if (a = e, a == null) throw "Edge is null!";
400
- if (!a.isInterGraph) throw "Not an inter-graph edge!";
401
- if (a.source == null || a.target == null) throw "Source and/or target is null!";
402
- if (a.source.edges.indexOf(a) == -1 || a.target.edges.indexOf(a) == -1) throw "Source and/or target doesn't know this edge!";
403
- var u = a.source.edges.indexOf(a);
404
- if (a.source.edges.splice(u, 1), u = a.target.edges.indexOf(a), a.target.edges.splice(u, 1), a.source.owner == null || a.source.owner.getGraphManager() == null) throw "Edge owner graph or owner graph manager is null!";
405
- if (a.source.owner.getGraphManager().edges.indexOf(a) == -1) throw "Not in owner graph manager's edge list!";
406
- var u = a.source.owner.getGraphManager().edges.indexOf(a);
407
- a.source.owner.getGraphManager().edges.splice(u, 1);
408
- }
409
- }, a.prototype.updateBounds = function() {
410
- this.rootGraph.updateBounds(!0);
411
- }, a.prototype.getGraphs = function() {
412
- return this.graphs;
413
- }, a.prototype.getAllNodes = function() {
414
- if (this.allNodes == null) {
415
- for (var e = [], t = this.getGraphs(), n = t.length, r = 0; r < n; r++) e = e.concat(t[r].getNodes());
416
- this.allNodes = e;
417
- }
418
- return this.allNodes;
419
- }, a.prototype.resetAllNodes = function() {
420
- this.allNodes = null;
421
- }, a.prototype.resetAllEdges = function() {
422
- this.allEdges = null;
423
- }, a.prototype.resetAllNodesToApplyGravitation = function() {
424
- this.allNodesToApplyGravitation = null;
425
- }, a.prototype.getAllEdges = function() {
426
- if (this.allEdges == null) {
427
- var e = [], t = this.getGraphs();
428
- t.length;
429
- for (var n = 0; n < t.length; n++) e = e.concat(t[n].getEdges());
430
- e = e.concat(this.edges), this.allEdges = e;
431
- }
432
- return this.allEdges;
433
- }, a.prototype.getAllNodesToApplyGravitation = function() {
434
- return this.allNodesToApplyGravitation;
435
- }, a.prototype.setAllNodesToApplyGravitation = function(e) {
436
- if (this.allNodesToApplyGravitation != null) throw "assert failed";
437
- this.allNodesToApplyGravitation = e;
438
- }, a.prototype.getRoot = function() {
439
- return this.rootGraph;
440
- }, a.prototype.setRootGraph = function(e) {
441
- if (e.getGraphManager() != this) throw "Root not in this graph mgr!";
442
- this.rootGraph = e, e.parent ??= this.layout.newNode("Root node");
443
- }, a.prototype.getLayout = function() {
444
- return this.layout;
445
- }, a.prototype.isOneAncestorOfOther = function(e, t) {
446
- if (e == null || t == null) throw "assert failed";
447
- if (e == t) return !0;
448
- var n = e.getOwner(), r;
449
- do {
450
- if (r = n.getParent(), r == null) break;
451
- if (r == t) return !0;
452
- if (n = r.getOwner(), n == null) break;
453
- } while (!0);
454
- n = t.getOwner();
455
- do {
456
- if (r = n.getParent(), r == null) break;
457
- if (r == e) return !0;
458
- if (n = r.getOwner(), n == null) break;
459
- } while (!0);
460
- return !1;
461
- }, a.prototype.calcLowestCommonAncestors = function() {
462
- for (var e, t, n, r, i, a = this.getAllEdges(), o = a.length, s = 0; s < o; s++) {
463
- if (e = a[s], t = e.source, n = e.target, e.lca = null, e.sourceInLca = t, e.targetInLca = n, t == n) {
464
- e.lca = t.getOwner();
465
- continue;
466
- }
467
- for (r = t.getOwner(); e.lca == null;) {
468
- for (e.targetInLca = n, i = n.getOwner(); e.lca == null;) {
469
- if (i == r) {
470
- e.lca = i;
471
- break;
472
- }
473
- if (i == this.rootGraph) break;
474
- if (e.lca != null) throw "assert failed";
475
- e.targetInLca = i.getParent(), i = e.targetInLca.getOwner();
476
- }
477
- if (r == this.rootGraph) break;
478
- e.lca ?? (e.sourceInLca = r.getParent(), r = e.sourceInLca.getOwner());
479
- }
480
- if (e.lca == null) throw "assert failed";
481
- }
482
- }, a.prototype.calcLowestCommonAncestor = function(e, t) {
483
- if (e == t) return e.getOwner();
484
- var n = e.getOwner();
485
- do {
486
- if (n == null) break;
487
- var r = t.getOwner();
488
- do {
489
- if (r == null) break;
490
- if (r == n) return r;
491
- r = r.getParent().getOwner();
492
- } while (!0);
493
- n = n.getParent().getOwner();
494
- } while (!0);
495
- return n;
496
- }, a.prototype.calcInclusionTreeDepths = function(e, t) {
497
- e == null && t == null && (e = this.rootGraph, t = 1);
498
- for (var n, r = e.getNodes(), i = r.length, a = 0; a < i; a++) n = r[a], n.inclusionTreeDepth = t, n.child != null && this.calcInclusionTreeDepths(n.child, t + 1);
499
- }, a.prototype.includesInvalidEdge = function() {
500
- for (var e, t = [], n = this.edges.length, r = 0; r < n; r++) e = this.edges[r], this.isOneAncestorOfOther(e.source, e.target) && t.push(e);
501
- for (var r = 0; r < t.length; r++) this.remove(t[r]);
502
- return !1;
503
- }, e.exports = a;
504
- }),
505
- (function(e, t, n) {
506
- var r = n(12);
507
- function i() {}
508
- i.calcSeparationAmount = function(e, t, n, r) {
509
- if (!e.intersects(t)) throw "assert failed";
510
- var i = [, ,];
511
- this.decideDirectionsForOverlappingNodes(e, t, i), n[0] = Math.min(e.getRight(), t.getRight()) - Math.max(e.x, t.x), n[1] = Math.min(e.getBottom(), t.getBottom()) - Math.max(e.y, t.y), e.getX() <= t.getX() && e.getRight() >= t.getRight() ? n[0] += Math.min(t.getX() - e.getX(), e.getRight() - t.getRight()) : t.getX() <= e.getX() && t.getRight() >= e.getRight() && (n[0] += Math.min(e.getX() - t.getX(), t.getRight() - e.getRight())), e.getY() <= t.getY() && e.getBottom() >= t.getBottom() ? n[1] += Math.min(t.getY() - e.getY(), e.getBottom() - t.getBottom()) : t.getY() <= e.getY() && t.getBottom() >= e.getBottom() && (n[1] += Math.min(e.getY() - t.getY(), t.getBottom() - e.getBottom()));
512
- var a = Math.abs((t.getCenterY() - e.getCenterY()) / (t.getCenterX() - e.getCenterX()));
513
- t.getCenterY() === e.getCenterY() && t.getCenterX() === e.getCenterX() && (a = 1);
514
- var o = a * n[0], s = n[1] / a;
515
- n[0] < s ? s = n[0] : o = n[1], n[0] = -1 * i[0] * (s / 2 + r), n[1] = -1 * i[1] * (o / 2 + r);
516
- }, i.decideDirectionsForOverlappingNodes = function(e, t, n) {
517
- n[0] = e.getCenterX() < t.getCenterX() ? -1 : 1, n[1] = e.getCenterY() < t.getCenterY() ? -1 : 1;
518
- }, i.getIntersection2 = function(e, t, n) {
519
- var r = e.getCenterX(), i = e.getCenterY(), a = t.getCenterX(), o = t.getCenterY();
520
- if (e.intersects(t)) return n[0] = r, n[1] = i, n[2] = a, n[3] = o, !0;
521
- var s = e.getX(), c = e.getY(), l = e.getRight(), u = e.getX(), d = e.getBottom(), f = e.getRight(), p = e.getWidthHalf(), m = e.getHeightHalf(), h = t.getX(), g = t.getY(), _ = t.getRight(), v = t.getX(), y = t.getBottom(), b = t.getRight(), x = t.getWidthHalf(), S = t.getHeightHalf(), C = !1, w = !1;
522
- if (r === a) {
523
- if (i > o) return n[0] = r, n[1] = c, n[2] = a, n[3] = y, !1;
524
- if (i < o) return n[0] = r, n[1] = d, n[2] = a, n[3] = g, !1;
525
- } else if (i === o) {
526
- if (r > a) return n[0] = s, n[1] = i, n[2] = _, n[3] = o, !1;
527
- if (r < a) return n[0] = l, n[1] = i, n[2] = h, n[3] = o, !1;
528
- } else {
529
- var T = e.height / e.width, E = t.height / t.width, D = (o - i) / (a - r), O = void 0, k = void 0, A = void 0, j = void 0, M = void 0, N = void 0;
530
- if (-T === D ? r > a ? (n[0] = u, n[1] = d, C = !0) : (n[0] = l, n[1] = c, C = !0) : T === D && (r > a ? (n[0] = s, n[1] = c, C = !0) : (n[0] = f, n[1] = d, C = !0)), -E === D ? a > r ? (n[2] = v, n[3] = y, w = !0) : (n[2] = _, n[3] = g, w = !0) : E === D && (a > r ? (n[2] = h, n[3] = g, w = !0) : (n[2] = b, n[3] = y, w = !0)), C && w) return !1;
531
- if (r > a ? i > o ? (O = this.getCardinalDirection(T, D, 4), k = this.getCardinalDirection(E, D, 2)) : (O = this.getCardinalDirection(-T, D, 3), k = this.getCardinalDirection(-E, D, 1)) : i > o ? (O = this.getCardinalDirection(-T, D, 1), k = this.getCardinalDirection(-E, D, 3)) : (O = this.getCardinalDirection(T, D, 2), k = this.getCardinalDirection(E, D, 4)), !C) switch (O) {
532
- case 1:
533
- j = c, A = r + -m / D, n[0] = A, n[1] = j;
534
- break;
535
- case 2:
536
- A = f, j = i + p * D, n[0] = A, n[1] = j;
537
- break;
538
- case 3:
539
- j = d, A = r + m / D, n[0] = A, n[1] = j;
540
- break;
541
- case 4: A = u, j = i + -p * D, n[0] = A, n[1] = j;
542
- }
543
- if (!w) switch (k) {
544
- case 1:
545
- N = g, M = a + -S / D, n[2] = M, n[3] = N;
546
- break;
547
- case 2:
548
- M = b, N = o + x * D, n[2] = M, n[3] = N;
549
- break;
550
- case 3:
551
- N = y, M = a + S / D, n[2] = M, n[3] = N;
552
- break;
553
- case 4: M = v, N = o + -x * D, n[2] = M, n[3] = N;
554
- }
555
- }
556
- return !1;
557
- }, i.getCardinalDirection = function(e, t, n) {
558
- return e > t ? n : 1 + n % 4;
559
- }, i.getIntersection = function(e, t, n, i) {
560
- if (i == null) return this.getIntersection2(e, t, n);
561
- var a = e.x, o = e.y, s = t.x, c = t.y, l = n.x, u = n.y, d = i.x, f = i.y, p = void 0, m = void 0, h = void 0, g = void 0, _ = void 0, v = void 0, y = void 0, b = void 0, x = void 0;
562
- return h = c - o, _ = a - s, y = s * o - a * c, g = f - u, v = l - d, b = d * u - l * f, x = h * v - g * _, x === 0 ? null : (p = (_ * b - v * y) / x, m = (g * y - h * b) / x, new r(p, m));
563
- }, i.angleOfVector = function(e, t, n, r) {
564
- var i = void 0;
565
- return e === n ? i = r < t ? this.ONE_AND_HALF_PI : this.HALF_PI : (i = Math.atan((r - t) / (n - e)), n < e ? i += Math.PI : r < t && (i += this.TWO_PI)), i;
566
- }, i.doIntersect = function(e, t, n, r) {
567
- var i = e.x, a = e.y, o = t.x, s = t.y, c = n.x, l = n.y, u = r.x, d = r.y, f = (o - i) * (d - l) - (u - c) * (s - a);
568
- if (f === 0) return !1;
569
- var p = ((d - l) * (u - i) + (c - u) * (d - a)) / f, m = ((a - s) * (u - i) + (o - i) * (d - a)) / f;
570
- return 0 < p && p < 1 && 0 < m && m < 1;
571
- }, i.findCircleLineIntersections = function(e, t, n, r, i, a, o) {
572
- var s = (n - e) * (n - e) + (r - t) * (r - t), c = 2 * ((e - i) * (n - e) + (t - a) * (r - t)), l = (e - i) * (e - i) + (t - a) * (t - a) - o * o;
573
- if (c * c - 4 * s * l >= 0) {
574
- var u = (-c + Math.sqrt(c * c - 4 * s * l)) / (2 * s), d = (-c - Math.sqrt(c * c - 4 * s * l)) / (2 * s);
575
- return u >= 0 && u <= 1 ? [u] : d >= 0 && d <= 1 ? [d] : null;
576
- }
577
- return null;
578
- }, i.HALF_PI = .5 * Math.PI, i.ONE_AND_HALF_PI = 1.5 * Math.PI, i.TWO_PI = 2 * Math.PI, i.THREE_PI = 3 * Math.PI, e.exports = i;
579
- }),
580
- (function(e, t, n) {
581
- function r() {}
582
- r.sign = function(e) {
583
- return e > 0 ? 1 : e < 0 ? -1 : 0;
584
- }, r.floor = function(e) {
585
- return e < 0 ? Math.ceil(e) : Math.floor(e);
586
- }, r.ceil = function(e) {
587
- return e < 0 ? Math.floor(e) : Math.ceil(e);
588
- }, e.exports = r;
589
- }),
590
- (function(e, t, n) {
591
- function r() {}
592
- r.MAX_VALUE = 2147483647, r.MIN_VALUE = -2147483648, e.exports = r;
593
- }),
594
- (function(e, t, n) {
595
- var r = function() {
596
- function e(e, t) {
597
- for (var n = 0; n < t.length; n++) {
598
- var r = t[n];
599
- r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(e, r.key, r);
600
- }
601
- }
602
- return function(t, n, r) {
603
- return n && e(t.prototype, n), r && e(t, r), t;
604
- };
605
- }();
606
- function i(e, t) {
607
- if (!(e instanceof t)) throw TypeError("Cannot call a class as a function");
608
- }
609
- var a = function(e) {
610
- return {
611
- value: e,
612
- next: null,
613
- prev: null
614
- };
615
- }, o = function(e, t, n, r) {
616
- return e === null ? r.head = t : e.next = t, n === null ? r.tail = t : n.prev = t, t.prev = e, t.next = n, r.length++, t;
617
- }, s = function(e, t) {
618
- var n = e.prev, r = e.next;
619
- return n === null ? t.head = r : n.next = r, r === null ? t.tail = n : r.prev = n, e.prev = e.next = null, t.length--, e;
620
- };
621
- e.exports = function() {
622
- function e(t) {
623
- var n = this;
624
- i(this, e), this.length = 0, this.head = null, this.tail = null, t?.forEach(function(e) {
625
- return n.push(e);
626
- });
627
- }
628
- return r(e, [
629
- {
630
- key: "size",
631
- value: function() {
632
- return this.length;
633
- }
634
- },
635
- {
636
- key: "insertBefore",
637
- value: function(e, t) {
638
- return o(t.prev, a(e), t, this);
639
- }
640
- },
641
- {
642
- key: "insertAfter",
643
- value: function(e, t) {
644
- return o(t, a(e), t.next, this);
645
- }
646
- },
647
- {
648
- key: "insertNodeBefore",
649
- value: function(e, t) {
650
- return o(t.prev, e, t, this);
651
- }
652
- },
653
- {
654
- key: "insertNodeAfter",
655
- value: function(e, t) {
656
- return o(t, e, t.next, this);
657
- }
658
- },
659
- {
660
- key: "push",
661
- value: function(e) {
662
- return o(this.tail, a(e), null, this);
663
- }
664
- },
665
- {
666
- key: "unshift",
667
- value: function(e) {
668
- return o(null, a(e), this.head, this);
669
- }
670
- },
671
- {
672
- key: "remove",
673
- value: function(e) {
674
- return s(e, this);
675
- }
676
- },
677
- {
678
- key: "pop",
679
- value: function() {
680
- return s(this.tail, this).value;
681
- }
682
- },
683
- {
684
- key: "popNode",
685
- value: function() {
686
- return s(this.tail, this);
687
- }
688
- },
689
- {
690
- key: "shift",
691
- value: function() {
692
- return s(this.head, this).value;
693
- }
694
- },
695
- {
696
- key: "shiftNode",
697
- value: function() {
698
- return s(this.head, this);
699
- }
700
- },
701
- {
702
- key: "get_object_at",
703
- value: function(e) {
704
- if (e <= this.length()) {
705
- for (var t = 1, n = this.head; t < e;) n = n.next, t++;
706
- return n.value;
707
- }
708
- }
709
- },
710
- {
711
- key: "set_object_at",
712
- value: function(e, t) {
713
- if (e <= this.length()) {
714
- for (var n = 1, r = this.head; n < e;) r = r.next, n++;
715
- r.value = t;
716
- }
717
- }
718
- }
719
- ]), e;
720
- }();
721
- }),
722
- (function(e, t, n) {
723
- function r(e, t, n) {
724
- this.x = null, this.y = null, e == null && t == null && n == null ? (this.x = 0, this.y = 0) : typeof e == "number" && typeof t == "number" && n == null ? (this.x = e, this.y = t) : e.constructor.name == "Point" && t == null && n == null && (n = e, this.x = n.x, this.y = n.y);
725
- }
726
- r.prototype.getX = function() {
727
- return this.x;
728
- }, r.prototype.getY = function() {
729
- return this.y;
730
- }, r.prototype.getLocation = function() {
731
- return new r(this.x, this.y);
732
- }, r.prototype.setLocation = function(e, t, n) {
733
- e.constructor.name == "Point" && t == null && n == null ? (n = e, this.setLocation(n.x, n.y)) : typeof e == "number" && typeof t == "number" && n == null && (parseInt(e) == e && parseInt(t) == t ? this.move(e, t) : (this.x = Math.floor(e + .5), this.y = Math.floor(t + .5)));
734
- }, r.prototype.move = function(e, t) {
735
- this.x = e, this.y = t;
736
- }, r.prototype.translate = function(e, t) {
737
- this.x += e, this.y += t;
738
- }, r.prototype.equals = function(e) {
739
- if (e.constructor.name == "Point") {
740
- var t = e;
741
- return this.x == t.x && this.y == t.y;
742
- }
743
- return this == e;
744
- }, r.prototype.toString = function() {
745
- return new r().constructor.name + "[x=" + this.x + ",y=" + this.y + "]";
746
- }, e.exports = r;
747
- }),
748
- (function(e, t, n) {
749
- function r(e, t, n, r) {
750
- this.x = 0, this.y = 0, this.width = 0, this.height = 0, e != null && t != null && n != null && r != null && (this.x = e, this.y = t, this.width = n, this.height = r);
751
- }
752
- r.prototype.getX = function() {
753
- return this.x;
754
- }, r.prototype.setX = function(e) {
755
- this.x = e;
756
- }, r.prototype.getY = function() {
757
- return this.y;
758
- }, r.prototype.setY = function(e) {
759
- this.y = e;
760
- }, r.prototype.getWidth = function() {
761
- return this.width;
762
- }, r.prototype.setWidth = function(e) {
763
- this.width = e;
764
- }, r.prototype.getHeight = function() {
765
- return this.height;
766
- }, r.prototype.setHeight = function(e) {
767
- this.height = e;
768
- }, r.prototype.getRight = function() {
769
- return this.x + this.width;
770
- }, r.prototype.getBottom = function() {
771
- return this.y + this.height;
772
- }, r.prototype.intersects = function(e) {
773
- return !(this.getRight() < e.x || this.getBottom() < e.y || e.getRight() < this.x || e.getBottom() < this.y);
774
- }, r.prototype.getCenterX = function() {
775
- return this.x + this.width / 2;
776
- }, r.prototype.getMinX = function() {
777
- return this.getX();
778
- }, r.prototype.getMaxX = function() {
779
- return this.getX() + this.width;
780
- }, r.prototype.getCenterY = function() {
781
- return this.y + this.height / 2;
782
- }, r.prototype.getMinY = function() {
783
- return this.getY();
784
- }, r.prototype.getMaxY = function() {
785
- return this.getY() + this.height;
786
- }, r.prototype.getWidthHalf = function() {
787
- return this.width / 2;
788
- }, r.prototype.getHeightHalf = function() {
789
- return this.height / 2;
790
- }, e.exports = r;
791
- }),
792
- (function(e, t, n) {
793
- var r = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(e) {
794
- return typeof e;
795
- } : function(e) {
796
- return e && typeof Symbol == "function" && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
797
- };
798
- function i() {}
799
- i.lastID = 0, i.createID = function(e) {
800
- return i.isPrimitive(e) ? e : e.uniqueID == null ? (e.uniqueID = i.getString(), i.lastID++, e.uniqueID) : e.uniqueID;
801
- }, i.getString = function(e) {
802
- return e ??= i.lastID, "Object#" + e;
803
- }, i.isPrimitive = function(e) {
804
- var t = e === void 0 ? "undefined" : r(e);
805
- return e == null || t != "object" && t != "function";
806
- }, e.exports = i;
807
- }),
808
- (function(e, t, n) {
809
- function r(e) {
810
- if (Array.isArray(e)) {
811
- for (var t = 0, n = Array(e.length); t < e.length; t++) n[t] = e[t];
812
- return n;
813
- }
814
- return Array.from(e);
815
- }
816
- var i = n(0), a = n(7), o = n(3), s = n(1), c = n(6), l = n(5), u = n(17), d = n(29);
817
- function f(e) {
818
- d.call(this), this.layoutQuality = i.QUALITY, this.createBendsAsNeeded = i.DEFAULT_CREATE_BENDS_AS_NEEDED, this.incremental = i.DEFAULT_INCREMENTAL, this.animationOnLayout = i.DEFAULT_ANIMATION_ON_LAYOUT, this.animationDuringLayout = i.DEFAULT_ANIMATION_DURING_LAYOUT, this.animationPeriod = i.DEFAULT_ANIMATION_PERIOD, this.uniformLeafNodeSizes = i.DEFAULT_UNIFORM_LEAF_NODE_SIZES, this.edgeToDummyNodes = /* @__PURE__ */ new Map(), this.graphManager = new a(this), this.isLayoutFinished = !1, this.isSubLayout = !1, this.isRemoteUse = !1, e != null && (this.isRemoteUse = e);
819
- }
820
- f.RANDOM_SEED = 1, f.prototype = Object.create(d.prototype), f.prototype.getGraphManager = function() {
821
- return this.graphManager;
822
- }, f.prototype.getAllNodes = function() {
823
- return this.graphManager.getAllNodes();
824
- }, f.prototype.getAllEdges = function() {
825
- return this.graphManager.getAllEdges();
826
- }, f.prototype.getAllNodesToApplyGravitation = function() {
827
- return this.graphManager.getAllNodesToApplyGravitation();
828
- }, f.prototype.newGraphManager = function() {
829
- var e = new a(this);
830
- return this.graphManager = e, e;
831
- }, f.prototype.newGraph = function(e) {
832
- return new c(null, this.graphManager, e);
833
- }, f.prototype.newNode = function(e) {
834
- return new o(this.graphManager, e);
835
- }, f.prototype.newEdge = function(e) {
836
- return new s(null, null, e);
837
- }, f.prototype.checkLayoutSuccess = function() {
838
- return this.graphManager.getRoot() == null || this.graphManager.getRoot().getNodes().length == 0 || this.graphManager.includesInvalidEdge();
839
- }, f.prototype.runLayout = function() {
840
- this.isLayoutFinished = !1, this.tilingPreLayout && this.tilingPreLayout(), this.initParameters();
841
- var e = !this.checkLayoutSuccess() && this.layout();
842
- return i.ANIMATE !== "during" && (e && (this.isSubLayout || this.doPostLayout()), this.tilingPostLayout && this.tilingPostLayout(), this.isLayoutFinished = !0, e);
843
- }, f.prototype.doPostLayout = function() {
844
- this.incremental || this.transform(), this.update();
845
- }, f.prototype.update2 = function() {
846
- if (this.createBendsAsNeeded && (this.createBendpointsFromDummyNodes(), this.graphManager.resetAllEdges()), !this.isRemoteUse) {
847
- for (var e = this.graphManager.getAllEdges(), t = 0; t < e.length; t++) e[t];
848
- for (var n = this.graphManager.getRoot().getNodes(), t = 0; t < n.length; t++) n[t];
849
- this.update(this.graphManager.getRoot());
850
- }
851
- }, f.prototype.update = function(e) {
852
- if (e == null) this.update2();
853
- else if (e instanceof o) {
854
- var t = e;
855
- if (t.getChild() != null) for (var n = t.getChild().getNodes(), r = 0; r < n.length; r++) update(n[r]);
856
- t.vGraphObject != null && t.vGraphObject.update(t);
857
- } else if (e instanceof s) {
858
- var i = e;
859
- i.vGraphObject != null && i.vGraphObject.update(i);
860
- } else if (e instanceof c) {
861
- var a = e;
862
- a.vGraphObject != null && a.vGraphObject.update(a);
863
- }
864
- }, f.prototype.initParameters = function() {
865
- this.isSubLayout || (this.layoutQuality = i.QUALITY, this.animationDuringLayout = i.DEFAULT_ANIMATION_DURING_LAYOUT, this.animationPeriod = i.DEFAULT_ANIMATION_PERIOD, this.animationOnLayout = i.DEFAULT_ANIMATION_ON_LAYOUT, this.incremental = i.DEFAULT_INCREMENTAL, this.createBendsAsNeeded = i.DEFAULT_CREATE_BENDS_AS_NEEDED, this.uniformLeafNodeSizes = i.DEFAULT_UNIFORM_LEAF_NODE_SIZES), this.animationDuringLayout && (this.animationOnLayout = !1);
866
- }, f.prototype.transform = function(e) {
867
- if (e == null) this.transform(new l(0, 0));
868
- else {
869
- var t = new u(), n = this.graphManager.getRoot().updateLeftTop();
870
- if (n != null) {
871
- t.setWorldOrgX(e.x), t.setWorldOrgY(e.y), t.setDeviceOrgX(n.x), t.setDeviceOrgY(n.y);
872
- for (var r = this.getAllNodes(), i, a = 0; a < r.length; a++) i = r[a], i.transform(t);
873
- }
874
- }
875
- }, f.prototype.positionNodesRandomly = function(e) {
876
- if (e == null) this.positionNodesRandomly(this.getGraphManager().getRoot()), this.getGraphManager().getRoot().updateBounds(!0);
877
- else for (var t, n, r = e.getNodes(), i = 0; i < r.length; i++) t = r[i], n = t.getChild(), n == null || n.getNodes().length == 0 ? t.scatter() : (this.positionNodesRandomly(n), t.updateBounds());
878
- }, f.prototype.getFlatForest = function() {
879
- for (var e = [], t = !0, n = this.graphManager.getRoot().getNodes(), i = !0, a = 0; a < n.length; a++) n[a].getChild() != null && (i = !1);
880
- if (!i) return e;
881
- var o = /* @__PURE__ */ new Set(), s = [], c = /* @__PURE__ */ new Map(), l = [];
882
- for (l = l.concat(n); l.length > 0 && t;) {
883
- for (s.push(l[0]); s.length > 0 && t;) {
884
- var u = s[0];
885
- s.splice(0, 1), o.add(u);
886
- for (var d = u.getEdges(), a = 0; a < d.length; a++) {
887
- var f = d[a].getOtherEnd(u);
888
- if (c.get(u) != f) {
889
- if (!o.has(f)) s.push(f), c.set(f, u);
890
- else {
891
- t = !1;
892
- break;
893
- }
894
- }
895
- }
896
- }
897
- if (!t) e = [];
898
- else {
899
- var p = [].concat(r(o));
900
- e.push(p);
901
- for (var a = 0; a < p.length; a++) {
902
- var m = p[a], h = l.indexOf(m);
903
- h > -1 && l.splice(h, 1);
904
- }
905
- o = /* @__PURE__ */ new Set(), c = /* @__PURE__ */ new Map();
906
- }
907
- }
908
- return e;
909
- }, f.prototype.createDummyNodesForBendpoints = function(e) {
910
- for (var t = [], n = e.source, r = this.graphManager.calcLowestCommonAncestor(e.source, e.target), i = 0; i < e.bendpoints.length; i++) {
911
- var a = this.newNode(null);
912
- a.setRect(new Point(0, 0), new Dimension(1, 1)), r.add(a);
913
- var o = this.newEdge(null);
914
- this.graphManager.add(o, n, a), t.add(a), n = a;
915
- }
916
- var o = this.newEdge(null);
917
- return this.graphManager.add(o, n, e.target), this.edgeToDummyNodes.set(e, t), e.isInterGraph() ? this.graphManager.remove(e) : r.remove(e), t;
918
- }, f.prototype.createBendpointsFromDummyNodes = function() {
919
- var e = [];
920
- e = e.concat(this.graphManager.getAllEdges()), e = [].concat(r(this.edgeToDummyNodes.keys()), e);
921
- for (var t = 0; t < e.length; t++) {
922
- var n = e[t];
923
- if (n.bendpoints.length > 0) {
924
- for (var i = this.edgeToDummyNodes.get(n), a = 0; a < i.length; a++) {
925
- var o = i[a], s = new l(o.getCenterX(), o.getCenterY()), c = n.bendpoints.get(a);
926
- c.x = s.x, c.y = s.y, o.getOwner().remove(o);
927
- }
928
- this.graphManager.add(n, n.source, n.target);
929
- }
930
- }
931
- }, f.transform = function(e, t, n, r) {
932
- if (n != null && r != null) {
933
- var i = t;
934
- if (e <= 50) {
935
- var a = t / n;
936
- i -= (t - a) / 50 * (50 - e);
937
- } else {
938
- var o = t * r;
939
- i += (o - t) / 50 * (e - 50);
940
- }
941
- return i;
942
- }
943
- var s, c;
944
- return e <= 50 ? (s = 9 * t / 500, c = t / 10) : (s = 9 * t / 50, c = -8 * t), s * e + c;
945
- }, f.findCenterOfTree = function(e) {
946
- var t = [];
947
- t = t.concat(e);
948
- var n = [], r = /* @__PURE__ */ new Map(), i = !1, a = null;
949
- (t.length == 1 || t.length == 2) && (i = !0, a = t[0]);
950
- for (var o = 0; o < t.length; o++) {
951
- var s = t[o], c = s.getNeighborsList().size;
952
- r.set(s, s.getNeighborsList().size), c == 1 && n.push(s);
953
- }
954
- var l = [];
955
- for (l = l.concat(n); !i;) {
956
- var u = [];
957
- u = u.concat(l), l = [];
958
- for (var o = 0; o < t.length; o++) {
959
- var s = t[o], d = t.indexOf(s);
960
- d >= 0 && t.splice(d, 1), s.getNeighborsList().forEach(function(e) {
961
- if (n.indexOf(e) < 0) {
962
- var t = r.get(e) - 1;
963
- t == 1 && l.push(e), r.set(e, t);
964
- }
965
- });
966
- }
967
- n = n.concat(l), (t.length == 1 || t.length == 2) && (i = !0, a = t[0]);
968
- }
969
- return a;
970
- }, f.prototype.setGraphManager = function(e) {
971
- this.graphManager = e;
972
- }, e.exports = f;
973
- }),
974
- (function(e, t, n) {
975
- function r() {}
976
- r.seed = 1, r.x = 0, r.nextDouble = function() {
977
- return r.x = Math.sin(r.seed++) * 1e4, r.x - Math.floor(r.x);
978
- }, e.exports = r;
979
- }),
980
- (function(e, t, n) {
981
- var r = n(5);
982
- function i(e, t) {
983
- this.lworldOrgX = 0, this.lworldOrgY = 0, this.ldeviceOrgX = 0, this.ldeviceOrgY = 0, this.lworldExtX = 1, this.lworldExtY = 1, this.ldeviceExtX = 1, this.ldeviceExtY = 1;
984
- }
985
- i.prototype.getWorldOrgX = function() {
986
- return this.lworldOrgX;
987
- }, i.prototype.setWorldOrgX = function(e) {
988
- this.lworldOrgX = e;
989
- }, i.prototype.getWorldOrgY = function() {
990
- return this.lworldOrgY;
991
- }, i.prototype.setWorldOrgY = function(e) {
992
- this.lworldOrgY = e;
993
- }, i.prototype.getWorldExtX = function() {
994
- return this.lworldExtX;
995
- }, i.prototype.setWorldExtX = function(e) {
996
- this.lworldExtX = e;
997
- }, i.prototype.getWorldExtY = function() {
998
- return this.lworldExtY;
999
- }, i.prototype.setWorldExtY = function(e) {
1000
- this.lworldExtY = e;
1001
- }, i.prototype.getDeviceOrgX = function() {
1002
- return this.ldeviceOrgX;
1003
- }, i.prototype.setDeviceOrgX = function(e) {
1004
- this.ldeviceOrgX = e;
1005
- }, i.prototype.getDeviceOrgY = function() {
1006
- return this.ldeviceOrgY;
1007
- }, i.prototype.setDeviceOrgY = function(e) {
1008
- this.ldeviceOrgY = e;
1009
- }, i.prototype.getDeviceExtX = function() {
1010
- return this.ldeviceExtX;
1011
- }, i.prototype.setDeviceExtX = function(e) {
1012
- this.ldeviceExtX = e;
1013
- }, i.prototype.getDeviceExtY = function() {
1014
- return this.ldeviceExtY;
1015
- }, i.prototype.setDeviceExtY = function(e) {
1016
- this.ldeviceExtY = e;
1017
- }, i.prototype.transformX = function(e) {
1018
- var t = 0, n = this.lworldExtX;
1019
- return n != 0 && (t = this.ldeviceOrgX + (e - this.lworldOrgX) * this.ldeviceExtX / n), t;
1020
- }, i.prototype.transformY = function(e) {
1021
- var t = 0, n = this.lworldExtY;
1022
- return n != 0 && (t = this.ldeviceOrgY + (e - this.lworldOrgY) * this.ldeviceExtY / n), t;
1023
- }, i.prototype.inverseTransformX = function(e) {
1024
- var t = 0, n = this.ldeviceExtX;
1025
- return n != 0 && (t = this.lworldOrgX + (e - this.ldeviceOrgX) * this.lworldExtX / n), t;
1026
- }, i.prototype.inverseTransformY = function(e) {
1027
- var t = 0, n = this.ldeviceExtY;
1028
- return n != 0 && (t = this.lworldOrgY + (e - this.ldeviceOrgY) * this.lworldExtY / n), t;
1029
- }, i.prototype.inverseTransformPoint = function(e) {
1030
- return new r(this.inverseTransformX(e.x), this.inverseTransformY(e.y));
1031
- }, e.exports = i;
1032
- }),
1033
- (function(e, t, n) {
1034
- function r(e) {
1035
- if (Array.isArray(e)) {
1036
- for (var t = 0, n = Array(e.length); t < e.length; t++) n[t] = e[t];
1037
- return n;
1038
- }
1039
- return Array.from(e);
1040
- }
1041
- var i = n(15), a = n(4), o = n(0), s = n(8), c = n(9);
1042
- function l() {
1043
- i.call(this), this.useSmartIdealEdgeLengthCalculation = a.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION, this.gravityConstant = a.DEFAULT_GRAVITY_STRENGTH, this.compoundGravityConstant = a.DEFAULT_COMPOUND_GRAVITY_STRENGTH, this.gravityRangeFactor = a.DEFAULT_GRAVITY_RANGE_FACTOR, this.compoundGravityRangeFactor = a.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR, this.displacementThresholdPerNode = 3 * a.DEFAULT_EDGE_LENGTH / 100, this.coolingFactor = a.DEFAULT_COOLING_FACTOR_INCREMENTAL, this.initialCoolingFactor = a.DEFAULT_COOLING_FACTOR_INCREMENTAL, this.totalDisplacement = 0, this.oldTotalDisplacement = 0, this.maxIterations = a.MAX_ITERATIONS;
1044
- }
1045
- for (var u in l.prototype = Object.create(i.prototype), i) l[u] = i[u];
1046
- l.prototype.initParameters = function() {
1047
- i.prototype.initParameters.call(this, arguments), this.totalIterations = 0, this.notAnimatedIterations = 0, this.useFRGridVariant = a.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION, this.grid = [];
1048
- }, l.prototype.calcIdealEdgeLengths = function() {
1049
- for (var e, t, n, r, i, s, c, l = this.getGraphManager().getAllEdges(), u = 0; u < l.length; u++) e = l[u], t = e.idealLength, e.isInterGraph && (r = e.getSource(), i = e.getTarget(), s = e.getSourceInLca().getEstimatedSize(), c = e.getTargetInLca().getEstimatedSize(), this.useSmartIdealEdgeLengthCalculation && (e.idealLength += s + c - 2 * o.SIMPLE_NODE_SIZE), n = e.getLca().getInclusionTreeDepth(), e.idealLength += t * a.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR * (r.getInclusionTreeDepth() + i.getInclusionTreeDepth() - 2 * n));
1050
- }, l.prototype.initSpringEmbedder = function() {
1051
- var e = this.getAllNodes().length;
1052
- this.incremental ? (e > a.ADAPTATION_LOWER_NODE_LIMIT && (this.coolingFactor = Math.max(this.coolingFactor * a.COOLING_ADAPTATION_FACTOR, this.coolingFactor - (e - a.ADAPTATION_LOWER_NODE_LIMIT) / (a.ADAPTATION_UPPER_NODE_LIMIT - a.ADAPTATION_LOWER_NODE_LIMIT) * this.coolingFactor * (1 - a.COOLING_ADAPTATION_FACTOR))), this.maxNodeDisplacement = a.MAX_NODE_DISPLACEMENT_INCREMENTAL) : (this.coolingFactor = e > a.ADAPTATION_LOWER_NODE_LIMIT ? Math.max(a.COOLING_ADAPTATION_FACTOR, 1 - (e - a.ADAPTATION_LOWER_NODE_LIMIT) / (a.ADAPTATION_UPPER_NODE_LIMIT - a.ADAPTATION_LOWER_NODE_LIMIT) * (1 - a.COOLING_ADAPTATION_FACTOR)) : 1, this.initialCoolingFactor = this.coolingFactor, this.maxNodeDisplacement = a.MAX_NODE_DISPLACEMENT), this.maxIterations = Math.max(this.getAllNodes().length * 5, this.maxIterations), this.displacementThresholdPerNode = 3 * a.DEFAULT_EDGE_LENGTH / 100, this.totalDisplacementThreshold = this.displacementThresholdPerNode * this.getAllNodes().length, this.repulsionRange = this.calcRepulsionRange();
1053
- }, l.prototype.calcSpringForces = function() {
1054
- for (var e = this.getAllEdges(), t, n = 0; n < e.length; n++) t = e[n], this.calcSpringForce(t, t.idealLength);
1055
- }, l.prototype.calcRepulsionForces = function() {
1056
- var e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : !0, t = arguments.length > 1 && arguments[1] !== void 0 && arguments[1], n, r, i, o, s = this.getAllNodes(), c;
1057
- if (this.useFRGridVariant) for (this.totalIterations % a.GRID_CALCULATION_CHECK_PERIOD == 1 && e && this.updateGrid(), c = /* @__PURE__ */ new Set(), n = 0; n < s.length; n++) i = s[n], this.calculateRepulsionForceOfANode(i, c, e, t), c.add(i);
1058
- else for (n = 0; n < s.length; n++) for (i = s[n], r = n + 1; r < s.length; r++) o = s[r], i.getOwner() == o.getOwner() && this.calcRepulsionForce(i, o);
1059
- }, l.prototype.calcGravitationalForces = function() {
1060
- for (var e, t = this.getAllNodesToApplyGravitation(), n = 0; n < t.length; n++) e = t[n], this.calcGravitationalForce(e);
1061
- }, l.prototype.moveNodes = function() {
1062
- for (var e = this.getAllNodes(), t, n = 0; n < e.length; n++) t = e[n], t.move();
1063
- }, l.prototype.calcSpringForce = function(e, t) {
1064
- var n = e.getSource(), r = e.getTarget(), i, a, o, s;
1065
- if (this.uniformLeafNodeSizes && n.getChild() == null && r.getChild() == null) e.updateLengthSimple();
1066
- else if (e.updateLength(), e.isOverlapingSourceAndTarget) return;
1067
- i = e.getLength(), i != 0 && (a = e.edgeElasticity * (i - t), o = a * (e.lengthX / i), s = a * (e.lengthY / i), n.springForceX += o, n.springForceY += s, r.springForceX -= o, r.springForceY -= s);
1068
- }, l.prototype.calcRepulsionForce = function(e, t) {
1069
- var n = e.getRect(), r = t.getRect(), i = [, ,], o = [
1070
- ,
1071
- ,
1072
- ,
1073
- ,
1074
- ], l, u, d, f, p, m, h;
1075
- if (n.intersects(r)) {
1076
- s.calcSeparationAmount(n, r, i, a.DEFAULT_EDGE_LENGTH / 2), m = 2 * i[0], h = 2 * i[1];
1077
- var g = e.noOfChildren * t.noOfChildren / (e.noOfChildren + t.noOfChildren);
1078
- e.repulsionForceX -= g * m, e.repulsionForceY -= g * h, t.repulsionForceX += g * m, t.repulsionForceY += g * h;
1079
- } else this.uniformLeafNodeSizes && e.getChild() == null && t.getChild() == null ? (l = r.getCenterX() - n.getCenterX(), u = r.getCenterY() - n.getCenterY()) : (s.getIntersection(n, r, o), l = o[2] - o[0], u = o[3] - o[1]), Math.abs(l) < a.MIN_REPULSION_DIST && (l = c.sign(l) * a.MIN_REPULSION_DIST), Math.abs(u) < a.MIN_REPULSION_DIST && (u = c.sign(u) * a.MIN_REPULSION_DIST), d = l * l + u * u, f = Math.sqrt(d), p = (e.nodeRepulsion / 2 + t.nodeRepulsion / 2) * e.noOfChildren * t.noOfChildren / d, m = p * l / f, h = p * u / f, e.repulsionForceX -= m, e.repulsionForceY -= h, t.repulsionForceX += m, t.repulsionForceY += h;
1080
- }, l.prototype.calcGravitationalForce = function(e) {
1081
- var t = e.getOwner(), n = (t.getRight() + t.getLeft()) / 2, r = (t.getTop() + t.getBottom()) / 2, i = e.getCenterX() - n, a = e.getCenterY() - r, o = Math.abs(i) + e.getWidth() / 2, s = Math.abs(a) + e.getHeight() / 2, c;
1082
- e.getOwner() == this.graphManager.getRoot() ? (c = t.getEstimatedSize() * this.gravityRangeFactor, (o > c || s > c) && (e.gravitationForceX = -this.gravityConstant * i, e.gravitationForceY = -this.gravityConstant * a)) : (c = t.getEstimatedSize() * this.compoundGravityRangeFactor, (o > c || s > c) && (e.gravitationForceX = -this.gravityConstant * i * this.compoundGravityConstant, e.gravitationForceY = -this.gravityConstant * a * this.compoundGravityConstant));
1083
- }, l.prototype.isConverged = function() {
1084
- var e, t = !1;
1085
- return this.totalIterations > this.maxIterations / 3 && (t = Math.abs(this.totalDisplacement - this.oldTotalDisplacement) < 2), e = this.totalDisplacement < this.totalDisplacementThreshold, this.oldTotalDisplacement = this.totalDisplacement, e || t;
1086
- }, l.prototype.animate = function() {
1087
- this.animationDuringLayout && !this.isSubLayout && (this.notAnimatedIterations == this.animationPeriod ? (this.update(), this.notAnimatedIterations = 0) : this.notAnimatedIterations++);
1088
- }, l.prototype.calcNoOfChildrenForAllNodes = function() {
1089
- for (var e, t = this.graphManager.getAllNodes(), n = 0; n < t.length; n++) e = t[n], e.noOfChildren = e.getNoOfChildren();
1090
- }, l.prototype.calcGrid = function(e) {
1091
- var t = 0, n = 0;
1092
- t = parseInt(Math.ceil((e.getRight() - e.getLeft()) / this.repulsionRange)), n = parseInt(Math.ceil((e.getBottom() - e.getTop()) / this.repulsionRange));
1093
- for (var r = Array(t), i = 0; i < t; i++) r[i] = Array(n);
1094
- for (var i = 0; i < t; i++) for (var a = 0; a < n; a++) r[i][a] = [];
1095
- return r;
1096
- }, l.prototype.addNodeToGrid = function(e, t, n) {
1097
- var r = 0, i = 0, a = 0, o = 0;
1098
- r = parseInt(Math.floor((e.getRect().x - t) / this.repulsionRange)), i = parseInt(Math.floor((e.getRect().width + e.getRect().x - t) / this.repulsionRange)), a = parseInt(Math.floor((e.getRect().y - n) / this.repulsionRange)), o = parseInt(Math.floor((e.getRect().height + e.getRect().y - n) / this.repulsionRange));
1099
- for (var s = r; s <= i; s++) for (var c = a; c <= o; c++) this.grid[s][c].push(e), e.setGridCoordinates(r, i, a, o);
1100
- }, l.prototype.updateGrid = function() {
1101
- var e, t, n = this.getAllNodes();
1102
- for (this.grid = this.calcGrid(this.graphManager.getRoot()), e = 0; e < n.length; e++) t = n[e], this.addNodeToGrid(t, this.graphManager.getRoot().getLeft(), this.graphManager.getRoot().getTop());
1103
- }, l.prototype.calculateRepulsionForceOfANode = function(e, t, n, i) {
1104
- if (this.totalIterations % a.GRID_CALCULATION_CHECK_PERIOD == 1 && n || i) {
1105
- var o = /* @__PURE__ */ new Set();
1106
- e.surrounding = [];
1107
- for (var s, c = this.grid, l = e.startX - 1; l < e.finishX + 2; l++) for (var u = e.startY - 1; u < e.finishY + 2; u++) if (!(l < 0 || u < 0 || l >= c.length || u >= c[0].length)) {
1108
- for (var d = 0; d < c[l][u].length; d++) if (s = c[l][u][d], e.getOwner() == s.getOwner() && e != s && !t.has(s) && !o.has(s)) {
1109
- var f = Math.abs(e.getCenterX() - s.getCenterX()) - (e.getWidth() / 2 + s.getWidth() / 2), p = Math.abs(e.getCenterY() - s.getCenterY()) - (e.getHeight() / 2 + s.getHeight() / 2);
1110
- f <= this.repulsionRange && p <= this.repulsionRange && o.add(s);
1111
- }
1112
- }
1113
- e.surrounding = [].concat(r(o));
1114
- }
1115
- for (l = 0; l < e.surrounding.length; l++) this.calcRepulsionForce(e, e.surrounding[l]);
1116
- }, l.prototype.calcRepulsionRange = function() {
1117
- return 0;
1118
- }, e.exports = l;
1119
- }),
1120
- (function(e, t, n) {
1121
- var r = n(1), i = n(4);
1122
- function a(e, t, n) {
1123
- r.call(this, e, t, n), this.idealLength = i.DEFAULT_EDGE_LENGTH, this.edgeElasticity = i.DEFAULT_SPRING_STRENGTH;
1124
- }
1125
- for (var o in a.prototype = Object.create(r.prototype), r) a[o] = r[o];
1126
- e.exports = a;
1127
- }),
1128
- (function(e, t, n) {
1129
- var r = n(3), i = n(4);
1130
- function a(e, t, n, a) {
1131
- r.call(this, e, t, n, a), this.nodeRepulsion = i.DEFAULT_REPULSION_STRENGTH, this.springForceX = 0, this.springForceY = 0, this.repulsionForceX = 0, this.repulsionForceY = 0, this.gravitationForceX = 0, this.gravitationForceY = 0, this.displacementX = 0, this.displacementY = 0, this.startX = 0, this.finishX = 0, this.startY = 0, this.finishY = 0, this.surrounding = [];
1132
- }
1133
- for (var o in a.prototype = Object.create(r.prototype), r) a[o] = r[o];
1134
- a.prototype.setGridCoordinates = function(e, t, n, r) {
1135
- this.startX = e, this.finishX = t, this.startY = n, this.finishY = r;
1136
- }, e.exports = a;
1137
- }),
1138
- (function(e, t, n) {
1139
- function r(e, t) {
1140
- this.width = 0, this.height = 0, e !== null && t !== null && (this.height = t, this.width = e);
1141
- }
1142
- r.prototype.getWidth = function() {
1143
- return this.width;
1144
- }, r.prototype.setWidth = function(e) {
1145
- this.width = e;
1146
- }, r.prototype.getHeight = function() {
1147
- return this.height;
1148
- }, r.prototype.setHeight = function(e) {
1149
- this.height = e;
1150
- }, e.exports = r;
1151
- }),
1152
- (function(e, t, n) {
1153
- var r = n(14);
1154
- function i() {
1155
- this.map = {}, this.keys = [];
1156
- }
1157
- i.prototype.put = function(e, t) {
1158
- var n = r.createID(e);
1159
- this.contains(n) || (this.map[n] = t, this.keys.push(e));
1160
- }, i.prototype.contains = function(e) {
1161
- return r.createID(e), this.map[e] != null;
1162
- }, i.prototype.get = function(e) {
1163
- var t = r.createID(e);
1164
- return this.map[t];
1165
- }, i.prototype.keySet = function() {
1166
- return this.keys;
1167
- }, e.exports = i;
1168
- }),
1169
- (function(e, t, n) {
1170
- var r = n(14);
1171
- function i() {
1172
- this.set = {};
1173
- }
1174
- i.prototype.add = function(e) {
1175
- var t = r.createID(e);
1176
- this.contains(t) || (this.set[t] = e);
1177
- }, i.prototype.remove = function(e) {
1178
- delete this.set[r.createID(e)];
1179
- }, i.prototype.clear = function() {
1180
- this.set = {};
1181
- }, i.prototype.contains = function(e) {
1182
- return this.set[r.createID(e)] == e;
1183
- }, i.prototype.isEmpty = function() {
1184
- return this.size() === 0;
1185
- }, i.prototype.size = function() {
1186
- return Object.keys(this.set).length;
1187
- }, i.prototype.addAllTo = function(e) {
1188
- for (var t = Object.keys(this.set), n = t.length, r = 0; r < n; r++) e.push(this.set[t[r]]);
1189
- }, i.prototype.size = function() {
1190
- return Object.keys(this.set).length;
1191
- }, i.prototype.addAll = function(e) {
1192
- for (var t = e.length, n = 0; n < t; n++) {
1193
- var r = e[n];
1194
- this.add(r);
1195
- }
1196
- }, e.exports = i;
1197
- }),
1198
- (function(e, t, n) {
1199
- function r() {}
1200
- r.multMat = function(e, t) {
1201
- for (var n = [], r = 0; r < e.length; r++) {
1202
- n[r] = [];
1203
- for (var i = 0; i < t[0].length; i++) {
1204
- n[r][i] = 0;
1205
- for (var a = 0; a < e[0].length; a++) n[r][i] += e[r][a] * t[a][i];
1206
- }
1207
- }
1208
- return n;
1209
- }, r.transpose = function(e) {
1210
- for (var t = [], n = 0; n < e[0].length; n++) {
1211
- t[n] = [];
1212
- for (var r = 0; r < e.length; r++) t[n][r] = e[r][n];
1213
- }
1214
- return t;
1215
- }, r.multCons = function(e, t) {
1216
- for (var n = [], r = 0; r < e.length; r++) n[r] = e[r] * t;
1217
- return n;
1218
- }, r.minusOp = function(e, t) {
1219
- for (var n = [], r = 0; r < e.length; r++) n[r] = e[r] - t[r];
1220
- return n;
1221
- }, r.dotProduct = function(e, t) {
1222
- for (var n = 0, r = 0; r < e.length; r++) n += e[r] * t[r];
1223
- return n;
1224
- }, r.mag = function(e) {
1225
- return Math.sqrt(this.dotProduct(e, e));
1226
- }, r.normalize = function(e) {
1227
- for (var t = [], n = this.mag(e), r = 0; r < e.length; r++) t[r] = e[r] / n;
1228
- return t;
1229
- }, r.multGamma = function(e) {
1230
- for (var t = [], n = 0, r = 0; r < e.length; r++) n += e[r];
1231
- n *= -1 / e.length;
1232
- for (var i = 0; i < e.length; i++) t[i] = n + e[i];
1233
- return t;
1234
- }, r.multL = function(e, t, n) {
1235
- for (var r = [], i = [], a = [], o = 0; o < t[0].length; o++) {
1236
- for (var s = 0, c = 0; c < t.length; c++) s += -.5 * t[c][o] * e[c];
1237
- i[o] = s;
1238
- }
1239
- for (var l = 0; l < n.length; l++) {
1240
- for (var u = 0, d = 0; d < n.length; d++) u += n[l][d] * i[d];
1241
- a[l] = u;
1242
- }
1243
- for (var f = 0; f < t.length; f++) {
1244
- for (var p = 0, m = 0; m < t[0].length; m++) p += t[f][m] * a[m];
1245
- r[f] = p;
1246
- }
1247
- return r;
1248
- }, e.exports = r;
1249
- }),
1250
- (function(e, t, n) {
1251
- var r = function() {
1252
- function e(e, t) {
1253
- for (var n = 0; n < t.length; n++) {
1254
- var r = t[n];
1255
- r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(e, r.key, r);
1256
- }
1257
- }
1258
- return function(t, n, r) {
1259
- return n && e(t.prototype, n), r && e(t, r), t;
1260
- };
1261
- }();
1262
- function i(e, t) {
1263
- if (!(e instanceof t)) throw TypeError("Cannot call a class as a function");
1264
- }
1265
- var a = n(11);
1266
- e.exports = function() {
1267
- function e(t, n) {
1268
- i(this, e), (n !== null || n !== void 0) && (this.compareFunction = this._defaultCompareFunction);
1269
- var r = void 0;
1270
- r = t instanceof a ? t.size() : t.length, this._quicksort(t, 0, r - 1);
1271
- }
1272
- return r(e, [
1273
- {
1274
- key: "_quicksort",
1275
- value: function(e, t, n) {
1276
- if (t < n) {
1277
- var r = this._partition(e, t, n);
1278
- this._quicksort(e, t, r), this._quicksort(e, r + 1, n);
1279
- }
1280
- }
1281
- },
1282
- {
1283
- key: "_partition",
1284
- value: function(e, t, n) {
1285
- for (var r = this._get(e, t), i = t, a = n;;) {
1286
- for (; this.compareFunction(r, this._get(e, a));) a--;
1287
- for (; this.compareFunction(this._get(e, i), r);) i++;
1288
- if (i < a) this._swap(e, i, a), i++, a--;
1289
- else return a;
1290
- }
1291
- }
1292
- },
1293
- {
1294
- key: "_get",
1295
- value: function(e, t) {
1296
- return e instanceof a ? e.get_object_at(t) : e[t];
1297
- }
1298
- },
1299
- {
1300
- key: "_set",
1301
- value: function(e, t, n) {
1302
- e instanceof a ? e.set_object_at(t, n) : e[t] = n;
1303
- }
1304
- },
1305
- {
1306
- key: "_swap",
1307
- value: function(e, t, n) {
1308
- var r = this._get(e, t);
1309
- this._set(e, t, this._get(e, n)), this._set(e, n, r);
1310
- }
1311
- },
1312
- {
1313
- key: "_defaultCompareFunction",
1314
- value: function(e, t) {
1315
- return t > e;
1316
- }
1317
- }
1318
- ]), e;
1319
- }();
1320
- }),
1321
- (function(e, t, n) {
1322
- function r() {}
1323
- r.svd = function(e) {
1324
- this.U = null, this.V = null, this.s = null, this.m = 0, this.n = 0, this.m = e.length, this.n = e[0].length;
1325
- var t = Math.min(this.m, this.n);
1326
- this.s = function(e) {
1327
- for (var t = []; e-- > 0;) t.push(0);
1328
- return t;
1329
- }(Math.min(this.m + 1, this.n)), this.U = function(e) {
1330
- return function e(t) {
1331
- if (t.length == 0) return 0;
1332
- for (var n = [], r = 0; r < t[0]; r++) n.push(e(t.slice(1)));
1333
- return n;
1334
- }(e);
1335
- }([this.m, t]), this.V = function(e) {
1336
- return function e(t) {
1337
- if (t.length == 0) return 0;
1338
- for (var n = [], r = 0; r < t[0]; r++) n.push(e(t.slice(1)));
1339
- return n;
1340
- }(e);
1341
- }([this.n, this.n]);
1342
- for (var n = function(e) {
1343
- for (var t = []; e-- > 0;) t.push(0);
1344
- return t;
1345
- }(this.n), i = function(e) {
1346
- for (var t = []; e-- > 0;) t.push(0);
1347
- return t;
1348
- }(this.m), a = !0, o = !0, s = Math.min(this.m - 1, this.n), c = Math.max(0, Math.min(this.n - 2, this.m)), l = 0; l < Math.max(s, c); l++) {
1349
- if (l < s) {
1350
- this.s[l] = 0;
1351
- for (var u = l; u < this.m; u++) this.s[l] = r.hypot(this.s[l], e[u][l]);
1352
- if (this.s[l] !== 0) {
1353
- e[l][l] < 0 && (this.s[l] = -this.s[l]);
1354
- for (var d = l; d < this.m; d++) e[d][l] /= this.s[l];
1355
- e[l][l] += 1;
1356
- }
1357
- this.s[l] = -this.s[l];
1358
- }
1359
- for (var f = l + 1; f < this.n; f++) {
1360
- if (function(e, t) {
1361
- return e && t;
1362
- }(l < s, this.s[l] !== 0)) {
1363
- for (var p = 0, m = l; m < this.m; m++) p += e[m][l] * e[m][f];
1364
- p = -p / e[l][l];
1365
- for (var h = l; h < this.m; h++) e[h][f] += p * e[h][l];
1366
- }
1367
- n[f] = e[l][f];
1368
- }
1369
- if (function(e, t) {
1370
- return e && t;
1371
- }(a, l < s)) for (var g = l; g < this.m; g++) this.U[g][l] = e[g][l];
1372
- if (l < c) {
1373
- n[l] = 0;
1374
- for (var _ = l + 1; _ < this.n; _++) n[l] = r.hypot(n[l], n[_]);
1375
- if (n[l] !== 0) {
1376
- n[l + 1] < 0 && (n[l] = -n[l]);
1377
- for (var v = l + 1; v < this.n; v++) n[v] /= n[l];
1378
- n[l + 1] += 1;
1379
- }
1380
- if (n[l] = -n[l], function(e, t) {
1381
- return e && t;
1382
- }(l + 1 < this.m, n[l] !== 0)) {
1383
- for (var y = l + 1; y < this.m; y++) i[y] = 0;
1384
- for (var b = l + 1; b < this.n; b++) for (var x = l + 1; x < this.m; x++) i[x] += n[b] * e[x][b];
1385
- for (var S = l + 1; S < this.n; S++) for (var C = -n[S] / n[l + 1], w = l + 1; w < this.m; w++) e[w][S] += C * i[w];
1386
- }
1387
- if (o) for (var T = l + 1; T < this.n; T++) this.V[T][l] = n[T];
1388
- }
1389
- }
1390
- var E = Math.min(this.n, this.m + 1);
1391
- if (s < this.n && (this.s[s] = e[s][s]), this.m < E && (this.s[E - 1] = 0), c + 1 < E && (n[c] = e[c][E - 1]), n[E - 1] = 0, a) {
1392
- for (var D = s; D < t; D++) {
1393
- for (var O = 0; O < this.m; O++) this.U[O][D] = 0;
1394
- this.U[D][D] = 1;
1395
- }
1396
- for (var k = s - 1; k >= 0; k--) if (this.s[k] !== 0) {
1397
- for (var A = k + 1; A < t; A++) {
1398
- for (var j = 0, M = k; M < this.m; M++) j += this.U[M][k] * this.U[M][A];
1399
- j = -j / this.U[k][k];
1400
- for (var N = k; N < this.m; N++) this.U[N][A] += j * this.U[N][k];
1401
- }
1402
- for (var P = k; P < this.m; P++) this.U[P][k] = -this.U[P][k];
1403
- this.U[k][k] = 1 + this.U[k][k];
1404
- for (var F = 0; F < k - 1; F++) this.U[F][k] = 0;
1405
- } else {
1406
- for (var I = 0; I < this.m; I++) this.U[I][k] = 0;
1407
- this.U[k][k] = 1;
1408
- }
1409
- }
1410
- if (o) for (var L = this.n - 1; L >= 0; L--) {
1411
- if (function(e, t) {
1412
- return e && t;
1413
- }(L < c, n[L] !== 0)) for (var R = L + 1; R < t; R++) {
1414
- for (var z = 0, B = L + 1; B < this.n; B++) z += this.V[B][L] * this.V[B][R];
1415
- z = -z / this.V[L + 1][L];
1416
- for (var V = L + 1; V < this.n; V++) this.V[V][R] += z * this.V[V][L];
1417
- }
1418
- for (var ee = 0; ee < this.n; ee++) this.V[ee][L] = 0;
1419
- this.V[L][L] = 1;
1420
- }
1421
- for (var te = E - 1, H = 0, ne = 2 ** -52, re = 2 ** -966; E > 0;) {
1422
- var U = void 0, W = void 0;
1423
- for (U = E - 2; U >= -1 && U !== -1; U--) if (Math.abs(n[U]) <= re + ne * (Math.abs(this.s[U]) + Math.abs(this.s[U + 1]))) {
1424
- n[U] = 0;
1425
- break;
1426
- }
1427
- if (U === E - 2) W = 4;
1428
- else {
1429
- var G = void 0;
1430
- for (G = E - 1; G >= U && G !== U; G--) {
1431
- var ie = (G === E ? 0 : Math.abs(n[G])) + (G === U + 1 ? 0 : Math.abs(n[G - 1]));
1432
- if (Math.abs(this.s[G]) <= re + ne * ie) {
1433
- this.s[G] = 0;
1434
- break;
1435
- }
1436
- }
1437
- G === U ? W = 3 : G === E - 1 ? W = 1 : (W = 2, U = G);
1438
- }
1439
- switch (U++, W) {
1440
- case 1:
1441
- var K = n[E - 2];
1442
- n[E - 2] = 0;
1443
- for (var q = E - 2; q >= U; q--) {
1444
- var ae = r.hypot(this.s[q], K), J = this.s[q] / ae, Y = K / ae;
1445
- if (this.s[q] = ae, q !== U && (K = -Y * n[q - 1], n[q - 1] = J * n[q - 1]), o) for (var X = 0; X < this.n; X++) ae = J * this.V[X][q] + Y * this.V[X][E - 1], this.V[X][E - 1] = -Y * this.V[X][q] + J * this.V[X][E - 1], this.V[X][q] = ae;
1446
- }
1447
- break;
1448
- case 2:
1449
- var oe = n[U - 1];
1450
- n[U - 1] = 0;
1451
- for (var Z = U; Z < E; Z++) {
1452
- var se = r.hypot(this.s[Z], oe), ce = this.s[Z] / se, le = oe / se;
1453
- if (this.s[Z] = se, oe = -le * n[Z], n[Z] = ce * n[Z], a) for (var ue = 0; ue < this.m; ue++) se = ce * this.U[ue][Z] + le * this.U[ue][U - 1], this.U[ue][U - 1] = -le * this.U[ue][Z] + ce * this.U[ue][U - 1], this.U[ue][Z] = se;
1454
- }
1455
- break;
1456
- case 3:
1457
- var de = Math.max(Math.max(Math.max(Math.max(Math.abs(this.s[E - 1]), Math.abs(this.s[E - 2])), Math.abs(n[E - 2])), Math.abs(this.s[U])), Math.abs(n[U])), fe = this.s[E - 1] / de, pe = this.s[E - 2] / de, me = n[E - 2] / de, he = this.s[U] / de, ge = n[U] / de, _e = ((pe + fe) * (pe - fe) + me * me) / 2, ve = fe * me * (fe * me), ye = 0;
1458
- (function(e, t) {
1459
- return e || t;
1460
- })(_e !== 0, ve !== 0) && (ye = Math.sqrt(_e * _e + ve), _e < 0 && (ye = -ye), ye = ve / (_e + ye));
1461
- for (var be = (he + fe) * (he - fe) + ye, xe = he * ge, Q = U; Q < E - 1; Q++) {
1462
- var $ = r.hypot(be, xe), Se = be / $, Ce = xe / $;
1463
- if (Q !== U && (n[Q - 1] = $), be = Se * this.s[Q] + Ce * n[Q], n[Q] = Se * n[Q] - Ce * this.s[Q], xe = Ce * this.s[Q + 1], this.s[Q + 1] = Se * this.s[Q + 1], o) for (var we = 0; we < this.n; we++) $ = Se * this.V[we][Q] + Ce * this.V[we][Q + 1], this.V[we][Q + 1] = -Ce * this.V[we][Q] + Se * this.V[we][Q + 1], this.V[we][Q] = $;
1464
- if ($ = r.hypot(be, xe), Se = be / $, Ce = xe / $, this.s[Q] = $, be = Se * n[Q] + Ce * this.s[Q + 1], this.s[Q + 1] = -Ce * n[Q] + Se * this.s[Q + 1], xe = Ce * n[Q + 1], n[Q + 1] = Se * n[Q + 1], a && Q < this.m - 1) for (var Te = 0; Te < this.m; Te++) $ = Se * this.U[Te][Q] + Ce * this.U[Te][Q + 1], this.U[Te][Q + 1] = -Ce * this.U[Te][Q] + Se * this.U[Te][Q + 1], this.U[Te][Q] = $;
1465
- }
1466
- n[E - 2] = be, H += 1;
1467
- break;
1468
- case 4:
1469
- if (this.s[U] <= 0 && (this.s[U] = this.s[U] < 0 ? -this.s[U] : 0, o)) for (var Ee = 0; Ee <= te; Ee++) this.V[Ee][U] = -this.V[Ee][U];
1470
- for (; U < te && !(this.s[U] >= this.s[U + 1]);) {
1471
- var De = this.s[U];
1472
- if (this.s[U] = this.s[U + 1], this.s[U + 1] = De, o && U < this.n - 1) for (var Oe = 0; Oe < this.n; Oe++) De = this.V[Oe][U + 1], this.V[Oe][U + 1] = this.V[Oe][U], this.V[Oe][U] = De;
1473
- if (a && U < this.m - 1) for (var ke = 0; ke < this.m; ke++) De = this.U[ke][U + 1], this.U[ke][U + 1] = this.U[ke][U], this.U[ke][U] = De;
1474
- U++;
1475
- }
1476
- H = 0, E--;
1477
- }
1478
- }
1479
- return {
1480
- U: this.U,
1481
- V: this.V,
1482
- S: this.s
1483
- };
1484
- }, r.hypot = function(e, t) {
1485
- var n = void 0;
1486
- return Math.abs(e) > Math.abs(t) ? (n = t / e, n = Math.abs(e) * Math.sqrt(1 + n * n)) : t == 0 ? n = 0 : (n = e / t, n = Math.abs(t) * Math.sqrt(1 + n * n)), n;
1487
- }, e.exports = r;
1488
- }),
1489
- (function(e, t, n) {
1490
- var r = function() {
1491
- function e(e, t) {
1492
- for (var n = 0; n < t.length; n++) {
1493
- var r = t[n];
1494
- r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(e, r.key, r);
1495
- }
1496
- }
1497
- return function(t, n, r) {
1498
- return n && e(t.prototype, n), r && e(t, r), t;
1499
- };
1500
- }();
1501
- function i(e, t) {
1502
- if (!(e instanceof t)) throw TypeError("Cannot call a class as a function");
1503
- }
1504
- e.exports = function() {
1505
- function e(t, n) {
1506
- var r = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 1, a = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : -1, o = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : -1;
1507
- i(this, e), this.sequence1 = t, this.sequence2 = n, this.match_score = r, this.mismatch_penalty = a, this.gap_penalty = o, this.iMax = t.length + 1, this.jMax = n.length + 1, this.grid = Array(this.iMax);
1508
- for (var s = 0; s < this.iMax; s++) {
1509
- this.grid[s] = Array(this.jMax);
1510
- for (var c = 0; c < this.jMax; c++) this.grid[s][c] = 0;
1511
- }
1512
- this.tracebackGrid = Array(this.iMax);
1513
- for (var l = 0; l < this.iMax; l++) {
1514
- this.tracebackGrid[l] = Array(this.jMax);
1515
- for (var u = 0; u < this.jMax; u++) this.tracebackGrid[l][u] = [
1516
- null,
1517
- null,
1518
- null
1519
- ];
1520
- }
1521
- this.alignments = [], this.score = -1, this.computeGrids();
1522
- }
1523
- return r(e, [
1524
- {
1525
- key: "getScore",
1526
- value: function() {
1527
- return this.score;
1528
- }
1529
- },
1530
- {
1531
- key: "getAlignments",
1532
- value: function() {
1533
- return this.alignments;
1534
- }
1535
- },
1536
- {
1537
- key: "computeGrids",
1538
- value: function() {
1539
- for (var e = 1; e < this.jMax; e++) this.grid[0][e] = this.grid[0][e - 1] + this.gap_penalty, this.tracebackGrid[0][e] = [
1540
- !1,
1541
- !1,
1542
- !0
1543
- ];
1544
- for (var t = 1; t < this.iMax; t++) this.grid[t][0] = this.grid[t - 1][0] + this.gap_penalty, this.tracebackGrid[t][0] = [
1545
- !1,
1546
- !0,
1547
- !1
1548
- ];
1549
- for (var n = 1; n < this.iMax; n++) for (var r = 1; r < this.jMax; r++) {
1550
- var i = void 0;
1551
- i = this.sequence1[n - 1] === this.sequence2[r - 1] ? this.grid[n - 1][r - 1] + this.match_score : this.grid[n - 1][r - 1] + this.mismatch_penalty;
1552
- var a = this.grid[n - 1][r] + this.gap_penalty, o = this.grid[n][r - 1] + this.gap_penalty, s = [
1553
- i,
1554
- a,
1555
- o
1556
- ], c = this.arrayAllMaxIndexes(s);
1557
- this.grid[n][r] = s[c[0]], this.tracebackGrid[n][r] = [
1558
- c.includes(0),
1559
- c.includes(1),
1560
- c.includes(2)
1561
- ];
1562
- }
1563
- this.score = this.grid[this.iMax - 1][this.jMax - 1];
1564
- }
1565
- },
1566
- {
1567
- key: "alignmentTraceback",
1568
- value: function() {
1569
- var e = [];
1570
- for (e.push({
1571
- pos: [this.sequence1.length, this.sequence2.length],
1572
- seq1: "",
1573
- seq2: ""
1574
- }); e[0];) {
1575
- var t = e[0], n = this.tracebackGrid[t.pos[0]][t.pos[1]];
1576
- n[0] && e.push({
1577
- pos: [t.pos[0] - 1, t.pos[1] - 1],
1578
- seq1: this.sequence1[t.pos[0] - 1] + t.seq1,
1579
- seq2: this.sequence2[t.pos[1] - 1] + t.seq2
1580
- }), n[1] && e.push({
1581
- pos: [t.pos[0] - 1, t.pos[1]],
1582
- seq1: this.sequence1[t.pos[0] - 1] + t.seq1,
1583
- seq2: "-" + t.seq2
1584
- }), n[2] && e.push({
1585
- pos: [t.pos[0], t.pos[1] - 1],
1586
- seq1: "-" + t.seq1,
1587
- seq2: this.sequence2[t.pos[1] - 1] + t.seq2
1588
- }), t.pos[0] === 0 && t.pos[1] === 0 && this.alignments.push({
1589
- sequence1: t.seq1,
1590
- sequence2: t.seq2
1591
- }), e.shift();
1592
- }
1593
- return this.alignments;
1594
- }
1595
- },
1596
- {
1597
- key: "getAllIndexes",
1598
- value: function(e, t) {
1599
- for (var n = [], r = -1; (r = e.indexOf(t, r + 1)) !== -1;) n.push(r);
1600
- return n;
1601
- }
1602
- },
1603
- {
1604
- key: "arrayAllMaxIndexes",
1605
- value: function(e) {
1606
- return this.getAllIndexes(e, Math.max.apply(null, e));
1607
- }
1608
- }
1609
- ]), e;
1610
- }();
1611
- }),
1612
- (function(e, t, n) {
1613
- var r = function() {};
1614
- r.FDLayout = n(18), r.FDLayoutConstants = n(4), r.FDLayoutEdge = n(19), r.FDLayoutNode = n(20), r.DimensionD = n(21), r.HashMap = n(22), r.HashSet = n(23), r.IGeometry = n(8), r.IMath = n(9), r.Integer = n(10), r.Point = n(12), r.PointD = n(5), r.RandomSeed = n(16), r.RectangleD = n(13), r.Transform = n(17), r.UniqueIDGeneretor = n(14), r.Quicksort = n(25), r.LinkedList = n(11), r.LGraphObject = n(2), r.LGraph = n(6), r.LEdge = n(1), r.LGraphManager = n(7), r.LNode = n(3), r.Layout = n(15), r.LayoutConstants = n(0), r.NeedlemanWunsch = n(27), r.Matrix = n(24), r.SVD = n(26), e.exports = r;
1615
- }),
1616
- (function(e, t, n) {
1617
- function r() {
1618
- this.listeners = [];
1619
- }
1620
- var i = r.prototype;
1621
- i.addListener = function(e, t) {
1622
- this.listeners.push({
1623
- event: e,
1624
- callback: t
1625
- });
1626
- }, i.removeListener = function(e, t) {
1627
- for (var n = this.listeners.length; n >= 0; n--) {
1628
- var r = this.listeners[n];
1629
- r.event === e && r.callback === t && this.listeners.splice(n, 1);
1630
- }
1631
- }, i.emit = function(e, t) {
1632
- for (var n = 0; n < this.listeners.length; n++) {
1633
- var r = this.listeners[n];
1634
- e === r.event && r.callback(t);
1635
- }
1636
- }, e.exports = r;
1637
- })
1638
- ]);
1639
- });
1640
- })), O = /* @__PURE__ */ e(((e, t) => {
1641
- (function(n, r) {
1642
- typeof e == "object" && typeof t == "object" ? t.exports = r(D()) : typeof define == "function" && define.amd ? define(["layout-base"], r) : typeof e == "object" ? e.coseBase = r(D()) : n.coseBase = r(n.layoutBase);
1643
- })(e, function(e) {
1644
- return (() => {
1645
- var t = {
1646
- 45: ((e, t, n) => {
1647
- var r = {};
1648
- r.layoutBase = n(551), r.CoSEConstants = n(806), r.CoSEEdge = n(767), r.CoSEGraph = n(880), r.CoSEGraphManager = n(578), r.CoSELayout = n(765), r.CoSENode = n(991), r.ConstraintHandler = n(902), e.exports = r;
1649
- }),
1650
- 806: ((e, t, n) => {
1651
- var r = n(551).FDLayoutConstants;
1652
- function i() {}
1653
- for (var a in r) i[a] = r[a];
1654
- i.DEFAULT_USE_MULTI_LEVEL_SCALING = !1, i.DEFAULT_RADIAL_SEPARATION = r.DEFAULT_EDGE_LENGTH, i.DEFAULT_COMPONENT_SEPERATION = 60, i.TILE = !0, i.TILING_PADDING_VERTICAL = 10, i.TILING_PADDING_HORIZONTAL = 10, i.TRANSFORM_ON_CONSTRAINT_HANDLING = !0, i.ENFORCE_CONSTRAINTS = !0, i.APPLY_LAYOUT = !0, i.RELAX_MOVEMENT_ON_CONSTRAINTS = !0, i.TREE_REDUCTION_ON_INCREMENTAL = !0, i.PURE_INCREMENTAL = i.DEFAULT_INCREMENTAL, e.exports = i;
1655
- }),
1656
- 767: ((e, t, n) => {
1657
- var r = n(551).FDLayoutEdge;
1658
- function i(e, t, n) {
1659
- r.call(this, e, t, n);
1660
- }
1661
- for (var a in i.prototype = Object.create(r.prototype), r) i[a] = r[a];
1662
- e.exports = i;
1663
- }),
1664
- 880: ((e, t, n) => {
1665
- var r = n(551).LGraph;
1666
- function i(e, t, n) {
1667
- r.call(this, e, t, n);
1668
- }
1669
- for (var a in i.prototype = Object.create(r.prototype), r) i[a] = r[a];
1670
- e.exports = i;
1671
- }),
1672
- 578: ((e, t, n) => {
1673
- var r = n(551).LGraphManager;
1674
- function i(e) {
1675
- r.call(this, e);
1676
- }
1677
- for (var a in i.prototype = Object.create(r.prototype), r) i[a] = r[a];
1678
- e.exports = i;
1679
- }),
1680
- 765: ((e, t, n) => {
1681
- var r = n(551).FDLayout, i = n(578), a = n(880), o = n(991), s = n(767), c = n(806), l = n(902), u = n(551).FDLayoutConstants, d = n(551).LayoutConstants, f = n(551).Point, p = n(551).PointD, m = n(551).DimensionD, h = n(551).Layout, g = n(551).Integer, _ = n(551).IGeometry, v = n(551).LGraph, y = n(551).Transform, b = n(551).LinkedList;
1682
- function x() {
1683
- r.call(this), this.toBeTiled = {}, this.constraints = {};
1684
- }
1685
- for (var S in x.prototype = Object.create(r.prototype), r) x[S] = r[S];
1686
- x.prototype.newGraphManager = function() {
1687
- var e = new i(this);
1688
- return this.graphManager = e, e;
1689
- }, x.prototype.newGraph = function(e) {
1690
- return new a(null, this.graphManager, e);
1691
- }, x.prototype.newNode = function(e) {
1692
- return new o(this.graphManager, e);
1693
- }, x.prototype.newEdge = function(e) {
1694
- return new s(null, null, e);
1695
- }, x.prototype.initParameters = function() {
1696
- r.prototype.initParameters.call(this, arguments), this.isSubLayout || (this.idealEdgeLength = c.DEFAULT_EDGE_LENGTH < 10 ? 10 : c.DEFAULT_EDGE_LENGTH, this.useSmartIdealEdgeLengthCalculation = c.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION, this.gravityConstant = u.DEFAULT_GRAVITY_STRENGTH, this.compoundGravityConstant = u.DEFAULT_COMPOUND_GRAVITY_STRENGTH, this.gravityRangeFactor = u.DEFAULT_GRAVITY_RANGE_FACTOR, this.compoundGravityRangeFactor = u.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR, this.prunedNodesAll = [], this.growTreeIterations = 0, this.afterGrowthIterations = 0, this.isTreeGrowing = !1, this.isGrowthFinished = !1);
1697
- }, x.prototype.initSpringEmbedder = function() {
1698
- r.prototype.initSpringEmbedder.call(this), this.coolingCycle = 0, this.maxCoolingCycle = this.maxIterations / u.CONVERGENCE_CHECK_PERIOD, this.finalTemperature = .04, this.coolingAdjuster = 1;
1699
- }, x.prototype.layout = function() {
1700
- return d.DEFAULT_CREATE_BENDS_AS_NEEDED && (this.createBendpoints(), this.graphManager.resetAllEdges()), this.level = 0, this.classicLayout();
1701
- }, x.prototype.classicLayout = function() {
1702
- if (this.nodesWithGravity = this.calculateNodesToApplyGravitationTo(), this.graphManager.setAllNodesToApplyGravitation(this.nodesWithGravity), this.calcNoOfChildrenForAllNodes(), this.graphManager.calcLowestCommonAncestors(), this.graphManager.calcInclusionTreeDepths(), this.graphManager.getRoot().calcEstimatedSize(), this.calcIdealEdgeLengths(), !this.incremental) {
1703
- var e = this.getFlatForest();
1704
- if (e.length > 0) this.positionNodesRadially(e);
1705
- else {
1706
- this.reduceTrees(), this.graphManager.resetAllNodesToApplyGravitation();
1707
- var t = new Set(this.getAllNodes()), n = this.nodesWithGravity.filter(function(e) {
1708
- return t.has(e);
1709
- });
1710
- this.graphManager.setAllNodesToApplyGravitation(n), this.positionNodesRandomly();
1711
- }
1712
- } else if (c.TREE_REDUCTION_ON_INCREMENTAL) {
1713
- this.reduceTrees(), this.graphManager.resetAllNodesToApplyGravitation();
1714
- var t = new Set(this.getAllNodes()), n = this.nodesWithGravity.filter(function(e) {
1715
- return t.has(e);
1716
- });
1717
- this.graphManager.setAllNodesToApplyGravitation(n);
1718
- }
1719
- return Object.keys(this.constraints).length > 0 && (l.handleConstraints(this), this.initConstraintVariables()), this.initSpringEmbedder(), c.APPLY_LAYOUT && this.runSpringEmbedder(), !0;
1720
- }, x.prototype.tick = function() {
1721
- if (this.totalIterations++, this.totalIterations === this.maxIterations && !this.isTreeGrowing && !this.isGrowthFinished) {
1722
- if (this.prunedNodesAll.length > 0) this.isTreeGrowing = !0;
1723
- else return !0;
1724
- }
1725
- if (this.totalIterations % u.CONVERGENCE_CHECK_PERIOD == 0 && !this.isTreeGrowing && !this.isGrowthFinished) {
1726
- if (this.isConverged()) {
1727
- if (this.prunedNodesAll.length > 0) this.isTreeGrowing = !0;
1728
- else return !0;
1729
- }
1730
- this.coolingCycle++, this.layoutQuality == 0 ? this.coolingAdjuster = this.coolingCycle : this.layoutQuality == 1 && (this.coolingAdjuster = this.coolingCycle / 3), this.coolingFactor = Math.max(this.initialCoolingFactor - this.coolingCycle ** +(Math.log(100 * (this.initialCoolingFactor - this.finalTemperature)) / Math.log(this.maxCoolingCycle)) / 100 * this.coolingAdjuster, this.finalTemperature), this.animationPeriod = Math.ceil(this.initialAnimationPeriod * Math.sqrt(this.coolingFactor));
1731
- }
1732
- if (this.isTreeGrowing) {
1733
- if (this.growTreeIterations % 10 == 0) {
1734
- if (this.prunedNodesAll.length > 0) {
1735
- this.graphManager.updateBounds(), this.updateGrid(), this.growTree(this.prunedNodesAll), this.graphManager.resetAllNodesToApplyGravitation();
1736
- var e = new Set(this.getAllNodes()), t = this.nodesWithGravity.filter(function(t) {
1737
- return e.has(t);
1738
- });
1739
- this.graphManager.setAllNodesToApplyGravitation(t), this.graphManager.updateBounds(), this.updateGrid(), this.coolingFactor = c.PURE_INCREMENTAL ? u.DEFAULT_COOLING_FACTOR_INCREMENTAL / 2 : u.DEFAULT_COOLING_FACTOR_INCREMENTAL;
1740
- } else this.isTreeGrowing = !1, this.isGrowthFinished = !0;
1741
- }
1742
- this.growTreeIterations++;
1743
- }
1744
- if (this.isGrowthFinished) {
1745
- if (this.isConverged()) return !0;
1746
- this.afterGrowthIterations % 10 == 0 && (this.graphManager.updateBounds(), this.updateGrid()), this.coolingFactor = c.PURE_INCREMENTAL ? u.DEFAULT_COOLING_FACTOR_INCREMENTAL / 2 * ((100 - this.afterGrowthIterations) / 100) : u.DEFAULT_COOLING_FACTOR_INCREMENTAL * ((100 - this.afterGrowthIterations) / 100), this.afterGrowthIterations++;
1747
- }
1748
- var n = !this.isTreeGrowing && !this.isGrowthFinished, r = this.growTreeIterations % 10 == 1 && this.isTreeGrowing || this.afterGrowthIterations % 10 == 1 && this.isGrowthFinished;
1749
- return this.totalDisplacement = 0, this.graphManager.updateBounds(), this.calcSpringForces(), this.calcRepulsionForces(n, r), this.calcGravitationalForces(), this.moveNodes(), this.animate(), !1;
1750
- }, x.prototype.getPositionsData = function() {
1751
- for (var e = this.graphManager.getAllNodes(), t = {}, n = 0; n < e.length; n++) {
1752
- var r = e[n].rect, i = e[n].id;
1753
- t[i] = {
1754
- id: i,
1755
- x: r.getCenterX(),
1756
- y: r.getCenterY(),
1757
- w: r.width,
1758
- h: r.height
1759
- };
1760
- }
1761
- return t;
1762
- }, x.prototype.runSpringEmbedder = function() {
1763
- this.initialAnimationPeriod = 25, this.animationPeriod = this.initialAnimationPeriod;
1764
- var e = !1;
1765
- if (u.ANIMATE === "during") this.emit("layoutstarted");
1766
- else {
1767
- for (; !e;) e = this.tick();
1768
- this.graphManager.updateBounds();
1769
- }
1770
- }, x.prototype.moveNodes = function() {
1771
- for (var e = this.getAllNodes(), t, n = 0; n < e.length; n++) t = e[n], t.calculateDisplacement();
1772
- Object.keys(this.constraints).length > 0 && this.updateDisplacements();
1773
- for (var n = 0; n < e.length; n++) t = e[n], t.move();
1774
- }, x.prototype.initConstraintVariables = function() {
1775
- var e = this;
1776
- this.idToNodeMap = /* @__PURE__ */ new Map(), this.fixedNodeSet = /* @__PURE__ */ new Set();
1777
- for (var t = this.graphManager.getAllNodes(), n = 0; n < t.length; n++) {
1778
- var r = t[n];
1779
- this.idToNodeMap.set(r.id, r);
1780
- }
1781
- var i = function t(n) {
1782
- for (var r = n.getChild().getNodes(), i, a = 0, o = 0; o < r.length; o++) i = r[o], i.getChild() == null ? e.fixedNodeSet.has(i.id) && (a += 100) : a += t(i);
1783
- return a;
1784
- };
1785
- if (this.constraints.fixedNodeConstraint) {
1786
- this.constraints.fixedNodeConstraint.forEach(function(t) {
1787
- e.fixedNodeSet.add(t.nodeId);
1788
- });
1789
- for (var t = this.graphManager.getAllNodes(), r, n = 0; n < t.length; n++) if (r = t[n], r.getChild() != null) {
1790
- var a = i(r);
1791
- a > 0 && (r.fixedNodeWeight = a);
1792
- }
1793
- }
1794
- if (this.constraints.relativePlacementConstraint) {
1795
- var o = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map();
1796
- if (this.dummyToNodeForVerticalAlignment = /* @__PURE__ */ new Map(), this.dummyToNodeForHorizontalAlignment = /* @__PURE__ */ new Map(), this.fixedNodesOnHorizontal = /* @__PURE__ */ new Set(), this.fixedNodesOnVertical = /* @__PURE__ */ new Set(), this.fixedNodeSet.forEach(function(t) {
1797
- e.fixedNodesOnHorizontal.add(t), e.fixedNodesOnVertical.add(t);
1798
- }), this.constraints.alignmentConstraint) {
1799
- if (this.constraints.alignmentConstraint.vertical) for (var l = this.constraints.alignmentConstraint.vertical, n = 0; n < l.length; n++) this.dummyToNodeForVerticalAlignment.set("dummy" + n, []), l[n].forEach(function(t) {
1800
- o.set(t, "dummy" + n), e.dummyToNodeForVerticalAlignment.get("dummy" + n).push(t), e.fixedNodeSet.has(t) && e.fixedNodesOnHorizontal.add("dummy" + n);
1801
- });
1802
- if (this.constraints.alignmentConstraint.horizontal) for (var u = this.constraints.alignmentConstraint.horizontal, n = 0; n < u.length; n++) this.dummyToNodeForHorizontalAlignment.set("dummy" + n, []), u[n].forEach(function(t) {
1803
- s.set(t, "dummy" + n), e.dummyToNodeForHorizontalAlignment.get("dummy" + n).push(t), e.fixedNodeSet.has(t) && e.fixedNodesOnVertical.add("dummy" + n);
1804
- });
1805
- }
1806
- if (c.RELAX_MOVEMENT_ON_CONSTRAINTS) this.shuffle = function(e) {
1807
- var t, n, r;
1808
- for (r = e.length - 1; r >= 2 * e.length / 3; r--) t = Math.floor(Math.random() * (r + 1)), n = e[r], e[r] = e[t], e[t] = n;
1809
- return e;
1810
- }, this.nodesInRelativeHorizontal = [], this.nodesInRelativeVertical = [], this.nodeToRelativeConstraintMapHorizontal = /* @__PURE__ */ new Map(), this.nodeToRelativeConstraintMapVertical = /* @__PURE__ */ new Map(), this.nodeToTempPositionMapHorizontal = /* @__PURE__ */ new Map(), this.nodeToTempPositionMapVertical = /* @__PURE__ */ new Map(), this.constraints.relativePlacementConstraint.forEach(function(t) {
1811
- if (t.left) {
1812
- var n = o.has(t.left) ? o.get(t.left) : t.left, r = o.has(t.right) ? o.get(t.right) : t.right;
1813
- e.nodesInRelativeHorizontal.includes(n) || (e.nodesInRelativeHorizontal.push(n), e.nodeToRelativeConstraintMapHorizontal.set(n, []), e.dummyToNodeForVerticalAlignment.has(n) ? e.nodeToTempPositionMapHorizontal.set(n, e.idToNodeMap.get(e.dummyToNodeForVerticalAlignment.get(n)[0]).getCenterX()) : e.nodeToTempPositionMapHorizontal.set(n, e.idToNodeMap.get(n).getCenterX())), e.nodesInRelativeHorizontal.includes(r) || (e.nodesInRelativeHorizontal.push(r), e.nodeToRelativeConstraintMapHorizontal.set(r, []), e.dummyToNodeForVerticalAlignment.has(r) ? e.nodeToTempPositionMapHorizontal.set(r, e.idToNodeMap.get(e.dummyToNodeForVerticalAlignment.get(r)[0]).getCenterX()) : e.nodeToTempPositionMapHorizontal.set(r, e.idToNodeMap.get(r).getCenterX())), e.nodeToRelativeConstraintMapHorizontal.get(n).push({
1814
- right: r,
1815
- gap: t.gap
1816
- }), e.nodeToRelativeConstraintMapHorizontal.get(r).push({
1817
- left: n,
1818
- gap: t.gap
1819
- });
1820
- } else {
1821
- var i = s.has(t.top) ? s.get(t.top) : t.top, a = s.has(t.bottom) ? s.get(t.bottom) : t.bottom;
1822
- e.nodesInRelativeVertical.includes(i) || (e.nodesInRelativeVertical.push(i), e.nodeToRelativeConstraintMapVertical.set(i, []), e.dummyToNodeForHorizontalAlignment.has(i) ? e.nodeToTempPositionMapVertical.set(i, e.idToNodeMap.get(e.dummyToNodeForHorizontalAlignment.get(i)[0]).getCenterY()) : e.nodeToTempPositionMapVertical.set(i, e.idToNodeMap.get(i).getCenterY())), e.nodesInRelativeVertical.includes(a) || (e.nodesInRelativeVertical.push(a), e.nodeToRelativeConstraintMapVertical.set(a, []), e.dummyToNodeForHorizontalAlignment.has(a) ? e.nodeToTempPositionMapVertical.set(a, e.idToNodeMap.get(e.dummyToNodeForHorizontalAlignment.get(a)[0]).getCenterY()) : e.nodeToTempPositionMapVertical.set(a, e.idToNodeMap.get(a).getCenterY())), e.nodeToRelativeConstraintMapVertical.get(i).push({
1823
- bottom: a,
1824
- gap: t.gap
1825
- }), e.nodeToRelativeConstraintMapVertical.get(a).push({
1826
- top: i,
1827
- gap: t.gap
1828
- });
1829
- }
1830
- });
1831
- else {
1832
- var d = /* @__PURE__ */ new Map(), f = /* @__PURE__ */ new Map();
1833
- this.constraints.relativePlacementConstraint.forEach(function(e) {
1834
- if (e.left) {
1835
- var t = o.has(e.left) ? o.get(e.left) : e.left, n = o.has(e.right) ? o.get(e.right) : e.right;
1836
- d.has(t) ? d.get(t).push(n) : d.set(t, [n]), d.has(n) ? d.get(n).push(t) : d.set(n, [t]);
1837
- } else {
1838
- var r = s.has(e.top) ? s.get(e.top) : e.top, i = s.has(e.bottom) ? s.get(e.bottom) : e.bottom;
1839
- f.has(r) ? f.get(r).push(i) : f.set(r, [i]), f.has(i) ? f.get(i).push(r) : f.set(i, [r]);
1840
- }
1841
- });
1842
- var p = function(e, t) {
1843
- var n = [], r = [], i = new b(), a = /* @__PURE__ */ new Set(), o = 0;
1844
- return e.forEach(function(s, c) {
1845
- if (!a.has(c)) {
1846
- n[o] = [], r[o] = !1;
1847
- var l = c;
1848
- for (i.push(l), a.add(l), n[o].push(l); i.length != 0;) l = i.shift(), t.has(l) && (r[o] = !0), e.get(l).forEach(function(e) {
1849
- a.has(e) || (i.push(e), a.add(e), n[o].push(e));
1850
- });
1851
- o++;
1852
- }
1853
- }), {
1854
- components: n,
1855
- isFixed: r
1856
- };
1857
- }, m = p(d, e.fixedNodesOnHorizontal);
1858
- this.componentsOnHorizontal = m.components, this.fixedComponentsOnHorizontal = m.isFixed;
1859
- var h = p(f, e.fixedNodesOnVertical);
1860
- this.componentsOnVertical = h.components, this.fixedComponentsOnVertical = h.isFixed;
1861
- }
1862
- }
1863
- }, x.prototype.updateDisplacements = function() {
1864
- var e = this;
1865
- if (this.constraints.fixedNodeConstraint && this.constraints.fixedNodeConstraint.forEach(function(t) {
1866
- var n = e.idToNodeMap.get(t.nodeId);
1867
- n.displacementX = 0, n.displacementY = 0;
1868
- }), this.constraints.alignmentConstraint) {
1869
- if (this.constraints.alignmentConstraint.vertical) for (var t = this.constraints.alignmentConstraint.vertical, n = 0; n < t.length; n++) {
1870
- for (var r = 0, i = 0; i < t[n].length; i++) {
1871
- if (this.fixedNodeSet.has(t[n][i])) {
1872
- r = 0;
1873
- break;
1874
- }
1875
- r += this.idToNodeMap.get(t[n][i]).displacementX;
1876
- }
1877
- for (var a = r / t[n].length, i = 0; i < t[n].length; i++) this.idToNodeMap.get(t[n][i]).displacementX = a;
1878
- }
1879
- if (this.constraints.alignmentConstraint.horizontal) for (var o = this.constraints.alignmentConstraint.horizontal, n = 0; n < o.length; n++) {
1880
- for (var s = 0, i = 0; i < o[n].length; i++) {
1881
- if (this.fixedNodeSet.has(o[n][i])) {
1882
- s = 0;
1883
- break;
1884
- }
1885
- s += this.idToNodeMap.get(o[n][i]).displacementY;
1886
- }
1887
- for (var l = s / o[n].length, i = 0; i < o[n].length; i++) this.idToNodeMap.get(o[n][i]).displacementY = l;
1888
- }
1889
- }
1890
- if (this.constraints.relativePlacementConstraint) {
1891
- if (c.RELAX_MOVEMENT_ON_CONSTRAINTS) this.totalIterations % 10 == 0 && (this.shuffle(this.nodesInRelativeHorizontal), this.shuffle(this.nodesInRelativeVertical)), this.nodesInRelativeHorizontal.forEach(function(t) {
1892
- if (!e.fixedNodesOnHorizontal.has(t)) {
1893
- var n = 0;
1894
- n = e.dummyToNodeForVerticalAlignment.has(t) ? e.idToNodeMap.get(e.dummyToNodeForVerticalAlignment.get(t)[0]).displacementX : e.idToNodeMap.get(t).displacementX, e.nodeToRelativeConstraintMapHorizontal.get(t).forEach(function(r) {
1895
- if (r.right) {
1896
- var i = e.nodeToTempPositionMapHorizontal.get(r.right) - e.nodeToTempPositionMapHorizontal.get(t) - n;
1897
- i < r.gap && (n -= r.gap - i);
1898
- } else {
1899
- var i = e.nodeToTempPositionMapHorizontal.get(t) - e.nodeToTempPositionMapHorizontal.get(r.left) + n;
1900
- i < r.gap && (n += r.gap - i);
1901
- }
1902
- }), e.nodeToTempPositionMapHorizontal.set(t, e.nodeToTempPositionMapHorizontal.get(t) + n), e.dummyToNodeForVerticalAlignment.has(t) ? e.dummyToNodeForVerticalAlignment.get(t).forEach(function(t) {
1903
- e.idToNodeMap.get(t).displacementX = n;
1904
- }) : e.idToNodeMap.get(t).displacementX = n;
1905
- }
1906
- }), this.nodesInRelativeVertical.forEach(function(t) {
1907
- if (!e.fixedNodesOnHorizontal.has(t)) {
1908
- var n = 0;
1909
- n = e.dummyToNodeForHorizontalAlignment.has(t) ? e.idToNodeMap.get(e.dummyToNodeForHorizontalAlignment.get(t)[0]).displacementY : e.idToNodeMap.get(t).displacementY, e.nodeToRelativeConstraintMapVertical.get(t).forEach(function(r) {
1910
- if (r.bottom) {
1911
- var i = e.nodeToTempPositionMapVertical.get(r.bottom) - e.nodeToTempPositionMapVertical.get(t) - n;
1912
- i < r.gap && (n -= r.gap - i);
1913
- } else {
1914
- var i = e.nodeToTempPositionMapVertical.get(t) - e.nodeToTempPositionMapVertical.get(r.top) + n;
1915
- i < r.gap && (n += r.gap - i);
1916
- }
1917
- }), e.nodeToTempPositionMapVertical.set(t, e.nodeToTempPositionMapVertical.get(t) + n), e.dummyToNodeForHorizontalAlignment.has(t) ? e.dummyToNodeForHorizontalAlignment.get(t).forEach(function(t) {
1918
- e.idToNodeMap.get(t).displacementY = n;
1919
- }) : e.idToNodeMap.get(t).displacementY = n;
1920
- }
1921
- });
1922
- else {
1923
- for (var n = 0; n < this.componentsOnHorizontal.length; n++) {
1924
- var u = this.componentsOnHorizontal[n];
1925
- if (this.fixedComponentsOnHorizontal[n]) for (var i = 0; i < u.length; i++) this.dummyToNodeForVerticalAlignment.has(u[i]) ? this.dummyToNodeForVerticalAlignment.get(u[i]).forEach(function(t) {
1926
- e.idToNodeMap.get(t).displacementX = 0;
1927
- }) : this.idToNodeMap.get(u[i]).displacementX = 0;
1928
- else {
1929
- for (var d = 0, f = 0, i = 0; i < u.length; i++) if (this.dummyToNodeForVerticalAlignment.has(u[i])) {
1930
- var p = this.dummyToNodeForVerticalAlignment.get(u[i]);
1931
- d += p.length * this.idToNodeMap.get(p[0]).displacementX, f += p.length;
1932
- } else d += this.idToNodeMap.get(u[i]).displacementX, f++;
1933
- for (var m = d / f, i = 0; i < u.length; i++) this.dummyToNodeForVerticalAlignment.has(u[i]) ? this.dummyToNodeForVerticalAlignment.get(u[i]).forEach(function(t) {
1934
- e.idToNodeMap.get(t).displacementX = m;
1935
- }) : this.idToNodeMap.get(u[i]).displacementX = m;
1936
- }
1937
- }
1938
- for (var n = 0; n < this.componentsOnVertical.length; n++) {
1939
- var u = this.componentsOnVertical[n];
1940
- if (this.fixedComponentsOnVertical[n]) for (var i = 0; i < u.length; i++) this.dummyToNodeForHorizontalAlignment.has(u[i]) ? this.dummyToNodeForHorizontalAlignment.get(u[i]).forEach(function(t) {
1941
- e.idToNodeMap.get(t).displacementY = 0;
1942
- }) : this.idToNodeMap.get(u[i]).displacementY = 0;
1943
- else {
1944
- for (var d = 0, f = 0, i = 0; i < u.length; i++) if (this.dummyToNodeForHorizontalAlignment.has(u[i])) {
1945
- var p = this.dummyToNodeForHorizontalAlignment.get(u[i]);
1946
- d += p.length * this.idToNodeMap.get(p[0]).displacementY, f += p.length;
1947
- } else d += this.idToNodeMap.get(u[i]).displacementY, f++;
1948
- for (var m = d / f, i = 0; i < u.length; i++) this.dummyToNodeForHorizontalAlignment.has(u[i]) ? this.dummyToNodeForHorizontalAlignment.get(u[i]).forEach(function(t) {
1949
- e.idToNodeMap.get(t).displacementY = m;
1950
- }) : this.idToNodeMap.get(u[i]).displacementY = m;
1951
- }
1952
- }
1953
- }
1954
- }
1955
- }, x.prototype.calculateNodesToApplyGravitationTo = function() {
1956
- var e = [], t, n = this.graphManager.getGraphs(), r = n.length, i;
1957
- for (i = 0; i < r; i++) t = n[i], t.updateConnected(), t.isConnected || (e = e.concat(t.getNodes()));
1958
- return e;
1959
- }, x.prototype.createBendpoints = function() {
1960
- var e = [];
1961
- e = e.concat(this.graphManager.getAllEdges());
1962
- var t = /* @__PURE__ */ new Set(), n;
1963
- for (n = 0; n < e.length; n++) {
1964
- var r = e[n];
1965
- if (!t.has(r)) {
1966
- var i = r.getSource(), a = r.getTarget();
1967
- if (i == a) r.getBendpoints().push(new p()), r.getBendpoints().push(new p()), this.createDummyNodesForBendpoints(r), t.add(r);
1968
- else {
1969
- var o = [];
1970
- if (o = o.concat(i.getEdgeListToNode(a)), o = o.concat(a.getEdgeListToNode(i)), !t.has(o[0])) {
1971
- if (o.length > 1) {
1972
- var s;
1973
- for (s = 0; s < o.length; s++) {
1974
- var c = o[s];
1975
- c.getBendpoints().push(new p()), this.createDummyNodesForBendpoints(c);
1976
- }
1977
- }
1978
- o.forEach(function(e) {
1979
- t.add(e);
1980
- });
1981
- }
1982
- }
1983
- }
1984
- if (t.size == e.length) break;
1985
- }
1986
- }, x.prototype.positionNodesRadially = function(e) {
1987
- for (var t = new f(0, 0), n = Math.ceil(Math.sqrt(e.length)), r = 0, i = 0, a = 0, o = new p(0, 0), s = 0; s < e.length; s++) {
1988
- s % n == 0 && (a = 0, i = r, s != 0 && (i += c.DEFAULT_COMPONENT_SEPERATION), r = 0);
1989
- var l = e[s], u = h.findCenterOfTree(l);
1990
- t.x = a, t.y = i, o = x.radialLayout(l, u, t), o.y > r && (r = Math.floor(o.y)), a = Math.floor(o.x + c.DEFAULT_COMPONENT_SEPERATION);
1991
- }
1992
- this.transform(new p(d.WORLD_CENTER_X - o.x / 2, d.WORLD_CENTER_Y - o.y / 2));
1993
- }, x.radialLayout = function(e, t, n) {
1994
- var r = Math.max(this.maxDiagonalInTree(e), c.DEFAULT_RADIAL_SEPARATION);
1995
- x.branchRadialLayout(t, null, 0, 359, 0, r);
1996
- var i = v.calculateBounds(e), a = new y();
1997
- a.setDeviceOrgX(i.getMinX()), a.setDeviceOrgY(i.getMinY()), a.setWorldOrgX(n.x), a.setWorldOrgY(n.y);
1998
- for (var o = 0; o < e.length; o++) e[o].transform(a);
1999
- var s = new p(i.getMaxX(), i.getMaxY());
2000
- return a.inverseTransformPoint(s);
2001
- }, x.branchRadialLayout = function(e, t, n, r, i, a) {
2002
- var o = (r - n + 1) / 2;
2003
- o < 0 && (o += 180);
2004
- var s = (o + n) % 360 * _.TWO_PI / 360, c = i * Math.cos(s), l = i * Math.sin(s);
2005
- e.setCenter(c, l);
2006
- var u = [];
2007
- u = u.concat(e.getEdges());
2008
- var d = u.length;
2009
- t != null && d--;
2010
- for (var f = 0, p = u.length, m, h = e.getEdgesBetween(t); h.length > 1;) {
2011
- var g = h[0];
2012
- h.splice(0, 1);
2013
- var v = u.indexOf(g);
2014
- v >= 0 && u.splice(v, 1), p--, d--;
2015
- }
2016
- m = t == null ? 0 : (u.indexOf(h[0]) + 1) % p;
2017
- for (var y = Math.abs(r - n) / d, b = m; f != d; b = ++b % p) {
2018
- var S = u[b].getOtherEnd(e);
2019
- if (S != t) {
2020
- var C = (n + f * y) % 360, w = (C + y) % 360;
2021
- x.branchRadialLayout(S, e, C, w, i + a, a), f++;
2022
- }
2023
- }
2024
- }, x.maxDiagonalInTree = function(e) {
2025
- for (var t = g.MIN_VALUE, n = 0; n < e.length; n++) {
2026
- var r = e[n].getDiagonal();
2027
- r > t && (t = r);
2028
- }
2029
- return t;
2030
- }, x.prototype.calcRepulsionRange = function() {
2031
- return 2 * (this.level + 1) * this.idealEdgeLength;
2032
- }, x.prototype.groupZeroDegreeMembers = function() {
2033
- var e = this, t = {};
2034
- this.memberGroups = {}, this.idToDummyNode = {};
2035
- for (var n = [], r = this.graphManager.getAllNodes(), i = 0; i < r.length; i++) {
2036
- var a = r[i], s = a.getParent();
2037
- this.getNodeDegreeWithChildren(a) === 0 && (s.id == null || !this.getToBeTiled(s)) && n.push(a);
2038
- }
2039
- for (var i = 0; i < n.length; i++) {
2040
- var a = n[i], c = a.getParent().id;
2041
- t[c] === void 0 && (t[c] = []), t[c] = t[c].concat(a);
2042
- }
2043
- Object.keys(t).forEach(function(n) {
2044
- if (t[n].length > 1) {
2045
- var r = "DummyCompound_" + n;
2046
- e.memberGroups[r] = t[n];
2047
- var i = t[n][0].getParent(), a = new o(e.graphManager);
2048
- a.id = r, a.paddingLeft = i.paddingLeft || 0, a.paddingRight = i.paddingRight || 0, a.paddingBottom = i.paddingBottom || 0, a.paddingTop = i.paddingTop || 0, e.idToDummyNode[r] = a;
2049
- var s = e.getGraphManager().add(e.newGraph(), a), c = i.getChild();
2050
- c.add(a);
2051
- for (var l = 0; l < t[n].length; l++) {
2052
- var u = t[n][l];
2053
- c.remove(u), s.add(u);
2054
- }
2055
- }
2056
- });
2057
- }, x.prototype.clearCompounds = function() {
2058
- var e = {}, t = {};
2059
- this.performDFSOnCompounds();
2060
- for (var n = 0; n < this.compoundOrder.length; n++) t[this.compoundOrder[n].id] = this.compoundOrder[n], e[this.compoundOrder[n].id] = [].concat(this.compoundOrder[n].getChild().getNodes()), this.graphManager.remove(this.compoundOrder[n].getChild()), this.compoundOrder[n].child = null;
2061
- this.graphManager.resetAllNodes(), this.tileCompoundMembers(e, t);
2062
- }, x.prototype.clearZeroDegreeMembers = function() {
2063
- var e = this, t = this.tiledZeroDegreePack = [];
2064
- Object.keys(this.memberGroups).forEach(function(n) {
2065
- var r = e.idToDummyNode[n];
2066
- if (t[n] = e.tileNodes(e.memberGroups[n], r.paddingLeft + r.paddingRight), r.rect.width = t[n].width, r.rect.height = t[n].height, r.setCenter(t[n].centerX, t[n].centerY), r.labelMarginLeft = 0, r.labelMarginTop = 0, c.NODE_DIMENSIONS_INCLUDE_LABELS) {
2067
- var i = r.rect.width, a = r.rect.height;
2068
- r.labelWidth && (r.labelPosHorizontal == "left" ? (r.rect.x -= r.labelWidth, r.setWidth(i + r.labelWidth), r.labelMarginLeft = r.labelWidth) : r.labelPosHorizontal == "center" && r.labelWidth > i ? (r.rect.x -= (r.labelWidth - i) / 2, r.setWidth(r.labelWidth), r.labelMarginLeft = (r.labelWidth - i) / 2) : r.labelPosHorizontal == "right" && r.setWidth(i + r.labelWidth)), r.labelHeight && (r.labelPosVertical == "top" ? (r.rect.y -= r.labelHeight, r.setHeight(a + r.labelHeight), r.labelMarginTop = r.labelHeight) : r.labelPosVertical == "center" && r.labelHeight > a ? (r.rect.y -= (r.labelHeight - a) / 2, r.setHeight(r.labelHeight), r.labelMarginTop = (r.labelHeight - a) / 2) : r.labelPosVertical == "bottom" && r.setHeight(a + r.labelHeight));
2069
- }
2070
- });
2071
- }, x.prototype.repopulateCompounds = function() {
2072
- for (var e = this.compoundOrder.length - 1; e >= 0; e--) {
2073
- var t = this.compoundOrder[e], n = t.id, r = t.paddingLeft, i = t.paddingTop, a = t.labelMarginLeft, o = t.labelMarginTop;
2074
- this.adjustLocations(this.tiledMemberPack[n], t.rect.x, t.rect.y, r, i, a, o);
2075
- }
2076
- }, x.prototype.repopulateZeroDegreeMembers = function() {
2077
- var e = this, t = this.tiledZeroDegreePack;
2078
- Object.keys(t).forEach(function(n) {
2079
- var r = e.idToDummyNode[n], i = r.paddingLeft, a = r.paddingTop, o = r.labelMarginLeft, s = r.labelMarginTop;
2080
- e.adjustLocations(t[n], r.rect.x, r.rect.y, i, a, o, s);
2081
- });
2082
- }, x.prototype.getToBeTiled = function(e) {
2083
- var t = e.id;
2084
- if (this.toBeTiled[t] != null) return this.toBeTiled[t];
2085
- var n = e.getChild();
2086
- if (n == null) return this.toBeTiled[t] = !1, !1;
2087
- for (var r = n.getNodes(), i = 0; i < r.length; i++) {
2088
- var a = r[i];
2089
- if (this.getNodeDegree(a) > 0) return this.toBeTiled[t] = !1, !1;
2090
- if (a.getChild() == null) {
2091
- this.toBeTiled[a.id] = !1;
2092
- continue;
2093
- }
2094
- if (!this.getToBeTiled(a)) return this.toBeTiled[t] = !1, !1;
2095
- }
2096
- return this.toBeTiled[t] = !0, !0;
2097
- }, x.prototype.getNodeDegree = function(e) {
2098
- e.id;
2099
- for (var t = e.getEdges(), n = 0, r = 0; r < t.length; r++) {
2100
- var i = t[r];
2101
- i.getSource().id !== i.getTarget().id && (n += 1);
2102
- }
2103
- return n;
2104
- }, x.prototype.getNodeDegreeWithChildren = function(e) {
2105
- var t = this.getNodeDegree(e);
2106
- if (e.getChild() == null) return t;
2107
- for (var n = e.getChild().getNodes(), r = 0; r < n.length; r++) {
2108
- var i = n[r];
2109
- t += this.getNodeDegreeWithChildren(i);
2110
- }
2111
- return t;
2112
- }, x.prototype.performDFSOnCompounds = function() {
2113
- this.compoundOrder = [], this.fillCompexOrderByDFS(this.graphManager.getRoot().getNodes());
2114
- }, x.prototype.fillCompexOrderByDFS = function(e) {
2115
- for (var t = 0; t < e.length; t++) {
2116
- var n = e[t];
2117
- n.getChild() != null && this.fillCompexOrderByDFS(n.getChild().getNodes()), this.getToBeTiled(n) && this.compoundOrder.push(n);
2118
- }
2119
- }, x.prototype.adjustLocations = function(e, t, n, r, i, a, o) {
2120
- t += r + a, n += i + o;
2121
- for (var s = t, c = 0; c < e.rows.length; c++) {
2122
- var l = e.rows[c];
2123
- t = s;
2124
- for (var u = 0, d = 0; d < l.length; d++) {
2125
- var f = l[d];
2126
- f.rect.x = t, f.rect.y = n, t += f.rect.width + e.horizontalPadding, f.rect.height > u && (u = f.rect.height);
2127
- }
2128
- n += u + e.verticalPadding;
2129
- }
2130
- }, x.prototype.tileCompoundMembers = function(e, t) {
2131
- var n = this;
2132
- this.tiledMemberPack = [], Object.keys(e).forEach(function(r) {
2133
- var i = t[r];
2134
- if (n.tiledMemberPack[r] = n.tileNodes(e[r], i.paddingLeft + i.paddingRight), i.rect.width = n.tiledMemberPack[r].width, i.rect.height = n.tiledMemberPack[r].height, i.setCenter(n.tiledMemberPack[r].centerX, n.tiledMemberPack[r].centerY), i.labelMarginLeft = 0, i.labelMarginTop = 0, c.NODE_DIMENSIONS_INCLUDE_LABELS) {
2135
- var a = i.rect.width, o = i.rect.height;
2136
- i.labelWidth && (i.labelPosHorizontal == "left" ? (i.rect.x -= i.labelWidth, i.setWidth(a + i.labelWidth), i.labelMarginLeft = i.labelWidth) : i.labelPosHorizontal == "center" && i.labelWidth > a ? (i.rect.x -= (i.labelWidth - a) / 2, i.setWidth(i.labelWidth), i.labelMarginLeft = (i.labelWidth - a) / 2) : i.labelPosHorizontal == "right" && i.setWidth(a + i.labelWidth)), i.labelHeight && (i.labelPosVertical == "top" ? (i.rect.y -= i.labelHeight, i.setHeight(o + i.labelHeight), i.labelMarginTop = i.labelHeight) : i.labelPosVertical == "center" && i.labelHeight > o ? (i.rect.y -= (i.labelHeight - o) / 2, i.setHeight(i.labelHeight), i.labelMarginTop = (i.labelHeight - o) / 2) : i.labelPosVertical == "bottom" && i.setHeight(o + i.labelHeight));
2137
- }
2138
- });
2139
- }, x.prototype.tileNodes = function(e, t) {
2140
- var n = this.tileNodesByFavoringDim(e, t, !0), r = this.tileNodesByFavoringDim(e, t, !1), i = this.getOrgRatio(n);
2141
- return this.getOrgRatio(r) < i ? r : n;
2142
- }, x.prototype.getOrgRatio = function(e) {
2143
- var t = e.width / e.height;
2144
- return t < 1 && (t = 1 / t), t;
2145
- }, x.prototype.calcIdealRowWidth = function(e, t) {
2146
- var n = c.TILING_PADDING_VERTICAL, r = c.TILING_PADDING_HORIZONTAL, i = e.length, a = 0, o = 0, s = 0;
2147
- e.forEach(function(e) {
2148
- a += e.getWidth(), o += e.getHeight(), e.getWidth() > s && (s = e.getWidth());
2149
- });
2150
- var l = a / i, u = o / i, d = (n - r) ** 2 + 4 * (l + r) * (u + n) * i, f = (r - n + Math.sqrt(d)) / (2 * (l + r)), p;
2151
- t ? (p = Math.ceil(f), p == f && p++) : p = Math.floor(f);
2152
- var m = p * (l + r) - r;
2153
- return s > m && (m = s), m += r * 2, m;
2154
- }, x.prototype.tileNodesByFavoringDim = function(e, t, n) {
2155
- var r = c.TILING_PADDING_VERTICAL, i = c.TILING_PADDING_HORIZONTAL, a = c.TILING_COMPARE_BY, o = {
2156
- rows: [],
2157
- rowWidth: [],
2158
- rowHeight: [],
2159
- width: 0,
2160
- height: t,
2161
- verticalPadding: r,
2162
- horizontalPadding: i,
2163
- centerX: 0,
2164
- centerY: 0
2165
- };
2166
- a && (o.idealRowWidth = this.calcIdealRowWidth(e, n));
2167
- var s = function(e) {
2168
- return e.rect.width * e.rect.height;
2169
- }, l = function(e, t) {
2170
- return s(t) - s(e);
2171
- };
2172
- e.sort(function(e, t) {
2173
- var n = l;
2174
- return o.idealRowWidth ? (n = a, n(e.id, t.id)) : n(e, t);
2175
- });
2176
- for (var u = 0, d = 0, f = 0; f < e.length; f++) {
2177
- var p = e[f];
2178
- u += p.getCenterX(), d += p.getCenterY();
2179
- }
2180
- o.centerX = u / e.length, o.centerY = d / e.length;
2181
- for (var f = 0; f < e.length; f++) {
2182
- var p = e[f];
2183
- if (o.rows.length == 0) this.insertNodeToRow(o, p, 0, t);
2184
- else if (this.canAddHorizontal(o, p.rect.width, p.rect.height)) {
2185
- var m = o.rows.length - 1;
2186
- o.idealRowWidth || (m = this.getShortestRowIndex(o)), this.insertNodeToRow(o, p, m, t);
2187
- } else this.insertNodeToRow(o, p, o.rows.length, t);
2188
- this.shiftToLastRow(o);
2189
- }
2190
- return o;
2191
- }, x.prototype.insertNodeToRow = function(e, t, n, r) {
2192
- var i = r;
2193
- n == e.rows.length && (e.rows.push([]), e.rowWidth.push(i), e.rowHeight.push(0));
2194
- var a = e.rowWidth[n] + t.rect.width;
2195
- e.rows[n].length > 0 && (a += e.horizontalPadding), e.rowWidth[n] = a, e.width < a && (e.width = a);
2196
- var o = t.rect.height;
2197
- n > 0 && (o += e.verticalPadding);
2198
- var s = 0;
2199
- o > e.rowHeight[n] && (s = e.rowHeight[n], e.rowHeight[n] = o, s = e.rowHeight[n] - s), e.height += s, e.rows[n].push(t);
2200
- }, x.prototype.getShortestRowIndex = function(e) {
2201
- for (var t = -1, n = Number.MAX_VALUE, r = 0; r < e.rows.length; r++) e.rowWidth[r] < n && (t = r, n = e.rowWidth[r]);
2202
- return t;
2203
- }, x.prototype.getLongestRowIndex = function(e) {
2204
- for (var t = -1, n = Number.MIN_VALUE, r = 0; r < e.rows.length; r++) e.rowWidth[r] > n && (t = r, n = e.rowWidth[r]);
2205
- return t;
2206
- }, x.prototype.canAddHorizontal = function(e, t, n) {
2207
- if (e.idealRowWidth) {
2208
- var r = e.rows.length - 1;
2209
- return e.rowWidth[r] + t + e.horizontalPadding <= e.idealRowWidth;
2210
- }
2211
- var i = this.getShortestRowIndex(e);
2212
- if (i < 0) return !0;
2213
- var a = e.rowWidth[i];
2214
- if (a + e.horizontalPadding + t <= e.width) return !0;
2215
- var o = 0;
2216
- e.rowHeight[i] < n && i > 0 && (o = n + e.verticalPadding - e.rowHeight[i]);
2217
- var s = e.width - a >= t + e.horizontalPadding ? (e.height + o) / (a + t + e.horizontalPadding) : (e.height + o) / e.width;
2218
- o = n + e.verticalPadding;
2219
- var c = e.width < t ? (e.height + o) / t : (e.height + o) / e.width;
2220
- return c < 1 && (c = 1 / c), s < 1 && (s = 1 / s), s < c;
2221
- }, x.prototype.shiftToLastRow = function(e) {
2222
- var t = this.getLongestRowIndex(e), n = e.rowWidth.length - 1, r = e.rows[t], i = r[r.length - 1], a = i.width + e.horizontalPadding;
2223
- if (e.width - e.rowWidth[n] > a && t != n) {
2224
- r.splice(-1, 1), e.rows[n].push(i), e.rowWidth[t] = e.rowWidth[t] - a, e.rowWidth[n] = e.rowWidth[n] + a, e.width = e.rowWidth[instance.getLongestRowIndex(e)];
2225
- for (var o = Number.MIN_VALUE, s = 0; s < r.length; s++) r[s].height > o && (o = r[s].height);
2226
- t > 0 && (o += e.verticalPadding);
2227
- var c = e.rowHeight[t] + e.rowHeight[n];
2228
- e.rowHeight[t] = o, e.rowHeight[n] < i.height + e.verticalPadding && (e.rowHeight[n] = i.height + e.verticalPadding);
2229
- var l = e.rowHeight[t] + e.rowHeight[n];
2230
- e.height += l - c, this.shiftToLastRow(e);
2231
- }
2232
- }, x.prototype.tilingPreLayout = function() {
2233
- c.TILE && (this.groupZeroDegreeMembers(), this.clearCompounds(), this.clearZeroDegreeMembers());
2234
- }, x.prototype.tilingPostLayout = function() {
2235
- c.TILE && (this.repopulateZeroDegreeMembers(), this.repopulateCompounds());
2236
- }, x.prototype.reduceTrees = function() {
2237
- for (var e = [], t = !0, n; t;) {
2238
- var r = this.graphManager.getAllNodes(), i = [];
2239
- t = !1;
2240
- for (var a = 0; a < r.length; a++) if (n = r[a], n.getEdges().length == 1 && !n.getEdges()[0].isInterGraph && n.getChild() == null) {
2241
- if (c.PURE_INCREMENTAL) {
2242
- var o = n.getEdges()[0].getOtherEnd(n), s = new m(n.getCenterX() - o.getCenterX(), n.getCenterY() - o.getCenterY());
2243
- i.push([
2244
- n,
2245
- n.getEdges()[0],
2246
- n.getOwner(),
2247
- s
2248
- ]);
2249
- } else i.push([
2250
- n,
2251
- n.getEdges()[0],
2252
- n.getOwner()
2253
- ]);
2254
- t = !0;
2255
- }
2256
- if (t == 1) {
2257
- for (var l = [], u = 0; u < i.length; u++) i[u][0].getEdges().length == 1 && (l.push(i[u]), i[u][0].getOwner().remove(i[u][0]));
2258
- e.push(l), this.graphManager.resetAllNodes(), this.graphManager.resetAllEdges();
2259
- }
2260
- }
2261
- this.prunedNodesAll = e;
2262
- }, x.prototype.growTree = function(e) {
2263
- for (var t = e[e.length - 1], n, r = 0; r < t.length; r++) n = t[r], this.findPlaceforPrunedNode(n), n[2].add(n[0]), n[2].add(n[1], n[1].source, n[1].target);
2264
- e.splice(e.length - 1, 1), this.graphManager.resetAllNodes(), this.graphManager.resetAllEdges();
2265
- }, x.prototype.findPlaceforPrunedNode = function(e) {
2266
- var t, n, r = e[0];
2267
- if (n = r == e[1].source ? e[1].target : e[1].source, c.PURE_INCREMENTAL) r.setCenter(n.getCenterX() + e[3].getWidth(), n.getCenterY() + e[3].getHeight());
2268
- else {
2269
- var i = n.startX, a = n.finishX, o = n.startY, s = n.finishY, l = [
2270
- 0,
2271
- 0,
2272
- 0,
2273
- 0
2274
- ];
2275
- if (o > 0) for (var d = i; d <= a; d++) l[0] += this.grid[d][o - 1].length + this.grid[d][o].length - 1;
2276
- if (a < this.grid.length - 1) for (var d = o; d <= s; d++) l[1] += this.grid[a + 1][d].length + this.grid[a][d].length - 1;
2277
- if (s < this.grid[0].length - 1) for (var d = i; d <= a; d++) l[2] += this.grid[d][s + 1].length + this.grid[d][s].length - 1;
2278
- if (i > 0) for (var d = o; d <= s; d++) l[3] += this.grid[i - 1][d].length + this.grid[i][d].length - 1;
2279
- for (var f = g.MAX_VALUE, p, m, h = 0; h < l.length; h++) l[h] < f ? (f = l[h], p = 1, m = h) : l[h] == f && p++;
2280
- if (p == 3 && f == 0) l[0] == 0 && l[1] == 0 && l[2] == 0 ? t = 1 : l[0] == 0 && l[1] == 0 && l[3] == 0 ? t = 0 : l[0] == 0 && l[2] == 0 && l[3] == 0 ? t = 3 : l[1] == 0 && l[2] == 0 && l[3] == 0 && (t = 2);
2281
- else if (p == 2 && f == 0) {
2282
- var _ = Math.floor(Math.random() * 2);
2283
- t = l[0] == 0 && l[1] == 0 ? _ == 0 ? 0 : 1 : l[0] == 0 && l[2] == 0 ? _ == 0 ? 0 : 2 : l[0] == 0 && l[3] == 0 ? _ == 0 ? 0 : 3 : l[1] == 0 && l[2] == 0 ? _ == 0 ? 1 : 2 : l[1] == 0 && l[3] == 0 ? _ == 0 ? 1 : 3 : _ == 0 ? 2 : 3;
2284
- } else if (p == 4 && f == 0) {
2285
- var _ = Math.floor(Math.random() * 4);
2286
- t = _;
2287
- } else t = m;
2288
- t == 0 ? r.setCenter(n.getCenterX(), n.getCenterY() - n.getHeight() / 2 - u.DEFAULT_EDGE_LENGTH - r.getHeight() / 2) : t == 1 ? r.setCenter(n.getCenterX() + n.getWidth() / 2 + u.DEFAULT_EDGE_LENGTH + r.getWidth() / 2, n.getCenterY()) : t == 2 ? r.setCenter(n.getCenterX(), n.getCenterY() + n.getHeight() / 2 + u.DEFAULT_EDGE_LENGTH + r.getHeight() / 2) : r.setCenter(n.getCenterX() - n.getWidth() / 2 - u.DEFAULT_EDGE_LENGTH - r.getWidth() / 2, n.getCenterY());
2289
- }
2290
- }, e.exports = x;
2291
- }),
2292
- 991: ((e, t, n) => {
2293
- var r = n(551).FDLayoutNode, i = n(551).IMath;
2294
- function a(e, t, n, i) {
2295
- r.call(this, e, t, n, i);
2296
- }
2297
- for (var o in a.prototype = Object.create(r.prototype), r) a[o] = r[o];
2298
- a.prototype.calculateDisplacement = function() {
2299
- var e = this.graphManager.getLayout();
2300
- this.getChild() != null && this.fixedNodeWeight ? (this.displacementX += e.coolingFactor * (this.springForceX + this.repulsionForceX + this.gravitationForceX) / this.fixedNodeWeight, this.displacementY += e.coolingFactor * (this.springForceY + this.repulsionForceY + this.gravitationForceY) / this.fixedNodeWeight) : (this.displacementX += e.coolingFactor * (this.springForceX + this.repulsionForceX + this.gravitationForceX) / this.noOfChildren, this.displacementY += e.coolingFactor * (this.springForceY + this.repulsionForceY + this.gravitationForceY) / this.noOfChildren), Math.abs(this.displacementX) > e.coolingFactor * e.maxNodeDisplacement && (this.displacementX = e.coolingFactor * e.maxNodeDisplacement * i.sign(this.displacementX)), Math.abs(this.displacementY) > e.coolingFactor * e.maxNodeDisplacement && (this.displacementY = e.coolingFactor * e.maxNodeDisplacement * i.sign(this.displacementY)), this.child && this.child.getNodes().length > 0 && this.propogateDisplacementToChildren(this.displacementX, this.displacementY);
2301
- }, a.prototype.propogateDisplacementToChildren = function(e, t) {
2302
- for (var n = this.getChild().getNodes(), r, i = 0; i < n.length; i++) r = n[i], r.getChild() == null ? (r.displacementX += e, r.displacementY += t) : r.propogateDisplacementToChildren(e, t);
2303
- }, a.prototype.move = function() {
2304
- var e = this.graphManager.getLayout();
2305
- (this.child == null || this.child.getNodes().length == 0) && (this.moveBy(this.displacementX, this.displacementY), e.totalDisplacement += Math.abs(this.displacementX) + Math.abs(this.displacementY)), this.springForceX = 0, this.springForceY = 0, this.repulsionForceX = 0, this.repulsionForceY = 0, this.gravitationForceX = 0, this.gravitationForceY = 0, this.displacementX = 0, this.displacementY = 0;
2306
- }, a.prototype.setPred1 = function(e) {
2307
- this.pred1 = e;
2308
- }, a.prototype.getPred1 = function() {
2309
- return pred1;
2310
- }, a.prototype.getPred2 = function() {
2311
- return pred2;
2312
- }, a.prototype.setNext = function(e) {
2313
- this.next = e;
2314
- }, a.prototype.getNext = function() {
2315
- return next;
2316
- }, a.prototype.setProcessed = function(e) {
2317
- this.processed = e;
2318
- }, a.prototype.isProcessed = function() {
2319
- return processed;
2320
- }, e.exports = a;
2321
- }),
2322
- 902: ((e, t, n) => {
2323
- function r(e) {
2324
- if (Array.isArray(e)) {
2325
- for (var t = 0, n = Array(e.length); t < e.length; t++) n[t] = e[t];
2326
- return n;
2327
- }
2328
- return Array.from(e);
2329
- }
2330
- var i = n(806), a = n(551).LinkedList, o = n(551).Matrix, s = n(551).SVD;
2331
- function c() {}
2332
- c.handleConstraints = function(e) {
2333
- var t = {};
2334
- t.fixedNodeConstraint = e.constraints.fixedNodeConstraint, t.alignmentConstraint = e.constraints.alignmentConstraint, t.relativePlacementConstraint = e.constraints.relativePlacementConstraint;
2335
- for (var n = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Map(), l = [], u = [], d = e.getAllNodes(), f = 0, p = 0; p < d.length; p++) {
2336
- var m = d[p];
2337
- m.getChild() ?? (c.set(m.id, f++), l.push(m.getCenterX()), u.push(m.getCenterY()), n.set(m.id, m));
2338
- }
2339
- t.relativePlacementConstraint && t.relativePlacementConstraint.forEach(function(e) {
2340
- !e.gap && e.gap != 0 && (e.gap = e.left ? i.DEFAULT_EDGE_LENGTH + n.get(e.left).getWidth() / 2 + n.get(e.right).getWidth() / 2 : i.DEFAULT_EDGE_LENGTH + n.get(e.top).getHeight() / 2 + n.get(e.bottom).getHeight() / 2);
2341
- });
2342
- var h = function(e, t) {
2343
- return {
2344
- x: e.x - t.x,
2345
- y: e.y - t.y
2346
- };
2347
- }, g = function(e) {
2348
- var t = 0, n = 0;
2349
- return e.forEach(function(e) {
2350
- t += l[c.get(e)], n += u[c.get(e)];
2351
- }), {
2352
- x: t / e.size,
2353
- y: n / e.size
2354
- };
2355
- }, _ = function(e, t, n, i, o) {
2356
- function s(e, t) {
2357
- var n = new Set(e), r = !0, i = !1, a = void 0;
2358
- try {
2359
- for (var o = t[Symbol.iterator](), s; !(r = (s = o.next()).done); r = !0) {
2360
- var c = s.value;
2361
- n.add(c);
2362
- }
2363
- } catch (e) {
2364
- i = !0, a = e;
2365
- } finally {
2366
- try {
2367
- !r && o.return && o.return();
2368
- } finally {
2369
- if (i) throw a;
2370
- }
2371
- }
2372
- return n;
2373
- }
2374
- var d = /* @__PURE__ */ new Map();
2375
- e.forEach(function(e, t) {
2376
- d.set(t, 0);
2377
- }), e.forEach(function(e, t) {
2378
- e.forEach(function(e) {
2379
- d.set(e.id, d.get(e.id) + 1);
2380
- });
2381
- });
2382
- var f = /* @__PURE__ */ new Map(), p = /* @__PURE__ */ new Map(), m = new a();
2383
- d.forEach(function(e, r) {
2384
- e == 0 ? (m.push(r), n || (t == "horizontal" ? f.set(r, c.has(r) ? l[c.get(r)] : i.get(r)) : f.set(r, c.has(r) ? u[c.get(r)] : i.get(r)))) : f.set(r, -Infinity), n && p.set(r, /* @__PURE__ */ new Set([r]));
2385
- }), n && o.forEach(function(e) {
2386
- var r = [];
2387
- if (e.forEach(function(e) {
2388
- n.has(e) && r.push(e);
2389
- }), r.length > 0) {
2390
- var a = 0;
2391
- r.forEach(function(e) {
2392
- t == "horizontal" ? (f.set(e, c.has(e) ? l[c.get(e)] : i.get(e)), a += f.get(e)) : (f.set(e, c.has(e) ? u[c.get(e)] : i.get(e)), a += f.get(e));
2393
- }), a /= r.length, e.forEach(function(e) {
2394
- n.has(e) || f.set(e, a);
2395
- });
2396
- } else {
2397
- var o = 0;
2398
- e.forEach(function(e) {
2399
- o += t == "horizontal" ? c.has(e) ? l[c.get(e)] : i.get(e) : c.has(e) ? u[c.get(e)] : i.get(e);
2400
- }), o /= e.length, e.forEach(function(e) {
2401
- f.set(e, o);
2402
- });
2403
- }
2404
- });
2405
- for (var h = function() {
2406
- var r = m.shift();
2407
- e.get(r).forEach(function(e) {
2408
- if (f.get(e.id) < f.get(r) + e.gap) {
2409
- if (n && n.has(e.id)) {
2410
- var a = void 0;
2411
- if (a = t == "horizontal" ? c.has(e.id) ? l[c.get(e.id)] : i.get(e.id) : c.has(e.id) ? u[c.get(e.id)] : i.get(e.id), f.set(e.id, a), a < f.get(r) + e.gap) {
2412
- var o = f.get(r) + e.gap - a;
2413
- p.get(r).forEach(function(e) {
2414
- f.set(e, f.get(e) - o);
2415
- });
2416
- }
2417
- } else f.set(e.id, f.get(r) + e.gap);
2418
- }
2419
- d.set(e.id, d.get(e.id) - 1), d.get(e.id) == 0 && m.push(e.id), n && p.set(e.id, s(p.get(r), p.get(e.id)));
2420
- });
2421
- }; m.length != 0;) h();
2422
- if (n) {
2423
- var g = /* @__PURE__ */ new Set();
2424
- e.forEach(function(e, t) {
2425
- e.length == 0 && g.add(t);
2426
- });
2427
- var _ = [];
2428
- p.forEach(function(e, t) {
2429
- if (g.has(t)) {
2430
- var i = !1, a = !0, o = !1, s = void 0;
2431
- try {
2432
- for (var c = e[Symbol.iterator](), l; !(a = (l = c.next()).done); a = !0) {
2433
- var u = l.value;
2434
- n.has(u) && (i = !0);
2435
- }
2436
- } catch (e) {
2437
- o = !0, s = e;
2438
- } finally {
2439
- try {
2440
- !a && c.return && c.return();
2441
- } finally {
2442
- if (o) throw s;
2443
- }
2444
- }
2445
- if (!i) {
2446
- var d = !1, f = void 0;
2447
- _.forEach(function(t, n) {
2448
- t.has([].concat(r(e))[0]) && (d = !0, f = n);
2449
- }), d ? e.forEach(function(e) {
2450
- _[f].add(e);
2451
- }) : _.push(new Set(e));
2452
- }
2453
- }
2454
- }), _.forEach(function(e, n) {
2455
- var r = Infinity, a = Infinity, o = -Infinity, s = -Infinity, d = !0, p = !1, m = void 0;
2456
- try {
2457
- for (var h = e[Symbol.iterator](), g; !(d = (g = h.next()).done); d = !0) {
2458
- var _ = g.value, v = void 0;
2459
- v = t == "horizontal" ? c.has(_) ? l[c.get(_)] : i.get(_) : c.has(_) ? u[c.get(_)] : i.get(_);
2460
- var y = f.get(_);
2461
- v < r && (r = v), v > o && (o = v), y < a && (a = y), y > s && (s = y);
2462
- }
2463
- } catch (e) {
2464
- p = !0, m = e;
2465
- } finally {
2466
- try {
2467
- !d && h.return && h.return();
2468
- } finally {
2469
- if (p) throw m;
2470
- }
2471
- }
2472
- var b = (r + o) / 2 - (a + s) / 2, x = !0, S = !1, C = void 0;
2473
- try {
2474
- for (var w = e[Symbol.iterator](), T; !(x = (T = w.next()).done); x = !0) {
2475
- var E = T.value;
2476
- f.set(E, f.get(E) + b);
2477
- }
2478
- } catch (e) {
2479
- S = !0, C = e;
2480
- } finally {
2481
- try {
2482
- !x && w.return && w.return();
2483
- } finally {
2484
- if (S) throw C;
2485
- }
2486
- }
2487
- });
2488
- }
2489
- return f;
2490
- }, v = function(e) {
2491
- var t = 0, n = 0, r = 0, i = 0;
2492
- if (e.forEach(function(e) {
2493
- e.left ? l[c.get(e.left)] - l[c.get(e.right)] >= 0 ? t++ : n++ : u[c.get(e.top)] - u[c.get(e.bottom)] >= 0 ? r++ : i++;
2494
- }), t > n && r > i) for (var a = 0; a < c.size; a++) l[a] = -1 * l[a], u[a] = -1 * u[a];
2495
- else if (t > n) for (var o = 0; o < c.size; o++) l[o] = -1 * l[o];
2496
- else if (r > i) for (var s = 0; s < c.size; s++) u[s] = -1 * u[s];
2497
- }, y = function(e) {
2498
- var t = [], n = new a(), r = /* @__PURE__ */ new Set(), i = 0;
2499
- return e.forEach(function(a, o) {
2500
- if (!r.has(o)) {
2501
- t[i] = [];
2502
- var s = o;
2503
- for (n.push(s), r.add(s), t[i].push(s); n.length != 0;) s = n.shift(), e.get(s).forEach(function(e) {
2504
- r.has(e.id) || (n.push(e.id), r.add(e.id), t[i].push(e.id));
2505
- });
2506
- i++;
2507
- }
2508
- }), t;
2509
- }, b = function(e) {
2510
- var t = /* @__PURE__ */ new Map();
2511
- return e.forEach(function(e, n) {
2512
- t.set(n, []);
2513
- }), e.forEach(function(e, n) {
2514
- e.forEach(function(e) {
2515
- t.get(n).push(e), t.get(e.id).push({
2516
- id: n,
2517
- gap: e.gap,
2518
- direction: e.direction
2519
- });
2520
- });
2521
- }), t;
2522
- }, x = function(e) {
2523
- var t = /* @__PURE__ */ new Map();
2524
- return e.forEach(function(e, n) {
2525
- t.set(n, []);
2526
- }), e.forEach(function(e, n) {
2527
- e.forEach(function(e) {
2528
- t.get(e.id).push({
2529
- id: n,
2530
- gap: e.gap,
2531
- direction: e.direction
2532
- });
2533
- });
2534
- }), t;
2535
- }, S = [], C = [], w = !1, T = !1, E = /* @__PURE__ */ new Set(), D = /* @__PURE__ */ new Map(), O = /* @__PURE__ */ new Map(), k = [];
2536
- if (t.fixedNodeConstraint && t.fixedNodeConstraint.forEach(function(e) {
2537
- E.add(e.nodeId);
2538
- }), t.relativePlacementConstraint && (t.relativePlacementConstraint.forEach(function(e) {
2539
- e.left ? (D.has(e.left) ? D.get(e.left).push({
2540
- id: e.right,
2541
- gap: e.gap,
2542
- direction: "horizontal"
2543
- }) : D.set(e.left, [{
2544
- id: e.right,
2545
- gap: e.gap,
2546
- direction: "horizontal"
2547
- }]), D.has(e.right) || D.set(e.right, [])) : (D.has(e.top) ? D.get(e.top).push({
2548
- id: e.bottom,
2549
- gap: e.gap,
2550
- direction: "vertical"
2551
- }) : D.set(e.top, [{
2552
- id: e.bottom,
2553
- gap: e.gap,
2554
- direction: "vertical"
2555
- }]), D.has(e.bottom) || D.set(e.bottom, []));
2556
- }), O = b(D), k = y(O)), i.TRANSFORM_ON_CONSTRAINT_HANDLING) {
2557
- if (t.fixedNodeConstraint && t.fixedNodeConstraint.length > 1) t.fixedNodeConstraint.forEach(function(e, t) {
2558
- S[t] = [e.position.x, e.position.y], C[t] = [l[c.get(e.nodeId)], u[c.get(e.nodeId)]];
2559
- }), w = !0;
2560
- else if (t.alignmentConstraint) (function() {
2561
- var e = 0;
2562
- if (t.alignmentConstraint.vertical) {
2563
- for (var n = t.alignmentConstraint.vertical, i = function(t) {
2564
- var i = /* @__PURE__ */ new Set();
2565
- n[t].forEach(function(e) {
2566
- i.add(e);
2567
- });
2568
- var a = new Set([].concat(r(i)).filter(function(e) {
2569
- return E.has(e);
2570
- })), o = void 0;
2571
- o = a.size > 0 ? l[c.get(a.values().next().value)] : g(i).x, n[t].forEach(function(t) {
2572
- S[e] = [o, u[c.get(t)]], C[e] = [l[c.get(t)], u[c.get(t)]], e++;
2573
- });
2574
- }, a = 0; a < n.length; a++) i(a);
2575
- w = !0;
2576
- }
2577
- if (t.alignmentConstraint.horizontal) {
2578
- for (var o = t.alignmentConstraint.horizontal, s = function(t) {
2579
- var n = /* @__PURE__ */ new Set();
2580
- o[t].forEach(function(e) {
2581
- n.add(e);
2582
- });
2583
- var i = new Set([].concat(r(n)).filter(function(e) {
2584
- return E.has(e);
2585
- })), a = void 0;
2586
- a = i.size > 0 ? l[c.get(i.values().next().value)] : g(n).y, o[t].forEach(function(t) {
2587
- S[e] = [l[c.get(t)], a], C[e] = [l[c.get(t)], u[c.get(t)]], e++;
2588
- });
2589
- }, d = 0; d < o.length; d++) s(d);
2590
- w = !0;
2591
- }
2592
- t.relativePlacementConstraint && (T = !0);
2593
- })();
2594
- else if (t.relativePlacementConstraint) {
2595
- for (var A = 0, j = 0, M = 0; M < k.length; M++) k[M].length > A && (A = k[M].length, j = M);
2596
- if (A < O.size / 2) v(t.relativePlacementConstraint), w = !1, T = !1;
2597
- else {
2598
- var N = /* @__PURE__ */ new Map(), P = /* @__PURE__ */ new Map(), F = [];
2599
- k[j].forEach(function(e) {
2600
- D.get(e).forEach(function(t) {
2601
- t.direction == "horizontal" ? (N.has(e) ? N.get(e).push(t) : N.set(e, [t]), N.has(t.id) || N.set(t.id, []), F.push({
2602
- left: e,
2603
- right: t.id
2604
- })) : (P.has(e) ? P.get(e).push(t) : P.set(e, [t]), P.has(t.id) || P.set(t.id, []), F.push({
2605
- top: e,
2606
- bottom: t.id
2607
- }));
2608
- });
2609
- }), v(F), T = !1;
2610
- var I = _(N, "horizontal"), L = _(P, "vertical");
2611
- k[j].forEach(function(e, t) {
2612
- C[t] = [l[c.get(e)], u[c.get(e)]], S[t] = [], I.has(e) ? S[t][0] = I.get(e) : S[t][0] = l[c.get(e)], L.has(e) ? S[t][1] = L.get(e) : S[t][1] = u[c.get(e)];
2613
- }), w = !0;
2614
- }
2615
- }
2616
- if (w) {
2617
- for (var R = void 0, z = o.transpose(S), B = o.transpose(C), V = 0; V < z.length; V++) z[V] = o.multGamma(z[V]), B[V] = o.multGamma(B[V]);
2618
- var ee = o.multMat(z, o.transpose(B)), te = s.svd(ee);
2619
- R = o.multMat(te.V, o.transpose(te.U));
2620
- for (var H = 0; H < c.size; H++) {
2621
- var ne = [l[H], u[H]], re = [R[0][0], R[1][0]], U = [R[0][1], R[1][1]];
2622
- l[H] = o.dotProduct(ne, re), u[H] = o.dotProduct(ne, U);
2623
- }
2624
- T && v(t.relativePlacementConstraint);
2625
- }
2626
- }
2627
- if (i.ENFORCE_CONSTRAINTS) {
2628
- if (t.fixedNodeConstraint && t.fixedNodeConstraint.length > 0) {
2629
- var W = {
2630
- x: 0,
2631
- y: 0
2632
- };
2633
- t.fixedNodeConstraint.forEach(function(e, t) {
2634
- var n = {
2635
- x: l[c.get(e.nodeId)],
2636
- y: u[c.get(e.nodeId)]
2637
- }, r = e.position, i = h(r, n);
2638
- W.x += i.x, W.y += i.y;
2639
- }), W.x /= t.fixedNodeConstraint.length, W.y /= t.fixedNodeConstraint.length, l.forEach(function(e, t) {
2640
- l[t] += W.x;
2641
- }), u.forEach(function(e, t) {
2642
- u[t] += W.y;
2643
- }), t.fixedNodeConstraint.forEach(function(e) {
2644
- l[c.get(e.nodeId)] = e.position.x, u[c.get(e.nodeId)] = e.position.y;
2645
- });
2646
- }
2647
- if (t.alignmentConstraint) {
2648
- if (t.alignmentConstraint.vertical) for (var G = t.alignmentConstraint.vertical, ie = function(e) {
2649
- var t = /* @__PURE__ */ new Set();
2650
- G[e].forEach(function(e) {
2651
- t.add(e);
2652
- });
2653
- var n = new Set([].concat(r(t)).filter(function(e) {
2654
- return E.has(e);
2655
- })), i = void 0;
2656
- i = n.size > 0 ? l[c.get(n.values().next().value)] : g(t).x, t.forEach(function(e) {
2657
- E.has(e) || (l[c.get(e)] = i);
2658
- });
2659
- }, K = 0; K < G.length; K++) ie(K);
2660
- if (t.alignmentConstraint.horizontal) for (var q = t.alignmentConstraint.horizontal, ae = function(e) {
2661
- var t = /* @__PURE__ */ new Set();
2662
- q[e].forEach(function(e) {
2663
- t.add(e);
2664
- });
2665
- var n = new Set([].concat(r(t)).filter(function(e) {
2666
- return E.has(e);
2667
- })), i = void 0;
2668
- i = n.size > 0 ? u[c.get(n.values().next().value)] : g(t).y, t.forEach(function(e) {
2669
- E.has(e) || (u[c.get(e)] = i);
2670
- });
2671
- }, J = 0; J < q.length; J++) ae(J);
2672
- }
2673
- t.relativePlacementConstraint && (function() {
2674
- var e = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Set(), d = /* @__PURE__ */ new Set();
2675
- if (E.forEach(function(e) {
2676
- s.add(e), d.add(e);
2677
- }), t.alignmentConstraint) {
2678
- if (t.alignmentConstraint.vertical) for (var f = t.alignmentConstraint.vertical, p = function(t) {
2679
- r.set("dummy" + t, []), f[t].forEach(function(n) {
2680
- e.set(n, "dummy" + t), r.get("dummy" + t).push(n), E.has(n) && s.add("dummy" + t);
2681
- }), a.set("dummy" + t, l[c.get(f[t][0])]);
2682
- }, m = 0; m < f.length; m++) p(m);
2683
- if (t.alignmentConstraint.horizontal) for (var h = t.alignmentConstraint.horizontal, g = function(e) {
2684
- i.set("dummy" + e, []), h[e].forEach(function(t) {
2685
- n.set(t, "dummy" + e), i.get("dummy" + e).push(t), E.has(t) && d.add("dummy" + e);
2686
- }), o.set("dummy" + e, u[c.get(h[e][0])]);
2687
- }, v = 0; v < h.length; v++) g(v);
2688
- }
2689
- var S = /* @__PURE__ */ new Map(), C = /* @__PURE__ */ new Map(), w = function(t) {
2690
- D.get(t).forEach(function(r) {
2691
- var i = void 0, a = void 0;
2692
- r.direction == "horizontal" ? (i = e.get(t) ? e.get(t) : t, a = e.get(r.id) ? {
2693
- id: e.get(r.id),
2694
- gap: r.gap,
2695
- direction: r.direction
2696
- } : r, S.has(i) ? S.get(i).push(a) : S.set(i, [a]), S.has(a.id) || S.set(a.id, [])) : (i = n.get(t) ? n.get(t) : t, a = n.get(r.id) ? {
2697
- id: n.get(r.id),
2698
- gap: r.gap,
2699
- direction: r.direction
2700
- } : r, C.has(i) ? C.get(i).push(a) : C.set(i, [a]), C.has(a.id) || C.set(a.id, []));
2701
- });
2702
- }, T = !0, O = !1, k = void 0;
2703
- try {
2704
- for (var A = D.keys()[Symbol.iterator](), j; !(T = (j = A.next()).done); T = !0) {
2705
- var M = j.value;
2706
- w(M);
2707
- }
2708
- } catch (e) {
2709
- O = !0, k = e;
2710
- } finally {
2711
- try {
2712
- !T && A.return && A.return();
2713
- } finally {
2714
- if (O) throw k;
2715
- }
2716
- }
2717
- var N = b(S), P = b(C), F = y(N), I = y(P), L = x(S), R = x(C), z = [], B = [];
2718
- F.forEach(function(e, t) {
2719
- z[t] = [], e.forEach(function(e) {
2720
- L.get(e).length == 0 && z[t].push(e);
2721
- });
2722
- }), I.forEach(function(e, t) {
2723
- B[t] = [], e.forEach(function(e) {
2724
- R.get(e).length == 0 && B[t].push(e);
2725
- });
2726
- });
2727
- var V = _(S, "horizontal", s, a, z), ee = _(C, "vertical", d, o, B), te = function(e) {
2728
- r.get(e) ? r.get(e).forEach(function(t) {
2729
- l[c.get(t)] = V.get(e);
2730
- }) : l[c.get(e)] = V.get(e);
2731
- }, H = !0, ne = !1, re = void 0;
2732
- try {
2733
- for (var U = V.keys()[Symbol.iterator](), W; !(H = (W = U.next()).done); H = !0) {
2734
- var G = W.value;
2735
- te(G);
2736
- }
2737
- } catch (e) {
2738
- ne = !0, re = e;
2739
- } finally {
2740
- try {
2741
- !H && U.return && U.return();
2742
- } finally {
2743
- if (ne) throw re;
2744
- }
2745
- }
2746
- var ie = function(e) {
2747
- i.get(e) ? i.get(e).forEach(function(t) {
2748
- u[c.get(t)] = ee.get(e);
2749
- }) : u[c.get(e)] = ee.get(e);
2750
- }, K = !0, q = !1, ae = void 0;
2751
- try {
2752
- for (var J = ee.keys()[Symbol.iterator](), Y; !(K = (Y = J.next()).done); K = !0) {
2753
- var G = Y.value;
2754
- ie(G);
2755
- }
2756
- } catch (e) {
2757
- q = !0, ae = e;
2758
- } finally {
2759
- try {
2760
- !K && J.return && J.return();
2761
- } finally {
2762
- if (q) throw ae;
2763
- }
2764
- }
2765
- })();
2766
- }
2767
- for (var Y = 0; Y < d.length; Y++) {
2768
- var X = d[Y];
2769
- X.getChild() ?? X.setCenter(l[c.get(X.id)], u[c.get(X.id)]);
2770
- }
2771
- }, e.exports = c;
2772
- }),
2773
- 551: ((t) => {
2774
- t.exports = e;
2775
- })
2776
- }, n = {};
2777
- function r(e) {
2778
- var i = n[e];
2779
- if (i !== void 0) return i.exports;
2780
- var a = n[e] = { exports: {} };
2781
- return t[e](a, a.exports, r), a.exports;
2782
- }
2783
- return r(45);
2784
- })();
2785
- });
2786
- })), k = /* @__PURE__ */ r((/* @__PURE__ */ e(((e, t) => {
2787
- (function(n, r) {
2788
- typeof e == "object" && typeof t == "object" ? t.exports = r(O()) : typeof define == "function" && define.amd ? define(["cose-base"], r) : typeof e == "object" ? e.cytoscapeFcose = r(O()) : n.cytoscapeFcose = r(n.coseBase);
2789
- })(e, function(e) {
2790
- return (() => {
2791
- var t = {
2792
- 658: ((e) => {
2793
- e.exports = Object.assign == null ? function(e) {
2794
- return [...arguments].slice(1).forEach(function(t) {
2795
- Object.keys(t).forEach(function(n) {
2796
- return e[n] = t[n];
2797
- });
2798
- }), e;
2799
- } : Object.assign.bind(Object);
2800
- }),
2801
- 548: ((e, t, n) => {
2802
- var r = function() {
2803
- function e(e, t) {
2804
- var n = [], r = !0, i = !1, a = void 0;
2805
- try {
2806
- for (var o = e[Symbol.iterator](), s; !(r = (s = o.next()).done) && (n.push(s.value), !(t && n.length === t)); r = !0);
2807
- } catch (e) {
2808
- i = !0, a = e;
2809
- } finally {
2810
- try {
2811
- !r && o.return && o.return();
2812
- } finally {
2813
- if (i) throw a;
2814
- }
2815
- }
2816
- return n;
2817
- }
2818
- return function(t, n) {
2819
- if (Array.isArray(t)) return t;
2820
- if (Symbol.iterator in Object(t)) return e(t, n);
2821
- throw TypeError("Invalid attempt to destructure non-iterable instance");
2822
- };
2823
- }(), i = n(140).layoutBase.LinkedList, a = {};
2824
- a.getTopMostNodes = function(e) {
2825
- for (var t = {}, n = 0; n < e.length; n++) t[e[n].id()] = !0;
2826
- return e.filter(function(e, n) {
2827
- typeof e == "number" && (e = n);
2828
- for (var r = e.parent()[0]; r != null;) {
2829
- if (t[r.id()]) return !1;
2830
- r = r.parent()[0];
2831
- }
2832
- return !0;
2833
- });
2834
- }, a.connectComponents = function(e, t, n, r) {
2835
- var a = new i(), o = /* @__PURE__ */ new Set(), s = [], c = void 0, l = void 0, u = void 0, d = !1, f = 1, p = [], m = [], h = function() {
2836
- var r = e.collection();
2837
- m.push(r);
2838
- var i = n[0], h = e.collection();
2839
- h.merge(i).merge(i.descendants().intersection(t)), s.push(i), h.forEach(function(e) {
2840
- a.push(e), o.add(e), r.merge(e);
2841
- });
2842
- for (var g = function() {
2843
- i = a.shift();
2844
- var l = e.collection();
2845
- i.neighborhood().nodes().forEach(function(e) {
2846
- t.intersection(i.edgesWith(e)).length > 0 && l.merge(e);
2847
- });
2848
- for (var u = 0; u < l.length; u++) {
2849
- var d = l[u];
2850
- c = n.intersection(d.union(d.ancestors())), c != null && !o.has(c[0]) && c.union(c.descendants()).forEach(function(e) {
2851
- a.push(e), o.add(e), r.merge(e), n.has(e) && s.push(e);
2852
- });
2853
- }
2854
- }; a.length != 0;) g();
2855
- if (r.forEach(function(e) {
2856
- t.intersection(e.connectedEdges()).forEach(function(e) {
2857
- r.has(e.source()) && r.has(e.target()) && r.merge(e);
2858
- });
2859
- }), s.length == n.length && (d = !0), !d || d && f > 1) {
2860
- l = s[0], u = l.connectedEdges().length, s.forEach(function(e) {
2861
- e.connectedEdges().length < u && (u = e.connectedEdges().length, l = e);
2862
- }), p.push(l.id());
2863
- var _ = e.collection();
2864
- _.merge(s[0]), s.forEach(function(e) {
2865
- _.merge(e);
2866
- }), s = [], n = n.difference(_), f++;
2867
- }
2868
- };
2869
- do
2870
- h();
2871
- while (!d);
2872
- return r && p.length > 0 && r.set("dummy" + (r.size + 1), p), m;
2873
- }, a.relocateComponent = function(e, t, n) {
2874
- if (!n.fixedNodeConstraint) {
2875
- var i = Infinity, a = -Infinity, o = Infinity, s = -Infinity;
2876
- if (n.quality == "draft") {
2877
- var c = !0, l = !1, u = void 0;
2878
- try {
2879
- for (var d = t.nodeIndexes[Symbol.iterator](), f; !(c = (f = d.next()).done); c = !0) {
2880
- var p = f.value, m = r(p, 2), h = m[0], g = m[1], _ = n.cy.getElementById(h);
2881
- if (_) {
2882
- var v = _.boundingBox(), y = t.xCoords[g] - v.w / 2, b = t.xCoords[g] + v.w / 2, x = t.yCoords[g] - v.h / 2, S = t.yCoords[g] + v.h / 2;
2883
- y < i && (i = y), b > a && (a = b), x < o && (o = x), S > s && (s = S);
2884
- }
2885
- }
2886
- } catch (e) {
2887
- l = !0, u = e;
2888
- } finally {
2889
- try {
2890
- !c && d.return && d.return();
2891
- } finally {
2892
- if (l) throw u;
2893
- }
2894
- }
2895
- var C = e.x - (a + i) / 2, w = e.y - (s + o) / 2;
2896
- t.xCoords = t.xCoords.map(function(e) {
2897
- return e + C;
2898
- }), t.yCoords = t.yCoords.map(function(e) {
2899
- return e + w;
2900
- });
2901
- } else {
2902
- Object.keys(t).forEach(function(e) {
2903
- var n = t[e], r = n.getRect().x, c = n.getRect().x + n.getRect().width, l = n.getRect().y, u = n.getRect().y + n.getRect().height;
2904
- r < i && (i = r), c > a && (a = c), l < o && (o = l), u > s && (s = u);
2905
- });
2906
- var T = e.x - (a + i) / 2, E = e.y - (s + o) / 2;
2907
- Object.keys(t).forEach(function(e) {
2908
- var n = t[e];
2909
- n.setCenter(n.getCenterX() + T, n.getCenterY() + E);
2910
- });
2911
- }
2912
- }
2913
- }, a.calcBoundingBox = function(e, t, n, r) {
2914
- for (var i = 2 ** 53 - 1, a = -(2 ** 53 - 1), o = 2 ** 53 - 1, s = -(2 ** 53 - 1), c = void 0, l = void 0, u = void 0, d = void 0, f = e.descendants().not(":parent"), p = f.length, m = 0; m < p; m++) {
2915
- var h = f[m];
2916
- c = t[r.get(h.id())] - h.width() / 2, l = t[r.get(h.id())] + h.width() / 2, u = n[r.get(h.id())] - h.height() / 2, d = n[r.get(h.id())] + h.height() / 2, i > c && (i = c), a < l && (a = l), o > u && (o = u), s < d && (s = d);
2917
- }
2918
- var g = {};
2919
- return g.topLeftX = i, g.topLeftY = o, g.width = a - i, g.height = s - o, g;
2920
- }, a.calcParentsWithoutChildren = function(e, t) {
2921
- var n = e.collection();
2922
- return t.nodes(":parent").forEach(function(e) {
2923
- var t = !1;
2924
- e.children().forEach(function(e) {
2925
- e.css("display") != "none" && (t = !0);
2926
- }), t || n.merge(e);
2927
- }), n;
2928
- }, e.exports = a;
2929
- }),
2930
- 816: ((e, t, n) => {
2931
- var r = n(548), i = n(140).CoSELayout, a = n(140).CoSENode, o = n(140).layoutBase.PointD, s = n(140).layoutBase.DimensionD, c = n(140).layoutBase.LayoutConstants, l = n(140).layoutBase.FDLayoutConstants, u = n(140).CoSEConstants;
2932
- e.exports = { coseLayout: function(e, t) {
2933
- var n = e.cy, d = e.eles, f = d.nodes(), p = d.edges(), m = void 0, h = void 0, g = void 0, _ = {};
2934
- e.randomize && (m = t.nodeIndexes, h = t.xCoords, g = t.yCoords);
2935
- var v = function(e) {
2936
- return typeof e == "function";
2937
- }, y = function(e, t) {
2938
- return v(e) ? e(t) : e;
2939
- }, b = r.calcParentsWithoutChildren(n, d), x = function e(t, n, i, c) {
2940
- for (var l = n.length, u = 0; u < l; u++) {
2941
- var d = n[u], f = null;
2942
- d.intersection(b).length == 0 && (f = d.children());
2943
- var p = void 0, v = d.layoutDimensions({ nodeDimensionsIncludeLabels: c.nodeDimensionsIncludeLabels });
2944
- if (d.outerWidth() != null && d.outerHeight() != null) {
2945
- if (c.randomize) {
2946
- if (!d.isParent()) p = t.add(new a(i.graphManager, new o(h[m.get(d.id())] - v.w / 2, g[m.get(d.id())] - v.h / 2), new s(parseFloat(v.w), parseFloat(v.h))));
2947
- else {
2948
- var x = r.calcBoundingBox(d, h, g, m);
2949
- p = d.intersection(b).length == 0 ? t.add(new a(i.graphManager, new o(x.topLeftX, x.topLeftY), new s(x.width, x.height))) : t.add(new a(i.graphManager, new o(x.topLeftX, x.topLeftY), new s(parseFloat(v.w), parseFloat(v.h))));
2950
- }
2951
- } else p = t.add(new a(i.graphManager, new o(d.position("x") - v.w / 2, d.position("y") - v.h / 2), new s(parseFloat(v.w), parseFloat(v.h))));
2952
- } else p = t.add(new a(this.graphManager));
2953
- if (p.id = d.data("id"), p.nodeRepulsion = y(c.nodeRepulsion, d), p.paddingLeft = parseInt(d.css("padding")), p.paddingTop = parseInt(d.css("padding")), p.paddingRight = parseInt(d.css("padding")), p.paddingBottom = parseInt(d.css("padding")), c.nodeDimensionsIncludeLabels && (p.labelWidth = d.boundingBox({
2954
- includeLabels: !0,
2955
- includeNodes: !1,
2956
- includeOverlays: !1
2957
- }).w, p.labelHeight = d.boundingBox({
2958
- includeLabels: !0,
2959
- includeNodes: !1,
2960
- includeOverlays: !1
2961
- }).h, p.labelPosVertical = d.css("text-valign"), p.labelPosHorizontal = d.css("text-halign")), _[d.data("id")] = p, isNaN(p.rect.x) && (p.rect.x = 0), isNaN(p.rect.y) && (p.rect.y = 0), f != null && f.length > 0) {
2962
- var S = void 0;
2963
- S = i.getGraphManager().add(i.newGraph(), p), e(S, f, i, c);
2964
- }
2965
- }
2966
- }, S = function(t, n, r) {
2967
- for (var i = 0, a = 0, o = 0; o < r.length; o++) {
2968
- var s = r[o], c = _[s.data("source")], d = _[s.data("target")];
2969
- if (c && d && c !== d && c.getEdgesBetween(d).length == 0) {
2970
- var f = n.add(t.newEdge(), c, d);
2971
- f.id = s.id(), f.idealLength = y(e.idealEdgeLength, s), f.edgeElasticity = y(e.edgeElasticity, s), i += f.idealLength, a++;
2972
- }
2973
- }
2974
- e.idealEdgeLength != null && (u.DEFAULT_EDGE_LENGTH = l.DEFAULT_EDGE_LENGTH = a > 0 ? i / a : v(e.idealEdgeLength) ? 50 : e.idealEdgeLength, u.MIN_REPULSION_DIST = l.MIN_REPULSION_DIST = l.DEFAULT_EDGE_LENGTH / 10, u.DEFAULT_RADIAL_SEPARATION = l.DEFAULT_EDGE_LENGTH);
2975
- }, C = function(e, t) {
2976
- t.fixedNodeConstraint && (e.constraints.fixedNodeConstraint = t.fixedNodeConstraint), t.alignmentConstraint && (e.constraints.alignmentConstraint = t.alignmentConstraint), t.relativePlacementConstraint && (e.constraints.relativePlacementConstraint = t.relativePlacementConstraint);
2977
- };
2978
- e.nestingFactor != null && (u.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR = l.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR = e.nestingFactor), e.gravity != null && (u.DEFAULT_GRAVITY_STRENGTH = l.DEFAULT_GRAVITY_STRENGTH = e.gravity), e.numIter != null && (u.MAX_ITERATIONS = l.MAX_ITERATIONS = e.numIter), e.gravityRange != null && (u.DEFAULT_GRAVITY_RANGE_FACTOR = l.DEFAULT_GRAVITY_RANGE_FACTOR = e.gravityRange), e.gravityCompound != null && (u.DEFAULT_COMPOUND_GRAVITY_STRENGTH = l.DEFAULT_COMPOUND_GRAVITY_STRENGTH = e.gravityCompound), e.gravityRangeCompound != null && (u.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR = l.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR = e.gravityRangeCompound), e.initialEnergyOnIncremental != null && (u.DEFAULT_COOLING_FACTOR_INCREMENTAL = l.DEFAULT_COOLING_FACTOR_INCREMENTAL = e.initialEnergyOnIncremental), e.tilingCompareBy != null && (u.TILING_COMPARE_BY = e.tilingCompareBy), c.QUALITY = e.quality == "proof" ? 2 : 0, u.NODE_DIMENSIONS_INCLUDE_LABELS = l.NODE_DIMENSIONS_INCLUDE_LABELS = c.NODE_DIMENSIONS_INCLUDE_LABELS = e.nodeDimensionsIncludeLabels, u.DEFAULT_INCREMENTAL = l.DEFAULT_INCREMENTAL = c.DEFAULT_INCREMENTAL = !e.randomize, u.ANIMATE = l.ANIMATE = c.ANIMATE = e.animate, u.TILE = e.tile, u.TILING_PADDING_VERTICAL = typeof e.tilingPaddingVertical == "function" ? e.tilingPaddingVertical.call() : e.tilingPaddingVertical, u.TILING_PADDING_HORIZONTAL = typeof e.tilingPaddingHorizontal == "function" ? e.tilingPaddingHorizontal.call() : e.tilingPaddingHorizontal, u.DEFAULT_INCREMENTAL = l.DEFAULT_INCREMENTAL = c.DEFAULT_INCREMENTAL = !0, u.PURE_INCREMENTAL = !e.randomize, c.DEFAULT_UNIFORM_LEAF_NODE_SIZES = e.uniformNodeDimensions, e.step == "transformed" && (u.TRANSFORM_ON_CONSTRAINT_HANDLING = !0, u.ENFORCE_CONSTRAINTS = !1, u.APPLY_LAYOUT = !1), e.step == "enforced" && (u.TRANSFORM_ON_CONSTRAINT_HANDLING = !1, u.ENFORCE_CONSTRAINTS = !0, u.APPLY_LAYOUT = !1), e.step == "cose" && (u.TRANSFORM_ON_CONSTRAINT_HANDLING = !1, u.ENFORCE_CONSTRAINTS = !1, u.APPLY_LAYOUT = !0), e.step == "all" && (u.TRANSFORM_ON_CONSTRAINT_HANDLING = !!e.randomize, u.ENFORCE_CONSTRAINTS = !0, u.APPLY_LAYOUT = !0), u.TREE_REDUCTION_ON_INCREMENTAL = !(e.fixedNodeConstraint || e.alignmentConstraint || e.relativePlacementConstraint);
2979
- var w = new i(), T = w.newGraphManager();
2980
- return x(T.addRoot(), r.getTopMostNodes(f), w, e), S(w, T, p), C(w, e), w.runLayout(), _;
2981
- } };
2982
- }),
2983
- 212: ((e, t, n) => {
2984
- var r = function() {
2985
- function e(e, t) {
2986
- for (var n = 0; n < t.length; n++) {
2987
- var r = t[n];
2988
- r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(e, r.key, r);
2989
- }
2990
- }
2991
- return function(t, n, r) {
2992
- return n && e(t.prototype, n), r && e(t, r), t;
2993
- };
2994
- }();
2995
- function i(e, t) {
2996
- if (!(e instanceof t)) throw TypeError("Cannot call a class as a function");
2997
- }
2998
- var a = n(658), o = n(548), s = n(657).spectralLayout, c = n(816).coseLayout, l = Object.freeze({
2999
- quality: "default",
3000
- randomize: !0,
3001
- animate: !0,
3002
- animationDuration: 1e3,
3003
- animationEasing: void 0,
3004
- fit: !0,
3005
- padding: 30,
3006
- nodeDimensionsIncludeLabels: !1,
3007
- uniformNodeDimensions: !1,
3008
- packComponents: !0,
3009
- step: "all",
3010
- samplingType: !0,
3011
- sampleSize: 25,
3012
- nodeSeparation: 75,
3013
- piTol: 1e-7,
3014
- nodeRepulsion: function(e) {
3015
- return 4500;
3016
- },
3017
- idealEdgeLength: function(e) {
3018
- return 50;
3019
- },
3020
- edgeElasticity: function(e) {
3021
- return .45;
3022
- },
3023
- nestingFactor: .1,
3024
- gravity: .25,
3025
- numIter: 2500,
3026
- tile: !0,
3027
- tilingCompareBy: void 0,
3028
- tilingPaddingVertical: 10,
3029
- tilingPaddingHorizontal: 10,
3030
- gravityRangeCompound: 1.5,
3031
- gravityCompound: 1,
3032
- gravityRange: 3.8,
3033
- initialEnergyOnIncremental: .3,
3034
- fixedNodeConstraint: void 0,
3035
- alignmentConstraint: void 0,
3036
- relativePlacementConstraint: void 0,
3037
- ready: function() {},
3038
- stop: function() {}
3039
- });
3040
- e.exports = function() {
3041
- function e(t) {
3042
- i(this, e), this.options = a({}, l, t);
3043
- }
3044
- return r(e, [{
3045
- key: "run",
3046
- value: function() {
3047
- var e = this, t = this.options, n = t.cy, r = t.eles, i = [], a = [], l = void 0, u = [];
3048
- t.fixedNodeConstraint && (!Array.isArray(t.fixedNodeConstraint) || t.fixedNodeConstraint.length == 0) && (t.fixedNodeConstraint = void 0), t.alignmentConstraint && (t.alignmentConstraint.vertical && (!Array.isArray(t.alignmentConstraint.vertical) || t.alignmentConstraint.vertical.length == 0) && (t.alignmentConstraint.vertical = void 0), t.alignmentConstraint.horizontal && (!Array.isArray(t.alignmentConstraint.horizontal) || t.alignmentConstraint.horizontal.length == 0) && (t.alignmentConstraint.horizontal = void 0)), t.relativePlacementConstraint && (!Array.isArray(t.relativePlacementConstraint) || t.relativePlacementConstraint.length == 0) && (t.relativePlacementConstraint = void 0), (t.fixedNodeConstraint || t.alignmentConstraint || t.relativePlacementConstraint) && (t.tile = !1, t.packComponents = !1);
3049
- var d = void 0, f = !1;
3050
- if (n.layoutUtilities && t.packComponents && (d = n.layoutUtilities("get"), d ||= n.layoutUtilities(), f = !0), r.nodes().length > 0) {
3051
- if (f) {
3052
- var p = o.getTopMostNodes(t.eles.nodes());
3053
- if (l = o.connectComponents(n, t.eles, p), l.forEach(function(e) {
3054
- var t = e.boundingBox();
3055
- u.push({
3056
- x: t.x1 + t.w / 2,
3057
- y: t.y1 + t.h / 2
3058
- });
3059
- }), t.randomize && l.forEach(function(e) {
3060
- t.eles = e, i.push(s(t));
3061
- }), t.quality == "default" || t.quality == "proof") {
3062
- var m = n.collection();
3063
- if (t.tile) {
3064
- var h = /* @__PURE__ */ new Map(), g = [], _ = [], v = 0, y = {
3065
- nodeIndexes: h,
3066
- xCoords: g,
3067
- yCoords: _
3068
- }, b = [];
3069
- if (l.forEach(function(e, t) {
3070
- e.edges().length == 0 && (e.nodes().forEach(function(t, n) {
3071
- m.merge(e.nodes()[n]), t.isParent() || (y.nodeIndexes.set(e.nodes()[n].id(), v++), y.xCoords.push(e.nodes()[0].position().x), y.yCoords.push(e.nodes()[0].position().y));
3072
- }), b.push(t));
3073
- }), m.length > 1) {
3074
- var x = m.boundingBox();
3075
- u.push({
3076
- x: x.x1 + x.w / 2,
3077
- y: x.y1 + x.h / 2
3078
- }), l.push(m), i.push(y);
3079
- for (var S = b.length - 1; S >= 0; S--) l.splice(b[S], 1), i.splice(b[S], 1), u.splice(b[S], 1);
3080
- }
3081
- }
3082
- l.forEach(function(e, n) {
3083
- t.eles = e, a.push(c(t, i[n])), o.relocateComponent(u[n], a[n], t);
3084
- });
3085
- } else l.forEach(function(e, n) {
3086
- o.relocateComponent(u[n], i[n], t);
3087
- });
3088
- var C = /* @__PURE__ */ new Set();
3089
- if (l.length > 1) {
3090
- var w = [], T = r.filter(function(e) {
3091
- return e.css("display") == "none";
3092
- });
3093
- l.forEach(function(e, n) {
3094
- var r = void 0;
3095
- if (t.quality == "draft" && (r = i[n].nodeIndexes), e.nodes().not(T).length > 0) {
3096
- var s = {};
3097
- s.edges = [], s.nodes = [];
3098
- var c = void 0;
3099
- e.nodes().not(T).forEach(function(e) {
3100
- if (t.quality == "draft") {
3101
- if (!e.isParent()) c = r.get(e.id()), s.nodes.push({
3102
- x: i[n].xCoords[c] - e.boundingbox().w / 2,
3103
- y: i[n].yCoords[c] - e.boundingbox().h / 2,
3104
- width: e.boundingbox().w,
3105
- height: e.boundingbox().h
3106
- });
3107
- else {
3108
- var l = o.calcBoundingBox(e, i[n].xCoords, i[n].yCoords, r);
3109
- s.nodes.push({
3110
- x: l.topLeftX,
3111
- y: l.topLeftY,
3112
- width: l.width,
3113
- height: l.height
3114
- });
3115
- }
3116
- } else a[n][e.id()] && s.nodes.push({
3117
- x: a[n][e.id()].getLeft(),
3118
- y: a[n][e.id()].getTop(),
3119
- width: a[n][e.id()].getWidth(),
3120
- height: a[n][e.id()].getHeight()
3121
- });
3122
- }), e.edges().forEach(function(e) {
3123
- var c = e.source(), l = e.target();
3124
- if (c.css("display") != "none" && l.css("display") != "none") {
3125
- if (t.quality == "draft") {
3126
- var u = r.get(c.id()), d = r.get(l.id()), f = [], p = [];
3127
- if (c.isParent()) {
3128
- var m = o.calcBoundingBox(c, i[n].xCoords, i[n].yCoords, r);
3129
- f.push(m.topLeftX + m.width / 2), f.push(m.topLeftY + m.height / 2);
3130
- } else f.push(i[n].xCoords[u]), f.push(i[n].yCoords[u]);
3131
- if (l.isParent()) {
3132
- var h = o.calcBoundingBox(l, i[n].xCoords, i[n].yCoords, r);
3133
- p.push(h.topLeftX + h.width / 2), p.push(h.topLeftY + h.height / 2);
3134
- } else p.push(i[n].xCoords[d]), p.push(i[n].yCoords[d]);
3135
- s.edges.push({
3136
- startX: f[0],
3137
- startY: f[1],
3138
- endX: p[0],
3139
- endY: p[1]
3140
- });
3141
- } else a[n][c.id()] && a[n][l.id()] && s.edges.push({
3142
- startX: a[n][c.id()].getCenterX(),
3143
- startY: a[n][c.id()].getCenterY(),
3144
- endX: a[n][l.id()].getCenterX(),
3145
- endY: a[n][l.id()].getCenterY()
3146
- });
3147
- }
3148
- }), s.nodes.length > 0 && (w.push(s), C.add(n));
3149
- }
3150
- });
3151
- var E = d.packComponents(w, t.randomize).shifts;
3152
- if (t.quality == "draft") i.forEach(function(e, t) {
3153
- var n = e.xCoords.map(function(e) {
3154
- return e + E[t].dx;
3155
- }), r = e.yCoords.map(function(e) {
3156
- return e + E[t].dy;
3157
- });
3158
- e.xCoords = n, e.yCoords = r;
3159
- });
3160
- else {
3161
- var D = 0;
3162
- C.forEach(function(e) {
3163
- Object.keys(a[e]).forEach(function(t) {
3164
- var n = a[e][t];
3165
- n.setCenter(n.getCenterX() + E[D].dx, n.getCenterY() + E[D].dy);
3166
- }), D++;
3167
- });
3168
- }
3169
- }
3170
- } else {
3171
- var O = t.eles.boundingBox();
3172
- if (u.push({
3173
- x: O.x1 + O.w / 2,
3174
- y: O.y1 + O.h / 2
3175
- }), t.randomize) {
3176
- var k = s(t);
3177
- i.push(k);
3178
- }
3179
- t.quality == "default" || t.quality == "proof" ? (a.push(c(t, i[0])), o.relocateComponent(u[0], a[0], t)) : o.relocateComponent(u[0], i[0], t);
3180
- }
3181
- }
3182
- var A = function(e, n) {
3183
- if (t.quality == "default" || t.quality == "proof") {
3184
- typeof e == "number" && (e = n);
3185
- var r = void 0, o = void 0, s = e.data("id");
3186
- return a.forEach(function(e) {
3187
- s in e && (r = {
3188
- x: e[s].getRect().getCenterX(),
3189
- y: e[s].getRect().getCenterY()
3190
- }, o = e[s]);
3191
- }), t.nodeDimensionsIncludeLabels && (o.labelWidth && (o.labelPosHorizontal == "left" ? r.x += o.labelWidth / 2 : o.labelPosHorizontal == "right" && (r.x -= o.labelWidth / 2)), o.labelHeight && (o.labelPosVertical == "top" ? r.y += o.labelHeight / 2 : o.labelPosVertical == "bottom" && (r.y -= o.labelHeight / 2))), r ??= {
3192
- x: e.position("x"),
3193
- y: e.position("y")
3194
- }, {
3195
- x: r.x,
3196
- y: r.y
3197
- };
3198
- }
3199
- var c = void 0;
3200
- return i.forEach(function(t) {
3201
- var n = t.nodeIndexes.get(e.id());
3202
- n != null && (c = {
3203
- x: t.xCoords[n],
3204
- y: t.yCoords[n]
3205
- });
3206
- }), c ??= {
3207
- x: e.position("x"),
3208
- y: e.position("y")
3209
- }, {
3210
- x: c.x,
3211
- y: c.y
3212
- };
3213
- };
3214
- if (t.quality == "default" || t.quality == "proof" || t.randomize) {
3215
- var j = o.calcParentsWithoutChildren(n, r), M = r.filter(function(e) {
3216
- return e.css("display") == "none";
3217
- });
3218
- t.eles = r.not(M), r.nodes().not(":parent").not(M).layoutPositions(e, t, A), j.length > 0 && j.forEach(function(e) {
3219
- e.position(A(e));
3220
- });
3221
- } else console.log("If randomize option is set to false, then quality option must be 'default' or 'proof'.");
3222
- }
3223
- }]), e;
3224
- }();
3225
- }),
3226
- 657: ((e, t, n) => {
3227
- var r = n(548), i = n(140).layoutBase.Matrix, a = n(140).layoutBase.SVD;
3228
- e.exports = { spectralLayout: function(e) {
3229
- var t = e.cy, n = e.eles, o = n.nodes(), s = n.nodes(":parent"), c = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map(), u = /* @__PURE__ */ new Map(), d = [], f = [], p = [], m = [], h = [], g = [], _ = [], v = [], y = void 0, b = 1e8, x = 1e-9, S = e.piTol, C = e.samplingType, w = e.nodeSeparation, T = void 0, E = function() {
3230
- for (var e = 0, t = 0, n = !1; t < T;) {
3231
- e = Math.floor(Math.random() * y), n = !1;
3232
- for (var r = 0; r < t; r++) if (m[r] == e) {
3233
- n = !0;
3234
- break;
3235
- }
3236
- if (!n) m[t] = e, t++;
3237
- else continue;
3238
- }
3239
- }, D = function(e, t, n) {
3240
- for (var r = [], i = 0, a = 0, o = 0, s = void 0, c = [], u = 0, f = 1, p = 0; p < y; p++) c[p] = b;
3241
- for (r[a] = e, c[e] = 0; a >= i;) {
3242
- o = r[i++];
3243
- for (var m = d[o], _ = 0; _ < m.length; _++) s = l.get(m[_]), c[s] == b && (c[s] = c[o] + 1, r[++a] = s);
3244
- g[o][t] = c[o] * w;
3245
- }
3246
- if (n) {
3247
- for (var v = 0; v < y; v++) g[v][t] < h[v] && (h[v] = g[v][t]);
3248
- for (var x = 0; x < y; x++) h[x] > u && (u = h[x], f = x);
3249
- }
3250
- return f;
3251
- }, O = function(e) {
3252
- var t = void 0;
3253
- if (e) {
3254
- t = Math.floor(Math.random() * y);
3255
- for (var n = 0; n < y; n++) h[n] = b;
3256
- for (var r = 0; r < T; r++) m[r] = t, t = D(t, r, e);
3257
- } else {
3258
- E();
3259
- for (var i = 0; i < T; i++) D(m[i], i, e, !1);
3260
- }
3261
- for (var a = 0; a < y; a++) for (var o = 0; o < T; o++) g[a][o] *= g[a][o];
3262
- for (var s = 0; s < T; s++) _[s] = [];
3263
- for (var c = 0; c < T; c++) for (var l = 0; l < T; l++) _[c][l] = g[m[l]][c];
3264
- }, k = function() {
3265
- for (var e = a.svd(_), t = e.S, n = e.U, r = e.V, o = t[0] * t[0] * t[0], s = [], c = 0; c < T; c++) {
3266
- s[c] = [];
3267
- for (var l = 0; l < T; l++) s[c][l] = 0, c == l && (s[c][l] = t[c] / (t[c] * t[c] + o / (t[c] * t[c])));
3268
- }
3269
- v = i.multMat(i.multMat(r, s), i.transpose(n));
3270
- }, A = function() {
3271
- for (var e = void 0, t = void 0, n = [], r = [], a = [], o = [], s = 0; s < y; s++) n[s] = Math.random(), r[s] = Math.random();
3272
- n = i.normalize(n), r = i.normalize(r);
3273
- for (var c = 0, l = x, u = x, d = void 0;;) {
3274
- c++;
3275
- for (var m = 0; m < y; m++) a[m] = n[m];
3276
- if (n = i.multGamma(i.multL(i.multGamma(a), g, v)), e = i.dotProduct(a, n), n = i.normalize(n), l = i.dotProduct(a, n), d = Math.abs(l / u), d <= 1 + S && d >= 1) break;
3277
- u = l;
3278
- }
3279
- for (var h = 0; h < y; h++) a[h] = n[h];
3280
- for (c = 0, u = x;;) {
3281
- c++;
3282
- for (var _ = 0; _ < y; _++) o[_] = r[_];
3283
- if (o = i.minusOp(o, i.multCons(a, i.dotProduct(a, o))), r = i.multGamma(i.multL(i.multGamma(o), g, v)), t = i.dotProduct(o, r), r = i.normalize(r), l = i.dotProduct(o, r), d = Math.abs(l / u), d <= 1 + S && d >= 1) break;
3284
- u = l;
3285
- }
3286
- for (var b = 0; b < y; b++) o[b] = r[b];
3287
- f = i.multCons(a, Math.sqrt(Math.abs(e))), p = i.multCons(o, Math.sqrt(Math.abs(t)));
3288
- };
3289
- r.connectComponents(t, n, r.getTopMostNodes(o), c), s.forEach(function(e) {
3290
- r.connectComponents(t, n, r.getTopMostNodes(e.descendants().intersection(n)), c);
3291
- });
3292
- for (var j = 0, M = 0; M < o.length; M++) o[M].isParent() || l.set(o[M].id(), j++);
3293
- var N = !0, P = !1, F = void 0;
3294
- try {
3295
- for (var I = c.keys()[Symbol.iterator](), L; !(N = (L = I.next()).done); N = !0) {
3296
- var R = L.value;
3297
- l.set(R, j++);
3298
- }
3299
- } catch (e) {
3300
- P = !0, F = e;
3301
- } finally {
3302
- try {
3303
- !N && I.return && I.return();
3304
- } finally {
3305
- if (P) throw F;
3306
- }
3307
- }
3308
- for (var z = 0; z < l.size; z++) d[z] = [];
3309
- s.forEach(function(e) {
3310
- for (var t = e.children().intersection(n); t.nodes(":childless").length == 0;) t = t.nodes()[0].children().intersection(n);
3311
- var r = 0, i = t.nodes(":childless")[0].connectedEdges().length;
3312
- t.nodes(":childless").forEach(function(e, t) {
3313
- e.connectedEdges().length < i && (i = e.connectedEdges().length, r = t);
3314
- }), u.set(e.id(), t.nodes(":childless")[r].id());
3315
- }), o.forEach(function(e) {
3316
- var t = void 0;
3317
- t = e.isParent() ? l.get(u.get(e.id())) : l.get(e.id()), e.neighborhood().nodes().forEach(function(r) {
3318
- n.intersection(e.edgesWith(r)).length > 0 && (r.isParent() ? d[t].push(u.get(r.id())) : d[t].push(r.id()));
3319
- });
3320
- });
3321
- var B = function(e) {
3322
- var n = l.get(e), r = void 0;
3323
- c.get(e).forEach(function(i) {
3324
- r = t.getElementById(i).isParent() ? u.get(i) : i, d[n].push(r), d[l.get(r)].push(e);
3325
- });
3326
- }, V = !0, ee = !1, te = void 0;
3327
- try {
3328
- for (var H = c.keys()[Symbol.iterator](), ne; !(V = (ne = H.next()).done); V = !0) {
3329
- var re = ne.value;
3330
- B(re);
3331
- }
3332
- } catch (e) {
3333
- ee = !0, te = e;
3334
- } finally {
3335
- try {
3336
- !V && H.return && H.return();
3337
- } finally {
3338
- if (ee) throw te;
3339
- }
3340
- }
3341
- y = l.size;
3342
- var U = void 0;
3343
- if (y > 2) {
3344
- T = y < e.sampleSize ? y : e.sampleSize;
3345
- for (var W = 0; W < y; W++) g[W] = [];
3346
- for (var G = 0; G < T; G++) v[G] = [];
3347
- return e.quality == "draft" || e.step == "all" ? (O(C), k(), A(), U = {
3348
- nodeIndexes: l,
3349
- xCoords: f,
3350
- yCoords: p
3351
- }) : (l.forEach(function(e, n) {
3352
- f.push(t.getElementById(n).position("x")), p.push(t.getElementById(n).position("y"));
3353
- }), U = {
3354
- nodeIndexes: l,
3355
- xCoords: f,
3356
- yCoords: p
3357
- }), U;
3358
- }
3359
- var ie = l.keys(), K = t.getElementById(ie.next().value), q = K.position(), ae = K.outerWidth();
3360
- if (f.push(q.x), p.push(q.y), y == 2) {
3361
- var J = t.getElementById(ie.next().value).outerWidth();
3362
- f.push(q.x + ae / 2 + J / 2 + e.idealEdgeLength), p.push(q.y);
3363
- }
3364
- return U = {
3365
- nodeIndexes: l,
3366
- xCoords: f,
3367
- yCoords: p
3368
- }, U;
3369
- } };
3370
- }),
3371
- 579: ((e, t, n) => {
3372
- var r = n(212), i = function(e) {
3373
- e && e("layout", "fcose", r);
3374
- };
3375
- typeof cytoscape < "u" && i(cytoscape), e.exports = i;
3376
- }),
3377
- 140: ((t) => {
3378
- t.exports = e;
3379
- })
3380
- }, n = {};
3381
- function r(e) {
3382
- var i = n[e];
3383
- if (i !== void 0) return i.exports;
3384
- var a = n[e] = { exports: {} };
3385
- return t[e](a, a.exports, r), a.exports;
3386
- }
3387
- return r(579);
3388
- })();
3389
- });
3390
- })))(), 1), A = {
3391
- L: "left",
3392
- R: "right",
3393
- T: "top",
3394
- B: "bottom"
3395
- }, j = {
3396
- L: /* @__PURE__ */ i((e) => `${e},${e / 2} 0,${e} 0,0`, "L"),
3397
- R: /* @__PURE__ */ i((e) => `0,${e / 2} ${e},0 ${e},${e}`, "R"),
3398
- T: /* @__PURE__ */ i((e) => `0,0 ${e},0 ${e / 2},${e}`, "T"),
3399
- B: /* @__PURE__ */ i((e) => `${e / 2},0 ${e},${e} 0,${e}`, "B")
3400
- }, M = {
3401
- L: /* @__PURE__ */ i((e, t) => e - t + 2, "L"),
3402
- R: /* @__PURE__ */ i((e, t) => e - 2, "R"),
3403
- T: /* @__PURE__ */ i((e, t) => e - t + 2, "T"),
3404
- B: /* @__PURE__ */ i((e, t) => e - 2, "B")
3405
- }, N = /* @__PURE__ */ i(function(e) {
3406
- return F(e) ? e === "L" ? "R" : "L" : e === "T" ? "B" : "T";
3407
- }, "getOppositeArchitectureDirection"), P = /* @__PURE__ */ i(function(e) {
3408
- let t = e;
3409
- return t === "L" || t === "R" || t === "T" || t === "B";
3410
- }, "isArchitectureDirection"), F = /* @__PURE__ */ i(function(e) {
3411
- let t = e;
3412
- return t === "L" || t === "R";
3413
- }, "isArchitectureDirectionX"), I = /* @__PURE__ */ i(function(e) {
3414
- let t = e;
3415
- return t === "T" || t === "B";
3416
- }, "isArchitectureDirectionY"), L = /* @__PURE__ */ i(function(e, t) {
3417
- let n = F(e) && I(t), r = I(e) && F(t);
3418
- return n || r;
3419
- }, "isArchitectureDirectionXY"), R = /* @__PURE__ */ i(function(e) {
3420
- let t = e[0], n = e[1], r = F(t) && I(n), i = I(t) && F(n);
3421
- return r || i;
3422
- }, "isArchitecturePairXY"), z = /* @__PURE__ */ i(function(e) {
3423
- return e !== "LL" && e !== "RR" && e !== "TT" && e !== "BB";
3424
- }, "isValidArchitectureDirectionPair"), B = /* @__PURE__ */ i(function(e, t) {
3425
- let n = `${e}${t}`;
3426
- return z(n) ? n : void 0;
3427
- }, "getArchitectureDirectionPair"), V = /* @__PURE__ */ i(function([e, t], n) {
3428
- let r = n[0], i = n[1];
3429
- return F(r) ? I(i) ? [e + (r === "L" ? -1 : 1), t + (i === "T" ? 1 : -1)] : [e + (r === "L" ? -1 : 1), t] : F(i) ? [e + (i === "L" ? 1 : -1), t + (r === "T" ? 1 : -1)] : [e, t + (r === "T" ? 1 : -1)];
3430
- }, "shiftPositionByArchitectureDirectionPair"), ee = /* @__PURE__ */ i(function(e) {
3431
- return e === "LT" || e === "TL" ? [1, 1] : e === "BL" || e === "LB" ? [1, -1] : e === "BR" || e === "RB" ? [-1, -1] : [-1, 1];
3432
- }, "getArchitectureDirectionXYFactors"), te = /* @__PURE__ */ i(function(e, t) {
3433
- return L(e, t) ? "bend" : F(e) ? "horizontal" : "vertical";
3434
- }, "getArchitectureDirectionAlignment"), H = /* @__PURE__ */ i(function(e) {
3435
- return e.type === "service";
3436
- }, "isArchitectureService"), ne = /* @__PURE__ */ i(function(e) {
3437
- return e.type === "junction";
3438
- }, "isArchitectureJunction"), re = /* @__PURE__ */ i((e, t) => {
3439
- let [n, r] = [e, t].sort();
3440
- return `${JSON.stringify(n)}-${JSON.stringify(r)}`;
3441
- }, "architectureGroupAlignmentKey"), U = /* @__PURE__ */ i((e) => e.data(), "edgeData"), W = /* @__PURE__ */ i((e) => e.data(), "nodeData"), G = d.architecture, ie = class {
3442
- constructor() {
3443
- this.nodes = /* @__PURE__ */ new Map(), this.groups = /* @__PURE__ */ new Map(), this.edges = [], this.layoutHints = [], this.registeredIds = /* @__PURE__ */ new Map(), this.elements = /* @__PURE__ */ new Map(), this.diagramId = "", this.setAccTitle = c, this.getAccTitle = h, this.setDiagramTitle = s, this.getDiagramTitle = p, this.getAccDescription = f, this.setAccDescription = a, this.clear();
3444
- }
3445
- static {
3446
- i(this, "ArchitectureDB");
3447
- }
3448
- setDiagramId(e) {
3449
- this.diagramId = e;
3450
- }
3451
- getDiagramId() {
3452
- return this.diagramId;
3453
- }
3454
- clear() {
3455
- this.nodes = /* @__PURE__ */ new Map(), this.groups = /* @__PURE__ */ new Map(), this.edges = [], this.layoutHints = [], this.registeredIds = /* @__PURE__ */ new Map(), this.dataStructures = void 0, this.elements = /* @__PURE__ */ new Map(), this.diagramId = "", l();
3456
- }
3457
- addService({ id: e, icon: t, in: n, title: r, iconText: i }) {
3458
- if (this.registeredIds.has(e)) throw Error(`The service id [${e}] is already in use by another ${this.registeredIds.get(e)}`);
3459
- if (n !== void 0) {
3460
- if (e === n) throw Error(`The service [${e}] cannot be placed within itself`);
3461
- if (!this.registeredIds.has(n)) throw Error(`The service [${e}]'s parent does not exist. Please make sure the parent is created before this service`);
3462
- if (this.registeredIds.get(n) === "node") throw Error(`The service [${e}]'s parent is not a group`);
3463
- }
3464
- this.registeredIds.set(e, "node"), this.nodes.set(e, {
3465
- id: e,
3466
- type: "service",
3467
- icon: t,
3468
- iconText: i,
3469
- title: r,
3470
- edges: [],
3471
- in: n
3472
- });
3473
- }
3474
- getServices() {
3475
- return [...this.nodes.values()].filter(H);
3476
- }
3477
- addJunction({ id: e, in: t }) {
3478
- if (this.registeredIds.has(e)) throw Error(`The junction id [${e}] is already in use by another ${this.registeredIds.get(e)}`);
3479
- if (t !== void 0) {
3480
- if (e === t) throw Error(`The junction [${e}] cannot be placed within itself`);
3481
- if (!this.registeredIds.has(t)) throw Error(`The junction [${e}]'s parent does not exist. Please make sure the parent is created before this junction`);
3482
- if (this.registeredIds.get(t) === "node") throw Error(`The junction [${e}]'s parent is not a group`);
3483
- }
3484
- this.registeredIds.set(e, "node"), this.nodes.set(e, {
3485
- id: e,
3486
- type: "junction",
3487
- edges: [],
3488
- in: t
3489
- });
3490
- }
3491
- getJunctions() {
3492
- return [...this.nodes.values()].filter(ne);
3493
- }
3494
- getNodes() {
3495
- return [...this.nodes.values()];
3496
- }
3497
- getNode(e) {
3498
- return this.nodes.get(e) ?? null;
3499
- }
3500
- addGroup({ id: e, icon: t, in: n, title: r }) {
3501
- if (this.registeredIds.has(e)) throw Error(`The group id [${e}] is already in use by another ${this.registeredIds.get(e)}`);
3502
- if (n !== void 0) {
3503
- if (e === n) throw Error(`The group [${e}] cannot be placed within itself`);
3504
- if (!this.registeredIds.has(n)) throw Error(`The group [${e}]'s parent does not exist. Please make sure the parent is created before this group`);
3505
- if (this.registeredIds.get(n) === "node") throw Error(`The group [${e}]'s parent is not a group`);
3506
- }
3507
- this.registeredIds.set(e, "group"), this.groups.set(e, {
3508
- id: e,
3509
- icon: t,
3510
- title: r,
3511
- in: n
3512
- });
3513
- }
3514
- getGroups() {
3515
- return [...this.groups.values()];
3516
- }
3517
- addEdge({ lhsId: e, rhsId: t, lhsDir: n, rhsDir: r, lhsInto: i, rhsInto: a, lhsGroup: o, rhsGroup: s, title: c }) {
3518
- if (!P(n)) throw Error(`Invalid direction given for left hand side of edge ${e}--${t}. Expected (L,R,T,B) got ${String(n)}`);
3519
- if (!P(r)) throw Error(`Invalid direction given for right hand side of edge ${e}--${t}. Expected (L,R,T,B) got ${String(r)}`);
3520
- if (!this.nodes.has(e) && !this.groups.has(e)) throw Error(`The left-hand id [${e}] does not yet exist. Please create the service/group before declaring an edge to it.`);
3521
- if (!this.nodes.has(t) && !this.groups.has(t)) throw Error(`The right-hand id [${t}] does not yet exist. Please create the service/group before declaring an edge to it.`);
3522
- let l = this.nodes.get(e).in, u = this.nodes.get(t).in;
3523
- if (o && l && u && l == u) throw Error(`The left-hand id [${e}] is modified to traverse the group boundary, but the edge does not pass through two groups.`);
3524
- if (s && l && u && l == u) throw Error(`The right-hand id [${t}] is modified to traverse the group boundary, but the edge does not pass through two groups.`);
3525
- let d = {
3526
- lhsId: e,
3527
- lhsDir: n,
3528
- lhsInto: i,
3529
- lhsGroup: o,
3530
- rhsId: t,
3531
- rhsDir: r,
3532
- rhsInto: a,
3533
- rhsGroup: s,
3534
- title: c
3535
- };
3536
- this.edges.push(d);
3537
- let f = this.nodes.get(e), p = this.nodes.get(t);
3538
- f && p && (f.edges.push(this.edges[this.edges.length - 1]), p.edges.push(this.edges[this.edges.length - 1]));
3539
- }
3540
- getEdges() {
3541
- return this.edges;
3542
- }
3543
- addLayoutHint(e) {
3544
- if (e.members.length < 2) throw Error(`An align directive requires at least two members; got ${e.members.length}`);
3545
- let t = /* @__PURE__ */ new Set();
3546
- e.members.forEach((n) => {
3547
- if (this.registeredIds.get(n) !== "node") throw Error(`align ${e.direction} references [${n}], which is not a service or junction`);
3548
- if (t.has(n)) throw Error(`align ${e.direction} lists [${n}] more than once`);
3549
- t.add(n);
3550
- }), this.layoutHints.push(e);
3551
- }
3552
- getLayoutHints() {
3553
- return this.layoutHints;
3554
- }
3555
- getDataStructures() {
3556
- if (this.dataStructures === void 0) {
3557
- let e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Map();
3558
- for (let [n, r] of this.nodes.entries()) {
3559
- let i = /* @__PURE__ */ new Map();
3560
- for (let t of r.edges) {
3561
- let r = this.getNode(t.lhsId)?.in, a = this.getNode(t.rhsId)?.in;
3562
- if (r && a && r !== a) {
3563
- let n = te(t.lhsDir, t.rhsDir);
3564
- n !== "bend" && e.set(re(r, a), n);
3565
- }
3566
- if (t.lhsId === n) {
3567
- let e = B(t.lhsDir, t.rhsDir);
3568
- e && i.set(e, t.rhsId);
3569
- } else {
3570
- let e = B(t.rhsDir, t.lhsDir);
3571
- e && i.set(e, t.lhsId);
3572
- }
3573
- }
3574
- t.set(n, i);
3575
- }
3576
- let n = /* @__PURE__ */ new Set(), r = new Set(t.keys()), a = /* @__PURE__ */ i((e) => {
3577
- let i = /* @__PURE__ */ new Map([[e, [0, 0]]]), a = [e];
3578
- for (; a.length > 0;) {
3579
- let e = a.shift();
3580
- if (e) {
3581
- n.add(e), r.delete(e);
3582
- let o = t.get(e);
3583
- if (!o) throw Error(`BFS error: adjacency list for id ${e} not found. Please report this as a bug.`);
3584
- let s = i.get(e);
3585
- if (!s) throw Error(`BFS error: position for id ${e} not found in spatial map. Please report this as a bug.`);
3586
- let [c, l] = s;
3587
- o.forEach((e, t) => {
3588
- n.has(e) || (i.set(e, V([c, l], t)), a.push(e));
3589
- });
3590
- }
3591
- }
3592
- return i;
3593
- }, "BFS"), o = [];
3594
- for (; r.size > 0;) {
3595
- let e = r.values().next().value;
3596
- o.push(a(e));
3597
- }
3598
- this.dataStructures = {
3599
- adjList: t,
3600
- spatialMaps: o,
3601
- groupAlignments: e
3602
- };
3603
- }
3604
- return this.dataStructures;
3605
- }
3606
- setElementForId(e, t) {
3607
- this.elements.set(e, t);
3608
- }
3609
- getElementById(e) {
3610
- return this.elements.get(e);
3611
- }
3612
- getConfig() {
3613
- return v({
3614
- ...G,
3615
- ...u().architecture
3616
- });
3617
- }
3618
- getConfigField(e) {
3619
- return this.getConfig()[e];
3620
- }
3621
- }, K = /* @__PURE__ */ i((e, t) => {
3622
- T(e, t), e.groups.map((e) => t.addGroup(e)), e.services.map((e) => t.addService({
3623
- ...e,
3624
- type: "service"
3625
- })), e.junctions.map((e) => t.addJunction({
3626
- ...e,
3627
- type: "junction"
3628
- })), e.edges.map((e) => t.addEdge(e)), e.alignments?.map((e) => t.addLayoutHint({
3629
- direction: e.direction,
3630
- members: [...e.members]
3631
- }));
3632
- }, "populateDb"), q = {
3633
- parser: { yy: void 0 },
3634
- parse: /* @__PURE__ */ i(async (e) => {
3635
- let n = await w("architecture", e);
3636
- t.debug(n);
3637
- let r = q.parser?.yy;
3638
- if (!(r instanceof ie)) 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.");
3639
- K(n, r);
3640
- }, "parse")
3641
- }, ae = /* @__PURE__ */ i((e) => `
3642
- .edge {
3643
- stroke-width: ${e.archEdgeWidth};
3644
- stroke: ${e.archEdgeColor};
3645
- fill: none;
3646
- }
3647
-
3648
- .arrow {
3649
- fill: ${e.archEdgeArrowColor};
3650
- }
3651
-
3652
- .node-bkg {
3653
- fill: none;
3654
- stroke: ${e.archGroupBorderColor};
3655
- stroke-width: ${e.archGroupBorderWidth};
3656
- stroke-dasharray: 8;
3657
- }
3658
- .node-icon-text {
3659
- display: flex;
3660
- align-items: center;
3661
- }
3662
-
3663
- .node-icon-text > div {
3664
- color: #fff;
3665
- margin: 1px;
3666
- height: fit-content;
3667
- text-align: center;
3668
- overflow: hidden;
3669
- display: -webkit-box;
3670
- -webkit-box-orient: vertical;
3671
- }
3672
- `, "getStyles");
3673
- function J(e, t) {
3674
- if (e === 0) return t();
3675
- let n = Math.random, r = e >>> 0;
3676
- Math.random = function() {
3677
- r = r + 1831565813 >>> 0;
3678
- let e = r;
3679
- return e = Math.imul(e ^ e >>> 15, e | 1), e ^= e + Math.imul(e ^ e >>> 7, e | 61), ((e ^ e >>> 14) >>> 0) / 4294967296;
3680
- };
3681
- try {
3682
- return t();
3683
- } finally {
3684
- Math.random = n;
3685
- }
3686
- }
3687
- i(J, "withSeededRandom");
3688
- var Y = /* @__PURE__ */ i((e) => `<g><rect width="80" height="80" style="fill: #087ebf; stroke-width: 0px;"/>${e}</g>`, "wrapIcon"), X = {
3689
- prefix: "mermaid-architecture",
3690
- height: 80,
3691
- width: 80,
3692
- icons: {
3693
- database: { body: Y("<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;\"/>") },
3694
- server: { body: Y("<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>") },
3695
- disk: { body: Y("<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;\"/>") },
3696
- internet: { body: Y("<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;\"/>") },
3697
- cloud: { body: Y("<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;\"/>") },
3698
- unknown: b,
3699
- blank: { body: Y("") }
3700
- }
3701
- }, oe = /* @__PURE__ */ i(async function(e, t, n, r) {
3702
- let i = n.getConfigField("padding"), a = n.getConfigField("iconSize"), o = a / 2, s = a / 6, c = s / 2;
3703
- await Promise.all(t.edges().map(async (t) => {
3704
- let { source: a, sourceDir: l, sourceArrow: u, sourceGroup: d, target: f, targetDir: p, targetArrow: h, targetGroup: g, label: v } = U(t), { x: y, y: b } = t[0].sourceEndpoint(), { x, y: S } = t[0].midpoint(), { x: w, y: T } = t[0].targetEndpoint(), E = i + 4;
3705
- if (d && (F(l) ? y += l === "L" ? -E : E : b += l === "T" ? -E : E + 18), g && (F(p) ? w += p === "L" ? -E : E : T += p === "T" ? -E : E + 18), !d && n.getNode(a)?.type === "junction" && (F(l) ? y += l === "L" ? o : -o : b += l === "T" ? o : -o), !g && n.getNode(f)?.type === "junction" && (F(p) ? w += p === "L" ? o : -o : T += p === "T" ? o : -o), t[0]._private.rscratch) {
3706
- let t = e.insert("g");
3707
- if (t.insert("path").attr("d", `M ${y},${b} L ${x},${S} L${w},${T} `).attr("class", "edge").attr("id", `${r}-${_(a, f, { prefix: "L" })}`), u) {
3708
- let e = F(l) ? M[l](y, s) : y - c, n = I(l) ? M[l](b, s) : b - c;
3709
- t.insert("polygon").attr("points", j[l](s)).attr("transform", `translate(${e},${n})`).attr("class", "arrow");
3710
- }
3711
- if (h) {
3712
- let e = F(p) ? M[p](w, s) : w - c, n = I(p) ? M[p](T, s) : T - c;
3713
- t.insert("polygon").attr("points", j[p](s)).attr("transform", `translate(${e},${n})`).attr("class", "arrow");
3714
- }
3715
- if (v) {
3716
- let e = L(l, p) ? "XY" : F(l) ? "X" : "Y", n = 0;
3717
- n = e === "X" ? Math.abs(y - w) : e === "Y" ? Math.abs(b - T) / 1.5 : Math.abs(y - w) / 2;
3718
- let r = t.append("g");
3719
- if (await C(r, v, {
3720
- useHtmlLabels: !1,
3721
- width: n,
3722
- classes: "architecture-service-label"
3723
- }, m()), r.attr("dy", "1em").attr("alignment-baseline", "middle").attr("dominant-baseline", "middle").attr("text-anchor", "middle"), e === "X") r.attr("transform", "translate(" + x + ", " + S + ")");
3724
- else if (e === "Y") r.attr("transform", "translate(" + x + ", " + S + ") rotate(-90)");
3725
- else if (e === "XY") {
3726
- let e = B(l, p);
3727
- if (e && R(e)) {
3728
- let t = r.node().getBoundingClientRect(), [n, i] = ee(e);
3729
- r.attr("dominant-baseline", "auto").attr("transform", `rotate(${-1 * n * i * 45})`);
3730
- let a = r.node().getBoundingClientRect();
3731
- r.attr("transform", `
3732
- translate(${x}, ${S - t.height / 2})
3733
- translate(${n * a.width / 2}, ${i * a.height / 2})
3734
- rotate(${-1 * n * i * 45}, 0, ${t.height / 2})
3735
- `);
3736
- }
3737
- }
3738
- }
3739
- }
3740
- }));
3741
- }, "drawEdges"), Z = /* @__PURE__ */ i(async function(e, t, n, r) {
3742
- let i = n.getConfigField("padding") * .75, a = n.getConfigField("fontSize"), o = n.getConfigField("iconSize") / 2;
3743
- await Promise.all(t.nodes().map(async (t) => {
3744
- let s = W(t);
3745
- if (s.type === "group") {
3746
- let { h: c, w: l, x1: u, y1: d } = t.boundingBox(), f = e.append("rect");
3747
- f.attr("id", `${r}-group-${s.id}`).attr("x", u + o).attr("y", d + o).attr("width", l).attr("height", c).attr("class", "node-bkg");
3748
- let p = e.append("g"), h = u, g = d;
3749
- if (s.icon) {
3750
- let e = p.append("g");
3751
- e.html(`<g>${await S(s.icon, {
3752
- height: i,
3753
- width: i,
3754
- fallbackPrefix: X.prefix
3755
- })}</g>`), e.attr("transform", "translate(" + (h + o + 1) + ", " + (g + o + 1) + ")"), h += i, g += a / 2 - 1 - 2;
3756
- }
3757
- if (s.label) {
3758
- let e = p.append("g");
3759
- await C(e, s.label, {
3760
- useHtmlLabels: !1,
3761
- width: l,
3762
- classes: "architecture-service-label"
3763
- }, m()), e.attr("dy", "1em").attr("alignment-baseline", "middle").attr("dominant-baseline", "start").attr("text-anchor", "start"), e.attr("transform", "translate(" + (h + o + 4) + ", " + (g + o + 2) + ")");
3764
- }
3765
- n.setElementForId(s.id, f);
3766
- }
3767
- }));
3768
- }, "drawGroups"), se = /* @__PURE__ */ i(async function(e, t, n, r) {
3769
- let i = m();
3770
- for (let a of n) {
3771
- let n = t.append("g"), o = e.getConfigField("iconSize");
3772
- if (a.title) {
3773
- let e = n.append("g");
3774
- await C(e, a.title, {
3775
- useHtmlLabels: !1,
3776
- width: o * 1.5,
3777
- classes: "architecture-service-label"
3778
- }, i), e.attr("dy", "1em").attr("alignment-baseline", "middle").attr("dominant-baseline", "middle").attr("text-anchor", "middle"), e.attr("transform", "translate(" + o / 2 + ", " + o + ")");
3779
- }
3780
- let s = n.append("g");
3781
- if (a.icon) s.html(`<g>${await S(a.icon, {
3782
- height: o,
3783
- width: o,
3784
- fallbackPrefix: X.prefix
3785
- })}</g>`);
3786
- else if (a.iconText) {
3787
- s.html(`<g>${await S("blank", {
3788
- height: o,
3789
- width: o,
3790
- fallbackPrefix: X.prefix
3791
- })}</g>`);
3792
- let e = s.append("g").append("foreignObject").attr("width", o).attr("height", o).append("div").attr("class", "node-icon-text").attr("style", `height: ${o}px;`).append("div").html(g(a.iconText, i)), t = parseInt(window.getComputedStyle(e.node(), null).getPropertyValue("font-size").replace(/\D/g, "")) ?? 16;
3793
- e.attr("style", `-webkit-line-clamp: ${Math.floor((o - 2) / t)};`);
3794
- } else s.append("path").attr("class", "node-bkg").attr("id", `${r}-node-${a.id}`).attr("d", `M0,${o} V5 Q0,0 5,0 H${o - 5} Q${o},0 ${o},5 V${o} Z`);
3795
- n.attr("id", `${r}-service-${a.id}`).attr("class", "architecture-service");
3796
- let { width: c, height: l } = n.node().getBBox();
3797
- a.width = c, a.height = l, e.setElementForId(a.id, n);
3798
- }
3799
- return 0;
3800
- }, "drawServices"), ce = /* @__PURE__ */ i(function(e, t, n, r) {
3801
- n.forEach((n) => {
3802
- let i = t.append("g"), a = e.getConfigField("iconSize");
3803
- i.append("g").append("rect").attr("id", `${r}-node-${n.id}`).attr("fill-opacity", "0").attr("width", a).attr("height", a), i.attr("class", "architecture-junction");
3804
- let { width: o, height: s } = i._groups[0][0].getBBox();
3805
- i.width = o, i.height = s, e.setElementForId(n.id, i);
3806
- });
3807
- }, "drawJunctions");
3808
- x([{
3809
- name: X.prefix,
3810
- icons: X
3811
- }]), E.use(k.default);
3812
- function le(e, t, n) {
3813
- e.forEach((e) => {
3814
- t.add({
3815
- group: "nodes",
3816
- data: {
3817
- type: "service",
3818
- id: e.id,
3819
- icon: e.icon,
3820
- label: e.title,
3821
- parent: e.in,
3822
- width: n.getConfigField("iconSize"),
3823
- height: n.getConfigField("iconSize")
3824
- },
3825
- classes: "node-service"
3826
- });
3827
- });
3828
- }
3829
- i(le, "addServices");
3830
- function ue(e, t, n) {
3831
- e.forEach((e) => {
3832
- t.add({
3833
- group: "nodes",
3834
- data: {
3835
- type: "junction",
3836
- id: e.id,
3837
- parent: e.in,
3838
- width: n.getConfigField("iconSize"),
3839
- height: n.getConfigField("iconSize")
3840
- },
3841
- classes: "node-junction"
3842
- });
3843
- });
3844
- }
3845
- i(ue, "addJunctions");
3846
- function de(e, t) {
3847
- t.nodes().map((t) => {
3848
- let n = W(t);
3849
- n.type !== "group" && (n.x = t.position().x, n.y = t.position().y, e.getElementById(n.id).attr("transform", "translate(" + (n.x || 0) + "," + (n.y || 0) + ")"));
3850
- });
3851
- }
3852
- i(de, "positionNodes");
3853
- function fe(e, t) {
3854
- e.forEach((e) => {
3855
- t.add({
3856
- group: "nodes",
3857
- data: {
3858
- type: "group",
3859
- id: e.id,
3860
- icon: e.icon,
3861
- label: e.title,
3862
- parent: e.in
3863
- },
3864
- classes: "node-group"
3865
- });
3866
- });
3867
- }
3868
- i(fe, "addGroups");
3869
- function pe(e, t) {
3870
- e.forEach((e) => {
3871
- let { lhsId: n, rhsId: r, lhsInto: i, lhsGroup: a, rhsInto: o, lhsDir: s, rhsDir: c, rhsGroup: l, title: u } = e, d = L(e.lhsDir, e.rhsDir) ? "segments" : "straight", f = {
3872
- id: `${n}-${r}`,
3873
- label: u,
3874
- source: n,
3875
- sourceDir: s,
3876
- sourceArrow: i,
3877
- sourceGroup: a,
3878
- sourceEndpoint: s === "L" ? "0 50%" : s === "R" ? "100% 50%" : s === "T" ? "50% 0" : "50% 100%",
3879
- target: r,
3880
- targetDir: c,
3881
- targetArrow: o,
3882
- targetGroup: l,
3883
- targetEndpoint: c === "L" ? "0 50%" : c === "R" ? "100% 50%" : c === "T" ? "50% 0" : "50% 100%"
3884
- };
3885
- t.add({
3886
- group: "edges",
3887
- data: f,
3888
- classes: d
3889
- });
3890
- });
3891
- }
3892
- i(pe, "addEdges");
3893
- function me(e, t, n, r = []) {
3894
- let a = /* @__PURE__ */ i((e, t) => {
3895
- let r = /* @__PURE__ */ new Map();
3896
- for (let [i, a] of e.entries()) {
3897
- let e = `${i}`, o = 0, s = [...a.entries()];
3898
- if (s.length === 1) {
3899
- r.set(e, s[0][1]);
3900
- continue;
3901
- }
3902
- for (let i = 0; i < s.length - 1; i++) for (let a = i + 1; a < s.length; a++) {
3903
- let [c, l] = s[i], [u, d] = s[a];
3904
- if (n.get(re(c, u)) === t) r.set(e, [
3905
- ...r.get(e) ?? [],
3906
- ...l,
3907
- ...d
3908
- ]);
3909
- else if (c === "default" || u === "default") r.set(e, [
3910
- ...r.get(e) ?? [],
3911
- ...l,
3912
- ...d
3913
- ]);
3914
- else {
3915
- let t = `${e}-${o++}`;
3916
- r.set(t, l);
3917
- let n = `${e}-${o++}`;
3918
- r.set(n, d);
3919
- }
3920
- }
3921
- }
3922
- return r;
3923
- }, "flattenAlignments"), [o, s] = t.map((t) => {
3924
- let n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map();
3925
- return t.forEach(([t, i], a) => {
3926
- let o = e.getNode(a)?.in ?? "default", s = n.get(i) ?? /* @__PURE__ */ new Map();
3927
- n.has(i) || n.set(i, s);
3928
- let c = r.get(t) ?? /* @__PURE__ */ new Map();
3929
- r.has(t) || r.set(t, c);
3930
- for (let e of [s, c]) {
3931
- let t = e.get(o) ?? [];
3932
- e.has(o) || e.set(o, t), t.push(a);
3933
- }
3934
- }), {
3935
- horiz: [...a(n, "horizontal").values()].filter((e) => e.length > 1),
3936
- vert: [...a(r, "vertical").values()].filter((e) => e.length > 1)
3937
- };
3938
- }).reduce(([e, t], { horiz: n, vert: r }) => [[...e, ...n], [...t, ...r]], [[], []]), c = /* @__PURE__ */ new Set();
3939
- r.forEach((e) => e.members.forEach((e) => c.add(e)));
3940
- let l = /* @__PURE__ */ i((e) => e.filter((e) => !e.some((e) => c.has(e))), "dropOverlapping"), u = l(o), d = l(s);
3941
- return r.forEach((e) => {
3942
- e.members.length < 2 || (e.direction === "row" ? u.push([...e.members]) : d.push([...e.members]));
3943
- }), {
3944
- horizontal: u,
3945
- vertical: d
3946
- };
3947
- }
3948
- i(me, "getAlignments");
3949
- function he(e, t, n = []) {
3950
- let r = [], a = t.getConfigField("iconSize"), o = t.getConfigField("idealEdgeLengthMultiplier"), s = o * a, c = /* @__PURE__ */ new Set();
3951
- n.forEach((e) => {
3952
- for (let t = 0; t < e.members.length - 1; t++) {
3953
- let n = e.members[t], i = e.members[t + 1];
3954
- c.add(`${n}|${i}`), c.add(`${i}|${n}`), e.direction === "row" ? r.push({
3955
- left: n,
3956
- right: i,
3957
- gap: s
3958
- }) : r.push({
3959
- top: n,
3960
- bottom: i,
3961
- gap: s
3962
- });
3963
- }
3964
- });
3965
- let l = /* @__PURE__ */ i((e) => `${e[0]},${e[1]}`, "posToStr"), u = /* @__PURE__ */ i((e) => e.split(",").map((e) => parseInt(e)), "strToPos");
3966
- return e.forEach((e) => {
3967
- let t = new Map([...e.entries()].map(([e, t]) => [l(t), e])), n = [l([0, 0])], i = {}, s = {
3968
- L: [-1, 0],
3969
- R: [1, 0],
3970
- T: [0, 1],
3971
- B: [0, -1]
3972
- };
3973
- for (; n.length > 0;) {
3974
- let e = n.shift();
3975
- if (e) {
3976
- i[e] = 1;
3977
- let d = t.get(e);
3978
- if (d) {
3979
- let f = u(e);
3980
- Object.entries(s).forEach(([e, s]) => {
3981
- let u = l([f[0] + s[0], f[1] + s[1]]), p = t.get(u);
3982
- if (p && !i[u]) {
3983
- if (n.push(u), c.has(`${d}|${p}`)) return;
3984
- r.push({
3985
- [A[e]]: p,
3986
- [A[N(e)]]: d,
3987
- gap: o * a
3988
- });
3989
- }
3990
- });
3991
- }
3992
- }
3993
- }
3994
- }), r;
3995
- }
3996
- i(he, "getRelativeConstraints");
3997
- function ge(e, r, a, o, s, { spatialMaps: c, groupAlignments: l }) {
3998
- return new Promise((u) => {
3999
- let d = n("body").append("div").attr("id", "cy").attr("style", "display:none"), f = E({
4000
- container: document.getElementById("cy"),
4001
- style: [
4002
- {
4003
- selector: "edge",
4004
- style: {
4005
- "curve-style": "straight",
4006
- "source-endpoint": "data(sourceEndpoint)",
4007
- "target-endpoint": "data(targetEndpoint)"
4008
- }
4009
- },
4010
- {
4011
- selector: "edge[label]",
4012
- style: { label: "data(label)" }
4013
- },
4014
- {
4015
- selector: "edge.segments",
4016
- style: {
4017
- "curve-style": "segments",
4018
- "segment-weights": "0",
4019
- "segment-distances": [.5],
4020
- "edge-distances": "endpoints",
4021
- "source-endpoint": "data(sourceEndpoint)",
4022
- "target-endpoint": "data(targetEndpoint)"
4023
- }
4024
- },
4025
- {
4026
- selector: "node",
4027
- style: { "compound-sizing-wrt-labels": "include" }
4028
- },
4029
- {
4030
- selector: "node[label]",
4031
- style: {
4032
- "text-valign": "bottom",
4033
- "text-halign": "center",
4034
- "font-size": `${s.getConfigField("fontSize")}px`
4035
- }
4036
- },
4037
- {
4038
- selector: ".node-service",
4039
- style: {
4040
- label: "data(label)",
4041
- width: "data(width)",
4042
- height: "data(height)"
4043
- }
4044
- },
4045
- {
4046
- selector: ".node-junction",
4047
- style: {
4048
- width: "data(width)",
4049
- height: "data(height)"
4050
- }
4051
- },
4052
- {
4053
- selector: ".node-group",
4054
- style: { padding: `${s.getConfigField("padding")}px` }
4055
- }
4056
- ],
4057
- layout: {
4058
- name: "grid",
4059
- boundingBox: {
4060
- x1: 0,
4061
- x2: 100,
4062
- y1: 0,
4063
- y2: 100
4064
- }
4065
- }
4066
- });
4067
- d.remove(), fe(a, f), le(e, f, s), ue(r, f, s), pe(o, f);
4068
- let p = s.getLayoutHints(), m = me(s, c, l, p), h = he(c, s, p), g = s.getConfigField("iconSize"), _ = s.getConfigField("idealEdgeLengthMultiplier") * g, v = .5 * g, y = s.getConfigField("edgeElasticity"), b = s.getConfigField("seed"), x = f.layout({
4069
- name: "fcose",
4070
- quality: "proof",
4071
- randomize: s.getConfigField("randomize"),
4072
- nodeSeparation: s.getConfigField("nodeSeparation"),
4073
- numIter: s.getConfigField("numIter"),
4074
- styleEnabled: !1,
4075
- animate: !1,
4076
- nodeDimensionsIncludeLabels: !1,
4077
- idealEdgeLength(e) {
4078
- let [t, n] = e.connectedNodes(), { parent: r } = W(t), { parent: i } = W(n);
4079
- return r === i ? _ : v;
4080
- },
4081
- edgeElasticity(e) {
4082
- let [t, n] = e.connectedNodes(), { parent: r } = W(t), { parent: i } = W(n);
4083
- return r === i ? y : .001;
4084
- },
4085
- alignmentConstraint: m,
4086
- relativePlacementConstraint: h
4087
- });
4088
- x.one("layoutstop", () => {
4089
- function e(e, t, n, r) {
4090
- let i, a, { x: o, y: s } = e, { x: c, y: l } = t;
4091
- a = (r - s + (o - n) * (s - l) / (o - c)) / Math.sqrt(1 + ((s - l) / (o - c)) ** 2), i = Math.sqrt((r - s) ** 2 + (n - o) ** 2 - a ** 2);
4092
- let u = Math.sqrt((c - o) ** 2 + (l - s) ** 2);
4093
- i /= u;
4094
- let d = (c - o) * (r - s) - (l - s) * (n - o);
4095
- switch (!0) {
4096
- case d >= 0:
4097
- d = 1;
4098
- break;
4099
- case d < 0: d = -1;
4100
- }
4101
- let f = (c - o) * (n - o) + (l - s) * (r - s);
4102
- switch (!0) {
4103
- case f >= 0:
4104
- f = 1;
4105
- break;
4106
- case f < 0: f = -1;
4107
- }
4108
- return a = Math.abs(a) * d, i *= f, {
4109
- distances: a,
4110
- weights: i
4111
- };
4112
- }
4113
- i(e, "getSegmentWeights"), f.startBatch();
4114
- for (let t of Object.values(f.edges())) if (t.data?.()) {
4115
- let { x: n, y: r } = t.source().position(), { x: i, y: a } = t.target().position();
4116
- if (n !== i && r !== a) {
4117
- let n = t.sourceEndpoint(), r = t.targetEndpoint(), { sourceDir: i } = U(t), [a, o] = I(i) ? [n.x, r.y] : [r.x, n.y], { weights: s, distances: c } = e(n, r, a, o);
4118
- t.style("segment-distances", c), t.style("segment-weights", s);
4119
- }
4120
- }
4121
- f.endBatch(), J(b, () => x.run());
4122
- });
4123
- try {
4124
- J(b, () => x.run());
4125
- } catch (e) {
4126
- throw e instanceof RangeError && e.message.includes("Invalid array length") ? Error("Architecture layout failed: a declared `align row|column` directive likely contradicts the edge directions, or two declared alignments overlap on a shared node. Check that the order of members in each `align` chain is consistent with the edges between them, and that no node appears in two `align` directives along the same axis.") : e;
4127
- }
4128
- f.ready((e) => {
4129
- t.info("Ready", e), u(f);
4130
- });
4131
- });
4132
- }
4133
- i(ge, "layoutArchitecture");
4134
- var _e = {
4135
- parser: q,
4136
- get db() {
4137
- return new ie();
4138
- },
4139
- renderer: { draw: /* @__PURE__ */ i(async (e, t, n, r) => {
4140
- let i = r.db;
4141
- i.setDiagramId(t);
4142
- let a = i.getServices(), s = i.getJunctions(), c = i.getGroups(), l = i.getEdges(), u = i.getDataStructures(), d = y(t), f = d.append("g");
4143
- f.attr("class", "architecture-edges");
4144
- let p = d.append("g");
4145
- p.attr("class", "architecture-services");
4146
- let m = d.append("g");
4147
- m.attr("class", "architecture-groups"), await se(i, p, a, t), ce(i, p, s, t);
4148
- let h = await ge(a, s, c, l, i, u);
4149
- await oe(f, h, i, t), await Z(m, h, i, t), de(i, h), o(void 0, d, i.getConfigField("padding"), i.getConfigField("useMaxWidth"));
4150
- }, "draw") },
4151
- styles: ae
4152
- };
4153
- //#endregion
4154
- export { _e as diagram };