@kabmo-labs/kabmo 0.32.0 → 0.32.1

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 (224) hide show
  1. package/dist/client/index.html +1 -1
  2. package/dist/client/index.js +308 -308
  3. package/dist/client/static/js/{CsvGrid-amafmq3z.js → CsvGrid-4gx0jevc.js} +2 -2
  4. package/dist/client/static/js/{DocxView-851ps9t0.js → DocxView-0667nr8h.js} +5 -5
  5. package/dist/client/static/js/{DrawioView-kw1vy3r2.js → DrawioView-522v0d0r.js} +2 -2
  6. package/dist/client/static/js/ImageView-t8xp60hm.js +1 -0
  7. package/dist/client/static/js/LayoutWrapper-xjnveecv.js +2 -0
  8. package/dist/client/static/js/{Modal-f8x3j3be.js → Modal-k2jr9hc4.js} +14 -14
  9. package/dist/client/static/js/{PdfView-f5jkm0rs.js → PdfView-3fx172xh.js} +1 -1
  10. package/dist/client/static/js/SessionsView-n3agmf5t.js +1 -0
  11. package/dist/client/static/js/{SheetView-23zxy30b.js → SheetView-nmrdb1b8.js} +23 -23
  12. package/dist/client/static/js/{SvgPreview-c341y50e.js → SvgPreview-0xsc6xam.js} +1 -1
  13. package/dist/client/static/js/{abnfDiagram-O67JEVCF-2dc3mpk6.js → abnfDiagram-O67JEVCF-jj31rs62.js} +1 -1
  14. package/dist/client/static/js/architecture-7GRP2DOG-1y9zvsyt.js +1 -0
  15. package/dist/client/static/js/{architectureDiagram-NJMV4G6O-7jmrr5ja.js → architectureDiagram-NJMV4G6O-ay3yr7pf.js} +3 -3
  16. package/dist/client/static/js/{astro-sjtf954j.js → astro-qgx1r159.js} +1 -1
  17. package/dist/client/static/js/bash-m0qjsyy0.js +1 -0
  18. package/dist/client/static/js/{blockDiagram-BEXU5L5S-jrk2m0ea.js → blockDiagram-BEXU5L5S-4x33e16k.js} +3 -3
  19. package/dist/client/static/js/c-wkgxb1t1.js +1 -0
  20. package/dist/client/static/js/{c4Diagram-YGBWAQC7-48cyncjd.js → c4Diagram-YGBWAQC7-dtb81cgz.js} +2 -2
  21. package/dist/client/static/js/{classDiagram-v2-NBCMYWYE-gm7jt1cd.js → classDiagram-v2-NBCMYWYE-vk5a2n9w.js} +3 -3
  22. package/dist/client/static/js/{cose-bilkent-JH36ORCC-g0g3z0xp.js → cose-bilkent-JH36ORCC-6rbjbe19.js} +1 -1
  23. package/dist/client/static/js/cpp-y0t6mynx.js +1 -0
  24. package/dist/client/static/js/css-t4ngafan.js +1 -0
  25. package/dist/client/static/js/cynefin-OW5HDTMX-k2188qcq.js +1 -0
  26. package/dist/client/static/js/{cynefinDiagram-VND7K2PF-6vjde6am.js → cynefinDiagram-VND7K2PF-vyjksedr.js} +2 -2
  27. package/dist/client/static/js/{dagre-6A5THRUB-q6k8bx1j.js → dagre-6A5THRUB-7hey38z5.js} +2 -2
  28. package/dist/client/static/js/{diagram-22UHCM2B-87cmze2n.js → diagram-22UHCM2B-aes06jde.js} +11 -11
  29. package/dist/client/static/js/{diagram-3UASUU5V-1ejbr2p4.js → diagram-3UASUU5V-3cfkgm3x.js} +1 -1
  30. package/dist/client/static/js/{diagram-ATOU4E4O-vaw1r6k2.js → diagram-ATOU4E4O-z8mfhwpy.js} +3 -3
  31. package/dist/client/static/js/{diagram-CDSNMT55-gxm9zv7d.js → diagram-CDSNMT55-t4821ctz.js} +2 -2
  32. package/dist/client/static/js/{diagram-MLGK6HIB-x010xswm.js → diagram-MLGK6HIB-23yxbfrx.js} +1 -1
  33. package/dist/client/static/js/{diagram-MPIPVDR6-qtcq7e6c.js → diagram-MPIPVDR6-chhtf7v0.js} +2 -2
  34. package/dist/client/static/js/{dockerfile-k5xbramm.js → dockerfile-5b87ghm7.js} +1 -1
  35. package/dist/client/static/js/{ebnfDiagram-ZINNZB2B-nwwbasfh.js → ebnfDiagram-ZINNZB2B-9jejcvfr.js} +1 -1
  36. package/dist/client/static/js/{elk-276RUBZZ-xcp7thax.js → elk-276RUBZZ-xhhtkf58.js} +1 -1
  37. package/dist/client/static/js/{erDiagram-OPXOYQCR-xj1tp716.js → erDiagram-OPXOYQCR-mt2apjjb.js} +5 -5
  38. package/dist/client/static/js/{erlang-rz1g9mxy.js → erlang-6m6tpt72.js} +1 -1
  39. package/dist/client/static/js/eventmodeling-NTZA5JFV-pdr0qn0n.js +1 -0
  40. package/dist/client/static/js/flowDiagram-KWPJA3E3-zvz0mxne.js +1 -0
  41. package/dist/client/static/js/{ganttDiagram-FUAMR5RP-f7q96bea.js → ganttDiagram-FUAMR5RP-8cm7a29w.js} +3 -3
  42. package/dist/client/static/js/gitGraph-4MIJSDKK-wmqf046s.js +1 -0
  43. package/dist/client/static/js/{gitGraphDiagram-X574FWY7-1rydkyq9.js → gitGraphDiagram-X574FWY7-5s0gbnx2.js} +2 -2
  44. package/dist/client/static/js/graphql-692h0n2x.js +1 -0
  45. package/dist/client/static/js/{index-52bgxh6f.js → index-2gfc25tq.js} +1 -1
  46. package/dist/client/static/js/{index-x64kqgen.js → index-2xj14800.js} +2 -2
  47. package/dist/client/static/js/{index-8m3q2zpb.js → index-360d7j0d.js} +1 -1
  48. package/dist/client/static/js/{index-123e8tqq.js → index-3vhznzgr.js} +1 -1
  49. package/dist/client/static/js/{index-y139vc12.js → index-4s8ttfxj.js} +175 -175
  50. package/dist/client/static/js/{index-9nbxb421.js → index-532btjmp.js} +2 -2
  51. package/dist/client/static/js/{index-c8jzx6b0.js → index-59jb53v3.js} +1 -1
  52. package/dist/client/static/js/{index-2t2tnc3x.js → index-5x95n3hx.js} +1 -1
  53. package/dist/client/static/js/{index-f63y3mjj.js → index-5y7c62sm.js} +4 -4
  54. package/dist/client/static/js/index-61tm0v57.js +1 -0
  55. package/dist/client/static/js/{index-fc2j6bq2.js → index-629kfbcb.js} +2 -2
  56. package/dist/client/static/js/{index-0n9c85ke.js → index-6q80csr0.js} +2 -2
  57. package/dist/client/static/js/{index-6sdctwv2.js → index-7fdp9c7m.js} +2 -2
  58. package/dist/client/static/js/index-7n68yx6m.js +2 -0
  59. package/dist/client/static/js/{index-pe9j88d4.js → index-9sd0vjmh.js} +2 -2
  60. package/dist/client/static/js/{index-m6wwc5h6.js → index-9t82sx0w.js} +2 -2
  61. package/dist/client/static/js/{index-xa7nrnda.js → index-a0bdavdr.js} +2 -2
  62. package/dist/client/static/js/{index-xpf2ra60.js → index-a6k2hqke.js} +1 -1
  63. package/dist/client/static/js/{index-e26rd868.js → index-a733k69t.js} +2 -2
  64. package/dist/client/static/js/{index-31jrebvn.js → index-ay34b398.js} +6 -6
  65. package/dist/client/static/js/{index-w4re5r8w.js → index-bbggh3f8.js} +2 -2
  66. package/dist/client/static/js/{index-73xfkyea.js → index-brj8qwa6.js} +2 -2
  67. package/dist/client/static/js/{index-fmxn1rzs.js → index-c0x6s6f7.js} +2 -2
  68. package/dist/client/static/js/{index-vmvcse63.js → index-c93sp4yh.js} +1 -1
  69. package/dist/client/static/js/{index-e7a3fkvv.js → index-dnp07j57.js} +1 -1
  70. package/dist/client/static/js/{index-pkyrkkbt.js → index-dq1kdt03.js} +2 -2
  71. package/dist/client/static/js/{index-ggaqh9rt.js → index-dt7e1328.js} +2 -2
  72. package/dist/client/static/js/{index-hkq0y3pn.js → index-ehcpzk5b.js} +2 -2
  73. package/dist/client/static/js/{index-tr8754r0.js → index-ejgd8w3s.js} +45 -45
  74. package/dist/client/static/js/{index-0a1ekhqf.js → index-fdbfzshx.js} +2 -2
  75. package/dist/client/static/js/{index-c20a46ww.js → index-g33knza2.js} +2 -2
  76. package/dist/client/static/js/{index-hhm62nfj.js → index-gbfg0anm.js} +2 -2
  77. package/dist/client/static/js/{index-2n5wy1sh.js → index-h06bcfds.js} +1 -1
  78. package/dist/client/static/js/{index-22jaxtz1.js → index-h7pn9qw6.js} +2 -2
  79. package/dist/client/static/js/{index-qmh0h87h.js → index-hc2jmzpx.js} +48 -48
  80. package/dist/client/static/js/{index-nsrnyqcm.js → index-jppt5mgc.js} +2 -2
  81. package/dist/client/static/js/{index-deex10rz.js → index-jz9fpznk.js} +5 -5
  82. package/dist/client/static/js/{index-r416e9dt.js → index-kg86e3sy.js} +11 -11
  83. package/dist/client/static/js/{index-e6rar25v.js → index-kpspnztv.js} +2 -2
  84. package/dist/client/static/js/index-nmmxb4va.js +2 -0
  85. package/dist/client/static/js/{index-zca66d5d.js → index-p7btwjvj.js} +3 -3
  86. package/dist/client/static/js/{index-gvwqjpcr.js → index-pf5sbesf.js} +2 -2
  87. package/dist/client/static/js/{index-ynqnbvn2.js → index-pf7syd7t.js} +3 -3
  88. package/dist/client/static/js/{index-3anc30zh.js → index-qkscve6n.js} +2 -2
  89. package/dist/client/static/js/index-qnwqaczk.js +4 -0
  90. package/dist/client/static/js/{index-5zd1jx9r.js → index-rg8jpbsw.js} +2 -2
  91. package/dist/client/static/js/{index-hyry1n8x.js → index-sa9cp6km.js} +2 -2
  92. package/dist/client/static/js/{index-f519m6s3.js → index-vd0e25p0.js} +1 -1
  93. package/dist/client/static/js/{index-cwaz6geq.js → index-vtbbfwx0.js} +2 -2
  94. package/dist/client/static/js/{index-14wppnkx.js → index-wzma5n54.js} +2 -2
  95. package/dist/client/static/js/{index-s9vp6p70.js → index-x07kp3jz.js} +2 -2
  96. package/dist/client/static/js/{index-8a3tmm1h.js → index-xj9649ac.js} +7 -7
  97. package/dist/client/static/js/{index-vrbcj11n.js → index-xya34x4v.js} +2 -2
  98. package/dist/client/static/js/{index-yvcpdk5f.js → index-ye3sr7db.js} +2 -2
  99. package/dist/client/static/js/{index-w5131mtt.js → index-z4v1xmh1.js} +2 -2
  100. package/dist/client/static/js/{index-0g25yrc0.js → index-z5s27s26.js} +1 -1
  101. package/dist/client/static/js/info-A6RAGUB7-zg3twte6.js +1 -0
  102. package/dist/client/static/js/{infoDiagram-VRGFBTTK-ptg07tp2.js → infoDiagram-VRGFBTTK-3w1yz32c.js} +1 -1
  103. package/dist/client/static/js/ini-cg0a5wm3.js +1 -0
  104. package/dist/client/static/js/{ishikawaDiagram-OU5B5YK6-bdk2dkf5.js → ishikawaDiagram-OU5B5YK6-ckt471dy.js} +1 -1
  105. package/dist/client/static/js/java-vcck089n.js +1 -0
  106. package/dist/client/static/js/{journeyDiagram-ZHPQQLJL-kez0ha4c.js → journeyDiagram-ZHPQQLJL-kfvn4w7e.js} +2 -2
  107. package/dist/client/static/js/json-j5q8nt57.js +1 -0
  108. package/dist/client/static/js/jsx-ht9zyzwa.js +1 -0
  109. package/dist/client/static/js/{julia-nmr85k8z.js → julia-0j0gsjvc.js} +1 -1
  110. package/dist/client/static/js/{kanban-definition-PNTS6WVX-dhzp3qg5.js → kanban-definition-PNTS6WVX-0q36cm83.js} +3 -3
  111. package/dist/client/static/js/lua-ke895s2q.js +1 -0
  112. package/dist/client/static/js/markdown-gwmsh53r.js +1 -0
  113. package/dist/client/static/js/{mermaid.core-h7wttbss.js → mermaid.core-b1ssa824.js} +7 -7
  114. package/dist/client/static/js/{mindmap-definition-NLK3R4M7-tq5dd1em.js → mindmap-definition-NLK3R4M7-e2ym5en8.js} +4 -4
  115. package/dist/client/static/js/one-dark-pro-4geyzhjj.js +1 -0
  116. package/dist/client/static/js/one-light-tqssjm9t.js +1 -0
  117. package/dist/client/static/js/packet-AYTQ26CC-3pav51g0.js +1 -0
  118. package/dist/client/static/js/{pegDiagram-GJSIUBJH-e5hrdfzv.js → pegDiagram-GJSIUBJH-t8bbdyhe.js} +1 -1
  119. package/dist/client/static/js/{perl-prxcva8r.js → perl-7n7e9ncg.js} +1 -1
  120. package/dist/client/static/js/{php-m9kcctzs.js → php-32vy69vd.js} +1 -1
  121. package/dist/client/static/js/pie-WAS4IAKB-wqfh7zdk.js +1 -0
  122. package/dist/client/static/js/{pieDiagram-5QR66LMP-axvbvnz8.js → pieDiagram-5QR66LMP-envv4brj.js} +2 -2
  123. package/dist/client/static/js/properties-mzvvbqg5.js +1 -0
  124. package/dist/client/static/js/python-3w64wsyd.js +1 -0
  125. package/dist/client/static/js/{quadrantDiagram-O4NWA36T-wtn28cfm.js → quadrantDiagram-O4NWA36T-72rk137a.js} +3 -3
  126. package/dist/client/static/js/r-32re2zwb.js +1 -0
  127. package/dist/client/static/js/radar-RG4KPBEZ-w7qjdr2g.js +1 -0
  128. package/dist/client/static/js/railroad-74A4TZTK-rhr99kkj.js +1 -0
  129. package/dist/client/static/js/railroad-abnf-HS5TGJTU-c4jeea3m.js +1 -0
  130. package/dist/client/static/js/railroad-ebnf-LZEXJU2U-x2ee66ex.js +1 -0
  131. package/dist/client/static/js/railroad-peg-WCYAUIDC-yw8wjfwg.js +1 -0
  132. package/dist/client/static/js/{railroadDiagram-XR7U4H2S-avjkq945.js → railroadDiagram-XR7U4H2S-1ej0f5hr.js} +1 -1
  133. package/dist/client/static/js/{requirementDiagram-PLB6GJNP-bntx7r6q.js → requirementDiagram-PLB6GJNP-rvdaknpd.js} +3 -3
  134. package/dist/client/static/js/{ruby-t06c0e7g.js → ruby-5ty7fys7.js} +1 -1
  135. package/dist/client/static/js/{rust-6gqjxyf0.js → rust-2geezrcs.js} +1 -1
  136. package/dist/client/static/js/{sankeyDiagram-IPEJSGJF-ps8nkdm2.js → sankeyDiagram-IPEJSGJF-nxvhtdaw.js} +3 -3
  137. package/dist/client/static/js/{sass-gsbyn3wh.js → sass-mey5150f.js} +1 -1
  138. package/dist/client/static/js/{sequenceDiagram-PO4LG4MO-3ckf1q6z.js → sequenceDiagram-PO4LG4MO-n5cn5qrt.js} +6 -6
  139. package/dist/client/static/js/{sizeCapture-INFHLROL-akvcr1x7.js → sizeCapture-INFHLROL-r074kj7s.js} +1 -1
  140. package/dist/client/static/js/sql-g8wcshpc.js +1 -0
  141. package/dist/client/static/js/{stateDiagram-v2-GCMORJYK-c82914fz.js → stateDiagram-v2-GCMORJYK-vxghxdb0.js} +3 -3
  142. package/dist/client/static/js/{svelte-j54gfrvq.js → svelte-3ewx0hzx.js} +1 -1
  143. package/dist/client/static/js/{swimlanes-2SLR337P-scgdefh4.js → swimlanes-2SLR337P-qkkv894p.js} +1 -1
  144. package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-y81h9n27.js +8 -0
  145. package/dist/client/static/js/{timeline-definition-EJHVYXUP-z2ha1rhq.js → timeline-definition-EJHVYXUP-5tbq4ex2.js} +2 -2
  146. package/dist/client/static/js/treeView-Q6P3EWNA-ekz05ccs.js +1 -0
  147. package/dist/client/static/js/treemap-WGGIJYW6-aq6qymjr.js +1 -0
  148. package/dist/client/static/js/tsx-0p183w2f.js +1 -0
  149. package/dist/client/static/js/typescript-t9a5jyvv.js +1 -0
  150. package/dist/client/static/js/{usecaseDiagram-POWQR4AR-3wdmrfmk.js → usecaseDiagram-POWQR4AR-6p8hf0b7.js} +15 -15
  151. package/dist/client/static/js/{vennDiagram-UO4OBE2U-7m5tatzv.js → vennDiagram-UO4OBE2U-7k5jsxf9.js} +1 -1
  152. package/dist/client/static/js/{vue-y8bb5f3h.js → vue-06rdf4wh.js} +1 -1
  153. package/dist/client/static/js/wardley-WFR3VGLG-z34tj4y3.js +1 -0
  154. package/dist/client/static/js/{wardleyDiagram-VNRHLVJA-55ps9s4z.js → wardleyDiagram-VNRHLVJA-km2x4er8.js} +3 -3
  155. package/dist/client/static/js/xml-81hxjjt4.js +1 -0
  156. package/dist/client/static/js/{xychartDiagram-PMCCYNJV-8bsjtm4t.js → xychartDiagram-PMCCYNJV-kr3sgr4m.js} +2 -2
  157. package/dist/client/static/js/yaml-yssayv8a.js +1 -0
  158. package/package.json +1 -1
  159. package/src/client/components/common/session-actions-menu/index.tsx +6 -1
  160. package/src/client/components/layout/session-sidebar/SessionsView.tsx +20 -33
  161. package/src/client/components/mobile/LayoutWrapper.tsx +16 -26
  162. package/src/client/components/mobile/worktree-session.ts +4 -1
  163. package/src/client/components/workspace/chat-timeline/EmptyWorkspacePrompt.tsx +16 -15
  164. package/src/client/components/workspace/chat-timeline/fork-preview.test.tsx +11 -0
  165. package/src/client/hooks/chat/btw/mode.ts +5 -1
  166. package/src/client/hooks/chat/omp/session-sidebar-controller.ts +9 -3
  167. package/src/client/hooks/chat/timeline/new-chat.ts +4 -1
  168. package/src/client/hooks/chat/timeline/pending-dispatch.ts +6 -10
  169. package/src/client/hooks/chat/waiting/dispatch.ts +4 -1
  170. package/src/client/hooks/workspace/batch-delete-run.ts +5 -1
  171. package/src/client/hooks/workspace/session-delete.ts +5 -1
  172. package/src/client/lib/router/branch-params.test.ts +62 -0
  173. package/src/client/lib/router/branch-params.ts +48 -0
  174. package/src/server/lib/assets/shell-settings.server.test.ts +35 -0
  175. package/src/server/lib/assets/shell-settings.server.ts +33 -0
  176. package/src/server/lib/realtime/topics/peer-relay.server.test.ts +1 -11
  177. package/src/server/plugins/ssr.ts +20 -8
  178. package/src/test-support/peer-harness.ts +13 -5
  179. package/dist/client/static/js/ImageView-ksx9bbct.js +0 -1
  180. package/dist/client/static/js/LayoutWrapper-9ftz050x.js +0 -2
  181. package/dist/client/static/js/SessionsView-wzdf1cp6.js +0 -1
  182. package/dist/client/static/js/architecture-7GRP2DOG-4wsd6vk0.js +0 -1
  183. package/dist/client/static/js/bash-h6pkqvth.js +0 -1
  184. package/dist/client/static/js/c-thbdzmwv.js +0 -1
  185. package/dist/client/static/js/cpp-r1za1kke.js +0 -1
  186. package/dist/client/static/js/css-qsv4vvke.js +0 -1
  187. package/dist/client/static/js/cynefin-OW5HDTMX-eycwde8c.js +0 -1
  188. package/dist/client/static/js/eventmodeling-NTZA5JFV-srqbnmey.js +0 -1
  189. package/dist/client/static/js/flowDiagram-KWPJA3E3-yj98317w.js +0 -1
  190. package/dist/client/static/js/gitGraph-4MIJSDKK-5jcrvn94.js +0 -1
  191. package/dist/client/static/js/graphql-275pg7ya.js +0 -1
  192. package/dist/client/static/js/index-b08zd4eq.js +0 -1
  193. package/dist/client/static/js/index-g0pkzanm.js +0 -2
  194. package/dist/client/static/js/index-ga2xdef3.js +0 -2
  195. package/dist/client/static/js/index-xzfsaqyz.js +0 -4
  196. package/dist/client/static/js/info-A6RAGUB7-mbt0ryx5.js +0 -1
  197. package/dist/client/static/js/ini-jqdrx98c.js +0 -1
  198. package/dist/client/static/js/java-70zqqrkr.js +0 -1
  199. package/dist/client/static/js/json-kxk8gfet.js +0 -1
  200. package/dist/client/static/js/jsx-h1035eqk.js +0 -1
  201. package/dist/client/static/js/lua-j2356waf.js +0 -1
  202. package/dist/client/static/js/markdown-ffw6rgk6.js +0 -1
  203. package/dist/client/static/js/one-dark-pro-8acf6cn2.js +0 -1
  204. package/dist/client/static/js/one-light-ysc1knem.js +0 -1
  205. package/dist/client/static/js/packet-AYTQ26CC-a5yw789s.js +0 -1
  206. package/dist/client/static/js/pie-WAS4IAKB-x0y4v4r2.js +0 -1
  207. package/dist/client/static/js/properties-55mrarxr.js +0 -1
  208. package/dist/client/static/js/python-dhypc3j4.js +0 -1
  209. package/dist/client/static/js/r-6b8dt1wp.js +0 -1
  210. package/dist/client/static/js/radar-RG4KPBEZ-trrc3ta1.js +0 -1
  211. package/dist/client/static/js/railroad-74A4TZTK-dxgvx21w.js +0 -1
  212. package/dist/client/static/js/railroad-abnf-HS5TGJTU-rbgkd8sk.js +0 -1
  213. package/dist/client/static/js/railroad-ebnf-LZEXJU2U-exgw7j47.js +0 -1
  214. package/dist/client/static/js/railroad-peg-WCYAUIDC-28tpamzk.js +0 -1
  215. package/dist/client/static/js/sql-9dq913c8.js +0 -1
  216. package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-0x2ashav.js +0 -8
  217. package/dist/client/static/js/treeView-Q6P3EWNA-1a00b6kc.js +0 -1
  218. package/dist/client/static/js/treemap-WGGIJYW6-2q4f2f7m.js +0 -1
  219. package/dist/client/static/js/tsx-wh5xgm7f.js +0 -1
  220. package/dist/client/static/js/typescript-ge85req5.js +0 -1
  221. package/dist/client/static/js/wardley-WFR3VGLG-x9v91the.js +0 -1
  222. package/dist/client/static/js/xml-7bgz40qa.js +0 -1
  223. package/dist/client/static/js/yaml-4ht9416k.js +0 -1
  224. package/src/client/components/layout/session-sidebar/new-session-context.test.ts +0 -55
@@ -1,4 +1,4 @@
1
- import{t,l,p,q,oa,yA,Mr,ai,la,Is,ii}from"./index-qmh0h87h.js";import{Nt,dn,Zn,jt,_r,Ka,ve,vt,dr,Va,pr,Al,gd,hd,bd,Ao,ta,yd,ho,pn,bo,Qa,na,yo,Ya,vo,vd,kd,gl,Rt,xd,ko,Ja,xo,hl,bl,Za,wd,yl,Cd,uu,Sr,vl,Ed,Bd,Id,Pn,kl,xl,wo,_d,wl,v,Xn,Tr,Ft,Xa,Oe}from"./index-ga2xdef3.js";import{pd,md,Ae,ks,sA,fd,Li}from"./index-0a1ekhqf.js";import{un}from"./index-fmxn1rzs.js";var fr={};un(fr,{default:()=>Z});var Sn=/\s/;function Nn(r){var e=r.length;while(e--&&Sn.test(r.charAt(e)));return e}var Hr=Nn;var kn=/^\s+/;function Tn(r){return r?r.slice(0,Hr(r)+1).replace(kn,""):r}var Kr=Tn;var Jr=NaN,Cn=/^[-+]0x[0-9a-f]+$/i,An=/^0b[01]+$/i,Rn=/^0o[0-7]+$/i,Mn=parseInt;function jn(r){if(typeof r=="number")return r;if(_r(r))return Jr;if(vt(r)){var e=typeof r.valueOf=="function"?r.valueOf():r;r=vt(e)?e+"":e}if(typeof r!="string")return r===0?r:+r;r=Kr(r);var n=An.test(r);return n||Rn.test(r)?Mn(r.slice(2),n?2:8):Cn.test(r)?Jr:+r}var Zr=jn;var $r=1/0,Bn=179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000;function Dn(r){if(!r)return r===0?r:0;if(r=Zr(r),r===$r||r===-$r){var e=r<0?-1:1;return e*Bn}return r===r?r:0}var U=Dn;function Fn(r){var e=U(r),n=e%1;return e===e?n?e-n:e:0}var Qr=Fn;var re=Object.create,Gn=function(){function r(){}return function(e){if(!vt(e))return{};if(re)return re(e);r.prototype=e;var n=new r;return r.prototype=void 0,n}}(),ee=Gn;function Un(r,e){var n=-1,o=r.length;e||(e=Array(o));while(++n<o)e[n]=r[n];return e}var ir=Un;function Vn(r,e,n){if(e=="__proto__"&&Al)Al(r,e,{configurable:!0,enumerable:!0,value:n,writable:!0});else r[e]=n}var R=Vn;var Yn=Object.prototype,zn=Yn.hasOwnProperty;function Wn(r,e,n){var o=r[e];if(!(zn.call(r,e)&&ta(o,n))||n===void 0&&!(e in r))R(r,e,n)}var M=Wn;function qn(r,e,n,o){var i=!n;n||(n={});var a=-1,f=e.length;while(++a<f){var s=e[a],u=o?o(n[s],r[s],s,n,r):void 0;if(u===void 0)u=r[s];if(i)R(n,s,u);else M(n,s,u)}return n}var P=qn;function Hn(r,e,n){if(!vt(n))return!1;var o=typeof e;if(o=="number"?pn(n)&&Ao(e,n.length):o=="string"&&(e in n))return ta(n[e],r);return!1}var T=Hn;function Kn(r){return ho(function(e,n){var o=-1,i=n.length,a=i>1?n[i-1]:void 0,f=i>2?n[2]:void 0;if(a=r.length>3&&typeof a=="function"?(i--,a):void 0,f&&T(n[0],n[1],f))a=i<3?void 0:a,i=1;e=Object(e);while(++o<i){var s=n[o];if(s)r(e,s,o,a)}return e})}var te=Kn;function Jn(r){var e=[];if(r!=null)for(var n in Object(r))e.push(n);return e}var ne=Jn;var $n=Object.prototype,Qn=$n.hasOwnProperty;function ro(r){if(!vt(r))return ne(r);var e=bo(r),n=[];for(var o in r)if(!(o=="constructor"&&(e||!Qn.call(r,o))))n.push(o);return n}var oe=ro;function eo(r){return pn(r)?vd(r,!0):oe(r)}var L=eo;function to(r){var e=r==null?0:r.length;return e?bl(r,1):[]}var S=to;function no(r){return gd(yd(r,void 0,S),r+"")}var ie=no;var oo=kd(Object.getPrototypeOf,Object),V=oo;var io="[object Object]",ao=Function.prototype,fo=Object.prototype,ae=ao.toString,so=fo.hasOwnProperty,uo=ae.call(Object);function co(r){if(!jt(r)||Zn(r)!=io)return!1;var e=V(r);if(e===null)return!0;var n=so.call(e,"constructor")&&e.constructor;return typeof n=="function"&&n instanceof n&&ae.call(n)==uo}var fe=co;var po="\\ud800-\\udfff",lo="\\u0300-\\u036f",mo="\\ufe20-\\ufe2f",go="\\u20d0-\\u20ff",_o=lo+mo+go,Eo="\\ufe0e\\ufe0f",Oo="\\u200d",Lo=RegExp("["+Oo+po+_o+Eo+"]");function Io(r){return Lo.test(r)}var se=Io;function So(r,e){return r&&P(e,Rt(e),r)}var ue=So;function No(r,e){return r&&P(e,L(e),r)}var de=No;var me=typeof fr=="object"&&fr&&!fr.nodeType&&fr,ce=me&&typeof ar=="object"&&ar&&!ar.nodeType&&ar,Po=ce&&ce.exports===me,pe=Po?Nt.Buffer:void 0,le=pe?pe.allocUnsafe:void 0;function To(r,e){if(e)return r.slice();var n=r.length,o=le?le(n):new r.constructor(n);return r.copy(o),o}var Z=To;function Co(r,e){return P(r,yl(r),e)}var he=Co;var Ro=Object.getOwnPropertySymbols,Mo=!Ro?wd:function(r){var e=[];while(r)hl(e,yl(r)),r=V(r);return e},sr=Mo;function jo(r,e){return P(r,sr(r),e)}var ge=jo;function Bo(r){return Cd(r,L,sr)}var be=Bo;var Do=Object.prototype,Fo=Do.hasOwnProperty;function Go(r){var e=r.length,n=new r.constructor(e);if(e&&typeof r[0]=="string"&&Fo.call(r,"index"))n.index=r.index,n.input=r.input;return n}var ye=Go;function Xo(r){var e=new r.constructor(r.byteLength);return new vl(e).set(new vl(r)),e}var Y=Xo;function Uo(r,e){var n=e?Y(r.buffer):r.buffer;return new r.constructor(n,r.byteOffset,r.byteLength)}var we=Uo;var Vo=/\w*$/;function Yo(r){var e=new r.constructor(r.source,Vo.exec(r));return e.lastIndex=r.lastIndex,e}var _e=Yo;var Ee=dn?dn.prototype:void 0,xe=Ee?Ee.valueOf:void 0;function zo(r){return xe?Object(xe.call(r)):{}}var Le=zo;function Wo(r,e){var n=e?Y(r.buffer):r.buffer;return new r.constructor(n,r.byteOffset,r.length)}var ur=Wo;var qo="[object Boolean]",Ho="[object Date]",Ko="[object Map]",Jo="[object Number]",Zo="[object RegExp]",$o="[object Set]",Qo="[object String]",ri="[object Symbol]",ei="[object ArrayBuffer]",ti="[object DataView]",ni="[object Float32Array]",oi="[object Float64Array]",fi="[object Int8Array]",si="[object Int16Array]",ui="[object Int32Array]",di="[object Uint8Array]",ci="[object Uint8ClampedArray]",pi="[object Uint16Array]",li="[object Uint32Array]";function mi(r,e,n){var o=r.constructor;switch(e){case ei:return Y(r);case qo:case Ho:return new o(+r);case ti:return we(r,n);case ni:case oi:case fi:case si:case ui:case di:case ci:case pi:case li:return ur(r,n);case Ko:return new o;case Jo:case Qo:return new o(r);case Zo:return _e(r);case $o:return new o;case ri:return Le(r)}}var Ie=mi;function hi(r){return typeof r.constructor=="function"&&!bo(r)?ee(V(r)):{}}var cr=hi;var gi="[object Map]";function vi(r){return jt(r)&&Sr(r)==gi}var Se=vi;var Ne=Ya&&Ya.isMap,bi=Ne?yo(Ne):Se,Pe=bi;var yi="[object Set]";function wi(r){return jt(r)&&Sr(r)==yi}var ke=wi;var Te=Ya&&Ya.isSet,_i=Te?yo(Te):ke,Ce=_i;var Ei=1,xi=2,Oi=4,Re="[object Arguments]",Ii="[object Array]",Si="[object Boolean]",Ni="[object Date]",Pi="[object Error]",Me="[object Function]",ki="[object GeneratorFunction]",Ti="[object Map]",Ci="[object Number]",je="[object Object]",Ai="[object RegExp]",Ri="[object Set]",Mi="[object String]",ji="[object Symbol]",Bi="[object WeakMap]",Di="[object ArrayBuffer]",Fi="[object DataView]",Gi="[object Float32Array]",Xi="[object Float64Array]",Ui="[object Int8Array]",Vi="[object Int16Array]",Yi="[object Int32Array]",zi="[object Uint8Array]",Wi="[object Uint8ClampedArray]",qi="[object Uint16Array]",Hi="[object Uint32Array]",x={};x[Re]=x[Ii]=x[Di]=x[Fi]=x[Si]=x[Ni]=x[Gi]=x[Xi]=x[Ui]=x[Vi]=x[Yi]=x[Ti]=x[Ci]=x[je]=x[Ai]=x[Ri]=x[Mi]=x[ji]=x[zi]=x[Wi]=x[qi]=x[Hi]=!0;x[Pi]=x[Me]=x[Bi]=!1;function lr(r,e,n,o,i,a){var f,s=e&Ei,u=e&xi,d=e&Oi;if(n)f=i?n(r,o,i,a):n(r);if(f!==void 0)return f;if(!vt(r))return r;var c=ve(r);if(c){if(f=ye(r),!s)return ir(r,f)}else{var m=Sr(r),h=m==Me||m==ki;if(na(r))return Z(r,s);if(m==je||m==Re||h&&!i){if(f=u||h?{}:cr(r),!s)return u?ge(r,de(f,r)):he(r,ue(f,r))}else{if(!x[m])return i?r:{};f=Ie(r,m,s)}}a||(a=new Za);var b=a.get(r);if(b)return b;if(a.set(r,f),Ce(r))r.forEach(function(g){f.add(lr(g,e,n,g,r,a))});else if(Pe(r))r.forEach(function(g,_){f.set(_,lr(g,e,n,_,r,a))});var w=d?u?be:uu:u?L:Rt,y=c?void 0:w(r);return hd(y||r,function(g,_){if(y)_=g,g=r[_];M(f,_,lr(g,e,n,_,r,a))}),f}var Be=lr;var Ki=1,Ji=4;function Zi(r){return Be(r,Ki|Ji)}var De=Zi;var $i=function(){return Nt.Date.now()},wr=$i;var Fe=Object.prototype,Qi=Fe.hasOwnProperty,ra=ho(function(r,e){r=Object(r);var n=-1,o=e.length,i=o>2?e[2]:void 0;if(i&&T(e[0],e[1],i))o=1;while(++n<o){var a=e[n],f=L(a),s=-1,u=f.length;while(++s<u){var d=f[s],c=r[d];if(c===void 0||ta(c,Fe[d])&&!Qi.call(r,d))r[d]=a[d]}}return r}),Ge=ra;function ea(r,e,n){if(n!==void 0&&!ta(r[e],n)||n===void 0&&!(e in r))R(r,e,n)}var Q=ea;function ia(r,e){if(e==="constructor"&&typeof r[e]==="function")return;if(e=="__proto__")return;return r[e]}var rr=ia;function aa(r){return P(r,L(r))}var Xe=aa;function fa(r,e,n,o,i,a,f){var s=rr(r,n),u=rr(e,n),d=f.get(u);if(d){Q(r,n,d);return}var c=a?a(s,u,n+"",r,e,f):void 0,m=c===void 0;if(m){var h=ve(u),b=!h&&na(u),w=!h&&!b&&vo(u);if(c=u,h||b||w)if(ve(s))c=s;else if(_d(s))c=ir(s);else if(b)m=!1,c=Z(u,!0);else if(w)m=!1,c=ur(u,!0);else c=[];else if(fe(u)||Qa(u)){if(c=s,Qa(s))c=Xe(s);else if(!vt(s)||Va(s))c=cr(u)}else m=!1}if(m)f.set(u,c),i(c,u,o,a,f),f.delete(u);Q(r,n,c)}var Ue=fa;function Ve(r,e,n,o,i){if(r===e)return;kl(e,function(a,f){if(i||(i=new Za),vt(a))Ue(r,e,f,n,Ve,o,i);else{var s=o?o(rr(r,f),a,f+"",r,e,i):void 0;if(s===void 0)s=a;Q(r,f,s)}},L)}var Ye=Ve;function sa(r){var e=r==null?0:r.length;return e?r[e-1]:void 0}var G=sa;function ua(r){return function(e,n,o){var i=Object(e);if(!pn(e)){var a=Pn(n,3);e=Rt(e),n=function(s){return a(i[s],s,i)}}var f=r(e,n,o);return f>-1?i[a?e[f]:f]:void 0}}var ze=ua;var da=Math.max;function ca(r,e,n){var o=r==null?0:r.length;if(!o)return-1;var i=n==null?0:Qr(n);if(i<0)i=da(o+i,0);return bd(r,Pn(e,3),i)}var We=ca;var pa=ze(We),er=pa;function ma(r,e){var n=-1,o=pn(r)?Array(r.length):[];return wo(r,function(i,a,f){o[++n]=e(i,a,f)}),o}var mr=ma;function ha(r,e){var n=ve(r)?Ka:mr;return n(r,Pn(e,3))}var E=ha;function ga(r,e){return r==null?r:kl(r,wl(e),L)}var qe=ga;function va(r,e){return r&&xl(r,wl(e))}var He=va;function ba(r,e){return r>e}var Ke=ba;var ya=Object.prototype,wa=ya.hasOwnProperty;function _a(r,e){return r!=null&&wa.call(r,e)}var Je=_a;function Ea(r,e){return r!=null&&Ed(r,e,Je)}var hr=Ea;var xa="[object String]";function Oa(r){return typeof r=="string"||!ve(r)&&jt(r)&&Zn(r)==xa}var Ze=Oa;function La(r,e){return r<e}var gr=La;function Ia(r,e){var n={};return e=Pn(e,3),xl(r,function(o,i,a){R(n,i,e(o,i,a))}),n}var z=Ia;function Sa(r,e,n){var o=-1,i=r.length;while(++o<i){var a=r[o],f=e(a);if(f!=null&&(s===void 0?f===f&&!_r(f):n(f,s)))var s=f,u=a}return u}var W=Sa;function Na(r){return r&&r.length?W(r,dr,Ke):void 0}var I=Na;var Pa=te(function(r,e,n){Ye(r,e,n)}),tr=Pa;function ka(r){return r&&r.length?W(r,dr,gr):void 0}var j=ka;function Ta(r,e){return r&&r.length?W(r,Pn(e,2),gr):void 0}var H=Ta;function Ca(r,e,n,o){if(!vt(r))return r;e=ko(e,r);var i=-1,a=e.length,f=a-1,s=r;while(s!=null&&++i<a){var u=Ja(e[i]),d=n;if(u==="__proto__"||u==="constructor"||u==="prototype")return r;if(i!=f){var c=s[u];if(d=o?o(c,u,s):void 0,d===void 0)d=vt(c)?c:Ao(e[i+1])?[]:{}}M(s,u,d),s=s[u]}return r}var $e=Ca;function Aa(r,e,n){var o=-1,i=e.length,a={};while(++o<i){var f=e[o],s=xo(r,f);if(n(s,f))$e(a,ko(f,r),s)}return a}var Qe=Aa;function Ra(r,e){var n=r.length;r.sort(e);while(n--)r[n]=r[n].value;return r}var rt=Ra;function Ma(r,e){if(r!==e){var n=r!==void 0,o=r===null,i=r===r,a=_r(r),f=e!==void 0,s=e===null,u=e===e,d=_r(e);if(!s&&!d&&!a&&r>e||a&&f&&u&&!s&&!d||o&&f&&u||!n&&u||!i)return 1;if(!o&&!a&&!d&&r<e||d&&n&&i&&!o&&!a||s&&n&&i||!f&&i||!u)return-1}return 0}var et=Ma;function ja(r,e,n){var o=-1,i=r.criteria,a=e.criteria,f=i.length,s=n.length;while(++o<f){var u=et(i[o],a[o]);if(u){if(o>=s)return u;var d=n[o];return u*(d=="desc"?-1:1)}}return r.index-e.index}var tt=ja;function Ba(r,e,n){if(e.length)e=Ka(e,function(a){if(ve(a))return function(f){return xo(f,a.length===1?a[0]:a)};return a});else e=[dr];var o=-1;e=Ka(e,yo(Pn));var i=mr(r,function(a,f,s){var u=Ka(e,function(d){return d(a)});return{criteria:u,index:++o,value:a}});return rt(i,function(a,f){return tt(a,f,n)})}var nt=Ba;var Da=Id("length"),ot=Da;var at="\\ud800-\\udfff",Fa="\\u0300-\\u036f",Ga="\\ufe20-\\ufe2f",Ua="\\u20d0-\\u20ff",za=Fa+Ga+Ua,Wa="\\ufe0e\\ufe0f",qa="["+at+"]",Er="["+za+"]",xr="\\ud83c[\\udffb-\\udfff]",Ha="(?:"+Er+"|"+xr+")",ft="[^"+at+"]",st="(?:\\ud83c[\\udde6-\\uddff]){2}",ut="[\\ud800-\\udbff][\\udc00-\\udfff]",$a="\\u200d",dt=Ha+"?",ct="["+Wa+"]?",rf="(?:"+$a+"(?:"+[ft,st,ut].join("|")+")"+ct+dt+")*",ef=ct+dt+rf,tf="(?:"+[ft+Er+"?",Er,st,ut,qa].join("|")+")",it=RegExp(xr+"(?="+xr+")|"+tf+ef,"g");function nf(r){var e=it.lastIndex=0;while(it.test(r))++e;return e}var pt=nf;function of(r){return se(r)?pt(r):ot(r)}var lt=of;function af(r,e){return Qe(r,e,function(n,o){return Bd(r,o)})}var mt=af;var ff=ie(function(r,e){return r==null?{}:mt(r,e)}),K=ff;var{ceil:sf,max:uf}=Math;function df(r,e,n,o){var i=-1,a=uf(sf((e-r)/(n||1)),0),f=Array(a);while(a--)f[o?a:++i]=r,r+=n;return f}var ht=df;function cf(r){return function(e,n,o){if(o&&typeof o!="number"&&T(e,n,o))n=o=void 0;if(e=U(e),n===void 0)n=e,e=0;else n=U(n);return o=o===void 0?e<n?1:-1:U(o),ht(e,n,o,r)}}var gt=cf;var pf=gt(),N=pf;var lf="[object Map]",mf="[object Set]";function hf(r){if(r==null)return 0;if(pn(r))return Ze(r)?lt(r):r.length;var e=Sr(r);if(e==lf||e==mf)return r.size;return gl(r).length}var bt=hf;var gf=ho(function(r,e){if(r==null)return[];var n=e.length;if(n>1&&T(r,e[0],e[1]))e=[];else if(n>2&&T(e[0],e[1],e[2]))e=[e[0]];return nt(r,bl(e,1),[])}),C=gf;var vf=0;function bf(r){var e=++vf;return xd(r)+e}var J=bf;function yf(r,e,n){var o=-1,i=r.length,a=e.length,f={};while(++o<i){var s=o<a?e[o]:void 0;n(f,r[o],s)}return f}var yt=yf;function wf(r,e){return yt(r||[],e||[],M)}var Or=wf;class Lr{constructor(){var r={};r._next=r._prev=r,this._sentinel=r}dequeue(){var r=this._sentinel,e=r._prev;if(e!==r)return wt(e),e}enqueue(r){var e=this._sentinel;if(r._prev&&r._next)wt(r);r._next=e._next,e._next._prev=r,e._next=r,r._prev=e}toString(){var r=[],e=this._sentinel,n=e._prev;while(n!==e)r.push(JSON.stringify(n,_f)),n=n._prev;return"["+r.join(", ")+"]"}}function wt(r){r._prev._next=r._next,r._next._prev=r._prev,delete r._next,delete r._prev}function _f(r,e){if(r!=="_next"&&r!=="_prev")return e}var Ef=pr(1);function _t(r,e){if(r.nodeCount()<=1)return[];var n=Of(r,e||Ef),o=xf(n.graph,n.buckets,n.zeroIdx);return S(E(o,function(i){return r.outEdges(i.v,i.w)}))}function xf(r,e,n){var o=[],i=e[e.length-1],a=e[0],f;while(r.nodeCount()){while(f=a.dequeue())Ir(r,e,n,f);while(f=i.dequeue())Ir(r,e,n,f);if(r.nodeCount()){for(var s=e.length-2;s>0;--s)if(f=e[s].dequeue(),f){o=o.concat(Ir(r,e,n,f,!0));break}}}return o}function Ir(r,e,n,o,i){var a=i?[]:void 0;return v(r.inEdges(o.v),function(f){var s=r.edge(f),u=r.node(f.v);if(i)a.push({v:f.v,w:f.w});u.out-=s,Nr(e,n,u)}),v(r.outEdges(o.v),function(f){var s=r.edge(f),u=f.w,d=r.node(u);d.in-=s,Nr(e,n,d)}),r.removeNode(o.v),a}function Of(r,e){var n=new Oe,o=0,i=0;v(r.nodes(),function(s){n.setNode(s,{v:s,in:0,out:0})}),v(r.edges(),function(s){var u=n.edge(s.v,s.w)||0,d=e(s),c=u+d;n.setEdge(s.v,s.w,c),i=Math.max(i,n.node(s.v).out+=d),o=Math.max(o,n.node(s.w).in+=d)});var a=N(i+o+3).map(function(){return new Lr}),f=o+1;return v(n.nodes(),function(s){Nr(a,f,n.node(s))}),{graph:n,buckets:a,zeroIdx:f}}function Nr(r,e,n){if(!n.out)r[0].enqueue(n);else if(!n.in)r[r.length-1].enqueue(n);else r[n.out-n.in+e].enqueue(n)}function Et(r){var e=r.graph().acyclicer==="greedy"?_t(r,n(r)):Lf(r);v(e,function(o){var i=r.edge(o);r.removeEdge(o),i.forwardName=o.name,i.reversed=!0,r.setEdge(o.w,o.v,i,J("rev"))});function n(o){return function(i){return o.edge(i).weight}}}function Lf(r){var e=[],n={},o={};function i(a){if(Object.prototype.hasOwnProperty.call(o,a))return;o[a]=!0,n[a]=!0,v(r.outEdges(a),function(f){if(Object.prototype.hasOwnProperty.call(n,f.w))e.push(f);else i(f.w)}),delete n[a]}return v(r.nodes(),i),e}function xt(r){v(r.edges(),function(e){var n=r.edge(e);if(n.reversed){r.removeEdge(e);var o=n.forwardName;delete n.reversed,delete n.forwardName,r.setEdge(e.w,e.v,n,o)}})}function k(r,e,n,o){var i;do i=J(o);while(r.hasNode(i));return n.dummy=e,r.setNode(i,n),i}function Lt(r){var e=new Oe().setGraph(r.graph());return v(r.nodes(),function(n){e.setNode(n,r.node(n))}),v(r.edges(),function(n){var o=e.edge(n.v,n.w)||{weight:0,minlen:1},i=r.edge(n);e.setEdge(n.v,n.w,{weight:o.weight+i.weight,minlen:Math.max(o.minlen,i.minlen)})}),e}function vr(r){var e=new Oe({multigraph:r.isMultigraph()}).setGraph(r.graph());return v(r.nodes(),function(n){if(!r.children(n).length)e.setNode(n,r.node(n))}),v(r.edges(),function(n){e.setEdge(n,r.edge(n))}),e}function Pr(r,e){var{x:n,y:o}=r,i=e.x-n,a=e.y-o,f=r.width/2,s=r.height/2;if(!i&&!a)throw Error("Not possible to find intersection inside of the rectangle");var u,d;if(Math.abs(a)*f>Math.abs(i)*s){if(a<0)s=-s;u=s*i/a,d=s}else{if(i<0)f=-f;u=f,d=f*a/i}return{x:n+u,y:o+d}}function B(r){var e=E(N(Cr(r)+1),function(){return[]});return v(r.nodes(),function(n){var o=r.node(n),i=o.rank;if(!Ft(i))e[i][o.order]=n}),e}function It(r){var e=j(E(r.nodes(),function(n){return r.node(n).rank}));v(r.nodes(),function(n){var o=r.node(n);if(hr(o,"rank"))o.rank-=e})}function St(r){var e=j(E(r.nodes(),function(a){return r.node(a).rank})),n=[];v(r.nodes(),function(a){var f=r.node(a).rank-e;if(!n[f])n[f]=[];n[f].push(a)});var o=0,i=r.graph().nodeRankFactor;v(n,function(a,f){if(Ft(a)&&f%i!==0)--o;else if(o)v(a,function(s){r.node(s).rank+=o})})}function kr(r,e,n,o){var i={width:0,height:0};if(arguments.length>=4)i.rank=n,i.order=o;return k(r,"border",i,e)}function Cr(r){return I(E(r.nodes(),function(e){var n=r.node(e).rank;if(!Ft(n))return n}))}function Pt(r,e){var n={lhs:[],rhs:[]};return v(r,function(o){if(e(o))n.lhs.push(o);else n.rhs.push(o)}),n}function kt(r,e){var n=wr();try{return e()}finally{console.log(r+" time: "+(wr()-n)+"ms")}}function Tt(r,e){return e()}function At(r){function e(n){var o=r.children(n),i=r.node(n);if(o.length)v(o,e);if(Object.prototype.hasOwnProperty.call(i,"minRank")){i.borderLeft=[],i.borderRight=[];for(var a=i.minRank,f=i.maxRank+1;a<f;++a)Ct(r,"borderLeft","_bl",n,i,a),Ct(r,"borderRight","_br",n,i,a)}}v(r.children(),e)}function Ct(r,e,n,o,i,a){var f={width:0,height:0,rank:a,borderType:e},s=i[e][a-1],u=k(r,"border",f,n);if(i[e][a]=u,r.setParent(u,o),s)r.setEdge(s,u,{weight:1})}function Bt(r){var e=r.graph().rankdir.toLowerCase();if(e==="lr"||e==="rl")Gt(r)}function Dt(r){var e=r.graph().rankdir.toLowerCase();if(e==="bt"||e==="rl")If(r);if(e==="lr"||e==="rl")Sf(r),Gt(r)}function Gt(r){v(r.nodes(),function(e){Mt(r.node(e))}),v(r.edges(),function(e){Mt(r.edge(e))})}function Mt(r){var e=r.width;r.width=r.height,r.height=e}function If(r){v(r.nodes(),function(e){Ar(r.node(e))}),v(r.edges(),function(e){var n=r.edge(e);if(v(n.points,Ar),Object.prototype.hasOwnProperty.call(n,"y"))Ar(n)})}function Ar(r){r.y=-r.y}function Sf(r){v(r.nodes(),function(e){Rr(r.node(e))}),v(r.edges(),function(e){var n=r.edge(e);if(v(n.points,Rr),Object.prototype.hasOwnProperty.call(n,"x"))Rr(n)})}function Rr(r){var e=r.x;r.x=r.y,r.y=e}function Xt(r){r.graph().dummyChains=[],v(r.edges(),function(e){Pf(r,e)})}function Pf(r,e){var n=e.v,o=r.node(n).rank,i=e.w,a=r.node(i).rank,f=e.name,s=r.edge(e),u=s.labelRank;if(a===o+1)return;r.removeEdge(e);var d=void 0,c,m;for(m=0,++o;o<a;++m,++o){if(s.points=[],d={width:0,height:0,edgeLabel:s,edgeObj:e,rank:o},c=k(r,"edge",d,"_d"),o===u)d.width=s.width,d.height=s.height,d.dummy="edge-label",d.labelpos=s.labelpos;if(r.setEdge(n,c,{weight:s.weight},f),m===0)r.graph().dummyChains.push(c);n=c}r.setEdge(n,i,{weight:s.weight},f)}function Ut(r){v(r.graph().dummyChains,function(e){var n=r.node(e),o=n.edgeLabel,i;r.setEdge(n.edgeObj,o);while(n.dummy){if(i=r.successors(e)[0],r.removeNode(e),o.points.push({x:n.x,y:n.y}),n.dummy==="edge-label")o.x=n.x,o.y=n.y,o.width=n.width,o.height=n.height;e=i,n=r.node(e)}})}function nr(r){var e={};function n(o){var i=r.node(o);if(Object.prototype.hasOwnProperty.call(e,o))return i.rank;e[o]=!0;var a=j(E(r.outEdges(o),function(f){return n(f.w)-r.edge(f).minlen}));if(a===Number.POSITIVE_INFINITY||a===void 0||a===null)a=0;return i.rank=a}v(r.sources(),n)}function X(r,e){return r.node(e.w).rank-r.node(e.v).rank-r.edge(e).minlen}function br(r){var e=new Oe({directed:!1}),n=r.nodes()[0],o=r.nodeCount();e.setNode(n,{});var i,a;while(kf(e,r)<o)i=Tf(e,r),a=e.hasNode(i.v)?X(r,i):-X(r,i),Cf(e,r,a);return e}function kf(r,e){function n(o){v(e.nodeEdges(o),function(i){var a=i.v,f=o===a?i.w:a;if(!r.hasNode(f)&&!X(e,i))r.setNode(f,{}),r.setEdge(o,f,{}),n(f)})}return v(r.nodes(),n),r.nodeCount()}function Tf(r,e){return H(e.edges(),function(n){if(r.hasNode(n.v)!==r.hasNode(n.w))return X(e,n)})}function Cf(r,e,n){v(r.nodes(),function(o){e.node(o).rank+=n})}var fh=pr(1);var mh=pr(1);jr.CycleException=or;function jr(r){var e={},n={},o=[];function i(a){if(Object.prototype.hasOwnProperty.call(n,a))throw new or;if(!Object.prototype.hasOwnProperty.call(e,a))n[a]=!0,e[a]=!0,v(r.predecessors(a),i),delete n[a],o.push(a)}if(v(r.sinks(),i),bt(e)!==r.nodeCount())throw new or;return o}function or(){}or.prototype=Error();function yr(r,e,n){if(!ve(e))e=[e];var o=(r.isDirected()?r.successors:r.neighbors).bind(r),i=[],a={};return v(e,function(f){if(!r.hasNode(f))throw Error("Graph does not have node: "+f);Yt(r,f,n==="post",a,o,i)}),i}function Yt(r,e,n,o,i,a){if(!Object.prototype.hasOwnProperty.call(o,e)){if(o[e]=!0,!n)a.push(e);if(v(i(e),function(f){Yt(r,f,n,o,i,a)}),n)a.push(e)}}function Br(r,e){return yr(r,e,"post")}function Dr(r,e){return yr(r,e,"pre")}F.initLowLimValues=Gr;F.initCutValues=Fr;F.calcCutValue=Wt;F.leaveEdge=Ht;F.enterEdge=Kt;F.exchangeEdges=Jt;function F(r){r=Lt(r),nr(r);var e=br(r);Gr(e),Fr(e,r);var n,o;while(n=Ht(e))o=Kt(e,r,n),Jt(e,r,n,o)}function Fr(r,e){var n=Br(r,r.nodes());n=n.slice(0,n.length-1),v(n,function(o){Bf(r,e,o)})}function Bf(r,e,n){var o=r.node(n),i=o.parent;r.edge(n,i).cutvalue=Wt(r,e,n)}function Wt(r,e,n){var o=r.node(n),i=o.parent,a=!0,f=e.edge(n,i),s=0;if(!f)a=!1,f=e.edge(i,n);return s=f.weight,v(e.nodeEdges(n),function(u){var d=u.v===n,c=d?u.w:u.v;if(c!==i){var m=d===a,h=e.edge(u).weight;if(s+=m?h:-h,Ff(r,n,c)){var b=r.edge(n,c).cutvalue;s+=m?-b:b}}}),s}function Gr(r,e){if(arguments.length<2)e=r.nodes()[0];qt(r,{},1,e)}function qt(r,e,n,o,i){var a=n,f=r.node(o);if(e[o]=!0,v(r.neighbors(o),function(s){if(!Object.prototype.hasOwnProperty.call(e,s))n=qt(r,e,n,s,o)}),f.low=a,f.lim=n++,i)f.parent=i;else delete f.parent;return n}function Ht(r){return er(r.edges(),function(e){return r.edge(e).cutvalue<0})}function Kt(r,e,n){var{v:o,w:i}=n;if(!e.hasEdge(o,i))o=n.w,i=n.v;var a=r.node(o),f=r.node(i),s=a,u=!1;if(a.lim>f.lim)s=f,u=!0;var d=Xn(e.edges(),function(c){return u===zt(r,r.node(c.v),s)&&u!==zt(r,r.node(c.w),s)});return H(d,function(c){return X(e,c)})}function Jt(r,e,n,o){var{v:i,w:a}=n;r.removeEdge(i,a),r.setEdge(o.v,o.w,{}),Gr(r),Fr(r,e),Df(r,e)}function Df(r,e){var n=er(r.nodes(),function(i){return!e.node(i).parent}),o=Dr(r,n);o=o.slice(1),v(o,function(i){var a=r.node(i).parent,f=e.edge(i,a),s=!1;if(!f)f=e.edge(a,i),s=!0;e.node(i).rank=e.node(a).rank+(s?f.minlen:-f.minlen)})}function Ff(r,e,n){return r.hasEdge(e,n)}function zt(r,e,n){return n.low<=e.lim&&e.lim<=n.lim}function Xr(r){switch(r.graph().ranker){case"network-simplex":Zt(r);break;case"tight-tree":Xf(r);break;case"longest-path":Gf(r);break;default:Zt(r)}}var Gf=nr;function Xf(r){nr(r),br(r)}function Zt(r){F(r)}function $t(r){var e=k(r,"root",{},"_root"),n=Uf(r),o=I(Tr(n))-1,i=2*o+1;r.graph().nestingRoot=e,v(r.edges(),function(f){r.edge(f).minlen*=i});var a=Vf(r)+1;v(r.children(),function(f){Qt(r,e,i,a,o,n,f)}),r.graph().nodeRankFactor=i}function Qt(r,e,n,o,i,a,f){var s=r.children(f);if(!s.length){if(f!==e)r.setEdge(e,f,{weight:0,minlen:n});return}var u=kr(r,"_bt"),d=kr(r,"_bb"),c=r.node(f);if(r.setParent(u,f),c.borderTop=u,r.setParent(d,f),c.borderBottom=d,v(s,function(m){Qt(r,e,n,o,i,a,m);var h=r.node(m),b=h.borderTop?h.borderTop:m,w=h.borderBottom?h.borderBottom:m,y=h.borderTop?o:2*o,g=b!==w?1:i-a[f]+1;r.setEdge(u,b,{weight:y,minlen:g,nestingEdge:!0}),r.setEdge(w,d,{weight:y,minlen:g,nestingEdge:!0})}),!r.parent(f))r.setEdge(e,u,{weight:0,minlen:i+a[f]})}function Uf(r){var e={};function n(o,i){var a=r.children(o);if(a&&a.length)v(a,function(f){n(f,i+1)});e[o]=i}return v(r.children(),function(o){n(o,1)}),e}function Vf(r){return Xa(r.edges(),function(e,n){return e+r.edge(n).weight},0)}function rn(r){var e=r.graph();r.removeNode(e.nestingRoot),delete e.nestingRoot,v(r.edges(),function(n){var o=r.edge(n);if(o.nestingEdge)r.removeEdge(n)})}function en(r,e,n){var o={},i;v(n,function(a){var f=r.parent(a),s,u;while(f){if(s=r.parent(f),s)u=o[s],o[s]=f;else u=i,i=f;if(u&&u!==f){e.setEdge(u,f);return}f=s}})}function tn(r,e,n){var o=zf(r),i=new Oe({compound:!0}).setGraph({root:o}).setDefaultNodeLabel(function(a){return r.node(a)});return v(r.nodes(),function(a){var f=r.node(a),s=r.parent(a);if(f.rank===e||f.minRank<=e&&e<=f.maxRank){if(i.setNode(a),i.setParent(a,s||o),v(r[n](a),function(u){var d=u.v===a?u.w:u.v,c=i.edge(d,a),m=!Ft(c)?c.weight:0;i.setEdge(d,a,{weight:r.edge(u).weight+m})}),Object.prototype.hasOwnProperty.call(f,"minRank"))i.setNode(a,{borderLeft:f.borderLeft[e],borderRight:f.borderRight[e]})}}),i}function zf(r){var e;while(r.hasNode(e=J("_root")));return e}function nn(r,e){var n=0;for(var o=1;o<e.length;++o)n+=Wf(r,e[o-1],e[o]);return n}function Wf(r,e,n){var o=Or(n,E(n,function(d,c){return c})),i=S(E(e,function(d){return C(E(r.outEdges(d),function(c){return{pos:o[c.w],weight:r.edge(c).weight}}),"pos")})),a=1;while(a<n.length)a<<=1;var f=2*a-1;a-=1;var s=E(Array(f),function(){return 0}),u=0;return v(i.forEach(function(d){var c=d.pos+a;s[c]+=d.weight;var m=0;while(c>0){if(c%2)m+=s[c+1];c=c-1>>1,s[c]+=d.weight}u+=d.weight*m})),u}function on(r){var e={},n=Xn(r.nodes(),function(s){return!r.children(s).length}),o=I(E(n,function(s){return r.node(s).rank})),i=E(N(o+1),function(){return[]});function a(s){if(hr(e,s))return;e[s]=!0;var u=r.node(s);i[u.rank].push(s),v(r.successors(s),a)}var f=C(n,function(s){return r.node(s).rank});return v(f,a),i}function an(r,e){return E(e,function(n){var o=r.inEdges(n);if(!o.length)return{v:n};else{var i=Xa(o,function(a,f){var s=r.edge(f),u=r.node(f.v);return{sum:a.sum+s.weight*u.order,weight:a.weight+s.weight}},{sum:0,weight:0});return{v:n,barycenter:i.sum/i.weight,weight:i.weight}}})}function fn(r,e){var n={};v(r,function(i,a){var f=n[i.v]={indegree:0,in:[],out:[],vs:[i.v],i:a};if(!Ft(i.barycenter))f.barycenter=i.barycenter,f.weight=i.weight}),v(e.edges(),function(i){var a=n[i.v],f=n[i.w];if(!Ft(a)&&!Ft(f))f.indegree++,a.out.push(n[i.w])});var o=Xn(n,function(i){return!i.indegree});return qf(o)}function qf(r){var e=[];function n(a){return function(f){if(f.merged)return;if(Ft(f.barycenter)||Ft(a.barycenter)||f.barycenter>=a.barycenter)Hf(a,f)}}function o(a){return function(f){if(f.in.push(a),--f.indegree===0)r.push(f)}}while(r.length){var i=r.pop();e.push(i),v(i.in.reverse(),n(i)),v(i.out,o(i))}return E(Xn(e,function(a){return!a.merged}),function(a){return K(a,["vs","i","barycenter","weight"])})}function Hf(r,e){var n=0,o=0;if(r.weight)n+=r.barycenter*r.weight,o+=r.weight;if(e.weight)n+=e.barycenter*e.weight,o+=e.weight;r.vs=e.vs.concat(r.vs),r.barycenter=n/o,r.weight=o,r.i=Math.min(e.i,r.i),e.merged=!0}function cn(r,e){var n=Pt(r,function(c){return Object.prototype.hasOwnProperty.call(c,"barycenter")}),o=n.lhs,i=C(n.rhs,function(c){return-c.i}),a=[],f=0,s=0,u=0;o.sort(Kf(!!e)),u=sn(a,i,u),v(o,function(c){u+=c.vs.length,a.push(c.vs),f+=c.barycenter*c.weight,s+=c.weight,u=sn(a,i,u)});var d={vs:S(a)};if(s)d.barycenter=f/s,d.weight=s;return d}function sn(r,e,n){var o;while(e.length&&(o=G(e)).i<=n)e.pop(),r.push(o.vs),n++;return n}function Kf(r){return function(e,n){if(e.barycenter<n.barycenter)return-1;else if(e.barycenter>n.barycenter)return 1;return!r?e.i-n.i:n.i-e.i}}function Ur(r,e,n,o){var i=r.children(e),a=r.node(e),f=a?a.borderLeft:void 0,s=a?a.borderRight:void 0,u={};if(f)i=Xn(i,function(w){return w!==f&&w!==s});var d=an(r,i);v(d,function(w){if(r.children(w.v).length){var y=Ur(r,w.v,n,o);if(u[w.v]=y,Object.prototype.hasOwnProperty.call(y,"barycenter"))Zf(w,y)}});var c=fn(d,n);Jf(c,u);var m=cn(c,o);if(f){if(m.vs=S([f,m.vs,s]),r.predecessors(f).length){var h=r.node(r.predecessors(f)[0]),b=r.node(r.predecessors(s)[0]);if(!Object.prototype.hasOwnProperty.call(m,"barycenter"))m.barycenter=0,m.weight=0;m.barycenter=(m.barycenter*m.weight+h.order+b.order)/(m.weight+2),m.weight+=2}}return m}function Jf(r,e){v(r,function(n){n.vs=S(n.vs.map(function(o){if(e[o])return e[o].vs;return o}))})}function Zf(r,e){if(!Ft(r.barycenter))r.barycenter=(r.barycenter*r.weight+e.barycenter*e.weight)/(r.weight+e.weight),r.weight+=e.weight;else r.barycenter=e.barycenter,r.weight=e.weight}function hn(r){var e=Cr(r),n=ln(r,N(1,e+1),"inEdges"),o=ln(r,N(e-1,-1,-1),"outEdges"),i=on(r);mn(r,i);var a=Number.POSITIVE_INFINITY,f;for(var s=0,u=0;u<4;++s,++u){$f(s%2?n:o,s%4>=2),i=B(r);var d=nn(r,i);if(d<a)u=0,f=De(i),a=d}mn(r,f)}function ln(r,e,n){return E(e,function(o){return tn(r,o,n)})}function $f(r,e){var n=new Oe;v(r,function(o){var i=o.graph().root,a=Ur(o,i,n,e);v(a.vs,function(f,s){o.node(f).order=s}),en(o,n,a.vs)})}function mn(r,e){v(e,function(n){v(n,function(o,i){r.node(o).order=i})})}function gn(r){var e=rs(r);v(r.graph().dummyChains,function(n){var o=r.node(n),i=o.edgeObj,a=Qf(r,e,i.v,i.w),{path:f,lca:s}=a,u=0,d=f[u],c=!0;while(n!==i.w){if(o=r.node(n),c){while((d=f[u])!==s&&r.node(d).maxRank<o.rank)u++;if(d===s)c=!1}if(!c){while(u<f.length-1&&r.node(d=f[u+1]).minRank<=o.rank)u++;d=f[u]}r.setParent(n,d),n=r.successors(n)[0]}})}function Qf(r,e,n,o){var i=[],a=[],f=Math.min(e[n].low,e[o].low),s=Math.max(e[n].lim,e[o].lim),u,d;u=n;do u=r.parent(u),i.push(u);while(u&&(e[u].low>f||s>e[u].lim));d=u,u=o;while((u=r.parent(u))!==d)a.push(u);return{path:i.concat(a.reverse()),lca:d}}function rs(r){var e={},n=0;function o(i){var a=n;v(r.children(i),o),e[i]={low:a,lim:n++}}return v(r.children(),o),e}function es(r,e){var n={};function o(i,a){var f=0,s=0,u=i.length,d=G(a);return v(a,function(c,m){var h=ns(r,c),b=h?r.node(h).order:u;if(h||c===d)v(a.slice(s,m+1),function(w){v(r.predecessors(w),function(y){var g=r.node(y),_=g.order;if((_<f||b<_)&&!(g.dummy&&r.node(w).dummy))vn(n,y,w)})}),s=m+1,f=b}),a}return Xa(e,o),n}function ts(r,e){var n={};function o(a,f,s,u,d){var c;v(N(f,s),function(m){if(c=a[m],r.node(c).dummy)v(r.predecessors(c),function(h){var b=r.node(h);if(b.dummy&&(b.order<u||b.order>d))vn(n,h,c)})})}function i(a,f){var s=-1,u,d=0;return v(f,function(c,m){if(r.node(c).dummy==="border"){var h=r.predecessors(c);if(h.length)u=r.node(h[0]).order,o(f,d,m,s,u),d=m,s=u}o(f,d,f.length,u,a.length)}),f}return Xa(e,i),n}function ns(r,e){if(r.node(e).dummy)return er(r.predecessors(e),function(n){return r.node(n).dummy})}function vn(r,e,n){if(e>n){var o=e;e=n,n=o}if(!Object.prototype.hasOwnProperty.call(r,e))Object.defineProperty(r,e,{enumerable:!0,configurable:!0,value:{},writable:!0});var i=r[e];Object.defineProperty(i,n,{enumerable:!0,configurable:!0,value:!0,writable:!0})}function os(r,e,n){if(e>n){var o=e;e=n,n=o}return!!r[e]&&Object.prototype.hasOwnProperty.call(r[e],n)}function is(r,e,n,o){var i={},a={},f={};return v(e,function(s){v(s,function(u,d){i[u]=u,a[u]=u,f[u]=d})}),v(e,function(s){var u=-1;v(s,function(d){var c=o(d);if(c.length){c=C(c,function(y){return f[y]});var m=(c.length-1)/2;for(var h=Math.floor(m),b=Math.ceil(m);h<=b;++h){var w=c[h];if(a[d]===d&&u<f[w]&&!os(n,d,w))a[w]=d,a[d]=i[d]=i[w],u=f[w]}}})}),{root:i,align:a}}function as(r,e,n,o,i){var a={},f=fs(r,e,n,i),s=i?"borderLeft":"borderRight";function u(m,h){var b=f.nodes(),w=b.pop(),y={};while(w){if(y[w])m(w);else y[w]=!0,b.push(w),b=b.concat(h(w));w=b.pop()}}function d(m){a[m]=f.inEdges(m).reduce(function(h,b){return Math.max(h,a[b.v]+f.edge(b))},0)}function c(m){var h=f.outEdges(m).reduce(function(w,y){return Math.min(w,a[y.w]-f.edge(y))},Number.POSITIVE_INFINITY),b=r.node(m);if(h!==Number.POSITIVE_INFINITY&&b.borderType!==s)a[m]=Math.max(a[m],h)}return u(d,f.predecessors.bind(f)),u(c,f.successors.bind(f)),v(o,function(m){a[m]=a[n[m]]}),a}function fs(r,e,n,o){var i=new Oe,a=r.graph(),f=cs(a.nodesep,a.edgesep,o);return v(e,function(s){var u;v(s,function(d){var c=n[d];if(i.setNode(c),u){var m=n[u],h=i.edge(m,c);i.setEdge(m,c,Math.max(f(r,d,u),h||0))}u=d})}),i}function ss(r,e){return H(Tr(e),function(n){var{NEGATIVE_INFINITY:o,POSITIVE_INFINITY:i}=Number;return qe(n,function(a,f){var s=ps(r,f)/2;o=Math.max(a+s,o),i=Math.min(a-s,i)}),o-i})}function us(r,e){var n=Tr(e),o=j(n),i=I(n);v(["u","d"],function(a){v(["l","r"],function(f){var s=a+f,u=r[s],d;if(u===e)return;var c=Tr(u);if(d=f==="l"?o-j(c):i-I(c),d)r[s]=z(u,function(m){return m+d})})})}function ds(r,e){return z(r.ul,function(n,o){if(e)return r[e.toLowerCase()][o];else{var i=C(E(r,o));return(i[1]+i[2])/2}})}function bn(r){var e=B(r),n=tr(es(r,e),ts(r,e)),o={},i;v(["u","d"],function(f){i=f==="u"?e:Tr(e).reverse(),v(["l","r"],function(s){if(s==="r")i=E(i,function(m){return Tr(m).reverse()});var u=(f==="u"?r.predecessors:r.successors).bind(r),d=is(r,i,n,u),c=as(r,i,d.root,d.align,s==="r");if(s==="r")c=z(c,function(m){return-m});o[f+s]=c})});var a=ss(r,o);return us(o,a),ds(o,r.graph().align)}function cs(r,e,n){return function(o,i,a){var f=o.node(i),s=o.node(a),u=0,d;if(u+=f.width/2,Object.prototype.hasOwnProperty.call(f,"labelpos"))switch(f.labelpos.toLowerCase()){case"l":d=-f.width/2;break;case"r":d=f.width/2;break}if(d)u+=n?d:-d;if(d=0,u+=(f.dummy?e:r)/2,u+=(s.dummy?e:r)/2,u+=s.width/2,Object.prototype.hasOwnProperty.call(s,"labelpos"))switch(s.labelpos.toLowerCase()){case"l":d=s.width/2;break;case"r":d=-s.width/2;break}if(d)u+=n?d:-d;return d=0,u}}function ps(r,e){return r.node(e).width}function yn(r){r=vr(r),ls(r),He(bn(r),function(e,n){r.node(n).x=e})}function ls(r){var e=B(r),n=r.graph().ranksep,o=0;v(e,function(i){var a=I(E(i,function(f){return r.node(f).height}));v(i,function(f){r.node(f).y=o+a/2}),o+=a+n})}function zr(r,e){var n=e&&e.debugTiming?kt:Tt;n("layout",()=>{var o=n(" buildLayoutGraph",()=>Os(r));n(" runLayout",()=>ms(o,n)),n(" updateInputGraph",()=>hs(r,o))})}function ms(r,e){e(" makeSpaceForEdgeLabels",()=>Ls(r)),e(" removeSelfEdges",()=>js(r)),e(" acyclic",()=>Et(r)),e(" nestingGraph.run",()=>$t(r)),e(" rank",()=>Xr(vr(r))),e(" injectEdgeLabelProxies",()=>Ss(r)),e(" removeEmptyRanks",()=>St(r)),e(" nestingGraph.cleanup",()=>rn(r)),e(" normalizeRanks",()=>It(r)),e(" assignRankMinMax",()=>Ns(r)),e(" removeEdgeLabelProxies",()=>Ps(r)),e(" normalize.run",()=>Xt(r)),e(" parentDummyChains",()=>gn(r)),e(" addBorderSegments",()=>At(r)),e(" order",()=>hn(r)),e(" insertSelfEdges",()=>Bs(r)),e(" adjustCoordinateSystem",()=>Bt(r)),e(" position",()=>yn(r)),e(" positionSelfEdges",()=>Ds(r)),e(" removeBorderNodes",()=>Ms(r)),e(" normalize.undo",()=>Ut(r)),e(" fixupEdgeLabelCoords",()=>As(r)),e(" undoCoordinateSystem",()=>Dt(r)),e(" translateGraph",()=>Ts(r)),e(" assignNodeIntersects",()=>Cs(r)),e(" reversePoints",()=>Rs(r)),e(" acyclic.undo",()=>xt(r))}function hs(r,e){v(r.nodes(),function(n){var o=r.node(n),i=e.node(n);if(o){if(o.x=i.x,o.y=i.y,e.children(n).length)o.width=i.width,o.height=i.height}}),v(r.edges(),function(n){var o=r.edge(n),i=e.edge(n);if(o.points=i.points,Object.prototype.hasOwnProperty.call(i,"x"))o.x=i.x,o.y=i.y}),r.graph().width=e.graph().width,r.graph().height=e.graph().height}var gs=["nodesep","edgesep","ranksep","marginx","marginy"],vs={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},bs=["acyclicer","ranker","rankdir","align"],ys=["width","height"],ws={width:0,height:0},_s=["minlen","weight","width","height","labeloffset"],Es={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},xs=["labelpos"];function Os(r){var e=new Oe({multigraph:!0,compound:!0}),n=Yr(r.graph());return e.setGraph(tr({},vs,Vr(n,gs),K(n,bs))),v(r.nodes(),function(o){var i=Yr(r.node(o));e.setNode(o,Ge(Vr(i,ys),ws)),e.setParent(o,r.parent(o))}),v(r.edges(),function(o){var i=Yr(r.edge(o));e.setEdge(o,tr({},Es,Vr(i,_s),K(i,xs)))}),e}function Ls(r){var e=r.graph();e.ranksep/=2,v(r.edges(),function(n){var o=r.edge(n);if(o.minlen*=2,o.labelpos.toLowerCase()!=="c")if(e.rankdir==="TB"||e.rankdir==="BT")o.width+=o.labeloffset;else o.height+=o.labeloffset})}function Ss(r){v(r.edges(),function(e){var n=r.edge(e);if(n.width&&n.height){var o=r.node(e.v),i=r.node(e.w),a={rank:(i.rank-o.rank)/2+o.rank,e};k(r,"edge-proxy",a,"_ep")}})}function Ns(r){var e=0;v(r.nodes(),function(n){var o=r.node(n);if(o.borderTop)o.minRank=r.node(o.borderTop).rank,o.maxRank=r.node(o.borderBottom).rank,e=I(e,o.maxRank)}),r.graph().maxRank=e}function Ps(r){v(r.nodes(),function(e){var n=r.node(e);if(n.dummy==="edge-proxy")r.edge(n.e).labelRank=n.rank,r.removeNode(e)})}function Ts(r){var e=Number.POSITIVE_INFINITY,n=0,o=Number.POSITIVE_INFINITY,i=0,a=r.graph(),f=a.marginx||0,s=a.marginy||0;function u(d){var{x:c,y:m,width:h,height:b}=d;e=Math.min(e,c-h/2),n=Math.max(n,c+h/2),o=Math.min(o,m-b/2),i=Math.max(i,m+b/2)}v(r.nodes(),function(d){u(r.node(d))}),v(r.edges(),function(d){var c=r.edge(d);if(Object.prototype.hasOwnProperty.call(c,"x"))u(c)}),e-=f,o-=s,v(r.nodes(),function(d){var c=r.node(d);c.x-=e,c.y-=o}),v(r.edges(),function(d){var c=r.edge(d);if(v(c.points,function(m){m.x-=e,m.y-=o}),Object.prototype.hasOwnProperty.call(c,"x"))c.x-=e;if(Object.prototype.hasOwnProperty.call(c,"y"))c.y-=o}),a.width=n-e+f,a.height=i-o+s}function Cs(r){v(r.edges(),function(e){var n=r.edge(e),o=r.node(e.v),i=r.node(e.w),a,f;if(!n.points)n.points=[],a=i,f=o;else a=n.points[0],f=n.points[n.points.length-1];n.points.unshift(Pr(o,a)),n.points.push(Pr(i,f))})}function As(r){v(r.edges(),function(e){var n=r.edge(e);if(Object.prototype.hasOwnProperty.call(n,"x")){if(n.labelpos==="l"||n.labelpos==="r")n.width-=n.labeloffset;switch(n.labelpos){case"l":n.x-=n.width/2+n.labeloffset;break;case"r":n.x+=n.width/2+n.labeloffset;break}}})}function Rs(r){v(r.edges(),function(e){var n=r.edge(e);if(n.reversed)n.points.reverse()})}function Ms(r){v(r.nodes(),function(e){if(r.children(e).length){var n=r.node(e),o=r.node(n.borderTop),i=r.node(n.borderBottom),a=r.node(G(n.borderLeft)),f=r.node(G(n.borderRight));n.width=Math.abs(f.x-a.x),n.height=Math.abs(i.y-o.y),n.x=a.x+n.width/2,n.y=o.y+n.height/2}}),v(r.nodes(),function(e){if(r.node(e).dummy==="border")r.removeNode(e)})}function js(r){v(r.edges(),function(e){if(e.v===e.w){var n=r.node(e.v);if(!n.selfEdges)n.selfEdges=[];n.selfEdges.push({e,label:r.edge(e)}),r.removeEdge(e)}})}function Bs(r){var e=B(r);v(e,function(n){var o=0;v(n,function(i,a){var f=r.node(i);f.order=a+o,v(f.selfEdges,function(s){k(r,"selfedge",{width:s.label.width,height:s.label.height,rank:f.rank,order:a+ ++o,e:s.e,label:s.label},"_se")}),delete f.selfEdges})})}function Ds(r){v(r.nodes(),function(e){var n=r.node(e);if(n.dummy==="selfedge"){var o=r.node(n.e.v),i=o.x+o.width/2,a=o.y,f=n.x-i,s=o.height/2;r.setEdge(n.e,n.label),r.removeNode(e),n.label.points=[{x:i+2*f/3,y:a-s},{x:i+5*f/6,y:a-s},{x:i+f,y:a},{x:i+5*f/6,y:a+s},{x:i+2*f/3,y:a+s}],n.label.x=n.x,n.label.y=n.y}})}function Vr(r,e){return z(K(r,e),Number)}function Yr(r){var e={};return v(r,function(n,o){e[o.toLowerCase()]=n}),e}var wn=t((r,e,n)=>Math.max(e,Math.min(n,r)),"clamp"),_n=t((r="TB")=>{switch(r){case"BT":return"bottom";case"LR":return"right";case"RL":return"left";case"TB":default:return"top"}},"getDefaultSelfLoopSide"),Fs=t((r)=>r==="flowchart"||r==="flowchart-v2"||r==="stateDiagram"||r==="er"||r==="classDiagram","shouldMergeSelfLoopSegments"),Gs=["x","y","width","height","labelBBox","intersect","calcIntersect","diff","clusterNode"],Xs=t((r,e,n,o,i)=>{let a=[],f=new Set;if(n.forEach(({start:c,end:m})=>{if(c!==o)f.add(c);if(m!==o)f.add(m)}),f.forEach((c)=>{let m=r.node(c);if(typeof m?.x==="number"&&typeof m?.y==="number")a.push(m)}),a.length===0)n.forEach(({edge:c})=>{(c.points??[]).forEach((m)=>{if(typeof m?.x==="number"&&typeof m?.y==="number")a.push(m)})});if(a.length===0)return _n(i);let s=a.reduce((c,m)=>({x:c.x+m.x/a.length,y:c.y+m.y/a.length}),{x:0,y:0}),u=s.x-e.x,d=s.y-e.y;if(Math.abs(u)>Math.abs(d))return u>0?"right":"left";if(Math.abs(d)>0)return d>0?"bottom":"top";return _n(i)},"getSelfLoopSide"),Us=t((r,e="top",n=0,o=0)=>{let i=r.x,a=r.y-n,f=r.width/2,s=r.height/2,u=Math.max(36,Math.min(100,r.width*0.8)),d=wn(Math.max(o,r.width*0.35),36,u),c=wn(Math.min(r.width,r.height)*0.45,24,48);switch(e){case"bottom":{let m=a+s;return[{x:i-d/2,y:m},{x:i-d/2,y:m+c},{x:i+d/2,y:m+c},{x:i+d/2,y:m}]}case"right":{let m=i+f;return[{x:m,y:a-d/2},{x:m+c,y:a-d/2},{x:m+c,y:a+d/2},{x:m,y:a+d/2}]}case"left":{let m=i-f;return[{x:m,y:a-d/2},{x:m-c,y:a-d/2},{x:m-c,y:a+d/2},{x:m,y:a+d/2}]}case"top":default:{let m=a-s;return[{x:i-d/2,y:m},{x:i-d/2,y:m-c},{x:i+d/2,y:m-c},{x:i+d/2,y:m}]}}},"getSelfLoopPoints"),Vs=t((r,e,n="top",o=0,i={})=>{let f=r.x,s=r.y-o,u=i.width??0,d=i.height??0;switch(n){case"bottom":return{x:f,y:Math.max(...e.map((c)=>c.y))+d/2+4};case"right":return{x:Math.max(...e.map((c)=>c.x))+u/2+4,y:s};case"left":return{x:Math.min(...e.map((c)=>c.x))-u/2-4,y:s};case"top":default:return{x:f,y:Math.min(...e.map((c)=>c.y))-d/2-4}}},"getSelfLoopLabelPosition"),xn=t((r,e=0,{mergeSelfLoops:n=!0}={})=>{let o=new Map,i=[],a=r.graph()?.rankdir;return r.edges().forEach((f)=>{let s=r.edge(f);if(n&&s.selfLoop){let u=s.selfLoop.id;if(!o.has(u))o.set(u,[]);o.get(u).push({edge:s,start:f.v,end:f.w})}else i.push({edge:s,start:f.v,end:f.w})}),o.forEach((f)=>{if(f.length!==3){f.forEach((_)=>i.push(_));return}f.sort((_,A)=>_.edge.selfLoop.order-A.edge.selfLoop.order);let[s,u,d]=f,c=s.edge.originalEdge??u.edge.originalEdge??d.edge.originalEdge??u.edge,m=r.node(c.start);if(!m){f.forEach((_)=>i.push(_));return}let h={width:u.edge.width,height:u.edge.height},b=Xs(r,m,f,c.start,a),w=Us(m,b,e,h.width??0),y=Vs(m,w,b,e,h),g={...u.edge,...c,id:c.id,points:w,start:c.start,end:c.end,x:y.x,y:y.y,width:h.width,height:h.height,labelStyle:u.edge.labelStyle,fromCluster:s.edge.fromCluster??u.edge.fromCluster??d.edge.fromCluster,toCluster:s.edge.toCluster??u.edge.toCluster??d.edge.toCluster};delete g.selfLoop,delete g.originalEdge,i.push({edge:g,start:g.start,end:g.end})}),i},"getEdgesToRender"),On=t(async({element:r,graph:e,diagramType:n,id:o,parentCluster:i,siteConfig:a})=>{let f=e.graph().rankdir;l.trace("Dir in recursive render - dir:",f);let{clusters:s,edgePaths:u,edgeLabels:d,nodes:c,rootGroups:m}=pd(r,{edgePathsClass:"edgePaths"});if(!e.nodes())l.info("No nodes found for",e);else l.info("Recursive render XXX",e.nodes());if(e.edges().length>0)l.info("Recursive edges",e.edge(e.edges()[0]));let h=Fs(n);await Promise.all(e.nodes().map(async function(y){let g=e.node(y);if(i!==void 0){let _=JSON.parse(JSON.stringify(i.clusterData));if(l.trace(`Setting data for parent cluster XXX
1
+ import{t,l,p,q,sa,kA,Lr,ii,ca,Is,oi}from"./index-hc2jmzpx.js";import{Rt,pn,Xn,qt,Sr,Va,ve,vt,pr,Ya,mr,gl,bd,yd,vd,ho,na,kd,bo,mn,yo,Qa,ra,vo,Ja,ko,xd,wd,hl,Ft,Cd,xo,Za,wo,bl,yl,Xa,Ed,vl,Bd,pu,Tr,kl,Id,_d,Sd,Pn,xl,wl,Co,Td,Cl,v,er,Dr,Mt,ei,Oe}from"./index-7n68yx6m.js";import{fd,Ad,Ae,ks,cA,gd,Pi}from"./index-fdbfzshx.js";import{dn}from"./index-c0x6s6f7.js";var sr={};dn(sr,{default:()=>Z});var Nn=/\s/;function kn(r){var e=r.length;while(e--&&Nn.test(r.charAt(e)));return e}var Kr=kn;var Tn=/^\s+/;function Cn(r){return r?r.slice(0,Kr(r)+1).replace(Tn,""):r}var Jr=Cn;var Zr=NaN,An=/^[-+]0x[0-9a-f]+$/i,Rn=/^0b[01]+$/i,Mn=/^0o[0-7]+$/i,jn=parseInt;function Bn(r){if(typeof r=="number")return r;if(Sr(r))return Zr;if(vt(r)){var e=typeof r.valueOf=="function"?r.valueOf():r;r=vt(e)?e+"":e}if(typeof r!="string")return r===0?r:+r;r=Jr(r);var n=Rn.test(r);return n||Mn.test(r)?jn(r.slice(2),n?2:8):An.test(r)?Zr:+r}var $r=Bn;var Qr=1/0,Dn=179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000;function Fn(r){if(!r)return r===0?r:0;if(r=$r(r),r===Qr||r===-Qr){var e=r<0?-1:1;return e*Dn}return r===r?r:0}var U=Fn;function Gn(r){var e=U(r),n=e%1;return e===e?n?e-n:e:0}var re=Gn;var ee=Object.create,Un=function(){function r(){}return function(e){if(!vt(e))return{};if(ee)return ee(e);r.prototype=e;var n=new r;return r.prototype=void 0,n}}(),te=Un;function Vn(r,e){var n=-1,o=r.length;e||(e=Array(o));while(++n<o)e[n]=r[n];return e}var ar=Vn;function Yn(r,e,n){if(e=="__proto__"&&gl)gl(r,e,{configurable:!0,enumerable:!0,value:n,writable:!0});else r[e]=n}var R=Yn;var zn=Object.prototype,Wn=zn.hasOwnProperty;function qn(r,e,n){var o=r[e];if(!(Wn.call(r,e)&&na(o,n))||n===void 0&&!(e in r))R(r,e,n)}var M=qn;function Hn(r,e,n,o){var i=!n;n||(n={});var a=-1,f=e.length;while(++a<f){var s=e[a],u=o?o(n[s],r[s],s,n,r):void 0;if(u===void 0)u=r[s];if(i)R(n,s,u);else M(n,s,u)}return n}var P=Hn;function Kn(r,e,n){if(!vt(n))return!1;var o=typeof e;if(o=="number"?mn(n)&&ho(e,n.length):o=="string"&&(e in n))return na(n[e],r);return!1}var T=Kn;function Jn(r){return bo(function(e,n){var o=-1,i=n.length,a=i>1?n[i-1]:void 0,f=i>2?n[2]:void 0;if(a=r.length>3&&typeof a=="function"?(i--,a):void 0,f&&T(n[0],n[1],f))a=i<3?void 0:a,i=1;e=Object(e);while(++o<i){var s=n[o];if(s)r(e,s,o,a)}return e})}var ne=Jn;function Zn(r){var e=[];if(r!=null)for(var n in Object(r))e.push(n);return e}var oe=Zn;var $n=Object.prototype,Qn=$n.hasOwnProperty;function ro(r){if(!vt(r))return oe(r);var e=yo(r),n=[];for(var o in r)if(!(o=="constructor"&&(e||!Qn.call(r,o))))n.push(o);return n}var ie=ro;function eo(r){return mn(r)?xd(r,!0):ie(r)}var L=eo;function to(r){var e=r==null?0:r.length;return e?yl(r,1):[]}var S=to;function no(r){return bd(kd(r,void 0,S),r+"")}var ae=no;var oo=wd(Object.getPrototypeOf,Object),V=oo;var io="[object Object]",ao=Function.prototype,fo=Object.prototype,fe=ao.toString,so=fo.hasOwnProperty,uo=fe.call(Object);function co(r){if(!qt(r)||Xn(r)!=io)return!1;var e=V(r);if(e===null)return!0;var n=so.call(e,"constructor")&&e.constructor;return typeof n=="function"&&n instanceof n&&fe.call(n)==uo}var se=co;var po="\\ud800-\\udfff",lo="\\u0300-\\u036f",mo="\\ufe20-\\ufe2f",go="\\u20d0-\\u20ff",_o=lo+mo+go,Eo="\\ufe0e\\ufe0f",Oo="\\u200d",Lo=RegExp("["+Oo+po+_o+Eo+"]");function Io(r){return Lo.test(r)}var ue=Io;function So(r,e){return r&&P(e,Ft(e),r)}var de=So;function No(r,e){return r&&P(e,L(e),r)}var ce=No;var he=typeof sr=="object"&&sr&&!sr.nodeType&&sr,pe=he&&typeof fr=="object"&&fr&&!fr.nodeType&&fr,Po=pe&&pe.exports===he,le=Po?Rt.Buffer:void 0,me=le?le.allocUnsafe:void 0;function To(r,e){if(e)return r.slice();var n=r.length,o=me?me(n):new r.constructor(n);return r.copy(o),o}var Z=To;function Ao(r,e){return P(r,vl(r),e)}var ge=Ao;var Ro=Object.getOwnPropertySymbols,Mo=!Ro?Ed:function(r){var e=[];while(r)bl(e,vl(r)),r=V(r);return e},ur=Mo;function jo(r,e){return P(r,ur(r),e)}var be=jo;function Bo(r){return Bd(r,L,ur)}var ye=Bo;var Do=Object.prototype,Fo=Do.hasOwnProperty;function Go(r){var e=r.length,n=new r.constructor(e);if(e&&typeof r[0]=="string"&&Fo.call(r,"index"))n.index=r.index,n.input=r.input;return n}var we=Go;function Xo(r){var e=new r.constructor(r.byteLength);return new kl(e).set(new kl(r)),e}var Y=Xo;function Uo(r,e){var n=e?Y(r.buffer):r.buffer;return new r.constructor(n,r.byteOffset,r.byteLength)}var _e=Uo;var Vo=/\w*$/;function Yo(r){var e=new r.constructor(r.source,Vo.exec(r));return e.lastIndex=r.lastIndex,e}var Ee=Yo;var xe=pn?pn.prototype:void 0,Le=xe?xe.valueOf:void 0;function zo(r){return Le?Object(Le.call(r)):{}}var Ie=zo;function Wo(r,e){var n=e?Y(r.buffer):r.buffer;return new r.constructor(n,r.byteOffset,r.length)}var dr=Wo;var qo="[object Boolean]",Ho="[object Date]",Ko="[object Map]",Jo="[object Number]",Zo="[object RegExp]",$o="[object Set]",Qo="[object String]",ri="[object Symbol]",ti="[object ArrayBuffer]",ni="[object DataView]",ai="[object Float32Array]",fi="[object Float64Array]",si="[object Int8Array]",ui="[object Int16Array]",di="[object Int32Array]",ci="[object Uint8Array]",pi="[object Uint8ClampedArray]",li="[object Uint16Array]",mi="[object Uint32Array]";function hi(r,e,n){var o=r.constructor;switch(e){case ti:return Y(r);case qo:case Ho:return new o(+r);case ni:return _e(r,n);case ai:case fi:case si:case ui:case di:case ci:case pi:case li:case mi:return dr(r,n);case Ko:return new o;case Jo:case Qo:return new o(r);case Zo:return Ee(r);case $o:return new o;case ri:return Ie(r)}}var Se=hi;function gi(r){return typeof r.constructor=="function"&&!yo(r)?te(V(r)):{}}var cr=gi;var vi="[object Map]";function bi(r){return qt(r)&&Tr(r)==vi}var Ne=bi;var Pe=Ja&&Ja.isMap,yi=Pe?vo(Pe):Ne,ke=yi;var wi="[object Set]";function _i(r){return qt(r)&&Tr(r)==wi}var Te=_i;var Ce=Ja&&Ja.isSet,Ei=Ce?vo(Ce):Te,Re=Ei;var xi=1,Oi=2,Li=4,Me="[object Arguments]",Ii="[object Array]",Si="[object Boolean]",Ni="[object Date]",ki="[object Error]",je="[object Function]",Ti="[object GeneratorFunction]",Ci="[object Map]",Ai="[object Number]",Be="[object Object]",Ri="[object RegExp]",Mi="[object Set]",ji="[object String]",Bi="[object Symbol]",Di="[object WeakMap]",Fi="[object ArrayBuffer]",Gi="[object DataView]",Xi="[object Float32Array]",Ui="[object Float64Array]",Vi="[object Int8Array]",Yi="[object Int16Array]",zi="[object Int32Array]",Wi="[object Uint8Array]",qi="[object Uint8ClampedArray]",Hi="[object Uint16Array]",Ki="[object Uint32Array]",x={};x[Me]=x[Ii]=x[Fi]=x[Gi]=x[Si]=x[Ni]=x[Xi]=x[Ui]=x[Vi]=x[Yi]=x[zi]=x[Ci]=x[Ai]=x[Be]=x[Ri]=x[Mi]=x[ji]=x[Bi]=x[Wi]=x[qi]=x[Hi]=x[Ki]=!0;x[ki]=x[je]=x[Di]=!1;function lr(r,e,n,o,i,a){var f,s=e&xi,u=e&Oi,d=e&Li;if(n)f=i?n(r,o,i,a):n(r);if(f!==void 0)return f;if(!vt(r))return r;var c=ve(r);if(c){if(f=we(r),!s)return ar(r,f)}else{var m=Tr(r),h=m==je||m==Ti;if(ra(r))return Z(r,s);if(m==Be||m==Me||h&&!i){if(f=u||h?{}:cr(r),!s)return u?be(r,ce(f,r)):ge(r,de(f,r))}else{if(!x[m])return i?r:{};f=Se(r,m,s)}}a||(a=new Xa);var b=a.get(r);if(b)return b;if(a.set(r,f),Re(r))r.forEach(function(g){f.add(lr(g,e,n,g,r,a))});else if(ke(r))r.forEach(function(g,_){f.set(_,lr(g,e,n,_,r,a))});var w=d?u?ye:pu:u?L:Ft,y=c?void 0:w(r);return yd(y||r,function(g,_){if(y)_=g,g=r[_];M(f,_,lr(g,e,n,_,r,a))}),f}var De=lr;var Ji=1,Zi=4;function $i(r){return De(r,Ji|Zi)}var Fe=$i;var Qi=function(){return Rt.Date.now()},_r=Qi;var Ge=Object.prototype,ea=Ge.hasOwnProperty,ta=bo(function(r,e){r=Object(r);var n=-1,o=e.length,i=o>2?e[2]:void 0;if(i&&T(e[0],e[1],i))o=1;while(++n<o){var a=e[n],f=L(a),s=-1,u=f.length;while(++s<u){var d=f[s],c=r[d];if(c===void 0||na(c,Ge[d])&&!ea.call(r,d))r[d]=a[d]}}return r}),Xe=ta;function oa(r,e,n){if(n!==void 0&&!na(r[e],n)||n===void 0&&!(e in r))R(r,e,n)}var Q=oa;function ia(r,e){if(e==="constructor"&&typeof r[e]==="function")return;if(e=="__proto__")return;return r[e]}var rr=ia;function aa(r){return P(r,L(r))}var Ue=aa;function fa(r,e,n,o,i,a,f){var s=rr(r,n),u=rr(e,n),d=f.get(u);if(d){Q(r,n,d);return}var c=a?a(s,u,n+"",r,e,f):void 0,m=c===void 0;if(m){var h=ve(u),b=!h&&ra(u),w=!h&&!b&&ko(u);if(c=u,h||b||w)if(ve(s))c=s;else if(Td(s))c=ar(s);else if(b)m=!1,c=Z(u,!0);else if(w)m=!1,c=dr(u,!0);else c=[];else if(se(u)||Qa(u)){if(c=s,Qa(s))c=Ue(s);else if(!vt(s)||Ya(s))c=cr(u)}else m=!1}if(m)f.set(u,c),i(c,u,o,a,f),f.delete(u);Q(r,n,c)}var Ve=fa;function Ye(r,e,n,o,i){if(r===e)return;xl(e,function(a,f){if(i||(i=new Xa),vt(a))Ve(r,e,f,n,Ye,o,i);else{var s=o?o(rr(r,f),a,f+"",r,e,i):void 0;if(s===void 0)s=a;Q(r,f,s)}},L)}var ze=Ye;function ua(r){var e=r==null?0:r.length;return e?r[e-1]:void 0}var G=ua;function da(r){return function(e,n,o){var i=Object(e);if(!mn(e)){var a=Pn(n,3);e=Ft(e),n=function(s){return a(i[s],s,i)}}var f=r(e,n,o);return f>-1?i[a?e[f]:f]:void 0}}var We=da;var pa=Math.max;function la(r,e,n){var o=r==null?0:r.length;if(!o)return-1;var i=n==null?0:re(n);if(i<0)i=pa(o+i,0);return vd(r,Pn(e,3),i)}var qe=la;var ma=We(qe),tr=ma;function ha(r,e){var n=-1,o=mn(r)?Array(r.length):[];return Co(r,function(i,a,f){o[++n]=e(i,a,f)}),o}var hr=ha;function ga(r,e){var n=ve(r)?Va:hr;return n(r,Pn(e,3))}var E=ga;function va(r,e){return r==null?r:xl(r,Cl(e),L)}var He=va;function ba(r,e){return r&&wl(r,Cl(e))}var Ke=ba;function ya(r,e){return r>e}var Je=ya;var wa=Object.prototype,_a=wa.hasOwnProperty;function Ea(r,e){return r!=null&&_a.call(r,e)}var Ze=Ea;function xa(r,e){return r!=null&&Id(r,e,Ze)}var gr=xa;var Oa="[object String]";function La(r){return typeof r=="string"||!ve(r)&&qt(r)&&Xn(r)==Oa}var $e=La;function Ia(r,e){return r<e}var vr=Ia;function Sa(r,e){var n={};return e=Pn(e,3),wl(r,function(o,i,a){R(n,i,e(o,i,a))}),n}var z=Sa;function Na(r,e,n){var o=-1,i=r.length;while(++o<i){var a=r[o],f=e(a);if(f!=null&&(s===void 0?f===f&&!Sr(f):n(f,s)))var s=f,u=a}return u}var W=Na;function Pa(r){return r&&r.length?W(r,pr,Je):void 0}var I=Pa;var ka=ne(function(r,e,n){ze(r,e,n)}),nr=ka;function Ta(r){return r&&r.length?W(r,pr,vr):void 0}var j=Ta;function Ca(r,e){return r&&r.length?W(r,Pn(e,2),vr):void 0}var H=Ca;function Aa(r,e,n,o){if(!vt(r))return r;e=xo(e,r);var i=-1,a=e.length,f=a-1,s=r;while(s!=null&&++i<a){var u=Za(e[i]),d=n;if(u==="__proto__"||u==="constructor"||u==="prototype")return r;if(i!=f){var c=s[u];if(d=o?o(c,u,s):void 0,d===void 0)d=vt(c)?c:ho(e[i+1])?[]:{}}M(s,u,d),s=s[u]}return r}var Qe=Aa;function Ra(r,e,n){var o=-1,i=e.length,a={};while(++o<i){var f=e[o],s=wo(r,f);if(n(s,f))Qe(a,xo(f,r),s)}return a}var rt=Ra;function Ma(r,e){var n=r.length;r.sort(e);while(n--)r[n]=r[n].value;return r}var et=Ma;function ja(r,e){if(r!==e){var n=r!==void 0,o=r===null,i=r===r,a=Sr(r),f=e!==void 0,s=e===null,u=e===e,d=Sr(e);if(!s&&!d&&!a&&r>e||a&&f&&u&&!s&&!d||o&&f&&u||!n&&u||!i)return 1;if(!o&&!a&&!d&&r<e||d&&n&&i&&!o&&!a||s&&n&&i||!f&&i||!u)return-1}return 0}var tt=ja;function Ba(r,e,n){var o=-1,i=r.criteria,a=e.criteria,f=i.length,s=n.length;while(++o<f){var u=tt(i[o],a[o]);if(u){if(o>=s)return u;var d=n[o];return u*(d=="desc"?-1:1)}}return r.index-e.index}var nt=Ba;function Da(r,e,n){if(e.length)e=Va(e,function(a){if(ve(a))return function(f){return wo(f,a.length===1?a[0]:a)};return a});else e=[pr];var o=-1;e=Va(e,vo(Pn));var i=hr(r,function(a,f,s){var u=Va(e,function(d){return d(a)});return{criteria:u,index:++o,value:a}});return et(i,function(a,f){return nt(a,f,n)})}var ot=Da;var Fa=Sd("length"),it=Fa;var ft="\\ud800-\\udfff",Ga="\\u0300-\\u036f",Ua="\\ufe20-\\ufe2f",za="\\u20d0-\\u20ff",Wa=Ga+Ua+za,qa="\\ufe0e\\ufe0f",Ha="["+ft+"]",Er="["+Wa+"]",xr="\\ud83c[\\udffb-\\udfff]",Ka="(?:"+Er+"|"+xr+")",st="[^"+ft+"]",ut="(?:\\ud83c[\\udde6-\\uddff]){2}",dt="[\\ud800-\\udbff][\\udc00-\\udfff]",$a="\\u200d",ct=Ka+"?",pt="["+qa+"]?",rf="(?:"+$a+"(?:"+[st,ut,dt].join("|")+")"+pt+ct+")*",ef=pt+ct+rf,tf="(?:"+[st+Er+"?",Er,ut,dt,Ha].join("|")+")",at=RegExp(xr+"(?="+xr+")|"+tf+ef,"g");function nf(r){var e=at.lastIndex=0;while(at.test(r))++e;return e}var lt=nf;function of(r){return ue(r)?lt(r):it(r)}var mt=of;function af(r,e){return rt(r,e,function(n,o){return _d(r,o)})}var ht=af;var ff=ae(function(r,e){return r==null?{}:ht(r,e)}),K=ff;var{ceil:sf,max:uf}=Math;function df(r,e,n,o){var i=-1,a=uf(sf((e-r)/(n||1)),0),f=Array(a);while(a--)f[o?a:++i]=r,r+=n;return f}var gt=df;function cf(r){return function(e,n,o){if(o&&typeof o!="number"&&T(e,n,o))n=o=void 0;if(e=U(e),n===void 0)n=e,e=0;else n=U(n);return o=o===void 0?e<n?1:-1:U(o),gt(e,n,o,r)}}var bt=cf;var pf=bt(),N=pf;var lf="[object Map]",mf="[object Set]";function hf(r){if(r==null)return 0;if(mn(r))return $e(r)?mt(r):r.length;var e=Tr(r);if(e==lf||e==mf)return r.size;return hl(r).length}var yt=hf;var gf=bo(function(r,e){if(r==null)return[];var n=e.length;if(n>1&&T(r,e[0],e[1]))e=[];else if(n>2&&T(e[0],e[1],e[2]))e=[e[0]];return ot(r,yl(e,1),[])}),C=gf;var vf=0;function bf(r){var e=++vf;return Cd(r)+e}var J=bf;function yf(r,e,n){var o=-1,i=r.length,a=e.length,f={};while(++o<i){var s=o<a?e[o]:void 0;n(f,r[o],s)}return f}var wt=yf;function wf(r,e){return wt(r||[],e||[],M)}var Or=wf;class Ir{constructor(){var r={};r._next=r._prev=r,this._sentinel=r}dequeue(){var r=this._sentinel,e=r._prev;if(e!==r)return _t(e),e}enqueue(r){var e=this._sentinel;if(r._prev&&r._next)_t(r);r._next=e._next,e._next._prev=r,e._next=r,r._prev=e}toString(){var r=[],e=this._sentinel,n=e._prev;while(n!==e)r.push(JSON.stringify(n,_f)),n=n._prev;return"["+r.join(", ")+"]"}}function _t(r){r._prev._next=r._next,r._next._prev=r._prev,delete r._next,delete r._prev}function _f(r,e){if(r!=="_next"&&r!=="_prev")return e}var Ef=mr(1);function Et(r,e){if(r.nodeCount()<=1)return[];var n=Of(r,e||Ef),o=xf(n.graph,n.buckets,n.zeroIdx);return S(E(o,function(i){return r.outEdges(i.v,i.w)}))}function xf(r,e,n){var o=[],i=e[e.length-1],a=e[0],f;while(r.nodeCount()){while(f=a.dequeue())Nr(r,e,n,f);while(f=i.dequeue())Nr(r,e,n,f);if(r.nodeCount()){for(var s=e.length-2;s>0;--s)if(f=e[s].dequeue(),f){o=o.concat(Nr(r,e,n,f,!0));break}}}return o}function Nr(r,e,n,o,i){var a=i?[]:void 0;return v(r.inEdges(o.v),function(f){var s=r.edge(f),u=r.node(f.v);if(i)a.push({v:f.v,w:f.w});u.out-=s,Pr(e,n,u)}),v(r.outEdges(o.v),function(f){var s=r.edge(f),u=f.w,d=r.node(u);d.in-=s,Pr(e,n,d)}),r.removeNode(o.v),a}function Of(r,e){var n=new Oe,o=0,i=0;v(r.nodes(),function(s){n.setNode(s,{v:s,in:0,out:0})}),v(r.edges(),function(s){var u=n.edge(s.v,s.w)||0,d=e(s),c=u+d;n.setEdge(s.v,s.w,c),i=Math.max(i,n.node(s.v).out+=d),o=Math.max(o,n.node(s.w).in+=d)});var a=N(i+o+3).map(function(){return new Ir}),f=o+1;return v(n.nodes(),function(s){Pr(a,f,n.node(s))}),{graph:n,buckets:a,zeroIdx:f}}function Pr(r,e,n){if(!n.out)r[0].enqueue(n);else if(!n.in)r[r.length-1].enqueue(n);else r[n.out-n.in+e].enqueue(n)}function xt(r){var e=r.graph().acyclicer==="greedy"?Et(r,n(r)):Lf(r);v(e,function(o){var i=r.edge(o);r.removeEdge(o),i.forwardName=o.name,i.reversed=!0,r.setEdge(o.w,o.v,i,J("rev"))});function n(o){return function(i){return o.edge(i).weight}}}function Lf(r){var e=[],n={},o={};function i(a){if(Object.prototype.hasOwnProperty.call(o,a))return;o[a]=!0,n[a]=!0,v(r.outEdges(a),function(f){if(Object.prototype.hasOwnProperty.call(n,f.w))e.push(f);else i(f.w)}),delete n[a]}return v(r.nodes(),i),e}function Ot(r){v(r.edges(),function(e){var n=r.edge(e);if(n.reversed){r.removeEdge(e);var o=n.forwardName;delete n.reversed,delete n.forwardName,r.setEdge(e.w,e.v,n,o)}})}function k(r,e,n,o){var i;do i=J(o);while(r.hasNode(i));return n.dummy=e,r.setNode(i,n),i}function It(r){var e=new Oe().setGraph(r.graph());return v(r.nodes(),function(n){e.setNode(n,r.node(n))}),v(r.edges(),function(n){var o=e.edge(n.v,n.w)||{weight:0,minlen:1},i=r.edge(n);e.setEdge(n.v,n.w,{weight:o.weight+i.weight,minlen:Math.max(o.minlen,i.minlen)})}),e}function br(r){var e=new Oe({multigraph:r.isMultigraph()}).setGraph(r.graph());return v(r.nodes(),function(n){if(!r.children(n).length)e.setNode(n,r.node(n))}),v(r.edges(),function(n){e.setEdge(n,r.edge(n))}),e}function kr(r,e){var{x:n,y:o}=r,i=e.x-n,a=e.y-o,f=r.width/2,s=r.height/2;if(!i&&!a)throw Error("Not possible to find intersection inside of the rectangle");var u,d;if(Math.abs(a)*f>Math.abs(i)*s){if(a<0)s=-s;u=s*i/a,d=s}else{if(i<0)f=-f;u=f,d=f*a/i}return{x:n+u,y:o+d}}function B(r){var e=E(N(Ar(r)+1),function(){return[]});return v(r.nodes(),function(n){var o=r.node(n),i=o.rank;if(!Mt(i))e[i][o.order]=n}),e}function St(r){var e=j(E(r.nodes(),function(n){return r.node(n).rank}));v(r.nodes(),function(n){var o=r.node(n);if(gr(o,"rank"))o.rank-=e})}function Nt(r){var e=j(E(r.nodes(),function(a){return r.node(a).rank})),n=[];v(r.nodes(),function(a){var f=r.node(a).rank-e;if(!n[f])n[f]=[];n[f].push(a)});var o=0,i=r.graph().nodeRankFactor;v(n,function(a,f){if(Mt(a)&&f%i!==0)--o;else if(o)v(a,function(s){r.node(s).rank+=o})})}function Cr(r,e,n,o){var i={width:0,height:0};if(arguments.length>=4)i.rank=n,i.order=o;return k(r,"border",i,e)}function Ar(r){return I(E(r.nodes(),function(e){var n=r.node(e).rank;if(!Mt(n))return n}))}function Pt(r,e){var n={lhs:[],rhs:[]};return v(r,function(o){if(e(o))n.lhs.push(o);else n.rhs.push(o)}),n}function kt(r,e){var n=_r();try{return e()}finally{console.log(r+" time: "+(_r()-n)+"ms")}}function Tt(r,e){return e()}function At(r){function e(n){var o=r.children(n),i=r.node(n);if(o.length)v(o,e);if(Object.prototype.hasOwnProperty.call(i,"minRank")){i.borderLeft=[],i.borderRight=[];for(var a=i.minRank,f=i.maxRank+1;a<f;++a)Ct(r,"borderLeft","_bl",n,i,a),Ct(r,"borderRight","_br",n,i,a)}}v(r.children(),e)}function Ct(r,e,n,o,i,a){var f={width:0,height:0,rank:a,borderType:e},s=i[e][a-1],u=k(r,"border",f,n);if(i[e][a]=u,r.setParent(u,o),s)r.setEdge(s,u,{weight:1})}function Bt(r){var e=r.graph().rankdir.toLowerCase();if(e==="lr"||e==="rl")Gt(r)}function Dt(r){var e=r.graph().rankdir.toLowerCase();if(e==="bt"||e==="rl")If(r);if(e==="lr"||e==="rl")Sf(r),Gt(r)}function Gt(r){v(r.nodes(),function(e){jt(r.node(e))}),v(r.edges(),function(e){jt(r.edge(e))})}function jt(r){var e=r.width;r.width=r.height,r.height=e}function If(r){v(r.nodes(),function(e){Rr(r.node(e))}),v(r.edges(),function(e){var n=r.edge(e);if(v(n.points,Rr),Object.prototype.hasOwnProperty.call(n,"y"))Rr(n)})}function Rr(r){r.y=-r.y}function Sf(r){v(r.nodes(),function(e){Mr(r.node(e))}),v(r.edges(),function(e){var n=r.edge(e);if(v(n.points,Mr),Object.prototype.hasOwnProperty.call(n,"x"))Mr(n)})}function Mr(r){var e=r.x;r.x=r.y,r.y=e}function Xt(r){r.graph().dummyChains=[],v(r.edges(),function(e){Pf(r,e)})}function Pf(r,e){var n=e.v,o=r.node(n).rank,i=e.w,a=r.node(i).rank,f=e.name,s=r.edge(e),u=s.labelRank;if(a===o+1)return;r.removeEdge(e);var d=void 0,c,m;for(m=0,++o;o<a;++m,++o){if(s.points=[],d={width:0,height:0,edgeLabel:s,edgeObj:e,rank:o},c=k(r,"edge",d,"_d"),o===u)d.width=s.width,d.height=s.height,d.dummy="edge-label",d.labelpos=s.labelpos;if(r.setEdge(n,c,{weight:s.weight},f),m===0)r.graph().dummyChains.push(c);n=c}r.setEdge(n,i,{weight:s.weight},f)}function Ut(r){v(r.graph().dummyChains,function(e){var n=r.node(e),o=n.edgeLabel,i;r.setEdge(n.edgeObj,o);while(n.dummy){if(i=r.successors(e)[0],r.removeNode(e),o.points.push({x:n.x,y:n.y}),n.dummy==="edge-label")o.x=n.x,o.y=n.y,o.width=n.width,o.height=n.height;e=i,n=r.node(e)}})}function or(r){var e={};function n(o){var i=r.node(o);if(Object.prototype.hasOwnProperty.call(e,o))return i.rank;e[o]=!0;var a=j(E(r.outEdges(o),function(f){return n(f.w)-r.edge(f).minlen}));if(a===Number.POSITIVE_INFINITY||a===void 0||a===null)a=0;return i.rank=a}v(r.sources(),n)}function X(r,e){return r.node(e.w).rank-r.node(e.v).rank-r.edge(e).minlen}function yr(r){var e=new Oe({directed:!1}),n=r.nodes()[0],o=r.nodeCount();e.setNode(n,{});var i,a;while(kf(e,r)<o)i=Tf(e,r),a=e.hasNode(i.v)?X(r,i):-X(r,i),Cf(e,r,a);return e}function kf(r,e){function n(o){v(e.nodeEdges(o),function(i){var a=i.v,f=o===a?i.w:a;if(!r.hasNode(f)&&!X(e,i))r.setNode(f,{}),r.setEdge(o,f,{}),n(f)})}return v(r.nodes(),n),r.nodeCount()}function Tf(r,e){return H(e.edges(),function(n){if(r.hasNode(n.v)!==r.hasNode(n.w))return X(e,n)})}function Cf(r,e,n){v(r.nodes(),function(o){e.node(o).rank+=n})}var fh=mr(1);var mh=mr(1);jr.CycleException=ir;function jr(r){var e={},n={},o=[];function i(a){if(Object.prototype.hasOwnProperty.call(n,a))throw new ir;if(!Object.prototype.hasOwnProperty.call(e,a))n[a]=!0,e[a]=!0,v(r.predecessors(a),i),delete n[a],o.push(a)}if(v(r.sinks(),i),yt(e)!==r.nodeCount())throw new ir;return o}function ir(){}ir.prototype=Error();function wr(r,e,n){if(!ve(e))e=[e];var o=(r.isDirected()?r.successors:r.neighbors).bind(r),i=[],a={};return v(e,function(f){if(!r.hasNode(f))throw Error("Graph does not have node: "+f);Yt(r,f,n==="post",a,o,i)}),i}function Yt(r,e,n,o,i,a){if(!Object.prototype.hasOwnProperty.call(o,e)){if(o[e]=!0,!n)a.push(e);if(v(i(e),function(f){Yt(r,f,n,o,i,a)}),n)a.push(e)}}function Br(r,e){return wr(r,e,"post")}function Fr(r,e){return wr(r,e,"pre")}F.initLowLimValues=Xr;F.initCutValues=Gr;F.calcCutValue=Wt;F.leaveEdge=Kt;F.enterEdge=Jt;F.exchangeEdges=Zt;function F(r){r=It(r),or(r);var e=yr(r);Xr(e),Gr(e,r);var n,o;while(n=Kt(e))o=Jt(e,r,n),Zt(e,r,n,o)}function Gr(r,e){var n=Br(r,r.nodes());n=n.slice(0,n.length-1),v(n,function(o){Bf(r,e,o)})}function Bf(r,e,n){var o=r.node(n),i=o.parent;r.edge(n,i).cutvalue=Wt(r,e,n)}function Wt(r,e,n){var o=r.node(n),i=o.parent,a=!0,f=e.edge(n,i),s=0;if(!f)a=!1,f=e.edge(i,n);return s=f.weight,v(e.nodeEdges(n),function(u){var d=u.v===n,c=d?u.w:u.v;if(c!==i){var m=d===a,h=e.edge(u).weight;if(s+=m?h:-h,Ff(r,n,c)){var b=r.edge(n,c).cutvalue;s+=m?-b:b}}}),s}function Xr(r,e){if(arguments.length<2)e=r.nodes()[0];Ht(r,{},1,e)}function Ht(r,e,n,o,i){var a=n,f=r.node(o);if(e[o]=!0,v(r.neighbors(o),function(s){if(!Object.prototype.hasOwnProperty.call(e,s))n=Ht(r,e,n,s,o)}),f.low=a,f.lim=n++,i)f.parent=i;else delete f.parent;return n}function Kt(r){return tr(r.edges(),function(e){return r.edge(e).cutvalue<0})}function Jt(r,e,n){var{v:o,w:i}=n;if(!e.hasEdge(o,i))o=n.w,i=n.v;var a=r.node(o),f=r.node(i),s=a,u=!1;if(a.lim>f.lim)s=f,u=!0;var d=er(e.edges(),function(c){return u===zt(r,r.node(c.v),s)&&u!==zt(r,r.node(c.w),s)});return H(d,function(c){return X(e,c)})}function Zt(r,e,n,o){var{v:i,w:a}=n;r.removeEdge(i,a),r.setEdge(o.v,o.w,{}),Xr(r),Gr(r,e),Df(r,e)}function Df(r,e){var n=tr(r.nodes(),function(i){return!e.node(i).parent}),o=Fr(r,n);o=o.slice(1),v(o,function(i){var a=r.node(i).parent,f=e.edge(i,a),s=!1;if(!f)f=e.edge(a,i),s=!0;e.node(i).rank=e.node(a).rank+(s?f.minlen:-f.minlen)})}function Ff(r,e,n){return r.hasEdge(e,n)}function zt(r,e,n){return n.low<=e.lim&&e.lim<=n.lim}function Ur(r){switch(r.graph().ranker){case"network-simplex":$t(r);break;case"tight-tree":Xf(r);break;case"longest-path":Gf(r);break;default:$t(r)}}var Gf=or;function Xf(r){or(r),yr(r)}function $t(r){F(r)}function Qt(r){var e=k(r,"root",{},"_root"),n=Uf(r),o=I(Dr(n))-1,i=2*o+1;r.graph().nestingRoot=e,v(r.edges(),function(f){r.edge(f).minlen*=i});var a=Vf(r)+1;v(r.children(),function(f){rn(r,e,i,a,o,n,f)}),r.graph().nodeRankFactor=i}function rn(r,e,n,o,i,a,f){var s=r.children(f);if(!s.length){if(f!==e)r.setEdge(e,f,{weight:0,minlen:n});return}var u=Cr(r,"_bt"),d=Cr(r,"_bb"),c=r.node(f);if(r.setParent(u,f),c.borderTop=u,r.setParent(d,f),c.borderBottom=d,v(s,function(m){rn(r,e,n,o,i,a,m);var h=r.node(m),b=h.borderTop?h.borderTop:m,w=h.borderBottom?h.borderBottom:m,y=h.borderTop?o:2*o,g=b!==w?1:i-a[f]+1;r.setEdge(u,b,{weight:y,minlen:g,nestingEdge:!0}),r.setEdge(w,d,{weight:y,minlen:g,nestingEdge:!0})}),!r.parent(f))r.setEdge(e,u,{weight:0,minlen:i+a[f]})}function Uf(r){var e={};function n(o,i){var a=r.children(o);if(a&&a.length)v(a,function(f){n(f,i+1)});e[o]=i}return v(r.children(),function(o){n(o,1)}),e}function Vf(r){return ei(r.edges(),function(e,n){return e+r.edge(n).weight},0)}function en(r){var e=r.graph();r.removeNode(e.nestingRoot),delete e.nestingRoot,v(r.edges(),function(n){var o=r.edge(n);if(o.nestingEdge)r.removeEdge(n)})}function tn(r,e,n){var o={},i;v(n,function(a){var f=r.parent(a),s,u;while(f){if(s=r.parent(f),s)u=o[s],o[s]=f;else u=i,i=f;if(u&&u!==f){e.setEdge(u,f);return}f=s}})}function nn(r,e,n){var o=zf(r),i=new Oe({compound:!0}).setGraph({root:o}).setDefaultNodeLabel(function(a){return r.node(a)});return v(r.nodes(),function(a){var f=r.node(a),s=r.parent(a);if(f.rank===e||f.minRank<=e&&e<=f.maxRank){if(i.setNode(a),i.setParent(a,s||o),v(r[n](a),function(u){var d=u.v===a?u.w:u.v,c=i.edge(d,a),m=!Mt(c)?c.weight:0;i.setEdge(d,a,{weight:r.edge(u).weight+m})}),Object.prototype.hasOwnProperty.call(f,"minRank"))i.setNode(a,{borderLeft:f.borderLeft[e],borderRight:f.borderRight[e]})}}),i}function zf(r){var e;while(r.hasNode(e=J("_root")));return e}function on(r,e){var n=0;for(var o=1;o<e.length;++o)n+=Wf(r,e[o-1],e[o]);return n}function Wf(r,e,n){var o=Or(n,E(n,function(d,c){return c})),i=S(E(e,function(d){return C(E(r.outEdges(d),function(c){return{pos:o[c.w],weight:r.edge(c).weight}}),"pos")})),a=1;while(a<n.length)a<<=1;var f=2*a-1;a-=1;var s=E(Array(f),function(){return 0}),u=0;return v(i.forEach(function(d){var c=d.pos+a;s[c]+=d.weight;var m=0;while(c>0){if(c%2)m+=s[c+1];c=c-1>>1,s[c]+=d.weight}u+=d.weight*m})),u}function an(r){var e={},n=er(r.nodes(),function(s){return!r.children(s).length}),o=I(E(n,function(s){return r.node(s).rank})),i=E(N(o+1),function(){return[]});function a(s){if(gr(e,s))return;e[s]=!0;var u=r.node(s);i[u.rank].push(s),v(r.successors(s),a)}var f=C(n,function(s){return r.node(s).rank});return v(f,a),i}function fn(r,e){return E(e,function(n){var o=r.inEdges(n);if(!o.length)return{v:n};else{var i=ei(o,function(a,f){var s=r.edge(f),u=r.node(f.v);return{sum:a.sum+s.weight*u.order,weight:a.weight+s.weight}},{sum:0,weight:0});return{v:n,barycenter:i.sum/i.weight,weight:i.weight}}})}function sn(r,e){var n={};v(r,function(i,a){var f=n[i.v]={indegree:0,in:[],out:[],vs:[i.v],i:a};if(!Mt(i.barycenter))f.barycenter=i.barycenter,f.weight=i.weight}),v(e.edges(),function(i){var a=n[i.v],f=n[i.w];if(!Mt(a)&&!Mt(f))f.indegree++,a.out.push(n[i.w])});var o=er(n,function(i){return!i.indegree});return qf(o)}function qf(r){var e=[];function n(a){return function(f){if(f.merged)return;if(Mt(f.barycenter)||Mt(a.barycenter)||f.barycenter>=a.barycenter)Hf(a,f)}}function o(a){return function(f){if(f.in.push(a),--f.indegree===0)r.push(f)}}while(r.length){var i=r.pop();e.push(i),v(i.in.reverse(),n(i)),v(i.out,o(i))}return E(er(e,function(a){return!a.merged}),function(a){return K(a,["vs","i","barycenter","weight"])})}function Hf(r,e){var n=0,o=0;if(r.weight)n+=r.barycenter*r.weight,o+=r.weight;if(e.weight)n+=e.barycenter*e.weight,o+=e.weight;r.vs=e.vs.concat(r.vs),r.barycenter=n/o,r.weight=o,r.i=Math.min(e.i,r.i),e.merged=!0}function cn(r,e){var n=Pt(r,function(c){return Object.prototype.hasOwnProperty.call(c,"barycenter")}),o=n.lhs,i=C(n.rhs,function(c){return-c.i}),a=[],f=0,s=0,u=0;o.sort(Kf(!!e)),u=un(a,i,u),v(o,function(c){u+=c.vs.length,a.push(c.vs),f+=c.barycenter*c.weight,s+=c.weight,u=un(a,i,u)});var d={vs:S(a)};if(s)d.barycenter=f/s,d.weight=s;return d}function un(r,e,n){var o;while(e.length&&(o=G(e)).i<=n)e.pop(),r.push(o.vs),n++;return n}function Kf(r){return function(e,n){if(e.barycenter<n.barycenter)return-1;else if(e.barycenter>n.barycenter)return 1;return!r?e.i-n.i:n.i-e.i}}function Vr(r,e,n,o){var i=r.children(e),a=r.node(e),f=a?a.borderLeft:void 0,s=a?a.borderRight:void 0,u={};if(f)i=er(i,function(w){return w!==f&&w!==s});var d=fn(r,i);v(d,function(w){if(r.children(w.v).length){var y=Vr(r,w.v,n,o);if(u[w.v]=y,Object.prototype.hasOwnProperty.call(y,"barycenter"))Zf(w,y)}});var c=sn(d,n);Jf(c,u);var m=cn(c,o);if(f){if(m.vs=S([f,m.vs,s]),r.predecessors(f).length){var h=r.node(r.predecessors(f)[0]),b=r.node(r.predecessors(s)[0]);if(!Object.prototype.hasOwnProperty.call(m,"barycenter"))m.barycenter=0,m.weight=0;m.barycenter=(m.barycenter*m.weight+h.order+b.order)/(m.weight+2),m.weight+=2}}return m}function Jf(r,e){v(r,function(n){n.vs=S(n.vs.map(function(o){if(e[o])return e[o].vs;return o}))})}function Zf(r,e){if(!Mt(r.barycenter))r.barycenter=(r.barycenter*r.weight+e.barycenter*e.weight)/(r.weight+e.weight),r.weight+=e.weight;else r.barycenter=e.barycenter,r.weight=e.weight}function gn(r){var e=Ar(r),n=ln(r,N(1,e+1),"inEdges"),o=ln(r,N(e-1,-1,-1),"outEdges"),i=an(r);hn(r,i);var a=Number.POSITIVE_INFINITY,f;for(var s=0,u=0;u<4;++s,++u){$f(s%2?n:o,s%4>=2),i=B(r);var d=on(r,i);if(d<a)u=0,f=Fe(i),a=d}hn(r,f)}function ln(r,e,n){return E(e,function(o){return nn(r,o,n)})}function $f(r,e){var n=new Oe;v(r,function(o){var i=o.graph().root,a=Vr(o,i,n,e);v(a.vs,function(f,s){o.node(f).order=s}),tn(o,n,a.vs)})}function hn(r,e){v(e,function(n){v(n,function(o,i){r.node(o).order=i})})}function vn(r){var e=rs(r);v(r.graph().dummyChains,function(n){var o=r.node(n),i=o.edgeObj,a=Qf(r,e,i.v,i.w),{path:f,lca:s}=a,u=0,d=f[u],c=!0;while(n!==i.w){if(o=r.node(n),c){while((d=f[u])!==s&&r.node(d).maxRank<o.rank)u++;if(d===s)c=!1}if(!c){while(u<f.length-1&&r.node(d=f[u+1]).minRank<=o.rank)u++;d=f[u]}r.setParent(n,d),n=r.successors(n)[0]}})}function Qf(r,e,n,o){var i=[],a=[],f=Math.min(e[n].low,e[o].low),s=Math.max(e[n].lim,e[o].lim),u,d;u=n;do u=r.parent(u),i.push(u);while(u&&(e[u].low>f||s>e[u].lim));d=u,u=o;while((u=r.parent(u))!==d)a.push(u);return{path:i.concat(a.reverse()),lca:d}}function rs(r){var e={},n=0;function o(i){var a=n;v(r.children(i),o),e[i]={low:a,lim:n++}}return v(r.children(),o),e}function es(r,e){var n={};function o(i,a){var f=0,s=0,u=i.length,d=G(a);return v(a,function(c,m){var h=ns(r,c),b=h?r.node(h).order:u;if(h||c===d)v(a.slice(s,m+1),function(w){v(r.predecessors(w),function(y){var g=r.node(y),_=g.order;if((_<f||b<_)&&!(g.dummy&&r.node(w).dummy))bn(n,y,w)})}),s=m+1,f=b}),a}return ei(e,o),n}function ts(r,e){var n={};function o(a,f,s,u,d){var c;v(N(f,s),function(m){if(c=a[m],r.node(c).dummy)v(r.predecessors(c),function(h){var b=r.node(h);if(b.dummy&&(b.order<u||b.order>d))bn(n,h,c)})})}function i(a,f){var s=-1,u,d=0;return v(f,function(c,m){if(r.node(c).dummy==="border"){var h=r.predecessors(c);if(h.length)u=r.node(h[0]).order,o(f,d,m,s,u),d=m,s=u}o(f,d,f.length,u,a.length)}),f}return ei(e,i),n}function ns(r,e){if(r.node(e).dummy)return tr(r.predecessors(e),function(n){return r.node(n).dummy})}function bn(r,e,n){if(e>n){var o=e;e=n,n=o}if(!Object.prototype.hasOwnProperty.call(r,e))Object.defineProperty(r,e,{enumerable:!0,configurable:!0,value:{},writable:!0});var i=r[e];Object.defineProperty(i,n,{enumerable:!0,configurable:!0,value:!0,writable:!0})}function os(r,e,n){if(e>n){var o=e;e=n,n=o}return!!r[e]&&Object.prototype.hasOwnProperty.call(r[e],n)}function is(r,e,n,o){var i={},a={},f={};return v(e,function(s){v(s,function(u,d){i[u]=u,a[u]=u,f[u]=d})}),v(e,function(s){var u=-1;v(s,function(d){var c=o(d);if(c.length){c=C(c,function(y){return f[y]});var m=(c.length-1)/2;for(var h=Math.floor(m),b=Math.ceil(m);h<=b;++h){var w=c[h];if(a[d]===d&&u<f[w]&&!os(n,d,w))a[w]=d,a[d]=i[d]=i[w],u=f[w]}}})}),{root:i,align:a}}function as(r,e,n,o,i){var a={},f=fs(r,e,n,i),s=i?"borderLeft":"borderRight";function u(m,h){var b=f.nodes(),w=b.pop(),y={};while(w){if(y[w])m(w);else y[w]=!0,b.push(w),b=b.concat(h(w));w=b.pop()}}function d(m){a[m]=f.inEdges(m).reduce(function(h,b){return Math.max(h,a[b.v]+f.edge(b))},0)}function c(m){var h=f.outEdges(m).reduce(function(w,y){return Math.min(w,a[y.w]-f.edge(y))},Number.POSITIVE_INFINITY),b=r.node(m);if(h!==Number.POSITIVE_INFINITY&&b.borderType!==s)a[m]=Math.max(a[m],h)}return u(d,f.predecessors.bind(f)),u(c,f.successors.bind(f)),v(o,function(m){a[m]=a[n[m]]}),a}function fs(r,e,n,o){var i=new Oe,a=r.graph(),f=cs(a.nodesep,a.edgesep,o);return v(e,function(s){var u;v(s,function(d){var c=n[d];if(i.setNode(c),u){var m=n[u],h=i.edge(m,c);i.setEdge(m,c,Math.max(f(r,d,u),h||0))}u=d})}),i}function ss(r,e){return H(Dr(e),function(n){var{NEGATIVE_INFINITY:o,POSITIVE_INFINITY:i}=Number;return He(n,function(a,f){var s=ps(r,f)/2;o=Math.max(a+s,o),i=Math.min(a-s,i)}),o-i})}function us(r,e){var n=Dr(e),o=j(n),i=I(n);v(["u","d"],function(a){v(["l","r"],function(f){var s=a+f,u=r[s],d;if(u===e)return;var c=Dr(u);if(d=f==="l"?o-j(c):i-I(c),d)r[s]=z(u,function(m){return m+d})})})}function ds(r,e){return z(r.ul,function(n,o){if(e)return r[e.toLowerCase()][o];else{var i=C(E(r,o));return(i[1]+i[2])/2}})}function yn(r){var e=B(r),n=nr(es(r,e),ts(r,e)),o={},i;v(["u","d"],function(f){i=f==="u"?e:Dr(e).reverse(),v(["l","r"],function(s){if(s==="r")i=E(i,function(m){return Dr(m).reverse()});var u=(f==="u"?r.predecessors:r.successors).bind(r),d=is(r,i,n,u),c=as(r,i,d.root,d.align,s==="r");if(s==="r")c=z(c,function(m){return-m});o[f+s]=c})});var a=ss(r,o);return us(o,a),ds(o,r.graph().align)}function cs(r,e,n){return function(o,i,a){var f=o.node(i),s=o.node(a),u=0,d;if(u+=f.width/2,Object.prototype.hasOwnProperty.call(f,"labelpos"))switch(f.labelpos.toLowerCase()){case"l":d=-f.width/2;break;case"r":d=f.width/2;break}if(d)u+=n?d:-d;if(d=0,u+=(f.dummy?e:r)/2,u+=(s.dummy?e:r)/2,u+=s.width/2,Object.prototype.hasOwnProperty.call(s,"labelpos"))switch(s.labelpos.toLowerCase()){case"l":d=s.width/2;break;case"r":d=-s.width/2;break}if(d)u+=n?d:-d;return d=0,u}}function ps(r,e){return r.node(e).width}function wn(r){r=br(r),ls(r),Ke(yn(r),function(e,n){r.node(n).x=e})}function ls(r){var e=B(r),n=r.graph().ranksep,o=0;v(e,function(i){var a=I(E(i,function(f){return r.node(f).height}));v(i,function(f){r.node(f).y=o+a/2}),o+=a+n})}function Wr(r,e){var n=e&&e.debugTiming?kt:Tt;n("layout",()=>{var o=n(" buildLayoutGraph",()=>Os(r));n(" runLayout",()=>ms(o,n)),n(" updateInputGraph",()=>hs(r,o))})}function ms(r,e){e(" makeSpaceForEdgeLabels",()=>Ls(r)),e(" removeSelfEdges",()=>js(r)),e(" acyclic",()=>xt(r)),e(" nestingGraph.run",()=>Qt(r)),e(" rank",()=>Ur(br(r))),e(" injectEdgeLabelProxies",()=>Ss(r)),e(" removeEmptyRanks",()=>Nt(r)),e(" nestingGraph.cleanup",()=>en(r)),e(" normalizeRanks",()=>St(r)),e(" assignRankMinMax",()=>Ns(r)),e(" removeEdgeLabelProxies",()=>Ps(r)),e(" normalize.run",()=>Xt(r)),e(" parentDummyChains",()=>vn(r)),e(" addBorderSegments",()=>At(r)),e(" order",()=>gn(r)),e(" insertSelfEdges",()=>Bs(r)),e(" adjustCoordinateSystem",()=>Bt(r)),e(" position",()=>wn(r)),e(" positionSelfEdges",()=>Ds(r)),e(" removeBorderNodes",()=>Ms(r)),e(" normalize.undo",()=>Ut(r)),e(" fixupEdgeLabelCoords",()=>As(r)),e(" undoCoordinateSystem",()=>Dt(r)),e(" translateGraph",()=>Ts(r)),e(" assignNodeIntersects",()=>Cs(r)),e(" reversePoints",()=>Rs(r)),e(" acyclic.undo",()=>Ot(r))}function hs(r,e){v(r.nodes(),function(n){var o=r.node(n),i=e.node(n);if(o){if(o.x=i.x,o.y=i.y,e.children(n).length)o.width=i.width,o.height=i.height}}),v(r.edges(),function(n){var o=r.edge(n),i=e.edge(n);if(o.points=i.points,Object.prototype.hasOwnProperty.call(i,"x"))o.x=i.x,o.y=i.y}),r.graph().width=e.graph().width,r.graph().height=e.graph().height}var gs=["nodesep","edgesep","ranksep","marginx","marginy"],vs={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},bs=["acyclicer","ranker","rankdir","align"],ys=["width","height"],ws={width:0,height:0},_s=["minlen","weight","width","height","labeloffset"],Es={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},xs=["labelpos"];function Os(r){var e=new Oe({multigraph:!0,compound:!0}),n=zr(r.graph());return e.setGraph(nr({},vs,Yr(n,gs),K(n,bs))),v(r.nodes(),function(o){var i=zr(r.node(o));e.setNode(o,Xe(Yr(i,ys),ws)),e.setParent(o,r.parent(o))}),v(r.edges(),function(o){var i=zr(r.edge(o));e.setEdge(o,nr({},Es,Yr(i,_s),K(i,xs)))}),e}function Ls(r){var e=r.graph();e.ranksep/=2,v(r.edges(),function(n){var o=r.edge(n);if(o.minlen*=2,o.labelpos.toLowerCase()!=="c")if(e.rankdir==="TB"||e.rankdir==="BT")o.width+=o.labeloffset;else o.height+=o.labeloffset})}function Ss(r){v(r.edges(),function(e){var n=r.edge(e);if(n.width&&n.height){var o=r.node(e.v),i=r.node(e.w),a={rank:(i.rank-o.rank)/2+o.rank,e};k(r,"edge-proxy",a,"_ep")}})}function Ns(r){var e=0;v(r.nodes(),function(n){var o=r.node(n);if(o.borderTop)o.minRank=r.node(o.borderTop).rank,o.maxRank=r.node(o.borderBottom).rank,e=I(e,o.maxRank)}),r.graph().maxRank=e}function Ps(r){v(r.nodes(),function(e){var n=r.node(e);if(n.dummy==="edge-proxy")r.edge(n.e).labelRank=n.rank,r.removeNode(e)})}function Ts(r){var e=Number.POSITIVE_INFINITY,n=0,o=Number.POSITIVE_INFINITY,i=0,a=r.graph(),f=a.marginx||0,s=a.marginy||0;function u(d){var{x:c,y:m,width:h,height:b}=d;e=Math.min(e,c-h/2),n=Math.max(n,c+h/2),o=Math.min(o,m-b/2),i=Math.max(i,m+b/2)}v(r.nodes(),function(d){u(r.node(d))}),v(r.edges(),function(d){var c=r.edge(d);if(Object.prototype.hasOwnProperty.call(c,"x"))u(c)}),e-=f,o-=s,v(r.nodes(),function(d){var c=r.node(d);c.x-=e,c.y-=o}),v(r.edges(),function(d){var c=r.edge(d);if(v(c.points,function(m){m.x-=e,m.y-=o}),Object.prototype.hasOwnProperty.call(c,"x"))c.x-=e;if(Object.prototype.hasOwnProperty.call(c,"y"))c.y-=o}),a.width=n-e+f,a.height=i-o+s}function Cs(r){v(r.edges(),function(e){var n=r.edge(e),o=r.node(e.v),i=r.node(e.w),a,f;if(!n.points)n.points=[],a=i,f=o;else a=n.points[0],f=n.points[n.points.length-1];n.points.unshift(kr(o,a)),n.points.push(kr(i,f))})}function As(r){v(r.edges(),function(e){var n=r.edge(e);if(Object.prototype.hasOwnProperty.call(n,"x")){if(n.labelpos==="l"||n.labelpos==="r")n.width-=n.labeloffset;switch(n.labelpos){case"l":n.x-=n.width/2+n.labeloffset;break;case"r":n.x+=n.width/2+n.labeloffset;break}}})}function Rs(r){v(r.edges(),function(e){var n=r.edge(e);if(n.reversed)n.points.reverse()})}function Ms(r){v(r.nodes(),function(e){if(r.children(e).length){var n=r.node(e),o=r.node(n.borderTop),i=r.node(n.borderBottom),a=r.node(G(n.borderLeft)),f=r.node(G(n.borderRight));n.width=Math.abs(f.x-a.x),n.height=Math.abs(i.y-o.y),n.x=a.x+n.width/2,n.y=o.y+n.height/2}}),v(r.nodes(),function(e){if(r.node(e).dummy==="border")r.removeNode(e)})}function js(r){v(r.edges(),function(e){if(e.v===e.w){var n=r.node(e.v);if(!n.selfEdges)n.selfEdges=[];n.selfEdges.push({e,label:r.edge(e)}),r.removeEdge(e)}})}function Bs(r){var e=B(r);v(e,function(n){var o=0;v(n,function(i,a){var f=r.node(i);f.order=a+o,v(f.selfEdges,function(s){k(r,"selfedge",{width:s.label.width,height:s.label.height,rank:f.rank,order:a+ ++o,e:s.e,label:s.label},"_se")}),delete f.selfEdges})})}function Ds(r){v(r.nodes(),function(e){var n=r.node(e);if(n.dummy==="selfedge"){var o=r.node(n.e.v),i=o.x+o.width/2,a=o.y,f=n.x-i,s=o.height/2;r.setEdge(n.e,n.label),r.removeNode(e),n.label.points=[{x:i+2*f/3,y:a-s},{x:i+5*f/6,y:a-s},{x:i+f,y:a},{x:i+5*f/6,y:a+s},{x:i+2*f/3,y:a+s}],n.label.x=n.x,n.label.y=n.y}})}function Yr(r,e){return z(K(r,e),Number)}function zr(r){var e={};return v(r,function(n,o){e[o.toLowerCase()]=n}),e}var _n=t((r,e,n)=>Math.max(e,Math.min(n,r)),"clamp"),En=t((r="TB")=>{switch(r){case"BT":return"bottom";case"LR":return"right";case"RL":return"left";case"TB":default:return"top"}},"getDefaultSelfLoopSide"),Fs=t((r)=>r==="flowchart"||r==="flowchart-v2"||r==="stateDiagram"||r==="er"||r==="classDiagram","shouldMergeSelfLoopSegments"),Gs=["x","y","width","height","labelBBox","intersect","calcIntersect","diff","clusterNode"],Xs=t((r,e,n,o,i)=>{let a=[],f=new Set;if(n.forEach(({start:c,end:m})=>{if(c!==o)f.add(c);if(m!==o)f.add(m)}),f.forEach((c)=>{let m=r.node(c);if(typeof m?.x==="number"&&typeof m?.y==="number")a.push(m)}),a.length===0)n.forEach(({edge:c})=>{(c.points??[]).forEach((m)=>{if(typeof m?.x==="number"&&typeof m?.y==="number")a.push(m)})});if(a.length===0)return En(i);let s=a.reduce((c,m)=>({x:c.x+m.x/a.length,y:c.y+m.y/a.length}),{x:0,y:0}),u=s.x-e.x,d=s.y-e.y;if(Math.abs(u)>Math.abs(d))return u>0?"right":"left";if(Math.abs(d)>0)return d>0?"bottom":"top";return En(i)},"getSelfLoopSide"),Us=t((r,e="top",n=0,o=0)=>{let i=r.x,a=r.y-n,f=r.width/2,s=r.height/2,u=Math.max(36,Math.min(100,r.width*0.8)),d=_n(Math.max(o,r.width*0.35),36,u),c=_n(Math.min(r.width,r.height)*0.45,24,48);switch(e){case"bottom":{let m=a+s;return[{x:i-d/2,y:m},{x:i-d/2,y:m+c},{x:i+d/2,y:m+c},{x:i+d/2,y:m}]}case"right":{let m=i+f;return[{x:m,y:a-d/2},{x:m+c,y:a-d/2},{x:m+c,y:a+d/2},{x:m,y:a+d/2}]}case"left":{let m=i-f;return[{x:m,y:a-d/2},{x:m-c,y:a-d/2},{x:m-c,y:a+d/2},{x:m,y:a+d/2}]}case"top":default:{let m=a-s;return[{x:i-d/2,y:m},{x:i-d/2,y:m-c},{x:i+d/2,y:m-c},{x:i+d/2,y:m}]}}},"getSelfLoopPoints"),Vs=t((r,e,n="top",o=0,i={})=>{let f=r.x,s=r.y-o,u=i.width??0,d=i.height??0;switch(n){case"bottom":return{x:f,y:Math.max(...e.map((c)=>c.y))+d/2+4};case"right":return{x:Math.max(...e.map((c)=>c.x))+u/2+4,y:s};case"left":return{x:Math.min(...e.map((c)=>c.x))-u/2-4,y:s};case"top":default:return{x:f,y:Math.min(...e.map((c)=>c.y))-d/2-4}}},"getSelfLoopLabelPosition"),On=t((r,e=0,{mergeSelfLoops:n=!0}={})=>{let o=new Map,i=[],a=r.graph()?.rankdir;return r.edges().forEach((f)=>{let s=r.edge(f);if(n&&s.selfLoop){let u=s.selfLoop.id;if(!o.has(u))o.set(u,[]);o.get(u).push({edge:s,start:f.v,end:f.w})}else i.push({edge:s,start:f.v,end:f.w})}),o.forEach((f)=>{if(f.length!==3){f.forEach((_)=>i.push(_));return}f.sort((_,A)=>_.edge.selfLoop.order-A.edge.selfLoop.order);let[s,u,d]=f,c=s.edge.originalEdge??u.edge.originalEdge??d.edge.originalEdge??u.edge,m=r.node(c.start);if(!m){f.forEach((_)=>i.push(_));return}let h={width:u.edge.width,height:u.edge.height},b=Xs(r,m,f,c.start,a),w=Us(m,b,e,h.width??0),y=Vs(m,w,b,e,h),g={...u.edge,...c,id:c.id,points:w,start:c.start,end:c.end,x:y.x,y:y.y,width:h.width,height:h.height,labelStyle:u.edge.labelStyle,fromCluster:s.edge.fromCluster??u.edge.fromCluster??d.edge.fromCluster,toCluster:s.edge.toCluster??u.edge.toCluster??d.edge.toCluster};delete g.selfLoop,delete g.originalEdge,i.push({edge:g,start:g.start,end:g.end})}),i},"getEdgesToRender"),Ln=t(async({element:r,graph:e,diagramType:n,id:o,parentCluster:i,siteConfig:a})=>{let f=e.graph().rankdir;l.trace("Dir in recursive render - dir:",f);let{clusters:s,edgePaths:u,edgeLabels:d,nodes:c,rootGroups:m}=fd(r,{edgePathsClass:"edgePaths"});if(!e.nodes())l.info("No nodes found for",e);else l.info("Recursive render XXX",e.nodes());if(e.edges().length>0)l.info("Recursive edges",e.edge(e.edges()[0]));let h=Fs(n);await Promise.all(e.nodes().map(async function(y){let g=e.node(y);if(i!==void 0){let _=JSON.parse(JSON.stringify(i.clusterData));if(l.trace(`Setting data for parent cluster XXX
2
2
  Node.id = `,y,`
3
3
  data=`,_.height,`
4
- Parent cluster`,i.height),e.setNode(i.id,_),!e.parent(y))l.trace("Setting parent",y,i.id),e.setParent(y,i.id,_)}if(l.info("(Insert) Node XXX"+y+": "+JSON.stringify(e.node(y))),g?.clusterNode){l.info("Cluster identified XBX",y,g.width,e.node(y));let{ranksep:_,nodesep:A}=e.graph();g.graph.setGraph({...g.graph.graph(),ranksep:_+25,nodesep:A});let Wr=await Hs({element:c,graph:g.graph,diagramType:n,id:o,parentCluster:e.node(y),siteConfig:a}),qr=Wr.elem;q(g,qr),g.diff=Wr.diff||0,l.info("New compound node after recursive render XAX",y,"width",g.width,"height",g.height),yA(qr,g)}else if(e.children(y).length>0)l.trace("Cluster - the non recursive path XBX",y,g.id,g,g.width,"Graph:",e),l.trace(ks(g.id,e)),Ae.set(g.id,{id:ks(g.id,e),node:g});else l.trace("Node - the non recursive path XAX",y,c,e.node(y),f),await md(c,e.node(y),{config:a,dir:f})})),await t(async()=>{let y=e.edges().map(async function(g){let _=e.edge(g.v,g.w,g.name);if(l.info("Edge "+g.v+" -> "+g.w+": "+JSON.stringify(g)),l.info("Edge "+g.v+" -> "+g.w+": ",g," ",JSON.stringify(e.edge(g))),l.info("Fix",Ae,"ids:",g.v,g.w,"Translating: ",Ae.get(g.v),Ae.get(g.w)),h&&_.selfLoop){if(_.selfLoop.order!==1)return;let A={..._.originalEdge,..._,id:_.selfLoop.id,startLabelLeft:_.originalEdge?.startLabelLeft??_.startLabelLeft,startLabelRight:_.originalEdge?.startLabelRight??_.startLabelRight,endLabelLeft:_.originalEdge?.endLabelLeft??_.endLabelLeft,endLabelRight:_.originalEdge?.endLabelRight??_.endLabelRight};await la(d,A),_.width=A.width,_.height=A.height,_.labelStyle=A.labelStyle;return}await la(d,_)});await Promise.all(y)},"processEdges")();let{subGraphTitleTotalMargin:w}=oa(a);return{elem:m,graph:e,groups:{clusters:s,edgePaths:u,edgeLabels:d,nodes:c,rootGroups:m},diagramType:n,id:o,mergeSelfLoops:h,subGraphTitleTotalMargin:w}},"measureDagreGraph"),Ln=t((r)=>{l.info("############################################# XXX"),l.info("### Layout ### XXX"),l.info("############################################# XXX"),zr(r)},"runDagreGraphLayout"),Ys=t((r,e,n)=>{let o=r.node(e);if(!o)return;let i={...o};if(o?.clusterNode)i.y=(o.y??0)+n;else if(r.children(e).length>0)i.height=(o.height??0)+n;else i.y=(o.y??0)+n/2;return i},"normalizeDagreNode"),En=t((r,e)=>{Gs.forEach((n)=>{if(e[n]!==void 0)r[n]=e[n]})},"applyDagreNodeLayout"),zs=t((r,e,n,o)=>({...r,start:r.start??e,end:r.end??n,points:(r.points??[]).map((i)=>({...i,y:typeof i.y==="number"?i.y+o:i.y}))}),"normalizeDagreEdge"),Ws=t((r,e)=>{let{graph:n,mergeSelfLoops:o,subGraphTitleTotalMargin:i=0}=e,a=new Map(r.nodes.map((s)=>[s.id,s]));fd(n).forEach((s)=>{let u=Ys(n,s,i);if(!u)return;En(n.node(s),u);let d=a.get(s);if(d)En(d,u)});let f=i/2;return r.edges=xn(n,f,{mergeSelfLoops:o}).map(({edge:s,start:u,end:d})=>zs(s,u,d,f)),r},"applyDagreLayoutResult"),qs=t(async({elem:r,graph:e,groups:{clusters:n,edgePaths:o},diagramType:i,id:a,mergeSelfLoops:f,subGraphTitleTotalMargin:s})=>{let u=0;await Promise.all(fd(e).map(async function(m){let h=e.node(m);if(l.info("Position XBX => "+m+": ("+h.x,","+h.y,") width: ",h.width," height: ",h.height),h?.clusterNode)h.y+=s,l.info("A tainted cluster node XBX1",m,h.id,h.width,h.height,h.x,h.y,e.parent(m)),Ae.get(h.id).node=h,Mr(h);else if(e.children(m).length>0){l.info("A pure cluster node XBX1",m,h.id,h.x,h.y,h.width,h.height,e.parent(m)),h.height+=s,e.node(h.parentId);let b=h?.padding/2||0,w=h?.labelBBox?.height||0,y=w-b||0;l.debug("OffsetY",y,"labelHeight",w,"halfPadding",b),await ai(n,h),Ae.get(h.id).node=h}else{let b=e.node(h.parentId);h.y+=s/2,l.info("A regular node XBX1 - using the padding",h.id,"parent",h.parentId,h.width,h.height,h.x,h.y,"offsetY",h.offsetY,"parent",b,b?.offsetY,h),Mr(h)}}));let d=s/2;return xn(e,d,{mergeSelfLoops:f}).forEach(function({edge:m,start:h,end:b}){l.info("Edge "+h+" -> "+b+": "+JSON.stringify(m),m),m.points.forEach((_)=>_.y+=d);let w=e.node(h),y=e.node(b),g=ii(o,m,Ae,i,w,y,a);Is(m,g)}),e.nodes().forEach(function(m){let h=e.node(m);if(l.info(m,h.type,h.diff),h.isGroup)u=h.diff}),l.warn("Returning from recursive render XAX",r,u),{elem:r,diff:u}},"paintDagreLayoutCore"),Hs=t(async(r)=>{let e=await On(r);return Ln(e.graph),await qs(e)},"renderDagreSubgraph"),In=t((r)=>{let e=new Oe({multigraph:!0,compound:!0}).setGraph({rankdir:r.direction,nodesep:r.config?.nodeSpacing||r.nodeSpacing||r.config?.flowchart?.nodeSpacing,ranksep:r.config?.rankSpacing||r.rankSpacing||r.config?.flowchart?.rankSpacing,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}});return r.nodes.forEach((n)=>{if(e.setNode(n.id,{...n}),n.parentId)e.setParent(n.id,n.parentId)}),l.debug("Edges:",r.edges),r.edges.forEach((n)=>{if(n.start===n.end){let o=n.start,i=o+"---"+o+"---1",a=o+"---"+o+"---2",f=e.node(o);e.setNode(i,{domId:i,id:i,parentId:f.parentId,labelStyle:"",label:"",padding:0,shape:"labelRect",style:"",width:10,height:10}),e.setParent(i,f.parentId),e.setNode(a,{domId:a,id:a,parentId:f.parentId,labelStyle:"",padding:0,shape:"labelRect",label:"",style:"",width:10,height:10}),e.setParent(a,f.parentId);let s=structuredClone(n),u=structuredClone(n),d=structuredClone(n),c=structuredClone(n);if(u.originalEdge=s,u.selfLoop={id:s.id,order:0},d.originalEdge=s,d.selfLoop={id:s.id,order:1},c.originalEdge=s,c.selfLoop={id:s.id,order:2},u.label="",u.arrowTypeEnd="none",u.endLabelLeft="",u.endLabelRight="",u.startLabelLeft="",u.id=o+"-cyclic-special-1",d.startLabelRight="",d.startLabelLeft="",d.endLabelLeft="",d.endLabelRight="",d.arrowTypeStart="none",d.arrowTypeEnd="none",d.id=o+"-cyclic-special-mid",c.label="",c.startLabelRight="",c.startLabelLeft="",c.arrowTypeStart="none",f.isGroup)u.fromCluster=o,c.toCluster=o;c.id=o+"-cyclic-special-2",c.arrowTypeStart="none",e.setEdge(o,i,u,o+"-cyclic-special-0"),e.setEdge(i,a,d,o+"-cyclic-special-1"),e.setEdge(a,o,c,o+"-cyclic-special-2")}else e.setEdge(n.start,n.end,{...n},n.id)}),sA(e),{graph:e}},"prepareLayoutForDagre"),Ks=t(async(r,{element:e,preparedLayout:n})=>{let o=n??In(r),i=p(),a=await On({element:e,graph:o.graph,diagramType:r.type,id:r.diagramId,parentCluster:void 0,siteConfig:i});return o.measuredLayout=a,a},"measureDagreLayout"),Js=t((r,e)=>{let n=e.preparedLayout?.measuredLayout;if(!n)throw Error("runDagreLayoutCore requires measureDagreLayout to run first");return Ln(n.graph),Ws(r,n),n},"runDagreLayoutCore"),Zs=t((r,{measure:e})=>fd(e.graph).map((n)=>e.graph.node(n)).filter(Boolean),"getDagrePaintNodes"),$s=t((r,e,{measure:n})=>r?n.graph.node(r):void 0,"getDagreEdgeNode"),qg=Li({prepareLayout:In,measureLayout:Ks,runLayoutCore:Js,paintOptions:{clusterDb:Ae,getNodes:Zs,getEdgeNode:$s,skipNode:t((r,{measure:e})=>!e.graph.hasNode(r.id),"skipNode"),isCluster:t((r,{measure:e})=>e.graph.hasNode(r.id)&&(e.graph.children(r.id)??[]).length>0,"isCluster")}});export{Ws as applyDagreLayoutResult,xn as getEdgesToRender,Ks as measureDagreLayout,In as prepareLayoutForDagre,qg as render,Js as runDagreLayoutCore};
4
+ Parent cluster`,i.height),e.setNode(i.id,_),!e.parent(y))l.trace("Setting parent",y,i.id),e.setParent(y,i.id,_)}if(l.info("(Insert) Node XXX"+y+": "+JSON.stringify(e.node(y))),g?.clusterNode){l.info("Cluster identified XBX",y,g.width,e.node(y));let{ranksep:_,nodesep:A}=e.graph();g.graph.setGraph({...g.graph.graph(),ranksep:_+25,nodesep:A});let qr=await Hs({element:c,graph:g.graph,diagramType:n,id:o,parentCluster:e.node(y),siteConfig:a}),Hr=qr.elem;q(g,Hr),g.diff=qr.diff||0,l.info("New compound node after recursive render XAX",y,"width",g.width,"height",g.height),kA(Hr,g)}else if(e.children(y).length>0)l.trace("Cluster - the non recursive path XBX",y,g.id,g,g.width,"Graph:",e),l.trace(ks(g.id,e)),Ae.set(g.id,{id:ks(g.id,e),node:g});else l.trace("Node - the non recursive path XAX",y,c,e.node(y),f),await Ad(c,e.node(y),{config:a,dir:f})})),await t(async()=>{let y=e.edges().map(async function(g){let _=e.edge(g.v,g.w,g.name);if(l.info("Edge "+g.v+" -> "+g.w+": "+JSON.stringify(g)),l.info("Edge "+g.v+" -> "+g.w+": ",g," ",JSON.stringify(e.edge(g))),l.info("Fix",Ae,"ids:",g.v,g.w,"Translating: ",Ae.get(g.v),Ae.get(g.w)),h&&_.selfLoop){if(_.selfLoop.order!==1)return;let A={..._.originalEdge,..._,id:_.selfLoop.id,startLabelLeft:_.originalEdge?.startLabelLeft??_.startLabelLeft,startLabelRight:_.originalEdge?.startLabelRight??_.startLabelRight,endLabelLeft:_.originalEdge?.endLabelLeft??_.endLabelLeft,endLabelRight:_.originalEdge?.endLabelRight??_.endLabelRight};await ca(d,A),_.width=A.width,_.height=A.height,_.labelStyle=A.labelStyle;return}await ca(d,_)});await Promise.all(y)},"processEdges")();let{subGraphTitleTotalMargin:w}=sa(a);return{elem:m,graph:e,groups:{clusters:s,edgePaths:u,edgeLabels:d,nodes:c,rootGroups:m},diagramType:n,id:o,mergeSelfLoops:h,subGraphTitleTotalMargin:w}},"measureDagreGraph"),In=t((r)=>{l.info("############################################# XXX"),l.info("### Layout ### XXX"),l.info("############################################# XXX"),Wr(r)},"runDagreGraphLayout"),Ys=t((r,e,n)=>{let o=r.node(e);if(!o)return;let i={...o};if(o?.clusterNode)i.y=(o.y??0)+n;else if(r.children(e).length>0)i.height=(o.height??0)+n;else i.y=(o.y??0)+n/2;return i},"normalizeDagreNode"),xn=t((r,e)=>{Gs.forEach((n)=>{if(e[n]!==void 0)r[n]=e[n]})},"applyDagreNodeLayout"),zs=t((r,e,n,o)=>({...r,start:r.start??e,end:r.end??n,points:(r.points??[]).map((i)=>({...i,y:typeof i.y==="number"?i.y+o:i.y}))}),"normalizeDagreEdge"),Ws=t((r,e)=>{let{graph:n,mergeSelfLoops:o,subGraphTitleTotalMargin:i=0}=e,a=new Map(r.nodes.map((s)=>[s.id,s]));gd(n).forEach((s)=>{let u=Ys(n,s,i);if(!u)return;xn(n.node(s),u);let d=a.get(s);if(d)xn(d,u)});let f=i/2;return r.edges=On(n,f,{mergeSelfLoops:o}).map(({edge:s,start:u,end:d})=>zs(s,u,d,f)),r},"applyDagreLayoutResult"),qs=t(async({elem:r,graph:e,groups:{clusters:n,edgePaths:o},diagramType:i,id:a,mergeSelfLoops:f,subGraphTitleTotalMargin:s})=>{let u=0;await Promise.all(gd(e).map(async function(m){let h=e.node(m);if(l.info("Position XBX => "+m+": ("+h.x,","+h.y,") width: ",h.width," height: ",h.height),h?.clusterNode)h.y+=s,l.info("A tainted cluster node XBX1",m,h.id,h.width,h.height,h.x,h.y,e.parent(m)),Ae.get(h.id).node=h,Lr(h);else if(e.children(m).length>0){l.info("A pure cluster node XBX1",m,h.id,h.x,h.y,h.width,h.height,e.parent(m)),h.height+=s,e.node(h.parentId);let b=h?.padding/2||0,w=h?.labelBBox?.height||0,y=w-b||0;l.debug("OffsetY",y,"labelHeight",w,"halfPadding",b),await ii(n,h),Ae.get(h.id).node=h}else{let b=e.node(h.parentId);h.y+=s/2,l.info("A regular node XBX1 - using the padding",h.id,"parent",h.parentId,h.width,h.height,h.x,h.y,"offsetY",h.offsetY,"parent",b,b?.offsetY,h),Lr(h)}}));let d=s/2;return On(e,d,{mergeSelfLoops:f}).forEach(function({edge:m,start:h,end:b}){l.info("Edge "+h+" -> "+b+": "+JSON.stringify(m),m),m.points.forEach((_)=>_.y+=d);let w=e.node(h),y=e.node(b),g=oi(o,m,Ae,i,w,y,a);Is(m,g)}),e.nodes().forEach(function(m){let h=e.node(m);if(l.info(m,h.type,h.diff),h.isGroup)u=h.diff}),l.warn("Returning from recursive render XAX",r,u),{elem:r,diff:u}},"paintDagreLayoutCore"),Hs=t(async(r)=>{let e=await Ln(r);return In(e.graph),await qs(e)},"renderDagreSubgraph"),Sn=t((r)=>{let e=new Oe({multigraph:!0,compound:!0}).setGraph({rankdir:r.direction,nodesep:r.config?.nodeSpacing||r.nodeSpacing||r.config?.flowchart?.nodeSpacing,ranksep:r.config?.rankSpacing||r.rankSpacing||r.config?.flowchart?.rankSpacing,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}});return r.nodes.forEach((n)=>{if(e.setNode(n.id,{...n}),n.parentId)e.setParent(n.id,n.parentId)}),l.debug("Edges:",r.edges),r.edges.forEach((n)=>{if(n.start===n.end){let o=n.start,i=o+"---"+o+"---1",a=o+"---"+o+"---2",f=e.node(o);e.setNode(i,{domId:i,id:i,parentId:f.parentId,labelStyle:"",label:"",padding:0,shape:"labelRect",style:"",width:10,height:10}),e.setParent(i,f.parentId),e.setNode(a,{domId:a,id:a,parentId:f.parentId,labelStyle:"",padding:0,shape:"labelRect",label:"",style:"",width:10,height:10}),e.setParent(a,f.parentId);let s=structuredClone(n),u=structuredClone(n),d=structuredClone(n),c=structuredClone(n);if(u.originalEdge=s,u.selfLoop={id:s.id,order:0},d.originalEdge=s,d.selfLoop={id:s.id,order:1},c.originalEdge=s,c.selfLoop={id:s.id,order:2},u.label="",u.arrowTypeEnd="none",u.endLabelLeft="",u.endLabelRight="",u.startLabelLeft="",u.id=o+"-cyclic-special-1",d.startLabelRight="",d.startLabelLeft="",d.endLabelLeft="",d.endLabelRight="",d.arrowTypeStart="none",d.arrowTypeEnd="none",d.id=o+"-cyclic-special-mid",c.label="",c.startLabelRight="",c.startLabelLeft="",c.arrowTypeStart="none",f.isGroup)u.fromCluster=o,c.toCluster=o;c.id=o+"-cyclic-special-2",c.arrowTypeStart="none",e.setEdge(o,i,u,o+"-cyclic-special-0"),e.setEdge(i,a,d,o+"-cyclic-special-1"),e.setEdge(a,o,c,o+"-cyclic-special-2")}else e.setEdge(n.start,n.end,{...n},n.id)}),cA(e),{graph:e}},"prepareLayoutForDagre"),Ks=t(async(r,{element:e,preparedLayout:n})=>{let o=n??Sn(r),i=p(),a=await Ln({element:e,graph:o.graph,diagramType:r.type,id:r.diagramId,parentCluster:void 0,siteConfig:i});return o.measuredLayout=a,a},"measureDagreLayout"),Js=t((r,e)=>{let n=e.preparedLayout?.measuredLayout;if(!n)throw Error("runDagreLayoutCore requires measureDagreLayout to run first");return In(n.graph),Ws(r,n),n},"runDagreLayoutCore"),Zs=t((r,{measure:e})=>gd(e.graph).map((n)=>e.graph.node(n)).filter(Boolean),"getDagrePaintNodes"),$s=t((r,e,{measure:n})=>r?n.graph.node(r):void 0,"getDagreEdgeNode"),qg=Pi({prepareLayout:Sn,measureLayout:Ks,runLayoutCore:Js,paintOptions:{clusterDb:Ae,getNodes:Zs,getEdgeNode:$s,skipNode:t((r,{measure:e})=>!e.graph.hasNode(r.id),"skipNode"),isCluster:t((r,{measure:e})=>e.graph.hasNode(r.id)&&(e.graph.children(r.id)??[]).length>0,"isCluster")}});export{Ws as applyDagreLayoutResult,On as getEdgesToRender,Ks as measureDagreLayout,Sn as prepareLayoutForDagre,qg as render,Js as runDagreLayoutCore};