@legionworks/facet 1.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (327) hide show
  1. package/LICENSE-APACHE +202 -0
  2. package/LICENSE-MIT +23 -0
  3. package/README.md +158 -0
  4. package/dist/gallery/chunk-4g8rem85.css +656 -0
  5. package/dist/gallery/chunk-c6s9k9ty.js +5970 -0
  6. package/dist/gallery/frame/artifact.css +8424 -0
  7. package/dist/gallery/frame/chunks/abnfDiagram-N423BO3Z-jj74szbm.js +155 -0
  8. package/dist/gallery/frame/chunks/architecture-TIHT7OUA-cvdjn7dt.js +10 -0
  9. package/dist/gallery/frame/chunks/architectureDiagram-T3A2C74G-n4z77eg6.js +8675 -0
  10. package/dist/gallery/frame/chunks/blockDiagram-VBNYF7ZC-7xsqzrd1.js +3529 -0
  11. package/dist/gallery/frame/chunks/c4Diagram-5PPSVZJV-z2zjs7wx.js +2413 -0
  12. package/dist/gallery/frame/chunks/classDiagram-JCYQIIEL-ve8rngqp.js +47 -0
  13. package/dist/gallery/frame/chunks/classDiagram-v2-OCEON4UE-8cfaxb8z.js +47 -0
  14. package/dist/gallery/frame/chunks/cose-bilkent-JH36ORCC-sn92qexx.js +4822 -0
  15. package/dist/gallery/frame/chunks/cynefin-VYW2F7L2-tqjv913d.js +10 -0
  16. package/dist/gallery/frame/chunks/cynefinDiagram-MW4NZA55-c1c0dj12.js +500 -0
  17. package/dist/gallery/frame/chunks/dagre-VZM6K2ZE-7tyg4yt2.js +476 -0
  18. package/dist/gallery/frame/chunks/diagram-7IWD3JNH-y4eng9sc.js +526 -0
  19. package/dist/gallery/frame/chunks/diagram-B4RE2ZJO-rn3p7j5h.js +673 -0
  20. package/dist/gallery/frame/chunks/diagram-LBJQPF4R-w4a2cm9q.js +255 -0
  21. package/dist/gallery/frame/chunks/diagram-Q27KOJAE-aqc2v7wy.js +575 -0
  22. package/dist/gallery/frame/chunks/diagram-UB23O5K3-xncy8nyd.js +355 -0
  23. package/dist/gallery/frame/chunks/ebnfDiagram-BXEA7PRR-acwgxz16.js +175 -0
  24. package/dist/gallery/frame/chunks/erDiagram-JOGREHBK-mzp5nswt.js +1332 -0
  25. package/dist/gallery/frame/chunks/eventmodeling-45OFAUF4-sg07qr0c.js +10 -0
  26. package/dist/gallery/frame/chunks/flowDiagram-UKHOOZJN-2e5ygs44.js +29 -0
  27. package/dist/gallery/frame/chunks/ganttDiagram-PKOTCBZU-p2hhh7hr.js +2620 -0
  28. package/dist/gallery/frame/chunks/gitGraph-TEB2WS4Q-j6kw0naa.js +10 -0
  29. package/dist/gallery/frame/chunks/gitGraphDiagram-DS77QQ5N-4z9z8wjm.js +1347 -0
  30. package/dist/gallery/frame/chunks/info-DKCQHKI2-mpt80jd3.js +10 -0
  31. package/dist/gallery/frame/chunks/infoDiagram-6WML65LV-5rqm3mgg.js +65 -0
  32. package/dist/gallery/frame/chunks/ishikawaDiagram-WSZJBQD7-b51z96jy.js +975 -0
  33. package/dist/gallery/frame/chunks/journeyDiagram-NVQOT4AX-9jbfp0pk.js +1272 -0
  34. package/dist/gallery/frame/chunks/kanban-definition-27J2QSJJ-4x0vx4se.js +1116 -0
  35. package/dist/gallery/frame/chunks/katex-xfgk95tv.js +14034 -0
  36. package/dist/gallery/frame/chunks/markdown-1s5vwkf2.js +9 -0
  37. package/dist/gallery/frame/chunks/markdown-2h6bwsms.js +3239 -0
  38. package/dist/gallery/frame/chunks/markdown-2x113yh8.js +107 -0
  39. package/dist/gallery/frame/chunks/markdown-30b7rwmp.js +1943 -0
  40. package/dist/gallery/frame/chunks/markdown-356bfj4g.js +2031 -0
  41. package/dist/gallery/frame/chunks/markdown-44n9ea69.js +2406 -0
  42. package/dist/gallery/frame/chunks/markdown-56enrf2r.js +39 -0
  43. package/dist/gallery/frame/chunks/markdown-5avymm8t.js +725 -0
  44. package/dist/gallery/frame/chunks/markdown-6r4svars.js +33 -0
  45. package/dist/gallery/frame/chunks/markdown-6zz8efx2.js +24 -0
  46. package/dist/gallery/frame/chunks/markdown-7jp6prnb.js +19 -0
  47. package/dist/gallery/frame/chunks/markdown-809k7q41.js +55 -0
  48. package/dist/gallery/frame/chunks/markdown-82xmzhzd.js +1076 -0
  49. package/dist/gallery/frame/chunks/markdown-92n37gd4.js +7627 -0
  50. package/dist/gallery/frame/chunks/markdown-ag2sssf8.js +36 -0
  51. package/dist/gallery/frame/chunks/markdown-b4s7ntq2.js +19 -0
  52. package/dist/gallery/frame/chunks/markdown-c9k0fvp1.js +100 -0
  53. package/dist/gallery/frame/chunks/markdown-ceefymn8.js +125 -0
  54. package/dist/gallery/frame/chunks/markdown-d1wfbs70.js +243 -0
  55. package/dist/gallery/frame/chunks/markdown-dy5sgjhc.js +11022 -0
  56. package/dist/gallery/frame/chunks/markdown-dz3z5w30.js +30868 -0
  57. package/dist/gallery/frame/chunks/markdown-eg6ngz7y.js +30340 -0
  58. package/dist/gallery/frame/chunks/markdown-ff5wvb43.js +1149 -0
  59. package/dist/gallery/frame/chunks/markdown-ffg06nfz.js +86 -0
  60. package/dist/gallery/frame/chunks/markdown-fvfncadf.js +472 -0
  61. package/dist/gallery/frame/chunks/markdown-gvyszqpv.js +19 -0
  62. package/dist/gallery/frame/chunks/markdown-gx1p0ew0.js +88 -0
  63. package/dist/gallery/frame/chunks/markdown-gxye5frz.js +65 -0
  64. package/dist/gallery/frame/chunks/markdown-h7pzv34e.js +105 -0
  65. package/dist/gallery/frame/chunks/markdown-hab789t9.js +47 -0
  66. package/dist/gallery/frame/chunks/markdown-hjp6sj8t.js +125 -0
  67. package/dist/gallery/frame/chunks/markdown-jka64qgp.js +1993 -0
  68. package/dist/gallery/frame/chunks/markdown-k8xkn8mw.js +56 -0
  69. package/dist/gallery/frame/chunks/markdown-m7frq8x8.js +112 -0
  70. package/dist/gallery/frame/chunks/markdown-p740v4qm.js +36 -0
  71. package/dist/gallery/frame/chunks/markdown-pxfeh231.js +57 -0
  72. package/dist/gallery/frame/chunks/markdown-pzgd8z3s.js +87 -0
  73. package/dist/gallery/frame/chunks/markdown-qx3cngz2.js +1673 -0
  74. package/dist/gallery/frame/chunks/markdown-rawhfvvc.js +85 -0
  75. package/dist/gallery/frame/chunks/markdown-rd8w0ng9.js +49 -0
  76. package/dist/gallery/frame/chunks/markdown-rm2yxfjj.js +2773 -0
  77. package/dist/gallery/frame/chunks/markdown-s1jatrnk.js +993 -0
  78. package/dist/gallery/frame/chunks/markdown-sgfg5vvq.js +59 -0
  79. package/dist/gallery/frame/chunks/markdown-t4ethv9d.js +409 -0
  80. package/dist/gallery/frame/chunks/markdown-tnmabqvz.js +36 -0
  81. package/dist/gallery/frame/chunks/markdown-tvdpppw8.js +5292 -0
  82. package/dist/gallery/frame/chunks/markdown-v0x27twr.js +22 -0
  83. package/dist/gallery/frame/chunks/markdown-v14td68x.js +36 -0
  84. package/dist/gallery/frame/chunks/markdown-w6sgd54z.js +36 -0
  85. package/dist/gallery/frame/chunks/markdown-xw8dsk8b.js +2125 -0
  86. package/dist/gallery/frame/chunks/markdown-y18mve73.js +85 -0
  87. package/dist/gallery/frame/chunks/markdown-yengsms5.js +427 -0
  88. package/dist/gallery/frame/chunks/markdown-z1wc0v0d.js +1826 -0
  89. package/dist/gallery/frame/chunks/markdown-zazx9h4n.js +329 -0
  90. package/dist/gallery/frame/chunks/mermaid-de7p4v0x.js +30 -0
  91. package/dist/gallery/frame/chunks/mindmap-definition-FAOFIHXS-ra44cbem.js +1216 -0
  92. package/dist/gallery/frame/chunks/packet-7NZHBO7P-xppm5913.js +10 -0
  93. package/dist/gallery/frame/chunks/pegDiagram-VL7TDLO6-a2a4wg03.js +163 -0
  94. package/dist/gallery/frame/chunks/pie-RZYD4A2V-hnbxk152.js +10 -0
  95. package/dist/gallery/frame/chunks/pieDiagram-7S7Q4E2Y-f1vxjtmx.js +311 -0
  96. package/dist/gallery/frame/chunks/quadrantDiagram-CIZ2JOQS-ywafa6kh.js +1390 -0
  97. package/dist/gallery/frame/chunks/radar-I7S5WNFK-ewqd27se.js +10 -0
  98. package/dist/gallery/frame/chunks/railroad-3IZDKUUU-5hy4bdx3.js +10 -0
  99. package/dist/gallery/frame/chunks/railroad-abnf-AHOZXSZD-bh5sxz0d.js +10 -0
  100. package/dist/gallery/frame/chunks/railroad-ebnf-EBAXGLYW-6b9c3zeh.js +10 -0
  101. package/dist/gallery/frame/chunks/railroad-peg-LSFZ7HO6-avc8v39s.js +10 -0
  102. package/dist/gallery/frame/chunks/railroadDiagram-AXF67PYL-qc61wax4.js +131 -0
  103. package/dist/gallery/frame/chunks/requirementDiagram-LRYGKXZP-9bs4786c.js +1295 -0
  104. package/dist/gallery/frame/chunks/sankeyDiagram-W5VNT64P-awt1em8b.js +1339 -0
  105. package/dist/gallery/frame/chunks/sequenceDiagram-SI44F4Z6-qaf9mz3t.js +4324 -0
  106. package/dist/gallery/frame/chunks/sizeCapture-X5ZJPWSS-9fq685xd.js +64 -0
  107. package/dist/gallery/frame/chunks/stateDiagram-OKZ733FA-vx7a7hh0.js +456 -0
  108. package/dist/gallery/frame/chunks/stateDiagram-v2-UEYNNEHI-x4m6ws5t.js +46 -0
  109. package/dist/gallery/frame/chunks/swimlanes-SLNWSIFB-e4mxm1gh.js +8287 -0
  110. package/dist/gallery/frame/chunks/swimlanesDiagram-ULZ7WXOC-0h93e2qq.js +42 -0
  111. package/dist/gallery/frame/chunks/timeline-definition-Z64GVDOM-wp0bhbzg.js +1549 -0
  112. package/dist/gallery/frame/chunks/treeView-QDETBFTQ-hcx7n0vt.js +10 -0
  113. package/dist/gallery/frame/chunks/treemap-6X3UGDF4-av02skdw.js +10 -0
  114. package/dist/gallery/frame/chunks/vennDiagram-T6HMQDX7-pmvk1p7n.js +2566 -0
  115. package/dist/gallery/frame/chunks/wardley-OPB4EBWU-njsp6e40.js +10 -0
  116. package/dist/gallery/frame/chunks/wardleyDiagram-T6FBY63Y-eggmnv4z.js +979 -0
  117. package/dist/gallery/frame/chunks/xychartDiagram-ELKLHX3M-q40tnpe5.js +1954 -0
  118. package/dist/gallery/frame/frame.css +183 -0
  119. package/dist/gallery/frame/runtime/chart.js +42744 -0
  120. package/dist/gallery/frame/runtime/html.js +14 -0
  121. package/dist/gallery/frame/runtime/markdown.js +1403 -0
  122. package/dist/gallery/frame/runtime/mermaid.js +32 -0
  123. package/dist/gallery/frame/runtime/svg.js +14 -0
  124. package/dist/gallery/frame/runtime/tsx.js +52 -0
  125. package/dist/gallery/index.html +104 -0
  126. package/docs/reference/cli.md +163 -0
  127. package/docs/reference/export.md +106 -0
  128. package/docs/reference/html.md +215 -0
  129. package/docs/reference/http.md +85 -0
  130. package/docs/reference/mcp.md +78 -0
  131. package/docs/reference/security.md +119 -0
  132. package/docs/reference/storage.md +93 -0
  133. package/docs/reference/tsx.md +101 -0
  134. package/docs/reference/validation.md +212 -0
  135. package/package.json +89 -0
  136. package/scripts/build-gallery.ts +127 -0
  137. package/scripts/launch-netns.sh +67 -0
  138. package/skills/facet/SKILL.md +100 -0
  139. package/src/cli/client.ts +311 -0
  140. package/src/cli/commands/create.ts +49 -0
  141. package/src/cli/commands/doctor.ts +249 -0
  142. package/src/cli/commands/export.ts +179 -0
  143. package/src/cli/commands/instantiate.ts +35 -0
  144. package/src/cli/commands/list.ts +49 -0
  145. package/src/cli/commands/open.ts +75 -0
  146. package/src/cli/commands/pin.ts +39 -0
  147. package/src/cli/commands/promote.ts +49 -0
  148. package/src/cli/commands/publish.ts +122 -0
  149. package/src/cli/commands/read-back.ts +56 -0
  150. package/src/cli/commands/status.ts +114 -0
  151. package/src/cli/commands/watch.ts +146 -0
  152. package/src/cli/main.ts +522 -0
  153. package/src/cli/output.ts +106 -0
  154. package/src/cli/parser.ts +376 -0
  155. package/src/cli/presenter.ts +212 -0
  156. package/src/cli/service-metadata.ts +134 -0
  157. package/src/cli/spawn-service.ts +326 -0
  158. package/src/css.d.ts +4 -0
  159. package/src/gallery-web/app.ts +1581 -0
  160. package/src/gallery-web/export-menu.ts +121 -0
  161. package/src/gallery-web/export.ts +112 -0
  162. package/src/gallery-web/favicon.ts +54 -0
  163. package/src/gallery-web/frame/entries/chart.ts +6 -0
  164. package/src/gallery-web/frame/entries/html.ts +6 -0
  165. package/src/gallery-web/frame/entries/markdown.ts +6 -0
  166. package/src/gallery-web/frame/entries/mermaid.ts +6 -0
  167. package/src/gallery-web/frame/entries/svg.ts +6 -0
  168. package/src/gallery-web/frame/entries/tsx.ts +6 -0
  169. package/src/gallery-web/frame/frame-payload.ts +91 -0
  170. package/src/gallery-web/frame/renderer-validation.ts +13 -0
  171. package/src/gallery-web/frame/renderers/chart.ts +182 -0
  172. package/src/gallery-web/frame/renderers/dompurify-shim.ts +112 -0
  173. package/src/gallery-web/frame/renderers/html.ts +48 -0
  174. package/src/gallery-web/frame/renderers/markdown.ts +81 -0
  175. package/src/gallery-web/frame/renderers/mermaid.ts +120 -0
  176. package/src/gallery-web/frame/renderers/registry.ts +260 -0
  177. package/src/gallery-web/frame/renderers/svg.ts +393 -0
  178. package/src/gallery-web/frame/renderers/tsx.ts +61 -0
  179. package/src/gallery-web/frame/runtime.ts +501 -0
  180. package/src/gallery-web/frame/styles/artifact.css +8424 -0
  181. package/src/gallery-web/frame/styles/frame.css +183 -0
  182. package/src/gallery-web/frame/styles/html-source.css +23 -0
  183. package/src/gallery-web/frame/view-box.ts +33 -0
  184. package/src/gallery-web/frame-html.ts +72 -0
  185. package/src/gallery-web/index.html +104 -0
  186. package/src/gallery-web/session.ts +107 -0
  187. package/src/gallery-web/sse-client.ts +212 -0
  188. package/src/gallery-web/styles/app.css +420 -0
  189. package/src/gallery-web/styles/tokens.css +112 -0
  190. package/src/gallery-web/styles/verdict.css +186 -0
  191. package/src/gallery-web/swap.ts +64 -0
  192. package/src/gallery-web/theme.ts +40 -0
  193. package/src/gallery-web/view-state.ts +93 -0
  194. package/src/harness-adapters/claude-code/README.md +10 -0
  195. package/src/harness-adapters/claude-code/facet.sh +4 -0
  196. package/src/harness-adapters/codex/README.md +10 -0
  197. package/src/harness-adapters/codex/facet.sh +4 -0
  198. package/src/harness-adapters/mcp/README.md +13 -0
  199. package/src/harness-adapters/mcp/cli-bridge.ts +216 -0
  200. package/src/harness-adapters/mcp/main.ts +15 -0
  201. package/src/harness-adapters/mcp/server.ts +164 -0
  202. package/src/harness-adapters/mcp/tool-schemas.ts +53 -0
  203. package/src/harness-adapters/opencode/README.md +10 -0
  204. package/src/harness-adapters/opencode/facet.sh +4 -0
  205. package/src/runtime/compiled-entrypoints.ts +69 -0
  206. package/src/service/dispatcher.ts +717 -0
  207. package/src/service/export.ts +218 -0
  208. package/src/service/http-utils.ts +55 -0
  209. package/src/service/lexical/expectations.ts +210 -0
  210. package/src/service/lifecycle/idle-controller.ts +125 -0
  211. package/src/service/lifecycle/orphan-cleanup.ts +128 -0
  212. package/src/service/lifecycle/process-lock.ts +235 -0
  213. package/src/service/main.ts +136 -0
  214. package/src/service/process.ts +240 -0
  215. package/src/service/router-guards.ts +239 -0
  216. package/src/service/router.ts +627 -0
  217. package/src/service/security/auth.ts +168 -0
  218. package/src/service/security/host-origin.ts +138 -0
  219. package/src/service/security/http-guards.ts +13 -0
  220. package/src/service/security/leases.ts +182 -0
  221. package/src/service/security/token-store.ts +138 -0
  222. package/src/service/server.ts +356 -0
  223. package/src/service/store/database.ts +61 -0
  224. package/src/service/store/evidence-retention.ts +234 -0
  225. package/src/service/store/migrations.ts +167 -0
  226. package/src/service/store/repository-lifecycle.ts +121 -0
  227. package/src/service/store/repository.ts +732 -0
  228. package/src/service/store/schema.ts +218 -0
  229. package/src/service/stored-verdict.ts +97 -0
  230. package/src/service/stream.ts +301 -0
  231. package/src/service/verdict-enrichment.ts +45 -0
  232. package/src/shared/build/frame-bundle-plugins.ts +61 -0
  233. package/src/shared/build-mode.ts +28 -0
  234. package/src/shared/config/evidence-read.ts +98 -0
  235. package/src/shared/config/limits.ts +56 -0
  236. package/src/shared/config/paths.ts +96 -0
  237. package/src/shared/contracts/artifact-types.ts +2 -0
  238. package/src/shared/contracts/artifact.ts +98 -0
  239. package/src/shared/contracts/commands/_shared.ts +59 -0
  240. package/src/shared/contracts/commands/guards.ts +86 -0
  241. package/src/shared/contracts/commands/index.ts +204 -0
  242. package/src/shared/contracts/commands/names.ts +35 -0
  243. package/src/shared/contracts/commands/requests.ts +149 -0
  244. package/src/shared/contracts/commands/results.ts +200 -0
  245. package/src/shared/contracts/envelope.ts +140 -0
  246. package/src/shared/contracts/events.ts +41 -0
  247. package/src/shared/contracts/observed-counts.ts +19 -0
  248. package/src/shared/contracts/renderers.ts +6 -0
  249. package/src/shared/contracts/validation.ts +296 -0
  250. package/src/shared/errors/facet-error.ts +127 -0
  251. package/src/shared/errors/store-error.ts +68 -0
  252. package/src/shared/evidence-image.ts +37 -0
  253. package/src/shared/export.ts +31 -0
  254. package/src/shared/html/policy.ts +108 -0
  255. package/src/shared/html/style-vocabulary.ts +352 -0
  256. package/src/shared/logging/logger.ts +108 -0
  257. package/src/shared/logging/redact.ts +49 -0
  258. package/src/shared/security/frozen-csp.ts +13 -0
  259. package/src/shared/storage-version.ts +2 -0
  260. package/src/shared/tsx/execution.ts +29 -0
  261. package/src/shared/tsx/import-policy.ts +94 -0
  262. package/src/shared/util/dir-permissions.ts +94 -0
  263. package/src/shared/util/mermaid-nodes.ts +230 -0
  264. package/src/shared/util/process.ts +67 -0
  265. package/src/shared/util/time.ts +21 -0
  266. package/src/shared/version.ts +3 -0
  267. package/src/validation/sandbox/limits.ts +41 -0
  268. package/src/validation/sandbox/netns.ts +177 -0
  269. package/src/validation/tier0/chart.ts +177 -0
  270. package/src/validation/tier0/dom-shim.ts +54 -0
  271. package/src/validation/tier0/html.ts +408 -0
  272. package/src/validation/tier0/markdown.ts +285 -0
  273. package/src/validation/tier0/mermaid.ts +98 -0
  274. package/src/validation/tier0/runner.ts +504 -0
  275. package/src/validation/tier0/svg.ts +321 -0
  276. package/src/validation/tier0/tsx/allowlist-resolver.ts +77 -0
  277. package/src/validation/tier0/tsx/ast-policy-capabilities.ts +238 -0
  278. package/src/validation/tier0/tsx/ast-policy-shared.ts +71 -0
  279. package/src/validation/tier0/tsx/ast-policy.ts +181 -0
  280. package/src/validation/tier0/tsx/compiler.ts +156 -0
  281. package/src/validation/tier0/worker-dispatch.ts +211 -0
  282. package/src/validation/tier0/worker-entry.ts +96 -0
  283. package/src/validation/tier0/worker-input.ts +75 -0
  284. package/src/validation/tier1/browser-process.ts +147 -0
  285. package/src/validation/tier1/cdp-pipe.ts +281 -0
  286. package/src/validation/tier1/entries/chart.ts +5 -0
  287. package/src/validation/tier1/entries/html.ts +6 -0
  288. package/src/validation/tier1/entries/markdown.ts +5 -0
  289. package/src/validation/tier1/entries/mermaid.ts +5 -0
  290. package/src/validation/tier1/entries/svg.ts +5 -0
  291. package/src/validation/tier1/entries/tsx.ts +5 -0
  292. package/src/validation/tier1/frame-target.ts +162 -0
  293. package/src/validation/tier1/harness-entry.ts +261 -0
  294. package/src/validation/tier1/harness.ts +215 -0
  295. package/src/validation/tier1/isolated-probe.ts +94 -0
  296. package/src/validation/tier1/launcher.ts +177 -0
  297. package/src/validation/tier1/limits.ts +80 -0
  298. package/src/validation/tier1/nonce.ts +17 -0
  299. package/src/validation/tier1/protocol-probe.ts +519 -0
  300. package/src/validation/tier1/runner.ts +1122 -0
  301. package/src/validation/tier1/verdict.ts +246 -0
  302. package/src/validation/tier1/webp.ts +69 -0
  303. package/templates/README.md +88 -0
  304. package/templates/bar-compare.vl.json +63 -0
  305. package/templates/capacity-report.tsx +102 -0
  306. package/templates/decision-record.md +24 -0
  307. package/templates/deployment-state.mmd +40 -0
  308. package/templates/exemplar.md +91 -0
  309. package/templates/facet-story.tsx +799 -0
  310. package/templates/fleet-dashboard.html +141 -0
  311. package/templates/html-release-ledger.html +91 -0
  312. package/templates/html-status-report.html +114 -0
  313. package/templates/incident-console.tsx +147 -0
  314. package/templates/legion-boundaries.mmd +23 -0
  315. package/templates/legion-flow.mmd +15 -0
  316. package/templates/legion-sequence.mmd +14 -0
  317. package/templates/legion-state.mmd +7 -0
  318. package/templates/metric-card.svg +29 -0
  319. package/templates/observability-map.svg +101 -0
  320. package/templates/pipeline-audit.md +108 -0
  321. package/templates/release-metrics.vl.json +98 -0
  322. package/templates/service-topology.mmd +47 -0
  323. package/templates/status-report.md +32 -0
  324. package/templates/system-map.svg +53 -0
  325. package/templates/timeseries.vl.json +71 -0
  326. package/templates/tsx-interactive-counter.tsx +19 -0
  327. package/templates/tsx-status-report.tsx +31 -0
@@ -0,0 +1,4822 @@
1
+ import {
2
+ cytoscape as cytoscape2
3
+ } from "./markdown-eg6ngz7y.js";
4
+ import {
5
+ log,
6
+ select_default
7
+ } from "./markdown-xw8dsk8b.js";
8
+ import {
9
+ __name
10
+ } from "./markdown-1s5vwkf2.js";
11
+ import"./markdown-dy5sgjhc.js";
12
+ import {
13
+ __commonJS,
14
+ __toESM
15
+ } from "./markdown-809k7q41.js";
16
+
17
+ // node_modules/layout-base/layout-base.js
18
+ var require_layout_base = __commonJS(function(exports, module) {
19
+ (function webpackUniversalModuleDefinition(root, factory) {
20
+ if (typeof exports === "object" && typeof module === "object")
21
+ module.exports = factory();
22
+ else if (typeof define === "function" && define.amd)
23
+ define([], factory);
24
+ else if (typeof exports === "object")
25
+ exports["layoutBase"] = factory();
26
+ else
27
+ root["layoutBase"] = factory();
28
+ })(exports, function() {
29
+ return function(modules) {
30
+ var installedModules = {};
31
+ function __webpack_require__(moduleId) {
32
+ if (installedModules[moduleId]) {
33
+ return installedModules[moduleId].exports;
34
+ }
35
+ var module2 = installedModules[moduleId] = {
36
+ i: moduleId,
37
+ l: false,
38
+ exports: {}
39
+ };
40
+ modules[moduleId].call(module2.exports, module2, module2.exports, __webpack_require__);
41
+ module2.l = true;
42
+ return module2.exports;
43
+ }
44
+ __webpack_require__.m = modules;
45
+ __webpack_require__.c = installedModules;
46
+ __webpack_require__.i = function(value) {
47
+ return value;
48
+ };
49
+ __webpack_require__.d = function(exports2, name, getter) {
50
+ if (!__webpack_require__.o(exports2, name)) {
51
+ Object.defineProperty(exports2, name, {
52
+ configurable: false,
53
+ enumerable: true,
54
+ get: getter
55
+ });
56
+ }
57
+ };
58
+ __webpack_require__.n = function(module2) {
59
+ var getter = module2 && module2.__esModule ? function getDefault() {
60
+ return module2["default"];
61
+ } : function getModuleExports() {
62
+ return module2;
63
+ };
64
+ __webpack_require__.d(getter, "a", getter);
65
+ return getter;
66
+ };
67
+ __webpack_require__.o = function(object, property) {
68
+ return Object.prototype.hasOwnProperty.call(object, property);
69
+ };
70
+ __webpack_require__.p = "";
71
+ return __webpack_require__(__webpack_require__.s = 26);
72
+ }([
73
+ function(module2, exports2, __webpack_require__) {
74
+ function LayoutConstants() {}
75
+ LayoutConstants.QUALITY = 1;
76
+ LayoutConstants.DEFAULT_CREATE_BENDS_AS_NEEDED = false;
77
+ LayoutConstants.DEFAULT_INCREMENTAL = false;
78
+ LayoutConstants.DEFAULT_ANIMATION_ON_LAYOUT = true;
79
+ LayoutConstants.DEFAULT_ANIMATION_DURING_LAYOUT = false;
80
+ LayoutConstants.DEFAULT_ANIMATION_PERIOD = 50;
81
+ LayoutConstants.DEFAULT_UNIFORM_LEAF_NODE_SIZES = false;
82
+ LayoutConstants.DEFAULT_GRAPH_MARGIN = 15;
83
+ LayoutConstants.NODE_DIMENSIONS_INCLUDE_LABELS = false;
84
+ LayoutConstants.SIMPLE_NODE_SIZE = 40;
85
+ LayoutConstants.SIMPLE_NODE_HALF_SIZE = LayoutConstants.SIMPLE_NODE_SIZE / 2;
86
+ LayoutConstants.EMPTY_COMPOUND_NODE_SIZE = 40;
87
+ LayoutConstants.MIN_EDGE_LENGTH = 1;
88
+ LayoutConstants.WORLD_BOUNDARY = 1e6;
89
+ LayoutConstants.INITIAL_WORLD_BOUNDARY = LayoutConstants.WORLD_BOUNDARY / 1000;
90
+ LayoutConstants.WORLD_CENTER_X = 1200;
91
+ LayoutConstants.WORLD_CENTER_Y = 900;
92
+ module2.exports = LayoutConstants;
93
+ },
94
+ function(module2, exports2, __webpack_require__) {
95
+ var LGraphObject = __webpack_require__(2);
96
+ var IGeometry = __webpack_require__(8);
97
+ var IMath = __webpack_require__(9);
98
+ function LEdge(source, target, vEdge) {
99
+ LGraphObject.call(this, vEdge);
100
+ this.isOverlapingSourceAndTarget = false;
101
+ this.vGraphObject = vEdge;
102
+ this.bendpoints = [];
103
+ this.source = source;
104
+ this.target = target;
105
+ }
106
+ LEdge.prototype = Object.create(LGraphObject.prototype);
107
+ for (var prop in LGraphObject) {
108
+ LEdge[prop] = LGraphObject[prop];
109
+ }
110
+ LEdge.prototype.getSource = function() {
111
+ return this.source;
112
+ };
113
+ LEdge.prototype.getTarget = function() {
114
+ return this.target;
115
+ };
116
+ LEdge.prototype.isInterGraph = function() {
117
+ return this.isInterGraph;
118
+ };
119
+ LEdge.prototype.getLength = function() {
120
+ return this.length;
121
+ };
122
+ LEdge.prototype.isOverlapingSourceAndTarget = function() {
123
+ return this.isOverlapingSourceAndTarget;
124
+ };
125
+ LEdge.prototype.getBendpoints = function() {
126
+ return this.bendpoints;
127
+ };
128
+ LEdge.prototype.getLca = function() {
129
+ return this.lca;
130
+ };
131
+ LEdge.prototype.getSourceInLca = function() {
132
+ return this.sourceInLca;
133
+ };
134
+ LEdge.prototype.getTargetInLca = function() {
135
+ return this.targetInLca;
136
+ };
137
+ LEdge.prototype.getOtherEnd = function(node) {
138
+ if (this.source === node) {
139
+ return this.target;
140
+ } else if (this.target === node) {
141
+ return this.source;
142
+ } else {
143
+ throw "Node is not incident with this edge";
144
+ }
145
+ };
146
+ LEdge.prototype.getOtherEndInGraph = function(node, graph) {
147
+ var otherEnd = this.getOtherEnd(node);
148
+ var root = graph.getGraphManager().getRoot();
149
+ while (true) {
150
+ if (otherEnd.getOwner() == graph) {
151
+ return otherEnd;
152
+ }
153
+ if (otherEnd.getOwner() == root) {
154
+ break;
155
+ }
156
+ otherEnd = otherEnd.getOwner().getParent();
157
+ }
158
+ return null;
159
+ };
160
+ LEdge.prototype.updateLength = function() {
161
+ var clipPointCoordinates = new Array(4);
162
+ this.isOverlapingSourceAndTarget = IGeometry.getIntersection(this.target.getRect(), this.source.getRect(), clipPointCoordinates);
163
+ if (!this.isOverlapingSourceAndTarget) {
164
+ this.lengthX = clipPointCoordinates[0] - clipPointCoordinates[2];
165
+ this.lengthY = clipPointCoordinates[1] - clipPointCoordinates[3];
166
+ if (Math.abs(this.lengthX) < 1) {
167
+ this.lengthX = IMath.sign(this.lengthX);
168
+ }
169
+ if (Math.abs(this.lengthY) < 1) {
170
+ this.lengthY = IMath.sign(this.lengthY);
171
+ }
172
+ this.length = Math.sqrt(this.lengthX * this.lengthX + this.lengthY * this.lengthY);
173
+ }
174
+ };
175
+ LEdge.prototype.updateLengthSimple = function() {
176
+ this.lengthX = this.target.getCenterX() - this.source.getCenterX();
177
+ this.lengthY = this.target.getCenterY() - this.source.getCenterY();
178
+ if (Math.abs(this.lengthX) < 1) {
179
+ this.lengthX = IMath.sign(this.lengthX);
180
+ }
181
+ if (Math.abs(this.lengthY) < 1) {
182
+ this.lengthY = IMath.sign(this.lengthY);
183
+ }
184
+ this.length = Math.sqrt(this.lengthX * this.lengthX + this.lengthY * this.lengthY);
185
+ };
186
+ module2.exports = LEdge;
187
+ },
188
+ function(module2, exports2, __webpack_require__) {
189
+ function LGraphObject(vGraphObject) {
190
+ this.vGraphObject = vGraphObject;
191
+ }
192
+ module2.exports = LGraphObject;
193
+ },
194
+ function(module2, exports2, __webpack_require__) {
195
+ var LGraphObject = __webpack_require__(2);
196
+ var Integer = __webpack_require__(10);
197
+ var RectangleD = __webpack_require__(13);
198
+ var LayoutConstants = __webpack_require__(0);
199
+ var RandomSeed = __webpack_require__(16);
200
+ var PointD = __webpack_require__(4);
201
+ function LNode(gm, loc, size, vNode) {
202
+ if (size == null && vNode == null) {
203
+ vNode = loc;
204
+ }
205
+ LGraphObject.call(this, vNode);
206
+ if (gm.graphManager != null)
207
+ gm = gm.graphManager;
208
+ this.estimatedSize = Integer.MIN_VALUE;
209
+ this.inclusionTreeDepth = Integer.MAX_VALUE;
210
+ this.vGraphObject = vNode;
211
+ this.edges = [];
212
+ this.graphManager = gm;
213
+ if (size != null && loc != null)
214
+ this.rect = new RectangleD(loc.x, loc.y, size.width, size.height);
215
+ else
216
+ this.rect = new RectangleD;
217
+ }
218
+ LNode.prototype = Object.create(LGraphObject.prototype);
219
+ for (var prop in LGraphObject) {
220
+ LNode[prop] = LGraphObject[prop];
221
+ }
222
+ LNode.prototype.getEdges = function() {
223
+ return this.edges;
224
+ };
225
+ LNode.prototype.getChild = function() {
226
+ return this.child;
227
+ };
228
+ LNode.prototype.getOwner = function() {
229
+ return this.owner;
230
+ };
231
+ LNode.prototype.getWidth = function() {
232
+ return this.rect.width;
233
+ };
234
+ LNode.prototype.setWidth = function(width) {
235
+ this.rect.width = width;
236
+ };
237
+ LNode.prototype.getHeight = function() {
238
+ return this.rect.height;
239
+ };
240
+ LNode.prototype.setHeight = function(height) {
241
+ this.rect.height = height;
242
+ };
243
+ LNode.prototype.getCenterX = function() {
244
+ return this.rect.x + this.rect.width / 2;
245
+ };
246
+ LNode.prototype.getCenterY = function() {
247
+ return this.rect.y + this.rect.height / 2;
248
+ };
249
+ LNode.prototype.getCenter = function() {
250
+ return new PointD(this.rect.x + this.rect.width / 2, this.rect.y + this.rect.height / 2);
251
+ };
252
+ LNode.prototype.getLocation = function() {
253
+ return new PointD(this.rect.x, this.rect.y);
254
+ };
255
+ LNode.prototype.getRect = function() {
256
+ return this.rect;
257
+ };
258
+ LNode.prototype.getDiagonal = function() {
259
+ return Math.sqrt(this.rect.width * this.rect.width + this.rect.height * this.rect.height);
260
+ };
261
+ LNode.prototype.getHalfTheDiagonal = function() {
262
+ return Math.sqrt(this.rect.height * this.rect.height + this.rect.width * this.rect.width) / 2;
263
+ };
264
+ LNode.prototype.setRect = function(upperLeft, dimension) {
265
+ this.rect.x = upperLeft.x;
266
+ this.rect.y = upperLeft.y;
267
+ this.rect.width = dimension.width;
268
+ this.rect.height = dimension.height;
269
+ };
270
+ LNode.prototype.setCenter = function(cx, cy) {
271
+ this.rect.x = cx - this.rect.width / 2;
272
+ this.rect.y = cy - this.rect.height / 2;
273
+ };
274
+ LNode.prototype.setLocation = function(x, y) {
275
+ this.rect.x = x;
276
+ this.rect.y = y;
277
+ };
278
+ LNode.prototype.moveBy = function(dx, dy) {
279
+ this.rect.x += dx;
280
+ this.rect.y += dy;
281
+ };
282
+ LNode.prototype.getEdgeListToNode = function(to) {
283
+ var edgeList = [];
284
+ var edge;
285
+ var self = this;
286
+ self.edges.forEach(function(edge2) {
287
+ if (edge2.target == to) {
288
+ if (edge2.source != self)
289
+ throw "Incorrect edge source!";
290
+ edgeList.push(edge2);
291
+ }
292
+ });
293
+ return edgeList;
294
+ };
295
+ LNode.prototype.getEdgesBetween = function(other) {
296
+ var edgeList = [];
297
+ var edge;
298
+ var self = this;
299
+ self.edges.forEach(function(edge2) {
300
+ if (!(edge2.source == self || edge2.target == self))
301
+ throw "Incorrect edge source and/or target";
302
+ if (edge2.target == other || edge2.source == other) {
303
+ edgeList.push(edge2);
304
+ }
305
+ });
306
+ return edgeList;
307
+ };
308
+ LNode.prototype.getNeighborsList = function() {
309
+ var neighbors = new Set;
310
+ var self = this;
311
+ self.edges.forEach(function(edge) {
312
+ if (edge.source == self) {
313
+ neighbors.add(edge.target);
314
+ } else {
315
+ if (edge.target != self) {
316
+ throw "Incorrect incidency!";
317
+ }
318
+ neighbors.add(edge.source);
319
+ }
320
+ });
321
+ return neighbors;
322
+ };
323
+ LNode.prototype.withChildren = function() {
324
+ var withNeighborsList = new Set;
325
+ var childNode;
326
+ var children;
327
+ withNeighborsList.add(this);
328
+ if (this.child != null) {
329
+ var nodes = this.child.getNodes();
330
+ for (var i = 0;i < nodes.length; i++) {
331
+ childNode = nodes[i];
332
+ children = childNode.withChildren();
333
+ children.forEach(function(node) {
334
+ withNeighborsList.add(node);
335
+ });
336
+ }
337
+ }
338
+ return withNeighborsList;
339
+ };
340
+ LNode.prototype.getNoOfChildren = function() {
341
+ var noOfChildren = 0;
342
+ var childNode;
343
+ if (this.child == null) {
344
+ noOfChildren = 1;
345
+ } else {
346
+ var nodes = this.child.getNodes();
347
+ for (var i = 0;i < nodes.length; i++) {
348
+ childNode = nodes[i];
349
+ noOfChildren += childNode.getNoOfChildren();
350
+ }
351
+ }
352
+ if (noOfChildren == 0) {
353
+ noOfChildren = 1;
354
+ }
355
+ return noOfChildren;
356
+ };
357
+ LNode.prototype.getEstimatedSize = function() {
358
+ if (this.estimatedSize == Integer.MIN_VALUE) {
359
+ throw "assert failed";
360
+ }
361
+ return this.estimatedSize;
362
+ };
363
+ LNode.prototype.calcEstimatedSize = function() {
364
+ if (this.child == null) {
365
+ return this.estimatedSize = (this.rect.width + this.rect.height) / 2;
366
+ } else {
367
+ this.estimatedSize = this.child.calcEstimatedSize();
368
+ this.rect.width = this.estimatedSize;
369
+ this.rect.height = this.estimatedSize;
370
+ return this.estimatedSize;
371
+ }
372
+ };
373
+ LNode.prototype.scatter = function() {
374
+ var randomCenterX;
375
+ var randomCenterY;
376
+ var minX = -LayoutConstants.INITIAL_WORLD_BOUNDARY;
377
+ var maxX = LayoutConstants.INITIAL_WORLD_BOUNDARY;
378
+ randomCenterX = LayoutConstants.WORLD_CENTER_X + RandomSeed.nextDouble() * (maxX - minX) + minX;
379
+ var minY = -LayoutConstants.INITIAL_WORLD_BOUNDARY;
380
+ var maxY = LayoutConstants.INITIAL_WORLD_BOUNDARY;
381
+ randomCenterY = LayoutConstants.WORLD_CENTER_Y + RandomSeed.nextDouble() * (maxY - minY) + minY;
382
+ this.rect.x = randomCenterX;
383
+ this.rect.y = randomCenterY;
384
+ };
385
+ LNode.prototype.updateBounds = function() {
386
+ if (this.getChild() == null) {
387
+ throw "assert failed";
388
+ }
389
+ if (this.getChild().getNodes().length != 0) {
390
+ var childGraph = this.getChild();
391
+ childGraph.updateBounds(true);
392
+ this.rect.x = childGraph.getLeft();
393
+ this.rect.y = childGraph.getTop();
394
+ this.setWidth(childGraph.getRight() - childGraph.getLeft());
395
+ this.setHeight(childGraph.getBottom() - childGraph.getTop());
396
+ if (LayoutConstants.NODE_DIMENSIONS_INCLUDE_LABELS) {
397
+ var width = childGraph.getRight() - childGraph.getLeft();
398
+ var height = childGraph.getBottom() - childGraph.getTop();
399
+ if (this.labelWidth > width) {
400
+ this.rect.x -= (this.labelWidth - width) / 2;
401
+ this.setWidth(this.labelWidth);
402
+ }
403
+ if (this.labelHeight > height) {
404
+ if (this.labelPos == "center") {
405
+ this.rect.y -= (this.labelHeight - height) / 2;
406
+ } else if (this.labelPos == "top") {
407
+ this.rect.y -= this.labelHeight - height;
408
+ }
409
+ this.setHeight(this.labelHeight);
410
+ }
411
+ }
412
+ }
413
+ };
414
+ LNode.prototype.getInclusionTreeDepth = function() {
415
+ if (this.inclusionTreeDepth == Integer.MAX_VALUE) {
416
+ throw "assert failed";
417
+ }
418
+ return this.inclusionTreeDepth;
419
+ };
420
+ LNode.prototype.transform = function(trans) {
421
+ var left = this.rect.x;
422
+ if (left > LayoutConstants.WORLD_BOUNDARY) {
423
+ left = LayoutConstants.WORLD_BOUNDARY;
424
+ } else if (left < -LayoutConstants.WORLD_BOUNDARY) {
425
+ left = -LayoutConstants.WORLD_BOUNDARY;
426
+ }
427
+ var top = this.rect.y;
428
+ if (top > LayoutConstants.WORLD_BOUNDARY) {
429
+ top = LayoutConstants.WORLD_BOUNDARY;
430
+ } else if (top < -LayoutConstants.WORLD_BOUNDARY) {
431
+ top = -LayoutConstants.WORLD_BOUNDARY;
432
+ }
433
+ var leftTop = new PointD(left, top);
434
+ var vLeftTop = trans.inverseTransformPoint(leftTop);
435
+ this.setLocation(vLeftTop.x, vLeftTop.y);
436
+ };
437
+ LNode.prototype.getLeft = function() {
438
+ return this.rect.x;
439
+ };
440
+ LNode.prototype.getRight = function() {
441
+ return this.rect.x + this.rect.width;
442
+ };
443
+ LNode.prototype.getTop = function() {
444
+ return this.rect.y;
445
+ };
446
+ LNode.prototype.getBottom = function() {
447
+ return this.rect.y + this.rect.height;
448
+ };
449
+ LNode.prototype.getParent = function() {
450
+ if (this.owner == null) {
451
+ return null;
452
+ }
453
+ return this.owner.getParent();
454
+ };
455
+ module2.exports = LNode;
456
+ },
457
+ function(module2, exports2, __webpack_require__) {
458
+ function PointD(x, y) {
459
+ if (x == null && y == null) {
460
+ this.x = 0;
461
+ this.y = 0;
462
+ } else {
463
+ this.x = x;
464
+ this.y = y;
465
+ }
466
+ }
467
+ PointD.prototype.getX = function() {
468
+ return this.x;
469
+ };
470
+ PointD.prototype.getY = function() {
471
+ return this.y;
472
+ };
473
+ PointD.prototype.setX = function(x) {
474
+ this.x = x;
475
+ };
476
+ PointD.prototype.setY = function(y) {
477
+ this.y = y;
478
+ };
479
+ PointD.prototype.getDifference = function(pt) {
480
+ return new DimensionD(this.x - pt.x, this.y - pt.y);
481
+ };
482
+ PointD.prototype.getCopy = function() {
483
+ return new PointD(this.x, this.y);
484
+ };
485
+ PointD.prototype.translate = function(dim) {
486
+ this.x += dim.width;
487
+ this.y += dim.height;
488
+ return this;
489
+ };
490
+ module2.exports = PointD;
491
+ },
492
+ function(module2, exports2, __webpack_require__) {
493
+ var LGraphObject = __webpack_require__(2);
494
+ var Integer = __webpack_require__(10);
495
+ var LayoutConstants = __webpack_require__(0);
496
+ var LGraphManager = __webpack_require__(6);
497
+ var LNode = __webpack_require__(3);
498
+ var LEdge = __webpack_require__(1);
499
+ var RectangleD = __webpack_require__(13);
500
+ var Point2 = __webpack_require__(12);
501
+ var LinkedList = __webpack_require__(11);
502
+ function LGraph(parent, obj2, vGraph) {
503
+ LGraphObject.call(this, vGraph);
504
+ this.estimatedSize = Integer.MIN_VALUE;
505
+ this.margin = LayoutConstants.DEFAULT_GRAPH_MARGIN;
506
+ this.edges = [];
507
+ this.nodes = [];
508
+ this.isConnected = false;
509
+ this.parent = parent;
510
+ if (obj2 != null && obj2 instanceof LGraphManager) {
511
+ this.graphManager = obj2;
512
+ } else if (obj2 != null && obj2 instanceof Layout) {
513
+ this.graphManager = obj2.graphManager;
514
+ }
515
+ }
516
+ LGraph.prototype = Object.create(LGraphObject.prototype);
517
+ for (var prop in LGraphObject) {
518
+ LGraph[prop] = LGraphObject[prop];
519
+ }
520
+ LGraph.prototype.getNodes = function() {
521
+ return this.nodes;
522
+ };
523
+ LGraph.prototype.getEdges = function() {
524
+ return this.edges;
525
+ };
526
+ LGraph.prototype.getGraphManager = function() {
527
+ return this.graphManager;
528
+ };
529
+ LGraph.prototype.getParent = function() {
530
+ return this.parent;
531
+ };
532
+ LGraph.prototype.getLeft = function() {
533
+ return this.left;
534
+ };
535
+ LGraph.prototype.getRight = function() {
536
+ return this.right;
537
+ };
538
+ LGraph.prototype.getTop = function() {
539
+ return this.top;
540
+ };
541
+ LGraph.prototype.getBottom = function() {
542
+ return this.bottom;
543
+ };
544
+ LGraph.prototype.isConnected = function() {
545
+ return this.isConnected;
546
+ };
547
+ LGraph.prototype.add = function(obj1, sourceNode, targetNode) {
548
+ if (sourceNode == null && targetNode == null) {
549
+ var newNode = obj1;
550
+ if (this.graphManager == null) {
551
+ throw "Graph has no graph mgr!";
552
+ }
553
+ if (this.getNodes().indexOf(newNode) > -1) {
554
+ throw "Node already in graph!";
555
+ }
556
+ newNode.owner = this;
557
+ this.getNodes().push(newNode);
558
+ return newNode;
559
+ } else {
560
+ var newEdge = obj1;
561
+ if (!(this.getNodes().indexOf(sourceNode) > -1 && this.getNodes().indexOf(targetNode) > -1)) {
562
+ throw "Source or target not in graph!";
563
+ }
564
+ if (!(sourceNode.owner == targetNode.owner && sourceNode.owner == this)) {
565
+ throw "Both owners must be this graph!";
566
+ }
567
+ if (sourceNode.owner != targetNode.owner) {
568
+ return null;
569
+ }
570
+ newEdge.source = sourceNode;
571
+ newEdge.target = targetNode;
572
+ newEdge.isInterGraph = false;
573
+ this.getEdges().push(newEdge);
574
+ sourceNode.edges.push(newEdge);
575
+ if (targetNode != sourceNode) {
576
+ targetNode.edges.push(newEdge);
577
+ }
578
+ return newEdge;
579
+ }
580
+ };
581
+ LGraph.prototype.remove = function(obj) {
582
+ var node = obj;
583
+ if (obj instanceof LNode) {
584
+ if (node == null) {
585
+ throw "Node is null!";
586
+ }
587
+ if (!(node.owner != null && node.owner == this)) {
588
+ throw "Owner graph is invalid!";
589
+ }
590
+ if (this.graphManager == null) {
591
+ throw "Owner graph manager is invalid!";
592
+ }
593
+ var edgesToBeRemoved = node.edges.slice();
594
+ var edge;
595
+ var s = edgesToBeRemoved.length;
596
+ for (var i = 0;i < s; i++) {
597
+ edge = edgesToBeRemoved[i];
598
+ if (edge.isInterGraph) {
599
+ this.graphManager.remove(edge);
600
+ } else {
601
+ edge.source.owner.remove(edge);
602
+ }
603
+ }
604
+ var index = this.nodes.indexOf(node);
605
+ if (index == -1) {
606
+ throw "Node not in owner node list!";
607
+ }
608
+ this.nodes.splice(index, 1);
609
+ } else if (obj instanceof LEdge) {
610
+ var edge = obj;
611
+ if (edge == null) {
612
+ throw "Edge is null!";
613
+ }
614
+ if (!(edge.source != null && edge.target != null)) {
615
+ throw "Source and/or target is null!";
616
+ }
617
+ if (!(edge.source.owner != null && edge.target.owner != null && edge.source.owner == this && edge.target.owner == this)) {
618
+ throw "Source and/or target owner is invalid!";
619
+ }
620
+ var sourceIndex = edge.source.edges.indexOf(edge);
621
+ var targetIndex = edge.target.edges.indexOf(edge);
622
+ if (!(sourceIndex > -1 && targetIndex > -1)) {
623
+ throw "Source and/or target doesn't know this edge!";
624
+ }
625
+ edge.source.edges.splice(sourceIndex, 1);
626
+ if (edge.target != edge.source) {
627
+ edge.target.edges.splice(targetIndex, 1);
628
+ }
629
+ var index = edge.source.owner.getEdges().indexOf(edge);
630
+ if (index == -1) {
631
+ throw "Not in owner's edge list!";
632
+ }
633
+ edge.source.owner.getEdges().splice(index, 1);
634
+ }
635
+ };
636
+ LGraph.prototype.updateLeftTop = function() {
637
+ var top = Integer.MAX_VALUE;
638
+ var left = Integer.MAX_VALUE;
639
+ var nodeTop;
640
+ var nodeLeft;
641
+ var margin;
642
+ var nodes = this.getNodes();
643
+ var s = nodes.length;
644
+ for (var i = 0;i < s; i++) {
645
+ var lNode = nodes[i];
646
+ nodeTop = lNode.getTop();
647
+ nodeLeft = lNode.getLeft();
648
+ if (top > nodeTop) {
649
+ top = nodeTop;
650
+ }
651
+ if (left > nodeLeft) {
652
+ left = nodeLeft;
653
+ }
654
+ }
655
+ if (top == Integer.MAX_VALUE) {
656
+ return null;
657
+ }
658
+ if (nodes[0].getParent().paddingLeft != null) {
659
+ margin = nodes[0].getParent().paddingLeft;
660
+ } else {
661
+ margin = this.margin;
662
+ }
663
+ this.left = left - margin;
664
+ this.top = top - margin;
665
+ return new Point2(this.left, this.top);
666
+ };
667
+ LGraph.prototype.updateBounds = function(recursive) {
668
+ var left = Integer.MAX_VALUE;
669
+ var right = -Integer.MAX_VALUE;
670
+ var top = Integer.MAX_VALUE;
671
+ var bottom = -Integer.MAX_VALUE;
672
+ var nodeLeft;
673
+ var nodeRight;
674
+ var nodeTop;
675
+ var nodeBottom;
676
+ var margin;
677
+ var nodes = this.nodes;
678
+ var s = nodes.length;
679
+ for (var i = 0;i < s; i++) {
680
+ var lNode = nodes[i];
681
+ if (recursive && lNode.child != null) {
682
+ lNode.updateBounds();
683
+ }
684
+ nodeLeft = lNode.getLeft();
685
+ nodeRight = lNode.getRight();
686
+ nodeTop = lNode.getTop();
687
+ nodeBottom = lNode.getBottom();
688
+ if (left > nodeLeft) {
689
+ left = nodeLeft;
690
+ }
691
+ if (right < nodeRight) {
692
+ right = nodeRight;
693
+ }
694
+ if (top > nodeTop) {
695
+ top = nodeTop;
696
+ }
697
+ if (bottom < nodeBottom) {
698
+ bottom = nodeBottom;
699
+ }
700
+ }
701
+ var boundingRect = new RectangleD(left, top, right - left, bottom - top);
702
+ if (left == Integer.MAX_VALUE) {
703
+ this.left = this.parent.getLeft();
704
+ this.right = this.parent.getRight();
705
+ this.top = this.parent.getTop();
706
+ this.bottom = this.parent.getBottom();
707
+ }
708
+ if (nodes[0].getParent().paddingLeft != null) {
709
+ margin = nodes[0].getParent().paddingLeft;
710
+ } else {
711
+ margin = this.margin;
712
+ }
713
+ this.left = boundingRect.x - margin;
714
+ this.right = boundingRect.x + boundingRect.width + margin;
715
+ this.top = boundingRect.y - margin;
716
+ this.bottom = boundingRect.y + boundingRect.height + margin;
717
+ };
718
+ LGraph.calculateBounds = function(nodes) {
719
+ var left = Integer.MAX_VALUE;
720
+ var right = -Integer.MAX_VALUE;
721
+ var top = Integer.MAX_VALUE;
722
+ var bottom = -Integer.MAX_VALUE;
723
+ var nodeLeft;
724
+ var nodeRight;
725
+ var nodeTop;
726
+ var nodeBottom;
727
+ var s = nodes.length;
728
+ for (var i = 0;i < s; i++) {
729
+ var lNode = nodes[i];
730
+ nodeLeft = lNode.getLeft();
731
+ nodeRight = lNode.getRight();
732
+ nodeTop = lNode.getTop();
733
+ nodeBottom = lNode.getBottom();
734
+ if (left > nodeLeft) {
735
+ left = nodeLeft;
736
+ }
737
+ if (right < nodeRight) {
738
+ right = nodeRight;
739
+ }
740
+ if (top > nodeTop) {
741
+ top = nodeTop;
742
+ }
743
+ if (bottom < nodeBottom) {
744
+ bottom = nodeBottom;
745
+ }
746
+ }
747
+ var boundingRect = new RectangleD(left, top, right - left, bottom - top);
748
+ return boundingRect;
749
+ };
750
+ LGraph.prototype.getInclusionTreeDepth = function() {
751
+ if (this == this.graphManager.getRoot()) {
752
+ return 1;
753
+ } else {
754
+ return this.parent.getInclusionTreeDepth();
755
+ }
756
+ };
757
+ LGraph.prototype.getEstimatedSize = function() {
758
+ if (this.estimatedSize == Integer.MIN_VALUE) {
759
+ throw "assert failed";
760
+ }
761
+ return this.estimatedSize;
762
+ };
763
+ LGraph.prototype.calcEstimatedSize = function() {
764
+ var size = 0;
765
+ var nodes = this.nodes;
766
+ var s = nodes.length;
767
+ for (var i = 0;i < s; i++) {
768
+ var lNode = nodes[i];
769
+ size += lNode.calcEstimatedSize();
770
+ }
771
+ if (size == 0) {
772
+ this.estimatedSize = LayoutConstants.EMPTY_COMPOUND_NODE_SIZE;
773
+ } else {
774
+ this.estimatedSize = size / Math.sqrt(this.nodes.length);
775
+ }
776
+ return this.estimatedSize;
777
+ };
778
+ LGraph.prototype.updateConnected = function() {
779
+ var self = this;
780
+ if (this.nodes.length == 0) {
781
+ this.isConnected = true;
782
+ return;
783
+ }
784
+ var queue = new LinkedList;
785
+ var visited = new Set;
786
+ var currentNode = this.nodes[0];
787
+ var neighborEdges;
788
+ var currentNeighbor;
789
+ var childrenOfNode = currentNode.withChildren();
790
+ childrenOfNode.forEach(function(node) {
791
+ queue.push(node);
792
+ visited.add(node);
793
+ });
794
+ while (queue.length !== 0) {
795
+ currentNode = queue.shift();
796
+ neighborEdges = currentNode.getEdges();
797
+ var size = neighborEdges.length;
798
+ for (var i = 0;i < size; i++) {
799
+ var neighborEdge = neighborEdges[i];
800
+ currentNeighbor = neighborEdge.getOtherEndInGraph(currentNode, this);
801
+ if (currentNeighbor != null && !visited.has(currentNeighbor)) {
802
+ var childrenOfNeighbor = currentNeighbor.withChildren();
803
+ childrenOfNeighbor.forEach(function(node) {
804
+ queue.push(node);
805
+ visited.add(node);
806
+ });
807
+ }
808
+ }
809
+ }
810
+ this.isConnected = false;
811
+ if (visited.size >= this.nodes.length) {
812
+ var noOfVisitedInThisGraph = 0;
813
+ visited.forEach(function(visitedNode) {
814
+ if (visitedNode.owner == self) {
815
+ noOfVisitedInThisGraph++;
816
+ }
817
+ });
818
+ if (noOfVisitedInThisGraph == this.nodes.length) {
819
+ this.isConnected = true;
820
+ }
821
+ }
822
+ };
823
+ module2.exports = LGraph;
824
+ },
825
+ function(module2, exports2, __webpack_require__) {
826
+ var LGraph;
827
+ var LEdge = __webpack_require__(1);
828
+ function LGraphManager(layout) {
829
+ LGraph = __webpack_require__(5);
830
+ this.layout = layout;
831
+ this.graphs = [];
832
+ this.edges = [];
833
+ }
834
+ LGraphManager.prototype.addRoot = function() {
835
+ var ngraph = this.layout.newGraph();
836
+ var nnode = this.layout.newNode(null);
837
+ var root = this.add(ngraph, nnode);
838
+ this.setRootGraph(root);
839
+ return this.rootGraph;
840
+ };
841
+ LGraphManager.prototype.add = function(newGraph, parentNode, newEdge, sourceNode, targetNode) {
842
+ if (newEdge == null && sourceNode == null && targetNode == null) {
843
+ if (newGraph == null) {
844
+ throw "Graph is null!";
845
+ }
846
+ if (parentNode == null) {
847
+ throw "Parent node is null!";
848
+ }
849
+ if (this.graphs.indexOf(newGraph) > -1) {
850
+ throw "Graph already in this graph mgr!";
851
+ }
852
+ this.graphs.push(newGraph);
853
+ if (newGraph.parent != null) {
854
+ throw "Already has a parent!";
855
+ }
856
+ if (parentNode.child != null) {
857
+ throw "Already has a child!";
858
+ }
859
+ newGraph.parent = parentNode;
860
+ parentNode.child = newGraph;
861
+ return newGraph;
862
+ } else {
863
+ targetNode = newEdge;
864
+ sourceNode = parentNode;
865
+ newEdge = newGraph;
866
+ var sourceGraph = sourceNode.getOwner();
867
+ var targetGraph = targetNode.getOwner();
868
+ if (!(sourceGraph != null && sourceGraph.getGraphManager() == this)) {
869
+ throw "Source not in this graph mgr!";
870
+ }
871
+ if (!(targetGraph != null && targetGraph.getGraphManager() == this)) {
872
+ throw "Target not in this graph mgr!";
873
+ }
874
+ if (sourceGraph == targetGraph) {
875
+ newEdge.isInterGraph = false;
876
+ return sourceGraph.add(newEdge, sourceNode, targetNode);
877
+ } else {
878
+ newEdge.isInterGraph = true;
879
+ newEdge.source = sourceNode;
880
+ newEdge.target = targetNode;
881
+ if (this.edges.indexOf(newEdge) > -1) {
882
+ throw "Edge already in inter-graph edge list!";
883
+ }
884
+ this.edges.push(newEdge);
885
+ if (!(newEdge.source != null && newEdge.target != null)) {
886
+ throw "Edge source and/or target is null!";
887
+ }
888
+ if (!(newEdge.source.edges.indexOf(newEdge) == -1 && newEdge.target.edges.indexOf(newEdge) == -1)) {
889
+ throw "Edge already in source and/or target incidency list!";
890
+ }
891
+ newEdge.source.edges.push(newEdge);
892
+ newEdge.target.edges.push(newEdge);
893
+ return newEdge;
894
+ }
895
+ }
896
+ };
897
+ LGraphManager.prototype.remove = function(lObj) {
898
+ if (lObj instanceof LGraph) {
899
+ var graph = lObj;
900
+ if (graph.getGraphManager() != this) {
901
+ throw "Graph not in this graph mgr";
902
+ }
903
+ if (!(graph == this.rootGraph || graph.parent != null && graph.parent.graphManager == this)) {
904
+ throw "Invalid parent node!";
905
+ }
906
+ var edgesToBeRemoved = [];
907
+ edgesToBeRemoved = edgesToBeRemoved.concat(graph.getEdges());
908
+ var edge;
909
+ var s = edgesToBeRemoved.length;
910
+ for (var i = 0;i < s; i++) {
911
+ edge = edgesToBeRemoved[i];
912
+ graph.remove(edge);
913
+ }
914
+ var nodesToBeRemoved = [];
915
+ nodesToBeRemoved = nodesToBeRemoved.concat(graph.getNodes());
916
+ var node;
917
+ s = nodesToBeRemoved.length;
918
+ for (var i = 0;i < s; i++) {
919
+ node = nodesToBeRemoved[i];
920
+ graph.remove(node);
921
+ }
922
+ if (graph == this.rootGraph) {
923
+ this.setRootGraph(null);
924
+ }
925
+ var index = this.graphs.indexOf(graph);
926
+ this.graphs.splice(index, 1);
927
+ graph.parent = null;
928
+ } else if (lObj instanceof LEdge) {
929
+ edge = lObj;
930
+ if (edge == null) {
931
+ throw "Edge is null!";
932
+ }
933
+ if (!edge.isInterGraph) {
934
+ throw "Not an inter-graph edge!";
935
+ }
936
+ if (!(edge.source != null && edge.target != null)) {
937
+ throw "Source and/or target is null!";
938
+ }
939
+ if (!(edge.source.edges.indexOf(edge) != -1 && edge.target.edges.indexOf(edge) != -1)) {
940
+ throw "Source and/or target doesn't know this edge!";
941
+ }
942
+ var index = edge.source.edges.indexOf(edge);
943
+ edge.source.edges.splice(index, 1);
944
+ index = edge.target.edges.indexOf(edge);
945
+ edge.target.edges.splice(index, 1);
946
+ if (!(edge.source.owner != null && edge.source.owner.getGraphManager() != null)) {
947
+ throw "Edge owner graph or owner graph manager is null!";
948
+ }
949
+ if (edge.source.owner.getGraphManager().edges.indexOf(edge) == -1) {
950
+ throw "Not in owner graph manager's edge list!";
951
+ }
952
+ var index = edge.source.owner.getGraphManager().edges.indexOf(edge);
953
+ edge.source.owner.getGraphManager().edges.splice(index, 1);
954
+ }
955
+ };
956
+ LGraphManager.prototype.updateBounds = function() {
957
+ this.rootGraph.updateBounds(true);
958
+ };
959
+ LGraphManager.prototype.getGraphs = function() {
960
+ return this.graphs;
961
+ };
962
+ LGraphManager.prototype.getAllNodes = function() {
963
+ if (this.allNodes == null) {
964
+ var nodeList = [];
965
+ var graphs = this.getGraphs();
966
+ var s = graphs.length;
967
+ for (var i = 0;i < s; i++) {
968
+ nodeList = nodeList.concat(graphs[i].getNodes());
969
+ }
970
+ this.allNodes = nodeList;
971
+ }
972
+ return this.allNodes;
973
+ };
974
+ LGraphManager.prototype.resetAllNodes = function() {
975
+ this.allNodes = null;
976
+ };
977
+ LGraphManager.prototype.resetAllEdges = function() {
978
+ this.allEdges = null;
979
+ };
980
+ LGraphManager.prototype.resetAllNodesToApplyGravitation = function() {
981
+ this.allNodesToApplyGravitation = null;
982
+ };
983
+ LGraphManager.prototype.getAllEdges = function() {
984
+ if (this.allEdges == null) {
985
+ var edgeList = [];
986
+ var graphs = this.getGraphs();
987
+ var s = graphs.length;
988
+ for (var i = 0;i < graphs.length; i++) {
989
+ edgeList = edgeList.concat(graphs[i].getEdges());
990
+ }
991
+ edgeList = edgeList.concat(this.edges);
992
+ this.allEdges = edgeList;
993
+ }
994
+ return this.allEdges;
995
+ };
996
+ LGraphManager.prototype.getAllNodesToApplyGravitation = function() {
997
+ return this.allNodesToApplyGravitation;
998
+ };
999
+ LGraphManager.prototype.setAllNodesToApplyGravitation = function(nodeList) {
1000
+ if (this.allNodesToApplyGravitation != null) {
1001
+ throw "assert failed";
1002
+ }
1003
+ this.allNodesToApplyGravitation = nodeList;
1004
+ };
1005
+ LGraphManager.prototype.getRoot = function() {
1006
+ return this.rootGraph;
1007
+ };
1008
+ LGraphManager.prototype.setRootGraph = function(graph) {
1009
+ if (graph.getGraphManager() != this) {
1010
+ throw "Root not in this graph mgr!";
1011
+ }
1012
+ this.rootGraph = graph;
1013
+ if (graph.parent == null) {
1014
+ graph.parent = this.layout.newNode("Root node");
1015
+ }
1016
+ };
1017
+ LGraphManager.prototype.getLayout = function() {
1018
+ return this.layout;
1019
+ };
1020
+ LGraphManager.prototype.isOneAncestorOfOther = function(firstNode, secondNode) {
1021
+ if (!(firstNode != null && secondNode != null)) {
1022
+ throw "assert failed";
1023
+ }
1024
+ if (firstNode == secondNode) {
1025
+ return true;
1026
+ }
1027
+ var ownerGraph = firstNode.getOwner();
1028
+ var parentNode;
1029
+ do {
1030
+ parentNode = ownerGraph.getParent();
1031
+ if (parentNode == null) {
1032
+ break;
1033
+ }
1034
+ if (parentNode == secondNode) {
1035
+ return true;
1036
+ }
1037
+ ownerGraph = parentNode.getOwner();
1038
+ if (ownerGraph == null) {
1039
+ break;
1040
+ }
1041
+ } while (true);
1042
+ ownerGraph = secondNode.getOwner();
1043
+ do {
1044
+ parentNode = ownerGraph.getParent();
1045
+ if (parentNode == null) {
1046
+ break;
1047
+ }
1048
+ if (parentNode == firstNode) {
1049
+ return true;
1050
+ }
1051
+ ownerGraph = parentNode.getOwner();
1052
+ if (ownerGraph == null) {
1053
+ break;
1054
+ }
1055
+ } while (true);
1056
+ return false;
1057
+ };
1058
+ LGraphManager.prototype.calcLowestCommonAncestors = function() {
1059
+ var edge;
1060
+ var sourceNode;
1061
+ var targetNode;
1062
+ var sourceAncestorGraph;
1063
+ var targetAncestorGraph;
1064
+ var edges = this.getAllEdges();
1065
+ var s = edges.length;
1066
+ for (var i = 0;i < s; i++) {
1067
+ edge = edges[i];
1068
+ sourceNode = edge.source;
1069
+ targetNode = edge.target;
1070
+ edge.lca = null;
1071
+ edge.sourceInLca = sourceNode;
1072
+ edge.targetInLca = targetNode;
1073
+ if (sourceNode == targetNode) {
1074
+ edge.lca = sourceNode.getOwner();
1075
+ continue;
1076
+ }
1077
+ sourceAncestorGraph = sourceNode.getOwner();
1078
+ while (edge.lca == null) {
1079
+ edge.targetInLca = targetNode;
1080
+ targetAncestorGraph = targetNode.getOwner();
1081
+ while (edge.lca == null) {
1082
+ if (targetAncestorGraph == sourceAncestorGraph) {
1083
+ edge.lca = targetAncestorGraph;
1084
+ break;
1085
+ }
1086
+ if (targetAncestorGraph == this.rootGraph) {
1087
+ break;
1088
+ }
1089
+ if (edge.lca != null) {
1090
+ throw "assert failed";
1091
+ }
1092
+ edge.targetInLca = targetAncestorGraph.getParent();
1093
+ targetAncestorGraph = edge.targetInLca.getOwner();
1094
+ }
1095
+ if (sourceAncestorGraph == this.rootGraph) {
1096
+ break;
1097
+ }
1098
+ if (edge.lca == null) {
1099
+ edge.sourceInLca = sourceAncestorGraph.getParent();
1100
+ sourceAncestorGraph = edge.sourceInLca.getOwner();
1101
+ }
1102
+ }
1103
+ if (edge.lca == null) {
1104
+ throw "assert failed";
1105
+ }
1106
+ }
1107
+ };
1108
+ LGraphManager.prototype.calcLowestCommonAncestor = function(firstNode, secondNode) {
1109
+ if (firstNode == secondNode) {
1110
+ return firstNode.getOwner();
1111
+ }
1112
+ var firstOwnerGraph = firstNode.getOwner();
1113
+ do {
1114
+ if (firstOwnerGraph == null) {
1115
+ break;
1116
+ }
1117
+ var secondOwnerGraph = secondNode.getOwner();
1118
+ do {
1119
+ if (secondOwnerGraph == null) {
1120
+ break;
1121
+ }
1122
+ if (secondOwnerGraph == firstOwnerGraph) {
1123
+ return secondOwnerGraph;
1124
+ }
1125
+ secondOwnerGraph = secondOwnerGraph.getParent().getOwner();
1126
+ } while (true);
1127
+ firstOwnerGraph = firstOwnerGraph.getParent().getOwner();
1128
+ } while (true);
1129
+ return firstOwnerGraph;
1130
+ };
1131
+ LGraphManager.prototype.calcInclusionTreeDepths = function(graph, depth) {
1132
+ if (graph == null && depth == null) {
1133
+ graph = this.rootGraph;
1134
+ depth = 1;
1135
+ }
1136
+ var node;
1137
+ var nodes = graph.getNodes();
1138
+ var s = nodes.length;
1139
+ for (var i = 0;i < s; i++) {
1140
+ node = nodes[i];
1141
+ node.inclusionTreeDepth = depth;
1142
+ if (node.child != null) {
1143
+ this.calcInclusionTreeDepths(node.child, depth + 1);
1144
+ }
1145
+ }
1146
+ };
1147
+ LGraphManager.prototype.includesInvalidEdge = function() {
1148
+ var edge;
1149
+ var s = this.edges.length;
1150
+ for (var i = 0;i < s; i++) {
1151
+ edge = this.edges[i];
1152
+ if (this.isOneAncestorOfOther(edge.source, edge.target)) {
1153
+ return true;
1154
+ }
1155
+ }
1156
+ return false;
1157
+ };
1158
+ module2.exports = LGraphManager;
1159
+ },
1160
+ function(module2, exports2, __webpack_require__) {
1161
+ var LayoutConstants = __webpack_require__(0);
1162
+ function FDLayoutConstants() {}
1163
+ for (var prop in LayoutConstants) {
1164
+ FDLayoutConstants[prop] = LayoutConstants[prop];
1165
+ }
1166
+ FDLayoutConstants.MAX_ITERATIONS = 2500;
1167
+ FDLayoutConstants.DEFAULT_EDGE_LENGTH = 50;
1168
+ FDLayoutConstants.DEFAULT_SPRING_STRENGTH = 0.45;
1169
+ FDLayoutConstants.DEFAULT_REPULSION_STRENGTH = 4500;
1170
+ FDLayoutConstants.DEFAULT_GRAVITY_STRENGTH = 0.4;
1171
+ FDLayoutConstants.DEFAULT_COMPOUND_GRAVITY_STRENGTH = 1;
1172
+ FDLayoutConstants.DEFAULT_GRAVITY_RANGE_FACTOR = 3.8;
1173
+ FDLayoutConstants.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR = 1.5;
1174
+ FDLayoutConstants.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION = true;
1175
+ FDLayoutConstants.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION = true;
1176
+ FDLayoutConstants.DEFAULT_COOLING_FACTOR_INCREMENTAL = 0.3;
1177
+ FDLayoutConstants.COOLING_ADAPTATION_FACTOR = 0.33;
1178
+ FDLayoutConstants.ADAPTATION_LOWER_NODE_LIMIT = 1000;
1179
+ FDLayoutConstants.ADAPTATION_UPPER_NODE_LIMIT = 5000;
1180
+ FDLayoutConstants.MAX_NODE_DISPLACEMENT_INCREMENTAL = 100;
1181
+ FDLayoutConstants.MAX_NODE_DISPLACEMENT = FDLayoutConstants.MAX_NODE_DISPLACEMENT_INCREMENTAL * 3;
1182
+ FDLayoutConstants.MIN_REPULSION_DIST = FDLayoutConstants.DEFAULT_EDGE_LENGTH / 10;
1183
+ FDLayoutConstants.CONVERGENCE_CHECK_PERIOD = 100;
1184
+ FDLayoutConstants.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR = 0.1;
1185
+ FDLayoutConstants.MIN_EDGE_LENGTH = 1;
1186
+ FDLayoutConstants.GRID_CALCULATION_CHECK_PERIOD = 10;
1187
+ module2.exports = FDLayoutConstants;
1188
+ },
1189
+ function(module2, exports2, __webpack_require__) {
1190
+ var Point2 = __webpack_require__(12);
1191
+ function IGeometry() {}
1192
+ IGeometry.calcSeparationAmount = function(rectA, rectB, overlapAmount, separationBuffer) {
1193
+ if (!rectA.intersects(rectB)) {
1194
+ throw "assert failed";
1195
+ }
1196
+ var directions = new Array(2);
1197
+ this.decideDirectionsForOverlappingNodes(rectA, rectB, directions);
1198
+ overlapAmount[0] = Math.min(rectA.getRight(), rectB.getRight()) - Math.max(rectA.x, rectB.x);
1199
+ overlapAmount[1] = Math.min(rectA.getBottom(), rectB.getBottom()) - Math.max(rectA.y, rectB.y);
1200
+ if (rectA.getX() <= rectB.getX() && rectA.getRight() >= rectB.getRight()) {
1201
+ overlapAmount[0] += Math.min(rectB.getX() - rectA.getX(), rectA.getRight() - rectB.getRight());
1202
+ } else if (rectB.getX() <= rectA.getX() && rectB.getRight() >= rectA.getRight()) {
1203
+ overlapAmount[0] += Math.min(rectA.getX() - rectB.getX(), rectB.getRight() - rectA.getRight());
1204
+ }
1205
+ if (rectA.getY() <= rectB.getY() && rectA.getBottom() >= rectB.getBottom()) {
1206
+ overlapAmount[1] += Math.min(rectB.getY() - rectA.getY(), rectA.getBottom() - rectB.getBottom());
1207
+ } else if (rectB.getY() <= rectA.getY() && rectB.getBottom() >= rectA.getBottom()) {
1208
+ overlapAmount[1] += Math.min(rectA.getY() - rectB.getY(), rectB.getBottom() - rectA.getBottom());
1209
+ }
1210
+ var slope = Math.abs((rectB.getCenterY() - rectA.getCenterY()) / (rectB.getCenterX() - rectA.getCenterX()));
1211
+ if (rectB.getCenterY() === rectA.getCenterY() && rectB.getCenterX() === rectA.getCenterX()) {
1212
+ slope = 1;
1213
+ }
1214
+ var moveByY = slope * overlapAmount[0];
1215
+ var moveByX = overlapAmount[1] / slope;
1216
+ if (overlapAmount[0] < moveByX) {
1217
+ moveByX = overlapAmount[0];
1218
+ } else {
1219
+ moveByY = overlapAmount[1];
1220
+ }
1221
+ overlapAmount[0] = -1 * directions[0] * (moveByX / 2 + separationBuffer);
1222
+ overlapAmount[1] = -1 * directions[1] * (moveByY / 2 + separationBuffer);
1223
+ };
1224
+ IGeometry.decideDirectionsForOverlappingNodes = function(rectA, rectB, directions) {
1225
+ if (rectA.getCenterX() < rectB.getCenterX()) {
1226
+ directions[0] = -1;
1227
+ } else {
1228
+ directions[0] = 1;
1229
+ }
1230
+ if (rectA.getCenterY() < rectB.getCenterY()) {
1231
+ directions[1] = -1;
1232
+ } else {
1233
+ directions[1] = 1;
1234
+ }
1235
+ };
1236
+ IGeometry.getIntersection2 = function(rectA, rectB, result) {
1237
+ var p1x = rectA.getCenterX();
1238
+ var p1y = rectA.getCenterY();
1239
+ var p2x = rectB.getCenterX();
1240
+ var p2y = rectB.getCenterY();
1241
+ if (rectA.intersects(rectB)) {
1242
+ result[0] = p1x;
1243
+ result[1] = p1y;
1244
+ result[2] = p2x;
1245
+ result[3] = p2y;
1246
+ return true;
1247
+ }
1248
+ var topLeftAx = rectA.getX();
1249
+ var topLeftAy = rectA.getY();
1250
+ var topRightAx = rectA.getRight();
1251
+ var bottomLeftAx = rectA.getX();
1252
+ var bottomLeftAy = rectA.getBottom();
1253
+ var bottomRightAx = rectA.getRight();
1254
+ var halfWidthA = rectA.getWidthHalf();
1255
+ var halfHeightA = rectA.getHeightHalf();
1256
+ var topLeftBx = rectB.getX();
1257
+ var topLeftBy = rectB.getY();
1258
+ var topRightBx = rectB.getRight();
1259
+ var bottomLeftBx = rectB.getX();
1260
+ var bottomLeftBy = rectB.getBottom();
1261
+ var bottomRightBx = rectB.getRight();
1262
+ var halfWidthB = rectB.getWidthHalf();
1263
+ var halfHeightB = rectB.getHeightHalf();
1264
+ var clipPointAFound = false;
1265
+ var clipPointBFound = false;
1266
+ if (p1x === p2x) {
1267
+ if (p1y > p2y) {
1268
+ result[0] = p1x;
1269
+ result[1] = topLeftAy;
1270
+ result[2] = p2x;
1271
+ result[3] = bottomLeftBy;
1272
+ return false;
1273
+ } else if (p1y < p2y) {
1274
+ result[0] = p1x;
1275
+ result[1] = bottomLeftAy;
1276
+ result[2] = p2x;
1277
+ result[3] = topLeftBy;
1278
+ return false;
1279
+ }
1280
+ } else if (p1y === p2y) {
1281
+ if (p1x > p2x) {
1282
+ result[0] = topLeftAx;
1283
+ result[1] = p1y;
1284
+ result[2] = topRightBx;
1285
+ result[3] = p2y;
1286
+ return false;
1287
+ } else if (p1x < p2x) {
1288
+ result[0] = topRightAx;
1289
+ result[1] = p1y;
1290
+ result[2] = topLeftBx;
1291
+ result[3] = p2y;
1292
+ return false;
1293
+ }
1294
+ } else {
1295
+ var slopeA = rectA.height / rectA.width;
1296
+ var slopeB = rectB.height / rectB.width;
1297
+ var slopePrime = (p2y - p1y) / (p2x - p1x);
1298
+ var cardinalDirectionA = undefined;
1299
+ var cardinalDirectionB = undefined;
1300
+ var tempPointAx = undefined;
1301
+ var tempPointAy = undefined;
1302
+ var tempPointBx = undefined;
1303
+ var tempPointBy = undefined;
1304
+ if (-slopeA === slopePrime) {
1305
+ if (p1x > p2x) {
1306
+ result[0] = bottomLeftAx;
1307
+ result[1] = bottomLeftAy;
1308
+ clipPointAFound = true;
1309
+ } else {
1310
+ result[0] = topRightAx;
1311
+ result[1] = topLeftAy;
1312
+ clipPointAFound = true;
1313
+ }
1314
+ } else if (slopeA === slopePrime) {
1315
+ if (p1x > p2x) {
1316
+ result[0] = topLeftAx;
1317
+ result[1] = topLeftAy;
1318
+ clipPointAFound = true;
1319
+ } else {
1320
+ result[0] = bottomRightAx;
1321
+ result[1] = bottomLeftAy;
1322
+ clipPointAFound = true;
1323
+ }
1324
+ }
1325
+ if (-slopeB === slopePrime) {
1326
+ if (p2x > p1x) {
1327
+ result[2] = bottomLeftBx;
1328
+ result[3] = bottomLeftBy;
1329
+ clipPointBFound = true;
1330
+ } else {
1331
+ result[2] = topRightBx;
1332
+ result[3] = topLeftBy;
1333
+ clipPointBFound = true;
1334
+ }
1335
+ } else if (slopeB === slopePrime) {
1336
+ if (p2x > p1x) {
1337
+ result[2] = topLeftBx;
1338
+ result[3] = topLeftBy;
1339
+ clipPointBFound = true;
1340
+ } else {
1341
+ result[2] = bottomRightBx;
1342
+ result[3] = bottomLeftBy;
1343
+ clipPointBFound = true;
1344
+ }
1345
+ }
1346
+ if (clipPointAFound && clipPointBFound) {
1347
+ return false;
1348
+ }
1349
+ if (p1x > p2x) {
1350
+ if (p1y > p2y) {
1351
+ cardinalDirectionA = this.getCardinalDirection(slopeA, slopePrime, 4);
1352
+ cardinalDirectionB = this.getCardinalDirection(slopeB, slopePrime, 2);
1353
+ } else {
1354
+ cardinalDirectionA = this.getCardinalDirection(-slopeA, slopePrime, 3);
1355
+ cardinalDirectionB = this.getCardinalDirection(-slopeB, slopePrime, 1);
1356
+ }
1357
+ } else {
1358
+ if (p1y > p2y) {
1359
+ cardinalDirectionA = this.getCardinalDirection(-slopeA, slopePrime, 1);
1360
+ cardinalDirectionB = this.getCardinalDirection(-slopeB, slopePrime, 3);
1361
+ } else {
1362
+ cardinalDirectionA = this.getCardinalDirection(slopeA, slopePrime, 2);
1363
+ cardinalDirectionB = this.getCardinalDirection(slopeB, slopePrime, 4);
1364
+ }
1365
+ }
1366
+ if (!clipPointAFound) {
1367
+ switch (cardinalDirectionA) {
1368
+ case 1:
1369
+ tempPointAy = topLeftAy;
1370
+ tempPointAx = p1x + -halfHeightA / slopePrime;
1371
+ result[0] = tempPointAx;
1372
+ result[1] = tempPointAy;
1373
+ break;
1374
+ case 2:
1375
+ tempPointAx = bottomRightAx;
1376
+ tempPointAy = p1y + halfWidthA * slopePrime;
1377
+ result[0] = tempPointAx;
1378
+ result[1] = tempPointAy;
1379
+ break;
1380
+ case 3:
1381
+ tempPointAy = bottomLeftAy;
1382
+ tempPointAx = p1x + halfHeightA / slopePrime;
1383
+ result[0] = tempPointAx;
1384
+ result[1] = tempPointAy;
1385
+ break;
1386
+ case 4:
1387
+ tempPointAx = bottomLeftAx;
1388
+ tempPointAy = p1y + -halfWidthA * slopePrime;
1389
+ result[0] = tempPointAx;
1390
+ result[1] = tempPointAy;
1391
+ break;
1392
+ }
1393
+ }
1394
+ if (!clipPointBFound) {
1395
+ switch (cardinalDirectionB) {
1396
+ case 1:
1397
+ tempPointBy = topLeftBy;
1398
+ tempPointBx = p2x + -halfHeightB / slopePrime;
1399
+ result[2] = tempPointBx;
1400
+ result[3] = tempPointBy;
1401
+ break;
1402
+ case 2:
1403
+ tempPointBx = bottomRightBx;
1404
+ tempPointBy = p2y + halfWidthB * slopePrime;
1405
+ result[2] = tempPointBx;
1406
+ result[3] = tempPointBy;
1407
+ break;
1408
+ case 3:
1409
+ tempPointBy = bottomLeftBy;
1410
+ tempPointBx = p2x + halfHeightB / slopePrime;
1411
+ result[2] = tempPointBx;
1412
+ result[3] = tempPointBy;
1413
+ break;
1414
+ case 4:
1415
+ tempPointBx = bottomLeftBx;
1416
+ tempPointBy = p2y + -halfWidthB * slopePrime;
1417
+ result[2] = tempPointBx;
1418
+ result[3] = tempPointBy;
1419
+ break;
1420
+ }
1421
+ }
1422
+ }
1423
+ return false;
1424
+ };
1425
+ IGeometry.getCardinalDirection = function(slope, slopePrime, line) {
1426
+ if (slope > slopePrime) {
1427
+ return line;
1428
+ } else {
1429
+ return 1 + line % 4;
1430
+ }
1431
+ };
1432
+ IGeometry.getIntersection = function(s1, s2, f1, f2) {
1433
+ if (f2 == null) {
1434
+ return this.getIntersection2(s1, s2, f1);
1435
+ }
1436
+ var x1 = s1.x;
1437
+ var y1 = s1.y;
1438
+ var x2 = s2.x;
1439
+ var y2 = s2.y;
1440
+ var x3 = f1.x;
1441
+ var y3 = f1.y;
1442
+ var x4 = f2.x;
1443
+ var y4 = f2.y;
1444
+ var x = undefined, y = undefined;
1445
+ var a1 = undefined, a2 = undefined, b1 = undefined, b2 = undefined, c1 = undefined, c2 = undefined;
1446
+ var denom = undefined;
1447
+ a1 = y2 - y1;
1448
+ b1 = x1 - x2;
1449
+ c1 = x2 * y1 - x1 * y2;
1450
+ a2 = y4 - y3;
1451
+ b2 = x3 - x4;
1452
+ c2 = x4 * y3 - x3 * y4;
1453
+ denom = a1 * b2 - a2 * b1;
1454
+ if (denom === 0) {
1455
+ return null;
1456
+ }
1457
+ x = (b1 * c2 - b2 * c1) / denom;
1458
+ y = (a2 * c1 - a1 * c2) / denom;
1459
+ return new Point2(x, y);
1460
+ };
1461
+ IGeometry.angleOfVector = function(Cx, Cy, Nx, Ny) {
1462
+ var C_angle = undefined;
1463
+ if (Cx !== Nx) {
1464
+ C_angle = Math.atan((Ny - Cy) / (Nx - Cx));
1465
+ if (Nx < Cx) {
1466
+ C_angle += Math.PI;
1467
+ } else if (Ny < Cy) {
1468
+ C_angle += this.TWO_PI;
1469
+ }
1470
+ } else if (Ny < Cy) {
1471
+ C_angle = this.ONE_AND_HALF_PI;
1472
+ } else {
1473
+ C_angle = this.HALF_PI;
1474
+ }
1475
+ return C_angle;
1476
+ };
1477
+ IGeometry.doIntersect = function(p1, p2, p3, p4) {
1478
+ var a = p1.x;
1479
+ var b = p1.y;
1480
+ var c = p2.x;
1481
+ var d = p2.y;
1482
+ var p = p3.x;
1483
+ var q = p3.y;
1484
+ var r = p4.x;
1485
+ var s = p4.y;
1486
+ var det = (c - a) * (s - q) - (r - p) * (d - b);
1487
+ if (det === 0) {
1488
+ return false;
1489
+ } else {
1490
+ var lambda = ((s - q) * (r - a) + (p - r) * (s - b)) / det;
1491
+ var gamma = ((b - d) * (r - a) + (c - a) * (s - b)) / det;
1492
+ return 0 < lambda && lambda < 1 && 0 < gamma && gamma < 1;
1493
+ }
1494
+ };
1495
+ IGeometry.HALF_PI = 0.5 * Math.PI;
1496
+ IGeometry.ONE_AND_HALF_PI = 1.5 * Math.PI;
1497
+ IGeometry.TWO_PI = 2 * Math.PI;
1498
+ IGeometry.THREE_PI = 3 * Math.PI;
1499
+ module2.exports = IGeometry;
1500
+ },
1501
+ function(module2, exports2, __webpack_require__) {
1502
+ function IMath() {}
1503
+ IMath.sign = function(value) {
1504
+ if (value > 0) {
1505
+ return 1;
1506
+ } else if (value < 0) {
1507
+ return -1;
1508
+ } else {
1509
+ return 0;
1510
+ }
1511
+ };
1512
+ IMath.floor = function(value) {
1513
+ return value < 0 ? Math.ceil(value) : Math.floor(value);
1514
+ };
1515
+ IMath.ceil = function(value) {
1516
+ return value < 0 ? Math.floor(value) : Math.ceil(value);
1517
+ };
1518
+ module2.exports = IMath;
1519
+ },
1520
+ function(module2, exports2, __webpack_require__) {
1521
+ function Integer() {}
1522
+ Integer.MAX_VALUE = 2147483647;
1523
+ Integer.MIN_VALUE = -2147483648;
1524
+ module2.exports = Integer;
1525
+ },
1526
+ function(module2, exports2, __webpack_require__) {
1527
+ var _createClass = function() {
1528
+ function defineProperties(target, props) {
1529
+ for (var i = 0;i < props.length; i++) {
1530
+ var descriptor = props[i];
1531
+ descriptor.enumerable = descriptor.enumerable || false;
1532
+ descriptor.configurable = true;
1533
+ if ("value" in descriptor)
1534
+ descriptor.writable = true;
1535
+ Object.defineProperty(target, descriptor.key, descriptor);
1536
+ }
1537
+ }
1538
+ return function(Constructor, protoProps, staticProps) {
1539
+ if (protoProps)
1540
+ defineProperties(Constructor.prototype, protoProps);
1541
+ if (staticProps)
1542
+ defineProperties(Constructor, staticProps);
1543
+ return Constructor;
1544
+ };
1545
+ }();
1546
+ function _classCallCheck(instance2, Constructor) {
1547
+ if (!(instance2 instanceof Constructor)) {
1548
+ throw new TypeError("Cannot call a class as a function");
1549
+ }
1550
+ }
1551
+ var nodeFrom = function nodeFrom2(value) {
1552
+ return { value, next: null, prev: null };
1553
+ };
1554
+ var add = function add2(prev, node, next2, list) {
1555
+ if (prev !== null) {
1556
+ prev.next = node;
1557
+ } else {
1558
+ list.head = node;
1559
+ }
1560
+ if (next2 !== null) {
1561
+ next2.prev = node;
1562
+ } else {
1563
+ list.tail = node;
1564
+ }
1565
+ node.prev = prev;
1566
+ node.next = next2;
1567
+ list.length++;
1568
+ return node;
1569
+ };
1570
+ var _remove = function _remove2(node, list) {
1571
+ var { prev, next: next2 } = node;
1572
+ if (prev !== null) {
1573
+ prev.next = next2;
1574
+ } else {
1575
+ list.head = next2;
1576
+ }
1577
+ if (next2 !== null) {
1578
+ next2.prev = prev;
1579
+ } else {
1580
+ list.tail = prev;
1581
+ }
1582
+ node.prev = node.next = null;
1583
+ list.length--;
1584
+ return node;
1585
+ };
1586
+ var LinkedList = function() {
1587
+ function LinkedList2(vals) {
1588
+ var _this = this;
1589
+ _classCallCheck(this, LinkedList2);
1590
+ this.length = 0;
1591
+ this.head = null;
1592
+ this.tail = null;
1593
+ if (vals != null) {
1594
+ vals.forEach(function(v) {
1595
+ return _this.push(v);
1596
+ });
1597
+ }
1598
+ }
1599
+ _createClass(LinkedList2, [{
1600
+ key: "size",
1601
+ value: function size() {
1602
+ return this.length;
1603
+ }
1604
+ }, {
1605
+ key: "insertBefore",
1606
+ value: function insertBefore(val, otherNode) {
1607
+ return add(otherNode.prev, nodeFrom(val), otherNode, this);
1608
+ }
1609
+ }, {
1610
+ key: "insertAfter",
1611
+ value: function insertAfter(val, otherNode) {
1612
+ return add(otherNode, nodeFrom(val), otherNode.next, this);
1613
+ }
1614
+ }, {
1615
+ key: "insertNodeBefore",
1616
+ value: function insertNodeBefore(newNode, otherNode) {
1617
+ return add(otherNode.prev, newNode, otherNode, this);
1618
+ }
1619
+ }, {
1620
+ key: "insertNodeAfter",
1621
+ value: function insertNodeAfter(newNode, otherNode) {
1622
+ return add(otherNode, newNode, otherNode.next, this);
1623
+ }
1624
+ }, {
1625
+ key: "push",
1626
+ value: function push(val) {
1627
+ return add(this.tail, nodeFrom(val), null, this);
1628
+ }
1629
+ }, {
1630
+ key: "unshift",
1631
+ value: function unshift(val) {
1632
+ return add(null, nodeFrom(val), this.head, this);
1633
+ }
1634
+ }, {
1635
+ key: "remove",
1636
+ value: function remove(node) {
1637
+ return _remove(node, this);
1638
+ }
1639
+ }, {
1640
+ key: "pop",
1641
+ value: function pop() {
1642
+ return _remove(this.tail, this).value;
1643
+ }
1644
+ }, {
1645
+ key: "popNode",
1646
+ value: function popNode() {
1647
+ return _remove(this.tail, this);
1648
+ }
1649
+ }, {
1650
+ key: "shift",
1651
+ value: function shift() {
1652
+ return _remove(this.head, this).value;
1653
+ }
1654
+ }, {
1655
+ key: "shiftNode",
1656
+ value: function shiftNode() {
1657
+ return _remove(this.head, this);
1658
+ }
1659
+ }, {
1660
+ key: "get_object_at",
1661
+ value: function get_object_at(index) {
1662
+ if (index <= this.length()) {
1663
+ var i = 1;
1664
+ var current = this.head;
1665
+ while (i < index) {
1666
+ current = current.next;
1667
+ i++;
1668
+ }
1669
+ return current.value;
1670
+ }
1671
+ }
1672
+ }, {
1673
+ key: "set_object_at",
1674
+ value: function set_object_at(index, value) {
1675
+ if (index <= this.length()) {
1676
+ var i = 1;
1677
+ var current = this.head;
1678
+ while (i < index) {
1679
+ current = current.next;
1680
+ i++;
1681
+ }
1682
+ current.value = value;
1683
+ }
1684
+ }
1685
+ }]);
1686
+ return LinkedList2;
1687
+ }();
1688
+ module2.exports = LinkedList;
1689
+ },
1690
+ function(module2, exports2, __webpack_require__) {
1691
+ function Point2(x, y, p) {
1692
+ this.x = null;
1693
+ this.y = null;
1694
+ if (x == null && y == null && p == null) {
1695
+ this.x = 0;
1696
+ this.y = 0;
1697
+ } else if (typeof x == "number" && typeof y == "number" && p == null) {
1698
+ this.x = x;
1699
+ this.y = y;
1700
+ } else if (x.constructor.name == "Point" && y == null && p == null) {
1701
+ p = x;
1702
+ this.x = p.x;
1703
+ this.y = p.y;
1704
+ }
1705
+ }
1706
+ Point2.prototype.getX = function() {
1707
+ return this.x;
1708
+ };
1709
+ Point2.prototype.getY = function() {
1710
+ return this.y;
1711
+ };
1712
+ Point2.prototype.getLocation = function() {
1713
+ return new Point2(this.x, this.y);
1714
+ };
1715
+ Point2.prototype.setLocation = function(x, y, p) {
1716
+ if (x.constructor.name == "Point" && y == null && p == null) {
1717
+ p = x;
1718
+ this.setLocation(p.x, p.y);
1719
+ } else if (typeof x == "number" && typeof y == "number" && p == null) {
1720
+ if (parseInt(x) == x && parseInt(y) == y) {
1721
+ this.move(x, y);
1722
+ } else {
1723
+ this.x = Math.floor(x + 0.5);
1724
+ this.y = Math.floor(y + 0.5);
1725
+ }
1726
+ }
1727
+ };
1728
+ Point2.prototype.move = function(x, y) {
1729
+ this.x = x;
1730
+ this.y = y;
1731
+ };
1732
+ Point2.prototype.translate = function(dx, dy) {
1733
+ this.x += dx;
1734
+ this.y += dy;
1735
+ };
1736
+ Point2.prototype.equals = function(obj) {
1737
+ if (obj.constructor.name == "Point") {
1738
+ var pt = obj;
1739
+ return this.x == pt.x && this.y == pt.y;
1740
+ }
1741
+ return this == obj;
1742
+ };
1743
+ Point2.prototype.toString = function() {
1744
+ return new Point2().constructor.name + "[x=" + this.x + ",y=" + this.y + "]";
1745
+ };
1746
+ module2.exports = Point2;
1747
+ },
1748
+ function(module2, exports2, __webpack_require__) {
1749
+ function RectangleD(x, y, width, height) {
1750
+ this.x = 0;
1751
+ this.y = 0;
1752
+ this.width = 0;
1753
+ this.height = 0;
1754
+ if (x != null && y != null && width != null && height != null) {
1755
+ this.x = x;
1756
+ this.y = y;
1757
+ this.width = width;
1758
+ this.height = height;
1759
+ }
1760
+ }
1761
+ RectangleD.prototype.getX = function() {
1762
+ return this.x;
1763
+ };
1764
+ RectangleD.prototype.setX = function(x) {
1765
+ this.x = x;
1766
+ };
1767
+ RectangleD.prototype.getY = function() {
1768
+ return this.y;
1769
+ };
1770
+ RectangleD.prototype.setY = function(y) {
1771
+ this.y = y;
1772
+ };
1773
+ RectangleD.prototype.getWidth = function() {
1774
+ return this.width;
1775
+ };
1776
+ RectangleD.prototype.setWidth = function(width) {
1777
+ this.width = width;
1778
+ };
1779
+ RectangleD.prototype.getHeight = function() {
1780
+ return this.height;
1781
+ };
1782
+ RectangleD.prototype.setHeight = function(height) {
1783
+ this.height = height;
1784
+ };
1785
+ RectangleD.prototype.getRight = function() {
1786
+ return this.x + this.width;
1787
+ };
1788
+ RectangleD.prototype.getBottom = function() {
1789
+ return this.y + this.height;
1790
+ };
1791
+ RectangleD.prototype.intersects = function(a) {
1792
+ if (this.getRight() < a.x) {
1793
+ return false;
1794
+ }
1795
+ if (this.getBottom() < a.y) {
1796
+ return false;
1797
+ }
1798
+ if (a.getRight() < this.x) {
1799
+ return false;
1800
+ }
1801
+ if (a.getBottom() < this.y) {
1802
+ return false;
1803
+ }
1804
+ return true;
1805
+ };
1806
+ RectangleD.prototype.getCenterX = function() {
1807
+ return this.x + this.width / 2;
1808
+ };
1809
+ RectangleD.prototype.getMinX = function() {
1810
+ return this.getX();
1811
+ };
1812
+ RectangleD.prototype.getMaxX = function() {
1813
+ return this.getX() + this.width;
1814
+ };
1815
+ RectangleD.prototype.getCenterY = function() {
1816
+ return this.y + this.height / 2;
1817
+ };
1818
+ RectangleD.prototype.getMinY = function() {
1819
+ return this.getY();
1820
+ };
1821
+ RectangleD.prototype.getMaxY = function() {
1822
+ return this.getY() + this.height;
1823
+ };
1824
+ RectangleD.prototype.getWidthHalf = function() {
1825
+ return this.width / 2;
1826
+ };
1827
+ RectangleD.prototype.getHeightHalf = function() {
1828
+ return this.height / 2;
1829
+ };
1830
+ module2.exports = RectangleD;
1831
+ },
1832
+ function(module2, exports2, __webpack_require__) {
1833
+ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function(obj) {
1834
+ return typeof obj;
1835
+ } : function(obj) {
1836
+ return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
1837
+ };
1838
+ function UniqueIDGeneretor() {}
1839
+ UniqueIDGeneretor.lastID = 0;
1840
+ UniqueIDGeneretor.createID = function(obj) {
1841
+ if (UniqueIDGeneretor.isPrimitive(obj)) {
1842
+ return obj;
1843
+ }
1844
+ if (obj.uniqueID != null) {
1845
+ return obj.uniqueID;
1846
+ }
1847
+ obj.uniqueID = UniqueIDGeneretor.getString();
1848
+ UniqueIDGeneretor.lastID++;
1849
+ return obj.uniqueID;
1850
+ };
1851
+ UniqueIDGeneretor.getString = function(id) {
1852
+ if (id == null)
1853
+ id = UniqueIDGeneretor.lastID;
1854
+ return "Object#" + id + "";
1855
+ };
1856
+ UniqueIDGeneretor.isPrimitive = function(arg) {
1857
+ var type = typeof arg === "undefined" ? "undefined" : _typeof(arg);
1858
+ return arg == null || type != "object" && type != "function";
1859
+ };
1860
+ module2.exports = UniqueIDGeneretor;
1861
+ },
1862
+ function(module2, exports2, __webpack_require__) {
1863
+ function _toConsumableArray(arr) {
1864
+ if (Array.isArray(arr)) {
1865
+ for (var i = 0, arr2 = Array(arr.length);i < arr.length; i++) {
1866
+ arr2[i] = arr[i];
1867
+ }
1868
+ return arr2;
1869
+ } else {
1870
+ return Array.from(arr);
1871
+ }
1872
+ }
1873
+ var LayoutConstants = __webpack_require__(0);
1874
+ var LGraphManager = __webpack_require__(6);
1875
+ var LNode = __webpack_require__(3);
1876
+ var LEdge = __webpack_require__(1);
1877
+ var LGraph = __webpack_require__(5);
1878
+ var PointD = __webpack_require__(4);
1879
+ var Transform = __webpack_require__(17);
1880
+ var Emitter = __webpack_require__(27);
1881
+ function Layout2(isRemoteUse) {
1882
+ Emitter.call(this);
1883
+ this.layoutQuality = LayoutConstants.QUALITY;
1884
+ this.createBendsAsNeeded = LayoutConstants.DEFAULT_CREATE_BENDS_AS_NEEDED;
1885
+ this.incremental = LayoutConstants.DEFAULT_INCREMENTAL;
1886
+ this.animationOnLayout = LayoutConstants.DEFAULT_ANIMATION_ON_LAYOUT;
1887
+ this.animationDuringLayout = LayoutConstants.DEFAULT_ANIMATION_DURING_LAYOUT;
1888
+ this.animationPeriod = LayoutConstants.DEFAULT_ANIMATION_PERIOD;
1889
+ this.uniformLeafNodeSizes = LayoutConstants.DEFAULT_UNIFORM_LEAF_NODE_SIZES;
1890
+ this.edgeToDummyNodes = new Map;
1891
+ this.graphManager = new LGraphManager(this);
1892
+ this.isLayoutFinished = false;
1893
+ this.isSubLayout = false;
1894
+ this.isRemoteUse = false;
1895
+ if (isRemoteUse != null) {
1896
+ this.isRemoteUse = isRemoteUse;
1897
+ }
1898
+ }
1899
+ Layout2.RANDOM_SEED = 1;
1900
+ Layout2.prototype = Object.create(Emitter.prototype);
1901
+ Layout2.prototype.getGraphManager = function() {
1902
+ return this.graphManager;
1903
+ };
1904
+ Layout2.prototype.getAllNodes = function() {
1905
+ return this.graphManager.getAllNodes();
1906
+ };
1907
+ Layout2.prototype.getAllEdges = function() {
1908
+ return this.graphManager.getAllEdges();
1909
+ };
1910
+ Layout2.prototype.getAllNodesToApplyGravitation = function() {
1911
+ return this.graphManager.getAllNodesToApplyGravitation();
1912
+ };
1913
+ Layout2.prototype.newGraphManager = function() {
1914
+ var gm = new LGraphManager(this);
1915
+ this.graphManager = gm;
1916
+ return gm;
1917
+ };
1918
+ Layout2.prototype.newGraph = function(vGraph) {
1919
+ return new LGraph(null, this.graphManager, vGraph);
1920
+ };
1921
+ Layout2.prototype.newNode = function(vNode) {
1922
+ return new LNode(this.graphManager, vNode);
1923
+ };
1924
+ Layout2.prototype.newEdge = function(vEdge) {
1925
+ return new LEdge(null, null, vEdge);
1926
+ };
1927
+ Layout2.prototype.checkLayoutSuccess = function() {
1928
+ return this.graphManager.getRoot() == null || this.graphManager.getRoot().getNodes().length == 0 || this.graphManager.includesInvalidEdge();
1929
+ };
1930
+ Layout2.prototype.runLayout = function() {
1931
+ this.isLayoutFinished = false;
1932
+ if (this.tilingPreLayout) {
1933
+ this.tilingPreLayout();
1934
+ }
1935
+ this.initParameters();
1936
+ var isLayoutSuccessfull;
1937
+ if (this.checkLayoutSuccess()) {
1938
+ isLayoutSuccessfull = false;
1939
+ } else {
1940
+ isLayoutSuccessfull = this.layout();
1941
+ }
1942
+ if (LayoutConstants.ANIMATE === "during") {
1943
+ return false;
1944
+ }
1945
+ if (isLayoutSuccessfull) {
1946
+ if (!this.isSubLayout) {
1947
+ this.doPostLayout();
1948
+ }
1949
+ }
1950
+ if (this.tilingPostLayout) {
1951
+ this.tilingPostLayout();
1952
+ }
1953
+ this.isLayoutFinished = true;
1954
+ return isLayoutSuccessfull;
1955
+ };
1956
+ Layout2.prototype.doPostLayout = function() {
1957
+ if (!this.incremental) {
1958
+ this.transform();
1959
+ }
1960
+ this.update();
1961
+ };
1962
+ Layout2.prototype.update2 = function() {
1963
+ if (this.createBendsAsNeeded) {
1964
+ this.createBendpointsFromDummyNodes();
1965
+ this.graphManager.resetAllEdges();
1966
+ }
1967
+ if (!this.isRemoteUse) {
1968
+ var edge;
1969
+ var allEdges = this.graphManager.getAllEdges();
1970
+ for (var i = 0;i < allEdges.length; i++) {
1971
+ edge = allEdges[i];
1972
+ }
1973
+ var node;
1974
+ var nodes = this.graphManager.getRoot().getNodes();
1975
+ for (var i = 0;i < nodes.length; i++) {
1976
+ node = nodes[i];
1977
+ }
1978
+ this.update(this.graphManager.getRoot());
1979
+ }
1980
+ };
1981
+ Layout2.prototype.update = function(obj) {
1982
+ if (obj == null) {
1983
+ this.update2();
1984
+ } else if (obj instanceof LNode) {
1985
+ var node = obj;
1986
+ if (node.getChild() != null) {
1987
+ var nodes = node.getChild().getNodes();
1988
+ for (var i = 0;i < nodes.length; i++) {
1989
+ update(nodes[i]);
1990
+ }
1991
+ }
1992
+ if (node.vGraphObject != null) {
1993
+ var vNode = node.vGraphObject;
1994
+ vNode.update(node);
1995
+ }
1996
+ } else if (obj instanceof LEdge) {
1997
+ var edge = obj;
1998
+ if (edge.vGraphObject != null) {
1999
+ var vEdge = edge.vGraphObject;
2000
+ vEdge.update(edge);
2001
+ }
2002
+ } else if (obj instanceof LGraph) {
2003
+ var graph = obj;
2004
+ if (graph.vGraphObject != null) {
2005
+ var vGraph = graph.vGraphObject;
2006
+ vGraph.update(graph);
2007
+ }
2008
+ }
2009
+ };
2010
+ Layout2.prototype.initParameters = function() {
2011
+ if (!this.isSubLayout) {
2012
+ this.layoutQuality = LayoutConstants.QUALITY;
2013
+ this.animationDuringLayout = LayoutConstants.DEFAULT_ANIMATION_DURING_LAYOUT;
2014
+ this.animationPeriod = LayoutConstants.DEFAULT_ANIMATION_PERIOD;
2015
+ this.animationOnLayout = LayoutConstants.DEFAULT_ANIMATION_ON_LAYOUT;
2016
+ this.incremental = LayoutConstants.DEFAULT_INCREMENTAL;
2017
+ this.createBendsAsNeeded = LayoutConstants.DEFAULT_CREATE_BENDS_AS_NEEDED;
2018
+ this.uniformLeafNodeSizes = LayoutConstants.DEFAULT_UNIFORM_LEAF_NODE_SIZES;
2019
+ }
2020
+ if (this.animationDuringLayout) {
2021
+ this.animationOnLayout = false;
2022
+ }
2023
+ };
2024
+ Layout2.prototype.transform = function(newLeftTop) {
2025
+ if (newLeftTop == undefined) {
2026
+ this.transform(new PointD(0, 0));
2027
+ } else {
2028
+ var trans = new Transform;
2029
+ var leftTop = this.graphManager.getRoot().updateLeftTop();
2030
+ if (leftTop != null) {
2031
+ trans.setWorldOrgX(newLeftTop.x);
2032
+ trans.setWorldOrgY(newLeftTop.y);
2033
+ trans.setDeviceOrgX(leftTop.x);
2034
+ trans.setDeviceOrgY(leftTop.y);
2035
+ var nodes = this.getAllNodes();
2036
+ var node;
2037
+ for (var i = 0;i < nodes.length; i++) {
2038
+ node = nodes[i];
2039
+ node.transform(trans);
2040
+ }
2041
+ }
2042
+ }
2043
+ };
2044
+ Layout2.prototype.positionNodesRandomly = function(graph) {
2045
+ if (graph == undefined) {
2046
+ this.positionNodesRandomly(this.getGraphManager().getRoot());
2047
+ this.getGraphManager().getRoot().updateBounds(true);
2048
+ } else {
2049
+ var lNode;
2050
+ var childGraph;
2051
+ var nodes = graph.getNodes();
2052
+ for (var i = 0;i < nodes.length; i++) {
2053
+ lNode = nodes[i];
2054
+ childGraph = lNode.getChild();
2055
+ if (childGraph == null) {
2056
+ lNode.scatter();
2057
+ } else if (childGraph.getNodes().length == 0) {
2058
+ lNode.scatter();
2059
+ } else {
2060
+ this.positionNodesRandomly(childGraph);
2061
+ lNode.updateBounds();
2062
+ }
2063
+ }
2064
+ }
2065
+ };
2066
+ Layout2.prototype.getFlatForest = function() {
2067
+ var flatForest = [];
2068
+ var isForest = true;
2069
+ var allNodes = this.graphManager.getRoot().getNodes();
2070
+ var isFlat = true;
2071
+ for (var i = 0;i < allNodes.length; i++) {
2072
+ if (allNodes[i].getChild() != null) {
2073
+ isFlat = false;
2074
+ }
2075
+ }
2076
+ if (!isFlat) {
2077
+ return flatForest;
2078
+ }
2079
+ var visited = new Set;
2080
+ var toBeVisited = [];
2081
+ var parents = new Map;
2082
+ var unProcessedNodes = [];
2083
+ unProcessedNodes = unProcessedNodes.concat(allNodes);
2084
+ while (unProcessedNodes.length > 0 && isForest) {
2085
+ toBeVisited.push(unProcessedNodes[0]);
2086
+ while (toBeVisited.length > 0 && isForest) {
2087
+ var currentNode = toBeVisited[0];
2088
+ toBeVisited.splice(0, 1);
2089
+ visited.add(currentNode);
2090
+ var neighborEdges = currentNode.getEdges();
2091
+ for (var i = 0;i < neighborEdges.length; i++) {
2092
+ var currentNeighbor = neighborEdges[i].getOtherEnd(currentNode);
2093
+ if (parents.get(currentNode) != currentNeighbor) {
2094
+ if (!visited.has(currentNeighbor)) {
2095
+ toBeVisited.push(currentNeighbor);
2096
+ parents.set(currentNeighbor, currentNode);
2097
+ } else {
2098
+ isForest = false;
2099
+ break;
2100
+ }
2101
+ }
2102
+ }
2103
+ }
2104
+ if (!isForest) {
2105
+ flatForest = [];
2106
+ } else {
2107
+ var temp = [].concat(_toConsumableArray(visited));
2108
+ flatForest.push(temp);
2109
+ for (var i = 0;i < temp.length; i++) {
2110
+ var value = temp[i];
2111
+ var index = unProcessedNodes.indexOf(value);
2112
+ if (index > -1) {
2113
+ unProcessedNodes.splice(index, 1);
2114
+ }
2115
+ }
2116
+ visited = new Set;
2117
+ parents = new Map;
2118
+ }
2119
+ }
2120
+ return flatForest;
2121
+ };
2122
+ Layout2.prototype.createDummyNodesForBendpoints = function(edge) {
2123
+ var dummyNodes = [];
2124
+ var prev = edge.source;
2125
+ var graph = this.graphManager.calcLowestCommonAncestor(edge.source, edge.target);
2126
+ for (var i = 0;i < edge.bendpoints.length; i++) {
2127
+ var dummyNode = this.newNode(null);
2128
+ dummyNode.setRect(new Point(0, 0), new Dimension(1, 1));
2129
+ graph.add(dummyNode);
2130
+ var dummyEdge = this.newEdge(null);
2131
+ this.graphManager.add(dummyEdge, prev, dummyNode);
2132
+ dummyNodes.add(dummyNode);
2133
+ prev = dummyNode;
2134
+ }
2135
+ var dummyEdge = this.newEdge(null);
2136
+ this.graphManager.add(dummyEdge, prev, edge.target);
2137
+ this.edgeToDummyNodes.set(edge, dummyNodes);
2138
+ if (edge.isInterGraph()) {
2139
+ this.graphManager.remove(edge);
2140
+ } else {
2141
+ graph.remove(edge);
2142
+ }
2143
+ return dummyNodes;
2144
+ };
2145
+ Layout2.prototype.createBendpointsFromDummyNodes = function() {
2146
+ var edges = [];
2147
+ edges = edges.concat(this.graphManager.getAllEdges());
2148
+ edges = [].concat(_toConsumableArray(this.edgeToDummyNodes.keys())).concat(edges);
2149
+ for (var k = 0;k < edges.length; k++) {
2150
+ var lEdge = edges[k];
2151
+ if (lEdge.bendpoints.length > 0) {
2152
+ var path = this.edgeToDummyNodes.get(lEdge);
2153
+ for (var i = 0;i < path.length; i++) {
2154
+ var dummyNode = path[i];
2155
+ var p = new PointD(dummyNode.getCenterX(), dummyNode.getCenterY());
2156
+ var ebp = lEdge.bendpoints.get(i);
2157
+ ebp.x = p.x;
2158
+ ebp.y = p.y;
2159
+ dummyNode.getOwner().remove(dummyNode);
2160
+ }
2161
+ this.graphManager.add(lEdge, lEdge.source, lEdge.target);
2162
+ }
2163
+ }
2164
+ };
2165
+ Layout2.transform = function(sliderValue, defaultValue, minDiv, maxMul) {
2166
+ if (minDiv != null && maxMul != null) {
2167
+ var value = defaultValue;
2168
+ if (sliderValue <= 50) {
2169
+ var minValue = defaultValue / minDiv;
2170
+ value -= (defaultValue - minValue) / 50 * (50 - sliderValue);
2171
+ } else {
2172
+ var maxValue = defaultValue * maxMul;
2173
+ value += (maxValue - defaultValue) / 50 * (sliderValue - 50);
2174
+ }
2175
+ return value;
2176
+ } else {
2177
+ var a, b;
2178
+ if (sliderValue <= 50) {
2179
+ a = 9 * defaultValue / 500;
2180
+ b = defaultValue / 10;
2181
+ } else {
2182
+ a = 9 * defaultValue / 50;
2183
+ b = -8 * defaultValue;
2184
+ }
2185
+ return a * sliderValue + b;
2186
+ }
2187
+ };
2188
+ Layout2.findCenterOfTree = function(nodes) {
2189
+ var list = [];
2190
+ list = list.concat(nodes);
2191
+ var removedNodes = [];
2192
+ var remainingDegrees = new Map;
2193
+ var foundCenter = false;
2194
+ var centerNode = null;
2195
+ if (list.length == 1 || list.length == 2) {
2196
+ foundCenter = true;
2197
+ centerNode = list[0];
2198
+ }
2199
+ for (var i = 0;i < list.length; i++) {
2200
+ var node = list[i];
2201
+ var degree = node.getNeighborsList().size;
2202
+ remainingDegrees.set(node, node.getNeighborsList().size);
2203
+ if (degree == 1) {
2204
+ removedNodes.push(node);
2205
+ }
2206
+ }
2207
+ var tempList = [];
2208
+ tempList = tempList.concat(removedNodes);
2209
+ while (!foundCenter) {
2210
+ var tempList2 = [];
2211
+ tempList2 = tempList2.concat(tempList);
2212
+ tempList = [];
2213
+ for (var i = 0;i < list.length; i++) {
2214
+ var node = list[i];
2215
+ var index = list.indexOf(node);
2216
+ if (index >= 0) {
2217
+ list.splice(index, 1);
2218
+ }
2219
+ var neighbours = node.getNeighborsList();
2220
+ neighbours.forEach(function(neighbour) {
2221
+ if (removedNodes.indexOf(neighbour) < 0) {
2222
+ var otherDegree = remainingDegrees.get(neighbour);
2223
+ var newDegree = otherDegree - 1;
2224
+ if (newDegree == 1) {
2225
+ tempList.push(neighbour);
2226
+ }
2227
+ remainingDegrees.set(neighbour, newDegree);
2228
+ }
2229
+ });
2230
+ }
2231
+ removedNodes = removedNodes.concat(tempList);
2232
+ if (list.length == 1 || list.length == 2) {
2233
+ foundCenter = true;
2234
+ centerNode = list[0];
2235
+ }
2236
+ }
2237
+ return centerNode;
2238
+ };
2239
+ Layout2.prototype.setGraphManager = function(gm) {
2240
+ this.graphManager = gm;
2241
+ };
2242
+ module2.exports = Layout2;
2243
+ },
2244
+ function(module2, exports2, __webpack_require__) {
2245
+ function RandomSeed() {}
2246
+ RandomSeed.seed = 1;
2247
+ RandomSeed.x = 0;
2248
+ RandomSeed.nextDouble = function() {
2249
+ RandomSeed.x = Math.sin(RandomSeed.seed++) * 1e4;
2250
+ return RandomSeed.x - Math.floor(RandomSeed.x);
2251
+ };
2252
+ module2.exports = RandomSeed;
2253
+ },
2254
+ function(module2, exports2, __webpack_require__) {
2255
+ var PointD = __webpack_require__(4);
2256
+ function Transform(x, y) {
2257
+ this.lworldOrgX = 0;
2258
+ this.lworldOrgY = 0;
2259
+ this.ldeviceOrgX = 0;
2260
+ this.ldeviceOrgY = 0;
2261
+ this.lworldExtX = 1;
2262
+ this.lworldExtY = 1;
2263
+ this.ldeviceExtX = 1;
2264
+ this.ldeviceExtY = 1;
2265
+ }
2266
+ Transform.prototype.getWorldOrgX = function() {
2267
+ return this.lworldOrgX;
2268
+ };
2269
+ Transform.prototype.setWorldOrgX = function(wox) {
2270
+ this.lworldOrgX = wox;
2271
+ };
2272
+ Transform.prototype.getWorldOrgY = function() {
2273
+ return this.lworldOrgY;
2274
+ };
2275
+ Transform.prototype.setWorldOrgY = function(woy) {
2276
+ this.lworldOrgY = woy;
2277
+ };
2278
+ Transform.prototype.getWorldExtX = function() {
2279
+ return this.lworldExtX;
2280
+ };
2281
+ Transform.prototype.setWorldExtX = function(wex) {
2282
+ this.lworldExtX = wex;
2283
+ };
2284
+ Transform.prototype.getWorldExtY = function() {
2285
+ return this.lworldExtY;
2286
+ };
2287
+ Transform.prototype.setWorldExtY = function(wey) {
2288
+ this.lworldExtY = wey;
2289
+ };
2290
+ Transform.prototype.getDeviceOrgX = function() {
2291
+ return this.ldeviceOrgX;
2292
+ };
2293
+ Transform.prototype.setDeviceOrgX = function(dox) {
2294
+ this.ldeviceOrgX = dox;
2295
+ };
2296
+ Transform.prototype.getDeviceOrgY = function() {
2297
+ return this.ldeviceOrgY;
2298
+ };
2299
+ Transform.prototype.setDeviceOrgY = function(doy) {
2300
+ this.ldeviceOrgY = doy;
2301
+ };
2302
+ Transform.prototype.getDeviceExtX = function() {
2303
+ return this.ldeviceExtX;
2304
+ };
2305
+ Transform.prototype.setDeviceExtX = function(dex) {
2306
+ this.ldeviceExtX = dex;
2307
+ };
2308
+ Transform.prototype.getDeviceExtY = function() {
2309
+ return this.ldeviceExtY;
2310
+ };
2311
+ Transform.prototype.setDeviceExtY = function(dey) {
2312
+ this.ldeviceExtY = dey;
2313
+ };
2314
+ Transform.prototype.transformX = function(x) {
2315
+ var xDevice = 0;
2316
+ var worldExtX = this.lworldExtX;
2317
+ if (worldExtX != 0) {
2318
+ xDevice = this.ldeviceOrgX + (x - this.lworldOrgX) * this.ldeviceExtX / worldExtX;
2319
+ }
2320
+ return xDevice;
2321
+ };
2322
+ Transform.prototype.transformY = function(y) {
2323
+ var yDevice = 0;
2324
+ var worldExtY = this.lworldExtY;
2325
+ if (worldExtY != 0) {
2326
+ yDevice = this.ldeviceOrgY + (y - this.lworldOrgY) * this.ldeviceExtY / worldExtY;
2327
+ }
2328
+ return yDevice;
2329
+ };
2330
+ Transform.prototype.inverseTransformX = function(x) {
2331
+ var xWorld = 0;
2332
+ var deviceExtX = this.ldeviceExtX;
2333
+ if (deviceExtX != 0) {
2334
+ xWorld = this.lworldOrgX + (x - this.ldeviceOrgX) * this.lworldExtX / deviceExtX;
2335
+ }
2336
+ return xWorld;
2337
+ };
2338
+ Transform.prototype.inverseTransformY = function(y) {
2339
+ var yWorld = 0;
2340
+ var deviceExtY = this.ldeviceExtY;
2341
+ if (deviceExtY != 0) {
2342
+ yWorld = this.lworldOrgY + (y - this.ldeviceOrgY) * this.lworldExtY / deviceExtY;
2343
+ }
2344
+ return yWorld;
2345
+ };
2346
+ Transform.prototype.inverseTransformPoint = function(inPoint) {
2347
+ var outPoint = new PointD(this.inverseTransformX(inPoint.x), this.inverseTransformY(inPoint.y));
2348
+ return outPoint;
2349
+ };
2350
+ module2.exports = Transform;
2351
+ },
2352
+ function(module2, exports2, __webpack_require__) {
2353
+ function _toConsumableArray(arr) {
2354
+ if (Array.isArray(arr)) {
2355
+ for (var i = 0, arr2 = Array(arr.length);i < arr.length; i++) {
2356
+ arr2[i] = arr[i];
2357
+ }
2358
+ return arr2;
2359
+ } else {
2360
+ return Array.from(arr);
2361
+ }
2362
+ }
2363
+ var Layout2 = __webpack_require__(15);
2364
+ var FDLayoutConstants = __webpack_require__(7);
2365
+ var LayoutConstants = __webpack_require__(0);
2366
+ var IGeometry = __webpack_require__(8);
2367
+ var IMath = __webpack_require__(9);
2368
+ function FDLayout() {
2369
+ Layout2.call(this);
2370
+ this.useSmartIdealEdgeLengthCalculation = FDLayoutConstants.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION;
2371
+ this.idealEdgeLength = FDLayoutConstants.DEFAULT_EDGE_LENGTH;
2372
+ this.springConstant = FDLayoutConstants.DEFAULT_SPRING_STRENGTH;
2373
+ this.repulsionConstant = FDLayoutConstants.DEFAULT_REPULSION_STRENGTH;
2374
+ this.gravityConstant = FDLayoutConstants.DEFAULT_GRAVITY_STRENGTH;
2375
+ this.compoundGravityConstant = FDLayoutConstants.DEFAULT_COMPOUND_GRAVITY_STRENGTH;
2376
+ this.gravityRangeFactor = FDLayoutConstants.DEFAULT_GRAVITY_RANGE_FACTOR;
2377
+ this.compoundGravityRangeFactor = FDLayoutConstants.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR;
2378
+ this.displacementThresholdPerNode = 3 * FDLayoutConstants.DEFAULT_EDGE_LENGTH / 100;
2379
+ this.coolingFactor = FDLayoutConstants.DEFAULT_COOLING_FACTOR_INCREMENTAL;
2380
+ this.initialCoolingFactor = FDLayoutConstants.DEFAULT_COOLING_FACTOR_INCREMENTAL;
2381
+ this.totalDisplacement = 0;
2382
+ this.oldTotalDisplacement = 0;
2383
+ this.maxIterations = FDLayoutConstants.MAX_ITERATIONS;
2384
+ }
2385
+ FDLayout.prototype = Object.create(Layout2.prototype);
2386
+ for (var prop in Layout2) {
2387
+ FDLayout[prop] = Layout2[prop];
2388
+ }
2389
+ FDLayout.prototype.initParameters = function() {
2390
+ Layout2.prototype.initParameters.call(this, arguments);
2391
+ this.totalIterations = 0;
2392
+ this.notAnimatedIterations = 0;
2393
+ this.useFRGridVariant = FDLayoutConstants.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION;
2394
+ this.grid = [];
2395
+ };
2396
+ FDLayout.prototype.calcIdealEdgeLengths = function() {
2397
+ var edge;
2398
+ var lcaDepth;
2399
+ var source;
2400
+ var target;
2401
+ var sizeOfSourceInLca;
2402
+ var sizeOfTargetInLca;
2403
+ var allEdges = this.getGraphManager().getAllEdges();
2404
+ for (var i = 0;i < allEdges.length; i++) {
2405
+ edge = allEdges[i];
2406
+ edge.idealLength = this.idealEdgeLength;
2407
+ if (edge.isInterGraph) {
2408
+ source = edge.getSource();
2409
+ target = edge.getTarget();
2410
+ sizeOfSourceInLca = edge.getSourceInLca().getEstimatedSize();
2411
+ sizeOfTargetInLca = edge.getTargetInLca().getEstimatedSize();
2412
+ if (this.useSmartIdealEdgeLengthCalculation) {
2413
+ edge.idealLength += sizeOfSourceInLca + sizeOfTargetInLca - 2 * LayoutConstants.SIMPLE_NODE_SIZE;
2414
+ }
2415
+ lcaDepth = edge.getLca().getInclusionTreeDepth();
2416
+ edge.idealLength += FDLayoutConstants.DEFAULT_EDGE_LENGTH * FDLayoutConstants.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR * (source.getInclusionTreeDepth() + target.getInclusionTreeDepth() - 2 * lcaDepth);
2417
+ }
2418
+ }
2419
+ };
2420
+ FDLayout.prototype.initSpringEmbedder = function() {
2421
+ var s = this.getAllNodes().length;
2422
+ if (this.incremental) {
2423
+ if (s > FDLayoutConstants.ADAPTATION_LOWER_NODE_LIMIT) {
2424
+ this.coolingFactor = Math.max(this.coolingFactor * FDLayoutConstants.COOLING_ADAPTATION_FACTOR, this.coolingFactor - (s - FDLayoutConstants.ADAPTATION_LOWER_NODE_LIMIT) / (FDLayoutConstants.ADAPTATION_UPPER_NODE_LIMIT - FDLayoutConstants.ADAPTATION_LOWER_NODE_LIMIT) * this.coolingFactor * (1 - FDLayoutConstants.COOLING_ADAPTATION_FACTOR));
2425
+ }
2426
+ this.maxNodeDisplacement = FDLayoutConstants.MAX_NODE_DISPLACEMENT_INCREMENTAL;
2427
+ } else {
2428
+ if (s > FDLayoutConstants.ADAPTATION_LOWER_NODE_LIMIT) {
2429
+ this.coolingFactor = Math.max(FDLayoutConstants.COOLING_ADAPTATION_FACTOR, 1 - (s - FDLayoutConstants.ADAPTATION_LOWER_NODE_LIMIT) / (FDLayoutConstants.ADAPTATION_UPPER_NODE_LIMIT - FDLayoutConstants.ADAPTATION_LOWER_NODE_LIMIT) * (1 - FDLayoutConstants.COOLING_ADAPTATION_FACTOR));
2430
+ } else {
2431
+ this.coolingFactor = 1;
2432
+ }
2433
+ this.initialCoolingFactor = this.coolingFactor;
2434
+ this.maxNodeDisplacement = FDLayoutConstants.MAX_NODE_DISPLACEMENT;
2435
+ }
2436
+ this.maxIterations = Math.max(this.getAllNodes().length * 5, this.maxIterations);
2437
+ this.totalDisplacementThreshold = this.displacementThresholdPerNode * this.getAllNodes().length;
2438
+ this.repulsionRange = this.calcRepulsionRange();
2439
+ };
2440
+ FDLayout.prototype.calcSpringForces = function() {
2441
+ var lEdges = this.getAllEdges();
2442
+ var edge;
2443
+ for (var i = 0;i < lEdges.length; i++) {
2444
+ edge = lEdges[i];
2445
+ this.calcSpringForce(edge, edge.idealLength);
2446
+ }
2447
+ };
2448
+ FDLayout.prototype.calcRepulsionForces = function() {
2449
+ var gridUpdateAllowed = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
2450
+ var forceToNodeSurroundingUpdate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
2451
+ var i, j;
2452
+ var nodeA, nodeB;
2453
+ var lNodes = this.getAllNodes();
2454
+ var processedNodeSet;
2455
+ if (this.useFRGridVariant) {
2456
+ if (this.totalIterations % FDLayoutConstants.GRID_CALCULATION_CHECK_PERIOD == 1 && gridUpdateAllowed) {
2457
+ this.updateGrid();
2458
+ }
2459
+ processedNodeSet = new Set;
2460
+ for (i = 0;i < lNodes.length; i++) {
2461
+ nodeA = lNodes[i];
2462
+ this.calculateRepulsionForceOfANode(nodeA, processedNodeSet, gridUpdateAllowed, forceToNodeSurroundingUpdate);
2463
+ processedNodeSet.add(nodeA);
2464
+ }
2465
+ } else {
2466
+ for (i = 0;i < lNodes.length; i++) {
2467
+ nodeA = lNodes[i];
2468
+ for (j = i + 1;j < lNodes.length; j++) {
2469
+ nodeB = lNodes[j];
2470
+ if (nodeA.getOwner() != nodeB.getOwner()) {
2471
+ continue;
2472
+ }
2473
+ this.calcRepulsionForce(nodeA, nodeB);
2474
+ }
2475
+ }
2476
+ }
2477
+ };
2478
+ FDLayout.prototype.calcGravitationalForces = function() {
2479
+ var node;
2480
+ var lNodes = this.getAllNodesToApplyGravitation();
2481
+ for (var i = 0;i < lNodes.length; i++) {
2482
+ node = lNodes[i];
2483
+ this.calcGravitationalForce(node);
2484
+ }
2485
+ };
2486
+ FDLayout.prototype.moveNodes = function() {
2487
+ var lNodes = this.getAllNodes();
2488
+ var node;
2489
+ for (var i = 0;i < lNodes.length; i++) {
2490
+ node = lNodes[i];
2491
+ node.move();
2492
+ }
2493
+ };
2494
+ FDLayout.prototype.calcSpringForce = function(edge, idealLength) {
2495
+ var sourceNode = edge.getSource();
2496
+ var targetNode = edge.getTarget();
2497
+ var length;
2498
+ var springForce;
2499
+ var springForceX;
2500
+ var springForceY;
2501
+ if (this.uniformLeafNodeSizes && sourceNode.getChild() == null && targetNode.getChild() == null) {
2502
+ edge.updateLengthSimple();
2503
+ } else {
2504
+ edge.updateLength();
2505
+ if (edge.isOverlapingSourceAndTarget) {
2506
+ return;
2507
+ }
2508
+ }
2509
+ length = edge.getLength();
2510
+ if (length == 0)
2511
+ return;
2512
+ springForce = this.springConstant * (length - idealLength);
2513
+ springForceX = springForce * (edge.lengthX / length);
2514
+ springForceY = springForce * (edge.lengthY / length);
2515
+ sourceNode.springForceX += springForceX;
2516
+ sourceNode.springForceY += springForceY;
2517
+ targetNode.springForceX -= springForceX;
2518
+ targetNode.springForceY -= springForceY;
2519
+ };
2520
+ FDLayout.prototype.calcRepulsionForce = function(nodeA, nodeB) {
2521
+ var rectA = nodeA.getRect();
2522
+ var rectB = nodeB.getRect();
2523
+ var overlapAmount = new Array(2);
2524
+ var clipPoints = new Array(4);
2525
+ var distanceX;
2526
+ var distanceY;
2527
+ var distanceSquared;
2528
+ var distance;
2529
+ var repulsionForce;
2530
+ var repulsionForceX;
2531
+ var repulsionForceY;
2532
+ if (rectA.intersects(rectB)) {
2533
+ IGeometry.calcSeparationAmount(rectA, rectB, overlapAmount, FDLayoutConstants.DEFAULT_EDGE_LENGTH / 2);
2534
+ repulsionForceX = 2 * overlapAmount[0];
2535
+ repulsionForceY = 2 * overlapAmount[1];
2536
+ var childrenConstant = nodeA.noOfChildren * nodeB.noOfChildren / (nodeA.noOfChildren + nodeB.noOfChildren);
2537
+ nodeA.repulsionForceX -= childrenConstant * repulsionForceX;
2538
+ nodeA.repulsionForceY -= childrenConstant * repulsionForceY;
2539
+ nodeB.repulsionForceX += childrenConstant * repulsionForceX;
2540
+ nodeB.repulsionForceY += childrenConstant * repulsionForceY;
2541
+ } else {
2542
+ if (this.uniformLeafNodeSizes && nodeA.getChild() == null && nodeB.getChild() == null) {
2543
+ distanceX = rectB.getCenterX() - rectA.getCenterX();
2544
+ distanceY = rectB.getCenterY() - rectA.getCenterY();
2545
+ } else {
2546
+ IGeometry.getIntersection(rectA, rectB, clipPoints);
2547
+ distanceX = clipPoints[2] - clipPoints[0];
2548
+ distanceY = clipPoints[3] - clipPoints[1];
2549
+ }
2550
+ if (Math.abs(distanceX) < FDLayoutConstants.MIN_REPULSION_DIST) {
2551
+ distanceX = IMath.sign(distanceX) * FDLayoutConstants.MIN_REPULSION_DIST;
2552
+ }
2553
+ if (Math.abs(distanceY) < FDLayoutConstants.MIN_REPULSION_DIST) {
2554
+ distanceY = IMath.sign(distanceY) * FDLayoutConstants.MIN_REPULSION_DIST;
2555
+ }
2556
+ distanceSquared = distanceX * distanceX + distanceY * distanceY;
2557
+ distance = Math.sqrt(distanceSquared);
2558
+ repulsionForce = this.repulsionConstant * nodeA.noOfChildren * nodeB.noOfChildren / distanceSquared;
2559
+ repulsionForceX = repulsionForce * distanceX / distance;
2560
+ repulsionForceY = repulsionForce * distanceY / distance;
2561
+ nodeA.repulsionForceX -= repulsionForceX;
2562
+ nodeA.repulsionForceY -= repulsionForceY;
2563
+ nodeB.repulsionForceX += repulsionForceX;
2564
+ nodeB.repulsionForceY += repulsionForceY;
2565
+ }
2566
+ };
2567
+ FDLayout.prototype.calcGravitationalForce = function(node) {
2568
+ var ownerGraph;
2569
+ var ownerCenterX;
2570
+ var ownerCenterY;
2571
+ var distanceX;
2572
+ var distanceY;
2573
+ var absDistanceX;
2574
+ var absDistanceY;
2575
+ var estimatedSize;
2576
+ ownerGraph = node.getOwner();
2577
+ ownerCenterX = (ownerGraph.getRight() + ownerGraph.getLeft()) / 2;
2578
+ ownerCenterY = (ownerGraph.getTop() + ownerGraph.getBottom()) / 2;
2579
+ distanceX = node.getCenterX() - ownerCenterX;
2580
+ distanceY = node.getCenterY() - ownerCenterY;
2581
+ absDistanceX = Math.abs(distanceX) + node.getWidth() / 2;
2582
+ absDistanceY = Math.abs(distanceY) + node.getHeight() / 2;
2583
+ if (node.getOwner() == this.graphManager.getRoot()) {
2584
+ estimatedSize = ownerGraph.getEstimatedSize() * this.gravityRangeFactor;
2585
+ if (absDistanceX > estimatedSize || absDistanceY > estimatedSize) {
2586
+ node.gravitationForceX = -this.gravityConstant * distanceX;
2587
+ node.gravitationForceY = -this.gravityConstant * distanceY;
2588
+ }
2589
+ } else {
2590
+ estimatedSize = ownerGraph.getEstimatedSize() * this.compoundGravityRangeFactor;
2591
+ if (absDistanceX > estimatedSize || absDistanceY > estimatedSize) {
2592
+ node.gravitationForceX = -this.gravityConstant * distanceX * this.compoundGravityConstant;
2593
+ node.gravitationForceY = -this.gravityConstant * distanceY * this.compoundGravityConstant;
2594
+ }
2595
+ }
2596
+ };
2597
+ FDLayout.prototype.isConverged = function() {
2598
+ var converged;
2599
+ var oscilating = false;
2600
+ if (this.totalIterations > this.maxIterations / 3) {
2601
+ oscilating = Math.abs(this.totalDisplacement - this.oldTotalDisplacement) < 2;
2602
+ }
2603
+ converged = this.totalDisplacement < this.totalDisplacementThreshold;
2604
+ this.oldTotalDisplacement = this.totalDisplacement;
2605
+ return converged || oscilating;
2606
+ };
2607
+ FDLayout.prototype.animate = function() {
2608
+ if (this.animationDuringLayout && !this.isSubLayout) {
2609
+ if (this.notAnimatedIterations == this.animationPeriod) {
2610
+ this.update();
2611
+ this.notAnimatedIterations = 0;
2612
+ } else {
2613
+ this.notAnimatedIterations++;
2614
+ }
2615
+ }
2616
+ };
2617
+ FDLayout.prototype.calcNoOfChildrenForAllNodes = function() {
2618
+ var node;
2619
+ var allNodes = this.graphManager.getAllNodes();
2620
+ for (var i = 0;i < allNodes.length; i++) {
2621
+ node = allNodes[i];
2622
+ node.noOfChildren = node.getNoOfChildren();
2623
+ }
2624
+ };
2625
+ FDLayout.prototype.calcGrid = function(graph) {
2626
+ var sizeX = 0;
2627
+ var sizeY = 0;
2628
+ sizeX = parseInt(Math.ceil((graph.getRight() - graph.getLeft()) / this.repulsionRange));
2629
+ sizeY = parseInt(Math.ceil((graph.getBottom() - graph.getTop()) / this.repulsionRange));
2630
+ var grid = new Array(sizeX);
2631
+ for (var i = 0;i < sizeX; i++) {
2632
+ grid[i] = new Array(sizeY);
2633
+ }
2634
+ for (var i = 0;i < sizeX; i++) {
2635
+ for (var j = 0;j < sizeY; j++) {
2636
+ grid[i][j] = new Array;
2637
+ }
2638
+ }
2639
+ return grid;
2640
+ };
2641
+ FDLayout.prototype.addNodeToGrid = function(v, left, top) {
2642
+ var startX = 0;
2643
+ var finishX = 0;
2644
+ var startY = 0;
2645
+ var finishY = 0;
2646
+ startX = parseInt(Math.floor((v.getRect().x - left) / this.repulsionRange));
2647
+ finishX = parseInt(Math.floor((v.getRect().width + v.getRect().x - left) / this.repulsionRange));
2648
+ startY = parseInt(Math.floor((v.getRect().y - top) / this.repulsionRange));
2649
+ finishY = parseInt(Math.floor((v.getRect().height + v.getRect().y - top) / this.repulsionRange));
2650
+ for (var i = startX;i <= finishX; i++) {
2651
+ for (var j = startY;j <= finishY; j++) {
2652
+ this.grid[i][j].push(v);
2653
+ v.setGridCoordinates(startX, finishX, startY, finishY);
2654
+ }
2655
+ }
2656
+ };
2657
+ FDLayout.prototype.updateGrid = function() {
2658
+ var i;
2659
+ var nodeA;
2660
+ var lNodes = this.getAllNodes();
2661
+ this.grid = this.calcGrid(this.graphManager.getRoot());
2662
+ for (i = 0;i < lNodes.length; i++) {
2663
+ nodeA = lNodes[i];
2664
+ this.addNodeToGrid(nodeA, this.graphManager.getRoot().getLeft(), this.graphManager.getRoot().getTop());
2665
+ }
2666
+ };
2667
+ FDLayout.prototype.calculateRepulsionForceOfANode = function(nodeA, processedNodeSet, gridUpdateAllowed, forceToNodeSurroundingUpdate) {
2668
+ if (this.totalIterations % FDLayoutConstants.GRID_CALCULATION_CHECK_PERIOD == 1 && gridUpdateAllowed || forceToNodeSurroundingUpdate) {
2669
+ var surrounding = new Set;
2670
+ nodeA.surrounding = new Array;
2671
+ var nodeB;
2672
+ var grid = this.grid;
2673
+ for (var i = nodeA.startX - 1;i < nodeA.finishX + 2; i++) {
2674
+ for (var j = nodeA.startY - 1;j < nodeA.finishY + 2; j++) {
2675
+ if (!(i < 0 || j < 0 || i >= grid.length || j >= grid[0].length)) {
2676
+ for (var k = 0;k < grid[i][j].length; k++) {
2677
+ nodeB = grid[i][j][k];
2678
+ if (nodeA.getOwner() != nodeB.getOwner() || nodeA == nodeB) {
2679
+ continue;
2680
+ }
2681
+ if (!processedNodeSet.has(nodeB) && !surrounding.has(nodeB)) {
2682
+ var distanceX = Math.abs(nodeA.getCenterX() - nodeB.getCenterX()) - (nodeA.getWidth() / 2 + nodeB.getWidth() / 2);
2683
+ var distanceY = Math.abs(nodeA.getCenterY() - nodeB.getCenterY()) - (nodeA.getHeight() / 2 + nodeB.getHeight() / 2);
2684
+ if (distanceX <= this.repulsionRange && distanceY <= this.repulsionRange) {
2685
+ surrounding.add(nodeB);
2686
+ }
2687
+ }
2688
+ }
2689
+ }
2690
+ }
2691
+ }
2692
+ nodeA.surrounding = [].concat(_toConsumableArray(surrounding));
2693
+ }
2694
+ for (i = 0;i < nodeA.surrounding.length; i++) {
2695
+ this.calcRepulsionForce(nodeA, nodeA.surrounding[i]);
2696
+ }
2697
+ };
2698
+ FDLayout.prototype.calcRepulsionRange = function() {
2699
+ return 0;
2700
+ };
2701
+ module2.exports = FDLayout;
2702
+ },
2703
+ function(module2, exports2, __webpack_require__) {
2704
+ var LEdge = __webpack_require__(1);
2705
+ var FDLayoutConstants = __webpack_require__(7);
2706
+ function FDLayoutEdge(source, target, vEdge) {
2707
+ LEdge.call(this, source, target, vEdge);
2708
+ this.idealLength = FDLayoutConstants.DEFAULT_EDGE_LENGTH;
2709
+ }
2710
+ FDLayoutEdge.prototype = Object.create(LEdge.prototype);
2711
+ for (var prop in LEdge) {
2712
+ FDLayoutEdge[prop] = LEdge[prop];
2713
+ }
2714
+ module2.exports = FDLayoutEdge;
2715
+ },
2716
+ function(module2, exports2, __webpack_require__) {
2717
+ var LNode = __webpack_require__(3);
2718
+ function FDLayoutNode(gm, loc, size, vNode) {
2719
+ LNode.call(this, gm, loc, size, vNode);
2720
+ this.springForceX = 0;
2721
+ this.springForceY = 0;
2722
+ this.repulsionForceX = 0;
2723
+ this.repulsionForceY = 0;
2724
+ this.gravitationForceX = 0;
2725
+ this.gravitationForceY = 0;
2726
+ this.displacementX = 0;
2727
+ this.displacementY = 0;
2728
+ this.startX = 0;
2729
+ this.finishX = 0;
2730
+ this.startY = 0;
2731
+ this.finishY = 0;
2732
+ this.surrounding = [];
2733
+ }
2734
+ FDLayoutNode.prototype = Object.create(LNode.prototype);
2735
+ for (var prop in LNode) {
2736
+ FDLayoutNode[prop] = LNode[prop];
2737
+ }
2738
+ FDLayoutNode.prototype.setGridCoordinates = function(_startX, _finishX, _startY, _finishY) {
2739
+ this.startX = _startX;
2740
+ this.finishX = _finishX;
2741
+ this.startY = _startY;
2742
+ this.finishY = _finishY;
2743
+ };
2744
+ module2.exports = FDLayoutNode;
2745
+ },
2746
+ function(module2, exports2, __webpack_require__) {
2747
+ function DimensionD2(width, height) {
2748
+ this.width = 0;
2749
+ this.height = 0;
2750
+ if (width !== null && height !== null) {
2751
+ this.height = height;
2752
+ this.width = width;
2753
+ }
2754
+ }
2755
+ DimensionD2.prototype.getWidth = function() {
2756
+ return this.width;
2757
+ };
2758
+ DimensionD2.prototype.setWidth = function(width) {
2759
+ this.width = width;
2760
+ };
2761
+ DimensionD2.prototype.getHeight = function() {
2762
+ return this.height;
2763
+ };
2764
+ DimensionD2.prototype.setHeight = function(height) {
2765
+ this.height = height;
2766
+ };
2767
+ module2.exports = DimensionD2;
2768
+ },
2769
+ function(module2, exports2, __webpack_require__) {
2770
+ var UniqueIDGeneretor = __webpack_require__(14);
2771
+ function HashMap() {
2772
+ this.map = {};
2773
+ this.keys = [];
2774
+ }
2775
+ HashMap.prototype.put = function(key, value) {
2776
+ var theId = UniqueIDGeneretor.createID(key);
2777
+ if (!this.contains(theId)) {
2778
+ this.map[theId] = value;
2779
+ this.keys.push(key);
2780
+ }
2781
+ };
2782
+ HashMap.prototype.contains = function(key) {
2783
+ var theId = UniqueIDGeneretor.createID(key);
2784
+ return this.map[key] != null;
2785
+ };
2786
+ HashMap.prototype.get = function(key) {
2787
+ var theId = UniqueIDGeneretor.createID(key);
2788
+ return this.map[theId];
2789
+ };
2790
+ HashMap.prototype.keySet = function() {
2791
+ return this.keys;
2792
+ };
2793
+ module2.exports = HashMap;
2794
+ },
2795
+ function(module2, exports2, __webpack_require__) {
2796
+ var UniqueIDGeneretor = __webpack_require__(14);
2797
+ function HashSet() {
2798
+ this.set = {};
2799
+ }
2800
+ HashSet.prototype.add = function(obj) {
2801
+ var theId = UniqueIDGeneretor.createID(obj);
2802
+ if (!this.contains(theId))
2803
+ this.set[theId] = obj;
2804
+ };
2805
+ HashSet.prototype.remove = function(obj) {
2806
+ delete this.set[UniqueIDGeneretor.createID(obj)];
2807
+ };
2808
+ HashSet.prototype.clear = function() {
2809
+ this.set = {};
2810
+ };
2811
+ HashSet.prototype.contains = function(obj) {
2812
+ return this.set[UniqueIDGeneretor.createID(obj)] == obj;
2813
+ };
2814
+ HashSet.prototype.isEmpty = function() {
2815
+ return this.size() === 0;
2816
+ };
2817
+ HashSet.prototype.size = function() {
2818
+ return Object.keys(this.set).length;
2819
+ };
2820
+ HashSet.prototype.addAllTo = function(list) {
2821
+ var keys = Object.keys(this.set);
2822
+ var length = keys.length;
2823
+ for (var i = 0;i < length; i++) {
2824
+ list.push(this.set[keys[i]]);
2825
+ }
2826
+ };
2827
+ HashSet.prototype.size = function() {
2828
+ return Object.keys(this.set).length;
2829
+ };
2830
+ HashSet.prototype.addAll = function(list) {
2831
+ var s = list.length;
2832
+ for (var i = 0;i < s; i++) {
2833
+ var v = list[i];
2834
+ this.add(v);
2835
+ }
2836
+ };
2837
+ module2.exports = HashSet;
2838
+ },
2839
+ function(module2, exports2, __webpack_require__) {
2840
+ var _createClass = function() {
2841
+ function defineProperties(target, props) {
2842
+ for (var i = 0;i < props.length; i++) {
2843
+ var descriptor = props[i];
2844
+ descriptor.enumerable = descriptor.enumerable || false;
2845
+ descriptor.configurable = true;
2846
+ if ("value" in descriptor)
2847
+ descriptor.writable = true;
2848
+ Object.defineProperty(target, descriptor.key, descriptor);
2849
+ }
2850
+ }
2851
+ return function(Constructor, protoProps, staticProps) {
2852
+ if (protoProps)
2853
+ defineProperties(Constructor.prototype, protoProps);
2854
+ if (staticProps)
2855
+ defineProperties(Constructor, staticProps);
2856
+ return Constructor;
2857
+ };
2858
+ }();
2859
+ function _classCallCheck(instance2, Constructor) {
2860
+ if (!(instance2 instanceof Constructor)) {
2861
+ throw new TypeError("Cannot call a class as a function");
2862
+ }
2863
+ }
2864
+ var LinkedList = __webpack_require__(11);
2865
+ var Quicksort = function() {
2866
+ function Quicksort2(A, compareFunction) {
2867
+ _classCallCheck(this, Quicksort2);
2868
+ if (compareFunction !== null || compareFunction !== undefined)
2869
+ this.compareFunction = this._defaultCompareFunction;
2870
+ var length = undefined;
2871
+ if (A instanceof LinkedList)
2872
+ length = A.size();
2873
+ else
2874
+ length = A.length;
2875
+ this._quicksort(A, 0, length - 1);
2876
+ }
2877
+ _createClass(Quicksort2, [{
2878
+ key: "_quicksort",
2879
+ value: function _quicksort(A, p, r) {
2880
+ if (p < r) {
2881
+ var q = this._partition(A, p, r);
2882
+ this._quicksort(A, p, q);
2883
+ this._quicksort(A, q + 1, r);
2884
+ }
2885
+ }
2886
+ }, {
2887
+ key: "_partition",
2888
+ value: function _partition(A, p, r) {
2889
+ var x = this._get(A, p);
2890
+ var i = p;
2891
+ var j = r;
2892
+ while (true) {
2893
+ while (this.compareFunction(x, this._get(A, j))) {
2894
+ j--;
2895
+ }
2896
+ while (this.compareFunction(this._get(A, i), x)) {
2897
+ i++;
2898
+ }
2899
+ if (i < j) {
2900
+ this._swap(A, i, j);
2901
+ i++;
2902
+ j--;
2903
+ } else
2904
+ return j;
2905
+ }
2906
+ }
2907
+ }, {
2908
+ key: "_get",
2909
+ value: function _get(object, index) {
2910
+ if (object instanceof LinkedList)
2911
+ return object.get_object_at(index);
2912
+ else
2913
+ return object[index];
2914
+ }
2915
+ }, {
2916
+ key: "_set",
2917
+ value: function _set(object, index, value) {
2918
+ if (object instanceof LinkedList)
2919
+ object.set_object_at(index, value);
2920
+ else
2921
+ object[index] = value;
2922
+ }
2923
+ }, {
2924
+ key: "_swap",
2925
+ value: function _swap(A, i, j) {
2926
+ var temp = this._get(A, i);
2927
+ this._set(A, i, this._get(A, j));
2928
+ this._set(A, j, temp);
2929
+ }
2930
+ }, {
2931
+ key: "_defaultCompareFunction",
2932
+ value: function _defaultCompareFunction(a, b) {
2933
+ return b > a;
2934
+ }
2935
+ }]);
2936
+ return Quicksort2;
2937
+ }();
2938
+ module2.exports = Quicksort;
2939
+ },
2940
+ function(module2, exports2, __webpack_require__) {
2941
+ var _createClass = function() {
2942
+ function defineProperties(target, props) {
2943
+ for (var i = 0;i < props.length; i++) {
2944
+ var descriptor = props[i];
2945
+ descriptor.enumerable = descriptor.enumerable || false;
2946
+ descriptor.configurable = true;
2947
+ if ("value" in descriptor)
2948
+ descriptor.writable = true;
2949
+ Object.defineProperty(target, descriptor.key, descriptor);
2950
+ }
2951
+ }
2952
+ return function(Constructor, protoProps, staticProps) {
2953
+ if (protoProps)
2954
+ defineProperties(Constructor.prototype, protoProps);
2955
+ if (staticProps)
2956
+ defineProperties(Constructor, staticProps);
2957
+ return Constructor;
2958
+ };
2959
+ }();
2960
+ function _classCallCheck(instance2, Constructor) {
2961
+ if (!(instance2 instanceof Constructor)) {
2962
+ throw new TypeError("Cannot call a class as a function");
2963
+ }
2964
+ }
2965
+ var NeedlemanWunsch = function() {
2966
+ function NeedlemanWunsch2(sequence1, sequence2) {
2967
+ var match_score = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
2968
+ var mismatch_penalty = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : -1;
2969
+ var gap_penalty = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : -1;
2970
+ _classCallCheck(this, NeedlemanWunsch2);
2971
+ this.sequence1 = sequence1;
2972
+ this.sequence2 = sequence2;
2973
+ this.match_score = match_score;
2974
+ this.mismatch_penalty = mismatch_penalty;
2975
+ this.gap_penalty = gap_penalty;
2976
+ this.iMax = sequence1.length + 1;
2977
+ this.jMax = sequence2.length + 1;
2978
+ this.grid = new Array(this.iMax);
2979
+ for (var i = 0;i < this.iMax; i++) {
2980
+ this.grid[i] = new Array(this.jMax);
2981
+ for (var j = 0;j < this.jMax; j++) {
2982
+ this.grid[i][j] = 0;
2983
+ }
2984
+ }
2985
+ this.tracebackGrid = new Array(this.iMax);
2986
+ for (var _i = 0;_i < this.iMax; _i++) {
2987
+ this.tracebackGrid[_i] = new Array(this.jMax);
2988
+ for (var _j = 0;_j < this.jMax; _j++) {
2989
+ this.tracebackGrid[_i][_j] = [null, null, null];
2990
+ }
2991
+ }
2992
+ this.alignments = [];
2993
+ this.score = -1;
2994
+ this.computeGrids();
2995
+ }
2996
+ _createClass(NeedlemanWunsch2, [{
2997
+ key: "getScore",
2998
+ value: function getScore() {
2999
+ return this.score;
3000
+ }
3001
+ }, {
3002
+ key: "getAlignments",
3003
+ value: function getAlignments() {
3004
+ return this.alignments;
3005
+ }
3006
+ }, {
3007
+ key: "computeGrids",
3008
+ value: function computeGrids() {
3009
+ for (var j = 1;j < this.jMax; j++) {
3010
+ this.grid[0][j] = this.grid[0][j - 1] + this.gap_penalty;
3011
+ this.tracebackGrid[0][j] = [false, false, true];
3012
+ }
3013
+ for (var i = 1;i < this.iMax; i++) {
3014
+ this.grid[i][0] = this.grid[i - 1][0] + this.gap_penalty;
3015
+ this.tracebackGrid[i][0] = [false, true, false];
3016
+ }
3017
+ for (var _i2 = 1;_i2 < this.iMax; _i2++) {
3018
+ for (var _j2 = 1;_j2 < this.jMax; _j2++) {
3019
+ var diag = undefined;
3020
+ if (this.sequence1[_i2 - 1] === this.sequence2[_j2 - 1])
3021
+ diag = this.grid[_i2 - 1][_j2 - 1] + this.match_score;
3022
+ else
3023
+ diag = this.grid[_i2 - 1][_j2 - 1] + this.mismatch_penalty;
3024
+ var up = this.grid[_i2 - 1][_j2] + this.gap_penalty;
3025
+ var left = this.grid[_i2][_j2 - 1] + this.gap_penalty;
3026
+ var maxOf = [diag, up, left];
3027
+ var indices = this.arrayAllMaxIndexes(maxOf);
3028
+ this.grid[_i2][_j2] = maxOf[indices[0]];
3029
+ this.tracebackGrid[_i2][_j2] = [indices.includes(0), indices.includes(1), indices.includes(2)];
3030
+ }
3031
+ }
3032
+ this.score = this.grid[this.iMax - 1][this.jMax - 1];
3033
+ }
3034
+ }, {
3035
+ key: "alignmentTraceback",
3036
+ value: function alignmentTraceback() {
3037
+ var inProcessAlignments = [];
3038
+ inProcessAlignments.push({
3039
+ pos: [this.sequence1.length, this.sequence2.length],
3040
+ seq1: "",
3041
+ seq2: ""
3042
+ });
3043
+ while (inProcessAlignments[0]) {
3044
+ var current = inProcessAlignments[0];
3045
+ var directions = this.tracebackGrid[current.pos[0]][current.pos[1]];
3046
+ if (directions[0]) {
3047
+ inProcessAlignments.push({
3048
+ pos: [current.pos[0] - 1, current.pos[1] - 1],
3049
+ seq1: this.sequence1[current.pos[0] - 1] + current.seq1,
3050
+ seq2: this.sequence2[current.pos[1] - 1] + current.seq2
3051
+ });
3052
+ }
3053
+ if (directions[1]) {
3054
+ inProcessAlignments.push({
3055
+ pos: [current.pos[0] - 1, current.pos[1]],
3056
+ seq1: this.sequence1[current.pos[0] - 1] + current.seq1,
3057
+ seq2: "-" + current.seq2
3058
+ });
3059
+ }
3060
+ if (directions[2]) {
3061
+ inProcessAlignments.push({
3062
+ pos: [current.pos[0], current.pos[1] - 1],
3063
+ seq1: "-" + current.seq1,
3064
+ seq2: this.sequence2[current.pos[1] - 1] + current.seq2
3065
+ });
3066
+ }
3067
+ if (current.pos[0] === 0 && current.pos[1] === 0)
3068
+ this.alignments.push({
3069
+ sequence1: current.seq1,
3070
+ sequence2: current.seq2
3071
+ });
3072
+ inProcessAlignments.shift();
3073
+ }
3074
+ return this.alignments;
3075
+ }
3076
+ }, {
3077
+ key: "getAllIndexes",
3078
+ value: function getAllIndexes(arr, val) {
3079
+ var indexes = [], i = -1;
3080
+ while ((i = arr.indexOf(val, i + 1)) !== -1) {
3081
+ indexes.push(i);
3082
+ }
3083
+ return indexes;
3084
+ }
3085
+ }, {
3086
+ key: "arrayAllMaxIndexes",
3087
+ value: function arrayAllMaxIndexes(array) {
3088
+ return this.getAllIndexes(array, Math.max.apply(null, array));
3089
+ }
3090
+ }]);
3091
+ return NeedlemanWunsch2;
3092
+ }();
3093
+ module2.exports = NeedlemanWunsch;
3094
+ },
3095
+ function(module2, exports2, __webpack_require__) {
3096
+ var layoutBase = function layoutBase2() {
3097
+ return;
3098
+ };
3099
+ layoutBase.FDLayout = __webpack_require__(18);
3100
+ layoutBase.FDLayoutConstants = __webpack_require__(7);
3101
+ layoutBase.FDLayoutEdge = __webpack_require__(19);
3102
+ layoutBase.FDLayoutNode = __webpack_require__(20);
3103
+ layoutBase.DimensionD = __webpack_require__(21);
3104
+ layoutBase.HashMap = __webpack_require__(22);
3105
+ layoutBase.HashSet = __webpack_require__(23);
3106
+ layoutBase.IGeometry = __webpack_require__(8);
3107
+ layoutBase.IMath = __webpack_require__(9);
3108
+ layoutBase.Integer = __webpack_require__(10);
3109
+ layoutBase.Point = __webpack_require__(12);
3110
+ layoutBase.PointD = __webpack_require__(4);
3111
+ layoutBase.RandomSeed = __webpack_require__(16);
3112
+ layoutBase.RectangleD = __webpack_require__(13);
3113
+ layoutBase.Transform = __webpack_require__(17);
3114
+ layoutBase.UniqueIDGeneretor = __webpack_require__(14);
3115
+ layoutBase.Quicksort = __webpack_require__(24);
3116
+ layoutBase.LinkedList = __webpack_require__(11);
3117
+ layoutBase.LGraphObject = __webpack_require__(2);
3118
+ layoutBase.LGraph = __webpack_require__(5);
3119
+ layoutBase.LEdge = __webpack_require__(1);
3120
+ layoutBase.LGraphManager = __webpack_require__(6);
3121
+ layoutBase.LNode = __webpack_require__(3);
3122
+ layoutBase.Layout = __webpack_require__(15);
3123
+ layoutBase.LayoutConstants = __webpack_require__(0);
3124
+ layoutBase.NeedlemanWunsch = __webpack_require__(25);
3125
+ module2.exports = layoutBase;
3126
+ },
3127
+ function(module2, exports2, __webpack_require__) {
3128
+ function Emitter() {
3129
+ this.listeners = [];
3130
+ }
3131
+ var p = Emitter.prototype;
3132
+ p.addListener = function(event, callback) {
3133
+ this.listeners.push({
3134
+ event,
3135
+ callback
3136
+ });
3137
+ };
3138
+ p.removeListener = function(event, callback) {
3139
+ for (var i = this.listeners.length;i >= 0; i--) {
3140
+ var l = this.listeners[i];
3141
+ if (l.event === event && l.callback === callback) {
3142
+ this.listeners.splice(i, 1);
3143
+ }
3144
+ }
3145
+ };
3146
+ p.emit = function(event, data) {
3147
+ for (var i = 0;i < this.listeners.length; i++) {
3148
+ var l = this.listeners[i];
3149
+ if (event === l.event) {
3150
+ l.callback(data);
3151
+ }
3152
+ }
3153
+ };
3154
+ module2.exports = Emitter;
3155
+ }
3156
+ ]);
3157
+ });
3158
+ });
3159
+
3160
+ // node_modules/cose-base/cose-base.js
3161
+ var require_cose_base = __commonJS(function(exports, module) {
3162
+ (function webpackUniversalModuleDefinition(root, factory) {
3163
+ if (typeof exports === "object" && typeof module === "object")
3164
+ module.exports = factory(require_layout_base());
3165
+ else if (typeof define === "function" && define.amd)
3166
+ define(["layout-base"], factory);
3167
+ else if (typeof exports === "object")
3168
+ exports["coseBase"] = factory(require_layout_base());
3169
+ else
3170
+ root["coseBase"] = factory(root["layoutBase"]);
3171
+ })(exports, function(__WEBPACK_EXTERNAL_MODULE_0__) {
3172
+ return function(modules) {
3173
+ var installedModules = {};
3174
+ function __webpack_require__(moduleId) {
3175
+ if (installedModules[moduleId]) {
3176
+ return installedModules[moduleId].exports;
3177
+ }
3178
+ var module2 = installedModules[moduleId] = {
3179
+ i: moduleId,
3180
+ l: false,
3181
+ exports: {}
3182
+ };
3183
+ modules[moduleId].call(module2.exports, module2, module2.exports, __webpack_require__);
3184
+ module2.l = true;
3185
+ return module2.exports;
3186
+ }
3187
+ __webpack_require__.m = modules;
3188
+ __webpack_require__.c = installedModules;
3189
+ __webpack_require__.i = function(value) {
3190
+ return value;
3191
+ };
3192
+ __webpack_require__.d = function(exports2, name, getter) {
3193
+ if (!__webpack_require__.o(exports2, name)) {
3194
+ Object.defineProperty(exports2, name, {
3195
+ configurable: false,
3196
+ enumerable: true,
3197
+ get: getter
3198
+ });
3199
+ }
3200
+ };
3201
+ __webpack_require__.n = function(module2) {
3202
+ var getter = module2 && module2.__esModule ? function getDefault() {
3203
+ return module2["default"];
3204
+ } : function getModuleExports() {
3205
+ return module2;
3206
+ };
3207
+ __webpack_require__.d(getter, "a", getter);
3208
+ return getter;
3209
+ };
3210
+ __webpack_require__.o = function(object, property) {
3211
+ return Object.prototype.hasOwnProperty.call(object, property);
3212
+ };
3213
+ __webpack_require__.p = "";
3214
+ return __webpack_require__(__webpack_require__.s = 7);
3215
+ }([
3216
+ function(module2, exports2) {
3217
+ module2.exports = __WEBPACK_EXTERNAL_MODULE_0__;
3218
+ },
3219
+ function(module2, exports2, __webpack_require__) {
3220
+ var FDLayoutConstants = __webpack_require__(0).FDLayoutConstants;
3221
+ function CoSEConstants() {}
3222
+ for (var prop in FDLayoutConstants) {
3223
+ CoSEConstants[prop] = FDLayoutConstants[prop];
3224
+ }
3225
+ CoSEConstants.DEFAULT_USE_MULTI_LEVEL_SCALING = false;
3226
+ CoSEConstants.DEFAULT_RADIAL_SEPARATION = FDLayoutConstants.DEFAULT_EDGE_LENGTH;
3227
+ CoSEConstants.DEFAULT_COMPONENT_SEPERATION = 60;
3228
+ CoSEConstants.TILE = true;
3229
+ CoSEConstants.TILING_PADDING_VERTICAL = 10;
3230
+ CoSEConstants.TILING_PADDING_HORIZONTAL = 10;
3231
+ CoSEConstants.TREE_REDUCTION_ON_INCREMENTAL = false;
3232
+ module2.exports = CoSEConstants;
3233
+ },
3234
+ function(module2, exports2, __webpack_require__) {
3235
+ var FDLayoutEdge = __webpack_require__(0).FDLayoutEdge;
3236
+ function CoSEEdge(source, target, vEdge) {
3237
+ FDLayoutEdge.call(this, source, target, vEdge);
3238
+ }
3239
+ CoSEEdge.prototype = Object.create(FDLayoutEdge.prototype);
3240
+ for (var prop in FDLayoutEdge) {
3241
+ CoSEEdge[prop] = FDLayoutEdge[prop];
3242
+ }
3243
+ module2.exports = CoSEEdge;
3244
+ },
3245
+ function(module2, exports2, __webpack_require__) {
3246
+ var LGraph = __webpack_require__(0).LGraph;
3247
+ function CoSEGraph(parent, graphMgr, vGraph) {
3248
+ LGraph.call(this, parent, graphMgr, vGraph);
3249
+ }
3250
+ CoSEGraph.prototype = Object.create(LGraph.prototype);
3251
+ for (var prop in LGraph) {
3252
+ CoSEGraph[prop] = LGraph[prop];
3253
+ }
3254
+ module2.exports = CoSEGraph;
3255
+ },
3256
+ function(module2, exports2, __webpack_require__) {
3257
+ var LGraphManager = __webpack_require__(0).LGraphManager;
3258
+ function CoSEGraphManager(layout) {
3259
+ LGraphManager.call(this, layout);
3260
+ }
3261
+ CoSEGraphManager.prototype = Object.create(LGraphManager.prototype);
3262
+ for (var prop in LGraphManager) {
3263
+ CoSEGraphManager[prop] = LGraphManager[prop];
3264
+ }
3265
+ module2.exports = CoSEGraphManager;
3266
+ },
3267
+ function(module2, exports2, __webpack_require__) {
3268
+ var FDLayoutNode = __webpack_require__(0).FDLayoutNode;
3269
+ var IMath = __webpack_require__(0).IMath;
3270
+ function CoSENode(gm, loc, size, vNode) {
3271
+ FDLayoutNode.call(this, gm, loc, size, vNode);
3272
+ }
3273
+ CoSENode.prototype = Object.create(FDLayoutNode.prototype);
3274
+ for (var prop in FDLayoutNode) {
3275
+ CoSENode[prop] = FDLayoutNode[prop];
3276
+ }
3277
+ CoSENode.prototype.move = function() {
3278
+ var layout = this.graphManager.getLayout();
3279
+ this.displacementX = layout.coolingFactor * (this.springForceX + this.repulsionForceX + this.gravitationForceX) / this.noOfChildren;
3280
+ this.displacementY = layout.coolingFactor * (this.springForceY + this.repulsionForceY + this.gravitationForceY) / this.noOfChildren;
3281
+ if (Math.abs(this.displacementX) > layout.coolingFactor * layout.maxNodeDisplacement) {
3282
+ this.displacementX = layout.coolingFactor * layout.maxNodeDisplacement * IMath.sign(this.displacementX);
3283
+ }
3284
+ if (Math.abs(this.displacementY) > layout.coolingFactor * layout.maxNodeDisplacement) {
3285
+ this.displacementY = layout.coolingFactor * layout.maxNodeDisplacement * IMath.sign(this.displacementY);
3286
+ }
3287
+ if (this.child == null) {
3288
+ this.moveBy(this.displacementX, this.displacementY);
3289
+ } else if (this.child.getNodes().length == 0) {
3290
+ this.moveBy(this.displacementX, this.displacementY);
3291
+ } else {
3292
+ this.propogateDisplacementToChildren(this.displacementX, this.displacementY);
3293
+ }
3294
+ layout.totalDisplacement += Math.abs(this.displacementX) + Math.abs(this.displacementY);
3295
+ this.springForceX = 0;
3296
+ this.springForceY = 0;
3297
+ this.repulsionForceX = 0;
3298
+ this.repulsionForceY = 0;
3299
+ this.gravitationForceX = 0;
3300
+ this.gravitationForceY = 0;
3301
+ this.displacementX = 0;
3302
+ this.displacementY = 0;
3303
+ };
3304
+ CoSENode.prototype.propogateDisplacementToChildren = function(dX, dY) {
3305
+ var nodes = this.getChild().getNodes();
3306
+ var node;
3307
+ for (var i = 0;i < nodes.length; i++) {
3308
+ node = nodes[i];
3309
+ if (node.getChild() == null) {
3310
+ node.moveBy(dX, dY);
3311
+ node.displacementX += dX;
3312
+ node.displacementY += dY;
3313
+ } else {
3314
+ node.propogateDisplacementToChildren(dX, dY);
3315
+ }
3316
+ }
3317
+ };
3318
+ CoSENode.prototype.setPred1 = function(pred12) {
3319
+ this.pred1 = pred12;
3320
+ };
3321
+ CoSENode.prototype.getPred1 = function() {
3322
+ return pred1;
3323
+ };
3324
+ CoSENode.prototype.getPred2 = function() {
3325
+ return pred2;
3326
+ };
3327
+ CoSENode.prototype.setNext = function(next2) {
3328
+ this.next = next2;
3329
+ };
3330
+ CoSENode.prototype.getNext = function() {
3331
+ return next;
3332
+ };
3333
+ CoSENode.prototype.setProcessed = function(processed2) {
3334
+ this.processed = processed2;
3335
+ };
3336
+ CoSENode.prototype.isProcessed = function() {
3337
+ return processed;
3338
+ };
3339
+ module2.exports = CoSENode;
3340
+ },
3341
+ function(module2, exports2, __webpack_require__) {
3342
+ var FDLayout = __webpack_require__(0).FDLayout;
3343
+ var CoSEGraphManager = __webpack_require__(4);
3344
+ var CoSEGraph = __webpack_require__(3);
3345
+ var CoSENode = __webpack_require__(5);
3346
+ var CoSEEdge = __webpack_require__(2);
3347
+ var CoSEConstants = __webpack_require__(1);
3348
+ var FDLayoutConstants = __webpack_require__(0).FDLayoutConstants;
3349
+ var LayoutConstants = __webpack_require__(0).LayoutConstants;
3350
+ var Point2 = __webpack_require__(0).Point;
3351
+ var PointD = __webpack_require__(0).PointD;
3352
+ var Layout2 = __webpack_require__(0).Layout;
3353
+ var Integer = __webpack_require__(0).Integer;
3354
+ var IGeometry = __webpack_require__(0).IGeometry;
3355
+ var LGraph = __webpack_require__(0).LGraph;
3356
+ var Transform = __webpack_require__(0).Transform;
3357
+ function CoSELayout() {
3358
+ FDLayout.call(this);
3359
+ this.toBeTiled = {};
3360
+ }
3361
+ CoSELayout.prototype = Object.create(FDLayout.prototype);
3362
+ for (var prop in FDLayout) {
3363
+ CoSELayout[prop] = FDLayout[prop];
3364
+ }
3365
+ CoSELayout.prototype.newGraphManager = function() {
3366
+ var gm = new CoSEGraphManager(this);
3367
+ this.graphManager = gm;
3368
+ return gm;
3369
+ };
3370
+ CoSELayout.prototype.newGraph = function(vGraph) {
3371
+ return new CoSEGraph(null, this.graphManager, vGraph);
3372
+ };
3373
+ CoSELayout.prototype.newNode = function(vNode) {
3374
+ return new CoSENode(this.graphManager, vNode);
3375
+ };
3376
+ CoSELayout.prototype.newEdge = function(vEdge) {
3377
+ return new CoSEEdge(null, null, vEdge);
3378
+ };
3379
+ CoSELayout.prototype.initParameters = function() {
3380
+ FDLayout.prototype.initParameters.call(this, arguments);
3381
+ if (!this.isSubLayout) {
3382
+ if (CoSEConstants.DEFAULT_EDGE_LENGTH < 10) {
3383
+ this.idealEdgeLength = 10;
3384
+ } else {
3385
+ this.idealEdgeLength = CoSEConstants.DEFAULT_EDGE_LENGTH;
3386
+ }
3387
+ this.useSmartIdealEdgeLengthCalculation = CoSEConstants.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION;
3388
+ this.springConstant = FDLayoutConstants.DEFAULT_SPRING_STRENGTH;
3389
+ this.repulsionConstant = FDLayoutConstants.DEFAULT_REPULSION_STRENGTH;
3390
+ this.gravityConstant = FDLayoutConstants.DEFAULT_GRAVITY_STRENGTH;
3391
+ this.compoundGravityConstant = FDLayoutConstants.DEFAULT_COMPOUND_GRAVITY_STRENGTH;
3392
+ this.gravityRangeFactor = FDLayoutConstants.DEFAULT_GRAVITY_RANGE_FACTOR;
3393
+ this.compoundGravityRangeFactor = FDLayoutConstants.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR;
3394
+ this.prunedNodesAll = [];
3395
+ this.growTreeIterations = 0;
3396
+ this.afterGrowthIterations = 0;
3397
+ this.isTreeGrowing = false;
3398
+ this.isGrowthFinished = false;
3399
+ this.coolingCycle = 0;
3400
+ this.maxCoolingCycle = this.maxIterations / FDLayoutConstants.CONVERGENCE_CHECK_PERIOD;
3401
+ this.finalTemperature = FDLayoutConstants.CONVERGENCE_CHECK_PERIOD / this.maxIterations;
3402
+ this.coolingAdjuster = 1;
3403
+ }
3404
+ };
3405
+ CoSELayout.prototype.layout = function() {
3406
+ var createBendsAsNeeded = LayoutConstants.DEFAULT_CREATE_BENDS_AS_NEEDED;
3407
+ if (createBendsAsNeeded) {
3408
+ this.createBendpoints();
3409
+ this.graphManager.resetAllEdges();
3410
+ }
3411
+ this.level = 0;
3412
+ return this.classicLayout();
3413
+ };
3414
+ CoSELayout.prototype.classicLayout = function() {
3415
+ this.nodesWithGravity = this.calculateNodesToApplyGravitationTo();
3416
+ this.graphManager.setAllNodesToApplyGravitation(this.nodesWithGravity);
3417
+ this.calcNoOfChildrenForAllNodes();
3418
+ this.graphManager.calcLowestCommonAncestors();
3419
+ this.graphManager.calcInclusionTreeDepths();
3420
+ this.graphManager.getRoot().calcEstimatedSize();
3421
+ this.calcIdealEdgeLengths();
3422
+ if (!this.incremental) {
3423
+ var forest = this.getFlatForest();
3424
+ if (forest.length > 0) {
3425
+ this.positionNodesRadially(forest);
3426
+ } else {
3427
+ this.reduceTrees();
3428
+ this.graphManager.resetAllNodesToApplyGravitation();
3429
+ var allNodes = new Set(this.getAllNodes());
3430
+ var intersection = this.nodesWithGravity.filter(function(x) {
3431
+ return allNodes.has(x);
3432
+ });
3433
+ this.graphManager.setAllNodesToApplyGravitation(intersection);
3434
+ this.positionNodesRandomly();
3435
+ }
3436
+ } else {
3437
+ if (CoSEConstants.TREE_REDUCTION_ON_INCREMENTAL) {
3438
+ this.reduceTrees();
3439
+ this.graphManager.resetAllNodesToApplyGravitation();
3440
+ var allNodes = new Set(this.getAllNodes());
3441
+ var intersection = this.nodesWithGravity.filter(function(x) {
3442
+ return allNodes.has(x);
3443
+ });
3444
+ this.graphManager.setAllNodesToApplyGravitation(intersection);
3445
+ }
3446
+ }
3447
+ this.initSpringEmbedder();
3448
+ this.runSpringEmbedder();
3449
+ return true;
3450
+ };
3451
+ CoSELayout.prototype.tick = function() {
3452
+ this.totalIterations++;
3453
+ if (this.totalIterations === this.maxIterations && !this.isTreeGrowing && !this.isGrowthFinished) {
3454
+ if (this.prunedNodesAll.length > 0) {
3455
+ this.isTreeGrowing = true;
3456
+ } else {
3457
+ return true;
3458
+ }
3459
+ }
3460
+ if (this.totalIterations % FDLayoutConstants.CONVERGENCE_CHECK_PERIOD == 0 && !this.isTreeGrowing && !this.isGrowthFinished) {
3461
+ if (this.isConverged()) {
3462
+ if (this.prunedNodesAll.length > 0) {
3463
+ this.isTreeGrowing = true;
3464
+ } else {
3465
+ return true;
3466
+ }
3467
+ }
3468
+ this.coolingCycle++;
3469
+ if (this.layoutQuality == 0) {
3470
+ this.coolingAdjuster = this.coolingCycle;
3471
+ } else if (this.layoutQuality == 1) {
3472
+ this.coolingAdjuster = this.coolingCycle / 3;
3473
+ }
3474
+ this.coolingFactor = Math.max(this.initialCoolingFactor - Math.pow(this.coolingCycle, Math.log(100 * (this.initialCoolingFactor - this.finalTemperature)) / Math.log(this.maxCoolingCycle)) / 100 * this.coolingAdjuster, this.finalTemperature);
3475
+ this.animationPeriod = Math.ceil(this.initialAnimationPeriod * Math.sqrt(this.coolingFactor));
3476
+ }
3477
+ if (this.isTreeGrowing) {
3478
+ if (this.growTreeIterations % 10 == 0) {
3479
+ if (this.prunedNodesAll.length > 0) {
3480
+ this.graphManager.updateBounds();
3481
+ this.updateGrid();
3482
+ this.growTree(this.prunedNodesAll);
3483
+ this.graphManager.resetAllNodesToApplyGravitation();
3484
+ var allNodes = new Set(this.getAllNodes());
3485
+ var intersection = this.nodesWithGravity.filter(function(x) {
3486
+ return allNodes.has(x);
3487
+ });
3488
+ this.graphManager.setAllNodesToApplyGravitation(intersection);
3489
+ this.graphManager.updateBounds();
3490
+ this.updateGrid();
3491
+ this.coolingFactor = FDLayoutConstants.DEFAULT_COOLING_FACTOR_INCREMENTAL;
3492
+ } else {
3493
+ this.isTreeGrowing = false;
3494
+ this.isGrowthFinished = true;
3495
+ }
3496
+ }
3497
+ this.growTreeIterations++;
3498
+ }
3499
+ if (this.isGrowthFinished) {
3500
+ if (this.isConverged()) {
3501
+ return true;
3502
+ }
3503
+ if (this.afterGrowthIterations % 10 == 0) {
3504
+ this.graphManager.updateBounds();
3505
+ this.updateGrid();
3506
+ }
3507
+ this.coolingFactor = FDLayoutConstants.DEFAULT_COOLING_FACTOR_INCREMENTAL * ((100 - this.afterGrowthIterations) / 100);
3508
+ this.afterGrowthIterations++;
3509
+ }
3510
+ var gridUpdateAllowed = !this.isTreeGrowing && !this.isGrowthFinished;
3511
+ var forceToNodeSurroundingUpdate = this.growTreeIterations % 10 == 1 && this.isTreeGrowing || this.afterGrowthIterations % 10 == 1 && this.isGrowthFinished;
3512
+ this.totalDisplacement = 0;
3513
+ this.graphManager.updateBounds();
3514
+ this.calcSpringForces();
3515
+ this.calcRepulsionForces(gridUpdateAllowed, forceToNodeSurroundingUpdate);
3516
+ this.calcGravitationalForces();
3517
+ this.moveNodes();
3518
+ this.animate();
3519
+ return false;
3520
+ };
3521
+ CoSELayout.prototype.getPositionsData = function() {
3522
+ var allNodes = this.graphManager.getAllNodes();
3523
+ var pData = {};
3524
+ for (var i = 0;i < allNodes.length; i++) {
3525
+ var rect = allNodes[i].rect;
3526
+ var id = allNodes[i].id;
3527
+ pData[id] = {
3528
+ id,
3529
+ x: rect.getCenterX(),
3530
+ y: rect.getCenterY(),
3531
+ w: rect.width,
3532
+ h: rect.height
3533
+ };
3534
+ }
3535
+ return pData;
3536
+ };
3537
+ CoSELayout.prototype.runSpringEmbedder = function() {
3538
+ this.initialAnimationPeriod = 25;
3539
+ this.animationPeriod = this.initialAnimationPeriod;
3540
+ var layoutEnded = false;
3541
+ if (FDLayoutConstants.ANIMATE === "during") {
3542
+ this.emit("layoutstarted");
3543
+ } else {
3544
+ while (!layoutEnded) {
3545
+ layoutEnded = this.tick();
3546
+ }
3547
+ this.graphManager.updateBounds();
3548
+ }
3549
+ };
3550
+ CoSELayout.prototype.calculateNodesToApplyGravitationTo = function() {
3551
+ var nodeList = [];
3552
+ var graph;
3553
+ var graphs = this.graphManager.getGraphs();
3554
+ var size = graphs.length;
3555
+ var i;
3556
+ for (i = 0;i < size; i++) {
3557
+ graph = graphs[i];
3558
+ graph.updateConnected();
3559
+ if (!graph.isConnected) {
3560
+ nodeList = nodeList.concat(graph.getNodes());
3561
+ }
3562
+ }
3563
+ return nodeList;
3564
+ };
3565
+ CoSELayout.prototype.createBendpoints = function() {
3566
+ var edges = [];
3567
+ edges = edges.concat(this.graphManager.getAllEdges());
3568
+ var visited = new Set;
3569
+ var i;
3570
+ for (i = 0;i < edges.length; i++) {
3571
+ var edge = edges[i];
3572
+ if (!visited.has(edge)) {
3573
+ var source = edge.getSource();
3574
+ var target = edge.getTarget();
3575
+ if (source == target) {
3576
+ edge.getBendpoints().push(new PointD);
3577
+ edge.getBendpoints().push(new PointD);
3578
+ this.createDummyNodesForBendpoints(edge);
3579
+ visited.add(edge);
3580
+ } else {
3581
+ var edgeList = [];
3582
+ edgeList = edgeList.concat(source.getEdgeListToNode(target));
3583
+ edgeList = edgeList.concat(target.getEdgeListToNode(source));
3584
+ if (!visited.has(edgeList[0])) {
3585
+ if (edgeList.length > 1) {
3586
+ var k;
3587
+ for (k = 0;k < edgeList.length; k++) {
3588
+ var multiEdge = edgeList[k];
3589
+ multiEdge.getBendpoints().push(new PointD);
3590
+ this.createDummyNodesForBendpoints(multiEdge);
3591
+ }
3592
+ }
3593
+ edgeList.forEach(function(edge2) {
3594
+ visited.add(edge2);
3595
+ });
3596
+ }
3597
+ }
3598
+ }
3599
+ if (visited.size == edges.length) {
3600
+ break;
3601
+ }
3602
+ }
3603
+ };
3604
+ CoSELayout.prototype.positionNodesRadially = function(forest) {
3605
+ var currentStartingPoint = new Point2(0, 0);
3606
+ var numberOfColumns = Math.ceil(Math.sqrt(forest.length));
3607
+ var height = 0;
3608
+ var currentY = 0;
3609
+ var currentX = 0;
3610
+ var point = new PointD(0, 0);
3611
+ for (var i = 0;i < forest.length; i++) {
3612
+ if (i % numberOfColumns == 0) {
3613
+ currentX = 0;
3614
+ currentY = height;
3615
+ if (i != 0) {
3616
+ currentY += CoSEConstants.DEFAULT_COMPONENT_SEPERATION;
3617
+ }
3618
+ height = 0;
3619
+ }
3620
+ var tree = forest[i];
3621
+ var centerNode = Layout2.findCenterOfTree(tree);
3622
+ currentStartingPoint.x = currentX;
3623
+ currentStartingPoint.y = currentY;
3624
+ point = CoSELayout.radialLayout(tree, centerNode, currentStartingPoint);
3625
+ if (point.y > height) {
3626
+ height = Math.floor(point.y);
3627
+ }
3628
+ currentX = Math.floor(point.x + CoSEConstants.DEFAULT_COMPONENT_SEPERATION);
3629
+ }
3630
+ this.transform(new PointD(LayoutConstants.WORLD_CENTER_X - point.x / 2, LayoutConstants.WORLD_CENTER_Y - point.y / 2));
3631
+ };
3632
+ CoSELayout.radialLayout = function(tree, centerNode, startingPoint) {
3633
+ var radialSep = Math.max(this.maxDiagonalInTree(tree), CoSEConstants.DEFAULT_RADIAL_SEPARATION);
3634
+ CoSELayout.branchRadialLayout(centerNode, null, 0, 359, 0, radialSep);
3635
+ var bounds = LGraph.calculateBounds(tree);
3636
+ var transform = new Transform;
3637
+ transform.setDeviceOrgX(bounds.getMinX());
3638
+ transform.setDeviceOrgY(bounds.getMinY());
3639
+ transform.setWorldOrgX(startingPoint.x);
3640
+ transform.setWorldOrgY(startingPoint.y);
3641
+ for (var i = 0;i < tree.length; i++) {
3642
+ var node = tree[i];
3643
+ node.transform(transform);
3644
+ }
3645
+ var bottomRight = new PointD(bounds.getMaxX(), bounds.getMaxY());
3646
+ return transform.inverseTransformPoint(bottomRight);
3647
+ };
3648
+ CoSELayout.branchRadialLayout = function(node, parentOfNode, startAngle, endAngle, distance, radialSeparation) {
3649
+ var halfInterval = (endAngle - startAngle + 1) / 2;
3650
+ if (halfInterval < 0) {
3651
+ halfInterval += 180;
3652
+ }
3653
+ var nodeAngle = (halfInterval + startAngle) % 360;
3654
+ var teta = nodeAngle * IGeometry.TWO_PI / 360;
3655
+ var cos_teta = Math.cos(teta);
3656
+ var x_ = distance * Math.cos(teta);
3657
+ var y_ = distance * Math.sin(teta);
3658
+ node.setCenter(x_, y_);
3659
+ var neighborEdges = [];
3660
+ neighborEdges = neighborEdges.concat(node.getEdges());
3661
+ var childCount = neighborEdges.length;
3662
+ if (parentOfNode != null) {
3663
+ childCount--;
3664
+ }
3665
+ var branchCount = 0;
3666
+ var incEdgesCount = neighborEdges.length;
3667
+ var startIndex;
3668
+ var edges = node.getEdgesBetween(parentOfNode);
3669
+ while (edges.length > 1) {
3670
+ var temp = edges[0];
3671
+ edges.splice(0, 1);
3672
+ var index = neighborEdges.indexOf(temp);
3673
+ if (index >= 0) {
3674
+ neighborEdges.splice(index, 1);
3675
+ }
3676
+ incEdgesCount--;
3677
+ childCount--;
3678
+ }
3679
+ if (parentOfNode != null) {
3680
+ startIndex = (neighborEdges.indexOf(edges[0]) + 1) % incEdgesCount;
3681
+ } else {
3682
+ startIndex = 0;
3683
+ }
3684
+ var stepAngle = Math.abs(endAngle - startAngle) / childCount;
3685
+ for (var i = startIndex;branchCount != childCount; i = ++i % incEdgesCount) {
3686
+ var currentNeighbor = neighborEdges[i].getOtherEnd(node);
3687
+ if (currentNeighbor == parentOfNode) {
3688
+ continue;
3689
+ }
3690
+ var childStartAngle = (startAngle + branchCount * stepAngle) % 360;
3691
+ var childEndAngle = (childStartAngle + stepAngle) % 360;
3692
+ CoSELayout.branchRadialLayout(currentNeighbor, node, childStartAngle, childEndAngle, distance + radialSeparation, radialSeparation);
3693
+ branchCount++;
3694
+ }
3695
+ };
3696
+ CoSELayout.maxDiagonalInTree = function(tree) {
3697
+ var maxDiagonal = Integer.MIN_VALUE;
3698
+ for (var i = 0;i < tree.length; i++) {
3699
+ var node = tree[i];
3700
+ var diagonal = node.getDiagonal();
3701
+ if (diagonal > maxDiagonal) {
3702
+ maxDiagonal = diagonal;
3703
+ }
3704
+ }
3705
+ return maxDiagonal;
3706
+ };
3707
+ CoSELayout.prototype.calcRepulsionRange = function() {
3708
+ return 2 * (this.level + 1) * this.idealEdgeLength;
3709
+ };
3710
+ CoSELayout.prototype.groupZeroDegreeMembers = function() {
3711
+ var self = this;
3712
+ var tempMemberGroups = {};
3713
+ this.memberGroups = {};
3714
+ this.idToDummyNode = {};
3715
+ var zeroDegree = [];
3716
+ var allNodes = this.graphManager.getAllNodes();
3717
+ for (var i = 0;i < allNodes.length; i++) {
3718
+ var node = allNodes[i];
3719
+ var parent = node.getParent();
3720
+ if (this.getNodeDegreeWithChildren(node) === 0 && (parent.id == undefined || !this.getToBeTiled(parent))) {
3721
+ zeroDegree.push(node);
3722
+ }
3723
+ }
3724
+ for (var i = 0;i < zeroDegree.length; i++) {
3725
+ var node = zeroDegree[i];
3726
+ var p_id = node.getParent().id;
3727
+ if (typeof tempMemberGroups[p_id] === "undefined")
3728
+ tempMemberGroups[p_id] = [];
3729
+ tempMemberGroups[p_id] = tempMemberGroups[p_id].concat(node);
3730
+ }
3731
+ Object.keys(tempMemberGroups).forEach(function(p_id2) {
3732
+ if (tempMemberGroups[p_id2].length > 1) {
3733
+ var dummyCompoundId = "DummyCompound_" + p_id2;
3734
+ self.memberGroups[dummyCompoundId] = tempMemberGroups[p_id2];
3735
+ var parent2 = tempMemberGroups[p_id2][0].getParent();
3736
+ var dummyCompound = new CoSENode(self.graphManager);
3737
+ dummyCompound.id = dummyCompoundId;
3738
+ dummyCompound.paddingLeft = parent2.paddingLeft || 0;
3739
+ dummyCompound.paddingRight = parent2.paddingRight || 0;
3740
+ dummyCompound.paddingBottom = parent2.paddingBottom || 0;
3741
+ dummyCompound.paddingTop = parent2.paddingTop || 0;
3742
+ self.idToDummyNode[dummyCompoundId] = dummyCompound;
3743
+ var dummyParentGraph = self.getGraphManager().add(self.newGraph(), dummyCompound);
3744
+ var parentGraph = parent2.getChild();
3745
+ parentGraph.add(dummyCompound);
3746
+ for (var i2 = 0;i2 < tempMemberGroups[p_id2].length; i2++) {
3747
+ var node2 = tempMemberGroups[p_id2][i2];
3748
+ parentGraph.remove(node2);
3749
+ dummyParentGraph.add(node2);
3750
+ }
3751
+ }
3752
+ });
3753
+ };
3754
+ CoSELayout.prototype.clearCompounds = function() {
3755
+ var childGraphMap = {};
3756
+ var idToNode = {};
3757
+ this.performDFSOnCompounds();
3758
+ for (var i = 0;i < this.compoundOrder.length; i++) {
3759
+ idToNode[this.compoundOrder[i].id] = this.compoundOrder[i];
3760
+ childGraphMap[this.compoundOrder[i].id] = [].concat(this.compoundOrder[i].getChild().getNodes());
3761
+ this.graphManager.remove(this.compoundOrder[i].getChild());
3762
+ this.compoundOrder[i].child = null;
3763
+ }
3764
+ this.graphManager.resetAllNodes();
3765
+ this.tileCompoundMembers(childGraphMap, idToNode);
3766
+ };
3767
+ CoSELayout.prototype.clearZeroDegreeMembers = function() {
3768
+ var self = this;
3769
+ var tiledZeroDegreePack = this.tiledZeroDegreePack = [];
3770
+ Object.keys(this.memberGroups).forEach(function(id) {
3771
+ var compoundNode = self.idToDummyNode[id];
3772
+ tiledZeroDegreePack[id] = self.tileNodes(self.memberGroups[id], compoundNode.paddingLeft + compoundNode.paddingRight);
3773
+ compoundNode.rect.width = tiledZeroDegreePack[id].width;
3774
+ compoundNode.rect.height = tiledZeroDegreePack[id].height;
3775
+ });
3776
+ };
3777
+ CoSELayout.prototype.repopulateCompounds = function() {
3778
+ for (var i = this.compoundOrder.length - 1;i >= 0; i--) {
3779
+ var lCompoundNode = this.compoundOrder[i];
3780
+ var id = lCompoundNode.id;
3781
+ var horizontalMargin = lCompoundNode.paddingLeft;
3782
+ var verticalMargin = lCompoundNode.paddingTop;
3783
+ this.adjustLocations(this.tiledMemberPack[id], lCompoundNode.rect.x, lCompoundNode.rect.y, horizontalMargin, verticalMargin);
3784
+ }
3785
+ };
3786
+ CoSELayout.prototype.repopulateZeroDegreeMembers = function() {
3787
+ var self = this;
3788
+ var tiledPack = this.tiledZeroDegreePack;
3789
+ Object.keys(tiledPack).forEach(function(id) {
3790
+ var compoundNode = self.idToDummyNode[id];
3791
+ var horizontalMargin = compoundNode.paddingLeft;
3792
+ var verticalMargin = compoundNode.paddingTop;
3793
+ self.adjustLocations(tiledPack[id], compoundNode.rect.x, compoundNode.rect.y, horizontalMargin, verticalMargin);
3794
+ });
3795
+ };
3796
+ CoSELayout.prototype.getToBeTiled = function(node) {
3797
+ var id = node.id;
3798
+ if (this.toBeTiled[id] != null) {
3799
+ return this.toBeTiled[id];
3800
+ }
3801
+ var childGraph = node.getChild();
3802
+ if (childGraph == null) {
3803
+ this.toBeTiled[id] = false;
3804
+ return false;
3805
+ }
3806
+ var children = childGraph.getNodes();
3807
+ for (var i = 0;i < children.length; i++) {
3808
+ var theChild = children[i];
3809
+ if (this.getNodeDegree(theChild) > 0) {
3810
+ this.toBeTiled[id] = false;
3811
+ return false;
3812
+ }
3813
+ if (theChild.getChild() == null) {
3814
+ this.toBeTiled[theChild.id] = false;
3815
+ continue;
3816
+ }
3817
+ if (!this.getToBeTiled(theChild)) {
3818
+ this.toBeTiled[id] = false;
3819
+ return false;
3820
+ }
3821
+ }
3822
+ this.toBeTiled[id] = true;
3823
+ return true;
3824
+ };
3825
+ CoSELayout.prototype.getNodeDegree = function(node) {
3826
+ var id = node.id;
3827
+ var edges = node.getEdges();
3828
+ var degree = 0;
3829
+ for (var i = 0;i < edges.length; i++) {
3830
+ var edge = edges[i];
3831
+ if (edge.getSource().id !== edge.getTarget().id) {
3832
+ degree = degree + 1;
3833
+ }
3834
+ }
3835
+ return degree;
3836
+ };
3837
+ CoSELayout.prototype.getNodeDegreeWithChildren = function(node) {
3838
+ var degree = this.getNodeDegree(node);
3839
+ if (node.getChild() == null) {
3840
+ return degree;
3841
+ }
3842
+ var children = node.getChild().getNodes();
3843
+ for (var i = 0;i < children.length; i++) {
3844
+ var child = children[i];
3845
+ degree += this.getNodeDegreeWithChildren(child);
3846
+ }
3847
+ return degree;
3848
+ };
3849
+ CoSELayout.prototype.performDFSOnCompounds = function() {
3850
+ this.compoundOrder = [];
3851
+ this.fillCompexOrderByDFS(this.graphManager.getRoot().getNodes());
3852
+ };
3853
+ CoSELayout.prototype.fillCompexOrderByDFS = function(children) {
3854
+ for (var i = 0;i < children.length; i++) {
3855
+ var child = children[i];
3856
+ if (child.getChild() != null) {
3857
+ this.fillCompexOrderByDFS(child.getChild().getNodes());
3858
+ }
3859
+ if (this.getToBeTiled(child)) {
3860
+ this.compoundOrder.push(child);
3861
+ }
3862
+ }
3863
+ };
3864
+ CoSELayout.prototype.adjustLocations = function(organization, x, y, compoundHorizontalMargin, compoundVerticalMargin) {
3865
+ x += compoundHorizontalMargin;
3866
+ y += compoundVerticalMargin;
3867
+ var left = x;
3868
+ for (var i = 0;i < organization.rows.length; i++) {
3869
+ var row = organization.rows[i];
3870
+ x = left;
3871
+ var maxHeight = 0;
3872
+ for (var j = 0;j < row.length; j++) {
3873
+ var lnode = row[j];
3874
+ lnode.rect.x = x;
3875
+ lnode.rect.y = y;
3876
+ x += lnode.rect.width + organization.horizontalPadding;
3877
+ if (lnode.rect.height > maxHeight)
3878
+ maxHeight = lnode.rect.height;
3879
+ }
3880
+ y += maxHeight + organization.verticalPadding;
3881
+ }
3882
+ };
3883
+ CoSELayout.prototype.tileCompoundMembers = function(childGraphMap, idToNode) {
3884
+ var self = this;
3885
+ this.tiledMemberPack = [];
3886
+ Object.keys(childGraphMap).forEach(function(id) {
3887
+ var compoundNode = idToNode[id];
3888
+ self.tiledMemberPack[id] = self.tileNodes(childGraphMap[id], compoundNode.paddingLeft + compoundNode.paddingRight);
3889
+ compoundNode.rect.width = self.tiledMemberPack[id].width;
3890
+ compoundNode.rect.height = self.tiledMemberPack[id].height;
3891
+ });
3892
+ };
3893
+ CoSELayout.prototype.tileNodes = function(nodes, minWidth) {
3894
+ var verticalPadding = CoSEConstants.TILING_PADDING_VERTICAL;
3895
+ var horizontalPadding = CoSEConstants.TILING_PADDING_HORIZONTAL;
3896
+ var organization = {
3897
+ rows: [],
3898
+ rowWidth: [],
3899
+ rowHeight: [],
3900
+ width: 0,
3901
+ height: minWidth,
3902
+ verticalPadding,
3903
+ horizontalPadding
3904
+ };
3905
+ nodes.sort(function(n1, n2) {
3906
+ if (n1.rect.width * n1.rect.height > n2.rect.width * n2.rect.height)
3907
+ return -1;
3908
+ if (n1.rect.width * n1.rect.height < n2.rect.width * n2.rect.height)
3909
+ return 1;
3910
+ return 0;
3911
+ });
3912
+ for (var i = 0;i < nodes.length; i++) {
3913
+ var lNode = nodes[i];
3914
+ if (organization.rows.length == 0) {
3915
+ this.insertNodeToRow(organization, lNode, 0, minWidth);
3916
+ } else if (this.canAddHorizontal(organization, lNode.rect.width, lNode.rect.height)) {
3917
+ this.insertNodeToRow(organization, lNode, this.getShortestRowIndex(organization), minWidth);
3918
+ } else {
3919
+ this.insertNodeToRow(organization, lNode, organization.rows.length, minWidth);
3920
+ }
3921
+ this.shiftToLastRow(organization);
3922
+ }
3923
+ return organization;
3924
+ };
3925
+ CoSELayout.prototype.insertNodeToRow = function(organization, node, rowIndex, minWidth) {
3926
+ var minCompoundSize = minWidth;
3927
+ if (rowIndex == organization.rows.length) {
3928
+ var secondDimension = [];
3929
+ organization.rows.push(secondDimension);
3930
+ organization.rowWidth.push(minCompoundSize);
3931
+ organization.rowHeight.push(0);
3932
+ }
3933
+ var w = organization.rowWidth[rowIndex] + node.rect.width;
3934
+ if (organization.rows[rowIndex].length > 0) {
3935
+ w += organization.horizontalPadding;
3936
+ }
3937
+ organization.rowWidth[rowIndex] = w;
3938
+ if (organization.width < w) {
3939
+ organization.width = w;
3940
+ }
3941
+ var h = node.rect.height;
3942
+ if (rowIndex > 0)
3943
+ h += organization.verticalPadding;
3944
+ var extraHeight = 0;
3945
+ if (h > organization.rowHeight[rowIndex]) {
3946
+ extraHeight = organization.rowHeight[rowIndex];
3947
+ organization.rowHeight[rowIndex] = h;
3948
+ extraHeight = organization.rowHeight[rowIndex] - extraHeight;
3949
+ }
3950
+ organization.height += extraHeight;
3951
+ organization.rows[rowIndex].push(node);
3952
+ };
3953
+ CoSELayout.prototype.getShortestRowIndex = function(organization) {
3954
+ var r = -1;
3955
+ var min = Number.MAX_VALUE;
3956
+ for (var i = 0;i < organization.rows.length; i++) {
3957
+ if (organization.rowWidth[i] < min) {
3958
+ r = i;
3959
+ min = organization.rowWidth[i];
3960
+ }
3961
+ }
3962
+ return r;
3963
+ };
3964
+ CoSELayout.prototype.getLongestRowIndex = function(organization) {
3965
+ var r = -1;
3966
+ var max = Number.MIN_VALUE;
3967
+ for (var i = 0;i < organization.rows.length; i++) {
3968
+ if (organization.rowWidth[i] > max) {
3969
+ r = i;
3970
+ max = organization.rowWidth[i];
3971
+ }
3972
+ }
3973
+ return r;
3974
+ };
3975
+ CoSELayout.prototype.canAddHorizontal = function(organization, extraWidth, extraHeight) {
3976
+ var sri = this.getShortestRowIndex(organization);
3977
+ if (sri < 0) {
3978
+ return true;
3979
+ }
3980
+ var min = organization.rowWidth[sri];
3981
+ if (min + organization.horizontalPadding + extraWidth <= organization.width)
3982
+ return true;
3983
+ var hDiff = 0;
3984
+ if (organization.rowHeight[sri] < extraHeight) {
3985
+ if (sri > 0)
3986
+ hDiff = extraHeight + organization.verticalPadding - organization.rowHeight[sri];
3987
+ }
3988
+ var add_to_row_ratio;
3989
+ if (organization.width - min >= extraWidth + organization.horizontalPadding) {
3990
+ add_to_row_ratio = (organization.height + hDiff) / (min + extraWidth + organization.horizontalPadding);
3991
+ } else {
3992
+ add_to_row_ratio = (organization.height + hDiff) / organization.width;
3993
+ }
3994
+ hDiff = extraHeight + organization.verticalPadding;
3995
+ var add_new_row_ratio;
3996
+ if (organization.width < extraWidth) {
3997
+ add_new_row_ratio = (organization.height + hDiff) / extraWidth;
3998
+ } else {
3999
+ add_new_row_ratio = (organization.height + hDiff) / organization.width;
4000
+ }
4001
+ if (add_new_row_ratio < 1)
4002
+ add_new_row_ratio = 1 / add_new_row_ratio;
4003
+ if (add_to_row_ratio < 1)
4004
+ add_to_row_ratio = 1 / add_to_row_ratio;
4005
+ return add_to_row_ratio < add_new_row_ratio;
4006
+ };
4007
+ CoSELayout.prototype.shiftToLastRow = function(organization) {
4008
+ var longest = this.getLongestRowIndex(organization);
4009
+ var last = organization.rowWidth.length - 1;
4010
+ var row = organization.rows[longest];
4011
+ var node = row[row.length - 1];
4012
+ var diff = node.width + organization.horizontalPadding;
4013
+ if (organization.width - organization.rowWidth[last] > diff && longest != last) {
4014
+ row.splice(-1, 1);
4015
+ organization.rows[last].push(node);
4016
+ organization.rowWidth[longest] = organization.rowWidth[longest] - diff;
4017
+ organization.rowWidth[last] = organization.rowWidth[last] + diff;
4018
+ organization.width = organization.rowWidth[instance.getLongestRowIndex(organization)];
4019
+ var maxHeight = Number.MIN_VALUE;
4020
+ for (var i = 0;i < row.length; i++) {
4021
+ if (row[i].height > maxHeight)
4022
+ maxHeight = row[i].height;
4023
+ }
4024
+ if (longest > 0)
4025
+ maxHeight += organization.verticalPadding;
4026
+ var prevTotal = organization.rowHeight[longest] + organization.rowHeight[last];
4027
+ organization.rowHeight[longest] = maxHeight;
4028
+ if (organization.rowHeight[last] < node.height + organization.verticalPadding)
4029
+ organization.rowHeight[last] = node.height + organization.verticalPadding;
4030
+ var finalTotal = organization.rowHeight[longest] + organization.rowHeight[last];
4031
+ organization.height += finalTotal - prevTotal;
4032
+ this.shiftToLastRow(organization);
4033
+ }
4034
+ };
4035
+ CoSELayout.prototype.tilingPreLayout = function() {
4036
+ if (CoSEConstants.TILE) {
4037
+ this.groupZeroDegreeMembers();
4038
+ this.clearCompounds();
4039
+ this.clearZeroDegreeMembers();
4040
+ }
4041
+ };
4042
+ CoSELayout.prototype.tilingPostLayout = function() {
4043
+ if (CoSEConstants.TILE) {
4044
+ this.repopulateZeroDegreeMembers();
4045
+ this.repopulateCompounds();
4046
+ }
4047
+ };
4048
+ CoSELayout.prototype.reduceTrees = function() {
4049
+ var prunedNodesAll = [];
4050
+ var containsLeaf = true;
4051
+ var node;
4052
+ while (containsLeaf) {
4053
+ var allNodes = this.graphManager.getAllNodes();
4054
+ var prunedNodesInStepTemp = [];
4055
+ containsLeaf = false;
4056
+ for (var i = 0;i < allNodes.length; i++) {
4057
+ node = allNodes[i];
4058
+ if (node.getEdges().length == 1 && !node.getEdges()[0].isInterGraph && node.getChild() == null) {
4059
+ prunedNodesInStepTemp.push([node, node.getEdges()[0], node.getOwner()]);
4060
+ containsLeaf = true;
4061
+ }
4062
+ }
4063
+ if (containsLeaf == true) {
4064
+ var prunedNodesInStep = [];
4065
+ for (var j = 0;j < prunedNodesInStepTemp.length; j++) {
4066
+ if (prunedNodesInStepTemp[j][0].getEdges().length == 1) {
4067
+ prunedNodesInStep.push(prunedNodesInStepTemp[j]);
4068
+ prunedNodesInStepTemp[j][0].getOwner().remove(prunedNodesInStepTemp[j][0]);
4069
+ }
4070
+ }
4071
+ prunedNodesAll.push(prunedNodesInStep);
4072
+ this.graphManager.resetAllNodes();
4073
+ this.graphManager.resetAllEdges();
4074
+ }
4075
+ }
4076
+ this.prunedNodesAll = prunedNodesAll;
4077
+ };
4078
+ CoSELayout.prototype.growTree = function(prunedNodesAll) {
4079
+ var lengthOfPrunedNodesInStep = prunedNodesAll.length;
4080
+ var prunedNodesInStep = prunedNodesAll[lengthOfPrunedNodesInStep - 1];
4081
+ var nodeData;
4082
+ for (var i = 0;i < prunedNodesInStep.length; i++) {
4083
+ nodeData = prunedNodesInStep[i];
4084
+ this.findPlaceforPrunedNode(nodeData);
4085
+ nodeData[2].add(nodeData[0]);
4086
+ nodeData[2].add(nodeData[1], nodeData[1].source, nodeData[1].target);
4087
+ }
4088
+ prunedNodesAll.splice(prunedNodesAll.length - 1, 1);
4089
+ this.graphManager.resetAllNodes();
4090
+ this.graphManager.resetAllEdges();
4091
+ };
4092
+ CoSELayout.prototype.findPlaceforPrunedNode = function(nodeData) {
4093
+ var gridForPrunedNode;
4094
+ var nodeToConnect;
4095
+ var prunedNode = nodeData[0];
4096
+ if (prunedNode == nodeData[1].source) {
4097
+ nodeToConnect = nodeData[1].target;
4098
+ } else {
4099
+ nodeToConnect = nodeData[1].source;
4100
+ }
4101
+ var startGridX = nodeToConnect.startX;
4102
+ var finishGridX = nodeToConnect.finishX;
4103
+ var startGridY = nodeToConnect.startY;
4104
+ var finishGridY = nodeToConnect.finishY;
4105
+ var upNodeCount = 0;
4106
+ var downNodeCount = 0;
4107
+ var rightNodeCount = 0;
4108
+ var leftNodeCount = 0;
4109
+ var controlRegions = [upNodeCount, rightNodeCount, downNodeCount, leftNodeCount];
4110
+ if (startGridY > 0) {
4111
+ for (var i = startGridX;i <= finishGridX; i++) {
4112
+ controlRegions[0] += this.grid[i][startGridY - 1].length + this.grid[i][startGridY].length - 1;
4113
+ }
4114
+ }
4115
+ if (finishGridX < this.grid.length - 1) {
4116
+ for (var i = startGridY;i <= finishGridY; i++) {
4117
+ controlRegions[1] += this.grid[finishGridX + 1][i].length + this.grid[finishGridX][i].length - 1;
4118
+ }
4119
+ }
4120
+ if (finishGridY < this.grid[0].length - 1) {
4121
+ for (var i = startGridX;i <= finishGridX; i++) {
4122
+ controlRegions[2] += this.grid[i][finishGridY + 1].length + this.grid[i][finishGridY].length - 1;
4123
+ }
4124
+ }
4125
+ if (startGridX > 0) {
4126
+ for (var i = startGridY;i <= finishGridY; i++) {
4127
+ controlRegions[3] += this.grid[startGridX - 1][i].length + this.grid[startGridX][i].length - 1;
4128
+ }
4129
+ }
4130
+ var min = Integer.MAX_VALUE;
4131
+ var minCount;
4132
+ var minIndex;
4133
+ for (var j = 0;j < controlRegions.length; j++) {
4134
+ if (controlRegions[j] < min) {
4135
+ min = controlRegions[j];
4136
+ minCount = 1;
4137
+ minIndex = j;
4138
+ } else if (controlRegions[j] == min) {
4139
+ minCount++;
4140
+ }
4141
+ }
4142
+ if (minCount == 3 && min == 0) {
4143
+ if (controlRegions[0] == 0 && controlRegions[1] == 0 && controlRegions[2] == 0) {
4144
+ gridForPrunedNode = 1;
4145
+ } else if (controlRegions[0] == 0 && controlRegions[1] == 0 && controlRegions[3] == 0) {
4146
+ gridForPrunedNode = 0;
4147
+ } else if (controlRegions[0] == 0 && controlRegions[2] == 0 && controlRegions[3] == 0) {
4148
+ gridForPrunedNode = 3;
4149
+ } else if (controlRegions[1] == 0 && controlRegions[2] == 0 && controlRegions[3] == 0) {
4150
+ gridForPrunedNode = 2;
4151
+ }
4152
+ } else if (minCount == 2 && min == 0) {
4153
+ var random = Math.floor(Math.random() * 2);
4154
+ if (controlRegions[0] == 0 && controlRegions[1] == 0) {
4155
+ if (random == 0) {
4156
+ gridForPrunedNode = 0;
4157
+ } else {
4158
+ gridForPrunedNode = 1;
4159
+ }
4160
+ } else if (controlRegions[0] == 0 && controlRegions[2] == 0) {
4161
+ if (random == 0) {
4162
+ gridForPrunedNode = 0;
4163
+ } else {
4164
+ gridForPrunedNode = 2;
4165
+ }
4166
+ } else if (controlRegions[0] == 0 && controlRegions[3] == 0) {
4167
+ if (random == 0) {
4168
+ gridForPrunedNode = 0;
4169
+ } else {
4170
+ gridForPrunedNode = 3;
4171
+ }
4172
+ } else if (controlRegions[1] == 0 && controlRegions[2] == 0) {
4173
+ if (random == 0) {
4174
+ gridForPrunedNode = 1;
4175
+ } else {
4176
+ gridForPrunedNode = 2;
4177
+ }
4178
+ } else if (controlRegions[1] == 0 && controlRegions[3] == 0) {
4179
+ if (random == 0) {
4180
+ gridForPrunedNode = 1;
4181
+ } else {
4182
+ gridForPrunedNode = 3;
4183
+ }
4184
+ } else {
4185
+ if (random == 0) {
4186
+ gridForPrunedNode = 2;
4187
+ } else {
4188
+ gridForPrunedNode = 3;
4189
+ }
4190
+ }
4191
+ } else if (minCount == 4 && min == 0) {
4192
+ var random = Math.floor(Math.random() * 4);
4193
+ gridForPrunedNode = random;
4194
+ } else {
4195
+ gridForPrunedNode = minIndex;
4196
+ }
4197
+ if (gridForPrunedNode == 0) {
4198
+ prunedNode.setCenter(nodeToConnect.getCenterX(), nodeToConnect.getCenterY() - nodeToConnect.getHeight() / 2 - FDLayoutConstants.DEFAULT_EDGE_LENGTH - prunedNode.getHeight() / 2);
4199
+ } else if (gridForPrunedNode == 1) {
4200
+ prunedNode.setCenter(nodeToConnect.getCenterX() + nodeToConnect.getWidth() / 2 + FDLayoutConstants.DEFAULT_EDGE_LENGTH + prunedNode.getWidth() / 2, nodeToConnect.getCenterY());
4201
+ } else if (gridForPrunedNode == 2) {
4202
+ prunedNode.setCenter(nodeToConnect.getCenterX(), nodeToConnect.getCenterY() + nodeToConnect.getHeight() / 2 + FDLayoutConstants.DEFAULT_EDGE_LENGTH + prunedNode.getHeight() / 2);
4203
+ } else {
4204
+ prunedNode.setCenter(nodeToConnect.getCenterX() - nodeToConnect.getWidth() / 2 - FDLayoutConstants.DEFAULT_EDGE_LENGTH - prunedNode.getWidth() / 2, nodeToConnect.getCenterY());
4205
+ }
4206
+ };
4207
+ module2.exports = CoSELayout;
4208
+ },
4209
+ function(module2, exports2, __webpack_require__) {
4210
+ var coseBase = {};
4211
+ coseBase.layoutBase = __webpack_require__(0);
4212
+ coseBase.CoSEConstants = __webpack_require__(1);
4213
+ coseBase.CoSEEdge = __webpack_require__(2);
4214
+ coseBase.CoSEGraph = __webpack_require__(3);
4215
+ coseBase.CoSEGraphManager = __webpack_require__(4);
4216
+ coseBase.CoSELayout = __webpack_require__(6);
4217
+ coseBase.CoSENode = __webpack_require__(5);
4218
+ module2.exports = coseBase;
4219
+ }
4220
+ ]);
4221
+ });
4222
+ });
4223
+
4224
+ // node_modules/cytoscape-cose-bilkent/cytoscape-cose-bilkent.js
4225
+ var require_cytoscape_cose_bilkent = __commonJS(function(exports, module) {
4226
+ (function webpackUniversalModuleDefinition(root, factory) {
4227
+ if (typeof exports === "object" && typeof module === "object")
4228
+ module.exports = factory(require_cose_base());
4229
+ else if (typeof define === "function" && define.amd)
4230
+ define(["cose-base"], factory);
4231
+ else if (typeof exports === "object")
4232
+ exports["cytoscapeCoseBilkent"] = factory(require_cose_base());
4233
+ else
4234
+ root["cytoscapeCoseBilkent"] = factory(root["coseBase"]);
4235
+ })(exports, function(__WEBPACK_EXTERNAL_MODULE_0__) {
4236
+ return function(modules) {
4237
+ var installedModules = {};
4238
+ function __webpack_require__(moduleId) {
4239
+ if (installedModules[moduleId]) {
4240
+ return installedModules[moduleId].exports;
4241
+ }
4242
+ var module2 = installedModules[moduleId] = {
4243
+ i: moduleId,
4244
+ l: false,
4245
+ exports: {}
4246
+ };
4247
+ modules[moduleId].call(module2.exports, module2, module2.exports, __webpack_require__);
4248
+ module2.l = true;
4249
+ return module2.exports;
4250
+ }
4251
+ __webpack_require__.m = modules;
4252
+ __webpack_require__.c = installedModules;
4253
+ __webpack_require__.i = function(value) {
4254
+ return value;
4255
+ };
4256
+ __webpack_require__.d = function(exports2, name, getter) {
4257
+ if (!__webpack_require__.o(exports2, name)) {
4258
+ Object.defineProperty(exports2, name, {
4259
+ configurable: false,
4260
+ enumerable: true,
4261
+ get: getter
4262
+ });
4263
+ }
4264
+ };
4265
+ __webpack_require__.n = function(module2) {
4266
+ var getter = module2 && module2.__esModule ? function getDefault() {
4267
+ return module2["default"];
4268
+ } : function getModuleExports() {
4269
+ return module2;
4270
+ };
4271
+ __webpack_require__.d(getter, "a", getter);
4272
+ return getter;
4273
+ };
4274
+ __webpack_require__.o = function(object, property) {
4275
+ return Object.prototype.hasOwnProperty.call(object, property);
4276
+ };
4277
+ __webpack_require__.p = "";
4278
+ return __webpack_require__(__webpack_require__.s = 1);
4279
+ }([
4280
+ function(module2, exports2) {
4281
+ module2.exports = __WEBPACK_EXTERNAL_MODULE_0__;
4282
+ },
4283
+ function(module2, exports2, __webpack_require__) {
4284
+ var LayoutConstants = __webpack_require__(0).layoutBase.LayoutConstants;
4285
+ var FDLayoutConstants = __webpack_require__(0).layoutBase.FDLayoutConstants;
4286
+ var CoSEConstants = __webpack_require__(0).CoSEConstants;
4287
+ var CoSELayout = __webpack_require__(0).CoSELayout;
4288
+ var CoSENode = __webpack_require__(0).CoSENode;
4289
+ var PointD = __webpack_require__(0).layoutBase.PointD;
4290
+ var DimensionD2 = __webpack_require__(0).layoutBase.DimensionD;
4291
+ var defaults = {
4292
+ ready: function ready() {},
4293
+ stop: function stop() {},
4294
+ quality: "default",
4295
+ nodeDimensionsIncludeLabels: false,
4296
+ refresh: 30,
4297
+ fit: true,
4298
+ padding: 10,
4299
+ randomize: true,
4300
+ nodeRepulsion: 4500,
4301
+ idealEdgeLength: 50,
4302
+ edgeElasticity: 0.45,
4303
+ nestingFactor: 0.1,
4304
+ gravity: 0.25,
4305
+ numIter: 2500,
4306
+ tile: true,
4307
+ animate: "end",
4308
+ animationDuration: 500,
4309
+ tilingPaddingVertical: 10,
4310
+ tilingPaddingHorizontal: 10,
4311
+ gravityRangeCompound: 1.5,
4312
+ gravityCompound: 1,
4313
+ gravityRange: 3.8,
4314
+ initialEnergyOnIncremental: 0.5
4315
+ };
4316
+ function extend(defaults2, options) {
4317
+ var obj = {};
4318
+ for (var i in defaults2) {
4319
+ obj[i] = defaults2[i];
4320
+ }
4321
+ for (var i in options) {
4322
+ obj[i] = options[i];
4323
+ }
4324
+ return obj;
4325
+ }
4326
+ function _CoSELayout(_options) {
4327
+ this.options = extend(defaults, _options);
4328
+ getUserOptions(this.options);
4329
+ }
4330
+ var getUserOptions = function getUserOptions2(options) {
4331
+ if (options.nodeRepulsion != null)
4332
+ CoSEConstants.DEFAULT_REPULSION_STRENGTH = FDLayoutConstants.DEFAULT_REPULSION_STRENGTH = options.nodeRepulsion;
4333
+ if (options.idealEdgeLength != null)
4334
+ CoSEConstants.DEFAULT_EDGE_LENGTH = FDLayoutConstants.DEFAULT_EDGE_LENGTH = options.idealEdgeLength;
4335
+ if (options.edgeElasticity != null)
4336
+ CoSEConstants.DEFAULT_SPRING_STRENGTH = FDLayoutConstants.DEFAULT_SPRING_STRENGTH = options.edgeElasticity;
4337
+ if (options.nestingFactor != null)
4338
+ CoSEConstants.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR = FDLayoutConstants.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR = options.nestingFactor;
4339
+ if (options.gravity != null)
4340
+ CoSEConstants.DEFAULT_GRAVITY_STRENGTH = FDLayoutConstants.DEFAULT_GRAVITY_STRENGTH = options.gravity;
4341
+ if (options.numIter != null)
4342
+ CoSEConstants.MAX_ITERATIONS = FDLayoutConstants.MAX_ITERATIONS = options.numIter;
4343
+ if (options.gravityRange != null)
4344
+ CoSEConstants.DEFAULT_GRAVITY_RANGE_FACTOR = FDLayoutConstants.DEFAULT_GRAVITY_RANGE_FACTOR = options.gravityRange;
4345
+ if (options.gravityCompound != null)
4346
+ CoSEConstants.DEFAULT_COMPOUND_GRAVITY_STRENGTH = FDLayoutConstants.DEFAULT_COMPOUND_GRAVITY_STRENGTH = options.gravityCompound;
4347
+ if (options.gravityRangeCompound != null)
4348
+ CoSEConstants.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR = FDLayoutConstants.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR = options.gravityRangeCompound;
4349
+ if (options.initialEnergyOnIncremental != null)
4350
+ CoSEConstants.DEFAULT_COOLING_FACTOR_INCREMENTAL = FDLayoutConstants.DEFAULT_COOLING_FACTOR_INCREMENTAL = options.initialEnergyOnIncremental;
4351
+ if (options.quality == "draft")
4352
+ LayoutConstants.QUALITY = 0;
4353
+ else if (options.quality == "proof")
4354
+ LayoutConstants.QUALITY = 2;
4355
+ else
4356
+ LayoutConstants.QUALITY = 1;
4357
+ CoSEConstants.NODE_DIMENSIONS_INCLUDE_LABELS = FDLayoutConstants.NODE_DIMENSIONS_INCLUDE_LABELS = LayoutConstants.NODE_DIMENSIONS_INCLUDE_LABELS = options.nodeDimensionsIncludeLabels;
4358
+ CoSEConstants.DEFAULT_INCREMENTAL = FDLayoutConstants.DEFAULT_INCREMENTAL = LayoutConstants.DEFAULT_INCREMENTAL = !options.randomize;
4359
+ CoSEConstants.ANIMATE = FDLayoutConstants.ANIMATE = LayoutConstants.ANIMATE = options.animate;
4360
+ CoSEConstants.TILE = options.tile;
4361
+ CoSEConstants.TILING_PADDING_VERTICAL = typeof options.tilingPaddingVertical === "function" ? options.tilingPaddingVertical.call() : options.tilingPaddingVertical;
4362
+ CoSEConstants.TILING_PADDING_HORIZONTAL = typeof options.tilingPaddingHorizontal === "function" ? options.tilingPaddingHorizontal.call() : options.tilingPaddingHorizontal;
4363
+ };
4364
+ _CoSELayout.prototype.run = function() {
4365
+ var ready;
4366
+ var frameId;
4367
+ var options = this.options;
4368
+ var idToLNode = this.idToLNode = {};
4369
+ var layout = this.layout = new CoSELayout;
4370
+ var self = this;
4371
+ self.stopped = false;
4372
+ this.cy = this.options.cy;
4373
+ this.cy.trigger({ type: "layoutstart", layout: this });
4374
+ var gm = layout.newGraphManager();
4375
+ this.gm = gm;
4376
+ var nodes = this.options.eles.nodes();
4377
+ var edges = this.options.eles.edges();
4378
+ this.root = gm.addRoot();
4379
+ this.processChildrenList(this.root, this.getTopMostNodes(nodes), layout);
4380
+ for (var i = 0;i < edges.length; i++) {
4381
+ var edge = edges[i];
4382
+ var sourceNode = this.idToLNode[edge.data("source")];
4383
+ var targetNode = this.idToLNode[edge.data("target")];
4384
+ if (sourceNode !== targetNode && sourceNode.getEdgesBetween(targetNode).length == 0) {
4385
+ var e1 = gm.add(layout.newEdge(), sourceNode, targetNode);
4386
+ e1.id = edge.id();
4387
+ }
4388
+ }
4389
+ var getPositions = function getPositions2(ele, i2) {
4390
+ if (typeof ele === "number") {
4391
+ ele = i2;
4392
+ }
4393
+ var theId = ele.data("id");
4394
+ var lNode = self.idToLNode[theId];
4395
+ return {
4396
+ x: lNode.getRect().getCenterX(),
4397
+ y: lNode.getRect().getCenterY()
4398
+ };
4399
+ };
4400
+ var iterateAnimated = function iterateAnimated2() {
4401
+ var afterReposition = function afterReposition2() {
4402
+ if (options.fit) {
4403
+ options.cy.fit(options.eles, options.padding);
4404
+ }
4405
+ if (!ready) {
4406
+ ready = true;
4407
+ self.cy.one("layoutready", options.ready);
4408
+ self.cy.trigger({ type: "layoutready", layout: self });
4409
+ }
4410
+ };
4411
+ var ticksPerFrame = self.options.refresh;
4412
+ var isDone;
4413
+ for (var i2 = 0;i2 < ticksPerFrame && !isDone; i2++) {
4414
+ isDone = self.stopped || self.layout.tick();
4415
+ }
4416
+ if (isDone) {
4417
+ if (layout.checkLayoutSuccess() && !layout.isSubLayout) {
4418
+ layout.doPostLayout();
4419
+ }
4420
+ if (layout.tilingPostLayout) {
4421
+ layout.tilingPostLayout();
4422
+ }
4423
+ layout.isLayoutFinished = true;
4424
+ self.options.eles.nodes().positions(getPositions);
4425
+ afterReposition();
4426
+ self.cy.one("layoutstop", self.options.stop);
4427
+ self.cy.trigger({ type: "layoutstop", layout: self });
4428
+ if (frameId) {
4429
+ cancelAnimationFrame(frameId);
4430
+ }
4431
+ ready = false;
4432
+ return;
4433
+ }
4434
+ var animationData = self.layout.getPositionsData();
4435
+ options.eles.nodes().positions(function(ele, i3) {
4436
+ if (typeof ele === "number") {
4437
+ ele = i3;
4438
+ }
4439
+ if (!ele.isParent()) {
4440
+ var theId = ele.id();
4441
+ var pNode = animationData[theId];
4442
+ var temp = ele;
4443
+ while (pNode == null) {
4444
+ pNode = animationData[temp.data("parent")] || animationData["DummyCompound_" + temp.data("parent")];
4445
+ animationData[theId] = pNode;
4446
+ temp = temp.parent()[0];
4447
+ if (temp == undefined) {
4448
+ break;
4449
+ }
4450
+ }
4451
+ if (pNode != null) {
4452
+ return {
4453
+ x: pNode.x,
4454
+ y: pNode.y
4455
+ };
4456
+ } else {
4457
+ return {
4458
+ x: ele.position("x"),
4459
+ y: ele.position("y")
4460
+ };
4461
+ }
4462
+ }
4463
+ });
4464
+ afterReposition();
4465
+ frameId = requestAnimationFrame(iterateAnimated2);
4466
+ };
4467
+ layout.addListener("layoutstarted", function() {
4468
+ if (self.options.animate === "during") {
4469
+ frameId = requestAnimationFrame(iterateAnimated);
4470
+ }
4471
+ });
4472
+ layout.runLayout();
4473
+ if (this.options.animate !== "during") {
4474
+ self.options.eles.nodes().not(":parent").layoutPositions(self, self.options, getPositions);
4475
+ ready = false;
4476
+ }
4477
+ return this;
4478
+ };
4479
+ _CoSELayout.prototype.getTopMostNodes = function(nodes) {
4480
+ var nodesMap = {};
4481
+ for (var i = 0;i < nodes.length; i++) {
4482
+ nodesMap[nodes[i].id()] = true;
4483
+ }
4484
+ var roots = nodes.filter(function(ele, i2) {
4485
+ if (typeof ele === "number") {
4486
+ ele = i2;
4487
+ }
4488
+ var parent = ele.parent()[0];
4489
+ while (parent != null) {
4490
+ if (nodesMap[parent.id()]) {
4491
+ return false;
4492
+ }
4493
+ parent = parent.parent()[0];
4494
+ }
4495
+ return true;
4496
+ });
4497
+ return roots;
4498
+ };
4499
+ _CoSELayout.prototype.processChildrenList = function(parent, children, layout) {
4500
+ var size = children.length;
4501
+ for (var i = 0;i < size; i++) {
4502
+ var theChild = children[i];
4503
+ var children_of_children = theChild.children();
4504
+ var theNode;
4505
+ var dimensions = theChild.layoutDimensions({
4506
+ nodeDimensionsIncludeLabels: this.options.nodeDimensionsIncludeLabels
4507
+ });
4508
+ if (theChild.outerWidth() != null && theChild.outerHeight() != null) {
4509
+ theNode = parent.add(new CoSENode(layout.graphManager, new PointD(theChild.position("x") - dimensions.w / 2, theChild.position("y") - dimensions.h / 2), new DimensionD2(parseFloat(dimensions.w), parseFloat(dimensions.h))));
4510
+ } else {
4511
+ theNode = parent.add(new CoSENode(this.graphManager));
4512
+ }
4513
+ theNode.id = theChild.data("id");
4514
+ theNode.paddingLeft = parseInt(theChild.css("padding"));
4515
+ theNode.paddingTop = parseInt(theChild.css("padding"));
4516
+ theNode.paddingRight = parseInt(theChild.css("padding"));
4517
+ theNode.paddingBottom = parseInt(theChild.css("padding"));
4518
+ if (this.options.nodeDimensionsIncludeLabels) {
4519
+ if (theChild.isParent()) {
4520
+ var labelWidth = theChild.boundingBox({ includeLabels: true, includeNodes: false }).w;
4521
+ var labelHeight = theChild.boundingBox({ includeLabels: true, includeNodes: false }).h;
4522
+ var labelPos = theChild.css("text-halign");
4523
+ theNode.labelWidth = labelWidth;
4524
+ theNode.labelHeight = labelHeight;
4525
+ theNode.labelPos = labelPos;
4526
+ }
4527
+ }
4528
+ this.idToLNode[theChild.data("id")] = theNode;
4529
+ if (isNaN(theNode.rect.x)) {
4530
+ theNode.rect.x = 0;
4531
+ }
4532
+ if (isNaN(theNode.rect.y)) {
4533
+ theNode.rect.y = 0;
4534
+ }
4535
+ if (children_of_children != null && children_of_children.length > 0) {
4536
+ var theNewGraph;
4537
+ theNewGraph = layout.getGraphManager().add(layout.newGraph(), theNode);
4538
+ this.processChildrenList(theNewGraph, children_of_children, layout);
4539
+ }
4540
+ }
4541
+ };
4542
+ _CoSELayout.prototype.stop = function() {
4543
+ this.stopped = true;
4544
+ return this;
4545
+ };
4546
+ var register = function register2(cytoscape3) {
4547
+ cytoscape3("layout", "cose-bilkent", _CoSELayout);
4548
+ };
4549
+ if (typeof cytoscape !== "undefined") {
4550
+ register(cytoscape);
4551
+ }
4552
+ module2.exports = register;
4553
+ }
4554
+ ]);
4555
+ });
4556
+ });
4557
+
4558
+ // node_modules/mermaid/dist/chunks/mermaid.core/cose-bilkent-JH36ORCC.mjs
4559
+ var import_cytoscape_cose_bilkent = __toESM(require_cytoscape_cose_bilkent(), 1);
4560
+ cytoscape2.use(import_cytoscape_cose_bilkent.default);
4561
+ function addNodes(nodes, cy) {
4562
+ nodes.forEach((node) => {
4563
+ const nodeData = {
4564
+ id: node.id,
4565
+ labelText: node.label,
4566
+ height: node.height,
4567
+ width: node.width,
4568
+ padding: node.padding ?? 0
4569
+ };
4570
+ Object.keys(node).forEach((key) => {
4571
+ if (!["id", "label", "height", "width", "padding", "x", "y"].includes(key)) {
4572
+ nodeData[key] = node[key];
4573
+ }
4574
+ });
4575
+ cy.add({
4576
+ group: "nodes",
4577
+ data: nodeData,
4578
+ position: {
4579
+ x: node.x ?? 0,
4580
+ y: node.y ?? 0
4581
+ }
4582
+ });
4583
+ });
4584
+ }
4585
+ __name(addNodes, "addNodes");
4586
+ function addEdges(edges, cy) {
4587
+ edges.forEach((edge) => {
4588
+ const edgeData = {
4589
+ id: edge.id,
4590
+ source: edge.start,
4591
+ target: edge.end
4592
+ };
4593
+ Object.keys(edge).forEach((key) => {
4594
+ if (!["id", "start", "end"].includes(key)) {
4595
+ edgeData[key] = edge[key];
4596
+ }
4597
+ });
4598
+ cy.add({
4599
+ group: "edges",
4600
+ data: edgeData
4601
+ });
4602
+ });
4603
+ }
4604
+ __name(addEdges, "addEdges");
4605
+ function createCytoscapeInstance(data) {
4606
+ return new Promise((resolve) => {
4607
+ const renderEl = select_default("body").append("div").attr("id", "cy").attr("style", "display:none");
4608
+ const cy = cytoscape2({
4609
+ container: document.getElementById("cy"),
4610
+ style: [
4611
+ {
4612
+ selector: "edge",
4613
+ style: {
4614
+ "curve-style": "bezier"
4615
+ }
4616
+ }
4617
+ ]
4618
+ });
4619
+ renderEl.remove();
4620
+ addNodes(data.nodes, cy);
4621
+ addEdges(data.edges, cy);
4622
+ cy.nodes().forEach(function(n) {
4623
+ n.layoutDimensions = () => {
4624
+ const nodeData = n.data();
4625
+ return { w: nodeData.width, h: nodeData.height };
4626
+ };
4627
+ });
4628
+ const layoutConfig = {
4629
+ name: "cose-bilkent",
4630
+ quality: "proof",
4631
+ styleEnabled: false,
4632
+ animate: false
4633
+ };
4634
+ cy.layout(layoutConfig).run();
4635
+ cy.ready((e) => {
4636
+ log.info("Cytoscape ready", e);
4637
+ resolve(cy);
4638
+ });
4639
+ });
4640
+ }
4641
+ __name(createCytoscapeInstance, "createCytoscapeInstance");
4642
+ function extractPositionedNodes(cy) {
4643
+ return cy.nodes().map((node) => {
4644
+ const data = node.data();
4645
+ const position = node.position();
4646
+ const positionedNode = {
4647
+ id: data.id,
4648
+ x: position.x,
4649
+ y: position.y
4650
+ };
4651
+ Object.keys(data).forEach((key) => {
4652
+ if (key !== "id") {
4653
+ positionedNode[key] = data[key];
4654
+ }
4655
+ });
4656
+ return positionedNode;
4657
+ });
4658
+ }
4659
+ __name(extractPositionedNodes, "extractPositionedNodes");
4660
+ function extractPositionedEdges(cy) {
4661
+ return cy.edges().map((edge) => {
4662
+ const data = edge.data();
4663
+ const rscratch = edge._private.rscratch;
4664
+ const positionedEdge = {
4665
+ id: data.id,
4666
+ source: data.source,
4667
+ target: data.target,
4668
+ startX: rscratch.startX,
4669
+ startY: rscratch.startY,
4670
+ midX: rscratch.midX,
4671
+ midY: rscratch.midY,
4672
+ endX: rscratch.endX,
4673
+ endY: rscratch.endY
4674
+ };
4675
+ Object.keys(data).forEach((key) => {
4676
+ if (!["id", "source", "target"].includes(key)) {
4677
+ positionedEdge[key] = data[key];
4678
+ }
4679
+ });
4680
+ return positionedEdge;
4681
+ });
4682
+ }
4683
+ __name(extractPositionedEdges, "extractPositionedEdges");
4684
+ async function executeCoseBilkentLayout(data, _config) {
4685
+ log.debug("Starting cose-bilkent layout algorithm");
4686
+ try {
4687
+ validateLayoutData(data);
4688
+ const cy = await createCytoscapeInstance(data);
4689
+ const positionedNodes = extractPositionedNodes(cy);
4690
+ const positionedEdges = extractPositionedEdges(cy);
4691
+ log.debug(`Layout completed: ${positionedNodes.length} nodes, ${positionedEdges.length} edges`);
4692
+ return {
4693
+ nodes: positionedNodes,
4694
+ edges: positionedEdges
4695
+ };
4696
+ } catch (error) {
4697
+ log.error("Error in cose-bilkent layout algorithm:", error);
4698
+ throw error;
4699
+ }
4700
+ }
4701
+ __name(executeCoseBilkentLayout, "executeCoseBilkentLayout");
4702
+ function validateLayoutData(data) {
4703
+ if (!data) {
4704
+ throw new Error("Layout data is required");
4705
+ }
4706
+ if (!data.config) {
4707
+ throw new Error("Configuration is required in layout data");
4708
+ }
4709
+ if (!data.rootNode) {
4710
+ throw new Error("Root node is required");
4711
+ }
4712
+ if (!data.nodes || !Array.isArray(data.nodes)) {
4713
+ throw new Error("No nodes found in layout data");
4714
+ }
4715
+ if (!Array.isArray(data.edges)) {
4716
+ throw new Error("Edges array is required in layout data");
4717
+ }
4718
+ return true;
4719
+ }
4720
+ __name(validateLayoutData, "validateLayoutData");
4721
+ var render = /* @__PURE__ */ __name(async (data4Layout, svg, {
4722
+ insertCluster,
4723
+ insertEdge,
4724
+ insertEdgeLabel,
4725
+ insertMarkers,
4726
+ insertNode,
4727
+ log: log2,
4728
+ positionEdgeLabel
4729
+ }, { algorithm: _algorithm }) => {
4730
+ const nodeDb = {};
4731
+ const clusterDb = {};
4732
+ const element = svg.select("g");
4733
+ insertMarkers(element, data4Layout.markers, data4Layout.type, data4Layout.diagramId);
4734
+ const subGraphsEl = element.insert("g").attr("class", "subgraphs");
4735
+ const edgePaths = element.insert("g").attr("class", "edgePaths");
4736
+ const edgeLabels = element.insert("g").attr("class", "edgeLabels");
4737
+ const nodes = element.insert("g").attr("class", "nodes");
4738
+ log2.debug("Inserting nodes into DOM for dimension calculation");
4739
+ await Promise.all(data4Layout.nodes.map(async (node) => {
4740
+ if (node.isGroup) {
4741
+ const clusterNode = { ...node };
4742
+ clusterDb[node.id] = clusterNode;
4743
+ nodeDb[node.id] = clusterNode;
4744
+ await insertCluster(subGraphsEl, node);
4745
+ } else {
4746
+ const nodeWithPosition = { ...node };
4747
+ nodeDb[node.id] = nodeWithPosition;
4748
+ const nodeEl = await insertNode(nodes, node, {
4749
+ config: data4Layout.config,
4750
+ dir: data4Layout.direction || "TB"
4751
+ });
4752
+ const boundingBox = nodeEl.node().getBBox();
4753
+ nodeWithPosition.width = boundingBox.width;
4754
+ nodeWithPosition.height = boundingBox.height;
4755
+ nodeWithPosition.domId = nodeEl;
4756
+ log2.debug(`Node ${node.id} dimensions: ${boundingBox.width}x${boundingBox.height}`);
4757
+ }
4758
+ }));
4759
+ log2.debug("Running cose-bilkent layout algorithm");
4760
+ const updatedLayoutData = {
4761
+ ...data4Layout,
4762
+ nodes: data4Layout.nodes.map((node) => {
4763
+ const nodeWithDimensions = nodeDb[node.id];
4764
+ return {
4765
+ ...node,
4766
+ width: nodeWithDimensions.width,
4767
+ height: nodeWithDimensions.height
4768
+ };
4769
+ })
4770
+ };
4771
+ const layoutResult = await executeCoseBilkentLayout(updatedLayoutData, data4Layout.config);
4772
+ log2.debug("Positioning nodes based on layout results");
4773
+ layoutResult.nodes.forEach((positionedNode) => {
4774
+ const node = nodeDb[positionedNode.id];
4775
+ if (node?.domId) {
4776
+ node.domId.attr("transform", `translate(${positionedNode.x}, ${positionedNode.y})`);
4777
+ node.x = positionedNode.x;
4778
+ node.y = positionedNode.y;
4779
+ log2.debug(`Positioned node ${node.id} at center (${positionedNode.x}, ${positionedNode.y})`);
4780
+ }
4781
+ });
4782
+ layoutResult.edges.forEach((positionedEdge) => {
4783
+ const edge = data4Layout.edges.find((e) => e.id === positionedEdge.id);
4784
+ if (edge) {
4785
+ edge.points = [
4786
+ { x: positionedEdge.startX, y: positionedEdge.startY },
4787
+ { x: positionedEdge.midX, y: positionedEdge.midY },
4788
+ { x: positionedEdge.endX, y: positionedEdge.endY }
4789
+ ];
4790
+ }
4791
+ });
4792
+ log2.debug("Inserting and positioning edges");
4793
+ await Promise.all(data4Layout.edges.map(async (edge) => {
4794
+ const _edgeLabel = await insertEdgeLabel(edgeLabels, edge);
4795
+ const startNode = nodeDb[edge.start ?? ""];
4796
+ const endNode = nodeDb[edge.end ?? ""];
4797
+ if (startNode && endNode) {
4798
+ const positionedEdge = layoutResult.edges.find((e) => e.id === edge.id);
4799
+ if (positionedEdge) {
4800
+ log2.debug("APA01 positionedEdge", positionedEdge);
4801
+ const edgeWithPath = { ...edge };
4802
+ const paths = insertEdge(edgePaths, edgeWithPath, clusterDb, data4Layout.type, startNode, endNode, data4Layout.diagramId);
4803
+ positionEdgeLabel(edgeWithPath, paths);
4804
+ } else {
4805
+ const edgeWithPath = {
4806
+ ...edge,
4807
+ points: [
4808
+ { x: startNode.x || 0, y: startNode.y || 0 },
4809
+ { x: endNode.x || 0, y: endNode.y || 0 }
4810
+ ]
4811
+ };
4812
+ const paths = insertEdge(edgePaths, edgeWithPath, clusterDb, data4Layout.type, startNode, endNode, data4Layout.diagramId);
4813
+ positionEdgeLabel(edgeWithPath, paths);
4814
+ }
4815
+ }
4816
+ }));
4817
+ log2.debug("Cose-bilkent rendering completed");
4818
+ }, "render");
4819
+ var render2 = render;
4820
+ export {
4821
+ render2 as render
4822
+ };