@pheem49/mint 1.16.0 → 1.17.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 (848) hide show
  1. package/Cargo.lock +6 -6
  2. package/Cargo.toml +1 -1
  3. package/README.md +1 -1
  4. package/Release_Note.md +71 -72
  5. package/apps/mint-companion/src-tauri/src/compact.rs +69 -0
  6. package/apps/mint-companion/src-tauri/src/main.rs +218 -11
  7. package/apps/mint-companion/vite.config.ts +2 -1
  8. package/crates/mint-cli/src/agent/live_status.rs +43 -2
  9. package/crates/mint-cli/src/agent.rs +178 -38
  10. package/crates/mint-cli/src/commands/agent.rs +225 -31
  11. package/crates/mint-cli/src/commands/browser.rs +127 -0
  12. package/crates/mint-cli/src/commands/config.rs +14 -1
  13. package/crates/mint-cli/src/commands/knowledge.rs +16 -2
  14. package/crates/mint-cli/src/commands/mod.rs +15 -1
  15. package/crates/mint-cli/src/commands/tailnet_web.rs +2 -7
  16. package/crates/mint-cli/src/companion_navigation.rs +268 -0
  17. package/crates/mint-cli/src/interactive/chat_tui.rs +1065 -63
  18. package/crates/mint-cli/src/interactive/command_ui.rs +39 -0
  19. package/crates/mint-cli/src/interactive/slash_commands.rs +114 -6
  20. package/crates/mint-cli/src/interactive/tool_activity.rs +375 -36
  21. package/crates/mint-cli/src/interactive.rs +37 -5
  22. package/crates/mint-cli/src/main.rs +23 -2
  23. package/crates/mint-cli/src/onboard.rs +3494 -1336
  24. package/crates/mint-cli/tests/mods_testing.rs +5 -1
  25. package/crates/mint-companion-protocol/src/lib.rs +113 -0
  26. package/crates/mint-core/src/agent/chat.rs +240 -1
  27. package/crates/mint-core/src/agent/memory.rs +73 -6
  28. package/crates/mint-core/src/agent/safety.rs +56 -4
  29. package/crates/mint-core/src/agent/skill_inventory.rs +3 -1
  30. package/crates/mint-core/src/agent/skills.rs +1 -0
  31. package/crates/mint-core/src/api_server/routes/auth.rs +1 -4
  32. package/crates/mint-core/src/api_server/routes/chat.rs +29 -15
  33. package/crates/mint-core/src/api_server/routes/misc.rs +116 -0
  34. package/crates/mint-core/src/api_server/routes/profile_oauth.rs +43 -26
  35. package/crates/mint-core/src/api_server/routes/sessions.rs +93 -76
  36. package/crates/mint-core/src/api_server/routes/skills_subagents.rs +11 -7
  37. package/crates/mint-core/src/api_server/routes/status_health.rs +18 -8
  38. package/crates/mint-core/src/api_server.rs +211 -65
  39. package/crates/mint-core/src/avatar_bridge.rs +5 -2
  40. package/crates/mint-core/src/browser/cdp.rs +82 -26
  41. package/crates/mint-core/src/browser/lifecycle.rs +143 -43
  42. package/crates/mint-core/src/browser/mod.rs +5 -4
  43. package/crates/mint-core/src/browser/navigate.rs +82 -9
  44. package/crates/mint-core/src/browser/runtime.rs +284 -0
  45. package/crates/mint-core/src/browser/session.rs +263 -7
  46. package/crates/mint-core/src/browser/workflow.rs +386 -0
  47. package/crates/mint-core/src/companion/navigation.rs +115 -0
  48. package/crates/mint-core/src/companion.rs +109 -1
  49. package/crates/mint-core/src/integrations/mcp_result.rs +45 -0
  50. package/crates/mint-core/src/lib.rs +10 -6
  51. package/crates/mint-core/src/media/image_proxy.rs +563 -0
  52. package/crates/mint-core/src/media/tool_images.rs +196 -0
  53. package/crates/mint-core/src/media/tts/playback.rs +609 -0
  54. package/crates/mint-core/src/media/tts.rs +1 -0
  55. package/crates/mint-core/src/media.rs +2 -0
  56. package/crates/mint-core/src/orchestration/context_render.rs +450 -33
  57. package/crates/mint-core/src/orchestration/decision_parsing.rs +5 -23
  58. package/crates/mint-core/src/orchestration/diagnostics.rs +307 -0
  59. package/crates/mint-core/src/orchestration/image_regressions.rs +379 -0
  60. package/crates/mint-core/src/orchestration/loop_guard.rs +334 -0
  61. package/crates/mint-core/src/orchestration/mod.rs +1104 -560
  62. package/crates/mint-core/src/orchestration/reliability.rs +541 -0
  63. package/crates/mint-core/src/orchestration/repeated_failures.rs +8 -0
  64. package/crates/mint-core/src/orchestration/review_regressions.rs +174 -28
  65. package/crates/mint-core/src/orchestration/tools/files.rs +31 -3
  66. package/crates/mint-core/src/orchestration/tools/plugins_mcp.rs +19 -4
  67. package/crates/mint-core/src/orchestration/tools/project.rs +1 -1
  68. package/crates/mint-core/src/orchestration/tools/shell.rs +29 -5
  69. package/crates/mint-core/src/orchestration/tools/web.rs +5 -1
  70. package/crates/mint-core/src/orchestration/trajectory_schema.rs +353 -0
  71. package/crates/mint-core/src/orchestration/truncation.rs +211 -0
  72. package/crates/mint-core/src/orchestration/verification.rs +36 -6
  73. package/crates/mint-core/src/orchestration/workspace_helpers.rs +54 -23
  74. package/crates/mint-core/src/prompts/agent.rs +31 -40
  75. package/crates/mint-core/src/prompts/tool_catalog.rs +134 -40
  76. package/crates/mint-core/src/search/web_search.rs +44 -3
  77. package/crates/mint-core/src/slash/mod.rs +464 -1
  78. package/crates/mint-core/src/swarm/batch.rs +643 -0
  79. package/crates/mint-core/src/swarm/dossier.rs +152 -0
  80. package/crates/mint-core/src/swarm/labels.rs +100 -0
  81. package/crates/mint-core/src/swarm/mod.rs +158 -0
  82. package/crates/mint-core/src/swarm/permissions.rs +167 -0
  83. package/crates/mint-core/src/system/auth.rs +156 -7
  84. package/crates/mint-core/src/system/bg_shell.rs +77 -9
  85. package/crates/mint-core/src/system/config.rs +92 -3
  86. package/crates/mint-core/src/system/mint_web.rs +33 -12
  87. package/crates/mint-core/src/system/shell.rs +179 -10
  88. package/crates/mint-core/src/system/workspace.rs +204 -0
  89. package/crates/mint-core/tests/background_retention.rs +1 -1
  90. package/crates/mint-core/tests/memory_persistence.rs +27 -0
  91. package/out/web/assets/ArtifactPreviewPanel-DAT_Y7i0.css +1 -0
  92. package/out/web/assets/ArtifactPreviewPanel-S0dPfYFx.js +2 -0
  93. package/out/web/assets/CalculationCard-CRjP3E1j.js +1 -0
  94. package/out/web/assets/{CliSessionsView-CtzUJpK_.css → CliSessionsView-C3Br2v5Y.css} +1 -1
  95. package/out/web/assets/CliSessionsView-MI8kXMAb.js +1 -0
  96. package/out/web/assets/CodeReviewPage-CUJceQme.css +1 -0
  97. package/out/web/assets/CodeReviewPage-VCUgPla_.js +2 -0
  98. package/out/web/assets/CommandPalette-BD8SlTE5.js +1 -0
  99. package/out/web/assets/ImageGenCard-BCXxkVJX.js +1 -0
  100. package/out/web/assets/ImageSearchCard-N3yQOr8Z.js +1 -0
  101. package/out/web/assets/ImageStudioPanel-BP7N4rLr.js +1 -0
  102. package/out/web/assets/LibraryPage-WlviRdR8.js +2 -0
  103. package/out/web/assets/LinkedFoldersView-CKRgroWK.js +1 -0
  104. package/out/web/assets/McpRegistryPicker-CoS83vtc.js +1 -0
  105. package/out/web/assets/McpServersView-D3wHnuHg.js +1 -0
  106. package/out/web/assets/MermaidCard-NqrHdyJW.js +2 -0
  107. package/out/web/assets/MintDashboard-B2DJsDDO.css +1 -0
  108. package/out/web/assets/MintDashboard-COw_xol7.js +63 -0
  109. package/out/web/assets/PluginsView-jBYmcKh4.js +1 -0
  110. package/out/web/assets/RewindModal-DempuDod.js +1 -0
  111. package/out/web/assets/ScheduledTasksView-5uw9-V9H.js +1 -0
  112. package/out/web/assets/SelectField-DXBQtrUK.js +1 -0
  113. package/out/web/assets/SelectField-lFEkkWCU.css +1 -0
  114. package/out/web/assets/SettingsWindow-2YP3yj7s.js +4 -0
  115. package/out/web/assets/SettingsWindow-Dz8LQVgD.css +1 -0
  116. package/out/web/assets/SkillsView-C-gp9J7m.js +2 -0
  117. package/out/web/assets/StockCard-BDMCe7mx.js +1 -0
  118. package/out/web/assets/ToolSurfacePage-B0J_q0Jl.js +38 -0
  119. package/out/web/assets/ToolSurfacePage-CRIQ1owD.css +1 -0
  120. package/out/web/assets/UiFeatureCard-6BwxTOCe.js +1 -0
  121. package/out/web/assets/UiGridCard-DvZcLNxb.js +1 -0
  122. package/out/web/assets/UiMockupWidget-DD73QWg1.js +1 -0
  123. package/out/web/assets/VeoStudioPanel-DfsOJKv0.js +4 -0
  124. package/out/web/assets/WeatherCard-CPucIfq8.js +1 -0
  125. package/out/web/assets/WorkspacePanel-BfHKkulU.js +1 -0
  126. package/out/web/assets/WorkspacePdfPreview-Dx_lkjNu.js +2 -0
  127. package/out/web/assets/abnfDiagram-VCTEODGH-BOo3Ckng.js +1 -0
  128. package/out/web/assets/architecture-7GRP2DOG-ZOwheW3n.js +1 -0
  129. package/out/web/assets/architectureDiagram-5GKGNRK7-DC2FDzVd.js +36 -0
  130. package/out/web/assets/{blockDiagram-NRAW4CY4-BrrqzHW5.js → blockDiagram-I7D4REHJ-BrKFWdAH.js} +4 -4
  131. package/out/web/assets/c4Diagram-7LVT6UL2-BHTHK1Yd.js +38 -0
  132. package/out/web/assets/chunk-2Q5K7J3B-D2JLPQzF.js +1 -0
  133. package/out/web/assets/{chunk-TEH6E4GO-G4Cdlyrt.js → chunk-4HAMMTFA-BYFkZwNj.js} +3 -3
  134. package/out/web/assets/{chunk-5VM5RSS4-BiPuE0io.js → chunk-5VM5RSS4-BZ2oBPYQ.js} +1 -1
  135. package/out/web/assets/chunk-75Z2AOVW-BSKfSKSA.js +2 -0
  136. package/out/web/assets/chunk-DU6HZSFF-vIhsiW6n.js +128 -0
  137. package/out/web/assets/chunk-F27PBJKO-BlYpW9xq.js +1 -0
  138. package/out/web/assets/chunk-FOHPRMQF-JXEeeJ9r.js +161 -0
  139. package/out/web/assets/{chunk-GMAD6QVW-BuhEcgHq.js → chunk-GMAD6QVW-BIBz_Ug5.js} +12 -12
  140. package/out/web/assets/chunk-GVQU2GXP-NPSHxeqC.js +1 -0
  141. package/out/web/assets/chunk-IMKFNOWR-YlJK8_Fp.js +231 -0
  142. package/out/web/assets/chunk-JWPE2WC7-BeEMUFDw.js +1 -0
  143. package/out/web/assets/chunk-L3NEJ4N5-DMYi4-af.js +1 -0
  144. package/out/web/assets/chunk-OSK3NFVY-Begd3-jA.js +10 -0
  145. package/out/web/assets/chunk-P2QGCYS3-D1I4xFHN.js +1 -0
  146. package/out/web/assets/chunk-POPQ4Y6H-CafZZzNE.js +1 -0
  147. package/out/web/assets/chunk-PWAF6VOD-Dwh6_Lnt.js +1 -0
  148. package/out/web/assets/chunk-SHT3W25Y-B0XrCSEb.js +168 -0
  149. package/out/web/assets/{chunk-SVP7TREG-Bu_yYb-V.js → chunk-SVP7TREG-CxLsddxC.js} +1 -1
  150. package/out/web/assets/{chunk-LCL6LL3I-BhXV9zyH.js → chunk-TICWLB2K-y156QInb.js} +4 -4
  151. package/out/web/assets/chunk-XXDRQBXY-B9YlhOkE.js +1 -0
  152. package/out/web/assets/chunk-Y2CYZVJY-BxCWjNVG.js +1 -0
  153. package/out/web/assets/classDiagram-ZZMXUADV-BgJ5WtSp.js +1 -0
  154. package/out/web/assets/classDiagram-v2-VYDZK3BY-BgJ5WtSp.js +1 -0
  155. package/out/web/assets/config-CvIO5hkn.js +2 -0
  156. package/out/web/assets/config-DqXJXeZM.css +1 -0
  157. package/out/web/assets/core-Mi3s5D4_.js +1 -0
  158. package/out/web/assets/cose-bilkent-JH36ORCC-qlna31ty.js +1 -0
  159. package/out/web/assets/cynefin-OW5HDTMX-SMVvrLf-.js +1 -0
  160. package/out/web/assets/cynefinDiagram-5FMLGOSQ-rZznN24T.js +62 -0
  161. package/out/web/assets/cytoscape.esm-DWtAUG0r.js +321 -0
  162. package/out/web/assets/dagre-CnWJJM5f.js +1 -0
  163. package/out/web/assets/dagre-GXQ25YYZ-BOToydFu.js +4 -0
  164. package/out/web/assets/diagram-S7CK7UJ4-TMVaGQEJ.js +30 -0
  165. package/out/web/assets/diagram-UQ7AKVKN-C2JK-GP2.js +41 -0
  166. package/out/web/assets/{diagram-VSXAHHWV-BJ86Ov2Y.js → diagram-VSXAHHWV-Cw8VSi2K.js} +1 -1
  167. package/out/web/assets/diagram-VX7I27RA-DXp4fKk9.js +24 -0
  168. package/out/web/assets/diagram-Z3DM3KII-CzSicYiW.js +24 -0
  169. package/out/web/assets/dist-9ISJ7r-g.js +1 -0
  170. package/out/web/assets/dist-js-BV3mI7uw.js +1 -0
  171. package/out/web/assets/ebnfDiagram-PWID7BFC-Dqj-zqPu.js +1 -0
  172. package/out/web/assets/{erDiagram-SSCWMZ5O-CzzmnZWT.js → erDiagram-RLTQ6QDP-DZwFZAuD.js} +3 -3
  173. package/out/web/assets/event-D7D-EBy9.js +1 -0
  174. package/out/web/assets/eventmodeling-NTZA5JFV-C0O-Lvgp.js +1 -0
  175. package/out/web/assets/flowDiagram-HODETNUW-uqCHJond.js +1 -0
  176. package/out/web/assets/ganttDiagram-EL5Y4UJY-Da4ULXTl.js +292 -0
  177. package/out/web/assets/gitGraph-4MIJSDKK-B9wNFZIP.js +1 -0
  178. package/out/web/assets/gitGraphDiagram-WWUBYQGX-RjrhB0MP.js +106 -0
  179. package/out/web/assets/graphlib-Bh9gHply.js +1 -0
  180. package/out/web/assets/index-BmpulIkg.js +168 -0
  181. package/out/web/assets/index-CkvBwhX_.css +1 -0
  182. package/out/web/assets/info-A6RAGUB7-B3dfCpeY.js +1 -0
  183. package/out/web/assets/infoDiagram-27XIBGKW-QVWkLVx7.js +2 -0
  184. package/out/web/assets/{ishikawaDiagram-5VMMS53U-s38yo28y.js → ishikawaDiagram-5VMMS53U-CLFNIRI9.js} +4 -4
  185. package/out/web/assets/journeyDiagram-3NMN7TZE-fgOQadYF.js +139 -0
  186. package/out/web/assets/jsx-runtime-DmUwWVTj.js +1 -0
  187. package/out/web/assets/{kanban-definition-3QL26DDD-DodjgySL.js → kanban-definition-UXKFOSKX-G3Q_9g9O.js} +6 -6
  188. package/out/web/assets/katex-MCdQaEAD.js +257 -0
  189. package/out/web/assets/mermaid-parser.core-v3Jm7nco.js +7 -0
  190. package/out/web/assets/mermaid.core-DTEjLUA1.js +44 -0
  191. package/out/web/assets/{mindmap-definition-FBJOCRG2-260WBDxZ.js → mindmap-definition-YA3MSWOX-C_D42_fF.js} +4 -4
  192. package/out/web/assets/modelManager-BPLycQrN.js +2 -0
  193. package/out/web/assets/oauthManager-BUK7ic7q.js +1 -0
  194. package/out/web/assets/packet-AYTQ26CC-B-R-SHlF.js +1 -0
  195. package/out/web/assets/pdf-Bcahc2yC.js +56 -0
  196. package/out/web/assets/pdf.worker.min-Dkey6ZUl.mjs +27 -0
  197. package/out/web/assets/pegDiagram-XKGWAZYB-Da2q_giz.js +1 -0
  198. package/out/web/assets/pie-WAS4IAKB-BC8F0N7-.js +1 -0
  199. package/out/web/assets/pieDiagram-E7YTZNPT-Iy9REJNC.js +39 -0
  200. package/out/web/assets/{quadrantDiagram-AXDQQJYC-B8D3gU5d.js → quadrantDiagram-AXDQQJYC-ztsiYw7h.js} +4 -4
  201. package/out/web/assets/radar-RG4KPBEZ-B_1P8Z_z.js +1 -0
  202. package/out/web/assets/railroad-74A4TZTK-DuTqczSo.js +1 -0
  203. package/out/web/assets/railroad-abnf-HS5TGJTU-Df29WLmp.js +1 -0
  204. package/out/web/assets/railroad-ebnf-LZEXJU2U-ePFMo-qp.js +1 -0
  205. package/out/web/assets/railroad-peg-WCYAUIDC-DYXLW4_E.js +1 -0
  206. package/out/web/assets/railroadDiagram-O6MQD6OU-LStnZf2S.js +1 -0
  207. package/out/web/assets/{requirementDiagram-EFPCY7ZU-D2X-Ewik.js → requirementDiagram-BXWQKSXE-DmzonMH-.js} +3 -3
  208. package/out/web/assets/rolldown-runtime-CNOWq4Kh.js +1 -0
  209. package/out/web/assets/rough.esm-CNnFptCR.js +1 -0
  210. package/out/web/assets/sankeyDiagram-P5KCCOFB-B8vjmUU1.js +40 -0
  211. package/out/web/assets/sequenceDiagram-WJ2MYXX4-CTnplOAX.js +162 -0
  212. package/out/web/assets/sizeCapture-INFHLROL-C8Q8DbV5.js +1 -0
  213. package/out/web/assets/src-CRDfRlHM.js +1 -0
  214. package/out/web/assets/stateDiagram-D77RDMKH-BFrIaLdI.js +1 -0
  215. package/out/web/assets/stateDiagram-v2-MP3YSRHH-uf3kdNW4.js +1 -0
  216. package/out/web/assets/studio-BBZQ_-QK.js +1 -0
  217. package/out/web/assets/swimlanes-42K2YHIH-BXGngUNU.js +1 -0
  218. package/out/web/assets/swimlanesDiagram-VR7AAH4N-Y8q5bQce.js +8 -0
  219. package/out/web/assets/timeline-definition-24CTP7MA-CegH7n43.js +120 -0
  220. package/out/web/assets/treeView-Q6P3EWNA-DTpJv2Tw.js +1 -0
  221. package/out/web/assets/treemap-WGGIJYW6-i8M9iJU6.js +1 -0
  222. package/out/web/assets/vennDiagram-4TSXK5OY-Dpzo1S8U.js +34 -0
  223. package/out/web/assets/wardley-WFR3VGLG-BrNsgtfw.js +1 -0
  224. package/out/web/assets/{wardleyDiagram-VM6X3IG4-DAdXELbQ.js → wardleyDiagram-VM6X3IG4-lQ92LFE1.js} +35 -35
  225. package/out/web/assets/window-CkUOP7t0.js +1 -0
  226. package/out/web/assets/workspaces-SYPrmbgC.js +1 -0
  227. package/out/web/assets/{xychartDiagram-S5SC5T6Z-IZIXf3Vo.js → xychartDiagram-S5SC5T6Z-BaOaEoBd.js} +4 -4
  228. package/out/web/index-web.html +4 -4
  229. package/out/web/index.html +4 -4
  230. package/out/web/pdfjs/cmaps/78-EUC-H.bcmap +0 -0
  231. package/out/web/pdfjs/cmaps/78-EUC-V.bcmap +0 -0
  232. package/out/web/pdfjs/cmaps/78-H.bcmap +0 -0
  233. package/out/web/pdfjs/cmaps/78-RKSJ-H.bcmap +0 -0
  234. package/out/web/pdfjs/cmaps/78-RKSJ-V.bcmap +0 -0
  235. package/out/web/pdfjs/cmaps/78-V.bcmap +0 -0
  236. package/out/web/pdfjs/cmaps/78ms-RKSJ-H.bcmap +0 -0
  237. package/out/web/pdfjs/cmaps/78ms-RKSJ-V.bcmap +0 -0
  238. package/out/web/pdfjs/cmaps/83pv-RKSJ-H.bcmap +0 -0
  239. package/out/web/pdfjs/cmaps/90ms-RKSJ-H.bcmap +0 -0
  240. package/out/web/pdfjs/cmaps/90ms-RKSJ-V.bcmap +0 -0
  241. package/out/web/pdfjs/cmaps/90msp-RKSJ-H.bcmap +0 -0
  242. package/out/web/pdfjs/cmaps/90msp-RKSJ-V.bcmap +0 -0
  243. package/out/web/pdfjs/cmaps/90pv-RKSJ-H.bcmap +0 -0
  244. package/out/web/pdfjs/cmaps/90pv-RKSJ-V.bcmap +0 -0
  245. package/out/web/pdfjs/cmaps/Add-H.bcmap +0 -0
  246. package/out/web/pdfjs/cmaps/Add-RKSJ-H.bcmap +0 -0
  247. package/out/web/pdfjs/cmaps/Add-RKSJ-V.bcmap +0 -0
  248. package/out/web/pdfjs/cmaps/Add-V.bcmap +0 -0
  249. package/out/web/pdfjs/cmaps/Adobe-CNS1-0.bcmap +0 -0
  250. package/out/web/pdfjs/cmaps/Adobe-CNS1-1.bcmap +0 -0
  251. package/out/web/pdfjs/cmaps/Adobe-CNS1-2.bcmap +0 -0
  252. package/out/web/pdfjs/cmaps/Adobe-CNS1-3.bcmap +0 -0
  253. package/out/web/pdfjs/cmaps/Adobe-CNS1-4.bcmap +0 -0
  254. package/out/web/pdfjs/cmaps/Adobe-CNS1-5.bcmap +0 -0
  255. package/out/web/pdfjs/cmaps/Adobe-CNS1-6.bcmap +0 -0
  256. package/out/web/pdfjs/cmaps/Adobe-CNS1-UCS2.bcmap +0 -0
  257. package/out/web/pdfjs/cmaps/Adobe-GB1-0.bcmap +0 -0
  258. package/out/web/pdfjs/cmaps/Adobe-GB1-1.bcmap +0 -0
  259. package/out/web/pdfjs/cmaps/Adobe-GB1-2.bcmap +0 -0
  260. package/out/web/pdfjs/cmaps/Adobe-GB1-3.bcmap +0 -0
  261. package/out/web/pdfjs/cmaps/Adobe-GB1-4.bcmap +0 -0
  262. package/out/web/pdfjs/cmaps/Adobe-GB1-5.bcmap +0 -0
  263. package/out/web/pdfjs/cmaps/Adobe-GB1-UCS2.bcmap +0 -0
  264. package/out/web/pdfjs/cmaps/Adobe-Japan1-0.bcmap +0 -0
  265. package/out/web/pdfjs/cmaps/Adobe-Japan1-1.bcmap +0 -0
  266. package/out/web/pdfjs/cmaps/Adobe-Japan1-2.bcmap +0 -0
  267. package/out/web/pdfjs/cmaps/Adobe-Japan1-3.bcmap +0 -0
  268. package/out/web/pdfjs/cmaps/Adobe-Japan1-4.bcmap +0 -0
  269. package/out/web/pdfjs/cmaps/Adobe-Japan1-5.bcmap +0 -0
  270. package/out/web/pdfjs/cmaps/Adobe-Japan1-6.bcmap +0 -0
  271. package/out/web/pdfjs/cmaps/Adobe-Japan1-UCS2.bcmap +0 -0
  272. package/out/web/pdfjs/cmaps/Adobe-Korea1-0.bcmap +0 -0
  273. package/out/web/pdfjs/cmaps/Adobe-Korea1-1.bcmap +0 -0
  274. package/out/web/pdfjs/cmaps/Adobe-Korea1-2.bcmap +0 -0
  275. package/out/web/pdfjs/cmaps/Adobe-Korea1-UCS2.bcmap +0 -0
  276. package/out/web/pdfjs/cmaps/B5-H.bcmap +0 -0
  277. package/out/web/pdfjs/cmaps/B5-V.bcmap +0 -0
  278. package/out/web/pdfjs/cmaps/B5pc-H.bcmap +0 -0
  279. package/out/web/pdfjs/cmaps/B5pc-V.bcmap +0 -0
  280. package/out/web/pdfjs/cmaps/CNS-EUC-H.bcmap +0 -0
  281. package/out/web/pdfjs/cmaps/CNS-EUC-V.bcmap +0 -0
  282. package/out/web/pdfjs/cmaps/CNS1-H.bcmap +0 -0
  283. package/out/web/pdfjs/cmaps/CNS1-V.bcmap +0 -0
  284. package/out/web/pdfjs/cmaps/CNS2-H.bcmap +0 -0
  285. package/out/web/pdfjs/cmaps/CNS2-V.bcmap +3 -0
  286. package/out/web/pdfjs/cmaps/ETHK-B5-H.bcmap +0 -0
  287. package/out/web/pdfjs/cmaps/ETHK-B5-V.bcmap +0 -0
  288. package/out/web/pdfjs/cmaps/ETen-B5-H.bcmap +0 -0
  289. package/out/web/pdfjs/cmaps/ETen-B5-V.bcmap +0 -0
  290. package/out/web/pdfjs/cmaps/ETenms-B5-H.bcmap +3 -0
  291. package/out/web/pdfjs/cmaps/ETenms-B5-V.bcmap +0 -0
  292. package/out/web/pdfjs/cmaps/EUC-H.bcmap +0 -0
  293. package/out/web/pdfjs/cmaps/EUC-V.bcmap +0 -0
  294. package/out/web/pdfjs/cmaps/Ext-H.bcmap +0 -0
  295. package/out/web/pdfjs/cmaps/Ext-RKSJ-H.bcmap +0 -0
  296. package/out/web/pdfjs/cmaps/Ext-RKSJ-V.bcmap +0 -0
  297. package/out/web/pdfjs/cmaps/Ext-V.bcmap +0 -0
  298. package/out/web/pdfjs/cmaps/GB-EUC-H.bcmap +0 -0
  299. package/out/web/pdfjs/cmaps/GB-EUC-V.bcmap +0 -0
  300. package/out/web/pdfjs/cmaps/GB-H.bcmap +4 -0
  301. package/out/web/pdfjs/cmaps/GB-V.bcmap +0 -0
  302. package/out/web/pdfjs/cmaps/GBK-EUC-H.bcmap +0 -0
  303. package/out/web/pdfjs/cmaps/GBK-EUC-V.bcmap +0 -0
  304. package/out/web/pdfjs/cmaps/GBK2K-H.bcmap +0 -0
  305. package/out/web/pdfjs/cmaps/GBK2K-V.bcmap +0 -0
  306. package/out/web/pdfjs/cmaps/GBKp-EUC-H.bcmap +0 -0
  307. package/out/web/pdfjs/cmaps/GBKp-EUC-V.bcmap +0 -0
  308. package/out/web/pdfjs/cmaps/GBT-EUC-H.bcmap +0 -0
  309. package/out/web/pdfjs/cmaps/GBT-EUC-V.bcmap +0 -0
  310. package/out/web/pdfjs/cmaps/GBT-H.bcmap +0 -0
  311. package/out/web/pdfjs/cmaps/GBT-V.bcmap +0 -0
  312. package/out/web/pdfjs/cmaps/GBTpc-EUC-H.bcmap +0 -0
  313. package/out/web/pdfjs/cmaps/GBTpc-EUC-V.bcmap +0 -0
  314. package/out/web/pdfjs/cmaps/GBpc-EUC-H.bcmap +0 -0
  315. package/out/web/pdfjs/cmaps/GBpc-EUC-V.bcmap +0 -0
  316. package/out/web/pdfjs/cmaps/H.bcmap +0 -0
  317. package/out/web/pdfjs/cmaps/HKdla-B5-H.bcmap +0 -0
  318. package/out/web/pdfjs/cmaps/HKdla-B5-V.bcmap +0 -0
  319. package/out/web/pdfjs/cmaps/HKdlb-B5-H.bcmap +0 -0
  320. package/out/web/pdfjs/cmaps/HKdlb-B5-V.bcmap +0 -0
  321. package/out/web/pdfjs/cmaps/HKgccs-B5-H.bcmap +0 -0
  322. package/out/web/pdfjs/cmaps/HKgccs-B5-V.bcmap +0 -0
  323. package/out/web/pdfjs/cmaps/HKm314-B5-H.bcmap +0 -0
  324. package/out/web/pdfjs/cmaps/HKm314-B5-V.bcmap +0 -0
  325. package/out/web/pdfjs/cmaps/HKm471-B5-H.bcmap +0 -0
  326. package/out/web/pdfjs/cmaps/HKm471-B5-V.bcmap +0 -0
  327. package/out/web/pdfjs/cmaps/HKscs-B5-H.bcmap +0 -0
  328. package/out/web/pdfjs/cmaps/HKscs-B5-V.bcmap +0 -0
  329. package/out/web/pdfjs/cmaps/Hankaku.bcmap +0 -0
  330. package/out/web/pdfjs/cmaps/Hiragana.bcmap +0 -0
  331. package/out/web/pdfjs/cmaps/KSC-EUC-H.bcmap +0 -0
  332. package/out/web/pdfjs/cmaps/KSC-EUC-V.bcmap +0 -0
  333. package/out/web/pdfjs/cmaps/KSC-H.bcmap +0 -0
  334. package/out/web/pdfjs/cmaps/KSC-Johab-H.bcmap +0 -0
  335. package/out/web/pdfjs/cmaps/KSC-Johab-V.bcmap +0 -0
  336. package/out/web/pdfjs/cmaps/KSC-V.bcmap +0 -0
  337. package/out/web/pdfjs/cmaps/KSCms-UHC-H.bcmap +0 -0
  338. package/out/web/pdfjs/cmaps/KSCms-UHC-HW-H.bcmap +0 -0
  339. package/out/web/pdfjs/cmaps/KSCms-UHC-HW-V.bcmap +0 -0
  340. package/out/web/pdfjs/cmaps/KSCms-UHC-V.bcmap +0 -0
  341. package/out/web/pdfjs/cmaps/KSCpc-EUC-H.bcmap +0 -0
  342. package/out/web/pdfjs/cmaps/KSCpc-EUC-V.bcmap +0 -0
  343. package/out/web/pdfjs/cmaps/Katakana.bcmap +0 -0
  344. package/out/web/pdfjs/cmaps/LICENSE +36 -0
  345. package/out/web/pdfjs/cmaps/NWP-H.bcmap +0 -0
  346. package/out/web/pdfjs/cmaps/NWP-V.bcmap +0 -0
  347. package/out/web/pdfjs/cmaps/RKSJ-H.bcmap +0 -0
  348. package/out/web/pdfjs/cmaps/RKSJ-V.bcmap +0 -0
  349. package/out/web/pdfjs/cmaps/Roman.bcmap +0 -0
  350. package/out/web/pdfjs/cmaps/UniCNS-UCS2-H.bcmap +0 -0
  351. package/out/web/pdfjs/cmaps/UniCNS-UCS2-V.bcmap +0 -0
  352. package/out/web/pdfjs/cmaps/UniCNS-UTF16-H.bcmap +0 -0
  353. package/out/web/pdfjs/cmaps/UniCNS-UTF16-V.bcmap +0 -0
  354. package/out/web/pdfjs/cmaps/UniCNS-UTF32-H.bcmap +0 -0
  355. package/out/web/pdfjs/cmaps/UniCNS-UTF32-V.bcmap +0 -0
  356. package/out/web/pdfjs/cmaps/UniCNS-UTF8-H.bcmap +0 -0
  357. package/out/web/pdfjs/cmaps/UniCNS-UTF8-V.bcmap +0 -0
  358. package/out/web/pdfjs/cmaps/UniGB-UCS2-H.bcmap +0 -0
  359. package/out/web/pdfjs/cmaps/UniGB-UCS2-V.bcmap +0 -0
  360. package/out/web/pdfjs/cmaps/UniGB-UTF16-H.bcmap +0 -0
  361. package/out/web/pdfjs/cmaps/UniGB-UTF16-V.bcmap +0 -0
  362. package/out/web/pdfjs/cmaps/UniGB-UTF32-H.bcmap +0 -0
  363. package/out/web/pdfjs/cmaps/UniGB-UTF32-V.bcmap +0 -0
  364. package/out/web/pdfjs/cmaps/UniGB-UTF8-H.bcmap +0 -0
  365. package/out/web/pdfjs/cmaps/UniGB-UTF8-V.bcmap +0 -0
  366. package/out/web/pdfjs/cmaps/UniJIS-UCS2-H.bcmap +0 -0
  367. package/out/web/pdfjs/cmaps/UniJIS-UCS2-HW-H.bcmap +0 -0
  368. package/out/web/pdfjs/cmaps/UniJIS-UCS2-HW-V.bcmap +0 -0
  369. package/out/web/pdfjs/cmaps/UniJIS-UCS2-V.bcmap +0 -0
  370. package/out/web/pdfjs/cmaps/UniJIS-UTF16-H.bcmap +0 -0
  371. package/out/web/pdfjs/cmaps/UniJIS-UTF16-V.bcmap +0 -0
  372. package/out/web/pdfjs/cmaps/UniJIS-UTF32-H.bcmap +0 -0
  373. package/out/web/pdfjs/cmaps/UniJIS-UTF32-V.bcmap +0 -0
  374. package/out/web/pdfjs/cmaps/UniJIS-UTF8-H.bcmap +0 -0
  375. package/out/web/pdfjs/cmaps/UniJIS-UTF8-V.bcmap +0 -0
  376. package/out/web/pdfjs/cmaps/UniJIS2004-UTF16-H.bcmap +0 -0
  377. package/out/web/pdfjs/cmaps/UniJIS2004-UTF16-V.bcmap +0 -0
  378. package/out/web/pdfjs/cmaps/UniJIS2004-UTF32-H.bcmap +0 -0
  379. package/out/web/pdfjs/cmaps/UniJIS2004-UTF32-V.bcmap +0 -0
  380. package/out/web/pdfjs/cmaps/UniJIS2004-UTF8-H.bcmap +0 -0
  381. package/out/web/pdfjs/cmaps/UniJIS2004-UTF8-V.bcmap +0 -0
  382. package/out/web/pdfjs/cmaps/UniJISPro-UCS2-HW-V.bcmap +0 -0
  383. package/out/web/pdfjs/cmaps/UniJISPro-UCS2-V.bcmap +0 -0
  384. package/out/web/pdfjs/cmaps/UniJISPro-UTF8-V.bcmap +0 -0
  385. package/out/web/pdfjs/cmaps/UniJISX0213-UTF32-H.bcmap +0 -0
  386. package/out/web/pdfjs/cmaps/UniJISX0213-UTF32-V.bcmap +0 -0
  387. package/out/web/pdfjs/cmaps/UniJISX02132004-UTF32-H.bcmap +0 -0
  388. package/out/web/pdfjs/cmaps/UniJISX02132004-UTF32-V.bcmap +0 -0
  389. package/out/web/pdfjs/cmaps/UniKS-UCS2-H.bcmap +0 -0
  390. package/out/web/pdfjs/cmaps/UniKS-UCS2-V.bcmap +0 -0
  391. package/out/web/pdfjs/cmaps/UniKS-UTF16-H.bcmap +0 -0
  392. package/out/web/pdfjs/cmaps/UniKS-UTF16-V.bcmap +0 -0
  393. package/out/web/pdfjs/cmaps/UniKS-UTF32-H.bcmap +0 -0
  394. package/out/web/pdfjs/cmaps/UniKS-UTF32-V.bcmap +0 -0
  395. package/out/web/pdfjs/cmaps/UniKS-UTF8-H.bcmap +0 -0
  396. package/out/web/pdfjs/cmaps/UniKS-UTF8-V.bcmap +0 -0
  397. package/out/web/pdfjs/cmaps/V.bcmap +0 -0
  398. package/out/web/pdfjs/cmaps/WP-Symbol.bcmap +0 -0
  399. package/out/web/pdfjs/standard_fonts/FoxitDingbats.pfb +0 -0
  400. package/out/web/pdfjs/standard_fonts/FoxitFixed.pfb +0 -0
  401. package/out/web/pdfjs/standard_fonts/FoxitFixedBold.pfb +0 -0
  402. package/out/web/pdfjs/standard_fonts/FoxitFixedBoldItalic.pfb +0 -0
  403. package/out/web/pdfjs/standard_fonts/FoxitFixedItalic.pfb +0 -0
  404. package/out/web/pdfjs/standard_fonts/FoxitSerif.pfb +0 -0
  405. package/out/web/pdfjs/standard_fonts/FoxitSerifBold.pfb +0 -0
  406. package/out/web/pdfjs/standard_fonts/FoxitSerifBoldItalic.pfb +0 -0
  407. package/out/web/pdfjs/standard_fonts/FoxitSerifItalic.pfb +0 -0
  408. package/out/web/pdfjs/standard_fonts/FoxitSymbol.pfb +0 -0
  409. package/out/web/pdfjs/standard_fonts/LICENSE_FOXIT +27 -0
  410. package/out/web/pdfjs/standard_fonts/LICENSE_LIBERATION +363 -0
  411. package/out/web/pdfjs/standard_fonts/LiberationSans-Bold.ttf +0 -0
  412. package/out/web/pdfjs/standard_fonts/LiberationSans-BoldItalic.ttf +0 -0
  413. package/out/web/pdfjs/standard_fonts/LiberationSans-Italic.ttf +0 -0
  414. package/out/web/pdfjs/standard_fonts/LiberationSans-Regular.ttf +0 -0
  415. package/out/web/pdfjs/wasm/LICENSE_JBIG2 +196 -0
  416. package/out/web/pdfjs/wasm/LICENSE_OPENJPEG +39 -0
  417. package/out/web/pdfjs/wasm/LICENSE_PDFJS_JBIG2 +13 -0
  418. package/out/web/pdfjs/wasm/LICENSE_PDFJS_OPENJPEG +22 -0
  419. package/out/web/pdfjs/wasm/LICENSE_PDFJS_QCMS +19 -0
  420. package/out/web/pdfjs/wasm/LICENSE_QCMS +21 -0
  421. package/out/web/pdfjs/wasm/jbig2.wasm +0 -0
  422. package/out/web/pdfjs/wasm/jbig2_nowasm_fallback.js +15 -0
  423. package/out/web/pdfjs/wasm/openjpeg.wasm +0 -0
  424. package/out/web/pdfjs/wasm/openjpeg_nowasm_fallback.js +17 -0
  425. package/out/web/pdfjs/wasm/qcms_bg.wasm +0 -0
  426. package/out/web/pdfjs/wasm/quickjs-eval.js +16 -0
  427. package/out/web/pdfjs/wasm/quickjs-eval.wasm +0 -0
  428. package/package.json +6 -4
  429. package/slash-commands.json +8 -2
  430. package/src/bin/index.js +4 -1
  431. package/src/bin/pdfjs-assets.mjs +31 -0
  432. package/src/renderer/node_modules/.vite/vitest/CACHEDIR.TAG +3 -0
  433. package/src/renderer/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +1 -1
  434. package/src/renderer/shared/agentProgress.ts +11 -2
  435. package/src/renderer/shared/components/Settings/AgentsTab.tsx +70 -6
  436. package/src/renderer/shared/components/Settings/AudioTab.tsx +1 -1
  437. package/src/renderer/shared/components/Settings/AutomationTab.tsx +57 -0
  438. package/src/renderer/shared/components/Settings/AvatarCropModal.tsx +18 -12
  439. package/src/renderer/shared/components/Settings/CustomProviderLogoPicker.test.tsx +65 -0
  440. package/src/renderer/shared/components/Settings/CustomProviderLogoPicker.tsx +456 -0
  441. package/src/renderer/shared/components/Settings/GeneralTab.tsx +40 -82
  442. package/src/renderer/shared/components/Settings/PluginsTab.tsx +101 -24
  443. package/src/renderer/shared/components/Settings/ProfileTab.tsx +1 -1
  444. package/src/renderer/shared/components/Settings/SettingsWindow.tsx +796 -0
  445. package/src/renderer/shared/components/Settings/ThemeTab.tsx +13 -1
  446. package/src/renderer/shared/components/{AgentActivityDrawer.tsx → activity/AgentActivityDrawer.tsx} +77 -61
  447. package/src/renderer/shared/components/{AgentActivityTable.tsx → activity/AgentActivityTable.tsx} +46 -7
  448. package/src/renderer/shared/components/{McpToolResults.tsx → activity/McpToolResults.tsx} +32 -13
  449. package/src/renderer/shared/components/{PlanChecklistWidget.tsx → activity/PlanChecklistWidget.tsx} +2 -2
  450. package/src/renderer/shared/components/activity/RunSummaryDashboard.test.tsx +127 -0
  451. package/src/renderer/shared/components/activity/RunSummaryDashboard.tsx +222 -0
  452. package/src/renderer/shared/components/activity/SubagentDagView.test.ts +123 -0
  453. package/src/renderer/shared/components/{SubagentDagView.tsx → activity/SubagentDagView.tsx} +97 -43
  454. package/src/renderer/shared/components/activity/SubagentStatusStrip.test.tsx +82 -0
  455. package/src/renderer/shared/components/activity/SubagentStatusStrip.tsx +107 -0
  456. package/src/renderer/shared/components/activity/ViewedImages.tsx +140 -0
  457. package/src/renderer/shared/components/{AuthGate.tsx → app/AuthGate.tsx} +3 -3
  458. package/src/renderer/shared/components/{ChunkErrorBoundary.tsx → app/ChunkErrorBoundary.tsx} +10 -10
  459. package/src/renderer/shared/components/{CommandPalette.tsx → app/CommandPalette.tsx} +25 -25
  460. package/src/renderer/shared/components/{DashboardSidebar.tsx → app/DashboardSidebar.tsx} +7 -5
  461. package/src/renderer/shared/components/{DesktopTitlebar.tsx → app/DesktopTitlebar.tsx} +7 -24
  462. package/src/renderer/shared/components/{ErrorNotice.tsx → app/ErrorNotice.tsx} +1 -1
  463. package/src/renderer/shared/components/{MintDashboard.tsx → app/MintDashboard.tsx} +191 -212
  464. package/src/renderer/shared/components/{ModalErrorBoundary.tsx → app/ModalErrorBoundary.tsx} +5 -5
  465. package/src/renderer/shared/components/{CalculationCard.tsx → cards/CalculationCard.tsx} +13 -27
  466. package/src/renderer/shared/components/{ImageGenCard.tsx → cards/ImageGenCard.tsx} +9 -22
  467. package/src/renderer/shared/components/{ImageSearchCard.tsx → cards/ImageSearchCard.tsx} +9 -22
  468. package/src/renderer/shared/components/{MermaidCard.tsx → cards/MermaidCard.tsx} +37 -21
  469. package/src/renderer/shared/components/{StockCard.tsx → cards/StockCard.tsx} +15 -31
  470. package/src/renderer/shared/components/cards/ToolResultCards.tsx +86 -0
  471. package/src/renderer/shared/components/{UiFeatureCard.tsx → cards/UiFeatureCard.tsx} +6 -6
  472. package/src/renderer/shared/components/{UiGridCard.tsx → cards/UiGridCard.tsx} +3 -3
  473. package/src/renderer/shared/components/{WeatherCard.tsx → cards/WeatherCard.tsx} +1 -1
  474. package/src/renderer/shared/components/{ApprovalCard.test.tsx → chat/ApprovalCard.test.tsx} +1 -1
  475. package/src/renderer/shared/components/{ApprovalCard.tsx → chat/ApprovalCard.tsx} +5 -5
  476. package/src/renderer/shared/components/{ChatCodeBlock.tsx → chat/ChatCodeBlock.tsx} +1 -1
  477. package/src/renderer/shared/components/{ChatMessageItem.test.tsx → chat/ChatMessageItem.test.tsx} +92 -15
  478. package/src/renderer/shared/components/{ChatMessageItem.tsx → chat/ChatMessageItem.tsx} +73 -157
  479. package/src/renderer/shared/components/chat/ChatPanel.test.tsx +31 -0
  480. package/src/renderer/shared/components/{ChatPanel.tsx → chat/ChatPanel.tsx} +244 -493
  481. package/src/renderer/shared/components/{CollapsiblePasteInput.tsx → chat/CollapsiblePasteInput.tsx} +2 -2
  482. package/src/renderer/shared/components/{DiffReviewModal.tsx → chat/DiffReviewModal.tsx} +40 -40
  483. package/src/renderer/shared/components/{GeminiLiveOverlay.tsx → chat/GeminiLiveOverlay.tsx} +2 -2
  484. package/src/renderer/shared/components/{ModelSelectorPopover.tsx → chat/ModelSelectorPopover.tsx} +3 -3
  485. package/src/renderer/shared/components/chat/QueuedMessagesBanner.test.tsx +89 -0
  486. package/src/renderer/shared/components/chat/QueuedMessagesBanner.tsx +201 -0
  487. package/src/renderer/shared/components/{RewindModal.tsx → chat/RewindModal.tsx} +4 -4
  488. package/src/renderer/shared/components/{SlashChoicePanel.tsx → chat/SlashChoicePanel.tsx} +2 -2
  489. package/src/renderer/shared/components/{SlashSuggestions.tsx → chat/SlashSuggestions.tsx} +4 -4
  490. package/src/renderer/shared/components/{SourcesBlock.tsx → chat/SourcesBlock.tsx} +30 -37
  491. package/src/renderer/shared/components/{ThinkingBlock.tsx → chat/ThinkingBlock.tsx} +1 -1
  492. package/src/renderer/shared/components/chat/TurnFileChanges.test.tsx +86 -0
  493. package/src/renderer/shared/components/chat/TurnFileChanges.tsx +430 -0
  494. package/src/renderer/shared/components/{VoicePill.css → chat/VoicePill.css} +1 -1
  495. package/src/renderer/shared/components/{VoicePill.jsx → chat/VoicePill.jsx} +3 -2
  496. package/src/renderer/shared/components/{CliSessionsView.test.tsx → extensions/CliSessionsView.test.tsx} +2 -2
  497. package/src/renderer/shared/components/{CliSessionsView.tsx → extensions/CliSessionsView.tsx} +14 -12
  498. package/src/renderer/shared/components/{LinkedFoldersView.tsx → extensions/LinkedFoldersView.tsx} +3 -3
  499. package/src/renderer/shared/components/{McpRegistryPicker.tsx → extensions/McpRegistryPicker.tsx} +3 -3
  500. package/src/renderer/shared/components/{McpServersView.tsx → extensions/McpServersView.tsx} +105 -36
  501. package/src/renderer/shared/components/{McpToolAllowlist.tsx → extensions/McpToolAllowlist.tsx} +2 -2
  502. package/src/renderer/shared/components/{ModUi.test.tsx → extensions/ModUi.test.tsx} +9 -4
  503. package/src/renderer/shared/components/{ModsPanel.tsx → extensions/ModsPanel.tsx} +59 -7
  504. package/src/renderer/shared/components/{PluginsView.tsx → extensions/PluginsView.tsx} +6 -6
  505. package/src/renderer/shared/components/{ScheduledTasksView.tsx → extensions/ScheduledTasksView.tsx} +5 -5
  506. package/src/renderer/shared/components/extensions/SkillsView.test.tsx +31 -0
  507. package/src/renderer/shared/components/{SkillsView.tsx → extensions/SkillsView.tsx} +20 -4
  508. package/src/renderer/shared/components/{ImageStudioPanel.tsx → studio/ImageStudioPanel.tsx} +6 -6
  509. package/src/renderer/shared/components/{LibraryItemCard.tsx → studio/LibraryItemCard.tsx} +2 -2
  510. package/src/renderer/shared/components/{LibraryPage.tsx → studio/LibraryPage.tsx} +5 -5
  511. package/src/renderer/shared/components/{LibraryPreview.tsx → studio/LibraryPreview.tsx} +2 -2
  512. package/src/renderer/shared/components/{VeoStudioPanel.tsx → studio/VeoStudioPanel.tsx} +7 -7
  513. package/src/renderer/shared/components/{GlideSelect.css → ui/GlideSelect.css} +7 -6
  514. package/src/renderer/shared/components/ui/ProviderBrandIcon.test.tsx +67 -0
  515. package/src/renderer/shared/components/ui/ProviderBrandIcon.tsx +167 -0
  516. package/src/renderer/shared/components/ui/SelectField.tsx +506 -0
  517. package/src/renderer/shared/components/ui/error-recovery.css +10 -10
  518. package/src/renderer/shared/components/ui/error-recovery.tsx +1 -1
  519. package/src/renderer/shared/components/{ArtifactPreviewPanel.tsx → workspace/ArtifactPreviewPanel.tsx} +256 -112
  520. package/src/renderer/shared/components/workspace/BackgroundTerminals.test.tsx +63 -0
  521. package/src/renderer/shared/components/{BackgroundTerminals.tsx → workspace/BackgroundTerminals.tsx} +40 -9
  522. package/src/renderer/shared/components/{CodeReviewPage.tsx → workspace/CodeReviewPage.tsx} +47 -8
  523. package/src/renderer/shared/components/{GitBranchSelector.tsx → workspace/GitBranchSelector.tsx} +2 -2
  524. package/src/renderer/shared/components/workspace/SessionSources.tsx +113 -0
  525. package/src/renderer/shared/components/{TerminalDock.tsx → workspace/TerminalDock.tsx} +5 -2
  526. package/src/renderer/shared/components/workspace/ToolSurfacePage.test.tsx +68 -0
  527. package/src/renderer/shared/components/{ToolSurfacePage.tsx → workspace/ToolSurfacePage.tsx} +322 -71
  528. package/src/renderer/shared/components/{ToolsPanelToggle.tsx → workspace/ToolsPanelToggle.tsx} +1 -1
  529. package/src/renderer/shared/components/workspace/WorkspaceFileInfo.tsx +28 -0
  530. package/src/renderer/shared/components/workspace/WorkspaceMediaPreview.tsx +17 -0
  531. package/src/renderer/shared/components/{WorkspacePaneResizer.tsx → workspace/WorkspacePaneResizer.tsx} +1 -1
  532. package/src/renderer/shared/components/workspace/WorkspacePdfPreview.tsx +89 -0
  533. package/src/renderer/shared/components/{WorkspacePreviewActions.test.tsx → workspace/WorkspacePreviewActions.test.tsx} +48 -3
  534. package/src/renderer/shared/components/{WorkspacePreviewActions.tsx → workspace/WorkspacePreviewActions.tsx} +3 -3
  535. package/src/renderer/shared/components/{WorkspaceSelector.tsx → workspace/WorkspaceSelector.tsx} +99 -7
  536. package/src/renderer/shared/components/{workspace-selector.css → workspace/workspace-selector.css} +84 -2
  537. package/src/renderer/shared/constants/config.ts +7 -0
  538. package/src/renderer/shared/conversation/coordinator.test.ts +46 -0
  539. package/src/renderer/shared/conversation/coordinator.ts +50 -2
  540. package/src/renderer/shared/conversation/lifecycle.test.ts +163 -1
  541. package/src/renderer/shared/conversation/lifecycle.ts +164 -7
  542. package/src/renderer/shared/conversation/projectNavigation.test.ts +18 -0
  543. package/src/renderer/shared/conversation/projectNavigation.ts +11 -0
  544. package/src/renderer/shared/conversation/transport.test.ts +20 -0
  545. package/src/renderer/shared/conversation/transport.ts +51 -9
  546. package/src/renderer/shared/conversation/useConversationCoordinator.ts +42 -12
  547. package/src/renderer/shared/css/agent-observability.css +72 -11
  548. package/src/renderer/shared/css/chat-ui-cards.css +35 -35
  549. package/src/renderer/shared/css/code-review.css +86 -86
  550. package/src/renderer/shared/css/code-sessions.css +10 -10
  551. package/src/renderer/shared/css/file-changes.css +167 -5
  552. package/src/renderer/shared/css/management-views.css +78 -37
  553. package/src/renderer/shared/css/mcp-results.css +46 -3
  554. package/src/renderer/shared/css/queued-messages.css +221 -0
  555. package/src/renderer/shared/css/session-sources.css +12 -7
  556. package/src/renderer/shared/css/settings/agents.css +2 -2
  557. package/src/renderer/{src-web → shared}/css/settings/base.css +101 -107
  558. package/src/renderer/shared/css/settings/general.css +384 -92
  559. package/src/renderer/shared/css/settings/plugins.css +8 -8
  560. package/src/renderer/shared/css/settings/theme.css +44 -32
  561. package/src/renderer/shared/css/ui-tailwind.css +2 -2
  562. package/src/renderer/shared/css/viewed-images.css +89 -0
  563. package/src/renderer/shared/css/workspace-file-info.css +12 -0
  564. package/src/renderer/shared/css/workspace-media-preview.css +13 -0
  565. package/src/renderer/shared/env.d.ts +9 -0
  566. package/src/renderer/shared/platform.test.ts +143 -0
  567. package/src/renderer/shared/platform.ts +10 -4
  568. package/src/renderer/shared/speech/player.ts +160 -0
  569. package/src/renderer/shared/speech/types.ts +11 -0
  570. package/src/renderer/shared/theme/themeManager.test.ts +20 -0
  571. package/src/renderer/shared/theme/themeManager.ts +3 -1
  572. package/src/renderer/shared/theme/themes.ts +17 -4
  573. package/src/renderer/shared/theme/tokens.css +448 -51
  574. package/src/renderer/shared/types.ts +56 -1
  575. package/src/renderer/shared/utils/agentActivity.test.ts +165 -6
  576. package/src/renderer/shared/utils/agentActivity.ts +181 -31
  577. package/src/renderer/shared/utils/artifactBrowser.ts +1 -1
  578. package/src/renderer/shared/utils/artifacts.ts +55 -0
  579. package/src/renderer/shared/utils/contextCompaction.test.tsx +1 -1
  580. package/src/renderer/shared/utils/externalLinks.ts +91 -0
  581. package/src/renderer/shared/utils/lazyWithRetry.ts +13 -0
  582. package/src/renderer/shared/utils/markdown.tsx +169 -35
  583. package/src/renderer/shared/utils/markdown.webImages.test.tsx +124 -2
  584. package/src/renderer/shared/utils/mcpResults.test.tsx +24 -1
  585. package/src/renderer/shared/utils/pdfRange.ts +16 -0
  586. package/src/renderer/shared/utils/previewObjectUrls.ts +20 -0
  587. package/src/renderer/shared/utils/sessionSources.test.ts +41 -1
  588. package/src/renderer/shared/utils/sessionSources.ts +2 -0
  589. package/src/renderer/shared/utils/slashCommandProcessor.ts +4 -1
  590. package/src/renderer/shared/utils/speech.ts +18 -4
  591. package/src/renderer/shared/utils/useNativeVoiceInput.ts +19 -5
  592. package/src/renderer/shared/utils/useSessionSources.ts +4 -0
  593. package/src/renderer/shared/utils/viewedImages.test.ts +129 -0
  594. package/src/renderer/shared/utils/viewedImages.ts +81 -10
  595. package/src/renderer/shared/utils/workspaceDrag.ts +30 -0
  596. package/src/renderer/shared/utils/workspaceImage.ts +17 -0
  597. package/src/renderer/shared/utils/workspaceListPreferences.test.ts +64 -0
  598. package/src/renderer/shared/utils/workspaceListPreferences.ts +54 -0
  599. package/src/renderer/shared/utils/workspaceMedia.ts +41 -0
  600. package/src/renderer/shared/utils/workspacePreview.test.ts +147 -2
  601. package/src/renderer/shared/utils/workspacePreview.ts +34 -3
  602. package/src/renderer/shared/utils/workspaces.ts +3 -2
  603. package/src/renderer/src/App.tsx +6 -8
  604. package/src/renderer/src/components/ChatPanel.tsx +1 -1
  605. package/src/renderer/src/components/DashboardSidebar.tsx +2 -2
  606. package/src/renderer/src/components/ImageStudioPanel.tsx +1 -1
  607. package/src/renderer/src/components/LiveTranslateControls.tsx +1 -1
  608. package/src/renderer/src/components/MintDashboard.tsx +1 -1
  609. package/src/renderer/src/components/ProactiveGlow.tsx +1 -1
  610. package/src/renderer/src/components/ScreenPicker.tsx +1 -1
  611. package/src/renderer/src/components/SettingsWindow.tsx +6 -830
  612. package/src/renderer/src/components/SpotlightWindow.tsx +4 -32
  613. package/src/renderer/src/components/VeoStudioPanel.tsx +1 -1
  614. package/src/renderer/src/components/WorkspacePanel.tsx +45 -12
  615. package/src/renderer/src/components/browser-shell.css +26 -26
  616. package/src/renderer/src/components/browser-suggestions-popup.css +8 -8
  617. package/src/renderer/src/css/app-shell.css +22 -102
  618. package/src/renderer/src/css/chat.css +221 -34
  619. package/src/renderer/src/css/desktop-tools.css +6 -337
  620. package/src/renderer/src/css/sidebar-workspace.css +20 -0
  621. package/src/renderer/src/css/spotlight.css +2 -2
  622. package/src/renderer/src/css/tool-surfaces.css +328 -58
  623. package/src/renderer/src/css/widget.css +6 -5
  624. package/src/renderer/src/env.d.ts +13 -0
  625. package/src/renderer/src/index.css +15 -63
  626. package/src/renderer/src/tauri.ts +77 -11
  627. package/src/renderer/src/voiceInput.ts +3 -1
  628. package/src/renderer/src-web/App.tsx +6 -8
  629. package/src/renderer/src-web/components/ChatPanel.tsx +1 -1
  630. package/src/renderer/src-web/components/DashboardSidebar.tsx +2 -2
  631. package/src/renderer/src-web/components/ImageStudioPanel.tsx +1 -1
  632. package/src/renderer/src-web/components/MintDashboard.tsx +1 -1
  633. package/src/renderer/src-web/components/SettingsWindow.tsx +6 -851
  634. package/src/renderer/src-web/components/VeoStudioPanel.tsx +1 -1
  635. package/src/renderer/src-web/css/app-shell.css +16 -100
  636. package/src/renderer/src-web/css/chat.css +221 -34
  637. package/src/renderer/src-web/css/sidebar-workspace.css +20 -0
  638. package/src/renderer/src-web/env.d.ts +14 -0
  639. package/src/renderer/src-web/index.css +15 -63
  640. package/src/renderer/src-web/tauri.ts +71 -13
  641. package/src/renderer/tests/browserArtifacts.browser.html +1 -0
  642. package/src/renderer/tests/browserArtifacts.browser.tsx +68 -0
  643. package/src/renderer/tests/chatEscape.browser.html +1 -0
  644. package/src/renderer/tests/chatEscape.browser.tsx +25 -0
  645. package/src/renderer/tests/chatPerformance.browser.html +1 -1
  646. package/src/renderer/tests/collapsedPaste.browser.html +1 -1
  647. package/src/renderer/tests/composerMenus.browser.html +3 -3
  648. package/src/renderer/tests/contextCompaction.browser.html +1 -1
  649. package/src/renderer/tests/errorRecovery.browser.html +1 -1
  650. package/src/renderer/tests/fixtures/preview.webm +0 -0
  651. package/src/renderer/tests/glideSelect.browser.html +1 -2
  652. package/src/renderer/tests/glideSelect.preview.html +1 -1
  653. package/src/renderer/tests/library.browser.tsx +1 -1
  654. package/src/renderer/tests/liveOrb.browser.html +1 -1
  655. package/src/renderer/tests/mediaFixtures.ts +32 -0
  656. package/src/renderer/tests/modInput.browser.html +1 -1
  657. package/src/renderer/tests/sessionSources.browser.tsx +76 -15
  658. package/src/renderer/tests/toolsPanel.browser.tsx +5 -5
  659. package/src/renderer/tests/viewedImages.browser.tsx +3 -3
  660. package/src/renderer/tests/voiceDictation.browser.html +101 -0
  661. package/src/renderer/tests/voicePill.browser.html +3 -3
  662. package/src/renderer/tests/voicePill.preview.html +1 -1
  663. package/src/renderer/tests/webSources.browser.tsx +2 -98
  664. package/src/renderer/tests/workspaceDrop.browser.html +1 -0
  665. package/src/renderer/tests/workspaceDrop.browser.tsx +183 -0
  666. package/src/renderer/tests/workspaceExpansion.browser.html +1 -0
  667. package/src/renderer/tests/workspaceExpansion.browser.tsx +66 -0
  668. package/src/renderer/tests/workspaceRemoval.browser.html +66 -0
  669. package/src/renderer/tests/workspaceUndo.browser.html +10 -2
  670. package/src-tauri/src/app/lifecycle.rs +44 -1
  671. package/src-tauri/src/commands/conversation.rs +99 -73
  672. package/src-tauri/src/commands/integrations.rs +7 -1
  673. package/src-tauri/src/commands/media.rs +7 -0
  674. package/src-tauri/src/commands/workspace.rs +38 -0
  675. package/tsconfig.json +15 -1
  676. package/vite.config.ts +2 -1
  677. package/vite.config.web.ts +2 -0
  678. package/out/web/assets/CliSessionsView-D7hw0Mgj.js +0 -1
  679. package/out/web/assets/CodeReviewPage-C7bEOJfd.js +0 -4
  680. package/out/web/assets/CodeReviewPage-Dte9uLiL.css +0 -1
  681. package/out/web/assets/CommandPalette-0RrF-AOT.js +0 -1
  682. package/out/web/assets/ImageStudioPanel-CdxkAf_r.js +0 -1
  683. package/out/web/assets/LibraryPage--Qfisp6D.js +0 -2
  684. package/out/web/assets/LinkedFoldersView-2nfZbDgN.js +0 -1
  685. package/out/web/assets/McpRegistryPicker-h9uS8_wT.js +0 -1
  686. package/out/web/assets/McpServersView-slfQJzNB.js +0 -1
  687. package/out/web/assets/MintDashboard-BSR5XpXh.js +0 -25
  688. package/out/web/assets/MintDashboard-CWUcCGhd.css +0 -1
  689. package/out/web/assets/PluginsView-l7LSm503.js +0 -1
  690. package/out/web/assets/ScheduledTasksView-CttmLbq1.js +0 -1
  691. package/out/web/assets/SettingsWindow-BCMLYvEV.js +0 -4
  692. package/out/web/assets/SettingsWindow-DcMVmU9u.css +0 -1
  693. package/out/web/assets/SkillsView-rNs1qr_U.js +0 -2
  694. package/out/web/assets/ToolSurfacePage-B9DzEPWN.js +0 -37
  695. package/out/web/assets/ToolSurfacePage-CTfgggF2.css +0 -1
  696. package/out/web/assets/VeoStudioPanel-DiJs_Cg2.js +0 -4
  697. package/out/web/assets/WorkspacePanel-CbJ1PFoZ.js +0 -1
  698. package/out/web/assets/WorkspaceSelector-B2xIp04D.js +0 -1
  699. package/out/web/assets/WorkspaceSelector-Ca8uJOsS.css +0 -1
  700. package/out/web/assets/abnfDiagram-VCTEODGH-CD0CjoGl.js +0 -1
  701. package/out/web/assets/architecture-7GRP2DOG-RKV83OeZ.js +0 -1
  702. package/out/web/assets/architectureDiagram-5GKGNRK7-nN_HAFct.js +0 -36
  703. package/out/web/assets/c4Diagram-UCG6FXSJ-DTdV8_zE.js +0 -38
  704. package/out/web/assets/chunk-2Q5K7J3B-Dmqrq8Tp.js +0 -1
  705. package/out/web/assets/chunk-75Z2AOVW-_M0z5olV.js +0 -2
  706. package/out/web/assets/chunk-CKBBP62Z-BpQEgeHF.js +0 -2
  707. package/out/web/assets/chunk-CLGD4ZFX-D54yGvGS.js +0 -1
  708. package/out/web/assets/chunk-CacB07dV.js +0 -1
  709. package/out/web/assets/chunk-DSNCTWBM-C-gvT2ru.js +0 -2
  710. package/out/web/assets/chunk-DU6HZSFF-CnFngIhW.js +0 -128
  711. package/out/web/assets/chunk-F27PBJKO-BqtWrnEO.js +0 -1
  712. package/out/web/assets/chunk-FOHPRMQF-BaVC1uA7.js +0 -161
  713. package/out/web/assets/chunk-G27WJ6UU-Ckoq5mi2.js +0 -231
  714. package/out/web/assets/chunk-JQ64N6SF-CF8T7GiZ.js +0 -1
  715. package/out/web/assets/chunk-JWPE2WC7-BwtYOHqU.js +0 -1
  716. package/out/web/assets/chunk-LNGE3PJU-AdBoOWw2.js +0 -34
  717. package/out/web/assets/chunk-OBVCFTLP-CRIkunUB.js +0 -1
  718. package/out/web/assets/chunk-P2QGCYS3-UFEU6BxZ.js +0 -1
  719. package/out/web/assets/chunk-POPQ4Y6H-CQcrNbjr.js +0 -1
  720. package/out/web/assets/chunk-PWAF6VOD-Cc2uVDsG.js +0 -1
  721. package/out/web/assets/chunk-R7TYR2AO-DiCxzdAY.js +0 -10
  722. package/out/web/assets/chunk-RHFEMEQ7-b7hnPmrR.js +0 -168
  723. package/out/web/assets/chunk-XXDRQBXY-DnJkbUaw.js +0 -1
  724. package/out/web/assets/chunk-Y2CYZVJY-C9o-s6OY.js +0 -1
  725. package/out/web/assets/classDiagram-DTDB5LWJ-RnC2mYO4.js +0 -1
  726. package/out/web/assets/classDiagram-v2-JRS7N3AN-RnC2mYO4.js +0 -1
  727. package/out/web/assets/config-CnvCChUM.js +0 -2
  728. package/out/web/assets/config-DM6oIVO3.css +0 -1
  729. package/out/web/assets/core-DsKkQ7ig.js +0 -1
  730. package/out/web/assets/cose-bilkent-JH36ORCC--UN4aw5-.js +0 -1
  731. package/out/web/assets/cynefin-OW5HDTMX-CnzQfOGp.js +0 -1
  732. package/out/web/assets/cynefinDiagram-5FMLGOSQ-DVtQnfpm.js +0 -62
  733. package/out/web/assets/cytoscape.esm-Df1UN4Y1.js +0 -321
  734. package/out/web/assets/dagre-3AP2YEHR-DG76_k5_.js +0 -4
  735. package/out/web/assets/dagre-BWadQu2F.js +0 -1
  736. package/out/web/assets/diagram-S7CK7UJ4-CaouUoze.js +0 -30
  737. package/out/web/assets/diagram-UQ7AKVKN-B4bEc26B.js +0 -41
  738. package/out/web/assets/diagram-VX7I27RA-7hH5IPYf.js +0 -24
  739. package/out/web/assets/diagram-Z3DM3KII-CCM4clo8.js +0 -24
  740. package/out/web/assets/dist-BoTOASLF.js +0 -1
  741. package/out/web/assets/dist-js-BkYNznHX.js +0 -1
  742. package/out/web/assets/ebnfDiagram-PWID7BFC-Da7WAM3k.js +0 -1
  743. package/out/web/assets/event-Cdt7Byyj.js +0 -1
  744. package/out/web/assets/eventmodeling-NTZA5JFV-xcfsA0XD.js +0 -1
  745. package/out/web/assets/flowDiagram-A5DVABFB-JdtH1673.js +0 -1
  746. package/out/web/assets/ganttDiagram-EL5Y4UJY-B3ClFGmL.js +0 -292
  747. package/out/web/assets/gitGraph-4MIJSDKK-BZ_y_cDU.js +0 -1
  748. package/out/web/assets/gitGraphDiagram-WWUBYQGX-drhRSYm3.js +0 -106
  749. package/out/web/assets/graphlib-CTR5ZhLf.js +0 -1
  750. package/out/web/assets/index-BZ9xgmMP.css +0 -1
  751. package/out/web/assets/index-Ca8cCS4h.js +0 -168
  752. package/out/web/assets/info-A6RAGUB7-B7I3K0F1.js +0 -1
  753. package/out/web/assets/infoDiagram-RXCK75RN-deX_1MPh.js +0 -2
  754. package/out/web/assets/journeyDiagram-EYS64GPL-CZn2kB8b.js +0 -139
  755. package/out/web/assets/jsx-runtime-DN4NhQUK.js +0 -1
  756. package/out/web/assets/katex-O3jvqgnU.js +0 -257
  757. package/out/web/assets/markdown-CMhYIcWB.js +0 -39
  758. package/out/web/assets/mermaid-parser.core-Whu2rlJC.js +0 -7
  759. package/out/web/assets/mermaid.core-CKyPo8VH.js +0 -11
  760. package/out/web/assets/modelManager-CUaGWMWu.js +0 -2
  761. package/out/web/assets/oauthManager-DlNhXJr6.js +0 -1
  762. package/out/web/assets/packet-AYTQ26CC-CEeIRKRG.js +0 -1
  763. package/out/web/assets/pegDiagram-XKGWAZYB-BYadI-KO.js +0 -1
  764. package/out/web/assets/pie-WAS4IAKB-D8uf4dh5.js +0 -1
  765. package/out/web/assets/pieDiagram-E7YTZNPT-CjSDy4hO.js +0 -39
  766. package/out/web/assets/radar-RG4KPBEZ-DZJxnokY.js +0 -1
  767. package/out/web/assets/railroad-74A4TZTK-DBysUiUi.js +0 -1
  768. package/out/web/assets/railroad-abnf-HS5TGJTU-CHWxoJYg.js +0 -1
  769. package/out/web/assets/railroad-ebnf-LZEXJU2U-DDv7X6bY.js +0 -1
  770. package/out/web/assets/railroad-peg-WCYAUIDC-DpfcYYNJ.js +0 -1
  771. package/out/web/assets/railroadDiagram-O6MQD6OU-CYtyv0t3.js +0 -1
  772. package/out/web/assets/rough.esm-DFbTUy8a.js +0 -1
  773. package/out/web/assets/sankeyDiagram-P5KCCOFB-Bn2x6C4Y.js +0 -40
  774. package/out/web/assets/sequenceDiagram-WJ2MYXX4-BvFLKtPd.js +0 -162
  775. package/out/web/assets/sizeCapture-X5ZJPWSS-DKeOCaN2.js +0 -1
  776. package/out/web/assets/src-DnfeXQPr.js +0 -1
  777. package/out/web/assets/stateDiagram-HBIQ2CUA-Bx0GWeaY.js +0 -1
  778. package/out/web/assets/stateDiagram-v2-4QOOHH4V--hol1yg_.js +0 -1
  779. package/out/web/assets/studio-B1mk40wD.js +0 -1
  780. package/out/web/assets/swimlanes-XN3QIQJK-CCma0T7L.js +0 -1
  781. package/out/web/assets/swimlanesDiagram-VK2B7HYN-BkohoVsU.js +0 -8
  782. package/out/web/assets/timeline-definition-24CTP7MA-iCRhhJ7C.js +0 -120
  783. package/out/web/assets/treeView-Q6P3EWNA-DZ-y08qp.js +0 -1
  784. package/out/web/assets/treemap-WGGIJYW6-De0CxzMx.js +0 -1
  785. package/out/web/assets/vennDiagram-4TSXK5OY-w_7aZ6xe.js +0 -34
  786. package/out/web/assets/wardley-WFR3VGLG-DT0y0xJ4.js +0 -1
  787. package/out/web/assets/window-BJCVtyET.js +0 -1
  788. package/src/renderer/shared/components/ChatPanel.test.tsx +0 -21
  789. package/src/renderer/shared/components/FormattedMessage.tsx +0 -11
  790. package/src/renderer/shared/components/GlideSelect.d.ts +0 -31
  791. package/src/renderer/shared/components/GlideSelect.jsx +0 -266
  792. package/src/renderer/shared/components/InlineThoughtNote.tsx +0 -27
  793. package/src/renderer/shared/components/ModSessionControls.tsx +0 -8
  794. package/src/renderer/shared/components/ModUi.tsx +0 -26
  795. package/src/renderer/shared/components/ProgressActivity.tsx +0 -17
  796. package/src/renderer/shared/components/ReviewHistory.tsx +0 -42
  797. package/src/renderer/shared/components/RunSummaryDashboard.tsx +0 -143
  798. package/src/renderer/shared/components/SelectField.tsx +0 -38
  799. package/src/renderer/shared/components/SessionSources.tsx +0 -48
  800. package/src/renderer/shared/components/SessionSourcesPopover.tsx +0 -61
  801. package/src/renderer/shared/components/ToolSurfacePage.test.tsx +0 -32
  802. package/src/renderer/shared/components/ViewedImages.tsx +0 -36
  803. package/src/renderer/shared/components/WorkspaceContextPopover.tsx +0 -138
  804. package/src/renderer/shared/components/ui/demo.tsx +0 -26
  805. package/src/renderer/shared/css/session-sources-popover.css +0 -9
  806. package/src/renderer/src/components/CalculationCard.tsx +0 -3
  807. package/src/renderer/src/components/ImageGenCard.tsx +0 -2
  808. package/src/renderer/src/components/ImageSearchCard.tsx +0 -2
  809. package/src/renderer/src/components/MermaidCard.tsx +0 -1
  810. package/src/renderer/src/components/PicturesLibrary.tsx +0 -2
  811. package/src/renderer/src/components/Settings/AgentsTab.tsx +0 -4
  812. package/src/renderer/src/components/Settings/AudioTab.tsx +0 -3
  813. package/src/renderer/src/components/Settings/AutomationTab.tsx +0 -3
  814. package/src/renderer/src/components/Settings/GeneralTab.tsx +0 -3
  815. package/src/renderer/src/components/Settings/MemoryTab.tsx +0 -3
  816. package/src/renderer/src/components/Settings/PluginsTab.tsx +0 -3
  817. package/src/renderer/src/components/Settings/ProfileTab.tsx +0 -3
  818. package/src/renderer/src/components/Settings/ShortcutsTab.tsx +0 -3
  819. package/src/renderer/src/components/Settings/ThemeTab.tsx +0 -3
  820. package/src/renderer/src/components/StockCard.tsx +0 -3
  821. package/src/renderer/src/components/WeatherCard.tsx +0 -3
  822. package/src/renderer/src/css/pictures.css +0 -2
  823. package/src/renderer/src/css/settings/base.css +0 -1266
  824. package/src/renderer/src-web/components/PicturesLibrary.tsx +0 -2
  825. package/src/renderer/src-web/components/Settings/AgentsTab.tsx +0 -4
  826. package/src/renderer/src-web/components/Settings/AudioTab.tsx +0 -3
  827. package/src/renderer/src-web/components/Settings/AutomationTab.tsx +0 -3
  828. package/src/renderer/src-web/components/Settings/GeneralTab.tsx +0 -3
  829. package/src/renderer/src-web/components/Settings/MemoryTab.tsx +0 -3
  830. package/src/renderer/src-web/components/Settings/PluginsTab.tsx +0 -3
  831. package/src/renderer/src-web/components/Settings/ProfileTab.tsx +0 -3
  832. package/src/renderer/src-web/components/Settings/ShortcutsTab.tsx +0 -3
  833. package/src/renderer/src-web/components/Settings/ThemeTab.tsx +0 -3
  834. package/src/renderer/src-web/css/pictures.css +0 -2
  835. package/src/renderer/src-web/css/spotlight.css +0 -102
  836. package/src/renderer/src-web/css/widget.css +0 -213
  837. /package/src/renderer/shared/components/{UiMockupWidget.tsx → cards/UiMockupWidget.tsx} +0 -0
  838. /package/src/renderer/shared/components/{ContextCompactionStatus.tsx → chat/ContextCompactionStatus.tsx} +0 -0
  839. /package/src/renderer/shared/components/{GeminiLiveOverlay.css → chat/GeminiLiveOverlay.css} +0 -0
  840. /package/src/renderer/shared/components/{GeminiLiveOverlay.test.tsx → chat/GeminiLiveOverlay.test.tsx} +0 -0
  841. /package/src/renderer/shared/components/{SlashSuggestions.test.tsx → chat/SlashSuggestions.test.tsx} +0 -0
  842. /package/src/renderer/shared/components/{VirtualChatHistory.tsx → chat/VirtualChatHistory.tsx} +0 -0
  843. /package/src/renderer/shared/components/{VoicePill.d.ts → chat/VoicePill.d.ts} +0 -0
  844. /package/src/renderer/shared/components/{VoicePill.test.tsx → chat/VoicePill.test.tsx} +0 -0
  845. /package/src/renderer/shared/components/{ScreenCaptureDialog.css → studio/ScreenCaptureDialog.css} +0 -0
  846. /package/src/renderer/shared/components/{ScreenCaptureDialog.tsx → studio/ScreenCaptureDialog.tsx} +0 -0
  847. /package/src/renderer/shared/components/{SelectField.test.tsx → ui/SelectField.test.tsx} +0 -0
  848. /package/src/renderer/shared/components/{background-terminals.css → workspace/background-terminals.css} +0 -0
@@ -1 +0,0 @@
1
- import{i as e,n as t,t as n}from"./chunk-CacB07dV.js";import{n as r,r as i}from"./chunk-Y2CYZVJY-C9o-s6OY.js";var a=n(((e,t)=>{(function(n,r){typeof e==`object`&&t!==void 0?t.exports=r():typeof define==`function`&&define.amd?define(r):(n=typeof globalThis<`u`?globalThis:n||self).dayjs=r()})(e,(function(){var e=1e3,t=6e4,n=36e5,r=`millisecond`,i=`second`,a=`minute`,o=`hour`,s=`day`,c=`week`,l=`month`,u=`quarter`,d=`year`,f=`date`,p=`Invalid Date`,m=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,h=/\[([^\]]+)]|YYYY|YY|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,g={name:`en`,weekdays:`Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday`.split(`_`),months:`January_February_March_April_May_June_July_August_September_October_November_December`.split(`_`),ordinal:function(e){var t=[`th`,`st`,`nd`,`rd`],n=e%100;return`[`+e+(t[(n-20)%10]||t[n]||t[0])+`]`}},_=function(e,t,n){var r=String(e);return!r||r.length>=t?e:``+Array(t+1-r.length).join(n)+e},v={s:_,z:function(e){var t=-e.utcOffset(),n=Math.abs(t),r=Math.floor(n/60),i=n%60;return(t<=0?`+`:`-`)+_(r,2,`0`)+`:`+_(i,2,`0`)},m:function e(t,n){if(t.date()<n.date())return-e(n,t);var r=12*(n.year()-t.year())+(n.month()-t.month()),i=t.clone().add(r,l),a=n-i<0,o=t.clone().add(r+(a?-1:1),l);return+(-(r+(n-i)/(a?i-o:o-i))||0)},a:function(e){return e<0?Math.ceil(e)||0:Math.floor(e)},p:function(e){return{M:l,y:d,w:c,d:s,D:f,h:o,m:a,s:i,ms:r,Q:u}[e]||String(e||``).toLowerCase().replace(/s$/,``)},u:function(e){return e===void 0}},y=`en`,b={};b[y]=g;var x=`$isDayjsObject`,S=function(e){return e instanceof E||!(!e||!e[x])},C=function e(t,n,r){var i;if(!t)return y;if(typeof t==`string`){var a=t.toLowerCase();b[a]&&(i=a),n&&(b[a]=n,i=a);var o=t.split(`-`);if(!i&&o.length>1)return e(o[0])}else{var s=t.name;b[s]=t,i=s}return!r&&i&&(y=i),i||!r&&y},w=function(e,t){if(S(e))return e.clone();var n=typeof t==`object`?t:{};return n.date=e,n.args=arguments,new E(n)},T=v;T.l=C,T.i=S,T.w=function(e,t){return w(e,{locale:t.$L,utc:t.$u,x:t.$x,$offset:t.$offset})};var E=function(){function g(e){this.$L=C(e.locale,null,!0),this.parse(e),this.$x=this.$x||e.x||{},this[x]=!0}var _=g.prototype;return _.parse=function(e){this.$d=function(e){var t=e.date,n=e.utc;if(t===null)return new Date(NaN);if(T.u(t))return new Date;if(t instanceof Date)return new Date(t);if(typeof t==`string`&&!/Z$/i.test(t)){var r=t.match(m);if(r){var i=r[2]-1||0,a=(r[7]||`0`).substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,a)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,a)}}return new Date(t)}(e),this.init()},_.init=function(){var e=this.$d;this.$y=e.getFullYear(),this.$M=e.getMonth(),this.$D=e.getDate(),this.$W=e.getDay(),this.$H=e.getHours(),this.$m=e.getMinutes(),this.$s=e.getSeconds(),this.$ms=e.getMilliseconds()},_.$utils=function(){return T},_.isValid=function(){return this.$d.toString()!==p},_.isSame=function(e,t){var n=w(e);return this.startOf(t)<=n&&n<=this.endOf(t)},_.isAfter=function(e,t){return w(e)<this.startOf(t)},_.isBefore=function(e,t){return this.endOf(t)<w(e)},_.$g=function(e,t,n){return T.u(e)?this[t]:this.set(n,e)},_.unix=function(){return Math.floor(this.valueOf()/1e3)},_.valueOf=function(){return this.$d.getTime()},_.startOf=function(e,t){var n=this,r=!!T.u(t)||t,u=T.p(e),p=function(e,t){var i=T.w(n.$u?Date.UTC(n.$y,t,e):new Date(n.$y,t,e),n);return r?i:i.endOf(s)},m=function(e,t){return T.w(n.toDate()[e].apply(n.toDate(`s`),(r?[0,0,0,0]:[23,59,59,999]).slice(t)),n)},h=this.$W,g=this.$M,_=this.$D,v=`set`+(this.$u?`UTC`:``);switch(u){case d:return r?p(1,0):p(31,11);case l:return r?p(1,g):p(0,g+1);case c:var y=this.$locale().weekStart||0,b=(h<y?h+7:h)-y;return p(r?_-b:_+(6-b),g);case s:case f:return m(v+`Hours`,0);case o:return m(v+`Minutes`,1);case a:return m(v+`Seconds`,2);case i:return m(v+`Milliseconds`,3);default:return this.clone()}},_.endOf=function(e){return this.startOf(e,!1)},_.$set=function(e,t){var n,c=T.p(e),u=`set`+(this.$u?`UTC`:``),p=(n={},n[s]=u+`Date`,n[f]=u+`Date`,n[l]=u+`Month`,n[d]=u+`FullYear`,n[o]=u+`Hours`,n[a]=u+`Minutes`,n[i]=u+`Seconds`,n[r]=u+`Milliseconds`,n)[c],m=c===s?this.$D+(t-this.$W):t;if(c===l||c===d){var h=this.clone().set(f,1);h.$d[p](m),h.init(),this.$d=h.set(f,Math.min(this.$D,h.daysInMonth())).$d}else p&&this.$d[p](m);return this.init(),this},_.set=function(e,t){return this.clone().$set(e,t)},_.get=function(e){return this[T.p(e)]()},_.add=function(r,u){var f,p=this;r=Number(r);var m=T.p(u),h=function(e){var t=w(p);return T.w(t.date(t.date()+Math.round(e*r)),p)};if(m===l)return this.set(l,this.$M+r);if(m===d)return this.set(d,this.$y+r);if(m===s)return h(1);if(m===c)return h(7);var g=(f={},f[a]=t,f[o]=n,f[i]=e,f)[m]||1,_=this.$d.getTime()+r*g;return T.w(_,this)},_.subtract=function(e,t){return this.add(-1*e,t)},_.format=function(e){var t=this,n=this.$locale();if(!this.isValid())return n.invalidDate||p;var r=e||`YYYY-MM-DDTHH:mm:ssZ`,i=T.z(this),a=this.$H,o=this.$m,s=this.$M,c=n.weekdays,l=n.months,u=n.meridiem,d=function(e,n,i,a){return e&&(e[n]||e(t,r))||i[n].slice(0,a)},f=function(e){return T.s(a%12||12,e,`0`)},m=u||function(e,t,n){var r=e<12?`AM`:`PM`;return n?r.toLowerCase():r};return r.replace(h,(function(e,r){return r||function(e){switch(e){case`YY`:return String(t.$y).slice(-2);case`YYYY`:return T.s(t.$y,4,`0`);case`M`:return s+1;case`MM`:return T.s(s+1,2,`0`);case`MMM`:return d(n.monthsShort,s,l,3);case`MMMM`:return d(l,s);case`D`:return t.$D;case`DD`:return T.s(t.$D,2,`0`);case`d`:return String(t.$W);case`dd`:return d(n.weekdaysMin,t.$W,c,2);case`ddd`:return d(n.weekdaysShort,t.$W,c,3);case`dddd`:return c[t.$W];case`H`:return String(a);case`HH`:return T.s(a,2,`0`);case`h`:return f(1);case`hh`:return f(2);case`a`:return m(a,o,!0);case`A`:return m(a,o,!1);case`m`:return String(o);case`mm`:return T.s(o,2,`0`);case`s`:return String(t.$s);case`ss`:return T.s(t.$s,2,`0`);case`SSS`:return T.s(t.$ms,3,`0`);case`Z`:return i}return null}(e)||i.replace(`:`,``)}))},_.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},_.diff=function(r,f,p){var m,h=this,g=T.p(f),_=w(r),v=(_.utcOffset()-this.utcOffset())*t,y=this-_,b=function(){return T.m(h,_)};switch(g){case d:m=b()/12;break;case l:m=b();break;case u:m=b()/3;break;case c:m=(y-v)/6048e5;break;case s:m=(y-v)/864e5;break;case o:m=y/n;break;case a:m=y/t;break;case i:m=y/e;break;default:m=y}return p?m:T.a(m)},_.daysInMonth=function(){return this.endOf(l).$D},_.$locale=function(){return b[this.$L]},_.locale=function(e,t){if(!e)return this.$L;var n=this.clone(),r=C(e,t,!0);return r&&(n.$L=r),n},_.clone=function(){return T.w(this.$d,this)},_.toDate=function(){return new Date(this.valueOf())},_.toJSON=function(){return this.isValid()?this.toISOString():null},_.toISOString=function(){return this.$d.toISOString()},_.toString=function(){return this.$d.toUTCString()},g}(),D=E.prototype;return w.prototype=D,[[`$ms`,r],[`$s`,i],[`$m`,a],[`$H`,o],[`$W`,s],[`$M`,l],[`$y`,d],[`$D`,f]].forEach((function(e){D[e[1]]=function(t){return this.$g(t,e[0],e[1])}})),w.extend=function(e,t){return e.$i||=(e(t,E,w),!0),w},w.locale=C,w.isDayjs=S,w.unix=function(e){return w(1e3*e)},w.en=b[y],w.Ls=b,w.p={},w}))})),o,s,c,l,u,d=t((()=>{i(),o=e(a(),1),s={trace:0,debug:1,info:2,warn:3,error:4,fatal:5},c={trace:r((...e)=>{},`trace`),debug:r((...e)=>{},`debug`),info:r((...e)=>{},`info`),warn:r((...e)=>{},`warn`),error:r((...e)=>{},`error`),fatal:r((...e)=>{},`fatal`)},l=r(function(e=`fatal`){let t=s.fatal;typeof e==`string`?e.toLowerCase()in s&&(t=s[e]):typeof e==`number`&&(t=e),c.trace=()=>{},c.debug=()=>{},c.info=()=>{},c.warn=()=>{},c.error=()=>{},c.fatal=()=>{},t<=s.fatal&&(c.fatal=console.error?console.error.bind(console,u(`FATAL`),`color: orange`):console.log.bind(console,`\x1B[35m`,u(`FATAL`))),t<=s.error&&(c.error=console.error?console.error.bind(console,u(`ERROR`),`color: orange`):console.log.bind(console,`\x1B[31m`,u(`ERROR`))),t<=s.warn&&(c.warn=console.warn?console.warn.bind(console,u(`WARN`),`color: orange`):console.log.bind(console,`\x1B[33m`,u(`WARN`))),t<=s.info&&(c.info=console.info?console.info.bind(console,u(`INFO`),`color: lightblue`):console.log.bind(console,`\x1B[34m`,u(`INFO`))),t<=s.debug&&(c.debug=console.debug?console.debug.bind(console,u(`DEBUG`),`color: lightgreen`):console.log.bind(console,`\x1B[32m`,u(`DEBUG`))),t<=s.trace&&(c.trace=console.debug?console.debug.bind(console,u(`TRACE`),`color: lightgreen`):console.log.bind(console,`\x1B[32m`,u(`TRACE`)))},`setLogLevel`),u=r(e=>`%c${(0,o.default)().format(`ss.SSS`)} : ${e} : `,`format`)}));function f(e,t){return e==null||t==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}var p=t((()=>{}));function m(e,t){return e==null||t==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}var h=t((()=>{}));function g(e){let t,n,r;e.length===2?(t=e===f||e===m?e:_,n=e,r=e):(t=f,n=(t,n)=>f(e(t),n),r=(t,n)=>e(t)-n);function i(e,r,i=0,a=e.length){if(i<a){if(t(r,r)!==0)return a;do{let t=i+a>>>1;n(e[t],r)<0?i=t+1:a=t}while(i<a)}return i}function a(e,r,i=0,a=e.length){if(i<a){if(t(r,r)!==0)return a;do{let t=i+a>>>1;n(e[t],r)<=0?i=t+1:a=t}while(i<a)}return i}function o(e,t,n=0,a=e.length){let o=i(e,t,n,a-1);return o>n&&r(e[o-1],t)>-r(e[o],t)?o-1:o}return{left:i,center:o,right:a}}function _(){return 0}var v=t((()=>{p(),h()}));function y(e){return e===null?NaN:+e}var b=t((()=>{})),x,S,C=t((()=>{p(),v(),b(),x=g(f),S=x.right,x.left,g(y).center}));function w({_intern:e,_key:t},n){let r=t(n);return e.has(r)?e.get(r):n}function T({_intern:e,_key:t},n){let r=t(n);return e.has(r)?e.get(r):(e.set(r,n),n)}function E({_intern:e,_key:t},n){let r=t(n);return e.has(r)&&(n=e.get(r),e.delete(r)),n}function D(e){return typeof e==`object`&&e?e.valueOf():e}var O,k=t((()=>{O=class extends Map{constructor(e,t=D){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:t}}),e!=null)for(let[t,n]of e)this.set(t,n)}get(e){return super.get(w(this,e))}has(e){return super.has(w(this,e))}set(e,t){return super.set(T(this,e),t)}delete(e){return super.delete(E(this,e))}}}));function A(e,t,n){let r=(t-e)/Math.max(0,n),i=Math.floor(Math.log10(r)),a=r/10**i,o=a>=ne?10:a>=re?5:a>=ie?2:1,s,c,l;return i<0?(l=10**-i/o,s=Math.round(e*l),c=Math.round(t*l),s/l<e&&++s,c/l>t&&--c,l=-l):(l=10**i*o,s=Math.round(e/l),c=Math.round(t/l),s*l<e&&++s,c*l>t&&--c),c<s&&.5<=n&&n<2?A(e,t,n*2):[s,c,l]}function ee(e,t,n){if(t=+t,e=+e,n=+n,!(n>0))return[];if(e===t)return[e];let r=t<e,[i,a,o]=r?A(t,e,n):A(e,t,n);if(!(a>=i))return[];let s=a-i+1,c=Array(s);if(r)if(o<0)for(let e=0;e<s;++e)c[e]=(a-e)/-o;else for(let e=0;e<s;++e)c[e]=(a-e)*o;else if(o<0)for(let e=0;e<s;++e)c[e]=(i+e)/-o;else for(let e=0;e<s;++e)c[e]=(i+e)*o;return c}function te(e,t,n){return t=+t,e=+e,n=+n,A(e,t,n)[2]}function j(e,t,n){t=+t,e=+e,n=+n;let r=t<e,i=r?te(t,e,n):te(e,t,n);return(r?-1:1)*(i<0?1/-i:i)}var ne,re,ie,ae=t((()=>{ne=Math.sqrt(50),re=Math.sqrt(10),ie=Math.sqrt(2)}));function oe(e,t){let n;if(t===void 0)for(let t of e)t!=null&&(n<t||n===void 0&&t>=t)&&(n=t);else{let r=-1;for(let i of e)(i=t(i,++r,e))!=null&&(n<i||n===void 0&&i>=i)&&(n=i)}return n}var se=t((()=>{}));function M(e,t){let n;if(t===void 0)for(let t of e)t!=null&&(n>t||n===void 0&&t>=t)&&(n=t);else{let r=-1;for(let i of e)(i=t(i,++r,e))!=null&&(n>i||n===void 0&&i>=i)&&(n=i)}return n}var ce=t((()=>{}));function le(e,t,n){e=+e,t=+t,n=(i=arguments.length)<2?(t=e,e=0,1):i<3?1:+n;for(var r=-1,i=Math.max(0,Math.ceil((t-e)/n))|0,a=Array(i);++r<i;)a[r]=e+r*n;return a}var ue=t((()=>{})),N=t((()=>{C(),p(),v(),h(),k(),ae(),se(),ce(),b(),ue()}));function de(e){return e}var fe=t((()=>{}));function pe(e){return`translate(`+e+`,0)`}function me(e){return`translate(0,`+e+`)`}function he(e){return t=>+e(t)}function ge(e,t){return t=Math.max(0,e.bandwidth()-t*2)/2,e.round()&&(t=Math.round(t)),n=>+e(n)+t}function _e(){return!this.__axis}function ve(e,t){var n=[],r=null,i=null,a=6,o=6,s=3,c=typeof window<`u`&&window.devicePixelRatio>1?0:.5,l=e===xe||e===we?-1:1,u=e===we||e===Se?`x`:`y`,d=e===xe||e===Ce?pe:me;function f(f){var p=r??(t.ticks?t.ticks.apply(t,n):t.domain()),m=i??(t.tickFormat?t.tickFormat.apply(t,n):de),h=Math.max(a,0)+s,g=t.range(),_=+g[0]+c,v=+g[g.length-1]+c,y=(t.bandwidth?ge:he)(t.copy(),c),b=f.selection?f.selection():f,x=b.selectAll(`.domain`).data([null]),S=b.selectAll(`.tick`).data(p,t).order(),C=S.exit(),w=S.enter().append(`g`).attr(`class`,`tick`),T=S.select(`line`),E=S.select(`text`);x=x.merge(x.enter().insert(`path`,`.tick`).attr(`class`,`domain`).attr(`stroke`,`currentColor`)),S=S.merge(w),T=T.merge(w.append(`line`).attr(`stroke`,`currentColor`).attr(u+`2`,l*a)),E=E.merge(w.append(`text`).attr(`fill`,`currentColor`).attr(u,l*h).attr(`dy`,e===xe?`0em`:e===Ce?`0.71em`:`0.32em`)),f!==b&&(x=x.transition(f),S=S.transition(f),T=T.transition(f),E=E.transition(f),C=C.transition(f).attr(`opacity`,Te).attr(`transform`,function(e){return isFinite(e=y(e))?d(e+c):this.getAttribute(`transform`)}),w.attr(`opacity`,Te).attr(`transform`,function(e){var t=this.parentNode.__axis;return d((t&&isFinite(t=t(e))?t:y(e))+c)})),C.remove(),x.attr(`d`,e===we||e===Se?o?`M`+l*o+`,`+_+`H`+c+`V`+v+`H`+l*o:`M`+c+`,`+_+`V`+v:o?`M`+_+`,`+l*o+`V`+c+`H`+v+`V`+l*o:`M`+_+`,`+c+`H`+v),S.attr(`opacity`,1).attr(`transform`,function(e){return d(y(e)+c)}),T.attr(u+`2`,l*a),E.attr(u,l*h).text(m),b.filter(_e).attr(`fill`,`none`).attr(`font-size`,10).attr(`font-family`,`sans-serif`).attr(`text-anchor`,e===Se?`start`:e===we?`end`:`middle`),b.each(function(){this.__axis=y})}return f.scale=function(e){return arguments.length?(t=e,f):t},f.ticks=function(){return n=Array.from(arguments),f},f.tickArguments=function(e){return arguments.length?(n=e==null?[]:Array.from(e),f):n.slice()},f.tickValues=function(e){return arguments.length?(r=e==null?null:Array.from(e),f):r&&r.slice()},f.tickFormat=function(e){return arguments.length?(i=e,f):i},f.tickSize=function(e){return arguments.length?(a=o=+e,f):a},f.tickSizeInner=function(e){return arguments.length?(a=+e,f):a},f.tickSizeOuter=function(e){return arguments.length?(o=+e,f):o},f.tickPadding=function(e){return arguments.length?(s=+e,f):s},f.offset=function(e){return arguments.length?(c=+e,f):c},f}function ye(e){return ve(xe,e)}function be(e){return ve(Ce,e)}var xe,Se,Ce,we,Te,Ee=t((()=>{fe(),xe=1,Se=2,Ce=3,we=4,Te=1e-6})),De=t((()=>{Ee()}));function Oe(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+``)||r in n||/[\s.]/.test(r))throw Error(`illegal type: `+r);n[r]=[]}return new ke(n)}function ke(e){this._=e}function Ae(e,t){return e.trim().split(/^|\s+/).map(function(e){var n=``,r=e.indexOf(`.`);if(r>=0&&(n=e.slice(r+1),e=e.slice(0,r)),e&&!t.hasOwnProperty(e))throw Error(`unknown type: `+e);return{type:e,name:n}})}function je(e,t){for(var n=0,r=e.length,i;n<r;++n)if((i=e[n]).name===t)return i.value}function Me(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=Ne,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var Ne,Pe=t((()=>{Ne={value:()=>{}},ke.prototype=Oe.prototype={constructor:ke,on:function(e,t){var n=this._,r=Ae(e+``,n),i,a=-1,o=r.length;if(arguments.length<2){for(;++a<o;)if((i=(e=r[a]).type)&&(i=je(n[i],e.name)))return i;return}if(t!=null&&typeof t!=`function`)throw Error(`invalid callback: `+t);for(;++a<o;)if(i=(e=r[a]).type)n[i]=Me(n[i],e.name,t);else if(t==null)for(i in n)n[i]=Me(n[i],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new ke(e)},call:function(e,t){if((i=arguments.length-2)>0)for(var n=Array(i),r=0,i,a;r<i;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw Error(`unknown type: `+e);for(a=this._[e],r=0,i=a.length;r<i;++r)a[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw Error(`unknown type: `+e);for(var r=this._[e],i=0,a=r.length;i<a;++i)r[i].value.apply(t,n)}}})),Fe=t((()=>{Pe()})),Ie,Le,Re=t((()=>{Ie=`http://www.w3.org/1999/xhtml`,Le={svg:`http://www.w3.org/2000/svg`,xhtml:Ie,xlink:`http://www.w3.org/1999/xlink`,xml:`http://www.w3.org/XML/1998/namespace`,xmlns:`http://www.w3.org/2000/xmlns/`}}));function ze(e){var t=e+=``,n=t.indexOf(`:`);return n>=0&&(t=e.slice(0,n))!==`xmlns`&&(e=e.slice(n+1)),Le.hasOwnProperty(t)?{space:Le[t],local:e}:e}var Be=t((()=>{Re()}));function Ve(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===`http://www.w3.org/1999/xhtml`&&t.documentElement.namespaceURI===`http://www.w3.org/1999/xhtml`?t.createElement(e):t.createElementNS(n,e)}}function He(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Ue(e){var t=ze(e);return(t.local?He:Ve)(t)}var We=t((()=>{Be(),Re()}));function Ge(){}function Ke(e){return e==null?Ge:function(){return this.querySelector(e)}}var qe=t((()=>{}));function Je(e){typeof e!=`function`&&(e=Ke(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=Array(o),c,l,u=0;u<o;++u)(c=a[u])&&(l=e.call(c,c.__data__,u,a))&&(`__data__`in c&&(l.__data__=c.__data__),s[u]=l);return new P(r,this._parents)}var Ye=t((()=>{F(),qe()}));function Xe(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}var Ze=t((()=>{}));function Qe(){return[]}function $e(e){return e==null?Qe:function(){return this.querySelectorAll(e)}}var et=t((()=>{}));function tt(e){return function(){return Xe(e.apply(this,arguments))}}function nt(e){e=typeof e==`function`?tt(e):$e(e);for(var t=this._groups,n=t.length,r=[],i=[],a=0;a<n;++a)for(var o=t[a],s=o.length,c,l=0;l<s;++l)(c=o[l])&&(r.push(e.call(c,c.__data__,l,o)),i.push(c));return new P(r,i)}var rt=t((()=>{F(),Ze(),et()}));function it(e){return function(){return this.matches(e)}}function at(e){return function(t){return t.matches(e)}}var ot=t((()=>{}));function st(e){return function(){return ut.call(this.children,e)}}function ct(){return this.firstElementChild}function lt(e){return this.select(e==null?ct:st(typeof e==`function`?e:at(e)))}var ut,dt=t((()=>{ot(),ut=Array.prototype.find}));function ft(){return Array.from(this.children)}function pt(e){return function(){return ht.call(this.children,e)}}function mt(e){return this.selectAll(e==null?ft:pt(typeof e==`function`?e:at(e)))}var ht,gt=t((()=>{ot(),ht=Array.prototype.filter}));function _t(e){typeof e!=`function`&&(e=it(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=[],c,l=0;l<o;++l)(c=a[l])&&e.call(c,c.__data__,l,a)&&s.push(c);return new P(r,this._parents)}var vt=t((()=>{F(),ot()}));function yt(e){return Array(e.length)}var bt=t((()=>{}));function xt(){return new P(this._enter||this._groups.map(yt),this._parents)}function St(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}var Ct=t((()=>{bt(),F(),St.prototype={constructor:St,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}}}));function wt(e){return function(){return e}}var Tt=t((()=>{}));function Et(e,t,n,r,i,a){for(var o=0,s,c=t.length,l=a.length;o<l;++o)(s=t[o])?(s.__data__=a[o],r[o]=s):n[o]=new St(e,a[o]);for(;o<c;++o)(s=t[o])&&(i[o]=s)}function Dt(e,t,n,r,i,a,o){var s,c,l=new Map,u=t.length,d=a.length,f=Array(u),p;for(s=0;s<u;++s)(c=t[s])&&(f[s]=p=o.call(c,c.__data__,s,t)+``,l.has(p)?i[s]=c:l.set(p,c));for(s=0;s<d;++s)p=o.call(e,a[s],s,a)+``,(c=l.get(p))?(r[s]=c,c.__data__=a[s],l.delete(p)):n[s]=new St(e,a[s]);for(s=0;s<u;++s)(c=t[s])&&l.get(f[s])===c&&(i[s]=c)}function Ot(e){return e.__data__}function kt(e,t){if(!arguments.length)return Array.from(this,Ot);var n=t?Dt:Et,r=this._parents,i=this._groups;typeof e!=`function`&&(e=wt(e));for(var a=i.length,o=Array(a),s=Array(a),c=Array(a),l=0;l<a;++l){var u=r[l],d=i[l],f=d.length,p=At(e.call(u,u&&u.__data__,l,r)),m=p.length,h=s[l]=Array(m),g=o[l]=Array(m);n(u,d,h,g,c[l]=Array(f),p,t);for(var _=0,v=0,y,b;_<m;++_)if(y=h[_]){for(_>=v&&(v=_+1);!(b=g[v])&&++v<m;);y._next=b||null}}return o=new P(o,r),o._enter=s,o._exit=c,o}function At(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}var jt=t((()=>{F(),Ct(),Tt()}));function Mt(){return new P(this._exit||this._groups.map(yt),this._parents)}var Nt=t((()=>{bt(),F()}));function Pt(e,t,n){var r=this.enter(),i=this,a=this.exit();return typeof e==`function`?(r=e(r),r&&=r.selection()):r=r.append(e+``),t!=null&&(i=t(i),i&&=i.selection()),n==null?a.remove():n(a),r&&i?r.merge(i).order():i}var Ft=t((()=>{}));function It(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,i=n.length,a=r.length,o=Math.min(i,a),s=Array(i),c=0;c<o;++c)for(var l=n[c],u=r[c],d=l.length,f=s[c]=Array(d),p,m=0;m<d;++m)(p=l[m]||u[m])&&(f[m]=p);for(;c<i;++c)s[c]=n[c];return new P(s,this._parents)}var Lt=t((()=>{F()}));function Rt(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],i=r.length-1,a=r[i],o;--i>=0;)(o=r[i])&&(a&&o.compareDocumentPosition(a)^4&&a.parentNode.insertBefore(o,a),a=o);return this}var zt=t((()=>{}));function Bt(e){e||=Vt;function t(t,n){return t&&n?e(t.__data__,n.__data__):!t-!n}for(var n=this._groups,r=n.length,i=Array(r),a=0;a<r;++a){for(var o=n[a],s=o.length,c=i[a]=Array(s),l,u=0;u<s;++u)(l=o[u])&&(c[u]=l);c.sort(t)}return new P(i,this._parents).order()}function Vt(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}var Ht=t((()=>{F()}));function Ut(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}var Wt=t((()=>{}));function Gt(){return Array.from(this)}var Kt=t((()=>{}));function qt(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,a=r.length;i<a;++i){var o=r[i];if(o)return o}return null}var Jt=t((()=>{}));function Yt(){let e=0;for(let t of this)++e;return e}var Xt=t((()=>{}));function Zt(){return!this.node()}var Qt=t((()=>{}));function $t(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var i=t[n],a=0,o=i.length,s;a<o;++a)(s=i[a])&&e.call(s,s.__data__,a,i);return this}var en=t((()=>{}));function tn(e){return function(){this.removeAttribute(e)}}function nn(e){return function(){this.removeAttributeNS(e.space,e.local)}}function rn(e,t){return function(){this.setAttribute(e,t)}}function an(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function on(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function sn(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function cn(e,t){var n=ze(e);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((t==null?n.local?nn:tn:typeof t==`function`?n.local?sn:on:n.local?an:rn)(n,t))}var ln=t((()=>{Be()}));function un(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}var dn=t((()=>{}));function fn(e){return function(){this.style.removeProperty(e)}}function pn(e,t,n){return function(){this.style.setProperty(e,t,n)}}function mn(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function hn(e,t,n){return arguments.length>1?this.each((t==null?fn:typeof t==`function`?mn:pn)(e,t,n??``)):gn(this.node(),e)}function gn(e,t){return e.style.getPropertyValue(t)||un(e).getComputedStyle(e,null).getPropertyValue(t)}var _n=t((()=>{dn()}));function vn(e){return function(){delete this[e]}}function yn(e,t){return function(){this[e]=t}}function bn(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function xn(e,t){return arguments.length>1?this.each((t==null?vn:typeof t==`function`?bn:yn)(e,t)):this.node()[e]}var Sn=t((()=>{}));function Cn(e){return e.trim().split(/^|\s+/)}function wn(e){return e.classList||new Tn(e)}function Tn(e){this._node=e,this._names=Cn(e.getAttribute(`class`)||``)}function En(e,t){for(var n=wn(e),r=-1,i=t.length;++r<i;)n.add(t[r])}function Dn(e,t){for(var n=wn(e),r=-1,i=t.length;++r<i;)n.remove(t[r])}function On(e){return function(){En(this,e)}}function kn(e){return function(){Dn(this,e)}}function An(e,t){return function(){(t.apply(this,arguments)?En:Dn)(this,e)}}function jn(e,t){var n=Cn(e+``);if(arguments.length<2){for(var r=wn(this.node()),i=-1,a=n.length;++i<a;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof t==`function`?An:t?On:kn)(n,t))}var Mn=t((()=>{Tn.prototype={add:function(e){this._names.indexOf(e)<0&&(this._names.push(e),this._node.setAttribute(`class`,this._names.join(` `)))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute(`class`,this._names.join(` `)))},contains:function(e){return this._names.indexOf(e)>=0}}}));function Nn(){this.textContent=``}function Pn(e){return function(){this.textContent=e}}function Fn(e){return function(){var t=e.apply(this,arguments);this.textContent=t??``}}function In(e){return arguments.length?this.each(e==null?Nn:(typeof e==`function`?Fn:Pn)(e)):this.node().textContent}var Ln=t((()=>{}));function Rn(){this.innerHTML=``}function zn(e){return function(){this.innerHTML=e}}function Bn(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??``}}function Vn(e){return arguments.length?this.each(e==null?Rn:(typeof e==`function`?Bn:zn)(e)):this.node().innerHTML}var Hn=t((()=>{}));function Un(){this.nextSibling&&this.parentNode.appendChild(this)}function Wn(){return this.each(Un)}var Gn=t((()=>{}));function Kn(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function qn(){return this.each(Kn)}var Jn=t((()=>{}));function Yn(e){var t=typeof e==`function`?e:Ue(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}var Xn=t((()=>{We()}));function Zn(){return null}function Qn(e,t){var n=typeof e==`function`?e:Ue(e),r=t==null?Zn:typeof t==`function`?t:Ke(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}var $n=t((()=>{We(),qe()}));function er(){var e=this.parentNode;e&&e.removeChild(this)}function tr(){return this.each(er)}var nr=t((()=>{}));function rr(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function ir(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function ar(e){return this.select(e?ir:rr)}var or=t((()=>{}));function sr(e){return arguments.length?this.property(`__data__`,e):this.node().__data__}var cr=t((()=>{}));function lr(e){return function(t){e.call(this,t,this.__data__)}}function ur(e){return e.trim().split(/^|\s+/).map(function(e){var t=``,n=e.indexOf(`.`);return n>=0&&(t=e.slice(n+1),e=e.slice(0,n)),{type:e,name:t}})}function dr(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,i=t.length,a;n<i;++n)a=t[n],(!e.type||a.type===e.type)&&a.name===e.name?this.removeEventListener(a.type,a.listener,a.options):t[++r]=a;++r?t.length=r:delete this.__on}}}function fr(e,t,n){return function(){var r=this.__on,i,a=lr(t);if(r){for(var o=0,s=r.length;o<s;++o)if((i=r[o]).type===e.type&&i.name===e.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=a,i.options=n),i.value=t;return}}this.addEventListener(e.type,a,n),i={type:e.type,name:e.name,value:t,listener:a,options:n},r?r.push(i):this.__on=[i]}}function pr(e,t,n){var r=ur(e+``),i,a=r.length,o;if(arguments.length<2){var s=this.node().__on;if(s){for(var c=0,l=s.length,u;c<l;++c)for(i=0,u=s[c];i<a;++i)if((o=r[i]).type===u.type&&o.name===u.name)return u.value}return}for(s=t?fr:dr,i=0;i<a;++i)this.each(s(r[i],t,n));return this}var mr=t((()=>{}));function hr(e,t,n){var r=un(e),i=r.CustomEvent;typeof i==`function`?i=new i(t,n):(i=r.document.createEvent(`Event`),n?(i.initEvent(t,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(t,!1,!1)),e.dispatchEvent(i)}function gr(e,t){return function(){return hr(this,e,t)}}function _r(e,t){return function(){return hr(this,e,t.apply(this,arguments))}}function vr(e,t){return this.each((typeof t==`function`?_r:gr)(e,t))}var yr=t((()=>{dn()}));function*br(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,a=r.length,o;i<a;++i)(o=r[i])&&(yield o)}var xr=t((()=>{}));function P(e,t){this._groups=e,this._parents=t}function Sr(){return new P([[document.documentElement]],wr)}function Cr(){return this}var wr,F=t((()=>{Ye(),rt(),dt(),gt(),vt(),jt(),Ct(),Nt(),Ft(),Lt(),zt(),Ht(),Wt(),Kt(),Jt(),Xt(),Qt(),en(),ln(),_n(),Sn(),Mn(),Ln(),Hn(),Gn(),Jn(),Xn(),$n(),nr(),or(),cr(),mr(),yr(),xr(),wr=[null],P.prototype=Sr.prototype={constructor:P,select:Je,selectAll:nt,selectChild:lt,selectChildren:mt,filter:_t,data:kt,enter:xt,exit:Mt,join:Pt,merge:It,selection:Cr,order:Rt,sort:Bt,call:Ut,nodes:Gt,node:qt,size:Yt,empty:Zt,each:$t,attr:cn,style:hn,property:xn,classed:jn,text:In,html:Vn,raise:Wn,lower:qn,append:Yn,insert:Qn,remove:tr,clone:ar,datum:sr,on:pr,dispatch:vr,[Symbol.iterator]:br}}));function Tr(e){return typeof e==`string`?new P([[document.querySelector(e)]],[document.documentElement]):new P([[e]],wr)}var Er=t((()=>{F()})),I=t((()=>{We(),Er(),ot(),Be(),Re(),Ze(),F(),qe(),et(),_n(),dn()})),Dr=t((()=>{Fe(),I()}));function Or(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function kr(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}var Ar=t((()=>{}));function jr(){}function Mr(){return this.rgb().formatHex()}function Nr(){return this.rgb().formatHex8()}function Pr(){return Jr(this).formatHsl()}function Fr(){return this.rgb().formatRgb()}function Ir(e){var t,n;return e=(e+``).trim().toLowerCase(),(t=ri.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?Lr(t):n===3?new L(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Rr(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Rr(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=ii.exec(e))?new L(t[1],t[2],t[3],1):(t=ai.exec(e))?new L(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=oi.exec(e))?Rr(t[1],t[2],t[3],t[4]):(t=si.exec(e))?Rr(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=ci.exec(e))?qr(t[1],t[2]/100,t[3]/100,1):(t=li.exec(e))?qr(t[1],t[2]/100,t[3]/100,t[4]):ui.hasOwnProperty(e)?Lr(ui[e]):e===`transparent`?new L(NaN,NaN,NaN,0):null}function Lr(e){return new L(e>>16&255,e>>8&255,e&255,1)}function Rr(e,t,n,r){return r<=0&&(e=t=n=NaN),new L(e,t,n,r)}function zr(e){return e instanceof jr||(e=Ir(e)),e?(e=e.rgb(),new L(e.r,e.g,e.b,e.opacity)):new L}function Br(e,t,n,r){return arguments.length===1?zr(e):new L(e,t,n,r??1)}function L(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}function Vr(){return`#${Kr(this.r)}${Kr(this.g)}${Kr(this.b)}`}function Hr(){return`#${Kr(this.r)}${Kr(this.g)}${Kr(this.b)}${Kr((isNaN(this.opacity)?1:this.opacity)*255)}`}function Ur(){let e=Wr(this.opacity);return`${e===1?`rgb(`:`rgba(`}${Gr(this.r)}, ${Gr(this.g)}, ${Gr(this.b)}${e===1?`)`:`, ${e})`}`}function Wr(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Gr(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Kr(e){return e=Gr(e),(e<16?`0`:``)+e.toString(16)}function qr(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new R(e,t,n,r)}function Jr(e){if(e instanceof R)return new R(e.h,e.s,e.l,e.opacity);if(e instanceof jr||(e=Ir(e)),!e)return new R;if(e instanceof R)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),a=Math.max(t,n,r),o=NaN,s=a-i,c=(a+i)/2;return s?(o=t===a?(n-r)/s+(n<r)*6:n===a?(r-t)/s+2:(t-n)/s+4,s/=c<.5?a+i:2-a-i,o*=60):s=c>0&&c<1?0:o,new R(o,s,c,e.opacity)}function Yr(e,t,n,r){return arguments.length===1?Jr(e):new R(e,t,n,r??1)}function R(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}function Xr(e){return e=(e||0)%360,e<0?e+360:e}function Zr(e){return Math.max(0,Math.min(1,e||0))}function Qr(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}var $r,ei,ti,ni,z,ri,ii,ai,oi,si,ci,li,ui,di=t((()=>{Ar(),$r=.7,ei=1/$r,ti=`\\s*([+-]?\\d+)\\s*`,ni=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*`,z=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*`,ri=/^#([0-9a-f]{3,8})$/,ii=RegExp(`^rgb\\(${ti},${ti},${ti}\\)$`),ai=RegExp(`^rgb\\(${z},${z},${z}\\)$`),oi=RegExp(`^rgba\\(${ti},${ti},${ti},${ni}\\)$`),si=RegExp(`^rgba\\(${z},${z},${z},${ni}\\)$`),ci=RegExp(`^hsl\\(${ni},${z},${z}\\)$`),li=RegExp(`^hsla\\(${ni},${z},${z},${ni}\\)$`),ui={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},Or(jr,Ir,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Mr,formatHex:Mr,formatHex8:Nr,formatHsl:Pr,formatRgb:Fr,toString:Fr}),Or(L,Br,kr(jr,{brighter(e){return e=e==null?ei:ei**+e,new L(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?$r:$r**+e,new L(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new L(Gr(this.r),Gr(this.g),Gr(this.b),Wr(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Vr,formatHex:Vr,formatHex8:Hr,formatRgb:Ur,toString:Ur})),Or(R,Yr,kr(jr,{brighter(e){return e=e==null?ei:ei**+e,new R(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?$r:$r**+e,new R(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new L(Qr(e>=240?e-240:e+120,i,r),Qr(e,i,r),Qr(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new R(Xr(this.h),Zr(this.s),Zr(this.l),Wr(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let e=Wr(this.opacity);return`${e===1?`hsl(`:`hsla(`}${Xr(this.h)}, ${Zr(this.s)*100}%, ${Zr(this.l)*100}%${e===1?`)`:`, ${e})`}`}}))})),fi,pi,mi=t((()=>{fi=Math.PI/180,pi=180/Math.PI}));function hi(e){if(e instanceof B)return new B(e.l,e.a,e.b,e.opacity);if(e instanceof Ci)return wi(e);e instanceof L||(e=zr(e));var t=bi(e.r),n=bi(e.g),r=bi(e.b),i=_i((.2225045*t+.7168786*n+.0606169*r)/Di),a,o;return t===n&&n===r?a=o=i:(a=_i((.4360747*t+.3850649*n+.1430804*r)/Ei),o=_i((.0139322*t+.0971045*n+.7141733*r)/Oi)),new B(116*i-16,500*(a-i),200*(i-o),e.opacity)}function gi(e,t,n,r){return arguments.length===1?hi(e):new B(e,t,n,r??1)}function B(e,t,n,r){this.l=+e,this.a=+t,this.b=+n,this.opacity=+r}function _i(e){return e>Mi?e**(1/3):e/ji+ki}function vi(e){return e>Ai?e*e*e:ji*(e-ki)}function yi(e){return 255*(e<=.0031308?12.92*e:1.055*e**(1/2.4)-.055)}function bi(e){return(e/=255)<=.04045?e/12.92:((e+.055)/1.055)**2.4}function xi(e){if(e instanceof Ci)return new Ci(e.h,e.c,e.l,e.opacity);if(e instanceof B||(e=hi(e)),e.a===0&&e.b===0)return new Ci(NaN,0<e.l&&e.l<100?0:NaN,e.l,e.opacity);var t=Math.atan2(e.b,e.a)*pi;return new Ci(t<0?t+360:t,Math.sqrt(e.a*e.a+e.b*e.b),e.l,e.opacity)}function Si(e,t,n,r){return arguments.length===1?xi(e):new Ci(e,t,n,r??1)}function Ci(e,t,n,r){this.h=+e,this.c=+t,this.l=+n,this.opacity=+r}function wi(e){if(isNaN(e.h))return new B(e.l,0,0,e.opacity);var t=e.h*fi;return new B(e.l,Math.cos(t)*e.c,Math.sin(t)*e.c,e.opacity)}var Ti,Ei,Di,Oi,ki,Ai,ji,Mi,Ni=t((()=>{Ar(),di(),mi(),Ti=18,Ei=.96422,Di=1,Oi=.82521,ki=4/29,Ai=6/29,ji=3*Ai*Ai,Mi=Ai*Ai*Ai,Or(B,gi,kr(jr,{brighter(e){return new B(this.l+Ti*(e??1),this.a,this.b,this.opacity)},darker(e){return new B(this.l-Ti*(e??1),this.a,this.b,this.opacity)},rgb(){var e=(this.l+16)/116,t=isNaN(this.a)?e:e+this.a/500,n=isNaN(this.b)?e:e-this.b/200;return t=Ei*vi(t),e=Di*vi(e),n=Oi*vi(n),new L(yi(3.1338561*t-1.6168667*e-.4906146*n),yi(-.9787684*t+1.9161415*e+.033454*n),yi(.0719453*t-.2289914*e+1.4052427*n),this.opacity)}})),Or(Ci,Si,kr(jr,{brighter(e){return new Ci(this.h,this.c,this.l+Ti*(e??1),this.opacity)},darker(e){return new Ci(this.h,this.c,this.l-Ti*(e??1),this.opacity)},rgb(){return wi(this).rgb()}}))})),Pi=t((()=>{di(),Ni(),Ar(),mi()})),Fi=t((()=>{})),Ii=t((()=>{Fi()})),Li,Ri=t((()=>{Li=e=>()=>e}));function zi(e,t){return function(n){return e+n*t}}function Bi(e,t,n){return e**=+n,t=t**+n-e,n=1/n,function(r){return(e+r*t)**+n}}function Vi(e,t){var n=t-e;return n?zi(e,n>180||n<-180?n-360*Math.round(n/360):n):Li(isNaN(e)?t:e)}function Hi(e){return(e=+e)==1?Ui:function(t,n){return n-t?Bi(t,n,e):Li(isNaN(t)?n:t)}}function Ui(e,t){var n=t-e;return n?zi(e,n):Li(isNaN(e)?t:e)}var Wi=t((()=>{Ri()})),Gi,Ki=t((()=>{Pi(),Fi(),Ii(),Wi(),Gi=(function e(t){var n=Hi(t);function r(e,t){var r=n((e=Br(e)).r,(t=Br(t)).r),i=n(e.g,t.g),a=n(e.b,t.b),o=Ui(e.opacity,t.opacity);return function(t){return e.r=r(t),e.g=i(t),e.b=a(t),e.opacity=o(t),e+``}}return r.gamma=e,r})(1)}));function qi(e,t){t||=[];var n=e?Math.min(t.length,e.length):0,r=t.slice(),i;return function(a){for(i=0;i<n;++i)r[i]=e[i]*(1-a)+t[i]*a;return r}}function Ji(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}var Yi=t((()=>{}));function Xi(e,t){var n=t?t.length:0,r=e?Math.min(n,e.length):0,i=Array(r),a=Array(n),o;for(o=0;o<r;++o)i[o]=la(e[o],t[o]);for(;o<n;++o)a[o]=t[o];return function(e){for(o=0;o<r;++o)a[o]=i[o](e);return a}}var Zi=t((()=>{ua()}));function Qi(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}var $i=t((()=>{}));function V(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}var ea=t((()=>{}));function ta(e,t){var n={},r={},i;for(i in(typeof e!=`object`||!e)&&(e={}),(typeof t!=`object`||!t)&&(t={}),t)i in e?n[i]=la(e[i],t[i]):r[i]=t[i];return function(e){for(i in n)r[i]=n[i](e);return r}}var na=t((()=>{ua()}));function ra(e){return function(){return e}}function ia(e){return function(t){return e(t)+``}}function aa(e,t){var n=oa.lastIndex=sa.lastIndex=0,r,i,a,o=-1,s=[],c=[];for(e+=``,t+=``;(r=oa.exec(e))&&(i=sa.exec(t));)(a=i.index)>n&&(a=t.slice(n,a),s[o]?s[o]+=a:s[++o]=a),(r=r[0])===(i=i[0])?s[o]?s[o]+=i:s[++o]=i:(s[++o]=null,c.push({i:o,x:V(r,i)})),n=sa.lastIndex;return n<t.length&&(a=t.slice(n),s[o]?s[o]+=a:s[++o]=a),s.length<2?c[0]?ia(c[0].x):ra(t):(t=c.length,function(e){for(var n=0,r;n<t;++n)s[(r=c[n]).i]=r.x(e);return s.join(``)})}var oa,sa,ca=t((()=>{ea(),oa=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,sa=new RegExp(oa.source,`g`)}));function la(e,t){var n=typeof t,r;return t==null||n===`boolean`?Li(t):(n===`number`?V:n===`string`?(r=Ir(t))?(t=r,Gi):aa:t instanceof Ir?Gi:t instanceof Date?Qi:Ji(t)?qi:Array.isArray(t)?Xi:typeof t.valueOf!=`function`&&typeof t.toString!=`function`||isNaN(t)?ta:V)(e,t)}var ua=t((()=>{Pi(),Ki(),Zi(),$i(),ea(),na(),ca(),Ri(),Yi()}));function da(e,t){return e=+e,t=+t,function(n){return Math.round(e*(1-n)+t*n)}}var fa=t((()=>{}));function pa(e,t,n,r,i,a){var o,s,c;return(o=Math.sqrt(e*e+t*t))&&(e/=o,t/=o),(c=e*n+t*r)&&(n-=e*c,r-=t*c),(s=Math.sqrt(n*n+r*r))&&(n/=s,r/=s,c/=s),e*r<t*n&&(e=-e,t=-t,c=-c,o=-o),{translateX:i,translateY:a,rotate:Math.atan2(t,e)*ma,skewX:Math.atan(c)*ma,scaleX:o,scaleY:s}}var ma,ha,ga=t((()=>{ma=180/Math.PI,ha={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1}}));function _a(e){let t=new(typeof DOMMatrix==`function`?DOMMatrix:WebKitCSSMatrix)(e+``);return t.isIdentity?ha:pa(t.a,t.b,t.c,t.d,t.e,t.f)}function va(e){return e==null||(ya||=document.createElementNS(`http://www.w3.org/2000/svg`,`g`),ya.setAttribute(`transform`,e),!(e=ya.transform.baseVal.consolidate()))?ha:(e=e.matrix,pa(e.a,e.b,e.c,e.d,e.e,e.f))}var ya,ba=t((()=>{ga()}));function xa(e,t,n,r){function i(e){return e.length?e.pop()+` `:``}function a(e,r,i,a,o,s){if(e!==i||r!==a){var c=o.push(`translate(`,null,t,null,n);s.push({i:c-4,x:V(e,i)},{i:c-2,x:V(r,a)})}else (i||a)&&o.push(`translate(`+i+t+a+n)}function o(e,t,n,a){e===t?t&&n.push(i(n)+`rotate(`+t+r):(e-t>180?t+=360:t-e>180&&(e+=360),a.push({i:n.push(i(n)+`rotate(`,null,r)-2,x:V(e,t)}))}function s(e,t,n,a){e===t?t&&n.push(i(n)+`skewX(`+t+r):a.push({i:n.push(i(n)+`skewX(`,null,r)-2,x:V(e,t)})}function c(e,t,n,r,a,o){if(e!==n||t!==r){var s=a.push(i(a)+`scale(`,null,`,`,null,`)`);o.push({i:s-4,x:V(e,n)},{i:s-2,x:V(t,r)})}else (n!==1||r!==1)&&a.push(i(a)+`scale(`+n+`,`+r+`)`)}return function(t,n){var r=[],i=[];return t=e(t),n=e(n),a(t.translateX,t.translateY,n.translateX,n.translateY,r,i),o(t.rotate,n.rotate,r,i),s(t.skewX,n.skewX,r,i),c(t.scaleX,t.scaleY,n.scaleX,n.scaleY,r,i),t=n=null,function(e){for(var t=-1,n=i.length,a;++t<n;)r[(a=i[t]).i]=a.x(e);return r.join(``)}}}var Sa,Ca,wa=t((()=>{ea(),ba(),Sa=xa(_a,`px, `,`px)`,`deg)`),Ca=xa(va,`, `,`)`,`)`)}));function Ta(e){return function(t,n){var r=e((t=Si(t)).h,(n=Si(n)).h),i=Ui(t.c,n.c),a=Ui(t.l,n.l),o=Ui(t.opacity,n.opacity);return function(e){return t.h=r(e),t.c=i(e),t.l=a(e),t.opacity=o(e),t+``}}}var Ea,Da=t((()=>{Pi(),Wi(),Ea=Ta(Vi)})),Oa=t((()=>{ua(),Zi(),Fi(),Ii(),$i(),Wi(),ea(),Yi(),na(),fa(),ca(),wa(),Ki(),Pi(),Da()}));function ka(){return Ga||=(Ja(Aa),qa.now()+Ka)}function Aa(){Ga=0}function ja(){this._call=this._time=this._next=null}function Ma(e,t,n){var r=new ja;return r.restart(e,t,n),r}function Na(){ka(),++Ra;for(var e=Ha,t;e;)(t=Ga-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Ra}function Pa(){Ga=(Wa=qa.now())+Ka,Ra=za=0;try{Na()}finally{Ra=0,Ia(),Ga=0}}function Fa(){var e=qa.now(),t=e-Wa;t>Va&&(Ka-=t,Wa=e)}function Ia(){for(var e,t=Ha,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:Ha=n);Ua=e,La(r)}function La(e){Ra||(za&&=clearTimeout(za),e-Ga>24?(e<1/0&&(za=setTimeout(Pa,e-qa.now()-Ka)),Ba&&=clearInterval(Ba)):(Ba||=(Wa=qa.now(),setInterval(Fa,Va)),Ra=1,Ja(Pa)))}var Ra,za,Ba,Va,Ha,Ua,Wa,Ga,Ka,qa,Ja,Ya=t((()=>{Ra=0,za=0,Ba=0,Va=1e3,Wa=0,Ga=0,Ka=0,qa=typeof performance==`object`&&performance.now?performance:Date,Ja=typeof window==`object`&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)},ja.prototype=Ma.prototype={constructor:ja,restart:function(e,t,n){if(typeof e!=`function`)throw TypeError(`callback is not a function`);n=(n==null?ka():+n)+(t==null?0:+t),!this._next&&Ua!==this&&(Ua?Ua._next=this:Ha=this,Ua=this),this._call=e,this._time=n,La()},stop:function(){this._call&&(this._call=null,this._time=1/0,La())}}}));function Xa(e,t,n){var r=new ja;return t=t==null?0:+t,r.restart(n=>{r.stop(),e(n+t)},t,n),r}var Za=t((()=>{Ya()})),Qa=t((()=>{Ya(),Za()}));function $a(e,t,n,r,i,a){var o=e.__transition;if(!o)e.__transition={};else if(n in o)return;to(e,n,{name:t,index:r,group:i,on:no,tween:ro,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:0})}function eo(e,t){var n=U(e,t);if(n.state>0)throw Error(`too late; already scheduled`);return n}function H(e,t){var n=U(e,t);if(n.state>3)throw Error(`too late; already running`);return n}function U(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw Error(`transition not found`);return n}function to(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=Ma(a,0,n.time);function a(e){n.state=1,n.timer.restart(o,n.delay,n.time),n.delay<=e&&o(e-n.delay)}function o(a){var l,u,d,f;if(n.state!==1)return c();for(l in r)if(f=r[l],f.name===n.name){if(f.state===3)return Xa(o);f.state===4?(f.state=6,f.timer.stop(),f.on.call(`interrupt`,e,e.__data__,f.index,f.group),delete r[l]):+l<t&&(f.state=6,f.timer.stop(),f.on.call(`cancel`,e,e.__data__,f.index,f.group),delete r[l])}if(Xa(function(){n.state===3&&(n.state=4,n.timer.restart(s,n.delay,n.time),s(a))}),n.state=2,n.on.call(`start`,e,e.__data__,n.index,n.group),n.state===2){for(n.state=3,i=Array(d=n.tween.length),l=0,u=-1;l<d;++l)(f=n.tween[l].value.call(e,e.__data__,n.index,n.group))&&(i[++u]=f);i.length=u+1}}function s(t){for(var r=t<n.duration?n.ease.call(null,t/n.duration):(n.timer.restart(c),n.state=5,1),a=-1,o=i.length;++a<o;)i[a].call(e,r);n.state===5&&(n.on.call(`end`,e,e.__data__,n.index,n.group),c())}function c(){for(var i in n.state=6,n.timer.stop(),delete r[t],r)return;delete e.__transition}}var no,ro,W=t((()=>{Fe(),Qa(),no=Oe(`start`,`end`,`cancel`,`interrupt`),ro=[]}));function io(e,t){var n=e.__transition,r,i,a=!0,o;if(n){for(o in t=t==null?null:t+``,n){if((r=n[o]).name!==t){a=!1;continue}i=r.state>2&&r.state<5,r.state=6,r.timer.stop(),r.on.call(i?`interrupt`:`cancel`,e,e.__data__,r.index,r.group),delete n[o]}a&&delete e.__transition}}var ao=t((()=>{W()}));function oo(e){return this.each(function(){io(this,e)})}var so=t((()=>{ao()}));function co(e,t){var n,r;return function(){var i=H(this,e),a=i.tween;if(a!==n){r=n=a;for(var o=0,s=r.length;o<s;++o)if(r[o].name===t){r=r.slice(),r.splice(o,1);break}}i.tween=r}}function lo(e,t,n){var r,i;if(typeof n!=`function`)throw Error();return function(){var a=H(this,e),o=a.tween;if(o!==r){i=(r=o).slice();for(var s={name:t,value:n},c=0,l=i.length;c<l;++c)if(i[c].name===t){i[c]=s;break}c===l&&i.push(s)}a.tween=i}}function uo(e,t){var n=this._id;if(e+=``,arguments.length<2){for(var r=U(this.node(),n).tween,i=0,a=r.length,o;i<a;++i)if((o=r[i]).name===e)return o.value;return null}return this.each((t==null?co:lo)(n,e,t))}function fo(e,t,n){var r=e._id;return e.each(function(){var e=H(this,r);(e.value||={})[t]=n.apply(this,arguments)}),function(e){return U(e,r).value[t]}}var po=t((()=>{W()}));function mo(e,t){var n;return(typeof t==`number`?V:t instanceof Ir?Gi:(n=Ir(t))?(t=n,Gi):aa)(e,t)}var ho=t((()=>{Pi(),Oa()}));function go(e){return function(){this.removeAttribute(e)}}function _o(e){return function(){this.removeAttributeNS(e.space,e.local)}}function vo(e,t,n){var r,i=n+``,a;return function(){var o=this.getAttribute(e);return o===i?null:o===r?a:a=t(r=o,n)}}function yo(e,t,n){var r,i=n+``,a;return function(){var o=this.getAttributeNS(e.space,e.local);return o===i?null:o===r?a:a=t(r=o,n)}}function bo(e,t,n){var r,i,a;return function(){var o,s=n(this),c;return s==null?void this.removeAttribute(e):(o=this.getAttribute(e),c=s+``,o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s)))}}function xo(e,t,n){var r,i,a;return function(){var o,s=n(this),c;return s==null?void this.removeAttributeNS(e.space,e.local):(o=this.getAttributeNS(e.space,e.local),c=s+``,o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s)))}}function So(e,t){var n=ze(e),r=n===`transform`?Ca:mo;return this.attrTween(e,typeof t==`function`?(n.local?xo:bo)(n,r,fo(this,`attr.`+e,t)):t==null?(n.local?_o:go)(n):(n.local?yo:vo)(n,r,t))}var Co=t((()=>{Oa(),I(),po(),ho()}));function wo(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function To(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function Eo(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&To(e,i)),n}return i._value=t,i}function Do(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&wo(e,i)),n}return i._value=t,i}function Oo(e,t){var n=`attr.`+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!=`function`)throw Error();var r=ze(e);return this.tween(n,(r.local?Eo:Do)(r,t))}var ko=t((()=>{I()}));function Ao(e,t){return function(){eo(this,e).delay=+t.apply(this,arguments)}}function jo(e,t){return t=+t,function(){eo(this,e).delay=t}}function Mo(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?Ao:jo)(t,e)):U(this.node(),t).delay}var No=t((()=>{W()}));function Po(e,t){return function(){H(this,e).duration=+t.apply(this,arguments)}}function Fo(e,t){return t=+t,function(){H(this,e).duration=t}}function Io(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?Po:Fo)(t,e)):U(this.node(),t).duration}var Lo=t((()=>{W()}));function Ro(e,t){if(typeof t!=`function`)throw Error();return function(){H(this,e).ease=t}}function zo(e){var t=this._id;return arguments.length?this.each(Ro(t,e)):U(this.node(),t).ease}var Bo=t((()=>{W()}));function Vo(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!=`function`)throw Error();H(this,e).ease=n}}function Ho(e){if(typeof e!=`function`)throw Error();return this.each(Vo(this._id,e))}var Uo=t((()=>{W()}));function Wo(e){typeof e!=`function`&&(e=it(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=[],c,l=0;l<o;++l)(c=a[l])&&e.call(c,c.__data__,l,a)&&s.push(c);return new js(r,this._parents,this._name,this._id)}var Go=t((()=>{I(),Fs()}));function Ko(e){if(e._id!==this._id)throw Error();for(var t=this._groups,n=e._groups,r=t.length,i=n.length,a=Math.min(r,i),o=Array(r),s=0;s<a;++s)for(var c=t[s],l=n[s],u=c.length,d=o[s]=Array(u),f,p=0;p<u;++p)(f=c[p]||l[p])&&(d[p]=f);for(;s<r;++s)o[s]=t[s];return new js(o,this._parents,this._name,this._id)}var qo=t((()=>{Fs()}));function Jo(e){return(e+``).trim().split(/^|\s+/).every(function(e){var t=e.indexOf(`.`);return t>=0&&(e=e.slice(0,t)),!e||e===`start`})}function Yo(e,t,n){var r,i,a=Jo(t)?eo:H;return function(){var o=a(this,e),s=o.on;s!==r&&(i=(r=s).copy()).on(t,n),o.on=i}}function Xo(e,t){var n=this._id;return arguments.length<2?U(this.node(),n).on.on(e):this.each(Yo(n,e,t))}var Zo=t((()=>{W()}));function Qo(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function $o(){return this.on(`end.remove`,Qo(this._id))}var es=t((()=>{}));function ts(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=Ke(e));for(var r=this._groups,i=r.length,a=Array(i),o=0;o<i;++o)for(var s=r[o],c=s.length,l=a[o]=Array(c),u,d,f=0;f<c;++f)(u=s[f])&&(d=e.call(u,u.__data__,f,s))&&(`__data__`in u&&(d.__data__=u.__data__),l[f]=d,$a(l[f],t,n,f,l,U(u,n)));return new js(a,this._parents,t,n)}var ns=t((()=>{I(),Fs(),W()}));function rs(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=$e(e));for(var r=this._groups,i=r.length,a=[],o=[],s=0;s<i;++s)for(var c=r[s],l=c.length,u,d=0;d<l;++d)if(u=c[d]){for(var f=e.call(u,u.__data__,d,c),p,m=U(u,n),h=0,g=f.length;h<g;++h)(p=f[h])&&$a(p,t,n,h,f,m);a.push(f),o.push(u)}return new js(a,o,t,n)}var is=t((()=>{I(),Fs(),W()}));function as(){return new os(this._groups,this._parents)}var os,ss=t((()=>{I(),os=Sr.prototype.constructor}));function cs(e,t){var n,r,i;return function(){var a=gn(this,e),o=(this.style.removeProperty(e),gn(this,e));return a===o?null:a===n&&o===r?i:i=t(n=a,r=o)}}function ls(e){return function(){this.style.removeProperty(e)}}function us(e,t,n){var r,i=n+``,a;return function(){var o=gn(this,e);return o===i?null:o===r?a:a=t(r=o,n)}}function ds(e,t,n){var r,i,a;return function(){var o=gn(this,e),s=n(this),c=s+``;return s??(c=s=(this.style.removeProperty(e),gn(this,e))),o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s))}}function fs(e,t){var n,r,i,a=`style.`+t,o=`end.`+a,s;return function(){var c=H(this,e),l=c.on,u=c.value[a]==null?s||=ls(t):void 0;(l!==n||i!==u)&&(r=(n=l).copy()).on(o,i=u),c.on=r}}function ps(e,t,n){var r=(e+=``)==`transform`?Sa:mo;return t==null?this.styleTween(e,cs(e,r)).on(`end.style.`+e,ls(e)):typeof t==`function`?this.styleTween(e,ds(e,r,fo(this,`style.`+e,t))).each(fs(this._id,e)):this.styleTween(e,us(e,r,t),n).on(`end.style.`+e,null)}var ms=t((()=>{Oa(),I(),W(),po(),ho()}));function hs(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function gs(e,t,n){var r,i;function a(){var a=t.apply(this,arguments);return a!==i&&(r=(i=a)&&hs(e,a,n)),r}return a._value=t,a}function _s(e,t,n){var r=`style.`+(e+=``);if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!=`function`)throw Error();return this.tween(r,gs(e,t,n??``))}var vs=t((()=>{}));function ys(e){return function(){this.textContent=e}}function bs(e){return function(){var t=e(this);this.textContent=t??``}}function xs(e){return this.tween(`text`,typeof e==`function`?bs(fo(this,`text`,e)):ys(e==null?``:e+``))}var Ss=t((()=>{po()}));function Cs(e){return function(t){this.textContent=e.call(this,t)}}function ws(e){var t,n;function r(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&Cs(r)),t}return r._value=e,r}function Ts(e){var t=`text`;if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!=`function`)throw Error();return this.tween(t,ws(e))}var Es=t((()=>{}));function Ds(){for(var e=this._name,t=this._id,n=Ns(),r=this._groups,i=r.length,a=0;a<i;++a)for(var o=r[a],s=o.length,c,l=0;l<s;++l)if(c=o[l]){var u=U(c,t);$a(c,e,n,l,o,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new js(r,this._parents,e,n)}var Os=t((()=>{Fs(),W()}));function ks(){var e,t,n=this,r=n._id,i=n.size();return new Promise(function(a,o){var s={value:o},c={value:function(){--i===0&&a()}};n.each(function(){var n=H(this,r),i=n.on;i!==e&&(t=(e=i).copy(),t._.cancel.push(s),t._.interrupt.push(s),t._.end.push(c)),n.on=t}),i===0&&a()})}var As=t((()=>{W()}));function js(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function Ms(e){return Sr().transition(e)}function Ns(){return++Ps}var Ps,G,Fs=t((()=>{I(),Co(),ko(),No(),Lo(),Bo(),Uo(),Go(),qo(),Zo(),es(),ns(),is(),ss(),ms(),vs(),Ss(),Es(),Os(),po(),As(),Ps=0,G=Sr.prototype,js.prototype=Ms.prototype={constructor:js,select:ts,selectAll:rs,selectChild:G.selectChild,selectChildren:G.selectChildren,filter:Wo,merge:Ko,selection:as,transition:Ds,call:G.call,nodes:G.nodes,node:G.node,size:G.size,empty:G.empty,each:G.each,on:Xo,attr:So,attrTween:Oo,style:ps,styleTween:_s,text:xs,textTween:Ts,remove:$o,tween:uo,delay:Mo,duration:Io,ease:zo,easeVarying:Ho,end:ks,[Symbol.iterator]:G[Symbol.iterator]}}));function Is(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var Ls=t((()=>{})),Rs=t((()=>{Ls()}));function zs(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw Error(`transition ${t} not found`);return n}function Bs(e){var t,n;e instanceof js?(t=e._id,e=e._name):(t=Ns(),(n=Vs).time=ka(),e=e==null?null:e+``);for(var r=this._groups,i=r.length,a=0;a<i;++a)for(var o=r[a],s=o.length,c,l=0;l<s;++l)(c=o[l])&&$a(c,e,t,l,o,n||zs(c,t));return new js(r,this._parents,e,t)}var Vs,Hs=t((()=>{Fs(),W(),Rs(),Qa(),Vs={time:null,delay:0,duration:250,ease:Is}})),Us=t((()=>{I(),so(),Hs(),Sr.prototype.interrupt=oo,Sr.prototype.transition=Bs})),Ws=t((()=>{Us(),Fs(),W(),ao()}));function Gs(e){return{type:e}}var Ks,qs,Js,Ys=t((()=>{Ws(),{abs:Ks,max:qs,min:Js}=Math,[`w`,`e`].map(Gs),[`n`,`s`].map(Gs),[`n`,`w`,`e`,`s`,`nw`,`ne`,`sw`,`se`].map(Gs)})),Xs=t((()=>{Ys()}));function Zs(e){this._+=e[0];for(let t=1,n=e.length;t<n;++t)this._+=arguments[t]+e[t]}function Qs(e){let t=Math.floor(e);if(!(t>=0))throw Error(`invalid digits: ${e}`);if(t>15)return Zs;let n=10**t;return function(e){this._+=e[0];for(let t=1,r=e.length;t<r;++t)this._+=Math.round(arguments[t]*n)/n+e[t]}}function $s(){return new ic}var ec,tc,nc,rc,ic,ac=t((()=>{ec=Math.PI,tc=2*ec,nc=1e-6,rc=tc-nc,ic=class{constructor(e){this._x0=this._y0=this._x1=this._y1=null,this._=``,this._append=e==null?Zs:Qs(e)}moveTo(e,t){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(e,t){this._append`L${this._x1=+e},${this._y1=+t}`}quadraticCurveTo(e,t,n,r){this._append`Q${+e},${+t},${this._x1=+n},${this._y1=+r}`}bezierCurveTo(e,t,n,r,i,a){this._append`C${+e},${+t},${+n},${+r},${this._x1=+i},${this._y1=+a}`}arcTo(e,t,n,r,i){if(e=+e,t=+t,n=+n,r=+r,i=+i,i<0)throw Error(`negative radius: ${i}`);let a=this._x1,o=this._y1,s=n-e,c=r-t,l=a-e,u=o-t,d=l*l+u*u;if(this._x1===null)this._append`M${this._x1=e},${this._y1=t}`;else if(d>nc)if(!(Math.abs(u*s-c*l)>nc)||!i)this._append`L${this._x1=e},${this._y1=t}`;else{let f=n-a,p=r-o,m=s*s+c*c,h=f*f+p*p,g=Math.sqrt(m),_=Math.sqrt(d),v=i*Math.tan((ec-Math.acos((m+d-h)/(2*g*_)))/2),y=v/_,b=v/g;Math.abs(y-1)>nc&&this._append`L${e+y*l},${t+y*u}`,this._append`A${i},${i},0,0,${+(u*f>l*p)},${this._x1=e+b*s},${this._y1=t+b*c}`}}arc(e,t,n,r,i,a){if(e=+e,t=+t,n=+n,a=!!a,n<0)throw Error(`negative radius: ${n}`);let o=n*Math.cos(r),s=n*Math.sin(r),c=e+o,l=t+s,u=1^a,d=a?r-i:i-r;this._x1===null?this._append`M${c},${l}`:(Math.abs(this._x1-c)>nc||Math.abs(this._y1-l)>nc)&&this._append`L${c},${l}`,n&&(d<0&&(d=d%tc+tc),d>rc?this._append`A${n},${n},0,1,${u},${e-o},${t-s}A${n},${n},0,1,${u},${this._x1=c},${this._y1=l}`:d>nc&&this._append`A${n},${n},0,${+(d>=ec)},${u},${this._x1=e+n*Math.cos(i)},${this._y1=t+n*Math.sin(i)}`)}rect(e,t,n,r){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}h${n=+n}v${+r}h${-n}Z`}toString(){return this._}},$s.prototype=ic.prototype})),oc=t((()=>{ac()})),sc=t((()=>{oc()})),cc=t((()=>{N()})),lc=t((()=>{})),uc=t((()=>{})),dc=t((()=>{uc()})),fc=t((()=>{})),pc=t((()=>{fc(),Fe(),Qa()}));function mc(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString(`en`).replace(/,/g,``):e.toString(10)}function hc(e,t){if(!isFinite(e)||e===0)return null;var n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf(`e`),r=e.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+e.slice(n+1)]}var gc=t((()=>{}));function _c(e){return e=hc(Math.abs(e)),e?e[1]:NaN}var vc=t((()=>{gc()}));function yc(e,t){return function(n,r){for(var i=n.length,a=[],o=0,s=e[0],c=0;i>0&&s>0&&(c+s+1>r&&(s=Math.max(1,r-c)),a.push(n.substring(i-=s,i+s)),!((c+=s+1)>r));)s=e[o=(o+1)%e.length];return a.reverse().join(t)}}var bc=t((()=>{}));function xc(e){return function(t){return t.replace(/[0-9]/g,function(t){return e[+t]})}}var Sc=t((()=>{}));function Cc(e){if(!(t=Tc.exec(e)))throw Error(`invalid format: `+e);var t;return new wc({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}function wc(e){this.fill=e.fill===void 0?` `:e.fill+``,this.align=e.align===void 0?`>`:e.align+``,this.sign=e.sign===void 0?`-`:e.sign+``,this.symbol=e.symbol===void 0?``:e.symbol+``,this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?``:e.type+``}var Tc,Ec=t((()=>{Tc=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i,Cc.prototype=wc.prototype,wc.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?`0`:``)+(this.width===void 0?``:Math.max(1,this.width|0))+(this.comma?`,`:``)+(this.precision===void 0?``:`.`+Math.max(0,this.precision|0))+(this.trim?`~`:``)+this.type}}));function Dc(e){out:for(var t=e.length,n=1,r=-1,i;n<t;++n)switch(e[n]){case`.`:r=i=n;break;case`0`:r===0&&(r=n),i=n;break;default:if(!+e[n])break out;r>0&&(r=0);break}return r>0?e.slice(0,r)+e.slice(i+1):e}var Oc=t((()=>{}));function kc(e,t){var n=hc(e,t);if(!n)return Ac=void 0,e.toPrecision(t);var r=n[0],i=n[1],a=i-(Ac=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,o=r.length;return a===o?r:a>o?r+Array(a-o+1).join(`0`):a>0?r.slice(0,a)+`.`+r.slice(a):`0.`+Array(1-a).join(`0`)+hc(e,Math.max(0,t+a-1))[0]}var Ac,jc=t((()=>{gc()}));function Mc(e,t){var n=hc(e,t);if(!n)return e+``;var r=n[0],i=n[1];return i<0?`0.`+Array(-i).join(`0`)+r:r.length>i+1?r.slice(0,i+1)+`.`+r.slice(i+1):r+Array(i-r.length+2).join(`0`)}var Nc=t((()=>{gc()})),Pc,Fc=t((()=>{gc(),jc(),Nc(),Pc={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+``,d:mc,e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>Mc(e*100,t),r:Mc,s:kc,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)}}));function Ic(e){return e}var Lc=t((()=>{}));function Rc(e){var t=e.grouping===void 0||e.thousands===void 0?Ic:yc(zc.call(e.grouping,Number),e.thousands+``),n=e.currency===void 0?``:e.currency[0]+``,r=e.currency===void 0?``:e.currency[1]+``,i=e.decimal===void 0?`.`:e.decimal+``,a=e.numerals===void 0?Ic:xc(zc.call(e.numerals,String)),o=e.percent===void 0?`%`:e.percent+``,s=e.minus===void 0?`−`:e.minus+``,c=e.nan===void 0?`NaN`:e.nan+``;function l(e,l){e=Cc(e);var u=e.fill,d=e.align,f=e.sign,p=e.symbol,m=e.zero,h=e.width,g=e.comma,_=e.precision,v=e.trim,y=e.type;y===`n`?(g=!0,y=`g`):Pc[y]||(_===void 0&&(_=12),v=!0,y=`g`),(m||u===`0`&&d===`=`)&&(m=!0,u=`0`,d=`=`);var b=(l&&l.prefix!==void 0?l.prefix:``)+(p===`$`?n:p===`#`&&/[boxX]/.test(y)?`0`+y.toLowerCase():``),x=(p===`$`?r:/[%p]/.test(y)?o:``)+(l&&l.suffix!==void 0?l.suffix:``),S=Pc[y],C=/[defgprs%]/.test(y);_=_===void 0?6:/[gprs]/.test(y)?Math.max(1,Math.min(21,_)):Math.max(0,Math.min(20,_));function w(e){var n=b,r=x,o,l,p;if(y===`c`)r=S(e)+r,e=``;else{e=+e;var w=e<0||1/e<0;if(e=isNaN(e)?c:S(Math.abs(e),_),v&&(e=Dc(e)),w&&+e==0&&f!==`+`&&(w=!1),n=(w?f===`(`?f:s:f===`-`||f===`(`?``:f)+n,r=(y===`s`&&!isNaN(e)&&Ac!==void 0?Bc[8+Ac/3]:``)+r+(w&&f===`(`?`)`:``),C){for(o=-1,l=e.length;++o<l;)if(p=e.charCodeAt(o),48>p||p>57){r=(p===46?i+e.slice(o+1):e.slice(o))+r,e=e.slice(0,o);break}}}g&&!m&&(e=t(e,1/0));var T=n.length+e.length+r.length,E=T<h?Array(h-T+1).join(u):``;switch(g&&m&&(e=t(E+e,E.length?h-r.length:1/0),E=``),d){case`<`:e=n+e+r+E;break;case`=`:e=n+E+e+r;break;case`^`:e=E.slice(0,T=E.length>>1)+n+e+r+E.slice(T);break;default:e=E+n+e+r;break}return a(e)}return w.toString=function(){return e+``},w}function u(e,t){var n=Math.max(-8,Math.min(8,Math.floor(_c(t)/3)))*3,r=10**-n,i=l((e=Cc(e),e.type=`f`,e),{suffix:Bc[8+n/3]});return function(e){return i(r*e)}}return{format:l,formatPrefix:u}}var zc,Bc,Vc=t((()=>{vc(),bc(),Sc(),Ec(),Oc(),Fc(),jc(),Lc(),zc=Array.prototype.map,Bc=[`y`,`z`,`a`,`f`,`p`,`n`,`µ`,`m`,``,`k`,`M`,`G`,`T`,`P`,`E`,`Z`,`Y`]}));function Hc(e){return Uc=Rc(e),Wc=Uc.format,Gc=Uc.formatPrefix,Uc}var Uc,Wc,Gc,Kc=t((()=>{Vc(),Hc({thousands:`,`,grouping:[3],currency:[`$`,``]})}));function qc(e){return Math.max(0,-_c(Math.abs(e)))}var Jc=t((()=>{vc()}));function Yc(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(_c(t)/3)))*3-_c(Math.abs(e)))}var Xc=t((()=>{vc()}));function Zc(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,_c(t)-_c(e))+1}var Qc=t((()=>{vc()})),$c=t((()=>{Kc(),Vc(),Ec(),Jc(),Xc(),Qc()})),el=t((()=>{N()}));function tl(e){var t=0,n=e.children,r=n&&n.length;if(!r)t=1;else for(;--r>=0;)t+=n[r].value;e.value=t}function nl(){return this.eachAfter(tl)}var rl=t((()=>{}));function il(e,t){let n=-1;for(let r of this)e.call(t,r,++n,this);return this}var al=t((()=>{}));function ol(e,t){for(var n=this,r=[n],i,a,o=-1;n=r.pop();)if(e.call(t,n,++o,this),i=n.children)for(a=i.length-1;a>=0;--a)r.push(i[a]);return this}var sl=t((()=>{}));function cl(e,t){for(var n=this,r=[n],i=[],a,o,s,c=-1;n=r.pop();)if(i.push(n),a=n.children)for(o=0,s=a.length;o<s;++o)r.push(a[o]);for(;n=i.pop();)e.call(t,n,++c,this);return this}var ll=t((()=>{}));function ul(e,t){let n=-1;for(let r of this)if(e.call(t,r,++n,this))return r}var dl=t((()=>{}));function fl(e){return this.eachAfter(function(t){for(var n=+e(t.data)||0,r=t.children,i=r&&r.length;--i>=0;)n+=r[i].value;t.value=n})}var pl=t((()=>{}));function ml(e){return this.eachBefore(function(t){t.children&&t.children.sort(e)})}var hl=t((()=>{}));function gl(e){for(var t=this,n=_l(t,e),r=[t];t!==n;)t=t.parent,r.push(t);for(var i=r.length;e!==n;)r.splice(i,0,e),e=e.parent;return r}function _l(e,t){if(e===t)return e;var n=e.ancestors(),r=t.ancestors(),i=null;for(e=n.pop(),t=r.pop();e===t;)i=e,e=n.pop(),t=r.pop();return i}var vl=t((()=>{}));function yl(){for(var e=this,t=[e];e=e.parent;)t.push(e);return t}var bl=t((()=>{}));function xl(){return Array.from(this)}var Sl=t((()=>{}));function Cl(){var e=[];return this.eachBefore(function(t){t.children||e.push(t)}),e}var wl=t((()=>{}));function Tl(){var e=this,t=[];return e.each(function(n){n!==e&&t.push({source:n.parent,target:n})}),t}var El=t((()=>{}));function*Dl(){var e=this,t,n=[e],r,i,a;do for(t=n.reverse(),n=[];e=t.pop();)if(yield e,r=e.children)for(i=0,a=r.length;i<a;++i)n.push(r[i]);while(n.length)}var Ol=t((()=>{}));function kl(e,t){e instanceof Map?(e=[void 0,e],t===void 0&&(t=Ml)):t===void 0&&(t=jl);for(var n=new Fl(e),r,i=[n],a,o,s,c;r=i.pop();)if((o=t(r.data))&&(c=(o=Array.from(o)).length))for(r.children=o,s=c-1;s>=0;--s)i.push(a=o[s]=new Fl(o[s])),a.parent=r,a.depth=r.depth+1;return n.eachBefore(Pl)}function Al(){return kl(this).eachBefore(Nl)}function jl(e){return e.children}function Ml(e){return Array.isArray(e)?e[1]:null}function Nl(e){e.data.value!==void 0&&(e.value=e.data.value),e.data=e.data.data}function Pl(e){var t=0;do e.height=t;while((e=e.parent)&&e.height<++t)}function Fl(e){this.data=e,this.depth=this.height=0,this.parent=null}var Il=t((()=>{rl(),al(),sl(),ll(),dl(),pl(),hl(),vl(),bl(),Sl(),wl(),El(),Ol(),Fl.prototype=kl.prototype={constructor:Fl,count:nl,each:il,eachAfter:cl,eachBefore:ol,find:ul,sum:fl,sort:ml,path:gl,ancestors:yl,descendants:xl,leaves:Cl,links:Tl,copy:Al,[Symbol.iterator]:Dl}}));function Ll(e){if(typeof e!=`function`)throw Error();return e}var Rl=t((()=>{}));function zl(){return 0}function Bl(e){return function(){return e}}var Vl=t((()=>{}));function Hl(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)}var Ul=t((()=>{}));function Wl(e,t,n,r,i){for(var a=e.children,o,s=-1,c=a.length,l=e.value&&(r-t)/e.value;++s<c;)o=a[s],o.y0=n,o.y1=i,o.x0=t,o.x1=t+=o.value*l}var Gl=t((()=>{}));function Kl(e,t,n,r,i){for(var a=e.children,o,s=-1,c=a.length,l=e.value&&(i-n)/e.value;++s<c;)o=a[s],o.x0=t,o.x1=r,o.y0=n,o.y1=n+=o.value*l}var ql=t((()=>{}));function Jl(e,t,n,r,i,a){for(var o=[],s=t.children,c,l,u=0,d=0,f=s.length,p,m,h=t.value,g,_,v,y,b,x,S;u<f;){p=i-n,m=a-r;do g=s[d++].value;while(!g&&d<f);for(_=v=g,x=Math.max(m/p,p/m)/(h*e),S=g*g*x,b=Math.max(v/S,S/_);d<f;++d){if(g+=l=s[d].value,l<_&&(_=l),l>v&&(v=l),S=g*g*x,y=Math.max(v/S,S/_),y>b){g-=l;break}b=y}o.push(c={value:g,dice:p<m,children:s.slice(u,d)}),c.dice?Wl(c,n,r,i,h?r+=m*g/h:a):Kl(c,n,r,h?n+=p*g/h:i,a),h-=g,u=d}return o}var Yl,Xl,Zl=t((()=>{Gl(),ql(),Yl=(1+Math.sqrt(5))/2,Xl=(function e(t){function n(e,n,r,i,a){Jl(t,e,n,r,i,a)}return n.ratio=function(t){return e((t=+t)>1?t:1)},n})(Yl)}));function Ql(){var e=Xl,t=!1,n=1,r=1,i=[0],a=zl,o=zl,s=zl,c=zl,l=zl;function u(e){return e.x0=e.y0=0,e.x1=n,e.y1=r,e.eachBefore(d),i=[0],t&&e.eachBefore(Hl),e}function d(t){var n=i[t.depth],r=t.x0+n,u=t.y0+n,d=t.x1-n,f=t.y1-n;d<r&&(r=d=(r+d)/2),f<u&&(u=f=(u+f)/2),t.x0=r,t.y0=u,t.x1=d,t.y1=f,t.children&&(n=i[t.depth+1]=a(t)/2,r+=l(t)-n,u+=o(t)-n,d-=s(t)-n,f-=c(t)-n,d<r&&(r=d=(r+d)/2),f<u&&(u=f=(u+f)/2),e(t,r,u,d,f))}return u.round=function(e){return arguments.length?(t=!!e,u):t},u.size=function(e){return arguments.length?(n=+e[0],r=+e[1],u):[n,r]},u.tile=function(t){return arguments.length?(e=Ll(t),u):e},u.padding=function(e){return arguments.length?u.paddingInner(e).paddingOuter(e):u.paddingInner()},u.paddingInner=function(e){return arguments.length?(a=typeof e==`function`?e:Bl(+e),u):a},u.paddingOuter=function(e){return arguments.length?u.paddingTop(e).paddingRight(e).paddingBottom(e).paddingLeft(e):u.paddingTop()},u.paddingTop=function(e){return arguments.length?(o=typeof e==`function`?e:Bl(+e),u):o},u.paddingRight=function(e){return arguments.length?(s=typeof e==`function`?e:Bl(+e),u):s},u.paddingBottom=function(e){return arguments.length?(c=typeof e==`function`?e:Bl(+e),u):c},u.paddingLeft=function(e){return arguments.length?(l=typeof e==`function`?e:Bl(+e),u):l},u}var $l=t((()=>{Ul(),Zl(),Rl(),Vl()})),eu=t((()=>{Il(),Rl(),Vl(),Ul(),Gl(),$l(),ql(),Zl()})),tu=t((()=>{})),nu=t((()=>{}));function ru(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e);break}return this}var iu=t((()=>{}));function au(){var e=new O,t=[],n=[],r=ou;function i(i){let a=e.get(i);if(a===void 0){if(r!==ou)return r;e.set(i,a=t.push(i)-1)}return n[a%n.length]}return i.domain=function(n){if(!arguments.length)return t.slice();t=[],e=new O;for(let r of n)e.has(r)||e.set(r,t.push(r)-1);return i},i.range=function(e){return arguments.length?(n=Array.from(e),i):n.slice()},i.unknown=function(e){return arguments.length?(r=e,i):r},i.copy=function(){return au(t,n).unknown(r)},ru.apply(i,arguments),i}var ou,su=t((()=>{N(),iu(),ou=Symbol(`implicit`)}));function cu(){var e=au().unknown(void 0),t=e.domain,n=e.range,r=0,i=1,a,o,s=!1,c=0,l=0,u=.5;delete e.unknown;function d(){var e=t().length,d=i<r,f=d?i:r,p=d?r:i;a=(p-f)/Math.max(1,e-c+l*2),s&&(a=Math.floor(a)),f+=(p-f-a*(e-c))*u,o=a*(1-c),s&&(f=Math.round(f),o=Math.round(o));var m=le(e).map(function(e){return f+a*e});return n(d?m.reverse():m)}return e.domain=function(e){return arguments.length?(t(e),d()):t()},e.range=function(e){return arguments.length?([r,i]=e,r=+r,i=+i,d()):[r,i]},e.rangeRound=function(e){return[r,i]=e,r=+r,i=+i,s=!0,d()},e.bandwidth=function(){return o},e.step=function(){return a},e.round=function(e){return arguments.length?(s=!!e,d()):s},e.padding=function(e){return arguments.length?(c=Math.min(1,l=+e),d()):c},e.paddingInner=function(e){return arguments.length?(c=Math.min(1,e),d()):c},e.paddingOuter=function(e){return arguments.length?(l=+e,d()):l},e.align=function(e){return arguments.length?(u=Math.max(0,Math.min(1,e)),d()):u},e.copy=function(){return cu(t(),[r,i]).round(s).paddingInner(c).paddingOuter(l).align(u)},ru.apply(d(),arguments)}var lu=t((()=>{N(),iu(),su()}));function uu(e){return function(){return e}}var du=t((()=>{}));function fu(e){return+e}var pu=t((()=>{}));function mu(e){return e}function hu(e,t){return(t-=e=+e)?function(n){return(n-e)/t}:uu(isNaN(t)?NaN:.5)}function gu(e,t){var n;return e>t&&(n=e,e=t,t=n),function(n){return Math.max(e,Math.min(t,n))}}function _u(e,t,n){var r=e[0],i=e[1],a=t[0],o=t[1];return i<r?(r=hu(i,r),a=n(o,a)):(r=hu(r,i),a=n(a,o)),function(e){return a(r(e))}}function vu(e,t,n){var r=Math.min(e.length,t.length)-1,i=Array(r),a=Array(r),o=-1;for(e[r]<e[0]&&(e=e.slice().reverse(),t=t.slice().reverse());++o<r;)i[o]=hu(e[o],e[o+1]),a[o]=n(t[o],t[o+1]);return function(t){var n=S(e,t,1,r)-1;return a[n](i[n](t))}}function yu(e,t){return t.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown())}function bu(){var e=Su,t=Su,n=la,r,i,a,o=mu,s,c,l;function u(){var n=Math.min(e.length,t.length);return o!==mu&&(o=gu(e[0],e[n-1])),s=n>2?vu:_u,c=l=null,d}function d(i){return i==null||isNaN(i=+i)?a:(c||=s(e.map(r),t,n))(r(o(i)))}return d.invert=function(n){return o(i((l||=s(t,e.map(r),V))(n)))},d.domain=function(t){return arguments.length?(e=Array.from(t,fu),u()):e.slice()},d.range=function(e){return arguments.length?(t=Array.from(e),u()):t.slice()},d.rangeRound=function(e){return t=Array.from(e),n=da,u()},d.clamp=function(e){return arguments.length?(o=e?!0:mu,u()):o!==mu},d.interpolate=function(e){return arguments.length?(n=e,u()):n},d.unknown=function(e){return arguments.length?(a=e,d):a},function(e,t){return r=e,i=t,u()}}function xu(){return bu()(mu,mu)}var Su,Cu=t((()=>{N(),Oa(),du(),pu(),Su=[0,1]}));function wu(e,t,n,r){var i=j(e,t,n),a;switch(r=Cc(r??`,f`),r.type){case`s`:var o=Math.max(Math.abs(e),Math.abs(t));return r.precision==null&&!isNaN(a=Yc(i,o))&&(r.precision=a),Gc(r,o);case``:case`e`:case`g`:case`p`:case`r`:r.precision==null&&!isNaN(a=Zc(i,Math.max(Math.abs(e),Math.abs(t))))&&(r.precision=a-(r.type===`e`));break;case`f`:case`%`:r.precision==null&&!isNaN(a=qc(i))&&(r.precision=a-(r.type===`%`)*2);break}return Wc(r)}var Tu=t((()=>{N(),$c()}));function Eu(e){var t=e.domain;return e.ticks=function(e){var n=t();return ee(n[0],n[n.length-1],e??10)},e.tickFormat=function(e,n){var r=t();return wu(r[0],r[r.length-1],e??10,n)},e.nice=function(n){n??=10;var r=t(),i=0,a=r.length-1,o=r[i],s=r[a],c,l,u=10;for(s<o&&(l=o,o=s,s=l,l=i,i=a,a=l);u-- >0;){if(l=te(o,s,n),l===c)return r[i]=o,r[a]=s,t(r);if(l>0)o=Math.floor(o/l)*l,s=Math.ceil(s/l)*l;else if(l<0)o=Math.ceil(o*l)/l,s=Math.floor(s*l)/l;else break;c=l}return e},e}function Du(){var e=xu();return e.copy=function(){return yu(e,Du())},ru.apply(e,arguments),Eu(e)}var Ou=t((()=>{N(),Cu(),iu(),Tu()}));function ku(e,t){e=e.slice();var n=0,r=e.length-1,i=e[n],a=e[r],o;return a<i&&(o=n,n=r,r=o,o=i,i=a,a=o),e[n]=t.floor(i),e[r]=t.ceil(a),e}var Au=t((()=>{}));function K(e,t,n,r){function i(t){return e(t=arguments.length===0?new Date:new Date(+t)),t}return i.floor=t=>(e(t=new Date(+t)),t),i.ceil=n=>(e(n=new Date(n-1)),t(n,1),e(n),n),i.round=e=>{let t=i(e),n=i.ceil(e);return e-t<n-e?t:n},i.offset=(e,n)=>(t(e=new Date(+e),n==null?1:Math.floor(n)),e),i.range=(n,r,a)=>{let o=[];if(n=i.ceil(n),a=a==null?1:Math.floor(a),!(n<r)||!(a>0))return o;let s;do o.push(s=new Date(+n)),t(n,a),e(n);while(s<n&&n<r);return o},i.filter=n=>K(t=>{if(t>=t)for(;e(t),!n(t);)t.setTime(t-1)},(e,r)=>{if(e>=e)if(r<0)for(;++r<=0;)for(;t(e,-1),!n(e););else for(;--r>=0;)for(;t(e,1),!n(e););}),n&&(i.count=(t,r)=>(ju.setTime(+t),Mu.setTime(+r),e(ju),e(Mu),Math.floor(n(ju,Mu))),i.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?i.filter(r?t=>r(t)%e===0:t=>i.count(0,t)%e===0):i)),i}var ju,Mu,Nu=t((()=>{ju=new Date,Mu=new Date})),Pu,Fu=t((()=>{Nu(),Pu=K(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e),Pu.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?K(t=>{t.setTime(Math.floor(t/e)*e)},(t,n)=>{t.setTime(+t+n*e)},(t,n)=>(n-t)/e):Pu),Pu.range})),Iu,q,Lu,Ru,zu,Bu,Vu,Hu=t((()=>{Iu=1e3,q=Iu*60,Lu=q*60,Ru=Lu*24,zu=Ru*7,Bu=Ru*30,Vu=Ru*365})),Uu,Wu=t((()=>{Nu(),Hu(),Uu=K(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*Iu)},(e,t)=>(t-e)/Iu,e=>e.getUTCSeconds()),Uu.range})),Gu,Ku,qu=t((()=>{Nu(),Hu(),Gu=K(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*Iu)},(e,t)=>{e.setTime(+e+t*q)},(e,t)=>(t-e)/q,e=>e.getMinutes()),Gu.range,Ku=K(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*q)},(e,t)=>(t-e)/q,e=>e.getUTCMinutes()),Ku.range})),Ju,Yu,Xu=t((()=>{Nu(),Hu(),Ju=K(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*Iu-e.getMinutes()*q)},(e,t)=>{e.setTime(+e+t*Lu)},(e,t)=>(t-e)/Lu,e=>e.getHours()),Ju.range,Yu=K(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*Lu)},(e,t)=>(t-e)/Lu,e=>e.getUTCHours()),Yu.range})),Zu,Qu,$u,ed=t((()=>{Nu(),Hu(),Zu=K(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*q)/Ru,e=>e.getDate()-1),Zu.range,Qu=K(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/Ru,e=>e.getUTCDate()-1),Qu.range,$u=K(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/Ru,e=>Math.floor(e/Ru)),$u.range}));function td(e){return K(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(e,t)=>{e.setDate(e.getDate()+t*7)},(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*q)/zu)}function nd(e){return K(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t*7)},(e,t)=>(t-e)/zu)}var rd,id,ad,od,sd,cd,ld,ud,dd,fd,pd,md,hd,gd,_d=t((()=>{Nu(),Hu(),rd=td(0),id=td(1),ad=td(2),od=td(3),sd=td(4),cd=td(5),ld=td(6),rd.range,id.range,ad.range,od.range,sd.range,cd.range,ld.range,ud=nd(0),dd=nd(1),fd=nd(2),pd=nd(3),md=nd(4),hd=nd(5),gd=nd(6),ud.range,dd.range,fd.range,pd.range,md.range,hd.range,gd.range})),vd,yd,bd=t((()=>{Nu(),vd=K(e=>{e.setDate(1),e.setHours(0,0,0,0)},(e,t)=>{e.setMonth(e.getMonth()+t)},(e,t)=>t.getMonth()-e.getMonth()+(t.getFullYear()-e.getFullYear())*12,e=>e.getMonth()),vd.range,yd=K(e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCMonth(e.getUTCMonth()+t)},(e,t)=>t.getUTCMonth()-e.getUTCMonth()+(t.getUTCFullYear()-e.getUTCFullYear())*12,e=>e.getUTCMonth()),yd.range})),J,xd,Sd=t((()=>{Nu(),J=K(e=>{e.setMonth(0,1),e.setHours(0,0,0,0)},(e,t)=>{e.setFullYear(e.getFullYear()+t)},(e,t)=>t.getFullYear()-e.getFullYear(),e=>e.getFullYear()),J.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:K(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,n)=>{t.setFullYear(t.getFullYear()+n*e)}),J.range,xd=K(e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)},(e,t)=>t.getUTCFullYear()-e.getUTCFullYear(),e=>e.getUTCFullYear()),xd.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:K(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCFullYear(t.getUTCFullYear()+n*e)}),xd.range}));function Cd(e,t,n,r,i,a){let o=[[Uu,1,Iu],[Uu,5,5*Iu],[Uu,15,15*Iu],[Uu,30,30*Iu],[a,1,q],[a,5,5*q],[a,15,15*q],[a,30,30*q],[i,1,Lu],[i,3,3*Lu],[i,6,6*Lu],[i,12,12*Lu],[r,1,Ru],[r,2,2*Ru],[n,1,zu],[t,1,Bu],[t,3,3*Bu],[e,1,Vu]];function s(e,t,n){let r=t<e;r&&([e,t]=[t,e]);let i=n&&typeof n.range==`function`?n:c(e,t,n),a=i?i.range(e,+t+1):[];return r?a.reverse():a}function c(t,n,r){let i=Math.abs(n-t)/r,a=g(([,,e])=>e).right(o,i);if(a===o.length)return e.every(j(t/Vu,n/Vu,r));if(a===0)return Pu.every(Math.max(j(t,n,r),1));let[s,c]=o[i/o[a-1][2]<o[a][2]/i?a-1:a];return s.every(c)}return[s,c]}var wd,Td,Ed,Dd,Od=t((()=>{N(),Hu(),Fu(),Wu(),qu(),Xu(),ed(),_d(),bd(),Sd(),[wd,Td]=Cd(xd,yd,ud,$u,Yu,Ku),[Ed,Dd]=Cd(J,vd,rd,Zu,Ju,Gu)})),kd=t((()=>{Nu(),Fu(),Wu(),qu(),Xu(),ed(),_d(),bd(),Sd(),Od()}));function Ad(e){if(0<=e.y&&e.y<100){var t=new Date(-1,e.m,e.d,e.H,e.M,e.S,e.L);return t.setFullYear(e.y),t}return new Date(e.y,e.m,e.d,e.H,e.M,e.S,e.L)}function jd(e){if(0<=e.y&&e.y<100){var t=new Date(Date.UTC(-1,e.m,e.d,e.H,e.M,e.S,e.L));return t.setUTCFullYear(e.y),t}return new Date(Date.UTC(e.y,e.m,e.d,e.H,e.M,e.S,e.L))}function Md(e,t,n){return{y:e,m:t,d:n,H:0,M:0,S:0,L:0}}function Nd(e){var t=e.dateTime,n=e.date,r=e.time,i=e.periods,a=e.days,o=e.shortDays,s=e.months,c=e.shortMonths,l=Fd(i),u=Id(i),d=Fd(a),f=Id(a),p=Fd(o),m=Id(o),h=Fd(s),g=Id(s),_=Fd(c),v=Id(c),y={a:j,A:ne,b:re,B:ie,c:null,d:rf,e:rf,f:lf,g:bf,G:Sf,H:af,I:of,j:sf,L:cf,m:uf,M:df,p:ae,q:oe,Q:Gf,s:Kf,S:ff,u:pf,U:mf,V:gf,w:_f,W:vf,x:null,X:null,y:yf,Y:xf,Z:Cf,"%":Wf},b={a:se,A:M,b:ce,B:le,c:null,d:wf,e:wf,f:kf,g:Bf,G:Hf,H:Tf,I:Ef,j:Df,L:Of,m:Af,M:jf,p:ue,q:N,Q:Gf,s:Kf,S:Mf,u:Nf,U:Pf,V:If,w:Lf,W:Rf,x:null,X:null,y:zf,Y:Vf,Z:Uf,"%":Wf},x={a:E,A:D,b:O,B:k,c:A,d:qd,e:qd,f:$d,g:Ud,G:Hd,H:Yd,I:Yd,j:Jd,L:Qd,m:Kd,M:Xd,p:T,q:Gd,Q:tf,s:nf,S:Zd,u:Rd,U:zd,V:Bd,w:Ld,W:Vd,x:ee,X:te,y:Ud,Y:Hd,Z:Wd,"%":ef};y.x=S(n,y),y.X=S(r,y),y.c=S(t,y),b.x=S(n,b),b.X=S(r,b),b.c=S(t,b);function S(e,t){return function(n){var r=[],i=-1,a=0,o=e.length,s,c,l;for(n instanceof Date||(n=new Date(+n));++i<o;)e.charCodeAt(i)===37&&(r.push(e.slice(a,i)),(c=qf[s=e.charAt(++i)])==null?c=s===`e`?` `:`0`:s=e.charAt(++i),(l=t[s])&&(s=l(n,c)),r.push(s),a=i+1);return r.push(e.slice(a,i)),r.join(``)}}function C(e,t){return function(n){var r=Md(1900,void 0,1),i=w(r,e,n+=``,0),a,o;if(i!=n.length)return null;if(`Q`in r)return new Date(r.Q);if(`s`in r)return new Date(r.s*1e3+(`L`in r?r.L:0));if(t&&!(`Z`in r)&&(r.Z=0),`p`in r&&(r.H=r.H%12+r.p*12),r.m===void 0&&(r.m=`q`in r?r.q:0),`V`in r){if(r.V<1||r.V>53)return null;`w`in r||(r.w=1),`Z`in r?(a=jd(Md(r.y,0,1)),o=a.getUTCDay(),a=o>4||o===0?dd.ceil(a):dd(a),a=Qu.offset(a,(r.V-1)*7),r.y=a.getUTCFullYear(),r.m=a.getUTCMonth(),r.d=a.getUTCDate()+(r.w+6)%7):(a=Ad(Md(r.y,0,1)),o=a.getDay(),a=o>4||o===0?id.ceil(a):id(a),a=Zu.offset(a,(r.V-1)*7),r.y=a.getFullYear(),r.m=a.getMonth(),r.d=a.getDate()+(r.w+6)%7)}else (`W`in r||`U`in r)&&(`w`in r||(r.w=`u`in r?r.u%7:+(`W`in r)),o=`Z`in r?jd(Md(r.y,0,1)).getUTCDay():Ad(Md(r.y,0,1)).getDay(),r.m=0,r.d=`W`in r?(r.w+6)%7+r.W*7-(o+5)%7:r.w+r.U*7-(o+6)%7);return`Z`in r?(r.H+=r.Z/100|0,r.M+=r.Z%100,jd(r)):Ad(r)}}function w(e,t,n,r){for(var i=0,a=t.length,o=n.length,s,c;i<a;){if(r>=o)return-1;if(s=t.charCodeAt(i++),s===37){if(s=t.charAt(i++),c=x[s in qf?t.charAt(i++):s],!c||(r=c(e,n,r))<0)return-1}else if(s!=n.charCodeAt(r++))return-1}return r}function T(e,t,n){var r=l.exec(t.slice(n));return r?(e.p=u.get(r[0].toLowerCase()),n+r[0].length):-1}function E(e,t,n){var r=p.exec(t.slice(n));return r?(e.w=m.get(r[0].toLowerCase()),n+r[0].length):-1}function D(e,t,n){var r=d.exec(t.slice(n));return r?(e.w=f.get(r[0].toLowerCase()),n+r[0].length):-1}function O(e,t,n){var r=_.exec(t.slice(n));return r?(e.m=v.get(r[0].toLowerCase()),n+r[0].length):-1}function k(e,t,n){var r=h.exec(t.slice(n));return r?(e.m=g.get(r[0].toLowerCase()),n+r[0].length):-1}function A(e,n,r){return w(e,t,n,r)}function ee(e,t,r){return w(e,n,t,r)}function te(e,t,n){return w(e,r,t,n)}function j(e){return o[e.getDay()]}function ne(e){return a[e.getDay()]}function re(e){return c[e.getMonth()]}function ie(e){return s[e.getMonth()]}function ae(e){return i[+(e.getHours()>=12)]}function oe(e){return 1+~~(e.getMonth()/3)}function se(e){return o[e.getUTCDay()]}function M(e){return a[e.getUTCDay()]}function ce(e){return c[e.getUTCMonth()]}function le(e){return s[e.getUTCMonth()]}function ue(e){return i[+(e.getUTCHours()>=12)]}function N(e){return 1+~~(e.getUTCMonth()/3)}return{format:function(e){var t=S(e+=``,y);return t.toString=function(){return e},t},parse:function(e){var t=C(e+=``,!1);return t.toString=function(){return e},t},utcFormat:function(e){var t=S(e+=``,b);return t.toString=function(){return e},t},utcParse:function(e){var t=C(e+=``,!0);return t.toString=function(){return e},t}}}function Y(e,t,n){var r=e<0?`-`:``,i=(r?-e:e)+``,a=i.length;return r+(a<n?Array(n-a+1).join(t)+i:i)}function Pd(e){return e.replace(Yf,`\\$&`)}function Fd(e){return RegExp(`^(?:`+e.map(Pd).join(`|`)+`)`,`i`)}function Id(e){return new Map(e.map((e,t)=>[e.toLowerCase(),t]))}function Ld(e,t,n){var r=X.exec(t.slice(n,n+1));return r?(e.w=+r[0],n+r[0].length):-1}function Rd(e,t,n){var r=X.exec(t.slice(n,n+1));return r?(e.u=+r[0],n+r[0].length):-1}function zd(e,t,n){var r=X.exec(t.slice(n,n+2));return r?(e.U=+r[0],n+r[0].length):-1}function Bd(e,t,n){var r=X.exec(t.slice(n,n+2));return r?(e.V=+r[0],n+r[0].length):-1}function Vd(e,t,n){var r=X.exec(t.slice(n,n+2));return r?(e.W=+r[0],n+r[0].length):-1}function Hd(e,t,n){var r=X.exec(t.slice(n,n+4));return r?(e.y=+r[0],n+r[0].length):-1}function Ud(e,t,n){var r=X.exec(t.slice(n,n+2));return r?(e.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function Wd(e,t,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(n,n+6));return r?(e.Z=r[1]?0:-(r[2]+(r[3]||`00`)),n+r[0].length):-1}function Gd(e,t,n){var r=X.exec(t.slice(n,n+1));return r?(e.q=r[0]*3-3,n+r[0].length):-1}function Kd(e,t,n){var r=X.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function qd(e,t,n){var r=X.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function Jd(e,t,n){var r=X.exec(t.slice(n,n+3));return r?(e.m=0,e.d=+r[0],n+r[0].length):-1}function Yd(e,t,n){var r=X.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function Xd(e,t,n){var r=X.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function Zd(e,t,n){var r=X.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function Qd(e,t,n){var r=X.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function $d(e,t,n){var r=X.exec(t.slice(n,n+6));return r?(e.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function ef(e,t,n){var r=Jf.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function tf(e,t,n){var r=X.exec(t.slice(n));return r?(e.Q=+r[0],n+r[0].length):-1}function nf(e,t,n){var r=X.exec(t.slice(n));return r?(e.s=+r[0],n+r[0].length):-1}function rf(e,t){return Y(e.getDate(),t,2)}function af(e,t){return Y(e.getHours(),t,2)}function of(e,t){return Y(e.getHours()%12||12,t,2)}function sf(e,t){return Y(1+Zu.count(J(e),e),t,3)}function cf(e,t){return Y(e.getMilliseconds(),t,3)}function lf(e,t){return cf(e,t)+`000`}function uf(e,t){return Y(e.getMonth()+1,t,2)}function df(e,t){return Y(e.getMinutes(),t,2)}function ff(e,t){return Y(e.getSeconds(),t,2)}function pf(e){var t=e.getDay();return t===0?7:t}function mf(e,t){return Y(rd.count(J(e)-1,e),t,2)}function hf(e){var t=e.getDay();return t>=4||t===0?sd(e):sd.ceil(e)}function gf(e,t){return e=hf(e),Y(sd.count(J(e),e)+(J(e).getDay()===4),t,2)}function _f(e){return e.getDay()}function vf(e,t){return Y(id.count(J(e)-1,e),t,2)}function yf(e,t){return Y(e.getFullYear()%100,t,2)}function bf(e,t){return e=hf(e),Y(e.getFullYear()%100,t,2)}function xf(e,t){return Y(e.getFullYear()%1e4,t,4)}function Sf(e,t){var n=e.getDay();return e=n>=4||n===0?sd(e):sd.ceil(e),Y(e.getFullYear()%1e4,t,4)}function Cf(e){var t=e.getTimezoneOffset();return(t>0?`-`:(t*=-1,`+`))+Y(t/60|0,`0`,2)+Y(t%60,`0`,2)}function wf(e,t){return Y(e.getUTCDate(),t,2)}function Tf(e,t){return Y(e.getUTCHours(),t,2)}function Ef(e,t){return Y(e.getUTCHours()%12||12,t,2)}function Df(e,t){return Y(1+Qu.count(xd(e),e),t,3)}function Of(e,t){return Y(e.getUTCMilliseconds(),t,3)}function kf(e,t){return Of(e,t)+`000`}function Af(e,t){return Y(e.getUTCMonth()+1,t,2)}function jf(e,t){return Y(e.getUTCMinutes(),t,2)}function Mf(e,t){return Y(e.getUTCSeconds(),t,2)}function Nf(e){var t=e.getUTCDay();return t===0?7:t}function Pf(e,t){return Y(ud.count(xd(e)-1,e),t,2)}function Ff(e){var t=e.getUTCDay();return t>=4||t===0?md(e):md.ceil(e)}function If(e,t){return e=Ff(e),Y(md.count(xd(e),e)+(xd(e).getUTCDay()===4),t,2)}function Lf(e){return e.getUTCDay()}function Rf(e,t){return Y(dd.count(xd(e)-1,e),t,2)}function zf(e,t){return Y(e.getUTCFullYear()%100,t,2)}function Bf(e,t){return e=Ff(e),Y(e.getUTCFullYear()%100,t,2)}function Vf(e,t){return Y(e.getUTCFullYear()%1e4,t,4)}function Hf(e,t){var n=e.getUTCDay();return e=n>=4||n===0?md(e):md.ceil(e),Y(e.getUTCFullYear()%1e4,t,4)}function Uf(){return`+0000`}function Wf(){return`%`}function Gf(e){return+e}function Kf(e){return Math.floor(e/1e3)}var qf,X,Jf,Yf,Xf=t((()=>{kd(),qf={"-":``,_:` `,0:`0`},X=/^\s*\d+/,Jf=/^%/,Yf=/[\\^$*+?|[\]().{}]/g}));function Zf(e){return Qf=Nd(e),$f=Qf.format,ep=Qf.parse,tp=Qf.utcFormat,np=Qf.utcParse,Qf}var Qf,$f,ep,tp,np,rp=t((()=>{Xf(),Zf({dateTime:`%x, %X`,date:`%-m/%-d/%Y`,time:`%-I:%M:%S %p`,periods:[`AM`,`PM`],days:[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`],shortDays:[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],months:[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],shortMonths:[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`]})})),ip=t((()=>{rp(),Xf()}));function ap(e){return new Date(e)}function op(e){return e instanceof Date?+e:+new Date(+e)}function sp(e,t,n,r,i,a,o,s,c,l){var u=xu(),d=u.invert,f=u.domain,p=l(`.%L`),m=l(`:%S`),h=l(`%I:%M`),g=l(`%I %p`),_=l(`%a %d`),v=l(`%b %d`),y=l(`%B`),b=l(`%Y`);function x(e){return(c(e)<e?p:s(e)<e?m:o(e)<e?h:a(e)<e?g:r(e)<e?i(e)<e?_:v:n(e)<e?y:b)(e)}return u.invert=function(e){return new Date(d(e))},u.domain=function(e){return arguments.length?f(Array.from(e,op)):f().map(ap)},u.ticks=function(t){var n=f();return e(n[0],n[n.length-1],t??10)},u.tickFormat=function(e,t){return t==null?x:l(t)},u.nice=function(e){var n=f();return(!e||typeof e.range!=`function`)&&(e=t(n[0],n[n.length-1],e??10)),e?f(ku(n,e)):u},u.copy=function(){return yu(u,sp(e,t,n,r,i,a,o,s,c,l))},u}function cp(){return ru.apply(sp(Ed,Dd,J,vd,rd,Zu,Ju,Gu,Uu,$f).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}var lp=t((()=>{kd(),ip(),Cu(),iu(),Au()})),up=t((()=>{lu(),Ou(),pu(),N(),$c(),Au(),Cu(),iu(),su(),lp(),kd(),ip(),Oa(),Tu()}));function dp(e){for(var t=e.length/6|0,n=Array(t),r=0;r<t;)n[r]=`#`+e.slice(r*6,++r*6);return n}var fp=t((()=>{})),pp,mp=t((()=>{fp(),pp=dp(`4e79a7f28e2ce1575976b7b259a14fedc949af7aa1ff9da79c755fbab0ab`)})),hp=t((()=>{fp(),mp(),Oa(),Pi()}));function Z(e){return function(){return e}}var gp=t((()=>{}));function _p(e){return e>1?0:e<-1?wp:Math.acos(e)}function vp(e){return e>=1?Tp:e<=-1?-Tp:Math.asin(e)}var yp,Q,bp,xp,Sp,$,Cp,wp,Tp,Ep,Dp=t((()=>{yp=Math.abs,Q=Math.atan2,bp=Math.cos,xp=Math.max,Sp=Math.min,$=Math.sin,Cp=Math.sqrt,wp=Math.PI,Tp=wp/2,Ep=2*wp}));function Op(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(n==null)t=null;else{let e=Math.floor(n);if(!(e>=0))throw RangeError(`invalid digits: ${n}`);t=e}return e},()=>new ic(t)}var kp=t((()=>{oc()}));function Ap(e){return e.innerRadius}function jp(e){return e.outerRadius}function Mp(e){return e.startAngle}function Np(e){return e.endAngle}function Pp(e){return e&&e.padAngle}function Fp(e,t,n,r,i,a,o,s){var c=n-e,l=r-t,u=o-i,d=s-a,f=d*c-u*l;if(!(f*f<1e-12))return f=(u*(t-a)-d*(e-i))/f,[e+f*c,t+f*l]}function Ip(e,t,n,r,i,a,o){var s=e-n,c=t-r,l=(o?a:-a)/Cp(s*s+c*c),u=l*c,d=-l*s,f=e+u,p=t+d,m=n+u,h=r+d,g=(f+m)/2,_=(p+h)/2,v=m-f,y=h-p,b=v*v+y*y,x=i-a,S=f*h-m*p,C=(y<0?-1:1)*Cp(xp(0,x*x*b-S*S)),w=(S*y-v*C)/b,T=(-S*v-y*C)/b,E=(S*y+v*C)/b,D=(-S*v+y*C)/b,O=w-g,k=T-_,A=E-g,ee=D-_;return O*O+k*k>A*A+ee*ee&&(w=E,T=D),{cx:w,cy:T,x01:-u,y01:-d,x11:w*(i/x-1),y11:T*(i/x-1)}}function Lp(){var e=Ap,t=jp,n=Z(0),r=null,i=Mp,a=Np,o=Pp,s=null,c=Op(l);function l(){var l,u,d=+e.apply(this,arguments),f=+t.apply(this,arguments),p=i.apply(this,arguments)-Tp,m=a.apply(this,arguments)-Tp,h=yp(m-p),g=m>p;if(s||=l=c(),f<d&&(u=f,f=d,d=u),!(f>1e-12))s.moveTo(0,0);else if(h>Ep-1e-12)s.moveTo(f*bp(p),f*$(p)),s.arc(0,0,f,p,m,!g),d>1e-12&&(s.moveTo(d*bp(m),d*$(m)),s.arc(0,0,d,m,p,g));else{var _=p,v=m,y=p,b=m,x=h,S=h,C=o.apply(this,arguments)/2,w=C>1e-12&&(r?+r.apply(this,arguments):Cp(d*d+f*f)),T=Sp(yp(f-d)/2,+n.apply(this,arguments)),E=T,D=T,O,k;if(w>1e-12){var A=vp(w/d*$(C)),ee=vp(w/f*$(C));(x-=A*2)>1e-12?(A*=g?1:-1,y+=A,b-=A):(x=0,y=b=(p+m)/2),(S-=ee*2)>1e-12?(ee*=g?1:-1,_+=ee,v-=ee):(S=0,_=v=(p+m)/2)}var te=f*bp(_),j=f*$(_),ne=d*bp(b),re=d*$(b);if(T>1e-12){var ie=f*bp(v),ae=f*$(v),oe=d*bp(y),se=d*$(y),M;if(h<wp)if(M=Fp(te,j,oe,se,ie,ae,ne,re)){var ce=te-M[0],le=j-M[1],ue=ie-M[0],N=ae-M[1],de=1/$(_p((ce*ue+le*N)/(Cp(ce*ce+le*le)*Cp(ue*ue+N*N)))/2),fe=Cp(M[0]*M[0]+M[1]*M[1]);E=Sp(T,(d-fe)/(de-1)),D=Sp(T,(f-fe)/(de+1))}else E=D=0}S>1e-12?D>1e-12?(O=Ip(oe,se,te,j,f,D,g),k=Ip(ie,ae,ne,re,f,D,g),s.moveTo(O.cx+O.x01,O.cy+O.y01),D<T?s.arc(O.cx,O.cy,D,Q(O.y01,O.x01),Q(k.y01,k.x01),!g):(s.arc(O.cx,O.cy,D,Q(O.y01,O.x01),Q(O.y11,O.x11),!g),s.arc(0,0,f,Q(O.cy+O.y11,O.cx+O.x11),Q(k.cy+k.y11,k.cx+k.x11),!g),s.arc(k.cx,k.cy,D,Q(k.y11,k.x11),Q(k.y01,k.x01),!g))):(s.moveTo(te,j),s.arc(0,0,f,_,v,!g)):s.moveTo(te,j),!(d>1e-12)||!(x>1e-12)?s.lineTo(ne,re):E>1e-12?(O=Ip(ne,re,ie,ae,d,-E,g),k=Ip(te,j,oe,se,d,-E,g),s.lineTo(O.cx+O.x01,O.cy+O.y01),E<T?s.arc(O.cx,O.cy,E,Q(O.y01,O.x01),Q(k.y01,k.x01),!g):(s.arc(O.cx,O.cy,E,Q(O.y01,O.x01),Q(O.y11,O.x11),!g),s.arc(0,0,d,Q(O.cy+O.y11,O.cx+O.x11),Q(k.cy+k.y11,k.cx+k.x11),g),s.arc(k.cx,k.cy,E,Q(k.y11,k.x11),Q(k.y01,k.x01),!g))):s.arc(0,0,d,b,y,g)}if(s.closePath(),l)return s=null,l+``||null}return l.centroid=function(){var n=(+e.apply(this,arguments)+ +t.apply(this,arguments))/2,r=(+i.apply(this,arguments)+ +a.apply(this,arguments))/2-wp/2;return[bp(r)*n,$(r)*n]},l.innerRadius=function(t){return arguments.length?(e=typeof t==`function`?t:Z(+t),l):e},l.outerRadius=function(e){return arguments.length?(t=typeof e==`function`?e:Z(+e),l):t},l.cornerRadius=function(e){return arguments.length?(n=typeof e==`function`?e:Z(+e),l):n},l.padRadius=function(e){return arguments.length?(r=e==null?null:typeof e==`function`?e:Z(+e),l):r},l.startAngle=function(e){return arguments.length?(i=typeof e==`function`?e:Z(+e),l):i},l.endAngle=function(e){return arguments.length?(a=typeof e==`function`?e:Z(+e),l):a},l.padAngle=function(e){return arguments.length?(o=typeof e==`function`?e:Z(+e),l):o},l.context=function(e){return arguments.length?(s=e??null,l):s},l}var Rp=t((()=>{gp(),Dp(),kp()}));function zp(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}var Bp=t((()=>{Array.prototype.slice}));function Vp(e){this._context=e}function Hp(e){return new Vp(e)}var Up=t((()=>{Vp.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t);break}}}}));function Wp(e){return e[0]}function Gp(e){return e[1]}var Kp=t((()=>{}));function qp(e,t){var n=Z(!0),r=null,i=Hp,a=null,o=Op(s);e=typeof e==`function`?e:e===void 0?Wp:Z(e),t=typeof t==`function`?t:t===void 0?Gp:Z(t);function s(s){var c,l=(s=zp(s)).length,u,d=!1,f;for(r??(a=i(f=o())),c=0;c<=l;++c)!(c<l&&n(u=s[c],c,s))===d&&((d=!d)?a.lineStart():a.lineEnd()),d&&a.point(+e(u,c,s),+t(u,c,s));if(f)return a=null,f+``||null}return s.x=function(t){return arguments.length?(e=typeof t==`function`?t:Z(+t),s):e},s.y=function(e){return arguments.length?(t=typeof e==`function`?e:Z(+e),s):t},s.defined=function(e){return arguments.length?(n=typeof e==`function`?e:Z(!!e),s):n},s.curve=function(e){return arguments.length?(i=e,r!=null&&(a=i(r)),s):i},s.context=function(e){return arguments.length?(e==null?r=a=null:a=i(r=e),s):r},s}var Jp=t((()=>{Bp(),gp(),Up(),kp(),Kp()}));function Yp(e,t){return t<e?-1:t>e?1:t>=e?0:NaN}var Xp=t((()=>{}));function Zp(e){return e}var Qp=t((()=>{}));function $p(){var e=Zp,t=Yp,n=null,r=Z(0),i=Z(Ep),a=Z(0);function o(o){var s,c=(o=zp(o)).length,l,u,d=0,f=Array(c),p=Array(c),m=+r.apply(this,arguments),h=Math.min(Ep,Math.max(-Ep,i.apply(this,arguments)-m)),g,_=Math.min(Math.abs(h)/c,a.apply(this,arguments)),v=_*(h<0?-1:1),y;for(s=0;s<c;++s)(y=p[f[s]=s]=+e(o[s],s,o))>0&&(d+=y);for(t==null?n!=null&&f.sort(function(e,t){return n(o[e],o[t])}):f.sort(function(e,n){return t(p[e],p[n])}),s=0,u=d?(h-c*v)/d:0;s<c;++s,m=g)l=f[s],y=p[l],g=m+(y>0?y*u:0)+v,p[l]={data:o[l],index:s,value:y,startAngle:m,endAngle:g,padAngle:_};return p}return o.value=function(t){return arguments.length?(e=typeof t==`function`?t:Z(+t),o):e},o.sortValues=function(e){return arguments.length?(t=e,n=null,o):t},o.sort=function(e){return arguments.length?(n=e,t=null,o):n},o.startAngle=function(e){return arguments.length?(r=typeof e==`function`?e:Z(+e),o):r},o.endAngle=function(e){return arguments.length?(i=typeof e==`function`?e:Z(+e),o):i},o.padAngle=function(e){return arguments.length?(a=typeof e==`function`?e:Z(+e),o):a},o}var em=t((()=>{Bp(),gp(),Xp(),Qp(),Dp()}));function tm(e){return new rm(e,!0)}function nm(e){return new rm(e,!1)}var rm,im=t((()=>{rm=class{constructor(e,t){this._context=e,this._x=t}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._x?this._context.bezierCurveTo(this._x0=(this._x0+e)/2,this._y0,this._x0,t,e,t):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+t)/2,e,this._y0,e,t);break}this._x0=e,this._y0=t}}}));function am(){}var om=t((()=>{}));function sm(e,t,n){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+n)/6)}function cm(e){this._context=e}function lm(e){return new cm(e)}var um=t((()=>{cm.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:sm(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:sm(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}}}));function dm(e){this._context=e}function fm(e){return new dm(e)}var pm=t((()=>{om(),um(),dm.prototype={areaStart:am,areaEnd:am,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:sm(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}}}));function mm(e){this._context=e}function hm(e){return new mm(e)}var gm=t((()=>{um(),mm.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+e)/6,r=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:sm(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}}}));function _m(e,t){this._basis=new cm(e),this._beta=t}var vm,ym=t((()=>{um(),_m.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var e=this._x,t=this._y,n=e.length-1;if(n>0)for(var r=e[0],i=t[0],a=e[n]-r,o=t[n]-i,s=-1,c;++s<=n;)c=s/n,this._basis.point(this._beta*e[s]+(1-this._beta)*(r+c*a),this._beta*t[s]+(1-this._beta)*(i+c*o));this._x=this._y=null,this._basis.lineEnd()},point:function(e,t){this._x.push(+e),this._y.push(+t)}},vm=(function e(t){function n(e){return t===1?new cm(e):new _m(e,t)}return n.beta=function(t){return e(+t)},n})(.85)}));function bm(e,t,n){e._context.bezierCurveTo(e._x1+e._k*(e._x2-e._x0),e._y1+e._k*(e._y2-e._y0),e._x2+e._k*(e._x1-t),e._y2+e._k*(e._y1-n),e._x2,e._y2)}function xm(e,t){this._context=e,this._k=(1-t)/6}var Sm,Cm=t((()=>{xm.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:bm(this,this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2,this._x1=e,this._y1=t;break;case 2:this._point=3;default:bm(this,e,t);break}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}},Sm=(function e(t){function n(e){return new xm(e,t)}return n.tension=function(t){return e(+t)},n})(0)}));function wm(e,t){this._context=e,this._k=(1-t)/6}var Tm,Em=t((()=>{om(),Cm(),wm.prototype={areaStart:am,areaEnd:am,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5);break}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x3=e,this._y3=t;break;case 1:this._point=2,this._context.moveTo(this._x4=e,this._y4=t);break;case 2:this._point=3,this._x5=e,this._y5=t;break;default:bm(this,e,t);break}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}},Tm=(function e(t){function n(e){return new wm(e,t)}return n.tension=function(t){return e(+t)},n})(0)}));function Dm(e,t){this._context=e,this._k=(1-t)/6}var Om,km=t((()=>{Cm(),Dm.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:bm(this,e,t);break}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}},Om=(function e(t){function n(e){return new Dm(e,t)}return n.tension=function(t){return e(+t)},n})(0)}));function Am(e,t,n){var r=e._x1,i=e._y1,a=e._x2,o=e._y2;if(e._l01_a>1e-12){var s=2*e._l01_2a+3*e._l01_a*e._l12_a+e._l12_2a,c=3*e._l01_a*(e._l01_a+e._l12_a);r=(r*s-e._x0*e._l12_2a+e._x2*e._l01_2a)/c,i=(i*s-e._y0*e._l12_2a+e._y2*e._l01_2a)/c}if(e._l23_a>1e-12){var l=2*e._l23_2a+3*e._l23_a*e._l12_a+e._l12_2a,u=3*e._l23_a*(e._l23_a+e._l12_a);a=(a*l+e._x1*e._l23_2a-t*e._l12_2a)/u,o=(o*l+e._y1*e._l23_2a-n*e._l12_2a)/u}e._context.bezierCurveTo(r,i,a,o,e._x2,e._y2)}function jm(e,t){this._context=e,this._alpha=t}var Mm,Nm=t((()=>{Dp(),Cm(),jm.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,r=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=(n*n+r*r)**+this._alpha)}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3;default:Am(this,e,t);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}},Mm=(function e(t){function n(e){return t?new jm(e,t):new xm(e,0)}return n.alpha=function(t){return e(+t)},n})(.5)}));function Pm(e,t){this._context=e,this._alpha=t}var Fm,Im=t((()=>{Em(),om(),Nm(),Pm.prototype={areaStart:am,areaEnd:am,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5);break}},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,r=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=(n*n+r*r)**+this._alpha)}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=t;break;case 1:this._point=2,this._context.moveTo(this._x4=e,this._y4=t);break;case 2:this._point=3,this._x5=e,this._y5=t;break;default:Am(this,e,t);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}},Fm=(function e(t){function n(e){return t?new Pm(e,t):new wm(e,0)}return n.alpha=function(t){return e(+t)},n})(.5)}));function Lm(e,t){this._context=e,this._alpha=t}var Rm,zm=t((()=>{km(),Nm(),Lm.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,r=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=(n*n+r*r)**+this._alpha)}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:Am(this,e,t);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}},Rm=(function e(t){function n(e){return t?new Lm(e,t):new Dm(e,0)}return n.alpha=function(t){return e(+t)},n})(.5)}));function Bm(e){this._context=e}function Vm(e){return new Bm(e)}var Hm=t((()=>{om(),Bm.prototype={areaStart:am,areaEnd:am,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}}}));function Um(e){return e<0?-1:1}function Wm(e,t,n){var r=e._x1-e._x0,i=t-e._x1,a=(e._y1-e._y0)/(r||i<0&&-0),o=(n-e._y1)/(i||r<0&&-0),s=(a*i+o*r)/(r+i);return(Um(a)+Um(o))*Math.min(Math.abs(a),Math.abs(o),.5*Math.abs(s))||0}function Gm(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function Km(e,t,n){var r=e._x0,i=e._y0,a=e._x1,o=e._y1,s=(a-r)/3;e._context.bezierCurveTo(r+s,i+s*t,a-s,o-s*n,a,o)}function qm(e){this._context=e}function Jm(e){this._context=new Ym(e)}function Ym(e){this._context=e}function Xm(e){return new qm(e)}function Zm(e){return new Jm(e)}var Qm=t((()=>{qm.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:Km(this,this._t0,Gm(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,Km(this,Gm(this,n=Wm(this,e,t)),n);break;default:Km(this,this._t0,n=Wm(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}},(Jm.prototype=Object.create(qm.prototype)).point=function(e,t){qm.prototype.point.call(this,t,e)},Ym.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,n,r,i,a){this._context.bezierCurveTo(t,e,r,n,a,i)}}}));function $m(e){this._context=e}function eh(e){var t,n=e.length-1,r,i=Array(n),a=Array(n),o=Array(n);for(i[0]=0,a[0]=2,o[0]=e[0]+2*e[1],t=1;t<n-1;++t)i[t]=1,a[t]=4,o[t]=4*e[t]+2*e[t+1];for(i[n-1]=2,a[n-1]=7,o[n-1]=8*e[n-1]+e[n],t=1;t<n;++t)r=i[t]/a[t-1],a[t]-=r,o[t]-=r*o[t-1];for(i[n-1]=o[n-1]/a[n-1],t=n-2;t>=0;--t)i[t]=(o[t]-i[t+1])/a[t];for(a[n-1]=(e[n]+i[n-1])/2,t=0;t<n-1;++t)a[t]=2*e[t+1]-i[t+1];return[i,a]}function th(e){return new $m(e)}var nh=t((()=>{$m.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,n=e.length;if(n)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),n===2)this._context.lineTo(e[1],t[1]);else for(var r=eh(e),i=eh(t),a=0,o=1;o<n;++a,++o)this._context.bezierCurveTo(r[0][a],i[0][a],r[1][a],i[1][a],e[o],t[o]);(this._line||this._line!==0&&n===1)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(e,t){this._x.push(+e),this._y.push(+t)}}}));function rh(e,t){this._context=e,this._t=t}function ih(e){return new rh(e,.5)}function ah(e){return new rh(e,0)}function oh(e){return new rh(e,1)}var sh=t((()=>{rh.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&this._point===2&&this._context.lineTo(this._x,this._y),(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}break}this._x=e,this._y=t}}})),ch=t((()=>{Rp(),Bp(),gp(),Up(),Jp(),kp(),Kp(),em(),im(),Dp(),pm(),gm(),um(),ym(),Em(),km(),Cm(),Im(),zm(),Nm(),Hm(),Qm(),nh(),sh()}));function lh(e,t,n){this.k=e,this.x=t,this.y=n}function uh(e){for(;!e.__zoom;)if(!(e=e.parentNode))return dh;return e.__zoom}var dh,fh=t((()=>{lh.prototype={constructor:lh,scale:function(e){return e===1?this:new lh(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new lh(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return`translate(`+this.x+`,`+this.y+`) scale(`+this.k+`)`}},dh=new lh(1,0,0),uh.prototype=lh.prototype})),ph=t((()=>{Ws(),fh()})),mh=t((()=>{ph(),fh()})),hh=t((()=>{N(),De(),Xs(),sc(),Pi(),cc(),lc(),Fe(),Dr(),uc(),Rs(),dc(),pc(),$c(),el(),eu(),Oa(),oc(),tu(),fc(),nu(),up(),hp(),I(),ch(),kd(),ip(),Qa(),Ws(),mh()}));export{cd as $,pm as A,Er as At,Up as B,c as Bt,Sm as C,Ql as Ct,hm as D,Kc as Dt,ym as E,Wc as Et,im as F,ce as Ft,mp as G,Lp as H,a as Ht,em as I,M as It,rp as J,lp as K,$p as L,se as Lt,um as M,be as Mt,tm as N,ye as Nt,gm as O,Ea as Ot,nm as P,Ee as Pt,_d as Q,Jp as R,oe as Rt,Em as S,$l as St,vm as T,Il as Tt,Rp as U,Hp as V,l as Vt,pp as W,bd as X,$f as Y,vd as Z,Mm as _,Du as _t,ih as a,od as at,km as b,su as bt,Qm as c,Xu as ct,Hm as d,Gu as dt,id as et,Vm as f,Wu as ft,Im as g,Ou as gt,Fm as h,Pu as ht,ah as i,ad as it,lm as j,Tr as jt,fm as k,Da as kt,Xm as l,Ju as lt,zm as m,Fu as mt,sh as n,rd as nt,nh as o,ed as ot,Rm as p,Uu as pt,cp as q,oh as r,sd as rt,th as s,Zu as st,hh as t,ld as tt,Zm as u,qu as ut,Nm as v,cu as vt,Cm as w,kl as wt,Tm as x,au as xt,Om as y,lu as yt,qp as z,d as zt};
@@ -1 +0,0 @@
1
- import{n as e}from"./chunk-CacB07dV.js";import{n as t,r as n}from"./chunk-Y2CYZVJY-C9o-s6OY.js";import{Bt as r,j as i,jt as a,t as o,z as s,zt as c}from"./src-DnfeXQPr.js";import{O as l,c as u,j as d,s as f,x as p}from"./chunk-DU6HZSFF-CnFngIhW.js";import{n as m}from"./chunk-PWAF6VOD-Cc2uVDsG.js";import{_ as h,d as g}from"./chunk-75Z2AOVW-_M0z5olV.js";import{i as _}from"./chunk-GMAD6QVW-BuhEcgHq.js";import{n as v}from"./chunk-P2QGCYS3-UFEU6BxZ.js";import{r as y}from"./chunk-TEH6E4GO-G4Cdlyrt.js";import{r as b}from"./chunk-OBVCFTLP-CRIkunUB.js";import{i as x}from"./chunk-R7TYR2AO-DiCxzdAY.js";import{n as S,t as C}from"./graphlib-CTR5ZhLf.js";import{l as w}from"./chunk-F27PBJKO-BqtWrnEO.js";import{n as ee}from"./chunk-XXDRQBXY-DnJkbUaw.js";import{t as T}from"./chunk-POPQ4Y6H-CQcrNbjr.js";import{n as E}from"./chunk-JQ64N6SF-CF8T7GiZ.js";import{n as D}from"./chunk-CKBBP62Z-BpQEgeHF.js";import{r as O,t as k}from"./dagre-BWadQu2F.js";import{a as A,n as j,r as M,t as N}from"./chunk-G27WJ6UU-Ckoq5mi2.js";var P,F,I,L,R,z,B,V,H,U,W,G,K,q,J,Y,X,Z,Q,$;e((()=>{j(),ee(),T(),D(),w(),E(),x(),b(),y(),v(),_(),m(),g(),d(),c(),n(),o(),k(),C(),P=t(e=>e.append(`circle`).attr(`class`,`start-state`).attr(`r`,p().state.sizeUnit).attr(`cx`,p().state.padding+p().state.sizeUnit).attr(`cy`,p().state.padding+p().state.sizeUnit),`drawStartState`),F=t(e=>e.append(`line`).style(`stroke`,`grey`).style(`stroke-dasharray`,`3`).attr(`x1`,p().state.textHeight).attr(`class`,`divider`).attr(`x2`,p().state.textHeight*2).attr(`y1`,0).attr(`y2`,0),`drawDivider`),I=t((e,t)=>{let n=e.append(`text`).attr(`x`,2*p().state.padding).attr(`y`,p().state.textHeight+2*p().state.padding).attr(`font-size`,p().state.fontSize).attr(`class`,`state-title`).text(t.id),r=n.node().getBBox();return e.insert(`rect`,`:first-child`).attr(`x`,p().state.padding).attr(`y`,p().state.padding).attr(`width`,r.width+2*p().state.padding).attr(`height`,r.height+2*p().state.padding).attr(`rx`,p().state.radius),n},`drawSimpleState`),L=t((e,n)=>{let r=t(function(e,t,n){let r=e.append(`tspan`).attr(`x`,2*p().state.padding).text(t);n||r.attr(`dy`,p().state.textHeight)},`addTspan`),i=e.append(`text`).attr(`x`,2*p().state.padding).attr(`y`,p().state.textHeight+1.3*p().state.padding).attr(`font-size`,p().state.fontSize).attr(`class`,`state-title`).text(n.descriptions[0]).node().getBBox(),a=i.height,o=e.append(`text`).attr(`x`,p().state.padding).attr(`y`,a+p().state.padding*.4+p().state.dividerMargin+p().state.textHeight).attr(`class`,`state-description`),s=!0,c=!0;n.descriptions.forEach(function(e){s||(r(o,e,c),c=!1),s=!1});let l=e.append(`line`).attr(`x1`,p().state.padding).attr(`y1`,p().state.padding+a+p().state.dividerMargin/2).attr(`y2`,p().state.padding+a+p().state.dividerMargin/2).attr(`class`,`descr-divider`),u=o.node().getBBox(),d=Math.max(u.width,i.width);return l.attr(`x2`,d+3*p().state.padding),e.insert(`rect`,`:first-child`).attr(`x`,p().state.padding).attr(`y`,p().state.padding).attr(`width`,d+2*p().state.padding).attr(`height`,u.height+a+2*p().state.padding).attr(`rx`,p().state.radius),e},`drawDescrState`),R=t((e,t,n)=>{let r=p().state.padding,i=2*p().state.padding,a=e.node().getBBox(),o=a.width,s=a.x,c=e.append(`text`).attr(`x`,0).attr(`y`,p().state.titleShift).attr(`font-size`,p().state.fontSize).attr(`class`,`state-title`).text(t.id),l=c.node().getBBox().width+i,u=Math.max(l,o);u===o&&(u+=i);let d,f=e.node().getBBox();t.doc,d=s-r,l>o&&(d=(o-u)/2+r),Math.abs(s-f.x)<r&&l>o&&(d=s-(l-o)/2);let m=1-p().state.textHeight;return e.insert(`rect`,`:first-child`).attr(`x`,d).attr(`y`,m).attr(`class`,n?`alt-composit`:`composit`).attr(`width`,u).attr(`height`,f.height+p().state.textHeight+p().state.titleShift+1).attr(`rx`,`0`),c.attr(`x`,d+r),l<=o&&c.attr(`x`,s+(u-i)/2-l/2+r),e.insert(`rect`,`:first-child`).attr(`x`,d).attr(`y`,p().state.titleShift-p().state.textHeight-p().state.padding).attr(`width`,u).attr(`height`,p().state.textHeight*3).attr(`rx`,p().state.radius),e.insert(`rect`,`:first-child`).attr(`x`,d).attr(`y`,p().state.titleShift-p().state.textHeight-p().state.padding).attr(`width`,u).attr(`height`,f.height+3+2*p().state.textHeight).attr(`rx`,p().state.radius),e},`addTitleAndBox`),z=t(e=>(e.append(`circle`).attr(`class`,`end-state-outer`).attr(`r`,p().state.sizeUnit+p().state.miniPadding).attr(`cx`,p().state.padding+p().state.sizeUnit+p().state.miniPadding).attr(`cy`,p().state.padding+p().state.sizeUnit+p().state.miniPadding),e.append(`circle`).attr(`class`,`end-state-inner`).attr(`r`,p().state.sizeUnit).attr(`cx`,p().state.padding+p().state.sizeUnit+2).attr(`cy`,p().state.padding+p().state.sizeUnit+2)),`drawEndState`),B=t((e,t)=>{let n=p().state.forkWidth,r=p().state.forkHeight;if(t.parentId){let e=n;n=r,r=e}return e.append(`rect`).style(`stroke`,`black`).style(`fill`,`black`).attr(`width`,n).attr(`height`,r).attr(`x`,p().state.padding).attr(`y`,p().state.padding)},`drawForkJoinState`),V=t((e,t,n,r)=>{let i=0,a=r.append(`text`);a.style(`text-anchor`,`start`),a.attr(`class`,`noteText`);let o=e.replace(/\r\n/g,`<br/>`);o=o.replace(/\n/g,`<br/>`);let s=o.split(f.lineBreakRegex),c=1.25*p().state.noteMargin;for(let e of s){let r=e.trim();if(r.length>0){let e=a.append(`tspan`);if(e.text(r),c===0){let t=e.node().getBBox();c+=t.height}i+=c,e.attr(`x`,t+p().state.noteMargin),e.attr(`y`,n+i+1.25*p().state.noteMargin)}}return{textWidth:a.node().getBBox().width,textHeight:i}},`_drawLongText`),H=t((e,t)=>{t.attr(`class`,`state-note`);let n=t.append(`rect`).attr(`x`,0).attr(`y`,p().state.padding),{textWidth:r,textHeight:i}=V(e,0,0,t.append(`g`));return n.attr(`height`,i+2*p().state.noteMargin),n.attr(`width`,r+p().state.noteMargin*2),n},`drawNote`),U=t(function(e,t){let n=t.id,r={id:n,label:t.id,width:0,height:0},i=e.append(`g`).attr(`id`,n).attr(`class`,`stateGroup`);t.type===`start`&&P(i),t.type===`end`&&z(i),(t.type===`fork`||t.type===`join`)&&B(i,t),t.type===`note`&&H(t.note.text,i),t.type===`divider`&&F(i),t.type==="default"&&t.descriptions.length===0&&I(i,t),t.type==="default"&&t.descriptions.length>0&&L(i,t);let a=i.node().getBBox();return r.width=a.width+2*p().state.padding,r.height=a.height+2*p().state.padding,r},`drawState`),W=0,G=t(function(e,n,a){let o=t(function(e){switch(e){case N.relationType.AGGREGATION:return`aggregation`;case N.relationType.EXTENSION:return`extension`;case N.relationType.COMPOSITION:return`composition`;case N.relationType.DEPENDENCY:return`dependency`}},`getRelationType`);n.points=n.points.filter(e=>!Number.isNaN(e.y));let c=n.points,u=s().x(function(e){return e.x}).y(function(e){return e.y}).curve(i),d=e.append(`path`).attr(`d`,u(c)).attr(`id`,`edge`+W).attr(`class`,`transition`),m=``;if(p().state.arrowMarkerAbsolute&&(m=l(!0)),d.attr(`marker-end`,`url(`+m+`#`+o(N.relationType.DEPENDENCY)+`End)`),a.title!==void 0){let t=e.append(`g`).attr(`class`,`stateLabel`),{x:i,y:o}=h.calcLabelPosition(n.points),s=f.getRows(a.title),c=0,l=[],u=0,d=0;for(let e=0;e<=s.length;e++){let n=t.append(`text`).attr(`text-anchor`,`middle`).text(s[e]).attr(`x`,i).attr(`y`,o+c),a=n.node().getBBox();u=Math.max(u,a.width),d=Math.min(d,a.x),r.info(a.x,i,o+c),c===0&&(c=n.node().getBBox().height,r.info(`Title height`,c,o)),l.push(n)}let m=c*s.length;if(s.length>1){let e=(s.length-1)*c*.5;l.forEach((t,n)=>t.attr(`y`,o+n*c-e)),m=c*s.length}let g=t.node().getBBox();t.insert(`rect`,`:first-child`).attr(`class`,`box`).attr(`x`,i-u/2-p().state.padding/2).attr(`y`,o-m/2-p().state.padding/2-3.5).attr(`width`,u+p().state.padding).attr(`height`,m+p().state.padding),r.info(g)}W++},`drawEdge`),q={},J=t(function(){},`setConf`),Y=t(function(e){e.append(`defs`).append(`marker`).attr(`id`,`dependencyEnd`).attr(`refX`,19).attr(`refY`,7).attr(`markerWidth`,20).attr(`markerHeight`,28).attr(`orient`,`auto`).append(`path`).attr(`d`,`M 19,7 L9,13 L14,7 L9,1 Z`)},`insertMarkers`),X=t(function(e,t,n,i){K=p().state;let o=p().securityLevel,s;o===`sandbox`&&(s=a(`#i`+t));let c=a(o===`sandbox`?s.nodes()[0].contentDocument.body:`body`),l=o===`sandbox`?s.nodes()[0].contentDocument:document;r.debug(`Rendering diagram `+e);let d=c.select(`[id='${t}']`);Y(d),Q(i.db.getRootDoc(),d.append(`g`).attr(`id`,t+`-root`),void 0,!1,c,l,i);let f=K.padding,m=d.node().getBBox(),h=m.width+f*2,g=m.height+f*2;u(d,g,h*1.75,K.useMaxWidth),d.attr(`viewBox`,`${m.x-K.padding} ${m.y-K.padding} `+h+` `+g)},`draw`),Z=t(e=>e?e.length*K.fontSizeFactor:1,`getLabelWidth`),Q=t((e,t,n,i,a,o,s)=>{let c=new S({compound:!0,multigraph:!0}),l,u=!0;for(l=0;l<e.length;l++)if(e[l].stmt===`relation`){u=!1;break}n?c.setGraph({rankdir:`LR`,multigraph:!0,compound:!0,ranker:`tight-tree`,ranksep:u?1:K.edgeLengthFactor,nodeSep:u?1:50,isMultiGraph:!0}):c.setGraph({rankdir:`TB`,multigraph:!0,compound:!0,ranksep:u?1:K.edgeLengthFactor,nodeSep:u?1:50,ranker:`tight-tree`,isMultiGraph:!0}),c.setDefaultEdgeLabel(function(){return{}});let d=s.db.getStates(),p=s.db.getRelations(),m=Object.keys(d);for(let e of m){let r=d[e];n&&(r.parentId=n);let l;if(r.doc){let e=t.append(`g`).attr(`id`,r.id).attr(`class`,`stateGroup`);l=Q(r.doc,e,r.id,!i,a,o,s);{e=R(e,r,i);let t=e.node().getBBox();l.width=t.width,l.height=t.height+K.padding/2,q[r.id]={y:K.compositTitleSize}}}else l=U(t,r,c);if(r.note){let e=U(t,{descriptions:[],id:r.id+`-note`,note:r.note,type:`note`},c);r.note.position===`left of`?(c.setNode(l.id+`-note`,e),c.setNode(l.id,l)):(c.setNode(l.id,l),c.setNode(l.id+`-note`,e)),c.setParent(l.id,l.id+`-group`),c.setParent(l.id+`-note`,l.id+`-group`)}else c.setNode(l.id,l)}r.debug(`Count=`,c.nodeCount(),c);let h=0;p.forEach(function(e){h++,r.debug(`Setting edge`,e),c.setEdge(e.id1,e.id2,{relation:e,width:Z(e.title),height:K.labelHeight*f.getRows(e.title).length,labelpos:`c`},`id`+h)}),O(c),r.debug(`Graph after layout`,c.nodes());let g=t.node();c.nodes().forEach(function(e){e!==void 0&&c.node(e)!==void 0?(r.warn(`Node `+e+`: `+JSON.stringify(c.node(e))),a.select(`#`+g.id+` #`+e).attr(`transform`,`translate(`+(c.node(e).x-c.node(e).width/2)+`,`+(c.node(e).y+(q[e]?q[e].y:0)-c.node(e).height/2)+` )`),a.select(`#`+g.id+` #`+e).attr(`data-x-shift`,c.node(e).x-c.node(e).width/2),o.querySelectorAll(`#`+g.id+` #`+e+` .divider`).forEach(e=>{let t=e.parentElement,n=0,r=0;t&&(t.parentElement&&(n=t.parentElement.getBBox().width),r=parseInt(t.getAttribute(`data-x-shift`),10),Number.isNaN(r)&&(r=0)),e.setAttribute(`x1`,0-r+8),e.setAttribute(`x2`,n-r-8)})):r.debug(`No Node `+e+`: `+JSON.stringify(c.node(e)))});let _=g.getBBox();c.edges().forEach(function(e){e!==void 0&&c.edge(e)!==void 0&&(r.debug(`Edge `+e.v+` -> `+e.w+`: `+JSON.stringify(c.edge(e))),G(t,c.edge(e),c.edge(e).relation))}),_=g.getBBox();let v={id:n||`root`,label:n||`root`,width:0,height:0};return v.width=_.width+2*K.padding,v.height=_.height+2*K.padding,r.debug(`Doc rendered`,v,c),v},`renderDoc`),$={parser:M,get db(){return new N(1)},renderer:{setConf:J,draw:X},styles:A,init:t(e=>{e.state||={},e.state.arrowMarkerAbsolute=e.arrowMarkerAbsolute},`init`)}}))();export{$ as diagram};
@@ -1 +0,0 @@
1
- import{n as e}from"./chunk-CacB07dV.js";import{n as t,r as n}from"./chunk-Y2CYZVJY-C9o-s6OY.js";import{zt as r}from"./src-DnfeXQPr.js";import{j as i}from"./chunk-DU6HZSFF-CnFngIhW.js";import{n as a}from"./chunk-PWAF6VOD-Cc2uVDsG.js";import{d as o}from"./chunk-75Z2AOVW-_M0z5olV.js";import{i as s}from"./chunk-GMAD6QVW-BuhEcgHq.js";import{n as c}from"./chunk-P2QGCYS3-UFEU6BxZ.js";import{r as l}from"./chunk-TEH6E4GO-G4Cdlyrt.js";import{r as u}from"./chunk-OBVCFTLP-CRIkunUB.js";import{i as d}from"./chunk-R7TYR2AO-DiCxzdAY.js";import{l as f}from"./chunk-F27PBJKO-BqtWrnEO.js";import{n as p}from"./chunk-XXDRQBXY-DnJkbUaw.js";import{t as m}from"./chunk-POPQ4Y6H-CQcrNbjr.js";import{n as h}from"./chunk-JQ64N6SF-CF8T7GiZ.js";import{n as g}from"./chunk-CKBBP62Z-BpQEgeHF.js";import{a as _,i as v,n as y,r as b,t as x}from"./chunk-G27WJ6UU-Ckoq5mi2.js";var S;e((()=>{y(),p(),m(),g(),f(),h(),d(),u(),l(),c(),s(),a(),o(),i(),r(),n(),S={parser:b,get db(){return new x(2)},renderer:v,styles:_,init:t(e=>{e.state||={},e.state.arrowMarkerAbsolute=e.arrowMarkerAbsolute},`init`)}}))();export{S as diagram};
@@ -1 +0,0 @@
1
- import{n as e}from"./chunk-CacB07dV.js";var t,n,r,i,a=e((()=>{t=[{value:`1:1`,label:`1:1`,icon:`■`},{value:`16:9`,label:`16:9`,icon:`▬`},{value:`9:16`,label:`9:16`,icon:`▮`},{value:`4:3`,label:`4:3`,icon:`▭`}],n=[{value:`16:9`,label:`16:9`,icon:`▬`},{value:`9:16`,label:`9:16`,icon:`▮`},{value:`1:1`,label:`1:1`,icon:`■`}],r=[`photorealistic`,`anime`,`oil painting`,`watercolor`,`cinematic`,`digital art`,`3D render`,`sketch`],i=[`cinematic`,`photorealistic`,`anime`,`3D animation`,`documentary`,`animation`,`action`,`nature`]}));export{a,i,r as n,n as r,t};
@@ -1 +0,0 @@
1
- import{n as e}from"./chunk-CacB07dV.js";import{n as t,r as n}from"./chunk-Y2CYZVJY-C9o-s6OY.js";import{Bt as r,zt as i}from"./src-DnfeXQPr.js";import{j as a}from"./chunk-DU6HZSFF-CnFngIhW.js";import{n as o}from"./chunk-PWAF6VOD-Cc2uVDsG.js";import{d as s}from"./chunk-75Z2AOVW-_M0z5olV.js";import{i as c}from"./chunk-GMAD6QVW-BuhEcgHq.js";import{n as l}from"./chunk-P2QGCYS3-UFEU6BxZ.js";import{r as u}from"./chunk-TEH6E4GO-G4Cdlyrt.js";import{r as d}from"./chunk-OBVCFTLP-CRIkunUB.js";import{i as f,s as p}from"./chunk-R7TYR2AO-DiCxzdAY.js";import{n as m}from"./chunk-JQ64N6SF-CF8T7GiZ.js";import{c as h,i as g}from"./chunk-DSNCTWBM-C-gvT2ru.js";function _(e){let t=[];for(let n=0;n<e.length-1;n++)t.push({a:e[n],b:e[n+1]});return t}function v(e,t,n,r){let i=t.x-e.x,a=t.y-e.y,o=r.x-n.x,s=r.y-n.y,c=i*s-a*o;if(c===0)return null;let l=n.x-e.x,u=n.y-e.y,d=(l*s-u*o)/c,f=(l*a-u*i)/c;return d<=Wn||d>=1-Wn||f<=Wn||f>=1-Wn?null:{point:{x:e.x+d*i,y:e.y+d*a},tA:d,tB:f}}function y(e){return Math.abs(e.b.x-e.a.x)>=Math.abs(e.b.y-e.a.y)}function b(e){let t=[];for(let n=0;n<e.length;n++){let r=e[n],i=_(r.points);for(let a=n+1;a<e.length;a++){let n=e[a],o=_(n.points);for(let[e,a]of i.entries())for(let[i,s]of o.entries()){let o=v(a.a,a.b,s.a,s.b);if(!o)continue;let c=y(a);c!==y(s)&&c?t.push({jumpEdgeId:r.id,otherEdgeId:n.id,segIndex:e,t:o.tA,point:o.point}):t.push({jumpEdgeId:n.id,otherEdgeId:r.id,segIndex:i,t:o.tB,point:o.point})}}}return t}function x(e){return`${Math.round(e*1e3)/1e3}`}function S(e){return`${x(e.x)},${x(e.y)}`}function C(e){let t=e.b.x-e.a.x,n=e.b.y-e.a.y;return Math.abs(t)>=Math.abs(n)?+(t>=0):+(n>=0)}function w(e,t){if(e.length<2)return e.map(e=>({...e}));let n=e.map(e=>({...e})),r=t.arrowTypeStart&&p[t.arrowTypeStart];if(r){let t=e[0],i=e[1],a=Math.atan2(i.y-t.y,i.x-t.x);n[0].x=t.x+r*Math.cos(a),n[0].y=t.y+r*Math.sin(a)}let i=t.arrowTypeEnd&&p[t.arrowTypeEnd];if(i){let t=e.length,r=e[t-2],a=e[t-1],o=Math.atan2(a.y-r.y,a.x-r.x);n[t-1].x=a.x-i*Math.cos(o),n[t-1].y=a.y-i*Math.sin(o)}return n}function T(e,t,n,r,i){let a=e.point.x,o=e.point.y,s={x:a-t*e.r,y:o-n*e.r},c={x:a+t*e.r,y:o+n*e.r},l=[`L${S(s)}`];return i===`arc`?l.push(`A${x(e.r)},${x(e.r)} 0 0 ${r} ${S(c)}`):l.push(`M${S(c)}`),l}function E(e,t,n,r){let i=t.x-e.x,a=t.y-e.y,o=n.x-t.x,s=n.y-t.y,c=Math.hypot(i,a),l=Math.hypot(o,s);if(c<Un||l<Un)return null;let u=i/c,d=a/c,f=o/l,p=s/l,m=u*f+d*p,h=Math.acos(Math.max(-1,Math.min(1,m)));if(h<Un||Math.abs(Math.PI-h)<Un)return null;let g=Math.min(r/Math.sin(h/2),c/2,l/2);return{startX:t.x-u*g,startY:t.y-d*g,endX:t.x+f*g,endY:t.y+p*g,ctrlX:t.x,ctrlY:t.y,cutLen:g}}function D(e,t,n){let r=e.points;if(r.length<2)return``;let i=w(r,e),a=e.curve===`rounded`,o=_(i),s=new Map;for(let e of t){let t=o[e.segIndex];if(!t)continue;let r=Math.hypot(t.b.x-t.a.x,t.b.y-t.a.y),i=s.get(e.segIndex)??[];i.push({t:e.t,point:e.point,d:e.t*r,r:n.jumpRadius}),s.set(e.segIndex,i)}let c=[`M${S(i[0])}`];for(let e=0;e<o.length;e++){let t=o[e],r=Math.hypot(t.b.x-t.a.x,t.b.y-t.a.y),l=r===0?0:(t.b.x-t.a.x)/r,u=r===0?0:(t.b.y-t.a.y)/r,d=C(t),f=0;if(a&&e>0){let t=E(i[e-1],i[e],i[e+1]??i[e],Hn);t&&(f=t.cutLen)}let p=r,m=null;a&&e<o.length-1&&(m=E(i[e],i[e+1],i[e+2]??i[e+1],Hn),m&&(p=r-m.cutLen));let h=[...s.get(e)??[]].sort((e,t)=>e.t-t.t);for(let e of h)e.r=Math.min(e.r,e.d-f,p-e.d);for(let e=0;e<h.length-1;e++){let t=h[e+1].d-h[e].d;if(h[e].r+h[e+1].r>t){let n=t/2;h[e].r=Math.min(h[e].r,n),h[e+1].r=Math.min(h[e+1].r,n)}}for(let e of h)e.r<Gn||c.push(...T(e,l,u,d,n.jumpStyle));a&&m?(c.push(`L${x(m.startX)},${x(m.startY)}`),c.push(`Q${x(m.ctrlX)},${x(m.ctrlY)} ${x(m.endX)},${x(m.endY)}`)):c.push(`L${S(t.b)}`)}return c.join(` `)}function O(e){return/^[\d\s+,.LMelm-]*$/.test(e)}function k(e){return e?e===`linear`||e===`rounded`||e===`step`||e===`stepBefore`||e===`stepAfter`:!0}function A(e){if(!e)return null;try{let t=typeof atob==`function`?atob(e):Buffer.from(e,`base64`).toString(),n=JSON.parse(t);if(!Array.isArray(n))return null;let r=[];for(let e of n)e&&typeof e.x==`number`&&typeof e.y==`number`&&r.push({x:e.x,y:e.y});return r.length>=2?r:null}catch{return null}}function j(e,t,n){if(!n.enabled)return;let r=e.node();if(!r)return;let i=new Map;for(let e of t)i.set(e.id,e);let a=[],o=new Map;for(let e of t){let t=typeof CSS<`u`&&CSS.escape?CSS.escape(e.id):e.id,n=r.querySelector(`path[data-id="${t}"]`);if(!n)continue;o.set(e.id,n);let i=A(n.getAttribute(`data-points`))??e.points;a.push({...e,points:i})}let s=b(a);if(s.length===0)return;let c=new Map;for(let e of s){let t=c.get(e.jumpEdgeId)??[];t.push(e),c.set(e.jumpEdgeId,t)}for(let e of a){let t=c.get(e.id);if(!t||t.length===0)continue;let r=i.get(e.id)?.curve;if(r!==void 0&&!k(r))continue;let a=o.get(e.id);if(!a||r===void 0&&!O(a.getAttribute(`d`)??``))continue;let s=a.getAttribute(`style`)??``,l=/stroke-dasharray\s*:\s*0\s+([\d.]+)\s+[\d.]+\s+([\d.]+)/.exec(s),u=l?Number.parseFloat(l[1]):null,d=l?Number.parseFloat(l[2]):null,f=D(e,t,n);if(a.setAttribute(`d`,f),u!==null&&d!==null&&typeof a.getTotalLength==`function`){let e=a.getTotalLength(),t=`0 ${u} ${Math.max(0,e-u-d)} ${d}`,n=s.replace(/stroke-dasharray\s*:[^;]*;?/g,`stroke-dasharray: ${t};`).replace(/;\s*;+/g,`;`);a.setAttribute(`style`,n)}}}function ee(e,{measure:t}){let n=e.config?.swimlane?.lineHops;if(n===!1)return;let r=n===`gap`?`gap`:`arc`,i=e.edges.filter(e=>Array.isArray(e.points)&&e.points.length>=2).map(e=>({id:e.id,points:e.points,curve:e.curve,arrowTypeStart:e.arrowTypeStart,arrowTypeEnd:e.arrowTypeEnd}));j(t.groups.edgePaths,i,{enabled:!0,jumpRadius:6,jumpStyle:r})}function te(e){return Math.max(e.padding??Jn,Jn)}function M(e){let{x:t,y:n,width:r,height:i}=e,a=e.swimlaneContentTop;if(typeof t!=`number`||typeof n!=`number`||typeof r!=`number`||typeof i!=`number`||typeof a!=`number`||!Number.isFinite(t)||!Number.isFinite(n)||!Number.isFinite(r)||!Number.isFinite(i)||!Number.isFinite(a)||r<=0||i<=0){delete e.groupTitleRect;return}let o=n-i/2,s=Math.min(a,n+i/2),c=o+Math.min(qn,Math.max(0,s-o));if(c<=o){delete e.groupTitleRect;return}e.groupTitleRect={left:t-r/2,right:t+r/2,top:o,bottom:c}}function ne(e){let t=e.direction,n=e.nodes??=[];for(let n of e.nodes??[])n.isGroup&&!n.parentId&&(n.shape=`swimlane`,t&&(n.direction=t));let r=n.filter(e=>!e.isGroup&&!e.parentId);if(r.length===0)return;let i=n.find(e=>e.id===Kn);i?i.isGroup&&(i.shape=`swimlane`,t&&(i.direction=t)):(i={id:Kn,label:``,isGroup:!0,shape:`swimlane`,padding:20,...t?{direction:t}:{}},n.push(i));for(let e of r)e.parentId=Kn}function re(e){let t=new Map;for(let n of e.nodes??[])t.set(n.id,n);let n=[];for(let t of e.edges??[]){let e=typeof t.start==`string`?t.start:void 0,r=typeof t.end==`string`?t.end:void 0;!e||!r||t.labelNodeId||n.push({id:t.id,src:e,dst:r,ref:t})}let r=e.nodes??[],i=r.filter(e=>e.isGroup),a=r.filter(e=>!e.isGroup);return{nodes:[...[...i].reverse(),...a].map(e=>e.id),edges:n,layout:e,nodeById:t}}function ie(e,t,n,r){let{layout:i}=e,a=e.nodeById,o=r?.layerGap??100,s=r?.nodeGap??40,c=0;for(let e of t.layers){let t=0;for(let r of e){let e=a.get(r);if(!e){t++;continue}e.layer=c,e.order=t;let i=n.x[r]??t*s,l=n.y[r]??c*o;e.x=i,e.y=l,t++}c++}let l=i.nodes??[],u=new Map,d=[];for(let e of l){if(!e?.isGroup)continue;e.parentId||d.push(e);let t=l.filter(t=>t.parentId===e.id),r=1/0,i=-1/0,a=1/0,o=-1/0;for(let e of t){let t=e.x??n.x[e.id],s=e.y??n.y[e.id],c=e.width??0,l=e.height??0;t!=null&&s!=null&&(r=Math.min(r,t-c/2),i=Math.max(i,t+c/2),a=Math.min(a,s-l/2),o=Math.max(o,s+l/2))}if(r===1/0||a===1/0)e.x=e.x??0,e.y=e.y??0,e.width=e.width??0,e.height=e.height??0;else{let t=e.padding??20,n=e.parentId?t:2*te(e),s=t,c=Math.max(0,i-r)+n,l=Math.max(0,o-a)+s,d=(r+i)/2,f=(a+o)/2;e.x=d,e.y=f,e.width=c,e.height=l,u.set(e.id,{minX:r,maxX:i,minY:a,maxY:o})}}if(d.length>0&&u.size>0){let e=1/0,t=-1/0,n=0;for(let r of d){let i=r.padding??20;i>n&&(n=i);let a=u.get(r.id);a&&(e=Math.min(e,a.minY),t=Math.max(t,a.maxY))}if(e!==1/0&&t!==-1/0){let r=Math.max(0,t-e)+2*Math.max(n,36),i=(e+t)/2;for(let t of d)t.y=i,t.height=r,t.swimlaneContentTop=e;let a=[...d].sort((e,t)=>(e.x??0)-(t.x??0)),o=[],s=[],c=[];for(let e of a){let t=u.get(e.id);if(!t)continue;let n=Math.max(0,t.maxX-t.minX)+2*te(e),r=(t.minX+t.maxX)/2;o.push(e.id),s.push(r),c.push(n)}let l=o.length;if(l>0){let e=new Map;if(l===1)e.set(o[0],c[0]);else{let t=[];for(let e=0;e<l-1;e++)t.push(s[e+1]-s[e]);let n=Array(l);n[0]=0;for(let e=0;e<l-1;e++)n[e+1]=2*t[e]-n[e];let r=0,i=1/0;for(let e=0;e<l;e++){let t=c[e];e%2==0?r=Math.max(r,t-n[e]):i=Math.min(i,n[e]-t)}let a=r;a=r<=i?(r+i)/2:r;for(let t=0;t<l;t++){let r=n[t]+(t%2==0?a:-a),i=Math.max(c[t],r);e.set(o[t],i)}}for(let t of d){let n=e.get(t.id);n!=null&&(t.width=n),M(t)}}}}}function ae(e){let t=[],n=[],i=new Map;for(let t of e.nodes)i.set(t.id,t);for(let a of e.edges){if(!a.label||a.label.length===0||a.isLayoutOnly||a.labelNodeId)continue;let e=a.start?i.get(a.start):void 0,o=a.end?i.get(a.end):void 0;if(!e||!o){r.warn(Yn,`Edge ${a.id} has missing source or target node`);continue}let s=`edge-label-${a.start}-${a.end}-${a.id}`,c=e.parentId===o.parentId?e.parentId:o.parentId,l={id:s,label:a.label,edgeStart:a.start??``,edgeEnd:a.end??``,shape:`labelRect`,width:0,height:0,isEdgeLabel:!0,isDummy:!0,parentId:c,isGroup:!1,labelStyle:Array.isArray(a.labelStyle)?a.labelStyle[0]:a.labelStyle??``,...e.dir?{dir:e.dir}:{}};t.push(l),a.labelNodeId=s,a.label=void 0,a.text=void 0;let u={id:`${a.id}-to-label`,start:a.start,end:s,type:`normal`,isLayoutOnly:!0},d={id:`${a.id}-from-label`,start:s,end:a.end,type:`normal`,isLayoutOnly:!0};n.push(u,d)}let a=[...e.nodes,...t],o=[...e.edges,...n];return{...e,nodes:a,edges:o}}function oe(e){let t=e.x??0,n=e.y??0,r=e.width??0,i=e.height??0;return r>0&&i>0?{cx:t,cy:n,rect:me(t,n,r,i)}:void 0}function se(e){if(e.isGroup)return;let t=oe(e);if(t)return{id:String(e.id??``),cx:t.cx,cy:t.cy,rect:t.rect}}function N(e,t,n=q){return Math.abs(e.x-t.x)<n&&Math.abs(e.y-t.y)<n}function P(e,t,n=q){return Math.abs(e.x-t.x)<n}function F(e,t,n=q){return Math.abs(e.y-t.y)<n}function I(e,t,n=q){return F(e,t,n)&&Math.abs(e.x-t.x)>n}function L(e,t,n=q){return P(e,t,n)&&Math.abs(e.y-t.y)>n}function R(e,t,n,r){return Math.max(0,Math.min(Math.max(e,t),Math.max(n,r))-Math.max(Math.min(e,t),Math.min(n,r)))}function z(e,t,n=q){return e.horizontal&&t.horizontal&&F(e.a,t.a,n)?R(e.a.x,e.b.x,t.a.x,t.b.x):e.vertical&&t.vertical&&P(e.a,t.a,n)?R(e.a.y,e.b.y,t.a.y,t.b.y):0}function ce(e,t=q){let n=[];for(let r=0;r<e.length-1;r++){let i=e[r],a=e[r+1],o=I(i,a,t),s=L(i,a,t);(o||s)&&n.push({index:r,a:i,b:a,horizontal:o,vertical:s})}return n}function B(e,t=q){let n=ce(e,t),r=0;for(let e=1;e<n.length;e++)n[e-1].horizontal!==n[e].horizontal&&r++;return r}function V(e,t=q){let n=[];for(let r of e){let e=n.length>0?n[n.length-1]:void 0;(!e||!N(e,r,t))&&n.push({x:r.x,y:r.y})}return n}function H(e,t=q){if(!e||e.length!==4)return;let[n,r,i,a]=e;return I(n,r,t)&&L(r,i,t)&&I(i,a,t)?{kind:`HVH`,p0:n,p1:r,p2:i,p3:a}:L(n,r,t)&&I(r,i,t)&&L(i,a,t)?{kind:`VHV`,p0:n,p1:r,p2:i,p3:a}:void 0}function le(e,t,n,r=0){let i=Math.min(e.x,t.x),a=Math.max(e.x,t.x),o=Math.min(e.y,t.y),s=Math.max(e.y,t.y);return a>n.left-r&&i<n.right+r&&s>n.top-r&&o<n.bottom+r}function ue(e,t,n=0){return e.x>t.left+n&&e.x<t.right-n&&e.y>t.top+n&&e.y<t.bottom-n}function de(e,t){return e.left<=t.left&&e.right>=t.right&&e.top<=t.top&&e.bottom>=t.bottom}function fe(e,t){return e.left<t.right&&e.right>t.left&&e.top<t.bottom&&e.bottom>t.top}function pe(e,t){return{left:e.left-t,right:e.right+t,top:e.top-t,bottom:e.bottom+t}}function me(e,t,n,r){return{left:e-n/2,right:e+n/2,top:t-r/2,bottom:t+r/2}}function U(e){return oe(e)?.rect}function W(e,t){switch(t){case`top`:return{x:e.cx,y:e.rect.top};case`bottom`:return{x:e.cx,y:e.rect.bottom};case`left`:return{x:e.rect.left,y:e.cy};case`right`:return{x:e.rect.right,y:e.cy}}}function G(e,t,n,r,i,a=q){let o=t===`left`||t===`right`,s=r===`left`||r===`right`;if(o&&s){if(t===`right`&&r===`left`&&e.x<n.x||t===`left`&&r===`right`&&e.x>n.x){if(F(e,n,a))return[e,n];let t=(e.x+n.x)/2;return[e,{x:t,y:e.y},{x:t,y:n.y},n]}if(t===r){if(F(e,n,a))return;let r=t===`left`?Math.min(e.x,n.x)-i:Math.max(e.x,n.x)+i;return[e,{x:r,y:e.y},{x:r,y:n.y},n]}return}if(!o&&!s){if(t===r){if(P(e,n,a))return;let r=t===`top`?Math.min(e.y,n.y)-i:Math.max(e.y,n.y)+i;return[e,{x:e.x,y:r},{x:n.x,y:r},n]}if(!(t===`bottom`&&r===`top`&&e.y<n.y||t===`top`&&r===`bottom`&&e.y>n.y))return;if(P(e,n,a))return[e,n];let o=(e.y+n.y)/2;return[e,{x:e.x,y:o},{x:n.x,y:o},n]}if(o&&!s){let i=t===`right`&&n.x>e.x||t===`left`&&n.x<e.x,a=r===`top`&&e.y<n.y||r===`bottom`&&e.y>n.y;return i&&a?[e,{x:n.x,y:e.y},n]:void 0}let c=t===`bottom`&&n.y>e.y||t===`top`&&n.y<e.y,l=r===`left`&&e.x<n.x||r===`right`&&e.x>n.x;return c&&l?[e,{x:e.x,y:n.y},n]:void 0}function he(e,t,n,r){return t===`left`||t===`right`?[e,{x:r,y:e.y},{x:r,y:n.y},n]:[e,{x:e.x,y:r},{x:n.x,y:r},n]}function ge(e){let t=new Map,n=[];for(let r of e){if(r.isEdgeLabel)continue;let e=se(r);e&&(t.set(e.id,e),n.push({id:e.id,rect:e.rect}))}return{nodeInfoById:t,realNodeRects:n}}function _e(e){let t=[],n=[];for(let r of e){let e=se(r);if(!e)continue;let i={id:e.id,rect:e.rect};r.isEdgeLabel?n.push(i):t.push(i)}return{realNodeRects:t,labelNodeRects:n}}function ve(e,{includeEdgeLabels:t=!0}={}){let n=[];for(let r of e){if(r.isGroup||!t&&r.isEdgeLabel)continue;let e=r.x??0,i=r.y??0,a=r.width??0,o=r.height??0;n.push({nodeId:r.id,...me(e,i,a,o)})}return n}function ye(e,t,n=q){let r=e.start,i=e.end;if(!r||!i)return;let a=t.get(r),o=t.get(i);if(!(!a||!o))return{srcId:r,dstId:i,srcInfo:a,dstInfo:o,collinearX:Math.abs(a.cx-o.cx)<n,collinearY:Math.abs(a.cy-o.cy)<n}}function K(e,t,n,r=[],i=0){for(let a of n)if(!r.includes(a.id)&&le(e,t,a.rect,-i))return!0;return!1}function be(e,t,n,r,i=q,a=1e-6){let o=F(e,t,i),s=P(e,t,i),c=F(n,r,i),l=P(n,r,i);if(o&&c||s&&l||!(o||s)||!(c||l))return!1;let u=o?{a:e,b:t}:{a:n,b:r},d=s?{a:e,b:t}:{a:n,b:r},f=u.a.y,p=Math.min(u.a.x,u.b.x),m=Math.max(u.a.x,u.b.x),h=d.a.x,g=Math.min(d.a.y,d.b.y),_=Math.max(d.a.y,d.b.y);if(h<p||h>m||f<g||f>_)return!1;let v=Math.abs(h-u.a.x)<a&&Math.abs(f-u.a.y)<a||Math.abs(h-u.b.x)<a&&Math.abs(f-u.b.y)<a,y=Math.abs(h-d.a.x)<a&&Math.abs(f-d.a.y)<a||Math.abs(h-d.b.x)<a&&Math.abs(f-d.b.y)<a;return!(v&&y)}function xe(e,t,n,r,i=q){let a=F(e,t,i),o=P(e,t,i),s=F(n,r,i),c=P(n,r,i);return o&&c&&P(e,n,i)?R(e.y,t.y,n.y,r.y)>i:a&&s&&F(e,n,i)?R(e.x,t.x,n.x,r.x)>i:!1}function Se(e,t,n,r,{epsilon:i=q,skipDegenerateOther:a=!1}={}){for(let o of n){if(o===r||o.isLayoutOnly)continue;let n=o.points;if(!(!n||n.length<2))for(let r=0;r<n.length-1;r++){let o=n[r],s=n[r+1];if(!(a&&N(o,s,i))&&(be(e,t,o,s,i)||xe(e,t,o,s,i)))return!0}}return!1}function Ce(e,t,n,r,i=q){let a=F(e,t,i),o=P(e,t,i),s=F(n,r,i),c=P(n,r,i);if(!(a&&c||o&&s))return!1;let l=a?{a:e,b:t}:{a:n,b:r},u=a?{a:n,b:r}:{a:e,b:t},d=l.a.y,f=Math.min(l.a.x,l.b.x),p=Math.max(l.a.x,l.b.x),m=u.a.x,h=Math.min(u.a.y,u.b.y),g=Math.max(u.a.y,u.b.y);return m>f+i&&m<p-i&&d>h+i&&d<g-i}function we(e,t,n){let r=Math.min(t,n),i=Math.max(t,n);return e>r+q&&e<i-q}function Te(e,t,n){return P(e,t)&&P(t,n)?we(t.y,e.y,n.y):F(e,t)&&F(t,n)?we(t.x,e.x,n.x):!1}function Ee(e){let t=!1,n=[];for(let r=0;r<e.length;r++){let i=n[n.length-1],a=e[r],o=r+1<e.length?e[r+1]:void 0;if(i&&o){if(N(i,o)){r++,t=!0;continue}if(Te(i,a,o)){t=!0;continue}}n.push(a)}return{points:n,changed:t}}function De(e){let t=[e[0]];for(let n=1;n<e.length;n++){let r=t[t.length-1],i=e[n];if(!P(r,i)&&!F(r,i)){let e=t.length>=2?t[t.length-2]:void 0,n=e&&P(e,r)?{x:r.x,y:i.y}:{x:i.x,y:r.y};t.push(n)}t.push(i)}let n=[];for(let e of t){let t=n[n.length-1];(!t||!N(t,e))&&n.push(e)}return n}function Oe(e){if(e.length<3)return e;let t=[...e];for(let e=0;e<32;e++){let e=Ee(t);if(t=e.points,!e.changed)break}return t}function ke(e,t,n){let r=e;if(r.isLayoutOnly||!r.points||r.points.length<n)return;let i=r.start?t.get(r.start):void 0,a=r.end?t.get(r.end):void 0;return{edge:r,points:r.points,srcRect:i?U(i):void 0,dstRect:a?U(a):void 0}}function Ae(e,t,n){if(F(e,t,J))return{x:e.x<n.left?n.left:n.right,y:e.y};if(P(e,t,J)){let t=e.y<n.top?n.top:n.bottom;return{x:e.x,y:t}}return{x:Math.min(n.right,Math.max(n.left,e.x)),y:Math.min(n.bottom,Math.max(n.top,e.y))}}function je(e,t,n){let r=n?1:-1,i=n?0:e.length-1;for(;i>=0&&i<e.length&&ue(e[i],t,Xn);)i+=r;if(i<0||i>=e.length)return e;let a=i-r;if(a<0||a>=e.length)return e;let o=Ae(e[i],e[a],t);return n?[o,...e.slice(i)]:[...e.slice(0,i+1),o]}function Me(e,t){for(let n of e){let e=ke(n,t,2);if(!e)continue;let r=[...e.points];e.srcRect&&(r=je(r,e.srcRect,!0)),e.dstRect&&(r=je(r,e.dstRect,!1)),r=Oe(De(r)),r=Ue(r,e.srcRect,e.dstRect),e.edge.points=Oe(De(r))}}function Ne(e,t,n,r=!1){if(F(e,t,J)){if(t.y<n.top-J||t.y>n.bottom+J)return t;if(r){if(e.x<n.left-J)return{x:n.left,y:e.y};if(e.x>n.right+J)return{x:n.right,y:e.y}}return{x:Math.abs(t.x-n.left)<=Math.abs(t.x-n.right)?n.left:n.right,y:e.y}}if(P(e,t,J)){if(t.x<n.left-J||t.x>n.right+J)return t;if(r){if(e.y<n.top-J)return{x:e.x,y:n.top};if(e.y>n.bottom+J)return{x:e.x,y:n.bottom}}let i=Math.abs(t.y-n.top)<=Math.abs(t.y-n.bottom);return{x:e.x,y:i?n.top:n.bottom}}return t}function Pe(e,t,n){let r=e[t];for(let i=t+n;i>=0&&i<e.length;i+=n){let t=e[i];if(!N(t,r,J))return t}return e[t+n]}function Fe(e,t){let n=e+Zn,r=t-Zn;return n<=r?{lo:n,hi:r}:{lo:(e+t)/2,hi:(e+t)/2}}function Ie(e,t,n){let{lo:r,hi:i}=Fe(t,n);return Math.min(i,Math.max(r,e))}function Le(e){let t=Math.max(...e.map(e=>e.lo)),n=Math.min(...e.map(e=>e.hi));if(!(t>n))return{lo:t,hi:n}}function Re(e,t){return t===`left`||t===`right`?Fe(e.top,e.bottom):Fe(e.left,e.right)}function ze(e,t,n){let r=e.y>=n.top-J&&e.y<=n.bottom+J,i=e.x>=n.left-J&&e.x<=n.right+J;if(F(e,t,J)&&r){if(Math.abs(e.x-n.left)<J)return`left`;if(Math.abs(e.x-n.right)<J)return`right`}if(P(e,t,J)&&i){if(Math.abs(e.y-n.top)<J)return`top`;if(Math.abs(e.y-n.bottom)<J)return`bottom`}}function Be(e){return e===`left`||e===`right`}function Ve(e,t,n,r,i){let a=[],o=n?ze(e,t,n):void 0,s=r?ze(t,e,r):void 0;return n&&o&&Be(o)===i&&a.push(Re(n,o)),r&&s&&Be(s)===i&&a.push(Re(r,s)),a.length>0?Le(a):void 0}function He(e,t,n,r,i){let a=Ve(e,t,n,r,i);if(!a)return;let o=i?e.y:e.x,s=Math.min(a.hi,Math.max(a.lo,o));if(!(Math.abs(s-o)<J))return i?[{x:e.x,y:s},{x:t.x,y:s}]:[{x:s,y:e.y},{x:s,y:t.y}]}function Ue(e,t,n){if(e.length!==2)return e;let[r,i]=e;return F(r,i,J)?He(r,i,t,n,!0)??e:P(r,i,J)?He(r,i,t,n,!1)??e:e}function We(e,t,n){return Be(n)?{x:e.x,y:Ie(e.y,t.top,t.bottom)}:{x:Ie(e.x,t.left,t.right),y:e.y}}function Ge(e,t,n,r,i,a){let o=e.map(e=>({...e}));for(let s=t;s>=0&&s<e.length;s+=n){let t=e[s];if(a&&!F(t,r,J)||!a&&!P(t,r,J))break;a?o[s].y=i.y:o[s].x=i.x}return o}function Ke(e,t,n){if(e.length<2)return e;let r=n?0:e.length-1,i=n?1:-1,a=e[r],o=Pe(e,r,i);if(!o)return e;let s=ze(a,o,t);if(!s)return e;let c=Be(s),l=We(a,t,s);return N(a,l,J)?e:Ge(e,r,i,a,l,c)}function qe(e,t,n){let r=Math.min(e.x,t.x)>=n.left-J&&Math.max(e.x,t.x)<=n.right+J,i=Math.min(e.y,t.y)>=n.top-J&&Math.max(e.y,t.y)<=n.bottom+J;if(Math.abs(e.y-n.top)<J&&Math.abs(t.y-n.top)<J&&r)return`top`;if(Math.abs(e.y-n.bottom)<J&&Math.abs(t.y-n.bottom)<J&&r)return`bottom`;if(Math.abs(e.x-n.left)<J&&Math.abs(t.x-n.left)<J&&i)return`left`;if(Math.abs(e.x-n.right)<J&&Math.abs(t.x-n.right)<J&&i)return`right`}function Je(e,t,n,r){switch(e){case`top`:return P(t,n,J)&&n.y<r.top-J;case`bottom`:return P(t,n,J)&&n.y>r.bottom+J;case`left`:return F(t,n,J)&&n.x<r.left-J;case`right`:return F(t,n,J)&&n.x>r.right+J}}function Ye(e,t,n){if(e.length<3)return e;if(n){let n=qe(e[0],e[1],t);return n&&Je(n,e[1],e[2],t)?e.slice(1):e}let r=e.length-1,i=qe(e[r-1],e[r],t);return i&&Je(i,e[r-1],e[r-2],t)?e.slice(0,r):e}function Xe(e,t,n){let r=e;if(t){let e=Pe(r,0,1);if(e){let n=Ne(e,r[0],t);n!==r[0]&&(r=[n,...r.slice(1)])}r=Ye(r,t,!0)}if(n){let e=r.length-1,t=Pe(r,e,-1);if(t){let i=Ne(t,r[e],n,!0);i!==r[e]&&(r=[...r.slice(0,e),i])}r=Ye(r,n,!1)}let i=Ue(r,t,n);return i!==r||r.length===2?i:(t&&(r=Ke(r,t,!0)),n&&(r=Ke(r,n,!1)),r)}function Ze(e,t){for(let n of e){let e=ke(n,t,2);if(!e)continue;let r=Xe(V(e.points,J),e.srcRect,e.dstRect);if(r.length<3){e.edge.points=r;continue}let i=[r[0],{...r[0]},...r.slice(1,-1),r[r.length-1],{...r[r.length-1]}];e.edge.points=i}}function Qe(e){return new Map(e.map(e=>[e.id,e]))}function $e(e,t){let n=e.parentId,r=null;for(;n;){let e=t.get(n);if(!e?.isGroup)break;r=e.id,n=e.parentId}return r}function et(e,t){let n=0,r=e.parentId;for(;r;){let e=t.get(r);if(!e?.isGroup)break;n++,r=e.parentId}return n}function tt(e){let t=1/0,n=-1/0,r=1/0,i=-1/0;for(let a of e){let e=a.x,o=a.y;if(typeof e!=`number`||typeof o!=`number`)continue;let s=a.width??0,c=a.height??0;t=Math.min(t,e-s/2),n=Math.max(n,e+s/2),r=Math.min(r,o-c/2),i=Math.max(i,o+c/2)}return t===1/0||r===1/0?null:{minX:t,maxX:n,minY:r,maxY:i}}function nt(e,t){let n=e.padding??20;e.x=(t.minX+t.maxX)/2,e.y=(t.minY+t.maxY)/2,e.width=Math.max(0,t.maxX-t.minX)+n,e.height=Math.max(0,t.maxY-t.minY)+n}function rt(e){let t=Qe(e),n=e.filter(e=>e.isGroup&&e.parentId).sort((e,n)=>et(n,t)-et(e,t));for(let t of n){let n=tt(e.filter(e=>e.parentId===t.id));n&&nt(t,n)}}function it(e,n){let r=e.nodes??[],i=e.edges??[],a=r.filter(e=>!e.isGroup),o=1/0,s=-1/0;for(let e of a){let t=e[n];typeof t==`number`&&(o=Math.min(o,t),s=Math.max(s,t))}if(!Number.isFinite(o)||!Number.isFinite(s))return!1;let c=t(e=>o+s-e,`mirror`);for(let e of r){let t=e[n];typeof t==`number`&&(e[n]=c(t));let r=e.groupTitleRect;r&&(e.groupTitleRect=n===`x`?{...r,left:c(r.right),right:c(r.left)}:{...r,top:c(r.bottom),bottom:c(r.top)})}for(let e of i)for(let t of e.points??[])t[n]=c(t[n]);return!0}function at(e){return(e.nodes??[]).some(e=>!e.isGroup)?it(e,`y`):!0}function ot(e,t=`LR`){let n=e.nodes??[],r=e.edges??[],i=n.filter(e=>!e.isGroup),a=1/0,o=1/0;for(let e of i){let t=e.x??0,n=e.y??0;t<a&&(a=t),n<o&&(o=n)}if(!Number.isFinite(a)||!Number.isFinite(o))return!1;let s=0,c=0;for(let e of i)s+=e.width??0,c+=e.height??0;let l=s/i.length,u=c/i.length,d=u>0?Math.max(1,l/u):1;for(let e of i){let t=e.x??0,n=((e.y??0)-o)*d+36,r=t-a;e.x=n,e.y=r}for(let e of r)if(e.points)for(let t of e.points){let e=t.x,n=(t.y-o)*d+36,r=e-a;t.x=n,t.y=r}rt(n);let f=n.filter(e=>e.isGroup&&!e.parentId);if(f.length===0)return t===`RL`&&it(e,`x`),!0;let p=Qe(n),m=new Map;for(let e of n){if(e.isGroup)continue;let t=$e(e,p);if(!t)continue;let n=m.get(t)??[];n.push(e),m.set(t,n)}let h=0;for(let e of f){let t=e.padding??0;t>h&&(h=t)}let g=[],_=1/0,v=-1/0;for(let e of f){let t=tt(m.get(e.id)??[]);t&&(_=Math.min(_,t.minX),v=Math.max(v,t.maxX),g.push({lane:e,contentTop:t.minY,contentBottom:t.maxY,centerY:(t.minY+t.maxY)/2}))}if(_===1/0||v===-1/0)return!0;let y=Math.max(0,v-_)+2*Math.max(h,10),b=36+y,x=(_+v)/2-y/2-36,S=x+b/2,C=Math.max(h,36);g.sort((e,t)=>e.centerY-t.centerY);for(let e=0;e<g.length;e++){let t=g[e],n,r;if(n=e===0?t.contentTop-C:(g[e-1].contentBottom+t.contentTop)/2,e===g.length-1)r=t.contentBottom+C;else{let n=g[e+1];r=(t.contentBottom+n.contentTop)/2}let i=Math.max(0,r-n),a=(n+r)/2;t.lane.x=S,t.lane.y=a,t.lane.width=b,t.lane.height=i,t.lane.swimlaneContentTop=t.contentTop,t.lane.groupTitleRect={left:x,right:x+36,top:n,bottom:r}}return t===`RL`&&it(e,`x`),!0}function st(e,t){let{nodeInfoById:n,realNodeRects:r}=ge(t);for(let t of e){if(t.isLayoutOnly)continue;let i=t.points;if(!i||i.length<4)continue;let a=H(V(i,Qn),Qn);if(!a)continue;let{p3:o}=a,s=a.kind===`HVH`,c=ye(t,n,Qn);if(!c)continue;let{srcId:l,dstId:u,srcInfo:d,dstInfo:f,collinearX:p,collinearY:m}=c;if(p||m)continue;let h,g=d.rect;for(let n of er){let i,a,c;if(s){let e=f.cy>d.cy?g.bottom:g.top,t=d.cx+n;if(t<=g.left+Qn||t>=g.right-Qn)continue;i={x:t,y:e},a={x:t,y:o.y},c={x:o.x,y:o.y}}else{let e=f.cx>d.cx?g.right:g.left,t=d.cy+n;if(t<=g.top+Qn||t>=g.bottom-Qn)continue;i={x:e,y:t},a={x:o.x,y:t},c={x:o.x,y:o.y}}let p=N(i,a,Qn),m=N(a,c,Qn);if(p&&m||!p&&K(i,a,r,[l],1)||!m&&K(a,c,r,[u],1))continue;let _=!p&&Se(i,a,e,t,{epsilon:Qn,skipDegenerateOther:!0}),v=!m&&Se(a,c,e,t,{epsilon:Qn,skipDegenerateOther:!0});if(!(_||v)){h=p?[a,c]:m?[i,a]:[i,a,c];break}}h&&(t.points=h)}}function ct(e,n){let r=.001,{realNodeRects:i,labelNodeRects:a}=_e(n.values());for(let o of e){if(o.isLayoutOnly)continue;let s=o.points;if(!s||s.length<4)continue;let c=V(s,r);if(c.length<4)continue;let l=c.length-1,u=c[l],d=c[l-1],f=c[l-2],p=u.x-d.x,m=u.y-d.y,h=Math.hypot(p,m);if(h>=10||h<r)continue;let g=d.x-f.x,_=d.y-f.y;if(Math.hypot(g,_)<r)continue;let v=I(d,u,r),y=L(d,u,r),b=I(f,d,r),x=L(f,d,r);if(!(v&&x||y&&b))continue;let S=o.end,C=o.start,w=S?n.get(S):void 0;if(!w)continue;let T=w.x??0,E=w.y??0,D=U(w);if(!D)continue;let O,k;if(x){let e=_<0;O={x:T,y:f.y},k={x:T,y:e?D.bottom:D.top}}else{let e=g>0;O={x:f.x,y:E},k={x:e?D.right:D.left,y:E}}if(K(O,k,i,S?[S]:[],-2)||K(O,k,a,[],-2))continue;if(C){let e=n.get(C),t=e?U(e):void 0;if(t&&ue(O,t,2))continue}let A=t((e,t)=>`${e.x.toFixed(3)},${e.y.toFixed(3)}|${t.x.toFixed(3)},${t.y.toFixed(3)}`,`ownSegmentKey`),j=new Set;for(let e=0;e<c.length-1;e++)j.add(A(c[e],c[e+1]));let ee=t((t,n)=>{for(let i of e){if(i===o||i.isLayoutOnly)continue;let e=i.points;if(!(!e||e.length<2))for(let i=0;i<e.length-1;i++){let a=e[i],o=e[i+1];if(!j.has(A(a,o))&&Ce(t,n,a,o,r))return!0}}return!1},`segmentCrossesOtherEdge`);if(ee(O,k))continue;if(l-3>=0){let e=c[l-3],t=[C,S].filter(e=>!!e);if(K(e,O,i,t,-2)||ee(e,O))continue}let te=[...c.slice(0,l-2),O,k];o.points=te;let M=o.labelNodeId;if(M){let e=n.get(M);if(e){let t=e.width??0,n=e.height??0;if(t>0&&n>0){let i,a,o=-1;for(let e=0;e<te.length-1;e++){let s=te[e],c=te[e+1],l=Math.hypot(c.x-s.x,c.y-s.y),u=F(s,c,r),d=P(s,c,r);(u&&l>=t+2||d&&l>=n+2)&&l>o&&(o=l,i=(s.x+c.x)/2,a=(s.y+c.y)/2)}i!==void 0&&a!==void 0&&(e.x=i,e.y=a)}}}}}function lt(e,n){let r=t((e,t)=>{let n=e.x??0,r=e.y??0,i=t.x-n,a=t.y-r,o=(e.width??0)/2,s=(e.height??0)/2;return Math.abs(a)*o>Math.abs(i)*s?(a<0&&(s=-s),{x:n+(a===0?0:s*i/a),y:r+s}):(i<0&&(o=-o),{x:n+o,y:r+(i===0?0:o*a/i)})},`rectIntersect`),i=t((e,t)=>{let i=V(e.points??[]);if(i.length<2)return;let a=t?e.start:e.end,o=a?n.get(a):void 0,s=o?U(o):void 0;if(!o||!a||!s)return;let c=t?i[0]:i[i.length-1],l=t?i[1]:i[i.length-2],u=r(o,c),d=c;if(tr(l,u)&&(d=l),P(u,d,Y))return{edge:e,edgeId:String(e.id??``),nodeId:a,atStart:t,orientation:`V`,coord:u.x,min:Math.min(u.y,d.y),max:Math.max(u.y,d.y),boundary:u,railEnd:d,rect:s};if(F(u,d,Y))return{edge:e,edgeId:String(e.id??``),nodeId:a,atStart:t,orientation:`H`,coord:u.y,min:Math.min(u.x,d.x),max:Math.max(u.x,d.x),boundary:u,railEnd:d,rect:s}},`terminalLaneFor`),a=t((e,t)=>Math.max(0,Math.min(e.max,t.max)-Math.max(e.min,t.min)),`projectedOverlapLength`),o=t((e,t)=>e.nodeId!==t.nodeId||e.orientation!==t.orientation?!1:e.orientation===`H`?(Math.abs(e.boundary.x-e.rect.left)<1||Math.abs(e.boundary.x-e.rect.right)<1)&&P(e.boundary,t.boundary,1):(Math.abs(e.boundary.y-e.rect.top)<1||Math.abs(e.boundary.y-e.rect.bottom)<1)&&F(e.boundary,t.boundary,1),`sameTerminalFace`),s=t((e,t)=>e.nodeId!==t.nodeId||e.orientation!==t.orientation?!1:a(e,t)>=X&&Math.abs(e.coord-t.coord)<.5,`exactTerminalLaneConflict`),c=t((e,t)=>{if(e.nodeId!==t.nodeId||e.orientation!==t.orientation||e.orientation!==`H`||e.atStart===t.atStart)return!1;let n=a(e,t);if(n<X)return!1;let r=e.rect.bottom-e.rect.top;return n<r||n>2*r?!1:o(e,t)&&Math.abs(e.coord-t.coord)<16},`nearTerminalLaneConflict`),l=t((e,n)=>{let r=V(e.edge.points??[]);if(r.length<2)return;let i=e.orientation===`V`?{x:e.boundary.x+n,y:e.boundary.y}:{x:e.boundary.x,y:e.boundary.y+n},a=e.orientation===`V`?{x:e.railEnd.x+n,y:e.railEnd.y}:{x:e.railEnd.x,y:e.railEnd.y+n};if(!t(()=>Math.abs(e.boundary.y-e.rect.top)<1||Math.abs(e.boundary.y-e.rect.bottom)<1?F(i,e.boundary,Y)&&i.x>=e.rect.left+1&&i.x<=e.rect.right-1:Math.abs(e.boundary.x-e.rect.left)<1||Math.abs(e.boundary.x-e.rect.right)<1?P(i,e.boundary,Y)&&i.y>=e.rect.top+1&&i.y<=e.rect.bottom-1:!1,`boundaryStaysOnSameFace`)())return;if(e.atStart){let t=r.length>1&&N(r[1],e.railEnd,Y),n=r.slice(t?2:1),o=n[0];return o&&!tr(o,a)?void 0:[i,a,...n]}let o=r.length>1&&N(r[r.length-2],e.railEnd,Y),s=r.slice(0,o?-2:-1),c=s[s.length-1];if(!(c&&!tr(c,a)))return[...s,a,i]},`shiftedCandidate`),u=t(e=>{let t=e.edge,r=V(t.points??[]);if(r.length!==2)return!1;let i=t.start,a=t.end,o=i?n.get(i):void 0,s=a?n.get(a):void 0;if(!o||!s)return!1;let c=o.x??0,l=o.y??0,u=s.x??0,d=s.y??0,[f,p]=r;return F(f,p,Y)&&Math.abs(l-d)<1&&Math.abs(c-u)>1||P(f,p,Y)&&Math.abs(c-u)<1&&Math.abs(l-d)>1},`laneIsStraightCollinearConnector`),d=[-7,7,-14,14,-21,21];for(let t=0;t<8;t++){let t=e.filter(e=>!e.isLayoutOnly).flatMap(e=>[i(e,!0),i(e,!1)]).filter(e=>!!e),n=!1;for(let e=0;e<t.length&&!n;e++)for(let r=e+1;r<t.length&&!n;r++){let a=t[e],o=t[r];if(a.edge===o.edge||!(s(a,o)||c(a,o)))continue;let f=!s(a,o),p=[a,o].sort((e,t)=>{let n=u(e),r=u(t);return n===r?Number(!t.atStart)-Number(!e.atStart):Number(n)-Number(r)});for(let e of p){for(let r of d){let a=l(e,r);if(!a)continue;let o=i({...e.edge,points:a},e.atStart);if(!(!o||t.some(t=>t.edge!==e.edge&&(s(o,t)||f&&c(o,t))))){e.edge.points=a,n=!0;break}}if(n)break}}if(!n)return}}function ut(e,n){let{realNodeRects:r,labelNodeRects:i}=_e(n.values()),a=t((t,n)=>{let a=t.start,o=t.end,s=Z(n);if(s.length!==n.length-1)return!1;let c=[a,o].filter(e=>!!e);for(let e of s)if(K(e.a,e.b,r,c,-2)||K(e.a,e.b,i,[],-2))return!1;for(let n of e){if(n===t||n.isLayoutOnly)continue;let e=n.points;if(!(!e||e.length<2)){for(let t of s)for(let n of Z(V(e)))if(z(t,n,.5)>=X||Ce(t.a,t.b,n.a,n.b,Y))return!1}}return!0},`candidateIsSafe`),o=t((e,t)=>{if(t+4>=e.length)return;let n=e[t],r=e[t+1],i=e[t+2],a=e[t+3],o=e[t+4],s=I(n,r)&&L(r,i)&&I(i,a)&&L(a,o)&&P(n,a,Y)&&P(n,o,Y)&&P(r,i,Y)&&(r.x-n.x)*(a.x-i.x)<0,c=L(n,r)&&I(r,i)&&L(i,a)&&I(a,o)&&F(n,a,Y)&&F(n,o,Y)&&F(r,i,Y)&&(r.y-n.y)*(a.y-i.y)<0;if(s||c)return V([...e.slice(0,t+1),o,...e.slice(t+5)]);if(t+5>=e.length)return;let l=e[t+5],u=L(n,r)&&I(r,i)&&L(i,a)&&I(a,o)&&L(o,l)&&P(n,o,Y)&&P(n,l,Y)&&P(i,a,Y)&&(i.x-r.x)*(o.x-a.x)<0,d=I(n,r)&&L(r,i)&&I(i,a)&&L(a,o)&&I(o,l)&&F(n,o,Y)&&F(n,l,Y)&&F(i,a,Y)&&(i.y-r.y)*(o.y-a.y)<0;if(!(!u&&!d))return V([...e.slice(0,t+1),l,...e.slice(t+6)])},`withoutDogleg`);for(let t=0;t<8;t++){let t=!1;for(let n of e){if(n.isLayoutOnly)continue;let e=V(n.points??[]);for(let r=0;r<=e.length-5;r++){let i=o(e,r);if(!(!i||!a(n,i))){n.points=i,t=!0;break}}if(t)break}if(!t)return}}function dt(e,n){let{realNodeRects:r,labelNodeRects:i}=_e(n.values()),a=e.filter(e=>!e.isLayoutOnly),o=t((e,t,n)=>V(e===t?n??[]:e.points??[]),`pointsFor`),s=t((e,t)=>{let n=0;for(let r=0;r<a.length;r++){let i=Z(o(a[r],e,t));for(let s=r+1;s<a.length;s++){let r=Z(o(a[s],e,t));for(let e of i)for(let t of r)Ce(e.a,e.b,t.a,t.b,Y)&&n++}}return n},`strictCrossingCount`),c=t(e=>{let t=Z(e);if(t.length!==3)return;let n=t[1];if(!(t[0].horizontal===n.horizontal||t[2].horizontal===n.horizontal))return{index:n.index,horizontal:n.horizontal,vertical:n.vertical,segment:n}},`middleRail`),l=t((e,t)=>{let n=[e.start,e.end].filter(e=>!!e);return r.filter(e=>{if(n.includes(e.id))return!1;let r=e.rect;return t.horizontal?R(t.a.x,t.b.x,r.left,r.right)>=X&&t.a.y>=r.top-2&&t.a.y<=r.bottom+2:R(t.a.y,t.b.y,r.top,r.bottom)>=X&&t.a.x>=r.left-2&&t.a.x<=r.right+2})},`blockingRectsFor`),u=t((e,t,n)=>{let r=e.map(e=>({...e}));if(t.horizontal)r[t.index].y=n,r[t.index+1].y=n;else if(t.vertical)r[t.index].x=n,r[t.index+1].x=n;else return;let i=Oe(V(r));return Z(i).length===i.length-1?i:void 0},`candidateByMovingRail`),d=t((e,t,n)=>{let c=[e.start,e.end].filter(e=>!!e),l=Z(t);if(l.length!==t.length-1)return!1;for(let e of l)if(K(e.a,e.b,r,c,-2)||K(e.a,e.b,i,[],-2))return!1;for(let t of a)if(t!==e){for(let e of l)for(let n of Z(o(t)))if(z(e,n,.5)>=X)return!1}return s(e,t)<=n},`candidateIsSafe`);for(let e=0;e<8;e++){let e=s(),t=!1;for(let n of a){let r=o(n),i=c(r);if(!i)continue;let a=l(n,i.segment);if(a.length===0)continue;let s=i.horizontal?[Math.min(...a.map(e=>e.rect.top))-20,Math.max(...a.map(e=>e.rect.bottom))+20]:[Math.min(...a.map(e=>e.rect.left))-20,Math.max(...a.map(e=>e.rect.right))+20];for(let a of s){let o=u(r,i.segment,a);if(!(!o||!d(n,o,e))){n.points=o,t=!0;break}}if(t)break}if(!t)return}}function ft(e,n){let r=t(e=>{let t=e.groupTitleRect;if(!(!t||typeof t.left!=`number`||typeof t.right!=`number`||typeof t.top!=`number`||typeof t.bottom!=`number`||!Number.isFinite(t.left)||!Number.isFinite(t.right)||!Number.isFinite(t.top)||!Number.isFinite(t.bottom)||t.right<=t.left||t.bottom<=t.top))return{left:t.left,right:t.right,top:t.top,bottom:t.bottom}},`validTitleRect`),i=t(e=>{if(!e.isGroup||e.parentId)return;let t=e.direction,n=typeof t==`string`?t.toUpperCase():``;if(n===`LR`||n===`RL`||n===`BT`)return;let i=r(e),a=e.y,o=e.height;if(!i||typeof a!=`number`||typeof o!=`number`||!Number.isFinite(a)||!Number.isFinite(o)||o<=0)return;let s=i.right-i.left,c=i.bottom-i.top;if(!(c<=0||s<c))return{node:e,rect:i}},`topLaneTitleFor`),a=t((e,t)=>{if(!e.horizontal)return!1;let n=e.a.y;return n<=t.top+Y||n>=t.bottom-Y?!1:R(e.a.x,e.b.x,t.left,t.right)>=X},`horizontalSegmentIntersectsTitle`),o=[...n.values()].map(i).filter(e=>!!e);if(o.length===0)return;let s=0;for(let t of e){if(t.isLayoutOnly)continue;let e=V(t.points??[]);for(let t of Z(e))for(let e of o)a(t,e.rect)&&(s=Math.max(s,e.rect.bottom-t.a.y+4))}if(!(s<=Y))for(let e of o){let t=e.node.y,n=e.node.height;typeof t!=`number`||typeof n!=`number`||!Number.isFinite(t)||!Number.isFinite(n)||n<=0||(e.node.y=t-s/2,e.node.height=n+s,e.node.groupTitleRect={...e.rect,top:e.rect.top-s,bottom:e.rect.bottom-s})}}function pt(e,n){let r=t(e=>{let t=e.groupTitleRect;if(!(!t||typeof t.left!=`number`||typeof t.right!=`number`||typeof t.top!=`number`||typeof t.bottom!=`number`||!Number.isFinite(t.left)||!Number.isFinite(t.right)||!Number.isFinite(t.top)||!Number.isFinite(t.bottom)||t.right<=t.left||t.bottom<=t.top))return{left:t.left,right:t.right,top:t.top,bottom:t.bottom}},`validTitleRect`),i=t(e=>{if(!e.isGroup||e.parentId||e.direction!==`LR`)return;let t=r(e),n=e.x,i=e.width;if(!t||typeof n!=`number`||typeof i!=`number`||!Number.isFinite(n)||!Number.isFinite(i)||i<=0)return;let a=t.right-t.left,o=t.bottom-t.top;if(!(a<=0||o<a))return{node:e,rect:t}},`leftLaneTitleFor`),a=t((e,t)=>{if(!e.vertical)return!1;let n=e.a.x;return n<=t.left+Y||n>=t.right-Y?!1:R(e.a.y,e.b.y,t.top,t.bottom)>=X},`verticalSegmentIntersectsTitle`),o=t((e,t)=>{if(!e.horizontal)return!1;let n=e.a.y;return n<=t.top+Y||n>=t.bottom-Y?!1:R(e.a.x,e.b.x,t.left,t.right)>=X},`horizontalSegmentIntersectsTitle`),s=[...n.values()].map(i).filter(e=>!!e);if(s.length===0)return;let c=0;for(let t of e){if(t.isLayoutOnly)continue;let e=V(t.points??[]);for(let t of Z(e))for(let e of s)if(a(t,e.rect))c=Math.max(c,e.rect.right-t.a.x+4);else if(o(t,e.rect)){let n=Math.min(t.a.x,t.b.x);c=Math.max(c,e.rect.right-n+4)}}if(!(c<=Y))for(let e of s){let t=e.node.x,n=e.node.width;typeof t!=`number`||typeof n!=`number`||!Number.isFinite(t)||!Number.isFinite(n)||n<=0||(e.node.x=t-c/2,e.node.width=n+c,e.node.groupTitleRect={...e.rect,left:e.rect.left-c,right:e.rect.right-c})}}function mt(e,n){let{realNodeRects:r}=_e(n.values()),i=e.filter(e=>!e.isLayoutOnly),a=t((e,t=new Map)=>V(t.get(e)??e.points??[]),`replacementPointsFor`),o=t((e=new Map)=>{let t=0;for(let n=0;n<i.length;n++){let r=Z(a(i[n],e));for(let o=n+1;o<i.length;o++){let n=Z(a(i[o],e));for(let e of r)for(let r of n)Ce(e.a,e.b,r.a,r.b,Y)&&t++}}return t},`crossingCount`),s=t((e=new Map)=>i.reduce((t,n)=>t+B(a(n,e)),0),`totalBends`),c=t(e=>{let t=a(e);if(t.length<4)return;let n=t[t.length-2],r=t[t.length-1];if(!(!I(n,r,Y)&&!L(n,r,Y)))return{tailStart:n,terminal:r}},`terminalTailFor`),l=t((e,t)=>{let n=a(e);if(n.length<3)return;let r=n[0],i=n[1],o;if(I(r,i,Y))o={x:i.x,y:t.tailStart.y};else if(L(r,i,Y))o={x:t.tailStart.x,y:i.y};else return;let s=Oe(V([r,i,o,t.tailStart,t.terminal]));return Z(s).length===s.length-1?s:void 0},`candidateWithDestinationTail`),u=t((e,t)=>{let n=[e.start,e.end].filter(e=>!!e);for(let e of Z(t))if(K(e.a,e.b,r,n,-2))return!0;return!1},`pathHasNodeHit`),d=t((e,t,n)=>{for(let r of i)if(r!==e){for(let e of Z(t))for(let t of Z(a(r,n)))if(z(e,t,.5)>=X)return!0}return!1},`pathHasSharedTrack`),f=t((e,t,n)=>!u(e,t)&&!d(e,t,n),`candidateIsSafe`),p=t(()=>{let e=new Map;for(let t of i){let r=t.end;if(!r||!n.has(r)||a(t).length<4)continue;let i=e.get(r)??[];i.push(t),e.set(r,i)}return e},`edgesByDestination`);for(let e=0;e<4;e++){let e=o();if(e===0)return;let t=s(),n,r=e,i=t;for(let t of p().values())for(let a=0;a<t.length;a++)for(let u=a+1;u<t.length;u++){let d=t[a],p=t[u],m=c(d),h=c(p);if(!m||!h)continue;let g=l(d,h),_=l(p,m);if(!g||!_)continue;let v=new Map([[d,g],[p,_]]);if(!f(d,g,v)||!f(p,_,v))continue;let y=o(v),b=s(v);y>=e||y>r||y===r&&b>=i||(n=v,r=y,i=b)}if(!n)return;for(let[e,t]of n)e.points=t}}function ht(e,n){let{realNodeRects:r,labelNodeRects:i}=_e(n.values()),a=e.filter(e=>!e.isLayoutOnly),o=t((e,t=new Map)=>V(t.get(e)??e.points??[]),`replacementPointsFor`),s=t((e=new Map)=>{let t=0;for(let n=0;n<a.length;n++){let r=Z(o(a[n],e));for(let i=n+1;i<a.length;i++){let n=Z(o(a[i],e));for(let e of r)for(let r of n)Ce(e.a,e.b,r.a,r.b,Y)&&t++}}return t},`strictCrossingCount`),c=t((e=new Map)=>a.reduce((t,n)=>t+B(o(n,e)),0),`totalBends`),l=t(e=>{let t=e.start,r=e.end,i=t?n.get(t):void 0,a=r?n.get(r):void 0,o=i?U(i):void 0,s=a?U(a):void 0;return o&&s?{src:o,dst:s}:void 0},`endpointRectsFor`),u=t((e,t,n)=>{if(n.index<=0||n.index+1>=t.length-1)return;let r=l(e);if(r){if(n.vertical){let i=n.a.x,a=Math.min(r.src.left,r.dst.left),o=Math.max(r.src.right,r.dst.right),s=i<a-Y?`left`:i>o+Y?`right`:void 0;return s?{edge:e,points:t,segmentIndex:n.index,axis:`vertical`,side:s,coord:i,min:Math.min(n.a.y,n.b.y),max:Math.max(n.a.y,n.b.y)}:void 0}if(n.horizontal){let i=n.a.y,a=Math.min(r.src.top,r.dst.top),o=Math.max(r.src.bottom,r.dst.bottom),s=i<a-Y?`top`:i>o+Y?`bottom`:void 0;return s?{edge:e,points:t,segmentIndex:n.index,axis:`horizontal`,side:s,coord:i,min:Math.min(n.a.x,n.b.x),max:Math.max(n.a.x,n.b.x)}:void 0}}},`externalRailForSegment`),d=t(()=>{let e=[];for(let t of a){let n=o(t);for(let r of Z(n)){let i=u(t,n,r);i&&e.push(i)}}return e},`collectExternalRails`),f=t((e,t)=>e.edge!==t.edge&&e.axis===t.axis&&e.side===t.side&&R(e.min,e.max,t.min,t.max)>=X,`railsInteract`),p=t(e=>{let t=[],n=new Set;for(let r of e){if(n.has(r))continue;let i=[r],a=[];for(n.add(r);i.length>0;){let t=i.pop();a.push(t);for(let r of e)!n.has(r)&&f(t,r)&&(n.add(r),i.push(r))}a.length>1&&t.push(a)}return t},`connectedComponents`),m=t(e=>{let t=[];for(let n of e)t.some(e=>Math.abs(e-n.coord)<Y)||t.push(n.coord);for(;t.length<e.length;){let n=Math.min(...t),r=Math.max(...t),i=e[0].side;t.push(i===`left`||i===`top`?n-12*(e.length-t.length):r+12*(e.length-t.length))}return t},`uniqueCoordsFor`),h=t(e=>{let n=e.map(e=>e.coord),r=m(e),i=[];if(e.length<=6){let a=Array(r.length).fill(!1),o=[],s=t(()=>{if(o.length===e.length){o.some((e,t)=>Math.abs(e-n[t])>=Y)&&i.push([...o]);return}for(let[e,t]of r.entries())a[e]||(a[e]=!0,o.push(t),s(),o.pop(),a[e]=!1)},`visit`);return s(),i}for(let e=0;e<n.length;e++)for(let t=e+1;t<n.length;t++){let r=[...n];[r[e],r[t]]=[r[t],r[e]],i.push(r)}return i},`coordinateAssignmentsFor`),g=t((e,t)=>{let n=new Map;for(let[r,i]of e.entries()){let e=t[r],a=n.get(i.edge)??i.points.map(e=>({x:e.x,y:e.y}));i.axis===`vertical`?(a[i.segmentIndex].x=e,a[i.segmentIndex+1].x=e):(a[i.segmentIndex].y=e,a[i.segmentIndex+1].y=e),n.set(i.edge,a)}let r=new Map;for(let[e,t]of n){let n=Oe(V(t));if(Z(n).length!==n.length-1)return;r.set(e,n)}return r},`replacementsForAssignment`),_=t(e=>{for(let[t,n]of e){let e=[t.start,t.end].filter(e=>!!e);for(let t of Z(n))if(K(t.a,t.b,r,e,-2)||K(t.a,t.b,i,[],-2))return!1}for(let t=0;t<a.length;t++){let n=a[t],r=e.has(n),i=Z(o(n,e));for(let n=t+1;n<a.length;n++){let t=a[n];if(!r&&!e.has(t))continue;let s=Z(o(t,e));for(let e of i)for(let t of s)if(z(e,t,.5)>=X)return!1}}return!0},`candidateIsSafe`);for(let e=0;e<4;e++){let e=s();if(e===0)return;let t,n=e,r=c(),i=1/0;for(let a of p(d()))for(let o of h(a)){let l=g(a,o);if(!l||!_(l))continue;let u=s(l);if(u>=e)continue;let d=c(l),f=a.reduce((e,t,n)=>e+Math.abs(o[n]-t.coord),0);u>n||u===n&&(d>r||d===r&&f>=i)||(t=l,n=u,r=d,i=f)}if(!t)return;for(let[e,n]of t)e.points=n}}function gt(e,n){let{realNodeRects:r,labelNodeRects:i}=_e(n.values()),a=e.filter(e=>!e.isLayoutOnly),o=t((e,t,n)=>V(e===t?n??[]:e.points??[]),`pointsFor`),s=t(e=>Z(e).reduce((e,t)=>{let n=t.a.x-t.b.x,r=t.a.y-t.b.y;return e+Math.hypot(n,r)},0),`pathLength`),c=t((e,t)=>{let n=0;for(let r=0;r<a.length;r++){let i=Z(o(a[r],e,t));for(let s=r+1;s<a.length;s++){let r=Z(o(a[s],e,t));for(let e of i)for(let t of r)Ce(e.a,e.b,t.a,t.b,Y)&&n++}}return n},`strictCrossingCount`),l=t((e,t)=>{if(e.horizontal){let n=e.a.y;return(Math.abs(n-t.top)<1||Math.abs(n-t.bottom)<1)&&R(e.a.x,e.b.x,t.left,t.right)>=X}if(e.vertical){let n=e.a.x;return(Math.abs(n-t.left)<1||Math.abs(n-t.right)<1)&&R(e.a.y,e.b.y,t.top,t.bottom)>=X}return!1},`segmentRunsAlongRectBorder`),u=t(e=>{let t=[e.start,e.end].filter(e=>!!e),r=[];for(let e of t){let t=n.get(e),i=t?U(t):void 0;i&&r.push(i)}return r},`endpointRectsFor`),d=t((e,t)=>{if(t+3>=e.length)return[];let n=e[t],r=e[t+1],i=e[t+2],a=e[t+3],o=I(n,r,Y)&&L(r,i,Y)&&I(i,a,Y),s=L(n,r,Y)&&I(r,i,Y)&&L(i,a,Y);if(!o&&!s||!(o?Math.sign(r.x-n.x)!==Math.sign(a.x-i.x):Math.sign(r.y-n.y)!==Math.sign(a.y-i.y)))return[];let c=P(n,a,Y)||F(n,a,Y)?[]:[{x:n.x,y:a.y},{x:a.x,y:n.y}],l=c.length===0?[[...e.slice(0,t+1),...e.slice(t+3)]]:c.map(n=>[...e.slice(0,t+1),n,...e.slice(t+3)]),u=new Set;return l.map(e=>Oe(V(e))).filter(e=>{if(Z(e).length!==e.length-1||!e.some(e=>N(e,a,Y)))return!1;let t=e.map(e=>`${e.x.toFixed(3)},${e.y.toFixed(3)}`).join(`|`);return u.has(t)?!1:(u.add(t),!0)})},`shortcutCandidatesAt`),f=t((e,t,n)=>{let s=[e.start,e.end].filter(e=>!!e),d=u(e);for(let e of Z(t))if(K(e.a,e.b,r,s,-2)||K(e.a,e.b,i,[],-2)||d.some(t=>l(e,t)))return!1;for(let n of a)if(n!==e){for(let e of Z(t))for(let t of Z(o(n)))if(z(e,t,.5)>=X)return!1}return c(e,t)<=n},`candidateIsSafe`);for(let e=0;e<8;e++){let e=c(),t,n,r=e,i=1/0,l=1/0;for(let u of a){let a=o(u),p=B(a,Y),m=s(a);for(let o=0;o<=a.length-4;o++)for(let h of d(a,o)){let a=B(h,Y),o=s(h);if(!(a<p||a===p&&o<m-Y)||!f(u,h,e))continue;let d=c(u,h);d>r||d===r&&(a>i||a===i&&o>=l)||(t=u,n=h,r=d,i=a,l=o)}}if(!t||!n)return;t.points=n}}function _t(e,n){let r=[];for(let e of n.values()){if(e.isGroup||e.isEdgeLabel)continue;let t=e.x??0,n=e.y??0,i=U(e);i&&r.push({id:String(e.id??``),cx:t,cy:n,rect:i})}if(r.length===0)return;let i=new Map(r.map(e=>[e.id,e])),a=r.map(e=>({id:e.id,rect:e.rect})),o=[`top`,`bottom`,`left`,`right`],s={top:Math.min(...r.map(e=>e.rect.top))-20,bottom:Math.max(...r.map(e=>e.rect.bottom))+20,left:Math.min(...r.map(e=>e.rect.left))-20,right:Math.max(...r.map(e=>e.rect.right))+20},c=e.filter(e=>!e.isLayoutOnly),l=new Map(c.map((e,t)=>[e,t])),u=t(e=>{let t=e===`left`||e===`top`?-1:1,n=[];for(let r=0;r<=2;r++)n.push(s[e]+t*20*r);return n},`outwardTracksForSide`),d=t((e,t=new Map)=>V(t.get(e)??e.points??[]),`replacementPointsFor`),f=t((e,t)=>{let n=0;for(let r of e)for(let e of t)Ce(r.a,r.b,e.a,e.b,Y)&&n++;return n},`crossingCountBetweenSegments`),p=t((e,t)=>f(Z(e),Z(t)),`crossingCountBetweenPaths`),m=t((e=new Map)=>{let n=0,r=[],i=new Set,a=[],o=t(e=>{i.has(e)||(i.add(e),a.push(e))},`addEdge`);for(let t=0;t<c.length;t++){let i=c[t],a=d(i,e);for(let s=t+1;s<c.length;s++){let t=c[s],l=p(a,d(t,e));l>0&&(n+=l,r.push({first:i,second:t,count:l}),o(i),o(t))}}return a.sort((e,t)=>(l.get(e)??0)-(l.get(t)??0)),{count:n,pairs:r,edgeSet:i,edges:a}},`crossingSnapshot`),h=t((e,t)=>{let n=new Set(t.keys());if(n.size===0)return e.count;let r=0;for(let t of e.pairs)(n.has(t.first)||n.has(t.second))&&(r+=t.count);let i=0;for(let e=0;e<c.length;e++){let r=c[e],a=n.has(r),o=d(r,t);for(let r=e+1;r<c.length;r++){let e=c[r];!a&&!n.has(e)||(i+=p(o,d(e,t)))}}return e.count-r+i},`crossingCountWithReplacements`),g=t(e=>{let t=new Map;for(let n of e.pairs){let e=t.get(n.first)??new Set;e.add(n.second),t.set(n.first,e);let r=t.get(n.second)??new Set;r.add(n.first),t.set(n.second,r)}let n=[],r=new Set;for(let i of e.edges){if(r.has(i))continue;let e=[i],a=[];for(r.add(i);e.length>0;){let n=e.pop();a.push(n);for(let i of t.get(n)??[])r.has(i)||(r.add(i),e.push(i))}a.sort((e,t)=>(l.get(e)??0)-(l.get(t)??0)),a.length>1&&n.push(a)}return n},`crossingComponents`),_=t(e=>[e.start,e.end].filter(e=>!!e),`endpointIdsFor`),v=t(e=>{let t=[];for(let n of g(e)){let e=new Set(n),r=new Set(n.flatMap(e=>_(e))),i=[...n];for(let t of c)e.has(t)||_(t).some(e=>r.has(e))&&i.push(t);i.sort((e,t)=>(l.get(e)??0)-(l.get(t)??0)),t.push(i)}return t},`pairSearchGroups`),y=t((e,t,n)=>h(e,new Map([[t,n]])),`crossingCountWithSingleReplacement`),b=t(e=>{let t=new Map;for(let n of e.pairs)t.set(n.first,(t.get(n.first)??0)+n.count),t.set(n.second,(t.get(n.second)??0)+n.count);return t},`currentCrossingsByEdge`),x=t(e=>e.slice(1).reduce((t,n,r)=>{let i=e[r];return t+Math.abs(n.x-i.x)+Math.abs(n.y-i.y)},0),`pathLength`),S=t((e=new Map)=>c.reduce((t,n)=>t+B(d(n,e)),0),`totalBends`),C=t((e=new Map)=>c.reduce((t,n)=>t+x(d(n,e)),0),`totalLength`),w=t((e,t,n=new Map)=>{let r=Z(t);for(let t of c)if(t!==e){for(let e of r)for(let r of Z(d(t,n)))if(z(e,r,.5)>=X)return!0}return!1},`pathHasSegmentConflict`),T=t((e,t)=>{let n=[e.start,e.end].filter(e=>!!e);for(let e of Z(t))if(K(e.a,e.b,a,n,-2))return!0;return!1},`pathHitsNode`),E=t((e,t)=>{let n=Oe(V(t));Z(n).length===n.length-1&&e.push(n)},`pushOrthogonalCandidate`),D=t(e=>e===`left`||e===`right`,`sideIsHorizontal`),O=t((e,t,n)=>{switch(t){case`left`:return Math.min(e.x,n.x)-20;case`right`:return Math.max(e.x,n.x)+20;case`top`:return Math.min(e.y,n.y)-20;case`bottom`:return Math.max(e.y,n.y)+20}},`localTrackForSameSide`),k=t((e,t,n,r)=>{let i=n===`left`||n===`top`?-1:1,a=[O(t,n,r),s[n]];for(let o of a)for(let a=0;a<=2;a++)E(e,he(t,n,r,o+i*20*a))},`addSameSideCandidates`),A=t((e,t,n,r,i)=>{for(let a of u(n))for(let n of u(i))E(e,[t,{x:a,y:t.y},{x:a,y:n},{x:r.x,y:n},r])},`addHorizontalToVerticalCandidates`),j=t((e,t,n,r,i)=>{for(let a of u(n))for(let n of u(i))E(e,[t,{x:t.x,y:a},{x:n,y:a},{x:n,y:r.y},r])},`addVerticalToHorizontalCandidates`),ee=t((e,t,n,r,i)=>{let a=[...u(`top`),...u(`bottom`)];for(let o of u(n))for(let n of u(i))for(let i of a)E(e,[t,{x:o,y:t.y},{x:o,y:i},{x:n,y:i},{x:n,y:r.y},r])},`addHorizontalPairCandidates`),te=t((e,t,n,r,i)=>{let a=[...u(`left`),...u(`right`)];for(let o of u(n))for(let n of u(i))for(let i of a)E(e,[t,{x:t.x,y:o},{x:i,y:o},{x:i,y:n},{x:r.x,y:n},r])},`addVerticalPairCandidates`),M=t(e=>{let t=new Set;return e.map(e=>V(e)).filter(e=>{let n=e.map(e=>`${e.x.toFixed(3)},${e.y.toFixed(3)}`).join(`|`);return t.has(n)||e.length<2?!1:(t.add(n),!0)})},`dedupeCandidatePaths`),ne=t((e,t,n,r)=>{let i=[],a=G(e,t,n,r,20,Y);a&&E(i,a),t===r&&k(i,e,t,n);let o=D(t),s=D(r);return o&&!s?A(i,e,t,n,r):!o&&s?j(i,e,t,n,r):o?ee(i,e,t,n,r):te(i,e,t,n,r),M(i)},`buildCandidatesForSides`),re=t((e,t,n,r)=>{let i=[...u(`left`),...u(`right`)],a=[...u(`top`),...u(`bottom`)];for(let s of o){let o=W(r,s),c=s===`top`||s===`bottom`?u(s):a;for(let r of i){E(e,[t,n,{x:r,y:n.y},{x:r,y:o.y},o]);for(let i of c)E(e,[t,n,{x:r,y:n.y},{x:r,y:i},{x:o.x,y:i},o])}}},`addVerticalDepartureOuterTrackCandidates`),ie=t((e,t,n,r)=>{let i=[...u(`left`),...u(`right`)],a=[...u(`top`),...u(`bottom`)];for(let s of o){let o=W(r,s),c=s===`left`||s===`right`?u(s):i;for(let r of a){E(e,[t,n,{x:n.x,y:r},{x:o.x,y:r},o]);for(let i of c)E(e,[t,n,{x:n.x,y:r},{x:i,y:r},{x:i,y:o.y},o])}}},`addHorizontalDepartureOuterTrackCandidates`),ae=t(e=>{let t=e.start,n=e.end,r=n?i.get(n):void 0;if(!t||!r)return[];let a=V(e.points??[]);if(a.length<4)return[];let o=a[0],s=a[1],c=[];return L(o,s,Y)?re(c,o,s,r):I(o,s,Y)&&ie(c,o,s,r),c},`terminalPreservingOuterTrackCandidates`),oe=t(e=>{let t=e.start,n=e.end,r=t?i.get(t):void 0,a=n?i.get(n):void 0;if(!r||!a)return[];let s=[];for(let e of o){let t=W(r,e);for(let n of o)s.push(...ne(t,e,W(a,n),n))}return s.push(...ae(e)),s},`candidatePathsFor`),se=t(()=>new Map(c.map(e=>[e,Z(d(e))])),`currentSegmentsByEdge`),N=t((e,t,n)=>{let r=new Set;for(let i of c){if(i===e)continue;let a=n.get(i)??Z(d(i));t.some(e=>a.some(t=>z(e,t,.5)>=X))&&r.add(i)}return r},`sharedTrackConflictsFor`),P=t((e,t,n,r)=>{let i=new Set;return oe(e).map(e=>Oe(V(e))).filter(t=>{if(T(e,t))return!1;let n=t.map(e=>`${e.x.toFixed(3)},${e.y.toFixed(3)}`).join(`|`);return i.has(n)||t.length<2?!1:(i.add(n),!0)}).map(i=>{let a=Z(i),o=0;for(let t of c)t!==e&&(o+=f(a,n.get(t)??Z(d(t))));return{candidate:i,candidateSegments:a,crossings:t.count-(r.get(e)??0)+o,bends:B(i,Y),totalBends:B(i),length:x(i)}}).filter(({crossings:e})=>e<=t.count).sort((e,t)=>e.crossings-t.crossings||e.bends-t.bends||e.length-t.length).slice(0,48).map(t=>({path:t.candidate,segments:t.candidateSegments,sharedTrackConflicts:N(e,t.candidateSegments,n),totalBends:t.totalBends,length:t.length}))},`pairCandidatesFor`),F=t((e,t,n,r,i,a)=>{let o=0;for(let n of e.pairs)(n.first===t||n.second===t||n.first===r||n.second===r)&&(o+=n.count);let s=f(n.segments,i.segments);for(let e of c){if(e===t||e===r)continue;let o=a.get(e)??Z(d(e));s+=f(n.segments,o)+f(i.segments,o)}return e.count-o+s},`pairCrossingCount`),R=t((e,t)=>{for(let n of e.sharedTrackConflicts)if(n!==t)return!1;return!0},`conflictsOnlyWith`),ce=t((e,t)=>e.segments.some(e=>t.segments.some(t=>z(e,t,.5)>=X)),`candidatesShareTrack`),H=t((e,t,n,r)=>R(t,n.edge)&&R(r,e.edge)&&!ce(t,r),`pairCandidatesAreCompatible`),le=t((e,t,n,r,i)=>{let a=F(e.current,t.edge,n,r.edge,i,e.baseSegments);if(!(a>=e.current.count))return{replacements:new Map([[t.edge,n.path],[r.edge,i.path]]),crossings:a,bends:e.currentBends-(e.baseBendsByEdge.get(t.edge)??0)-(e.baseBendsByEdge.get(r.edge)??0)+n.totalBends+i.totalBends,length:e.currentLength-(e.baseLengthByEdge.get(t.edge)??0)-(e.baseLengthByEdge.get(r.edge)??0)+n.length+i.length}},`scorePairReplacement`),ue=t((e,t)=>e.crossings<t.crossings||e.crossings===t.crossings&&(e.bends<t.bends||e.bends===t.bends&&e.length<t.length),`pairScoreIsBetter`),de=t((e,t,n,r)=>{let i=r;for(let r of t.candidates)for(let a of n.candidates){if(!H(t,r,n,a))continue;let o=le(e,t,r,n,a);o&&ue(o,i)&&(i=o)}return i},`bestScoreForOptionPair`),fe=t(e=>{let t=S(),n=C(),r=se(),i=b(e),a=new Map(c.map(e=>[e,B(d(e))])),o=new Map(c.map(e=>[e,x(d(e))])),s=new Map,l=v(e);for(let t of l)for(let n of t){if(s.has(n))continue;let t=P(n,e,r,i);t.length>0&&s.set(n,{edge:n,candidates:t})}let u={replacements:new Map,crossings:e.count,bends:t,length:n},f={current:e,currentBends:t,currentLength:n,baseBendsByEdge:a,baseLengthByEdge:o,baseSegments:r};for(let t of l){let n=new Set(t.filter(t=>e.edgeSet.has(t))),r=t.map(e=>s.get(e)).filter(e=>!!e);for(let e=0;e<r.length;e++){let t=r[e];for(let i=e+1;i<r.length;i++){let e=r[i];!n.has(t.edge)&&!n.has(e.edge)||(u=de(f,t,e,u))}}}return u.replacements.size>0?u.replacements:void 0},`bestPairedReplacement`);for(let e=0;e<4;e++){let e=m(),t=e.count;if(t===0)return;let n,r,i=t,a=1/0;for(let o of e.edges){let s=B(d(o),Y);for(let c of oe(o)){let l=T(o,c),u=!l&&w(o,c),d=y(e,o,c),f=B(c,Y);l||u||(d<t||d===t&&f<s)&&(d>i||d===i&&f>=a||(n=o,r=c,i=d,a=f))}}if(n&&r){n.points=r;continue}let o=fe(e);if(!o)return;for(let[e,t]of o)e.points=t}}function vt(e,n){let{nodeInfoById:r,realNodeRects:i}=ge(n),a=[`top`,`bottom`,`left`,`right`],o={top:Math.min(...i.map(e=>e.rect.top))-20,bottom:Math.max(...i.map(e=>e.rect.bottom))+20,left:Math.min(...i.map(e=>e.rect.left))-20,right:Math.max(...i.map(e=>e.rect.right))+20},s=t((e,t,n,r)=>{let i=[],a=G(e,t,n,r,20,nr);return a&&i.push(a),t===r&&i.push(he(e,t,n,o[t])),i},`buildOrthogonalPathCandidates`),c=t((e,t)=>{for(let n=0;n<e.length-1;n++){let r=e[n],a=e[n+1];if(K(r,a,i,t,1))return!0}return!1},`pathHitsNode`),l=t((t,n,r=!1)=>{let i=0,a=ce(t,nr),o=n.start,s=n.end;for(let t of e){if(t===n||t.isLayoutOnly)continue;let e=t.start,c=t.end;if(!r&&o&&s&&(e===o||e===s||c===o||c===s))continue;let l=t.points;if(!(!l||l.length<2))for(let e of a)for(let t of ce(l,nr)){if(be(e.a,e.b,t.a,t.b,nr,nr)){i++;continue}z(e,t,nr)>=rr&&i++}}return i},`pathConflictCount`),u=t((e,t)=>{let n=Math.abs(e.y-t.rect.top),r=Math.abs(e.y-t.rect.bottom),i=Math.abs(e.x-t.rect.left),a=Math.abs(e.x-t.rect.right),o=`top`,s=n;return r<s&&(o=`bottom`,s=r),i<s&&(o=`left`,s=i),a<s&&(o=`right`,s=a),o},`nearestSideOfRect`),d=new Map,f=t((e,t,n)=>{let r=d.get(e)??[];r.push({side:t,edgeId:n}),d.set(e,r)},`addFaceClaim`);for(let t of e){if(t.isLayoutOnly)continue;let e=t.points??[];if(e.length<1)continue;let n=t.id??``,i=t.start,a=t.end;if(i){let t=r.get(i);t&&f(i,u(e[0],t),n)}if(a){let t=r.get(a);t&&f(a,u(e[e.length-1],t),n)}}let p=t((e,t,n)=>d.get(e)?.some(e=>e.edgeId!==n&&e.side===t)??!1,`faceIsClaimed`);for(let t of e){if(t.isLayoutOnly)continue;let e=t.points;if(!e||e.length<2)continue;let n=B(e,nr);if(n<4)continue;let i=t.start,o=t.end;if(!i||!o)continue;let m=r.get(i),h=r.get(o);if(!m||!h)continue;let g=t.id??``,_=l(e,t,!0),v=l(e,t),y,b=_,x=n;for(let e of a){if(p(i,e,g))continue;let n=W(m,e);for(let r of a){if(p(o,r,g))continue;let a=W(h,r);for(let u of s(n,e,a,r)){if(c(u,[i,o]))continue;let e=B(u,nr);if(_>0){let n=l(u,t,!0);if(n>b||n===b&&e>=x)continue;b=n,x=e,y=u;continue}l(u,t)>v||e<x&&(x=e,y=u)}}}if(y){t.points=y;let e=d.get(i);e&&d.set(i,e.filter(e=>e.edgeId!==g));let n=d.get(o);n&&d.set(o,n.filter(e=>e.edgeId!==g)),f(i,u(y[0],m),g),f(o,u(y[y.length-1],h),g)}}}function yt(e,t){let n=t?0:e.length-1,r=t?1:-1,i=e[n],a=e[n+r];if(!i||!a)return;let o=a.x-i.x,s=a.y-i.y;if(!(Math.abs(o)+Math.abs(s)<Q)){if(Math.abs(s)<=Q){let e=i.x+Math.sign(o)*ir;return{left:Math.min(i.x,e),right:Math.max(i.x,e),top:i.y-ar,bottom:i.y+ar}}if(Math.abs(o)<=Q){let e=i.y+Math.sign(s)*ir;return{left:i.x-ar,right:i.x+ar,top:Math.min(i.y,e),bottom:Math.max(i.y,e)}}return{left:Math.min(i.x,a.x),right:Math.max(i.x,a.x),top:Math.min(i.y,a.y),bottom:Math.max(i.y,a.y)}}}function bt(e){return{left:Math.min(e.left,e.right),right:Math.max(e.left,e.right),top:Math.min(e.top,e.bottom),bottom:Math.max(e.top,e.bottom)}}function xt(e,t){let n=V(t);return[yt(n,!0),yt(n,!1)].some(t=>t&&fe(e,bt(t)))}function St(e,n){let r=[];for(let t of e){if(t.isLayoutOnly)continue;let e=t.points;if(!(!e||e.length<2))for(let n=0;n<e.length-1;n++)r.push({edgeId:t.id,p1:e[n],p2:e[n+1]})}let i=[],a=[];for(let e of n.values()){let t=e.isGroup,n=e.parentId;if(t&&!n){let t=U(e);t&&a.push({id:e.id,rect:t});continue}if(t||e.isEdgeLabel)continue;let r=U(e);r&&i.push({nodeId:e.id,rect:r})}let o=t((e,t)=>{let n=pe(t,3);for(let{nodeId:t,rect:r}of i)if(t!==e&&fe(n,r))return!0;return!1},`labelOverlapsForeignNode`),s=t((e,t)=>{let n=pe(t,3);for(let t of r)if(t.edgeId!==e&&le(t.p1,t.p2,n))return!0;return!1},`labelOverlapsForeignEdge`),c=t((e,t,n)=>o(e,n)||s(t,n),`labelOverlapsAnything`),l=[],u=t(e=>{for(let{id:t,rect:n}of a)if(de(n,e))return t},`findContainingLane`),d=t((e,t)=>l.some(n=>n.labelId!==e&&fe(t,n.rect)),`overlapsPlacedLabel`);for(let r of e){if(r.isLayoutOnly)continue;let e=r.labelNodeId;if(!e)continue;let i=n.get(e);if(!i)continue;let f=r.points;if(!f||f.length<2)continue;let p=i.width??0,m=i.height??0;if(p<=0||m<=0)continue;let h=[];for(let e=0;e<f.length-1;e++){let t=f[e],n=f[e+1],r=Math.abs(t.x-n.x),i=Math.abs(t.y-n.y);r<Q&&i<Q||r>=Q&&i>=Q||h.push({idx:e,length:r+i,orientation:r>=Q?`horizontal`:`vertical`,midX:(t.x+n.x)/2,midY:(t.y+n.y)/2})}if(h.length===0)continue;let g=h.length>=3?h.filter(e=>e.idx>0&&e.idx<h.length-1):h,_=g.length>0?g:h,v=p>=m?`horizontal`:`vertical`,y=t(e=>[...e].sort((e,t)=>{let n=e.orientation===v;if(n!==(t.orientation===v))return n?-1:1;let r=e.length>=(e.orientation===`horizontal`?p:m)+2;return r===t.length>=(t.orientation===`horizontal`?p:m)+2?t.length-e.length:r?-1:1}),`rankSegments`),b=h[0],x=h[h.length-1],S=[.5,.25,.75,.05,.95,.15,.85,.1,.9],C=t((e,t)=>{let n=f[e.idx],r=f[e.idx+1];return{midX:n.x+(r.x-n.x)*t,midY:n.y+(r.y-n.y)*t}},`anchorAtT`),w=t((e,t,n)=>Math.min(n,Math.max(t,e)),`clamp`),T=t((e,t)=>e.midX>=t.left-Q&&e.midX<=t.right+Q&&e.midY>=t.top-Q&&e.midY<=t.bottom+Q,`pointInsideRectInclusive`),E=t(e=>{let t=me(e.midX,e.midY,p,m),n=u(t);if(n)return{laneId:n,anchor:e,rect:t};let r=a.find(({rect:t})=>T(e,t));if(!r)return;let i=r.rect.left+p/2+1,o=r.rect.right-p/2-1,s=r.rect.top+m/2+1,c=r.rect.bottom-m/2-1;if(i>o||s>c)return;let l={midX:w(e.midX,i,o),midY:w(e.midY,s,c)},d=me(l.midX,l.midY,p,m);return T(e,d)?{laneId:r.id,anchor:l,rect:d}:void 0},`placementForAnchor`),D=t((e,t,n)=>e.orientation===`horizontal`?Math.abs(t.midX-n.x):Math.abs(t.midY-n.y),`distanceAlongSegment`),O=t((e,t)=>{let n=(e.orientation===`horizontal`?p/2:m/2)+12;if(e===b){let r=f[e.idx];if(D(e,t,r)+Q<n)return!1}if(e===x){let r=f[e.idx+1];if(D(e,t,r)+Q<n)return!1}return!0},`labelClearsTerminalEndpoints`),k=t(t=>{let n=y(t);for(let t of n)for(let n of S){let i=C(t,n);if(!O(t,i))continue;let a=E(i);if(a&&!xt(a.rect,f)&&!d(e,a.rect)&&!c(e,r.id,a.rect))return{laneId:a.laneId,anchor:a.anchor}}},`tryPool`),A=t((t,n,i=!1)=>{let a=y(t);for(let t of a){let a={midX:t.midX,midY:t.midY};if(n&&!O(t,a))continue;let c=E(a);if(c&&!xt(c.rect,f)&&!d(e,c.rect)&&!o(e,c.rect)&&(i||!s(r.id,c.rect)))return{laneId:c.laneId,anchor:c.anchor}}},`findLaneContainingFallback`),j=k(_)??(_.length<h.length?k(h):void 0)??A(h,!0)??A(h,!1)??A(h,!1,!0);if(j){i.x=j.anchor.midX,i.y=j.anchor.midY,i.parentId=j.laneId;let t=me(j.anchor.midX,j.anchor.midY,p,m),n=l.findIndex(t=>t.labelId===e);n>=0?l[n]={labelId:e,rect:t}:l.push({labelId:e,rect:t})}}}function Ct(e,t){return e<t?`${e}::${t}`:`${t}::${e}`}function wt(e,n){let{nodeInfoById:r,realNodeRects:i}=ge(n),a=new Map;for(let e of n){let t=e.id;if(!e.isGroup&&e.isEdgeLabel){a.set(t,{w:e.width??0,h:e.height??0});continue}}let o=t((n,r,i,o)=>{let s=Ct(r,i),c=0,l=t(e=>{if(!e)return;let t=a.get(e);if(!t)return;let n=o===`x`?t.w/2:t.h/2;n>c&&(c=n)},`consider`);l(n.labelNodeId);for(let t of e){if(t===n||t.isLayoutOnly)continue;let e=t.start,r=t.end;!e||!r||Ct(e,r)===s&&l(t.labelNodeId)}return c>0?c+cr:0},`labelClearanceFor`);for(let t of e){if(t.isLayoutOnly)continue;let n=t.points;if(!H(n,or))continue;let a=ye(t,r,or);if(!a)continue;let{srcId:s,dstId:c,srcInfo:l,dstInfo:u,collinearX:d,collinearY:f}=a;if(d===f)continue;let p,m;if(d){let e=u.cy>l.cy;p={x:l.cx,y:e?l.rect.bottom:l.rect.top},m={x:u.cx,y:e?u.rect.top:u.rect.bottom}}else{let e=u.cx>l.cx;p={x:e?l.rect.right:l.rect.left,y:l.cy},m={x:e?u.rect.left:u.rect.right,y:u.cy}}if(K(p,m,i,[s,c],1))continue;let h=o(t,s,c,d?`x`:`y`),g=h>sr?h:sr,_=[0,g,-g];for(let n of _){let r={...p},a={...m};if(d){if(r.x+=n,a.x+=n,r.x<=l.rect.left||r.x>=l.rect.right||a.x<=u.rect.left||a.x>=u.rect.right)continue}else if(r.y+=n,a.y+=n,r.y<=l.rect.top||r.y>=l.rect.bottom||a.y<=u.rect.top||a.y>=u.rect.bottom)continue;if(!K(r,a,i,[s,c],1)&&!Se(r,a,e,t,{epsilon:or})){t.points=[r,a];break}}}}function Tt(e,n){let r=.001,{realNodeRects:i,labelNodeRects:a}=_e(n.values()),o=t((e,t)=>ce(t,r).map(n=>({...n,edge:e,interior:n.index>=1&&n.index<=t.length-3})),`segmentsFor`),s=t(()=>{let t=[];for(let n of e){if(n.isLayoutOnly)continue;let e=n.points;!e||e.length<2||t.push(...o(n,V(e)))}return t},`allSegments`),c=t((e,t)=>e.horizontal&&t.horizontal?R(e.a.x,e.b.x,t.a.x,t.b.x)>=8&&Math.abs(e.a.y-t.a.y)<7:e.vertical&&t.vertical?R(e.a.y,e.b.y,t.a.y,t.b.y)>=8&&Math.abs(e.a.x-t.a.x)<7:!1,`hasCrowdedParallelTrack`),l=t((t,n)=>{let s=t.start,l=t.end,u=o(t,n);if(u.length!==n.length-1)return!1;let d=[s,l].filter(e=>!!e),f=t.labelNodeId?[t.labelNodeId]:[];for(let e of u)if(K(e.a,e.b,i,d,-2)||K(e.a,e.b,a,f,-2))return!1;for(let n of e){if(n===t||n.isLayoutOnly)continue;let e=n.points;if(!(!e||e.length<2)){for(let t of u)for(let i of o(n,V(e)))if(c(t,i)||Ce(t.a,t.b,i.a,i.b,r))return!1}}return!0},`candidateIsSafe`),u=t((e,t)=>{let n=V(e.edge.points??[]);if(n.length<4||e.index>=n.length-1)return;let r=n.map(e=>({...e}));if(e.horizontal)r[e.index].y+=t,r[e.index+1].y+=t;else if(e.vertical)r[e.index].x+=t,r[e.index+1].x+=t;else return;return o(e.edge,r).length===r.length-1?r:void 0},`shiftedCandidate`),d=t((e,t)=>({x:e.x??(t.left+t.right)/2,y:e.y??(t.top+t.bottom)/2}),`nodeCenter`),f=t(e=>{let t=e.edge,r=V(t.points??[]);if(r.length!==4||e.index!==1)return;let i=t.start?n.get(t.start):void 0,a=t.end?n.get(t.end):void 0,o=i?U(i):void 0,s=a?U(a):void 0,c=r.slice(e.index+2);if(!(!i||!a||!o||!s||c.length===0))return{sourceCenter:d(i,o),targetCenter:d(a,s),sourceRect:o,tail:c}},`sourceDetourContextFor`),p=t((e,t,n,i,a,o)=>{let s=i.y>=n.y,c=s?a.bottom:a.top,l=c+(s?20:-20);if(s&&e.b.y<=l+r||!s&&e.b.y>=l-r)return;let u=e.a.x+t;return V([{x:n.x,y:c},{x:n.x,y:l},{x:u,y:l},{x:u,y:e.b.y},...o],r)},`verticalSourceDetour`),m=t((e,t,n,i,a,o)=>{let s=i.x>=n.x,c=s?a.right:a.left,l=c+(s?20:-20);if(s&&e.b.x<=l+r||!s&&e.b.x>=l-r)return;let u=e.a.y+t;return V([{x:c,y:n.y},{x:l,y:n.y},{x:l,y:u},{x:e.b.x,y:u},...o],r)},`horizontalSourceDetour`),h=t((e,t)=>{let n=f(e);if(n){if(e.vertical)return p(e,t,n.sourceCenter,n.targetCenter,n.sourceRect,n.tail);if(e.horizontal)return m(e,t,n.sourceCenter,n.targetCenter,n.sourceRect,n.tail)}},`sourceDetourCandidate`),g=[-7,7,-14,14,-21,21];for(let e=0;e<12;e++){let e=s(),t=!1;for(let n=0;n<e.length&&!t;n++)for(let r=n+1;r<e.length&&!t;r++){let i=e[n],a=e[r];if(i.edge===a.edge||!c(i,a))continue;let o=[i,a].filter(e=>e.interior);for(let e of o){for(let n of g){let r=u(e,n);if(r&&l(e.edge,r)){e.edge.points=r,t=!0;break}let i=h(e,n);if(i&&l(e.edge,i)){e.edge.points=i,t=!0;break}}if(t)break}}if(!t)return}}function Et(e,t,n,r){let i=t.x-e.x,a=t.y-e.y,o=r.x-n.x,s=r.y-n.y,c=i*s-a*o;if(Math.abs(c)<1e-10)return!1;let l=n.x-e.x,u=n.y-e.y,d=(l*s-u*o)/c,f=(l*a-u*i)/c,p=.01;return d>p&&d<1-p&&f>p&&f<1-p}function Dt(e){let t=e.nodes??[],n=e.edges??[],i=[];if(!n.length||!t.length)return i;let a=ve(t),o=[];for(let e of n){if(e.isLayoutOnly)continue;let t=e.points;if(!t||t.length<2)continue;let n=e.start,r=e.end,s=e.labelNodeId,c=e.id??`${n}->${r}`;for(let e of a)if(!(e.nodeId===n||e.nodeId===r)&&!(s&&e.nodeId===s)){for(let n=0;n<t.length-1;n++)if(le(t[n],t[n+1],e,-1)){i.push({type:`edge-node-overlap`,edgeId:c,targetId:e.nodeId,detail:`segment ${n} passes through node "${e.nodeId}"`});break}}for(let e=0;e<t.length-1;e++)o.push({edgeId:c,start:n,end:r,p1:t[e],p2:t[e+1]})}let s=new Set;for(let e=0;e<o.length;e++)for(let t=e+1;t<o.length;t++){let n=o[e],r=o[t];if(n.edgeId!==r.edgeId&&!(n.start===r.start||n.start===r.end||n.end===r.start||n.end===r.end)&&Et(n.p1,n.p2,r.p1,r.p2)){let e=n.edgeId<r.edgeId?`${n.edgeId}|${r.edgeId}`:`${r.edgeId}|${n.edgeId}`;s.has(e)||(s.add(e),i.push({type:`edge-edge-crossing`,edgeId:n.edgeId,targetId:r.edgeId,detail:`edges "${n.edgeId}" and "${r.edgeId}" cross`}))}}if(i.length>0){let e=i.filter(e=>e.type===`edge-node-overlap`).length,t=i.filter(e=>e.type===`edge-edge-crossing`).length;r.warn(`[SWIMLANE_VALIDATE] ${i.length} issue(s) detected: ${e} edge-node overlap(s), ${t} edge crossing(s)`);for(let e of i)r.warn(`[SWIMLANE_VALIDATE] ${e.type}: ${e.detail}`)}return i}function Ot(e,n){let r=e.nodes??[],i=e.edges??[],a=r.filter(e=>!e.isGroup);if((n===`LR`||n===`RL`)&&a.length>0&&!ot(e,n)||n===`BT`&&a.length>0&&!at(e))return;for(let e of i){if(e.isLayoutOnly)continue;let t=e.points;!t||t.length<2||(e.points=Oe(De(t)))}vt(i,r),wt(i,r),st(i,r);let o=new Map;for(let e of r)o.set(String(e.id),e);St(i,o),Me(i,o),ct(i,o),Tt(i,o),lt(i,o),ut(i,o),dt(i,o),mt(i,o);let s=t(()=>{_t(i,o),ht(i,o),gt(i,o),St(i,o),Ze(i,o),dt(i,o),St(i,o),Ze(i,o)},`finalizeRenderedEdges`);s(),Tt(i,o),s(),ft(i,o),pt(i,o),ft(i,o),pt(i,o)}function kt(e){let t=new Map(e.nodeById),n=new Set,r=[];for(let i of e.edges){if(!t.has(i.src)||!t.has(i.dst))continue;let e=`${i.id}:${i.src}->${i.dst}`;n.has(e)||(n.add(e),r.push(i))}return{nodes:[...t.keys()],edges:r,layout:e.layout,nodeById:t}}function At(e,t){return e.edges.filter(e=>e.dst===t)}function jt(e){let t=new Map;for(let n of e.nodes)t.set(n,[]);for(let n of e.edges)t.get(n.src).push(n.dst);return t}function Mt(e){let t=jt(e);for(let e of t.values())e.sort((e,t)=>e.localeCompare(t));return t}function Nt(e){let t=new Map;for(let n of e.nodes)t.set(n,0);for(let n of e.edges)t.set(n.dst,(t.get(n.dst)??0)+1);return t}function Pt(e){return[...e.entries()].filter(([,e])=>e===0).map(([e])=>e).sort((e,t)=>e.localeCompare(t))}function Ft(e,t=()=>!0){let n=new Map,r=new Map;for(let t of e.nodes)n.set(t,[]),r.set(t,[]);for(let i of e.edges)t(i)&&(r.get(i.src).push(i.dst),n.get(i.dst).push(i.src));return{preds:n,succs:r}}function It(e,t,n,r){let i=0;for(let t of e.nodes)r?.skipGroups&&e.nodeById.get(t)?.isGroup||(i=Math.max(i,n[t]??0));let a=Array.from({length:i+1},()=>[]);for(let i of t)r?.skipGroups&&e.nodeById.get(i)?.isGroup||a[Math.max(0,n[i]??0)].push(i);return a}function Lt(e){let t=Nt(e),n=Pt(t),r=[],i=Mt(e);for(;n.length;){let e=n.shift();r.push(e);for(let r of i.get(e)??[])if(t.set(r,(t.get(r)??0)-1),(t.get(r)??0)===0){let e=0;for(;e<n.length&&n[e]<r;)e++;n.splice(e,0,r)}}return r.length===e.nodes.length?r:null}function Rt(e){let t=new Map,n=0;for(let r of e)t.set(r,n),n++;return t}function zt(e){let n=Array(e.length),r=t((t,i)=>{if(i-t<=1)return 0;let a=t+i>>1,o=r(t,a)+r(a,i),s=t,c=a,l=t;for(;s<a||c<i;)c>=i||s<a&&e[s]<=e[c]?n[l++]=e[s++]:(n[l++]=e[c++],o+=a-s);for(let r=t;r<i;r++)e[r]=n[r];return o},`count`);return r(0,e.length)}function Bt(e){let n=kt(e),r=new Map;for(let e of n.nodes)r.set(e,[]);for(let e of n.edges)r.get(e.src).push(e);for(let e of r.values())e.sort((e,t)=>e.dst===t.dst?e.id.localeCompare(t.id):e.dst.localeCompare(t.dst));let i=Object.create(null);for(let e of n.nodes)i[e]=0;let a=[],o=t(e=>{i[e]=1;for(let t of r.get(e)??[]){let e=t.dst;i[e]===0?o(e):i[e]===1&&a.push(t)}i[e]=2},`dfs`),s=[...n.nodes].sort((e,t)=>e.localeCompare(t));for(let e of s)i[e]===0&&o(e);let c=new Set(a.map(e=>`${e.id}:${e.src}->${e.dst}`)),l=n.edges.map(e=>c.has(`${e.id}:${e.src}->${e.dst}`)?{id:e.id,src:e.dst,dst:e.src,weight:e.weight,ref:e.ref}:e);return{acyclic:{nodes:[...n.nodes],edges:l,layout:n.layout,nodeById:new Map(n.nodeById)},reversed:a}}function Vt(e){let n=new Map,r=t(t=>{if(n.has(t))return n.get(t);let i=e.nodeById.get(t);if(!i)return n.set(t,null),null;let a=i.parentId;if(!a)return n.set(t,null),null;let o=r(a)??a;return n.set(t,o),o},`resolve`);for(let t of e.nodes)r(t);return n}function Ht(e){let t=Vt(e);return e=>t.get(e)??null}function Ut(e){let t=[];for(let n of e.layout.nodes??[])n.isGroup&&!n.parentId&&t.push(n.id);return[...new Set(t)].reverse()}function Wt(e,t){let n=Ut(e);if(!t||t.length===0)return n;let r=new Set(n),i=new Set,a=[];for(let e of t)!r.has(e)||i.has(e)||(i.add(e),a.push(e));for(let e of n)i.has(e)||a.push(e);return a}function Gt(e,n){let r=kt(e),i=n?.laneOf??(()=>null),a=n?.rankHint,{preds:o}=Ft(r);for(let e of o.values())e.sort((e,t)=>e.localeCompare(t));let s=Lt(r)??[...r.nodes].sort((e,t)=>e.localeCompare(t)),c=new Map;for(let[e,t]of s.entries())c.set(t,e);let l=new Map,u=new Map;for(let e of r.nodes)u.set(e,[]);for(let e of s){let t=(o.get(e)??[]).filter(e=>l.has(e));if(t.length>0){let n=Kt(e,t,{laneOf:i,rankHint:a,topoIndex:c});l.set(e,n),u.get(n).push(e)}else l.has(e)||l.set(e,null)}for(let e of r.nodes)l.has(e)||l.set(e,null);let d=new Set;for(let e of r.nodes)(l.get(e)??null)===null&&d.add(e);let f=[...d].sort((e,t)=>{let n=c.get(e)??0,r=c.get(t)??0;return n===r?e.localeCompare(t):n-r}),p=qt(r),m=new Map;for(let[e,t]of p.entries())m.set(e,[...t].sort((e,t)=>e.localeCompare(t)));let h=Jt(m),g=Yt(m),_=new Map;for(let e of r.nodes)_.set(e,[]);for(let e of g)for(let t of e.nodes){let n=_.get(t);n?n.push(e.id):_.set(t,[e.id])}let v=[],y=[],b=new Set,x=t(e=>{if(!b.has(e)){b.add(e),v.push(e);for(let t of u.get(e)??[])x(t);y.push(e)}},`walk`);for(let e of f)x(e);for(let e of s)x(e);return{parent:l,children:u,roots:f,componentOf:h,blocks:g,nodeBlocks:_,adjacency:m,preorder:v,postorder:y,topologicalOrder:s}}function Kt(e,t,n){let r=n.laneOf(e);return[...t].sort((e,t)=>{let i=n.laneOf(e),a=n.laneOf(t),o=i!=null&&i===r;if(o!==(a!=null&&a===r))return o?-1:1;let s=n.rankHint?.[e],c=n.rankHint?.[t];if(s!=null&&c!=null&&s!==c)return c-s;let l=n.topoIndex.get(e)??0,u=n.topoIndex.get(t)??0;return l===u?e.localeCompare(t):l-u})[0]}function qt(e){let t=new Map;for(let n of e.nodes)t.set(n,new Set);for(let n of e.edges)t.get(n.src).add(n.dst),t.get(n.dst).add(n.src);return t}function Jt(e){let t=new Map,n=0;for(let r of e.keys()){if(t.has(r))continue;let i=[r];for(;i.length>0;){let r=i.pop();if(!t.has(r)){t.set(r,n);for(let n of e.get(r)??[])t.has(n)||i.push(n)}}n++}return t}function Yt(e){let n=new Map,r=new Map,i=[],a=[],o=0,s=t((t,c)=>{n.set(t,++o),r.set(t,o);for(let l of e.get(t)??[])l!==c&&(n.has(l)?(n.get(l)??0)<(n.get(t)??0)&&(i.push([t,l]),r.set(t,Math.min(r.get(t)??o,n.get(l)??o))):(i.push([t,l]),s(l,t),r.set(t,Math.min(r.get(t)??o,r.get(l)??o)),(r.get(l)??0)>=(n.get(t)??0)&&a.push(Xt(t,l,i,a.length))))},`visit`);for(let t of e.keys())n.has(t)||s(t,null);return a}function Xt(e,t,n,r){let i=[],a=new Set;for(;n.length>0;){let r=n.pop();if(i.push(r),a.add(r[0]),a.add(r[1]),r[0]===e&&r[1]===t||r[0]===t&&r[1]===e)break}return{id:r,edges:i,nodes:[...a]}}function Zt(e,n,r){let i=[...e.nodes],a=new Map;for(let[e,t]of i.entries())a.set(t,e);let o=i.length,s=Array(o).fill(-1),c=Array(o).fill(0),l=[],u=new Set;for(let e of i){let t=r.parent.get(e)??null,n=a.get(e);n!=null&&(t??(s[n]=-1,c[n]=0,u.has(e)||(u.add(e),l.push(e))))}for(;l.length>0;){let e=l.shift(),t=a.get(e);if(t==null)continue;let n=r.children.get(e)??[];for(let e of n){if(u.has(e))continue;let n=a.get(e);n!=null&&(s[n]=t,c[n]=c[t]+1,u.add(e),l.push(e))}}for(let e of i){if(u.has(e))continue;let t=a.get(e);t!=null&&(s[t]=-1,c[t]=0,u.add(e))}let d=Math.max(1,Math.ceil(Math.log2(Math.max(1,o)))+1),f=Array.from({length:d},()=>Array(o).fill(-1));for(let e=0;e<o;e++)f[0][e]=s[e];for(let e=1;e<d;e++)for(let t=0;t<o;t++){let n=f[e-1][t];f[e][t]=n===-1?-1:f[e-1][n]}let p=t((e,t)=>{if(e===-1||t===-1)return-1;c[e]<c[t]&&([e,t]=[t,e]);let n=c[e]-c[t];for(let t=0;t<d;t++)if(n>>t&1&&(e=f[t][e],e===-1))return-1;if(e===t)return e;for(let n=d-1;n>=0;n--){let r=f[n][e],i=f[n][t];r===-1||i===-1||r!==i&&(e=r,t=i)}return f[0][e]},`lcaIndex`),m=Array.from({length:o},()=>new Map);for(let t of e.edges){let e=t.src,r=t.dst,i=n[e],o=n[r];if(i==null||o==null||(i>o&&([e,r]=[r,e],[i,o]=[o,i]),i==null||o==null||i===o))continue;let s=a.get(e),c=a.get(r);if(s==null||c==null)continue;let l=p(s,c);if(l===-1)continue;let u=m[l];for(let e=i;e<o;e++)u.set(e,(u.get(e)??0)+1)}let h=new Map,g=t((e,t)=>{if(t.size!==0)for(let[n,r]of t)e.set(n,(e.get(n)??0)+r)},`mergeInto`),_=new Set,v=t(e=>{let t=a.get(e);_.add(e);let i=t==null?void 0:m[t],o=i?new Map(i):new Map,s=r.children.get(e)??[];for(let t of s){let r=v(t),i=n[e];if(i!=null){let a=h.get(e);a||(a=new Map,h.set(e,a));let o=r.get(i)??0,s=n[t];s!=null&&s>i&&(o+=1),a.set(t,o)}g(o,r)}return o},`dfs`);for(let e of r.roots)_.has(e)||v(e);for(let e of i)_.has(e)||v(e);return h}function Qt(e,n,r){let i=new Map,a=t(e=>{let t=r[e]??0,o=[...n.get(e)??[]];o.sort($t(r));for(let e of o){a(e);let n=i.get(e);n!=null&&(t=Math.min(t,n))}i.set(e,t)},`annotate`);for(let t of e)a(t);return i}function $t(e){return(t,n)=>{let r=e[t]??0,i=e[n]??0;return r===i?t.localeCompare(n):r-i}}function en(e,n,r,i){let a=0;for(let e of n){let t=r[e]??0;t>a&&(a=t)}let o=Array.from({length:a+1},()=>[]),s=new Set,c=t(e=>{if(s.has(e))return;s.add(e);let t=r[e]??0;o[t]||(o[t]=[]),o[t].push(e);for(let t of i(e))c(t)},`emit`);for(let t of e)c(t);for(let e of n)if(!s.has(e)){let t=r[e]??0;o[t]||(o[t]=[]),o[t].push(e),s.add(e)}return o}function tn(e){let t=[];for(let n of e){let e=new Set,r=[];for(let t of n)e.has(t)||(e.add(t),r.push(t));t.push(r)}return t}function nn(e,t,n,r){return i=>{let a=e.get(i)??[];if(a.length===0)return[];let o=t[i]??0,s=[],c=[],l=n.get(i);for(let e of a){let t=r.get(e)??o;t>o?s.push({child:e,min:t}):c.push(e)}return s.sort((e,t)=>e.min===t.min?e.child.localeCompare(t.child):e.min-t.min),c.sort((e,t)=>{let n=l?.get(e)??0,i=l?.get(t)??0;if(n!==i)return n-i;let a=r.get(e)??o,s=r.get(t)??o;return a===s?e.localeCompare(t):a-s}),[...s.map(e=>e.child),...c]}}function rn(e,t,n){let r=Gt(e,{rankHint:t,laneOf:n}),{children:i,roots:a}=r;for(let t of e.nodes)i.has(t)||i.set(t,[]);let o=Zt(e,t,r),s=[...a].sort($t(t)),c=nn(i,t,o,Qt(s,i,t)),l=en(s,e.nodes,t,c);return l=tn(l),l}function an(e,t,n){let r=new Set(e),i=new Set(t),a=Rt(t),o=[];for(let e of n)r.has(e.src)&&i.has(e.dst)&&o.push(a.get(e.dst));return zt(o)}function on(e,t,n){let r=[];for(let e of t){let t=n[e.src],i=n[e.dst];if(t==null||i==null||t===i)continue;let a=e.src,o=e.dst,s=t,c=i;t>i&&(a=e.dst,o=e.src,s=i,c=t);for(let t=s;t<c;t++)r.push({id:`${e.id}@${t}`,src:a,dst:o,ref:e.ref})}let i=0;for(let t=0;t+1<e.length;t++)i+=an(e[t],e[t+1],r);return i}function sn(e,t){let n={...t},{preds:r}=Ft(e),i=Ht(e),a=on(rn(e,n,i),e.edges,n),o=ur.MAX_CROSSING_OPTIMIZATION_PASSES;for(let t=0;t<o;t++){let t=!1,o=[...e.nodes].sort((e,t)=>(n[t]??0)-(n[e]??0));for(let s of o){let o=n[s]??0;if(o===0)continue;let c=0;for(let e of r.get(s)??[])c=Math.max(c,(n[e]??0)+1);if(c>=o)continue;let l=o;n[s]=c;let u=on(rn(e,n,i),e.edges,n);u<a?(a=u,t=!0):n[s]=l}if(!t)break}return n}function cn(e,t){let n=Ht(e),r=[...e.nodes].sort((e,n)=>(t[e]??0)-(t[n]??0)||e.localeCompare(n));for(let i of r){let r=n(i);if(!r)continue;let a=e.edges.filter(e=>e.src===i);if(a.length===0)continue;let o=!1,s=0;for(let e of a){let t=n(e.dst);t==null||t===r?o=!0:s++}if(s===0||o)continue;let c=0,l=!1;for(let t of e.edges){if(t.dst!==i)continue;let e=n(t.src);e&&(e===r?l=!0:c++)}if(c>0||!l)continue;let u=t[i]??0,d=u+s,f=0;for(let n of e.edges)n.dst===i&&(f=Math.max(f,(t[n.src]??0)+1));let p=Math.max(u,f,d);p!==u&&(t[i]=p)}}function ln(e,t){let n=kt(e),r=Lt(n)??[...n.nodes].sort(),i=t?.compactSingleInput??!1,a=Ht(n),o=Object.create(null);for(let e of r){let r=At(n,e),s=t?.ignoreCrossLaneEdges?r.filter(t=>{let n=a(t.src),r=a(e);return!n||!r?!0:n===r}):r;if(s.length===0)o[e]=0;else if(i&&s.length===1){let t=s[0].src;a(t)===a(e)?o[e]=(o[t]??0)+1:o[e]=o[t]??0}else{let t=-1/0;for(let e of s)t=Math.max(t,(o[e.src]??0)+1);o[e]=t===-1/0?0:t}}return(t?.optimizeRanksByCrossings??!1)&&(o=sn(n,o)),t?.ignoreCrossLaneEdges&&cn(n,o),{layers:rn(n,o,a),rankOf:o,dummy:new Set}}function un(e,n){let r=kt(e),i={...ln(r,{compactSingleInput:n?.compactSingleInput,ignoreCrossLaneEdges:n?.ignoreCrossLaneEdges,optimizeRanksByCrossings:n?.optimizeRanksByCrossings}).rankOf},a=Ht(r),{preds:o,succs:s}=Ft(r,e=>{if(n?.ignoreCrossLaneEdges){let t=a(e.src),n=a(e.dst);if(t&&n&&t!==n)return!1}return!0}),c=Lt(r)??[...r.nodes],l=[...c].reverse(),u=t((e,t)=>{let n=0;for(let t of o.get(e)??[])n=Math.max(n,(i[t]??0)+1);let r=1/0,a=s.get(e)??[];return a.length>0&&(r=Math.min(...a.map(e=>(i[e]??0)-1))),Number.isFinite(r)||(r=Math.max(n,t)),Math.min(Math.max(t,n),r)},`clampFeasible`),d=ur.GRAVITY_ITERATIONS,f=t(e=>{let t=!1;for(let n of e){let e=o.get(n)??[],r=s.get(n)??[];if(e.length===0&&r.length===0)continue;let a=e.length>0?e.reduce((e,t)=>e+(i[t]??0)+1,0)/e.length:i[n]??0,c=r.length>0?r.reduce((e,t)=>e+(i[t]??0)-1,0)/r.length:i[n]??0,l=u(n,Math.round((a+c)/2));l!==i[n]&&(i[n]=l,t=!0)}return t},`relaxOrder`);for(let e=0;e<d;e++){let e=f(c),t=f(l);if(!e&&!t)break}for(let e of c){let t=0;for(let n of o.get(e)??[])t=Math.max(t,(i[n]??0)+1);(i[e]??0)<t&&(i[e]=t)}for(let e of l){let t=s.get(e)??[];if(t.length>0){let n=Math.min(...t.map(e=>(i[e]??0)-1));(i[e]??0)>n&&(i[e]=n)}}return{layers:It(r,c,i),rankOf:i,dummy:new Set}}function dn(e){let t=Nt(e),n=Mt(e),r=Pt(t),i=[];for(;r.length>0;){let e=[];for(let a of r){i.push(a);for(let r of n.get(a)??[])t.set(r,(t.get(r)??0)-1),(t.get(r)??0)===0&&e.push(r)}r=e.sort((e,t)=>e.localeCompare(t))}return i.length===e.nodes.length?i:null}function fn(e,n){let r=kt(e),i=n?.direction===`LR`?dn(r)??[...r.nodes].sort():Lt(r)??[...r.nodes].sort(),a=Ht(r),o=t(e=>a(e)??e,`laneOf`),s=Object.create(null),c=new Map,l=t((e,t)=>n?.ignoreCrossLaneEdges??!0?+(o(e)===o(t)):1,`edgeWeight`);for(let e of i){if(r.nodeById.get(e)?.isGroup)continue;let t=At(r,e),n=0;if(t.length>0)for(let r of t){let t=r.src,i=s[t]??0;n=Math.max(n,i+l(t,e))}let i=o(e),a=c.get(i)??0,u=Math.max(n,a);s[e]=u,c.set(i,u+1)}return{layers:It(r,i,s,{skipGroups:!0}),rankOf:s,dummy:new Set}}function pn(e,n){let r=kt(n),{rankOf:i}=e,a=e.layers.map(e=>[...e]),o=new Set(e.dummy?[...e.dummy]:[]),s=0,c=new Map(r.nodeById),l=t(e=>{let t=`placeholder-${s++}`,n={id:t,isGroup:!1,isDummy:!0,width:0,height:0};for(c.set(t,n),o.add(t);a.length<=e;)a.push([]);return a[e].push(t),i[t]=e,t},`addDummyAt`),u=[...r.edges].sort((e,t)=>e.id===t.id?e.src===t.src?e.dst.localeCompare(t.dst):e.src.localeCompare(t.src):e.id.localeCompare(t.id)),d=[];for(let e of u){let t=i[e.src]??0,n=i[e.dst]??0;if(n-t<=1){d.push(e);continue}let r=e.src;for(let i=t+1,a=0;i<n;i++,a++){let t=l(i);d.push({id:`${e.id}#${a}`,src:r,dst:t,weight:e.weight,ref:e.ref}),r=t}let a=n-t-2;d.push({id:`${e.id}#${Math.max(a+1,0)}`,src:r,dst:e.dst,weight:e.weight,ref:e.ref})}let f={nodes:[...r.nodes,...[...o].filter(e=>!r.nodes.includes(e))],edges:d,layout:r.layout,nodeById:c};return{layering:{layers:a,rankOf:i,dummy:o},graphWithDummies:f}}function mn(e){let t=e.length;if(t===0)return 1/0;let n=[...e].sort((e,t)=>e-t);return t%2==1?n[(t-1)/2]:.5*(n[t/2-1]+n[t/2])}function hn(e){return e.length===0?1/0:e.reduce((e,t)=>e+t,0)/e.length}function gn(e,t,n,r){let i=new Map;for(let t of e)i.set(t,[]);for(let e of n)r===`down`?t.has(e.src)&&i.has(e.dst)&&i.get(e.dst).push(t.get(e.src)):t.has(e.dst)&&i.has(e.src)&&i.get(e.src).push(t.get(e.dst));return i}function _n(e,t,n){let r=n.get(e)??0,i=n.get(t)??0;return r===i?e.localeCompare(t):r-i}function vn(e,t,n){let r=new Set(e),i=new Set(t),a=Rt(e),o=Rt(t),s=[];for(let e of n)r.has(e.src)&&i.has(e.dst)&&s.push({u:a.get(e.src),v:o.get(e.dst)});return s.sort((e,t)=>e.u===t.u?e.v-t.v:e.u-t.u),zt(s.map(e=>e.v))}function yn(e,t,n){return[...e].sort((e,r)=>{let i=mn(t.get(e)??[]),a=mn(t.get(r)??[]);return i===a?_n(e,r,n):isFinite(i)?isFinite(a)?i-a:-1:1})}function bn(e,t,n,r,i,a){let o=Rt(e),s=Rt(t),c=gn(t,o,n,r);if(!i||!a||a.length===0)return yn(t,c,s);let l=new Map;for(let e of t){let t=i(e),n=l.get(t)??[];n.push(e),l.set(t,n)}let u=[];for(let e of a){let t=l.get(e);if(!t||t.length===0)continue;let n=yn(t,c,s);u.push(...n)}let d=l.get(null);if(d&&d.length>0){let e=yn(d,c,s);for(let t of e){let e=hn(c.get(t)??[]),n=u.length;if(isFinite(e)){for(let[t,r]of u.entries())if(e<hn(c.get(r)??[])){n=t;break}}u.splice(n,0,t)}}return u}function xn(e,n,r,i,a){let o=[...n],s=new Set(e),c=new Set(n),l=i?new Set(i):null,u=r.filter(e=>s.has(e.src)&&c.has(e.dst)),d=l?r.filter(e=>c.has(e.src)&&l.has(e.dst)):void 0,f=t(t=>{let n=vn(e,t,u);return d&&i&&(n+=vn(t,i,d)),n},`crossingScore`),p=a?new Map:null;if(a&&p)for(let e of n)p.set(e,a(e));let m=!0,h=f(o);for(;m;){m=!1;for(let e=0;e+1<o.length;e++){if(p&&p.get(o[e])!==p.get(o[e+1]))continue;let t=h;[o[e],o[e+1]]=[o[e+1],o[e]];let n=f(o);n<t?(h=n,m=!0):[o[e],o[e+1]]=[o[e+1],o[e]]}}return o}function Sn(e,t,n){let r=e.layers.map(e=>[...e]),i=t.edges,a=Ht(t),o=Wt(t,n?.laneOrder);for(let e=0;e<3;e++){for(let e=1;e<r.length;e++)r[e]=bn(r[e-1],r[e],i,`down`,a,o),r[e]=xn(r[e-1],r[e],i,r[e+1],a);for(let e=r.length-2;e>=0;e--)r[e]=bn(r[e+1],r[e],i,`up`,a,o),r[e]=xn(r[e+1],r[e],i,r[e-1],a)}return{layers:r}}function Cn(e,n,r){let i=r?.layerGap??dr.DEFAULT_LAYER_GAP,a=r?.nodeGap??dr.DEFAULT_NODE_GAP,o=r?.laneGap??a*2,s=r?.direction??`TB`,c=s===`LR`||s===`RL`,l=e.layers,u=Object.create(null),d=Object.create(null),f=t(e=>n.nodeById.get(e),`getNode`),p=t(e=>f(e)?.width??0,`getWidth`),m=t(e=>f(e)?.height??0,`getHeight`),h=Ht(n),g=Wt(n,r?.laneOrder),_=l.map(e=>e.reduce((e,t)=>Math.max(e,m(t)),0)),v=[];if(c)for(let e=0;e+1<l.length;e++){let t=l[e].reduce((e,t)=>Math.max(e,p(t)),0),n=l[e+1].reduce((e,t)=>Math.max(e,p(t)),0),r=_[e],a=_[e+1],o=r/2+a/2,s=(t+n)/2,c=Math.max(0,s-o-i);v.push(c)}let y=new Set;for(let e of l)for(let t of e)y.add(h(t));let b=y.has(null),x=g.filter(e=>y.has(e)),S=[...b?[null]:[],...x],C=Object.create(null);for(let e of x)C[e]=0;b&&(C.null=0);for(let e of l){let t=Object.create(null),n=[];for(let r of e){let e=h(r);e===null?n.push(r):(t[e]||=[]).push(r)}for(let[e,n]of Object.entries(t)){let t=n.reduce((e,t)=>e+p(t),0)+a*Math.max(0,n.length-1);C[e]=Math.max(C[e]??0,t)}if(b&&n.length){let e=n.reduce((e,t)=>e+p(t),0)+a*Math.max(0,n.length-1);C.null=Math.max(C.null??0,e)}}let w=new Map;{let e=S.map(e=>(e===null?C.null:C[e])??0),t=-(e.reduce((e,t)=>e+t,0)+o*Math.max(0,S.length-1))/2;for(let n=0;n<S.length;n++){let r=S[n],i=e[n]??0,a=t+i/2;w.set(r,a),t+=i,n<S.length-1&&(t+=o)}}let T=0;for(let[e,t]of l.entries()){let n=_[e]??0,r=new Map;for(let e of t){let t=h(e),n=r.get(t)??[];n.push(e),r.set(t,n)}for(let e of S){let t=r.get(e)??[];if(t.length===0)continue;let i=w.get(e);if(t.length===1){let e=t[0];u[e]=i,d[e]=T+n/2}else{let e=t.map(e=>p(e)),r=i-(e.reduce((e,t)=>e+t,0)+a*(t.length-1))/2;for(let[i,o]of t.entries()){let t=e[i];u[o]=r+t/2,d[o]=T+n/2,r+=t+a}}}let o=v[e]??0;T+=n+i+o}let E=new Map;for(let e of n.edges){let t=e.ref.id;E.has(t)||E.set(t,[]),E.get(t).push(e)}for(let[,e]of E){if(e.length===0)continue;let t=e[0].ref,r=t.start,i=t.end;if(r==null||i==null)continue;let a=Math.round(((u[r]??0)+(u[i]??0))/2),o=new Set;for(let t of e)o.add(t.src),o.add(t.dst);for(let e of o)e===r||e===i||n.nodeById.get(e)?.isDummy&&(u[e]=a)}return{x:u,y:d}}function wn(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return t>>>0}function Tn(e){let t=e>>>0;return()=>{t+=1831565813;let e=t;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}}function En(e,t){let n=[...e],r=Tn(t);for(let e=n.length-1;e>0;e--){let t=Math.floor(r()*(e+1));[n[e],n[t]]=[n[t],n[e]]}return n}function Dn(e,t){let n=0;for(let[r,i]of e.entries())n+=Math.abs(r-(t.get(i)??r));return n}function On(e,t){let n=new Map;for(let[t,r]of e.entries())n.set(r,t);let r=0;for(let{a:e,b:i,weight:a}of t){let t=n.get(e),o=n.get(i);t==null||o==null||(r+=a*Math.abs(t-o))}return r}function kn(e){let t=Ut(e);if(t.length<2)return[];let n=new Map(t.map((e,t)=>[e,t])),r=Ht(e),i=new Map;for(let t of e.layout.edges??[]){if(t.isLayoutOnly)continue;let a=typeof t.start==`string`?t.start:void 0,o=typeof t.end==`string`?t.end:void 0;if(!a||!o||!e.nodeById.has(a)||!e.nodeById.has(o))continue;let s=r(a),c=r(o);if(!s||!c||s===c)continue;let l=n.get(s),u=n.get(c);if(l==null||u==null)continue;let[d,f]=l<=u?[s,c]:[c,s],p=`${d}\0${f}`,m=i.get(p);m?m.weight++:i.set(p,{a:d,b:f,weight:1})}return[...i.values()]}function An(e,t,n){let r=[...e],i=On(r,t),a=!0,o=0,s=Math.max(1,r.length);for(;a&&o<s;){a=!1,o++;for(let e=0;e+1<r.length;e++){[r[e],r[e+1]]=[r[e+1],r[e]];let n=On(r,t);n<i?(i=n,a=!0):[r[e],r[e+1]]=[r[e+1],r[e]]}}return{order:r,cost:i,sourceDistance:Dn(r,n)}}function jn(e,t){return e.cost===t.cost?e.sourceDistance<t.sourceDistance:e.cost<t.cost}function Mn(e,t,n){let r=[...t].sort((e,t)=>e.a===t.a?e.b.localeCompare(t.b):e.a.localeCompare(t.a)).map(({a:e,b:t,weight:n})=>`${e}:${t}:${n}`).join(`|`);return wn(`${e.join(`|`)}#${r}#${n}`)}function Nn(e,t={}){let n=Ut(e);if(n.length<2)return n;let r=kn(e);if(r.length===0)return n;let i=new Map(n.map((e,t)=>[e,t])),a=An(n,r,i),o=Math.max(0,t.restarts??fr);for(let e=0;e<o;e++){let t=An(En(n,Mn(n,r,e)),r,i);jn(t,a)&&(a=t)}return a.order}function Pn(e,t){let n=t?.ignoreCrossLaneEdges??!0,r=t?.optimizeRanksByCrossings??!0,i=kt(e),a=t?.automaticLaneOrdering?Nn(i,{restarts:fr}):void 0,o=Bt(i),s=o.acyclic,{layering:c,graphWithDummies:l}=pn(n?fn(s,{compactSingleInput:t?.compactSingleInput??ur.DEFAULT_COMPACT_SINGLE_INPUT,ignoreCrossLaneEdges:!0,direction:t?.direction}):un(s,{compactSingleInput:t?.compactSingleInput??ur.DEFAULT_COMPACT_SINGLE_INPUT,ignoreCrossLaneEdges:!1,optimizeRanksByCrossings:r}),s),u=Sn(c,l,{laneOrder:a}),d=Cn(u,l,{layerGap:t?.layerGap,nodeGap:t?.nodeGap,direction:t?.direction,laneOrder:a});return{acyclic:s,reversed:o.reversed,layering:c,ordered:u,coordinates:d}}function Fn(e,t,n){let r=e.x??0,i=e.y??0,a=t.x-r,o=t.y-i,s=Math.abs(a),c=Math.abs(o);return s<$&&c<$?n:c>$&&c*3>=s?o>0?`bottom`:`top`:s>$?a>0?`right`:`left`:n}function In(e,t){return Math.abs(e.to-t.from)<$||Math.abs(e.to-t.to)<$?e.to:e.from}function Ln(e,t){return e.orient===`vertical`?{x:e.coord,y:t}:{x:t,y:e.coord}}function Rn(e,n){let r=e.nodes??[],i=e.edges??[],a=[];for(let e of i)e.isLayoutOnly||a.push({...e,__originalEdge:e});let o=new Map,s=new Map,c=[],l=n===`LR`;for(let e of r)o.set(e.id,e);let u=r.filter(e=>e.isGroup&&!e.parentId);for(let e of u){let n={id:e.id},i=t(e=>{s.set(e.id,n),r.filter(t=>t.parentId===e.id).forEach(i)},`assignLane`);i(e)}let d=r.filter(e=>!e.isGroup&&!e.isEdgeLabel).map(e=>{let t=e.width??10,n=e.height??10,r=e.x??0,i=e.y??0,a=pr;return{nodeId:e.id,minX:r-t/2-a,maxX:r+t/2+a,minY:i-n/2-a,maxY:i+n/2+a,visualXHalfExtent:l?n/2+a:t/2+a}}),f=t((e,t,n,r)=>{let i=c.find(n=>n.orientation===e&&Math.abs(n.coord-t)<1);return i||(i={id:`pipe-${e}-${t.toFixed(0)}`,orientation:e,coord:t,spanMin:n,spanMax:r,tracks:[]},c.push(i)),i.spanMin=Math.min(i.spanMin,n),i.spanMax=Math.max(i.spanMax,r),i},`getOrAddPipe`),p=t((e,t)=>{let n=e.width??10,r=e.height??10,i=e.x??0,a=e.y??0;switch(t){case`top`:return{x:i,y:a-r/2};case`bottom`:return{x:i,y:a+r/2};case`left`:return{x:i-n/2,y:a};case`right`:return{x:i+n/2,y:a}}},`portForSide`),m=t((e,t,n)=>p(e,Fn(e,t,n?`bottom`:`top`)),`getOrthogonalPort`),h=[],g=[],_=new Set,v=1e3,y=t((e,t,n)=>{if(h.length===0)return 0;let r=Math.abs(t.y-n.y)<$,i=Math.abs(t.x-n.x)<$;if(!r&&!i)return 0;let a=0;if(r){let r=t.y,i=Math.min(t.x,n.x)-$,o=Math.max(t.x,n.x)+$;if(o<=i)return 0;for(let t of h)t.edgeIndex===e||t.orientation!==`vertical`||t.pipe.coord<i||t.pipe.coord>o||t.from-$<=r&&t.to+$>=r&&(a+=v)}else if(i){let r=t.x,i=Math.min(t.y,n.y)-$,o=Math.max(t.y,n.y)+$;if(o<=i)return 0;for(let t of h)t.edgeIndex===e||t.orientation!==`horizontal`||t.pipe.coord<i||t.pipe.coord>o||t.from-$<=r&&t.to+$>=r&&(a+=v)}return a},`crossingPenalty`),b=a.map((e,t)=>{if(!e.start||!e.end)return{idx:t,crossLane:0,dx:0,dy:0};let n=o.get(e.start),r=o.get(e.end),i=s.get(e.start),a=s.get(e.end);return{idx:t,crossLane:i&&a&&i.id!==a.id?1:0,dx:n&&r?Math.abs((r.x??0)-(n.x??0)):0,dy:n&&r?Math.abs((r.y??0)-(n.y??0)):0}}).sort((e,t)=>{if(e.crossLane!==t.crossLane)return t.crossLane-e.crossLane;let n=e.dx+e.dy,r=t.dx+t.dy;return Math.abs(n-r)>1?n-r:e.idx-t.idx}).map(e=>e.idx),x=t((e,t,n,r)=>{let i=Math.min(e.x,t.x),a=Math.max(e.x,t.x),o=Math.min(e.y,t.y),s=Math.max(e.y,t.y);return!!d.find(c=>n&&c.nodeId===n||r&&c.nodeId===r?!1:Math.abs(e.x-t.x)>$?c.minY<e.y&&c.maxY>e.y&&c.maxX>i&&c.minX<a:c.minX<e.x&&c.maxX>e.x&&c.maxY>o&&c.minY<s)},`isSegmentBlocked`),S=new Map,C=new Map;for(let e of a)!e.start||!e.end||e.start===e.end||(C.set(e.start,(C.get(e.start)??0)+1),C.set(e.end,(C.get(e.end)??0)+1));let w=t((e,t)=>Fn(e,t,`bottom`),`determineSide`),T=new Map;for(let[e,t]of a.entries()){if(!t.start||!t.end||t.start===t.end||t.points&&t.points.length>0)continue;let n=o.get(t.start),r=o.get(t.end);if(!n||!r)continue;let i=(r.x??0)-(n.x??0),a=(r.y??0)-(n.y??0);T.set(e,{edgeIdx:e,srcId:t.start,dstId:t.end,srcSide:w(n,{x:r.x??0,y:r.y??0}),dstSide:w(r,{x:n.x??0,y:n.y??0}),absDx:Math.abs(i),absDy:Math.abs(a),dxSign:Math.sign(i),dySign:Math.sign(a)})}let E=t(e=>e.srcSide===`top`||e.srcSide===`bottom`?e.absDx===0?1/0:e.absDy/e.absDx:e.absDy===0?1/0:e.absDx/e.absDy,`preferenceStrength`),D=t(e=>e.srcSide===`top`||e.srcSide===`bottom`?e.dxSign>=0?`right`:`left`:e.dySign>=0?`bottom`:`top`,`secondarySide`),O=new Map;for(let e of T.values()){let t=`${e.srcId}:${e.srcSide}`;O.has(t)||O.set(t,[]),O.get(t).push(e)}let k=new Map,A=t((e,t)=>`${e}:${t}`,`loadKey`);for(let e of T.values())k.set(A(e.srcId,e.srcSide),(k.get(A(e.srcId,e.srcSide))??0)+1),k.set(A(e.dstId,e.dstSide),(k.get(A(e.dstId,e.dstSide))??0)+1);for(let e of O.values())if(!(e.length<2)){e.sort((e,t)=>{let n=E(e),r=E(t);return Math.abs(n-r)>1e-9?r-n:e.edgeIdx-t.edgeIdx});for(let t=1;t<e.length;t++){let n=e[t],r=D(n),i=k.get(A(n.srcId,n.srcSide))??0,a=k.get(A(n.srcId,r))??0;a>=i||(k.set(A(n.srcId,n.srcSide),i-1),k.set(A(n.srcId,r),a+1),n.srcSide=r)}}let j=t(e=>{let t=e?.shape;return t===`question`||t===`diamond`},`isDiamondNode`),ee=new Map;for(let e of T.values())ee.has(e.dstId)||ee.set(e.dstId,new Set),ee.get(e.dstId).add(e.dstSide);for(let e of T.values()){if(!j(o.get(e.srcId)))continue;let t=ee.get(e.srcId);if(!t?.has(e.srcSide))continue;let n=D(e);if(t.has(n)||(k.get(A(e.srcId,n))??0)>0)continue;let r=k.get(A(e.srcId,e.srcSide))??0;k.set(A(e.srcId,e.srcSide),Math.max(0,r-1)),k.set(A(e.srcId,n),1),e.srcSide=n}for(let e of T.values()){let{edgeIdx:t,srcId:n,dstId:r,srcSide:i,dstSide:a}=e,s=o.get(n),c=o.get(r),l=`${n}:${i}:src`,u=i===`top`||i===`bottom`?c.x??0:c.y??0;S.has(l)||S.set(l,[]),S.get(l).push({edgeIdx:t,oppositeCoord:u});let d=`${r}:${a}:dst`,f=a===`top`||a===`bottom`?s.x??0:s.y??0;S.has(d)||S.set(d,[]),S.get(d).push({edgeIdx:t,oppositeCoord:f})}let te=new Map;for(let[e,t]of S){if(t.length<2)continue;t.sort((e,t)=>e.oppositeCoord-t.oppositeCoord);let n=e.split(`:`),r=n.slice(0,-2).join(`:`),i=n[n.length-2],a=n[n.length-1],s=o.get(r);if(!s)continue;let c=i===`left`||i===`right`?s.height??10:s.width??10,l=s.shape,u=l===`question`||l===`diamond`?c*.3:c,d=Math.min(20,Math.max(8,u/(t.length+1))),f=-(d*(t.length-1))/2;for(let[e,n]of t.entries()){let t=f+e*d,r=`${n.edgeIdx}:${a}`;te.set(r,t)}}let M=t(e=>!!a[e]?.labelNodeId,`edgeHasLabelNode`),ne=t((e,t)=>e?(S.get(`${e}:${t}:src`)??[]).some(({edgeIdx:e})=>M(e))||(S.get(`${e}:${t}:dst`)??[]).some(({edgeIdx:e})=>M(e)):!1,`faceHasLabelNode`),re=t((e,t,n)=>t===`top`||t===`bottom`?{x:e.x+n,y:e.y}:{x:e.x,y:e.y+n},`applyPortOffset`),ie=t((e,t,n)=>{let r=T.get(e),i={x:n.x??0,y:n.y??0},a={x:t.x??0,y:t.y??0},o=r?.srcSide??w(t,i),s=r?.dstSide??w(n,a),c=r?p(t,r.srcSide):m(t,i,!0),l=r?p(n,r.dstSide):m(n,a,!1),u=te.get(`${e}:src`),d=te.get(`${e}:dst`);return u!==void 0&&(c=re(c,o,u)),d!==void 0&&(l=re(l,s,d)),{pSrcPort:c,pDstPort:l,srcSide:o,dstSide:s}},`portsForEdge`);for(let e of b){let n=a[e];if(g[e]=[],!n.start||!n.end||n.points&&n.points.length>0||n.start===n.end)continue;let r=o.get(n.start),i=o.get(n.end);if(!r||!i)continue;let{pSrcPort:s,pDstPort:u,srcSide:p,dstSide:m}=ie(e,r,i),v={...s},b={...u},w=p===`top`||p===`bottom`,T=m===`top`||m===`bottom`;w?v.y=s.y>(r.y??0)?s.y+_r:s.y-_r:v.x=s.x>(r.x??0)?s.x+_r:s.x-_r,T?b.y=u.y>(i.y??0)?u.y+_r:u.y-_r:b.x=u.x>(i.x??0)?u.x+_r:u.x-_r;let E=t((e,t)=>{for(let n of d)if(!t.includes(n.nodeId)&&e.x>n.minX&&e.x<n.maxX&&e.y>n.minY&&e.y<n.maxY)return{inside:!0,obstacle:n};return{inside:!1}},`isPointInObstacle`),D=t((e,t,n,r,i)=>{if(i){let i=e.y>(t.y??0);return{x:(n.x??0)>=e.x?r.maxX+mr:r.minX-mr,y:i?r.maxY+hr:r.minY-hr,leavesPositiveSide:i}}let a=e.x>(t.x??0),o=(n.y??0)>=e.y;return{x:a?r.maxX+mr:r.minX-mr,y:o?r.maxY+hr:r.minY-hr,leavesPositiveSide:a}},`obstacleDetour`),O=[],k=[n.start,n.end],A=E(v,k);if(A.inside&&A.obstacle){let e=A.obstacle;if(w){let t=D(s,r,i,e,!0);v.x=t.x,v.y=t.y;let n=t.leavesPositiveSide?Math.min(e.minY-2,s.y+_r):Math.max(e.maxY+2,s.y-_r);O=[{x:s.x,y:n},{x:t.x,y:n},{x:t.x,y:t.y}]}else{let t=D(s,r,i,e,!1),n=t.leavesPositiveSide?Math.min(e.minX-2,s.x+_r):Math.max(e.maxX+2,s.x-_r);v.x=t.x,v.y=t.y,O=[{x:n,y:s.y},{x:n,y:t.y},{x:t.x,y:t.y}]}}let j=[],ee=E(b,k);if(ee.inside&&ee.obstacle){let e=ee.obstacle;if(T){let t=D(u,i,r,e,!0);b.x=t.x,b.y=t.y,j=[{x:t.x,y:t.y},{x:u.x,y:t.y}]}else{let t=D(u,i,r,e,!1);b.x=t.x,b.y=t.y,j=[{x:t.x,y:t.y},{x:t.x,y:u.y}]}}if(O.length===0&&j.length===0){let t=mr,r=Math.abs(v.x-b.x)<t,i=Math.abs(v.y-b.y)<t,a=te.get(`${e}:src`)!==void 0||te.get(`${e}:dst`)!==void 0,o=(S.get(`${n.start??``}:${p}:src`)?.length??0)+(S.get(`${n.start??``}:${p}:dst`)?.length??0),c=(S.get(`${n.end??``}:${m}:src`)?.length??0)+(S.get(`${n.end??``}:${m}:dst`)?.length??0),l=o>1||c>1,d=C.get(n.start??``)??0,f=C.get(n.end??``)??0,g=o>1&&ne(n.start,p)||c>1&&ne(n.end,m);if((r||i)&&!a&&(!l||l&&!g&&(o<=1||d<=2)&&(c<=1||f<=2))&&!x(s,u,n.start,n.end)){n.points=[{...s},{...v},{...b},{...u}],_.add(e);let t=i?`horizontal`:`vertical`,r=i?s.y:s.x,a=i?Math.min(s.x,u.x):Math.min(s.y,u.y),o=i?Math.max(s.x,u.x):Math.max(s.y,u.y),c={id:`fast-path-${t}-${r.toFixed(0)}-${e}`,orientation:t,coord:r,spanMin:a,spanMax:o,tracks:[]};h.push({edgeIndex:e,segmentIndex:0,orientation:t,pipe:c,trackIndex:0,from:a,to:o});continue}}v.x=f(`vertical`,v.x,v.y,v.y).coord,b.x=f(`vertical`,b.x,b.y,b.y).coord;let M=Math.min(v.x,b.x)-50,re=Math.max(v.x,b.x)+50,ae=Math.min(v.y,b.y)-50,oe=Math.max(v.y,b.y)+50;for(let e of d){let t=Math.min(v.x,b.x),n=Math.max(v.x,b.x),r=Math.min(v.y,b.y),i=Math.max(v.y,b.y);e.minX<n&&e.maxX>t&&e.minY<i&&e.maxY>r&&(M=Math.min(M,e.minX-gr),re=Math.max(re,e.maxX+gr),ae=Math.min(ae,e.minY-gr),oe=Math.max(oe,e.maxY+gr))}for(let e of d){if(e.maxX<M||e.minX>re||e.maxY<ae||e.minY>oe)continue;let t=mr;f(`horizontal`,e.minY-t,M,re),f(`horizontal`,e.maxY+t,M,re);let n=hr;f(`vertical`,e.minX-n,ae,oe),f(`vertical`,e.maxX+n,ae,oe)}f(`horizontal`,v.y,M,re),f(`horizontal`,b.y,M,re);let se=c.filter(e=>e.orientation===`horizontal`&&e.coord>=ae&&e.coord<=oe),N=c.filter(e=>e.orientation===`vertical`&&e.coord>=M&&e.coord<=re),P=t((e,t)=>`${e.toFixed(1)},${t.toFixed(1)}`,`getKey`),F=P(v.x,v.y),I=P(b.x,b.y),L=new Map,R=new Map,z=new Map,ce=new Set,B=[];L.set(F,0),z.set(F,`n`),B.push({key:F,f:Math.hypot(b.x-v.x,b.y-v.y),pt:v}),ce.add(F);let V=[],H=t((e,t)=>x(e,t,n.start,n.end),`checkSegmentBlocked`),le={x:b.x,y:v.y},ue=H(v,le),de=H(le,b),fe=ue||de,pe={x:v.x,y:b.y},me=H(v,pe),U=H(pe,b);if(fe?me||U||(V=Math.abs(v.x-b.x)<$?[v,b]:[v,pe,b]):V=Math.abs(v.y-b.y)<$||Math.abs(v.x-b.x)<$?[v,b]:[v,le,b],V.length===0)for(;B.length>0;){B.sort((e,t)=>e.f-t.f);let t=B.shift();if(ce.delete(t.key),t.key===I){let e=I,t=b;for(V=[t];R.has(e);){let n=R.get(e);V.unshift(n),t=n,e=P(n.x,n.y)}break}let r=t.pt.x,i=t.pt.y,a=N.sort((e,t)=>e.coord-t.coord),o=a.findIndex(e=>Math.abs(e.coord-r)<1),s=se.sort((e,t)=>e.coord-t.coord),c=s.findIndex(e=>Math.abs(e.coord-i)<1),l=[];o>0&&l.push({x:a[o-1].coord,y:i}),o>=0&&o<a.length-1&&l.push({x:a[o+1].coord,y:i}),c>0&&l.push({x:r,y:s[c-1].coord}),c>=0&&c<s.length-1&&l.push({x:r,y:s[c+1].coord});for(let a of l){let o=Math.min(r,a.x),s=Math.max(r,a.x),c=Math.min(i,a.y),l=Math.max(i,a.y);if(d.some(e=>e.nodeId===n.start||e.nodeId===n.end?!1:o===s?e.minX<r&&e.maxX>r&&e.maxY>c&&e.minY<l:e.minY<i&&e.maxY>i&&e.maxX>o&&e.minX<s))continue;let u=P(a.x,a.y),f=Math.abs(a.x-r)+Math.abs(a.y-i),p=y(e,t.pt,a),m=0,h=b.x-v.x,g=b.y-v.y,_=a.x-r,x=a.y-i;(g>10&&x<-5||g<-10&&x>5)&&(m=Math.abs(x)*100),(h>10&&_<-5||h<-10&&_>5)&&(m+=Math.abs(_)*50);let S=0,C=z.get(t.key)??`n`,w=Math.abs(_)>$?`h`:`v`;C!==`n`&&C!==w&&(S=50);let T=f+p+m+S,E=(L.get(t.key)??1/0)+T,D=Math.abs(b.x-a.x)+Math.abs(b.y-a.y);if(E<(L.get(u)??1/0))if(R.set(u,t.pt),L.set(u,E),z.set(u,w),!ce.has(u))B.push({key:u,f:E+D,pt:a}),ce.add(u);else{let e=B.findIndex(e=>e.key===u);e!==-1&&(B[e].f=E+D)}}}if(V.length===0&&(V=[v,{x:v.x,y:b.y},b]),V.length>4){let e=V[0],n=V[V.length-1],r=Math.min(e.x,n.x),i=Math.max(e.x,n.x),a=Math.min(e.y,n.y),o=Math.max(e.y,n.y);for(let e of V)r=Math.min(r,e.x),i=Math.max(i,e.x),a=Math.min(a,e.y),o=Math.max(o,e.y);let s=i>Math.max(e.x,n.x),c=r<Math.min(e.x,n.x);if(l){let t=hr;if(s){let r=Math.max(e.x,n.x),a=Math.min(e.y,n.y),o=Math.max(e.y,n.y),s=d.filter(e=>e.minX<r&&e.maxX>r&&e.minY<o&&e.maxY>a);if(s.length>0){let r=Math.max(e.x,n.x);for(let e of s){let n=(e.minX+e.maxX)/2;if(e.visualXHalfExtent===void 0||isNaN(e.visualXHalfExtent))continue;let i=n+e.visualXHalfExtent+t;r=Math.max(r,i)}isNaN(r)||(i=r)}}if(c){let i=d.filter(r=>r.minX<Math.min(e.x,n.x)+t&&r.minY<Math.max(e.y,n.y)&&r.maxY>Math.min(e.y,n.y));if(i.length>0){let a=Math.min(e.x,n.x);for(let e of i){let n=(e.minX+e.maxX)/2-e.visualXHalfExtent-t;a=Math.min(a,n)}r=a}}}let u=t(t=>{let r=n.y>e.y,i=d.filter(t=>{let r=Math.min(e.x,n.x)<t.maxX&&Math.max(e.x,n.x)>t.minX,i=Math.min(e.y,n.y)<t.maxY&&Math.max(e.y,n.y)>t.minY;return r&&i}),a=i;if(l&&i.length>0){let e=i.filter(e=>e.minX<t&&e.maxX>t);e.length>0&&(a=e)}if(a.length===0)return n.y;let o=mr;if(r){let e=Math.max(...a.map(e=>e.maxY))+o;if(e<n.y-$)return e}else{let e=Math.min(...a.map(e=>e.minY))-o;if(e>n.y+$)return e}return n.y},`findBestReturnY`),f=t(t=>{let r=u(t),i={x:t,y:e.y},a={x:t,y:r},o={x:n.x,y:r},s=H(e,i),c=H(i,a),l=H(a,o),d=r===n.y?!1:H(o,n);return!s&&!c&&!l&&!d?Math.abs(r-n.y)<$?[e,i,a,n]:[e,i,a,o,n]:null},`trySimplifyWithDetourX`),p=s&&!c?f(i):c&&!s?f(r):null;p&&(V=p)}let W=[s,...O,...V,...j.reverse(),u];if(W.length>=3){let e=W[W.length-1],t=W[W.length-2],n=W[W.length-3],r=Math.abs(n.y-t.y)<$&&Math.abs(t.y-e.y)<$,i=Math.abs(n.x-t.x)<$&&Math.abs(t.x-e.x)<$;if(r){let r=Math.sign(t.x-n.x),i=Math.sign(e.x-n.x);r!==0&&r===i&&Math.abs(t.x-n.x)>Math.abs(e.x-n.x)&&W.splice(-2,1)}else if(i){let r=Math.sign(t.y-n.y),i=Math.sign(e.y-n.y);r!==0&&r===i&&Math.abs(t.y-n.y)>Math.abs(e.y-n.y)&&W.splice(-2,1)}}let G=[W[0]];for(let e=1;e<W.length-1;e++){if(e===1){G.push(W[e]);continue}let t=G[G.length-1],n=W[e],r=W[e+1];if(Math.abs(t.y-n.y)<$&&Math.abs(n.y-r.y)<$){if(n.x>t.x!=r.x>n.x){G.push(n);continue}continue}if(Math.abs(t.x-n.x)<$&&Math.abs(n.x-r.x)<$){if(n.y>t.y!=r.y>n.y){G.push(n);continue}continue}G.push(n)}G.push(W[W.length-1]);for(let t=0;t<G.length-1;t++){let n=G[t],r=G[t+1],i=Math.abs(n.x-r.x)<$?`vertical`:`horizontal`,a=i===`vertical`?n.x:n.y,o=i===`vertical`?Math.min(n.y,r.y):Math.min(n.x,r.x),s=i===`vertical`?Math.max(n.y,r.y):Math.max(n.x,r.x),c=f(i,a,o,s),l={edgeIndex:e,segmentIndex:t,orientation:i,pipe:c,trackIndex:0,from:o,to:s};h.push(l),g[e].push(h.length-1),c.tracks[0]||(c.tracks[0]={index:0,coord:c.coord,segments:[]}),c.tracks[0].segments.push({edgeIndex:e,segmentIndex:t,from:o,to:s})}}let ae=t((e,t)=>e.from<t.to&&t.from<e.to,`segmentsOverlap`),oe=t((e,t,n,r)=>{let i=!r.segments.some(n=>(n.edgeIndex!==t.edgeIndex||n.segmentIndex!==t.segmentIndex)&&ae(n,e)),a=!n.segments.some(n=>(n.edgeIndex!==e.edgeIndex||n.segmentIndex!==e.segmentIndex)&&ae(n,t));return i&&a?(e.trackIndex=r.index,t.trackIndex=n.index,n.segments=[...n.segments.filter(t=>t.edgeIndex!==e.edgeIndex||t.segmentIndex!==e.segmentIndex),{edgeIndex:t.edgeIndex,segmentIndex:t.segmentIndex,from:t.from,to:t.to}],r.segments=[...r.segments.filter(e=>e.edgeIndex!==t.edgeIndex||e.segmentIndex!==t.segmentIndex),{edgeIndex:e.edgeIndex,segmentIndex:e.segmentIndex,from:e.from,to:e.to}],!0):!1},`trySwapSegmentsAcrossTracks`),se=t(e=>{let t=e.tracks.length;return e.tracks[t]={index:t,coord:e.coord,segments:[]},t},`createNewTrack`),N=t((e,t)=>{let n=e.pipe.tracks[e.trackIndex];n.segments=n.segments.filter(t=>t.edgeIndex!==e.edgeIndex||t.segmentIndex!==e.segmentIndex),e.trackIndex=t,e.pipe.tracks[t].segments.push({edgeIndex:e.edgeIndex,segmentIndex:e.segmentIndex,from:e.from,to:e.to})},`moveSegmentToTrack`),P=t((e,t)=>{let n=g[e.edgeIndex];for(let r of n){let n=h[r];n.pipe===e.pipe&&N(n,t)}},`moveSegmentChainToTrack`),F=t(e=>{let t=g[e.edgeIndex],n=t.indexOf(h.indexOf(e)),r=[];return n>0&&r.push(h[t[n-1]]),n<t.length-1&&r.push(h[t[n+1]]),r},`getAdjacentSegmentsAlongEdge`),I=t((e,t)=>{if(e.orientation===t.orientation)return!1;let n=e.orientation===`horizontal`?e:t,r=e.orientation===`horizontal`?t:e;return r.pipe.coord>n.from&&r.pipe.coord<n.to&&n.pipe.coord>r.from&&n.pipe.coord<r.to},`haveAnyCrossing`),L=t((e,t)=>{for(let n of e.tracks)if(!n.segments.some(e=>(e.edgeIndex!==t.edgeIndex||e.segmentIndex!==t.segmentIndex)&&ae(e,t)))return n.index;return-1},`findAvailableTrack`),R=t((e,t)=>{if(e.trackIndex===t.trackIndex)return ae(e,t);let n=F(e),r=F(t);return n.some(e=>r.some(t=>I(e,t)))},`segmentsConflict`),z=t((e,t,n)=>{if(oe(e,t,e.pipe.tracks[e.trackIndex],t.pipe.tracks[t.trackIndex]))return;let r=L(e.pipe,t);n(t,r===-1?se(e.pipe):r)},`resolveTrackConflict`),ce=t(e=>{let t=0;for(let n=0;n<e.length;n++)for(let r=n+1;r<e.length;r++){let i=e[n],a=e[r];i.pipe===a.pipe&&R(i,a)&&(t++,z(i,a,P))}return t},`resolveHandleConflicts`),B=new Map,V=t(e=>{if(B.has(e))return B.get(e);let t=g[e];if(t.length===0){let t={dest:0,deviation:0,base:0,delta:0};return B.set(e,t),t}let n=h[t[0]].pipe.coord,r=n;for(let e=1;e<t.length;e++){let i=h[t[e]];if(i.orientation===`horizontal`){let e=i.from,t=i.to;r=Math.abs(e-n)>Math.abs(t-n)?e:t;break}}let i=Math.abs(r-n),a={dest:r,deviation:i,base:n,delta:r-n};return B.set(e,a),a},`getDestInfo`),H=t(()=>{let e=0,n=new Map;for(let[e,t]of a.entries())g[e].length!==0&&t.start&&(n.has(t.start)||n.set(t.start,[]),n.get(t.start).push(e));let r=t(e=>{let t=a[e];if(!t.start||!t.end)return 0;let n=o.get(t.start),r=o.get(t.end);if(!n||!r)return 0;let i=(r.x??0)-(n.x??0),s=(r.y??0)-(n.y??0);return Math.abs(i)+Math.abs(s)},`getEdgeDistance`);for(let t of n.values()){t.sort((e,t)=>{let n=V(e),i=V(t);if(Math.abs(n.deviation-i.deviation)>1)return n.deviation-i.deviation;if(Math.abs(n.dest-i.dest)>1)return n.dest-i.dest;let a=r(e),o=r(t);if(Math.abs(a-o)>1)return o-a;let s=g[e].length,c=g[t].length;if(s!==c)return s-c;if(s===1){let n=g[e][0],r=g[t][0];if(h[n]&&h[r]){let e=h[n],t=h[r],i=Math.abs(e.to-e.from),a=Math.abs(t.to-t.from);if(Math.abs(i-a)>1)return i-a}}return 0});let n=t.map(e=>h[g[e][0]]);e+=ce(n)}return e},`fixSourceHandleCrossings`),le=t(()=>{let e=0,n=new Map;for(let[e,t]of a.entries())g[e].length!==0&&t.end&&(n.has(t.end)||n.set(t.end,[]),n.get(t.end).push(e));for(let r of n.values()){r.sort((e,n)=>{let r=t(e=>{let t=g[e];if(t.length<2)return 0;let n=h[t[t.length-2]];return Math.abs(n.to-n.from)},`getDist`),i=r(e),a=r(n);return Math.abs(i-a)>.1?i-a:e-n});let n=r.map(e=>h[g[e][g[e].length-1]]);e+=ce(n)}return e},`fixTargetHandleCrossings`),ue=t(()=>{let e=0;for(let t of c){let n=[];for(let e of t.tracks)for(let t of e.segments){let e=g[t.edgeIndex].find(e=>h[e].segmentIndex===t.segmentIndex);e!==void 0&&n.push(h[e])}n.sort((e,t)=>e.edgeIndex-t.edgeIndex||e.segmentIndex-t.segmentIndex);for(let t=0;t<n.length;t++)for(let r=t+1;r<n.length;r++){let i=n[t],a=n[r];R(i,a)&&(e++,z(i,a,N))}}return e},`fixPipeCrossings`),de=0;for(;de<10;){let e=0;if(e+=H(),e+=le(),e+=ue(),e===0)break;de++}let fe=new Map;for(let e of c){let n=[];e.tracks.forEach(e=>{e.segments.forEach(t=>{n.push({edgeIndex:t.edgeIndex,segmentIndex:t.segmentIndex,trackIndex:e.index,from:t.from,to:t.to})})}),n.sort((e,t)=>e.from-t.from);let r=[];if(n.length>0){let e=[n[0]],t=n[0].to;for(let i=1;i<n.length;i++){let a=n[i];a.from<t?(e.push(a),t=Math.max(t,a.to)):(r.push(e),e=[a],t=a.to)}r.push(e)}for(let n of r){let r=new Set;n.forEach(e=>r.add(e.trackIndex));let i=new Map;n.forEach(e=>{let t=V(e.edgeIndex);i.set(e.trackIndex,(i.get(e.trackIndex)??0)+t.delta)});let a=[...r].filter(e=>(i.get(e)??0)<-1),o=[...r].filter(e=>(i.get(e)??0)>1),s=[...r].filter(e=>Math.abs(i.get(e)??0)<=1);a.sort((e,t)=>(i.get(t)??0)-(i.get(e)??0)),o.sort((e,t)=>(i.get(e)??0)-(i.get(t)??0));let c=t((t,r)=>{n.filter(e=>e.trackIndex===t).forEach(t=>{let n=_.has(t.edgeIndex)?e.coord:r;fe.set(`${t.edgeIndex}-${t.segmentIndex}`,n)})},`assignCoord`),l=0;for(let t of a)l++,c(t,e.coord-l*vr);if(s.length===0&&r.size>0){let e=[...r].sort((e,t)=>Math.abs(i.get(e)??0)-Math.abs(i.get(t)??0))[0],t=a.indexOf(e);t!==-1&&a.splice(t,1);let n=o.indexOf(e);n!==-1&&o.splice(n,1),s.push(e)}let u=0;for(let t of s){if(u===0)c(t,e.coord);else{let n=u%2==1?1:-1,r=Math.ceil(u/2);c(t,e.coord+n*r*vr*.5)}u++}let d=0;for(let t of o)d++,c(t,e.coord+d*vr)}}for(let[e,t]of a.entries()){let n=g[e]??[];if(n.length===0)continue;let r=[],{pSrcPort:i,pDstPort:a}=ie(e,o.get(t.start),o.get(t.end)),s=n.map(e=>{let t=h[e],n=fe.get(`${t.edgeIndex}-${t.segmentIndex}`)??t.pipe.coord;return{orient:t.orientation,coord:n,from:t.from,to:t.to}});r.push(i);for(let e=0;e<s.length;e++){let t=s[e],n=r[r.length-1],i=t.orient===`vertical`?n.y:n.x,a=t.orient===`vertical`?n.x:n.y,o=s[e+1],c=e<s.length-1;if(Math.abs(a-t.coord)>$&&r.push(Ln(t,i)),c&&o.orient===t.orient)if(Math.abs(t.coord-o.coord)>$){let e=t.orient===`vertical`?(i+o.from)/2:In(t,o);r.push(Ln(t,e),Ln(o,e))}else (e===0||e===s.length-2)&&r.push(Ln(t,In(t,o)));else if(c)r.push(Ln(t,o.coord));else{let e=Math.abs(t.from-i)<Math.abs(t.to-i)?t.to:t.from;r.push(Ln(t,e))}}let c=r[r.length-1];(Math.abs(c.x-a.x)>$||Math.abs(c.y-a.y)>$)&&r.push(a);let l=[];r.length>0&&l.push(r[0]);for(let e=1;e<r.length;e++){let t=r[e],n=l[l.length-1];(Math.abs(t.x-n.x)>$||Math.abs(t.y-n.y)>$)&&l.push(t)}t.points=l}for(let e of a){let t=e.__originalEdge;t&&e.points&&(t.points=e.points)}e.edges=(e.edges??[]).filter(e=>!e.isLayoutOnly);let pe=t((e,t)=>{let n=t.x??0,r=t.y??0,i=t.width??0,a=t.height??0;if(i<=0||a<=0)return e;let o=n-i/2,s=n+i/2,c=r-a/2,l=r+a/2;if(e.x<o||e.x>s||e.y<c||e.y>l)return e;let u=e.x-o,d=s-e.x,f=e.y-c,p=l-e.y,m=Math.min(u,d,f,p);return m===u?{x:o,y:e.y}:m===d?{x:s,y:e.y}:m===f?{x:e.x,y:c}:{x:e.x,y:l}},`nodeBoundaryClamp`);for(let t of e.edges){let e=t.points;if(!e||e.length<2)continue;let n=t.start,r=t.end,i=n?o.get(n):void 0,a=r?o.get(r):void 0;i&&(e[0]=pe(e[0],i)),a&&(e[e.length-1]=pe(e[e.length-1],a))}return e}function zn(e){return e.direction??`TB`}function Bn(e){let t=re(e),n=e.config.flowchart?.nodeSpacing??40,r=e.config.flowchart?.rankSpacing??100,i=e.config.swimlane?.ignoreCrossLaneEdges??!0,a=e.config.swimlane?.optimizeRanksByCrossings??!0,o=e.config.swimlane?.automaticLaneOrdering??!1,s=zn(e),{ordered:c,coordinates:l}=Pn(t,{nodeGap:n,layerGap:r,ignoreCrossLaneEdges:i,optimizeRanksByCrossings:a,automaticLaneOrdering:o,direction:s});ie(t,c,l,{nodeGap:n,layerGap:r});for(let t of e.edges??[])delete t.points;Rn(e,s);for(let t of e.edges??[])(!t.curve||t.curve===`basis`)&&(t.curve=`rounded`);return Ot(e,s),Dt(e),s}function Vn(e){ne(e);let t=ae(e);e.nodes=t.nodes,e.edges=t.edges}var Hn,Un,Wn,Gn,Kn,qn,Jn,Yn,q,J,Xn,Zn,Qn,$n,er,Y,X,Z,tr,nr,rr,Q,ir,ar,or,sr,cr,lr,ur,dr,fr,$,pr,mr,hr,gr,_r,vr,yr;e((()=>{h(),m(),f(),d(),u(),l(),c(),o(),s(),a(),i(),n(),Hn=5,Un=1e-5,Wn=1e-6,t(_,`buildSegmentList`),t(v,`segmentIntersection`),t(y,`isHorizontalSeg`),t(b,`findEdgeIntersections`),t(x,`fmt`),t(S,`pointToString`),t(C,`getArcSweepFlag`),Gn=.001,t(w,`applyMarkerOffsets`),t(T,`emitJump`),t(E,`computeRoundedCorner`),t(D,`rewriteEdgePath`),t(O,`isStraightPath`),t(k,`curveSupportsLineHops`),t(A,`decodeDataPoints`),t(j,`applyLineJumpsToSvg`),t(ee,`applySwimlaneLineJumps`),Kn=`__swimlane_default__`,qn=21,Jn=20,t(te,`topLaneHorizontalPadding`),t(M,`assignTopLaneTitleRect`),t(ne,`prepareLayoutForSwimlanes`),t(re,`toGraphView`),t(ie,`writeBackToLayoutData`),Yn=`[EdgeLabelNodes]`,t(ae,`createEdgeLabelNodes`),q=.001,t(oe,`measuredNodeRect`),t(se,`nodeBoundsInfoFor`),t(N,`samePoint`),t(P,`sameX`),t(F,`sameY`),t(I,`isHorizontalSegment`),t(L,`isVerticalSegment`),t(R,`overlapLength`),t(z,`sameAxisSegmentOverlapLength`),t(ce,`orthogonalSegmentsForPoints`),t(B,`countOrthogonalBends`),t(V,`dedupeConsecutivePoints`),t(H,`classifyThreeSegmentRoute`),t(le,`segmentBoundsOverlapRect`),t(ue,`pointInsideRect`),t(de,`rectContainsRect`),t(fe,`rectsOverlap`),t(pe,`inflateRect`),t(me,`rectFromCenterSize`),t(U,`rectOfNodeBounds`),t(W,`portForRectSide`),t(G,`buildOrthogonalPortPath`),t(he,`buildSameSideTrackPath`),t(ge,`collectRealNodeBounds`),t(_e,`collectNodeRectEntries`),t(ve,`collectLayoutNodeRects`),t(ye,`getNodePairGeometry`),t(K,`segmentHitsAnyRect`),t(be,`orthogonalSegmentsCross`),t(xe,`sameAxisSegmentsOverlap`),t(Se,`segmentConflictsWithAnyEdge`),t(Ce,`orthogonalSegmentsStrictlyCross`),t(we,`strictlyBetween`),t(Te,`isCollinearIntermediate`),t(Ee,`simplifyPolylineOnce`),t(De,`orthogonalizePolyline`),t(Oe,`simplifyPolyline`),J=.001,Xn=.5,Zn=4,t(ke,`endpointContextFor`),t(Ae,`segmentEnterPoint`),t(je,`clipEndpoint`),t(Me,`clipEdgeEndpointsToNodeBoundaries`),t(Ne,`snapEndpointToBoundary`),t(Pe,`firstDistinctAdjacent`),t(Fe,`cornerClearanceRange`),t(Ie,`clampToCornerClearance`),t(Le,`intersectRanges`),t(Re,`clearanceRangeForSide`),t(ze,`terminalSideForSegment`),t(Be,`isHorizontalSide`),t(Ve,`straightClearanceRange`),t(He,`clearStraightEndpointCornerAxis`),t(Ue,`clearStraightEndpointCornerConnections`),t(We,`cornerClearedEndpoint`),t(Ge,`moveCollinearEndpointRun`),t(Ke,`clearEndpointCornerConnection`),t(qe,`borderSideForSegment`),t(Je,`leavesOutward`),t(Ye,`collapseOwnBorderStub`),t(Xe,`snapAndCollapseEndpoints`),t(Ze,`prepareEdgeEndpointsForRenderer`),t(Qe,`buildNodeMap`),t($e,`resolveTopLevelGroupId`),t(et,`groupDepth`),t(tt,`boundsForChildren`),t(nt,`applyGroupBounds`),t(rt,`recomputeNestedGroupBounds`),t(it,`mirrorAxis`),t(at,`applyBtDirectionTransform`),t(ot,`applyLrDirectionTransform`),Qn=1e-6,$n=8,er=[0,$n,-$n,2*$n,-2*$n],t(st,`portSwapToLShape`),t(ct,`collapseShortTerminalStub`),Y=.001,X=8,Z=ce,tr=t((e,t)=>P(e,t,Y)||F(e,t,Y),`orthogonallyAligned`),t(lt,`separateSharedRenderedTerminalLanes`),t(ut,`collapseRedundantRectangularDoglegs`),t(dt,`liftObstacleHuggingSameSideRails`),t(ft,`liftTopLaneTitleBandsAboveRails`),t(pt,`shiftLeftLaneTitleBandsLeftOfRails`),t(mt,`swapDestinationTerminalTailsToReduceCrossings`),t(ht,`reassignCrossingExternalRailChannels`),t(gt,`shortcutRedundantOrthogonalJogs`),t(_t,`resolveRenderedOrthogonalCrossings`),nr=.001,rr=8,t(vt,`simplifyDetouredEdges`),Q=.001,ir=10,ar=7,t(yt,`markerClearanceRectFor`),t(bt,`normalizeRect`),t(xt,`labelOverlapsOwnMarker`),t(St,`anchorLabelsToPolyline`),or=1e-6,sr=8/2,cr=3,t(Ct,`pairKey`),t(wt,`straightenCollinearSiblingDetours`),t(Tt,`nudgeSharedInteriorSubpaths`),t(Et,`segmentsIntersect`),t(Dt,`validateSwimlanesLayout`),t(Ot,`postProcessSwimlaneLayout`),t(kt,`normalizeGraph`),t(At,`incoming`),t(jt,`buildSuccessorMap`),t(Mt,`buildSortedSuccessorMap`),t(Nt,`buildInDegreeMap`),t(Pt,`sortedZeroInDegreeNodes`),t(Ft,`buildPredecessorSuccessorMaps`),t(It,`buildLayersFromRanks`),t(Lt,`topoSortIfAcyclic`),t(Rt,`buildLayerIndex`),t(zt,`countInversions`),t(Bt,`removeCycles_DFS`),t(Vt,`buildTopLaneMap`),t(Ht,`createTopLaneResolver`),t(Ut,`buildTopLaneOrder`),t(Wt,`resolveTopLaneOrder`),lr={EPSILON:1e-6},ur={GRAVITY_ITERATIONS:8,MAX_CROSSING_OPTIMIZATION_PASSES:4,DEFAULT_COMPACT_SINGLE_INPUT:!0},dr={DEFAULT_LAYER_GAP:100,DEFAULT_NODE_GAP:40},t(Gt,`buildDrivingTree`),t(Kt,`chooseParent`),t(qt,`buildAdjacency`),t(Jt,`assignComponents`),t(Yt,`computeBlocks`),t(Xt,`popBlock`),t(Zt,`computeSubtreeCrossCounts`),t(Qt,`annotateMinimumLayers`),t($t,`compareByRankThenId`),t(en,`emitNodesInTreeOrder`),t(tn,`deduplicateLayers`),t(nn,`createChildOrderer`),t(rn,`buildMultitreeLayerOrder`),t(an,`countCrossingsBetweenAdjacent`),t(on,`totalCrossings`),t(sn,`optimizeRanksByCrossings`),t(cn,`adjustCrossLaneSources`),t(ln,`assignLayers_LongestPath`),t(un,`assignLayers_Gravity`),t(dn,`topoSortByGenerationIfAcyclic`),t(fn,`assignLayers_LaneAwareCompact`),t(pn,`makeProperLayering`),t(mn,`median`),t(hn,`barycenter`),t(gn,`neighborPositionsFor`),t(_n,`currentOrderTieBreak`),t(vn,`countCrossingsBetweenAdjacent`),t(yn,`sortByHeuristic`),t(bn,`reorderLayer`),t(xn,`transposeImprove`),t(Sn,`orderLayers`),t(Cn,`assignCoordinates`),fr=8,t(wn,`hashString`),t(Tn,`mulberry32`),t(En,`deterministicShuffle`),t(Dn,`sourceDistance`),t(On,`laneArrangementCost`),t(kn,`buildWeightedLaneEdges`),t(An,`greedySwitch`),t(jn,`isBetterCandidate`),t(Mn,`seedForRestart`),t(Nn,`optimizeTopLaneOrder`),t(Pn,`sugiyamaLayout`),$=lr.EPSILON,pr=8,mr=15,hr=15,gr=25,_r=20,vr=10,t(Fn,`chooseOrthogonalSide`),t(In,`sharedLineEndpointCoord`),t(Ln,`pointOnLine`),t(Rn,`routeEdgesOrthogonal`),t(zn,`getSwimlaneDirection`),t(Bn,`runSwimlaneLayoutCore`),t(Vn,`prepareSwimlaneLayout`),yr=g({prepareLayout:Vn,runLayoutCore:Bn,afterPaint:ee})}))();export{yr as render};