@kabmo-labs/kabmo 0.48.0 → 0.50.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (647) hide show
  1. package/dist/client/index.html +1 -1
  2. package/dist/client/index.js +608 -550
  3. package/dist/client/static/js/{Body-3tspyjtk.js → Body-pd3nt4xa.js} +3 -3
  4. package/dist/client/static/js/{CsvGrid-3pwsfmxp.js → CsvGrid-eksmqv8f.js} +2 -2
  5. package/dist/client/static/js/{DocxView-xcg9jktb.js → DocxView-xfx1kt8x.js} +22 -22
  6. package/dist/client/static/js/{DrawioView-2q19tgkx.js → DrawioView-2xyqg9bv.js} +2 -2
  7. package/dist/client/static/js/{HtmlPreview-92cadvbr.js → HtmlPreview-ps3f0aa5.js} +1 -1
  8. package/dist/client/static/js/ImageView-7vse3k6x.js +1 -0
  9. package/dist/client/static/js/LayoutWrapper-qdp83fps.js +2 -0
  10. package/dist/client/static/js/MergeDiffView-hzsccppq.js +1 -0
  11. package/dist/client/static/js/Modal-zw9x5b6f.js +60 -0
  12. package/dist/client/static/js/PdfView-8fp08jym.js +1 -0
  13. package/dist/client/static/js/SessionsView-qmgg03fv.js +1 -0
  14. package/dist/client/static/js/{SheetView-w5w2m2de.js → SheetView-g7mstjdp.js} +46 -46
  15. package/dist/client/static/js/{SvgPreview-mtk6de6h.js → SvgPreview-wsv4h6c6.js} +1 -1
  16. package/dist/client/static/js/{abnfDiagram-O67JEVCF-tha4j2fn.js → abnfDiagram-O67JEVCF-1kgm1049.js} +1 -1
  17. package/dist/client/static/js/architecture-7GRP2DOG-g7b64973.js +1 -0
  18. package/dist/client/static/js/architectureDiagram-NJMV4G6O-mtm210rw.js +36 -0
  19. package/dist/client/static/js/{astro-r4dp34pw.js → astro-dszrfwwn.js} +1 -1
  20. package/dist/client/static/js/bash-z5pe89pt.js +1 -0
  21. package/dist/client/static/js/{blockDiagram-BEXU5L5S-6mzgfqh8.js → blockDiagram-BEXU5L5S-s474vn2w.js} +9 -9
  22. package/dist/client/static/js/c-fy0fysfw.js +1 -0
  23. package/dist/client/static/js/{c4Diagram-YGBWAQC7-sfkcw7g9.js → c4Diagram-YGBWAQC7-s68v6tc8.js} +3 -3
  24. package/dist/client/static/js/{classDiagram-v2-NBCMYWYE-v530ny5e.js → classDiagram-v2-NBCMYWYE-291va3yk.js} +9 -9
  25. package/dist/client/static/js/cose-bilkent-JH36ORCC-0zg7crdw.js +1 -0
  26. package/dist/client/static/js/cpp-wam8dze6.js +1 -0
  27. package/dist/client/static/js/css-ke51m4kc.js +1 -0
  28. package/dist/client/static/js/css-yryw442h.js +1 -0
  29. package/dist/client/static/js/cynefin-OW5HDTMX-8bscrcct.js +1 -0
  30. package/dist/client/static/js/{cynefinDiagram-VND7K2PF-k8f3z0mm.js → cynefinDiagram-VND7K2PF-4gnmn3yc.js} +2 -2
  31. package/dist/client/static/js/dagre-6A5THRUB-nxmj6bkg.js +4 -0
  32. package/dist/client/static/js/{diagram-22UHCM2B-2zh2957c.js → diagram-22UHCM2B-3171dabw.js} +25 -25
  33. package/dist/client/static/js/diagram-3UASUU5V-9h1pd6h8.js +24 -0
  34. package/dist/client/static/js/{diagram-ATOU4E4O-16adx4g0.js → diagram-ATOU4E4O-ywfrbd6m.js} +3 -3
  35. package/dist/client/static/js/{diagram-CDSNMT55-1ja98ens.js → diagram-CDSNMT55-t87b4wbk.js} +5 -5
  36. package/dist/client/static/js/{diagram-MLGK6HIB-f9nnyjbq.js → diagram-MLGK6HIB-bzv52p97.js} +2 -2
  37. package/dist/client/static/js/{diagram-MPIPVDR6-3qgadfjz.js → diagram-MPIPVDR6-8f66rp0a.js} +2 -2
  38. package/dist/client/static/js/{dockerfile-04tc68pq.js → dockerfile-z3v0km9v.js} +1 -1
  39. package/dist/client/static/js/{ebnfDiagram-ZINNZB2B-022cz603.js → ebnfDiagram-ZINNZB2B-3y4w2j6t.js} +1 -1
  40. package/dist/client/static/js/{elixir-61gbjv6c.js → elixir-c701n0qg.js} +1 -1
  41. package/dist/client/static/js/{elk-276RUBZZ-2anf1c36.js → elk-276RUBZZ-d9d23jch.js} +1 -1
  42. package/dist/client/static/js/{erDiagram-OPXOYQCR-ndd27fz1.js → erDiagram-OPXOYQCR-w4z3501c.js} +15 -15
  43. package/dist/client/static/js/{erlang-bh5cbm8m.js → erlang-cpw5s1f9.js} +1 -1
  44. package/dist/client/static/js/eventmodeling-NTZA5JFV-pj22bng1.js +1 -0
  45. package/dist/client/static/js/flowDiagram-KWPJA3E3-9h6g160j.js +1 -0
  46. package/dist/client/static/js/{ganttDiagram-FUAMR5RP-9gm6hkgn.js → ganttDiagram-FUAMR5RP-7wcxk4bm.js} +5 -5
  47. package/dist/client/static/js/gitGraph-4MIJSDKK-hgw4jcvk.js +1 -0
  48. package/dist/client/static/js/{gitGraphDiagram-X574FWY7-78bxa67c.js → gitGraphDiagram-X574FWY7-sdh1hsb1.js} +9 -9
  49. package/dist/client/static/js/graphql-0yv8dc1v.js +1 -0
  50. package/dist/client/static/js/html-zk3m0az9.js +1 -0
  51. package/dist/client/static/js/{index-dxnkwf39.js → index-09ap9ncj.js} +54 -54
  52. package/dist/client/static/js/index-0ff2x5g9.js +1 -0
  53. package/dist/client/static/js/{index-3en15m75.js → index-0q39ajgh.js} +2 -2
  54. package/dist/client/static/js/{index-t4s10406.js → index-144aknp3.js} +2 -2
  55. package/dist/client/static/js/index-17jy16v3.js +314 -0
  56. package/dist/client/static/js/{index-jnkc9p53.js → index-1adfks1n.js} +2 -2
  57. package/dist/client/static/js/{index-ya9yqj5w.js → index-1d8v3bvm.js} +2 -2
  58. package/dist/client/static/js/index-1dx4dqzy.js +4 -0
  59. package/dist/client/static/js/{index-kaxvwh07.js → index-1ec33b1j.js} +2 -2
  60. package/dist/client/static/js/{index-qe0vfv6s.js → index-1jx4nt2f.js} +1 -1
  61. package/dist/client/static/js/{index-gpmcth0x.js → index-1kjgdyfk.js} +2 -2
  62. package/dist/client/static/js/{index-x7rajphe.js → index-1vfej0gk.js} +2 -2
  63. package/dist/client/static/js/{index-45p59fxq.js → index-2g1ey1c9.js} +2 -2
  64. package/dist/client/static/js/{index-hwzxdwwg.js → index-3rhk4apq.js} +1 -1
  65. package/dist/client/static/js/{index-g3rg6vsd.js → index-4vaxdt8a.js} +2 -2
  66. package/dist/client/static/js/{index-ac2q5903.js → index-4z3qtazf.js} +2 -2
  67. package/dist/client/static/js/{index-30a8py59.js → index-56319bht.js} +2 -2
  68. package/dist/client/static/js/{index-a58rkn3f.js → index-5qwgexg6.js} +4 -4
  69. package/dist/client/static/js/index-779rptb2.js +1 -0
  70. package/dist/client/static/js/{index-7whstwc7.js → index-7jdz4jr4.js} +2 -2
  71. package/dist/client/static/js/{index-hq28918s.js → index-7xn7gxgw.js} +2 -2
  72. package/dist/client/static/js/{index-tzz5gp8a.js → index-8fk7h2me.js} +5 -5
  73. package/dist/client/static/js/index-971stdh4.js +2 -0
  74. package/dist/client/static/js/{index-c250nzm1.js → index-9jrej3ht.js} +3 -3
  75. package/dist/client/static/js/index-9ydvkxz1.css +1 -0
  76. package/dist/client/static/js/{index-0e51wknc.js → index-ajdzvegm.js} +10 -10
  77. package/dist/client/static/js/{index-8tvrzce0.js → index-ajqmcds5.js} +2 -2
  78. package/dist/client/static/js/{index-k39be93q.js → index-ap6hv7s7.js} +1 -1
  79. package/dist/client/static/js/{index-he4k2j91.js → index-aqqj4xxy.js} +2 -2
  80. package/dist/client/static/js/index-bczhbk01.js +2 -0
  81. package/dist/client/static/js/{index-ebf50mrs.js → index-bggz63br.js} +7 -7
  82. package/dist/client/static/js/{index-seekt5k3.js → index-c2mqr5fh.js} +2 -2
  83. package/dist/client/static/js/{index-xny7vsfz.js → index-cm8pa783.js} +2 -2
  84. package/dist/client/static/js/{index-zcgqacvx.js → index-dgkpbrdr.js} +2 -2
  85. package/dist/client/static/js/index-e471eprg.js +1 -0
  86. package/dist/client/static/js/{index-4n7t26ap.js → index-evvmkk2f.js} +1 -1
  87. package/dist/client/static/js/index-frhxbqhg.js +1 -0
  88. package/dist/client/static/js/{index-mqzgf7rw.js → index-gcgsjd3c.js} +2 -2
  89. package/dist/client/static/js/{index-sng4prpr.js → index-grkacfv3.js} +2 -2
  90. package/dist/client/static/js/{index-417fbrqk.js → index-gws4prmg.js} +2 -2
  91. package/dist/client/static/js/index-hqhz4eam.js +1 -0
  92. package/dist/client/static/js/index-jr6q69r3.js +465 -0
  93. package/dist/client/static/js/{index-hkz2mz34.js → index-jxxewcat.js} +2 -2
  94. package/dist/client/static/js/{index-13g17wa3.js → index-k3vvk28c.js} +1 -1
  95. package/dist/client/static/js/{index-55pqvh82.js → index-k66w6d9b.js} +2 -2
  96. package/dist/client/static/js/{index-34aq5bz5.js → index-kce86cnw.js} +2 -2
  97. package/dist/client/static/js/{index-5mpv57fn.js → index-n54jd3aw.js} +12 -12
  98. package/dist/client/static/js/{index-abrrqhne.js → index-nnqyew8n.js} +2 -2
  99. package/dist/client/static/js/index-qaxjp73x.js +2 -0
  100. package/dist/client/static/js/{index-pzsp1src.js → index-qxzyvye9.js} +2 -2
  101. package/dist/client/static/js/{index-2bsnywea.js → index-r2z0a118.js} +2 -2
  102. package/dist/client/static/js/{index-m0fatq7c.js → index-r6bm9sth.js} +11 -11
  103. package/dist/client/static/js/{index-ep6bqcmg.js → index-ratbr10x.js} +2 -2
  104. package/dist/client/static/js/index-rgneq3zt.js +2 -0
  105. package/dist/client/static/js/{index-7pz6n3pg.js → index-svx6rnfs.js} +2 -2
  106. package/dist/client/static/js/{index-aabp7nt6.js → index-tew3rd6t.js} +1 -1
  107. package/dist/client/static/js/index-tfwsch7a.js +4 -0
  108. package/dist/client/static/js/{index-g8rpydkr.js → index-vgwjn4de.js} +2 -2
  109. package/dist/client/static/js/{index-e6ny4gd9.js → index-vn495w82.js} +6 -6
  110. package/dist/client/static/js/{index-hcmhdpp4.js → index-wbma8kqw.js} +23 -23
  111. package/dist/client/static/js/{index-qxzj780x.js → index-xgbcn89g.js} +2 -2
  112. package/dist/client/static/js/{index-fb2s080r.js → index-xrn2reb5.js} +2 -2
  113. package/dist/client/static/js/{index-2n1fgpjv.js → index-zhnfq8br.js} +2 -2
  114. package/dist/client/static/js/index-zsx5vs3j.js +2 -0
  115. package/dist/client/static/js/info-A6RAGUB7-k0kv05ny.js +1 -0
  116. package/dist/client/static/js/{infoDiagram-VRGFBTTK-bxk0g0pe.js → infoDiagram-VRGFBTTK-gtdp0z6p.js} +2 -2
  117. package/dist/client/static/js/ini-apj95p59.js +1 -0
  118. package/dist/client/static/js/{ishikawaDiagram-OU5B5YK6-d1kdkhth.js → ishikawaDiagram-OU5B5YK6-c05m0sqq.js} +6 -6
  119. package/dist/client/static/js/java-khk2v3g4.js +1 -0
  120. package/dist/client/static/js/javascript-gez6yppm.js +1 -0
  121. package/dist/client/static/js/{journeyDiagram-ZHPQQLJL-cahg3zjq.js → journeyDiagram-ZHPQQLJL-kgk5ygm2.js} +6 -6
  122. package/dist/client/static/js/json-r78y6e80.js +1 -0
  123. package/dist/client/static/js/jsx-h7hfj8cz.js +1 -0
  124. package/dist/client/static/js/{julia-2n5k898q.js → julia-w13bz4s1.js} +1 -1
  125. package/dist/client/static/js/{kanban-definition-PNTS6WVX-nq7t83en.js → kanban-definition-PNTS6WVX-q1w9w68s.js} +12 -12
  126. package/dist/client/static/js/lua-pat2bzg3.js +1 -0
  127. package/dist/client/static/js/markdown-545zn05v.js +1 -0
  128. package/dist/client/static/js/{mermaid.core-6nw0853j.js → mermaid.core-1rz62j9g.js} +7 -7
  129. package/dist/client/static/js/{mindmap-definition-NLK3R4M7-cm7ykxf2.js → mindmap-definition-NLK3R4M7-3m3w6bnb.js} +9 -9
  130. package/dist/client/static/js/one-dark-pro-7c942tnw.js +1 -0
  131. package/dist/client/static/js/one-light-tp8y6c5g.js +1 -0
  132. package/dist/client/static/js/packet-AYTQ26CC-ne66q5h9.js +1 -0
  133. package/dist/client/static/js/{pegDiagram-GJSIUBJH-xwxz8nsq.js → pegDiagram-GJSIUBJH-svd3ex4e.js} +1 -1
  134. package/dist/client/static/js/{perl-66vb5pz7.js → perl-hcg3hacf.js} +1 -1
  135. package/dist/client/static/js/{php-4e9we8am.js → php-q6hhp84p.js} +1 -1
  136. package/dist/client/static/js/pie-WAS4IAKB-ej9aysvz.js +1 -0
  137. package/dist/client/static/js/{pieDiagram-5QR66LMP-n910k9th.js → pieDiagram-5QR66LMP-2nrkw034.js} +3 -3
  138. package/dist/client/static/js/properties-9f76xngb.js +1 -0
  139. package/dist/client/static/js/python-nwerpkfq.js +1 -0
  140. package/dist/client/static/js/quadrantDiagram-O4NWA36T-4895d1aq.js +7 -0
  141. package/dist/client/static/js/r-39k5dr2p.js +1 -0
  142. package/dist/client/static/js/radar-RG4KPBEZ-375pe46t.js +1 -0
  143. package/dist/client/static/js/railroad-74A4TZTK-hdgdfsc1.js +1 -0
  144. package/dist/client/static/js/railroad-abnf-HS5TGJTU-2p5ynn4a.js +1 -0
  145. package/dist/client/static/js/railroad-ebnf-LZEXJU2U-2p1fxxen.js +1 -0
  146. package/dist/client/static/js/railroad-peg-WCYAUIDC-g131pt42.js +1 -0
  147. package/dist/client/static/js/{railroadDiagram-XR7U4H2S-xb1smt7r.js → railroadDiagram-XR7U4H2S-zj3g9yne.js} +1 -1
  148. package/dist/client/static/js/{requirementDiagram-PLB6GJNP-6kb21b9f.js → requirementDiagram-PLB6GJNP-727yjvs8.js} +8 -8
  149. package/dist/client/static/js/{ruby-v7nmcvyr.js → ruby-wzqz8vw6.js} +1 -1
  150. package/dist/client/static/js/{rust-5ersd7be.js → rust-r94pgqvf.js} +1 -1
  151. package/dist/client/static/js/{sankeyDiagram-IPEJSGJF-74z0fskw.js → sankeyDiagram-IPEJSGJF-17c7p2pe.js} +5 -5
  152. package/dist/client/static/js/{sass-h3nvy4c8.js → sass-xb3van7h.js} +1 -1
  153. package/dist/client/static/js/{scss-kvev49ga.js → scss-ddg6t3x4.js} +1 -1
  154. package/dist/client/static/js/{sequenceDiagram-PO4LG4MO-apn6kezn.js → sequenceDiagram-PO4LG4MO-wcmbpckr.js} +18 -18
  155. package/dist/client/static/js/{sizeCapture-INFHLROL-2drzcjb8.js → sizeCapture-INFHLROL-nkr57cd6.js} +1 -1
  156. package/dist/client/static/js/sql-4dcrp3sw.js +1 -0
  157. package/dist/client/static/js/{stateDiagram-v2-GCMORJYK-ma09vhby.js → stateDiagram-v2-GCMORJYK-vd7r8s78.js} +6 -6
  158. package/dist/client/static/js/{svelte-dhspkgss.js → svelte-wzaxz546.js} +1 -1
  159. package/dist/client/static/js/{swimlanes-2SLR337P-f6y9xqnx.js → swimlanes-2SLR337P-zhxm05ak.js} +1 -1
  160. package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-myzk2rg0.js +8 -0
  161. package/dist/client/static/js/{timeline-definition-EJHVYXUP-zmcmvq00.js → timeline-definition-EJHVYXUP-n7gbzhzd.js} +11 -11
  162. package/dist/client/static/js/treeView-Q6P3EWNA-gfztfha9.js +1 -0
  163. package/dist/client/static/js/treemap-WGGIJYW6-kwtrwq1f.js +1 -0
  164. package/dist/client/static/js/tsx-dk8rpgtw.js +1 -0
  165. package/dist/client/static/js/typescript-q0493nmw.js +1 -0
  166. package/dist/client/static/js/{usecaseDiagram-POWQR4AR-wfaa019a.js → usecaseDiagram-POWQR4AR-davsnwkf.js} +82 -82
  167. package/dist/client/static/js/{vennDiagram-UO4OBE2U-46wf2pgd.js → vennDiagram-UO4OBE2U-gb54bh5k.js} +8 -8
  168. package/dist/client/static/js/{vue-ffngx2b3.js → vue-6zhfw7zx.js} +1 -1
  169. package/dist/client/static/js/wardley-WFR3VGLG-30dnzvww.js +1 -0
  170. package/dist/client/static/js/wardleyDiagram-VNRHLVJA-sf98cg9t.js +78 -0
  171. package/dist/client/static/js/xml-91sb3gt9.js +1 -0
  172. package/dist/client/static/js/{xychartDiagram-PMCCYNJV-2ba825z9.js → xychartDiagram-PMCCYNJV-9nn09k40.js} +5 -5
  173. package/dist/client/static/js/yaml-ghx4mjw1.js +1 -0
  174. package/package.json +1 -1
  175. package/src/client/components/common/MarkdownRenderer.tsx +29 -28
  176. package/src/client/components/common/header-button/index.tsx +10 -2
  177. package/src/client/components/common/header-controls/index.test.tsx +1 -0
  178. package/src/client/components/common/header-controls/phone-row.test.tsx +1 -0
  179. package/src/client/components/common/header-controls/plugin-entry.test.tsx +1 -0
  180. package/src/client/components/common/header-controls/shell-chrome.test.tsx +1 -0
  181. package/src/client/components/layout/ActivityBar.tsx +2 -1
  182. package/src/client/components/layout/LeftActivityBar.test.ts +1 -0
  183. package/src/client/components/settings/Modal.tsx +1 -1
  184. package/src/client/components/settings/Sidebar.tsx +2 -1
  185. package/src/client/components/settings/apply-side-effects.test.ts +16 -0
  186. package/src/client/components/settings/apply-side-effects.ts +16 -0
  187. package/src/client/components/settings/categories/AppearanceSettings.test.tsx +1 -0
  188. package/src/client/components/settings/categories/AppearanceSettings.tsx +2 -0
  189. package/src/client/components/settings/categories/DictationSettings.test.tsx +152 -0
  190. package/src/client/components/settings/categories/DictationSettings.tsx +76 -0
  191. package/src/client/components/settings/categories/HarnessSettings.tsx +8 -0
  192. package/src/client/components/settings/categories/TokenUsageSettings.tsx +26 -3
  193. package/src/client/components/settings/categories/VoiceSettings.tsx +77 -0
  194. package/src/client/components/settings/categories/appearance-settings/RightSideSection.test.tsx +97 -0
  195. package/src/client/components/settings/categories/appearance-settings/RightSideSection.tsx +94 -0
  196. package/src/client/components/settings/categories/appearance-settings/groups.ts +4 -3
  197. package/src/client/components/settings/categories/dictation-settings/CaptureSection.tsx +153 -0
  198. package/src/client/components/settings/categories/dictation-settings/EngineSection.tsx +123 -0
  199. package/src/client/components/settings/categories/dictation-settings/ExternalSection.tsx +221 -0
  200. package/src/client/components/settings/categories/dictation-settings/LanguageSection.tsx +73 -0
  201. package/src/client/components/settings/categories/harness-settings/AccountLoginPanel.tsx +224 -0
  202. package/src/client/components/settings/categories/harness-settings/AccountsPanel.test.tsx +139 -0
  203. package/src/client/components/settings/categories/harness-settings/AccountsPanel.tsx +349 -0
  204. package/src/client/components/settings/categories/harness-settings/AddAccountForm.tsx +58 -0
  205. package/src/client/components/settings/categories/harness-settings/HarnessCard.tsx +33 -0
  206. package/src/client/components/settings/categories/panel-plugins/InstallForm.tsx +24 -17
  207. package/src/client/components/settings/categories/panel-plugins/Registries.test.tsx +164 -0
  208. package/src/client/components/settings/categories/panel-plugins/Registries.tsx +180 -0
  209. package/src/client/components/settings/categories/panel-plugins/Section.tsx +15 -6
  210. package/src/client/components/settings/categories/token-usage-settings/HarnessFilter.tsx +59 -0
  211. package/src/client/components/settings/categories/token-usage-settings/panel.test.tsx +37 -0
  212. package/src/client/components/settings/categories/usage-settings/limit-groups.test.ts +10 -0
  213. package/src/client/components/settings/categories/usage-settings/limit-groups.ts +4 -1
  214. package/src/client/components/settings/categories/usage-settings/providers.ts +28 -0
  215. package/src/client/components/settings/categories/usage-settings/usage-visibility.test.ts +60 -0
  216. package/src/client/components/settings/categories/voice-settings/SpeechSettings.test.tsx +152 -0
  217. package/src/client/components/settings/categories/voice-settings/SpeechSettings.tsx +84 -0
  218. package/src/client/components/settings/categories/voice-settings/groups.test.ts +23 -0
  219. package/src/client/components/settings/categories/voice-settings/groups.ts +48 -0
  220. package/src/client/components/settings/categories/voice-settings/speech/AutoplaySection.tsx +49 -0
  221. package/src/client/components/settings/categories/voice-settings/speech/EndpointSection.tsx +167 -0
  222. package/src/client/components/settings/categories/voice-settings/speech/EngineSection.tsx +108 -0
  223. package/src/client/components/settings/categories/voice-settings/speech/TestSection.tsx +56 -0
  224. package/src/client/components/settings/categories/voice-settings/speech/VoiceSection.tsx +188 -0
  225. package/src/client/components/settings/categories/voice-settings/speech/styles.ts +15 -0
  226. package/src/client/components/settings/category-content.tsx +3 -0
  227. package/src/client/components/workspace/chat-timeline/AiMessageFooter.speech.test.tsx +140 -0
  228. package/src/client/components/workspace/chat-timeline/AiMessageFooter.tsx +41 -97
  229. package/src/client/components/workspace/chat-timeline/AiMessageFooterSheet.tsx +143 -0
  230. package/src/client/components/workspace/chat-timeline/MessageItem.tsx +5 -1
  231. package/src/client/components/workspace/chat-timeline/MessageList.tsx +1 -0
  232. package/src/client/components/workspace/chat-timeline/RunFooter.tsx +1 -0
  233. package/src/client/components/workspace/chat-timeline/SpeechButton.tsx +110 -0
  234. package/src/client/components/workspace/chat-timeline/chat-input/AccessDropdown.test.ts +26 -10
  235. package/src/client/components/workspace/chat-timeline/chat-input/AccessDropdown.tsx +13 -8
  236. package/src/client/components/workspace/chat-timeline/chat-input/AttachmentToolbar.tsx +9 -2
  237. package/src/client/components/workspace/chat-timeline/chat-input/ComposerRows.tsx +6 -0
  238. package/src/client/components/workspace/chat-timeline/chat-input/ModeToggles.tsx +18 -7
  239. package/src/client/components/workspace/chat-timeline/chat-input/SessionModeDropdown.tsx +4 -2
  240. package/src/client/components/workspace/chat-timeline/chat-input/ThinkingLevelDropdown.tsx +4 -4
  241. package/src/client/components/workspace/chat-timeline/chat-input/Toolbar.tsx +19 -11
  242. package/src/client/components/workspace/chat-timeline/chat-input/WaitingDependencyPicker.tsx +8 -6
  243. package/src/client/components/workspace/chat-timeline/chat-input/index.tsx +38 -30
  244. package/src/client/components/workspace/chat-timeline/chat-input/narrow.test.tsx +185 -0
  245. package/src/client/components/workspace/chat-timeline/chat-input/paste-attach.test.tsx +194 -0
  246. package/src/client/components/workspace/chat-timeline/index.tsx +4 -1
  247. package/src/client/components/workspace/chat-timeline/tool-renderers/index.tsx +5 -11
  248. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Bash.test.ts +10 -0
  249. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Edit.tsx +2 -7
  250. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/task-rows.ts +6 -1
  251. package/src/client/components/workspace/chat-timeline/tool-renderers/registry.test.ts +38 -0
  252. package/src/client/components/workspace/chat-timeline/tool-renderers/registry.ts +10 -2
  253. package/src/client/components/workspace/chat-timeline/tool-renderers/shared/tool-input.ts +5 -5
  254. package/src/client/components/workspace/usage-panel/index.test.tsx +92 -12
  255. package/src/client/components/workspace/usage-panel/index.tsx +48 -12
  256. package/src/client/data/mock/token-usage.ts +53 -10
  257. package/src/client/hooks/chat/composer/attachments.ts +18 -2
  258. package/src/client/hooks/chat/composer/capture.test.ts +282 -0
  259. package/src/client/hooks/chat/composer/capture.ts +166 -0
  260. package/src/client/hooks/chat/composer/dictation-settings.ts +53 -0
  261. package/src/client/hooks/chat/composer/narrow.test.ts +130 -0
  262. package/src/client/hooks/chat/composer/narrow.ts +82 -0
  263. package/src/client/hooks/chat/composer/paste-attachments.test.ts +215 -0
  264. package/src/client/hooks/chat/composer/paste-attachments.ts +173 -0
  265. package/src/client/hooks/chat/composer/pipeline.ts +16 -3
  266. package/src/client/hooks/chat/composer/speech-to-text.test.tsx +314 -0
  267. package/src/client/hooks/chat/composer/speech-to-text.ts +158 -134
  268. package/src/client/hooks/chat/composer/voice-input.ts +24 -9
  269. package/src/client/hooks/chat/timeline/reader-input.ts +53 -1
  270. package/src/client/hooks/chat/timeline/scroll-activity.test.ts +103 -0
  271. package/src/client/hooks/chat/timeline/scroll-geometry.ts +9 -4
  272. package/src/client/hooks/chat/timeline/scroll.test.ts +44 -3
  273. package/src/client/hooks/chat/timeline/scroll.ts +50 -16
  274. package/src/client/hooks/chat/timeline/send-helpers.ts +3 -0
  275. package/src/client/hooks/chat/timeline/send.ts +5 -1
  276. package/src/client/hooks/models/harness-accounts.ts +143 -0
  277. package/src/client/hooks/models/harness-catalog.ts +9 -2
  278. package/src/client/hooks/models/use-harnesses-controller.ts +12 -0
  279. package/src/client/hooks/models/use-harnesses.ts +14 -0
  280. package/src/client/hooks/settings/dictation.ts +153 -0
  281. package/src/client/hooks/settings/hide-empty-providers.test.ts +132 -0
  282. package/src/client/hooks/settings/hide-empty-providers.ts +49 -0
  283. package/src/client/hooks/settings/speech.ts +170 -0
  284. package/src/client/hooks/settings/useTokenUsage.ts +7 -2
  285. package/src/client/hooks/tts/provider.tsx +50 -0
  286. package/src/client/hooks/tts/tts-context.ts +39 -0
  287. package/src/client/hooks/tts/use-speech-autoplay.test.tsx +122 -0
  288. package/src/client/hooks/tts/use-speech-autoplay.ts +106 -0
  289. package/src/client/hooks/tts/use-tts-player.ts +33 -0
  290. package/src/client/hooks/ui/markdown-hydration.test.tsx +83 -0
  291. package/src/client/hooks/ui/markdown-hydration.ts +31 -0
  292. package/src/client/hooks/ui/markdown-render.ts +119 -0
  293. package/src/client/hooks/workspace/journal-diff.ts +8 -1
  294. package/src/client/hooks/workspace/panel-actions.ts +184 -0
  295. package/src/client/hooks/workspace/panel-registry.ts +6 -139
  296. package/src/client/hooks/workspace/panel-tabs.ts +1 -1
  297. package/src/client/hooks/workspace/panel-visibility-menu.ts +2 -1
  298. package/src/client/hooks/workspace/right-side.test.ts +75 -1
  299. package/src/client/hooks/workspace/right-side.ts +71 -10
  300. package/src/client/lib/plugins/bootstrap.test.ts +1 -0
  301. package/src/client/lib/tts/player.test.ts +103 -0
  302. package/src/client/lib/tts/player.ts +213 -0
  303. package/src/client/tailwind.css +11 -0
  304. package/src/server/lib/antigravity/home.server.ts +27 -0
  305. package/src/server/lib/changes/capture-bash.server.ts +6 -3
  306. package/src/server/lib/changes/capture-fs.server.ts +2 -2
  307. package/src/server/lib/changes/capture-races.test.ts +33 -1
  308. package/src/server/lib/changes/capture-scan.test.ts +1 -1
  309. package/src/server/lib/changes/capture-test-util.ts +1 -1
  310. package/src/server/lib/changes/capture-types.ts +1 -1
  311. package/src/server/lib/changes/capture.server.ts +1 -1
  312. package/src/server/lib/changes/journal-read.server.ts +21 -0
  313. package/src/server/lib/changes/reader.server.ts +92 -14
  314. package/src/server/lib/changes/reader.test.ts +99 -0
  315. package/src/server/lib/changes/records.ts +2 -0
  316. package/src/server/lib/db/schema.ts +5 -1
  317. package/src/server/lib/dictation/capability.server.test.ts +113 -0
  318. package/src/server/lib/dictation/capability.server.ts +57 -0
  319. package/src/server/lib/dictation/engines/adapter.ts +147 -0
  320. package/src/server/lib/dictation/engines/adapters.test.ts +215 -0
  321. package/src/server/lib/dictation/engines/deepgram.ts +77 -0
  322. package/src/server/lib/dictation/engines/elevenlabs.ts +44 -0
  323. package/src/server/lib/dictation/engines/index.ts +55 -0
  324. package/src/server/lib/dictation/engines/openai.ts +51 -0
  325. package/src/server/lib/dictation/language.server.test.ts +21 -22
  326. package/src/server/lib/dictation/language.server.ts +16 -19
  327. package/src/server/lib/dictation/omp-stt-worker.test.ts +183 -0
  328. package/src/server/lib/dictation/omp-stt-worker.ts +130 -78
  329. package/src/server/lib/dictation/settings.server.ts +74 -0
  330. package/src/server/lib/dictation/speech-frames.test.ts +125 -0
  331. package/src/server/lib/dictation/speech-frames.ts +146 -0
  332. package/src/server/lib/dictation/worker-process.ts +122 -0
  333. package/src/server/lib/harness/account-identity.server.ts +163 -0
  334. package/src/server/lib/harness/account-login.server.test.ts +151 -0
  335. package/src/server/lib/harness/account-login.server.ts +232 -0
  336. package/src/server/lib/harness/accounts.server.ts +339 -0
  337. package/src/server/lib/harness/accounts.test.ts +147 -0
  338. package/src/server/lib/harness/acp/background-probe.test.ts +314 -0
  339. package/src/server/lib/harness/acp/background-probe.ts +288 -0
  340. package/src/server/lib/harness/acp/background-replay.test.ts +1 -1
  341. package/src/server/lib/harness/acp/background-work.test.ts +4 -194
  342. package/src/server/lib/harness/acp/background-work.ts +4 -207
  343. package/src/server/lib/harness/acp/calls.ts +20 -0
  344. package/src/server/lib/harness/acp/client-capabilities.ts +8 -1
  345. package/src/server/lib/harness/acp/client-fs.ts +17 -5
  346. package/src/server/lib/harness/acp/client-initialize.test.ts +32 -1
  347. package/src/server/lib/harness/acp/client-initialize.ts +51 -6
  348. package/src/server/lib/harness/acp/client-requests.ts +49 -0
  349. package/src/server/lib/harness/acp/client.ts +36 -36
  350. package/src/server/lib/harness/acp/commands.ts +2 -2
  351. package/src/server/lib/harness/acp/frames-rows.test.ts +144 -0
  352. package/src/server/lib/harness/acp/frames-tool-shapes.test.ts +238 -0
  353. package/src/server/lib/harness/acp/frames-v2.test.ts +21 -0
  354. package/src/server/lib/harness/acp/frames.test.ts +3 -15
  355. package/src/server/lib/harness/acp/frames.ts +43 -67
  356. package/src/server/lib/harness/acp/grants.ts +20 -5
  357. package/src/server/lib/harness/acp/mapper.test.ts +40 -1
  358. package/src/server/lib/harness/acp/mapper.ts +69 -9
  359. package/src/server/lib/harness/acp/message-rows.ts +219 -0
  360. package/src/server/lib/harness/acp/one-shot.server.ts +4 -2
  361. package/src/server/lib/harness/acp/prewarm.server.ts +21 -16
  362. package/src/server/lib/harness/acp/prompt.ts +20 -2
  363. package/src/server/lib/harness/acp/protocol.ts +24 -0
  364. package/src/server/lib/harness/acp/replay-window.test.ts +66 -0
  365. package/src/server/lib/harness/acp/replay.ts +33 -8
  366. package/src/server/lib/harness/acp/session-addressing.test.ts +99 -0
  367. package/src/server/lib/harness/acp/session-approvals.ts +4 -0
  368. package/src/server/lib/harness/acp/session-background.test.ts +2 -1
  369. package/src/server/lib/harness/acp/session-cancel-policy.test.ts +86 -0
  370. package/src/server/lib/harness/acp/session-close.test.ts +89 -0
  371. package/src/server/lib/harness/acp/session-config.ts +8 -3
  372. package/src/server/lib/harness/acp/session-handshake.ts +6 -0
  373. package/src/server/lib/harness/acp/session-inbound.ts +126 -0
  374. package/src/server/lib/harness/acp/session-intake.test.ts +8 -0
  375. package/src/server/lib/harness/acp/session-intake.ts +21 -5
  376. package/src/server/lib/harness/acp/session-lifecycle.ts +25 -0
  377. package/src/server/lib/harness/acp/session-notifications.ts +36 -0
  378. package/src/server/lib/harness/acp/session-options.ts +2 -0
  379. package/src/server/lib/harness/acp/session-permissions.ts +22 -1
  380. package/src/server/lib/harness/acp/session-process.ts +1 -0
  381. package/src/server/lib/harness/acp/session-requests.ts +19 -1
  382. package/src/server/lib/harness/acp/session-stop.ts +54 -0
  383. package/src/server/lib/harness/acp/session-wiring.test.ts +2 -0
  384. package/src/server/lib/harness/acp/session-wiring.ts +23 -0
  385. package/src/server/lib/harness/acp/session.test-util.ts +8 -3
  386. package/src/server/lib/harness/acp/session.ts +78 -78
  387. package/src/server/lib/harness/acp/stdio.test.ts +52 -0
  388. package/src/server/lib/harness/acp/stdio.ts +15 -2
  389. package/src/server/lib/harness/acp/subagent-frames.test.ts +82 -0
  390. package/src/server/lib/harness/acp/subagent-frames.ts +124 -0
  391. package/src/server/lib/harness/acp/subagents.test.ts +124 -0
  392. package/src/server/lib/harness/acp/subagents.ts +182 -0
  393. package/src/server/lib/harness/acp/tool-calls.ts +115 -45
  394. package/src/server/lib/harness/acp/tool-identity.test.ts +8 -0
  395. package/src/server/lib/harness/acp/tool-identity.ts +13 -1
  396. package/src/server/lib/harness/acp/tool-shape.ts +99 -0
  397. package/src/server/lib/harness/acp/turn.test.ts +1 -0
  398. package/src/server/lib/harness/acp/turn.ts +4 -1
  399. package/src/server/lib/harness/acp/v2.test.ts +21 -1
  400. package/src/server/lib/harness/acp/v2.ts +6 -1
  401. package/src/server/lib/harness/auto-probe.server.ts +2 -2
  402. package/src/server/lib/harness/launch-table.ts +6 -1
  403. package/src/server/lib/harness/launch.ts +1 -0
  404. package/src/server/lib/harness/schema.server.ts +37 -0
  405. package/src/server/lib/harness/session-delete.server.ts +4 -2
  406. package/src/server/lib/harness/session-import.server.ts +21 -7
  407. package/src/server/lib/harness/session-store.server.test.ts +12 -0
  408. package/src/server/lib/harness/session-store.server.ts +21 -6
  409. package/src/server/lib/harness/session-transcript.server.ts +2 -1
  410. package/src/server/lib/harness/spawn.server.ts +27 -6
  411. package/src/server/lib/lifecycle/paths.ts +22 -0
  412. package/src/server/lib/models/provider-icon-fetch.test.ts +57 -3
  413. package/src/server/lib/models/provider-icon-fetch.ts +9 -1
  414. package/src/server/lib/models/provider-icon-store.server.ts +61 -0
  415. package/src/server/lib/models/provider-icon-store.test.ts +55 -0
  416. package/src/server/lib/models/provider-icon-svg.ts +57 -0
  417. package/src/server/lib/omp/session/changes-patch.test.ts +120 -0
  418. package/src/server/lib/omp/session/changes-patch.ts +190 -0
  419. package/src/server/lib/omp/session/changes.test.ts +55 -61
  420. package/src/server/lib/omp/session/changes.ts +79 -127
  421. package/src/server/lib/omp/session/merge-stored.ts +2 -0
  422. package/src/server/lib/panels/catalog-offers.server.ts +1 -1
  423. package/src/server/lib/panels/catalog.server.test.ts +71 -2
  424. package/src/server/lib/panels/catalog.server.ts +80 -0
  425. package/src/server/lib/panels/install.server.test.ts +15 -0
  426. package/src/server/lib/panels/install.server.ts +7 -0
  427. package/src/server/lib/panels/manifest.test.ts +1 -76
  428. package/src/server/lib/panels/manifest.ts +3 -60
  429. package/src/server/lib/panels/marketplace-catalog.server.test.ts +154 -0
  430. package/src/server/lib/panels/marketplace-catalog.server.ts +131 -0
  431. package/src/server/lib/panels/offers.server.test.ts +5 -5
  432. package/src/server/lib/panels/offers.server.ts +20 -2
  433. package/src/server/lib/panels/registries.server.test.ts +216 -0
  434. package/src/server/lib/panels/registries.server.ts +118 -0
  435. package/src/server/lib/panels/registry-cache.server.ts +104 -0
  436. package/src/server/lib/panels/registry-refresh.server.ts +195 -0
  437. package/src/server/lib/panels/registry.server.test.ts +2 -2
  438. package/src/server/lib/panels/registry.server.ts +19 -1
  439. package/src/server/lib/panels/seed.server.ts +4 -1
  440. package/src/server/lib/schedule/runtime.server.ts +4 -1
  441. package/src/server/lib/sessions/dispatch.server.ts +4 -1
  442. package/src/server/lib/sessions/fork.server.ts +2 -0
  443. package/src/server/lib/sessions/resolve.server.ts +4 -0
  444. package/src/server/lib/sessions/spawn.server.ts +4 -2
  445. package/src/server/lib/tts/engines/adapter.ts +133 -0
  446. package/src/server/lib/tts/engines/adapters.test.ts +162 -0
  447. package/src/server/lib/tts/engines/deepgram.ts +43 -0
  448. package/src/server/lib/tts/engines/elevenlabs.ts +59 -0
  449. package/src/server/lib/tts/engines/gemini.ts +116 -0
  450. package/src/server/lib/tts/engines/index.ts +78 -0
  451. package/src/server/lib/tts/engines/openai.ts +69 -0
  452. package/src/server/lib/tts/engines/xai.ts +44 -0
  453. package/src/server/lib/tts/local.server.ts +160 -0
  454. package/src/server/lib/tts/settings.server.ts +103 -0
  455. package/src/server/lib/usage/antigravity-quota.test.ts +249 -0
  456. package/src/server/lib/usage/antigravity-quota.ts +197 -0
  457. package/src/server/lib/usage/antigravity.test.ts +20 -0
  458. package/src/server/lib/usage/antigravity.ts +267 -0
  459. package/src/server/lib/usage/index-harness.test.ts +162 -0
  460. package/src/server/lib/usage/index-parse.test.ts +1 -0
  461. package/src/server/lib/usage/index-parse.ts +12 -4
  462. package/src/server/lib/usage/index-query.server.ts +64 -2
  463. package/src/server/lib/usage/index-scan.server.ts +68 -152
  464. package/src/server/lib/usage/index-schema.server.ts +24 -8
  465. package/src/server/lib/usage/index-schema.test.ts +54 -0
  466. package/src/server/lib/usage/index-sources.server.ts +54 -0
  467. package/src/server/lib/usage/providers.server.test.ts +67 -1
  468. package/src/server/lib/usage/providers.server.ts +82 -3
  469. package/src/server/lib/usage/sources/claude.server.ts +187 -0
  470. package/src/server/lib/usage/sources/claude.test.ts +86 -0
  471. package/src/server/lib/usage/sources/codex.server.ts +155 -0
  472. package/src/server/lib/usage/sources/codex.test.ts +53 -0
  473. package/src/server/lib/usage/sources/dsh.server.ts +120 -0
  474. package/src/server/lib/usage/sources/dsh.test.ts +49 -0
  475. package/src/server/lib/usage/sources/helpers.ts +191 -0
  476. package/src/server/lib/usage/sources/jsonl.server.ts +78 -0
  477. package/src/server/lib/usage/sources/jsonl.test.ts +72 -0
  478. package/src/server/lib/usage/sources/omp.server.ts +124 -0
  479. package/src/server/lib/usage/sources/opencode.server.ts +203 -0
  480. package/src/server/lib/usage/sources/opencode.test.ts +104 -0
  481. package/src/server/lib/usage/sources/qwen.server.ts +122 -0
  482. package/src/server/lib/usage/sources/qwen.test.ts +62 -0
  483. package/src/server/lib/usage/sources/types.ts +53 -0
  484. package/src/server/lib/usage/sources/zcode.server.ts +131 -0
  485. package/src/server/lib/usage/sources/zcode.test.ts +87 -0
  486. package/src/server/routes/agent/harness-command.ts +2 -0
  487. package/src/server/routes/agent/prewarm.ts +7 -2
  488. package/src/server/routes/dictation/ws.ts +99 -27
  489. package/src/server/routes/harness/accounts.test.ts +99 -0
  490. package/src/server/routes/harness/accounts.ts +106 -0
  491. package/src/server/routes/harness/root.ts +13 -1
  492. package/src/server/routes/index.ts +2 -0
  493. package/src/server/routes/panels/install-route.test.ts +110 -0
  494. package/src/server/routes/panels/install.ts +82 -3
  495. package/src/server/routes/sessions/index.ts +5 -0
  496. package/src/server/routes/sessions/local-image.test.ts +94 -0
  497. package/src/server/routes/sessions/local-image.ts +141 -0
  498. package/src/server/routes/settings/dictation.test.ts +139 -0
  499. package/src/server/routes/settings/dictation.ts +86 -0
  500. package/src/server/routes/settings/index.ts +4 -0
  501. package/src/server/routes/settings/speech.test.ts +156 -0
  502. package/src/server/routes/settings/speech.ts +98 -0
  503. package/src/server/routes/telemetry/tokens.test.ts +20 -0
  504. package/src/server/routes/telemetry/tokens.ts +12 -3
  505. package/src/server/routes/tts/index.ts +11 -0
  506. package/src/server/routes/tts/speak.test.ts +200 -0
  507. package/src/server/routes/tts/speak.ts +87 -0
  508. package/src/shared/lib/chat/attachments.ts +17 -3
  509. package/src/shared/lib/chat/composer/attachment-labels.test.ts +154 -0
  510. package/src/shared/lib/chat/composer/attachment-labels.ts +166 -0
  511. package/src/shared/lib/chat/omp/subagent-card-fold.test.ts +75 -0
  512. package/src/shared/lib/chat/timeline/changed-files.test.ts +13 -0
  513. package/src/shared/lib/chat/timeline/changed-files.ts +4 -2
  514. package/src/shared/lib/chat/timeline/local-image.test.ts +88 -0
  515. package/src/shared/lib/chat/timeline/local-image.ts +110 -0
  516. package/src/shared/lib/chat/timeline/omp-callbacks.ts +3 -2
  517. package/src/shared/lib/chat/timeline/run-signals.ts +2 -2
  518. package/src/shared/lib/chat/timeline/stream-callbacks.ts +8 -6
  519. package/src/shared/lib/chat/timeline/stream-coalescer.ts +7 -0
  520. package/src/shared/lib/chat/timeline/stream.test.ts +3 -1
  521. package/src/shared/lib/chat/timeline/tool-verbs.test.ts +5 -0
  522. package/src/shared/lib/chat/timeline/tool-verbs.ts +3 -1
  523. package/src/shared/lib/chat/todo/parser.test.ts +54 -0
  524. package/src/shared/lib/chat/todo/parser.ts +56 -0
  525. package/src/shared/lib/chat/tool/tool-aliases.test.ts +37 -0
  526. package/src/shared/lib/chat/tool/tool-aliases.ts +75 -0
  527. package/src/shared/lib/chat/tool/tool-input-path.test.ts +44 -0
  528. package/src/shared/lib/chat/tool/tool-input-path.ts +47 -0
  529. package/src/shared/lib/dictation/capability.ts +32 -0
  530. package/src/shared/lib/dictation/constraints.test.ts +41 -0
  531. package/src/shared/lib/dictation/constraints.ts +48 -0
  532. package/src/shared/lib/dictation/engines.test.ts +117 -0
  533. package/src/shared/lib/dictation/engines.ts +190 -0
  534. package/src/shared/lib/dictation/gate.test.ts +118 -0
  535. package/src/shared/lib/dictation/gate.ts +85 -0
  536. package/src/shared/lib/dictation/languages.test.ts +88 -0
  537. package/src/shared/lib/dictation/languages.ts +90 -0
  538. package/src/shared/lib/dictation/models.ts +9 -5
  539. package/src/shared/lib/dictation/protocol.ts +74 -34
  540. package/src/shared/lib/dictation/settings.test.ts +94 -0
  541. package/src/shared/lib/dictation/settings.ts +111 -0
  542. package/src/shared/lib/dictation/wav.test.ts +66 -0
  543. package/src/shared/lib/dictation/wav.ts +48 -0
  544. package/src/shared/lib/fs/journal-unavailable.test.ts +30 -0
  545. package/src/shared/lib/fs/journal-unavailable.ts +35 -0
  546. package/src/shared/lib/harness/accounts.test.ts +41 -0
  547. package/src/shared/lib/harness/accounts.ts +175 -0
  548. package/src/shared/lib/icons/tint-hues.generated.ts +36 -35
  549. package/src/shared/lib/markdown/ascii-art.test.ts +154 -0
  550. package/src/shared/lib/markdown/ascii-art.ts +158 -0
  551. package/src/shared/lib/markdown/marked.ts +24 -2
  552. package/src/shared/lib/models/provider/identity.test.ts +34 -0
  553. package/src/shared/lib/models/provider/identity.ts +28 -0
  554. package/src/shared/lib/net/base-url.test.ts +25 -0
  555. package/src/shared/lib/net/base-url.ts +29 -0
  556. package/src/shared/lib/omp/config/schema-extras.ts +9 -8
  557. package/src/shared/lib/omp/session/parse-message-blocks.ts +2 -2
  558. package/src/shared/lib/panels/plugin-repo.test.ts +113 -0
  559. package/src/shared/lib/panels/plugin-repo.ts +149 -0
  560. package/src/shared/lib/settings/defaults.ts +6 -0
  561. package/src/shared/lib/tts/capability.ts +16 -0
  562. package/src/shared/lib/tts/engines.test.ts +91 -0
  563. package/src/shared/lib/tts/engines.ts +314 -0
  564. package/src/shared/lib/tts/settings.test.ts +56 -0
  565. package/src/shared/lib/tts/settings.ts +108 -0
  566. package/src/shared/lib/tts/speakable.test.ts +76 -0
  567. package/src/shared/lib/tts/speakable.ts +179 -0
  568. package/src/shared/lib/tts/voices.ts +98 -0
  569. package/src/shared/lib/workspace/right-side-hidden.ts +57 -0
  570. package/src/shared/lib/workspace/session-state/store.ts +7 -5
  571. package/src/shared/types/chat.ts +8 -1
  572. package/src/shared/types/harness.ts +5 -0
  573. package/src/shared/types/panels-registry.ts +32 -0
  574. package/src/shared/types/panels.ts +23 -0
  575. package/src/shared/types/session-changes.ts +15 -1
  576. package/src/shared/types/settings/state.ts +37 -0
  577. package/src/shared/types/tokenUsage.ts +21 -0
  578. package/src/test-support/preload.ts +9 -0
  579. package/src/test-support/pristine-globals.ts +5 -0
  580. package/dist/client/static/js/ImageView-pr4h38hb.js +0 -1
  581. package/dist/client/static/js/LayoutWrapper-n4tzhjes.js +0 -2
  582. package/dist/client/static/js/MergeDiffView-0t15nh9f.js +0 -1
  583. package/dist/client/static/js/Modal-77hgx4dw.js +0 -59
  584. package/dist/client/static/js/PdfView-gzxhvxe8.js +0 -1
  585. package/dist/client/static/js/SessionsView-2tdqrvk0.js +0 -1
  586. package/dist/client/static/js/architecture-7GRP2DOG-zs15nydj.js +0 -1
  587. package/dist/client/static/js/architectureDiagram-NJMV4G6O-heep78p6.js +0 -36
  588. package/dist/client/static/js/bash-8d3wrx5c.js +0 -1
  589. package/dist/client/static/js/c-rn3z0csz.js +0 -1
  590. package/dist/client/static/js/cose-bilkent-JH36ORCC-ybv1ttbx.js +0 -1
  591. package/dist/client/static/js/cpp-99ws9nak.js +0 -1
  592. package/dist/client/static/js/css-drfs4n12.js +0 -1
  593. package/dist/client/static/js/css-narcr42w.js +0 -1
  594. package/dist/client/static/js/cynefin-OW5HDTMX-p3y1b4ap.js +0 -1
  595. package/dist/client/static/js/dagre-6A5THRUB-gk0gp124.js +0 -4
  596. package/dist/client/static/js/diagram-3UASUU5V-bzstt5e2.js +0 -24
  597. package/dist/client/static/js/eventmodeling-NTZA5JFV-sx2cwkz3.js +0 -1
  598. package/dist/client/static/js/flowDiagram-KWPJA3E3-dsc17mty.js +0 -1
  599. package/dist/client/static/js/gitGraph-4MIJSDKK-yqhbscsd.js +0 -1
  600. package/dist/client/static/js/graphql-tr0jcndy.js +0 -1
  601. package/dist/client/static/js/html-n8fdvrdk.js +0 -1
  602. package/dist/client/static/js/index-1hb8fvw9.js +0 -1
  603. package/dist/client/static/js/index-869vdnz8.js +0 -2
  604. package/dist/client/static/js/index-9a78xmkk.js +0 -462
  605. package/dist/client/static/js/index-aa3hmn6j.js +0 -314
  606. package/dist/client/static/js/index-axtm1aq8.js +0 -2
  607. package/dist/client/static/js/index-b2cs4c51.js +0 -4
  608. package/dist/client/static/js/index-fryp0kgf.js +0 -2
  609. package/dist/client/static/js/index-gkmn4y1v.js +0 -1
  610. package/dist/client/static/js/index-kjr68pcj.js +0 -2
  611. package/dist/client/static/js/index-m39gbcxn.js +0 -1
  612. package/dist/client/static/js/index-qek9mt5w.js +0 -1
  613. package/dist/client/static/js/index-rgxg0azs.css +0 -1
  614. package/dist/client/static/js/index-rq4dk4tp.js +0 -4
  615. package/dist/client/static/js/index-vnv9z0a1.js +0 -1
  616. package/dist/client/static/js/index-xr4hjv01.js +0 -2
  617. package/dist/client/static/js/info-A6RAGUB7-0sd3zzgg.js +0 -1
  618. package/dist/client/static/js/ini-tnaw7zjy.js +0 -1
  619. package/dist/client/static/js/java-m4dpc2vw.js +0 -1
  620. package/dist/client/static/js/javascript-8y26t991.js +0 -1
  621. package/dist/client/static/js/json-azm7bdqd.js +0 -1
  622. package/dist/client/static/js/jsx-p9j1k773.js +0 -1
  623. package/dist/client/static/js/lua-hbm9rhz9.js +0 -1
  624. package/dist/client/static/js/markdown-tk3cd3vs.js +0 -1
  625. package/dist/client/static/js/one-dark-pro-2cdc2nk7.js +0 -1
  626. package/dist/client/static/js/one-light-bt6z4jf0.js +0 -1
  627. package/dist/client/static/js/packet-AYTQ26CC-13w2v5bb.js +0 -1
  628. package/dist/client/static/js/pie-WAS4IAKB-swtnysgn.js +0 -1
  629. package/dist/client/static/js/properties-6911ckw7.js +0 -1
  630. package/dist/client/static/js/python-44cvj250.js +0 -1
  631. package/dist/client/static/js/quadrantDiagram-O4NWA36T-dxkwxbqb.js +0 -7
  632. package/dist/client/static/js/r-t3sepzm4.js +0 -1
  633. package/dist/client/static/js/radar-RG4KPBEZ-vtvxkx55.js +0 -1
  634. package/dist/client/static/js/railroad-74A4TZTK-5sp2d63r.js +0 -1
  635. package/dist/client/static/js/railroad-abnf-HS5TGJTU-kg706fan.js +0 -1
  636. package/dist/client/static/js/railroad-ebnf-LZEXJU2U-4ra1gzx5.js +0 -1
  637. package/dist/client/static/js/railroad-peg-WCYAUIDC-hms3zpjm.js +0 -1
  638. package/dist/client/static/js/sql-zdkawqx3.js +0 -1
  639. package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-3dwas56m.js +0 -8
  640. package/dist/client/static/js/treeView-Q6P3EWNA-7t5k6rs2.js +0 -1
  641. package/dist/client/static/js/treemap-WGGIJYW6-w56ry3bg.js +0 -1
  642. package/dist/client/static/js/tsx-b7eabr17.js +0 -1
  643. package/dist/client/static/js/typescript-nnkvhwfy.js +0 -1
  644. package/dist/client/static/js/wardley-WFR3VGLG-rtjb9kgv.js +0 -1
  645. package/dist/client/static/js/wardleyDiagram-VNRHLVJA-10ph3bzq.js +0 -78
  646. package/dist/client/static/js/xml-xy1tw6b2.js +0 -1
  647. package/dist/client/static/js/yaml-0fexqg2d.js +0 -1
@@ -1 +0,0 @@
1
- import{t,l,h}from"./index-aa3hmn6j.js";import{jr}from"./index-a58rkn3f.js";import{bn,Fn}from"./index-g3rg6vsd.js";var q=Fn(function(Z,K){(function(w,L){if(typeof Z==="object"&&typeof K==="object")K.exports=L();else if(typeof define==="function"&&define.amd)define([],L);else if(typeof Z==="object")Z.layoutBase=L();else w.layoutBase=L()})(Z,function(){return function(m){var w={};function L(s){if(w[s])return w[s].exports;var r=w[s]={i:s,l:!1,exports:{}};return m[s].call(r.exports,r,r.exports,L),r.l=!0,r.exports}return L.m=m,L.c=w,L.i=function(s){return s},L.d=function(s,r,e){if(!L.o(s,r))Object.defineProperty(s,r,{configurable:!1,enumerable:!0,get:e})},L.n=function(s){var r=s&&s.__esModule?function(){return s.default}:function(){return s};return L.d(r,"a",r),r},L.o=function(s,r){return Object.prototype.hasOwnProperty.call(s,r)},L.p="",L(L.s=26)}([function(m,w,L){function s(){}s.QUALITY=1,s.DEFAULT_CREATE_BENDS_AS_NEEDED=!1,s.DEFAULT_INCREMENTAL=!1,s.DEFAULT_ANIMATION_ON_LAYOUT=!0,s.DEFAULT_ANIMATION_DURING_LAYOUT=!1,s.DEFAULT_ANIMATION_PERIOD=50,s.DEFAULT_UNIFORM_LEAF_NODE_SIZES=!1,s.DEFAULT_GRAPH_MARGIN=15,s.NODE_DIMENSIONS_INCLUDE_LABELS=!1,s.SIMPLE_NODE_SIZE=40,s.SIMPLE_NODE_HALF_SIZE=s.SIMPLE_NODE_SIZE/2,s.EMPTY_COMPOUND_NODE_SIZE=40,s.MIN_EDGE_LENGTH=1,s.WORLD_BOUNDARY=1e6,s.INITIAL_WORLD_BOUNDARY=s.WORLD_BOUNDARY/1000,s.WORLD_CENTER_X=1200,s.WORLD_CENTER_Y=900,m.exports=s},function(m,w,L){var s=L(2),r=L(8),e=L(9);function i(c,o,y){s.call(this,y),this.isOverlapingSourceAndTarget=!1,this.vGraphObject=y,this.bendpoints=[],this.source=c,this.target=o}i.prototype=Object.create(s.prototype);for(var u in s)i[u]=s[u];i.prototype.getSource=function(){return this.source},i.prototype.getTarget=function(){return this.target},i.prototype.isInterGraph=function(){return this.isInterGraph},i.prototype.getLength=function(){return this.length},i.prototype.isOverlapingSourceAndTarget=function(){return this.isOverlapingSourceAndTarget},i.prototype.getBendpoints=function(){return this.bendpoints},i.prototype.getLca=function(){return this.lca},i.prototype.getSourceInLca=function(){return this.sourceInLca},i.prototype.getTargetInLca=function(){return this.targetInLca},i.prototype.getOtherEnd=function(c){if(this.source===c)return this.target;else if(this.target===c)return this.source;else throw"Node is not incident with this edge"},i.prototype.getOtherEndInGraph=function(c,o){var y=this.getOtherEnd(c),n=o.getGraphManager().getRoot();while(!0){if(y.getOwner()==o)return y;if(y.getOwner()==n)break;y=y.getOwner().getParent()}return null},i.prototype.updateLength=function(){var c=[,,,,];if(this.isOverlapingSourceAndTarget=r.getIntersection(this.target.getRect(),this.source.getRect(),c),!this.isOverlapingSourceAndTarget){if(this.lengthX=c[0]-c[2],this.lengthY=c[1]-c[3],Math.abs(this.lengthX)<1)this.lengthX=e.sign(this.lengthX);if(Math.abs(this.lengthY)<1)this.lengthY=e.sign(this.lengthY);this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY)}},i.prototype.updateLengthSimple=function(){if(this.lengthX=this.target.getCenterX()-this.source.getCenterX(),this.lengthY=this.target.getCenterY()-this.source.getCenterY(),Math.abs(this.lengthX)<1)this.lengthX=e.sign(this.lengthX);if(Math.abs(this.lengthY)<1)this.lengthY=e.sign(this.lengthY);this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY)},m.exports=i},function(m,w,L){function s(r){this.vGraphObject=r}m.exports=s},function(m,w,L){var s=L(2),r=L(10),e=L(13),i=L(0),u=L(16),c=L(4);function o(n,g,f,E){if(f==null&&E==null)E=g;if(s.call(this,E),n.graphManager!=null)n=n.graphManager;if(this.estimatedSize=r.MIN_VALUE,this.inclusionTreeDepth=r.MAX_VALUE,this.vGraphObject=E,this.edges=[],this.graphManager=n,f!=null&&g!=null)this.rect=new e(g.x,g.y,f.width,f.height);else this.rect=new e}o.prototype=Object.create(s.prototype);for(var y in s)o[y]=s[y];o.prototype.getEdges=function(){return this.edges},o.prototype.getChild=function(){return this.child},o.prototype.getOwner=function(){return this.owner},o.prototype.getWidth=function(){return this.rect.width},o.prototype.setWidth=function(n){this.rect.width=n},o.prototype.getHeight=function(){return this.rect.height},o.prototype.setHeight=function(n){this.rect.height=n},o.prototype.getCenterX=function(){return this.rect.x+this.rect.width/2},o.prototype.getCenterY=function(){return this.rect.y+this.rect.height/2},o.prototype.getCenter=function(){return new c(this.rect.x+this.rect.width/2,this.rect.y+this.rect.height/2)},o.prototype.getLocation=function(){return new c(this.rect.x,this.rect.y)},o.prototype.getRect=function(){return this.rect},o.prototype.getDiagonal=function(){return Math.sqrt(this.rect.width*this.rect.width+this.rect.height*this.rect.height)},o.prototype.getHalfTheDiagonal=function(){return Math.sqrt(this.rect.height*this.rect.height+this.rect.width*this.rect.width)/2},o.prototype.setRect=function(n,g){this.rect.x=n.x,this.rect.y=n.y,this.rect.width=g.width,this.rect.height=g.height},o.prototype.setCenter=function(n,g){this.rect.x=n-this.rect.width/2,this.rect.y=g-this.rect.height/2},o.prototype.setLocation=function(n,g){this.rect.x=n,this.rect.y=g},o.prototype.moveBy=function(n,g){this.rect.x+=n,this.rect.y+=g},o.prototype.getEdgeListToNode=function(n){var g=[],f,E=this;return E.edges.forEach(function(T){if(T.target==n){if(T.source!=E)throw"Incorrect edge source!";g.push(T)}}),g},o.prototype.getEdgesBetween=function(n){var g=[],f,E=this;return E.edges.forEach(function(T){if(!(T.source==E||T.target==E))throw"Incorrect edge source and/or target";if(T.target==n||T.source==n)g.push(T)}),g},o.prototype.getNeighborsList=function(){var n=new Set,g=this;return g.edges.forEach(function(f){if(f.source==g)n.add(f.target);else{if(f.target!=g)throw"Incorrect incidency!";n.add(f.source)}}),n},o.prototype.withChildren=function(){var n=new Set,g,f;if(n.add(this),this.child!=null){var E=this.child.getNodes();for(var T=0;T<E.length;T++)g=E[T],f=g.withChildren(),f.forEach(function(N){n.add(N)})}return n},o.prototype.getNoOfChildren=function(){var n=0,g;if(this.child==null)n=1;else{var f=this.child.getNodes();for(var E=0;E<f.length;E++)g=f[E],n+=g.getNoOfChildren()}if(n==0)n=1;return n},o.prototype.getEstimatedSize=function(){if(this.estimatedSize==r.MIN_VALUE)throw"assert failed";return this.estimatedSize},o.prototype.calcEstimatedSize=function(){if(this.child==null)return this.estimatedSize=(this.rect.width+this.rect.height)/2;else return this.estimatedSize=this.child.calcEstimatedSize(),this.rect.width=this.estimatedSize,this.rect.height=this.estimatedSize,this.estimatedSize},o.prototype.scatter=function(){var n,g,f=-i.INITIAL_WORLD_BOUNDARY,E=i.INITIAL_WORLD_BOUNDARY;n=i.WORLD_CENTER_X+u.nextDouble()*(E-f)+f;var T=-i.INITIAL_WORLD_BOUNDARY,N=i.INITIAL_WORLD_BOUNDARY;g=i.WORLD_CENTER_Y+u.nextDouble()*(N-T)+T,this.rect.x=n,this.rect.y=g},o.prototype.updateBounds=function(){if(this.getChild()==null)throw"assert failed";if(this.getChild().getNodes().length!=0){var n=this.getChild();if(n.updateBounds(!0),this.rect.x=n.getLeft(),this.rect.y=n.getTop(),this.setWidth(n.getRight()-n.getLeft()),this.setHeight(n.getBottom()-n.getTop()),i.NODE_DIMENSIONS_INCLUDE_LABELS){var g=n.getRight()-n.getLeft(),f=n.getBottom()-n.getTop();if(this.labelWidth>g)this.rect.x-=(this.labelWidth-g)/2,this.setWidth(this.labelWidth);if(this.labelHeight>f){if(this.labelPos=="center")this.rect.y-=(this.labelHeight-f)/2;else if(this.labelPos=="top")this.rect.y-=this.labelHeight-f;this.setHeight(this.labelHeight)}}}},o.prototype.getInclusionTreeDepth=function(){if(this.inclusionTreeDepth==r.MAX_VALUE)throw"assert failed";return this.inclusionTreeDepth},o.prototype.transform=function(n){var g=this.rect.x;if(g>i.WORLD_BOUNDARY)g=i.WORLD_BOUNDARY;else if(g<-i.WORLD_BOUNDARY)g=-i.WORLD_BOUNDARY;var f=this.rect.y;if(f>i.WORLD_BOUNDARY)f=i.WORLD_BOUNDARY;else if(f<-i.WORLD_BOUNDARY)f=-i.WORLD_BOUNDARY;var E=new c(g,f),T=n.inverseTransformPoint(E);this.setLocation(T.x,T.y)},o.prototype.getLeft=function(){return this.rect.x},o.prototype.getRight=function(){return this.rect.x+this.rect.width},o.prototype.getTop=function(){return this.rect.y},o.prototype.getBottom=function(){return this.rect.y+this.rect.height},o.prototype.getParent=function(){if(this.owner==null)return null;return this.owner.getParent()},m.exports=o},function(m,w,L){function s(r,e){if(r==null&&e==null)this.x=0,this.y=0;else this.x=r,this.y=e}s.prototype.getX=function(){return this.x},s.prototype.getY=function(){return this.y},s.prototype.setX=function(r){this.x=r},s.prototype.setY=function(r){this.y=r},s.prototype.getDifference=function(r){return new DimensionD(this.x-r.x,this.y-r.y)},s.prototype.getCopy=function(){return new s(this.x,this.y)},s.prototype.translate=function(r){return this.x+=r.width,this.y+=r.height,this},m.exports=s},function(m,w,L){var s=L(2),r=L(10),e=L(0),i=L(6),u=L(3),c=L(1),o=L(13),y=L(12),n=L(11);function g(E,T,N){if(s.call(this,N),this.estimatedSize=r.MIN_VALUE,this.margin=e.DEFAULT_GRAPH_MARGIN,this.edges=[],this.nodes=[],this.isConnected=!1,this.parent=E,T!=null&&T instanceof i)this.graphManager=T;else if(T!=null&&T instanceof Layout)this.graphManager=T.graphManager}g.prototype=Object.create(s.prototype);for(var f in s)g[f]=s[f];g.prototype.getNodes=function(){return this.nodes},g.prototype.getEdges=function(){return this.edges},g.prototype.getGraphManager=function(){return this.graphManager},g.prototype.getParent=function(){return this.parent},g.prototype.getLeft=function(){return this.left},g.prototype.getRight=function(){return this.right},g.prototype.getTop=function(){return this.top},g.prototype.getBottom=function(){return this.bottom},g.prototype.isConnected=function(){return this.isConnected},g.prototype.add=function(E,T,N){if(T==null&&N==null){var v=E;if(this.graphManager==null)throw"Graph has no graph mgr!";if(this.getNodes().indexOf(v)>-1)throw"Node already in graph!";return v.owner=this,this.getNodes().push(v),v}else{var O=E;if(!(this.getNodes().indexOf(T)>-1&&this.getNodes().indexOf(N)>-1))throw"Source or target not in graph!";if(!(T.owner==N.owner&&T.owner==this))throw"Both owners must be this graph!";if(T.owner!=N.owner)return null;if(O.source=T,O.target=N,O.isInterGraph=!1,this.getEdges().push(O),T.edges.push(O),N!=T)N.edges.push(O);return O}},g.prototype.remove=function(E){var T=E;if(E instanceof u){if(T==null)throw"Node is null!";if(!(T.owner!=null&&T.owner==this))throw"Owner graph is invalid!";if(this.graphManager==null)throw"Owner graph manager is invalid!";var N=T.edges.slice(),v,O=N.length;for(var D=0;D<O;D++)if(v=N[D],v.isInterGraph)this.graphManager.remove(v);else v.source.owner.remove(v);var R=this.nodes.indexOf(T);if(R==-1)throw"Node not in owner node list!";this.nodes.splice(R,1)}else if(E instanceof c){var v=E;if(v==null)throw"Edge is null!";if(!(v.source!=null&&v.target!=null))throw"Source and/or target is null!";if(!(v.source.owner!=null&&v.target.owner!=null&&v.source.owner==this&&v.target.owner==this))throw"Source and/or target owner is invalid!";var a=v.source.edges.indexOf(v),p=v.target.edges.indexOf(v);if(!(a>-1&&p>-1))throw"Source and/or target doesn't know this edge!";if(v.source.edges.splice(a,1),v.target!=v.source)v.target.edges.splice(p,1);var R=v.source.owner.getEdges().indexOf(v);if(R==-1)throw"Not in owner's edge list!";v.source.owner.getEdges().splice(R,1)}},g.prototype.updateLeftTop=function(){var{MAX_VALUE:E,MAX_VALUE:T}=r,N,v,O,D=this.getNodes(),R=D.length;for(var a=0;a<R;a++){var p=D[a];if(N=p.getTop(),v=p.getLeft(),E>N)E=N;if(T>v)T=v}if(E==r.MAX_VALUE)return null;if(D[0].getParent().paddingLeft!=null)O=D[0].getParent().paddingLeft;else O=this.margin;return this.left=T-O,this.top=E-O,new y(this.left,this.top)},g.prototype.updateBounds=function(E){var T=r.MAX_VALUE,N=-r.MAX_VALUE,v=r.MAX_VALUE,O=-r.MAX_VALUE,D,R,a,p,d,A=this.nodes,I=A.length;for(var C=0;C<I;C++){var M=A[C];if(E&&M.child!=null)M.updateBounds();if(D=M.getLeft(),R=M.getRight(),a=M.getTop(),p=M.getBottom(),T>D)T=D;if(N<R)N=R;if(v>a)v=a;if(O<p)O=p}var G=new o(T,v,N-T,O-v);if(T==r.MAX_VALUE)this.left=this.parent.getLeft(),this.right=this.parent.getRight(),this.top=this.parent.getTop(),this.bottom=this.parent.getBottom();if(A[0].getParent().paddingLeft!=null)d=A[0].getParent().paddingLeft;else d=this.margin;this.left=G.x-d,this.right=G.x+G.width+d,this.top=G.y-d,this.bottom=G.y+G.height+d},g.calculateBounds=function(E){var T=r.MAX_VALUE,N=-r.MAX_VALUE,v=r.MAX_VALUE,O=-r.MAX_VALUE,D,R,a,p,d=E.length;for(var A=0;A<d;A++){var I=E[A];if(D=I.getLeft(),R=I.getRight(),a=I.getTop(),p=I.getBottom(),T>D)T=D;if(N<R)N=R;if(v>a)v=a;if(O<p)O=p}var C=new o(T,v,N-T,O-v);return C},g.prototype.getInclusionTreeDepth=function(){if(this==this.graphManager.getRoot())return 1;else return this.parent.getInclusionTreeDepth()},g.prototype.getEstimatedSize=function(){if(this.estimatedSize==r.MIN_VALUE)throw"assert failed";return this.estimatedSize},g.prototype.calcEstimatedSize=function(){var E=0,T=this.nodes,N=T.length;for(var v=0;v<N;v++){var O=T[v];E+=O.calcEstimatedSize()}if(E==0)this.estimatedSize=e.EMPTY_COMPOUND_NODE_SIZE;else this.estimatedSize=E/Math.sqrt(this.nodes.length);return this.estimatedSize},g.prototype.updateConnected=function(){var E=this;if(this.nodes.length==0){this.isConnected=!0;return}var T=new n,N=new Set,v=this.nodes[0],O,D,R=v.withChildren();R.forEach(function(C){T.push(C),N.add(C)});while(T.length!==0){v=T.shift(),O=v.getEdges();var a=O.length;for(var p=0;p<a;p++){var d=O[p];if(D=d.getOtherEndInGraph(v,this),D!=null&&!N.has(D)){var A=D.withChildren();A.forEach(function(C){T.push(C),N.add(C)})}}}if(this.isConnected=!1,N.size>=this.nodes.length){var I=0;if(N.forEach(function(C){if(C.owner==E)I++}),I==this.nodes.length)this.isConnected=!0}},m.exports=g},function(m,w,L){var s,r=L(1);function e(i){s=L(5),this.layout=i,this.graphs=[],this.edges=[]}e.prototype.addRoot=function(){var i=this.layout.newGraph(),u=this.layout.newNode(null),c=this.add(i,u);return this.setRootGraph(c),this.rootGraph},e.prototype.add=function(i,u,c,o,y){if(c==null&&o==null&&y==null){if(i==null)throw"Graph is null!";if(u==null)throw"Parent node is null!";if(this.graphs.indexOf(i)>-1)throw"Graph already in this graph mgr!";if(this.graphs.push(i),i.parent!=null)throw"Already has a parent!";if(u.child!=null)throw"Already has a child!";return i.parent=u,u.child=i,i}else{y=c,o=u,c=i;var n=o.getOwner(),g=y.getOwner();if(!(n!=null&&n.getGraphManager()==this))throw"Source not in this graph mgr!";if(!(g!=null&&g.getGraphManager()==this))throw"Target not in this graph mgr!";if(n==g)return c.isInterGraph=!1,n.add(c,o,y);else{if(c.isInterGraph=!0,c.source=o,c.target=y,this.edges.indexOf(c)>-1)throw"Edge already in inter-graph edge list!";if(this.edges.push(c),!(c.source!=null&&c.target!=null))throw"Edge source and/or target is null!";if(!(c.source.edges.indexOf(c)==-1&&c.target.edges.indexOf(c)==-1))throw"Edge already in source and/or target incidency list!";return c.source.edges.push(c),c.target.edges.push(c),c}}},e.prototype.remove=function(i){if(i instanceof s){var u=i;if(u.getGraphManager()!=this)throw"Graph not in this graph mgr";if(!(u==this.rootGraph||u.parent!=null&&u.parent.graphManager==this))throw"Invalid parent node!";var c=[];c=c.concat(u.getEdges());var o,y=c.length;for(var n=0;n<y;n++)o=c[n],u.remove(o);var g=[];g=g.concat(u.getNodes());var f;y=g.length;for(var n=0;n<y;n++)f=g[n],u.remove(f);if(u==this.rootGraph)this.setRootGraph(null);var E=this.graphs.indexOf(u);this.graphs.splice(E,1),u.parent=null}else if(i instanceof r){if(o=i,o==null)throw"Edge is null!";if(!o.isInterGraph)throw"Not an inter-graph edge!";if(!(o.source!=null&&o.target!=null))throw"Source and/or target is null!";if(!(o.source.edges.indexOf(o)!=-1&&o.target.edges.indexOf(o)!=-1))throw"Source and/or target doesn't know this edge!";var E=o.source.edges.indexOf(o);if(o.source.edges.splice(E,1),E=o.target.edges.indexOf(o),o.target.edges.splice(E,1),!(o.source.owner!=null&&o.source.owner.getGraphManager()!=null))throw"Edge owner graph or owner graph manager is null!";if(o.source.owner.getGraphManager().edges.indexOf(o)==-1)throw"Not in owner graph manager's edge list!";var E=o.source.owner.getGraphManager().edges.indexOf(o);o.source.owner.getGraphManager().edges.splice(E,1)}},e.prototype.updateBounds=function(){this.rootGraph.updateBounds(!0)},e.prototype.getGraphs=function(){return this.graphs},e.prototype.getAllNodes=function(){if(this.allNodes==null){var i=[],u=this.getGraphs(),c=u.length;for(var o=0;o<c;o++)i=i.concat(u[o].getNodes());this.allNodes=i}return this.allNodes},e.prototype.resetAllNodes=function(){this.allNodes=null},e.prototype.resetAllEdges=function(){this.allEdges=null},e.prototype.resetAllNodesToApplyGravitation=function(){this.allNodesToApplyGravitation=null},e.prototype.getAllEdges=function(){if(this.allEdges==null){var i=[],u=this.getGraphs(),c=u.length;for(var o=0;o<u.length;o++)i=i.concat(u[o].getEdges());i=i.concat(this.edges),this.allEdges=i}return this.allEdges},e.prototype.getAllNodesToApplyGravitation=function(){return this.allNodesToApplyGravitation},e.prototype.setAllNodesToApplyGravitation=function(i){if(this.allNodesToApplyGravitation!=null)throw"assert failed";this.allNodesToApplyGravitation=i},e.prototype.getRoot=function(){return this.rootGraph},e.prototype.setRootGraph=function(i){if(i.getGraphManager()!=this)throw"Root not in this graph mgr!";if(this.rootGraph=i,i.parent==null)i.parent=this.layout.newNode("Root node")},e.prototype.getLayout=function(){return this.layout},e.prototype.isOneAncestorOfOther=function(i,u){if(!(i!=null&&u!=null))throw"assert failed";if(i==u)return!0;var c=i.getOwner(),o;do{if(o=c.getParent(),o==null)break;if(o==u)return!0;if(c=o.getOwner(),c==null)break}while(!0);c=u.getOwner();do{if(o=c.getParent(),o==null)break;if(o==i)return!0;if(c=o.getOwner(),c==null)break}while(!0);return!1},e.prototype.calcLowestCommonAncestors=function(){var i,u,c,o,y,n=this.getAllEdges(),g=n.length;for(var f=0;f<g;f++){if(i=n[f],u=i.source,c=i.target,i.lca=null,i.sourceInLca=u,i.targetInLca=c,u==c){i.lca=u.getOwner();continue}o=u.getOwner();while(i.lca==null){i.targetInLca=c,y=c.getOwner();while(i.lca==null){if(y==o){i.lca=y;break}if(y==this.rootGraph)break;if(i.lca!=null)throw"assert failed";i.targetInLca=y.getParent(),y=i.targetInLca.getOwner()}if(o==this.rootGraph)break;if(i.lca==null)i.sourceInLca=o.getParent(),o=i.sourceInLca.getOwner()}if(i.lca==null)throw"assert failed"}},e.prototype.calcLowestCommonAncestor=function(i,u){if(i==u)return i.getOwner();var c=i.getOwner();do{if(c==null)break;var o=u.getOwner();do{if(o==null)break;if(o==c)return o;o=o.getParent().getOwner()}while(!0);c=c.getParent().getOwner()}while(!0);return c},e.prototype.calcInclusionTreeDepths=function(i,u){if(i==null&&u==null)i=this.rootGraph,u=1;var c,o=i.getNodes(),y=o.length;for(var n=0;n<y;n++)if(c=o[n],c.inclusionTreeDepth=u,c.child!=null)this.calcInclusionTreeDepths(c.child,u+1)},e.prototype.includesInvalidEdge=function(){var i,u=this.edges.length;for(var c=0;c<u;c++)if(i=this.edges[c],this.isOneAncestorOfOther(i.source,i.target))return!0;return!1},m.exports=e},function(m,w,L){var s=L(0);function r(){}for(var e in s)r[e]=s[e];r.MAX_ITERATIONS=2500,r.DEFAULT_EDGE_LENGTH=50,r.DEFAULT_SPRING_STRENGTH=0.45,r.DEFAULT_REPULSION_STRENGTH=4500,r.DEFAULT_GRAVITY_STRENGTH=0.4,r.DEFAULT_COMPOUND_GRAVITY_STRENGTH=1,r.DEFAULT_GRAVITY_RANGE_FACTOR=3.8,r.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=1.5,r.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION=!0,r.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION=!0,r.DEFAULT_COOLING_FACTOR_INCREMENTAL=0.3,r.COOLING_ADAPTATION_FACTOR=0.33,r.ADAPTATION_LOWER_NODE_LIMIT=1000,r.ADAPTATION_UPPER_NODE_LIMIT=5000,r.MAX_NODE_DISPLACEMENT_INCREMENTAL=100,r.MAX_NODE_DISPLACEMENT=r.MAX_NODE_DISPLACEMENT_INCREMENTAL*3,r.MIN_REPULSION_DIST=r.DEFAULT_EDGE_LENGTH/10,r.CONVERGENCE_CHECK_PERIOD=100,r.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=0.1,r.MIN_EDGE_LENGTH=1,r.GRID_CALCULATION_CHECK_PERIOD=10,m.exports=r},function(m,w,L){var s=L(12);function r(){}r.calcSeparationAmount=function(e,i,u,c){if(!e.intersects(i))throw"assert failed";var o=[,,];if(this.decideDirectionsForOverlappingNodes(e,i,o),u[0]=Math.min(e.getRight(),i.getRight())-Math.max(e.x,i.x),u[1]=Math.min(e.getBottom(),i.getBottom())-Math.max(e.y,i.y),e.getX()<=i.getX()&&e.getRight()>=i.getRight())u[0]+=Math.min(i.getX()-e.getX(),e.getRight()-i.getRight());else if(i.getX()<=e.getX()&&i.getRight()>=e.getRight())u[0]+=Math.min(e.getX()-i.getX(),i.getRight()-e.getRight());if(e.getY()<=i.getY()&&e.getBottom()>=i.getBottom())u[1]+=Math.min(i.getY()-e.getY(),e.getBottom()-i.getBottom());else if(i.getY()<=e.getY()&&i.getBottom()>=e.getBottom())u[1]+=Math.min(e.getY()-i.getY(),i.getBottom()-e.getBottom());var y=Math.abs((i.getCenterY()-e.getCenterY())/(i.getCenterX()-e.getCenterX()));if(i.getCenterY()===e.getCenterY()&&i.getCenterX()===e.getCenterX())y=1;var n=y*u[0],g=u[1]/y;if(u[0]<g)g=u[0];else n=u[1];u[0]=-1*o[0]*(g/2+c),u[1]=-1*o[1]*(n/2+c)},r.decideDirectionsForOverlappingNodes=function(e,i,u){if(e.getCenterX()<i.getCenterX())u[0]=-1;else u[0]=1;if(e.getCenterY()<i.getCenterY())u[1]=-1;else u[1]=1},r.getIntersection2=function(e,i,u){var c=e.getCenterX(),o=e.getCenterY(),y=i.getCenterX(),n=i.getCenterY();if(e.intersects(i))return u[0]=c,u[1]=o,u[2]=y,u[3]=n,!0;var g=e.getX(),f=e.getY(),E=e.getRight(),T=e.getX(),N=e.getBottom(),v=e.getRight(),O=e.getWidthHalf(),D=e.getHeightHalf(),R=i.getX(),a=i.getY(),p=i.getRight(),d=i.getX(),A=i.getBottom(),I=i.getRight(),C=i.getWidthHalf(),M=i.getHeightHalf(),G=!1,F=!1;if(c===y){if(o>n)return u[0]=c,u[1]=f,u[2]=y,u[3]=A,!1;else if(o<n)return u[0]=c,u[1]=N,u[2]=y,u[3]=a,!1}else if(o===n){if(c>y)return u[0]=g,u[1]=o,u[2]=p,u[3]=n,!1;else if(c<y)return u[0]=E,u[1]=o,u[2]=R,u[3]=n,!1}else{var P=e.height/e.width,b=i.height/i.width,U=(n-o)/(y-c),x=void 0,S=void 0,Y=void 0,X=void 0,H=void 0,_=void 0;if(-P===U)if(c>y)u[0]=T,u[1]=N,G=!0;else u[0]=E,u[1]=f,G=!0;else if(P===U)if(c>y)u[0]=g,u[1]=f,G=!0;else u[0]=v,u[1]=N,G=!0;if(-b===U)if(y>c)u[2]=d,u[3]=A,F=!0;else u[2]=p,u[3]=a,F=!0;else if(b===U)if(y>c)u[2]=R,u[3]=a,F=!0;else u[2]=I,u[3]=A,F=!0;if(G&&F)return!1;if(c>y)if(o>n)x=this.getCardinalDirection(P,U,4),S=this.getCardinalDirection(b,U,2);else x=this.getCardinalDirection(-P,U,3),S=this.getCardinalDirection(-b,U,1);else if(o>n)x=this.getCardinalDirection(-P,U,1),S=this.getCardinalDirection(-b,U,3);else x=this.getCardinalDirection(P,U,2),S=this.getCardinalDirection(b,U,4);if(!G)switch(x){case 1:X=f,Y=c+-D/U,u[0]=Y,u[1]=X;break;case 2:Y=v,X=o+O*U,u[0]=Y,u[1]=X;break;case 3:X=N,Y=c+D/U,u[0]=Y,u[1]=X;break;case 4:Y=T,X=o+-O*U,u[0]=Y,u[1]=X;break}if(!F)switch(S){case 1:_=a,H=y+-M/U,u[2]=H,u[3]=_;break;case 2:H=I,_=n+C*U,u[2]=H,u[3]=_;break;case 3:_=A,H=y+M/U,u[2]=H,u[3]=_;break;case 4:H=d,_=n+-C*U,u[2]=H,u[3]=_;break}}return!1},r.getCardinalDirection=function(e,i,u){if(e>i)return u;else return 1+u%4},r.getIntersection=function(e,i,u,c){if(c==null)return this.getIntersection2(e,i,u);var{x:o,y}=e,{x:n,y:g}=i,{x:f,y:E}=u,{x:T,y:N}=c,v=void 0,O=void 0,D=void 0,R=void 0,a=void 0,p=void 0,d=void 0,A=void 0,I=void 0;if(D=g-y,a=o-n,d=n*y-o*g,R=N-E,p=f-T,A=T*E-f*N,I=D*p-R*a,I===0)return null;return v=(a*A-p*d)/I,O=(R*d-D*A)/I,new s(v,O)},r.angleOfVector=function(e,i,u,c){var o=void 0;if(e!==u){if(o=Math.atan((c-i)/(u-e)),u<e)o+=Math.PI;else if(c<i)o+=this.TWO_PI}else if(c<i)o=this.ONE_AND_HALF_PI;else o=this.HALF_PI;return o},r.doIntersect=function(e,i,u,c){var{x:o,y}=e,{x:n,y:g}=i,{x:f,y:E}=u,{x:T,y:N}=c,v=(n-o)*(N-E)-(T-f)*(g-y);if(v===0)return!1;else{var O=((N-E)*(T-o)+(f-T)*(N-y))/v,D=((y-g)*(T-o)+(n-o)*(N-y))/v;return 0<O&&O<1&&0<D&&D<1}},r.HALF_PI=0.5*Math.PI,r.ONE_AND_HALF_PI=1.5*Math.PI,r.TWO_PI=2*Math.PI,r.THREE_PI=3*Math.PI,m.exports=r},function(m,w,L){function s(){}s.sign=function(r){if(r>0)return 1;else if(r<0)return-1;else return 0},s.floor=function(r){return r<0?Math.ceil(r):Math.floor(r)},s.ceil=function(r){return r<0?Math.floor(r):Math.ceil(r)},m.exports=s},function(m,w,L){function s(){}s.MAX_VALUE=2147483647,s.MIN_VALUE=-2147483648,m.exports=s},function(m,w,L){var s=function(){function o(y,n){for(var g=0;g<n.length;g++){var f=n[g];if(f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f)f.writable=!0;Object.defineProperty(y,f.key,f)}}return function(y,n,g){if(n)o(y.prototype,n);if(g)o(y,g);return y}}();function r(o,y){if(!(o instanceof y))throw TypeError("Cannot call a class as a function")}var e=function(y){return{value:y,next:null,prev:null}},i=function(y,n,g,f){if(y!==null)y.next=n;else f.head=n;if(g!==null)g.prev=n;else f.tail=n;return n.prev=y,n.next=g,f.length++,n},u=function(y,n){var{prev:g,next:f}=y;if(g!==null)g.next=f;else n.head=f;if(f!==null)f.prev=g;else n.tail=g;return y.prev=y.next=null,n.length--,y},c=function(){function o(y){var n=this;if(r(this,o),this.length=0,this.head=null,this.tail=null,y!=null)y.forEach(function(g){return n.push(g)})}return s(o,[{key:"size",value:function(){return this.length}},{key:"insertBefore",value:function(n,g){return i(g.prev,e(n),g,this)}},{key:"insertAfter",value:function(n,g){return i(g,e(n),g.next,this)}},{key:"insertNodeBefore",value:function(n,g){return i(g.prev,n,g,this)}},{key:"insertNodeAfter",value:function(n,g){return i(g,n,g.next,this)}},{key:"push",value:function(n){return i(this.tail,e(n),null,this)}},{key:"unshift",value:function(n){return i(null,e(n),this.head,this)}},{key:"remove",value:function(n){return u(n,this)}},{key:"pop",value:function(){return u(this.tail,this).value}},{key:"popNode",value:function(){return u(this.tail,this)}},{key:"shift",value:function(){return u(this.head,this).value}},{key:"shiftNode",value:function(){return u(this.head,this)}},{key:"get_object_at",value:function(n){if(n<=this.length()){var g=1,f=this.head;while(g<n)f=f.next,g++;return f.value}}},{key:"set_object_at",value:function(n,g){if(n<=this.length()){var f=1,E=this.head;while(f<n)E=E.next,f++;E.value=g}}}]),o}();m.exports=c},function(m,w,L){function s(r,e,i){if(this.x=null,this.y=null,r==null&&e==null&&i==null)this.x=0,this.y=0;else if(typeof r=="number"&&typeof e=="number"&&i==null)this.x=r,this.y=e;else if(r.constructor.name=="Point"&&e==null&&i==null)i=r,this.x=i.x,this.y=i.y}s.prototype.getX=function(){return this.x},s.prototype.getY=function(){return this.y},s.prototype.getLocation=function(){return new s(this.x,this.y)},s.prototype.setLocation=function(r,e,i){if(r.constructor.name=="Point"&&e==null&&i==null)i=r,this.setLocation(i.x,i.y);else if(typeof r=="number"&&typeof e=="number"&&i==null)if(parseInt(r)==r&&parseInt(e)==e)this.move(r,e);else this.x=Math.floor(r+0.5),this.y=Math.floor(e+0.5)},s.prototype.move=function(r,e){this.x=r,this.y=e},s.prototype.translate=function(r,e){this.x+=r,this.y+=e},s.prototype.equals=function(r){if(r.constructor.name=="Point"){var e=r;return this.x==e.x&&this.y==e.y}return this==r},s.prototype.toString=function(){return new s().constructor.name+"[x="+this.x+",y="+this.y+"]"},m.exports=s},function(m,w,L){function s(r,e,i,u){if(this.x=0,this.y=0,this.width=0,this.height=0,r!=null&&e!=null&&i!=null&&u!=null)this.x=r,this.y=e,this.width=i,this.height=u}s.prototype.getX=function(){return this.x},s.prototype.setX=function(r){this.x=r},s.prototype.getY=function(){return this.y},s.prototype.setY=function(r){this.y=r},s.prototype.getWidth=function(){return this.width},s.prototype.setWidth=function(r){this.width=r},s.prototype.getHeight=function(){return this.height},s.prototype.setHeight=function(r){this.height=r},s.prototype.getRight=function(){return this.x+this.width},s.prototype.getBottom=function(){return this.y+this.height},s.prototype.intersects=function(r){if(this.getRight()<r.x)return!1;if(this.getBottom()<r.y)return!1;if(r.getRight()<this.x)return!1;if(r.getBottom()<this.y)return!1;return!0},s.prototype.getCenterX=function(){return this.x+this.width/2},s.prototype.getMinX=function(){return this.getX()},s.prototype.getMaxX=function(){return this.getX()+this.width},s.prototype.getCenterY=function(){return this.y+this.height/2},s.prototype.getMinY=function(){return this.getY()},s.prototype.getMaxY=function(){return this.getY()+this.height},s.prototype.getWidthHalf=function(){return this.width/2},s.prototype.getHeightHalf=function(){return this.height/2},m.exports=s},function(m,w,L){var s=typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol==="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};function r(){}r.lastID=0,r.createID=function(e){if(r.isPrimitive(e))return e;if(e.uniqueID!=null)return e.uniqueID;return e.uniqueID=r.getString(),r.lastID++,e.uniqueID},r.getString=function(e){if(e==null)e=r.lastID;return"Object#"+e},r.isPrimitive=function(e){var i=typeof e>"u"?"undefined":s(e);return e==null||i!="object"&&i!="function"},m.exports=r},function(m,w,L){function s(f){if(Array.isArray(f)){for(var E=0,T=Array(f.length);E<f.length;E++)T[E]=f[E];return T}else return Array.from(f)}var r=L(0),e=L(6),i=L(3),u=L(1),c=L(5),o=L(4),y=L(17),n=L(27);function g(f){if(n.call(this),this.layoutQuality=r.QUALITY,this.createBendsAsNeeded=r.DEFAULT_CREATE_BENDS_AS_NEEDED,this.incremental=r.DEFAULT_INCREMENTAL,this.animationOnLayout=r.DEFAULT_ANIMATION_ON_LAYOUT,this.animationDuringLayout=r.DEFAULT_ANIMATION_DURING_LAYOUT,this.animationPeriod=r.DEFAULT_ANIMATION_PERIOD,this.uniformLeafNodeSizes=r.DEFAULT_UNIFORM_LEAF_NODE_SIZES,this.edgeToDummyNodes=new Map,this.graphManager=new e(this),this.isLayoutFinished=!1,this.isSubLayout=!1,this.isRemoteUse=!1,f!=null)this.isRemoteUse=f}g.RANDOM_SEED=1,g.prototype=Object.create(n.prototype),g.prototype.getGraphManager=function(){return this.graphManager},g.prototype.getAllNodes=function(){return this.graphManager.getAllNodes()},g.prototype.getAllEdges=function(){return this.graphManager.getAllEdges()},g.prototype.getAllNodesToApplyGravitation=function(){return this.graphManager.getAllNodesToApplyGravitation()},g.prototype.newGraphManager=function(){var f=new e(this);return this.graphManager=f,f},g.prototype.newGraph=function(f){return new c(null,this.graphManager,f)},g.prototype.newNode=function(f){return new i(this.graphManager,f)},g.prototype.newEdge=function(f){return new u(null,null,f)},g.prototype.checkLayoutSuccess=function(){return this.graphManager.getRoot()==null||this.graphManager.getRoot().getNodes().length==0||this.graphManager.includesInvalidEdge()},g.prototype.runLayout=function(){if(this.isLayoutFinished=!1,this.tilingPreLayout)this.tilingPreLayout();this.initParameters();var f;if(this.checkLayoutSuccess())f=!1;else f=this.layout();if(r.ANIMATE==="during")return!1;if(f){if(!this.isSubLayout)this.doPostLayout()}if(this.tilingPostLayout)this.tilingPostLayout();return this.isLayoutFinished=!0,f},g.prototype.doPostLayout=function(){if(!this.incremental)this.transform();this.update()},g.prototype.update2=function(){if(this.createBendsAsNeeded)this.createBendpointsFromDummyNodes(),this.graphManager.resetAllEdges();if(!this.isRemoteUse){var f,E=this.graphManager.getAllEdges();for(var T=0;T<E.length;T++)f=E[T];var N,v=this.graphManager.getRoot().getNodes();for(var T=0;T<v.length;T++)N=v[T];this.update(this.graphManager.getRoot())}},g.prototype.update=function(f){if(f==null)this.update2();else if(f instanceof i){var E=f;if(E.getChild()!=null){var T=E.getChild().getNodes();for(var N=0;N<T.length;N++)update(T[N])}if(E.vGraphObject!=null){var v=E.vGraphObject;v.update(E)}}else if(f instanceof u){var O=f;if(O.vGraphObject!=null){var D=O.vGraphObject;D.update(O)}}else if(f instanceof c){var R=f;if(R.vGraphObject!=null){var a=R.vGraphObject;a.update(R)}}},g.prototype.initParameters=function(){if(!this.isSubLayout)this.layoutQuality=r.QUALITY,this.animationDuringLayout=r.DEFAULT_ANIMATION_DURING_LAYOUT,this.animationPeriod=r.DEFAULT_ANIMATION_PERIOD,this.animationOnLayout=r.DEFAULT_ANIMATION_ON_LAYOUT,this.incremental=r.DEFAULT_INCREMENTAL,this.createBendsAsNeeded=r.DEFAULT_CREATE_BENDS_AS_NEEDED,this.uniformLeafNodeSizes=r.DEFAULT_UNIFORM_LEAF_NODE_SIZES;if(this.animationDuringLayout)this.animationOnLayout=!1},g.prototype.transform=function(f){if(f==null)this.transform(new o(0,0));else{var E=new y,T=this.graphManager.getRoot().updateLeftTop();if(T!=null){E.setWorldOrgX(f.x),E.setWorldOrgY(f.y),E.setDeviceOrgX(T.x),E.setDeviceOrgY(T.y);var N=this.getAllNodes(),v;for(var O=0;O<N.length;O++)v=N[O],v.transform(E)}}},g.prototype.positionNodesRandomly=function(f){if(f==null)this.positionNodesRandomly(this.getGraphManager().getRoot()),this.getGraphManager().getRoot().updateBounds(!0);else{var E,T,N=f.getNodes();for(var v=0;v<N.length;v++)if(E=N[v],T=E.getChild(),T==null)E.scatter();else if(T.getNodes().length==0)E.scatter();else this.positionNodesRandomly(T),E.updateBounds()}},g.prototype.getFlatForest=function(){var f=[],E=!0,T=this.graphManager.getRoot().getNodes(),N=!0;for(var v=0;v<T.length;v++)if(T[v].getChild()!=null)N=!1;if(!N)return f;var O=new Set,D=[],R=new Map,a=[];a=a.concat(T);while(a.length>0&&E){D.push(a[0]);while(D.length>0&&E){var p=D[0];D.splice(0,1),O.add(p);var d=p.getEdges();for(var v=0;v<d.length;v++){var A=d[v].getOtherEnd(p);if(R.get(p)!=A)if(!O.has(A))D.push(A),R.set(A,p);else{E=!1;break}}}if(!E)f=[];else{var I=[].concat(s(O));f.push(I);for(var v=0;v<I.length;v++){var C=I[v],M=a.indexOf(C);if(M>-1)a.splice(M,1)}O=new Set,R=new Map}}return f},g.prototype.createDummyNodesForBendpoints=function(f){var E=[],T=f.source,N=this.graphManager.calcLowestCommonAncestor(f.source,f.target);for(var v=0;v<f.bendpoints.length;v++){var O=this.newNode(null);O.setRect(new Point(0,0),new Dimension(1,1)),N.add(O);var D=this.newEdge(null);this.graphManager.add(D,T,O),E.add(O),T=O}var D=this.newEdge(null);if(this.graphManager.add(D,T,f.target),this.edgeToDummyNodes.set(f,E),f.isInterGraph())this.graphManager.remove(f);else N.remove(f);return E},g.prototype.createBendpointsFromDummyNodes=function(){var f=[];f=f.concat(this.graphManager.getAllEdges()),f=[].concat(s(this.edgeToDummyNodes.keys())).concat(f);for(var E=0;E<f.length;E++){var T=f[E];if(T.bendpoints.length>0){var N=this.edgeToDummyNodes.get(T);for(var v=0;v<N.length;v++){var O=N[v],D=new o(O.getCenterX(),O.getCenterY()),R=T.bendpoints.get(v);R.x=D.x,R.y=D.y,O.getOwner().remove(O)}this.graphManager.add(T,T.source,T.target)}}},g.transform=function(f,E,T,N){if(T!=null&&N!=null){var v=E;if(f<=50){var O=E/T;v-=(E-O)/50*(50-f)}else{var D=E*N;v+=(D-E)/50*(f-50)}return v}else{var R,a;if(f<=50)R=9*E/500,a=E/10;else R=9*E/50,a=-8*E;return R*f+a}},g.findCenterOfTree=function(f){var E=[];E=E.concat(f);var T=[],N=new Map,v=!1,O=null;if(E.length==1||E.length==2)v=!0,O=E[0];for(var D=0;D<E.length;D++){var R=E[D],a=R.getNeighborsList().size;if(N.set(R,R.getNeighborsList().size),a==1)T.push(R)}var p=[];p=p.concat(T);while(!v){var d=[];d=d.concat(p),p=[];for(var D=0;D<E.length;D++){var R=E[D],A=E.indexOf(R);if(A>=0)E.splice(A,1);var I=R.getNeighborsList();I.forEach(function(G){if(T.indexOf(G)<0){var F=N.get(G),P=F-1;if(P==1)p.push(G);N.set(G,P)}})}if(T=T.concat(p),E.length==1||E.length==2)v=!0,O=E[0]}return O},g.prototype.setGraphManager=function(f){this.graphManager=f},m.exports=g},function(m,w,L){function s(){}s.seed=1,s.x=0,s.nextDouble=function(){return s.x=Math.sin(s.seed++)*1e4,s.x-Math.floor(s.x)},m.exports=s},function(m,w,L){var s=L(4);function r(e,i){this.lworldOrgX=0,this.lworldOrgY=0,this.ldeviceOrgX=0,this.ldeviceOrgY=0,this.lworldExtX=1,this.lworldExtY=1,this.ldeviceExtX=1,this.ldeviceExtY=1}r.prototype.getWorldOrgX=function(){return this.lworldOrgX},r.prototype.setWorldOrgX=function(e){this.lworldOrgX=e},r.prototype.getWorldOrgY=function(){return this.lworldOrgY},r.prototype.setWorldOrgY=function(e){this.lworldOrgY=e},r.prototype.getWorldExtX=function(){return this.lworldExtX},r.prototype.setWorldExtX=function(e){this.lworldExtX=e},r.prototype.getWorldExtY=function(){return this.lworldExtY},r.prototype.setWorldExtY=function(e){this.lworldExtY=e},r.prototype.getDeviceOrgX=function(){return this.ldeviceOrgX},r.prototype.setDeviceOrgX=function(e){this.ldeviceOrgX=e},r.prototype.getDeviceOrgY=function(){return this.ldeviceOrgY},r.prototype.setDeviceOrgY=function(e){this.ldeviceOrgY=e},r.prototype.getDeviceExtX=function(){return this.ldeviceExtX},r.prototype.setDeviceExtX=function(e){this.ldeviceExtX=e},r.prototype.getDeviceExtY=function(){return this.ldeviceExtY},r.prototype.setDeviceExtY=function(e){this.ldeviceExtY=e},r.prototype.transformX=function(e){var i=0,u=this.lworldExtX;if(u!=0)i=this.ldeviceOrgX+(e-this.lworldOrgX)*this.ldeviceExtX/u;return i},r.prototype.transformY=function(e){var i=0,u=this.lworldExtY;if(u!=0)i=this.ldeviceOrgY+(e-this.lworldOrgY)*this.ldeviceExtY/u;return i},r.prototype.inverseTransformX=function(e){var i=0,u=this.ldeviceExtX;if(u!=0)i=this.lworldOrgX+(e-this.ldeviceOrgX)*this.lworldExtX/u;return i},r.prototype.inverseTransformY=function(e){var i=0,u=this.ldeviceExtY;if(u!=0)i=this.lworldOrgY+(e-this.ldeviceOrgY)*this.lworldExtY/u;return i},r.prototype.inverseTransformPoint=function(e){var i=new s(this.inverseTransformX(e.x),this.inverseTransformY(e.y));return i},m.exports=r},function(m,w,L){function s(n){if(Array.isArray(n)){for(var g=0,f=Array(n.length);g<n.length;g++)f[g]=n[g];return f}else return Array.from(n)}var r=L(15),e=L(7),i=L(0),u=L(8),c=L(9);function o(){r.call(this),this.useSmartIdealEdgeLengthCalculation=e.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION,this.idealEdgeLength=e.DEFAULT_EDGE_LENGTH,this.springConstant=e.DEFAULT_SPRING_STRENGTH,this.repulsionConstant=e.DEFAULT_REPULSION_STRENGTH,this.gravityConstant=e.DEFAULT_GRAVITY_STRENGTH,this.compoundGravityConstant=e.DEFAULT_COMPOUND_GRAVITY_STRENGTH,this.gravityRangeFactor=e.DEFAULT_GRAVITY_RANGE_FACTOR,this.compoundGravityRangeFactor=e.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR,this.displacementThresholdPerNode=3*e.DEFAULT_EDGE_LENGTH/100,this.coolingFactor=e.DEFAULT_COOLING_FACTOR_INCREMENTAL,this.initialCoolingFactor=e.DEFAULT_COOLING_FACTOR_INCREMENTAL,this.totalDisplacement=0,this.oldTotalDisplacement=0,this.maxIterations=e.MAX_ITERATIONS}o.prototype=Object.create(r.prototype);for(var y in r)o[y]=r[y];o.prototype.initParameters=function(){r.prototype.initParameters.call(this,arguments),this.totalIterations=0,this.notAnimatedIterations=0,this.useFRGridVariant=e.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION,this.grid=[]},o.prototype.calcIdealEdgeLengths=function(){var n,g,f,E,T,N,v=this.getGraphManager().getAllEdges();for(var O=0;O<v.length;O++)if(n=v[O],n.idealLength=this.idealEdgeLength,n.isInterGraph){if(f=n.getSource(),E=n.getTarget(),T=n.getSourceInLca().getEstimatedSize(),N=n.getTargetInLca().getEstimatedSize(),this.useSmartIdealEdgeLengthCalculation)n.idealLength+=T+N-2*i.SIMPLE_NODE_SIZE;g=n.getLca().getInclusionTreeDepth(),n.idealLength+=e.DEFAULT_EDGE_LENGTH*e.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR*(f.getInclusionTreeDepth()+E.getInclusionTreeDepth()-2*g)}},o.prototype.initSpringEmbedder=function(){var n=this.getAllNodes().length;if(this.incremental){if(n>e.ADAPTATION_LOWER_NODE_LIMIT)this.coolingFactor=Math.max(this.coolingFactor*e.COOLING_ADAPTATION_FACTOR,this.coolingFactor-(n-e.ADAPTATION_LOWER_NODE_LIMIT)/(e.ADAPTATION_UPPER_NODE_LIMIT-e.ADAPTATION_LOWER_NODE_LIMIT)*this.coolingFactor*(1-e.COOLING_ADAPTATION_FACTOR));this.maxNodeDisplacement=e.MAX_NODE_DISPLACEMENT_INCREMENTAL}else{if(n>e.ADAPTATION_LOWER_NODE_LIMIT)this.coolingFactor=Math.max(e.COOLING_ADAPTATION_FACTOR,1-(n-e.ADAPTATION_LOWER_NODE_LIMIT)/(e.ADAPTATION_UPPER_NODE_LIMIT-e.ADAPTATION_LOWER_NODE_LIMIT)*(1-e.COOLING_ADAPTATION_FACTOR));else this.coolingFactor=1;this.initialCoolingFactor=this.coolingFactor,this.maxNodeDisplacement=e.MAX_NODE_DISPLACEMENT}this.maxIterations=Math.max(this.getAllNodes().length*5,this.maxIterations),this.totalDisplacementThreshold=this.displacementThresholdPerNode*this.getAllNodes().length,this.repulsionRange=this.calcRepulsionRange()},o.prototype.calcSpringForces=function(){var n=this.getAllEdges(),g;for(var f=0;f<n.length;f++)g=n[f],this.calcSpringForce(g,g.idealLength)},o.prototype.calcRepulsionForces=function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,g=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,f,E,T,N,v=this.getAllNodes(),O;if(this.useFRGridVariant){if(this.totalIterations%e.GRID_CALCULATION_CHECK_PERIOD==1&&n)this.updateGrid();O=new Set;for(f=0;f<v.length;f++)T=v[f],this.calculateRepulsionForceOfANode(T,O,n,g),O.add(T)}else for(f=0;f<v.length;f++){T=v[f];for(E=f+1;E<v.length;E++){if(N=v[E],T.getOwner()!=N.getOwner())continue;this.calcRepulsionForce(T,N)}}},o.prototype.calcGravitationalForces=function(){var n,g=this.getAllNodesToApplyGravitation();for(var f=0;f<g.length;f++)n=g[f],this.calcGravitationalForce(n)},o.prototype.moveNodes=function(){var n=this.getAllNodes(),g;for(var f=0;f<n.length;f++)g=n[f],g.move()},o.prototype.calcSpringForce=function(n,g){var f=n.getSource(),E=n.getTarget(),T,N,v,O;if(this.uniformLeafNodeSizes&&f.getChild()==null&&E.getChild()==null)n.updateLengthSimple();else if(n.updateLength(),n.isOverlapingSourceAndTarget)return;if(T=n.getLength(),T==0)return;N=this.springConstant*(T-g),v=N*(n.lengthX/T),O=N*(n.lengthY/T),f.springForceX+=v,f.springForceY+=O,E.springForceX-=v,E.springForceY-=O},o.prototype.calcRepulsionForce=function(n,g){var f=n.getRect(),E=g.getRect(),T=[,,],N=[,,,,],v,O,D,R,a,p,d;if(f.intersects(E)){u.calcSeparationAmount(f,E,T,e.DEFAULT_EDGE_LENGTH/2),p=2*T[0],d=2*T[1];var A=n.noOfChildren*g.noOfChildren/(n.noOfChildren+g.noOfChildren);n.repulsionForceX-=A*p,n.repulsionForceY-=A*d,g.repulsionForceX+=A*p,g.repulsionForceY+=A*d}else{if(this.uniformLeafNodeSizes&&n.getChild()==null&&g.getChild()==null)v=E.getCenterX()-f.getCenterX(),O=E.getCenterY()-f.getCenterY();else u.getIntersection(f,E,N),v=N[2]-N[0],O=N[3]-N[1];if(Math.abs(v)<e.MIN_REPULSION_DIST)v=c.sign(v)*e.MIN_REPULSION_DIST;if(Math.abs(O)<e.MIN_REPULSION_DIST)O=c.sign(O)*e.MIN_REPULSION_DIST;D=v*v+O*O,R=Math.sqrt(D),a=this.repulsionConstant*n.noOfChildren*g.noOfChildren/D,p=a*v/R,d=a*O/R,n.repulsionForceX-=p,n.repulsionForceY-=d,g.repulsionForceX+=p,g.repulsionForceY+=d}},o.prototype.calcGravitationalForce=function(n){var g,f,E,T,N,v,O,D;if(g=n.getOwner(),f=(g.getRight()+g.getLeft())/2,E=(g.getTop()+g.getBottom())/2,T=n.getCenterX()-f,N=n.getCenterY()-E,v=Math.abs(T)+n.getWidth()/2,O=Math.abs(N)+n.getHeight()/2,n.getOwner()==this.graphManager.getRoot()){if(D=g.getEstimatedSize()*this.gravityRangeFactor,v>D||O>D)n.gravitationForceX=-this.gravityConstant*T,n.gravitationForceY=-this.gravityConstant*N}else if(D=g.getEstimatedSize()*this.compoundGravityRangeFactor,v>D||O>D)n.gravitationForceX=-this.gravityConstant*T*this.compoundGravityConstant,n.gravitationForceY=-this.gravityConstant*N*this.compoundGravityConstant},o.prototype.isConverged=function(){var n,g=!1;if(this.totalIterations>this.maxIterations/3)g=Math.abs(this.totalDisplacement-this.oldTotalDisplacement)<2;return n=this.totalDisplacement<this.totalDisplacementThreshold,this.oldTotalDisplacement=this.totalDisplacement,n||g},o.prototype.animate=function(){if(this.animationDuringLayout&&!this.isSubLayout)if(this.notAnimatedIterations==this.animationPeriod)this.update(),this.notAnimatedIterations=0;else this.notAnimatedIterations++},o.prototype.calcNoOfChildrenForAllNodes=function(){var n,g=this.graphManager.getAllNodes();for(var f=0;f<g.length;f++)n=g[f],n.noOfChildren=n.getNoOfChildren()},o.prototype.calcGrid=function(n){var g=0,f=0;g=parseInt(Math.ceil((n.getRight()-n.getLeft())/this.repulsionRange)),f=parseInt(Math.ceil((n.getBottom()-n.getTop())/this.repulsionRange));var E=Array(g);for(var T=0;T<g;T++)E[T]=Array(f);for(var T=0;T<g;T++)for(var N=0;N<f;N++)E[T][N]=[];return E},o.prototype.addNodeToGrid=function(n,g,f){var E=0,T=0,N=0,v=0;E=parseInt(Math.floor((n.getRect().x-g)/this.repulsionRange)),T=parseInt(Math.floor((n.getRect().width+n.getRect().x-g)/this.repulsionRange)),N=parseInt(Math.floor((n.getRect().y-f)/this.repulsionRange)),v=parseInt(Math.floor((n.getRect().height+n.getRect().y-f)/this.repulsionRange));for(var O=E;O<=T;O++)for(var D=N;D<=v;D++)this.grid[O][D].push(n),n.setGridCoordinates(E,T,N,v)},o.prototype.updateGrid=function(){var n,g,f=this.getAllNodes();this.grid=this.calcGrid(this.graphManager.getRoot());for(n=0;n<f.length;n++)g=f[n],this.addNodeToGrid(g,this.graphManager.getRoot().getLeft(),this.graphManager.getRoot().getTop())},o.prototype.calculateRepulsionForceOfANode=function(n,g,f,E){if(this.totalIterations%e.GRID_CALCULATION_CHECK_PERIOD==1&&f||E){var T=new Set;n.surrounding=[];var N,v=this.grid;for(var O=n.startX-1;O<n.finishX+2;O++)for(var D=n.startY-1;D<n.finishY+2;D++)if(!(O<0||D<0||O>=v.length||D>=v[0].length))for(var R=0;R<v[O][D].length;R++){if(N=v[O][D][R],n.getOwner()!=N.getOwner()||n==N)continue;if(!g.has(N)&&!T.has(N)){var a=Math.abs(n.getCenterX()-N.getCenterX())-(n.getWidth()/2+N.getWidth()/2),p=Math.abs(n.getCenterY()-N.getCenterY())-(n.getHeight()/2+N.getHeight()/2);if(a<=this.repulsionRange&&p<=this.repulsionRange)T.add(N)}}n.surrounding=[].concat(s(T))}for(O=0;O<n.surrounding.length;O++)this.calcRepulsionForce(n,n.surrounding[O])},o.prototype.calcRepulsionRange=function(){return 0},m.exports=o},function(m,w,L){var s=L(1),r=L(7);function e(u,c,o){s.call(this,u,c,o),this.idealLength=r.DEFAULT_EDGE_LENGTH}e.prototype=Object.create(s.prototype);for(var i in s)e[i]=s[i];m.exports=e},function(m,w,L){var s=L(3);function r(i,u,c,o){s.call(this,i,u,c,o),this.springForceX=0,this.springForceY=0,this.repulsionForceX=0,this.repulsionForceY=0,this.gravitationForceX=0,this.gravitationForceY=0,this.displacementX=0,this.displacementY=0,this.startX=0,this.finishX=0,this.startY=0,this.finishY=0,this.surrounding=[]}r.prototype=Object.create(s.prototype);for(var e in s)r[e]=s[e];r.prototype.setGridCoordinates=function(i,u,c,o){this.startX=i,this.finishX=u,this.startY=c,this.finishY=o},m.exports=r},function(m,w,L){function s(r,e){if(this.width=0,this.height=0,r!==null&&e!==null)this.height=e,this.width=r}s.prototype.getWidth=function(){return this.width},s.prototype.setWidth=function(r){this.width=r},s.prototype.getHeight=function(){return this.height},s.prototype.setHeight=function(r){this.height=r},m.exports=s},function(m,w,L){var s=L(14);function r(){this.map={},this.keys=[]}r.prototype.put=function(e,i){var u=s.createID(e);if(!this.contains(u))this.map[u]=i,this.keys.push(e)},r.prototype.contains=function(e){var i=s.createID(e);return this.map[e]!=null},r.prototype.get=function(e){var i=s.createID(e);return this.map[i]},r.prototype.keySet=function(){return this.keys},m.exports=r},function(m,w,L){var s=L(14);function r(){this.set={}}r.prototype.add=function(e){var i=s.createID(e);if(!this.contains(i))this.set[i]=e},r.prototype.remove=function(e){delete this.set[s.createID(e)]},r.prototype.clear=function(){this.set={}},r.prototype.contains=function(e){return this.set[s.createID(e)]==e},r.prototype.isEmpty=function(){return this.size()===0},r.prototype.size=function(){return Object.keys(this.set).length},r.prototype.addAllTo=function(e){var i=Object.keys(this.set),u=i.length;for(var c=0;c<u;c++)e.push(this.set[i[c]])},r.prototype.size=function(){return Object.keys(this.set).length},r.prototype.addAll=function(e){var i=e.length;for(var u=0;u<i;u++){var c=e[u];this.add(c)}},m.exports=r},function(m,w,L){var s=function(){function u(c,o){for(var y=0;y<o.length;y++){var n=o[y];if(n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n)n.writable=!0;Object.defineProperty(c,n.key,n)}}return function(c,o,y){if(o)u(c.prototype,o);if(y)u(c,y);return c}}();function r(u,c){if(!(u instanceof c))throw TypeError("Cannot call a class as a function")}var e=L(11),i=function(){function u(c,o){if(r(this,u),o!==null||o!==void 0)this.compareFunction=this._defaultCompareFunction;var y=void 0;if(c instanceof e)y=c.size();else y=c.length;this._quicksort(c,0,y-1)}return s(u,[{key:"_quicksort",value:function(o,y,n){if(y<n){var g=this._partition(o,y,n);this._quicksort(o,y,g),this._quicksort(o,g+1,n)}}},{key:"_partition",value:function(o,y,n){var g=this._get(o,y),f=y,E=n;while(!0){while(this.compareFunction(g,this._get(o,E)))E--;while(this.compareFunction(this._get(o,f),g))f++;if(f<E)this._swap(o,f,E),f++,E--;else return E}}},{key:"_get",value:function(o,y){if(o instanceof e)return o.get_object_at(y);else return o[y]}},{key:"_set",value:function(o,y,n){if(o instanceof e)o.set_object_at(y,n);else o[y]=n}},{key:"_swap",value:function(o,y,n){var g=this._get(o,y);this._set(o,y,this._get(o,n)),this._set(o,n,g)}},{key:"_defaultCompareFunction",value:function(o,y){return y>o}}]),u}();m.exports=i},function(m,w,L){var s=function(){function i(u,c){for(var o=0;o<c.length;o++){var y=c[o];if(y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y)y.writable=!0;Object.defineProperty(u,y.key,y)}}return function(u,c,o){if(c)i(u.prototype,c);if(o)i(u,o);return u}}();function r(i,u){if(!(i instanceof u))throw TypeError("Cannot call a class as a function")}var e=function(){function i(u,c){var o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,y=arguments.length>3&&arguments[3]!==void 0?arguments[3]:-1,n=arguments.length>4&&arguments[4]!==void 0?arguments[4]:-1;r(this,i),this.sequence1=u,this.sequence2=c,this.match_score=o,this.mismatch_penalty=y,this.gap_penalty=n,this.iMax=u.length+1,this.jMax=c.length+1,this.grid=Array(this.iMax);for(var g=0;g<this.iMax;g++){this.grid[g]=Array(this.jMax);for(var f=0;f<this.jMax;f++)this.grid[g][f]=0}this.tracebackGrid=Array(this.iMax);for(var E=0;E<this.iMax;E++){this.tracebackGrid[E]=Array(this.jMax);for(var T=0;T<this.jMax;T++)this.tracebackGrid[E][T]=[null,null,null]}this.alignments=[],this.score=-1,this.computeGrids()}return s(i,[{key:"getScore",value:function(){return this.score}},{key:"getAlignments",value:function(){return this.alignments}},{key:"computeGrids",value:function(){for(var c=1;c<this.jMax;c++)this.grid[0][c]=this.grid[0][c-1]+this.gap_penalty,this.tracebackGrid[0][c]=[!1,!1,!0];for(var o=1;o<this.iMax;o++)this.grid[o][0]=this.grid[o-1][0]+this.gap_penalty,this.tracebackGrid[o][0]=[!1,!0,!1];for(var y=1;y<this.iMax;y++)for(var n=1;n<this.jMax;n++){var g=void 0;if(this.sequence1[y-1]===this.sequence2[n-1])g=this.grid[y-1][n-1]+this.match_score;else g=this.grid[y-1][n-1]+this.mismatch_penalty;var f=this.grid[y-1][n]+this.gap_penalty,E=this.grid[y][n-1]+this.gap_penalty,T=[g,f,E],N=this.arrayAllMaxIndexes(T);this.grid[y][n]=T[N[0]],this.tracebackGrid[y][n]=[N.includes(0),N.includes(1),N.includes(2)]}this.score=this.grid[this.iMax-1][this.jMax-1]}},{key:"alignmentTraceback",value:function(){var c=[];c.push({pos:[this.sequence1.length,this.sequence2.length],seq1:"",seq2:""});while(c[0]){var o=c[0],y=this.tracebackGrid[o.pos[0]][o.pos[1]];if(y[0])c.push({pos:[o.pos[0]-1,o.pos[1]-1],seq1:this.sequence1[o.pos[0]-1]+o.seq1,seq2:this.sequence2[o.pos[1]-1]+o.seq2});if(y[1])c.push({pos:[o.pos[0]-1,o.pos[1]],seq1:this.sequence1[o.pos[0]-1]+o.seq1,seq2:"-"+o.seq2});if(y[2])c.push({pos:[o.pos[0],o.pos[1]-1],seq1:"-"+o.seq1,seq2:this.sequence2[o.pos[1]-1]+o.seq2});if(o.pos[0]===0&&o.pos[1]===0)this.alignments.push({sequence1:o.seq1,sequence2:o.seq2});c.shift()}return this.alignments}},{key:"getAllIndexes",value:function(c,o){var y=[],n=-1;while((n=c.indexOf(o,n+1))!==-1)y.push(n);return y}},{key:"arrayAllMaxIndexes",value:function(c){return this.getAllIndexes(c,Math.max.apply(null,c))}}]),i}();m.exports=e},function(m,w,L){var s=function(){return};s.FDLayout=L(18),s.FDLayoutConstants=L(7),s.FDLayoutEdge=L(19),s.FDLayoutNode=L(20),s.DimensionD=L(21),s.HashMap=L(22),s.HashSet=L(23),s.IGeometry=L(8),s.IMath=L(9),s.Integer=L(10),s.Point=L(12),s.PointD=L(4),s.RandomSeed=L(16),s.RectangleD=L(13),s.Transform=L(17),s.UniqueIDGeneretor=L(14),s.Quicksort=L(24),s.LinkedList=L(11),s.LGraphObject=L(2),s.LGraph=L(5),s.LEdge=L(1),s.LGraphManager=L(6),s.LNode=L(3),s.Layout=L(15),s.LayoutConstants=L(0),s.NeedlemanWunsch=L(25),m.exports=s},function(m,w,L){function s(){this.listeners=[]}var r=s.prototype;r.addListener=function(e,i){this.listeners.push({event:e,callback:i})},r.removeListener=function(e,i){for(var u=this.listeners.length;u>=0;u--){var c=this.listeners[u];if(c.event===e&&c.callback===i)this.listeners.splice(u,1)}},r.emit=function(e,i){for(var u=0;u<this.listeners.length;u++){var c=this.listeners[u];if(e===c.event)c.callback(i)}},m.exports=s}])})});var J=Fn(function(Q,z){(function(w,L){if(typeof Q==="object"&&typeof z==="object")z.exports=L(q());else if(typeof define==="function"&&define.amd)define(["layout-base"],L);else if(typeof Q==="object")Q.coseBase=L(q());else w.coseBase=L(w.layoutBase)})(Q,function(m){return function(w){var L={};function s(r){if(L[r])return L[r].exports;var e=L[r]={i:r,l:!1,exports:{}};return w[r].call(e.exports,e,e.exports,s),e.l=!0,e.exports}return s.m=w,s.c=L,s.i=function(r){return r},s.d=function(r,e,i){if(!s.o(r,e))Object.defineProperty(r,e,{configurable:!1,enumerable:!0,get:i})},s.n=function(r){var e=r&&r.__esModule?function(){return r.default}:function(){return r};return s.d(e,"a",e),e},s.o=function(r,e){return Object.prototype.hasOwnProperty.call(r,e)},s.p="",s(s.s=7)}([function(w,L){w.exports=m},function(w,L,s){var r=s(0).FDLayoutConstants;function e(){}for(var i in r)e[i]=r[i];e.DEFAULT_USE_MULTI_LEVEL_SCALING=!1,e.DEFAULT_RADIAL_SEPARATION=r.DEFAULT_EDGE_LENGTH,e.DEFAULT_COMPONENT_SEPERATION=60,e.TILE=!0,e.TILING_PADDING_VERTICAL=10,e.TILING_PADDING_HORIZONTAL=10,e.TREE_REDUCTION_ON_INCREMENTAL=!1,w.exports=e},function(w,L,s){var r=s(0).FDLayoutEdge;function e(u,c,o){r.call(this,u,c,o)}e.prototype=Object.create(r.prototype);for(var i in r)e[i]=r[i];w.exports=e},function(w,L,s){var r=s(0).LGraph;function e(u,c,o){r.call(this,u,c,o)}e.prototype=Object.create(r.prototype);for(var i in r)e[i]=r[i];w.exports=e},function(w,L,s){var r=s(0).LGraphManager;function e(u){r.call(this,u)}e.prototype=Object.create(r.prototype);for(var i in r)e[i]=r[i];w.exports=e},function(w,L,s){var r=s(0).FDLayoutNode,e=s(0).IMath;function i(c,o,y,n){r.call(this,c,o,y,n)}i.prototype=Object.create(r.prototype);for(var u in r)i[u]=r[u];i.prototype.move=function(){var c=this.graphManager.getLayout();if(this.displacementX=c.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.noOfChildren,this.displacementY=c.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.noOfChildren,Math.abs(this.displacementX)>c.coolingFactor*c.maxNodeDisplacement)this.displacementX=c.coolingFactor*c.maxNodeDisplacement*e.sign(this.displacementX);if(Math.abs(this.displacementY)>c.coolingFactor*c.maxNodeDisplacement)this.displacementY=c.coolingFactor*c.maxNodeDisplacement*e.sign(this.displacementY);if(this.child==null)this.moveBy(this.displacementX,this.displacementY);else if(this.child.getNodes().length==0)this.moveBy(this.displacementX,this.displacementY);else this.propogateDisplacementToChildren(this.displacementX,this.displacementY);c.totalDisplacement+=Math.abs(this.displacementX)+Math.abs(this.displacementY),this.springForceX=0,this.springForceY=0,this.repulsionForceX=0,this.repulsionForceY=0,this.gravitationForceX=0,this.gravitationForceY=0,this.displacementX=0,this.displacementY=0},i.prototype.propogateDisplacementToChildren=function(c,o){var y=this.getChild().getNodes(),n;for(var g=0;g<y.length;g++)if(n=y[g],n.getChild()==null)n.moveBy(c,o),n.displacementX+=c,n.displacementY+=o;else n.propogateDisplacementToChildren(c,o)},i.prototype.setPred1=function(c){this.pred1=c},i.prototype.getPred1=function(){return pred1},i.prototype.getPred2=function(){return pred2},i.prototype.setNext=function(c){this.next=c},i.prototype.getNext=function(){return next},i.prototype.setProcessed=function(c){this.processed=c},i.prototype.isProcessed=function(){return processed},w.exports=i},function(w,L,s){var r=s(0).FDLayout,e=s(4),i=s(3),u=s(5),c=s(2),o=s(1),y=s(0).FDLayoutConstants,n=s(0).LayoutConstants,g=s(0).Point,f=s(0).PointD,E=s(0).Layout,T=s(0).Integer,N=s(0).IGeometry,v=s(0).LGraph,O=s(0).Transform;function D(){r.call(this),this.toBeTiled={}}D.prototype=Object.create(r.prototype);for(var R in r)D[R]=r[R];D.prototype.newGraphManager=function(){var a=new e(this);return this.graphManager=a,a},D.prototype.newGraph=function(a){return new i(null,this.graphManager,a)},D.prototype.newNode=function(a){return new u(this.graphManager,a)},D.prototype.newEdge=function(a){return new c(null,null,a)},D.prototype.initParameters=function(){if(r.prototype.initParameters.call(this,arguments),!this.isSubLayout){if(o.DEFAULT_EDGE_LENGTH<10)this.idealEdgeLength=10;else this.idealEdgeLength=o.DEFAULT_EDGE_LENGTH;this.useSmartIdealEdgeLengthCalculation=o.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION,this.springConstant=y.DEFAULT_SPRING_STRENGTH,this.repulsionConstant=y.DEFAULT_REPULSION_STRENGTH,this.gravityConstant=y.DEFAULT_GRAVITY_STRENGTH,this.compoundGravityConstant=y.DEFAULT_COMPOUND_GRAVITY_STRENGTH,this.gravityRangeFactor=y.DEFAULT_GRAVITY_RANGE_FACTOR,this.compoundGravityRangeFactor=y.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR,this.prunedNodesAll=[],this.growTreeIterations=0,this.afterGrowthIterations=0,this.isTreeGrowing=!1,this.isGrowthFinished=!1,this.coolingCycle=0,this.maxCoolingCycle=this.maxIterations/y.CONVERGENCE_CHECK_PERIOD,this.finalTemperature=y.CONVERGENCE_CHECK_PERIOD/this.maxIterations,this.coolingAdjuster=1}},D.prototype.layout=function(){var a=n.DEFAULT_CREATE_BENDS_AS_NEEDED;if(a)this.createBendpoints(),this.graphManager.resetAllEdges();return this.level=0,this.classicLayout()},D.prototype.classicLayout=function(){if(this.nodesWithGravity=this.calculateNodesToApplyGravitationTo(),this.graphManager.setAllNodesToApplyGravitation(this.nodesWithGravity),this.calcNoOfChildrenForAllNodes(),this.graphManager.calcLowestCommonAncestors(),this.graphManager.calcInclusionTreeDepths(),this.graphManager.getRoot().calcEstimatedSize(),this.calcIdealEdgeLengths(),!this.incremental){var a=this.getFlatForest();if(a.length>0)this.positionNodesRadially(a);else{this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var p=new Set(this.getAllNodes()),d=this.nodesWithGravity.filter(function(A){return p.has(A)});this.graphManager.setAllNodesToApplyGravitation(d),this.positionNodesRandomly()}}else if(o.TREE_REDUCTION_ON_INCREMENTAL){this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var p=new Set(this.getAllNodes()),d=this.nodesWithGravity.filter(function(C){return p.has(C)});this.graphManager.setAllNodesToApplyGravitation(d)}return this.initSpringEmbedder(),this.runSpringEmbedder(),!0},D.prototype.tick=function(){if(this.totalIterations++,this.totalIterations===this.maxIterations&&!this.isTreeGrowing&&!this.isGrowthFinished)if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;if(this.totalIterations%y.CONVERGENCE_CHECK_PERIOD==0&&!this.isTreeGrowing&&!this.isGrowthFinished){if(this.isConverged())if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;if(this.coolingCycle++,this.layoutQuality==0)this.coolingAdjuster=this.coolingCycle;else if(this.layoutQuality==1)this.coolingAdjuster=this.coolingCycle/3;this.coolingFactor=Math.max(this.initialCoolingFactor-Math.pow(this.coolingCycle,Math.log(100*(this.initialCoolingFactor-this.finalTemperature))/Math.log(this.maxCoolingCycle))/100*this.coolingAdjuster,this.finalTemperature),this.animationPeriod=Math.ceil(this.initialAnimationPeriod*Math.sqrt(this.coolingFactor))}if(this.isTreeGrowing){if(this.growTreeIterations%10==0)if(this.prunedNodesAll.length>0){this.graphManager.updateBounds(),this.updateGrid(),this.growTree(this.prunedNodesAll),this.graphManager.resetAllNodesToApplyGravitation();var a=new Set(this.getAllNodes()),p=this.nodesWithGravity.filter(function(I){return a.has(I)});this.graphManager.setAllNodesToApplyGravitation(p),this.graphManager.updateBounds(),this.updateGrid(),this.coolingFactor=y.DEFAULT_COOLING_FACTOR_INCREMENTAL}else this.isTreeGrowing=!1,this.isGrowthFinished=!0;this.growTreeIterations++}if(this.isGrowthFinished){if(this.isConverged())return!0;if(this.afterGrowthIterations%10==0)this.graphManager.updateBounds(),this.updateGrid();this.coolingFactor=y.DEFAULT_COOLING_FACTOR_INCREMENTAL*((100-this.afterGrowthIterations)/100),this.afterGrowthIterations++}var d=!this.isTreeGrowing&&!this.isGrowthFinished,A=this.growTreeIterations%10==1&&this.isTreeGrowing||this.afterGrowthIterations%10==1&&this.isGrowthFinished;return this.totalDisplacement=0,this.graphManager.updateBounds(),this.calcSpringForces(),this.calcRepulsionForces(d,A),this.calcGravitationalForces(),this.moveNodes(),this.animate(),!1},D.prototype.getPositionsData=function(){var a=this.graphManager.getAllNodes(),p={};for(var d=0;d<a.length;d++){var A=a[d].rect,I=a[d].id;p[I]={id:I,x:A.getCenterX(),y:A.getCenterY(),w:A.width,h:A.height}}return p},D.prototype.runSpringEmbedder=function(){this.initialAnimationPeriod=25,this.animationPeriod=this.initialAnimationPeriod;var a=!1;if(y.ANIMATE==="during")this.emit("layoutstarted");else{while(!a)a=this.tick();this.graphManager.updateBounds()}},D.prototype.calculateNodesToApplyGravitationTo=function(){var a=[],p,d=this.graphManager.getGraphs(),A=d.length,I;for(I=0;I<A;I++)if(p=d[I],p.updateConnected(),!p.isConnected)a=a.concat(p.getNodes());return a},D.prototype.createBendpoints=function(){var a=[];a=a.concat(this.graphManager.getAllEdges());var p=new Set,d;for(d=0;d<a.length;d++){var A=a[d];if(!p.has(A)){var I=A.getSource(),C=A.getTarget();if(I==C)A.getBendpoints().push(new f),A.getBendpoints().push(new f),this.createDummyNodesForBendpoints(A),p.add(A);else{var M=[];if(M=M.concat(I.getEdgeListToNode(C)),M=M.concat(C.getEdgeListToNode(I)),!p.has(M[0])){if(M.length>1){var G;for(G=0;G<M.length;G++){var F=M[G];F.getBendpoints().push(new f),this.createDummyNodesForBendpoints(F)}}M.forEach(function(P){p.add(P)})}}}if(p.size==a.length)break}},D.prototype.positionNodesRadially=function(a){var p=new g(0,0),d=Math.ceil(Math.sqrt(a.length)),A=0,I=0,C=0,M=new f(0,0);for(var G=0;G<a.length;G++){if(G%d==0){if(C=0,I=A,G!=0)I+=o.DEFAULT_COMPONENT_SEPERATION;A=0}var F=a[G],P=E.findCenterOfTree(F);if(p.x=C,p.y=I,M=D.radialLayout(F,P,p),M.y>A)A=Math.floor(M.y);C=Math.floor(M.x+o.DEFAULT_COMPONENT_SEPERATION)}this.transform(new f(n.WORLD_CENTER_X-M.x/2,n.WORLD_CENTER_Y-M.y/2))},D.radialLayout=function(a,p,d){var A=Math.max(this.maxDiagonalInTree(a),o.DEFAULT_RADIAL_SEPARATION);D.branchRadialLayout(p,null,0,359,0,A);var I=v.calculateBounds(a),C=new O;C.setDeviceOrgX(I.getMinX()),C.setDeviceOrgY(I.getMinY()),C.setWorldOrgX(d.x),C.setWorldOrgY(d.y);for(var M=0;M<a.length;M++){var G=a[M];G.transform(C)}var F=new f(I.getMaxX(),I.getMaxY());return C.inverseTransformPoint(F)},D.branchRadialLayout=function(a,p,d,A,I,C){var M=(A-d+1)/2;if(M<0)M+=180;var G=(M+d)%360,F=G*N.TWO_PI/360,P=Math.cos(F),b=I*Math.cos(F),U=I*Math.sin(F);a.setCenter(b,U);var x=[];x=x.concat(a.getEdges());var S=x.length;if(p!=null)S--;var Y=0,X=x.length,H,_=a.getEdgesBetween(p);while(_.length>1){var W=_[0];_.splice(0,1);var k=x.indexOf(W);if(k>=0)x.splice(k,1);X--,S--}if(p!=null)H=(x.indexOf(_[0])+1)%X;else H=0;var B=Math.abs(A-d)/S;for(var V=H;Y!=S;V=++V%X){var et=x[V].getOtherEnd(a);if(et==p)continue;var rt=(d+Y*B)%360,ft=(rt+B)%360;D.branchRadialLayout(et,a,rt,ft,I+C,C),Y++}},D.maxDiagonalInTree=function(a){var p=T.MIN_VALUE;for(var d=0;d<a.length;d++){var A=a[d],I=A.getDiagonal();if(I>p)p=I}return p},D.prototype.calcRepulsionRange=function(){return 2*(this.level+1)*this.idealEdgeLength},D.prototype.groupZeroDegreeMembers=function(){var a=this,p={};this.memberGroups={},this.idToDummyNode={};var d=[],A=this.graphManager.getAllNodes();for(var I=0;I<A.length;I++){var C=A[I],M=C.getParent();if(this.getNodeDegreeWithChildren(C)===0&&(M.id==null||!this.getToBeTiled(M)))d.push(C)}for(var I=0;I<d.length;I++){var C=d[I],G=C.getParent().id;if(typeof p[G]>"u")p[G]=[];p[G]=p[G].concat(C)}Object.keys(p).forEach(function(F){if(p[F].length>1){var P="DummyCompound_"+F;a.memberGroups[P]=p[F];var b=p[F][0].getParent(),U=new u(a.graphManager);U.id=P,U.paddingLeft=b.paddingLeft||0,U.paddingRight=b.paddingRight||0,U.paddingBottom=b.paddingBottom||0,U.paddingTop=b.paddingTop||0,a.idToDummyNode[P]=U;var x=a.getGraphManager().add(a.newGraph(),U),S=b.getChild();S.add(U);for(var Y=0;Y<p[F].length;Y++){var X=p[F][Y];S.remove(X),x.add(X)}}})},D.prototype.clearCompounds=function(){var a={},p={};this.performDFSOnCompounds();for(var d=0;d<this.compoundOrder.length;d++)p[this.compoundOrder[d].id]=this.compoundOrder[d],a[this.compoundOrder[d].id]=[].concat(this.compoundOrder[d].getChild().getNodes()),this.graphManager.remove(this.compoundOrder[d].getChild()),this.compoundOrder[d].child=null;this.graphManager.resetAllNodes(),this.tileCompoundMembers(a,p)},D.prototype.clearZeroDegreeMembers=function(){var a=this,p=this.tiledZeroDegreePack=[];Object.keys(this.memberGroups).forEach(function(d){var A=a.idToDummyNode[d];p[d]=a.tileNodes(a.memberGroups[d],A.paddingLeft+A.paddingRight),A.rect.width=p[d].width,A.rect.height=p[d].height})},D.prototype.repopulateCompounds=function(){for(var a=this.compoundOrder.length-1;a>=0;a--){var p=this.compoundOrder[a],{id:d,paddingLeft:A,paddingTop:I}=p;this.adjustLocations(this.tiledMemberPack[d],p.rect.x,p.rect.y,A,I)}},D.prototype.repopulateZeroDegreeMembers=function(){var a=this,p=this.tiledZeroDegreePack;Object.keys(p).forEach(function(d){var A=a.idToDummyNode[d],{paddingLeft:I,paddingTop:C}=A;a.adjustLocations(p[d],A.rect.x,A.rect.y,I,C)})},D.prototype.getToBeTiled=function(a){var p=a.id;if(this.toBeTiled[p]!=null)return this.toBeTiled[p];var d=a.getChild();if(d==null)return this.toBeTiled[p]=!1,!1;var A=d.getNodes();for(var I=0;I<A.length;I++){var C=A[I];if(this.getNodeDegree(C)>0)return this.toBeTiled[p]=!1,!1;if(C.getChild()==null){this.toBeTiled[C.id]=!1;continue}if(!this.getToBeTiled(C))return this.toBeTiled[p]=!1,!1}return this.toBeTiled[p]=!0,!0},D.prototype.getNodeDegree=function(a){var p=a.id,d=a.getEdges(),A=0;for(var I=0;I<d.length;I++){var C=d[I];if(C.getSource().id!==C.getTarget().id)A=A+1}return A},D.prototype.getNodeDegreeWithChildren=function(a){var p=this.getNodeDegree(a);if(a.getChild()==null)return p;var d=a.getChild().getNodes();for(var A=0;A<d.length;A++){var I=d[A];p+=this.getNodeDegreeWithChildren(I)}return p},D.prototype.performDFSOnCompounds=function(){this.compoundOrder=[],this.fillCompexOrderByDFS(this.graphManager.getRoot().getNodes())},D.prototype.fillCompexOrderByDFS=function(a){for(var p=0;p<a.length;p++){var d=a[p];if(d.getChild()!=null)this.fillCompexOrderByDFS(d.getChild().getNodes());if(this.getToBeTiled(d))this.compoundOrder.push(d)}},D.prototype.adjustLocations=function(a,p,d,A,I){p+=A,d+=I;var C=p;for(var M=0;M<a.rows.length;M++){var G=a.rows[M];p=C;var F=0;for(var P=0;P<G.length;P++){var b=G[P];if(b.rect.x=p,b.rect.y=d,p+=b.rect.width+a.horizontalPadding,b.rect.height>F)F=b.rect.height}d+=F+a.verticalPadding}},D.prototype.tileCompoundMembers=function(a,p){var d=this;this.tiledMemberPack=[],Object.keys(a).forEach(function(A){var I=p[A];d.tiledMemberPack[A]=d.tileNodes(a[A],I.paddingLeft+I.paddingRight),I.rect.width=d.tiledMemberPack[A].width,I.rect.height=d.tiledMemberPack[A].height})},D.prototype.tileNodes=function(a,p){var{TILING_PADDING_VERTICAL:d,TILING_PADDING_HORIZONTAL:A}=o,I={rows:[],rowWidth:[],rowHeight:[],width:0,height:p,verticalPadding:d,horizontalPadding:A};a.sort(function(G,F){if(G.rect.width*G.rect.height>F.rect.width*F.rect.height)return-1;if(G.rect.width*G.rect.height<F.rect.width*F.rect.height)return 1;return 0});for(var C=0;C<a.length;C++){var M=a[C];if(I.rows.length==0)this.insertNodeToRow(I,M,0,p);else if(this.canAddHorizontal(I,M.rect.width,M.rect.height))this.insertNodeToRow(I,M,this.getShortestRowIndex(I),p);else this.insertNodeToRow(I,M,I.rows.length,p);this.shiftToLastRow(I)}return I},D.prototype.insertNodeToRow=function(a,p,d,A){var I=A;if(d==a.rows.length){var C=[];a.rows.push(C),a.rowWidth.push(I),a.rowHeight.push(0)}var M=a.rowWidth[d]+p.rect.width;if(a.rows[d].length>0)M+=a.horizontalPadding;if(a.rowWidth[d]=M,a.width<M)a.width=M;var G=p.rect.height;if(d>0)G+=a.verticalPadding;var F=0;if(G>a.rowHeight[d])F=a.rowHeight[d],a.rowHeight[d]=G,F=a.rowHeight[d]-F;a.height+=F,a.rows[d].push(p)},D.prototype.getShortestRowIndex=function(a){var p=-1,d=Number.MAX_VALUE;for(var A=0;A<a.rows.length;A++)if(a.rowWidth[A]<d)p=A,d=a.rowWidth[A];return p},D.prototype.getLongestRowIndex=function(a){var p=-1,d=Number.MIN_VALUE;for(var A=0;A<a.rows.length;A++)if(a.rowWidth[A]>d)p=A,d=a.rowWidth[A];return p},D.prototype.canAddHorizontal=function(a,p,d){var A=this.getShortestRowIndex(a);if(A<0)return!0;var I=a.rowWidth[A];if(I+a.horizontalPadding+p<=a.width)return!0;var C=0;if(a.rowHeight[A]<d){if(A>0)C=d+a.verticalPadding-a.rowHeight[A]}var M;if(a.width-I>=p+a.horizontalPadding)M=(a.height+C)/(I+p+a.horizontalPadding);else M=(a.height+C)/a.width;C=d+a.verticalPadding;var G;if(a.width<p)G=(a.height+C)/p;else G=(a.height+C)/a.width;if(G<1)G=1/G;if(M<1)M=1/M;return M<G},D.prototype.shiftToLastRow=function(a){var p=this.getLongestRowIndex(a),d=a.rowWidth.length-1,A=a.rows[p],I=A[A.length-1],C=I.width+a.horizontalPadding;if(a.width-a.rowWidth[d]>C&&p!=d){A.splice(-1,1),a.rows[d].push(I),a.rowWidth[p]=a.rowWidth[p]-C,a.rowWidth[d]=a.rowWidth[d]+C,a.width=a.rowWidth[instance.getLongestRowIndex(a)];var M=Number.MIN_VALUE;for(var G=0;G<A.length;G++)if(A[G].height>M)M=A[G].height;if(p>0)M+=a.verticalPadding;var F=a.rowHeight[p]+a.rowHeight[d];if(a.rowHeight[p]=M,a.rowHeight[d]<I.height+a.verticalPadding)a.rowHeight[d]=I.height+a.verticalPadding;var P=a.rowHeight[p]+a.rowHeight[d];a.height+=P-F,this.shiftToLastRow(a)}},D.prototype.tilingPreLayout=function(){if(o.TILE)this.groupZeroDegreeMembers(),this.clearCompounds(),this.clearZeroDegreeMembers()},D.prototype.tilingPostLayout=function(){if(o.TILE)this.repopulateZeroDegreeMembers(),this.repopulateCompounds()},D.prototype.reduceTrees=function(){var a=[],p=!0,d;while(p){var A=this.graphManager.getAllNodes(),I=[];p=!1;for(var C=0;C<A.length;C++)if(d=A[C],d.getEdges().length==1&&!d.getEdges()[0].isInterGraph&&d.getChild()==null)I.push([d,d.getEdges()[0],d.getOwner()]),p=!0;if(p==!0){var M=[];for(var G=0;G<I.length;G++)if(I[G][0].getEdges().length==1)M.push(I[G]),I[G][0].getOwner().remove(I[G][0]);a.push(M),this.graphManager.resetAllNodes(),this.graphManager.resetAllEdges()}}this.prunedNodesAll=a},D.prototype.growTree=function(a){var p=a.length,d=a[p-1],A;for(var I=0;I<d.length;I++)A=d[I],this.findPlaceforPrunedNode(A),A[2].add(A[0]),A[2].add(A[1],A[1].source,A[1].target);a.splice(a.length-1,1),this.graphManager.resetAllNodes(),this.graphManager.resetAllEdges()},D.prototype.findPlaceforPrunedNode=function(a){var p,d,A=a[0];if(A==a[1].source)d=a[1].target;else d=a[1].source;var I=d.startX,C=d.finishX,M=d.startY,G=d.finishY,F=0,P=0,b=0,U=0,x=[F,b,P,U];if(M>0)for(var S=I;S<=C;S++)x[0]+=this.grid[S][M-1].length+this.grid[S][M].length-1;if(C<this.grid.length-1)for(var S=M;S<=G;S++)x[1]+=this.grid[C+1][S].length+this.grid[C][S].length-1;if(G<this.grid[0].length-1)for(var S=I;S<=C;S++)x[2]+=this.grid[S][G+1].length+this.grid[S][G].length-1;if(I>0)for(var S=M;S<=G;S++)x[3]+=this.grid[I-1][S].length+this.grid[I][S].length-1;var Y=T.MAX_VALUE,X,H;for(var _=0;_<x.length;_++)if(x[_]<Y)Y=x[_],X=1,H=_;else if(x[_]==Y)X++;if(X==3&&Y==0){if(x[0]==0&&x[1]==0&&x[2]==0)p=1;else if(x[0]==0&&x[1]==0&&x[3]==0)p=0;else if(x[0]==0&&x[2]==0&&x[3]==0)p=3;else if(x[1]==0&&x[2]==0&&x[3]==0)p=2}else if(X==2&&Y==0){var W=Math.floor(Math.random()*2);if(x[0]==0&&x[1]==0)if(W==0)p=0;else p=1;else if(x[0]==0&&x[2]==0)if(W==0)p=0;else p=2;else if(x[0]==0&&x[3]==0)if(W==0)p=0;else p=3;else if(x[1]==0&&x[2]==0)if(W==0)p=1;else p=2;else if(x[1]==0&&x[3]==0)if(W==0)p=1;else p=3;else if(W==0)p=2;else p=3}else if(X==4&&Y==0){var W=Math.floor(Math.random()*4);p=W}else p=H;if(p==0)A.setCenter(d.getCenterX(),d.getCenterY()-d.getHeight()/2-y.DEFAULT_EDGE_LENGTH-A.getHeight()/2);else if(p==1)A.setCenter(d.getCenterX()+d.getWidth()/2+y.DEFAULT_EDGE_LENGTH+A.getWidth()/2,d.getCenterY());else if(p==2)A.setCenter(d.getCenterX(),d.getCenterY()+d.getHeight()/2+y.DEFAULT_EDGE_LENGTH+A.getHeight()/2);else A.setCenter(d.getCenterX()-d.getWidth()/2-y.DEFAULT_EDGE_LENGTH-A.getWidth()/2,d.getCenterY())},w.exports=D},function(w,L,s){var r={};r.layoutBase=s(0),r.CoSEConstants=s(1),r.CoSEEdge=s(2),r.CoSEGraph=s(3),r.CoSEGraphManager=s(4),r.CoSELayout=s(6),r.CoSENode=s(5),w.exports=r}])})});var it=Fn(function(j,tt){(function(w,L){if(typeof j==="object"&&typeof tt==="object")tt.exports=L(J());else if(typeof define==="function"&&define.amd)define(["cose-base"],L);else if(typeof j==="object")j.cytoscapeCoseBilkent=L(J());else w.cytoscapeCoseBilkent=L(w.coseBase)})(j,function(m){return function(w){var L={};function s(r){if(L[r])return L[r].exports;var e=L[r]={i:r,l:!1,exports:{}};return w[r].call(e.exports,e,e.exports,s),e.l=!0,e.exports}return s.m=w,s.c=L,s.i=function(r){return r},s.d=function(r,e,i){if(!s.o(r,e))Object.defineProperty(r,e,{configurable:!1,enumerable:!0,get:i})},s.n=function(r){var e=r&&r.__esModule?function(){return r.default}:function(){return r};return s.d(e,"a",e),e},s.o=function(r,e){return Object.prototype.hasOwnProperty.call(r,e)},s.p="",s(s.s=1)}([function(w,L){w.exports=m},function(w,L,s){var r=s(0).layoutBase.LayoutConstants,e=s(0).layoutBase.FDLayoutConstants,i=s(0).CoSEConstants,u=s(0).CoSELayout,c=s(0).CoSENode,o=s(0).layoutBase.PointD,y=s(0).layoutBase.DimensionD,n={ready:function(){},stop:function(){},quality:"default",nodeDimensionsIncludeLabels:!1,refresh:30,fit:!0,padding:10,randomize:!0,nodeRepulsion:4500,idealEdgeLength:50,edgeElasticity:0.45,nestingFactor:0.1,gravity:0.25,numIter:2500,tile:!0,animate:"end",animationDuration:500,tilingPaddingVertical:10,tilingPaddingHorizontal:10,gravityRangeCompound:1.5,gravityCompound:1,gravityRange:3.8,initialEnergyOnIncremental:0.5};function g(N,v){var O={};for(var D in N)O[D]=N[D];for(var D in v)O[D]=v[D];return O}function f(N){this.options=g(n,N),E(this.options)}var E=function(v){if(v.nodeRepulsion!=null)i.DEFAULT_REPULSION_STRENGTH=e.DEFAULT_REPULSION_STRENGTH=v.nodeRepulsion;if(v.idealEdgeLength!=null)i.DEFAULT_EDGE_LENGTH=e.DEFAULT_EDGE_LENGTH=v.idealEdgeLength;if(v.edgeElasticity!=null)i.DEFAULT_SPRING_STRENGTH=e.DEFAULT_SPRING_STRENGTH=v.edgeElasticity;if(v.nestingFactor!=null)i.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=e.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=v.nestingFactor;if(v.gravity!=null)i.DEFAULT_GRAVITY_STRENGTH=e.DEFAULT_GRAVITY_STRENGTH=v.gravity;if(v.numIter!=null)i.MAX_ITERATIONS=e.MAX_ITERATIONS=v.numIter;if(v.gravityRange!=null)i.DEFAULT_GRAVITY_RANGE_FACTOR=e.DEFAULT_GRAVITY_RANGE_FACTOR=v.gravityRange;if(v.gravityCompound!=null)i.DEFAULT_COMPOUND_GRAVITY_STRENGTH=e.DEFAULT_COMPOUND_GRAVITY_STRENGTH=v.gravityCompound;if(v.gravityRangeCompound!=null)i.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=e.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=v.gravityRangeCompound;if(v.initialEnergyOnIncremental!=null)i.DEFAULT_COOLING_FACTOR_INCREMENTAL=e.DEFAULT_COOLING_FACTOR_INCREMENTAL=v.initialEnergyOnIncremental;if(v.quality=="draft")r.QUALITY=0;else if(v.quality=="proof")r.QUALITY=2;else r.QUALITY=1;i.NODE_DIMENSIONS_INCLUDE_LABELS=e.NODE_DIMENSIONS_INCLUDE_LABELS=r.NODE_DIMENSIONS_INCLUDE_LABELS=v.nodeDimensionsIncludeLabels,i.DEFAULT_INCREMENTAL=e.DEFAULT_INCREMENTAL=r.DEFAULT_INCREMENTAL=!v.randomize,i.ANIMATE=e.ANIMATE=r.ANIMATE=v.animate,i.TILE=v.tile,i.TILING_PADDING_VERTICAL=typeof v.tilingPaddingVertical==="function"?v.tilingPaddingVertical.call():v.tilingPaddingVertical,i.TILING_PADDING_HORIZONTAL=typeof v.tilingPaddingHorizontal==="function"?v.tilingPaddingHorizontal.call():v.tilingPaddingHorizontal};f.prototype.run=function(){var N,v,O=this.options,D=this.idToLNode={},R=this.layout=new u,a=this;a.stopped=!1,this.cy=this.options.cy,this.cy.trigger({type:"layoutstart",layout:this});var p=R.newGraphManager();this.gm=p;var d=this.options.eles.nodes(),A=this.options.eles.edges();this.root=p.addRoot(),this.processChildrenList(this.root,this.getTopMostNodes(d),R);for(var I=0;I<A.length;I++){var C=A[I],M=this.idToLNode[C.data("source")],G=this.idToLNode[C.data("target")];if(M!==G&&M.getEdgesBetween(G).length==0){var F=p.add(R.newEdge(),M,G);F.id=C.id()}}var P=function(x,S){if(typeof x==="number")x=S;var Y=x.data("id"),X=a.idToLNode[Y];return{x:X.getRect().getCenterX(),y:X.getRect().getCenterY()}},b=function U(){var x=function(){if(O.fit)O.cy.fit(O.eles,O.padding);if(!N)N=!0,a.cy.one("layoutready",O.ready),a.cy.trigger({type:"layoutready",layout:a})},S=a.options.refresh,Y;for(var X=0;X<S&&!Y;X++)Y=a.stopped||a.layout.tick();if(Y){if(R.checkLayoutSuccess()&&!R.isSubLayout)R.doPostLayout();if(R.tilingPostLayout)R.tilingPostLayout();if(R.isLayoutFinished=!0,a.options.eles.nodes().positions(P),x(),a.cy.one("layoutstop",a.options.stop),a.cy.trigger({type:"layoutstop",layout:a}),v)cancelAnimationFrame(v);N=!1;return}var H=a.layout.getPositionsData();O.eles.nodes().positions(function(_,W){if(typeof _==="number")_=W;if(!_.isParent()){var k=_.id(),B=H[k],V=_;while(B==null)if(B=H[V.data("parent")]||H["DummyCompound_"+V.data("parent")],H[k]=B,V=V.parent()[0],V==null)break;if(B!=null)return{x:B.x,y:B.y};else return{x:_.position("x"),y:_.position("y")}}}),x(),v=requestAnimationFrame(U)};if(R.addListener("layoutstarted",function(){if(a.options.animate==="during")v=requestAnimationFrame(b)}),R.runLayout(),this.options.animate!=="during")a.options.eles.nodes().not(":parent").layoutPositions(a,a.options,P),N=!1;return this},f.prototype.getTopMostNodes=function(N){var v={};for(var O=0;O<N.length;O++)v[N[O].id()]=!0;var D=N.filter(function(R,a){if(typeof R==="number")R=a;var p=R.parent()[0];while(p!=null){if(v[p.id()])return!1;p=p.parent()[0]}return!0});return D},f.prototype.processChildrenList=function(N,v,O){var D=v.length;for(var R=0;R<D;R++){var a=v[R],p=a.children(),d,A=a.layoutDimensions({nodeDimensionsIncludeLabels:this.options.nodeDimensionsIncludeLabels});if(a.outerWidth()!=null&&a.outerHeight()!=null)d=N.add(new c(O.graphManager,new o(a.position("x")-A.w/2,a.position("y")-A.h/2),new y(parseFloat(A.w),parseFloat(A.h))));else d=N.add(new c(this.graphManager));if(d.id=a.data("id"),d.paddingLeft=parseInt(a.css("padding")),d.paddingTop=parseInt(a.css("padding")),d.paddingRight=parseInt(a.css("padding")),d.paddingBottom=parseInt(a.css("padding")),this.options.nodeDimensionsIncludeLabels){if(a.isParent()){var I=a.boundingBox({includeLabels:!0,includeNodes:!1}).w,C=a.boundingBox({includeLabels:!0,includeNodes:!1}).h,M=a.css("text-halign");d.labelWidth=I,d.labelHeight=C,d.labelPos=M}}if(this.idToLNode[a.data("id")]=d,isNaN(d.rect.x))d.rect.x=0;if(isNaN(d.rect.y))d.rect.y=0;if(p!=null&&p.length>0){var G=O.getGraphManager().add(O.newGraph(),d);this.processChildrenList(G,p,O)}}},f.prototype.stop=function(){return this.stopped=!0,this};var T=function(v){v("layout","cose-bilkent",f)};if(typeof cytoscape<"u")T(cytoscape);w.exports=T}])})});var nt=bn(it(),1);jr.use(nt.default);function st(m,w){m.forEach((L)=>{let s={id:L.id,labelText:L.label,height:L.height,width:L.width,padding:L.padding??0};Object.keys(L).forEach((r)=>{if(!["id","label","height","width","padding","x","y"].includes(r))s[r]=L[r]}),w.add({group:"nodes",data:s,position:{x:L.x??0,y:L.y??0}})})}t(st,"addNodes");function ot(m,w){m.forEach((L)=>{let s={id:L.id,source:L.start,target:L.end};Object.keys(L).forEach((r)=>{if(!["id","start","end"].includes(r))s[r]=L[r]}),w.add({group:"edges",data:s})})}t(ot,"addEdges");function at(m){return new Promise((w)=>{let L=h("body").append("div").attr("id","cy").attr("style","display:none"),s=jr({container:document.getElementById("cy"),style:[{selector:"edge",style:{"curve-style":"bezier"}}]});L.remove(),st(m.nodes,s),ot(m.edges,s),s.nodes().forEach(function(e){e.layoutDimensions=()=>{let i=e.data();return{w:i.width,h:i.height}}});let r={name:"cose-bilkent",quality:"proof",styleEnabled:!1,animate:!1};s.layout(r).run(),s.ready((e)=>{l.info("Cytoscape ready",e),w(s)})})}t(at,"createCytoscapeInstance");function ht(m){return m.nodes().map((w)=>{let L=w.data(),s=w.position(),r={id:L.id,x:s.x,y:s.y};return Object.keys(L).forEach((e)=>{if(e!=="id")r[e]=L[e]}),r})}t(ht,"extractPositionedNodes");function lt(m){return m.edges().map((w)=>{let L=w.data(),s=w._private.rscratch,r={id:L.id,source:L.source,target:L.target,startX:s.startX,startY:s.startY,midX:s.midX,midY:s.midY,endX:s.endX,endY:s.endY};return Object.keys(L).forEach((e)=>{if(!["id","source","target"].includes(e))r[e]=L[e]}),r})}t(lt,"extractPositionedEdges");async function ut(m,w){l.debug("Starting cose-bilkent layout algorithm");try{gt(m);let L=await at(m),s=ht(L),r=lt(L);return l.debug(`Layout completed: ${s.length} nodes, ${r.length} edges`),{nodes:s,edges:r}}catch(L){throw l.error("Error in cose-bilkent layout algorithm:",L),L}}t(ut,"executeCoseBilkentLayout");function gt(m){if(!m)throw Error("Layout data is required");if(!m.config)throw Error("Configuration is required in layout data");if(!m.rootNode)throw Error("Root node is required");if(!m.nodes||!Array.isArray(m.nodes))throw Error("No nodes found in layout data");if(!Array.isArray(m.edges))throw Error("Edges array is required in layout data");return!0}t(gt,"validateLayoutData");var ct=t(async(m,w,{insertCluster:L,insertEdge:s,insertEdgeLabel:r,insertMarkers:e,insertNode:i,log:u,positionEdgeLabel:c},{algorithm:o})=>{let y={},n={},g=w.select("g");e(g,m.markers,m.type,m.diagramId);let f=g.insert("g").attr("class","subgraphs"),E=g.insert("g").attr("class","edgePaths"),T=g.insert("g").attr("class","edgeLabels"),N=g.insert("g").attr("class","nodes");u.debug("Inserting nodes into DOM for dimension calculation"),await Promise.all(m.nodes.map(async(D)=>{if(D.isGroup){let R={...D};n[D.id]=R,y[D.id]=R,await L(f,D)}else{let R={...D};y[D.id]=R;let a=await i(N,D,{config:m.config,dir:m.direction||"TB"}),p=a.node().getBBox();R.width=p.width,R.height=p.height,R.domId=a,u.debug(`Node ${D.id} dimensions: ${p.width}x${p.height}`)}})),u.debug("Running cose-bilkent layout algorithm");let v={...m,nodes:m.nodes.map((D)=>{let R=y[D.id];return{...D,width:R.width,height:R.height}})},O=await ut(v,m.config);u.debug("Positioning nodes based on layout results"),O.nodes.forEach((D)=>{let R=y[D.id];if(R?.domId)R.domId.attr("transform",`translate(${D.x}, ${D.y})`),R.x=D.x,R.y=D.y,u.debug(`Positioned node ${R.id} at center (${D.x}, ${D.y})`)}),O.edges.forEach((D)=>{let R=m.edges.find((a)=>a.id===D.id);if(R)R.points=[{x:D.startX,y:D.startY},{x:D.midX,y:D.midY},{x:D.endX,y:D.endY}]}),u.debug("Inserting and positioning edges"),await Promise.all(m.edges.map(async(D)=>{let R=await r(T,D),a=y[D.start??""],p=y[D.end??""];if(a&&p){let d=O.edges.find((A)=>A.id===D.id);if(d){u.debug("APA01 positionedEdge",d);let A={...D},I=s(E,A,n,m.type,a,p,m.diagramId);c(A,I)}else{let A={...D,points:[{x:a.x||0,y:a.y||0},{x:p.x||0,y:p.y||0}]},I=s(E,A,n,m.type,a,p,m.diagramId);c(A,I)}}})),u.debug("Cose-bilkent rendering completed")},"render"),Et=ct;export{Et as render};
@@ -1 +0,0 @@
1
- import{Ac}from"./index-xny7vsfz.js";import"./index-45p59fxq.js";export{Ac as default};
@@ -1 +0,0 @@
1
- import{vt}from"./index-hkz2mz34.js";export{vt as default};
@@ -1 +0,0 @@
1
- import{zd,Ns,x0,w0,C0,E0}from"./index-x7rajphe.js";export{x0 as css,E0 as gss,Ns as keywords,C0 as less,zd as mkCSS,w0 as sCSS};
@@ -1 +0,0 @@
1
- import{eg}from"./index-dxnkwf39.js";export{eg as createCynefinServices};
@@ -1,4 +0,0 @@
1
- import{t,l,p,W,Aa,OA,Vr,vo,ba,ol,ko}from"./index-aa3hmn6j.js";import{jt,Tn,sr,tn,zr,lo,we,St,xr,co,wr,Hl,gp,Ap,hp,Ri,da,bp,Fi,Dn,Li,Ua,pa,Mi,uo,Pi,yp,vp,Wl,qt,kp,Oi,po,$i,Kl,Vl,mo,xp,Yl,wp,Yu,Ur,Jl,Cp,Ep,Bp,Kn,Zl,Xl,zi,Ip,ec,v,lr,Gr,Ht,fo,He}from"./index-axtm1aq8.js";import{dp,pp,be,Xs,IA,mp,Zo}from"./index-gpmcth0x.js";import{En}from"./index-g3rg6vsd.js";var fr={};En(fr,{default:()=>Z});var Sn=/\s/;function Nn(r){var e=r.length;while(e--&&Sn.test(r.charAt(e)));return e}var Jr=Nn;var Pn=/^\s+/;function kn(r){return r?r.slice(0,Jr(r)+1).replace(Pn,""):r}var Zr=kn;var $r=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(zr(r))return $r;if(St(r)){var e=typeof r.valueOf=="function"?r.valueOf():r;r=St(e)?e+"":e}if(typeof r!="string")return r===0?r:+r;r=Zr(r);var n=An.test(r);return n||Rn.test(r)?Mn(r.slice(2),n?2:8):Cn.test(r)?$r:+r}var Qr=jn;var re=1/0,Bn=179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000;function Fn(r){if(!r)return r===0?r:0;if(r=Qr(r),r===re||r===-re){var e=r<0?-1:1;return e*Bn}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 ee=Gn;var te=Object.create,Xn=function(){function r(){}return function(e){if(!St(e))return{};if(te)return te(e);r.prototype=e;var n=new r;return r.prototype=void 0,n}}(),ne=Xn;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__"&&Hl)Hl(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)&&da(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(!St(n))return!1;var o=typeof e;if(o=="number"?Dn(n)&&Ri(e,n.length):o=="string"&&(e in n))return da(n[e],r);return!1}var T=Hn;function Jn(r){return Fi(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 oe=Jn;function Zn(r){var e=[];if(r!=null)for(var n in Object(r))e.push(n);return e}var ie=Zn;var $n=Object.prototype,Qn=$n.hasOwnProperty;function ro(r){if(!St(r))return ie(r);var e=Li(r),n=[];for(var o in r)if(!(o=="constructor"&&(e||!Qn.call(r,o))))n.push(o);return n}var ae=ro;function eo(r){return Dn(r)?yp(r,!0):ae(r)}var L=eo;function to(r){var e=r==null?0:r.length;return e?Vl(r,1):[]}var S=to;function no(r){return gp(bp(r,void 0,S),r+"")}var fe=no;var oo=vp(Object.getPrototypeOf,Object),V=oo;var io="[object Object]",ao=Function.prototype,so=Object.prototype,se=ao.toString,ho=so.hasOwnProperty,go=se.call(Object);function bo(r){if(!tn(r)||sr(r)!=io)return!1;var e=V(r);if(e===null)return!0;var n=ho.call(e,"constructor")&&e.constructor;return typeof n=="function"&&n instanceof n&&se.call(n)==go}var ue=bo;var yo="\\ud800-\\udfff",wo="\\u0300-\\u036f",_o="\\ufe20-\\ufe2f",Eo="\\u20d0-\\u20ff",xo=wo+_o+Eo,Oo="\\ufe0e\\ufe0f",Lo="\\u200d",Io=RegExp("["+Lo+yo+xo+Oo+"]");function So(r){return Io.test(r)}var de=So;function No(r,e){return r&&P(e,qt(e),r)}var ce=No;function Po(r,e){return r&&P(e,L(e),r)}var pe=Po;var ge=typeof fr=="object"&&fr&&!fr.nodeType&&fr,le=ge&&typeof ar=="object"&&ar&&!ar.nodeType&&ar,To=le&&le.exports===ge,me=To?jt.Buffer:void 0,he=me?me.allocUnsafe:void 0;function Co(r,e){if(e)return r.slice();var n=r.length,o=he?he(n):new r.constructor(n);return r.copy(o),o}var Z=Co;function Ao(r,e){return P(r,Yl(r),e)}var ve=Ao;var Ro=Object.getOwnPropertySymbols,Mo=!Ro?xp:function(r){var e=[];while(r)Kl(e,Yl(r)),r=V(r);return e},ur=Mo;function jo(r,e){return P(r,ur(r),e)}var ye=jo;function Bo(r){return wp(r,L,ur)}var _e=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 Ee=Go;function Xo(r){var e=new r.constructor(r.byteLength);return new Jl(e).set(new Jl(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 xe=Uo;var Vo=/\w*$/;function Yo(r){var e=new r.constructor(r.source,Vo.exec(r));return e.lastIndex=r.lastIndex,e}var Oe=Yo;var Le=Tn?Tn.prototype:void 0,Ie=Le?Le.valueOf:void 0;function zo(r){return Ie?Object(Ie.call(r)):{}}var Se=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]",$o="[object RegExp]",Qo="[object Set]",ri="[object String]",ei="[object Symbol]",ti="[object ArrayBuffer]",ni="[object DataView]",oi="[object Float32Array]",ii="[object Float64Array]",ai="[object Int8Array]",fi="[object Int16Array]",si="[object Int32Array]",ui="[object Uint8Array]",di="[object Uint8ClampedArray]",ci="[object Uint16Array]",pi="[object Uint32Array]";function li(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 xe(r,n);case oi:case ii:case ai:case fi:case si:case ui:case di:case ci:case pi:return dr(r,n);case Ko:return new o;case Jo:case ri:return new o(r);case $o:return Oe(r);case Qo:return new o;case ei:return Se(r)}}var Ne=li;function mi(r){return typeof r.constructor=="function"&&!Li(r)?ne(V(r)):{}}var cr=mi;var hi="[object Map]";function gi(r){return tn(r)&&Ur(r)==hi}var Pe=gi;var ke=uo&&uo.isMap,vi=ke?Mi(ke):Pe,Te=vi;var bi="[object Set]";function yi(r){return tn(r)&&Ur(r)==bi}var Ce=yi;var Ae=uo&&uo.isSet,wi=Ae?Mi(Ae):Ce,Re=wi;var _i=1,Ei=2,xi=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]",ji="[object RegExp]",Bi="[object Set]",Di="[object String]",Gi="[object Symbol]",Xi="[object WeakMap]",Ui="[object ArrayBuffer]",Vi="[object DataView]",Yi="[object Float32Array]",Wi="[object Float64Array]",qi="[object Int8Array]",Hi="[object Int16Array]",Ki="[object Int32Array]",Ji="[object Uint8Array]",Zi="[object Uint8ClampedArray]",Qi="[object Uint16Array]",ra="[object Uint32Array]",x={};x[Me]=x[Ii]=x[Ui]=x[Vi]=x[Si]=x[Ni]=x[Yi]=x[Wi]=x[qi]=x[Hi]=x[Ki]=x[Ci]=x[Ai]=x[Be]=x[ji]=x[Bi]=x[Di]=x[Gi]=x[Ji]=x[Zi]=x[Qi]=x[ra]=!0;x[ki]=x[je]=x[Xi]=!1;function pr(r,e,n,o,i,a){var f,s=e&_i,u=e&Ei,d=e&xi;if(n)f=i?n(r,o,i,a):n(r);if(f!==void 0)return f;if(!St(r))return r;var c=we(r);if(c){if(f=Ee(r),!s)return ir(r,f)}else{var m=Ur(r),h=m==je||m==Ti;if(pa(r))return Z(r,s);if(m==Be||m==Me||h&&!i){if(f=u||h?{}:cr(r),!s)return u?ye(r,pe(f,r)):ve(r,ce(f,r))}else{if(!x[m])return i?r:{};f=Ne(r,m,s)}}a||(a=new mo);var b=a.get(r);if(b)return b;if(a.set(r,f),Re(r))r.forEach(function(g){f.add(pr(g,e,n,g,r,a))});else if(Te(r))r.forEach(function(g,_){f.set(_,pr(g,e,n,_,r,a))});var w=d?u?_e:Yu:u?L:qt,y=c?void 0:w(r);return Ap(y||r,function(g,_){if(y)_=g,g=r[_];M(f,_,pr(g,e,n,_,r,a))}),f}var De=pr;var ea=1,ta=4;function na(r){return De(r,ea|ta)}var Fe=na;var oa=function(){return jt.Date.now()},_r=oa;var Ge=Object.prototype,ia=Ge.hasOwnProperty,aa=Fi(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||da(c,Ge[d])&&!ia.call(r,d))r[d]=a[d]}}return r}),Xe=aa;function fa(r,e,n){if(n!==void 0&&!da(r[e],n)||n===void 0&&!(e in r))R(r,e,n)}var Q=fa;function sa(r,e){if(e==="constructor"&&typeof r[e]==="function")return;if(e=="__proto__")return;return r[e]}var rr=sa;function ua(r){return P(r,L(r))}var Ue=ua;function ca(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=we(u),b=!h&&pa(u),w=!h&&!b&&Pi(u);if(c=u,h||b||w)if(we(s))c=s;else if(Ip(s))c=ir(s);else if(b)m=!1,c=Z(u,!0);else if(w)m=!1,c=dr(u,!0);else c=[];else if(ue(u)||Ua(u)){if(c=s,Ua(s))c=Ue(s);else if(!St(s)||co(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=ca;function Ye(r,e,n,o,i){if(r===e)return;Zl(e,function(a,f){if(i||(i=new mo),St(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 la(r){var e=r==null?0:r.length;return e?r[e-1]:void 0}var G=la;function ma(r){return function(e,n,o){var i=Object(e);if(!Dn(e)){var a=Kn(n,3);e=qt(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=ma;var ha=Math.max;function ga(r,e,n){var o=r==null?0:r.length;if(!o)return-1;var i=n==null?0:ee(n);if(i<0)i=ha(o+i,0);return hp(r,Kn(e,3),i)}var qe=ga;var va=We(qe),er=va;function ya(r,e){var n=-1,o=Dn(r)?Array(r.length):[];return zi(r,function(i,a,f){o[++n]=e(i,a,f)}),o}var mr=ya;function wa(r,e){var n=we(r)?lo:mr;return n(r,Kn(e,3))}var E=wa;function _a(r,e){return r==null?r:Zl(r,ec(e),L)}var Ke=_a;function Ea(r,e){return r&&Xl(r,ec(e))}var Je=Ea;function xa(r,e){return r>e}var Ze=xa;var Oa=Object.prototype,La=Oa.hasOwnProperty;function Ia(r,e){return r!=null&&La.call(r,e)}var $e=Ia;function Sa(r,e){return r!=null&&Cp(r,e,$e)}var hr=Sa;var Na="[object String]";function Pa(r){return typeof r=="string"||!we(r)&&tn(r)&&sr(r)==Na}var Qe=Pa;function ka(r,e){return r<e}var gr=ka;function Ta(r,e){var n={};return e=Kn(e,3),Xl(r,function(o,i,a){R(n,i,e(o,i,a))}),n}var z=Ta;function Ca(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&&!zr(f):n(f,s)))var s=f,u=a}return u}var q=Ca;function Ra(r){return r&&r.length?q(r,xr,Ze):void 0}var I=Ra;var Ma=oe(function(r,e,n){ze(r,e,n)}),tr=Ma;function ja(r){return r&&r.length?q(r,xr,gr):void 0}var j=ja;function Ba(r,e){return r&&r.length?q(r,Kn(e,2),gr):void 0}var H=Ba;function Da(r,e,n,o){if(!St(r))return r;e=Oi(e,r);var i=-1,a=e.length,f=a-1,s=r;while(s!=null&&++i<a){var u=po(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=St(c)?c:Ri(e[i+1])?[]:{}}M(s,u,d),s=s[u]}return r}var rt=Da;function Fa(r,e,n){var o=-1,i=e.length,a={};while(++o<i){var f=e[o],s=$i(r,f);if(n(s,f))rt(a,Oi(f,r),s)}return a}var et=Fa;function Ga(r,e){var n=r.length;r.sort(e);while(n--)r[n]=r[n].value;return r}var tt=Ga;function Xa(r,e){if(r!==e){var n=r!==void 0,o=r===null,i=r===r,a=zr(r),f=e!==void 0,s=e===null,u=e===e,d=zr(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 nt=Xa;function Va(r,e,n){var o=-1,i=r.criteria,a=e.criteria,f=i.length,s=n.length;while(++o<f){var u=nt(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 ot=Va;function Ya(r,e,n){if(e.length)e=lo(e,function(a){if(we(a))return function(f){return $i(f,a.length===1?a[0]:a)};return a});else e=[xr];var o=-1;e=lo(e,Mi(Kn));var i=mr(r,function(a,f,s){var u=lo(e,function(d){return d(a)});return{criteria:u,index:++o,value:a}});return tt(i,function(a,f){return ot(a,f,n)})}var it=Ya;var za=Bp("length"),at=za;var st="\\ud800-\\udfff",Wa="\\u0300-\\u036f",qa="\\ufe20-\\ufe2f",Ha="\\u20d0-\\u20ff",Ka=Wa+qa+Ha,Ja="\\ufe0e\\ufe0f",Za="["+st+"]",Er="["+Ka+"]",Or="\\ud83c[\\udffb-\\udfff]",$a="(?:"+Er+"|"+Or+")",ut="[^"+st+"]",dt="(?:\\ud83c[\\udde6-\\uddff]){2}",ct="[\\ud800-\\udbff][\\udc00-\\udfff]",Qa="\\u200d",pt=$a+"?",lt="["+Ja+"]?",rf="(?:"+Qa+"(?:"+[ut,dt,ct].join("|")+")"+lt+pt+")*",ef=lt+pt+rf,tf="(?:"+[ut+Er+"?",Er,dt,ct,Za].join("|")+")",ft=RegExp(Or+"(?="+Or+")|"+tf+ef,"g");function nf(r){var e=ft.lastIndex=0;while(ft.test(r))++e;return e}var mt=nf;function of(r){return de(r)?mt(r):at(r)}var ht=of;function af(r,e){return et(r,e,function(n,o){return Ep(r,o)})}var gt=af;var ff=fe(function(r,e){return r==null?{}:gt(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 vt=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),vt(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(Dn(r))return Qe(r)?ht(r):r.length;var e=Ur(r);if(e==lf||e==mf)return r.size;return Wl(r).length}var yt=hf;var gf=Fi(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 it(r,Vl(e,1),[])}),C=gf;var vf=0;function bf(r){var e=++vf;return kp(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 Lr=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=wr(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())Sr(r,e,n,f);while(f=i.dequeue())Sr(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(Sr(r,e,n,f,!0));break}}}return o}function Sr(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 He,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){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 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 He().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 He({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(Tr(r)+1),function(){return[]});return v(r.nodes(),function(n){var o=r.node(n),i=o.rank;if(!Ht(i))e[i][o.order]=n}),e}function Nt(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 Pt(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(Ht(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 Tr(r){return I(E(r.nodes(),function(e){var n=r.node(e).rank;if(!Ht(n))return n}))}function kt(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 Tt(r,e){var n=_r();try{return e()}finally{console.log(r+" time: "+(_r()-n)+"ms")}}function Ct(r,e){return e()}function Rt(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)At(r,"borderLeft","_bl",n,i,a),At(r,"borderRight","_br",n,i,a)}}v(r.children(),e)}function At(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")Ft(r)}function Dt(r){var e=r.graph().rankdir.toLowerCase();if(e==="bt"||e==="rl")If(r);if(e==="lr"||e==="rl")Sf(r),Ft(r)}function Ft(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){Cr(r.node(e))}),v(r.edges(),function(e){var n=r.edge(e);if(v(n.points,Cr),Object.prototype.hasOwnProperty.call(n,"y"))Cr(n)})}function Cr(r){r.y=-r.y}function Sf(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,"x"))Ar(n)})}function Ar(r){var e=r.x;r.x=r.y,r.y=e}function Gt(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 Xt(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 He({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=wr(1);var mh=wr(1);Rr.CycleException=or;function Rr(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),yt(e)!==r.nodeCount())throw new or;return o}function or(){}or.prototype=Error();function yr(r,e,n){if(!we(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);Vt(r,f,n==="post",a,o,i)}),i}function Vt(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){Vt(r,f,n,o,i,a)}),n)a.push(e)}}function Mr(r,e){return yr(r,e,"post")}function jr(r,e){return yr(r,e,"pre")}F.initLowLimValues=Dr;F.initCutValues=Br;F.calcCutValue=zt;F.leaveEdge=Kt;F.enterEdge=Jt;F.exchangeEdges=Zt;function F(r){r=It(r),nr(r);var e=br(r);Dr(e),Br(e,r);var n,o;while(n=Kt(e))o=Jt(e,r,n),Zt(e,r,n,o)}function Br(r,e){var n=Mr(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=zt(r,e,n)}function zt(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 Dr(r,e){if(arguments.length<2)e=r.nodes()[0];Wt(r,{},1,e)}function Wt(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=Wt(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 er(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=lr(e.edges(),function(c){return u===Yt(r,r.node(c.v),s)&&u!==Yt(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,{}),Dr(r),Br(r,e),Df(r,e)}function Df(r,e){var n=er(r.nodes(),function(i){return!e.node(i).parent}),o=jr(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 Yt(r,e,n){return n.low<=e.lim&&e.lim<=n.lim}function Fr(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=nr;function Xf(r){nr(r),br(r)}function $t(r){F(r)}function Qt(r){var e=k(r,"root",{},"_root"),n=Uf(r),o=I(Gr(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=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){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 fo(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 nn(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 on(r,e,n){var o=zf(r),i=new He({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=!Ht(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 an(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=Lr(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 fn(r){var e={},n=lr(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 sn(r,e){return E(e,function(n){var o=r.inEdges(n);if(!o.length)return{v:n};else{var i=fo(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 un(r,e){var n={};v(r,function(i,a){var f=n[i.v]={indegree:0,in:[],out:[],vs:[i.v],i:a};if(!Ht(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(!Ht(a)&&!Ht(f))f.indegree++,a.out.push(n[i.w])});var o=lr(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(Ht(f.barycenter)||Ht(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(lr(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=kt(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=dn(a,i,u),v(o,function(c){u+=c.vs.length,a.push(c.vs),f+=c.barycenter*c.weight,s+=c.weight,u=dn(a,i,u)});var d={vs:S(a)};if(s)d.barycenter=f/s,d.weight=s;return d}function dn(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 Xr(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=lr(i,function(w){return w!==f&&w!==s});var d=sn(r,i);v(d,function(w){if(r.children(w.v).length){var y=Xr(r,w.v,n,o);if(u[w.v]=y,Object.prototype.hasOwnProperty.call(y,"barycenter"))Zf(w,y)}});var c=un(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(!Ht(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 mn(r){var e=Tr(r),n=pn(r,N(1,e+1),"inEdges"),o=pn(r,N(e-1,-1,-1),"outEdges"),i=fn(r);ln(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=an(r,i);if(d<a)u=0,f=Fe(i),a=d}ln(r,f)}function pn(r,e,n){return E(e,function(o){return on(r,o,n)})}function $f(r,e){var n=new He;v(r,function(o){var i=o.graph().root,a=Xr(o,i,n,e);v(a.vs,function(f,s){o.node(f).order=s}),nn(o,n,a.vs)})}function ln(r,e){v(e,function(n){v(n,function(o,i){r.node(o).order=i})})}function hn(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))gn(n,y,w)})}),s=m+1,f=b}),a}return fo(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))gn(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 fo(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 gn(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 He,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(Gr(e),function(n){var{NEGATIVE_INFINITY:o,POSITIVE_INFINITY:i}=Number;return Ke(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=Gr(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=Gr(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 vn(r){var e=B(r),n=tr(es(r,e),ts(r,e)),o={},i;v(["u","d"],function(f){i=f==="u"?e:Gr(e).reverse(),v(["l","r"],function(s){if(s==="r")i=E(i,function(m){return Gr(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 bn(r){r=vr(r),ls(r),Je(vn(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 qr(r,e){var n=e&&e.debugTiming?Tt:Ct;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",()=>Rs(r)),e(" acyclic",()=>xt(r)),e(" nestingGraph.run",()=>Qt(r)),e(" rank",()=>Fr(vr(r))),e(" injectEdgeLabelProxies",()=>Is(r)),e(" removeEmptyRanks",()=>Pt(r)),e(" nestingGraph.cleanup",()=>en(r)),e(" normalizeRanks",()=>Nt(r)),e(" assignRankMinMax",()=>Ss(r)),e(" removeEdgeLabelProxies",()=>Ns(r)),e(" normalize.run",()=>Gt(r)),e(" parentDummyChains",()=>hn(r)),e(" addBorderSegments",()=>Rt(r)),e(" order",()=>mn(r)),e(" insertSelfEdges",()=>Ms(r)),e(" adjustCoordinateSystem",()=>Bt(r)),e(" position",()=>bn(r)),e(" positionSelfEdges",()=>js(r)),e(" removeBorderNodes",()=>As(r)),e(" normalize.undo",()=>Xt(r)),e(" fixupEdgeLabelCoords",()=>Ts(r)),e(" undoCoordinateSystem",()=>Dt(r)),e(" translateGraph",()=>Ps(r)),e(" assignNodeIntersects",()=>ks(r)),e(" reversePoints",()=>Cs(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 He({multigraph:!0,compound:!0}),n=Wr(r.graph());return e.setGraph(tr({},vs,Yr(n,gs),K(n,bs))),v(r.nodes(),function(o){var i=Wr(r.node(o));e.setNode(o,Xe(Yr(i,ys),ws)),e.setParent(o,r.parent(o))}),v(r.edges(),function(o){var i=Wr(r.edge(o));e.setEdge(o,tr({},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 Is(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 Ss(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 Ns(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 Ps(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 ks(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 Ts(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 Cs(r){v(r.edges(),function(e){var n=r.edge(e);if(n.reversed)n.points.reverse()})}function As(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 Rs(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 Ms(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 js(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 Wr(r){var e={};return v(r,function(n,o){e[o.toLowerCase()]=n}),e}var yn=t((r,e,n)=>Math.max(e,Math.min(n,r)),"clamp"),wn=t((r="TB")=>{switch(r){case"BT":return"bottom";case"LR":return"right";case"RL":return"left";case"TB":default:return"top"}},"getDefaultSelfLoopSide"),Bs=t((r)=>r==="flowchart"||r==="flowchart-v2"||r==="stateDiagram"||r==="er"||r==="classDiagram","shouldMergeSelfLoopSegments"),Ds=["x","y","width","height","labelBBox","intersect","calcIntersect","diff","clusterNode"],Fs=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 wn(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 wn(i)},"getSelfLoopSide"),Gs=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=yn(Math.max(o,r.width*0.35),36,u),c=yn(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"),Us=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=Fs(r,m,f,c.start,a),w=Gs(m,b,e,h.width??0),y=Us(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}=dp(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=Bs(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
- Node.id = `,y,`
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 Hr=await qs({element:c,graph:g.graph,diagramType:n,id:o,parentCluster:e.node(y),siteConfig:a}),Kr=Hr.elem;W(g,Kr),g.diff=Hr.diff||0,l.info("New compound node after recursive render XAX",y,"width",g.width,"height",g.height),OA(Kr,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(Xs(g.id,e)),be.set(g.id,{id:Xs(g.id,e),node:g});else l.trace("Node - the non recursive path XAX",y,c,e.node(y),f),await pp(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",be,"ids:",g.v,g.w,"Translating: ",be.get(g.v),be.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 ba(d,A),_.width=A.width,_.height=A.height,_.labelStyle=A.labelStyle;return}await ba(d,_)});await Promise.all(y)},"processEdges")();let{subGraphTitleTotalMargin:w}=Aa(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"),qr(r)},"runDagreGraphLayout"),Vs=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"),_n=t((r,e)=>{Ds.forEach((n)=>{if(e[n]!==void 0)r[n]=e[n]})},"applyDagreNodeLayout"),Ys=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"),zs=t((r,e)=>{let{graph:n,mergeSelfLoops:o,subGraphTitleTotalMargin:i=0}=e,a=new Map(r.nodes.map((s)=>[s.id,s]));mp(n).forEach((s)=>{let u=Vs(n,s,i);if(!u)return;_n(n.node(s),u);let d=a.get(s);if(d)_n(d,u)});let f=i/2;return r.edges=xn(n,f,{mergeSelfLoops:o}).map(({edge:s,start:u,end:d})=>Ys(s,u,d,f)),r},"applyDagreLayoutResult"),Ws=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(mp(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)),be.get(h.id).node=h,Vr(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 vo(n,h),be.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),Vr(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=ko(o,m,be,i,w,y,a);ol(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"),qs=t(async(r)=>{let e=await On(r);return Ln(e.graph),await Ws(e)},"renderDagreSubgraph"),In=t((r)=>{let e=new He({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)}),IA(e),{graph:e}},"prepareLayoutForDagre"),Hs=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"),Ks=t((r,e)=>{let n=e.preparedLayout?.measuredLayout;if(!n)throw Error("runDagreLayoutCore requires measureDagreLayout to run first");return Ln(n.graph),zs(r,n),n},"runDagreLayoutCore"),Js=t((r,{measure:e})=>mp(e.graph).map((n)=>e.graph.node(n)).filter(Boolean),"getDagrePaintNodes"),Zs=t((r,e,{measure:n})=>r?n.graph.node(r):void 0,"getDagreEdgeNode"),qg=Zo({prepareLayout:In,measureLayout:Hs,runLayoutCore:Ks,paintOptions:{clusterDb:be,getNodes:Js,getEdgeNode:Zs,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{zs as applyDagreLayoutResult,xn as getEdgesToRender,Hs as measureDagreLayout,In as prepareLayoutForDagre,qg as render,Ks as runDagreLayoutCore};
@@ -1,24 +0,0 @@
1
- import{ke}from"./index-4n7t26ap.js";import{t,l,Wt,Y,C,te,F,P,G,z,j,H,q,h,Vn,me,nd,Q,ie,bt}from"./index-aa3hmn6j.js";import{so}from"./index-7pz6n3pg.js";import{Pe}from"./index-dxnkwf39.js";function Ge(e){var r=0,n=e.children,o=n&&n.length;if(!o)r=1;else while(--o>=0)r+=n[o].value;e.value=r}function ue(){return this.eachAfter(Ge)}function fe(e,r){let n=-1;for(let o of this)e.call(r,o,++n,this);return this}function he(e,r){var n=this,o=[n],s,p,u=-1;while(n=o.pop())if(e.call(r,n,++u,this),s=n.children)for(p=s.length-1;p>=0;--p)o.push(s[p]);return this}function ge(e,r){var n=this,o=[n],s=[],p,u,f,S=-1;while(n=o.pop())if(s.push(n),p=n.children)for(u=0,f=p.length;u<f;++u)o.push(p[u]);while(n=s.pop())e.call(r,n,++S,this);return this}function ye(e,r){let n=-1;for(let o of this)if(e.call(r,o,++n,this))return o}function xe(e){return this.eachAfter(function(r){var n=+e(r.data)||0,o=r.children,s=o&&o.length;while(--s>=0)n+=o[s].value;r.value=n})}function Se(e){return this.eachBefore(function(r){if(r.children)r.children.sort(e)})}function ve(e){var r=this,n=Xe(r,e),o=[r];while(r!==n)r=r.parent,o.push(r);var s=o.length;while(e!==n)o.splice(s,0,e),e=e.parent;return o}function Xe(e,r){if(e===r)return e;var n=e.ancestors(),o=r.ancestors(),s=null;e=n.pop(),r=o.pop();while(e===r)s=e,e=n.pop(),r=o.pop();return s}function be(){var e=this,r=[e];while(e=e.parent)r.push(e);return r}function we(){return Array.from(this)}function Ce(){var e=[];return this.eachBefore(function(r){if(!r.children)e.push(r)}),e}function Te(){var e=this,r=[];return e.each(function(n){if(n!==e)r.push({source:n.parent,target:n})}),r}function*Le(){var e=this,r,n=[e],o,s,p;do{r=n.reverse(),n=[];while(e=r.pop())if(yield e,o=e.children)for(s=0,p=o.length;s<p;++s)n.push(o[s])}while(n.length)}function J(e,r){if(e instanceof Map){if(e=[void 0,e],r===void 0)r=Ze}else if(r===void 0)r=je;var n=new ne(e),o,s=[n],p,u,f,S;while(o=s.pop())if((u=r(o.data))&&(S=(u=Array.from(u)).length)){o.children=u;for(f=S-1;f>=0;--f)s.push(p=u[f]=new ne(u[f])),p.parent=o,p.depth=o.depth+1}return n.eachBefore(Je)}function Ye(){return J(this).eachBefore(Ue)}function je(e){return e.children}function Ze(e){return Array.isArray(e)?e[1]:null}function Ue(e){if(e.data.value!==void 0)e.value=e.data.value;e.data=e.data.data}function Je(e){var r=0;do e.height=r;while((e=e.parent)&&e.height<++r)}function ne(e){this.data=e,this.depth=this.height=0,this.parent=null}ne.prototype=J.prototype={constructor:ne,count:ue,each:fe,eachAfter:ge,eachBefore:he,find:ye,sum:xe,sort:Se,path:ve,ancestors:be,descendants:we,leaves:Ce,links:Te,copy:Ye,[Symbol.iterator]:Le};function De(e){if(typeof e!=="function")throw Error();return e}function K(){return 0}function O(e){return function(){return e}}function $e(e){e.x0=Math.round(e.x0),e.y0=Math.round(e.y0),e.x1=Math.round(e.x1),e.y1=Math.round(e.y1)}function Ae(e,r,n,o,s){var p=e.children,u,f=-1,S=p.length,d=e.value&&(o-r)/e.value;while(++f<S)u=p[f],u.y0=n,u.y1=s,u.x0=r,u.x1=r+=u.value*d}function Fe(e,r,n,o,s){var p=e.children,u,f=-1,S=p.length,d=e.value&&(s-n)/e.value;while(++f<S)u=p[f],u.x0=r,u.x1=o,u.y0=n,u.y1=n+=u.value*d}var Ke=(1+Math.sqrt(5))/2;function Qe(e,r,n,o,s,p){var u=[],f=r.children,S,d,m=0,L=0,i=f.length,T,b,w=r.value,g,v,B,D,X,ae,E;while(m<i){T=s-n,b=p-o;do g=f[L++].value;while(!g&&L<i);v=B=g,ae=Math.max(b/T,T/b)/(w*e),E=g*g*ae,X=Math.max(B/E,E/v);for(;L<i;++L){if(g+=d=f[L].value,d<v)v=d;if(d>B)B=d;if(E=g*g*ae,D=Math.max(B/E,E/v),D>X){g-=d;break}X=D}if(u.push(S={value:g,dice:T<b,children:f.slice(m,L)}),S.dice)Ae(S,n,o,s,w?o+=b*g/w:p);else Fe(S,n,o,w?n+=T*g/w:s,p);w-=g,m=L}return u}var Ve=function e(r){function n(o,s,p,u,f){Qe(r,o,s,p,u,f)}return n.ratio=function(o){return e((o=+o)>1?o:1)},n}(Ke);function ce(){var e=Ve,r=!1,n=1,o=1,s=[0],p=K,u=K,f=K,S=K,d=K;function m(i){if(i.x0=i.y0=0,i.x1=n,i.y1=o,i.eachBefore(L),s=[0],r)i.eachBefore($e);return i}function L(i){var T=s[i.depth],b=i.x0+T,w=i.y0+T,g=i.x1-T,v=i.y1-T;if(g<b)b=g=(b+g)/2;if(v<w)w=v=(w+v)/2;if(i.x0=b,i.y0=w,i.x1=g,i.y1=v,i.children){if(T=s[i.depth+1]=p(i)/2,b+=d(i)-T,w+=u(i)-T,g-=f(i)-T,v-=S(i)-T,g<b)b=g=(b+g)/2;if(v<w)w=v=(w+v)/2;e(i,b,w,g,v)}}return m.round=function(i){return arguments.length?(r=!!i,m):r},m.size=function(i){return arguments.length?(n=+i[0],o=+i[1],m):[n,o]},m.tile=function(i){return arguments.length?(e=De(i),m):e},m.padding=function(i){return arguments.length?m.paddingInner(i).paddingOuter(i):m.paddingInner()},m.paddingInner=function(i){return arguments.length?(p=typeof i==="function"?i:O(+i),m):p},m.paddingOuter=function(i){return arguments.length?m.paddingTop(i).paddingRight(i).paddingBottom(i).paddingLeft(i):m.paddingTop()},m.paddingTop=function(i){return arguments.length?(u=typeof i==="function"?i:O(+i),m):u},m.paddingRight=function(i){return arguments.length?(f=typeof i==="function"?i:O(+i),m):f},m.paddingBottom=function(i){return arguments.length?(S=typeof i==="function"?i:O(+i),m):S},m.paddingLeft=function(i){return arguments.length?(d=typeof i==="function"?i:O(+i),m):d},m}var Be=class{constructor(){this.nodes=[],this.levels=new Map,this.outerNodes=[],this.classes=new Map,this.setAccTitle=P,this.getAccTitle=G,this.setDiagramTitle=H,this.getDiagramTitle=q,this.getAccDescription=j,this.setAccDescription=z}static{t(this,"TreeMapDB")}getNodes(){return this.nodes}getConfig(){let e=Y,r=C();return ie({...e.treemap,...r.treemap??{}})}addNode(e,r){if(this.nodes.push(e),this.levels.set(e,r),r===0)this.outerNodes.push(e),this.root??=e}getRoot(){return{name:"",children:this.outerNodes}}addClass(e,r){let n=this.classes.get(e)??{id:e,styles:[],textStyles:[]},o=r.replace(/\\,/g,"§§§").replace(/,/g,";").replace(/§§§/g,",").split(";");if(o)o.forEach((s)=>{if(nd(s))if(n?.textStyles)n.textStyles.push(s);else n.textStyles=[s];if(n?.styles)n.styles.push(s);else n.styles=[s]});this.classes.set(e,n)}getClasses(){return this.classes}getStylesForClass(e){return this.classes.get(e)?.styles??[]}clear(){F(),this.nodes=[],this.levels=new Map,this.outerNodes=[],this.classes=new Map,this.root=void 0}};function Ee(e){if(!e.length)return[];let r=[],n=[];return e.forEach((o)=>{let s={name:o.name,children:o.type==="Leaf"?void 0:[]};if(s.classSelector=o?.classSelector,o?.cssCompiledStyles)s.cssCompiledStyles=o.cssCompiledStyles;if(o.type==="Leaf"&&o.value!==void 0)s.value=o.value;while(n.length>0&&n[n.length-1].level>=o.level)n.pop();if(n.length===0)r.push(s);else{let p=n[n.length-1].node;if(p.children)p.children.push(s);else p.children=[s]}if(o.type!=="Leaf")n.push({node:s,level:o.level})}),r}t(Ee,"buildHierarchy");var et=t((e,r)=>{ke(e,r);let n=[];for(let p of e.TreemapRows??[])if(p.$type==="ClassDefStatement")r.addClass(p.className??"",p.styleText??"");for(let p of e.TreemapRows??[]){let u=p.item;if(!u)continue;let f=p.indent?parseInt(p.indent):0,S=tt(u),d=u.classSelector?r.getStylesForClass(u.classSelector):[],m=d.length>0?d:void 0,L={level:f,name:S,type:u.$type,value:u.value,classSelector:u.classSelector,cssCompiledStyles:m};n.push(L)}let o=Ee(n),s=t((p,u)=>{for(let f of p)if(r.addNode(f,u),f.children&&f.children.length>0)s(f.children,u+1)},"addNodesRecursively");s(o,0)},"populate"),tt=t((e)=>e.name?String(e.name):"","getItemName"),Re={parser:{yy:void 0},parse:t(async(e)=>{try{let n=await Pe("treemap",e);l.debug("Treemap AST:",n);let o=Re.parser?.yy;if(!(o instanceof Be))throw Error("parser.parser?.yy was not a TreemapDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");et(n,o)}catch(r){throw l.error("Error parsing treemap:",r),r}},"parse")},at=10,ee=10,le=25,rt=t((e,r,n,o)=>{let s=o.db,p=s.getConfig(),u=p.padding??at,f=s.getDiagramTitle(),S=s.getRoot(),{themeVariables:d}=C();if(!S)return;let m=f?30:0,L=me(r),i=p.nodeWidth?p.nodeWidth*ee:960,T=p.nodeHeight?p.nodeHeight*ee:500,b=i,w=T+m;L.attr("viewBox",`0 0 ${b} ${w}`),te(L,w,b,p.useMaxWidth);let g;try{let a=p.valueFormat||",";if(a==="$0,0")g=t((c)=>"$"+so(",")(c),"valueFormat");else if(a.startsWith("$")&&a.includes(",")){let c=/\.\d+/.exec(a),y=c?c[0]:"";g=t((A)=>"$"+so(","+y)(A),"valueFormat")}else if(a.startsWith("$")){let c=a.substring(1);g=t((y)=>"$"+so(c||"")(y),"valueFormat")}else g=so(a)}catch(a){l.error("Error creating format function:",a),g=so(",")}let v=Vn().range(["transparent",d.cScale0,d.cScale1,d.cScale2,d.cScale3,d.cScale4,d.cScale5,d.cScale6,d.cScale7,d.cScale8,d.cScale9,d.cScale10,d.cScale11]),B=Vn().range(["transparent",d.cScalePeer0,d.cScalePeer1,d.cScalePeer2,d.cScalePeer3,d.cScalePeer4,d.cScalePeer5,d.cScalePeer6,d.cScalePeer7,d.cScalePeer8,d.cScalePeer9,d.cScalePeer10,d.cScalePeer11]),D=Vn().range([d.cScaleLabel0,d.cScaleLabel1,d.cScaleLabel2,d.cScaleLabel3,d.cScaleLabel4,d.cScaleLabel5,d.cScaleLabel6,d.cScaleLabel7,d.cScaleLabel8,d.cScaleLabel9,d.cScaleLabel10,d.cScaleLabel11]);if(f)L.append("text").attr("x",b/2).attr("y",m/2).attr("class","treemapTitle").attr("text-anchor","middle").attr("dominant-baseline","middle").text(f);let X=L.append("g").attr("transform",`translate(0, ${m})`).attr("class","treemapContainer"),ae=J(S).sum((a)=>a.value??0).sort((a,c)=>(c.value??0)-(a.value??0)),Ne=ce().size([i,T]).paddingTop((a)=>a.children&&a.children.length>0?le+ee:0).paddingInner(u).paddingLeft((a)=>a.children&&a.children.length>0?ee:0).paddingRight((a)=>a.children&&a.children.length>0?ee:0).paddingBottom((a)=>a.children&&a.children.length>0?ee:0).round(!0)(ae),We=Ne.descendants().filter((a)=>a.children&&a.children.length>0),re=X.selectAll(".treemapSection").data(We).enter().append("g").attr("class","treemapSection").attr("transform",(a)=>`translate(${a.x0},${a.y0})`);if(re.append("rect").attr("width",(a)=>a.x1-a.x0).attr("height",le).attr("class","treemapSectionHeader").attr("fill","none").attr("fill-opacity",0.6).attr("stroke-width",0.6).attr("style",(a)=>{if(a.depth===0)return"display: none;";return""}),re.append("clipPath").attr("id",(a,c)=>`clip-section-${r}-${c}`).append("rect").attr("width",(a)=>Math.max(0,a.x1-a.x0-12)).attr("height",le),re.append("rect").attr("width",(a)=>a.x1-a.x0).attr("height",(a)=>a.y1-a.y0).attr("class",(a,c)=>`treemapSection section${c}`).attr("fill",(a)=>v(a.data.name)).attr("fill-opacity",0.6).attr("stroke",(a)=>B(a.data.name)).attr("stroke-width",2).attr("stroke-opacity",0.4).attr("style",(a)=>{if(a.depth===0)return"display: none;";let c=Q({cssCompiledStyles:a.data.cssCompiledStyles});return c.nodeStyles+";"+c.borderStyles.join(";")}),re.append("text").attr("class","treemapSectionLabel").attr("x",6).attr("y",le/2).attr("dominant-baseline","middle").text((a)=>a.depth===0?"":a.data.name).attr("font-weight","bold").attr("clip-path",(a,c)=>`url(#clip-section-${r}-${c})`).attr("style",(a)=>{if(a.depth===0)return"display: none;";let c="dominant-baseline: middle; font-size: 12px; fill:"+D(a.data.name)+"; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;",y=Q({cssCompiledStyles:a.data.cssCompiledStyles});return c+y.labelStyles.replace("color:","fill:")}).each(function(a){if(a.depth===0)return;let c=h(this),y=a.data.name;c.text(y);let A=a.x1-a.x0,k=6,N;if(p.showValues!==!1&&a.value){let _=A-10,I=30,Oe=10;N=_-30-10-k}else N=A-k-6;let x=Math.max(15,N),W=c.node();if(W.getComputedTextLength()>x){let I=y;while(I.length>0){if(I=y.substring(0,I.length-1),I.length===0){if(c.text("..."),W.getComputedTextLength()>x)c.text("");break}if(c.text(I+"..."),W.getComputedTextLength()<=x)break}}}),p.showValues!==!1)re.append("text").attr("class","treemapSectionValue").attr("x",(a)=>a.x1-a.x0-10).attr("y",le/2).attr("text-anchor","end").attr("dominant-baseline","middle").text((a)=>a.value?g(a.value):"").attr("font-style","italic").attr("style",(a)=>{if(a.depth===0)return"display: none;";let c="text-anchor: end; dominant-baseline: middle; font-size: 10px; fill:"+D(a.data.name)+"; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;",y=Q({cssCompiledStyles:a.data.cssCompiledStyles});return c+y.labelStyles.replace("color:","fill:")});let Me=Ne.leaves(),V=Me.length>20,He=V?16:38,oe=V?14:28,Z=V?4:8,U=V?4:6,pe=V?2:4,_e=V?8:10,de=V?1:2,se=X.selectAll(".treemapLeafGroup").data(Me).enter().append("g").attr("class",(a,c)=>`treemapNode treemapLeafGroup leaf${c}${a.data.classSelector?` ${a.data.classSelector}`:""}x`).attr("transform",(a)=>`translate(${a.x0},${a.y0})`);if(se.append("rect").attr("width",(a)=>a.x1-a.x0).attr("height",(a)=>a.y1-a.y0).attr("class","treemapLeaf").attr("fill",(a)=>a.parent?v(a.parent.data.name):v(a.data.name)).attr("style",(a)=>Q({cssCompiledStyles:a.data.cssCompiledStyles}).nodeStyles).attr("fill-opacity",0.3).attr("stroke",(a)=>a.parent?v(a.parent.data.name):v(a.data.name)).attr("stroke-width",3),se.append("clipPath").attr("id",(a,c)=>`clip-${r}-${c}`).append("rect").attr("width",(a)=>Math.max(0,a.x1-a.x0-4)).attr("height",(a)=>Math.max(0,a.y1-a.y0-4)),se.append("text").attr("class","treemapLabel").attr("x",(a)=>(a.x1-a.x0)/2).attr("y",(a)=>(a.y1-a.y0)/2).attr("style",(a)=>{let c=`text-anchor: middle; dominant-baseline: middle; font-size: ${He}px;fill:`+D(a.data.name)+";",y=Q({cssCompiledStyles:a.data.cssCompiledStyles});return c+y.labelStyles.replace("color:","fill:")}).attr("clip-path",(a,c)=>`url(#clip-${r}-${c})`).text((a)=>a.data.name).each(function(a){let c=h(this),y=a.x1-a.x0,A=a.y1-a.y0,k=c.node(),N=y-2*pe,R=A-2*pe;if(N<_e||R<_e){c.style("display","none");return}let x=parseInt(c.style("font-size"),10),W=0.6;while(k.getComputedTextLength()>N&&x>Z)x--,c.style("font-size",`${x}px`);let M=Math.max(U,Math.min(oe,Math.round(x*W))),_=x+de+M;while(_>R&&x>Z){if(x--,M=Math.max(U,Math.min(oe,Math.round(x*W))),M<U&&x===Z)break;if(c.style("font-size",`${x}px`),_=x+de+M,M<=U&&_>R);}if(c.style("font-size",`${x}px`),V){if(x<Z||R<Z)c.style("display","none")}else if(k.getComputedTextLength()>N||x<Z||R<x)c.style("display","none")}),p.showValues!==!1)se.append("text").attr("class","treemapValue").attr("x",(c)=>(c.x1-c.x0)/2).attr("y",function(c){return(c.y1-c.y0)/2}).attr("style",(c)=>{let y=`text-anchor: middle; dominant-baseline: hanging; font-size: ${oe}px;fill:`+D(c.data.name)+";",A=Q({cssCompiledStyles:c.data.cssCompiledStyles});return y+A.labelStyles.replace("color:","fill:")}).attr("clip-path",(c,y)=>`url(#clip-${r}-${y})`).text((c)=>c.value?g(c.value):"").each(function(c){let y=h(this),A=this.parentNode;if(!A){y.style("display","none");return}let k=h(A).select(".treemapLabel");if(k.empty()||k.style("display")==="none"){y.style("display","none");return}let N=parseFloat(k.style("font-size")),x=Math.max(U,Math.min(oe,Math.round(N*0.6)));y.style("font-size",`${x}px`);let M=(c.y1-c.y0)/2+N/2+de;y.attr("y",M);let _=c.x1-c.x0,ze=c.y1-c.y0-4,qe=_-2*pe;if(y.node().getComputedTextLength()>qe||M+x>ze||x<U)y.style("display","none");else y.style("display",null)});let Ie=p.diagramPadding??8;bt(L,Ie,"flowchart",p?.useMaxWidth||!1)},"draw"),nt=t(function(e,r){return r.db.getClasses()},"getClasses"),lt={draw:rt,getClasses:nt},ot={sectionStrokeColor:"black",sectionStrokeWidth:"1",sectionFillColor:"#efefef",leafStrokeColor:"black",leafStrokeWidth:"1",leafFillColor:"#efefef",labelFontSize:"12px",valueFontSize:"10px",titleFontSize:"14px"},st=t(({treemap:e}={})=>{let r=Wt(),n=C(),o=ie(r,n.themeVariables),s=ie(ot,e),p=s.titleColor??o.titleColor,u=s.labelColor??o.textColor,f=s.valueColor??o.textColor;return`
2
- .treemapNode.section {
3
- stroke: ${s.sectionStrokeColor};
4
- stroke-width: ${s.sectionStrokeWidth};
5
- fill: ${s.sectionFillColor};
6
- }
7
- .treemapNode.leaf {
8
- stroke: ${s.leafStrokeColor};
9
- stroke-width: ${s.leafStrokeWidth};
10
- fill: ${s.leafFillColor};
11
- }
12
- .treemapLabel {
13
- fill: ${u};
14
- font-size: ${s.labelFontSize};
15
- }
16
- .treemapValue {
17
- fill: ${f};
18
- font-size: ${s.valueFontSize};
19
- }
20
- .treemapTitle {
21
- fill: ${p};
22
- font-size: ${s.titleFontSize};
23
- }
24
- `},"getStyles"),it=st,da={parser:Re,get db(){return new Be},renderer:lt,styles:it};export{da as diagram};
@@ -1 +0,0 @@
1
- import{sg}from"./index-dxnkwf39.js";export{sg as createEventModelingServices};
@@ -1 +0,0 @@
1
- import"./index-aa3hmn6j.js";import"./index-30a8py59.js";import{k0}from"./index-hcmhdpp4.js";export{k0 as diagram};
@@ -1 +0,0 @@
1
- import{tg}from"./index-dxnkwf39.js";export{tg as createGitGraphServices};
@@ -1 +0,0 @@
1
- import{Bg}from"./index-qxzj780x.js";import"./index-34aq5bz5.js";import"./index-abrrqhne.js";import"./index-2bsnywea.js";import"./index-pzsp1src.js";export{Bg as default};
@@ -1 +0,0 @@
1
- import{zn}from"./index-zcgqacvx.js";import"./index-2bsnywea.js";import"./index-hkz2mz34.js";export{zn as default};
@@ -1 +0,0 @@
1
- import{n,o,K,i,a,Ge,Fe,Be,oe,e,s,m,_,B,Ve,di,Xn,b,tr,Ue,xe,S,Je,gi,de,Z,dt,Qo,Fo,Xh,p0,vf,jo,Ei,Ff,Yg}from"./index-9a78xmkk.js";import"./index-3en15m75.js";import{_i}from"./index-xr4hjv01.js";import"./index-5mpv57fn.js";import{nA,du,Ds,pu,mu,fu,gu,Au,hu,bu,yu,vu}from"./index-0e51wknc.js";var vt={name:"panel-right-close",size:24,node:[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m8 9 3 3-3 3",key:"12hl5m"}]]},ge=s(vt);var L=new Set,ae=new Set,ve=new Set;function he(){ve=new Set(L);for(let t of[...ae])t()}function ye(t){let r=new Set(t);if(r.size===L.size){let l=!0;for(let d of r)if(!L.has(d)){l=!1;break}if(l)return}L.clear();for(let l of r)L.add(l);he()}function Ce(t){let r=new Set(t),l=!1;for(let d of[...L])if(!r.has(d))L.delete(d),l=!0;if(l)he()}function Se(t){return L.has(t)}function ke(){return L.size>0}function ht(t){return ae.add(t),()=>{ae.delete(t)}}var yt=ht;function we(){return Ge(yt,()=>ve)}function Ee({x:t,y:r,rows:l,onAction:d,onClose:u}){let y=i(null),[c,p]=n({left:t,top:r});return K(()=>{let g=y.current;if(!g)return;let{width:k,height:v}=g.getBoundingClientRect();p({left:Math.min(t,Math.max(0,window.innerWidth-k-8)),top:Math.min(r,Math.max(0,window.innerHeight-v-8))})},[t,r,l.length]),oe(e("div",{className:"fixed inset-0 z-[70]",onClick:u,onContextMenu:(g)=>{g.preventDefault(),u()},children:e("div",{ref:y,role:"menu","aria-label":"Tab actions",className:"glass-popover absolute w-52 bg-paper border border-ink/15 rounded-md shadow-xl py-1 text-xs text-ink",style:{left:`${c.left}px`,top:`${c.top}px`},onClick:(g)=>g.stopPropagation(),children:l.map((g)=>e("button",{type:"button",role:"menuitem",onClick:()=>{d(g.action),u()},className:"w-full text-left px-3 py-1.5 hover:bg-ink/5 transition-colors cursor-pointer",children:g.label},g.action))})}),document.body)}var ee={rightFileId:null,fraction:0.5};function ne(t,r,l){if(t===null)return!1;if(t===r)return!1;return l.includes(t)}function Te(t,r){for(let l=r.length-1;l>=0;l-=1){let d=r[l];if(d!==t)return d}return null}function Ne(t,r){if(t.rightFileId===null)return t;if(t.rightFileId!==r)return t;return{...t,rightFileId:null}}function J(t){if(!Number.isFinite(t))return ee.fraction;return Math.max(0.2,Math.min(0.8,t))}function Me(t,r){if(typeof t!=="object"||t===null)return ee;let l=t,d=typeof l.fraction==="number"?J(l.fraction):ee.fraction,u=typeof l.rightFileId==="string"||typeof l.rightFileId==="number"?l.rightFileId:null;if(u===null||!r.includes(u))return{rightFileId:null,fraction:d};return{rightFileId:u,fraction:d}}function Pe({tab:t,openedFiles:r,dirtyIds:l,reopenable:d,activeFileId:u,splitRightFileId:y}){let c=r.filter((v)=>v.id!==t.id),p=r.filter((v)=>!l.has(v.id)),g=r.map((v)=>v.id);return[{action:"split-right",label:"Split right",enabled:ne(t.id,u,g)},{action:"unsplit",label:"Unsplit",enabled:y!==null},{action:"close",label:"Close",enabled:!0},{action:"close-others",label:"Close others",enabled:c.length>0},{action:"close-all",label:"Close all",enabled:r.length>0},{action:"close-saved",label:"Close saved",enabled:p.some((v)=>v.id!==t.id)},{action:"copy-path",label:"Copy path",enabled:Boolean(t.path)},{action:"reveal-in-files",label:"Reveal in Files",enabled:Boolean(t.path)&&!t.isDiff},{action:"reopen-closed",label:"Reopen closed tab",enabled:d>0}].filter((v)=>v.enabled)}function Y({onHide:t}){let r=jo("toggleEditorPanel","Hide Editor Panel");return e("button",{type:"button",onClick:t,className:"p-1.5 mx-1 rounded transition-colors cursor-pointer text-ink/60 hover:bg-ink/10 hover:text-ink flex-shrink-0",title:r,"aria-label":r,children:e(ge,{size:14})})}function Re({openedFiles:t,activeFileId:r,onSelectFile:l,onCloseFile:d,missingIds:u,onCopyPath:y,onRevealInFiles:c,onReopenClosed:p,reopenableCount:g,onSplitTo:k,onUnsplit:v,splitRightFileId:x=null,onHide:D}){let N=we(),M=i(null),A=i(null),[P,R]=n(5),[O,I]=n(!1),[f,Q]=n(null);de(A,()=>I(!1)),o(()=>{let h=new ResizeObserver((E)=>{for(let w of E){let G=w.contentRect.width,z=Math.max(1,Math.floor((G-60)/150));R(z)}});if(M.current)h.observe(M.current);return()=>h.disconnect()},[]);let H=Te(r,t.map((h)=>h.id)),j=[],U=[];if(t.length<=P)j=t;else{let h=t.findIndex((w)=>w.id===r),E=new Set;if(h!==-1&&r!==null)E.add(r);for(let w=t.length-1;w>=0;w--){if(E.size>=P)break;E.add(t[w].id)}j=t.filter((w)=>E.has(w.id)),U=t.filter((w)=>!E.has(w.id))}return e("div",{className:`${gi.desktop} flex bg-ink/10 w-full relative border-b border-ink/10`,ref:M,children:[e("div",{className:"flex overflow-hidden",children:j.map((h)=>{let E=h.id===r,w=Boolean(h.isDiff),G=w?tr(h.diffStatus||"M",h.diffStaged):null,z=Boolean(u?.has(h.id));return e("div",{onClick:()=>l(h.id),onContextMenu:(q)=>{q.preventDefault(),Q({tab:h,x:q.clientX,y:q.clientY})},className:`flex items-center space-x-1.5 px-3 py-1.5 cursor-pointer border-r border-ink/10 min-w-[120px] max-w-[210px] group ${E?"bg-paper border-t-2 border-t-ink text-ink":"bg-transparent border-t-2 border-t-transparent text-ink/60 hover:bg-paper/50"}`,title:z?`${h.path} — file no longer exists`:h.path,children:[w?e(di,{size:14,className:E?"text-info flex-shrink-0":"text-info/70 flex-shrink-0"}):e(dt,{name:h.name,size:14,className:`flex-shrink-0${E||z?"":" opacity-60"}${z?" text-error":""}`}),e("span",{className:`text-xs font-mono truncate flex-1${z?" text-error line-through":""}`,children:h.name}),G&&e("span",{className:`px-1 text-[10px] font-mono font-bold rounded ${G.badgeBgClass}`,children:G.charStatus}),e(De,{dirty:N.has(h.id),active:E,label:`Close ${h.name}`,onClose:()=>d(h.id)})]},h.id)})}),f?e(Ee,{x:f.x,y:f.y,rows:Pe({tab:f.tab,openedFiles:t,dirtyIds:N,reopenable:g?.()??0,activeFileId:r,splitRightFileId:x}),onAction:(h)=>{let E=f.tab;switch(h){case"close":d(E.id);return;case"close-others":for(let w of[...t].reverse())if(w.id!==E.id)d(w.id);l(E.id);return;case"close-all":for(let w of[...t].reverse())d(w.id);return;case"close-saved":for(let w of[...t].reverse())if(!N.has(w.id))d(w.id);return;case"copy-path":y?.(E);return;case"reveal-in-files":c?.(E);return;case"reopen-closed":p?.();return;case"split-right":k?.(E.id);return;case"unsplit":v?.();return}},onClose:()=>Q(null)}):null,e("div",{className:"ml-auto flex items-center",children:[e("button",{type:"button",onClick:()=>x!==null?v?.():k?.(H),disabled:x===null&&H===null,"aria-pressed":x!==null,"aria-label":"Split editor",title:x!==null?"Close the split pane (the tab stays open)":H===null?"Open another file to split the editor":"Split the editor and show the newest other file",className:`p-1.5 mx-1 rounded transition-colors cursor-pointer disabled:opacity-30 disabled:cursor-default ${x!==null?"bg-ink/10 text-ink":"text-ink/60 hover:bg-ink/10"}`,children:e(Xn,{size:14})}),D&&e(Y,{onHide:D})]}),U.length>0&&e("div",{className:"relative flex items-center bg-ink/10",ref:A,children:[e("button",{className:`p-1.5 mx-1 rounded hover:bg-ink/10 text-ink/60 ${O?"bg-ink/10 text-ink":""}`,onClick:()=>I(!O),title:"More open files",children:e(B,{size:14})}),O&&e("div",{className:"glass-popover absolute right-0 top-full mt-1 w-52 bg-paper border border-ink/10 rounded shadow-lg z-50 py-1",children:[e("div",{className:"px-3 py-1 text-[10px] uppercase font-mono text-ink/40 border-b border-ink/10 mb-1",children:"Older Tabs"}),U.map((h)=>{let E=Boolean(u?.has(h.id));return e("div",{onClick:()=>{l(h.id),I(!1)},className:"flex items-center space-x-2 px-3 py-1.5 hover:bg-ink/5 cursor-pointer group",children:[h.isDiff?e(di,{size:14,className:"text-info/80"}):e(dt,{name:h.name,size:14,className:E?"text-error":"opacity-60"}),e("span",{className:`text-xs font-mono truncate flex-1 ${E?"text-error line-through":"text-ink/80"}`,children:h.name}),e(De,{dirty:N.has(h.id),active:!1,label:`Close ${h.name}`,onClose:()=>{if(d(h.id),U.length===1)I(!1)}})]},h.id)})]})]})]})}function De({dirty:t,active:r,label:l,onClose:d}){return e("div",{role:"button",tabIndex:-1,"aria-label":l,title:t?`${l} — unsaved changes`:l,className:`p-0.5 rounded hover:bg-ink/10 touch-visible ${r||t?"opacity-100":"opacity-0 group-hover:opacity-100"}`,onClick:(u)=>{u.stopPropagation(),d()},children:t?e("span",{className:"block w-2 h-2 rounded-full bg-current mx-0.5","data-tab-dirty":"","aria-hidden":"true"}):e(b,{size:12})})}function Oe({pluginId:t,Component:r,sessionId:l,className:d="",onHide:u}){return e("div",{className:`flex flex-col h-full bg-canvas ${d}`,children:[u&&e("div",{className:"flex justify-end flex-shrink-0 border-b border-ink/10",children:e(Y,{onHide:u})}),e(Je,{pluginId:t,children:e(r,{sessionId:l,workspacePath:null})})]})}function Ie({className:t="",onHide:r}){return e("div",{className:`relative flex flex-col h-full bg-canvas items-center justify-center text-muted ${t}`,children:[r&&e("div",{className:"absolute top-0 right-0 flex items-center",children:e(Y,{onHide:r})}),e(dt,{name:"placeholder.txt",size:48,className:"mb-4 opacity-20"}),e("p",{className:"font-mono text-sm",children:"Select a file to open"})]})}function Ae({searchReveal:t,revealMatch:r}){let l=i(r);l.current=r;let d=i(null);o(()=>{if(!t||d.current===t.request)return;d.current=t.request,l.current({query:t.request.query,options:t.request.options,line:t.request.line})},[t])}function Le({openedFiles:t,dirtyKeys:r,activeFile:l,previewReady:d,setPreviewMode:u,sessionId:y}){o(()=>{let c=new Set(t.filter((p)=>!p.isDiff&&p.content===void 0).map((p)=>p.id));ye([...r].filter((p)=>c.has(p)))},[r,t]),o(()=>{if(!d)return;let c=l?.id;if(!l||c===void 0||c===null)return;if(!du(Ds(l.name)))return;let p=xe(y,"editor.previewMode");if(p&&p[c]!==void 0)return;u((g)=>g[c]===void 0?{...g,[c]:!0}:g)},[d,l])}function Ke({activeFile:t,externalChange:r,conflict:l,onReload:d,onKeepMine:u}){if(!t)return null;if(l)return e(bu,{diskMtimeMs:l.diskMtimeMs,fileName:t.name,onReload:d,onKeepMine:u});if(r)return e(hu,{fileName:t.name,onReload:d,onKeepMine:u});return null}async function ze(t){let r=t.name.trim();if(!r)return{status:"failed",reason:"Enter a file name."};let l=new FormData;if(l.append("actionType","saveAs"),l.append("path",t.parent),l.append("name",r),l.append("content",t.content),l.append("eol",t.eol),t.root)l.append("root",t.root);if(t.repo&&t.repo!==".")l.append("repo",t.repo);try{let d=await fetch("/api/fs/action",{method:"POST",body:l}),u=await d.json().catch(()=>null),y=typeof u?.error==="string"?u.error:null;if(d.status===409)return{status:"exists",reason:y??`${r} already exists.`};if(d.ok&&u?.success&&typeof u.path==="string")return{status:"written",path:u.path};return{status:"failed",reason:y??"The file could not be written."}}catch{return{status:"failed",reason:"The file could not be written."}}}function He(t){let r=t.lastIndexOf(".");if(r<=0)return`${t} copy`;return`${t.slice(0,r)} copy${t.slice(r)}`}function $e(t){let r=t.trim();if(!r)return!1;if(r==="."||r==="..")return!1;return!r.includes("/")&&!r.includes("\\")}function xt(t){let r=t.lastIndexOf("/");return r===-1?"":t.slice(0,r)}function qe({fileName:t,filePath:r,content:l,eol:d,root:u,repo:y,onSaved:c,onClose:p}){let[g,k]=n(()=>xt(r)),[v,x]=n(()=>He(t)),[D,N]=n(!1),[M,A]=n(null),P=i(null);o(()=>{P.current?.focus(),P.current?.select()},[]);let R=$e(v),O=async()=>{if(!R||D)return;N(!0),A(null);let f=await ze({parent:g,name:v,content:l,eol:d,root:u,repo:y});if(N(!1),f.status==="written"){c({path:f.path});return}A(f.reason)},I=(f)=>{if(f.key==="Enter"){f.preventDefault(),O();return}if(f.key==="Escape")f.preventDefault(),p()};return e(Z,{onClose:p,maxWidthClass:"max-w-md",header:e("span",{className:"text-sm font-semibold text-ink",children:"Save as"}),footer:e("div",{className:"flex items-center justify-end gap-2 px-4 py-3 border-t border-ink/10",children:[e("button",{type:"button",onClick:p,className:"px-3 py-1.5 rounded border border-ink/20 text-ink/80 hover:bg-ink/5 transition-colors cursor-pointer",children:"Cancel"}),e("button",{type:"button",onClick:()=>void O(),disabled:!R||D,className:"flex items-center gap-1.5 px-3 py-1.5 rounded bg-ink text-paper disabled:opacity-40 disabled:cursor-default cursor-pointer",children:[D?e(m,{size:12,className:"animate-spin"}):e(Ve,{size:12}),"Save"]})]}),children:e("div",{className:"px-4 py-3 space-y-2 text-xs",children:[e("label",{className:"block",children:[e("span",{className:"block text-[10px] uppercase tracking-wide text-ink/50 mb-1",children:"Folder"}),e("input",{value:g,onInput:(f)=>k(f.target.value),onKeyDown:I,placeholder:"(workspace root)","aria-label":"Destination folder",className:"w-full bg-paper border border-ink/20 rounded px-2 py-1 font-mono text-ink outline-none focus:border-ink/40"})]}),e("label",{className:"block",children:[e("span",{className:"block text-[10px] uppercase tracking-wide text-ink/50 mb-1",children:"Name"}),e("input",{ref:P,value:v,onInput:(f)=>x(f.target.value),onKeyDown:I,"aria-label":"File name","aria-invalid":!R,className:`w-full bg-paper border rounded px-2 py-1 font-mono text-ink outline-none ${R?"border-ink/20 focus:border-ink/40":"border-error text-error"}`})]}),!R?e("div",{className:"text-[10px] text-error font-mono",children:"Enter a file name without a path separator"}):null,M?e("div",{className:"text-[10px] text-error font-mono",children:M}):null,e("div",{className:"text-[10px] text-ink/40",children:"The original file stays where it is, and its tab stays open."})]})})}function _e(){o(()=>{let t=(r)=>{if(!ke())return;r.preventDefault(),r.returnValue=""};return window.addEventListener("beforeunload",t),()=>window.removeEventListener("beforeunload",t)},[])}function We({fileName:t,onAnswer:r}){return e(Z,{onClose:()=>r("cancel"),header:e("div",{className:"flex items-center gap-2",children:[e(_,{size:15,className:"text-warning"}),e("span",{className:"text-sm font-semibold text-ink",children:"Unsaved changes"})]}),footer:e("div",{className:"flex items-center justify-end gap-2 px-4 py-3 border-t border-ink/10",children:[e("button",{type:"button",onClick:()=>r("cancel"),className:"px-3 py-1.5 rounded border border-ink/20 text-ink/80 hover:bg-ink/5 transition-colors cursor-pointer",children:"Cancel"}),e("button",{type:"button",onClick:()=>r("discard"),className:"px-3 py-1.5 rounded border border-error/40 text-error hover:bg-error/10 transition-colors cursor-pointer",children:"Discard"}),e("button",{type:"button",onClick:()=>r("save"),className:"px-3 py-1.5 rounded bg-ink text-paper hover:bg-ink/90 transition-colors cursor-pointer",children:"Save & close"})]}),children:e("div",{className:"px-4 py-3 text-xs text-ink/80",children:[e("span",{className:"font-mono text-ink",children:t})," has changes that are not on disk.",e("div",{className:"mt-1 text-ink/50",children:"Discarding them cannot be undone."})]})})}function Xe({closeGuard:t,activeFile:r,saveMissingConfirm:l,onCancelSaveMissing:d,onConfirmSaveMissing:u}){if(t.pending)return e(We,{fileName:t.pending.name,onAnswer:t.answer});if(l&&r)return e(yu,{fileName:r.name,filePath:r.path,onClose:d,onConfirm:u});return null}function Ye({className:t="",isMaximized:r,onKeyDownCapture:l,onFocusCapture:d,asSplitPane:u,tabs:y,activeFile:c,editor:p,externalChange:g,conflict:k,onReload:v,onKeepMine:x,body:D,saveAsOpen:N,onSaveAsClose:M,onSavedAs:A,closeGuard:P}){let R=r?"fixed inset-0 z-50 flex flex-col bg-canvas":`flex flex-col h-full bg-canvas ${t}`;return e("div",{className:R,onKeyDownCapture:l,onFocusCapture:d,children:[u?null:y,e(Ke,{activeFile:c,externalChange:g,conflict:k,onReload:v,onKeepMine:x}),D,N&&c?e(qe,{fileName:c.name,filePath:c.path,content:p.content,eol:p.eol,root:c.root,repo:c.repo,onSaved:({path:O})=>A(O),onClose:M}):null,e(Xe,{closeGuard:P,activeFile:c,saveMissingConfirm:p.saveMissingConfirm,onCancelSaveMissing:p.cancelSaveMissing,onConfirmSaveMissing:p.confirmSaveMissing})]})}function Ze({fileName:t,onClose:r,children:l}){return e("div",{className:"flex flex-col h-full min-w-0","data-split-pane":"",children:[e("div",{className:"flex items-center justify-between gap-2 px-3 py-1 border-b border-ink/10 bg-canvas flex-shrink-0",children:[e("span",{className:"text-[11px] font-mono text-ink/60 truncate",title:t,children:t}),e("button",{type:"button",onClick:r,className:"p-0.5 rounded hover:bg-ink/10 text-ink/50 hover:text-ink transition-colors cursor-pointer flex-shrink-0",title:"Close this pane (the tab stays open)","aria-label":"Close split pane",children:e(b,{size:12})})]}),e("div",{className:"flex-1 min-h-0",children:l})]})}function Qe({fraction:t,onFraction:r,rightPaneName:l,onClosePane:d,rightPane:u,children:y}){let c=i(null),p=i(null),g=vf(p),k=(v)=>{let x=v.currentTarget,D=c.current;if(!x||!D)return;x.setPointerCapture(v.pointerId);let N=(A)=>{let P=D.getBoundingClientRect();if(P.width===0)return;r(J((A.clientX-P.left)/P.width))},M=()=>{x.releasePointerCapture(v.pointerId),x.removeEventListener("pointermove",N),x.removeEventListener("pointerup",M)};x.addEventListener("pointermove",N),x.addEventListener("pointerup",M)};return e("div",{ref:c,className:"flex w-full h-full","data-split-column":"",children:[e("div",{className:"flex flex-col min-w-0 h-full",style:{width:`${Math.round(J(t)*100)}%`},children:y}),e("div",{ref:p,className:`w-[3px] flex-shrink-0 cursor-col-resize transition-colors active:bg-ink/40 ${g?"bg-ink/40":"bg-ink/10"}`,role:"separator","aria-orientation":"vertical","aria-label":"Resize split panes",onPointerDown:k}),e("div",{className:"flex-1 min-w-0 h-full",children:e(Ze,{fileName:l,onClose:d,children:u})})]})}function je({openedFiles:t,activeFileId:r,enabled:l}){let[d,u]=S("editor.split",ee),y=t.map((x)=>x.id),c=Ne(Me(d,y),r),p=l&&c.rightFileId!==null?t.find((x)=>x.id===c.rightFileId)??null:null,g=a((x)=>{if(x!==null&&!ne(x,r,y))return;u({...c,rightFileId:x})},[c,u,r,y]),k=a(()=>u({...c,rightFileId:null}),[c,u]),v=a((x)=>u({...c,fraction:J(x)}),[c,u]);return{rightFile:p,fraction:c.fraction,splitTo:g,close:k,setFraction:v}}function et({find:t,runCommand:r,reopenClosed:l}){let d=i(t);d.current=t;let u=i(r);u.current=r;let y=i(l);return y.current=l,{onKeyDownCapture:a((p)=>{let g=d.current;if(p.key==="Escape"){if(!g.open)return;p.preventDefault(),p.stopPropagation(),g.close();return}if((p.metaKey||p.ctrlKey)&&p.shiftKey&&p.code==="KeyT"){if(y.current?.())p.preventDefault(),p.stopPropagation();return}let k=Xh(Ei,p);if(!k||!Ff(k))return;p.preventDefault(),p.stopPropagation(),u.current(k)},[])}}function tt(t){let r=i(t);r.current=t;let l=i(null);if(!l.current)l.current={saveNow:()=>r.current.saveNow(),runCommand:(u)=>r.current.runCommand(u)};return o(()=>{let u=l.current;if(!u)return;return Yg(u)},[]),{onFocusCapture:a(()=>{if(l.current)Yg(l.current)},[])}}function nt({openedFiles:t,activeFileId:r,onSelectFile:l,onCloseFile:d,saveNow:u}){let[y,c]=n(null);_e();let p=a((k)=>{let v=t.find((x)=>x.id===k);if(v&&Se(k)){c(v);return}d(k)},[t,d]),g=a((k)=>{let v=y;if(!v)return;if(k==="cancel"){c(null);return}if(k==="save"){if(v.id!==r)l(v.id);u()}c(null),d(v.id)},[y,r,l,u,d]);return{requestClose:p,pending:y,answer:g}}function ot(){let[t,r]=n(0),[l,d]=n(!1),u=a(()=>r((y)=>y+1),[]);return{goToLineRequest:t,openGoToLine:u,saveAsOpen:l,setSaveAsOpen:d}}var Ct=Be(()=>import("./Body-3tspyjtk.js").then((t)=>({default:t.EditorBody})));function rt(t){return e(Fe,{fallback:e("div",{className:"h-full w-full"}),children:e(Ct,{...t})})}function St({className:t="",openedFiles:r,activeFileId:l,onSelectFile:d,onCloseFile:u,onConvertDiffToEditor:y,refreshKey:c=0,onFileSaved:p,onOpenPath:g,onReopenClosed:k,reopenableCount:v,onCopyPath:x,onRevealInFiles:D,rootPath:N=null,repoPath:M=null,activeEditorPanelKey:A=null,forcedActiveFileId:P=null,asSplitPane:R=!1,onHidePanel:O}){let I=R?P:l,f=r.find((C)=>C.id===I),[Q,H,j]=S("editor.previewMode",{}),U=vu(String(I??"")),[h,E]=S("editor.zoomLevel",Qo),[w,G]=n(!1),[z,q]=S("editor.wordWrap",!0),X=ot(),{sessionId:le}=Ue(),F=je({openedFiles:r,activeFileId:I,enabled:!R}),W=i(null),it=Fo(),st=_i(),ue=pu(r,c),pe=Boolean(f&&ue.has(f.id)),T=mu(f??null,{reportSaveError:!0,onFileSaved:p,missing:pe}),at=nA({path:f?.path??"",content:T.content,language:T.language}),lt=T.diskChange,ce=nt({openedFiles:r,activeFileId:I,onSelectFile:d,onCloseFile:u,saveNow:T.saveNow}),te=fu({text:T.content,documentKey:`${f?.id??""}\x00${T.language}`,readSelection:()=>W.current?.getSelection()??null,select:(C,V,se=!0)=>W.current?.select(C,V,se),reveal:(C)=>W.current?.revealOffset(C),applyDocument:(C,V,se)=>W.current?.applyDocument(C,V,se),toggleWordWrap:()=>q((C)=>!C)}),me=gu(f?.path??null,T.content,T.loaded&&!T.loadError);Ae({searchReveal:me,revealMatch:te.revealMatch}),Au({file:f,editor:T,surfaceRef:W,isPreview:f?Q[f.id]===!0:!1,exitPreview:()=>{let C=f?.id;if(C===void 0||C===null)return;H((V)=>({...V,[C]:!1}))}}),o(()=>{if(c>0)T.reset()},[c]),o(()=>{T.retain(r.map((C)=>C.id)),Ce(r.map((C)=>C.id))},[r]),Le({openedFiles:r,dirtyKeys:T.dirtyKeys,activeFile:f,previewReady:j,setPreviewMode:H,sessionId:le});let ut=()=>{if(!f)return;H((C)=>({...C,[f.id]:!C[f.id]}))},re=(C)=>{if(Ff(C)){te.runCommand(C);return}if(C==="toggleWordWrap"){q((V)=>!V);return}if(C==="goToLine"){X.openGoToLine();return}W.current?.runCommand(C)},pt=et({find:te,runCommand:re,reopenClosed:k}),ct=tt({saveNow:T.saveNow,runCommand:re}),ie=p0(A);if(ie)return e(Oe,{pluginId:ie.pluginId,Component:ie.Component,sessionId:le,className:t,onHide:O});if(r.length===0)return e(Ie,{className:t,onHide:O});let mt=T.viewerKind,fe=f?Q[f.id]:!1,ft={activeFile:f,editor:T,find:te,surfaceRef:W,pluginFileView:at,wordWrap:z,setWordWrap:q,viewerKind:mt,isPreview:Boolean(fe),isReviewing:Boolean(fe)&&U.active,onToggleReview:U.toggle,isMaximized:w,setIsMaximized:G,zoomLevel:h,setZoomLevel:E,goToLineRequest:X.goToLineRequest,onSaveAs:()=>X.setSaveAsOpen(!0),onOpenPath:g,rootPath:N,repoPath:M,runCommand:re,editorFontFamily:it,editorTheme:st,togglePreview:ut,revealActive:Boolean(me),missing:pe,onConvertDiffToEditor:y,onFileSaved:p},bt=(C)=>({openedFiles:r,activeFileId:l,onSelectFile:d,onCloseFile:u,onConvertDiffToEditor:y,refreshKey:c,onFileSaved:p,onOpenPath:g,rootPath:N,repoPath:M,forcedActiveFileId:C,asSplitPane:!0}),gt=e(Re,{openedFiles:r,activeFileId:l,onSelectFile:d,onCloseFile:ce.requestClose,missingIds:ue,onCopyPath:x,onRevealInFiles:D,onReopenClosed:k,reopenableCount:v,onSplitTo:F.splitTo,onUnsplit:F.close,splitRightFileId:F.rightFile?.id??null,onHide:O}),be=e(Ye,{className:t,isMaximized:w,onKeyDownCapture:pt.onKeyDownCapture,onFocusCapture:ct.onFocusCapture,asSplitPane:R,tabs:gt,activeFile:f,editor:T,externalChange:lt,conflict:T.conflict,onReload:T.resolveConflictByReload,onKeepMine:T.keepMineAgainstDisk,body:e(rt,{...ft}),saveAsOpen:X.saveAsOpen,onSaveAsClose:()=>X.setSaveAsOpen(!1),onSavedAs:(C)=>{X.setSaveAsOpen(!1),g?.(C)},closeGuard:ce});if(!F.rightFile)return be;return e(Qe,{fraction:F.fraction,onFraction:F.setFraction,rightPaneName:F.rightFile.name,onClosePane:F.close,rightPane:e(St,{...bt(F.rightFile.id)}),children:be})}export{St as Editor};
@@ -1,2 +0,0 @@
1
- import{d,n,o,a,e,s,E,D,Ne,ft}from"./index-9a78xmkk.js";var G={name:"ticket",size:24,node:[["path",{d:"M2 9a3 3 0 0 1 0 6v2a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-2a3 3 0 0 1 0-6V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z",key:"qn84l0"}],["path",{d:"M13 5v2",key:"dyzc3o"}],["path",{d:"M13 17v2",key:"1ont0d"}],["path",{d:"M13 11v2",key:"1wjjxi"}]]},U=s(G);function T({providerName:t,providerSlug:r,iconUrl:i,credentialSources:l,error:p,note:c,children:m}){return e("section",{className:"bg-paper border border-ink/15 rounded-lg shadow-xs",children:[e("header",{className:"flex items-center justify-between gap-2 px-3.5 py-2.5 border-b border-ink/10",children:[e("span",{className:"flex min-w-0 items-center gap-2",children:[r&&e(ft,{provider:{slug:r,name:t,...i?{iconUrl:i}:{}},size:20}),e("span",{className:"truncate text-xs font-semibold text-ink",children:t})]}),e("span",{className:"text-[10px] font-mono uppercase tracking-wider text-ink/50 truncate",title:`Credentials from ${l.join(", ")}`,children:l.join(" · ")})]}),e("div",{className:"p-3.5 space-y-4",children:[p&&e("p",{className:"flex items-start gap-2 text-error text-xs leading-relaxed",children:[e(E,{size:14,className:"shrink-0 mt-0.5"}),e("span",{className:"break-words",children:p})]}),m,c&&e("p",{className:"text-[10px] text-ink/50 leading-relaxed border-t border-ink/10 pt-2.5",children:c})]})]})}var z=new Intl.NumberFormat("id-ID",{style:"currency",currency:"IDR",maximumFractionDigits:0}),V=new Intl.NumberFormat("id-ID"),R=new Intl.NumberFormat("id-ID",{minimumFractionDigits:2,maximumFractionDigits:2,useGrouping:!1}),X=new Intl.DateTimeFormat("id-ID",{dateStyle:"medium",timeStyle:"short"}),J=new Intl.DateTimeFormat("id-ID",{dateStyle:"medium"});function x(t){return z.format(t)}function b(t){return V.format(t)}function la(t){let r=new Date(t);if(Number.isNaN(r.getTime()))return t;return X.format(r)}function C(t){let r=new Date(t);if(Number.isNaN(r.getTime()))return t;return J.format(r)}function S(t,r){if(r<=0)return 0;return Math.min(100,Math.max(0,t/r*100))}function A(t,r){if(r<=0)return"0%";return`${new Intl.NumberFormat("id-ID",{maximumFractionDigits:1}).format(t/r*100)}%`}function v(t){if(!Number.isFinite(t))return"0";let r=Math.abs(t);if(r>=1e9)return`${R.format(t/1e9)}B`;if(r>=1e6)return`${R.format(t/1e6)}M`;if(r>=1000)return`${R.format(t/1000)}K`;return b(t)}function w(t){let r=Number(t);if(t.trim()===""||!Number.isFinite(r))return t;return b(r)}var Y=new Intl.NumberFormat("id-ID",{minimumFractionDigits:2,maximumFractionDigits:2});function F(t){if(!Number.isFinite(t))return"$0,00";return`$${Y.format(t)}`}function h(t,r){if(!Number.isFinite(t))return"—";let i=r.trim().toUpperCase();if(i==="IDR")return x(t);if(i==="USD")return F(t);if(!i)return"—";try{return new Intl.NumberFormat("id-ID",{style:"currency",currency:i}).format(t)}catch{return`${b(t)} ${i}`}}function y(t,r){if(!Number.isFinite(t))return"—";switch(r){case"percent":return`${new Intl.NumberFormat("id-ID",{maximumFractionDigits:1}).format(t)}%`;case"usd":return F(t);case"idr":return x(t);case"tokens":case"bytes":return v(t);default:return b(t)}}function I(t){if(!Number.isFinite(t))return"0%";return`${new Intl.NumberFormat("id-ID",{maximumFractionDigits:1}).format(t*100)}%`}function Z({window:t}){let r=t.usedRp+t.remainingRp,i=S(t.usedRp,r);return e("div",{className:"bg-paper border border-ink/15 rounded-lg p-3 shadow-xs space-y-2",children:[e("div",{className:"flex items-center justify-between gap-2",children:[e("span",{className:"text-[11px] font-semibold text-ink",children:t.label}),e("span",{className:"text-[10px] text-ink/50",children:["Resets ",la(t.resetsAt)]})]}),e("div",{className:"h-1.5 w-full bg-ink/10 rounded-full overflow-hidden",children:e("div",{className:"h-full bg-ink/80 rounded-full",style:{width:`${i}%`}})}),e("div",{className:"flex flex-wrap items-center justify-between gap-x-3 gap-y-0.5 text-[10px] text-ink/60",children:[e("span",{children:["Used ",e("span",{className:"font-semibold text-ink",children:x(t.usedRp)})," ·"," ",A(t.usedRp,r)]}),e("span",{children:["Remaining ",e("span",{className:"font-semibold text-ink",children:x(t.remainingRp)})]})]})]})}function ee({coupon:t}){return e("div",{className:"bg-ink/5 border border-ink/10 rounded-lg p-3 shadow-xs",children:[e("div",{className:"flex items-center gap-1.5 mb-1.5",children:[e(U,{size:12,className:"text-ink/60"}),e("span",{className:"text-[11px] font-semibold text-ink",children:["Active coupon · ",t.name]})]}),e("div",{className:"text-[10px] text-ink/60 space-y-0.5",children:[e("div",{children:["Remaining"," ",e("span",{className:"font-semibold text-ink",children:t.remainingRp===null?"Unlimited":x(t.remainingRp)})," ","· Used ",e("span",{className:"font-semibold text-ink",children:x(t.usedRp)})]}),e("div",{children:["Expires ",la(t.expiresAt)]}),t.scopeModels.length>0&&e("div",{children:["Models: ",t.scopeModels.join(", ")]})]})]})}function L({quota:t}){if(!t)return e("p",{className:"text-[11px] text-ink/50",children:"Quota data is not available for this account."});return e("div",{className:"space-y-2",children:[e("div",{className:"flex items-center justify-between gap-2",children:[e("h4",{className:"text-[10px] font-mono font-semibold uppercase tracking-wider text-ink/40",children:"Quota windows"}),t.planName&&e("span",{className:"text-[10px] text-ink/60",children:["Plan ",e("span",{className:"font-semibold text-ink",children:t.planName})]})]}),t.windows.length===0?e("p",{className:"text-[11px] text-ink/50",children:"No quota windows reported."}):e("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-2.5",children:t.windows.map((r)=>e(Z,{window:r},r.key))}),t.coupon&&e(ee,{coupon:t.coupon})]})}function B({usage:t}){if(!t)return e("p",{className:"text-[11px] text-ink/50",children:"The 30-day usage report is not available."});let r=t.rows.reduce((l,p)=>l+p.inputTokens,0),i=t.rows.reduce((l,p)=>l+p.outputTokens,0);return e("div",{className:"space-y-2",children:[e("h4",{className:"text-[10px] font-mono font-semibold uppercase tracking-wider text-ink/40",children:"30-day usage by model"}),e("div",{className:"overflow-x-auto border border-ink/15 rounded-lg shadow-xs",children:e("table",{className:"w-full text-[11px]",children:[e("thead",{className:"bg-ink/5 text-ink/60",children:e("tr",{children:[e("th",{className:"text-left font-semibold px-3 py-2 whitespace-nowrap",children:"Model"}),e("th",{className:"text-right font-semibold px-3 py-2 whitespace-nowrap",children:"Requests"}),e("th",{className:"text-right font-semibold px-3 py-2 whitespace-nowrap",children:"Input tokens"}),e("th",{className:"text-right font-semibold px-3 py-2 whitespace-nowrap",children:"Output tokens"}),e("th",{className:"text-right font-semibold px-3 py-2 whitespace-nowrap",children:"Cost"})]})}),e("tbody",{className:"divide-y divide-ink/10",children:t.rows.length===0?e("tr",{children:e("td",{colSpan:5,className:"px-3 py-3 text-center text-ink/50",children:"No usage recorded in the last 30 days."})}):t.rows.map((l)=>e("tr",{children:[e("td",{className:"px-3 py-1.5 font-mono text-ink whitespace-nowrap",children:l.model}),e("td",{className:"px-3 py-1.5 text-right tabular-nums text-ink/80",children:b(l.requests)}),e("td",{className:"px-3 py-1.5 text-right tabular-nums text-ink/80",children:v(l.inputTokens)}),e("td",{className:"px-3 py-1.5 text-right tabular-nums text-ink/80",children:v(l.outputTokens)}),e("td",{className:"px-3 py-1.5 text-right tabular-nums text-ink/80",children:x(l.costRp)})]},l.model))}),e("tfoot",{className:"bg-ink/5 border-t border-ink/15 font-semibold text-ink",children:e("tr",{children:[e("td",{className:"px-3 py-2",children:"Total"}),e("td",{className:"px-3 py-2 text-right tabular-nums",children:b(t.totalRequests)}),e("td",{className:"px-3 py-2 text-right tabular-nums",children:v(r)}),e("td",{className:"px-3 py-2 text-right tabular-nums",children:v(i)}),e("td",{className:"px-3 py-2 text-right tabular-nums",children:x(t.totalCostRp)})]})})]})})]})}function M({report:t}){let{balance:r,usage:i,quota:l}=t;if(!r&&!i&&!l)return e("p",{className:"text-[11px] text-ink/50",children:"No kenari data was returned for this account."});let p=r?r.amountRp!==null?x(r.amountRp):r.raw:"–",c=r?r.amountRp!==null?r.raw:"Amount could not be parsed":"Balance unavailable",m=i?i.rows.reduce((f,u)=>f+u.inputTokens+u.outputTokens,0):0;return e(d,{children:[e("div",{className:"@container",children:e("div",{className:"grid grid-cols-3 @[540px]:grid-cols-5 gap-2.5 items-stretch",children:[e(Ne,{value:p,label:"Wallet balance",hint:c}),e(Ne,{value:l?.planName??"–",label:"Active plan",hint:l?"kenari quota plan":"Quota unavailable"}),e(Ne,{value:i?b(i.totalRequests):"–",label:"Requests (30 days)",hint:i?"Across all models":"Usage report unavailable"}),e(Ne,{value:i?x(i.totalCostRp):"–",label:"Cost (30 days)",hint:i?"Billed in Rupiah":"Usage report unavailable"}),e(Ne,{value:i?v(m):"–",label:"Tokens processed (30 days)",hint:i?"Input + output":"Usage report unavailable",tone:"muted",className:"col-span-2 @[540px]:col-span-1"})]})}),e(L,{quota:l}),e(B,{usage:i})]})}function _({report:t}){let r=t.balance;if(!r)return e("p",{className:"text-[11px] text-ink/50",children:"DeepSeek balance data is not available."});return e(d,{children:[e("div",{className:"@container",children:e("div",{className:"grid grid-cols-3 @[540px]:grid-cols-5 gap-2.5 items-stretch",children:[e(Ne,{value:r.isAvailable?"Available":"Unavailable",label:"Prepaid balance",hint:r.isAvailable?"Account can spend":"Top up required",tone:r.isAvailable?"default":"muted"}),e(Ne,{value:b(r.entries.length),label:"Currency buckets",hint:r.entries.length>0?"From the balance endpoint":"No entries returned",tone:"muted"})]})}),r.entries.length===0?e("p",{className:"text-[11px] text-ink/50",children:"The balance endpoint returned no currency entries."}):e("div",{className:"grid grid-cols-1 gap-2.5",children:r.entries.map((i)=>e("div",{className:"bg-paper border border-ink/15 rounded-lg p-3 shadow-xs",children:[e("div",{className:"flex items-center justify-between gap-2 mb-2",children:[e("span",{className:"text-[11px] font-semibold text-ink",children:i.currency}),e("span",{className:"text-[10px] font-mono uppercase tracking-wider text-ink/40",children:"Balance"})]}),e("dl",{className:"grid grid-cols-3 gap-2 text-[10px]",children:[e("div",{children:[e("dt",{className:"text-ink/50",children:"Total"}),e("dd",{className:"font-semibold text-ink tabular-nums break-words",children:w(i.totalBalance)})]}),e("div",{children:[e("dt",{className:"text-ink/50",children:"Granted"}),e("dd",{className:"font-semibold text-ink tabular-nums break-words",children:w(i.grantedBalance)})]}),e("div",{children:[e("dt",{className:"text-ink/50",children:"Topped up"}),e("dd",{className:"font-semibold text-ink tabular-nums break-words",children:w(i.toppedUpBalance)})]})]})]},i.currency))})]})}function K({label:t,percent:r,spent:i,enabled:l=!0,children:p}){let c=l&&r!==null?Math.min(100,Math.max(0,r)):0,m=!l?"Off":i?"Spent":r!==null?`${r}% used`:"Not reported";return e("div",{className:"space-y-1.5",children:[e("div",{className:"flex items-baseline justify-between gap-2",children:[e("span",{className:"text-[11px] font-semibold text-ink",children:t}),e("span",{className:`text-[10px] ${i?"text-error":"text-ink/60"}`,children:m})]}),e("div",{className:"h-1.5 w-full bg-ink/10 rounded-full overflow-hidden",...l?{role:"progressbar","aria-label":t,"aria-valuemin":0,"aria-valuemax":100,...r!==null?{"aria-valuenow":c}:{}}:{},children:e("div",{className:`h-full rounded-full ${i?"bg-error/70":l?"bg-ink/80":"bg-ink/20"}`,style:{width:`${c}%`}})}),p]})}function O({report:t}){let r=t.allowance;if(!r)return e("p",{className:"text-[11px] text-ink/60",children:"Token Harbor returned no allowance for this key. Refresh to try again."});let{onPlan:i,activated:l,resetAt:p}=r,c=(m)=>m===null?"n/a":y(m,"percent");return e(d,{children:[e("div",{className:"@container",children:e("div",{className:"grid grid-cols-2 @[540px]:grid-cols-4 gap-2.5 items-stretch",children:[e(Ne,{value:r.planName??"No Pass",label:"Plan",hint:i?"Pass allowance applies":"Covered models bill your wallet"}),e(Ne,{value:i?c(r.planUsedPct):"n/a",label:"Pass week used",hint:i?r.planExhausted?"Spent for this window":"Of this 7-day window":"No Pass to draw on",tone:i?"default":"muted"}),e(Ne,{value:c(r.usedPct),label:"Free week used",hint:r.modelsEnabled?"Of this 7-day window":"Free models are off",tone:"muted"}),e(Ne,{value:l&&p?C(p):"Not started",label:"Resets",hint:l?"Pass and free share one window":"The window begins with your first request",tone:"muted"})]})}),e("div",{className:"space-y-3",children:[e("h4",{className:"text-[10px] font-mono font-semibold uppercase tracking-wider text-muted",children:"Allowance"}),i?e(K,{label:r.planName??"Pass allowance",percent:r.planUsedPct,spent:r.planExhausted,children:r.planExhausted&&e("p",{className:"text-[10px] text-ink/70 leading-relaxed",children:"Covered calls resume when the window resets. Until then they run only if Keep working after my Pass allowance runs out is on in Dashboard, Billing, which bills your wallet at the Pass discount."})}):e("p",{className:"text-[10px] text-ink/70 leading-relaxed",children:"This account holds no Pass, so there is no Pass allowance to draw. Covered models bill your wallet."}),e(K,{label:"Free allowance",percent:r.usedPct,spent:r.exhausted,enabled:r.modelsEnabled,children:r.modelsEnabled?r.freeModels.length>0&&e("p",{className:"text-[10px] text-ink/60 leading-relaxed break-words",children:["Free models now: ",r.freeModels.join(", ")]}):e("p",{className:"text-[10px] text-ink/70 leading-relaxed",children:"Free models are switched off for this account, so calls to them are refused whatever the percentage says. Turn them back on in the Token Harbor dashboard, under Data and privacy."})}),!l&&e("p",{className:"text-[10px] text-ink/60 leading-relaxed",children:"The 7-day window starts with this account's first request. Both allowances reset together."})]})]})}function W({report:t}){let r=t.balance;if(!r)return e("p",{className:"text-[11px] text-ink/60",children:"TokenPortal returned no balance for this key. Refresh to try again."});let i=r.limit!==null&&r.limitRemaining!==null?Math.max(0,r.limit-r.limitRemaining):null,l=r.limit!==null&&i!==null&&r.limit>0?Math.min(100,i/r.limit*100):null;return e(d,{children:[e("div",{className:"@container",children:e("div",{className:"grid grid-cols-2 @[540px]:grid-cols-4 gap-2.5 items-stretch",children:[e(Ne,{value:h(r.balance,r.currency),label:"Credit balance",hint:r.label?`Key ${r.label}`:`Left on this key, in ${r.currency}`}),e(Ne,{value:r.limit===null?"No cap":h(r.limit,r.currency),label:"Key limit",hint:r.limit===null?"Spending is not capped on this key":i!==null?`${h(i,r.currency)} spent`:"Cap set by the operator",tone:r.limit===null?"muted":"default"}),e(Ne,{value:r.sessionBudget===null?"Not set":h(r.sessionBudget,r.currency),label:"Session budget",hint:r.sessionBudget===null?"No per-session cap":"Applies to one gateway session",tone:"muted"}),e(Ne,{value:r.isFreeTier?"Free":"Paid",label:"Tier",hint:r.isFreeTier?"Free-tier limits apply":"No free-tier limit on this key",tone:"muted"})]})}),l!==null&&i!==null&&e("div",{className:"space-y-1.5",children:[e("div",{className:"flex items-baseline justify-between gap-2",children:[e("span",{className:"text-[11px] font-semibold text-ink",children:"Key limit used"}),e("span",{className:"text-[10px] text-ink/60",children:[h(i,r.currency)," of ",h(r.limit??0,r.currency)]})]}),e("div",{className:"h-1.5 w-full bg-ink/10 rounded-full overflow-hidden",role:"progressbar","aria-label":"Key limit used","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(l),children:e("div",{className:`h-full rounded-full ${r.limitRemaining!==null&&r.limitRemaining<=0?"bg-error/70":"bg-ink/80"}`,style:{width:`${l}%`}})}),r.limitRemaining!==null&&e("p",{className:"text-[10px] text-ink/50",children:[h(r.limitRemaining,r.currency)," left under the cap"]})]}),e("p",{className:"text-[10px] text-ink/50 leading-relaxed",children:["Balance and caps come from TokenPortal’s ",e("span",{className:"font-mono",children:"/v1/key"})," endpoint in"," ",r.currency,"; top-ups and transaction history live in its console."]})]})}function P(t,r,i,l){let p=t.find((c)=>c.id===r);if(p){p.limits.push(l);return}t.push({id:r,title:i,limits:[l]})}function te(t){let r=(t.split(":")[1]??"").toLowerCase();if(r==="google")return{id:"google",title:"Google"};if(r==="anthropic"||r==="openai")return{id:"third-party",title:"Claude & GPT (shared)"};if(r==="default"||r==="")return{id:"default",title:"Usage"};return{id:r,title:r}}function ae(t){let r=[];for(let i of t)if(i.id==="anthropic:extra")P(r,"balance","Balance",i);else P(r,"windows","Quota windows",i);return r}function ne(t){let r=[];for(let i of t){let l=te(i.id);if(l.id==="third-party"){if(r.find((c)=>c.id==="third-party")?.limits.some((c)=>re(c,i)))continue}P(r,l.id,l.title,i)}return r}function re(t,r){return t.unit===r.unit&&t.label===r.label&&t.usedFraction===r.usedFraction&&t.remaining===r.remaining&&t.resetsAt===r.resetsAt}function H(t,r){if(r.length===0)return[];let i=t.trim().toLowerCase();if(i==="anthropic")return ae(r);if(i==="google-antigravity")return ne(r);return[{id:"all",title:"Quota windows",limits:[...r]}]}function se({limit:t}){let r=Math.min(100,Math.max(0,(t.usedFraction??0)*100)),i=t.modelId??t.accountId,l=t.used!==void 0?y(t.used,t.unit):void 0,p=t.limit!==void 0?y(t.limit,t.unit):void 0,c=t.remaining!==void 0?y(t.remaining,t.unit):void 0;return e("div",{className:"bg-paper border border-ink/15 rounded-lg p-3 shadow-xs space-y-2",children:[e("div",{className:"flex items-start justify-between gap-2",children:[e("div",{className:"min-w-0",children:[e("div",{className:"text-[11px] font-semibold text-ink truncate",children:[t.label,t.windowLabel&&e("span",{className:"ml-1.5 rounded border border-ink/15 px-1 py-px font-mono text-[9px] font-normal text-ink/50",children:t.windowLabel})]}),i&&e("div",{className:"text-[10px] text-ink/50 truncate",children:i})]}),e("span",{className:"text-[10px] text-ink/50 flex-shrink-0 whitespace-nowrap",children:t.resetsAt!==void 0?`Resets ${la(new Date(t.resetsAt).toISOString())}`:""})]}),e("div",{className:"h-1.5 w-full bg-ink/10 rounded-full overflow-hidden",children:e("div",{className:`h-full rounded-full ${t.status==="exhausted"?"bg-error/70":"bg-ink/80"}`,style:{width:`${r}%`}})}),e("div",{className:"flex flex-wrap items-center justify-between gap-x-3 gap-y-0.5 text-[10px] text-ink/60",children:[e("span",{children:["Used"," ",e("span",{className:"font-semibold text-ink",children:t.unit==="percent"||!l?I(t.usedFraction??0):l}),t.unit!=="percent"&&l&&p?` of ${p}`:""]}),e("span",{className:"flex items-center gap-2",children:[t.status!=="ok"&&t.status!=="unknown"&&e("span",{className:"text-[10px] font-mono uppercase px-1.5 py-0.5 rounded bg-ink/10 text-ink/70",children:t.status}),c&&e("span",{children:["Remaining ",e("span",{className:"font-semibold text-ink",children:c})]})]})]}),t.notes&&t.notes.length>0&&e("ul",{className:"text-[10px] text-ink/50 leading-relaxed space-y-0.5",children:t.notes.map((m)=>e("li",{children:m},m))})]})}function Q({providerId:t,limits:r,tracked:i,unavailable:l,emptyReason:p,notes:c}){let m=H(t,r);return e("div",{className:"space-y-2",children:[c&&c.length>0&&e("ul",{className:"text-[10px] text-ink/50 leading-relaxed space-y-0.5",children:c.map((f)=>e("li",{children:f},f))}),m.length===0?e(d,{children:[e("h4",{className:"text-[10px] font-mono font-semibold uppercase tracking-wider text-ink/40",children:"Quota windows"}),e("p",{className:"text-[11px] text-ink/50",children:p??(!i?"No quota source for this provider: omp ships no usage adapter for it and it exposes no balance endpoint Kabmo knows.":l?"omp tracks this provider but its usage endpoint returned no data — an invalid or expired credential, an unreachable endpoint, or a plan without quota windows.":"No quota windows were reported for this provider.")})]}):m.map((f)=>e("div",{className:"@container space-y-2",children:[e("h4",{className:"text-[10px] font-mono font-semibold uppercase tracking-wider text-ink/40",children:f.title}),e("div",{className:"grid grid-cols-1 @[520px]:grid-cols-2 gap-2.5",children:f.limits.map((u)=>e(se,{limit:u},u.id))})]},f.id))]})}var ie="DeepSeek exposes no usage or quota API — only the prepaid balance (and the web console at platform.deepseek.com) is available.",oe="Token Harbor reports percentages, never a dollar remainder. Request history and per-request cost are on its usage dashboard.",le="omp tracks Command Code, but its usage read needs an API key created in Studio — the signed-in OAuth credential cannot read its billing endpoint. Add an API key in Settings → Providers to see the 5-hour, weekly and credit windows.";function Gu({summary:t}){let r=Boolean(t.kenari||t.deepseek||t.tokenHarbor||t.tokenPortal),i=t.tokenHarbor?oe:t.deepseek?ie:void 0;return e(T,{providerName:t.name,providerSlug:t.id,iconUrl:t.iconUrl,credentialSources:t.credentialSources,error:t.error,note:i,children:[t.kenari&&e(M,{report:t.kenari}),t.deepseek&&e(_,{report:t.deepseek}),t.tokenHarbor&&e(O,{report:t.tokenHarbor}),t.tokenPortal&&e(W,{report:t.tokenPortal}),!r&&(t.limits.length>0||!t.error)&&e(Q,{providerId:t.id,limits:t.limits,tracked:t.tracked,unavailable:t.limitsUnavailable,...t.id==="commandcode"&&t.limitsUnavailable?{emptyReason:le}:{},notes:t.notes})]})}function de(t){let r=t.filter((p)=>p.usedFraction!==void 0);if(r.length===0){let p=t.find((c)=>(c.unit==="usd"||c.unit==="idr")&&c.remaining!==void 0);if(p)return`${h(p.remaining??0,p.unit==="idr"?"IDR":"USD")} left`;return t[0]?.label}let i=r.reduce((p,c)=>(c.usedFraction??0)>(p.usedFraction??0)?c:p),l=Math.round((i.usedFraction??0)*100);return i.windowLabel?`${l}% · ${i.windowLabel}`:`${l}% used`}function Zs(t){return t.providers.map((r)=>({id:r.id,name:r.name,...r.iconUrl?{iconUrl:r.iconUrl}:{},error:r.error,hint:pe(r),limits:r.limits,tracked:r.tracked,limitsUnavailable:r.limitsUnavailable,summary:r}))}function pe(t){let r=t.kenari?.quota?.planName;if(r)return r;let i=t.tokenPortal?.balance;if(i)return h(i.balance,i.currency);let l=t.deepseek?.balance?.entries[0];if(l)return`${l.currency} ${w(l.totalBalance)}`;let p=t.tokenHarbor?.allowance;if(p){if(!p.activated)return`${p.planName??"Free"} · not started`;if(p.onPlan)return`${p.planName??"Pass"} · ${p.planUsedPct??0}% · 7d`;return`${p.usedPct??0}% free · 7d`}if(t.id==="commandcode"&&t.limitsUnavailable)return"API key needed";return de(t.limits)??"No quota reported"}function BA(t){return t.error?"Error":"Connected"}function q(){let[t,r]=n([]),[i,l]=n(null),[p,c]=n(!0),m=a(()=>{c(!0),fetch("/api/settings/usage/reset").then((u)=>u.json()).then((u)=>{r(Array.isArray(u.accounts)?u.accounts:[]),l(typeof u.error==="string"?u.error:null)}).catch((u)=>{r([]),l(u instanceof Error?u.message:"Failed to load saved resets")}).finally(()=>c(!1))},[]);o(()=>{m()},[m]);let f=a(async(u)=>{try{let N=await(await fetch("/api/settings/usage/reset",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({target:u})})).json();if(N.ok)m();return{ok:Boolean(N.ok),message:N.message||"No result reported."}}catch(g){return{ok:!1,message:g instanceof Error?g.message:"Failed to spend the saved reset"}}},[m]);return{accounts:t,error:i,isLoading:p,reload:m,spend:f}}function ce({account:t,onSpend:r,spending:i}){let l=`${t.provider}/${t.credentialId}`,p=t.email??t.accountId??t.credentialId,c=t.orgName??t.orgId,m=t.availableCount??t.credits.length,f=t.redeemableCount??0,u=t.error??t.unavailableReason;return e("div",{className:"bg-paper border border-ink/15 rounded-lg p-3 shadow-xs space-y-2",children:[e("div",{className:"flex items-start justify-between gap-2",children:[e("div",{className:"min-w-0",children:[e("div",{className:"text-[11px] font-semibold text-ink truncate",children:[p,c?e("span",{className:"text-ink/50 font-normal",children:[" · ",c]}):null]}),e("div",{className:"text-[10px] text-ink/50 font-mono truncate",children:l})]}),e("span",{className:"text-[10px] text-ink/60 flex-shrink-0 whitespace-nowrap",children:f>0?`${f} of ${m} usable`:`${m} saved`})]}),t.soonestExpiry!==void 0&&e("div",{className:"text-[10px] text-ink/60",children:["Soonest expires ",la(new Date(t.soonestExpiry).toISOString())]}),t.credits.length>0&&e("div",{className:"space-y-1",children:t.credits.map((g)=>e("div",{className:"flex items-center justify-between gap-2 text-[10px] text-ink/70",children:[e("span",{className:"truncate",children:g.title??g.program??g.id}),e("span",{className:"flex items-center gap-1.5 flex-shrink-0",children:[g.clears&&g.clears.length>0&&e("span",{className:"font-mono text-ink/50",children:g.clears.join(", ")}),g.usable===!1&&e("span",{className:"font-mono uppercase px-1.5 py-0.5 rounded bg-ink/10 text-ink/60",children:"blocked"})]})]},g.id))}),u&&e("div",{className:"text-[10px] text-ink/60 leading-snug",children:u}),e("button",{type:"button",onClick:()=>r(l),disabled:i||f===0,title:f===0?u??"Nothing to spend on this account right now.":`Spend a saved reset on ${l}`,className:"w-full rounded-md border border-ink/15 px-2 py-1 text-[11px] font-medium text-ink/80 hover:bg-ink/5 transition-colors cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed",children:i?"Spending…":"Spend saved reset"})]})}function ju(){let{accounts:t,error:r,isLoading:i,reload:l,spend:p}=q(),[c,m]=n(null),[f,u]=n(null),g=(k)=>{m(k),u(null),p(k).then((j)=>{u(j),m(null)})},N=!i&&!r&&t.length===0;return e("div",{className:"space-y-2",children:[e("div",{className:"flex items-center justify-between gap-2",children:[e("div",{className:"min-w-0",children:[e("div",{className:"text-[11px] font-semibold text-ink",children:"Saved rate-limit resets"}),e("div",{className:"text-[10px] text-ink/50 leading-snug",children:"Provider-issued resets for Codex and Claude accounts. Spending one clears the window it covers."})]}),e("button",{type:"button",onClick:l,disabled:i,title:"Re-read saved resets",className:"p-1.5 bg-paper border border-ink/15 rounded-md hover:bg-ink/5 text-ink/80 transition-colors disabled:opacity-50 flex-shrink-0",children:e(D,{size:12,className:i?"animate-spin text-ink":""})})]}),r&&e("div",{className:"flex items-start gap-1.5 text-[10px] text-error leading-snug",children:[e(E,{size:12,className:"flex-shrink-0 mt-px"}),e("span",{children:r})]}),t.map((k)=>e(ce,{account:k,onSpend:g,spending:c===`${k.provider}/${k.credentialId}`},`${k.provider}/${k.credentialId}`)),N&&e("p",{className:"text-[10px] text-ink/50 leading-snug",children:"No saved resets on any account."}),f&&e("div",{className:`text-[10px] leading-snug ${f.ok?"text-ink/70":"text-error"}`,children:f.message})]})}function qu(){let[t,r]=n(null),[i,l]=n(!0),[p,c]=n(null),m=a(async(f)=>{if(!f?.silent)l(!0);c(null);try{let u=f?.force?"/api/settings/usage?refresh=1":"/api/settings/usage",g=await fetch(u);if(!g.ok)throw Error(`Usage request failed (${g.status})`);let N=await g.json();r(N)}catch(u){c(u instanceof Error?u.message:"Failed to load provider usage")}finally{if(!f?.silent)l(!1)}},[]);return o(()=>{m()},[m]),{report:t,isLoading:i,error:p,reload:m}}
2
- export{la,Gu,Zs,BA,ju,qu};